From: Andrea Amorese Date: Fri, 4 Feb 2022 14:25:22 +0000 (+0100) Subject: Built motion from commit ef9bfea2.|2.6.1 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22avatar.png//%27?a=commitdiff_plain;h=6965aa3248dd022453715a725e8909ef79db6a4f;p=motion2.git Built motion from commit ef9bfea2.|2.6.1 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index edbaf27..5cdd358 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-02-04T13:58:14.265Z", + "time": "2022-02-04T14:13:02.506Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 5af4ef6..68c386c 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-02-04T13:58:14.265Z", + "time": "2022-02-04T14:13:02.506Z", "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 0324f05..2ebf50c 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 _0x7697=['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[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','VIRTUAL','STRING','integration','jscripty'];(function(_0x18e2f3,_0xfea2ca){var _0x1ef3cb=function(_0x6bb00d){while(--_0x6bb00d){_0x18e2f3['push'](_0x18e2f3['shift']());}};_0x1ef3cb(++_0xfea2ca);}(_0x7697,0x10c));var _0x7769=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x7697[_0x2d8d69];return _0x39ae22;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7769('0x0')],'get':function(_0x5307cc){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x7769('0x1')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x7769('0x2'),'motionbar',_0x7769('0x3'),_0x7769('0x4'),_0x7769('0x5'),_0x7769('0x6'),_0x7769('0x7')]],'msg':_0x7769('0x8')}},'comment':_0x7769('0x8')},'data1':{'type':Sequelize[_0x7769('0x1')](0x1000),'comment':_0x7769('0x9')},'data2':{'type':Sequelize[_0x7769('0x1')](0x1000),'comment':_0x7769('0xa')},'data3':{'type':Sequelize[_0x7769('0x1')](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[_0x7769('0x1')](0x1000),'comments':_0x7769('0xb')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x7769('0xc')},'data6':{'type':Sequelize[_0x7769('0x1')],'comments':_0x7769('0xd')},'data7':{'type':Sequelize[_0x7769('0xe')],'comments':_0x7769('0xf')}}; \ No newline at end of file +var _0x130b=['STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','action','contactManager','integration','motionbar','jscripty','urlForward','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)]'];(function(_0x698f77,_0x12353a){var _0x3d7207=function(_0x43981a){while(--_0x43981a){_0x698f77['push'](_0x698f77['shift']());}};_0x3d7207(++_0x12353a);}(_0x130b,0x1b6));var _0xb130=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x130b[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0xb130('0x0'));module[_0xb130('0x1')]={'name':{'type':Sequelize[_0xb130('0x2')],'get':function(_0x21895d){return this['getDataValue'](_0xb130('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xb130('0x4'),_0xb130('0x5'),_0xb130('0x6'),_0xb130('0x7'),_0xb130('0x8'),'browser','bot',_0xb130('0x9')]],'msg':_0xb130('0xa')}},'comment':_0xb130('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xb130('0xb')},'data2':{'type':Sequelize[_0xb130('0xc')](0x1000),'comment':_0xb130('0xd')},'data3':{'type':Sequelize[_0xb130('0xc')](0x1000),'comment':_0xb130('0xe')},'data4':{'type':Sequelize[_0xb130('0xc')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xb130('0xc')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xb130('0xc')],'comments':_0xb130('0xf')},'data7':{'type':Sequelize[_0xb130('0x10')],'comments':_0xb130('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 49f9a8b..2625b52 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 _0xf4be=['../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','error','stack','name','send','body','Action','find','then','destroy','params','catch','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'];(function(_0x3a0def,_0x142b55){var _0x52f735=function(_0xf3c9e6){while(--_0xf3c9e6){_0x3a0def['push'](_0x3a0def['shift']());}};_0x52f735(++_0x142b55);}(_0xf4be,0x1c4));var _0xef4b=function(_0x30442,_0x4ef11e){_0x30442=_0x30442-0x0;var _0x2c8a82=_0xf4be[_0x30442];return _0x2c8a82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef4b('0x0'));var zipdir=require(_0xef4b('0x1'));var jsonpatch=require(_0xef4b('0x2'));var rp=require(_0xef4b('0x3'));var moment=require(_0xef4b('0x4'));var BPromise=require(_0xef4b('0x5'));var Mustache=require(_0xef4b('0x6'));var util=require(_0xef4b('0x7'));var path=require(_0xef4b('0x8'));var sox=require(_0xef4b('0x9'));var csv=require(_0xef4b('0xa'));var ejs=require(_0xef4b('0xb'));var fs=require('fs');var fs_extra=require(_0xef4b('0xc'));var _=require('lodash');var squel=require(_0xef4b('0xd'));var crypto=require(_0xef4b('0xe'));var jsforce=require(_0xef4b('0xf'));var deskjs=require(_0xef4b('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef4b('0x11'));var Redis=require('ioredis');var authService=require(_0xef4b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef4b('0x13'));var logger=require(_0xef4b('0x14'))('api');var utils=require(_0xef4b('0x15'));var config=require(_0xef4b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xef4b('0x17'))['db'];function respondWithStatusCode(_0x207ff7,_0x17a7a6){_0x17a7a6=_0x17a7a6||0xcc;return function(_0x1a6da9){if(_0x1a6da9){return _0x207ff7['sendStatus'](_0x17a7a6);}return _0x207ff7[_0xef4b('0x18')](_0x17a7a6)[_0xef4b('0x19')]();};}function respondWithResult(_0x7f18,_0xeb6654){_0xeb6654=_0xeb6654||0xc8;return function(_0x1d80ec){if(_0x1d80ec){return _0x7f18['status'](_0xeb6654)[_0xef4b('0x1a')](_0x1d80ec);}};}function respondWithFilteredResult(_0x3557c7,_0x2d42bc){return function(_0x316fd3){if(_0x316fd3){var _0x1197f6=typeof _0x2d42bc[_0xef4b('0x1b')]===_0xef4b('0x1c')&&typeof _0x2d42bc[_0xef4b('0x1d')]===_0xef4b('0x1c');var _0x350984=_0x316fd3[_0xef4b('0x1e')];var _0x4f426e=_0x1197f6?0x0:_0x2d42bc['offset'];var _0x267330=_0x1197f6?_0x316fd3[_0xef4b('0x1e')]:_0x2d42bc['offset']+_0x2d42bc['limit'];var _0x410812;if(_0x267330>=_0x350984){_0x267330=_0x350984;_0x410812=0xc8;}else{_0x410812=0xce;}_0x3557c7[_0xef4b('0x18')](_0x410812);return _0x3557c7[_0xef4b('0x1f')](_0xef4b('0x20'),_0x4f426e+'-'+_0x267330+'/'+_0x350984)['json'](_0x316fd3);}return null;};}function patchUpdates(_0x1e0331){return function(_0x5126ae){try{jsonpatch['apply'](_0x5126ae,_0x1e0331,!![]);}catch(_0x150375){return BPromise[_0xef4b('0x21')](_0x150375);}return _0x5126ae[_0xef4b('0x22')]();};}function saveUpdates(_0x458d5e,_0x18d58d){return function(_0x864257){if(_0x864257){return _0x864257[_0xef4b('0x23')](_0x458d5e)['then'](function(_0x244311){return _0x244311;});}return null;};}function removeEntity(_0x1a2743,_0x101f26){return function(_0x4cb046){if(_0x4cb046){return _0x4cb046['destroy']()['then'](function(){_0x1a2743[_0xef4b('0x18')](0xcc)[_0xef4b('0x19')]();});}};}function handleEntityNotFound(_0x3595e0,_0x3bcb60){return function(_0x3be3cd){if(!_0x3be3cd){_0x3595e0['sendStatus'](0x194);}return _0x3be3cd;};}function handleError(_0x122dc8,_0x1ffd55){_0x1ffd55=_0x1ffd55||0x1f4;return function(_0x103627){logger[_0xef4b('0x24')](_0x103627[_0xef4b('0x25')]);if(_0x103627[_0xef4b('0x26')]){delete _0x103627[_0xef4b('0x26')];}_0x122dc8[_0xef4b('0x18')](_0x1ffd55)[_0xef4b('0x27')](_0x103627);};}exports[_0xef4b('0x23')]=function(_0x2fb4f1,_0x1d81e6){if(_0x2fb4f1[_0xef4b('0x28')]['id']){delete _0x2fb4f1[_0xef4b('0x28')]['id'];}return db[_0xef4b('0x29')][_0xef4b('0x2a')]({'where':{'id':_0x2fb4f1['params']['id']}})[_0xef4b('0x2b')](handleEntityNotFound(_0x1d81e6,null))['then'](saveUpdates(_0x2fb4f1['body'],null))[_0xef4b('0x2b')](respondWithResult(_0x1d81e6,null))['catch'](handleError(_0x1d81e6,null));};exports[_0xef4b('0x2c')]=function(_0x23cadb,_0x2077b7){return db[_0xef4b('0x29')][_0xef4b('0x2a')]({'where':{'id':_0x23cadb[_0xef4b('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2077b7,null))[_0xef4b('0x2b')](removeEntity(_0x2077b7,null))[_0xef4b('0x2e')](handleError(_0x2077b7,null));}; \ No newline at end of file +var _0x587d=['api','../../config/utils','../../config/environment','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','sendStatus','error','name','body','find','params','catch','Action','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x587d,0x168));var _0xd587=function(_0x401785,_0x36d344){_0x401785=_0x401785-0x0;var _0x509351=_0x587d[_0x401785];return _0x509351;};'use strict';var emlformat=require(_0xd587('0x0'));var rimraf=require(_0xd587('0x1'));var zipdir=require(_0xd587('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd587('0x3'));var moment=require(_0xd587('0x4'));var BPromise=require(_0xd587('0x5'));var Mustache=require(_0xd587('0x6'));var util=require('util');var path=require(_0xd587('0x7'));var sox=require(_0xd587('0x8'));var csv=require(_0xd587('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd587('0xa'));var _=require(_0xd587('0xb'));var squel=require(_0xd587('0xc'));var crypto=require(_0xd587('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd587('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd587('0xe'));var authService=require(_0xd587('0xf'));var qs=require(_0xd587('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd587('0x11'));var logger=require('../../config/logger')(_0xd587('0x12'));var utils=require(_0xd587('0x13'));var config=require(_0xd587('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x439c08,_0x269034){_0x269034=_0x269034||0xcc;return function(_0x11da4b){if(_0x11da4b){return _0x439c08['sendStatus'](_0x269034);}return _0x439c08[_0xd587('0x15')](_0x269034)[_0xd587('0x16')]();};}function respondWithResult(_0x51abd1,_0x3473f0){_0x3473f0=_0x3473f0||0xc8;return function(_0x1b9dd6){if(_0x1b9dd6){return _0x51abd1['status'](_0x3473f0)[_0xd587('0x17')](_0x1b9dd6);}};}function respondWithFilteredResult(_0x2e5533,_0x5c83c4){return function(_0x3108c9){if(_0x3108c9){var _0x374219=typeof _0x5c83c4[_0xd587('0x18')]===_0xd587('0x19')&&typeof _0x5c83c4['limit']===_0xd587('0x19');var _0x362503=_0x3108c9[_0xd587('0x1a')];var _0x53ae71=_0x374219?0x0:_0x5c83c4[_0xd587('0x18')];var _0x4d8f46=_0x374219?_0x3108c9[_0xd587('0x1a')]:_0x5c83c4['offset']+_0x5c83c4[_0xd587('0x1b')];var _0x18b7d7;if(_0x4d8f46>=_0x362503){_0x4d8f46=_0x362503;_0x18b7d7=0xc8;}else{_0x18b7d7=0xce;}_0x2e5533[_0xd587('0x15')](_0x18b7d7);return _0x2e5533[_0xd587('0x1c')]('Content-Range',_0x53ae71+'-'+_0x4d8f46+'/'+_0x362503)[_0xd587('0x17')](_0x3108c9);}return null;};}function patchUpdates(_0x6910a4){return function(_0x13526e){try{jsonpatch[_0xd587('0x1d')](_0x13526e,_0x6910a4,!![]);}catch(_0x1675ac){return BPromise['reject'](_0x1675ac);}return _0x13526e[_0xd587('0x1e')]();};}function saveUpdates(_0x410143,_0x5c33a0){return function(_0x4cd828){if(_0x4cd828){return _0x4cd828[_0xd587('0x1f')](_0x410143)[_0xd587('0x20')](function(_0x4fa522){return _0x4fa522;});}return null;};}function removeEntity(_0x2add01,_0x2dd9c6){return function(_0x39c262){if(_0x39c262){return _0x39c262[_0xd587('0x21')]()[_0xd587('0x20')](function(){_0x2add01[_0xd587('0x15')](0xcc)[_0xd587('0x16')]();});}};}function handleEntityNotFound(_0x2ca009,_0x505a3a){return function(_0x159309){if(!_0x159309){_0x2ca009[_0xd587('0x22')](0x194);}return _0x159309;};}function handleError(_0xedd188,_0x2a8a21){_0x2a8a21=_0x2a8a21||0x1f4;return function(_0x30b36b){logger[_0xd587('0x23')](_0x30b36b['stack']);if(_0x30b36b[_0xd587('0x24')]){delete _0x30b36b['name'];}_0xedd188[_0xd587('0x15')](_0x2a8a21)['send'](_0x30b36b);};}exports[_0xd587('0x1f')]=function(_0xef17d4,_0x37d043){if(_0xef17d4[_0xd587('0x25')]['id']){delete _0xef17d4['body']['id'];}return db['Action'][_0xd587('0x26')]({'where':{'id':_0xef17d4[_0xd587('0x27')]['id']}})[_0xd587('0x20')](handleEntityNotFound(_0x37d043,null))[_0xd587('0x20')](saveUpdates(_0xef17d4[_0xd587('0x25')],null))['then'](respondWithResult(_0x37d043,null))[_0xd587('0x28')](handleError(_0x37d043,null));};exports[_0xd587('0x21')]=function(_0x5d078c,_0x45e783){return db[_0xd587('0x29')][_0xd587('0x26')]({'where':{'id':_0x5d078c['params']['id']}})[_0xd587('0x20')](handleEntityNotFound(_0x45e783,null))['then'](removeEntity(_0x45e783,null))[_0xd587('0x28')](handleError(_0x45e783,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 19b690b..55c5b25 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 _0xdfe9=['moment','bluebird','request-promise','path','../../config/environment','./action.attributes','exports','define','Action','tools_actions','util','../../config/logger'];(function(_0x1d878b,_0x41ebb6){var _0x477347=function(_0x562be3){while(--_0x562be3){_0x1d878b['push'](_0x1d878b['shift']());}};_0x477347(++_0x41ebb6);}(_0xdfe9,0x14e));var _0x9dfe=function(_0x368618,_0x307064){_0x368618=_0x368618-0x0;var _0xf5fbec=_0xdfe9[_0x368618];return _0xf5fbec;};'use strict';var _=require('lodash');var util=require(_0x9dfe('0x0'));var logger=require(_0x9dfe('0x1'))('api');var moment=require(_0x9dfe('0x2'));var BPromise=require(_0x9dfe('0x3'));var rp=require(_0x9dfe('0x4'));var fs=require('fs');var path=require(_0x9dfe('0x5'));var rimraf=require('rimraf');var config=require(_0x9dfe('0x6'));var attributes=require(_0x9dfe('0x7'));module[_0x9dfe('0x8')]=function(_0x899faf,_0x532c31){return _0x899faf[_0x9dfe('0x9')](_0x9dfe('0xa'),attributes,{'tableName':_0x9dfe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13be=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Action','tools_actions','util'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x13be,0x175));var _0xe13b=function(_0x5e0af1,_0x1bbe16){_0x5e0af1=_0x5e0af1-0x0;var _0x129dff=_0x13be[_0x5e0af1];return _0x129dff;};'use strict';var _=require('lodash');var util=require(_0xe13b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe13b('0x1'));var BPromise=require(_0xe13b('0x2'));var rp=require(_0xe13b('0x3'));var fs=require('fs');var path=require(_0xe13b('0x4'));var rimraf=require(_0xe13b('0x5'));var config=require(_0xe13b('0x6'));var attributes=require('./action.attributes');module[_0xe13b('0x7')]=function(_0x2acb7c,_0x7ce80a){return _0x2acb7c[_0xe13b('0x8')](_0xe13b('0x9'),attributes,{'tableName':_0xe13b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index ad1aac3..8a952ae 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1b3e7f,_0x2c307f){var _0x257f4b=function(_0x2eba4c){while(--_0x2eba4c){_0x1b3e7f['push'](_0x1b3e7f['shift']());}};_0x257f4b(++_0x2c307f);}(_0x326f,0xd1));var _0xf326=function(_0x28fc58,_0x37bc3a){_0x28fc58=_0x28fc58-0x0;var _0x185ada=_0x326f[_0x28fc58];return _0x185ada;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf07dc9,_0x267991){var _0x142b39=function(_0x71a70){while(--_0x71a70){_0xf07dc9['push'](_0xf07dc9['shift']());}};_0x142b39(++_0x267991);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x232147,_0x241aaa){_0x232147=_0x232147-0x0;var _0x462788=_0x7fbe[_0x232147];return _0x462788;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index aaa99f5..ec32e55 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 _0x762f=['../../config/environment','./action.controller','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x114da9,_0xd91064){var _0x2d64f0=function(_0x128064){while(--_0x128064){_0x114da9['push'](_0x114da9['shift']());}};_0x2d64f0(++_0xd91064);}(_0x762f,0x161));var _0xf762=function(_0x59b104,_0x3efcd1){_0x59b104=_0x59b104-0x0;var _0x115b85=_0x762f[_0x59b104];return _0x115b85;};'use strict';var multer=require(_0xf762('0x0'));var util=require(_0xf762('0x1'));var path=require(_0xf762('0x2'));var timeout=require('connect-timeout');var express=require(_0xf762('0x3'));var router=express[_0xf762('0x4')]();var fs_extra=require(_0xf762('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf762('0x6'));var config=require(_0xf762('0x7'));var controller=require(_0xf762('0x8'));router['put']('/:id',auth[_0xf762('0x9')](),controller[_0xf762('0xa')]);router[_0xf762('0xb')](_0xf762('0xc'),auth[_0xf762('0x9')](),controller[_0xf762('0xd')]);module[_0xf762('0xe')]=router; \ No newline at end of file +var _0x0113=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','isAuthenticated','delete','/:id','destroy','exports'];(function(_0x15cc52,_0x167dca){var _0x47224b=function(_0x2046e6){while(--_0x2046e6){_0x15cc52['push'](_0x15cc52['shift']());}};_0x47224b(++_0x167dca);}(_0x0113,0x196));var _0x3011=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0113[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x3011('0x0'));var path=require(_0x3011('0x1'));var timeout=require(_0x3011('0x2'));var express=require(_0x3011('0x3'));var router=express[_0x3011('0x4')]();var fs_extra=require(_0x3011('0x5'));var auth=require(_0x3011('0x6'));var interaction=require(_0x3011('0x7'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x3011('0x8')]('/:id',auth[_0x3011('0x9')](),controller['update']);router[_0x3011('0xa')](_0x3011('0xb'),auth[_0x3011('0x9')](),controller[_0x3011('0xc')]);module[_0x3011('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 3c8ce18..26b8e40 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 _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x1fa274,_0x27a51f){var _0x5601e0=function(_0x146c2c){while(--_0x146c2c){_0x1fa274['push'](_0x1fa274['shift']());}};_0x5601e0(++_0x27a51f);}(_0xac9d,0x14d));var _0xdac9=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0xac9d[_0x54f7c0];return _0x245d03;};'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 +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x3a34ee,_0x39eeba){var _0x2ca122=function(_0x252e9e){while(--_0x252e9e){_0x3a34ee['push'](_0x3a34ee['shift']());}};_0x2ca122(++_0x39eeba);}(_0xe14b,0x93));var _0xbe14=function(_0x58a540,_0x342cef){_0x58a540=_0x58a540-0x0;var _0x162803=_0xe14b[_0x58a540];return _0x162803;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 65e0e49..40f6a4f 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 _0xadf4=['replace','format','orderBy','DESC','alias','joins','parse','type','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(%s)','MAX(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','value','getFields','keyBy','groupBy','foreignKey','clone','output','web','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','savename','countTable','COUNT(*)','sequelize','QueryTypes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','error','stack','name','send','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','filter','AnalyticCustomReport','includeAll','include','findAll','rows','show','params','keys','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','MetricId','metric','function'];(function(_0x201fc4,_0x50d5f3){var _0x5a3a8e=function(_0x34e2c0){while(--_0x34e2c0){_0x201fc4['push'](_0x201fc4['shift']());}};_0x5a3a8e(++_0x50d5f3);}(_0xadf4,0xd4));var _0x4adf=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0xadf4[_0x503ffd];return _0x160437;};'use strict';var emlformat=require(_0x4adf('0x0'));var rimraf=require(_0x4adf('0x1'));var zipdir=require(_0x4adf('0x2'));var jsonpatch=require(_0x4adf('0x3'));var rp=require(_0x4adf('0x4'));var moment=require('moment');var BPromise=require(_0x4adf('0x5'));var Mustache=require(_0x4adf('0x6'));var util=require(_0x4adf('0x7'));var path=require(_0x4adf('0x8'));var sox=require(_0x4adf('0x9'));var csv=require(_0x4adf('0xa'));var ejs=require(_0x4adf('0xb'));var fs=require('fs');var fs_extra=require(_0x4adf('0xc'));var _=require('lodash');var squel=require(_0x4adf('0xd'));var crypto=require(_0x4adf('0xe'));var jsforce=require(_0x4adf('0xf'));var deskjs=require(_0x4adf('0x10'));var toCsv=require(_0x4adf('0xa'));var querystring=require(_0x4adf('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4adf('0x12'));var qs=require(_0x4adf('0x13'));var as=require(_0x4adf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4adf('0x15'))(_0x4adf('0x16'));var utils=require(_0x4adf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4adf('0x18'));var db=require(_0x4adf('0x19'))['db'];var dbH=require('../../mysqldb')[_0x4adf('0x1a')];function respondWithStatusCode(_0x2cb20c,_0x17d051){_0x17d051=_0x17d051||0xcc;return function(_0x216f58){if(_0x216f58){return _0x2cb20c[_0x4adf('0x1b')](_0x17d051);}return _0x2cb20c['status'](_0x17d051)[_0x4adf('0x1c')]();};}function respondWithResult(_0x38ae51,_0x4104e1){_0x4104e1=_0x4104e1||0xc8;return function(_0x45b7b4){if(_0x45b7b4){return _0x38ae51['status'](_0x4104e1)[_0x4adf('0x1d')](_0x45b7b4);}};}function respondWithFilteredResult(_0x45b161,_0x397e2e){return function(_0x1c0885){if(_0x1c0885){var _0x7ad56b=typeof _0x397e2e['offset']===_0x4adf('0x1e')&&typeof _0x397e2e[_0x4adf('0x1f')]===_0x4adf('0x1e');var _0x560179=_0x1c0885[_0x4adf('0x20')];var _0x400feb=_0x7ad56b?0x0:_0x397e2e['offset'];var _0x4e6241=_0x7ad56b?_0x1c0885[_0x4adf('0x20')]:_0x397e2e[_0x4adf('0x21')]+_0x397e2e['limit'];var _0x5b186b;if(_0x4e6241>=_0x560179){_0x4e6241=_0x560179;_0x5b186b=0xc8;}else{_0x5b186b=0xce;}_0x45b161[_0x4adf('0x22')](_0x5b186b);return _0x45b161[_0x4adf('0x23')](_0x4adf('0x24'),_0x400feb+'-'+_0x4e6241+'/'+_0x560179)[_0x4adf('0x1d')](_0x1c0885);}return null;};}function patchUpdates(_0x3bfc3d){return function(_0x4b2f73){try{jsonpatch[_0x4adf('0x25')](_0x4b2f73,_0x3bfc3d,!![]);}catch(_0x30bcc1){return BPromise[_0x4adf('0x26')](_0x30bcc1);}return _0x4b2f73[_0x4adf('0x27')]();};}function saveUpdates(_0x455bb1,_0x2b9fa0){return function(_0xcb2a77){if(_0xcb2a77){return _0xcb2a77[_0x4adf('0x28')](_0x455bb1)[_0x4adf('0x29')](function(_0x5be2c6){return _0x5be2c6;});}return null;};}function removeEntity(_0x3081ca,_0x1ba54a){return function(_0xe23096){if(_0xe23096){return _0xe23096[_0x4adf('0x2a')]()[_0x4adf('0x29')](function(){var _0x282705=_0xe23096[_0x4adf('0x2b')]({'plain':!![]});var _0x5d09a1=_0x4adf('0x2c');return db['UserProfileResource'][_0x4adf('0x2a')]({'where':{'type':_0x5d09a1,'resourceId':_0x282705['id']}})[_0x4adf('0x29')](function(){return _0xe23096;});})[_0x4adf('0x29')](function(){_0x3081ca[_0x4adf('0x22')](0xcc)[_0x4adf('0x1c')]();});}};}function handleEntityNotFound(_0x1e6b83,_0x1772f1){return function(_0x1579b2){if(!_0x1579b2){_0x1e6b83[_0x4adf('0x1b')](0x194);}return _0x1579b2;};}function handleError(_0x3dacb3,_0x1acfb9){_0x1acfb9=_0x1acfb9||0x1f4;return function(_0xde3030){logger[_0x4adf('0x2d')](_0xde3030[_0x4adf('0x2e')]);if(_0xde3030[_0x4adf('0x2f')]){delete _0xde3030['name'];}_0x3dacb3[_0x4adf('0x22')](_0x1acfb9)[_0x4adf('0x30')](_0xde3030);};}exports['index']=function(_0x5222c1,_0x1f6353){var _0x238ae8={},_0x91228f={},_0x5b2420={'count':0x0,'rows':[]};var _0x420ddc=_['map'](db['AnalyticCustomReport'][_0x4adf('0x31')],function(_0x5dd93d){return{'name':_0x5dd93d[_0x4adf('0x32')],'type':_0x5dd93d['type'][_0x4adf('0x33')]};});_0x91228f['model']=_['map'](_0x420ddc,_0x4adf('0x2f'));_0x91228f[_0x4adf('0x34')]=_['keys'](_0x5222c1[_0x4adf('0x34')]);_0x91228f[_0x4adf('0x35')]=_[_0x4adf('0x36')](_0x91228f[_0x4adf('0x37')],_0x91228f[_0x4adf('0x34')]);_0x238ae8[_0x4adf('0x38')]=_['intersection'](_0x91228f[_0x4adf('0x37')],qs[_0x4adf('0x39')](_0x5222c1[_0x4adf('0x34')][_0x4adf('0x39')]));_0x238ae8[_0x4adf('0x38')]=_0x238ae8[_0x4adf('0x38')][_0x4adf('0x3a')]?_0x238ae8[_0x4adf('0x38')]:_0x91228f[_0x4adf('0x37')];if(!_0x5222c1['query'][_0x4adf('0x3b')]('nolimit')){_0x238ae8['limit']=qs[_0x4adf('0x1f')](_0x5222c1['query'][_0x4adf('0x1f')]);_0x238ae8[_0x4adf('0x21')]=qs['offset'](_0x5222c1[_0x4adf('0x34')][_0x4adf('0x21')]);}_0x238ae8[_0x4adf('0x3c')]=qs[_0x4adf('0x3d')](_0x5222c1[_0x4adf('0x34')][_0x4adf('0x3d')]);_0x238ae8[_0x4adf('0x3e')]=qs[_0x4adf('0x35')](_[_0x4adf('0x3f')](_0x5222c1[_0x4adf('0x34')],_0x91228f[_0x4adf('0x35')]),_0x420ddc);if(_0x5222c1['query']['filter']){_0x238ae8[_0x4adf('0x3e')]=_[_0x4adf('0x40')](_0x238ae8[_0x4adf('0x3e')],{'$or':_[_0x4adf('0x41')](_0x420ddc,function(_0x35ec37){if(_0x35ec37['type']!=='VIRTUAL'){var _0xc3f0ec={};_0xc3f0ec[_0x35ec37['name']]={'$like':'%'+_0x5222c1[_0x4adf('0x34')][_0x4adf('0x42')]+'%'};return _0xc3f0ec;}})});}_0x238ae8=_[_0x4adf('0x40')]({},_0x238ae8,_0x5222c1['options']);var _0x290ed7={'where':_0x238ae8['where']};return db[_0x4adf('0x43')][_0x4adf('0x20')](_0x290ed7)[_0x4adf('0x29')](function(_0x31c31d){_0x5b2420['count']=_0x31c31d;if(_0x5222c1[_0x4adf('0x34')][_0x4adf('0x44')]){_0x238ae8[_0x4adf('0x45')]=[{'all':!![]}];}return db[_0x4adf('0x43')][_0x4adf('0x46')](_0x238ae8);})[_0x4adf('0x29')](function(_0x324844){_0x5b2420[_0x4adf('0x47')]=_0x324844;return _0x5b2420;})[_0x4adf('0x29')](respondWithFilteredResult(_0x1f6353,_0x238ae8))['catch'](handleError(_0x1f6353,null));};exports[_0x4adf('0x48')]=function(_0x3d59ab,_0x45756a){var _0x1af777={'raw':![],'where':{'id':_0x3d59ab[_0x4adf('0x49')]['id']}},_0x1293c7={};_0x1293c7[_0x4adf('0x37')]=_[_0x4adf('0x4a')](db[_0x4adf('0x43')][_0x4adf('0x31')]);_0x1293c7[_0x4adf('0x34')]=_[_0x4adf('0x4a')](_0x3d59ab[_0x4adf('0x34')]);_0x1293c7['filters']=_[_0x4adf('0x36')](_0x1293c7[_0x4adf('0x37')],_0x1293c7['query']);_0x1af777['attributes']=_[_0x4adf('0x36')](_0x1293c7[_0x4adf('0x37')],qs[_0x4adf('0x39')](_0x3d59ab[_0x4adf('0x34')][_0x4adf('0x39')]));_0x1af777[_0x4adf('0x38')]=_0x1af777[_0x4adf('0x38')][_0x4adf('0x3a')]?_0x1af777[_0x4adf('0x38')]:_0x1293c7[_0x4adf('0x37')];if(_0x3d59ab[_0x4adf('0x34')][_0x4adf('0x44')]){_0x1af777[_0x4adf('0x45')]=[{'all':!![]}];}_0x1af777=_[_0x4adf('0x40')]({},_0x1af777,_0x3d59ab[_0x4adf('0x4b')]);return db[_0x4adf('0x43')]['find'](_0x1af777)['then'](handleEntityNotFound(_0x45756a,null))[_0x4adf('0x29')](respondWithResult(_0x45756a,null))[_0x4adf('0x4c')](handleError(_0x45756a,null));};exports[_0x4adf('0x4d')]=function(_0x44c898,_0xd1cbfc){return db['AnalyticCustomReport'][_0x4adf('0x4d')](_0x44c898[_0x4adf('0x4e')],{})[_0x4adf('0x29')](function(_0x2fe1a7){var _0x47afc9=_0x44c898[_0x4adf('0x4f')][_0x4adf('0x2b')]({'plain':!![]});if(!_0x47afc9)throw new Error(_0x4adf('0x50'));if(_0x47afc9[_0x4adf('0x51')]===_0x4adf('0x4f')){var _0x11152e=_0x2fe1a7[_0x4adf('0x2b')]({'plain':!![]});var _0x156ccd='Reports';return db[_0x4adf('0x52')][_0x4adf('0x53')]({'where':{'name':_0x156ccd,'userProfileId':_0x47afc9[_0x4adf('0x54')]},'raw':!![]})[_0x4adf('0x29')](function(_0x3ed8d8){if(_0x3ed8d8&&_0x3ed8d8[_0x4adf('0x55')]===0x0){return db['UserProfileResource'][_0x4adf('0x4d')]({'name':_0x11152e[_0x4adf('0x2f')],'resourceId':_0x11152e['id'],'type':_0x4adf('0x2c'),'sectionId':_0x3ed8d8['id']},{})[_0x4adf('0x29')](function(){return _0x2fe1a7;});}else{return _0x2fe1a7;}})[_0x4adf('0x4c')](function(_0x8ea99a){logger[_0x4adf('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8ea99a);throw _0x8ea99a;});}return _0x2fe1a7;})['then'](respondWithResult(_0xd1cbfc,0xc9))[_0x4adf('0x4c')](handleError(_0xd1cbfc,null));};exports[_0x4adf('0x28')]=function(_0x4f88fd,_0x2dc67e){if(_0x4f88fd[_0x4adf('0x4e')]['id']){delete _0x4f88fd[_0x4adf('0x4e')]['id'];}return db['AnalyticCustomReport'][_0x4adf('0x53')]({'where':{'id':_0x4f88fd[_0x4adf('0x49')]['id']}})[_0x4adf('0x29')](handleEntityNotFound(_0x2dc67e,null))[_0x4adf('0x29')](saveUpdates(_0x4f88fd[_0x4adf('0x4e')],null))[_0x4adf('0x29')](respondWithResult(_0x2dc67e,null))[_0x4adf('0x4c')](handleError(_0x2dc67e,null));};exports['destroy']=function(_0xd75aa3,_0x483be5){return db[_0x4adf('0x43')][_0x4adf('0x53')]({'where':{'id':_0xd75aa3[_0x4adf('0x49')]['id']}})[_0x4adf('0x29')](handleEntityNotFound(_0x483be5,null))[_0x4adf('0x29')](removeEntity(_0x483be5,null))[_0x4adf('0x4c')](handleError(_0x483be5,null));};exports[_0x4adf('0x56')]=function(_0xee28fd,_0x2f3150){var _0x26224c=0xa;var _0x2931a9=[_0x4adf('0x57'),_0x4adf('0x58'),_0x4adf('0x59'),_0x4adf('0x5a')];var _0x5b1846={'SUM':_0x4adf('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4adf('0x5c'),'MAX':'MAX(%s)','MIN':_0x4adf('0x5d'),'AVG':_0x4adf('0x5e'),'GROUP_CONCAT':_0x4adf('0x5f'),'GROUP_CONCAT ASC':_0x4adf('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x32f5d7={'SEC_TO_TIME':_0x4adf('0x61'),'DATE':_0x4adf('0x62'),'HOUR':_0x4adf('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x545fc2=function(_0x3699bb){return!_[_0x4adf('0x64')]([_0x4adf('0x65'),'IS\x20NOT\x20NULL',_0x4adf('0x66'),_0x4adf('0x67')],_0x3699bb);};var _0x4bd318=function(_0x2b33ac){if(!_0x2b33ac||!_0x2b33ac[_0x4adf('0x68')][_0x4adf('0x3a')]){return'';}for(var _0x174eab='(',_0x24a497=0x0;_0x24a497<_0x2b33ac[_0x4adf('0x68')][_0x4adf('0x3a')];_0x24a497+=0x1){_0x24a497>0x0&&(_0x174eab+='\x20'+_0x2b33ac[_0x4adf('0x69')]+'\x20');_0x174eab+=_0x2b33ac['rules'][_0x24a497]['group']?_0x4bd318(_0x2b33ac[_0x4adf('0x68')][_0x24a497][_0x4adf('0x6a')]):_0x2b33ac[_0x4adf('0x68')][_0x24a497][_0x4adf('0x6b')]+'\x20'+_0x2b33ac['rules'][_0x24a497][_0x4adf('0x6c')]+(_0x545fc2(_0x2b33ac[_0x4adf('0x68')][_0x24a497][_0x4adf('0x6c')])?'\x20'+_0x2b33ac['rules'][_0x24a497]['value']:'');}return _0x174eab+')';};var _0x4d1903={'where':{'id':_0xee28fd[_0x4adf('0x49')]['id']}},_0x472f58,_0x3ec440,_0x4ee0af,_0x1c2892,_0x34f6e6;_0x4d1903=_[_0x4adf('0x40')]({},_0x4d1903,_0xee28fd['options']);return db[_0x4adf('0x43')]['find'](_0x4d1903)[_0x4adf('0x29')](function(_0x2805cf){if(_0x2805cf){_0x472f58=_0x2805cf;return _0x2805cf['getFields']();}return null;})[_0x4adf('0x29')](function(_0x4f561a){if(_0x4f561a){if(!_0x4f561a[_0x4adf('0x3a')]){throw new db[(_0x4adf('0x6d'))][(_0x4adf('0x6e'))](_0x4adf('0x6f'),0x193);}_0x3ec440=_0x4f561a;return db[_0x4adf('0x70')][_0x4adf('0x46')]({'raw':!![]});}return null;})['then'](function(_0x26b91e){if(_0x26b91e){_0x4ee0af=_['keyBy'](_0x26b91e,'id');var _0x261fd9;var _0x41221b=squel[_0x4adf('0x71')]();_0x41221b[_0x4adf('0x72')](_0x472f58['table']);for(var _0x5b23dd=0x0;_0x5b23dd<_0x3ec440['length'];_0x5b23dd+=0x1){_0x261fd9=_0x3ec440[_0x5b23dd][_0x4adf('0x73')]?_0x4ee0af[_0x3ec440[_0x5b23dd][_0x4adf('0x73')]][_0x4adf('0x74')]:_0x3ec440[_0x5b23dd][_0x4adf('0x6b')];_0x261fd9=_0x3ec440[_0x5b23dd][_0x4adf('0x75')]?_[_0x4adf('0x76')](_0x5b1846[_0x3ec440[_0x5b23dd]['function']],'%s',_0x261fd9):_0x261fd9;_0x261fd9=_0x3ec440[_0x5b23dd][_0x4adf('0x77')]?_[_0x4adf('0x76')](_0x32f5d7[_0x3ec440[_0x5b23dd][_0x4adf('0x77')]],'%s',_0x261fd9):_0x261fd9;if(_0x3ec440[_0x5b23dd]['groupBy']){_0x41221b[_0x4adf('0x6a')](_0x261fd9);}_0x3ec440[_0x5b23dd][_0x4adf('0x78')]&&_0x41221b[_0x4adf('0x3c')](_0x261fd9,_0x3ec440[_0x5b23dd][_0x4adf('0x78')]===_0x4adf('0x79')?![]:!![]);_0x41221b['field'](_0x261fd9,_0x3ec440[_0x5b23dd][_0x4adf('0x7a')]||_0x261fd9);}if(_0x472f58[_0x4adf('0x7b')]){_0x472f58[_0x4adf('0x7b')]=JSON[_0x4adf('0x7c')](_0x472f58[_0x4adf('0x7b')]);for(var _0x4be794=0x0;_0x4be794<_0x472f58[_0x4adf('0x7b')][_0x4adf('0x3a')];_0x4be794+=0x1){if(_0x472f58[_0x4adf('0x7b')][_0x4be794][_0x4adf('0x7d')]&&_['includes'](_0x2931a9,_0x472f58[_0x4adf('0x7b')][_0x4be794][_0x4adf('0x7d')])&&_0x472f58[_0x4adf('0x7b')][_0x4be794][_0x4adf('0x7e')]&&_0x472f58['joins'][_0x4be794][_0x4adf('0x7f')]&&_0x472f58['joins'][_0x4be794]['foreignKey']){_0x41221b[_0x472f58[_0x4adf('0x7b')][_0x4be794]['type']](_0x472f58[_0x4adf('0x7b')][_0x4be794]['foreignTable'],null,util[_0x4adf('0x77')](_0x4adf('0x80'),_0x472f58[_0x4adf('0x81')],_0x472f58['joins'][_0x4be794][_0x4adf('0x7e')],_0x472f58[_0x4adf('0x7b')][_0x4be794][_0x4adf('0x7f')],_0x472f58[_0x4adf('0x7b')][_0x4be794]['foreignKey']));}}}if(_0x472f58[_0x4adf('0x82')]){_0x472f58[_0x4adf('0x82')]=JSON[_0x4adf('0x7c')](_0x472f58[_0x4adf('0x82')]);_0x41221b['where'](_0x4bd318(_0x472f58['conditions'][_0x4adf('0x6a')]));}_0x34f6e6=_0x41221b['clone']();_0x41221b['limit'](_0x26224c);_0x41221b[_0x4adf('0x21')](0x0);logger[_0x4adf('0x83')](_0x4adf('0x84'),_0x41221b['toString']());return dbH['sequelize']['query'](_0x41221b[_0x4adf('0x85')](),{'type':dbH['sequelize']['QueryTypes'][_0x4adf('0x86')]});}})[_0x4adf('0x29')](respondWithResult(_0x2f3150,null))[_0x4adf('0x4c')](handleError(_0x2f3150,null));};function runReport(_0x408363,_0x574f6c,_0x3a82b7){var _0xc59a20=_0x574f6c[_0x4adf('0x2f')];var _0x41b3e4=0xa;var _0x4e620b=[_0x4adf('0x57'),'left_join',_0x4adf('0x59'),_0x4adf('0x5a')];var _0x4b4b79={'SUM':_0x4adf('0x5b'),'COUNT':_0x4adf('0x87'),'COUNT DISTINCT':_0x4adf('0x5c'),'MAX':_0x4adf('0x88'),'MIN':'MIN(%s)','AVG':_0x4adf('0x5e'),'GROUP_CONCAT':_0x4adf('0x5f'),'GROUP_CONCAT ASC':_0x4adf('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x16b916={'SEC_TO_TIME':_0x4adf('0x61'),'DATE':_0x4adf('0x62'),'HOUR':_0x4adf('0x63'),'ROUND':_0x4adf('0x89'),'UNIX_TIMESTAMP':_0x4adf('0x8a')};var _0x5b6be0=function(_0x575be8){return!_['includes']([_0x4adf('0x65'),_0x4adf('0x8b'),_0x4adf('0x66'),'IS\x20NOT\x20EMPTY'],_0x575be8);};var _0x5efc93=function(_0xdc823b){if(!_0xdc823b||!_0xdc823b[_0x4adf('0x68')]['length']){return'';}for(var _0x5567de='(',_0x1759e2=0x0;_0x1759e2<_0xdc823b[_0x4adf('0x68')][_0x4adf('0x3a')];_0x1759e2+=0x1){_0x1759e2>0x0&&(_0x5567de+='\x20'+_0xdc823b[_0x4adf('0x69')]+'\x20');_0x5567de+=_0xdc823b[_0x4adf('0x68')][_0x1759e2][_0x4adf('0x6a')]?_0x5efc93(_0xdc823b[_0x4adf('0x68')][_0x1759e2][_0x4adf('0x6a')]):_0xdc823b[_0x4adf('0x68')][_0x1759e2][_0x4adf('0x6b')]+'\x20'+_0xdc823b[_0x4adf('0x68')][_0x1759e2]['condition']+(_0x5b6be0(_0xdc823b[_0x4adf('0x68')][_0x1759e2][_0x4adf('0x6c')])?'\x20'+_0xdc823b[_0x4adf('0x68')][_0x1759e2][_0x4adf('0x8c')]:'');}return _0x5567de+')';};var _0x2c0ba3={'where':{'id':_0x408363['id']}},_0xa61d4,_0x4b51a6,_0x10a504,_0x386c16,_0x55f01c;_0x2c0ba3=_[_0x4adf('0x40')]({},_0x2c0ba3,_0x3a82b7);return db['AnalyticCustomReport'][_0x4adf('0x53')](_0x2c0ba3)[_0x4adf('0x29')](function(_0x55c2de){if(_0x55c2de){_0xa61d4=_0x55c2de;return _0x55c2de[_0x4adf('0x8d')]();}return null;})['then'](function(_0x251e5f){if(_0x251e5f){if(!_0x251e5f[_0x4adf('0x3a')]){throw new db[(_0x4adf('0x6d'))][(_0x4adf('0x6e'))](_0x4adf('0x6f'),0x193);}_0x4b51a6=_0x251e5f;return db[_0x4adf('0x70')][_0x4adf('0x46')]({'raw':!![]});}return null;})[_0x4adf('0x29')](function(_0x44aad3){if(_0x44aad3){_0x10a504=_[_0x4adf('0x8e')](_0x44aad3,'id');var _0x48206d;var _0x3a690f=squel['select']();_0x3a690f[_0x4adf('0x72')](_0xa61d4[_0x4adf('0x81')]);for(var _0x3c5811=0x0;_0x3c5811<_0x4b51a6[_0x4adf('0x3a')];_0x3c5811+=0x1){_0x48206d=_0x4b51a6[_0x3c5811][_0x4adf('0x73')]?_0x10a504[_0x4b51a6[_0x3c5811][_0x4adf('0x73')]]['metric']:_0x4b51a6[_0x3c5811]['field'];_0x48206d=_0x4b51a6[_0x3c5811][_0x4adf('0x75')]?_[_0x4adf('0x76')](_0x4b4b79[_0x4b51a6[_0x3c5811][_0x4adf('0x75')]],'%s',_0x48206d):_0x48206d;_0x48206d=_0x4b51a6[_0x3c5811][_0x4adf('0x77')]?_[_0x4adf('0x76')](_0x16b916[_0x4b51a6[_0x3c5811][_0x4adf('0x77')]],'%s',_0x48206d):_0x48206d;if(_0x4b51a6[_0x3c5811][_0x4adf('0x8f')]){_0x3a690f[_0x4adf('0x6a')](_0x48206d);}_0x4b51a6[_0x3c5811][_0x4adf('0x78')]&&_0x3a690f[_0x4adf('0x3c')](_0x48206d,_0x4b51a6[_0x3c5811][_0x4adf('0x78')]===_0x4adf('0x79')?![]:!![]);_0x3a690f[_0x4adf('0x6b')](_0x48206d,_0x4b51a6[_0x3c5811]['alias']||_0x48206d);}if(_0xa61d4[_0x4adf('0x7b')]){_0xa61d4[_0x4adf('0x7b')]=JSON[_0x4adf('0x7c')](_0xa61d4['joins']);for(var _0x41375a=0x0;_0x41375a<_0xa61d4['joins']['length'];_0x41375a+=0x1){if(_0xa61d4[_0x4adf('0x7b')][_0x41375a][_0x4adf('0x7d')]&&_[_0x4adf('0x64')](_0x4e620b,_0xa61d4[_0x4adf('0x7b')][_0x41375a][_0x4adf('0x7d')])&&_0xa61d4['joins'][_0x41375a][_0x4adf('0x7e')]&&_0xa61d4[_0x4adf('0x7b')][_0x41375a]['foreignTable']&&_0xa61d4[_0x4adf('0x7b')][_0x41375a][_0x4adf('0x90')]){_0x3a690f[_0xa61d4['joins'][_0x41375a]['type']](_0xa61d4[_0x4adf('0x7b')][_0x41375a][_0x4adf('0x7f')],null,util[_0x4adf('0x77')](_0x4adf('0x80'),_0xa61d4[_0x4adf('0x81')],_0xa61d4['joins'][_0x41375a][_0x4adf('0x7e')],_0xa61d4[_0x4adf('0x7b')][_0x41375a][_0x4adf('0x7f')],_0xa61d4['joins'][_0x41375a]['foreignKey']));}}}if(_0xa61d4['conditions']){_0xa61d4[_0x4adf('0x82')]=JSON[_0x4adf('0x7c')](_0xa61d4['conditions']);_0x3a690f[_0x4adf('0x3e')](_0x5efc93(_0xa61d4[_0x4adf('0x82')][_0x4adf('0x6a')]));}_0x55f01c=_0x3a690f[_0x4adf('0x91')]();_0x3a690f[_0x4adf('0x1f')](_0x41b3e4);_0x3a690f[_0x4adf('0x21')](0x0);return;}})[_0x4adf('0x29')](function(){if(_0x574f6c[_0x4adf('0x92')]===_0x4adf('0x93')){return null;}var _0x43fbad=_[_0x4adf('0x40')](_0x574f6c,{'name':_0x574f6c[_0x4adf('0x94')]||_0x574f6c[_0x4adf('0x2f')]||_0xa61d4[_0x4adf('0x2f')],'basename':_0xc59a20,'savename':util[_0x4adf('0x77')](_0x4adf('0x95'),_0x574f6c[_0x4adf('0x2f')]||_0xa61d4[_0x4adf('0x2f')],require(_0x4adf('0x96'))['generate'](0x4),_0x574f6c[_0x4adf('0x92')]||_0x4adf('0x97')),'reportId':_0xa61d4['id'],'reportType':'custom'});return db[_0x4adf('0x98')][_0x4adf('0x4d')](_0x43fbad,{'raw':!![]});})[_0x4adf('0x29')](function(_0x228298){if(_0xa61d4[_0x4adf('0x81')]===_0x4adf('0x99')){_0x55f01c[_0x4adf('0x3e')](_0xa61d4[_0x4adf('0x81')]+_0x4adf('0x9a'),_0x574f6c[_0x4adf('0x9b')],_0x574f6c['endDate']);}else{_0x55f01c[_0x4adf('0x3e')](_0xa61d4[_0x4adf('0x81')]+_0x4adf('0x9c'),_0x574f6c[_0x4adf('0x9b')],_0x574f6c['endDate']);}if(_0x228298){logger[_0x4adf('0x9d')](_0x4adf('0x9e'),_0x55f01c[_0x4adf('0x85')]());require('child_process')[_0x4adf('0x9f')](path[_0x4adf('0x57')](__dirname,'../../components/export/',_0x228298[_0x4adf('0x92')]),[_0x228298['id'],_0x55f01c[_0x4adf('0x85')](),path[_0x4adf('0x57')](__dirname,'../../files/reports',_0x228298[_0x4adf('0xa0')]),_0xc59a20]);return _0x228298;}else{var _0x22dcac=squel[_0x4adf('0x71')]();_0x22dcac['from']('('+_0x55f01c[_0x4adf('0x85')]()+')',_0x4adf('0xa1'));_0x22dcac[_0x4adf('0x6b')](_0x4adf('0xa2'),_0x4adf('0x20'));_0x55f01c[_0x4adf('0x1f')](_0x574f6c[_0x4adf('0x1f')]||_0x41b3e4);_0x55f01c['offset'](_0x574f6c['offset']||0x0);return dbH[_0x4adf('0xa3')]['query'](_0x22dcac[_0x4adf('0x85')](),{'type':dbH[_0x4adf('0xa3')][_0x4adf('0xa4')][_0x4adf('0x86')]})['then'](function(_0x2d2edc){if(!_0x2d2edc['length']){_0x386c16=0x0;}else{_0x386c16=_0x2d2edc[0x0][_0x4adf('0x20')]||0x0;}return dbH[_0x4adf('0xa3')]['query'](_0x55f01c[_0x4adf('0x85')](),{'type':dbH[_0x4adf('0xa3')][_0x4adf('0xa4')][_0x4adf('0x86')]});})[_0x4adf('0x29')](function(_0x5bb9fd){return{'rows':_0x5bb9fd||[],'count':_0x386c16};});}});}exports['run']=function(_0x142b21,_0x25f7af){return runReport(_0x142b21[_0x4adf('0x49')],_0x142b21[_0x4adf('0x34')],_0x142b21[_0x4adf('0x4b')])[_0x4adf('0x29')](respondWithResult(_0x25f7af,null))[_0x4adf('0x4c')](handleError(_0x25f7af,null));};exports['runReport']=runReport;exports[_0x4adf('0x34')]=function(_0x1df2bd,_0x3f0a8f){var _0x1e8a45=0xa;var _0x453ddc=[_0x4adf('0x57'),_0x4adf('0x58'),_0x4adf('0x59'),_0x4adf('0x5a')];var _0x32d61d={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4adf('0x5c'),'MAX':'MAX(%s)','MIN':_0x4adf('0x5d'),'AVG':_0x4adf('0x5e'),'GROUP_CONCAT':_0x4adf('0x5f'),'GROUP_CONCAT ASC':_0x4adf('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2b21f1={'SEC_TO_TIME':_0x4adf('0x61'),'DATE':_0x4adf('0x62'),'HOUR':'HOUR(%s)','ROUND':_0x4adf('0x89'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2dfc0d=function(_0x1988fb){return!_[_0x4adf('0x64')]([_0x4adf('0x65'),'IS\x20NOT\x20NULL',_0x4adf('0x66'),_0x4adf('0x67')],_0x1988fb);};var _0x5ee4c1=function(_0x2cdf3e){if(!_0x2cdf3e||!_0x2cdf3e['rules'][_0x4adf('0x3a')]){return'';}for(var _0x448307='(',_0x3dc371=0x0;_0x3dc371<_0x2cdf3e[_0x4adf('0x68')]['length'];_0x3dc371+=0x1){_0x3dc371>0x0&&(_0x448307+='\x20'+_0x2cdf3e[_0x4adf('0x69')]+'\x20');_0x448307+=_0x2cdf3e[_0x4adf('0x68')][_0x3dc371][_0x4adf('0x6a')]?_0x5ee4c1(_0x2cdf3e[_0x4adf('0x68')][_0x3dc371][_0x4adf('0x6a')]):_0x2cdf3e[_0x4adf('0x68')][_0x3dc371][_0x4adf('0x6b')]+'\x20'+_0x2cdf3e[_0x4adf('0x68')][_0x3dc371][_0x4adf('0x6c')]+(_0x2dfc0d(_0x2cdf3e[_0x4adf('0x68')][_0x3dc371][_0x4adf('0x6c')])?'\x20'+_0x2cdf3e['rules'][_0x3dc371]['value']:'');}return _0x448307+')';};var _0x137c16={'where':{'id':_0x1df2bd['params']['id']}},_0x38180e,_0x325716,_0x4b7d30,_0x277393,_0x5adb2b;_0x137c16=_[_0x4adf('0x40')]({},_0x137c16,_0x1df2bd['options']);return db[_0x4adf('0x43')][_0x4adf('0x53')](_0x137c16)[_0x4adf('0x29')](function(_0x683e3){if(_0x683e3){_0x38180e=_0x683e3;return _0x683e3[_0x4adf('0x8d')]();}return null;})['then'](function(_0x4f981b){if(_0x4f981b){if(!_0x4f981b['length']){throw new db[(_0x4adf('0x6d'))][(_0x4adf('0x6e'))](_0x4adf('0x6f'),0x193);}_0x325716=_0x4f981b;return db['AnalyticMetric'][_0x4adf('0x46')]({'raw':!![]});}return null;})[_0x4adf('0x29')](function(_0x3857fa){if(_0x3857fa){_0x4b7d30=_[_0x4adf('0x8e')](_0x3857fa,'id');var _0x52d7c8;var _0x3dc731=squel[_0x4adf('0x71')]();_0x3dc731[_0x4adf('0x72')](_0x38180e[_0x4adf('0x81')]);for(var _0x57f3a5=0x0;_0x57f3a5<_0x325716[_0x4adf('0x3a')];_0x57f3a5+=0x1){_0x52d7c8=_0x325716[_0x57f3a5][_0x4adf('0x73')]?_0x4b7d30[_0x325716[_0x57f3a5]['MetricId']][_0x4adf('0x74')]:_0x325716[_0x57f3a5][_0x4adf('0x6b')];_0x52d7c8=_0x325716[_0x57f3a5][_0x4adf('0x75')]?_[_0x4adf('0x76')](_0x32d61d[_0x325716[_0x57f3a5][_0x4adf('0x75')]],'%s',_0x52d7c8):_0x52d7c8;_0x52d7c8=_0x325716[_0x57f3a5][_0x4adf('0x77')]?_[_0x4adf('0x76')](_0x2b21f1[_0x325716[_0x57f3a5]['format']],'%s',_0x52d7c8):_0x52d7c8;if(_0x325716[_0x57f3a5][_0x4adf('0x8f')]){_0x3dc731['group'](_0x52d7c8);}_0x325716[_0x57f3a5][_0x4adf('0x78')]&&_0x3dc731[_0x4adf('0x3c')](_0x52d7c8,_0x325716[_0x57f3a5][_0x4adf('0x78')]===_0x4adf('0x79')?![]:!![]);_0x3dc731[_0x4adf('0x6b')](_0x52d7c8,_0x325716[_0x57f3a5]['alias']||_0x52d7c8);}if(_0x38180e[_0x4adf('0x7b')]){_0x38180e['joins']=JSON[_0x4adf('0x7c')](_0x38180e['joins']);for(var _0x1ead2f=0x0;_0x1ead2f<_0x38180e['joins'][_0x4adf('0x3a')];_0x1ead2f+=0x1){if(_0x38180e[_0x4adf('0x7b')][_0x1ead2f][_0x4adf('0x7d')]&&_['includes'](_0x453ddc,_0x38180e[_0x4adf('0x7b')][_0x1ead2f][_0x4adf('0x7d')])&&_0x38180e[_0x4adf('0x7b')][_0x1ead2f][_0x4adf('0x7e')]&&_0x38180e[_0x4adf('0x7b')][_0x1ead2f]['foreignTable']&&_0x38180e['joins'][_0x1ead2f]['foreignKey']){_0x3dc731[_0x38180e[_0x4adf('0x7b')][_0x1ead2f]['type']](_0x38180e[_0x4adf('0x7b')][_0x1ead2f][_0x4adf('0x7f')],null,util[_0x4adf('0x77')](_0x4adf('0x80'),_0x38180e[_0x4adf('0x81')],_0x38180e['joins'][_0x1ead2f][_0x4adf('0x7e')],_0x38180e[_0x4adf('0x7b')][_0x1ead2f]['foreignTable'],_0x38180e[_0x4adf('0x7b')][_0x1ead2f]['foreignKey']));}}}if(_0x38180e[_0x4adf('0x82')]){_0x38180e[_0x4adf('0x82')]=JSON['parse'](_0x38180e[_0x4adf('0x82')]);_0x3dc731['where'](_0x5ee4c1(_0x38180e[_0x4adf('0x82')][_0x4adf('0x6a')]));}_0x5adb2b=_0x3dc731[_0x4adf('0x91')]();_0x3dc731[_0x4adf('0x1f')](_0x1e8a45);_0x3dc731[_0x4adf('0x21')](0x0);logger[_0x4adf('0x83')](_0x4adf('0x84'),_0x3dc731[_0x4adf('0x85')]());return dbH[_0x4adf('0xa3')]['query'](_0x3dc731[_0x4adf('0x85')](),{'type':dbH[_0x4adf('0xa3')]['QueryTypes'][_0x4adf('0x86')]});}})[_0x4adf('0x29')](function(){return{'sql':_0x5adb2b[_0x4adf('0x85')]()};})[_0x4adf('0x29')](respondWithResult(_0x3f0a8f,null))['catch'](handleError(_0x3f0a8f,null));}; \ No newline at end of file +var _0x67d0=['send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','CustomReports','update','params','preview','left_join','right_join','SUM(%s)','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','IS\x20NOT\x20EMPTY','metric','clone','web','fullPath','%s-%s.%s','randomstring','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','COUNT(*)','run','runReport','AVG(%s)','operator','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','destroy','then','get','end','error','stack','name'];(function(_0x2d821d,_0x5b1339){var _0x2ad521=function(_0x257642){while(--_0x257642){_0x2d821d['push'](_0x2d821d['shift']());}};_0x2ad521(++_0x5b1339);}(_0x67d0,0x1c7));var _0x067d=function(_0x3c234d,_0x3a95e0){_0x3c234d=_0x3c234d-0x0;var _0xf3ae6c=_0x67d0[_0x3c234d];return _0xf3ae6c;};'use strict';var emlformat=require(_0x067d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x067d('0x1'));var rp=require(_0x067d('0x2'));var moment=require('moment');var BPromise=require(_0x067d('0x3'));var Mustache=require(_0x067d('0x4'));var util=require(_0x067d('0x5'));var path=require('path');var sox=require(_0x067d('0x6'));var csv=require(_0x067d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x067d('0x8'));var _=require(_0x067d('0x9'));var squel=require(_0x067d('0xa'));var crypto=require(_0x067d('0xb'));var jsforce=require(_0x067d('0xc'));var deskjs=require(_0x067d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x067d('0xe'));var Papa=require(_0x067d('0xf'));var Redis=require(_0x067d('0x10'));var authService=require(_0x067d('0x11'));var qs=require(_0x067d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x067d('0x13'));var utils=require('../../config/utils');var config=require(_0x067d('0x14'));var licenseUtil=require(_0x067d('0x15'));var db=require(_0x067d('0x16'))['db'];var dbH=require(_0x067d('0x16'))[_0x067d('0x17')];function respondWithStatusCode(_0x39eb58,_0x5bdfb2){_0x5bdfb2=_0x5bdfb2||0xcc;return function(_0x1d445f){if(_0x1d445f){return _0x39eb58[_0x067d('0x18')](_0x5bdfb2);}return _0x39eb58['status'](_0x5bdfb2)['end']();};}function respondWithResult(_0x4aca9b,_0x4097a3){_0x4097a3=_0x4097a3||0xc8;return function(_0x3780ba){if(_0x3780ba){return _0x4aca9b[_0x067d('0x19')](_0x4097a3)['json'](_0x3780ba);}};}function respondWithFilteredResult(_0x5e06f1,_0x540ca7){return function(_0x2e99f8){if(_0x2e99f8){var _0x51f483=typeof _0x540ca7[_0x067d('0x1a')]==='undefined'&&typeof _0x540ca7[_0x067d('0x1b')]==='undefined';var _0x37cbf3=_0x2e99f8[_0x067d('0x1c')];var _0x4012e7=_0x51f483?0x0:_0x540ca7[_0x067d('0x1a')];var _0x4f3e67=_0x51f483?_0x2e99f8[_0x067d('0x1c')]:_0x540ca7['offset']+_0x540ca7[_0x067d('0x1b')];var _0x2bb727;if(_0x4f3e67>=_0x37cbf3){_0x4f3e67=_0x37cbf3;_0x2bb727=0xc8;}else{_0x2bb727=0xce;}_0x5e06f1[_0x067d('0x19')](_0x2bb727);return _0x5e06f1[_0x067d('0x1d')](_0x067d('0x1e'),_0x4012e7+'-'+_0x4f3e67+'/'+_0x37cbf3)[_0x067d('0x1f')](_0x2e99f8);}return null;};}function patchUpdates(_0x1ae5a2){return function(_0x279a8f){try{jsonpatch['apply'](_0x279a8f,_0x1ae5a2,!![]);}catch(_0x4e7d96){return BPromise[_0x067d('0x20')](_0x4e7d96);}return _0x279a8f['save']();};}function saveUpdates(_0x20994f,_0x4cd3de){return function(_0x789b56){if(_0x789b56){return _0x789b56['update'](_0x20994f)['then'](function(_0x597018){return _0x597018;});}return null;};}function removeEntity(_0x1474c1,_0x205ab7){return function(_0x23363a){if(_0x23363a){return _0x23363a[_0x067d('0x21')]()[_0x067d('0x22')](function(){var _0x47808d=_0x23363a[_0x067d('0x23')]({'plain':!![]});var _0x1be544='CustomReports';return db['UserProfileResource'][_0x067d('0x21')]({'where':{'type':_0x1be544,'resourceId':_0x47808d['id']}})[_0x067d('0x22')](function(){return _0x23363a;});})['then'](function(){_0x1474c1[_0x067d('0x19')](0xcc)[_0x067d('0x24')]();});}};}function handleEntityNotFound(_0x119591,_0xac1b26){return function(_0x1fd47d){if(!_0x1fd47d){_0x119591[_0x067d('0x18')](0x194);}return _0x1fd47d;};}function handleError(_0x268e0e,_0x251f0b){_0x251f0b=_0x251f0b||0x1f4;return function(_0x27c33a){logger[_0x067d('0x25')](_0x27c33a[_0x067d('0x26')]);if(_0x27c33a[_0x067d('0x27')]){delete _0x27c33a[_0x067d('0x27')];}_0x268e0e[_0x067d('0x19')](_0x251f0b)[_0x067d('0x28')](_0x27c33a);};}exports['index']=function(_0x2ba7d1,_0x1ba8fd){var _0x3421bb={},_0x323005={},_0x23d705={'count':0x0,'rows':[]};var _0x112c79=_[_0x067d('0x29')](db[_0x067d('0x2a')][_0x067d('0x2b')],function(_0x5e1793){return{'name':_0x5e1793[_0x067d('0x2c')],'type':_0x5e1793[_0x067d('0x2d')][_0x067d('0x2e')]};});_0x323005[_0x067d('0x2f')]=_[_0x067d('0x29')](_0x112c79,_0x067d('0x27'));_0x323005[_0x067d('0x30')]=_[_0x067d('0x31')](_0x2ba7d1['query']);_0x323005[_0x067d('0x32')]=_['intersection'](_0x323005[_0x067d('0x2f')],_0x323005[_0x067d('0x30')]);_0x3421bb[_0x067d('0x33')]=_[_0x067d('0x34')](_0x323005[_0x067d('0x2f')],qs[_0x067d('0x35')](_0x2ba7d1['query'][_0x067d('0x35')]));_0x3421bb[_0x067d('0x33')]=_0x3421bb['attributes'][_0x067d('0x36')]?_0x3421bb[_0x067d('0x33')]:_0x323005[_0x067d('0x2f')];if(!_0x2ba7d1['query']['hasOwnProperty'](_0x067d('0x37'))){_0x3421bb[_0x067d('0x1b')]=qs[_0x067d('0x1b')](_0x2ba7d1[_0x067d('0x30')][_0x067d('0x1b')]);_0x3421bb[_0x067d('0x1a')]=qs['offset'](_0x2ba7d1[_0x067d('0x30')][_0x067d('0x1a')]);}_0x3421bb[_0x067d('0x38')]=qs['sort'](_0x2ba7d1['query'][_0x067d('0x39')]);_0x3421bb[_0x067d('0x3a')]=qs[_0x067d('0x32')](_['pick'](_0x2ba7d1[_0x067d('0x30')],_0x323005[_0x067d('0x32')]),_0x112c79);if(_0x2ba7d1[_0x067d('0x30')][_0x067d('0x3b')]){_0x3421bb[_0x067d('0x3a')]=_[_0x067d('0x3c')](_0x3421bb[_0x067d('0x3a')],{'$or':_['map'](_0x112c79,function(_0x254d73){if(_0x254d73[_0x067d('0x2d')]!==_0x067d('0x3d')){var _0x5d4185={};_0x5d4185[_0x254d73[_0x067d('0x27')]]={'$like':'%'+_0x2ba7d1[_0x067d('0x30')][_0x067d('0x3b')]+'%'};return _0x5d4185;}})});}_0x3421bb=_['merge']({},_0x3421bb,_0x2ba7d1[_0x067d('0x3e')]);var _0x5e5e8f={'where':_0x3421bb[_0x067d('0x3a')]};return db['AnalyticCustomReport']['count'](_0x5e5e8f)[_0x067d('0x22')](function(_0xe9ec8a){_0x23d705[_0x067d('0x1c')]=_0xe9ec8a;if(_0x2ba7d1[_0x067d('0x30')][_0x067d('0x3f')]){_0x3421bb['include']=[{'all':!![]}];}return db[_0x067d('0x2a')][_0x067d('0x40')](_0x3421bb);})[_0x067d('0x22')](function(_0x48149b){_0x23d705[_0x067d('0x41')]=_0x48149b;return _0x23d705;})[_0x067d('0x22')](respondWithFilteredResult(_0x1ba8fd,_0x3421bb))[_0x067d('0x42')](handleError(_0x1ba8fd,null));};exports[_0x067d('0x43')]=function(_0x422693,_0x30b269){var _0x366392={'raw':![],'where':{'id':_0x422693['params']['id']}},_0x1915e5={};_0x1915e5[_0x067d('0x2f')]=_[_0x067d('0x31')](db[_0x067d('0x2a')][_0x067d('0x2b')]);_0x1915e5[_0x067d('0x30')]=_[_0x067d('0x31')](_0x422693[_0x067d('0x30')]);_0x1915e5[_0x067d('0x32')]=_[_0x067d('0x34')](_0x1915e5[_0x067d('0x2f')],_0x1915e5[_0x067d('0x30')]);_0x366392[_0x067d('0x33')]=_['intersection'](_0x1915e5[_0x067d('0x2f')],qs[_0x067d('0x35')](_0x422693[_0x067d('0x30')][_0x067d('0x35')]));_0x366392['attributes']=_0x366392[_0x067d('0x33')][_0x067d('0x36')]?_0x366392[_0x067d('0x33')]:_0x1915e5['model'];if(_0x422693[_0x067d('0x30')][_0x067d('0x3f')]){_0x366392[_0x067d('0x44')]=[{'all':!![]}];}_0x366392=_[_0x067d('0x3c')]({},_0x366392,_0x422693[_0x067d('0x3e')]);return db[_0x067d('0x2a')][_0x067d('0x45')](_0x366392)['then'](handleEntityNotFound(_0x30b269,null))['then'](respondWithResult(_0x30b269,null))[_0x067d('0x42')](handleError(_0x30b269,null));};exports[_0x067d('0x46')]=function(_0x43926c,_0x4d6680){return db['AnalyticCustomReport'][_0x067d('0x46')](_0x43926c[_0x067d('0x47')],{})[_0x067d('0x22')](function(_0x524bed){var _0x5aba2b=_0x43926c[_0x067d('0x48')]['get']({'plain':!![]});if(!_0x5aba2b)throw new Error(_0x067d('0x49'));if(_0x5aba2b[_0x067d('0x4a')]===_0x067d('0x48')){var _0x463c6c=_0x524bed[_0x067d('0x23')]({'plain':!![]});var _0x3dfef0=_0x067d('0x4b');return db[_0x067d('0x4c')][_0x067d('0x45')]({'where':{'name':_0x3dfef0,'userProfileId':_0x5aba2b[_0x067d('0x4d')]},'raw':!![]})[_0x067d('0x22')](function(_0x14ff40){if(_0x14ff40&&_0x14ff40['autoAssociation']===0x0){return db[_0x067d('0x4e')][_0x067d('0x46')]({'name':_0x463c6c[_0x067d('0x27')],'resourceId':_0x463c6c['id'],'type':_0x067d('0x4f'),'sectionId':_0x14ff40['id']},{})[_0x067d('0x22')](function(){return _0x524bed;});}else{return _0x524bed;}})[_0x067d('0x42')](function(_0x33e981){logger[_0x067d('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33e981);throw _0x33e981;});}return _0x524bed;})[_0x067d('0x22')](respondWithResult(_0x4d6680,0xc9))[_0x067d('0x42')](handleError(_0x4d6680,null));};exports[_0x067d('0x50')]=function(_0x2fa030,_0x325366){if(_0x2fa030['body']['id']){delete _0x2fa030[_0x067d('0x47')]['id'];}return db[_0x067d('0x2a')][_0x067d('0x45')]({'where':{'id':_0x2fa030[_0x067d('0x51')]['id']}})['then'](handleEntityNotFound(_0x325366,null))[_0x067d('0x22')](saveUpdates(_0x2fa030[_0x067d('0x47')],null))[_0x067d('0x22')](respondWithResult(_0x325366,null))['catch'](handleError(_0x325366,null));};exports[_0x067d('0x21')]=function(_0x41e7d0,_0x21f697){return db[_0x067d('0x2a')][_0x067d('0x45')]({'where':{'id':_0x41e7d0['params']['id']}})[_0x067d('0x22')](handleEntityNotFound(_0x21f697,null))['then'](removeEntity(_0x21f697,null))[_0x067d('0x42')](handleError(_0x21f697,null));};exports[_0x067d('0x52')]=function(_0x340303,_0x559bca){var _0x1a84fa=0xa;var _0x1b3402=['join',_0x067d('0x53'),_0x067d('0x54'),'cross_join'];var _0xf06779={'SUM':_0x067d('0x55'),'COUNT':_0x067d('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x067d('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x067d('0x58'),'GROUP_CONCAT ASC':_0x067d('0x59'),'GROUP_CONCAT DESC':_0x067d('0x5a')};var _0x3d715f={'SEC_TO_TIME':_0x067d('0x5b'),'DATE':_0x067d('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x067d('0x5d'),'UNIX_TIMESTAMP':_0x067d('0x5e')};var _0x7955bb=function(_0x4a8307){return!_['includes']([_0x067d('0x5f'),_0x067d('0x60'),_0x067d('0x61'),'IS\x20NOT\x20EMPTY'],_0x4a8307);};var _0x5e3672=function(_0x51ecee){if(!_0x51ecee||!_0x51ecee[_0x067d('0x62')][_0x067d('0x36')]){return'';}for(var _0x2ecbb2='(',_0x1a6e6e=0x0;_0x1a6e6e<_0x51ecee['rules'][_0x067d('0x36')];_0x1a6e6e+=0x1){_0x1a6e6e>0x0&&(_0x2ecbb2+='\x20'+_0x51ecee['operator']+'\x20');_0x2ecbb2+=_0x51ecee['rules'][_0x1a6e6e][_0x067d('0x63')]?_0x5e3672(_0x51ecee[_0x067d('0x62')][_0x1a6e6e]['group']):_0x51ecee['rules'][_0x1a6e6e]['field']+'\x20'+_0x51ecee[_0x067d('0x62')][_0x1a6e6e][_0x067d('0x64')]+(_0x7955bb(_0x51ecee['rules'][_0x1a6e6e][_0x067d('0x64')])?'\x20'+_0x51ecee[_0x067d('0x62')][_0x1a6e6e][_0x067d('0x65')]:'');}return _0x2ecbb2+')';};var _0x26f810={'where':{'id':_0x340303[_0x067d('0x51')]['id']}},_0x19a955,_0x55c80e,_0x1632b0,_0x9400,_0x2b817f;_0x26f810=_[_0x067d('0x3c')]({},_0x26f810,_0x340303['options']);return db[_0x067d('0x2a')]['find'](_0x26f810)[_0x067d('0x22')](function(_0x1ca4c7){if(_0x1ca4c7){_0x19a955=_0x1ca4c7;return _0x1ca4c7[_0x067d('0x66')]();}return null;})[_0x067d('0x22')](function(_0x4e5baa){if(_0x4e5baa){if(!_0x4e5baa[_0x067d('0x36')]){throw new db[(_0x067d('0x67'))][(_0x067d('0x68'))](_0x067d('0x69'),0x193);}_0x55c80e=_0x4e5baa;return db[_0x067d('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x067d('0x22')](function(_0x330a52){if(_0x330a52){_0x1632b0=_[_0x067d('0x6b')](_0x330a52,'id');var _0x316f2a;var _0x494360=squel[_0x067d('0x6c')]();_0x494360[_0x067d('0x6d')](_0x19a955['table']);for(var _0x20788e=0x0;_0x20788e<_0x55c80e[_0x067d('0x36')];_0x20788e+=0x1){_0x316f2a=_0x55c80e[_0x20788e]['MetricId']?_0x1632b0[_0x55c80e[_0x20788e][_0x067d('0x6e')]]['metric']:_0x55c80e[_0x20788e][_0x067d('0x6f')];_0x316f2a=_0x55c80e[_0x20788e][_0x067d('0x70')]?_[_0x067d('0x71')](_0xf06779[_0x55c80e[_0x20788e][_0x067d('0x70')]],'%s',_0x316f2a):_0x316f2a;_0x316f2a=_0x55c80e[_0x20788e][_0x067d('0x72')]?_[_0x067d('0x71')](_0x3d715f[_0x55c80e[_0x20788e][_0x067d('0x72')]],'%s',_0x316f2a):_0x316f2a;if(_0x55c80e[_0x20788e][_0x067d('0x73')]){_0x494360[_0x067d('0x63')](_0x316f2a);}_0x55c80e[_0x20788e][_0x067d('0x74')]&&_0x494360[_0x067d('0x38')](_0x316f2a,_0x55c80e[_0x20788e]['orderBy']===_0x067d('0x75')?![]:!![]);_0x494360['field'](_0x316f2a,_0x55c80e[_0x20788e][_0x067d('0x76')]||_0x316f2a);}if(_0x19a955[_0x067d('0x77')]){_0x19a955[_0x067d('0x77')]=JSON[_0x067d('0x78')](_0x19a955[_0x067d('0x77')]);for(var _0x353fac=0x0;_0x353fac<_0x19a955['joins'][_0x067d('0x36')];_0x353fac+=0x1){if(_0x19a955[_0x067d('0x77')][_0x353fac]['type']&&_[_0x067d('0x79')](_0x1b3402,_0x19a955[_0x067d('0x77')][_0x353fac][_0x067d('0x2d')])&&_0x19a955[_0x067d('0x77')][_0x353fac]['parentKey']&&_0x19a955['joins'][_0x353fac][_0x067d('0x7a')]&&_0x19a955[_0x067d('0x77')][_0x353fac][_0x067d('0x7b')]){_0x494360[_0x19a955[_0x067d('0x77')][_0x353fac][_0x067d('0x2d')]](_0x19a955[_0x067d('0x77')][_0x353fac][_0x067d('0x7a')],null,util[_0x067d('0x72')](_0x067d('0x7c'),_0x19a955[_0x067d('0x7d')],_0x19a955['joins'][_0x353fac][_0x067d('0x7e')],_0x19a955[_0x067d('0x77')][_0x353fac][_0x067d('0x7a')],_0x19a955['joins'][_0x353fac][_0x067d('0x7b')]));}}}if(_0x19a955[_0x067d('0x7f')]){_0x19a955[_0x067d('0x7f')]=JSON[_0x067d('0x78')](_0x19a955['conditions']);_0x494360['where'](_0x5e3672(_0x19a955[_0x067d('0x7f')][_0x067d('0x63')]));}_0x2b817f=_0x494360['clone']();_0x494360[_0x067d('0x1b')](_0x1a84fa);_0x494360[_0x067d('0x1a')](0x0);logger['debug'](_0x067d('0x80'),_0x494360[_0x067d('0x81')]());return dbH[_0x067d('0x82')][_0x067d('0x30')](_0x494360[_0x067d('0x81')](),{'type':dbH[_0x067d('0x82')][_0x067d('0x83')][_0x067d('0x84')]});}})[_0x067d('0x22')](respondWithResult(_0x559bca,null))[_0x067d('0x42')](handleError(_0x559bca,null));};function runReport(_0x421704,_0x4c7565,_0x39fe01){var _0x5aa5b0=_0x4c7565[_0x067d('0x27')];var _0x30a00b=0xa;var _0x6dba31=[_0x067d('0x85'),'left_join','right_join',_0x067d('0x86')];var _0x41a9be={'SUM':_0x067d('0x55'),'COUNT':_0x067d('0x56'),'COUNT DISTINCT':_0x067d('0x87'),'MAX':_0x067d('0x88'),'MIN':_0x067d('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x067d('0x58'),'GROUP_CONCAT ASC':_0x067d('0x59'),'GROUP_CONCAT DESC':_0x067d('0x5a')};var _0x445021={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x067d('0x5c'),'HOUR':_0x067d('0x89'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x067d('0x5e')};var _0x92840b=function(_0x3d3588){return!_[_0x067d('0x79')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x067d('0x61'),_0x067d('0x8a')],_0x3d3588);};var _0x7253f5=function(_0xaa022b){if(!_0xaa022b||!_0xaa022b[_0x067d('0x62')]['length']){return'';}for(var _0x1e8ca3='(',_0x4cb745=0x0;_0x4cb745<_0xaa022b[_0x067d('0x62')][_0x067d('0x36')];_0x4cb745+=0x1){_0x4cb745>0x0&&(_0x1e8ca3+='\x20'+_0xaa022b['operator']+'\x20');_0x1e8ca3+=_0xaa022b[_0x067d('0x62')][_0x4cb745][_0x067d('0x63')]?_0x7253f5(_0xaa022b['rules'][_0x4cb745][_0x067d('0x63')]):_0xaa022b['rules'][_0x4cb745][_0x067d('0x6f')]+'\x20'+_0xaa022b['rules'][_0x4cb745][_0x067d('0x64')]+(_0x92840b(_0xaa022b[_0x067d('0x62')][_0x4cb745]['condition'])?'\x20'+_0xaa022b['rules'][_0x4cb745][_0x067d('0x65')]:'');}return _0x1e8ca3+')';};var _0x198d49={'where':{'id':_0x421704['id']}},_0x4021ac,_0x37762a,_0x155a52,_0x558319,_0x5d79d1;_0x198d49=_['merge']({},_0x198d49,_0x39fe01);return db[_0x067d('0x2a')]['find'](_0x198d49)['then'](function(_0x2cf033){if(_0x2cf033){_0x4021ac=_0x2cf033;return _0x2cf033[_0x067d('0x66')]();}return null;})[_0x067d('0x22')](function(_0xc27a0a){if(_0xc27a0a){if(!_0xc27a0a[_0x067d('0x36')]){throw new db[(_0x067d('0x67'))][(_0x067d('0x68'))](_0x067d('0x69'),0x193);}_0x37762a=_0xc27a0a;return db[_0x067d('0x6a')][_0x067d('0x40')]({'raw':!![]});}return null;})['then'](function(_0x365276){if(_0x365276){_0x155a52=_[_0x067d('0x6b')](_0x365276,'id');var _0x4363ff;var _0x24f29e=squel[_0x067d('0x6c')]();_0x24f29e[_0x067d('0x6d')](_0x4021ac[_0x067d('0x7d')]);for(var _0x4c4bd3=0x0;_0x4c4bd3<_0x37762a[_0x067d('0x36')];_0x4c4bd3+=0x1){_0x4363ff=_0x37762a[_0x4c4bd3][_0x067d('0x6e')]?_0x155a52[_0x37762a[_0x4c4bd3][_0x067d('0x6e')]][_0x067d('0x8b')]:_0x37762a[_0x4c4bd3][_0x067d('0x6f')];_0x4363ff=_0x37762a[_0x4c4bd3][_0x067d('0x70')]?_[_0x067d('0x71')](_0x41a9be[_0x37762a[_0x4c4bd3][_0x067d('0x70')]],'%s',_0x4363ff):_0x4363ff;_0x4363ff=_0x37762a[_0x4c4bd3]['format']?_[_0x067d('0x71')](_0x445021[_0x37762a[_0x4c4bd3][_0x067d('0x72')]],'%s',_0x4363ff):_0x4363ff;if(_0x37762a[_0x4c4bd3][_0x067d('0x73')]){_0x24f29e[_0x067d('0x63')](_0x4363ff);}_0x37762a[_0x4c4bd3][_0x067d('0x74')]&&_0x24f29e['order'](_0x4363ff,_0x37762a[_0x4c4bd3][_0x067d('0x74')]===_0x067d('0x75')?![]:!![]);_0x24f29e[_0x067d('0x6f')](_0x4363ff,_0x37762a[_0x4c4bd3][_0x067d('0x76')]||_0x4363ff);}if(_0x4021ac[_0x067d('0x77')]){_0x4021ac[_0x067d('0x77')]=JSON[_0x067d('0x78')](_0x4021ac['joins']);for(var _0x21d9e5=0x0;_0x21d9e5<_0x4021ac[_0x067d('0x77')][_0x067d('0x36')];_0x21d9e5+=0x1){if(_0x4021ac[_0x067d('0x77')][_0x21d9e5]['type']&&_['includes'](_0x6dba31,_0x4021ac[_0x067d('0x77')][_0x21d9e5][_0x067d('0x2d')])&&_0x4021ac[_0x067d('0x77')][_0x21d9e5][_0x067d('0x7e')]&&_0x4021ac[_0x067d('0x77')][_0x21d9e5][_0x067d('0x7a')]&&_0x4021ac['joins'][_0x21d9e5][_0x067d('0x7b')]){_0x24f29e[_0x4021ac['joins'][_0x21d9e5]['type']](_0x4021ac[_0x067d('0x77')][_0x21d9e5][_0x067d('0x7a')],null,util[_0x067d('0x72')](_0x067d('0x7c'),_0x4021ac[_0x067d('0x7d')],_0x4021ac[_0x067d('0x77')][_0x21d9e5][_0x067d('0x7e')],_0x4021ac[_0x067d('0x77')][_0x21d9e5][_0x067d('0x7a')],_0x4021ac[_0x067d('0x77')][_0x21d9e5]['foreignKey']));}}}if(_0x4021ac[_0x067d('0x7f')]){_0x4021ac['conditions']=JSON['parse'](_0x4021ac[_0x067d('0x7f')]);_0x24f29e[_0x067d('0x3a')](_0x7253f5(_0x4021ac['conditions'][_0x067d('0x63')]));}_0x5d79d1=_0x24f29e[_0x067d('0x8c')]();_0x24f29e[_0x067d('0x1b')](_0x30a00b);_0x24f29e[_0x067d('0x1a')](0x0);return;}})['then'](function(){if(_0x4c7565['output']===_0x067d('0x8d')){return null;}var _0xeb9409=_[_0x067d('0x3c')](_0x4c7565,{'name':_0x4c7565[_0x067d('0x8e')]||_0x4c7565[_0x067d('0x27')]||_0x4021ac['name'],'basename':_0x5aa5b0,'savename':util[_0x067d('0x72')](_0x067d('0x8f'),_0x4c7565[_0x067d('0x27')]||_0x4021ac[_0x067d('0x27')],require(_0x067d('0x90'))['generate'](0x4),_0x4c7565[_0x067d('0x91')]||_0x067d('0x92')),'reportId':_0x4021ac['id'],'reportType':_0x067d('0x93')});return db[_0x067d('0x94')][_0x067d('0x46')](_0xeb9409,{'raw':!![]});})['then'](function(_0x12a8ff){if(_0x4021ac[_0x067d('0x7d')]===_0x067d('0x95')){_0x5d79d1[_0x067d('0x3a')](_0x4021ac['table']+_0x067d('0x96'),_0x4c7565[_0x067d('0x97')],_0x4c7565['endDate']);}else{_0x5d79d1[_0x067d('0x3a')](_0x4021ac[_0x067d('0x7d')]+_0x067d('0x98'),_0x4c7565['startDate'],_0x4c7565[_0x067d('0x99')]);}if(_0x12a8ff){logger[_0x067d('0x9a')](_0x067d('0x9b'),_0x5d79d1['toString']());require(_0x067d('0x9c'))[_0x067d('0x9d')](path[_0x067d('0x85')](__dirname,_0x067d('0x9e'),_0x12a8ff[_0x067d('0x91')]),[_0x12a8ff['id'],_0x5d79d1['toString'](),path[_0x067d('0x85')](__dirname,'../../files/reports',_0x12a8ff[_0x067d('0x9f')]),_0x5aa5b0]);return _0x12a8ff;}else{var _0x392bb8=squel['select']();_0x392bb8['from']('('+_0x5d79d1[_0x067d('0x81')]()+')','countTable');_0x392bb8[_0x067d('0x6f')](_0x067d('0xa0'),_0x067d('0x1c'));_0x5d79d1[_0x067d('0x1b')](_0x4c7565[_0x067d('0x1b')]||_0x30a00b);_0x5d79d1[_0x067d('0x1a')](_0x4c7565[_0x067d('0x1a')]||0x0);return dbH['sequelize']['query'](_0x392bb8[_0x067d('0x81')](),{'type':dbH[_0x067d('0x82')]['QueryTypes'][_0x067d('0x84')]})[_0x067d('0x22')](function(_0x30d792){if(!_0x30d792[_0x067d('0x36')]){_0x558319=0x0;}else{_0x558319=_0x30d792[0x0][_0x067d('0x1c')]||0x0;}return dbH[_0x067d('0x82')][_0x067d('0x30')](_0x5d79d1[_0x067d('0x81')](),{'type':dbH[_0x067d('0x82')][_0x067d('0x83')]['SELECT']});})[_0x067d('0x22')](function(_0x366c48){return{'rows':_0x366c48||[],'count':_0x558319};});}});}exports[_0x067d('0xa1')]=function(_0x2653c9,_0x57ddc2){return runReport(_0x2653c9[_0x067d('0x51')],_0x2653c9[_0x067d('0x30')],_0x2653c9['options'])[_0x067d('0x22')](respondWithResult(_0x57ddc2,null))[_0x067d('0x42')](handleError(_0x57ddc2,null));};exports[_0x067d('0xa2')]=runReport;exports[_0x067d('0x30')]=function(_0x50d45c,_0x34d02c){var _0x252ec5=0xa;var _0x21ac2e=[_0x067d('0x85'),'left_join',_0x067d('0x54'),_0x067d('0x86')];var _0xe6a928={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x067d('0xa3'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x067d('0x5a')};var _0x382596={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x067d('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x067d('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x804cbd=function(_0xd09e22){return!_['includes']([_0x067d('0x5f'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd09e22);};var _0x2c28ff=function(_0x30de62){if(!_0x30de62||!_0x30de62[_0x067d('0x62')][_0x067d('0x36')]){return'';}for(var _0x18806f='(',_0x21480e=0x0;_0x21480e<_0x30de62[_0x067d('0x62')][_0x067d('0x36')];_0x21480e+=0x1){_0x21480e>0x0&&(_0x18806f+='\x20'+_0x30de62[_0x067d('0xa4')]+'\x20');_0x18806f+=_0x30de62[_0x067d('0x62')][_0x21480e][_0x067d('0x63')]?_0x2c28ff(_0x30de62[_0x067d('0x62')][_0x21480e]['group']):_0x30de62[_0x067d('0x62')][_0x21480e][_0x067d('0x6f')]+'\x20'+_0x30de62[_0x067d('0x62')][_0x21480e][_0x067d('0x64')]+(_0x804cbd(_0x30de62[_0x067d('0x62')][_0x21480e][_0x067d('0x64')])?'\x20'+_0x30de62[_0x067d('0x62')][_0x21480e][_0x067d('0x65')]:'');}return _0x18806f+')';};var _0x4145f5={'where':{'id':_0x50d45c[_0x067d('0x51')]['id']}},_0x191d71,_0x70d3d4,_0x1f15c7,_0x51c55e,_0x1f949c;_0x4145f5=_[_0x067d('0x3c')]({},_0x4145f5,_0x50d45c['options']);return db[_0x067d('0x2a')]['find'](_0x4145f5)[_0x067d('0x22')](function(_0x24f7e9){if(_0x24f7e9){_0x191d71=_0x24f7e9;return _0x24f7e9[_0x067d('0x66')]();}return null;})[_0x067d('0x22')](function(_0xcab792){if(_0xcab792){if(!_0xcab792[_0x067d('0x36')]){throw new db['Sequelize'][(_0x067d('0x68'))](_0x067d('0x69'),0x193);}_0x70d3d4=_0xcab792;return db[_0x067d('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x067d('0x22')](function(_0x40b57a){if(_0x40b57a){_0x1f15c7=_[_0x067d('0x6b')](_0x40b57a,'id');var _0x4db2ee;var _0x2de39a=squel['select']();_0x2de39a[_0x067d('0x6d')](_0x191d71['table']);for(var _0x7010a3=0x0;_0x7010a3<_0x70d3d4[_0x067d('0x36')];_0x7010a3+=0x1){_0x4db2ee=_0x70d3d4[_0x7010a3]['MetricId']?_0x1f15c7[_0x70d3d4[_0x7010a3][_0x067d('0x6e')]]['metric']:_0x70d3d4[_0x7010a3][_0x067d('0x6f')];_0x4db2ee=_0x70d3d4[_0x7010a3]['function']?_['replace'](_0xe6a928[_0x70d3d4[_0x7010a3]['function']],'%s',_0x4db2ee):_0x4db2ee;_0x4db2ee=_0x70d3d4[_0x7010a3]['format']?_[_0x067d('0x71')](_0x382596[_0x70d3d4[_0x7010a3][_0x067d('0x72')]],'%s',_0x4db2ee):_0x4db2ee;if(_0x70d3d4[_0x7010a3][_0x067d('0x73')]){_0x2de39a['group'](_0x4db2ee);}_0x70d3d4[_0x7010a3]['orderBy']&&_0x2de39a[_0x067d('0x38')](_0x4db2ee,_0x70d3d4[_0x7010a3][_0x067d('0x74')]===_0x067d('0x75')?![]:!![]);_0x2de39a[_0x067d('0x6f')](_0x4db2ee,_0x70d3d4[_0x7010a3]['alias']||_0x4db2ee);}if(_0x191d71['joins']){_0x191d71[_0x067d('0x77')]=JSON[_0x067d('0x78')](_0x191d71[_0x067d('0x77')]);for(var _0x1520a6=0x0;_0x1520a6<_0x191d71[_0x067d('0x77')][_0x067d('0x36')];_0x1520a6+=0x1){if(_0x191d71[_0x067d('0x77')][_0x1520a6][_0x067d('0x2d')]&&_[_0x067d('0x79')](_0x21ac2e,_0x191d71[_0x067d('0x77')][_0x1520a6][_0x067d('0x2d')])&&_0x191d71[_0x067d('0x77')][_0x1520a6]['parentKey']&&_0x191d71[_0x067d('0x77')][_0x1520a6][_0x067d('0x7a')]&&_0x191d71[_0x067d('0x77')][_0x1520a6]['foreignKey']){_0x2de39a[_0x191d71[_0x067d('0x77')][_0x1520a6][_0x067d('0x2d')]](_0x191d71['joins'][_0x1520a6]['foreignTable'],null,util[_0x067d('0x72')]('%s.%s\x20=\x20%s.%s',_0x191d71['table'],_0x191d71[_0x067d('0x77')][_0x1520a6]['parentKey'],_0x191d71[_0x067d('0x77')][_0x1520a6]['foreignTable'],_0x191d71[_0x067d('0x77')][_0x1520a6][_0x067d('0x7b')]));}}}if(_0x191d71[_0x067d('0x7f')]){_0x191d71[_0x067d('0x7f')]=JSON[_0x067d('0x78')](_0x191d71[_0x067d('0x7f')]);_0x2de39a[_0x067d('0x3a')](_0x2c28ff(_0x191d71[_0x067d('0x7f')]['group']));}_0x1f949c=_0x2de39a[_0x067d('0x8c')]();_0x2de39a['limit'](_0x252ec5);_0x2de39a[_0x067d('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x2de39a[_0x067d('0x81')]());return dbH[_0x067d('0x82')][_0x067d('0x30')](_0x2de39a['toString'](),{'type':dbH[_0x067d('0x82')][_0x067d('0x83')][_0x067d('0x84')]});}})[_0x067d('0x22')](function(){return{'sql':_0x1f949c[_0x067d('0x81')]()};})[_0x067d('0x22')](respondWithResult(_0x34d02c,null))[_0x067d('0x42')](handleError(_0x34d02c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 330adf9..3391597 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 _0xedd2=['analytics_custom_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xedd2,0x1c3));var _0x2edd=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xedd2[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x2edd('0x0'));var util=require(_0x2edd('0x1'));var logger=require(_0x2edd('0x2'))(_0x2edd('0x3'));var moment=require('moment');var BPromise=require(_0x2edd('0x4'));var rp=require(_0x2edd('0x5'));var fs=require('fs');var path=require(_0x2edd('0x6'));var rimraf=require('rimraf');var config=require(_0x2edd('0x7'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x26ed37,_0x558b0f){return _0x26ed37[_0x2edd('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0x2edd('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf845=['moment','bluebird','request-promise','path','rimraf','exports','define','analytics_custom_reports','util','../../config/logger','api'];(function(_0x4424fa,_0x5c3e9f){var _0x54544e=function(_0x2b2ff8){while(--_0x2b2ff8){_0x4424fa['push'](_0x4424fa['shift']());}};_0x54544e(++_0x5c3e9f);}(_0xf845,0x13c));var _0x5f84=function(_0x2d30d2,_0x1a1271){_0x2d30d2=_0x2d30d2-0x0;var _0xf203e8=_0xf845[_0x2d30d2];return _0xf203e8;};'use strict';var _=require('lodash');var util=require(_0x5f84('0x0'));var logger=require(_0x5f84('0x1'))(_0x5f84('0x2'));var moment=require(_0x5f84('0x3'));var BPromise=require(_0x5f84('0x4'));var rp=require(_0x5f84('0x5'));var fs=require('fs');var path=require(_0x5f84('0x6'));var rimraf=require(_0x5f84('0x7'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x5f84('0x8')]=function(_0x473e54,_0x4b3344){return _0x473e54[_0x5f84('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0x5f84('0xa'),'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 10b79a7..3badb66 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 _0x9d4e=['error','code','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x5b2167,_0x250a30){var _0x58c756=function(_0x1ddc4f){while(--_0x1ddc4f){_0x5b2167['push'](_0x5b2167['shift']());}};_0x58c756(++_0x250a30);}(_0x9d4e,0x16c));var _0xe9d4=function(_0xafcda6,_0x2817b9){_0xafcda6=_0xafcda6-0x0;var _0x2f00c5=_0x9d4e[_0xafcda6];return _0x2f00c5;};'use strict';var _=require(_0xe9d4('0x0'));var util=require('util');var moment=require(_0xe9d4('0x1'));var BPromise=require('bluebird');var rs=require(_0xe9d4('0x2'));var fs=require('fs');var Redis=require(_0xe9d4('0x3'));var db=require(_0xe9d4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9d4('0x5'))(_0xe9d4('0x6'));var config=require('../../config/environment');var jayson=require(_0xe9d4('0x7'));var client=jayson['client'][_0xe9d4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b235c,_0x397343,_0x51202f){return new BPromise(function(_0x42bdc4,_0x20fa6b){return client[_0xe9d4('0x9')](_0x1b235c,_0x51202f)[_0xe9d4('0xa')](function(_0x1c2493){logger[_0xe9d4('0xb')](_0xe9d4('0xc'),_0x397343,_0xe9d4('0xd'));logger[_0xe9d4('0xe')](_0xe9d4('0xf'),_0x397343,_0xe9d4('0xd'),JSON['stringify'](_0x1c2493));if(_0x1c2493['error']){if(_0x1c2493[_0xe9d4('0x10')][_0xe9d4('0x11')]===0x1f4){logger[_0xe9d4('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x397343,_0x1c2493[_0xe9d4('0x10')]['message']);return _0x20fa6b(_0x1c2493[_0xe9d4('0x10')][_0xe9d4('0x12')]);}logger[_0xe9d4('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x397343,_0x1c2493['error'][_0xe9d4('0x12')]);return _0x42bdc4(_0x1c2493[_0xe9d4('0x10')][_0xe9d4('0x12')]);}else{logger['info'](_0xe9d4('0xc'),_0x397343,_0xe9d4('0xd'));_0x42bdc4(_0x1c2493['result'][_0xe9d4('0x12')]);}})['catch'](function(_0x74fedd){logger[_0xe9d4('0x10')](_0xe9d4('0xc'),_0x397343,_0x74fedd);_0x20fa6b(_0x74fedd);});});} \ No newline at end of file +var _0x1704=['AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2dcd29,_0x315264){var _0x3a2654=function(_0x3a351e){while(--_0x3a351e){_0x2dcd29['push'](_0x2dcd29['shift']());}};_0x3a2654(++_0x315264);}(_0x1704,0x111));var _0x4170=function(_0x37da0c,_0x4c72b6){_0x37da0c=_0x37da0c-0x0;var _0x295d67=_0x1704[_0x37da0c];return _0x295d67;};'use strict';var _=require('lodash');var util=require(_0x4170('0x0'));var moment=require(_0x4170('0x1'));var BPromise=require(_0x4170('0x2'));var rs=require(_0x4170('0x3'));var fs=require('fs');var Redis=require(_0x4170('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4170('0x5'));var logger=require(_0x4170('0x6'))('rpc');var config=require(_0x4170('0x7'));var jayson=require(_0x4170('0x8'));var client=jayson[_0x4170('0x9')][_0x4170('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f2653,_0x1686d3,_0x168d75){return new BPromise(function(_0x531151,_0xc30ce3){return client['request'](_0x4f2653,_0x168d75)[_0x4170('0xb')](function(_0x11af40){logger[_0x4170('0xc')](_0x4170('0xd'),_0x1686d3,_0x4170('0xe'));logger['debug'](_0x4170('0xf'),_0x1686d3,_0x4170('0xe'),JSON[_0x4170('0x10')](_0x11af40));if(_0x11af40[_0x4170('0x11')]){if(_0x11af40[_0x4170('0x11')][_0x4170('0x12')]===0x1f4){logger[_0x4170('0x11')](_0x4170('0xd'),_0x1686d3,_0x11af40[_0x4170('0x11')][_0x4170('0x13')]);return _0xc30ce3(_0x11af40['error'][_0x4170('0x13')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x1686d3,_0x11af40['error']['message']);return _0x531151(_0x11af40['error']['message']);}else{logger['info'](_0x4170('0xd'),_0x1686d3,_0x4170('0xe'));_0x531151(_0x11af40[_0x4170('0x14')][_0x4170('0x13')]);}})[_0x4170('0x15')](function(_0x47d5b7){logger['error'](_0x4170('0xd'),_0x1686d3,_0x47d5b7);_0xc30ce3(_0x47d5b7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index b4855bc..cede68e 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 _0xa31d=['get','isAuthenticated','index','preview','/:id/run','run','/:id/query','query','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ad53d,_0x3067eb){var _0x57df8d=function(_0x2e1ac3){while(--_0x2e1ac3){_0x1ad53d['push'](_0x1ad53d['shift']());}};_0x57df8d(++_0x3067eb);}(_0xa31d,0xcf));var _0xda31=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0xa31d[_0x57d13b];return _0x467696;};'use strict';var multer=require(_0xda31('0x0'));var util=require(_0xda31('0x1'));var path=require(_0xda31('0x2'));var timeout=require('connect-timeout');var express=require(_0xda31('0x3'));var router=express[_0xda31('0x4')]();var fs_extra=require(_0xda31('0x5'));var auth=require(_0xda31('0x6'));var interaction=require(_0xda31('0x7'));var config=require(_0xda31('0x8'));var controller=require('./analyticCustomReport.controller');router[_0xda31('0x9')]('/',auth[_0xda31('0xa')](),controller[_0xda31('0xb')]);router[_0xda31('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xda31('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xda31('0xc')]);router[_0xda31('0x9')](_0xda31('0xd'),auth[_0xda31('0xa')](),controller[_0xda31('0xe')]);router[_0xda31('0x9')](_0xda31('0xf'),auth[_0xda31('0xa')](),controller[_0xda31('0x10')]);router[_0xda31('0x11')]('/',auth['isAuthenticated'](),controller[_0xda31('0x12')]);router['put'](_0xda31('0x13'),auth[_0xda31('0xa')](),controller[_0xda31('0x14')]);router[_0xda31('0x15')]('/:id',auth[_0xda31('0xa')](),controller[_0xda31('0x16')]);module[_0xda31('0x17')]=router; \ No newline at end of file +var _0xd6ad=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd6ad,0x129));var _0xdd6a=function(_0x2fb8d3,_0x2ec153){_0x2fb8d3=_0x2fb8d3-0x0;var _0x278bec=_0xd6ad[_0x2fb8d3];return _0x278bec;};'use strict';var multer=require(_0xdd6a('0x0'));var util=require(_0xdd6a('0x1'));var path=require(_0xdd6a('0x2'));var timeout=require(_0xdd6a('0x3'));var express=require(_0xdd6a('0x4'));var router=express[_0xdd6a('0x5')]();var fs_extra=require(_0xdd6a('0x6'));var auth=require(_0xdd6a('0x7'));var interaction=require(_0xdd6a('0x8'));var config=require(_0xdd6a('0x9'));var controller=require(_0xdd6a('0xa'));router[_0xdd6a('0xb')]('/',auth[_0xdd6a('0xc')](),controller[_0xdd6a('0xd')]);router[_0xdd6a('0xb')](_0xdd6a('0xe'),auth[_0xdd6a('0xc')](),controller[_0xdd6a('0xf')]);router[_0xdd6a('0xb')](_0xdd6a('0x10'),auth[_0xdd6a('0xc')](),controller[_0xdd6a('0x11')]);router['get'](_0xdd6a('0x12'),auth[_0xdd6a('0xc')](),controller[_0xdd6a('0x13')]);router['get'](_0xdd6a('0x14'),auth['isAuthenticated'](),controller[_0xdd6a('0x15')]);router[_0xdd6a('0x16')]('/',auth[_0xdd6a('0xc')](),controller[_0xdd6a('0x17')]);router[_0xdd6a('0x18')](_0xdd6a('0xe'),auth[_0xdd6a('0xc')](),controller[_0xdd6a('0x19')]);router[_0xdd6a('0x1a')](_0xdd6a('0xe'),auth[_0xdd6a('0xc')](),controller[_0xdd6a('0x1b')]);module[_0xdd6a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 656d356..88facbb 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 _0x7217=['sequelize','STRING','TEXT'];(function(_0x504ad9,_0x2dec3e){var _0x4aacf9=function(_0x3fec23){while(--_0x3fec23){_0x504ad9['push'](_0x504ad9['shift']());}};_0x4aacf9(++_0x2dec3e);}(_0x7217,0x19e));var _0x7721=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7217[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xda19=['exports','STRING','TEXT'];(function(_0x1a8892,_0x3c8097){var _0x1e0932=function(_0x4fc39a){while(--_0x4fc39a){_0x1a8892['push'](_0x1a8892['shift']());}};_0x1e0932(++_0x3c8097);}(_0xda19,0xd5));var _0x9da1=function(_0x53fe3f,_0x56ee14){_0x53fe3f=_0x53fe3f-0x0;var _0x4be89e=_0xda19[_0x53fe3f];return _0x4be89e;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 8328b6e..9bb7317 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x5f3dfb,_0xef3847){var _0x2e1a49=function(_0x29aec1){while(--_0x29aec1){_0x5f3dfb['push'](_0x5f3dfb['shift']());}};_0x2e1a49(++_0xef3847);}(_0x53ec,0x192));var _0xc53e=function(_0x1e76e8,_0x41ec55){_0x1e76e8=_0x1e76e8-0x0;var _0x2d7a1f=_0x53ec[_0x1e76e8];return _0x2d7a1f;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x3ff74a,_0x550558){var _0x3ce59f=function(_0x364b94){while(--_0x364b94){_0x3ff74a['push'](_0x3ff74a['shift']());}};_0x3ce59f(++_0x550558);}(_0x4975,0x86));var _0x5497=function(_0x1e9050,_0xaefc09){_0x1e9050=_0x1e9050-0x0;var _0x309cfa=_0x4975[_0x1e9050];return _0x309cfa;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b4caf85..84d3ea6 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 _0x3719=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','api','moment','bluebird','request-promise'];(function(_0x1240be,_0x4a000d){var _0x3b59d0=function(_0x3aa5b8){while(--_0x3aa5b8){_0x1240be['push'](_0x1240be['shift']());}};_0x3b59d0(++_0x4a000d);}(_0x3719,0xeb));var _0x9371=function(_0x4cda78,_0x35e3fd){_0x4cda78=_0x4cda78-0x0;var _0x17e662=_0x3719[_0x4cda78];return _0x17e662;};'use strict';var _=require(_0x9371('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9371('0x1'));var moment=require(_0x9371('0x2'));var BPromise=require(_0x9371('0x3'));var rp=require(_0x9371('0x4'));var fs=require('fs');var path=require(_0x9371('0x5'));var rimraf=require(_0x9371('0x6'));var config=require(_0x9371('0x7'));var attributes=require(_0x9371('0x8'));module[_0x9371('0x9')]=function(_0x590ddb,_0x35e3fb){return _0x590ddb[_0x9371('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x9371('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cef=['define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./analyticDefaultReport.attributes','exports'];(function(_0x26d71e,_0x25beea){var _0x5d304d=function(_0x308112){while(--_0x308112){_0x26d71e['push'](_0x26d71e['shift']());}};_0x5d304d(++_0x25beea);}(_0x1cef,0x1e3));var _0xf1ce=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x1cef[_0x4191bc];return _0x1ffd4e;};'use strict';var _=require(_0xf1ce('0x0'));var util=require(_0xf1ce('0x1'));var logger=require(_0xf1ce('0x2'))(_0xf1ce('0x3'));var moment=require(_0xf1ce('0x4'));var BPromise=require(_0xf1ce('0x5'));var rp=require(_0xf1ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf1ce('0x7'));module[_0xf1ce('0x8')]=function(_0x31a498,_0x5aee46){return _0x31a498[_0xf1ce('0x9')](_0xf1ce('0xa'),attributes,{'tableName':_0xf1ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 50a0728..a154f8b 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 _0x8a76=['../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x26ba1b,_0x275f28){var _0xb0d3f1=function(_0x57ef8f){while(--_0x57ef8f){_0x26ba1b['push'](_0x26ba1b['shift']());}};_0xb0d3f1(++_0x275f28);}(_0x8a76,0x92));var _0x68a7=function(_0x13fab8,_0x40c642){_0x13fab8=_0x13fab8-0x0;var _0x112129=_0x8a76[_0x13fab8];return _0x112129;};'use strict';var _=require(_0x68a7('0x0'));var util=require('util');var moment=require(_0x68a7('0x1'));var BPromise=require(_0x68a7('0x2'));var rs=require(_0x68a7('0x3'));var fs=require('fs');var Redis=require(_0x68a7('0x4'));var db=require(_0x68a7('0x5'))['db'];var utils=require(_0x68a7('0x6'));var logger=require(_0x68a7('0x7'))('rpc');var config=require(_0x68a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x68a7('0x9')][_0x68a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fb442,_0x17c3ed,_0x1aaeac){return new BPromise(function(_0x5d431e,_0xc93778){return client[_0x68a7('0xb')](_0x1fb442,_0x1aaeac)[_0x68a7('0xc')](function(_0x33094c){logger[_0x68a7('0xd')](_0x68a7('0xe'),_0x17c3ed,'request\x20sent');logger[_0x68a7('0xf')](_0x68a7('0x10'),_0x17c3ed,_0x68a7('0x11'),JSON[_0x68a7('0x12')](_0x33094c));if(_0x33094c['error']){if(_0x33094c['error']['code']===0x1f4){logger[_0x68a7('0x13')](_0x68a7('0xe'),_0x17c3ed,_0x33094c[_0x68a7('0x13')]['message']);return _0xc93778(_0x33094c['error'][_0x68a7('0x14')]);}logger[_0x68a7('0x13')](_0x68a7('0xe'),_0x17c3ed,_0x33094c[_0x68a7('0x13')]['message']);return _0x5d431e(_0x33094c['error'][_0x68a7('0x14')]);}else{logger[_0x68a7('0xd')](_0x68a7('0xe'),_0x17c3ed,_0x68a7('0x11'));_0x5d431e(_0x33094c['result']['message']);}})[_0x68a7('0x15')](function(_0x206795){logger[_0x68a7('0x13')](_0x68a7('0xe'),_0x17c3ed,_0x206795);_0xc93778(_0x206795);});});} \ No newline at end of file +var _0xf012=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf012,0x1b1));var _0x2f01=function(_0x25875c,_0xc144a9){_0x25875c=_0x25875c-0x0;var _0x48a9e6=_0xf012[_0x25875c];return _0x48a9e6;};'use strict';var _=require(_0x2f01('0x0'));var util=require(_0x2f01('0x1'));var moment=require(_0x2f01('0x2'));var BPromise=require(_0x2f01('0x3'));var rs=require(_0x2f01('0x4'));var fs=require('fs');var Redis=require(_0x2f01('0x5'));var db=require(_0x2f01('0x6'))['db'];var utils=require(_0x2f01('0x7'));var logger=require(_0x2f01('0x8'))(_0x2f01('0x9'));var config=require(_0x2f01('0xa'));var jayson=require(_0x2f01('0xb'));var client=jayson[_0x2f01('0xc')][_0x2f01('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3a92f3,_0x13a72d,_0x2bbe5a){return new BPromise(function(_0x534a07,_0x5b6934){return client[_0x2f01('0xe')](_0x3a92f3,_0x2bbe5a)[_0x2f01('0xf')](function(_0x1edb27){logger[_0x2f01('0x10')](_0x2f01('0x11'),_0x13a72d,'request\x20sent');logger[_0x2f01('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x13a72d,_0x2f01('0x13'),JSON[_0x2f01('0x14')](_0x1edb27));if(_0x1edb27[_0x2f01('0x15')]){if(_0x1edb27[_0x2f01('0x15')][_0x2f01('0x16')]===0x1f4){logger[_0x2f01('0x15')](_0x2f01('0x11'),_0x13a72d,_0x1edb27[_0x2f01('0x15')][_0x2f01('0x17')]);return _0x5b6934(_0x1edb27[_0x2f01('0x15')][_0x2f01('0x17')]);}logger[_0x2f01('0x15')](_0x2f01('0x11'),_0x13a72d,_0x1edb27[_0x2f01('0x15')][_0x2f01('0x17')]);return _0x534a07(_0x1edb27['error'][_0x2f01('0x17')]);}else{logger[_0x2f01('0x10')](_0x2f01('0x11'),_0x13a72d,_0x2f01('0x13'));_0x534a07(_0x1edb27[_0x2f01('0x18')][_0x2f01('0x17')]);}})[_0x2f01('0x19')](function(_0x39647f){logger[_0x2f01('0x15')](_0x2f01('0x11'),_0x13a72d,_0x39647f);_0x5b6934(_0x39647f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 2753ba3..6573589 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 _0x2d95=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0xa4c503,_0x5ae5c2){var _0x32716d=function(_0x5e1103){while(--_0x5e1103){_0xa4c503['push'](_0xa4c503['shift']());}};_0x32716d(++_0x5ae5c2);}(_0x2d95,0xca));var _0x52d9=function(_0x353a32,_0x5779d4){_0x353a32=_0x353a32-0x0;var _0x1c6aab=_0x2d95[_0x353a32];return _0x1c6aab;};'use strict';var multer=require(_0x52d9('0x0'));var util=require('util');var path=require(_0x52d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x52d9('0x2'));var router=express[_0x52d9('0x3')]();var fs_extra=require(_0x52d9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x52d9('0x5'));var config=require(_0x52d9('0x6'));var controller=require(_0x52d9('0x7'));router[_0x52d9('0x8')]('/',auth[_0x52d9('0x9')](),controller[_0x52d9('0xa')]);router[_0x52d9('0x8')](_0x52d9('0xb'),auth[_0x52d9('0x9')](),controller[_0x52d9('0xc')]);router[_0x52d9('0x8')](_0x52d9('0xd'),auth[_0x52d9('0x9')](),controller[_0x52d9('0xe')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0x52d9('0xf')]);router[_0x52d9('0x8')](_0x52d9('0x10'),auth[_0x52d9('0x9')](),controller[_0x52d9('0x11')]);router['post']('/',auth[_0x52d9('0x9')](),controller[_0x52d9('0x12')]);router[_0x52d9('0x13')](_0x52d9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x52d9('0x14')](_0x52d9('0xb'),auth[_0x52d9('0x9')](),controller[_0x52d9('0x15')]);module[_0x52d9('0x16')]=router; \ No newline at end of file +var _0x5883=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','delete','destroy','exports','multer'];(function(_0x33c024,_0x4c819f){var _0x286da7=function(_0x2811b3){while(--_0x2811b3){_0x33c024['push'](_0x33c024['shift']());}};_0x286da7(++_0x4c819f);}(_0x5883,0x1c7));var _0x3588=function(_0x40906e,_0xddb60f){_0x40906e=_0x40906e-0x0;var _0x4f0f08=_0x5883[_0x40906e];return _0x4f0f08;};'use strict';var multer=require(_0x3588('0x0'));var util=require(_0x3588('0x1'));var path=require('path');var timeout=require(_0x3588('0x2'));var express=require(_0x3588('0x3'));var router=express['Router']();var fs_extra=require(_0x3588('0x4'));var auth=require(_0x3588('0x5'));var interaction=require(_0x3588('0x6'));var config=require(_0x3588('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0x3588('0x8')]('/',auth['isAuthenticated'](),controller[_0x3588('0x9')]);router[_0x3588('0x8')](_0x3588('0xa'),auth[_0x3588('0xb')](),controller[_0x3588('0xc')]);router[_0x3588('0x8')](_0x3588('0xd'),auth[_0x3588('0xb')](),controller[_0x3588('0xe')]);router['get'](_0x3588('0xf'),auth[_0x3588('0xb')](),controller['run']);router[_0x3588('0x8')](_0x3588('0x10'),auth[_0x3588('0xb')](),controller[_0x3588('0x11')]);router[_0x3588('0x12')]('/',auth['isAuthenticated'](),controller[_0x3588('0x13')]);router[_0x3588('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3588('0x15')](_0x3588('0xa'),auth['isAuthenticated'](),controller[_0x3588('0x16')]);module[_0x3588('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 4b99899..db2d178 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 _0xadaf=['scheduled','INTEGER','UNSIGNED','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x2cdebc,_0x437797){var _0x306326=function(_0x4529d5){while(--_0x4529d5){_0x2cdebc['push'](_0x2cdebc['shift']());}};_0x306326(++_0x437797);}(_0xadaf,0x179));var _0xfada=function(_0x4b328a,_0x3be393){_0x4b328a=_0x4b328a-0x0;var _0x4ce14d=_0xadaf[_0x4b328a];return _0x4ce14d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xfada('0x0')]={'name':{'type':Sequelize[_0xfada('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xfada('0x2')](_0xfada('0x3'),_0xfada('0x4'),_0xfada('0x5')),'allowNull':![],'defaultValue':_0xfada('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xfada('0x6')]},'status':{'type':Sequelize[_0xfada('0x1')],'defaultValue':_0xfada('0x7')},'type':{'type':Sequelize['ENUM']('manual',_0xfada('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xfada('0x9')](0xb)[_0xfada('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x013f=['STRING','ENUM','csv','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','moment'];(function(_0x1593f3,_0x25f8d5){var _0x42813c=function(_0x23f69f){while(--_0x23f69f){_0x1593f3['push'](_0x1593f3['shift']());}};_0x42813c(++_0x25f8d5);}(_0x013f,0xba));var _0xf013=function(_0x6783ec,_0x4f578c){_0x6783ec=_0x6783ec-0x0;var _0x41545b=_0x013f[_0x6783ec];return _0x41545b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf013('0x0'));module['exports']={'name':{'type':Sequelize[_0xf013('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xf013('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xf013('0x2')](_0xf013('0x3'),'pdf',_0xf013('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xf013('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xf013('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xf013('0x6')},'type':{'type':Sequelize[_0xf013('0x2')](_0xf013('0x7'),_0xf013('0x8')),'allowNull':![],'defaultValue':_0xf013('0x7')},'reportId':{'type':Sequelize[_0xf013('0x9')](0xb)[_0xf013('0xa')]},'reportType':{'type':Sequelize[_0xf013('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 12c94c0..f8b1336 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 _0xb266=['savename','output','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','root','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','include','rows','show','params','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename'];(function(_0x82a071,_0x252266){var _0x15dda9=function(_0x3f73b0){while(--_0x3f73b0){_0x82a071['push'](_0x82a071['shift']());}};_0x15dda9(++_0x252266);}(_0xb266,0x139));var _0x6b26=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb266[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x6b26('0x0'));var rimraf=require(_0x6b26('0x1'));var zipdir=require(_0x6b26('0x2'));var jsonpatch=require(_0x6b26('0x3'));var rp=require(_0x6b26('0x4'));var moment=require(_0x6b26('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6b26('0x6'));var util=require('util');var path=require(_0x6b26('0x7'));var sox=require(_0x6b26('0x8'));var csv=require(_0x6b26('0x9'));var ejs=require(_0x6b26('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b26('0xb'));var squel=require(_0x6b26('0xc'));var crypto=require(_0x6b26('0xd'));var jsforce=require(_0x6b26('0xe'));var deskjs=require(_0x6b26('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6b26('0x10'));var Papa=require(_0x6b26('0x11'));var Redis=require(_0x6b26('0x12'));var authService=require(_0x6b26('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6b26('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b26('0x15'))(_0x6b26('0x16'));var utils=require(_0x6b26('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6b26('0x18'))['db'];function respondWithStatusCode(_0x12e585,_0x2c9e72){_0x2c9e72=_0x2c9e72||0xcc;return function(_0x1ccf5e){if(_0x1ccf5e){return _0x12e585['sendStatus'](_0x2c9e72);}return _0x12e585[_0x6b26('0x19')](_0x2c9e72)[_0x6b26('0x1a')]();};}function respondWithResult(_0x328e32,_0x112b1b){_0x112b1b=_0x112b1b||0xc8;return function(_0x33b728){if(_0x33b728){return _0x328e32[_0x6b26('0x19')](_0x112b1b)['json'](_0x33b728);}};}function respondWithFilteredResult(_0x52bd45,_0x4bb838){return function(_0x4c7bb0){if(_0x4c7bb0){var _0x4a8c63=typeof _0x4bb838[_0x6b26('0x1b')]===_0x6b26('0x1c')&&typeof _0x4bb838[_0x6b26('0x1d')]===_0x6b26('0x1c');var _0x733615=_0x4c7bb0[_0x6b26('0x1e')];var _0x255b59=_0x4a8c63?0x0:_0x4bb838['offset'];var _0x56dd5d=_0x4a8c63?_0x4c7bb0[_0x6b26('0x1e')]:_0x4bb838['offset']+_0x4bb838[_0x6b26('0x1d')];var _0x4b4748;if(_0x56dd5d>=_0x733615){_0x56dd5d=_0x733615;_0x4b4748=0xc8;}else{_0x4b4748=0xce;}_0x52bd45[_0x6b26('0x19')](_0x4b4748);return _0x52bd45['set']('Content-Range',_0x255b59+'-'+_0x56dd5d+'/'+_0x733615)[_0x6b26('0x1f')](_0x4c7bb0);}return null;};}function patchUpdates(_0x3c4384){return function(_0x488f82){try{jsonpatch[_0x6b26('0x20')](_0x488f82,_0x3c4384,!![]);}catch(_0x24b94d){return BPromise['reject'](_0x24b94d);}return _0x488f82[_0x6b26('0x21')]();};}function saveUpdates(_0x39f0f3,_0x5caa6d){return function(_0x59266c){if(_0x59266c){return _0x59266c[_0x6b26('0x22')](_0x39f0f3)[_0x6b26('0x23')](function(_0x543504){return _0x543504;});}return null;};}function removeEntity(_0x164a9d,_0x194ac0){return function(_0x494c10){if(_0x494c10){return _0x494c10[_0x6b26('0x24')]()['then'](function(){var _0xc408ac=_0x494c10[_0x6b26('0x25')]({'plain':!![]});var _0x21c3c0=_0x6b26('0x26');return db[_0x6b26('0x27')][_0x6b26('0x24')]({'where':{'type':_0x21c3c0,'resourceId':_0xc408ac['id']}})[_0x6b26('0x23')](function(){return _0x494c10;});})[_0x6b26('0x23')](function(){_0x164a9d[_0x6b26('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221677,_0x260238){return function(_0x3af961){if(!_0x3af961){_0x221677[_0x6b26('0x28')](0x194);}return _0x3af961;};}function handleError(_0x322808,_0x16aea6){_0x16aea6=_0x16aea6||0x1f4;return function(_0x1ab6d9){logger['error'](_0x1ab6d9[_0x6b26('0x29')]);if(_0x1ab6d9[_0x6b26('0x2a')]){delete _0x1ab6d9[_0x6b26('0x2a')];}_0x322808[_0x6b26('0x19')](_0x16aea6)[_0x6b26('0x2b')](_0x1ab6d9);};}exports[_0x6b26('0x2c')]=function(_0x11a3d0,_0x4f792a){var _0x50cdbf={},_0x39fa46={},_0x10295e={'count':0x0,'rows':[]};var _0xf02513=_[_0x6b26('0x2d')](db[_0x6b26('0x2e')][_0x6b26('0x2f')],function(_0x85cc87){return{'name':_0x85cc87[_0x6b26('0x30')],'type':_0x85cc87['type'][_0x6b26('0x31')]};});_0x39fa46['model']=_['map'](_0xf02513,'name');_0x39fa46[_0x6b26('0x32')]=_['keys'](_0x11a3d0[_0x6b26('0x32')]);_0x39fa46[_0x6b26('0x33')]=_['intersection'](_0x39fa46[_0x6b26('0x34')],_0x39fa46[_0x6b26('0x32')]);_0x50cdbf[_0x6b26('0x35')]=_[_0x6b26('0x36')](_0x39fa46[_0x6b26('0x34')],qs[_0x6b26('0x37')](_0x11a3d0[_0x6b26('0x32')][_0x6b26('0x37')]));_0x50cdbf[_0x6b26('0x35')]=_0x50cdbf[_0x6b26('0x35')][_0x6b26('0x38')]?_0x50cdbf[_0x6b26('0x35')]:_0x39fa46['model'];if(!_0x11a3d0['query'][_0x6b26('0x39')](_0x6b26('0x3a'))){_0x50cdbf['limit']=qs['limit'](_0x11a3d0[_0x6b26('0x32')][_0x6b26('0x1d')]);_0x50cdbf[_0x6b26('0x1b')]=qs[_0x6b26('0x1b')](_0x11a3d0['query']['offset']);}_0x50cdbf[_0x6b26('0x3b')]=qs[_0x6b26('0x3c')](_0x11a3d0['query']['sort']);_0x50cdbf[_0x6b26('0x3d')]=qs[_0x6b26('0x33')](_[_0x6b26('0x3e')](_0x11a3d0[_0x6b26('0x32')],_0x39fa46[_0x6b26('0x33')]),_0xf02513);if(_0x11a3d0['query']['filter']){_0x50cdbf[_0x6b26('0x3d')]=_[_0x6b26('0x3f')](_0x50cdbf[_0x6b26('0x3d')],{'$or':_[_0x6b26('0x2d')](_0xf02513,function(_0xbac530){if(_0xbac530[_0x6b26('0x40')]!=='VIRTUAL'){var _0x237506={};_0x237506[_0xbac530['name']]={'$like':'%'+_0x11a3d0[_0x6b26('0x32')][_0x6b26('0x41')]+'%'};return _0x237506;}})});}_0x50cdbf=_['merge']({},_0x50cdbf,_0x11a3d0['options']);var _0x33ce38={'where':_0x50cdbf[_0x6b26('0x3d')]};return db[_0x6b26('0x2e')][_0x6b26('0x1e')](_0x33ce38)[_0x6b26('0x23')](function(_0xca35b3){_0x10295e[_0x6b26('0x1e')]=_0xca35b3;if(_0x11a3d0['query']['includeAll']){_0x50cdbf[_0x6b26('0x42')]=[{'all':!![]}];}return db[_0x6b26('0x2e')]['findAll'](_0x50cdbf);})[_0x6b26('0x23')](function(_0x258f62){_0x10295e[_0x6b26('0x43')]=_0x258f62;return _0x10295e;})[_0x6b26('0x23')](respondWithFilteredResult(_0x4f792a,_0x50cdbf))['catch'](handleError(_0x4f792a,null));};exports[_0x6b26('0x44')]=function(_0x183685,_0x585d3e){var _0x103f34={'raw':!![],'where':{'id':_0x183685[_0x6b26('0x45')]['id']}},_0x4fec27={};_0x4fec27['model']=_[_0x6b26('0x46')](db[_0x6b26('0x2e')][_0x6b26('0x2f')]);_0x4fec27[_0x6b26('0x32')]=_[_0x6b26('0x46')](_0x183685[_0x6b26('0x32')]);_0x4fec27[_0x6b26('0x33')]=_[_0x6b26('0x36')](_0x4fec27[_0x6b26('0x34')],_0x4fec27[_0x6b26('0x32')]);_0x103f34[_0x6b26('0x35')]=_[_0x6b26('0x36')](_0x4fec27[_0x6b26('0x34')],qs[_0x6b26('0x37')](_0x183685[_0x6b26('0x32')]['fields']));_0x103f34[_0x6b26('0x35')]=_0x103f34[_0x6b26('0x35')]['length']?_0x103f34[_0x6b26('0x35')]:_0x4fec27[_0x6b26('0x34')];if(_0x183685[_0x6b26('0x32')][_0x6b26('0x47')]){_0x103f34['include']=[{'all':!![]}];}_0x103f34=_[_0x6b26('0x3f')]({},_0x103f34,_0x183685[_0x6b26('0x48')]);return db['AnalyticExtractedReport'][_0x6b26('0x49')](_0x103f34)[_0x6b26('0x23')](handleEntityNotFound(_0x585d3e,null))[_0x6b26('0x23')](respondWithResult(_0x585d3e,null))['catch'](handleError(_0x585d3e,null));};exports[_0x6b26('0x4a')]=function(_0x4db989,_0x2379d0){return db[_0x6b26('0x2e')][_0x6b26('0x4a')](_0x4db989[_0x6b26('0x4b')],{})['then'](function(_0x445c25){var _0x321308=_0x4db989[_0x6b26('0x4c')]['get']({'plain':!![]});if(!_0x321308)throw new Error(_0x6b26('0x4d'));if(_0x321308[_0x6b26('0x4e')]===_0x6b26('0x4c')){var _0x3eebd4=_0x445c25[_0x6b26('0x25')]({'plain':!![]});var _0x122ab2=_0x6b26('0x26');return db[_0x6b26('0x4f')][_0x6b26('0x49')]({'where':{'name':_0x122ab2,'userProfileId':_0x321308[_0x6b26('0x50')]},'raw':!![]})['then'](function(_0x13c71c){if(_0x13c71c&&_0x13c71c[_0x6b26('0x51')]===0x0){return db[_0x6b26('0x27')][_0x6b26('0x4a')]({'name':_0x3eebd4['name'],'resourceId':_0x3eebd4['id'],'type':_0x13c71c[_0x6b26('0x2a')],'sectionId':_0x13c71c['id']},{})['then'](function(){return _0x445c25;});}else{return _0x445c25;}})[_0x6b26('0x52')](function(_0xf2dd1d){logger[_0x6b26('0x53')](_0x6b26('0x54'),_0xf2dd1d);throw _0xf2dd1d;});}return _0x445c25;})[_0x6b26('0x23')](respondWithResult(_0x2379d0,0xc9))[_0x6b26('0x52')](handleError(_0x2379d0,null));};exports[_0x6b26('0x22')]=function(_0x32eaea,_0x29f649){if(_0x32eaea[_0x6b26('0x4b')]['id']){delete _0x32eaea[_0x6b26('0x4b')]['id'];}return db[_0x6b26('0x2e')][_0x6b26('0x49')]({'where':{'id':_0x32eaea['params']['id']}})[_0x6b26('0x23')](handleEntityNotFound(_0x29f649,null))['then'](saveUpdates(_0x32eaea[_0x6b26('0x4b')],null))[_0x6b26('0x23')](respondWithResult(_0x29f649,null))[_0x6b26('0x52')](handleError(_0x29f649,null));};exports[_0x6b26('0x24')]=function(_0x3d7c6d,_0x14f606){return db['AnalyticExtractedReport'][_0x6b26('0x49')]({'where':{'id':_0x3d7c6d[_0x6b26('0x45')]['id']}})['then'](handleEntityNotFound(_0x14f606,null))[_0x6b26('0x23')](removeEntity(_0x14f606,null))[_0x6b26('0x52')](handleError(_0x14f606,null));};exports[_0x6b26('0x55')]=function(_0x159369,_0x15855d,_0x3f4806){return db[_0x6b26('0x2e')][_0x6b26('0x49')]({'where':{'id':_0x159369[_0x6b26('0x45')]['id']},'attributes':[_0x6b26('0x2a'),_0x6b26('0x56'),_0x6b26('0x57'),_0x6b26('0x58')],'raw':!![]})[_0x6b26('0x23')](handleEntityNotFound(_0x15855d,null))['then'](function(_0x2e67dd){if(_0x2e67dd){if(!fs[_0x6b26('0x59')](path['join'](config['root'],_0x6b26('0x5a'),_0x2e67dd[_0x6b26('0x57')]))){throw new db[(_0x6b26('0x5b'))][(_0x6b26('0x5c'))](_0x6b26('0x5d'));}if(_0x159369['query'][_0x6b26('0x5e')]){return _0x15855d[_0x6b26('0x28')](0xc8);}return _0x15855d[_0x6b26('0x55')](path[_0x6b26('0x5f')](config[_0x6b26('0x60')],_0x6b26('0x5a'),_0x2e67dd[_0x6b26('0x57')]),util[_0x6b26('0x61')](_0x6b26('0x62'),_0x2e67dd['basename']||_0x2e67dd['name'],_0x2e67dd[_0x6b26('0x58')][_0x6b26('0x63')]()));}})[_0x6b26('0x52')](handleError(_0x15855d,null));}; \ No newline at end of file +var _0xa486=['download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','destroy','ExtractedReports','UserProfileResource','error','name','send','map','AnalyticExtractedReport','rawAttributes','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','intersection','find','catch','create','body','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x3267b8,_0x308961){var _0x3e456f=function(_0x59e286){while(--_0x59e286){_0x3267b8['push'](_0x3267b8['shift']());}};_0x3e456f(++_0x308961);}(_0xa486,0x1ef));var _0x6a48=function(_0x545056,_0x7e5994){_0x545056=_0x545056-0x0;var _0x5c4153=_0xa486[_0x545056];return _0x5c4153;};'use strict';var emlformat=require(_0x6a48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a48('0x1'));var jsonpatch=require(_0x6a48('0x2'));var rp=require(_0x6a48('0x3'));var moment=require(_0x6a48('0x4'));var BPromise=require(_0x6a48('0x5'));var Mustache=require(_0x6a48('0x6'));var util=require(_0x6a48('0x7'));var path=require('path');var sox=require(_0x6a48('0x8'));var csv=require(_0x6a48('0x9'));var ejs=require(_0x6a48('0xa'));var fs=require('fs');var fs_extra=require(_0x6a48('0xb'));var _=require(_0x6a48('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6a48('0xd'));var deskjs=require(_0x6a48('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6a48('0xf'));var Papa=require(_0x6a48('0x10'));var Redis=require('ioredis');var authService=require(_0x6a48('0x11'));var qs=require(_0x6a48('0x12'));var as=require(_0x6a48('0x13'));var hardwareService=require(_0x6a48('0x14'));var logger=require(_0x6a48('0x15'))('api');var utils=require(_0x6a48('0x16'));var config=require(_0x6a48('0x17'));var licenseUtil=require(_0x6a48('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fcb72,_0x3e21b6){_0x3e21b6=_0x3e21b6||0xcc;return function(_0x1468a3){if(_0x1468a3){return _0x4fcb72[_0x6a48('0x19')](_0x3e21b6);}return _0x4fcb72[_0x6a48('0x1a')](_0x3e21b6)[_0x6a48('0x1b')]();};}function respondWithResult(_0x419243,_0x5623f4){_0x5623f4=_0x5623f4||0xc8;return function(_0x25537b){if(_0x25537b){return _0x419243[_0x6a48('0x1a')](_0x5623f4)[_0x6a48('0x1c')](_0x25537b);}};}function respondWithFilteredResult(_0x556464,_0x2bf0d5){return function(_0x26aa41){if(_0x26aa41){var _0x10419b=typeof _0x2bf0d5[_0x6a48('0x1d')]===_0x6a48('0x1e')&&typeof _0x2bf0d5['limit']===_0x6a48('0x1e');var _0x84703=_0x26aa41[_0x6a48('0x1f')];var _0xc1c2bb=_0x10419b?0x0:_0x2bf0d5[_0x6a48('0x1d')];var _0x3a7008=_0x10419b?_0x26aa41[_0x6a48('0x1f')]:_0x2bf0d5[_0x6a48('0x1d')]+_0x2bf0d5[_0x6a48('0x20')];var _0x3ce887;if(_0x3a7008>=_0x84703){_0x3a7008=_0x84703;_0x3ce887=0xc8;}else{_0x3ce887=0xce;}_0x556464[_0x6a48('0x1a')](_0x3ce887);return _0x556464[_0x6a48('0x21')]('Content-Range',_0xc1c2bb+'-'+_0x3a7008+'/'+_0x84703)[_0x6a48('0x1c')](_0x26aa41);}return null;};}function patchUpdates(_0x4c8163){return function(_0x119189){try{jsonpatch[_0x6a48('0x22')](_0x119189,_0x4c8163,!![]);}catch(_0x335f78){return BPromise['reject'](_0x335f78);}return _0x119189[_0x6a48('0x23')]();};}function saveUpdates(_0x3cc25b,_0x367b6d){return function(_0x1c35b9){if(_0x1c35b9){return _0x1c35b9['update'](_0x3cc25b)[_0x6a48('0x24')](function(_0x1dbe37){return _0x1dbe37;});}return null;};}function removeEntity(_0x5adbf8,_0x510a5f){return function(_0x4c6788){if(_0x4c6788){return _0x4c6788[_0x6a48('0x25')]()[_0x6a48('0x24')](function(){var _0x4d2ef8=_0x4c6788['get']({'plain':!![]});var _0x2c18f5=_0x6a48('0x26');return db[_0x6a48('0x27')][_0x6a48('0x25')]({'where':{'type':_0x2c18f5,'resourceId':_0x4d2ef8['id']}})['then'](function(){return _0x4c6788;});})[_0x6a48('0x24')](function(){_0x5adbf8[_0x6a48('0x1a')](0xcc)[_0x6a48('0x1b')]();});}};}function handleEntityNotFound(_0x3766f5,_0xe5dcf9){return function(_0x54acd7){if(!_0x54acd7){_0x3766f5['sendStatus'](0x194);}return _0x54acd7;};}function handleError(_0x20e785,_0x5bddf1){_0x5bddf1=_0x5bddf1||0x1f4;return function(_0x210e8f){logger[_0x6a48('0x28')](_0x210e8f['stack']);if(_0x210e8f[_0x6a48('0x29')]){delete _0x210e8f['name'];}_0x20e785[_0x6a48('0x1a')](_0x5bddf1)[_0x6a48('0x2a')](_0x210e8f);};}exports['index']=function(_0xdde5fb,_0x46f356){var _0x79f873={},_0xea7362={},_0x5e2d96={'count':0x0,'rows':[]};var _0x4170c5=_[_0x6a48('0x2b')](db[_0x6a48('0x2c')][_0x6a48('0x2d')],function(_0x5ed04f){return{'name':_0x5ed04f['fieldName'],'type':_0x5ed04f['type'][_0x6a48('0x2e')]};});_0xea7362[_0x6a48('0x2f')]=_[_0x6a48('0x2b')](_0x4170c5,_0x6a48('0x29'));_0xea7362['query']=_[_0x6a48('0x30')](_0xdde5fb[_0x6a48('0x31')]);_0xea7362['filters']=_['intersection'](_0xea7362[_0x6a48('0x2f')],_0xea7362[_0x6a48('0x31')]);_0x79f873[_0x6a48('0x32')]=_['intersection'](_0xea7362[_0x6a48('0x2f')],qs[_0x6a48('0x33')](_0xdde5fb[_0x6a48('0x31')]['fields']));_0x79f873['attributes']=_0x79f873[_0x6a48('0x32')][_0x6a48('0x34')]?_0x79f873['attributes']:_0xea7362[_0x6a48('0x2f')];if(!_0xdde5fb[_0x6a48('0x31')][_0x6a48('0x35')](_0x6a48('0x36'))){_0x79f873['limit']=qs[_0x6a48('0x20')](_0xdde5fb[_0x6a48('0x31')][_0x6a48('0x20')]);_0x79f873[_0x6a48('0x1d')]=qs['offset'](_0xdde5fb['query']['offset']);}_0x79f873[_0x6a48('0x37')]=qs[_0x6a48('0x38')](_0xdde5fb[_0x6a48('0x31')][_0x6a48('0x38')]);_0x79f873[_0x6a48('0x39')]=qs[_0x6a48('0x3a')](_[_0x6a48('0x3b')](_0xdde5fb[_0x6a48('0x31')],_0xea7362[_0x6a48('0x3a')]),_0x4170c5);if(_0xdde5fb[_0x6a48('0x31')][_0x6a48('0x3c')]){_0x79f873['where']=_[_0x6a48('0x3d')](_0x79f873['where'],{'$or':_[_0x6a48('0x2b')](_0x4170c5,function(_0x248007){if(_0x248007[_0x6a48('0x3e')]!==_0x6a48('0x3f')){var _0xcf70b4={};_0xcf70b4[_0x248007[_0x6a48('0x29')]]={'$like':'%'+_0xdde5fb['query'][_0x6a48('0x3c')]+'%'};return _0xcf70b4;}})});}_0x79f873=_[_0x6a48('0x3d')]({},_0x79f873,_0xdde5fb[_0x6a48('0x40')]);var _0x42cf5c={'where':_0x79f873[_0x6a48('0x39')]};return db[_0x6a48('0x2c')][_0x6a48('0x1f')](_0x42cf5c)['then'](function(_0x7beb9b){_0x5e2d96[_0x6a48('0x1f')]=_0x7beb9b;if(_0xdde5fb[_0x6a48('0x31')][_0x6a48('0x41')]){_0x79f873[_0x6a48('0x42')]=[{'all':!![]}];}return db[_0x6a48('0x2c')]['findAll'](_0x79f873);})[_0x6a48('0x24')](function(_0x34a3fc){_0x5e2d96[_0x6a48('0x43')]=_0x34a3fc;return _0x5e2d96;})['then'](respondWithFilteredResult(_0x46f356,_0x79f873))['catch'](handleError(_0x46f356,null));};exports[_0x6a48('0x44')]=function(_0x8ccf01,_0x3d6d3e){var _0x231f43={'raw':!![],'where':{'id':_0x8ccf01[_0x6a48('0x45')]['id']}},_0xcf5438={};_0xcf5438[_0x6a48('0x2f')]=_[_0x6a48('0x30')](db[_0x6a48('0x2c')]['rawAttributes']);_0xcf5438['query']=_['keys'](_0x8ccf01['query']);_0xcf5438['filters']=_['intersection'](_0xcf5438[_0x6a48('0x2f')],_0xcf5438[_0x6a48('0x31')]);_0x231f43[_0x6a48('0x32')]=_[_0x6a48('0x46')](_0xcf5438['model'],qs[_0x6a48('0x33')](_0x8ccf01[_0x6a48('0x31')][_0x6a48('0x33')]));_0x231f43['attributes']=_0x231f43[_0x6a48('0x32')][_0x6a48('0x34')]?_0x231f43[_0x6a48('0x32')]:_0xcf5438[_0x6a48('0x2f')];if(_0x8ccf01['query'][_0x6a48('0x41')]){_0x231f43['include']=[{'all':!![]}];}_0x231f43=_[_0x6a48('0x3d')]({},_0x231f43,_0x8ccf01[_0x6a48('0x40')]);return db[_0x6a48('0x2c')][_0x6a48('0x47')](_0x231f43)['then'](handleEntityNotFound(_0x3d6d3e,null))[_0x6a48('0x24')](respondWithResult(_0x3d6d3e,null))[_0x6a48('0x48')](handleError(_0x3d6d3e,null));};exports[_0x6a48('0x49')]=function(_0x324de0,_0x34e339){return db[_0x6a48('0x2c')]['create'](_0x324de0[_0x6a48('0x4a')],{})['then'](function(_0x127bfb){var _0x5d0c26=_0x324de0['user'][_0x6a48('0x4b')]({'plain':!![]});if(!_0x5d0c26)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d0c26[_0x6a48('0x4c')]==='user'){var _0x3a1ae8=_0x127bfb['get']({'plain':!![]});var _0x4d5ba9=_0x6a48('0x26');return db['UserProfileSection'][_0x6a48('0x47')]({'where':{'name':_0x4d5ba9,'userProfileId':_0x5d0c26[_0x6a48('0x4d')]},'raw':!![]})[_0x6a48('0x24')](function(_0x594984){if(_0x594984&&_0x594984[_0x6a48('0x4e')]===0x0){return db[_0x6a48('0x27')][_0x6a48('0x49')]({'name':_0x3a1ae8[_0x6a48('0x29')],'resourceId':_0x3a1ae8['id'],'type':_0x594984[_0x6a48('0x29')],'sectionId':_0x594984['id']},{})[_0x6a48('0x24')](function(){return _0x127bfb;});}else{return _0x127bfb;}})[_0x6a48('0x48')](function(_0x3d40a9){logger['error'](_0x6a48('0x4f'),_0x3d40a9);throw _0x3d40a9;});}return _0x127bfb;})[_0x6a48('0x24')](respondWithResult(_0x34e339,0xc9))[_0x6a48('0x48')](handleError(_0x34e339,null));};exports[_0x6a48('0x50')]=function(_0x4c7efa,_0x173ef3){if(_0x4c7efa[_0x6a48('0x4a')]['id']){delete _0x4c7efa['body']['id'];}return db[_0x6a48('0x2c')]['find']({'where':{'id':_0x4c7efa[_0x6a48('0x45')]['id']}})[_0x6a48('0x24')](handleEntityNotFound(_0x173ef3,null))[_0x6a48('0x24')](saveUpdates(_0x4c7efa[_0x6a48('0x4a')],null))[_0x6a48('0x24')](respondWithResult(_0x173ef3,null))['catch'](handleError(_0x173ef3,null));};exports['destroy']=function(_0x4c88c2,_0x33249e){return db[_0x6a48('0x2c')][_0x6a48('0x47')]({'where':{'id':_0x4c88c2[_0x6a48('0x45')]['id']}})[_0x6a48('0x24')](handleEntityNotFound(_0x33249e,null))[_0x6a48('0x24')](removeEntity(_0x33249e,null))[_0x6a48('0x48')](handleError(_0x33249e,null));};exports[_0x6a48('0x51')]=function(_0x33e85a,_0x3efdcd,_0x116e24){return db['AnalyticExtractedReport'][_0x6a48('0x47')]({'where':{'id':_0x33e85a[_0x6a48('0x45')]['id']},'attributes':[_0x6a48('0x29'),_0x6a48('0x52'),_0x6a48('0x53'),_0x6a48('0x54')],'raw':!![]})[_0x6a48('0x24')](handleEntityNotFound(_0x3efdcd,null))[_0x6a48('0x24')](function(_0x220af1){if(_0x220af1){if(!fs[_0x6a48('0x55')](path[_0x6a48('0x56')](config[_0x6a48('0x57')],_0x6a48('0x58'),_0x220af1[_0x6a48('0x53')]))){throw new db[(_0x6a48('0x59'))][(_0x6a48('0x5a'))](_0x6a48('0x5b'));}if(_0x33e85a['query'][_0x6a48('0x5c')]){return _0x3efdcd[_0x6a48('0x19')](0xc8);}return _0x3efdcd[_0x6a48('0x51')](path[_0x6a48('0x56')](config['root'],'server/files/reports',_0x220af1[_0x6a48('0x53')]),util[_0x6a48('0x5d')](_0x6a48('0x5e'),_0x220af1['basename']||_0x220af1[_0x6a48('0x29')],_0x220af1['output'][_0x6a48('0x5f')]()));}})[_0x6a48('0x48')](handleError(_0x3efdcd,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 31ad0a4..94ee659 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 _0xd1a7=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd1a7,0x113));var _0x7d1a=function(_0x316458,_0x588d62){_0x316458=_0x316458-0x0;var _0x213445=_0xd1a7[_0x316458];return _0x213445;};'use strict';var _=require(_0x7d1a('0x0'));var util=require('util');var logger=require(_0x7d1a('0x1'))(_0x7d1a('0x2'));var moment=require(_0x7d1a('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d1a('0x4'));var fs=require('fs');var path=require(_0x7d1a('0x5'));var rimraf=require(_0x7d1a('0x6'));var config=require('../../config/environment');var attributes=require(_0x7d1a('0x7'));module['exports']=function(_0x448b69,_0x1035b3){return _0x448b69[_0x7d1a('0x8')](_0x7d1a('0x9'),attributes,{'tableName':_0x7d1a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fed=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment'];(function(_0x305ac5,_0x54d4aa){var _0x4ff032=function(_0x8f8cd8){while(--_0x8f8cd8){_0x305ac5['push'](_0x305ac5['shift']());}};_0x4ff032(++_0x54d4aa);}(_0x0fed,0xb2));var _0xd0fe=function(_0x4851c2,_0x35e83a){_0x4851c2=_0x4851c2-0x0;var _0xd3409b=_0x0fed[_0x4851c2];return _0xd3409b;};'use strict';var _=require('lodash');var util=require(_0xd0fe('0x0'));var logger=require(_0xd0fe('0x1'))(_0xd0fe('0x2'));var moment=require(_0xd0fe('0x3'));var BPromise=require(_0xd0fe('0x4'));var rp=require(_0xd0fe('0x5'));var fs=require('fs');var path=require(_0xd0fe('0x6'));var rimraf=require(_0xd0fe('0x7'));var config=require(_0xd0fe('0x8'));var attributes=require(_0xd0fe('0x9'));module[_0xd0fe('0xa')]=function(_0x2ceb44,_0x485ac9){return _0x2ceb44[_0xd0fe('0xb')](_0xd0fe('0xc'),attributes,{'tableName':_0xd0fe('0xd'),'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 da8fe09..dfe1b7f 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 _0x43c2=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x245fd8,_0x4f5262){var _0x5958a8=function(_0x42166e){while(--_0x42166e){_0x245fd8['push'](_0x245fd8['shift']());}};_0x5958a8(++_0x4f5262);}(_0x43c2,0x1a1));var _0x243c=function(_0x31ee74,_0x3f055b){_0x31ee74=_0x31ee74-0x0;var _0xe904ee=_0x43c2[_0x31ee74];return _0xe904ee;};'use strict';var _=require(_0x243c('0x0'));var util=require(_0x243c('0x1'));var moment=require(_0x243c('0x2'));var BPromise=require(_0x243c('0x3'));var rs=require(_0x243c('0x4'));var fs=require('fs');var Redis=require(_0x243c('0x5'));var db=require(_0x243c('0x6'))['db'];var utils=require(_0x243c('0x7'));var logger=require(_0x243c('0x8'))(_0x243c('0x9'));var config=require(_0x243c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x243c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1de96c,_0x45ef59,_0x211fe){return new BPromise(function(_0x57f579,_0x16b16b){return client[_0x243c('0xc')](_0x1de96c,_0x211fe)[_0x243c('0xd')](function(_0x58c50f){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x45ef59,'request\x20sent');logger[_0x243c('0xe')](_0x243c('0xf'),_0x45ef59,'request\x20sent',JSON[_0x243c('0x10')](_0x58c50f));if(_0x58c50f[_0x243c('0x11')]){if(_0x58c50f[_0x243c('0x11')]['code']===0x1f4){logger[_0x243c('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x45ef59,_0x58c50f[_0x243c('0x11')]['message']);return _0x16b16b(_0x58c50f['error']['message']);}logger[_0x243c('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x45ef59,_0x58c50f[_0x243c('0x11')][_0x243c('0x12')]);return _0x57f579(_0x58c50f['error']['message']);}else{logger[_0x243c('0x13')](_0x243c('0x14'),_0x45ef59,_0x243c('0x15'));_0x57f579(_0x58c50f[_0x243c('0x16')][_0x243c('0x12')]);}})['catch'](function(_0x26d996){logger['error'](_0x243c('0x14'),_0x45ef59,_0x26d996);_0x16b16b(_0x26d996);});});} \ No newline at end of file +var _0xb3ca=['client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x493f95,_0x2212fc){var _0x899d7f=function(_0xd5286){while(--_0xd5286){_0x493f95['push'](_0x493f95['shift']());}};_0x899d7f(++_0x2212fc);}(_0xb3ca,0x70));var _0xab3c=function(_0x1d5ccb,_0x136776){_0x1d5ccb=_0x1d5ccb-0x0;var _0x49fc07=_0xb3ca[_0x1d5ccb];return _0x49fc07;};'use strict';var _=require('lodash');var util=require(_0xab3c('0x0'));var moment=require('moment');var BPromise=require(_0xab3c('0x1'));var rs=require(_0xab3c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab3c('0x3'))['db'];var utils=require(_0xab3c('0x4'));var logger=require(_0xab3c('0x5'))(_0xab3c('0x6'));var config=require(_0xab3c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xab3c('0x8')][_0xab3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e6456,_0x2f9d1f,_0x57e254){return new BPromise(function(_0x2ba1a4,_0x43f051){return client['request'](_0x1e6456,_0x57e254)[_0xab3c('0xa')](function(_0x40900b){logger[_0xab3c('0xb')](_0xab3c('0xc'),_0x2f9d1f,'request\x20sent');logger[_0xab3c('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2f9d1f,'request\x20sent',JSON[_0xab3c('0xe')](_0x40900b));if(_0x40900b['error']){if(_0x40900b[_0xab3c('0xf')][_0xab3c('0x10')]===0x1f4){logger[_0xab3c('0xf')](_0xab3c('0xc'),_0x2f9d1f,_0x40900b['error']['message']);return _0x43f051(_0x40900b['error'][_0xab3c('0x11')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f9d1f,_0x40900b[_0xab3c('0xf')][_0xab3c('0x11')]);return _0x2ba1a4(_0x40900b[_0xab3c('0xf')][_0xab3c('0x11')]);}else{logger['info'](_0xab3c('0xc'),_0x2f9d1f,_0xab3c('0x12'));_0x2ba1a4(_0x40900b['result']['message']);}})[_0xab3c('0x13')](function(_0x1867d8){logger[_0xab3c('0xf')](_0xab3c('0xc'),_0x2f9d1f,_0x1867d8);_0x43f051(_0x1867d8);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index aeeae1b..f2f04ac 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 _0x97eb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','exports','multer','util','path','express','Router'];(function(_0x52d4ab,_0x5d7cdf){var _0x170deb=function(_0x38aaf5){while(--_0x38aaf5){_0x52d4ab['push'](_0x52d4ab['shift']());}};_0x170deb(++_0x5d7cdf);}(_0x97eb,0x1f3));var _0xb97e=function(_0x94f78d,_0x2a0822){_0x94f78d=_0x94f78d-0x0;var _0x4f0d4b=_0x97eb[_0x94f78d];return _0x4f0d4b;};'use strict';var multer=require(_0xb97e('0x0'));var util=require(_0xb97e('0x1'));var path=require(_0xb97e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb97e('0x3'));var router=express[_0xb97e('0x4')]();var fs_extra=require(_0xb97e('0x5'));var auth=require(_0xb97e('0x6'));var interaction=require(_0xb97e('0x7'));var config=require(_0xb97e('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0xb97e('0x9')]('/',auth[_0xb97e('0xa')](),controller[_0xb97e('0xb')]);router[_0xb97e('0x9')](_0xb97e('0xc'),auth['isAuthenticated'](),controller[_0xb97e('0xd')]);router[_0xb97e('0x9')](_0xb97e('0xe'),auth[_0xb97e('0xa')](),controller[_0xb97e('0xf')]);router[_0xb97e('0x10')]('/',auth[_0xb97e('0xa')](),controller[_0xb97e('0x11')]);router['put'](_0xb97e('0xc'),auth['isAuthenticated'](),controller[_0xb97e('0x12')]);router[_0xb97e('0x13')](_0xb97e('0xc'),auth[_0xb97e('0xa')](),controller['destroy']);module[_0xb97e('0x14')]=router; \ No newline at end of file +var _0xd987=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','delete','destroy','exports','multer'];(function(_0x2629b3,_0x27c8fd){var _0x5ea958=function(_0x6b0989){while(--_0x6b0989){_0x2629b3['push'](_0x2629b3['shift']());}};_0x5ea958(++_0x27c8fd);}(_0xd987,0x15f));var _0x7d98=function(_0xb0429a,_0x3aa043){_0xb0429a=_0xb0429a-0x0;var _0x431576=_0xd987[_0xb0429a];return _0x431576;};'use strict';var multer=require(_0x7d98('0x0'));var util=require(_0x7d98('0x1'));var path=require(_0x7d98('0x2'));var timeout=require(_0x7d98('0x3'));var express=require(_0x7d98('0x4'));var router=express[_0x7d98('0x5')]();var fs_extra=require(_0x7d98('0x6'));var auth=require(_0x7d98('0x7'));var interaction=require(_0x7d98('0x8'));var config=require('../../config/environment');var controller=require(_0x7d98('0x9'));router[_0x7d98('0xa')]('/',auth[_0x7d98('0xb')](),controller[_0x7d98('0xc')]);router['get'](_0x7d98('0xd'),auth[_0x7d98('0xb')](),controller[_0x7d98('0xe')]);router[_0x7d98('0xa')](_0x7d98('0xf'),auth[_0x7d98('0xb')](),controller['download']);router[_0x7d98('0x10')]('/',auth['isAuthenticated'](),controller[_0x7d98('0x11')]);router[_0x7d98('0x12')](_0x7d98('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x7d98('0x13')](_0x7d98('0xd'),auth[_0x7d98('0xb')](),controller[_0x7d98('0x14')]);module[_0x7d98('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 6a75a6e..b4834fe 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 _0x79c5=['exports','TEXT','STRING','BOOLEAN'];(function(_0x223e3d,_0x584f24){var _0x414d57=function(_0x1604a5){while(--_0x1604a5){_0x223e3d['push'](_0x223e3d['shift']());}};_0x414d57(++_0x584f24);}(_0x79c5,0xdc));var _0x579c=function(_0xf2e13d,_0x424179){_0xf2e13d=_0xf2e13d-0x0;var _0x26e9a1=_0x79c5[_0xf2e13d];return _0x26e9a1;};'use strict';var Sequelize=require('sequelize');module[_0x579c('0x0')]={'field':{'type':Sequelize[_0x579c('0x1')]},'alias':{'type':Sequelize[_0x579c('0x2')]},'function':{'type':Sequelize[_0x579c('0x2')]},'format':{'type':Sequelize[_0x579c('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x579c('0x2')]},'custom':{'type':Sequelize[_0x579c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x410f=['BOOLEAN','exports','TEXT','STRING'];(function(_0xdc88a5,_0xd6201d){var _0x1ee88f=function(_0x4b042a){while(--_0x4b042a){_0xdc88a5['push'](_0xdc88a5['shift']());}};_0x1ee88f(++_0xd6201d);}(_0x410f,0x191));var _0xf410=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x410f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf410('0x0')]={'field':{'type':Sequelize[_0xf410('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf410('0x2')]},'groupBy':{'type':Sequelize[_0xf410('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf410('0x2')]},'custom':{'type':Sequelize[_0xf410('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index cba53d7..39c47cb 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 _0xb90d=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','update','destroy','then','end','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis'];(function(_0x4220d3,_0x4341e0){var _0x3dba53=function(_0xb9c7e3){while(--_0xb9c7e3){_0x4220d3['push'](_0x4220d3['shift']());}};_0x3dba53(++_0x4341e0);}(_0xb90d,0x17a));var _0xdb90=function(_0x52a505,_0x5dec98){_0x52a505=_0x52a505-0x0;var _0x1fc95e=_0xb90d[_0x52a505];return _0x1fc95e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb90('0x0'));var zipdir=require(_0xdb90('0x1'));var jsonpatch=require(_0xdb90('0x2'));var rp=require(_0xdb90('0x3'));var moment=require(_0xdb90('0x4'));var BPromise=require(_0xdb90('0x5'));var Mustache=require('mustache');var util=require(_0xdb90('0x6'));var path=require(_0xdb90('0x7'));var sox=require(_0xdb90('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb90('0x9'));var _=require(_0xdb90('0xa'));var squel=require(_0xdb90('0xb'));var crypto=require(_0xdb90('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdb90('0xd'));var toCsv=require(_0xdb90('0xe'));var querystring=require(_0xdb90('0xf'));var Papa=require('papaparse');var Redis=require(_0xdb90('0x10'));var authService=require(_0xdb90('0x11'));var qs=require(_0xdb90('0x12'));var as=require(_0xdb90('0x13'));var hardwareService=require(_0xdb90('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdb90('0x15'));var licenseUtil=require(_0xdb90('0x16'));var db=require(_0xdb90('0x17'))['db'];function respondWithStatusCode(_0xb5ea64,_0xdc179e){_0xdc179e=_0xdc179e||0xcc;return function(_0x113659){if(_0x113659){return _0xb5ea64['sendStatus'](_0xdc179e);}return _0xb5ea64['status'](_0xdc179e)['end']();};}function respondWithResult(_0x511592,_0x569d40){_0x569d40=_0x569d40||0xc8;return function(_0x5eb6ef){if(_0x5eb6ef){return _0x511592[_0xdb90('0x18')](_0x569d40)[_0xdb90('0x19')](_0x5eb6ef);}};}function respondWithFilteredResult(_0x5b93b1,_0x19b02e){return function(_0x1cde0d){if(_0x1cde0d){var _0x4db002=typeof _0x19b02e['offset']===_0xdb90('0x1a')&&typeof _0x19b02e[_0xdb90('0x1b')]===_0xdb90('0x1a');var _0x5101e9=_0x1cde0d[_0xdb90('0x1c')];var _0x13f6df=_0x4db002?0x0:_0x19b02e[_0xdb90('0x1d')];var _0x44d4d4=_0x4db002?_0x1cde0d[_0xdb90('0x1c')]:_0x19b02e[_0xdb90('0x1d')]+_0x19b02e[_0xdb90('0x1b')];var _0x1838ed;if(_0x44d4d4>=_0x5101e9){_0x44d4d4=_0x5101e9;_0x1838ed=0xc8;}else{_0x1838ed=0xce;}_0x5b93b1[_0xdb90('0x18')](_0x1838ed);return _0x5b93b1[_0xdb90('0x1e')]('Content-Range',_0x13f6df+'-'+_0x44d4d4+'/'+_0x5101e9)['json'](_0x1cde0d);}return null;};}function patchUpdates(_0x4110c7){return function(_0x1c2dbe){try{jsonpatch[_0xdb90('0x1f')](_0x1c2dbe,_0x4110c7,!![]);}catch(_0x13f84d){return BPromise[_0xdb90('0x20')](_0x13f84d);}return _0x1c2dbe['save']();};}function saveUpdates(_0x31f9df,_0x922395){return function(_0x590e6a){if(_0x590e6a){return _0x590e6a[_0xdb90('0x21')](_0x31f9df)['then'](function(_0x185b08){return _0x185b08;});}return null;};}function removeEntity(_0x2fdb1b,_0x1fe5ab){return function(_0x463199){if(_0x463199){return _0x463199[_0xdb90('0x22')]()[_0xdb90('0x23')](function(){_0x2fdb1b[_0xdb90('0x18')](0xcc)[_0xdb90('0x24')]();});}};}function handleEntityNotFound(_0x1ef44a,_0x1fed39){return function(_0x64268c){if(!_0x64268c){_0x1ef44a['sendStatus'](0x194);}return _0x64268c;};}function handleError(_0x1a27c3,_0xedb1a6){_0xedb1a6=_0xedb1a6||0x1f4;return function(_0x3fcafd){logger['error'](_0x3fcafd['stack']);if(_0x3fcafd[_0xdb90('0x25')]){delete _0x3fcafd[_0xdb90('0x25')];}_0x1a27c3[_0xdb90('0x18')](_0xedb1a6)[_0xdb90('0x26')](_0x3fcafd);};}exports[_0xdb90('0x27')]=function(_0x321efc,_0x46f743){var _0x67aebc={},_0x554d8f={},_0x3c8671={'count':0x0,'rows':[]};var _0x204f8a=_[_0xdb90('0x28')](db[_0xdb90('0x29')][_0xdb90('0x2a')],function(_0x66ecd3){return{'name':_0x66ecd3[_0xdb90('0x2b')],'type':_0x66ecd3[_0xdb90('0x2c')][_0xdb90('0x2d')]};});_0x554d8f[_0xdb90('0x2e')]=_[_0xdb90('0x28')](_0x204f8a,_0xdb90('0x25'));_0x554d8f[_0xdb90('0x2f')]=_[_0xdb90('0x30')](_0x321efc['query']);_0x554d8f[_0xdb90('0x31')]=_[_0xdb90('0x32')](_0x554d8f[_0xdb90('0x2e')],_0x554d8f[_0xdb90('0x2f')]);_0x67aebc[_0xdb90('0x33')]=_[_0xdb90('0x32')](_0x554d8f[_0xdb90('0x2e')],qs[_0xdb90('0x34')](_0x321efc[_0xdb90('0x2f')][_0xdb90('0x34')]));_0x67aebc['attributes']=_0x67aebc[_0xdb90('0x33')][_0xdb90('0x35')]?_0x67aebc['attributes']:_0x554d8f[_0xdb90('0x2e')];if(!_0x321efc[_0xdb90('0x2f')][_0xdb90('0x36')](_0xdb90('0x37'))){_0x67aebc[_0xdb90('0x1b')]=qs['limit'](_0x321efc[_0xdb90('0x2f')][_0xdb90('0x1b')]);_0x67aebc[_0xdb90('0x1d')]=qs['offset'](_0x321efc[_0xdb90('0x2f')][_0xdb90('0x1d')]);}_0x67aebc['order']=qs[_0xdb90('0x38')](_0x321efc[_0xdb90('0x2f')][_0xdb90('0x38')]);_0x67aebc[_0xdb90('0x39')]=qs['filters'](_[_0xdb90('0x3a')](_0x321efc[_0xdb90('0x2f')],_0x554d8f['filters']),_0x204f8a);if(_0x321efc['query'][_0xdb90('0x3b')]){_0x67aebc[_0xdb90('0x39')]=_[_0xdb90('0x3c')](_0x67aebc[_0xdb90('0x39')],{'$or':_['map'](_0x204f8a,function(_0x13ae1b){if(_0x13ae1b['type']!=='VIRTUAL'){var _0x5676db={};_0x5676db[_0x13ae1b[_0xdb90('0x25')]]={'$like':'%'+_0x321efc[_0xdb90('0x2f')][_0xdb90('0x3b')]+'%'};return _0x5676db;}})});}_0x67aebc=_[_0xdb90('0x3c')]({},_0x67aebc,_0x321efc[_0xdb90('0x3d')]);var _0x57ba6b={'where':_0x67aebc[_0xdb90('0x39')]};return db['AnalyticFieldReport'][_0xdb90('0x1c')](_0x57ba6b)[_0xdb90('0x23')](function(_0x5afca9){_0x3c8671['count']=_0x5afca9;if(_0x321efc[_0xdb90('0x2f')]['includeAll']){_0x67aebc[_0xdb90('0x3e')]=[{'all':!![]}];}return db[_0xdb90('0x29')][_0xdb90('0x3f')](_0x67aebc);})['then'](function(_0x300d70){_0x3c8671[_0xdb90('0x40')]=_0x300d70;return _0x3c8671;})['then'](respondWithFilteredResult(_0x46f743,_0x67aebc))[_0xdb90('0x41')](handleError(_0x46f743,null));};exports[_0xdb90('0x42')]=function(_0x2eec66,_0x68e9e5){var _0x1e2e7f={'raw':![],'where':{'id':_0x2eec66[_0xdb90('0x43')]['id']}},_0x284342={};_0x284342[_0xdb90('0x2e')]=_['keys'](db[_0xdb90('0x29')]['rawAttributes']);_0x284342['query']=_['keys'](_0x2eec66[_0xdb90('0x2f')]);_0x284342['filters']=_['intersection'](_0x284342[_0xdb90('0x2e')],_0x284342[_0xdb90('0x2f')]);_0x1e2e7f[_0xdb90('0x33')]=_[_0xdb90('0x32')](_0x284342['model'],qs[_0xdb90('0x34')](_0x2eec66[_0xdb90('0x2f')][_0xdb90('0x34')]));_0x1e2e7f[_0xdb90('0x33')]=_0x1e2e7f[_0xdb90('0x33')][_0xdb90('0x35')]?_0x1e2e7f[_0xdb90('0x33')]:_0x284342[_0xdb90('0x2e')];if(_0x2eec66[_0xdb90('0x2f')][_0xdb90('0x44')]){_0x1e2e7f[_0xdb90('0x3e')]=[{'all':!![]}];}_0x1e2e7f=_[_0xdb90('0x3c')]({},_0x1e2e7f,_0x2eec66[_0xdb90('0x3d')]);return db['AnalyticFieldReport']['find'](_0x1e2e7f)['then'](handleEntityNotFound(_0x68e9e5,null))['then'](respondWithResult(_0x68e9e5,null))[_0xdb90('0x41')](handleError(_0x68e9e5,null));};exports['create']=function(_0x56fef9,_0x4ba023){return db[_0xdb90('0x29')]['create'](_0x56fef9[_0xdb90('0x45')],{})[_0xdb90('0x23')](respondWithResult(_0x4ba023,0xc9))[_0xdb90('0x41')](handleError(_0x4ba023,null));};exports[_0xdb90('0x46')]=function(_0x16888b,_0x21c540){return db[_0xdb90('0x29')][_0xdb90('0x46')](_0x16888b['body'],{'raw':![],'individualHooks':!![]})[_0xdb90('0x23')](respondWithResult(_0x21c540,0xc9))[_0xdb90('0x41')](handleError(_0x21c540,null));};exports['update']=function(_0x58ca62,_0x133d8b){if(_0x58ca62[_0xdb90('0x45')]['id']){delete _0x58ca62[_0xdb90('0x45')]['id'];}return db['AnalyticFieldReport'][_0xdb90('0x47')]({'where':{'id':_0x58ca62[_0xdb90('0x43')]['id']}})[_0xdb90('0x23')](handleEntityNotFound(_0x133d8b,null))[_0xdb90('0x23')](saveUpdates(_0x58ca62[_0xdb90('0x45')],null))[_0xdb90('0x23')](respondWithResult(_0x133d8b,null))[_0xdb90('0x41')](handleError(_0x133d8b,null));};exports[_0xdb90('0x22')]=function(_0x3ed260,_0x507d6e){return db[_0xdb90('0x29')][_0xdb90('0x47')]({'where':{'id':_0x3ed260['params']['id']}})['then'](handleEntityNotFound(_0x507d6e,null))['then'](removeEntity(_0x507d6e,null))[_0xdb90('0x41')](handleError(_0x507d6e,null));};exports[_0xdb90('0x48')]=function(_0x54237b,_0x57b8f4){return db[_0xdb90('0x29')][_0xdb90('0x22')]({'where':{'id':_0x54237b[_0xdb90('0x2f')][_0xdb90('0x49')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x57b8f4,0xcc))[_0xdb90('0x41')](handleError(_0x57b8f4,null));};exports[_0xdb90('0x4a')]=function(_0x507138,_0x5e7dd1,_0x37210d){return db[_0xdb90('0x4b')][_0xdb90('0x4c')]({'where':{'id':_0x507138[_0xdb90('0x43')]['id']}})[_0xdb90('0x23')](handleEntityNotFound(_0x5e7dd1,null))[_0xdb90('0x23')](function(_0x510edd){if(_0x510edd){return db['sequelize'][_0xdb90('0x4d')](function(_0x2f51d4){return db['AnalyticFieldReport'][_0xdb90('0x22')]({'where':{'CustomReportId':_0x507138[_0xdb90('0x43')]['id']},'transaction':_0x2f51d4})[_0xdb90('0x23')](function(_0x255166){var _0x5acf12=_[_0xdb90('0x28')](_0x507138['body'],function(_0x323dbb){delete _0x323dbb['id'];_0x323dbb[_0xdb90('0x4e')]=_0x507138[_0xdb90('0x43')]['id'];return _0x323dbb;});return db[_0xdb90('0x29')][_0xdb90('0x46')](_0x5acf12,{'transaction':_0x2f51d4});});})['then'](function(){return db['AnalyticFieldReport'][_0xdb90('0x3f')]({'where':{'CustomReportId':_0x507138[_0xdb90('0x43')]['id']}});});}})[_0xdb90('0x23')](respondWithResult(_0x5e7dd1,null))[_0xdb90('0x41')](handleError(_0x5e7dd1,null));}; \ No newline at end of file +var _0x733c=['fields','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','rawAttributes','model','map','query','keys','filters','intersection','attributes'];(function(_0x5d381c,_0x445675){var _0x5d0199=function(_0x3344e3){while(--_0x3344e3){_0x5d381c['push'](_0x5d381c['shift']());}};_0x5d0199(++_0x445675);}(_0x733c,0x6d));var _0xc733=function(_0xe2904,_0x1caf92){_0xe2904=_0xe2904-0x0;var _0x425487=_0x733c[_0xe2904];return _0x425487;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc733('0x0'));var jsonpatch=require(_0xc733('0x1'));var rp=require(_0xc733('0x2'));var moment=require(_0xc733('0x3'));var BPromise=require(_0xc733('0x4'));var Mustache=require(_0xc733('0x5'));var util=require('util');var path=require(_0xc733('0x6'));var sox=require(_0xc733('0x7'));var csv=require(_0xc733('0x8'));var ejs=require(_0xc733('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc733('0xa'));var crypto=require('crypto');var jsforce=require(_0xc733('0xb'));var deskjs=require(_0xc733('0xc'));var toCsv=require(_0xc733('0x8'));var querystring=require(_0xc733('0xd'));var Papa=require(_0xc733('0xe'));var Redis=require(_0xc733('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc733('0x10'));var as=require(_0xc733('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc733('0x12'))(_0xc733('0x13'));var utils=require(_0xc733('0x14'));var config=require(_0xc733('0x15'));var licenseUtil=require(_0xc733('0x16'));var db=require(_0xc733('0x17'))['db'];function respondWithStatusCode(_0x229347,_0xefb6c9){_0xefb6c9=_0xefb6c9||0xcc;return function(_0x3c7e50){if(_0x3c7e50){return _0x229347[_0xc733('0x18')](_0xefb6c9);}return _0x229347[_0xc733('0x19')](_0xefb6c9)['end']();};}function respondWithResult(_0x4f80b1,_0x263fb8){_0x263fb8=_0x263fb8||0xc8;return function(_0x5aa741){if(_0x5aa741){return _0x4f80b1['status'](_0x263fb8)[_0xc733('0x1a')](_0x5aa741);}};}function respondWithFilteredResult(_0x2f4fbe,_0x2a65ba){return function(_0x21413b){if(_0x21413b){var _0x19818c=typeof _0x2a65ba[_0xc733('0x1b')]===_0xc733('0x1c')&&typeof _0x2a65ba[_0xc733('0x1d')]===_0xc733('0x1c');var _0x3db480=_0x21413b[_0xc733('0x1e')];var _0x549369=_0x19818c?0x0:_0x2a65ba[_0xc733('0x1b')];var _0x2d87f4=_0x19818c?_0x21413b[_0xc733('0x1e')]:_0x2a65ba[_0xc733('0x1b')]+_0x2a65ba['limit'];var _0x261824;if(_0x2d87f4>=_0x3db480){_0x2d87f4=_0x3db480;_0x261824=0xc8;}else{_0x261824=0xce;}_0x2f4fbe[_0xc733('0x19')](_0x261824);return _0x2f4fbe[_0xc733('0x1f')](_0xc733('0x20'),_0x549369+'-'+_0x2d87f4+'/'+_0x3db480)[_0xc733('0x1a')](_0x21413b);}return null;};}function patchUpdates(_0x10a6fc){return function(_0x54f801){try{jsonpatch[_0xc733('0x21')](_0x54f801,_0x10a6fc,!![]);}catch(_0x27e3b2){return BPromise['reject'](_0x27e3b2);}return _0x54f801[_0xc733('0x22')]();};}function saveUpdates(_0xdfdbc,_0x314baa){return function(_0x367921){if(_0x367921){return _0x367921[_0xc733('0x23')](_0xdfdbc)[_0xc733('0x24')](function(_0x4f21e1){return _0x4f21e1;});}return null;};}function removeEntity(_0x1be3e4,_0x5a7448){return function(_0x4be189){if(_0x4be189){return _0x4be189[_0xc733('0x25')]()[_0xc733('0x24')](function(){_0x1be3e4[_0xc733('0x19')](0xcc)[_0xc733('0x26')]();});}};}function handleEntityNotFound(_0x38aaee,_0x4787c6){return function(_0x3b1047){if(!_0x3b1047){_0x38aaee['sendStatus'](0x194);}return _0x3b1047;};}function handleError(_0x2a68e6,_0x2c5fa3){_0x2c5fa3=_0x2c5fa3||0x1f4;return function(_0x174ed7){logger[_0xc733('0x27')](_0x174ed7[_0xc733('0x28')]);if(_0x174ed7['name']){delete _0x174ed7[_0xc733('0x29')];}_0x2a68e6[_0xc733('0x19')](_0x2c5fa3)[_0xc733('0x2a')](_0x174ed7);};}exports['index']=function(_0xe7284d,_0x157669){var _0x3d3aa9={},_0x2f706b={},_0x3c7851={'count':0x0,'rows':[]};var _0x33845e=_['map'](db['AnalyticFieldReport'][_0xc733('0x2b')],function(_0x29dea0){return{'name':_0x29dea0['fieldName'],'type':_0x29dea0['type']['key']};});_0x2f706b[_0xc733('0x2c')]=_[_0xc733('0x2d')](_0x33845e,_0xc733('0x29'));_0x2f706b[_0xc733('0x2e')]=_[_0xc733('0x2f')](_0xe7284d[_0xc733('0x2e')]);_0x2f706b[_0xc733('0x30')]=_[_0xc733('0x31')](_0x2f706b['model'],_0x2f706b[_0xc733('0x2e')]);_0x3d3aa9[_0xc733('0x32')]=_[_0xc733('0x31')](_0x2f706b['model'],qs[_0xc733('0x33')](_0xe7284d[_0xc733('0x2e')]['fields']));_0x3d3aa9[_0xc733('0x32')]=_0x3d3aa9[_0xc733('0x32')]['length']?_0x3d3aa9[_0xc733('0x32')]:_0x2f706b[_0xc733('0x2c')];if(!_0xe7284d[_0xc733('0x2e')]['hasOwnProperty'](_0xc733('0x34'))){_0x3d3aa9['limit']=qs['limit'](_0xe7284d[_0xc733('0x2e')][_0xc733('0x1d')]);_0x3d3aa9[_0xc733('0x1b')]=qs[_0xc733('0x1b')](_0xe7284d['query']['offset']);}_0x3d3aa9['order']=qs[_0xc733('0x35')](_0xe7284d['query'][_0xc733('0x35')]);_0x3d3aa9['where']=qs[_0xc733('0x30')](_[_0xc733('0x36')](_0xe7284d[_0xc733('0x2e')],_0x2f706b[_0xc733('0x30')]),_0x33845e);if(_0xe7284d[_0xc733('0x2e')][_0xc733('0x37')]){_0x3d3aa9[_0xc733('0x38')]=_[_0xc733('0x39')](_0x3d3aa9[_0xc733('0x38')],{'$or':_[_0xc733('0x2d')](_0x33845e,function(_0x15635c){if(_0x15635c[_0xc733('0x3a')]!==_0xc733('0x3b')){var _0x2bf9f4={};_0x2bf9f4[_0x15635c[_0xc733('0x29')]]={'$like':'%'+_0xe7284d[_0xc733('0x2e')][_0xc733('0x37')]+'%'};return _0x2bf9f4;}})});}_0x3d3aa9=_[_0xc733('0x39')]({},_0x3d3aa9,_0xe7284d[_0xc733('0x3c')]);var _0x1ef9f2={'where':_0x3d3aa9['where']};return db[_0xc733('0x3d')]['count'](_0x1ef9f2)[_0xc733('0x24')](function(_0x49d62b){_0x3c7851[_0xc733('0x1e')]=_0x49d62b;if(_0xe7284d[_0xc733('0x2e')][_0xc733('0x3e')]){_0x3d3aa9[_0xc733('0x3f')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xc733('0x40')](_0x3d3aa9);})['then'](function(_0xd1eec){_0x3c7851[_0xc733('0x41')]=_0xd1eec;return _0x3c7851;})['then'](respondWithFilteredResult(_0x157669,_0x3d3aa9))[_0xc733('0x42')](handleError(_0x157669,null));};exports[_0xc733('0x43')]=function(_0x1b2755,_0x1c683f){var _0x5a9ccb={'raw':![],'where':{'id':_0x1b2755[_0xc733('0x44')]['id']}},_0x52feec={};_0x52feec[_0xc733('0x2c')]=_[_0xc733('0x2f')](db['AnalyticFieldReport'][_0xc733('0x2b')]);_0x52feec['query']=_['keys'](_0x1b2755[_0xc733('0x2e')]);_0x52feec[_0xc733('0x30')]=_[_0xc733('0x31')](_0x52feec['model'],_0x52feec[_0xc733('0x2e')]);_0x5a9ccb[_0xc733('0x32')]=_['intersection'](_0x52feec[_0xc733('0x2c')],qs[_0xc733('0x33')](_0x1b2755[_0xc733('0x2e')]['fields']));_0x5a9ccb[_0xc733('0x32')]=_0x5a9ccb['attributes']['length']?_0x5a9ccb[_0xc733('0x32')]:_0x52feec[_0xc733('0x2c')];if(_0x1b2755[_0xc733('0x2e')][_0xc733('0x3e')]){_0x5a9ccb[_0xc733('0x3f')]=[{'all':!![]}];}_0x5a9ccb=_[_0xc733('0x39')]({},_0x5a9ccb,_0x1b2755[_0xc733('0x3c')]);return db[_0xc733('0x3d')][_0xc733('0x45')](_0x5a9ccb)[_0xc733('0x24')](handleEntityNotFound(_0x1c683f,null))[_0xc733('0x24')](respondWithResult(_0x1c683f,null))[_0xc733('0x42')](handleError(_0x1c683f,null));};exports[_0xc733('0x46')]=function(_0x252bfc,_0x5c8b31){return db[_0xc733('0x3d')]['create'](_0x252bfc[_0xc733('0x47')],{})[_0xc733('0x24')](respondWithResult(_0x5c8b31,0xc9))['catch'](handleError(_0x5c8b31,null));};exports[_0xc733('0x48')]=function(_0x595fff,_0x503ede){return db[_0xc733('0x3d')]['bulkCreate'](_0x595fff[_0xc733('0x47')],{'raw':![],'individualHooks':!![]})[_0xc733('0x24')](respondWithResult(_0x503ede,0xc9))[_0xc733('0x42')](handleError(_0x503ede,null));};exports[_0xc733('0x23')]=function(_0x110528,_0x1e71b1){if(_0x110528[_0xc733('0x47')]['id']){delete _0x110528[_0xc733('0x47')]['id'];}return db[_0xc733('0x3d')][_0xc733('0x45')]({'where':{'id':_0x110528['params']['id']}})['then'](handleEntityNotFound(_0x1e71b1,null))[_0xc733('0x24')](saveUpdates(_0x110528[_0xc733('0x47')],null))[_0xc733('0x24')](respondWithResult(_0x1e71b1,null))['catch'](handleError(_0x1e71b1,null));};exports['destroy']=function(_0x54dec1,_0x372bc0){return db[_0xc733('0x3d')][_0xc733('0x45')]({'where':{'id':_0x54dec1[_0xc733('0x44')]['id']}})[_0xc733('0x24')](handleEntityNotFound(_0x372bc0,null))['then'](removeEntity(_0x372bc0,null))[_0xc733('0x42')](handleError(_0x372bc0,null));};exports['bulkDestroy']=function(_0x304228,_0xc9c137){return db['AnalyticFieldReport'][_0xc733('0x25')]({'where':{'id':_0x304228[_0xc733('0x2e')][_0xc733('0x49')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xc9c137,0xcc))[_0xc733('0x42')](handleError(_0xc9c137,null));};exports[_0xc733('0x4a')]=function(_0x25f04b,_0x980349,_0x26c4f1){return db[_0xc733('0x4b')][_0xc733('0x4c')]({'where':{'id':_0x25f04b[_0xc733('0x44')]['id']}})[_0xc733('0x24')](handleEntityNotFound(_0x980349,null))[_0xc733('0x24')](function(_0x2af7c5){if(_0x2af7c5){return db[_0xc733('0x4d')][_0xc733('0x4e')](function(_0x565572){return db[_0xc733('0x3d')][_0xc733('0x25')]({'where':{'CustomReportId':_0x25f04b[_0xc733('0x44')]['id']},'transaction':_0x565572})[_0xc733('0x24')](function(_0x1ce495){var _0x2e7f7b=_[_0xc733('0x2d')](_0x25f04b[_0xc733('0x47')],function(_0x50cd2a){delete _0x50cd2a['id'];_0x50cd2a[_0xc733('0x4f')]=_0x25f04b['params']['id'];return _0x50cd2a;});return db[_0xc733('0x3d')][_0xc733('0x48')](_0x2e7f7b,{'transaction':_0x565572});});})[_0xc733('0x24')](function(){return db[_0xc733('0x3d')][_0xc733('0x40')]({'where':{'CustomReportId':_0x25f04b[_0xc733('0x44')]['id']}});});}})['then'](respondWithResult(_0x980349,null))[_0xc733('0x42')](handleError(_0x980349,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index afddcd6..7ee557d 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 _0x7a89=['./analyticFieldReport.attributes','exports','AnalyticFieldReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x375da7,_0x18765c){var _0x324c46=function(_0x56f5f0){while(--_0x56f5f0){_0x375da7['push'](_0x375da7['shift']());}};_0x324c46(++_0x18765c);}(_0x7a89,0x13b));var _0x97a8=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x7a89[_0x1ee351];return _0x245aaf;};'use strict';var _=require(_0x97a8('0x0'));var util=require(_0x97a8('0x1'));var logger=require('../../config/logger')(_0x97a8('0x2'));var moment=require(_0x97a8('0x3'));var BPromise=require(_0x97a8('0x4'));var rp=require(_0x97a8('0x5'));var fs=require('fs');var path=require(_0x97a8('0x6'));var rimraf=require(_0x97a8('0x7'));var config=require(_0x97a8('0x8'));var attributes=require(_0x97a8('0x9'));module[_0x97a8('0xa')]=function(_0xd64f3c,_0x5685f8){return _0xd64f3c['define'](_0x97a8('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfe1=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x36ea93,_0x5abc0d){var _0x5b5b08=function(_0x3cc394){while(--_0x3cc394){_0x36ea93['push'](_0x36ea93['shift']());}};_0x5b5b08(++_0x5abc0d);}(_0xbfe1,0x186));var _0x1bfe=function(_0x557815,_0x22420d){_0x557815=_0x557815-0x0;var _0x48e0b0=_0xbfe1[_0x557815];return _0x48e0b0;};'use strict';var _=require(_0x1bfe('0x0'));var util=require(_0x1bfe('0x1'));var logger=require(_0x1bfe('0x2'))('api');var moment=require(_0x1bfe('0x3'));var BPromise=require(_0x1bfe('0x4'));var rp=require(_0x1bfe('0x5'));var fs=require('fs');var path=require(_0x1bfe('0x6'));var rimraf=require(_0x1bfe('0x7'));var config=require(_0x1bfe('0x8'));var attributes=require(_0x1bfe('0x9'));module[_0x1bfe('0xa')]=function(_0x12e699,_0x5f31d2){return _0x12e699['define']('AnalyticFieldReport',attributes,{'tableName':_0x1bfe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 3e86861..b25d0f3 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 _0x3611=['http','then','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x3611,0xbc));var _0x1361=function(_0x3409ec,_0x1bb946){_0x3409ec=_0x3409ec-0x0;var _0x11a522=_0x3611[_0x3409ec];return _0x11a522;};'use strict';var _=require(_0x1361('0x0'));var util=require('util');var moment=require(_0x1361('0x1'));var BPromise=require(_0x1361('0x2'));var rs=require(_0x1361('0x3'));var fs=require('fs');var Redis=require(_0x1361('0x4'));var db=require(_0x1361('0x5'))['db'];var utils=require(_0x1361('0x6'));var logger=require(_0x1361('0x7'))(_0x1361('0x8'));var config=require(_0x1361('0x9'));var jayson=require(_0x1361('0xa'));var client=jayson[_0x1361('0xb')][_0x1361('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6198b4,_0x560214,_0x2b2e22){return new BPromise(function(_0x36a5da,_0x58d67b){return client['request'](_0x6198b4,_0x2b2e22)[_0x1361('0xd')](function(_0x1e854f){logger['info'](_0x1361('0xe'),_0x560214,'request\x20sent');logger[_0x1361('0xf')](_0x1361('0x10'),_0x560214,_0x1361('0x11'),JSON[_0x1361('0x12')](_0x1e854f));if(_0x1e854f[_0x1361('0x13')]){if(_0x1e854f[_0x1361('0x13')][_0x1361('0x14')]===0x1f4){logger[_0x1361('0x13')](_0x1361('0xe'),_0x560214,_0x1e854f['error']['message']);return _0x58d67b(_0x1e854f['error'][_0x1361('0x15')]);}logger[_0x1361('0x13')](_0x1361('0xe'),_0x560214,_0x1e854f['error'][_0x1361('0x15')]);return _0x36a5da(_0x1e854f[_0x1361('0x13')][_0x1361('0x15')]);}else{logger[_0x1361('0x16')](_0x1361('0xe'),_0x560214,_0x1361('0x11'));_0x36a5da(_0x1e854f[_0x1361('0x17')]['message']);}})[_0x1361('0x18')](function(_0x1c93be){logger['error'](_0x1361('0xe'),_0x560214,_0x1c93be);_0x58d67b(_0x1c93be);});});} \ No newline at end of file +var _0x83e8=['message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4983ec,_0x40e839){var _0x438314=function(_0x467e14){while(--_0x467e14){_0x4983ec['push'](_0x4983ec['shift']());}};_0x438314(++_0x40e839);}(_0x83e8,0x1d0));var _0x883e=function(_0x5dd3ab,_0x483373){_0x5dd3ab=_0x5dd3ab-0x0;var _0x385c03=_0x83e8[_0x5dd3ab];return _0x385c03;};'use strict';var _=require(_0x883e('0x0'));var util=require('util');var moment=require(_0x883e('0x1'));var BPromise=require(_0x883e('0x2'));var rs=require(_0x883e('0x3'));var fs=require('fs');var Redis=require(_0x883e('0x4'));var db=require(_0x883e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x883e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x883e('0x7')][_0x883e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ddc2f,_0x4ca18c,_0x313fc7){return new BPromise(function(_0x57b86a,_0x546c53){return client[_0x883e('0x9')](_0x5ddc2f,_0x313fc7)['then'](function(_0x25d8c5){logger[_0x883e('0xa')](_0x883e('0xb'),_0x4ca18c,'request\x20sent');logger[_0x883e('0xc')](_0x883e('0xd'),_0x4ca18c,'request\x20sent',JSON['stringify'](_0x25d8c5));if(_0x25d8c5['error']){if(_0x25d8c5[_0x883e('0xe')][_0x883e('0xf')]===0x1f4){logger[_0x883e('0xe')](_0x883e('0xb'),_0x4ca18c,_0x25d8c5[_0x883e('0xe')][_0x883e('0x10')]);return _0x546c53(_0x25d8c5['error'][_0x883e('0x10')]);}logger[_0x883e('0xe')](_0x883e('0xb'),_0x4ca18c,_0x25d8c5[_0x883e('0xe')][_0x883e('0x10')]);return _0x57b86a(_0x25d8c5[_0x883e('0xe')][_0x883e('0x10')]);}else{logger[_0x883e('0xa')](_0x883e('0xb'),_0x4ca18c,_0x883e('0x11'));_0x57b86a(_0x25d8c5[_0x883e('0x12')][_0x883e('0x10')]);}})[_0x883e('0x13')](function(_0x497c87){logger[_0x883e('0xe')](_0x883e('0xb'),_0x4ca18c,_0x497c87);_0x546c53(_0x497c87);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c046005..1d1ff57 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(_0x7f162d,_0x190ff5){var _0x2d58d8=function(_0x5a93cf){while(--_0x5a93cf){_0x7f162d['push'](_0x7f162d['shift']());}};_0x2d58d8(++_0x190ff5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x1c6ee7,_0x2f93fe){var _0x5c3740=function(_0x3d58e3){while(--_0x3d58e3){_0x1c6ee7['push'](_0x1c6ee7['shift']());}};_0x5c3740(++_0x2f93fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 f5bbcb0..0b22e59 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 _0x7980=['TEXT','sequelize','exports','name','STRING'];(function(_0x4d83ef,_0x49c76e){var _0x495f4f=function(_0x970086){while(--_0x970086){_0x4d83ef['push'](_0x4d83ef['shift']());}};_0x495f4f(++_0x49c76e);}(_0x7980,0x123));var _0x0798=function(_0x16e01a,_0x3621ad){_0x16e01a=_0x16e01a-0x0;var _0x287045=_0x7980[_0x16e01a];return _0x287045;};'use strict';var Sequelize=require(_0x0798('0x0'));module[_0x0798('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0798('0x2')},'table':{'type':Sequelize[_0x0798('0x3')]},'metric':{'type':Sequelize[_0x0798('0x4')]},'description':{'type':Sequelize[_0x0798('0x3')]}}; \ No newline at end of file +var _0x45c8=['STRING','name','TEXT','sequelize'];(function(_0x3e5eb1,_0xedb8eb){var _0x521e0e=function(_0x976bad){while(--_0x976bad){_0x3e5eb1['push'](_0x3e5eb1['shift']());}};_0x521e0e(++_0xedb8eb);}(_0x45c8,0xef));var _0x845c=function(_0x3496ec,_0x976664){_0x3496ec=_0x3496ec-0x0;var _0x6b7f48=_0x45c8[_0x3496ec];return _0x6b7f48;};'use strict';var Sequelize=require(_0x845c('0x0'));module['exports']={'name':{'type':Sequelize[_0x845c('0x1')],'allowNull':![],'unique':_0x845c('0x2')},'table':{'type':Sequelize[_0x845c('0x1')]},'metric':{'type':Sequelize[_0x845c('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 557a502..5e9788a 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 _0xd6d6=['includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','AnalyticMetric','rows','show'];(function(_0x2ac083,_0x1c4617){var _0x567a7c=function(_0x37eb78){while(--_0x37eb78){_0x2ac083['push'](_0x2ac083['shift']());}};_0x567a7c(++_0x1c4617);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5472dc,_0x3ba0cf){_0x5472dc=_0x5472dc-0x0;var _0x729862=_0xd6d6[_0x5472dc];return _0x729862;};'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'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){var _0x99f7d6=_0x583b10[_0x6d6d('0x29')]({'plain':!![]});var _0xf0df7f=_0x6d6d('0x2a');return db['UserProfileResource'][_0x6d6d('0x28')]({'where':{'type':_0xf0df7f,'resourceId':_0x99f7d6['id']}})[_0x6d6d('0x27')](function(){return _0x583b10;});})[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0x408f98,_0x3641fc){return function(_0x4a57a1){if(!_0x4a57a1){_0x408f98[_0x6d6d('0x19')](0x194);}return _0x4a57a1;};}function handleError(_0x9595d8,_0x51bd68){_0x51bd68=_0x51bd68||0x1f4;return function(_0x553645){logger[_0x6d6d('0x2b')](_0x553645[_0x6d6d('0x2c')]);if(_0x553645[_0x6d6d('0x2d')]){delete _0x553645['name'];}_0x9595d8[_0x6d6d('0x1a')](_0x51bd68)[_0x6d6d('0x2e')](_0x553645);};}exports[_0x6d6d('0x2f')]=function(_0x1c8340,_0x64d1f7){var _0x428c17={},_0xdda3f2={},_0x359cfd={'count':0x0,'rows':[]};var _0x6c4741=_[_0x6d6d('0x30')](db['AnalyticMetric'][_0x6d6d('0x31')],function(_0x4f1fc5){return{'name':_0x4f1fc5[_0x6d6d('0x32')],'type':_0x4f1fc5[_0x6d6d('0x33')][_0x6d6d('0x34')]};});_0xdda3f2[_0x6d6d('0x35')]=_['map'](_0x6c4741,_0x6d6d('0x2d'));_0xdda3f2['query']=_[_0x6d6d('0x36')](_0x1c8340[_0x6d6d('0x37')]);_0xdda3f2['filters']=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],_0xdda3f2[_0x6d6d('0x37')]);_0x428c17[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x428c17[_0x6d6d('0x39')]=_0x428c17[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x428c17[_0x6d6d('0x39')]:_0xdda3f2[_0x6d6d('0x35')];if(!_0x1c8340['query'][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x428c17[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x1c8340['query']['limit']);_0x428c17[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x1c8340[_0x6d6d('0x37')]['offset']);}_0x428c17[_0x6d6d('0x3e')]=qs[_0x6d6d('0x3f')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3f')]);_0x428c17['where']=qs['filters'](_['pick'](_0x1c8340[_0x6d6d('0x37')],_0xdda3f2[_0x6d6d('0x40')]),_0x6c4741);if(_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]){_0x428c17['where']=_[_0x6d6d('0x42')](_0x428c17[_0x6d6d('0x43')],{'$or':_[_0x6d6d('0x30')](_0x6c4741,function(_0x3c6d23){if(_0x3c6d23[_0x6d6d('0x33')]!==_0x6d6d('0x44')){var _0x4b457d={};_0x4b457d[_0x3c6d23[_0x6d6d('0x2d')]]={'$like':'%'+_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]+'%'};return _0x4b457d;}})});}_0x428c17=_[_0x6d6d('0x42')]({},_0x428c17,_0x1c8340[_0x6d6d('0x45')]);var _0x3e27b7={'where':_0x428c17[_0x6d6d('0x43')]};return db['AnalyticMetric'][_0x6d6d('0x20')](_0x3e27b7)[_0x6d6d('0x27')](function(_0x16e177){_0x359cfd[_0x6d6d('0x20')]=_0x16e177;if(_0x1c8340[_0x6d6d('0x37')]['includeAll']){_0x428c17[_0x6d6d('0x46')]=[{'all':!![]}];}return db[_0x6d6d('0x47')]['findAll'](_0x428c17);})[_0x6d6d('0x27')](function(_0x50dc17){_0x359cfd[_0x6d6d('0x48')]=_0x50dc17;return _0x359cfd;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x64d1f7,_0x428c17))['catch'](handleError(_0x64d1f7,null));};exports[_0x6d6d('0x49')]=function(_0x3324ec,_0x252cbe){var _0x4041f3={'raw':!![],'where':{'id':_0x3324ec['params']['id']}},_0xf7ea0d={};_0xf7ea0d['model']=_[_0x6d6d('0x36')](db['AnalyticMetric']['rawAttributes']);_0xf7ea0d[_0x6d6d('0x37')]=_[_0x6d6d('0x36')](_0x3324ec[_0x6d6d('0x37')]);_0xf7ea0d['filters']=_[_0x6d6d('0x38')](_0xf7ea0d['model'],_0xf7ea0d[_0x6d6d('0x37')]);_0x4041f3[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xf7ea0d[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x4041f3['attributes']=_0x4041f3[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x4041f3[_0x6d6d('0x39')]:_0xf7ea0d[_0x6d6d('0x35')];if(_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x4a')]){_0x4041f3[_0x6d6d('0x46')]=[{'all':!![]}];}_0x4041f3=_[_0x6d6d('0x42')]({},_0x4041f3,_0x3324ec[_0x6d6d('0x45')]);return db['AnalyticMetric']['find'](_0x4041f3)[_0x6d6d('0x27')](handleEntityNotFound(_0x252cbe,null))[_0x6d6d('0x27')](respondWithResult(_0x252cbe,null))[_0x6d6d('0x4b')](handleError(_0x252cbe,null));};exports[_0x6d6d('0x4c')]=function(_0xe2a20e,_0x492834){return db[_0x6d6d('0x47')][_0x6d6d('0x4c')](_0xe2a20e[_0x6d6d('0x4d')],{})[_0x6d6d('0x27')](function(_0x2ee917){var _0x23c2db=_0xe2a20e[_0x6d6d('0x4e')][_0x6d6d('0x29')]({'plain':!![]});if(!_0x23c2db)throw new Error(_0x6d6d('0x4f'));if(_0x23c2db[_0x6d6d('0x50')]===_0x6d6d('0x4e')){var _0x175e26=_0x2ee917['get']({'plain':!![]});var _0x190786=_0x6d6d('0x2a');return db[_0x6d6d('0x51')][_0x6d6d('0x52')]({'where':{'name':_0x190786,'userProfileId':_0x23c2db[_0x6d6d('0x53')]},'raw':!![]})['then'](function(_0x38c307){if(_0x38c307&&_0x38c307[_0x6d6d('0x54')]===0x0){return db[_0x6d6d('0x55')]['create']({'name':_0x175e26['name'],'resourceId':_0x175e26['id'],'type':_0x38c307[_0x6d6d('0x2d')],'sectionId':_0x38c307['id']},{})['then'](function(){return _0x2ee917;});}else{return _0x2ee917;}})[_0x6d6d('0x4b')](function(_0x995fe2){logger[_0x6d6d('0x2b')](_0x6d6d('0x56'),_0x995fe2);throw _0x995fe2;});}return _0x2ee917;})[_0x6d6d('0x27')](respondWithResult(_0x492834,0xc9))[_0x6d6d('0x4b')](handleError(_0x492834,null));};exports[_0x6d6d('0x26')]=function(_0x26c23a,_0x1a8f33){if(_0x26c23a[_0x6d6d('0x4d')]['id']){delete _0x26c23a['body']['id'];}return db[_0x6d6d('0x47')][_0x6d6d('0x52')]({'where':{'id':_0x26c23a[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x1a8f33,null))[_0x6d6d('0x27')](saveUpdates(_0x26c23a[_0x6d6d('0x4d')],null))[_0x6d6d('0x27')](respondWithResult(_0x1a8f33,null))['catch'](handleError(_0x1a8f33,null));};exports['destroy']=function(_0x3ad9b0,_0x122865){return db['AnalyticMetric'][_0x6d6d('0x52')]({'where':{'id':_0x3ad9b0[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x122865,null))[_0x6d6d('0x27')](removeEntity(_0x122865,null))[_0x6d6d('0x4b')](handleError(_0x122865,null));}; \ No newline at end of file +var _0x7da7=['model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','options','where','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x7da7,0x10d));var _0x77da=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7da7[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){var _0x4885ec=_0x270318[_0x77da('0x23')]({'plain':!![]});var _0x2d009f=_0x77da('0x24');return db[_0x77da('0x25')]['destroy']({'where':{'type':_0x2d009f,'resourceId':_0x4885ec['id']}})[_0x77da('0x21')](function(){return _0x270318;});})[_0x77da('0x21')](function(){_0x27b6c7[_0x77da('0x18')](0xcc)[_0x77da('0x26')]();});}};}function handleEntityNotFound(_0x446ae7,_0x5997b6){return function(_0xce24b8){if(!_0xce24b8){_0x446ae7[_0x77da('0x17')](0x194);}return _0xce24b8;};}function handleError(_0x1f2279,_0x2913f7){_0x2913f7=_0x2913f7||0x1f4;return function(_0x496ecd){logger['error'](_0x496ecd['stack']);if(_0x496ecd[_0x77da('0x27')]){delete _0x496ecd[_0x77da('0x27')];}_0x1f2279[_0x77da('0x18')](_0x2913f7)[_0x77da('0x28')](_0x496ecd);};}exports[_0x77da('0x29')]=function(_0x4eeb99,_0x350b4e){var _0x26f5a0={},_0x356bfb={},_0x1d381b={'count':0x0,'rows':[]};var _0x1e7853=_[_0x77da('0x2a')](db['AnalyticMetric'][_0x77da('0x2b')],function(_0x228851){return{'name':_0x228851[_0x77da('0x2c')],'type':_0x228851[_0x77da('0x2d')][_0x77da('0x2e')]};});_0x356bfb[_0x77da('0x2f')]=_[_0x77da('0x2a')](_0x1e7853,_0x77da('0x27'));_0x356bfb['query']=_['keys'](_0x4eeb99[_0x77da('0x30')]);_0x356bfb[_0x77da('0x31')]=_['intersection'](_0x356bfb[_0x77da('0x2f')],_0x356bfb[_0x77da('0x30')]);_0x26f5a0[_0x77da('0x32')]=_[_0x77da('0x33')](_0x356bfb[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x4eeb99[_0x77da('0x30')]['fields']));_0x26f5a0[_0x77da('0x32')]=_0x26f5a0['attributes']['length']?_0x26f5a0['attributes']:_0x356bfb[_0x77da('0x2f')];if(!_0x4eeb99['query'][_0x77da('0x35')](_0x77da('0x36'))){_0x26f5a0[_0x77da('0x1c')]=qs[_0x77da('0x1c')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x1c')]);_0x26f5a0[_0x77da('0x19')]=qs['offset'](_0x4eeb99[_0x77da('0x30')][_0x77da('0x19')]);}_0x26f5a0[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x38')]);_0x26f5a0['where']=qs[_0x77da('0x31')](_[_0x77da('0x39')](_0x4eeb99[_0x77da('0x30')],_0x356bfb['filters']),_0x1e7853);if(_0x4eeb99[_0x77da('0x30')]['filter']){_0x26f5a0['where']=_['merge'](_0x26f5a0['where'],{'$or':_[_0x77da('0x2a')](_0x1e7853,function(_0x1adba5){if(_0x1adba5[_0x77da('0x2d')]!=='VIRTUAL'){var _0x21d337={};_0x21d337[_0x1adba5['name']]={'$like':'%'+_0x4eeb99[_0x77da('0x30')]['filter']+'%'};return _0x21d337;}})});}_0x26f5a0=_[_0x77da('0x3a')]({},_0x26f5a0,_0x4eeb99[_0x77da('0x3b')]);var _0x290667={'where':_0x26f5a0[_0x77da('0x3c')]};return db[_0x77da('0x3d')]['count'](_0x290667)[_0x77da('0x21')](function(_0x1f48bd){_0x1d381b[_0x77da('0x1b')]=_0x1f48bd;if(_0x4eeb99[_0x77da('0x30')][_0x77da('0x3e')]){_0x26f5a0[_0x77da('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x77da('0x40')](_0x26f5a0);})[_0x77da('0x21')](function(_0x21de41){_0x1d381b[_0x77da('0x41')]=_0x21de41;return _0x1d381b;})[_0x77da('0x21')](respondWithFilteredResult(_0x350b4e,_0x26f5a0))[_0x77da('0x42')](handleError(_0x350b4e,null));};exports['show']=function(_0x10957b,_0x5abcd9){var _0x1ae806={'raw':!![],'where':{'id':_0x10957b[_0x77da('0x43')]['id']}},_0x373fb2={};_0x373fb2['model']=_[_0x77da('0x44')](db[_0x77da('0x3d')][_0x77da('0x2b')]);_0x373fb2[_0x77da('0x30')]=_[_0x77da('0x44')](_0x10957b[_0x77da('0x30')]);_0x373fb2[_0x77da('0x31')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],_0x373fb2['query']);_0x1ae806[_0x77da('0x32')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x10957b[_0x77da('0x30')][_0x77da('0x34')]));_0x1ae806['attributes']=_0x1ae806['attributes'][_0x77da('0x45')]?_0x1ae806[_0x77da('0x32')]:_0x373fb2[_0x77da('0x2f')];if(_0x10957b[_0x77da('0x30')][_0x77da('0x3e')]){_0x1ae806[_0x77da('0x3f')]=[{'all':!![]}];}_0x1ae806=_['merge']({},_0x1ae806,_0x10957b[_0x77da('0x3b')]);return db[_0x77da('0x3d')][_0x77da('0x46')](_0x1ae806)[_0x77da('0x21')](handleEntityNotFound(_0x5abcd9,null))['then'](respondWithResult(_0x5abcd9,null))[_0x77da('0x42')](handleError(_0x5abcd9,null));};exports['create']=function(_0x518fd5,_0x36263b){return db[_0x77da('0x3d')][_0x77da('0x47')](_0x518fd5[_0x77da('0x48')],{})['then'](function(_0x16bf4b){var _0x1e36ee=_0x518fd5['user'][_0x77da('0x23')]({'plain':!![]});if(!_0x1e36ee)throw new Error(_0x77da('0x49'));if(_0x1e36ee['role']===_0x77da('0x4a')){var _0x3aaf5b=_0x16bf4b[_0x77da('0x23')]({'plain':!![]});var _0xef2496=_0x77da('0x24');return db[_0x77da('0x4b')][_0x77da('0x46')]({'where':{'name':_0xef2496,'userProfileId':_0x1e36ee[_0x77da('0x4c')]},'raw':!![]})[_0x77da('0x21')](function(_0x3a34a8){if(_0x3a34a8&&_0x3a34a8['autoAssociation']===0x0){return db[_0x77da('0x25')]['create']({'name':_0x3aaf5b[_0x77da('0x27')],'resourceId':_0x3aaf5b['id'],'type':_0x3a34a8[_0x77da('0x27')],'sectionId':_0x3a34a8['id']},{})[_0x77da('0x21')](function(){return _0x16bf4b;});}else{return _0x16bf4b;}})[_0x77da('0x42')](function(_0x374179){logger[_0x77da('0x4d')](_0x77da('0x4e'),_0x374179);throw _0x374179;});}return _0x16bf4b;})['then'](respondWithResult(_0x36263b,0xc9))[_0x77da('0x42')](handleError(_0x36263b,null));};exports[_0x77da('0x20')]=function(_0x1a7115,_0x353be9){if(_0x1a7115['body']['id']){delete _0x1a7115[_0x77da('0x48')]['id'];}return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x1a7115['params']['id']}})['then'](handleEntityNotFound(_0x353be9,null))[_0x77da('0x21')](saveUpdates(_0x1a7115[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x353be9,null))[_0x77da('0x42')](handleError(_0x353be9,null));};exports[_0x77da('0x22')]=function(_0x528a32,_0x50437b){return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x528a32['params']['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x50437b,null))[_0x77da('0x21')](removeEntity(_0x50437b,null))[_0x77da('0x42')](handleError(_0x50437b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 75f43cb..342ace5 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 _0x723e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics'];(function(_0x4e7413,_0x5dffb1){var _0x11b6de=function(_0xd6721b){while(--_0xd6721b){_0x4e7413['push'](_0x4e7413['shift']());}};_0x11b6de(++_0x5dffb1);}(_0x723e,0x179));var _0xe723=function(_0x27817b,_0x2f7e80){_0x27817b=_0x27817b-0x0;var _0x11692c=_0x723e[_0x27817b];return _0x11692c;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var logger=require(_0xe723('0x1'))(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var BPromise=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var fs=require('fs');var path=require(_0xe723('0x6'));var rimraf=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var attributes=require(_0xe723('0x9'));module['exports']=function(_0x32d689,_0x20c13b){return _0x32d689[_0xe723('0xa')](_0xe723('0xb'),attributes,{'tableName':_0xe723('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf360=['AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./analyticMetric.attributes','exports','define'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xf360,0x9e));var _0x0f36=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf360[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0f36('0x0'));var util=require(_0x0f36('0x1'));var logger=require(_0x0f36('0x2'))('api');var moment=require(_0x0f36('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f36('0x4'));var fs=require('fs');var path=require(_0x0f36('0x5'));var rimraf=require(_0x0f36('0x6'));var config=require('../../config/environment');var attributes=require(_0x0f36('0x7'));module[_0x0f36('0x8')]=function(_0x13d262,_0x110709){return _0x13d262[_0x0f36('0x9')](_0x0f36('0xa'),attributes,{'tableName':_0x0f36('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 13d1319..d0b8e85 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 _0x16a9=['then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x16a9,0x107));var _0x916a=function(_0x218422,_0x367e3c){_0x218422=_0x218422-0x0;var _0x2fc5a5=_0x16a9[_0x218422];return _0x2fc5a5;};'use strict';var _=require(_0x916a('0x0'));var util=require('util');var moment=require(_0x916a('0x1'));var BPromise=require(_0x916a('0x2'));var rs=require(_0x916a('0x3'));var fs=require('fs');var Redis=require(_0x916a('0x4'));var db=require(_0x916a('0x5'))['db'];var utils=require(_0x916a('0x6'));var logger=require(_0x916a('0x7'))('rpc');var config=require(_0x916a('0x8'));var jayson=require(_0x916a('0x9'));var client=jayson[_0x916a('0xa')][_0x916a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x410c75,_0x3256d3,_0x27ca04){return new BPromise(function(_0x2e66b3,_0xbe274a){return client[_0x916a('0xc')](_0x410c75,_0x27ca04)[_0x916a('0xd')](function(_0x5df37a){logger['info'](_0x916a('0xe'),_0x3256d3,_0x916a('0xf'));logger[_0x916a('0x10')](_0x916a('0x11'),_0x3256d3,'request\x20sent',JSON[_0x916a('0x12')](_0x5df37a));if(_0x5df37a[_0x916a('0x13')]){if(_0x5df37a['error']['code']===0x1f4){logger[_0x916a('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x3256d3,_0x5df37a[_0x916a('0x13')][_0x916a('0x14')]);return _0xbe274a(_0x5df37a['error'][_0x916a('0x14')]);}logger[_0x916a('0x13')](_0x916a('0xe'),_0x3256d3,_0x5df37a['error'][_0x916a('0x14')]);return _0x2e66b3(_0x5df37a[_0x916a('0x13')]['message']);}else{logger[_0x916a('0x15')](_0x916a('0xe'),_0x3256d3,_0x916a('0xf'));_0x2e66b3(_0x5df37a[_0x916a('0x16')][_0x916a('0x14')]);}})['catch'](function(_0x428433){logger[_0x916a('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x3256d3,_0x428433);_0xbe274a(_0x428433);});});} \ No newline at end of file +var _0x0648=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x43a6a1,_0x4f0100){var _0x20b2ed=function(_0x84672d){while(--_0x84672d){_0x43a6a1['push'](_0x43a6a1['shift']());}};_0x20b2ed(++_0x4f0100);}(_0x0648,0x1f4));var _0x8064=function(_0x5d2613,_0x47193f){_0x5d2613=_0x5d2613-0x0;var _0x20b242=_0x0648[_0x5d2613];return _0x20b242;};'use strict';var _=require(_0x8064('0x0'));var util=require('util');var moment=require(_0x8064('0x1'));var BPromise=require(_0x8064('0x2'));var rs=require(_0x8064('0x3'));var fs=require('fs');var Redis=require(_0x8064('0x4'));var db=require(_0x8064('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8064('0x6'))(_0x8064('0x7'));var config=require(_0x8064('0x8'));var jayson=require(_0x8064('0x9'));var client=jayson[_0x8064('0xa')][_0x8064('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x63a73d,_0x6e796e,_0x110c58){return new BPromise(function(_0x351ff5,_0x27ed78){return client['request'](_0x63a73d,_0x110c58)[_0x8064('0xc')](function(_0xcdcd4e){logger[_0x8064('0xd')](_0x8064('0xe'),_0x6e796e,_0x8064('0xf'));logger[_0x8064('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x6e796e,'request\x20sent',JSON[_0x8064('0x11')](_0xcdcd4e));if(_0xcdcd4e[_0x8064('0x12')]){if(_0xcdcd4e['error'][_0x8064('0x13')]===0x1f4){logger[_0x8064('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x6e796e,_0xcdcd4e['error'][_0x8064('0x14')]);return _0x27ed78(_0xcdcd4e['error'][_0x8064('0x14')]);}logger[_0x8064('0x12')](_0x8064('0xe'),_0x6e796e,_0xcdcd4e[_0x8064('0x12')][_0x8064('0x14')]);return _0x351ff5(_0xcdcd4e['error'][_0x8064('0x14')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x6e796e,'request\x20sent');_0x351ff5(_0xcdcd4e[_0x8064('0x15')][_0x8064('0x14')]);}})[_0x8064('0x16')](function(_0x1b8787){logger[_0x8064('0x12')](_0x8064('0xe'),_0x6e796e,_0x1b8787);_0x27ed78(_0x1b8787);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index ba6b976..a2b6f1a 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 _0xdf98=['isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf98,0xcf));var _0x8df9=function(_0x10e653,_0x59f1cc){_0x10e653=_0x10e653-0x0;var _0x328dfd=_0xdf98[_0x10e653];return _0x328dfd;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require(_0x8df9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8df9('0x2')]();var fs_extra=require(_0x8df9('0x3'));var auth=require(_0x8df9('0x4'));var interaction=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var controller=require(_0x8df9('0x7'));router[_0x8df9('0x8')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xa')]);router['get'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8df9('0xd')]);router['put'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xe')]);router[_0x8df9('0xf')](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0x10')]);module[_0x8df9('0x11')]=router; \ No newline at end of file +var _0x7d10=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4ca00c,_0x3bd1aa){var _0x429cfb=function(_0x3c3296){while(--_0x3c3296){_0x4ca00c['push'](_0x4ca00c['shift']());}};_0x429cfb(++_0x3bd1aa);}(_0x7d10,0x1ce));var _0x07d1=function(_0x1c65bf,_0x226c04){_0x1c65bf=_0x1c65bf-0x0;var _0x2450f6=_0x7d10[_0x1c65bf];return _0x2450f6;};'use strict';var multer=require('multer');var util=require(_0x07d1('0x0'));var path=require(_0x07d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x07d1('0x2'));var router=express[_0x07d1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x07d1('0x4'));var interaction=require(_0x07d1('0x5'));var config=require('../../config/environment');var controller=require(_0x07d1('0x6'));router[_0x07d1('0x7')]('/',auth[_0x07d1('0x8')](),controller[_0x07d1('0x9')]);router['get'](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0xb')]);router[_0x07d1('0xc')]('/',auth[_0x07d1('0x8')](),controller[_0x07d1('0xd')]);router[_0x07d1('0xe')](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0xf')]);router[_0x07d1('0x10')](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0x11')]);module[_0x07d1('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 69a30cb..0831f02 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 _0xce0a=['TEXT','sequelize'];(function(_0x2d6498,_0x16b741){var _0x5398a8=function(_0x104458){while(--_0x104458){_0x2d6498['push'](_0x2d6498['shift']());}};_0x5398a8(++_0x16b741);}(_0xce0a,0xc1));var _0xace0=function(_0x2a1e2d,_0x195473){_0x2a1e2d=_0x2a1e2d-0x0;var _0x32b8cc=_0xce0a[_0x2a1e2d];return _0x32b8cc;};'use strict';var Sequelize=require(_0xace0('0x0'));module['exports']={'tree':{'type':Sequelize[_0xace0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xeef4=['TEXT','sequelize','exports'];(function(_0x2164ea,_0x3d6f2f){var _0x9baac2=function(_0x12c4ba){while(--_0x12c4ba){_0x2164ea['push'](_0x2164ea['shift']());}};_0x9baac2(++_0x3d6f2f);}(_0xeef4,0x7f));var _0x4eef=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0xeef4[_0x2125f0];return _0x12d6eb;};'use strict';var Sequelize=require(_0x4eef('0x0'));module[_0x4eef('0x1')]={'tree':{'type':Sequelize[_0x4eef('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 88448a6..d3af3f7 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 _0xfb75=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','name','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x177225,_0x2476b5){var _0x5d6a65=function(_0x3b98f1){while(--_0x3b98f1){_0x177225['push'](_0x177225['shift']());}};_0x5d6a65(++_0x2476b5);}(_0xfb75,0x1f3));var _0x5fb7=function(_0x448d4f,_0x1d4201){_0x448d4f=_0x448d4f-0x0;var _0x156d90=_0xfb75[_0x448d4f];return _0x156d90;};'use strict';var emlformat=require(_0x5fb7('0x0'));var rimraf=require(_0x5fb7('0x1'));var zipdir=require(_0x5fb7('0x2'));var jsonpatch=require(_0x5fb7('0x3'));var rp=require(_0x5fb7('0x4'));var moment=require(_0x5fb7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5fb7('0x6'));var util=require(_0x5fb7('0x7'));var path=require(_0x5fb7('0x8'));var sox=require(_0x5fb7('0x9'));var csv=require(_0x5fb7('0xa'));var ejs=require(_0x5fb7('0xb'));var fs=require('fs');var fs_extra=require(_0x5fb7('0xc'));var _=require(_0x5fb7('0xd'));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('querystring');var Papa=require(_0x5fb7('0xe'));var Redis=require(_0x5fb7('0xf'));var authService=require(_0x5fb7('0x10'));var qs=require(_0x5fb7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fb7('0x12'));var logger=require(_0x5fb7('0x13'))(_0x5fb7('0x14'));var utils=require('../../config/utils');var config=require(_0x5fb7('0x15'));var licenseUtil=require(_0x5fb7('0x16'));var db=require(_0x5fb7('0x17'))['db'];function respondWithStatusCode(_0x18641f,_0xeea3e4){_0xeea3e4=_0xeea3e4||0xcc;return function(_0xf002e1){if(_0xf002e1){return _0x18641f[_0x5fb7('0x18')](_0xeea3e4);}return _0x18641f['status'](_0xeea3e4)['end']();};}function respondWithResult(_0x1d3e62,_0xa86ecb){_0xa86ecb=_0xa86ecb||0xc8;return function(_0x3e1a9d){if(_0x3e1a9d){return _0x1d3e62[_0x5fb7('0x19')](_0xa86ecb)[_0x5fb7('0x1a')](_0x3e1a9d);}};}function respondWithFilteredResult(_0x1aac89,_0x5d6a6e){return function(_0x543b31){if(_0x543b31){var _0x2ee629=typeof _0x5d6a6e[_0x5fb7('0x1b')]===_0x5fb7('0x1c')&&typeof _0x5d6a6e['limit']===_0x5fb7('0x1c');var _0x4cd2f5=_0x543b31[_0x5fb7('0x1d')];var _0x21f698=_0x2ee629?0x0:_0x5d6a6e['offset'];var _0x251b28=_0x2ee629?_0x543b31['count']:_0x5d6a6e[_0x5fb7('0x1b')]+_0x5d6a6e['limit'];var _0x955a7f;if(_0x251b28>=_0x4cd2f5){_0x251b28=_0x4cd2f5;_0x955a7f=0xc8;}else{_0x955a7f=0xce;}_0x1aac89[_0x5fb7('0x19')](_0x955a7f);return _0x1aac89[_0x5fb7('0x1e')](_0x5fb7('0x1f'),_0x21f698+'-'+_0x251b28+'/'+_0x4cd2f5)[_0x5fb7('0x1a')](_0x543b31);}return null;};}function patchUpdates(_0x3a4192){return function(_0x83591b){try{jsonpatch[_0x5fb7('0x20')](_0x83591b,_0x3a4192,!![]);}catch(_0x31abe1){return BPromise['reject'](_0x31abe1);}return _0x83591b[_0x5fb7('0x21')]();};}function saveUpdates(_0x54cc12,_0x23bbfb){return function(_0x1c45e4){if(_0x1c45e4){return _0x1c45e4[_0x5fb7('0x22')](_0x54cc12)[_0x5fb7('0x23')](function(_0xe4e96f){return _0xe4e96f;});}return null;};}function removeEntity(_0x52c9ba,_0x3cbc33){return function(_0x7026b2){if(_0x7026b2){return _0x7026b2[_0x5fb7('0x24')]()['then'](function(){_0x52c9ba[_0x5fb7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41e7e9,_0x4de460){return function(_0x285bd6){if(!_0x285bd6){_0x41e7e9[_0x5fb7('0x18')](0x194);}return _0x285bd6;};}function handleError(_0x284054,_0x245f97){_0x245f97=_0x245f97||0x1f4;return function(_0xb11f33){logger[_0x5fb7('0x25')](_0xb11f33[_0x5fb7('0x26')]);if(_0xb11f33['name']){delete _0xb11f33['name'];}_0x284054[_0x5fb7('0x19')](_0x245f97)[_0x5fb7('0x27')](_0xb11f33);};}exports['index']=function(_0x2dcbae,_0x2c3e39){var _0x1d6447={},_0x4e62ff={},_0x4247f5={'count':0x0,'rows':[]};var _0x1e91f1=_[_0x5fb7('0x28')](db[_0x5fb7('0x29')][_0x5fb7('0x2a')],function(_0x445f09){return{'name':_0x445f09[_0x5fb7('0x2b')],'type':_0x445f09[_0x5fb7('0x2c')][_0x5fb7('0x2d')]};});_0x4e62ff[_0x5fb7('0x2e')]=_[_0x5fb7('0x28')](_0x1e91f1,'name');_0x4e62ff['query']=_[_0x5fb7('0x2f')](_0x2dcbae[_0x5fb7('0x30')]);_0x4e62ff['filters']=_[_0x5fb7('0x31')](_0x4e62ff[_0x5fb7('0x2e')],_0x4e62ff['query']);_0x1d6447[_0x5fb7('0x32')]=_[_0x5fb7('0x31')](_0x4e62ff[_0x5fb7('0x2e')],qs[_0x5fb7('0x33')](_0x2dcbae['query'][_0x5fb7('0x33')]));_0x1d6447[_0x5fb7('0x32')]=_0x1d6447[_0x5fb7('0x32')]['length']?_0x1d6447[_0x5fb7('0x32')]:_0x4e62ff[_0x5fb7('0x2e')];if(!_0x2dcbae['query'][_0x5fb7('0x34')](_0x5fb7('0x35'))){_0x1d6447[_0x5fb7('0x36')]=qs['limit'](_0x2dcbae[_0x5fb7('0x30')]['limit']);_0x1d6447[_0x5fb7('0x1b')]=qs[_0x5fb7('0x1b')](_0x2dcbae[_0x5fb7('0x30')]['offset']);}_0x1d6447[_0x5fb7('0x37')]=qs['sort'](_0x2dcbae[_0x5fb7('0x30')][_0x5fb7('0x38')]);_0x1d6447[_0x5fb7('0x39')]=qs[_0x5fb7('0x3a')](_[_0x5fb7('0x3b')](_0x2dcbae['query'],_0x4e62ff[_0x5fb7('0x3a')]),_0x1e91f1);if(_0x2dcbae[_0x5fb7('0x30')]['filter']){_0x1d6447[_0x5fb7('0x39')]=_[_0x5fb7('0x3c')](_0x1d6447[_0x5fb7('0x39')],{'$or':_[_0x5fb7('0x28')](_0x1e91f1,function(_0x1a04c6){if(_0x1a04c6[_0x5fb7('0x2c')]!==_0x5fb7('0x3d')){var _0x3efb47={};_0x3efb47[_0x1a04c6[_0x5fb7('0x3e')]]={'$like':'%'+_0x2dcbae[_0x5fb7('0x30')][_0x5fb7('0x3f')]+'%'};return _0x3efb47;}})});}_0x1d6447=_['merge']({},_0x1d6447,_0x2dcbae[_0x5fb7('0x40')]);var _0x320704={'where':_0x1d6447[_0x5fb7('0x39')]};return db[_0x5fb7('0x29')][_0x5fb7('0x1d')](_0x320704)[_0x5fb7('0x23')](function(_0x171120){_0x4247f5[_0x5fb7('0x1d')]=_0x171120;if(_0x2dcbae[_0x5fb7('0x30')]['includeAll']){_0x1d6447[_0x5fb7('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x5fb7('0x42')](_0x1d6447);})[_0x5fb7('0x23')](function(_0x24e2b5){_0x4247f5['rows']=_0x24e2b5;return _0x4247f5;})[_0x5fb7('0x23')](respondWithFilteredResult(_0x2c3e39,_0x1d6447))[_0x5fb7('0x43')](handleError(_0x2c3e39,null));};exports[_0x5fb7('0x44')]=function(_0xa5d8af,_0x34b278){var _0xec72f={'raw':!![],'where':{'id':_0xa5d8af[_0x5fb7('0x45')]['id']}},_0x51dad3={};_0x51dad3[_0x5fb7('0x2e')]=_['keys'](db['AnalyticTreeReport'][_0x5fb7('0x2a')]);_0x51dad3['query']=_[_0x5fb7('0x2f')](_0xa5d8af[_0x5fb7('0x30')]);_0x51dad3[_0x5fb7('0x3a')]=_[_0x5fb7('0x31')](_0x51dad3[_0x5fb7('0x2e')],_0x51dad3[_0x5fb7('0x30')]);_0xec72f['attributes']=_['intersection'](_0x51dad3[_0x5fb7('0x2e')],qs['fields'](_0xa5d8af['query']['fields']));_0xec72f[_0x5fb7('0x32')]=_0xec72f[_0x5fb7('0x32')]['length']?_0xec72f['attributes']:_0x51dad3['model'];if(_0xa5d8af['query'][_0x5fb7('0x46')]){_0xec72f[_0x5fb7('0x41')]=[{'all':!![]}];}_0xec72f=_[_0x5fb7('0x3c')]({},_0xec72f,_0xa5d8af[_0x5fb7('0x40')]);return db[_0x5fb7('0x29')][_0x5fb7('0x47')](_0xec72f)[_0x5fb7('0x23')](handleEntityNotFound(_0x34b278,null))[_0x5fb7('0x23')](respondWithResult(_0x34b278,null))[_0x5fb7('0x43')](handleError(_0x34b278,null));};exports[_0x5fb7('0x48')]=function(_0x1edf63,_0x5078b4){return db[_0x5fb7('0x29')][_0x5fb7('0x48')](_0x1edf63[_0x5fb7('0x49')],{})[_0x5fb7('0x23')](respondWithResult(_0x5078b4,0xc9))['catch'](handleError(_0x5078b4,null));};exports[_0x5fb7('0x22')]=function(_0x277df3,_0xcb5e17){if(_0x277df3[_0x5fb7('0x49')]['id']){delete _0x277df3[_0x5fb7('0x49')]['id'];}return db[_0x5fb7('0x29')][_0x5fb7('0x47')]({'where':{'id':_0x277df3[_0x5fb7('0x45')]['id']}})['then'](handleEntityNotFound(_0xcb5e17,null))['then'](saveUpdates(_0x277df3['body'],null))[_0x5fb7('0x23')](respondWithResult(_0xcb5e17,null))[_0x5fb7('0x43')](handleError(_0xcb5e17,null));};exports[_0x5fb7('0x24')]=function(_0x4cebca,_0x188d8b){return db[_0x5fb7('0x29')]['find']({'where':{'id':_0x4cebca[_0x5fb7('0x45')]['id']}})[_0x5fb7('0x23')](handleEntityNotFound(_0x188d8b,null))[_0x5fb7('0x23')](removeEntity(_0x188d8b,null))[_0x5fb7('0x43')](handleError(_0x188d8b,null));}; \ No newline at end of file +var _0xfa00=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','show','find','catch','create','body','params','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x2cd07d,_0x12b075){var _0x11ccf5=function(_0x1f34a6){while(--_0x1f34a6){_0x2cd07d['push'](_0x2cd07d['shift']());}};_0x11ccf5(++_0x12b075);}(_0xfa00,0x145));var _0x0fa0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfa00[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0fa0('0x0'));var BPromise=require('bluebird');var Mustache=require(_0x0fa0('0x1'));var util=require(_0x0fa0('0x2'));var path=require('path');var sox=require(_0x0fa0('0x3'));var csv=require(_0x0fa0('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0fa0('0x5'));var _=require(_0x0fa0('0x6'));var squel=require(_0x0fa0('0x7'));var crypto=require(_0x0fa0('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0fa0('0x4'));var querystring=require(_0x0fa0('0x9'));var Papa=require(_0x0fa0('0xa'));var Redis=require('ioredis');var authService=require(_0x0fa0('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fa0('0xc'));var logger=require('../../config/logger')(_0x0fa0('0xd'));var utils=require('../../config/utils');var config=require(_0x0fa0('0xe'));var licenseUtil=require(_0x0fa0('0xf'));var db=require(_0x0fa0('0x10'))['db'];function respondWithStatusCode(_0x119467,_0x8d1868){_0x8d1868=_0x8d1868||0xcc;return function(_0x343bcb){if(_0x343bcb){return _0x119467[_0x0fa0('0x11')](_0x8d1868);}return _0x119467['status'](_0x8d1868)[_0x0fa0('0x12')]();};}function respondWithResult(_0x5e74c5,_0x3bd143){_0x3bd143=_0x3bd143||0xc8;return function(_0x5253ac){if(_0x5253ac){return _0x5e74c5[_0x0fa0('0x13')](_0x3bd143)[_0x0fa0('0x14')](_0x5253ac);}};}function respondWithFilteredResult(_0x5c3448,_0x3feb46){return function(_0x3a60c3){if(_0x3a60c3){var _0xea3124=typeof _0x3feb46[_0x0fa0('0x15')]===_0x0fa0('0x16')&&typeof _0x3feb46[_0x0fa0('0x17')]===_0x0fa0('0x16');var _0xc7610b=_0x3a60c3[_0x0fa0('0x18')];var _0x28c000=_0xea3124?0x0:_0x3feb46[_0x0fa0('0x15')];var _0x361a54=_0xea3124?_0x3a60c3[_0x0fa0('0x18')]:_0x3feb46['offset']+_0x3feb46[_0x0fa0('0x17')];var _0x4c61e0;if(_0x361a54>=_0xc7610b){_0x361a54=_0xc7610b;_0x4c61e0=0xc8;}else{_0x4c61e0=0xce;}_0x5c3448[_0x0fa0('0x13')](_0x4c61e0);return _0x5c3448['set'](_0x0fa0('0x19'),_0x28c000+'-'+_0x361a54+'/'+_0xc7610b)[_0x0fa0('0x14')](_0x3a60c3);}return null;};}function patchUpdates(_0x21583e){return function(_0x583d17){try{jsonpatch[_0x0fa0('0x1a')](_0x583d17,_0x21583e,!![]);}catch(_0x3cddf3){return BPromise[_0x0fa0('0x1b')](_0x3cddf3);}return _0x583d17[_0x0fa0('0x1c')]();};}function saveUpdates(_0xa5cf39,_0x5e4db3){return function(_0x5555ed){if(_0x5555ed){return _0x5555ed[_0x0fa0('0x1d')](_0xa5cf39)[_0x0fa0('0x1e')](function(_0x576ce5){return _0x576ce5;});}return null;};}function removeEntity(_0x412e9c,_0x18cc57){return function(_0x5db8dc){if(_0x5db8dc){return _0x5db8dc[_0x0fa0('0x1f')]()[_0x0fa0('0x1e')](function(){_0x412e9c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c37d9,_0x49d7bf){return function(_0x13dba2){if(!_0x13dba2){_0x4c37d9['sendStatus'](0x194);}return _0x13dba2;};}function handleError(_0x456963,_0x216270){_0x216270=_0x216270||0x1f4;return function(_0x272303){logger[_0x0fa0('0x20')](_0x272303[_0x0fa0('0x21')]);if(_0x272303['name']){delete _0x272303[_0x0fa0('0x22')];}_0x456963[_0x0fa0('0x13')](_0x216270)[_0x0fa0('0x23')](_0x272303);};}exports[_0x0fa0('0x24')]=function(_0x2a5530,_0xeb9eea){var _0x26013a={},_0x2ef159={},_0x4c2e64={'count':0x0,'rows':[]};var _0x3ecb18=_[_0x0fa0('0x25')](db['AnalyticTreeReport'][_0x0fa0('0x26')],function(_0x409a6a){return{'name':_0x409a6a[_0x0fa0('0x27')],'type':_0x409a6a[_0x0fa0('0x28')]['key']};});_0x2ef159[_0x0fa0('0x29')]=_[_0x0fa0('0x25')](_0x3ecb18,_0x0fa0('0x22'));_0x2ef159[_0x0fa0('0x2a')]=_[_0x0fa0('0x2b')](_0x2a5530[_0x0fa0('0x2a')]);_0x2ef159[_0x0fa0('0x2c')]=_['intersection'](_0x2ef159[_0x0fa0('0x29')],_0x2ef159[_0x0fa0('0x2a')]);_0x26013a[_0x0fa0('0x2d')]=_[_0x0fa0('0x2e')](_0x2ef159[_0x0fa0('0x29')],qs[_0x0fa0('0x2f')](_0x2a5530['query'][_0x0fa0('0x2f')]));_0x26013a[_0x0fa0('0x2d')]=_0x26013a['attributes'][_0x0fa0('0x30')]?_0x26013a['attributes']:_0x2ef159[_0x0fa0('0x29')];if(!_0x2a5530['query'][_0x0fa0('0x31')](_0x0fa0('0x32'))){_0x26013a[_0x0fa0('0x17')]=qs[_0x0fa0('0x17')](_0x2a5530['query'][_0x0fa0('0x17')]);_0x26013a['offset']=qs[_0x0fa0('0x15')](_0x2a5530[_0x0fa0('0x2a')][_0x0fa0('0x15')]);}_0x26013a[_0x0fa0('0x33')]=qs['sort'](_0x2a5530[_0x0fa0('0x2a')]['sort']);_0x26013a['where']=qs[_0x0fa0('0x2c')](_[_0x0fa0('0x34')](_0x2a5530['query'],_0x2ef159[_0x0fa0('0x2c')]),_0x3ecb18);if(_0x2a5530['query'][_0x0fa0('0x35')]){_0x26013a[_0x0fa0('0x36')]=_[_0x0fa0('0x37')](_0x26013a[_0x0fa0('0x36')],{'$or':_[_0x0fa0('0x25')](_0x3ecb18,function(_0x565f56){if(_0x565f56[_0x0fa0('0x28')]!==_0x0fa0('0x38')){var _0x565fcf={};_0x565fcf[_0x565f56[_0x0fa0('0x22')]]={'$like':'%'+_0x2a5530[_0x0fa0('0x2a')][_0x0fa0('0x35')]+'%'};return _0x565fcf;}})});}_0x26013a=_[_0x0fa0('0x37')]({},_0x26013a,_0x2a5530[_0x0fa0('0x39')]);var _0xb77e29={'where':_0x26013a[_0x0fa0('0x36')]};return db[_0x0fa0('0x3a')]['count'](_0xb77e29)[_0x0fa0('0x1e')](function(_0x30935f){_0x4c2e64['count']=_0x30935f;if(_0x2a5530[_0x0fa0('0x2a')][_0x0fa0('0x3b')]){_0x26013a[_0x0fa0('0x3c')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x0fa0('0x3d')](_0x26013a);})[_0x0fa0('0x1e')](function(_0x573ac6){_0x4c2e64[_0x0fa0('0x3e')]=_0x573ac6;return _0x4c2e64;})[_0x0fa0('0x1e')](respondWithFilteredResult(_0xeb9eea,_0x26013a))['catch'](handleError(_0xeb9eea,null));};exports[_0x0fa0('0x3f')]=function(_0x4a326d,_0x8b7d88){var _0x103faf={'raw':!![],'where':{'id':_0x4a326d['params']['id']}},_0x3fb6bb={};_0x3fb6bb[_0x0fa0('0x29')]=_[_0x0fa0('0x2b')](db[_0x0fa0('0x3a')][_0x0fa0('0x26')]);_0x3fb6bb[_0x0fa0('0x2a')]=_['keys'](_0x4a326d[_0x0fa0('0x2a')]);_0x3fb6bb[_0x0fa0('0x2c')]=_[_0x0fa0('0x2e')](_0x3fb6bb['model'],_0x3fb6bb[_0x0fa0('0x2a')]);_0x103faf['attributes']=_[_0x0fa0('0x2e')](_0x3fb6bb['model'],qs[_0x0fa0('0x2f')](_0x4a326d[_0x0fa0('0x2a')][_0x0fa0('0x2f')]));_0x103faf[_0x0fa0('0x2d')]=_0x103faf[_0x0fa0('0x2d')]['length']?_0x103faf[_0x0fa0('0x2d')]:_0x3fb6bb[_0x0fa0('0x29')];if(_0x4a326d[_0x0fa0('0x2a')][_0x0fa0('0x3b')]){_0x103faf['include']=[{'all':!![]}];}_0x103faf=_[_0x0fa0('0x37')]({},_0x103faf,_0x4a326d[_0x0fa0('0x39')]);return db[_0x0fa0('0x3a')][_0x0fa0('0x40')](_0x103faf)[_0x0fa0('0x1e')](handleEntityNotFound(_0x8b7d88,null))['then'](respondWithResult(_0x8b7d88,null))[_0x0fa0('0x41')](handleError(_0x8b7d88,null));};exports[_0x0fa0('0x42')]=function(_0xe6e11d,_0x1f30ab){return db['AnalyticTreeReport'][_0x0fa0('0x42')](_0xe6e11d[_0x0fa0('0x43')],{})['then'](respondWithResult(_0x1f30ab,0xc9))[_0x0fa0('0x41')](handleError(_0x1f30ab,null));};exports[_0x0fa0('0x1d')]=function(_0x15413e,_0x1900cd){if(_0x15413e[_0x0fa0('0x43')]['id']){delete _0x15413e[_0x0fa0('0x43')]['id'];}return db[_0x0fa0('0x3a')][_0x0fa0('0x40')]({'where':{'id':_0x15413e[_0x0fa0('0x44')]['id']}})[_0x0fa0('0x1e')](handleEntityNotFound(_0x1900cd,null))[_0x0fa0('0x1e')](saveUpdates(_0x15413e[_0x0fa0('0x43')],null))['then'](respondWithResult(_0x1900cd,null))[_0x0fa0('0x41')](handleError(_0x1900cd,null));};exports['destroy']=function(_0x1e96ca,_0x39b288){return db['AnalyticTreeReport'][_0x0fa0('0x40')]({'where':{'id':_0x1e96ca[_0x0fa0('0x44')]['id']}})['then'](handleEntityNotFound(_0x39b288,null))[_0x0fa0('0x1e')](removeEntity(_0x39b288,null))[_0x0fa0('0x41')](handleError(_0x39b288,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 3443de4..91ae2e5 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 _0xa7b0=['analytics_report_trees','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','AnalyticTreeReport'];(function(_0x35fccf,_0x3cad3b){var _0x58831a=function(_0x59faa4){while(--_0x59faa4){_0x35fccf['push'](_0x35fccf['shift']());}};_0x58831a(++_0x3cad3b);}(_0xa7b0,0xa1));var _0x0a7b=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0xa7b0[_0x49beea];return _0x27693a;};'use strict';var _=require(_0x0a7b('0x0'));var util=require('util');var logger=require(_0x0a7b('0x1'))(_0x0a7b('0x2'));var moment=require('moment');var BPromise=require(_0x0a7b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a7b('0x4'));var rimraf=require(_0x0a7b('0x5'));var config=require(_0x0a7b('0x6'));var attributes=require(_0x0a7b('0x7'));module['exports']=function(_0x3a59a5,_0x9df57f){return _0x3a59a5['define'](_0x0a7b('0x8'),attributes,{'tableName':_0x0a7b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac68=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1f2997,_0x474655){var _0x1d61c2=function(_0x363eed){while(--_0x363eed){_0x1f2997['push'](_0x1f2997['shift']());}};_0x1d61c2(++_0x474655);}(_0xac68,0xaf));var _0x8ac6=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xac68[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0x8ac6('0x0'));var util=require('util');var logger=require(_0x8ac6('0x1'))('api');var moment=require(_0x8ac6('0x2'));var BPromise=require(_0x8ac6('0x3'));var rp=require(_0x8ac6('0x4'));var fs=require('fs');var path=require(_0x8ac6('0x5'));var rimraf=require(_0x8ac6('0x6'));var config=require(_0x8ac6('0x7'));var attributes=require(_0x8ac6('0x8'));module[_0x8ac6('0x9')]=function(_0x5e8356,_0x6058f9){return _0x5e8356[_0x8ac6('0xa')](_0x8ac6('0xb'),attributes,{'tableName':_0x8ac6('0xc'),'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 99c1642..9d074ce 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xc352bd,_0x312795){var _0x10e333=function(_0x9fc6bd){while(--_0x9fc6bd){_0xc352bd['push'](_0xc352bd['shift']());}};_0x10e333(++_0x312795);}(_0xadb5,0xad));var _0x5adb=function(_0x28813c,_0xce074e){_0x28813c=_0x28813c-0x0;var _0x4cd4bb=_0xadb5[_0x28813c];return _0x4cd4bb;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x241115,_0x22f76b){_0x241115=_0x241115-0x0;var _0x1ffc68=_0x7a54[_0x241115];return _0x1ffc68;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 54fcec6..00b4cf2 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 _0x2ad4=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','/:id','post','create','put','delete','destroy'];(function(_0x5d1566,_0x3fed4b){var _0x3441a2=function(_0x57c3fe){while(--_0x57c3fe){_0x5d1566['push'](_0x5d1566['shift']());}};_0x3441a2(++_0x3fed4b);}(_0x2ad4,0x12d));var _0x42ad=function(_0x2de81b,_0x322f1d){_0x2de81b=_0x2de81b-0x0;var _0x3df553=_0x2ad4[_0x2de81b];return _0x3df553;};'use strict';var multer=require(_0x42ad('0x0'));var util=require(_0x42ad('0x1'));var path=require(_0x42ad('0x2'));var timeout=require(_0x42ad('0x3'));var express=require(_0x42ad('0x4'));var router=express[_0x42ad('0x5')]();var fs_extra=require(_0x42ad('0x6'));var auth=require(_0x42ad('0x7'));var interaction=require(_0x42ad('0x8'));var config=require(_0x42ad('0x9'));var controller=require(_0x42ad('0xa'));router['get']('/',auth[_0x42ad('0xb')](),controller[_0x42ad('0xc')]);router['get'](_0x42ad('0xd'),auth[_0x42ad('0xb')](),controller['show']);router[_0x42ad('0xe')]('/',auth['isAuthenticated'](),controller[_0x42ad('0xf')]);router[_0x42ad('0x10')](_0x42ad('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x42ad('0x11')](_0x42ad('0xd'),auth[_0x42ad('0xb')](),controller[_0x42ad('0x12')]);module[_0x42ad('0x13')]=router; \ No newline at end of file +var _0x9289=['show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0x9289,0x195));var _0x9928=function(_0x35dd97,_0x9fe675){_0x35dd97=_0x35dd97-0x0;var _0x465788=_0x9289[_0x35dd97];return _0x465788;};'use strict';var multer=require(_0x9928('0x0'));var util=require(_0x9928('0x1'));var path=require(_0x9928('0x2'));var timeout=require(_0x9928('0x3'));var express=require(_0x9928('0x4'));var router=express[_0x9928('0x5')]();var fs_extra=require(_0x9928('0x6'));var auth=require(_0x9928('0x7'));var interaction=require(_0x9928('0x8'));var config=require(_0x9928('0x9'));var controller=require(_0x9928('0xa'));router[_0x9928('0xb')]('/',auth[_0x9928('0xc')](),controller[_0x9928('0xd')]);router[_0x9928('0xb')](_0x9928('0xe'),auth[_0x9928('0xc')](),controller[_0x9928('0xf')]);router[_0x9928('0x10')]('/',auth[_0x9928('0xc')](),controller['create']);router[_0x9928('0x11')](_0x9928('0xe'),auth['isAuthenticated'](),controller[_0x9928('0x12')]);router['delete']('/:id',auth[_0x9928('0xc')](),controller[_0x9928('0x13')]);module[_0x9928('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 0d242d7..704e89a 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 _0x56e6=['exports','STRING','sequelize'];(function(_0x36140c,_0x5190e7){var _0x128ddd=function(_0x1be27b){while(--_0x1be27b){_0x36140c['push'](_0x36140c['shift']());}};_0x128ddd(++_0x5190e7);}(_0x56e6,0x6b));var _0x656e=function(_0x5476c8,_0x12cc06){_0x5476c8=_0x5476c8-0x0;var _0x4e3bac=_0x56e6[_0x5476c8];return _0x4e3bac;};'use strict';var Sequelize=require(_0x656e('0x0'));module[_0x656e('0x1')]={'name':{'type':Sequelize[_0x656e('0x2')]},'basename':{'type':Sequelize[_0x656e('0x2')]},'type':{'type':Sequelize[_0x656e('0x2')]}}; \ No newline at end of file +var _0x6108=['sequelize','STRING'];(function(_0x57075d,_0x1c0db7){var _0x10a32c=function(_0x4d79f6){while(--_0x4d79f6){_0x57075d['push'](_0x57075d['shift']());}};_0x10a32c(++_0x1c0db7);}(_0x6108,0xbc));var _0x8610=function(_0xa79d75,_0x1ff79e){_0xa79d75=_0xa79d75-0x0;var _0x31e8e2=_0x6108[_0xa79d75];return _0x31e8e2;};'use strict';var Sequelize=require(_0x8610('0x0'));module['exports']={'name':{'type':Sequelize[_0x8610('0x1')]},'basename':{'type':Sequelize[_0x8610('0x1')]},'type':{'type':Sequelize[_0x8610('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9722e8c..ac45f48 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 _0xfec7=['body','omit','updatedAt','create','update','file','originalname','basename','mimetype','findOne','join','root','server/files/attachments/','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','Attachment','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','clone','find','get','createdAt'];(function(_0x4c7935,_0x4a53fb){var _0x30651d=function(_0x12f35f){while(--_0x12f35f){_0x4c7935['push'](_0x4c7935['shift']());}};_0x30651d(++_0x4a53fb);}(_0xfec7,0x112));var _0x7fec=function(_0x58b84b,_0x1a464b){_0x58b84b=_0x58b84b-0x0;var _0x43d902=_0xfec7[_0x58b84b];return _0x43d902;};'use strict';var emlformat=require(_0x7fec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fec('0x1'));var jsonpatch=require(_0x7fec('0x2'));var rp=require(_0x7fec('0x3'));var moment=require(_0x7fec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7fec('0x5'));var util=require(_0x7fec('0x6'));var path=require('path');var sox=require(_0x7fec('0x7'));var csv=require(_0x7fec('0x8'));var ejs=require(_0x7fec('0x9'));var fs=require('fs');var fs_extra=require(_0x7fec('0xa'));var _=require(_0x7fec('0xb'));var squel=require(_0x7fec('0xc'));var crypto=require('crypto');var jsforce=require(_0x7fec('0xd'));var deskjs=require(_0x7fec('0xe'));var toCsv=require(_0x7fec('0x8'));var querystring=require(_0x7fec('0xf'));var Papa=require(_0x7fec('0x10'));var Redis=require(_0x7fec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7fec('0x12'));var as=require(_0x7fec('0x13'));var hardwareService=require(_0x7fec('0x14'));var logger=require(_0x7fec('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7fec('0x16'));var licenseUtil=require(_0x7fec('0x17'));var db=require(_0x7fec('0x18'))['db'];function respondWithStatusCode(_0xca6401,_0x209f2b){_0x209f2b=_0x209f2b||0xcc;return function(_0x17bc19){if(_0x17bc19){return _0xca6401[_0x7fec('0x19')](_0x209f2b);}return _0xca6401[_0x7fec('0x1a')](_0x209f2b)['end']();};}function respondWithResult(_0xdd3dd4,_0x577151){_0x577151=_0x577151||0xc8;return function(_0x507092){if(_0x507092){return _0xdd3dd4[_0x7fec('0x1a')](_0x577151)['json'](_0x507092);}};}function respondWithFilteredResult(_0x43bac2,_0x2a1b56){return function(_0x42c8ca){if(_0x42c8ca){var _0xfa167e=typeof _0x2a1b56['offset']===_0x7fec('0x1b')&&typeof _0x2a1b56[_0x7fec('0x1c')]===_0x7fec('0x1b');var _0x1cc59a=_0x42c8ca['count'];var _0x26c355=_0xfa167e?0x0:_0x2a1b56[_0x7fec('0x1d')];var _0x4ad22e=_0xfa167e?_0x42c8ca[_0x7fec('0x1e')]:_0x2a1b56[_0x7fec('0x1d')]+_0x2a1b56[_0x7fec('0x1c')];var _0x5e7dea;if(_0x4ad22e>=_0x1cc59a){_0x4ad22e=_0x1cc59a;_0x5e7dea=0xc8;}else{_0x5e7dea=0xce;}_0x43bac2[_0x7fec('0x1a')](_0x5e7dea);return _0x43bac2[_0x7fec('0x1f')](_0x7fec('0x20'),_0x26c355+'-'+_0x4ad22e+'/'+_0x1cc59a)['json'](_0x42c8ca);}return null;};}function patchUpdates(_0x31497d){return function(_0x3c5d8e){try{jsonpatch[_0x7fec('0x21')](_0x3c5d8e,_0x31497d,!![]);}catch(_0xcc8a86){return BPromise[_0x7fec('0x22')](_0xcc8a86);}return _0x3c5d8e['save']();};}function saveUpdates(_0x14e54d,_0x3c5cfe){return function(_0x1ba84b){if(_0x1ba84b){return _0x1ba84b['update'](_0x14e54d)[_0x7fec('0x23')](function(_0x551ef1){return _0x551ef1;});}return null;};}function removeEntity(_0x3ca971,_0x2fb33a){return function(_0x100f24){if(_0x100f24){return _0x100f24[_0x7fec('0x24')]()[_0x7fec('0x23')](function(){_0x3ca971[_0x7fec('0x1a')](0xcc)[_0x7fec('0x25')]();});}};}function handleEntityNotFound(_0x469529,_0x535f57){return function(_0x3df643){if(!_0x3df643){_0x469529[_0x7fec('0x19')](0x194);}return _0x3df643;};}function handleError(_0x498c5e,_0x284124){_0x284124=_0x284124||0x1f4;return function(_0x178974){logger[_0x7fec('0x26')](_0x178974[_0x7fec('0x27')]);if(_0x178974['name']){delete _0x178974[_0x7fec('0x28')];}_0x498c5e[_0x7fec('0x1a')](_0x284124)[_0x7fec('0x29')](_0x178974);};}exports[_0x7fec('0x2a')]=function(_0x28b491,_0x5dc91a){var _0x5a7097={},_0x2e0b79={},_0x9b8427={'count':0x0,'rows':[]};var _0x4129f6=_[_0x7fec('0x2b')](db[_0x7fec('0x2c')]['rawAttributes'],function(_0x1bfa3e){return{'name':_0x1bfa3e['fieldName'],'type':_0x1bfa3e['type']['key']};});_0x2e0b79[_0x7fec('0x2d')]=_[_0x7fec('0x2b')](_0x4129f6,_0x7fec('0x28'));_0x2e0b79[_0x7fec('0x2e')]=_['keys'](_0x28b491[_0x7fec('0x2e')]);_0x2e0b79['filters']=_[_0x7fec('0x2f')](_0x2e0b79[_0x7fec('0x2d')],_0x2e0b79[_0x7fec('0x2e')]);_0x5a7097[_0x7fec('0x30')]=_[_0x7fec('0x2f')](_0x2e0b79[_0x7fec('0x2d')],qs['fields'](_0x28b491['query'][_0x7fec('0x31')]));_0x5a7097[_0x7fec('0x30')]=_0x5a7097[_0x7fec('0x30')][_0x7fec('0x32')]?_0x5a7097[_0x7fec('0x30')]:_0x2e0b79['model'];if(!_0x28b491['query'][_0x7fec('0x33')](_0x7fec('0x34'))){_0x5a7097[_0x7fec('0x1c')]=qs['limit'](_0x28b491[_0x7fec('0x2e')][_0x7fec('0x1c')]);_0x5a7097[_0x7fec('0x1d')]=qs[_0x7fec('0x1d')](_0x28b491[_0x7fec('0x2e')][_0x7fec('0x1d')]);}_0x5a7097[_0x7fec('0x35')]=qs[_0x7fec('0x36')](_0x28b491[_0x7fec('0x2e')][_0x7fec('0x36')]);_0x5a7097[_0x7fec('0x37')]=qs['filters'](_['pick'](_0x28b491[_0x7fec('0x2e')],_0x2e0b79[_0x7fec('0x38')]),_0x4129f6);if(_0x28b491['query'][_0x7fec('0x39')]){_0x5a7097['where']=_[_0x7fec('0x3a')](_0x5a7097[_0x7fec('0x37')],{'$or':_[_0x7fec('0x2b')](_0x4129f6,function(_0x251960){if(_0x251960[_0x7fec('0x3b')]!=='VIRTUAL'){var _0x41a1a4={};_0x41a1a4[_0x251960[_0x7fec('0x28')]]={'$like':'%'+_0x28b491[_0x7fec('0x2e')]['filter']+'%'};return _0x41a1a4;}})});}_0x5a7097=_['merge']({},_0x5a7097,_0x28b491[_0x7fec('0x3c')]);var _0x2b5b61={'where':_0x5a7097[_0x7fec('0x37')]};return db[_0x7fec('0x2c')]['count'](_0x2b5b61)[_0x7fec('0x23')](function(_0x185537){_0x9b8427[_0x7fec('0x1e')]=_0x185537;if(_0x28b491['query']['includeAll']){_0x5a7097[_0x7fec('0x3d')]=[{'all':!![]}];}return db[_0x7fec('0x2c')][_0x7fec('0x3e')](_0x5a7097);})[_0x7fec('0x23')](function(_0x3759cd){_0x9b8427[_0x7fec('0x3f')]=_0x3759cd;return _0x9b8427;})[_0x7fec('0x23')](respondWithFilteredResult(_0x5dc91a,_0x5a7097))[_0x7fec('0x40')](handleError(_0x5dc91a,null));};exports[_0x7fec('0x41')]=function(_0x553118,_0x2969ff){var _0x5573e7={'raw':!![],'where':{'id':_0x553118[_0x7fec('0x42')]['id']}},_0x9fdc4b={};_0x9fdc4b[_0x7fec('0x2d')]=_[_0x7fec('0x43')](db[_0x7fec('0x2c')][_0x7fec('0x44')]);_0x9fdc4b[_0x7fec('0x2e')]=_[_0x7fec('0x43')](_0x553118[_0x7fec('0x2e')]);_0x9fdc4b[_0x7fec('0x38')]=_['intersection'](_0x9fdc4b[_0x7fec('0x2d')],_0x9fdc4b[_0x7fec('0x2e')]);_0x5573e7['attributes']=_[_0x7fec('0x2f')](_0x9fdc4b[_0x7fec('0x2d')],qs[_0x7fec('0x31')](_0x553118['query']['fields']));_0x5573e7[_0x7fec('0x30')]=_0x5573e7[_0x7fec('0x30')][_0x7fec('0x32')]?_0x5573e7[_0x7fec('0x30')]:_0x9fdc4b[_0x7fec('0x2d')];if(_0x553118[_0x7fec('0x2e')][_0x7fec('0x45')]){_0x5573e7['include']=[{'all':!![]}];}_0x5573e7=_[_0x7fec('0x3a')]({},_0x5573e7,_0x553118[_0x7fec('0x3c')]);return db[_0x7fec('0x2c')]['find'](_0x5573e7)[_0x7fec('0x23')](handleEntityNotFound(_0x2969ff,null))[_0x7fec('0x23')](respondWithResult(_0x2969ff,null))[_0x7fec('0x40')](handleError(_0x2969ff,null));};exports[_0x7fec('0x46')]=function(_0x24262b,_0x1c83cc){var _0x17ce0b={'where':{'id':_0x24262b[_0x7fec('0x42')]['id']}},_0x54b4a3={};_0x54b4a3[_0x7fec('0x2d')]=_[_0x7fec('0x43')](db[_0x7fec('0x2c')][_0x7fec('0x44')]);_0x17ce0b[_0x7fec('0x30')]=_['intersection'](_0x54b4a3[_0x7fec('0x2d')],qs['fields'](_0x24262b['query'][_0x7fec('0x31')]));_0x17ce0b['attributes']=_0x17ce0b[_0x7fec('0x30')][_0x7fec('0x32')]?_0x17ce0b['attributes']:_0x54b4a3[_0x7fec('0x2d')];if(_0x24262b[_0x7fec('0x2e')][_0x7fec('0x45')]){_0x17ce0b[_0x7fec('0x3d')]=[{'all':!![]}];}_0x17ce0b=_[_0x7fec('0x3a')]({},_0x17ce0b,_0x24262b[_0x7fec('0x3c')]);return db['Attachment'][_0x7fec('0x47')](_0x17ce0b)[_0x7fec('0x23')](handleEntityNotFound(_0x1c83cc,null))['then'](function(_0x31ab72){if(_0x31ab72){var _0x143470=_0x31ab72[_0x7fec('0x48')]({'plain':!![]});_0x143470=qs['omit'](_0x143470,['id',_0x7fec('0x49'),'updatedAt']);_0x24262b[_0x7fec('0x4a')]=_[_0x7fec('0x4b')](_0x24262b[_0x7fec('0x4a')],['id',_0x7fec('0x49'),_0x7fec('0x4c')]);return db[_0x7fec('0x2c')][_0x7fec('0x4d')](_[_0x7fec('0x3a')](_0x143470,_0x24262b[_0x7fec('0x4a')]),{'include':_0x24262b[_0x7fec('0x2e')][_0x7fec('0x45')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1c83cc,0xc9))['catch'](handleError(_0x1c83cc,null));};exports[_0x7fec('0x4e')]=function(_0x5a2dd9,_0x42cd6e){if(_0x5a2dd9[_0x7fec('0x4a')]['id']){delete _0x5a2dd9[_0x7fec('0x4a')]['id'];}return db[_0x7fec('0x2c')]['find']({'where':{'id':_0x5a2dd9[_0x7fec('0x42')]['id']}})[_0x7fec('0x23')](handleEntityNotFound(_0x42cd6e,null))[_0x7fec('0x23')](saveUpdates(_0x5a2dd9[_0x7fec('0x4a')],null))[_0x7fec('0x23')](respondWithResult(_0x42cd6e,null))['catch'](handleError(_0x42cd6e,null));};exports['destroy']=function(_0x5eeb57,_0x3e1165){return db[_0x7fec('0x2c')][_0x7fec('0x47')]({'where':{'id':_0x5eeb57[_0x7fec('0x42')]['id']}})[_0x7fec('0x23')](handleEntityNotFound(_0x3e1165,null))['then'](removeEntity(_0x3e1165,null))[_0x7fec('0x40')](handleError(_0x3e1165,null));};exports['create']=function(_0x15d539,_0x1abfe7,_0x452a81){_0x15d539[_0x7fec('0x4a')][_0x7fec('0x28')]=_0x15d539[_0x7fec('0x4f')][_0x7fec('0x50')];_0x15d539[_0x7fec('0x4a')][_0x7fec('0x51')]=_0x15d539['file']['filename'];_0x15d539['body'][_0x7fec('0x3b')]=_0x15d539['file'][_0x7fec('0x52')];return db[_0x7fec('0x2c')][_0x7fec('0x4d')](_0x15d539[_0x7fec('0x4a')])[_0x7fec('0x23')](respondWithResult(_0x1abfe7,0xc9))['catch'](handleError(_0x1abfe7,null));};exports['download']=function(_0x11361e,_0x1961f2,_0xda181b){return db[_0x7fec('0x2c')][_0x7fec('0x53')]({'where':{'id':_0x11361e['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1961f2,null))[_0x7fec('0x23')](function(_0x4ec5cb){if(_0x4ec5cb){var _0x373fe9=_0x4ec5cb['ChatOfflineMessageId']!==null;var _0x48e613=path[_0x7fec('0x54')](config[_0x7fec('0x55')],_0x7fec('0x56'));if(_0x373fe9){_0x48e613=path[_0x7fec('0x54')](_0x48e613,'offline-chat/');}var _0x59fe57=path[_0x7fec('0x54')](_0x48e613,_0x4ec5cb[_0x7fec('0x51')]);return _0x1961f2['download'](_0x59fe57);}})[_0x7fec('0x40')](handleError(_0x1961f2,null));}; \ No newline at end of file +var _0x0576=['mimetype','download','findOne','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','save','update','end','error','stack','name','send','index','map','Attachment','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','rows','show','rawAttributes','find','catch','clone','params','get','createdAt','body','omit','updatedAt','destroy','create','file','originalname','basename'];(function(_0x58ee96,_0x5affd5){var _0xb346aa=function(_0x245b1a){while(--_0x245b1a){_0x58ee96['push'](_0x58ee96['shift']());}};_0xb346aa(++_0x5affd5);}(_0x0576,0xb9));var _0x6057=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0576[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x6057('0x0'));var rimraf=require(_0x6057('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6057('0x2'));var moment=require('moment');var BPromise=require(_0x6057('0x3'));var Mustache=require(_0x6057('0x4'));var util=require(_0x6057('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6057('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6057('0x7'));var _=require(_0x6057('0x8'));var squel=require(_0x6057('0x9'));var crypto=require(_0x6057('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6057('0xb'));var toCsv=require(_0x6057('0x6'));var querystring=require(_0x6057('0xc'));var Papa=require(_0x6057('0xd'));var Redis=require(_0x6057('0xe'));var authService=require(_0x6057('0xf'));var qs=require(_0x6057('0x10'));var as=require(_0x6057('0x11'));var hardwareService=require(_0x6057('0x12'));var logger=require(_0x6057('0x13'))(_0x6057('0x14'));var utils=require(_0x6057('0x15'));var config=require(_0x6057('0x16'));var licenseUtil=require(_0x6057('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36edb4,_0x4b1b5a){_0x4b1b5a=_0x4b1b5a||0xcc;return function(_0x38cfdd){if(_0x38cfdd){return _0x36edb4[_0x6057('0x18')](_0x4b1b5a);}return _0x36edb4[_0x6057('0x19')](_0x4b1b5a)['end']();};}function respondWithResult(_0x23b35e,_0x1ff3d4){_0x1ff3d4=_0x1ff3d4||0xc8;return function(_0x253e61){if(_0x253e61){return _0x23b35e[_0x6057('0x19')](_0x1ff3d4)['json'](_0x253e61);}};}function respondWithFilteredResult(_0x48f7e2,_0x49e338){return function(_0x129a12){if(_0x129a12){var _0x5a3ec3=typeof _0x49e338[_0x6057('0x1a')]==='undefined'&&typeof _0x49e338[_0x6057('0x1b')]===_0x6057('0x1c');var _0x2e78a8=_0x129a12['count'];var _0x10c5e8=_0x5a3ec3?0x0:_0x49e338[_0x6057('0x1a')];var _0x54125e=_0x5a3ec3?_0x129a12[_0x6057('0x1d')]:_0x49e338[_0x6057('0x1a')]+_0x49e338[_0x6057('0x1b')];var _0x57926b;if(_0x54125e>=_0x2e78a8){_0x54125e=_0x2e78a8;_0x57926b=0xc8;}else{_0x57926b=0xce;}_0x48f7e2['status'](_0x57926b);return _0x48f7e2[_0x6057('0x1e')]('Content-Range',_0x10c5e8+'-'+_0x54125e+'/'+_0x2e78a8)[_0x6057('0x1f')](_0x129a12);}return null;};}function patchUpdates(_0x18658b){return function(_0x15e044){try{jsonpatch[_0x6057('0x20')](_0x15e044,_0x18658b,!![]);}catch(_0x14438f){return BPromise[_0x6057('0x21')](_0x14438f);}return _0x15e044[_0x6057('0x22')]();};}function saveUpdates(_0x437ac3,_0x2db8f3){return function(_0x4b957e){if(_0x4b957e){return _0x4b957e[_0x6057('0x23')](_0x437ac3)['then'](function(_0x49676e){return _0x49676e;});}return null;};}function removeEntity(_0x282e8c,_0x2873ae){return function(_0x270a68){if(_0x270a68){return _0x270a68['destroy']()['then'](function(){_0x282e8c[_0x6057('0x19')](0xcc)[_0x6057('0x24')]();});}};}function handleEntityNotFound(_0x1f8d5f,_0x4ff1b5){return function(_0x4d4688){if(!_0x4d4688){_0x1f8d5f[_0x6057('0x18')](0x194);}return _0x4d4688;};}function handleError(_0x239069,_0x344937){_0x344937=_0x344937||0x1f4;return function(_0x12a829){logger[_0x6057('0x25')](_0x12a829[_0x6057('0x26')]);if(_0x12a829[_0x6057('0x27')]){delete _0x12a829[_0x6057('0x27')];}_0x239069['status'](_0x344937)[_0x6057('0x28')](_0x12a829);};}exports[_0x6057('0x29')]=function(_0x2932a7,_0x11fb52){var _0x36fc6f={},_0x4fc7b5={},_0x22334c={'count':0x0,'rows':[]};var _0x58e3fe=_[_0x6057('0x2a')](db[_0x6057('0x2b')]['rawAttributes'],function(_0x3ffc4c){return{'name':_0x3ffc4c['fieldName'],'type':_0x3ffc4c[_0x6057('0x2c')]['key']};});_0x4fc7b5['model']=_[_0x6057('0x2a')](_0x58e3fe,_0x6057('0x27'));_0x4fc7b5[_0x6057('0x2d')]=_[_0x6057('0x2e')](_0x2932a7[_0x6057('0x2d')]);_0x4fc7b5[_0x6057('0x2f')]=_[_0x6057('0x30')](_0x4fc7b5['model'],_0x4fc7b5[_0x6057('0x2d')]);_0x36fc6f[_0x6057('0x31')]=_[_0x6057('0x30')](_0x4fc7b5[_0x6057('0x32')],qs[_0x6057('0x33')](_0x2932a7[_0x6057('0x2d')][_0x6057('0x33')]));_0x36fc6f[_0x6057('0x31')]=_0x36fc6f[_0x6057('0x31')][_0x6057('0x34')]?_0x36fc6f[_0x6057('0x31')]:_0x4fc7b5[_0x6057('0x32')];if(!_0x2932a7[_0x6057('0x2d')][_0x6057('0x35')]('nolimit')){_0x36fc6f[_0x6057('0x1b')]=qs['limit'](_0x2932a7['query'][_0x6057('0x1b')]);_0x36fc6f[_0x6057('0x1a')]=qs[_0x6057('0x1a')](_0x2932a7[_0x6057('0x2d')][_0x6057('0x1a')]);}_0x36fc6f[_0x6057('0x36')]=qs['sort'](_0x2932a7['query'][_0x6057('0x37')]);_0x36fc6f['where']=qs[_0x6057('0x2f')](_[_0x6057('0x38')](_0x2932a7[_0x6057('0x2d')],_0x4fc7b5[_0x6057('0x2f')]),_0x58e3fe);if(_0x2932a7[_0x6057('0x2d')][_0x6057('0x39')]){_0x36fc6f[_0x6057('0x3a')]=_[_0x6057('0x3b')](_0x36fc6f[_0x6057('0x3a')],{'$or':_[_0x6057('0x2a')](_0x58e3fe,function(_0x23050f){if(_0x23050f[_0x6057('0x2c')]!==_0x6057('0x3c')){var _0x184ee5={};_0x184ee5[_0x23050f['name']]={'$like':'%'+_0x2932a7[_0x6057('0x2d')][_0x6057('0x39')]+'%'};return _0x184ee5;}})});}_0x36fc6f=_[_0x6057('0x3b')]({},_0x36fc6f,_0x2932a7[_0x6057('0x3d')]);var _0x2022ad={'where':_0x36fc6f[_0x6057('0x3a')]};return db[_0x6057('0x2b')]['count'](_0x2022ad)[_0x6057('0x3e')](function(_0x24781c){_0x22334c[_0x6057('0x1d')]=_0x24781c;if(_0x2932a7[_0x6057('0x2d')][_0x6057('0x3f')]){_0x36fc6f[_0x6057('0x40')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x36fc6f);})['then'](function(_0x4d6308){_0x22334c[_0x6057('0x41')]=_0x4d6308;return _0x22334c;})[_0x6057('0x3e')](respondWithFilteredResult(_0x11fb52,_0x36fc6f))['catch'](handleError(_0x11fb52,null));};exports[_0x6057('0x42')]=function(_0x2b7afe,_0x2ab7be){var _0x480b97={'raw':!![],'where':{'id':_0x2b7afe['params']['id']}},_0x1ea408={};_0x1ea408[_0x6057('0x32')]=_[_0x6057('0x2e')](db[_0x6057('0x2b')][_0x6057('0x43')]);_0x1ea408[_0x6057('0x2d')]=_[_0x6057('0x2e')](_0x2b7afe[_0x6057('0x2d')]);_0x1ea408[_0x6057('0x2f')]=_['intersection'](_0x1ea408[_0x6057('0x32')],_0x1ea408['query']);_0x480b97[_0x6057('0x31')]=_[_0x6057('0x30')](_0x1ea408['model'],qs[_0x6057('0x33')](_0x2b7afe[_0x6057('0x2d')]['fields']));_0x480b97[_0x6057('0x31')]=_0x480b97[_0x6057('0x31')][_0x6057('0x34')]?_0x480b97[_0x6057('0x31')]:_0x1ea408[_0x6057('0x32')];if(_0x2b7afe[_0x6057('0x2d')]['includeAll']){_0x480b97[_0x6057('0x40')]=[{'all':!![]}];}_0x480b97=_['merge']({},_0x480b97,_0x2b7afe[_0x6057('0x3d')]);return db['Attachment'][_0x6057('0x44')](_0x480b97)['then'](handleEntityNotFound(_0x2ab7be,null))[_0x6057('0x3e')](respondWithResult(_0x2ab7be,null))[_0x6057('0x45')](handleError(_0x2ab7be,null));};exports[_0x6057('0x46')]=function(_0x39c332,_0x1e3cf3){var _0x4adbf9={'where':{'id':_0x39c332[_0x6057('0x47')]['id']}},_0x4f4131={};_0x4f4131['model']=_[_0x6057('0x2e')](db['Attachment'][_0x6057('0x43')]);_0x4adbf9['attributes']=_[_0x6057('0x30')](_0x4f4131['model'],qs['fields'](_0x39c332[_0x6057('0x2d')][_0x6057('0x33')]));_0x4adbf9[_0x6057('0x31')]=_0x4adbf9['attributes'][_0x6057('0x34')]?_0x4adbf9[_0x6057('0x31')]:_0x4f4131[_0x6057('0x32')];if(_0x39c332['query'][_0x6057('0x3f')]){_0x4adbf9['include']=[{'all':!![]}];}_0x4adbf9=_[_0x6057('0x3b')]({},_0x4adbf9,_0x39c332['options']);return db['Attachment'][_0x6057('0x44')](_0x4adbf9)[_0x6057('0x3e')](handleEntityNotFound(_0x1e3cf3,null))[_0x6057('0x3e')](function(_0x2412ac){if(_0x2412ac){var _0x543bc0=_0x2412ac[_0x6057('0x48')]({'plain':!![]});_0x543bc0=qs['omit'](_0x543bc0,['id',_0x6057('0x49'),'updatedAt']);_0x39c332[_0x6057('0x4a')]=_[_0x6057('0x4b')](_0x39c332[_0x6057('0x4a')],['id',_0x6057('0x49'),_0x6057('0x4c')]);return db['Attachment']['create'](_[_0x6057('0x3b')](_0x543bc0,_0x39c332[_0x6057('0x4a')]),{'include':_0x39c332[_0x6057('0x2d')][_0x6057('0x3f')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1e3cf3,0xc9))[_0x6057('0x45')](handleError(_0x1e3cf3,null));};exports['update']=function(_0x1e6cbf,_0x3ee262){if(_0x1e6cbf['body']['id']){delete _0x1e6cbf[_0x6057('0x4a')]['id'];}return db[_0x6057('0x2b')][_0x6057('0x44')]({'where':{'id':_0x1e6cbf[_0x6057('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ee262,null))[_0x6057('0x3e')](saveUpdates(_0x1e6cbf[_0x6057('0x4a')],null))['then'](respondWithResult(_0x3ee262,null))[_0x6057('0x45')](handleError(_0x3ee262,null));};exports[_0x6057('0x4d')]=function(_0x361a26,_0x17ea3b){return db[_0x6057('0x2b')]['find']({'where':{'id':_0x361a26['params']['id']}})['then'](handleEntityNotFound(_0x17ea3b,null))[_0x6057('0x3e')](removeEntity(_0x17ea3b,null))[_0x6057('0x45')](handleError(_0x17ea3b,null));};exports[_0x6057('0x4e')]=function(_0x46c34f,_0x45812a,_0x2f6b2e){_0x46c34f[_0x6057('0x4a')][_0x6057('0x27')]=_0x46c34f[_0x6057('0x4f')][_0x6057('0x50')];_0x46c34f['body'][_0x6057('0x51')]=_0x46c34f[_0x6057('0x4f')]['filename'];_0x46c34f['body']['type']=_0x46c34f[_0x6057('0x4f')][_0x6057('0x52')];return db[_0x6057('0x2b')][_0x6057('0x4e')](_0x46c34f['body'])[_0x6057('0x3e')](respondWithResult(_0x45812a,0xc9))['catch'](handleError(_0x45812a,null));};exports[_0x6057('0x53')]=function(_0x229869,_0x44beda,_0x302f39){return db[_0x6057('0x2b')][_0x6057('0x54')]({'where':{'id':_0x229869[_0x6057('0x47')]['id']},'raw':!![]})[_0x6057('0x3e')](handleEntityNotFound(_0x44beda,null))['then'](function(_0x4c949e){if(_0x4c949e){var _0x10a58f=_0x4c949e['ChatOfflineMessageId']!==null;var _0x6ff088=path[_0x6057('0x55')](config[_0x6057('0x56')],_0x6057('0x57'));if(_0x10a58f){_0x6ff088=path[_0x6057('0x55')](_0x6ff088,_0x6057('0x58'));}var _0x58e0c8=path[_0x6057('0x55')](_0x6ff088,_0x4c949e[_0x6057('0x51')]);return _0x44beda[_0x6057('0x53')](_0x58e0c8);}})[_0x6057('0x45')](handleError(_0x44beda,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5c63111..cee48a6 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 _0x6d1c=['rimraf','../../config/environment','./attachment.attributes','exports','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x126026,_0x19498c){var _0x57de09=function(_0x526589){while(--_0x526589){_0x126026['push'](_0x126026['shift']());}};_0x57de09(++_0x19498c);}(_0x6d1c,0x185));var _0xc6d1=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x6d1c[_0x27bd2c];return _0x3784ea;};'use strict';var _=require(_0xc6d1('0x0'));var util=require('util');var logger=require(_0xc6d1('0x1'))(_0xc6d1('0x2'));var moment=require(_0xc6d1('0x3'));var BPromise=require(_0xc6d1('0x4'));var rp=require(_0xc6d1('0x5'));var fs=require('fs');var path=require(_0xc6d1('0x6'));var rimraf=require(_0xc6d1('0x7'));var config=require(_0xc6d1('0x8'));var attributes=require(_0xc6d1('0x9'));module[_0xc6d1('0xa')]=function(_0x553757,_0x2f13d3){return _0x553757['define']('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaae1=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define','lodash'];(function(_0x44c78b,_0x1b8998){var _0x38f72a=function(_0x3354a0){while(--_0x3354a0){_0x44c78b['push'](_0x44c78b['shift']());}};_0x38f72a(++_0x1b8998);}(_0xaae1,0x17f));var _0x1aae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaae1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1aae('0x0'));var util=require(_0x1aae('0x1'));var logger=require(_0x1aae('0x2'))(_0x1aae('0x3'));var moment=require(_0x1aae('0x4'));var BPromise=require(_0x1aae('0x5'));var rp=require(_0x1aae('0x6'));var fs=require('fs');var path=require(_0x1aae('0x7'));var rimraf=require(_0x1aae('0x8'));var config=require(_0x1aae('0x9'));var attributes=require(_0x1aae('0xa'));module['exports']=function(_0x4035e5,_0x446d9e){return _0x4035e5[_0x1aae('0xb')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index f2c8d5d..147b4e0 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 _0x39cb=['message','result','catch','CreateAttachment','Attachment','create','body','options','raw','debug','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Attachment,\x20%s,\x20%s'];(function(_0x3835f0,_0x415627){var _0x1d727a=function(_0x122ff2){while(--_0x122ff2){_0x3835f0['push'](_0x3835f0['shift']());}};_0x1d727a(++_0x415627);}(_0x39cb,0x1bd));var _0xb39c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x39cb[_0x4b369d];return _0x571a98;};'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')]('Attachment,\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);});});}exports[_0xb39c('0x16')]=function(_0x4e02cf){var _0x35dade=this;return new Promise(function(_0x2eeae6,_0x559ad6){return db[_0xb39c('0x17')][_0xb39c('0x18')](_0x4e02cf[_0xb39c('0x19')],{'raw':_0x4e02cf[_0xb39c('0x1a')]?_0x4e02cf['options'][_0xb39c('0x1b')]===undefined?!![]:![]:!![]})[_0xb39c('0xb')](function(_0x5e4a0b){logger[_0xb39c('0xc')](_0xb39c('0x16'),_0x4e02cf);logger[_0xb39c('0x1c')]('CreateAttachment',_0x4e02cf,JSON['stringify'](_0x5e4a0b));_0x2eeae6(_0x5e4a0b);})[_0xb39c('0x15')](function(_0x1a5b9d){logger[_0xb39c('0x10')]('CreateAttachment',_0x1a5b9d[_0xb39c('0x13')],_0x4e02cf);_0x559ad6(_0x35dade[_0xb39c('0x10')](0x1f4,_0x1a5b9d[_0xb39c('0x13')]));});});}; \ No newline at end of file +var _0xe2cc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','create','body','raw','then','lodash','util','randomstring'];(function(_0x18d40c,_0xea7cc1){var _0x104e38=function(_0x2ea9b1){while(--_0x2ea9b1){_0x18d40c['push'](_0x18d40c['shift']());}};_0x104e38(++_0xea7cc1);}(_0xe2cc,0x69));var _0xce2c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xe2cc[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xce2c('0x2'));var fs=require('fs');var Redis=require(_0xce2c('0x3'));var db=require(_0xce2c('0x4'))['db'];var utils=require(_0xce2c('0x5'));var logger=require(_0xce2c('0x6'))(_0xce2c('0x7'));var config=require(_0xce2c('0x8'));var jayson=require(_0xce2c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14bb4e,_0x14b502,_0x23f678){return new BPromise(function(_0x29632b,_0x2ce69f){return client[_0xce2c('0xa')](_0x14bb4e,_0x23f678)['then'](function(_0x2f7d44){logger[_0xce2c('0xb')](_0xce2c('0xc'),_0x14b502,_0xce2c('0xd'));logger[_0xce2c('0xe')](_0xce2c('0xf'),_0x14b502,_0xce2c('0xd'),JSON[_0xce2c('0x10')](_0x2f7d44));if(_0x2f7d44[_0xce2c('0x11')]){if(_0x2f7d44[_0xce2c('0x11')][_0xce2c('0x12')]===0x1f4){logger[_0xce2c('0x11')](_0xce2c('0xc'),_0x14b502,_0x2f7d44[_0xce2c('0x11')][_0xce2c('0x13')]);return _0x2ce69f(_0x2f7d44['error']['message']);}logger[_0xce2c('0x11')]('Attachment,\x20%s,\x20%s',_0x14b502,_0x2f7d44[_0xce2c('0x11')][_0xce2c('0x13')]);return _0x29632b(_0x2f7d44[_0xce2c('0x11')][_0xce2c('0x13')]);}else{logger['info'](_0xce2c('0xc'),_0x14b502,_0xce2c('0xd'));_0x29632b(_0x2f7d44[_0xce2c('0x14')][_0xce2c('0x13')]);}})[_0xce2c('0x15')](function(_0x35136f){logger[_0xce2c('0x11')]('Attachment,\x20%s,\x20%s',_0x14b502,_0x35136f);_0x2ce69f(_0x35136f);});});}exports[_0xce2c('0x16')]=function(_0x35bc08){var _0x383085=this;return new Promise(function(_0x151422,_0x24537f){return db['Attachment'][_0xce2c('0x17')](_0x35bc08[_0xce2c('0x18')],{'raw':_0x35bc08['options']?_0x35bc08['options'][_0xce2c('0x19')]===undefined?!![]:![]:!![]})[_0xce2c('0x1a')](function(_0x43ee21){logger[_0xce2c('0xb')](_0xce2c('0x16'),_0x35bc08);logger[_0xce2c('0xe')](_0xce2c('0x16'),_0x35bc08,JSON['stringify'](_0x43ee21));_0x151422(_0x43ee21);})[_0xce2c('0x15')](function(_0xb8057b){logger[_0xce2c('0x11')](_0xce2c('0x16'),_0xb8057b[_0xce2c('0x13')],_0x35bc08);_0x24537f(_0x383085[_0xce2c('0x11')](0x1f4,_0xb8057b[_0xce2c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5897bf5..7ef57bd 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0xf6b163,_0x520e2e){var _0x55fc52=function(_0x55e0de){while(--_0x55e0de){_0xf6b163['push'](_0xf6b163['shift']());}};_0x55fc52(++_0x520e2e);}(_0xadb5,0xad));var _0x5adb=function(_0x30c1c4,_0x4f9952){_0x30c1c4=_0x30c1c4-0x0;var _0x41ddf8=_0xadb5[_0x30c1c4];return _0x41ddf8;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb28,0x106));var _0x8db2=function(_0xe4df14,_0x2b32ae){_0xe4df14=_0xe4df14-0x0;var _0x27222f=_0xdb28[_0xe4df14];return _0x27222f;};'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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index f968162..aa0b73f 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 _0x07b8=['clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','password','passport','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','salt','role','disabled','blockedAt','online','user','agent','name','domain'];(function(_0xd6ccdc,_0x23b167){var _0x1eac6d=function(_0x198a14){while(--_0x198a14){_0xd6ccdc['push'](_0xd6ccdc['shift']());}};_0x1eac6d(++_0x23b167);}(_0x07b8,0x183));var _0x807b=function(_0x255caf,_0x2f893b){_0x255caf=_0x255caf-0x0;var _0x25e862=_0x07b8[_0x255caf];return _0x25e862;};'use strict';var passport=require(_0x807b('0x0'));var LocalStrategy=require('passport-local')[_0x807b('0x1')];var moment=require(_0x807b('0x2'));var ActiveDirectory=require(_0x807b('0x3'));var BPromise=require(_0x807b('0x4'));var util=require(_0x807b('0x5'));var db=require(_0x807b('0x6'))['db'];var authService=require(_0x807b('0x7'));var utils=require('../../config/utils');var config=require(_0x807b('0x8'));var logger=require(_0x807b('0x9'))(_0x807b('0xa'));function isActiveDirectoryConfigured(_0x550aa5){var _0x20cbe6=![];if(typeof _0x550aa5[_0x807b('0xb')]!==_0x807b('0xc')){_0x20cbe6=_0x550aa5[_0x807b('0xb')][_0x807b('0xd')]&&_0x550aa5[_0x807b('0xb')][_0x807b('0xe')]&&_0x550aa5[_0x807b('0xb')]['domain'];}return _0x20cbe6;}function adAuthenticate(_0x7d8ad1,_0x271b12,_0xb7deab){return new BPromise(function(_0x3c1a74,_0x288c6d){try{var _0x30efed=new ActiveDirectory(_0x7d8ad1);_0x30efed['authenticate'](_0x271b12,_0xb7deab,function(_0x80025c,_0x5edc00){if(_0x80025c){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x271b12,util[_0x807b('0xf')](_0x80025c,{'showHidden':![],'depth':null}));_0x288c6d(_0x807b('0x10'));}else if(!_0x5edc00){logger[_0x807b('0x11')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x271b12);_0x288c6d(_0x807b('0x10'));}else{_0x3c1a74(_0x5edc00);}});}catch(_0x240fa0){_0x288c6d(_0x240fa0);}});}function ActiveDirectoryAuthenticate(_0x4137d9,_0x577452,_0x578859,_0x111122){var _0x2a193c,_0x547b69;if(!isActiveDirectoryConfigured(config)){logger[_0x807b('0x11')](_0x807b('0x12'),_0x577452);return _0x111122(null,![],{'message':_0x807b('0x10')});}return db[_0x807b('0x13')][_0x807b('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x807b('0x15')],'raw':!![]})[_0x807b('0x16')](function(_0x39be02){_0x2a193c=_0x39be02;if(!_0x2a193c['adSsoEnabled']){logger[_0x807b('0x11')](_0x807b('0x17'),_0x577452);throw new Error(_0x807b('0x10'));}return _0x4137d9['findOne']({'logging':!![],'attributes':['id','name','password',_0x807b('0x18'),_0x807b('0x19'),_0x807b('0x1a'),'blocked',_0x807b('0x1b'),_0x807b('0x1c')],'where':{'name':_0x577452,'role':{'$or':['admin',_0x807b('0x1d'),_0x807b('0x1e')]},'adSsoEnabled':!![]}});})[_0x807b('0x16')](function(_0xc0fc0d){if(!_0xc0fc0d||_0xc0fc0d&&_0xc0fc0d[_0x807b('0x1f')]!==_0x577452){throw new Error(_0x807b('0x10'));}_0x547b69=_0xc0fc0d;var _0x399cbd=_0x547b69[_0x807b('0x1f')]+'@'+config['activedirectory'][_0x807b('0x20')];return adAuthenticate(config[_0x807b('0xb')],_0x399cbd,_0x578859);})[_0x807b('0x16')](function(_0x4eca2c){if(_0x547b69[_0x807b('0x1a')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x2a193c[_0x807b('0x15')]>0x0){if(_0x547b69['blocked']){if(moment(_0x547b69[_0x807b('0x1b')])['add'](_0x2a193c[_0x807b('0x15')],'minutes')>moment()){throw new Error(_0x807b('0x10'));}return utils[_0x807b('0x21')](_0x547b69,0x0,![],null)['then'](function(){return utils[_0x807b('0x22')](_0x547b69);})[_0x807b('0x16')](function(){return _0x111122(null,_0x547b69);});}else{return utils[_0x807b('0x22')](_0x547b69)[_0x807b('0x16')](function(){return _0x111122(null,_0x547b69);});}}else{return utils[_0x807b('0x22')](_0x547b69)[_0x807b('0x16')](function(){return _0x111122(null,_0x547b69);});}})['catch'](function(_0x3d6889){return _0x111122(null,![],_0x3d6889);});}function handleError(_0x2931f1,_0x3d4e3a,_0x43817d){return _0x2931f1[_0x807b('0x23')](_0x3d4e3a||0x1f4)[_0x807b('0x24')]({'message':_0x43817d?_0x43817d[_0x807b('0x25')]||_0x43817d:''});}exports[_0x807b('0x26')]=function(_0x57ed4b,_0x574891,_0x5ec5a7){passport['authenticate'](_0x807b('0x27'),function(_0x5569b9,_0x1a6de4,_0x52f8a8){var _0x1c2677=_0x5569b9||_0x52f8a8;if(_0x1c2677){return handleError(_0x574891,0x191,_0x1c2677);}if(!_0x1a6de4){return handleError(_0x574891,0x194,{'message':_0x807b('0x28')});}else{var _0x5ee722={'payload':{'id':_0x1a6de4['id'],'role':_0x1a6de4['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5ee722)['then'](function(_0x158f6a){_0x574891['json']({'id':_0x1a6de4['id'],'token':_0x158f6a,'statusCall':'','isAlreadyLogged':_0x1a6de4[_0x807b('0x1c')]});});}})(_0x57ed4b,_0x574891,_0x5ec5a7);};passport['use'](_0x807b('0x27'),new LocalStrategy({'usernameField':_0x807b('0x1f'),'passwordField':_0x807b('0x29')},function(_0x44df6b,_0x1e3176,_0xbd5052){return ActiveDirectoryAuthenticate(db['User'],_0x44df6b,_0x1e3176,_0xbd5052);})); \ No newline at end of file +var _0x2903=['util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','authenticate','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','salt','role','blocked','blockedAt','online','admin','agent','then','name','domain','disabled','blockDuration','add','clearBlockUser','getLicense','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','password','User','passport','passport-local','Strategy','moment','bluebird'];(function(_0x23597f,_0x1e34ac){var _0x237f67=function(_0x46f9b8){while(--_0x46f9b8){_0x23597f['push'](_0x23597f['shift']());}};_0x237f67(++_0x1e34ac);}(_0x2903,0xbf));var _0x3290=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x2903[_0x2070da];return _0x4f9fe1;};'use strict';var passport=require(_0x3290('0x0'));var LocalStrategy=require(_0x3290('0x1'))[_0x3290('0x2')];var moment=require(_0x3290('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x3290('0x4'));var util=require(_0x3290('0x5'));var db=require(_0x3290('0x6'))['db'];var authService=require(_0x3290('0x7'));var utils=require(_0x3290('0x8'));var config=require(_0x3290('0x9'));var logger=require('../../config/logger')(_0x3290('0xa'));function isActiveDirectoryConfigured(_0x3afd7f){var _0x1915bd=![];if(typeof _0x3afd7f[_0x3290('0xb')]!==_0x3290('0xc')){_0x1915bd=_0x3afd7f[_0x3290('0xb')][_0x3290('0xd')]&&_0x3afd7f['activedirectory'][_0x3290('0xe')]&&_0x3afd7f[_0x3290('0xb')]['domain'];}return _0x1915bd;}function adAuthenticate(_0x347aa1,_0x462c69,_0x2cfc57){return new BPromise(function(_0x33ed6c,_0x514406){try{var _0x1a8bf5=new ActiveDirectory(_0x347aa1);_0x1a8bf5[_0x3290('0xf')](_0x462c69,_0x2cfc57,function(_0x209077,_0x3363e8){if(_0x209077){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x462c69,util[_0x3290('0x10')](_0x209077,{'showHidden':![],'depth':null}));_0x514406('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x3363e8){logger['error'](_0x3290('0x11'),_0x462c69);_0x514406(_0x3290('0x12'));}else{_0x33ed6c(_0x3363e8);}});}catch(_0x55ccc8){_0x514406(_0x55ccc8);}});}function ActiveDirectoryAuthenticate(_0x36957e,_0x126ae6,_0x5c934f,_0xa56605){var _0x5dab15,_0x3d391c;if(!isActiveDirectoryConfigured(config)){logger[_0x3290('0x13')](_0x3290('0x14'),_0x126ae6);return _0xa56605(null,![],{'message':_0x3290('0x12')});}return db[_0x3290('0x15')][_0x3290('0x16')]({'where':{'id':0x1},'attributes':[_0x3290('0x17'),'blockDuration'],'raw':!![]})['then'](function(_0x336dc2){_0x5dab15=_0x336dc2;if(!_0x5dab15[_0x3290('0x17')]){logger['error'](_0x3290('0x18'),_0x126ae6);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x36957e[_0x3290('0x16')]({'logging':!![],'attributes':['id','name','password',_0x3290('0x19'),_0x3290('0x1a'),'disabled',_0x3290('0x1b'),_0x3290('0x1c'),_0x3290('0x1d')],'where':{'name':_0x126ae6,'role':{'$or':[_0x3290('0x1e'),'user',_0x3290('0x1f')]},'adSsoEnabled':!![]}});})[_0x3290('0x20')](function(_0x5c899e){if(!_0x5c899e||_0x5c899e&&_0x5c899e['name']!==_0x126ae6){throw new Error(_0x3290('0x12'));}_0x3d391c=_0x5c899e;var _0x20b99c=_0x3d391c[_0x3290('0x21')]+'@'+config[_0x3290('0xb')][_0x3290('0x22')];return adAuthenticate(config[_0x3290('0xb')],_0x20b99c,_0x5c934f);})['then'](function(_0x7b93aa){if(_0x3d391c[_0x3290('0x23')]){throw new Error(_0x3290('0x12'));}if(_0x5dab15[_0x3290('0x24')]>0x0){if(_0x3d391c['blocked']){if(moment(_0x3d391c[_0x3290('0x1c')])[_0x3290('0x25')](_0x5dab15[_0x3290('0x24')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x3290('0x26')](_0x3d391c,0x0,![],null)[_0x3290('0x20')](function(){return utils[_0x3290('0x27')](_0x3d391c);})[_0x3290('0x20')](function(){return _0xa56605(null,_0x3d391c);});}else{return utils['getLicense'](_0x3d391c)[_0x3290('0x20')](function(){return _0xa56605(null,_0x3d391c);});}}else{return utils[_0x3290('0x27')](_0x3d391c)[_0x3290('0x20')](function(){return _0xa56605(null,_0x3d391c);});}})['catch'](function(_0x5c2c3c){return _0xa56605(null,![],_0x5c2c3c);});}function handleError(_0x1da19b,_0x213d41,_0x2550d7){return _0x1da19b[_0x3290('0x28')](_0x213d41||0x1f4)['send']({'message':_0x2550d7?_0x2550d7[_0x3290('0x29')]||_0x2550d7:''});}exports[_0x3290('0x2a')]=function(_0x58143a,_0xf730d2,_0x519b34){passport[_0x3290('0xf')](_0x3290('0x2b'),function(_0x48e8be,_0x1148c7,_0x7fdedd){var _0x4d496c=_0x48e8be||_0x7fdedd;if(_0x4d496c){return handleError(_0xf730d2,0x191,_0x4d496c);}if(!_0x1148c7){return handleError(_0xf730d2,0x194,{'message':_0x3290('0x2c')});}else{var _0x3211c9={'payload':{'id':_0x1148c7['id'],'role':_0x1148c7[_0x3290('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x3290('0x2d')](_0x3211c9)['then'](function(_0x166172){_0xf730d2['json']({'id':_0x1148c7['id'],'token':_0x166172,'statusCall':'','isAlreadyLogged':_0x1148c7[_0x3290('0x1d')]});});}})(_0x58143a,_0xf730d2,_0x519b34);};passport[_0x3290('0x2e')](_0x3290('0x2b'),new LocalStrategy({'usernameField':_0x3290('0x21'),'passwordField':_0x3290('0x2f')},function(_0xd24617,_0x1c55dd,_0x43f44){return ActiveDirectoryAuthenticate(db[_0x3290('0x30')],_0xd24617,_0x1c55dd,_0x43f44);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index fc7c453..ad6b712 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 _0xcc1b=['exports','express','Router','./authActiveDirectory.controller','post','login'];(function(_0x1ea092,_0x448c9e){var _0xd259ea=function(_0x2f059f){while(--_0x2f059f){_0x1ea092['push'](_0x1ea092['shift']());}};_0xd259ea(++_0x448c9e);}(_0xcc1b,0xfd));var _0xbcc1=function(_0x32a337,_0x5a776){_0x32a337=_0x32a337-0x0;var _0x23730f=_0xcc1b[_0x32a337];return _0x23730f;};'use strict';var express=require(_0xbcc1('0x0'));var router=express[_0xbcc1('0x1')]();var controller=require(_0xbcc1('0x2'));router[_0xbcc1('0x3')]('/',controller[_0xbcc1('0x4')]);module[_0xbcc1('0x5')]=router; \ No newline at end of file +var _0x93af=['express','Router','./authActiveDirectory.controller','post'];(function(_0x44c583,_0xdc4d48){var _0x396a41=function(_0x1f3e0d){while(--_0x1f3e0d){_0x44c583['push'](_0x44c583['shift']());}};_0x396a41(++_0xdc4d48);}(_0x93af,0x64));var _0xf93a=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x93af[_0x3cbe1c];return _0x5ee08b;};'use strict';var express=require(_0xf93a('0x0'));var router=express[_0xf93a('0x1')]();var controller=require(_0xf93a('0x2'));router[_0xf93a('0x3')]('/',controller['login']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 7d2105c..35106ef 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(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x7a54,0x106));var _0x47a5=function(_0x463d05,_0x48fafe){_0x463d05=_0x463d05-0x0;var _0x2d4014=_0x7a54[_0x463d05];return _0x2d4014;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7a54,0x106));var _0x47a5=function(_0x3100af,_0x752fb6){_0x3100af=_0x3100af-0x0;var _0xdfecbb=_0x7a54[_0x3100af];return _0xdfecbb;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index fac00a4..ab84ce8 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 _0x66ad=['exports','express','passport','./authGoogle.controller','../user/user.controller.js','get','/callback','callback','login'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x66ad,0x12a));var _0xd66a=function(_0x102147,_0x170d81){_0x102147=_0x102147-0x0;var _0x5e2d52=_0x66ad[_0x102147];return _0x5e2d52;};'use strict';var express=require(_0xd66a('0x0'));var passport=require(_0xd66a('0x1'));var router=express['Router']();var controller=require(_0xd66a('0x2'));var userController=require(_0xd66a('0x3'));var authService=require('../../components/auth/service');router[_0xd66a('0x4')]('/',controller['login']);router[_0xd66a('0x4')](_0xd66a('0x5'),controller[_0xd66a('0x6')],authService['isMiddleware'],userController[_0xd66a('0x7')],authService['setTokenCookie']);module[_0xd66a('0x8')]=router; \ No newline at end of file +var _0x77b4=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','exports','passport'];(function(_0x3b9060,_0x3a34af){var _0x25fdc9=function(_0x4054fd){while(--_0x4054fd){_0x3b9060['push'](_0x3b9060['shift']());}};_0x25fdc9(++_0x3a34af);}(_0x77b4,0x11d));var _0x477b=function(_0x1b7a80,_0x4d00eb){_0x1b7a80=_0x1b7a80-0x0;var _0x28c802=_0x77b4[_0x1b7a80];return _0x28c802;};'use strict';var express=require('express');var passport=require(_0x477b('0x0'));var router=express[_0x477b('0x1')]();var controller=require(_0x477b('0x2'));var userController=require(_0x477b('0x3'));var authService=require(_0x477b('0x4'));router[_0x477b('0x5')]('/',controller[_0x477b('0x6')]);router['get'](_0x477b('0x7'),controller[_0x477b('0x8')],authService[_0x477b('0x9')],userController[_0x477b('0x6')],authService['setTokenCookie']);module[_0x477b('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 85984b1..676029c 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 _0x9cac=['minutes','clearBlockUser','blocked','getLicense','catch','find','email','Smtp','CloudProvider','\x22%s\x22\x20<%s>','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','message','local-login','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.','resetPasswordToken','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://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','User','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','password','Password\x20reset!','use','util','passport','Strategy','lodash','randomstring','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts','then','salt','blockedAt','loginAttempts','admin','user','agent','name','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','add'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0x9cac,0x82));var _0xc9ca=function(_0x515062,_0x3610b1){_0x515062=_0x515062-0x0;var _0x5cc7f3=_0x9cac[_0x515062];return _0x5cc7f3;};'use strict';var util=require(_0xc9ca('0x0'));var passport=require(_0xc9ca('0x1'));var LocalStrategy=require('passport-local')[_0xc9ca('0x2')];var jayson=require('jayson/promise');var _=require(_0xc9ca('0x3'));var rs=require(_0xc9ca('0x4'));var moment=require('moment');var db=require(_0xc9ca('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc9ca('0x6'));var client=jayson[_0xc9ca('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x43754a,_0x325659,_0x52426f,_0x457b91){var _0x1ba25b,_0x5335a9;return db[_0xc9ca('0x8')][_0xc9ca('0x9')]({'where':{'id':0x1},'attributes':[_0xc9ca('0xa'),'blockDuration'],'raw':!![]})[_0xc9ca('0xb')](function(_0x88ac31){_0x1ba25b=_0x88ac31;return _0x43754a[_0xc9ca('0x9')]({'attributes':['id','name','password',_0xc9ca('0xc'),'role','disabled','blocked',_0xc9ca('0xd'),_0xc9ca('0xe')],'where':{'name':_0x325659,'role':{'$or':[_0xc9ca('0xf'),_0xc9ca('0x10'),_0xc9ca('0x11')]}}});})['then'](function(_0xdcd2c8){if(!_0xdcd2c8||_0xdcd2c8&&_0xdcd2c8[_0xc9ca('0x12')]!==_0x325659){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5335a9=_0xdcd2c8;return _0x5335a9;}})['then'](function(){_0x5335a9[_0xc9ca('0x13')](_0x52426f,function(_0x3e20c5,_0x59db1a){var _0x2b88ad=_0x5335a9[_0xc9ca('0xe')]+0x1;if(_0x3e20c5){return _0x457b91(_0x3e20c5);}else if(!_0x59db1a){if(_0x5335a9[_0xc9ca('0x14')]){return _0x457b91(null,![],{'message':_0xc9ca('0x15')});}else if(_0x1ba25b[_0xc9ca('0xa')]>0x0){if(_0x5335a9['blocked']){if(_0x1ba25b[_0xc9ca('0x16')]>0x0){if(moment(_0x5335a9[_0xc9ca('0xd')])[_0xc9ca('0x17')](_0x1ba25b['blockDuration'],_0xc9ca('0x18'))>moment()){return _0x457b91(null,![],{'message':_0xc9ca('0x15')});}else{return utils[_0xc9ca('0x19')](_0x5335a9,_0x2b88ad,![],null)[_0xc9ca('0xb')](function(){return _0x457b91(null,![],{'message':_0xc9ca('0x15')});});}}else{return _0x457b91(null,![],{'message':_0xc9ca('0x15')});}}else{if(_0x2b88ad>=_0x1ba25b['allowedLoginAttempts']){return utils[_0xc9ca('0x19')](_0x5335a9,0x0,!![],moment())[_0xc9ca('0xb')](function(){return _0x457b91(null,![],{'message':_0xc9ca('0x15')});});}else{return utils[_0xc9ca('0x19')](_0x5335a9,_0x2b88ad,![],null)[_0xc9ca('0xb')](function(){return _0x457b91(null,![],{'message':_0xc9ca('0x15')});});}}}else{return _0x457b91(null,![],{'message':_0xc9ca('0x15')});}}else{if(_0x5335a9[_0xc9ca('0x14')]){return _0x457b91(null,![],{'message':_0xc9ca('0x15')});}else if(_0x1ba25b[_0xc9ca('0xa')]>0x0){if(_0x5335a9[_0xc9ca('0x1a')]){if(_0x1ba25b[_0xc9ca('0x16')]>0x0){if(moment(_0x5335a9['blockedAt'])[_0xc9ca('0x17')](_0x1ba25b[_0xc9ca('0x16')],_0xc9ca('0x18'))>moment()){return _0x457b91(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x5335a9,0x0,![],null)[_0xc9ca('0xb')](function(){return utils[_0xc9ca('0x1b')](_0x5335a9);})[_0xc9ca('0xb')](function(){return _0x457b91(null,_0x5335a9);});}}else{return _0x457b91(null,![],{'message':_0xc9ca('0x15')});}}else{return utils[_0xc9ca('0x19')](_0x5335a9,0x0,![],null)[_0xc9ca('0xb')](function(){return utils[_0xc9ca('0x1b')](_0x5335a9);})[_0xc9ca('0xb')](function(){return _0x457b91(null,_0x5335a9);})[_0xc9ca('0x1c')](function(_0x3ca059){return _0x457b91(null,![],_0x3ca059);});}}else{if(_0x5335a9[_0xc9ca('0x1a')]){return _0x457b91(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc9ca('0x1b')](_0x5335a9)[_0xc9ca('0xb')](function(){return _0x457b91(null,_0x5335a9);});}}}});})[_0xc9ca('0x1c')](function(_0x3c66e6){return _0x457b91(null,![],_0x3c66e6);});}function sendServiceMail(_0x3008bb){return db['MailAccount'][_0xc9ca('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xc9ca('0x12'),_0xc9ca('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0xc9ca('0x1f'),'include':[{'model':db['CloudProvider'],'as':_0xc9ca('0x20')}]}]})[_0xc9ca('0xb')](function(_0x2d0d1d){if(!_0x2d0d1d){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5d2b62=_0x2d0d1d['getSmtpOptions']();var _0x493a92={'account':_0x5d2b62,'message':_['merge']({'from':util['format'](_0xc9ca('0x21'),_0x2d0d1d[_0xc9ca('0x12')],_0x2d0d1d[_0xc9ca('0x1e')]||_0x2d0d1d[_0xc9ca('0x1f')][_0xc9ca('0x10')])},_0x3008bb)};return client[_0xc9ca('0x22')]('SendMail',_0x493a92);})['then'](function(_0x39a944){if(_0x39a944[_0xc9ca('0x23')]){throw new Error(util[_0xc9ca('0x24')](_0xc9ca('0x25'),_0x39a944['error']['message']||JSON['stringify'](_0x39a944[_0xc9ca('0x23')])));}return!![];});}function handleError(_0x429274,_0x2a1bc2,_0x1be8e3){return _0x429274[_0xc9ca('0x26')](_0x2a1bc2||0x1f4)['send']({'message':_0x1be8e3?_0x1be8e3[_0xc9ca('0x27')]||_0x1be8e3:''});}exports['login']=function(_0x1ec555,_0x1651a8,_0x68d056){passport['authenticate'](_0xc9ca('0x28'),function(_0x245b31,_0xb10a4c,_0x5e8a42){var _0xddd9fe=_0x245b31||_0x5e8a42;if(_0xddd9fe){return handleError(_0x1651a8,0x191,_0xddd9fe);}if(!_0xb10a4c){return handleError(_0x1651a8,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4329c3={'payload':{'id':_0xb10a4c['id'],'role':_0xb10a4c['role']},'options':{'expiresIn':0x15180}};return authService[_0xc9ca('0x29')](_0x4329c3)['then'](function(_0x260b7e){_0x1651a8[_0xc9ca('0x2a')]({'id':_0xb10a4c['id'],'token':_0x260b7e,'statusCall':'','isAlreadyLogged':_0xb10a4c[_0xc9ca('0x2b')]});});}})(_0x1ec555,_0x1651a8,_0x68d056);};exports[_0xc9ca('0x2c')]=function(_0x10f5a2,_0x504c6a){if(!_0x10f5a2[_0xc9ca('0x2d')][_0xc9ca('0x1e')]){return handleError(_0x504c6a,0x1f4,{'message':_0xc9ca('0x2e')});}var _0x1cff62=rs[_0xc9ca('0x2f')]();_0x10f5a2[_0xc9ca('0x2d')][_0xc9ca('0x1e')]=_0x10f5a2['body'][_0xc9ca('0x1e')][_0xc9ca('0x30')]()[_0xc9ca('0x31')]();var _0x5aefa4;return db[_0xc9ca('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0xc9ca('0xa'),_0xc9ca('0x16')],'raw':!![]})[_0xc9ca('0xb')](function(_0x1ad888){_0x5aefa4=_0x1ad888;return db['User'][_0xc9ca('0x1d')]({'where':{'email':_0x10f5a2['body']['email']}});})[_0xc9ca('0xb')](function(_0x5593fa){if(!_0x5593fa){throw new Error(_0xc9ca('0x32'));}if(_0x5593fa[_0xc9ca('0x14')]){throw new Error(_0xc9ca('0x33'));}if(_0x5593fa[_0xc9ca('0x1a')]){if(moment(_0x5593fa[_0xc9ca('0xd')])['add'](_0x5aefa4[_0xc9ca('0x16')],_0xc9ca('0x18'))>moment()){throw new Error(_0xc9ca('0x34'));}else{_0x5593fa[_0xc9ca('0x1a')]=![];_0x5593fa[_0xc9ca('0xd')]=null;}}_0x5593fa[_0xc9ca('0x35')]=_0x1cff62;_0x5593fa[_0xc9ca('0x36')]=Date['now']()+0x36ee80;return _0x5593fa[_0xc9ca('0x37')]();})['then'](function(){return sendServiceMail({'to':_0x10f5a2[_0xc9ca('0x2d')][_0xc9ca('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xc9ca('0x38')+_0xc9ca('0x39')+_0xc9ca('0x3a')+_0x10f5a2[_0xc9ca('0x3b')][_0xc9ca('0x3c')]+_0xc9ca('0x3d')+_0x1cff62+'\x0a\x0a'+_0xc9ca('0x3e')});})[_0xc9ca('0xb')](function(){_0x504c6a[_0xc9ca('0x26')](0xc8)[_0xc9ca('0x3f')]({'message':_0xc9ca('0x40')});})[_0xc9ca('0x1c')](function(_0x5177f5){return handleError(_0x504c6a,0x1f4,_0x5177f5);});};exports[_0xc9ca('0x41')]=function(_0x402450,_0x5b5dfd){return db[_0xc9ca('0x42')]['find']({'where':{'resetPasswordToken':_0x402450['params']['token'],'resetPasswordExpires':{'$gt':Date[_0xc9ca('0x43')]()}}})[_0xc9ca('0xb')](function(_0x1a348a){if(!_0x1a348a){throw new Error(_0xc9ca('0x44'));}return db[_0xc9ca('0x8')]['findOne']({'attributes':['id',_0xc9ca('0x45'),_0xc9ca('0x46'),_0xc9ca('0x47')]})[_0xc9ca('0xb')](function(_0x4dfb05){if(_0x4dfb05['securePassword'])authService[_0xc9ca('0x48')](_0x402450['body']['password']);if(!_0x4dfb05[_0xc9ca('0x46')]||!_0x1a348a[_0xc9ca('0x49')])return _0x1a348a;authService['validatePasswordHistory'](_0x402450[_0xc9ca('0x2d')][_0xc9ca('0x4a')],_0x1a348a['previousPasswords'],_0x4dfb05[_0xc9ca('0x47')]);return _0x1a348a;})[_0xc9ca('0xb')](function(){_0x1a348a['password']=_0x402450[_0xc9ca('0x2d')]['password'];_0x1a348a[_0xc9ca('0x35')]=null;_0x1a348a['resetPasswordExpires']=null;return _0x1a348a[_0xc9ca('0x37')]();});})[_0xc9ca('0xb')](function(){_0x5b5dfd[_0xc9ca('0x26')](0xc8)[_0xc9ca('0x3f')]({'message':_0xc9ca('0x4b')});})[_0xc9ca('0x1c')](function(_0xec4065){return handleError(_0x5b5dfd,0x1f4,_0xec4065);});};passport[_0xc9ca('0x4c')](_0xc9ca('0x28'),new LocalStrategy({'usernameField':'name','passwordField':_0xc9ca('0x4a')},function(_0x3d3bf7,_0x45fec7,_0x2a7f0a){return localAuthenticate(db[_0xc9ca('0x42')],_0x3d3bf7,_0x45fec7,_0x2a7f0a);})); \ No newline at end of file +var _0x989f=['resetPasswordToken','save','use','util','passport','passport-local','randomstring','moment','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','disabled','add','minutes','clearBlockUser','blocked','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','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','https://','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory'];(function(_0x3ca257,_0x4ce970){var _0xeb7580=function(_0x3a01b9){while(--_0x3a01b9){_0x3ca257['push'](_0x3ca257['shift']());}};_0xeb7580(++_0x4ce970);}(_0x989f,0x143));var _0xf989=function(_0x2fcfff,_0x53333d){_0x2fcfff=_0x2fcfff-0x0;var _0x42e871=_0x989f[_0x2fcfff];return _0x42e871;};'use strict';var util=require(_0xf989('0x0'));var passport=require(_0xf989('0x1'));var LocalStrategy=require(_0xf989('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xf989('0x3'));var moment=require(_0xf989('0x4'));var db=require(_0xf989('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xf989('0x6'));var client=jayson[_0xf989('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x3805e3,_0x2d35b8,_0x380cc3,_0xf5935b){var _0x4ef390,_0x1cf7fe;return db[_0xf989('0x8')][_0xf989('0x9')]({'where':{'id':0x1},'attributes':[_0xf989('0xa'),_0xf989('0xb')],'raw':!![]})['then'](function(_0x17bff5){_0x4ef390=_0x17bff5;return _0x3805e3[_0xf989('0x9')]({'attributes':['id',_0xf989('0xc'),_0xf989('0xd'),'salt','role','disabled','blocked',_0xf989('0xe'),_0xf989('0xf')],'where':{'name':_0x2d35b8,'role':{'$or':[_0xf989('0x10'),_0xf989('0x11'),_0xf989('0x12')]}}});})['then'](function(_0x9141a5){if(!_0x9141a5||_0x9141a5&&_0x9141a5[_0xf989('0xc')]!==_0x2d35b8){throw new Error(_0xf989('0x13'));}else{_0x1cf7fe=_0x9141a5;return _0x1cf7fe;}})[_0xf989('0x14')](function(){_0x1cf7fe['authenticate'](_0x380cc3,function(_0xdca813,_0x336485){var _0x338755=_0x1cf7fe[_0xf989('0xf')]+0x1;if(_0xdca813){return _0xf5935b(_0xdca813);}else if(!_0x336485){if(_0x1cf7fe[_0xf989('0x15')]){return _0xf5935b(null,![],{'message':_0xf989('0x13')});}else if(_0x4ef390[_0xf989('0xa')]>0x0){if(_0x1cf7fe['blocked']){if(_0x4ef390[_0xf989('0xb')]>0x0){if(moment(_0x1cf7fe[_0xf989('0xe')])[_0xf989('0x16')](_0x4ef390['blockDuration'],_0xf989('0x17'))>moment()){return _0xf5935b(null,![],{'message':_0xf989('0x13')});}else{return utils[_0xf989('0x18')](_0x1cf7fe,_0x338755,![],null)[_0xf989('0x14')](function(){return _0xf5935b(null,![],{'message':_0xf989('0x13')});});}}else{return _0xf5935b(null,![],{'message':_0xf989('0x13')});}}else{if(_0x338755>=_0x4ef390[_0xf989('0xa')]){return utils[_0xf989('0x18')](_0x1cf7fe,0x0,!![],moment())[_0xf989('0x14')](function(){return _0xf5935b(null,![],{'message':_0xf989('0x13')});});}else{return utils['clearBlockUser'](_0x1cf7fe,_0x338755,![],null)[_0xf989('0x14')](function(){return _0xf5935b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0xf5935b(null,![],{'message':_0xf989('0x13')});}}else{if(_0x1cf7fe[_0xf989('0x15')]){return _0xf5935b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4ef390['allowedLoginAttempts']>0x0){if(_0x1cf7fe[_0xf989('0x19')]){if(_0x4ef390['blockDuration']>0x0){if(moment(_0x1cf7fe[_0xf989('0xe')])[_0xf989('0x16')](_0x4ef390[_0xf989('0xb')],_0xf989('0x17'))>moment()){return _0xf5935b(null,![],{'message':_0xf989('0x13')});}else{return utils[_0xf989('0x18')](_0x1cf7fe,0x0,![],null)[_0xf989('0x14')](function(){return utils[_0xf989('0x1a')](_0x1cf7fe);})[_0xf989('0x14')](function(){return _0xf5935b(null,_0x1cf7fe);});}}else{return _0xf5935b(null,![],{'message':_0xf989('0x13')});}}else{return utils[_0xf989('0x18')](_0x1cf7fe,0x0,![],null)[_0xf989('0x14')](function(){return utils[_0xf989('0x1a')](_0x1cf7fe);})[_0xf989('0x14')](function(){return _0xf5935b(null,_0x1cf7fe);})[_0xf989('0x1b')](function(_0x2723a9){return _0xf5935b(null,![],_0x2723a9);});}}else{if(_0x1cf7fe[_0xf989('0x19')]){return _0xf5935b(null,![],{'message':_0xf989('0x13')});}else{return utils[_0xf989('0x1a')](_0x1cf7fe)[_0xf989('0x14')](function(){return _0xf5935b(null,_0x1cf7fe);});}}}});})['catch'](function(_0x54c8b9){return _0xf5935b(null,![],_0x54c8b9);});}function sendServiceMail(_0x397c35){return db[_0xf989('0x1c')][_0xf989('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xf989('0xc'),_0xf989('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0xf989('0x1f'),'include':[{'model':db[_0xf989('0x20')],'as':_0xf989('0x20')}]}]})[_0xf989('0x14')](function(_0x4e5b7b){if(!_0x4e5b7b){throw new Error(_0xf989('0x21'));}var _0x526817=_0x4e5b7b[_0xf989('0x22')]();var _0x4353b5={'account':_0x526817,'message':_[_0xf989('0x23')]({'from':util[_0xf989('0x24')](_0xf989('0x25'),_0x4e5b7b[_0xf989('0xc')],_0x4e5b7b[_0xf989('0x1e')]||_0x4e5b7b[_0xf989('0x1f')]['user'])},_0x397c35)};return client['request']('SendMail',_0x4353b5);})['then'](function(_0x420f81){if(_0x420f81[_0xf989('0x26')]){throw new Error(util[_0xf989('0x24')](_0xf989('0x27'),_0x420f81[_0xf989('0x26')]['message']||JSON[_0xf989('0x28')](_0x420f81[_0xf989('0x26')])));}return!![];});}function handleError(_0xd63a68,_0x3066d0,_0x5c3083){return _0xd63a68[_0xf989('0x29')](_0x3066d0||0x1f4)[_0xf989('0x2a')]({'message':_0x5c3083?_0x5c3083[_0xf989('0x2b')]||_0x5c3083:''});}exports['login']=function(_0x302669,_0x43ef5c,_0x1238ee){passport[_0xf989('0x2c')](_0xf989('0x2d'),function(_0xfdaef4,_0x174f55,_0x5be1c4){var _0x58866d=_0xfdaef4||_0x5be1c4;if(_0x58866d){return handleError(_0x43ef5c,0x191,_0x58866d);}if(!_0x174f55){return handleError(_0x43ef5c,0x194,{'message':_0xf989('0x2e')});}else{var _0x3f6504={'payload':{'id':_0x174f55['id'],'role':_0x174f55[_0xf989('0x2f')]},'options':{'expiresIn':0x15180}};return authService[_0xf989('0x30')](_0x3f6504)[_0xf989('0x14')](function(_0x35e111){_0x43ef5c[_0xf989('0x31')]({'id':_0x174f55['id'],'token':_0x35e111,'statusCall':'','isAlreadyLogged':_0x174f55[_0xf989('0x32')]});});}})(_0x302669,_0x43ef5c,_0x1238ee);};exports['forgot']=function(_0x6a4e9e,_0x3cd3f9){if(!_0x6a4e9e['body']['email']){return handleError(_0x3cd3f9,0x1f4,{'message':_0xf989('0x33')});}var _0x1d6967=rs[_0xf989('0x34')]();_0x6a4e9e['body'][_0xf989('0x1e')]=_0x6a4e9e[_0xf989('0x35')][_0xf989('0x1e')][_0xf989('0x36')]()[_0xf989('0x37')]();var _0x644345;return db['Setting'][_0xf989('0x9')]({'where':{'id':0x1},'attributes':[_0xf989('0xa'),_0xf989('0xb')],'raw':!![]})[_0xf989('0x14')](function(_0x2ce1d8){_0x644345=_0x2ce1d8;return db[_0xf989('0x38')][_0xf989('0x1d')]({'where':{'email':_0x6a4e9e[_0xf989('0x35')][_0xf989('0x1e')]}});})[_0xf989('0x14')](function(_0x201f77){if(!_0x201f77){throw new Error(_0xf989('0x39'));}if(_0x201f77[_0xf989('0x15')]){throw new Error(_0xf989('0x3a'));}if(_0x201f77['blocked']){if(moment(_0x201f77[_0xf989('0xe')])[_0xf989('0x16')](_0x644345[_0xf989('0xb')],_0xf989('0x17'))>moment()){throw new Error(_0xf989('0x3b'));}else{_0x201f77[_0xf989('0x19')]=![];_0x201f77['blockedAt']=null;}}_0x201f77['resetPasswordToken']=_0x1d6967;_0x201f77[_0xf989('0x3c')]=Date[_0xf989('0x3d')]()+0x36ee80;return _0x201f77['save']();})[_0xf989('0x14')](function(){return sendServiceMail({'to':_0x6a4e9e[_0xf989('0x35')]['email'],'subject':_0xf989('0x3e'),'text':_0xf989('0x3f')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xf989('0x40')+_0x6a4e9e['headers'][_0xf989('0x41')]+'/reset/'+_0x1d6967+'\x0a\x0a'+_0xf989('0x42')});})[_0xf989('0x14')](function(){_0x3cd3f9['status'](0xc8)['send']({'message':_0xf989('0x43')});})[_0xf989('0x1b')](function(_0x1bb120){return handleError(_0x3cd3f9,0x1f4,_0x1bb120);});};exports[_0xf989('0x44')]=function(_0x5aea3d,_0x44173b){return db[_0xf989('0x38')]['find']({'where':{'resetPasswordToken':_0x5aea3d[_0xf989('0x45')][_0xf989('0x46')],'resetPasswordExpires':{'$gt':Date[_0xf989('0x3d')]()}}})[_0xf989('0x14')](function(_0x563f91){if(!_0x563f91){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xf989('0x9')]({'attributes':['id','securePassword',_0xf989('0x47'),_0xf989('0x48')]})[_0xf989('0x14')](function(_0xcf8dd){if(_0xcf8dd[_0xf989('0x49')])authService[_0xf989('0x4a')](_0x5aea3d['body']['password']);if(!_0xcf8dd[_0xf989('0x47')]||!_0x563f91[_0xf989('0x4b')])return _0x563f91;authService[_0xf989('0x4c')](_0x5aea3d[_0xf989('0x35')][_0xf989('0xd')],_0x563f91[_0xf989('0x4b')],_0xcf8dd[_0xf989('0x48')]);return _0x563f91;})[_0xf989('0x14')](function(){_0x563f91['password']=_0x5aea3d['body'][_0xf989('0xd')];_0x563f91[_0xf989('0x4d')]=null;_0x563f91[_0xf989('0x3c')]=null;return _0x563f91[_0xf989('0x4e')]();});})[_0xf989('0x14')](function(){_0x44173b[_0xf989('0x29')](0xc8)[_0xf989('0x2a')]({'message':'Password\x20reset!'});})['catch'](function(_0x399b72){return handleError(_0x44173b,0x1f4,_0x399b72);});};passport[_0xf989('0x4f')](_0xf989('0x2d'),new LocalStrategy({'usernameField':_0xf989('0xc'),'passwordField':'password'},function(_0x3caba,_0x5ec5fe,_0x41bb30){return localAuthenticate(db['User'],_0x3caba,_0x5ec5fe,_0x41bb30);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3277724..26894bb 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 _0xbea4=['exports','express','login','post','/forgot','/reset/:token'];(function(_0x519663,_0x3dcd48){var _0x5009e0=function(_0x3f6053){while(--_0x3f6053){_0x519663['push'](_0x519663['shift']());}};_0x5009e0(++_0x3dcd48);}(_0xbea4,0xf1));var _0x4bea=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xbea4[_0x4fc9e6];return _0x551d28;};'use strict';var express=require(_0x4bea('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller[_0x4bea('0x1')]);router[_0x4bea('0x2')](_0x4bea('0x3'),controller['forgot']);router[_0x4bea('0x2')](_0x4bea('0x4'),controller['reset']);module[_0x4bea('0x5')]=router; \ No newline at end of file +var _0xa5ef=['Router','./authLocal.controller','post','/forgot','forgot','/reset/:token','exports','express'];(function(_0x519869,_0x5e9535){var _0x26f819=function(_0x4a83bd){while(--_0x4a83bd){_0x519869['push'](_0x519869['shift']());}};_0x26f819(++_0x5e9535);}(_0xa5ef,0x14f));var _0xfa5e=function(_0x5ef37c,_0x2df5ff){_0x5ef37c=_0x5ef37c-0x0;var _0x308937=_0xa5ef[_0x5ef37c];return _0x308937;};'use strict';var express=require(_0xfa5e('0x0'));var router=express[_0xfa5e('0x1')]();var controller=require(_0xfa5e('0x2'));router[_0xfa5e('0x3')]('/',controller['login']);router[_0xfa5e('0x3')](_0xfa5e('0x4'),controller[_0xfa5e('0x5')]);router[_0xfa5e('0x3')](_0xfa5e('0x6'),controller['reset']);module[_0xfa5e('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 468b884..bb8d7ee 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 _0x6d33=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x6d33,0x82));var _0x36d3=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x6d33[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require(_0x36d3('0x0'));module[_0x36d3('0x1')]={'name':{'type':Sequelize[_0x36d3('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x36d3('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x36d3('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x36d3('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x56f6=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x2db314,_0x305b01){var _0x15db81=function(_0x390714){while(--_0x390714){_0x2db314['push'](_0x2db314['shift']());}};_0x15db81(++_0x305b01);}(_0x56f6,0xf0));var _0x656f=function(_0x3deae2,_0x2bd6ea){_0x3deae2=_0x3deae2-0x0;var _0x52683c=_0x56f6[_0x3deae2];return _0x52683c;};'use strict';var Sequelize=require(_0x656f('0x0'));module[_0x656f('0x1')]={'name':{'type':Sequelize[_0x656f('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x656f('0x2')]},'description':{'type':Sequelize[_0x656f('0x2')]},'status':{'type':Sequelize[_0x656f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x656f('0x4')],'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 66235e0..d53c260 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 _0xc4b5=['jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','Automation','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','Condition','ids','omit','getConditions','findOne','hasOwnProperty','addActions','getActions','Action','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto'];(function(_0x220900,_0x5b1eeb){var _0x5e143c=function(_0x230886){while(--_0x230886){_0x220900['push'](_0x220900['shift']());}};_0x5e143c(++_0x5b1eeb);}(_0xc4b5,0xf7));var _0x5c4b=function(_0xa9b530,_0xb439e3){_0xa9b530=_0xa9b530-0x0;var _0x5d21e5=_0xc4b5[_0xa9b530];return _0x5d21e5;};'use strict';var emlformat=require(_0x5c4b('0x0'));var rimraf=require(_0x5c4b('0x1'));var zipdir=require(_0x5c4b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c4b('0x3'));var moment=require(_0x5c4b('0x4'));var BPromise=require(_0x5c4b('0x5'));var Mustache=require(_0x5c4b('0x6'));var util=require(_0x5c4b('0x7'));var path=require(_0x5c4b('0x8'));var sox=require(_0x5c4b('0x9'));var csv=require('to-csv');var ejs=require(_0x5c4b('0xa'));var fs=require('fs');var fs_extra=require(_0x5c4b('0xb'));var _=require('lodash');var squel=require(_0x5c4b('0xc'));var crypto=require(_0x5c4b('0xd'));var jsforce=require(_0x5c4b('0xe'));var deskjs=require(_0x5c4b('0xf'));var toCsv=require(_0x5c4b('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5c4b('0x11'));var qs=require(_0x5c4b('0x12'));var as=require(_0x5c4b('0x13'));var hardwareService=require(_0x5c4b('0x14'));var logger=require(_0x5c4b('0x15'))(_0x5c4b('0x16'));var utils=require(_0x5c4b('0x17'));var config=require(_0x5c4b('0x18'));var licenseUtil=require(_0x5c4b('0x19'));var db=require(_0x5c4b('0x1a'))['db'];function respondWithStatusCode(_0x46e246,_0xf379b4){_0xf379b4=_0xf379b4||0xcc;return function(_0x201a47){if(_0x201a47){return _0x46e246[_0x5c4b('0x1b')](_0xf379b4);}return _0x46e246[_0x5c4b('0x1c')](_0xf379b4)[_0x5c4b('0x1d')]();};}function respondWithResult(_0x17df64,_0x21c9ef){_0x21c9ef=_0x21c9ef||0xc8;return function(_0x303a47){if(_0x303a47){return _0x17df64[_0x5c4b('0x1c')](_0x21c9ef)['json'](_0x303a47);}};}function respondWithFilteredResult(_0x236ef0,_0x260ef5){return function(_0x190fee){if(_0x190fee){var _0xbed3d5=typeof _0x260ef5['offset']===_0x5c4b('0x1e')&&typeof _0x260ef5[_0x5c4b('0x1f')]===_0x5c4b('0x1e');var _0x2e2726=_0x190fee[_0x5c4b('0x20')];var _0x30a27f=_0xbed3d5?0x0:_0x260ef5[_0x5c4b('0x21')];var _0xf0e71f=_0xbed3d5?_0x190fee['count']:_0x260ef5[_0x5c4b('0x21')]+_0x260ef5[_0x5c4b('0x1f')];var _0x3c576e;if(_0xf0e71f>=_0x2e2726){_0xf0e71f=_0x2e2726;_0x3c576e=0xc8;}else{_0x3c576e=0xce;}_0x236ef0[_0x5c4b('0x1c')](_0x3c576e);return _0x236ef0[_0x5c4b('0x22')](_0x5c4b('0x23'),_0x30a27f+'-'+_0xf0e71f+'/'+_0x2e2726)[_0x5c4b('0x24')](_0x190fee);}return null;};}function patchUpdates(_0x350ab4){return function(_0x499cde){try{jsonpatch[_0x5c4b('0x25')](_0x499cde,_0x350ab4,!![]);}catch(_0x331b5b){return BPromise[_0x5c4b('0x26')](_0x331b5b);}return _0x499cde[_0x5c4b('0x27')]();};}function saveUpdates(_0x15ba64,_0x323ff1){return function(_0x1ddfa7){if(_0x1ddfa7){return _0x1ddfa7['update'](_0x15ba64)[_0x5c4b('0x28')](function(_0x25a31c){return _0x25a31c;});}return null;};}function removeEntity(_0x10b7d6,_0x37bd49){return function(_0x13ba35){if(_0x13ba35){return _0x13ba35[_0x5c4b('0x29')]()['then'](function(){_0x10b7d6[_0x5c4b('0x1c')](0xcc)[_0x5c4b('0x1d')]();});}};}function handleEntityNotFound(_0x431eae,_0x1d1f54){return function(_0x4da10a){if(!_0x4da10a){_0x431eae[_0x5c4b('0x1b')](0x194);}return _0x4da10a;};}function handleError(_0x49756f,_0x118306){_0x118306=_0x118306||0x1f4;return function(_0x3c7d68){logger[_0x5c4b('0x2a')](_0x3c7d68['stack']);if(_0x3c7d68[_0x5c4b('0x2b')]){delete _0x3c7d68[_0x5c4b('0x2b')];}_0x49756f['status'](_0x118306)[_0x5c4b('0x2c')](_0x3c7d68);};}exports[_0x5c4b('0x2d')]=function(_0x1e8086,_0x4706f5){var _0x494c3b={},_0x9ae907={},_0x343b66={'count':0x0,'rows':[]};var _0x59b80f=_['map'](db[_0x5c4b('0x2e')][_0x5c4b('0x2f')],function(_0x11521c){return{'name':_0x11521c[_0x5c4b('0x30')],'type':_0x11521c['type'][_0x5c4b('0x31')]};});_0x9ae907[_0x5c4b('0x32')]=_[_0x5c4b('0x33')](_0x59b80f,_0x5c4b('0x2b'));_0x9ae907[_0x5c4b('0x34')]=_[_0x5c4b('0x35')](_0x1e8086[_0x5c4b('0x34')]);_0x9ae907[_0x5c4b('0x36')]=_[_0x5c4b('0x37')](_0x9ae907['model'],_0x9ae907[_0x5c4b('0x34')]);_0x494c3b['attributes']=_['intersection'](_0x9ae907['model'],qs[_0x5c4b('0x38')](_0x1e8086[_0x5c4b('0x34')][_0x5c4b('0x38')]));_0x494c3b[_0x5c4b('0x39')]=_0x494c3b['attributes'][_0x5c4b('0x3a')]?_0x494c3b[_0x5c4b('0x39')]:_0x9ae907['model'];if(!_0x1e8086[_0x5c4b('0x34')]['hasOwnProperty'](_0x5c4b('0x3b'))){_0x494c3b['limit']=qs[_0x5c4b('0x1f')](_0x1e8086[_0x5c4b('0x34')]['limit']);_0x494c3b[_0x5c4b('0x21')]=qs[_0x5c4b('0x21')](_0x1e8086['query'][_0x5c4b('0x21')]);}_0x494c3b[_0x5c4b('0x3c')]=qs['sort'](_0x1e8086['query'][_0x5c4b('0x3d')]);_0x494c3b[_0x5c4b('0x3e')]=qs['filters'](_[_0x5c4b('0x3f')](_0x1e8086['query'],_0x9ae907[_0x5c4b('0x36')]),_0x59b80f);if(_0x1e8086[_0x5c4b('0x34')]['filter']){_0x494c3b[_0x5c4b('0x3e')]=_[_0x5c4b('0x40')](_0x494c3b[_0x5c4b('0x3e')],{'$or':_['map'](_0x59b80f,function(_0x1c336b){if(_0x1c336b[_0x5c4b('0x41')]!=='VIRTUAL'){var _0x47da97={};_0x47da97[_0x1c336b[_0x5c4b('0x2b')]]={'$like':'%'+_0x1e8086[_0x5c4b('0x34')][_0x5c4b('0x42')]+'%'};return _0x47da97;}})});}_0x494c3b=_['merge']({},_0x494c3b,_0x1e8086['options']);var _0x5b0381={'where':_0x494c3b[_0x5c4b('0x3e')]};return db[_0x5c4b('0x2e')][_0x5c4b('0x20')](_0x5b0381)[_0x5c4b('0x28')](function(_0x36cb2c){_0x343b66[_0x5c4b('0x20')]=_0x36cb2c;if(_0x1e8086['query'][_0x5c4b('0x43')]){_0x494c3b[_0x5c4b('0x44')]=[{'all':!![]}];}return db['Automation'][_0x5c4b('0x45')](_0x494c3b);})[_0x5c4b('0x28')](function(_0x510055){_0x343b66[_0x5c4b('0x46')]=_0x510055;return _0x343b66;})[_0x5c4b('0x28')](respondWithFilteredResult(_0x4706f5,_0x494c3b))[_0x5c4b('0x47')](handleError(_0x4706f5,null));};exports[_0x5c4b('0x48')]=function(_0x605704,_0x34f214){var _0x32ad7b={'raw':![],'where':{'id':_0x605704[_0x5c4b('0x49')]['id']}},_0x33e3cb={};_0x33e3cb[_0x5c4b('0x32')]=_['keys'](db[_0x5c4b('0x2e')][_0x5c4b('0x2f')]);_0x33e3cb['query']=_[_0x5c4b('0x35')](_0x605704[_0x5c4b('0x34')]);_0x33e3cb['filters']=_[_0x5c4b('0x37')](_0x33e3cb[_0x5c4b('0x32')],_0x33e3cb[_0x5c4b('0x34')]);_0x32ad7b[_0x5c4b('0x39')]=_['intersection'](_0x33e3cb['model'],qs[_0x5c4b('0x38')](_0x605704[_0x5c4b('0x34')]['fields']));_0x32ad7b[_0x5c4b('0x39')]=_0x32ad7b[_0x5c4b('0x39')][_0x5c4b('0x3a')]?_0x32ad7b['attributes']:_0x33e3cb[_0x5c4b('0x32')];if(_0x605704[_0x5c4b('0x34')][_0x5c4b('0x43')]){_0x32ad7b[_0x5c4b('0x44')]=[{'all':!![]}];}_0x32ad7b=_[_0x5c4b('0x40')]({},_0x32ad7b,_0x605704[_0x5c4b('0x4a')]);return db['Automation']['find'](_0x32ad7b)['then'](handleEntityNotFound(_0x34f214,null))[_0x5c4b('0x28')](respondWithResult(_0x34f214,null))[_0x5c4b('0x47')](handleError(_0x34f214,null));};exports[_0x5c4b('0x4b')]=function(_0x193277,_0x3ad117){return db[_0x5c4b('0x2e')][_0x5c4b('0x4b')](_0x193277[_0x5c4b('0x4c')],{})[_0x5c4b('0x28')](respondWithResult(_0x3ad117,0xc9))[_0x5c4b('0x47')](handleError(_0x3ad117,null));};exports['update']=function(_0x3a1587,_0x7d5756){if(_0x3a1587[_0x5c4b('0x4c')]['id']){delete _0x3a1587['body']['id'];}return db[_0x5c4b('0x2e')][_0x5c4b('0x4d')]({'where':{'id':_0x3a1587[_0x5c4b('0x49')]['id']}})[_0x5c4b('0x28')](handleEntityNotFound(_0x7d5756,null))[_0x5c4b('0x28')](saveUpdates(_0x3a1587[_0x5c4b('0x4c')],null))[_0x5c4b('0x28')](respondWithResult(_0x7d5756,null))[_0x5c4b('0x47')](handleError(_0x7d5756,null));};exports[_0x5c4b('0x29')]=function(_0x241801,_0x26c0c9){return db[_0x5c4b('0x2e')][_0x5c4b('0x4d')]({'where':{'id':_0x241801[_0x5c4b('0x49')]['id']}})[_0x5c4b('0x28')](handleEntityNotFound(_0x26c0c9,null))[_0x5c4b('0x28')](removeEntity(_0x26c0c9,null))[_0x5c4b('0x47')](handleError(_0x26c0c9,null));};exports['addConditions']=function(_0x20be87,_0x1c0133,_0x9f4561){return db[_0x5c4b('0x4e')]['find']({'where':{'id':_0x20be87[_0x5c4b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c0133,null))[_0x5c4b('0x28')](function(_0x382f35){if(_0x382f35){return _0x382f35['addConditions'](_0x20be87['body'][_0x5c4b('0x4f')],_[_0x5c4b('0x50')](_0x20be87[_0x5c4b('0x4c')],['ids','id'])||{});}})['then'](respondWithResult(_0x1c0133,null))['catch'](handleError(_0x1c0133,null));};exports[_0x5c4b('0x51')]=function(_0x34f068,_0xa90c8f,_0x72ebc5){var _0x4380d1={};var _0x5462fc={};var _0x2a467b;var _0x1a9817;return db['Automation'][_0x5c4b('0x52')]({'where':{'id':_0x34f068[_0x5c4b('0x49')]['id']}})[_0x5c4b('0x28')](handleEntityNotFound(_0xa90c8f,null))[_0x5c4b('0x28')](function(_0x4f71ad){if(_0x4f71ad){_0x2a467b=_0x4f71ad;_0x5462fc['model']=_[_0x5c4b('0x35')](db['Condition'][_0x5c4b('0x2f')]);_0x5462fc[_0x5c4b('0x34')]=_[_0x5c4b('0x35')](_0x34f068[_0x5c4b('0x34')]);_0x5462fc[_0x5c4b('0x36')]=_[_0x5c4b('0x37')](_0x5462fc['model'],_0x5462fc[_0x5c4b('0x34')]);_0x4380d1[_0x5c4b('0x39')]=_[_0x5c4b('0x37')](_0x5462fc[_0x5c4b('0x32')],qs[_0x5c4b('0x38')](_0x34f068[_0x5c4b('0x34')][_0x5c4b('0x38')]));_0x4380d1[_0x5c4b('0x39')]=_0x4380d1[_0x5c4b('0x39')][_0x5c4b('0x3a')]?_0x4380d1[_0x5c4b('0x39')]:_0x5462fc[_0x5c4b('0x32')];_0x4380d1[_0x5c4b('0x3c')]=qs[_0x5c4b('0x3d')](_0x34f068[_0x5c4b('0x34')][_0x5c4b('0x3d')]);_0x4380d1[_0x5c4b('0x3e')]=qs[_0x5c4b('0x36')](_['pick'](_0x34f068[_0x5c4b('0x34')],_0x5462fc[_0x5c4b('0x36')]));if(_0x34f068[_0x5c4b('0x34')][_0x5c4b('0x42')]){_0x4380d1[_0x5c4b('0x3e')]=_[_0x5c4b('0x40')](_0x4380d1[_0x5c4b('0x3e')],{'$or':_[_0x5c4b('0x33')](_0x4380d1[_0x5c4b('0x39')],function(_0x3bac64){var _0x12eb39={};_0x12eb39[_0x3bac64]={'$like':'%'+_0x34f068[_0x5c4b('0x34')][_0x5c4b('0x42')]+'%'};return _0x12eb39;})});}_0x4380d1=_['merge']({},_0x4380d1,_0x34f068['options']);return _0x2a467b[_0x5c4b('0x51')](_0x4380d1);}})[_0x5c4b('0x28')](function(_0x1cd444){if(_0x1cd444){_0x1a9817=_0x1cd444['length'];if(!_0x34f068[_0x5c4b('0x34')][_0x5c4b('0x53')](_0x5c4b('0x3b'))){_0x4380d1[_0x5c4b('0x1f')]=qs[_0x5c4b('0x1f')](_0x34f068[_0x5c4b('0x34')][_0x5c4b('0x1f')]);_0x4380d1[_0x5c4b('0x21')]=qs['offset'](_0x34f068[_0x5c4b('0x34')]['offset']);}return _0x2a467b[_0x5c4b('0x51')](_0x4380d1);}})[_0x5c4b('0x28')](function(_0x201af9){if(_0x201af9){return _0x201af9?{'count':_0x1a9817,'rows':_0x201af9}:null;}})[_0x5c4b('0x28')](respondWithResult(_0xa90c8f,null))[_0x5c4b('0x47')](handleError(_0xa90c8f,null));};exports[_0x5c4b('0x54')]=function(_0x5a6639,_0x58b56d,_0x2fbed6){return db['Action']['find']({'where':{'id':_0x5a6639[_0x5c4b('0x49')]['id']}})[_0x5c4b('0x28')](handleEntityNotFound(_0x58b56d,null))[_0x5c4b('0x28')](function(_0x5addda){if(_0x5addda){return _0x5addda['addActions'](_0x5a6639[_0x5c4b('0x4c')][_0x5c4b('0x4f')],_[_0x5c4b('0x50')](_0x5a6639[_0x5c4b('0x4c')],[_0x5c4b('0x4f'),'id'])||{});}})[_0x5c4b('0x28')](respondWithResult(_0x58b56d,null))[_0x5c4b('0x47')](handleError(_0x58b56d,null));};exports[_0x5c4b('0x55')]=function(_0x4bb7b8,_0x43b073,_0x4daeb8){var _0x60a490={};var _0x2b7137={};var _0x241c39;var _0xa60f53;return db[_0x5c4b('0x2e')][_0x5c4b('0x52')]({'where':{'id':_0x4bb7b8[_0x5c4b('0x49')]['id']}})[_0x5c4b('0x28')](handleEntityNotFound(_0x43b073,null))[_0x5c4b('0x28')](function(_0x4775b1){if(_0x4775b1){_0x241c39=_0x4775b1;_0x2b7137[_0x5c4b('0x32')]=_[_0x5c4b('0x35')](db[_0x5c4b('0x56')]['rawAttributes']);_0x2b7137[_0x5c4b('0x34')]=_[_0x5c4b('0x35')](_0x4bb7b8[_0x5c4b('0x34')]);_0x2b7137[_0x5c4b('0x36')]=_[_0x5c4b('0x37')](_0x2b7137[_0x5c4b('0x32')],_0x2b7137['query']);_0x60a490[_0x5c4b('0x39')]=_[_0x5c4b('0x37')](_0x2b7137[_0x5c4b('0x32')],qs[_0x5c4b('0x38')](_0x4bb7b8[_0x5c4b('0x34')][_0x5c4b('0x38')]));_0x60a490[_0x5c4b('0x39')]=_0x60a490[_0x5c4b('0x39')][_0x5c4b('0x3a')]?_0x60a490[_0x5c4b('0x39')]:_0x2b7137[_0x5c4b('0x32')];_0x60a490['order']=qs[_0x5c4b('0x3d')](_0x4bb7b8[_0x5c4b('0x34')][_0x5c4b('0x3d')]);_0x60a490[_0x5c4b('0x3e')]=qs[_0x5c4b('0x36')](_[_0x5c4b('0x3f')](_0x4bb7b8[_0x5c4b('0x34')],_0x2b7137[_0x5c4b('0x36')]));if(_0x4bb7b8[_0x5c4b('0x34')][_0x5c4b('0x42')]){_0x60a490[_0x5c4b('0x3e')]=_[_0x5c4b('0x40')](_0x60a490[_0x5c4b('0x3e')],{'$or':_[_0x5c4b('0x33')](_0x60a490[_0x5c4b('0x39')],function(_0x5cc85e){var _0x23a8e2={};_0x23a8e2[_0x5cc85e]={'$like':'%'+_0x4bb7b8[_0x5c4b('0x34')]['filter']+'%'};return _0x23a8e2;})});}_0x60a490=_[_0x5c4b('0x40')]({},_0x60a490,_0x4bb7b8[_0x5c4b('0x4a')]);return _0x241c39['getActions'](_0x60a490);}})[_0x5c4b('0x28')](function(_0x565e2f){if(_0x565e2f){_0xa60f53=_0x565e2f[_0x5c4b('0x3a')];if(!_0x4bb7b8[_0x5c4b('0x34')][_0x5c4b('0x53')](_0x5c4b('0x3b'))){_0x60a490[_0x5c4b('0x1f')]=qs[_0x5c4b('0x1f')](_0x4bb7b8[_0x5c4b('0x34')]['limit']);_0x60a490[_0x5c4b('0x21')]=qs[_0x5c4b('0x21')](_0x4bb7b8[_0x5c4b('0x34')]['offset']);}return _0x241c39[_0x5c4b('0x55')](_0x60a490);}})['then'](function(_0x3194f1){if(_0x3194f1){return _0x3194f1?{'count':_0xa60f53,'rows':_0x3194f1}:null;}})[_0x5c4b('0x28')](respondWithResult(_0x43b073,null))['catch'](handleError(_0x43b073,null));}; \ No newline at end of file +var _0xc9a9=['Condition','ids','omit','getConditions','findOne','keys','sort','nolimit','addActions','getActions','Action','hasOwnProperty','eml-format','rimraf','moment','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/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','fields','length','find','create','body','addConditions'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc9a9,0x1ab));var _0x9c9a=function(_0x553767,_0xea82df){_0x553767=_0x553767-0x0;var _0x543b15=_0xc9a9[_0x553767];return _0x543b15;};'use strict';var emlformat=require(_0x9c9a('0x0'));var rimraf=require(_0x9c9a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9c9a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9c9a('0x3'));var util=require(_0x9c9a('0x4'));var path=require(_0x9c9a('0x5'));var sox=require(_0x9c9a('0x6'));var csv=require(_0x9c9a('0x7'));var ejs=require(_0x9c9a('0x8'));var fs=require('fs');var fs_extra=require(_0x9c9a('0x9'));var _=require('lodash');var squel=require(_0x9c9a('0xa'));var crypto=require(_0x9c9a('0xb'));var jsforce=require(_0x9c9a('0xc'));var deskjs=require(_0x9c9a('0xd'));var toCsv=require(_0x9c9a('0x7'));var querystring=require('querystring');var Papa=require(_0x9c9a('0xe'));var Redis=require('ioredis');var authService=require(_0x9c9a('0xf'));var qs=require(_0x9c9a('0x10'));var as=require(_0x9c9a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c9a('0x12'))('api');var utils=require(_0x9c9a('0x13'));var config=require(_0x9c9a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c9a('0x15'))['db'];function respondWithStatusCode(_0x49e475,_0xbedf79){_0xbedf79=_0xbedf79||0xcc;return function(_0x1daf1b){if(_0x1daf1b){return _0x49e475[_0x9c9a('0x16')](_0xbedf79);}return _0x49e475[_0x9c9a('0x17')](_0xbedf79)[_0x9c9a('0x18')]();};}function respondWithResult(_0x4e55b6,_0x4773f6){_0x4773f6=_0x4773f6||0xc8;return function(_0x7a8ec0){if(_0x7a8ec0){return _0x4e55b6[_0x9c9a('0x17')](_0x4773f6)[_0x9c9a('0x19')](_0x7a8ec0);}};}function respondWithFilteredResult(_0x1b5b0e,_0x422034){return function(_0x4bb659){if(_0x4bb659){var _0x1295a7=typeof _0x422034['offset']==='undefined'&&typeof _0x422034[_0x9c9a('0x1a')]===_0x9c9a('0x1b');var _0x22cdb3=_0x4bb659[_0x9c9a('0x1c')];var _0x2f716d=_0x1295a7?0x0:_0x422034[_0x9c9a('0x1d')];var _0x411c75=_0x1295a7?_0x4bb659[_0x9c9a('0x1c')]:_0x422034[_0x9c9a('0x1d')]+_0x422034[_0x9c9a('0x1a')];var _0x3b2434;if(_0x411c75>=_0x22cdb3){_0x411c75=_0x22cdb3;_0x3b2434=0xc8;}else{_0x3b2434=0xce;}_0x1b5b0e[_0x9c9a('0x17')](_0x3b2434);return _0x1b5b0e[_0x9c9a('0x1e')]('Content-Range',_0x2f716d+'-'+_0x411c75+'/'+_0x22cdb3)[_0x9c9a('0x19')](_0x4bb659);}return null;};}function patchUpdates(_0x141c9b){return function(_0x24245d){try{jsonpatch[_0x9c9a('0x1f')](_0x24245d,_0x141c9b,!![]);}catch(_0x2c0f1d){return BPromise['reject'](_0x2c0f1d);}return _0x24245d[_0x9c9a('0x20')]();};}function saveUpdates(_0x23c1a7,_0x2d204c){return function(_0x48267a){if(_0x48267a){return _0x48267a[_0x9c9a('0x21')](_0x23c1a7)[_0x9c9a('0x22')](function(_0x19fc0f){return _0x19fc0f;});}return null;};}function removeEntity(_0x24fb81,_0x6fa6d0){return function(_0x218811){if(_0x218811){return _0x218811[_0x9c9a('0x23')]()[_0x9c9a('0x22')](function(){_0x24fb81[_0x9c9a('0x17')](0xcc)[_0x9c9a('0x18')]();});}};}function handleEntityNotFound(_0x170ea8,_0xa9beff){return function(_0x327277){if(!_0x327277){_0x170ea8[_0x9c9a('0x16')](0x194);}return _0x327277;};}function handleError(_0x15df9e,_0x4cde4e){_0x4cde4e=_0x4cde4e||0x1f4;return function(_0x468d9f){logger[_0x9c9a('0x24')](_0x468d9f[_0x9c9a('0x25')]);if(_0x468d9f[_0x9c9a('0x26')]){delete _0x468d9f[_0x9c9a('0x26')];}_0x15df9e[_0x9c9a('0x17')](_0x4cde4e)[_0x9c9a('0x27')](_0x468d9f);};}exports[_0x9c9a('0x28')]=function(_0x3ed492,_0x703d3a){var _0x5a1c09={},_0x4ec672={},_0x50ec36={'count':0x0,'rows':[]};var _0x16ccdf=_[_0x9c9a('0x29')](db[_0x9c9a('0x2a')][_0x9c9a('0x2b')],function(_0x364a8f){return{'name':_0x364a8f[_0x9c9a('0x2c')],'type':_0x364a8f[_0x9c9a('0x2d')][_0x9c9a('0x2e')]};});_0x4ec672['model']=_[_0x9c9a('0x29')](_0x16ccdf,'name');_0x4ec672['query']=_['keys'](_0x3ed492[_0x9c9a('0x2f')]);_0x4ec672[_0x9c9a('0x30')]=_[_0x9c9a('0x31')](_0x4ec672['model'],_0x4ec672['query']);_0x5a1c09['attributes']=_[_0x9c9a('0x31')](_0x4ec672[_0x9c9a('0x32')],qs['fields'](_0x3ed492['query']['fields']));_0x5a1c09[_0x9c9a('0x33')]=_0x5a1c09['attributes']['length']?_0x5a1c09['attributes']:_0x4ec672[_0x9c9a('0x32')];if(!_0x3ed492[_0x9c9a('0x2f')]['hasOwnProperty']('nolimit')){_0x5a1c09[_0x9c9a('0x1a')]=qs[_0x9c9a('0x1a')](_0x3ed492[_0x9c9a('0x2f')][_0x9c9a('0x1a')]);_0x5a1c09[_0x9c9a('0x1d')]=qs[_0x9c9a('0x1d')](_0x3ed492[_0x9c9a('0x2f')][_0x9c9a('0x1d')]);}_0x5a1c09[_0x9c9a('0x34')]=qs['sort'](_0x3ed492[_0x9c9a('0x2f')]['sort']);_0x5a1c09[_0x9c9a('0x35')]=qs[_0x9c9a('0x30')](_[_0x9c9a('0x36')](_0x3ed492[_0x9c9a('0x2f')],_0x4ec672[_0x9c9a('0x30')]),_0x16ccdf);if(_0x3ed492[_0x9c9a('0x2f')][_0x9c9a('0x37')]){_0x5a1c09[_0x9c9a('0x35')]=_[_0x9c9a('0x38')](_0x5a1c09[_0x9c9a('0x35')],{'$or':_['map'](_0x16ccdf,function(_0x2afaf6){if(_0x2afaf6[_0x9c9a('0x2d')]!==_0x9c9a('0x39')){var _0x49cfdc={};_0x49cfdc[_0x2afaf6[_0x9c9a('0x26')]]={'$like':'%'+_0x3ed492[_0x9c9a('0x2f')][_0x9c9a('0x37')]+'%'};return _0x49cfdc;}})});}_0x5a1c09=_[_0x9c9a('0x38')]({},_0x5a1c09,_0x3ed492[_0x9c9a('0x3a')]);var _0x4b9edf={'where':_0x5a1c09[_0x9c9a('0x35')]};return db[_0x9c9a('0x2a')][_0x9c9a('0x1c')](_0x4b9edf)[_0x9c9a('0x22')](function(_0x281e5e){_0x50ec36['count']=_0x281e5e;if(_0x3ed492[_0x9c9a('0x2f')]['includeAll']){_0x5a1c09[_0x9c9a('0x3b')]=[{'all':!![]}];}return db['Automation'][_0x9c9a('0x3c')](_0x5a1c09);})[_0x9c9a('0x22')](function(_0xb0d5a1){_0x50ec36[_0x9c9a('0x3d')]=_0xb0d5a1;return _0x50ec36;})['then'](respondWithFilteredResult(_0x703d3a,_0x5a1c09))[_0x9c9a('0x3e')](handleError(_0x703d3a,null));};exports[_0x9c9a('0x3f')]=function(_0x28b18a,_0x14a376){var _0x37c06a={'raw':![],'where':{'id':_0x28b18a[_0x9c9a('0x40')]['id']}},_0x147ef3={};_0x147ef3[_0x9c9a('0x32')]=_['keys'](db[_0x9c9a('0x2a')][_0x9c9a('0x2b')]);_0x147ef3[_0x9c9a('0x2f')]=_['keys'](_0x28b18a[_0x9c9a('0x2f')]);_0x147ef3['filters']=_[_0x9c9a('0x31')](_0x147ef3['model'],_0x147ef3[_0x9c9a('0x2f')]);_0x37c06a['attributes']=_[_0x9c9a('0x31')](_0x147ef3[_0x9c9a('0x32')],qs[_0x9c9a('0x41')](_0x28b18a[_0x9c9a('0x2f')][_0x9c9a('0x41')]));_0x37c06a[_0x9c9a('0x33')]=_0x37c06a[_0x9c9a('0x33')][_0x9c9a('0x42')]?_0x37c06a['attributes']:_0x147ef3['model'];if(_0x28b18a[_0x9c9a('0x2f')]['includeAll']){_0x37c06a['include']=[{'all':!![]}];}_0x37c06a=_[_0x9c9a('0x38')]({},_0x37c06a,_0x28b18a[_0x9c9a('0x3a')]);return db['Automation'][_0x9c9a('0x43')](_0x37c06a)['then'](handleEntityNotFound(_0x14a376,null))['then'](respondWithResult(_0x14a376,null))[_0x9c9a('0x3e')](handleError(_0x14a376,null));};exports['create']=function(_0x5c8886,_0x3cd7f6){return db[_0x9c9a('0x2a')][_0x9c9a('0x44')](_0x5c8886[_0x9c9a('0x45')],{})['then'](respondWithResult(_0x3cd7f6,0xc9))[_0x9c9a('0x3e')](handleError(_0x3cd7f6,null));};exports[_0x9c9a('0x21')]=function(_0x55faf3,_0x3ef129){if(_0x55faf3[_0x9c9a('0x45')]['id']){delete _0x55faf3[_0x9c9a('0x45')]['id'];}return db[_0x9c9a('0x2a')][_0x9c9a('0x43')]({'where':{'id':_0x55faf3[_0x9c9a('0x40')]['id']}})[_0x9c9a('0x22')](handleEntityNotFound(_0x3ef129,null))[_0x9c9a('0x22')](saveUpdates(_0x55faf3['body'],null))[_0x9c9a('0x22')](respondWithResult(_0x3ef129,null))[_0x9c9a('0x3e')](handleError(_0x3ef129,null));};exports[_0x9c9a('0x23')]=function(_0x319cbe,_0x110255){return db[_0x9c9a('0x2a')][_0x9c9a('0x43')]({'where':{'id':_0x319cbe['params']['id']}})['then'](handleEntityNotFound(_0x110255,null))[_0x9c9a('0x22')](removeEntity(_0x110255,null))[_0x9c9a('0x3e')](handleError(_0x110255,null));};exports[_0x9c9a('0x46')]=function(_0x2ec4b9,_0x4696bb,_0x56118a){return db[_0x9c9a('0x47')]['find']({'where':{'id':_0x2ec4b9['params']['id']}})['then'](handleEntityNotFound(_0x4696bb,null))[_0x9c9a('0x22')](function(_0x49249d){if(_0x49249d){return _0x49249d[_0x9c9a('0x46')](_0x2ec4b9[_0x9c9a('0x45')][_0x9c9a('0x48')],_[_0x9c9a('0x49')](_0x2ec4b9[_0x9c9a('0x45')],[_0x9c9a('0x48'),'id'])||{});}})[_0x9c9a('0x22')](respondWithResult(_0x4696bb,null))[_0x9c9a('0x3e')](handleError(_0x4696bb,null));};exports[_0x9c9a('0x4a')]=function(_0x9bb306,_0x49f5b4,_0x3a645d){var _0x5da384={};var _0x5bfb49={};var _0x157615;var _0x33d0f3;return db['Automation'][_0x9c9a('0x4b')]({'where':{'id':_0x9bb306[_0x9c9a('0x40')]['id']}})[_0x9c9a('0x22')](handleEntityNotFound(_0x49f5b4,null))[_0x9c9a('0x22')](function(_0x22d243){if(_0x22d243){_0x157615=_0x22d243;_0x5bfb49[_0x9c9a('0x32')]=_[_0x9c9a('0x4c')](db[_0x9c9a('0x47')][_0x9c9a('0x2b')]);_0x5bfb49[_0x9c9a('0x2f')]=_[_0x9c9a('0x4c')](_0x9bb306[_0x9c9a('0x2f')]);_0x5bfb49['filters']=_[_0x9c9a('0x31')](_0x5bfb49[_0x9c9a('0x32')],_0x5bfb49[_0x9c9a('0x2f')]);_0x5da384['attributes']=_[_0x9c9a('0x31')](_0x5bfb49[_0x9c9a('0x32')],qs[_0x9c9a('0x41')](_0x9bb306[_0x9c9a('0x2f')][_0x9c9a('0x41')]));_0x5da384[_0x9c9a('0x33')]=_0x5da384[_0x9c9a('0x33')][_0x9c9a('0x42')]?_0x5da384[_0x9c9a('0x33')]:_0x5bfb49[_0x9c9a('0x32')];_0x5da384[_0x9c9a('0x34')]=qs['sort'](_0x9bb306['query'][_0x9c9a('0x4d')]);_0x5da384['where']=qs[_0x9c9a('0x30')](_['pick'](_0x9bb306[_0x9c9a('0x2f')],_0x5bfb49[_0x9c9a('0x30')]));if(_0x9bb306['query'][_0x9c9a('0x37')]){_0x5da384[_0x9c9a('0x35')]=_[_0x9c9a('0x38')](_0x5da384[_0x9c9a('0x35')],{'$or':_[_0x9c9a('0x29')](_0x5da384[_0x9c9a('0x33')],function(_0x449d2){var _0x3d21e2={};_0x3d21e2[_0x449d2]={'$like':'%'+_0x9bb306[_0x9c9a('0x2f')][_0x9c9a('0x37')]+'%'};return _0x3d21e2;})});}_0x5da384=_[_0x9c9a('0x38')]({},_0x5da384,_0x9bb306[_0x9c9a('0x3a')]);return _0x157615[_0x9c9a('0x4a')](_0x5da384);}})['then'](function(_0x2fcc31){if(_0x2fcc31){_0x33d0f3=_0x2fcc31[_0x9c9a('0x42')];if(!_0x9bb306['query']['hasOwnProperty'](_0x9c9a('0x4e'))){_0x5da384['limit']=qs[_0x9c9a('0x1a')](_0x9bb306[_0x9c9a('0x2f')][_0x9c9a('0x1a')]);_0x5da384[_0x9c9a('0x1d')]=qs[_0x9c9a('0x1d')](_0x9bb306[_0x9c9a('0x2f')][_0x9c9a('0x1d')]);}return _0x157615[_0x9c9a('0x4a')](_0x5da384);}})['then'](function(_0x231d58){if(_0x231d58){return _0x231d58?{'count':_0x33d0f3,'rows':_0x231d58}:null;}})[_0x9c9a('0x22')](respondWithResult(_0x49f5b4,null))[_0x9c9a('0x3e')](handleError(_0x49f5b4,null));};exports[_0x9c9a('0x4f')]=function(_0x426bb8,_0xf1cb72,_0x288108){return db['Action']['find']({'where':{'id':_0x426bb8[_0x9c9a('0x40')]['id']}})[_0x9c9a('0x22')](handleEntityNotFound(_0xf1cb72,null))['then'](function(_0x31df7b){if(_0x31df7b){return _0x31df7b['addActions'](_0x426bb8[_0x9c9a('0x45')][_0x9c9a('0x48')],_[_0x9c9a('0x49')](_0x426bb8['body'],[_0x9c9a('0x48'),'id'])||{});}})[_0x9c9a('0x22')](respondWithResult(_0xf1cb72,null))['catch'](handleError(_0xf1cb72,null));};exports[_0x9c9a('0x50')]=function(_0x3bd217,_0x5a407c,_0x55850b){var _0x1aecfa={};var _0x5d1b1d={};var _0x1056fd;var _0x2a5390;return db[_0x9c9a('0x2a')][_0x9c9a('0x4b')]({'where':{'id':_0x3bd217[_0x9c9a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a407c,null))[_0x9c9a('0x22')](function(_0x44d03b){if(_0x44d03b){_0x1056fd=_0x44d03b;_0x5d1b1d[_0x9c9a('0x32')]=_['keys'](db[_0x9c9a('0x51')][_0x9c9a('0x2b')]);_0x5d1b1d[_0x9c9a('0x2f')]=_['keys'](_0x3bd217[_0x9c9a('0x2f')]);_0x5d1b1d[_0x9c9a('0x30')]=_[_0x9c9a('0x31')](_0x5d1b1d['model'],_0x5d1b1d[_0x9c9a('0x2f')]);_0x1aecfa[_0x9c9a('0x33')]=_[_0x9c9a('0x31')](_0x5d1b1d[_0x9c9a('0x32')],qs['fields'](_0x3bd217[_0x9c9a('0x2f')][_0x9c9a('0x41')]));_0x1aecfa[_0x9c9a('0x33')]=_0x1aecfa[_0x9c9a('0x33')][_0x9c9a('0x42')]?_0x1aecfa[_0x9c9a('0x33')]:_0x5d1b1d[_0x9c9a('0x32')];_0x1aecfa[_0x9c9a('0x34')]=qs['sort'](_0x3bd217[_0x9c9a('0x2f')][_0x9c9a('0x4d')]);_0x1aecfa[_0x9c9a('0x35')]=qs[_0x9c9a('0x30')](_[_0x9c9a('0x36')](_0x3bd217[_0x9c9a('0x2f')],_0x5d1b1d[_0x9c9a('0x30')]));if(_0x3bd217[_0x9c9a('0x2f')][_0x9c9a('0x37')]){_0x1aecfa[_0x9c9a('0x35')]=_[_0x9c9a('0x38')](_0x1aecfa[_0x9c9a('0x35')],{'$or':_[_0x9c9a('0x29')](_0x1aecfa['attributes'],function(_0x458fff){var _0x419495={};_0x419495[_0x458fff]={'$like':'%'+_0x3bd217[_0x9c9a('0x2f')][_0x9c9a('0x37')]+'%'};return _0x419495;})});}_0x1aecfa=_[_0x9c9a('0x38')]({},_0x1aecfa,_0x3bd217[_0x9c9a('0x3a')]);return _0x1056fd['getActions'](_0x1aecfa);}})[_0x9c9a('0x22')](function(_0x441a10){if(_0x441a10){_0x2a5390=_0x441a10[_0x9c9a('0x42')];if(!_0x3bd217[_0x9c9a('0x2f')][_0x9c9a('0x52')](_0x9c9a('0x4e'))){_0x1aecfa[_0x9c9a('0x1a')]=qs[_0x9c9a('0x1a')](_0x3bd217[_0x9c9a('0x2f')][_0x9c9a('0x1a')]);_0x1aecfa[_0x9c9a('0x1d')]=qs[_0x9c9a('0x1d')](_0x3bd217[_0x9c9a('0x2f')][_0x9c9a('0x1d')]);}return _0x1056fd[_0x9c9a('0x50')](_0x1aecfa);}})[_0x9c9a('0x22')](function(_0x1f066e){if(_0x1f066e){return _0x1f066e?{'count':_0x2a5390,'rows':_0x1f066e}:null;}})[_0x9c9a('0x22')](respondWithResult(_0x5a407c,null))[_0x9c9a('0x3e')](handleError(_0x5a407c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2c55ff4..2b729d1 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 _0x23c0=['./automation.attributes','exports','Automation','util','api','bluebird','rimraf','../../config/environment'];(function(_0x246371,_0x3ca7e0){var _0x1da5b5=function(_0x37f80b){while(--_0x37f80b){_0x246371['push'](_0x246371['shift']());}};_0x1da5b5(++_0x3ca7e0);}(_0x23c0,0x1c3));var _0x023c=function(_0x463e5b,_0x52feee){_0x463e5b=_0x463e5b-0x0;var _0x1b5e35=_0x23c0[_0x463e5b];return _0x1b5e35;};'use strict';var _=require('lodash');var util=require(_0x023c('0x0'));var logger=require('../../config/logger')(_0x023c('0x1'));var moment=require('moment');var BPromise=require(_0x023c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x023c('0x3'));var config=require(_0x023c('0x4'));var attributes=require(_0x023c('0x5'));module[_0x023c('0x6')]=function(_0x47f354,_0x2b17ea){return _0x47f354['define'](_0x023c('0x7'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65bf=['Automation','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x65bf,0x1ae));var _0xf65b=function(_0x461eac,_0xc6285d){_0x461eac=_0x461eac-0x0;var _0x57b870=_0x65bf[_0x461eac];return _0x57b870;};'use strict';var _=require('lodash');var util=require(_0xf65b('0x0'));var logger=require(_0xf65b('0x1'))(_0xf65b('0x2'));var moment=require('moment');var BPromise=require(_0xf65b('0x3'));var rp=require(_0xf65b('0x4'));var fs=require('fs');var path=require(_0xf65b('0x5'));var rimraf=require('rimraf');var config=require(_0xf65b('0x6'));var attributes=require(_0xf65b('0x7'));module[_0xf65b('0x8')]=function(_0x5b4d5,_0x2c8dbd){return _0x5b4d5[_0xf65b('0x9')](_0xf65b('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index e9af981..6fc7fdd 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 _0x8f1a=['debug','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x35c12c,_0x378ba0){var _0x2bab3a=function(_0x43eeb2){while(--_0x43eeb2){_0x35c12c['push'](_0x35c12c['shift']());}};_0x2bab3a(++_0x378ba0);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x51f537,_0x5a2b9b){_0x51f537=_0x51f537-0x0;var _0x4b3920=_0x8f1a[_0x51f537];return _0x4b3920;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var moment=require(_0xa8f1('0x2'));var BPromise=require(_0xa8f1('0x3'));var rs=require(_0xa8f1('0x4'));var fs=require('fs');var Redis=require(_0xa8f1('0x5'));var db=require(_0xa8f1('0x6'))['db'];var utils=require(_0xa8f1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8f1('0x9')][_0xa8f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c2920,_0x43c3ed,_0x13f210){return new BPromise(function(_0xcc8a38,_0x36b58b){return client[_0xa8f1('0xb')](_0x4c2920,_0x13f210)[_0xa8f1('0xc')](function(_0x1a23a0){logger[_0xa8f1('0xd')]('Automation,\x20%s,\x20%s',_0x43c3ed,_0xa8f1('0xe'));logger[_0xa8f1('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x43c3ed,_0xa8f1('0xe'),JSON['stringify'](_0x1a23a0));if(_0x1a23a0[_0xa8f1('0x10')]){if(_0x1a23a0[_0xa8f1('0x10')][_0xa8f1('0x11')]===0x1f4){logger['error'](_0xa8f1('0x12'),_0x43c3ed,_0x1a23a0[_0xa8f1('0x10')][_0xa8f1('0x13')]);return _0x36b58b(_0x1a23a0[_0xa8f1('0x10')][_0xa8f1('0x13')]);}logger['error'](_0xa8f1('0x12'),_0x43c3ed,_0x1a23a0['error'][_0xa8f1('0x13')]);return _0xcc8a38(_0x1a23a0[_0xa8f1('0x10')]['message']);}else{logger['info'](_0xa8f1('0x12'),_0x43c3ed,_0xa8f1('0xe'));_0xcc8a38(_0x1a23a0[_0xa8f1('0x14')][_0xa8f1('0x13')]);}})[_0xa8f1('0x15')](function(_0x15bfad){logger[_0xa8f1('0x10')](_0xa8f1('0x12'),_0x43c3ed,_0x15bfad);_0x36b58b(_0x15bfad);});});} \ No newline at end of file +var _0xa848=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x292fb9,_0x3913fa){var _0x23c91b=function(_0x67c914){while(--_0x67c914){_0x292fb9['push'](_0x292fb9['shift']());}};_0x23c91b(++_0x3913fa);}(_0xa848,0x99));var _0x8a84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa848[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a84('0x0'));var util=require(_0x8a84('0x1'));var moment=require(_0x8a84('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a84('0x3'));var fs=require('fs');var Redis=require(_0x8a84('0x4'));var db=require(_0x8a84('0x5'))['db'];var utils=require(_0x8a84('0x6'));var logger=require(_0x8a84('0x7'))(_0x8a84('0x8'));var config=require(_0x8a84('0x9'));var jayson=require(_0x8a84('0xa'));var client=jayson[_0x8a84('0xb')][_0x8a84('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d463b,_0x1b958b,_0x764e89){return new BPromise(function(_0xd33118,_0x5a76f4){return client[_0x8a84('0xd')](_0x1d463b,_0x764e89)[_0x8a84('0xe')](function(_0x2294c8){logger['info'](_0x8a84('0xf'),_0x1b958b,_0x8a84('0x10'));logger[_0x8a84('0x11')](_0x8a84('0x12'),_0x1b958b,_0x8a84('0x10'),JSON[_0x8a84('0x13')](_0x2294c8));if(_0x2294c8[_0x8a84('0x14')]){if(_0x2294c8[_0x8a84('0x14')][_0x8a84('0x15')]===0x1f4){logger[_0x8a84('0x14')](_0x8a84('0xf'),_0x1b958b,_0x2294c8[_0x8a84('0x14')]['message']);return _0x5a76f4(_0x2294c8[_0x8a84('0x14')][_0x8a84('0x16')]);}logger[_0x8a84('0x14')]('Automation,\x20%s,\x20%s',_0x1b958b,_0x2294c8[_0x8a84('0x14')][_0x8a84('0x16')]);return _0xd33118(_0x2294c8[_0x8a84('0x14')]['message']);}else{logger[_0x8a84('0x17')](_0x8a84('0xf'),_0x1b958b,'request\x20sent');_0xd33118(_0x2294c8[_0x8a84('0x18')][_0x8a84('0x16')]);}})[_0x8a84('0x19')](function(_0x209516){logger['error'](_0x8a84('0xf'),_0x1b958b,_0x209516);_0x5a76f4(_0x209516);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 538e8ee..06bdf7f 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 _0x430e=['Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','getConditions','/:id/actions','post','create','/:id/conditions','addConditions','addActions','put','update','delete','destroy','exports','util','path','express'];(function(_0x26b7f7,_0x1533fe){var _0x199e66=function(_0x14357e){while(--_0x14357e){_0x26b7f7['push'](_0x26b7f7['shift']());}};_0x199e66(++_0x1533fe);}(_0x430e,0x105));var _0xe430=function(_0x2fb356,_0x567092){_0x2fb356=_0x2fb356-0x0;var _0x27fb4b=_0x430e[_0x2fb356];return _0x27fb4b;};'use strict';var multer=require('multer');var util=require(_0xe430('0x0'));var path=require(_0xe430('0x1'));var timeout=require('connect-timeout');var express=require(_0xe430('0x2'));var router=express[_0xe430('0x3')]();var fs_extra=require(_0xe430('0x4'));var auth=require(_0xe430('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe430('0x6'));var controller=require(_0xe430('0x7'));router[_0xe430('0x8')]('/',auth[_0xe430('0x9')](),controller['index']);router[_0xe430('0x8')](_0xe430('0xa'),auth[_0xe430('0x9')](),controller[_0xe430('0xb')]);router[_0xe430('0x8')]('/:id/conditions',auth[_0xe430('0x9')](),controller[_0xe430('0xc')]);router[_0xe430('0x8')](_0xe430('0xd'),auth[_0xe430('0x9')](),controller['getActions']);router[_0xe430('0xe')]('/',auth[_0xe430('0x9')](),controller[_0xe430('0xf')]);router[_0xe430('0xe')](_0xe430('0x10'),auth['isAuthenticated'](),controller[_0xe430('0x11')]);router['post']('/:id/actions',auth[_0xe430('0x9')](),controller[_0xe430('0x12')]);router[_0xe430('0x13')](_0xe430('0xa'),auth[_0xe430('0x9')](),controller[_0xe430('0x14')]);router[_0xe430('0x15')]('/:id',auth[_0xe430('0x9')](),controller[_0xe430('0x16')]);module[_0xe430('0x17')]=router; \ No newline at end of file +var _0xb377=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','show','/:id/conditions','isAuthenticated','getConditions','/:id/actions','post','addConditions','addActions','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb377,0x1b6));var _0x7b37=function(_0x37d9f9,_0x42caa7){_0x37d9f9=_0x37d9f9-0x0;var _0x2edaf0=_0xb377[_0x37d9f9];return _0x2edaf0;};'use strict';var multer=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var path=require(_0x7b37('0x2'));var timeout=require(_0x7b37('0x3'));var express=require(_0x7b37('0x4'));var router=express[_0x7b37('0x5')]();var fs_extra=require(_0x7b37('0x6'));var auth=require(_0x7b37('0x7'));var interaction=require(_0x7b37('0x8'));var config=require(_0x7b37('0x9'));var controller=require(_0x7b37('0xa'));router[_0x7b37('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b37('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7b37('0xc')]);router[_0x7b37('0xb')](_0x7b37('0xd'),auth[_0x7b37('0xe')](),controller[_0x7b37('0xf')]);router[_0x7b37('0xb')](_0x7b37('0x10'),auth[_0x7b37('0xe')](),controller['getActions']);router[_0x7b37('0x11')]('/',auth[_0x7b37('0xe')](),controller['create']);router['post'](_0x7b37('0xd'),auth[_0x7b37('0xe')](),controller[_0x7b37('0x12')]);router[_0x7b37('0x11')](_0x7b37('0x10'),auth[_0x7b37('0xe')](),controller[_0x7b37('0x13')]);router[_0x7b37('0x14')](_0x7b37('0x15'),auth[_0x7b37('0xe')](),controller[_0x7b37('0x16')]);router[_0x7b37('0x17')](_0x7b37('0x15'),auth[_0x7b37('0xe')](),controller[_0x7b37('0x18')]);module[_0x7b37('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 8ecaa85..905bb66 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 _0xef6d=['07:00-22:00,*,*,*','ENUM','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'];(function(_0x29f96d,_0x35e5b6){var _0x223056=function(_0x1c2a43){while(--_0x1c2a43){_0x29f96d['push'](_0x29f96d['shift']());}};_0x223056(++_0x35e5b6);}(_0xef6d,0x1df));var _0xdef6=function(_0x4e75bf,_0x3b7e84){_0x4e75bf=_0x4e75bf-0x0;var _0x1e8f3e=_0xef6d[_0x4e75bf];return _0x1e8f3e;};'use strict';var Sequelize=require(_0xdef6('0x0'));module[_0xdef6('0x1')]={'name':{'type':Sequelize[_0xdef6('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdef6('0x3')),'allowNull':![],'defaultValue':_0xdef6('0x3')},'description':{'type':Sequelize[_0xdef6('0x2')]},'active':{'type':Sequelize[_0xdef6('0x4')],'defaultValue':0x0,'comment':_0xdef6('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xdef6('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdef6('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdef6('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xdef6('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xdef6('0x8')](0x3)[_0xdef6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdef6('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdef6('0x8')](0x5)[_0xdef6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdef6('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xdef6('0x8')](0x3)[_0xdef6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdef6('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdef6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdef6('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xdef6('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdef6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdef6('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdef6('0x8')](0x3)[_0xdef6('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdef6('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdef6('0x2')],'defaultValue':_0xdef6('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xdef6('0x10')]('always',_0xdef6('0x11'),_0xdef6('0x12')),'defaultValue':_0xdef6('0x13')},'dialAMDActive':{'type':Sequelize[_0xdef6('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdef6('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdef6('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdef6('0x8')](0x9)[_0xdef6('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xdef6('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xdef6('0x8')](0x9)[_0xdef6('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdef6('0x8')](0x9)[_0xdef6('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdef6('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdef6('0x8')](0x9)[_0xdef6('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdef6('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdef6('0x8')](0x5)[_0xdef6('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdef6('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdef6('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdef6('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdef6('0x10')](_0xdef6('0x1a'),_0xdef6('0x1b')),'defaultValue':_0xdef6('0x1a')},'dialPrefix':{'type':Sequelize[_0xdef6('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdef6('0x8')](0x3)[_0xdef6('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdef6('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xdef6('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdef6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdef6('0x8')](0x5)[_0xdef6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdef6('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdef6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdef6('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdef6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdef6('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdef6('0x8')](0x3)[_0xdef6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdef6('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdef6('0x8')](0x5)[_0xdef6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdef6('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdef6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdef6('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdef6('0x8')](0x5)[_0xdef6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdef6('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdef6('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdef6('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdef6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdef6('0x25')}}; \ No newline at end of file +var _0x672b=['DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x40e6f0,_0x4492e0){var _0x70afa5=function(_0x1acd9d){while(--_0x1acd9d){_0x40e6f0['push'](_0x40e6f0['shift']());}};_0x70afa5(++_0x4492e0);}(_0x672b,0x131));var _0xb672=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x672b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb672('0x0'));module[_0xb672('0x1')]={'name':{'type':Sequelize[_0xb672('0x2')],'unique':_0xb672('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb672('0x4')](_0xb672('0x5')),'allowNull':![],'defaultValue':_0xb672('0x5')},'description':{'type':Sequelize[_0xb672('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb672('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb672('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb672('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xb672('0x8')](0x3)[_0xb672('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb672('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb672('0x8')](0x3)[_0xb672('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb672('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb672('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb672('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xb672('0x8')](0x3)[_0xb672('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb672('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb672('0x8')](0x5)[_0xb672('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb672('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb672('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb672('0x8')](0x5)[_0xb672('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb672('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb672('0x8')](0x3)[_0xb672('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb672('0x10')},'dialTimezone':{'type':Sequelize[_0xb672('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb672('0x2')],'defaultValue':_0xb672('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xb672('0x12'),_0xb672('0x13'),_0xb672('0x14')),'defaultValue':_0xb672('0x12')},'dialAMDActive':{'type':Sequelize[_0xb672('0x15')],'defaultValue':0x0,'comment':_0xb672('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0xb672('0x8')](0x9)[_0xb672('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb672('0x17')},'dialAMDGreeting':{'type':Sequelize[_0xb672('0x8')](0x9)[_0xb672('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb672('0x18')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb672('0x8')](0x9)[_0xb672('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb672('0x19')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb672('0x8')](0x9)[_0xb672('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb672('0x1a')},'dialAMDMinWordLength':{'type':Sequelize[_0xb672('0x8')](0x9)[_0xb672('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb672('0x1b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb672('0x8')](0x9)[_0xb672('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb672('0x8')](0x9)[_0xb672('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb672('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb672('0x8')](0x5)[_0xb672('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb672('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb672('0x8')](0x9)[_0xb672('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb672('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb672('0x4')](_0xb672('0x1f'),_0xb672('0x20')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb672('0x8')](0x3)[_0xb672('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb672('0x21')},'dialCutDigit':{'type':Sequelize[_0xb672('0x8')](0x3)[_0xb672('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb672('0x22')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb672('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb672('0x23')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb672('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb672('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb672('0x24')},'dialDropRetryFrequency':{'type':Sequelize[_0xb672('0x8')](0x5)[_0xb672('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb672('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb672('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb672('0x26')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb672('0x8')](0x5)[_0xb672('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb672('0x27')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xb672('0x8')](0x5)[_0xb672('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb672('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb672('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb672('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb672('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 1911a27..3060276 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 _0x16d1=['attributes','fields','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','userProfileId','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','YYYY-MM-DD\x20HH:mm:ss','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','sendStatus','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','key','keys','query','filters','intersection','model'];(function(_0x4cf2bb,_0xc26020){var _0x44e779=function(_0x371446){while(--_0x371446){_0x4cf2bb['push'](_0x4cf2bb['shift']());}};_0x44e779(++_0xc26020);}(_0x16d1,0xf7));var _0x116d=function(_0x259aab,_0x3c2b69){_0x259aab=_0x259aab-0x0;var _0x2824b1=_0x16d1[_0x259aab];return _0x2824b1;};'use strict';var emlformat=require(_0x116d('0x0'));var rimraf=require(_0x116d('0x1'));var zipdir=require(_0x116d('0x2'));var jsonpatch=require(_0x116d('0x3'));var rp=require(_0x116d('0x4'));var moment=require('moment');var BPromise=require(_0x116d('0x5'));var Mustache=require('mustache');var util=require(_0x116d('0x6'));var path=require(_0x116d('0x7'));var sox=require(_0x116d('0x8'));var csv=require('to-csv');var ejs=require(_0x116d('0x9'));var fs=require('fs');var fs_extra=require(_0x116d('0xa'));var _=require(_0x116d('0xb'));var squel=require('squel');var crypto=require(_0x116d('0xc'));var jsforce=require(_0x116d('0xd'));var deskjs=require(_0x116d('0xe'));var toCsv=require(_0x116d('0xf'));var querystring=require(_0x116d('0x10'));var Papa=require(_0x116d('0x11'));var Redis=require(_0x116d('0x12'));var authService=require(_0x116d('0x13'));var qs=require(_0x116d('0x14'));var as=require(_0x116d('0x15'));var hardwareService=require(_0x116d('0x16'));var logger=require(_0x116d('0x17'))(_0x116d('0x18'));var utils=require(_0x116d('0x19'));var config=require(_0x116d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4471cd,_0x51c4a5){_0x51c4a5=_0x51c4a5||0xcc;return function(_0x17ef0b){if(_0x17ef0b){return _0x4471cd['sendStatus'](_0x51c4a5);}return _0x4471cd[_0x116d('0x1b')](_0x51c4a5)[_0x116d('0x1c')]();};}function respondWithResult(_0x3e40db,_0x2df82e){_0x2df82e=_0x2df82e||0xc8;return function(_0x239502){if(_0x239502){return _0x3e40db[_0x116d('0x1b')](_0x2df82e)[_0x116d('0x1d')](_0x239502);}};}function respondWithFilteredResult(_0x431381,_0x5d3f12){return function(_0x79c787){if(_0x79c787){var _0x4d323b=typeof _0x5d3f12[_0x116d('0x1e')]===_0x116d('0x1f')&&typeof _0x5d3f12[_0x116d('0x20')]===_0x116d('0x1f');var _0x503d43=_0x79c787[_0x116d('0x21')];var _0x16f75d=_0x4d323b?0x0:_0x5d3f12[_0x116d('0x1e')];var _0x527211=_0x4d323b?_0x79c787[_0x116d('0x21')]:_0x5d3f12['offset']+_0x5d3f12[_0x116d('0x20')];var _0x4e783d;if(_0x527211>=_0x503d43){_0x527211=_0x503d43;_0x4e783d=0xc8;}else{_0x4e783d=0xce;}_0x431381['status'](_0x4e783d);return _0x431381['set'](_0x116d('0x22'),_0x16f75d+'-'+_0x527211+'/'+_0x503d43)[_0x116d('0x1d')](_0x79c787);}return null;};}function patchUpdates(_0x466928){return function(_0x1177f6){try{jsonpatch[_0x116d('0x23')](_0x1177f6,_0x466928,!![]);}catch(_0x5aaf80){return BPromise[_0x116d('0x24')](_0x5aaf80);}return _0x1177f6[_0x116d('0x25')]();};}function saveUpdates(_0x36da9a,_0x4dae8c){return function(_0x3eef37){if(_0x3eef37){return _0x3eef37[_0x116d('0x26')](_0x36da9a)[_0x116d('0x27')](function(_0x4db1ee){return _0x4db1ee;});}return null;};}function removeEntity(_0x3dc071,_0x50f05c){return function(_0x4b7268){if(_0x4b7268){return _0x4b7268[_0x116d('0x28')]()['then'](function(){var _0x5a90bd=_0x4b7268[_0x116d('0x29')]({'plain':!![]});var _0x25b9b9=_0x116d('0x2a');return db['UserProfileResource'][_0x116d('0x28')]({'where':{'type':_0x25b9b9,'resourceId':_0x5a90bd['id']}})[_0x116d('0x27')](function(){return _0x4b7268;});})['then'](function(){_0x3dc071[_0x116d('0x1b')](0xcc)[_0x116d('0x1c')]();});}};}function handleEntityNotFound(_0x519588,_0x464b16){return function(_0x14ae6f){if(!_0x14ae6f){_0x519588[_0x116d('0x2b')](0x194);}return _0x14ae6f;};}function handleError(_0x2024b3,_0x27b0f7){_0x27b0f7=_0x27b0f7||0x1f4;return function(_0x59618c){logger[_0x116d('0x2c')](_0x59618c[_0x116d('0x2d')]);if(_0x59618c[_0x116d('0x2e')]){delete _0x59618c[_0x116d('0x2e')];}_0x2024b3['status'](_0x27b0f7)[_0x116d('0x2f')](_0x59618c);};}exports[_0x116d('0x30')]=function(_0x324f3c,_0x4c3509){var _0xf9abe2={},_0x4918e0={},_0x27e1e0={'count':0x0,'rows':[]};var _0x3fa09e=_[_0x116d('0x31')](db[_0x116d('0x32')][_0x116d('0x33')],function(_0x279f2){return{'name':_0x279f2[_0x116d('0x34')],'type':_0x279f2['type'][_0x116d('0x35')]};});_0x4918e0['model']=_[_0x116d('0x31')](_0x3fa09e,_0x116d('0x2e'));_0x4918e0['query']=_[_0x116d('0x36')](_0x324f3c[_0x116d('0x37')]);_0x4918e0[_0x116d('0x38')]=_[_0x116d('0x39')](_0x4918e0[_0x116d('0x3a')],_0x4918e0[_0x116d('0x37')]);_0xf9abe2[_0x116d('0x3b')]=_['intersection'](_0x4918e0[_0x116d('0x3a')],qs['fields'](_0x324f3c[_0x116d('0x37')][_0x116d('0x3c')]));_0xf9abe2[_0x116d('0x3b')]=_0xf9abe2[_0x116d('0x3b')]['length']?_0xf9abe2[_0x116d('0x3b')]:_0x4918e0[_0x116d('0x3a')];if(!_0x324f3c[_0x116d('0x37')]['hasOwnProperty']('nolimit')){_0xf9abe2[_0x116d('0x20')]=qs[_0x116d('0x20')](_0x324f3c[_0x116d('0x37')][_0x116d('0x20')]);_0xf9abe2[_0x116d('0x1e')]=qs[_0x116d('0x1e')](_0x324f3c['query'][_0x116d('0x1e')]);}_0xf9abe2[_0x116d('0x3d')]=qs[_0x116d('0x3e')](_0x324f3c[_0x116d('0x37')][_0x116d('0x3e')]);_0xf9abe2[_0x116d('0x3f')]=qs[_0x116d('0x38')](_[_0x116d('0x40')](_0x324f3c[_0x116d('0x37')],_0x4918e0[_0x116d('0x38')]),_0x3fa09e);if(_0x324f3c['query'][_0x116d('0x41')]){_0xf9abe2[_0x116d('0x3f')]=_[_0x116d('0x42')](_0xf9abe2[_0x116d('0x3f')],{'$or':_[_0x116d('0x31')](_0x3fa09e,function(_0x2b8138){if(_0x2b8138[_0x116d('0x43')]!=='VIRTUAL'){var _0x2716c1={};_0x2716c1[_0x2b8138[_0x116d('0x2e')]]={'$like':'%'+_0x324f3c[_0x116d('0x37')]['filter']+'%'};return _0x2716c1;}})});}_0xf9abe2=_[_0x116d('0x42')]({},_0xf9abe2,_0x324f3c[_0x116d('0x44')]);var _0x152cd2={'where':_0xf9abe2['where']};return db[_0x116d('0x32')][_0x116d('0x21')](_0x152cd2)[_0x116d('0x27')](function(_0x446870){_0x27e1e0[_0x116d('0x21')]=_0x446870;if(_0x324f3c[_0x116d('0x37')][_0x116d('0x45')]){_0xf9abe2[_0x116d('0x46')]=[{'all':!![]}];}return db[_0x116d('0x32')][_0x116d('0x47')](_0xf9abe2);})[_0x116d('0x27')](function(_0x4fc6d8){_0x27e1e0[_0x116d('0x48')]=_0x4fc6d8;return _0x27e1e0;})[_0x116d('0x27')](respondWithFilteredResult(_0x4c3509,_0xf9abe2))['catch'](handleError(_0x4c3509,null));};exports[_0x116d('0x49')]=function(_0x3df272,_0x22eed2){var _0x5f30c9={'raw':![],'where':{'id':_0x3df272[_0x116d('0x4a')]['id']}},_0x50f72e={};_0x50f72e[_0x116d('0x3a')]=_[_0x116d('0x36')](db[_0x116d('0x32')]['rawAttributes']);_0x50f72e[_0x116d('0x37')]=_[_0x116d('0x36')](_0x3df272[_0x116d('0x37')]);_0x50f72e[_0x116d('0x38')]=_['intersection'](_0x50f72e[_0x116d('0x3a')],_0x50f72e[_0x116d('0x37')]);_0x5f30c9[_0x116d('0x3b')]=_['intersection'](_0x50f72e[_0x116d('0x3a')],qs[_0x116d('0x3c')](_0x3df272[_0x116d('0x37')][_0x116d('0x3c')]));_0x5f30c9[_0x116d('0x3b')]=_0x5f30c9[_0x116d('0x3b')][_0x116d('0x4b')]?_0x5f30c9[_0x116d('0x3b')]:_0x50f72e[_0x116d('0x3a')];if(_0x3df272[_0x116d('0x37')]['includeAll']){_0x5f30c9[_0x116d('0x46')]=[{'all':!![]}];}_0x5f30c9=_[_0x116d('0x42')]({},_0x5f30c9,_0x3df272[_0x116d('0x44')]);return db[_0x116d('0x32')][_0x116d('0x4c')](_0x5f30c9)[_0x116d('0x27')](handleEntityNotFound(_0x22eed2,null))[_0x116d('0x27')](respondWithResult(_0x22eed2,null))[_0x116d('0x4d')](handleError(_0x22eed2,null));};exports[_0x116d('0x4e')]=function(_0x397154,_0x2f2690){return db[_0x116d('0x32')][_0x116d('0x4e')](_0x397154['body'],{})[_0x116d('0x27')](function(_0x586d27){var _0xe5917f=_0x397154[_0x116d('0x4f')]['get']({'plain':!![]});if(!_0xe5917f)throw new Error(_0x116d('0x50'));if(_0xe5917f[_0x116d('0x51')]===_0x116d('0x4f')){var _0x5420ff=_0x586d27[_0x116d('0x29')]({'plain':!![]});var _0x2291bb=_0x116d('0x2a');return db[_0x116d('0x52')]['find']({'where':{'name':_0x2291bb,'userProfileId':_0xe5917f['userProfileId']},'raw':!![]})[_0x116d('0x27')](function(_0x20ddf3){if(_0x20ddf3&&_0x20ddf3[_0x116d('0x53')]===0x0){return db[_0x116d('0x54')][_0x116d('0x4e')]({'name':_0x5420ff['name'],'resourceId':_0x5420ff['id'],'type':_0x20ddf3[_0x116d('0x2e')],'sectionId':_0x20ddf3['id']},{})[_0x116d('0x27')](function(){return _0x586d27;});}else{return _0x586d27;}})[_0x116d('0x4d')](function(_0x1eba28){logger[_0x116d('0x2c')](_0x116d('0x55'),_0x1eba28);throw _0x1eba28;});}return _0x586d27;})['then'](respondWithResult(_0x2f2690,0xc9))[_0x116d('0x4d')](handleError(_0x2f2690,null));};exports[_0x116d('0x56')]=function(_0x5e988a,_0x3c8299){var _0x517d85={'where':{'id':_0x5e988a[_0x116d('0x4a')]['id']}},_0xf505cc={};_0xf505cc[_0x116d('0x3a')]=_[_0x116d('0x36')](db[_0x116d('0x32')][_0x116d('0x33')]);_0x517d85[_0x116d('0x3b')]=_[_0x116d('0x39')](_0xf505cc[_0x116d('0x3a')],qs[_0x116d('0x3c')](_0x5e988a[_0x116d('0x37')]['fields']));_0x517d85[_0x116d('0x3b')]=_0x517d85['attributes'][_0x116d('0x4b')]?_0x517d85[_0x116d('0x3b')]:_0xf505cc['model'];if(_0x5e988a['query'][_0x116d('0x45')]){_0x517d85['include']=[{'all':!![]}];}_0x517d85=_['merge']({},_0x517d85,_0x5e988a[_0x116d('0x44')]);return db[_0x116d('0x32')][_0x116d('0x4c')](_0x517d85)[_0x116d('0x27')](handleEntityNotFound(_0x3c8299,null))[_0x116d('0x27')](function(_0x288144){if(_0x288144){var _0x1d033d=_0x288144['get']({'plain':!![]});_0x1d033d=qs[_0x116d('0x57')](_0x1d033d,['id',_0x116d('0x58'),_0x116d('0x59')]);_0x5e988a[_0x116d('0x5a')]=_['omit'](_0x5e988a[_0x116d('0x5a')],['id','createdAt',_0x116d('0x59')]);return db[_0x116d('0x32')][_0x116d('0x4e')](_[_0x116d('0x42')](_0x1d033d,_0x5e988a[_0x116d('0x5a')]),{'include':_0x5e988a['query'][_0x116d('0x45')]?[{'all':!![]}]:undefined})[_0x116d('0x27')](function(_0xe7d18b){var _0xad15b6=_0x5e988a[_0x116d('0x4f')][_0x116d('0x29')]({'plain':!![]});if(!_0xad15b6)throw new Error(_0x116d('0x50'));if(_0xad15b6['role']==='user'){var _0x42fb07=_0xe7d18b[_0x116d('0x29')]({'plain':!![]});var _0x3d510e=_0x116d('0x2a');return db['UserProfileSection'][_0x116d('0x4c')]({'where':{'name':_0x3d510e,'userProfileId':_0xad15b6[_0x116d('0x5b')]},'raw':!![]})['then'](function(_0x5bf417){if(_0x5bf417&&_0x5bf417['autoAssociation']===0x0){return db['UserProfileResource'][_0x116d('0x4e')]({'name':_0x42fb07[_0x116d('0x2e')],'resourceId':_0x42fb07['id'],'type':_0x5bf417[_0x116d('0x2e')],'sectionId':_0x5bf417['id']},{})['then'](function(){return _0xe7d18b;});}else{return _0xe7d18b;}})[_0x116d('0x4d')](function(_0x1a6014){logger['error'](_0x116d('0x55'),_0x1a6014);throw _0x1a6014;});}return _0xe7d18b;});}})[_0x116d('0x27')](respondWithResult(_0x3c8299,0xc9))[_0x116d('0x4d')](handleError(_0x3c8299,null));};exports[_0x116d('0x26')]=function(_0xaf50cf,_0x3d28b6){if(_0xaf50cf[_0x116d('0x5a')]['id']){delete _0xaf50cf[_0x116d('0x5a')]['id'];}return db['Campaign']['find']({'where':{'id':_0xaf50cf['params']['id']}})[_0x116d('0x27')](handleEntityNotFound(_0x3d28b6,null))['then'](saveUpdates(_0xaf50cf['body'],null))[_0x116d('0x27')](respondWithResult(_0x3d28b6,null))[_0x116d('0x4d')](handleError(_0x3d28b6,null));};exports[_0x116d('0x28')]=function(_0x3bb363,_0x5265b7){return db[_0x116d('0x32')][_0x116d('0x4c')]({'where':{'id':_0x3bb363[_0x116d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5265b7,null))[_0x116d('0x27')](removeEntity(_0x5265b7,null))[_0x116d('0x4d')](handleError(_0x5265b7,null));};exports[_0x116d('0x5c')]=function(_0x418773,_0x1e2117,_0x28d201){var _0x32fa2c={'raw':!![],'where':{}};var _0x44453b={};var _0x5472ef={'count':0x0,'rows':[]};return db[_0x116d('0x32')][_0x116d('0x5d')]({'where':{'id':_0x418773[_0x116d('0x4a')]['id']}})[_0x116d('0x27')](handleEntityNotFound(_0x1e2117,null))[_0x116d('0x27')](function(_0x56dbcf){if(_0x56dbcf){_0x44453b[_0x116d('0x3a')]=_[_0x116d('0x36')](db[_0x116d('0x5e')]['rawAttributes']);_0x44453b[_0x116d('0x37')]=_['keys'](_0x418773[_0x116d('0x37')]);_0x44453b['filters']=_['intersection'](_0x44453b[_0x116d('0x3a')],_0x44453b[_0x116d('0x37')]);_0x32fa2c['attributes']=_[_0x116d('0x39')](_0x44453b['model'],qs[_0x116d('0x3c')](_0x418773[_0x116d('0x37')][_0x116d('0x3c')]));_0x32fa2c[_0x116d('0x3b')]=_0x32fa2c[_0x116d('0x3b')][_0x116d('0x4b')]?_0x32fa2c[_0x116d('0x3b')]:_0x44453b[_0x116d('0x3a')];if(!_0x418773[_0x116d('0x37')][_0x116d('0x5f')](_0x116d('0x60'))){_0x32fa2c[_0x116d('0x20')]=qs[_0x116d('0x20')](_0x418773[_0x116d('0x37')]['limit']);_0x32fa2c['offset']=qs[_0x116d('0x1e')](_0x418773[_0x116d('0x37')]['offset']);}_0x32fa2c[_0x116d('0x3d')]=qs[_0x116d('0x3e')](_0x418773[_0x116d('0x37')]['sort']);_0x32fa2c[_0x116d('0x3f')]=qs[_0x116d('0x38')](_[_0x116d('0x40')](_0x418773[_0x116d('0x37')],_0x44453b[_0x116d('0x38')]));_0x32fa2c[_0x116d('0x3f')][_0x116d('0x61')]=_0x56dbcf['id'];if(_0x418773[_0x116d('0x37')][_0x116d('0x41')]){_0x32fa2c[_0x116d('0x3f')]=_[_0x116d('0x42')](_0x32fa2c[_0x116d('0x3f')],{'$or':_['map'](_0x32fa2c[_0x116d('0x3b')],function(_0x1b093a){var _0x8da400={};_0x8da400[_0x1b093a]={'$like':'%'+_0x418773[_0x116d('0x37')][_0x116d('0x41')]+'%'};return _0x8da400;})});}_0x32fa2c=_[_0x116d('0x42')]({},_0x32fa2c,_0x418773[_0x116d('0x44')]);return db[_0x116d('0x5e')]['count']({'where':_0x32fa2c['where']})['then'](function(_0x485fd7){_0x5472ef['count']=_0x485fd7;if(_0x418773[_0x116d('0x37')][_0x116d('0x45')]){_0x32fa2c[_0x116d('0x46')]=[{'all':!![]}];}return db['CmHopper'][_0x116d('0x47')](_0x32fa2c);})[_0x116d('0x27')](function(_0x443d52){_0x5472ef[_0x116d('0x48')]=_0x443d52;return _0x5472ef;});}})['then'](respondWithFilteredResult(_0x1e2117,_0x32fa2c))[_0x116d('0x4d')](handleError(_0x1e2117,null));};exports[_0x116d('0x62')]=function(_0x2317ed,_0x3775e7,_0x2f1266){var _0x2f0b6a={'raw':!![],'where':{}};var _0x4a5a60={};var _0x4deff2={'count':0x0,'rows':[]};return db[_0x116d('0x32')][_0x116d('0x5d')]({'where':{'id':_0x2317ed[_0x116d('0x4a')]['id']}})[_0x116d('0x27')](handleEntityNotFound(_0x3775e7,null))['then'](function(_0x536c61){if(_0x536c61){_0x4a5a60[_0x116d('0x3a')]=_['keys'](db[_0x116d('0x63')]['rawAttributes']);_0x4a5a60[_0x116d('0x37')]=_[_0x116d('0x36')](_0x2317ed[_0x116d('0x37')]);_0x4a5a60['filters']=_['intersection'](_0x4a5a60['model'],_0x4a5a60[_0x116d('0x37')]);_0x2f0b6a[_0x116d('0x3b')]=_[_0x116d('0x39')](_0x4a5a60[_0x116d('0x3a')],qs[_0x116d('0x3c')](_0x2317ed[_0x116d('0x37')]['fields']));_0x2f0b6a['attributes']=_0x2f0b6a[_0x116d('0x3b')][_0x116d('0x4b')]?_0x2f0b6a[_0x116d('0x3b')]:_0x4a5a60[_0x116d('0x3a')];if(!_0x2317ed['query'][_0x116d('0x5f')](_0x116d('0x60'))){_0x2f0b6a[_0x116d('0x20')]=qs[_0x116d('0x20')](_0x2317ed[_0x116d('0x37')][_0x116d('0x20')]);_0x2f0b6a[_0x116d('0x1e')]=qs[_0x116d('0x1e')](_0x2317ed[_0x116d('0x37')][_0x116d('0x1e')]);}_0x2f0b6a[_0x116d('0x3d')]=qs[_0x116d('0x3e')](_0x2317ed[_0x116d('0x37')][_0x116d('0x3e')]);_0x2f0b6a[_0x116d('0x3f')]=qs['filters'](_[_0x116d('0x40')](_0x2317ed['query'],_0x4a5a60[_0x116d('0x38')]));_0x2f0b6a[_0x116d('0x3f')]['CampaignId']=_0x536c61['id'];if(_0x2317ed[_0x116d('0x37')]['filter']){_0x2f0b6a[_0x116d('0x3f')]=_[_0x116d('0x42')](_0x2f0b6a[_0x116d('0x3f')],{'$or':_['map'](_0x2f0b6a[_0x116d('0x3b')],function(_0x2dd027){var _0x24b9a8={};_0x24b9a8[_0x2dd027]={'$like':'%'+_0x2317ed[_0x116d('0x37')][_0x116d('0x41')]+'%'};return _0x24b9a8;})});}_0x2f0b6a=_[_0x116d('0x42')]({},_0x2f0b6a,_0x2317ed[_0x116d('0x44')]);return db[_0x116d('0x63')]['count']({'where':_0x2f0b6a['where']})[_0x116d('0x27')](function(_0x496997){_0x4deff2[_0x116d('0x21')]=_0x496997;if(_0x2317ed[_0x116d('0x37')][_0x116d('0x45')]){_0x2f0b6a['include']=[{'all':!![]}];}return db[_0x116d('0x63')][_0x116d('0x47')](_0x2f0b6a);})['then'](function(_0x47d8d2){_0x4deff2[_0x116d('0x48')]=_0x47d8d2;return _0x4deff2;});}})[_0x116d('0x27')](respondWithFilteredResult(_0x3775e7,_0x2f0b6a))[_0x116d('0x4d')](handleError(_0x3775e7,null));};exports[_0x116d('0x64')]=function(_0x2db20f,_0x150136,_0x278b7d){var _0x26d354={'raw':!![],'where':{}};var _0x3048c1={};var _0x3e1903={'count':0x0,'rows':[]};return db[_0x116d('0x32')][_0x116d('0x5d')]({'where':{'id':_0x2db20f[_0x116d('0x4a')]['id']}})[_0x116d('0x27')](handleEntityNotFound(_0x150136,null))[_0x116d('0x27')](function(_0x39f0e8){if(_0x39f0e8){_0x3048c1[_0x116d('0x3a')]=_[_0x116d('0x36')](db['CmHopperFinal'][_0x116d('0x33')]);_0x3048c1['query']=_[_0x116d('0x36')](_0x2db20f['query']);_0x3048c1[_0x116d('0x38')]=_[_0x116d('0x39')](_0x3048c1['model'],_0x3048c1[_0x116d('0x37')]);_0x26d354['attributes']=_[_0x116d('0x39')](_0x3048c1[_0x116d('0x3a')],qs[_0x116d('0x3c')](_0x2db20f['query'][_0x116d('0x3c')]));_0x26d354[_0x116d('0x3b')]=_0x26d354[_0x116d('0x3b')][_0x116d('0x4b')]?_0x26d354[_0x116d('0x3b')]:_0x3048c1[_0x116d('0x3a')];if(!_0x2db20f['query'][_0x116d('0x5f')](_0x116d('0x60'))){_0x26d354[_0x116d('0x20')]=qs[_0x116d('0x20')](_0x2db20f[_0x116d('0x37')]['limit']);_0x26d354[_0x116d('0x1e')]=qs['offset'](_0x2db20f[_0x116d('0x37')][_0x116d('0x1e')]);}_0x26d354[_0x116d('0x3d')]=qs['sort'](_0x2db20f[_0x116d('0x37')][_0x116d('0x3e')]);_0x26d354['where']=qs[_0x116d('0x38')](_[_0x116d('0x40')](_0x2db20f[_0x116d('0x37')],_0x3048c1[_0x116d('0x38')]));_0x26d354[_0x116d('0x3f')]['CampaignId']=_0x39f0e8['id'];if(_0x2db20f['query']['filter']){_0x26d354['where']=_[_0x116d('0x42')](_0x26d354[_0x116d('0x3f')],{'$or':_[_0x116d('0x31')](_0x26d354[_0x116d('0x3b')],function(_0x38c38a){var _0x27483e={};_0x27483e[_0x38c38a]={'$like':'%'+_0x2db20f[_0x116d('0x37')][_0x116d('0x41')]+'%'};return _0x27483e;})});}_0x26d354=_['merge']({},_0x26d354,_0x2db20f[_0x116d('0x44')]);return db[_0x116d('0x65')]['count']({'where':_0x26d354[_0x116d('0x3f')]})[_0x116d('0x27')](function(_0x2e6a9b){_0x3e1903['count']=_0x2e6a9b;if(_0x2db20f[_0x116d('0x37')][_0x116d('0x45')]){_0x26d354[_0x116d('0x46')]=[{'all':!![]}];}return db[_0x116d('0x65')][_0x116d('0x47')](_0x26d354);})[_0x116d('0x27')](function(_0x57a4e6){_0x3e1903[_0x116d('0x48')]=_0x57a4e6;return _0x3e1903;});}})[_0x116d('0x27')](respondWithFilteredResult(_0x150136,_0x26d354))['catch'](handleError(_0x150136,null));};exports[_0x116d('0x66')]=function(_0x18085e,_0x3587aa,_0x4388c0){var _0x4979ed={'raw':!![],'where':{}};var _0x3e2953={};var _0x52c2a9={'count':0x0,'rows':[]};return db[_0x116d('0x32')][_0x116d('0x5d')]({'where':{'id':_0x18085e[_0x116d('0x4a')]['id']}})[_0x116d('0x27')](handleEntityNotFound(_0x3587aa,null))['then'](function(_0x57b469){if(_0x57b469){_0x3e2953[_0x116d('0x3a')]=_['keys'](db[_0x116d('0x67')][_0x116d('0x33')]);_0x3e2953['query']=_[_0x116d('0x36')](_0x18085e['query']);_0x3e2953[_0x116d('0x38')]=_['intersection'](_0x3e2953['model'],_0x3e2953[_0x116d('0x37')]);_0x4979ed[_0x116d('0x3b')]=_['intersection'](_0x3e2953[_0x116d('0x3a')],qs[_0x116d('0x3c')](_0x18085e['query'][_0x116d('0x3c')]));_0x4979ed[_0x116d('0x3b')]=_0x4979ed['attributes'][_0x116d('0x4b')]?_0x4979ed['attributes']:_0x3e2953[_0x116d('0x3a')];if(!_0x18085e[_0x116d('0x37')][_0x116d('0x5f')](_0x116d('0x60'))){_0x4979ed[_0x116d('0x20')]=qs[_0x116d('0x20')](_0x18085e[_0x116d('0x37')][_0x116d('0x20')]);_0x4979ed[_0x116d('0x1e')]=qs[_0x116d('0x1e')](_0x18085e[_0x116d('0x37')]['offset']);}_0x4979ed[_0x116d('0x3d')]=qs[_0x116d('0x3e')](_0x18085e[_0x116d('0x37')][_0x116d('0x3e')]);_0x4979ed['where']=qs[_0x116d('0x38')](_[_0x116d('0x40')](_0x18085e['query'],_0x3e2953[_0x116d('0x38')]));_0x4979ed[_0x116d('0x3f')][_0x116d('0x61')]=_0x57b469['id'];if(_0x18085e[_0x116d('0x37')][_0x116d('0x41')]){_0x4979ed[_0x116d('0x3f')]=_[_0x116d('0x42')](_0x4979ed[_0x116d('0x3f')],{'$or':_[_0x116d('0x31')](_0x4979ed[_0x116d('0x3b')],function(_0x4d68e3){var _0x580ad5={};_0x580ad5[_0x4d68e3]={'$like':'%'+_0x18085e[_0x116d('0x37')]['filter']+'%'};return _0x580ad5;})});}_0x4979ed=_['merge']({},_0x4979ed,_0x18085e[_0x116d('0x44')]);return db['CmHopperBlack'][_0x116d('0x21')]({'where':_0x4979ed[_0x116d('0x3f')]})[_0x116d('0x27')](function(_0xd9e310){_0x52c2a9[_0x116d('0x21')]=_0xd9e310;if(_0x18085e[_0x116d('0x37')][_0x116d('0x45')]){_0x4979ed[_0x116d('0x46')]=[{'all':!![]}];}return db[_0x116d('0x67')][_0x116d('0x47')](_0x4979ed);})[_0x116d('0x27')](function(_0x3d45c4){_0x52c2a9[_0x116d('0x48')]=_0x3d45c4;return _0x52c2a9;});}})[_0x116d('0x27')](respondWithFilteredResult(_0x3587aa,_0x4979ed))['catch'](handleError(_0x3587aa,null));};exports[_0x116d('0x68')]=function(_0x16214f,_0x44009a,_0x55c06d){var _0x5befd5={};var _0x5e6e50={};var _0xae0b19;var _0x4a6f2e;return db[_0x116d('0x32')]['findOne']({'where':{'id':_0x16214f[_0x116d('0x4a')]['id']}})[_0x116d('0x27')](handleEntityNotFound(_0x44009a,null))['then'](function(_0x5dfe6f){if(_0x5dfe6f){_0xae0b19=_0x5dfe6f;_0x5e6e50[_0x116d('0x3a')]=_[_0x116d('0x36')](db[_0x116d('0x69')]['rawAttributes']);_0x5e6e50[_0x116d('0x37')]=_['keys'](_0x16214f[_0x116d('0x37')]);_0x5e6e50['filters']=_[_0x116d('0x39')](_0x5e6e50[_0x116d('0x3a')],_0x5e6e50[_0x116d('0x37')]);_0x5befd5[_0x116d('0x3b')]=_[_0x116d('0x39')](_0x5e6e50[_0x116d('0x3a')],qs['fields'](_0x16214f[_0x116d('0x37')]['fields']));_0x5befd5[_0x116d('0x3b')]=_0x5befd5[_0x116d('0x3b')]['length']?_0x5befd5[_0x116d('0x3b')]:_0x5e6e50[_0x116d('0x3a')];_0x5befd5[_0x116d('0x3d')]=qs['sort'](_0x16214f[_0x116d('0x37')][_0x116d('0x3e')]);_0x5befd5[_0x116d('0x3f')]=qs['filters'](_[_0x116d('0x40')](_0x16214f[_0x116d('0x37')],_0x5e6e50['filters']));if(_0x16214f[_0x116d('0x37')][_0x116d('0x41')]){_0x5befd5['where']=_[_0x116d('0x42')](_0x5befd5[_0x116d('0x3f')],{'$or':_[_0x116d('0x31')](_0x5befd5[_0x116d('0x3b')],function(_0x7b15b2){var _0xa5dbcf={};_0xa5dbcf[_0x7b15b2]={'$like':'%'+_0x16214f['query'][_0x116d('0x41')]+'%'};return _0xa5dbcf;})});}_0x5befd5=_['merge']({},_0x5befd5,_0x16214f[_0x116d('0x44')]);return _0xae0b19['getLists'](_0x5befd5);}})[_0x116d('0x27')](function(_0x27c5a7){if(_0x27c5a7){_0x4a6f2e=_0x27c5a7['length'];if(!_0x16214f[_0x116d('0x37')][_0x116d('0x5f')]('nolimit')){_0x5befd5['limit']=qs[_0x116d('0x20')](_0x16214f[_0x116d('0x37')][_0x116d('0x20')]);_0x5befd5['offset']=qs[_0x116d('0x1e')](_0x16214f[_0x116d('0x37')]['offset']);}return _0xae0b19['getLists'](_0x5befd5);}})['then'](function(_0x4b3b11){if(_0x4b3b11){return _0x4b3b11?{'count':_0x4a6f2e,'rows':_0x4b3b11}:null;}})[_0x116d('0x27')](respondWithResult(_0x44009a,null))[_0x116d('0x4d')](handleError(_0x44009a,null));};exports['addLists']=function(_0x66cbcd,_0x188b5f,_0x4cc913){var _0x10bc73,_0x53a8e9;var _0x3e05dc=[];var _0x1b08a9=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0x116d('0x32')][_0x116d('0x4c')]({'where':{'id':_0x66cbcd['params']['id']}})[_0x116d('0x27')](handleEntityNotFound(_0x188b5f,null))[_0x116d('0x27')](function(_0x14d3ba){if(_0x14d3ba){_0x53a8e9=_0x14d3ba;return _0x14d3ba[_0x116d('0x6a')](_0x66cbcd[_0x116d('0x5a')][_0x116d('0x6b')],_[_0x116d('0x57')](_0x66cbcd['body'],[_0x116d('0x6b'),'id'])||{});}return null;})['spread'](function(_0x28e5ae){var _0x5a37e3;var _0x4d2bbf;_0x10bc73=_0x28e5ae||[];var _0x5df04d=[];if(_0x28e5ae){for(var _0xb712c4=0x0;_0xb712c4<_0x28e5ae['length'];_0xb712c4+=0x1){var _0x20309a=_0x28e5ae[_0xb712c4]['get']({'plain':!![]});_0x53a8e9['dialCheckDuplicateType']=_0x66cbcd[_0x116d('0x5a')][_0x116d('0x6c')]?_0x66cbcd[_0x116d('0x5a')]['dialCheckDuplicateType']:_0x53a8e9['dialCheckDuplicateType'];switch(_0x53a8e9[_0x116d('0x6c')]){case'always':_0x5a37e3=squel[_0x116d('0x6d')]()[_0x116d('0x6e')](_0x116d('0x6f'))[_0x116d('0x70')]([_0x116d('0x71'),'scheduledAt',_0x116d('0x72'),_0x116d('0x73'),_0x116d('0x61'),_0x116d('0x58'),'updatedAt'],squel[_0x116d('0x74')]()['field'](_0x116d('0x71'),_0x116d('0x71'))[_0x116d('0x75')](_0x116d('0x76'),_0x116d('0x77'))[_0x116d('0x75')]('id',_0x116d('0x72'))[_0x116d('0x75')](_0x20309a[_0x116d('0x78')]['toString'](),_0x116d('0x73'))[_0x116d('0x75')](_0x66cbcd[_0x116d('0x4a')]['id'][_0x116d('0x79')](),'CampaignId')[_0x116d('0x75')]('\x27'+_0x1b08a9+'\x27','createdAt')[_0x116d('0x75')]('\x27'+_0x1b08a9+'\x27',_0x116d('0x59'))[_0x116d('0x7a')](_0x116d('0x7b'))[_0x116d('0x3f')](_0x116d('0x7c'))[_0x116d('0x3f')](_0x116d('0x7d'),_0x20309a['CmListId']['toString']())[_0x116d('0x3f')](_0x116d('0x7e'))[_0x116d('0x3f')](_0x116d('0x7f'),squel[_0x116d('0x74')]()[_0x116d('0x75')](_0x116d('0x80'))[_0x116d('0x7a')](_0x116d('0x81'))[_0x116d('0x3f')](_0x116d('0x82'),_0x66cbcd[_0x116d('0x4a')]['id'][_0x116d('0x79')]()))[_0x116d('0x3f')](_0x116d('0x7f'),squel['select']()[_0x116d('0x75')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x116d('0x82'),_0x66cbcd[_0x116d('0x4a')]['id'][_0x116d('0x79')]())))[_0x116d('0x79')]();break;case _0x116d('0x83'):_0x5a37e3=squel[_0x116d('0x6d')]()[_0x116d('0x6e')]('cm_hopper')[_0x116d('0x70')]([_0x116d('0x71'),_0x116d('0x77'),_0x116d('0x72'),_0x116d('0x73'),'CampaignId',_0x116d('0x58'),_0x116d('0x59')],squel['select']()[_0x116d('0x75')](_0x116d('0x71'),_0x116d('0x71'))[_0x116d('0x75')](_0x116d('0x76'),'scheduledAt')[_0x116d('0x75')]('id',_0x116d('0x72'))[_0x116d('0x75')](_0x20309a[_0x116d('0x78')][_0x116d('0x79')](),_0x116d('0x73'))[_0x116d('0x75')](_0x66cbcd[_0x116d('0x4a')]['id'][_0x116d('0x79')](),_0x116d('0x61'))[_0x116d('0x75')]('\x27'+_0x1b08a9+'\x27',_0x116d('0x58'))['field']('\x27'+_0x1b08a9+'\x27',_0x116d('0x59'))[_0x116d('0x7a')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x20309a['CmListId']['toString']())[_0x116d('0x3f')](_0x116d('0x7e'))['where'](_0x116d('0x7f'),squel[_0x116d('0x74')]()[_0x116d('0x75')](_0x116d('0x84'))[_0x116d('0x7a')]('cm_hopper')['where'](_0x116d('0x82'),_0x66cbcd[_0x116d('0x4a')]['id'][_0x116d('0x79')]())))[_0x116d('0x79')]();break;default:_0x5a37e3=squel[_0x116d('0x6d')]()[_0x116d('0x6e')]('cm_hopper')[_0x116d('0x70')]([_0x116d('0x71'),_0x116d('0x77'),'ContactId','ListId',_0x116d('0x61'),_0x116d('0x58'),'updatedAt'],squel[_0x116d('0x74')]()[_0x116d('0x75')]('phone',_0x116d('0x71'))[_0x116d('0x75')](_0x116d('0x76'),_0x116d('0x77'))[_0x116d('0x75')]('id','ContactId')[_0x116d('0x75')](_0x20309a[_0x116d('0x78')][_0x116d('0x79')](),_0x116d('0x73'))[_0x116d('0x75')](_0x66cbcd['params']['id'][_0x116d('0x79')](),_0x116d('0x61'))[_0x116d('0x75')]('\x27'+_0x1b08a9+'\x27',_0x116d('0x58'))[_0x116d('0x75')]('\x27'+_0x1b08a9+'\x27','updatedAt')['from'](_0x116d('0x7b'))[_0x116d('0x3f')]('deletedAt\x20IS\x20NULL')[_0x116d('0x3f')](_0x116d('0x7d'),_0x20309a['CmListId'][_0x116d('0x79')]())[_0x116d('0x3f')](_0x116d('0x7e')))[_0x116d('0x79')]();}_0x4d2bbf=squel[_0x116d('0x6d')]()[_0x116d('0x6e')](_0x116d('0x85'))[_0x116d('0x70')]([_0x116d('0x86'),'scheduledAt',_0x116d('0x71'),_0x116d('0x87'),'createdAt','updatedAt'],squel['select']()[_0x116d('0x75')](_0x116d('0x88'),'id')[_0x116d('0x75')](_0x116d('0x76'),_0x116d('0x77'))[_0x116d('0x75')](_0x116d('0x89'),'phone')[_0x116d('0x75')](_0x116d('0x8a'),'OrderBy')['field']('\x27'+_0x1b08a9+'\x27',_0x116d('0x58'))[_0x116d('0x75')]('\x27'+_0x1b08a9+'\x27','updatedAt')['from']('cm_contact_has_items','ci')['join'](_0x116d('0x6f'),'h',_0x116d('0x8b'))[_0x116d('0x3f')](_0x116d('0x8c'),_0x20309a[_0x116d('0x78')][_0x116d('0x79')]())['where'](_0x116d('0x8d'),_0x66cbcd[_0x116d('0x4a')]['id']['toString']())[_0x116d('0x3f')]('h.createdAt\x20=\x20?',_0x1b08a9))[_0x116d('0x79')]();_0x5df04d[_0x116d('0x8e')](db[_0x116d('0x8f')][_0x116d('0x37')](_0x5a37e3));_0x3e05dc['push'](db[_0x116d('0x8f')][_0x116d('0x37')](_0x4d2bbf));}return BPromise[_0x116d('0x90')](_0x5df04d);}})[_0x116d('0x27')](function(){return BPromise[_0x116d('0x90')](_0x3e05dc);})[_0x116d('0x27')](function(){return _0x10bc73;})[_0x116d('0x27')](respondWithResult(_0x188b5f,null))['catch'](handleError(_0x188b5f,null));};exports[_0x116d('0x91')]=function(_0x2a440b,_0xb25df5,_0x3a10fd){return db['Campaign'][_0x116d('0x4c')]({'where':{'id':_0x2a440b[_0x116d('0x4a')]['id']}})[_0x116d('0x27')](handleEntityNotFound(_0xb25df5,null))[_0x116d('0x27')](function(_0x395bb4){if(_0x395bb4){return _0x395bb4[_0x116d('0x91')](_0x2a440b[_0x116d('0x37')]['ids']);}})['then'](function(_0x2c26cf){if(_0x2c26cf){return db[_0x116d('0x5e')][_0x116d('0x28')]({'where':{'ListId':_0x2a440b['query'][_0x116d('0x6b')],'CampaignId':_0x2a440b[_0x116d('0x4a')]['id']}})[_0x116d('0x27')](function(){return _0x2c26cf;});}})[_0x116d('0x27')](respondWithStatusCode(_0xb25df5,null))['catch'](handleError(_0xb25df5,null));};exports[_0x116d('0x92')]=function(_0x51a6f1,_0x215665,_0x492165){var _0xf3b2c2={};var _0x21bc9b={};var _0xa321ab;var _0x229d9e;return db[_0x116d('0x32')][_0x116d('0x5d')]({'where':{'id':_0x51a6f1[_0x116d('0x4a')]['id']}})[_0x116d('0x27')](handleEntityNotFound(_0x215665,null))['then'](function(_0x10647d){if(_0x10647d){_0xa321ab=_0x10647d;_0x21bc9b[_0x116d('0x3a')]=_['keys'](db[_0x116d('0x69')][_0x116d('0x33')]);_0x21bc9b[_0x116d('0x37')]=_['keys'](_0x51a6f1[_0x116d('0x37')]);_0x21bc9b['filters']=_['intersection'](_0x21bc9b[_0x116d('0x3a')],_0x21bc9b[_0x116d('0x37')]);_0xf3b2c2[_0x116d('0x3b')]=_[_0x116d('0x39')](_0x21bc9b[_0x116d('0x3a')],qs[_0x116d('0x3c')](_0x51a6f1['query'][_0x116d('0x3c')]));_0xf3b2c2[_0x116d('0x3b')]=_0xf3b2c2[_0x116d('0x3b')]['length']?_0xf3b2c2[_0x116d('0x3b')]:_0x21bc9b[_0x116d('0x3a')];_0xf3b2c2['order']=qs[_0x116d('0x3e')](_0x51a6f1[_0x116d('0x37')][_0x116d('0x3e')]);_0xf3b2c2[_0x116d('0x3f')]=qs['filters'](_[_0x116d('0x40')](_0x51a6f1['query'],_0x21bc9b[_0x116d('0x38')]));if(_0x51a6f1[_0x116d('0x37')][_0x116d('0x41')]){_0xf3b2c2[_0x116d('0x3f')]=_[_0x116d('0x42')](_0xf3b2c2[_0x116d('0x3f')],{'$or':_[_0x116d('0x31')](_0xf3b2c2[_0x116d('0x3b')],function(_0x2b0eff){var _0x42f61f={};_0x42f61f[_0x2b0eff]={'$like':'%'+_0x51a6f1[_0x116d('0x37')]['filter']+'%'};return _0x42f61f;})});}_0xf3b2c2=_[_0x116d('0x42')]({},_0xf3b2c2,_0x51a6f1[_0x116d('0x44')]);return _0xa321ab[_0x116d('0x92')](_0xf3b2c2);}})[_0x116d('0x27')](function(_0x4f9357){if(_0x4f9357){_0x229d9e=_0x4f9357[_0x116d('0x4b')];if(!_0x51a6f1[_0x116d('0x37')]['hasOwnProperty'](_0x116d('0x60'))){_0xf3b2c2[_0x116d('0x20')]=qs[_0x116d('0x20')](_0x51a6f1[_0x116d('0x37')]['limit']);_0xf3b2c2[_0x116d('0x1e')]=qs['offset'](_0x51a6f1[_0x116d('0x37')][_0x116d('0x1e')]);}return _0xa321ab[_0x116d('0x92')](_0xf3b2c2);}})[_0x116d('0x27')](function(_0x4c3a5b){if(_0x4c3a5b){return _0x4c3a5b?{'count':_0x229d9e,'rows':_0x4c3a5b}:null;}})[_0x116d('0x27')](respondWithResult(_0x215665,null))[_0x116d('0x4d')](handleError(_0x215665,null));};exports[_0x116d('0x93')]=function(_0x48046d,_0x52efa5,_0x323cf3){var _0x52bd60,_0x28436e;var _0x193b2e=[];var _0x5dbf4a=moment()[_0x116d('0x94')](_0x116d('0x95'));return db[_0x116d('0x32')]['find']({'where':{'id':_0x48046d[_0x116d('0x4a')]['id']}})[_0x116d('0x27')](handleEntityNotFound(_0x52efa5,null))[_0x116d('0x27')](function(_0x57d8e1){if(_0x57d8e1){_0x28436e=_0x57d8e1;return _0x57d8e1[_0x116d('0x93')](_0x48046d[_0x116d('0x5a')]['ids'],_[_0x116d('0x57')](_0x48046d[_0x116d('0x5a')],[_0x116d('0x6b'),'id'])||{});}return null;})[_0x116d('0x96')](function(_0x164563){var _0x16f66f;var _0x2e4351;_0x52bd60=_0x164563||[];var _0x8e5c3a=[];if(_0x164563){for(var _0x41c52f=0x0;_0x41c52f<_0x164563[_0x116d('0x4b')];_0x41c52f+=0x1){var _0x1272db=_0x164563[_0x41c52f][_0x116d('0x29')]({'plain':!![]});_0x16f66f=squel[_0x116d('0x6d')]()[_0x116d('0x6e')](_0x116d('0x97'))[_0x116d('0x70')](['phone','ContactId',_0x116d('0x73'),_0x116d('0x61'),_0x116d('0x58'),_0x116d('0x59')],squel[_0x116d('0x74')]()[_0x116d('0x75')]('phone',_0x116d('0x71'))[_0x116d('0x75')]('id',_0x116d('0x72'))[_0x116d('0x75')](_0x1272db['CmListId'][_0x116d('0x79')](),_0x116d('0x73'))[_0x116d('0x75')](_0x48046d[_0x116d('0x4a')]['id']['toString'](),_0x116d('0x61'))['field'](_0x116d('0x76'),_0x116d('0x58'))[_0x116d('0x75')](_0x116d('0x76'),_0x116d('0x59'))[_0x116d('0x7a')](_0x116d('0x7b'))[_0x116d('0x3f')](_0x116d('0x7c'))[_0x116d('0x3f')]('ListId\x20=\x20?',_0x1272db[_0x116d('0x78')][_0x116d('0x79')]())['where'](_0x116d('0x7e')))[_0x116d('0x79')]();_0x8e5c3a[_0x116d('0x8e')](db['sequelize'][_0x116d('0x37')](_0x16f66f));}return BPromise[_0x116d('0x90')](_0x8e5c3a);}})[_0x116d('0x27')](function(){return _0x52bd60;})['then'](respondWithResult(_0x52efa5,null))[_0x116d('0x4d')](handleError(_0x52efa5,null));};exports['removeBlackLists']=function(_0x33d394,_0x371097,_0x3156d9){return db[_0x116d('0x32')][_0x116d('0x4c')]({'where':{'id':_0x33d394['params']['id']}})[_0x116d('0x27')](handleEntityNotFound(_0x371097,null))[_0x116d('0x27')](function(_0x32a566){if(_0x32a566){return _0x32a566[_0x116d('0x98')](_0x33d394[_0x116d('0x37')][_0x116d('0x6b')]);}})[_0x116d('0x27')](function(_0x4841e8){if(_0x4841e8){return db[_0x116d('0x67')][_0x116d('0x28')]({'where':{'ListId':_0x33d394[_0x116d('0x37')]['ids'],'CampaignId':_0x33d394['params']['id']}})[_0x116d('0x27')](function(){return _0x4841e8;});}})[_0x116d('0x27')](respondWithStatusCode(_0x371097,null))[_0x116d('0x4d')](handleError(_0x371097,null));}; \ No newline at end of file +var _0x05b6=['reject','save','update','then','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','query','order','sort','where','filter','merge','options','Campaign','include','findAll','rows','catch','show','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','body','omit','updatedAt','getHoppers','findOne','CmHopper','length','hasOwnProperty','nolimit','pick','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','select','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','push','sequelize','removeLists','getBlackLists','addBlackLists','spread','all','removeBlackLists','destroy','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','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply'];(function(_0x421630,_0x2bbb2f){var _0x45b9f1=function(_0x104436){while(--_0x104436){_0x421630['push'](_0x421630['shift']());}};_0x45b9f1(++_0x2bbb2f);}(_0x05b6,0x74));var _0x605b=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x05b6[_0x274dd7];return _0x148829;};'use strict';var emlformat=require(_0x605b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x605b('0x1'));var jsonpatch=require(_0x605b('0x2'));var rp=require(_0x605b('0x3'));var moment=require(_0x605b('0x4'));var BPromise=require(_0x605b('0x5'));var Mustache=require(_0x605b('0x6'));var util=require(_0x605b('0x7'));var path=require(_0x605b('0x8'));var sox=require(_0x605b('0x9'));var csv=require(_0x605b('0xa'));var ejs=require(_0x605b('0xb'));var fs=require('fs');var fs_extra=require(_0x605b('0xc'));var _=require(_0x605b('0xd'));var squel=require(_0x605b('0xe'));var crypto=require(_0x605b('0xf'));var jsforce=require(_0x605b('0x10'));var deskjs=require(_0x605b('0x11'));var toCsv=require(_0x605b('0xa'));var querystring=require(_0x605b('0x12'));var Papa=require('papaparse');var Redis=require(_0x605b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x605b('0x14'));var logger=require(_0x605b('0x15'))(_0x605b('0x16'));var utils=require(_0x605b('0x17'));var config=require(_0x605b('0x18'));var licenseUtil=require(_0x605b('0x19'));var db=require(_0x605b('0x1a'))['db'];function respondWithStatusCode(_0x342254,_0x380b60){_0x380b60=_0x380b60||0xcc;return function(_0x178bce){if(_0x178bce){return _0x342254[_0x605b('0x1b')](_0x380b60);}return _0x342254[_0x605b('0x1c')](_0x380b60)[_0x605b('0x1d')]();};}function respondWithResult(_0x4040b9,_0x54390b){_0x54390b=_0x54390b||0xc8;return function(_0x262b53){if(_0x262b53){return _0x4040b9[_0x605b('0x1c')](_0x54390b)['json'](_0x262b53);}};}function respondWithFilteredResult(_0x543ebb,_0x5b3ccd){return function(_0x12da61){if(_0x12da61){var _0x34a394=typeof _0x5b3ccd['offset']===_0x605b('0x1e')&&typeof _0x5b3ccd[_0x605b('0x1f')]===_0x605b('0x1e');var _0x156717=_0x12da61[_0x605b('0x20')];var _0x5974f8=_0x34a394?0x0:_0x5b3ccd[_0x605b('0x21')];var _0x1233a5=_0x34a394?_0x12da61['count']:_0x5b3ccd[_0x605b('0x21')]+_0x5b3ccd['limit'];var _0x2a6a74;if(_0x1233a5>=_0x156717){_0x1233a5=_0x156717;_0x2a6a74=0xc8;}else{_0x2a6a74=0xce;}_0x543ebb[_0x605b('0x1c')](_0x2a6a74);return _0x543ebb[_0x605b('0x22')]('Content-Range',_0x5974f8+'-'+_0x1233a5+'/'+_0x156717)[_0x605b('0x23')](_0x12da61);}return null;};}function patchUpdates(_0x33db86){return function(_0x382b6a){try{jsonpatch[_0x605b('0x24')](_0x382b6a,_0x33db86,!![]);}catch(_0x11262c){return BPromise[_0x605b('0x25')](_0x11262c);}return _0x382b6a[_0x605b('0x26')]();};}function saveUpdates(_0x48adf5,_0x20fcf9){return function(_0x2a3b06){if(_0x2a3b06){return _0x2a3b06[_0x605b('0x27')](_0x48adf5)[_0x605b('0x28')](function(_0x19e9d4){return _0x19e9d4;});}return null;};}function removeEntity(_0x38793d,_0x1040dc){return function(_0x5245b7){if(_0x5245b7){return _0x5245b7['destroy']()[_0x605b('0x28')](function(){var _0x4996da=_0x5245b7['get']({'plain':!![]});var _0x1b6642=_0x605b('0x29');return db[_0x605b('0x2a')]['destroy']({'where':{'type':_0x1b6642,'resourceId':_0x4996da['id']}})['then'](function(){return _0x5245b7;});})[_0x605b('0x28')](function(){_0x38793d['status'](0xcc)[_0x605b('0x1d')]();});}};}function handleEntityNotFound(_0x5d18f0,_0x33078a){return function(_0xb0f44e){if(!_0xb0f44e){_0x5d18f0['sendStatus'](0x194);}return _0xb0f44e;};}function handleError(_0x234e6a,_0x4b5a6c){_0x4b5a6c=_0x4b5a6c||0x1f4;return function(_0x470ec8){logger[_0x605b('0x2b')](_0x470ec8[_0x605b('0x2c')]);if(_0x470ec8[_0x605b('0x2d')]){delete _0x470ec8[_0x605b('0x2d')];}_0x234e6a[_0x605b('0x1c')](_0x4b5a6c)[_0x605b('0x2e')](_0x470ec8);};}exports[_0x605b('0x2f')]=function(_0x11b048,_0x1b11b0){var _0x4d7ab8={},_0x3a1363={},_0x27415c={'count':0x0,'rows':[]};var _0x240f5d=_[_0x605b('0x30')](db['Campaign'][_0x605b('0x31')],function(_0x435122){return{'name':_0x435122[_0x605b('0x32')],'type':_0x435122['type'][_0x605b('0x33')]};});_0x3a1363[_0x605b('0x34')]=_['map'](_0x240f5d,_0x605b('0x2d'));_0x3a1363['query']=_[_0x605b('0x35')](_0x11b048['query']);_0x3a1363[_0x605b('0x36')]=_[_0x605b('0x37')](_0x3a1363[_0x605b('0x34')],_0x3a1363['query']);_0x4d7ab8[_0x605b('0x38')]=_[_0x605b('0x37')](_0x3a1363[_0x605b('0x34')],qs[_0x605b('0x39')](_0x11b048[_0x605b('0x3a')][_0x605b('0x39')]));_0x4d7ab8[_0x605b('0x38')]=_0x4d7ab8[_0x605b('0x38')]['length']?_0x4d7ab8[_0x605b('0x38')]:_0x3a1363[_0x605b('0x34')];if(!_0x11b048['query']['hasOwnProperty']('nolimit')){_0x4d7ab8[_0x605b('0x1f')]=qs[_0x605b('0x1f')](_0x11b048[_0x605b('0x3a')][_0x605b('0x1f')]);_0x4d7ab8[_0x605b('0x21')]=qs[_0x605b('0x21')](_0x11b048['query'][_0x605b('0x21')]);}_0x4d7ab8[_0x605b('0x3b')]=qs[_0x605b('0x3c')](_0x11b048[_0x605b('0x3a')][_0x605b('0x3c')]);_0x4d7ab8[_0x605b('0x3d')]=qs[_0x605b('0x36')](_['pick'](_0x11b048['query'],_0x3a1363[_0x605b('0x36')]),_0x240f5d);if(_0x11b048[_0x605b('0x3a')][_0x605b('0x3e')]){_0x4d7ab8[_0x605b('0x3d')]=_['merge'](_0x4d7ab8[_0x605b('0x3d')],{'$or':_[_0x605b('0x30')](_0x240f5d,function(_0x39f147){if(_0x39f147['type']!=='VIRTUAL'){var _0x33f204={};_0x33f204[_0x39f147[_0x605b('0x2d')]]={'$like':'%'+_0x11b048['query']['filter']+'%'};return _0x33f204;}})});}_0x4d7ab8=_[_0x605b('0x3f')]({},_0x4d7ab8,_0x11b048[_0x605b('0x40')]);var _0x1506e5={'where':_0x4d7ab8[_0x605b('0x3d')]};return db[_0x605b('0x41')][_0x605b('0x20')](_0x1506e5)[_0x605b('0x28')](function(_0x3bcf2c){_0x27415c['count']=_0x3bcf2c;if(_0x11b048[_0x605b('0x3a')]['includeAll']){_0x4d7ab8[_0x605b('0x42')]=[{'all':!![]}];}return db['Campaign'][_0x605b('0x43')](_0x4d7ab8);})[_0x605b('0x28')](function(_0x194804){_0x27415c[_0x605b('0x44')]=_0x194804;return _0x27415c;})[_0x605b('0x28')](respondWithFilteredResult(_0x1b11b0,_0x4d7ab8))[_0x605b('0x45')](handleError(_0x1b11b0,null));};exports[_0x605b('0x46')]=function(_0x597c68,_0x16d658){var _0x168e93={'raw':![],'where':{'id':_0x597c68[_0x605b('0x47')]['id']}},_0x2a2363={};_0x2a2363[_0x605b('0x34')]=_[_0x605b('0x35')](db[_0x605b('0x41')][_0x605b('0x31')]);_0x2a2363['query']=_[_0x605b('0x35')](_0x597c68['query']);_0x2a2363[_0x605b('0x36')]=_[_0x605b('0x37')](_0x2a2363['model'],_0x2a2363['query']);_0x168e93[_0x605b('0x38')]=_[_0x605b('0x37')](_0x2a2363[_0x605b('0x34')],qs[_0x605b('0x39')](_0x597c68[_0x605b('0x3a')][_0x605b('0x39')]));_0x168e93['attributes']=_0x168e93['attributes']['length']?_0x168e93[_0x605b('0x38')]:_0x2a2363['model'];if(_0x597c68['query'][_0x605b('0x48')]){_0x168e93[_0x605b('0x42')]=[{'all':!![]}];}_0x168e93=_[_0x605b('0x3f')]({},_0x168e93,_0x597c68[_0x605b('0x40')]);return db[_0x605b('0x41')][_0x605b('0x49')](_0x168e93)[_0x605b('0x28')](handleEntityNotFound(_0x16d658,null))[_0x605b('0x28')](respondWithResult(_0x16d658,null))[_0x605b('0x45')](handleError(_0x16d658,null));};exports['create']=function(_0x927f41,_0x5662da){return db['Campaign'][_0x605b('0x4a')](_0x927f41['body'],{})[_0x605b('0x28')](function(_0x272b3c){var _0x30bb90=_0x927f41[_0x605b('0x4b')][_0x605b('0x4c')]({'plain':!![]});if(!_0x30bb90)throw new Error(_0x605b('0x4d'));if(_0x30bb90[_0x605b('0x4e')]===_0x605b('0x4b')){var _0x594bd7=_0x272b3c[_0x605b('0x4c')]({'plain':!![]});var _0x112b38=_0x605b('0x29');return db[_0x605b('0x4f')]['find']({'where':{'name':_0x112b38,'userProfileId':_0x30bb90[_0x605b('0x50')]},'raw':!![]})[_0x605b('0x28')](function(_0x1d87fe){if(_0x1d87fe&&_0x1d87fe[_0x605b('0x51')]===0x0){return db[_0x605b('0x2a')][_0x605b('0x4a')]({'name':_0x594bd7[_0x605b('0x2d')],'resourceId':_0x594bd7['id'],'type':_0x1d87fe['name'],'sectionId':_0x1d87fe['id']},{})['then'](function(){return _0x272b3c;});}else{return _0x272b3c;}})[_0x605b('0x45')](function(_0x10b95d){logger['error'](_0x605b('0x52'),_0x10b95d);throw _0x10b95d;});}return _0x272b3c;})['then'](respondWithResult(_0x5662da,0xc9))[_0x605b('0x45')](handleError(_0x5662da,null));};exports[_0x605b('0x53')]=function(_0x5549a6,_0x504922){var _0x384e7d={'where':{'id':_0x5549a6['params']['id']}},_0x135bc0={};_0x135bc0[_0x605b('0x34')]=_[_0x605b('0x35')](db[_0x605b('0x41')][_0x605b('0x31')]);_0x384e7d['attributes']=_[_0x605b('0x37')](_0x135bc0[_0x605b('0x34')],qs['fields'](_0x5549a6[_0x605b('0x3a')][_0x605b('0x39')]));_0x384e7d['attributes']=_0x384e7d[_0x605b('0x38')]['length']?_0x384e7d['attributes']:_0x135bc0[_0x605b('0x34')];if(_0x5549a6[_0x605b('0x3a')]['includeAll']){_0x384e7d['include']=[{'all':!![]}];}_0x384e7d=_['merge']({},_0x384e7d,_0x5549a6[_0x605b('0x40')]);return db[_0x605b('0x41')]['find'](_0x384e7d)[_0x605b('0x28')](handleEntityNotFound(_0x504922,null))[_0x605b('0x28')](function(_0x17ee10){if(_0x17ee10){var _0x1b4a25=_0x17ee10[_0x605b('0x4c')]({'plain':!![]});_0x1b4a25=qs['omit'](_0x1b4a25,['id',_0x605b('0x54'),'updatedAt']);_0x5549a6[_0x605b('0x55')]=_[_0x605b('0x56')](_0x5549a6[_0x605b('0x55')],['id',_0x605b('0x54'),_0x605b('0x57')]);return db['Campaign'][_0x605b('0x4a')](_[_0x605b('0x3f')](_0x1b4a25,_0x5549a6[_0x605b('0x55')]),{'include':_0x5549a6[_0x605b('0x3a')][_0x605b('0x48')]?[{'all':!![]}]:undefined})[_0x605b('0x28')](function(_0x361a62){var _0x581eda=_0x5549a6[_0x605b('0x4b')][_0x605b('0x4c')]({'plain':!![]});if(!_0x581eda)throw new Error(_0x605b('0x4d'));if(_0x581eda['role']===_0x605b('0x4b')){var _0x22fb6d=_0x361a62[_0x605b('0x4c')]({'plain':!![]});var _0x18380e=_0x605b('0x29');return db['UserProfileSection'][_0x605b('0x49')]({'where':{'name':_0x18380e,'userProfileId':_0x581eda['userProfileId']},'raw':!![]})[_0x605b('0x28')](function(_0x38e21c){if(_0x38e21c&&_0x38e21c[_0x605b('0x51')]===0x0){return db['UserProfileResource'][_0x605b('0x4a')]({'name':_0x22fb6d[_0x605b('0x2d')],'resourceId':_0x22fb6d['id'],'type':_0x38e21c['name'],'sectionId':_0x38e21c['id']},{})[_0x605b('0x28')](function(){return _0x361a62;});}else{return _0x361a62;}})[_0x605b('0x45')](function(_0x1549fb){logger[_0x605b('0x2b')](_0x605b('0x52'),_0x1549fb);throw _0x1549fb;});}return _0x361a62;});}})[_0x605b('0x28')](respondWithResult(_0x504922,0xc9))[_0x605b('0x45')](handleError(_0x504922,null));};exports['update']=function(_0x1427fe,_0x5c2a20){if(_0x1427fe['body']['id']){delete _0x1427fe[_0x605b('0x55')]['id'];}return db[_0x605b('0x41')][_0x605b('0x49')]({'where':{'id':_0x1427fe[_0x605b('0x47')]['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x5c2a20,null))[_0x605b('0x28')](saveUpdates(_0x1427fe['body'],null))[_0x605b('0x28')](respondWithResult(_0x5c2a20,null))[_0x605b('0x45')](handleError(_0x5c2a20,null));};exports['destroy']=function(_0x483a3a,_0x4edb69){return db[_0x605b('0x41')][_0x605b('0x49')]({'where':{'id':_0x483a3a['params']['id']}})['then'](handleEntityNotFound(_0x4edb69,null))[_0x605b('0x28')](removeEntity(_0x4edb69,null))['catch'](handleError(_0x4edb69,null));};exports[_0x605b('0x58')]=function(_0x5a5f3d,_0x491af5,_0x54a740){var _0x59b5fb={'raw':!![],'where':{}};var _0x4413a3={};var _0x531a63={'count':0x0,'rows':[]};return db['Campaign'][_0x605b('0x59')]({'where':{'id':_0x5a5f3d[_0x605b('0x47')]['id']}})['then'](handleEntityNotFound(_0x491af5,null))['then'](function(_0x502be6){if(_0x502be6){_0x4413a3['model']=_[_0x605b('0x35')](db[_0x605b('0x5a')][_0x605b('0x31')]);_0x4413a3[_0x605b('0x3a')]=_[_0x605b('0x35')](_0x5a5f3d[_0x605b('0x3a')]);_0x4413a3['filters']=_['intersection'](_0x4413a3['model'],_0x4413a3['query']);_0x59b5fb[_0x605b('0x38')]=_[_0x605b('0x37')](_0x4413a3['model'],qs[_0x605b('0x39')](_0x5a5f3d[_0x605b('0x3a')][_0x605b('0x39')]));_0x59b5fb[_0x605b('0x38')]=_0x59b5fb[_0x605b('0x38')][_0x605b('0x5b')]?_0x59b5fb[_0x605b('0x38')]:_0x4413a3[_0x605b('0x34')];if(!_0x5a5f3d[_0x605b('0x3a')][_0x605b('0x5c')](_0x605b('0x5d'))){_0x59b5fb[_0x605b('0x1f')]=qs[_0x605b('0x1f')](_0x5a5f3d[_0x605b('0x3a')][_0x605b('0x1f')]);_0x59b5fb[_0x605b('0x21')]=qs[_0x605b('0x21')](_0x5a5f3d[_0x605b('0x3a')][_0x605b('0x21')]);}_0x59b5fb[_0x605b('0x3b')]=qs['sort'](_0x5a5f3d['query'][_0x605b('0x3c')]);_0x59b5fb[_0x605b('0x3d')]=qs[_0x605b('0x36')](_[_0x605b('0x5e')](_0x5a5f3d[_0x605b('0x3a')],_0x4413a3['filters']));_0x59b5fb[_0x605b('0x3d')]['CampaignId']=_0x502be6['id'];if(_0x5a5f3d[_0x605b('0x3a')][_0x605b('0x3e')]){_0x59b5fb[_0x605b('0x3d')]=_[_0x605b('0x3f')](_0x59b5fb[_0x605b('0x3d')],{'$or':_['map'](_0x59b5fb[_0x605b('0x38')],function(_0x1700e1){var _0x5bd95c={};_0x5bd95c[_0x1700e1]={'$like':'%'+_0x5a5f3d['query'][_0x605b('0x3e')]+'%'};return _0x5bd95c;})});}_0x59b5fb=_[_0x605b('0x3f')]({},_0x59b5fb,_0x5a5f3d[_0x605b('0x40')]);return db['CmHopper'][_0x605b('0x20')]({'where':_0x59b5fb[_0x605b('0x3d')]})[_0x605b('0x28')](function(_0x273542){_0x531a63['count']=_0x273542;if(_0x5a5f3d[_0x605b('0x3a')][_0x605b('0x48')]){_0x59b5fb[_0x605b('0x42')]=[{'all':!![]}];}return db[_0x605b('0x5a')]['findAll'](_0x59b5fb);})[_0x605b('0x28')](function(_0x41e61e){_0x531a63[_0x605b('0x44')]=_0x41e61e;return _0x531a63;});}})[_0x605b('0x28')](respondWithFilteredResult(_0x491af5,_0x59b5fb))[_0x605b('0x45')](handleError(_0x491af5,null));};exports[_0x605b('0x5f')]=function(_0x10bf7c,_0x53c944,_0x5dbce4){var _0x2a2a83={'raw':!![],'where':{}};var _0x119744={};var _0x1bac04={'count':0x0,'rows':[]};return db[_0x605b('0x41')][_0x605b('0x59')]({'where':{'id':_0x10bf7c[_0x605b('0x47')]['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x53c944,null))[_0x605b('0x28')](function(_0x64e227){if(_0x64e227){_0x119744['model']=_[_0x605b('0x35')](db[_0x605b('0x60')][_0x605b('0x31')]);_0x119744['query']=_[_0x605b('0x35')](_0x10bf7c['query']);_0x119744['filters']=_[_0x605b('0x37')](_0x119744[_0x605b('0x34')],_0x119744[_0x605b('0x3a')]);_0x2a2a83[_0x605b('0x38')]=_['intersection'](_0x119744['model'],qs[_0x605b('0x39')](_0x10bf7c['query'][_0x605b('0x39')]));_0x2a2a83[_0x605b('0x38')]=_0x2a2a83['attributes'][_0x605b('0x5b')]?_0x2a2a83['attributes']:_0x119744[_0x605b('0x34')];if(!_0x10bf7c[_0x605b('0x3a')][_0x605b('0x5c')](_0x605b('0x5d'))){_0x2a2a83[_0x605b('0x1f')]=qs['limit'](_0x10bf7c['query'][_0x605b('0x1f')]);_0x2a2a83[_0x605b('0x21')]=qs[_0x605b('0x21')](_0x10bf7c[_0x605b('0x3a')][_0x605b('0x21')]);}_0x2a2a83['order']=qs[_0x605b('0x3c')](_0x10bf7c[_0x605b('0x3a')][_0x605b('0x3c')]);_0x2a2a83[_0x605b('0x3d')]=qs[_0x605b('0x36')](_['pick'](_0x10bf7c[_0x605b('0x3a')],_0x119744['filters']));_0x2a2a83[_0x605b('0x3d')][_0x605b('0x61')]=_0x64e227['id'];if(_0x10bf7c[_0x605b('0x3a')]['filter']){_0x2a2a83['where']=_[_0x605b('0x3f')](_0x2a2a83['where'],{'$or':_[_0x605b('0x30')](_0x2a2a83[_0x605b('0x38')],function(_0x5d64c4){var _0x2e8f66={};_0x2e8f66[_0x5d64c4]={'$like':'%'+_0x10bf7c[_0x605b('0x3a')][_0x605b('0x3e')]+'%'};return _0x2e8f66;})});}_0x2a2a83=_[_0x605b('0x3f')]({},_0x2a2a83,_0x10bf7c['options']);return db[_0x605b('0x60')][_0x605b('0x20')]({'where':_0x2a2a83[_0x605b('0x3d')]})[_0x605b('0x28')](function(_0x1fd7f0){_0x1bac04[_0x605b('0x20')]=_0x1fd7f0;if(_0x10bf7c[_0x605b('0x3a')]['includeAll']){_0x2a2a83[_0x605b('0x42')]=[{'all':!![]}];}return db[_0x605b('0x60')]['findAll'](_0x2a2a83);})['then'](function(_0x26d368){_0x1bac04[_0x605b('0x44')]=_0x26d368;return _0x1bac04;});}})[_0x605b('0x28')](respondWithFilteredResult(_0x53c944,_0x2a2a83))[_0x605b('0x45')](handleError(_0x53c944,null));};exports[_0x605b('0x62')]=function(_0x528eee,_0x864f2c,_0x84d05b){var _0x36ecd8={'raw':!![],'where':{}};var _0x391aa6={};var _0x3fc9be={'count':0x0,'rows':[]};return db[_0x605b('0x41')][_0x605b('0x59')]({'where':{'id':_0x528eee[_0x605b('0x47')]['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x864f2c,null))[_0x605b('0x28')](function(_0x1d412f){if(_0x1d412f){_0x391aa6['model']=_['keys'](db['CmHopperFinal'][_0x605b('0x31')]);_0x391aa6[_0x605b('0x3a')]=_['keys'](_0x528eee[_0x605b('0x3a')]);_0x391aa6[_0x605b('0x36')]=_[_0x605b('0x37')](_0x391aa6[_0x605b('0x34')],_0x391aa6[_0x605b('0x3a')]);_0x36ecd8[_0x605b('0x38')]=_[_0x605b('0x37')](_0x391aa6['model'],qs[_0x605b('0x39')](_0x528eee[_0x605b('0x3a')]['fields']));_0x36ecd8[_0x605b('0x38')]=_0x36ecd8[_0x605b('0x38')]['length']?_0x36ecd8['attributes']:_0x391aa6[_0x605b('0x34')];if(!_0x528eee[_0x605b('0x3a')][_0x605b('0x5c')]('nolimit')){_0x36ecd8[_0x605b('0x1f')]=qs[_0x605b('0x1f')](_0x528eee[_0x605b('0x3a')]['limit']);_0x36ecd8[_0x605b('0x21')]=qs[_0x605b('0x21')](_0x528eee[_0x605b('0x3a')][_0x605b('0x21')]);}_0x36ecd8[_0x605b('0x3b')]=qs['sort'](_0x528eee['query'][_0x605b('0x3c')]);_0x36ecd8['where']=qs[_0x605b('0x36')](_[_0x605b('0x5e')](_0x528eee[_0x605b('0x3a')],_0x391aa6['filters']));_0x36ecd8[_0x605b('0x3d')][_0x605b('0x61')]=_0x1d412f['id'];if(_0x528eee[_0x605b('0x3a')][_0x605b('0x3e')]){_0x36ecd8[_0x605b('0x3d')]=_[_0x605b('0x3f')](_0x36ecd8[_0x605b('0x3d')],{'$or':_[_0x605b('0x30')](_0x36ecd8['attributes'],function(_0x3f1f0f){var _0xaacd54={};_0xaacd54[_0x3f1f0f]={'$like':'%'+_0x528eee[_0x605b('0x3a')]['filter']+'%'};return _0xaacd54;})});}_0x36ecd8=_['merge']({},_0x36ecd8,_0x528eee[_0x605b('0x40')]);return db[_0x605b('0x63')][_0x605b('0x20')]({'where':_0x36ecd8['where']})[_0x605b('0x28')](function(_0x110eb6){_0x3fc9be[_0x605b('0x20')]=_0x110eb6;if(_0x528eee[_0x605b('0x3a')][_0x605b('0x48')]){_0x36ecd8[_0x605b('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x605b('0x43')](_0x36ecd8);})['then'](function(_0x11cf0c){_0x3fc9be[_0x605b('0x44')]=_0x11cf0c;return _0x3fc9be;});}})[_0x605b('0x28')](respondWithFilteredResult(_0x864f2c,_0x36ecd8))[_0x605b('0x45')](handleError(_0x864f2c,null));};exports[_0x605b('0x64')]=function(_0x5b04f8,_0xbd6ae7,_0x4ff653){var _0xbdfc2d={'raw':!![],'where':{}};var _0x1adaf0={};var _0x30cdc0={'count':0x0,'rows':[]};return db['Campaign'][_0x605b('0x59')]({'where':{'id':_0x5b04f8[_0x605b('0x47')]['id']}})[_0x605b('0x28')](handleEntityNotFound(_0xbd6ae7,null))[_0x605b('0x28')](function(_0x4d30ea){if(_0x4d30ea){_0x1adaf0[_0x605b('0x34')]=_['keys'](db['CmHopperBlack'][_0x605b('0x31')]);_0x1adaf0[_0x605b('0x3a')]=_[_0x605b('0x35')](_0x5b04f8[_0x605b('0x3a')]);_0x1adaf0[_0x605b('0x36')]=_[_0x605b('0x37')](_0x1adaf0[_0x605b('0x34')],_0x1adaf0[_0x605b('0x3a')]);_0xbdfc2d['attributes']=_[_0x605b('0x37')](_0x1adaf0['model'],qs[_0x605b('0x39')](_0x5b04f8[_0x605b('0x3a')][_0x605b('0x39')]));_0xbdfc2d[_0x605b('0x38')]=_0xbdfc2d[_0x605b('0x38')][_0x605b('0x5b')]?_0xbdfc2d[_0x605b('0x38')]:_0x1adaf0[_0x605b('0x34')];if(!_0x5b04f8[_0x605b('0x3a')][_0x605b('0x5c')](_0x605b('0x5d'))){_0xbdfc2d[_0x605b('0x1f')]=qs[_0x605b('0x1f')](_0x5b04f8['query'][_0x605b('0x1f')]);_0xbdfc2d['offset']=qs[_0x605b('0x21')](_0x5b04f8['query']['offset']);}_0xbdfc2d[_0x605b('0x3b')]=qs[_0x605b('0x3c')](_0x5b04f8[_0x605b('0x3a')]['sort']);_0xbdfc2d[_0x605b('0x3d')]=qs['filters'](_[_0x605b('0x5e')](_0x5b04f8[_0x605b('0x3a')],_0x1adaf0[_0x605b('0x36')]));_0xbdfc2d[_0x605b('0x3d')]['CampaignId']=_0x4d30ea['id'];if(_0x5b04f8[_0x605b('0x3a')][_0x605b('0x3e')]){_0xbdfc2d[_0x605b('0x3d')]=_[_0x605b('0x3f')](_0xbdfc2d[_0x605b('0x3d')],{'$or':_[_0x605b('0x30')](_0xbdfc2d[_0x605b('0x38')],function(_0x55abdf){var _0xce116e={};_0xce116e[_0x55abdf]={'$like':'%'+_0x5b04f8[_0x605b('0x3a')][_0x605b('0x3e')]+'%'};return _0xce116e;})});}_0xbdfc2d=_[_0x605b('0x3f')]({},_0xbdfc2d,_0x5b04f8['options']);return db[_0x605b('0x65')][_0x605b('0x20')]({'where':_0xbdfc2d['where']})['then'](function(_0x14a775){_0x30cdc0['count']=_0x14a775;if(_0x5b04f8[_0x605b('0x3a')][_0x605b('0x48')]){_0xbdfc2d[_0x605b('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x605b('0x43')](_0xbdfc2d);})[_0x605b('0x28')](function(_0x3fdd25){_0x30cdc0[_0x605b('0x44')]=_0x3fdd25;return _0x30cdc0;});}})[_0x605b('0x28')](respondWithFilteredResult(_0xbd6ae7,_0xbdfc2d))['catch'](handleError(_0xbd6ae7,null));};exports[_0x605b('0x66')]=function(_0x4b975b,_0x5de33a,_0x1321f0){var _0x3ea5fb={};var _0x376b9b={};var _0x1c4ac0;var _0x369b42;return db[_0x605b('0x41')][_0x605b('0x59')]({'where':{'id':_0x4b975b['params']['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x5de33a,null))[_0x605b('0x28')](function(_0x2b8a07){if(_0x2b8a07){_0x1c4ac0=_0x2b8a07;_0x376b9b[_0x605b('0x34')]=_[_0x605b('0x35')](db[_0x605b('0x67')][_0x605b('0x31')]);_0x376b9b[_0x605b('0x3a')]=_['keys'](_0x4b975b['query']);_0x376b9b[_0x605b('0x36')]=_[_0x605b('0x37')](_0x376b9b[_0x605b('0x34')],_0x376b9b[_0x605b('0x3a')]);_0x3ea5fb[_0x605b('0x38')]=_[_0x605b('0x37')](_0x376b9b[_0x605b('0x34')],qs[_0x605b('0x39')](_0x4b975b[_0x605b('0x3a')]['fields']));_0x3ea5fb[_0x605b('0x38')]=_0x3ea5fb[_0x605b('0x38')][_0x605b('0x5b')]?_0x3ea5fb[_0x605b('0x38')]:_0x376b9b[_0x605b('0x34')];_0x3ea5fb[_0x605b('0x3b')]=qs[_0x605b('0x3c')](_0x4b975b[_0x605b('0x3a')][_0x605b('0x3c')]);_0x3ea5fb['where']=qs[_0x605b('0x36')](_[_0x605b('0x5e')](_0x4b975b[_0x605b('0x3a')],_0x376b9b[_0x605b('0x36')]));if(_0x4b975b[_0x605b('0x3a')][_0x605b('0x3e')]){_0x3ea5fb[_0x605b('0x3d')]=_[_0x605b('0x3f')](_0x3ea5fb[_0x605b('0x3d')],{'$or':_[_0x605b('0x30')](_0x3ea5fb[_0x605b('0x38')],function(_0x533d82){var _0x787f7={};_0x787f7[_0x533d82]={'$like':'%'+_0x4b975b[_0x605b('0x3a')][_0x605b('0x3e')]+'%'};return _0x787f7;})});}_0x3ea5fb=_[_0x605b('0x3f')]({},_0x3ea5fb,_0x4b975b['options']);return _0x1c4ac0['getLists'](_0x3ea5fb);}})['then'](function(_0x4a6ecd){if(_0x4a6ecd){_0x369b42=_0x4a6ecd[_0x605b('0x5b')];if(!_0x4b975b[_0x605b('0x3a')][_0x605b('0x5c')](_0x605b('0x5d'))){_0x3ea5fb[_0x605b('0x1f')]=qs[_0x605b('0x1f')](_0x4b975b[_0x605b('0x3a')][_0x605b('0x1f')]);_0x3ea5fb[_0x605b('0x21')]=qs[_0x605b('0x21')](_0x4b975b['query']['offset']);}return _0x1c4ac0['getLists'](_0x3ea5fb);}})['then'](function(_0x52182b){if(_0x52182b){return _0x52182b?{'count':_0x369b42,'rows':_0x52182b}:null;}})[_0x605b('0x28')](respondWithResult(_0x5de33a,null))[_0x605b('0x45')](handleError(_0x5de33a,null));};exports[_0x605b('0x68')]=function(_0x999178,_0x30bccc,_0x5f611f){var _0x3c93ca,_0x348552;var _0x36a63b=[];var _0x3eeb40=moment()[_0x605b('0x69')](_0x605b('0x6a'));return db[_0x605b('0x41')][_0x605b('0x49')]({'where':{'id':_0x999178['params']['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x30bccc,null))[_0x605b('0x28')](function(_0xe01b8a){if(_0xe01b8a){_0x348552=_0xe01b8a;return _0xe01b8a[_0x605b('0x68')](_0x999178[_0x605b('0x55')][_0x605b('0x6b')],_[_0x605b('0x56')](_0x999178[_0x605b('0x55')],['ids','id'])||{});}return null;})['spread'](function(_0x2d0500){var _0x204329;var _0x412ff9;_0x3c93ca=_0x2d0500||[];var _0x57d4e7=[];if(_0x2d0500){for(var _0x23a2ca=0x0;_0x23a2ca<_0x2d0500[_0x605b('0x5b')];_0x23a2ca+=0x1){var _0x325f8b=_0x2d0500[_0x23a2ca]['get']({'plain':!![]});_0x348552[_0x605b('0x6c')]=_0x999178[_0x605b('0x55')][_0x605b('0x6c')]?_0x999178[_0x605b('0x55')][_0x605b('0x6c')]:_0x348552['dialCheckDuplicateType'];switch(_0x348552[_0x605b('0x6c')]){case _0x605b('0x6d'):_0x204329=squel[_0x605b('0x6e')]()[_0x605b('0x6f')](_0x605b('0x70'))['fromQuery']([_0x605b('0x71'),_0x605b('0x72'),_0x605b('0x73'),_0x605b('0x74'),_0x605b('0x61'),_0x605b('0x54'),_0x605b('0x57')],squel['select']()[_0x605b('0x75')]('phone',_0x605b('0x71'))[_0x605b('0x75')](_0x605b('0x76'),'scheduledAt')[_0x605b('0x75')]('id',_0x605b('0x73'))[_0x605b('0x75')](_0x325f8b[_0x605b('0x77')][_0x605b('0x78')](),_0x605b('0x74'))[_0x605b('0x75')](_0x999178[_0x605b('0x47')]['id'][_0x605b('0x78')](),_0x605b('0x61'))[_0x605b('0x75')]('\x27'+_0x3eeb40+'\x27',_0x605b('0x54'))['field']('\x27'+_0x3eeb40+'\x27','updatedAt')[_0x605b('0x79')](_0x605b('0x7a'))['where'](_0x605b('0x7b'))[_0x605b('0x3d')](_0x605b('0x7c'),_0x325f8b[_0x605b('0x77')][_0x605b('0x78')]())[_0x605b('0x3d')](_0x605b('0x7d'))[_0x605b('0x3d')](_0x605b('0x7e'),squel['select']()['field'](_0x605b('0x7f'))[_0x605b('0x79')](_0x605b('0x80'))['where']('CampaignId\x20=\x20?',_0x999178[_0x605b('0x47')]['id']['toString']()))['where'](_0x605b('0x7e'),squel[_0x605b('0x81')]()[_0x605b('0x75')](_0x605b('0x82'))[_0x605b('0x79')]('cm_hopper')[_0x605b('0x3d')](_0x605b('0x83'),_0x999178[_0x605b('0x47')]['id']['toString']())))[_0x605b('0x78')]();break;case _0x605b('0x84'):_0x204329=squel[_0x605b('0x6e')]()[_0x605b('0x6f')](_0x605b('0x70'))[_0x605b('0x85')]([_0x605b('0x71'),_0x605b('0x72'),_0x605b('0x73'),'ListId',_0x605b('0x61'),_0x605b('0x54'),_0x605b('0x57')],squel[_0x605b('0x81')]()[_0x605b('0x75')](_0x605b('0x71'),_0x605b('0x71'))[_0x605b('0x75')](_0x605b('0x76'),_0x605b('0x72'))[_0x605b('0x75')]('id','ContactId')[_0x605b('0x75')](_0x325f8b[_0x605b('0x77')]['toString'](),_0x605b('0x74'))[_0x605b('0x75')](_0x999178[_0x605b('0x47')]['id']['toString'](),_0x605b('0x61'))[_0x605b('0x75')]('\x27'+_0x3eeb40+'\x27',_0x605b('0x54'))[_0x605b('0x75')]('\x27'+_0x3eeb40+'\x27','updatedAt')[_0x605b('0x79')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x605b('0x7c'),_0x325f8b[_0x605b('0x77')][_0x605b('0x78')]())[_0x605b('0x3d')](_0x605b('0x7d'))[_0x605b('0x3d')](_0x605b('0x7e'),squel[_0x605b('0x81')]()[_0x605b('0x75')](_0x605b('0x82'))[_0x605b('0x79')]('cm_hopper')[_0x605b('0x3d')](_0x605b('0x83'),_0x999178[_0x605b('0x47')]['id'][_0x605b('0x78')]())))[_0x605b('0x78')]();break;default:_0x204329=squel[_0x605b('0x6e')]()[_0x605b('0x6f')](_0x605b('0x70'))['fromQuery'](['phone',_0x605b('0x72'),_0x605b('0x73'),_0x605b('0x74'),_0x605b('0x61'),'createdAt',_0x605b('0x57')],squel['select']()[_0x605b('0x75')](_0x605b('0x71'),_0x605b('0x71'))[_0x605b('0x75')](_0x605b('0x76'),_0x605b('0x72'))[_0x605b('0x75')]('id',_0x605b('0x73'))[_0x605b('0x75')](_0x325f8b[_0x605b('0x77')][_0x605b('0x78')](),_0x605b('0x74'))[_0x605b('0x75')](_0x999178[_0x605b('0x47')]['id']['toString'](),_0x605b('0x61'))['field']('\x27'+_0x3eeb40+'\x27',_0x605b('0x54'))[_0x605b('0x75')]('\x27'+_0x3eeb40+'\x27',_0x605b('0x57'))[_0x605b('0x79')](_0x605b('0x7a'))[_0x605b('0x3d')](_0x605b('0x7b'))[_0x605b('0x3d')](_0x605b('0x7c'),_0x325f8b[_0x605b('0x77')][_0x605b('0x78')]())[_0x605b('0x3d')](_0x605b('0x7d')))[_0x605b('0x78')]();}_0x412ff9=squel[_0x605b('0x6e')]()[_0x605b('0x6f')](_0x605b('0x86'))[_0x605b('0x85')]([_0x605b('0x87'),_0x605b('0x72'),_0x605b('0x71'),_0x605b('0x88'),_0x605b('0x54'),_0x605b('0x57')],squel[_0x605b('0x81')]()[_0x605b('0x75')](_0x605b('0x89'),'id')[_0x605b('0x75')]('NOW()',_0x605b('0x72'))['field'](_0x605b('0x8a'),'phone')[_0x605b('0x75')](_0x605b('0x8b'),_0x605b('0x88'))[_0x605b('0x75')]('\x27'+_0x3eeb40+'\x27',_0x605b('0x54'))[_0x605b('0x75')]('\x27'+_0x3eeb40+'\x27',_0x605b('0x57'))[_0x605b('0x79')](_0x605b('0x8c'),'ci')[_0x605b('0x8d')]('cm_hopper','h',_0x605b('0x8e'))[_0x605b('0x3d')](_0x605b('0x8f'),_0x325f8b['CmListId'][_0x605b('0x78')]())['where']('h.CampaignId=?',_0x999178[_0x605b('0x47')]['id'][_0x605b('0x78')]())['where']('h.createdAt\x20=\x20?',_0x3eeb40))['toString']();_0x57d4e7[_0x605b('0x90')](db[_0x605b('0x91')][_0x605b('0x3a')](_0x204329));_0x36a63b[_0x605b('0x90')](db[_0x605b('0x91')][_0x605b('0x3a')](_0x412ff9));}return BPromise['all'](_0x57d4e7);}})[_0x605b('0x28')](function(){return BPromise['all'](_0x36a63b);})['then'](function(){return _0x3c93ca;})[_0x605b('0x28')](respondWithResult(_0x30bccc,null))[_0x605b('0x45')](handleError(_0x30bccc,null));};exports[_0x605b('0x92')]=function(_0xa074bf,_0x1693be,_0x2795e8){return db[_0x605b('0x41')][_0x605b('0x49')]({'where':{'id':_0xa074bf[_0x605b('0x47')]['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x1693be,null))[_0x605b('0x28')](function(_0x832a96){if(_0x832a96){return _0x832a96[_0x605b('0x92')](_0xa074bf[_0x605b('0x3a')]['ids']);}})[_0x605b('0x28')](function(_0x488da0){if(_0x488da0){return db[_0x605b('0x5a')]['destroy']({'where':{'ListId':_0xa074bf[_0x605b('0x3a')][_0x605b('0x6b')],'CampaignId':_0xa074bf[_0x605b('0x47')]['id']}})['then'](function(){return _0x488da0;});}})['then'](respondWithStatusCode(_0x1693be,null))[_0x605b('0x45')](handleError(_0x1693be,null));};exports[_0x605b('0x93')]=function(_0x14406e,_0x3eae45,_0x179761){var _0x39c4c3={};var _0x37e75a={};var _0x289b55;var _0x44a96b;return db['Campaign'][_0x605b('0x59')]({'where':{'id':_0x14406e[_0x605b('0x47')]['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x3eae45,null))['then'](function(_0x333a3b){if(_0x333a3b){_0x289b55=_0x333a3b;_0x37e75a[_0x605b('0x34')]=_['keys'](db[_0x605b('0x67')][_0x605b('0x31')]);_0x37e75a[_0x605b('0x3a')]=_['keys'](_0x14406e[_0x605b('0x3a')]);_0x37e75a[_0x605b('0x36')]=_[_0x605b('0x37')](_0x37e75a[_0x605b('0x34')],_0x37e75a[_0x605b('0x3a')]);_0x39c4c3['attributes']=_[_0x605b('0x37')](_0x37e75a[_0x605b('0x34')],qs[_0x605b('0x39')](_0x14406e[_0x605b('0x3a')][_0x605b('0x39')]));_0x39c4c3[_0x605b('0x38')]=_0x39c4c3['attributes'][_0x605b('0x5b')]?_0x39c4c3[_0x605b('0x38')]:_0x37e75a[_0x605b('0x34')];_0x39c4c3['order']=qs[_0x605b('0x3c')](_0x14406e['query'][_0x605b('0x3c')]);_0x39c4c3[_0x605b('0x3d')]=qs[_0x605b('0x36')](_[_0x605b('0x5e')](_0x14406e[_0x605b('0x3a')],_0x37e75a[_0x605b('0x36')]));if(_0x14406e[_0x605b('0x3a')][_0x605b('0x3e')]){_0x39c4c3['where']=_[_0x605b('0x3f')](_0x39c4c3[_0x605b('0x3d')],{'$or':_[_0x605b('0x30')](_0x39c4c3[_0x605b('0x38')],function(_0x5b10d4){var _0x3ef692={};_0x3ef692[_0x5b10d4]={'$like':'%'+_0x14406e[_0x605b('0x3a')]['filter']+'%'};return _0x3ef692;})});}_0x39c4c3=_[_0x605b('0x3f')]({},_0x39c4c3,_0x14406e['options']);return _0x289b55[_0x605b('0x93')](_0x39c4c3);}})[_0x605b('0x28')](function(_0x5b512d){if(_0x5b512d){_0x44a96b=_0x5b512d[_0x605b('0x5b')];if(!_0x14406e[_0x605b('0x3a')][_0x605b('0x5c')](_0x605b('0x5d'))){_0x39c4c3[_0x605b('0x1f')]=qs['limit'](_0x14406e[_0x605b('0x3a')][_0x605b('0x1f')]);_0x39c4c3[_0x605b('0x21')]=qs[_0x605b('0x21')](_0x14406e['query'][_0x605b('0x21')]);}return _0x289b55[_0x605b('0x93')](_0x39c4c3);}})['then'](function(_0x419e8e){if(_0x419e8e){return _0x419e8e?{'count':_0x44a96b,'rows':_0x419e8e}:null;}})['then'](respondWithResult(_0x3eae45,null))['catch'](handleError(_0x3eae45,null));};exports['addBlackLists']=function(_0x5233e5,_0x1a021b,_0x2a0a43){var _0x4d5d6e,_0x32710e;var _0x3907c8=[];var _0x16fac2=moment()[_0x605b('0x69')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x605b('0x41')][_0x605b('0x49')]({'where':{'id':_0x5233e5[_0x605b('0x47')]['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x1a021b,null))[_0x605b('0x28')](function(_0x3cbe52){if(_0x3cbe52){_0x32710e=_0x3cbe52;return _0x3cbe52[_0x605b('0x94')](_0x5233e5[_0x605b('0x55')][_0x605b('0x6b')],_[_0x605b('0x56')](_0x5233e5[_0x605b('0x55')],[_0x605b('0x6b'),'id'])||{});}return null;})[_0x605b('0x95')](function(_0x5915f4){var _0xff5d51;var _0x4a97df;_0x4d5d6e=_0x5915f4||[];var _0x5b52da=[];if(_0x5915f4){for(var _0x43f3fa=0x0;_0x43f3fa<_0x5915f4[_0x605b('0x5b')];_0x43f3fa+=0x1){var _0x2bed4b=_0x5915f4[_0x43f3fa][_0x605b('0x4c')]({'plain':!![]});_0xff5d51=squel[_0x605b('0x6e')]()['into']('cm_hopper_black')[_0x605b('0x85')]([_0x605b('0x71'),_0x605b('0x73'),_0x605b('0x74'),_0x605b('0x61'),_0x605b('0x54'),'updatedAt'],squel['select']()[_0x605b('0x75')](_0x605b('0x71'),_0x605b('0x71'))[_0x605b('0x75')]('id',_0x605b('0x73'))[_0x605b('0x75')](_0x2bed4b['CmListId'][_0x605b('0x78')](),_0x605b('0x74'))[_0x605b('0x75')](_0x5233e5['params']['id'][_0x605b('0x78')](),'CampaignId')[_0x605b('0x75')](_0x605b('0x76'),_0x605b('0x54'))[_0x605b('0x75')](_0x605b('0x76'),_0x605b('0x57'))[_0x605b('0x79')](_0x605b('0x7a'))['where'](_0x605b('0x7b'))[_0x605b('0x3d')](_0x605b('0x7c'),_0x2bed4b['CmListId'][_0x605b('0x78')]())[_0x605b('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x5b52da[_0x605b('0x90')](db[_0x605b('0x91')]['query'](_0xff5d51));}return BPromise[_0x605b('0x96')](_0x5b52da);}})[_0x605b('0x28')](function(){return _0x4d5d6e;})[_0x605b('0x28')](respondWithResult(_0x1a021b,null))[_0x605b('0x45')](handleError(_0x1a021b,null));};exports['removeBlackLists']=function(_0x3c0697,_0x2c0978,_0x1a94a1){return db[_0x605b('0x41')][_0x605b('0x49')]({'where':{'id':_0x3c0697[_0x605b('0x47')]['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x2c0978,null))[_0x605b('0x28')](function(_0x584e2f){if(_0x584e2f){return _0x584e2f[_0x605b('0x97')](_0x3c0697['query'][_0x605b('0x6b')]);}})['then'](function(_0x142306){if(_0x142306){return db['CmHopperBlack'][_0x605b('0x98')]({'where':{'ListId':_0x3c0697[_0x605b('0x3a')][_0x605b('0x6b')],'CampaignId':_0x3c0697[_0x605b('0x47')]['id']}})[_0x605b('0x28')](function(){return _0x142306;});}})[_0x605b('0x28')](respondWithStatusCode(_0x2c0978,null))['catch'](handleError(_0x2c0978,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index ba543f6..419338c 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(_0xdb9db5,_0x16cb80){var _0x35c68f=function(_0x26117c){while(--_0x26117c){_0xdb9db5['push'](_0xdb9db5['shift']());}};_0x35c68f(++_0x16cb80);}(_0x7a54,0x106));var _0x47a5=function(_0x2822ff,_0x115d25){_0x2822ff=_0x2822ff-0x0;var _0x38a45f=_0x7a54[_0x2822ff];return _0x38a45f;};'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(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 9dfcc48..758ad3b 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 _0x0269=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','include','model','map','lodash'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0x0269,0x135));var _0x9026=function(_0x37bca8,_0x2fb3ac){_0x37bca8=_0x37bca8-0x0;var _0x40eb58=_0x0269[_0x37bca8];return _0x40eb58;};'use strict';var _=require(_0x9026('0x0'));var util=require('util');var moment=require(_0x9026('0x1'));var BPromise=require('bluebird');var rs=require(_0x9026('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9026('0x3'))['db'];var utils=require(_0x9026('0x4'));var logger=require(_0x9026('0x5'))(_0x9026('0x6'));var config=require('../../config/environment');var jayson=require(_0x9026('0x7'));var client=jayson[_0x9026('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x540056,_0x97c0c3,_0x1a212f){return new BPromise(function(_0x1149ad,_0xd97c29){return client['request'](_0x540056,_0x1a212f)[_0x9026('0x9')](function(_0x1a238a){logger[_0x9026('0xa')]('Campaign,\x20%s,\x20%s',_0x97c0c3,_0x9026('0xb'));logger[_0x9026('0xc')](_0x9026('0xd'),_0x97c0c3,'request\x20sent',JSON[_0x9026('0xe')](_0x1a238a));if(_0x1a238a['error']){if(_0x1a238a[_0x9026('0xf')][_0x9026('0x10')]===0x1f4){logger[_0x9026('0xf')](_0x9026('0x11'),_0x97c0c3,_0x1a238a[_0x9026('0xf')][_0x9026('0x12')]);return _0xd97c29(_0x1a238a[_0x9026('0xf')]['message']);}logger[_0x9026('0xf')]('Campaign,\x20%s,\x20%s',_0x97c0c3,_0x1a238a[_0x9026('0xf')][_0x9026('0x12')]);return _0x1149ad(_0x1a238a[_0x9026('0xf')][_0x9026('0x12')]);}else{logger[_0x9026('0xa')](_0x9026('0x11'),_0x97c0c3,_0x9026('0xb'));_0x1149ad(_0x1a238a[_0x9026('0x13')]['message']);}})[_0x9026('0x14')](function(_0x2b9834){logger['error'](_0x9026('0x11'),_0x97c0c3,_0x2b9834);_0xd97c29(_0x2b9834);});});}exports[_0x9026('0x15')]=function(_0x15b3ab){var _0x4e37d0=this;return new Promise(function(_0x1d1613,_0x3e57f7){return db[_0x9026('0x16')][_0x9026('0x17')]({'raw':_0x15b3ab['options']?_0x15b3ab[_0x9026('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x15b3ab[_0x9026('0x18')]?_0x15b3ab['options'][_0x9026('0x19')]||null:null,'attributes':_0x15b3ab[_0x9026('0x18')]?_0x15b3ab[_0x9026('0x18')][_0x9026('0x1a')]||null:null,'limit':_0x15b3ab[_0x9026('0x18')]?_0x15b3ab[_0x9026('0x18')][_0x9026('0x1b')]||null:null,'include':_0x15b3ab[_0x9026('0x18')]?_0x15b3ab[_0x9026('0x18')]['include']?_['map'](_0x15b3ab[_0x9026('0x18')][_0x9026('0x1c')],function(_0x2968fb){return{'model':db[_0x2968fb[_0x9026('0x1d')]],'as':_0x2968fb['as'],'attributes':_0x2968fb[_0x9026('0x1a')],'include':_0x2968fb[_0x9026('0x1c')]?_[_0x9026('0x1e')](_0x2968fb[_0x9026('0x1c')],function(_0x775596){return{'model':db[_0x775596[_0x9026('0x1d')]],'as':_0x775596['as'],'attributes':_0x775596[_0x9026('0x1a')],'include':_0x775596[_0x9026('0x1c')]?_[_0x9026('0x1e')](_0x775596[_0x9026('0x1c')],function(_0x28dba4){return{'model':db[_0x28dba4[_0x9026('0x1d')]],'as':_0x28dba4['as'],'attributes':_0x28dba4[_0x9026('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9026('0x9')](function(_0x2fae98){logger['info'](_0x9026('0x15'),_0x15b3ab);logger[_0x9026('0xc')](_0x9026('0x15'),_0x15b3ab,JSON[_0x9026('0xe')](_0x2fae98));_0x1d1613(_0x2fae98);})[_0x9026('0x14')](function(_0x3cead8){logger[_0x9026('0xf')](_0x9026('0x15'),_0x3cead8[_0x9026('0x12')],_0x15b3ab);_0x3e57f7(_0x4e37d0[_0x9026('0xf')](0x1f4,_0x3cead8[_0x9026('0x12')]));});});}; \ No newline at end of file +var _0x4522=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','options','raw','where','limit','include','map','model','attributes','info'];(function(_0x571c65,_0x321f37){var _0x563767=function(_0x2e9f2a){while(--_0x2e9f2a){_0x571c65['push'](_0x571c65['shift']());}};_0x563767(++_0x321f37);}(_0x4522,0x1a0));var _0x2452=function(_0x2550d5,_0x4a68e4){_0x2550d5=_0x2550d5-0x0;var _0x18ddd3=_0x4522[_0x2550d5];return _0x18ddd3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2452('0x0'));var BPromise=require(_0x2452('0x1'));var rs=require(_0x2452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require(_0x2452('0x5'))(_0x2452('0x6'));var config=require(_0x2452('0x7'));var jayson=require(_0x2452('0x8'));var client=jayson[_0x2452('0x9')][_0x2452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0139,_0x149807,_0x3bc193){return new BPromise(function(_0x33b935,_0x24073f){return client[_0x2452('0xb')](_0x2f0139,_0x3bc193)[_0x2452('0xc')](function(_0x2995b5){logger['info']('Campaign,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x149807,_0x2452('0xd'),JSON[_0x2452('0xe')](_0x2995b5));if(_0x2995b5[_0x2452('0xf')]){if(_0x2995b5[_0x2452('0xf')][_0x2452('0x10')]===0x1f4){logger[_0x2452('0xf')](_0x2452('0x11'),_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x24073f(_0x2995b5['error']['message']);}logger[_0x2452('0xf')]('Campaign,\x20%s,\x20%s',_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x33b935(_0x2995b5[_0x2452('0xf')][_0x2452('0x12')]);}else{logger['info'](_0x2452('0x11'),_0x149807,'request\x20sent');_0x33b935(_0x2995b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xdede20){logger['error'](_0x2452('0x11'),_0x149807,_0xdede20);_0x24073f(_0xdede20);});});}exports[_0x2452('0x15')]=function(_0x59d89a){var _0x4802ad=this;return new Promise(function(_0x1bfb44,_0x37c6a6){return db[_0x2452('0x16')]['findAll']({'raw':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')][_0x2452('0x18')]===undefined?!![]:![]:!![],'where':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')][_0x2452('0x19')]||null:null,'attributes':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')]['attributes']||null:null,'limit':_0x59d89a['options']?_0x59d89a[_0x2452('0x17')][_0x2452('0x1a')]||null:null,'include':_0x59d89a['options']?_0x59d89a[_0x2452('0x17')][_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x59d89a[_0x2452('0x17')][_0x2452('0x1b')],function(_0x397f21){return{'model':db[_0x397f21[_0x2452('0x1d')]],'as':_0x397f21['as'],'attributes':_0x397f21['attributes'],'include':_0x397f21[_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x397f21[_0x2452('0x1b')],function(_0x231410){return{'model':db[_0x231410[_0x2452('0x1d')]],'as':_0x231410['as'],'attributes':_0x231410['attributes'],'include':_0x231410['include']?_[_0x2452('0x1c')](_0x231410[_0x2452('0x1b')],function(_0x46fcbb){return{'model':db[_0x46fcbb[_0x2452('0x1d')]],'as':_0x46fcbb['as'],'attributes':_0x46fcbb[_0x2452('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fba00){logger[_0x2452('0x1f')]('GetCampaign',_0x59d89a);logger['debug'](_0x2452('0x15'),_0x59d89a,JSON[_0x2452('0xe')](_0x3fba00));_0x1bfb44(_0x3fba00);})[_0x2452('0x14')](function(_0x28e6ea){logger[_0x2452('0xf')](_0x2452('0x15'),_0x28e6ea['message'],_0x59d89a);_0x37c6a6(_0x4802ad['error'](0x1f4,_0x28e6ea[_0x2452('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index d9a00b8..2c1704e 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 _0x28ff=['getHopperFinals','getHopperBlacks','/:id/lists','getLists','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','delete','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','index','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals'];(function(_0x516b5d,_0x5a0ee0){var _0x28be8e=function(_0x3573c2){while(--_0x3573c2){_0x516b5d['push'](_0x516b5d['shift']());}};_0x28be8e(++_0x5a0ee0);}(_0x28ff,0x138));var _0xf28f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28ff[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf28f('0x0'));var path=require(_0xf28f('0x1'));var timeout=require(_0xf28f('0x2'));var express=require(_0xf28f('0x3'));var router=express[_0xf28f('0x4')]();var fs_extra=require(_0xf28f('0x5'));var auth=require(_0xf28f('0x6'));var interaction=require(_0xf28f('0x7'));var config=require('../../config/environment');var controller=require(_0xf28f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf28f('0x9')]);router[_0xf28f('0xa')](_0xf28f('0xb'),auth[_0xf28f('0xc')](),controller[_0xf28f('0xd')]);router[_0xf28f('0xa')](_0xf28f('0xe'),auth[_0xf28f('0xc')](),controller[_0xf28f('0xf')]);router[_0xf28f('0xa')](_0xf28f('0x10'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xf28f('0xa')](_0xf28f('0x11'),auth['isAuthenticated'](),controller[_0xf28f('0x12')]);router[_0xf28f('0xa')]('/:id/hopper_black',auth[_0xf28f('0xc')](),controller[_0xf28f('0x13')]);router['get'](_0xf28f('0x14'),auth[_0xf28f('0xc')](),controller[_0xf28f('0x15')]);router['get']('/:id/blacklists',auth[_0xf28f('0xc')](),controller['getBlackLists']);router[_0xf28f('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf28f('0x16')](_0xf28f('0x17'),auth['isAuthenticated'](),controller[_0xf28f('0x18')]);router[_0xf28f('0x16')](_0xf28f('0x14'),auth[_0xf28f('0xc')](),controller[_0xf28f('0x19')]);router[_0xf28f('0x16')](_0xf28f('0x1a'),auth[_0xf28f('0xc')](),controller[_0xf28f('0x1b')]);router[_0xf28f('0x1c')](_0xf28f('0xb'),auth[_0xf28f('0xc')](),controller['update']);router[_0xf28f('0x1d')](_0xf28f('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xf28f('0x1d')](_0xf28f('0x14'),auth[_0xf28f('0xc')](),controller[_0xf28f('0x1e')]);router['delete'](_0xf28f('0x1a'),auth['isAuthenticated'](),controller[_0xf28f('0x1f')]);module[_0xf28f('0x20')]=router; \ No newline at end of file +var _0x9589=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getBlackLists','post','/:id/clone','addLists','/:id/blacklists','addBlackLists','delete','/:id/lists','removeBlackLists','exports','multer','util','path','connect-timeout'];(function(_0x7b52d9,_0x246600){var _0x2b605f=function(_0x56d365){while(--_0x56d365){_0x7b52d9['push'](_0x7b52d9['shift']());}};_0x2b605f(++_0x246600);}(_0x9589,0xbc));var _0x9958=function(_0x24689d,_0x36a12a){_0x24689d=_0x24689d-0x0;var _0x4b9d0f=_0x9589[_0x24689d];return _0x4b9d0f;};'use strict';var multer=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var path=require(_0x9958('0x2'));var timeout=require(_0x9958('0x3'));var express=require(_0x9958('0x4'));var router=express['Router']();var fs_extra=require(_0x9958('0x5'));var auth=require(_0x9958('0x6'));var interaction=require(_0x9958('0x7'));var config=require('../../config/environment');var controller=require(_0x9958('0x8'));router[_0x9958('0x9')]('/',auth[_0x9958('0xa')](),controller[_0x9958('0xb')]);router[_0x9958('0x9')](_0x9958('0xc'),auth['isAuthenticated'](),controller[_0x9958('0xd')]);router[_0x9958('0x9')](_0x9958('0xe'),auth[_0x9958('0xa')](),controller[_0x9958('0xf')]);router[_0x9958('0x9')](_0x9958('0x10'),auth[_0x9958('0xa')](),controller[_0x9958('0x11')]);router[_0x9958('0x9')](_0x9958('0x12'),auth[_0x9958('0xa')](),controller[_0x9958('0x13')]);router[_0x9958('0x9')](_0x9958('0x14'),auth[_0x9958('0xa')](),controller[_0x9958('0x15')]);router[_0x9958('0x9')]('/:id/lists',auth[_0x9958('0xa')](),controller['getLists']);router[_0x9958('0x9')]('/:id/blacklists',auth[_0x9958('0xa')](),controller[_0x9958('0x16')]);router[_0x9958('0x17')]('/',auth[_0x9958('0xa')](),controller['create']);router[_0x9958('0x17')](_0x9958('0x18'),auth['isAuthenticated'](),controller['clone']);router[_0x9958('0x17')]('/:id/lists',auth[_0x9958('0xa')](),controller[_0x9958('0x19')]);router[_0x9958('0x17')](_0x9958('0x1a'),auth[_0x9958('0xa')](),controller[_0x9958('0x1b')]);router['put']('/:id',auth[_0x9958('0xa')](),controller['update']);router['delete'](_0x9958('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x9958('0x1c')](_0x9958('0x1d'),auth[_0x9958('0xa')](),controller['removeLists']);router[_0x9958('0x1c')](_0x9958('0x1a'),auth[_0x9958('0xa')](),controller[_0x9958('0x1e')]);module[_0x9958('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index d22604d..9c78204 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 _0x57b2=['key','sequelize','STRING','TEXT','getDataValue'];(function(_0x8e7fb0,_0x3453c1){var _0x2d20b9=function(_0x3075a8){while(--_0x3075a8){_0x8e7fb0['push'](_0x8e7fb0['shift']());}};_0x2d20b9(++_0x3453c1);}(_0x57b2,0x150));var _0x257b=function(_0x2ba5d2,_0x14ef5c){_0x2ba5d2=_0x2ba5d2-0x0;var _0x5d9933=_0x57b2[_0x2ba5d2];return _0x5d9933;};'use strict';var Sequelize=require(_0x257b('0x0'));module['exports']={'key':{'type':Sequelize[_0x257b('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x257b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x257b('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x257b('0x3')](_0x257b('0x4'));}}}; \ No newline at end of file +var _0xa090=['STRING','TEXT','getDataValue','key','sequelize','exports'];(function(_0x27ca07,_0x326280){var _0x54d51a=function(_0xf7a0ed){while(--_0xf7a0ed){_0x27ca07['push'](_0x27ca07['shift']());}};_0x54d51a(++_0x326280);}(_0xa090,0x1cc));var _0x0a09=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0xa090[_0x7a3247];return _0x1bfde5;};'use strict';var Sequelize=require(_0x0a09('0x0'));module[_0x0a09('0x1')]={'key':{'type':Sequelize[_0x0a09('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x0a09('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x0a09('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a09('0x4')](_0x0a09('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8807730..e1100e0 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 _0xa986=['mustache','path','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','includeAll','findAll','rows','catch','show','params','keys','length','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','bluebird'];(function(_0x59416f,_0x24068d){var _0x5cd23a=function(_0x5174f7){while(--_0x5174f7){_0x59416f['push'](_0x59416f['shift']());}};_0x5cd23a(++_0x24068d);}(_0xa986,0x1ee));var _0x6a98=function(_0x4342b4,_0x157ddf){_0x4342b4=_0x4342b4-0x0;var _0x13e947=_0xa986[_0x4342b4];return _0x13e947;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a98('0x0'));var zipdir=require(_0x6a98('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a98('0x2'));var moment=require('moment');var BPromise=require(_0x6a98('0x3'));var Mustache=require(_0x6a98('0x4'));var util=require('util');var path=require(_0x6a98('0x5'));var sox=require('sox');var csv=require(_0x6a98('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a98('0x7'));var squel=require(_0x6a98('0x8'));var crypto=require('crypto');var jsforce=require(_0x6a98('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a98('0xa'));var Papa=require(_0x6a98('0xb'));var Redis=require('ioredis');var authService=require(_0x6a98('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x6a98('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a98('0xe'))(_0x6a98('0xf'));var utils=require(_0x6a98('0x10'));var config=require(_0x6a98('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a98('0x12'))['db'];function respondWithStatusCode(_0xe97200,_0x15013a){_0x15013a=_0x15013a||0xcc;return function(_0x53ae3d){if(_0x53ae3d){return _0xe97200[_0x6a98('0x13')](_0x15013a);}return _0xe97200[_0x6a98('0x14')](_0x15013a)[_0x6a98('0x15')]();};}function respondWithResult(_0x356100,_0x3b2faf){_0x3b2faf=_0x3b2faf||0xc8;return function(_0x416eac){if(_0x416eac){return _0x356100[_0x6a98('0x14')](_0x3b2faf)[_0x6a98('0x16')](_0x416eac);}};}function respondWithFilteredResult(_0x233241,_0x5ea882){return function(_0x101fc0){if(_0x101fc0){var _0x4b61d5=typeof _0x5ea882[_0x6a98('0x17')]===_0x6a98('0x18')&&typeof _0x5ea882[_0x6a98('0x19')]===_0x6a98('0x18');var _0x52177=_0x101fc0[_0x6a98('0x1a')];var _0x3b290a=_0x4b61d5?0x0:_0x5ea882[_0x6a98('0x17')];var _0x1e8de9=_0x4b61d5?_0x101fc0['count']:_0x5ea882[_0x6a98('0x17')]+_0x5ea882[_0x6a98('0x19')];var _0x3d3fef;if(_0x1e8de9>=_0x52177){_0x1e8de9=_0x52177;_0x3d3fef=0xc8;}else{_0x3d3fef=0xce;}_0x233241[_0x6a98('0x14')](_0x3d3fef);return _0x233241[_0x6a98('0x1b')]('Content-Range',_0x3b290a+'-'+_0x1e8de9+'/'+_0x52177)[_0x6a98('0x16')](_0x101fc0);}return null;};}function patchUpdates(_0x43fd58){return function(_0x193b2a){try{jsonpatch[_0x6a98('0x1c')](_0x193b2a,_0x43fd58,!![]);}catch(_0x351dff){return BPromise[_0x6a98('0x1d')](_0x351dff);}return _0x193b2a[_0x6a98('0x1e')]();};}function saveUpdates(_0x5777af,_0x4ca9f4){return function(_0x4427de){if(_0x4427de){return _0x4427de[_0x6a98('0x1f')](_0x5777af)[_0x6a98('0x20')](function(_0x114c3b){return _0x114c3b;});}return null;};}function removeEntity(_0x128f47,_0x292233){return function(_0x5ef0fd){if(_0x5ef0fd){return _0x5ef0fd[_0x6a98('0x21')]()[_0x6a98('0x20')](function(){var _0x19ec84=_0x5ef0fd[_0x6a98('0x22')]({'plain':!![]});var _0x4ad6f3=_0x6a98('0x23');return db[_0x6a98('0x24')][_0x6a98('0x21')]({'where':{'type':_0x4ad6f3,'resourceId':_0x19ec84['id']}})[_0x6a98('0x20')](function(){return _0x5ef0fd;});})[_0x6a98('0x20')](function(){_0x128f47[_0x6a98('0x14')](0xcc)[_0x6a98('0x15')]();});}};}function handleEntityNotFound(_0x188734,_0x5b5b1f){return function(_0x2184bb){if(!_0x2184bb){_0x188734[_0x6a98('0x13')](0x194);}return _0x2184bb;};}function handleError(_0x2f6dd6,_0x51f158){_0x51f158=_0x51f158||0x1f4;return function(_0x1ef0c3){logger[_0x6a98('0x25')](_0x1ef0c3['stack']);if(_0x1ef0c3[_0x6a98('0x26')]){delete _0x1ef0c3['name'];}_0x2f6dd6[_0x6a98('0x14')](_0x51f158)[_0x6a98('0x27')](_0x1ef0c3);};}exports[_0x6a98('0x28')]=function(_0x7ad977,_0x23e24c){var _0xdaa70={},_0x3b387f={},_0x16b108={'count':0x0,'rows':[]};var _0x57896a=_['map'](db[_0x6a98('0x29')][_0x6a98('0x2a')],function(_0x5f0a8c){return{'name':_0x5f0a8c[_0x6a98('0x2b')],'type':_0x5f0a8c[_0x6a98('0x2c')][_0x6a98('0x2d')]};});_0x3b387f[_0x6a98('0x2e')]=_[_0x6a98('0x2f')](_0x57896a,_0x6a98('0x26'));_0x3b387f[_0x6a98('0x30')]=_['keys'](_0x7ad977[_0x6a98('0x30')]);_0x3b387f['filters']=_[_0x6a98('0x31')](_0x3b387f[_0x6a98('0x2e')],_0x3b387f[_0x6a98('0x30')]);_0xdaa70[_0x6a98('0x32')]=_[_0x6a98('0x31')](_0x3b387f[_0x6a98('0x2e')],qs[_0x6a98('0x33')](_0x7ad977[_0x6a98('0x30')]['fields']));_0xdaa70['attributes']=_0xdaa70['attributes']['length']?_0xdaa70[_0x6a98('0x32')]:_0x3b387f['model'];if(!_0x7ad977[_0x6a98('0x30')][_0x6a98('0x34')]('nolimit')){_0xdaa70[_0x6a98('0x19')]=qs['limit'](_0x7ad977[_0x6a98('0x30')]['limit']);_0xdaa70[_0x6a98('0x17')]=qs[_0x6a98('0x17')](_0x7ad977[_0x6a98('0x30')][_0x6a98('0x17')]);}_0xdaa70[_0x6a98('0x35')]=qs['sort'](_0x7ad977[_0x6a98('0x30')][_0x6a98('0x36')]);_0xdaa70[_0x6a98('0x37')]=qs['filters'](_[_0x6a98('0x38')](_0x7ad977['query'],_0x3b387f[_0x6a98('0x39')]),_0x57896a);if(_0x7ad977[_0x6a98('0x30')][_0x6a98('0x3a')]){_0xdaa70['where']=_['merge'](_0xdaa70[_0x6a98('0x37')],{'$or':[{'key':{'$like':'%'+_0x7ad977[_0x6a98('0x30')][_0x6a98('0x3a')]+'%'}},{'value':{'$like':'%'+_0x7ad977[_0x6a98('0x30')][_0x6a98('0x3a')]+'%'}}]});}_0xdaa70=_[_0x6a98('0x3b')]({},_0xdaa70,_0x7ad977['options']);var _0x3698ef={'where':_0xdaa70[_0x6a98('0x37')]};return db[_0x6a98('0x29')][_0x6a98('0x1a')](_0x3698ef)[_0x6a98('0x20')](function(_0x2cca33){_0x16b108[_0x6a98('0x1a')]=_0x2cca33;if(_0x7ad977[_0x6a98('0x30')][_0x6a98('0x3c')]){_0xdaa70['include']=[{'all':!![]}];}return db[_0x6a98('0x29')][_0x6a98('0x3d')](_0xdaa70);})[_0x6a98('0x20')](function(_0x47b33c){_0x16b108[_0x6a98('0x3e')]=_0x47b33c;return _0x16b108;})[_0x6a98('0x20')](respondWithFilteredResult(_0x23e24c,_0xdaa70))[_0x6a98('0x3f')](handleError(_0x23e24c,null));};exports[_0x6a98('0x40')]=function(_0xc6e39c,_0x1df41f){var _0x4fe5b7={'raw':!![],'where':{'id':_0xc6e39c[_0x6a98('0x41')]['id']}},_0x1328f6={};_0x1328f6['model']=_[_0x6a98('0x42')](db[_0x6a98('0x29')][_0x6a98('0x2a')]);_0x1328f6['query']=_[_0x6a98('0x42')](_0xc6e39c[_0x6a98('0x30')]);_0x1328f6[_0x6a98('0x39')]=_[_0x6a98('0x31')](_0x1328f6['model'],_0x1328f6['query']);_0x4fe5b7[_0x6a98('0x32')]=_[_0x6a98('0x31')](_0x1328f6[_0x6a98('0x2e')],qs[_0x6a98('0x33')](_0xc6e39c['query']['fields']));_0x4fe5b7['attributes']=_0x4fe5b7['attributes'][_0x6a98('0x43')]?_0x4fe5b7[_0x6a98('0x32')]:_0x1328f6[_0x6a98('0x2e')];if(_0xc6e39c[_0x6a98('0x30')][_0x6a98('0x3c')]){_0x4fe5b7['include']=[{'all':!![]}];}_0x4fe5b7=_['merge']({},_0x4fe5b7,_0xc6e39c[_0x6a98('0x44')]);return db[_0x6a98('0x29')][_0x6a98('0x45')](_0x4fe5b7)['then'](handleEntityNotFound(_0x1df41f,null))['then'](respondWithResult(_0x1df41f,null))[_0x6a98('0x3f')](handleError(_0x1df41f,null));};exports[_0x6a98('0x1f')]=function(_0x1b45bc,_0x212056){if(_0x1b45bc[_0x6a98('0x46')]['id']){delete _0x1b45bc[_0x6a98('0x46')]['id'];}return db['CannedAnswer'][_0x6a98('0x45')]({'where':{'id':_0x1b45bc['params']['id']}})[_0x6a98('0x20')](handleEntityNotFound(_0x212056,null))[_0x6a98('0x20')](saveUpdates(_0x1b45bc['body'],null))[_0x6a98('0x20')](respondWithResult(_0x212056,null))[_0x6a98('0x3f')](handleError(_0x212056,null));};exports[_0x6a98('0x21')]=function(_0x2aef2b,_0x5c636d){return db[_0x6a98('0x29')][_0x6a98('0x45')]({'where':{'id':_0x2aef2b[_0x6a98('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c636d,null))[_0x6a98('0x20')](removeEntity(_0x5c636d,null))[_0x6a98('0x3f')](handleError(_0x5c636d,null));};exports['create']=function(_0x1a0505,_0x25b8ac){var _0x1f7a4b={'key':_0x1a0505[_0x6a98('0x46')][_0x6a98('0x2d')]};if(_0x1a0505[_0x6a98('0x46')][_0x6a98('0x47')]){_0x1f7a4b[_0x6a98('0x47')]=_0x1a0505[_0x6a98('0x46')]['MailAccountId'];}else if(_0x1a0505['body'][_0x6a98('0x48')]){_0x1f7a4b[_0x6a98('0x48')]=_0x1a0505[_0x6a98('0x46')][_0x6a98('0x48')];}else if(_0x1a0505[_0x6a98('0x46')][_0x6a98('0x49')]){_0x1f7a4b['OpenchannelAccountId']=_0x1a0505[_0x6a98('0x46')][_0x6a98('0x49')];}else if(_0x1a0505['body'][_0x6a98('0x4a')]){_0x1f7a4b['ChatWebsiteId']=_0x1a0505[_0x6a98('0x46')][_0x6a98('0x4a')];}return db[_0x6a98('0x29')]['find']({'where':_0x1f7a4b})[_0x6a98('0x20')](function(_0x3d3c1f){if(_0x3d3c1f){throw new db[(_0x6a98('0x4b'))][(_0x6a98('0x4c'))](_0x6a98('0x4d'));}return db[_0x6a98('0x29')]['create'](_0x1a0505[_0x6a98('0x46')]);})['then'](function(_0xca9153){var _0x2fd526=_0x1a0505[_0x6a98('0x4e')]['get']({'plain':!![]});if(!_0x2fd526)throw new Error(_0x6a98('0x4f'));if(_0x2fd526['role']==='user'){var _0x32440b=_0xca9153[_0x6a98('0x22')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'CannedAnswers','userProfileId':_0x2fd526[_0x6a98('0x50')]},'raw':!![]})[_0x6a98('0x20')](function(_0x460009){if(_0x460009&&_0x460009['autoAssociation']===0x0){return db['UserProfileResource'][_0x6a98('0x51')]({'name':_0x32440b[_0x6a98('0x26')],'resourceId':_0x32440b['id'],'type':_0x460009[_0x6a98('0x26')],'sectionId':_0x460009['id']},{})[_0x6a98('0x20')](function(){return _0xca9153;});}else{return _0xca9153;}})['catch'](function(_0x36d39e){logger[_0x6a98('0x25')](_0x6a98('0x52'),_0x36d39e);throw _0x36d39e;});}return _0xca9153;})[_0x6a98('0x20')](respondWithResult(_0x25b8ac,0xc9))[_0x6a98('0x3f')](handleError(_0x25b8ac,null));}; \ No newline at end of file +var _0x96e6=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','includeAll','include','rows','catch','show','params','length','options','find','update','body','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x41a6a9,_0x3927a4){var _0x193ccf=function(_0x1e7fde){while(--_0x1e7fde){_0x41a6a9['push'](_0x41a6a9['shift']());}};_0x193ccf(++_0x3927a4);}(_0x96e6,0x10f));var _0x696e=function(_0xfd8218,_0x33f2da){_0xfd8218=_0xfd8218-0x0;var _0x46e864=_0x96e6[_0xfd8218];return _0x46e864;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x696e('0x0'));var zipdir=require(_0x696e('0x1'));var jsonpatch=require(_0x696e('0x2'));var rp=require(_0x696e('0x3'));var moment=require(_0x696e('0x4'));var BPromise=require(_0x696e('0x5'));var Mustache=require(_0x696e('0x6'));var util=require(_0x696e('0x7'));var path=require(_0x696e('0x8'));var sox=require(_0x696e('0x9'));var csv=require('to-csv');var ejs=require(_0x696e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x696e('0xb'));var squel=require(_0x696e('0xc'));var crypto=require(_0x696e('0xd'));var jsforce=require(_0x696e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x696e('0xf'));var Papa=require(_0x696e('0x10'));var Redis=require(_0x696e('0x11'));var authService=require(_0x696e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x696e('0x13'));var hardwareService=require(_0x696e('0x14'));var logger=require(_0x696e('0x15'))(_0x696e('0x16'));var utils=require(_0x696e('0x17'));var config=require(_0x696e('0x18'));var licenseUtil=require(_0x696e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x405056,_0x4aa5b4){_0x4aa5b4=_0x4aa5b4||0xcc;return function(_0x3bbf0f){if(_0x3bbf0f){return _0x405056[_0x696e('0x1a')](_0x4aa5b4);}return _0x405056[_0x696e('0x1b')](_0x4aa5b4)['end']();};}function respondWithResult(_0x39a57a,_0x534179){_0x534179=_0x534179||0xc8;return function(_0x5da0c6){if(_0x5da0c6){return _0x39a57a[_0x696e('0x1b')](_0x534179)[_0x696e('0x1c')](_0x5da0c6);}};}function respondWithFilteredResult(_0x10db62,_0x1e5bcc){return function(_0x3c2c5b){if(_0x3c2c5b){var _0x580c11=typeof _0x1e5bcc[_0x696e('0x1d')]===_0x696e('0x1e')&&typeof _0x1e5bcc[_0x696e('0x1f')]===_0x696e('0x1e');var _0x52fb6a=_0x3c2c5b[_0x696e('0x20')];var _0x360e7c=_0x580c11?0x0:_0x1e5bcc[_0x696e('0x1d')];var _0xe23fc7=_0x580c11?_0x3c2c5b[_0x696e('0x20')]:_0x1e5bcc[_0x696e('0x1d')]+_0x1e5bcc[_0x696e('0x1f')];var _0x43a822;if(_0xe23fc7>=_0x52fb6a){_0xe23fc7=_0x52fb6a;_0x43a822=0xc8;}else{_0x43a822=0xce;}_0x10db62[_0x696e('0x1b')](_0x43a822);return _0x10db62[_0x696e('0x21')](_0x696e('0x22'),_0x360e7c+'-'+_0xe23fc7+'/'+_0x52fb6a)[_0x696e('0x1c')](_0x3c2c5b);}return null;};}function patchUpdates(_0x3c3588){return function(_0x34c5ab){try{jsonpatch[_0x696e('0x23')](_0x34c5ab,_0x3c3588,!![]);}catch(_0x4c30a0){return BPromise[_0x696e('0x24')](_0x4c30a0);}return _0x34c5ab['save']();};}function saveUpdates(_0x1917d2,_0x3c3bc4){return function(_0xf53932){if(_0xf53932){return _0xf53932['update'](_0x1917d2)[_0x696e('0x25')](function(_0x588778){return _0x588778;});}return null;};}function removeEntity(_0x191a95,_0x5809c4){return function(_0x560447){if(_0x560447){return _0x560447[_0x696e('0x26')]()[_0x696e('0x25')](function(){var _0xfdd8d1=_0x560447[_0x696e('0x27')]({'plain':!![]});var _0x128474=_0x696e('0x28');return db[_0x696e('0x29')]['destroy']({'where':{'type':_0x128474,'resourceId':_0xfdd8d1['id']}})[_0x696e('0x25')](function(){return _0x560447;});})[_0x696e('0x25')](function(){_0x191a95[_0x696e('0x1b')](0xcc)[_0x696e('0x2a')]();});}};}function handleEntityNotFound(_0x4cd6c1,_0x4f13d9){return function(_0x572ee1){if(!_0x572ee1){_0x4cd6c1[_0x696e('0x1a')](0x194);}return _0x572ee1;};}function handleError(_0x4e180e,_0x4f4f01){_0x4f4f01=_0x4f4f01||0x1f4;return function(_0x37a8a1){logger[_0x696e('0x2b')](_0x37a8a1[_0x696e('0x2c')]);if(_0x37a8a1['name']){delete _0x37a8a1[_0x696e('0x2d')];}_0x4e180e['status'](_0x4f4f01)[_0x696e('0x2e')](_0x37a8a1);};}exports['index']=function(_0x5301cb,_0xbd549c){var _0x240839={},_0x145784={},_0x14712b={'count':0x0,'rows':[]};var _0x2116ab=_[_0x696e('0x2f')](db[_0x696e('0x30')][_0x696e('0x31')],function(_0x1db1fd){return{'name':_0x1db1fd[_0x696e('0x32')],'type':_0x1db1fd['type']['key']};});_0x145784[_0x696e('0x33')]=_['map'](_0x2116ab,_0x696e('0x2d'));_0x145784['query']=_[_0x696e('0x34')](_0x5301cb[_0x696e('0x35')]);_0x145784[_0x696e('0x36')]=_[_0x696e('0x37')](_0x145784[_0x696e('0x33')],_0x145784[_0x696e('0x35')]);_0x240839[_0x696e('0x38')]=_[_0x696e('0x37')](_0x145784[_0x696e('0x33')],qs['fields'](_0x5301cb[_0x696e('0x35')][_0x696e('0x39')]));_0x240839['attributes']=_0x240839['attributes']['length']?_0x240839['attributes']:_0x145784[_0x696e('0x33')];if(!_0x5301cb[_0x696e('0x35')]['hasOwnProperty'](_0x696e('0x3a'))){_0x240839[_0x696e('0x1f')]=qs[_0x696e('0x1f')](_0x5301cb[_0x696e('0x35')][_0x696e('0x1f')]);_0x240839['offset']=qs[_0x696e('0x1d')](_0x5301cb[_0x696e('0x35')]['offset']);}_0x240839[_0x696e('0x3b')]=qs[_0x696e('0x3c')](_0x5301cb[_0x696e('0x35')]['sort']);_0x240839['where']=qs['filters'](_[_0x696e('0x3d')](_0x5301cb[_0x696e('0x35')],_0x145784[_0x696e('0x36')]),_0x2116ab);if(_0x5301cb[_0x696e('0x35')][_0x696e('0x3e')]){_0x240839[_0x696e('0x3f')]=_[_0x696e('0x40')](_0x240839[_0x696e('0x3f')],{'$or':[{'key':{'$like':'%'+_0x5301cb['query'][_0x696e('0x3e')]+'%'}},{'value':{'$like':'%'+_0x5301cb[_0x696e('0x35')][_0x696e('0x3e')]+'%'}}]});}_0x240839=_[_0x696e('0x40')]({},_0x240839,_0x5301cb['options']);var _0x487193={'where':_0x240839['where']};return db[_0x696e('0x30')][_0x696e('0x20')](_0x487193)['then'](function(_0x72742e){_0x14712b[_0x696e('0x20')]=_0x72742e;if(_0x5301cb[_0x696e('0x35')][_0x696e('0x41')]){_0x240839[_0x696e('0x42')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x240839);})[_0x696e('0x25')](function(_0x2ee0e5){_0x14712b[_0x696e('0x43')]=_0x2ee0e5;return _0x14712b;})[_0x696e('0x25')](respondWithFilteredResult(_0xbd549c,_0x240839))[_0x696e('0x44')](handleError(_0xbd549c,null));};exports[_0x696e('0x45')]=function(_0x572ff0,_0x306199){var _0x4ccdea={'raw':!![],'where':{'id':_0x572ff0[_0x696e('0x46')]['id']}},_0x182320={};_0x182320[_0x696e('0x33')]=_['keys'](db[_0x696e('0x30')][_0x696e('0x31')]);_0x182320['query']=_['keys'](_0x572ff0['query']);_0x182320[_0x696e('0x36')]=_[_0x696e('0x37')](_0x182320[_0x696e('0x33')],_0x182320[_0x696e('0x35')]);_0x4ccdea['attributes']=_[_0x696e('0x37')](_0x182320['model'],qs[_0x696e('0x39')](_0x572ff0['query'][_0x696e('0x39')]));_0x4ccdea['attributes']=_0x4ccdea[_0x696e('0x38')][_0x696e('0x47')]?_0x4ccdea[_0x696e('0x38')]:_0x182320['model'];if(_0x572ff0[_0x696e('0x35')][_0x696e('0x41')]){_0x4ccdea[_0x696e('0x42')]=[{'all':!![]}];}_0x4ccdea=_[_0x696e('0x40')]({},_0x4ccdea,_0x572ff0[_0x696e('0x48')]);return db[_0x696e('0x30')][_0x696e('0x49')](_0x4ccdea)['then'](handleEntityNotFound(_0x306199,null))['then'](respondWithResult(_0x306199,null))[_0x696e('0x44')](handleError(_0x306199,null));};exports[_0x696e('0x4a')]=function(_0x704b79,_0x3a0b38){if(_0x704b79[_0x696e('0x4b')]['id']){delete _0x704b79[_0x696e('0x4b')]['id'];}return db[_0x696e('0x30')][_0x696e('0x49')]({'where':{'id':_0x704b79['params']['id']}})[_0x696e('0x25')](handleEntityNotFound(_0x3a0b38,null))[_0x696e('0x25')](saveUpdates(_0x704b79[_0x696e('0x4b')],null))[_0x696e('0x25')](respondWithResult(_0x3a0b38,null))['catch'](handleError(_0x3a0b38,null));};exports[_0x696e('0x26')]=function(_0x185751,_0x408f5d){return db[_0x696e('0x30')][_0x696e('0x49')]({'where':{'id':_0x185751[_0x696e('0x46')]['id']}})[_0x696e('0x25')](handleEntityNotFound(_0x408f5d,null))[_0x696e('0x25')](removeEntity(_0x408f5d,null))[_0x696e('0x44')](handleError(_0x408f5d,null));};exports['create']=function(_0x6d1bd8,_0x24f0e4){var _0x118a3b={'key':_0x6d1bd8[_0x696e('0x4b')][_0x696e('0x4c')]};if(_0x6d1bd8[_0x696e('0x4b')]['MailAccountId']){_0x118a3b[_0x696e('0x4d')]=_0x6d1bd8[_0x696e('0x4b')]['MailAccountId'];}else if(_0x6d1bd8[_0x696e('0x4b')][_0x696e('0x4e')]){_0x118a3b[_0x696e('0x4e')]=_0x6d1bd8[_0x696e('0x4b')][_0x696e('0x4e')];}else if(_0x6d1bd8[_0x696e('0x4b')][_0x696e('0x4f')]){_0x118a3b['OpenchannelAccountId']=_0x6d1bd8[_0x696e('0x4b')]['OpenchannelAccountId'];}else if(_0x6d1bd8[_0x696e('0x4b')][_0x696e('0x50')]){_0x118a3b[_0x696e('0x50')]=_0x6d1bd8[_0x696e('0x4b')][_0x696e('0x50')];}return db[_0x696e('0x30')]['find']({'where':_0x118a3b})[_0x696e('0x25')](function(_0x434af3){if(_0x434af3){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x696e('0x51')](_0x6d1bd8[_0x696e('0x4b')]);})[_0x696e('0x25')](function(_0x181f2c){var _0x165acc=_0x6d1bd8[_0x696e('0x52')]['get']({'plain':!![]});if(!_0x165acc)throw new Error(_0x696e('0x53'));if(_0x165acc[_0x696e('0x54')]==='user'){var _0x1257d9=_0x181f2c[_0x696e('0x27')]({'plain':!![]});return db[_0x696e('0x55')]['find']({'where':{'name':_0x696e('0x28'),'userProfileId':_0x165acc[_0x696e('0x56')]},'raw':!![]})[_0x696e('0x25')](function(_0x4366d4){if(_0x4366d4&&_0x4366d4[_0x696e('0x57')]===0x0){return db[_0x696e('0x29')][_0x696e('0x51')]({'name':_0x1257d9[_0x696e('0x2d')],'resourceId':_0x1257d9['id'],'type':_0x4366d4[_0x696e('0x2d')],'sectionId':_0x4366d4['id']},{})[_0x696e('0x25')](function(){return _0x181f2c;});}else{return _0x181f2c;}})[_0x696e('0x44')](function(_0x29bf3f){logger[_0x696e('0x2b')](_0x696e('0x58'),_0x29bf3f);throw _0x29bf3f;});}return _0x181f2c;})[_0x696e('0x25')](respondWithResult(_0x24f0e4,0xc9))[_0x696e('0x44')](handleError(_0x24f0e4,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index cf85ecb..3a06dd6 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 _0x9d3f=['utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers'];(function(_0x1e814b,_0x4262ac){var _0x13456c=function(_0x205d42){while(--_0x205d42){_0x1e814b['push'](_0x1e814b['shift']());}};_0x13456c(++_0x4262ac);}(_0x9d3f,0x18e));var _0xf9d3=function(_0x17d011,_0x441407){_0x17d011=_0x17d011-0x0;var _0x4c754a=_0x9d3f[_0x17d011];return _0x4c754a;};'use strict';var _=require('lodash');var util=require(_0xf9d3('0x0'));var logger=require('../../config/logger')(_0xf9d3('0x1'));var moment=require(_0xf9d3('0x2'));var BPromise=require(_0xf9d3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf9d3('0x4'));var config=require(_0xf9d3('0x5'));var attributes=require(_0xf9d3('0x6'));module['exports']=function(_0x29d4ef,_0x273ef5){return _0x29d4ef[_0xf9d3('0x7')](_0xf9d3('0x8'),attributes,{'tableName':_0xf9d3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf9d3('0xa'),'collate':_0xf9d3('0xb')});}; \ No newline at end of file +var _0x8f37=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','./cannedAnswer.attributes','define'];(function(_0x276628,_0x56bc4b){var _0x182325=function(_0x4072a0){while(--_0x4072a0){_0x276628['push'](_0x276628['shift']());}};_0x182325(++_0x56bc4b);}(_0x8f37,0x100));var _0x78f3=function(_0x310721,_0x537b22){_0x310721=_0x310721-0x0;var _0x364515=_0x8f37[_0x310721];return _0x364515;};'use strict';var _=require(_0x78f3('0x0'));var util=require(_0x78f3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x78f3('0x2'));var BPromise=require(_0x78f3('0x3'));var rp=require(_0x78f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x78f3('0x5'));var config=require('../../config/environment');var attributes=require(_0x78f3('0x6'));module['exports']=function(_0x2ff2d5,_0x9807a5){return _0x2ff2d5[_0x78f3('0x7')]('CannedAnswer',attributes,{'tableName':_0x78f3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x78f3('0x9'),'collate':_0x78f3('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 14852d4..58f2d47 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(_0xe431fd,_0x437ce0){var _0x80aee5=function(_0x3bb191){while(--_0x3bb191){_0xe431fd['push'](_0xe431fd['shift']());}};_0x80aee5(++_0x437ce0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x5d31ef,_0x146a61){var _0x3fe0b5=function(_0x20cea1){while(--_0x20cea1){_0x5d31ef['push'](_0x5d31ef['shift']());}};_0x3fe0b5(++_0x146a61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 20dfc0d..c4e8a2a 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 _0x74b7=['index','/:id','show','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated'];(function(_0x2157fe,_0x4f7ac4){var _0x55a8ef=function(_0x2ef1dc){while(--_0x2ef1dc){_0x2157fe['push'](_0x2157fe['shift']());}};_0x55a8ef(++_0x4f7ac4);}(_0x74b7,0x174));var _0x774b=function(_0x1eb7d4,_0x11bbf7){_0x1eb7d4=_0x1eb7d4-0x0;var _0xce6879=_0x74b7[_0x1eb7d4];return _0xce6879;};'use strict';var multer=require(_0x774b('0x0'));var util=require(_0x774b('0x1'));var path=require(_0x774b('0x2'));var timeout=require(_0x774b('0x3'));var express=require('express');var router=express[_0x774b('0x4')]();var fs_extra=require(_0x774b('0x5'));var auth=require(_0x774b('0x6'));var interaction=require(_0x774b('0x7'));var config=require(_0x774b('0x8'));var controller=require(_0x774b('0x9'));router[_0x774b('0xa')]('/',auth[_0x774b('0xb')](),controller[_0x774b('0xc')]);router[_0x774b('0xa')](_0x774b('0xd'),auth[_0x774b('0xb')](),controller[_0x774b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x774b('0xd'),auth[_0x774b('0xb')](),controller[_0x774b('0xf')]);router['delete'](_0x774b('0xd'),auth[_0x774b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xff5a=['put','delete','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x508fba,_0x508b43){var _0x58876b=function(_0x5b70dc){while(--_0x5b70dc){_0x508fba['push'](_0x508fba['shift']());}};_0x58876b(++_0x508b43);}(_0xff5a,0x14c));var _0xaff5=function(_0x474b57,_0x399738){_0x474b57=_0x474b57-0x0;var _0x5aa476=_0xff5a[_0x474b57];return _0x5aa476;};'use strict';var multer=require('multer');var util=require(_0xaff5('0x0'));var path=require(_0xaff5('0x1'));var timeout=require(_0xaff5('0x2'));var express=require('express');var router=express[_0xaff5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaff5('0x4'));var config=require(_0xaff5('0x5'));var controller=require(_0xaff5('0x6'));router[_0xaff5('0x7')]('/',auth[_0xaff5('0x8')](),controller[_0xaff5('0x9')]);router[_0xaff5('0x7')](_0xaff5('0xa'),auth[_0xaff5('0x8')](),controller[_0xaff5('0xb')]);router[_0xaff5('0xc')]('/',auth[_0xaff5('0x8')](),controller['create']);router[_0xaff5('0xd')](_0xaff5('0xa'),auth[_0xaff5('0x8')](),controller['update']);router[_0xaff5('0xe')](_0xaff5('0xa'),auth[_0xaff5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 9bad500..7d979c0 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 _0x18e0=['STRING','INTEGER','exports','1970-01-01\x2000:00:01'];(function(_0xd33936,_0x1ffe76){var _0x899e0a=function(_0x3129c1){while(--_0x3129c1){_0xd33936['push'](_0xd33936['shift']());}};_0x899e0a(++_0x1ffe76);}(_0x18e0,0xa2));var _0x018e=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x18e0[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require('sequelize');module[_0x018e('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x018e('0x1')},'clid':{'type':Sequelize[_0x018e('0x2')]},'src':{'type':Sequelize[_0x018e('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x018e('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x018e('0x2')]},'lastdata':{'type':Sequelize[_0x018e('0x2')]},'duration':{'type':Sequelize[_0x018e('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x018e('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x018e('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x018e('0x2')]},'linkedid':{'type':Sequelize[_0x018e('0x2')]},'sequence':{'type':Sequelize[_0x018e('0x2')]},'peeraccount':{'type':Sequelize[_0x018e('0x2')]},'type':{'type':Sequelize[_0x018e('0x2')]},'tag':{'type':Sequelize[_0x018e('0x2')]}}; \ No newline at end of file +var _0x97f5=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0x97f5,0x72));var _0x597f=function(_0xabba36,_0x5c87ea){_0xabba36=_0xabba36-0x0;var _0x4f955c=_0x97f5[_0xabba36];return _0x4f955c;};'use strict';var Sequelize=require(_0x597f('0x0'));module[_0x597f('0x1')]={'calldate':{'type':Sequelize[_0x597f('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x597f('0x3')]},'dst':{'type':Sequelize[_0x597f('0x3')]},'dcontext':{'type':Sequelize[_0x597f('0x3')]},'channel':{'type':Sequelize[_0x597f('0x3')]},'dstchannel':{'type':Sequelize[_0x597f('0x3')]},'lastapp':{'type':Sequelize[_0x597f('0x3')]},'lastdata':{'type':Sequelize[_0x597f('0x3')]},'duration':{'type':Sequelize[_0x597f('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x597f('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x597f('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x597f('0x3')]},'userfield':{'type':Sequelize[_0x597f('0x3')]},'uniqueid':{'type':Sequelize[_0x597f('0x3')]},'linkedid':{'type':Sequelize[_0x597f('0x3')]},'sequence':{'type':Sequelize[_0x597f('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x597f('0x3')]},'tag':{'type':Sequelize[_0x597f('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index da97343..6fabc2a 100644 --- a/server/api/cdr/cdr.controller.js +++ b/server/api/cdr/cdr.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafdd=['pick','filter','merge','type','VIRTUAL','options','Cdr','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','fieldName','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xafdd,0x19a));var _0xdafd=function(_0x28e5b3,_0x33c91d){_0x28e5b3=_0x28e5b3-0x0;var _0x24d7d5=_0xafdd[_0x28e5b3];return _0x24d7d5;};'use strict';var emlformat=require(_0xdafd('0x0'));var rimraf=require(_0xdafd('0x1'));var zipdir=require(_0xdafd('0x2'));var jsonpatch=require(_0xdafd('0x3'));var rp=require(_0xdafd('0x4'));var moment=require(_0xdafd('0x5'));var BPromise=require(_0xdafd('0x6'));var Mustache=require(_0xdafd('0x7'));var util=require('util');var path=require(_0xdafd('0x8'));var sox=require(_0xdafd('0x9'));var csv=require(_0xdafd('0xa'));var ejs=require(_0xdafd('0xb'));var fs=require('fs');var fs_extra=require(_0xdafd('0xc'));var _=require(_0xdafd('0xd'));var squel=require(_0xdafd('0xe'));var crypto=require('crypto');var jsforce=require(_0xdafd('0xf'));var deskjs=require(_0xdafd('0x10'));var toCsv=require(_0xdafd('0xa'));var querystring=require('querystring');var Papa=require(_0xdafd('0x11'));var Redis=require(_0xdafd('0x12'));var authService=require(_0xdafd('0x13'));var qs=require(_0xdafd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdafd('0x15'));var logger=require(_0xdafd('0x16'))(_0xdafd('0x17'));var utils=require(_0xdafd('0x18'));var config=require(_0xdafd('0x19'));var licenseUtil=require(_0xdafd('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x166176,_0x594f47){_0x594f47=_0x594f47||0xcc;return function(_0x553508){if(_0x553508){return _0x166176[_0xdafd('0x1b')](_0x594f47);}return _0x166176[_0xdafd('0x1c')](_0x594f47)['end']();};}function respondWithResult(_0x43a716,_0x490382){_0x490382=_0x490382||0xc8;return function(_0x4b09da){if(_0x4b09da){return _0x43a716[_0xdafd('0x1c')](_0x490382)[_0xdafd('0x1d')](_0x4b09da);}};}function respondWithFilteredResult(_0x583b1d,_0x267bfc){return function(_0x186379){if(_0x186379){var _0x496515=typeof _0x267bfc[_0xdafd('0x1e')]===_0xdafd('0x1f')&&typeof _0x267bfc[_0xdafd('0x20')]==='undefined';var _0xb382ca=_0x186379[_0xdafd('0x21')];var _0x4fc3a4=_0x496515?0x0:_0x267bfc['offset'];var _0x2569b2=_0x496515?_0x186379['count']:_0x267bfc[_0xdafd('0x1e')]+_0x267bfc[_0xdafd('0x20')];var _0x1e64d3;if(_0x2569b2>=_0xb382ca){_0x2569b2=_0xb382ca;_0x1e64d3=0xc8;}else{_0x1e64d3=0xce;}_0x583b1d[_0xdafd('0x1c')](_0x1e64d3);return _0x583b1d[_0xdafd('0x22')](_0xdafd('0x23'),_0x4fc3a4+'-'+_0x2569b2+'/'+_0xb382ca)[_0xdafd('0x1d')](_0x186379);}return null;};}function patchUpdates(_0x42e0f9){return function(_0x8480a8){try{jsonpatch[_0xdafd('0x24')](_0x8480a8,_0x42e0f9,!![]);}catch(_0xee767e){return BPromise[_0xdafd('0x25')](_0xee767e);}return _0x8480a8[_0xdafd('0x26')]();};}function saveUpdates(_0xf4a521,_0x491d96){return function(_0x230495){if(_0x230495){return _0x230495['update'](_0xf4a521)[_0xdafd('0x27')](function(_0x5e96cc){return _0x5e96cc;});}return null;};}function removeEntity(_0x439bbf,_0x35ef78){return function(_0x7f10f6){if(_0x7f10f6){return _0x7f10f6[_0xdafd('0x28')]()[_0xdafd('0x27')](function(){_0x439bbf[_0xdafd('0x1c')](0xcc)[_0xdafd('0x29')]();});}};}function handleEntityNotFound(_0x30cba9,_0x3846dd){return function(_0x5cd11d){if(!_0x5cd11d){_0x30cba9[_0xdafd('0x1b')](0x194);}return _0x5cd11d;};}function handleError(_0x2ab575,_0x18554c){_0x18554c=_0x18554c||0x1f4;return function(_0x1feb5b){logger[_0xdafd('0x2a')](_0x1feb5b[_0xdafd('0x2b')]);if(_0x1feb5b[_0xdafd('0x2c')]){delete _0x1feb5b[_0xdafd('0x2c')];}_0x2ab575[_0xdafd('0x1c')](_0x18554c)[_0xdafd('0x2d')](_0x1feb5b);};}exports['index']=function(_0x243182,_0x14626b){var _0x13ab81={},_0x249743={},_0x21edb6={'count':0x0,'rows':[]};var _0x324f0f=_['map'](db['Cdr']['rawAttributes'],function(_0xcca4f){return{'name':_0xcca4f[_0xdafd('0x2e')],'type':_0xcca4f['type']['key']};});_0x249743[_0xdafd('0x2f')]=_[_0xdafd('0x30')](_0x324f0f,_0xdafd('0x2c'));_0x249743[_0xdafd('0x31')]=_[_0xdafd('0x32')](_0x243182[_0xdafd('0x31')]);_0x249743[_0xdafd('0x33')]=_['intersection'](_0x249743[_0xdafd('0x2f')],_0x249743[_0xdafd('0x31')]);_0x13ab81[_0xdafd('0x34')]=_['intersection'](_0x249743[_0xdafd('0x2f')],qs[_0xdafd('0x35')](_0x243182['query'][_0xdafd('0x35')]));_0x13ab81[_0xdafd('0x34')]=_0x13ab81[_0xdafd('0x34')]['length']?_0x13ab81[_0xdafd('0x34')]:_0x249743[_0xdafd('0x2f')];if(!_0x243182[_0xdafd('0x31')][_0xdafd('0x36')](_0xdafd('0x37'))){_0x13ab81[_0xdafd('0x20')]=qs[_0xdafd('0x20')](_0x243182['query'][_0xdafd('0x20')]);_0x13ab81[_0xdafd('0x1e')]=qs[_0xdafd('0x1e')](_0x243182[_0xdafd('0x31')][_0xdafd('0x1e')]);}_0x13ab81['order']=qs[_0xdafd('0x38')](_0x243182[_0xdafd('0x31')]['sort']);_0x13ab81[_0xdafd('0x39')]=qs[_0xdafd('0x33')](_[_0xdafd('0x3a')](_0x243182[_0xdafd('0x31')],_0x249743[_0xdafd('0x33')]),_0x324f0f);if(_0x243182[_0xdafd('0x31')][_0xdafd('0x3b')]){_0x13ab81[_0xdafd('0x39')]=_[_0xdafd('0x3c')](_0x13ab81[_0xdafd('0x39')],{'$or':_[_0xdafd('0x30')](_0x324f0f,function(_0x245163){if(_0x245163[_0xdafd('0x3d')]!==_0xdafd('0x3e')){var _0xb1e264={};_0xb1e264[_0x245163[_0xdafd('0x2c')]]={'$like':'%'+_0x243182[_0xdafd('0x31')][_0xdafd('0x3b')]+'%'};return _0xb1e264;}})});}_0x13ab81=_[_0xdafd('0x3c')]({},_0x13ab81,_0x243182[_0xdafd('0x3f')]);var _0x3f25c2={'where':_0x13ab81[_0xdafd('0x39')]};return db[_0xdafd('0x40')][_0xdafd('0x21')](_0x3f25c2)[_0xdafd('0x27')](function(_0x21d43d){_0x21edb6['count']=_0x21d43d;if(_0x243182['query'][_0xdafd('0x41')]){_0x13ab81['include']=[{'all':!![]}];}return db[_0xdafd('0x40')][_0xdafd('0x42')](_0x13ab81);})['then'](function(_0x4b463c){_0x21edb6[_0xdafd('0x43')]=_0x4b463c;return _0x21edb6;})[_0xdafd('0x27')](respondWithFilteredResult(_0x14626b,_0x13ab81))[_0xdafd('0x44')](handleError(_0x14626b,null));};exports[_0xdafd('0x45')]=function(_0xbc5159,_0x184a59){var _0x3a3a14={'raw':!![],'where':{'id':_0xbc5159[_0xdafd('0x46')]['id']}},_0x2417f8={};_0x2417f8['model']=_['keys'](db[_0xdafd('0x40')][_0xdafd('0x47')]);_0x2417f8[_0xdafd('0x31')]=_[_0xdafd('0x32')](_0xbc5159[_0xdafd('0x31')]);_0x2417f8[_0xdafd('0x33')]=_[_0xdafd('0x48')](_0x2417f8[_0xdafd('0x2f')],_0x2417f8[_0xdafd('0x31')]);_0x3a3a14[_0xdafd('0x34')]=_[_0xdafd('0x48')](_0x2417f8[_0xdafd('0x2f')],qs[_0xdafd('0x35')](_0xbc5159['query'][_0xdafd('0x35')]));_0x3a3a14['attributes']=_0x3a3a14[_0xdafd('0x34')]['length']?_0x3a3a14[_0xdafd('0x34')]:_0x2417f8[_0xdafd('0x2f')];if(_0xbc5159[_0xdafd('0x31')][_0xdafd('0x41')]){_0x3a3a14[_0xdafd('0x49')]=[{'all':!![]}];}_0x3a3a14=_[_0xdafd('0x3c')]({},_0x3a3a14,_0xbc5159['options']);return db[_0xdafd('0x40')][_0xdafd('0x4a')](_0x3a3a14)[_0xdafd('0x27')](handleEntityNotFound(_0x184a59,null))[_0xdafd('0x27')](respondWithResult(_0x184a59,null))[_0xdafd('0x44')](handleError(_0x184a59,null));};exports['create']=function(_0x48cc85,_0x189d61){return db[_0xdafd('0x40')][_0xdafd('0x4b')](_0x48cc85[_0xdafd('0x4c')],{})[_0xdafd('0x27')](respondWithResult(_0x189d61,0xc9))[_0xdafd('0x44')](handleError(_0x189d61,null));};exports[_0xdafd('0x4d')]=function(_0x2f5e4c,_0x2ae4cd){if(_0x2f5e4c['body']['id']){delete _0x2f5e4c[_0xdafd('0x4c')]['id'];}return db[_0xdafd('0x40')][_0xdafd('0x4a')]({'where':{'id':_0x2f5e4c[_0xdafd('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ae4cd,null))[_0xdafd('0x27')](saveUpdates(_0x2f5e4c[_0xdafd('0x4c')],null))[_0xdafd('0x27')](respondWithResult(_0x2ae4cd,null))[_0xdafd('0x44')](handleError(_0x2ae4cd,null));};exports[_0xdafd('0x28')]=function(_0x4b6fbb,_0x5af1a8){return db[_0xdafd('0x40')][_0xdafd('0x4a')]({'where':{'id':_0x4b6fbb['params']['id']}})['then'](handleEntityNotFound(_0x5af1a8,null))[_0xdafd('0x27')](removeEntity(_0x5af1a8,null))[_0xdafd('0x44')](handleError(_0x5af1a8,null));};exports['describe']=function(_0x2dde06,_0x5dc9a0){return db[_0xdafd('0x40')]['describe']()['then'](respondWithResult(_0x5dc9a0,null))[_0xdafd('0x44')](handleError(_0x5dc9a0,null));}; \ No newline at end of file +var _0x25fa=['json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25fa,0x109));var _0xa25f=function(_0xce49b5,_0x53f50e){_0xce49b5=_0xce49b5-0x0;var _0x321ac3=_0x25fa[_0xce49b5];return _0x321ac3;};'use strict';var emlformat=require(_0xa25f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa25f('0x1'));var jsonpatch=require(_0xa25f('0x2'));var rp=require('request-promise');var moment=require(_0xa25f('0x3'));var BPromise=require(_0xa25f('0x4'));var Mustache=require(_0xa25f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa25f('0x6'));var csv=require('to-csv');var ejs=require(_0xa25f('0x7'));var fs=require('fs');var fs_extra=require(_0xa25f('0x8'));var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0xe'));var querystring=require(_0xa25f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa25f('0x10'));var authService=require(_0xa25f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x12'));var hardwareService=require(_0xa25f('0x13'));var logger=require(_0xa25f('0x14'))(_0xa25f('0x15'));var utils=require('../../config/utils');var config=require(_0xa25f('0x16'));var licenseUtil=require(_0xa25f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e970c,_0x465e41){_0x465e41=_0x465e41||0xcc;return function(_0x50bb78){if(_0x50bb78){return _0x3e970c[_0xa25f('0x18')](_0x465e41);}return _0x3e970c[_0xa25f('0x19')](_0x465e41)[_0xa25f('0x1a')]();};}function respondWithResult(_0x4b3792,_0x199e18){_0x199e18=_0x199e18||0xc8;return function(_0x2a627f){if(_0x2a627f){return _0x4b3792[_0xa25f('0x19')](_0x199e18)[_0xa25f('0x1b')](_0x2a627f);}};}function respondWithFilteredResult(_0x465809,_0x2d2417){return function(_0x1e5836){if(_0x1e5836){var _0x1859ba=typeof _0x2d2417['offset']===_0xa25f('0x1c')&&typeof _0x2d2417[_0xa25f('0x1d')]===_0xa25f('0x1c');var _0x451a6e=_0x1e5836[_0xa25f('0x1e')];var _0x427105=_0x1859ba?0x0:_0x2d2417['offset'];var _0x292171=_0x1859ba?_0x1e5836['count']:_0x2d2417[_0xa25f('0x1f')]+_0x2d2417['limit'];var _0x559c89;if(_0x292171>=_0x451a6e){_0x292171=_0x451a6e;_0x559c89=0xc8;}else{_0x559c89=0xce;}_0x465809[_0xa25f('0x19')](_0x559c89);return _0x465809['set'](_0xa25f('0x20'),_0x427105+'-'+_0x292171+'/'+_0x451a6e)[_0xa25f('0x1b')](_0x1e5836);}return null;};}function patchUpdates(_0x2aaf3a){return function(_0x3c2665){try{jsonpatch[_0xa25f('0x21')](_0x3c2665,_0x2aaf3a,!![]);}catch(_0x504135){return BPromise[_0xa25f('0x22')](_0x504135);}return _0x3c2665[_0xa25f('0x23')]();};}function saveUpdates(_0x371716,_0x14b7f6){return function(_0x5d2803){if(_0x5d2803){return _0x5d2803[_0xa25f('0x24')](_0x371716)[_0xa25f('0x25')](function(_0x248c0c){return _0x248c0c;});}return null;};}function removeEntity(_0x3675b5,_0x4c6f4d){return function(_0x2b710f){if(_0x2b710f){return _0x2b710f[_0xa25f('0x26')]()[_0xa25f('0x25')](function(){_0x3675b5[_0xa25f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2812d7,_0x898446){return function(_0x53f011){if(!_0x53f011){_0x2812d7[_0xa25f('0x18')](0x194);}return _0x53f011;};}function handleError(_0x51dbf8,_0x2df893){_0x2df893=_0x2df893||0x1f4;return function(_0x4eb7b7){logger[_0xa25f('0x27')](_0x4eb7b7[_0xa25f('0x28')]);if(_0x4eb7b7['name']){delete _0x4eb7b7[_0xa25f('0x29')];}_0x51dbf8[_0xa25f('0x19')](_0x2df893)['send'](_0x4eb7b7);};}exports[_0xa25f('0x2a')]=function(_0x5d39c7,_0x1030c4){var _0x41a847={},_0x472114={},_0x208518={'count':0x0,'rows':[]};var _0x334629=_['map'](db[_0xa25f('0x2b')][_0xa25f('0x2c')],function(_0x119ffc){return{'name':_0x119ffc[_0xa25f('0x2d')],'type':_0x119ffc[_0xa25f('0x2e')]['key']};});_0x472114[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x334629,_0xa25f('0x29'));_0x472114[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0x5d39c7[_0xa25f('0x31')]);_0x472114[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x472114[_0xa25f('0x2f')],_0x472114['query']);_0x41a847['attributes']=_['intersection'](_0x472114[_0xa25f('0x2f')],qs[_0xa25f('0x35')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x35')]));_0x41a847[_0xa25f('0x36')]=_0x41a847[_0xa25f('0x36')][_0xa25f('0x37')]?_0x41a847[_0xa25f('0x36')]:_0x472114[_0xa25f('0x2f')];if(!_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x38')]('nolimit')){_0x41a847['limit']=qs[_0xa25f('0x1d')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x1d')]);_0x41a847['offset']=qs['offset'](_0x5d39c7['query'][_0xa25f('0x1f')]);}_0x41a847[_0xa25f('0x39')]=qs[_0xa25f('0x3a')](_0x5d39c7['query']['sort']);_0x41a847[_0xa25f('0x3b')]=qs[_0xa25f('0x33')](_['pick'](_0x5d39c7['query'],_0x472114[_0xa25f('0x33')]),_0x334629);if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]){_0x41a847['where']=_[_0xa25f('0x3d')](_0x41a847[_0xa25f('0x3b')],{'$or':_[_0xa25f('0x30')](_0x334629,function(_0x49556e){if(_0x49556e['type']!==_0xa25f('0x3e')){var _0x44c9c8={};_0x44c9c8[_0x49556e[_0xa25f('0x29')]]={'$like':'%'+_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]+'%'};return _0x44c9c8;}})});}_0x41a847=_[_0xa25f('0x3d')]({},_0x41a847,_0x5d39c7[_0xa25f('0x3f')]);var _0x3382f4={'where':_0x41a847['where']};return db[_0xa25f('0x2b')][_0xa25f('0x1e')](_0x3382f4)[_0xa25f('0x25')](function(_0x2e886f){_0x208518[_0xa25f('0x1e')]=_0x2e886f;if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x40')]){_0x41a847[_0xa25f('0x41')]=[{'all':!![]}];}return db[_0xa25f('0x2b')][_0xa25f('0x42')](_0x41a847);})[_0xa25f('0x25')](function(_0x3267a0){_0x208518[_0xa25f('0x43')]=_0x3267a0;return _0x208518;})['then'](respondWithFilteredResult(_0x1030c4,_0x41a847))[_0xa25f('0x44')](handleError(_0x1030c4,null));};exports['show']=function(_0xace015,_0x320119){var _0x36afe4={'raw':!![],'where':{'id':_0xace015[_0xa25f('0x45')]['id']}},_0x559874={};_0x559874[_0xa25f('0x2f')]=_[_0xa25f('0x32')](db[_0xa25f('0x2b')]['rawAttributes']);_0x559874[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0xace015[_0xa25f('0x31')]);_0x559874[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x559874[_0xa25f('0x2f')],_0x559874['query']);_0x36afe4[_0xa25f('0x36')]=_[_0xa25f('0x34')](_0x559874['model'],qs[_0xa25f('0x35')](_0xace015[_0xa25f('0x31')][_0xa25f('0x35')]));_0x36afe4[_0xa25f('0x36')]=_0x36afe4[_0xa25f('0x36')][_0xa25f('0x37')]?_0x36afe4[_0xa25f('0x36')]:_0x559874[_0xa25f('0x2f')];if(_0xace015[_0xa25f('0x31')][_0xa25f('0x40')]){_0x36afe4[_0xa25f('0x41')]=[{'all':!![]}];}_0x36afe4=_[_0xa25f('0x3d')]({},_0x36afe4,_0xace015[_0xa25f('0x3f')]);return db['Cdr'][_0xa25f('0x46')](_0x36afe4)[_0xa25f('0x25')](handleEntityNotFound(_0x320119,null))[_0xa25f('0x25')](respondWithResult(_0x320119,null))[_0xa25f('0x44')](handleError(_0x320119,null));};exports['create']=function(_0x34717c,_0x43888b){return db[_0xa25f('0x2b')]['create'](_0x34717c[_0xa25f('0x47')],{})[_0xa25f('0x25')](respondWithResult(_0x43888b,0xc9))[_0xa25f('0x44')](handleError(_0x43888b,null));};exports[_0xa25f('0x24')]=function(_0x18c9f2,_0x3b6d34){if(_0x18c9f2[_0xa25f('0x47')]['id']){delete _0x18c9f2[_0xa25f('0x47')]['id'];}return db['Cdr'][_0xa25f('0x46')]({'where':{'id':_0x18c9f2[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0x3b6d34,null))[_0xa25f('0x25')](saveUpdates(_0x18c9f2[_0xa25f('0x47')],null))[_0xa25f('0x25')](respondWithResult(_0x3b6d34,null))[_0xa25f('0x44')](handleError(_0x3b6d34,null));};exports[_0xa25f('0x26')]=function(_0x26a096,_0xe04d67){return db[_0xa25f('0x2b')][_0xa25f('0x46')]({'where':{'id':_0x26a096[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0xe04d67,null))[_0xa25f('0x25')](removeEntity(_0xe04d67,null))[_0xa25f('0x44')](handleError(_0xe04d67,null));};exports[_0xa25f('0x48')]=function(_0x2fedba,_0x32f719){return db[_0xa25f('0x2b')][_0xa25f('0x48')]()[_0xa25f('0x25')](respondWithResult(_0x32f719,null))['catch'](handleError(_0x32f719,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ff7f640..82adeea 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5bb2d8,_0x47a1db){var _0x19dc01=function(_0x205c45){while(--_0x205c45){_0x5bb2d8['push'](_0x5bb2d8['shift']());}};_0x19dc01(++_0x47a1db);}(_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':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x199ea1,_0x1a3d0b){var _0x1e746a=function(_0x3c44d4){while(--_0x3c44d4){_0x199ea1['push'](_0x199ea1['shift']());}};_0x1e746a(++_0x1a3d0b);}(_0x7a54,0x106));var _0x47a5=function(_0x3c9485,_0x355fd1){_0x3c9485=_0x3c9485-0x0;var _0x4bced0=_0x7a54[_0x3c9485];return _0x4bced0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 94c134c..afdb352 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 _0x90ea=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','debug','request\x20sent','code','error','message','info','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x90ea,0xa3));var _0xa90e=function(_0x17fba1,_0x4533c1){_0x17fba1=_0x17fba1-0x0;var _0x5d95b1=_0x90ea[_0x17fba1];return _0x5d95b1;};'use strict';var _=require('lodash');var util=require(_0xa90e('0x0'));var moment=require('moment');var BPromise=require(_0xa90e('0x1'));var rs=require(_0xa90e('0x2'));var fs=require('fs');var Redis=require(_0xa90e('0x3'));var db=require(_0xa90e('0x4'))['db'];var utils=require(_0xa90e('0x5'));var logger=require(_0xa90e('0x6'))(_0xa90e('0x7'));var config=require(_0xa90e('0x8'));var jayson=require(_0xa90e('0x9'));var client=jayson[_0xa90e('0xa')][_0xa90e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b2176,_0x2feb65,_0x4dece6){return new BPromise(function(_0xc2d625,_0x278c34){return client[_0xa90e('0xc')](_0x1b2176,_0x4dece6)[_0xa90e('0xd')](function(_0x30388a){logger['info'](_0xa90e('0xe'),_0x2feb65,'request\x20sent');logger[_0xa90e('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x2feb65,_0xa90e('0x10'),JSON['stringify'](_0x30388a));if(_0x30388a['error']){if(_0x30388a['error'][_0xa90e('0x11')]===0x1f4){logger[_0xa90e('0x12')](_0xa90e('0xe'),_0x2feb65,_0x30388a[_0xa90e('0x12')][_0xa90e('0x13')]);return _0x278c34(_0x30388a['error'][_0xa90e('0x13')]);}logger[_0xa90e('0x12')](_0xa90e('0xe'),_0x2feb65,_0x30388a['error']['message']);return _0xc2d625(_0x30388a['error'][_0xa90e('0x13')]);}else{logger[_0xa90e('0x14')]('Cdr,\x20%s,\x20%s',_0x2feb65,_0xa90e('0x10'));_0xc2d625(_0x30388a['result'][_0xa90e('0x13')]);}})['catch'](function(_0x44f8ec){logger[_0xa90e('0x12')](_0xa90e('0xe'),_0x2feb65,_0x44f8ec);_0x278c34(_0x44f8ec);});});} \ No newline at end of file +var _0x4869=['error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2532a6,_0x25e8e9){var _0x1d6b92=function(_0x39158d){while(--_0x39158d){_0x2532a6['push'](_0x2532a6['shift']());}};_0x1d6b92(++_0x25e8e9);}(_0x4869,0x143));var _0x9486=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4869[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x9486('0x0'));var util=require('util');var moment=require(_0x9486('0x1'));var BPromise=require(_0x9486('0x2'));var rs=require(_0x9486('0x3'));var fs=require('fs');var Redis=require(_0x9486('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9486('0x5'));var logger=require('../../config/logger')(_0x9486('0x6'));var config=require(_0x9486('0x7'));var jayson=require(_0x9486('0x8'));var client=jayson[_0x9486('0x9')][_0x9486('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d8271,_0x53dc10,_0xc7b77b){return new BPromise(function(_0x17d86f,_0x410917){return client['request'](_0x5d8271,_0xc7b77b)[_0x9486('0xb')](function(_0x329839){logger[_0x9486('0xc')](_0x9486('0xd'),_0x53dc10,_0x9486('0xe'));logger['debug'](_0x9486('0xf'),_0x53dc10,_0x9486('0xe'),JSON[_0x9486('0x10')](_0x329839));if(_0x329839[_0x9486('0x11')]){if(_0x329839[_0x9486('0x11')]['code']===0x1f4){logger[_0x9486('0x11')](_0x9486('0xd'),_0x53dc10,_0x329839['error'][_0x9486('0x12')]);return _0x410917(_0x329839[_0x9486('0x11')][_0x9486('0x12')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x53dc10,_0x329839[_0x9486('0x11')]['message']);return _0x17d86f(_0x329839['error'][_0x9486('0x12')]);}else{logger[_0x9486('0xc')](_0x9486('0xd'),_0x53dc10,_0x9486('0xe'));_0x17d86f(_0x329839['result'][_0x9486('0x12')]);}})[_0x9486('0x13')](function(_0x4c51a0){logger[_0x9486('0x11')](_0x9486('0xd'),_0x53dc10,_0x4c51a0);_0x410917(_0x4c51a0);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 4cd0360..7efc5b1 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x54bc96,_0x20cb68){var _0x4685b9=function(_0x41f797){while(--_0x41f797){_0x54bc96['push'](_0x54bc96['shift']());}};_0x4685b9(++_0x20cb68);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x24d24e,_0x4e17a4){var _0x20e068=function(_0x48d5e5){while(--_0x48d5e5){_0x24d24e['push'](_0x24d24e['shift']());}};_0x20e068(++_0x4e17a4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 13ccae6..ac57be7 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 _0x64a6=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x557c42,_0x13d1b1){var _0x2c56f9=function(_0x1055c1){while(--_0x1055c1){_0x557c42['push'](_0x557c42['shift']());}};_0x2c56f9(++_0x13d1b1);}(_0x64a6,0x183));var _0x664a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x64a6[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x664a('0x0'));module[_0x664a('0x1')]={'priority':{'type':Sequelize[_0x664a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x664a('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x664a('0x4')],'defaultValue':_0x664a('0x5')}}; \ No newline at end of file +var _0x4894=['STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x5a9e32,_0x3197fd){var _0x521b3f=function(_0x55f4f9){while(--_0x55f4f9){_0x5a9e32['push'](_0x5a9e32['shift']());}};_0x521b3f(++_0x3197fd);}(_0x4894,0x17e));var _0x4489=function(_0x112ed7,_0x3f0c19){_0x112ed7=_0x112ed7-0x0;var _0xd240bd=_0x4894[_0x112ed7];return _0xd240bd;};'use strict';var Sequelize=require(_0x4489('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4489('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4489('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4489('0x2')]},'interval':{'type':Sequelize[_0x4489('0x2')],'defaultValue':_0x4489('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index fbc88ba..3d217b3 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 _0x4627=['Content-Range','json','apply','reject','save','then','end','sendStatus','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','merge','find','catch','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4627,0x115));var _0x7462=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x4627[_0x45bf86];return _0x1f02b7;};'use strict';var emlformat=require(_0x7462('0x0'));var rimraf=require(_0x7462('0x1'));var zipdir=require(_0x7462('0x2'));var jsonpatch=require(_0x7462('0x3'));var rp=require(_0x7462('0x4'));var moment=require(_0x7462('0x5'));var BPromise=require(_0x7462('0x6'));var Mustache=require(_0x7462('0x7'));var util=require(_0x7462('0x8'));var path=require(_0x7462('0x9'));var sox=require(_0x7462('0xa'));var csv=require(_0x7462('0xb'));var ejs=require(_0x7462('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7462('0xd'));var squel=require(_0x7462('0xe'));var crypto=require(_0x7462('0xf'));var jsforce=require(_0x7462('0x10'));var deskjs=require(_0x7462('0x11'));var toCsv=require(_0x7462('0xb'));var querystring=require(_0x7462('0x12'));var Papa=require(_0x7462('0x13'));var Redis=require(_0x7462('0x14'));var authService=require(_0x7462('0x15'));var qs=require(_0x7462('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7462('0x17'))(_0x7462('0x18'));var utils=require(_0x7462('0x19'));var config=require(_0x7462('0x1a'));var licenseUtil=require(_0x7462('0x1b'));var db=require(_0x7462('0x1c'))['db'];function respondWithStatusCode(_0x31bf84,_0x4e313a){_0x4e313a=_0x4e313a||0xcc;return function(_0x5cb363){if(_0x5cb363){return _0x31bf84['sendStatus'](_0x4e313a);}return _0x31bf84[_0x7462('0x1d')](_0x4e313a)['end']();};}function respondWithResult(_0x1ba7e5,_0x461bd2){_0x461bd2=_0x461bd2||0xc8;return function(_0x368f45){if(_0x368f45){return _0x1ba7e5[_0x7462('0x1d')](_0x461bd2)['json'](_0x368f45);}};}function respondWithFilteredResult(_0x27b8f5,_0x4913ff){return function(_0x36b008){if(_0x36b008){var _0x42ed50=typeof _0x4913ff[_0x7462('0x1e')]===_0x7462('0x1f')&&typeof _0x4913ff['limit']===_0x7462('0x1f');var _0x56ed70=_0x36b008[_0x7462('0x20')];var _0x216eba=_0x42ed50?0x0:_0x4913ff[_0x7462('0x1e')];var _0x26e25f=_0x42ed50?_0x36b008['count']:_0x4913ff[_0x7462('0x1e')]+_0x4913ff['limit'];var _0x85341c;if(_0x26e25f>=_0x56ed70){_0x26e25f=_0x56ed70;_0x85341c=0xc8;}else{_0x85341c=0xce;}_0x27b8f5[_0x7462('0x1d')](_0x85341c);return _0x27b8f5['set'](_0x7462('0x21'),_0x216eba+'-'+_0x26e25f+'/'+_0x56ed70)[_0x7462('0x22')](_0x36b008);}return null;};}function patchUpdates(_0x4d0e60){return function(_0x25a44a){try{jsonpatch[_0x7462('0x23')](_0x25a44a,_0x4d0e60,!![]);}catch(_0x2e9a25){return BPromise[_0x7462('0x24')](_0x2e9a25);}return _0x25a44a[_0x7462('0x25')]();};}function saveUpdates(_0x4404eb,_0x32da06){return function(_0x3c9616){if(_0x3c9616){return _0x3c9616['update'](_0x4404eb)[_0x7462('0x26')](function(_0x52460e){return _0x52460e;});}return null;};}function removeEntity(_0x185934,_0x11caf5){return function(_0x290715){if(_0x290715){return _0x290715['destroy']()[_0x7462('0x26')](function(){_0x185934['status'](0xcc)[_0x7462('0x27')]();});}};}function handleEntityNotFound(_0x5473d1,_0x5759fa){return function(_0x29992b){if(!_0x29992b){_0x5473d1[_0x7462('0x28')](0x194);}return _0x29992b;};}function handleError(_0x51d9d9,_0x5575fc){_0x5575fc=_0x5575fc||0x1f4;return function(_0x554d21){logger['error'](_0x554d21['stack']);if(_0x554d21[_0x7462('0x29')]){delete _0x554d21[_0x7462('0x29')];}_0x51d9d9['status'](_0x5575fc)[_0x7462('0x2a')](_0x554d21);};}exports[_0x7462('0x2b')]=function(_0x3a3313,_0x10a673){var _0x4948c9={'raw':!![],'where':{'id':_0x3a3313[_0x7462('0x2c')]['id']}},_0x1f279b={};_0x1f279b[_0x7462('0x2d')]=_[_0x7462('0x2e')](db[_0x7462('0x2f')][_0x7462('0x30')]);_0x1f279b[_0x7462('0x31')]=_[_0x7462('0x2e')](_0x3a3313[_0x7462('0x31')]);_0x1f279b[_0x7462('0x32')]=_['intersection'](_0x1f279b[_0x7462('0x2d')],_0x1f279b['query']);_0x4948c9[_0x7462('0x33')]=_[_0x7462('0x34')](_0x1f279b[_0x7462('0x2d')],qs[_0x7462('0x35')](_0x3a3313['query'][_0x7462('0x35')]));_0x4948c9[_0x7462('0x33')]=_0x4948c9[_0x7462('0x33')][_0x7462('0x36')]?_0x4948c9[_0x7462('0x33')]:_0x1f279b[_0x7462('0x2d')];if(_0x3a3313['query'][_0x7462('0x37')]){_0x4948c9['include']=[{'all':!![]}];}_0x4948c9=_[_0x7462('0x38')]({},_0x4948c9,_0x3a3313['options']);return db[_0x7462('0x2f')][_0x7462('0x39')](_0x4948c9)['then'](handleEntityNotFound(_0x10a673,null))[_0x7462('0x26')](respondWithResult(_0x10a673,null))[_0x7462('0x3a')](handleError(_0x10a673,null));};exports[_0x7462('0x3b')]=function(_0x1f713b,_0x469a7e){if(_0x1f713b[_0x7462('0x3c')]['id']){delete _0x1f713b[_0x7462('0x3c')]['id'];}return db[_0x7462('0x2f')][_0x7462('0x39')]({'where':{'id':_0x1f713b[_0x7462('0x2c')]['id']}})[_0x7462('0x26')](handleEntityNotFound(_0x469a7e,null))[_0x7462('0x26')](saveUpdates(_0x1f713b[_0x7462('0x3c')],null))[_0x7462('0x26')](respondWithResult(_0x469a7e,null))['catch'](handleError(_0x469a7e,null));};exports[_0x7462('0x3d')]=function(_0x92edff,_0xb65b90){return db[_0x7462('0x2f')]['find']({'where':{'id':_0x92edff[_0x7462('0x2c')]['id']}})[_0x7462('0x26')](handleEntityNotFound(_0xb65b90,null))[_0x7462('0x26')](removeEntity(_0xb65b90,null))[_0x7462('0x3a')](handleError(_0xb65b90,null));}; \ No newline at end of file +var _0xee4f=['intersection','fields','attributes','length','includeAll','merge','ChatApplication','find','catch','body','params','eml-format','fast-json-patch','request-promise','moment','mustache','path','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','model','rawAttributes','query'];(function(_0x4bc53b,_0x39fc31){var _0x5743f5=function(_0x3db0ea){while(--_0x3db0ea){_0x4bc53b['push'](_0x4bc53b['shift']());}};_0x5743f5(++_0x39fc31);}(_0xee4f,0xad));var _0xfee4=function(_0xc3b888,_0x96390){_0xc3b888=_0xc3b888-0x0;var _0x3693e7=_0xee4f[_0xc3b888];return _0x3693e7;};'use strict';var emlformat=require(_0xfee4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfee4('0x1'));var rp=require(_0xfee4('0x2'));var moment=require(_0xfee4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfee4('0x4'));var util=require('util');var path=require(_0xfee4('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfee4('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfee4('0x7'));var crypto=require(_0xfee4('0x8'));var jsforce=require(_0xfee4('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfee4('0xa'));var Papa=require(_0xfee4('0xb'));var Redis=require(_0xfee4('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfee4('0xd'));var hardwareService=require(_0xfee4('0xe'));var logger=require(_0xfee4('0xf'))('api');var utils=require(_0xfee4('0x10'));var config=require(_0xfee4('0x11'));var licenseUtil=require(_0xfee4('0x12'));var db=require(_0xfee4('0x13'))['db'];function respondWithStatusCode(_0x95be61,_0x1cbbf5){_0x1cbbf5=_0x1cbbf5||0xcc;return function(_0x297cee){if(_0x297cee){return _0x95be61['sendStatus'](_0x1cbbf5);}return _0x95be61[_0xfee4('0x14')](_0x1cbbf5)[_0xfee4('0x15')]();};}function respondWithResult(_0x4f0b6c,_0xaf0d7f){_0xaf0d7f=_0xaf0d7f||0xc8;return function(_0x296ec2){if(_0x296ec2){return _0x4f0b6c[_0xfee4('0x14')](_0xaf0d7f)[_0xfee4('0x16')](_0x296ec2);}};}function respondWithFilteredResult(_0x38749e,_0x453635){return function(_0x24868c){if(_0x24868c){var _0x55440a=typeof _0x453635[_0xfee4('0x17')]===_0xfee4('0x18')&&typeof _0x453635[_0xfee4('0x19')]==='undefined';var _0x26a9b8=_0x24868c['count'];var _0x54a606=_0x55440a?0x0:_0x453635[_0xfee4('0x17')];var _0x3a0219=_0x55440a?_0x24868c[_0xfee4('0x1a')]:_0x453635[_0xfee4('0x17')]+_0x453635[_0xfee4('0x19')];var _0xe7b74d;if(_0x3a0219>=_0x26a9b8){_0x3a0219=_0x26a9b8;_0xe7b74d=0xc8;}else{_0xe7b74d=0xce;}_0x38749e[_0xfee4('0x14')](_0xe7b74d);return _0x38749e[_0xfee4('0x1b')](_0xfee4('0x1c'),_0x54a606+'-'+_0x3a0219+'/'+_0x26a9b8)['json'](_0x24868c);}return null;};}function patchUpdates(_0x194cd8){return function(_0x2686ad){try{jsonpatch[_0xfee4('0x1d')](_0x2686ad,_0x194cd8,!![]);}catch(_0x3c6c96){return BPromise[_0xfee4('0x1e')](_0x3c6c96);}return _0x2686ad[_0xfee4('0x1f')]();};}function saveUpdates(_0x57012c,_0x33154b){return function(_0xd97878){if(_0xd97878){return _0xd97878[_0xfee4('0x20')](_0x57012c)[_0xfee4('0x21')](function(_0x347990){return _0x347990;});}return null;};}function removeEntity(_0x115d1d,_0x2ff87d){return function(_0x4fa425){if(_0x4fa425){return _0x4fa425[_0xfee4('0x22')]()[_0xfee4('0x21')](function(){_0x115d1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b6772,_0x4d746d){return function(_0x5176a1){if(!_0x5176a1){_0x4b6772[_0xfee4('0x23')](0x194);}return _0x5176a1;};}function handleError(_0x6871d4,_0x2d33c3){_0x2d33c3=_0x2d33c3||0x1f4;return function(_0x256cff){logger[_0xfee4('0x24')](_0x256cff[_0xfee4('0x25')]);if(_0x256cff[_0xfee4('0x26')]){delete _0x256cff[_0xfee4('0x26')];}_0x6871d4['status'](_0x2d33c3)[_0xfee4('0x27')](_0x256cff);};}exports['show']=function(_0x4c4c1e,_0x428a90){var _0x1b053e={'raw':!![],'where':{'id':_0x4c4c1e['params']['id']}},_0x4cb4b7={};_0x4cb4b7[_0xfee4('0x28')]=_['keys'](db['ChatApplication'][_0xfee4('0x29')]);_0x4cb4b7[_0xfee4('0x2a')]=_['keys'](_0x4c4c1e[_0xfee4('0x2a')]);_0x4cb4b7['filters']=_[_0xfee4('0x2b')](_0x4cb4b7[_0xfee4('0x28')],_0x4cb4b7[_0xfee4('0x2a')]);_0x1b053e['attributes']=_[_0xfee4('0x2b')](_0x4cb4b7[_0xfee4('0x28')],qs[_0xfee4('0x2c')](_0x4c4c1e[_0xfee4('0x2a')]['fields']));_0x1b053e[_0xfee4('0x2d')]=_0x1b053e['attributes'][_0xfee4('0x2e')]?_0x1b053e[_0xfee4('0x2d')]:_0x4cb4b7['model'];if(_0x4c4c1e[_0xfee4('0x2a')][_0xfee4('0x2f')]){_0x1b053e['include']=[{'all':!![]}];}_0x1b053e=_[_0xfee4('0x30')]({},_0x1b053e,_0x4c4c1e['options']);return db[_0xfee4('0x31')][_0xfee4('0x32')](_0x1b053e)[_0xfee4('0x21')](handleEntityNotFound(_0x428a90,null))[_0xfee4('0x21')](respondWithResult(_0x428a90,null))[_0xfee4('0x33')](handleError(_0x428a90,null));};exports[_0xfee4('0x20')]=function(_0x53b320,_0x384581){if(_0x53b320['body']['id']){delete _0x53b320[_0xfee4('0x34')]['id'];}return db['ChatApplication'][_0xfee4('0x32')]({'where':{'id':_0x53b320[_0xfee4('0x35')]['id']}})[_0xfee4('0x21')](handleEntityNotFound(_0x384581,null))[_0xfee4('0x21')](saveUpdates(_0x53b320[_0xfee4('0x34')],null))[_0xfee4('0x21')](respondWithResult(_0x384581,null))['catch'](handleError(_0x384581,null));};exports[_0xfee4('0x22')]=function(_0x1212e5,_0x2e1219){return db[_0xfee4('0x31')][_0xfee4('0x32')]({'where':{'id':_0x1212e5[_0xfee4('0x35')]['id']}})[_0xfee4('0x21')](handleEntityNotFound(_0x2e1219,null))['then'](removeEntity(_0x2e1219,null))[_0xfee4('0x33')](handleError(_0x2e1219,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 1eee96a..a0d5e6d 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 _0x848d=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x36a66a,_0x3ea9fc){var _0x5aaefd=function(_0x200838){while(--_0x200838){_0x36a66a['push'](_0x36a66a['shift']());}};_0x5aaefd(++_0x3ea9fc);}(_0x848d,0x1d5));var _0xd848=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x848d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd848('0x0'));var util=require(_0xd848('0x1'));var logger=require(_0xd848('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd848('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd848('0x4'));var rimraf=require(_0xd848('0x5'));var config=require(_0xd848('0x6'));var attributes=require(_0xd848('0x7'));module[_0xd848('0x8')]=function(_0x11c998,_0x3c4d1b){return _0x11c998[_0xd848('0x9')](_0xd848('0xa'),attributes,{'tableName':_0xd848('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd848('0xc'),'collate':_0xd848('0xd')});}; \ No newline at end of file +var _0x5900=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatApplication','chat_applications'];(function(_0x21d3c4,_0x48d915){var _0x341584=function(_0x35aaa7){while(--_0x35aaa7){_0x21d3c4['push'](_0x21d3c4['shift']());}};_0x341584(++_0x48d915);}(_0x5900,0xd2));var _0x0590=function(_0x3d8ba1,_0x5ba1fd){_0x3d8ba1=_0x3d8ba1-0x0;var _0x87804e=_0x5900[_0x3d8ba1];return _0x87804e;};'use strict';var _=require('lodash');var util=require(_0x0590('0x0'));var logger=require(_0x0590('0x1'))('api');var moment=require(_0x0590('0x2'));var BPromise=require(_0x0590('0x3'));var rp=require(_0x0590('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0590('0x5'));var config=require(_0x0590('0x6'));var attributes=require('./chatApplication.attributes');module[_0x0590('0x7')]=function(_0x1d9927,_0x494b17){return _0x1d9927[_0x0590('0x8')](_0x0590('0x9'),attributes,{'tableName':_0x0590('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0590('0xb'),'collate':_0x0590('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 3d7c125..c9fecd5 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 _0xc337=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x57541b,_0x4d54a4){var _0x39d2ef=function(_0x3b7910){while(--_0x3b7910){_0x57541b['push'](_0x57541b['shift']());}};_0x39d2ef(++_0x4d54a4);}(_0xc337,0x167));var _0x7c33=function(_0xb4aa18,_0x37b8ef){_0xb4aa18=_0xb4aa18-0x0;var _0x2b704a=_0xc337[_0xb4aa18];return _0x2b704a;};'use strict';var _=require(_0x7c33('0x0'));var util=require(_0x7c33('0x1'));var moment=require(_0x7c33('0x2'));var BPromise=require(_0x7c33('0x3'));var rs=require(_0x7c33('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c33('0x5'))['db'];var utils=require(_0x7c33('0x6'));var logger=require(_0x7c33('0x7'))('rpc');var config=require(_0x7c33('0x8'));var jayson=require(_0x7c33('0x9'));var client=jayson['client'][_0x7c33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1222de,_0x2634ec,_0x3d5151){return new BPromise(function(_0x320c28,_0x3da34c){return client[_0x7c33('0xb')](_0x1222de,_0x3d5151)['then'](function(_0x4af7e1){logger['info'](_0x7c33('0xc'),_0x2634ec,_0x7c33('0xd'));logger[_0x7c33('0xe')](_0x7c33('0xf'),_0x2634ec,_0x7c33('0xd'),JSON['stringify'](_0x4af7e1));if(_0x4af7e1['error']){if(_0x4af7e1['error']['code']===0x1f4){logger[_0x7c33('0x10')](_0x7c33('0xc'),_0x2634ec,_0x4af7e1[_0x7c33('0x10')][_0x7c33('0x11')]);return _0x3da34c(_0x4af7e1[_0x7c33('0x10')][_0x7c33('0x11')]);}logger[_0x7c33('0x10')](_0x7c33('0xc'),_0x2634ec,_0x4af7e1[_0x7c33('0x10')]['message']);return _0x320c28(_0x4af7e1[_0x7c33('0x10')][_0x7c33('0x11')]);}else{logger[_0x7c33('0x12')](_0x7c33('0xc'),_0x2634ec,_0x7c33('0xd'));_0x320c28(_0x4af7e1[_0x7c33('0x13')][_0x7c33('0x11')]);}})[_0x7c33('0x14')](function(_0x42b2bf){logger[_0x7c33('0x10')](_0x7c33('0xc'),_0x2634ec,_0x42b2bf);_0x3da34c(_0x42b2bf);});});} \ No newline at end of file +var _0xe542=['request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x29309f,_0x2a5b){var _0xdcf2a7=function(_0x1c6acc){while(--_0x1c6acc){_0x29309f['push'](_0x29309f['shift']());}};_0xdcf2a7(++_0x2a5b);}(_0xe542,0xb4));var _0x2e54=function(_0x431bc9,_0x736158){_0x431bc9=_0x431bc9-0x0;var _0x1bf59c=_0xe542[_0x431bc9];return _0x1bf59c;};'use strict';var _=require(_0x2e54('0x0'));var util=require(_0x2e54('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2e54('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2e54('0x3'));var logger=require('../../config/logger')(_0x2e54('0x4'));var config=require(_0x2e54('0x5'));var jayson=require(_0x2e54('0x6'));var client=jayson[_0x2e54('0x7')][_0x2e54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x265a01,_0xc36d68,_0x35a4fb){return new BPromise(function(_0xf78c6b,_0x3cd894){return client[_0x2e54('0x9')](_0x265a01,_0x35a4fb)[_0x2e54('0xa')](function(_0x2bdd21){logger[_0x2e54('0xb')](_0x2e54('0xc'),_0xc36d68,_0x2e54('0xd'));logger[_0x2e54('0xe')](_0x2e54('0xf'),_0xc36d68,_0x2e54('0xd'),JSON['stringify'](_0x2bdd21));if(_0x2bdd21['error']){if(_0x2bdd21['error'][_0x2e54('0x10')]===0x1f4){logger[_0x2e54('0x11')](_0x2e54('0xc'),_0xc36d68,_0x2bdd21[_0x2e54('0x11')]['message']);return _0x3cd894(_0x2bdd21[_0x2e54('0x11')]['message']);}logger[_0x2e54('0x11')](_0x2e54('0xc'),_0xc36d68,_0x2bdd21[_0x2e54('0x11')][_0x2e54('0x12')]);return _0xf78c6b(_0x2bdd21[_0x2e54('0x11')][_0x2e54('0x12')]);}else{logger[_0x2e54('0xb')](_0x2e54('0xc'),_0xc36d68,_0x2e54('0xd'));_0xf78c6b(_0x2bdd21[_0x2e54('0x13')]['message']);}})[_0x2e54('0x14')](function(_0x8a3572){logger[_0x2e54('0x11')]('ChatApplication,\x20%s,\x20%s',_0xc36d68,_0x8a3572);_0x3cd894(_0x8a3572);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f952abd..942d2ea 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 _0x268c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x3e5197,_0x409cb1){var _0x410b01=function(_0x43b2dd){while(--_0x43b2dd){_0x3e5197['push'](_0x3e5197['shift']());}};_0x410b01(++_0x409cb1);}(_0x268c,0x13d));var _0xc268=function(_0x315aea,_0x318a80){_0x315aea=_0x315aea-0x0;var _0x4a4bdb=_0x268c[_0x315aea];return _0x4a4bdb;};'use strict';var multer=require(_0xc268('0x0'));var util=require(_0xc268('0x1'));var path=require(_0xc268('0x2'));var timeout=require(_0xc268('0x3'));var express=require('express');var router=express[_0xc268('0x4')]();var fs_extra=require(_0xc268('0x5'));var auth=require(_0xc268('0x6'));var interaction=require(_0xc268('0x7'));var config=require(_0xc268('0x8'));var controller=require(_0xc268('0x9'));router[_0xc268('0xa')](_0xc268('0xb'),auth['isAuthenticated'](),controller[_0xc268('0xc')]);router[_0xc268('0xd')]('/:id',auth[_0xc268('0xe')](),controller[_0xc268('0xf')]);router['delete'](_0xc268('0xb'),auth[_0xc268('0xe')](),controller['destroy']);module[_0xc268('0x10')]=router; \ No newline at end of file +var _0xdba2=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x3654c5,_0x2f4ecd){var _0xf5f082=function(_0x20cdcf){while(--_0x20cdcf){_0x3654c5['push'](_0x3654c5['shift']());}};_0xf5f082(++_0x2f4ecd);}(_0xdba2,0x102));var _0x2dba=function(_0x1412cb,_0x1a1bf6){_0x1412cb=_0x1412cb-0x0;var _0x246487=_0xdba2[_0x1412cb];return _0x246487;};'use strict';var multer=require(_0x2dba('0x0'));var util=require(_0x2dba('0x1'));var path=require(_0x2dba('0x2'));var timeout=require(_0x2dba('0x3'));var express=require(_0x2dba('0x4'));var router=express[_0x2dba('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2dba('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0x2dba('0x7')](_0x2dba('0x8'),auth[_0x2dba('0x9')](),controller[_0x2dba('0xa')]);router[_0x2dba('0xb')](_0x2dba('0x8'),auth[_0x2dba('0x9')](),controller[_0x2dba('0xc')]);router[_0x2dba('0xd')](_0x2dba('0x8'),auth['isAuthenticated'](),controller[_0x2dba('0xe')]);module[_0x2dba('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d9a47d8..017a248 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 _0x2b0a=['sequelize','exports','STRING'];(function(_0x10673f,_0x5f1781){var _0x36ce1c=function(_0x1d88d6){while(--_0x1d88d6){_0x10673f['push'](_0x10673f['shift']());}};_0x36ce1c(++_0x5f1781);}(_0x2b0a,0x84));var _0xa2b0=function(_0x4f7cba,_0x570c91){_0x4f7cba=_0x4f7cba-0x0;var _0x3fb190=_0x2b0a[_0x4f7cba];return _0x3fb190;};'use strict';var Sequelize=require(_0xa2b0('0x0'));module[_0xa2b0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa2b0('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x8f04=['exports','STRING','sequelize'];(function(_0x5de47b,_0x60868c){var _0x48322d=function(_0x445947){while(--_0x445947){_0x5de47b['push'](_0x5de47b['shift']());}};_0x48322d(++_0x60868c);}(_0x8f04,0xbc));var _0x48f0=function(_0x5f3a14,_0x5a904d){_0x5f3a14=_0x5f3a14-0x0;var _0x1edbd6=_0x8f04[_0x5f3a14];return _0x1edbd6;};'use strict';var Sequelize=require(_0x48f0('0x0'));module[_0x48f0('0x1')]={'name':{'type':Sequelize[_0x48f0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x48f0('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 1c5f723..196dcd5 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 _0x4aca=['moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','status','json','offset','undefined','count','limit','apply','reject','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','ChatGroup','findAll','rows','catch','params','intersection','create','body','find','describe','getUnread','user','toInteger','addMembers','ids','getMembers','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','$gte','split','format','getMessages','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5ea94c,_0x19937b){var _0xededd7=function(_0x27d10e){while(--_0x27d10e){_0x5ea94c['push'](_0x5ea94c['shift']());}};_0xededd7(++_0x19937b);}(_0x4aca,0x164));var _0xa4ac=function(_0x4f9d00,_0x47eeca){_0x4f9d00=_0x4f9d00-0x0;var _0x32aca1=_0x4aca[_0x4f9d00];return _0x32aca1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4ac('0x0'));var zipdir=require(_0xa4ac('0x1'));var jsonpatch=require(_0xa4ac('0x2'));var rp=require(_0xa4ac('0x3'));var moment=require(_0xa4ac('0x4'));var BPromise=require(_0xa4ac('0x5'));var Mustache=require('mustache');var util=require(_0xa4ac('0x6'));var path=require('path');var sox=require(_0xa4ac('0x7'));var csv=require(_0xa4ac('0x8'));var ejs=require(_0xa4ac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa4ac('0xa'));var squel=require('squel');var crypto=require(_0xa4ac('0xb'));var jsforce=require(_0xa4ac('0xc'));var deskjs=require(_0xa4ac('0xd'));var toCsv=require(_0xa4ac('0x8'));var querystring=require('querystring');var Papa=require(_0xa4ac('0xe'));var Redis=require('ioredis');var authService=require(_0xa4ac('0xf'));var qs=require(_0xa4ac('0x10'));var as=require(_0xa4ac('0x11'));var hardwareService=require(_0xa4ac('0x12'));var logger=require(_0xa4ac('0x13'))(_0xa4ac('0x14'));var utils=require(_0xa4ac('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa4ac('0x16'))['db'];config[_0xa4ac('0x17')]=_[_0xa4ac('0x18')](config[_0xa4ac('0x17')],{'host':_0xa4ac('0x19'),'port':0x18eb});var socket=require(_0xa4ac('0x1a'))(new Redis(config[_0xa4ac('0x17')]));require(_0xa4ac('0x1b'))['register'](socket);function respondWithStatusCode(_0x1a6d11,_0x578860){_0x578860=_0x578860||0xcc;return function(_0xc23219){if(_0xc23219){return _0x1a6d11['sendStatus'](_0x578860);}return _0x1a6d11[_0xa4ac('0x1c')](_0x578860)['end']();};}function respondWithResult(_0x25fb05,_0x27d0cd){_0x27d0cd=_0x27d0cd||0xc8;return function(_0x254121){if(_0x254121){return _0x25fb05[_0xa4ac('0x1c')](_0x27d0cd)[_0xa4ac('0x1d')](_0x254121);}};}function respondWithFilteredResult(_0x38d690,_0x505c33){return function(_0x540b4a){if(_0x540b4a){var _0x1c9aff=typeof _0x505c33[_0xa4ac('0x1e')]===_0xa4ac('0x1f')&&typeof _0x505c33['limit']===_0xa4ac('0x1f');var _0x4d47b9=_0x540b4a[_0xa4ac('0x20')];var _0x58aa1c=_0x1c9aff?0x0:_0x505c33[_0xa4ac('0x1e')];var _0xf1235c=_0x1c9aff?_0x540b4a[_0xa4ac('0x20')]:_0x505c33[_0xa4ac('0x1e')]+_0x505c33[_0xa4ac('0x21')];var _0x5e3e8a;if(_0xf1235c>=_0x4d47b9){_0xf1235c=_0x4d47b9;_0x5e3e8a=0xc8;}else{_0x5e3e8a=0xce;}_0x38d690[_0xa4ac('0x1c')](_0x5e3e8a);return _0x38d690['set']('Content-Range',_0x58aa1c+'-'+_0xf1235c+'/'+_0x4d47b9)[_0xa4ac('0x1d')](_0x540b4a);}return null;};}function patchUpdates(_0x4e11ac){return function(_0x1f6ff2){try{jsonpatch[_0xa4ac('0x22')](_0x1f6ff2,_0x4e11ac,!![]);}catch(_0x1e14a0){return BPromise[_0xa4ac('0x23')](_0x1e14a0);}return _0x1f6ff2['save']();};}function saveUpdates(_0x5363f7,_0x5d7ff8){return function(_0x40b09d){if(_0x40b09d){return _0x40b09d[_0xa4ac('0x24')](_0x5363f7)[_0xa4ac('0x25')](function(_0x378b83){return _0x378b83;});}return null;};}function removeEntity(_0x46f9b,_0x21b6b5){return function(_0x8ad001){if(_0x8ad001){return _0x8ad001[_0xa4ac('0x26')]()[_0xa4ac('0x25')](function(){_0x46f9b[_0xa4ac('0x1c')](0xcc)[_0xa4ac('0x27')]();});}};}function handleEntityNotFound(_0x544db3,_0x5c1256){return function(_0x5ae549){if(!_0x5ae549){_0x544db3['sendStatus'](0x194);}return _0x5ae549;};}function handleError(_0x1f6564,_0x3b0a29){_0x3b0a29=_0x3b0a29||0x1f4;return function(_0x4181c2){logger[_0xa4ac('0x28')](_0x4181c2['stack']);if(_0x4181c2[_0xa4ac('0x29')]){delete _0x4181c2['name'];}_0x1f6564['status'](_0x3b0a29)['send'](_0x4181c2);};}exports[_0xa4ac('0x2a')]=function(_0x32c823,_0x4cf8fc){var _0x57f6b8={},_0x426c58={},_0x1d2951={'count':0x0,'rows':[]};var _0x2ff75a=_[_0xa4ac('0x2b')](db['ChatGroup'][_0xa4ac('0x2c')],function(_0x45ffe7){return{'name':_0x45ffe7[_0xa4ac('0x2d')],'type':_0x45ffe7['type'][_0xa4ac('0x2e')]};});_0x426c58[_0xa4ac('0x2f')]=_[_0xa4ac('0x2b')](_0x2ff75a,_0xa4ac('0x29'));_0x426c58[_0xa4ac('0x30')]=_[_0xa4ac('0x31')](_0x32c823['query']);_0x426c58[_0xa4ac('0x32')]=_['intersection'](_0x426c58[_0xa4ac('0x2f')],_0x426c58[_0xa4ac('0x30')]);_0x57f6b8[_0xa4ac('0x33')]=_['intersection'](_0x426c58[_0xa4ac('0x2f')],qs['fields'](_0x32c823[_0xa4ac('0x30')][_0xa4ac('0x34')]));_0x57f6b8[_0xa4ac('0x33')]=_0x57f6b8[_0xa4ac('0x33')][_0xa4ac('0x35')]?_0x57f6b8[_0xa4ac('0x33')]:_0x426c58['model'];if(!_0x32c823[_0xa4ac('0x30')]['hasOwnProperty'](_0xa4ac('0x36'))){_0x57f6b8[_0xa4ac('0x21')]=qs[_0xa4ac('0x21')](_0x32c823[_0xa4ac('0x30')]['limit']);_0x57f6b8[_0xa4ac('0x1e')]=qs[_0xa4ac('0x1e')](_0x32c823[_0xa4ac('0x30')][_0xa4ac('0x1e')]);}_0x57f6b8[_0xa4ac('0x37')]=qs[_0xa4ac('0x38')](_0x32c823[_0xa4ac('0x30')][_0xa4ac('0x38')]);_0x57f6b8['where']=qs[_0xa4ac('0x32')](_[_0xa4ac('0x39')](_0x32c823['query'],_0x426c58['filters']),_0x2ff75a);if(_0x32c823[_0xa4ac('0x30')][_0xa4ac('0x3a')]){_0x57f6b8[_0xa4ac('0x3b')]=_[_0xa4ac('0x3c')](_0x57f6b8['where'],{'$or':_[_0xa4ac('0x2b')](_0x2ff75a,function(_0x23ebd5){if(_0x23ebd5[_0xa4ac('0x3d')]!=='VIRTUAL'){var _0x5b9ecc={};_0x5b9ecc[_0x23ebd5[_0xa4ac('0x29')]]={'$like':'%'+_0x32c823[_0xa4ac('0x30')]['filter']+'%'};return _0x5b9ecc;}})});}_0x57f6b8=_[_0xa4ac('0x3c')]({},_0x57f6b8,_0x32c823[_0xa4ac('0x3e')]);var _0x4afb16={'where':_0x57f6b8[_0xa4ac('0x3b')]};return db['ChatGroup'][_0xa4ac('0x20')](_0x4afb16)['then'](function(_0x3492b6){_0x1d2951['count']=_0x3492b6;if(_0x32c823[_0xa4ac('0x30')][_0xa4ac('0x3f')]){_0x57f6b8['include']=[{'all':!![]}];}return db[_0xa4ac('0x40')][_0xa4ac('0x41')](_0x57f6b8);})['then'](function(_0x489226){_0x1d2951[_0xa4ac('0x42')]=_0x489226;return _0x1d2951;})[_0xa4ac('0x25')](respondWithFilteredResult(_0x4cf8fc,_0x57f6b8))[_0xa4ac('0x43')](handleError(_0x4cf8fc,null));};exports['show']=function(_0x2109d7,_0x155ca0){var _0x2be022={'raw':!![],'where':{'id':_0x2109d7[_0xa4ac('0x44')]['id']}},_0x353fd1={};_0x353fd1[_0xa4ac('0x2f')]=_['keys'](db[_0xa4ac('0x40')][_0xa4ac('0x2c')]);_0x353fd1['query']=_['keys'](_0x2109d7['query']);_0x353fd1[_0xa4ac('0x32')]=_[_0xa4ac('0x45')](_0x353fd1[_0xa4ac('0x2f')],_0x353fd1['query']);_0x2be022[_0xa4ac('0x33')]=_['intersection'](_0x353fd1['model'],qs[_0xa4ac('0x34')](_0x2109d7[_0xa4ac('0x30')][_0xa4ac('0x34')]));_0x2be022['attributes']=_0x2be022['attributes']['length']?_0x2be022[_0xa4ac('0x33')]:_0x353fd1[_0xa4ac('0x2f')];if(_0x2109d7[_0xa4ac('0x30')][_0xa4ac('0x3f')]){_0x2be022['include']=[{'all':!![]}];}_0x2be022=_[_0xa4ac('0x3c')]({},_0x2be022,_0x2109d7[_0xa4ac('0x3e')]);return db[_0xa4ac('0x40')]['find'](_0x2be022)[_0xa4ac('0x25')](handleEntityNotFound(_0x155ca0,null))[_0xa4ac('0x25')](respondWithResult(_0x155ca0,null))[_0xa4ac('0x43')](handleError(_0x155ca0,null));};exports[_0xa4ac('0x46')]=function(_0x2abfa7,_0x2579c1){return db[_0xa4ac('0x40')]['create'](_0x2abfa7[_0xa4ac('0x47')],{})[_0xa4ac('0x25')](respondWithResult(_0x2579c1,0xc9))[_0xa4ac('0x43')](handleError(_0x2579c1,null));};exports['update']=function(_0x2859e0,_0x5109b7){if(_0x2859e0['body']['id']){delete _0x2859e0['body']['id'];}return db[_0xa4ac('0x40')][_0xa4ac('0x48')]({'where':{'id':_0x2859e0['params']['id']}})['then'](handleEntityNotFound(_0x5109b7,null))['then'](saveUpdates(_0x2859e0[_0xa4ac('0x47')],null))[_0xa4ac('0x25')](respondWithResult(_0x5109b7,null))[_0xa4ac('0x43')](handleError(_0x5109b7,null));};exports[_0xa4ac('0x26')]=function(_0x4ee4e1,_0x39178){return db[_0xa4ac('0x40')][_0xa4ac('0x48')]({'where':{'id':_0x4ee4e1[_0xa4ac('0x44')]['id']}})['then'](handleEntityNotFound(_0x39178,null))[_0xa4ac('0x25')](removeEntity(_0x39178,null))[_0xa4ac('0x43')](handleError(_0x39178,null));};exports[_0xa4ac('0x49')]=function(_0xddb0b6,_0x93f93b){return db['ChatGroup']['describe']()[_0xa4ac('0x25')](respondWithResult(_0x93f93b,null))[_0xa4ac('0x43')](handleError(_0x93f93b,null));};exports[_0xa4ac('0x4a')]=function(_0x3c44f2,_0x5f1f2e,_0x3fabed){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x3c44f2[_0xa4ac('0x44')]['id'],'ToId':_0x3c44f2[_0xa4ac('0x4b')]['id'],'read':![]}})[_0xa4ac('0x25')](function(_0x4ee9bf){return{'id':_[_0xa4ac('0x4c')](_0x3c44f2[_0xa4ac('0x44')]['id']),'count':_0x4ee9bf};})[_0xa4ac('0x25')](respondWithResult(_0x5f1f2e,null))[_0xa4ac('0x43')](handleError(_0x5f1f2e,null));};exports[_0xa4ac('0x4d')]=function(_0x43d8f3,_0x238a5f,_0x3c4bad){return db[_0xa4ac('0x40')][_0xa4ac('0x48')]({'where':{'id':_0x43d8f3[_0xa4ac('0x44')]['id']}})['then'](handleEntityNotFound(_0x238a5f,null))[_0xa4ac('0x25')](function(_0x364e3e){if(_0x364e3e){return _0x364e3e[_0xa4ac('0x4d')](_0x43d8f3['body'][_0xa4ac('0x4e')],_['omit'](_0x43d8f3['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x238a5f,null))['catch'](handleError(_0x238a5f,null));};exports[_0xa4ac('0x4f')]=function(_0x5e690,_0x292622,_0x2f5df4){var _0x274017={};var _0x560558={};var _0x2787b1;var _0x27be1e;return db[_0xa4ac('0x40')]['findOne']({'where':{'id':_0x5e690['params']['id']}})[_0xa4ac('0x25')](handleEntityNotFound(_0x292622,null))[_0xa4ac('0x25')](function(_0x454cac){if(_0x454cac){_0x2787b1=_0x454cac;_0x560558[_0xa4ac('0x2f')]=_[_0xa4ac('0x31')](db[_0xa4ac('0x50')]['rawAttributes']);_0x560558[_0xa4ac('0x30')]=_['keys'](_0x5e690[_0xa4ac('0x30')]);_0x560558[_0xa4ac('0x32')]=_[_0xa4ac('0x45')](_0x560558[_0xa4ac('0x2f')],_0x560558[_0xa4ac('0x30')]);_0x274017[_0xa4ac('0x33')]=_['intersection'](_0x560558[_0xa4ac('0x2f')],qs[_0xa4ac('0x34')](_0x5e690[_0xa4ac('0x30')][_0xa4ac('0x34')]));_0x274017[_0xa4ac('0x33')]=_0x274017['attributes'][_0xa4ac('0x35')]?_0x274017[_0xa4ac('0x33')]:_0x560558['model'];_0x274017[_0xa4ac('0x37')]=qs[_0xa4ac('0x38')](_0x5e690[_0xa4ac('0x30')][_0xa4ac('0x38')]);_0x274017[_0xa4ac('0x3b')]=qs['filters'](_[_0xa4ac('0x39')](_0x5e690[_0xa4ac('0x30')],_0x560558['filters']));if(_0x5e690[_0xa4ac('0x30')][_0xa4ac('0x3a')]){_0x274017[_0xa4ac('0x3b')]=_[_0xa4ac('0x3c')](_0x274017[_0xa4ac('0x3b')],{'$or':_[_0xa4ac('0x2b')](_0x274017[_0xa4ac('0x33')],function(_0x4c8bca){var _0xffc38={};_0xffc38[_0x4c8bca]={'$like':'%'+_0x5e690[_0xa4ac('0x30')][_0xa4ac('0x3a')]+'%'};return _0xffc38;})});}_0x274017=_[_0xa4ac('0x3c')]({},_0x274017,_0x5e690[_0xa4ac('0x3e')]);return _0x2787b1[_0xa4ac('0x4f')](_0x274017);}})[_0xa4ac('0x25')](function(_0x58dfee){if(_0x58dfee){_0x27be1e=_0x58dfee['length'];if(!_0x5e690[_0xa4ac('0x30')][_0xa4ac('0x51')](_0xa4ac('0x36'))){_0x274017[_0xa4ac('0x21')]=qs[_0xa4ac('0x21')](_0x5e690[_0xa4ac('0x30')][_0xa4ac('0x21')]);_0x274017['offset']=qs[_0xa4ac('0x1e')](_0x5e690[_0xa4ac('0x30')][_0xa4ac('0x1e')]);}return _0x2787b1[_0xa4ac('0x4f')](_0x274017);}})['then'](function(_0x475794){if(_0x475794){return _0x475794?{'count':_0x27be1e,'rows':_0x475794}:null;}})[_0xa4ac('0x25')](respondWithResult(_0x292622,null))[_0xa4ac('0x43')](handleError(_0x292622,null));};exports[_0xa4ac('0x52')]=function(_0x289b9b,_0x28ba0a,_0x4b9226){return db['ChatGroup'][_0xa4ac('0x48')]({'where':{'id':_0x289b9b['params']['id']}})[_0xa4ac('0x25')](handleEntityNotFound(_0x28ba0a,null))[_0xa4ac('0x25')](function(_0x2a8105){if(_0x2a8105){return _0x2a8105[_0xa4ac('0x52')](_0x289b9b[_0xa4ac('0x30')]['ids']);}})[_0xa4ac('0x25')](respondWithStatusCode(_0x28ba0a,null))[_0xa4ac('0x43')](handleError(_0x28ba0a,null));};exports[_0xa4ac('0x53')]=function(_0x5d598f,_0x46bebd,_0x27ef86){if(_0x5d598f[_0xa4ac('0x47')]['id']){delete _0x5d598f[_0xa4ac('0x47')]['id'];}return db[_0xa4ac('0x40')]['find']({'where':{'id':_0x5d598f[_0xa4ac('0x44')]['id']}})[_0xa4ac('0x25')](handleEntityNotFound(_0x46bebd,null))[_0xa4ac('0x25')](function(_0x1d2c82){if(_0x1d2c82){_0x5d598f['body'][_0xa4ac('0x54')]=_0x1d2c82['id'];return db[_0xa4ac('0x55')][_0xa4ac('0x46')](_0x5d598f[_0xa4ac('0x47')]);}})[_0xa4ac('0x25')](respondWithResult(_0x46bebd,null))[_0xa4ac('0x43')](handleError(_0x46bebd,null));};exports['getMessages']=function(_0x4d3cda,_0x3c0887,_0x284008){var _0x50d559={};var _0x25be8f={};var _0x51462c;var _0x34e403;return db[_0xa4ac('0x40')]['findOne']({'where':{'id':_0x4d3cda[_0xa4ac('0x44')]['id']}})[_0xa4ac('0x25')](handleEntityNotFound(_0x3c0887,null))[_0xa4ac('0x25')](function(_0x51b9d2){if(_0x51b9d2){_0x51462c=_0x51b9d2;_0x25be8f[_0xa4ac('0x2f')]=_[_0xa4ac('0x31')](db[_0xa4ac('0x55')][_0xa4ac('0x2c')]);_0x25be8f[_0xa4ac('0x30')]=_['keys'](_0x4d3cda[_0xa4ac('0x30')]);_0x25be8f['filters']=_['intersection'](_0x25be8f['model'],_0x25be8f['query']);_0x50d559[_0xa4ac('0x33')]=_['intersection'](_0x25be8f[_0xa4ac('0x2f')],qs[_0xa4ac('0x34')](_0x4d3cda['query'][_0xa4ac('0x34')]));_0x50d559[_0xa4ac('0x33')]=_0x50d559[_0xa4ac('0x33')][_0xa4ac('0x35')]?_0x50d559['attributes']:_0x25be8f['model'];_0x50d559[_0xa4ac('0x37')]=qs[_0xa4ac('0x38')](_0x4d3cda[_0xa4ac('0x30')][_0xa4ac('0x38')]);_0x50d559[_0xa4ac('0x3b')]=qs[_0xa4ac('0x32')](_['pick'](_0x4d3cda[_0xa4ac('0x30')],_0x25be8f[_0xa4ac('0x32')]));if(_0x4d3cda[_0xa4ac('0x30')]['filter']){_0x50d559[_0xa4ac('0x3b')]=_[_0xa4ac('0x3c')](_0x50d559['where'],{'$or':_[_0xa4ac('0x2b')](_0x50d559[_0xa4ac('0x33')],function(_0x2a12e6){var _0x2a8703={};_0x2a8703[_0x2a12e6]={'$like':'%'+_0x4d3cda[_0xa4ac('0x30')][_0xa4ac('0x3a')]+'%'};return _0x2a8703;})});}if(_0x4d3cda[_0xa4ac('0x30')][_0xa4ac('0x56')]){var _0x226676=_0x4d3cda[_0xa4ac('0x30')][_0xa4ac('0x56')][_0xa4ac('0x57')](',');var _0xba6d10={};_0xba6d10[_0x226676[0x0]]={'$gte':moment(_0x226676[0x1])[_0xa4ac('0x58')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50d559[_0xa4ac('0x3b')]=_[_0xa4ac('0x3c')](_0x50d559[_0xa4ac('0x3b')],_0xba6d10);}_0x50d559=_[_0xa4ac('0x3c')]({},_0x50d559,_0x4d3cda[_0xa4ac('0x3e')]);return _0x51462c[_0xa4ac('0x59')](_0x50d559);}})[_0xa4ac('0x25')](function(_0x49216e){if(_0x49216e){_0x34e403=_0x49216e[_0xa4ac('0x35')];if(!_0x4d3cda[_0xa4ac('0x30')][_0xa4ac('0x51')](_0xa4ac('0x36'))){_0x50d559[_0xa4ac('0x21')]=qs[_0xa4ac('0x21')](_0x4d3cda[_0xa4ac('0x30')][_0xa4ac('0x21')]);_0x50d559[_0xa4ac('0x1e')]=qs[_0xa4ac('0x1e')](_0x4d3cda['query'][_0xa4ac('0x1e')]);}return _0x51462c['getMessages'](_0x50d559);}})[_0xa4ac('0x25')](function(_0x3ab1e0){if(_0x3ab1e0){return _0x3ab1e0?{'count':_0x34e403,'rows':_0x3ab1e0}:null;}})[_0xa4ac('0x25')](respondWithResult(_0x3c0887,null))[_0xa4ac('0x43')](handleError(_0x3c0887,null));}; \ No newline at end of file +var _0x2d85=['./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','ChatGroup','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','find','create','body','update','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','rawAttributes','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/license/util','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x270255,_0x401e79){var _0x34e637=function(_0xa0b7a5){while(--_0xa0b7a5){_0x270255['push'](_0x270255['shift']());}};_0x34e637(++_0x401e79);}(_0x2d85,0xa7));var _0x52d8=function(_0x34c189,_0x389307){_0x34c189=_0x34c189-0x0;var _0x3e01fc=_0x2d85[_0x34c189];return _0x3e01fc;};'use strict';var emlformat=require(_0x52d8('0x0'));var rimraf=require(_0x52d8('0x1'));var zipdir=require(_0x52d8('0x2'));var jsonpatch=require(_0x52d8('0x3'));var rp=require(_0x52d8('0x4'));var moment=require('moment');var BPromise=require(_0x52d8('0x5'));var Mustache=require(_0x52d8('0x6'));var util=require('util');var path=require(_0x52d8('0x7'));var sox=require(_0x52d8('0x8'));var csv=require(_0x52d8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x52d8('0xa'));var _=require(_0x52d8('0xb'));var squel=require(_0x52d8('0xc'));var crypto=require(_0x52d8('0xd'));var jsforce=require(_0x52d8('0xe'));var deskjs=require(_0x52d8('0xf'));var toCsv=require(_0x52d8('0x9'));var querystring=require(_0x52d8('0x10'));var Papa=require('papaparse');var Redis=require(_0x52d8('0x11'));var authService=require(_0x52d8('0x12'));var qs=require(_0x52d8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52d8('0x14'));var logger=require(_0x52d8('0x15'))(_0x52d8('0x16'));var utils=require(_0x52d8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x52d8('0x18'));var db=require(_0x52d8('0x19'))['db'];config[_0x52d8('0x1a')]=_['defaults'](config[_0x52d8('0x1a')],{'host':_0x52d8('0x1b'),'port':0x18eb});var socket=require(_0x52d8('0x1c'))(new Redis(config[_0x52d8('0x1a')]));require(_0x52d8('0x1d'))[_0x52d8('0x1e')](socket);function respondWithStatusCode(_0x38ec21,_0x1682b3){_0x1682b3=_0x1682b3||0xcc;return function(_0x115735){if(_0x115735){return _0x38ec21[_0x52d8('0x1f')](_0x1682b3);}return _0x38ec21[_0x52d8('0x20')](_0x1682b3)[_0x52d8('0x21')]();};}function respondWithResult(_0x41e3ae,_0xa54a1){_0xa54a1=_0xa54a1||0xc8;return function(_0x38cfcd){if(_0x38cfcd){return _0x41e3ae[_0x52d8('0x20')](_0xa54a1)[_0x52d8('0x22')](_0x38cfcd);}};}function respondWithFilteredResult(_0x3fd75a,_0x2625e0){return function(_0x509f69){if(_0x509f69){var _0xfdc6a1=typeof _0x2625e0[_0x52d8('0x23')]==='undefined'&&typeof _0x2625e0[_0x52d8('0x24')]===_0x52d8('0x25');var _0x398583=_0x509f69[_0x52d8('0x26')];var _0x2b1a7a=_0xfdc6a1?0x0:_0x2625e0['offset'];var _0xd09429=_0xfdc6a1?_0x509f69['count']:_0x2625e0[_0x52d8('0x23')]+_0x2625e0[_0x52d8('0x24')];var _0x28f859;if(_0xd09429>=_0x398583){_0xd09429=_0x398583;_0x28f859=0xc8;}else{_0x28f859=0xce;}_0x3fd75a[_0x52d8('0x20')](_0x28f859);return _0x3fd75a['set'](_0x52d8('0x27'),_0x2b1a7a+'-'+_0xd09429+'/'+_0x398583)['json'](_0x509f69);}return null;};}function patchUpdates(_0x52f613){return function(_0x54e44b){try{jsonpatch[_0x52d8('0x28')](_0x54e44b,_0x52f613,!![]);}catch(_0x23676c){return BPromise[_0x52d8('0x29')](_0x23676c);}return _0x54e44b['save']();};}function saveUpdates(_0x14a23a,_0x4762e6){return function(_0x52923a){if(_0x52923a){return _0x52923a['update'](_0x14a23a)[_0x52d8('0x2a')](function(_0x2c40a9){return _0x2c40a9;});}return null;};}function removeEntity(_0x5c393a,_0x2f44a6){return function(_0x1cb72e){if(_0x1cb72e){return _0x1cb72e[_0x52d8('0x2b')]()[_0x52d8('0x2a')](function(){_0x5c393a[_0x52d8('0x20')](0xcc)[_0x52d8('0x21')]();});}};}function handleEntityNotFound(_0x10c6ab,_0x525b92){return function(_0x16dc1b){if(!_0x16dc1b){_0x10c6ab[_0x52d8('0x1f')](0x194);}return _0x16dc1b;};}function handleError(_0x249140,_0x450d0b){_0x450d0b=_0x450d0b||0x1f4;return function(_0x304aa1){logger[_0x52d8('0x2c')](_0x304aa1[_0x52d8('0x2d')]);if(_0x304aa1[_0x52d8('0x2e')]){delete _0x304aa1[_0x52d8('0x2e')];}_0x249140[_0x52d8('0x20')](_0x450d0b)[_0x52d8('0x2f')](_0x304aa1);};}exports[_0x52d8('0x30')]=function(_0x386f77,_0x3dd9f1){var _0x5257ea={},_0x2004c={},_0x32442d={'count':0x0,'rows':[]};var _0x985a22=_[_0x52d8('0x31')](db[_0x52d8('0x32')]['rawAttributes'],function(_0x4f3147){return{'name':_0x4f3147[_0x52d8('0x33')],'type':_0x4f3147[_0x52d8('0x34')]['key']};});_0x2004c[_0x52d8('0x35')]=_[_0x52d8('0x31')](_0x985a22,_0x52d8('0x2e'));_0x2004c[_0x52d8('0x36')]=_[_0x52d8('0x37')](_0x386f77[_0x52d8('0x36')]);_0x2004c[_0x52d8('0x38')]=_[_0x52d8('0x39')](_0x2004c['model'],_0x2004c[_0x52d8('0x36')]);_0x5257ea[_0x52d8('0x3a')]=_[_0x52d8('0x39')](_0x2004c['model'],qs[_0x52d8('0x3b')](_0x386f77[_0x52d8('0x36')][_0x52d8('0x3b')]));_0x5257ea[_0x52d8('0x3a')]=_0x5257ea[_0x52d8('0x3a')][_0x52d8('0x3c')]?_0x5257ea['attributes']:_0x2004c[_0x52d8('0x35')];if(!_0x386f77[_0x52d8('0x36')]['hasOwnProperty'](_0x52d8('0x3d'))){_0x5257ea['limit']=qs['limit'](_0x386f77[_0x52d8('0x36')][_0x52d8('0x24')]);_0x5257ea[_0x52d8('0x23')]=qs[_0x52d8('0x23')](_0x386f77[_0x52d8('0x36')][_0x52d8('0x23')]);}_0x5257ea[_0x52d8('0x3e')]=qs['sort'](_0x386f77['query'][_0x52d8('0x3f')]);_0x5257ea[_0x52d8('0x40')]=qs[_0x52d8('0x38')](_[_0x52d8('0x41')](_0x386f77[_0x52d8('0x36')],_0x2004c[_0x52d8('0x38')]),_0x985a22);if(_0x386f77['query'][_0x52d8('0x42')]){_0x5257ea['where']=_[_0x52d8('0x43')](_0x5257ea['where'],{'$or':_[_0x52d8('0x31')](_0x985a22,function(_0x5d4a70){if(_0x5d4a70['type']!==_0x52d8('0x44')){var _0x25e85a={};_0x25e85a[_0x5d4a70[_0x52d8('0x2e')]]={'$like':'%'+_0x386f77[_0x52d8('0x36')][_0x52d8('0x42')]+'%'};return _0x25e85a;}})});}_0x5257ea=_[_0x52d8('0x43')]({},_0x5257ea,_0x386f77[_0x52d8('0x45')]);var _0x2ef796={'where':_0x5257ea[_0x52d8('0x40')]};return db['ChatGroup'][_0x52d8('0x26')](_0x2ef796)[_0x52d8('0x2a')](function(_0x1ead46){_0x32442d[_0x52d8('0x26')]=_0x1ead46;if(_0x386f77['query']['includeAll']){_0x5257ea[_0x52d8('0x46')]=[{'all':!![]}];}return db[_0x52d8('0x32')][_0x52d8('0x47')](_0x5257ea);})[_0x52d8('0x2a')](function(_0x77bfae){_0x32442d['rows']=_0x77bfae;return _0x32442d;})['then'](respondWithFilteredResult(_0x3dd9f1,_0x5257ea))[_0x52d8('0x48')](handleError(_0x3dd9f1,null));};exports[_0x52d8('0x49')]=function(_0x326e77,_0x243a80){var _0x16747b={'raw':!![],'where':{'id':_0x326e77[_0x52d8('0x4a')]['id']}},_0x496226={};_0x496226[_0x52d8('0x35')]=_['keys'](db[_0x52d8('0x32')]['rawAttributes']);_0x496226[_0x52d8('0x36')]=_[_0x52d8('0x37')](_0x326e77[_0x52d8('0x36')]);_0x496226[_0x52d8('0x38')]=_[_0x52d8('0x39')](_0x496226['model'],_0x496226[_0x52d8('0x36')]);_0x16747b[_0x52d8('0x3a')]=_[_0x52d8('0x39')](_0x496226['model'],qs[_0x52d8('0x3b')](_0x326e77[_0x52d8('0x36')][_0x52d8('0x3b')]));_0x16747b[_0x52d8('0x3a')]=_0x16747b[_0x52d8('0x3a')][_0x52d8('0x3c')]?_0x16747b['attributes']:_0x496226['model'];if(_0x326e77[_0x52d8('0x36')]['includeAll']){_0x16747b[_0x52d8('0x46')]=[{'all':!![]}];}_0x16747b=_[_0x52d8('0x43')]({},_0x16747b,_0x326e77[_0x52d8('0x45')]);return db['ChatGroup'][_0x52d8('0x4b')](_0x16747b)[_0x52d8('0x2a')](handleEntityNotFound(_0x243a80,null))[_0x52d8('0x2a')](respondWithResult(_0x243a80,null))[_0x52d8('0x48')](handleError(_0x243a80,null));};exports['create']=function(_0x17d2f1,_0x116907){return db['ChatGroup'][_0x52d8('0x4c')](_0x17d2f1[_0x52d8('0x4d')],{})[_0x52d8('0x2a')](respondWithResult(_0x116907,0xc9))[_0x52d8('0x48')](handleError(_0x116907,null));};exports[_0x52d8('0x4e')]=function(_0x1f4010,_0x34d1bd){if(_0x1f4010[_0x52d8('0x4d')]['id']){delete _0x1f4010[_0x52d8('0x4d')]['id'];}return db[_0x52d8('0x32')]['find']({'where':{'id':_0x1f4010[_0x52d8('0x4a')]['id']}})[_0x52d8('0x2a')](handleEntityNotFound(_0x34d1bd,null))['then'](saveUpdates(_0x1f4010['body'],null))[_0x52d8('0x2a')](respondWithResult(_0x34d1bd,null))[_0x52d8('0x48')](handleError(_0x34d1bd,null));};exports['destroy']=function(_0x4c786e,_0x298901){return db[_0x52d8('0x32')]['find']({'where':{'id':_0x4c786e['params']['id']}})[_0x52d8('0x2a')](handleEntityNotFound(_0x298901,null))['then'](removeEntity(_0x298901,null))[_0x52d8('0x48')](handleError(_0x298901,null));};exports[_0x52d8('0x4f')]=function(_0x4d580c,_0x3566d1){return db[_0x52d8('0x32')][_0x52d8('0x4f')]()[_0x52d8('0x2a')](respondWithResult(_0x3566d1,null))['catch'](handleError(_0x3566d1,null));};exports['getUnread']=function(_0x22f161,_0x13361e,_0x46292d){return db[_0x52d8('0x50')][_0x52d8('0x26')]({'where':{'ChatGroupId':_0x22f161['params']['id'],'ToId':_0x22f161[_0x52d8('0x51')]['id'],'read':![]}})[_0x52d8('0x2a')](function(_0x3e798d){return{'id':_[_0x52d8('0x52')](_0x22f161[_0x52d8('0x4a')]['id']),'count':_0x3e798d};})['then'](respondWithResult(_0x13361e,null))[_0x52d8('0x48')](handleError(_0x13361e,null));};exports[_0x52d8('0x53')]=function(_0x1e2b77,_0x15e721,_0x334cd0){return db[_0x52d8('0x32')][_0x52d8('0x4b')]({'where':{'id':_0x1e2b77['params']['id']}})['then'](handleEntityNotFound(_0x15e721,null))[_0x52d8('0x2a')](function(_0x11b3b5){if(_0x11b3b5){return _0x11b3b5['addMembers'](_0x1e2b77['body'][_0x52d8('0x54')],_[_0x52d8('0x55')](_0x1e2b77[_0x52d8('0x4d')],[_0x52d8('0x54'),'id'])||{});}})[_0x52d8('0x2a')](respondWithResult(_0x15e721,null))[_0x52d8('0x48')](handleError(_0x15e721,null));};exports[_0x52d8('0x56')]=function(_0x2c19ba,_0x395b2c,_0x16e5bb){var _0x4e4ffc={};var _0x1c24a1={};var _0x28d509;var _0x2601ab;return db['ChatGroup'][_0x52d8('0x57')]({'where':{'id':_0x2c19ba[_0x52d8('0x4a')]['id']}})[_0x52d8('0x2a')](handleEntityNotFound(_0x395b2c,null))[_0x52d8('0x2a')](function(_0x33c9d7){if(_0x33c9d7){_0x28d509=_0x33c9d7;_0x1c24a1[_0x52d8('0x35')]=_[_0x52d8('0x37')](db['User'][_0x52d8('0x58')]);_0x1c24a1[_0x52d8('0x36')]=_[_0x52d8('0x37')](_0x2c19ba['query']);_0x1c24a1[_0x52d8('0x38')]=_[_0x52d8('0x39')](_0x1c24a1[_0x52d8('0x35')],_0x1c24a1[_0x52d8('0x36')]);_0x4e4ffc['attributes']=_[_0x52d8('0x39')](_0x1c24a1[_0x52d8('0x35')],qs[_0x52d8('0x3b')](_0x2c19ba['query']['fields']));_0x4e4ffc[_0x52d8('0x3a')]=_0x4e4ffc[_0x52d8('0x3a')][_0x52d8('0x3c')]?_0x4e4ffc[_0x52d8('0x3a')]:_0x1c24a1['model'];_0x4e4ffc[_0x52d8('0x3e')]=qs[_0x52d8('0x3f')](_0x2c19ba[_0x52d8('0x36')]['sort']);_0x4e4ffc[_0x52d8('0x40')]=qs[_0x52d8('0x38')](_[_0x52d8('0x41')](_0x2c19ba[_0x52d8('0x36')],_0x1c24a1[_0x52d8('0x38')]));if(_0x2c19ba[_0x52d8('0x36')][_0x52d8('0x42')]){_0x4e4ffc[_0x52d8('0x40')]=_['merge'](_0x4e4ffc[_0x52d8('0x40')],{'$or':_[_0x52d8('0x31')](_0x4e4ffc[_0x52d8('0x3a')],function(_0x1a6e4a){var _0x32d1ce={};_0x32d1ce[_0x1a6e4a]={'$like':'%'+_0x2c19ba[_0x52d8('0x36')]['filter']+'%'};return _0x32d1ce;})});}_0x4e4ffc=_[_0x52d8('0x43')]({},_0x4e4ffc,_0x2c19ba[_0x52d8('0x45')]);return _0x28d509[_0x52d8('0x56')](_0x4e4ffc);}})['then'](function(_0x528130){if(_0x528130){_0x2601ab=_0x528130[_0x52d8('0x3c')];if(!_0x2c19ba[_0x52d8('0x36')][_0x52d8('0x59')](_0x52d8('0x3d'))){_0x4e4ffc[_0x52d8('0x24')]=qs[_0x52d8('0x24')](_0x2c19ba[_0x52d8('0x36')][_0x52d8('0x24')]);_0x4e4ffc[_0x52d8('0x23')]=qs[_0x52d8('0x23')](_0x2c19ba[_0x52d8('0x36')][_0x52d8('0x23')]);}return _0x28d509['getMembers'](_0x4e4ffc);}})[_0x52d8('0x2a')](function(_0x3d278b){if(_0x3d278b){return _0x3d278b?{'count':_0x2601ab,'rows':_0x3d278b}:null;}})[_0x52d8('0x2a')](respondWithResult(_0x395b2c,null))['catch'](handleError(_0x395b2c,null));};exports['removeMembers']=function(_0x155e60,_0x320664,_0x2fc8e1){return db[_0x52d8('0x32')]['find']({'where':{'id':_0x155e60[_0x52d8('0x4a')]['id']}})[_0x52d8('0x2a')](handleEntityNotFound(_0x320664,null))[_0x52d8('0x2a')](function(_0x40684c){if(_0x40684c){return _0x40684c[_0x52d8('0x5a')](_0x155e60[_0x52d8('0x36')][_0x52d8('0x54')]);}})[_0x52d8('0x2a')](respondWithStatusCode(_0x320664,null))[_0x52d8('0x48')](handleError(_0x320664,null));};exports[_0x52d8('0x5b')]=function(_0x168dc4,_0x44318b,_0x5a8708){if(_0x168dc4[_0x52d8('0x4d')]['id']){delete _0x168dc4[_0x52d8('0x4d')]['id'];}return db[_0x52d8('0x32')][_0x52d8('0x4b')]({'where':{'id':_0x168dc4[_0x52d8('0x4a')]['id']}})[_0x52d8('0x2a')](handleEntityNotFound(_0x44318b,null))[_0x52d8('0x2a')](function(_0x4a9d39){if(_0x4a9d39){_0x168dc4[_0x52d8('0x4d')][_0x52d8('0x5c')]=_0x4a9d39['id'];return db[_0x52d8('0x50')]['create'](_0x168dc4['body']);}})[_0x52d8('0x2a')](respondWithResult(_0x44318b,null))['catch'](handleError(_0x44318b,null));};exports[_0x52d8('0x5d')]=function(_0x150823,_0x9f203e,_0x139dcd){var _0xc50721={};var _0x47e5c0={};var _0x1168cd;var _0x27d4b3;return db['ChatGroup'][_0x52d8('0x57')]({'where':{'id':_0x150823['params']['id']}})[_0x52d8('0x2a')](handleEntityNotFound(_0x9f203e,null))['then'](function(_0x28a077){if(_0x28a077){_0x1168cd=_0x28a077;_0x47e5c0[_0x52d8('0x35')]=_[_0x52d8('0x37')](db[_0x52d8('0x50')][_0x52d8('0x58')]);_0x47e5c0[_0x52d8('0x36')]=_[_0x52d8('0x37')](_0x150823[_0x52d8('0x36')]);_0x47e5c0['filters']=_[_0x52d8('0x39')](_0x47e5c0[_0x52d8('0x35')],_0x47e5c0['query']);_0xc50721[_0x52d8('0x3a')]=_[_0x52d8('0x39')](_0x47e5c0[_0x52d8('0x35')],qs[_0x52d8('0x3b')](_0x150823[_0x52d8('0x36')]['fields']));_0xc50721['attributes']=_0xc50721[_0x52d8('0x3a')][_0x52d8('0x3c')]?_0xc50721[_0x52d8('0x3a')]:_0x47e5c0['model'];_0xc50721[_0x52d8('0x3e')]=qs[_0x52d8('0x3f')](_0x150823[_0x52d8('0x36')][_0x52d8('0x3f')]);_0xc50721[_0x52d8('0x40')]=qs[_0x52d8('0x38')](_[_0x52d8('0x41')](_0x150823[_0x52d8('0x36')],_0x47e5c0[_0x52d8('0x38')]));if(_0x150823[_0x52d8('0x36')]['filter']){_0xc50721[_0x52d8('0x40')]=_[_0x52d8('0x43')](_0xc50721[_0x52d8('0x40')],{'$or':_['map'](_0xc50721[_0x52d8('0x3a')],function(_0x163b14){var _0xd780b={};_0xd780b[_0x163b14]={'$like':'%'+_0x150823['query']['filter']+'%'};return _0xd780b;})});}if(_0x150823[_0x52d8('0x36')][_0x52d8('0x5e')]){var _0x1bf78a=_0x150823[_0x52d8('0x36')][_0x52d8('0x5e')][_0x52d8('0x5f')](',');var _0x3e81ee={};_0x3e81ee[_0x1bf78a[0x0]]={'$gte':moment(_0x1bf78a[0x1])[_0x52d8('0x60')](_0x52d8('0x61'))};_0xc50721['where']=_[_0x52d8('0x43')](_0xc50721['where'],_0x3e81ee);}_0xc50721=_[_0x52d8('0x43')]({},_0xc50721,_0x150823[_0x52d8('0x45')]);return _0x1168cd[_0x52d8('0x5d')](_0xc50721);}})[_0x52d8('0x2a')](function(_0x159ee2){if(_0x159ee2){_0x27d4b3=_0x159ee2[_0x52d8('0x3c')];if(!_0x150823[_0x52d8('0x36')][_0x52d8('0x59')](_0x52d8('0x3d'))){_0xc50721[_0x52d8('0x24')]=qs[_0x52d8('0x24')](_0x150823[_0x52d8('0x36')]['limit']);_0xc50721[_0x52d8('0x23')]=qs['offset'](_0x150823[_0x52d8('0x36')][_0x52d8('0x23')]);}return _0x1168cd[_0x52d8('0x5d')](_0xc50721);}})[_0x52d8('0x2a')](function(_0x3af371){if(_0x3af371){return _0x3af371?{'count':_0x27d4b3,'rows':_0x3af371}:null;}})[_0x52d8('0x2a')](respondWithResult(_0x9f203e,null))[_0x52d8('0x48')](handleError(_0x9f203e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 17e7aee..ced2336 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 _0xd709=['emit','hasOwnProperty','hook','exports','ChatGroup','setMaxListeners','update','remove'];(function(_0x9f78b9,_0x1b4ab3){var _0x2262e5=function(_0x20990f){while(--_0x20990f){_0x9f78b9['push'](_0x9f78b9['shift']());}};_0x2262e5(++_0x1b4ab3);}(_0xd709,0x104));var _0x9d70=function(_0x404bbf,_0x4e6a0a){_0x404bbf=_0x404bbf-0x0;var _0x52a7dc=_0xd709[_0x404bbf];return _0x52a7dc;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0x9d70('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9d70('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9d70('0x2'),'afterDestroy':_0x9d70('0x3')};function emitEvent(_0x4bdb69){return function(_0x587d75,_0x294a79,_0x391db5){ChatGroupEvents[_0x9d70('0x4')](_0x4bdb69+':'+_0x587d75['id'],_0x587d75);ChatGroupEvents[_0x9d70('0x4')](_0x4bdb69,_0x587d75);_0x391db5(null);};}for(var e in events){if(events[_0x9d70('0x5')](e)){var event=events[e];ChatGroup[_0x9d70('0x6')](e,emitEvent(event));}}module[_0x9d70('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x3157=['events','../../mysqldb','ChatGroup','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x41dfbc,_0x54be51){var _0x22755a=function(_0x2d0f){while(--_0x2d0f){_0x41dfbc['push'](_0x41dfbc['shift']());}};_0x22755a(++_0x54be51);}(_0x3157,0x198));var _0x7315=function(_0x25672a,_0x5f1c6d){_0x25672a=_0x25672a-0x0;var _0x43a8ae=_0x3157[_0x25672a];return _0x43a8ae;};'use strict';var EventEmitter=require(_0x7315('0x0'));var ChatGroup=require(_0x7315('0x1'))['db'][_0x7315('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7315('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7315('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ba02f){return function(_0x413249,_0x5c3bca,_0x58d458){ChatGroupEvents[_0x7315('0x5')](_0x1ba02f+':'+_0x413249['id'],_0x413249);ChatGroupEvents[_0x7315('0x5')](_0x1ba02f,_0x413249);_0x58d458(null);};}for(var e in events){if(events[_0x7315('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x7315('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 f062e99..45ad209 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 _0x12f8=['bluebird','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','api','moment'];(function(_0xca9e2,_0x350f76){var _0x145f56=function(_0x7f3b77){while(--_0x7f3b77){_0xca9e2['push'](_0xca9e2['shift']());}};_0x145f56(++_0x350f76);}(_0x12f8,0xec));var _0x812f=function(_0x1539ad,_0x2794de){_0x1539ad=_0x1539ad-0x0;var _0xc91daf=_0x12f8[_0x1539ad];return _0xc91daf;};'use strict';var _=require(_0x812f('0x0'));var util=require(_0x812f('0x1'));var logger=require('../../config/logger')(_0x812f('0x2'));var moment=require(_0x812f('0x3'));var BPromise=require(_0x812f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x812f('0x5'));var rimraf=require('rimraf');var config=require(_0x812f('0x6'));var attributes=require(_0x812f('0x7'));module[_0x812f('0x8')]=function(_0x20b80b,_0x4622e4){return _0x20b80b[_0x812f('0x9')](_0x812f('0xa'),attributes,{'tableName':_0x812f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa625=['bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','../../config/logger','api','moment'];(function(_0x171bae,_0x59de14){var _0x40197b=function(_0x205298){while(--_0x205298){_0x171bae['push'](_0x171bae['shift']());}};_0x40197b(++_0x59de14);}(_0xa625,0x1b9));var _0x5a62=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0xa625[_0x104e21];return _0x605b37;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a62('0x0'))(_0x5a62('0x1'));var moment=require(_0x5a62('0x2'));var BPromise=require(_0x5a62('0x3'));var rp=require(_0x5a62('0x4'));var fs=require('fs');var path=require(_0x5a62('0x5'));var rimraf=require(_0x5a62('0x6'));var config=require(_0x5a62('0x7'));var attributes=require(_0x5a62('0x8'));module[_0x5a62('0x9')]=function(_0x5e2aba,_0x61c8d0){return _0x5e2aba[_0x5a62('0xa')]('ChatGroup',attributes,{'tableName':_0x5a62('0xb'),'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 4bdcb94..314201a 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 _0xaeaf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x419893,_0x1aab65){var _0x542714=function(_0x53efb1){while(--_0x53efb1){_0x419893['push'](_0x419893['shift']());}};_0x542714(++_0x1aab65);}(_0xaeaf,0x14e));var _0xfaea=function(_0x311e77,_0x49a459){_0x311e77=_0x311e77-0x0;var _0x559c54=_0xaeaf[_0x311e77];return _0x559c54;};'use strict';var _=require(_0xfaea('0x0'));var util=require(_0xfaea('0x1'));var moment=require(_0xfaea('0x2'));var BPromise=require(_0xfaea('0x3'));var rs=require(_0xfaea('0x4'));var fs=require('fs');var Redis=require(_0xfaea('0x5'));var db=require(_0xfaea('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaea('0x7'))(_0xfaea('0x8'));var config=require(_0xfaea('0x9'));var jayson=require(_0xfaea('0xa'));var client=jayson['client'][_0xfaea('0xb')]({'port':0x232a});config[_0xfaea('0xc')]=_[_0xfaea('0xd')](config[_0xfaea('0xc')],{'host':_0xfaea('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfaea('0xc')]));require(_0xfaea('0xf'))['register'](socket);function respondWithRpcPromise(_0x191039,_0x3c1f4d,_0x2462f5){return new BPromise(function(_0x5078b6,_0x116379){return client[_0xfaea('0x10')](_0x191039,_0x2462f5)[_0xfaea('0x11')](function(_0x5c4746){logger[_0xfaea('0x12')](_0xfaea('0x13'),_0x3c1f4d,_0xfaea('0x14'));logger[_0xfaea('0x15')](_0xfaea('0x16'),_0x3c1f4d,'request\x20sent',JSON[_0xfaea('0x17')](_0x5c4746));if(_0x5c4746['error']){if(_0x5c4746[_0xfaea('0x18')]['code']===0x1f4){logger[_0xfaea('0x18')](_0xfaea('0x13'),_0x3c1f4d,_0x5c4746['error'][_0xfaea('0x19')]);return _0x116379(_0x5c4746[_0xfaea('0x18')][_0xfaea('0x19')]);}logger[_0xfaea('0x18')](_0xfaea('0x13'),_0x3c1f4d,_0x5c4746['error']['message']);return _0x5078b6(_0x5c4746[_0xfaea('0x18')][_0xfaea('0x19')]);}else{logger[_0xfaea('0x12')](_0xfaea('0x13'),_0x3c1f4d,_0xfaea('0x14'));_0x5078b6(_0x5c4746[_0xfaea('0x1a')][_0xfaea('0x19')]);}})[_0xfaea('0x1b')](function(_0x328924){logger[_0xfaea('0x18')]('ChatGroup,\x20%s,\x20%s',_0x3c1f4d,_0x328924);_0x116379(_0x328924);});});} \ No newline at end of file +var _0x3c6d=['error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatGroup.socket','register','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3f6e70,_0x26ec51){var _0x235a0d=function(_0x3f2f46){while(--_0x3f2f46){_0x3f6e70['push'](_0x3f6e70['shift']());}};_0x235a0d(++_0x26ec51);}(_0x3c6d,0x199));var _0xd3c6=function(_0x170148,_0x238066){_0x170148=_0x170148-0x0;var _0x55bb1f=_0x3c6d[_0x170148];return _0x55bb1f;};'use strict';var _=require(_0xd3c6('0x0'));var util=require(_0xd3c6('0x1'));var moment=require(_0xd3c6('0x2'));var BPromise=require(_0xd3c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3c6('0x4'));var db=require(_0xd3c6('0x5'))['db'];var utils=require(_0xd3c6('0x6'));var logger=require(_0xd3c6('0x7'))(_0xd3c6('0x8'));var config=require(_0xd3c6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd3c6('0xa')][_0xd3c6('0xb')]({'port':0x232a});config[_0xd3c6('0xc')]=_[_0xd3c6('0xd')](config[_0xd3c6('0xc')],{'host':_0xd3c6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd3c6('0xf'))[_0xd3c6('0x10')](socket);function respondWithRpcPromise(_0x36e762,_0x4ed22f,_0x1b7e6d){return new BPromise(function(_0x5c14ec,_0x3c9df8){return client['request'](_0x36e762,_0x1b7e6d)['then'](function(_0x260608){logger[_0xd3c6('0x11')](_0xd3c6('0x12'),_0x4ed22f,_0xd3c6('0x13'));logger[_0xd3c6('0x14')](_0xd3c6('0x15'),_0x4ed22f,_0xd3c6('0x13'),JSON[_0xd3c6('0x16')](_0x260608));if(_0x260608[_0xd3c6('0x17')]){if(_0x260608[_0xd3c6('0x17')][_0xd3c6('0x18')]===0x1f4){logger['error'](_0xd3c6('0x12'),_0x4ed22f,_0x260608[_0xd3c6('0x17')][_0xd3c6('0x19')]);return _0x3c9df8(_0x260608[_0xd3c6('0x17')][_0xd3c6('0x19')]);}logger[_0xd3c6('0x17')](_0xd3c6('0x12'),_0x4ed22f,_0x260608[_0xd3c6('0x17')][_0xd3c6('0x19')]);return _0x5c14ec(_0x260608[_0xd3c6('0x17')][_0xd3c6('0x19')]);}else{logger[_0xd3c6('0x11')](_0xd3c6('0x12'),_0x4ed22f,_0xd3c6('0x13'));_0x5c14ec(_0x260608[_0xd3c6('0x1a')]['message']);}})['catch'](function(_0x339b2b){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4ed22f,_0x339b2b);_0x3c9df8(_0x339b2b);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 74efbcb..31cfc8a 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 _0xe6b9=['./chatGroup.events','update','emit','removeListener','register','chatGroup:'];(function(_0x14f814,_0x1e4ffa){var _0x351e4d=function(_0x3a3342){while(--_0x3a3342){_0x14f814['push'](_0x14f814['shift']());}};_0x351e4d(++_0x1e4ffa);}(_0xe6b9,0x144));var _0x9e6b=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0xe6b9[_0x413b4d];return _0x8b810a;};'use strict';var ChatGroupEvents=require(_0x9e6b('0x0'));var events=['save','remove',_0x9e6b('0x1')];function createListener(_0x3aba29,_0x369d3c){return function(_0x517a60){_0x369d3c[_0x9e6b('0x2')](_0x3aba29,_0x517a60);};}function removeListener(_0x2e6f0d,_0xf0ed5a){return function(){ChatGroupEvents[_0x9e6b('0x3')](_0x2e6f0d,_0xf0ed5a);};}exports[_0x9e6b('0x4')]=function(_0x57df67){for(var _0x499403=0x0,_0x2f5899=events['length'];_0x499403<_0x2f5899;_0x499403++){var _0x5df622=events[_0x499403];var _0xe6a057=createListener(_0x9e6b('0x5')+_0x5df622,_0x57df67);ChatGroupEvents['on'](_0x5df622,_0xe6a057);}}; \ No newline at end of file +var _0xe50d=['update','register','length','./chatGroup.events','save','remove'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xe50d,0x153));var _0xde50=function(_0x15c9e9,_0x5db6c7){_0x15c9e9=_0x15c9e9-0x0;var _0x50baad=_0xe50d[_0x15c9e9];return _0x50baad;};'use strict';var ChatGroupEvents=require(_0xde50('0x0'));var events=[_0xde50('0x1'),_0xde50('0x2'),_0xde50('0x3')];function createListener(_0x7b84a5,_0x4a1c3a){return function(_0x47fc26){_0x4a1c3a['emit'](_0x7b84a5,_0x47fc26);};}function removeListener(_0x2ac40d,_0x2da6ca){return function(){ChatGroupEvents['removeListener'](_0x2ac40d,_0x2da6ca);};}exports[_0xde50('0x4')]=function(_0x45d4e6){for(var _0x50e6fc=0x0,_0x236599=events[_0xde50('0x5')];_0x50e6fc<_0x236599;_0x50e6fc++){var _0xdece8=events[_0x50e6fc];var _0x47b99f=createListener('chatGroup:'+_0xdece8,_0x45d4e6);ChatGroupEvents['on'](_0xdece8,_0x47b99f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index f6e1b82..c1d74f7 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 _0xae91=['index','/describe','describe','show','getUnread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x148fa9,_0x5232a7){var _0x5c87da=function(_0x5c1323){while(--_0x5c1323){_0x148fa9['push'](_0x148fa9['shift']());}};_0x5c87da(++_0x5232a7);}(_0xae91,0xd5));var _0x1ae9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xae91[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x1ae9('0x0'));var util=require(_0x1ae9('0x1'));var path=require(_0x1ae9('0x2'));var timeout=require(_0x1ae9('0x3'));var express=require(_0x1ae9('0x4'));var router=express[_0x1ae9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1ae9('0x6'));var interaction=require(_0x1ae9('0x7'));var config=require(_0x1ae9('0x8'));var controller=require('./chatGroup.controller');router[_0x1ae9('0x9')]('/',auth[_0x1ae9('0xa')](),controller[_0x1ae9('0xb')]);router[_0x1ae9('0x9')](_0x1ae9('0xc'),auth[_0x1ae9('0xa')](),controller[_0x1ae9('0xd')]);router['get']('/:id',auth[_0x1ae9('0xa')](),controller[_0x1ae9('0xe')]);router[_0x1ae9('0x9')]('/:id/unread',auth['isAuthenticated'](),controller[_0x1ae9('0xf')]);router[_0x1ae9('0x9')]('/:id/members',auth[_0x1ae9('0xa')](),controller[_0x1ae9('0x10')]);router[_0x1ae9('0x9')](_0x1ae9('0x11'),auth[_0x1ae9('0xa')](),controller[_0x1ae9('0x12')]);router[_0x1ae9('0x13')]('/',auth[_0x1ae9('0xa')](),controller[_0x1ae9('0x14')]);router['post'](_0x1ae9('0x15'),auth['isAuthenticated'](),controller[_0x1ae9('0x16')]);router[_0x1ae9('0x13')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x1ae9('0x17')](_0x1ae9('0x18'),auth[_0x1ae9('0xa')](),controller[_0x1ae9('0x19')]);router[_0x1ae9('0x1a')]('/:id',auth[_0x1ae9('0xa')](),controller[_0x1ae9('0x1b')]);router[_0x1ae9('0x1a')](_0x1ae9('0x15'),auth[_0x1ae9('0xa')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file +var _0x65a7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMessage','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x149b9,_0x85803e){var _0x111a7e=function(_0x15f016){while(--_0x15f016){_0x149b9['push'](_0x149b9['shift']());}};_0x111a7e(++_0x85803e);}(_0x65a7,0x18b));var _0x765a=function(_0x58bdbb,_0xbb1f4f){_0x58bdbb=_0x58bdbb-0x0;var _0x4c6400=_0x65a7[_0x58bdbb];return _0x4c6400;};'use strict';var multer=require(_0x765a('0x0'));var util=require(_0x765a('0x1'));var path=require('path');var timeout=require(_0x765a('0x2'));var express=require('express');var router=express[_0x765a('0x3')]();var fs_extra=require(_0x765a('0x4'));var auth=require(_0x765a('0x5'));var interaction=require(_0x765a('0x6'));var config=require(_0x765a('0x7'));var controller=require('./chatGroup.controller');router[_0x765a('0x8')]('/',auth[_0x765a('0x9')](),controller[_0x765a('0xa')]);router[_0x765a('0x8')]('/describe',auth[_0x765a('0x9')](),controller[_0x765a('0xb')]);router[_0x765a('0x8')]('/:id',auth[_0x765a('0x9')](),controller['show']);router['get']('/:id/unread',auth[_0x765a('0x9')](),controller[_0x765a('0xc')]);router['get'](_0x765a('0xd'),auth[_0x765a('0x9')](),controller[_0x765a('0xe')]);router['get'](_0x765a('0xf'),auth[_0x765a('0x9')](),controller['getMessages']);router[_0x765a('0x10')]('/',auth[_0x765a('0x9')](),controller[_0x765a('0x11')]);router[_0x765a('0x10')](_0x765a('0xd'),auth['isAuthenticated'](),controller['addMembers']);router[_0x765a('0x10')](_0x765a('0xf'),auth[_0x765a('0x9')](),controller[_0x765a('0x12')]);router[_0x765a('0x13')](_0x765a('0x14'),auth['isAuthenticated'](),controller[_0x765a('0x15')]);router[_0x765a('0x16')](_0x765a('0x14'),auth[_0x765a('0x9')](),controller[_0x765a('0x17')]);router[_0x765a('0x16')](_0x765a('0xd'),auth[_0x765a('0x9')](),controller['removeMembers']);module[_0x765a('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 655553d..be215af 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 _0xaf4c=['long','DATE','out','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING'];(function(_0x5e2976,_0x2cc1ec){var _0x5979c9=function(_0x21c481){while(--_0x21c481){_0x5e2976['push'](_0x5e2976['shift']());}};_0x5979c9(++_0x2cc1ec);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x303e1c,_0x34b41e){_0x303e1c=_0x303e1c-0x0;var _0x2ea37f=_0xaf4c[_0x303e1c];return _0x2ea37f;};'use strict';var Sequelize=require('sequelize');module[_0xcaf4('0x0')]={'closed':{'type':Sequelize[_0xcaf4('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xcaf4('0x2')](_0xcaf4('0x3'),_0xcaf4('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xcaf4('0x5')]},'pathTranscript':{'type':Sequelize[_0xcaf4('0x5')]},'mailTranscript':{'type':Sequelize[_0xcaf4('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xcaf4('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcaf4('0x6')]},'note':{'type':Sequelize[_0xcaf4('0x6')]},'browserName':{'type':Sequelize[_0xcaf4('0x6')]},'browserVersion':{'type':Sequelize[_0xcaf4('0x6')]},'osName':{'type':Sequelize[_0xcaf4('0x6')]},'osVersion':{'type':Sequelize[_0xcaf4('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xcaf4('0x6')]},'referer':{'type':Sequelize[_0xcaf4('0x5')]},'customerIp':{'type':Sequelize[_0xcaf4('0x6')]},'formData':{'type':Sequelize[_0xcaf4('0x5')](_0xcaf4('0x7'))},'read1stAt':{'type':Sequelize[_0xcaf4('0x8')]},'lastMsgAt':{'type':Sequelize[_0xcaf4('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xcaf4('0x2')]('in',_0xcaf4('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xcaf4('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xcaf4('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb5fb=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x46306f,_0x5aef14){var _0x16a27f=function(_0x5526fd){while(--_0x5526fd){_0x46306f['push'](_0x46306f['shift']());}};_0x16a27f(++_0x5aef14);}(_0xb5fb,0x172));var _0xbb5f=function(_0x45d5ef,_0x10c29b){_0x45d5ef=_0x45d5ef-0x0;var _0x474d19=_0xb5fb[_0x45d5ef];return _0x474d19;};'use strict';var Sequelize=require(_0xbb5f('0x0'));module[_0xbb5f('0x1')]={'closed':{'type':Sequelize[_0xbb5f('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xbb5f('0x3')]},'ratingType':{'type':Sequelize[_0xbb5f('0x4')](_0xbb5f('0x5'),_0xbb5f('0x6')),'defaultValue':_0xbb5f('0x5')},'ratingMessage':{'type':Sequelize[_0xbb5f('0x7')]},'pathTranscript':{'type':Sequelize[_0xbb5f('0x7')]},'mailTranscript':{'type':Sequelize[_0xbb5f('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xbb5f('0x9')]},'disposition':{'type':Sequelize[_0xbb5f('0x8')]},'secondDisposition':{'type':Sequelize[_0xbb5f('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xbb5f('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xbb5f('0x8')]},'osVersion':{'type':Sequelize[_0xbb5f('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xbb5f('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xbb5f('0x8')]},'formData':{'type':Sequelize[_0xbb5f('0x7')](_0xbb5f('0xa'))},'read1stAt':{'type':Sequelize[_0xbb5f('0x9')]},'lastMsgAt':{'type':Sequelize[_0xbb5f('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xbb5f('0x4')]('in',_0xbb5f('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xbb5f('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xbb5f('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 8f6c00b..98c8212 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 _0x9c44=['join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','CmContact','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','options','addTags','spread','emit','removeTags','unix','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','sendStatus','request-promise','moment','bluebird','mustache','util','path','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','update','name','send','merge','body','contact','interaction','account','Users','map','TagIds','split','forEach','Tags','push','waiting','talking','answered','unmanaged','abandoned','total','UserId','closed','disposition','index','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','start','some','compact','isEmpty','ChatWebsiteId','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','destroy','describe','createVidaooSession','findOne','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','Error\x20in\x20conversion\x20vidaooMetadata','out','ChatMessage','create','ValidationError','updateAttributes','abandon','AbandonInteraction','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x49c4('0x0'));var moment=require(_0x49c4('0x1'));var BPromise=require(_0x49c4('0x2'));var Mustache=require(_0x49c4('0x3'));var util=require(_0x49c4('0x4'));var path=require(_0x49c4('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x49c4('0x6'));var Redis=require('ioredis');var qs=require(_0x49c4('0x7'));var as=require(_0x49c4('0x8'));var pdf=require(_0x49c4('0x9'));var logger=require(_0x49c4('0xa'))(_0x49c4('0xb'));var config=require('../../config/environment');var db=require(_0x49c4('0xc'))['db'];config[_0x49c4('0xd')]=_[_0x49c4('0xe')](config[_0x49c4('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49c4('0xd')]));require(_0x49c4('0xf'))['register'](socket);var jayson=require(_0x49c4('0x10'));var client=jayson[_0x49c4('0x11')]['http']({'port':0x232b});var client9004=jayson['client'][_0x49c4('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x6d1b08,_0x5487cd,_0x7df3a9,_0x403bfb){return new BPromise(function(_0x5f2fd9,_0x1909fe){var _0x280996=_0x403bfb||client;return _0x280996[_0x49c4('0x13')](_0x6d1b08,_0x7df3a9)[_0x49c4('0x14')](function(_0x12777c){logger[_0x49c4('0x15')](_0x49c4('0x16'),_0x5487cd,_0x49c4('0x17'));logger['debug'](_0x49c4('0x18'),_0x5487cd,_0x49c4('0x17'),JSON[_0x49c4('0x19')](_0x12777c));if(_0x12777c[_0x49c4('0x1a')]){if(_0x12777c[_0x49c4('0x1a')]['code']===0x1f4){logger[_0x49c4('0x1a')](_0x49c4('0x16'),_0x5487cd,_0x12777c['error']['message']);return _0x1909fe(_0x12777c[_0x49c4('0x1a')][_0x49c4('0x1b')]);}logger[_0x49c4('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x5487cd,_0x12777c[_0x49c4('0x1a')]['message']);return _0x5f2fd9(_0x12777c[_0x49c4('0x1a')][_0x49c4('0x1b')]);}else{logger[_0x49c4('0x15')](_0x49c4('0x16'),_0x5487cd,_0x49c4('0x17'));_0x5f2fd9(_0x12777c[_0x49c4('0x1c')][_0x49c4('0x1b')]);}})[_0x49c4('0x1d')](function(_0x2197d2){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5487cd,_0x2197d2);_0x1909fe(_0x2197d2);});});}function respondWithStatusCode(_0x57f502,_0x1c99b1){_0x1c99b1=_0x1c99b1||0xcc;return function(_0x4f0b62){if(_0x4f0b62){return _0x57f502['sendStatus'](_0x1c99b1);}return _0x57f502[_0x49c4('0x1e')](_0x1c99b1)[_0x49c4('0x1f')]();};}function respondWithResult(_0x26c640,_0xd335e4){_0xd335e4=_0xd335e4||0xc8;return function(_0x4811c4){if(_0x4811c4){return _0x26c640['status'](_0xd335e4)[_0x49c4('0x20')](_0x4811c4);}};}function respondWithFilteredResult(_0x9cb797,_0x565423){return function(_0x207358){if(_0x207358){var _0x43e014=typeof _0x565423[_0x49c4('0x21')]===_0x49c4('0x22')&&typeof _0x565423['limit']==='undefined';var _0x449960=_0x207358['count'];var _0x3800b7=_0x43e014?0x0:_0x565423[_0x49c4('0x21')];var _0x3f1708=_0x43e014?_0x207358[_0x49c4('0x23')]:_0x565423['offset']+_0x565423[_0x49c4('0x24')];var _0x2b2793;if(_0x3f1708>=_0x449960){_0x3f1708=_0x449960;_0x2b2793=0xc8;}else{_0x2b2793=0xce;}_0x9cb797[_0x49c4('0x1e')](_0x2b2793);return _0x9cb797[_0x49c4('0x25')](_0x49c4('0x26'),_0x3800b7+'-'+_0x3f1708+'/'+_0x449960)[_0x49c4('0x20')](_0x207358);}return null;};}function saveUpdates(_0x26ba17){return function(_0x427b26){if(_0x427b26){return _0x427b26[_0x49c4('0x27')](_0x26ba17)[_0x49c4('0x14')](function(_0x46f7ea){return _0x46f7ea;});}return null;};}function removeEntity(_0x4ea6ea){return function(_0x4f4495){if(_0x4f4495){return _0x4f4495['destroy']()[_0x49c4('0x14')](function(){_0x4ea6ea[_0x49c4('0x1e')](0xcc)[_0x49c4('0x1f')]();});}};}function handleEntityNotFound(_0x27e467){return function(_0x28eb47){if(!_0x28eb47){_0x27e467['sendStatus'](0x194);}return _0x28eb47;};}function handleError(_0x38ad77,_0x116eb4){_0x116eb4=_0x116eb4||0x1f4;return function(_0x2e7a69){logger[_0x49c4('0x1a')](_0x2e7a69['stack']);if(_0x2e7a69['name']){delete _0x2e7a69[_0x49c4('0x28')];}_0x38ad77[_0x49c4('0x1e')](_0x116eb4)[_0x49c4('0x29')](_0x2e7a69);};}function getMustacheRender(_0x13b3b4,_0xd38540){return Mustache['render'](_0x13b3b4,_[_0x49c4('0x2a')](_0xd38540[_0x49c4('0x2b')],{'contact':_0xd38540[_0x49c4('0x2c')],'message':_0xd38540['message'],'agent':_0xd38540['agent'],'interaction':_0xd38540[_0x49c4('0x2d')],'account':_0xd38540[_0x49c4('0x2e')]}))||'';}function getInteractionUsers(_0x3bec0a,_0x1238c0){return new BPromise(function(_0x2b45a1,_0x2cf897){try{if(_0x1238c0[_0x3bec0a['id']]){_0x3bec0a[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x1238c0[_0x3bec0a['id']],function(_0x3209cd){return{'id':_0x3209cd['id'],'fullname':_0x3209cd['fullname']};});}}catch(_0x2d34ca){_0x2cf897(_0x2d34ca);}_0x2b45a1(_0x3bec0a);});}function getInteractionTags(_0x5b96df,_0xdda586){return new BPromise(function(_0x349791,_0x2625a6){try{if(_0x5b96df[_0x49c4('0x31')]){_0x5b96df['Tags']=[];_0x5b96df[_0x49c4('0x31')][_0x49c4('0x32')](',')[_0x49c4('0x33')](function(_0x4e913a){_0x5b96df[_0x49c4('0x34')][_0x49c4('0x35')](_0xdda586[_0x4e913a]);});}delete _0x5b96df[_0x49c4('0x31')];}catch(_0x5e5366){_0x2625a6(_0x5e5366);}_0x349791(_0x5b96df);});}function updateChatInteraction(_0x1ba7a0,_0x24c177,_0x143916){return new BPromise(function(_0x2ba76a,_0x70e552){return getInteractionUsers(_0x1ba7a0,_0x143916)[_0x49c4('0x14')](function(_0x1e506a){return getInteractionTags(_0x1e506a,_0x24c177);})['then'](function(_0x2d2510){return getStateInteraction(_0x2d2510);})[_0x49c4('0x14')](function(_0x32b172){_0x2ba76a(_0x32b172);})[_0x49c4('0x1d')](function(_0x41ad28){_0x70e552(_0x41ad28);});});}function getStateInteraction(_0x29dd5d){return new BPromise(function(_0x1be62d){_0x29dd5d[_0x49c4('0x36')]=0x0;_0x29dd5d[_0x49c4('0x37')]=0x0;_0x29dd5d[_0x49c4('0x38')]=0x0;_0x29dd5d[_0x49c4('0x39')]=0x0;_0x29dd5d[_0x49c4('0x3a')]=0x0;_0x29dd5d[_0x49c4('0x3b')]=0x0;if(!_0x29dd5d['closed']&&!_0x29dd5d[_0x49c4('0x3c')]){_0x29dd5d['waiting']+=0x1;}if(!_0x29dd5d[_0x49c4('0x3d')]&&_0x29dd5d[_0x49c4('0x3c')]){_0x29dd5d[_0x49c4('0x37')]+=0x1;if(_0x29dd5d[_0x49c4('0x36')]){_0x29dd5d[_0x49c4('0x36')]-=0x1;}}if(_0x29dd5d[_0x49c4('0x3d')]&&_0x29dd5d['disposition']==='abandoned'){_0x29dd5d[_0x49c4('0x3a')]+=0x1;if(_0x29dd5d[_0x49c4('0x36')]){_0x29dd5d[_0x49c4('0x36')]-=0x1;}}else if(_0x29dd5d[_0x49c4('0x3d')]&&!_0x29dd5d['UserId']&&_0x29dd5d[_0x49c4('0x3e')]){_0x29dd5d[_0x49c4('0x39')]+=0x1;if(_0x29dd5d[_0x49c4('0x36')]){_0x29dd5d[_0x49c4('0x36')]-=0x1;}}else if(_0x29dd5d[_0x49c4('0x3d')]&&_0x29dd5d[_0x49c4('0x3c')]){_0x29dd5d[_0x49c4('0x38')]+=0x1;if(_0x29dd5d[_0x49c4('0x37')]){_0x29dd5d[_0x49c4('0x37')]-=0x1;}}_0x29dd5d['total']+=0x1;_0x1be62d(_0x29dd5d);});}exports[_0x49c4('0x3f')]=function(_0x4d27d0,_0x33696e){var _0x628423={},_0x301def={},_0x258abe={'count':0x0,'rows':[]};var _0x2d93d8=_['map'](db[_0x49c4('0x40')][_0x49c4('0x41')],function(_0x384862){return{'name':_0x384862[_0x49c4('0x42')],'type':_0x384862[_0x49c4('0x43')][_0x49c4('0x44')]};});_0x301def[_0x49c4('0x45')]=_['map'](_0x2d93d8,_0x49c4('0x28'));_0x301def['query']=_[_0x49c4('0x46')](_0x4d27d0[_0x49c4('0x47')]);_0x301def[_0x49c4('0x48')]=_[_0x49c4('0x49')](_0x301def[_0x49c4('0x45')],_0x301def[_0x49c4('0x47')]);_0x628423[_0x49c4('0x4a')]=_['intersection'](_0x301def[_0x49c4('0x45')],qs[_0x49c4('0x4b')](_0x4d27d0['query'][_0x49c4('0x4b')]));_0x628423[_0x49c4('0x4a')]=_0x628423[_0x49c4('0x4a')][_0x49c4('0x4c')]?_0x628423['attributes']:_0x301def['model'];if(!_0x4d27d0[_0x49c4('0x47')]['hasOwnProperty'](_0x49c4('0x4d'))){_0x628423[_0x49c4('0x24')]=qs[_0x49c4('0x24')](_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x24')]);_0x628423[_0x49c4('0x21')]=qs[_0x49c4('0x21')](_0x4d27d0['query'][_0x49c4('0x21')]);}_0x628423[_0x49c4('0x4e')]=qs[_0x49c4('0x4f')](_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x4f')]);_0x628423[_0x49c4('0x50')]=qs[_0x49c4('0x48')](_[_0x49c4('0x51')](_0x4d27d0[_0x49c4('0x47')],_0x301def[_0x49c4('0x48')]),_0x2d93d8);var _0x5b822f=[];var _0x5e63f0=squel[_0x49c4('0x52')]()[_0x49c4('0x53')]('id')['field']('name')[_0x49c4('0x53')]('color')['from'](_0x49c4('0x54'));var _0x4081a5=squel[_0x49c4('0x52')]()[_0x49c4('0x53')](_0x49c4('0x55'))[_0x49c4('0x53')](_0x49c4('0x56'))['field'](_0x49c4('0x57'))[_0x49c4('0x58')](_0x49c4('0x59'),'ui')[_0x49c4('0x5a')](_0x49c4('0x5b'),'u',_0x49c4('0x5c'));var _0x5d24f3=squel['select']()[_0x49c4('0x58')](_0x49c4('0x5d'),'i')[_0x49c4('0x5a')](_0x49c4('0x5e'),'c',_0x49c4('0x5f'))[_0x49c4('0x5a')](_0x49c4('0x5b'),'o','o.id\x20=\x20i.UserId')[_0x49c4('0x5a')](_0x49c4('0x60'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x49c4('0x5a')]('chat_messages','me',_0x49c4('0x61'))[_0x49c4('0x5a')](_0x49c4('0x62'),'it',_0x49c4('0x63'))[_0x49c4('0x5a')](_0x49c4('0x54'),'t',_0x49c4('0x64'));var _0x2f520f=squel['expr']();var _0x3894e0=[];var _0x27b9c2=squel['expr']();var _0x10dec7;if(_0x4d27d0[_0x49c4('0x47')]['search']){_0x10dec7=as[_0x49c4('0x65')](_0x4d27d0[_0x49c4('0x47')]['search']);var _0x4dc54d=_0x10dec7['sqlOperator'];for(var _0x513879=0x0;_0x513879<_0x10dec7[_0x49c4('0x66')]['length'];_0x513879++){var _0xb20a5d=_0x10dec7[_0x49c4('0x66')][_0x513879];var _0x515240='i';var _0x679134=_[_0x49c4('0x67')](_0x2d93d8,['name',_0xb20a5d[_0x49c4('0x53')]]);if(!_0x679134){switch(_0xb20a5d[_0x49c4('0x53')]){case _0x49c4('0x68'):if(_0xb20a5d[_0x49c4('0x69')]==0x1){_0x5d24f3['having']('`'+_0xb20a5d[_0x49c4('0x53')]+_0x49c4('0x6a'));}else{_0x5d24f3[_0x49c4('0x6b')]('`'+_0xb20a5d[_0x49c4('0x53')]+'`\x20>\x200');}break;case _0x49c4('0x6c'):if(_0xb20a5d['operator']==='$substring'){if(_0xb20a5d['value']['split']('\x20')[_0x49c4('0x4c')]>0x1){_0x2f520f[_0x4dc54d](_0x49c4('0x6d'),qs[_0x49c4('0x6e')](_0xb20a5d[_0x49c4('0x69')]),null);}else{var _0x5b056e='%'+_0xb20a5d['value']+'%';_0x2f520f[_0x4dc54d](_0x49c4('0x6f'),_0x5b056e,_0x5b056e,_0x5b056e);}}else{_0x679134=_[_0x49c4('0x67')](_0x2d93d8,[_0x49c4('0x28'),_0x49c4('0x70')]);_0xb20a5d[_0x49c4('0x53')]=_0x49c4('0x70');_0x191afb=as[_0x49c4('0x71')](_0x515240,_0x679134[_0x49c4('0x43')],_0xb20a5d);_0x2f520f[_0x4dc54d](_0x191afb['text'],_0x191afb[_0x49c4('0x69')]['start'],_0x191afb[_0x49c4('0x69')][_0x49c4('0x1f')]);}break;case _0x49c4('0x72'):var _0x1ea1b4=_0xb20a5d[_0x49c4('0x69')][_0x49c4('0x32')](',')[_0x49c4('0x30')](function(_0x3feb0b){return Number(_0x3feb0b);});_0x1ea1b4[_0x49c4('0x33')](function(_0x1743d0){_0x27b9c2['or'](_0x49c4('0x73'),'%,'+_0x1743d0+',%');});_0x3894e0=_[_0x49c4('0x74')](_0x3894e0,_0x1ea1b4);break;case _0x49c4('0x75'):if(_0xb20a5d[_0x49c4('0x76')]===_0x49c4('0x77')){_0x2f520f[_0x4dc54d](_0x49c4('0x78'),'%'+_0xb20a5d[_0x49c4('0x69')]+'%',null);}else{_0x679134=_[_0x49c4('0x67')](_0x2d93d8,['name','UserId']);_0xb20a5d[_0x49c4('0x53')]=_0x49c4('0x3c');_0x191afb=as['buildExpression'](_0x515240,_0x679134[_0x49c4('0x43')],_0xb20a5d);_0x2f520f[_0x4dc54d](_0x191afb[_0x49c4('0x79')],_0x191afb[_0x49c4('0x69')][_0x49c4('0x7a')],_0x191afb['value']['end']);}break;case'body':_0x191afb=as[_0x49c4('0x71')]('me',null,_0xb20a5d);_0x2f520f[_0x4dc54d](_0x191afb[_0x49c4('0x79')],_0x191afb[_0x49c4('0x69')][_0x49c4('0x7a')],_0x191afb[_0x49c4('0x69')][_0x49c4('0x1f')]);break;}}else{var _0x191afb=as[_0x49c4('0x71')](_0x515240,_0x679134[_0x49c4('0x43')],_0xb20a5d);_0x2f520f[_0x4dc54d](_0x191afb['text'],_0x191afb[_0x49c4('0x69')][_0x49c4('0x7a')],_0x191afb[_0x49c4('0x69')]['end']);}}}else{var _0x4448b9=_(_0x4d27d0[_0x49c4('0x47')])[_0x49c4('0x46')]()[_0x49c4('0x30')](function(_0x1f25be){return _[_0x49c4('0x7b')](_0x2d93d8,[_0x49c4('0x28'),_0x1f25be])?_0x1f25be:undefined;})[_0x49c4('0x7c')]()['value']();if(!_[_0x49c4('0x7d')](_0x4448b9)){_0x4448b9[_0x49c4('0x33')](function(_0x85540f){if(_0x85540f===_0x49c4('0x7e')){_0x5d24f3[_0x49c4('0x50')]('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x4d27d0[_0x49c4('0x47')][_0x85540f]));}else if(_0x85540f==='createdAt'){var _0x34cf49=JSON['parse'](_0x4d27d0[_0x49c4('0x47')][_0x85540f])[_0x49c4('0x7f')];var _0x3b03dd=JSON[_0x49c4('0x80')](_0x4d27d0['query'][_0x85540f])[_0x49c4('0x81')];_0x5d24f3[_0x49c4('0x50')](_0x49c4('0x82'),_0x34cf49,_0x3b03dd);}else{if(_0x4d27d0[_0x49c4('0x47')][_0x85540f]===_0x49c4('0x83')){_0x5d24f3[_0x49c4('0x50')]('i.'+_0x85540f+_0x49c4('0x84'));}else{_0x5d24f3[_0x49c4('0x50')]('i.'+_0x85540f+_0x49c4('0x85'),_0x4d27d0[_0x49c4('0x47')][_0x85540f]);}}});}if(_0x4d27d0['query'][_0x49c4('0x86')]){if(_0x4d27d0[_0x49c4('0x47')]['read']==0x1){_0x5d24f3[_0x49c4('0x6b')]('`unreadMessages`\x20=\x200');}else{_0x5d24f3[_0x49c4('0x6b')](_0x49c4('0x87'));}}if(_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x88')]){_0x3894e0=_[_0x49c4('0x89')](_0x4d27d0['query'][_0x49c4('0x88')])?_0x4d27d0[_0x49c4('0x47')]['tag']:new Array(_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x88')]);_0x3894e0['forEach'](function(_0xbd12b9){_0x27b9c2['or'](_0x49c4('0x73'),'%,'+_0xbd12b9+',%');});}if(_0x4d27d0['query'][_0x49c4('0x8a')]){var _0x993d00=_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x8a')]['replace']('\x5c','\x5c\x5c')[_0x49c4('0x8b')](/'/g,'\x27\x27');if(qs[_0x49c4('0x8c')](_0x993d00)){_0x2f520f['or']('i.id\x20LIKE\x20?',_0x993d00+'%');}else{_0x2f520f['or'](_0x49c4('0x8d'),qs['getFullTextValue'](_0x993d00))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x993d00+'%');}}}_0x5d24f3[_0x49c4('0x50')](_0x2f520f);_0x5d24f3['group']('i.id');var _0x39cacf={'type':db[_0x49c4('0x8e')]['QueryTypes'][_0x49c4('0x8f')],'raw':!![]};var _0x5c3509=_0x5d24f3['clone']();_0x5c3509['field'](_0x49c4('0x90'));_0x5c3509[_0x49c4('0x53')](_0x49c4('0x91'),_0x49c4('0x68'));if(_0x628423['order']){_0x628423['order'][_0x49c4('0x33')](function(_0x48705c){var _0x2c560e=_0x48705c[0x0]==='contactName'?_0x48705c[0x0]:'i.'+_0x48705c[0x0];_0x5d24f3[_0x49c4('0x4e')](_0x2c560e,_0x48705c[0x1]===_0x49c4('0x92')?![]:!![]);});}if(!_[_0x49c4('0x7d')](_0x3894e0)){_0x5d24f3[_0x49c4('0x6b')](_0x27b9c2);_0x5c3509[_0x49c4('0x50')](_0x49c4('0x93'),_0x3894e0);}BPromise[_0x49c4('0x94')]()['then'](function(){if(!_0x10dec7){if(_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x7e')])return;_0x5c3509[_0x49c4('0x50')](_0x49c4('0x95'));_0x5d24f3[_0x49c4('0x50')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x4d27d0[_0x49c4('0x96')][_0x49c4('0x97')]!==_0x49c4('0x98'))return;return _0x4d27d0['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x49c4('0x14')](function(_0x27b31d){if(_[_0x49c4('0x7d')](_0x27b31d)){_0x5c3509[_0x49c4('0x50')](_0x49c4('0x99'));_0x5d24f3['where'](_0x49c4('0x99'));}else{_0x5c3509[_0x49c4('0x50')](_0x49c4('0x9a'),_[_0x49c4('0x30')](_0x27b31d,'id'));_0x5d24f3['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x49c4('0x30')](_0x27b31d,'id'));}});})[_0x49c4('0x14')](function(){if(_0x4d27d0[_0x49c4('0x96')][_0x49c4('0x97')]===_0x49c4('0x98')&&!_0x10dec7&&!_0x4d27d0['query'][_0x49c4('0x7e')])return[];return db[_0x49c4('0x9b')][_0x49c4('0x47')](_0x5c3509[_0x49c4('0x9c')](),_0x39cacf);})[_0x49c4('0x14')](function(_0x8f37e5){_0x258abe['count']=_0x8f37e5[_0x49c4('0x4c')];if(_0x258abe[_0x49c4('0x23')]===0x0)return[];return db[_0x49c4('0x9b')][_0x49c4('0x47')](_0x5e63f0['toString'](),_0x39cacf)['then'](function(_0xa96f53){_0x5b822f=_['keyBy'](_0xa96f53,'id');_0x39cacf=_[_0x49c4('0x2a')](_0x39cacf,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x4b')]){_0x628423[_0x49c4('0x4a')][_0x49c4('0x33')](function(_0x4eebc9){_0x5d24f3['field']('i.'+_0x4eebc9);});}else{_0x5d24f3[_0x49c4('0x53')](_0x49c4('0x91'),_0x49c4('0x68'));_0x5d24f3['field']('a.key',_0x49c4('0x9d'));_0x5d24f3['field']('a.mandatoryDisposition',_0x49c4('0x9e'));_0x5d24f3['field'](_0x49c4('0x9f'),_0x49c4('0xa0'));_0x5d24f3['field'](_0x49c4('0xa1'));_0x5d24f3[_0x49c4('0x53')]('c.firstName','Contact.firstName');_0x5d24f3[_0x49c4('0x53')]('c.lastName',_0x49c4('0xa2'));_0x5d24f3[_0x49c4('0x53')](_0x49c4('0xa3'),_0x49c4('0xa4'));_0x5d24f3[_0x49c4('0x53')](_0x49c4('0xa5'),_0x49c4('0xa6'));_0x5d24f3['field'](_0x49c4('0xa7'),_0x49c4('0xa8'));_0x5d24f3[_0x49c4('0x53')](_0x49c4('0xa9'),_0x49c4('0xaa'));_0x5d24f3['field'](_0x49c4('0xab'),'Owner.fullname');_0x5d24f3[_0x49c4('0x53')](_0x49c4('0xac'),_0x49c4('0xad'));_0x5d24f3[_0x49c4('0x53')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x49c4('0x31'));}if(_0x628423[_0x49c4('0x24')])_0x5d24f3[_0x49c4('0x24')](_0x628423[_0x49c4('0x24')]);if(_0x628423[_0x49c4('0x21')])_0x5d24f3[_0x49c4('0x21')](_0x628423['offset']);return db[_0x49c4('0x9b')]['query'](_0x5d24f3[_0x49c4('0x9c')](),_0x39cacf);})[_0x49c4('0x14')](function(_0x1db53d){if(_0x1db53d[_0x49c4('0x4c')]>0x0)_0x4081a5['where'](_0x49c4('0xae'),_[_0x49c4('0x30')](_0x1db53d,'id'));return db['sequelize'][_0x49c4('0x47')](_0x4081a5[_0x49c4('0x9c')](),_0x39cacf)['then'](function(_0x562f47){var _0x25f1c7=_[_0x49c4('0xaf')](_0x562f47,_0x49c4('0xb0'));var _0x1aa3a3=[];_0x1db53d[_0x49c4('0x33')](function(_0x15e403){_0x1aa3a3[_0x49c4('0x35')](updateChatInteraction(_0x15e403,_0x5b822f,_0x25f1c7));});return BPromise[_0x49c4('0xb1')](_0x1aa3a3);});});})[_0x49c4('0x14')](function(_0x117c64){_0x258abe[_0x49c4('0xb2')]=_0x117c64;return _0x258abe;})['then'](respondWithFilteredResult(_0x33696e,_0x628423))['catch'](handleError(_0x33696e,null));};exports[_0x49c4('0xb3')]=function(_0x1e286e,_0xccdf6d){var _0x5be042={'raw':![],'where':{'id':_0x1e286e[_0x49c4('0xb4')]['id']}},_0x1276bf={};_0x1276bf['model']=_[_0x49c4('0x46')](db['ChatInteraction'][_0x49c4('0x41')]);_0x1276bf[_0x49c4('0x47')]=_[_0x49c4('0x46')](_0x1e286e[_0x49c4('0x47')]);_0x1276bf['filters']=_[_0x49c4('0x49')](_0x1276bf[_0x49c4('0x45')],_0x1276bf[_0x49c4('0x47')]);_0x5be042[_0x49c4('0x4a')]=_[_0x49c4('0x49')](_0x1276bf['model'],qs['fields'](_0x1e286e['query'][_0x49c4('0x4b')]));_0x5be042[_0x49c4('0x4a')]=_0x5be042[_0x49c4('0x4a')][_0x49c4('0x4c')]?_0x5be042[_0x49c4('0x4a')]:_0x1276bf['model'];if(_0x1e286e[_0x49c4('0x47')][_0x49c4('0xb5')]){_0x5be042[_0x49c4('0xb6')]=[{'all':!![]}];}_0x5be042=_[_0x49c4('0x2a')]({},_0x5be042,_0x1e286e['options']);return db[_0x49c4('0x40')][_0x49c4('0x67')](_0x5be042)[_0x49c4('0x14')](handleEntityNotFound(_0xccdf6d,null))[_0x49c4('0x14')](respondWithResult(_0xccdf6d,null))[_0x49c4('0x1d')](handleError(_0xccdf6d,null));};exports['create']=function(_0x1d9e1a,_0x9b622d){return db[_0x49c4('0x40')]['create'](_0x1d9e1a[_0x49c4('0x2b')],{})[_0x49c4('0x14')](respondWithResult(_0x9b622d,0xc9))[_0x49c4('0x1d')](handleError(_0x9b622d,null));};exports['update']=function(_0x97f579,_0x491231){if(_0x97f579['body']['id']){delete _0x97f579[_0x49c4('0x2b')]['id'];}return db[_0x49c4('0x40')]['find']({'where':{'id':_0x97f579[_0x49c4('0xb4')]['id']}})[_0x49c4('0x14')](handleEntityNotFound(_0x491231,null))[_0x49c4('0x14')](saveUpdates(_0x97f579[_0x49c4('0x2b')],null))[_0x49c4('0x14')](respondWithResult(_0x491231,null))[_0x49c4('0x1d')](handleError(_0x491231,null));};exports[_0x49c4('0xb7')]=function(_0x219133,_0x59dbef){return db['ChatInteraction'][_0x49c4('0x67')]({'where':{'id':_0x219133[_0x49c4('0xb4')]['id']}})[_0x49c4('0x14')](handleEntityNotFound(_0x59dbef,null))['then'](removeEntity(_0x59dbef,null))['catch'](handleError(_0x59dbef,null));};exports[_0x49c4('0xb8')]=function(_0x3222ec,_0xd979f7){return db[_0x49c4('0x40')][_0x49c4('0xb8')]()[_0x49c4('0x14')](respondWithResult(_0xd979f7,null))[_0x49c4('0x1d')](handleError(_0xd979f7,null));};exports[_0x49c4('0xb9')]=function(_0x318008,_0x1e2dd3){var _0xa42e74=_0x318008[_0x49c4('0xb4')]['id'];var _0x352b67;var _0xbfb25b;var _0x4cc855;return db[_0x49c4('0x40')][_0x49c4('0xba')]({'where':{'id':_0xa42e74}})[_0x49c4('0x14')](function(_0x318aaf){_0x352b67=_0x318aaf;return db['ChatWebsite']['findOne']({'where':{'id':_0x318aaf[_0x49c4('0x7e')]},'attributes':['id','vidaooApiKey',_0x49c4('0xbb'),_0x49c4('0xbc'),_0x49c4('0xbd'),_0x49c4('0xbe')],'raw':!![]});})[_0x49c4('0x14')](function(_0x45a2ef){if(_0x45a2ef&&_0x45a2ef[_0x49c4('0xbf')]&&_0x45a2ef[_0x49c4('0xbb')]){_0xbfb25b=_0x45a2ef;var _0x31ba95={'interaction':{'id':_0xa42e74},'agent':{'id':_0x318008[_0x49c4('0x96')]['id'],'name':_0x318008[_0x49c4('0x96')][_0x49c4('0x28')],'fullname':_0x318008['user'][_0x49c4('0xc0')],'email':_0x318008[_0x49c4('0x96')][_0x49c4('0xc1')]},'contact':_0x318008['body'][_0x49c4('0x2c')],'account':_0x318008['body'][_0x49c4('0x2e')]};var _0x82925={'rejectUnauthorized':![],'method':_0x49c4('0xc2'),'url':_0x49c4('0xc3'),'headers':{'X-APIKEY':_0x45a2ef['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x318008[_0x49c4('0x96')]['email']],'buttons':null,'topic':_0xbfb25b['vidaooTopic'],'note':_[_0x49c4('0xc4')](_0xbfb25b[_0x49c4('0xbd')])?null:getMustacheRender(_0xbfb25b[_0x49c4('0xbd')],_0x31ba95),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0xbfb25b[_0x49c4('0xbe')])){var _0x1221de=getMustacheRender(_0xbfb25b[_0x49c4('0xbe')],_0x31ba95);var _0x330512=JSON[_0x49c4('0x80')](_0x1221de);_0x82925[_0x49c4('0x2b')][_0x49c4('0xc5')]=_0x330512;}}catch(_0x19f30b){throw new db[(_0x49c4('0x8e'))]['ValidationError'](_0x49c4('0xc6'));}return rp(_0x82925);}else{throw new db[(_0x49c4('0x8e'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x49c4('0x14')](function(_0x4d5481){_0x4cc855=_0x4d5481;if(_0x4cc855['id']){var _0xefec38={'body':_0x4cc855['join_url'],'ChatWebsiteId':_0xbfb25b['id'],'ChatInteractionId':_0x352b67['id'],'direction':_0x49c4('0xc7'),'UserId':_0x318008['user']['id']};return db[_0x49c4('0xc8')][_0x49c4('0xc9')](_0xefec38,{});}else{throw new db[(_0x49c4('0x8e'))][(_0x49c4('0xca'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x352b67[_0x49c4('0xcb')]({'vidaooSessionId':_0x4cc855['id']});})[_0x49c4('0x14')](respondWithResult(_0x1e2dd3,null))[_0x49c4('0x1d')](handleError(_0x1e2dd3,null));};exports['customUpdate']=function(_0x367d3d,_0x1814c4){if(_0x367d3d['body']['id']){delete _0x367d3d['body']['id'];}return db[_0x49c4('0x40')][_0x49c4('0x67')]({'where':{'id':_0x367d3d[_0x49c4('0xb4')]['id']},'include':[{'model':db['CmContact'],'as':_0x49c4('0x6c')}]})[_0x49c4('0x14')](handleEntityNotFound(_0x1814c4,null))[_0x49c4('0x14')](saveUpdates(_0x367d3d[_0x49c4('0x2b')],null))['then'](respondWithResult(_0x1814c4,null))[_0x49c4('0x1d')](handleError(_0x1814c4,null));};exports['abandon']=function(_0x4d0a28,_0xf5f718){if(_0x4d0a28[_0x49c4('0x2b')]['id']){delete _0x4d0a28[_0x49c4('0x2b')]['id'];}return db[_0x49c4('0x40')]['find']({'where':{'id':_0x4d0a28[_0x49c4('0xb4')]['id']}})[_0x49c4('0x14')](function(_0xa6f48){if(!_0xa6f48){logger[_0x49c4('0x1a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x49c4('0xcc'),0x194,'entity\x20not\x20found');_0xf5f718['sendStatus'](0x194);}else{if(_0xa6f48[_0x49c4('0x3c')]){throw new db[(_0x49c4('0x8e'))][(_0x49c4('0xca'))]('Interaction\x20already\x20assigned');}}return _0xa6f48;})[_0x49c4('0x14')](function(_0x4a874a){if(_0x4a874a){return _0x4a874a[_0x49c4('0x27')]({'closed':_0x4d0a28[_0x49c4('0x2b')][_0x49c4('0x3d')],'disposition':_0x4d0a28[_0x49c4('0x2b')][_0x49c4('0x3e')]})[_0x49c4('0x14')](function(_0x2b31ac){return _0x2b31ac;});}})['then'](function(){return respondWithRpcPromise(_0x49c4('0xcd'),_0x49c4('0xcc'),_0x4d0a28[_0x49c4('0x2b')],client9004);})[_0x49c4('0x14')](respondWithResult(_0xf5f718,null))['catch'](handleError(_0xf5f718,null));};exports['attachmentUpload']=function(_0x4c15ff,_0x2d4f8a){_0x4c15ff[_0x49c4('0x2b')][_0x49c4('0x28')]=_0x4c15ff[_0x49c4('0xce')][_0x49c4('0xcf')];_0x4c15ff[_0x49c4('0x2b')][_0x49c4('0xd0')]=_0x4c15ff['file'][_0x49c4('0xd1')];_0x4c15ff[_0x49c4('0x2b')]['type']=_0x4c15ff['file']['mimetype'];return db[_0x49c4('0xd2')][_0x49c4('0xc9')](_0x4c15ff[_0x49c4('0x2b')])[_0x49c4('0x14')](respondWithResult(_0x2d4f8a,0xc9))[_0x49c4('0x1d')](handleError(_0x2d4f8a,null));};exports[_0x49c4('0xd3')]=function(_0x2f36c6,_0x5039fc){return db[_0x49c4('0x40')][_0x49c4('0xba')]({'where':{'id':_0x2f36c6[_0x49c4('0xb4')]['id']},'raw':!![]})[_0x49c4('0x14')](handleEntityNotFound(_0x5039fc,null))['then'](function(_0x3440ad){if(_0x3440ad){if(_0x3440ad[_0x49c4('0x3d')]){return _0x5039fc[_0x49c4('0x1e')](0x193)[_0x49c4('0x20')]({'status':0x193,'message':_0x49c4('0xd4')});}return db['Attachment'][_0x49c4('0xba')]({'where':{'id':_0x2f36c6['query']['attachId']},'raw':!![]})[_0x49c4('0x14')](handleEntityNotFound(_0x5039fc,null));}})[_0x49c4('0x14')](function(_0x113beb){if(_0x113beb){var _0x35289f=_0x113beb[_0x49c4('0xd5')]!==null;var _0x5b9591=path[_0x49c4('0xd6')](config[_0x49c4('0xd7')],_0x49c4('0xd8'));if(_0x35289f){_0x5b9591=path['join'](_0x5b9591,_0x49c4('0xd9'));}var _0x45c34a=path['join'](_0x5b9591,_0x113beb[_0x49c4('0xd0')]);return _0x5039fc[_0x49c4('0xda')](_0x45c34a);}})[_0x49c4('0x1d')](handleError(_0x5039fc,null));};exports[_0x49c4('0xdb')]=function(_0x2ef538,_0x163128){var _0x1679ca=null;var _0x4b0114=null;var _0x261d61=null;if(_0x2ef538[_0x49c4('0x2b')]['id']){delete _0x2ef538[_0x49c4('0x2b')]['id'];}if(_0x2ef538[_0x49c4('0x2b')][_0x49c4('0xdc')]){_0x261d61=path['join'](config[_0x49c4('0xd7')],_0x49c4('0xdd'),util[_0x49c4('0xde')](_0x49c4('0xdf'),Date[_0x49c4('0xe0')]()));_0x2ef538['body'][_0x49c4('0xe1')]=_0x261d61;}return db[_0x49c4('0x40')][_0x49c4('0x67')]({'where':{'id':_0x2ef538[_0x49c4('0xb4')]['id']},'include':[{'model':db[_0x49c4('0xc8')],'as':_0x49c4('0xe2'),'include':[{'model':db[_0x49c4('0x75')],'as':_0x49c4('0x75')}]}]})[_0x49c4('0x14')](handleEntityNotFound(_0x163128,null))[_0x49c4('0x14')](saveUpdates(_0x2ef538['body'],null))[_0x49c4('0x14')](function(_0x1b6966){if(_0x1b6966){_0x1679ca=_0x1b6966;return db[_0x49c4('0xe3')][_0x49c4('0x67')]({'where':{'id':_0x1679ca[_0x49c4('0x7e')]}});}})['then'](function(_0x501786){if(_0x501786){_0x4b0114=_0x501786;return db[_0x49c4('0xe4')][_0x49c4('0x67')]({'where':{'id':_0x1679ca[_0x49c4('0x70')]}});}})[_0x49c4('0x14')](function(_0xd87f7e){if(_0xd87f7e){if(_0x261d61){var _0x25d2a1=null;for(var _0x58d24f=0x1;_0x58d24f<_0x1679ca[_0x49c4('0xe2')][_0x49c4('0x4c')];++_0x58d24f){_0x25d2a1=_0x1679ca['Messages'][_0x58d24f];var _0x386595=_0x25d2a1['UserId']?util[_0x49c4('0xde')](_0x49c4('0xe5'),_0x4b0114[_0x49c4('0xe6')],_0x25d2a1['UserId']):_0x49c4('0xe7');var _0x4f431e=_0x2ef538[_0x49c4('0x2b')]['customer']||util['format'](_0x49c4('0xe5'),_0x49c4('0xe8'),_0x25d2a1[_0x49c4('0x70')]);switch(_0x4b0114[_0x49c4('0xe9')]){case _0x49c4('0xea'):_0x386595=_0x25d2a1[_0x49c4('0x3c')]?util['format']('%s%d',_0x4b0114[_0x49c4('0xe6')],_0x25d2a1[_0x49c4('0x3c')]):_0x49c4('0xe7');break;case _0x49c4('0xeb'):_0x386595=_0x25d2a1[_0x49c4('0x3c')]?_0x25d2a1[_0x49c4('0x75')][_0x49c4('0xec')]||_0x25d2a1['User']['fullname']:'System';break;case'agent_fullname':_0x386595=_0x25d2a1[_0x49c4('0x3c')]?_0x25d2a1['User'][_0x49c4('0xc0')]:_0x49c4('0xe7');break;default:_0x386595=_0x25d2a1[_0x49c4('0x3c')]?util['format']('%s%d',_0x4b0114[_0x49c4('0xe6')],_0x25d2a1[_0x49c4('0x3c')]):'System';}var _0x4323ec=util[_0x49c4('0xde')](_0x49c4('0xed'),moment(_0x25d2a1[_0x49c4('0xee')])[_0x49c4('0xde')](_0x49c4('0xef')),_0x25d2a1['direction']==='in'?_0x4f431e:_0x386595,_0x25d2a1[_0x49c4('0x2b')]);if(!_0x25d2a1[_0x49c4('0xf0')]){fs[_0x49c4('0xf1')](_0x261d61,_0x4323ec);}}return db['MailAccount'][_0x49c4('0xba')]({'where':{'service':!![]},'include':[{'model':db[_0x49c4('0xf2')],'as':_0x49c4('0xf3'),'raw':!![],'include':[{'model':db[_0x49c4('0xf4')],'as':_0x49c4('0xf4'),'raw':!![]}]}]});}}})[_0x49c4('0x14')](function(_0x82c4bf){if(!_0x82c4bf||!_0x82c4bf[_0x49c4('0xf3')]||!_0x2ef538['body'])return _0x1679ca;var _0x2fc500=_0x82c4bf[_0x49c4('0xf5')]();return respondWithRpcPromise(_0x49c4('0xf6'),_0x49c4('0xf7'),{'account':_0x2fc500,'message':{'from':util[_0x49c4('0xde')](_0x49c4('0xf8'),_0x82c4bf['name'],_0x82c4bf[_0x49c4('0xc1')]||_0x82c4bf[_0x49c4('0xf3')][_0x49c4('0x96')]),'to':_0x2ef538[_0x49c4('0x2b')][_0x49c4('0xdc')],'subject':_0x49c4('0xf9'),'text':util[_0x49c4('0xde')](_0x49c4('0xfa'),_0x2ef538[_0x49c4('0x2b')][_0x49c4('0xdc')]),'attachments':[{'path':_0x261d61}]}})[_0x49c4('0x14')](function(){return _0x1679ca;})[_0x49c4('0x1d')](function(_0x471e28){logger[_0x49c4('0x1a')](_0x471e28);});})['then'](respondWithStatusCode(_0x163128,0xc8))['catch'](handleError(_0x163128,null));};exports[_0x49c4('0xfb')]=function(_0x3b6fd2,_0x4c07b3){return db['ChatMessage'][_0x49c4('0x67')]({'where':{'id':_0x3b6fd2['params']['id']}})[_0x49c4('0x14')](handleEntityNotFound(_0x4c07b3,null))[_0x49c4('0x14')](function(_0x1ac2c0){if(_0x1ac2c0){return _0x1ac2c0[_0x49c4('0xfb')](_0x3b6fd2[_0x49c4('0x2b')][_0x49c4('0xfc')],_[_0x49c4('0xfd')](_0x3b6fd2[_0x49c4('0x2b')],['ids','id'])||{});}})[_0x49c4('0x14')](respondWithResult(_0x4c07b3,null))[_0x49c4('0x1d')](handleError(_0x4c07b3,null));};exports[_0x49c4('0xfe')]=function(_0xd2ee5e,_0x201909){var _0x5b2cc8={'raw':![],'where':{}};var _0x2bfa4f={};var _0x2b507f={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x49c4('0xba')]({'where':{'id':_0xd2ee5e[_0x49c4('0xb4')]['id']}})['then'](handleEntityNotFound(_0x201909,null))[_0x49c4('0x14')](function(_0x3119a5){if(_0x3119a5){_0x2bfa4f[_0x49c4('0x45')]=_['keys'](db[_0x49c4('0xc8')][_0x49c4('0x41')]);_0x2bfa4f[_0x49c4('0x47')]=_[_0x49c4('0x46')](_0xd2ee5e['query']);_0x2bfa4f[_0x49c4('0x48')]=_['intersection'](_0x2bfa4f[_0x49c4('0x45')],_0x2bfa4f[_0x49c4('0x47')]);_0x5b2cc8[_0x49c4('0x4a')]=_[_0x49c4('0x49')](_0x2bfa4f['model'],qs[_0x49c4('0x4b')](_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x4b')]));_0x5b2cc8[_0x49c4('0x4a')]=_0x5b2cc8[_0x49c4('0x4a')][_0x49c4('0x4c')]?_0x5b2cc8['attributes']:_0x2bfa4f['model'];if(!_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0xff')](_0x49c4('0x4d'))){_0x5b2cc8[_0x49c4('0x24')]=qs[_0x49c4('0x24')](_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x24')]);_0x5b2cc8[_0x49c4('0x21')]=qs[_0x49c4('0x21')](_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x21')]);}_0x5b2cc8[_0x49c4('0x4e')]=qs['sort'](_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x4f')]);_0x5b2cc8['where']=qs[_0x49c4('0x48')](_['pick'](_0xd2ee5e[_0x49c4('0x47')],_0x2bfa4f[_0x49c4('0x48')]));_0x5b2cc8['where'][_0x49c4('0xb0')]=_0x3119a5['id'];if(_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x8a')]){_0x5b2cc8[_0x49c4('0x50')]=_[_0x49c4('0x2a')](_0x5b2cc8['where'],{'$or':_[_0x49c4('0x30')](_0x5b2cc8['attributes'],function(_0x1c74ce){var _0x216896={};_0x216896[_0x1c74ce]={'$like':'%'+_0xd2ee5e[_0x49c4('0x47')]['filter']+'%'};return _0x216896;})});}if(_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x7f')]){var _0x37ec56=_0xd2ee5e['query']['$gte'][_0x49c4('0x32')](',');var _0x590586={};_0x590586[_0x37ec56[0x0]]={'$gte':moment(_0x37ec56[0x1])[_0x49c4('0xde')](_0x49c4('0x100'))};_0x5b2cc8[_0x49c4('0x50')]=_[_0x49c4('0x2a')](_0x5b2cc8['where'],_0x590586);}_0x5b2cc8=_['merge']({},_0x5b2cc8,_0xd2ee5e['options']);return db[_0x49c4('0xc8')][_0x49c4('0x23')]({'where':_0x5b2cc8[_0x49c4('0x50')]})[_0x49c4('0x14')](function(_0x5255f7){_0x2b507f[_0x49c4('0x23')]=_0x5255f7;if(_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0xb5')]){_0x5b2cc8[_0x49c4('0xb6')]=[{'all':!![]}];}return db[_0x49c4('0xc8')][_0x49c4('0x101')](_0x5b2cc8);})[_0x49c4('0x14')](function(_0x1d2931){_0x2b507f[_0x49c4('0xb2')]=_0x1d2931;return _0x2b507f;});}})[_0x49c4('0x14')](respondWithFilteredResult(_0x201909,_0x5b2cc8))[_0x49c4('0x1d')](handleError(_0x201909,null));};exports['getMyMessages']=function(_0x16e808,_0x514446){var _0x3308c4={'where':{}},_0x3683d7={},_0x4feb6f={'count':0x0,'rows':[]};return db[_0x49c4('0x40')]['findOne']({'where':{'id':_0x16e808[_0x49c4('0xb4')]['id']}})['then'](handleEntityNotFound(_0x514446,null))['then'](function(_0x577ae6){if(_0x577ae6){_0x3683d7[_0x49c4('0x45')]=_[_0x49c4('0x46')](db[_0x49c4('0xc8')]['rawAttributes']);_0x3683d7[_0x49c4('0x47')]=_['keys'](_0x16e808[_0x49c4('0x47')]);_0x3683d7[_0x49c4('0x48')]=_[_0x49c4('0x49')](_0x3683d7['model'],_0x3683d7[_0x49c4('0x47')]);_0x3308c4[_0x49c4('0x4a')]=_[_0x49c4('0x49')](_0x3683d7[_0x49c4('0x45')],qs[_0x49c4('0x4b')](_0x16e808['query'][_0x49c4('0x4b')]));_0x3308c4[_0x49c4('0x4a')]=_0x3308c4[_0x49c4('0x4a')][_0x49c4('0x4c')]?_0x3308c4['attributes']:_0x3683d7['model'];if(!_0x16e808[_0x49c4('0x47')][_0x49c4('0xff')]('nolimit')){_0x3308c4[_0x49c4('0x24')]=qs[_0x49c4('0x24')](_0x16e808[_0x49c4('0x47')][_0x49c4('0x24')]);_0x3308c4['offset']=qs[_0x49c4('0x21')](_0x16e808[_0x49c4('0x47')]['offset']);}_0x3308c4['order']=qs[_0x49c4('0x4f')](_0x16e808[_0x49c4('0x47')][_0x49c4('0x4f')]);_0x3308c4[_0x49c4('0x50')]=qs[_0x49c4('0x48')](_['pick'](_0x16e808[_0x49c4('0x47')],_0x3683d7['filters']));_0x3308c4[_0x49c4('0x50')][_0x49c4('0xb0')]=_0x577ae6['id'];if(_0x16e808[_0x49c4('0x47')][_0x49c4('0x8a')]){_0x3308c4['where']=_['merge'](_0x3308c4['where'],{'$or':_[_0x49c4('0x30')](_0x3308c4[_0x49c4('0x4a')],function(_0x14d5ca){var _0x2cb936={};_0x2cb936[_0x14d5ca]={'$like':'%'+_0x16e808['query']['filter']+'%'};return _0x2cb936;})});}_0x3308c4[_0x49c4('0x50')]['secret']=![];if(_0x16e808[_0x49c4('0x47')]['id']){_0x3308c4[_0x49c4('0x50')]['id']={'$gt':_0x16e808['query']['id']};}_0x3308c4=_[_0x49c4('0x2a')]({},_0x3308c4,_0x16e808[_0x49c4('0x102')]);return db[_0x49c4('0xc8')]['count']({'where':_0x3308c4[_0x49c4('0x50')]})[_0x49c4('0x14')](function(_0x1a5755){_0x4feb6f['count']=_0x1a5755;_0x3308c4[_0x49c4('0xb6')]=[];if(_0x16e808[_0x49c4('0x47')]['includeAgent']){_0x3308c4[_0x49c4('0xb6')][_0x49c4('0x35')]({'model':db['User'],'as':_0x49c4('0x75'),'attributes':['id',_0x49c4('0xc0'),_0x49c4('0xec')]});}if(_0x16e808[_0x49c4('0x47')][_0x49c4('0xb5')]){_0x3308c4['include']=[{'all':!![]}];}return db[_0x49c4('0xc8')][_0x49c4('0x101')](_0x3308c4);})['then'](function(_0x5a4b35){_0x4feb6f[_0x49c4('0xb2')]=_0x5a4b35;return _0x4feb6f;});}})[_0x49c4('0x14')](respondWithFilteredResult(_0x514446,_0x3308c4))['catch'](handleError(_0x514446,null));};exports[_0x49c4('0x103')]=function(_0x55bb71,_0x4059b0){return db[_0x49c4('0x40')]['find']({'where':{'id':_0x55bb71[_0x49c4('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4059b0,null))[_0x49c4('0x14')](function(_0x17ab2c){if(_0x17ab2c){return _0x17ab2c['setTags'](_0x55bb71[_0x49c4('0x2b')][_0x49c4('0xfc')],_['omit'](_0x55bb71['body'],[_0x49c4('0xfc'),'id'])||{})[_0x49c4('0x104')](function(){return db[_0x49c4('0x72')][_0x49c4('0x101')]({'attributes':['id',_0x49c4('0x28'),'color'],'where':{'id':_0x55bb71[_0x49c4('0x2b')][_0x49c4('0xfc')]}});})[_0x49c4('0x14')](function(_0xd62ca){socket[_0x49c4('0x105')]('chatInteractionTags:save',{'id':Number(_0x55bb71[_0x49c4('0xb4')]['id']),'tags':_0xd62ca||[]});return{'id':Number(_0x55bb71[_0x49c4('0xb4')]['id']),'tags':_0xd62ca||[]};});}})[_0x49c4('0x14')](respondWithResult(_0x4059b0,null))[_0x49c4('0x1d')](handleError(_0x4059b0,null));};exports[_0x49c4('0x106')]=function(_0x39abbf,_0x3de5d8){return db[_0x49c4('0x40')]['find']({'where':{'id':_0x39abbf[_0x49c4('0xb4')]['id']}})[_0x49c4('0x14')](handleEntityNotFound(_0x3de5d8,null))[_0x49c4('0x14')](function(_0x5a4b4c){if(_0x5a4b4c){return _0x5a4b4c['removeTags'](_0x39abbf[_0x49c4('0x47')]['ids']);}})[_0x49c4('0x14')](respondWithStatusCode(_0x3de5d8,null))[_0x49c4('0x1d')](handleError(_0x3de5d8,null));};exports[_0x49c4('0xda')]=function(_0x3f0e74,_0x55f423){var _0x3ce0f9=moment()[_0x49c4('0x107')]()[_0x49c4('0x9c')]();var _0x156a4f=path['join'](config[_0x49c4('0xd7')],_0x49c4('0x108'),'files',_0x49c4('0x109'));var _0x22005f=path[_0x49c4('0xd6')](config[_0x49c4('0xd7')],_0x49c4('0x108'),_0x49c4('0x10a'),_0x49c4('0x10b'));var _0x1d3b1a=path['join'](_0x156a4f,_0x3ce0f9);var _0x4eb6ba=util['format'](_0x49c4('0x10c'),_0x3f0e74[_0x49c4('0xb4')]['id'],_0x3ce0f9);var _0x418ead=path[_0x49c4('0xd6')](_0x156a4f,_0x4eb6ba);var _0x39ff8b=[];_0x39ff8b['push']({'model':db[_0x49c4('0x75')],'as':_0x49c4('0x75'),'attributes':['id',_0x49c4('0xc0')],'raw':!![]});_0x39ff8b[_0x49c4('0x35')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x49c4('0x10d'),_0x49c4('0x10e')],'raw':!![]});if(_0x3f0e74[_0x49c4('0x47')][_0x49c4('0x10b')]){_0x39ff8b[_0x49c4('0x35')]({'model':db[_0x49c4('0xd2')],'as':'Attachment','raw':!![]});}var _0x58a5c9=[{'model':db[_0x49c4('0xc8')],'as':_0x49c4('0xe2'),'attributes':['id',_0x49c4('0x2b'),_0x49c4('0xee'),_0x49c4('0x10f'),'secret',_0x49c4('0x86')],'include':_0x39ff8b}];_0x58a5c9[_0x49c4('0x35')]({'model':db[_0x49c4('0xe3')],'as':_0x49c4('0x110'),'attributes':['id',_0x49c4('0x28')]});_0x58a5c9[_0x49c4('0x35')]({'model':db[_0x49c4('0x75')],'as':_0x49c4('0x111'),'attributes':['id',_0x49c4('0xc0')]});return db['ChatInteraction'][_0x49c4('0x67')]({'where':{'id':_0x3f0e74[_0x49c4('0xb4')]['id']},'include':_0x58a5c9})[_0x49c4('0x14')](handleEntityNotFound(_0x55f423,null))[_0x49c4('0x14')](function(_0xe5bb64){if(_0xe5bb64){var _0x5e5ca3=_0xe5bb64[_0x49c4('0x112')]({'plain':!![]});fs[_0x49c4('0x113')](_0x1d3b1a);var _0x485c2d={'channel':_0x49c4('0x114'),'account':_0x5e5ca3['Account'][_0x49c4('0x28')],'agent':_0x5e5ca3['Owner']?_0x5e5ca3[_0x49c4('0x111')][_0x49c4('0xc0')]:'N.A.','createdAt':moment(_0x5e5ca3[_0x49c4('0xee')])['format'](_0x49c4('0x100'))[_0x49c4('0x9c')](),'closedAt':_0x5e5ca3[_0x49c4('0x3d')]?moment(_0x5e5ca3[_0x49c4('0x115')])[_0x49c4('0xde')]('YYYY-MM-DD\x20HH:mm:ss')[_0x49c4('0x9c')]():'','disposition':_0x5e5ca3[_0x49c4('0x3e')],'chatInfo':{'browser':_0x5e5ca3[_0x49c4('0x116')],'os':_0x5e5ca3[_0x49c4('0x117')],'referer':_0x5e5ca3[_0x49c4('0x118')],'customerIp':_0x5e5ca3[_0x49c4('0x119')],'customerPort':_0x5e5ca3[_0x49c4('0x11a')]?_0x5e5ca3[_0x49c4('0x11a')]:'N.A.'},'messages':_(_0x5e5ca3[_0x49c4('0xe2')])[_0x49c4('0x11b')]()[_0x49c4('0x8a')]({'secret':![]})[_0x49c4('0x30')](function(_0x341528){if(_0x341528[_0x49c4('0xd2')]){var _0x2a0ef8=path[_0x49c4('0xd6')](_0x22005f,_0x341528[_0x49c4('0xd2')][_0x49c4('0xd0')]);if(fs[_0x49c4('0x11c')](_0x2a0ef8)){fs[_0x49c4('0x11d')](_0x2a0ef8)['pipe'](fs[_0x49c4('0x11e')](path['join'](_0x1d3b1a,_0x341528[_0x49c4('0xd2')][_0x49c4('0xd0')])));}}return{'date':moment(_0x341528[_0x49c4('0xee')])[_0x49c4('0xde')](_0x49c4('0x100'))[_0x49c4('0x9c')](),'sender':_0x341528[_0x49c4('0x10f')]===_0x49c4('0xc7')?_0x341528[_0x49c4('0x75')]?_0x341528[_0x49c4('0x75')][_0x49c4('0xc0')]:_0x49c4('0xe7'):_0x341528[_0x49c4('0x6c')][_0x49c4('0x10d')]+(_0x341528[_0x49c4('0x6c')]['lastName']?'\x20'+_0x341528[_0x49c4('0x6c')][_0x49c4('0x10e')]:''),'body':_0x341528['Attachment']?_0x341528[_0x49c4('0xd2')]['basename']:_0x341528[_0x49c4('0x2b')],'direction':_0x341528[_0x49c4('0x10f')]===_0x49c4('0xc7')?'A':'C','secret':_0x341528[_0x49c4('0xf0')],'read':_0x341528[_0x49c4('0x86')],'attachment':_0x341528['Attachment']};})['value']()};return ejs[_0x49c4('0x11f')](path[_0x49c4('0xd6')](config[_0x49c4('0xd7')],'server',_0x49c4('0x120'),_0x49c4('0x121')),{'interaction':_0x485c2d})['then'](function(_0x6a1d66){var _0x563f95=path['join'](_0x1d3b1a,'transcript-'+_0x5e5ca3['id']+'-'+_0x3ce0f9+_0x49c4('0x122'));var _0x442210={'path':_0x563f95,'channel':_0x49c4('0x114'),'interactionId':_0x5e5ca3['id']};return pdf[_0x49c4('0x123')](_0x6a1d66,_0x442210);})[_0x49c4('0x14')](function(){return new Promise(function(_0x547d37,_0x223fa2){zipdir(_0x1d3b1a,{'saveTo':_0x418ead},function(_0x147d5e,_0x29674d){if(_0x147d5e)return _0x223fa2(_0x147d5e);return _0x547d37(_0x29674d);});})['then'](function(){return new BPromise(function(_0x17b015,_0x724d15){rimraf(_0x1d3b1a,function(_0x3350da){if(_0x3350da)_0x724d15(_0x3350da);return _0x17b015();});});})[_0x49c4('0x14')](function(){return _0x55f423[_0x49c4('0xda')](_0x418ead,_0x4eb6ba,function(_0x146c6e){if(_0x146c6e){logger[_0x49c4('0x1a')](_0x49c4('0x124'),_0x146c6e);}else{fs[_0x49c4('0x125')](_0x418ead);}});});});}else{return _0x55f423[_0x49c4('0x126')](0xc8);}})[_0x49c4('0x1d')](handleError(_0x55f423,null));}; \ No newline at end of file +var _0x9a19=['request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','sendStatus','end','status','json','limit','undefined','count','offset','set','update','destroy','stack','name','send','render','merge','body','contact','agent','Users','map','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','abandoned','total','closed','UserId','disposition','unmanaged','index','ChatInteraction','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','buildExpression','start','some','compact','isEmpty','ChatWebsiteId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','sequelize','toString','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','groupBy','ChatInteractionId','all','rows','params','includeAll','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','ValidationError','Sequelize','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','AbandonInteraction','attachmentUpload','originalname','basename','file','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','Messages','agentAlias','System','customer','%s%d','Visitor','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','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','omit','getMessages','rawAttributes','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','getMyMessages','secret','includeAgent','alias','addTags','setTags','Tag','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','get','mkdirSync','Chat','Owner','closedAt','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http'];(function(_0x5245ab,_0x160e47){var _0x5b7ee1=function(_0x1edc0){while(--_0x1edc0){_0x5245ab['push'](_0x5245ab['shift']());}};_0x5b7ee1(++_0x160e47);}(_0x9a19,0x114));var _0x99a1=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x9a19[_0x450689];return _0x46ffb0;};'use strict';var rimraf=require(_0x99a1('0x0'));var zipdir=require(_0x99a1('0x1'));var rp=require(_0x99a1('0x2'));var moment=require('moment');var BPromise=require(_0x99a1('0x3'));var Mustache=require(_0x99a1('0x4'));var util=require(_0x99a1('0x5'));var path=require(_0x99a1('0x6'));var ejs=require(_0x99a1('0x7'));var fs=require('fs');var _=require(_0x99a1('0x8'));var squel=require(_0x99a1('0x9'));var Redis=require(_0x99a1('0xa'));var qs=require(_0x99a1('0xb'));var as=require(_0x99a1('0xc'));var pdf=require(_0x99a1('0xd'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x99a1('0xe'))['db'];config[_0x99a1('0xf')]=_['defaults'](config['redis'],{'host':_0x99a1('0x10'),'port':0x18eb});var socket=require(_0x99a1('0x11'))(new Redis(config[_0x99a1('0xf')]));require(_0x99a1('0x12'))[_0x99a1('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0x99a1('0x14')][_0x99a1('0x15')]({'port':0x232b});var client9004=jayson[_0x99a1('0x14')][_0x99a1('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x2c68dd,_0x1bc7aa,_0x2ff655,_0x532f56){return new BPromise(function(_0xf713b9,_0x40c19c){var _0x3a865c=_0x532f56||client;return _0x3a865c[_0x99a1('0x16')](_0x2c68dd,_0x2ff655)[_0x99a1('0x17')](function(_0x3c9ef4){logger[_0x99a1('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x1bc7aa,_0x99a1('0x19'));logger[_0x99a1('0x1a')](_0x99a1('0x1b'),_0x1bc7aa,_0x99a1('0x19'),JSON[_0x99a1('0x1c')](_0x3c9ef4));if(_0x3c9ef4[_0x99a1('0x1d')]){if(_0x3c9ef4[_0x99a1('0x1d')]['code']===0x1f4){logger['error'](_0x99a1('0x1e'),_0x1bc7aa,_0x3c9ef4[_0x99a1('0x1d')][_0x99a1('0x1f')]);return _0x40c19c(_0x3c9ef4[_0x99a1('0x1d')][_0x99a1('0x1f')]);}logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x1bc7aa,_0x3c9ef4[_0x99a1('0x1d')][_0x99a1('0x1f')]);return _0xf713b9(_0x3c9ef4[_0x99a1('0x1d')][_0x99a1('0x1f')]);}else{logger['info'](_0x99a1('0x1e'),_0x1bc7aa,_0x99a1('0x19'));_0xf713b9(_0x3c9ef4['result'][_0x99a1('0x1f')]);}})['catch'](function(_0x458ed3){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x1bc7aa,_0x458ed3);_0x40c19c(_0x458ed3);});});}function respondWithStatusCode(_0x2d3b82,_0x5a88c6){_0x5a88c6=_0x5a88c6||0xcc;return function(_0x3eab51){if(_0x3eab51){return _0x2d3b82[_0x99a1('0x20')](_0x5a88c6);}return _0x2d3b82['status'](_0x5a88c6)[_0x99a1('0x21')]();};}function respondWithResult(_0x5b5dfa,_0x1f9800){_0x1f9800=_0x1f9800||0xc8;return function(_0x1e5cc6){if(_0x1e5cc6){return _0x5b5dfa[_0x99a1('0x22')](_0x1f9800)[_0x99a1('0x23')](_0x1e5cc6);}};}function respondWithFilteredResult(_0x3c813,_0x491341){return function(_0x4fe7f7){if(_0x4fe7f7){var _0x114b38=typeof _0x491341['offset']==='undefined'&&typeof _0x491341[_0x99a1('0x24')]===_0x99a1('0x25');var _0xa6799b=_0x4fe7f7[_0x99a1('0x26')];var _0x25d560=_0x114b38?0x0:_0x491341[_0x99a1('0x27')];var _0x183037=_0x114b38?_0x4fe7f7['count']:_0x491341[_0x99a1('0x27')]+_0x491341['limit'];var _0x255197;if(_0x183037>=_0xa6799b){_0x183037=_0xa6799b;_0x255197=0xc8;}else{_0x255197=0xce;}_0x3c813[_0x99a1('0x22')](_0x255197);return _0x3c813[_0x99a1('0x28')]('Content-Range',_0x25d560+'-'+_0x183037+'/'+_0xa6799b)[_0x99a1('0x23')](_0x4fe7f7);}return null;};}function saveUpdates(_0x2ab46b){return function(_0x5718b9){if(_0x5718b9){return _0x5718b9[_0x99a1('0x29')](_0x2ab46b)[_0x99a1('0x17')](function(_0x36aa34){return _0x36aa34;});}return null;};}function removeEntity(_0x303d1e){return function(_0x2a5b8c){if(_0x2a5b8c){return _0x2a5b8c[_0x99a1('0x2a')]()[_0x99a1('0x17')](function(){_0x303d1e[_0x99a1('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4960e4){return function(_0x3fa342){if(!_0x3fa342){_0x4960e4['sendStatus'](0x194);}return _0x3fa342;};}function handleError(_0x38e383,_0x400581){_0x400581=_0x400581||0x1f4;return function(_0x5b1a79){logger[_0x99a1('0x1d')](_0x5b1a79[_0x99a1('0x2b')]);if(_0x5b1a79[_0x99a1('0x2c')]){delete _0x5b1a79[_0x99a1('0x2c')];}_0x38e383[_0x99a1('0x22')](_0x400581)[_0x99a1('0x2d')](_0x5b1a79);};}function getMustacheRender(_0x3081cd,_0x38bb91){return Mustache[_0x99a1('0x2e')](_0x3081cd,_[_0x99a1('0x2f')](_0x38bb91[_0x99a1('0x30')],{'contact':_0x38bb91[_0x99a1('0x31')],'message':_0x38bb91[_0x99a1('0x1f')],'agent':_0x38bb91[_0x99a1('0x32')],'interaction':_0x38bb91['interaction'],'account':_0x38bb91['account']}))||'';}function getInteractionUsers(_0x46e3f2,_0x5424eb){return new BPromise(function(_0x416a36,_0x4131e0){try{if(_0x5424eb[_0x46e3f2['id']]){_0x46e3f2[_0x99a1('0x33')]=_[_0x99a1('0x34')](_0x5424eb[_0x46e3f2['id']],function(_0x318dab){return{'id':_0x318dab['id'],'fullname':_0x318dab['fullname']};});}}catch(_0x355f9d){_0x4131e0(_0x355f9d);}_0x416a36(_0x46e3f2);});}function getInteractionTags(_0x506613,_0x551d85){return new BPromise(function(_0x26ce0e,_0x2d328c){try{if(_0x506613[_0x99a1('0x35')]){_0x506613[_0x99a1('0x36')]=[];_0x506613[_0x99a1('0x35')][_0x99a1('0x37')](',')[_0x99a1('0x38')](function(_0x2f8135){_0x506613[_0x99a1('0x36')][_0x99a1('0x39')](_0x551d85[_0x2f8135]);});}delete _0x506613[_0x99a1('0x35')];}catch(_0x152969){_0x2d328c(_0x152969);}_0x26ce0e(_0x506613);});}function updateChatInteraction(_0x1f224c,_0x5018e9,_0x5553e4){return new BPromise(function(_0x485969,_0x29e884){return getInteractionUsers(_0x1f224c,_0x5553e4)[_0x99a1('0x17')](function(_0x1d3f85){return getInteractionTags(_0x1d3f85,_0x5018e9);})[_0x99a1('0x17')](function(_0x40613a){return getStateInteraction(_0x40613a);})['then'](function(_0x157d0c){_0x485969(_0x157d0c);})[_0x99a1('0x3a')](function(_0x32ee4c){_0x29e884(_0x32ee4c);});});}function getStateInteraction(_0x51efe5){return new BPromise(function(_0x49be37){_0x51efe5[_0x99a1('0x3b')]=0x0;_0x51efe5[_0x99a1('0x3c')]=0x0;_0x51efe5[_0x99a1('0x3d')]=0x0;_0x51efe5['unmanaged']=0x0;_0x51efe5[_0x99a1('0x3e')]=0x0;_0x51efe5[_0x99a1('0x3f')]=0x0;if(!_0x51efe5[_0x99a1('0x40')]&&!_0x51efe5[_0x99a1('0x41')]){_0x51efe5[_0x99a1('0x3b')]+=0x1;}if(!_0x51efe5[_0x99a1('0x40')]&&_0x51efe5[_0x99a1('0x41')]){_0x51efe5[_0x99a1('0x3c')]+=0x1;if(_0x51efe5[_0x99a1('0x3b')]){_0x51efe5[_0x99a1('0x3b')]-=0x1;}}if(_0x51efe5['closed']&&_0x51efe5[_0x99a1('0x42')]===_0x99a1('0x3e')){_0x51efe5[_0x99a1('0x3e')]+=0x1;if(_0x51efe5['waiting']){_0x51efe5[_0x99a1('0x3b')]-=0x1;}}else if(_0x51efe5['closed']&&!_0x51efe5[_0x99a1('0x41')]&&_0x51efe5[_0x99a1('0x42')]){_0x51efe5[_0x99a1('0x43')]+=0x1;if(_0x51efe5[_0x99a1('0x3b')]){_0x51efe5[_0x99a1('0x3b')]-=0x1;}}else if(_0x51efe5[_0x99a1('0x40')]&&_0x51efe5['UserId']){_0x51efe5[_0x99a1('0x3d')]+=0x1;if(_0x51efe5['talking']){_0x51efe5[_0x99a1('0x3c')]-=0x1;}}_0x51efe5[_0x99a1('0x3f')]+=0x1;_0x49be37(_0x51efe5);});}exports[_0x99a1('0x44')]=function(_0x278e22,_0x3a0b44){var _0x67992={},_0x31db25={},_0x3861b6={'count':0x0,'rows':[]};var _0x61c259=_[_0x99a1('0x34')](db[_0x99a1('0x45')]['rawAttributes'],function(_0x3c1f55){return{'name':_0x3c1f55[_0x99a1('0x46')],'type':_0x3c1f55['type'][_0x99a1('0x47')]};});_0x31db25[_0x99a1('0x48')]=_[_0x99a1('0x34')](_0x61c259,_0x99a1('0x2c'));_0x31db25[_0x99a1('0x49')]=_[_0x99a1('0x4a')](_0x278e22[_0x99a1('0x49')]);_0x31db25['filters']=_[_0x99a1('0x4b')](_0x31db25['model'],_0x31db25[_0x99a1('0x49')]);_0x67992[_0x99a1('0x4c')]=_['intersection'](_0x31db25['model'],qs[_0x99a1('0x4d')](_0x278e22[_0x99a1('0x49')][_0x99a1('0x4d')]));_0x67992[_0x99a1('0x4c')]=_0x67992[_0x99a1('0x4c')]['length']?_0x67992['attributes']:_0x31db25['model'];if(!_0x278e22[_0x99a1('0x49')][_0x99a1('0x4e')](_0x99a1('0x4f'))){_0x67992[_0x99a1('0x24')]=qs[_0x99a1('0x24')](_0x278e22[_0x99a1('0x49')][_0x99a1('0x24')]);_0x67992['offset']=qs[_0x99a1('0x27')](_0x278e22[_0x99a1('0x49')][_0x99a1('0x27')]);}_0x67992['order']=qs[_0x99a1('0x50')](_0x278e22['query']['sort']);_0x67992[_0x99a1('0x51')]=qs[_0x99a1('0x52')](_[_0x99a1('0x53')](_0x278e22[_0x99a1('0x49')],_0x31db25[_0x99a1('0x52')]),_0x61c259);var _0xf8208a=[];var _0x240d2e=squel[_0x99a1('0x54')]()[_0x99a1('0x55')]('id')['field'](_0x99a1('0x2c'))['field'](_0x99a1('0x56'))[_0x99a1('0x57')]('tools_tags');var _0x2cc320=squel[_0x99a1('0x54')]()[_0x99a1('0x55')](_0x99a1('0x58'))[_0x99a1('0x55')](_0x99a1('0x59'))[_0x99a1('0x55')](_0x99a1('0x5a'))[_0x99a1('0x57')](_0x99a1('0x5b'),'ui')[_0x99a1('0x5c')](_0x99a1('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x4f64b7=squel[_0x99a1('0x54')]()[_0x99a1('0x57')](_0x99a1('0x5e'),'i')[_0x99a1('0x5c')](_0x99a1('0x5f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x99a1('0x5c')](_0x99a1('0x5d'),'o','o.id\x20=\x20i.UserId')[_0x99a1('0x5c')](_0x99a1('0x60'),'a',_0x99a1('0x61'))[_0x99a1('0x5c')](_0x99a1('0x62'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x99a1('0x5c')](_0x99a1('0x63'),'it',_0x99a1('0x64'))[_0x99a1('0x5c')](_0x99a1('0x65'),'t',_0x99a1('0x66'));var _0x59260e=squel[_0x99a1('0x67')]();var _0x1e65fa=[];var _0x5d67c1=squel[_0x99a1('0x67')]();var _0x2b228e;if(_0x278e22[_0x99a1('0x49')][_0x99a1('0x68')]){_0x2b228e=as[_0x99a1('0x69')](_0x278e22['query'][_0x99a1('0x68')]);var _0x5d250a=_0x2b228e['sqlOperator'];for(var _0x5cbf98=0x0;_0x5cbf98<_0x2b228e[_0x99a1('0x6a')][_0x99a1('0x6b')];_0x5cbf98++){var _0x548952=_0x2b228e['conditions'][_0x5cbf98];var _0x2c605f='i';var _0x49f8fa=_[_0x99a1('0x6c')](_0x61c259,[_0x99a1('0x2c'),_0x548952[_0x99a1('0x55')]]);if(!_0x49f8fa){switch(_0x548952[_0x99a1('0x55')]){case'unreadMessages':if(_0x548952[_0x99a1('0x6d')]==0x1){_0x4f64b7[_0x99a1('0x6e')]('`'+_0x548952[_0x99a1('0x55')]+'`\x20=\x200');}else{_0x4f64b7[_0x99a1('0x6e')]('`'+_0x548952['field']+_0x99a1('0x6f'));}break;case _0x99a1('0x70'):if(_0x548952[_0x99a1('0x71')]===_0x99a1('0x72')){if(_0x548952[_0x99a1('0x6d')]['split']('\x20')['length']>0x1){_0x59260e[_0x5d250a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x99a1('0x73')](_0x548952[_0x99a1('0x6d')]),null);}else{var _0x4ad713='%'+_0x548952['value']+'%';_0x59260e[_0x5d250a](_0x99a1('0x74'),_0x4ad713,_0x4ad713,_0x4ad713);}}else{_0x49f8fa=_[_0x99a1('0x6c')](_0x61c259,[_0x99a1('0x2c'),'ContactId']);_0x548952['field']=_0x99a1('0x75');_0x19e306=as['buildExpression'](_0x2c605f,_0x49f8fa[_0x99a1('0x76')],_0x548952);_0x59260e[_0x5d250a](_0x19e306[_0x99a1('0x77')],_0x19e306[_0x99a1('0x6d')]['start'],_0x19e306[_0x99a1('0x6d')][_0x99a1('0x21')]);}break;case'Tag':var _0x4c14ed=_0x548952[_0x99a1('0x6d')]['split'](',')[_0x99a1('0x34')](function(_0x3a5f6a){return Number(_0x3a5f6a);});_0x4c14ed[_0x99a1('0x38')](function(_0x57817e){_0x5d67c1['or'](_0x99a1('0x78'),'%,'+_0x57817e+',%');});_0x1e65fa=_[_0x99a1('0x79')](_0x1e65fa,_0x4c14ed);break;case _0x99a1('0x7a'):if(_0x548952[_0x99a1('0x71')]===_0x99a1('0x72')){_0x59260e[_0x5d250a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x548952['value']+'%',null);}else{_0x49f8fa=_[_0x99a1('0x6c')](_0x61c259,[_0x99a1('0x2c'),_0x99a1('0x41')]);_0x548952[_0x99a1('0x55')]='UserId';_0x19e306=as[_0x99a1('0x7b')](_0x2c605f,_0x49f8fa['type'],_0x548952);_0x59260e[_0x5d250a](_0x19e306['text'],_0x19e306[_0x99a1('0x6d')][_0x99a1('0x7c')],_0x19e306[_0x99a1('0x6d')]['end']);}break;case _0x99a1('0x30'):_0x19e306=as[_0x99a1('0x7b')]('me',null,_0x548952);_0x59260e[_0x5d250a](_0x19e306[_0x99a1('0x77')],_0x19e306[_0x99a1('0x6d')][_0x99a1('0x7c')],_0x19e306['value'][_0x99a1('0x21')]);break;}}else{var _0x19e306=as[_0x99a1('0x7b')](_0x2c605f,_0x49f8fa[_0x99a1('0x76')],_0x548952);_0x59260e[_0x5d250a](_0x19e306[_0x99a1('0x77')],_0x19e306[_0x99a1('0x6d')]['start'],_0x19e306[_0x99a1('0x6d')][_0x99a1('0x21')]);}}}else{var _0x2421bc=_(_0x278e22[_0x99a1('0x49')])[_0x99a1('0x4a')]()['map'](function(_0x18843d){return _[_0x99a1('0x7d')](_0x61c259,[_0x99a1('0x2c'),_0x18843d])?_0x18843d:undefined;})[_0x99a1('0x7e')]()[_0x99a1('0x6d')]();if(!_[_0x99a1('0x7f')](_0x2421bc)){_0x2421bc['forEach'](function(_0xaa953e){if(_0xaa953e===_0x99a1('0x80')){_0x4f64b7['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x99a1('0x81')](_0x278e22[_0x99a1('0x49')][_0xaa953e]));}else if(_0xaa953e==='createdAt'){var _0x2f2b17=JSON[_0x99a1('0x82')](_0x278e22[_0x99a1('0x49')][_0xaa953e])[_0x99a1('0x83')];var _0x43156f=JSON[_0x99a1('0x82')](_0x278e22[_0x99a1('0x49')][_0xaa953e])[_0x99a1('0x84')];_0x4f64b7[_0x99a1('0x51')](_0x99a1('0x85'),_0x2f2b17,_0x43156f);}else{if(_0x278e22[_0x99a1('0x49')][_0xaa953e]===_0x99a1('0x86')){_0x4f64b7[_0x99a1('0x51')]('i.'+_0xaa953e+'\x20IS\x20NULL');}else{_0x4f64b7[_0x99a1('0x51')]('i.'+_0xaa953e+'\x20=\x20?',_0x278e22['query'][_0xaa953e]);}}});}if(_0x278e22[_0x99a1('0x49')][_0x99a1('0x87')]){if(_0x278e22[_0x99a1('0x49')][_0x99a1('0x87')]==0x1){_0x4f64b7[_0x99a1('0x6e')](_0x99a1('0x88'));}else{_0x4f64b7[_0x99a1('0x6e')](_0x99a1('0x89'));}}if(_0x278e22[_0x99a1('0x49')]['tag']){_0x1e65fa=_[_0x99a1('0x8a')](_0x278e22[_0x99a1('0x49')][_0x99a1('0x8b')])?_0x278e22[_0x99a1('0x49')][_0x99a1('0x8b')]:new Array(_0x278e22[_0x99a1('0x49')][_0x99a1('0x8b')]);_0x1e65fa[_0x99a1('0x38')](function(_0x4f9ed2){_0x5d67c1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f9ed2+',%');});}if(_0x278e22['query'][_0x99a1('0x8c')]){var _0x353f25=_0x278e22['query'][_0x99a1('0x8c')][_0x99a1('0x8d')]('\x5c','\x5c\x5c')[_0x99a1('0x8d')](/'/g,'\x27\x27');if(qs[_0x99a1('0x8e')](_0x353f25)){_0x59260e['or']('i.id\x20LIKE\x20?',_0x353f25+'%');}else{_0x59260e['or'](_0x99a1('0x8f'),qs[_0x99a1('0x73')](_0x353f25))['or'](_0x99a1('0x90'),_0x353f25+'%');}}}_0x4f64b7[_0x99a1('0x51')](_0x59260e);_0x4f64b7['group'](_0x99a1('0x91'));var _0x4e80d9={'type':db['Sequelize']['QueryTypes'][_0x99a1('0x92')],'raw':!![]};var _0x47e2fd=_0x4f64b7[_0x99a1('0x93')]();_0x47e2fd[_0x99a1('0x55')](_0x99a1('0x91'));_0x47e2fd[_0x99a1('0x55')](_0x99a1('0x94'),_0x99a1('0x95'));if(_0x67992[_0x99a1('0x96')]){_0x67992['order']['forEach'](function(_0x42e229){var _0x14cd7d=_0x42e229[0x0]===_0x99a1('0x97')?_0x42e229[0x0]:'i.'+_0x42e229[0x0];_0x4f64b7['order'](_0x14cd7d,_0x42e229[0x1]===_0x99a1('0x98')?![]:!![]);});}if(!_[_0x99a1('0x7f')](_0x1e65fa)){_0x4f64b7[_0x99a1('0x6e')](_0x5d67c1);_0x47e2fd['where'](_0x99a1('0x99'),_0x1e65fa);}BPromise[_0x99a1('0x9a')]()[_0x99a1('0x17')](function(){if(!_0x2b228e){if(_0x278e22['query']['ChatWebsiteId'])return;_0x47e2fd[_0x99a1('0x51')](_0x99a1('0x9b'));_0x4f64b7[_0x99a1('0x51')](_0x99a1('0x9b'));return;}if(_0x278e22[_0x99a1('0x9c')]['role']!==_0x99a1('0x32'))return;return _0x278e22['user'][_0x99a1('0x9d')]({'attributes':['id'],'raw':!![]})[_0x99a1('0x17')](function(_0x5b7cdf){if(_[_0x99a1('0x7f')](_0x5b7cdf)){_0x47e2fd[_0x99a1('0x51')](_0x99a1('0x9e'));_0x4f64b7['where'](_0x99a1('0x9e'));}else{_0x47e2fd[_0x99a1('0x51')](_0x99a1('0x9f'),_[_0x99a1('0x34')](_0x5b7cdf,'id'));_0x4f64b7[_0x99a1('0x51')]('i.ChatWebsiteId\x20IN\x20?',_[_0x99a1('0x34')](_0x5b7cdf,'id'));}});})['then'](function(){if(_0x278e22[_0x99a1('0x9c')][_0x99a1('0xa0')]==='agent'&&!_0x2b228e&&!_0x278e22[_0x99a1('0x49')]['ChatWebsiteId'])return[];return db[_0x99a1('0xa1')][_0x99a1('0x49')](_0x47e2fd[_0x99a1('0xa2')](),_0x4e80d9);})[_0x99a1('0x17')](function(_0x188b9e){_0x3861b6[_0x99a1('0x26')]=_0x188b9e['length'];if(_0x3861b6[_0x99a1('0x26')]===0x0)return[];return db[_0x99a1('0xa1')]['query'](_0x240d2e[_0x99a1('0xa2')](),_0x4e80d9)[_0x99a1('0x17')](function(_0x1d905e){_0xf8208a=_['keyBy'](_0x1d905e,'id');_0x4e80d9=_[_0x99a1('0x2f')](_0x4e80d9,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x278e22[_0x99a1('0x49')][_0x99a1('0x4d')]){_0x67992[_0x99a1('0x4c')][_0x99a1('0x38')](function(_0x409bc3){_0x4f64b7['field']('i.'+_0x409bc3);});}else{_0x4f64b7[_0x99a1('0x55')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4f64b7[_0x99a1('0x55')](_0x99a1('0xa3'),'Account.key');_0x4f64b7[_0x99a1('0x55')](_0x99a1('0xa4'),_0x99a1('0xa5'));_0x4f64b7['field'](_0x99a1('0xa6'),_0x99a1('0x97'));_0x4f64b7[_0x99a1('0x55')]('i.*');_0x4f64b7[_0x99a1('0x55')](_0x99a1('0xa7'),'Contact.firstName');_0x4f64b7[_0x99a1('0x55')](_0x99a1('0xa8'),'Contact.lastName');_0x4f64b7['field'](_0x99a1('0xa9'),_0x99a1('0xaa'));_0x4f64b7[_0x99a1('0x55')]('c.phone',_0x99a1('0xab'));_0x4f64b7[_0x99a1('0x55')](_0x99a1('0xac'),_0x99a1('0xad'));_0x4f64b7[_0x99a1('0x55')](_0x99a1('0xae'),'Contact.fax');_0x4f64b7['field']('o.fullname',_0x99a1('0xaf'));_0x4f64b7[_0x99a1('0x55')](_0x99a1('0xb0'),_0x99a1('0xb1'));_0x4f64b7[_0x99a1('0x55')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x99a1('0x35'));}if(_0x67992[_0x99a1('0x24')])_0x4f64b7['limit'](_0x67992['limit']);if(_0x67992[_0x99a1('0x27')])_0x4f64b7[_0x99a1('0x27')](_0x67992[_0x99a1('0x27')]);return db['sequelize'][_0x99a1('0x49')](_0x4f64b7['toString'](),_0x4e80d9);})[_0x99a1('0x17')](function(_0x50bd70){if(_0x50bd70[_0x99a1('0x6b')]>0x0)_0x2cc320[_0x99a1('0x51')]('ui.ChatInteractionId\x20IN\x20?',_[_0x99a1('0x34')](_0x50bd70,'id'));return db[_0x99a1('0xa1')]['query'](_0x2cc320[_0x99a1('0xa2')](),_0x4e80d9)[_0x99a1('0x17')](function(_0xa40c63){var _0x2fdee5=_[_0x99a1('0xb2')](_0xa40c63,_0x99a1('0xb3'));var _0x44bd17=[];_0x50bd70['forEach'](function(_0x5bc396){_0x44bd17[_0x99a1('0x39')](updateChatInteraction(_0x5bc396,_0xf8208a,_0x2fdee5));});return BPromise[_0x99a1('0xb4')](_0x44bd17);});});})['then'](function(_0x48303a){_0x3861b6[_0x99a1('0xb5')]=_0x48303a;return _0x3861b6;})['then'](respondWithFilteredResult(_0x3a0b44,_0x67992))['catch'](handleError(_0x3a0b44,null));};exports['show']=function(_0x319ccb,_0x5be52b){var _0x445b69={'raw':![],'where':{'id':_0x319ccb[_0x99a1('0xb6')]['id']}},_0x40ca30={};_0x40ca30[_0x99a1('0x48')]=_[_0x99a1('0x4a')](db[_0x99a1('0x45')]['rawAttributes']);_0x40ca30[_0x99a1('0x49')]=_[_0x99a1('0x4a')](_0x319ccb[_0x99a1('0x49')]);_0x40ca30[_0x99a1('0x52')]=_[_0x99a1('0x4b')](_0x40ca30['model'],_0x40ca30[_0x99a1('0x49')]);_0x445b69[_0x99a1('0x4c')]=_[_0x99a1('0x4b')](_0x40ca30[_0x99a1('0x48')],qs[_0x99a1('0x4d')](_0x319ccb[_0x99a1('0x49')][_0x99a1('0x4d')]));_0x445b69[_0x99a1('0x4c')]=_0x445b69['attributes'][_0x99a1('0x6b')]?_0x445b69[_0x99a1('0x4c')]:_0x40ca30[_0x99a1('0x48')];if(_0x319ccb[_0x99a1('0x49')][_0x99a1('0xb7')]){_0x445b69['include']=[{'all':!![]}];}_0x445b69=_[_0x99a1('0x2f')]({},_0x445b69,_0x319ccb['options']);return db[_0x99a1('0x45')][_0x99a1('0x6c')](_0x445b69)[_0x99a1('0x17')](handleEntityNotFound(_0x5be52b,null))[_0x99a1('0x17')](respondWithResult(_0x5be52b,null))['catch'](handleError(_0x5be52b,null));};exports[_0x99a1('0xb8')]=function(_0x28fb61,_0x3f029e){return db['ChatInteraction'][_0x99a1('0xb8')](_0x28fb61[_0x99a1('0x30')],{})[_0x99a1('0x17')](respondWithResult(_0x3f029e,0xc9))[_0x99a1('0x3a')](handleError(_0x3f029e,null));};exports[_0x99a1('0x29')]=function(_0x2a5d6f,_0x41e5f6){if(_0x2a5d6f[_0x99a1('0x30')]['id']){delete _0x2a5d6f[_0x99a1('0x30')]['id'];}return db[_0x99a1('0x45')][_0x99a1('0x6c')]({'where':{'id':_0x2a5d6f['params']['id']}})[_0x99a1('0x17')](handleEntityNotFound(_0x41e5f6,null))['then'](saveUpdates(_0x2a5d6f[_0x99a1('0x30')],null))[_0x99a1('0x17')](respondWithResult(_0x41e5f6,null))[_0x99a1('0x3a')](handleError(_0x41e5f6,null));};exports['destroy']=function(_0x1813c7,_0x60c710){return db['ChatInteraction'][_0x99a1('0x6c')]({'where':{'id':_0x1813c7['params']['id']}})[_0x99a1('0x17')](handleEntityNotFound(_0x60c710,null))[_0x99a1('0x17')](removeEntity(_0x60c710,null))[_0x99a1('0x3a')](handleError(_0x60c710,null));};exports[_0x99a1('0xb9')]=function(_0x61013d,_0x53416a){return db[_0x99a1('0x45')][_0x99a1('0xb9')]()['then'](respondWithResult(_0x53416a,null))[_0x99a1('0x3a')](handleError(_0x53416a,null));};exports['createVidaooSession']=function(_0x4d0c1f,_0x7e84d6){var _0x109a1b=_0x4d0c1f[_0x99a1('0xb6')]['id'];var _0x2ed167;var _0x12a2d9;var _0x122c45;return db[_0x99a1('0x45')][_0x99a1('0xba')]({'where':{'id':_0x109a1b}})[_0x99a1('0x17')](function(_0x42b7b3){_0x2ed167=_0x42b7b3;return db[_0x99a1('0xbb')][_0x99a1('0xba')]({'where':{'id':_0x42b7b3['ChatWebsiteId']},'attributes':['id',_0x99a1('0xbc'),_0x99a1('0xbd'),_0x99a1('0xbe'),_0x99a1('0xbf'),_0x99a1('0xc0')],'raw':!![]});})[_0x99a1('0x17')](function(_0x55dfd5){if(_0x55dfd5&&_0x55dfd5[_0x99a1('0xbc')]&&_0x55dfd5[_0x99a1('0xbd')]){_0x12a2d9=_0x55dfd5;var _0x240af8={'interaction':{'id':_0x109a1b},'agent':{'id':_0x4d0c1f[_0x99a1('0x9c')]['id'],'name':_0x4d0c1f['user']['name'],'fullname':_0x4d0c1f[_0x99a1('0x9c')][_0x99a1('0xc1')],'email':_0x4d0c1f[_0x99a1('0x9c')][_0x99a1('0xc2')]},'contact':_0x4d0c1f[_0x99a1('0x30')][_0x99a1('0x31')],'account':_0x4d0c1f[_0x99a1('0x30')][_0x99a1('0xc3')]};var _0x171f69={'rejectUnauthorized':![],'method':_0x99a1('0xc4'),'url':_0x99a1('0xc5'),'headers':{'X-APIKEY':_0x55dfd5[_0x99a1('0xbc')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4d0c1f[_0x99a1('0x9c')][_0x99a1('0xc2')]],'buttons':null,'topic':_0x12a2d9[_0x99a1('0xbe')],'note':_[_0x99a1('0xc6')](_0x12a2d9['vidaooNote'])?null:getMustacheRender(_0x12a2d9[_0x99a1('0xbf')],_0x240af8),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x99a1('0xc6')](_0x12a2d9[_0x99a1('0xc0')])){var _0x5db133=getMustacheRender(_0x12a2d9['vidaooMetadata'],_0x240af8);var _0x4dec67=JSON[_0x99a1('0x82')](_0x5db133);_0x171f69['body'][_0x99a1('0xc7')]=_0x4dec67;}}catch(_0x4c7e31){throw new db['Sequelize'][(_0x99a1('0xc8'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x171f69);}else{throw new db[(_0x99a1('0xc9'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x99a1('0x17')](function(_0xce4e39){_0x122c45=_0xce4e39;if(_0x122c45['id']){var _0x5060b3={'body':_0x122c45[_0x99a1('0xca')],'ChatWebsiteId':_0x12a2d9['id'],'ChatInteractionId':_0x2ed167['id'],'direction':_0x99a1('0xcb'),'UserId':_0x4d0c1f[_0x99a1('0x9c')]['id']};return db[_0x99a1('0xcc')][_0x99a1('0xb8')](_0x5060b3,{});}else{throw new db['Sequelize']['ValidationError'](_0x99a1('0xcd'));}})[_0x99a1('0x17')](function(){return _0x2ed167[_0x99a1('0xce')]({'vidaooSessionId':_0x122c45['id']});})[_0x99a1('0x17')](respondWithResult(_0x7e84d6,null))[_0x99a1('0x3a')](handleError(_0x7e84d6,null));};exports['customUpdate']=function(_0x557d9c,_0x46d0d3){if(_0x557d9c[_0x99a1('0x30')]['id']){delete _0x557d9c[_0x99a1('0x30')]['id'];}return db[_0x99a1('0x45')][_0x99a1('0x6c')]({'where':{'id':_0x557d9c[_0x99a1('0xb6')]['id']},'include':[{'model':db[_0x99a1('0xcf')],'as':_0x99a1('0x70')}]})[_0x99a1('0x17')](handleEntityNotFound(_0x46d0d3,null))[_0x99a1('0x17')](saveUpdates(_0x557d9c[_0x99a1('0x30')],null))[_0x99a1('0x17')](respondWithResult(_0x46d0d3,null))[_0x99a1('0x3a')](handleError(_0x46d0d3,null));};exports[_0x99a1('0xd0')]=function(_0x236f79,_0x49debb){if(_0x236f79[_0x99a1('0x30')]['id']){delete _0x236f79[_0x99a1('0x30')]['id'];}return db[_0x99a1('0x45')][_0x99a1('0x6c')]({'where':{'id':_0x236f79[_0x99a1('0xb6')]['id']}})[_0x99a1('0x17')](function(_0x3acb34){if(!_0x3acb34){logger[_0x99a1('0x1d')](_0x99a1('0xd1'),_0x99a1('0xd0'),0x194,_0x99a1('0xd2'));_0x49debb['sendStatus'](0x194);}else{if(_0x3acb34['UserId']){throw new db[(_0x99a1('0xc9'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x3acb34;})['then'](function(_0x793d63){if(_0x793d63){return _0x793d63[_0x99a1('0x29')]({'closed':_0x236f79[_0x99a1('0x30')][_0x99a1('0x40')],'disposition':_0x236f79[_0x99a1('0x30')][_0x99a1('0x42')]})[_0x99a1('0x17')](function(_0x41a990){return _0x41a990;});}})[_0x99a1('0x17')](function(){return respondWithRpcPromise(_0x99a1('0xd3'),_0x99a1('0xd0'),_0x236f79[_0x99a1('0x30')],client9004);})[_0x99a1('0x17')](respondWithResult(_0x49debb,null))[_0x99a1('0x3a')](handleError(_0x49debb,null));};exports[_0x99a1('0xd4')]=function(_0x316d8b,_0x4eaf77){_0x316d8b[_0x99a1('0x30')][_0x99a1('0x2c')]=_0x316d8b['file'][_0x99a1('0xd5')];_0x316d8b[_0x99a1('0x30')][_0x99a1('0xd6')]=_0x316d8b[_0x99a1('0xd7')]['filename'];_0x316d8b[_0x99a1('0x30')]['type']=_0x316d8b['file']['mimetype'];return db['Attachment'][_0x99a1('0xb8')](_0x316d8b[_0x99a1('0x30')])['then'](respondWithResult(_0x4eaf77,0xc9))['catch'](handleError(_0x4eaf77,null));};exports['attachmentDownload']=function(_0x2d8190,_0x4f736b){return db['ChatInteraction'][_0x99a1('0xba')]({'where':{'id':_0x2d8190[_0x99a1('0xb6')]['id']},'raw':!![]})[_0x99a1('0x17')](handleEntityNotFound(_0x4f736b,null))[_0x99a1('0x17')](function(_0x191f1a){if(_0x191f1a){if(_0x191f1a[_0x99a1('0x40')]){return _0x4f736b[_0x99a1('0x22')](0x193)[_0x99a1('0x23')]({'status':0x193,'message':_0x99a1('0xd8')});}return db[_0x99a1('0xd9')]['findOne']({'where':{'id':_0x2d8190[_0x99a1('0x49')][_0x99a1('0xda')]},'raw':!![]})['then'](handleEntityNotFound(_0x4f736b,null));}})[_0x99a1('0x17')](function(_0xf172b3){if(_0xf172b3){var _0x22757d=_0xf172b3[_0x99a1('0xdb')]!==null;var _0x13d3f2=path[_0x99a1('0xdc')](config[_0x99a1('0xdd')],'server/files/attachments/');if(_0x22757d){_0x13d3f2=path[_0x99a1('0xdc')](_0x13d3f2,_0x99a1('0xde'));}var _0x5b9b02=path[_0x99a1('0xdc')](_0x13d3f2,_0xf172b3['basename']);return _0x4f736b[_0x99a1('0xdf')](_0x5b9b02);}})[_0x99a1('0x3a')](handleError(_0x4f736b,null));};exports[_0x99a1('0xe0')]=function(_0x37577e,_0x1ca0cc){var _0x27a06a=null;var _0x2e1a93=null;var _0x5e1ab8=null;if(_0x37577e[_0x99a1('0x30')]['id']){delete _0x37577e['body']['id'];}if(_0x37577e[_0x99a1('0x30')][_0x99a1('0xe1')]){_0x5e1ab8=path['join'](config[_0x99a1('0xdd')],_0x99a1('0xe2'),util[_0x99a1('0xe3')]('transcript-%s.txt',Date['now']()));_0x37577e[_0x99a1('0x30')]['pathTranscript']=_0x5e1ab8;}return db[_0x99a1('0x45')][_0x99a1('0x6c')]({'where':{'id':_0x37577e[_0x99a1('0xb6')]['id']},'include':[{'model':db[_0x99a1('0xcc')],'as':_0x99a1('0xe4'),'include':[{'model':db[_0x99a1('0x7a')],'as':_0x99a1('0x7a')}]}]})[_0x99a1('0x17')](handleEntityNotFound(_0x1ca0cc,null))[_0x99a1('0x17')](saveUpdates(_0x37577e['body'],null))['then'](function(_0x5c1175){if(_0x5c1175){_0x27a06a=_0x5c1175;return db[_0x99a1('0xbb')][_0x99a1('0x6c')]({'where':{'id':_0x27a06a[_0x99a1('0x80')]}});}})[_0x99a1('0x17')](function(_0x9f3ffb){if(_0x9f3ffb){_0x2e1a93=_0x9f3ffb;return db[_0x99a1('0xcf')][_0x99a1('0x6c')]({'where':{'id':_0x27a06a[_0x99a1('0x75')]}});}})[_0x99a1('0x17')](function(_0x529733){if(_0x529733){if(_0x5e1ab8){var _0x4611a7=null;for(var _0xfd2f49=0x1;_0xfd2f49<_0x27a06a['Messages'][_0x99a1('0x6b')];++_0xfd2f49){_0x4611a7=_0x27a06a[_0x99a1('0xe4')][_0xfd2f49];var _0x10bd69=_0x4611a7[_0x99a1('0x41')]?util[_0x99a1('0xe3')]('%s%d',_0x2e1a93[_0x99a1('0xe5')],_0x4611a7[_0x99a1('0x41')]):_0x99a1('0xe6');var _0xa0ab8=_0x37577e[_0x99a1('0x30')][_0x99a1('0xe7')]||util[_0x99a1('0xe3')](_0x99a1('0xe8'),_0x99a1('0xe9'),_0x4611a7[_0x99a1('0x75')]);switch(_0x2e1a93['agentIdentifier']){case _0x99a1('0xea'):_0x10bd69=_0x4611a7[_0x99a1('0x41')]?util[_0x99a1('0xe3')](_0x99a1('0xe8'),_0x2e1a93[_0x99a1('0xe5')],_0x4611a7[_0x99a1('0x41')]):_0x99a1('0xe6');break;case _0x99a1('0xeb'):_0x10bd69=_0x4611a7['UserId']?_0x4611a7[_0x99a1('0x7a')]['alias']||_0x4611a7[_0x99a1('0x7a')]['fullname']:_0x99a1('0xe6');break;case _0x99a1('0xec'):_0x10bd69=_0x4611a7['UserId']?_0x4611a7[_0x99a1('0x7a')][_0x99a1('0xc1')]:_0x99a1('0xe6');break;default:_0x10bd69=_0x4611a7[_0x99a1('0x41')]?util[_0x99a1('0xe3')](_0x99a1('0xe8'),_0x2e1a93['agentAlias'],_0x4611a7[_0x99a1('0x41')]):_0x99a1('0xe6');}var _0x425462=util['format'](_0x99a1('0xed'),moment(_0x4611a7[_0x99a1('0xee')])['format'](_0x99a1('0xef')),_0x4611a7[_0x99a1('0xf0')]==='in'?_0xa0ab8:_0x10bd69,_0x4611a7['body']);if(!_0x4611a7['secret']){fs[_0x99a1('0xf1')](_0x5e1ab8,_0x425462);}}return db[_0x99a1('0xf2')][_0x99a1('0xba')]({'where':{'service':!![]},'include':[{'model':db[_0x99a1('0xf3')],'as':_0x99a1('0xf4'),'raw':!![],'include':[{'model':db[_0x99a1('0xf5')],'as':_0x99a1('0xf5'),'raw':!![]}]}]});}}})['then'](function(_0x342612){if(!_0x342612||!_0x342612[_0x99a1('0xf4')]||!_0x37577e[_0x99a1('0x30')])return _0x27a06a;var _0x5b07bb=_0x342612[_0x99a1('0xf6')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x5b07bb,'message':{'from':util[_0x99a1('0xe3')](_0x99a1('0xf7'),_0x342612['name'],_0x342612[_0x99a1('0xc2')]||_0x342612['Smtp'][_0x99a1('0x9c')]),'to':_0x37577e['body']['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format'](_0x99a1('0xf8'),_0x37577e[_0x99a1('0x30')]['mailTranscript']),'attachments':[{'path':_0x5e1ab8}]}})['then'](function(){return _0x27a06a;})[_0x99a1('0x3a')](function(_0x5a35ef){logger[_0x99a1('0x1d')](_0x5a35ef);});})[_0x99a1('0x17')](respondWithStatusCode(_0x1ca0cc,0xc8))[_0x99a1('0x3a')](handleError(_0x1ca0cc,null));};exports['addMessage']=function(_0x548c0a,_0x58ae99){return db[_0x99a1('0xcc')][_0x99a1('0x6c')]({'where':{'id':_0x548c0a[_0x99a1('0xb6')]['id']}})[_0x99a1('0x17')](handleEntityNotFound(_0x58ae99,null))[_0x99a1('0x17')](function(_0x182baf){if(_0x182baf){return _0x182baf[_0x99a1('0xf9')](_0x548c0a[_0x99a1('0x30')][_0x99a1('0xfa')],_[_0x99a1('0xfb')](_0x548c0a[_0x99a1('0x30')],['ids','id'])||{});}})[_0x99a1('0x17')](respondWithResult(_0x58ae99,null))['catch'](handleError(_0x58ae99,null));};exports[_0x99a1('0xfc')]=function(_0x251df4,_0x513bfa){var _0x5e163e={'raw':![],'where':{}};var _0x4bc43d={};var _0x11ec42={'count':0x0,'rows':[]};return db[_0x99a1('0x45')]['findOne']({'where':{'id':_0x251df4['params']['id']}})['then'](handleEntityNotFound(_0x513bfa,null))[_0x99a1('0x17')](function(_0x211b44){if(_0x211b44){_0x4bc43d['model']=_[_0x99a1('0x4a')](db[_0x99a1('0xcc')][_0x99a1('0xfd')]);_0x4bc43d[_0x99a1('0x49')]=_[_0x99a1('0x4a')](_0x251df4[_0x99a1('0x49')]);_0x4bc43d[_0x99a1('0x52')]=_[_0x99a1('0x4b')](_0x4bc43d[_0x99a1('0x48')],_0x4bc43d['query']);_0x5e163e[_0x99a1('0x4c')]=_[_0x99a1('0x4b')](_0x4bc43d[_0x99a1('0x48')],qs[_0x99a1('0x4d')](_0x251df4[_0x99a1('0x49')][_0x99a1('0x4d')]));_0x5e163e[_0x99a1('0x4c')]=_0x5e163e[_0x99a1('0x4c')][_0x99a1('0x6b')]?_0x5e163e[_0x99a1('0x4c')]:_0x4bc43d['model'];if(!_0x251df4[_0x99a1('0x49')]['hasOwnProperty'](_0x99a1('0x4f'))){_0x5e163e[_0x99a1('0x24')]=qs[_0x99a1('0x24')](_0x251df4[_0x99a1('0x49')][_0x99a1('0x24')]);_0x5e163e[_0x99a1('0x27')]=qs['offset'](_0x251df4[_0x99a1('0x49')]['offset']);}_0x5e163e[_0x99a1('0x96')]=qs[_0x99a1('0x50')](_0x251df4[_0x99a1('0x49')][_0x99a1('0x50')]);_0x5e163e[_0x99a1('0x51')]=qs[_0x99a1('0x52')](_['pick'](_0x251df4[_0x99a1('0x49')],_0x4bc43d[_0x99a1('0x52')]));_0x5e163e[_0x99a1('0x51')][_0x99a1('0xb3')]=_0x211b44['id'];if(_0x251df4[_0x99a1('0x49')][_0x99a1('0x8c')]){_0x5e163e[_0x99a1('0x51')]=_['merge'](_0x5e163e[_0x99a1('0x51')],{'$or':_['map'](_0x5e163e[_0x99a1('0x4c')],function(_0xbe9500){var _0x37bbb2={};_0x37bbb2[_0xbe9500]={'$like':'%'+_0x251df4[_0x99a1('0x49')]['filter']+'%'};return _0x37bbb2;})});}if(_0x251df4[_0x99a1('0x49')]['$gte']){var _0x14ec6e=_0x251df4[_0x99a1('0x49')]['$gte'][_0x99a1('0x37')](',');var _0x722681={};_0x722681[_0x14ec6e[0x0]]={'$gte':moment(_0x14ec6e[0x1])[_0x99a1('0xe3')](_0x99a1('0xfe'))};_0x5e163e[_0x99a1('0x51')]=_[_0x99a1('0x2f')](_0x5e163e[_0x99a1('0x51')],_0x722681);}_0x5e163e=_[_0x99a1('0x2f')]({},_0x5e163e,_0x251df4[_0x99a1('0xff')]);return db[_0x99a1('0xcc')][_0x99a1('0x26')]({'where':_0x5e163e[_0x99a1('0x51')]})['then'](function(_0x526a82){_0x11ec42[_0x99a1('0x26')]=_0x526a82;if(_0x251df4[_0x99a1('0x49')]['includeAll']){_0x5e163e[_0x99a1('0x100')]=[{'all':!![]}];}return db[_0x99a1('0xcc')][_0x99a1('0x101')](_0x5e163e);})[_0x99a1('0x17')](function(_0x53ccd5){_0x11ec42[_0x99a1('0xb5')]=_0x53ccd5;return _0x11ec42;});}})['then'](respondWithFilteredResult(_0x513bfa,_0x5e163e))[_0x99a1('0x3a')](handleError(_0x513bfa,null));};exports[_0x99a1('0x102')]=function(_0x1c0ab2,_0x220eaa){var _0xe8d71a={'where':{}},_0x5bf8c7={},_0xd05ea={'count':0x0,'rows':[]};return db[_0x99a1('0x45')][_0x99a1('0xba')]({'where':{'id':_0x1c0ab2[_0x99a1('0xb6')]['id']}})[_0x99a1('0x17')](handleEntityNotFound(_0x220eaa,null))['then'](function(_0x2f0c0f){if(_0x2f0c0f){_0x5bf8c7[_0x99a1('0x48')]=_[_0x99a1('0x4a')](db[_0x99a1('0xcc')]['rawAttributes']);_0x5bf8c7['query']=_[_0x99a1('0x4a')](_0x1c0ab2[_0x99a1('0x49')]);_0x5bf8c7[_0x99a1('0x52')]=_[_0x99a1('0x4b')](_0x5bf8c7[_0x99a1('0x48')],_0x5bf8c7[_0x99a1('0x49')]);_0xe8d71a[_0x99a1('0x4c')]=_[_0x99a1('0x4b')](_0x5bf8c7['model'],qs[_0x99a1('0x4d')](_0x1c0ab2[_0x99a1('0x49')][_0x99a1('0x4d')]));_0xe8d71a[_0x99a1('0x4c')]=_0xe8d71a[_0x99a1('0x4c')][_0x99a1('0x6b')]?_0xe8d71a[_0x99a1('0x4c')]:_0x5bf8c7['model'];if(!_0x1c0ab2[_0x99a1('0x49')][_0x99a1('0x4e')](_0x99a1('0x4f'))){_0xe8d71a['limit']=qs[_0x99a1('0x24')](_0x1c0ab2[_0x99a1('0x49')]['limit']);_0xe8d71a[_0x99a1('0x27')]=qs[_0x99a1('0x27')](_0x1c0ab2['query'][_0x99a1('0x27')]);}_0xe8d71a['order']=qs[_0x99a1('0x50')](_0x1c0ab2[_0x99a1('0x49')][_0x99a1('0x50')]);_0xe8d71a['where']=qs['filters'](_[_0x99a1('0x53')](_0x1c0ab2[_0x99a1('0x49')],_0x5bf8c7[_0x99a1('0x52')]));_0xe8d71a[_0x99a1('0x51')][_0x99a1('0xb3')]=_0x2f0c0f['id'];if(_0x1c0ab2['query']['filter']){_0xe8d71a[_0x99a1('0x51')]=_[_0x99a1('0x2f')](_0xe8d71a[_0x99a1('0x51')],{'$or':_[_0x99a1('0x34')](_0xe8d71a[_0x99a1('0x4c')],function(_0x534762){var _0x5e8678={};_0x5e8678[_0x534762]={'$like':'%'+_0x1c0ab2[_0x99a1('0x49')][_0x99a1('0x8c')]+'%'};return _0x5e8678;})});}_0xe8d71a[_0x99a1('0x51')][_0x99a1('0x103')]=![];if(_0x1c0ab2['query']['id']){_0xe8d71a[_0x99a1('0x51')]['id']={'$gt':_0x1c0ab2['query']['id']};}_0xe8d71a=_[_0x99a1('0x2f')]({},_0xe8d71a,_0x1c0ab2[_0x99a1('0xff')]);return db['ChatMessage'][_0x99a1('0x26')]({'where':_0xe8d71a['where']})['then'](function(_0x2722d0){_0xd05ea[_0x99a1('0x26')]=_0x2722d0;_0xe8d71a[_0x99a1('0x100')]=[];if(_0x1c0ab2['query'][_0x99a1('0x104')]){_0xe8d71a[_0x99a1('0x100')][_0x99a1('0x39')]({'model':db[_0x99a1('0x7a')],'as':_0x99a1('0x7a'),'attributes':['id','fullname',_0x99a1('0x105')]});}if(_0x1c0ab2[_0x99a1('0x49')][_0x99a1('0xb7')]){_0xe8d71a[_0x99a1('0x100')]=[{'all':!![]}];}return db['ChatMessage'][_0x99a1('0x101')](_0xe8d71a);})[_0x99a1('0x17')](function(_0x1becf9){_0xd05ea[_0x99a1('0xb5')]=_0x1becf9;return _0xd05ea;});}})['then'](respondWithFilteredResult(_0x220eaa,_0xe8d71a))[_0x99a1('0x3a')](handleError(_0x220eaa,null));};exports[_0x99a1('0x106')]=function(_0x1f1d29,_0x5c4dc0){return db['ChatInteraction'][_0x99a1('0x6c')]({'where':{'id':_0x1f1d29[_0x99a1('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5c4dc0,null))[_0x99a1('0x17')](function(_0x5fc729){if(_0x5fc729){return _0x5fc729[_0x99a1('0x107')](_0x1f1d29[_0x99a1('0x30')][_0x99a1('0xfa')],_[_0x99a1('0xfb')](_0x1f1d29[_0x99a1('0x30')],[_0x99a1('0xfa'),'id'])||{})['spread'](function(){return db[_0x99a1('0x108')][_0x99a1('0x101')]({'attributes':['id',_0x99a1('0x2c'),_0x99a1('0x56')],'where':{'id':_0x1f1d29['body'][_0x99a1('0xfa')]}});})[_0x99a1('0x17')](function(_0x485f57){socket[_0x99a1('0x109')](_0x99a1('0x10a'),{'id':Number(_0x1f1d29[_0x99a1('0xb6')]['id']),'tags':_0x485f57||[]});return{'id':Number(_0x1f1d29[_0x99a1('0xb6')]['id']),'tags':_0x485f57||[]};});}})[_0x99a1('0x17')](respondWithResult(_0x5c4dc0,null))[_0x99a1('0x3a')](handleError(_0x5c4dc0,null));};exports[_0x99a1('0x10b')]=function(_0x1557fc,_0xec4124){return db[_0x99a1('0x45')][_0x99a1('0x6c')]({'where':{'id':_0x1557fc[_0x99a1('0xb6')]['id']}})['then'](handleEntityNotFound(_0xec4124,null))[_0x99a1('0x17')](function(_0x1f2219){if(_0x1f2219){return _0x1f2219[_0x99a1('0x10b')](_0x1557fc[_0x99a1('0x49')][_0x99a1('0xfa')]);}})[_0x99a1('0x17')](respondWithStatusCode(_0xec4124,null))[_0x99a1('0x3a')](handleError(_0xec4124,null));};exports['download']=function(_0x1a6043,_0x5adb5f){var _0x434c1d=moment()[_0x99a1('0x10c')]()[_0x99a1('0xa2')]();var _0x4d9679=path[_0x99a1('0xdc')](config['root'],_0x99a1('0x10d'),_0x99a1('0x10e'),_0x99a1('0x10f'));var _0x152893=path[_0x99a1('0xdc')](config['root'],_0x99a1('0x10d'),'files',_0x99a1('0x110'));var _0x1d09e6=path[_0x99a1('0xdc')](_0x4d9679,_0x434c1d);var _0x539dc6=util['format'](_0x99a1('0x111'),_0x1a6043[_0x99a1('0xb6')]['id'],_0x434c1d);var _0x4dc89f=path['join'](_0x4d9679,_0x539dc6);var _0x26e00f=[];_0x26e00f['push']({'model':db[_0x99a1('0x7a')],'as':_0x99a1('0x7a'),'attributes':['id','fullname'],'raw':!![]});_0x26e00f[_0x99a1('0x39')]({'model':db['CmContact'],'as':_0x99a1('0x70'),'attributes':['id',_0x99a1('0x112'),_0x99a1('0x113')],'raw':!![]});if(_0x1a6043[_0x99a1('0x49')]['attachments']){_0x26e00f[_0x99a1('0x39')]({'model':db[_0x99a1('0xd9')],'as':_0x99a1('0xd9'),'raw':!![]});}var _0x1e7243=[{'model':db[_0x99a1('0xcc')],'as':'Messages','attributes':['id',_0x99a1('0x30'),_0x99a1('0xee'),_0x99a1('0xf0'),_0x99a1('0x103'),_0x99a1('0x87')],'include':_0x26e00f}];_0x1e7243[_0x99a1('0x39')]({'model':db[_0x99a1('0xbb')],'as':_0x99a1('0x114'),'attributes':['id','name']});_0x1e7243[_0x99a1('0x39')]({'model':db[_0x99a1('0x7a')],'as':'Owner','attributes':['id',_0x99a1('0xc1')]});return db['ChatInteraction'][_0x99a1('0x6c')]({'where':{'id':_0x1a6043[_0x99a1('0xb6')]['id']},'include':_0x1e7243})[_0x99a1('0x17')](handleEntityNotFound(_0x5adb5f,null))[_0x99a1('0x17')](function(_0x1bfc03){if(_0x1bfc03){var _0x25b1e9=_0x1bfc03[_0x99a1('0x115')]({'plain':!![]});fs[_0x99a1('0x116')](_0x1d09e6);var _0x395721={'channel':_0x99a1('0x117'),'account':_0x25b1e9['Account'][_0x99a1('0x2c')],'agent':_0x25b1e9[_0x99a1('0x118')]?_0x25b1e9['Owner'][_0x99a1('0xc1')]:'N.A.','createdAt':moment(_0x25b1e9[_0x99a1('0xee')])[_0x99a1('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x25b1e9[_0x99a1('0x40')]?moment(_0x25b1e9[_0x99a1('0x119')])[_0x99a1('0xe3')](_0x99a1('0xfe'))[_0x99a1('0xa2')]():'','disposition':_0x25b1e9[_0x99a1('0x42')],'chatInfo':{'browser':_0x25b1e9['browserName'],'os':_0x25b1e9['osName'],'referer':_0x25b1e9[_0x99a1('0x11a')],'customerIp':_0x25b1e9[_0x99a1('0x11b')],'customerPort':_0x25b1e9['customerPort']?_0x25b1e9[_0x99a1('0x11c')]:_0x99a1('0x11d')},'messages':_(_0x25b1e9['Messages'])['tail']()['filter']({'secret':![]})[_0x99a1('0x34')](function(_0x1f14b7){if(_0x1f14b7[_0x99a1('0xd9')]){var _0x546c9a=path['join'](_0x152893,_0x1f14b7['Attachment']['basename']);if(fs[_0x99a1('0x11e')](_0x546c9a)){fs[_0x99a1('0x11f')](_0x546c9a)[_0x99a1('0x120')](fs[_0x99a1('0x121')](path[_0x99a1('0xdc')](_0x1d09e6,_0x1f14b7[_0x99a1('0xd9')][_0x99a1('0xd6')])));}}return{'date':moment(_0x1f14b7[_0x99a1('0xee')])['format'](_0x99a1('0xfe'))[_0x99a1('0xa2')](),'sender':_0x1f14b7[_0x99a1('0xf0')]===_0x99a1('0xcb')?_0x1f14b7[_0x99a1('0x7a')]?_0x1f14b7[_0x99a1('0x7a')][_0x99a1('0xc1')]:_0x99a1('0xe6'):_0x1f14b7[_0x99a1('0x70')][_0x99a1('0x112')]+(_0x1f14b7['Contact']['lastName']?'\x20'+_0x1f14b7[_0x99a1('0x70')][_0x99a1('0x113')]:''),'body':_0x1f14b7['Attachment']?_0x1f14b7[_0x99a1('0xd9')][_0x99a1('0xd6')]:_0x1f14b7[_0x99a1('0x30')],'direction':_0x1f14b7['direction']==='out'?'A':'C','secret':_0x1f14b7['secret'],'read':_0x1f14b7['read'],'attachment':_0x1f14b7['Attachment']};})['value']()};return ejs[_0x99a1('0x122')](path[_0x99a1('0xdc')](config['root'],'server',_0x99a1('0x123'),_0x99a1('0x124')),{'interaction':_0x395721})[_0x99a1('0x17')](function(_0x10349e){var _0x2daada=path[_0x99a1('0xdc')](_0x1d09e6,_0x99a1('0x125')+_0x25b1e9['id']+'-'+_0x434c1d+_0x99a1('0x126'));var _0x526638={'path':_0x2daada,'channel':_0x99a1('0x117'),'interactionId':_0x25b1e9['id']};return pdf[_0x99a1('0x127')](_0x10349e,_0x526638);})['then'](function(){return new Promise(function(_0x3aaf56,_0x11e9e7){zipdir(_0x1d09e6,{'saveTo':_0x4dc89f},function(_0x277d49,_0xbf6ea6){if(_0x277d49)return _0x11e9e7(_0x277d49);return _0x3aaf56(_0xbf6ea6);});})['then'](function(){return new BPromise(function(_0x5d9ecd,_0x21b4fe){rimraf(_0x1d09e6,function(_0x1d78c6){if(_0x1d78c6)_0x21b4fe(_0x1d78c6);return _0x5d9ecd();});});})['then'](function(){return _0x5adb5f[_0x99a1('0xdf')](_0x4dc89f,_0x539dc6,function(_0x38f02f){if(_0x38f02f){logger[_0x99a1('0x1d')](_0x99a1('0x128'),_0x38f02f);}else{fs[_0x99a1('0x129')](_0x4dc89f);}});});});}else{return _0x5adb5f[_0x99a1('0x20')](0xc8);}})[_0x99a1('0x3a')](handleError(_0x5adb5f,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index cbbd6c3..90f7499 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 _0x76b2=['Users','map','findAll','then','unreadMessages','emit','hasOwnProperty','exports','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','remove','getUsers','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76b2,0xa8));var _0x276b=function(_0x176b6c,_0x1c8db3){_0x176b6c=_0x176b6c-0x0;var _0x24aa00=_0x76b2[_0x176b6c];return _0x24aa00;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x276b('0x0')];var ChatMessage=require(_0x276b('0x1'))['db'][_0x276b('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x276b('0x3')](0x0);var events={'afterCreate':_0x276b('0x4'),'afterUpdate':'update','afterDestroy':_0x276b('0x5')};function emitEvent(_0x2e61ff){return function(_0x1d66f4,_0x407ac7,_0x3fb4aa){_0x1d66f4[_0x276b('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1d14a3){_0x1d66f4[_0x276b('0x7')](_0x276b('0x8'),_0x1d14a3[_0x276b('0x9')](function(_0x283b06){return{'id':_0x283b06['id']};}));return ChatMessage[_0x276b('0xa')]({'where':{'ChatInteractionId':_0x1d66f4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x276b('0xb')](function(_0x553cda){_0x1d66f4[_0x276b('0x7')](_0x276b('0xc'),_0x553cda['length']);ChatInteractionEvents[_0x276b('0xd')](_0x2e61ff+':'+_0x1d66f4['id'],_0x1d66f4);ChatInteractionEvents['emit'](_0x2e61ff,_0x1d66f4);_0x3fb4aa(null);})['catch'](_0x3fb4aa(null));};}for(var e in events){if(events[_0x276b('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x276b('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x61eb=['getUsers','setDataValue','map','findAll','then','unreadMessages','catch','hasOwnProperty','exports','../../mysqldb','ChatInteraction','setMaxListeners','update','remove'];(function(_0x3a5e2c,_0x278636){var _0x2a7ad3=function(_0x1d0496){while(--_0x1d0496){_0x3a5e2c['push'](_0x3a5e2c['shift']());}};_0x2a7ad3(++_0x278636);}(_0x61eb,0xbf));var _0xb61e=function(_0x16ec2e,_0x5a9df5){_0x16ec2e=_0x16ec2e-0x0;var _0x5644ba=_0x61eb[_0x16ec2e];return _0x5644ba;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xb61e('0x0'))['db'][_0xb61e('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb61e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb61e('0x3'),'afterDestroy':_0xb61e('0x4')};function emitEvent(_0x3b5471){return function(_0x3fa1f3,_0x5122e7,_0x4e8331){_0x3fa1f3[_0xb61e('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x508e92){_0x3fa1f3[_0xb61e('0x6')]('Users',_0x508e92[_0xb61e('0x7')](function(_0x387980){return{'id':_0x387980['id']};}));return ChatMessage[_0xb61e('0x8')]({'where':{'ChatInteractionId':_0x3fa1f3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb61e('0x9')](function(_0x6e3818){_0x3fa1f3[_0xb61e('0x6')](_0xb61e('0xa'),_0x6e3818['length']);ChatInteractionEvents['emit'](_0x3b5471+':'+_0x3fa1f3['id'],_0x3fa1f3);ChatInteractionEvents['emit'](_0x3b5471,_0x3fa1f3);_0x4e8331(null);})[_0xb61e('0xb')](_0x4e8331(null));};}for(var e in events){if(events[_0xb61e('0xc')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xb61e('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 67ea4b7..beabca0 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 _0xe8af=['define','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xe8af,0x1a1));var _0xfe8a=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0xe8af[_0x359bbe];return _0x1b3353;};'use strict';var _=require('lodash');var util=require(_0xfe8a('0x0'));var logger=require(_0xfe8a('0x1'))(_0xfe8a('0x2'));var moment=require(_0xfe8a('0x3'));var BPromise=require('bluebird');var rp=require(_0xfe8a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe8a('0x5'));var config=require(_0xfe8a('0x6'));var attributes=require(_0xfe8a('0x7'));module['exports']=function(_0x66c5a6,_0x3aeb4f){return _0x66c5a6[_0xfe8a('0x8')](_0xfe8a('0x9'),attributes,{'tableName':_0xfe8a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x234da0,_0x2e3f3d,_0x28bb3b){if(_0x234da0['changed'](_0xfe8a('0xb'))){_0x234da0[_0xfe8a('0xc')]=moment()[_0xfe8a('0xd')](_0xfe8a('0xe'));}_0x28bb3b(null,_0x234da0);}},'charset':_0xfe8a('0xf'),'collate':_0xfe8a('0x10')});}; \ No newline at end of file +var _0x23b2=['exports','define','changed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x2c289f,_0x9b2848){var _0xe1e2ef=function(_0x28f192){while(--_0x28f192){_0x2c289f['push'](_0x2c289f['shift']());}};_0xe1e2ef(++_0x9b2848);}(_0x23b2,0x12c));var _0x223b=function(_0x2c547d,_0x44b34b){_0x2c547d=_0x2c547d-0x0;var _0x13f588=_0x23b2[_0x2c547d];return _0x13f588;};'use strict';var _=require('lodash');var util=require(_0x223b('0x0'));var logger=require('../../config/logger')(_0x223b('0x1'));var moment=require(_0x223b('0x2'));var BPromise=require(_0x223b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x223b('0x4'));var rimraf=require(_0x223b('0x5'));var config=require(_0x223b('0x6'));var attributes=require(_0x223b('0x7'));module[_0x223b('0x8')]=function(_0x5d9f98,_0x4ce52a){return _0x5d9f98[_0x223b('0x9')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18d9ca,_0x401f12,_0x3110eb){if(_0x18d9ca[_0x223b('0xa')]('closed')){_0x18d9ca['closedAt']=moment()['format'](_0x223b('0xb'));}_0x3110eb(null,_0x18d9ca);}},'charset':_0x223b('0xc'),'collate':_0x223b('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 63c8e6c..7b8b464 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 _0x7df8=['then','debug','UpdateChatInteraction','find','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ChatInteraction','body','options','where','limit'];(function(_0x189b1d,_0x1df005){var _0x3d8ab0=function(_0x59a27f){while(--_0x59a27f){_0x189b1d['push'](_0x189b1d['shift']());}};_0x3d8ab0(++_0x1df005);}(_0x7df8,0x1f1));var _0x87df=function(_0x73302,_0x49d341){_0x73302=_0x73302-0x0;var _0x1e65b9=_0x7df8[_0x73302];return _0x1e65b9;};'use strict';var _=require(_0x87df('0x0'));var util=require(_0x87df('0x1'));var moment=require(_0x87df('0x2'));var BPromise=require(_0x87df('0x3'));var rs=require(_0x87df('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87df('0x5'))['db'];var utils=require(_0x87df('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x87df('0x7'));var jayson=require(_0x87df('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x87df('0x9'),'port':0x18eb});var socket=require(_0x87df('0xa'))(new Redis(config[_0x87df('0xb')]));require(_0x87df('0xc'))[_0x87df('0xd')](socket);function respondWithRpcPromise(_0x3a0a2e,_0x11354a,_0x1a9735){return new BPromise(function(_0x36956d,_0x2d8ad9){return client[_0x87df('0xe')](_0x3a0a2e,_0x1a9735)['then'](function(_0x75aaff){logger[_0x87df('0xf')](_0x87df('0x10'),_0x11354a,_0x87df('0x11'));logger['debug'](_0x87df('0x12'),_0x11354a,'request\x20sent',JSON[_0x87df('0x13')](_0x75aaff));if(_0x75aaff[_0x87df('0x14')]){if(_0x75aaff['error']['code']===0x1f4){logger[_0x87df('0x14')](_0x87df('0x10'),_0x11354a,_0x75aaff[_0x87df('0x14')]['message']);return _0x2d8ad9(_0x75aaff[_0x87df('0x14')][_0x87df('0x15')]);}logger['error'](_0x87df('0x10'),_0x11354a,_0x75aaff[_0x87df('0x14')][_0x87df('0x15')]);return _0x36956d(_0x75aaff[_0x87df('0x14')][_0x87df('0x15')]);}else{logger[_0x87df('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x11354a,_0x87df('0x11'));_0x36956d(_0x75aaff['result'][_0x87df('0x15')]);}})[_0x87df('0x16')](function(_0x23ff95){logger[_0x87df('0x14')](_0x87df('0x10'),_0x11354a,_0x23ff95);_0x2d8ad9(_0x23ff95);});});}exports['UpdateChatInteraction']=function(_0x2c83a0){var _0x25edb5=this;return new Promise(function(_0x390553,_0x35061c){return db[_0x87df('0x17')]['update'](_0x2c83a0[_0x87df('0x18')],{'raw':_0x2c83a0[_0x87df('0x19')]?_0x2c83a0[_0x87df('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c83a0[_0x87df('0x19')]?_0x2c83a0[_0x87df('0x19')][_0x87df('0x1a')]||null:null,'attributes':_0x2c83a0['options']?_0x2c83a0[_0x87df('0x19')]['attributes']||null:null,'limit':_0x2c83a0['options']?_0x2c83a0['options'][_0x87df('0x1b')]||null:null})[_0x87df('0x1c')](function(_0x388097){logger['info']('UpdateChatInteraction',_0x2c83a0);logger[_0x87df('0x1d')](_0x87df('0x1e'),_0x2c83a0,JSON[_0x87df('0x13')](_0x388097));_0x390553(_0x388097);})[_0x87df('0x16')](function(_0x3a91c3){logger['error'](_0x87df('0x1e'),_0x3a91c3[_0x87df('0x15')],_0x2c83a0);_0x35061c(_0x25edb5['error'](0x1f4,_0x3a91c3[_0x87df('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x2a5cd7){return new Promise(function(_0x598291,_0x479659){return db[_0x87df('0x17')][_0x87df('0x1f')]({'where':_0x2a5cd7[_0x87df('0x19')]?_0x2a5cd7[_0x87df('0x19')][_0x87df('0x1a')]||null:null})[_0x87df('0x1c')](function(_0x2094d9){if(_0x2094d9){return _0x2094d9['addTags'](_0x2a5cd7[_0x87df('0x18')][_0x87df('0x20')],_[_0x87df('0x21')](_0x2a5cd7[_0x87df('0x18')],['ids','id'])||{});}})['spread'](function(_0x20183d){logger[_0x87df('0xf')]('AddTags',_0x2a5cd7);logger['debug'](_0x87df('0x22'),_0x2a5cd7,JSON[_0x87df('0x13')](_0x20183d));_0x598291(_0x20183d);})[_0x87df('0x16')](function(_0x49b330){logger[_0x87df('0x14')](_0x87df('0x22'),_0x49b330['message'],_0x2a5cd7);_0x479659(_this['error'](0x1f4,_0x49b330[_0x87df('0x15')]));});});}; \ No newline at end of file +var _0x3a4f=['ChatInteraction','update','body','options','attributes','limit','then','find','where','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction'];(function(_0x32f903,_0xb543af){var _0x1ab908=function(_0x5c31ec){while(--_0x5c31ec){_0x32f903['push'](_0x32f903['shift']());}};_0x1ab908(++_0xb543af);}(_0x3a4f,0x8b));var _0xf3a4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3a4f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf3a4('0x0'));var util=require(_0xf3a4('0x1'));var moment=require(_0xf3a4('0x2'));var BPromise=require(_0xf3a4('0x3'));var rs=require(_0xf3a4('0x4'));var fs=require('fs');var Redis=require(_0xf3a4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf3a4('0x6'));var config=require(_0xf3a4('0x7'));var jayson=require(_0xf3a4('0x8'));var client=jayson[_0xf3a4('0x9')][_0xf3a4('0xa')]({'port':0x232a});config['redis']=_[_0xf3a4('0xb')](config[_0xf3a4('0xc')],{'host':_0xf3a4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3a4('0xc')]));require(_0xf3a4('0xe'))[_0xf3a4('0xf')](socket);function respondWithRpcPromise(_0x2b554b,_0x53d978,_0x27982f){return new BPromise(function(_0x59eb9a,_0x57eeb7){return client[_0xf3a4('0x10')](_0x2b554b,_0x27982f)['then'](function(_0x2ddc4f){logger[_0xf3a4('0x11')](_0xf3a4('0x12'),_0x53d978,_0xf3a4('0x13'));logger[_0xf3a4('0x14')](_0xf3a4('0x15'),_0x53d978,_0xf3a4('0x13'),JSON[_0xf3a4('0x16')](_0x2ddc4f));if(_0x2ddc4f[_0xf3a4('0x17')]){if(_0x2ddc4f[_0xf3a4('0x17')][_0xf3a4('0x18')]===0x1f4){logger[_0xf3a4('0x17')](_0xf3a4('0x12'),_0x53d978,_0x2ddc4f[_0xf3a4('0x17')][_0xf3a4('0x19')]);return _0x57eeb7(_0x2ddc4f[_0xf3a4('0x17')][_0xf3a4('0x19')]);}logger[_0xf3a4('0x17')](_0xf3a4('0x12'),_0x53d978,_0x2ddc4f[_0xf3a4('0x17')][_0xf3a4('0x19')]);return _0x59eb9a(_0x2ddc4f[_0xf3a4('0x17')]['message']);}else{logger[_0xf3a4('0x11')](_0xf3a4('0x12'),_0x53d978,_0xf3a4('0x13'));_0x59eb9a(_0x2ddc4f[_0xf3a4('0x1a')]['message']);}})[_0xf3a4('0x1b')](function(_0x35ceb3){logger[_0xf3a4('0x17')](_0xf3a4('0x12'),_0x53d978,_0x35ceb3);_0x57eeb7(_0x35ceb3);});});}exports[_0xf3a4('0x1c')]=function(_0x37ce64){var _0x614b16=this;return new Promise(function(_0x5c4860,_0x15567f){return db[_0xf3a4('0x1d')][_0xf3a4('0x1e')](_0x37ce64[_0xf3a4('0x1f')],{'raw':_0x37ce64['options']?_0x37ce64[_0xf3a4('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37ce64[_0xf3a4('0x20')]?_0x37ce64[_0xf3a4('0x20')]['where']||null:null,'attributes':_0x37ce64[_0xf3a4('0x20')]?_0x37ce64[_0xf3a4('0x20')][_0xf3a4('0x21')]||null:null,'limit':_0x37ce64[_0xf3a4('0x20')]?_0x37ce64[_0xf3a4('0x20')][_0xf3a4('0x22')]||null:null})[_0xf3a4('0x23')](function(_0x40eeb1){logger[_0xf3a4('0x11')](_0xf3a4('0x1c'),_0x37ce64);logger[_0xf3a4('0x14')](_0xf3a4('0x1c'),_0x37ce64,JSON[_0xf3a4('0x16')](_0x40eeb1));_0x5c4860(_0x40eeb1);})[_0xf3a4('0x1b')](function(_0x366633){logger[_0xf3a4('0x17')](_0xf3a4('0x1c'),_0x366633[_0xf3a4('0x19')],_0x37ce64);_0x15567f(_0x614b16[_0xf3a4('0x17')](0x1f4,_0x366633[_0xf3a4('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x2ab1b9){return new Promise(function(_0xc3ed1a,_0x44f4f5){return db['ChatInteraction'][_0xf3a4('0x24')]({'where':_0x2ab1b9['options']?_0x2ab1b9['options'][_0xf3a4('0x25')]||null:null})[_0xf3a4('0x23')](function(_0xc35376){if(_0xc35376){return _0xc35376[_0xf3a4('0x26')](_0x2ab1b9[_0xf3a4('0x1f')]['ids'],_[_0xf3a4('0x27')](_0x2ab1b9[_0xf3a4('0x1f')],['ids','id'])||{});}})[_0xf3a4('0x28')](function(_0xd7099){logger['info'](_0xf3a4('0x29'),_0x2ab1b9);logger[_0xf3a4('0x14')](_0xf3a4('0x29'),_0x2ab1b9,JSON[_0xf3a4('0x16')](_0xd7099));_0xc3ed1a(_0xd7099);})[_0xf3a4('0x1b')](function(_0x4acf6e){logger['error'](_0xf3a4('0x29'),_0x4acf6e[_0xf3a4('0x19')],_0x2ab1b9);_0x44f4f5(_this[_0xf3a4('0x17')](0x1f4,_0x4acf6e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a573f48..b9912e4 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 _0x1b15=['register','length','chatInteraction:','./chatInteraction.events','save','remove','emit'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x1b15,0x81));var _0x51b1=function(_0x5a4040,_0x10f3b0){_0x5a4040=_0x5a4040-0x0;var _0x122652=_0x1b15[_0x5a4040];return _0x122652;};'use strict';var ChatInteractionEvents=require(_0x51b1('0x0'));var events=[_0x51b1('0x1'),_0x51b1('0x2'),'update'];function createListener(_0x285f42,_0x77f306){return function(_0x638cc1){_0x77f306[_0x51b1('0x3')](_0x285f42,_0x638cc1);};}function removeListener(_0x30f3f9,_0x3c7805){return function(){ChatInteractionEvents['removeListener'](_0x30f3f9,_0x3c7805);};}exports[_0x51b1('0x4')]=function(_0x52f185){for(var _0x16d0a4=0x0,_0x46b3ea=events[_0x51b1('0x5')];_0x16d0a4<_0x46b3ea;_0x16d0a4++){var _0xe69605=events[_0x16d0a4];var _0x37d594=createListener(_0x51b1('0x6')+_0xe69605,_0x52f185);ChatInteractionEvents['on'](_0xe69605,_0x37d594);}}; \ No newline at end of file +var _0xe625=['emit','removeListener','register','length','./chatInteraction.events','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe625,0x1d2));var _0x5e62=function(_0x2580f5,_0x155628){_0x2580f5=_0x2580f5-0x0;var _0x598078=_0xe625[_0x2580f5];return _0x598078;};'use strict';var ChatInteractionEvents=require(_0x5e62('0x0'));var events=[_0x5e62('0x1'),'remove',_0x5e62('0x2')];function createListener(_0x15c438,_0x1b27ad){return function(_0x37ddb7){_0x1b27ad[_0x5e62('0x3')](_0x15c438,_0x37ddb7);};}function removeListener(_0x46cd96,_0xecf19c){return function(){ChatInteractionEvents[_0x5e62('0x4')](_0x46cd96,_0xecf19c);};}exports[_0x5e62('0x5')]=function(_0x4ca2a5){for(var _0x424812=0x0,_0x26bfef=events[_0x5e62('0x6')];_0x424812<_0x26bfef;_0x424812++){var _0x12a5a2=events[_0x424812];var _0x47bc79=createListener('chatInteraction:'+_0x12a5a2,_0x4ca2a5);ChatInteractionEvents['on'](_0x12a5a2,_0x47bc79);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a8d0e4a..2bf1857 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 _0x55fd=['describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','isAuthenticated'];(function(_0xc93fcf,_0x2db4fe){var _0x182f27=function(_0x26fd4b){while(--_0x26fd4b){_0xc93fcf['push'](_0xc93fcf['shift']());}};_0x182f27(++_0x2db4fe);}(_0x55fd,0x1ca));var _0xd55f=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x55fd[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require(_0xd55f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd55f('0x1'));var router=express['Router']();var fs_extra=require(_0xd55f('0x2'));var auth=require(_0xd55f('0x3'));var interaction=require(_0xd55f('0x4'));var config=require(_0xd55f('0x5'));var controller=require(_0xd55f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd55f('0x7')]);router[_0xd55f('0x8')]('/describe',auth[_0xd55f('0x9')](),controller[_0xd55f('0xa')]);router[_0xd55f('0x8')](_0xd55f('0xb'),auth[_0xd55f('0xc')](),controller[_0xd55f('0xd')]);router[_0xd55f('0x8')]('/:id/attachment_download',auth[_0xd55f('0xc')](),controller[_0xd55f('0xe')]);router[_0xd55f('0x8')](_0xd55f('0xf'),auth[_0xd55f('0x9')](),controller[_0xd55f('0x10')]);router['get'](_0xd55f('0x11'),auth[_0xd55f('0xc')](),controller['getMyMessages']);router[_0xd55f('0x8')](_0xd55f('0x12'),auth[_0xd55f('0x9')](),controller[_0xd55f('0x13')]);router['post']('/',auth[_0xd55f('0x9')](),controller[_0xd55f('0x14')]);router[_0xd55f('0x15')](_0xd55f('0x16'),auth[_0xd55f('0x9')](),controller[_0xd55f('0x17')]);var upload=multer({'storage':multer[_0xd55f('0x18')]({'destination':function(_0x24c030,_0x17d205,_0x1fb575){_0x1fb575(null,path[_0xd55f('0x19')](config[_0xd55f('0x1a')],_0xd55f('0x1b')));},'filename':function(_0x214eeb,_0x54c040,_0x22ba8e){_0x22ba8e(null,util[_0xd55f('0x1c')](_0xd55f('0x1d'),Date[_0xd55f('0x1e')](),_0x54c040['originalname'][_0xd55f('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xd55f('0x20'),upload[_0xd55f('0x21')](_0xd55f('0x22')),controller[_0xd55f('0x23')]);router[_0xd55f('0x15')](_0xd55f('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xd55f('0x24')]);router[_0xd55f('0x15')](_0xd55f('0x25'),auth[_0xd55f('0x9')](),interaction[_0xd55f('0x26')](_0xd55f('0x27'),_0xd55f('0x28')),controller['addTags']);router[_0xd55f('0x29')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xd55f('0x27'),_0xd55f('0x2a')),controller[_0xd55f('0x2b')]);router[_0xd55f('0x29')](_0xd55f('0x2c'),controller[_0xd55f('0x2d')]);router[_0xd55f('0x29')]('/:id/abandon',auth[_0xd55f('0xc')](),controller[_0xd55f('0x2e')]);router[_0xd55f('0x29')](_0xd55f('0x2f'),controller[_0xd55f('0x30')]);router[_0xd55f('0x31')](_0xd55f('0xb'),auth[_0xd55f('0x9')](),interaction[_0xd55f('0x26')]('chat',_0xd55f('0x32')),controller['destroy']);router[_0xd55f('0x31')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd55f('0x33')]);module['exports']=router; \ No newline at end of file +var _0xc52e=['close','chat','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','getMyMessages','isAuthenticated','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','originalname','/:id/attachment_upload','single','/:id/messages','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xc52e,0x172));var _0xec52=function(_0x2f6d16,_0x516c0c){_0x2f6d16=_0x2f6d16-0x0;var _0xf706a=_0xc52e[_0x2f6d16];return _0xf706a;};'use strict';var multer=require(_0xec52('0x0'));var util=require(_0xec52('0x1'));var path=require(_0xec52('0x2'));var timeout=require(_0xec52('0x3'));var express=require(_0xec52('0x4'));var router=express[_0xec52('0x5')]();var fs_extra=require(_0xec52('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xec52('0x7'));var config=require(_0xec52('0x8'));var controller=require(_0xec52('0x9'));router[_0xec52('0xa')]('/',auth['isAuthenticated'](),controller[_0xec52('0xb')]);router[_0xec52('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xec52('0xc')]);router['get']('/:id',auth[_0xec52('0xd')](),controller[_0xec52('0xe')]);router[_0xec52('0xa')](_0xec52('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xec52('0x10')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xec52('0x11')]);router['get']('/:id/my_messages',auth[_0xec52('0xd')](),controller[_0xec52('0x12')]);router[_0xec52('0xa')]('/:id/download',auth[_0xec52('0x13')](),controller[_0xec52('0x14')]);router[_0xec52('0x15')]('/',auth[_0xec52('0x13')](),controller[_0xec52('0x16')]);router[_0xec52('0x15')](_0xec52('0x17'),auth[_0xec52('0x13')](),controller[_0xec52('0x18')]);var upload=multer({'storage':multer[_0xec52('0x19')]({'destination':function(_0x4ca925,_0x29c796,_0x20752a){_0x20752a(null,path[_0xec52('0x1a')](config[_0xec52('0x1b')],_0xec52('0x1c')));},'filename':function(_0x2b35de,_0x1493d9,_0x298749){_0x298749(null,util[_0xec52('0x1d')](_0xec52('0x1e'),Date['now'](),_0x1493d9[_0xec52('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xec52('0x15')](_0xec52('0x20'),upload[_0xec52('0x21')]('file'),controller['attachmentUpload']);router[_0xec52('0x15')](_0xec52('0x22'),auth[_0xec52('0xd')](),controller[_0xec52('0x23')]);router['post'](_0xec52('0x24'),auth['isAuthenticated'](),interaction[_0xec52('0x25')]('chat',_0xec52('0x26')),controller['addTags']);router[_0xec52('0x27')](_0xec52('0x28'),auth[_0xec52('0x13')](),interaction['tracked']('chat',_0xec52('0x29')),controller[_0xec52('0x2a')]);router[_0xec52('0x27')](_0xec52('0x2b'),controller[_0xec52('0x2c')]);router[_0xec52('0x27')](_0xec52('0x2d'),auth[_0xec52('0xd')](),controller['abandon']);router['put']('/:id/close',controller[_0xec52('0x2e')]);router['delete'](_0xec52('0x28'),auth['isAuthenticated'](),interaction[_0xec52('0x25')](_0xec52('0x2f'),'chatinteraction:destroy'),controller[_0xec52('0x30')]);router[_0xec52('0x31')](_0xec52('0x24'),auth[_0xec52('0x13')](),controller[_0xec52('0x32')]);module[_0xec52('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 ae9973f..d9c2fce 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 _0x4c84=['sequelize','TEXT','medium'];(function(_0x29be19,_0x1f63c5){var _0x212385=function(_0x389450){while(--_0x389450){_0x29be19['push'](_0x29be19['shift']());}};_0x212385(++_0x1f63c5);}(_0x4c84,0xe4));var _0x44c8=function(_0x3fab48,_0x1d55ea){_0x3fab48=_0x3fab48-0x0;var _0x11dd8d=_0x4c84[_0x3fab48];return _0x11dd8d;};'use strict';var Sequelize=require(_0x44c8('0x0'));module['exports']={'body':{'type':Sequelize[_0x44c8('0x1')](_0x44c8('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x712c=['INTEGER','sequelize','TEXT','medium'];(function(_0x1a20ec,_0x27626c){var _0x3a2ec1=function(_0xb45d54){while(--_0xb45d54){_0x1a20ec['push'](_0x1a20ec['shift']());}};_0x3a2ec1(++_0x27626c);}(_0x712c,0x1c9));var _0xc712=function(_0x35c2e4,_0x151b64){_0x35c2e4=_0x35c2e4-0x0;var _0x1abee7=_0x712c[_0x35c2e4];return _0x1abee7;};'use strict';var Sequelize=require(_0xc712('0x0'));module['exports']={'body':{'type':Sequelize[_0xc712('0x1')](_0xc712('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc712('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f4d26ff..781bbe4 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 _0xe83e=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','role','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','all','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','query','keys','filters','intersection','model'];(function(_0x4bacd2,_0x465d39){var _0x312fe7=function(_0x5916c7){while(--_0x5916c7){_0x4bacd2['push'](_0x4bacd2['shift']());}};_0x312fe7(++_0x465d39);}(_0xe83e,0x180));var _0xee83=function(_0x245500,_0x3ece34){_0x245500=_0x245500-0x0;var _0x3d934c=_0xe83e[_0x245500];return _0x3d934c;};'use strict';var emlformat=require(_0xee83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee83('0x1'));var jsonpatch=require(_0xee83('0x2'));var rp=require(_0xee83('0x3'));var moment=require('moment');var BPromise=require(_0xee83('0x4'));var Mustache=require(_0xee83('0x5'));var util=require('util');var path=require(_0xee83('0x6'));var sox=require('sox');var csv=require(_0xee83('0x7'));var ejs=require(_0xee83('0x8'));var fs=require('fs');var fs_extra=require(_0xee83('0x9'));var _=require('lodash');var squel=require(_0xee83('0xa'));var crypto=require(_0xee83('0xb'));var jsforce=require(_0xee83('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xee83('0xd'));var Papa=require(_0xee83('0xe'));var Redis=require(_0xee83('0xf'));var authService=require(_0xee83('0x10'));var qs=require(_0xee83('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xee83('0x12'))(_0xee83('0x13'));var utils=require(_0xee83('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xee83('0x15'));var db=require(_0xee83('0x16'))['db'];config['redis']=_[_0xee83('0x17')](config['redis'],{'host':_0xee83('0x18'),'port':0x18eb});var socket=require(_0xee83('0x19'))(new Redis(config[_0xee83('0x1a')]));require('./chatInternalMessage.socket')[_0xee83('0x1b')](socket);function respondWithStatusCode(_0x454712,_0x1c3f45){_0x1c3f45=_0x1c3f45||0xcc;return function(_0x405c58){if(_0x405c58){return _0x454712[_0xee83('0x1c')](_0x1c3f45);}return _0x454712[_0xee83('0x1d')](_0x1c3f45)[_0xee83('0x1e')]();};}function respondWithResult(_0x474b25,_0x4ab994){_0x4ab994=_0x4ab994||0xc8;return function(_0x4c04ad){if(_0x4c04ad){return _0x474b25[_0xee83('0x1d')](_0x4ab994)[_0xee83('0x1f')](_0x4c04ad);}};}function respondWithFilteredResult(_0x1a647f,_0x19e9d4){return function(_0x7f12c0){if(_0x7f12c0){var _0x54ac2e=typeof _0x19e9d4['offset']===_0xee83('0x20')&&typeof _0x19e9d4[_0xee83('0x21')]===_0xee83('0x20');var _0xded38f=_0x7f12c0[_0xee83('0x22')];var _0x2538d3=_0x54ac2e?0x0:_0x19e9d4['offset'];var _0x10ccbc=_0x54ac2e?_0x7f12c0[_0xee83('0x22')]:_0x19e9d4[_0xee83('0x23')]+_0x19e9d4[_0xee83('0x21')];var _0x21a834;if(_0x10ccbc>=_0xded38f){_0x10ccbc=_0xded38f;_0x21a834=0xc8;}else{_0x21a834=0xce;}_0x1a647f['status'](_0x21a834);return _0x1a647f[_0xee83('0x24')](_0xee83('0x25'),_0x2538d3+'-'+_0x10ccbc+'/'+_0xded38f)[_0xee83('0x1f')](_0x7f12c0);}return null;};}function patchUpdates(_0x37a710){return function(_0x569e84){try{jsonpatch[_0xee83('0x26')](_0x569e84,_0x37a710,!![]);}catch(_0x1cd001){return BPromise['reject'](_0x1cd001);}return _0x569e84['save']();};}function saveUpdates(_0x2d2c12,_0xffce18){return function(_0x3f9406){if(_0x3f9406){return _0x3f9406[_0xee83('0x27')](_0x2d2c12)[_0xee83('0x28')](function(_0x53c7b2){return _0x53c7b2;});}return null;};}function removeEntity(_0x1cb295,_0x343bef){return function(_0x4fcae2){if(_0x4fcae2){return _0x4fcae2['destroy']()[_0xee83('0x28')](function(){_0x1cb295[_0xee83('0x1d')](0xcc)[_0xee83('0x1e')]();});}};}function handleEntityNotFound(_0x1c98f5,_0x220936){return function(_0x293848){if(!_0x293848){_0x1c98f5[_0xee83('0x1c')](0x194);}return _0x293848;};}function handleError(_0x14a189,_0x3a1d){_0x3a1d=_0x3a1d||0x1f4;return function(_0x58cf36){logger[_0xee83('0x29')](_0x58cf36[_0xee83('0x2a')]);if(_0x58cf36[_0xee83('0x2b')]){delete _0x58cf36[_0xee83('0x2b')];}_0x14a189[_0xee83('0x1d')](_0x3a1d)[_0xee83('0x2c')](_0x58cf36);};}exports[_0xee83('0x2d')]=function(_0x453d7a,_0x1cf2da){var _0x4c6197={},_0x24bf0b={},_0x4cc5ee={'count':0x0,'rows':[]};var _0x4f0314=_[_0xee83('0x2e')](db[_0xee83('0x2f')][_0xee83('0x30')],function(_0x26b004){return{'name':_0x26b004['fieldName'],'type':_0x26b004[_0xee83('0x31')][_0xee83('0x32')]};});_0x24bf0b['model']=_[_0xee83('0x2e')](_0x4f0314,_0xee83('0x2b'));_0x24bf0b[_0xee83('0x33')]=_[_0xee83('0x34')](_0x453d7a[_0xee83('0x33')]);_0x24bf0b[_0xee83('0x35')]=_[_0xee83('0x36')](_0x24bf0b[_0xee83('0x37')],_0x24bf0b[_0xee83('0x33')]);_0x4c6197[_0xee83('0x38')]=_[_0xee83('0x36')](_0x24bf0b[_0xee83('0x37')],qs[_0xee83('0x39')](_0x453d7a[_0xee83('0x33')][_0xee83('0x39')]));_0x4c6197[_0xee83('0x38')]=_0x4c6197['attributes'][_0xee83('0x3a')]?_0x4c6197['attributes']:_0x24bf0b['model'];if(!_0x453d7a[_0xee83('0x33')][_0xee83('0x3b')](_0xee83('0x3c'))){_0x4c6197[_0xee83('0x21')]=qs[_0xee83('0x21')](_0x453d7a['query'][_0xee83('0x21')]);_0x4c6197[_0xee83('0x23')]=qs['offset'](_0x453d7a[_0xee83('0x33')][_0xee83('0x23')]);}_0x4c6197[_0xee83('0x3d')]=qs[_0xee83('0x3e')](_0x453d7a['query'][_0xee83('0x3e')]);_0x4c6197[_0xee83('0x3f')]=qs[_0xee83('0x35')](_['pick'](_0x453d7a[_0xee83('0x33')],_0x24bf0b[_0xee83('0x35')]),_0x4f0314);if(_0x453d7a['query']['filter']){_0x4c6197[_0xee83('0x3f')]=_[_0xee83('0x40')](_0x4c6197[_0xee83('0x3f')],{'$or':_[_0xee83('0x2e')](_0x4f0314,function(_0x75d624){if(_0x75d624[_0xee83('0x31')]!=='VIRTUAL'){var _0x4567b0={};_0x4567b0[_0x75d624[_0xee83('0x2b')]]={'$like':'%'+_0x453d7a[_0xee83('0x33')][_0xee83('0x41')]+'%'};return _0x4567b0;}})});}_0x4c6197=_['merge']({},_0x4c6197,_0x453d7a[_0xee83('0x42')]);var _0x1e6808={'where':_0x4c6197['where']};return db[_0xee83('0x2f')][_0xee83('0x22')](_0x1e6808)[_0xee83('0x28')](function(_0x2eddfa){_0x4cc5ee['count']=_0x2eddfa;if(_0x453d7a[_0xee83('0x33')][_0xee83('0x43')]){_0x4c6197[_0xee83('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xee83('0x45')](_0x4c6197);})[_0xee83('0x28')](function(_0x1734f3){_0x4cc5ee[_0xee83('0x46')]=_0x1734f3;return _0x4cc5ee;})['then'](respondWithFilteredResult(_0x1cf2da,_0x4c6197))[_0xee83('0x47')](handleError(_0x1cf2da,null));};exports['show']=function(_0x486588,_0x5d13f8){var _0x230136={'raw':!![],'where':{'id':_0x486588[_0xee83('0x48')]['id']}},_0x1d0dd5={};_0x1d0dd5['model']=_['keys'](db[_0xee83('0x2f')][_0xee83('0x30')]);_0x1d0dd5[_0xee83('0x33')]=_[_0xee83('0x34')](_0x486588[_0xee83('0x33')]);_0x1d0dd5[_0xee83('0x35')]=_[_0xee83('0x36')](_0x1d0dd5[_0xee83('0x37')],_0x1d0dd5['query']);_0x230136['attributes']=_[_0xee83('0x36')](_0x1d0dd5[_0xee83('0x37')],qs['fields'](_0x486588[_0xee83('0x33')]['fields']));_0x230136[_0xee83('0x38')]=_0x230136[_0xee83('0x38')][_0xee83('0x3a')]?_0x230136[_0xee83('0x38')]:_0x1d0dd5['model'];if(_0x486588[_0xee83('0x33')][_0xee83('0x43')]){_0x230136[_0xee83('0x44')]=[{'all':!![]}];}_0x230136=_[_0xee83('0x40')]({},_0x230136,_0x486588[_0xee83('0x42')]);return db['ChatInternalMessage'][_0xee83('0x49')](_0x230136)[_0xee83('0x28')](handleEntityNotFound(_0x5d13f8,null))[_0xee83('0x28')](respondWithResult(_0x5d13f8,null))[_0xee83('0x47')](handleError(_0x5d13f8,null));};exports['create']=function(_0x5ee57c,_0x1d2efc){return db[_0xee83('0x2f')][_0xee83('0x4a')](_0x5ee57c[_0xee83('0x4b')],{})[_0xee83('0x28')](respondWithResult(_0x1d2efc,0xc9))[_0xee83('0x47')](handleError(_0x1d2efc,null));};exports[_0xee83('0x27')]=function(_0x1c490c,_0x5b1fd2){if(_0x1c490c[_0xee83('0x4b')]['id']){delete _0x1c490c[_0xee83('0x4b')]['id'];}return db[_0xee83('0x2f')][_0xee83('0x49')]({'where':{'id':_0x1c490c['params']['id']}})[_0xee83('0x28')](handleEntityNotFound(_0x5b1fd2,null))[_0xee83('0x28')](saveUpdates(_0x1c490c[_0xee83('0x4b')],null))[_0xee83('0x28')](respondWithResult(_0x5b1fd2,null))['catch'](handleError(_0x5b1fd2,null));};exports[_0xee83('0x4c')]=function(_0x4e6604,_0x5ce878){return db[_0xee83('0x2f')][_0xee83('0x49')]({'where':{'id':_0x4e6604[_0xee83('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ce878,null))[_0xee83('0x28')](removeEntity(_0x5ce878,null))[_0xee83('0x47')](handleError(_0x5ce878,null));};exports[_0xee83('0x4d')]=function(_0x360c58,_0x1f0cef){return db['ChatInternalMessage']['describe']()[_0xee83('0x28')](respondWithResult(_0x1f0cef,null))['catch'](handleError(_0x1f0cef,null));};function wrapUser(_0x126448){return function(_0x5e6b38){var _0x2fbc97=_0x126448[_0xee83('0x4e')]({'plain':!![]});_0x2fbc97[_0xee83('0x4f')]=[];if(_0x5e6b38){_0x2fbc97[_0xee83('0x50')]=_0x5e6b38[_0xee83('0x51')];_0x2fbc97[_0xee83('0x52')]=_0x5e6b38;}else{_0x2fbc97[_0xee83('0x50')]=moment(0x0)[_0xee83('0x53')](_0xee83('0x54'));_0x2fbc97['lastMessage']={};}return _0x2fbc97;};}exports[_0xee83('0x55')]=function(_0x24cba2,_0x580445,_0x593cee){var _0x2c5c7d=[];return db[_0xee83('0x56')]['findAll']({'where':{'role':[_0xee83('0x57'),_0xee83('0x58'),_0xee83('0x59')]},'attributes':['id',_0xee83('0x5a'),_0xee83('0x2b'),'role',_0xee83('0x5b'),_0xee83('0x5c'),_0xee83('0x5d'),'lastLoginAt',_0xee83('0x5e'),_0xee83('0x5f')],'order':qs['sort'](_0xee83('0x60')),'include':[{'model':db[_0xee83('0x61')],'as':_0xee83('0x62'),'attributes':['id',_0xee83('0x2b'),_0xee83('0x31')],'through':{'attributes':[]}}]})['then'](function(_0x495500){if(_0x495500){var _0x52bd87=_0x24cba2[_0xee83('0x59')]['get']({'plain':!![]});if(!_0x52bd87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52bd87[_0xee83('0x63')]===_0xee83('0x59')){return db['UserProfileSection'][_0xee83('0x49')]({'where':{'name':_0xee83('0x64'),'userProfileId':_0x52bd87[_0xee83('0x65')]},'raw':!![]})[_0xee83('0x28')](function(_0x9812fb){if(_0x9812fb){if(_0x9812fb['autoAssociation']===0x0){return db[_0xee83('0x66')][_0xee83('0x45')]({'where':{'sectionId':_0x9812fb['id']},'raw':!![]})[_0xee83('0x28')](function(_0x47f6fe){var _0x3833b4=[];if(_[_0xee83('0x67')](_0x47f6fe)){_0x3833b4=_['filter'](_0x495500,function(_0x2a7412){if(_0x2a7412['role']!==_0xee83('0x57')){return _0x2a7412;}});return _0x3833b4;}else{for(var _0x1598be=0x0;_0x1598be<_0x495500['length'];_0x1598be++){var _0x1583cc=_0x495500[_0x1598be];if(_0x1583cc['role']===_0xee83('0x57')){var _0x4e68bc=_[_0xee83('0x49')](_0x47f6fe,function(_0x1fdc02){return _0x1fdc02[_0xee83('0x68')]===_0x1583cc['id'];});if(_0x4e68bc)_0x3833b4[_0xee83('0x69')](_0x1583cc);}else{_0x3833b4['push'](_0x1583cc);}}return _0x3833b4;}});}else{return _0x495500;}}else{var _0x852979=_[_0xee83('0x41')](_0x495500,function(_0x3c370a){if(_0x3c370a[_0xee83('0x63')]!==_0xee83('0x57')){return _0x3c370a;}});return _0x852979;}});}else{return _0x495500;}}})['then'](function(_0x20b137){var _0x37b380=[];if(_0x20b137){_0x2c5c7d=_0x20b137;for(var _0x3204d7=0x0;_0x3204d7<_0x20b137[_0xee83('0x3a')];_0x3204d7+=0x1){_0x2c5c7d[_0x3204d7]['messages']=[];_0x37b380['push'](db[_0xee83('0x2f')][_0xee83('0x49')]({'where':{'FromId':[_0x24cba2[_0xee83('0x59')]['id'],_0x20b137[_0x3204d7]['id']],'ToId':[_0x24cba2[_0xee83('0x59')]['id'],_0x20b137[_0x3204d7]['id']],'ChatGroupId':null},'attributes':['id',_0xee83('0x51'),_0xee83('0x6a'),_0xee83('0x6b'),_0xee83('0x6c'),'body'],'order':qs[_0xee83('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xee83('0x28')](wrapUser(_0x20b137[_0x3204d7])));}return BPromise[_0xee83('0x6d')](_0x37b380);}return[];})[_0xee83('0x28')](function(_0xcb12d9){return{'rows':_0xcb12d9,'count':_0xcb12d9[_0xee83('0x3a')]};})[_0xee83('0x28')](respondWithResult(_0x580445,null))['catch'](handleError(_0x580445,null));}; \ No newline at end of file +var _0xeecc=['read','-createdAt','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','sendStatus','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','update','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','findAll','admin','user','fullname','internal','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','isEmpty','role','agent','push','FromId','ToId'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xeecc,0x1aa));var _0xceec=function(_0x2467b8,_0x584199){_0x2467b8=_0x2467b8-0x0;var _0x5d3095=_0xeecc[_0x2467b8];return _0x5d3095;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xceec('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xceec('0x1'));var rp=require(_0xceec('0x2'));var moment=require(_0xceec('0x3'));var BPromise=require(_0xceec('0x4'));var Mustache=require(_0xceec('0x5'));var util=require(_0xceec('0x6'));var path=require(_0xceec('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xceec('0x8'));var fs=require('fs');var fs_extra=require(_0xceec('0x9'));var _=require(_0xceec('0xa'));var squel=require(_0xceec('0xb'));var crypto=require(_0xceec('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xceec('0xd'));var toCsv=require('to-csv');var querystring=require(_0xceec('0xe'));var Papa=require(_0xceec('0xf'));var Redis=require(_0xceec('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xceec('0x11'));var as=require(_0xceec('0x12'));var hardwareService=require(_0xceec('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xceec('0x14'));var config=require(_0xceec('0x15'));var licenseUtil=require(_0xceec('0x16'));var db=require(_0xceec('0x17'))['db'];config[_0xceec('0x18')]=_[_0xceec('0x19')](config[_0xceec('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xceec('0x1a'))(new Redis(config[_0xceec('0x18')]));require(_0xceec('0x1b'))['register'](socket);function respondWithStatusCode(_0xf1cf3d,_0x11b727){_0x11b727=_0x11b727||0xcc;return function(_0x43feff){if(_0x43feff){return _0xf1cf3d['sendStatus'](_0x11b727);}return _0xf1cf3d[_0xceec('0x1c')](_0x11b727)[_0xceec('0x1d')]();};}function respondWithResult(_0x5abbb0,_0x2dec3c){_0x2dec3c=_0x2dec3c||0xc8;return function(_0x1ddd70){if(_0x1ddd70){return _0x5abbb0[_0xceec('0x1c')](_0x2dec3c)[_0xceec('0x1e')](_0x1ddd70);}};}function respondWithFilteredResult(_0x39ba50,_0x383cf1){return function(_0x5d4985){if(_0x5d4985){var _0x1ed121=typeof _0x383cf1[_0xceec('0x1f')]===_0xceec('0x20')&&typeof _0x383cf1[_0xceec('0x21')]===_0xceec('0x20');var _0x108ac4=_0x5d4985[_0xceec('0x22')];var _0x4d3ba5=_0x1ed121?0x0:_0x383cf1[_0xceec('0x1f')];var _0x56cec0=_0x1ed121?_0x5d4985['count']:_0x383cf1[_0xceec('0x1f')]+_0x383cf1[_0xceec('0x21')];var _0x1f34d8;if(_0x56cec0>=_0x108ac4){_0x56cec0=_0x108ac4;_0x1f34d8=0xc8;}else{_0x1f34d8=0xce;}_0x39ba50[_0xceec('0x1c')](_0x1f34d8);return _0x39ba50[_0xceec('0x23')]('Content-Range',_0x4d3ba5+'-'+_0x56cec0+'/'+_0x108ac4)[_0xceec('0x1e')](_0x5d4985);}return null;};}function patchUpdates(_0x1045ad){return function(_0x35e66a){try{jsonpatch['apply'](_0x35e66a,_0x1045ad,!![]);}catch(_0x2dea8f){return BPromise[_0xceec('0x24')](_0x2dea8f);}return _0x35e66a[_0xceec('0x25')]();};}function saveUpdates(_0x152eec,_0x19391a){return function(_0x17a29b){if(_0x17a29b){return _0x17a29b['update'](_0x152eec)[_0xceec('0x26')](function(_0x509047){return _0x509047;});}return null;};}function removeEntity(_0x3f0442,_0x4e3a75){return function(_0xa8a7db){if(_0xa8a7db){return _0xa8a7db[_0xceec('0x27')]()[_0xceec('0x26')](function(){_0x3f0442['status'](0xcc)[_0xceec('0x1d')]();});}};}function handleEntityNotFound(_0x501d07,_0xb94b2e){return function(_0x3e2e0e){if(!_0x3e2e0e){_0x501d07[_0xceec('0x28')](0x194);}return _0x3e2e0e;};}function handleError(_0x5a681d,_0x9f324c){_0x9f324c=_0x9f324c||0x1f4;return function(_0x3469c5){logger['error'](_0x3469c5[_0xceec('0x29')]);if(_0x3469c5[_0xceec('0x2a')]){delete _0x3469c5[_0xceec('0x2a')];}_0x5a681d['status'](_0x9f324c)[_0xceec('0x2b')](_0x3469c5);};}exports[_0xceec('0x2c')]=function(_0x3121a5,_0x549436){var _0x98553d={},_0x247d4f={},_0x1079c1={'count':0x0,'rows':[]};var _0xa60050=_[_0xceec('0x2d')](db[_0xceec('0x2e')][_0xceec('0x2f')],function(_0x4c0058){return{'name':_0x4c0058[_0xceec('0x30')],'type':_0x4c0058[_0xceec('0x31')][_0xceec('0x32')]};});_0x247d4f[_0xceec('0x33')]=_[_0xceec('0x2d')](_0xa60050,'name');_0x247d4f[_0xceec('0x34')]=_[_0xceec('0x35')](_0x3121a5[_0xceec('0x34')]);_0x247d4f['filters']=_[_0xceec('0x36')](_0x247d4f[_0xceec('0x33')],_0x247d4f[_0xceec('0x34')]);_0x98553d[_0xceec('0x37')]=_['intersection'](_0x247d4f[_0xceec('0x33')],qs['fields'](_0x3121a5[_0xceec('0x34')][_0xceec('0x38')]));_0x98553d[_0xceec('0x37')]=_0x98553d[_0xceec('0x37')][_0xceec('0x39')]?_0x98553d[_0xceec('0x37')]:_0x247d4f[_0xceec('0x33')];if(!_0x3121a5[_0xceec('0x34')]['hasOwnProperty'](_0xceec('0x3a'))){_0x98553d[_0xceec('0x21')]=qs[_0xceec('0x21')](_0x3121a5[_0xceec('0x34')][_0xceec('0x21')]);_0x98553d[_0xceec('0x1f')]=qs[_0xceec('0x1f')](_0x3121a5[_0xceec('0x34')][_0xceec('0x1f')]);}_0x98553d[_0xceec('0x3b')]=qs['sort'](_0x3121a5[_0xceec('0x34')][_0xceec('0x3c')]);_0x98553d[_0xceec('0x3d')]=qs[_0xceec('0x3e')](_[_0xceec('0x3f')](_0x3121a5[_0xceec('0x34')],_0x247d4f[_0xceec('0x3e')]),_0xa60050);if(_0x3121a5[_0xceec('0x34')][_0xceec('0x40')]){_0x98553d['where']=_[_0xceec('0x41')](_0x98553d[_0xceec('0x3d')],{'$or':_[_0xceec('0x2d')](_0xa60050,function(_0x5abc72){if(_0x5abc72[_0xceec('0x31')]!==_0xceec('0x42')){var _0x101af4={};_0x101af4[_0x5abc72[_0xceec('0x2a')]]={'$like':'%'+_0x3121a5[_0xceec('0x34')][_0xceec('0x40')]+'%'};return _0x101af4;}})});}_0x98553d=_['merge']({},_0x98553d,_0x3121a5[_0xceec('0x43')]);var _0x5287c2={'where':_0x98553d['where']};return db[_0xceec('0x2e')][_0xceec('0x22')](_0x5287c2)[_0xceec('0x26')](function(_0x5b9b33){_0x1079c1['count']=_0x5b9b33;if(_0x3121a5[_0xceec('0x34')][_0xceec('0x44')]){_0x98553d[_0xceec('0x45')]=[{'all':!![]}];}return db[_0xceec('0x2e')]['findAll'](_0x98553d);})[_0xceec('0x26')](function(_0x7d8476){_0x1079c1[_0xceec('0x46')]=_0x7d8476;return _0x1079c1;})[_0xceec('0x26')](respondWithFilteredResult(_0x549436,_0x98553d))[_0xceec('0x47')](handleError(_0x549436,null));};exports['show']=function(_0x514b0c,_0x36d274){var _0x5defab={'raw':!![],'where':{'id':_0x514b0c[_0xceec('0x48')]['id']}},_0x8d253e={};_0x8d253e[_0xceec('0x33')]=_[_0xceec('0x35')](db[_0xceec('0x2e')][_0xceec('0x2f')]);_0x8d253e['query']=_[_0xceec('0x35')](_0x514b0c[_0xceec('0x34')]);_0x8d253e[_0xceec('0x3e')]=_[_0xceec('0x36')](_0x8d253e[_0xceec('0x33')],_0x8d253e[_0xceec('0x34')]);_0x5defab[_0xceec('0x37')]=_[_0xceec('0x36')](_0x8d253e[_0xceec('0x33')],qs['fields'](_0x514b0c[_0xceec('0x34')][_0xceec('0x38')]));_0x5defab[_0xceec('0x37')]=_0x5defab[_0xceec('0x37')][_0xceec('0x39')]?_0x5defab['attributes']:_0x8d253e['model'];if(_0x514b0c[_0xceec('0x34')][_0xceec('0x44')]){_0x5defab['include']=[{'all':!![]}];}_0x5defab=_['merge']({},_0x5defab,_0x514b0c[_0xceec('0x43')]);return db[_0xceec('0x2e')][_0xceec('0x49')](_0x5defab)[_0xceec('0x26')](handleEntityNotFound(_0x36d274,null))['then'](respondWithResult(_0x36d274,null))[_0xceec('0x47')](handleError(_0x36d274,null));};exports['create']=function(_0x27ad2b,_0xf0fb70){return db[_0xceec('0x2e')][_0xceec('0x4a')](_0x27ad2b[_0xceec('0x4b')],{})[_0xceec('0x26')](respondWithResult(_0xf0fb70,0xc9))['catch'](handleError(_0xf0fb70,null));};exports[_0xceec('0x4c')]=function(_0xc53f26,_0x473956){if(_0xc53f26['body']['id']){delete _0xc53f26['body']['id'];}return db[_0xceec('0x2e')]['find']({'where':{'id':_0xc53f26[_0xceec('0x48')]['id']}})[_0xceec('0x26')](handleEntityNotFound(_0x473956,null))['then'](saveUpdates(_0xc53f26[_0xceec('0x4b')],null))['then'](respondWithResult(_0x473956,null))['catch'](handleError(_0x473956,null));};exports['destroy']=function(_0x4f7f42,_0x4100d9){return db[_0xceec('0x2e')][_0xceec('0x49')]({'where':{'id':_0x4f7f42[_0xceec('0x48')]['id']}})[_0xceec('0x26')](handleEntityNotFound(_0x4100d9,null))[_0xceec('0x26')](removeEntity(_0x4100d9,null))[_0xceec('0x47')](handleError(_0x4100d9,null));};exports[_0xceec('0x4d')]=function(_0x5a8a8f,_0x2b0a0f){return db['ChatInternalMessage']['describe']()[_0xceec('0x26')](respondWithResult(_0x2b0a0f,null))[_0xceec('0x47')](handleError(_0x2b0a0f,null));};function wrapUser(_0x59ffc7){return function(_0x404160){var _0x183dd7=_0x59ffc7[_0xceec('0x4e')]({'plain':!![]});_0x183dd7[_0xceec('0x4f')]=[];if(_0x404160){_0x183dd7[_0xceec('0x50')]=_0x404160[_0xceec('0x51')];_0x183dd7[_0xceec('0x52')]=_0x404160;}else{_0x183dd7[_0xceec('0x50')]=moment(0x0)[_0xceec('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x183dd7[_0xceec('0x52')]={};}return _0x183dd7;};}exports[_0xceec('0x54')]=function(_0x26e618,_0x13966d,_0x540c73){var _0x47d25c=[];return db['User'][_0xceec('0x55')]({'where':{'role':['agent',_0xceec('0x56'),_0xceec('0x57')]},'attributes':['id',_0xceec('0x58'),_0xceec('0x2a'),'role','userpic',_0xceec('0x59'),'online',_0xceec('0x5a'),_0xceec('0x5b'),'showWebBar'],'order':qs[_0xceec('0x3c')](_0xceec('0x5c')),'include':[{'model':db[_0xceec('0x5d')],'as':_0xceec('0x5e'),'attributes':['id',_0xceec('0x2a'),_0xceec('0x31')],'through':{'attributes':[]}}]})[_0xceec('0x26')](function(_0x5c200a){if(_0x5c200a){var _0x47f5d7=_0x26e618[_0xceec('0x57')]['get']({'plain':!![]});if(!_0x47f5d7)throw new Error(_0xceec('0x5f'));if(_0x47f5d7['role']===_0xceec('0x57')){return db[_0xceec('0x60')][_0xceec('0x49')]({'where':{'name':'Agents','userProfileId':_0x47f5d7['userProfileId']},'raw':!![]})['then'](function(_0x36da37){if(_0x36da37){if(_0x36da37['autoAssociation']===0x0){return db[_0xceec('0x61')][_0xceec('0x55')]({'where':{'sectionId':_0x36da37['id']},'raw':!![]})['then'](function(_0x34fbc8){var _0xd6739=[];if(_[_0xceec('0x62')](_0x34fbc8)){_0xd6739=_['filter'](_0x5c200a,function(_0xbff624){if(_0xbff624[_0xceec('0x63')]!==_0xceec('0x64')){return _0xbff624;}});return _0xd6739;}else{for(var _0x2450ba=0x0;_0x2450ba<_0x5c200a[_0xceec('0x39')];_0x2450ba++){var _0x5298a8=_0x5c200a[_0x2450ba];if(_0x5298a8['role']===_0xceec('0x64')){var _0x22aa61=_[_0xceec('0x49')](_0x34fbc8,function(_0x476f83){return _0x476f83['resourceId']===_0x5298a8['id'];});if(_0x22aa61)_0xd6739[_0xceec('0x65')](_0x5298a8);}else{_0xd6739[_0xceec('0x65')](_0x5298a8);}}return _0xd6739;}});}else{return _0x5c200a;}}else{var _0x334ead=_[_0xceec('0x40')](_0x5c200a,function(_0x3015fa){if(_0x3015fa[_0xceec('0x63')]!=='agent'){return _0x3015fa;}});return _0x334ead;}});}else{return _0x5c200a;}}})[_0xceec('0x26')](function(_0x16a2b7){var _0x3b439a=[];if(_0x16a2b7){_0x47d25c=_0x16a2b7;for(var _0x3dab70=0x0;_0x3dab70<_0x16a2b7['length'];_0x3dab70+=0x1){_0x47d25c[_0x3dab70]['messages']=[];_0x3b439a[_0xceec('0x65')](db[_0xceec('0x2e')][_0xceec('0x49')]({'where':{'FromId':[_0x26e618[_0xceec('0x57')]['id'],_0x16a2b7[_0x3dab70]['id']],'ToId':[_0x26e618['user']['id'],_0x16a2b7[_0x3dab70]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xceec('0x66'),_0xceec('0x67'),_0xceec('0x68'),_0xceec('0x4b')],'order':qs[_0xceec('0x3c')](_0xceec('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x16a2b7[_0x3dab70])));}return BPromise['all'](_0x3b439a);}return[];})[_0xceec('0x26')](function(_0x56177a){return{'rows':_0x56177a,'count':_0x56177a[_0xceec('0x39')]};})[_0xceec('0x26')](respondWithResult(_0x13966d,null))[_0xceec('0x47')](handleError(_0x13966d,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 17f92d2..85ab2cf 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 _0x5d2e=['events','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3e0bb2,_0x400cd6){var _0x476100=function(_0x315174){while(--_0x315174){_0x3e0bb2['push'](_0x3e0bb2['shift']());}};_0x476100(++_0x400cd6);}(_0x5d2e,0x120));var _0xe5d2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5d2e[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require(_0xe5d2('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xe5d2('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe5d2('0x2')](0x0);var events={'afterCreate':_0xe5d2('0x3'),'afterUpdate':'update','afterDestroy':_0xe5d2('0x4')};function emitEvent(_0x57c20a){return function(_0x17c2d2,_0x253eff,_0x159287){ChatInternalMessageEvents[_0xe5d2('0x5')](_0x57c20a+':'+_0x17c2d2['id'],_0x17c2d2);ChatInternalMessageEvents[_0xe5d2('0x5')](_0x57c20a,_0x17c2d2);_0x159287(null);};}for(var e in events){if(events[_0xe5d2('0x6')](e)){var event=events[e];ChatInternalMessage[_0xe5d2('0x7')](e,emitEvent(event));}}module[_0xe5d2('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1053=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x43754e,_0x185d0d){var _0x892380=function(_0x351fa7){while(--_0x351fa7){_0x43754e['push'](_0x43754e['shift']());}};_0x892380(++_0x185d0d);}(_0x1053,0xd5));var _0x3105=function(_0x1b1ce5,_0x508743){_0x1b1ce5=_0x1b1ce5-0x0;var _0x432ff6=_0x1053[_0x1b1ce5];return _0x432ff6;};'use strict';var EventEmitter=require(_0x3105('0x0'));var ChatInternalMessage=require(_0x3105('0x1'))['db'][_0x3105('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3105('0x3')](0x0);var events={'afterCreate':_0x3105('0x4'),'afterUpdate':_0x3105('0x5'),'afterDestroy':_0x3105('0x6')};function emitEvent(_0x138b28){return function(_0x57e05e,_0x5342db,_0x3f75a6){ChatInternalMessageEvents[_0x3105('0x7')](_0x138b28+':'+_0x57e05e['id'],_0x57e05e);ChatInternalMessageEvents[_0x3105('0x7')](_0x138b28,_0x57e05e);_0x3f75a6(null);};}for(var e in events){if(events[_0x3105('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x3105('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 187f4bb..717b286 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 _0x2a78=['../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','path','rimraf'];(function(_0x15168f,_0xcd139b){var _0x484b3d=function(_0x156419){while(--_0x156419){_0x15168f['push'](_0x15168f['shift']());}};_0x484b3d(++_0xcd139b);}(_0x2a78,0xd7));var _0x82a7=function(_0x301979,_0x1127b6){_0x301979=_0x301979-0x0;var _0xafa18d=_0x2a78[_0x301979];return _0xafa18d;};'use strict';var _=require('lodash');var util=require(_0x82a7('0x0'));var logger=require('../../config/logger')(_0x82a7('0x1'));var moment=require(_0x82a7('0x2'));var BPromise=require('bluebird');var rp=require(_0x82a7('0x3'));var fs=require('fs');var path=require(_0x82a7('0x4'));var rimraf=require(_0x82a7('0x5'));var config=require(_0x82a7('0x6'));var attributes=require(_0x82a7('0x7'));module[_0x82a7('0x8')]=function(_0x1d04b7,_0x395832){return _0x1d04b7['define'](_0x82a7('0x9'),attributes,{'tableName':_0x82a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x82a7('0xb'),'collate':_0x82a7('0xc')});}; \ No newline at end of file +var _0x48f7=['request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x3d5798,_0x11a5a4){var _0x2f9b86=function(_0x2023cd){while(--_0x2023cd){_0x3d5798['push'](_0x3d5798['shift']());}};_0x2f9b86(++_0x11a5a4);}(_0x48f7,0x87));var _0x748f=function(_0x2ff6b2,_0x2e7ae7){_0x2ff6b2=_0x2ff6b2-0x0;var _0x892d92=_0x48f7[_0x2ff6b2];return _0x892d92;};'use strict';var _=require('lodash');var util=require(_0x748f('0x0'));var logger=require(_0x748f('0x1'))(_0x748f('0x2'));var moment=require(_0x748f('0x3'));var BPromise=require(_0x748f('0x4'));var rp=require(_0x748f('0x5'));var fs=require('fs');var path=require(_0x748f('0x6'));var rimraf=require(_0x748f('0x7'));var config=require(_0x748f('0x8'));var attributes=require(_0x748f('0x9'));module[_0x748f('0xa')]=function(_0x5064d1,_0x24e28d){return _0x5064d1['define']('ChatInternalMessage',attributes,{'tableName':_0x748f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x748f('0xc'),'collate':_0x748f('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 078fbb0..5398d2b 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 _0xf5a7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x499056,_0x29efc4){var _0x37feb6=function(_0x1edcd1){while(--_0x1edcd1){_0x499056['push'](_0x499056['shift']());}};_0x37feb6(++_0x29efc4);}(_0xf5a7,0x133));var _0x7f5a=function(_0x26fa3a,_0x530f65){_0x26fa3a=_0x26fa3a-0x0;var _0x494b57=_0xf5a7[_0x26fa3a];return _0x494b57;};'use strict';var _=require(_0x7f5a('0x0'));var util=require(_0x7f5a('0x1'));var moment=require('moment');var BPromise=require(_0x7f5a('0x2'));var rs=require(_0x7f5a('0x3'));var fs=require('fs');var Redis=require(_0x7f5a('0x4'));var db=require(_0x7f5a('0x5'))['db'];var utils=require(_0x7f5a('0x6'));var logger=require(_0x7f5a('0x7'))(_0x7f5a('0x8'));var config=require(_0x7f5a('0x9'));var jayson=require(_0x7f5a('0xa'));var client=jayson['client'][_0x7f5a('0xb')]({'port':0x232a});config[_0x7f5a('0xc')]=_['defaults'](config[_0x7f5a('0xc')],{'host':_0x7f5a('0xd'),'port':0x18eb});var socket=require(_0x7f5a('0xe'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x7f5a('0xf')](socket);function respondWithRpcPromise(_0x43a45c,_0x570faa,_0x47cba6){return new BPromise(function(_0x438daa,_0x3bf4bd){return client['request'](_0x43a45c,_0x47cba6)['then'](function(_0x43b061){logger[_0x7f5a('0x10')](_0x7f5a('0x11'),_0x570faa,_0x7f5a('0x12'));logger[_0x7f5a('0x13')](_0x7f5a('0x14'),_0x570faa,'request\x20sent',JSON[_0x7f5a('0x15')](_0x43b061));if(_0x43b061[_0x7f5a('0x16')]){if(_0x43b061[_0x7f5a('0x16')][_0x7f5a('0x17')]===0x1f4){logger[_0x7f5a('0x16')](_0x7f5a('0x11'),_0x570faa,_0x43b061[_0x7f5a('0x16')][_0x7f5a('0x18')]);return _0x3bf4bd(_0x43b061['error'][_0x7f5a('0x18')]);}logger[_0x7f5a('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x570faa,_0x43b061[_0x7f5a('0x16')][_0x7f5a('0x18')]);return _0x438daa(_0x43b061[_0x7f5a('0x16')][_0x7f5a('0x18')]);}else{logger['info'](_0x7f5a('0x11'),_0x570faa,_0x7f5a('0x12'));_0x438daa(_0x43b061[_0x7f5a('0x19')][_0x7f5a('0x18')]);}})['catch'](function(_0x45d387){logger[_0x7f5a('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x570faa,_0x45d387);_0x3bf4bd(_0x45d387);});});} \ No newline at end of file +var _0x7ecd=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x4e0486,_0x5b92b3){var _0x5411a7=function(_0x1f84e8){while(--_0x1f84e8){_0x4e0486['push'](_0x4e0486['shift']());}};_0x5411a7(++_0x5b92b3);}(_0x7ecd,0x1ea));var _0xd7ec=function(_0xb0dfa0,_0x367afd){_0xb0dfa0=_0xb0dfa0-0x0;var _0x44d097=_0x7ecd[_0xb0dfa0];return _0x44d097;};'use strict';var _=require(_0xd7ec('0x0'));var util=require(_0xd7ec('0x1'));var moment=require(_0xd7ec('0x2'));var BPromise=require('bluebird');var rs=require(_0xd7ec('0x3'));var fs=require('fs');var Redis=require(_0xd7ec('0x4'));var db=require(_0xd7ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7ec('0x6'))(_0xd7ec('0x7'));var config=require('../../config/environment');var jayson=require(_0xd7ec('0x8'));var client=jayson[_0xd7ec('0x9')]['http']({'port':0x232a});config[_0xd7ec('0xa')]=_['defaults'](config[_0xd7ec('0xa')],{'host':_0xd7ec('0xb'),'port':0x18eb});var socket=require(_0xd7ec('0xc'))(new Redis(config[_0xd7ec('0xa')]));require(_0xd7ec('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d4a4,_0x4b77ef,_0x3f2239){return new BPromise(function(_0x5e4037,_0x5ab5ae){return client[_0xd7ec('0xe')](_0x5d4a4,_0x3f2239)['then'](function(_0x23265e){logger[_0xd7ec('0xf')](_0xd7ec('0x10'),_0x4b77ef,_0xd7ec('0x11'));logger[_0xd7ec('0x12')](_0xd7ec('0x13'),_0x4b77ef,_0xd7ec('0x11'),JSON[_0xd7ec('0x14')](_0x23265e));if(_0x23265e['error']){if(_0x23265e[_0xd7ec('0x15')][_0xd7ec('0x16')]===0x1f4){logger[_0xd7ec('0x15')](_0xd7ec('0x10'),_0x4b77ef,_0x23265e[_0xd7ec('0x15')][_0xd7ec('0x17')]);return _0x5ab5ae(_0x23265e[_0xd7ec('0x15')]['message']);}logger[_0xd7ec('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x4b77ef,_0x23265e[_0xd7ec('0x15')][_0xd7ec('0x17')]);return _0x5e4037(_0x23265e[_0xd7ec('0x15')][_0xd7ec('0x17')]);}else{logger[_0xd7ec('0xf')](_0xd7ec('0x10'),_0x4b77ef,_0xd7ec('0x11'));_0x5e4037(_0x23265e[_0xd7ec('0x18')][_0xd7ec('0x17')]);}})[_0xd7ec('0x19')](function(_0x3cfbe0){logger[_0xd7ec('0x15')](_0xd7ec('0x10'),_0x4b77ef,_0x3cfbe0);_0x5ab5ae(_0x3cfbe0);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 9d529e7..6595678 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 _0x4266=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x603235,_0x27c57a){var _0x32b3c6=function(_0x38d305){while(--_0x38d305){_0x603235['push'](_0x603235['shift']());}};_0x32b3c6(++_0x27c57a);}(_0x4266,0x8d));var _0x6426=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4266[_0x19e35c];return _0x3e1fe8;};'use strict';var ChatInternalMessageEvents=require(_0x6426('0x0'));var events=[_0x6426('0x1'),_0x6426('0x2'),_0x6426('0x3')];function createListener(_0x4efbba,_0x4692bb){return function(_0x59a9c8){_0x4692bb[_0x6426('0x4')](_0x4efbba,_0x59a9c8);};}function removeListener(_0x1df96a,_0x225dce){return function(){ChatInternalMessageEvents[_0x6426('0x5')](_0x1df96a,_0x225dce);};}exports['register']=function(_0x14b9b6){for(var _0x5795e8=0x0,_0x4b572b=events['length'];_0x5795e8<_0x4b572b;_0x5795e8++){var _0x41bc62=events[_0x5795e8];var _0x14deac=createListener(_0x6426('0x6')+_0x41bc62,_0x14b9b6);ChatInternalMessageEvents['on'](_0x41bc62,_0x14deac);}}; \ No newline at end of file +var _0xa01d=['chatInternalMessage:','./chatInternalMessage.events','save','update','emit','register','length'];(function(_0x4fffd6,_0x177a1d){var _0x2ecbba=function(_0x476e7c){while(--_0x476e7c){_0x4fffd6['push'](_0x4fffd6['shift']());}};_0x2ecbba(++_0x177a1d);}(_0xa01d,0xe1));var _0xda01=function(_0x582560,_0x3d4b01){_0x582560=_0x582560-0x0;var _0x1d7279=_0xa01d[_0x582560];return _0x1d7279;};'use strict';var ChatInternalMessageEvents=require(_0xda01('0x0'));var events=[_0xda01('0x1'),'remove',_0xda01('0x2')];function createListener(_0x5d42ea,_0x513069){return function(_0x2a66d6){_0x513069[_0xda01('0x3')](_0x5d42ea,_0x2a66d6);};}function removeListener(_0x2d19b6,_0x1b07f2){return function(){ChatInternalMessageEvents['removeListener'](_0x2d19b6,_0x1b07f2);};}exports[_0xda01('0x4')]=function(_0x25adc2){for(var _0x1325fc=0x0,_0x372c3e=events[_0xda01('0x5')];_0x1325fc<_0x372c3e;_0x1325fc++){var _0x475cbe=events[_0x1325fc];var _0x5d9336=createListener(_0xda01('0x6')+_0x475cbe,_0x25adc2);ChatInternalMessageEvents['on'](_0x475cbe,_0x5d9336);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 42b315a..7f2f64b 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 _0xf95c=['/:id','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','/users','getUsers'];(function(_0xd0e3b7,_0x5d0d4b){var _0x4ff0b3=function(_0x572b7b){while(--_0x572b7b){_0xd0e3b7['push'](_0xd0e3b7['shift']());}};_0x4ff0b3(++_0x5d0d4b);}(_0xf95c,0x10e));var _0xcf95=function(_0x4aaf83,_0x2aaedb){_0x4aaf83=_0x4aaf83-0x0;var _0x49fb97=_0xf95c[_0x4aaf83];return _0x49fb97;};'use strict';var multer=require('multer');var util=require(_0xcf95('0x0'));var path=require(_0xcf95('0x1'));var timeout=require(_0xcf95('0x2'));var express=require('express');var router=express[_0xcf95('0x3')]();var fs_extra=require(_0xcf95('0x4'));var auth=require(_0xcf95('0x5'));var interaction=require(_0xcf95('0x6'));var config=require(_0xcf95('0x7'));var controller=require(_0xcf95('0x8'));router[_0xcf95('0x9')]('/',auth['isAuthenticated'](),controller[_0xcf95('0xa')]);router[_0xcf95('0x9')](_0xcf95('0xb'),auth[_0xcf95('0xc')](),controller[_0xcf95('0xd')]);router[_0xcf95('0x9')](_0xcf95('0xe'),auth[_0xcf95('0xc')](),controller[_0xcf95('0xf')]);router[_0xcf95('0x9')](_0xcf95('0x10'),auth[_0xcf95('0xc')](),controller['show']);router['post']('/',auth[_0xcf95('0xc')](),controller['create']);router[_0xcf95('0x11')](_0xcf95('0x10'),controller[_0xcf95('0x12')]);router[_0xcf95('0x13')](_0xcf95('0x10'),auth[_0xcf95('0xc')](),controller[_0xcf95('0x14')]);module[_0xcf95('0x15')]=router; \ No newline at end of file +var _0x11d3=['isAuthenticated','index','/describe','/users','getUsers','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x56d850,_0xc4a37f){var _0x22296c=function(_0x2c22e5){while(--_0x2c22e5){_0x56d850['push'](_0x56d850['shift']());}};_0x22296c(++_0xc4a37f);}(_0x11d3,0x1f0));var _0x311d=function(_0x42988f,_0x3f4dd6){_0x42988f=_0x42988f-0x0;var _0x40f1fe=_0x11d3[_0x42988f];return _0x40f1fe;};'use strict';var multer=require(_0x311d('0x0'));var util=require(_0x311d('0x1'));var path=require(_0x311d('0x2'));var timeout=require(_0x311d('0x3'));var express=require(_0x311d('0x4'));var router=express['Router']();var fs_extra=require(_0x311d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x311d('0x6'));var config=require(_0x311d('0x7'));var controller=require(_0x311d('0x8'));router[_0x311d('0x9')]('/',auth[_0x311d('0xa')](),controller[_0x311d('0xb')]);router[_0x311d('0x9')](_0x311d('0xc'),auth[_0x311d('0xa')](),controller['describe']);router[_0x311d('0x9')](_0x311d('0xd'),auth[_0x311d('0xa')](),controller[_0x311d('0xe')]);router[_0x311d('0x9')](_0x311d('0xf'),auth[_0x311d('0xa')](),controller[_0x311d('0x10')]);router[_0x311d('0x11')]('/',auth['isAuthenticated'](),controller[_0x311d('0x12')]);router[_0x311d('0x13')]('/:id',controller['update']);router[_0x311d('0x14')](_0x311d('0xf'),auth[_0x311d('0xa')](),controller['destroy']);module[_0x311d('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 21e3c5d..ce0db86 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 _0xdac7=['exports','BOOLEAN','ENUM','out','sequelize'];(function(_0x537348,_0x1b9186){var _0x41ca46=function(_0x31c782){while(--_0x31c782){_0x537348['push'](_0x537348['shift']());}};_0x41ca46(++_0x1b9186);}(_0xdac7,0x180));var _0x7dac=function(_0x2975ff,_0x5267be){_0x2975ff=_0x2975ff-0x0;var _0x7ac006=_0xdac7[_0x2975ff];return _0x7ac006;};'use strict';var Sequelize=require(_0x7dac('0x0'));module[_0x7dac('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x7dac('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7dac('0x3')]('in',_0x7dac('0x4')),'defaultValue':_0x7dac('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1b0e=['TEXT','medium','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x1b0e,0x132));var _0xe1b0=function(_0x52e07e,_0x25ed97){_0x52e07e=_0x52e07e-0x0;var _0x1ea46f=_0x1b0e[_0x52e07e];return _0x1ea46f;};'use strict';var Sequelize=require(_0xe1b0('0x0'));module[_0xe1b0('0x1')]={'body':{'type':Sequelize[_0xe1b0('0x2')](_0xe1b0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe1b0('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe1b0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe1b0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe1b0('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe1b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 04ca2ff..7939b79 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 _0xd0ed=['sequelize','Sequelize','SELECT','contact','User','fullname','internal','agent','manual','interface','format','channel','motionChannel','event','EventManager','acceptmessage','merge','interaction','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SIP/%s','rejectmessage','parse','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','send','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','body','describe','chat-interactions','accept','chat','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','info','name','null','AcceptMessage','acceptMessage','ContactId'];(function(_0x1b06ae,_0x3db6f1){var _0x5f4972=function(_0x3b5bbc){while(--_0x3b5bbc){_0x1b06ae['push'](_0x1b06ae['shift']());}};_0x5f4972(++_0x3db6f1);}(_0xd0ed,0x127));var _0xdd0e=function(_0x1a4d43,_0x28b32c){_0x1a4d43=_0x1a4d43-0x0;var _0x3650e0=_0xd0ed[_0x1a4d43];return _0x3650e0;};'use strict';var emlformat=require(_0xdd0e('0x0'));var rimraf=require(_0xdd0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd0e('0x2'));var rp=require(_0xdd0e('0x3'));var moment=require(_0xdd0e('0x4'));var BPromise=require(_0xdd0e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdd0e('0x6'));var sox=require(_0xdd0e('0x7'));var csv=require('to-csv');var ejs=require(_0xdd0e('0x8'));var fs=require('fs');var fs_extra=require(_0xdd0e('0x9'));var _=require(_0xdd0e('0xa'));var squel=require(_0xdd0e('0xb'));var crypto=require('crypto');var jsforce=require(_0xdd0e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdd0e('0xd'));var querystring=require(_0xdd0e('0xe'));var Papa=require('papaparse');var Redis=require(_0xdd0e('0xf'));var authService=require(_0xdd0e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd0e('0x11'));var logger=require(_0xdd0e('0x12'))(_0xdd0e('0x13'));var utils=require(_0xdd0e('0x14'));var config=require(_0xdd0e('0x15'));var licenseUtil=require(_0xdd0e('0x16'));var db=require(_0xdd0e('0x17'))['db'];config[_0xdd0e('0x18')]=_['defaults'](config[_0xdd0e('0x18')],{'host':_0xdd0e('0x19'),'port':0x18eb});var socket=require(_0xdd0e('0x1a'))(new Redis(config['redis']));require(_0xdd0e('0x1b'))[_0xdd0e('0x1c')](socket);var jayson=require(_0xdd0e('0x1d'));var client=jayson[_0xdd0e('0x1e')][_0xdd0e('0x1f')]({'port':0x232c});var client9002=jayson[_0xdd0e('0x1e')][_0xdd0e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1af92e,_0x481ba6,_0x88a694,_0xa614e4){return new BPromise(function(_0x4aff71,_0x34591a){var _0x4cf1e4=_0xa614e4||client;return _0x4cf1e4[_0xdd0e('0x20')](_0x1af92e,_0x88a694)[_0xdd0e('0x21')](function(_0x432628){logger['info'](_0xdd0e('0x22'),_0x481ba6,'request\x20sent');logger[_0xdd0e('0x23')](_0xdd0e('0x24'),_0x481ba6,_0xdd0e('0x25'),JSON[_0xdd0e('0x26')](_0x432628));if(_0x432628[_0xdd0e('0x27')]){if(_0x432628[_0xdd0e('0x27')][_0xdd0e('0x28')]===0x1f4){logger['error'](_0xdd0e('0x22'),_0x481ba6,_0x432628[_0xdd0e('0x27')][_0xdd0e('0x29')]);return _0x34591a(_0x432628['error']['message']);}logger[_0xdd0e('0x27')](_0xdd0e('0x22'),_0x481ba6,_0x432628[_0xdd0e('0x27')]['message']);return _0x4aff71(_0x432628[_0xdd0e('0x27')]['message']);}else{logger['info'](_0xdd0e('0x22'),_0x481ba6,'request\x20sent');_0x4aff71(_0x432628['result']['message']);}})[_0xdd0e('0x2a')](function(_0x28f1ec){logger['error'](_0xdd0e('0x22'),_0x481ba6,_0x28f1ec);_0x34591a(_0x28f1ec);});});}function respondWithStatusCode(_0x4aac55,_0x46df22){_0x46df22=_0x46df22||0xcc;return function(_0x158112){if(_0x158112){return _0x4aac55[_0xdd0e('0x2b')](_0x46df22);}return _0x4aac55[_0xdd0e('0x2c')](_0x46df22)[_0xdd0e('0x2d')]();};}function respondWithResult(_0x382542,_0x3ee425){_0x3ee425=_0x3ee425||0xc8;return function(_0x356226){if(_0x356226){return _0x382542[_0xdd0e('0x2c')](_0x3ee425)[_0xdd0e('0x2e')](_0x356226);}};}function respondWithFilteredResult(_0x29110a,_0x1ace7e){return function(_0x427378){if(_0x427378){var _0x3fbfc7=typeof _0x1ace7e[_0xdd0e('0x2f')]==='undefined'&&typeof _0x1ace7e[_0xdd0e('0x30')]===_0xdd0e('0x31');var _0x17b94f=_0x427378[_0xdd0e('0x32')];var _0x4dc077=_0x3fbfc7?0x0:_0x1ace7e[_0xdd0e('0x2f')];var _0x22370a=_0x3fbfc7?_0x427378[_0xdd0e('0x32')]:_0x1ace7e[_0xdd0e('0x2f')]+_0x1ace7e['limit'];var _0x2042b4;if(_0x22370a>=_0x17b94f){_0x22370a=_0x17b94f;_0x2042b4=0xc8;}else{_0x2042b4=0xce;}_0x29110a[_0xdd0e('0x2c')](_0x2042b4);return _0x29110a[_0xdd0e('0x33')](_0xdd0e('0x34'),_0x4dc077+'-'+_0x22370a+'/'+_0x17b94f)[_0xdd0e('0x2e')](_0x427378);}return null;};}function patchUpdates(_0x155e9b){return function(_0xb5a236){try{jsonpatch['apply'](_0xb5a236,_0x155e9b,!![]);}catch(_0x1b2710){return BPromise[_0xdd0e('0x35')](_0x1b2710);}return _0xb5a236[_0xdd0e('0x36')]();};}function saveUpdates(_0x445289,_0x1392b0){return function(_0x28a33a){if(_0x28a33a){return _0x28a33a[_0xdd0e('0x37')](_0x445289)['then'](function(_0x2e8ddb){return _0x2e8ddb;});}return null;};}function removeEntity(_0x2248e1,_0x14c00f){return function(_0x2f8436){if(_0x2f8436){return _0x2f8436[_0xdd0e('0x38')]()[_0xdd0e('0x21')](function(){_0x2248e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57b0b5,_0x4c4564){return function(_0x36cf27){if(!_0x36cf27){_0x57b0b5[_0xdd0e('0x2b')](0x194);}return _0x36cf27;};}function handleError(_0xe8b6f,_0x3e08f0){_0x3e08f0=_0x3e08f0||0x1f4;return function(_0x507240){logger[_0xdd0e('0x27')](_0x507240['stack']);if(_0x507240['name']){delete _0x507240['name'];}_0xe8b6f[_0xdd0e('0x2c')](_0x3e08f0)[_0xdd0e('0x39')](_0x507240);};}exports['index']=function(_0x5c3a7e,_0x5b01ec){var _0x25a9a1={},_0x562610={},_0x58c3db={'count':0x0,'rows':[]};var _0xf0134c=_[_0xdd0e('0x3a')](db[_0xdd0e('0x3b')][_0xdd0e('0x3c')],function(_0x741e6e){return{'name':_0x741e6e[_0xdd0e('0x3d')],'type':_0x741e6e[_0xdd0e('0x3e')][_0xdd0e('0x3f')]};});_0x562610[_0xdd0e('0x40')]=_[_0xdd0e('0x3a')](_0xf0134c,'name');_0x562610[_0xdd0e('0x41')]=_[_0xdd0e('0x42')](_0x5c3a7e[_0xdd0e('0x41')]);_0x562610['filters']=_[_0xdd0e('0x43')](_0x562610['model'],_0x562610[_0xdd0e('0x41')]);_0x25a9a1[_0xdd0e('0x44')]=_['intersection'](_0x562610['model'],qs[_0xdd0e('0x45')](_0x5c3a7e['query'][_0xdd0e('0x45')]));_0x25a9a1[_0xdd0e('0x44')]=_0x25a9a1['attributes'][_0xdd0e('0x46')]?_0x25a9a1['attributes']:_0x562610[_0xdd0e('0x40')];if(!_0x5c3a7e[_0xdd0e('0x41')][_0xdd0e('0x47')](_0xdd0e('0x48'))){_0x25a9a1[_0xdd0e('0x30')]=qs[_0xdd0e('0x30')](_0x5c3a7e[_0xdd0e('0x41')][_0xdd0e('0x30')]);_0x25a9a1[_0xdd0e('0x2f')]=qs[_0xdd0e('0x2f')](_0x5c3a7e['query'][_0xdd0e('0x2f')]);}_0x25a9a1[_0xdd0e('0x49')]=qs[_0xdd0e('0x4a')](_0x5c3a7e[_0xdd0e('0x41')][_0xdd0e('0x4a')]);_0x25a9a1[_0xdd0e('0x4b')]=qs[_0xdd0e('0x4c')](_[_0xdd0e('0x4d')](_0x5c3a7e[_0xdd0e('0x41')],_0x562610[_0xdd0e('0x4c')]),_0xf0134c);if(_0x5c3a7e['query'][_0xdd0e('0x4e')]){_0x25a9a1[_0xdd0e('0x4b')]=_['merge'](_0x25a9a1[_0xdd0e('0x4b')],{'$or':_[_0xdd0e('0x3a')](_0xf0134c,function(_0x36f2c5){if(_0x36f2c5['type']!==_0xdd0e('0x4f')){var _0x4b03ce={};_0x4b03ce[_0x36f2c5['name']]={'$like':'%'+_0x5c3a7e[_0xdd0e('0x41')][_0xdd0e('0x4e')]+'%'};return _0x4b03ce;}})});}_0x25a9a1=_['merge']({},_0x25a9a1,_0x5c3a7e[_0xdd0e('0x50')]);var _0x10a72c={'where':_0x25a9a1[_0xdd0e('0x4b')]};return db[_0xdd0e('0x3b')]['count'](_0x10a72c)['then'](function(_0x5352a6){_0x58c3db[_0xdd0e('0x32')]=_0x5352a6;if(_0x5c3a7e[_0xdd0e('0x41')][_0xdd0e('0x51')]){_0x25a9a1['include']=[{'all':!![]}];}return db['ChatMessage'][_0xdd0e('0x52')](_0x25a9a1);})['then'](function(_0x40cd35){_0x58c3db[_0xdd0e('0x53')]=_0x40cd35;return _0x58c3db;})['then'](respondWithFilteredResult(_0x5b01ec,_0x25a9a1))[_0xdd0e('0x2a')](handleError(_0x5b01ec,null));};exports[_0xdd0e('0x54')]=function(_0x4a4ebc,_0x55b6d0){var _0x384cab={'raw':!![],'where':{'id':_0x4a4ebc[_0xdd0e('0x55')]['id']}},_0x207694={};_0x207694[_0xdd0e('0x40')]=_[_0xdd0e('0x42')](db['ChatMessage'][_0xdd0e('0x3c')]);_0x207694[_0xdd0e('0x41')]=_[_0xdd0e('0x42')](_0x4a4ebc[_0xdd0e('0x41')]);_0x207694[_0xdd0e('0x4c')]=_[_0xdd0e('0x43')](_0x207694[_0xdd0e('0x40')],_0x207694[_0xdd0e('0x41')]);_0x384cab[_0xdd0e('0x44')]=_[_0xdd0e('0x43')](_0x207694['model'],qs[_0xdd0e('0x45')](_0x4a4ebc[_0xdd0e('0x41')][_0xdd0e('0x45')]));_0x384cab['attributes']=_0x384cab['attributes'][_0xdd0e('0x46')]?_0x384cab[_0xdd0e('0x44')]:_0x207694[_0xdd0e('0x40')];if(_0x4a4ebc[_0xdd0e('0x41')][_0xdd0e('0x51')]){_0x384cab[_0xdd0e('0x56')]=[{'all':!![]}];}_0x384cab=_['merge']({},_0x384cab,_0x4a4ebc[_0xdd0e('0x50')]);return db['ChatMessage'][_0xdd0e('0x57')](_0x384cab)[_0xdd0e('0x21')](handleEntityNotFound(_0x55b6d0,null))['then'](respondWithResult(_0x55b6d0,null))[_0xdd0e('0x2a')](handleError(_0x55b6d0,null));};exports[_0xdd0e('0x58')]=function(_0x635bc1,_0x250680){return db['ChatMessage'][_0xdd0e('0x58')](_0x635bc1[_0xdd0e('0x59')],{})['then'](respondWithResult(_0x250680,0xc9))[_0xdd0e('0x2a')](handleError(_0x250680,null));};exports[_0xdd0e('0x37')]=function(_0x595772,_0x228cbc){if(_0x595772[_0xdd0e('0x59')]['id']){delete _0x595772[_0xdd0e('0x59')]['id'];}return db['ChatMessage'][_0xdd0e('0x57')]({'where':{'id':_0x595772[_0xdd0e('0x55')]['id']}})[_0xdd0e('0x21')](handleEntityNotFound(_0x228cbc,null))[_0xdd0e('0x21')](saveUpdates(_0x595772['body'],null))[_0xdd0e('0x21')](respondWithResult(_0x228cbc,null))[_0xdd0e('0x2a')](handleError(_0x228cbc,null));};exports[_0xdd0e('0x38')]=function(_0x2a5a88,_0x29c6bb){return db[_0xdd0e('0x3b')]['find']({'where':{'id':_0x2a5a88['params']['id']}})[_0xdd0e('0x21')](handleEntityNotFound(_0x29c6bb,null))[_0xdd0e('0x21')](removeEntity(_0x29c6bb,null))[_0xdd0e('0x2a')](handleError(_0x29c6bb,null));};exports[_0xdd0e('0x5a')]=function(_0xfe4137,_0x25aaf9){return db[_0xdd0e('0x3b')][_0xdd0e('0x5a')]()[_0xdd0e('0x21')](respondWithResult(_0x25aaf9,null))[_0xdd0e('0x2a')](handleError(_0x25aaf9,null));};var interaction_log=require(_0xdd0e('0x12'))(_0xdd0e('0x5b'));exports[_0xdd0e('0x5c')]=function(_0x21c0ed,_0x4d71d3,_0x13887d){var _0x33cba3={'agent':{},'channel':_0xdd0e('0x5d')};if(_0x21c0ed[_0xdd0e('0x59')]['id']){delete _0x21c0ed[_0xdd0e('0x59')]['id'];}_0x21c0ed[_0xdd0e('0x59')]['read']=!![];_0x21c0ed[_0xdd0e('0x59')]['readAt']=moment()['format'](_0xdd0e('0x5e'));_0x21c0ed[_0xdd0e('0x59')][_0xdd0e('0x5f')]=_0x21c0ed['body']['UserId']||_0x21c0ed[_0xdd0e('0x60')]['id'];_0x33cba3['agent']['id']=_0x21c0ed[_0xdd0e('0x59')]['UserId'];return db['ChatMessage'][_0xdd0e('0x57')]({'where':{'id':_0x21c0ed[_0xdd0e('0x55')]['id'],'UserId':null}})[_0xdd0e('0x21')](handleEntityNotFound(_0x4d71d3,null))[_0xdd0e('0x21')](saveUpdates(_0x21c0ed['body'],null))[_0xdd0e('0x21')](function(_0x53d8d7){if(_0x53d8d7){_0x33cba3['message']=_0x53d8d7[_0xdd0e('0x61')]({'plain':!![]});return db[_0xdd0e('0x62')][_0xdd0e('0x57')]({'where':{'id':_0x53d8d7[_0xdd0e('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x4d71d3,null))[_0xdd0e('0x21')](function(_0x1979c6){if(_0x1979c6){return _0x1979c6[_0xdd0e('0x37')]({'UserId':_0x21c0ed['body'][_0xdd0e('0x5f')],'read1stAt':_[_0xdd0e('0x64')](_0x1979c6['read1stAt'])?moment()['format'](_0xdd0e('0x5e')):undefined});}return null;})[_0xdd0e('0x21')](function(_0x56f7cd){if(_0x56f7cd){_0x33cba3['interaction']=_0x56f7cd[_0xdd0e('0x61')]({'plain':!![]});interaction_log[_0xdd0e('0x65')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x21c0ed['user']['id'],_0x21c0ed[_0xdd0e('0x60')][_0xdd0e('0x66')],_0x21c0ed[_0xdd0e('0x60')]['role'],_0x33cba3['interaction']['id'],_0x21c0ed[_0xdd0e('0x59')]?JSON[_0xdd0e('0x26')](_0x21c0ed['body']):_0xdd0e('0x67'));return respondWithRpcPromise(_0xdd0e('0x68'),_0xdd0e('0x69'),_0x33cba3);}return null;})[_0xdd0e('0x21')](function(_0x2c6f9c){var _0x41179f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2c6f9c[_0xdd0e('0x29')][_0xdd0e('0x6a')];return db[_0xdd0e('0x6b')][_0xdd0e('0x41')](_0x41179f,{'type':db[_0xdd0e('0x6c')]['QueryTypes'][_0xdd0e('0x6d')],'raw':!![]})[_0xdd0e('0x21')](function(_0xe77d27){return _0xe77d27;});})[_0xdd0e('0x21')](function(_0x29227b){if(_0x29227b){_0x33cba3[_0xdd0e('0x29')][_0xdd0e('0x6e')]=_0x29227b[0x0];if(!_0x21c0ed[_0xdd0e('0x59')][_0xdd0e('0x5f')])return;return db[_0xdd0e('0x6f')][_0xdd0e('0x57')]({'where':{'id':_0x21c0ed[_0xdd0e('0x59')][_0xdd0e('0x5f')],'role':'agent'},'attributes':['id',_0xdd0e('0x66'),_0xdd0e('0x70'),'email',_0xdd0e('0x71')],'raw':!![]});}return null;})['then'](function(_0x51c27c){if(!_0x51c27c)return null;_0x33cba3[_0xdd0e('0x29')][_0xdd0e('0x72')]=_0x51c27c;return _0x33cba3;})['then'](function(_0x3264e3){if(_0x3264e3){if(_0x21c0ed[_0xdd0e('0x59')][_0xdd0e('0x73')]){_0x33cba3[_0xdd0e('0x29')][_0xdd0e('0x74')]=util[_0xdd0e('0x75')]('SIP/%s',_0x21c0ed[_0xdd0e('0x60')]['name']);_0x33cba3['message'][_0xdd0e('0x76')]=_0x33cba3[_0xdd0e('0x76')];_0x33cba3[_0xdd0e('0x29')][_0xdd0e('0x77')]=_0x33cba3[_0xdd0e('0x76')];_0x33cba3[_0xdd0e('0x29')][_0xdd0e('0x78')]=_0xdd0e('0x5c');return respondWithRpcPromise(_0xdd0e('0x79'),_0xdd0e('0x79'),{'event':_0xdd0e('0x7a'),'message':_[_0xdd0e('0x7b')](_0x33cba3[_0xdd0e('0x29')],JSON['parse'](_0x33cba3[_0xdd0e('0x7c')][_0xdd0e('0x7d')]))},client9002)['then'](function(){return _0x33cba3;});}return _0x33cba3;}return null;})[_0xdd0e('0x21')](respondWithResult(_0x4d71d3,null))[_0xdd0e('0x2a')](handleError(_0x4d71d3,null));};var interaction_log=require(_0xdd0e('0x12'))(_0xdd0e('0x5b'));exports['reject']=function(_0x34408b,_0x4e0fad,_0x181e3e){var _0x1b787e={'agent':{},'channel':_0xdd0e('0x5d')};if(_0x34408b[_0xdd0e('0x59')]['id']){delete _0x34408b[_0xdd0e('0x59')]['id'];}_0x34408b[_0xdd0e('0x59')][_0xdd0e('0x5f')]=_0x34408b[_0xdd0e('0x59')]['UserId']||_0x34408b[_0xdd0e('0x60')]['id'];_0x1b787e[_0xdd0e('0x72')]['id']=_0x34408b[_0xdd0e('0x59')][_0xdd0e('0x5f')];return db[_0xdd0e('0x3b')]['find']({'where':{'id':_0x34408b[_0xdd0e('0x55')]['id'],'UserId':null}})[_0xdd0e('0x21')](handleEntityNotFound(_0x4e0fad,null))[_0xdd0e('0x21')](function(_0x4709c1){if(_0x4709c1){_0x1b787e[_0xdd0e('0x29')]=_0x4709c1['get']({'plain':!![]});return db[_0xdd0e('0x62')][_0xdd0e('0x57')]({'where':{'id':_0x4709c1[_0xdd0e('0x63')]}});}return null;})[_0xdd0e('0x21')](handleEntityNotFound(_0x4e0fad,null))[_0xdd0e('0x21')](function(_0x1cbafa){if(_0x1cbafa){_0x1b787e[_0xdd0e('0x7c')]=_0x1cbafa['get']({'plain':!![]});interaction_log['info'](_0xdd0e('0x7e'),_0x34408b[_0xdd0e('0x60')]['id'],_0x34408b['user'][_0xdd0e('0x66')],_0x34408b[_0xdd0e('0x60')][_0xdd0e('0x7f')],_0x1b787e[_0xdd0e('0x7c')]['id'],_0x34408b[_0xdd0e('0x59')]?JSON[_0xdd0e('0x26')](_0x34408b[_0xdd0e('0x59')]):_0xdd0e('0x67'));return respondWithRpcPromise(_0xdd0e('0x80'),'rejectMessage',_0x1b787e);}return null;})[_0xdd0e('0x21')](function(_0x87bfa4){var _0x22d510=_0xdd0e('0x81')+_0x87bfa4['message']['ContactId'];return db[_0xdd0e('0x6b')][_0xdd0e('0x41')](_0x22d510,{'type':db[_0xdd0e('0x6c')][_0xdd0e('0x82')][_0xdd0e('0x6d')],'raw':!![]})[_0xdd0e('0x21')](function(_0x380d64){return _0x380d64;});})[_0xdd0e('0x21')](function(_0x309ee8){if(_0x309ee8){_0x1b787e[_0xdd0e('0x29')][_0xdd0e('0x6e')]=_0x309ee8[0x0];if(!_0x34408b['body'][_0xdd0e('0x5f')])return;return db[_0xdd0e('0x6f')][_0xdd0e('0x57')]({'where':{'id':_0x34408b[_0xdd0e('0x59')][_0xdd0e('0x5f')],'role':'agent'},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0xdd0e('0x21')](function(_0x455d05){if(!_0x455d05)return null;_0x1b787e[_0xdd0e('0x29')]['agent']=_0x455d05;return _0x1b787e;})[_0xdd0e('0x21')](function(_0x361b28){if(_0x361b28){_0x361b28['message'][_0xdd0e('0x74')]=util[_0xdd0e('0x75')](_0xdd0e('0x83'),_0x34408b['user']['name']);_0x361b28[_0xdd0e('0x29')][_0xdd0e('0x76')]=_0x1b787e[_0xdd0e('0x76')];_0x361b28['message'][_0xdd0e('0x77')]=_0x1b787e[_0xdd0e('0x76')];_0x361b28[_0xdd0e('0x29')]['event']='reject';respondWithRpcPromise(_0xdd0e('0x79'),'EventManager',{'event':_0xdd0e('0x84'),'message':_[_0xdd0e('0x7b')](_0x1b787e['message'],JSON[_0xdd0e('0x85')](_0x1b787e['interaction'][_0xdd0e('0x7d')]))},client9002);return _0x1b787e;}return null;})['then'](respondWithResult(_0x4e0fad,null))['catch'](handleError(_0x4e0fad,null));}; \ No newline at end of file +var _0x89da=['map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','ChatMessage','findAll','rows','params','find','create','body','update','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','formData','chat-interactions','role','stringify','RejectMessage','Sequelize','internal','rejectmessage','parse','eml-format','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','stack','name','index'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x89da,0x1c4));var _0xa89d=function(_0x4a85e3,_0x132198){_0x4a85e3=_0x4a85e3-0x0;var _0x5e1a60=_0x89da[_0x4a85e3];return _0x5e1a60;};'use strict';var emlformat=require(_0xa89d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa89d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa89d('0x2'));var BPromise=require(_0xa89d('0x3'));var Mustache=require('mustache');var util=require(_0xa89d('0x4'));var path=require(_0xa89d('0x5'));var sox=require('sox');var csv=require(_0xa89d('0x6'));var ejs=require(_0xa89d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa89d('0x8'));var squel=require(_0xa89d('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa89d('0xa'));var toCsv=require(_0xa89d('0x6'));var querystring=require(_0xa89d('0xb'));var Papa=require(_0xa89d('0xc'));var Redis=require('ioredis');var authService=require(_0xa89d('0xd'));var qs=require(_0xa89d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa89d('0xf'));var logger=require(_0xa89d('0x10'))(_0xa89d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa89d('0x12')]=_[_0xa89d('0x13')](config['redis'],{'host':_0xa89d('0x14'),'port':0x18eb});var socket=require(_0xa89d('0x15'))(new Redis(config[_0xa89d('0x12')]));require(_0xa89d('0x16'))[_0xa89d('0x17')](socket);var jayson=require(_0xa89d('0x18'));var client=jayson[_0xa89d('0x19')][_0xa89d('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0xa89d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1641e0,_0x84669f,_0x5a61fa,_0x2836ce){return new BPromise(function(_0x36beb2,_0x3a4c66){var _0x21f5a5=_0x2836ce||client;return _0x21f5a5['request'](_0x1641e0,_0x5a61fa)[_0xa89d('0x1b')](function(_0x53c53a){logger[_0xa89d('0x1c')](_0xa89d('0x1d'),_0x84669f,_0xa89d('0x1e'));logger[_0xa89d('0x1f')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x84669f,'request\x20sent',JSON['stringify'](_0x53c53a));if(_0x53c53a[_0xa89d('0x20')]){if(_0x53c53a[_0xa89d('0x20')][_0xa89d('0x21')]===0x1f4){logger[_0xa89d('0x20')](_0xa89d('0x1d'),_0x84669f,_0x53c53a[_0xa89d('0x20')][_0xa89d('0x22')]);return _0x3a4c66(_0x53c53a[_0xa89d('0x20')]['message']);}logger['error'](_0xa89d('0x1d'),_0x84669f,_0x53c53a[_0xa89d('0x20')][_0xa89d('0x22')]);return _0x36beb2(_0x53c53a[_0xa89d('0x20')]['message']);}else{logger[_0xa89d('0x1c')](_0xa89d('0x1d'),_0x84669f,_0xa89d('0x1e'));_0x36beb2(_0x53c53a['result']['message']);}})[_0xa89d('0x23')](function(_0x445796){logger['error'](_0xa89d('0x1d'),_0x84669f,_0x445796);_0x3a4c66(_0x445796);});});}function respondWithStatusCode(_0x7b1cec,_0x59cf72){_0x59cf72=_0x59cf72||0xcc;return function(_0x4d3c22){if(_0x4d3c22){return _0x7b1cec[_0xa89d('0x24')](_0x59cf72);}return _0x7b1cec[_0xa89d('0x25')](_0x59cf72)[_0xa89d('0x26')]();};}function respondWithResult(_0x3e7cd7,_0x4de558){_0x4de558=_0x4de558||0xc8;return function(_0x4311d2){if(_0x4311d2){return _0x3e7cd7[_0xa89d('0x25')](_0x4de558)[_0xa89d('0x27')](_0x4311d2);}};}function respondWithFilteredResult(_0x1d2c2f,_0xbcd9c){return function(_0x2446d8){if(_0x2446d8){var _0x42ddca=typeof _0xbcd9c[_0xa89d('0x28')]==='undefined'&&typeof _0xbcd9c[_0xa89d('0x29')]===_0xa89d('0x2a');var _0x387e30=_0x2446d8[_0xa89d('0x2b')];var _0x3b1ea4=_0x42ddca?0x0:_0xbcd9c[_0xa89d('0x28')];var _0x3f3bb6=_0x42ddca?_0x2446d8[_0xa89d('0x2b')]:_0xbcd9c['offset']+_0xbcd9c[_0xa89d('0x29')];var _0x590cc1;if(_0x3f3bb6>=_0x387e30){_0x3f3bb6=_0x387e30;_0x590cc1=0xc8;}else{_0x590cc1=0xce;}_0x1d2c2f[_0xa89d('0x25')](_0x590cc1);return _0x1d2c2f[_0xa89d('0x2c')](_0xa89d('0x2d'),_0x3b1ea4+'-'+_0x3f3bb6+'/'+_0x387e30)[_0xa89d('0x27')](_0x2446d8);}return null;};}function patchUpdates(_0x965f9){return function(_0x4b5444){try{jsonpatch[_0xa89d('0x2e')](_0x4b5444,_0x965f9,!![]);}catch(_0x30087b){return BPromise[_0xa89d('0x2f')](_0x30087b);}return _0x4b5444[_0xa89d('0x30')]();};}function saveUpdates(_0x3996f0,_0x32ce5f){return function(_0x57e2be){if(_0x57e2be){return _0x57e2be['update'](_0x3996f0)[_0xa89d('0x1b')](function(_0x599fe9){return _0x599fe9;});}return null;};}function removeEntity(_0x4089e8,_0x40af3f){return function(_0x527d80){if(_0x527d80){return _0x527d80['destroy']()[_0xa89d('0x1b')](function(){_0x4089e8['status'](0xcc)[_0xa89d('0x26')]();});}};}function handleEntityNotFound(_0x57f9f4,_0x5a6d62){return function(_0x5c152d){if(!_0x5c152d){_0x57f9f4[_0xa89d('0x24')](0x194);}return _0x5c152d;};}function handleError(_0x438543,_0x40184d){_0x40184d=_0x40184d||0x1f4;return function(_0x953fee){logger[_0xa89d('0x20')](_0x953fee[_0xa89d('0x31')]);if(_0x953fee[_0xa89d('0x32')]){delete _0x953fee['name'];}_0x438543[_0xa89d('0x25')](_0x40184d)['send'](_0x953fee);};}exports[_0xa89d('0x33')]=function(_0x409422,_0x85783e){var _0x5f36b9={},_0x10cdcf={},_0xf6c3f1={'count':0x0,'rows':[]};var _0x27cf0f=_[_0xa89d('0x34')](db['ChatMessage'][_0xa89d('0x35')],function(_0xd2a36b){return{'name':_0xd2a36b['fieldName'],'type':_0xd2a36b[_0xa89d('0x36')][_0xa89d('0x37')]};});_0x10cdcf[_0xa89d('0x38')]=_[_0xa89d('0x34')](_0x27cf0f,'name');_0x10cdcf[_0xa89d('0x39')]=_[_0xa89d('0x3a')](_0x409422['query']);_0x10cdcf[_0xa89d('0x3b')]=_[_0xa89d('0x3c')](_0x10cdcf[_0xa89d('0x38')],_0x10cdcf[_0xa89d('0x39')]);_0x5f36b9[_0xa89d('0x3d')]=_['intersection'](_0x10cdcf[_0xa89d('0x38')],qs[_0xa89d('0x3e')](_0x409422[_0xa89d('0x39')][_0xa89d('0x3e')]));_0x5f36b9[_0xa89d('0x3d')]=_0x5f36b9['attributes'][_0xa89d('0x3f')]?_0x5f36b9[_0xa89d('0x3d')]:_0x10cdcf['model'];if(!_0x409422['query'][_0xa89d('0x40')](_0xa89d('0x41'))){_0x5f36b9[_0xa89d('0x29')]=qs[_0xa89d('0x29')](_0x409422[_0xa89d('0x39')]['limit']);_0x5f36b9[_0xa89d('0x28')]=qs[_0xa89d('0x28')](_0x409422['query'][_0xa89d('0x28')]);}_0x5f36b9[_0xa89d('0x42')]=qs['sort'](_0x409422['query'][_0xa89d('0x43')]);_0x5f36b9[_0xa89d('0x44')]=qs[_0xa89d('0x3b')](_[_0xa89d('0x45')](_0x409422['query'],_0x10cdcf['filters']),_0x27cf0f);if(_0x409422[_0xa89d('0x39')][_0xa89d('0x46')]){_0x5f36b9[_0xa89d('0x44')]=_[_0xa89d('0x47')](_0x5f36b9['where'],{'$or':_[_0xa89d('0x34')](_0x27cf0f,function(_0x5ec3ad){if(_0x5ec3ad[_0xa89d('0x36')]!=='VIRTUAL'){var _0x499dcf={};_0x499dcf[_0x5ec3ad[_0xa89d('0x32')]]={'$like':'%'+_0x409422[_0xa89d('0x39')][_0xa89d('0x46')]+'%'};return _0x499dcf;}})});}_0x5f36b9=_[_0xa89d('0x47')]({},_0x5f36b9,_0x409422[_0xa89d('0x48')]);var _0x1d145f={'where':_0x5f36b9[_0xa89d('0x44')]};return db['ChatMessage'][_0xa89d('0x2b')](_0x1d145f)['then'](function(_0x23779){_0xf6c3f1['count']=_0x23779;if(_0x409422[_0xa89d('0x39')][_0xa89d('0x49')]){_0x5f36b9[_0xa89d('0x4a')]=[{'all':!![]}];}return db[_0xa89d('0x4b')][_0xa89d('0x4c')](_0x5f36b9);})[_0xa89d('0x1b')](function(_0xbaffbb){_0xf6c3f1[_0xa89d('0x4d')]=_0xbaffbb;return _0xf6c3f1;})['then'](respondWithFilteredResult(_0x85783e,_0x5f36b9))[_0xa89d('0x23')](handleError(_0x85783e,null));};exports['show']=function(_0x45a055,_0x11350a){var _0x140acd={'raw':!![],'where':{'id':_0x45a055[_0xa89d('0x4e')]['id']}},_0x6c6a6={};_0x6c6a6['model']=_[_0xa89d('0x3a')](db[_0xa89d('0x4b')]['rawAttributes']);_0x6c6a6[_0xa89d('0x39')]=_[_0xa89d('0x3a')](_0x45a055['query']);_0x6c6a6['filters']=_[_0xa89d('0x3c')](_0x6c6a6['model'],_0x6c6a6[_0xa89d('0x39')]);_0x140acd[_0xa89d('0x3d')]=_['intersection'](_0x6c6a6[_0xa89d('0x38')],qs[_0xa89d('0x3e')](_0x45a055['query'][_0xa89d('0x3e')]));_0x140acd[_0xa89d('0x3d')]=_0x140acd[_0xa89d('0x3d')][_0xa89d('0x3f')]?_0x140acd['attributes']:_0x6c6a6['model'];if(_0x45a055[_0xa89d('0x39')]['includeAll']){_0x140acd[_0xa89d('0x4a')]=[{'all':!![]}];}_0x140acd=_[_0xa89d('0x47')]({},_0x140acd,_0x45a055[_0xa89d('0x48')]);return db[_0xa89d('0x4b')][_0xa89d('0x4f')](_0x140acd)['then'](handleEntityNotFound(_0x11350a,null))[_0xa89d('0x1b')](respondWithResult(_0x11350a,null))[_0xa89d('0x23')](handleError(_0x11350a,null));};exports[_0xa89d('0x50')]=function(_0x427433,_0x6f09d3){return db[_0xa89d('0x4b')]['create'](_0x427433[_0xa89d('0x51')],{})['then'](respondWithResult(_0x6f09d3,0xc9))[_0xa89d('0x23')](handleError(_0x6f09d3,null));};exports[_0xa89d('0x52')]=function(_0x50302e,_0x869d69){if(_0x50302e[_0xa89d('0x51')]['id']){delete _0x50302e[_0xa89d('0x51')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x50302e[_0xa89d('0x4e')]['id']}})[_0xa89d('0x1b')](handleEntityNotFound(_0x869d69,null))['then'](saveUpdates(_0x50302e[_0xa89d('0x51')],null))[_0xa89d('0x1b')](respondWithResult(_0x869d69,null))['catch'](handleError(_0x869d69,null));};exports['destroy']=function(_0x522b72,_0x3b2926){return db[_0xa89d('0x4b')][_0xa89d('0x4f')]({'where':{'id':_0x522b72['params']['id']}})['then'](handleEntityNotFound(_0x3b2926,null))['then'](removeEntity(_0x3b2926,null))['catch'](handleError(_0x3b2926,null));};exports[_0xa89d('0x53')]=function(_0x333e9e,_0x5491dc){return db[_0xa89d('0x4b')][_0xa89d('0x53')]()[_0xa89d('0x1b')](respondWithResult(_0x5491dc,null))['catch'](handleError(_0x5491dc,null));};var interaction_log=require(_0xa89d('0x10'))('chat-interactions');exports[_0xa89d('0x54')]=function(_0x2701f3,_0xe8338e,_0x173ed4){var _0x2f5d28={'agent':{},'channel':_0xa89d('0x55')};if(_0x2701f3[_0xa89d('0x51')]['id']){delete _0x2701f3[_0xa89d('0x51')]['id'];}_0x2701f3[_0xa89d('0x51')][_0xa89d('0x56')]=!![];_0x2701f3[_0xa89d('0x51')][_0xa89d('0x57')]=moment()[_0xa89d('0x58')](_0xa89d('0x59'));_0x2701f3['body'][_0xa89d('0x5a')]=_0x2701f3[_0xa89d('0x51')][_0xa89d('0x5a')]||_0x2701f3[_0xa89d('0x5b')]['id'];_0x2f5d28[_0xa89d('0x5c')]['id']=_0x2701f3[_0xa89d('0x51')][_0xa89d('0x5a')];return db[_0xa89d('0x4b')][_0xa89d('0x4f')]({'where':{'id':_0x2701f3[_0xa89d('0x4e')]['id'],'UserId':null}})[_0xa89d('0x1b')](handleEntityNotFound(_0xe8338e,null))[_0xa89d('0x1b')](saveUpdates(_0x2701f3[_0xa89d('0x51')],null))['then'](function(_0x3f00fe){if(_0x3f00fe){_0x2f5d28['message']=_0x3f00fe[_0xa89d('0x5d')]({'plain':!![]});return db[_0xa89d('0x5e')][_0xa89d('0x4f')]({'where':{'id':_0x3f00fe[_0xa89d('0x5f')]}});}return null;})[_0xa89d('0x1b')](handleEntityNotFound(_0xe8338e,null))[_0xa89d('0x1b')](function(_0x8f9f5e){if(_0x8f9f5e){return _0x8f9f5e[_0xa89d('0x52')]({'UserId':_0x2701f3[_0xa89d('0x51')][_0xa89d('0x5a')],'read1stAt':_['isNil'](_0x8f9f5e[_0xa89d('0x60')])?moment()[_0xa89d('0x58')](_0xa89d('0x59')):undefined});}return null;})[_0xa89d('0x1b')](function(_0x3541cb){if(_0x3541cb){_0x2f5d28[_0xa89d('0x61')]=_0x3541cb[_0xa89d('0x5d')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2701f3[_0xa89d('0x5b')]['id'],_0x2701f3[_0xa89d('0x5b')][_0xa89d('0x32')],_0x2701f3[_0xa89d('0x5b')]['role'],_0x2f5d28[_0xa89d('0x61')]['id'],_0x2701f3[_0xa89d('0x51')]?JSON['stringify'](_0x2701f3['body']):_0xa89d('0x62'));return respondWithRpcPromise('AcceptMessage',_0xa89d('0x63'),_0x2f5d28);}return null;})[_0xa89d('0x1b')](function(_0x2e65fd){var _0x5dc9ee=_0xa89d('0x64')+_0x2e65fd['message'][_0xa89d('0x65')];return db[_0xa89d('0x66')][_0xa89d('0x39')](_0x5dc9ee,{'type':db['Sequelize'][_0xa89d('0x67')][_0xa89d('0x68')],'raw':!![]})[_0xa89d('0x1b')](function(_0x5dca18){return _0x5dca18;});})[_0xa89d('0x1b')](function(_0xc34419){if(_0xc34419){_0x2f5d28[_0xa89d('0x22')][_0xa89d('0x69')]=_0xc34419[0x0];if(!_0x2701f3['body']['UserId'])return;return db[_0xa89d('0x6a')][_0xa89d('0x4f')]({'where':{'id':_0x2701f3[_0xa89d('0x51')][_0xa89d('0x5a')],'role':_0xa89d('0x5c')},'attributes':['id','name',_0xa89d('0x6b'),_0xa89d('0x6c'),'internal'],'raw':!![]});}return null;})[_0xa89d('0x1b')](function(_0x36435c){if(!_0x36435c)return null;_0x2f5d28[_0xa89d('0x22')][_0xa89d('0x5c')]=_0x36435c;return _0x2f5d28;})[_0xa89d('0x1b')](function(_0x5251fd){if(_0x5251fd){if(_0x2701f3[_0xa89d('0x51')][_0xa89d('0x6d')]){_0x2f5d28[_0xa89d('0x22')][_0xa89d('0x6e')]=util['format'](_0xa89d('0x6f'),_0x2701f3[_0xa89d('0x5b')][_0xa89d('0x32')]);_0x2f5d28['message'][_0xa89d('0x70')]=_0x2f5d28['channel'];_0x2f5d28[_0xa89d('0x22')][_0xa89d('0x71')]=_0x2f5d28[_0xa89d('0x70')];_0x2f5d28[_0xa89d('0x22')][_0xa89d('0x72')]=_0xa89d('0x54');return respondWithRpcPromise('EventManager',_0xa89d('0x73'),{'event':_0xa89d('0x74'),'message':_[_0xa89d('0x47')](_0x2f5d28[_0xa89d('0x22')],JSON['parse'](_0x2f5d28['interaction'][_0xa89d('0x75')]))},client9002)[_0xa89d('0x1b')](function(){return _0x2f5d28;});}return _0x2f5d28;}return null;})[_0xa89d('0x1b')](respondWithResult(_0xe8338e,null))[_0xa89d('0x23')](handleError(_0xe8338e,null));};var interaction_log=require(_0xa89d('0x10'))(_0xa89d('0x76'));exports[_0xa89d('0x2f')]=function(_0x173191,_0x4d21a8,_0x1b2d06){var _0x5eb712={'agent':{},'channel':_0xa89d('0x55')};if(_0x173191[_0xa89d('0x51')]['id']){delete _0x173191[_0xa89d('0x51')]['id'];}_0x173191[_0xa89d('0x51')][_0xa89d('0x5a')]=_0x173191['body'][_0xa89d('0x5a')]||_0x173191[_0xa89d('0x5b')]['id'];_0x5eb712[_0xa89d('0x5c')]['id']=_0x173191[_0xa89d('0x51')]['UserId'];return db[_0xa89d('0x4b')][_0xa89d('0x4f')]({'where':{'id':_0x173191['params']['id'],'UserId':null}})[_0xa89d('0x1b')](handleEntityNotFound(_0x4d21a8,null))[_0xa89d('0x1b')](function(_0x51621c){if(_0x51621c){_0x5eb712[_0xa89d('0x22')]=_0x51621c[_0xa89d('0x5d')]({'plain':!![]});return db[_0xa89d('0x5e')][_0xa89d('0x4f')]({'where':{'id':_0x51621c[_0xa89d('0x5f')]}});}return null;})[_0xa89d('0x1b')](handleEntityNotFound(_0x4d21a8,null))[_0xa89d('0x1b')](function(_0x147b9e){if(_0x147b9e){_0x5eb712[_0xa89d('0x61')]=_0x147b9e[_0xa89d('0x5d')]({'plain':!![]});interaction_log[_0xa89d('0x1c')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x173191[_0xa89d('0x5b')]['id'],_0x173191['user'][_0xa89d('0x32')],_0x173191[_0xa89d('0x5b')][_0xa89d('0x77')],_0x5eb712[_0xa89d('0x61')]['id'],_0x173191[_0xa89d('0x51')]?JSON[_0xa89d('0x78')](_0x173191[_0xa89d('0x51')]):_0xa89d('0x62'));return respondWithRpcPromise(_0xa89d('0x79'),'rejectMessage',_0x5eb712);}return null;})[_0xa89d('0x1b')](function(_0x59af76){var _0x1d6c2b=_0xa89d('0x64')+_0x59af76['message'][_0xa89d('0x65')];return db[_0xa89d('0x66')][_0xa89d('0x39')](_0x1d6c2b,{'type':db[_0xa89d('0x7a')]['QueryTypes'][_0xa89d('0x68')],'raw':!![]})[_0xa89d('0x1b')](function(_0x21563b){return _0x21563b;});})[_0xa89d('0x1b')](function(_0x355720){if(_0x355720){_0x5eb712[_0xa89d('0x22')][_0xa89d('0x69')]=_0x355720[0x0];if(!_0x173191['body'][_0xa89d('0x5a')])return;return db['User'][_0xa89d('0x4f')]({'where':{'id':_0x173191[_0xa89d('0x51')]['UserId'],'role':_0xa89d('0x5c')},'attributes':['id',_0xa89d('0x32'),_0xa89d('0x6b'),_0xa89d('0x6c'),_0xa89d('0x7b')],'raw':!![]});}return null;})['then'](function(_0x431aff){if(!_0x431aff)return null;_0x5eb712['message'][_0xa89d('0x5c')]=_0x431aff;return _0x5eb712;})[_0xa89d('0x1b')](function(_0xf5d1e1){if(_0xf5d1e1){_0xf5d1e1['message'][_0xa89d('0x6e')]=util[_0xa89d('0x58')]('SIP/%s',_0x173191[_0xa89d('0x5b')][_0xa89d('0x32')]);_0xf5d1e1[_0xa89d('0x22')]['channel']=_0x5eb712[_0xa89d('0x70')];_0xf5d1e1[_0xa89d('0x22')][_0xa89d('0x71')]=_0x5eb712['channel'];_0xf5d1e1[_0xa89d('0x22')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xa89d('0x7c'),'message':_[_0xa89d('0x47')](_0x5eb712[_0xa89d('0x22')],JSON[_0xa89d('0x7d')](_0x5eb712['interaction'][_0xa89d('0x75')]))},client9002);return _0x5eb712;}return null;})['then'](respondWithResult(_0x4d21a8,null))[_0xa89d('0x23')](handleError(_0x4d21a8,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 28b0689..2dd0104 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 _0x8456=['ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4ddc7a,_0x5b6cb8){var _0x4547c1=function(_0x3739e7){while(--_0x3739e7){_0x4ddc7a['push'](_0x4ddc7a['shift']());}};_0x4547c1(++_0x5b6cb8);}(_0x8456,0x9e));var _0x6845=function(_0x2bdd0e,_0x16948d){_0x2bdd0e=_0x2bdd0e-0x0;var _0x317ebd=_0x8456[_0x2bdd0e];return _0x317ebd;};'use strict';var EventEmitter=require(_0x6845('0x0'));var ChatMessage=require(_0x6845('0x1'))['db'][_0x6845('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6845('0x3')](0x0);var events={'afterCreate':_0x6845('0x4'),'afterUpdate':_0x6845('0x5'),'afterDestroy':_0x6845('0x6')};function emitEvent(_0x5dd97e){return function(_0x2c47c0,_0x13f2ad,_0x3f7e4a){ChatMessageEvents[_0x6845('0x7')](_0x5dd97e+':'+_0x2c47c0['id'],_0x2c47c0);ChatMessageEvents[_0x6845('0x7')](_0x5dd97e,_0x2c47c0);_0x3f7e4a(null);};}for(var e in events){if(events[_0x6845('0x8')](e)){var event=events[e];ChatMessage[_0x6845('0x9')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xce12=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x373ece,_0x724a30){var _0x33bb5b=function(_0x209cbb){while(--_0x209cbb){_0x373ece['push'](_0x373ece['shift']());}};_0x33bb5b(++_0x724a30);}(_0xce12,0x7d));var _0x2ce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce12[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x2ce1('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2ce1('0x1')](0x0);var events={'afterCreate':_0x2ce1('0x2'),'afterUpdate':_0x2ce1('0x3'),'afterDestroy':_0x2ce1('0x4')};function emitEvent(_0x191875){return function(_0x133273,_0x2ede16,_0x309755){ChatMessageEvents[_0x2ce1('0x5')](_0x191875+':'+_0x133273['id'],_0x133273);ChatMessageEvents['emit'](_0x191875,_0x133273);_0x309755(null);};}for(var e in events){if(events[_0x2ce1('0x6')](e)){var event=events[e];ChatMessage[_0x2ce1('0x7')](e,emitEvent(event));}}module[_0x2ce1('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 10691e3..c28ed42 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 _0x3c6d=['ChatInteraction','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil'];(function(_0x26aafa,_0x100c92){var _0x13b20e=function(_0x3f6216){while(--_0x3f6216){_0x26aafa['push'](_0x26aafa['shift']());}};_0x13b20e(++_0x100c92);}(_0x3c6d,0x190));var _0xd3c6=function(_0x10beb5,_0x3758b8){_0x10beb5=_0x10beb5-0x0;var _0x361364=_0x3c6d[_0x10beb5];return _0x361364;};'use strict';var _=require(_0xd3c6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd3c6('0x1'));var moment=require(_0xd3c6('0x2'));var BPromise=require(_0xd3c6('0x3'));var rp=require(_0xd3c6('0x4'));var fs=require('fs');var path=require(_0xd3c6('0x5'));var rimraf=require(_0xd3c6('0x6'));var config=require(_0xd3c6('0x7'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x4523d4,_0x4a1c95){return _0x4523d4[_0xd3c6('0x8')]('ChatMessage',attributes,{'tableName':_0xd3c6('0x9'),'paranoid':![],'indexes':[{'name':_0xd3c6('0xa'),'fields':[_0xd3c6('0xb')],'type':_0xd3c6('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6492c9,_0x1f1ce7,_0x316ab5){var _0x2d6b68=_0x4523d4[_0xd3c6('0xd')];var _0x185b28=_0x6492c9[_0xd3c6('0xe')]({'plain':!![]});if(_0x185b28['direction'][_0xd3c6('0xf')]()==='in'||_0x185b28[_0xd3c6('0x10')][_0xd3c6('0xf')]()===_0xd3c6('0x11')&&!_0x185b28[_0xd3c6('0x12')]&&!_[_0xd3c6('0x13')](_0x185b28['UserId'])){_0x2d6b68[_0xd3c6('0x14')][_0xd3c6('0x15')]({'where':{'id':_0x185b28['ChatInteractionId']}})[_0xd3c6('0x16')](function(_0x1c45dc){if(_0x1c45dc){_0x1c45dc[_0xd3c6('0x17')]({'lastMsgAt':_0x185b28[_0xd3c6('0x18')],'lastMsgDirection':_0x185b28[_0xd3c6('0x10')][_0xd3c6('0xf')]()});}})[_0xd3c6('0x19')](function(_0x1b8653){console['error'](_0x1b8653);});}_0x316ab5();}},'charset':_0xd3c6('0x1a'),'collate':_0xd3c6('0x1b')});}; \ No newline at end of file +var _0x2aff=['out','secret','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x18cdfc,_0x4238a6){var _0x1ec1bf=function(_0x2e3137){while(--_0x2e3137){_0x18cdfc['push'](_0x18cdfc['shift']());}};_0x1ec1bf(++_0x4238a6);}(_0x2aff,0x6b));var _0xf2af=function(_0xac12b,_0x3f0dfa){_0xac12b=_0xac12b-0x0;var _0x5d1fd3=_0x2aff[_0xac12b];return _0x5d1fd3;};'use strict';var _=require('lodash');var util=require(_0xf2af('0x0'));var logger=require(_0xf2af('0x1'))(_0xf2af('0x2'));var moment=require(_0xf2af('0x3'));var BPromise=require(_0xf2af('0x4'));var rp=require(_0xf2af('0x5'));var fs=require('fs');var path=require(_0xf2af('0x6'));var rimraf=require(_0xf2af('0x7'));var config=require(_0xf2af('0x8'));var attributes=require(_0xf2af('0x9'));module[_0xf2af('0xa')]=function(_0xf56cec,_0x3a97b1){return _0xf56cec[_0xf2af('0xb')](_0xf2af('0xc'),attributes,{'tableName':_0xf2af('0xd'),'paranoid':![],'indexes':[{'name':_0xf2af('0xe'),'fields':[_0xf2af('0xf')],'type':_0xf2af('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5dd0b3,_0xd5bb5c,_0x432e9c){var _0x167df9=_0xf56cec[_0xf2af('0x11')];var _0x373f27=_0x5dd0b3[_0xf2af('0x12')]({'plain':!![]});if(_0x373f27[_0xf2af('0x13')]['toLowerCase']()==='in'||_0x373f27[_0xf2af('0x13')][_0xf2af('0x14')]()===_0xf2af('0x15')&&!_0x373f27[_0xf2af('0x16')]&&!_['isNil'](_0x373f27['UserId'])){_0x167df9[_0xf2af('0x17')][_0xf2af('0x18')]({'where':{'id':_0x373f27[_0xf2af('0x19')]}})['then'](function(_0x5ee9cc){if(_0x5ee9cc){_0x5ee9cc[_0xf2af('0x1a')]({'lastMsgAt':_0x373f27[_0xf2af('0x1b')],'lastMsgDirection':_0x373f27[_0xf2af('0x13')][_0xf2af('0x14')]()});}})[_0xf2af('0x1c')](function(_0x2d261e){console[_0xf2af('0x1d')](_0x2d261e);});}_0x432e9c();}},'charset':_0xf2af('0x1e'),'collate':_0xf2af('0x1f')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e9238ad..613b086 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 _0xec28=['CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatMessage,\x20%s,\x20%s','catch'];(function(_0x4e7c73,_0x44dc00){var _0x3da080=function(_0x587a6b){while(--_0x587a6b){_0x4e7c73['push'](_0x4e7c73['shift']());}};_0x3da080(++_0x44dc00);}(_0xec28,0x14a));var _0x8ec2=function(_0x5ac791,_0x504d37){_0x5ac791=_0x5ac791-0x0;var _0x9e3a19=_0xec28[_0x5ac791];return _0x9e3a19;};'use strict';var _=require(_0x8ec2('0x0'));var util=require(_0x8ec2('0x1'));var moment=require('moment');var BPromise=require(_0x8ec2('0x2'));var rs=require(_0x8ec2('0x3'));var fs=require('fs');var Redis=require(_0x8ec2('0x4'));var db=require(_0x8ec2('0x5'))['db'];var utils=require(_0x8ec2('0x6'));var logger=require(_0x8ec2('0x7'))(_0x8ec2('0x8'));var config=require(_0x8ec2('0x9'));var jayson=require(_0x8ec2('0xa'));var client=jayson[_0x8ec2('0xb')][_0x8ec2('0xc')]({'port':0x232a});config[_0x8ec2('0xd')]=_[_0x8ec2('0xe')](config[_0x8ec2('0xd')],{'host':_0x8ec2('0xf'),'port':0x18eb});var socket=require(_0x8ec2('0x10'))(new Redis(config[_0x8ec2('0xd')]));require(_0x8ec2('0x11'))[_0x8ec2('0x12')](socket);function respondWithRpcPromise(_0x51fd43,_0x437b3e,_0x4cb148){return new BPromise(function(_0x179825,_0x3b02ce){return client[_0x8ec2('0x13')](_0x51fd43,_0x4cb148)[_0x8ec2('0x14')](function(_0x34c39e){logger[_0x8ec2('0x15')]('ChatMessage,\x20%s,\x20%s',_0x437b3e,_0x8ec2('0x16'));logger[_0x8ec2('0x17')](_0x8ec2('0x18'),_0x437b3e,_0x8ec2('0x16'),JSON[_0x8ec2('0x19')](_0x34c39e));if(_0x34c39e[_0x8ec2('0x1a')]){if(_0x34c39e['error']['code']===0x1f4){logger[_0x8ec2('0x1a')]('ChatMessage,\x20%s,\x20%s',_0x437b3e,_0x34c39e[_0x8ec2('0x1a')]['message']);return _0x3b02ce(_0x34c39e[_0x8ec2('0x1a')][_0x8ec2('0x1b')]);}logger[_0x8ec2('0x1a')](_0x8ec2('0x1c'),_0x437b3e,_0x34c39e['error'][_0x8ec2('0x1b')]);return _0x179825(_0x34c39e[_0x8ec2('0x1a')][_0x8ec2('0x1b')]);}else{logger[_0x8ec2('0x15')](_0x8ec2('0x1c'),_0x437b3e,'request\x20sent');_0x179825(_0x34c39e['result'][_0x8ec2('0x1b')]);}})[_0x8ec2('0x1d')](function(_0x4cc094){logger[_0x8ec2('0x1a')](_0x8ec2('0x1c'),_0x437b3e,_0x4cc094);_0x3b02ce(_0x4cc094);});});}exports[_0x8ec2('0x1e')]=function(_0x1e7381){var _0xc922cf=this;return new Promise(function(_0x148367,_0x5ed09a){return db[_0x8ec2('0x1f')][_0x8ec2('0x20')](_0x1e7381[_0x8ec2('0x21')],{'raw':_0x1e7381[_0x8ec2('0x22')]?_0x1e7381[_0x8ec2('0x22')][_0x8ec2('0x23')]===undefined?!![]:![]:!![]})[_0x8ec2('0x14')](function(_0x87ac84){logger['info'](_0x8ec2('0x1e'),_0x1e7381);logger[_0x8ec2('0x17')](_0x8ec2('0x1e'),_0x1e7381,JSON[_0x8ec2('0x19')](_0x87ac84));_0x148367(_0x87ac84);})[_0x8ec2('0x1d')](function(_0x4d72b3){logger[_0x8ec2('0x1a')](_0x8ec2('0x1e'),_0x4d72b3[_0x8ec2('0x1b')],_0x1e7381);_0x5ed09a(_0xc922cf[_0x8ec2('0x1a')](0x1f4,_0x4d72b3[_0x8ec2('0x1b')]));});});}; \ No newline at end of file +var _0xe3e4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','debug','stringify','code','error','message','info','result','CreateChatMessage','create','body','options','raw','catch','lodash','util','moment'];(function(_0x3af393,_0x5887c4){var _0x532015=function(_0x3a472b){while(--_0x3a472b){_0x3af393['push'](_0x3af393['shift']());}};_0x532015(++_0x5887c4);}(_0xe3e4,0xc3));var _0x4e3e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe3e4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4e3e('0x0'));var util=require(_0x4e3e('0x1'));var moment=require(_0x4e3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e3e('0x3'));var fs=require('fs');var Redis=require(_0x4e3e('0x4'));var db=require(_0x4e3e('0x5'))['db'];var utils=require(_0x4e3e('0x6'));var logger=require(_0x4e3e('0x7'))('rpc');var config=require(_0x4e3e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4e3e('0x9')][_0x4e3e('0xa')]({'port':0x232a});config[_0x4e3e('0xb')]=_[_0x4e3e('0xc')](config[_0x4e3e('0xb')],{'host':_0x4e3e('0xd'),'port':0x18eb});var socket=require(_0x4e3e('0xe'))(new Redis(config[_0x4e3e('0xb')]));require(_0x4e3e('0xf'))[_0x4e3e('0x10')](socket);function respondWithRpcPromise(_0x32c4bf,_0x465a9a,_0x21bb0b){return new BPromise(function(_0x1cb7aa,_0x51a4cc){return client[_0x4e3e('0x11')](_0x32c4bf,_0x21bb0b)[_0x4e3e('0x12')](function(_0x304cd0){logger['info'](_0x4e3e('0x13'),_0x465a9a,'request\x20sent');logger[_0x4e3e('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x465a9a,'request\x20sent',JSON[_0x4e3e('0x15')](_0x304cd0));if(_0x304cd0['error']){if(_0x304cd0['error'][_0x4e3e('0x16')]===0x1f4){logger[_0x4e3e('0x17')](_0x4e3e('0x13'),_0x465a9a,_0x304cd0['error']['message']);return _0x51a4cc(_0x304cd0[_0x4e3e('0x17')]['message']);}logger[_0x4e3e('0x17')]('ChatMessage,\x20%s,\x20%s',_0x465a9a,_0x304cd0[_0x4e3e('0x17')]['message']);return _0x1cb7aa(_0x304cd0['error'][_0x4e3e('0x18')]);}else{logger[_0x4e3e('0x19')]('ChatMessage,\x20%s,\x20%s',_0x465a9a,'request\x20sent');_0x1cb7aa(_0x304cd0[_0x4e3e('0x1a')][_0x4e3e('0x18')]);}})['catch'](function(_0x2d51a7){logger[_0x4e3e('0x17')](_0x4e3e('0x13'),_0x465a9a,_0x2d51a7);_0x51a4cc(_0x2d51a7);});});}exports[_0x4e3e('0x1b')]=function(_0x3bbb8a){var _0x1e979d=this;return new Promise(function(_0x8b5b71,_0x27c829){return db['ChatMessage'][_0x4e3e('0x1c')](_0x3bbb8a[_0x4e3e('0x1d')],{'raw':_0x3bbb8a[_0x4e3e('0x1e')]?_0x3bbb8a[_0x4e3e('0x1e')][_0x4e3e('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x49ae5b){logger[_0x4e3e('0x19')](_0x4e3e('0x1b'),_0x3bbb8a);logger[_0x4e3e('0x14')]('CreateChatMessage',_0x3bbb8a,JSON[_0x4e3e('0x15')](_0x49ae5b));_0x8b5b71(_0x49ae5b);})[_0x4e3e('0x20')](function(_0x89f09){logger[_0x4e3e('0x17')](_0x4e3e('0x1b'),_0x89f09['message'],_0x3bbb8a);_0x27c829(_0x1e979d['error'](0x1f4,_0x89f09[_0x4e3e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7bbff99..1e10966 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 _0x2975=['update','removeListener','register','length','chatMessage:','save','remove'];(function(_0x667ff8,_0x59e7df){var _0x2ddfc7=function(_0x5a4a46){while(--_0x5a4a46){_0x667ff8['push'](_0x667ff8['shift']());}};_0x2ddfc7(++_0x59e7df);}(_0x2975,0x1c5));var _0x5297=function(_0x382609,_0x1d2fa2){_0x382609=_0x382609-0x0;var _0x5a6ae5=_0x2975[_0x382609];return _0x5a6ae5;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5297('0x0'),_0x5297('0x1'),_0x5297('0x2')];function createListener(_0x1a511b,_0x115e60){return function(_0x178801){_0x115e60['emit'](_0x1a511b,_0x178801);};}function removeListener(_0x56371f,_0x5e9de3){return function(){ChatMessageEvents[_0x5297('0x3')](_0x56371f,_0x5e9de3);};}exports[_0x5297('0x4')]=function(_0x11a43d){for(var _0x3da9c6=0x0,_0x4d1d2c=events[_0x5297('0x5')];_0x3da9c6<_0x4d1d2c;_0x3da9c6++){var _0x1b72a7=events[_0x3da9c6];var _0x4f12b0=createListener(_0x5297('0x6')+_0x1b72a7,_0x11a43d);ChatMessageEvents['on'](_0x1b72a7,_0x4f12b0);}}; \ No newline at end of file +var _0x7c1f=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x691e56,_0x4d33a5){var _0x91888=function(_0x176d02){while(--_0x176d02){_0x691e56['push'](_0x691e56['shift']());}};_0x91888(++_0x4d33a5);}(_0x7c1f,0x194));var _0xf7c1=function(_0x12a003,_0x8352c3){_0x12a003=_0x12a003-0x0;var _0x57b5ba=_0x7c1f[_0x12a003];return _0x57b5ba;};'use strict';var ChatMessageEvents=require(_0xf7c1('0x0'));var events=[_0xf7c1('0x1'),_0xf7c1('0x2'),_0xf7c1('0x3')];function createListener(_0x3ca7b6,_0x568116){return function(_0x1e3254){_0x568116[_0xf7c1('0x4')](_0x3ca7b6,_0x1e3254);};}function removeListener(_0x18f5a9,_0x485d8d){return function(){ChatMessageEvents[_0xf7c1('0x5')](_0x18f5a9,_0x485d8d);};}exports[_0xf7c1('0x6')]=function(_0x3c21cf){for(var _0x136e1e=0x0,_0x5423bf=events[_0xf7c1('0x7')];_0x136e1e<_0x5423bf;_0x136e1e++){var _0x1a342b=events[_0x136e1e];var _0x329050=createListener(_0xf7c1('0x8')+_0x1a342b,_0x3c21cf);ChatMessageEvents['on'](_0x1a342b,_0x329050);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 8f8ec4c..5f6d359 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 _0x8f15=['destroy','exports','multer','util','path','express','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','tracked','chatmessage:create','put','/:id','update','/:id/accept','accept'];(function(_0x5b54c8,_0x952a7){var _0x50339a=function(_0x3b04d7){while(--_0x3b04d7){_0x5b54c8['push'](_0x5b54c8['shift']());}};_0x50339a(++_0x952a7);}(_0x8f15,0xd4));var _0x58f1=function(_0x36a92a,_0x519210){_0x36a92a=_0x36a92a-0x0;var _0x539e72=_0x8f15[_0x36a92a];return _0x539e72;};'use strict';var multer=require(_0x58f1('0x0'));var util=require(_0x58f1('0x1'));var path=require(_0x58f1('0x2'));var timeout=require('connect-timeout');var express=require(_0x58f1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x58f1('0x4'));var config=require('../../config/environment');var controller=require(_0x58f1('0x5'));router[_0x58f1('0x6')]('/',auth[_0x58f1('0x7')](),controller[_0x58f1('0x8')]);router[_0x58f1('0x6')](_0x58f1('0x9'),auth['isAuthenticated'](),controller[_0x58f1('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x58f1('0xb')]);router['post']('/',auth[_0x58f1('0x7')](),interaction[_0x58f1('0xc')]('chat',_0x58f1('0xd')),controller['create']);router[_0x58f1('0xe')](_0x58f1('0xf'),controller[_0x58f1('0x10')]);router[_0x58f1('0xe')](_0x58f1('0x11'),auth['isAuthenticated'](),controller[_0x58f1('0x12')]);router[_0x58f1('0xe')]('/:id/reject',auth[_0x58f1('0x7')](),controller['reject']);router['delete'](_0x58f1('0xf'),auth['isAuthenticated'](),controller[_0x58f1('0x13')]);module[_0x58f1('0x14')]=router; \ No newline at end of file +var _0x7db5=['../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','show','tracked','chat','chatmessage:create','put','update','accept','/:id/reject','reject','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x341606,_0x304efe){var _0x2b7f94=function(_0x216c97){while(--_0x216c97){_0x341606['push'](_0x341606['shift']());}};_0x2b7f94(++_0x304efe);}(_0x7db5,0xc0));var _0x57db=function(_0x8b8e3a,_0x197385){_0x8b8e3a=_0x8b8e3a-0x0;var _0x45ea5f=_0x7db5[_0x8b8e3a];return _0x45ea5f;};'use strict';var multer=require(_0x57db('0x0'));var util=require(_0x57db('0x1'));var path=require('path');var timeout=require(_0x57db('0x2'));var express=require('express');var router=express[_0x57db('0x3')]();var fs_extra=require(_0x57db('0x4'));var auth=require(_0x57db('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x57db('0x6'));var controller=require(_0x57db('0x7'));router[_0x57db('0x8')]('/',auth[_0x57db('0x9')](),controller[_0x57db('0xa')]);router[_0x57db('0x8')]('/describe',auth[_0x57db('0x9')](),controller[_0x57db('0xb')]);router[_0x57db('0x8')](_0x57db('0xc'),auth['isAuthenticated'](),controller[_0x57db('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x57db('0xe')](_0x57db('0xf'),_0x57db('0x10')),controller['create']);router[_0x57db('0x11')](_0x57db('0xc'),controller[_0x57db('0x12')]);router[_0x57db('0x11')]('/:id/accept',auth[_0x57db('0x9')](),controller[_0x57db('0x13')]);router[_0x57db('0x11')](_0x57db('0x14'),auth[_0x57db('0x9')](),controller[_0x57db('0x15')]);router['delete'](_0x57db('0xc'),auth[_0x57db('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c1ab779..437bb6b 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 _0xadb5=['medium','TEXT','exports'];(function(_0x2681de,_0x2f0760){var _0x565a4b=function(_0x126b4b){while(--_0x126b4b){_0x2681de['push'](_0x2681de['shift']());}};_0x565a4b(++_0x2f0760);}(_0xadb5,0xad));var _0x5adb=function(_0x49ca88,_0x4a5082){_0x49ca88=_0x49ca88-0x0;var _0x16f46d=_0xadb5[_0x49ca88];return _0x16f46d;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x757a=['exports','TEXT'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x757a,0xde));var _0xa757=function(_0x1692f2,_0x18ef8a){_0x1692f2=_0x1692f2-0x0;var _0xa11c8b=_0x757a[_0x1692f2];return _0xa11c8b;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 094e011..df6cc52 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(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x7a54,0x106));var _0x47a5=function(_0x21d0c4,_0x1798cb){_0x21d0c4=_0x21d0c4-0x0;var _0x4a7389=_0x7a54[_0x21d0c4];return _0x4a7389;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x285f89,_0x3bdc20){var _0x4500eb=function(_0xccc660){while(--_0xccc660){_0x285f89['push'](_0x285f89['shift']());}};_0x4500eb(++_0x3bdc20);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 5ba2c23..8a5d108 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 _0x6217=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove'];(function(_0x52e66b,_0x1413cf){var _0x3dc151=function(_0x566945){while(--_0x566945){_0x52e66b['push'](_0x52e66b['shift']());}};_0x3dc151(++_0x1413cf);}(_0x6217,0x1bc));var _0x7621=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x6217[_0xa990b7];return _0x52c99c;};'use strict';var EventEmitter=require(_0x7621('0x0'));var ChatOfflineMessage=require(_0x7621('0x1'))['db'][_0x7621('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7621('0x3')](0x0);var events={'afterCreate':_0x7621('0x4'),'afterUpdate':_0x7621('0x5'),'afterDestroy':_0x7621('0x6')};function emitEvent(_0x5051bc){return function(_0x4c36b9,_0x3fc5be,_0x21a300){ChatOfflineMessageEvents[_0x7621('0x7')](_0x5051bc+':'+_0x4c36b9['id'],_0x4c36b9);ChatOfflineMessageEvents[_0x7621('0x7')](_0x5051bc,_0x4c36b9);_0x21a300(null);};}for(var e in events){if(events[_0x7621('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x7621('0x9')](e,emitEvent(event));}}module[_0x7621('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x188f=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit'];(function(_0xe77233,_0x48306f){var _0x7fd60e=function(_0x1382a9){while(--_0x1382a9){_0xe77233['push'](_0xe77233['shift']());}};_0x7fd60e(++_0x48306f);}(_0x188f,0x1a5));var _0xf188=function(_0x5dfe0c,_0x2e0202){_0x5dfe0c=_0x5dfe0c-0x0;var _0x4832c4=_0x188f[_0x5dfe0c];return _0x4832c4;};'use strict';var EventEmitter=require(_0xf188('0x0'));var ChatOfflineMessage=require(_0xf188('0x1'))['db'][_0xf188('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xf188('0x3')](0x0);var events={'afterCreate':_0xf188('0x4'),'afterUpdate':_0xf188('0x5'),'afterDestroy':_0xf188('0x6')};function emitEvent(_0x554df6){return function(_0x5637c6,_0x204680,_0x52b670){ChatOfflineMessageEvents['emit'](_0x554df6+':'+_0x5637c6['id'],_0x5637c6);ChatOfflineMessageEvents[_0xf188('0x7')](_0x554df6,_0x5637c6);_0x52b670(null);};}for(var e in events){if(events[_0xf188('0x8')](e)){var event=events[e];ChatOfflineMessage[_0xf188('0x9')](e,emitEvent(event));}}module[_0xf188('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 4e30152..fac6309 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 _0x8f57=['define','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports'];(function(_0x4ba160,_0x249ba7){var _0x57196b=function(_0x364b5b){while(--_0x364b5b){_0x4ba160['push'](_0x4ba160['shift']());}};_0x57196b(++_0x249ba7);}(_0x8f57,0xa8));var _0x78f5=function(_0x4bcbc2,_0x46cbff){_0x4bcbc2=_0x4bcbc2-0x0;var _0xe5b888=_0x8f57[_0x4bcbc2];return _0xe5b888;};'use strict';var attributes=require(_0x78f5('0x0'));module[_0x78f5('0x1')]=function(_0x41c1a5){return _0x41c1a5[_0x78f5('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x78f5('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x78f5('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9c49=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0xa92d6e,_0x3b408c){var _0x2825fd=function(_0x1616e1){while(--_0x1616e1){_0xa92d6e['push'](_0xa92d6e['shift']());}};_0x2825fd(++_0x3b408c);}(_0x9c49,0x1d6));var _0x99c4=function(_0x2a0040,_0x2aeac4){_0x2a0040=_0x2a0040-0x0;var _0x3bfa9e=_0x9c49[_0x2a0040];return _0x3bfa9e;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x35e0e9){return _0x35e0e9[_0x99c4('0x0')](_0x99c4('0x1'),attributes,{'tableName':_0x99c4('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x99c4('0x3'),'collate':_0x99c4('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 5a270d2..23681e7 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 _0xa0d6=['message','result','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x416939,_0x5e8347){var _0x10b649=function(_0xaf7094){while(--_0xaf7094){_0x416939['push'](_0x416939['shift']());}};_0x10b649(++_0x5e8347);}(_0xa0d6,0x1f0));var _0x6a0d=function(_0x1e5ad6,_0x34417a){_0x1e5ad6=_0x1e5ad6-0x0;var _0x5bc0d3=_0xa0d6[_0x1e5ad6];return _0x5bc0d3;};'use strict';var _=require(_0x6a0d('0x0'));var util=require(_0x6a0d('0x1'));var moment=require('moment');var BPromise=require(_0x6a0d('0x2'));var rs=require(_0x6a0d('0x3'));var fs=require('fs');var Redis=require(_0x6a0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6a0d('0x5'));var config=require(_0x6a0d('0x6'));var jayson=require(_0x6a0d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x172d9a,_0x53d72d,_0x123a87){return new BPromise(function(_0x1f7595,_0x205615){return client[_0x6a0d('0x8')](_0x172d9a,_0x123a87)[_0x6a0d('0x9')](function(_0x39aa65){logger[_0x6a0d('0xa')](_0x6a0d('0xb'),_0x53d72d,'request\x20sent');logger[_0x6a0d('0xc')](_0x6a0d('0xd'),_0x53d72d,_0x6a0d('0xe'),JSON['stringify'](_0x39aa65));if(_0x39aa65['error']){if(_0x39aa65[_0x6a0d('0xf')][_0x6a0d('0x10')]===0x1f4){logger[_0x6a0d('0xf')](_0x6a0d('0xb'),_0x53d72d,_0x39aa65['error'][_0x6a0d('0x11')]);return _0x205615(_0x39aa65[_0x6a0d('0xf')][_0x6a0d('0x11')]);}logger[_0x6a0d('0xf')](_0x6a0d('0xb'),_0x53d72d,_0x39aa65[_0x6a0d('0xf')][_0x6a0d('0x11')]);return _0x1f7595(_0x39aa65['error'][_0x6a0d('0x11')]);}else{logger['info'](_0x6a0d('0xb'),_0x53d72d,'request\x20sent');_0x1f7595(_0x39aa65[_0x6a0d('0x12')][_0x6a0d('0x11')]);}})['catch'](function(_0x5f5d6d){logger[_0x6a0d('0xf')](_0x6a0d('0xb'),_0x53d72d,_0x5f5d6d);_0x205615(_0x5f5d6d);});});} \ No newline at end of file +var _0x640a=['code','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x640a,0x133));var _0xa640=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x640a[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xa640('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa640('0x1'));var rs=require(_0xa640('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa640('0x3'))['db'];var utils=require(_0xa640('0x4'));var logger=require(_0xa640('0x5'))(_0xa640('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa640('0x7')][_0xa640('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3940c8,_0x1f76e3,_0x4ca12a){return new BPromise(function(_0x344b83,_0x16bcc5){return client[_0xa640('0x9')](_0x3940c8,_0x4ca12a)['then'](function(_0xbaf0a){logger[_0xa640('0xa')](_0xa640('0xb'),_0x1f76e3,'request\x20sent');logger[_0xa640('0xc')](_0xa640('0xd'),_0x1f76e3,_0xa640('0xe'),JSON['stringify'](_0xbaf0a));if(_0xbaf0a[_0xa640('0xf')]){if(_0xbaf0a[_0xa640('0xf')][_0xa640('0x10')]===0x1f4){logger[_0xa640('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1f76e3,_0xbaf0a[_0xa640('0xf')]['message']);return _0x16bcc5(_0xbaf0a[_0xa640('0xf')]['message']);}logger['error'](_0xa640('0xb'),_0x1f76e3,_0xbaf0a['error'][_0xa640('0x11')]);return _0x344b83(_0xbaf0a['error']['message']);}else{logger[_0xa640('0xa')](_0xa640('0xb'),_0x1f76e3,_0xa640('0xe'));_0x344b83(_0xbaf0a[_0xa640('0x12')][_0xa640('0x11')]);}})['catch'](function(_0x596d7d){logger[_0xa640('0xf')](_0xa640('0xb'),_0x1f76e3,_0x596d7d);_0x16bcc5(_0x596d7d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 2129bb0..0dd20ff 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 _0xb406=['../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb406,0x197));var _0x6b40=function(_0xb20e64,_0x5cd27d){_0xb20e64=_0xb20e64-0x0;var _0x5efca5=_0xb406[_0xb20e64];return _0x5efca5;};'use strict';var multer=require(_0x6b40('0x0'));var util=require('util');var path=require(_0x6b40('0x1'));var timeout=require(_0x6b40('0x2'));var express=require(_0x6b40('0x3'));var router=express[_0x6b40('0x4')]();var fs_extra=require(_0x6b40('0x5'));var auth=require(_0x6b40('0x6'));var interaction=require(_0x6b40('0x7'));var config=require(_0x6b40('0x8'));var controller=require(_0x6b40('0x9'));router[_0x6b40('0xa')]('/',auth[_0x6b40('0xb')](),controller[_0x6b40('0xc')]);router[_0x6b40('0xa')](_0x6b40('0xd'),auth['isAuthenticated'](),controller[_0x6b40('0xe')]);router['get'](_0x6b40('0xf'),auth[_0x6b40('0xb')](),controller[_0x6b40('0x10')]);router[_0x6b40('0x11')]('/',auth[_0x6b40('0xb')](),controller[_0x6b40('0x12')]);router['put']('/:id',auth[_0x6b40('0xb')](),controller[_0x6b40('0x13')]);router[_0x6b40('0x14')]('/:id',auth[_0x6b40('0xb')](),controller[_0x6b40('0x15')]);module[_0x6b40('0x16')]=router; \ No newline at end of file +var _0x348e=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./chatOfflineMessage.controller','isAuthenticated','index','/:id'];(function(_0x2f2763,_0x4d9637){var _0x442362=function(_0xaed4fa){while(--_0xaed4fa){_0x2f2763['push'](_0x2f2763['shift']());}};_0x442362(++_0x4d9637);}(_0x348e,0x139));var _0xe348=function(_0x15204b,_0x12d6af){_0x15204b=_0x15204b-0x0;var _0x410d73=_0x348e[_0x15204b];return _0x410d73;};'use strict';var multer=require(_0xe348('0x0'));var util=require(_0xe348('0x1'));var path=require(_0xe348('0x2'));var timeout=require(_0xe348('0x3'));var express=require('express');var router=express[_0xe348('0x4')]();var fs_extra=require(_0xe348('0x5'));var auth=require(_0xe348('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe348('0x7'));router['get']('/',auth[_0xe348('0x8')](),controller[_0xe348('0x9')]);router['get']('/describe',auth[_0xe348('0x8')](),controller['describe']);router['get'](_0xe348('0xa'),auth[_0xe348('0x8')](),controller[_0xe348('0xb')]);router[_0xe348('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe348('0xd')](_0xe348('0xa'),auth[_0xe348('0x8')](),controller[_0xe348('0xe')]);router[_0xe348('0xf')](_0xe348('0xa'),auth['isAuthenticated'](),controller[_0xe348('0x10')]);module[_0xe348('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 7fd7017..3ab035e 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 _0x280a=['ENUM','mouseOver','timeout','sequelize','exports','STRING'];(function(_0x29be47,_0xf5e31b){var _0x595d1b=function(_0x343b49){while(--_0x343b49){_0x29be47['push'](_0x29be47['shift']());}};_0x595d1b(++_0xf5e31b);}(_0x280a,0xab));var _0xa280=function(_0x92724b,_0x18e7d6){_0x92724b=_0x92724b-0x0;var _0x12e4f5=_0x280a[_0x92724b];return _0x12e4f5;};'use strict';var Sequelize=require(_0xa280('0x0'));module[_0xa280('0x1')]={'name':{'type':Sequelize[_0xa280('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa280('0x3')](_0xa280('0x4'),_0xa280('0x5')),'defaultValue':_0xa280('0x4')},'selector':{'type':Sequelize[_0xa280('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xab29=['INTEGER','sequelize','exports','STRING','ENUM','timeout','mouseOver'];(function(_0x28c648,_0x2fe756){var _0x11e77e=function(_0x5b54e7){while(--_0x5b54e7){_0x28c648['push'](_0x28c648['shift']());}};_0x11e77e(++_0x2fe756);}(_0xab29,0x6a));var _0x9ab2=function(_0x3d75a7,_0x5d9a59){_0x3d75a7=_0x3d75a7-0x0;var _0x4cc10d=_0xab29[_0x3d75a7];return _0x4cc10d;};'use strict';var Sequelize=require(_0x9ab2('0x0'));module[_0x9ab2('0x1')]={'name':{'type':Sequelize[_0x9ab2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9ab2('0x3')]('mouseOver',_0x9ab2('0x4')),'defaultValue':_0x9ab2('0x5')},'selector':{'type':Sequelize[_0x9ab2('0x2')]},'timeout':{'type':Sequelize[_0x9ab2('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ced2eb3..2f2f28d 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 _0x8781=['limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','show','model','keys','query','filters','intersection','attributes','fields','includeAll','include','find','catch','ChatProactiveAction','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined'];(function(_0x3342ee,_0x2dd43e){var _0x11d861=function(_0x3e64b0){while(--_0x3e64b0){_0x3342ee['push'](_0x3342ee['shift']());}};_0x11d861(++_0x2dd43e);}(_0x8781,0x1c8));var _0x1878=function(_0x24b55c,_0x163e62){_0x24b55c=_0x24b55c-0x0;var _0x1f034e=_0x8781[_0x24b55c];return _0x1f034e;};'use strict';var emlformat=require(_0x1878('0x0'));var rimraf=require(_0x1878('0x1'));var zipdir=require(_0x1878('0x2'));var jsonpatch=require(_0x1878('0x3'));var rp=require(_0x1878('0x4'));var moment=require(_0x1878('0x5'));var BPromise=require(_0x1878('0x6'));var Mustache=require('mustache');var util=require(_0x1878('0x7'));var path=require(_0x1878('0x8'));var sox=require(_0x1878('0x9'));var csv=require(_0x1878('0xa'));var ejs=require(_0x1878('0xb'));var fs=require('fs');var fs_extra=require(_0x1878('0xc'));var _=require('lodash');var squel=require(_0x1878('0xd'));var crypto=require(_0x1878('0xe'));var jsforce=require(_0x1878('0xf'));var deskjs=require(_0x1878('0x10'));var toCsv=require(_0x1878('0xa'));var querystring=require(_0x1878('0x11'));var Papa=require(_0x1878('0x12'));var Redis=require(_0x1878('0x13'));var authService=require(_0x1878('0x14'));var qs=require(_0x1878('0x15'));var as=require(_0x1878('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1878('0x17'))(_0x1878('0x18'));var utils=require(_0x1878('0x19'));var config=require(_0x1878('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4272ab,_0x1ed9f0){_0x1ed9f0=_0x1ed9f0||0xcc;return function(_0x181e51){if(_0x181e51){return _0x4272ab[_0x1878('0x1b')](_0x1ed9f0);}return _0x4272ab['status'](_0x1ed9f0)['end']();};}function respondWithResult(_0x19ffaa,_0x396f3a){_0x396f3a=_0x396f3a||0xc8;return function(_0x49d3a1){if(_0x49d3a1){return _0x19ffaa[_0x1878('0x1c')](_0x396f3a)[_0x1878('0x1d')](_0x49d3a1);}};}function respondWithFilteredResult(_0xb324ba,_0x4a5ba9){return function(_0x562902){if(_0x562902){var _0x13e16d=typeof _0x4a5ba9[_0x1878('0x1e')]===_0x1878('0x1f')&&typeof _0x4a5ba9[_0x1878('0x20')]===_0x1878('0x1f');var _0x430e64=_0x562902[_0x1878('0x21')];var _0x1642b3=_0x13e16d?0x0:_0x4a5ba9[_0x1878('0x1e')];var _0x2b8492=_0x13e16d?_0x562902[_0x1878('0x21')]:_0x4a5ba9['offset']+_0x4a5ba9['limit'];var _0xf80c60;if(_0x2b8492>=_0x430e64){_0x2b8492=_0x430e64;_0xf80c60=0xc8;}else{_0xf80c60=0xce;}_0xb324ba[_0x1878('0x1c')](_0xf80c60);return _0xb324ba['set'](_0x1878('0x22'),_0x1642b3+'-'+_0x2b8492+'/'+_0x430e64)[_0x1878('0x1d')](_0x562902);}return null;};}function patchUpdates(_0x1fae20){return function(_0x387f5){try{jsonpatch[_0x1878('0x23')](_0x387f5,_0x1fae20,!![]);}catch(_0x4dc6f1){return BPromise[_0x1878('0x24')](_0x4dc6f1);}return _0x387f5['save']();};}function saveUpdates(_0x1c2b5d,_0x45e2b6){return function(_0x2bc65b){if(_0x2bc65b){return _0x2bc65b[_0x1878('0x25')](_0x1c2b5d)[_0x1878('0x26')](function(_0x524e68){return _0x524e68;});}return null;};}function removeEntity(_0x461905,_0x10ce95){return function(_0x215e59){if(_0x215e59){return _0x215e59[_0x1878('0x27')]()[_0x1878('0x26')](function(){_0x461905[_0x1878('0x1c')](0xcc)[_0x1878('0x28')]();});}};}function handleEntityNotFound(_0x4e114d,_0x122c65){return function(_0x10ab5c){if(!_0x10ab5c){_0x4e114d[_0x1878('0x1b')](0x194);}return _0x10ab5c;};}function handleError(_0xb191d0,_0x46f5b7){_0x46f5b7=_0x46f5b7||0x1f4;return function(_0x57580b){logger[_0x1878('0x29')](_0x57580b[_0x1878('0x2a')]);if(_0x57580b[_0x1878('0x2b')]){delete _0x57580b[_0x1878('0x2b')];}_0xb191d0['status'](_0x46f5b7)[_0x1878('0x2c')](_0x57580b);};}exports[_0x1878('0x2d')]=function(_0x13fb40,_0x31b2ba){var _0x1eda2b={'raw':!![],'where':{'id':_0x13fb40['params']['id']}},_0x45e3db={};_0x45e3db[_0x1878('0x2e')]=_[_0x1878('0x2f')](db['ChatProactiveAction']['rawAttributes']);_0x45e3db[_0x1878('0x30')]=_['keys'](_0x13fb40['query']);_0x45e3db[_0x1878('0x31')]=_[_0x1878('0x32')](_0x45e3db[_0x1878('0x2e')],_0x45e3db['query']);_0x1eda2b[_0x1878('0x33')]=_[_0x1878('0x32')](_0x45e3db[_0x1878('0x2e')],qs[_0x1878('0x34')](_0x13fb40['query'][_0x1878('0x34')]));_0x1eda2b[_0x1878('0x33')]=_0x1eda2b[_0x1878('0x33')]['length']?_0x1eda2b['attributes']:_0x45e3db[_0x1878('0x2e')];if(_0x13fb40['query'][_0x1878('0x35')]){_0x1eda2b[_0x1878('0x36')]=[{'all':!![]}];}_0x1eda2b=_['merge']({},_0x1eda2b,_0x13fb40['options']);return db['ChatProactiveAction'][_0x1878('0x37')](_0x1eda2b)[_0x1878('0x26')](handleEntityNotFound(_0x31b2ba,null))[_0x1878('0x26')](respondWithResult(_0x31b2ba,null))[_0x1878('0x38')](handleError(_0x31b2ba,null));};exports['create']=function(_0xcd00c2,_0x4ca033){return db[_0x1878('0x39')][_0x1878('0x3a')](_0xcd00c2['body'],{})[_0x1878('0x26')](respondWithResult(_0x4ca033,0xc9))[_0x1878('0x38')](handleError(_0x4ca033,null));};exports['update']=function(_0xd589dc,_0x4086ea){if(_0xd589dc['body']['id']){delete _0xd589dc[_0x1878('0x3b')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0xd589dc[_0x1878('0x3c')]['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x4086ea,null))['then'](saveUpdates(_0xd589dc[_0x1878('0x3b')],null))[_0x1878('0x26')](respondWithResult(_0x4086ea,null))[_0x1878('0x38')](handleError(_0x4086ea,null));};exports[_0x1878('0x27')]=function(_0x5cbdfe,_0x41e778){return db[_0x1878('0x39')][_0x1878('0x37')]({'where':{'id':_0x5cbdfe['params']['id']}})['then'](handleEntityNotFound(_0x41e778,null))[_0x1878('0x26')](removeEntity(_0x41e778,null))[_0x1878('0x38')](handleError(_0x41e778,null));}; \ No newline at end of file +var _0x9865=['merge','options','ChatProactiveAction','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','name','send','params','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include'];(function(_0x1d9f83,_0x564382){var _0x4274d7=function(_0x44da9e){while(--_0x44da9e){_0x1d9f83['push'](_0x1d9f83['shift']());}};_0x4274d7(++_0x564382);}(_0x9865,0x1ba));var _0x5986=function(_0x2199fd,_0x30c86f){_0x2199fd=_0x2199fd-0x0;var _0x4b3afd=_0x9865[_0x2199fd];return _0x4b3afd;};'use strict';var emlformat=require(_0x5986('0x0'));var rimraf=require(_0x5986('0x1'));var zipdir=require(_0x5986('0x2'));var jsonpatch=require(_0x5986('0x3'));var rp=require(_0x5986('0x4'));var moment=require(_0x5986('0x5'));var BPromise=require(_0x5986('0x6'));var Mustache=require(_0x5986('0x7'));var util=require(_0x5986('0x8'));var path=require(_0x5986('0x9'));var sox=require('sox');var csv=require(_0x5986('0xa'));var ejs=require(_0x5986('0xb'));var fs=require('fs');var fs_extra=require(_0x5986('0xc'));var _=require(_0x5986('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5986('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5986('0xa'));var querystring=require(_0x5986('0xf'));var Papa=require(_0x5986('0x10'));var Redis=require(_0x5986('0x11'));var authService=require(_0x5986('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5986('0x13'));var hardwareService=require(_0x5986('0x14'));var logger=require(_0x5986('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5986('0x16'));var licenseUtil=require(_0x5986('0x17'));var db=require(_0x5986('0x18'))['db'];function respondWithStatusCode(_0x196bc9,_0x3337db){_0x3337db=_0x3337db||0xcc;return function(_0x52daf9){if(_0x52daf9){return _0x196bc9['sendStatus'](_0x3337db);}return _0x196bc9[_0x5986('0x19')](_0x3337db)['end']();};}function respondWithResult(_0x381fb2,_0x2e5091){_0x2e5091=_0x2e5091||0xc8;return function(_0x19356e){if(_0x19356e){return _0x381fb2[_0x5986('0x19')](_0x2e5091)[_0x5986('0x1a')](_0x19356e);}};}function respondWithFilteredResult(_0x4f7fe1,_0x5e134e){return function(_0x2b6cc5){if(_0x2b6cc5){var _0x498ecb=typeof _0x5e134e[_0x5986('0x1b')]===_0x5986('0x1c')&&typeof _0x5e134e[_0x5986('0x1d')]===_0x5986('0x1c');var _0x22b69f=_0x2b6cc5[_0x5986('0x1e')];var _0x89245c=_0x498ecb?0x0:_0x5e134e[_0x5986('0x1b')];var _0x3c2a39=_0x498ecb?_0x2b6cc5[_0x5986('0x1e')]:_0x5e134e['offset']+_0x5e134e['limit'];var _0x82f4a3;if(_0x3c2a39>=_0x22b69f){_0x3c2a39=_0x22b69f;_0x82f4a3=0xc8;}else{_0x82f4a3=0xce;}_0x4f7fe1[_0x5986('0x19')](_0x82f4a3);return _0x4f7fe1['set'](_0x5986('0x1f'),_0x89245c+'-'+_0x3c2a39+'/'+_0x22b69f)[_0x5986('0x1a')](_0x2b6cc5);}return null;};}function patchUpdates(_0x40446c){return function(_0x4420ae){try{jsonpatch[_0x5986('0x20')](_0x4420ae,_0x40446c,!![]);}catch(_0x1ae6e1){return BPromise[_0x5986('0x21')](_0x1ae6e1);}return _0x4420ae[_0x5986('0x22')]();};}function saveUpdates(_0x3b47c4,_0x2d4f25){return function(_0x29143f){if(_0x29143f){return _0x29143f['update'](_0x3b47c4)[_0x5986('0x23')](function(_0x587848){return _0x587848;});}return null;};}function removeEntity(_0x34b4ec,_0x5cd42a){return function(_0x52d853){if(_0x52d853){return _0x52d853[_0x5986('0x24')]()['then'](function(){_0x34b4ec[_0x5986('0x19')](0xcc)[_0x5986('0x25')]();});}};}function handleEntityNotFound(_0x52864a,_0x1b0510){return function(_0x3b705d){if(!_0x3b705d){_0x52864a[_0x5986('0x26')](0x194);}return _0x3b705d;};}function handleError(_0x273f27,_0x909589){_0x909589=_0x909589||0x1f4;return function(_0x3f9234){logger[_0x5986('0x27')](_0x3f9234['stack']);if(_0x3f9234[_0x5986('0x28')]){delete _0x3f9234[_0x5986('0x28')];}_0x273f27[_0x5986('0x19')](_0x909589)[_0x5986('0x29')](_0x3f9234);};}exports['show']=function(_0x1b9b20,_0x5efef3){var _0x4fc0a2={'raw':!![],'where':{'id':_0x1b9b20[_0x5986('0x2a')]['id']}},_0xf5501b={};_0xf5501b['model']=_[_0x5986('0x2b')](db['ChatProactiveAction'][_0x5986('0x2c')]);_0xf5501b['query']=_['keys'](_0x1b9b20[_0x5986('0x2d')]);_0xf5501b[_0x5986('0x2e')]=_['intersection'](_0xf5501b[_0x5986('0x2f')],_0xf5501b[_0x5986('0x2d')]);_0x4fc0a2[_0x5986('0x30')]=_[_0x5986('0x31')](_0xf5501b['model'],qs[_0x5986('0x32')](_0x1b9b20['query'][_0x5986('0x32')]));_0x4fc0a2['attributes']=_0x4fc0a2['attributes'][_0x5986('0x33')]?_0x4fc0a2[_0x5986('0x30')]:_0xf5501b[_0x5986('0x2f')];if(_0x1b9b20['query'][_0x5986('0x34')]){_0x4fc0a2[_0x5986('0x35')]=[{'all':!![]}];}_0x4fc0a2=_[_0x5986('0x36')]({},_0x4fc0a2,_0x1b9b20[_0x5986('0x37')]);return db[_0x5986('0x38')]['find'](_0x4fc0a2)[_0x5986('0x23')](handleEntityNotFound(_0x5efef3,null))['then'](respondWithResult(_0x5efef3,null))[_0x5986('0x39')](handleError(_0x5efef3,null));};exports['create']=function(_0x3a063f,_0x329d21){return db['ChatProactiveAction'][_0x5986('0x3a')](_0x3a063f[_0x5986('0x3b')],{})[_0x5986('0x23')](respondWithResult(_0x329d21,0xc9))[_0x5986('0x39')](handleError(_0x329d21,null));};exports[_0x5986('0x3c')]=function(_0x4caa2c,_0x4aec03){if(_0x4caa2c['body']['id']){delete _0x4caa2c[_0x5986('0x3b')]['id'];}return db['ChatProactiveAction'][_0x5986('0x3d')]({'where':{'id':_0x4caa2c[_0x5986('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4aec03,null))[_0x5986('0x23')](saveUpdates(_0x4caa2c['body'],null))['then'](respondWithResult(_0x4aec03,null))[_0x5986('0x39')](handleError(_0x4aec03,null));};exports['destroy']=function(_0xb4714e,_0x4b8e62){return db['ChatProactiveAction'][_0x5986('0x3d')]({'where':{'id':_0xb4714e[_0x5986('0x2a')]['id']}})[_0x5986('0x23')](handleEntityNotFound(_0x4b8e62,null))[_0x5986('0x23')](removeEntity(_0x4b8e62,null))[_0x5986('0x39')](handleError(_0x4b8e62,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 796ca6b..d1b864d 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 _0x45dd=['api','moment','bluebird','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger'];(function(_0x57172c,_0x1df512){var _0x38e8a4=function(_0x1bc9a5){while(--_0x1bc9a5){_0x57172c['push'](_0x57172c['shift']());}};_0x38e8a4(++_0x1df512);}(_0x45dd,0x172));var _0xd45d=function(_0x343d34,_0x2efaa0){_0x343d34=_0x343d34-0x0;var _0x12acc3=_0x45dd[_0x343d34];return _0x12acc3;};'use strict';var _=require(_0xd45d('0x0'));var util=require('util');var logger=require(_0xd45d('0x1'))(_0xd45d('0x2'));var moment=require(_0xd45d('0x3'));var BPromise=require(_0xd45d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd45d('0x5'));var rimraf=require(_0xd45d('0x6'));var config=require('../../config/environment');var attributes=require(_0xd45d('0x7'));module[_0xd45d('0x8')]=function(_0x17fecc,_0x20af6a){return _0x17fecc[_0xd45d('0x9')](_0xd45d('0xa'),attributes,{'tableName':_0xd45d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d97=['bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','../../config/logger','api','moment'];(function(_0x28c89b,_0x2510b3){var _0x176500=function(_0x3dfee2){while(--_0x3dfee2){_0x28c89b['push'](_0x28c89b['shift']());}};_0x176500(++_0x2510b3);}(_0x6d97,0x134));var _0x76d9=function(_0x52a505,_0x5dec98){_0x52a505=_0x52a505-0x0;var _0x1fc95e=_0x6d97[_0x52a505];return _0x1fc95e;};'use strict';var _=require(_0x76d9('0x0'));var util=require('util');var logger=require(_0x76d9('0x1'))(_0x76d9('0x2'));var moment=require(_0x76d9('0x3'));var BPromise=require(_0x76d9('0x4'));var rp=require(_0x76d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76d9('0x6'));var config=require(_0x76d9('0x7'));var attributes=require(_0x76d9('0x8'));module[_0x76d9('0x9')]=function(_0x3b3b9e,_0x150882){return _0x3b3b9e[_0x76d9('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x76d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index a2fab5d..1d3d15d 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 _0xdceb=['client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xdceb,0x160));var _0xbdce=function(_0x34fa5c,_0x44c7a7){_0x34fa5c=_0x34fa5c-0x0;var _0x590357=_0xdceb[_0x34fa5c];return _0x590357;};'use strict';var _=require('lodash');var util=require(_0xbdce('0x0'));var moment=require('moment');var BPromise=require(_0xbdce('0x1'));var rs=require(_0xbdce('0x2'));var fs=require('fs');var Redis=require(_0xbdce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbdce('0x4'));var logger=require(_0xbdce('0x5'))('rpc');var config=require(_0xbdce('0x6'));var jayson=require(_0xbdce('0x7'));var client=jayson[_0xbdce('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x155cc6,_0x311e09,_0x3c7791){return new BPromise(function(_0x2af993,_0x662f1d){return client['request'](_0x155cc6,_0x3c7791)[_0xbdce('0x9')](function(_0x280e9d){logger[_0xbdce('0xa')](_0xbdce('0xb'),_0x311e09,_0xbdce('0xc'));logger[_0xbdce('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x311e09,_0xbdce('0xc'),JSON[_0xbdce('0xe')](_0x280e9d));if(_0x280e9d[_0xbdce('0xf')]){if(_0x280e9d['error'][_0xbdce('0x10')]===0x1f4){logger[_0xbdce('0xf')](_0xbdce('0xb'),_0x311e09,_0x280e9d[_0xbdce('0xf')][_0xbdce('0x11')]);return _0x662f1d(_0x280e9d[_0xbdce('0xf')][_0xbdce('0x11')]);}logger[_0xbdce('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x311e09,_0x280e9d[_0xbdce('0xf')][_0xbdce('0x11')]);return _0x2af993(_0x280e9d[_0xbdce('0xf')][_0xbdce('0x11')]);}else{logger[_0xbdce('0xa')](_0xbdce('0xb'),_0x311e09,_0xbdce('0xc'));_0x2af993(_0x280e9d[_0xbdce('0x12')][_0xbdce('0x11')]);}})[_0xbdce('0x13')](function(_0xa1fbc5){logger[_0xbdce('0xf')](_0xbdce('0xb'),_0x311e09,_0xa1fbc5);_0x662f1d(_0xa1fbc5);});});} \ No newline at end of file +var _0x48c2=['rpc','../../config/environment','jayson/promise','request','then','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x48c2,0x10a));var _0x248c=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x48c2[_0x39e283];return _0x7de89f;};'use strict';var _=require(_0x248c('0x0'));var util=require('util');var moment=require(_0x248c('0x1'));var BPromise=require(_0x248c('0x2'));var rs=require(_0x248c('0x3'));var fs=require('fs');var Redis=require(_0x248c('0x4'));var db=require(_0x248c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x248c('0x6'))(_0x248c('0x7'));var config=require(_0x248c('0x8'));var jayson=require(_0x248c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4952de,_0x559c2a,_0x22ede5){return new BPromise(function(_0x3a4e65,_0x2dadbd){return client[_0x248c('0xa')](_0x4952de,_0x22ede5)[_0x248c('0xb')](function(_0x35f957){logger[_0x248c('0xc')](_0x248c('0xd'),_0x559c2a,'request\x20sent');logger['debug'](_0x248c('0xe'),_0x559c2a,'request\x20sent',JSON[_0x248c('0xf')](_0x35f957));if(_0x35f957[_0x248c('0x10')]){if(_0x35f957['error'][_0x248c('0x11')]===0x1f4){logger[_0x248c('0x10')](_0x248c('0xd'),_0x559c2a,_0x35f957[_0x248c('0x10')][_0x248c('0x12')]);return _0x2dadbd(_0x35f957[_0x248c('0x10')][_0x248c('0x12')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x559c2a,_0x35f957[_0x248c('0x10')][_0x248c('0x12')]);return _0x3a4e65(_0x35f957[_0x248c('0x10')][_0x248c('0x12')]);}else{logger[_0x248c('0xc')](_0x248c('0xd'),_0x559c2a,_0x248c('0x13'));_0x3a4e65(_0x35f957['result'][_0x248c('0x12')]);}})[_0x248c('0x14')](function(_0x23e733){logger[_0x248c('0x10')](_0x248c('0xd'),_0x559c2a,_0x23e733);_0x2dadbd(_0x23e733);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 13b63e8..dc847ab 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 _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','exports'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x2bd8,0x130));var _0x82bd=function(_0x25e703,_0x433147){_0x25e703=_0x25e703-0x0;var _0x534a40=_0x2bd8[_0x25e703];return _0x534a40;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')](_0x82bd('0xa'),auth['isAuthenticated'](),controller[_0x82bd('0xb')]);router[_0x82bd('0xc')]('/',auth[_0x82bd('0xd')](),controller[_0x82bd('0xe')]);router['put'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x82bd('0xf')]=router; \ No newline at end of file +var _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x6a3124,_0x4fc714){_0x6a3124=_0x6a3124-0x0;var _0x2772a1=_0xb4c7[_0x6a3124];return _0x2772a1;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 477b6b2..7a79ff6 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 _0xb7b8=['STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x58fcb4,_0xca5a33){var _0x53bfe1=function(_0x1289e6){while(--_0x1289e6){_0x58fcb4['push'](_0x58fcb4['shift']());}};_0x53bfe1(++_0xca5a33);}(_0xb7b8,0x1d4));var _0x8b7b=function(_0x5d3a2b,_0x2f3586){_0x5d3a2b=_0x5d3a2b-0x0;var _0x226126=_0xb7b8[_0x5d3a2b];return _0x226126;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8b7b('0x0')],'unique':_0x8b7b('0x1'),'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[_0x8b7b('0x2')](_0x8b7b('0x3'),_0x8b7b('0x4'),_0x8b7b('0x5'))}}; \ No newline at end of file +var _0x7fb5=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x22bd53,_0x403703){var _0xe71a22=function(_0xdf7945){while(--_0xdf7945){_0x22bd53['push'](_0x22bd53['shift']());}};_0xe71a22(++_0x403703);}(_0x7fb5,0xcb));var _0x57fb=function(_0x2d568a,_0x4eaf83){_0x2d568a=_0x2d568a-0x0;var _0x2eec04=_0x7fb5[_0x2d568a];return _0x2eec04;};'use strict';var Sequelize=require('sequelize');module[_0x57fb('0x0')]={'name':{'type':Sequelize[_0x57fb('0x1')],'unique':_0x57fb('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x57fb('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x57fb('0x3')](_0x57fb('0x4'),_0x57fb('0x5'),_0x57fb('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index b8c81e9..0170c05 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 _0x2f87=['then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','UserProfileResource','destroy','end','stack','name','send','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','ChatQueue','includeAll','include','params','keys','rawAttributes','find','create','body','get','role','ChatQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','nolimit','pick','ChatQueueId','User','findAndCountAll','UserId','updatedAt','rows','format','SIP','chatPause','createdAt','findOne','getTeams','addTeams','findAll','Agents','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','Team','ids','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','addAgents','omit','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','jayson/promise','client','http','request'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x2f87,0x10c));var _0x72f8=function(_0x49762c,_0x59b975){_0x49762c=_0x49762c-0x0;var _0x2462cb=_0x2f87[_0x49762c];return _0x2462cb;};'use strict';var emlformat=require(_0x72f8('0x0'));var rimraf=require(_0x72f8('0x1'));var zipdir=require(_0x72f8('0x2'));var jsonpatch=require(_0x72f8('0x3'));var rp=require('request-promise');var moment=require(_0x72f8('0x4'));var BPromise=require(_0x72f8('0x5'));var Mustache=require(_0x72f8('0x6'));var util=require(_0x72f8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x72f8('0x8'));var ejs=require(_0x72f8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x72f8('0xa'));var squel=require(_0x72f8('0xb'));var crypto=require(_0x72f8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x72f8('0xd'));var toCsv=require(_0x72f8('0x8'));var querystring=require(_0x72f8('0xe'));var Papa=require(_0x72f8('0xf'));var Redis=require(_0x72f8('0x10'));var authService=require(_0x72f8('0x11'));var qs=require(_0x72f8('0x12'));var as=require(_0x72f8('0x13'));var hardwareService=require(_0x72f8('0x14'));var logger=require(_0x72f8('0x15'))(_0x72f8('0x16'));var utils=require(_0x72f8('0x17'));var config=require(_0x72f8('0x18'));var licenseUtil=require(_0x72f8('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x72f8('0x1a')],{'host':_0x72f8('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72f8('0x1a')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x72f8('0x1c'));var client=jayson[_0x72f8('0x1d')][_0x72f8('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3bdd56,_0xf507e1,_0x409c94,_0x23400f){return new BPromise(function(_0x51d61e,_0x2e5a20){var _0x36ffbd=_0x23400f||client;return _0x36ffbd[_0x72f8('0x1f')](_0x3bdd56,_0x409c94)[_0x72f8('0x20')](function(_0x57a777){logger[_0x72f8('0x21')]('ChatQueue,\x20%s,\x20%s',_0xf507e1,_0x72f8('0x22'));logger['debug'](_0x72f8('0x23'),_0xf507e1,'request\x20sent',JSON[_0x72f8('0x24')](_0x57a777));if(_0x57a777[_0x72f8('0x25')]){if(_0x57a777[_0x72f8('0x25')][_0x72f8('0x26')]===0x1f4){logger[_0x72f8('0x25')]('ChatQueue,\x20%s,\x20%s',_0xf507e1,_0x57a777['error'][_0x72f8('0x27')]);return _0x2e5a20(_0x57a777[_0x72f8('0x25')][_0x72f8('0x27')]);}logger[_0x72f8('0x25')](_0x72f8('0x28'),_0xf507e1,_0x57a777[_0x72f8('0x25')][_0x72f8('0x27')]);return _0x51d61e(_0x57a777[_0x72f8('0x25')]['message']);}else{logger[_0x72f8('0x21')](_0x72f8('0x28'),_0xf507e1,'request\x20sent');_0x51d61e(_0x57a777[_0x72f8('0x29')][_0x72f8('0x27')]);}})[_0x72f8('0x2a')](function(_0x473253){logger[_0x72f8('0x25')]('ChatQueue,\x20%s,\x20%s',_0xf507e1,_0x473253);_0x2e5a20(_0x473253);});});}function respondWithStatusCode(_0x2c7509,_0x5712a3){_0x5712a3=_0x5712a3||0xcc;return function(_0x530a08){if(_0x530a08){return _0x2c7509[_0x72f8('0x2b')](_0x5712a3);}return _0x2c7509[_0x72f8('0x2c')](_0x5712a3)['end']();};}function respondWithResult(_0x185847,_0x303662){_0x303662=_0x303662||0xc8;return function(_0x2b12f2){if(_0x2b12f2){return _0x185847[_0x72f8('0x2c')](_0x303662)['json'](_0x2b12f2);}};}function respondWithFilteredResult(_0x2633e6,_0x323795){return function(_0x210628){if(_0x210628){var _0x384b0a=typeof _0x323795[_0x72f8('0x2d')]===_0x72f8('0x2e')&&typeof _0x323795[_0x72f8('0x2f')]==='undefined';var _0x419be6=_0x210628['count'];var _0x33f3b8=_0x384b0a?0x0:_0x323795[_0x72f8('0x2d')];var _0xf06103=_0x384b0a?_0x210628[_0x72f8('0x30')]:_0x323795[_0x72f8('0x2d')]+_0x323795[_0x72f8('0x2f')];var _0x1ab95e;if(_0xf06103>=_0x419be6){_0xf06103=_0x419be6;_0x1ab95e=0xc8;}else{_0x1ab95e=0xce;}_0x2633e6[_0x72f8('0x2c')](_0x1ab95e);return _0x2633e6[_0x72f8('0x31')]('Content-Range',_0x33f3b8+'-'+_0xf06103+'/'+_0x419be6)[_0x72f8('0x32')](_0x210628);}return null;};}function patchUpdates(_0x25720f){return function(_0x14798a){try{jsonpatch[_0x72f8('0x33')](_0x14798a,_0x25720f,!![]);}catch(_0xa02fce){return BPromise[_0x72f8('0x34')](_0xa02fce);}return _0x14798a['save']();};}function saveUpdates(_0x2f29fe,_0x29082b){return function(_0x22e3d2){if(_0x22e3d2){return _0x22e3d2[_0x72f8('0x35')](_0x2f29fe)[_0x72f8('0x20')](function(_0x4e6a52){return _0x4e6a52;});}return null;};}function removeEntity(_0x1b41e7,_0x122017){return function(_0x2f9cc2){if(_0x2f9cc2){return _0x2f9cc2['destroy']()[_0x72f8('0x20')](function(){var _0x59e5ee=_0x2f9cc2['get']({'plain':!![]});var _0x1b7653='ChatQueues';return db[_0x72f8('0x36')][_0x72f8('0x37')]({'where':{'type':_0x1b7653,'resourceId':_0x59e5ee['id']}})[_0x72f8('0x20')](function(){return _0x2f9cc2;});})[_0x72f8('0x20')](function(){_0x1b41e7[_0x72f8('0x2c')](0xcc)[_0x72f8('0x38')]();});}};}function handleEntityNotFound(_0x527af4,_0x5ca29a){return function(_0x183ac4){if(!_0x183ac4){_0x527af4[_0x72f8('0x2b')](0x194);}return _0x183ac4;};}function handleError(_0x2a37a9,_0x2d606b){_0x2d606b=_0x2d606b||0x1f4;return function(_0x680cc5){logger[_0x72f8('0x25')](_0x680cc5[_0x72f8('0x39')]);if(_0x680cc5[_0x72f8('0x3a')]){delete _0x680cc5[_0x72f8('0x3a')];}_0x2a37a9[_0x72f8('0x2c')](_0x2d606b)[_0x72f8('0x3b')](_0x680cc5);};}exports['index']=function(_0x7a1dc8,_0x22aa94){var _0x70efc7={},_0x4d5a69={},_0x3a2c8b={'count':0x0,'rows':[]};var _0x144c1f=_['map'](db['ChatQueue']['rawAttributes'],function(_0x39550f){return{'name':_0x39550f[_0x72f8('0x3c')],'type':_0x39550f[_0x72f8('0x3d')][_0x72f8('0x3e')]};});_0x4d5a69[_0x72f8('0x3f')]=_[_0x72f8('0x40')](_0x144c1f,_0x72f8('0x3a'));_0x4d5a69[_0x72f8('0x41')]=_['keys'](_0x7a1dc8[_0x72f8('0x41')]);_0x4d5a69[_0x72f8('0x42')]=_[_0x72f8('0x43')](_0x4d5a69['model'],_0x4d5a69[_0x72f8('0x41')]);_0x70efc7['attributes']=_[_0x72f8('0x43')](_0x4d5a69[_0x72f8('0x3f')],qs[_0x72f8('0x44')](_0x7a1dc8['query'][_0x72f8('0x44')]));_0x70efc7['attributes']=_0x70efc7[_0x72f8('0x45')][_0x72f8('0x46')]?_0x70efc7[_0x72f8('0x45')]:_0x4d5a69[_0x72f8('0x3f')];if(!_0x7a1dc8['query'][_0x72f8('0x47')]('nolimit')){_0x70efc7[_0x72f8('0x2f')]=qs[_0x72f8('0x2f')](_0x7a1dc8[_0x72f8('0x41')]['limit']);_0x70efc7['offset']=qs[_0x72f8('0x2d')](_0x7a1dc8['query'][_0x72f8('0x2d')]);}_0x70efc7[_0x72f8('0x48')]=qs[_0x72f8('0x49')](_0x7a1dc8['query']['sort']);_0x70efc7['where']=qs['filters'](_['pick'](_0x7a1dc8[_0x72f8('0x41')],_0x4d5a69[_0x72f8('0x42')]),_0x144c1f);if(_0x7a1dc8['query'][_0x72f8('0x4a')]){_0x70efc7['where']=_[_0x72f8('0x4b')](_0x70efc7[_0x72f8('0x4c')],{'$or':_[_0x72f8('0x40')](_0x144c1f,function(_0x407aa7){if(_0x407aa7[_0x72f8('0x3d')]!==_0x72f8('0x4d')){var _0x122a95={};_0x122a95[_0x407aa7[_0x72f8('0x3a')]]={'$like':'%'+_0x7a1dc8['query'][_0x72f8('0x4a')]+'%'};return _0x122a95;}})});}_0x70efc7=_[_0x72f8('0x4b')]({},_0x70efc7,_0x7a1dc8[_0x72f8('0x4e')]);var _0x39a85f={'where':_0x70efc7[_0x72f8('0x4c')]};return db[_0x72f8('0x4f')][_0x72f8('0x30')](_0x39a85f)[_0x72f8('0x20')](function(_0x5c2539){_0x3a2c8b['count']=_0x5c2539;if(_0x7a1dc8['query'][_0x72f8('0x50')]){_0x70efc7[_0x72f8('0x51')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x70efc7);})[_0x72f8('0x20')](function(_0x2a98df){_0x3a2c8b['rows']=_0x2a98df;return _0x3a2c8b;})[_0x72f8('0x20')](respondWithFilteredResult(_0x22aa94,_0x70efc7))['catch'](handleError(_0x22aa94,null));};exports['show']=function(_0x434e33,_0xa2f10){var _0x1ab20b={'raw':!![],'where':{'id':_0x434e33[_0x72f8('0x52')]['id']}},_0x1e1d7d={};_0x1e1d7d[_0x72f8('0x3f')]=_[_0x72f8('0x53')](db[_0x72f8('0x4f')][_0x72f8('0x54')]);_0x1e1d7d[_0x72f8('0x41')]=_[_0x72f8('0x53')](_0x434e33[_0x72f8('0x41')]);_0x1e1d7d[_0x72f8('0x42')]=_[_0x72f8('0x43')](_0x1e1d7d[_0x72f8('0x3f')],_0x1e1d7d[_0x72f8('0x41')]);_0x1ab20b[_0x72f8('0x45')]=_[_0x72f8('0x43')](_0x1e1d7d[_0x72f8('0x3f')],qs[_0x72f8('0x44')](_0x434e33[_0x72f8('0x41')]['fields']));_0x1ab20b[_0x72f8('0x45')]=_0x1ab20b[_0x72f8('0x45')][_0x72f8('0x46')]?_0x1ab20b['attributes']:_0x1e1d7d['model'];if(_0x434e33[_0x72f8('0x41')]['includeAll']){_0x1ab20b[_0x72f8('0x51')]=[{'all':!![]}];}_0x1ab20b=_[_0x72f8('0x4b')]({},_0x1ab20b,_0x434e33['options']);return db[_0x72f8('0x4f')][_0x72f8('0x55')](_0x1ab20b)[_0x72f8('0x20')](handleEntityNotFound(_0xa2f10,null))[_0x72f8('0x20')](respondWithResult(_0xa2f10,null))['catch'](handleError(_0xa2f10,null));};exports[_0x72f8('0x56')]=function(_0x15a80a,_0x3b0859){return db['ChatQueue']['create'](_0x15a80a[_0x72f8('0x57')],{})[_0x72f8('0x20')](function(_0x19de47){var _0x262760=_0x15a80a['user'][_0x72f8('0x58')]({'plain':!![]});if(!_0x262760)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x262760[_0x72f8('0x59')]==='user'){var _0x4761c1=_0x19de47['get']({'plain':!![]});var _0x3fd6ee=_0x72f8('0x5a');return db['UserProfileSection'][_0x72f8('0x55')]({'where':{'name':_0x3fd6ee,'userProfileId':_0x262760[_0x72f8('0x5b')]},'raw':!![]})[_0x72f8('0x20')](function(_0x20836e){if(_0x20836e&&_0x20836e[_0x72f8('0x5c')]===0x0){return db[_0x72f8('0x36')][_0x72f8('0x56')]({'name':_0x4761c1[_0x72f8('0x3a')],'resourceId':_0x4761c1['id'],'type':_0x20836e[_0x72f8('0x3a')],'sectionId':_0x20836e['id']},{})[_0x72f8('0x20')](function(){return _0x19de47;});}else{return _0x19de47;}})[_0x72f8('0x2a')](function(_0x21590b){logger[_0x72f8('0x25')](_0x72f8('0x5d'),_0x21590b);throw _0x21590b;});}return _0x19de47;})['then'](respondWithResult(_0x3b0859,0xc9))[_0x72f8('0x2a')](handleError(_0x3b0859,null));};exports[_0x72f8('0x35')]=function(_0x10f26f,_0x1df9a8){if(_0x10f26f[_0x72f8('0x57')]['id']){delete _0x10f26f[_0x72f8('0x57')]['id'];}return db[_0x72f8('0x4f')]['find']({'where':{'id':_0x10f26f[_0x72f8('0x52')]['id']}})[_0x72f8('0x20')](handleEntityNotFound(_0x1df9a8,null))['then'](saveUpdates(_0x10f26f[_0x72f8('0x57')],null))[_0x72f8('0x20')](respondWithResult(_0x1df9a8,null))[_0x72f8('0x2a')](handleError(_0x1df9a8,null));};exports['destroy']=function(_0x3ba9b0,_0x3f1f53){return db['ChatQueue'][_0x72f8('0x55')]({'where':{'id':_0x3ba9b0[_0x72f8('0x52')]['id']}})[_0x72f8('0x20')](handleEntityNotFound(_0x3f1f53,null))[_0x72f8('0x20')](removeEntity(_0x3f1f53,null))['catch'](handleError(_0x3f1f53,null));};exports[_0x72f8('0x5e')]=function(_0x469a5d,_0x2bcae4){return db[_0x72f8('0x4f')][_0x72f8('0x5e')]()['then'](respondWithResult(_0x2bcae4,null))[_0x72f8('0x2a')](handleError(_0x2bcae4,null));};exports[_0x72f8('0x5f')]=function(_0x585adc,_0x38f5a7,_0xb8a604){var _0x15abff={'raw':!![],'where':{}},_0x1c2464={},_0x9be2fa;return db[_0x72f8('0x4f')]['findOne']({'where':{'id':_0x585adc[_0x72f8('0x52')]['id']}})[_0x72f8('0x20')](handleEntityNotFound(_0x38f5a7,null))[_0x72f8('0x20')](function(_0x1267ea){if(_0x1267ea){_0x9be2fa=_0x1267ea['get']({'plain':!![]});_0x1c2464[_0x72f8('0x3f')]=_['keys'](db[_0x72f8('0x60')][_0x72f8('0x54')]);_0x1c2464[_0x72f8('0x41')]=_[_0x72f8('0x53')](_0x585adc[_0x72f8('0x41')]);_0x1c2464[_0x72f8('0x42')]=_[_0x72f8('0x43')](_0x1c2464['model'],_0x1c2464[_0x72f8('0x41')]);_0x15abff['attributes']=_[_0x72f8('0x43')](_0x1c2464[_0x72f8('0x3f')],qs['fields'](_0x585adc[_0x72f8('0x41')][_0x72f8('0x44')]));_0x15abff[_0x72f8('0x45')]=_0x15abff[_0x72f8('0x45')][_0x72f8('0x46')]?_0x15abff[_0x72f8('0x45')]:_0x1c2464[_0x72f8('0x3f')];if(!_0x585adc['query'][_0x72f8('0x47')](_0x72f8('0x61'))){_0x15abff[_0x72f8('0x2f')]=qs['limit'](_0x585adc[_0x72f8('0x41')]['limit']);_0x15abff[_0x72f8('0x2d')]=qs[_0x72f8('0x2d')](_0x585adc[_0x72f8('0x41')][_0x72f8('0x2d')]);}_0x15abff[_0x72f8('0x48')]=qs['sort'](_0x585adc[_0x72f8('0x41')][_0x72f8('0x49')]);_0x15abff[_0x72f8('0x4c')]=qs['filters'](_[_0x72f8('0x62')](_0x585adc[_0x72f8('0x41')],_0x1c2464[_0x72f8('0x42')]));_0x15abff['where'][_0x72f8('0x63')]=_0x1267ea['id'];if(_0x585adc[_0x72f8('0x41')]['filter']){_0x15abff['where']=_[_0x72f8('0x4b')](_0x15abff[_0x72f8('0x4c')],{'$or':_['map'](_0x15abff[_0x72f8('0x45')],function(_0x4c4bd1){var _0x5e2c06={};_0x5e2c06[_0x4c4bd1]={'$like':'%'+_0x585adc[_0x72f8('0x41')][_0x72f8('0x4a')]+'%'};return _0x5e2c06;})});}_0x15abff=_[_0x72f8('0x4b')]({},_0x15abff,_0x585adc[_0x72f8('0x4e')]);return db['UserChatQueue']['findAll'](_0x15abff);}})[_0x72f8('0x20')](function(_0x397f59){if(_0x397f59){return db[_0x72f8('0x64')][_0x72f8('0x65')]({'where':{'id':_[_0x72f8('0x40')](_0x397f59,_0x72f8('0x66')),'role':'agent'},'attributes':['id','name','chatPause',_0x72f8('0x67'),'createdAt']});}})['then'](function(_0x2ea4b0){if(_0x2ea4b0){return{'count':_0x2ea4b0[_0x72f8('0x30')],'rows':_['map'](_0x2ea4b0[_0x72f8('0x68')],function(_0x3a2436){return{'membername':_0x3a2436[_0x72f8('0x3a')],'UserId':_0x3a2436['id'],'queue_name':_0x9be2fa['name'],'ChatQueueId':_0x9be2fa['id'],'interface':util[_0x72f8('0x69')]('%s/%s',_0x72f8('0x6a'),_0x3a2436[_0x72f8('0x3a')]),'penalty':0x0,'paused':_0x3a2436[_0x72f8('0x6b')],'createdAt':_0x3a2436[_0x72f8('0x6c')],'updatedAt':_0x3a2436[_0x72f8('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x72f8('0x20')](respondWithFilteredResult(_0x38f5a7,_0x15abff))[_0x72f8('0x2a')](handleError(_0x38f5a7,null));};exports['getTeams']=function(_0x64c593,_0x221660,_0x3afb2c){var _0xb6812e={};var _0x12faef={};var _0x52993f;var _0x4f9d15;return db[_0x72f8('0x4f')][_0x72f8('0x6d')]({'where':{'id':_0x64c593[_0x72f8('0x52')]['id']}})[_0x72f8('0x20')](handleEntityNotFound(_0x221660,null))[_0x72f8('0x20')](function(_0x378e5b){if(_0x378e5b){_0x52993f=_0x378e5b;_0x12faef['model']=_[_0x72f8('0x53')](db['Team'][_0x72f8('0x54')]);_0x12faef[_0x72f8('0x41')]=_[_0x72f8('0x53')](_0x64c593[_0x72f8('0x41')]);_0x12faef[_0x72f8('0x42')]=_[_0x72f8('0x43')](_0x12faef[_0x72f8('0x3f')],_0x12faef[_0x72f8('0x41')]);_0xb6812e[_0x72f8('0x45')]=_[_0x72f8('0x43')](_0x12faef['model'],qs[_0x72f8('0x44')](_0x64c593[_0x72f8('0x41')][_0x72f8('0x44')]));_0xb6812e['attributes']=_0xb6812e['attributes'][_0x72f8('0x46')]?_0xb6812e[_0x72f8('0x45')]:_0x12faef[_0x72f8('0x3f')];_0xb6812e[_0x72f8('0x48')]=qs['sort'](_0x64c593[_0x72f8('0x41')]['sort']);_0xb6812e[_0x72f8('0x4c')]=qs[_0x72f8('0x42')](_[_0x72f8('0x62')](_0x64c593[_0x72f8('0x41')],_0x12faef[_0x72f8('0x42')]));if(_0x64c593['query'][_0x72f8('0x4a')]){_0xb6812e[_0x72f8('0x4c')]=_[_0x72f8('0x4b')](_0xb6812e[_0x72f8('0x4c')],{'$or':_['map'](_0xb6812e[_0x72f8('0x45')],function(_0x7862f9){var _0x1b6cd6={};_0x1b6cd6[_0x7862f9]={'$like':'%'+_0x64c593[_0x72f8('0x41')]['filter']+'%'};return _0x1b6cd6;})});}_0xb6812e=_[_0x72f8('0x4b')]({},_0xb6812e,_0x64c593[_0x72f8('0x4e')]);return _0x52993f[_0x72f8('0x6e')](_0xb6812e);}})['then'](function(_0x565c57){if(_0x565c57){_0x4f9d15=_0x565c57[_0x72f8('0x46')];if(!_0x64c593[_0x72f8('0x41')]['hasOwnProperty'](_0x72f8('0x61'))){_0xb6812e['limit']=qs[_0x72f8('0x2f')](_0x64c593[_0x72f8('0x41')][_0x72f8('0x2f')]);_0xb6812e['offset']=qs[_0x72f8('0x2d')](_0x64c593[_0x72f8('0x41')][_0x72f8('0x2d')]);}return _0x52993f[_0x72f8('0x6e')](_0xb6812e);}})[_0x72f8('0x20')](function(_0x3198b1){if(_0x3198b1){return _0x3198b1?{'count':_0x4f9d15,'rows':_0x3198b1}:null;}})['then'](respondWithResult(_0x221660,null))[_0x72f8('0x2a')](handleError(_0x221660,null));};exports[_0x72f8('0x6f')]=function(_0x2d6129,_0x3b601c,_0x225d24){var _0x266f18=_0x2d6129['body']['ids'];return db['Team'][_0x72f8('0x70')]({'where':{'id':_0x266f18},'attributes':['id'],'include':[{'model':db[_0x72f8('0x64')],'as':_0x72f8('0x71'),'attributes':['id','name','online',_0x72f8('0x72'),_0x72f8('0x73')],'raw':!![]}]})['then'](function(_0x357de4){if(_0x357de4){var _0x38c107=_['flatMap'](_0x357de4,function(_0xddfe40){var _0x4f1717=_0xddfe40[_0x72f8('0x58')]({'plain':!![]});return _0x4f1717[_0x72f8('0x71')];});return db[_0x72f8('0x4f')]['find']({'where':{'id':_0x2d6129[_0x72f8('0x52')]['id']}})[_0x72f8('0x20')](function(_0x44bc17){return db['sequelize'][_0x72f8('0x74')](function(_0x4c384a){return _0x44bc17[_0x72f8('0x6f')](_0x266f18,{'transaction':_0x4c384a})[_0x72f8('0x20')](function(){return BPromise[_0x72f8('0x75')](_0x38c107,function(_0x13e161){return db['UserChatQueue'][_0x72f8('0x76')]({'where':{'UserId':_0x13e161['id'],'ChatQueueId':_0x2d6129[_0x72f8('0x52')]['id']},'transaction':_0x4c384a});});})[_0x72f8('0x20')](function(){_0x38c107[_0x72f8('0x77')](function(_0x3ed5ce){socket[_0x72f8('0x78')](_0x72f8('0x79'),{'UserId':_0x3ed5ce['id'],'ChatQueueId':_0x44bc17['id']});});});});});}})[_0x72f8('0x20')](respondWithStatusCode(_0x3b601c,null))['catch'](handleError(_0x3b601c,null));};exports['removeTeams']=function(_0x47da86,_0x32ceb5,_0x34e9a5){return db[_0x72f8('0x7a')][_0x72f8('0x70')]({'where':{'id':_0x47da86[_0x72f8('0x41')][_0x72f8('0x7b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x32ceb5,null))[_0x72f8('0x20')](function(_0x3c07ba){var _0x442a82=_['map'](_0x3c07ba,'id');var _0x1ce612=[];var _0x1ee3c2=[];var _0x146180=squel[_0x72f8('0x7c')]();_0x146180['field'](_0x72f8('0x7d'))[_0x72f8('0x7e')](_0x72f8('0x7f'),'tq')[_0x72f8('0x80')](_0x72f8('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x72f8('0x82'),_0x47da86[_0x72f8('0x52')]['id']);for(var _0x4a302b=0x0;_0x4a302b<_0x3c07ba[_0x72f8('0x46')];_0x4a302b+=0x1){let _0x4896eb=_0x3c07ba[_0x4a302b];for(var _0x47aedb=0x0;_0x47aedb<_0x4896eb[_0x72f8('0x71')]['length'];_0x47aedb+=0x1){let _0x14a0c3=_0x4896eb[_0x72f8('0x71')][_0x47aedb];var _0x25bbc8=_0x146180[_0x72f8('0x83')]();_0x25bbc8[_0x72f8('0x4c')](_0x72f8('0x84'),_0x14a0c3['id']);_0x1ee3c2[_0x72f8('0x85')](db[_0x72f8('0x86')][_0x72f8('0x41')](_0x25bbc8[_0x72f8('0x87')](),{'type':db[_0x72f8('0x86')][_0x72f8('0x88')][_0x72f8('0x89')]})[_0x72f8('0x20')](function(_0x1f80ff){if(_0x1f80ff[_0x72f8('0x46')]===0x1){return _0x14a0c3['id'];}else{var _0x2ba3fd=_['every'](_[_0x72f8('0x40')](_0x1f80ff,_0x72f8('0x8a')),function(_0x290388){return _[_0x72f8('0x8b')](_0x442a82,_0x290388);});if(_0x2ba3fd){return _0x14a0c3['id'];}}}));}}return BPromise[_0x72f8('0x8c')](_0x1ee3c2)['then'](function(_0x48a9c5){_0x1ce612=_(_0x1ce612)[_0x72f8('0x8d')](_0x48a9c5)['compact']()[_0x72f8('0x8e')]();return db[_0x72f8('0x4f')][_0x72f8('0x55')]({'where':{'id':_0x47da86['params']['id']}})[_0x72f8('0x20')](function(_0x2c7107){return db['sequelize'][_0x72f8('0x74')](function(_0x1274d8){return _0x2c7107[_0x72f8('0x8f')](_0x47da86['query']['ids'],{'transaction':_0x1274d8})['then'](function(){if(!_[_0x72f8('0x90')](_0x1ce612)){return _0x2c7107[_0x72f8('0x91')](_0x1ce612,{'transaction':_0x1274d8});}})['then'](function(){_0x1ce612[_0x72f8('0x77')](function(_0x575d05){socket[_0x72f8('0x78')]('userChatQueue:remove',{'UserId':_0x575d05,'ChatQueueId':_0x2c7107['id']});});});});});});})[_0x72f8('0x20')](respondWithStatusCode(_0x32ceb5,null))[_0x72f8('0x2a')](handleError(_0x32ceb5,null));};exports[_0x72f8('0x92')]=function(_0x3b0abb,_0x59dc87,_0x271472){return db[_0x72f8('0x4f')]['find']({'where':{'id':_0x3b0abb['params']['id']}})[_0x72f8('0x20')](handleEntityNotFound(_0x59dc87,null))[_0x72f8('0x20')](function(_0x1e5707){if(_0x1e5707){return _0x1e5707[_0x72f8('0x92')](_0x3b0abb['body'][_0x72f8('0x7b')],_[_0x72f8('0x93')](_0x3b0abb['body'],[_0x72f8('0x7b'),'id'])||{})['spread'](function(_0x4f2746){for(var _0x236464=0x0;_0x236464<_0x3b0abb['body'][_0x72f8('0x7b')][_0x72f8('0x46')];_0x236464+=0x1){socket[_0x72f8('0x78')]('userChatQueue:save',{'UserId':Number(_0x3b0abb['body']['ids'][_0x236464]),'ChatQueueId':Number(_0x3b0abb[_0x72f8('0x52')]['id'])});}return _0x4f2746;});}})[_0x72f8('0x20')](respondWithResult(_0x59dc87,null))['catch'](handleError(_0x59dc87,null));};exports[_0x72f8('0x91')]=function(_0x21366a,_0x403fd9,_0x1ef836){return db[_0x72f8('0x4f')]['find']({'where':{'id':_0x21366a[_0x72f8('0x52')]['id']}})[_0x72f8('0x20')](handleEntityNotFound(_0x403fd9,null))[_0x72f8('0x20')](function(_0x24eb2d){if(_0x24eb2d){return _0x24eb2d['removeAgents'](_0x21366a[_0x72f8('0x41')][_0x72f8('0x7b')])['then'](function(){if(_['isArray'](_0x21366a['query'][_0x72f8('0x7b')])){for(var _0x31ea8e=0x0;_0x31ea8e<_0x21366a[_0x72f8('0x41')][_0x72f8('0x7b')][_0x72f8('0x46')];_0x31ea8e+=0x1){socket['emit'](_0x72f8('0x94'),{'UserId':Number(_0x21366a[_0x72f8('0x41')]['ids'][_0x31ea8e]),'ChatQueueId':Number(_0x21366a[_0x72f8('0x52')]['id'])});}}else{socket['emit'](_0x72f8('0x94'),{'UserId':Number(_0x21366a['query'][_0x72f8('0x7b')]),'ChatQueueId':Number(_0x21366a['params']['id'])});}});}})[_0x72f8('0x20')](respondWithStatusCode(_0x403fd9,null))[_0x72f8('0x2a')](handleError(_0x403fd9,null));};exports['getAgents']=function(_0x2ceb9b,_0xdca97b,_0x5ca41c){var _0x4b8c05={};var _0x2109dd={};var _0x239eba;var _0x3e84c6;return db[_0x72f8('0x4f')][_0x72f8('0x6d')]({'where':{'id':_0x2ceb9b[_0x72f8('0x52')]['id']}})[_0x72f8('0x20')](handleEntityNotFound(_0xdca97b,null))[_0x72f8('0x20')](function(_0x4fc861){if(_0x4fc861){_0x239eba=_0x4fc861;_0x2109dd['model']=_[_0x72f8('0x53')](db[_0x72f8('0x64')][_0x72f8('0x54')]);_0x2109dd['query']=_[_0x72f8('0x53')](_0x2ceb9b[_0x72f8('0x41')]);_0x2109dd[_0x72f8('0x42')]=_[_0x72f8('0x43')](_0x2109dd[_0x72f8('0x3f')],_0x2109dd[_0x72f8('0x41')]);_0x4b8c05['attributes']=_[_0x72f8('0x43')](_0x2109dd[_0x72f8('0x3f')],qs[_0x72f8('0x44')](_0x2ceb9b['query'][_0x72f8('0x44')]));_0x4b8c05[_0x72f8('0x45')]=_0x4b8c05['attributes']['length']?_0x4b8c05[_0x72f8('0x45')]:_0x2109dd[_0x72f8('0x3f')];_0x4b8c05[_0x72f8('0x48')]=qs['sort'](_0x2ceb9b['query'][_0x72f8('0x49')]);_0x4b8c05[_0x72f8('0x4c')]=qs[_0x72f8('0x42')](_[_0x72f8('0x62')](_0x2ceb9b['query'],_0x2109dd[_0x72f8('0x42')]));if(_0x2ceb9b[_0x72f8('0x41')][_0x72f8('0x4a')]){_0x4b8c05[_0x72f8('0x4c')]=_['merge'](_0x4b8c05[_0x72f8('0x4c')],{'$or':_[_0x72f8('0x40')](_0x4b8c05[_0x72f8('0x45')],function(_0xed0ccc){var _0x2e8921={};_0x2e8921[_0xed0ccc]={'$like':'%'+_0x2ceb9b['query'][_0x72f8('0x4a')]+'%'};return _0x2e8921;})});}_0x4b8c05=_[_0x72f8('0x4b')]({},_0x4b8c05,_0x2ceb9b['options']);return _0x239eba[_0x72f8('0x95')](_0x4b8c05);}})[_0x72f8('0x20')](function(_0x287781){if(_0x287781){_0x3e84c6=_0x287781[_0x72f8('0x46')];if(!_0x2ceb9b['query'][_0x72f8('0x47')]('nolimit')){_0x4b8c05['limit']=qs[_0x72f8('0x2f')](_0x2ceb9b[_0x72f8('0x41')]['limit']);_0x4b8c05[_0x72f8('0x2d')]=qs['offset'](_0x2ceb9b[_0x72f8('0x41')]['offset']);}return _0x239eba[_0x72f8('0x95')](_0x4b8c05);}})['then'](function(_0x38b831){if(_0x38b831){return _0x38b831?{'count':_0x3e84c6,'rows':_0x38b831}:null;}})[_0x72f8('0x20')](respondWithResult(_0xdca97b,null))[_0x72f8('0x2a')](handleError(_0xdca97b,null));}; \ No newline at end of file +var _0x61e2=['undefined','count','limit','Content-Range','apply','update','get','ChatQueues','UserProfileResource','destroy','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','rows','show','params','keys','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','ChatQueueId','filter','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','chatPause','createdAt','SIP','Team','getTeams','online','interface','flatMap','Agents','addTeams','each','forEach','emit','userChatQueue:save','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','includes','all','union','compact','value','transaction','removeTeams','ids','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','hasOwnProperty','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset'];(function(_0x333037,_0xbbe0b6){var _0x45b3b8=function(_0x1a8fe7){while(--_0x1a8fe7){_0x333037['push'](_0x333037['shift']());}};_0x45b3b8(++_0xbbe0b6);}(_0x61e2,0x19e));var _0x261e=function(_0x1b9162,_0x4cb13c){_0x1b9162=_0x1b9162-0x0;var _0x3a61ae=_0x61e2[_0x1b9162];return _0x3a61ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x261e('0x0'));var zipdir=require(_0x261e('0x1'));var jsonpatch=require(_0x261e('0x2'));var rp=require('request-promise');var moment=require(_0x261e('0x3'));var BPromise=require(_0x261e('0x4'));var Mustache=require(_0x261e('0x5'));var util=require(_0x261e('0x6'));var path=require(_0x261e('0x7'));var sox=require(_0x261e('0x8'));var csv=require(_0x261e('0x9'));var ejs=require(_0x261e('0xa'));var fs=require('fs');var fs_extra=require(_0x261e('0xb'));var _=require(_0x261e('0xc'));var squel=require(_0x261e('0xd'));var crypto=require(_0x261e('0xe'));var jsforce=require(_0x261e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x261e('0x9'));var querystring=require(_0x261e('0x10'));var Papa=require(_0x261e('0x11'));var Redis=require(_0x261e('0x12'));var authService=require(_0x261e('0x13'));var qs=require(_0x261e('0x14'));var as=require(_0x261e('0x15'));var hardwareService=require(_0x261e('0x16'));var logger=require(_0x261e('0x17'))(_0x261e('0x18'));var utils=require('../../config/utils');var config=require(_0x261e('0x19'));var licenseUtil=require(_0x261e('0x1a'));var db=require(_0x261e('0x1b'))['db'];config[_0x261e('0x1c')]=_[_0x261e('0x1d')](config['redis'],{'host':_0x261e('0x1e'),'port':0x18eb});var socket=require(_0x261e('0x1f'))(new Redis(config[_0x261e('0x1c')]));require('./chatQueue.socket')[_0x261e('0x20')](socket);var jayson=require(_0x261e('0x21'));var client=jayson[_0x261e('0x22')][_0x261e('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3c45b9,_0x1829df,_0x36fd65,_0x2db483){return new BPromise(function(_0x503481,_0x2446cc){var _0x57a59d=_0x2db483||client;return _0x57a59d['request'](_0x3c45b9,_0x36fd65)[_0x261e('0x24')](function(_0x439602){logger['info'](_0x261e('0x25'),_0x1829df,_0x261e('0x26'));logger[_0x261e('0x27')](_0x261e('0x28'),_0x1829df,_0x261e('0x26'),JSON['stringify'](_0x439602));if(_0x439602[_0x261e('0x29')]){if(_0x439602[_0x261e('0x29')][_0x261e('0x2a')]===0x1f4){logger[_0x261e('0x29')](_0x261e('0x25'),_0x1829df,_0x439602[_0x261e('0x29')][_0x261e('0x2b')]);return _0x2446cc(_0x439602['error']['message']);}logger[_0x261e('0x29')]('ChatQueue,\x20%s,\x20%s',_0x1829df,_0x439602[_0x261e('0x29')]['message']);return _0x503481(_0x439602[_0x261e('0x29')][_0x261e('0x2b')]);}else{logger[_0x261e('0x2c')](_0x261e('0x25'),_0x1829df,'request\x20sent');_0x503481(_0x439602[_0x261e('0x2d')][_0x261e('0x2b')]);}})[_0x261e('0x2e')](function(_0x2fa01a){logger[_0x261e('0x29')](_0x261e('0x25'),_0x1829df,_0x2fa01a);_0x2446cc(_0x2fa01a);});});}function respondWithStatusCode(_0x18a533,_0x3adfed){_0x3adfed=_0x3adfed||0xcc;return function(_0x140074){if(_0x140074){return _0x18a533[_0x261e('0x2f')](_0x3adfed);}return _0x18a533[_0x261e('0x30')](_0x3adfed)['end']();};}function respondWithResult(_0x4a3c5f,_0x12b987){_0x12b987=_0x12b987||0xc8;return function(_0xed0eb7){if(_0xed0eb7){return _0x4a3c5f[_0x261e('0x30')](_0x12b987)[_0x261e('0x31')](_0xed0eb7);}};}function respondWithFilteredResult(_0x137f75,_0x471a0f){return function(_0x14719d){if(_0x14719d){var _0x32cfe3=typeof _0x471a0f[_0x261e('0x32')]==='undefined'&&typeof _0x471a0f['limit']===_0x261e('0x33');var _0x521ca6=_0x14719d[_0x261e('0x34')];var _0x597120=_0x32cfe3?0x0:_0x471a0f[_0x261e('0x32')];var _0x411b88=_0x32cfe3?_0x14719d[_0x261e('0x34')]:_0x471a0f[_0x261e('0x32')]+_0x471a0f[_0x261e('0x35')];var _0x4e8309;if(_0x411b88>=_0x521ca6){_0x411b88=_0x521ca6;_0x4e8309=0xc8;}else{_0x4e8309=0xce;}_0x137f75[_0x261e('0x30')](_0x4e8309);return _0x137f75['set'](_0x261e('0x36'),_0x597120+'-'+_0x411b88+'/'+_0x521ca6)[_0x261e('0x31')](_0x14719d);}return null;};}function patchUpdates(_0xc57399){return function(_0x361247){try{jsonpatch[_0x261e('0x37')](_0x361247,_0xc57399,!![]);}catch(_0x299787){return BPromise['reject'](_0x299787);}return _0x361247['save']();};}function saveUpdates(_0x101d36,_0x422616){return function(_0x6839e){if(_0x6839e){return _0x6839e[_0x261e('0x38')](_0x101d36)['then'](function(_0x91f448){return _0x91f448;});}return null;};}function removeEntity(_0x1f21ba,_0x42c2ba){return function(_0x5eaf51){if(_0x5eaf51){return _0x5eaf51['destroy']()[_0x261e('0x24')](function(){var _0xe94ccf=_0x5eaf51[_0x261e('0x39')]({'plain':!![]});var _0x545f5b=_0x261e('0x3a');return db[_0x261e('0x3b')][_0x261e('0x3c')]({'where':{'type':_0x545f5b,'resourceId':_0xe94ccf['id']}})[_0x261e('0x24')](function(){return _0x5eaf51;});})['then'](function(){_0x1f21ba[_0x261e('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19ce52,_0x319ae0){return function(_0x7fa93e){if(!_0x7fa93e){_0x19ce52[_0x261e('0x2f')](0x194);}return _0x7fa93e;};}function handleError(_0x92f758,_0x400d42){_0x400d42=_0x400d42||0x1f4;return function(_0x3d4a6b){logger['error'](_0x3d4a6b[_0x261e('0x3d')]);if(_0x3d4a6b['name']){delete _0x3d4a6b[_0x261e('0x3e')];}_0x92f758[_0x261e('0x30')](_0x400d42)[_0x261e('0x3f')](_0x3d4a6b);};}exports[_0x261e('0x40')]=function(_0x1f9914,_0x48ad04){var _0x114481={},_0x579542={},_0x5ebaac={'count':0x0,'rows':[]};var _0x8b40ac=_[_0x261e('0x41')](db[_0x261e('0x42')][_0x261e('0x43')],function(_0x18e00f){return{'name':_0x18e00f[_0x261e('0x44')],'type':_0x18e00f[_0x261e('0x45')]['key']};});_0x579542['model']=_['map'](_0x8b40ac,_0x261e('0x3e'));_0x579542[_0x261e('0x46')]=_['keys'](_0x1f9914[_0x261e('0x46')]);_0x579542[_0x261e('0x47')]=_['intersection'](_0x579542[_0x261e('0x48')],_0x579542[_0x261e('0x46')]);_0x114481[_0x261e('0x49')]=_[_0x261e('0x4a')](_0x579542['model'],qs[_0x261e('0x4b')](_0x1f9914[_0x261e('0x46')][_0x261e('0x4b')]));_0x114481[_0x261e('0x49')]=_0x114481['attributes']['length']?_0x114481[_0x261e('0x49')]:_0x579542[_0x261e('0x48')];if(!_0x1f9914[_0x261e('0x46')]['hasOwnProperty'](_0x261e('0x4c'))){_0x114481[_0x261e('0x35')]=qs[_0x261e('0x35')](_0x1f9914[_0x261e('0x46')]['limit']);_0x114481[_0x261e('0x32')]=qs[_0x261e('0x32')](_0x1f9914['query'][_0x261e('0x32')]);}_0x114481[_0x261e('0x4d')]=qs[_0x261e('0x4e')](_0x1f9914[_0x261e('0x46')][_0x261e('0x4e')]);_0x114481[_0x261e('0x4f')]=qs[_0x261e('0x47')](_[_0x261e('0x50')](_0x1f9914[_0x261e('0x46')],_0x579542[_0x261e('0x47')]),_0x8b40ac);if(_0x1f9914[_0x261e('0x46')]['filter']){_0x114481[_0x261e('0x4f')]=_[_0x261e('0x51')](_0x114481[_0x261e('0x4f')],{'$or':_[_0x261e('0x41')](_0x8b40ac,function(_0x60bb6a){if(_0x60bb6a['type']!==_0x261e('0x52')){var _0x41261f={};_0x41261f[_0x60bb6a[_0x261e('0x3e')]]={'$like':'%'+_0x1f9914[_0x261e('0x46')]['filter']+'%'};return _0x41261f;}})});}_0x114481=_[_0x261e('0x51')]({},_0x114481,_0x1f9914[_0x261e('0x53')]);var _0x49f6b6={'where':_0x114481[_0x261e('0x4f')]};return db['ChatQueue'][_0x261e('0x34')](_0x49f6b6)[_0x261e('0x24')](function(_0x3e46dc){_0x5ebaac[_0x261e('0x34')]=_0x3e46dc;if(_0x1f9914[_0x261e('0x46')]['includeAll']){_0x114481['include']=[{'all':!![]}];}return db[_0x261e('0x42')]['findAll'](_0x114481);})[_0x261e('0x24')](function(_0x395dc7){_0x5ebaac[_0x261e('0x54')]=_0x395dc7;return _0x5ebaac;})['then'](respondWithFilteredResult(_0x48ad04,_0x114481))['catch'](handleError(_0x48ad04,null));};exports[_0x261e('0x55')]=function(_0x5c450f,_0x2858c7){var _0x510171={'raw':!![],'where':{'id':_0x5c450f[_0x261e('0x56')]['id']}},_0x3e556b={};_0x3e556b[_0x261e('0x48')]=_['keys'](db[_0x261e('0x42')]['rawAttributes']);_0x3e556b['query']=_[_0x261e('0x57')](_0x5c450f[_0x261e('0x46')]);_0x3e556b['filters']=_[_0x261e('0x4a')](_0x3e556b[_0x261e('0x48')],_0x3e556b[_0x261e('0x46')]);_0x510171[_0x261e('0x49')]=_[_0x261e('0x4a')](_0x3e556b[_0x261e('0x48')],qs[_0x261e('0x4b')](_0x5c450f[_0x261e('0x46')][_0x261e('0x4b')]));_0x510171[_0x261e('0x49')]=_0x510171['attributes'][_0x261e('0x58')]?_0x510171[_0x261e('0x49')]:_0x3e556b['model'];if(_0x5c450f[_0x261e('0x46')]['includeAll']){_0x510171[_0x261e('0x59')]=[{'all':!![]}];}_0x510171=_[_0x261e('0x51')]({},_0x510171,_0x5c450f[_0x261e('0x53')]);return db['ChatQueue'][_0x261e('0x5a')](_0x510171)[_0x261e('0x24')](handleEntityNotFound(_0x2858c7,null))[_0x261e('0x24')](respondWithResult(_0x2858c7,null))[_0x261e('0x2e')](handleError(_0x2858c7,null));};exports[_0x261e('0x5b')]=function(_0x1a925e,_0x13d3d2){return db[_0x261e('0x42')][_0x261e('0x5b')](_0x1a925e[_0x261e('0x5c')],{})['then'](function(_0x136e07){var _0x161427=_0x1a925e[_0x261e('0x5d')][_0x261e('0x39')]({'plain':!![]});if(!_0x161427)throw new Error(_0x261e('0x5e'));if(_0x161427[_0x261e('0x5f')]==='user'){var _0x3a0220=_0x136e07['get']({'plain':!![]});var _0x1e3b6e='ChatQueues';return db[_0x261e('0x60')]['find']({'where':{'name':_0x1e3b6e,'userProfileId':_0x161427[_0x261e('0x61')]},'raw':!![]})['then'](function(_0x1cff07){if(_0x1cff07&&_0x1cff07[_0x261e('0x62')]===0x0){return db[_0x261e('0x3b')][_0x261e('0x5b')]({'name':_0x3a0220['name'],'resourceId':_0x3a0220['id'],'type':_0x1cff07[_0x261e('0x3e')],'sectionId':_0x1cff07['id']},{})[_0x261e('0x24')](function(){return _0x136e07;});}else{return _0x136e07;}})[_0x261e('0x2e')](function(_0x18ea7b){logger[_0x261e('0x29')](_0x261e('0x63'),_0x18ea7b);throw _0x18ea7b;});}return _0x136e07;})[_0x261e('0x24')](respondWithResult(_0x13d3d2,0xc9))[_0x261e('0x2e')](handleError(_0x13d3d2,null));};exports['update']=function(_0x1e5dd9,_0x5325e9){if(_0x1e5dd9[_0x261e('0x5c')]['id']){delete _0x1e5dd9[_0x261e('0x5c')]['id'];}return db[_0x261e('0x42')]['find']({'where':{'id':_0x1e5dd9[_0x261e('0x56')]['id']}})[_0x261e('0x24')](handleEntityNotFound(_0x5325e9,null))[_0x261e('0x24')](saveUpdates(_0x1e5dd9['body'],null))['then'](respondWithResult(_0x5325e9,null))[_0x261e('0x2e')](handleError(_0x5325e9,null));};exports[_0x261e('0x3c')]=function(_0x41f3c8,_0x4be46e){return db['ChatQueue'][_0x261e('0x5a')]({'where':{'id':_0x41f3c8[_0x261e('0x56')]['id']}})[_0x261e('0x24')](handleEntityNotFound(_0x4be46e,null))[_0x261e('0x24')](removeEntity(_0x4be46e,null))[_0x261e('0x2e')](handleError(_0x4be46e,null));};exports[_0x261e('0x64')]=function(_0x5b833a,_0x2acbd3){return db[_0x261e('0x42')]['describe']()[_0x261e('0x24')](respondWithResult(_0x2acbd3,null))[_0x261e('0x2e')](handleError(_0x2acbd3,null));};exports[_0x261e('0x65')]=function(_0x2a71b2,_0x4134b4,_0x278f8f){var _0x3ac74b={'raw':!![],'where':{}},_0x231dd3={},_0x27a1d7;return db['ChatQueue'][_0x261e('0x66')]({'where':{'id':_0x2a71b2[_0x261e('0x56')]['id']}})[_0x261e('0x24')](handleEntityNotFound(_0x4134b4,null))[_0x261e('0x24')](function(_0x3323ed){if(_0x3323ed){_0x27a1d7=_0x3323ed[_0x261e('0x39')]({'plain':!![]});_0x231dd3[_0x261e('0x48')]=_[_0x261e('0x57')](db['UserChatQueue'][_0x261e('0x43')]);_0x231dd3[_0x261e('0x46')]=_[_0x261e('0x57')](_0x2a71b2['query']);_0x231dd3[_0x261e('0x47')]=_['intersection'](_0x231dd3[_0x261e('0x48')],_0x231dd3[_0x261e('0x46')]);_0x3ac74b[_0x261e('0x49')]=_[_0x261e('0x4a')](_0x231dd3[_0x261e('0x48')],qs[_0x261e('0x4b')](_0x2a71b2[_0x261e('0x46')][_0x261e('0x4b')]));_0x3ac74b[_0x261e('0x49')]=_0x3ac74b[_0x261e('0x49')][_0x261e('0x58')]?_0x3ac74b[_0x261e('0x49')]:_0x231dd3['model'];if(!_0x2a71b2[_0x261e('0x46')]['hasOwnProperty'](_0x261e('0x4c'))){_0x3ac74b[_0x261e('0x35')]=qs[_0x261e('0x35')](_0x2a71b2[_0x261e('0x46')]['limit']);_0x3ac74b[_0x261e('0x32')]=qs[_0x261e('0x32')](_0x2a71b2[_0x261e('0x46')][_0x261e('0x32')]);}_0x3ac74b['order']=qs[_0x261e('0x4e')](_0x2a71b2[_0x261e('0x46')][_0x261e('0x4e')]);_0x3ac74b['where']=qs[_0x261e('0x47')](_['pick'](_0x2a71b2['query'],_0x231dd3[_0x261e('0x47')]));_0x3ac74b['where'][_0x261e('0x67')]=_0x3323ed['id'];if(_0x2a71b2[_0x261e('0x46')][_0x261e('0x68')]){_0x3ac74b[_0x261e('0x4f')]=_[_0x261e('0x51')](_0x3ac74b['where'],{'$or':_[_0x261e('0x41')](_0x3ac74b[_0x261e('0x49')],function(_0x59df15){var _0x19882a={};_0x19882a[_0x59df15]={'$like':'%'+_0x2a71b2['query'][_0x261e('0x68')]+'%'};return _0x19882a;})});}_0x3ac74b=_[_0x261e('0x51')]({},_0x3ac74b,_0x2a71b2[_0x261e('0x53')]);return db[_0x261e('0x69')][_0x261e('0x6a')](_0x3ac74b);}})[_0x261e('0x24')](function(_0x41306c){if(_0x41306c){return db[_0x261e('0x6b')][_0x261e('0x6c')]({'where':{'id':_['map'](_0x41306c,_0x261e('0x6d')),'role':_0x261e('0x6e')},'attributes':['id',_0x261e('0x3e'),_0x261e('0x6f'),'updatedAt',_0x261e('0x70')]});}})[_0x261e('0x24')](function(_0x513df5){if(_0x513df5){return{'count':_0x513df5[_0x261e('0x34')],'rows':_[_0x261e('0x41')](_0x513df5[_0x261e('0x54')],function(_0x3f34d8){return{'membername':_0x3f34d8['name'],'UserId':_0x3f34d8['id'],'queue_name':_0x27a1d7[_0x261e('0x3e')],'ChatQueueId':_0x27a1d7['id'],'interface':util['format']('%s/%s',_0x261e('0x71'),_0x3f34d8[_0x261e('0x3e')]),'penalty':0x0,'paused':_0x3f34d8[_0x261e('0x6f')],'createdAt':_0x3f34d8[_0x261e('0x70')],'updatedAt':_0x3f34d8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4134b4,_0x3ac74b))[_0x261e('0x2e')](handleError(_0x4134b4,null));};exports['getTeams']=function(_0x5ae46b,_0x2dd9bb,_0x1ba2b6){var _0x423075={};var _0x208c7a={};var _0x7a87dc;var _0x45d955;return db[_0x261e('0x42')]['findOne']({'where':{'id':_0x5ae46b[_0x261e('0x56')]['id']}})[_0x261e('0x24')](handleEntityNotFound(_0x2dd9bb,null))[_0x261e('0x24')](function(_0x173ee2){if(_0x173ee2){_0x7a87dc=_0x173ee2;_0x208c7a[_0x261e('0x48')]=_[_0x261e('0x57')](db[_0x261e('0x72')][_0x261e('0x43')]);_0x208c7a[_0x261e('0x46')]=_[_0x261e('0x57')](_0x5ae46b['query']);_0x208c7a['filters']=_[_0x261e('0x4a')](_0x208c7a['model'],_0x208c7a[_0x261e('0x46')]);_0x423075[_0x261e('0x49')]=_[_0x261e('0x4a')](_0x208c7a[_0x261e('0x48')],qs[_0x261e('0x4b')](_0x5ae46b[_0x261e('0x46')]['fields']));_0x423075[_0x261e('0x49')]=_0x423075[_0x261e('0x49')][_0x261e('0x58')]?_0x423075['attributes']:_0x208c7a[_0x261e('0x48')];_0x423075[_0x261e('0x4d')]=qs[_0x261e('0x4e')](_0x5ae46b['query'][_0x261e('0x4e')]);_0x423075[_0x261e('0x4f')]=qs[_0x261e('0x47')](_[_0x261e('0x50')](_0x5ae46b['query'],_0x208c7a['filters']));if(_0x5ae46b[_0x261e('0x46')][_0x261e('0x68')]){_0x423075[_0x261e('0x4f')]=_[_0x261e('0x51')](_0x423075[_0x261e('0x4f')],{'$or':_[_0x261e('0x41')](_0x423075['attributes'],function(_0x2584dd){var _0x4901cf={};_0x4901cf[_0x2584dd]={'$like':'%'+_0x5ae46b[_0x261e('0x46')][_0x261e('0x68')]+'%'};return _0x4901cf;})});}_0x423075=_[_0x261e('0x51')]({},_0x423075,_0x5ae46b['options']);return _0x7a87dc[_0x261e('0x73')](_0x423075);}})[_0x261e('0x24')](function(_0x1eebb7){if(_0x1eebb7){_0x45d955=_0x1eebb7[_0x261e('0x58')];if(!_0x5ae46b[_0x261e('0x46')]['hasOwnProperty'](_0x261e('0x4c'))){_0x423075['limit']=qs[_0x261e('0x35')](_0x5ae46b[_0x261e('0x46')][_0x261e('0x35')]);_0x423075[_0x261e('0x32')]=qs[_0x261e('0x32')](_0x5ae46b[_0x261e('0x46')][_0x261e('0x32')]);}return _0x7a87dc[_0x261e('0x73')](_0x423075);}})[_0x261e('0x24')](function(_0x24c7b9){if(_0x24c7b9){return _0x24c7b9?{'count':_0x45d955,'rows':_0x24c7b9}:null;}})['then'](respondWithResult(_0x2dd9bb,null))[_0x261e('0x2e')](handleError(_0x2dd9bb,null));};exports['addTeams']=function(_0x51f1e9,_0x58591c,_0x4fa9ce){var _0x176dc7=_0x51f1e9[_0x261e('0x5c')]['ids'];return db[_0x261e('0x72')]['findAll']({'where':{'id':_0x176dc7},'attributes':['id'],'include':[{'model':db[_0x261e('0x6b')],'as':'Agents','attributes':['id','name',_0x261e('0x74'),'voicePause',_0x261e('0x75')],'raw':!![]}]})[_0x261e('0x24')](function(_0x83a406){if(_0x83a406){var _0x37a605=_[_0x261e('0x76')](_0x83a406,function(_0x1c9679){var _0x27724b=_0x1c9679[_0x261e('0x39')]({'plain':!![]});return _0x27724b[_0x261e('0x77')];});return db['ChatQueue'][_0x261e('0x5a')]({'where':{'id':_0x51f1e9[_0x261e('0x56')]['id']}})[_0x261e('0x24')](function(_0x40877e){return db['sequelize']['transaction'](function(_0x1f1ac2){return _0x40877e[_0x261e('0x78')](_0x176dc7,{'transaction':_0x1f1ac2})[_0x261e('0x24')](function(){return BPromise[_0x261e('0x79')](_0x37a605,function(_0x427c58){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x427c58['id'],'ChatQueueId':_0x51f1e9[_0x261e('0x56')]['id']},'transaction':_0x1f1ac2});});})[_0x261e('0x24')](function(){_0x37a605[_0x261e('0x7a')](function(_0x237da2){socket[_0x261e('0x7b')](_0x261e('0x7c'),{'UserId':_0x237da2['id'],'ChatQueueId':_0x40877e['id']});});});});});}})[_0x261e('0x24')](respondWithStatusCode(_0x58591c,null))['catch'](handleError(_0x58591c,null));};exports['removeTeams']=function(_0x120e98,_0x43b8c6,_0x4d9102){return db[_0x261e('0x72')]['findAll']({'where':{'id':_0x120e98[_0x261e('0x46')]['ids']},'attributes':['id'],'include':[{'model':db[_0x261e('0x6b')],'as':_0x261e('0x77'),'attributes':['id'],'raw':!![]}]})[_0x261e('0x24')](handleEntityNotFound(_0x43b8c6,null))[_0x261e('0x24')](function(_0x60291){var _0x2cd50e=_[_0x261e('0x41')](_0x60291,'id');var _0x1f7fb1=[];var _0x1e67af=[];var _0x4adefc=squel[_0x261e('0x7d')]();_0x4adefc[_0x261e('0x7e')](_0x261e('0x7f'))['from'](_0x261e('0x80'),'tq')[_0x261e('0x81')](_0x261e('0x82'),'ut',_0x261e('0x83'))[_0x261e('0x4f')]('ChatQueueId\x20=\x20?',_0x120e98[_0x261e('0x56')]['id']);for(var _0x2f09b9=0x0;_0x2f09b9<_0x60291[_0x261e('0x58')];_0x2f09b9+=0x1){let _0x2ee2e0=_0x60291[_0x2f09b9];for(var _0x5c48e7=0x0;_0x5c48e7<_0x2ee2e0[_0x261e('0x77')][_0x261e('0x58')];_0x5c48e7+=0x1){let _0x458888=_0x2ee2e0[_0x261e('0x77')][_0x5c48e7];var _0x332b27=_0x4adefc[_0x261e('0x84')]();_0x332b27[_0x261e('0x4f')](_0x261e('0x85'),_0x458888['id']);_0x1e67af[_0x261e('0x86')](db[_0x261e('0x87')][_0x261e('0x46')](_0x332b27[_0x261e('0x88')](),{'type':db[_0x261e('0x87')][_0x261e('0x89')]['SELECT']})[_0x261e('0x24')](function(_0x5bca0a){if(_0x5bca0a[_0x261e('0x58')]===0x1){return _0x458888['id'];}else{var _0x1f9106=_['every'](_[_0x261e('0x41')](_0x5bca0a,'TeamId'),function(_0x377c57){return _[_0x261e('0x8a')](_0x2cd50e,_0x377c57);});if(_0x1f9106){return _0x458888['id'];}}}));}}return BPromise[_0x261e('0x8b')](_0x1e67af)['then'](function(_0x369a7b){_0x1f7fb1=_(_0x1f7fb1)[_0x261e('0x8c')](_0x369a7b)[_0x261e('0x8d')]()[_0x261e('0x8e')]();return db[_0x261e('0x42')]['find']({'where':{'id':_0x120e98['params']['id']}})['then'](function(_0x1b7eb7){return db[_0x261e('0x87')][_0x261e('0x8f')](function(_0xfb09be){return _0x1b7eb7[_0x261e('0x90')](_0x120e98[_0x261e('0x46')][_0x261e('0x91')],{'transaction':_0xfb09be})[_0x261e('0x24')](function(){if(!_[_0x261e('0x92')](_0x1f7fb1)){return _0x1b7eb7[_0x261e('0x93')](_0x1f7fb1,{'transaction':_0xfb09be});}})[_0x261e('0x24')](function(){_0x1f7fb1['forEach'](function(_0x543952){socket[_0x261e('0x7b')]('userChatQueue:remove',{'UserId':_0x543952,'ChatQueueId':_0x1b7eb7['id']});});});});});});})[_0x261e('0x24')](respondWithStatusCode(_0x43b8c6,null))[_0x261e('0x2e')](handleError(_0x43b8c6,null));};exports[_0x261e('0x94')]=function(_0x32bc5e,_0x586be6,_0x462246){return db[_0x261e('0x42')][_0x261e('0x5a')]({'where':{'id':_0x32bc5e[_0x261e('0x56')]['id']}})[_0x261e('0x24')](handleEntityNotFound(_0x586be6,null))[_0x261e('0x24')](function(_0x24634f){if(_0x24634f){return _0x24634f['addAgents'](_0x32bc5e[_0x261e('0x5c')][_0x261e('0x91')],_[_0x261e('0x95')](_0x32bc5e['body'],[_0x261e('0x91'),'id'])||{})[_0x261e('0x96')](function(_0x503302){for(var _0x5f15ab=0x0;_0x5f15ab<_0x32bc5e[_0x261e('0x5c')][_0x261e('0x91')][_0x261e('0x58')];_0x5f15ab+=0x1){socket[_0x261e('0x7b')](_0x261e('0x7c'),{'UserId':Number(_0x32bc5e[_0x261e('0x5c')]['ids'][_0x5f15ab]),'ChatQueueId':Number(_0x32bc5e[_0x261e('0x56')]['id'])});}return _0x503302;});}})[_0x261e('0x24')](respondWithResult(_0x586be6,null))[_0x261e('0x2e')](handleError(_0x586be6,null));};exports[_0x261e('0x93')]=function(_0x42a1c5,_0x1b6080,_0x197c20){return db['ChatQueue'][_0x261e('0x5a')]({'where':{'id':_0x42a1c5['params']['id']}})['then'](handleEntityNotFound(_0x1b6080,null))[_0x261e('0x24')](function(_0x19bf32){if(_0x19bf32){return _0x19bf32[_0x261e('0x93')](_0x42a1c5[_0x261e('0x46')][_0x261e('0x91')])[_0x261e('0x24')](function(){if(_[_0x261e('0x97')](_0x42a1c5['query'][_0x261e('0x91')])){for(var _0x4c453d=0x0;_0x4c453d<_0x42a1c5['query']['ids'][_0x261e('0x58')];_0x4c453d+=0x1){socket['emit'](_0x261e('0x98'),{'UserId':Number(_0x42a1c5['query'][_0x261e('0x91')][_0x4c453d]),'ChatQueueId':Number(_0x42a1c5[_0x261e('0x56')]['id'])});}}else{socket[_0x261e('0x7b')](_0x261e('0x98'),{'UserId':Number(_0x42a1c5[_0x261e('0x46')][_0x261e('0x91')]),'ChatQueueId':Number(_0x42a1c5[_0x261e('0x56')]['id'])});}});}})[_0x261e('0x24')](respondWithStatusCode(_0x1b6080,null))[_0x261e('0x2e')](handleError(_0x1b6080,null));};exports['getAgents']=function(_0x25eca8,_0x52023c,_0x5c416c){var _0x51f013={};var _0x163455={};var _0xf9da1f;var _0x23e176;return db['ChatQueue'][_0x261e('0x66')]({'where':{'id':_0x25eca8['params']['id']}})[_0x261e('0x24')](handleEntityNotFound(_0x52023c,null))['then'](function(_0x387d9d){if(_0x387d9d){_0xf9da1f=_0x387d9d;_0x163455[_0x261e('0x48')]=_['keys'](db[_0x261e('0x6b')][_0x261e('0x43')]);_0x163455[_0x261e('0x46')]=_['keys'](_0x25eca8[_0x261e('0x46')]);_0x163455[_0x261e('0x47')]=_[_0x261e('0x4a')](_0x163455[_0x261e('0x48')],_0x163455['query']);_0x51f013['attributes']=_[_0x261e('0x4a')](_0x163455[_0x261e('0x48')],qs['fields'](_0x25eca8[_0x261e('0x46')][_0x261e('0x4b')]));_0x51f013['attributes']=_0x51f013[_0x261e('0x49')]['length']?_0x51f013['attributes']:_0x163455[_0x261e('0x48')];_0x51f013[_0x261e('0x4d')]=qs[_0x261e('0x4e')](_0x25eca8[_0x261e('0x46')][_0x261e('0x4e')]);_0x51f013[_0x261e('0x4f')]=qs['filters'](_[_0x261e('0x50')](_0x25eca8[_0x261e('0x46')],_0x163455['filters']));if(_0x25eca8['query'][_0x261e('0x68')]){_0x51f013[_0x261e('0x4f')]=_[_0x261e('0x51')](_0x51f013[_0x261e('0x4f')],{'$or':_[_0x261e('0x41')](_0x51f013[_0x261e('0x49')],function(_0x3585f7){var _0x3a0ee9={};_0x3a0ee9[_0x3585f7]={'$like':'%'+_0x25eca8['query'][_0x261e('0x68')]+'%'};return _0x3a0ee9;})});}_0x51f013=_[_0x261e('0x51')]({},_0x51f013,_0x25eca8[_0x261e('0x53')]);return _0xf9da1f['getAgents'](_0x51f013);}})[_0x261e('0x24')](function(_0x5c6293){if(_0x5c6293){_0x23e176=_0x5c6293['length'];if(!_0x25eca8[_0x261e('0x46')][_0x261e('0x99')](_0x261e('0x4c'))){_0x51f013[_0x261e('0x35')]=qs[_0x261e('0x35')](_0x25eca8[_0x261e('0x46')][_0x261e('0x35')]);_0x51f013[_0x261e('0x32')]=qs[_0x261e('0x32')](_0x25eca8[_0x261e('0x46')][_0x261e('0x32')]);}return _0xf9da1f[_0x261e('0x9a')](_0x51f013);}})[_0x261e('0x24')](function(_0x11cf92){if(_0x11cf92){return _0x11cf92?{'count':_0x23e176,'rows':_0x11cf92}:null;}})['then'](respondWithResult(_0x52023c,null))[_0x261e('0x2e')](handleError(_0x52023c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 79a7644..e6d2aae 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 _0xb4a9=['exports','events','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x332e43,_0x252844){var _0x13bee3=function(_0x28c39a){while(--_0x28c39a){_0x332e43['push'](_0x332e43['shift']());}};_0x13bee3(++_0x252844);}(_0xb4a9,0x1c1));var _0x9b4a=function(_0x3a8be4,_0x11056d){_0x3a8be4=_0x3a8be4-0x0;var _0x5f0406=_0xb4a9[_0x3a8be4];return _0x5f0406;};'use strict';var EventEmitter=require(_0x9b4a('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x9b4a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9b4a('0x2')};function emitEvent(_0x48824e){return function(_0x5cc501,_0x1a1ec6,_0x6e3590){ChatQueueEvents[_0x9b4a('0x3')](_0x48824e+':'+_0x5cc501['id'],_0x5cc501);ChatQueueEvents[_0x9b4a('0x3')](_0x48824e,_0x5cc501);_0x6e3590(null);};}for(var e in events){if(events[_0x9b4a('0x4')](e)){var event=events[e];ChatQueue[_0x9b4a('0x5')](e,emitEvent(event));}}module[_0x9b4a('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x3d1b=['emit','events','../../mysqldb','ChatQueue','setMaxListeners','update','remove'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x3d1b,0xb7));var _0xb3d1=function(_0x4ecedb,_0x2dffa3){_0x4ecedb=_0x4ecedb-0x0;var _0x3544cc=_0x3d1b[_0x4ecedb];return _0x3544cc;};'use strict';var EventEmitter=require(_0xb3d1('0x0'));var ChatQueue=require(_0xb3d1('0x1'))['db'][_0xb3d1('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xb3d1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb3d1('0x4'),'afterDestroy':_0xb3d1('0x5')};function emitEvent(_0x265d46){return function(_0x271a79,_0x3d1e20,_0x5df6d1){ChatQueueEvents[_0xb3d1('0x6')](_0x265d46+':'+_0x271a79['id'],_0x271a79);ChatQueueEvents['emit'](_0x265d46,_0x271a79);_0x5df6d1(null);};}for(var e in events){if(events['hasOwnProperty'](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 b142aad..8ff1845 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 _0x0b48=['bluebird','request-promise','../../config/environment','exports','define','ChatQueue','util','api','moment'];(function(_0x430f44,_0x4ae21b){var _0x1f6b0f=function(_0x35968f){while(--_0x35968f){_0x430f44['push'](_0x430f44['shift']());}};_0x1f6b0f(++_0x4ae21b);}(_0x0b48,0x1bf));var _0x80b4=function(_0xc22a01,_0x77c37f){_0xc22a01=_0xc22a01-0x0;var _0x26ffbc=_0x0b48[_0xc22a01];return _0x26ffbc;};'use strict';var _=require('lodash');var util=require(_0x80b4('0x0'));var logger=require('../../config/logger')(_0x80b4('0x1'));var moment=require(_0x80b4('0x2'));var BPromise=require(_0x80b4('0x3'));var rp=require(_0x80b4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x80b4('0x5'));var attributes=require('./chatQueue.attributes');module[_0x80b4('0x6')]=function(_0x4bd2f4,_0x36eb76){return _0x4bd2f4[_0x80b4('0x7')](_0x80b4('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2024=['path','./chatQueue.attributes','exports','chat_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1643d3,_0x5e3deb){var _0x52dd4c=function(_0x2207ef){while(--_0x2207ef){_0x1643d3['push'](_0x1643d3['shift']());}};_0x52dd4c(++_0x5e3deb);}(_0x2024,0xa4));var _0x4202=function(_0x5bd159,_0x37b00b){_0x5bd159=_0x5bd159-0x0;var _0x3c20f5=_0x2024[_0x5bd159];return _0x3c20f5;};'use strict';var _=require(_0x4202('0x0'));var util=require(_0x4202('0x1'));var logger=require(_0x4202('0x2'))(_0x4202('0x3'));var moment=require(_0x4202('0x4'));var BPromise=require('bluebird');var rp=require(_0x4202('0x5'));var fs=require('fs');var path=require(_0x4202('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4202('0x7'));module[_0x4202('0x8')]=function(_0x335704,_0x4b61b0){return _0x335704['define']('ChatQueue',attributes,{'tableName':_0x4202('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 ba22160..e855238 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 _0xd0f5=['catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','find','ShowChatQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x27d6b6,_0x317686){var _0xc06c37=function(_0x6f6aa6){while(--_0x6f6aa6){_0x27d6b6['push'](_0x27d6b6['shift']());}};_0xc06c37(++_0x317686);}(_0xd0f5,0xda));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d0f('0x0'));var util=require(_0x5d0f('0x1'));var moment=require('moment');var BPromise=require(_0x5d0f('0x2'));var rs=require(_0x5d0f('0x3'));var fs=require('fs');var Redis=require(_0x5d0f('0x4'));var db=require(_0x5d0f('0x5'))['db'];var utils=require(_0x5d0f('0x6'));var logger=require(_0x5d0f('0x7'))(_0x5d0f('0x8'));var config=require(_0x5d0f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5d0f('0xa')][_0x5d0f('0xb')]({'port':0x232a});config['redis']=_[_0x5d0f('0xc')](config[_0x5d0f('0xd')],{'host':_0x5d0f('0xe'),'port':0x18eb});var socket=require(_0x5d0f('0xf'))(new Redis(config['redis']));require(_0x5d0f('0x10'))[_0x5d0f('0x11')](socket);function respondWithRpcPromise(_0x138715,_0x47f7a7,_0x177101){return new BPromise(function(_0x29164d,_0x49aba5){return client[_0x5d0f('0x12')](_0x138715,_0x177101)[_0x5d0f('0x13')](function(_0x5c5bc1){logger[_0x5d0f('0x14')](_0x5d0f('0x15'),_0x47f7a7,_0x5d0f('0x16'));logger[_0x5d0f('0x17')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x47f7a7,'request\x20sent',JSON[_0x5d0f('0x18')](_0x5c5bc1));if(_0x5c5bc1['error']){if(_0x5c5bc1[_0x5d0f('0x19')][_0x5d0f('0x1a')]===0x1f4){logger[_0x5d0f('0x19')](_0x5d0f('0x15'),_0x47f7a7,_0x5c5bc1[_0x5d0f('0x19')][_0x5d0f('0x1b')]);return _0x49aba5(_0x5c5bc1[_0x5d0f('0x19')][_0x5d0f('0x1b')]);}logger[_0x5d0f('0x19')](_0x5d0f('0x15'),_0x47f7a7,_0x5c5bc1[_0x5d0f('0x19')]['message']);return _0x29164d(_0x5c5bc1['error'][_0x5d0f('0x1b')]);}else{logger[_0x5d0f('0x14')](_0x5d0f('0x15'),_0x47f7a7,_0x5d0f('0x16'));_0x29164d(_0x5c5bc1['result'][_0x5d0f('0x1b')]);}})[_0x5d0f('0x1c')](function(_0x1c3976){logger[_0x5d0f('0x19')](_0x5d0f('0x15'),_0x47f7a7,_0x1c3976);_0x49aba5(_0x1c3976);});});}exports[_0x5d0f('0x1d')]=function(_0x27de43){var _0xdf02d5=this;return new Promise(function(_0x4a8fdb,_0x1679e2){return db[_0x5d0f('0x1e')][_0x5d0f('0x1f')]({'raw':_0x27de43[_0x5d0f('0x20')]?_0x27de43[_0x5d0f('0x20')][_0x5d0f('0x21')]===undefined?!![]:![]:!![],'where':_0x27de43[_0x5d0f('0x20')]?_0x27de43[_0x5d0f('0x20')]['where']||null:null,'attributes':_0x27de43['options']?_0x27de43[_0x5d0f('0x20')][_0x5d0f('0x22')]||null:null,'limit':_0x27de43['options']?_0x27de43[_0x5d0f('0x20')][_0x5d0f('0x23')]||null:null,'include':_0x27de43[_0x5d0f('0x20')]?_0x27de43['options'][_0x5d0f('0x24')]?_[_0x5d0f('0x25')](_0x27de43['options'][_0x5d0f('0x24')],function(_0x35aa62){return{'model':db[_0x35aa62[_0x5d0f('0x26')]],'as':_0x35aa62['as'],'attributes':_0x35aa62[_0x5d0f('0x22')],'include':_0x35aa62[_0x5d0f('0x24')]?_[_0x5d0f('0x25')](_0x35aa62[_0x5d0f('0x24')],function(_0x2a35eb){return{'model':db[_0x2a35eb[_0x5d0f('0x26')]],'as':_0x2a35eb['as'],'attributes':_0x2a35eb[_0x5d0f('0x22')],'include':_0x2a35eb[_0x5d0f('0x24')]?_[_0x5d0f('0x25')](_0x2a35eb['include'],function(_0x3886f8){return{'model':db[_0x3886f8['model']],'as':_0x3886f8['as'],'attributes':_0x3886f8[_0x5d0f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5d0f('0x13')](function(_0x4fbddf){logger[_0x5d0f('0x14')](_0x5d0f('0x1d'),_0x27de43);logger[_0x5d0f('0x17')]('GetChatQueue',_0x27de43,JSON[_0x5d0f('0x18')](_0x4fbddf));_0x4a8fdb(_0x4fbddf);})[_0x5d0f('0x1c')](function(_0x564496){logger[_0x5d0f('0x19')](_0x5d0f('0x1d'),_0x564496[_0x5d0f('0x1b')],_0x27de43);_0x1679e2(_0xdf02d5[_0x5d0f('0x19')](0x1f4,_0x564496[_0x5d0f('0x1b')]));});});};exports['ShowChatQueue']=function(_0x4d15e9){var _0x37c61e=this;return new Promise(function(_0x397c63,_0x13207d){return db[_0x5d0f('0x1e')][_0x5d0f('0x27')]({'raw':_0x4d15e9['options']?_0x4d15e9['options'][_0x5d0f('0x21')]===undefined?!![]:![]:!![],'where':_0x4d15e9[_0x5d0f('0x20')]?_0x4d15e9[_0x5d0f('0x20')]['where']||null:null,'attributes':_0x4d15e9[_0x5d0f('0x20')]?_0x4d15e9[_0x5d0f('0x20')][_0x5d0f('0x22')]||null:null,'include':_0x4d15e9[_0x5d0f('0x20')]?_0x4d15e9['options'][_0x5d0f('0x24')]?_[_0x5d0f('0x25')](_0x4d15e9[_0x5d0f('0x20')][_0x5d0f('0x24')],function(_0x16e25e){return{'model':db[_0x16e25e[_0x5d0f('0x26')]],'as':_0x16e25e['as'],'attributes':_0x16e25e[_0x5d0f('0x22')],'include':_0x16e25e[_0x5d0f('0x24')]?_[_0x5d0f('0x25')](_0x16e25e[_0x5d0f('0x24')],function(_0x3b2e11){return{'model':db[_0x3b2e11['model']],'as':_0x3b2e11['as'],'attributes':_0x3b2e11[_0x5d0f('0x22')],'include':_0x3b2e11[_0x5d0f('0x24')]?_[_0x5d0f('0x25')](_0x3b2e11['include'],function(_0x5bbfc2){return{'model':db[_0x5bbfc2[_0x5d0f('0x26')]],'as':_0x5bbfc2['as'],'attributes':_0x5bbfc2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x396cd0){logger[_0x5d0f('0x14')]('ShowChatQueue',_0x4d15e9);logger[_0x5d0f('0x17')](_0x5d0f('0x28'),_0x4d15e9,JSON['stringify'](_0x396cd0));_0x397c63(_0x396cd0);})[_0x5d0f('0x1c')](function(_0x2b5c15){logger[_0x5d0f('0x19')](_0x5d0f('0x28'),_0x2b5c15[_0x5d0f('0x1b')],_0x4d15e9);_0x13207d(_0x37c61e[_0x5d0f('0x19')](0x1f4,_0x2b5c15['message']));});});}; \ No newline at end of file +var _0xfbb2=['code','ChatQueue,\x20%s,\x20%s','message','catch','GetChatQueue','options','raw','where','include','map','model','attributes','find','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfbb2,0xae));var _0x2fbb=function(_0x34fe22,_0x4b0faa){_0x34fe22=_0x34fe22-0x0;var _0x126030=_0xfbb2[_0x34fe22];return _0x126030;};'use strict';var _=require(_0x2fbb('0x0'));var util=require(_0x2fbb('0x1'));var moment=require(_0x2fbb('0x2'));var BPromise=require(_0x2fbb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fbb('0x4'));var db=require(_0x2fbb('0x5'))['db'];var utils=require(_0x2fbb('0x6'));var logger=require(_0x2fbb('0x7'))(_0x2fbb('0x8'));var config=require(_0x2fbb('0x9'));var jayson=require(_0x2fbb('0xa'));var client=jayson['client'][_0x2fbb('0xb')]({'port':0x232a});config[_0x2fbb('0xc')]=_[_0x2fbb('0xd')](config['redis'],{'host':_0x2fbb('0xe'),'port':0x18eb});var socket=require(_0x2fbb('0xf'))(new Redis(config[_0x2fbb('0xc')]));require(_0x2fbb('0x10'))[_0x2fbb('0x11')](socket);function respondWithRpcPromise(_0x52b99d,_0x4abfac,_0x551625){return new BPromise(function(_0x4b083d,_0x3c98be){return client[_0x2fbb('0x12')](_0x52b99d,_0x551625)[_0x2fbb('0x13')](function(_0x4a2c2c){logger[_0x2fbb('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4abfac,_0x2fbb('0x15'));logger[_0x2fbb('0x16')](_0x2fbb('0x17'),_0x4abfac,_0x2fbb('0x15'),JSON[_0x2fbb('0x18')](_0x4a2c2c));if(_0x4a2c2c['error']){if(_0x4a2c2c[_0x2fbb('0x19')][_0x2fbb('0x1a')]===0x1f4){logger['error'](_0x2fbb('0x1b'),_0x4abfac,_0x4a2c2c['error'][_0x2fbb('0x1c')]);return _0x3c98be(_0x4a2c2c[_0x2fbb('0x19')][_0x2fbb('0x1c')]);}logger['error'](_0x2fbb('0x1b'),_0x4abfac,_0x4a2c2c[_0x2fbb('0x19')][_0x2fbb('0x1c')]);return _0x4b083d(_0x4a2c2c[_0x2fbb('0x19')][_0x2fbb('0x1c')]);}else{logger[_0x2fbb('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4abfac,_0x2fbb('0x15'));_0x4b083d(_0x4a2c2c['result'][_0x2fbb('0x1c')]);}})[_0x2fbb('0x1d')](function(_0x47f0c5){logger['error'](_0x2fbb('0x1b'),_0x4abfac,_0x47f0c5);_0x3c98be(_0x47f0c5);});});}exports[_0x2fbb('0x1e')]=function(_0x1d1215){var _0x3dca1c=this;return new Promise(function(_0x579fe0,_0xcdec3d){return db['ChatQueue']['findAll']({'raw':_0x1d1215[_0x2fbb('0x1f')]?_0x1d1215[_0x2fbb('0x1f')][_0x2fbb('0x20')]===undefined?!![]:![]:!![],'where':_0x1d1215[_0x2fbb('0x1f')]?_0x1d1215['options'][_0x2fbb('0x21')]||null:null,'attributes':_0x1d1215[_0x2fbb('0x1f')]?_0x1d1215[_0x2fbb('0x1f')]['attributes']||null:null,'limit':_0x1d1215['options']?_0x1d1215[_0x2fbb('0x1f')]['limit']||null:null,'include':_0x1d1215[_0x2fbb('0x1f')]?_0x1d1215[_0x2fbb('0x1f')][_0x2fbb('0x22')]?_[_0x2fbb('0x23')](_0x1d1215['options'][_0x2fbb('0x22')],function(_0x178569){return{'model':db[_0x178569[_0x2fbb('0x24')]],'as':_0x178569['as'],'attributes':_0x178569[_0x2fbb('0x25')],'include':_0x178569['include']?_[_0x2fbb('0x23')](_0x178569[_0x2fbb('0x22')],function(_0x1ddb64){return{'model':db[_0x1ddb64[_0x2fbb('0x24')]],'as':_0x1ddb64['as'],'attributes':_0x1ddb64['attributes'],'include':_0x1ddb64[_0x2fbb('0x22')]?_['map'](_0x1ddb64['include'],function(_0x33b493){return{'model':db[_0x33b493[_0x2fbb('0x24')]],'as':_0x33b493['as'],'attributes':_0x33b493['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45d35a){logger[_0x2fbb('0x14')](_0x2fbb('0x1e'),_0x1d1215);logger[_0x2fbb('0x16')](_0x2fbb('0x1e'),_0x1d1215,JSON[_0x2fbb('0x18')](_0x45d35a));_0x579fe0(_0x45d35a);})['catch'](function(_0x1bad55){logger[_0x2fbb('0x19')](_0x2fbb('0x1e'),_0x1bad55[_0x2fbb('0x1c')],_0x1d1215);_0xcdec3d(_0x3dca1c['error'](0x1f4,_0x1bad55[_0x2fbb('0x1c')]));});});};exports['ShowChatQueue']=function(_0x52b923){var _0x4a8373=this;return new Promise(function(_0x1e8a96,_0x221409){return db['ChatQueue'][_0x2fbb('0x26')]({'raw':_0x52b923[_0x2fbb('0x1f')]?_0x52b923[_0x2fbb('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x52b923[_0x2fbb('0x1f')]?_0x52b923[_0x2fbb('0x1f')][_0x2fbb('0x21')]||null:null,'attributes':_0x52b923[_0x2fbb('0x1f')]?_0x52b923[_0x2fbb('0x1f')][_0x2fbb('0x25')]||null:null,'include':_0x52b923['options']?_0x52b923[_0x2fbb('0x1f')][_0x2fbb('0x22')]?_[_0x2fbb('0x23')](_0x52b923['options'][_0x2fbb('0x22')],function(_0x267402){return{'model':db[_0x267402['model']],'as':_0x267402['as'],'attributes':_0x267402['attributes'],'include':_0x267402[_0x2fbb('0x22')]?_[_0x2fbb('0x23')](_0x267402[_0x2fbb('0x22')],function(_0x59f3e1){return{'model':db[_0x59f3e1['model']],'as':_0x59f3e1['as'],'attributes':_0x59f3e1[_0x2fbb('0x25')],'include':_0x59f3e1[_0x2fbb('0x22')]?_['map'](_0x59f3e1[_0x2fbb('0x22')],function(_0x59fd8d){return{'model':db[_0x59fd8d[_0x2fbb('0x24')]],'as':_0x59fd8d['as'],'attributes':_0x59fd8d[_0x2fbb('0x25')]};}):[]};}):[]};}):[]:[]})[_0x2fbb('0x13')](function(_0x4d4543){logger[_0x2fbb('0x14')](_0x2fbb('0x27'),_0x52b923);logger[_0x2fbb('0x16')]('ShowChatQueue',_0x52b923,JSON['stringify'](_0x4d4543));_0x1e8a96(_0x4d4543);})['catch'](function(_0x8645a2){logger[_0x2fbb('0x19')](_0x2fbb('0x27'),_0x8645a2['message'],_0x52b923);_0x221409(_0x4a8373[_0x2fbb('0x19')](0x1f4,_0x8645a2[_0x2fbb('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index de5f7fc..46bfe6e 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 _0x84ab=['update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save','remove'];(function(_0x47f1cc,_0x1081db){var _0x43760a=function(_0x55949b){while(--_0x55949b){_0x47f1cc['push'](_0x47f1cc['shift']());}};_0x43760a(++_0x1081db);}(_0x84ab,0x12f));var _0xb84a=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x84ab[_0x38ced4];return _0x547c07;};'use strict';var ChatQueueEvents=require(_0xb84a('0x0'));var events=[_0xb84a('0x1'),_0xb84a('0x2'),_0xb84a('0x3')];function createListener(_0x473c3,_0x512f13){return function(_0xc83587){_0x512f13[_0xb84a('0x4')](_0x473c3,_0xc83587);};}function removeListener(_0x47b8e3,_0x9d3a00){return function(){ChatQueueEvents[_0xb84a('0x5')](_0x47b8e3,_0x9d3a00);};}exports[_0xb84a('0x6')]=function(_0x5b9def){for(var _0x521a64=0x0,_0x4dc496=events[_0xb84a('0x7')];_0x521a64<_0x4dc496;_0x521a64++){var _0x4fac4d=events[_0x521a64];var _0x3e9086=createListener(_0xb84a('0x8')+_0x4fac4d,_0x5b9def);ChatQueueEvents['on'](_0x4fac4d,_0x3e9086);}}; \ No newline at end of file +var _0xb332=['emit','register','./chatQueue.events','remove','update'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xb332,0xd9));var _0x2b33=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0xb332[_0x5b5eb4];return _0x42af53;};'use strict';var ChatQueueEvents=require(_0x2b33('0x0'));var events=['save',_0x2b33('0x1'),_0x2b33('0x2')];function createListener(_0x5ee720,_0xf8c6a7){return function(_0x548a70){_0xf8c6a7[_0x2b33('0x3')](_0x5ee720,_0x548a70);};}function removeListener(_0x4c6634,_0x34b111){return function(){ChatQueueEvents['removeListener'](_0x4c6634,_0x34b111);};}exports[_0x2b33('0x4')]=function(_0x22d66){for(var _0x478214=0x0,_0x461d44=events['length'];_0x478214<_0x461d44;_0x478214++){var _0x5ccf2d=events[_0x478214];var _0x4302b7=createListener('chatQueue:'+_0x5ccf2d,_0x22d66);ChatQueueEvents['on'](_0x5ccf2d,_0x4302b7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 6ce4f00..4231d43 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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x48ae10,_0x140e3c){var _0x66cd50=function(_0x253b59){while(--_0x253b59){_0x48ae10['push'](_0x48ae10['shift']());}};_0x66cd50(++_0x140e3c);}(_0x7217,0x19e));var _0x7721=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x7217[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x4b580c,_0x381e1b){var _0x4e3826=function(_0x54954a){while(--_0x54954a){_0x4b580c['push'](_0x4b580c['shift']());}};_0x4e3826(++_0x381e1b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 50d41b9..91ee6f4 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 _0x8457=['STRING','DATE','moment','sequelize','exports'];(function(_0x3ccdeb,_0x44306d){var _0x1552e4=function(_0x18f396){while(--_0x18f396){_0x3ccdeb['push'](_0x3ccdeb['shift']());}};_0x1552e4(++_0x44306d);}(_0x8457,0x142));var _0x7845=function(_0x5c313d,_0x45bdf7){_0x5c313d=_0x5c313d-0x0;var _0x317ecf=_0x8457[_0x5c313d];return _0x317ecf;};'use strict';var moment=require(_0x7845('0x0'));var Sequelize=require(_0x7845('0x1'));module[_0x7845('0x2')]={'uniqueid':{'type':Sequelize[_0x7845('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7845('0x3')]},'joinAt':{'type':Sequelize[_0x7845('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7845('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7845('0x3')]}}; \ No newline at end of file +var _0xf032=['DATE','moment','exports','STRING'];(function(_0x5828d0,_0x2c3e93){var _0x239b02=function(_0x702fe4){while(--_0x702fe4){_0x5828d0['push'](_0x5828d0['shift']());}};_0x239b02(++_0x2c3e93);}(_0xf032,0x131));var _0x2f03=function(_0x28ad0d,_0x275a74){_0x28ad0d=_0x28ad0d-0x0;var _0x471931=_0xf032[_0x28ad0d];return _0x471931;};'use strict';var moment=require(_0x2f03('0x0'));var Sequelize=require('sequelize');module[_0x2f03('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2f03('0x2')]},'joinAt':{'type':Sequelize[_0x2f03('0x3')]},'leaveAt':{'type':Sequelize[_0x2f03('0x3')]},'acceptAt':{'type':Sequelize[_0x2f03('0x3')]},'exitAt':{'type':Sequelize[_0x2f03('0x3')]},'reason':{'type':Sequelize[_0x2f03('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 7fe0067..99b5b17 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 _0xa647=['../../config/license/util','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatQueueReport','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x141da6,_0x4d933d){var _0x1edf5a=function(_0x462593){while(--_0x462593){_0x141da6['push'](_0x141da6['shift']());}};_0x1edf5a(++_0x4d933d);}(_0xa647,0x81));var _0x7a64=function(_0x2939f6,_0x6dc867){_0x2939f6=_0x2939f6-0x0;var _0x58330c=_0xa647[_0x2939f6];return _0x58330c;};'use strict';var emlformat=require(_0x7a64('0x0'));var rimraf=require(_0x7a64('0x1'));var zipdir=require(_0x7a64('0x2'));var jsonpatch=require(_0x7a64('0x3'));var rp=require(_0x7a64('0x4'));var moment=require(_0x7a64('0x5'));var BPromise=require(_0x7a64('0x6'));var Mustache=require(_0x7a64('0x7'));var util=require(_0x7a64('0x8'));var path=require(_0x7a64('0x9'));var sox=require(_0x7a64('0xa'));var csv=require(_0x7a64('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a64('0xc'));var _=require(_0x7a64('0xd'));var squel=require('squel');var crypto=require(_0x7a64('0xe'));var jsforce=require(_0x7a64('0xf'));var deskjs=require(_0x7a64('0x10'));var toCsv=require(_0x7a64('0xb'));var querystring=require(_0x7a64('0x11'));var Papa=require(_0x7a64('0x12'));var Redis=require(_0x7a64('0x13'));var authService=require(_0x7a64('0x14'));var qs=require(_0x7a64('0x15'));var as=require(_0x7a64('0x16'));var hardwareService=require(_0x7a64('0x17'));var logger=require(_0x7a64('0x18'))(_0x7a64('0x19'));var utils=require('../../config/utils');var config=require(_0x7a64('0x1a'));var licenseUtil=require(_0x7a64('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d549,_0x5923c){_0x5923c=_0x5923c||0xcc;return function(_0x30a408){if(_0x30a408){return _0x10d549['sendStatus'](_0x5923c);}return _0x10d549[_0x7a64('0x1c')](_0x5923c)[_0x7a64('0x1d')]();};}function respondWithResult(_0x38e79b,_0x293021){_0x293021=_0x293021||0xc8;return function(_0x24f0e3){if(_0x24f0e3){return _0x38e79b[_0x7a64('0x1c')](_0x293021)[_0x7a64('0x1e')](_0x24f0e3);}};}function respondWithFilteredResult(_0x4829f8,_0x136263){return function(_0x5ae1c3){if(_0x5ae1c3){var _0x47a13d=typeof _0x136263[_0x7a64('0x1f')]===_0x7a64('0x20')&&typeof _0x136263[_0x7a64('0x21')]==='undefined';var _0x126eef=_0x5ae1c3['count'];var _0x30c214=_0x47a13d?0x0:_0x136263['offset'];var _0x41e444=_0x47a13d?_0x5ae1c3['count']:_0x136263[_0x7a64('0x1f')]+_0x136263[_0x7a64('0x21')];var _0x5c196a;if(_0x41e444>=_0x126eef){_0x41e444=_0x126eef;_0x5c196a=0xc8;}else{_0x5c196a=0xce;}_0x4829f8['status'](_0x5c196a);return _0x4829f8['set'](_0x7a64('0x22'),_0x30c214+'-'+_0x41e444+'/'+_0x126eef)[_0x7a64('0x1e')](_0x5ae1c3);}return null;};}function patchUpdates(_0x4f56ab){return function(_0x57fa06){try{jsonpatch[_0x7a64('0x23')](_0x57fa06,_0x4f56ab,!![]);}catch(_0x5751b3){return BPromise[_0x7a64('0x24')](_0x5751b3);}return _0x57fa06[_0x7a64('0x25')]();};}function saveUpdates(_0x435abe,_0x2e78af){return function(_0x5dbac4){if(_0x5dbac4){return _0x5dbac4[_0x7a64('0x26')](_0x435abe)[_0x7a64('0x27')](function(_0x5e34d5){return _0x5e34d5;});}return null;};}function removeEntity(_0x2caaa4,_0xdfce54){return function(_0x61efd8){if(_0x61efd8){return _0x61efd8[_0x7a64('0x28')]()['then'](function(){_0x2caaa4['status'](0xcc)[_0x7a64('0x1d')]();});}};}function handleEntityNotFound(_0x40af63,_0x593144){return function(_0x38acec){if(!_0x38acec){_0x40af63['sendStatus'](0x194);}return _0x38acec;};}function handleError(_0x329f34,_0x3cc6a7){_0x3cc6a7=_0x3cc6a7||0x1f4;return function(_0x177132){logger[_0x7a64('0x29')](_0x177132[_0x7a64('0x2a')]);if(_0x177132[_0x7a64('0x2b')]){delete _0x177132[_0x7a64('0x2b')];}_0x329f34[_0x7a64('0x1c')](_0x3cc6a7)[_0x7a64('0x2c')](_0x177132);};}exports[_0x7a64('0x2d')]=function(_0x317183,_0x4e4136){var _0x1ce700={},_0x2dc737={},_0x358916={'count':0x0,'rows':[]};var _0x35a913=_['map'](db[_0x7a64('0x2e')]['rawAttributes'],function(_0x421092){return{'name':_0x421092['fieldName'],'type':_0x421092[_0x7a64('0x2f')]['key']};});_0x2dc737['model']=_[_0x7a64('0x30')](_0x35a913,_0x7a64('0x2b'));_0x2dc737[_0x7a64('0x31')]=_[_0x7a64('0x32')](_0x317183['query']);_0x2dc737[_0x7a64('0x33')]=_[_0x7a64('0x34')](_0x2dc737[_0x7a64('0x35')],_0x2dc737[_0x7a64('0x31')]);_0x1ce700['attributes']=_[_0x7a64('0x34')](_0x2dc737[_0x7a64('0x35')],qs['fields'](_0x317183['query'][_0x7a64('0x36')]));_0x1ce700[_0x7a64('0x37')]=_0x1ce700[_0x7a64('0x37')][_0x7a64('0x38')]?_0x1ce700[_0x7a64('0x37')]:_0x2dc737['model'];if(!_0x317183[_0x7a64('0x31')][_0x7a64('0x39')](_0x7a64('0x3a'))){_0x1ce700[_0x7a64('0x21')]=qs[_0x7a64('0x21')](_0x317183['query'][_0x7a64('0x21')]);_0x1ce700[_0x7a64('0x1f')]=qs[_0x7a64('0x1f')](_0x317183[_0x7a64('0x31')]['offset']);}_0x1ce700[_0x7a64('0x3b')]=qs[_0x7a64('0x3c')](_0x317183[_0x7a64('0x31')]['sort']);_0x1ce700[_0x7a64('0x3d')]=qs[_0x7a64('0x33')](_[_0x7a64('0x3e')](_0x317183[_0x7a64('0x31')],_0x2dc737[_0x7a64('0x33')]),_0x35a913);if(_0x317183['query'][_0x7a64('0x3f')]){_0x1ce700[_0x7a64('0x3d')]=_[_0x7a64('0x40')](_0x1ce700[_0x7a64('0x3d')],{'$or':_[_0x7a64('0x30')](_0x35a913,function(_0x5a1692){if(_0x5a1692[_0x7a64('0x2f')]!=='VIRTUAL'){var _0x255061={};_0x255061[_0x5a1692[_0x7a64('0x2b')]]={'$like':'%'+_0x317183[_0x7a64('0x31')][_0x7a64('0x3f')]+'%'};return _0x255061;}})});}_0x1ce700=_[_0x7a64('0x40')]({},_0x1ce700,_0x317183[_0x7a64('0x41')]);var _0x137b4d={'where':_0x1ce700[_0x7a64('0x3d')]};return db[_0x7a64('0x2e')]['count'](_0x137b4d)[_0x7a64('0x27')](function(_0xf7898a){_0x358916[_0x7a64('0x42')]=_0xf7898a;if(_0x317183[_0x7a64('0x31')][_0x7a64('0x43')]){_0x1ce700[_0x7a64('0x44')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x1ce700);})[_0x7a64('0x27')](function(_0x77b1e1){_0x358916[_0x7a64('0x45')]=_0x77b1e1;return _0x358916;})[_0x7a64('0x27')](respondWithFilteredResult(_0x4e4136,_0x1ce700))[_0x7a64('0x46')](handleError(_0x4e4136,null));};exports[_0x7a64('0x47')]=function(_0x1519a6,_0x306827){var _0x3f0766={'raw':!![],'where':{'id':_0x1519a6[_0x7a64('0x48')]['id']}},_0x5426f1={};_0x5426f1[_0x7a64('0x35')]=_[_0x7a64('0x32')](db[_0x7a64('0x2e')][_0x7a64('0x49')]);_0x5426f1[_0x7a64('0x31')]=_[_0x7a64('0x32')](_0x1519a6[_0x7a64('0x31')]);_0x5426f1['filters']=_[_0x7a64('0x34')](_0x5426f1[_0x7a64('0x35')],_0x5426f1[_0x7a64('0x31')]);_0x3f0766[_0x7a64('0x37')]=_['intersection'](_0x5426f1[_0x7a64('0x35')],qs[_0x7a64('0x36')](_0x1519a6[_0x7a64('0x31')][_0x7a64('0x36')]));_0x3f0766[_0x7a64('0x37')]=_0x3f0766[_0x7a64('0x37')][_0x7a64('0x38')]?_0x3f0766[_0x7a64('0x37')]:_0x5426f1[_0x7a64('0x35')];if(_0x1519a6['query'][_0x7a64('0x43')]){_0x3f0766[_0x7a64('0x44')]=[{'all':!![]}];}_0x3f0766=_[_0x7a64('0x40')]({},_0x3f0766,_0x1519a6[_0x7a64('0x41')]);return db[_0x7a64('0x2e')]['find'](_0x3f0766)[_0x7a64('0x27')](handleEntityNotFound(_0x306827,null))[_0x7a64('0x27')](respondWithResult(_0x306827,null))[_0x7a64('0x46')](handleError(_0x306827,null));};exports[_0x7a64('0x4a')]=function(_0x7d9d89,_0x2b3148){return db[_0x7a64('0x2e')]['create'](_0x7d9d89['body'],{})[_0x7a64('0x27')](respondWithResult(_0x2b3148,0xc9))['catch'](handleError(_0x2b3148,null));};exports[_0x7a64('0x26')]=function(_0x4eaa4f,_0x24b932){if(_0x4eaa4f['body']['id']){delete _0x4eaa4f[_0x7a64('0x4b')]['id'];}return db[_0x7a64('0x2e')][_0x7a64('0x4c')]({'where':{'id':_0x4eaa4f[_0x7a64('0x48')]['id']}})[_0x7a64('0x27')](handleEntityNotFound(_0x24b932,null))[_0x7a64('0x27')](saveUpdates(_0x4eaa4f['body'],null))[_0x7a64('0x27')](respondWithResult(_0x24b932,null))[_0x7a64('0x46')](handleError(_0x24b932,null));};exports[_0x7a64('0x28')]=function(_0x2dbd81,_0xfa8bfe){return db[_0x7a64('0x2e')][_0x7a64('0x4c')]({'where':{'id':_0x2dbd81[_0x7a64('0x48')]['id']}})['then'](handleEntityNotFound(_0xfa8bfe,null))[_0x7a64('0x27')](removeEntity(_0xfa8bfe,null))['catch'](handleError(_0xfa8bfe,null));};exports['describe']=function(_0x53d828,_0x5f4cd1){return db[_0x7a64('0x2e')][_0x7a64('0x4d')]()['then'](respondWithResult(_0x5f4cd1,null))[_0x7a64('0x46')](handleError(_0x5f4cd1,null));}; \ No newline at end of file +var _0xac41=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','merge','options','ChatQueueReport','include','findAll','catch','show','keys','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x6674b3,_0x14cc1a){var _0x4fad2d=function(_0x498a19){while(--_0x498a19){_0x6674b3['push'](_0x6674b3['shift']());}};_0x4fad2d(++_0x14cc1a);}(_0xac41,0xdd));var _0x1ac4=function(_0x1a74d8,_0x108519){_0x1a74d8=_0x1a74d8-0x0;var _0x54bcdc=_0xac41[_0x1a74d8];return _0x54bcdc;};'use strict';var emlformat=require(_0x1ac4('0x0'));var rimraf=require(_0x1ac4('0x1'));var zipdir=require(_0x1ac4('0x2'));var jsonpatch=require(_0x1ac4('0x3'));var rp=require(_0x1ac4('0x4'));var moment=require(_0x1ac4('0x5'));var BPromise=require(_0x1ac4('0x6'));var Mustache=require(_0x1ac4('0x7'));var util=require('util');var path=require(_0x1ac4('0x8'));var sox=require(_0x1ac4('0x9'));var csv=require(_0x1ac4('0xa'));var ejs=require(_0x1ac4('0xb'));var fs=require('fs');var fs_extra=require(_0x1ac4('0xc'));var _=require(_0x1ac4('0xd'));var squel=require(_0x1ac4('0xe'));var crypto=require(_0x1ac4('0xf'));var jsforce=require(_0x1ac4('0x10'));var deskjs=require(_0x1ac4('0x11'));var toCsv=require(_0x1ac4('0xa'));var querystring=require(_0x1ac4('0x12'));var Papa=require(_0x1ac4('0x13'));var Redis=require(_0x1ac4('0x14'));var authService=require(_0x1ac4('0x15'));var qs=require(_0x1ac4('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ac4('0x17'));var logger=require('../../config/logger')(_0x1ac4('0x18'));var utils=require(_0x1ac4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac4('0x1a'));var db=require(_0x1ac4('0x1b'))['db'];function respondWithStatusCode(_0x4bc8d8,_0x2ac588){_0x2ac588=_0x2ac588||0xcc;return function(_0x4e54c2){if(_0x4e54c2){return _0x4bc8d8['sendStatus'](_0x2ac588);}return _0x4bc8d8['status'](_0x2ac588)[_0x1ac4('0x1c')]();};}function respondWithResult(_0x288b4e,_0x3841fa){_0x3841fa=_0x3841fa||0xc8;return function(_0xad7a88){if(_0xad7a88){return _0x288b4e[_0x1ac4('0x1d')](_0x3841fa)[_0x1ac4('0x1e')](_0xad7a88);}};}function respondWithFilteredResult(_0x5038e3,_0x531769){return function(_0x160b86){if(_0x160b86){var _0x427684=typeof _0x531769[_0x1ac4('0x1f')]==='undefined'&&typeof _0x531769[_0x1ac4('0x20')]===_0x1ac4('0x21');var _0x3bdeb7=_0x160b86[_0x1ac4('0x22')];var _0x1e7669=_0x427684?0x0:_0x531769[_0x1ac4('0x1f')];var _0x1797fc=_0x427684?_0x160b86['count']:_0x531769['offset']+_0x531769[_0x1ac4('0x20')];var _0x1dc9b3;if(_0x1797fc>=_0x3bdeb7){_0x1797fc=_0x3bdeb7;_0x1dc9b3=0xc8;}else{_0x1dc9b3=0xce;}_0x5038e3[_0x1ac4('0x1d')](_0x1dc9b3);return _0x5038e3[_0x1ac4('0x23')](_0x1ac4('0x24'),_0x1e7669+'-'+_0x1797fc+'/'+_0x3bdeb7)['json'](_0x160b86);}return null;};}function patchUpdates(_0x4b31c8){return function(_0x3c293d){try{jsonpatch[_0x1ac4('0x25')](_0x3c293d,_0x4b31c8,!![]);}catch(_0x479110){return BPromise[_0x1ac4('0x26')](_0x479110);}return _0x3c293d[_0x1ac4('0x27')]();};}function saveUpdates(_0x28a2d7,_0x2643bc){return function(_0x48475e){if(_0x48475e){return _0x48475e[_0x1ac4('0x28')](_0x28a2d7)[_0x1ac4('0x29')](function(_0x51901a){return _0x51901a;});}return null;};}function removeEntity(_0x1b5490,_0x5e58b4){return function(_0xfe5397){if(_0xfe5397){return _0xfe5397[_0x1ac4('0x2a')]()[_0x1ac4('0x29')](function(){_0x1b5490[_0x1ac4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ddf22,_0x54284c){return function(_0x289579){if(!_0x289579){_0x1ddf22[_0x1ac4('0x2b')](0x194);}return _0x289579;};}function handleError(_0x10a42c,_0x3c0bbb){_0x3c0bbb=_0x3c0bbb||0x1f4;return function(_0x385885){logger[_0x1ac4('0x2c')](_0x385885[_0x1ac4('0x2d')]);if(_0x385885[_0x1ac4('0x2e')]){delete _0x385885[_0x1ac4('0x2e')];}_0x10a42c[_0x1ac4('0x1d')](_0x3c0bbb)[_0x1ac4('0x2f')](_0x385885);};}exports[_0x1ac4('0x30')]=function(_0x4541bb,_0x14de4e){var _0x22e219={},_0x1fa40a={},_0x4510e2={'count':0x0,'rows':[]};var _0x58e76d=_['map'](db['ChatQueueReport'][_0x1ac4('0x31')],function(_0x456655){return{'name':_0x456655['fieldName'],'type':_0x456655[_0x1ac4('0x32')][_0x1ac4('0x33')]};});_0x1fa40a[_0x1ac4('0x34')]=_['map'](_0x58e76d,_0x1ac4('0x2e'));_0x1fa40a['query']=_['keys'](_0x4541bb[_0x1ac4('0x35')]);_0x1fa40a[_0x1ac4('0x36')]=_[_0x1ac4('0x37')](_0x1fa40a['model'],_0x1fa40a[_0x1ac4('0x35')]);_0x22e219[_0x1ac4('0x38')]=_[_0x1ac4('0x37')](_0x1fa40a[_0x1ac4('0x34')],qs[_0x1ac4('0x39')](_0x4541bb['query'][_0x1ac4('0x39')]));_0x22e219[_0x1ac4('0x38')]=_0x22e219[_0x1ac4('0x38')][_0x1ac4('0x3a')]?_0x22e219[_0x1ac4('0x38')]:_0x1fa40a[_0x1ac4('0x34')];if(!_0x4541bb[_0x1ac4('0x35')]['hasOwnProperty'](_0x1ac4('0x3b'))){_0x22e219[_0x1ac4('0x20')]=qs['limit'](_0x4541bb[_0x1ac4('0x35')][_0x1ac4('0x20')]);_0x22e219['offset']=qs[_0x1ac4('0x1f')](_0x4541bb[_0x1ac4('0x35')][_0x1ac4('0x1f')]);}_0x22e219[_0x1ac4('0x3c')]=qs[_0x1ac4('0x3d')](_0x4541bb[_0x1ac4('0x35')][_0x1ac4('0x3d')]);_0x22e219['where']=qs[_0x1ac4('0x36')](_[_0x1ac4('0x3e')](_0x4541bb[_0x1ac4('0x35')],_0x1fa40a[_0x1ac4('0x36')]),_0x58e76d);if(_0x4541bb[_0x1ac4('0x35')][_0x1ac4('0x3f')]){_0x22e219[_0x1ac4('0x40')]=_['merge'](_0x22e219['where'],{'$or':_[_0x1ac4('0x41')](_0x58e76d,function(_0x3277a2){if(_0x3277a2['type']!=='VIRTUAL'){var _0x593635={};_0x593635[_0x3277a2[_0x1ac4('0x2e')]]={'$like':'%'+_0x4541bb[_0x1ac4('0x35')][_0x1ac4('0x3f')]+'%'};return _0x593635;}})});}_0x22e219=_[_0x1ac4('0x42')]({},_0x22e219,_0x4541bb[_0x1ac4('0x43')]);var _0x41af65={'where':_0x22e219[_0x1ac4('0x40')]};return db[_0x1ac4('0x44')][_0x1ac4('0x22')](_0x41af65)[_0x1ac4('0x29')](function(_0x21ccb9){_0x4510e2[_0x1ac4('0x22')]=_0x21ccb9;if(_0x4541bb[_0x1ac4('0x35')]['includeAll']){_0x22e219[_0x1ac4('0x45')]=[{'all':!![]}];}return db[_0x1ac4('0x44')][_0x1ac4('0x46')](_0x22e219);})[_0x1ac4('0x29')](function(_0xb8aa0f){_0x4510e2['rows']=_0xb8aa0f;return _0x4510e2;})['then'](respondWithFilteredResult(_0x14de4e,_0x22e219))[_0x1ac4('0x47')](handleError(_0x14de4e,null));};exports[_0x1ac4('0x48')]=function(_0x5c5f79,_0x21cec8){var _0x4d443a={'raw':!![],'where':{'id':_0x5c5f79['params']['id']}},_0x2854ca={};_0x2854ca[_0x1ac4('0x34')]=_[_0x1ac4('0x49')](db[_0x1ac4('0x44')][_0x1ac4('0x31')]);_0x2854ca[_0x1ac4('0x35')]=_[_0x1ac4('0x49')](_0x5c5f79[_0x1ac4('0x35')]);_0x2854ca[_0x1ac4('0x36')]=_[_0x1ac4('0x37')](_0x2854ca['model'],_0x2854ca[_0x1ac4('0x35')]);_0x4d443a['attributes']=_[_0x1ac4('0x37')](_0x2854ca['model'],qs[_0x1ac4('0x39')](_0x5c5f79[_0x1ac4('0x35')][_0x1ac4('0x39')]));_0x4d443a[_0x1ac4('0x38')]=_0x4d443a[_0x1ac4('0x38')]['length']?_0x4d443a['attributes']:_0x2854ca[_0x1ac4('0x34')];if(_0x5c5f79['query'][_0x1ac4('0x4a')]){_0x4d443a[_0x1ac4('0x45')]=[{'all':!![]}];}_0x4d443a=_[_0x1ac4('0x42')]({},_0x4d443a,_0x5c5f79['options']);return db[_0x1ac4('0x44')][_0x1ac4('0x4b')](_0x4d443a)[_0x1ac4('0x29')](handleEntityNotFound(_0x21cec8,null))[_0x1ac4('0x29')](respondWithResult(_0x21cec8,null))[_0x1ac4('0x47')](handleError(_0x21cec8,null));};exports[_0x1ac4('0x4c')]=function(_0x244569,_0x4af615){return db[_0x1ac4('0x44')]['create'](_0x244569[_0x1ac4('0x4d')],{})[_0x1ac4('0x29')](respondWithResult(_0x4af615,0xc9))[_0x1ac4('0x47')](handleError(_0x4af615,null));};exports[_0x1ac4('0x28')]=function(_0x2de44a,_0x4e132f){if(_0x2de44a[_0x1ac4('0x4d')]['id']){delete _0x2de44a[_0x1ac4('0x4d')]['id'];}return db[_0x1ac4('0x44')][_0x1ac4('0x4b')]({'where':{'id':_0x2de44a['params']['id']}})['then'](handleEntityNotFound(_0x4e132f,null))[_0x1ac4('0x29')](saveUpdates(_0x2de44a[_0x1ac4('0x4d')],null))[_0x1ac4('0x29')](respondWithResult(_0x4e132f,null))[_0x1ac4('0x47')](handleError(_0x4e132f,null));};exports['destroy']=function(_0x4678ab,_0x436fca){return db[_0x1ac4('0x44')]['find']({'where':{'id':_0x4678ab[_0x1ac4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x436fca,null))[_0x1ac4('0x29')](removeEntity(_0x436fca,null))[_0x1ac4('0x47')](handleError(_0x436fca,null));};exports[_0x1ac4('0x4f')]=function(_0x573942,_0x3ae162){return db['ChatQueueReport']['describe']()[_0x1ac4('0x29')](respondWithResult(_0x3ae162,null))['catch'](handleError(_0x3ae162,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 73fc330..2f8cb94 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1488d4,_0x1286ec){var _0x5ce26d=function(_0x1cab99){while(--_0x1cab99){_0x1488d4['push'](_0x1488d4['shift']());}};_0x5ce26d(++_0x1286ec);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x2f7a29,_0x55de79){var _0x47b74b=function(_0x53d890){while(--_0x53d890){_0x2f7a29['push'](_0x2f7a29['shift']());}};_0x47b74b(++_0x55de79);}(_0xe706,0xa3));var _0x6e70=function(_0x37bef1,_0xecf330){_0x37bef1=_0x37bef1-0x0;var _0x342427=_0xe706[_0x37bef1];return _0x342427;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 75dc592..1fbd801 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 _0x51c5=['limit','UpdateChatQueueReport','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','update','where'];(function(_0x4e4315,_0x5d7615){var _0x31f97a=function(_0x330858){while(--_0x330858){_0x4e4315['push'](_0x4e4315['shift']());}};_0x31f97a(++_0x5d7615);}(_0x51c5,0xc8));var _0x551c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x51c5[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x551c('0x0'));var BPromise=require(_0x551c('0x1'));var rs=require(_0x551c('0x2'));var fs=require('fs');var Redis=require(_0x551c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x551c('0x4'));var logger=require(_0x551c('0x5'))(_0x551c('0x6'));var config=require(_0x551c('0x7'));var jayson=require(_0x551c('0x8'));var client=jayson[_0x551c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c5309,_0x3449a0,_0x24611b){return new BPromise(function(_0x39e753,_0x4758ac){return client[_0x551c('0xa')](_0x1c5309,_0x24611b)[_0x551c('0xb')](function(_0x1b83c4){logger[_0x551c('0xc')](_0x551c('0xd'),_0x3449a0,'request\x20sent');logger['debug'](_0x551c('0xe'),_0x3449a0,'request\x20sent',JSON[_0x551c('0xf')](_0x1b83c4));if(_0x1b83c4[_0x551c('0x10')]){if(_0x1b83c4['error'][_0x551c('0x11')]===0x1f4){logger['error'](_0x551c('0xd'),_0x3449a0,_0x1b83c4[_0x551c('0x10')][_0x551c('0x12')]);return _0x4758ac(_0x1b83c4[_0x551c('0x10')][_0x551c('0x12')]);}logger[_0x551c('0x10')](_0x551c('0xd'),_0x3449a0,_0x1b83c4['error'][_0x551c('0x12')]);return _0x39e753(_0x1b83c4[_0x551c('0x10')]['message']);}else{logger['info'](_0x551c('0xd'),_0x3449a0,_0x551c('0x13'));_0x39e753(_0x1b83c4[_0x551c('0x14')]['message']);}})[_0x551c('0x15')](function(_0x2f9710){logger[_0x551c('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x3449a0,_0x2f9710);_0x4758ac(_0x2f9710);});});}exports[_0x551c('0x16')]=function(_0x29d639){var _0x58267b=this;return new Promise(function(_0x34e284,_0x4d7669){return db[_0x551c('0x17')][_0x551c('0x18')](_0x29d639[_0x551c('0x19')],{'raw':_0x29d639['options']?_0x29d639[_0x551c('0x1a')][_0x551c('0x1b')]===undefined?!![]:![]:!![]})[_0x551c('0xb')](function(_0x1fff90){logger['info'](_0x551c('0x16'),_0x29d639);logger[_0x551c('0x1c')](_0x551c('0x16'),_0x29d639,JSON['stringify'](_0x1fff90));_0x34e284(_0x1fff90);})[_0x551c('0x15')](function(_0x10e611){logger[_0x551c('0x10')](_0x551c('0x16'),_0x10e611[_0x551c('0x12')],_0x29d639);_0x4d7669(_0x58267b['error'](0x1f4,_0x10e611[_0x551c('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x24b561){var _0x3d8c54=this;return new Promise(function(_0x488ac2,_0x5c1a8e){return db[_0x551c('0x17')][_0x551c('0x1d')](_0x24b561[_0x551c('0x19')],{'raw':_0x24b561[_0x551c('0x1a')]?_0x24b561[_0x551c('0x1a')][_0x551c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24b561[_0x551c('0x1a')]?_0x24b561[_0x551c('0x1a')][_0x551c('0x1e')]||null:null,'attributes':_0x24b561[_0x551c('0x1a')]?_0x24b561['options']['attributes']||null:null,'limit':_0x24b561[_0x551c('0x1a')]?_0x24b561[_0x551c('0x1a')][_0x551c('0x1f')]||null:null})[_0x551c('0xb')](function(_0x37b5fa){logger[_0x551c('0xc')](_0x551c('0x20'),_0x24b561);logger[_0x551c('0x1c')](_0x551c('0x20'),_0x24b561,JSON[_0x551c('0xf')](_0x37b5fa));_0x488ac2(_0x37b5fa);})[_0x551c('0x15')](function(_0x4dbe97){logger[_0x551c('0x10')](_0x551c('0x20'),_0x4dbe97[_0x551c('0x12')],_0x24b561);_0x5c1a8e(_0x3d8c54[_0x551c('0x10')](0x1f4,_0x4dbe97[_0x551c('0x12')]));});});}; \ No newline at end of file +var _0x01c6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','options','raw','stringify','UpdateChatQueueReport','update','body','where','attributes','limit','lodash','util','moment','randomstring'];(function(_0x3e2f0a,_0x19ec9c){var _0x342fab=function(_0x5e9283){while(--_0x5e9283){_0x3e2f0a['push'](_0x3e2f0a['shift']());}};_0x342fab(++_0x19ec9c);}(_0x01c6,0x1a9));var _0x601c=function(_0x37e342,_0x160c8f){_0x37e342=_0x37e342-0x0;var _0x1768f9=_0x01c6[_0x37e342];return _0x1768f9;};'use strict';var _=require(_0x601c('0x0'));var util=require(_0x601c('0x1'));var moment=require(_0x601c('0x2'));var BPromise=require('bluebird');var rs=require(_0x601c('0x3'));var fs=require('fs');var Redis=require(_0x601c('0x4'));var db=require(_0x601c('0x5'))['db'];var utils=require(_0x601c('0x6'));var logger=require(_0x601c('0x7'))(_0x601c('0x8'));var config=require(_0x601c('0x9'));var jayson=require(_0x601c('0xa'));var client=jayson['client'][_0x601c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x222baf,_0x5f58fc,_0xbf9106){return new BPromise(function(_0x4a1a0b,_0x5f0d8c){return client[_0x601c('0xc')](_0x222baf,_0xbf9106)[_0x601c('0xd')](function(_0x59e596){logger[_0x601c('0xe')](_0x601c('0xf'),_0x5f58fc,'request\x20sent');logger['debug'](_0x601c('0x10'),_0x5f58fc,_0x601c('0x11'),JSON['stringify'](_0x59e596));if(_0x59e596[_0x601c('0x12')]){if(_0x59e596['error']['code']===0x1f4){logger[_0x601c('0x12')](_0x601c('0xf'),_0x5f58fc,_0x59e596[_0x601c('0x12')]['message']);return _0x5f0d8c(_0x59e596[_0x601c('0x12')][_0x601c('0x13')]);}logger[_0x601c('0x12')](_0x601c('0xf'),_0x5f58fc,_0x59e596[_0x601c('0x12')][_0x601c('0x13')]);return _0x4a1a0b(_0x59e596[_0x601c('0x12')]['message']);}else{logger[_0x601c('0xe')](_0x601c('0xf'),_0x5f58fc,_0x601c('0x11'));_0x4a1a0b(_0x59e596[_0x601c('0x14')][_0x601c('0x13')]);}})[_0x601c('0x15')](function(_0x4a4e18){logger[_0x601c('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x5f58fc,_0x4a4e18);_0x5f0d8c(_0x4a4e18);});});}exports[_0x601c('0x16')]=function(_0xdf1b1d){var _0x44ae3d=this;return new Promise(function(_0x4233f7,_0x2bb781){return db[_0x601c('0x17')]['create'](_0xdf1b1d['body'],{'raw':_0xdf1b1d[_0x601c('0x18')]?_0xdf1b1d[_0x601c('0x18')][_0x601c('0x19')]===undefined?!![]:![]:!![]})[_0x601c('0xd')](function(_0xf4feb1){logger[_0x601c('0xe')]('CreateChatQueueReport',_0xdf1b1d);logger['debug'](_0x601c('0x16'),_0xdf1b1d,JSON[_0x601c('0x1a')](_0xf4feb1));_0x4233f7(_0xf4feb1);})[_0x601c('0x15')](function(_0x5767a0){logger[_0x601c('0x12')](_0x601c('0x16'),_0x5767a0[_0x601c('0x13')],_0xdf1b1d);_0x2bb781(_0x44ae3d[_0x601c('0x12')](0x1f4,_0x5767a0[_0x601c('0x13')]));});});};exports[_0x601c('0x1b')]=function(_0x3bf4b7){var _0x43b871=this;return new Promise(function(_0x5281fd,_0x377d1e){return db[_0x601c('0x17')][_0x601c('0x1c')](_0x3bf4b7[_0x601c('0x1d')],{'raw':_0x3bf4b7[_0x601c('0x18')]?_0x3bf4b7[_0x601c('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bf4b7[_0x601c('0x18')]?_0x3bf4b7[_0x601c('0x18')][_0x601c('0x1e')]||null:null,'attributes':_0x3bf4b7['options']?_0x3bf4b7['options'][_0x601c('0x1f')]||null:null,'limit':_0x3bf4b7[_0x601c('0x18')]?_0x3bf4b7[_0x601c('0x18')][_0x601c('0x20')]||null:null})[_0x601c('0xd')](function(_0x535a12){logger[_0x601c('0xe')](_0x601c('0x1b'),_0x3bf4b7);logger['debug'](_0x601c('0x1b'),_0x3bf4b7,JSON[_0x601c('0x1a')](_0x535a12));_0x5281fd(_0x535a12);})[_0x601c('0x15')](function(_0x2f97d7){logger[_0x601c('0x12')](_0x601c('0x1b'),_0x2f97d7[_0x601c('0x13')],_0x3bf4b7);_0x377d1e(_0x43b871[_0x601c('0x12')](0x1f4,_0x2f97d7['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d4e3245..be4881a 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 _0x22a0=['../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x141da1,_0x3905c7){var _0x5abdbd=function(_0xc78a12){while(--_0xc78a12){_0x141da1['push'](_0x141da1['shift']());}};_0x5abdbd(++_0x3905c7);}(_0x22a0,0x80));var _0x022a=function(_0x1eb308,_0x140fa8){_0x1eb308=_0x1eb308-0x0;var _0x26d5c2=_0x22a0[_0x1eb308];return _0x26d5c2;};'use strict';var multer=require(_0x022a('0x0'));var util=require(_0x022a('0x1'));var path=require(_0x022a('0x2'));var timeout=require(_0x022a('0x3'));var express=require('express');var router=express[_0x022a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x022a('0x5'));var interaction=require(_0x022a('0x6'));var config=require('../../config/environment');var controller=require(_0x022a('0x7'));router['get']('/',auth[_0x022a('0x8')](),controller[_0x022a('0x9')]);router[_0x022a('0xa')]('/describe',auth[_0x022a('0x8')](),controller[_0x022a('0xb')]);router['get'](_0x022a('0xc'),auth['isAuthenticated'](),controller[_0x022a('0xd')]);router['post']('/',auth[_0x022a('0x8')](),controller['create']);router[_0x022a('0xe')](_0x022a('0xc'),auth['isAuthenticated'](),controller[_0x022a('0xf')]);router[_0x022a('0x10')](_0x022a('0xc'),auth[_0x022a('0x8')](),controller[_0x022a('0x11')]);module[_0x022a('0x12')]=router; \ No newline at end of file +var _0x14b6=['isAuthenticated','index','/describe','show','put','/:id','update','delete','destroy','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get'];(function(_0xa986f0,_0x51b014){var _0x546b47=function(_0x36c3fc){while(--_0x36c3fc){_0xa986f0['push'](_0xa986f0['shift']());}};_0x546b47(++_0x51b014);}(_0x14b6,0x160));var _0x614b=function(_0x582e05,_0x22af93){_0x582e05=_0x582e05-0x0;var _0x535890=_0x14b6[_0x582e05];return _0x535890;};'use strict';var multer=require('multer');var util=require(_0x614b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x614b('0x1')]();var fs_extra=require(_0x614b('0x2'));var auth=require(_0x614b('0x3'));var interaction=require(_0x614b('0x4'));var config=require(_0x614b('0x5'));var controller=require(_0x614b('0x6'));router[_0x614b('0x7')]('/',auth[_0x614b('0x8')](),controller[_0x614b('0x9')]);router[_0x614b('0x7')](_0x614b('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x614b('0x7')]('/:id',auth[_0x614b('0x8')](),controller[_0x614b('0xb')]);router['post']('/',auth[_0x614b('0x8')](),controller['create']);router[_0x614b('0xc')](_0x614b('0xd'),auth['isAuthenticated'](),controller[_0x614b('0xe')]);router[_0x614b('0xf')](_0x614b('0xd'),auth[_0x614b('0x8')](),controller[_0x614b('0x10')]);module[_0x614b('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 659a77d..be6e311 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0xb43b,0x1b2));var _0xbb43=function(_0x33b476,_0x1d4cd3){_0x33b476=_0x33b476-0x0;var _0x99fa39=_0xb43b[_0x33b476];return _0x99fa39;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x20008a,_0x362490){var _0x5d0f1c=function(_0x122ecf){while(--_0x122ecf){_0x20008a['push'](_0x20008a['shift']());}};_0x5d0f1c(++_0x362490);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 1fe704f..ebd7f62 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 _0x8286=['show','params','rawAttributes','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','Content-Range','reject','then','destroy','end','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0xf7ec9b,_0xefe7a3){var _0x519f33=function(_0x3764d2){while(--_0x3764d2){_0xf7ec9b['push'](_0xf7ec9b['shift']());}};_0x519f33(++_0xefe7a3);}(_0x8286,0x17b));var _0x6828=function(_0xeb6b88,_0x313a36){_0xeb6b88=_0xeb6b88-0x0;var _0x23d2ab=_0x8286[_0xeb6b88];return _0x23d2ab;};'use strict';var emlformat=require(_0x6828('0x0'));var rimraf=require(_0x6828('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6828('0x2'));var rp=require('request-promise');var moment=require(_0x6828('0x3'));var BPromise=require(_0x6828('0x4'));var Mustache=require(_0x6828('0x5'));var util=require(_0x6828('0x6'));var path=require(_0x6828('0x7'));var sox=require(_0x6828('0x8'));var csv=require(_0x6828('0x9'));var ejs=require(_0x6828('0xa'));var fs=require('fs');var fs_extra=require(_0x6828('0xb'));var _=require(_0x6828('0xc'));var squel=require('squel');var crypto=require(_0x6828('0xd'));var jsforce=require(_0x6828('0xe'));var deskjs=require(_0x6828('0xf'));var toCsv=require(_0x6828('0x9'));var querystring=require(_0x6828('0x10'));var Papa=require(_0x6828('0x11'));var Redis=require(_0x6828('0x12'));var authService=require(_0x6828('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6828('0x14'));var logger=require(_0x6828('0x15'))(_0x6828('0x16'));var utils=require('../../config/utils');var config=require(_0x6828('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6828('0x18'))['db'];function respondWithStatusCode(_0x266e5e,_0x1f44e5){_0x1f44e5=_0x1f44e5||0xcc;return function(_0x31e39c){if(_0x31e39c){return _0x266e5e['sendStatus'](_0x1f44e5);}return _0x266e5e[_0x6828('0x19')](_0x1f44e5)['end']();};}function respondWithResult(_0x11979a,_0x541c20){_0x541c20=_0x541c20||0xc8;return function(_0x463c75){if(_0x463c75){return _0x11979a[_0x6828('0x19')](_0x541c20)[_0x6828('0x1a')](_0x463c75);}};}function respondWithFilteredResult(_0x541537,_0x53fb85){return function(_0x520d5b){if(_0x520d5b){var _0x2d5f91=typeof _0x53fb85['offset']===_0x6828('0x1b')&&typeof _0x53fb85[_0x6828('0x1c')]==='undefined';var _0x4d1d8c=_0x520d5b[_0x6828('0x1d')];var _0x492365=_0x2d5f91?0x0:_0x53fb85['offset'];var _0x453ef1=_0x2d5f91?_0x520d5b['count']:_0x53fb85['offset']+_0x53fb85[_0x6828('0x1c')];var _0xdc4f1a;if(_0x453ef1>=_0x4d1d8c){_0x453ef1=_0x4d1d8c;_0xdc4f1a=0xc8;}else{_0xdc4f1a=0xce;}_0x541537['status'](_0xdc4f1a);return _0x541537['set'](_0x6828('0x1e'),_0x492365+'-'+_0x453ef1+'/'+_0x4d1d8c)[_0x6828('0x1a')](_0x520d5b);}return null;};}function patchUpdates(_0x72ff48){return function(_0x4d534e){try{jsonpatch['apply'](_0x4d534e,_0x72ff48,!![]);}catch(_0x2bf16d){return BPromise[_0x6828('0x1f')](_0x2bf16d);}return _0x4d534e['save']();};}function saveUpdates(_0x2cab6e,_0x2dddda){return function(_0x2ffe37){if(_0x2ffe37){return _0x2ffe37['update'](_0x2cab6e)[_0x6828('0x20')](function(_0x47c314){return _0x47c314;});}return null;};}function removeEntity(_0x58dc7b,_0xb4a764){return function(_0x4e197c){if(_0x4e197c){return _0x4e197c[_0x6828('0x21')]()[_0x6828('0x20')](function(){_0x58dc7b['status'](0xcc)[_0x6828('0x22')]();});}};}function handleEntityNotFound(_0x1200e4,_0x14de9b){return function(_0x1a32cc){if(!_0x1a32cc){_0x1200e4['sendStatus'](0x194);}return _0x1a32cc;};}function handleError(_0x515226,_0x66a9b9){_0x66a9b9=_0x66a9b9||0x1f4;return function(_0x28e279){logger[_0x6828('0x23')](_0x28e279[_0x6828('0x24')]);if(_0x28e279[_0x6828('0x25')]){delete _0x28e279[_0x6828('0x25')];}_0x515226['status'](_0x66a9b9)[_0x6828('0x26')](_0x28e279);};}exports[_0x6828('0x27')]=function(_0x4a1d53,_0x59e36a){var _0x920346={},_0xd87f9d={},_0xf60440={'count':0x0,'rows':[]};var _0x526c97=_[_0x6828('0x28')](db[_0x6828('0x29')]['rawAttributes'],function(_0x26eb3b){return{'name':_0x26eb3b[_0x6828('0x2a')],'type':_0x26eb3b[_0x6828('0x2b')][_0x6828('0x2c')]};});_0xd87f9d[_0x6828('0x2d')]=_[_0x6828('0x28')](_0x526c97,_0x6828('0x25'));_0xd87f9d[_0x6828('0x2e')]=_[_0x6828('0x2f')](_0x4a1d53[_0x6828('0x2e')]);_0xd87f9d[_0x6828('0x30')]=_[_0x6828('0x31')](_0xd87f9d[_0x6828('0x2d')],_0xd87f9d[_0x6828('0x2e')]);_0x920346[_0x6828('0x32')]=_[_0x6828('0x31')](_0xd87f9d[_0x6828('0x2d')],qs[_0x6828('0x33')](_0x4a1d53['query'][_0x6828('0x33')]));_0x920346[_0x6828('0x32')]=_0x920346[_0x6828('0x32')][_0x6828('0x34')]?_0x920346[_0x6828('0x32')]:_0xd87f9d[_0x6828('0x2d')];if(!_0x4a1d53[_0x6828('0x2e')]['hasOwnProperty']('nolimit')){_0x920346[_0x6828('0x1c')]=qs[_0x6828('0x1c')](_0x4a1d53['query'][_0x6828('0x1c')]);_0x920346['offset']=qs[_0x6828('0x35')](_0x4a1d53[_0x6828('0x2e')][_0x6828('0x35')]);}_0x920346[_0x6828('0x36')]=qs[_0x6828('0x37')](_0x4a1d53[_0x6828('0x2e')]['sort']);_0x920346[_0x6828('0x38')]=qs[_0x6828('0x30')](_[_0x6828('0x39')](_0x4a1d53[_0x6828('0x2e')],_0xd87f9d[_0x6828('0x30')]),_0x526c97);if(_0x4a1d53['query'][_0x6828('0x3a')]){_0x920346[_0x6828('0x38')]=_[_0x6828('0x3b')](_0x920346[_0x6828('0x38')],{'$or':_[_0x6828('0x28')](_0x526c97,function(_0x13b8d5){if(_0x13b8d5[_0x6828('0x2b')]!=='VIRTUAL'){var _0x16392e={};_0x16392e[_0x13b8d5[_0x6828('0x25')]]={'$like':'%'+_0x4a1d53[_0x6828('0x2e')][_0x6828('0x3a')]+'%'};return _0x16392e;}})});}_0x920346=_['merge']({},_0x920346,_0x4a1d53[_0x6828('0x3c')]);var _0x225d68={'where':_0x920346[_0x6828('0x38')]};return db['ChatTransferReport'][_0x6828('0x1d')](_0x225d68)[_0x6828('0x20')](function(_0x40320f){_0xf60440[_0x6828('0x1d')]=_0x40320f;if(_0x4a1d53[_0x6828('0x2e')][_0x6828('0x3d')]){_0x920346[_0x6828('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x6828('0x3f')](_0x920346);})[_0x6828('0x20')](function(_0xbacc2b){_0xf60440[_0x6828('0x40')]=_0xbacc2b;return _0xf60440;})[_0x6828('0x20')](respondWithFilteredResult(_0x59e36a,_0x920346))['catch'](handleError(_0x59e36a,null));};exports[_0x6828('0x41')]=function(_0x152eed,_0x35df70){var _0xddbf59={'raw':!![],'where':{'id':_0x152eed[_0x6828('0x42')]['id']}},_0x5e5d75={};_0x5e5d75['model']=_[_0x6828('0x2f')](db['ChatTransferReport'][_0x6828('0x43')]);_0x5e5d75[_0x6828('0x2e')]=_['keys'](_0x152eed[_0x6828('0x2e')]);_0x5e5d75[_0x6828('0x30')]=_[_0x6828('0x31')](_0x5e5d75[_0x6828('0x2d')],_0x5e5d75['query']);_0xddbf59['attributes']=_[_0x6828('0x31')](_0x5e5d75[_0x6828('0x2d')],qs[_0x6828('0x33')](_0x152eed[_0x6828('0x2e')][_0x6828('0x33')]));_0xddbf59[_0x6828('0x32')]=_0xddbf59[_0x6828('0x32')]['length']?_0xddbf59[_0x6828('0x32')]:_0x5e5d75['model'];if(_0x152eed[_0x6828('0x2e')][_0x6828('0x3d')]){_0xddbf59[_0x6828('0x3e')]=[{'all':!![]}];}_0xddbf59=_[_0x6828('0x3b')]({},_0xddbf59,_0x152eed[_0x6828('0x3c')]);return db['ChatTransferReport'][_0x6828('0x44')](_0xddbf59)['then'](handleEntityNotFound(_0x35df70,null))[_0x6828('0x20')](respondWithResult(_0x35df70,null))[_0x6828('0x45')](handleError(_0x35df70,null));};exports[_0x6828('0x46')]=function(_0x5dbf75,_0x14ac38){return db[_0x6828('0x29')][_0x6828('0x46')](_0x5dbf75[_0x6828('0x47')],{})[_0x6828('0x20')](respondWithResult(_0x14ac38,0xc9))['catch'](handleError(_0x14ac38,null));};exports[_0x6828('0x48')]=function(_0x33614d,_0x11d0c0){if(_0x33614d[_0x6828('0x47')]['id']){delete _0x33614d[_0x6828('0x47')]['id'];}return db[_0x6828('0x29')]['find']({'where':{'id':_0x33614d[_0x6828('0x42')]['id']}})[_0x6828('0x20')](handleEntityNotFound(_0x11d0c0,null))[_0x6828('0x20')](saveUpdates(_0x33614d[_0x6828('0x47')],null))[_0x6828('0x20')](respondWithResult(_0x11d0c0,null))[_0x6828('0x45')](handleError(_0x11d0c0,null));};exports[_0x6828('0x21')]=function(_0x445dcf,_0x2e35ab){return db[_0x6828('0x29')][_0x6828('0x44')]({'where':{'id':_0x445dcf[_0x6828('0x42')]['id']}})[_0x6828('0x20')](handleEntityNotFound(_0x2e35ab,null))[_0x6828('0x20')](removeEntity(_0x2e35ab,null))[_0x6828('0x45')](handleError(_0x2e35ab,null));};exports[_0x6828('0x49')]=function(_0x2fdabb,_0x1f5ffa){return db[_0x6828('0x29')][_0x6828('0x49')]()[_0x6828('0x20')](respondWithResult(_0x1f5ffa,null))[_0x6828('0x45')](handleError(_0x1f5ffa,null));}; \ No newline at end of file +var _0x2867=['api','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','save','then','destroy','error','stack','index','map','ChatTransferReport','fieldName','type','model','name','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','rows','catch','keys','rawAttributes','fields','includeAll','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x548da1,_0xcdf95a){var _0xb7dc69=function(_0x577aee){while(--_0x577aee){_0x548da1['push'](_0x548da1['shift']());}};_0xb7dc69(++_0xcdf95a);}(_0x2867,0xc5));var _0x7286=function(_0x4a3554,_0x14f2fd){_0x4a3554=_0x4a3554-0x0;var _0x12e4cb=_0x2867[_0x4a3554];return _0x12e4cb;};'use strict';var emlformat=require(_0x7286('0x0'));var rimraf=require(_0x7286('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7286('0x2'));var rp=require(_0x7286('0x3'));var moment=require(_0x7286('0x4'));var BPromise=require(_0x7286('0x5'));var Mustache=require('mustache');var util=require(_0x7286('0x6'));var path=require(_0x7286('0x7'));var sox=require(_0x7286('0x8'));var csv=require(_0x7286('0x9'));var ejs=require(_0x7286('0xa'));var fs=require('fs');var fs_extra=require(_0x7286('0xb'));var _=require('lodash');var squel=require(_0x7286('0xc'));var crypto=require('crypto');var jsforce=require(_0x7286('0xd'));var deskjs=require(_0x7286('0xe'));var toCsv=require(_0x7286('0x9'));var querystring=require(_0x7286('0xf'));var Papa=require('papaparse');var Redis=require(_0x7286('0x10'));var authService=require(_0x7286('0x11'));var qs=require(_0x7286('0x12'));var as=require(_0x7286('0x13'));var hardwareService=require(_0x7286('0x14'));var logger=require(_0x7286('0x15'))(_0x7286('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7286('0x17'));var db=require(_0x7286('0x18'))['db'];function respondWithStatusCode(_0xb53b59,_0x2d5d68){_0x2d5d68=_0x2d5d68||0xcc;return function(_0x5defbc){if(_0x5defbc){return _0xb53b59[_0x7286('0x19')](_0x2d5d68);}return _0xb53b59[_0x7286('0x1a')](_0x2d5d68)['end']();};}function respondWithResult(_0x6d8446,_0x4b15ba){_0x4b15ba=_0x4b15ba||0xc8;return function(_0x3d913f){if(_0x3d913f){return _0x6d8446[_0x7286('0x1a')](_0x4b15ba)['json'](_0x3d913f);}};}function respondWithFilteredResult(_0x36b7cb,_0xd4e1c8){return function(_0x4dfaa6){if(_0x4dfaa6){var _0x4a5b58=typeof _0xd4e1c8['offset']===_0x7286('0x1b')&&typeof _0xd4e1c8[_0x7286('0x1c')]==='undefined';var _0x3ebbd9=_0x4dfaa6[_0x7286('0x1d')];var _0x1c759e=_0x4a5b58?0x0:_0xd4e1c8['offset'];var _0x508fd9=_0x4a5b58?_0x4dfaa6[_0x7286('0x1d')]:_0xd4e1c8[_0x7286('0x1e')]+_0xd4e1c8[_0x7286('0x1c')];var _0x29d5f6;if(_0x508fd9>=_0x3ebbd9){_0x508fd9=_0x3ebbd9;_0x29d5f6=0xc8;}else{_0x29d5f6=0xce;}_0x36b7cb[_0x7286('0x1a')](_0x29d5f6);return _0x36b7cb['set'](_0x7286('0x1f'),_0x1c759e+'-'+_0x508fd9+'/'+_0x3ebbd9)[_0x7286('0x20')](_0x4dfaa6);}return null;};}function patchUpdates(_0x47cfa8){return function(_0x17bd0e){try{jsonpatch[_0x7286('0x21')](_0x17bd0e,_0x47cfa8,!![]);}catch(_0xd7e1ca){return BPromise['reject'](_0xd7e1ca);}return _0x17bd0e[_0x7286('0x22')]();};}function saveUpdates(_0x4d1d10,_0x2dd255){return function(_0x45f355){if(_0x45f355){return _0x45f355['update'](_0x4d1d10)[_0x7286('0x23')](function(_0x54ee47){return _0x54ee47;});}return null;};}function removeEntity(_0x2665c8,_0x1cf1e8){return function(_0x581861){if(_0x581861){return _0x581861[_0x7286('0x24')]()[_0x7286('0x23')](function(){_0x2665c8[_0x7286('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x92f450,_0x5ae6d1){return function(_0x413d65){if(!_0x413d65){_0x92f450['sendStatus'](0x194);}return _0x413d65;};}function handleError(_0x374309,_0x2ef08a){_0x2ef08a=_0x2ef08a||0x1f4;return function(_0x363092){logger[_0x7286('0x25')](_0x363092[_0x7286('0x26')]);if(_0x363092['name']){delete _0x363092['name'];}_0x374309[_0x7286('0x1a')](_0x2ef08a)['send'](_0x363092);};}exports[_0x7286('0x27')]=function(_0x31fcb7,_0xc3156){var _0x4c6991={},_0x187db4={},_0x3f0fcd={'count':0x0,'rows':[]};var _0x165ecb=_[_0x7286('0x28')](db[_0x7286('0x29')]['rawAttributes'],function(_0x41028e){return{'name':_0x41028e[_0x7286('0x2a')],'type':_0x41028e[_0x7286('0x2b')]['key']};});_0x187db4[_0x7286('0x2c')]=_[_0x7286('0x28')](_0x165ecb,_0x7286('0x2d'));_0x187db4['query']=_['keys'](_0x31fcb7[_0x7286('0x2e')]);_0x187db4[_0x7286('0x2f')]=_[_0x7286('0x30')](_0x187db4[_0x7286('0x2c')],_0x187db4[_0x7286('0x2e')]);_0x4c6991[_0x7286('0x31')]=_[_0x7286('0x30')](_0x187db4['model'],qs['fields'](_0x31fcb7['query']['fields']));_0x4c6991['attributes']=_0x4c6991[_0x7286('0x31')][_0x7286('0x32')]?_0x4c6991[_0x7286('0x31')]:_0x187db4[_0x7286('0x2c')];if(!_0x31fcb7[_0x7286('0x2e')][_0x7286('0x33')](_0x7286('0x34'))){_0x4c6991[_0x7286('0x1c')]=qs['limit'](_0x31fcb7[_0x7286('0x2e')][_0x7286('0x1c')]);_0x4c6991[_0x7286('0x1e')]=qs[_0x7286('0x1e')](_0x31fcb7[_0x7286('0x2e')][_0x7286('0x1e')]);}_0x4c6991[_0x7286('0x35')]=qs[_0x7286('0x36')](_0x31fcb7[_0x7286('0x2e')][_0x7286('0x36')]);_0x4c6991[_0x7286('0x37')]=qs[_0x7286('0x2f')](_[_0x7286('0x38')](_0x31fcb7['query'],_0x187db4[_0x7286('0x2f')]),_0x165ecb);if(_0x31fcb7[_0x7286('0x2e')]['filter']){_0x4c6991[_0x7286('0x37')]=_[_0x7286('0x39')](_0x4c6991[_0x7286('0x37')],{'$or':_[_0x7286('0x28')](_0x165ecb,function(_0x58a573){if(_0x58a573[_0x7286('0x2b')]!=='VIRTUAL'){var _0x57065a={};_0x57065a[_0x58a573['name']]={'$like':'%'+_0x31fcb7['query'][_0x7286('0x3a')]+'%'};return _0x57065a;}})});}_0x4c6991=_[_0x7286('0x39')]({},_0x4c6991,_0x31fcb7[_0x7286('0x3b')]);var _0x4f356e={'where':_0x4c6991[_0x7286('0x37')]};return db[_0x7286('0x29')][_0x7286('0x1d')](_0x4f356e)[_0x7286('0x23')](function(_0x43bd4f){_0x3f0fcd['count']=_0x43bd4f;if(_0x31fcb7['query']['includeAll']){_0x4c6991[_0x7286('0x3c')]=[{'all':!![]}];}return db[_0x7286('0x29')]['findAll'](_0x4c6991);})['then'](function(_0x2c8da1){_0x3f0fcd[_0x7286('0x3d')]=_0x2c8da1;return _0x3f0fcd;})[_0x7286('0x23')](respondWithFilteredResult(_0xc3156,_0x4c6991))[_0x7286('0x3e')](handleError(_0xc3156,null));};exports['show']=function(_0x3e1a97,_0x461a7d){var _0x2691a7={'raw':!![],'where':{'id':_0x3e1a97['params']['id']}},_0x324ba5={};_0x324ba5[_0x7286('0x2c')]=_[_0x7286('0x3f')](db[_0x7286('0x29')][_0x7286('0x40')]);_0x324ba5[_0x7286('0x2e')]=_[_0x7286('0x3f')](_0x3e1a97[_0x7286('0x2e')]);_0x324ba5['filters']=_[_0x7286('0x30')](_0x324ba5[_0x7286('0x2c')],_0x324ba5['query']);_0x2691a7[_0x7286('0x31')]=_['intersection'](_0x324ba5[_0x7286('0x2c')],qs[_0x7286('0x41')](_0x3e1a97[_0x7286('0x2e')][_0x7286('0x41')]));_0x2691a7[_0x7286('0x31')]=_0x2691a7['attributes'][_0x7286('0x32')]?_0x2691a7[_0x7286('0x31')]:_0x324ba5['model'];if(_0x3e1a97[_0x7286('0x2e')][_0x7286('0x42')]){_0x2691a7[_0x7286('0x3c')]=[{'all':!![]}];}_0x2691a7=_[_0x7286('0x39')]({},_0x2691a7,_0x3e1a97[_0x7286('0x3b')]);return db[_0x7286('0x29')][_0x7286('0x43')](_0x2691a7)[_0x7286('0x23')](handleEntityNotFound(_0x461a7d,null))[_0x7286('0x23')](respondWithResult(_0x461a7d,null))[_0x7286('0x3e')](handleError(_0x461a7d,null));};exports[_0x7286('0x44')]=function(_0x22d19c,_0xfd5aac){return db[_0x7286('0x29')][_0x7286('0x44')](_0x22d19c[_0x7286('0x45')],{})['then'](respondWithResult(_0xfd5aac,0xc9))['catch'](handleError(_0xfd5aac,null));};exports[_0x7286('0x46')]=function(_0x17741b,_0x403008){if(_0x17741b[_0x7286('0x45')]['id']){delete _0x17741b[_0x7286('0x45')]['id'];}return db[_0x7286('0x29')]['find']({'where':{'id':_0x17741b[_0x7286('0x47')]['id']}})[_0x7286('0x23')](handleEntityNotFound(_0x403008,null))[_0x7286('0x23')](saveUpdates(_0x17741b[_0x7286('0x45')],null))[_0x7286('0x23')](respondWithResult(_0x403008,null))['catch'](handleError(_0x403008,null));};exports[_0x7286('0x24')]=function(_0x460ae0,_0x576406){return db['ChatTransferReport'][_0x7286('0x43')]({'where':{'id':_0x460ae0[_0x7286('0x47')]['id']}})['then'](handleEntityNotFound(_0x576406,null))[_0x7286('0x23')](removeEntity(_0x576406,null))['catch'](handleError(_0x576406,null));};exports[_0x7286('0x48')]=function(_0x2cfbb0,_0x31f445){return db[_0x7286('0x29')][_0x7286('0x48')]()['then'](respondWithResult(_0x31f445,null))['catch'](handleError(_0x31f445,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 1c1a2e0..fb979d7 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 _0x9f2c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger'];(function(_0x7054ce,_0x3a24ad){var _0x3670c2=function(_0x1abf0d){while(--_0x1abf0d){_0x7054ce['push'](_0x7054ce['shift']());}};_0x3670c2(++_0x3a24ad);}(_0x9f2c,0x1ba));var _0xc9f2=function(_0x347399,_0x42bbda){_0x347399=_0x347399-0x0;var _0x24e7be=_0x9f2c[_0x347399];return _0x24e7be;};'use strict';var _=require('lodash');var util=require(_0xc9f2('0x0'));var logger=require(_0xc9f2('0x1'))(_0xc9f2('0x2'));var moment=require(_0xc9f2('0x3'));var BPromise=require(_0xc9f2('0x4'));var rp=require(_0xc9f2('0x5'));var fs=require('fs');var path=require(_0xc9f2('0x6'));var rimraf=require(_0xc9f2('0x7'));var config=require(_0xc9f2('0x8'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x2922dc,_0x490086){return _0x2922dc['define'](_0xc9f2('0x9'),attributes,{'tableName':_0xc9f2('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc9f2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec3d=['exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x2e7087,_0x112eec){var _0xb5b3a6=function(_0x296310){while(--_0x296310){_0x2e7087['push'](_0x2e7087['shift']());}};_0xb5b3a6(++_0x112eec);}(_0xec3d,0x1b5));var _0xdec3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdec3('0x0'));var util=require(_0xdec3('0x1'));var logger=require(_0xdec3('0x2'))(_0xdec3('0x3'));var moment=require(_0xdec3('0x4'));var BPromise=require(_0xdec3('0x5'));var rp=require(_0xdec3('0x6'));var fs=require('fs');var path=require(_0xdec3('0x7'));var rimraf=require(_0xdec3('0x8'));var config=require(_0xdec3('0x9'));var attributes=require(_0xdec3('0xa'));module[_0xdec3('0xb')]=function(_0x4f86a0,_0x547603){return _0x4f86a0[_0xdec3('0xc')](_0xdec3('0xd'),attributes,{'tableName':_0xdec3('0xe'),'paranoid':![],'indexes':[{'name':_0xdec3('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 8ce40d6..62ad36f 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 _0x6a95=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x486b5e,_0x2c0ef8){var _0x343b2c=function(_0x274039){while(--_0x274039){_0x486b5e['push'](_0x486b5e['shift']());}};_0x343b2c(++_0x2c0ef8);}(_0x6a95,0x105));var _0x56a9=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x6a95[_0x32d457];return _0x338386;};'use strict';var _=require(_0x56a9('0x0'));var util=require('util');var moment=require(_0x56a9('0x1'));var BPromise=require(_0x56a9('0x2'));var rs=require(_0x56a9('0x3'));var fs=require('fs');var Redis=require(_0x56a9('0x4'));var db=require(_0x56a9('0x5'))['db'];var utils=require(_0x56a9('0x6'));var logger=require(_0x56a9('0x7'))('rpc');var config=require(_0x56a9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x56a9('0x9')][_0x56a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3747e9,_0x4df9de,_0x3661de){return new BPromise(function(_0x2402f8,_0x403481){return client[_0x56a9('0xb')](_0x3747e9,_0x3661de)[_0x56a9('0xc')](function(_0x63c99c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0x4df9de,'request\x20sent');logger[_0x56a9('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4df9de,_0x56a9('0x10'),JSON[_0x56a9('0x11')](_0x63c99c));if(_0x63c99c[_0x56a9('0x12')]){if(_0x63c99c[_0x56a9('0x12')][_0x56a9('0x13')]===0x1f4){logger['error'](_0x56a9('0xe'),_0x4df9de,_0x63c99c['error'][_0x56a9('0x14')]);return _0x403481(_0x63c99c[_0x56a9('0x12')][_0x56a9('0x14')]);}logger[_0x56a9('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x4df9de,_0x63c99c[_0x56a9('0x12')][_0x56a9('0x14')]);return _0x2402f8(_0x63c99c['error'][_0x56a9('0x14')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x4df9de,_0x56a9('0x10'));_0x2402f8(_0x63c99c[_0x56a9('0x15')][_0x56a9('0x14')]);}})['catch'](function(_0xe29e76){logger[_0x56a9('0x12')](_0x56a9('0xe'),_0x4df9de,_0xe29e76);_0x403481(_0xe29e76);});});} \ No newline at end of file +var _0x71f8=['../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x71f8,0x1f3));var _0x871f=function(_0x2fe245,_0x2d7dcd){_0x2fe245=_0x2fe245-0x0;var _0x315cba=_0x71f8[_0x2fe245];return _0x315cba;};'use strict';var _=require('lodash');var util=require(_0x871f('0x0'));var moment=require(_0x871f('0x1'));var BPromise=require(_0x871f('0x2'));var rs=require(_0x871f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x871f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x871f('0x5'))(_0x871f('0x6'));var config=require(_0x871f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x871f('0x8')][_0x871f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x338587,_0x3a807a,_0x2d3e11){return new BPromise(function(_0x30a130,_0x477e0a){return client[_0x871f('0xa')](_0x338587,_0x2d3e11)[_0x871f('0xb')](function(_0x13478c){logger[_0x871f('0xc')](_0x871f('0xd'),_0x3a807a,_0x871f('0xe'));logger['debug'](_0x871f('0xf'),_0x3a807a,_0x871f('0xe'),JSON[_0x871f('0x10')](_0x13478c));if(_0x13478c[_0x871f('0x11')]){if(_0x13478c['error'][_0x871f('0x12')]===0x1f4){logger[_0x871f('0x11')](_0x871f('0xd'),_0x3a807a,_0x13478c['error'][_0x871f('0x13')]);return _0x477e0a(_0x13478c['error']['message']);}logger[_0x871f('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x3a807a,_0x13478c[_0x871f('0x11')][_0x871f('0x13')]);return _0x30a130(_0x13478c[_0x871f('0x11')][_0x871f('0x13')]);}else{logger['info'](_0x871f('0xd'),_0x3a807a,_0x871f('0xe'));_0x30a130(_0x13478c[_0x871f('0x14')]['message']);}})[_0x871f('0x15')](function(_0x1b0f8d){logger['error'](_0x871f('0xd'),_0x3a807a,_0x1b0f8d);_0x477e0a(_0x1b0f8d);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index ed52283..a143490 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 _0x1a86=['/describe','describe','get','/:id','show','post','create','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated'];(function(_0x484780,_0xbbe226){var _0x2f6a92=function(_0x37e258){while(--_0x37e258){_0x484780['push'](_0x484780['shift']());}};_0x2f6a92(++_0xbbe226);}(_0x1a86,0x121));var _0x61a8=function(_0x2feae7,_0x4c7bf4){_0x2feae7=_0x2feae7-0x0;var _0x27ca97=_0x1a86[_0x2feae7];return _0x27ca97;};'use strict';var multer=require(_0x61a8('0x0'));var util=require('util');var path=require(_0x61a8('0x1'));var timeout=require(_0x61a8('0x2'));var express=require(_0x61a8('0x3'));var router=express[_0x61a8('0x4')]();var fs_extra=require(_0x61a8('0x5'));var auth=require(_0x61a8('0x6'));var interaction=require(_0x61a8('0x7'));var config=require(_0x61a8('0x8'));var controller=require(_0x61a8('0x9'));router['get']('/',auth[_0x61a8('0xa')](),controller['index']);router['get'](_0x61a8('0xb'),auth[_0x61a8('0xa')](),controller[_0x61a8('0xc')]);router[_0x61a8('0xd')](_0x61a8('0xe'),auth['isAuthenticated'](),controller[_0x61a8('0xf')]);router[_0x61a8('0x10')]('/',auth['isAuthenticated'](),controller[_0x61a8('0x11')]);router[_0x61a8('0x12')](_0x61a8('0xe'),auth[_0x61a8('0xa')](),controller[_0x61a8('0x13')]);router['delete'](_0x61a8('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe1d9=['get','describe','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xe1d9,0x149));var _0x9e1d=function(_0x4c4013,_0x6be6b2){_0x4c4013=_0x4c4013-0x0;var _0x3e7bb5=_0xe1d9[_0x4c4013];return _0x3e7bb5;};'use strict';var multer=require(_0x9e1d('0x0'));var util=require(_0x9e1d('0x1'));var path=require(_0x9e1d('0x2'));var timeout=require(_0x9e1d('0x3'));var express=require(_0x9e1d('0x4'));var router=express[_0x9e1d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9e1d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9e1d('0x7'));var controller=require(_0x9e1d('0x8'));router['get']('/',auth[_0x9e1d('0x9')](),controller[_0x9e1d('0xa')]);router[_0x9e1d('0xb')]('/describe',auth[_0x9e1d('0x9')](),controller[_0x9e1d('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9e1d('0xd')]);router[_0x9e1d('0xe')]('/',auth['isAuthenticated'](),controller[_0x9e1d('0xf')]);router[_0x9e1d('0x10')](_0x9e1d('0x11'),auth[_0x9e1d('0x9')](),controller[_0x9e1d('0x12')]);router['delete'](_0x9e1d('0x11'),auth[_0x9e1d('0x9')](),controller['destroy']);module[_0x9e1d('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 478f145..6c1323c 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 _0xf4eb=['squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','ENUM','star','thumb','TEXT','stringify','input','text','name','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','parse','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Your\x20request\x20has\x20not\x20been\x20processed.','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','address','email','STRING','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN'];(function(_0x2cf3b0,_0x4e6a14){var _0x29fd9c=function(_0x514c07){while(--_0x514c07){_0x2cf3b0['push'](_0x2cf3b0['shift']());}};_0x29fd9c(++_0x4e6a14);}(_0xf4eb,0xec));var _0xbf4e=function(_0x60403,_0x70a934){_0x60403=_0x60403-0x0;var _0x134abb=_0xf4eb[_0x60403];return _0x134abb;};'use strict';var Sequelize=require(_0xbf4e('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbf4e('0x1')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xbf4e('0x2')},'mapKeyOffline':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x2')},'key':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x4')},'customerAlias':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbf4e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':_0xbf4e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':_0xbf4e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbf4e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbf4e('0x3')]},'animation':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xbf4e('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbf4e('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0xc')},'download_transcript':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbf4e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0xd')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0xf')},'noteTitle':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x10')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbf4e('0x11')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x12')},'conditionAgreement':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x13')},'ratingType':{'type':Sequelize[_0xbf4e('0x14')](_0xbf4e('0x15'),_0xbf4e('0x16')),'defaultValue':_0xbf4e('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xbf4e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbf4e('0x17')],'defaultValue':function(){return JSON[_0xbf4e('0x18')]({'items':[{'type':_0xbf4e('0x19'),'variable':null,'config':{'placeholder':'name','type':_0xbf4e('0x1a'),'required':!![]},'props':{'title':_0xbf4e('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0xbf4e('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0xbf4e('0x2'),'type':_0xbf4e('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbf4e('0x1c')](_0xbf4e('0x1d'))?JSON['parse'](this[_0xbf4e('0x1c')](_0xbf4e('0x1d'))):{};},'set':function(_0x3d6863){return this['setDataValue'](_0xbf4e('0x1d'),JSON['stringify'](_0x3d6863));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xbf4e('0x18')]({'items':[{'type':'input','props':{'title':_0xbf4e('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0xbf4e('0x2'),'type':_0xbf4e('0x2')},'variable':null},{'type':_0xbf4e('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':_0xbf4e('0x1f'),'helpText':_0xbf4e('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xbf4e('0x1c')]('offlineForm')?JSON[_0xbf4e('0x21')](this['getDataValue'](_0xbf4e('0x22'))):{};},'set':function(_0x1421e1){return this[_0xbf4e('0x23')]('offlineForm',JSON[_0xbf4e('0x18')](_0x1421e1));}},'token':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':function(){return rs[_0xbf4e('0x24')]();}},'autoclose':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbf4e('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xbf4e('0x25')},'waitingMessage':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xbf4e('0x12')},'sendUnmanaged':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x27')},'enableCustomerAttachment':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbf4e('0x17')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbf4e('0x3')]},'notificationTemplate':{'type':Sequelize[_0xbf4e('0x17')],'defaultValue':function(){return _0xbf4e('0x28');}},'notificationSound':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x29')},'verticalAlignment':{'type':Sequelize[_0xbf4e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x2a')},'messagesAlignment':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x2b')},'defaultTitle':{'type':Sequelize[_0xbf4e('0x3')]},'customerAvatar':{'type':Sequelize[_0xbf4e('0x17')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':_0xbf4e('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x2d')},'systemAvatar':{'type':Sequelize[_0xbf4e('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf4e('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![],'comment':_0xbf4e('0x2e'),'set':function(_0x3aa308){if(!_0x3aa308)this[_0xbf4e('0x23')]('mandatoryDispositionPauseId',null);this[_0xbf4e('0x23')](_0xbf4e('0x2f'),_0x3aa308);}},'vidaooEscalation':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbf4e('0x3')]},'vidaooTopic':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':_0xbf4e('0x30')},'vidaooNote':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xbf4e('0x17')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3c81=['bottom_right','alternate','#fafafa','System','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','text','input','parse','getDataValue','setDataValue','onlineForm','textarea','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias'];(function(_0x5604d2,_0x4f1950){var _0x50d8c2=function(_0x1df321){while(--_0x1df321){_0x5604d2['push'](_0x5604d2['shift']());}};_0x50d8c2(++_0x4f1950);}(_0x3c81,0x102));var _0x13c8=function(_0x27f2f8,_0x18eefd){_0x27f2f8=_0x27f2f8-0x0;var _0x456294=_0x3c81[_0x27f2f8];return _0x456294;};'use strict';var Sequelize=require(_0x13c8('0x0'));var rs=require(_0x13c8('0x1'));module['exports']={'name':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x3')},'key':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x4')},'customerAlias':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x13c8('0x2')]},'animation':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x13c8('0x8')](_0x13c8('0x9'),_0x13c8('0xa')),'defaultValue':_0x13c8('0x9')},'header_online':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xb')},'start_chat_button':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xc')},'header_offline':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x13c8('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x11')},'placeholderMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x12')},'closingMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x13')},'closingMessageButton':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xc')},'skipMessageButton':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x14')},'conditionAgreement':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x13c8('0x16'),_0x13c8('0x17')),'defaultValue':_0x13c8('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':function(){return JSON[_0x13c8('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x13c8('0x19'),'type':_0x13c8('0x1a'),'required':!![]},'props':{'title':_0x13c8('0x19'),'helpText':''}},{'type':_0x13c8('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x13c8('0x3'),'type':_0x13c8('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x13c8('0x1c')](this[_0x13c8('0x1d')]('onlineForm')):{};},'set':function(_0x5ad0dc){return this[_0x13c8('0x1e')](_0x13c8('0x1f'),JSON['stringify'](_0x5ad0dc));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x13c8('0x18')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x13c8('0x3'),'type':_0x13c8('0x3')},'variable':null},{'type':_0x13c8('0x20'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x13c8('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x13c8('0x1d')](_0x13c8('0x22'))?JSON[_0x13c8('0x1c')](this[_0x13c8('0x1d')](_0x13c8('0x22'))):{};},'set':function(_0x343080){return this['setDataValue'](_0x13c8('0x22'),JSON[_0x13c8('0x18')](_0x343080));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x13c8('0x2')]},'forwardOffline':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x23')},'waitingMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x25')},'offlineMessageBody':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0x27')},'skipUnmanaged':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x13c8('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x13c8('0x2')]},'notificationTemplate':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':function(){return _0x13c8('0x28');}},'notificationSound':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x2a')},'verticalAlignment':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0x2b')},'defaultTitle':{'type':Sequelize[_0x13c8('0x2')]},'customerAvatar':{'type':Sequelize[_0x13c8('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x13c8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x2d')},'systemAvatar':{'type':Sequelize[_0x13c8('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x13c8('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x343dba){if(!_0x343dba)this[_0x13c8('0x1e')](_0x13c8('0x2e'),null);this[_0x13c8('0x1e')](_0x13c8('0x2f'),_0x343dba);}},'vidaooEscalation':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x13c8('0x2')]},'vidaooTopic':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x30')},'vidaooNote':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':function(){return _0x13c8('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x13c8('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index c7fe785..4814caf 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 _0x95b6=['Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','inspect','No\x20timezone','getSnippet','Interval','getProactiveActions','virtual','License','increment','Intervals','readFileSync','remote','x-real-ip','remoteAddress','replace','render','alignment','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','offlineForm','items','fromKey','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','params','keys','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','describe','addDisposition','Disposition','getDispositions','findOne','length','ChatWebsiteId','removeDispositions','ids','CannedAnswer','findAll','removeAnswers','addLogo','sitepic','filename','addAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','agentAvatar','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','DESC','account','list','List','applications','orderBy','priority','asc','contact','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','format','unknown','version','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','ContactId','interaction','ChatInteraction','spread','lastName','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','files','difference','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','email','Smtp','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','internal','Tag','Tags','color','tag'];(function(_0x275c39,_0x3584f0){var _0x437901=function(_0xdb2d9b){while(--_0xdb2d9b){_0x275c39['push'](_0x275c39['shift']());}};_0x437901(++_0x3584f0);}(_0x95b6,0x15f));var _0x695b=function(_0x87e81b,_0x2ddb31){_0x87e81b=_0x87e81b-0x0;var _0x1d4c78=_0x95b6[_0x87e81b];return _0x1d4c78;};'use strict';var BPromise=require(_0x695b('0x0'));var Mustache=require(_0x695b('0x1'));var util=require('util');var path=require(_0x695b('0x2'));var ejs=require(_0x695b('0x3'));var fs=require('fs');var fs_extra=require(_0x695b('0x4'));var _=require(_0x695b('0x5'));var querystring=require('querystring');var Redis=require(_0x695b('0x6'));var qs=require(_0x695b('0x7'));var logger=require(_0x695b('0x8'))(_0x695b('0x9'));var config=require(_0x695b('0xa'));var db=require(_0x695b('0xb'))['db'];config[_0x695b('0xc')]=_[_0x695b('0xd')](config[_0x695b('0xc')],{'host':_0x695b('0xe'),'port':0x18eb});var socket=require(_0x695b('0xf'))(new Redis(config[_0x695b('0xc')]));require(_0x695b('0x10'))[_0x695b('0x11')](socket);var htmlToText=require(_0x695b('0x12'));var jayson=require(_0x695b('0x13'));var client=jayson[_0x695b('0x14')][_0x695b('0x15')]({'port':0x232c});var client9002=jayson[_0x695b('0x14')]['http']({'port':0x232a});var client9003=jayson['client'][_0x695b('0x15')]({'port':0x232b});var client9001=jayson['client'][_0x695b('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x146620,_0x233a7f,_0x3b9468,_0xec8f34){return new BPromise(function(_0x1128f6,_0x15809e){var _0x9d0ca8=_0xec8f34||client;return _0x9d0ca8['request'](_0x146620,_0x3b9468)[_0x695b('0x16')](function(_0x5aebd2){logger[_0x695b('0x17')](_0x695b('0x18'),_0x233a7f,_0x695b('0x19'));logger[_0x695b('0x1a')](_0x695b('0x1b'),_0x233a7f,_0x695b('0x19'),JSON['stringify'](_0x5aebd2));if(_0x5aebd2[_0x695b('0x1c')]){if(_0x5aebd2[_0x695b('0x1c')][_0x695b('0x1d')]===0x1f4){logger[_0x695b('0x1c')](_0x695b('0x18'),_0x233a7f,_0x5aebd2[_0x695b('0x1c')][_0x695b('0x1e')]);return _0x15809e(_0x5aebd2['error'][_0x695b('0x1e')]);}logger[_0x695b('0x1c')](_0x695b('0x18'),_0x233a7f,_0x5aebd2['error']['message']);return _0x1128f6(_0x5aebd2[_0x695b('0x1c')][_0x695b('0x1e')]);}else{logger[_0x695b('0x17')](_0x695b('0x18'),_0x233a7f,_0x695b('0x19'));_0x1128f6(_0x5aebd2[_0x695b('0x1f')][_0x695b('0x1e')]);}})[_0x695b('0x20')](function(_0x5a5221){logger[_0x695b('0x1c')](_0x695b('0x18'),_0x233a7f,_0x5a5221);_0x15809e(_0x5a5221);});});}function respondWithStatusCode(_0x19b4d8,_0x2b85a3){_0x2b85a3=_0x2b85a3||0xcc;return function(_0x4c9dd4){if(_0x4c9dd4){return _0x19b4d8[_0x695b('0x21')](_0x2b85a3);}return _0x19b4d8[_0x695b('0x22')](_0x2b85a3)[_0x695b('0x23')]();};}function respondWithResult(_0x18b4fe,_0x1d009b){_0x1d009b=_0x1d009b||0xc8;return function(_0x2935e){if(_0x2935e){return _0x18b4fe[_0x695b('0x22')](_0x1d009b)[_0x695b('0x24')](_0x2935e);}};}function respondWithFilteredResult(_0x11041d,_0x24085a){return function(_0x1b6eec){if(_0x1b6eec){var _0x12d645=typeof _0x24085a['offset']==='undefined'&&typeof _0x24085a['limit']===_0x695b('0x25');var _0x1875c9=_0x1b6eec[_0x695b('0x26')];var _0x3dbd41=_0x12d645?0x0:_0x24085a[_0x695b('0x27')];var _0x3be238=_0x12d645?_0x1b6eec[_0x695b('0x26')]:_0x24085a[_0x695b('0x27')]+_0x24085a[_0x695b('0x28')];var _0x1d7bc3;if(_0x3be238>=_0x1875c9){_0x3be238=_0x1875c9;_0x1d7bc3=0xc8;}else{_0x1d7bc3=0xce;}_0x11041d[_0x695b('0x22')](_0x1d7bc3);return _0x11041d['set'](_0x695b('0x29'),_0x3dbd41+'-'+_0x3be238+'/'+_0x1875c9)[_0x695b('0x24')](_0x1b6eec);}return null;};}function saveUpdates(_0x4d1062){return function(_0x178859){if(_0x178859){return _0x178859[_0x695b('0x2a')](_0x4d1062)[_0x695b('0x16')](function(_0xa1d932){return _0xa1d932;});}return null;};}function removeEntity(_0x31303e){return function(_0x4a831d){if(_0x4a831d){return _0x4a831d[_0x695b('0x2b')]()[_0x695b('0x16')](function(){var _0x11df91=_0x4a831d[_0x695b('0x2c')]({'plain':!![]});var _0x58f8f7=_0x695b('0x2d');return db[_0x695b('0x2e')][_0x695b('0x2b')]({'where':{'type':_0x58f8f7,'resourceId':_0x11df91['id']}})[_0x695b('0x16')](function(){return _0x4a831d;});})[_0x695b('0x16')](function(){_0x31303e[_0x695b('0x22')](0xcc)[_0x695b('0x23')]();});}};}function handleEntityNotFound(_0x4623fb){return function(_0xb40d02){if(!_0xb40d02){_0x4623fb[_0x695b('0x21')](0x194);}return _0xb40d02;};}function handleError(_0x5b3f0a,_0x5c688a){_0x5c688a=_0x5c688a||0x1f4;return function(_0xc48b60){logger[_0x695b('0x1c')](_0xc48b60['stack']);if(_0xc48b60[_0x695b('0x2f')]){delete _0xc48b60[_0x695b('0x2f')];}_0x5b3f0a['status'](_0x5c688a)[_0x695b('0x30')](_0xc48b60);};}exports[_0x695b('0x31')]=function(_0x3b6ad6,_0x1bdff6){var _0x399a95={'include':[{'model':db[_0x695b('0x32')],'as':_0x695b('0x33')}]},_0x235ba4={},_0x1052c1={'count':0x0,'rows':[]};var _0x1c7cf3=_['map'](db[_0x695b('0x34')]['rawAttributes'],function(_0x18886e){return{'name':_0x18886e['fieldName'],'type':_0x18886e[_0x695b('0x35')][_0x695b('0x36')]};});_0x235ba4[_0x695b('0x37')]=_[_0x695b('0x38')](_0x1c7cf3,_0x695b('0x2f'));_0x235ba4[_0x695b('0x39')]=_['keys'](_0x3b6ad6['query']);_0x235ba4[_0x695b('0x3a')]=_[_0x695b('0x3b')](_0x235ba4[_0x695b('0x37')],_0x235ba4[_0x695b('0x39')]);_0x399a95[_0x695b('0x3c')]=_[_0x695b('0x3b')](_0x235ba4[_0x695b('0x37')],qs[_0x695b('0x3d')](_0x3b6ad6[_0x695b('0x39')][_0x695b('0x3d')]));_0x399a95[_0x695b('0x3c')]=_0x399a95[_0x695b('0x3c')]['length']?_0x399a95['attributes']:_0x235ba4['model'];if(!_0x3b6ad6[_0x695b('0x39')][_0x695b('0x3e')](_0x695b('0x3f'))){_0x399a95['limit']=qs[_0x695b('0x28')](_0x3b6ad6[_0x695b('0x39')][_0x695b('0x28')]);_0x399a95[_0x695b('0x27')]=qs['offset'](_0x3b6ad6[_0x695b('0x39')][_0x695b('0x27')]);}_0x399a95[_0x695b('0x40')]=qs['sort'](_0x3b6ad6[_0x695b('0x39')][_0x695b('0x41')]);_0x399a95[_0x695b('0x42')]=qs[_0x695b('0x3a')](_[_0x695b('0x43')](_0x3b6ad6[_0x695b('0x39')],_0x235ba4[_0x695b('0x3a')]),_0x1c7cf3);if(_0x3b6ad6[_0x695b('0x39')][_0x695b('0x44')]){_0x399a95[_0x695b('0x42')]=_['merge'](_0x399a95[_0x695b('0x42')],{'$or':_[_0x695b('0x38')](_0x1c7cf3,function(_0x265fa9){if(_0x265fa9['type']!==_0x695b('0x45')){var _0x108ecf={};_0x108ecf[_0x265fa9[_0x695b('0x2f')]]={'$like':'%'+_0x3b6ad6[_0x695b('0x39')][_0x695b('0x44')]+'%'};return _0x108ecf;}})});}_0x399a95=_[_0x695b('0x46')]({},_0x399a95,_0x3b6ad6[_0x695b('0x47')]);var _0x3a7b8f={'where':_0x399a95['where']};return db['ChatWebsite'][_0x695b('0x26')](_0x3a7b8f)[_0x695b('0x16')](function(_0x23add8){_0x1052c1['count']=_0x23add8;if(_0x3b6ad6[_0x695b('0x39')][_0x695b('0x48')]){_0x399a95['include']=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x399a95);})['then'](function(_0x53946a){_0x1052c1[_0x695b('0x49')]=_0x53946a;return _0x1052c1;})['then'](respondWithFilteredResult(_0x1bdff6,_0x399a95))[_0x695b('0x20')](handleError(_0x1bdff6,null));};exports[_0x695b('0x4a')]=function(_0x5db67c,_0x5492b6){var _0x2617f0={'raw':![],'where':{'id':_0x5db67c[_0x695b('0x4b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1d4c13={};_0x1d4c13[_0x695b('0x37')]=_[_0x695b('0x4c')](db[_0x695b('0x34')][_0x695b('0x4d')]);_0x1d4c13['query']=_[_0x695b('0x4c')](_0x5db67c[_0x695b('0x39')]);_0x1d4c13['filters']=_['intersection'](_0x1d4c13[_0x695b('0x37')],_0x1d4c13[_0x695b('0x39')]);_0x2617f0[_0x695b('0x3c')]=_[_0x695b('0x3b')](_0x1d4c13['model'],qs[_0x695b('0x3d')](_0x5db67c[_0x695b('0x39')][_0x695b('0x3d')]));_0x2617f0[_0x695b('0x3c')]=_0x2617f0[_0x695b('0x3c')]['length']?_0x2617f0[_0x695b('0x3c')]:_0x1d4c13[_0x695b('0x37')];if(_0x5db67c['query'][_0x695b('0x48')]){_0x2617f0[_0x695b('0x4e')]=[{'all':!![]}];}_0x2617f0=_[_0x695b('0x46')]({},_0x2617f0,_0x5db67c[_0x695b('0x47')]);return db[_0x695b('0x34')]['find'](_0x2617f0)['then'](handleEntityNotFound(_0x5492b6,null))['then'](respondWithResult(_0x5492b6,null))[_0x695b('0x20')](handleError(_0x5492b6,null));};exports[_0x695b('0x4f')]=function(_0x20285d,_0x8d8e53){return db['ChatWebsite'][_0x695b('0x4f')](_0x20285d[_0x695b('0x50')],{})[_0x695b('0x16')](function(_0x18cee7){var _0x52c2b9=_0x20285d[_0x695b('0x51')][_0x695b('0x2c')]({'plain':!![]});if(!_0x52c2b9)throw new Error(_0x695b('0x52'));if(_0x52c2b9[_0x695b('0x53')]==='user'){var _0x664a22=_0x18cee7[_0x695b('0x2c')]({'plain':!![]});var _0x47e397=_0x695b('0x2d');return db[_0x695b('0x54')]['find']({'where':{'name':_0x47e397,'userProfileId':_0x52c2b9[_0x695b('0x55')]},'raw':!![]})[_0x695b('0x16')](function(_0x47bf4d){if(_0x47bf4d&&_0x47bf4d[_0x695b('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x664a22['name'],'resourceId':_0x664a22['id'],'type':_0x47bf4d[_0x695b('0x2f')],'sectionId':_0x47bf4d['id']},{})[_0x695b('0x16')](function(){return _0x18cee7;});}else{return _0x18cee7;}})[_0x695b('0x20')](function(_0x2ed6c1){logger[_0x695b('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ed6c1);throw _0x2ed6c1;});}return _0x18cee7;})['then'](respondWithResult(_0x8d8e53,0xc9))['catch'](handleError(_0x8d8e53,null));};exports[_0x695b('0x2a')]=function(_0x2a8184,_0x5cc323){if(_0x2a8184[_0x695b('0x50')]['id']){delete _0x2a8184[_0x695b('0x50')]['id'];}return db[_0x695b('0x34')][_0x695b('0x57')]({'where':{'id':_0x2a8184[_0x695b('0x4b')]['id']},'include':[{'model':db[_0x695b('0x32')],'as':_0x695b('0x33')}]})[_0x695b('0x16')](handleEntityNotFound(_0x5cc323,null))['then'](saveUpdates(_0x2a8184['body'],null))[_0x695b('0x16')](respondWithResult(_0x5cc323,null))[_0x695b('0x20')](handleError(_0x5cc323,null));};exports['destroy']=function(_0x5d6ef7,_0x8f34d){return db[_0x695b('0x34')]['find']({'where':{'id':_0x5d6ef7[_0x695b('0x4b')]['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x8f34d,null))[_0x695b('0x16')](removeEntity(_0x8f34d,null))[_0x695b('0x20')](handleError(_0x8f34d,null));};exports['describe']=function(_0x581c11,_0x329fab){return db['ChatWebsite'][_0x695b('0x58')]()[_0x695b('0x16')](respondWithResult(_0x329fab,null))[_0x695b('0x20')](handleError(_0x329fab,null));};exports[_0x695b('0x59')]=function(_0x31a4e6,_0x233bbf){if(_0x31a4e6['body']['id']){delete _0x31a4e6['body']['id'];}return db[_0x695b('0x34')][_0x695b('0x57')]({'where':{'id':_0x31a4e6['params']['id']}})['then'](handleEntityNotFound(_0x233bbf,null))[_0x695b('0x16')](function(_0xa7e6b7){if(_0xa7e6b7){_0x31a4e6['body']['ChatWebsiteId']=_0xa7e6b7['id'];return db[_0x695b('0x5a')]['create'](_0x31a4e6[_0x695b('0x50')]);}})['then'](respondWithResult(_0x233bbf,null))[_0x695b('0x20')](handleError(_0x233bbf,null));};exports[_0x695b('0x5b')]=function(_0x475aae,_0x3937ed){var _0x25d827={'raw':![],'where':{}};var _0x3e8627={};var _0x32a4d7={'count':0x0,'rows':[]};return db[_0x695b('0x34')][_0x695b('0x5c')]({'where':{'id':_0x475aae['params']['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x3937ed,null))[_0x695b('0x16')](function(_0x3a0553){if(_0x3a0553){_0x3e8627[_0x695b('0x37')]=_[_0x695b('0x4c')](db['Disposition'][_0x695b('0x4d')]);_0x3e8627[_0x695b('0x39')]=_['keys'](_0x475aae[_0x695b('0x39')]);_0x3e8627[_0x695b('0x3a')]=_[_0x695b('0x3b')](_0x3e8627['model'],_0x3e8627[_0x695b('0x39')]);_0x25d827['attributes']=_['intersection'](_0x3e8627[_0x695b('0x37')],qs[_0x695b('0x3d')](_0x475aae[_0x695b('0x39')]['fields']));_0x25d827[_0x695b('0x3c')]=_0x25d827[_0x695b('0x3c')][_0x695b('0x5d')]?_0x25d827[_0x695b('0x3c')]:_0x3e8627[_0x695b('0x37')];if(!_0x475aae['query']['hasOwnProperty']('nolimit')){_0x25d827[_0x695b('0x28')]=qs['limit'](_0x475aae[_0x695b('0x39')][_0x695b('0x28')]);_0x25d827[_0x695b('0x27')]=qs[_0x695b('0x27')](_0x475aae['query'][_0x695b('0x27')]);}_0x25d827[_0x695b('0x40')]=qs[_0x695b('0x41')](_0x475aae[_0x695b('0x39')][_0x695b('0x41')]);_0x25d827[_0x695b('0x42')]=qs['filters'](_[_0x695b('0x43')](_0x475aae['query'],_0x3e8627[_0x695b('0x3a')]));_0x25d827[_0x695b('0x42')][_0x695b('0x5e')]=_0x3a0553['id'];if(_0x475aae['query']['filter']){_0x25d827['where']=_['merge'](_0x25d827['where'],{'$or':_[_0x695b('0x38')](_0x25d827['attributes'],function(_0x53ac2d){var _0x4591d6={};_0x4591d6[_0x53ac2d]={'$like':'%'+_0x475aae[_0x695b('0x39')][_0x695b('0x44')]+'%'};return _0x4591d6;})});}_0x25d827=_['merge']({},_0x25d827,_0x475aae[_0x695b('0x47')]);return db['Disposition'][_0x695b('0x26')]({'where':_0x25d827['where']})[_0x695b('0x16')](function(_0x588e5a){_0x32a4d7[_0x695b('0x26')]=_0x588e5a;if(_0x475aae[_0x695b('0x39')][_0x695b('0x48')]){_0x25d827[_0x695b('0x4e')]=[{'all':!![]}];}return db[_0x695b('0x5a')]['findAll'](_0x25d827);})[_0x695b('0x16')](function(_0xe53420){_0x32a4d7[_0x695b('0x49')]=_0xe53420;return _0x32a4d7;});}})[_0x695b('0x16')](respondWithFilteredResult(_0x3937ed,_0x25d827))[_0x695b('0x20')](handleError(_0x3937ed,null));};exports[_0x695b('0x5f')]=function(_0x46ac48,_0x376de3){return db[_0x695b('0x34')]['find']({'where':{'id':_0x46ac48[_0x695b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x376de3,null))[_0x695b('0x16')](function(_0x43e79b){if(_0x43e79b){return _0x43e79b[_0x695b('0x5f')](_0x46ac48[_0x695b('0x39')][_0x695b('0x60')]);}})[_0x695b('0x16')](respondWithStatusCode(_0x376de3,null))['catch'](handleError(_0x376de3,null));};exports['addAnswer']=function(_0x3eb981,_0xf3a860){if(_0x3eb981[_0x695b('0x50')]['id']){delete _0x3eb981[_0x695b('0x50')]['id'];}return db['ChatWebsite'][_0x695b('0x57')]({'where':{'id':_0x3eb981['params']['id']}})[_0x695b('0x16')](handleEntityNotFound(_0xf3a860,null))['then'](function(_0x4c723b){if(_0x4c723b){_0x3eb981[_0x695b('0x50')][_0x695b('0x5e')]=_0x4c723b['id'];return db[_0x695b('0x61')][_0x695b('0x4f')](_0x3eb981['body']);}})[_0x695b('0x16')](respondWithResult(_0xf3a860,null))[_0x695b('0x20')](handleError(_0xf3a860,null));};exports['getAnswers']=function(_0x133242,_0x36f466){var _0x103456={'raw':![],'where':{}};var _0x1bb992={};var _0x2a7c5f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x695b('0x5c')]({'where':{'id':_0x133242[_0x695b('0x4b')]['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x36f466,null))[_0x695b('0x16')](function(_0x4600d7){if(_0x4600d7){_0x1bb992[_0x695b('0x37')]=_[_0x695b('0x4c')](db[_0x695b('0x61')][_0x695b('0x4d')]);_0x1bb992['query']=_['keys'](_0x133242['query']);_0x1bb992['filters']=_[_0x695b('0x3b')](_0x1bb992[_0x695b('0x37')],_0x1bb992['query']);_0x103456[_0x695b('0x3c')]=_[_0x695b('0x3b')](_0x1bb992['model'],qs[_0x695b('0x3d')](_0x133242[_0x695b('0x39')][_0x695b('0x3d')]));_0x103456[_0x695b('0x3c')]=_0x103456[_0x695b('0x3c')][_0x695b('0x5d')]?_0x103456[_0x695b('0x3c')]:_0x1bb992[_0x695b('0x37')];if(!_0x133242['query'][_0x695b('0x3e')]('nolimit')){_0x103456[_0x695b('0x28')]=qs[_0x695b('0x28')](_0x133242[_0x695b('0x39')][_0x695b('0x28')]);_0x103456[_0x695b('0x27')]=qs[_0x695b('0x27')](_0x133242['query'][_0x695b('0x27')]);}_0x103456['order']=qs[_0x695b('0x41')](_0x133242['query'][_0x695b('0x41')]);_0x103456[_0x695b('0x42')]=qs[_0x695b('0x3a')](_['pick'](_0x133242[_0x695b('0x39')],_0x1bb992[_0x695b('0x3a')]));_0x103456[_0x695b('0x42')][_0x695b('0x5e')]=_0x4600d7['id'];if(_0x133242['query']['filter']){_0x103456[_0x695b('0x42')]=_[_0x695b('0x46')](_0x103456[_0x695b('0x42')],{'$or':_['map'](_0x103456[_0x695b('0x3c')],function(_0x41fd32){var _0x3c3fd4={};_0x3c3fd4[_0x41fd32]={'$like':'%'+_0x133242[_0x695b('0x39')][_0x695b('0x44')]+'%'};return _0x3c3fd4;})});}_0x103456=_[_0x695b('0x46')]({},_0x103456,_0x133242['options']);return db[_0x695b('0x61')][_0x695b('0x26')]({'where':_0x103456['where']})[_0x695b('0x16')](function(_0x2d26b4){_0x2a7c5f[_0x695b('0x26')]=_0x2d26b4;if(_0x133242[_0x695b('0x39')][_0x695b('0x48')]){_0x103456['include']=[{'all':!![]}];}return db[_0x695b('0x61')][_0x695b('0x62')](_0x103456);})[_0x695b('0x16')](function(_0x437b89){_0x2a7c5f[_0x695b('0x49')]=_0x437b89;return _0x2a7c5f;});}})[_0x695b('0x16')](respondWithFilteredResult(_0x36f466,_0x103456))['catch'](handleError(_0x36f466,null));};exports[_0x695b('0x63')]=function(_0x577454,_0x530fc0){return db[_0x695b('0x34')]['find']({'where':{'id':_0x577454['params']['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x530fc0,null))['then'](function(_0x23e857){if(_0x23e857){return _0x23e857['removeAnswers'](_0x577454['query'][_0x695b('0x60')]);}})['then'](respondWithStatusCode(_0x530fc0,null))['catch'](handleError(_0x530fc0,null));};exports[_0x695b('0x64')]=function(_0xf8a4db,_0x176135){_0xf8a4db['body'][_0x695b('0x65')]=_0xf8a4db['file'][_0x695b('0x66')];return db[_0x695b('0x34')][_0x695b('0x57')]({'where':{'id':_0xf8a4db[_0x695b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x176135,null))[_0x695b('0x16')](saveUpdates(_0xf8a4db[_0x695b('0x50')],null))[_0x695b('0x16')](respondWithResult(_0x176135,null))[_0x695b('0x20')](handleError(_0x176135,null));};exports[_0x695b('0x67')]=function(_0xfa4da4,_0x21682b){_0xfa4da4[_0x695b('0x50')]['agentAvatar']=_0xfa4da4[_0x695b('0x68')][_0x695b('0x66')];return db[_0x695b('0x34')][_0x695b('0x57')]({'where':{'id':_0xfa4da4['params']['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x21682b,null))[_0x695b('0x16')](saveUpdates(_0xfa4da4[_0x695b('0x50')],null))['then'](respondWithResult(_0x21682b,null))['catch'](handleError(_0x21682b,null));};exports[_0x695b('0x69')]=function(_0xa8344d,_0x177ca4){_0xa8344d[_0x695b('0x50')][_0x695b('0x6a')]=_0xa8344d[_0x695b('0x68')][_0x695b('0x66')];return db[_0x695b('0x34')]['find']({'where':{'id':_0xa8344d[_0x695b('0x4b')]['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x177ca4,null))[_0x695b('0x16')](saveUpdates(_0xa8344d[_0x695b('0x50')],null))[_0x695b('0x16')](respondWithResult(_0x177ca4,null))[_0x695b('0x20')](handleError(_0x177ca4,null));};exports[_0x695b('0x6b')]=function(_0xcaa570,_0x22f1a8){_0xcaa570['body'][_0x695b('0x6c')]=_0xcaa570[_0x695b('0x68')]['filename'];return db[_0x695b('0x34')][_0x695b('0x57')]({'where':{'id':_0xcaa570[_0x695b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x22f1a8,null))[_0x695b('0x16')](saveUpdates(_0xcaa570[_0x695b('0x50')],null))['then'](respondWithResult(_0x22f1a8,null))['catch'](handleError(_0x22f1a8,null));};exports[_0x695b('0x6d')]=function(_0x2ba3a8,_0x167724){var _0x3b698d=path['join'](config[_0x695b('0x6e')],_0x695b('0x6f'));var _0x4e452b={'where':{'id':_0x2ba3a8[_0x695b('0x4b')]['id']},'attributes':['id',_0x695b('0x65')],'raw':!![]};var _0x2f1f54=![];return require(_0x695b('0x70'))[_0x695b('0x71')]()[_0x695b('0x16')](function(_0x3d87f6){if(_0x3d87f6){_0x2f1f54=_0x3d87f6[_0x695b('0x72')];}})[_0x695b('0x16')](function(){return db['ChatWebsite'][_0x695b('0x57')](_0x4e452b);})[_0x695b('0x16')](handleEntityNotFound(_0x167724,null))['then'](function(_0xfcadd5){if(_0xfcadd5){if(!_['isNil'](_0xfcadd5[_0x695b('0x65')])){if(fs['existsSync'](path[_0x695b('0x73')](config['root'],_0x695b('0x74'),_0xfcadd5['sitepic']))&&_0x2f1f54){_0x3b698d=path[_0x695b('0x73')](config[_0x695b('0x6e')],'server/files/images/logos/',_0xfcadd5[_0x695b('0x65')]);}}return _0x167724[_0x695b('0x75')](_0x3b698d);}})[_0x695b('0x20')](handleError(_0x167724,null));};exports[_0x695b('0x76')]=function(_0x3ae23a,_0x368167){var _0xcd5d75=path[_0x695b('0x73')](config[_0x695b('0x6e')],_0x695b('0x77'));var _0x128363={'where':{'id':_0x3ae23a[_0x695b('0x4b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x695b('0x34')][_0x695b('0x57')](_0x128363)[_0x695b('0x16')](handleEntityNotFound(_0x368167,null))['then'](function(_0xc37a1a){if(_0xc37a1a){if(!_[_0x695b('0x78')](_0xc37a1a[_0x695b('0x79')])){if(fs[_0x695b('0x7a')](path['join'](config[_0x695b('0x6e')],_0x695b('0x7b'),_0xc37a1a[_0x695b('0x79')]))){_0xcd5d75=path[_0x695b('0x73')](config[_0x695b('0x6e')],'server/files/images/avatars/',_0xc37a1a[_0x695b('0x79')]);}}return _0x368167[_0x695b('0x75')](_0xcd5d75);}})['catch'](handleError(_0x368167,null));};exports['getCustomerAvatar']=function(_0x4f3b00,_0xa072d5){var _0x226e5f=path['join'](config[_0x695b('0x6e')],_0x695b('0x7c'));var _0x4fdb52={'where':{'id':_0x4f3b00['params']['id']},'attributes':['id',_0x695b('0x6a'),_0x695b('0x7d')],'raw':!![]};return db[_0x695b('0x34')][_0x695b('0x57')](_0x4fdb52)[_0x695b('0x16')](handleEntityNotFound(_0xa072d5,null))[_0x695b('0x16')](function(_0x10e62d){if(_0x10e62d){if(!_[_0x695b('0x78')](_0x10e62d[_0x695b('0x6a')])){if(fs[_0x695b('0x7a')](path[_0x695b('0x73')](config['root'],_0x695b('0x7b'),_0x10e62d[_0x695b('0x6a')]))&&_0x10e62d[_0x695b('0x7d')]){_0x226e5f=path[_0x695b('0x73')](config['root'],_0x695b('0x7b'),_0x10e62d[_0x695b('0x6a')]);}}return _0xa072d5[_0x695b('0x75')](_0x226e5f);}})[_0x695b('0x20')](handleError(_0xa072d5,null));};exports[_0x695b('0x7e')]=function(_0x3e88e0,_0x2a01df){var _0x4e8c55=path[_0x695b('0x73')](config[_0x695b('0x6e')],_0x695b('0x7f'));var _0xd237fa={'where':{'id':_0x3e88e0[_0x695b('0x4b')]['id']},'attributes':['id',_0x695b('0x6c')],'raw':!![]};return db['ChatWebsite'][_0x695b('0x57')](_0xd237fa)[_0x695b('0x16')](handleEntityNotFound(_0x2a01df,null))[_0x695b('0x16')](function(_0x51e1e7){if(_0x51e1e7){if(!_[_0x695b('0x78')](_0x51e1e7[_0x695b('0x6c')])){if(fs[_0x695b('0x7a')](path['join'](config[_0x695b('0x6e')],_0x695b('0x7b'),_0x51e1e7[_0x695b('0x6c')]))){_0x4e8c55=path['join'](config[_0x695b('0x6e')],_0x695b('0x7b'),_0x51e1e7[_0x695b('0x6c')]);}}return _0x2a01df[_0x695b('0x75')](_0x4e8c55);}})[_0x695b('0x20')](handleError(_0x2a01df,null));};exports[_0x695b('0x80')]=function(_0x1d0317,_0x11cde9){var _0x53be05=require(_0x695b('0x81'));var _0xaa5bcd=new _0x53be05();var _0x53ab26=_0xaa5bcd['setUA'](_0x1d0317[_0x695b('0x82')][_0x695b('0x83')])[_0x695b('0x84')]();var _0x4a6254={'body':_0x1d0317[_0x695b('0x50')],'channel':'chat'};var _0x937e4f=[];var _0x1418b9=[];var _0xe619af={};var _0x3a90f7=![];return db[_0x695b('0x85')][_0x695b('0x58')]()['then'](function(_0x5a1b6e){if(!_0x5a1b6e){throw new db[(_0x695b('0x86'))]['ValidationError'](_0x695b('0x87'));}_0x937e4f=_['difference'](_[_0x695b('0x4c')](_0x5a1b6e),[_0x695b('0x88'),'updatedAt']);_0x1418b9=_['difference'](_[_0x695b('0x4c')](_0x5a1b6e),[_0x695b('0x88'),_0x695b('0x89'),_0x695b('0x8a'),_0x695b('0x8b')]);if(_0x1d0317[_0x695b('0x50')]['id']){delete _0x1d0317[_0x695b('0x50')]['id'];}if(_[_0x695b('0x78')](_0x1d0317[_0x695b('0x50')][_0x695b('0x8c')])){throw new db[(_0x695b('0x86'))][(_0x695b('0x8d'))](_0x695b('0x8e'));}if(_[_0x695b('0x78')](_0x1d0317[_0x695b('0x50')][_0x695b('0x50')])||_0x1d0317['body'][_0x695b('0x50')]===''){throw new db[(_0x695b('0x86'))][(_0x695b('0x8d'))](_0x695b('0x8f'));}if(_['isNil'](_0x1d0317['body']['mapKey'])){throw new db[(_0x695b('0x86'))][(_0x695b('0x8d'))](_0x695b('0x90')+_0x1418b9);}if(!_[_0x695b('0x91')](_0x1418b9,_0x1d0317[_0x695b('0x50')]['mapKey'])){throw new db[(_0x695b('0x86'))]['ValidationError'](_0x695b('0x92')+_0x1418b9);}_0xe619af[_0x1d0317[_0x695b('0x50')][_0x695b('0x93')]]=_0x1d0317['body'][_0x695b('0x8c')];})[_0x695b('0x16')](function(){return db[_0x695b('0x34')]['find']({'where':{'id':_0x1d0317[_0x695b('0x4b')]['id']},'include':[{'model':db[_0x695b('0x94')],'as':'List','include':[{'model':db[_0x695b('0x85')],'as':_0x695b('0x95'),'where':_0xe619af,'limit':0x1,'order':[[_0x695b('0x89'),_0x695b('0x96')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x695b('0x16')](handleEntityNotFound(_0x11cde9,null))[_0x695b('0x16')](function(_0x15feeb){if(_0x15feeb&&_0x15feeb['List']){_0x4a6254[_0x695b('0x97')]=_0x15feeb;_0x4a6254['applications']=_0x15feeb['Applications'];_0x4a6254[_0x695b('0x98')]=_0x15feeb[_0x695b('0x99')];_0x4a6254[_0x695b('0x9a')]=_[_0x695b('0x9b')](_0x4a6254[_0x695b('0x9a')],[_0x695b('0x9c')],[_0x695b('0x9d')]);if(_0x4a6254[_0x695b('0x97')]['Applications']){delete _0x4a6254[_0x695b('0x97')]['Applications'];}if(_0x4a6254[_0x695b('0x97')][_0x695b('0x99')]&&_0x4a6254[_0x695b('0x97')][_0x695b('0x99')]['Contacts'][_0x695b('0x5d')]){return _0x4a6254[_0x695b('0x97')][_0x695b('0x99')][_0x695b('0x95')][0x0];}var _0x1819a2=_[_0x695b('0xd')](_0x1d0317['body'],{'firstName':_0x1d0317[_0x695b('0x50')][_0x695b('0x8c')],'ListId':_0x15feeb[_0x695b('0x8b')]});_0x1819a2[_0x1d0317[_0x695b('0x50')][_0x695b('0x93')]]=_0x1d0317[_0x695b('0x50')][_0x695b('0x8c')];return db['CmContact'][_0x695b('0x4f')](_0x1819a2,{'fields':_0x937e4f,'raw':!![]});}})[_0x695b('0x16')](handleEntityNotFound(_0x11cde9,null))['then'](function(_0x2f3b43){_0x4a6254[_0x695b('0x9e')]=_0x2f3b43;var _0x254c4f=_0x1d0317['body']['customerIp'];if(_0x1d0317[_0x695b('0x82')][_0x695b('0x9f')]){_0x254c4f=_0x1d0317[_0x695b('0x82')][_0x695b('0x9f')];}else if(_0x1d0317['headers'][_0x695b('0xa0')]){_0x254c4f=_[_0x695b('0xa1')](_0x1d0317[_0x695b('0x82')][_0x695b('0xa0')][_0x695b('0xa2')](','));}if(_0x2f3b43){var _0x1ca6cc={'ContactId':_0x2f3b43['id'],'ChatWebsiteId':_0x1d0317[_0x695b('0x4b')]['id'],'from':(_0x2f3b43[_0x695b('0xa3')]||'')+'\x20'+(_0x2f3b43['lastName']||''),'customerIp':_0x254c4f,'customerPort':_0x1d0317[_0x695b('0x82')][_0x695b('0xa4')]?_0x1d0317[_0x695b('0x82')]['x-real-port']:null,'referer':_0x1d0317['body'][_0x695b('0xa5')],'browserName':_0x53ab26[_0x695b('0xa6')]['name']&&_0x53ab26[_0x695b('0xa6')]['version']?util[_0x695b('0xa7')]('%s\x20%s',_0x53ab26['browser']['name'],_0x53ab26[_0x695b('0xa6')]['version']):_0x695b('0xa8'),'browserVersion':_0x53ab26[_0x695b('0xa6')][_0x695b('0xa9')]||'unknown','osName':util[_0x695b('0xa7')](_0x695b('0xaa'),_0x53ab26['os'][_0x695b('0x2f')],_0x53ab26['os']['version']),'osVersion':_0x53ab26['os'][_0x695b('0xa9')],'deviceModel':_0x53ab26[_0x695b('0xab')][_0x695b('0x37')]&&_0x53ab26[_0x695b('0xab')][_0x695b('0xac')]?util[_0x695b('0xa7')](_0x695b('0xad'),_0x53ab26[_0x695b('0xab')]['model'],_0x53ab26[_0x695b('0xab')][_0x695b('0xac')],_0x53ab26[_0x695b('0xab')][_0x695b('0x35')]):null,'deviceVendor':_0x53ab26['device'][_0x695b('0xac')],'deviceType':_0x53ab26['device'][_0x695b('0x35')],'formData':JSON[_0x695b('0xae')](_0x1d0317[_0x695b('0x50')])};var _0x4c1b9b={'ChatWebsiteId':_0x1d0317['params']['id'],'closed':![]};if(_0x1d0317['body']['threadId']){_0x4c1b9b[_0x695b('0xaf')]=_0x1d0317[_0x695b('0x50')][_0x695b('0xaf')];return db['ChatInteraction'][_0x695b('0x57')]({'where':_0x4c1b9b})['then'](function(_0x423044){if(_0x423044){return[_0x423044,![]];}_0x1ca6cc[_0x695b('0xaf')]=_0x1d0317['body'][_0x695b('0xaf')];_0x1ca6cc['externalUrl']=_0x1d0317[_0x695b('0x50')]['externalUrl'];return db['ChatInteraction'][_0x695b('0x4f')](_0x1ca6cc)[_0x695b('0x16')](function(_0x3bb880){return[_0x3bb880,!![]];});});}_0x4c1b9b[_0x695b('0xb0')]=_0x2f3b43['id'];if(_0x1d0317['body']['interaction']&&_0x1d0317[_0x695b('0x50')][_0x695b('0xb1')]['id']){_0x4c1b9b['id']=_0x1d0317[_0x695b('0x50')][_0x695b('0xb1')]['id'];return db['ChatInteraction'][_0x695b('0x57')]({'where':_0x4c1b9b})[_0x695b('0x16')](function(_0x7bf4c6){if(_0x7bf4c6){return[_0x7bf4c6,![]];}return db[_0x695b('0xb2')][_0x695b('0x4f')](_0x1ca6cc)[_0x695b('0x16')](function(_0x253dc1){return[_0x253dc1,!![]];});});}return db[_0x695b('0xb2')][_0x695b('0x4f')](_0x1ca6cc)[_0x695b('0x16')](function(_0x5e0b67){return[_0x5e0b67,!![]];});}})[_0x695b('0xb3')](function(_0x5962d2,_0x13ba4d){if(_0x5962d2){_0x3a90f7=_0x13ba4d;if(!_0x13ba4d){var _0x46096b={'from':(_0x4a6254[_0x695b('0x9e')][_0x695b('0xa3')]||'')+'\x20'+(_0x4a6254[_0x695b('0x9e')][_0x695b('0xb4')]||'')};if(_0x1d0317[_0x695b('0x50')]['threadId']&&_0x1d0317['body'][_0x695b('0xb5')]&&_0x1d0317['body']['threadId']!=_0x1d0317[_0x695b('0x50')]['messageId']){_0x46096b[_0x695b('0xaf')]=_0x1d0317['body'][_0x695b('0xb5')];}return _0x5962d2[_0x695b('0x2a')](_0x46096b);}else{return _0x5962d2;}}})[_0x695b('0x16')](function(_0x81455e){_0x4a6254[_0x695b('0xb1')]=_0x81455e['get']({'plain':!![]});_0x4a6254[_0x695b('0xb1')][_0x695b('0xb6')]=_0x3a90f7;if(_0x4a6254[_0x695b('0xb1')][_0x695b('0xb6')]){if(_0x4a6254[_0x695b('0x97')][_0x695b('0xb7')]){_0x4a6254[_0x695b('0x9a')][_0x695b('0xb8')]({'id':0x0,'priority':_0x4a6254[_0x695b('0x9a')][_0x695b('0x5d')]+0x1,'app':_0x695b('0xb9'),'appdata':'unmanaged','interval':_0x695b('0xba')});}}return db[_0x695b('0xbb')][_0x695b('0x4f')]({'body':_0x1d0317[_0x695b('0x50')][_0x695b('0x50')],'ChatWebsiteId':_0x1d0317['params']['id'],'ChatInteractionId':_0x81455e['id'],'direction':'in','ContactId':_0x4a6254[_0x695b('0x9e')]['id'],'AttachmentId':_0x1d0317['body'][_0x695b('0xbc')]});})[_0x695b('0x16')](function(_0x58f198){_0x4a6254[_0x695b('0x1e')]=_0x58f198;if(_0x4a6254[_0x695b('0xb1')][_0x695b('0xbd')]){return db[_0x695b('0xbe')][_0x695b('0x57')]({'attributes':['id',_0x695b('0x2f')],'where':{'id':_0x4a6254['interaction'][_0x695b('0xbd')]}})['then'](function(_0x5ad216){if(_0x5ad216){_0x4a6254[_0x695b('0x9a')][_0x695b('0xbf')]({'id':0x0,'priority':0x0,'app':_0x695b('0xc0'),'appdata':_0x5ad216['name']+','+(_0x4a6254[_0x695b('0x97')][_0x695b('0xc1')]||0xa),'interval':_0x695b('0xba')});_0x4a6254['forcedOwnership']=!![];}return respondWithRpcPromise(_0x695b('0xc2'),_0x695b('0xc3'),_0x4a6254);});}return respondWithRpcPromise('Start',_0x695b('0xc3'),_0x4a6254);})['then'](function(_0x3952e1){respondWithRpcPromise('EventManager',_0x695b('0xc4'),{'event':_0x695b('0x80'),'message':_0x3952e1},client9002);return _0x3952e1;})[_0x695b('0x16')](respondWithResult(_0x11cde9,null))[_0x695b('0x20')](handleError(_0x11cde9,null));};exports['offline']=function(_0x47c763,_0x1c913c){var _0x91c4e5,_0x3d8361,_0x51de58;var _0x5712bc=[];var _0x3babf7={};var _0x3f01fe=_0x47c763[_0x695b('0xc5')]||[];var _0x37c31c=[];var _0x3b4d4f;return db[_0x695b('0x85')]['describe']()['then'](function(_0x51165b){if(!_0x51165b){throw new db[(_0x695b('0x86'))][(_0x695b('0x8d'))]('no\x20available\x20attributes');}_0x5712bc=_[_0x695b('0xc6')](_[_0x695b('0x4c')](_0x51165b),[_0x695b('0x88'),'updatedAt',_0x695b('0x8a'),'ListId']);if(_0x47c763[_0x695b('0x50')]['id']){delete _0x47c763['body']['id'];}if(_[_0x695b('0x78')](_0x47c763['body'][_0x695b('0x8c')])){throw _0x1c913c[_0x695b('0x22')](0x1f4)[_0x695b('0x30')](new db[(_0x695b('0x86'))][(_0x695b('0x8d'))]('from\x20is\x20mandatory'));}if(_[_0x695b('0x78')](_0x47c763[_0x695b('0x50')]['body'])||_0x47c763[_0x695b('0x50')][_0x695b('0x50')]===''){throw _0x1c913c[_0x695b('0x22')](0x1f4)[_0x695b('0x30')](new db[(_0x695b('0x86'))][(_0x695b('0x8d'))](_0x695b('0x8f')));}if(_['isNil'](_0x47c763[_0x695b('0x50')][_0x695b('0xc7')])){throw _0x1c913c['status'](0x1f4)[_0x695b('0x30')](new db[(_0x695b('0x86'))][(_0x695b('0x8d'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5712bc));}if(!_[_0x695b('0x91')](_0x5712bc,_0x47c763[_0x695b('0x50')][_0x695b('0xc7')])){throw _0x1c913c[_0x695b('0x22')](0x1f4)['send'](new db['Sequelize'][(_0x695b('0x8d'))](_0x695b('0xc8')+_0x5712bc));}_0x3babf7[_0x47c763['body'][_0x695b('0xc7')]]=_0x47c763[_0x695b('0x50')][_0x695b('0x8c')];})[_0x695b('0x16')](function(){return db[_0x695b('0x34')][_0x695b('0x57')]({'where':{'id':_0x47c763[_0x695b('0x4b')]['id']},'include':[{'model':db[_0x695b('0x94')],'as':_0x695b('0x99')},{'model':db['MailAccount'],'as':_0x695b('0xc9')}]});})[_0x695b('0x16')](handleEntityNotFound(_0x1c913c,null))[_0x695b('0x16')](function(_0x5a0ef5){if(_0x5a0ef5&&_0x5a0ef5['List']){_0x3d8361=_0x5a0ef5;var _0x541e45=_[_0x695b('0xd')](_0x47c763[_0x695b('0x50')],{'firstName':_0x47c763['body'][_0x695b('0x8c')],'phone':_0x47c763[_0x695b('0x50')][_0x695b('0x8c')],'ListId':_0x5a0ef5[_0x695b('0x8b')]});_0x541e45[_0x47c763['body'][_0x695b('0xc7')]]=_0x47c763['body'][_0x695b('0x8c')];return db[_0x695b('0x85')][_0x695b('0xca')]({'where':_0x3babf7,'defaults':_0x541e45});}})[_0x695b('0xb3')](function(_0xcf7387){if(_0xcf7387){_0x51de58=_0xcf7387;var _0x2f0a61=fs['readFileSync'](path[_0x695b('0x73')](config[_0x695b('0x6e')],_0x695b('0xcb')),_0x695b('0xcc'));var _0xae9b92=ejs['render'](_0x2f0a61,{'body':_[_0x695b('0xcd')](_0x47c763[_0x695b('0x50')]['body']),'bodyTitle':_0x3d8361[_0x695b('0xce')]});return db[_0x695b('0xcf')][_0x695b('0x4f')]({'body':_0xae9b92,'plainBody':htmlToText[_0x695b('0xd0')](_0xae9b92),'ContactId':_0xcf7387['id'],'ChatWebsiteId':_0x3d8361['id']});}})[_0x695b('0x16')](function(_0x18cf5){_0x3b4d4f=_0x18cf5;if(_0x3f01fe[_0x695b('0x5d')]){var _0x1c0e82=_0x3f01fe[_0x695b('0x38')](function(_0x1426f6){return{'name':_0x1426f6['originalname'],'basename':_0x1426f6['filename'],'type':_0x1426f6[_0x695b('0xd1')],'ChatOfflineMessageId':_0x18cf5['id']};});_0x37c31c=_0x1c0e82['map'](_0x174818=>{var _0x29c3b2={'filename':_0x174818[_0x695b('0x2f')],'path':path[_0x695b('0x73')](config[_0x695b('0x6e')],_0x695b('0xd2'),_0x695b('0xc5'),_0x695b('0xd3'),'offline-chat',_0x174818[_0x695b('0xd4')])};return _0x29c3b2;});if(!_0x3d8361[_0x695b('0xd5')]){return db[_0x695b('0xd6')][_0x695b('0xd7')](function(_0x6484da){return db[_0x695b('0xd8')][_0x695b('0xd9')](_0x1c0e82,{'transaction':_0x6484da});});}}})['then'](function(){if(_0x3b4d4f){_0x91c4e5=_0x3b4d4f;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x695b('0xda')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x695b('0xdb')],'as':_0x695b('0xdb'),'raw':!![]}]}]});}})[_0x695b('0x16')](function(_0x6ddac6){if(_0x6ddac6&&_0x6ddac6['Smtp']&&_0x3d8361[_0x695b('0xdc')]&&_0x3d8361[_0x695b('0xdd')]){var _0x3a5575=_0x6ddac6['getSmtpOptions']();return respondWithRpcPromise(_0x695b('0xde'),_0x695b('0xdf'),{'account':_0x3a5575,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x6ddac6[_0x695b('0x2f')],_0x6ddac6[_0x695b('0xe0')]||_0x6ddac6[_0x695b('0xe1')]['user']),'to':_0x3d8361[_0x695b('0xdd')],'subject':_0x3d8361[_0x695b('0xe2')],'html':_0x91c4e5[_0x695b('0x50')],'attachments':_0x37c31c}},client9003)[_0x695b('0x16')](function(){return _0x91c4e5;})[_0x695b('0x20')](function(_0x49311e){logger[_0x695b('0x1c')](_0x49311e);});}})[_0x695b('0x16')](function(){if(_0x3d8361&&_0x3d8361[_0x695b('0xd5')]&&_0x3d8361[_0x695b('0xe3')]){var _0x1a8df4=[];if(_0x3f01fe['length']){_0x1a8df4=_0x3f01fe[_0x695b('0x38')](function(_0x24f29d){return{'name':_0x24f29d['originalname'],'basename':_0x24f29d['filename'],'type':_0x24f29d[_0x695b('0xd1')],'ChatOfflineMessageId':_0x3b4d4f['id']};});}var _0x19d1a6;if(!_[_0x695b('0x78')](_0x3d8361[_0x695b('0xe4')])){var _0x41dbc0=_[_0x695b('0x38')](_0x47c763[_0x695b('0x50')],function(_0x2af248){return _0x2af248;});var _0x315d57=_[_0x695b('0xe5')](_0x41dbc0)[0x0];var _0x2c06f1=_['mapValues'](_0x315d57,function(_0x52f281){return _0x52f281;});_0x19d1a6=_0x2c06f1[0x1][_0x3d8361[_0x695b('0xe4')]];}var _0x58a56e={'from':_0x51de58[_0x695b('0xe0')],'firstName':_0x51de58[_0x695b('0xa3')],'lastName':_0x51de58[_0x695b('0xb4')],'mapKey':_0x695b('0xe0'),'message':{'from':_0x51de58[_0x695b('0xe0')],'to':_0x3d8361[_0x695b('0xc9')][_0x695b('0xe0')],'cc':'','subject':_[_0x695b('0x78')](_0x19d1a6)?_0x3d8361[_0x695b('0xe2')]:_0x19d1a6,'messageId':'','sentAt':new Date(),'attach':_0x1a8df4[_0x695b('0x5d')],'attachments':_0x1a8df4,'originChannel':_0x695b('0xe6'),'ChatWebsiteId':_0x3d8361['id'],'ChatOfflineMessageId':_0x91c4e5['id'],'originTo':_0x3d8361[_0x695b('0xc9')][_0x695b('0xe0')]},'body':_0x91c4e5[_0x695b('0x50')]};var _0x511095={'account':{'id':_0x3d8361['MailAccountId']},'body':_0x58a56e,'log':_0x695b('0xe7')};return respondWithRpcPromise(_0x695b('0xe7'),_0x695b('0xe8'),_0x511095,client9001)['then'](function(){return _0x91c4e5;})[_0x695b('0x20')](function(_0x2fdccc){logger[_0x695b('0x1c')](_0x2fdccc);});}return;})[_0x695b('0x16')](function(){if(_0x91c4e5){return _0x91c4e5;}})['then'](respondWithResult(_0x1c913c,null))[_0x695b('0x20')](function(_0x2a2dc7){logger['error'](_0x695b('0x20'),_0x2a2dc7);for(var _0xa8cb31 of _0x3f01fe){var _0x269a9e=path[_0x695b('0x73')](config[_0x695b('0x6e')],_0x695b('0xd2'),_0x695b('0xc5'),_0x695b('0xd3'),_0x695b('0xe9'),_0xa8cb31[_0x695b('0x66')]);fs_extra[_0x695b('0xea')](_0x269a9e)[_0x695b('0x20')](function(_0xac5cf2){logger[_0x695b('0x1c')](_0x695b('0xeb'),_0x269a9e,_0xac5cf2);});}});};exports[_0x695b('0xec')]=function(_0x5b42a2,_0x5da510){return db[_0x695b('0xb2')][_0x695b('0x57')]({'where':{'id':_0x5b42a2[_0x695b('0x4b')]['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x5da510,null))[_0x695b('0x16')](function(_0x4e1ce3){if(_0x4e1ce3){return _0x4e1ce3[_0x695b('0xec')](_0x5b42a2[_0x695b('0x50')][_0x695b('0x60')],_[_0x695b('0xed')](_0x5b42a2[_0x695b('0x50')],['ids','id'])||{});}})['then'](respondWithResult(_0x5da510,null))[_0x695b('0x20')](handleError(_0x5da510,null));};exports[_0x695b('0xee')]=function(_0x1f3264,_0x43f9ba){var _0x25f421={'raw':![],'where':{}};var _0x50a788={};var _0x3e0ff1={'count':0x0,'rows':[]};return db[_0x695b('0x34')]['findOne']({'where':{'id':_0x1f3264[_0x695b('0x4b')]['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x43f9ba,null))[_0x695b('0x16')](function(_0x5dff7a){if(_0x5dff7a){_0x50a788[_0x695b('0x37')]=_['keys'](db[_0x695b('0xb2')][_0x695b('0x4d')]);_0x50a788[_0x695b('0x39')]=_[_0x695b('0x4c')](_0x1f3264['query']);_0x50a788[_0x695b('0x3a')]=_[_0x695b('0x3b')](_0x50a788['model'],_0x50a788[_0x695b('0x39')]);_0x25f421[_0x695b('0x3c')]=_['intersection'](_0x50a788[_0x695b('0x37')],qs[_0x695b('0x3d')](_0x1f3264[_0x695b('0x39')]['fields']));_0x25f421['attributes']=_0x25f421[_0x695b('0x3c')][_0x695b('0x5d')]?_0x25f421[_0x695b('0x3c')]:_0x50a788[_0x695b('0x37')];if(!_0x1f3264[_0x695b('0x39')][_0x695b('0x3e')]('nolimit')){_0x25f421[_0x695b('0x28')]=qs[_0x695b('0x28')](_0x1f3264[_0x695b('0x39')][_0x695b('0x28')]);_0x25f421['offset']=qs[_0x695b('0x27')](_0x1f3264[_0x695b('0x39')][_0x695b('0x27')]);}_0x25f421[_0x695b('0x40')]=qs[_0x695b('0x41')](_0x1f3264[_0x695b('0x39')][_0x695b('0x41')]);_0x25f421[_0x695b('0x42')]=qs['filters'](_[_0x695b('0x43')](_0x1f3264[_0x695b('0x39')],_0x50a788[_0x695b('0x3a')]));_0x25f421[_0x695b('0x42')][_0x695b('0x5e')]=_0x5dff7a['id'];if(_0x1f3264['query']['filter']){_0x25f421[_0x695b('0x42')]=_[_0x695b('0x46')](_0x25f421[_0x695b('0x42')],{'$or':_[_0x695b('0x38')](_0x25f421[_0x695b('0x3c')],function(_0x2800c2){var _0x5d7501={};_0x5d7501[_0x2800c2]={'$like':'%'+_0x1f3264['query'][_0x695b('0x44')]+'%'};return _0x5d7501;})});}_0x25f421=_[_0x695b('0x46')]({},_0x25f421,_0x1f3264[_0x695b('0x47')]);return db[_0x695b('0xb2')][_0x695b('0x26')]({'where':_0x25f421['where']})[_0x695b('0x16')](function(_0x116352){_0x3e0ff1[_0x695b('0x26')]=_0x116352;if(_0x1f3264[_0x695b('0x39')][_0x695b('0x48')]){_0x25f421['include']=[{'model':db[_0x695b('0x85')],'as':'Contact','required':![]},{'model':db[_0x695b('0xbe')],'as':_0x695b('0xef'),'attributes':[_0x695b('0x2f'),'fullname',_0x695b('0xf0')],'required':![]},{'model':db[_0x695b('0xf1')],'as':_0x695b('0xf2'),'attributes':['id','name',_0x695b('0xf3')],'where':_0x1f3264['query'][_0x695b('0xf4')]?{'id':_0x1f3264[_0x695b('0x39')][_0x695b('0xf4')]}:undefined,'required':_0x1f3264['query'][_0x695b('0xf4')]?!![]:![]}];}return db[_0x695b('0xb2')]['findAll'](_0x25f421);})[_0x695b('0x16')](function(_0x3507e0){_0x3e0ff1['rows']=_0x3507e0;return _0x3e0ff1;});}})['then'](respondWithFilteredResult(_0x43f9ba,_0x25f421))['catch'](handleError(_0x43f9ba,null));};function iftimePromise(_0x288474,_0xdf18f0){return respondWithRpcPromise(_0x695b('0xf5'),'getSnippet',{'command':_0xdf18f0[_0x695b('0xf6')]?util[_0x695b('0xa7')](_0x695b('0xf7'),_0x288474[_0x695b('0xf8')],_0xdf18f0['timezone']):util[_0x695b('0xa7')](_0x695b('0xf9'),_0x288474['interval'])},client9002)[_0x695b('0x16')](function(_0x575881){var _0x14a25b=_0x575881&&_0x575881[_0x695b('0xfa')](_0x695b('0xfb'))>=0x0?!![]:![];logger[_0x695b('0x17')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xdf18f0['id'],_0x288474['id'],_0x288474[_0x695b('0xf8')],_0x14a25b?_0x695b('0xfc'):'OFFLINE',_0xdf18f0[_0x695b('0xf6')]?_0xdf18f0['timezone']:'No\x20timezone');return _0x14a25b;})[_0x695b('0x20')](function(_0x253d87){logger[_0x695b('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xdf18f0['id'],_0x288474['id'],_0x288474[_0x695b('0xf8')],util[_0x695b('0xfd')](_0x253d87,{'showHidden':![],'depth':null}),_0xdf18f0['timezone']?_0xdf18f0[_0x695b('0xf6')]:_0x695b('0xfe'));return![];});}exports[_0x695b('0xff')]=function(_0x35a7cf,_0x4ca8c8){var _0x32f940=0x0;var _0x292cec=0x0;var _0x29f2b8=![];var _0x4b485f;var _0x3deedf;return db[_0x695b('0x34')][_0x695b('0x57')]({'where':{'id':_0x35a7cf[_0x695b('0x4b')]['id']},'include':[{'model':db[_0x695b('0x100')],'as':_0x695b('0x100'),'include':[{'model':db[_0x695b('0x100')],'as':'Intervals','attributes':['id',_0x695b('0xf8')],'raw':!![]}]}]})[_0x695b('0x16')](handleEntityNotFound(_0x4ca8c8,null))['then'](function(_0x448d7d){if(_0x448d7d){_0x4b485f=_0x448d7d;return _0x448d7d[_0x695b('0x101')]({'raw':!![]});}})[_0x695b('0x16')](function(_0x236569){if(_0x4b485f){if(_0x236569){_0x3deedf=_0x236569;}}return require(_0x695b('0x70'))[_0x695b('0x71')]();})[_0x695b('0x16')](function(_0x15ea98){if(_0x15ea98){_0x292cec=_0x15ea98[_0x695b('0x102')];_0x29f2b8=_0x15ea98[_0x695b('0x72')];}})[_0x695b('0x16')](function(){return db[_0x695b('0xb2')][_0x695b('0x26')]({'where':{'closed':![]}});})[_0x695b('0x16')](function(_0x334c7b){_0x32f940=_0x334c7b;if(_0x292cec&&_0x334c7b>_0x292cec){return db[_0x695b('0x103')][_0x695b('0x5c')]({'where':{'id':0x1}})[_0x695b('0x16')](function(_0x540b44){if(_0x540b44){_0x540b44[_0x695b('0x104')]('chatLicenseExceeded');}});}})[_0x695b('0x16')](function(){if(_0x4b485f[_0x695b('0x100')]&&_0x4b485f[_0x695b('0x100')][_0x695b('0x105')]){var _0x39d369=[];for(var _0x268a24=0x0;_0x268a24<_0x4b485f[_0x695b('0x100')][_0x695b('0x105')][_0x695b('0x5d')];_0x268a24++){var _0x1f0cf2=_0x4b485f[_0x695b('0x100')][_0x695b('0x105')][_0x268a24][_0x695b('0x2c')]({'plain':!![]});_0x39d369['push'](iftimePromise(_0x1f0cf2,_0x4b485f));}return BPromise['all'](_0x39d369)[_0x695b('0x16')](function(_0x2e4eb9){return _['some'](_0x2e4eb9);});}else{return!![];}})[_0x695b('0x16')](function(_0x11643f){var _0x45bd98=fs[_0x695b('0x106')](path[_0x695b('0x73')](config[_0x695b('0x6e')],'server/files/chat/iframe.ejs'),'utf8');var _0x36496a={'remote':_0x4b485f[_0x695b('0x107')],'query':querystring[_0x695b('0xae')](_[_0x695b('0x46')](_0x4b485f[_0x695b('0x2c')]({'plain':!![]}),{'customerIp':_0x35a7cf[_0x695b('0x82')]['x-forwarded-for']||_0x35a7cf[_0x695b('0x82')][_0x695b('0x108')]||_0x35a7cf['connection'][_0x695b('0x109')]||_0x35a7cf['ip'],'referer':_0x35a7cf[_0x695b('0x82')][_0x695b('0xa5')],'openedInteractions':_0x32f940,'maxInteractions':_0x292cec,'virtual':_0x29f2b8[_0x695b('0x102')],'online':_0x11643f,'custom':_0x29f2b8}))[_0x695b('0x10a')](/'/g,'\x5c\x27')};_0x4ca8c8['send'](ejs[_0x695b('0x10b')](Mustache['render'](_0x45bd98,_0x36496a),{'proactiveActions':_0x3deedf,'alignment':_0x4b485f[_0x695b('0x10c')],'verticalAlignment':_0x4b485f[_0x695b('0x10d')],'div_color':_0x4b485f['color'],'labelText':_0x4b485f[_0x695b('0x10e')],'text_color':_0x4b485f['textColor'],'text_button_color':_0x4b485f[_0x695b('0x10f')],'button_color':_0x4b485f[_0x695b('0x110')],'background_color':_0x4b485f[_0x695b('0x111')],'hideWhenOffline':_0x4b485f[_0x695b('0x112')],'interval':_0x4b485f[_0x695b('0x113')]}));})[_0x695b('0x20')](handleError(_0x4ca8c8,null));};exports[_0x695b('0x114')]=function(_0x3bd97c,_0x20b7fb){var _0x31a0d6=_0x3bd97c[_0x695b('0x4b')]['id'];var _0x15fce2=_0x3bd97c[_0x695b('0x50')];var _0x2a9f25=0xc8;var _0x15fb59=null;return db[_0x695b('0xd6')]['transaction']({'isolationLevel':db[_0x695b('0xd6')]['Transaction'][_0x695b('0x115')][_0x695b('0x116')]},function(_0x3732ef){return db[_0x695b('0x34')][_0x695b('0x5c')]({'where':{'id':_0x31a0d6},'transaction':_0x3732ef})[_0x695b('0x16')](function(_0x4b555d){if(_0x4b555d){return db[_0x695b('0x117')][_0x695b('0x2b')]({'where':{'ChatWebsiteId':_0x31a0d6},'transaction':_0x3732ef})[_0x695b('0x16')](function(){var _0x4d152e=_['map'](_0x15fce2,function(_0x29b92f){_0x29b92f[_0x695b('0x5e')]=_0x31a0d6;return _0x29b92f;});return db['ChatApplication'][_0x695b('0xd9')](_0x4d152e,{'transaction':_0x3732ef});});}else{_0x2a9f25=0x194;_0x15fb59=[];}});})[_0x695b('0x16')](function(){if(_0x2a9f25!==0x194){return db[_0x695b('0x117')][_0x695b('0x118')]({'where':{'ChatWebsiteId':_0x31a0d6},'order':'priority'})[_0x695b('0x16')](function(_0x5d7406){_0x15fb59=_0x5d7406;});}})[_0x695b('0x20')](function(_0x198b27){_0x2a9f25=0x1f4;logger[_0x695b('0x1c')](_0x198b27[_0x695b('0x119')]);if(_0x198b27[_0x695b('0x2f')]){delete _0x198b27[_0x695b('0x2f')];}_0x15fb59=_0x198b27;})[_0x695b('0x11a')](function(){if(_0x15fb59===null){_0x20b7fb['sendStatus'](_0x2a9f25);}else{if(_0x2a9f25===0x1f4){_0x20b7fb[_0x695b('0x22')](_0x2a9f25)['send'](_0x15fb59);}else{_0x20b7fb[_0x695b('0x22')](_0x2a9f25)[_0x695b('0x24')](_0x15fb59);}}});};exports[_0x695b('0x11b')]=function(_0x2c10a8,_0x4f1494){var _0x5b8151={};var _0x41d525={};var _0x2e376a;var _0x456af8;return db[_0x695b('0x34')][_0x695b('0x5c')]({'where':{'id':_0x2c10a8['params']['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x4f1494,null))[_0x695b('0x16')](function(_0x39edc9){if(_0x39edc9){_0x2e376a=_0x39edc9;_0x41d525[_0x695b('0x37')]=_['keys'](db[_0x695b('0x117')][_0x695b('0x4d')]);_0x41d525['query']=_[_0x695b('0x4c')](_0x2c10a8[_0x695b('0x39')]);_0x41d525[_0x695b('0x3a')]=_[_0x695b('0x3b')](_0x41d525[_0x695b('0x37')],_0x41d525[_0x695b('0x39')]);_0x5b8151[_0x695b('0x3c')]=_[_0x695b('0x3b')](_0x41d525[_0x695b('0x37')],qs['fields'](_0x2c10a8[_0x695b('0x39')]['fields']));_0x5b8151[_0x695b('0x3c')]=_0x5b8151[_0x695b('0x3c')][_0x695b('0x5d')]?_0x5b8151[_0x695b('0x3c')]:_0x41d525[_0x695b('0x37')];_0x5b8151[_0x695b('0x40')]=qs[_0x695b('0x41')](_0x2c10a8['query'][_0x695b('0x41')]);_0x5b8151[_0x695b('0x42')]=qs[_0x695b('0x3a')](_['pick'](_0x2c10a8[_0x695b('0x39')],_0x41d525['filters']));if(_0x2c10a8[_0x695b('0x39')][_0x695b('0x44')]){_0x5b8151[_0x695b('0x42')]=_[_0x695b('0x46')](_0x5b8151[_0x695b('0x42')],{'$or':_[_0x695b('0x38')](_0x5b8151[_0x695b('0x3c')],function(_0x543dad){var _0x5e0613={};_0x5e0613[_0x543dad]={'$like':'%'+_0x2c10a8[_0x695b('0x39')][_0x695b('0x44')]+'%'};return _0x5e0613;})});}_0x5b8151=_[_0x695b('0x46')]({},_0x5b8151,_0x2c10a8['options']);return _0x2e376a[_0x695b('0x11b')](_0x5b8151);}})[_0x695b('0x16')](function(_0x328b2a){if(_0x328b2a){_0x456af8=_0x328b2a['length'];if(!_0x2c10a8[_0x695b('0x39')][_0x695b('0x3e')](_0x695b('0x3f'))){_0x5b8151[_0x695b('0x28')]=qs['limit'](_0x2c10a8[_0x695b('0x39')][_0x695b('0x28')]);_0x5b8151[_0x695b('0x27')]=qs[_0x695b('0x27')](_0x2c10a8['query'][_0x695b('0x27')]);}return _0x2e376a[_0x695b('0x11b')](_0x5b8151);}})[_0x695b('0x16')](function(_0x2d2e14){if(_0x2d2e14){return _0x2d2e14?{'count':_0x456af8,'rows':_0x2d2e14}:null;}})[_0x695b('0x16')](respondWithResult(_0x4f1494,null))[_0x695b('0x20')](handleError(_0x4f1494,null));};exports[_0x695b('0x11c')]=function(_0x4dc607,_0x52b126){return db[_0x695b('0x11d')][_0x695b('0x57')]({'where':{'id':_0x4dc607['params']['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x52b126,null))['then'](function(_0x27a671){if(_0x27a671){return _0x27a671[_0x695b('0x11c')](_0x4dc607['body'][_0x695b('0x60')],_[_0x695b('0xed')](_0x4dc607[_0x695b('0x50')],['ids','id'])||{});}})[_0x695b('0x16')](respondWithResult(_0x52b126,null))[_0x695b('0x20')](handleError(_0x52b126,null));};exports[_0x695b('0x101')]=function(_0x55b487,_0x5a7a96){var _0x513a71={};var _0x3b54a0={};var _0x43f26f;var _0x446d27;return db[_0x695b('0x34')][_0x695b('0x5c')]({'where':{'id':_0x55b487[_0x695b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7a96,null))[_0x695b('0x16')](function(_0x1f08d2){if(_0x1f08d2){_0x43f26f=_0x1f08d2;_0x3b54a0[_0x695b('0x37')]=_[_0x695b('0x4c')](db[_0x695b('0x11e')][_0x695b('0x4d')]);_0x3b54a0[_0x695b('0x39')]=_[_0x695b('0x4c')](_0x55b487['query']);_0x3b54a0[_0x695b('0x3a')]=_['intersection'](_0x3b54a0[_0x695b('0x37')],_0x3b54a0[_0x695b('0x39')]);_0x513a71[_0x695b('0x3c')]=_[_0x695b('0x3b')](_0x3b54a0[_0x695b('0x37')],qs['fields'](_0x55b487[_0x695b('0x39')]['fields']));_0x513a71['attributes']=_0x513a71['attributes']['length']?_0x513a71[_0x695b('0x3c')]:_0x3b54a0[_0x695b('0x37')];_0x513a71[_0x695b('0x40')]=qs[_0x695b('0x41')](_0x55b487[_0x695b('0x39')][_0x695b('0x41')]);_0x513a71[_0x695b('0x42')]=qs[_0x695b('0x3a')](_[_0x695b('0x43')](_0x55b487[_0x695b('0x39')],_0x3b54a0[_0x695b('0x3a')]));if(_0x55b487['query'][_0x695b('0x44')]){_0x513a71['where']=_['merge'](_0x513a71[_0x695b('0x42')],{'$or':_[_0x695b('0x38')](_0x513a71[_0x695b('0x3c')],function(_0x4516a3){var _0x312b06={};_0x312b06[_0x4516a3]={'$like':'%'+_0x55b487['query']['filter']+'%'};return _0x312b06;})});}_0x513a71=_['merge']({},_0x513a71,_0x55b487[_0x695b('0x47')]);return _0x43f26f[_0x695b('0x101')](_0x513a71);}})['then'](function(_0x514a77){if(_0x514a77){_0x446d27=_0x514a77[_0x695b('0x5d')];if(!_0x55b487[_0x695b('0x39')][_0x695b('0x3e')](_0x695b('0x3f'))){_0x513a71[_0x695b('0x28')]=qs[_0x695b('0x28')](_0x55b487[_0x695b('0x39')]['limit']);_0x513a71['offset']=qs[_0x695b('0x27')](_0x55b487[_0x695b('0x39')][_0x695b('0x27')]);}return _0x43f26f[_0x695b('0x101')](_0x513a71);}})[_0x695b('0x16')](function(_0x414f64){if(_0x414f64){return _0x414f64?{'count':_0x446d27,'rows':_0x414f64}:null;}})[_0x695b('0x16')](respondWithResult(_0x5a7a96,null))[_0x695b('0x20')](handleError(_0x5a7a96,null));};exports[_0x695b('0x11f')]=function(_0x19def8,_0x40a385){var _0x5e8710=_0x19def8[_0x695b('0x39')]['online']==='false'?_0x695b('0x120'):'onlineForm';return db[_0x695b('0x34')][_0x695b('0x57')]({'attributes':['id',_0x5e8710],'where':{'id':_0x19def8[_0x695b('0x4b')]['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x40a385,null))['then'](function(_0x2ad7f9){if(_0x2ad7f9){var _0x3d3353=_0x2ad7f9[_0x5e8710];var _0x2f1b2f=_0x3d3353&&_0x3d3353[_0x695b('0x121')]?_0x3d3353[_0x695b('0x121')]:[];_0x40a385[_0x695b('0x30')]({'fromKey':_[_0x695b('0x78')](_0x3d3353[_0x695b('0x122')])?undefined:_0x3d3353[_0x695b('0x122')],'count':_0x2f1b2f[_0x695b('0x5d')],'rows':_0x2f1b2f});}})['catch'](handleError(_0x40a385,null));};exports['getOfflineMessages']=function(_0x1dbba0,_0xcad2b9){var _0x16a1e9={'raw':![],'where':{}};var _0x3ad505={};var _0x5acee5={'count':0x0,'rows':[]};return db[_0x695b('0x34')]['findOne']({'where':{'id':_0x1dbba0[_0x695b('0x4b')]['id']}})[_0x695b('0x16')](handleEntityNotFound(_0xcad2b9,null))[_0x695b('0x16')](function(_0x2e7294){if(_0x2e7294){_0x3ad505[_0x695b('0x37')]=_[_0x695b('0x4c')](db[_0x695b('0xcf')]['rawAttributes']);_0x3ad505[_0x695b('0x39')]=_[_0x695b('0x4c')](_0x1dbba0[_0x695b('0x39')]);_0x3ad505[_0x695b('0x3a')]=_['intersection'](_0x3ad505['model'],_0x3ad505['query']);_0x16a1e9[_0x695b('0x3c')]=_['intersection'](_0x3ad505['model'],qs[_0x695b('0x3d')](_0x1dbba0['query']['fields']));_0x16a1e9[_0x695b('0x3c')]=_0x16a1e9[_0x695b('0x3c')][_0x695b('0x5d')]?_0x16a1e9[_0x695b('0x3c')]:_0x3ad505[_0x695b('0x37')];if(!_0x1dbba0[_0x695b('0x39')][_0x695b('0x3e')]('nolimit')){_0x16a1e9['limit']=qs[_0x695b('0x28')](_0x1dbba0[_0x695b('0x39')][_0x695b('0x28')]);_0x16a1e9[_0x695b('0x27')]=qs[_0x695b('0x27')](_0x1dbba0['query'][_0x695b('0x27')]);}_0x16a1e9[_0x695b('0x40')]=qs[_0x695b('0x41')](_0x1dbba0[_0x695b('0x39')][_0x695b('0x41')]);_0x16a1e9[_0x695b('0x42')]=qs[_0x695b('0x3a')](_[_0x695b('0x43')](_0x1dbba0[_0x695b('0x39')],_0x3ad505[_0x695b('0x3a')]));_0x16a1e9[_0x695b('0x42')][_0x695b('0x5e')]=_0x2e7294['id'];if(_0x1dbba0[_0x695b('0x39')]['filter']){_0x16a1e9['where']=_[_0x695b('0x46')](_0x16a1e9['where'],{'$or':_[_0x695b('0x38')](_0x16a1e9[_0x695b('0x3c')],function(_0x3fa8a7){var _0x345739={};_0x345739[_0x3fa8a7]={'$like':'%'+_0x1dbba0[_0x695b('0x39')][_0x695b('0x44')]+'%'};return _0x345739;})});}_0x16a1e9=_[_0x695b('0x46')]({},_0x16a1e9,_0x1dbba0[_0x695b('0x47')]);return db[_0x695b('0xcf')][_0x695b('0x26')]({'where':_0x16a1e9['where']})['then'](function(_0x362d49){_0x5acee5[_0x695b('0x26')]=_0x362d49;if(_0x1dbba0[_0x695b('0x39')][_0x695b('0x48')]){_0x16a1e9[_0x695b('0x4e')]=[{'all':!![]}];}else{_0x16a1e9[_0x695b('0x4e')]=[{'model':db[_0x695b('0x85')],'as':'Contact','required':![]},{'model':db[_0x695b('0xd8')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x695b('0x62')](_0x16a1e9);})[_0x695b('0x16')](function(_0xa8b1fe){_0x5acee5[_0x695b('0x49')]=_0xa8b1fe;return _0x5acee5;});}})[_0x695b('0x16')](respondWithFilteredResult(_0xcad2b9,_0x16a1e9))[_0x695b('0x20')](handleError(_0xcad2b9,null));};exports[_0x695b('0x123')]=function(_0x40176c,_0x38493d){return db['ChatWebsite']['find']({'where':{'id':_0x40176c[_0x695b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38493d,null))[_0x695b('0x16')](function(_0x26053c){if(_0x26053c){return _0x26053c['addAgents'](_0x40176c['body'][_0x695b('0x60')],_[_0x695b('0xed')](_0x40176c['body'],[_0x695b('0x60'),'id'])||{})[_0x695b('0xb3')](function(_0x15ae05){for(var _0x3b9aac=0x0;_0x3b9aac<_0x40176c[_0x695b('0x50')][_0x695b('0x60')][_0x695b('0x5d')];_0x3b9aac+=0x1){socket[_0x695b('0x124')](_0x695b('0x125'),{'UserId':Number(_0x40176c[_0x695b('0x50')][_0x695b('0x60')][_0x3b9aac]),'ChatWebsiteId':Number(_0x40176c['params']['id'])});}return _0x15ae05;});}})[_0x695b('0x16')](respondWithResult(_0x38493d,null))['catch'](handleError(_0x38493d,null));};exports[_0x695b('0x126')]=function(_0x533541,_0x2dd705){return db['ChatWebsite'][_0x695b('0x57')]({'where':{'id':_0x533541[_0x695b('0x4b')]['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x2dd705,null))[_0x695b('0x16')](function(_0x3edda8){if(_0x3edda8){return _0x3edda8['removeAgents'](_0x533541[_0x695b('0x39')]['ids'])[_0x695b('0x16')](function(){if(_[_0x695b('0x127')](_0x533541['query'][_0x695b('0x60')])){for(var _0x5e1ae8=0x0;_0x5e1ae8<_0x533541['query'][_0x695b('0x60')][_0x695b('0x5d')];_0x5e1ae8+=0x1){socket[_0x695b('0x124')](_0x695b('0x128'),{'UserId':Number(_0x533541[_0x695b('0x39')][_0x695b('0x60')][_0x5e1ae8]),'ChatWebsiteId':Number(_0x533541[_0x695b('0x4b')]['id'])});}}else{socket[_0x695b('0x124')](_0x695b('0x128'),{'UserId':Number(_0x533541['query'][_0x695b('0x60')]),'ChatWebsiteId':Number(_0x533541['params']['id'])});}});}})[_0x695b('0x16')](respondWithStatusCode(_0x2dd705,null))['catch'](handleError(_0x2dd705,null));};exports[_0x695b('0x129')]=function(_0x4bd1eb,_0x475971){var _0x498b68={};var _0x30f557={};var _0x47cadf;var _0x2f43ba;return db[_0x695b('0x34')][_0x695b('0x5c')]({'where':{'id':_0x4bd1eb[_0x695b('0x4b')]['id']}})[_0x695b('0x16')](handleEntityNotFound(_0x475971,null))['then'](function(_0x267bc7){if(_0x267bc7){_0x47cadf=_0x267bc7;_0x30f557[_0x695b('0x37')]=_[_0x695b('0x4c')](db[_0x695b('0xbe')][_0x695b('0x4d')]);_0x30f557['query']=_['keys'](_0x4bd1eb[_0x695b('0x39')]);_0x30f557['filters']=_['intersection'](_0x30f557[_0x695b('0x37')],_0x30f557[_0x695b('0x39')]);_0x498b68[_0x695b('0x3c')]=_[_0x695b('0x3b')](_0x30f557[_0x695b('0x37')],qs['fields'](_0x4bd1eb[_0x695b('0x39')][_0x695b('0x3d')]));_0x498b68[_0x695b('0x3c')]=_0x498b68[_0x695b('0x3c')][_0x695b('0x5d')]?_0x498b68[_0x695b('0x3c')]:_0x30f557['model'];_0x498b68[_0x695b('0x40')]=qs['sort'](_0x4bd1eb['query'][_0x695b('0x41')]);_0x498b68[_0x695b('0x42')]=qs['filters'](_[_0x695b('0x43')](_0x4bd1eb['query'],_0x30f557['filters']));if(_0x4bd1eb[_0x695b('0x39')][_0x695b('0x44')]){_0x498b68[_0x695b('0x42')]=_[_0x695b('0x46')](_0x498b68[_0x695b('0x42')],{'$or':_[_0x695b('0x38')](_0x498b68['attributes'],function(_0x3cd903){var _0x2d30e6={};_0x2d30e6[_0x3cd903]={'$like':'%'+_0x4bd1eb[_0x695b('0x39')][_0x695b('0x44')]+'%'};return _0x2d30e6;})});}_0x498b68=_[_0x695b('0x46')]({},_0x498b68,_0x4bd1eb['options']);return _0x47cadf[_0x695b('0x129')](_0x498b68);}})['then'](function(_0x12d802){if(_0x12d802){_0x2f43ba=_0x12d802['length'];if(!_0x4bd1eb[_0x695b('0x39')][_0x695b('0x3e')](_0x695b('0x3f'))){_0x498b68[_0x695b('0x28')]=qs[_0x695b('0x28')](_0x4bd1eb['query'][_0x695b('0x28')]);_0x498b68[_0x695b('0x27')]=qs[_0x695b('0x27')](_0x4bd1eb[_0x695b('0x39')][_0x695b('0x27')]);}return _0x47cadf[_0x695b('0x129')](_0x498b68);}})[_0x695b('0x16')](function(_0x43bad4){if(_0x43bad4){return _0x43bad4?{'count':_0x2f43ba,'rows':_0x43bad4}:null;}})['then'](respondWithResult(_0x475971,null))['catch'](handleError(_0x475971,null));}; \ No newline at end of file +var _0xf168=['applications','orderBy','priority','asc','account','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','unmanaged','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','push','readFileSync','remote','stringify','x-real-ip','remoteAddress','verticalAlignment','labelText','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','Attachment','Attachments','addAgents','omit','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','register','html-to-text','jayson/promise','http','client','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','params','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','getDispositions','sort','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','findAll','rows','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','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','List','Contacts','DESC','Applications','list'];(function(_0x3a122b,_0x253c23){var _0xee10ab=function(_0x564d36){while(--_0x564d36){_0x3a122b['push'](_0x3a122b['shift']());}};_0xee10ab(++_0x253c23);}(_0xf168,0x96));var _0x8f16=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xf168[_0x4dbaad];return _0x226c72;};'use strict';var BPromise=require(_0x8f16('0x0'));var Mustache=require(_0x8f16('0x1'));var util=require('util');var path=require(_0x8f16('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f16('0x3'));var querystring=require(_0x8f16('0x4'));var Redis=require(_0x8f16('0x5'));var qs=require(_0x8f16('0x6'));var logger=require(_0x8f16('0x7'))('api');var config=require(_0x8f16('0x8'));var db=require(_0x8f16('0x9'))['db'];config[_0x8f16('0xa')]=_[_0x8f16('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f16('0xa')]));require('./chatWebsite.socket')[_0x8f16('0xc')](socket);var htmlToText=require(_0x8f16('0xd'));var jayson=require(_0x8f16('0xe'));var client=jayson['client'][_0x8f16('0xf')]({'port':0x232c});var client9002=jayson[_0x8f16('0x10')][_0x8f16('0xf')]({'port':0x232a});var client9003=jayson[_0x8f16('0x10')][_0x8f16('0xf')]({'port':0x232b});var client9001=jayson[_0x8f16('0x10')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3bfeeb,_0x52b252,_0x43297e,_0x4b7316){return new BPromise(function(_0xcb0ec4,_0x3ace78){var _0x52e0e8=_0x4b7316||client;return _0x52e0e8[_0x8f16('0x11')](_0x3bfeeb,_0x43297e)[_0x8f16('0x12')](function(_0xb09bc3){logger[_0x8f16('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x52b252,_0x8f16('0x14'));logger[_0x8f16('0x15')](_0x8f16('0x16'),_0x52b252,_0x8f16('0x14'),JSON['stringify'](_0xb09bc3));if(_0xb09bc3[_0x8f16('0x17')]){if(_0xb09bc3['error'][_0x8f16('0x18')]===0x1f4){logger[_0x8f16('0x17')](_0x8f16('0x19'),_0x52b252,_0xb09bc3[_0x8f16('0x17')][_0x8f16('0x1a')]);return _0x3ace78(_0xb09bc3[_0x8f16('0x17')][_0x8f16('0x1a')]);}logger[_0x8f16('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x52b252,_0xb09bc3[_0x8f16('0x17')][_0x8f16('0x1a')]);return _0xcb0ec4(_0xb09bc3[_0x8f16('0x17')][_0x8f16('0x1a')]);}else{logger[_0x8f16('0x13')](_0x8f16('0x19'),_0x52b252,_0x8f16('0x14'));_0xcb0ec4(_0xb09bc3[_0x8f16('0x1b')][_0x8f16('0x1a')]);}})[_0x8f16('0x1c')](function(_0x21d35a){logger[_0x8f16('0x17')](_0x8f16('0x19'),_0x52b252,_0x21d35a);_0x3ace78(_0x21d35a);});});}function respondWithStatusCode(_0x146d72,_0x2f3919){_0x2f3919=_0x2f3919||0xcc;return function(_0x3286b6){if(_0x3286b6){return _0x146d72[_0x8f16('0x1d')](_0x2f3919);}return _0x146d72[_0x8f16('0x1e')](_0x2f3919)[_0x8f16('0x1f')]();};}function respondWithResult(_0x4edf9a,_0x6fd51c){_0x6fd51c=_0x6fd51c||0xc8;return function(_0x3b3263){if(_0x3b3263){return _0x4edf9a['status'](_0x6fd51c)[_0x8f16('0x20')](_0x3b3263);}};}function respondWithFilteredResult(_0x19a264,_0x5eb9df){return function(_0x5be027){if(_0x5be027){var _0x361b8d=typeof _0x5eb9df[_0x8f16('0x21')]===_0x8f16('0x22')&&typeof _0x5eb9df[_0x8f16('0x23')]===_0x8f16('0x22');var _0x22eccc=_0x5be027[_0x8f16('0x24')];var _0x52dc43=_0x361b8d?0x0:_0x5eb9df[_0x8f16('0x21')];var _0x29101e=_0x361b8d?_0x5be027[_0x8f16('0x24')]:_0x5eb9df[_0x8f16('0x21')]+_0x5eb9df[_0x8f16('0x23')];var _0x42e9cd;if(_0x29101e>=_0x22eccc){_0x29101e=_0x22eccc;_0x42e9cd=0xc8;}else{_0x42e9cd=0xce;}_0x19a264[_0x8f16('0x1e')](_0x42e9cd);return _0x19a264[_0x8f16('0x25')](_0x8f16('0x26'),_0x52dc43+'-'+_0x29101e+'/'+_0x22eccc)['json'](_0x5be027);}return null;};}function saveUpdates(_0x514c2a){return function(_0xcf7e8f){if(_0xcf7e8f){return _0xcf7e8f['update'](_0x514c2a)[_0x8f16('0x12')](function(_0x49fa45){return _0x49fa45;});}return null;};}function removeEntity(_0x2fb8f2){return function(_0x5dd1e8){if(_0x5dd1e8){return _0x5dd1e8[_0x8f16('0x27')]()[_0x8f16('0x12')](function(){var _0x41c341=_0x5dd1e8[_0x8f16('0x28')]({'plain':!![]});var _0x44a108=_0x8f16('0x29');return db[_0x8f16('0x2a')][_0x8f16('0x27')]({'where':{'type':_0x44a108,'resourceId':_0x41c341['id']}})[_0x8f16('0x12')](function(){return _0x5dd1e8;});})['then'](function(){_0x2fb8f2[_0x8f16('0x1e')](0xcc)[_0x8f16('0x1f')]();});}};}function handleEntityNotFound(_0x283dd3){return function(_0x25ddfb){if(!_0x25ddfb){_0x283dd3[_0x8f16('0x1d')](0x194);}return _0x25ddfb;};}function handleError(_0x12269a,_0x15e143){_0x15e143=_0x15e143||0x1f4;return function(_0xe342a){logger[_0x8f16('0x17')](_0xe342a[_0x8f16('0x2b')]);if(_0xe342a[_0x8f16('0x2c')]){delete _0xe342a[_0x8f16('0x2c')];}_0x12269a[_0x8f16('0x1e')](_0x15e143)[_0x8f16('0x2d')](_0xe342a);};}exports['index']=function(_0x34afb7,_0x26023a){var _0x3f8a64={'include':[{'model':db[_0x8f16('0x2e')],'as':'mandatoryDispositionPause'}]},_0x5e17dd={},_0x4d2e52={'count':0x0,'rows':[]};var _0x46e807=_[_0x8f16('0x2f')](db[_0x8f16('0x30')][_0x8f16('0x31')],function(_0x26c451){return{'name':_0x26c451[_0x8f16('0x32')],'type':_0x26c451[_0x8f16('0x33')][_0x8f16('0x34')]};});_0x5e17dd[_0x8f16('0x35')]=_[_0x8f16('0x2f')](_0x46e807,_0x8f16('0x2c'));_0x5e17dd[_0x8f16('0x36')]=_[_0x8f16('0x37')](_0x34afb7['query']);_0x5e17dd[_0x8f16('0x38')]=_['intersection'](_0x5e17dd[_0x8f16('0x35')],_0x5e17dd[_0x8f16('0x36')]);_0x3f8a64[_0x8f16('0x39')]=_[_0x8f16('0x3a')](_0x5e17dd[_0x8f16('0x35')],qs[_0x8f16('0x3b')](_0x34afb7[_0x8f16('0x36')][_0x8f16('0x3b')]));_0x3f8a64[_0x8f16('0x39')]=_0x3f8a64[_0x8f16('0x39')][_0x8f16('0x3c')]?_0x3f8a64['attributes']:_0x5e17dd[_0x8f16('0x35')];if(!_0x34afb7[_0x8f16('0x36')][_0x8f16('0x3d')](_0x8f16('0x3e'))){_0x3f8a64['limit']=qs[_0x8f16('0x23')](_0x34afb7[_0x8f16('0x36')][_0x8f16('0x23')]);_0x3f8a64[_0x8f16('0x21')]=qs[_0x8f16('0x21')](_0x34afb7[_0x8f16('0x36')][_0x8f16('0x21')]);}_0x3f8a64[_0x8f16('0x3f')]=qs['sort'](_0x34afb7['query']['sort']);_0x3f8a64[_0x8f16('0x40')]=qs['filters'](_[_0x8f16('0x41')](_0x34afb7[_0x8f16('0x36')],_0x5e17dd[_0x8f16('0x38')]),_0x46e807);if(_0x34afb7[_0x8f16('0x36')][_0x8f16('0x42')]){_0x3f8a64[_0x8f16('0x40')]=_[_0x8f16('0x43')](_0x3f8a64[_0x8f16('0x40')],{'$or':_[_0x8f16('0x2f')](_0x46e807,function(_0x32441b){if(_0x32441b[_0x8f16('0x33')]!==_0x8f16('0x44')){var _0x40dd3f={};_0x40dd3f[_0x32441b[_0x8f16('0x2c')]]={'$like':'%'+_0x34afb7[_0x8f16('0x36')][_0x8f16('0x42')]+'%'};return _0x40dd3f;}})});}_0x3f8a64=_['merge']({},_0x3f8a64,_0x34afb7[_0x8f16('0x45')]);var _0x38e70a={'where':_0x3f8a64[_0x8f16('0x40')]};return db[_0x8f16('0x30')][_0x8f16('0x24')](_0x38e70a)[_0x8f16('0x12')](function(_0x4a0f28){_0x4d2e52[_0x8f16('0x24')]=_0x4a0f28;if(_0x34afb7[_0x8f16('0x36')][_0x8f16('0x46')]){_0x3f8a64['include']=[{'all':!![]}];}return db[_0x8f16('0x30')]['findAll'](_0x3f8a64);})[_0x8f16('0x12')](function(_0x571af7){_0x4d2e52['rows']=_0x571af7;return _0x4d2e52;})[_0x8f16('0x12')](respondWithFilteredResult(_0x26023a,_0x3f8a64))[_0x8f16('0x1c')](handleError(_0x26023a,null));};exports['show']=function(_0x19adc2,_0x47e092){var _0x175338={'raw':![],'where':{'id':_0x19adc2[_0x8f16('0x47')]['id']},'include':[{'model':db[_0x8f16('0x2e')],'as':'mandatoryDispositionPause'}]},_0x145a98={};_0x145a98[_0x8f16('0x35')]=_['keys'](db['ChatWebsite'][_0x8f16('0x31')]);_0x145a98[_0x8f16('0x36')]=_[_0x8f16('0x37')](_0x19adc2['query']);_0x145a98[_0x8f16('0x38')]=_[_0x8f16('0x3a')](_0x145a98['model'],_0x145a98[_0x8f16('0x36')]);_0x175338[_0x8f16('0x39')]=_[_0x8f16('0x3a')](_0x145a98[_0x8f16('0x35')],qs[_0x8f16('0x3b')](_0x19adc2[_0x8f16('0x36')][_0x8f16('0x3b')]));_0x175338['attributes']=_0x175338['attributes']['length']?_0x175338[_0x8f16('0x39')]:_0x145a98['model'];if(_0x19adc2['query']['includeAll']){_0x175338[_0x8f16('0x48')]=[{'all':!![]}];}_0x175338=_['merge']({},_0x175338,_0x19adc2[_0x8f16('0x45')]);return db[_0x8f16('0x30')]['find'](_0x175338)[_0x8f16('0x12')](handleEntityNotFound(_0x47e092,null))[_0x8f16('0x12')](respondWithResult(_0x47e092,null))[_0x8f16('0x1c')](handleError(_0x47e092,null));};exports['create']=function(_0x33a4d2,_0x2e8dd4){return db['ChatWebsite']['create'](_0x33a4d2[_0x8f16('0x49')],{})[_0x8f16('0x12')](function(_0xf829a7){var _0x506aa0=_0x33a4d2[_0x8f16('0x4a')]['get']({'plain':!![]});if(!_0x506aa0)throw new Error(_0x8f16('0x4b'));if(_0x506aa0[_0x8f16('0x4c')]===_0x8f16('0x4a')){var _0x4efd47=_0xf829a7[_0x8f16('0x28')]({'plain':!![]});var _0x327b89=_0x8f16('0x29');return db[_0x8f16('0x4d')][_0x8f16('0x4e')]({'where':{'name':_0x327b89,'userProfileId':_0x506aa0[_0x8f16('0x4f')]},'raw':!![]})[_0x8f16('0x12')](function(_0x515dce){if(_0x515dce&&_0x515dce[_0x8f16('0x50')]===0x0){return db[_0x8f16('0x2a')][_0x8f16('0x51')]({'name':_0x4efd47[_0x8f16('0x2c')],'resourceId':_0x4efd47['id'],'type':_0x515dce[_0x8f16('0x2c')],'sectionId':_0x515dce['id']},{})[_0x8f16('0x12')](function(){return _0xf829a7;});}else{return _0xf829a7;}})[_0x8f16('0x1c')](function(_0x5cf621){logger['error'](_0x8f16('0x52'),_0x5cf621);throw _0x5cf621;});}return _0xf829a7;})[_0x8f16('0x12')](respondWithResult(_0x2e8dd4,0xc9))['catch'](handleError(_0x2e8dd4,null));};exports[_0x8f16('0x53')]=function(_0x2a7547,_0x186ece){if(_0x2a7547[_0x8f16('0x49')]['id']){delete _0x2a7547[_0x8f16('0x49')]['id'];}return db['ChatWebsite'][_0x8f16('0x4e')]({'where':{'id':_0x2a7547['params']['id']},'include':[{'model':db[_0x8f16('0x2e')],'as':_0x8f16('0x54')}]})[_0x8f16('0x12')](handleEntityNotFound(_0x186ece,null))[_0x8f16('0x12')](saveUpdates(_0x2a7547[_0x8f16('0x49')],null))[_0x8f16('0x12')](respondWithResult(_0x186ece,null))[_0x8f16('0x1c')](handleError(_0x186ece,null));};exports['destroy']=function(_0x828ed,_0x195014){return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'where':{'id':_0x828ed[_0x8f16('0x47')]['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x195014,null))['then'](removeEntity(_0x195014,null))[_0x8f16('0x1c')](handleError(_0x195014,null));};exports[_0x8f16('0x55')]=function(_0xbf44a2,_0x56dffd){return db['ChatWebsite'][_0x8f16('0x55')]()[_0x8f16('0x12')](respondWithResult(_0x56dffd,null))[_0x8f16('0x1c')](handleError(_0x56dffd,null));};exports[_0x8f16('0x56')]=function(_0x58dce2,_0x56f3dc){if(_0x58dce2[_0x8f16('0x49')]['id']){delete _0x58dce2[_0x8f16('0x49')]['id'];}return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'where':{'id':_0x58dce2[_0x8f16('0x47')]['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x56f3dc,null))[_0x8f16('0x12')](function(_0x50d42d){if(_0x50d42d){_0x58dce2['body'][_0x8f16('0x57')]=_0x50d42d['id'];return db['Disposition'][_0x8f16('0x51')](_0x58dce2[_0x8f16('0x49')]);}})[_0x8f16('0x12')](respondWithResult(_0x56f3dc,null))[_0x8f16('0x1c')](handleError(_0x56f3dc,null));};exports[_0x8f16('0x58')]=function(_0x7a9fcc,_0x57220b){var _0x17b8c4={'raw':![],'where':{}};var _0x41860a={};var _0x240788={'count':0x0,'rows':[]};return db[_0x8f16('0x30')]['findOne']({'where':{'id':_0x7a9fcc[_0x8f16('0x47')]['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x57220b,null))['then'](function(_0x233a7c){if(_0x233a7c){_0x41860a[_0x8f16('0x35')]=_['keys'](db['Disposition'][_0x8f16('0x31')]);_0x41860a[_0x8f16('0x36')]=_[_0x8f16('0x37')](_0x7a9fcc[_0x8f16('0x36')]);_0x41860a[_0x8f16('0x38')]=_['intersection'](_0x41860a[_0x8f16('0x35')],_0x41860a[_0x8f16('0x36')]);_0x17b8c4['attributes']=_[_0x8f16('0x3a')](_0x41860a[_0x8f16('0x35')],qs['fields'](_0x7a9fcc[_0x8f16('0x36')][_0x8f16('0x3b')]));_0x17b8c4[_0x8f16('0x39')]=_0x17b8c4[_0x8f16('0x39')][_0x8f16('0x3c')]?_0x17b8c4[_0x8f16('0x39')]:_0x41860a['model'];if(!_0x7a9fcc['query'][_0x8f16('0x3d')]('nolimit')){_0x17b8c4[_0x8f16('0x23')]=qs[_0x8f16('0x23')](_0x7a9fcc[_0x8f16('0x36')][_0x8f16('0x23')]);_0x17b8c4[_0x8f16('0x21')]=qs[_0x8f16('0x21')](_0x7a9fcc['query'][_0x8f16('0x21')]);}_0x17b8c4['order']=qs['sort'](_0x7a9fcc['query'][_0x8f16('0x59')]);_0x17b8c4[_0x8f16('0x40')]=qs[_0x8f16('0x38')](_[_0x8f16('0x41')](_0x7a9fcc[_0x8f16('0x36')],_0x41860a[_0x8f16('0x38')]));_0x17b8c4['where'][_0x8f16('0x57')]=_0x233a7c['id'];if(_0x7a9fcc['query'][_0x8f16('0x42')]){_0x17b8c4[_0x8f16('0x40')]=_[_0x8f16('0x43')](_0x17b8c4[_0x8f16('0x40')],{'$or':_['map'](_0x17b8c4[_0x8f16('0x39')],function(_0x505565){var _0x40cab1={};_0x40cab1[_0x505565]={'$like':'%'+_0x7a9fcc[_0x8f16('0x36')][_0x8f16('0x42')]+'%'};return _0x40cab1;})});}_0x17b8c4=_[_0x8f16('0x43')]({},_0x17b8c4,_0x7a9fcc[_0x8f16('0x45')]);return db[_0x8f16('0x5a')]['count']({'where':_0x17b8c4[_0x8f16('0x40')]})[_0x8f16('0x12')](function(_0x39d461){_0x240788[_0x8f16('0x24')]=_0x39d461;if(_0x7a9fcc[_0x8f16('0x36')][_0x8f16('0x46')]){_0x17b8c4[_0x8f16('0x48')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x17b8c4);})[_0x8f16('0x12')](function(_0x4def0d){_0x240788['rows']=_0x4def0d;return _0x240788;});}})[_0x8f16('0x12')](respondWithFilteredResult(_0x57220b,_0x17b8c4))[_0x8f16('0x1c')](handleError(_0x57220b,null));};exports[_0x8f16('0x5b')]=function(_0x13f331,_0x522f24){return db['ChatWebsite']['find']({'where':{'id':_0x13f331['params']['id']}})['then'](handleEntityNotFound(_0x522f24,null))[_0x8f16('0x12')](function(_0x1db403){if(_0x1db403){return _0x1db403[_0x8f16('0x5b')](_0x13f331['query'][_0x8f16('0x5c')]);}})[_0x8f16('0x12')](respondWithStatusCode(_0x522f24,null))['catch'](handleError(_0x522f24,null));};exports[_0x8f16('0x5d')]=function(_0x2614f2,_0x59dbea){if(_0x2614f2['body']['id']){delete _0x2614f2[_0x8f16('0x49')]['id'];}return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'where':{'id':_0x2614f2[_0x8f16('0x47')]['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x59dbea,null))[_0x8f16('0x12')](function(_0x5cd42f){if(_0x5cd42f){_0x2614f2[_0x8f16('0x49')][_0x8f16('0x57')]=_0x5cd42f['id'];return db[_0x8f16('0x5e')][_0x8f16('0x51')](_0x2614f2[_0x8f16('0x49')]);}})['then'](respondWithResult(_0x59dbea,null))['catch'](handleError(_0x59dbea,null));};exports[_0x8f16('0x5f')]=function(_0x2dd4ba,_0x40f028){var _0x362f75={'raw':![],'where':{}};var _0x490e39={};var _0x51b07f={'count':0x0,'rows':[]};return db[_0x8f16('0x30')][_0x8f16('0x60')]({'where':{'id':_0x2dd4ba[_0x8f16('0x47')]['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x40f028,null))[_0x8f16('0x12')](function(_0x5f2eab){if(_0x5f2eab){_0x490e39[_0x8f16('0x35')]=_[_0x8f16('0x37')](db[_0x8f16('0x5e')]['rawAttributes']);_0x490e39[_0x8f16('0x36')]=_[_0x8f16('0x37')](_0x2dd4ba['query']);_0x490e39[_0x8f16('0x38')]=_[_0x8f16('0x3a')](_0x490e39[_0x8f16('0x35')],_0x490e39[_0x8f16('0x36')]);_0x362f75['attributes']=_['intersection'](_0x490e39[_0x8f16('0x35')],qs[_0x8f16('0x3b')](_0x2dd4ba[_0x8f16('0x36')][_0x8f16('0x3b')]));_0x362f75[_0x8f16('0x39')]=_0x362f75['attributes'][_0x8f16('0x3c')]?_0x362f75[_0x8f16('0x39')]:_0x490e39[_0x8f16('0x35')];if(!_0x2dd4ba[_0x8f16('0x36')][_0x8f16('0x3d')]('nolimit')){_0x362f75['limit']=qs[_0x8f16('0x23')](_0x2dd4ba[_0x8f16('0x36')]['limit']);_0x362f75[_0x8f16('0x21')]=qs['offset'](_0x2dd4ba[_0x8f16('0x36')][_0x8f16('0x21')]);}_0x362f75['order']=qs[_0x8f16('0x59')](_0x2dd4ba['query'][_0x8f16('0x59')]);_0x362f75[_0x8f16('0x40')]=qs[_0x8f16('0x38')](_[_0x8f16('0x41')](_0x2dd4ba[_0x8f16('0x36')],_0x490e39[_0x8f16('0x38')]));_0x362f75['where']['ChatWebsiteId']=_0x5f2eab['id'];if(_0x2dd4ba[_0x8f16('0x36')][_0x8f16('0x42')]){_0x362f75[_0x8f16('0x40')]=_[_0x8f16('0x43')](_0x362f75[_0x8f16('0x40')],{'$or':_['map'](_0x362f75[_0x8f16('0x39')],function(_0x3c2fcc){var _0xb05315={};_0xb05315[_0x3c2fcc]={'$like':'%'+_0x2dd4ba[_0x8f16('0x36')][_0x8f16('0x42')]+'%'};return _0xb05315;})});}_0x362f75=_['merge']({},_0x362f75,_0x2dd4ba[_0x8f16('0x45')]);return db[_0x8f16('0x5e')][_0x8f16('0x24')]({'where':_0x362f75[_0x8f16('0x40')]})['then'](function(_0x28505c){_0x51b07f[_0x8f16('0x24')]=_0x28505c;if(_0x2dd4ba[_0x8f16('0x36')][_0x8f16('0x46')]){_0x362f75[_0x8f16('0x48')]=[{'all':!![]}];}return db[_0x8f16('0x5e')][_0x8f16('0x61')](_0x362f75);})[_0x8f16('0x12')](function(_0x3c712b){_0x51b07f[_0x8f16('0x62')]=_0x3c712b;return _0x51b07f;});}})[_0x8f16('0x12')](respondWithFilteredResult(_0x40f028,_0x362f75))[_0x8f16('0x1c')](handleError(_0x40f028,null));};exports['removeAnswers']=function(_0x509a02,_0x3c211b){return db[_0x8f16('0x30')]['find']({'where':{'id':_0x509a02['params']['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x3c211b,null))[_0x8f16('0x12')](function(_0x3827ec){if(_0x3827ec){return _0x3827ec[_0x8f16('0x63')](_0x509a02[_0x8f16('0x36')][_0x8f16('0x5c')]);}})[_0x8f16('0x12')](respondWithStatusCode(_0x3c211b,null))['catch'](handleError(_0x3c211b,null));};exports['addLogo']=function(_0x19f92b,_0x5cc95f){_0x19f92b[_0x8f16('0x49')][_0x8f16('0x64')]=_0x19f92b[_0x8f16('0x65')][_0x8f16('0x66')];return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'where':{'id':_0x19f92b['params']['id']}})['then'](handleEntityNotFound(_0x5cc95f,null))[_0x8f16('0x12')](saveUpdates(_0x19f92b[_0x8f16('0x49')],null))[_0x8f16('0x12')](respondWithResult(_0x5cc95f,null))[_0x8f16('0x1c')](handleError(_0x5cc95f,null));};exports[_0x8f16('0x67')]=function(_0x158e57,_0x216c4d){_0x158e57['body'][_0x8f16('0x68')]=_0x158e57[_0x8f16('0x65')][_0x8f16('0x66')];return db[_0x8f16('0x30')]['find']({'where':{'id':_0x158e57[_0x8f16('0x47')]['id']}})['then'](handleEntityNotFound(_0x216c4d,null))[_0x8f16('0x12')](saveUpdates(_0x158e57[_0x8f16('0x49')],null))[_0x8f16('0x12')](respondWithResult(_0x216c4d,null))[_0x8f16('0x1c')](handleError(_0x216c4d,null));};exports[_0x8f16('0x69')]=function(_0x28f17f,_0x4c1aca){_0x28f17f[_0x8f16('0x49')][_0x8f16('0x6a')]=_0x28f17f[_0x8f16('0x65')][_0x8f16('0x66')];return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'where':{'id':_0x28f17f[_0x8f16('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c1aca,null))['then'](saveUpdates(_0x28f17f[_0x8f16('0x49')],null))[_0x8f16('0x12')](respondWithResult(_0x4c1aca,null))[_0x8f16('0x1c')](handleError(_0x4c1aca,null));};exports[_0x8f16('0x6b')]=function(_0x2d3e46,_0x32213f){_0x2d3e46[_0x8f16('0x49')]['systemAvatar']=_0x2d3e46['file'][_0x8f16('0x66')];return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'where':{'id':_0x2d3e46[_0x8f16('0x47')]['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x32213f,null))[_0x8f16('0x12')](saveUpdates(_0x2d3e46[_0x8f16('0x49')],null))[_0x8f16('0x12')](respondWithResult(_0x32213f,null))[_0x8f16('0x1c')](handleError(_0x32213f,null));};exports['getLogo']=function(_0x44b20d,_0x21aa27){var _0x5c0e5e=path['join'](config[_0x8f16('0x6c')],_0x8f16('0x6d'));var _0x2f8401={'where':{'id':_0x44b20d[_0x8f16('0x47')]['id']},'attributes':['id',_0x8f16('0x64')],'raw':!![]};var _0x22527c=![];return require(_0x8f16('0x6e'))[_0x8f16('0x6f')]()[_0x8f16('0x12')](function(_0x172947){if(_0x172947){_0x22527c=_0x172947[_0x8f16('0x70')];}})[_0x8f16('0x12')](function(){return db[_0x8f16('0x30')][_0x8f16('0x4e')](_0x2f8401);})['then'](handleEntityNotFound(_0x21aa27,null))[_0x8f16('0x12')](function(_0x41344a){if(_0x41344a){if(!_[_0x8f16('0x71')](_0x41344a[_0x8f16('0x64')])){if(fs[_0x8f16('0x72')](path[_0x8f16('0x73')](config[_0x8f16('0x6c')],'server/files/images/logos/',_0x41344a[_0x8f16('0x64')]))&&_0x22527c){_0x5c0e5e=path[_0x8f16('0x73')](config[_0x8f16('0x6c')],'server/files/images/logos/',_0x41344a[_0x8f16('0x64')]);}}return _0x21aa27[_0x8f16('0x74')](_0x5c0e5e);}})[_0x8f16('0x1c')](handleError(_0x21aa27,null));};exports[_0x8f16('0x75')]=function(_0x115ed1,_0x293cb9){var _0x58bad6=path[_0x8f16('0x73')](config[_0x8f16('0x6c')],_0x8f16('0x76'));var _0x2b4b17={'where':{'id':_0x115ed1[_0x8f16('0x47')]['id']},'attributes':['id',_0x8f16('0x68')],'raw':!![]};return db[_0x8f16('0x30')][_0x8f16('0x4e')](_0x2b4b17)[_0x8f16('0x12')](handleEntityNotFound(_0x293cb9,null))[_0x8f16('0x12')](function(_0x11b10c){if(_0x11b10c){if(!_[_0x8f16('0x71')](_0x11b10c[_0x8f16('0x68')])){if(fs[_0x8f16('0x72')](path[_0x8f16('0x73')](config[_0x8f16('0x6c')],_0x8f16('0x77'),_0x11b10c['agentAvatar']))){_0x58bad6=path['join'](config[_0x8f16('0x6c')],'server/files/images/avatars/',_0x11b10c[_0x8f16('0x68')]);}}return _0x293cb9[_0x8f16('0x74')](_0x58bad6);}})[_0x8f16('0x1c')](handleError(_0x293cb9,null));};exports[_0x8f16('0x78')]=function(_0x361706,_0x37ce42){var _0xb32a6f=path[_0x8f16('0x73')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x452eba={'where':{'id':_0x361706[_0x8f16('0x47')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x8f16('0x30')]['find'](_0x452eba)[_0x8f16('0x12')](handleEntityNotFound(_0x37ce42,null))[_0x8f16('0x12')](function(_0xe30dd2){if(_0xe30dd2){if(!_['isNil'](_0xe30dd2[_0x8f16('0x6a')])){if(fs[_0x8f16('0x72')](path[_0x8f16('0x73')](config[_0x8f16('0x6c')],_0x8f16('0x77'),_0xe30dd2[_0x8f16('0x6a')]))&&_0xe30dd2[_0x8f16('0x79')]){_0xb32a6f=path['join'](config[_0x8f16('0x6c')],_0x8f16('0x77'),_0xe30dd2[_0x8f16('0x6a')]);}}return _0x37ce42[_0x8f16('0x74')](_0xb32a6f);}})[_0x8f16('0x1c')](handleError(_0x37ce42,null));};exports[_0x8f16('0x7a')]=function(_0x3cae98,_0x3d97ba){var _0x246be7=path[_0x8f16('0x73')](config[_0x8f16('0x6c')],'server/files/images/avatars/system_avatar.png');var _0x3b35a0={'where':{'id':_0x3cae98[_0x8f16('0x47')]['id']},'attributes':['id',_0x8f16('0x7b')],'raw':!![]};return db['ChatWebsite'][_0x8f16('0x4e')](_0x3b35a0)[_0x8f16('0x12')](handleEntityNotFound(_0x3d97ba,null))[_0x8f16('0x12')](function(_0x8494d8){if(_0x8494d8){if(!_['isNil'](_0x8494d8[_0x8f16('0x7b')])){if(fs[_0x8f16('0x72')](path['join'](config[_0x8f16('0x6c')],_0x8f16('0x77'),_0x8494d8[_0x8f16('0x7b')]))){_0x246be7=path[_0x8f16('0x73')](config[_0x8f16('0x6c')],_0x8f16('0x77'),_0x8494d8[_0x8f16('0x7b')]);}}return _0x3d97ba[_0x8f16('0x74')](_0x246be7);}})[_0x8f16('0x1c')](handleError(_0x3d97ba,null));};exports[_0x8f16('0x7c')]=function(_0x2b998a,_0x140430){var _0x5cad99=require(_0x8f16('0x7d'));var _0xb1ab9d=new _0x5cad99();var _0x2557ca=_0xb1ab9d[_0x8f16('0x7e')](_0x2b998a[_0x8f16('0x7f')][_0x8f16('0x80')])[_0x8f16('0x81')]();var _0x1a1d8e={'body':_0x2b998a['body'],'channel':_0x8f16('0x82')};var _0x1b6a23=[];var _0x2ffcaa=[];var _0x5ca9a4={};var _0x3d24f6=![];return db[_0x8f16('0x83')][_0x8f16('0x55')]()[_0x8f16('0x12')](function(_0x273b3b){if(!_0x273b3b){throw new db[(_0x8f16('0x84'))][(_0x8f16('0x85'))]('no\x20available\x20attributes');}_0x1b6a23=_[_0x8f16('0x86')](_['keys'](_0x273b3b),[_0x8f16('0x87'),'updatedAt']);_0x2ffcaa=_['difference'](_['keys'](_0x273b3b),[_0x8f16('0x87'),_0x8f16('0x88'),_0x8f16('0x89'),_0x8f16('0x8a')]);if(_0x2b998a['body']['id']){delete _0x2b998a[_0x8f16('0x49')]['id'];}if(_[_0x8f16('0x71')](_0x2b998a['body'][_0x8f16('0x8b')])){throw new db[(_0x8f16('0x84'))][(_0x8f16('0x85'))](_0x8f16('0x8c'));}if(_[_0x8f16('0x71')](_0x2b998a[_0x8f16('0x49')][_0x8f16('0x49')])||_0x2b998a[_0x8f16('0x49')][_0x8f16('0x49')]===''){throw new db[(_0x8f16('0x84'))][(_0x8f16('0x85'))](_0x8f16('0x8d'));}if(_[_0x8f16('0x71')](_0x2b998a[_0x8f16('0x49')]['mapKey'])){throw new db['Sequelize'][(_0x8f16('0x85'))](_0x8f16('0x8e')+_0x2ffcaa);}if(!_[_0x8f16('0x8f')](_0x2ffcaa,_0x2b998a[_0x8f16('0x49')][_0x8f16('0x90')])){throw new db[(_0x8f16('0x84'))]['ValidationError'](_0x8f16('0x91')+_0x2ffcaa);}_0x5ca9a4[_0x2b998a[_0x8f16('0x49')][_0x8f16('0x90')]]=_0x2b998a[_0x8f16('0x49')][_0x8f16('0x8b')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2b998a[_0x8f16('0x47')]['id']},'include':[{'model':db['CmList'],'as':_0x8f16('0x92'),'include':[{'model':db['CmContact'],'as':_0x8f16('0x93'),'where':_0x5ca9a4,'limit':0x1,'order':[[_0x8f16('0x88'),_0x8f16('0x94')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x8f16('0x12')](handleEntityNotFound(_0x140430,null))['then'](function(_0x46f54c){if(_0x46f54c&&_0x46f54c[_0x8f16('0x92')]){_0x1a1d8e['account']=_0x46f54c;_0x1a1d8e['applications']=_0x46f54c[_0x8f16('0x95')];_0x1a1d8e[_0x8f16('0x96')]=_0x46f54c[_0x8f16('0x92')];_0x1a1d8e[_0x8f16('0x97')]=_[_0x8f16('0x98')](_0x1a1d8e[_0x8f16('0x97')],[_0x8f16('0x99')],[_0x8f16('0x9a')]);if(_0x1a1d8e[_0x8f16('0x9b')][_0x8f16('0x95')]){delete _0x1a1d8e[_0x8f16('0x9b')][_0x8f16('0x95')];}if(_0x1a1d8e[_0x8f16('0x9b')][_0x8f16('0x92')]&&_0x1a1d8e[_0x8f16('0x9b')][_0x8f16('0x92')][_0x8f16('0x93')][_0x8f16('0x3c')]){return _0x1a1d8e[_0x8f16('0x9b')][_0x8f16('0x92')][_0x8f16('0x93')][0x0];}var _0x544917=_[_0x8f16('0xb')](_0x2b998a[_0x8f16('0x49')],{'firstName':_0x2b998a[_0x8f16('0x49')]['from'],'ListId':_0x46f54c[_0x8f16('0x8a')]});_0x544917[_0x2b998a[_0x8f16('0x49')][_0x8f16('0x90')]]=_0x2b998a[_0x8f16('0x49')][_0x8f16('0x8b')];return db['CmContact'][_0x8f16('0x51')](_0x544917,{'fields':_0x1b6a23,'raw':!![]});}})[_0x8f16('0x12')](handleEntityNotFound(_0x140430,null))[_0x8f16('0x12')](function(_0x52a8f0){_0x1a1d8e[_0x8f16('0x9c')]=_0x52a8f0;var _0x475e1b=_0x2b998a[_0x8f16('0x49')][_0x8f16('0x9d')];if(_0x2b998a[_0x8f16('0x7f')][_0x8f16('0x9e')]){_0x475e1b=_0x2b998a[_0x8f16('0x7f')][_0x8f16('0x9e')];}else if(_0x2b998a[_0x8f16('0x7f')][_0x8f16('0x9f')]){_0x475e1b=_[_0x8f16('0xa0')](_0x2b998a['headers'][_0x8f16('0x9f')][_0x8f16('0xa1')](','));}if(_0x52a8f0){var _0x2216fc={'ContactId':_0x52a8f0['id'],'ChatWebsiteId':_0x2b998a[_0x8f16('0x47')]['id'],'from':(_0x52a8f0[_0x8f16('0xa2')]||'')+'\x20'+(_0x52a8f0[_0x8f16('0xa3')]||''),'customerIp':_0x475e1b,'customerPort':_0x2b998a[_0x8f16('0x7f')][_0x8f16('0xa4')]?_0x2b998a[_0x8f16('0x7f')][_0x8f16('0xa4')]:null,'referer':_0x2b998a[_0x8f16('0x49')][_0x8f16('0xa5')],'browserName':_0x2557ca[_0x8f16('0xa6')][_0x8f16('0x2c')]&&_0x2557ca['browser'][_0x8f16('0xa7')]?util[_0x8f16('0xa8')](_0x8f16('0xa9'),_0x2557ca[_0x8f16('0xa6')][_0x8f16('0x2c')],_0x2557ca[_0x8f16('0xa6')]['version']):_0x8f16('0xaa'),'browserVersion':_0x2557ca[_0x8f16('0xa6')]['version']||_0x8f16('0xaa'),'osName':util[_0x8f16('0xa8')]('%s\x20%s',_0x2557ca['os']['name'],_0x2557ca['os']['version']),'osVersion':_0x2557ca['os']['version'],'deviceModel':_0x2557ca[_0x8f16('0xab')]['model']&&_0x2557ca[_0x8f16('0xab')]['vendor']?util[_0x8f16('0xa8')]('%s\x20%s\x20%s',_0x2557ca['device'][_0x8f16('0x35')],_0x2557ca[_0x8f16('0xab')][_0x8f16('0xac')],_0x2557ca['device'][_0x8f16('0x33')]):null,'deviceVendor':_0x2557ca[_0x8f16('0xab')][_0x8f16('0xac')],'deviceType':_0x2557ca['device']['type'],'formData':JSON['stringify'](_0x2b998a[_0x8f16('0x49')])};var _0x5e79b2={'ChatWebsiteId':_0x2b998a[_0x8f16('0x47')]['id'],'closed':![]};if(_0x2b998a[_0x8f16('0x49')][_0x8f16('0xad')]){_0x5e79b2['threadId']=_0x2b998a[_0x8f16('0x49')][_0x8f16('0xad')];return db[_0x8f16('0xae')][_0x8f16('0x4e')]({'where':_0x5e79b2})[_0x8f16('0x12')](function(_0x4cd8fe){if(_0x4cd8fe){return[_0x4cd8fe,![]];}_0x2216fc[_0x8f16('0xad')]=_0x2b998a['body'][_0x8f16('0xad')];_0x2216fc['externalUrl']=_0x2b998a[_0x8f16('0x49')][_0x8f16('0xaf')];return db[_0x8f16('0xae')][_0x8f16('0x51')](_0x2216fc)[_0x8f16('0x12')](function(_0x2a8aa6){return[_0x2a8aa6,!![]];});});}_0x5e79b2[_0x8f16('0xb0')]=_0x52a8f0['id'];if(_0x2b998a[_0x8f16('0x49')][_0x8f16('0xb1')]&&_0x2b998a[_0x8f16('0x49')][_0x8f16('0xb1')]['id']){_0x5e79b2['id']=_0x2b998a[_0x8f16('0x49')][_0x8f16('0xb1')]['id'];return db[_0x8f16('0xae')]['find']({'where':_0x5e79b2})[_0x8f16('0x12')](function(_0x5da510){if(_0x5da510){return[_0x5da510,![]];}return db[_0x8f16('0xae')][_0x8f16('0x51')](_0x2216fc)[_0x8f16('0x12')](function(_0x26d1d6){return[_0x26d1d6,!![]];});});}return db[_0x8f16('0xae')][_0x8f16('0x51')](_0x2216fc)[_0x8f16('0x12')](function(_0x271adc){return[_0x271adc,!![]];});}})[_0x8f16('0xb2')](function(_0x3fc5f8,_0x251407){if(_0x3fc5f8){_0x3d24f6=_0x251407;if(!_0x251407){var _0x5d45a8={'from':(_0x1a1d8e[_0x8f16('0x9c')][_0x8f16('0xa2')]||'')+'\x20'+(_0x1a1d8e['contact'][_0x8f16('0xa3')]||'')};if(_0x2b998a[_0x8f16('0x49')][_0x8f16('0xad')]&&_0x2b998a[_0x8f16('0x49')][_0x8f16('0xb3')]&&_0x2b998a['body'][_0x8f16('0xad')]!=_0x2b998a['body'][_0x8f16('0xb3')]){_0x5d45a8[_0x8f16('0xad')]=_0x2b998a['body'][_0x8f16('0xb3')];}return _0x3fc5f8[_0x8f16('0x53')](_0x5d45a8);}else{return _0x3fc5f8;}}})[_0x8f16('0x12')](function(_0x4ef807){_0x1a1d8e['interaction']=_0x4ef807[_0x8f16('0x28')]({'plain':!![]});_0x1a1d8e['interaction'][_0x8f16('0xb4')]=_0x3d24f6;if(_0x1a1d8e['interaction']['created']){if(_0x1a1d8e[_0x8f16('0x9b')][_0x8f16('0xb5')]){_0x1a1d8e[_0x8f16('0x97')]['push']({'id':0x0,'priority':_0x1a1d8e[_0x8f16('0x97')][_0x8f16('0x3c')]+0x1,'app':'close','appdata':_0x8f16('0xb6'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x2b998a[_0x8f16('0x49')][_0x8f16('0x49')],'ChatWebsiteId':_0x2b998a[_0x8f16('0x47')]['id'],'ChatInteractionId':_0x4ef807['id'],'direction':'in','ContactId':_0x1a1d8e[_0x8f16('0x9c')]['id'],'AttachmentId':_0x2b998a[_0x8f16('0x49')][_0x8f16('0xb7')]});})[_0x8f16('0x12')](function(_0x1b5dbe){_0x1a1d8e[_0x8f16('0x1a')]=_0x1b5dbe;if(_0x1a1d8e[_0x8f16('0xb1')][_0x8f16('0xb8')]){return db[_0x8f16('0xb9')][_0x8f16('0x4e')]({'attributes':['id',_0x8f16('0x2c')],'where':{'id':_0x1a1d8e['interaction'][_0x8f16('0xb8')]}})[_0x8f16('0x12')](function(_0x3682c1){if(_0x3682c1){_0x1a1d8e[_0x8f16('0x97')][_0x8f16('0xba')]({'id':0x0,'priority':0x0,'app':_0x8f16('0xbb'),'appdata':_0x3682c1[_0x8f16('0x2c')]+','+(_0x1a1d8e[_0x8f16('0x9b')][_0x8f16('0xbc')]||0xa),'interval':_0x8f16('0xbd')});_0x1a1d8e[_0x8f16('0xbe')]=!![];}return respondWithRpcPromise(_0x8f16('0xbf'),_0x8f16('0xc0'),_0x1a1d8e);});}return respondWithRpcPromise(_0x8f16('0xbf'),'startRouting',_0x1a1d8e);})[_0x8f16('0x12')](function(_0x355d7e){respondWithRpcPromise(_0x8f16('0xc1'),_0x8f16('0xc1'),{'event':_0x8f16('0x7c'),'message':_0x355d7e},client9002);return _0x355d7e;})[_0x8f16('0x12')](respondWithResult(_0x140430,null))[_0x8f16('0x1c')](handleError(_0x140430,null));};exports[_0x8f16('0xc2')]=function(_0x314809,_0x3b8bfc){var _0x29258f,_0x55ff72,_0x116c11;var _0x5e1217=[];var _0x154b86={};var _0x572d1a=_0x314809[_0x8f16('0xc3')]||[];var _0xac03bc=[];var _0x15a00e;return db[_0x8f16('0x83')]['describe']()[_0x8f16('0x12')](function(_0x258cfa){if(!_0x258cfa){throw new db[(_0x8f16('0x84'))]['ValidationError'](_0x8f16('0xc4'));}_0x5e1217=_[_0x8f16('0x86')](_[_0x8f16('0x37')](_0x258cfa),[_0x8f16('0x87'),_0x8f16('0x88'),_0x8f16('0x89'),_0x8f16('0x8a')]);if(_0x314809[_0x8f16('0x49')]['id']){delete _0x314809[_0x8f16('0x49')]['id'];}if(_[_0x8f16('0x71')](_0x314809[_0x8f16('0x49')]['from'])){throw _0x3b8bfc[_0x8f16('0x1e')](0x1f4)[_0x8f16('0x2d')](new db[(_0x8f16('0x84'))]['ValidationError'](_0x8f16('0x8c')));}if(_[_0x8f16('0x71')](_0x314809['body']['body'])||_0x314809['body'][_0x8f16('0x49')]===''){throw _0x3b8bfc[_0x8f16('0x1e')](0x1f4)[_0x8f16('0x2d')](new db[(_0x8f16('0x84'))][(_0x8f16('0x85'))](_0x8f16('0x8d')));}if(_[_0x8f16('0x71')](_0x314809[_0x8f16('0x49')][_0x8f16('0xc5')])){throw _0x3b8bfc[_0x8f16('0x1e')](0x1f4)[_0x8f16('0x2d')](new db[(_0x8f16('0x84'))]['ValidationError'](_0x8f16('0xc6')+_0x5e1217));}if(!_[_0x8f16('0x8f')](_0x5e1217,_0x314809['body'][_0x8f16('0xc5')])){throw _0x3b8bfc[_0x8f16('0x1e')](0x1f4)[_0x8f16('0x2d')](new db[(_0x8f16('0x84'))]['ValidationError'](_0x8f16('0xc7')+_0x5e1217));}_0x154b86[_0x314809[_0x8f16('0x49')]['mapKeyOffline']]=_0x314809[_0x8f16('0x49')][_0x8f16('0x8b')];})['then'](function(){return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'where':{'id':_0x314809['params']['id']},'include':[{'model':db[_0x8f16('0xc8')],'as':'List'},{'model':db[_0x8f16('0xc9')],'as':_0x8f16('0xc9')}]});})[_0x8f16('0x12')](handleEntityNotFound(_0x3b8bfc,null))[_0x8f16('0x12')](function(_0x554247){if(_0x554247&&_0x554247[_0x8f16('0x92')]){_0x55ff72=_0x554247;var _0x18c6a2=_[_0x8f16('0xb')](_0x314809[_0x8f16('0x49')],{'firstName':_0x314809[_0x8f16('0x49')]['from'],'phone':_0x314809[_0x8f16('0x49')]['from'],'ListId':_0x554247[_0x8f16('0x8a')]});_0x18c6a2[_0x314809['body'][_0x8f16('0xc5')]]=_0x314809[_0x8f16('0x49')]['from'];return db[_0x8f16('0x83')][_0x8f16('0xca')]({'where':_0x154b86,'defaults':_0x18c6a2});}})[_0x8f16('0xb2')](function(_0x1d5a64){if(_0x1d5a64){_0x116c11=_0x1d5a64;var _0x348002=fs['readFileSync'](path[_0x8f16('0x73')](config['root'],_0x8f16('0xcb')),_0x8f16('0xcc'));var _0x3ee20c=ejs[_0x8f16('0xcd')](_0x348002,{'body':_[_0x8f16('0xce')](_0x314809['body'][_0x8f16('0x49')]),'bodyTitle':_0x55ff72[_0x8f16('0xcf')]});return db[_0x8f16('0xd0')][_0x8f16('0x51')]({'body':_0x3ee20c,'plainBody':htmlToText[_0x8f16('0xd1')](_0x3ee20c),'ContactId':_0x1d5a64['id'],'ChatWebsiteId':_0x55ff72['id']});}})[_0x8f16('0x12')](function(_0x19fd1f){_0x15a00e=_0x19fd1f;if(_0x572d1a[_0x8f16('0x3c')]){var _0xb14aac=_0x572d1a[_0x8f16('0x2f')](function(_0x3177c7){return{'name':_0x3177c7[_0x8f16('0xd2')],'basename':_0x3177c7[_0x8f16('0x66')],'type':_0x3177c7[_0x8f16('0xd3')],'ChatOfflineMessageId':_0x19fd1f['id']};});_0xac03bc=_0xb14aac[_0x8f16('0x2f')](_0x20dc27=>{var _0x58b000={'filename':_0x20dc27[_0x8f16('0x2c')],'path':path['join'](config['root'],_0x8f16('0xd4'),_0x8f16('0xc3'),_0x8f16('0xd5'),_0x8f16('0xd6'),_0x20dc27[_0x8f16('0xd7')])};return _0x58b000;});if(!_0x55ff72[_0x8f16('0xd8')]){return db[_0x8f16('0xd9')][_0x8f16('0xda')](function(_0x40a90f){return db['Attachment'][_0x8f16('0xdb')](_0xb14aac,{'transaction':_0x40a90f});});}}})['then'](function(){if(_0x15a00e){_0x29258f=_0x15a00e;return db[_0x8f16('0xc9')][_0x8f16('0x60')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x8f16('0xdc'),'raw':!![],'include':[{'model':db[_0x8f16('0xdd')],'as':_0x8f16('0xdd'),'raw':!![]}]}]});}})[_0x8f16('0x12')](function(_0x91cfbf){if(_0x91cfbf&&_0x91cfbf['Smtp']&&_0x55ff72[_0x8f16('0xde')]&&_0x55ff72[_0x8f16('0xdf')]){var _0x2deeeb=_0x91cfbf[_0x8f16('0xe0')]();return respondWithRpcPromise(_0x8f16('0xe1'),_0x8f16('0xe2'),{'account':_0x2deeeb,'message':{'from':util[_0x8f16('0xa8')](_0x8f16('0xe3'),_0x91cfbf[_0x8f16('0x2c')],_0x91cfbf[_0x8f16('0xe4')]||_0x91cfbf[_0x8f16('0xdc')]['user']),'to':_0x55ff72['forwardOfflineAddress'],'subject':_0x55ff72[_0x8f16('0xe5')],'html':_0x29258f[_0x8f16('0x49')],'attachments':_0xac03bc}},client9003)[_0x8f16('0x12')](function(){return _0x29258f;})[_0x8f16('0x1c')](function(_0x55ca43){logger['error'](_0x55ca43);});}})['then'](function(){if(_0x55ff72&&_0x55ff72[_0x8f16('0xd8')]&&_0x55ff72['MailAccountId']){var _0x5284f9=[];if(_0x572d1a['length']){_0x5284f9=_0x572d1a[_0x8f16('0x2f')](function(_0x35feb5){return{'name':_0x35feb5[_0x8f16('0xd2')],'basename':_0x35feb5[_0x8f16('0x66')],'type':_0x35feb5['mimetype'],'ChatOfflineMessageId':_0x15a00e['id']};});}var _0x46a72f;if(!_[_0x8f16('0x71')](_0x55ff72[_0x8f16('0xe6')])){var _0x2fe9ce=_[_0x8f16('0x2f')](_0x314809['body'],function(_0x17a469){return _0x17a469;});var _0x35d55c=_[_0x8f16('0xe7')](_0x2fe9ce)[0x0];var _0x2778c7=_[_0x8f16('0xe8')](_0x35d55c,function(_0x8b5345){return _0x8b5345;});_0x46a72f=_0x2778c7[0x1][_0x55ff72['subjectOffline']];}var _0x409750={'from':_0x116c11[_0x8f16('0xe4')],'firstName':_0x116c11[_0x8f16('0xa2')],'lastName':_0x116c11['lastName'],'mapKey':'email','message':{'from':_0x116c11[_0x8f16('0xe4')],'to':_0x55ff72[_0x8f16('0xc9')]['email'],'cc':'','subject':_[_0x8f16('0x71')](_0x46a72f)?_0x55ff72[_0x8f16('0xe5')]:_0x46a72f,'messageId':'','sentAt':new Date(),'attach':_0x5284f9[_0x8f16('0x3c')],'attachments':_0x5284f9,'originChannel':_0x8f16('0xe9'),'ChatWebsiteId':_0x55ff72['id'],'ChatOfflineMessageId':_0x29258f['id'],'originTo':_0x55ff72[_0x8f16('0xc9')][_0x8f16('0xe4')]},'body':_0x29258f[_0x8f16('0x49')]};var _0x1f06f7={'account':{'id':_0x55ff72[_0x8f16('0xea')]},'body':_0x409750,'log':_0x8f16('0xeb')};return respondWithRpcPromise(_0x8f16('0xeb'),_0x8f16('0xec'),_0x1f06f7,client9001)[_0x8f16('0x12')](function(){return _0x29258f;})[_0x8f16('0x1c')](function(_0x43ffdd){logger[_0x8f16('0x17')](_0x43ffdd);});}return;})['then'](function(){if(_0x29258f){return _0x29258f;}})[_0x8f16('0x12')](respondWithResult(_0x3b8bfc,null))[_0x8f16('0x1c')](function(_0x4fe0d9){logger[_0x8f16('0x17')](_0x8f16('0x1c'),_0x4fe0d9);for(var _0x493ae6 of _0x572d1a){var _0x309ff0=path['join'](config[_0x8f16('0x6c')],_0x8f16('0xd4'),'files',_0x8f16('0xd5'),_0x8f16('0xd6'),_0x493ae6[_0x8f16('0x66')]);fs_extra['remove'](_0x309ff0)[_0x8f16('0x1c')](function(_0x43f913){logger[_0x8f16('0x17')](_0x8f16('0xed'),_0x309ff0,_0x43f913);});}});};exports[_0x8f16('0xee')]=function(_0x1453c7,_0x23536f){return db[_0x8f16('0xae')][_0x8f16('0x4e')]({'where':{'id':_0x1453c7['params']['id']}})['then'](handleEntityNotFound(_0x23536f,null))[_0x8f16('0x12')](function(_0x49ef56){if(_0x49ef56){return _0x49ef56[_0x8f16('0xee')](_0x1453c7[_0x8f16('0x49')][_0x8f16('0x5c')],_['omit'](_0x1453c7[_0x8f16('0x49')],['ids','id'])||{});}})['then'](respondWithResult(_0x23536f,null))[_0x8f16('0x1c')](handleError(_0x23536f,null));};exports['getInteractions']=function(_0x3495e3,_0x354aea){var _0x30f0d8={'raw':![],'where':{}};var _0x1c26d0={};var _0x3fb4d1={'count':0x0,'rows':[]};return db[_0x8f16('0x30')]['findOne']({'where':{'id':_0x3495e3[_0x8f16('0x47')]['id']}})['then'](handleEntityNotFound(_0x354aea,null))[_0x8f16('0x12')](function(_0x42155e){if(_0x42155e){_0x1c26d0[_0x8f16('0x35')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x1c26d0['query']=_[_0x8f16('0x37')](_0x3495e3[_0x8f16('0x36')]);_0x1c26d0['filters']=_[_0x8f16('0x3a')](_0x1c26d0[_0x8f16('0x35')],_0x1c26d0[_0x8f16('0x36')]);_0x30f0d8['attributes']=_[_0x8f16('0x3a')](_0x1c26d0[_0x8f16('0x35')],qs[_0x8f16('0x3b')](_0x3495e3['query'][_0x8f16('0x3b')]));_0x30f0d8[_0x8f16('0x39')]=_0x30f0d8[_0x8f16('0x39')][_0x8f16('0x3c')]?_0x30f0d8[_0x8f16('0x39')]:_0x1c26d0[_0x8f16('0x35')];if(!_0x3495e3[_0x8f16('0x36')][_0x8f16('0x3d')](_0x8f16('0x3e'))){_0x30f0d8[_0x8f16('0x23')]=qs[_0x8f16('0x23')](_0x3495e3['query'][_0x8f16('0x23')]);_0x30f0d8['offset']=qs[_0x8f16('0x21')](_0x3495e3[_0x8f16('0x36')][_0x8f16('0x21')]);}_0x30f0d8[_0x8f16('0x3f')]=qs[_0x8f16('0x59')](_0x3495e3['query'][_0x8f16('0x59')]);_0x30f0d8[_0x8f16('0x40')]=qs[_0x8f16('0x38')](_[_0x8f16('0x41')](_0x3495e3[_0x8f16('0x36')],_0x1c26d0['filters']));_0x30f0d8[_0x8f16('0x40')][_0x8f16('0x57')]=_0x42155e['id'];if(_0x3495e3[_0x8f16('0x36')]['filter']){_0x30f0d8['where']=_['merge'](_0x30f0d8[_0x8f16('0x40')],{'$or':_[_0x8f16('0x2f')](_0x30f0d8[_0x8f16('0x39')],function(_0x2ca6f6){var _0x3d568c={};_0x3d568c[_0x2ca6f6]={'$like':'%'+_0x3495e3[_0x8f16('0x36')][_0x8f16('0x42')]+'%'};return _0x3d568c;})});}_0x30f0d8=_[_0x8f16('0x43')]({},_0x30f0d8,_0x3495e3['options']);return db[_0x8f16('0xae')][_0x8f16('0x24')]({'where':_0x30f0d8[_0x8f16('0x40')]})[_0x8f16('0x12')](function(_0x3ee3ca){_0x3fb4d1[_0x8f16('0x24')]=_0x3ee3ca;if(_0x3495e3['query'][_0x8f16('0x46')]){_0x30f0d8['include']=[{'model':db[_0x8f16('0x83')],'as':_0x8f16('0xef'),'required':![]},{'model':db[_0x8f16('0xb9')],'as':_0x8f16('0xf0'),'attributes':['name',_0x8f16('0xf1'),_0x8f16('0xf2')],'required':![]},{'model':db[_0x8f16('0xf3')],'as':_0x8f16('0xf4'),'attributes':['id',_0x8f16('0x2c'),_0x8f16('0xf5')],'where':_0x3495e3[_0x8f16('0x36')]['tag']?{'id':_0x3495e3['query'][_0x8f16('0xf6')]}:undefined,'required':_0x3495e3['query']['tag']?!![]:![]}];}return db[_0x8f16('0xae')][_0x8f16('0x61')](_0x30f0d8);})[_0x8f16('0x12')](function(_0x4475bb){_0x3fb4d1['rows']=_0x4475bb;return _0x3fb4d1;});}})[_0x8f16('0x12')](respondWithFilteredResult(_0x354aea,_0x30f0d8))[_0x8f16('0x1c')](handleError(_0x354aea,null));};function iftimePromise(_0x2b1153,_0x3c9797){return respondWithRpcPromise('Command',_0x8f16('0xf7'),{'command':_0x3c9797[_0x8f16('0xf8')]?util[_0x8f16('0xa8')](_0x8f16('0xf9'),_0x2b1153['interval'],_0x3c9797[_0x8f16('0xf8')]):util[_0x8f16('0xa8')](_0x8f16('0xfa'),_0x2b1153[_0x8f16('0xfb')])},client9002)[_0x8f16('0x12')](function(_0x491f20){var _0x3d4379=_0x491f20&&_0x491f20[_0x8f16('0xfc')](_0x8f16('0xfd'))>=0x0?!![]:![];logger[_0x8f16('0x13')](_0x8f16('0xfe'),_0x3c9797['id'],_0x2b1153['id'],_0x2b1153[_0x8f16('0xfb')],_0x3d4379?_0x8f16('0xff'):_0x8f16('0x100'),_0x3c9797['timezone']?_0x3c9797[_0x8f16('0xf8')]:_0x8f16('0x101'));return _0x3d4379;})[_0x8f16('0x1c')](function(_0x187040){logger['error'](_0x8f16('0xfe'),_0x3c9797['id'],_0x2b1153['id'],_0x2b1153['interval'],util['inspect'](_0x187040,{'showHidden':![],'depth':null}),_0x3c9797[_0x8f16('0xf8')]?_0x3c9797[_0x8f16('0xf8')]:_0x8f16('0x101'));return![];});}exports[_0x8f16('0xf7')]=function(_0x1b5611,_0x11cd3e){var _0x48f812=0x0;var _0x50e53d=0x0;var _0x1d7ed1=![];var _0x3a062b;var _0x335a8e;return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'where':{'id':_0x1b5611[_0x8f16('0x47')]['id']},'include':[{'model':db[_0x8f16('0x102')],'as':_0x8f16('0x102'),'include':[{'model':db['Interval'],'as':_0x8f16('0x103'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x8f16('0x12')](handleEntityNotFound(_0x11cd3e,null))['then'](function(_0x129714){if(_0x129714){_0x3a062b=_0x129714;return _0x129714[_0x8f16('0x104')]({'raw':!![]});}})[_0x8f16('0x12')](function(_0x10460f){if(_0x3a062b){if(_0x10460f){_0x335a8e=_0x10460f;}}return require(_0x8f16('0x6e'))['getLicense']();})[_0x8f16('0x12')](function(_0x21f8ea){if(_0x21f8ea){_0x50e53d=_0x21f8ea[_0x8f16('0x105')];_0x1d7ed1=_0x21f8ea[_0x8f16('0x70')];}})[_0x8f16('0x12')](function(){return db['ChatInteraction'][_0x8f16('0x24')]({'where':{'closed':![]}});})[_0x8f16('0x12')](function(_0x5e172b){_0x48f812=_0x5e172b;if(_0x50e53d&&_0x5e172b>_0x50e53d){return db['License']['findOne']({'where':{'id':0x1}})['then'](function(_0x98607a){if(_0x98607a){_0x98607a[_0x8f16('0x106')]('chatLicenseExceeded');}});}})[_0x8f16('0x12')](function(){if(_0x3a062b['Interval']&&_0x3a062b[_0x8f16('0x102')][_0x8f16('0x103')]){var _0x3925c0=[];for(var _0x2cb3e2=0x0;_0x2cb3e2<_0x3a062b[_0x8f16('0x102')][_0x8f16('0x103')][_0x8f16('0x3c')];_0x2cb3e2++){var _0x3a00cc=_0x3a062b[_0x8f16('0x102')][_0x8f16('0x103')][_0x2cb3e2][_0x8f16('0x28')]({'plain':!![]});_0x3925c0[_0x8f16('0x107')](iftimePromise(_0x3a00cc,_0x3a062b));}return BPromise['all'](_0x3925c0)[_0x8f16('0x12')](function(_0x8147c8){return _['some'](_0x8147c8);});}else{return!![];}})[_0x8f16('0x12')](function(_0x4ca1eb){var _0x577de8=fs[_0x8f16('0x108')](path[_0x8f16('0x73')](config[_0x8f16('0x6c')],'server/files/chat/iframe.ejs'),_0x8f16('0xcc'));var _0x1a6ec1={'remote':_0x3a062b[_0x8f16('0x109')],'query':querystring[_0x8f16('0x10a')](_[_0x8f16('0x43')](_0x3a062b[_0x8f16('0x28')]({'plain':!![]}),{'customerIp':_0x1b5611['headers']['x-forwarded-for']||_0x1b5611[_0x8f16('0x7f')][_0x8f16('0x10b')]||_0x1b5611['connection'][_0x8f16('0x10c')]||_0x1b5611['ip'],'referer':_0x1b5611[_0x8f16('0x7f')][_0x8f16('0xa5')],'openedInteractions':_0x48f812,'maxInteractions':_0x50e53d,'virtual':_0x1d7ed1[_0x8f16('0x105')],'online':_0x4ca1eb,'custom':_0x1d7ed1}))['replace'](/'/g,'\x5c\x27')};_0x11cd3e[_0x8f16('0x2d')](ejs['render'](Mustache['render'](_0x577de8,_0x1a6ec1),{'proactiveActions':_0x335a8e,'alignment':_0x3a062b['alignment'],'verticalAlignment':_0x3a062b[_0x8f16('0x10d')],'div_color':_0x3a062b[_0x8f16('0xf5')],'labelText':_0x3a062b[_0x8f16('0x10e')],'text_color':_0x3a062b['textColor'],'text_button_color':_0x3a062b['textButtonColor'],'button_color':_0x3a062b[_0x8f16('0x10f')],'background_color':_0x3a062b[_0x8f16('0x110')],'hideWhenOffline':_0x3a062b[_0x8f16('0x111')],'interval':_0x3a062b['IntervalId']}));})['catch'](handleError(_0x11cd3e,null));};exports[_0x8f16('0x112')]=function(_0x443c50,_0x5ac827){var _0x3cdf5b=_0x443c50[_0x8f16('0x47')]['id'];var _0x5567e2=_0x443c50[_0x8f16('0x49')];var _0x5034a0=0xc8;var _0x2ba6bd=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x8f16('0xd9')][_0x8f16('0x113')][_0x8f16('0x114')][_0x8f16('0x115')]},function(_0x106679){return db[_0x8f16('0x30')]['findOne']({'where':{'id':_0x3cdf5b},'transaction':_0x106679})[_0x8f16('0x12')](function(_0x51fb6c){if(_0x51fb6c){return db[_0x8f16('0x116')][_0x8f16('0x27')]({'where':{'ChatWebsiteId':_0x3cdf5b},'transaction':_0x106679})[_0x8f16('0x12')](function(){var _0x49a4ba=_[_0x8f16('0x2f')](_0x5567e2,function(_0x46b4e3){_0x46b4e3[_0x8f16('0x57')]=_0x3cdf5b;return _0x46b4e3;});return db[_0x8f16('0x116')]['bulkCreate'](_0x49a4ba,{'transaction':_0x106679});});}else{_0x5034a0=0x194;_0x2ba6bd=[];}});})[_0x8f16('0x12')](function(){if(_0x5034a0!==0x194){return db[_0x8f16('0x116')][_0x8f16('0x117')]({'where':{'ChatWebsiteId':_0x3cdf5b},'order':'priority'})['then'](function(_0xce679c){_0x2ba6bd=_0xce679c;});}})['catch'](function(_0x1a64dc){_0x5034a0=0x1f4;logger[_0x8f16('0x17')](_0x1a64dc[_0x8f16('0x2b')]);if(_0x1a64dc[_0x8f16('0x2c')]){delete _0x1a64dc[_0x8f16('0x2c')];}_0x2ba6bd=_0x1a64dc;})[_0x8f16('0x118')](function(){if(_0x2ba6bd===null){_0x5ac827[_0x8f16('0x1d')](_0x5034a0);}else{if(_0x5034a0===0x1f4){_0x5ac827[_0x8f16('0x1e')](_0x5034a0)[_0x8f16('0x2d')](_0x2ba6bd);}else{_0x5ac827[_0x8f16('0x1e')](_0x5034a0)['json'](_0x2ba6bd);}}});};exports[_0x8f16('0x119')]=function(_0x4f2356,_0x2658b3){var _0xb4a3bd={};var _0x126e7b={};var _0x402ebe;var _0x1d990b;return db[_0x8f16('0x30')]['findOne']({'where':{'id':_0x4f2356['params']['id']}})['then'](handleEntityNotFound(_0x2658b3,null))[_0x8f16('0x12')](function(_0x4abc97){if(_0x4abc97){_0x402ebe=_0x4abc97;_0x126e7b[_0x8f16('0x35')]=_[_0x8f16('0x37')](db['ChatApplication'][_0x8f16('0x31')]);_0x126e7b['query']=_['keys'](_0x4f2356[_0x8f16('0x36')]);_0x126e7b[_0x8f16('0x38')]=_['intersection'](_0x126e7b[_0x8f16('0x35')],_0x126e7b[_0x8f16('0x36')]);_0xb4a3bd['attributes']=_[_0x8f16('0x3a')](_0x126e7b[_0x8f16('0x35')],qs[_0x8f16('0x3b')](_0x4f2356[_0x8f16('0x36')][_0x8f16('0x3b')]));_0xb4a3bd['attributes']=_0xb4a3bd['attributes'][_0x8f16('0x3c')]?_0xb4a3bd[_0x8f16('0x39')]:_0x126e7b[_0x8f16('0x35')];_0xb4a3bd[_0x8f16('0x3f')]=qs['sort'](_0x4f2356[_0x8f16('0x36')]['sort']);_0xb4a3bd[_0x8f16('0x40')]=qs[_0x8f16('0x38')](_[_0x8f16('0x41')](_0x4f2356[_0x8f16('0x36')],_0x126e7b[_0x8f16('0x38')]));if(_0x4f2356[_0x8f16('0x36')][_0x8f16('0x42')]){_0xb4a3bd['where']=_[_0x8f16('0x43')](_0xb4a3bd['where'],{'$or':_[_0x8f16('0x2f')](_0xb4a3bd['attributes'],function(_0x513785){var _0x2461bd={};_0x2461bd[_0x513785]={'$like':'%'+_0x4f2356[_0x8f16('0x36')]['filter']+'%'};return _0x2461bd;})});}_0xb4a3bd=_[_0x8f16('0x43')]({},_0xb4a3bd,_0x4f2356['options']);return _0x402ebe['getApplications'](_0xb4a3bd);}})[_0x8f16('0x12')](function(_0x8ba64e){if(_0x8ba64e){_0x1d990b=_0x8ba64e[_0x8f16('0x3c')];if(!_0x4f2356[_0x8f16('0x36')][_0x8f16('0x3d')]('nolimit')){_0xb4a3bd[_0x8f16('0x23')]=qs[_0x8f16('0x23')](_0x4f2356['query'][_0x8f16('0x23')]);_0xb4a3bd['offset']=qs[_0x8f16('0x21')](_0x4f2356[_0x8f16('0x36')]['offset']);}return _0x402ebe[_0x8f16('0x119')](_0xb4a3bd);}})[_0x8f16('0x12')](function(_0x34fc72){if(_0x34fc72){return _0x34fc72?{'count':_0x1d990b,'rows':_0x34fc72}:null;}})[_0x8f16('0x12')](respondWithResult(_0x2658b3,null))[_0x8f16('0x1c')](handleError(_0x2658b3,null));};exports['addProactiveActions']=function(_0x33e2ee,_0x7b90be){return db[_0x8f16('0x11a')][_0x8f16('0x4e')]({'where':{'id':_0x33e2ee[_0x8f16('0x47')]['id']}})['then'](handleEntityNotFound(_0x7b90be,null))[_0x8f16('0x12')](function(_0xbb135a){if(_0xbb135a){return _0xbb135a[_0x8f16('0x11b')](_0x33e2ee[_0x8f16('0x49')][_0x8f16('0x5c')],_['omit'](_0x33e2ee['body'],[_0x8f16('0x5c'),'id'])||{});}})[_0x8f16('0x12')](respondWithResult(_0x7b90be,null))['catch'](handleError(_0x7b90be,null));};exports[_0x8f16('0x104')]=function(_0x37e6d8,_0xd9ada6){var _0x207de9={};var _0x1c5b90={};var _0x25765d;var _0x26a29f;return db['ChatWebsite'][_0x8f16('0x60')]({'where':{'id':_0x37e6d8[_0x8f16('0x47')]['id']}})['then'](handleEntityNotFound(_0xd9ada6,null))[_0x8f16('0x12')](function(_0x125ad1){if(_0x125ad1){_0x25765d=_0x125ad1;_0x1c5b90[_0x8f16('0x35')]=_[_0x8f16('0x37')](db[_0x8f16('0x11c')][_0x8f16('0x31')]);_0x1c5b90[_0x8f16('0x36')]=_[_0x8f16('0x37')](_0x37e6d8[_0x8f16('0x36')]);_0x1c5b90[_0x8f16('0x38')]=_[_0x8f16('0x3a')](_0x1c5b90[_0x8f16('0x35')],_0x1c5b90[_0x8f16('0x36')]);_0x207de9['attributes']=_['intersection'](_0x1c5b90[_0x8f16('0x35')],qs[_0x8f16('0x3b')](_0x37e6d8[_0x8f16('0x36')][_0x8f16('0x3b')]));_0x207de9[_0x8f16('0x39')]=_0x207de9['attributes'][_0x8f16('0x3c')]?_0x207de9[_0x8f16('0x39')]:_0x1c5b90['model'];_0x207de9[_0x8f16('0x3f')]=qs['sort'](_0x37e6d8[_0x8f16('0x36')][_0x8f16('0x59')]);_0x207de9[_0x8f16('0x40')]=qs['filters'](_[_0x8f16('0x41')](_0x37e6d8[_0x8f16('0x36')],_0x1c5b90[_0x8f16('0x38')]));if(_0x37e6d8[_0x8f16('0x36')][_0x8f16('0x42')]){_0x207de9[_0x8f16('0x40')]=_[_0x8f16('0x43')](_0x207de9[_0x8f16('0x40')],{'$or':_['map'](_0x207de9[_0x8f16('0x39')],function(_0x39a4cc){var _0x508cbb={};_0x508cbb[_0x39a4cc]={'$like':'%'+_0x37e6d8[_0x8f16('0x36')]['filter']+'%'};return _0x508cbb;})});}_0x207de9=_[_0x8f16('0x43')]({},_0x207de9,_0x37e6d8[_0x8f16('0x45')]);return _0x25765d[_0x8f16('0x104')](_0x207de9);}})[_0x8f16('0x12')](function(_0x1c85fd){if(_0x1c85fd){_0x26a29f=_0x1c85fd['length'];if(!_0x37e6d8[_0x8f16('0x36')]['hasOwnProperty'](_0x8f16('0x3e'))){_0x207de9[_0x8f16('0x23')]=qs[_0x8f16('0x23')](_0x37e6d8[_0x8f16('0x36')][_0x8f16('0x23')]);_0x207de9[_0x8f16('0x21')]=qs[_0x8f16('0x21')](_0x37e6d8[_0x8f16('0x36')][_0x8f16('0x21')]);}return _0x25765d[_0x8f16('0x104')](_0x207de9);}})[_0x8f16('0x12')](function(_0x5b9071){if(_0x5b9071){return _0x5b9071?{'count':_0x26a29f,'rows':_0x5b9071}:null;}})['then'](respondWithResult(_0xd9ada6,null))[_0x8f16('0x1c')](handleError(_0xd9ada6,null));};exports['getFields']=function(_0x5848ad,_0x31d303){var _0x23fab1=_0x5848ad[_0x8f16('0x36')][_0x8f16('0x11d')]===_0x8f16('0x11e')?_0x8f16('0x11f'):_0x8f16('0x120');return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'attributes':['id',_0x23fab1],'where':{'id':_0x5848ad[_0x8f16('0x47')]['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x31d303,null))[_0x8f16('0x12')](function(_0x5d010b){if(_0x5d010b){var _0x3f5053=_0x5d010b[_0x23fab1];var _0x15ca4d=_0x3f5053&&_0x3f5053[_0x8f16('0x121')]?_0x3f5053[_0x8f16('0x121')]:[];_0x31d303['send']({'fromKey':_['isNil'](_0x3f5053[_0x8f16('0x122')])?undefined:_0x3f5053['fromKey'],'count':_0x15ca4d[_0x8f16('0x3c')],'rows':_0x15ca4d});}})[_0x8f16('0x1c')](handleError(_0x31d303,null));};exports['getOfflineMessages']=function(_0x5bc3fb,_0x62cc36){var _0xd0d3e5={'raw':![],'where':{}};var _0x3decf7={};var _0x1e717a={'count':0x0,'rows':[]};return db[_0x8f16('0x30')][_0x8f16('0x60')]({'where':{'id':_0x5bc3fb[_0x8f16('0x47')]['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x62cc36,null))[_0x8f16('0x12')](function(_0x237886){if(_0x237886){_0x3decf7[_0x8f16('0x35')]=_[_0x8f16('0x37')](db[_0x8f16('0xd0')][_0x8f16('0x31')]);_0x3decf7[_0x8f16('0x36')]=_[_0x8f16('0x37')](_0x5bc3fb[_0x8f16('0x36')]);_0x3decf7[_0x8f16('0x38')]=_[_0x8f16('0x3a')](_0x3decf7[_0x8f16('0x35')],_0x3decf7[_0x8f16('0x36')]);_0xd0d3e5[_0x8f16('0x39')]=_[_0x8f16('0x3a')](_0x3decf7[_0x8f16('0x35')],qs[_0x8f16('0x3b')](_0x5bc3fb[_0x8f16('0x36')]['fields']));_0xd0d3e5[_0x8f16('0x39')]=_0xd0d3e5['attributes'][_0x8f16('0x3c')]?_0xd0d3e5['attributes']:_0x3decf7[_0x8f16('0x35')];if(!_0x5bc3fb[_0x8f16('0x36')][_0x8f16('0x3d')]('nolimit')){_0xd0d3e5[_0x8f16('0x23')]=qs[_0x8f16('0x23')](_0x5bc3fb['query'][_0x8f16('0x23')]);_0xd0d3e5[_0x8f16('0x21')]=qs[_0x8f16('0x21')](_0x5bc3fb[_0x8f16('0x36')][_0x8f16('0x21')]);}_0xd0d3e5[_0x8f16('0x3f')]=qs[_0x8f16('0x59')](_0x5bc3fb[_0x8f16('0x36')][_0x8f16('0x59')]);_0xd0d3e5[_0x8f16('0x40')]=qs[_0x8f16('0x38')](_['pick'](_0x5bc3fb['query'],_0x3decf7[_0x8f16('0x38')]));_0xd0d3e5[_0x8f16('0x40')]['ChatWebsiteId']=_0x237886['id'];if(_0x5bc3fb[_0x8f16('0x36')][_0x8f16('0x42')]){_0xd0d3e5[_0x8f16('0x40')]=_['merge'](_0xd0d3e5[_0x8f16('0x40')],{'$or':_[_0x8f16('0x2f')](_0xd0d3e5[_0x8f16('0x39')],function(_0x5896a1){var _0x4c1f9b={};_0x4c1f9b[_0x5896a1]={'$like':'%'+_0x5bc3fb[_0x8f16('0x36')][_0x8f16('0x42')]+'%'};return _0x4c1f9b;})});}_0xd0d3e5=_[_0x8f16('0x43')]({},_0xd0d3e5,_0x5bc3fb['options']);return db[_0x8f16('0xd0')]['count']({'where':_0xd0d3e5[_0x8f16('0x40')]})[_0x8f16('0x12')](function(_0x30782e){_0x1e717a[_0x8f16('0x24')]=_0x30782e;if(_0x5bc3fb[_0x8f16('0x36')]['includeAll']){_0xd0d3e5['include']=[{'all':!![]}];}else{_0xd0d3e5[_0x8f16('0x48')]=[{'model':db[_0x8f16('0x83')],'as':_0x8f16('0xef'),'required':![]},{'model':db[_0x8f16('0x123')],'as':_0x8f16('0x124'),'required':![]}];}return db[_0x8f16('0xd0')]['findAll'](_0xd0d3e5);})[_0x8f16('0x12')](function(_0xb5e6d){_0x1e717a['rows']=_0xb5e6d;return _0x1e717a;});}})[_0x8f16('0x12')](respondWithFilteredResult(_0x62cc36,_0xd0d3e5))[_0x8f16('0x1c')](handleError(_0x62cc36,null));};exports[_0x8f16('0x125')]=function(_0x4a4028,_0x4b47ca){return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'where':{'id':_0x4a4028[_0x8f16('0x47')]['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x4b47ca,null))[_0x8f16('0x12')](function(_0x5eb984){if(_0x5eb984){return _0x5eb984[_0x8f16('0x125')](_0x4a4028[_0x8f16('0x49')]['ids'],_[_0x8f16('0x126')](_0x4a4028[_0x8f16('0x49')],['ids','id'])||{})[_0x8f16('0xb2')](function(_0x368a19){for(var _0x4a702f=0x0;_0x4a702f<_0x4a4028[_0x8f16('0x49')][_0x8f16('0x5c')][_0x8f16('0x3c')];_0x4a702f+=0x1){socket[_0x8f16('0x127')](_0x8f16('0x128'),{'UserId':Number(_0x4a4028[_0x8f16('0x49')]['ids'][_0x4a702f]),'ChatWebsiteId':Number(_0x4a4028[_0x8f16('0x47')]['id'])});}return _0x368a19;});}})['then'](respondWithResult(_0x4b47ca,null))[_0x8f16('0x1c')](handleError(_0x4b47ca,null));};exports[_0x8f16('0x129')]=function(_0x33ad2c,_0x287513){return db[_0x8f16('0x30')][_0x8f16('0x4e')]({'where':{'id':_0x33ad2c[_0x8f16('0x47')]['id']}})[_0x8f16('0x12')](handleEntityNotFound(_0x287513,null))[_0x8f16('0x12')](function(_0x43f53d){if(_0x43f53d){return _0x43f53d[_0x8f16('0x129')](_0x33ad2c[_0x8f16('0x36')]['ids'])[_0x8f16('0x12')](function(){if(_[_0x8f16('0x12a')](_0x33ad2c[_0x8f16('0x36')][_0x8f16('0x5c')])){for(var _0x18c1a7=0x0;_0x18c1a7<_0x33ad2c[_0x8f16('0x36')][_0x8f16('0x5c')]['length'];_0x18c1a7+=0x1){socket[_0x8f16('0x127')](_0x8f16('0x12b'),{'UserId':Number(_0x33ad2c[_0x8f16('0x36')]['ids'][_0x18c1a7]),'ChatWebsiteId':Number(_0x33ad2c[_0x8f16('0x47')]['id'])});}}else{socket[_0x8f16('0x127')](_0x8f16('0x12b'),{'UserId':Number(_0x33ad2c['query'][_0x8f16('0x5c')]),'ChatWebsiteId':Number(_0x33ad2c[_0x8f16('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x287513,null))['catch'](handleError(_0x287513,null));};exports['getAgents']=function(_0x17bd36,_0x4081f4){var _0x472a5a={};var _0x3b1894={};var _0x2bc781;var _0x94a3f9;return db[_0x8f16('0x30')][_0x8f16('0x60')]({'where':{'id':_0x17bd36[_0x8f16('0x47')]['id']}})['then'](handleEntityNotFound(_0x4081f4,null))[_0x8f16('0x12')](function(_0x5002a8){if(_0x5002a8){_0x2bc781=_0x5002a8;_0x3b1894[_0x8f16('0x35')]=_[_0x8f16('0x37')](db[_0x8f16('0xb9')][_0x8f16('0x31')]);_0x3b1894['query']=_[_0x8f16('0x37')](_0x17bd36['query']);_0x3b1894[_0x8f16('0x38')]=_[_0x8f16('0x3a')](_0x3b1894[_0x8f16('0x35')],_0x3b1894['query']);_0x472a5a[_0x8f16('0x39')]=_['intersection'](_0x3b1894[_0x8f16('0x35')],qs[_0x8f16('0x3b')](_0x17bd36['query'][_0x8f16('0x3b')]));_0x472a5a[_0x8f16('0x39')]=_0x472a5a[_0x8f16('0x39')][_0x8f16('0x3c')]?_0x472a5a['attributes']:_0x3b1894[_0x8f16('0x35')];_0x472a5a[_0x8f16('0x3f')]=qs[_0x8f16('0x59')](_0x17bd36[_0x8f16('0x36')][_0x8f16('0x59')]);_0x472a5a['where']=qs[_0x8f16('0x38')](_['pick'](_0x17bd36[_0x8f16('0x36')],_0x3b1894['filters']));if(_0x17bd36['query'][_0x8f16('0x42')]){_0x472a5a['where']=_[_0x8f16('0x43')](_0x472a5a[_0x8f16('0x40')],{'$or':_[_0x8f16('0x2f')](_0x472a5a[_0x8f16('0x39')],function(_0x1b44d7){var _0x578529={};_0x578529[_0x1b44d7]={'$like':'%'+_0x17bd36[_0x8f16('0x36')][_0x8f16('0x42')]+'%'};return _0x578529;})});}_0x472a5a=_[_0x8f16('0x43')]({},_0x472a5a,_0x17bd36[_0x8f16('0x45')]);return _0x2bc781['getAgents'](_0x472a5a);}})['then'](function(_0x596f4c){if(_0x596f4c){_0x94a3f9=_0x596f4c['length'];if(!_0x17bd36[_0x8f16('0x36')]['hasOwnProperty'](_0x8f16('0x3e'))){_0x472a5a[_0x8f16('0x23')]=qs[_0x8f16('0x23')](_0x17bd36[_0x8f16('0x36')][_0x8f16('0x23')]);_0x472a5a[_0x8f16('0x21')]=qs[_0x8f16('0x21')](_0x17bd36['query'][_0x8f16('0x21')]);}return _0x2bc781[_0x8f16('0x12c')](_0x472a5a);}})[_0x8f16('0x12')](function(_0x28a687){if(_0x28a687){return _0x28a687?{'count':_0x94a3f9,'rows':_0x28a687}:null;}})[_0x8f16('0x12')](respondWithResult(_0x4081f4,null))[_0x8f16('0x1c')](handleError(_0x4081f4,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 554bc83..6d259e6 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 _0xa41a=['remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update'];(function(_0xe3390b,_0x1daddd){var _0x22658c=function(_0x1bd38f){while(--_0x1bd38f){_0xe3390b['push'](_0xe3390b['shift']());}};_0x22658c(++_0x1daddd);}(_0xa41a,0x6b));var _0xaa41=function(_0x40879b,_0x65ac13){_0x40879b=_0x40879b-0x0;var _0x581594=_0xa41a[_0x40879b];return _0x581594;};'use strict';var EventEmitter=require(_0xaa41('0x0'));var ChatWebsite=require(_0xaa41('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xaa41('0x2')](0x0);var events={'afterCreate':_0xaa41('0x3'),'afterUpdate':_0xaa41('0x4'),'afterDestroy':_0xaa41('0x5')};function emitEvent(_0x37c7a1){return function(_0x3168be,_0x42896b,_0x251efa){ChatWebsiteEvents['emit'](_0x37c7a1+':'+_0x3168be['id'],_0x3168be);ChatWebsiteEvents[_0xaa41('0x6')](_0x37c7a1,_0x3168be);_0x251efa(null);};}for(var e in events){if(events[_0xaa41('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x2392=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x4578e7,_0x1c72a2){var _0x3db768=function(_0x58a4ed){while(--_0x58a4ed){_0x4578e7['push'](_0x4578e7['shift']());}};_0x3db768(++_0x1c72a2);}(_0x2392,0xd0));var _0x2239=function(_0x518bd5,_0x292bfe){_0x518bd5=_0x518bd5-0x0;var _0x45caaa=_0x2392[_0x518bd5];return _0x45caaa;};'use strict';var EventEmitter=require(_0x2239('0x0'));var ChatWebsite=require(_0x2239('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2239('0x2')](0x0);var events={'afterCreate':_0x2239('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x277193){return function(_0x420e52,_0x3f3b7c,_0x42dcec){ChatWebsiteEvents[_0x2239('0x4')](_0x277193+':'+_0x420e52['id'],_0x420e52);ChatWebsiteEvents[_0x2239('0x4')](_0x277193,_0x420e52);_0x42dcec(null);};}for(var e in events){if(events[_0x2239('0x5')](e)){var event=events[e];ChatWebsite[_0x2239('0x6')](e,emitEvent(event));}}module[_0x2239('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index af97716..9b93488 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 _0xa7e3=['rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x49057a,_0x4c6add){var _0x54b2d0=function(_0x37e906){while(--_0x37e906){_0x49057a['push'](_0x49057a['shift']());}};_0x54b2d0(++_0x4c6add);}(_0xa7e3,0x19e));var _0x3a7e=function(_0x12b944,_0x3f2c46){_0x12b944=_0x12b944-0x0;var _0xa542bf=_0xa7e3[_0x12b944];return _0xa542bf;};'use strict';var _=require('lodash');var util=require(_0x3a7e('0x0'));var logger=require(_0x3a7e('0x1'))('api');var moment=require(_0x3a7e('0x2'));var BPromise=require(_0x3a7e('0x3'));var rp=require(_0x3a7e('0x4'));var fs=require('fs');var path=require(_0x3a7e('0x5'));var rimraf=require(_0x3a7e('0x6'));var config=require('../../config/environment');var attributes=require(_0x3a7e('0x7'));module[_0x3a7e('0x8')]=function(_0x375637,_0x43b9fe){return _0x375637[_0x3a7e('0x9')](_0x3a7e('0xa'),attributes,{'tableName':_0x3a7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8195=['define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x56d3d5,_0x11ab73){var _0x35a042=function(_0x3d0270){while(--_0x3d0270){_0x56d3d5['push'](_0x56d3d5['shift']());}};_0x35a042(++_0x11ab73);}(_0x8195,0x1bf));var _0x5819=function(_0x56ec52,_0x35e3c3){_0x56ec52=_0x56ec52-0x0;var _0x324eb2=_0x8195[_0x56ec52];return _0x324eb2;};'use strict';var _=require(_0x5819('0x0'));var util=require('util');var logger=require(_0x5819('0x1'))(_0x5819('0x2'));var moment=require(_0x5819('0x3'));var BPromise=require('bluebird');var rp=require(_0x5819('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5819('0x5'));var config=require(_0x5819('0x6'));var attributes=require(_0x5819('0x7'));module[_0x5819('0x8')]=function(_0x335991,_0x3efffc){return _0x335991[_0x5819('0x9')](_0x5819('0xa'),attributes,{'tableName':_0x5819('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 341cb25..0e42a39 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 _0x2ee1=['socket.io-emitter','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x34882f,_0x601a99){var _0x455929=function(_0x463c7c){while(--_0x463c7c){_0x34882f['push'](_0x34882f['shift']());}};_0x455929(++_0x601a99);}(_0x2ee1,0xee));var _0x12ee=function(_0xfe3abe,_0x2a0817){_0xfe3abe=_0xfe3abe-0x0;var _0x4935d7=_0x2ee1[_0xfe3abe];return _0x4935d7;};'use strict';var _=require(_0x12ee('0x0'));var util=require(_0x12ee('0x1'));var moment=require('moment');var BPromise=require(_0x12ee('0x2'));var rs=require(_0x12ee('0x3'));var fs=require('fs');var Redis=require(_0x12ee('0x4'));var db=require(_0x12ee('0x5'))['db'];var utils=require(_0x12ee('0x6'));var logger=require('../../config/logger')(_0x12ee('0x7'));var config=require(_0x12ee('0x8'));var jayson=require(_0x12ee('0x9'));var client=jayson[_0x12ee('0xa')][_0x12ee('0xb')]({'port':0x232a});config[_0x12ee('0xc')]=_[_0x12ee('0xd')](config[_0x12ee('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x12ee('0xe'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x12ee('0xf')](socket);function respondWithRpcPromise(_0x54fc48,_0x494690,_0x4ce6be){return new BPromise(function(_0x4b1e9c,_0x1be7b8){return client[_0x12ee('0x10')](_0x54fc48,_0x4ce6be)[_0x12ee('0x11')](function(_0x26f509){logger['info'](_0x12ee('0x12'),_0x494690,_0x12ee('0x13'));logger[_0x12ee('0x14')](_0x12ee('0x15'),_0x494690,_0x12ee('0x13'),JSON[_0x12ee('0x16')](_0x26f509));if(_0x26f509[_0x12ee('0x17')]){if(_0x26f509[_0x12ee('0x17')][_0x12ee('0x18')]===0x1f4){logger[_0x12ee('0x17')](_0x12ee('0x12'),_0x494690,_0x26f509[_0x12ee('0x17')][_0x12ee('0x19')]);return _0x1be7b8(_0x26f509[_0x12ee('0x17')][_0x12ee('0x19')]);}logger[_0x12ee('0x17')](_0x12ee('0x12'),_0x494690,_0x26f509[_0x12ee('0x17')]['message']);return _0x4b1e9c(_0x26f509[_0x12ee('0x17')][_0x12ee('0x19')]);}else{logger[_0x12ee('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x494690,_0x12ee('0x13'));_0x4b1e9c(_0x26f509['result'][_0x12ee('0x19')]);}})[_0x12ee('0x1b')](function(_0x5d82ae){logger['error'](_0x12ee('0x12'),_0x494690,_0x5d82ae);_0x1be7b8(_0x5d82ae);});});} \ No newline at end of file +var _0x134f=['ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x543583,_0x371d21){var _0x5d79c3=function(_0x1d020e){while(--_0x1d020e){_0x543583['push'](_0x543583['shift']());}};_0x5d79c3(++_0x371d21);}(_0x134f,0x157));var _0xf134=function(_0x51dadd,_0x565279){_0x51dadd=_0x51dadd-0x0;var _0x10c8e9=_0x134f[_0x51dadd];return _0x10c8e9;};'use strict';var _=require(_0xf134('0x0'));var util=require(_0xf134('0x1'));var moment=require('moment');var BPromise=require(_0xf134('0x2'));var rs=require(_0xf134('0x3'));var fs=require('fs');var Redis=require(_0xf134('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf134('0x5'));var logger=require(_0xf134('0x6'))(_0xf134('0x7'));var config=require(_0xf134('0x8'));var jayson=require(_0xf134('0x9'));var client=jayson['client'][_0xf134('0xa')]({'port':0x232a});config['redis']=_[_0xf134('0xb')](config[_0xf134('0xc')],{'host':_0xf134('0xd'),'port':0x18eb});var socket=require(_0xf134('0xe'))(new Redis(config[_0xf134('0xc')]));require(_0xf134('0xf'))[_0xf134('0x10')](socket);function respondWithRpcPromise(_0xaded7c,_0x50594e,_0x13a55c){return new BPromise(function(_0x5d89b2,_0x2d614c){return client['request'](_0xaded7c,_0x13a55c)['then'](function(_0x57d2bb){logger[_0xf134('0x11')](_0xf134('0x12'),_0x50594e,_0xf134('0x13'));logger[_0xf134('0x14')](_0xf134('0x15'),_0x50594e,_0xf134('0x13'),JSON['stringify'](_0x57d2bb));if(_0x57d2bb[_0xf134('0x16')]){if(_0x57d2bb['error']['code']===0x1f4){logger[_0xf134('0x16')](_0xf134('0x12'),_0x50594e,_0x57d2bb['error']['message']);return _0x2d614c(_0x57d2bb[_0xf134('0x16')]['message']);}logger['error'](_0xf134('0x12'),_0x50594e,_0x57d2bb[_0xf134('0x16')][_0xf134('0x17')]);return _0x5d89b2(_0x57d2bb[_0xf134('0x16')]['message']);}else{logger[_0xf134('0x11')](_0xf134('0x12'),_0x50594e,_0xf134('0x13'));_0x5d89b2(_0x57d2bb[_0xf134('0x18')][_0xf134('0x17')]);}})[_0xf134('0x19')](function(_0x400f39){logger[_0xf134('0x16')](_0xf134('0x12'),_0x50594e,_0x400f39);_0x2d614c(_0x400f39);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index b782bce..9bfe636 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 _0x4870=['register','chatWebsite:','remove','update','emit'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x4870,0xc0));var _0x0487=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x4870[_0x1203f];return _0x365f0a;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0x0487('0x0'),_0x0487('0x1')];function createListener(_0x122aa9,_0x183e62){return function(_0x4c5719){_0x183e62[_0x0487('0x2')](_0x122aa9,_0x4c5719);};}function removeListener(_0x843e2e,_0x237fed){return function(){ChatWebsiteEvents['removeListener'](_0x843e2e,_0x237fed);};}exports[_0x0487('0x3')]=function(_0x27fb54){for(var _0x5b149d=0x0,_0x20f637=events['length'];_0x5b149d<_0x20f637;_0x5b149d++){var _0x240d38=events[_0x5b149d];var _0x3088b9=createListener(_0x0487('0x4')+_0x240d38,_0x27fb54);ChatWebsiteEvents['on'](_0x240d38,_0x3088b9);}}; \ No newline at end of file +var _0x0636=['save','remove','update','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0636,0x8f));var _0x6063=function(_0x282f91,_0x4160d4){_0x282f91=_0x282f91-0x0;var _0xa635bf=_0x0636[_0x282f91];return _0xa635bf;};'use strict';var ChatWebsiteEvents=require(_0x6063('0x0'));var events=[_0x6063('0x1'),_0x6063('0x2'),_0x6063('0x3')];function createListener(_0x58f4cf,_0x4e7222){return function(_0x638cfc){_0x4e7222['emit'](_0x58f4cf,_0x638cfc);};}function removeListener(_0x3ea6ed,_0x28c90e){return function(){ChatWebsiteEvents[_0x6063('0x4')](_0x3ea6ed,_0x28c90e);};}exports[_0x6063('0x5')]=function(_0x21c0c5){for(var _0x42f786=0x0,_0x1cb470=events[_0x6063('0x6')];_0x42f786<_0x1cb470;_0x42f786++){var _0x5bd6b0=events[_0x42f786];var _0x547a44=createListener(_0x6063('0x7')+_0x5bd6b0,_0x21c0c5);ChatWebsiteEvents['on'](_0x5bd6b0,_0x547a44);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 1f4f4ae..7d4c4c2 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 _0x7c79=['/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','file','server/files/images/avatars/','now','single','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','/:id/offline','offline','/:id/interactions','addApplications','addProactiveActions','addAgents','destroy','/:id/dispositions','removeDispositions','delete','removeAnswers','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7c79,0x177));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x97c7('0x0'));var util=require(_0x97c7('0x1'));var path=require(_0x97c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x97c7('0x3'));var router=express[_0x97c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x97c7('0x5'));var config=require(_0x97c7('0x6'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x97c7('0x7')](),controller[_0x97c7('0x8')]);router[_0x97c7('0x9')]('/describe',auth[_0x97c7('0x7')](),controller[_0x97c7('0xa')]);router[_0x97c7('0x9')](_0x97c7('0xb'),auth[_0x97c7('0x7')](),controller['show']);router[_0x97c7('0x9')]('/:id/dispositions',auth[_0x97c7('0x7')](),controller[_0x97c7('0xc')]);router['get'](_0x97c7('0xd'),auth[_0x97c7('0x7')](),controller[_0x97c7('0xe')]);router[_0x97c7('0x9')](_0x97c7('0xf'),controller[_0x97c7('0x10')]);router['get']('/:id/avatar',controller[_0x97c7('0x11')]);router['get'](_0x97c7('0x12'),controller['getCustomerAvatar']);router[_0x97c7('0x9')](_0x97c7('0x13'),controller[_0x97c7('0x14')]);router['get']('/:id/interactions',auth[_0x97c7('0x7')](),controller[_0x97c7('0x15')]);router['get']('/:id/snippet',controller[_0x97c7('0x16')]);router['get'](_0x97c7('0x17'),auth['isAuthenticated'](),controller[_0x97c7('0x18')]);router[_0x97c7('0x9')](_0x97c7('0x19'),auth['isAuthenticated'](),controller[_0x97c7('0x1a')]);router['get'](_0x97c7('0x1b'),controller[_0x97c7('0x1c')]);router[_0x97c7('0x9')]('/:id/offline_messages',auth[_0x97c7('0x7')](),controller[_0x97c7('0x1d')]);router[_0x97c7('0x9')](_0x97c7('0x1e'),auth[_0x97c7('0x7')](),controller[_0x97c7('0x1f')]);router[_0x97c7('0x20')]('/',auth['isAuthenticated'](),controller[_0x97c7('0x21')]);router[_0x97c7('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x97c7('0x22')]);router[_0x97c7('0x20')]('/:id/canned_answers',auth[_0x97c7('0x7')](),controller[_0x97c7('0x23')]);var upload=multer({'storage':multer[_0x97c7('0x24')]({'destination':function(_0x9ba20f,_0x525c26,_0x8b9744){_0x8b9744(null,path[_0x97c7('0x25')](config[_0x97c7('0x26')],_0x97c7('0x27')));},'filename':function(_0x145674,_0x26165a,_0x564f23){_0x564f23(null,util[_0x97c7('0x28')](_0x97c7('0x29'),Date['now'](),_0x26165a[_0x97c7('0x2a')]));}})});router[_0x97c7('0x20')](_0x97c7('0xf'),upload['single'](_0x97c7('0x2b')),controller['addLogo']);var upload=multer({'storage':multer[_0x97c7('0x24')]({'destination':function(_0x2b7e46,_0x70aa3b,_0x655608){_0x655608(null,path[_0x97c7('0x25')](config[_0x97c7('0x26')],_0x97c7('0x2c')));},'filename':function(_0xaf1b91,_0x2bba89,_0x4a7a7b){_0x4a7a7b(null,util[_0x97c7('0x28')](_0x97c7('0x29'),Date[_0x97c7('0x2d')](),_0x2bba89[_0x97c7('0x2a')]));}})});router[_0x97c7('0x20')]('/:id/avatar',upload[_0x97c7('0x2e')]('file'),controller[_0x97c7('0x2f')]);var upload=multer({'storage':multer[_0x97c7('0x24')]({'destination':function(_0x1face4,_0x52bb57,_0x3e3aed){_0x3e3aed(null,path[_0x97c7('0x25')](config[_0x97c7('0x26')],_0x97c7('0x2c')));},'filename':function(_0x2b6f98,_0x3a4662,_0x283212){_0x283212(null,util[_0x97c7('0x28')]('%s-%s',Date[_0x97c7('0x2d')](),_0x3a4662[_0x97c7('0x2a')]));}})});router[_0x97c7('0x20')]('/:id/customer_avatar',upload['single']('file'),controller[_0x97c7('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5790de,_0x3e4f44,_0x150bca){_0x150bca(null,path[_0x97c7('0x25')](config[_0x97c7('0x26')],_0x97c7('0x2c')));},'filename':function(_0x6dfcd2,_0x3a8608,_0x9077bf){_0x9077bf(null,util[_0x97c7('0x28')](_0x97c7('0x29'),Date['now'](),_0x3a8608['originalname']));}})});router[_0x97c7('0x20')](_0x97c7('0x13'),upload[_0x97c7('0x2e')](_0x97c7('0x2b')),controller[_0x97c7('0x31')]);router[_0x97c7('0x20')](_0x97c7('0x32'),controller[_0x97c7('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x97c7('0x24')]({'destination':function(_0x1f4036,_0xeddad9,_0x5017e){const _0x4ae10f=path[_0x97c7('0x25')](config['root'],_0x97c7('0x34'),_0x97c7('0x35'),_0x97c7('0x36'));fs_extra['ensureDir'](_0x4ae10f,function(){_0x5017e(null,_0x4ae10f);});},'filename':function(_0x8f06de,_0x58aefe,_0x431162){const _0x28e4b8=_0x58aefe[_0x97c7('0x2a')][_0x97c7('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x346812=path['extname'](_0x28e4b8);const _0x2d5149=Date['now']()+'-'+_0x28e4b8[_0x97c7('0x37')](_0x346812,'')+_0x346812;_0x431162(null,_0x2d5149);}})});router[_0x97c7('0x20')](_0x97c7('0x38'),offlineUploadMulter['any'](),controller[_0x97c7('0x39')]);router[_0x97c7('0x20')](_0x97c7('0x3a'),auth[_0x97c7('0x7')](),controller['addInteraction']);router[_0x97c7('0x20')](_0x97c7('0x17'),auth[_0x97c7('0x7')](),controller[_0x97c7('0x3b')]);router[_0x97c7('0x20')](_0x97c7('0x19'),auth[_0x97c7('0x7')](),controller[_0x97c7('0x3c')]);router[_0x97c7('0x20')](_0x97c7('0x1e'),auth[_0x97c7('0x7')](),controller[_0x97c7('0x3d')]);router['put'](_0x97c7('0xb'),auth[_0x97c7('0x7')](),controller['update']);router['delete'](_0x97c7('0xb'),auth[_0x97c7('0x7')](),controller[_0x97c7('0x3e')]);router['delete'](_0x97c7('0x3f'),auth[_0x97c7('0x7')](),controller[_0x97c7('0x40')]);router[_0x97c7('0x41')](_0x97c7('0xd'),auth['isAuthenticated'](),controller[_0x97c7('0x42')]);router[_0x97c7('0x41')](_0x97c7('0x1e'),auth[_0x97c7('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x84ff=['extname','/:id/offline','any','offline','addApplications','addAgents','put','update','delete','destroy','/:id/dispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getDispositions','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','format','%s-%s','originalname','/:id/logo','file','addLogo','root','now','single','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','offline-chat'];(function(_0x7972e5,_0x172ce7){var _0x217b50=function(_0x50b9a8){while(--_0x50b9a8){_0x7972e5['push'](_0x7972e5['shift']());}};_0x217b50(++_0x172ce7);}(_0x84ff,0xe5));var _0xf84f=function(_0x8ccbb,_0x5ec6e0){_0x8ccbb=_0x8ccbb-0x0;var _0x173713=_0x84ff[_0x8ccbb];return _0x173713;};'use strict';var multer=require(_0xf84f('0x0'));var util=require(_0xf84f('0x1'));var path=require('path');var timeout=require(_0xf84f('0x2'));var express=require(_0xf84f('0x3'));var router=express[_0xf84f('0x4')]();var fs_extra=require(_0xf84f('0x5'));var auth=require(_0xf84f('0x6'));var interaction=require(_0xf84f('0x7'));var config=require(_0xf84f('0x8'));var controller=require(_0xf84f('0x9'));router['get']('/',auth[_0xf84f('0xa')](),controller[_0xf84f('0xb')]);router[_0xf84f('0xc')](_0xf84f('0xd'),auth['isAuthenticated'](),controller[_0xf84f('0xe')]);router[_0xf84f('0xc')](_0xf84f('0xf'),auth[_0xf84f('0xa')](),controller[_0xf84f('0x10')]);router[_0xf84f('0xc')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf84f('0x11')]);router[_0xf84f('0xc')]('/:id/canned_answers',auth[_0xf84f('0xa')](),controller[_0xf84f('0x12')]);router[_0xf84f('0xc')]('/:id/logo',controller[_0xf84f('0x13')]);router[_0xf84f('0xc')](_0xf84f('0x14'),controller[_0xf84f('0x15')]);router[_0xf84f('0xc')]('/:id/customer_avatar',controller[_0xf84f('0x16')]);router['get'](_0xf84f('0x17'),controller[_0xf84f('0x18')]);router['get'](_0xf84f('0x19'),auth[_0xf84f('0xa')](),controller[_0xf84f('0x1a')]);router[_0xf84f('0xc')](_0xf84f('0x1b'),controller[_0xf84f('0x1c')]);router['get'](_0xf84f('0x1d'),auth[_0xf84f('0xa')](),controller[_0xf84f('0x1e')]);router[_0xf84f('0xc')](_0xf84f('0x1f'),auth[_0xf84f('0xa')](),controller[_0xf84f('0x20')]);router[_0xf84f('0xc')](_0xf84f('0x21'),controller['getFields']);router['get'](_0xf84f('0x22'),auth[_0xf84f('0xa')](),controller[_0xf84f('0x23')]);router[_0xf84f('0xc')](_0xf84f('0x24'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xf84f('0xa')](),controller['create']);router[_0xf84f('0x25')]('/:id/dispositions',auth[_0xf84f('0xa')](),controller[_0xf84f('0x26')]);router['post'](_0xf84f('0x27'),auth[_0xf84f('0xa')](),controller[_0xf84f('0x28')]);var upload=multer({'storage':multer[_0xf84f('0x29')]({'destination':function(_0x2dfc27,_0x3fb501,_0x26e0c6){_0x26e0c6(null,path[_0xf84f('0x2a')](config['root'],'server/files/images/logos/'));},'filename':function(_0x180c13,_0x1a1e93,_0x54032f){_0x54032f(null,util[_0xf84f('0x2b')](_0xf84f('0x2c'),Date['now'](),_0x1a1e93[_0xf84f('0x2d')]));}})});router[_0xf84f('0x25')](_0xf84f('0x2e'),upload['single'](_0xf84f('0x2f')),controller[_0xf84f('0x30')]);var upload=multer({'storage':multer[_0xf84f('0x29')]({'destination':function(_0x1bf900,_0x3e3604,_0x1dfb5e){_0x1dfb5e(null,path[_0xf84f('0x2a')](config[_0xf84f('0x31')],'server/files/images/avatars/'));},'filename':function(_0x1a82df,_0x4874d1,_0x2f0017){_0x2f0017(null,util[_0xf84f('0x2b')](_0xf84f('0x2c'),Date[_0xf84f('0x32')](),_0x4874d1[_0xf84f('0x2d')]));}})});router[_0xf84f('0x25')](_0xf84f('0x14'),upload[_0xf84f('0x33')](_0xf84f('0x2f')),controller[_0xf84f('0x34')]);var upload=multer({'storage':multer[_0xf84f('0x29')]({'destination':function(_0xd7ec7e,_0x3a0947,_0x41d97a){_0x41d97a(null,path['join'](config[_0xf84f('0x31')],_0xf84f('0x35')));},'filename':function(_0x23d43e,_0x52f07c,_0x1b17a7){_0x1b17a7(null,util['format']('%s-%s',Date[_0xf84f('0x32')](),_0x52f07c[_0xf84f('0x2d')]));}})});router[_0xf84f('0x25')](_0xf84f('0x36'),upload[_0xf84f('0x33')](_0xf84f('0x2f')),controller[_0xf84f('0x37')]);var upload=multer({'storage':multer[_0xf84f('0x29')]({'destination':function(_0x5762a2,_0x383a86,_0x1b7521){_0x1b7521(null,path[_0xf84f('0x2a')](config['root'],_0xf84f('0x35')));},'filename':function(_0x2283fe,_0x1a71ce,_0x864b8d){_0x864b8d(null,util[_0xf84f('0x2b')]('%s-%s',Date[_0xf84f('0x32')](),_0x1a71ce[_0xf84f('0x2d')]));}})});router[_0xf84f('0x25')](_0xf84f('0x17'),upload[_0xf84f('0x33')](_0xf84f('0x2f')),controller[_0xf84f('0x38')]);router['post'](_0xf84f('0x39'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xf84f('0x29')]({'destination':function(_0x1c6074,_0x16a6a5,_0x49a850){const _0x500ea7=path[_0xf84f('0x2a')](config[_0xf84f('0x31')],'server/files','attachments',_0xf84f('0x3a'));fs_extra['ensureDir'](_0x500ea7,function(){_0x49a850(null,_0x500ea7);});},'filename':function(_0x1dbd1f,_0x93b6e6,_0x5a8603){const _0x111c44=_0x93b6e6[_0xf84f('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x6aad43=path[_0xf84f('0x3b')](_0x111c44);const _0x4518fe=Date[_0xf84f('0x32')]()+'-'+_0x111c44['replace'](_0x6aad43,'')+_0x6aad43;_0x5a8603(null,_0x4518fe);}})});router['post'](_0xf84f('0x3c'),offlineUploadMulter[_0xf84f('0x3d')](),controller[_0xf84f('0x3e')]);router['post'](_0xf84f('0x19'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xf84f('0x25')]('/:id/applications',auth['isAuthenticated'](),controller[_0xf84f('0x3f')]);router[_0xf84f('0x25')]('/:id/proactive_actions',auth[_0xf84f('0xa')](),controller['addProactiveActions']);router['post'](_0xf84f('0x24'),auth[_0xf84f('0xa')](),controller[_0xf84f('0x40')]);router[_0xf84f('0x41')]('/:id',auth[_0xf84f('0xa')](),controller[_0xf84f('0x42')]);router[_0xf84f('0x43')](_0xf84f('0xf'),auth[_0xf84f('0xa')](),controller[_0xf84f('0x44')]);router['delete'](_0xf84f('0x45'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xf84f('0x27'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xf84f('0x43')]('/:id/users',auth['isAuthenticated'](),controller[_0xf84f('0x46')]);module[_0xf84f('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index bec9723..0cf5396 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 _0xa78d=['Router','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment'];(function(_0x5f46ac,_0x4aed0a){var _0xbe5805=function(_0x308582){while(--_0x308582){_0x5f46ac['push'](_0x5f46ac['shift']());}};_0xbe5805(++_0x4aed0a);}(_0xa78d,0x1ca));var _0xda78=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xa78d[_0x2aea9e];return _0x430b92;};var beaverLogger=require(_0xda78('0x0'));var express=require(_0xda78('0x1'));var auth=require(_0xda78('0x2'));var config=require(_0xda78('0x3'));var router=express[_0xda78('0x4')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x481043,_0x52b72e,_0x295ac4){var _0x45f794=_0x481043[_0xda78('0x5')][_0xda78('0x6')](_0xda78('0x7'));if(!_0x45f794){throw new Error(_0xda78('0x8'));}return beaverLogger[_0xda78('0x9')]({'uri':_0xda78('0xa'),'logger':_0x45f794,'enableCors':!isProduction})(_0x481043,_0x52b72e,_0x295ac4);}router[_0xda78('0xb')](auth[_0xda78('0xc')](),clientSideLogs);module[_0xda78('0xd')]=router; \ No newline at end of file +var _0x6c53=['use','isAuthenticated','express','../components/auth/service','Router','env','app','get','Client-Side\x20logger\x20not\x20found!','/client-logs'];(function(_0x443520,_0x2fe333){var _0x20afa5=function(_0x13cf74){while(--_0x13cf74){_0x443520['push'](_0x443520['shift']());}};_0x20afa5(++_0x2fe333);}(_0x6c53,0x11a));var _0x36c5=function(_0x5f1fe6,_0x206f88){_0x5f1fe6=_0x5f1fe6-0x0;var _0x2e6391=_0x6c53[_0x5f1fe6];return _0x2e6391;};var beaverLogger=require('beaver-logger/server');var express=require(_0x36c5('0x0'));var auth=require(_0x36c5('0x1'));var config=require('../config/environment');var router=express[_0x36c5('0x2')]();var isProduction=config[_0x36c5('0x3')]==='production'||![];function clientSideLogs(_0x4c9309,_0x18aaf5,_0x44a64a){var _0x3c29f4=_0x4c9309[_0x36c5('0x4')][_0x36c5('0x5')]('client-side-logger');if(!_0x3c29f4){throw new Error(_0x36c5('0x6'));}return beaverLogger['expressEndpoint']({'uri':_0x36c5('0x7'),'logger':_0x3c29f4,'enableCors':!isProduction})(_0x4c9309,_0x18aaf5,_0x44a64a);}router[_0x36c5('0x8')](auth[_0x36c5('0x9')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 320ae46..1bdc9fe 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 _0x88b0=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x4723d1,_0x515d2e){var _0x335b7f=function(_0x559134){while(--_0x559134){_0x4723d1['push'](_0x4723d1['shift']());}};_0x335b7f(++_0x515d2e);}(_0x88b0,0x1e0));var _0x088b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x88b0[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x088b('0x0'));module[_0x088b('0x1')]={'name':{'type':Sequelize[_0x088b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x088b('0x3')](_0x088b('0x4'),_0x088b('0x5'),_0x088b('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x088b('0x3')](_0x088b('0x7'),_0x088b('0x8'))},'data1':{'type':Sequelize[_0x088b('0x2')],'comment':_0x088b('0x9')},'data2':{'type':Sequelize[_0x088b('0x2')],'comment':_0x088b('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0x088b('0xb')},'data4':{'type':Sequelize[_0x088b('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x088b('0xc')],'comment':_0x088b('0xd')}}; \ No newline at end of file +var _0x204e=['MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','MicrosoftAzure','ENUM','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant'];(function(_0x2852ed,_0x3dfed2){var _0x24f215=function(_0x51e0c2){while(--_0x51e0c2){_0x2852ed['push'](_0x2852ed['shift']());}};_0x24f215(++_0x3dfed2);}(_0x204e,0x86));var _0xe204=function(_0x531e3c,_0x453a12){_0x531e3c=_0x531e3c-0x0;var _0x16d931=_0x204e[_0x531e3c];return _0x16d931;};'use strict';var Sequelize=require(_0xe204('0x0'));module[_0xe204('0x1')]={'name':{'type':Sequelize[_0xe204('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xe204('0x3'),'Google',_0xe204('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe204('0x5')]('Outlook365',_0xe204('0x6'))},'data1':{'type':Sequelize[_0xe204('0x2')],'comment':_0xe204('0x7')},'data2':{'type':Sequelize[_0xe204('0x2')],'comment':_0xe204('0x8')},'data3':{'type':Sequelize[_0xe204('0x2')],'comment':_0xe204('0x9')},'data4':{'type':Sequelize[_0xe204('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xe204('0xa')],'comment':_0xe204('0xb')},'data6':{'type':Sequelize[_0xe204('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xe204('0xa')],'comment':_0xe204('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 91e207c..764aa08 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 _0x3dda=['count','limit','set','Content-Range','update','destroy','then','sendStatus','error','stack','name','padEnd','slice','index','map','CloudProvider','fieldName','type','key','model','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','rawAttributes','keys','fields','include','find','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','params','oauth2MicrosoftAuthorize','findOne','oauth2MicrosoftCallback','get','state','parse','from','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','./cloudProvider.oauth','redis','defaults','socket.io-emitter','status','end','json','offset','undefined'];(function(_0x5351d4,_0x9fad72){var _0x158dd6=function(_0x21c0b4){while(--_0x21c0b4){_0x5351d4['push'](_0x5351d4['shift']());}};_0x158dd6(++_0x9fad72);}(_0x3dda,0x17a));var _0xa3dd=function(_0xfb073a,_0x248d58){_0xfb073a=_0xfb073a-0x0;var _0x4a0cd=_0x3dda[_0xfb073a];return _0x4a0cd;};'use strict';var _=require(_0xa3dd('0x0'));var Redis=require(_0xa3dd('0x1'));var qs=require(_0xa3dd('0x2'));var encryptor=require(_0xa3dd('0x3'));var config=require('../../config/environment');var logger=require(_0xa3dd('0x4'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0xa3dd('0x5'));config[_0xa3dd('0x6')]=_[_0xa3dd('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa3dd('0x8'))(new Redis(config[_0xa3dd('0x6')]));var redis=new Redis(config[_0xa3dd('0x6')]);function respondWithStatusCode(_0x37bbbe,_0x5c8361){_0x5c8361=_0x5c8361||0xcc;return function(_0x4b699c){if(_0x4b699c){return _0x37bbbe['sendStatus'](_0x5c8361);}return _0x37bbbe[_0xa3dd('0x9')](_0x5c8361)[_0xa3dd('0xa')]();};}function respondWithResult(_0x2070e2,_0x3d67e9){_0x3d67e9=_0x3d67e9||0xc8;return function(_0x5d639e){if(_0x5d639e){return _0x2070e2[_0xa3dd('0x9')](_0x3d67e9)[_0xa3dd('0xb')](_0x5d639e);}};}function respondWithFilteredResult(_0x35705a,_0x2ea143){return function(_0x209c89){if(_0x209c89){var _0x3cc43c=typeof _0x2ea143[_0xa3dd('0xc')]==='undefined'&&typeof _0x2ea143['limit']===_0xa3dd('0xd');var _0x14279d=_0x209c89[_0xa3dd('0xe')];var _0xc3df35=_0x3cc43c?0x0:_0x2ea143[_0xa3dd('0xc')];var _0x451e43=_0x3cc43c?_0x209c89['count']:_0x2ea143[_0xa3dd('0xc')]+_0x2ea143[_0xa3dd('0xf')];var _0x29b6ce;if(_0x451e43>=_0x14279d){_0x451e43=_0x14279d;_0x29b6ce=0xc8;}else{_0x29b6ce=0xce;}_0x35705a['status'](_0x29b6ce);return _0x35705a[_0xa3dd('0x10')](_0xa3dd('0x11'),_0xc3df35+'-'+_0x451e43+'/'+_0x14279d)[_0xa3dd('0xb')](_0x209c89);}return null;};}function saveUpdates(_0x3c4d9f){return function(_0x23ee1f){if(_0x23ee1f){return _0x23ee1f[_0xa3dd('0x12')](_0x3c4d9f)['then'](function(_0x18f7e0){return _0x18f7e0;});}return null;};}function removeEntity(_0x945e79){return function(_0x3a5b8a){if(_0x3a5b8a){return _0x3a5b8a[_0xa3dd('0x13')]()[_0xa3dd('0x14')](function(){_0x945e79[_0xa3dd('0x9')](0xcc)[_0xa3dd('0xa')]();});}};}function handleEntityNotFound(_0x4afb7f){return function(_0xcf56e4){if(!_0xcf56e4){_0x4afb7f[_0xa3dd('0x15')](0x194);}return _0xcf56e4;};}function handleError(_0x243037,_0x2b19a5){_0x2b19a5=_0x2b19a5||0x1f4;return function(_0x552f1b){logger[_0xa3dd('0x16')](_0x552f1b[_0xa3dd('0x17')]);if(_0x552f1b[_0xa3dd('0x18')]){delete _0x552f1b[_0xa3dd('0x18')];}_0x243037[_0xa3dd('0x9')](_0x2b19a5)['send'](_0x552f1b);};}function maskClientSecret(_0x6040bd){return _[_0xa3dd('0x19')](_0x6040bd[_0xa3dd('0x1a')](0x0,0x3),0x14,'*');}exports[_0xa3dd('0x1b')]=function(_0x37eb39,_0x2119fb){var _0x19de62={},_0x14ef41={},_0x47fb61={'count':0x0,'rows':[]};var _0x411f90=_[_0xa3dd('0x1c')](db[_0xa3dd('0x1d')]['rawAttributes'],function(_0x20ee1f){return{'name':_0x20ee1f[_0xa3dd('0x1e')],'type':_0x20ee1f[_0xa3dd('0x1f')][_0xa3dd('0x20')]};});_0x14ef41[_0xa3dd('0x21')]=_[_0xa3dd('0x1c')](_0x411f90,_0xa3dd('0x18'));_0x14ef41[_0xa3dd('0x22')]=_['keys'](_0x37eb39[_0xa3dd('0x22')]);_0x14ef41[_0xa3dd('0x23')]=_['intersection'](_0x14ef41[_0xa3dd('0x21')],_0x14ef41[_0xa3dd('0x22')]);_0x19de62[_0xa3dd('0x24')]=_[_0xa3dd('0x25')](_0x14ef41[_0xa3dd('0x21')],qs['fields'](_0x37eb39['query']['fields']));_0x19de62[_0xa3dd('0x24')]=_0x19de62[_0xa3dd('0x24')]['length']?_0x19de62[_0xa3dd('0x24')]:_0x14ef41[_0xa3dd('0x21')];if(!_0x37eb39[_0xa3dd('0x22')][_0xa3dd('0x26')](_0xa3dd('0x27'))){_0x19de62[_0xa3dd('0xf')]=qs[_0xa3dd('0xf')](_0x37eb39[_0xa3dd('0x22')][_0xa3dd('0xf')]);_0x19de62[_0xa3dd('0xc')]=qs[_0xa3dd('0xc')](_0x37eb39[_0xa3dd('0x22')][_0xa3dd('0xc')]);}_0x19de62[_0xa3dd('0x28')]=qs[_0xa3dd('0x29')](_0x37eb39['query']['sort']);_0x19de62[_0xa3dd('0x2a')]=qs[_0xa3dd('0x23')](_[_0xa3dd('0x2b')](_0x37eb39[_0xa3dd('0x22')],_0x14ef41['filters']),_0x411f90);if(_0x37eb39[_0xa3dd('0x22')][_0xa3dd('0x2c')]){_0x19de62['where']=_[_0xa3dd('0x2d')](_0x19de62[_0xa3dd('0x2a')],{'$or':_['map'](_0x411f90,function(_0x3a8521){if(_0x3a8521['type']!==_0xa3dd('0x2e')){var _0x4c1e8c={};_0x4c1e8c[_0x3a8521[_0xa3dd('0x18')]]={'$like':'%'+_0x37eb39[_0xa3dd('0x22')][_0xa3dd('0x2c')]+'%'};return _0x4c1e8c;}})});}_0x19de62=_[_0xa3dd('0x2d')]({},_0x19de62,_0x37eb39[_0xa3dd('0x2f')]);var _0x454ce8={'where':_0x19de62['where']};return db['CloudProvider']['count'](_0x454ce8)[_0xa3dd('0x14')](function(_0x8dd7d0){_0x47fb61[_0xa3dd('0xe')]=_0x8dd7d0;if(_0x37eb39[_0xa3dd('0x22')][_0xa3dd('0x30')]){_0x19de62['include']=[{'all':!![]}];}return db['CloudProvider'][_0xa3dd('0x31')](_0x19de62);})[_0xa3dd('0x14')](function(_0x48b6b4){_0x47fb61['rows']=_[_0xa3dd('0x1c')](_0x48b6b4,function(_0xda0977){if(_0xda0977[_0xa3dd('0x32')]===_0xa3dd('0x33')){var _0x31cb65=encryptor[_0xa3dd('0x34')](_0xda0977['data3']);_0xda0977[_0xa3dd('0x35')]=maskClientSecret(_0x31cb65);}return _0xda0977;});return _0x47fb61;})[_0xa3dd('0x14')](respondWithFilteredResult(_0x2119fb,_0x19de62))[_0xa3dd('0x36')](handleError(_0x2119fb,null));};exports[_0xa3dd('0x37')]=function(_0x240465,_0x5614e0){var _0x1b464b={'raw':!![],'where':{'id':_0x240465['params']['id']}},_0x1c2f4e={};_0x1c2f4e[_0xa3dd('0x21')]=_['keys'](db[_0xa3dd('0x1d')][_0xa3dd('0x38')]);_0x1c2f4e[_0xa3dd('0x22')]=_[_0xa3dd('0x39')](_0x240465[_0xa3dd('0x22')]);_0x1c2f4e[_0xa3dd('0x23')]=_[_0xa3dd('0x25')](_0x1c2f4e[_0xa3dd('0x21')],_0x1c2f4e[_0xa3dd('0x22')]);_0x1b464b[_0xa3dd('0x24')]=_[_0xa3dd('0x25')](_0x1c2f4e[_0xa3dd('0x21')],qs['fields'](_0x240465[_0xa3dd('0x22')][_0xa3dd('0x3a')]));_0x1b464b[_0xa3dd('0x24')]=_0x1b464b[_0xa3dd('0x24')]['length']?_0x1b464b[_0xa3dd('0x24')]:_0x1c2f4e[_0xa3dd('0x21')];if(_0x240465[_0xa3dd('0x22')][_0xa3dd('0x30')]){_0x1b464b[_0xa3dd('0x3b')]=[{'all':!![]}];}_0x1b464b=_[_0xa3dd('0x2d')]({},_0x1b464b,_0x240465[_0xa3dd('0x2f')]);return db['CloudProvider'][_0xa3dd('0x3c')](_0x1b464b)[_0xa3dd('0x14')](handleEntityNotFound(_0x5614e0,null))[_0xa3dd('0x14')](function(_0x210f75){if(_0x210f75[_0xa3dd('0x32')]==='MicrosoftAzure'){var _0x9b0ee0=encryptor['decryptString'](_0x210f75['data3']);_0x210f75['data3']=maskClientSecret(_0x9b0ee0);}return _0x210f75;})[_0xa3dd('0x14')](respondWithResult(_0x5614e0,null))[_0xa3dd('0x36')](handleError(_0x5614e0,null));};exports['create']=function(_0xf968aa,_0x123e82){if(!_0xf968aa[_0xa3dd('0x3d')][_0xa3dd('0x18')])throw new Error(_0xa3dd('0x3e'));if(!_0xf968aa['body'][_0xa3dd('0x32')])throw new Error(_0xa3dd('0x3f'));var _0x2cd603=db[_0xa3dd('0x1d')][_0xa3dd('0x38')][_0xa3dd('0x32')][_0xa3dd('0x40')];if(!_0x2cd603[_0xa3dd('0x41')](_0xf968aa[_0xa3dd('0x3d')][_0xa3dd('0x32')]))throw new Error(_0xa3dd('0x42')+_0x2cd603[_0xa3dd('0x43')](',\x20'));if(_0xf968aa[_0xa3dd('0x3d')]['service']===_0xa3dd('0x33')&&_0xf968aa[_0xa3dd('0x3d')][_0xa3dd('0x35')]){_0xf968aa[_0xa3dd('0x3d')][_0xa3dd('0x35')]=encryptor[_0xa3dd('0x44')](_0xf968aa['body'][_0xa3dd('0x35')]);}return db[_0xa3dd('0x1d')][_0xa3dd('0x45')](_0xf968aa['body'],{})['then'](respondWithResult(_0x123e82,0xc9))[_0xa3dd('0x36')](handleError(_0x123e82,null));};exports[_0xa3dd('0x12')]=function(_0x74f826,_0x244beb){if(_0x74f826[_0xa3dd('0x3d')]['id']){delete _0x74f826[_0xa3dd('0x3d')]['id'];}return db[_0xa3dd('0x1d')][_0xa3dd('0x3c')]({'where':{'id':_0x74f826[_0xa3dd('0x46')]['id']}})[_0xa3dd('0x14')](handleEntityNotFound(_0x244beb,null))[_0xa3dd('0x14')](function(_0x4c50eb){if(_0x4c50eb[_0xa3dd('0x32')]===_0xa3dd('0x33')&&_0x74f826[_0xa3dd('0x3d')][_0xa3dd('0x35')]){_0x74f826[_0xa3dd('0x3d')][_0xa3dd('0x35')]=encryptor[_0xa3dd('0x44')](_0x74f826['body'][_0xa3dd('0x35')]);}return _0x4c50eb;})['then'](saveUpdates(_0x74f826[_0xa3dd('0x3d')],null))[_0xa3dd('0x14')](respondWithResult(_0x244beb,null))[_0xa3dd('0x36')](handleError(_0x244beb,null));};exports[_0xa3dd('0x13')]=function(_0x309fda,_0x3f7285){return db[_0xa3dd('0x1d')][_0xa3dd('0x3c')]({'where':{'id':_0x309fda['params']['id']}})[_0xa3dd('0x14')](handleEntityNotFound(_0x3f7285,null))[_0xa3dd('0x14')](removeEntity(_0x3f7285,null))['catch'](handleError(_0x3f7285,null));};exports[_0xa3dd('0x47')]=function(_0x31f029,_0x3c6ffb){return db[_0xa3dd('0x1d')][_0xa3dd('0x48')]({'where':{'id':_0x31f029['params']['id']},'raw':!![]})[_0xa3dd('0x14')](function(_0x510598){if(!_0x510598)return _0x3c6ffb[_0xa3dd('0x15')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x510598,_0x31f029['user']['id'])};})[_0xa3dd('0x14')](respondWithResult(_0x3c6ffb,null))[_0xa3dd('0x36')](handleError(_0x3c6ffb,null));};exports[_0xa3dd('0x49')]=function(_0x13f1b0,_0x5e303a){var _0x16a445=_0x13f1b0[_0xa3dd('0x3d')];var _0x3d54f0;var _0x1c8a1c;if(_0x16a445['error'])throw _0x16a445;redis[_0xa3dd('0x4a')](_0x16a445[_0xa3dd('0x4b')])[_0xa3dd('0x14')](function(_0x4beff3){if(!_0x4beff3)throw new Error('Invalid\x20state\x20parameter');_0x3d54f0=JSON[_0xa3dd('0x4c')](_0x4beff3);var _0x1c7bf4=Buffer[_0xa3dd('0x4d')](_0x16a445['state'],'base64')[_0xa3dd('0x4e')](_0xa3dd('0x4f'));_0x1c8a1c=JSON['parse'](_0x1c7bf4);if(!oauth[_0xa3dd('0x50')](_0x16a445[_0xa3dd('0x51')],_0x3d54f0[_0xa3dd('0x52')]))throw new Error(_0xa3dd('0x53'));redis[_0xa3dd('0x54')](_0x16a445[_0xa3dd('0x4b')]);return oauth[_0xa3dd('0x55')](_0x16a445['code'],_0x3d54f0);})['then'](function(_0x271398){_0x3d54f0[_0xa3dd('0x56')]=_0x271398[_0xa3dd('0x57')];_0x3d54f0['data6']=_0x271398[_0xa3dd('0x58')];return db[_0xa3dd('0x1d')][_0xa3dd('0x12')]({'data5':_0x3d54f0[_0xa3dd('0x56')],'data6':_0x3d54f0[_0xa3dd('0x59')]},{'where':{'id':_0x3d54f0['id']}});})[_0xa3dd('0x14')](function(){oauth[_0xa3dd('0x5a')](_0x3d54f0);socket[_0xa3dd('0x5b')](_0xa3dd('0x5c'),{'id':_0x1c8a1c['id']});return;})['then'](respondWithStatusCode(_0x5e303a,null))['catch'](function(_0x1cb1a3){if(_0x1c8a1c){socket[_0xa3dd('0x5b')](_0xa3dd('0x5d'),{'id':_0x1c8a1c['id']});}if(!_0x3d54f0){logger[_0xa3dd('0x16')](_0xa3dd('0x5e'),_0x1cb1a3);return _0x5e303a[_0xa3dd('0x9')](0x1f4)[_0xa3dd('0x5f')](_0x1cb1a3['message']);}logger[_0xa3dd('0x16')](_0xa3dd('0x60'),_0x3d54f0['id'],JSON[_0xa3dd('0x61')](_0x1cb1a3));});}; \ No newline at end of file +var _0xb9ec=['params','options','find','catch','create','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','parse','from','state','ascii','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../config/environment','api','./cloudProvider.oauth','defaults','localhost','redis','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','error','name','send','padEnd','slice','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','CloudProvider','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','show'];(function(_0x23247e,_0x18ab73){var _0xa76fa7=function(_0x2e7b6f){while(--_0x2e7b6f){_0x23247e['push'](_0x23247e['shift']());}};_0xa76fa7(++_0x18ab73);}(_0xb9ec,0xd3));var _0xcb9e=function(_0x47a885,_0x388d27){_0x47a885=_0x47a885-0x0;var _0x216738=_0xb9ec[_0x47a885];return _0x216738;};'use strict';var _=require(_0xcb9e('0x0'));var Redis=require('ioredis');var qs=require(_0xcb9e('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0xcb9e('0x2'));var logger=require('../../config/logger')(_0xcb9e('0x3'));var db=require('../../mysqldb')['db'];var oauth=require(_0xcb9e('0x4'));config['redis']=_[_0xcb9e('0x5')](config['redis'],{'host':_0xcb9e('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0xcb9e('0x7')]);function respondWithStatusCode(_0x281f40,_0x2923c9){_0x2923c9=_0x2923c9||0xcc;return function(_0x12c83b){if(_0x12c83b){return _0x281f40[_0xcb9e('0x8')](_0x2923c9);}return _0x281f40[_0xcb9e('0x9')](_0x2923c9)[_0xcb9e('0xa')]();};}function respondWithResult(_0x4e4170,_0x294131){_0x294131=_0x294131||0xc8;return function(_0xb990e3){if(_0xb990e3){return _0x4e4170[_0xcb9e('0x9')](_0x294131)[_0xcb9e('0xb')](_0xb990e3);}};}function respondWithFilteredResult(_0x3d1394,_0x23c068){return function(_0x55fe26){if(_0x55fe26){var _0x23d63f=typeof _0x23c068['offset']===_0xcb9e('0xc')&&typeof _0x23c068[_0xcb9e('0xd')]===_0xcb9e('0xc');var _0x5bec42=_0x55fe26[_0xcb9e('0xe')];var _0x27992a=_0x23d63f?0x0:_0x23c068['offset'];var _0xea5af3=_0x23d63f?_0x55fe26[_0xcb9e('0xe')]:_0x23c068[_0xcb9e('0xf')]+_0x23c068['limit'];var _0xadd1ff;if(_0xea5af3>=_0x5bec42){_0xea5af3=_0x5bec42;_0xadd1ff=0xc8;}else{_0xadd1ff=0xce;}_0x3d1394['status'](_0xadd1ff);return _0x3d1394[_0xcb9e('0x10')](_0xcb9e('0x11'),_0x27992a+'-'+_0xea5af3+'/'+_0x5bec42)['json'](_0x55fe26);}return null;};}function saveUpdates(_0x4d14bd){return function(_0x50aefd){if(_0x50aefd){return _0x50aefd[_0xcb9e('0x12')](_0x4d14bd)[_0xcb9e('0x13')](function(_0x40b913){return _0x40b913;});}return null;};}function removeEntity(_0x324956){return function(_0x2a8840){if(_0x2a8840){return _0x2a8840['destroy']()['then'](function(){_0x324956[_0xcb9e('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e5d25){return function(_0x4c0460){if(!_0x4c0460){_0x5e5d25[_0xcb9e('0x8')](0x194);}return _0x4c0460;};}function handleError(_0x337326,_0x17ef4c){_0x17ef4c=_0x17ef4c||0x1f4;return function(_0x574c40){logger[_0xcb9e('0x14')](_0x574c40['stack']);if(_0x574c40[_0xcb9e('0x15')]){delete _0x574c40['name'];}_0x337326[_0xcb9e('0x9')](_0x17ef4c)[_0xcb9e('0x16')](_0x574c40);};}function maskClientSecret(_0x3a74ce){return _[_0xcb9e('0x17')](_0x3a74ce[_0xcb9e('0x18')](0x0,0x3),0x14,'*');}exports[_0xcb9e('0x19')]=function(_0x4ec344,_0x4e5a48){var _0x424e61={},_0x54ecc7={},_0x4d2792={'count':0x0,'rows':[]};var _0x62eb6d=_[_0xcb9e('0x1a')](db['CloudProvider'][_0xcb9e('0x1b')],function(_0x303a61){return{'name':_0x303a61['fieldName'],'type':_0x303a61[_0xcb9e('0x1c')][_0xcb9e('0x1d')]};});_0x54ecc7[_0xcb9e('0x1e')]=_[_0xcb9e('0x1a')](_0x62eb6d,_0xcb9e('0x15'));_0x54ecc7[_0xcb9e('0x1f')]=_[_0xcb9e('0x20')](_0x4ec344['query']);_0x54ecc7[_0xcb9e('0x21')]=_[_0xcb9e('0x22')](_0x54ecc7['model'],_0x54ecc7[_0xcb9e('0x1f')]);_0x424e61['attributes']=_[_0xcb9e('0x22')](_0x54ecc7[_0xcb9e('0x1e')],qs[_0xcb9e('0x23')](_0x4ec344[_0xcb9e('0x1f')][_0xcb9e('0x23')]));_0x424e61['attributes']=_0x424e61[_0xcb9e('0x24')][_0xcb9e('0x25')]?_0x424e61['attributes']:_0x54ecc7['model'];if(!_0x4ec344[_0xcb9e('0x1f')]['hasOwnProperty'](_0xcb9e('0x26'))){_0x424e61[_0xcb9e('0xd')]=qs[_0xcb9e('0xd')](_0x4ec344[_0xcb9e('0x1f')][_0xcb9e('0xd')]);_0x424e61[_0xcb9e('0xf')]=qs[_0xcb9e('0xf')](_0x4ec344[_0xcb9e('0x1f')][_0xcb9e('0xf')]);}_0x424e61[_0xcb9e('0x27')]=qs['sort'](_0x4ec344[_0xcb9e('0x1f')][_0xcb9e('0x28')]);_0x424e61[_0xcb9e('0x29')]=qs['filters'](_[_0xcb9e('0x2a')](_0x4ec344[_0xcb9e('0x1f')],_0x54ecc7[_0xcb9e('0x21')]),_0x62eb6d);if(_0x4ec344[_0xcb9e('0x1f')]['filter']){_0x424e61['where']=_['merge'](_0x424e61[_0xcb9e('0x29')],{'$or':_[_0xcb9e('0x1a')](_0x62eb6d,function(_0x1de905){if(_0x1de905[_0xcb9e('0x1c')]!==_0xcb9e('0x2b')){var _0x572104={};_0x572104[_0x1de905[_0xcb9e('0x15')]]={'$like':'%'+_0x4ec344[_0xcb9e('0x1f')][_0xcb9e('0x2c')]+'%'};return _0x572104;}})});}_0x424e61=_[_0xcb9e('0x2d')]({},_0x424e61,_0x4ec344['options']);var _0x4614c3={'where':_0x424e61[_0xcb9e('0x29')]};return db[_0xcb9e('0x2e')]['count'](_0x4614c3)[_0xcb9e('0x13')](function(_0x40bf24){_0x4d2792[_0xcb9e('0xe')]=_0x40bf24;if(_0x4ec344[_0xcb9e('0x1f')][_0xcb9e('0x2f')]){_0x424e61[_0xcb9e('0x30')]=[{'all':!![]}];}return db[_0xcb9e('0x2e')][_0xcb9e('0x31')](_0x424e61);})['then'](function(_0x5e068f){_0x4d2792[_0xcb9e('0x32')]=_['map'](_0x5e068f,function(_0x424672){if(_0x424672[_0xcb9e('0x33')]===_0xcb9e('0x34')){var _0x445b40=encryptor[_0xcb9e('0x35')](_0x424672[_0xcb9e('0x36')]);_0x424672['data3']=maskClientSecret(_0x445b40);}return _0x424672;});return _0x4d2792;})['then'](respondWithFilteredResult(_0x4e5a48,_0x424e61))['catch'](handleError(_0x4e5a48,null));};exports[_0xcb9e('0x37')]=function(_0xdde0f4,_0x34cd1e){var _0x24058b={'raw':!![],'where':{'id':_0xdde0f4[_0xcb9e('0x38')]['id']}},_0x34e5ca={};_0x34e5ca[_0xcb9e('0x1e')]=_[_0xcb9e('0x20')](db[_0xcb9e('0x2e')][_0xcb9e('0x1b')]);_0x34e5ca[_0xcb9e('0x1f')]=_[_0xcb9e('0x20')](_0xdde0f4['query']);_0x34e5ca[_0xcb9e('0x21')]=_['intersection'](_0x34e5ca[_0xcb9e('0x1e')],_0x34e5ca[_0xcb9e('0x1f')]);_0x24058b[_0xcb9e('0x24')]=_[_0xcb9e('0x22')](_0x34e5ca[_0xcb9e('0x1e')],qs[_0xcb9e('0x23')](_0xdde0f4[_0xcb9e('0x1f')][_0xcb9e('0x23')]));_0x24058b[_0xcb9e('0x24')]=_0x24058b[_0xcb9e('0x24')][_0xcb9e('0x25')]?_0x24058b['attributes']:_0x34e5ca[_0xcb9e('0x1e')];if(_0xdde0f4['query']['includeAll']){_0x24058b[_0xcb9e('0x30')]=[{'all':!![]}];}_0x24058b=_[_0xcb9e('0x2d')]({},_0x24058b,_0xdde0f4[_0xcb9e('0x39')]);return db[_0xcb9e('0x2e')][_0xcb9e('0x3a')](_0x24058b)[_0xcb9e('0x13')](handleEntityNotFound(_0x34cd1e,null))['then'](function(_0x5ca013){if(_0x5ca013[_0xcb9e('0x33')]===_0xcb9e('0x34')){var _0x3da984=encryptor['decryptString'](_0x5ca013[_0xcb9e('0x36')]);_0x5ca013['data3']=maskClientSecret(_0x3da984);}return _0x5ca013;})[_0xcb9e('0x13')](respondWithResult(_0x34cd1e,null))[_0xcb9e('0x3b')](handleError(_0x34cd1e,null));};exports[_0xcb9e('0x3c')]=function(_0x151bc4,_0x1569e0){if(!_0x151bc4[_0xcb9e('0x3d')][_0xcb9e('0x15')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x151bc4['body'][_0xcb9e('0x33')])throw new Error(_0xcb9e('0x3e'));var _0x3206fc=db[_0xcb9e('0x2e')][_0xcb9e('0x1b')][_0xcb9e('0x33')][_0xcb9e('0x3f')];if(!_0x3206fc['includes'](_0x151bc4[_0xcb9e('0x3d')][_0xcb9e('0x33')]))throw new Error(_0xcb9e('0x40')+_0x3206fc[_0xcb9e('0x41')](',\x20'));if(_0x151bc4[_0xcb9e('0x3d')][_0xcb9e('0x33')]===_0xcb9e('0x34')&&_0x151bc4[_0xcb9e('0x3d')][_0xcb9e('0x36')]){_0x151bc4['body'][_0xcb9e('0x36')]=encryptor[_0xcb9e('0x42')](_0x151bc4[_0xcb9e('0x3d')][_0xcb9e('0x36')]);}return db['CloudProvider'][_0xcb9e('0x3c')](_0x151bc4[_0xcb9e('0x3d')],{})[_0xcb9e('0x13')](respondWithResult(_0x1569e0,0xc9))[_0xcb9e('0x3b')](handleError(_0x1569e0,null));};exports[_0xcb9e('0x12')]=function(_0x466766,_0x5ea718){if(_0x466766[_0xcb9e('0x3d')]['id']){delete _0x466766[_0xcb9e('0x3d')]['id'];}return db[_0xcb9e('0x2e')]['find']({'where':{'id':_0x466766[_0xcb9e('0x38')]['id']}})['then'](handleEntityNotFound(_0x5ea718,null))[_0xcb9e('0x13')](function(_0x39e377){if(_0x39e377[_0xcb9e('0x33')]==='MicrosoftAzure'&&_0x466766[_0xcb9e('0x3d')][_0xcb9e('0x36')]){_0x466766['body'][_0xcb9e('0x36')]=encryptor[_0xcb9e('0x42')](_0x466766[_0xcb9e('0x3d')][_0xcb9e('0x36')]);}return _0x39e377;})[_0xcb9e('0x13')](saveUpdates(_0x466766[_0xcb9e('0x3d')],null))[_0xcb9e('0x13')](respondWithResult(_0x5ea718,null))[_0xcb9e('0x3b')](handleError(_0x5ea718,null));};exports[_0xcb9e('0x43')]=function(_0x551335,_0x211550){return db['CloudProvider'][_0xcb9e('0x3a')]({'where':{'id':_0x551335[_0xcb9e('0x38')]['id']}})[_0xcb9e('0x13')](handleEntityNotFound(_0x211550,null))[_0xcb9e('0x13')](removeEntity(_0x211550,null))[_0xcb9e('0x3b')](handleError(_0x211550,null));};exports[_0xcb9e('0x44')]=function(_0x151717,_0x295bcc){return db[_0xcb9e('0x2e')][_0xcb9e('0x45')]({'where':{'id':_0x151717['params']['id']},'raw':!![]})[_0xcb9e('0x13')](function(_0x4ce9b2){if(!_0x4ce9b2)return _0x295bcc[_0xcb9e('0x8')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x4ce9b2,_0x151717[_0xcb9e('0x46')]['id'])};})[_0xcb9e('0x13')](respondWithResult(_0x295bcc,null))['catch'](handleError(_0x295bcc,null));};exports[_0xcb9e('0x47')]=function(_0x17c0f0,_0x599699){var _0x4228a9=_0x17c0f0[_0xcb9e('0x3d')];var _0x229099;var _0x33d30e;if(_0x4228a9['error'])throw _0x4228a9;redis['get'](_0x4228a9['state'])[_0xcb9e('0x13')](function(_0x4fc526){if(!_0x4fc526)throw new Error('Invalid\x20state\x20parameter');_0x229099=JSON[_0xcb9e('0x48')](_0x4fc526);var _0x94e1fc=Buffer[_0xcb9e('0x49')](_0x4228a9[_0xcb9e('0x4a')],'base64')['toString'](_0xcb9e('0x4b'));_0x33d30e=JSON[_0xcb9e('0x48')](_0x94e1fc);if(!oauth['isValidIdToken'](_0x4228a9['id_token'],_0x229099[_0xcb9e('0x4c')]))throw new Error(_0xcb9e('0x4d'));redis[_0xcb9e('0x4e')](_0x4228a9[_0xcb9e('0x4a')]);return oauth['getOauth2MicrosoftAccessToken'](_0x4228a9[_0xcb9e('0x4f')],_0x229099);})[_0xcb9e('0x13')](function(_0x209c55){_0x229099['data5']=_0x209c55[_0xcb9e('0x50')];_0x229099[_0xcb9e('0x51')]=_0x209c55['refresh_token'];return db[_0xcb9e('0x2e')][_0xcb9e('0x12')]({'data5':_0x229099['data5'],'data6':_0x229099[_0xcb9e('0x51')]},{'where':{'id':_0x229099['id']}});})[_0xcb9e('0x13')](function(){oauth[_0xcb9e('0x52')](_0x229099);socket[_0xcb9e('0x53')]('microsoftAuthorization:success',{'id':_0x33d30e['id']});return;})[_0xcb9e('0x13')](respondWithStatusCode(_0x599699,null))[_0xcb9e('0x3b')](function(_0x2c7329){if(_0x33d30e){socket[_0xcb9e('0x53')](_0xcb9e('0x54'),{'id':_0x33d30e['id']});}if(!_0x229099){logger[_0xcb9e('0x14')](_0xcb9e('0x55'),_0x2c7329);return _0x599699[_0xcb9e('0x9')](0x1f4)[_0xcb9e('0x16')](_0x2c7329[_0xcb9e('0x56')]);}logger[_0xcb9e('0x14')](_0xcb9e('0x57'),_0x229099['id'],JSON[_0xcb9e('0x58')](_0x2c7329));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2f05ecc..3e17d5e 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 _0xa9b8=['exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x523b92,_0x25d6b8){var _0x1a5e3b=function(_0x4e594e){while(--_0x4e594e){_0x523b92['push'](_0x523b92['shift']());}};_0x1a5e3b(++_0x25d6b8);}(_0xa9b8,0x12e));var _0x8a9b=function(_0x36af9a,_0x17b203){_0x36af9a=_0x36af9a-0x0;var _0x40abc9=_0xa9b8[_0x36af9a];return _0x40abc9;};'use strict';var _=require(_0x8a9b('0x0'));var util=require(_0x8a9b('0x1'));var logger=require(_0x8a9b('0x2'))(_0x8a9b('0x3'));var moment=require(_0x8a9b('0x4'));var BPromise=require(_0x8a9b('0x5'));var rp=require(_0x8a9b('0x6'));var fs=require('fs');var path=require(_0x8a9b('0x7'));var rimraf=require(_0x8a9b('0x8'));var config=require(_0x8a9b('0x9'));var attributes=require('./cloudProvider.attributes');module[_0x8a9b('0xa')]=function(_0x5b9a79,_0x517925){return _0x5b9a79['define'](_0x8a9b('0xb'),attributes,{'tableName':_0x8a9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec80=['cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xec80,0xeb));var _0x0ec8=function(_0x1e0203,_0x568b28){_0x1e0203=_0x1e0203-0x0;var _0x25ff8c=_0xec80[_0x1e0203];return _0x25ff8c;};'use strict';var _=require(_0x0ec8('0x0'));var util=require(_0x0ec8('0x1'));var logger=require(_0x0ec8('0x2'))(_0x0ec8('0x3'));var moment=require(_0x0ec8('0x4'));var BPromise=require(_0x0ec8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ec8('0x6'));var config=require(_0x0ec8('0x7'));var attributes=require(_0x0ec8('0x8'));module[_0x0ec8('0x9')]=function(_0x11cfa7,_0x187c3c){return _0x11cfa7[_0x0ec8('0xa')](_0x0ec8('0xb'),attributes,{'tableName':_0x0ec8('0xc'),'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 14038dd..8d2dec6 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 _0xbad1=['POST','{TENANT_ID}','data2','data5','access_token','update','catch','error','authorization_code','intervals','bind','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','openid','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','data7','/.default','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','code','id_token','from','stringify','toString','randomBytes','hex','client_id','response_type','join','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','oauth2Claims','data1','decode','payload','iss','issuer','aud','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString'];(function(_0x3ba57e,_0x2e6810){var _0x5d95cf=function(_0x8017a0){while(--_0x8017a0){_0x3ba57e['push'](_0x3ba57e['shift']());}};_0x5d95cf(++_0x2e6810);}(_0xbad1,0x1e3));var _0x1bad=function(_0x2049d1,_0x32a702){_0x2049d1=_0x2049d1-0x0;var _0x2f4f35=_0xbad1[_0x2049d1];return _0x2f4f35;};'use strict';var _=require(_0x1bad('0x0'));var crypto=require(_0x1bad('0x1'));var jwt=require(_0x1bad('0x2'));var moment=require('moment');var Redis=require(_0x1bad('0x3'));var rp=require('request-promise');var util=require(_0x1bad('0x4'));var encryptor=require(_0x1bad('0x5'));var config=require('../../config/environment');var logger=require(_0x1bad('0x6'))(_0x1bad('0x7'));var schedule=require(_0x1bad('0x8'));var db=require(_0x1bad('0x9'))['db'];config['redis']=_[_0x1bad('0xa')](config[_0x1bad('0xb')],{'host':_0x1bad('0xc'),'port':0x18eb});var redis=new Redis(config[_0x1bad('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x1bad('0xd'),_0x1bad('0xe'),'email',_0x1bad('0xf'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x1bad('0x10'),_0x1bad('0x11')],'Dynamics365':['openid',_0x1bad('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x1bad('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x1bad('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1a78af){var _0x4193fc=_[_0x1bad('0x14')](AZURE_AUTH_SCOPES[_0x1a78af['type']]);if(_0x1a78af[_0x1bad('0x15')]===_0x1bad('0x16'))_0x4193fc['push'](_0x1a78af[_0x1bad('0x17')]+_0x1bad('0x18'));return _0x4193fc['join']('\x20');}function getAccessTokenScope(_0x2a67ec){if(_0x2a67ec[_0x1bad('0x15')]===_0x1bad('0x19'))return _0x1bad('0x1a');if(_0x2a67ec['type']===_0x1bad('0x16'))return _0x2a67ec['data7']+_0x1bad('0x18');}function generateMicrosoftAuthorizationUrl(_0x4013d7,_0x2180e7){var _0x3be3f7=MICROSOFT_AUTH_URL[_0x1bad('0x1b')]('{TENANT_ID}',_0x4013d7['data2']);var _0x4b0cec=[_0x1bad('0x1c'),_0x1bad('0x1d')];var _0x34bfa9=Buffer[_0x1bad('0x1e')](JSON[_0x1bad('0x1f')]({'id':_0x2180e7}))[_0x1bad('0x20')]('base64');var _0x124fb1=crypto[_0x1bad('0x21')](0x10)['toString'](_0x1bad('0x22'));var _0x41f0ad=getAuthorizationScopes(_0x4013d7);var _0x1f0ec8=[{'key':_0x1bad('0x23'),'value':_0x4013d7['data1']},{'key':_0x1bad('0x24'),'value':encodeURIComponent(_0x4b0cec[_0x1bad('0x25')]('\x20'))},{'key':_0x1bad('0x26'),'value':_0x4013d7[_0x1bad('0x27')]},{'key':_0x1bad('0x28'),'value':_0x1bad('0x29')},{'key':'scope','value':encodeURIComponent(_0x41f0ad)},{'key':_0x1bad('0x2a'),'value':_0x34bfa9},{'key':_0x1bad('0x2b'),'value':_0x124fb1},{'key':_0x1bad('0x2c'),'value':_0x1bad('0x2d')}];var _0x257cdc=_0x3be3f7+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1bad('0x14')](_0x1f0ec8,function(_0x14f023){return _0x14f023['key']+'='+_0x14f023['value'];})[_0x1bad('0x25')]('&');_0x4013d7[_0x1bad('0x2e')]={'issuer':_0x3be3f7[_0x1bad('0x1b')]('oauth2/',''),'audience':_0x4013d7[_0x1bad('0x2f')],'state':_0x34bfa9,'nonce':_0x124fb1};redis['set'](_0x34bfa9,JSON[_0x1bad('0x1f')](_0x4013d7));return _0x257cdc;}function isValidIdToken(_0x3fb048,_0x53959c){try{var _0x5216e7=jwt[_0x1bad('0x30')](_0x3fb048,{'complete':!![]});var _0x17fdde=_0x5216e7[_0x1bad('0x31')];if(_0x17fdde[_0x1bad('0x32')]!==_0x53959c[_0x1bad('0x33')])return![];if(_0x17fdde[_0x1bad('0x34')]!==_0x53959c['audience'])return![];if(_0x17fdde[_0x1bad('0x2b')]!==_0x53959c[_0x1bad('0x2b')])return![];if(moment()['isAfter'](moment[_0x1bad('0x35')](_0x17fdde[_0x1bad('0x36')])))return![];return!![];}catch(_0x2633b0){throw _0x2633b0;}}function refreshOauth2MicrosoftAccessToken(_0x20d85f){return Promise[_0x1bad('0x37')]()[_0x1bad('0x38')](function(){if(_0x20d85f[_0x1bad('0x39')])return _0x20d85f;return db[_0x1bad('0x3a')][_0x1bad('0x3b')]({'where':{'id':_0x20d85f['id']},'raw':!![]});})[_0x1bad('0x38')](function(_0x1963f4){var _0x193a77={'grant_type':_0x1bad('0x3c'),'refresh_token':_0x1963f4[_0x1bad('0x3d')],'scope':getAccessTokenScope(_0x1963f4),'redirect_uri':_0x1963f4[_0x1bad('0x27')],'client_id':_0x1963f4[_0x1bad('0x2f')],'client_secret':encryptor[_0x1bad('0x3e')](_0x1963f4[_0x1bad('0x39')])};var _0x1e54d8={'method':_0x1bad('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x1bad('0x1b')](_0x1bad('0x40'),_0x1963f4[_0x1bad('0x41')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x193a77,'json':!![]};return rp(_0x1e54d8);})['then'](function(_0x2de0e4){_0x20d85f[_0x1bad('0x42')]=_0x2de0e4[_0x1bad('0x43')];_0x20d85f[_0x1bad('0x3d')]=_0x2de0e4['refresh_token'];return db[_0x1bad('0x3a')][_0x1bad('0x44')]({'data5':_0x20d85f[_0x1bad('0x42')],'data6':_0x20d85f['data6']},{'where':{'id':_0x20d85f['id']}});})[_0x1bad('0x38')](function(){return _0x20d85f;})[_0x1bad('0x45')](function(_0x575f7f){logger[_0x1bad('0x46')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x20d85f['id'],_0x575f7f);});}function getOauth2MicrosoftAccessToken(_0x260ee6,_0x56d4b5){var _0x55fb46={'grant_type':_0x1bad('0x47'),'code':_0x260ee6,'scope':getAccessTokenScope(_0x56d4b5),'redirect_uri':_0x56d4b5[_0x1bad('0x27')],'client_id':_0x56d4b5[_0x1bad('0x2f')],'client_secret':encryptor[_0x1bad('0x3e')](_0x56d4b5[_0x1bad('0x39')])};var _0x570c12={'method':_0x1bad('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x1bad('0x1b')](_0x1bad('0x40'),_0x56d4b5[_0x1bad('0x41')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x55fb46,'json':!![]};return rp(_0x570c12);}function startRefreshInterval(_0x50b6a8){var _0x43fb37=schedule[_0x1bad('0x48')];if(_0x43fb37[_0x50b6a8['id']])clearInterval(_0x43fb37[_0x50b6a8['id']]);_0x43fb37[_0x50b6a8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1bad('0x49')](this,{'id':_0x50b6a8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x1bad('0x48')]=_0x43fb37;}function startAllRefreshIntervals(){return db[_0x1bad('0x3a')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1bad('0x38')](function(_0x5b15b7){var _0x4d677b=_0x5b15b7['map'](function(_0x495290){return refreshOauth2MicrosoftAccessToken(_0x495290)[_0x1bad('0x38')](function(_0x1903fe){startRefreshInterval(_0x1903fe);});});return Promise[_0x1bad('0x4a')](_0x4d677b);})['catch'](function(_0x4d0e07){var _0x18c229=_0x4d0e07?util[_0x1bad('0x4b')](_0x4d0e07,{'showHidden':![],'depth':null}):'';logger['error'](_0x1bad('0x4c'),_0x18c229);});}module[_0x1bad('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xe83a=['type','join','Outlook365','Dynamics365','data7','/.default','replace','{TENANT_ID}','data2','from','stringify','toString','base64','randomBytes','hex','client_id','response_type','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','data1','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','catch','error','authorization_code','intervals','bind','all','crypto','jsonwebtoken','moment','util','../../components/encryptor','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map'];(function(_0x5b3350,_0x3012cc){var _0x233b9a=function(_0x5c960e){while(--_0x5c960e){_0x5b3350['push'](_0x5b3350['shift']());}};_0x233b9a(++_0x3012cc);}(_0xe83a,0x1f4));var _0xae83=function(_0x28da07,_0x119907){_0x28da07=_0x28da07-0x0;var _0x23b5e0=_0xe83a[_0x28da07];return _0x23b5e0;};'use strict';var _=require('lodash');var crypto=require(_0xae83('0x0'));var jwt=require(_0xae83('0x1'));var moment=require(_0xae83('0x2'));var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0xae83('0x3'));var encryptor=require(_0xae83('0x4'));var config=require('../../config/environment');var logger=require('../../config/logger')('api');var schedule=require(_0xae83('0x5'));var db=require(_0xae83('0x6'))['db'];config[_0xae83('0x7')]=_[_0xae83('0x8')](config[_0xae83('0x7')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xae83('0x7')]);var MICROSOFT_AUTH_URL=_0xae83('0x9');var AZURE_AUTH_SCOPES={'Outlook365':[_0xae83('0xa'),_0xae83('0xb'),'email',_0xae83('0xc'),_0xae83('0xd'),'https://outlook.office.com/POP.AccessAsUser.All',_0xae83('0xe')],'Dynamics365':['openid',_0xae83('0xc')]};var MICROSOFT_AUTH_ENDPOINT=_0xae83('0xf');var MICROSOFT_TOKEN_ENDPOINT=_0xae83('0x10');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3b0360){var _0x1de70e=_[_0xae83('0x11')](AZURE_AUTH_SCOPES[_0x3b0360[_0xae83('0x12')]]);if(_0x3b0360[_0xae83('0x12')]==='Dynamics365')_0x1de70e['push'](_0x3b0360['data7']+'/.default');return _0x1de70e[_0xae83('0x13')]('\x20');}function getAccessTokenScope(_0xef0d03){if(_0xef0d03[_0xae83('0x12')]===_0xae83('0x14'))return _0xae83('0xd');if(_0xef0d03['type']===_0xae83('0x15'))return _0xef0d03[_0xae83('0x16')]+_0xae83('0x17');}function generateMicrosoftAuthorizationUrl(_0x35e19e,_0x49fe69){var _0x34a77c=MICROSOFT_AUTH_URL[_0xae83('0x18')](_0xae83('0x19'),_0x35e19e[_0xae83('0x1a')]);var _0x1e6e73=['code','id_token'];var _0x4a8d21=Buffer[_0xae83('0x1b')](JSON[_0xae83('0x1c')]({'id':_0x49fe69}))[_0xae83('0x1d')](_0xae83('0x1e'));var _0x507efc=crypto[_0xae83('0x1f')](0x10)[_0xae83('0x1d')](_0xae83('0x20'));var _0x301f8b=getAuthorizationScopes(_0x35e19e);var _0x173d1e=[{'key':_0xae83('0x21'),'value':_0x35e19e['data1']},{'key':_0xae83('0x22'),'value':encodeURIComponent(_0x1e6e73[_0xae83('0x13')]('\x20'))},{'key':'redirect_uri','value':_0x35e19e[_0xae83('0x23')]},{'key':_0xae83('0x24'),'value':_0xae83('0x25')},{'key':_0xae83('0x26'),'value':encodeURIComponent(_0x301f8b)},{'key':_0xae83('0x27'),'value':_0x4a8d21},{'key':_0xae83('0x28'),'value':_0x507efc},{'key':_0xae83('0x29'),'value':_0xae83('0x2a')}];var _0x5651fa=_0x34a77c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xae83('0x11')](_0x173d1e,function(_0x137723){return _0x137723[_0xae83('0x2b')]+'='+_0x137723[_0xae83('0x2c')];})[_0xae83('0x13')]('&');_0x35e19e[_0xae83('0x2d')]={'issuer':_0x34a77c[_0xae83('0x18')](_0xae83('0x2e'),''),'audience':_0x35e19e[_0xae83('0x2f')],'state':_0x4a8d21,'nonce':_0x507efc};redis[_0xae83('0x30')](_0x4a8d21,JSON[_0xae83('0x1c')](_0x35e19e));return _0x5651fa;}function isValidIdToken(_0x48b311,_0x338c89){try{var _0x51e5c2=jwt[_0xae83('0x31')](_0x48b311,{'complete':!![]});var _0x23286c=_0x51e5c2[_0xae83('0x32')];if(_0x23286c[_0xae83('0x33')]!==_0x338c89[_0xae83('0x34')])return![];if(_0x23286c[_0xae83('0x35')]!==_0x338c89[_0xae83('0x36')])return![];if(_0x23286c[_0xae83('0x28')]!==_0x338c89[_0xae83('0x28')])return![];if(moment()[_0xae83('0x37')](moment[_0xae83('0x38')](_0x23286c[_0xae83('0x39')])))return![];return!![];}catch(_0x1ff9d0){throw _0x1ff9d0;}}function refreshOauth2MicrosoftAccessToken(_0x106d6e){return Promise[_0xae83('0x3a')]()[_0xae83('0x3b')](function(){if(_0x106d6e[_0xae83('0x3c')])return _0x106d6e;return db[_0xae83('0x3d')][_0xae83('0x3e')]({'where':{'id':_0x106d6e['id']},'raw':!![]});})[_0xae83('0x3b')](function(_0x52ebe7){var _0x3f4a2c={'grant_type':_0xae83('0x3f'),'refresh_token':_0x52ebe7[_0xae83('0x40')],'scope':getAccessTokenScope(_0x52ebe7),'redirect_uri':_0x52ebe7[_0xae83('0x23')],'client_id':_0x52ebe7['data1'],'client_secret':encryptor[_0xae83('0x41')](_0x52ebe7[_0xae83('0x3c')])};var _0xe2e75b={'method':_0xae83('0x42'),'uri':MICROSOFT_AUTH_URL[_0xae83('0x18')](_0xae83('0x19'),_0x52ebe7[_0xae83('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3f4a2c,'json':!![]};return rp(_0xe2e75b);})[_0xae83('0x3b')](function(_0x43a7ad){_0x106d6e[_0xae83('0x43')]=_0x43a7ad['access_token'];_0x106d6e[_0xae83('0x40')]=_0x43a7ad[_0xae83('0x3f')];return db['CloudProvider']['update']({'data5':_0x106d6e[_0xae83('0x43')],'data6':_0x106d6e[_0xae83('0x40')]},{'where':{'id':_0x106d6e['id']}});})[_0xae83('0x3b')](function(){return _0x106d6e;})[_0xae83('0x44')](function(_0x7dc253){logger[_0xae83('0x45')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x106d6e['id'],_0x7dc253);});}function getOauth2MicrosoftAccessToken(_0xcf800c,_0x4c04d5){var _0xac53a0={'grant_type':_0xae83('0x46'),'code':_0xcf800c,'scope':getAccessTokenScope(_0x4c04d5),'redirect_uri':_0x4c04d5['data4'],'client_id':_0x4c04d5['data1'],'client_secret':encryptor['decryptString'](_0x4c04d5['data3'])};var _0x310943={'method':_0xae83('0x42'),'uri':MICROSOFT_AUTH_URL[_0xae83('0x18')](_0xae83('0x19'),_0x4c04d5[_0xae83('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xac53a0,'json':!![]};return rp(_0x310943);}function startRefreshInterval(_0x53b201){var _0x14e772=schedule[_0xae83('0x47')];if(_0x14e772[_0x53b201['id']])clearInterval(_0x14e772[_0x53b201['id']]);_0x14e772[_0x53b201['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xae83('0x48')](this,{'id':_0x53b201['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x14e772;}function startAllRefreshIntervals(){return db[_0xae83('0x3d')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xae83('0x3b')](function(_0xfc6bbe){var _0x138648=_0xfc6bbe['map'](function(_0x218164){return refreshOauth2MicrosoftAccessToken(_0x218164)[_0xae83('0x3b')](function(_0x2c61fb){startRefreshInterval(_0x2c61fb);});});return Promise[_0xae83('0x49')](_0x138648);})[_0xae83('0x44')](function(_0x5b64c9){var _0x11ec3e=_0x5b64c9?util['inspect'](_0x5b64c9,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x11ec3e);});}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 ee3789b..d3c2c12 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 _0x160c=['error','code','message','result','catch','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x160c,0x181));var _0xc160=function(_0x2e938d,_0x888278){_0x2e938d=_0x2e938d-0x0;var _0x2ea295=_0x160c[_0x2e938d];return _0x2ea295;};'use strict';var _=require('lodash');var util=require(_0xc160('0x0'));var moment=require(_0xc160('0x1'));var BPromise=require(_0xc160('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc160('0x3'));var logger=require('../../config/logger')(_0xc160('0x4'));var config=require(_0xc160('0x5'));var jayson=require(_0xc160('0x6'));var client=jayson['client'][_0xc160('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dfb45,_0x26e1f4,_0x549651){return new BPromise(function(_0x359ac9,_0x30c90e){return client['request'](_0x5dfb45,_0x549651)[_0xc160('0x8')](function(_0x208643){logger['info'](_0xc160('0x9'),_0x26e1f4,_0xc160('0xa'));logger[_0xc160('0xb')](_0xc160('0xc'),_0x26e1f4,_0xc160('0xa'),JSON[_0xc160('0xd')](_0x208643));if(_0x208643[_0xc160('0xe')]){if(_0x208643[_0xc160('0xe')][_0xc160('0xf')]===0x1f4){logger['error'](_0xc160('0x9'),_0x26e1f4,_0x208643[_0xc160('0xe')]['message']);return _0x30c90e(_0x208643[_0xc160('0xe')][_0xc160('0x10')]);}logger[_0xc160('0xe')]('CloudProvider,\x20%s,\x20%s',_0x26e1f4,_0x208643[_0xc160('0xe')]['message']);return _0x359ac9(_0x208643[_0xc160('0xe')][_0xc160('0x10')]);}else{logger['info'](_0xc160('0x9'),_0x26e1f4,'request\x20sent');_0x359ac9(_0x208643[_0xc160('0x11')][_0xc160('0x10')]);}})[_0xc160('0x12')](function(_0x5bb074){logger['error'](_0xc160('0x9'),_0x26e1f4,_0x5bb074);_0x30c90e(_0x5bb074);});});} \ No newline at end of file +var _0x964b=['../../config/environment','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x6d1ecf,_0x12001c){var _0x5d00d2=function(_0x2882c4){while(--_0x2882c4){_0x6d1ecf['push'](_0x6d1ecf['shift']());}};_0x5d00d2(++_0x12001c);}(_0x964b,0x112));var _0xb964=function(_0x5eed47,_0x39e0b5){_0x5eed47=_0x5eed47-0x0;var _0x146edb=_0x964b[_0x5eed47];return _0x146edb;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var moment=require('moment');var BPromise=require(_0xb964('0x2'));var rs=require(_0xb964('0x3'));var fs=require('fs');var Redis=require(_0xb964('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb964('0x5'))('rpc');var config=require(_0xb964('0x6'));var jayson=require(_0xb964('0x7'));var client=jayson[_0xb964('0x8')][_0xb964('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x204c7d,_0xde47d5,_0x3fe401){return new BPromise(function(_0x53b463,_0x58e49e){return client[_0xb964('0xa')](_0x204c7d,_0x3fe401)['then'](function(_0x55e697){logger[_0xb964('0xb')](_0xb964('0xc'),_0xde47d5,_0xb964('0xd'));logger[_0xb964('0xe')](_0xb964('0xf'),_0xde47d5,_0xb964('0xd'),JSON['stringify'](_0x55e697));if(_0x55e697[_0xb964('0x10')]){if(_0x55e697[_0xb964('0x10')][_0xb964('0x11')]===0x1f4){logger[_0xb964('0x10')]('CloudProvider,\x20%s,\x20%s',_0xde47d5,_0x55e697[_0xb964('0x10')]['message']);return _0x58e49e(_0x55e697['error'][_0xb964('0x12')]);}logger[_0xb964('0x10')](_0xb964('0xc'),_0xde47d5,_0x55e697[_0xb964('0x10')][_0xb964('0x12')]);return _0x53b463(_0x55e697[_0xb964('0x10')][_0xb964('0x12')]);}else{logger['info'](_0xb964('0xc'),_0xde47d5,'request\x20sent');_0x53b463(_0x55e697['result'][_0xb964('0x12')]);}})[_0xb964('0x13')](function(_0x26aa2c){logger[_0xb964('0x10')](_0xb964('0xc'),_0xde47d5,_0x26aa2c);_0x58e49e(_0x26aa2c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index ada28a5..df3ce87 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(_0x197e88,_0x542f13){var _0x541669=function(_0x3f3672){while(--_0x3f3672){_0x197e88['push'](_0x197e88['shift']());}};_0x541669(++_0x542f13);}(_0x2ef3,0xba));var _0x32ef=function(_0x48162f,_0x598996){_0x48162f=_0x48162f-0x0;var _0x216f76=_0x2ef3[_0x48162f];return _0x216f76;};'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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x219c78,_0x23b165){var _0x21d22e=function(_0x26f358){while(--_0x26f358){_0x219c78['push'](_0x219c78['shift']());}};_0x21d22e(++_0x23b165);}(_0xdb28,0x106));var _0x8db2=function(_0x3afc8e,_0x35ec62){_0x3afc8e=_0x3afc8e-0x0;var _0x51b412=_0xdb28[_0x3afc8e];return _0x51b412;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8128207..fa71223 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 _0x7f47=['STRING','name','sequelize','exports'];(function(_0x25762d,_0x45830d){var _0x2300d0=function(_0x172f7b){while(--_0x172f7b){_0x25762d['push'](_0x25762d['shift']());}};_0x2300d0(++_0x45830d);}(_0x7f47,0x12e));var _0x77f4=function(_0x872f6f,_0x5efe7b){_0x872f6f=_0x872f6f-0x0;var _0x59a5f4=_0x7f47[_0x872f6f];return _0x59a5f4;};'use strict';var Sequelize=require(_0x77f4('0x0'));module[_0x77f4('0x1')]={'name':{'type':Sequelize[_0x77f4('0x2')],'unique':_0x77f4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x77f4('0x2')]},'companyId':{'type':Sequelize[_0x77f4('0x2')]},'website':{'type':Sequelize[_0x77f4('0x2')]},'phone':{'type':Sequelize[_0x77f4('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x77f4('0x2')]},'street':{'type':Sequelize[_0x77f4('0x2')]},'postalCode':{'type':Sequelize[_0x77f4('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x77f4('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x77f4('0x2')]},'sStreet':{'type':Sequelize[_0x77f4('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x77f4('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x77f4('0x2')]}}; \ No newline at end of file +var _0x4e8e=['STRING','exports'];(function(_0x39cff5,_0x234f0c){var _0x430437=function(_0xb2375){while(--_0xb2375){_0x39cff5['push'](_0x39cff5['shift']());}};_0x430437(++_0x234f0c);}(_0x4e8e,0xf3));var _0xe4e8=function(_0xbbba1b,_0x5400d0){_0xbbba1b=_0xbbba1b-0x0;var _0x3d8a0f=_0x4e8e[_0xbbba1b];return _0x3d8a0f;};'use strict';var Sequelize=require('sequelize');module[_0xe4e8('0x0')]={'name':{'type':Sequelize[_0xe4e8('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xe4e8('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe4e8('0x1')]},'fax':{'type':Sequelize[_0xe4e8('0x1')]},'type':{'type':Sequelize[_0xe4e8('0x1')]},'street':{'type':Sequelize[_0xe4e8('0x1')]},'postalCode':{'type':Sequelize[_0xe4e8('0x1')]},'city':{'type':Sequelize[_0xe4e8('0x1')]},'country':{'type':Sequelize[_0xe4e8('0x1')]},'email':{'type':Sequelize[_0xe4e8('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe4e8('0x1')]},'sStreet':{'type':Sequelize[_0xe4e8('0x1')]},'sPostalCode':{'type':Sequelize[_0xe4e8('0x1')]},'sCity':{'type':Sequelize[_0xe4e8('0x1')]},'sCountry':{'type':Sequelize[_0xe4e8('0x1')]},'description':{'type':Sequelize[_0xe4e8('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 04aa5fe..ffef132 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 _0xc554=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','CmContact','addContacts','ids','omit','findOne','filter','getContacts','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5adf6c,_0x43aded){var _0x54535f=function(_0xe03640){while(--_0xe03640){_0x5adf6c['push'](_0x5adf6c['shift']());}};_0x54535f(++_0x43aded);}(_0xc554,0x142));var _0x4c55=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc554[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c55('0x0'));var jsonpatch=require(_0x4c55('0x1'));var rp=require(_0x4c55('0x2'));var moment=require(_0x4c55('0x3'));var BPromise=require(_0x4c55('0x4'));var Mustache=require('mustache');var util=require(_0x4c55('0x5'));var path=require('path');var sox=require(_0x4c55('0x6'));var csv=require(_0x4c55('0x7'));var ejs=require(_0x4c55('0x8'));var fs=require('fs');var fs_extra=require(_0x4c55('0x9'));var _=require(_0x4c55('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c55('0xb'));var toCsv=require(_0x4c55('0x7'));var querystring=require(_0x4c55('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4c55('0xd'));var qs=require(_0x4c55('0xe'));var as=require(_0x4c55('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4c55('0x10'));var utils=require(_0x4c55('0x11'));var config=require(_0x4c55('0x12'));var licenseUtil=require(_0x4c55('0x13'));var db=require(_0x4c55('0x14'))['db'];function respondWithStatusCode(_0x5918d2,_0x26b645){_0x26b645=_0x26b645||0xcc;return function(_0x55b87d){if(_0x55b87d){return _0x5918d2[_0x4c55('0x15')](_0x26b645);}return _0x5918d2[_0x4c55('0x16')](_0x26b645)[_0x4c55('0x17')]();};}function respondWithResult(_0x50f3e3,_0xbb2cfd){_0xbb2cfd=_0xbb2cfd||0xc8;return function(_0x6e3319){if(_0x6e3319){return _0x50f3e3[_0x4c55('0x16')](_0xbb2cfd)[_0x4c55('0x18')](_0x6e3319);}};}function respondWithFilteredResult(_0x15fd7d,_0x509b53){return function(_0x4a47a8){if(_0x4a47a8){var _0x912b74=typeof _0x509b53[_0x4c55('0x19')]===_0x4c55('0x1a')&&typeof _0x509b53[_0x4c55('0x1b')]===_0x4c55('0x1a');var _0x56edff=_0x4a47a8[_0x4c55('0x1c')];var _0x4956c1=_0x912b74?0x0:_0x509b53['offset'];var _0x373b3d=_0x912b74?_0x4a47a8['count']:_0x509b53['offset']+_0x509b53['limit'];var _0xb05ec4;if(_0x373b3d>=_0x56edff){_0x373b3d=_0x56edff;_0xb05ec4=0xc8;}else{_0xb05ec4=0xce;}_0x15fd7d[_0x4c55('0x16')](_0xb05ec4);return _0x15fd7d[_0x4c55('0x1d')](_0x4c55('0x1e'),_0x4956c1+'-'+_0x373b3d+'/'+_0x56edff)[_0x4c55('0x18')](_0x4a47a8);}return null;};}function patchUpdates(_0x50c810){return function(_0x52b567){try{jsonpatch[_0x4c55('0x1f')](_0x52b567,_0x50c810,!![]);}catch(_0x9ed2fc){return BPromise[_0x4c55('0x20')](_0x9ed2fc);}return _0x52b567[_0x4c55('0x21')]();};}function saveUpdates(_0x482a5c,_0x415154){return function(_0x55c924){if(_0x55c924){return _0x55c924[_0x4c55('0x22')](_0x482a5c)[_0x4c55('0x23')](function(_0x41af07){return _0x41af07;});}return null;};}function removeEntity(_0x2a5d16,_0x912a2e){return function(_0x3dc057){if(_0x3dc057){return _0x3dc057[_0x4c55('0x24')]()['then'](function(){var _0x38b85f=_0x3dc057[_0x4c55('0x25')]({'plain':!![]});var _0x103d57=_0x4c55('0x26');return db[_0x4c55('0x27')][_0x4c55('0x24')]({'where':{'type':_0x103d57,'resourceId':_0x38b85f['id']}})[_0x4c55('0x23')](function(){return _0x3dc057;});})[_0x4c55('0x23')](function(){_0x2a5d16[_0x4c55('0x16')](0xcc)[_0x4c55('0x17')]();});}};}function handleEntityNotFound(_0x6934d1,_0x4e2e99){return function(_0x3ed9b0){if(!_0x3ed9b0){_0x6934d1[_0x4c55('0x15')](0x194);}return _0x3ed9b0;};}function handleError(_0x18a30a,_0xe14066){_0xe14066=_0xe14066||0x1f4;return function(_0x2936c0){logger[_0x4c55('0x28')](_0x2936c0[_0x4c55('0x29')]);if(_0x2936c0[_0x4c55('0x2a')]){delete _0x2936c0[_0x4c55('0x2a')];}_0x18a30a[_0x4c55('0x16')](_0xe14066)[_0x4c55('0x2b')](_0x2936c0);};}exports['index']=function(_0x5bf367,_0x389ae2){var _0x123059={},_0x20cec5={},_0x2df10a={'count':0x0,'rows':[]};return db[_0x4c55('0x2c')]['describe']()[_0x4c55('0x23')](function(_0x548e4d){_0x20cec5[_0x4c55('0x2d')]=_['keys'](_0x548e4d);_0x20cec5[_0x4c55('0x2e')]=_[_0x4c55('0x2f')](_0x5bf367['query']);_0x20cec5['filters']=_[_0x4c55('0x30')](_0x20cec5['model'],_0x20cec5[_0x4c55('0x2e')]);_0x123059[_0x4c55('0x31')]=_[_0x4c55('0x30')](_0x20cec5[_0x4c55('0x2d')],qs['fields'](_0x5bf367['query'][_0x4c55('0x32')]));_0x123059['attributes']=_0x123059[_0x4c55('0x31')][_0x4c55('0x33')]?_0x123059[_0x4c55('0x31')]:_0x20cec5[_0x4c55('0x2d')];if(!_0x5bf367[_0x4c55('0x2e')][_0x4c55('0x34')](_0x4c55('0x35'))){_0x123059[_0x4c55('0x1b')]=qs[_0x4c55('0x1b')](_0x5bf367[_0x4c55('0x2e')][_0x4c55('0x1b')]);_0x123059[_0x4c55('0x19')]=qs['offset'](_0x5bf367[_0x4c55('0x2e')][_0x4c55('0x19')]);}_0x123059[_0x4c55('0x36')]=qs[_0x4c55('0x37')](_0x5bf367[_0x4c55('0x2e')][_0x4c55('0x37')]);_0x123059[_0x4c55('0x38')]=qs[_0x4c55('0x39')](_[_0x4c55('0x3a')](_0x5bf367['query'],_0x20cec5[_0x4c55('0x39')]),_0x548e4d);if(_0x5bf367['query']['filter']){_0x123059[_0x4c55('0x38')]=_['merge'](_0x123059[_0x4c55('0x38')],{'$or':_['map'](_0x123059[_0x4c55('0x31')],function(_0x5f3f66){var _0xf5a651={};_0xf5a651[_0x5f3f66]={'$like':'%'+_0x5bf367[_0x4c55('0x2e')]['filter']+'%'};return _0xf5a651;})});}_0x123059=_[_0x4c55('0x3b')]({},_0x123059,_0x5bf367['options']);var _0x180001={'where':_0x123059['where']};return db[_0x4c55('0x2c')][_0x4c55('0x1c')](_0x180001)[_0x4c55('0x23')](function(_0x17679a){_0x2df10a[_0x4c55('0x1c')]=_0x17679a;if(_0x5bf367[_0x4c55('0x2e')][_0x4c55('0x3c')]){_0x123059['include']=[{'all':!![]}];}return db[_0x4c55('0x2c')][_0x4c55('0x3d')](_0x123059);})[_0x4c55('0x23')](function(_0xbc7755){_0x2df10a[_0x4c55('0x3e')]=_0xbc7755;return _0x2df10a;})[_0x4c55('0x23')](respondWithFilteredResult(_0x389ae2,_0x123059))[_0x4c55('0x3f')](handleError(_0x389ae2,null));})[_0x4c55('0x3f')](handleError(_0x389ae2,null));};exports[_0x4c55('0x40')]=function(_0x125eab,_0xa00154){var _0x41698d={'raw':![],'where':{'id':_0x125eab[_0x4c55('0x41')]['id']}},_0x5d54eb={};_0x5d54eb[_0x4c55('0x2d')]=_[_0x4c55('0x2f')](db[_0x4c55('0x2c')][_0x4c55('0x42')]);_0x5d54eb[_0x4c55('0x2e')]=_[_0x4c55('0x2f')](_0x125eab[_0x4c55('0x2e')]);_0x5d54eb[_0x4c55('0x39')]=_[_0x4c55('0x30')](_0x5d54eb[_0x4c55('0x2d')],_0x5d54eb[_0x4c55('0x2e')]);_0x41698d[_0x4c55('0x31')]=_[_0x4c55('0x30')](_0x5d54eb[_0x4c55('0x2d')],qs[_0x4c55('0x32')](_0x125eab[_0x4c55('0x2e')][_0x4c55('0x32')]));_0x41698d['attributes']=_0x41698d[_0x4c55('0x31')]['length']?_0x41698d[_0x4c55('0x31')]:_0x5d54eb[_0x4c55('0x2d')];if(_0x125eab[_0x4c55('0x2e')][_0x4c55('0x3c')]){_0x41698d[_0x4c55('0x43')]=[{'all':!![]}];}_0x41698d=_['merge']({},_0x41698d,_0x125eab[_0x4c55('0x44')]);return db['CmCompany'][_0x4c55('0x45')](_0x41698d)['then'](handleEntityNotFound(_0xa00154,null))['then'](respondWithResult(_0xa00154,null))[_0x4c55('0x3f')](handleError(_0xa00154,null));};exports['create']=function(_0x11db4a,_0x36e82b){return db[_0x4c55('0x2c')][_0x4c55('0x46')](_0x11db4a[_0x4c55('0x47')],{})[_0x4c55('0x23')](function(_0x5f344a){var _0x12f1a7=_0x11db4a[_0x4c55('0x48')]['get']({'plain':!![]});if(!_0x12f1a7)throw new Error(_0x4c55('0x49'));if(_0x12f1a7[_0x4c55('0x4a')]===_0x4c55('0x48')){var _0x14ccc3=_0x5f344a[_0x4c55('0x25')]({'plain':!![]});var _0x2770b6='Companies';return db[_0x4c55('0x4b')][_0x4c55('0x45')]({'where':{'name':_0x2770b6,'userProfileId':_0x12f1a7['userProfileId']},'raw':!![]})['then'](function(_0x3ba594){if(_0x3ba594&&_0x3ba594[_0x4c55('0x4c')]===0x0){return db[_0x4c55('0x27')]['create']({'name':_0x14ccc3[_0x4c55('0x2a')],'resourceId':_0x14ccc3['id'],'type':_0x3ba594[_0x4c55('0x2a')],'sectionId':_0x3ba594['id']},{})[_0x4c55('0x23')](function(){return _0x5f344a;});}else{return _0x5f344a;}})[_0x4c55('0x3f')](function(_0x2e092b){logger[_0x4c55('0x28')](_0x4c55('0x4d'),_0x2e092b);throw _0x2e092b;});}return _0x5f344a;})[_0x4c55('0x23')](respondWithResult(_0x36e82b,0xc9))[_0x4c55('0x3f')](handleError(_0x36e82b,null));};exports[_0x4c55('0x22')]=function(_0x420573,_0x308284){if(_0x420573['body']['id']){delete _0x420573[_0x4c55('0x47')]['id'];}return db['CmCompany'][_0x4c55('0x45')]({'where':{'id':_0x420573[_0x4c55('0x41')]['id']}})[_0x4c55('0x23')](handleEntityNotFound(_0x308284,null))[_0x4c55('0x23')](saveUpdates(_0x420573[_0x4c55('0x47')],null))[_0x4c55('0x23')](respondWithResult(_0x308284,null))[_0x4c55('0x3f')](handleError(_0x308284,null));};exports[_0x4c55('0x24')]=function(_0x44e5f1,_0x39ec29){return db[_0x4c55('0x2c')]['find']({'where':{'id':_0x44e5f1[_0x4c55('0x41')]['id']}})[_0x4c55('0x23')](handleEntityNotFound(_0x39ec29,null))[_0x4c55('0x23')](removeEntity(_0x39ec29,null))[_0x4c55('0x3f')](handleError(_0x39ec29,null));};exports[_0x4c55('0x4e')]=function(_0x30678c,_0x4f996c){return db[_0x4c55('0x2c')][_0x4c55('0x4e')]()[_0x4c55('0x23')](respondWithResult(_0x4f996c,null))[_0x4c55('0x3f')](handleError(_0x4f996c,null));};exports['addContacts']=function(_0x1a483e,_0x2c3b9c,_0x355f06){return db[_0x4c55('0x4f')][_0x4c55('0x45')]({'where':{'id':_0x1a483e[_0x4c55('0x41')]['id']}})[_0x4c55('0x23')](handleEntityNotFound(_0x2c3b9c,null))['then'](function(_0x4eb2a2){if(_0x4eb2a2){return _0x4eb2a2[_0x4c55('0x50')](_0x1a483e[_0x4c55('0x47')][_0x4c55('0x51')],_[_0x4c55('0x52')](_0x1a483e[_0x4c55('0x47')],[_0x4c55('0x51'),'id'])||{});}})[_0x4c55('0x23')](respondWithResult(_0x2c3b9c,null))['catch'](handleError(_0x2c3b9c,null));};exports['getContacts']=function(_0xcf3413,_0x343b12,_0x40a1cb){var _0x27fb34={};var _0x8782af={};var _0x3c57f7;var _0x360e48;return db[_0x4c55('0x2c')][_0x4c55('0x53')]({'where':{'id':_0xcf3413['params']['id']}})[_0x4c55('0x23')](handleEntityNotFound(_0x343b12,null))[_0x4c55('0x23')](function(_0x2af24b){if(_0x2af24b){_0x3c57f7=_0x2af24b;_0x8782af[_0x4c55('0x2d')]=_['keys'](db[_0x4c55('0x4f')][_0x4c55('0x42')]);_0x8782af[_0x4c55('0x2e')]=_[_0x4c55('0x2f')](_0xcf3413['query']);_0x8782af[_0x4c55('0x39')]=_[_0x4c55('0x30')](_0x8782af['model'],_0x8782af[_0x4c55('0x2e')]);_0x27fb34[_0x4c55('0x31')]=_[_0x4c55('0x30')](_0x8782af[_0x4c55('0x2d')],qs[_0x4c55('0x32')](_0xcf3413[_0x4c55('0x2e')][_0x4c55('0x32')]));_0x27fb34['attributes']=_0x27fb34[_0x4c55('0x31')][_0x4c55('0x33')]?_0x27fb34[_0x4c55('0x31')]:_0x8782af[_0x4c55('0x2d')];_0x27fb34['order']=qs[_0x4c55('0x37')](_0xcf3413[_0x4c55('0x2e')]['sort']);_0x27fb34[_0x4c55('0x38')]=qs[_0x4c55('0x39')](_[_0x4c55('0x3a')](_0xcf3413[_0x4c55('0x2e')],_0x8782af['filters']));if(_0xcf3413[_0x4c55('0x2e')]['filter']){_0x27fb34['where']=_[_0x4c55('0x3b')](_0x27fb34[_0x4c55('0x38')],{'$or':_['map'](_0x27fb34['attributes'],function(_0x694deb){var _0x31c813={};_0x31c813[_0x694deb]={'$like':'%'+_0xcf3413[_0x4c55('0x2e')][_0x4c55('0x54')]+'%'};return _0x31c813;})});}_0x27fb34=_[_0x4c55('0x3b')]({},_0x27fb34,_0xcf3413['options']);return _0x3c57f7['getContacts'](_0x27fb34);}})[_0x4c55('0x23')](function(_0x40beb0){if(_0x40beb0){_0x360e48=_0x40beb0[_0x4c55('0x33')];if(!_0xcf3413[_0x4c55('0x2e')][_0x4c55('0x34')](_0x4c55('0x35'))){_0x27fb34[_0x4c55('0x1b')]=qs['limit'](_0xcf3413['query'][_0x4c55('0x1b')]);_0x27fb34['offset']=qs[_0x4c55('0x19')](_0xcf3413['query'][_0x4c55('0x19')]);}return _0x3c57f7[_0x4c55('0x55')](_0x27fb34);}})['then'](function(_0x59c169){if(_0x59c169){return _0x59c169?{'count':_0x360e48,'rows':_0x59c169}:null;}})['then'](respondWithResult(_0x343b12,null))[_0x4c55('0x3f')](handleError(_0x343b12,null));}; \ No newline at end of file +var _0x7236=['body','params','addContacts','omit','getContacts','findOne','CmContact','rawAttributes','map','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','Companies','UserProfileResource','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','catch','show','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7236,0x16e));var _0x6723=function(_0x383ea7,_0x4d98bd){_0x383ea7=_0x383ea7-0x0;var _0xfa9014=_0x7236[_0x383ea7];return _0xfa9014;};'use strict';var emlformat=require(_0x6723('0x0'));var rimraf=require(_0x6723('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6723('0x2'));var rp=require(_0x6723('0x3'));var moment=require(_0x6723('0x4'));var BPromise=require(_0x6723('0x5'));var Mustache=require('mustache');var util=require(_0x6723('0x6'));var path=require('path');var sox=require(_0x6723('0x7'));var csv=require('to-csv');var ejs=require(_0x6723('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6723('0x9'));var squel=require(_0x6723('0xa'));var crypto=require('crypto');var jsforce=require(_0x6723('0xb'));var deskjs=require(_0x6723('0xc'));var toCsv=require(_0x6723('0xd'));var querystring=require(_0x6723('0xe'));var Papa=require(_0x6723('0xf'));var Redis=require(_0x6723('0x10'));var authService=require(_0x6723('0x11'));var qs=require(_0x6723('0x12'));var as=require(_0x6723('0x13'));var hardwareService=require(_0x6723('0x14'));var logger=require('../../config/logger')(_0x6723('0x15'));var utils=require(_0x6723('0x16'));var config=require(_0x6723('0x17'));var licenseUtil=require(_0x6723('0x18'));var db=require(_0x6723('0x19'))['db'];function respondWithStatusCode(_0x279b20,_0x58433b){_0x58433b=_0x58433b||0xcc;return function(_0x5c06f2){if(_0x5c06f2){return _0x279b20[_0x6723('0x1a')](_0x58433b);}return _0x279b20[_0x6723('0x1b')](_0x58433b)[_0x6723('0x1c')]();};}function respondWithResult(_0x4fb9b8,_0x9b2f26){_0x9b2f26=_0x9b2f26||0xc8;return function(_0x1d73f4){if(_0x1d73f4){return _0x4fb9b8[_0x6723('0x1b')](_0x9b2f26)[_0x6723('0x1d')](_0x1d73f4);}};}function respondWithFilteredResult(_0x2afffd,_0x5c082b){return function(_0x154a0b){if(_0x154a0b){var _0x4430e2=typeof _0x5c082b['offset']==='undefined'&&typeof _0x5c082b['limit']==='undefined';var _0x85954a=_0x154a0b[_0x6723('0x1e')];var _0x54089b=_0x4430e2?0x0:_0x5c082b[_0x6723('0x1f')];var _0x4fc187=_0x4430e2?_0x154a0b[_0x6723('0x1e')]:_0x5c082b[_0x6723('0x1f')]+_0x5c082b[_0x6723('0x20')];var _0x40c7a4;if(_0x4fc187>=_0x85954a){_0x4fc187=_0x85954a;_0x40c7a4=0xc8;}else{_0x40c7a4=0xce;}_0x2afffd[_0x6723('0x1b')](_0x40c7a4);return _0x2afffd['set'](_0x6723('0x21'),_0x54089b+'-'+_0x4fc187+'/'+_0x85954a)[_0x6723('0x1d')](_0x154a0b);}return null;};}function patchUpdates(_0xae176e){return function(_0x15e4a9){try{jsonpatch[_0x6723('0x22')](_0x15e4a9,_0xae176e,!![]);}catch(_0x204904){return BPromise[_0x6723('0x23')](_0x204904);}return _0x15e4a9['save']();};}function saveUpdates(_0x3664e7,_0x3a7d19){return function(_0x58a0fc){if(_0x58a0fc){return _0x58a0fc[_0x6723('0x24')](_0x3664e7)[_0x6723('0x25')](function(_0x22b1c2){return _0x22b1c2;});}return null;};}function removeEntity(_0x3a7dfd,_0x3706e6){return function(_0x544c87){if(_0x544c87){return _0x544c87[_0x6723('0x26')]()['then'](function(){var _0x4658cd=_0x544c87[_0x6723('0x27')]({'plain':!![]});var _0x1bf3f3=_0x6723('0x28');return db[_0x6723('0x29')][_0x6723('0x26')]({'where':{'type':_0x1bf3f3,'resourceId':_0x4658cd['id']}})['then'](function(){return _0x544c87;});})[_0x6723('0x25')](function(){_0x3a7dfd['status'](0xcc)[_0x6723('0x1c')]();});}};}function handleEntityNotFound(_0x2295f0,_0x567bf1){return function(_0x52bc6e){if(!_0x52bc6e){_0x2295f0[_0x6723('0x1a')](0x194);}return _0x52bc6e;};}function handleError(_0x57cb22,_0x3cbe14){_0x3cbe14=_0x3cbe14||0x1f4;return function(_0xea6ffb){logger['error'](_0xea6ffb[_0x6723('0x2a')]);if(_0xea6ffb['name']){delete _0xea6ffb[_0x6723('0x2b')];}_0x57cb22[_0x6723('0x1b')](_0x3cbe14)[_0x6723('0x2c')](_0xea6ffb);};}exports[_0x6723('0x2d')]=function(_0x28b54e,_0x7ac268){var _0x2d92e4={},_0x434360={},_0x431481={'count':0x0,'rows':[]};return db[_0x6723('0x2e')][_0x6723('0x2f')]()['then'](function(_0x13b40f){_0x434360[_0x6723('0x30')]=_[_0x6723('0x31')](_0x13b40f);_0x434360['query']=_[_0x6723('0x31')](_0x28b54e[_0x6723('0x32')]);_0x434360['filters']=_[_0x6723('0x33')](_0x434360[_0x6723('0x30')],_0x434360[_0x6723('0x32')]);_0x2d92e4[_0x6723('0x34')]=_[_0x6723('0x33')](_0x434360[_0x6723('0x30')],qs[_0x6723('0x35')](_0x28b54e[_0x6723('0x32')]['fields']));_0x2d92e4[_0x6723('0x34')]=_0x2d92e4[_0x6723('0x34')]['length']?_0x2d92e4[_0x6723('0x34')]:_0x434360['model'];if(!_0x28b54e[_0x6723('0x32')][_0x6723('0x36')]('nolimit')){_0x2d92e4['limit']=qs[_0x6723('0x20')](_0x28b54e[_0x6723('0x32')]['limit']);_0x2d92e4[_0x6723('0x1f')]=qs[_0x6723('0x1f')](_0x28b54e['query']['offset']);}_0x2d92e4[_0x6723('0x37')]=qs[_0x6723('0x38')](_0x28b54e[_0x6723('0x32')]['sort']);_0x2d92e4[_0x6723('0x39')]=qs['filters'](_[_0x6723('0x3a')](_0x28b54e[_0x6723('0x32')],_0x434360[_0x6723('0x3b')]),_0x13b40f);if(_0x28b54e[_0x6723('0x32')][_0x6723('0x3c')]){_0x2d92e4['where']=_[_0x6723('0x3d')](_0x2d92e4[_0x6723('0x39')],{'$or':_['map'](_0x2d92e4[_0x6723('0x34')],function(_0x518317){var _0x5a1059={};_0x5a1059[_0x518317]={'$like':'%'+_0x28b54e[_0x6723('0x32')][_0x6723('0x3c')]+'%'};return _0x5a1059;})});}_0x2d92e4=_['merge']({},_0x2d92e4,_0x28b54e[_0x6723('0x3e')]);var _0x4a66d6={'where':_0x2d92e4[_0x6723('0x39')]};return db['CmCompany'][_0x6723('0x1e')](_0x4a66d6)[_0x6723('0x25')](function(_0x33be2d){_0x431481[_0x6723('0x1e')]=_0x33be2d;if(_0x28b54e[_0x6723('0x32')][_0x6723('0x3f')]){_0x2d92e4[_0x6723('0x40')]=[{'all':!![]}];}return db[_0x6723('0x2e')][_0x6723('0x41')](_0x2d92e4);})[_0x6723('0x25')](function(_0x36df6a){_0x431481['rows']=_0x36df6a;return _0x431481;})[_0x6723('0x25')](respondWithFilteredResult(_0x7ac268,_0x2d92e4))[_0x6723('0x42')](handleError(_0x7ac268,null));})[_0x6723('0x42')](handleError(_0x7ac268,null));};exports[_0x6723('0x43')]=function(_0x30c8da,_0x553572){var _0x21ec56={'raw':![],'where':{'id':_0x30c8da['params']['id']}},_0x8af452={};_0x8af452[_0x6723('0x30')]=_[_0x6723('0x31')](db['CmCompany']['rawAttributes']);_0x8af452[_0x6723('0x32')]=_['keys'](_0x30c8da[_0x6723('0x32')]);_0x8af452[_0x6723('0x3b')]=_[_0x6723('0x33')](_0x8af452['model'],_0x8af452[_0x6723('0x32')]);_0x21ec56[_0x6723('0x34')]=_[_0x6723('0x33')](_0x8af452[_0x6723('0x30')],qs[_0x6723('0x35')](_0x30c8da[_0x6723('0x32')][_0x6723('0x35')]));_0x21ec56[_0x6723('0x34')]=_0x21ec56['attributes'][_0x6723('0x44')]?_0x21ec56[_0x6723('0x34')]:_0x8af452['model'];if(_0x30c8da[_0x6723('0x32')][_0x6723('0x3f')]){_0x21ec56[_0x6723('0x40')]=[{'all':!![]}];}_0x21ec56=_[_0x6723('0x3d')]({},_0x21ec56,_0x30c8da[_0x6723('0x3e')]);return db[_0x6723('0x2e')][_0x6723('0x45')](_0x21ec56)[_0x6723('0x25')](handleEntityNotFound(_0x553572,null))['then'](respondWithResult(_0x553572,null))[_0x6723('0x42')](handleError(_0x553572,null));};exports[_0x6723('0x46')]=function(_0x3c91ca,_0x217699){return db['CmCompany'][_0x6723('0x46')](_0x3c91ca['body'],{})[_0x6723('0x25')](function(_0x4f6650){var _0x80843f=_0x3c91ca['user']['get']({'plain':!![]});if(!_0x80843f)throw new Error(_0x6723('0x47'));if(_0x80843f[_0x6723('0x48')]===_0x6723('0x49')){var _0x418967=_0x4f6650['get']({'plain':!![]});var _0x525d7c='Companies';return db[_0x6723('0x4a')][_0x6723('0x45')]({'where':{'name':_0x525d7c,'userProfileId':_0x80843f[_0x6723('0x4b')]},'raw':!![]})[_0x6723('0x25')](function(_0x1528fb){if(_0x1528fb&&_0x1528fb[_0x6723('0x4c')]===0x0){return db[_0x6723('0x29')]['create']({'name':_0x418967[_0x6723('0x2b')],'resourceId':_0x418967['id'],'type':_0x1528fb[_0x6723('0x2b')],'sectionId':_0x1528fb['id']},{})[_0x6723('0x25')](function(){return _0x4f6650;});}else{return _0x4f6650;}})[_0x6723('0x42')](function(_0x16f3a2){logger[_0x6723('0x4d')](_0x6723('0x4e'),_0x16f3a2);throw _0x16f3a2;});}return _0x4f6650;})[_0x6723('0x25')](respondWithResult(_0x217699,0xc9))[_0x6723('0x42')](handleError(_0x217699,null));};exports[_0x6723('0x24')]=function(_0x273d27,_0x3484b7){if(_0x273d27['body']['id']){delete _0x273d27[_0x6723('0x4f')]['id'];}return db[_0x6723('0x2e')][_0x6723('0x45')]({'where':{'id':_0x273d27[_0x6723('0x50')]['id']}})[_0x6723('0x25')](handleEntityNotFound(_0x3484b7,null))[_0x6723('0x25')](saveUpdates(_0x273d27[_0x6723('0x4f')],null))[_0x6723('0x25')](respondWithResult(_0x3484b7,null))[_0x6723('0x42')](handleError(_0x3484b7,null));};exports['destroy']=function(_0x3fc8ed,_0x3bebb1){return db['CmCompany'][_0x6723('0x45')]({'where':{'id':_0x3fc8ed[_0x6723('0x50')]['id']}})[_0x6723('0x25')](handleEntityNotFound(_0x3bebb1,null))[_0x6723('0x25')](removeEntity(_0x3bebb1,null))['catch'](handleError(_0x3bebb1,null));};exports[_0x6723('0x2f')]=function(_0xfe7ab6,_0x4e579e){return db[_0x6723('0x2e')][_0x6723('0x2f')]()[_0x6723('0x25')](respondWithResult(_0x4e579e,null))[_0x6723('0x42')](handleError(_0x4e579e,null));};exports[_0x6723('0x51')]=function(_0x4ab6b8,_0x5aeff5,_0x580905){return db['CmContact'][_0x6723('0x45')]({'where':{'id':_0x4ab6b8['params']['id']}})[_0x6723('0x25')](handleEntityNotFound(_0x5aeff5,null))['then'](function(_0x59b8d1){if(_0x59b8d1){return _0x59b8d1[_0x6723('0x51')](_0x4ab6b8[_0x6723('0x4f')]['ids'],_[_0x6723('0x52')](_0x4ab6b8[_0x6723('0x4f')],['ids','id'])||{});}})[_0x6723('0x25')](respondWithResult(_0x5aeff5,null))[_0x6723('0x42')](handleError(_0x5aeff5,null));};exports[_0x6723('0x53')]=function(_0x2e4344,_0x28063a,_0xa315c8){var _0x352a73={};var _0x5e1150={};var _0x12e440;var _0x492d7c;return db[_0x6723('0x2e')][_0x6723('0x54')]({'where':{'id':_0x2e4344[_0x6723('0x50')]['id']}})['then'](handleEntityNotFound(_0x28063a,null))[_0x6723('0x25')](function(_0x2f8787){if(_0x2f8787){_0x12e440=_0x2f8787;_0x5e1150[_0x6723('0x30')]=_[_0x6723('0x31')](db[_0x6723('0x55')][_0x6723('0x56')]);_0x5e1150[_0x6723('0x32')]=_[_0x6723('0x31')](_0x2e4344[_0x6723('0x32')]);_0x5e1150[_0x6723('0x3b')]=_[_0x6723('0x33')](_0x5e1150[_0x6723('0x30')],_0x5e1150[_0x6723('0x32')]);_0x352a73['attributes']=_[_0x6723('0x33')](_0x5e1150['model'],qs[_0x6723('0x35')](_0x2e4344['query'][_0x6723('0x35')]));_0x352a73[_0x6723('0x34')]=_0x352a73['attributes']['length']?_0x352a73[_0x6723('0x34')]:_0x5e1150[_0x6723('0x30')];_0x352a73['order']=qs['sort'](_0x2e4344[_0x6723('0x32')][_0x6723('0x38')]);_0x352a73[_0x6723('0x39')]=qs[_0x6723('0x3b')](_[_0x6723('0x3a')](_0x2e4344['query'],_0x5e1150['filters']));if(_0x2e4344['query'][_0x6723('0x3c')]){_0x352a73[_0x6723('0x39')]=_[_0x6723('0x3d')](_0x352a73[_0x6723('0x39')],{'$or':_[_0x6723('0x57')](_0x352a73[_0x6723('0x34')],function(_0x44dd2f){var _0x18a3a7={};_0x18a3a7[_0x44dd2f]={'$like':'%'+_0x2e4344['query'][_0x6723('0x3c')]+'%'};return _0x18a3a7;})});}_0x352a73=_['merge']({},_0x352a73,_0x2e4344[_0x6723('0x3e')]);return _0x12e440[_0x6723('0x53')](_0x352a73);}})['then'](function(_0x52eaae){if(_0x52eaae){_0x492d7c=_0x52eaae[_0x6723('0x44')];if(!_0x2e4344[_0x6723('0x32')][_0x6723('0x36')](_0x6723('0x58'))){_0x352a73[_0x6723('0x20')]=qs[_0x6723('0x20')](_0x2e4344[_0x6723('0x32')][_0x6723('0x20')]);_0x352a73[_0x6723('0x1f')]=qs[_0x6723('0x1f')](_0x2e4344[_0x6723('0x32')][_0x6723('0x1f')]);}return _0x12e440[_0x6723('0x53')](_0x352a73);}})['then'](function(_0x3b22ea){if(_0x3b22ea){return _0x3b22ea?{'count':_0x492d7c,'rows':_0x3b22ea}:null;}})[_0x6723('0x25')](respondWithResult(_0x28063a,null))['catch'](handleError(_0x28063a,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ab05b5e..c029944 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 _0xb577=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0xcb67f,_0x512990){var _0x1884d2=function(_0x42a682){while(--_0x42a682){_0xcb67f['push'](_0xcb67f['shift']());}};_0x1884d2(++_0x512990);}(_0xb577,0x1dd));var _0x7b57=function(_0x512178,_0x109489){_0x512178=_0x512178-0x0;var _0xae37b5=_0xb577[_0x512178];return _0xae37b5;};'use strict';var _=require(_0x7b57('0x0'));var util=require(_0x7b57('0x1'));var logger=require(_0x7b57('0x2'))(_0x7b57('0x3'));var moment=require(_0x7b57('0x4'));var BPromise=require(_0x7b57('0x5'));var rp=require(_0x7b57('0x6'));var fs=require('fs');var path=require(_0x7b57('0x7'));var rimraf=require(_0x7b57('0x8'));var config=require(_0x7b57('0x9'));var attributes=require(_0x7b57('0xa'));module[_0x7b57('0xb')]=function(_0x557531,_0x1cd83c){return _0x557531[_0x7b57('0xc')](_0x7b57('0xd'),attributes,{'tableName':_0x7b57('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a50=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany'];(function(_0x43f929,_0x131e0b){var _0x3dc6c4=function(_0x4bd9c2){while(--_0x4bd9c2){_0x43f929['push'](_0x43f929['shift']());}};_0x3dc6c4(++_0x131e0b);}(_0x8a50,0x9c));var _0x08a5=function(_0x33662d,_0x1eb6c2){_0x33662d=_0x33662d-0x0;var _0x31384e=_0x8a50[_0x33662d];return _0x31384e;};'use strict';var _=require(_0x08a5('0x0'));var util=require(_0x08a5('0x1'));var logger=require(_0x08a5('0x2'))(_0x08a5('0x3'));var moment=require(_0x08a5('0x4'));var BPromise=require(_0x08a5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08a5('0x6'));var rimraf=require(_0x08a5('0x7'));var config=require(_0x08a5('0x8'));var attributes=require(_0x08a5('0x9'));module['exports']=function(_0x5696e3,_0x1afdcc){return _0x5696e3[_0x08a5('0xa')](_0x08a5('0xb'),attributes,{'tableName':'cm_companies','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 0ba4d1a..95e8cb8 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 _0x1199=['code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x1199,0x129));var _0x9119=function(_0x55841f,_0x487812){_0x55841f=_0x55841f-0x0;var _0x4c5ccf=_0x1199[_0x55841f];return _0x4c5ccf;};'use strict';var _=require(_0x9119('0x0'));var util=require('util');var moment=require(_0x9119('0x1'));var BPromise=require('bluebird');var rs=require(_0x9119('0x2'));var fs=require('fs');var Redis=require(_0x9119('0x3'));var db=require(_0x9119('0x4'))['db'];var utils=require(_0x9119('0x5'));var logger=require('../../config/logger')(_0x9119('0x6'));var config=require(_0x9119('0x7'));var jayson=require(_0x9119('0x8'));var client=jayson[_0x9119('0x9')][_0x9119('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x364b66,_0x3ac1ae,_0x314b6e){return new BPromise(function(_0x23dec1,_0x5e2cf0){return client[_0x9119('0xb')](_0x364b66,_0x314b6e)[_0x9119('0xc')](function(_0x44272f){logger[_0x9119('0xd')](_0x9119('0xe'),_0x3ac1ae,'request\x20sent');logger['debug'](_0x9119('0xf'),_0x3ac1ae,_0x9119('0x10'),JSON['stringify'](_0x44272f));if(_0x44272f['error']){if(_0x44272f[_0x9119('0x11')][_0x9119('0x12')]===0x1f4){logger[_0x9119('0x11')]('CmCompany,\x20%s,\x20%s',_0x3ac1ae,_0x44272f[_0x9119('0x11')][_0x9119('0x13')]);return _0x5e2cf0(_0x44272f[_0x9119('0x11')]['message']);}logger[_0x9119('0x11')]('CmCompany,\x20%s,\x20%s',_0x3ac1ae,_0x44272f[_0x9119('0x11')][_0x9119('0x13')]);return _0x23dec1(_0x44272f['error'][_0x9119('0x13')]);}else{logger[_0x9119('0xd')](_0x9119('0xe'),_0x3ac1ae,'request\x20sent');_0x23dec1(_0x44272f['result'][_0x9119('0x13')]);}})[_0x9119('0x14')](function(_0x2e0990){logger[_0x9119('0x11')](_0x9119('0xe'),_0x3ac1ae,_0x2e0990);_0x5e2cf0(_0x2e0990);});});} \ No newline at end of file +var _0x49be=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x2e4574,_0x2041a8){var _0x2cd207=function(_0x2b6ec8){while(--_0x2b6ec8){_0x2e4574['push'](_0x2e4574['shift']());}};_0x2cd207(++_0x2041a8);}(_0x49be,0x1f1));var _0xe49b=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x49be[_0x221b8c];return _0x3fab9f;};'use strict';var _=require(_0xe49b('0x0'));var util=require('util');var moment=require(_0xe49b('0x1'));var BPromise=require(_0xe49b('0x2'));var rs=require(_0xe49b('0x3'));var fs=require('fs');var Redis=require(_0xe49b('0x4'));var db=require(_0xe49b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe49b('0x6'));var config=require(_0xe49b('0x7'));var jayson=require(_0xe49b('0x8'));var client=jayson['client'][_0xe49b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4511a1,_0x34c15b,_0x267138){return new BPromise(function(_0x292bb3,_0x21cb56){return client[_0xe49b('0xa')](_0x4511a1,_0x267138)[_0xe49b('0xb')](function(_0x427eb5){logger[_0xe49b('0xc')](_0xe49b('0xd'),_0x34c15b,_0xe49b('0xe'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x34c15b,'request\x20sent',JSON['stringify'](_0x427eb5));if(_0x427eb5[_0xe49b('0xf')]){if(_0x427eb5[_0xe49b('0xf')][_0xe49b('0x10')]===0x1f4){logger[_0xe49b('0xf')](_0xe49b('0xd'),_0x34c15b,_0x427eb5[_0xe49b('0xf')]['message']);return _0x21cb56(_0x427eb5['error'][_0xe49b('0x11')]);}logger['error'](_0xe49b('0xd'),_0x34c15b,_0x427eb5['error']['message']);return _0x292bb3(_0x427eb5['error'][_0xe49b('0x11')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x34c15b,_0xe49b('0xe'));_0x292bb3(_0x427eb5[_0xe49b('0x12')][_0xe49b('0x11')]);}})[_0xe49b('0x13')](function(_0x42dcc5){logger[_0xe49b('0xf')](_0xe49b('0xd'),_0x34c15b,_0x42dcc5);_0x21cb56(_0x42dcc5);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index b7d6a66..9df79dc 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 _0x1059=['/:id','show','/:id/contacts','post','put','update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','isAuthenticated','describe','get'];(function(_0x4d1800,_0x2138d7){var _0x6ac748=function(_0x279259){while(--_0x279259){_0x4d1800['push'](_0x4d1800['shift']());}};_0x6ac748(++_0x2138d7);}(_0x1059,0x1aa));var _0x9105=function(_0x50baeb,_0x26431a){_0x50baeb=_0x50baeb-0x0;var _0x494366=_0x1059[_0x50baeb];return _0x494366;};'use strict';var multer=require(_0x9105('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9105('0x1'));var router=express[_0x9105('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9105('0x3'));var interaction=require(_0x9105('0x4'));var config=require(_0x9105('0x5'));var controller=require(_0x9105('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9105('0x7')]);router['get']('/describe',auth[_0x9105('0x8')](),controller[_0x9105('0x9')]);router[_0x9105('0xa')](_0x9105('0xb'),auth[_0x9105('0x8')](),controller[_0x9105('0xc')]);router[_0x9105('0xa')](_0x9105('0xd'),auth[_0x9105('0x8')](),controller['getContacts']);router[_0x9105('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9105('0xe')](_0x9105('0xd'),auth[_0x9105('0x8')](),controller['addContacts']);router[_0x9105('0xf')](_0x9105('0xb'),auth['isAuthenticated'](),controller[_0x9105('0x10')]);router[_0x9105('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9105('0x12')]=router; \ No newline at end of file +var _0x9146=['create','addContacts','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x9146,0x16d));var _0x6914=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0x9146[_0x10852d];return _0x13a8d6;};'use strict';var multer=require(_0x6914('0x0'));var util=require(_0x6914('0x1'));var path=require(_0x6914('0x2'));var timeout=require('connect-timeout');var express=require(_0x6914('0x3'));var router=express[_0x6914('0x4')]();var fs_extra=require(_0x6914('0x5'));var auth=require(_0x6914('0x6'));var interaction=require(_0x6914('0x7'));var config=require(_0x6914('0x8'));var controller=require(_0x6914('0x9'));router[_0x6914('0xa')]('/',auth[_0x6914('0xb')](),controller[_0x6914('0xc')]);router[_0x6914('0xa')](_0x6914('0xd'),auth[_0x6914('0xb')](),controller[_0x6914('0xe')]);router[_0x6914('0xa')](_0x6914('0xf'),auth[_0x6914('0xb')](),controller[_0x6914('0x10')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x6914('0x11')]);router[_0x6914('0x12')]('/',auth[_0x6914('0xb')](),controller[_0x6914('0x13')]);router[_0x6914('0x12')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x6914('0x14')]);router['put'](_0x6914('0xf'),auth[_0x6914('0xb')](),controller[_0x6914('0x15')]);router[_0x6914('0x16')](_0x6914('0xf'),auth[_0x6914('0xb')](),controller['destroy']);module[_0x6914('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 685d9fc..9f7a0fa 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 _0x4293=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x23f7f0,_0x1548a0){var _0x445c99=function(_0x339f94){while(--_0x339f94){_0x23f7f0['push'](_0x23f7f0['shift']());}};_0x445c99(++_0x1548a0);}(_0x4293,0x11a));var _0x3429=function(_0x407135,_0x2c22d4){_0x407135=_0x407135-0x0;var _0x17c45b=_0x4293[_0x407135];return _0x17c45b;};'use strict';var _=require(_0x3429('0x0'));var Sequelize=require(_0x3429('0x1'));module[_0x3429('0x2')]={'firstName':{'type':Sequelize[_0x3429('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3429('0x3')]},'street':{'type':Sequelize[_0x3429('0x3')]},'postalCode':{'type':Sequelize[_0x3429('0x3')]},'city':{'type':Sequelize[_0x3429('0x3')]},'country':{'type':Sequelize[_0x3429('0x3')]},'dateOfBirth':{'type':Sequelize[_0x3429('0x3')]},'description':{'type':Sequelize[_0x3429('0x4')]},'phone':{'type':Sequelize[_0x3429('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x3429('0x3')]},'email':{'type':Sequelize[_0x3429('0x3')]},'url':{'type':Sequelize[_0x3429('0x3')]},'facebook':{'type':Sequelize[_0x3429('0x3')]},'fb_data':{'type':Sequelize[_0x3429('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x3429('0x3')]},'teams':{'type':Sequelize[_0x3429('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x3429('0x3')]},'wechat':{'type':Sequelize[_0x3429('0x3')]},'telegram':{'type':Sequelize[_0x3429('0x3')]},'UserId':{'type':Sequelize[_0x3429('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x3429('0x3')]},'priority':{'type':Sequelize[_0x3429('0x5')](0x2)[_0x3429('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3429('0x7')],'defaultValue':Sequelize[_0x3429('0x8')]},'dialTimezone':{'type':Sequelize[_0x3429('0x3')]},'utcOffset':{'type':Sequelize[_0x3429('0x5')]}}; \ No newline at end of file +var _0x1548=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','sequelize'];(function(_0x5aba01,_0x11a9ed){var _0x1b6c10=function(_0x3089f2){while(--_0x3089f2){_0x5aba01['push'](_0x5aba01['shift']());}};_0x1b6c10(++_0x11a9ed);}(_0x1548,0x1a7));var _0x8154=function(_0x4b2c34,_0x1f7c35){_0x4b2c34=_0x4b2c34-0x0;var _0x5a25b6=_0x1548[_0x4b2c34];return _0x5a25b6;};'use strict';var _=require('lodash');var Sequelize=require(_0x8154('0x0'));module[_0x8154('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8154('0x2')]},'postalCode':{'type':Sequelize[_0x8154('0x2')]},'city':{'type':Sequelize[_0x8154('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x8154('0x2')]},'description':{'type':Sequelize[_0x8154('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x8154('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8154('0x2')]},'url':{'type':Sequelize[_0x8154('0x2')]},'facebook':{'type':Sequelize[_0x8154('0x2')]},'fb_data':{'type':Sequelize[_0x8154('0x2')]},'twitter':{'type':Sequelize[_0x8154('0x2')]},'skype':{'type':Sequelize[_0x8154('0x2')]},'teams':{'type':Sequelize[_0x8154('0x2')]},'viber':{'type':Sequelize[_0x8154('0x2')]},'line':{'type':Sequelize[_0x8154('0x2')]},'wechat':{'type':Sequelize[_0x8154('0x2')]},'telegram':{'type':Sequelize[_0x8154('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8154('0x4')](0x2)[_0x8154('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8154('0x6')],'defaultValue':Sequelize[_0x8154('0x7')]},'dialTimezone':{'type':Sequelize[_0x8154('0x2')]},'utcOffset':{'type':Sequelize[_0x8154('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 71d0cc4..9678898 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 _0x6b1e=['having','t.id\x20IN\x20?','resolve','role','agent','some','user','getLists','c.ListId\x20IS\x20NULL','map','ListId','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','find','params','tags','columnName','displayName','analytics','CmCustomField','findAll','custom','body','get','mergeWith','isArray','info','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','$or','findOrCreate','contact','Tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','format','cf_%d','omit','pickBy','table','values','phone','CmHopper','getTags','findOne','rawAttributes','options','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','CmHopperAdditionalPhone','item','OrderBy','PHONE','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','intersection','includeAll','rows','getHopperHistories','ContactId','include','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','join','root','server/files/tmp','filename','chmodSync','0777','fork','File\x20uploaded\x20correctly!','upload','file','parse','meta','import','User','binding','child_process','../../components/import/cm/csv2','stringify','message','pid','exit','importUpdates','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','mail','openchannel','fax','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','destination','starttime','endtime','userDisposition','userSecondDisposition','userThirdDisposition','fullname','alias','createdAt','VoiceCallReport','findAndCountAll','startCase','chat','Website','Account','closedAt','note','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','threadId','sortBy','util','path','lodash','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/environment/shared','defaults','redis','localhost','./cmContact.socket','register','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','end','sendStatus','error','name','send','CmContact','describe','keys','length','startsWith','cf_','all','fieldType','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','pick','field','color','from','select','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','where','search','parseSearch','sqlOperator','conditions','value','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','text','filter','Contact','push','isEmpty','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','order','forEach','DESC'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x6b1e,0xc6));var _0xe6b1=function(_0x497f4a,_0x92ae85){_0x497f4a=_0x497f4a-0x0;var _0x194c59=_0x6b1e[_0x497f4a];return _0x194c59;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe6b1('0x0'));var path=require(_0xe6b1('0x1'));var fs=require('fs');var _=require(_0xe6b1('0x2'));var squel=require(_0xe6b1('0x3'));var Papa=require(_0xe6b1('0x4'));var Redis=require('ioredis');var qs=require(_0xe6b1('0x5'));var as=require(_0xe6b1('0x6'));var logger=require(_0xe6b1('0x7'))('api');var config=require(_0xe6b1('0x8'));var shared=require(_0xe6b1('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe6b1('0xa')](config[_0xe6b1('0xb')],{'host':_0xe6b1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe6b1('0xd'))[_0xe6b1('0xe')](socket);function respondWithResult(_0x40533d,_0x4a27d0){_0x4a27d0=_0x4a27d0||0xc8;return function(_0x9ae990){if(_0x9ae990){return _0x40533d[_0xe6b1('0xf')](_0x4a27d0)[_0xe6b1('0x10')](_0x9ae990);}};}function respondWithFilteredResult(_0x1522f2,_0x212335){return function(_0x3083a1){if(_0x3083a1){var _0x5ca68a=typeof _0x212335[_0xe6b1('0x11')]===_0xe6b1('0x12')&&typeof _0x212335[_0xe6b1('0x13')]===_0xe6b1('0x12');var _0x2c6211=_0x3083a1[_0xe6b1('0x14')];var _0x1acbf8=_0x5ca68a?0x0:_0x212335[_0xe6b1('0x11')];var _0x2c92a0=_0x5ca68a?_0x3083a1[_0xe6b1('0x14')]:_0x212335['offset']+_0x212335[_0xe6b1('0x13')];var _0x36161e;if(_0x2c92a0>=_0x2c6211){_0x2c92a0=_0x2c6211;_0x36161e=0xc8;}else{_0x36161e=0xce;}_0x1522f2[_0xe6b1('0xf')](_0x36161e);return _0x1522f2['set'](_0xe6b1('0x15'),_0x1acbf8+'-'+_0x2c92a0+'/'+_0x2c6211)[_0xe6b1('0x10')](_0x3083a1);}return null;};}function saveUpdates(_0x3d1a31){return function(_0x4e1817){if(_0x4e1817){return _0x4e1817[_0xe6b1('0x16')](_0x3d1a31)['then'](function(_0x4f05ca){return _0x4f05ca;});}return null;};}function removeEntity(_0x46c419){return function(_0x3a1f33){if(_0x3a1f33){return _0x3a1f33[_0xe6b1('0x17')]()[_0xe6b1('0x18')](function(){_0x46c419[_0xe6b1('0xf')](0xcc)[_0xe6b1('0x19')]();});}};}function handleEntityNotFound(_0x2f9f66){return function(_0x3bcde5){if(!_0x3bcde5){_0x2f9f66[_0xe6b1('0x1a')](0x194);}return _0x3bcde5;};}function handleError(_0x327d36,_0x2a4ab4){_0x2a4ab4=_0x2a4ab4||0x1f4;return function(_0x43dd10){logger[_0xe6b1('0x1b')](_0x43dd10['stack']);if(_0x43dd10[_0xe6b1('0x1c')]){delete _0x43dd10[_0xe6b1('0x1c')];}_0x327d36['status'](_0x2a4ab4)[_0xe6b1('0x1d')](_0x43dd10);};}exports['index']=function(_0x2b7920,_0x53aaeb){var _0x47c5c7={},_0x5c0f96={},_0x322026={'count':0x0,'rows':[]};return db[_0xe6b1('0x1e')][_0xe6b1('0x1f')]()[_0xe6b1('0x18')](function(_0x1d43f2){var _0x3f9d6d=[];for(var _0x365341=0x0;_0x3653410x1){_0x30d5f9['or'](_0xe6b1('0x54'),qs[_0xe6b1('0x55')](_0x41c92e),null);}else{if(qs[_0xe6b1('0x56')](_0x41c92e)){_0x30d5f9['or']('c.id\x20LIKE\x20?',_0x41c92e+'%');_0x30d5f9['or']('c.phone\x20LIKE\x20?',_0x41c92e+'%');_0x30d5f9['or'](_0xe6b1('0x57'),_0x41c92e+'%');_0x30d5f9['or']('c.fax\x20LIKE\x20?',_0x41c92e+'%');}else if(qs[_0xe6b1('0x58')](_0x41c92e)){_0x30d5f9['or']('c.email\x20LIKE\x20?',_0x41c92e+'%');}else{_0x30d5f9['or'](_0xe6b1('0x59'),'%'+_0x41c92e+'%');_0x30d5f9['or'](_0xe6b1('0x5a'),'%'+_0x41c92e+'%');_0x30d5f9['or'](_0xe6b1('0x5b'),'%'+_0x41c92e+'%');}}}}_0x1c58d2['where'](_0x30d5f9);_0x1c58d2['group'](_0xe6b1('0x5c'));var _0x4d5082={'type':db[_0xe6b1('0x5d')][_0xe6b1('0x5e')][_0xe6b1('0x5f')],'raw':!![]};var _0x478944=_0x1c58d2['clone']()['field'](_0xe6b1('0x5c'));if(_0x47c5c7['order']){_0x47c5c7[_0xe6b1('0x60')][_0xe6b1('0x61')](function(_0x2e7076){_0x1c58d2[_0xe6b1('0x60')]('c.'+_0x2e7076[0x0],_0x2e7076[0x1]===_0xe6b1('0x62')?![]:!![]);});}if(!_[_0xe6b1('0x4d')](_0x148e85)){_0x1c58d2[_0xe6b1('0x63')](_0x29f12a);_0x478944[_0xe6b1('0x3b')](_0xe6b1('0x64'),_0x148e85);}BPromise[_0xe6b1('0x65')]()[_0xe6b1('0x18')](function(){if(!_0x5cefb7)return;if(_0x2b7920['user'][_0xe6b1('0x66')]!==_0xe6b1('0x67'))return;if(!_[_0xe6b1('0x68')](_0x5cefb7[_0xe6b1('0x3f')],['field','User'])){return _0x2b7920[_0xe6b1('0x69')][_0xe6b1('0x6a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x35e31c){if(_[_0xe6b1('0x4d')](_0x35e31c)){_0x478944['where'](_0xe6b1('0x6b'));_0x1c58d2[_0xe6b1('0x3b')](_0xe6b1('0x6b'));}else{_0x478944[_0xe6b1('0x3b')](_0xe6b1('0x4e'),_[_0xe6b1('0x6c')](_0x35e31c,'id'));_0x1c58d2[_0xe6b1('0x3b')]('c.ListId\x20IN\x20?',_[_0xe6b1('0x6c')](_0x35e31c,'id'));}});}})[_0xe6b1('0x18')](function(){if(_0x2b7920[_0xe6b1('0x69')][_0xe6b1('0x66')]===_0xe6b1('0x67')&&!_0x5cefb7&&!_0x2b7920[_0xe6b1('0x28')][_0xe6b1('0x6d')])return[];return db[_0xe6b1('0x6e')][_0xe6b1('0x28')](_0x478944[_0xe6b1('0x6f')](),_0x4d5082);})['then'](function(_0x20334e){_0x322026[_0xe6b1('0x14')]=_0x20334e[_0xe6b1('0x21')];if(_0x322026[_0xe6b1('0x14')]===0x0)return[];return db[_0xe6b1('0x6e')][_0xe6b1('0x28')](_0x2e23ab['toString'](),_0x4d5082)[_0xe6b1('0x18')](function(_0xe7a5c8){_0x154df0=_[_0xe6b1('0x70')](_0xe7a5c8,'id');_0x4d5082=_[_0xe6b1('0x71')](_0x4d5082,{'model':db[_0xe6b1('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b7920[_0xe6b1('0x28')][_0xe6b1('0x2b')]){_0x47c5c7[_0xe6b1('0x2a')][_0xe6b1('0x61')](function(_0xe62bc6){_0x1c58d2[_0xe6b1('0x30')]('c.'+_0xe62bc6);});}else{_0x1c58d2[_0xe6b1('0x30')](_0xe6b1('0x5c'));_0x1c58d2[_0xe6b1('0x30')](_0xe6b1('0x72'));_0x1c58d2['field'](_0xe6b1('0x73'));_0x1c58d2[_0xe6b1('0x30')](_0xe6b1('0x74'));_0x1c58d2[_0xe6b1('0x30')](_0xe6b1('0x75'));_0x1c58d2['field']('c.fax');_0x1c58d2[_0xe6b1('0x30')]('c.email');_0x1c58d2[_0xe6b1('0x30')](_0xe6b1('0x76'));_0x1c58d2[_0xe6b1('0x30')](_0xe6b1('0x77'));_0x1c58d2[_0xe6b1('0x30')](_0xe6b1('0x78'));_0x1c58d2['field'](_0xe6b1('0x79'));_0x1c58d2[_0xe6b1('0x30')](_0xe6b1('0x7a'),'TagIds');}if(_0x47c5c7['limit'])_0x1c58d2[_0xe6b1('0x13')](_0x47c5c7[_0xe6b1('0x13')]);if(_0x47c5c7[_0xe6b1('0x11')])_0x1c58d2[_0xe6b1('0x11')](_0x47c5c7[_0xe6b1('0x11')]);return db[_0xe6b1('0x6e')]['query'](_0x1c58d2[_0xe6b1('0x6f')](),_0x4d5082);});})[_0xe6b1('0x18')](function(_0x2ec84c){_0x2ec84c[_0xe6b1('0x61')](function(_0x2d5271){if(_0x2d5271[_0xe6b1('0x7b')]){_0x2d5271[_0xe6b1('0x7c')]=[];_0x2d5271[_0xe6b1('0x7b')][_0xe6b1('0x41')](',')[_0xe6b1('0x61')](function(_0x5b6f59){_0x2d5271[_0xe6b1('0x7c')][_0xe6b1('0x4c')](_0x154df0[_0x5b6f59]);});}delete _0x2d5271['TagIds'];});_0x322026['rows']=_0x2ec84c;return _0x322026;})[_0xe6b1('0x18')](respondWithFilteredResult(_0x53aaeb,_0x47c5c7));})[_0xe6b1('0x7d')](handleError(_0x53aaeb,null));};exports['destroy']=function(_0x13aa6c,_0xcd72a4){return db[_0xe6b1('0x1e')][_0xe6b1('0x7e')]({'where':{'id':_0x13aa6c[_0xe6b1('0x7f')]['id']}})[_0xe6b1('0x18')](handleEntityNotFound(_0xcd72a4,null))['then'](removeEntity(_0xcd72a4,null))[_0xe6b1('0x7d')](handleError(_0xcd72a4,null));};exports['describe']=function(_0xc7a573,_0x2fbf94){return db[_0xe6b1('0x1e')][_0xe6b1('0x1f')]()[_0xe6b1('0x18')](function(_0x3a5662){delete _0x3a5662[_0xe6b1('0x80')];for(var _0x17d488=0x0;_0x17d4880x0){return new Promise(function(_0x4e9a36,_0x4b2fcb){var _0x5c3308=[];for(var _0x3f11d6=0x0;_0x3f11d6<_0x53d627['length'];_0x3f11d6++){_0x5c3308[_0xe6b1('0x4c')](insertAdditionalPhones(_0x53d627[_0x3f11d6][_0xe6b1('0xa9')],_0x53d627[_0x3f11d6]['additionalPhones']));}Promise[_0xe6b1('0x24')](_0x5c3308)[_0xe6b1('0x18')](function(){_0x4e9a36(0x1);});})[_0xe6b1('0x18')](function(){return{'success':_0x3b4fe4,'failure':_0x3b1105,'duplicates':_0x39f840};});}else{return{'success':_0x3b4fe4,'failure':_0x3b1105,'duplicates':_0x39f840};}}})[_0xe6b1('0x18')](respondWithResult(_0x35cb94,0xc9))[_0xe6b1('0x7d')](handleError(_0x35cb94,null));};exports['show']=function(_0x62562f,_0x30ac47){var _0x2a5893;return db[_0xe6b1('0x1e')]['describe']()[_0xe6b1('0x18')](function(_0x51791f){return db[_0xe6b1('0x1e')][_0xe6b1('0x7e')]({'where':{'id':_0x62562f['params']['id']},'include':[{'model':db[_0xe6b1('0xaa')],'as':_0xe6b1('0x7c'),'attributes':['id',_0xe6b1('0x1c'),_0xe6b1('0x31')],'required':_0x62562f['query'][_0xe6b1('0x52')]?!![]:![]},{'model':db[_0xe6b1('0x97')],'as':_0xe6b1('0xab'),'where':{'CmContactId':_0x62562f[_0xe6b1('0x7f')]['id']},'required':![],'include':[{'model':db[_0xe6b1('0xac')],'as':_0xe6b1('0xad')}]}],'order':[db[_0xe6b1('0x6e')][_0xe6b1('0xae')](_0xe6b1('0xaf'))],'attributes':_[_0xe6b1('0x20')](_0x51791f)});})[_0xe6b1('0x18')](function(_0xf0dc5b){if(!_[_0xe6b1('0xa0')](_0xf0dc5b)){_0x2a5893=_0xf0dc5b[_0xe6b1('0x88')]({'plain':!![]});var _0x42c17f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0dc5b&&_0xf0dc5b[_0xe6b1('0x6d')]){if(_0xf0dc5b['ListId']){_0x42c17f[_0xe6b1('0x3b')][_0xe6b1('0xb0')][_0xe6b1('0x4c')]({'ListId':{'$ne':_0xf0dc5b[_0xe6b1('0x6d')]}});}}return db[_0xe6b1('0x84')][_0xe6b1('0x85')](_0x42c17f);}})[_0xe6b1('0x18')](function(_0x174f3b){if(!_[_0xe6b1('0xa0')](_0x174f3b)){return _['omit'](_0x2a5893,_[_0xe6b1('0x6c')](_0x174f3b,function(_0x1eb123){return util[_0xe6b1('0xb1')](_0xe6b1('0xb2'),_0x1eb123['id']);}));}})[_0xe6b1('0x18')](handleEntityNotFound(_0x30ac47,null))[_0xe6b1('0x18')](respondWithResult(_0x30ac47,null))[_0xe6b1('0x7d')](handleError(_0x30ac47,null));};exports[_0xe6b1('0x16')]=function(_0x1a18cd,_0x4d72b1){var _0x107383;if(_0x1a18cd[_0xe6b1('0x87')]['id']){delete _0x1a18cd[_0xe6b1('0x87')]['id'];}if(!_[_0xe6b1('0xa0')](_0x1a18cd[_0xe6b1('0x87')][_0xe6b1('0xa1')])){var _0x415a48=_0x1a18cd[_0xe6b1('0x87')]['dialTimezone'];if(!_[_0xe6b1('0xa0')](shared[_0xe6b1('0xa2')][_0x415a48]))_0x1a18cd[_0xe6b1('0x87')][_0xe6b1('0xa3')]=shared[_0xe6b1('0xa2')][_0x415a48][_0xe6b1('0xa3')];}return db['CmContact']['find']({'where':{'id':_0x1a18cd[_0xe6b1('0x7f')]['id']}})[_0xe6b1('0x18')](handleEntityNotFound(_0x4d72b1,null))[_0xe6b1('0x18')](saveUpdates(_0x1a18cd['body'],null))[_0xe6b1('0x18')](function(_0x21ccc2){_0x107383=_0x21ccc2;var _0x4c4899={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x21ccc2&&_0x21ccc2[_0xe6b1('0x6d')]){if(_0x21ccc2[_0xe6b1('0x6d')]){_0x4c4899['where'][_0xe6b1('0xb0')][_0xe6b1('0x4c')]({'ListId':{'$ne':_0x21ccc2[_0xe6b1('0x6d')]}});}}return db[_0xe6b1('0x84')][_0xe6b1('0x85')](_0x4c4899);})['then'](function(_0x3f7999){if(_0x3f7999){return _[_0xe6b1('0xb3')](_[_0xe6b1('0xb4')](_0x1a18cd[_0xe6b1('0x87')],function(_0x57034d,_0x46b33d){return _[_0xe6b1('0x22')](_0x46b33d,_0xe6b1('0x23'));}),_[_0xe6b1('0x6c')](_0x3f7999,function(_0x3cd94f){return util[_0xe6b1('0xb1')]('cf_%d',_0x3cd94f['id']);}));}})[_0xe6b1('0x18')](function(_0x1ecb26){if(_0x1ecb26&&!_[_0xe6b1('0x4d')](_0x1ecb26)){var _0x5e9d63=squel[_0xe6b1('0x16')]()[_0xe6b1('0xb5')](_0xe6b1('0x34'))['setFields'](_0x1ecb26)[_0xe6b1('0x3b')]('id\x20=\x20?',_0x1a18cd[_0xe6b1('0x7f')]['id'])['toParam']();return db[_0xe6b1('0x6e')][_0xe6b1('0x28')](_0x5e9d63['text'],{'replacements':_0x5e9d63[_0xe6b1('0xb6')]});}})[_0xe6b1('0x18')](function(){if(_0x1a18cd[_0xe6b1('0x87')][_0xe6b1('0xb7')]&&_0x107383){return db[_0xe6b1('0xb8')][_0xe6b1('0x16')]({'phone':_0x1a18cd[_0xe6b1('0x87')][_0xe6b1('0xb7')],'OrderBy':0x0},{'where':{'ContactId':_0x107383['id']}});}})[_0xe6b1('0x18')](function(){return _0x107383;})[_0xe6b1('0x18')](respondWithResult(_0x4d72b1,null))['catch'](handleError(_0x4d72b1,null));};exports[_0xe6b1('0xb9')]=function(_0x442fc4,_0x3ffc3e){var _0x3e8753={};var _0x370da3={};var _0x33e704;var _0x206d66;return db[_0xe6b1('0x1e')][_0xe6b1('0xba')]({'where':{'id':_0x442fc4[_0xe6b1('0x7f')]['id']}})[_0xe6b1('0x18')](handleEntityNotFound(_0x3ffc3e,null))[_0xe6b1('0x18')](function(_0x57099e){if(_0x57099e){_0x33e704=_0x57099e;_0x370da3[_0xe6b1('0x27')]=_['keys'](db[_0xe6b1('0xaa')][_0xe6b1('0xbb')]);_0x370da3[_0xe6b1('0x28')]=_[_0xe6b1('0x20')](_0x442fc4['query']);_0x370da3['filters']=_['intersection'](_0x370da3[_0xe6b1('0x27')],_0x370da3['query']);_0x3e8753[_0xe6b1('0x2a')]=_['intersection'](_0x370da3[_0xe6b1('0x27')],qs[_0xe6b1('0x2b')](_0x442fc4['query'][_0xe6b1('0x2b')]));_0x3e8753[_0xe6b1('0x2a')]=_0x3e8753[_0xe6b1('0x2a')]['length']?_0x3e8753['attributes']:_0x370da3[_0xe6b1('0x27')];_0x3e8753[_0xe6b1('0x60')]=qs[_0xe6b1('0x2e')](_0x442fc4['query'][_0xe6b1('0x2e')]);_0x3e8753['where']=qs[_0xe6b1('0x29')](_['pick'](_0x442fc4[_0xe6b1('0x28')],_0x370da3[_0xe6b1('0x29')]));if(_0x442fc4[_0xe6b1('0x28')]['filter']){_0x3e8753[_0xe6b1('0x3b')]=_[_0xe6b1('0x71')](_0x3e8753[_0xe6b1('0x3b')],{'$or':_[_0xe6b1('0x6c')](_0x3e8753[_0xe6b1('0x2a')],function(_0x531d48){var _0x3623a9={};_0x3623a9[_0x531d48]={'$like':'%'+_0x442fc4['query']['filter']+'%'};return _0x3623a9;})});}_0x3e8753=_[_0xe6b1('0x71')]({},_0x3e8753,_0x442fc4[_0xe6b1('0xbc')]);return _0x33e704[_0xe6b1('0xb9')](_0x3e8753);}})[_0xe6b1('0x18')](function(_0x3d3e76){if(_0x3d3e76){_0x206d66=_0x3d3e76[_0xe6b1('0x21')];if(!_0x442fc4[_0xe6b1('0x28')][_0xe6b1('0x2c')](_0xe6b1('0x2d'))){_0x3e8753[_0xe6b1('0x13')]=qs[_0xe6b1('0x13')](_0x442fc4[_0xe6b1('0x28')][_0xe6b1('0x13')]);_0x3e8753['offset']=qs[_0xe6b1('0x11')](_0x442fc4[_0xe6b1('0x28')]['offset']);}return _0x33e704['getTags'](_0x3e8753);}})['then'](function(_0x2447b8){if(_0x2447b8){return _0x2447b8?{'count':_0x206d66,'rows':_0x2447b8}:null;}})['then'](respondWithResult(_0x3ffc3e,null))[_0xe6b1('0x7d')](handleError(_0x3ffc3e,null));};exports[_0xe6b1('0xbd')]=function(_0x3099df,_0x4a47c2){if(_0x3099df[_0xe6b1('0x87')]['id']){delete _0x3099df[_0xe6b1('0x87')]['id'];}return db['CmContact'][_0xe6b1('0xba')]({'where':{'id':_0x3099df[_0xe6b1('0x7f')]['id']}})[_0xe6b1('0x18')](handleEntityNotFound(_0x4a47c2,null))[_0xe6b1('0x18')](function(_0x423ae3){if(_0x423ae3){return _0x423ae3['setTags'](_0x3099df['body'][_0xe6b1('0xbe')]||[]);}return null;})[_0xe6b1('0x18')](respondWithResult(_0x4a47c2,null))['catch'](handleError(_0x4a47c2,null));};exports[_0xe6b1('0xbf')]=function(_0x5c56ce,_0x295931){var _0x148862=[];_0x148862[_0xe6b1('0x4c')](addAdditionalPhones(_0x5c56ce[_0xe6b1('0x87')]));Promise[_0xe6b1('0x24')](_0x148862)['then'](function(){_0x148862=[];_0x148862[_0xe6b1('0x4c')](deleteCmHopperPhones(_0x5c56ce[_0xe6b1('0x87')]['id']));_0x148862['push'](addCmHopperPhones(_0x5c56ce['body']['id']));Promise[_0xe6b1('0x24')](_0x148862)[_0xe6b1('0x18')](function(){return[0x1];})[_0xe6b1('0x18')](respondWithResult(_0x295931,null));});};function addAdditionalPhones(_0x58c826){var _0xe78e28;return new Promise(function(_0x6c2806,_0x296bfd){return db[_0xe6b1('0x97')]['destroy']({'where':{'CmContactId':_0x58c826['id']}})['then'](function(){db[_0xe6b1('0xac')][_0xe6b1('0x85')]({'raw':!![],'attributes':['id','OrderBy']})['then'](function(_0x1741d6){var _0x471c95=[];for(var _0x24a65=0x0;_0x24a65<_0x58c826[_0xe6b1('0xc0')][_0xe6b1('0x21')];_0x24a65++){var _0x36eea2=_0x58c826[_0xe6b1('0xc1')]?_[_0xe6b1('0xa0')](_0x58c826['item_types'][_0x24a65])?'':_0x58c826[_0xe6b1('0xc1')][_0x24a65]:_0x58c826[_0xe6b1('0xc0')][_0x24a65][_0xe6b1('0xc2')]?_0x58c826['items'][_0x24a65][_0xe6b1('0xc2')]:'';var _0x33e936=_['isNil'](_0x58c826[_0xe6b1('0xc0')][_0x24a65]['description'])?'':_0x58c826[_0xe6b1('0xc0')][_0x24a65][_0xe6b1('0xc3')];var _0x14c2be=_0x36eea2+':'+_0x58c826[_0xe6b1('0xc0')][_0x24a65][_0xe6b1('0xb7')]+'§'+_0x33e936;if(_['isNil'](_0xe78e28))_0xe78e28=_0x14c2be;else _0xe78e28+=';'+_0x14c2be;var _0x4678ff=null;if(_0x58c826[_0xe6b1('0xc1')]){if(!_[_0xe6b1('0xa0')](_0x58c826['item_types'][_0x24a65])){var _0x12d7f4=_[_0xe6b1('0x7e')](_0x1741d6,function(_0x4dbe93){return _0x4dbe93['id']===_0x58c826[_0xe6b1('0xc1')][_0x24a65];});if(!_[_0xe6b1('0xa0')](_0x12d7f4)){_0x4678ff=_0x12d7f4['OrderBy'];}}}else{if(!_[_0xe6b1('0xa0')](_0x58c826['items'][_0x24a65])){var _0x12d7f4=_['find'](_0x1741d6,function(_0x244c19){return _0x244c19['id']===_0x58c826['items'][_0x24a65][_0xe6b1('0xc2')];});if(!_[_0xe6b1('0xa0')](_0x12d7f4)){_0x4678ff=_0x24a65;}}}if(_[_0xe6b1('0xa0')](_0x4678ff)){_0x4678ff=0x64;}_0x471c95[_0xe6b1('0x4c')](addAdditionalPhone(_0x58c826['id'],_0x58c826['items'][_0x24a65][_0xe6b1('0xb7')],_0x58c826[_0xe6b1('0xc1')]?_[_0xe6b1('0xa0')](_0x58c826[_0xe6b1('0xc1')][_0x24a65])?null:_0x58c826[_0xe6b1('0xc1')][_0x24a65]:_0x58c826[_0xe6b1('0xc0')][_0x24a65]['ItemTypeId']?_0x58c826['items'][_0x24a65][_0xe6b1('0xc2')]:null,_0x4678ff,_0x33e936));}Promise[_0xe6b1('0x24')](_0x471c95)[_0xe6b1('0x18')](function(){db[_0xe6b1('0x1e')]['update']({'AdditionalPhones':_0xe78e28},{'where':{'id':_0x58c826['id']}})[_0xe6b1('0x18')](function(){_0x6c2806(0x1);});});});});});}function addAdditionalPhone(_0x39bb70,_0x25295a,_0x439d9c,_0x47a434,_0x5e5880){return db[_0xe6b1('0x97')][_0xe6b1('0x7e')]({'where':{'CmContactId':_0x39bb70,'item':_0x25295a}})[_0xe6b1('0x18')](function(_0x18add5){if(_0x18add5)logger[_0xe6b1('0x8b')]('contact\x20phone\x20exists',_0x18add5);else{db[_0xe6b1('0x97')][_0xe6b1('0x8e')]({'CmContactId':_0x39bb70,'item':_0x25295a,'ItemTypeId':_0x439d9c,'OrderBy':_0x47a434,'ItemClass':'PHONE','description':_0x5e5880});}});}function deletePhones(_0x2e7b25){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x2e7b25}});}function deleteCmHopperPhones(_0x40f429){return new Promise(function(_0x28377f,_0x2f2fd1){return db[_0xe6b1('0xb8')][_0xe6b1('0x85')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x40f429}})[_0xe6b1('0x18')](function(_0xcfb7d3){db[_0xe6b1('0xc4')][_0xe6b1('0x17')]({'where':{'CmHopperId':{'$in':_['map'](_0xcfb7d3,'id')}}});})[_0xe6b1('0x18')](function(){_0x28377f(0x1);});});}function addCmHopperPhones(_0x1069c6){return new Promise(function(_0x4c72d3,_0x5ef28f){return db[_0xe6b1('0xb8')][_0xe6b1('0x85')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1069c6}})['then'](function(_0x4c9ff5){var _0x3636ea=[];_[_0xe6b1('0x6c')](_0x4c9ff5,function(_0x296e28){_0x3636ea[_0xe6b1('0x4c')](createCmHopperPhone(_0x1069c6,_0x296e28['id']));});Promise[_0xe6b1('0x24')](_0x3636ea)[_0xe6b1('0x18')](function(){_0x4c72d3(0x1);});});});}function createCmHopperPhone(_0x4168d0,_0x58e0e7){return new Promise(function(_0x27fa50,_0x2d30be){db['CmContactHasItem']['findAll']({'raw':!![],'attributes':[_0xe6b1('0xc5'),_0xe6b1('0xc6')],'where':{'CmContactId':_0x4168d0,'ItemClass':_0xe6b1('0xc7')},'include':[{'model':db['ContactItemType'],'attributes':[_0xe6b1('0xc6')],'as':_0xe6b1('0xad')}],'order':[_0xe6b1('0xc6'),db['sequelize'][_0xe6b1('0xae')](_0xe6b1('0xc8'))]})['then'](function(_0x1adbb2){var _0x23a6ff=0x1;var _0x1a9d96=_[_0xe6b1('0x6c')](_0x1adbb2,function(_0x7709c1){_0x7709c1['CmHopperId']=_0x58e0e7;_0x7709c1[_0xe6b1('0xb7')]=_0x7709c1['item'];_0x7709c1['OrderBy']=_0x23a6ff;delete _0x7709c1[_0xe6b1('0xc9')];_0x23a6ff=_0x23a6ff+0x1;return _0x7709c1;});return db[_0xe6b1('0xc4')][_0xe6b1('0xa5')](_0x1a9d96,{});})[_0xe6b1('0x18')](function(){_0x27fa50(0x1);});});}function insertAdditionalPhones(_0x28538d,_0x395101){return new Promise(function(_0x16655b,_0x388c8b){var _0x5f537e=[];for(var _0x5e7081=0x0;_0x5e7081<_0x395101[_0xe6b1('0x21')];_0x5e7081++){var _0x5ae7ca=_0x395101[_0x5e7081];_0x5f537e['push'](parseContactItemType(_0x5ae7ca));}Promise[_0xe6b1('0x24')](_0x5f537e)[_0xe6b1('0x18')](function(){var _0x5514a4={'id':_0x28538d['id'],'items':_0x395101};return addAdditionalPhones(_0x5514a4)['then'](function(_0x4c4f2c){return addCmHopperPhones(_0x28538d['id']);});})[_0xe6b1('0x18')](function(){_0x16655b(_0x28538d);});});}function parseContactItemType(_0x689095){return new Promise(function(_0x27c2a9,_0x160906){if(_0x689095['hasOwnProperty'](_0xe6b1('0xc2'))){_0x27c2a9(_0x689095);}else{return db['ContactItemType'][_0xe6b1('0x7e')]({'where':{'name':_0x689095[_0xe6b1('0xad')]}})[_0xe6b1('0x18')](function(_0xcb4089){if(_[_0xe6b1('0xa0')](_0xcb4089))_0x689095['ItemTypeId']=null;else _0x689095[_0xe6b1('0xc2')]=_0xcb4089['id'];_0x27c2a9(_0x689095);});}});}exports[_0xe6b1('0xca')]=function(_0x448e9b,_0x488ddd){return db[_0xe6b1('0x97')][_0xe6b1('0x85')]({'raw':!![],'where':{'CmContactId':_0x448e9b[_0xe6b1('0x7f')]['id'],'ItemClass':_0xe6b1('0xc7')},'include':[{'model':db[_0xe6b1('0xac')],'as':_0xe6b1('0xad')}],'order':[[_0xe6b1('0xc6')],[db[_0xe6b1('0x6e')][_0xe6b1('0xae')](_0xe6b1('0xc8'))]]})[_0xe6b1('0x18')](function(_0x4071dd){return _0x4071dd;})[_0xe6b1('0x18')](respondWithResult(_0x488ddd,null))[_0xe6b1('0x7d')](handleError(_0x488ddd,null));};exports['duplicateAdditionalPhones']=function(_0x441930,_0x377e9a){return db[_0xe6b1('0x97')][_0xe6b1('0x85')]({'raw':!![],'where':{'CmContactId':_0x441930['body'][_0xe6b1('0xcb')]}})['then'](function(_0x2c7356){var _0x1cc0c5=_[_0xe6b1('0x6c')](_0x2c7356,function(_0x49644b){_0x49644b['CmContactId']=_0x441930['body'][_0xe6b1('0xcc')];return _0x49644b;});return db[_0xe6b1('0x97')][_0xe6b1('0xa5')](_0x1cc0c5,{});})[_0xe6b1('0x18')](function(_0x1f8e15){return addCmHopperPhones(_0x441930[_0xe6b1('0x87')][_0xe6b1('0xcc')]);})[_0xe6b1('0x18')](function(_0x12e4d6){return['ok'];})[_0xe6b1('0x18')](respondWithResult(_0x377e9a,null))[_0xe6b1('0x7d')](handleError(_0x377e9a,null));};exports[_0xe6b1('0xcd')]=function(_0x27940d,_0x5cbf5d){var _0x3351ee=[];_0x3351ee[_0xe6b1('0x4c')](createCmHopperPhone(_0x27940d[_0xe6b1('0x87')]['id'],_0x27940d['body']['hopperId']));Promise[_0xe6b1('0x24')](_0x3351ee)[_0xe6b1('0x18')](function(){return[0x1];})[_0xe6b1('0x18')](respondWithResult(_0x5cbf5d,null));};exports['getHoppers']=function(_0x4012dd,_0x306049){var _0x314eae={'raw':![],'where':{}};var _0x3eeef5={};var _0x470e1f={'count':0x0,'rows':[]};return db[_0xe6b1('0x1e')]['findOne']({'where':{'id':_0x4012dd[_0xe6b1('0x7f')]['id']}})['then'](handleEntityNotFound(_0x306049,null))[_0xe6b1('0x18')](function(_0x4d56a4){if(_0x4d56a4){_0x3eeef5[_0xe6b1('0x27')]=_['keys'](db[_0xe6b1('0xb8')][_0xe6b1('0xbb')]);_0x3eeef5['query']=_[_0xe6b1('0x20')](_0x4012dd[_0xe6b1('0x28')]);_0x3eeef5[_0xe6b1('0x29')]=_['intersection'](_0x3eeef5['model'],_0x3eeef5['query']);_0x314eae[_0xe6b1('0x2a')]=_[_0xe6b1('0xce')](_0x3eeef5[_0xe6b1('0x27')],qs[_0xe6b1('0x2b')](_0x4012dd[_0xe6b1('0x28')]['fields']));_0x314eae['attributes']=_0x314eae[_0xe6b1('0x2a')][_0xe6b1('0x21')]?_0x314eae[_0xe6b1('0x2a')]:_0x3eeef5[_0xe6b1('0x27')];if(!_0x4012dd[_0xe6b1('0x28')][_0xe6b1('0x2c')](_0xe6b1('0x2d'))){_0x314eae[_0xe6b1('0x13')]=qs[_0xe6b1('0x13')](_0x4012dd[_0xe6b1('0x28')]['limit']);_0x314eae[_0xe6b1('0x11')]=qs[_0xe6b1('0x11')](_0x4012dd['query'][_0xe6b1('0x11')]);}_0x314eae[_0xe6b1('0x60')]=qs[_0xe6b1('0x2e')](_0x4012dd[_0xe6b1('0x28')][_0xe6b1('0x2e')]);_0x314eae['where']=qs[_0xe6b1('0x29')](_[_0xe6b1('0x2f')](_0x4012dd[_0xe6b1('0x28')],_0x3eeef5[_0xe6b1('0x29')]));_0x314eae['where']['ContactId']=_0x4d56a4['id'];if(_0x4012dd['query']['filter']){_0x314eae['where']=_['merge'](_0x314eae[_0xe6b1('0x3b')],{'$or':_[_0xe6b1('0x6c')](_0x314eae[_0xe6b1('0x2a')],function(_0x29e63e){var _0x1004b4={};_0x1004b4[_0x29e63e]={'$like':'%'+_0x4012dd[_0xe6b1('0x28')][_0xe6b1('0x4a')]+'%'};return _0x1004b4;})});}_0x314eae=_[_0xe6b1('0x71')]({},_0x314eae,_0x4012dd[_0xe6b1('0xbc')]);return db[_0xe6b1('0xb8')]['count']({'where':_0x314eae['where']})[_0xe6b1('0x18')](function(_0x310134){_0x470e1f[_0xe6b1('0x14')]=_0x310134;if(_0x4012dd[_0xe6b1('0x28')][_0xe6b1('0xcf')]){_0x314eae['include']=[{'all':!![]}];}return db[_0xe6b1('0xb8')][_0xe6b1('0x85')](_0x314eae);})['then'](function(_0x2ff4c0){_0x470e1f[_0xe6b1('0xd0')]=_0x2ff4c0;return _0x470e1f;});}})[_0xe6b1('0x18')](respondWithFilteredResult(_0x306049,_0x314eae))[_0xe6b1('0x7d')](handleError(_0x306049,null));};exports[_0xe6b1('0xd1')]=function(_0x4b8041,_0x274a47){var _0x43042b={'raw':!![],'where':{}};var _0x44772d={};var _0x81a756={'count':0x0,'rows':[]};return db['CmContact'][_0xe6b1('0xba')]({'where':{'id':_0x4b8041[_0xe6b1('0x7f')]['id']}})[_0xe6b1('0x18')](handleEntityNotFound(_0x274a47,null))[_0xe6b1('0x18')](function(_0x3c45bf){if(_0x3c45bf){_0x44772d[_0xe6b1('0x27')]=_[_0xe6b1('0x20')](db[_0xe6b1('0x99')][_0xe6b1('0xbb')]);_0x44772d[_0xe6b1('0x28')]=_[_0xe6b1('0x20')](_0x4b8041['query']);_0x44772d[_0xe6b1('0x29')]=_[_0xe6b1('0xce')](_0x44772d[_0xe6b1('0x27')],_0x44772d['query']);_0x43042b[_0xe6b1('0x2a')]=_[_0xe6b1('0xce')](_0x44772d[_0xe6b1('0x27')],qs[_0xe6b1('0x2b')](_0x4b8041[_0xe6b1('0x28')][_0xe6b1('0x2b')]));_0x43042b[_0xe6b1('0x2a')]=_0x43042b['attributes'][_0xe6b1('0x21')]?_0x43042b[_0xe6b1('0x2a')]:_0x44772d[_0xe6b1('0x27')];if(!_0x4b8041[_0xe6b1('0x28')]['hasOwnProperty'](_0xe6b1('0x2d'))){_0x43042b[_0xe6b1('0x13')]=qs[_0xe6b1('0x13')](_0x4b8041[_0xe6b1('0x28')][_0xe6b1('0x13')]);_0x43042b['offset']=qs['offset'](_0x4b8041['query'][_0xe6b1('0x11')]);}_0x43042b['order']=qs[_0xe6b1('0x2e')](_0x4b8041['query'][_0xe6b1('0x2e')]);_0x43042b[_0xe6b1('0x3b')]=qs[_0xe6b1('0x29')](_[_0xe6b1('0x2f')](_0x4b8041[_0xe6b1('0x28')],_0x44772d[_0xe6b1('0x29')]));_0x43042b[_0xe6b1('0x3b')][_0xe6b1('0xd2')]=_0x3c45bf['id'];if(_0x4b8041[_0xe6b1('0x28')]['filter']){_0x43042b[_0xe6b1('0x3b')]=_[_0xe6b1('0x71')](_0x43042b[_0xe6b1('0x3b')],{'$or':_['map'](_0x43042b[_0xe6b1('0x2a')],function(_0x46219f){var _0x15110b={};_0x15110b[_0x46219f]={'$like':'%'+_0x4b8041[_0xe6b1('0x28')][_0xe6b1('0x4a')]+'%'};return _0x15110b;})});}_0x43042b=_['merge']({},_0x43042b,_0x4b8041[_0xe6b1('0xbc')]);return db[_0xe6b1('0x99')][_0xe6b1('0x14')]({'where':_0x43042b[_0xe6b1('0x3b')]})['then'](function(_0x48b108){_0x81a756['count']=_0x48b108;if(_0x4b8041['query'][_0xe6b1('0xcf')]){_0x43042b[_0xe6b1('0xd3')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe6b1('0x85')](_0x43042b);})[_0xe6b1('0x18')](function(_0x1b0728){_0x81a756[_0xe6b1('0xd0')]=_0x1b0728;return _0x81a756;});}})[_0xe6b1('0x18')](respondWithFilteredResult(_0x274a47,_0x43042b))[_0xe6b1('0x7d')](handleError(_0x274a47,null));};exports[_0xe6b1('0xd4')]=function(_0x35ac33,_0x449aa4){var _0x4d7633={'raw':!![],'where':{}};var _0x74b73c={};var _0x3c363e={'count':0x0,'rows':[]};return db[_0xe6b1('0x1e')][_0xe6b1('0xba')]({'where':{'id':_0x35ac33['params']['id']}})['then'](handleEntityNotFound(_0x449aa4,null))[_0xe6b1('0x18')](function(_0x540c99){if(_0x540c99){_0x74b73c[_0xe6b1('0x27')]=_[_0xe6b1('0x20')](db[_0xe6b1('0x98')][_0xe6b1('0xbb')]);_0x74b73c['query']=_[_0xe6b1('0x20')](_0x35ac33[_0xe6b1('0x28')]);_0x74b73c[_0xe6b1('0x29')]=_[_0xe6b1('0xce')](_0x74b73c['model'],_0x74b73c[_0xe6b1('0x28')]);_0x4d7633[_0xe6b1('0x2a')]=_[_0xe6b1('0xce')](_0x74b73c[_0xe6b1('0x27')],qs['fields'](_0x35ac33['query']['fields']));_0x4d7633[_0xe6b1('0x2a')]=_0x4d7633[_0xe6b1('0x2a')]['length']?_0x4d7633[_0xe6b1('0x2a')]:_0x74b73c[_0xe6b1('0x27')];if(!_0x35ac33[_0xe6b1('0x28')]['hasOwnProperty'](_0xe6b1('0x2d'))){_0x4d7633[_0xe6b1('0x13')]=qs[_0xe6b1('0x13')](_0x35ac33['query'][_0xe6b1('0x13')]);_0x4d7633['offset']=qs[_0xe6b1('0x11')](_0x35ac33['query'][_0xe6b1('0x11')]);}_0x4d7633[_0xe6b1('0x60')]=qs[_0xe6b1('0x2e')](_0x35ac33[_0xe6b1('0x28')]['sort']);_0x4d7633[_0xe6b1('0x3b')]=qs[_0xe6b1('0x29')](_[_0xe6b1('0x2f')](_0x35ac33['query'],_0x74b73c[_0xe6b1('0x29')]));_0x4d7633[_0xe6b1('0x3b')]['ContactId']=_0x540c99['id'];if(_0x35ac33[_0xe6b1('0x28')][_0xe6b1('0x4a')]){_0x4d7633['where']=_[_0xe6b1('0x71')](_0x4d7633[_0xe6b1('0x3b')],{'$or':_[_0xe6b1('0x6c')](_0x4d7633[_0xe6b1('0x2a')],function(_0x1f76fa){var _0x7171f4={};_0x7171f4[_0x1f76fa]={'$like':'%'+_0x35ac33[_0xe6b1('0x28')][_0xe6b1('0x4a')]+'%'};return _0x7171f4;})});}_0x4d7633=_[_0xe6b1('0x71')]({},_0x4d7633,_0x35ac33['options']);return db['CmHopperFinal'][_0xe6b1('0x14')]({'where':_0x4d7633[_0xe6b1('0x3b')]})[_0xe6b1('0x18')](function(_0x1cb866){_0x3c363e['count']=_0x1cb866;if(_0x35ac33[_0xe6b1('0x28')][_0xe6b1('0xcf')]){_0x4d7633[_0xe6b1('0xd3')]=[{'all':!![]}];}return db[_0xe6b1('0x98')][_0xe6b1('0x85')](_0x4d7633);})[_0xe6b1('0x18')](function(_0x1645fd){_0x3c363e['rows']=_0x1645fd;return _0x3c363e;});}})[_0xe6b1('0x18')](respondWithFilteredResult(_0x449aa4,_0x4d7633))[_0xe6b1('0x7d')](handleError(_0x449aa4,null));};exports[_0xe6b1('0xd5')]=function(_0x9faf27,_0x543cab){var _0x196490={'raw':!![],'where':{}};var _0x2b7588={};var _0x225df3={'count':0x0,'rows':[]};return db[_0xe6b1('0x1e')][_0xe6b1('0xba')]({'where':{'id':_0x9faf27[_0xe6b1('0x7f')]['id']}})['then'](handleEntityNotFound(_0x543cab,null))[_0xe6b1('0x18')](function(_0x5a54cb){if(_0x5a54cb){_0x2b7588[_0xe6b1('0x27')]=_[_0xe6b1('0x20')](db[_0xe6b1('0xd6')][_0xe6b1('0xbb')]);_0x2b7588['query']=_[_0xe6b1('0x20')](_0x9faf27[_0xe6b1('0x28')]);_0x2b7588[_0xe6b1('0x29')]=_[_0xe6b1('0xce')](_0x2b7588['model'],_0x2b7588[_0xe6b1('0x28')]);_0x196490[_0xe6b1('0x2a')]=_[_0xe6b1('0xce')](_0x2b7588[_0xe6b1('0x27')],qs[_0xe6b1('0x2b')](_0x9faf27[_0xe6b1('0x28')][_0xe6b1('0x2b')]));_0x196490['attributes']=_0x196490['attributes'][_0xe6b1('0x21')]?_0x196490[_0xe6b1('0x2a')]:_0x2b7588['model'];if(!_0x9faf27[_0xe6b1('0x28')][_0xe6b1('0x2c')](_0xe6b1('0x2d'))){_0x196490[_0xe6b1('0x13')]=qs['limit'](_0x9faf27[_0xe6b1('0x28')][_0xe6b1('0x13')]);_0x196490[_0xe6b1('0x11')]=qs[_0xe6b1('0x11')](_0x9faf27[_0xe6b1('0x28')][_0xe6b1('0x11')]);}_0x196490[_0xe6b1('0x60')]=qs[_0xe6b1('0x2e')](_0x9faf27[_0xe6b1('0x28')]['sort']);_0x196490[_0xe6b1('0x3b')]=qs['filters'](_[_0xe6b1('0x2f')](_0x9faf27[_0xe6b1('0x28')],_0x2b7588[_0xe6b1('0x29')]));_0x196490[_0xe6b1('0x3b')][_0xe6b1('0xd2')]=_0x5a54cb['id'];if(_0x9faf27[_0xe6b1('0x28')][_0xe6b1('0x4a')]){_0x196490[_0xe6b1('0x3b')]=_['merge'](_0x196490[_0xe6b1('0x3b')],{'$or':_[_0xe6b1('0x6c')](_0x196490[_0xe6b1('0x2a')],function(_0x4f2854){var _0x3dfa41={};_0x3dfa41[_0x4f2854]={'$like':'%'+_0x9faf27[_0xe6b1('0x28')][_0xe6b1('0x4a')]+'%'};return _0x3dfa41;})});}_0x196490=_['merge']({},_0x196490,_0x9faf27['options']);return db['JscriptySessionReport'][_0xe6b1('0x14')]({'where':_0x196490[_0xe6b1('0x3b')]})[_0xe6b1('0x18')](function(_0x435be2){_0x225df3[_0xe6b1('0x14')]=_0x435be2;if(_0x9faf27[_0xe6b1('0x28')]['includeAll']){_0x196490[_0xe6b1('0xd3')]=[{'all':!![]}];}return db[_0xe6b1('0xd6')][_0xe6b1('0x85')](_0x196490);})[_0xe6b1('0x18')](function(_0x4711b6){_0x225df3[_0xe6b1('0xd0')]=_0x4711b6;return _0x225df3;});}})[_0xe6b1('0x18')](respondWithFilteredResult(_0x543cab,_0x196490))[_0xe6b1('0x7d')](handleError(_0x543cab,null));};exports[_0xe6b1('0xd7')]=function(_0x4d778f,_0x9af91f){try{if(!_0x4d778f['body'][_0xe6b1('0x6d')]){throw new Error(_0xe6b1('0xd8'));}if(!_0x4d778f['body']['binding_keys']){throw new Error(_0xe6b1('0xd9'));}if(!_0x4d778f[_0xe6b1('0x87')][_0xe6b1('0xda')]){throw new Error(_0xe6b1('0xdb'));}if(!_0x4d778f['body'][_0xe6b1('0xdc')]){throw new Error(_0xe6b1('0xdd'));}var _0x4eb765=_0x4d778f[_0xe6b1('0x87')][_0xe6b1('0xde')]['split'](',');var _0x1c07ca=_0x4d778f['body'][_0xe6b1('0xda')]['split'](',');if(!_0x4eb765[_0xe6b1('0x21')]||!_0x1c07ca['length']||_0x4eb765[_0xe6b1('0x21')]!==_0x1c07ca[_0xe6b1('0x21')]){throw new Error(_0xe6b1('0xdf'));}_0x4d778f[_0xe6b1('0x87')][_0xe6b1('0x2b')]=_['zipObject'](_0x4eb765,_0x1c07ca);if(!_0x4d778f[_0xe6b1('0x87')][_0xe6b1('0x2b')][_0xe6b1('0xb7')]){throw new Error(_0xe6b1('0xe0'));}if(!_0x4d778f[_0xe6b1('0x87')][_0xe6b1('0x2b')][_0xe6b1('0xe1')]){throw new Error(_0xe6b1('0xe2'));}var _0x30cd93=path[_0xe6b1('0xe3')](config[_0xe6b1('0xe4')],_0xe6b1('0xe5'),_0x4d778f['file'][_0xe6b1('0xe6')]);fs[_0xe6b1('0xe7')](_0x30cd93,parseInt(_0xe6b1('0xe8'),0x8));var _0x66c8bb=require('child_process')[_0xe6b1('0xe9')](path[_0xe6b1('0xe3')](__dirname,'../../components/import/cm/csv'),[_0x30cd93,_0x4d778f['body'][_0xe6b1('0xde')],_0x4d778f[_0xe6b1('0x87')]['binding_values'],_0x4d778f[_0xe6b1('0x87')][_0xe6b1('0x6d')],_0x4d778f[_0xe6b1('0x87')]['CompanyId'],_0x4d778f[_0xe6b1('0x87')][_0xe6b1('0xa6')],_0x4d778f[_0xe6b1('0x87')][_0xe6b1('0xdc')]]);return _0x9af91f[_0xe6b1('0xf')](0xc8)[_0xe6b1('0x10')]({'message':_0xe6b1('0xea'),'pid':_0x66c8bb['pid']});}catch(_0x168c82){return _0x9af91f[_0xe6b1('0xf')](0x1f4)['send'](_0x168c82);}};exports[_0xe6b1('0xeb')]=function(_0x258574,_0x1cd69f){var _0x515001=fs['createReadStream'](_0x258574[_0xe6b1('0xec')][_0xe6b1('0x1')]);Papa[_0xe6b1('0xed')](_0x515001,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3ccd8e){return _0x1cd69f[_0xe6b1('0xf')](0xc8)[_0xe6b1('0x10')]({'file':_0x258574[_0xe6b1('0xec')],'fields':_0x3ccd8e[_0xe6b1('0xee')]['fields']});}});};exports[_0xe6b1('0xef')]=function(_0x3f4413,_0x3bed8b){return db[_0xe6b1('0xf0')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xe6b1('0x67')}})['then'](function(_0x2dda97){var _0x2610d3=![];if(!_0x3f4413[_0xe6b1('0x87')][_0xe6b1('0x6d')]){throw new Error(_0xe6b1('0xd8'));}if(!_0x3f4413[_0xe6b1('0x87')][_0xe6b1('0xf1')]['phone']){throw new Error(_0xe6b1('0xe0'));}if(!_0x3f4413['body']['binding']['firstName']){throw new Error(_0xe6b1('0xe2'));}if(!_0x3f4413[_0xe6b1('0x87')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2bef0d=require(_0xe6b1('0xf2'))[_0xe6b1('0xe9')](path[_0xe6b1('0xe3')](__dirname,_0xe6b1('0xf3')),[_0x3f4413[_0xe6b1('0x7f')]['id'],JSON['stringify'](_0x3f4413[_0xe6b1('0x87')]),JSON[_0xe6b1('0xf4')](_0x2dda97)]);_0x2bef0d['on'](_0xe6b1('0xf5'),function(){_0x2610d3=!![];return _0x3bed8b[_0xe6b1('0xf')](0xc8)[_0xe6b1('0x10')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x2bef0d[_0xe6b1('0xf6')]});});_0x2bef0d['on'](_0xe6b1('0xf7'),function(_0x2e81c8){if(_0x2e81c8&&!_0x2610d3){return _0x3bed8b['status'](0x1f4)[_0xe6b1('0x10')]({'message':'error\x20child\x20process','pid':_0x2bef0d[_0xe6b1('0xf6')]});}});})['catch'](handleError(_0x3bed8b,null));};exports[_0xe6b1('0xf8')]=function(_0x1421e3,_0xea76b1,_0x25d9ae){return db[_0xe6b1('0xf0')][_0xe6b1('0x85')]({'raw':!![],'attributes':['id'],'where':{'role':_0xe6b1('0x67')}})[_0xe6b1('0x18')](function(_0x26283c){var _0x1c5580=![];if(!_0x1421e3[_0xe6b1('0x87')]['ListId']){throw new Error(_0xe6b1('0xd8'));}if(!_0x1421e3[_0xe6b1('0x87')][_0xe6b1('0xf1')][_0xe6b1('0xb7')]){throw new Error(_0xe6b1('0xe0'));}if(!_0x1421e3[_0xe6b1('0x87')][_0xe6b1('0xf1')][_0xe6b1('0xe1')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1421e3['body'][_0xe6b1('0xdc')]){throw new Error(_0xe6b1('0xdd'));}var _0x2163cc=require(_0xe6b1('0xf2'))[_0xe6b1('0xe9')](path[_0xe6b1('0xe3')](__dirname,'../../components/import/cm/csvUpdates'),[_0x1421e3[_0xe6b1('0x7f')]['id'],JSON['stringify'](_0x1421e3[_0xe6b1('0x87')]),JSON[_0xe6b1('0xf4')](_0x26283c)]);_0x2163cc['on'](_0xe6b1('0xf5'),function(_0x105b80){_0x1c5580=!![];return _0xea76b1[_0xe6b1('0xf')](0xc8)[_0xe6b1('0x10')]({'message':_0xe6b1('0xf9'),'pid':_0x2163cc[_0xe6b1('0xf6')]});});_0x2163cc['on']('exit',function(_0x18b2a9){if(_0x18b2a9&&!_0x1c5580){return _0xea76b1[_0xe6b1('0xf')](0x1f4)[_0xe6b1('0x10')]({'message':_0xe6b1('0xfa'),'pid':_0x2163cc['pid']});}});})[_0xe6b1('0x7d')](handleError(_0xea76b1,null));};exports[_0xe6b1('0xfb')]=function(_0x4232d4,_0x3ae113){var _0x1c0a4a=[_0xe6b1('0xfc'),'chat','sms',_0xe6b1('0xfd'),_0xe6b1('0xfe'),'whatsapp','voice'];var _0x30ad10={'offset':0x0,'order':qs[_0xe6b1('0x2e')]('-createdAt')},_0x5b1d8a={'count':0x0,'rows':[]};Promise[_0xe6b1('0x65')]()[_0xe6b1('0x18')](function(){if(_0x4232d4[_0xe6b1('0x28')][_0xe6b1('0xff')]){if(!_[_0xe6b1('0x100')](_0x1c0a4a,_0x4232d4[_0xe6b1('0x28')]['channel'][_0xe6b1('0x101')]())){throw new Error(_0xe6b1('0x102'));}_0x1c0a4a=[_0x4232d4[_0xe6b1('0x28')]['channel'][_0xe6b1('0x101')]()];}if(_0x4232d4[_0xe6b1('0x28')][_0xe6b1('0x103')]){try{var _0x2e2f39=JSON[_0xe6b1('0xed')](_0x4232d4[_0xe6b1('0x28')]['range']);if(!moment(_0x2e2f39[_0xe6b1('0x32')])[_0xe6b1('0x104')]()){throw new Error(_0xe6b1('0x105'));}if(!moment(_0x2e2f39['to'])[_0xe6b1('0x104')]()){throw new Error(_0xe6b1('0x106'));}}catch(_0x5bb7e5){throw new Error(_0xe6b1('0x107'));}}if(!_0x4232d4[_0xe6b1('0x28')][_0xe6b1('0x2c')](_0xe6b1('0x2d'))){_0x30ad10['limit']=qs['limit'](_0x4232d4[_0xe6b1('0x28')]['limit']||0xa);_0x30ad10[_0xe6b1('0x11')]=qs[_0xe6b1('0x11')](_0x4232d4['query'][_0xe6b1('0x11')]);}var _0x492504=_0x1c0a4a[_0xe6b1('0x6c')](function(_0x476ee3){if(_0x476ee3===_0xe6b1('0x108')){var _0x2f1c62={'attributes':['id',_0xe6b1('0x109'),_0xe6b1('0x26'),'source',_0xe6b1('0x10a'),'callerid',_0xe6b1('0x10b'),_0xe6b1('0x10c'),'duration','note','createdAt',_0xe6b1('0x10d'),_0xe6b1('0x10e'),_0xe6b1('0x10f'),'UserId'],'where':{'ContactId':_0x4232d4[_0xe6b1('0x7f')]['id']},'include':[{'model':db[_0xe6b1('0xf0')],'as':'User','attributes':['id',_0xe6b1('0x1c'),_0xe6b1('0x110'),_0xe6b1('0x111')]}],'order':[[_0xe6b1('0x112'),'DESC']]};if(_0x4232d4[_0xe6b1('0x28')][_0xe6b1('0x103')]){_0x2f1c62[_0xe6b1('0x3b')][_0xe6b1('0x112')]={'$gte':_0x2e2f39[_0xe6b1('0x32')],'$lte':_0x2e2f39['to']};}return db[_0xe6b1('0x113')][_0xe6b1('0x114')](_0x2f1c62)['then'](function(_0x23a913){_0x5b1d8a[_0xe6b1('0x14')]+=_0x23a913[_0xe6b1('0x14')];return _[_0xe6b1('0x6c')](_0x23a913['rows'],function(_0x38c2c4){var _0x2aec17=_0x38c2c4['get']({'plain':!![]});_0x2aec17['channel']=_0x476ee3;if(_0x2aec17['User']){_0x2aec17['User']={'id':_0x2aec17[_0xe6b1('0xf0')]['id'],'name':_0x2aec17[_0xe6b1('0xf0')][_0xe6b1('0x1c')],'fullname':_0x2aec17[_0xe6b1('0xf0')][_0xe6b1('0x110')],'alias':_0x2aec17[_0xe6b1('0xf0')][_0xe6b1('0x111')]};}return _0x2aec17;});});}else{var _0x533aea=_[_0xe6b1('0x115')](_0x476ee3)+(_0x476ee3===_0xe6b1('0x116')?_0xe6b1('0x117'):_0xe6b1('0x118'));var _0x2be84d={'attributes':['id','closed',_0xe6b1('0x119'),_0xe6b1('0x112'),_0xe6b1('0x11a'),'disposition','secondDisposition',_0xe6b1('0x11b'),'UserId',_0x533aea+'Id'],'where':{'ContactId':_0x4232d4[_0xe6b1('0x7f')]['id']},'include':[{'model':db[_0x533aea],'as':_0xe6b1('0x118'),'attributes':['id',_0xe6b1('0x1c'),_0xe6b1('0x11c')]},{'model':db[_0xe6b1('0xf0')],'as':_0xe6b1('0x11d'),'attributes':['id',_0xe6b1('0x1c'),_0xe6b1('0x110')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xe6b1('0x1c'),'color'],'through':{'attributes':[]}}],'order':[[_0xe6b1('0x112'),_0xe6b1('0x62')]]};if(_0x4232d4[_0xe6b1('0x28')][_0xe6b1('0x103')]){_0x2be84d['where'][_0xe6b1('0x112')]={'$gte':_0x2e2f39['from'],'$lte':_0x2e2f39['to']};}switch(_0x476ee3){case _0xe6b1('0x116'):_0x2be84d[_0xe6b1('0x2a')]['push'](_0xe6b1('0x11e'),_0xe6b1('0x11f'),_0xe6b1('0x120'),_0xe6b1('0x121'),'osName',_0xe6b1('0x122'),_0xe6b1('0x123'),_0xe6b1('0x124'),_0xe6b1('0x125'));break;case _0xe6b1('0xfc'):_0x2be84d['attributes'][_0xe6b1('0x4c')](_0xe6b1('0x126'),'substatus');break;case _0xe6b1('0xfd'):_0x2be84d[_0xe6b1('0x2a')][_0xe6b1('0x4c')]('externalUrl',_0xe6b1('0x127'));break;}return db[_[_0xe6b1('0x115')](_0x476ee3)+'Interaction']['findAndCountAll'](_0x2be84d)[_0xe6b1('0x18')](function(_0x17b9c){_0x5b1d8a[_0xe6b1('0x14')]+=_0x17b9c[_0xe6b1('0x14')];return _[_0xe6b1('0x6c')](_0x17b9c[_0xe6b1('0xd0')],function(_0x6033ae){var _0x49ac90=_0x6033ae[_0xe6b1('0x88')]({'plain':!![]});_0x49ac90['channel']=_0x476ee3;if(_0x49ac90['Owner']){_0x49ac90['Owner']={'id':_0x49ac90[_0xe6b1('0x11d')]['id'],'name':_0x49ac90[_0xe6b1('0x11d')][_0xe6b1('0x1c')],'fullname':_0x49ac90['Owner'][_0xe6b1('0x110')]};}return _0x49ac90;});});}});return Promise[_0xe6b1('0x24')](_0x492504);})['then'](function(_0x3a8599){return _(_0x3a8599)['flatten']()[_0xe6b1('0x128')](_0xe6b1('0x112'))['reverse']()['value']();})[_0xe6b1('0x18')](function(_0x8968db){_0x5b1d8a['rows']=_0x30ad10['limit']?_0x8968db['slice'](_0x30ad10['offset'],_0x30ad10['offset']+_0x30ad10[_0xe6b1('0x13')]):_0x8968db;return _0x5b1d8a;})[_0xe6b1('0x18')](respondWithFilteredResult(_0x3ae113,_0x30ad10))[_0xe6b1('0x7d')](handleError(_0x3ae113,null));}; \ No newline at end of file +var _0x9ac6=['t.id\x20IN\x20?','user','role','agent','some','getLists','map','sequelize','toString','keyBy','merge','c.firstName','c.mobile','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','params','tags','startsWith','columnName','displayName','analytics','findAll','alias','custom','values','catch','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','create','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','ChatQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','utcOffset','timezones','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','show','Tag','CmContactHasItem','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','toParam','phone','getTags','findOne','rawAttributes','options','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','nolimit','ContactId','include','getHopperHistories','CmHopperHistory','includeAll','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','chmodSync','child_process','fork','join','binding_keys','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','meta','import','binding','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','getJourney','chat','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','fullname','VoiceCallReport','findAndCountAll','startCase','Website','closed','disposition','thirdDisposition','Account','Owner','color','browserName','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','referer','mail','externalUrl','threadId','Interaction','flatten','sortBy','reverse','bluebird','util','path','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','limit','set','update','then','destroy','end','sendStatus','error','stack','name','send','index','CmContact','describe','keys','cf_','CmCustomField','all','length','fieldType','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','select','field','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','conditions','find','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','text','filter','isNil','Contact','push','isEmpty','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','c.id','order','DESC','having'];(function(_0x33ac6b,_0x1ed895){var _0x34cffe=function(_0x17d762){while(--_0x17d762){_0x33ac6b['push'](_0x33ac6b['shift']());}};_0x34cffe(++_0x1ed895);}(_0x9ac6,0xce));var _0x69ac=function(_0x24ec09,_0x335eae){_0x24ec09=_0x24ec09-0x0;var _0x4d45f7=_0x9ac6[_0x24ec09];return _0x4d45f7;};'use strict';var moment=require('moment');var BPromise=require(_0x69ac('0x0'));var util=require(_0x69ac('0x1'));var path=require(_0x69ac('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x69ac('0x3'));var Papa=require(_0x69ac('0x4'));var Redis=require('ioredis');var qs=require(_0x69ac('0x5'));var as=require(_0x69ac('0x6'));var logger=require(_0x69ac('0x7'))(_0x69ac('0x8'));var config=require(_0x69ac('0x9'));var shared=require(_0x69ac('0xa'));var db=require(_0x69ac('0xb'))['db'];config[_0x69ac('0xc')]=_[_0x69ac('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x69ac('0xe'))(new Redis(config['redis']));require(_0x69ac('0xf'))[_0x69ac('0x10')](socket);function respondWithResult(_0xa4b96f,_0x553995){_0x553995=_0x553995||0xc8;return function(_0x476f1d){if(_0x476f1d){return _0xa4b96f[_0x69ac('0x11')](_0x553995)[_0x69ac('0x12')](_0x476f1d);}};}function respondWithFilteredResult(_0x5ecfca,_0x3221b1){return function(_0xf225ef){if(_0xf225ef){var _0x2084a9=typeof _0x3221b1[_0x69ac('0x13')]===_0x69ac('0x14')&&typeof _0x3221b1['limit']===_0x69ac('0x14');var _0xe751de=_0xf225ef[_0x69ac('0x15')];var _0x30dade=_0x2084a9?0x0:_0x3221b1[_0x69ac('0x13')];var _0x57168f=_0x2084a9?_0xf225ef[_0x69ac('0x15')]:_0x3221b1['offset']+_0x3221b1[_0x69ac('0x16')];var _0x45b30a;if(_0x57168f>=_0xe751de){_0x57168f=_0xe751de;_0x45b30a=0xc8;}else{_0x45b30a=0xce;}_0x5ecfca[_0x69ac('0x11')](_0x45b30a);return _0x5ecfca[_0x69ac('0x17')]('Content-Range',_0x30dade+'-'+_0x57168f+'/'+_0xe751de)[_0x69ac('0x12')](_0xf225ef);}return null;};}function saveUpdates(_0x349d5b){return function(_0x348781){if(_0x348781){return _0x348781[_0x69ac('0x18')](_0x349d5b)[_0x69ac('0x19')](function(_0x1a7235){return _0x1a7235;});}return null;};}function removeEntity(_0x609650){return function(_0xc33382){if(_0xc33382){return _0xc33382[_0x69ac('0x1a')]()['then'](function(){_0x609650[_0x69ac('0x11')](0xcc)[_0x69ac('0x1b')]();});}};}function handleEntityNotFound(_0x2e653b){return function(_0x476d9f){if(!_0x476d9f){_0x2e653b[_0x69ac('0x1c')](0x194);}return _0x476d9f;};}function handleError(_0x2e78a0,_0xafbfe0){_0xafbfe0=_0xafbfe0||0x1f4;return function(_0x2f6fd7){logger[_0x69ac('0x1d')](_0x2f6fd7[_0x69ac('0x1e')]);if(_0x2f6fd7[_0x69ac('0x1f')]){delete _0x2f6fd7[_0x69ac('0x1f')];}_0x2e78a0['status'](_0xafbfe0)[_0x69ac('0x20')](_0x2f6fd7);};}exports[_0x69ac('0x21')]=function(_0x2d16da,_0x12bc42){var _0x371adb={},_0x508f8d={},_0x49e839={'count':0x0,'rows':[]};return db[_0x69ac('0x22')][_0x69ac('0x23')]()[_0x69ac('0x19')](function(_0x623609){var _0x34f69d=[];for(var _0x149cbc=0x0;_0x149cbc0x1){_0xc99bd2['or'](_0x69ac('0x5d'),qs['getFullTextValue'](_0xfcc817),null);}else{if(qs[_0x69ac('0x5e')](_0xfcc817)){_0xc99bd2['or'](_0x69ac('0x5f'),_0xfcc817+'%');_0xc99bd2['or'](_0x69ac('0x60'),_0xfcc817+'%');_0xc99bd2['or'](_0x69ac('0x61'),_0xfcc817+'%');_0xc99bd2['or'](_0x69ac('0x62'),_0xfcc817+'%');}else if(qs[_0x69ac('0x63')](_0xfcc817)){_0xc99bd2['or']('c.email\x20LIKE\x20?',_0xfcc817+'%');}else{_0xc99bd2['or'](_0x69ac('0x64'),'%'+_0xfcc817+'%');_0xc99bd2['or']('c.lastName\x20LIKE\x20?','%'+_0xfcc817+'%');_0xc99bd2['or'](_0x69ac('0x65'),'%'+_0xfcc817+'%');}}}}_0x244742[_0x69ac('0x33')](_0xc99bd2);_0x244742['group'](_0x69ac('0x66'));var _0x292cef={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x227fb6=_0x244742['clone']()[_0x69ac('0x36')]('c.id');if(_0x371adb[_0x69ac('0x67')]){_0x371adb['order'][_0x69ac('0x47')](function(_0x11ef33){_0x244742['order']('c.'+_0x11ef33[0x0],_0x11ef33[0x1]===_0x69ac('0x68')?![]:!![]);});}if(!_[_0x69ac('0x55')](_0x4bc469)){_0x244742[_0x69ac('0x69')](_0x158978);_0x227fb6[_0x69ac('0x33')](_0x69ac('0x6a'),_0x4bc469);}BPromise['resolve']()[_0x69ac('0x19')](function(){if(!_0x31e15c)return;if(_0x2d16da[_0x69ac('0x6b')][_0x69ac('0x6c')]!==_0x69ac('0x6d'))return;if(!_[_0x69ac('0x6e')](_0x31e15c[_0x69ac('0x43')],[_0x69ac('0x36'),_0x69ac('0x49')])){return _0x2d16da[_0x69ac('0x6b')][_0x69ac('0x6f')]({'attributes':['id'],'raw':!![]})[_0x69ac('0x19')](function(_0x3aef0a){if(_[_0x69ac('0x55')](_0x3aef0a)){_0x227fb6['where']('c.ListId\x20IS\x20NULL');_0x244742[_0x69ac('0x33')]('c.ListId\x20IS\x20NULL');}else{_0x227fb6['where'](_0x69ac('0x57'),_[_0x69ac('0x70')](_0x3aef0a,'id'));_0x244742[_0x69ac('0x33')](_0x69ac('0x57'),_[_0x69ac('0x70')](_0x3aef0a,'id'));}});}})['then'](function(){if(_0x2d16da[_0x69ac('0x6b')][_0x69ac('0x6c')]===_0x69ac('0x6d')&&!_0x31e15c&&!_0x2d16da[_0x69ac('0x2c')]['ListId'])return[];return db[_0x69ac('0x71')]['query'](_0x227fb6['toString'](),_0x292cef);})['then'](function(_0x19b901){_0x49e839[_0x69ac('0x15')]=_0x19b901[_0x69ac('0x28')];if(_0x49e839[_0x69ac('0x15')]===0x0)return[];return db[_0x69ac('0x71')]['query'](_0x2a5fec[_0x69ac('0x72')](),_0x292cef)[_0x69ac('0x19')](function(_0x2269b5){_0x1c432f=_[_0x69ac('0x73')](_0x2269b5,'id');_0x292cef=_[_0x69ac('0x74')](_0x292cef,{'model':db[_0x69ac('0x22')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d16da['query'][_0x69ac('0x2f')]){_0x371adb[_0x69ac('0x30')][_0x69ac('0x47')](function(_0x244ea7){_0x244742['field']('c.'+_0x244ea7);});}else{_0x244742['field'](_0x69ac('0x66'));_0x244742[_0x69ac('0x36')](_0x69ac('0x75'));_0x244742['field']('c.lastName');_0x244742['field']('c.phone');_0x244742[_0x69ac('0x36')](_0x69ac('0x76'));_0x244742[_0x69ac('0x36')]('c.fax');_0x244742[_0x69ac('0x36')](_0x69ac('0x77'));_0x244742[_0x69ac('0x36')](_0x69ac('0x78'));_0x244742[_0x69ac('0x36')](_0x69ac('0x79'));_0x244742['field'](_0x69ac('0x7a'));_0x244742[_0x69ac('0x36')](_0x69ac('0x7b'));_0x244742['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x371adb[_0x69ac('0x16')])_0x244742[_0x69ac('0x16')](_0x371adb[_0x69ac('0x16')]);if(_0x371adb[_0x69ac('0x13')])_0x244742[_0x69ac('0x13')](_0x371adb[_0x69ac('0x13')]);return db[_0x69ac('0x71')][_0x69ac('0x2c')](_0x244742[_0x69ac('0x72')](),_0x292cef);});})[_0x69ac('0x19')](function(_0x5b9ad3){_0x5b9ad3[_0x69ac('0x47')](function(_0x4dc4ff){if(_0x4dc4ff[_0x69ac('0x7c')]){_0x4dc4ff['Tags']=[];_0x4dc4ff[_0x69ac('0x7c')][_0x69ac('0x46')](',')[_0x69ac('0x47')](function(_0x2b7c06){_0x4dc4ff[_0x69ac('0x7d')]['push'](_0x1c432f[_0x2b7c06]);});}delete _0x4dc4ff[_0x69ac('0x7c')];});_0x49e839[_0x69ac('0x7e')]=_0x5b9ad3;return _0x49e839;})['then'](respondWithFilteredResult(_0x12bc42,_0x371adb));})['catch'](handleError(_0x12bc42,null));};exports[_0x69ac('0x1a')]=function(_0x3623a2,_0x1d774a){return db[_0x69ac('0x22')]['find']({'where':{'id':_0x3623a2[_0x69ac('0x7f')]['id']}})[_0x69ac('0x19')](handleEntityNotFound(_0x1d774a,null))['then'](removeEntity(_0x1d774a,null))['catch'](handleError(_0x1d774a,null));};exports['describe']=function(_0x511905,_0x2757ae){return db[_0x69ac('0x22')][_0x69ac('0x23')]()[_0x69ac('0x19')](function(_0x3c42d0){delete _0x3c42d0[_0x69ac('0x80')];for(var _0x5c0bde=0x0;_0x5c0bde0x0){return new Promise(function(_0x112013,_0xc09380){var _0x4b246a=[];for(var _0x337f6e=0x0;_0x337f6e<_0x2dfb81[_0x69ac('0x28')];_0x337f6e++){_0x4b246a[_0x69ac('0x54')](insertAdditionalPhones(_0x2dfb81[_0x337f6e][_0x69ac('0xad')],_0x2dfb81[_0x337f6e][_0x69ac('0xa6')]));}Promise[_0x69ac('0x27')](_0x4b246a)[_0x69ac('0x19')](function(){_0x112013(0x1);});})[_0x69ac('0x19')](function(){return{'success':_0x2236f8,'failure':_0x2f31eb,'duplicates':_0x10852e};});}else{return{'success':_0x2236f8,'failure':_0x2f31eb,'duplicates':_0x10852e};}}})[_0x69ac('0x19')](respondWithResult(_0x502382,0xc9))[_0x69ac('0x89')](handleError(_0x502382,null));};exports[_0x69ac('0xae')]=function(_0x120b0e,_0x275291){var _0x1f9552;return db[_0x69ac('0x22')][_0x69ac('0x23')]()['then'](function(_0x4c0f00){return db['CmContact']['find']({'where':{'id':_0x120b0e[_0x69ac('0x7f')]['id']},'include':[{'model':db[_0x69ac('0xaf')],'as':_0x69ac('0x7d'),'attributes':['id',_0x69ac('0x1f'),'color'],'required':_0x120b0e[_0x69ac('0x2c')][_0x69ac('0x5a')]?!![]:![]},{'model':db[_0x69ac('0xb0')],'as':_0x69ac('0xb1'),'where':{'CmContactId':_0x120b0e['params']['id']},'required':![],'include':[{'model':db[_0x69ac('0xb2')],'as':_0x69ac('0xb3')}]}],'order':[db['sequelize'][_0x69ac('0xb4')](_0x69ac('0xb5'))],'attributes':_[_0x69ac('0x24')](_0x4c0f00)});})['then'](function(_0x40c4f6){if(!_[_0x69ac('0x52')](_0x40c4f6)){_0x1f9552=_0x40c4f6['get']({'plain':!![]});var _0x10845b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x40c4f6&&_0x40c4f6[_0x69ac('0x56')]){if(_0x40c4f6[_0x69ac('0x56')]){_0x10845b[_0x69ac('0x33')][_0x69ac('0xb6')][_0x69ac('0x54')]({'ListId':{'$ne':_0x40c4f6[_0x69ac('0x56')]}});}}return db[_0x69ac('0x26')][_0x69ac('0x85')](_0x10845b);}})['then'](function(_0x5ca329){if(!_[_0x69ac('0x52')](_0x5ca329)){return _[_0x69ac('0xb7')](_0x1f9552,_['map'](_0x5ca329,function(_0x215eab){return util[_0x69ac('0xb8')](_0x69ac('0xb9'),_0x215eab['id']);}));}})[_0x69ac('0x19')](handleEntityNotFound(_0x275291,null))[_0x69ac('0x19')](respondWithResult(_0x275291,null))[_0x69ac('0x89')](handleError(_0x275291,null));};exports[_0x69ac('0x18')]=function(_0x18c156,_0x1a4f91){var _0x5c56bd;if(_0x18c156[_0x69ac('0x8a')]['id']){delete _0x18c156['body']['id'];}if(!_['isNil'](_0x18c156[_0x69ac('0x8a')]['dialTimezone'])){var _0x61184a=_0x18c156[_0x69ac('0x8a')][_0x69ac('0xa3')];if(!_[_0x69ac('0x52')](shared['timezones'][_0x61184a]))_0x18c156['body']['utcOffset']=shared[_0x69ac('0xa5')][_0x61184a]['utcOffset'];}return db[_0x69ac('0x22')]['find']({'where':{'id':_0x18c156[_0x69ac('0x7f')]['id']}})[_0x69ac('0x19')](handleEntityNotFound(_0x1a4f91,null))[_0x69ac('0x19')](saveUpdates(_0x18c156['body'],null))[_0x69ac('0x19')](function(_0x5123bb){_0x5c56bd=_0x5123bb;var _0x1a7d02={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5123bb&&_0x5123bb['ListId']){if(_0x5123bb[_0x69ac('0x56')]){_0x1a7d02[_0x69ac('0x33')][_0x69ac('0xb6')][_0x69ac('0x54')]({'ListId':{'$ne':_0x5123bb[_0x69ac('0x56')]}});}}return db[_0x69ac('0x26')][_0x69ac('0x85')](_0x1a7d02);})['then'](function(_0x126a56){if(_0x126a56){return _['omit'](_[_0x69ac('0xba')](_0x18c156[_0x69ac('0x8a')],function(_0x1a76c1,_0x3846cf){return _[_0x69ac('0x81')](_0x3846cf,_0x69ac('0x25'));}),_[_0x69ac('0x70')](_0x126a56,function(_0x22af63){return util['format']('cf_%d',_0x22af63['id']);}));}})[_0x69ac('0x19')](function(_0x4d6f5d){if(_0x4d6f5d&&!_[_0x69ac('0x55')](_0x4d6f5d)){var _0x34336d=squel['update']()['table'](_0x69ac('0x39'))[_0x69ac('0xbb')](_0x4d6f5d)[_0x69ac('0x33')](_0x69ac('0xbc'),_0x18c156[_0x69ac('0x7f')]['id'])[_0x69ac('0xbd')]();return db[_0x69ac('0x71')]['query'](_0x34336d['text'],{'replacements':_0x34336d['values']});}})[_0x69ac('0x19')](function(){if(_0x18c156[_0x69ac('0x8a')][_0x69ac('0xbe')]&&_0x5c56bd){return db['CmHopper'][_0x69ac('0x18')]({'phone':_0x18c156[_0x69ac('0x8a')][_0x69ac('0xbe')],'OrderBy':0x0},{'where':{'ContactId':_0x5c56bd['id']}});}})[_0x69ac('0x19')](function(){return _0x5c56bd;})['then'](respondWithResult(_0x1a4f91,null))[_0x69ac('0x89')](handleError(_0x1a4f91,null));};exports[_0x69ac('0xbf')]=function(_0x2408c6,_0x40646a){var _0x296664={};var _0x5d1829={};var _0x549f02;var _0x1bb4b7;return db['CmContact'][_0x69ac('0xc0')]({'where':{'id':_0x2408c6[_0x69ac('0x7f')]['id']}})['then'](handleEntityNotFound(_0x40646a,null))[_0x69ac('0x19')](function(_0x9a5c6f){if(_0x9a5c6f){_0x549f02=_0x9a5c6f;_0x5d1829[_0x69ac('0x2b')]=_[_0x69ac('0x24')](db[_0x69ac('0xaf')][_0x69ac('0xc1')]);_0x5d1829['query']=_['keys'](_0x2408c6[_0x69ac('0x2c')]);_0x5d1829[_0x69ac('0x2d')]=_[_0x69ac('0x2e')](_0x5d1829[_0x69ac('0x2b')],_0x5d1829[_0x69ac('0x2c')]);_0x296664[_0x69ac('0x30')]=_[_0x69ac('0x2e')](_0x5d1829[_0x69ac('0x2b')],qs[_0x69ac('0x2f')](_0x2408c6[_0x69ac('0x2c')][_0x69ac('0x2f')]));_0x296664['attributes']=_0x296664['attributes'][_0x69ac('0x28')]?_0x296664[_0x69ac('0x30')]:_0x5d1829[_0x69ac('0x2b')];_0x296664[_0x69ac('0x67')]=qs[_0x69ac('0x32')](_0x2408c6['query'][_0x69ac('0x32')]);_0x296664['where']=qs['filters'](_[_0x69ac('0x34')](_0x2408c6[_0x69ac('0x2c')],_0x5d1829[_0x69ac('0x2d')]));if(_0x2408c6[_0x69ac('0x2c')]['filter']){_0x296664[_0x69ac('0x33')]=_[_0x69ac('0x74')](_0x296664[_0x69ac('0x33')],{'$or':_[_0x69ac('0x70')](_0x296664[_0x69ac('0x30')],function(_0x3d9b97){var _0x100910={};_0x100910[_0x3d9b97]={'$like':'%'+_0x2408c6[_0x69ac('0x2c')]['filter']+'%'};return _0x100910;})});}_0x296664=_[_0x69ac('0x74')]({},_0x296664,_0x2408c6[_0x69ac('0xc2')]);return _0x549f02['getTags'](_0x296664);}})[_0x69ac('0x19')](function(_0x2376d9){if(_0x2376d9){_0x1bb4b7=_0x2376d9[_0x69ac('0x28')];if(!_0x2408c6[_0x69ac('0x2c')][_0x69ac('0x31')]('nolimit')){_0x296664[_0x69ac('0x16')]=qs['limit'](_0x2408c6[_0x69ac('0x2c')]['limit']);_0x296664['offset']=qs[_0x69ac('0x13')](_0x2408c6[_0x69ac('0x2c')][_0x69ac('0x13')]);}return _0x549f02[_0x69ac('0xbf')](_0x296664);}})['then'](function(_0x212259){if(_0x212259){return _0x212259?{'count':_0x1bb4b7,'rows':_0x212259}:null;}})[_0x69ac('0x19')](respondWithResult(_0x40646a,null))[_0x69ac('0x89')](handleError(_0x40646a,null));};exports[_0x69ac('0xc3')]=function(_0x74e12a,_0x47ae27){if(_0x74e12a[_0x69ac('0x8a')]['id']){delete _0x74e12a[_0x69ac('0x8a')]['id'];}return db[_0x69ac('0x22')][_0x69ac('0xc0')]({'where':{'id':_0x74e12a[_0x69ac('0x7f')]['id']}})[_0x69ac('0x19')](handleEntityNotFound(_0x47ae27,null))[_0x69ac('0x19')](function(_0x124306){if(_0x124306){return _0x124306[_0x69ac('0xc3')](_0x74e12a[_0x69ac('0x8a')][_0x69ac('0xc4')]||[]);}return null;})[_0x69ac('0x19')](respondWithResult(_0x47ae27,null))[_0x69ac('0x89')](handleError(_0x47ae27,null));};exports['setAdditionalPhones']=function(_0x5e79c9,_0x31d644){var _0x55380e=[];_0x55380e[_0x69ac('0x54')](addAdditionalPhones(_0x5e79c9['body']));Promise[_0x69ac('0x27')](_0x55380e)['then'](function(){_0x55380e=[];_0x55380e[_0x69ac('0x54')](deleteCmHopperPhones(_0x5e79c9[_0x69ac('0x8a')]['id']));_0x55380e['push'](addCmHopperPhones(_0x5e79c9[_0x69ac('0x8a')]['id']));Promise['all'](_0x55380e)[_0x69ac('0x19')](function(){return[0x1];})[_0x69ac('0x19')](respondWithResult(_0x31d644,null));});};function addAdditionalPhones(_0x2f8d7d){var _0x234c07;return new Promise(function(_0x2814ab,_0x476ef2){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x2f8d7d['id']}})['then'](function(){db[_0x69ac('0xb2')][_0x69ac('0x85')]({'raw':!![],'attributes':['id',_0x69ac('0xc5')]})[_0x69ac('0x19')](function(_0x46a344){var _0x3d9a87=[];for(var _0x1cd68f=0x0;_0x1cd68f<_0x2f8d7d[_0x69ac('0xc6')][_0x69ac('0x28')];_0x1cd68f++){var _0xee0893=_0x2f8d7d[_0x69ac('0xc7')]?_[_0x69ac('0x52')](_0x2f8d7d['item_types'][_0x1cd68f])?'':_0x2f8d7d['item_types'][_0x1cd68f]:_0x2f8d7d[_0x69ac('0xc6')][_0x1cd68f][_0x69ac('0xc8')]?_0x2f8d7d['items'][_0x1cd68f][_0x69ac('0xc8')]:'';var _0xfe7581=_[_0x69ac('0x52')](_0x2f8d7d[_0x69ac('0xc6')][_0x1cd68f][_0x69ac('0xc9')])?'':_0x2f8d7d[_0x69ac('0xc6')][_0x1cd68f]['description'];var _0x566b61=_0xee0893+':'+_0x2f8d7d[_0x69ac('0xc6')][_0x1cd68f][_0x69ac('0xbe')]+'§'+_0xfe7581;if(_[_0x69ac('0x52')](_0x234c07))_0x234c07=_0x566b61;else _0x234c07+=';'+_0x566b61;var _0x59e01f=null;if(_0x2f8d7d[_0x69ac('0xc7')]){if(!_['isNil'](_0x2f8d7d['item_types'][_0x1cd68f])){var _0x246531=_[_0x69ac('0x44')](_0x46a344,function(_0xe66588){return _0xe66588['id']===_0x2f8d7d[_0x69ac('0xc7')][_0x1cd68f];});if(!_['isNil'](_0x246531)){_0x59e01f=_0x246531[_0x69ac('0xc5')];}}}else{if(!_['isNil'](_0x2f8d7d[_0x69ac('0xc6')][_0x1cd68f])){var _0x246531=_[_0x69ac('0x44')](_0x46a344,function(_0x36d489){return _0x36d489['id']===_0x2f8d7d[_0x69ac('0xc6')][_0x1cd68f][_0x69ac('0xc8')];});if(!_[_0x69ac('0x52')](_0x246531)){_0x59e01f=_0x1cd68f;}}}if(_[_0x69ac('0x52')](_0x59e01f)){_0x59e01f=0x64;}_0x3d9a87[_0x69ac('0x54')](addAdditionalPhone(_0x2f8d7d['id'],_0x2f8d7d['items'][_0x1cd68f][_0x69ac('0xbe')],_0x2f8d7d[_0x69ac('0xc7')]?_[_0x69ac('0x52')](_0x2f8d7d[_0x69ac('0xc7')][_0x1cd68f])?null:_0x2f8d7d[_0x69ac('0xc7')][_0x1cd68f]:_0x2f8d7d[_0x69ac('0xc6')][_0x1cd68f][_0x69ac('0xc8')]?_0x2f8d7d[_0x69ac('0xc6')][_0x1cd68f]['ItemTypeId']:null,_0x59e01f,_0xfe7581));}Promise[_0x69ac('0x27')](_0x3d9a87)[_0x69ac('0x19')](function(){db[_0x69ac('0x22')]['update']({'AdditionalPhones':_0x234c07},{'where':{'id':_0x2f8d7d['id']}})['then'](function(){_0x2814ab(0x1);});});});});});}function addAdditionalPhone(_0x5348fe,_0x3183e3,_0x4ef13f,_0xc7aa1c,_0x34be23){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x5348fe,'item':_0x3183e3}})[_0x69ac('0x19')](function(_0x114f5d){if(_0x114f5d)logger[_0x69ac('0x8d')](_0x69ac('0xca'),_0x114f5d);else{db[_0x69ac('0xb0')][_0x69ac('0x91')]({'CmContactId':_0x5348fe,'item':_0x3183e3,'ItemTypeId':_0x4ef13f,'OrderBy':_0xc7aa1c,'ItemClass':_0x69ac('0xcb'),'description':_0x34be23});}});}function deletePhones(_0x525005){return db[_0x69ac('0xb0')][_0x69ac('0x1a')]({'where':{'CmContactId':_0x525005}});}function deleteCmHopperPhones(_0x4b3db8){return new Promise(function(_0x305b29,_0x431114){return db[_0x69ac('0x8f')][_0x69ac('0x85')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4b3db8}})['then'](function(_0x18a7f0){db[_0x69ac('0xcc')][_0x69ac('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x69ac('0x70')](_0x18a7f0,'id')}}});})[_0x69ac('0x19')](function(){_0x305b29(0x1);});});}function addCmHopperPhones(_0x464b81){return new Promise(function(_0x4c4072,_0x5062a6){return db['CmHopper'][_0x69ac('0x85')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x464b81}})[_0x69ac('0x19')](function(_0x16d045){var _0x56fbd6=[];_[_0x69ac('0x70')](_0x16d045,function(_0x4dac47){_0x56fbd6[_0x69ac('0x54')](createCmHopperPhone(_0x464b81,_0x4dac47['id']));});Promise[_0x69ac('0x27')](_0x56fbd6)[_0x69ac('0x19')](function(){_0x4c4072(0x1);});});});}function createCmHopperPhone(_0x53933c,_0x4b6c34){return new Promise(function(_0x56079d,_0x360fbb){db[_0x69ac('0xb0')][_0x69ac('0x85')]({'raw':!![],'attributes':[_0x69ac('0xcd'),_0x69ac('0xc5')],'where':{'CmContactId':_0x53933c,'ItemClass':_0x69ac('0xcb')},'include':[{'model':db['ContactItemType'],'attributes':[_0x69ac('0xc5')],'as':_0x69ac('0xb3')}],'order':['OrderBy',db[_0x69ac('0x71')][_0x69ac('0xb4')](_0x69ac('0xce'))]})[_0x69ac('0x19')](function(_0x244686){var _0x499ecd=0x1;var _0x1fb3f8=_[_0x69ac('0x70')](_0x244686,function(_0x26c4aa){_0x26c4aa[_0x69ac('0xcf')]=_0x4b6c34;_0x26c4aa['phone']=_0x26c4aa['item'];_0x26c4aa[_0x69ac('0xc5')]=_0x499ecd;delete _0x26c4aa[_0x69ac('0xd0')];_0x499ecd=_0x499ecd+0x1;return _0x26c4aa;});return db[_0x69ac('0xcc')][_0x69ac('0xa7')](_0x1fb3f8,{});})[_0x69ac('0x19')](function(){_0x56079d(0x1);});});}function insertAdditionalPhones(_0x41ea65,_0x43af70){return new Promise(function(_0x406944,_0x4f99dd){var _0x2fb933=[];for(var _0x4a22e9=0x0;_0x4a22e9<_0x43af70[_0x69ac('0x28')];_0x4a22e9++){var _0x408f0e=_0x43af70[_0x4a22e9];_0x2fb933[_0x69ac('0x54')](parseContactItemType(_0x408f0e));}Promise[_0x69ac('0x27')](_0x2fb933)['then'](function(){var _0x562120={'id':_0x41ea65['id'],'items':_0x43af70};return addAdditionalPhones(_0x562120)[_0x69ac('0x19')](function(_0x2bb064){return addCmHopperPhones(_0x41ea65['id']);});})[_0x69ac('0x19')](function(){_0x406944(_0x41ea65);});});}function parseContactItemType(_0x308af5){return new Promise(function(_0x357af6,_0x3b4dc3){if(_0x308af5[_0x69ac('0x31')](_0x69ac('0xc8'))){_0x357af6(_0x308af5);}else{return db[_0x69ac('0xb2')][_0x69ac('0x44')]({'where':{'name':_0x308af5[_0x69ac('0xb3')]}})[_0x69ac('0x19')](function(_0x399a00){if(_[_0x69ac('0x52')](_0x399a00))_0x308af5['ItemTypeId']=null;else _0x308af5[_0x69ac('0xc8')]=_0x399a00['id'];_0x357af6(_0x308af5);});}});}exports[_0x69ac('0xd1')]=function(_0x43fdd6,_0xba34d1){return db[_0x69ac('0xb0')][_0x69ac('0x85')]({'raw':!![],'where':{'CmContactId':_0x43fdd6[_0x69ac('0x7f')]['id'],'ItemClass':_0x69ac('0xcb')},'include':[{'model':db[_0x69ac('0xb2')],'as':'ItemType'}],'order':[[_0x69ac('0xc5')],[db[_0x69ac('0x71')][_0x69ac('0xb4')](_0x69ac('0xce'))]]})['then'](function(_0x1ec6ad){return _0x1ec6ad;})[_0x69ac('0x19')](respondWithResult(_0xba34d1,null))['catch'](handleError(_0xba34d1,null));};exports[_0x69ac('0xd2')]=function(_0x1fd841,_0x3b4489){return db[_0x69ac('0xb0')][_0x69ac('0x85')]({'raw':!![],'where':{'CmContactId':_0x1fd841[_0x69ac('0x8a')][_0x69ac('0xd3')]}})['then'](function(_0x252349){var _0x5703b2=_[_0x69ac('0x70')](_0x252349,function(_0x366c7f){_0x366c7f[_0x69ac('0xd4')]=_0x1fd841['body']['toContactId'];return _0x366c7f;});return db[_0x69ac('0xb0')][_0x69ac('0xa7')](_0x5703b2,{});})[_0x69ac('0x19')](function(_0x2f05b6){return addCmHopperPhones(_0x1fd841['body'][_0x69ac('0xd5')]);})[_0x69ac('0x19')](function(_0x5229e3){return['ok'];})[_0x69ac('0x19')](respondWithResult(_0x3b4489,null))[_0x69ac('0x89')](handleError(_0x3b4489,null));};exports[_0x69ac('0xd6')]=function(_0x28c068,_0x4990a9){var _0x4619b7=[];_0x4619b7['push'](createCmHopperPhone(_0x28c068['body']['id'],_0x28c068[_0x69ac('0x8a')]['hopperId']));Promise['all'](_0x4619b7)['then'](function(){return[0x1];})[_0x69ac('0x19')](respondWithResult(_0x4990a9,null));};exports[_0x69ac('0xd7')]=function(_0x19494c,_0x1a7802){var _0x45d80d={'raw':![],'where':{}};var _0x57af17={};var _0x2b2fb5={'count':0x0,'rows':[]};return db[_0x69ac('0x22')][_0x69ac('0xc0')]({'where':{'id':_0x19494c[_0x69ac('0x7f')]['id']}})['then'](handleEntityNotFound(_0x1a7802,null))[_0x69ac('0x19')](function(_0x27966b){if(_0x27966b){_0x57af17[_0x69ac('0x2b')]=_[_0x69ac('0x24')](db[_0x69ac('0x8f')][_0x69ac('0xc1')]);_0x57af17[_0x69ac('0x2c')]=_['keys'](_0x19494c[_0x69ac('0x2c')]);_0x57af17[_0x69ac('0x2d')]=_[_0x69ac('0x2e')](_0x57af17[_0x69ac('0x2b')],_0x57af17[_0x69ac('0x2c')]);_0x45d80d['attributes']=_[_0x69ac('0x2e')](_0x57af17['model'],qs['fields'](_0x19494c[_0x69ac('0x2c')][_0x69ac('0x2f')]));_0x45d80d[_0x69ac('0x30')]=_0x45d80d[_0x69ac('0x30')][_0x69ac('0x28')]?_0x45d80d['attributes']:_0x57af17[_0x69ac('0x2b')];if(!_0x19494c['query'][_0x69ac('0x31')](_0x69ac('0xd8'))){_0x45d80d[_0x69ac('0x16')]=qs[_0x69ac('0x16')](_0x19494c[_0x69ac('0x2c')][_0x69ac('0x16')]);_0x45d80d[_0x69ac('0x13')]=qs['offset'](_0x19494c[_0x69ac('0x2c')]['offset']);}_0x45d80d[_0x69ac('0x67')]=qs[_0x69ac('0x32')](_0x19494c['query'][_0x69ac('0x32')]);_0x45d80d[_0x69ac('0x33')]=qs[_0x69ac('0x2d')](_[_0x69ac('0x34')](_0x19494c[_0x69ac('0x2c')],_0x57af17['filters']));_0x45d80d[_0x69ac('0x33')][_0x69ac('0xd9')]=_0x27966b['id'];if(_0x19494c['query'][_0x69ac('0x51')]){_0x45d80d[_0x69ac('0x33')]=_['merge'](_0x45d80d[_0x69ac('0x33')],{'$or':_[_0x69ac('0x70')](_0x45d80d[_0x69ac('0x30')],function(_0x5b7345){var _0x116f66={};_0x116f66[_0x5b7345]={'$like':'%'+_0x19494c['query'][_0x69ac('0x51')]+'%'};return _0x116f66;})});}_0x45d80d=_[_0x69ac('0x74')]({},_0x45d80d,_0x19494c[_0x69ac('0xc2')]);return db[_0x69ac('0x8f')][_0x69ac('0x15')]({'where':_0x45d80d[_0x69ac('0x33')]})[_0x69ac('0x19')](function(_0x49f9fe){_0x2b2fb5[_0x69ac('0x15')]=_0x49f9fe;if(_0x19494c[_0x69ac('0x2c')]['includeAll']){_0x45d80d[_0x69ac('0xda')]=[{'all':!![]}];}return db[_0x69ac('0x8f')][_0x69ac('0x85')](_0x45d80d);})[_0x69ac('0x19')](function(_0x4cf90e){_0x2b2fb5[_0x69ac('0x7e')]=_0x4cf90e;return _0x2b2fb5;});}})[_0x69ac('0x19')](respondWithFilteredResult(_0x1a7802,_0x45d80d))[_0x69ac('0x89')](handleError(_0x1a7802,null));};exports[_0x69ac('0xdb')]=function(_0x15248a,_0x14b125){var _0x544552={'raw':!![],'where':{}};var _0x36e540={};var _0x5f399b={'count':0x0,'rows':[]};return db[_0x69ac('0x22')][_0x69ac('0xc0')]({'where':{'id':_0x15248a[_0x69ac('0x7f')]['id']}})[_0x69ac('0x19')](handleEntityNotFound(_0x14b125,null))[_0x69ac('0x19')](function(_0x4c8cec){if(_0x4c8cec){_0x36e540[_0x69ac('0x2b')]=_[_0x69ac('0x24')](db[_0x69ac('0xdc')][_0x69ac('0xc1')]);_0x36e540[_0x69ac('0x2c')]=_[_0x69ac('0x24')](_0x15248a[_0x69ac('0x2c')]);_0x36e540[_0x69ac('0x2d')]=_[_0x69ac('0x2e')](_0x36e540['model'],_0x36e540[_0x69ac('0x2c')]);_0x544552[_0x69ac('0x30')]=_[_0x69ac('0x2e')](_0x36e540[_0x69ac('0x2b')],qs[_0x69ac('0x2f')](_0x15248a[_0x69ac('0x2c')]['fields']));_0x544552[_0x69ac('0x30')]=_0x544552[_0x69ac('0x30')][_0x69ac('0x28')]?_0x544552['attributes']:_0x36e540[_0x69ac('0x2b')];if(!_0x15248a[_0x69ac('0x2c')][_0x69ac('0x31')](_0x69ac('0xd8'))){_0x544552[_0x69ac('0x16')]=qs[_0x69ac('0x16')](_0x15248a['query'][_0x69ac('0x16')]);_0x544552[_0x69ac('0x13')]=qs[_0x69ac('0x13')](_0x15248a[_0x69ac('0x2c')][_0x69ac('0x13')]);}_0x544552[_0x69ac('0x67')]=qs[_0x69ac('0x32')](_0x15248a[_0x69ac('0x2c')][_0x69ac('0x32')]);_0x544552[_0x69ac('0x33')]=qs['filters'](_['pick'](_0x15248a[_0x69ac('0x2c')],_0x36e540[_0x69ac('0x2d')]));_0x544552['where'][_0x69ac('0xd9')]=_0x4c8cec['id'];if(_0x15248a['query'][_0x69ac('0x51')]){_0x544552[_0x69ac('0x33')]=_[_0x69ac('0x74')](_0x544552[_0x69ac('0x33')],{'$or':_['map'](_0x544552[_0x69ac('0x30')],function(_0x28d947){var _0x2fd648={};_0x2fd648[_0x28d947]={'$like':'%'+_0x15248a[_0x69ac('0x2c')]['filter']+'%'};return _0x2fd648;})});}_0x544552=_[_0x69ac('0x74')]({},_0x544552,_0x15248a[_0x69ac('0xc2')]);return db['CmHopperHistory']['count']({'where':_0x544552[_0x69ac('0x33')]})[_0x69ac('0x19')](function(_0x3df6da){_0x5f399b[_0x69ac('0x15')]=_0x3df6da;if(_0x15248a['query'][_0x69ac('0xdd')]){_0x544552[_0x69ac('0xda')]=[{'all':!![]}];}return db[_0x69ac('0xdc')][_0x69ac('0x85')](_0x544552);})[_0x69ac('0x19')](function(_0x41ea2e){_0x5f399b['rows']=_0x41ea2e;return _0x5f399b;});}})[_0x69ac('0x19')](respondWithFilteredResult(_0x14b125,_0x544552))[_0x69ac('0x89')](handleError(_0x14b125,null));};exports[_0x69ac('0xde')]=function(_0x24077d,_0x4069a6){var _0x25bebe={'raw':!![],'where':{}};var _0x20e4b4={};var _0x4c9f12={'count':0x0,'rows':[]};return db[_0x69ac('0x22')][_0x69ac('0xc0')]({'where':{'id':_0x24077d['params']['id']}})[_0x69ac('0x19')](handleEntityNotFound(_0x4069a6,null))[_0x69ac('0x19')](function(_0x2fae36){if(_0x2fae36){_0x20e4b4[_0x69ac('0x2b')]=_[_0x69ac('0x24')](db[_0x69ac('0x9b')][_0x69ac('0xc1')]);_0x20e4b4[_0x69ac('0x2c')]=_[_0x69ac('0x24')](_0x24077d[_0x69ac('0x2c')]);_0x20e4b4[_0x69ac('0x2d')]=_[_0x69ac('0x2e')](_0x20e4b4['model'],_0x20e4b4[_0x69ac('0x2c')]);_0x25bebe[_0x69ac('0x30')]=_[_0x69ac('0x2e')](_0x20e4b4[_0x69ac('0x2b')],qs[_0x69ac('0x2f')](_0x24077d[_0x69ac('0x2c')]['fields']));_0x25bebe[_0x69ac('0x30')]=_0x25bebe[_0x69ac('0x30')][_0x69ac('0x28')]?_0x25bebe[_0x69ac('0x30')]:_0x20e4b4['model'];if(!_0x24077d[_0x69ac('0x2c')]['hasOwnProperty'](_0x69ac('0xd8'))){_0x25bebe[_0x69ac('0x16')]=qs[_0x69ac('0x16')](_0x24077d[_0x69ac('0x2c')]['limit']);_0x25bebe[_0x69ac('0x13')]=qs['offset'](_0x24077d[_0x69ac('0x2c')][_0x69ac('0x13')]);}_0x25bebe[_0x69ac('0x67')]=qs['sort'](_0x24077d[_0x69ac('0x2c')][_0x69ac('0x32')]);_0x25bebe[_0x69ac('0x33')]=qs[_0x69ac('0x2d')](_[_0x69ac('0x34')](_0x24077d[_0x69ac('0x2c')],_0x20e4b4['filters']));_0x25bebe[_0x69ac('0x33')]['ContactId']=_0x2fae36['id'];if(_0x24077d[_0x69ac('0x2c')]['filter']){_0x25bebe[_0x69ac('0x33')]=_[_0x69ac('0x74')](_0x25bebe[_0x69ac('0x33')],{'$or':_[_0x69ac('0x70')](_0x25bebe[_0x69ac('0x30')],function(_0x300b23){var _0x15c2ec={};_0x15c2ec[_0x300b23]={'$like':'%'+_0x24077d['query'][_0x69ac('0x51')]+'%'};return _0x15c2ec;})});}_0x25bebe=_[_0x69ac('0x74')]({},_0x25bebe,_0x24077d['options']);return db['CmHopperFinal']['count']({'where':_0x25bebe[_0x69ac('0x33')]})[_0x69ac('0x19')](function(_0x4e87c3){_0x4c9f12[_0x69ac('0x15')]=_0x4e87c3;if(_0x24077d[_0x69ac('0x2c')]['includeAll']){_0x25bebe[_0x69ac('0xda')]=[{'all':!![]}];}return db[_0x69ac('0x9b')][_0x69ac('0x85')](_0x25bebe);})[_0x69ac('0x19')](function(_0x29a9d0){_0x4c9f12[_0x69ac('0x7e')]=_0x29a9d0;return _0x4c9f12;});}})['then'](respondWithFilteredResult(_0x4069a6,_0x25bebe))['catch'](handleError(_0x4069a6,null));};exports[_0x69ac('0xdf')]=function(_0x347e62,_0x2c3faf){var _0x534b20={'raw':!![],'where':{}};var _0x201e3f={};var _0x210bb9={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x347e62[_0x69ac('0x7f')]['id']}})[_0x69ac('0x19')](handleEntityNotFound(_0x2c3faf,null))[_0x69ac('0x19')](function(_0x4f2532){if(_0x4f2532){_0x201e3f[_0x69ac('0x2b')]=_[_0x69ac('0x24')](db[_0x69ac('0x9f')][_0x69ac('0xc1')]);_0x201e3f[_0x69ac('0x2c')]=_[_0x69ac('0x24')](_0x347e62[_0x69ac('0x2c')]);_0x201e3f[_0x69ac('0x2d')]=_[_0x69ac('0x2e')](_0x201e3f[_0x69ac('0x2b')],_0x201e3f[_0x69ac('0x2c')]);_0x534b20[_0x69ac('0x30')]=_[_0x69ac('0x2e')](_0x201e3f[_0x69ac('0x2b')],qs['fields'](_0x347e62[_0x69ac('0x2c')][_0x69ac('0x2f')]));_0x534b20[_0x69ac('0x30')]=_0x534b20[_0x69ac('0x30')]['length']?_0x534b20[_0x69ac('0x30')]:_0x201e3f[_0x69ac('0x2b')];if(!_0x347e62[_0x69ac('0x2c')][_0x69ac('0x31')](_0x69ac('0xd8'))){_0x534b20['limit']=qs['limit'](_0x347e62[_0x69ac('0x2c')][_0x69ac('0x16')]);_0x534b20['offset']=qs['offset'](_0x347e62[_0x69ac('0x2c')][_0x69ac('0x13')]);}_0x534b20['order']=qs[_0x69ac('0x32')](_0x347e62['query'][_0x69ac('0x32')]);_0x534b20[_0x69ac('0x33')]=qs[_0x69ac('0x2d')](_['pick'](_0x347e62[_0x69ac('0x2c')],_0x201e3f['filters']));_0x534b20[_0x69ac('0x33')][_0x69ac('0xd9')]=_0x4f2532['id'];if(_0x347e62[_0x69ac('0x2c')][_0x69ac('0x51')]){_0x534b20[_0x69ac('0x33')]=_[_0x69ac('0x74')](_0x534b20[_0x69ac('0x33')],{'$or':_[_0x69ac('0x70')](_0x534b20[_0x69ac('0x30')],function(_0xfef5b9){var _0x272a40={};_0x272a40[_0xfef5b9]={'$like':'%'+_0x347e62[_0x69ac('0x2c')][_0x69ac('0x51')]+'%'};return _0x272a40;})});}_0x534b20=_[_0x69ac('0x74')]({},_0x534b20,_0x347e62[_0x69ac('0xc2')]);return db['JscriptySessionReport']['count']({'where':_0x534b20[_0x69ac('0x33')]})['then'](function(_0x237e3e){_0x210bb9[_0x69ac('0x15')]=_0x237e3e;if(_0x347e62[_0x69ac('0x2c')][_0x69ac('0xdd')]){_0x534b20[_0x69ac('0xda')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x534b20);})[_0x69ac('0x19')](function(_0x19fe72){_0x210bb9[_0x69ac('0x7e')]=_0x19fe72;return _0x210bb9;});}})['then'](respondWithFilteredResult(_0x2c3faf,_0x534b20))[_0x69ac('0x89')](handleError(_0x2c3faf,null));};exports[_0x69ac('0xe0')]=function(_0x288cd0,_0x118ebb){try{if(!_0x288cd0[_0x69ac('0x8a')][_0x69ac('0x56')]){throw new Error(_0x69ac('0xe1'));}if(!_0x288cd0[_0x69ac('0x8a')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x288cd0[_0x69ac('0x8a')][_0x69ac('0xe2')]){throw new Error(_0x69ac('0xe3'));}if(!_0x288cd0[_0x69ac('0x8a')][_0x69ac('0xe4')]){throw new Error(_0x69ac('0xe5'));}var _0x5f243e=_0x288cd0['body']['binding_keys'][_0x69ac('0x46')](',');var _0x5dcc1f=_0x288cd0[_0x69ac('0x8a')][_0x69ac('0xe2')]['split'](',');if(!_0x5f243e[_0x69ac('0x28')]||!_0x5dcc1f['length']||_0x5f243e[_0x69ac('0x28')]!==_0x5dcc1f[_0x69ac('0x28')]){throw new Error(_0x69ac('0xe6'));}_0x288cd0[_0x69ac('0x8a')]['fields']=_[_0x69ac('0xe7')](_0x5f243e,_0x5dcc1f);if(!_0x288cd0[_0x69ac('0x8a')][_0x69ac('0x2f')][_0x69ac('0xbe')]){throw new Error(_0x69ac('0xe8'));}if(!_0x288cd0['body'][_0x69ac('0x2f')][_0x69ac('0xe9')]){throw new Error(_0x69ac('0xea'));}var _0x5a5095=path['join'](config[_0x69ac('0xeb')],_0x69ac('0xec'),_0x288cd0['file']['filename']);fs[_0x69ac('0xed')](_0x5a5095,parseInt('0777',0x8));var _0x4e82c5=require(_0x69ac('0xee'))[_0x69ac('0xef')](path[_0x69ac('0xf0')](__dirname,'../../components/import/cm/csv'),[_0x5a5095,_0x288cd0[_0x69ac('0x8a')][_0x69ac('0xf1')],_0x288cd0[_0x69ac('0x8a')][_0x69ac('0xe2')],_0x288cd0[_0x69ac('0x8a')][_0x69ac('0x56')],_0x288cd0[_0x69ac('0x8a')][_0x69ac('0xf2')],_0x288cd0['body'][_0x69ac('0xa9')],_0x288cd0[_0x69ac('0x8a')]['socket_timestamp']]);return _0x118ebb['status'](0xc8)['json']({'message':_0x69ac('0xf3'),'pid':_0x4e82c5[_0x69ac('0xf4')]});}catch(_0x9f7170){return _0x118ebb[_0x69ac('0x11')](0x1f4)['send'](_0x9f7170);}};exports[_0x69ac('0xf5')]=function(_0x582f5f,_0x3e3682){var _0x5aca99=fs[_0x69ac('0xf6')](_0x582f5f[_0x69ac('0xf7')][_0x69ac('0x2')]);Papa['parse'](_0x5aca99,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5acde9){return _0x3e3682['status'](0xc8)[_0x69ac('0x12')]({'file':_0x582f5f[_0x69ac('0xf7')],'fields':_0x5acde9[_0x69ac('0xf8')][_0x69ac('0x2f')]});}});};exports[_0x69ac('0xf9')]=function(_0x1a77ef,_0xdeecc0){return db[_0x69ac('0x49')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x69ac('0x6d')}})[_0x69ac('0x19')](function(_0x3f01c5){var _0x51cd17=![];if(!_0x1a77ef['body'][_0x69ac('0x56')]){throw new Error(_0x69ac('0xe1'));}if(!_0x1a77ef[_0x69ac('0x8a')][_0x69ac('0xfa')][_0x69ac('0xbe')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1a77ef[_0x69ac('0x8a')][_0x69ac('0xfa')][_0x69ac('0xe9')]){throw new Error(_0x69ac('0xea'));}if(!_0x1a77ef['body'][_0x69ac('0xe4')]){throw new Error(_0x69ac('0xe5'));}var _0x3708d3=require(_0x69ac('0xee'))[_0x69ac('0xef')](path[_0x69ac('0xf0')](__dirname,_0x69ac('0xfb')),[_0x1a77ef[_0x69ac('0x7f')]['id'],JSON[_0x69ac('0xfc')](_0x1a77ef['body']),JSON['stringify'](_0x3f01c5)]);_0x3708d3['on'](_0x69ac('0xfd'),function(){_0x51cd17=!![];return _0xdeecc0[_0x69ac('0x11')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x3708d3[_0x69ac('0xf4')]});});_0x3708d3['on'](_0x69ac('0xfe'),function(_0x206a2b){if(_0x206a2b&&!_0x51cd17){return _0xdeecc0['status'](0x1f4)['json']({'message':_0x69ac('0xff'),'pid':_0x3708d3[_0x69ac('0xf4')]});}});})[_0x69ac('0x89')](handleError(_0xdeecc0,null));};exports[_0x69ac('0x100')]=function(_0x5092b3,_0x5b9e7b,_0x134ed7){return db['User'][_0x69ac('0x85')]({'raw':!![],'attributes':['id'],'where':{'role':_0x69ac('0x6d')}})['then'](function(_0x2a4ffb){var _0x4a7d50=![];if(!_0x5092b3[_0x69ac('0x8a')]['ListId']){throw new Error(_0x69ac('0xe1'));}if(!_0x5092b3[_0x69ac('0x8a')][_0x69ac('0xfa')][_0x69ac('0xbe')]){throw new Error(_0x69ac('0xe8'));}if(!_0x5092b3[_0x69ac('0x8a')][_0x69ac('0xfa')]['firstName']){throw new Error(_0x69ac('0xea'));}if(!_0x5092b3[_0x69ac('0x8a')][_0x69ac('0xe4')]){throw new Error(_0x69ac('0xe5'));}var _0x112513=require('child_process')['fork'](path[_0x69ac('0xf0')](__dirname,_0x69ac('0x101')),[_0x5092b3[_0x69ac('0x7f')]['id'],JSON[_0x69ac('0xfc')](_0x5092b3[_0x69ac('0x8a')]),JSON[_0x69ac('0xfc')](_0x2a4ffb)]);_0x112513['on'](_0x69ac('0xfd'),function(_0x5f2a43){_0x4a7d50=!![];return _0x5b9e7b[_0x69ac('0x11')](0xc8)[_0x69ac('0x12')]({'message':_0x69ac('0x102'),'pid':_0x112513[_0x69ac('0xf4')]});});_0x112513['on'](_0x69ac('0xfe'),function(_0x16a292){if(_0x16a292&&!_0x4a7d50){return _0x5b9e7b[_0x69ac('0x11')](0x1f4)[_0x69ac('0x12')]({'message':'error\x20child\x20process','pid':_0x112513['pid']});}});})[_0x69ac('0x89')](handleError(_0x5b9e7b,null));};exports[_0x69ac('0x103')]=function(_0x5a1501,_0x5a0838){var _0x2e13c3=['mail',_0x69ac('0x104'),'sms',_0x69ac('0x105'),_0x69ac('0x106'),_0x69ac('0x107'),_0x69ac('0x108')];var _0x183f17={'offset':0x0,'order':qs[_0x69ac('0x32')](_0x69ac('0x109'))},_0x50d324={'count':0x0,'rows':[]};Promise['resolve']()['then'](function(){if(_0x5a1501[_0x69ac('0x2c')][_0x69ac('0x10a')]){if(!_[_0x69ac('0x10b')](_0x2e13c3,_0x5a1501[_0x69ac('0x2c')][_0x69ac('0x10a')]['toLowerCase']())){throw new Error(_0x69ac('0x10c'));}_0x2e13c3=[_0x5a1501[_0x69ac('0x2c')][_0x69ac('0x10a')][_0x69ac('0x10d')]()];}if(_0x5a1501[_0x69ac('0x2c')][_0x69ac('0x10e')]){try{var _0x5e0516=JSON['parse'](_0x5a1501[_0x69ac('0x2c')][_0x69ac('0x10e')]);if(!moment(_0x5e0516[_0x69ac('0x37')])[_0x69ac('0x10f')]()){throw new Error(_0x69ac('0x110'));}if(!moment(_0x5e0516['to'])[_0x69ac('0x10f')]()){throw new Error(_0x69ac('0x111'));}}catch(_0x5c9e9d){throw new Error(_0x69ac('0x112'));}}if(!_0x5a1501[_0x69ac('0x2c')][_0x69ac('0x31')]('nolimit')){_0x183f17['limit']=qs[_0x69ac('0x16')](_0x5a1501[_0x69ac('0x2c')][_0x69ac('0x16')]||0xa);_0x183f17[_0x69ac('0x13')]=qs['offset'](_0x5a1501[_0x69ac('0x2c')][_0x69ac('0x13')]);}var _0x4f92c4=_0x2e13c3[_0x69ac('0x70')](function(_0x55ee99){if(_0x55ee99==='voice'){var _0x45568e={'attributes':['id','uniqueid',_0x69ac('0x2a'),_0x69ac('0x113'),_0x69ac('0x114'),_0x69ac('0x115'),_0x69ac('0x116'),_0x69ac('0x117'),_0x69ac('0x118'),_0x69ac('0x119'),_0x69ac('0x11a'),_0x69ac('0x11b'),_0x69ac('0x11c'),'userThirdDisposition',_0x69ac('0x11d')],'where':{'ContactId':_0x5a1501[_0x69ac('0x7f')]['id']},'include':[{'model':db['User'],'as':_0x69ac('0x49'),'attributes':['id','name',_0x69ac('0x11e'),_0x69ac('0x86')]}],'order':[[_0x69ac('0x11a'),_0x69ac('0x68')]]};if(_0x5a1501[_0x69ac('0x2c')][_0x69ac('0x10e')]){_0x45568e[_0x69ac('0x33')]['createdAt']={'$gte':_0x5e0516[_0x69ac('0x37')],'$lte':_0x5e0516['to']};}return db[_0x69ac('0x11f')][_0x69ac('0x120')](_0x45568e)[_0x69ac('0x19')](function(_0x1d3b54){_0x50d324[_0x69ac('0x15')]+=_0x1d3b54['count'];return _['map'](_0x1d3b54[_0x69ac('0x7e')],function(_0x5c78e2){var _0x4f7489=_0x5c78e2[_0x69ac('0x8b')]({'plain':!![]});_0x4f7489[_0x69ac('0x10a')]=_0x55ee99;if(_0x4f7489[_0x69ac('0x49')]){_0x4f7489[_0x69ac('0x49')]={'id':_0x4f7489['User']['id'],'name':_0x4f7489[_0x69ac('0x49')][_0x69ac('0x1f')],'fullname':_0x4f7489[_0x69ac('0x49')]['fullname'],'alias':_0x4f7489['User'][_0x69ac('0x86')]};}return _0x4f7489;});});}else{var _0x59c1ae=_[_0x69ac('0x121')](_0x55ee99)+(_0x55ee99==='chat'?_0x69ac('0x122'):'Account');var _0x5789bd={'attributes':['id',_0x69ac('0x123'),'closedAt',_0x69ac('0x11a'),_0x69ac('0x119'),_0x69ac('0x124'),'secondDisposition',_0x69ac('0x125'),_0x69ac('0x11d'),_0x59c1ae+'Id'],'where':{'ContactId':_0x5a1501['params']['id']},'include':[{'model':db[_0x59c1ae],'as':_0x69ac('0x126'),'attributes':['id',_0x69ac('0x1f'),'key']},{'model':db[_0x69ac('0x49')],'as':_0x69ac('0x127'),'attributes':['id',_0x69ac('0x1f'),_0x69ac('0x11e')]},{'model':db[_0x69ac('0xaf')],'as':_0x69ac('0x7d'),'attributes':['id',_0x69ac('0x1f'),_0x69ac('0x128')],'through':{'attributes':[]}}],'order':[[_0x69ac('0x11a'),_0x69ac('0x68')]]};if(_0x5a1501[_0x69ac('0x2c')][_0x69ac('0x10e')]){_0x5789bd['where'][_0x69ac('0x11a')]={'$gte':_0x5e0516[_0x69ac('0x37')],'$lte':_0x5e0516['to']};}switch(_0x55ee99){case _0x69ac('0x104'):_0x5789bd[_0x69ac('0x30')][_0x69ac('0x54')](_0x69ac('0x129'),_0x69ac('0x12a'),_0x69ac('0x12b'),_0x69ac('0x12c'),_0x69ac('0x12d'),'ratingMessage',_0x69ac('0x12e'),_0x69ac('0x12f'),_0x69ac('0x130'));break;case _0x69ac('0x131'):_0x5789bd['attributes'][_0x69ac('0x54')]('subject','substatus');break;case _0x69ac('0x105'):_0x5789bd[_0x69ac('0x30')][_0x69ac('0x54')](_0x69ac('0x132'),_0x69ac('0x133'));break;}return db[_[_0x69ac('0x121')](_0x55ee99)+_0x69ac('0x134')][_0x69ac('0x120')](_0x5789bd)['then'](function(_0x559ba4){_0x50d324[_0x69ac('0x15')]+=_0x559ba4[_0x69ac('0x15')];return _[_0x69ac('0x70')](_0x559ba4[_0x69ac('0x7e')],function(_0x3e9d7c){var _0x3c6e81=_0x3e9d7c['get']({'plain':!![]});_0x3c6e81[_0x69ac('0x10a')]=_0x55ee99;if(_0x3c6e81[_0x69ac('0x127')]){_0x3c6e81[_0x69ac('0x127')]={'id':_0x3c6e81[_0x69ac('0x127')]['id'],'name':_0x3c6e81[_0x69ac('0x127')][_0x69ac('0x1f')],'fullname':_0x3c6e81[_0x69ac('0x127')][_0x69ac('0x11e')]};}return _0x3c6e81;});});}});return Promise[_0x69ac('0x27')](_0x4f92c4);})[_0x69ac('0x19')](function(_0x4214e3){return _(_0x4214e3)[_0x69ac('0x135')]()[_0x69ac('0x136')](_0x69ac('0x11a'))[_0x69ac('0x137')]()[_0x69ac('0x45')]();})['then'](function(_0x11b395){_0x50d324[_0x69ac('0x7e')]=_0x183f17[_0x69ac('0x16')]?_0x11b395['slice'](_0x183f17['offset'],_0x183f17[_0x69ac('0x13')]+_0x183f17[_0x69ac('0x16')]):_0x11b395;return _0x50d324;})['then'](respondWithFilteredResult(_0x5a0838,_0x183f17))[_0x69ac('0x89')](handleError(_0x5a0838,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index c0882ce..f6a912c 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 _0x029e=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x029e,0x7b));var _0xe029=function(_0x15f962,_0x51aa80){_0x15f962=_0x15f962-0x0;var _0x58bec4=_0x029e[_0x15f962];return _0x58bec4;};'use strict';var EventEmitter=require(_0xe029('0x0'));var CmContact=require(_0xe029('0x1'))['db'][_0xe029('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xe029('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe029('0x4'),'afterDestroy':_0xe029('0x5')};function emitEvent(_0x21bcb3){return function(_0x4ad748,_0x747610,_0x3ecf94){CmContactEvents['emit'](_0x21bcb3+':'+_0x4ad748['id'],_0x4ad748);CmContactEvents[_0xe029('0x6')](_0x21bcb3,_0x4ad748);_0x3ecf94(null);};}for(var e in events){if(events[_0xe029('0x7')](e)){var event=events[e];CmContact[_0xe029('0x8')](e,emitEvent(event));}}module[_0xe029('0x9')]=CmContactEvents; \ No newline at end of file +var _0xeba6=['exports','events','../../mysqldb','CmContact','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x333869,_0x349bfd){var _0xc4ac44=function(_0x19fd19){while(--_0x19fd19){_0x333869['push'](_0x333869['shift']());}};_0xc4ac44(++_0x349bfd);}(_0xeba6,0x187));var _0x6eba=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeba6[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x6eba('0x0'));var CmContact=require(_0x6eba('0x1'))['db'][_0x6eba('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x6eba('0x3')](0x0);var events={'afterCreate':_0x6eba('0x4'),'afterUpdate':'update','afterDestroy':_0x6eba('0x5')};function emitEvent(_0x365514){return function(_0x42eddb,_0x3916f6,_0x38b710){CmContactEvents[_0x6eba('0x6')](_0x365514+':'+_0x42eddb['id'],_0x42eddb);CmContactEvents[_0x6eba('0x6')](_0x365514,_0x42eddb);_0x38b710(null);};}for(var e in events){if(events[_0x6eba('0x7')](e)){var event=events[e];CmContact[_0x6eba('0x8')](e,emitEvent(event));}}module[_0x6eba('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 8c9b1ba..86a866f 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 _0x5d95=['dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','List\x20not\x20found','destroy','ContactId','VoiceQueueId','CampaignId','all','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','fax','utf8mb4','utf8mb4_unicode_ci','models','get','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','dialTimezone','timezones','utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','error','afterCreate','inspect','\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','findAll','outbound'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5d95,0x1de));var _0x55d9=function(_0x5fd687,_0x46d9d2){_0x5fd687=_0x5fd687-0x0;var _0x4188cf=_0x5d95[_0x5fd687];return _0x4188cf;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var logger=require('../../config/logger')(_0x55d9('0x2'));var moment=require('moment');var BPromise=require(_0x55d9('0x3'));var rp=require(_0x55d9('0x4'));var fs=require('fs');var path=require(_0x55d9('0x5'));var rimraf=require(_0x55d9('0x6'));var config=require(_0x55d9('0x7'));var shared=require('../../config/environment/shared');var attributes=require(_0x55d9('0x8'));module[_0x55d9('0x9')]=function(_0x583ecf,_0x366cb8){return _0x583ecf[_0x55d9('0xa')](_0x55d9('0xb'),attributes,{'tableName':_0x55d9('0xc'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x55d9('0xd')]},{'name':_0x55d9('0xe'),'fields':['firstName',_0x55d9('0xf'),'phone','mobile',_0x55d9('0x10'),'email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x55d9('0x11'),'collate':_0x55d9('0x12'),'hooks':{'afterCreate':function(_0x2e1ba4,_0xbd1c86,_0x5a71d6){var _0x249036=_0x583ecf[_0x55d9('0x13')];var _0x24ced2=_0x2e1ba4[_0x55d9('0x14')]({'plain':!![]});function _0x159d52(){return function(_0x41ec6f){logger['error']('cmContact','afterCreate',util['inspect'](_0x41ec6f,{'showHidden':![],'depth':null}));};}function _0x114474(_0x4c067e,_0x3dcc46){var _0x3846a4=_0x3dcc46['scheduledat']?_0x3dcc46[_0x55d9('0x15')]:moment()[_0x55d9('0x16')](_0x55d9('0x17'));return new BPromise(function(_0xf2d317,_0x11dd43){if(_[_0x55d9('0x18')](_0x3dcc46['dialTimezone'])){_0xf2d317({'ret':_0x3846a4});}else{_0x249036[_0x55d9('0x19')][_0x55d9('0x1a')]({'where':{'id':_0x4c067e['id']}})['then'](function(_0x281744){if(!_['isNil'](_0x281744)){var _0x248db1=_0x281744[_0x55d9('0x1b')];if(!_[_0x55d9('0x18')](_0x248db1)){var _0x5f16a4=shared[_0x55d9('0x1c')];var _0x5a8466=_0x5f16a4[_0x248db1];var _0x49b280=_0x5f16a4[_0x3dcc46[_0x55d9('0x1b')]];if(!_['isNil'](_0x5a8466)&&!_[_0x55d9('0x18')](_0x49b280)){var _0x1d40c1=_0x5a8466['utcOffset']-_0x49b280[_0x55d9('0x1d')];_0x3846a4=_0x3dcc46[_0x55d9('0x15')]?_0x3dcc46[_0x55d9('0x15')]:moment();var _0x6da16d=moment(_0x3846a4)[_0x55d9('0x1e')](_0x1d40c1,_0x55d9('0x1f'));_0xf2d317({'ret':_0x6da16d[_0x55d9('0x16')](_0x55d9('0x17'))});}else _0xf2d317({'ret':_0x3846a4});}else _0xf2d317({'ret':_0x3846a4});}else{_0xf2d317({'ret':_0x3846a4});}});}});return 0xa;}var _0x4c1feb=function(_0x18937d){return new BPromise(function(_0x13be96,_0x1975b8){_0x114474(_0x18937d,_0x24ced2)[_0x55d9('0x20')](function(_0x31ab72){_0x24ced2[_0x55d9('0x15')]=_0x31ab72[_0x55d9('0x21')];_0x249036[_0x55d9('0x22')][_0x55d9('0x1a')]({'where':{'phone':_0x24ced2[_0x55d9('0xd')],'VoiceQueueId':_0x18937d['id']}})['then'](function(_0x4abcf5){if(!_[_0x55d9('0x18')](_0x4abcf5)){throw new Error(_0x55d9('0x23')+_0x24ced2[_0x55d9('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x18937d['id']);}return _0x249036[_0x55d9('0x22')][_0x55d9('0x24')]({'phone':_0x24ced2['phone'],'ContactId':_0x24ced2['id'],'ListId':_0x24ced2[_0x55d9('0x25')],'priority':_0x24ced2[_0x55d9('0x26')]?_0x24ced2[_0x55d9('0x26')]:0x2,'scheduledat':_0x24ced2['scheduledat']?_0x24ced2[_0x55d9('0x15')]:moment()['format'](_0x55d9('0x17')),'callback':_0x24ced2['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x24ced2[_0x55d9('0x27')]?_0x24ced2[_0x55d9('0x27')]:undefined,'callbackat':_0x24ced2[_0x55d9('0x27')]?moment()[_0x55d9('0x16')](_0x55d9('0x17')):undefined,'VoiceQueueId':_0x18937d['id']});})[_0x55d9('0x28')](function(_0x1742c0){_0x1975b8(_0x1742c0);});});});};var _0xce4d79=function(_0xe9f90b){return new BPromise(function(_0x44f76c,_0x5ac769){_0x114474(_0xe9f90b,_0x24ced2)[_0x55d9('0x20')](function(_0x1663ec){_0x24ced2[_0x55d9('0x15')]=_0x1663ec['ret'];_0x249036[_0x55d9('0x22')][_0x55d9('0x1a')]({'where':{'phone':_0x24ced2[_0x55d9('0xd')],'VoiceQueueId':_0xe9f90b['id']}})['then'](function(_0x453dab){if(!_[_0x55d9('0x18')](_0x453dab)){throw new Error(_0x55d9('0x23')+_0x24ced2[_0x55d9('0xd')]+_0x55d9('0x29')+_0xe9f90b['id']);}return _0x249036['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x24ced2[_0x55d9('0xd')],'VoiceQueueId':_0xe9f90b['id']}});})['then'](function(_0x2d33ef){if(!_[_0x55d9('0x18')](_0x2d33ef)){throw new Error(_0x55d9('0x2a')+_0x24ced2[_0x55d9('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0xe9f90b['id']);}return _0x249036[_0x55d9('0x22')]['create']({'phone':_0x24ced2[_0x55d9('0xd')],'ContactId':_0x24ced2['id'],'ListId':_0x24ced2['ListId'],'priority':_0x24ced2[_0x55d9('0x26')]?_0x24ced2[_0x55d9('0x26')]:0x2,'scheduledat':_0x24ced2[_0x55d9('0x15')]?_0x24ced2[_0x55d9('0x15')]:moment()[_0x55d9('0x16')](_0x55d9('0x17')),'callback':_0x24ced2[_0x55d9('0x27')]?!![]:![],'callbackuniqueid':_0x24ced2['callbackUniqueid']?_0x24ced2[_0x55d9('0x27')]:undefined,'callbackat':_0x24ced2[_0x55d9('0x27')]?moment()[_0x55d9('0x16')](_0x55d9('0x17')):undefined,'VoiceQueueId':_0xe9f90b['id']});})['catch'](function(_0x28dda1){_0x5ac769(_0x28dda1);});});});};function _0x9d8520(){return function(_0x3b460b){logger[_0x55d9('0x2b')]('cmContact',_0x55d9('0x2c'),util[_0x55d9('0x2d')](_0x3b460b,{'showHidden':![],'depth':null}));};}function _0x122eff(_0x42d315,_0x32ba55){var _0x1ceb00=_0x32ba55['scheduledat']?_0x32ba55[_0x55d9('0x15')]:moment()[_0x55d9('0x16')](_0x55d9('0x17'));return new BPromise(function(_0x511251,_0x519b06){if(_['isNil'](_0x32ba55['dialTimezone'])){_0x511251({'ret':_0x1ceb00});}else{_0x249036['Campaign'][_0x55d9('0x1a')]({'where':{'id':_0x42d315['id']}})[_0x55d9('0x20')](function(_0x1377d3){if(!_[_0x55d9('0x18')](_0x1377d3)){var _0x4548a0=_0x1377d3[_0x55d9('0x1b')];if(!_[_0x55d9('0x18')](_0x4548a0)){var _0x288e7e=shared[_0x55d9('0x1c')];var _0x14404c=_0x288e7e[_0x4548a0];var _0x574287=_0x288e7e[_0x32ba55['dialTimezone']];if(!_[_0x55d9('0x18')](_0x14404c)&&!_[_0x55d9('0x18')](_0x574287)){var _0x55a110=_0x14404c[_0x55d9('0x1d')]-_0x574287['utcOffset'];_0x1ceb00=_0x32ba55[_0x55d9('0x15')]?_0x32ba55[_0x55d9('0x15')]:moment();var _0x1af0cd=moment(_0x1ceb00)[_0x55d9('0x1e')](_0x55a110,_0x55d9('0x1f'));_0x511251({'ret':_0x1af0cd[_0x55d9('0x16')](_0x55d9('0x17'))});}else _0x511251({'ret':_0x1ceb00});}else _0x511251({'ret':_0x1ceb00});}else{_0x511251({'ret':_0x1ceb00});}});}});return 0xa;}var _0x3b8ab9=function(_0x28f7eb){return new BPromise(function(_0x47d730,_0x2084ed){_0x122eff(_0x28f7eb,_0x24ced2)[_0x55d9('0x20')](function(_0x4518df){_0x24ced2[_0x55d9('0x15')]=_0x4518df['ret'];_0x249036['CmHopper']['findOne']({'where':{'phone':_0x24ced2[_0x55d9('0xd')],'CampaignId':_0x28f7eb['id']}})['then'](function(_0xffcf2d){if(!_[_0x55d9('0x18')](_0xffcf2d)){throw new Error('cmContact,\x20afterCreate\x20'+_0x24ced2[_0x55d9('0xd')]+_0x55d9('0x2e')+_0x28f7eb['id']);}return _0x249036[_0x55d9('0x22')]['create']({'phone':_0x24ced2['phone'],'ContactId':_0x24ced2['id'],'ListId':_0x24ced2[_0x55d9('0x25')],'priority':_0x24ced2[_0x55d9('0x26')]?_0x24ced2[_0x55d9('0x26')]:0x2,'scheduledat':_0x24ced2[_0x55d9('0x15')]?_0x24ced2['scheduledat']:moment()[_0x55d9('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x24ced2[_0x55d9('0x27')]?!![]:![],'callbackuniqueid':_0x24ced2['callbackUniqueid']?_0x24ced2[_0x55d9('0x27')]:undefined,'callbackat':_0x24ced2[_0x55d9('0x27')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x28f7eb['id']});})[_0x55d9('0x28')](function(_0x1238bd){_0x2084ed(_0x1238bd);});});});};var _0x4ce641=function(_0x20dcde){return new BPromise(function(_0x4270d1,_0x109e4e){_0x122eff(_0x20dcde,_0x24ced2)['then'](function(_0x83c5b6){_0x24ced2[_0x55d9('0x15')]=_0x83c5b6[_0x55d9('0x21')];_0x249036['CmHopper']['findOne']({'where':{'phone':_0x24ced2[_0x55d9('0xd')],'CampaignId':_0x20dcde['id']}})['then'](function(_0x344a7e){if(!_[_0x55d9('0x18')](_0x344a7e)){throw new Error('cmContact,\x20afterCreate\x20'+_0x24ced2[_0x55d9('0xd')]+_0x55d9('0x2f')+_0x20dcde['id']);}return _0x249036['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x24ced2[_0x55d9('0xd')],'CampaignId':_0x20dcde['id']}});})[_0x55d9('0x20')](function(_0x100c25){if(!_[_0x55d9('0x18')](_0x100c25)){throw new Error(_0x55d9('0x2a')+_0x24ced2[_0x55d9('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x20dcde['id']);}return _0x249036[_0x55d9('0x22')]['create']({'phone':_0x24ced2[_0x55d9('0xd')],'ContactId':_0x24ced2['id'],'ListId':_0x24ced2[_0x55d9('0x25')],'priority':_0x24ced2[_0x55d9('0x26')]?_0x24ced2[_0x55d9('0x26')]:0x2,'scheduledat':_0x24ced2[_0x55d9('0x15')]?_0x24ced2[_0x55d9('0x15')]:moment()[_0x55d9('0x16')](_0x55d9('0x17')),'callback':_0x24ced2['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x24ced2[_0x55d9('0x27')]?_0x24ced2[_0x55d9('0x27')]:undefined,'callbackat':_0x24ced2['callbackUniqueid']?moment()[_0x55d9('0x16')](_0x55d9('0x17')):undefined,'CampaignId':_0x20dcde['id']});})[_0x55d9('0x28')](function(_0xc04c35){_0x109e4e(_0xc04c35);});});});};if(_0x24ced2[_0x55d9('0x25')]){_0x249036['VoiceQueue'][_0x55d9('0x30')]({'where':{'type':_0x55d9('0x31')},'attributes':['id',_0x55d9('0x32'),_0x55d9('0x1b')],'include':[{'model':_0x249036[_0x55d9('0x33')],'as':_0x55d9('0x34'),'where':{'id':_0x24ced2[_0x55d9('0x25')]}}]})[_0x55d9('0x20')](function(_0x39b3f5){if(_0x39b3f5){var _0x54d9a7=[];for(var _0x10b757=0x0,_0x4b2054;_0x10b757<_0x39b3f5[_0x55d9('0x35')];_0x10b757+=0x1){_0x4b2054=_0x39b3f5[_0x10b757][_0x55d9('0x14')]({'plain':!![]});switch(_0x4b2054[_0x55d9('0x32')]){case _0x55d9('0x36'):_0xce4d79(_0x4b2054)[_0x55d9('0x28')](_0x159d52());break;case _0x55d9('0x37'):_0x4c1feb(_0x4b2054)[_0x55d9('0x28')](_0x159d52());break;default:_0x122eff(_0x4b2054,_0x24ced2)[_0x55d9('0x20')](function(_0x206f1a){_0x24ced2[_0x55d9('0x15')]=_0x206f1a[_0x55d9('0x21')];_0x249036['CmHopper']['create']({'phone':_0x24ced2[_0x55d9('0xd')],'ContactId':_0x24ced2['id'],'ListId':_0x24ced2[_0x55d9('0x25')],'scheduledat':_0x24ced2[_0x55d9('0x15')]?_0x24ced2[_0x55d9('0x15')]:moment()['format'](_0x55d9('0x17')),'priority':_0x24ced2[_0x55d9('0x26')]?_0x24ced2['priority']:0x2,'callback':_0x24ced2[_0x55d9('0x27')]?!![]:![],'callbackuniqueid':_0x24ced2[_0x55d9('0x27')]?_0x24ced2[_0x55d9('0x27')]:undefined,'callbackat':_0x24ced2['callbackUniqueid']?moment()[_0x55d9('0x16')](_0x55d9('0x17')):undefined,'VoiceQueueId':_0x4b2054['id']})[_0x55d9('0x28')](_0x159d52());});}}}})[_0x55d9('0x20')](function(){return _0x249036[_0x55d9('0x19')][_0x55d9('0x30')]({'where':{'type':_0x55d9('0x31')},'attributes':['id'],'include':[{'model':_0x249036[_0x55d9('0x33')],'as':'BlackLists','where':{'id':_0x24ced2[_0x55d9('0x25')]}}]})['then'](function(_0x5e7bbb){if(_0x5e7bbb){var _0x5edc94=[];for(var _0x2b04cc=0x0,_0x5a2042;_0x2b04cc<_0x5e7bbb['length'];_0x2b04cc+=0x1){_0x5a2042=_0x5e7bbb[_0x2b04cc]['get']({'plain':!![]});_0x249036[_0x55d9('0x38')][_0x55d9('0x24')]({'phone':_0x24ced2[_0x55d9('0xd')],'ContactId':_0x24ced2['id'],'ListId':_0x24ced2[_0x55d9('0x25')],'VoiceQueueId':_0x5a2042['id']})[_0x55d9('0x28')](function(_0x5ec0a9){logger['error'](_0x55d9('0x39'),_0x55d9('0x2c'),_0x5ec0a9[_0x55d9('0x3a')]);});}}});})[_0x55d9('0x20')](function(){return _0x249036[_0x55d9('0x3b')][_0x55d9('0x30')]({'attributes':['id','dialCheckDuplicateType',_0x55d9('0x1b')],'include':[{'model':_0x249036[_0x55d9('0x33')],'as':_0x55d9('0x34'),'where':{'id':_0x24ced2['ListId']}}]})[_0x55d9('0x20')](function(_0x30e76e){if(_0x30e76e){var _0x4e9132=[];for(var _0x324a48=0x0,_0x400a5a;_0x324a48<_0x30e76e['length'];_0x324a48+=0x1){_0x400a5a=_0x30e76e[_0x324a48]['get']({'plain':!![]});switch(_0x400a5a[_0x55d9('0x32')]){case _0x55d9('0x36'):_0x4ce641(_0x400a5a)[_0x55d9('0x28')](_0x9d8520());break;case'onlyIfOpen':_0x3b8ab9(_0x400a5a)[_0x55d9('0x28')](_0x9d8520());break;default:_0x249036[_0x55d9('0x22')][_0x55d9('0x24')]({'phone':_0x24ced2[_0x55d9('0xd')],'ContactId':_0x24ced2['id'],'ListId':_0x24ced2[_0x55d9('0x25')],'scheduledat':_0x24ced2[_0x55d9('0x15')]?_0x24ced2[_0x55d9('0x15')]:moment()[_0x55d9('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x24ced2[_0x55d9('0x26')]?_0x24ced2[_0x55d9('0x26')]:0x2,'callback':_0x24ced2[_0x55d9('0x27')]?!![]:![],'callbackuniqueid':_0x24ced2[_0x55d9('0x27')]?_0x24ced2[_0x55d9('0x27')]:undefined,'callbackat':_0x24ced2['callbackUniqueid']?moment()[_0x55d9('0x16')](_0x55d9('0x17')):undefined,'CampaignId':_0x400a5a['id']})[_0x55d9('0x28')](_0x9d8520());}}}});})['then'](function(){return _0x249036['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x249036[_0x55d9('0x33')],'as':'BlackLists','where':{'id':_0x24ced2[_0x55d9('0x25')]}}]})['then'](function(_0x17cfb3){if(_0x17cfb3){var _0x533303=[];for(var _0x18adb8=0x0,_0x50a6bc;_0x18adb8<_0x17cfb3['length'];_0x18adb8+=0x1){_0x50a6bc=_0x17cfb3[_0x18adb8][_0x55d9('0x14')]({'plain':!![]});_0x249036[_0x55d9('0x38')][_0x55d9('0x24')]({'phone':_0x24ced2[_0x55d9('0xd')],'ContactId':_0x24ced2['id'],'ListId':_0x24ced2[_0x55d9('0x25')],'CampaignId':_0x50a6bc['id']})[_0x55d9('0x28')](function(_0x4f95a2){logger[_0x55d9('0x2b')](_0x55d9('0x39'),_0x55d9('0x2c'),_0x4f95a2[_0x55d9('0x3a')]);});}}});})[_0x55d9('0x20')](function(){_0x5a71d6();})[_0x55d9('0x28')](function(_0x476165){logger[_0x55d9('0x2b')](_0x55d9('0x39'),_0x55d9('0x2c'),_0x476165['message']);_0x5a71d6(_0x476165);});}else{_0x5a71d6(new Error(_0x55d9('0x3c')));}},'afterDestroy':function(_0x1612ea,_0x16ed90,_0x13647a){var _0x759f45=_0x583ecf['models'];var _0x579bba=_0x1612ea['get']({'plain':!![]});return _0x759f45[_0x55d9('0x22')][_0x55d9('0x30')]({'raw':!![],'where':{'ListId':_0x579bba['ListId'],'ContactId':_0x579bba['id']}})[_0x55d9('0x20')](function(_0x43bc4e){if(!_['isEmpty'](_0x43bc4e)){var _0x3227cf=[];for(var _0x3759dc=0x0;_0x3759dc<_0x43bc4e['length'];_0x3759dc+=0x1){var _0x3ef7a4=_0x759f45['CmHopper'][_0x55d9('0x3d')]({'where':{'ListId':_0x43bc4e[_0x3759dc]['ListId'],'ContactId':_0x43bc4e[_0x3759dc][_0x55d9('0x3e')],'VoiceQueueId':_0x43bc4e[_0x3759dc][_0x55d9('0x3f')],'CampaignId':_0x43bc4e[_0x3759dc][_0x55d9('0x40')]}});_0x3227cf['push'](_0x3ef7a4);}return BPromise[_0x55d9('0x41')](_0x3227cf);}})[_0x55d9('0x20')](function(_0x21c701){logger['info']('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x21c701,{'showHidden':![],'depth':null}));_0x13647a();})[_0x55d9('0x28')](function(_0x16777e){logger[_0x55d9('0x2b')]('[CmContact][afterDestroy][Error]',util['inspect'](_0x16777e,{'showHidden':![],'depth':null}));_0x13647a(_0x16777e);});}}});}; \ No newline at end of file +var _0xe949=['phone','fti_cm_contacts','firstName','lastName','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','add','minutes','then','cmContact,\x20afterCreate\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','length','dialCheckDuplicateType','always','onlyIfOpen','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Lists','BlackLists','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','../../config/logger','moment','request-promise','path','./cmContact.attributes','CmContact','cm_contacts'];(function(_0x2d04da,_0x14e534){var _0x4229c0=function(_0x201959){while(--_0x201959){_0x2d04da['push'](_0x2d04da['shift']());}};_0x4229c0(++_0x14e534);}(_0xe949,0xca));var _0x9e94=function(_0x77b8bd,_0x1fb418){_0x77b8bd=_0x77b8bd-0x0;var _0xb100f=_0xe949[_0x77b8bd];return _0xb100f;};'use strict';var _=require(_0x9e94('0x0'));var util=require('util');var logger=require(_0x9e94('0x1'))('api');var moment=require(_0x9e94('0x2'));var BPromise=require('bluebird');var rp=require(_0x9e94('0x3'));var fs=require('fs');var path=require(_0x9e94('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require(_0x9e94('0x5'));module['exports']=function(_0x2e15b6,_0x195f84){return _0x2e15b6['define'](_0x9e94('0x6'),attributes,{'tableName':_0x9e94('0x7'),'paranoid':!![],'indexes':[{'name':_0x9e94('0x8'),'fields':[_0x9e94('0x8')]},{'name':_0x9e94('0x9'),'fields':[_0x9e94('0xa'),_0x9e94('0xb'),_0x9e94('0x8'),'mobile','fax','email'],'type':_0x9e94('0xc')}],'timestamps':!![],'charset':_0x9e94('0xd'),'collate':_0x9e94('0xe'),'hooks':{'afterCreate':function(_0x57e1cc,_0x1b3185,_0x475f5b){var _0x35c340=_0x2e15b6['models'];var _0x38327e=_0x57e1cc[_0x9e94('0xf')]({'plain':!![]});function _0x26702b(){return function(_0x8f670b){logger[_0x9e94('0x10')](_0x9e94('0x11'),_0x9e94('0x12'),util[_0x9e94('0x13')](_0x8f670b,{'showHidden':![],'depth':null}));};}function _0xa55782(_0x5cda0f,_0x1be1af){var _0x4fbe24=_0x1be1af['scheduledat']?_0x1be1af[_0x9e94('0x14')]:moment()[_0x9e94('0x15')](_0x9e94('0x16'));return new BPromise(function(_0x1d7e8c,_0x25c4cf){if(_[_0x9e94('0x17')](_0x1be1af[_0x9e94('0x18')])){_0x1d7e8c({'ret':_0x4fbe24});}else{_0x35c340[_0x9e94('0x19')][_0x9e94('0x1a')]({'where':{'id':_0x5cda0f['id']}})['then'](function(_0x1cfe9f){if(!_[_0x9e94('0x17')](_0x1cfe9f)){var _0xac9082=_0x1cfe9f[_0x9e94('0x18')];if(!_[_0x9e94('0x17')](_0xac9082)){var _0x50687c=shared[_0x9e94('0x1b')];var _0x455d67=_0x50687c[_0xac9082];var _0x463ce1=_0x50687c[_0x1be1af[_0x9e94('0x18')]];if(!_[_0x9e94('0x17')](_0x455d67)&&!_[_0x9e94('0x17')](_0x463ce1)){var _0xfe3716=_0x455d67['utcOffset']-_0x463ce1[_0x9e94('0x1c')];_0x4fbe24=_0x1be1af[_0x9e94('0x14')]?_0x1be1af[_0x9e94('0x14')]:moment();var _0x63c435=moment(_0x4fbe24)[_0x9e94('0x1d')](_0xfe3716,_0x9e94('0x1e'));_0x1d7e8c({'ret':_0x63c435[_0x9e94('0x15')](_0x9e94('0x16'))});}else _0x1d7e8c({'ret':_0x4fbe24});}else _0x1d7e8c({'ret':_0x4fbe24});}else{_0x1d7e8c({'ret':_0x4fbe24});}});}});return 0xa;}var _0x2f774d=function(_0x272c2b){return new BPromise(function(_0x1e9249,_0x272243){_0xa55782(_0x272c2b,_0x38327e)[_0x9e94('0x1f')](function(_0x1e3177){_0x38327e[_0x9e94('0x14')]=_0x1e3177['ret'];_0x35c340['CmHopper'][_0x9e94('0x1a')]({'where':{'phone':_0x38327e['phone'],'VoiceQueueId':_0x272c2b['id']}})[_0x9e94('0x1f')](function(_0x23842e){if(!_[_0x9e94('0x17')](_0x23842e)){throw new Error(_0x9e94('0x20')+_0x38327e[_0x9e94('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x272c2b['id']);}return _0x35c340[_0x9e94('0x21')][_0x9e94('0x22')]({'phone':_0x38327e['phone'],'ContactId':_0x38327e['id'],'ListId':_0x38327e[_0x9e94('0x23')],'priority':_0x38327e['priority']?_0x38327e[_0x9e94('0x24')]:0x2,'scheduledat':_0x38327e[_0x9e94('0x14')]?_0x38327e[_0x9e94('0x14')]:moment()[_0x9e94('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x38327e[_0x9e94('0x25')]?!![]:![],'callbackuniqueid':_0x38327e[_0x9e94('0x25')]?_0x38327e[_0x9e94('0x25')]:undefined,'callbackat':_0x38327e[_0x9e94('0x25')]?moment()['format'](_0x9e94('0x16')):undefined,'VoiceQueueId':_0x272c2b['id']});})[_0x9e94('0x26')](function(_0x3d2c54){_0x272243(_0x3d2c54);});});});};var _0x3032c4=function(_0xdbbb0){return new BPromise(function(_0x3ff3f4,_0x5d652d){_0xa55782(_0xdbbb0,_0x38327e)[_0x9e94('0x1f')](function(_0x59c02d){_0x38327e['scheduledat']=_0x59c02d[_0x9e94('0x27')];_0x35c340[_0x9e94('0x21')][_0x9e94('0x1a')]({'where':{'phone':_0x38327e[_0x9e94('0x8')],'VoiceQueueId':_0xdbbb0['id']}})[_0x9e94('0x1f')](function(_0x5779d8){if(!_[_0x9e94('0x17')](_0x5779d8)){throw new Error(_0x9e94('0x20')+_0x38327e[_0x9e94('0x8')]+_0x9e94('0x28')+_0xdbbb0['id']);}return _0x35c340['CmHopperFinal'][_0x9e94('0x1a')]({'where':{'calleridnum':_0x38327e[_0x9e94('0x8')],'VoiceQueueId':_0xdbbb0['id']}});})[_0x9e94('0x1f')](function(_0x562a9d){if(!_[_0x9e94('0x17')](_0x562a9d)){throw new Error(_0x9e94('0x29')+_0x38327e[_0x9e94('0x8')]+_0x9e94('0x2a')+_0xdbbb0['id']);}return _0x35c340['CmHopper'][_0x9e94('0x22')]({'phone':_0x38327e[_0x9e94('0x8')],'ContactId':_0x38327e['id'],'ListId':_0x38327e[_0x9e94('0x23')],'priority':_0x38327e[_0x9e94('0x24')]?_0x38327e[_0x9e94('0x24')]:0x2,'scheduledat':_0x38327e['scheduledat']?_0x38327e[_0x9e94('0x14')]:moment()[_0x9e94('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x38327e[_0x9e94('0x25')]?!![]:![],'callbackuniqueid':_0x38327e['callbackUniqueid']?_0x38327e['callbackUniqueid']:undefined,'callbackat':_0x38327e[_0x9e94('0x25')]?moment()[_0x9e94('0x15')](_0x9e94('0x16')):undefined,'VoiceQueueId':_0xdbbb0['id']});})['catch'](function(_0x55f7ed){_0x5d652d(_0x55f7ed);});});});};function _0x46bcf5(){return function(_0x40ef88){logger[_0x9e94('0x10')](_0x9e94('0x11'),_0x9e94('0x12'),util[_0x9e94('0x13')](_0x40ef88,{'showHidden':![],'depth':null}));};}function _0x3a520a(_0x6a24ee,_0x29192a){var _0x49f352=_0x29192a[_0x9e94('0x14')]?_0x29192a[_0x9e94('0x14')]:moment()[_0x9e94('0x15')](_0x9e94('0x16'));return new BPromise(function(_0x28cd4c,_0x47fc4b){if(_[_0x9e94('0x17')](_0x29192a['dialTimezone'])){_0x28cd4c({'ret':_0x49f352});}else{_0x35c340[_0x9e94('0x2b')][_0x9e94('0x1a')]({'where':{'id':_0x6a24ee['id']}})['then'](function(_0x4577de){if(!_[_0x9e94('0x17')](_0x4577de)){var _0x1650dc=_0x4577de[_0x9e94('0x18')];if(!_[_0x9e94('0x17')](_0x1650dc)){var _0xb513ac=shared[_0x9e94('0x1b')];var _0x12df56=_0xb513ac[_0x1650dc];var _0x3509ee=_0xb513ac[_0x29192a[_0x9e94('0x18')]];if(!_[_0x9e94('0x17')](_0x12df56)&&!_[_0x9e94('0x17')](_0x3509ee)){var _0x12071f=_0x12df56[_0x9e94('0x1c')]-_0x3509ee[_0x9e94('0x1c')];_0x49f352=_0x29192a[_0x9e94('0x14')]?_0x29192a[_0x9e94('0x14')]:moment();var _0x564848=moment(_0x49f352)['add'](_0x12071f,_0x9e94('0x1e'));_0x28cd4c({'ret':_0x564848[_0x9e94('0x15')](_0x9e94('0x16'))});}else _0x28cd4c({'ret':_0x49f352});}else _0x28cd4c({'ret':_0x49f352});}else{_0x28cd4c({'ret':_0x49f352});}});}});return 0xa;}var _0x2848aa=function(_0x12208a){return new BPromise(function(_0x348c42,_0x334bce){_0x3a520a(_0x12208a,_0x38327e)['then'](function(_0x5db1a3){_0x38327e['scheduledat']=_0x5db1a3[_0x9e94('0x27')];_0x35c340[_0x9e94('0x21')][_0x9e94('0x1a')]({'where':{'phone':_0x38327e['phone'],'CampaignId':_0x12208a['id']}})[_0x9e94('0x1f')](function(_0x27bcdf){if(!_['isNil'](_0x27bcdf)){throw new Error('cmContact,\x20afterCreate\x20'+_0x38327e[_0x9e94('0x8')]+_0x9e94('0x2c')+_0x12208a['id']);}return _0x35c340[_0x9e94('0x21')]['create']({'phone':_0x38327e['phone'],'ContactId':_0x38327e['id'],'ListId':_0x38327e[_0x9e94('0x23')],'priority':_0x38327e[_0x9e94('0x24')]?_0x38327e[_0x9e94('0x24')]:0x2,'scheduledat':_0x38327e[_0x9e94('0x14')]?_0x38327e[_0x9e94('0x14')]:moment()[_0x9e94('0x15')](_0x9e94('0x16')),'callback':_0x38327e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x38327e['callbackUniqueid']?_0x38327e[_0x9e94('0x25')]:undefined,'callbackat':_0x38327e[_0x9e94('0x25')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x12208a['id']});})['catch'](function(_0x38fb88){_0x334bce(_0x38fb88);});});});};var _0x4e4f86=function(_0x3d9f91){return new BPromise(function(_0x102e88,_0x447d0c){_0x3a520a(_0x3d9f91,_0x38327e)['then'](function(_0x30d8bb){_0x38327e[_0x9e94('0x14')]=_0x30d8bb[_0x9e94('0x27')];_0x35c340[_0x9e94('0x21')][_0x9e94('0x1a')]({'where':{'phone':_0x38327e[_0x9e94('0x8')],'CampaignId':_0x3d9f91['id']}})['then'](function(_0xf46537){if(!_[_0x9e94('0x17')](_0xf46537)){throw new Error(_0x9e94('0x20')+_0x38327e[_0x9e94('0x8')]+_0x9e94('0x2d')+_0x3d9f91['id']);}return _0x35c340['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x38327e[_0x9e94('0x8')],'CampaignId':_0x3d9f91['id']}});})[_0x9e94('0x1f')](function(_0x2d1abb){if(!_[_0x9e94('0x17')](_0x2d1abb)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x38327e[_0x9e94('0x8')]+_0x9e94('0x2e')+_0x3d9f91['id']);}return _0x35c340[_0x9e94('0x21')][_0x9e94('0x22')]({'phone':_0x38327e['phone'],'ContactId':_0x38327e['id'],'ListId':_0x38327e[_0x9e94('0x23')],'priority':_0x38327e['priority']?_0x38327e[_0x9e94('0x24')]:0x2,'scheduledat':_0x38327e['scheduledat']?_0x38327e[_0x9e94('0x14')]:moment()[_0x9e94('0x15')](_0x9e94('0x16')),'callback':_0x38327e[_0x9e94('0x25')]?!![]:![],'callbackuniqueid':_0x38327e['callbackUniqueid']?_0x38327e['callbackUniqueid']:undefined,'callbackat':_0x38327e['callbackUniqueid']?moment()[_0x9e94('0x15')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3d9f91['id']});})[_0x9e94('0x26')](function(_0x54a218){_0x447d0c(_0x54a218);});});});};if(_0x38327e['ListId']){_0x35c340['VoiceQueue'][_0x9e94('0x2f')]({'where':{'type':_0x9e94('0x30')},'attributes':['id','dialCheckDuplicateType',_0x9e94('0x18')],'include':[{'model':_0x35c340[_0x9e94('0x31')],'as':'Lists','where':{'id':_0x38327e['ListId']}}]})['then'](function(_0x40e453){if(_0x40e453){var _0x56e424=[];for(var _0x220807=0x0,_0x1f4967;_0x220807<_0x40e453[_0x9e94('0x32')];_0x220807+=0x1){_0x1f4967=_0x40e453[_0x220807]['get']({'plain':!![]});switch(_0x1f4967[_0x9e94('0x33')]){case _0x9e94('0x34'):_0x3032c4(_0x1f4967)[_0x9e94('0x26')](_0x26702b());break;case _0x9e94('0x35'):_0x2f774d(_0x1f4967)['catch'](_0x26702b());break;default:_0x3a520a(_0x1f4967,_0x38327e)[_0x9e94('0x1f')](function(_0x37e081){_0x38327e[_0x9e94('0x14')]=_0x37e081[_0x9e94('0x27')];_0x35c340[_0x9e94('0x21')][_0x9e94('0x22')]({'phone':_0x38327e[_0x9e94('0x8')],'ContactId':_0x38327e['id'],'ListId':_0x38327e[_0x9e94('0x23')],'scheduledat':_0x38327e[_0x9e94('0x14')]?_0x38327e[_0x9e94('0x14')]:moment()['format'](_0x9e94('0x16')),'priority':_0x38327e[_0x9e94('0x24')]?_0x38327e[_0x9e94('0x24')]:0x2,'callback':_0x38327e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x38327e['callbackUniqueid']?_0x38327e[_0x9e94('0x25')]:undefined,'callbackat':_0x38327e['callbackUniqueid']?moment()[_0x9e94('0x15')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1f4967['id']})[_0x9e94('0x26')](_0x26702b());});}}}})[_0x9e94('0x1f')](function(){return _0x35c340['VoiceQueue'][_0x9e94('0x2f')]({'where':{'type':_0x9e94('0x30')},'attributes':['id'],'include':[{'model':_0x35c340[_0x9e94('0x31')],'as':'BlackLists','where':{'id':_0x38327e[_0x9e94('0x23')]}}]})[_0x9e94('0x1f')](function(_0x64933a){if(_0x64933a){var _0x14516c=[];for(var _0xddf6ea=0x0,_0x185994;_0xddf6ea<_0x64933a[_0x9e94('0x32')];_0xddf6ea+=0x1){_0x185994=_0x64933a[_0xddf6ea][_0x9e94('0xf')]({'plain':!![]});_0x35c340[_0x9e94('0x36')][_0x9e94('0x22')]({'phone':_0x38327e[_0x9e94('0x8')],'ContactId':_0x38327e['id'],'ListId':_0x38327e['ListId'],'VoiceQueueId':_0x185994['id']})[_0x9e94('0x26')](function(_0xccd8cb){logger[_0x9e94('0x10')](_0x9e94('0x37'),_0x9e94('0x12'),_0xccd8cb[_0x9e94('0x38')]);});}}});})[_0x9e94('0x1f')](function(){return _0x35c340['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType',_0x9e94('0x18')],'include':[{'model':_0x35c340[_0x9e94('0x31')],'as':_0x9e94('0x39'),'where':{'id':_0x38327e[_0x9e94('0x23')]}}]})['then'](function(_0xd22373){if(_0xd22373){var _0x21bdee=[];for(var _0x20a2b2=0x0,_0x22b89d;_0x20a2b2<_0xd22373[_0x9e94('0x32')];_0x20a2b2+=0x1){_0x22b89d=_0xd22373[_0x20a2b2][_0x9e94('0xf')]({'plain':!![]});switch(_0x22b89d['dialCheckDuplicateType']){case _0x9e94('0x34'):_0x4e4f86(_0x22b89d)[_0x9e94('0x26')](_0x46bcf5());break;case _0x9e94('0x35'):_0x2848aa(_0x22b89d)[_0x9e94('0x26')](_0x46bcf5());break;default:_0x35c340['CmHopper'][_0x9e94('0x22')]({'phone':_0x38327e['phone'],'ContactId':_0x38327e['id'],'ListId':_0x38327e[_0x9e94('0x23')],'scheduledat':_0x38327e[_0x9e94('0x14')]?_0x38327e['scheduledat']:moment()[_0x9e94('0x15')](_0x9e94('0x16')),'priority':_0x38327e[_0x9e94('0x24')]?_0x38327e['priority']:0x2,'callback':_0x38327e[_0x9e94('0x25')]?!![]:![],'callbackuniqueid':_0x38327e['callbackUniqueid']?_0x38327e[_0x9e94('0x25')]:undefined,'callbackat':_0x38327e[_0x9e94('0x25')]?moment()[_0x9e94('0x15')](_0x9e94('0x16')):undefined,'CampaignId':_0x22b89d['id']})[_0x9e94('0x26')](_0x46bcf5());}}}});})[_0x9e94('0x1f')](function(){return _0x35c340[_0x9e94('0x2b')][_0x9e94('0x2f')]({'attributes':['id'],'include':[{'model':_0x35c340[_0x9e94('0x31')],'as':_0x9e94('0x3a'),'where':{'id':_0x38327e[_0x9e94('0x23')]}}]})['then'](function(_0x36fb1d){if(_0x36fb1d){var _0xd1e58d=[];for(var _0x264c47=0x0,_0x2b65e5;_0x264c47<_0x36fb1d[_0x9e94('0x32')];_0x264c47+=0x1){_0x2b65e5=_0x36fb1d[_0x264c47][_0x9e94('0xf')]({'plain':!![]});_0x35c340['CmHopperBlack'][_0x9e94('0x22')]({'phone':_0x38327e['phone'],'ContactId':_0x38327e['id'],'ListId':_0x38327e['ListId'],'CampaignId':_0x2b65e5['id']})[_0x9e94('0x26')](function(_0x1f6967){logger[_0x9e94('0x10')](_0x9e94('0x37'),_0x9e94('0x12'),_0x1f6967[_0x9e94('0x38')]);});}}});})[_0x9e94('0x1f')](function(){_0x475f5b();})['catch'](function(_0x3ef1e4){logger['error'](_0x9e94('0x37'),_0x9e94('0x12'),_0x3ef1e4[_0x9e94('0x38')]);_0x475f5b(_0x3ef1e4);});}else{_0x475f5b(new Error(_0x9e94('0x3b')));}},'afterDestroy':function(_0x5ad188,_0x4c4dc7,_0x53cd30){var _0x116875=_0x2e15b6[_0x9e94('0x3c')];var _0x432491=_0x5ad188[_0x9e94('0xf')]({'plain':!![]});return _0x116875[_0x9e94('0x21')][_0x9e94('0x2f')]({'raw':!![],'where':{'ListId':_0x432491['ListId'],'ContactId':_0x432491['id']}})[_0x9e94('0x1f')](function(_0x9e8cea){if(!_[_0x9e94('0x3d')](_0x9e8cea)){var _0x29058c=[];for(var _0xd1ae27=0x0;_0xd1ae27<_0x9e8cea[_0x9e94('0x32')];_0xd1ae27+=0x1){var _0x46a809=_0x116875[_0x9e94('0x21')][_0x9e94('0x3e')]({'where':{'ListId':_0x9e8cea[_0xd1ae27][_0x9e94('0x23')],'ContactId':_0x9e8cea[_0xd1ae27][_0x9e94('0x3f')],'VoiceQueueId':_0x9e8cea[_0xd1ae27][_0x9e94('0x40')],'CampaignId':_0x9e8cea[_0xd1ae27][_0x9e94('0x41')]}});_0x29058c[_0x9e94('0x42')](_0x46a809);}return BPromise[_0x9e94('0x43')](_0x29058c);}})[_0x9e94('0x1f')](function(_0x2cb4eb){logger[_0x9e94('0x44')](_0x9e94('0x45'),util[_0x9e94('0x13')](_0x2cb4eb,{'showHidden':![],'depth':null}));_0x53cd30();})['catch'](function(_0x2fa8ce){logger['error']('[CmContact][afterDestroy][Error]',util['inspect'](_0x2fa8ce,{'showHidden':![],'depth':null}));_0x53cd30(_0x2fa8ce);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index efce196..e7e6ac0 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(_0x24150e,_0xc3662e){var _0x1f1dfd=function(_0x4ab3da){while(--_0x4ab3da){_0x24150e['push'](_0x24150e['shift']());}};_0x1f1dfd(++_0xc3662e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x49fb72,_0x3ba006){var _0x3111e1=function(_0xeb0d8e){while(--_0xeb0d8e){_0x49fb72['push'](_0x49fb72['shift']());}};_0x3111e1(++_0x3ba006);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 44f8ff2..2948004 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 _0xc68d=['STRING','PHONE','exports','INTEGER'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc68d,0x17a));var _0xdc68=function(_0x470670,_0x39fddd){_0x470670=_0x470670-0x0;var _0x4901ce=_0xc68d[_0x470670];return _0x4901ce;};'use strict';var Sequelize=require('sequelize');module[_0xdc68('0x0')]={'CmContactId':{'type':Sequelize[_0xdc68('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xdc68('0x2')],'defaultValue':_0xdc68('0x3')},'OrderBy':{'type':Sequelize[_0xdc68('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xdc68('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xaced=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x31c480,_0x13f64a){var _0x3687ce=function(_0x46fbc0){while(--_0x46fbc0){_0x31c480['push'](_0x31c480['shift']());}};_0x3687ce(++_0x13f64a);}(_0xaced,0x18c));var _0xdace=function(_0x58a7d1,_0x3852a9){_0x58a7d1=_0x58a7d1-0x0;var _0x1c97a4=_0xaced[_0x58a7d1];return _0x1c97a4;};'use strict';var Sequelize=require(_0xdace('0x0'));module[_0xdace('0x1')]={'CmContactId':{'type':Sequelize[_0xdace('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xdace('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xdace('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xdace('0x4')},'OrderBy':{'type':Sequelize[_0xdace('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xdace('0x3')],'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 7dae0f8..07b3d2e 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 _0x5490=['error','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmContactHasItem','rows','catch','show','params','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','destroy','then','CmContactHasItems','end'];(function(_0x33fb76,_0x450ed3){var _0x41033e=function(_0x14ed5e){while(--_0x14ed5e){_0x33fb76['push'](_0x33fb76['shift']());}};_0x41033e(++_0x450ed3);}(_0x5490,0xca));var _0x0549=function(_0x4d77cc,_0xcaf146){_0x4d77cc=_0x4d77cc-0x0;var _0x24ae59=_0x5490[_0x4d77cc];return _0x24ae59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0549('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0549('0x1'));var rp=require(_0x0549('0x2'));var moment=require(_0x0549('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0549('0x4'));var util=require(_0x0549('0x5'));var path=require(_0x0549('0x6'));var sox=require(_0x0549('0x7'));var csv=require('to-csv');var ejs=require(_0x0549('0x8'));var fs=require('fs');var fs_extra=require(_0x0549('0x9'));var _=require(_0x0549('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0549('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0549('0xc'));var querystring=require(_0x0549('0xd'));var Papa=require(_0x0549('0xe'));var Redis=require(_0x0549('0xf'));var authService=require(_0x0549('0x10'));var qs=require(_0x0549('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0549('0x12'))(_0x0549('0x13'));var utils=require(_0x0549('0x14'));var config=require(_0x0549('0x15'));var licenseUtil=require(_0x0549('0x16'));var db=require(_0x0549('0x17'))['db'];function respondWithStatusCode(_0x344e29,_0x3550a9){_0x3550a9=_0x3550a9||0xcc;return function(_0x41f82f){if(_0x41f82f){return _0x344e29[_0x0549('0x18')](_0x3550a9);}return _0x344e29[_0x0549('0x19')](_0x3550a9)['end']();};}function respondWithResult(_0x5d45cd,_0x14a044){_0x14a044=_0x14a044||0xc8;return function(_0x2bf86b){if(_0x2bf86b){return _0x5d45cd['status'](_0x14a044)[_0x0549('0x1a')](_0x2bf86b);}};}function respondWithFilteredResult(_0x414324,_0x27f993){return function(_0x1f33c1){if(_0x1f33c1){var _0x205764=typeof _0x27f993[_0x0549('0x1b')]==='undefined'&&typeof _0x27f993[_0x0549('0x1c')]==='undefined';var _0x5e622c=_0x1f33c1[_0x0549('0x1d')];var _0x3d6337=_0x205764?0x0:_0x27f993[_0x0549('0x1b')];var _0x52cd6e=_0x205764?_0x1f33c1[_0x0549('0x1d')]:_0x27f993[_0x0549('0x1b')]+_0x27f993[_0x0549('0x1c')];var _0x1c73e3;if(_0x52cd6e>=_0x5e622c){_0x52cd6e=_0x5e622c;_0x1c73e3=0xc8;}else{_0x1c73e3=0xce;}_0x414324[_0x0549('0x19')](_0x1c73e3);return _0x414324[_0x0549('0x1e')](_0x0549('0x1f'),_0x3d6337+'-'+_0x52cd6e+'/'+_0x5e622c)[_0x0549('0x1a')](_0x1f33c1);}return null;};}function patchUpdates(_0x15cc22){return function(_0x1269d4){try{jsonpatch[_0x0549('0x20')](_0x1269d4,_0x15cc22,!![]);}catch(_0x49e8c7){return BPromise['reject'](_0x49e8c7);}return _0x1269d4[_0x0549('0x21')]();};}function saveUpdates(_0x57bd61,_0xecc0fd){return function(_0x4057ac){if(_0x4057ac){return _0x4057ac['update'](_0x57bd61)['then'](function(_0x4ebd6b){return _0x4ebd6b;});}return null;};}function removeEntity(_0x45f2d0,_0x1575d2){return function(_0x23e04e){if(_0x23e04e){return _0x23e04e[_0x0549('0x22')]()[_0x0549('0x23')](function(){var _0x716aa8=_0x23e04e['get']({'plain':!![]});var _0x5e734f=_0x0549('0x24');return db['UserProfileResource'][_0x0549('0x22')]({'where':{'type':_0x5e734f,'resourceId':_0x716aa8['id']}})[_0x0549('0x23')](function(){return _0x23e04e;});})[_0x0549('0x23')](function(){_0x45f2d0[_0x0549('0x19')](0xcc)[_0x0549('0x25')]();});}};}function handleEntityNotFound(_0xfe9cc4,_0x347017){return function(_0x12bf10){if(!_0x12bf10){_0xfe9cc4[_0x0549('0x18')](0x194);}return _0x12bf10;};}function handleError(_0x343563,_0x12a8b8){_0x12a8b8=_0x12a8b8||0x1f4;return function(_0x149827){logger[_0x0549('0x26')](_0x149827['stack']);if(_0x149827[_0x0549('0x27')]){delete _0x149827[_0x0549('0x27')];}_0x343563[_0x0549('0x19')](_0x12a8b8)['send'](_0x149827);};}exports[_0x0549('0x28')]=function(_0x5306d8,_0xc0da60){var _0x1c2ded={},_0x809e6c={},_0x5b9da2={'count':0x0,'rows':[]};var _0x3d9ecf=_[_0x0549('0x29')](db['CmContactHasItem']['rawAttributes'],function(_0x39e0ea){return{'name':_0x39e0ea[_0x0549('0x2a')],'type':_0x39e0ea[_0x0549('0x2b')][_0x0549('0x2c')]};});_0x809e6c[_0x0549('0x2d')]=_[_0x0549('0x29')](_0x3d9ecf,'name');_0x809e6c[_0x0549('0x2e')]=_[_0x0549('0x2f')](_0x5306d8[_0x0549('0x2e')]);_0x809e6c[_0x0549('0x30')]=_[_0x0549('0x31')](_0x809e6c[_0x0549('0x2d')],_0x809e6c['query']);_0x1c2ded['attributes']=_[_0x0549('0x31')](_0x809e6c[_0x0549('0x2d')],qs[_0x0549('0x32')](_0x5306d8['query'][_0x0549('0x32')]));_0x1c2ded[_0x0549('0x33')]=_0x1c2ded['attributes']['length']?_0x1c2ded[_0x0549('0x33')]:_0x809e6c['model'];if(!_0x5306d8['query'][_0x0549('0x34')](_0x0549('0x35'))){_0x1c2ded[_0x0549('0x1c')]=qs['limit'](_0x5306d8[_0x0549('0x2e')][_0x0549('0x1c')]);_0x1c2ded[_0x0549('0x1b')]=qs['offset'](_0x5306d8[_0x0549('0x2e')][_0x0549('0x1b')]);}_0x1c2ded[_0x0549('0x36')]=qs[_0x0549('0x37')](_0x5306d8[_0x0549('0x2e')][_0x0549('0x37')]);_0x1c2ded[_0x0549('0x38')]=qs['filters'](_[_0x0549('0x39')](_0x5306d8[_0x0549('0x2e')],_0x809e6c[_0x0549('0x30')]),_0x3d9ecf);if(_0x5306d8['query'][_0x0549('0x3a')]){_0x1c2ded[_0x0549('0x38')]=_[_0x0549('0x3b')](_0x1c2ded[_0x0549('0x38')],{'$or':_[_0x0549('0x29')](_0x3d9ecf,function(_0x103d93){if(_0x103d93[_0x0549('0x2b')]!==_0x0549('0x3c')){var _0x5c33ad={};_0x5c33ad[_0x103d93['name']]={'$like':'%'+_0x5306d8[_0x0549('0x2e')][_0x0549('0x3a')]+'%'};return _0x5c33ad;}})});}_0x1c2ded=_[_0x0549('0x3b')]({},_0x1c2ded,_0x5306d8[_0x0549('0x3d')]);var _0x3a089d={'where':_0x1c2ded[_0x0549('0x38')]};return db[_0x0549('0x3e')][_0x0549('0x1d')](_0x3a089d)[_0x0549('0x23')](function(_0x480421){_0x5b9da2[_0x0549('0x1d')]=_0x480421;if(_0x5306d8[_0x0549('0x2e')]['includeAll']){_0x1c2ded['include']=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x1c2ded);})[_0x0549('0x23')](function(_0x3a3811){_0x5b9da2[_0x0549('0x3f')]=_0x3a3811;return _0x5b9da2;})[_0x0549('0x23')](respondWithFilteredResult(_0xc0da60,_0x1c2ded))[_0x0549('0x40')](handleError(_0xc0da60,null));};exports[_0x0549('0x41')]=function(_0x17850d,_0x4f4e08){var _0x55b6a1={'raw':!![],'where':{'id':_0x17850d[_0x0549('0x42')]['id']}},_0x2a1d65={};_0x2a1d65[_0x0549('0x2d')]=_[_0x0549('0x2f')](db[_0x0549('0x3e')][_0x0549('0x43')]);_0x2a1d65[_0x0549('0x2e')]=_[_0x0549('0x2f')](_0x17850d[_0x0549('0x2e')]);_0x2a1d65['filters']=_[_0x0549('0x31')](_0x2a1d65['model'],_0x2a1d65[_0x0549('0x2e')]);_0x55b6a1[_0x0549('0x33')]=_[_0x0549('0x31')](_0x2a1d65[_0x0549('0x2d')],qs[_0x0549('0x32')](_0x17850d[_0x0549('0x2e')][_0x0549('0x32')]));_0x55b6a1['attributes']=_0x55b6a1[_0x0549('0x33')]['length']?_0x55b6a1[_0x0549('0x33')]:_0x2a1d65[_0x0549('0x2d')];if(_0x17850d[_0x0549('0x2e')]['includeAll']){_0x55b6a1[_0x0549('0x44')]=[{'all':!![]}];}_0x55b6a1=_[_0x0549('0x3b')]({},_0x55b6a1,_0x17850d['options']);return db[_0x0549('0x3e')][_0x0549('0x45')](_0x55b6a1)[_0x0549('0x23')](handleEntityNotFound(_0x4f4e08,null))[_0x0549('0x23')](respondWithResult(_0x4f4e08,null))['catch'](handleError(_0x4f4e08,null));};exports['create']=function(_0x4d9554,_0x300fde){return db[_0x0549('0x3e')][_0x0549('0x46')](_0x4d9554[_0x0549('0x47')],{})[_0x0549('0x23')](function(_0x4ddef0){var _0x454137=_0x4d9554['user'][_0x0549('0x48')]({'plain':!![]});if(!_0x454137)throw new Error(_0x0549('0x49'));if(_0x454137[_0x0549('0x4a')]==='user'){var _0x55dd0a=_0x4ddef0['get']({'plain':!![]});var _0x2de78e=_0x0549('0x24');return db[_0x0549('0x4b')][_0x0549('0x45')]({'where':{'name':_0x2de78e,'userProfileId':_0x454137[_0x0549('0x4c')]},'raw':!![]})[_0x0549('0x23')](function(_0x220d8b){if(_0x220d8b&&_0x220d8b[_0x0549('0x4d')]===0x0){return db[_0x0549('0x4e')]['create']({'name':_0x55dd0a['name'],'resourceId':_0x55dd0a['id'],'type':_0x220d8b[_0x0549('0x27')],'sectionId':_0x220d8b['id']},{})[_0x0549('0x23')](function(){return _0x4ddef0;});}else{return _0x4ddef0;}})['catch'](function(_0x5b20f6){logger[_0x0549('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b20f6);throw _0x5b20f6;});}return _0x4ddef0;})[_0x0549('0x23')](respondWithResult(_0x300fde,0xc9))[_0x0549('0x40')](handleError(_0x300fde,null));};exports[_0x0549('0x4f')]=function(_0x435ff7,_0x4060bd){if(_0x435ff7['body']['id']){delete _0x435ff7[_0x0549('0x47')]['id'];}return db[_0x0549('0x3e')][_0x0549('0x45')]({'where':{'id':_0x435ff7[_0x0549('0x42')]['id']}})[_0x0549('0x23')](handleEntityNotFound(_0x4060bd,null))['then'](saveUpdates(_0x435ff7[_0x0549('0x47')],null))[_0x0549('0x23')](respondWithResult(_0x4060bd,null))[_0x0549('0x40')](handleError(_0x4060bd,null));};exports['destroy']=function(_0x39c3bd,_0x2667fa){return db[_0x0549('0x3e')]['find']({'where':{'id':_0x39c3bd[_0x0549('0x42')]['id']}})[_0x0549('0x23')](handleEntityNotFound(_0x2667fa,null))[_0x0549('0x23')](removeEntity(_0x2667fa,null))[_0x0549('0x40')](handleError(_0x2667fa,null));}; \ No newline at end of file +var _0xaa8a=['status','set','Content-Range','apply','reject','update','then','destroy','get','stack','name','send','index','map','CmContactHasItem','type','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','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','json','undefined','limit','count','offset'];(function(_0x302567,_0x1fafe1){var _0x1caa42=function(_0x44129c){while(--_0x44129c){_0x302567['push'](_0x302567['shift']());}};_0x1caa42(++_0x1fafe1);}(_0xaa8a,0x85));var _0xaaa8=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xaa8a[_0xd0b415];return _0x2bdf2c;};'use strict';var emlformat=require(_0xaaa8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaaa8('0x1'));var jsonpatch=require(_0xaaa8('0x2'));var rp=require('request-promise');var moment=require(_0xaaa8('0x3'));var BPromise=require(_0xaaa8('0x4'));var Mustache=require('mustache');var util=require(_0xaaa8('0x5'));var path=require(_0xaaa8('0x6'));var sox=require('sox');var csv=require(_0xaaa8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaaa8('0x8'));var crypto=require(_0xaaa8('0x9'));var jsforce=require(_0xaaa8('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaaa8('0xb'));var Papa=require(_0xaaa8('0xc'));var Redis=require(_0xaaa8('0xd'));var authService=require(_0xaaa8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xaaa8('0xf'));var hardwareService=require(_0xaaa8('0x10'));var logger=require(_0xaaa8('0x11'))(_0xaaa8('0x12'));var utils=require(_0xaaa8('0x13'));var config=require(_0xaaa8('0x14'));var licenseUtil=require(_0xaaa8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fc64c,_0x27551c){_0x27551c=_0x27551c||0xcc;return function(_0x4f7e30){if(_0x4f7e30){return _0x1fc64c[_0xaaa8('0x16')](_0x27551c);}return _0x1fc64c['status'](_0x27551c)[_0xaaa8('0x17')]();};}function respondWithResult(_0x31511b,_0x532c77){_0x532c77=_0x532c77||0xc8;return function(_0x8c51e4){if(_0x8c51e4){return _0x31511b['status'](_0x532c77)[_0xaaa8('0x18')](_0x8c51e4);}};}function respondWithFilteredResult(_0x5810b4,_0x4680ab){return function(_0x149fb4){if(_0x149fb4){var _0x5c2af0=typeof _0x4680ab['offset']===_0xaaa8('0x19')&&typeof _0x4680ab[_0xaaa8('0x1a')]===_0xaaa8('0x19');var _0x1dc5ac=_0x149fb4[_0xaaa8('0x1b')];var _0x24b29c=_0x5c2af0?0x0:_0x4680ab[_0xaaa8('0x1c')];var _0x4ab3b9=_0x5c2af0?_0x149fb4['count']:_0x4680ab['offset']+_0x4680ab[_0xaaa8('0x1a')];var _0x3b16e4;if(_0x4ab3b9>=_0x1dc5ac){_0x4ab3b9=_0x1dc5ac;_0x3b16e4=0xc8;}else{_0x3b16e4=0xce;}_0x5810b4[_0xaaa8('0x1d')](_0x3b16e4);return _0x5810b4[_0xaaa8('0x1e')](_0xaaa8('0x1f'),_0x24b29c+'-'+_0x4ab3b9+'/'+_0x1dc5ac)[_0xaaa8('0x18')](_0x149fb4);}return null;};}function patchUpdates(_0x86135c){return function(_0x2c8194){try{jsonpatch[_0xaaa8('0x20')](_0x2c8194,_0x86135c,!![]);}catch(_0xba9076){return BPromise[_0xaaa8('0x21')](_0xba9076);}return _0x2c8194['save']();};}function saveUpdates(_0x216c90,_0x58f860){return function(_0x4dd3b2){if(_0x4dd3b2){return _0x4dd3b2[_0xaaa8('0x22')](_0x216c90)[_0xaaa8('0x23')](function(_0xeb7fd2){return _0xeb7fd2;});}return null;};}function removeEntity(_0xbc17e7,_0x2fca00){return function(_0x28f6fc){if(_0x28f6fc){return _0x28f6fc[_0xaaa8('0x24')]()['then'](function(){var _0x10048b=_0x28f6fc[_0xaaa8('0x25')]({'plain':!![]});var _0xab30bd='CmContactHasItems';return db['UserProfileResource'][_0xaaa8('0x24')]({'where':{'type':_0xab30bd,'resourceId':_0x10048b['id']}})[_0xaaa8('0x23')](function(){return _0x28f6fc;});})[_0xaaa8('0x23')](function(){_0xbc17e7[_0xaaa8('0x1d')](0xcc)[_0xaaa8('0x17')]();});}};}function handleEntityNotFound(_0xcc7b0e,_0x370e11){return function(_0x3ff022){if(!_0x3ff022){_0xcc7b0e['sendStatus'](0x194);}return _0x3ff022;};}function handleError(_0x48ac1d,_0x51ab1a){_0x51ab1a=_0x51ab1a||0x1f4;return function(_0x665872){logger['error'](_0x665872[_0xaaa8('0x26')]);if(_0x665872[_0xaaa8('0x27')]){delete _0x665872['name'];}_0x48ac1d[_0xaaa8('0x1d')](_0x51ab1a)[_0xaaa8('0x28')](_0x665872);};}exports[_0xaaa8('0x29')]=function(_0x45abc7,_0x1d3959){var _0x36244b={},_0x129d05={},_0x284016={'count':0x0,'rows':[]};var _0x54fc52=_[_0xaaa8('0x2a')](db[_0xaaa8('0x2b')]['rawAttributes'],function(_0x3aadba){return{'name':_0x3aadba['fieldName'],'type':_0x3aadba[_0xaaa8('0x2c')]['key']};});_0x129d05['model']=_[_0xaaa8('0x2a')](_0x54fc52,_0xaaa8('0x27'));_0x129d05[_0xaaa8('0x2d')]=_['keys'](_0x45abc7[_0xaaa8('0x2d')]);_0x129d05[_0xaaa8('0x2e')]=_['intersection'](_0x129d05[_0xaaa8('0x2f')],_0x129d05['query']);_0x36244b[_0xaaa8('0x30')]=_[_0xaaa8('0x31')](_0x129d05[_0xaaa8('0x2f')],qs['fields'](_0x45abc7[_0xaaa8('0x2d')][_0xaaa8('0x32')]));_0x36244b[_0xaaa8('0x30')]=_0x36244b['attributes'][_0xaaa8('0x33')]?_0x36244b[_0xaaa8('0x30')]:_0x129d05[_0xaaa8('0x2f')];if(!_0x45abc7[_0xaaa8('0x2d')]['hasOwnProperty'](_0xaaa8('0x34'))){_0x36244b['limit']=qs[_0xaaa8('0x1a')](_0x45abc7[_0xaaa8('0x2d')][_0xaaa8('0x1a')]);_0x36244b[_0xaaa8('0x1c')]=qs['offset'](_0x45abc7[_0xaaa8('0x2d')][_0xaaa8('0x1c')]);}_0x36244b[_0xaaa8('0x35')]=qs[_0xaaa8('0x36')](_0x45abc7['query']['sort']);_0x36244b[_0xaaa8('0x37')]=qs[_0xaaa8('0x2e')](_[_0xaaa8('0x38')](_0x45abc7[_0xaaa8('0x2d')],_0x129d05[_0xaaa8('0x2e')]),_0x54fc52);if(_0x45abc7[_0xaaa8('0x2d')][_0xaaa8('0x39')]){_0x36244b[_0xaaa8('0x37')]=_[_0xaaa8('0x3a')](_0x36244b['where'],{'$or':_[_0xaaa8('0x2a')](_0x54fc52,function(_0xd0352a){if(_0xd0352a['type']!==_0xaaa8('0x3b')){var _0x5ef2df={};_0x5ef2df[_0xd0352a[_0xaaa8('0x27')]]={'$like':'%'+_0x45abc7[_0xaaa8('0x2d')]['filter']+'%'};return _0x5ef2df;}})});}_0x36244b=_[_0xaaa8('0x3a')]({},_0x36244b,_0x45abc7[_0xaaa8('0x3c')]);var _0xcb409={'where':_0x36244b[_0xaaa8('0x37')]};return db['CmContactHasItem']['count'](_0xcb409)[_0xaaa8('0x23')](function(_0x3c1cb7){_0x284016['count']=_0x3c1cb7;if(_0x45abc7[_0xaaa8('0x2d')][_0xaaa8('0x3d')]){_0x36244b[_0xaaa8('0x3e')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xaaa8('0x3f')](_0x36244b);})['then'](function(_0x44828c){_0x284016['rows']=_0x44828c;return _0x284016;})[_0xaaa8('0x23')](respondWithFilteredResult(_0x1d3959,_0x36244b))[_0xaaa8('0x40')](handleError(_0x1d3959,null));};exports[_0xaaa8('0x41')]=function(_0xd05702,_0xc7276e){var _0x1da6ff={'raw':!![],'where':{'id':_0xd05702[_0xaaa8('0x42')]['id']}},_0x5616ca={};_0x5616ca[_0xaaa8('0x2f')]=_['keys'](db['CmContactHasItem'][_0xaaa8('0x43')]);_0x5616ca[_0xaaa8('0x2d')]=_[_0xaaa8('0x44')](_0xd05702['query']);_0x5616ca[_0xaaa8('0x2e')]=_[_0xaaa8('0x31')](_0x5616ca['model'],_0x5616ca[_0xaaa8('0x2d')]);_0x1da6ff[_0xaaa8('0x30')]=_[_0xaaa8('0x31')](_0x5616ca[_0xaaa8('0x2f')],qs[_0xaaa8('0x32')](_0xd05702[_0xaaa8('0x2d')][_0xaaa8('0x32')]));_0x1da6ff[_0xaaa8('0x30')]=_0x1da6ff['attributes'][_0xaaa8('0x33')]?_0x1da6ff[_0xaaa8('0x30')]:_0x5616ca[_0xaaa8('0x2f')];if(_0xd05702['query'][_0xaaa8('0x3d')]){_0x1da6ff['include']=[{'all':!![]}];}_0x1da6ff=_[_0xaaa8('0x3a')]({},_0x1da6ff,_0xd05702['options']);return db[_0xaaa8('0x2b')][_0xaaa8('0x45')](_0x1da6ff)[_0xaaa8('0x23')](handleEntityNotFound(_0xc7276e,null))[_0xaaa8('0x23')](respondWithResult(_0xc7276e,null))[_0xaaa8('0x40')](handleError(_0xc7276e,null));};exports[_0xaaa8('0x46')]=function(_0x3bb951,_0x232aac){return db[_0xaaa8('0x2b')][_0xaaa8('0x46')](_0x3bb951[_0xaaa8('0x47')],{})['then'](function(_0x4caf03){var _0x5e7776=_0x3bb951[_0xaaa8('0x48')][_0xaaa8('0x25')]({'plain':!![]});if(!_0x5e7776)throw new Error(_0xaaa8('0x49'));if(_0x5e7776[_0xaaa8('0x4a')]===_0xaaa8('0x48')){var _0x29aa9b=_0x4caf03['get']({'plain':!![]});var _0x51d479=_0xaaa8('0x4b');return db[_0xaaa8('0x4c')][_0xaaa8('0x45')]({'where':{'name':_0x51d479,'userProfileId':_0x5e7776['userProfileId']},'raw':!![]})[_0xaaa8('0x23')](function(_0x380191){if(_0x380191&&_0x380191[_0xaaa8('0x4d')]===0x0){return db[_0xaaa8('0x4e')][_0xaaa8('0x46')]({'name':_0x29aa9b[_0xaaa8('0x27')],'resourceId':_0x29aa9b['id'],'type':_0x380191['name'],'sectionId':_0x380191['id']},{})['then'](function(){return _0x4caf03;});}else{return _0x4caf03;}})[_0xaaa8('0x40')](function(_0x383aa7){logger[_0xaaa8('0x4f')](_0xaaa8('0x50'),_0x383aa7);throw _0x383aa7;});}return _0x4caf03;})['then'](respondWithResult(_0x232aac,0xc9))[_0xaaa8('0x40')](handleError(_0x232aac,null));};exports['update']=function(_0x40180f,_0xc0acbe){if(_0x40180f[_0xaaa8('0x47')]['id']){delete _0x40180f[_0xaaa8('0x47')]['id'];}return db['CmContactHasItem'][_0xaaa8('0x45')]({'where':{'id':_0x40180f[_0xaaa8('0x42')]['id']}})[_0xaaa8('0x23')](handleEntityNotFound(_0xc0acbe,null))[_0xaaa8('0x23')](saveUpdates(_0x40180f[_0xaaa8('0x47')],null))['then'](respondWithResult(_0xc0acbe,null))['catch'](handleError(_0xc0acbe,null));};exports['destroy']=function(_0x1729af,_0x4e7b15){return db[_0xaaa8('0x2b')]['find']({'where':{'id':_0x1729af[_0xaaa8('0x42')]['id']}})[_0xaaa8('0x23')](handleEntityNotFound(_0x4e7b15,null))[_0xaaa8('0x23')](removeEntity(_0x4e7b15,null))[_0xaaa8('0x40')](handleError(_0x4e7b15,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 39bf84e..57b290d 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 _0x11e3=['exports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x1a5c43,_0x16de09){var _0x3a7675=function(_0x5efc39){while(--_0x5efc39){_0x1a5c43['push'](_0x1a5c43['shift']());}};_0x3a7675(++_0x16de09);}(_0x11e3,0x1f0));var _0x311e=function(_0x5247f8,_0x3c61a4){_0x5247f8=_0x5247f8-0x0;var _0x128759=_0x11e3[_0x5247f8];return _0x128759;};'use strict';var _=require(_0x311e('0x0'));var util=require(_0x311e('0x1'));var logger=require(_0x311e('0x2'))(_0x311e('0x3'));var moment=require(_0x311e('0x4'));var BPromise=require(_0x311e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x311e('0x6'));var rimraf=require(_0x311e('0x7'));var config=require(_0x311e('0x8'));var attributes=require(_0x311e('0x9'));module[_0x311e('0xa')]=function(_0x45ec76,_0x18506e){return _0x45ec76['define']('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b88=['rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0x8b88,0x14a));var _0x88b8=function(_0x2349f8,_0x55eb2a){_0x2349f8=_0x2349f8-0x0;var _0x4a904a=_0x8b88[_0x2349f8];return _0x4a904a;};'use strict';var _=require('lodash');var util=require(_0x88b8('0x0'));var logger=require(_0x88b8('0x1'))('api');var moment=require(_0x88b8('0x2'));var BPromise=require(_0x88b8('0x3'));var rp=require(_0x88b8('0x4'));var fs=require('fs');var path=require(_0x88b8('0x5'));var rimraf=require(_0x88b8('0x6'));var config=require(_0x88b8('0x7'));var attributes=require(_0x88b8('0x8'));module[_0x88b8('0x9')]=function(_0x5949c6,_0x64a40d){return _0x5949c6['define'](_0x88b8('0xa'),attributes,{'tableName':_0x88b8('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 f40119c..fa06fa8 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 _0xb7c7=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xb7c7,0x175));var _0x7b7c=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0xb7c7[_0x1f3aec];return _0x409f0d;};'use strict';var _=require(_0x7b7c('0x0'));var util=require(_0x7b7c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7b7c('0x2'));var fs=require('fs');var Redis=require(_0x7b7c('0x3'));var db=require(_0x7b7c('0x4'))['db'];var utils=require(_0x7b7c('0x5'));var logger=require(_0x7b7c('0x6'))(_0x7b7c('0x7'));var config=require(_0x7b7c('0x8'));var jayson=require(_0x7b7c('0x9'));var client=jayson[_0x7b7c('0xa')][_0x7b7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x455b02,_0x4f7444,_0x492999){return new BPromise(function(_0x25393d,_0x432110){return client[_0x7b7c('0xc')](_0x455b02,_0x492999)['then'](function(_0x3e0766){logger[_0x7b7c('0xd')](_0x7b7c('0xe'),_0x4f7444,_0x7b7c('0xf'));logger[_0x7b7c('0x10')](_0x7b7c('0x11'),_0x4f7444,_0x7b7c('0xf'),JSON['stringify'](_0x3e0766));if(_0x3e0766[_0x7b7c('0x12')]){if(_0x3e0766[_0x7b7c('0x12')][_0x7b7c('0x13')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4f7444,_0x3e0766['error'][_0x7b7c('0x14')]);return _0x432110(_0x3e0766[_0x7b7c('0x12')][_0x7b7c('0x14')]);}logger[_0x7b7c('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x4f7444,_0x3e0766[_0x7b7c('0x12')][_0x7b7c('0x14')]);return _0x25393d(_0x3e0766[_0x7b7c('0x12')][_0x7b7c('0x14')]);}else{logger[_0x7b7c('0xd')](_0x7b7c('0xe'),_0x4f7444,'request\x20sent');_0x25393d(_0x3e0766['result'][_0x7b7c('0x14')]);}})[_0x7b7c('0x15')](function(_0x513041){logger[_0x7b7c('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x4f7444,_0x513041);_0x432110(_0x513041);});});} \ No newline at end of file +var _0xc887=['error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x442203,_0x4b0d6f){var _0x49d2d4=function(_0x4fc200){while(--_0x4fc200){_0x442203['push'](_0x442203['shift']());}};_0x49d2d4(++_0x4b0d6f);}(_0xc887,0x10b));var _0x7c88=function(_0x35f0b7,_0xe77778){_0x35f0b7=_0x35f0b7-0x0;var _0x333b69=_0xc887[_0x35f0b7];return _0x333b69;};'use strict';var _=require(_0x7c88('0x0'));var util=require(_0x7c88('0x1'));var moment=require('moment');var BPromise=require(_0x7c88('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c88('0x3'));var db=require(_0x7c88('0x4'))['db'];var utils=require(_0x7c88('0x5'));var logger=require(_0x7c88('0x6'))(_0x7c88('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c88('0x8'));var client=jayson[_0x7c88('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2708ad,_0x345ffa,_0xc13a5a){return new BPromise(function(_0xfa66a4,_0x3ad92d){return client[_0x7c88('0xa')](_0x2708ad,_0xc13a5a)[_0x7c88('0xb')](function(_0x422ed6){logger[_0x7c88('0xc')](_0x7c88('0xd'),_0x345ffa,_0x7c88('0xe'));logger[_0x7c88('0xf')](_0x7c88('0x10'),_0x345ffa,_0x7c88('0xe'),JSON[_0x7c88('0x11')](_0x422ed6));if(_0x422ed6['error']){if(_0x422ed6['error'][_0x7c88('0x12')]===0x1f4){logger['error'](_0x7c88('0xd'),_0x345ffa,_0x422ed6[_0x7c88('0x13')]['message']);return _0x3ad92d(_0x422ed6['error'][_0x7c88('0x14')]);}logger[_0x7c88('0x13')](_0x7c88('0xd'),_0x345ffa,_0x422ed6[_0x7c88('0x13')]['message']);return _0xfa66a4(_0x422ed6[_0x7c88('0x13')][_0x7c88('0x14')]);}else{logger[_0x7c88('0xc')](_0x7c88('0xd'),_0x345ffa,'request\x20sent');_0xfa66a4(_0x422ed6['result'][_0x7c88('0x14')]);}})[_0x7c88('0x15')](function(_0x10499f){logger[_0x7c88('0x13')](_0x7c88('0xd'),_0x345ffa,_0x10499f);_0x3ad92d(_0x10499f);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 7b0a0b0..ee3ebc0 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 _0xdae9=['../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','create','put','update','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xb83b3a,_0xd08bd8){var _0x1d4e6a=function(_0x4da2ef){while(--_0x4da2ef){_0xb83b3a['push'](_0xb83b3a['shift']());}};_0x1d4e6a(++_0xd08bd8);}(_0xdae9,0x15e));var _0x9dae=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdae9[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x9dae('0x0'));var path=require('path');var timeout=require(_0x9dae('0x1'));var express=require(_0x9dae('0x2'));var router=express[_0x9dae('0x3')]();var fs_extra=require(_0x9dae('0x4'));var auth=require(_0x9dae('0x5'));var interaction=require(_0x9dae('0x6'));var config=require(_0x9dae('0x7'));var controller=require(_0x9dae('0x8'));router[_0x9dae('0x9')]('/',auth[_0x9dae('0xa')](),controller['index']);router[_0x9dae('0x9')](_0x9dae('0xb'),auth['isAuthenticated'](),controller[_0x9dae('0xc')]);router['post']('/',auth[_0x9dae('0xa')](),controller[_0x9dae('0xd')]);router[_0x9dae('0xe')]('/:id',auth[_0x9dae('0xa')](),controller[_0x9dae('0xf')]);router[_0x9dae('0x10')](_0x9dae('0xb'),auth[_0x9dae('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x91c5=['post','create','put','update','delete','destroy','exports','util','express','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','/:id','show'];(function(_0x329d3f,_0x2ecfe2){var _0x54fede=function(_0x4ff69a){while(--_0x4ff69a){_0x329d3f['push'](_0x329d3f['shift']());}};_0x54fede(++_0x2ecfe2);}(_0x91c5,0x124));var _0x591c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x91c5[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x591c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x591c('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x591c('0x2'));var controller=require(_0x591c('0x3'));router['get']('/',auth[_0x591c('0x4')](),controller[_0x591c('0x5')]);router['get'](_0x591c('0x6'),auth['isAuthenticated'](),controller[_0x591c('0x7')]);router[_0x591c('0x8')]('/',auth[_0x591c('0x4')](),controller[_0x591c('0x9')]);router[_0x591c('0xa')](_0x591c('0x6'),auth[_0x591c('0x4')](),controller[_0x591c('0xb')]);router[_0x591c('0xc')](_0x591c('0x6'),auth[_0x591c('0x4')](),controller[_0x591c('0xd')]);module[_0x591c('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 83a17a7..6efb56b 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 _0x55e3=['VIRTUAL','getDataValue','STRING','setDataValue','alias','name','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports'];(function(_0x122091,_0x2fb0dc){var _0x28b9ca=function(_0x1577e6){while(--_0x1577e6){_0x122091['push'](_0x122091['shift']());}};_0x28b9ca(++_0x2fb0dc);}(_0x55e3,0x177));var _0x355e=function(_0xa8ba63,_0x41601f){_0xa8ba63=_0xa8ba63-0x0;var _0x585b3b=_0x55e3[_0xa8ba63];return _0x585b3b;};'use strict';var Sequelize=require(_0x355e('0x0'));var _=require(_0x355e('0x1'));module[_0x355e('0x2')]={'name':{'type':Sequelize[_0x355e('0x3')],'get':function(_0x1f9eea){return this[_0x355e('0x4')]('alias');}},'alias':{'type':Sequelize[_0x355e('0x5')],'allowNull':![],'set':function(_0xca1e05){this[_0x355e('0x6')](_0x355e('0x7'),_0xca1e05?_0xca1e05:this[_0x355e('0x4')](_0x355e('0x8')));}},'type':{'type':Sequelize[_0x355e('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x355e('0x9')),'get':function(){if(this[_0x355e('0x4')](_0x355e('0xa'))===_0x355e('0xb')){return JSON[_0x355e('0xc')](this[_0x355e('0x4')](_0x355e('0xd')));}else{return this['getDataValue'](_0x355e('0xd'));}},'set':function(_0x3c8f73){if(Array[_0x355e('0xe')](_0x3c8f73)){this[_0x355e('0x6')]('values',JSON[_0x355e('0xf')](_0x3c8f73));}else{this['setDataValue'](_0x355e('0xd'),_0x3c8f73);}}},'required':{'type':Sequelize[_0x355e('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x355e('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x355e('0x11')]('voice')}}; \ No newline at end of file +var _0x966f=['isArray','stringify','BOOLEAN','ENUM','voice','sequelize','VIRTUAL','getDataValue','setDataValue','name','STRING','TEXT','long','select','parse','values'];(function(_0x4c5fab,_0x48d244){var _0x2d153e=function(_0x1edda7){while(--_0x1edda7){_0x4c5fab['push'](_0x4c5fab['shift']());}};_0x2d153e(++_0x48d244);}(_0x966f,0x105));var _0xf966=function(_0x55ee61,_0x26393e){_0x55ee61=_0x55ee61-0x0;var _0x58710e=_0x966f[_0x55ee61];return _0x58710e;};'use strict';var Sequelize=require(_0xf966('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xf966('0x1')],'get':function(_0x2b690a){return this[_0xf966('0x2')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x110724){this[_0xf966('0x3')]('alias',_0x110724?_0x110724:this[_0xf966('0x2')](_0xf966('0x4')));}},'type':{'type':Sequelize[_0xf966('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf966('0x6')](_0xf966('0x7')),'get':function(){if(this[_0xf966('0x2')]('type')===_0xf966('0x8')){return JSON[_0xf966('0x9')](this['getDataValue']('values'));}else{return this[_0xf966('0x2')](_0xf966('0xa'));}},'set':function(_0x3a24d9){if(Array[_0xf966('0xb')](_0x3a24d9)){this[_0xf966('0x3')](_0xf966('0xa'),JSON[_0xf966('0xc')](_0x3a24d9));}else{this[_0xf966('0x3')](_0xf966('0xa'),_0x3a24d9);}}},'required':{'type':Sequelize[_0xf966('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf966('0xe')](_0xf966('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 1542a37..7cafded 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 _0x8a10=['create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','defaultValue','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','CmCustomField','fieldName','type','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','update','body'];(function(_0x49f100,_0xa57605){var _0x299fb4=function(_0x170bf6){while(--_0x170bf6){_0x49f100['push'](_0x49f100['shift']());}};_0x299fb4(++_0xa57605);}(_0x8a10,0x10b));var _0x08a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a10[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x08a1('0x0'));var rimraf=require(_0x08a1('0x1'));var zipdir=require(_0x08a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x08a1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x08a1('0x4'));var util=require(_0x08a1('0x5'));var path=require('path');var sox=require(_0x08a1('0x6'));var csv=require(_0x08a1('0x7'));var ejs=require(_0x08a1('0x8'));var fs=require('fs');var fs_extra=require(_0x08a1('0x9'));var _=require(_0x08a1('0xa'));var squel=require(_0x08a1('0xb'));var crypto=require(_0x08a1('0xc'));var jsforce=require(_0x08a1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x08a1('0xe'));var Papa=require(_0x08a1('0xf'));var Redis=require(_0x08a1('0x10'));var authService=require(_0x08a1('0x11'));var qs=require(_0x08a1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08a1('0x13'));var logger=require(_0x08a1('0x14'))('api');var utils=require(_0x08a1('0x15'));var config=require(_0x08a1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x08a1('0x17'))['db'];function respondWithStatusCode(_0x309ca8,_0x31daa4){_0x31daa4=_0x31daa4||0xcc;return function(_0x172a00){if(_0x172a00){return _0x309ca8['sendStatus'](_0x31daa4);}return _0x309ca8[_0x08a1('0x18')](_0x31daa4)[_0x08a1('0x19')]();};}function respondWithResult(_0x60255a,_0x11ef81){_0x11ef81=_0x11ef81||0xc8;return function(_0x529e34){if(_0x529e34){return _0x60255a[_0x08a1('0x18')](_0x11ef81)[_0x08a1('0x1a')](_0x529e34);}};}function respondWithFilteredResult(_0x5c0f87,_0x31419d){return function(_0x263942){if(_0x263942){var _0x1a9992=typeof _0x31419d[_0x08a1('0x1b')]===_0x08a1('0x1c')&&typeof _0x31419d[_0x08a1('0x1d')]==='undefined';var _0x1ceb7c=_0x263942[_0x08a1('0x1e')];var _0x18e44d=_0x1a9992?0x0:_0x31419d[_0x08a1('0x1b')];var _0x65cead=_0x1a9992?_0x263942[_0x08a1('0x1e')]:_0x31419d[_0x08a1('0x1b')]+_0x31419d[_0x08a1('0x1d')];var _0x27d17a;if(_0x65cead>=_0x1ceb7c){_0x65cead=_0x1ceb7c;_0x27d17a=0xc8;}else{_0x27d17a=0xce;}_0x5c0f87[_0x08a1('0x18')](_0x27d17a);return _0x5c0f87[_0x08a1('0x1f')](_0x08a1('0x20'),_0x18e44d+'-'+_0x65cead+'/'+_0x1ceb7c)[_0x08a1('0x1a')](_0x263942);}return null;};}function patchUpdates(_0x2a28df){return function(_0x746bf5){try{jsonpatch[_0x08a1('0x21')](_0x746bf5,_0x2a28df,!![]);}catch(_0x2e7649){return BPromise[_0x08a1('0x22')](_0x2e7649);}return _0x746bf5[_0x08a1('0x23')]();};}function saveUpdates(_0x4c7912,_0x17d29a){return function(_0x1e1421){if(_0x1e1421){return _0x1e1421['update'](_0x4c7912)[_0x08a1('0x24')](function(_0x1d3673){return _0x1d3673;});}return null;};}function removeEntity(_0x3e6cf4,_0x18d5a2){return function(_0x2a4c45){if(_0x2a4c45){return _0x2a4c45['destroy']()['then'](function(){_0x3e6cf4[_0x08a1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x417284,_0xc7ad3e){return function(_0x360bc6){if(!_0x360bc6){_0x417284[_0x08a1('0x25')](0x194);}return _0x360bc6;};}function handleError(_0x2f1ab7,_0x159881){_0x159881=_0x159881||0x1f4;return function(_0x4d11b3){logger[_0x08a1('0x26')](_0x4d11b3[_0x08a1('0x27')]);if(_0x4d11b3['name']){delete _0x4d11b3[_0x08a1('0x28')];}_0x2f1ab7['status'](_0x159881)[_0x08a1('0x29')](_0x4d11b3);};}exports['index']=function(_0x1a69f4,_0x5bb9d6){var _0x10906d={},_0x1f2326={},_0x22264e={'count':0x0,'rows':[]};var _0x32ea53=_['map'](db[_0x08a1('0x2a')]['rawAttributes'],function(_0x2f37ea){return{'name':_0x2f37ea[_0x08a1('0x2b')],'type':_0x2f37ea[_0x08a1('0x2c')]['key']};});_0x1f2326[_0x08a1('0x2d')]=_[_0x08a1('0x2e')](_[_0x08a1('0x2f')](_0x32ea53,'name'),['name']);_0x1f2326[_0x08a1('0x30')]=_[_0x08a1('0x31')](_0x1a69f4[_0x08a1('0x30')]);_0x1f2326[_0x08a1('0x32')]=_[_0x08a1('0x33')](_0x1f2326['model'],_0x1f2326[_0x08a1('0x30')]);_0x10906d[_0x08a1('0x34')]=_[_0x08a1('0x33')](_0x1f2326[_0x08a1('0x2d')],qs['fields'](_0x1a69f4[_0x08a1('0x30')][_0x08a1('0x35')]));_0x10906d['attributes']=_0x10906d[_0x08a1('0x34')]['length']?_0x10906d[_0x08a1('0x34')]:_0x1f2326[_0x08a1('0x2d')];if(!_0x1a69f4[_0x08a1('0x30')]['hasOwnProperty'](_0x08a1('0x36'))){_0x10906d[_0x08a1('0x1d')]=qs[_0x08a1('0x1d')](_0x1a69f4[_0x08a1('0x30')][_0x08a1('0x1d')]);_0x10906d[_0x08a1('0x1b')]=qs['offset'](_0x1a69f4['query'][_0x08a1('0x1b')]);}_0x10906d[_0x08a1('0x37')]=qs[_0x08a1('0x38')](_0x1a69f4[_0x08a1('0x30')][_0x08a1('0x38')]);_0x10906d['where']=qs[_0x08a1('0x32')](_[_0x08a1('0x39')](_0x1a69f4[_0x08a1('0x30')],_0x1f2326[_0x08a1('0x32')]),_0x32ea53);if(_0x1a69f4[_0x08a1('0x30')]['filter']){_0x10906d[_0x08a1('0x3a')]=_[_0x08a1('0x3b')](_0x10906d[_0x08a1('0x3a')],{'$or':_[_0x08a1('0x2f')](_0x32ea53,function(_0x2f9dcf){if(_0x2f9dcf[_0x08a1('0x2c')]!=='VIRTUAL'){var _0x15377d={};_0x15377d[_0x2f9dcf['name']]={'$like':'%'+_0x1a69f4[_0x08a1('0x30')]['filter']+'%'};return _0x15377d;}})});}_0x10906d=_['merge']({},_0x10906d,_0x1a69f4['options']);var _0x336df2={'where':_0x10906d[_0x08a1('0x3a')]};return db[_0x08a1('0x2a')][_0x08a1('0x1e')](_0x336df2)['then'](function(_0x165e1c){_0x22264e['count']=_0x165e1c;if(_0x1a69f4[_0x08a1('0x30')][_0x08a1('0x3c')]){_0x10906d[_0x08a1('0x3d')]=[{'all':!![]}];}return db['CmCustomField'][_0x08a1('0x3e')](_0x10906d);})[_0x08a1('0x24')](function(_0x295a2c){_0x22264e[_0x08a1('0x3f')]=_0x295a2c;return _0x22264e;})[_0x08a1('0x24')](respondWithFilteredResult(_0x5bb9d6,_0x10906d))[_0x08a1('0x40')](handleError(_0x5bb9d6,null));};exports[_0x08a1('0x41')]=function(_0x52b49f,_0x529911){var _0x4d582d={'raw':!![],'where':{'id':_0x52b49f[_0x08a1('0x42')]['id']}},_0x4d9b81={};_0x4d9b81['model']=_[_0x08a1('0x31')](db[_0x08a1('0x2a')][_0x08a1('0x43')]);_0x4d9b81[_0x08a1('0x30')]=_[_0x08a1('0x31')](_0x52b49f[_0x08a1('0x30')]);_0x4d9b81[_0x08a1('0x32')]=_[_0x08a1('0x33')](_0x4d9b81[_0x08a1('0x2d')],_0x4d9b81[_0x08a1('0x30')]);_0x4d582d[_0x08a1('0x34')]=_[_0x08a1('0x33')](_0x4d9b81[_0x08a1('0x2d')],qs[_0x08a1('0x35')](_0x52b49f['query'][_0x08a1('0x35')]));_0x4d582d[_0x08a1('0x34')]=_0x4d582d['attributes'][_0x08a1('0x44')]?_0x4d582d[_0x08a1('0x34')]:_0x4d9b81['model'];if(_0x52b49f['query'][_0x08a1('0x3c')]){_0x4d582d[_0x08a1('0x3d')]=[{'all':!![]}];}_0x4d582d=_['merge']({},_0x4d582d,_0x52b49f[_0x08a1('0x45')]);return db[_0x08a1('0x2a')][_0x08a1('0x46')](_0x4d582d)[_0x08a1('0x24')](handleEntityNotFound(_0x529911,null))[_0x08a1('0x24')](respondWithResult(_0x529911,null))[_0x08a1('0x40')](handleError(_0x529911,null));};exports[_0x08a1('0x47')]=function(_0x22a8de,_0x37ec00){if(_0x22a8de[_0x08a1('0x48')]['id']){delete _0x22a8de[_0x08a1('0x48')]['id'];}return db[_0x08a1('0x2a')][_0x08a1('0x46')]({'where':{'id':_0x22a8de[_0x08a1('0x42')]['id']}})[_0x08a1('0x24')](handleEntityNotFound(_0x37ec00,null))[_0x08a1('0x24')](saveUpdates(_0x22a8de[_0x08a1('0x48')],null))[_0x08a1('0x24')](respondWithResult(_0x37ec00,null))[_0x08a1('0x40')](handleError(_0x37ec00,null));};exports['destroy']=function(_0xc11b90,_0x597528){return db[_0x08a1('0x2a')][_0x08a1('0x46')]({'where':{'id':_0xc11b90[_0x08a1('0x42')]['id']}})[_0x08a1('0x24')](handleEntityNotFound(_0x597528,null))[_0x08a1('0x24')](removeEntity(_0x597528,null))[_0x08a1('0x40')](handleError(_0x597528,null));};exports[_0x08a1('0x49')]=function(_0x2f8520,_0x5df029){var _0x363584;return db[_0x08a1('0x4a')][_0x08a1('0x4b')](function(_0x45c3cd){return db[_0x08a1('0x2a')][_0x08a1('0x49')](_0x2f8520[_0x08a1('0x48')],{'transaction':_0x45c3cd})[_0x08a1('0x24')](function(_0x438159){_0x363584=_0x438159;var _0x86da2={'type':db[_0x08a1('0x4c')][_0x08a1('0x4d')],'transaction':_0x45c3cd};switch(_0x2f8520['body'][_0x08a1('0x2c')]){case _0x08a1('0x4e'):_0x86da2[_0x08a1('0x2c')]=db[_0x08a1('0x4c')][_0x08a1('0x4d')];break;case'number':_0x86da2[_0x08a1('0x2c')]=db['Sequelize'][_0x08a1('0x4f')];break;case _0x08a1('0x50'):_0x86da2['type']=db[_0x08a1('0x4c')]['BOOLEAN'];_0x86da2[_0x08a1('0x51')]=![];break;default:}return db[_0x08a1('0x4a')]['queryInterface'][_0x08a1('0x52')](_0x08a1('0x53'),util[_0x08a1('0x54')]('cf_%d',_0x363584['id']),_0x86da2);})['then'](function(){return _0x363584;});})[_0x08a1('0x24')](respondWithResult(_0x5df029,0xc9))[_0x08a1('0x40')](handleError(_0x5df029,null));}; \ No newline at end of file +var _0x58e0=['undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','query','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','body','transaction','create','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','addColumn','format','cf_%d','eml-format','rimraf','bluebird','mustache','util','path','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x45e3f3,_0x5a357a){var _0x329494=function(_0x4c283e){while(--_0x4c283e){_0x45e3f3['push'](_0x45e3f3['shift']());}};_0x329494(++_0x5a357a);}(_0x58e0,0x1c9));var _0x058e=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x58e0[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require(_0x058e('0x0'));var rimraf=require(_0x058e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x058e('0x2'));var Mustache=require(_0x058e('0x3'));var util=require(_0x058e('0x4'));var path=require(_0x058e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x058e('0x6'));var _=require(_0x058e('0x7'));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(_0x058e('0x8'));var Papa=require('papaparse');var Redis=require(_0x058e('0x9'));var authService=require(_0x058e('0xa'));var qs=require(_0x058e('0xb'));var as=require(_0x058e('0xc'));var hardwareService=require(_0x058e('0xd'));var logger=require(_0x058e('0xe'))(_0x058e('0xf'));var utils=require('../../config/utils');var config=require(_0x058e('0x10'));var licenseUtil=require(_0x058e('0x11'));var db=require(_0x058e('0x12'))['db'];function respondWithStatusCode(_0x5ccbcd,_0x514518){_0x514518=_0x514518||0xcc;return function(_0xa2882){if(_0xa2882){return _0x5ccbcd[_0x058e('0x13')](_0x514518);}return _0x5ccbcd[_0x058e('0x14')](_0x514518)[_0x058e('0x15')]();};}function respondWithResult(_0x3d3cb3,_0x49ae1){_0x49ae1=_0x49ae1||0xc8;return function(_0x14ad15){if(_0x14ad15){return _0x3d3cb3[_0x058e('0x14')](_0x49ae1)['json'](_0x14ad15);}};}function respondWithFilteredResult(_0x3e35f1,_0x3429c8){return function(_0x1fb9be){if(_0x1fb9be){var _0x204116=typeof _0x3429c8[_0x058e('0x16')]===_0x058e('0x17')&&typeof _0x3429c8['limit']==='undefined';var _0x43fc91=_0x1fb9be[_0x058e('0x18')];var _0x3bc2c3=_0x204116?0x0:_0x3429c8[_0x058e('0x16')];var _0x182fb1=_0x204116?_0x1fb9be['count']:_0x3429c8[_0x058e('0x16')]+_0x3429c8[_0x058e('0x19')];var _0x352bb9;if(_0x182fb1>=_0x43fc91){_0x182fb1=_0x43fc91;_0x352bb9=0xc8;}else{_0x352bb9=0xce;}_0x3e35f1[_0x058e('0x14')](_0x352bb9);return _0x3e35f1[_0x058e('0x1a')](_0x058e('0x1b'),_0x3bc2c3+'-'+_0x182fb1+'/'+_0x43fc91)[_0x058e('0x1c')](_0x1fb9be);}return null;};}function patchUpdates(_0x36d82a){return function(_0x5d1ca1){try{jsonpatch[_0x058e('0x1d')](_0x5d1ca1,_0x36d82a,!![]);}catch(_0x5128e9){return BPromise[_0x058e('0x1e')](_0x5128e9);}return _0x5d1ca1[_0x058e('0x1f')]();};}function saveUpdates(_0x2197bd,_0x11a52f){return function(_0x20750f){if(_0x20750f){return _0x20750f[_0x058e('0x20')](_0x2197bd)['then'](function(_0x42fe84){return _0x42fe84;});}return null;};}function removeEntity(_0x1edb74,_0x50cbdd){return function(_0xf3bc8f){if(_0xf3bc8f){return _0xf3bc8f[_0x058e('0x21')]()[_0x058e('0x22')](function(){_0x1edb74[_0x058e('0x14')](0xcc)[_0x058e('0x15')]();});}};}function handleEntityNotFound(_0x541157,_0x1e3ca7){return function(_0x3b30d4){if(!_0x3b30d4){_0x541157[_0x058e('0x13')](0x194);}return _0x3b30d4;};}function handleError(_0x2d3e18,_0x3f89f4){_0x3f89f4=_0x3f89f4||0x1f4;return function(_0x36aae9){logger['error'](_0x36aae9[_0x058e('0x23')]);if(_0x36aae9[_0x058e('0x24')]){delete _0x36aae9['name'];}_0x2d3e18['status'](_0x3f89f4)[_0x058e('0x25')](_0x36aae9);};}exports[_0x058e('0x26')]=function(_0x15b716,_0x34637b){var _0x55ac8b={},_0x4179b0={},_0x324e36={'count':0x0,'rows':[]};var _0x2ee7fc=_[_0x058e('0x27')](db[_0x058e('0x28')]['rawAttributes'],function(_0x289cae){return{'name':_0x289cae[_0x058e('0x29')],'type':_0x289cae[_0x058e('0x2a')][_0x058e('0x2b')]};});_0x4179b0[_0x058e('0x2c')]=_[_0x058e('0x2d')](_[_0x058e('0x27')](_0x2ee7fc,_0x058e('0x24')),[_0x058e('0x24')]);_0x4179b0['query']=_['keys'](_0x15b716[_0x058e('0x2e')]);_0x4179b0['filters']=_['intersection'](_0x4179b0[_0x058e('0x2c')],_0x4179b0[_0x058e('0x2e')]);_0x55ac8b['attributes']=_[_0x058e('0x2f')](_0x4179b0['model'],qs['fields'](_0x15b716[_0x058e('0x2e')][_0x058e('0x30')]));_0x55ac8b['attributes']=_0x55ac8b[_0x058e('0x31')][_0x058e('0x32')]?_0x55ac8b[_0x058e('0x31')]:_0x4179b0['model'];if(!_0x15b716[_0x058e('0x2e')]['hasOwnProperty']('nolimit')){_0x55ac8b['limit']=qs['limit'](_0x15b716[_0x058e('0x2e')][_0x058e('0x19')]);_0x55ac8b[_0x058e('0x16')]=qs[_0x058e('0x16')](_0x15b716[_0x058e('0x2e')][_0x058e('0x16')]);}_0x55ac8b['order']=qs[_0x058e('0x33')](_0x15b716[_0x058e('0x2e')]['sort']);_0x55ac8b[_0x058e('0x34')]=qs[_0x058e('0x35')](_[_0x058e('0x36')](_0x15b716[_0x058e('0x2e')],_0x4179b0[_0x058e('0x35')]),_0x2ee7fc);if(_0x15b716[_0x058e('0x2e')][_0x058e('0x37')]){_0x55ac8b[_0x058e('0x34')]=_[_0x058e('0x38')](_0x55ac8b[_0x058e('0x34')],{'$or':_[_0x058e('0x27')](_0x2ee7fc,function(_0x5419d6){if(_0x5419d6['type']!==_0x058e('0x39')){var _0x1a68cb={};_0x1a68cb[_0x5419d6[_0x058e('0x24')]]={'$like':'%'+_0x15b716[_0x058e('0x2e')]['filter']+'%'};return _0x1a68cb;}})});}_0x55ac8b=_[_0x058e('0x38')]({},_0x55ac8b,_0x15b716[_0x058e('0x3a')]);var _0x587e18={'where':_0x55ac8b['where']};return db[_0x058e('0x28')]['count'](_0x587e18)['then'](function(_0x231726){_0x324e36['count']=_0x231726;if(_0x15b716['query'][_0x058e('0x3b')]){_0x55ac8b[_0x058e('0x3c')]=[{'all':!![]}];}return db[_0x058e('0x28')][_0x058e('0x3d')](_0x55ac8b);})[_0x058e('0x22')](function(_0x45d4ef){_0x324e36[_0x058e('0x3e')]=_0x45d4ef;return _0x324e36;})['then'](respondWithFilteredResult(_0x34637b,_0x55ac8b))[_0x058e('0x3f')](handleError(_0x34637b,null));};exports['show']=function(_0x4cc3a2,_0x55be04){var _0x3cca28={'raw':!![],'where':{'id':_0x4cc3a2[_0x058e('0x40')]['id']}},_0x51296d={};_0x51296d[_0x058e('0x2c')]=_[_0x058e('0x41')](db[_0x058e('0x28')][_0x058e('0x42')]);_0x51296d[_0x058e('0x2e')]=_[_0x058e('0x41')](_0x4cc3a2[_0x058e('0x2e')]);_0x51296d['filters']=_[_0x058e('0x2f')](_0x51296d[_0x058e('0x2c')],_0x51296d[_0x058e('0x2e')]);_0x3cca28[_0x058e('0x31')]=_[_0x058e('0x2f')](_0x51296d['model'],qs[_0x058e('0x30')](_0x4cc3a2[_0x058e('0x2e')][_0x058e('0x30')]));_0x3cca28['attributes']=_0x3cca28['attributes'][_0x058e('0x32')]?_0x3cca28['attributes']:_0x51296d[_0x058e('0x2c')];if(_0x4cc3a2[_0x058e('0x2e')][_0x058e('0x3b')]){_0x3cca28[_0x058e('0x3c')]=[{'all':!![]}];}_0x3cca28=_['merge']({},_0x3cca28,_0x4cc3a2[_0x058e('0x3a')]);return db[_0x058e('0x28')][_0x058e('0x43')](_0x3cca28)[_0x058e('0x22')](handleEntityNotFound(_0x55be04,null))[_0x058e('0x22')](respondWithResult(_0x55be04,null))[_0x058e('0x3f')](handleError(_0x55be04,null));};exports[_0x058e('0x20')]=function(_0x4bfc54,_0x32945f){if(_0x4bfc54[_0x058e('0x44')]['id']){delete _0x4bfc54[_0x058e('0x44')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x4bfc54[_0x058e('0x40')]['id']}})[_0x058e('0x22')](handleEntityNotFound(_0x32945f,null))[_0x058e('0x22')](saveUpdates(_0x4bfc54[_0x058e('0x44')],null))['then'](respondWithResult(_0x32945f,null))['catch'](handleError(_0x32945f,null));};exports['destroy']=function(_0x3f35cb,_0x2a9cec){return db[_0x058e('0x28')][_0x058e('0x43')]({'where':{'id':_0x3f35cb[_0x058e('0x40')]['id']}})[_0x058e('0x22')](handleEntityNotFound(_0x2a9cec,null))['then'](removeEntity(_0x2a9cec,null))['catch'](handleError(_0x2a9cec,null));};exports['create']=function(_0x39c72b,_0x3de5f7){var _0x4104f2;return db['sequelize'][_0x058e('0x45')](function(_0x2e3153){return db[_0x058e('0x28')][_0x058e('0x46')](_0x39c72b[_0x058e('0x44')],{'transaction':_0x2e3153})[_0x058e('0x22')](function(_0x45f5b4){_0x4104f2=_0x45f5b4;var _0x4a7ce2={'type':db[_0x058e('0x47')][_0x058e('0x48')],'transaction':_0x2e3153};switch(_0x39c72b[_0x058e('0x44')][_0x058e('0x2a')]){case _0x058e('0x49'):_0x4a7ce2[_0x058e('0x2a')]=db[_0x058e('0x47')][_0x058e('0x48')];break;case _0x058e('0x4a'):_0x4a7ce2[_0x058e('0x2a')]=db[_0x058e('0x47')]['INTEGER'];break;case'switch':_0x4a7ce2['type']=db[_0x058e('0x47')][_0x058e('0x4b')];_0x4a7ce2[_0x058e('0x4c')]=![];break;default:}return db['sequelize']['queryInterface'][_0x058e('0x4d')]('cm_contacts',util[_0x058e('0x4e')](_0x058e('0x4f'),_0x4104f2['id']),_0x4a7ce2);})[_0x058e('0x22')](function(){return _0x4104f2;});})[_0x058e('0x22')](respondWithResult(_0x3de5f7,0xc9))[_0x058e('0x3f')](handleError(_0x3de5f7,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index db052cb..fa4fdd2 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 _0x7f94=['cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','CmCustomField'];(function(_0x310864,_0x286188){var _0x2fc306=function(_0x444ae3){while(--_0x444ae3){_0x310864['push'](_0x310864['shift']());}};_0x2fc306(++_0x286188);}(_0x7f94,0x1c4));var _0x47f9=function(_0x40895a,_0x73487){_0x40895a=_0x40895a-0x0;var _0x5dabdb=_0x7f94[_0x40895a];return _0x5dabdb;};'use strict';var _=require(_0x47f9('0x0'));var util=require(_0x47f9('0x1'));var logger=require(_0x47f9('0x2'))('api');var moment=require(_0x47f9('0x3'));var BPromise=require(_0x47f9('0x4'));var rp=require(_0x47f9('0x5'));var fs=require('fs');var path=require(_0x47f9('0x6'));var rimraf=require('rimraf');var config=require(_0x47f9('0x7'));var attributes=require(_0x47f9('0x8'));module['exports']=function(_0x3b1cd6,_0x4d0424){return _0x3b1cd6['define'](_0x47f9('0x9'),attributes,{'tableName':_0x47f9('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbee3=['request-promise','path','rimraf','define','CmCustomField','lodash','api','moment'];(function(_0x2c954a,_0x466dd4){var _0x3c1f19=function(_0x2388cc){while(--_0x2388cc){_0x2c954a['push'](_0x2c954a['shift']());}};_0x3c1f19(++_0x466dd4);}(_0xbee3,0x10d));var _0x3bee=function(_0x5a22cf,_0x5415c8){_0x5a22cf=_0x5a22cf-0x0;var _0x2c3b7f=_0xbee3[_0x5a22cf];return _0x2c3b7f;};'use strict';var _=require(_0x3bee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var rp=require(_0x3bee('0x3'));var fs=require('fs');var path=require(_0x3bee('0x4'));var rimraf=require(_0x3bee('0x5'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x4bdc8f,_0x54a923){return _0x4bdc8f[_0x3bee('0x6')](_0x3bee('0x7'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 95e845e..807eacb 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 _0x959a=['CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','CmCustomField,\x20%s,\x20%s','info','result','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0x16d0ed,_0x2912d4){var _0x20aa1e=function(_0x2766e3){while(--_0x2766e3){_0x16d0ed['push'](_0x16d0ed['shift']());}};_0x20aa1e(++_0x2912d4);}(_0x959a,0xd8));var _0xa959=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x959a[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xa959('0x0'));var moment=require('moment');var BPromise=require(_0xa959('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa959('0x2'))['db'];var utils=require(_0xa959('0x3'));var logger=require('../../config/logger')(_0xa959('0x4'));var config=require(_0xa959('0x5'));var jayson=require(_0xa959('0x6'));var client=jayson['client'][_0xa959('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2837ac,_0x37e39f,_0x51e21f){return new BPromise(function(_0x3cfdb7,_0x438ab4){return client[_0xa959('0x8')](_0x2837ac,_0x51e21f)[_0xa959('0x9')](function(_0x4cfb9d){logger['info']('CmCustomField,\x20%s,\x20%s',_0x37e39f,_0xa959('0xa'));logger[_0xa959('0xb')](_0xa959('0xc'),_0x37e39f,_0xa959('0xa'),JSON['stringify'](_0x4cfb9d));if(_0x4cfb9d[_0xa959('0xd')]){if(_0x4cfb9d['error'][_0xa959('0xe')]===0x1f4){logger[_0xa959('0xd')]('CmCustomField,\x20%s,\x20%s',_0x37e39f,_0x4cfb9d[_0xa959('0xd')][_0xa959('0xf')]);return _0x438ab4(_0x4cfb9d[_0xa959('0xd')]['message']);}logger[_0xa959('0xd')](_0xa959('0x10'),_0x37e39f,_0x4cfb9d[_0xa959('0xd')][_0xa959('0xf')]);return _0x3cfdb7(_0x4cfb9d[_0xa959('0xd')][_0xa959('0xf')]);}else{logger[_0xa959('0x11')](_0xa959('0x10'),_0x37e39f,_0xa959('0xa'));_0x3cfdb7(_0x4cfb9d[_0xa959('0x12')][_0xa959('0xf')]);}})['catch'](function(_0x2dfd04){logger[_0xa959('0xd')](_0xa959('0x10'),_0x37e39f,_0x2dfd04);_0x438ab4(_0x2dfd04);});});} \ No newline at end of file +var _0xd120=['../../config/logger','../../config/environment','jayson/promise','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xd120,0xec));var _0x0d12=function(_0x35f8c1,_0x14442a){_0x35f8c1=_0x35f8c1-0x0;var _0x35b77d=_0xd120[_0x35f8c1];return _0x35b77d;};'use strict';var _=require(_0x0d12('0x0'));var util=require(_0x0d12('0x1'));var moment=require(_0x0d12('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d12('0x3'));var db=require(_0x0d12('0x4'))['db'];var utils=require(_0x0d12('0x5'));var logger=require(_0x0d12('0x6'))('rpc');var config=require(_0x0d12('0x7'));var jayson=require(_0x0d12('0x8'));var client=jayson['client'][_0x0d12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37957d,_0x2e5326,_0x3774ce){return new BPromise(function(_0x19b842,_0x5a2fbb){return client[_0x0d12('0xa')](_0x37957d,_0x3774ce)['then'](function(_0x8c0b29){logger['info'](_0x0d12('0xb'),_0x2e5326,_0x0d12('0xc'));logger[_0x0d12('0xd')](_0x0d12('0xe'),_0x2e5326,'request\x20sent',JSON[_0x0d12('0xf')](_0x8c0b29));if(_0x8c0b29[_0x0d12('0x10')]){if(_0x8c0b29['error'][_0x0d12('0x11')]===0x1f4){logger[_0x0d12('0x10')](_0x0d12('0xb'),_0x2e5326,_0x8c0b29[_0x0d12('0x10')]['message']);return _0x5a2fbb(_0x8c0b29['error'][_0x0d12('0x12')]);}logger[_0x0d12('0x10')]('CmCustomField,\x20%s,\x20%s',_0x2e5326,_0x8c0b29[_0x0d12('0x10')][_0x0d12('0x12')]);return _0x19b842(_0x8c0b29[_0x0d12('0x10')][_0x0d12('0x12')]);}else{logger[_0x0d12('0x13')](_0x0d12('0xb'),_0x2e5326,_0x0d12('0xc'));_0x19b842(_0x8c0b29[_0x0d12('0x14')]['message']);}})[_0x0d12('0x15')](function(_0x11714a){logger[_0x0d12('0x10')]('CmCustomField,\x20%s,\x20%s',_0x2e5326,_0x11714a);_0x5a2fbb(_0x11714a);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 3da41fd..d8bfe47 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 _0xc4ab=['create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','post'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4ab,0xef));var _0xbc4a=function(_0x14dbbb,_0x416d9f){_0x14dbbb=_0x14dbbb-0x0;var _0x25855b=_0xc4ab[_0x14dbbb];return _0x25855b;};'use strict';var multer=require(_0xbc4a('0x0'));var util=require('util');var path=require(_0xbc4a('0x1'));var timeout=require(_0xbc4a('0x2'));var express=require(_0xbc4a('0x3'));var router=express['Router']();var fs_extra=require(_0xbc4a('0x4'));var auth=require(_0xbc4a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbc4a('0x6'));var controller=require(_0xbc4a('0x7'));router['get']('/',auth[_0xbc4a('0x8')](),controller[_0xbc4a('0x9')]);router[_0xbc4a('0xa')](_0xbc4a('0xb'),auth[_0xbc4a('0x8')](),controller['show']);router[_0xbc4a('0xc')]('/',auth[_0xbc4a('0x8')](),controller[_0xbc4a('0xd')]);router[_0xbc4a('0xe')](_0xbc4a('0xb'),auth[_0xbc4a('0x8')](),controller[_0xbc4a('0xf')]);router[_0xbc4a('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xbc4a('0x11')]=router; \ No newline at end of file +var _0x0845=['./cmCustomField.controller','get','isAuthenticated','show','post','put','/:id','delete','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3d6591,_0x3f0085){var _0x57e3ea=function(_0x1d96ed){while(--_0x1d96ed){_0x3d6591['push'](_0x3d6591['shift']());}};_0x57e3ea(++_0x3f0085);}(_0x0845,0x125));var _0x5084=function(_0xf17dd5,_0x5c345e){_0xf17dd5=_0xf17dd5-0x0;var _0x41da34=_0x0845[_0xf17dd5];return _0x41da34;};'use strict';var multer=require(_0x5084('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5084('0x1'));var express=require(_0x5084('0x2'));var router=express[_0x5084('0x3')]();var fs_extra=require(_0x5084('0x4'));var auth=require(_0x5084('0x5'));var interaction=require(_0x5084('0x6'));var config=require('../../config/environment');var controller=require(_0x5084('0x7'));router[_0x5084('0x8')]('/',auth[_0x5084('0x9')](),controller['index']);router['get']('/:id',auth[_0x5084('0x9')](),controller[_0x5084('0xa')]);router[_0x5084('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5084('0xc')](_0x5084('0xd'),auth[_0x5084('0x9')](),controller['update']);router[_0x5084('0xe')](_0x5084('0xd'),auth[_0x5084('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 00635da..65b3c56 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 _0x9378=['contactListQueue','exports','STRING','BOOLEAN','DATE','format','INTEGER'];(function(_0x124179,_0x28f4e8){var _0x1569f7=function(_0x2e9b21){while(--_0x2e9b21){_0x124179['push'](_0x124179['shift']());}};_0x1569f7(++_0x28f4e8);}(_0x9378,0x94));var _0x8937=function(_0x12fc9c,_0x56a306){_0x12fc9c=_0x12fc9c-0x0;var _0x4aeed5=_0x9378[_0x12fc9c];return _0x4aeed5;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x8937('0x0')]={'phone':{'type':Sequelize[_0x8937('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x8937('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8937('0x3')],'defaultValue':moment()[_0x8937('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8937('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8937('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8937('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8937('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8937('0x3')]},'priority':{'type':Sequelize[_0x8937('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8937('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8937('0x5')],'unique':_0x8937('0x6')},'UserId':{'type':Sequelize[_0x8937('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x8937('0x5')],'unique':_0x8937('0x6')},'CampaignId':{'type':Sequelize[_0x8937('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x8937('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8937('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8937('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8937('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x8937('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8937('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8937('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa4f7=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','STRING','DATE','moment','sequelize','exports','BOOLEAN'];(function(_0x1da30b,_0x3128f8){var _0xeed0da=function(_0x559995){while(--_0x559995){_0x1da30b['push'](_0x1da30b['shift']());}};_0xeed0da(++_0x3128f8);}(_0xa4f7,0xdd));var _0x7a4f=function(_0x233f9a,_0x3d51fd){_0x233f9a=_0x233f9a-0x0;var _0x342084=_0xa4f7[_0x233f9a];return _0x342084;};'use strict';var moment=require(_0x7a4f('0x0'));var Sequelize=require(_0x7a4f('0x1'));module[_0x7a4f('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x7a4f('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x7a4f('0x4'))},'countbusyretry':{'type':Sequelize[_0x7a4f('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7a4f('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7a4f('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7a4f('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7a4f('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7a4f('0x5')],'unique':_0x7a4f('0x6')},'ListId':{'type':Sequelize[_0x7a4f('0x5')],'unique':_0x7a4f('0x6')},'UserId':{'type':Sequelize[_0x7a4f('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x7a4f('0x5')],'unique':_0x7a4f('0x6')},'CampaignId':{'type':Sequelize[_0x7a4f('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x7a4f('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7a4f('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7a4f('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7a4f('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x7a4f('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7a4f('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0x7a4f('0x8')],'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 01eb835..59f985f 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 _0x4fd2=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','send','index','map','CmHopper','rawAttributes','fieldName','name','query','keys','filters','concat','$or','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','isEmpty','hopperIds','priority','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','Contact','CmCompany','Company','CmList','List','dialActive','update','getPreviewRecall','hopperId','UPDATE','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','getTimezone','eml-format'];(function(_0x13c4f8,_0x433521){var _0x5a8f4b=function(_0x1df845){while(--_0x1df845){_0x13c4f8['push'](_0x13c4f8['shift']());}};_0x5a8f4b(++_0x433521);}(_0x4fd2,0x1d9));var _0x24fd=function(_0x146fd1,_0x5a02d2){_0x146fd1=_0x146fd1-0x0;var _0x3c755d=_0x4fd2[_0x146fd1];return _0x3c755d;};'use strict';var emlformat=require(_0x24fd('0x0'));var rimraf=require(_0x24fd('0x1'));var zipdir=require(_0x24fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fd('0x3'));var moment=require(_0x24fd('0x4'));var BPromise=require(_0x24fd('0x5'));var Mustache=require(_0x24fd('0x6'));var util=require('util');var path=require('path');var sox=require(_0x24fd('0x7'));var csv=require(_0x24fd('0x8'));var ejs=require(_0x24fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24fd('0xa'));var squel=require('squel');var crypto=require(_0x24fd('0xb'));var jsforce=require(_0x24fd('0xc'));var deskjs=require(_0x24fd('0xd'));var toCsv=require(_0x24fd('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x24fd('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24fd('0xf'));var logger=require(_0x24fd('0x10'))(_0x24fd('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var shared=require('../../config/environment');var licenseUtil=require(_0x24fd('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x431a7b,_0x8d2853){_0x8d2853=_0x8d2853||0xcc;return function(_0xc681a){if(_0xc681a){return _0x431a7b[_0x24fd('0x13')](_0x8d2853);}return _0x431a7b[_0x24fd('0x14')](_0x8d2853)[_0x24fd('0x15')]();};}function respondWithResult(_0x352ad7,_0x29ae1a){_0x29ae1a=_0x29ae1a||0xc8;return function(_0x4780aa){if(_0x4780aa){return _0x352ad7[_0x24fd('0x14')](_0x29ae1a)[_0x24fd('0x16')](_0x4780aa);}};}function respondWithFilteredResult(_0x44b8da,_0xb4a5f7){return function(_0x3a55dc){if(_0x3a55dc){var _0x42869e=typeof _0xb4a5f7[_0x24fd('0x17')]===_0x24fd('0x18')&&typeof _0xb4a5f7[_0x24fd('0x19')]==='undefined';var _0xad75c5=_0x3a55dc['count'];var _0x1b857b=_0x42869e?0x0:_0xb4a5f7[_0x24fd('0x17')];var _0x32d703=_0x42869e?_0x3a55dc[_0x24fd('0x1a')]:_0xb4a5f7[_0x24fd('0x17')]+_0xb4a5f7[_0x24fd('0x19')];var _0x565eef;if(_0x32d703>=_0xad75c5){_0x32d703=_0xad75c5;_0x565eef=0xc8;}else{_0x565eef=0xce;}_0x44b8da[_0x24fd('0x14')](_0x565eef);return _0x44b8da[_0x24fd('0x1b')]('Content-Range',_0x1b857b+'-'+_0x32d703+'/'+_0xad75c5)[_0x24fd('0x16')](_0x3a55dc);}return null;};}function patchUpdates(_0x54be39){return function(_0x1371ba){try{jsonpatch[_0x24fd('0x1c')](_0x1371ba,_0x54be39,!![]);}catch(_0x3c7827){return BPromise[_0x24fd('0x1d')](_0x3c7827);}return _0x1371ba[_0x24fd('0x1e')]();};}function saveUpdates(_0x4ce1df,_0x28e154){return function(_0x5a1b7d){if(_0x5a1b7d){return _0x5a1b7d['update'](_0x4ce1df)[_0x24fd('0x1f')](function(_0xbf6b7b){return _0xbf6b7b;});}return null;};}function removeEntity(_0x368f6b,_0x439734){return function(_0x1e30f8){if(_0x1e30f8){return _0x1e30f8[_0x24fd('0x20')]()[_0x24fd('0x1f')](function(){_0x368f6b[_0x24fd('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c15cd,_0x536723){return function(_0x45f1d1){if(!_0x45f1d1){_0x3c15cd[_0x24fd('0x13')](0x194);}return _0x45f1d1;};}function handleError(_0x1b0d13,_0xd44f71){_0xd44f71=_0xd44f71||0x1f4;return function(_0x48fb2c){logger[_0x24fd('0x21')](_0x48fb2c[_0x24fd('0x22')]);if(_0x48fb2c['name']){delete _0x48fb2c['name'];}_0x1b0d13[_0x24fd('0x14')](_0xd44f71)[_0x24fd('0x23')](_0x48fb2c);};}exports[_0x24fd('0x24')]=function(_0x5e5df9,_0x5106d9){var _0x4e510a={},_0x39a615={},_0x532df7={'count':0x0,'rows':[]};var _0x7369ce=_[_0x24fd('0x25')](db[_0x24fd('0x26')][_0x24fd('0x27')],function(_0x312abf){return{'name':_0x312abf[_0x24fd('0x28')],'type':_0x312abf['type']['key']};});_0x39a615['model']=_[_0x24fd('0x25')](_0x7369ce,_0x24fd('0x29'));_0x39a615[_0x24fd('0x2a')]=_[_0x24fd('0x2b')](_0x5e5df9[_0x24fd('0x2a')]);_0x39a615[_0x24fd('0x2c')]=_['intersection'](_0x39a615['model'],_0x39a615[_0x24fd('0x2a')]);_0x39a615[_0x24fd('0x2c')]=_[_0x24fd('0x2d')](_0x39a615['filters'],['$and',_0x24fd('0x2e'),_0x24fd('0x2f'),'$gte',_0x24fd('0x30'),'$lte',_0x24fd('0x31'),_0x24fd('0x32'),_0x24fd('0x33'),_0x24fd('0x34'),_0x24fd('0x35'),_0x24fd('0x36'),'$notIn',_0x24fd('0x37'),'$notLike',_0x24fd('0x38'),_0x24fd('0x39'),_0x24fd('0x37'),_0x24fd('0x3a'),_0x24fd('0x3b'),_0x24fd('0x3c'),_0x24fd('0x3d')]);_0x4e510a[_0x24fd('0x3e')]=_[_0x24fd('0x3f')](_0x39a615['model'],qs[_0x24fd('0x40')](_0x5e5df9[_0x24fd('0x2a')][_0x24fd('0x40')]));_0x4e510a[_0x24fd('0x3e')]=_0x4e510a[_0x24fd('0x3e')]['length']?_0x4e510a['attributes']:_0x39a615[_0x24fd('0x41')];if(!_0x5e5df9['query'][_0x24fd('0x42')](_0x24fd('0x43'))){_0x4e510a[_0x24fd('0x19')]=qs[_0x24fd('0x19')](_0x5e5df9[_0x24fd('0x2a')][_0x24fd('0x19')]);_0x4e510a[_0x24fd('0x17')]=qs[_0x24fd('0x17')](_0x5e5df9[_0x24fd('0x2a')][_0x24fd('0x17')]);}_0x4e510a[_0x24fd('0x44')]=qs['sort'](_0x5e5df9[_0x24fd('0x2a')][_0x24fd('0x45')]);_0x4e510a[_0x24fd('0x46')]=qs[_0x24fd('0x2c')](_[_0x24fd('0x47')](_0x5e5df9[_0x24fd('0x2a')],_0x39a615[_0x24fd('0x2c')]),_0x7369ce);if(_0x5e5df9[_0x24fd('0x2a')]['filter']){_0x4e510a['where']=_[_0x24fd('0x48')](_0x4e510a[_0x24fd('0x46')],{'$or':_[_0x24fd('0x25')](_0x7369ce,function(_0x1ee6ec){if(_0x1ee6ec[_0x24fd('0x49')]!==_0x24fd('0x4a')){var _0x5616f1={};_0x5616f1[_0x1ee6ec['name']]={'$like':'%'+_0x5e5df9[_0x24fd('0x2a')]['filter']+'%'};return _0x5616f1;}})});}_0x4e510a=_[_0x24fd('0x48')]({},_0x4e510a,_0x5e5df9[_0x24fd('0x4b')]);var _0x2f5086={'where':_0x4e510a[_0x24fd('0x46')]};return db[_0x24fd('0x26')]['count'](_0x2f5086)['then'](function(_0x2f456e){_0x532df7['count']=_0x2f456e;if(_0x5e5df9['query'][_0x24fd('0x4c')]){_0x4e510a[_0x24fd('0x4d')]=[{'all':!![]}];}return db[_0x24fd('0x26')][_0x24fd('0x4e')](_0x4e510a);})[_0x24fd('0x1f')](function(_0x364b41){_0x532df7[_0x24fd('0x4f')]=_0x364b41;return _0x532df7;})[_0x24fd('0x1f')](respondWithFilteredResult(_0x5106d9,_0x4e510a))[_0x24fd('0x50')](handleError(_0x5106d9,null));};exports[_0x24fd('0x51')]=function(_0x1b7777,_0x14f785){var _0x51f0db={'raw':!![],'where':{'id':_0x1b7777[_0x24fd('0x52')]['id']}},_0x1a0e8b={};_0x1a0e8b[_0x24fd('0x41')]=_[_0x24fd('0x2b')](db[_0x24fd('0x26')][_0x24fd('0x27')]);_0x1a0e8b[_0x24fd('0x2a')]=_[_0x24fd('0x2b')](_0x1b7777[_0x24fd('0x2a')]);_0x1a0e8b[_0x24fd('0x2c')]=_[_0x24fd('0x3f')](_0x1a0e8b['model'],_0x1a0e8b[_0x24fd('0x2a')]);_0x51f0db[_0x24fd('0x3e')]=_[_0x24fd('0x3f')](_0x1a0e8b[_0x24fd('0x41')],qs[_0x24fd('0x40')](_0x1b7777['query'][_0x24fd('0x40')]));_0x51f0db[_0x24fd('0x3e')]=_0x51f0db[_0x24fd('0x3e')][_0x24fd('0x53')]?_0x51f0db['attributes']:_0x1a0e8b[_0x24fd('0x41')];if(_0x1b7777[_0x24fd('0x2a')]['includeAll']){_0x51f0db['include']=[{'all':!![]}];}_0x51f0db=_[_0x24fd('0x48')]({},_0x51f0db,_0x1b7777[_0x24fd('0x4b')]);return db['CmHopper'][_0x24fd('0x54')](_0x51f0db)['then'](handleEntityNotFound(_0x14f785,null))[_0x24fd('0x1f')](respondWithResult(_0x14f785,null))['catch'](handleError(_0x14f785,null));};exports[_0x24fd('0x55')]=function(_0x494e9f,_0x2e256e){return db[_0x24fd('0x26')]['create'](_0x494e9f[_0x24fd('0x56')],{})['then'](respondWithResult(_0x2e256e,0xc9))['catch'](handleError(_0x2e256e,null));};exports['update']=function(_0x150850,_0x413a74){if(_0x150850[_0x24fd('0x56')]['id']){delete _0x150850[_0x24fd('0x56')]['id'];}return db[_0x24fd('0x26')][_0x24fd('0x54')]({'where':{'id':_0x150850[_0x24fd('0x52')]['id']}})[_0x24fd('0x1f')](handleEntityNotFound(_0x413a74,null))['then'](saveUpdates(_0x150850[_0x24fd('0x56')],null))[_0x24fd('0x1f')](respondWithResult(_0x413a74,null))[_0x24fd('0x50')](handleError(_0x413a74,null));};exports[_0x24fd('0x57')]=function(_0x56e282,_0xc66380){return db[_0x24fd('0x26')][_0x24fd('0x57')]()[_0x24fd('0x1f')](respondWithResult(_0xc66380,null))[_0x24fd('0x50')](handleError(_0xc66380,null));};exports[_0x24fd('0x20')]=function(_0x464970,_0x41cf13){var _0x4288d7;var _0x580944=_0x464970[_0x24fd('0x52')]['id'];return db[_0x24fd('0x26')][_0x24fd('0x54')]({'where':{'id':_0x464970[_0x24fd('0x52')]['id']}})['then'](handleEntityNotFound(_0x41cf13,null))[_0x24fd('0x1f')](function(_0x4fec01){if(_0x4fec01){return _0x4fec01[_0x24fd('0x20')]()[_0x24fd('0x1f')](function(_0x1ea9f1){return _0x1ea9f1;});}})[_0x24fd('0x1f')](function(_0x4e4895){_0x4288d7=_0x4e4895;if(_0x4e4895){if(_0x4e4895['VoiceQueueId']||_0x4e4895[_0x24fd('0x58')]){return db[_0x4e4895[_0x24fd('0x59')]?_0x24fd('0x5a'):_0x24fd('0x5b')]['find']({'where':{'id':_0x4e4895['VoiceQueueId']?_0x4e4895['VoiceQueueId']:_0x4e4895['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x24fd('0x1f')](function(_0x351590){var _0x31aa0e={};if(_0x351590){_[_0x24fd('0x48')](_0x31aa0e,_[_0x24fd('0x5c')](_0x4288d7[_0x24fd('0x5d')],['createdAt',_0x24fd('0x5e'),'id']));_0x31aa0e[_0x24fd('0x5f')]=0x15;_0x31aa0e[_0x24fd('0x60')]=_0x24fd('0x61');_0x31aa0e[_0x24fd('0x62')]=_0x351590['name'];_0x31aa0e[_0x24fd('0x63')]=_0x464970[_0x24fd('0x64')][_0x24fd('0x29')];_0x31aa0e[_0x24fd('0x65')]=_0x464970['user']['id'];_0x31aa0e[_0x24fd('0x61')]=!![];_0x31aa0e[_0x24fd('0x66')]=moment()['format'](_0x24fd('0x67'));_0x31aa0e[_0x24fd('0x68')]=_0x4288d7[_0x24fd('0x69')];_0x31aa0e[_0x24fd('0x6a')]=_0x4288d7[_0x24fd('0x59')]?_0x24fd('0x6b'):_0x24fd('0x6c');return db[_0x24fd('0x6d')][_0x24fd('0x54')]({'where':{'id':_0x31aa0e[_0x24fd('0x6e')]},'attributes':[_0x24fd('0x6f'),'lastName']})['then'](function(_0x41172b){if(!_[_0x24fd('0x70')](_0x41cf13)&&!_[_0x24fd('0x70')](_0x41172b[_0x24fd('0x6f')])){_0x31aa0e[_0x24fd('0x71')]=_0x41172b['firstName'];if(!_[_0x24fd('0x70')](_0x41172b[_0x24fd('0x72')])){_0x31aa0e[_0x24fd('0x71')]+='\x20'+_0x41172b[_0x24fd('0x72')];}}})[_0x24fd('0x73')](function(){return db[_0x24fd('0x74')]['create'](_0x31aa0e);});}})[_0x24fd('0x1f')](function(_0x5eb7e8){return db['CmHopperAdditionalPhone'][_0x24fd('0x20')]({'where':{'CmHopperId':_0x580944}});})[_0x24fd('0x1f')](function(){return _0x41cf13['status'](0xcc)['end']();})[_0x24fd('0x50')](handleError(_0x41cf13,null));};exports[_0x24fd('0x75')]=function(_0x3c3d0a,_0x981369,_0x192faf){var _0x240831=[];return db[_0x24fd('0x6d')][_0x24fd('0x57')]()[_0x24fd('0x1f')](function(_0x181e00){_0x240831=_['keys'](_0x181e00);return _0x3c3d0a[_0x24fd('0x64')][_0x24fd('0x76')]({'where':{'type':_0x24fd('0x77'),'dialActive':!![],'dialMethod':_0x24fd('0x78')},'attributes':['id',_0x24fd('0x79'),_0x24fd('0x7a')],'raw':!![]});})[_0x24fd('0x1f')](function(_0x5d008f){if(_0x5d008f&&_0x5d008f[_0x24fd('0x53')]){return db[_0x24fd('0x7b')][_0x24fd('0x7c')](function(_0x582657){var _0x26195c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x24fd('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x24fd('0x25')](_0x5d008f,'id')},'$or':[{'UserId':null},{'UserId':_0x3c3d0a['user']['id']}]};var _0x47bcc8={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5d008f)['filter']([_0x24fd('0x7a'),0x0])[_0x24fd('0x25')]('id')[_0x24fd('0x7e')]()},'$or':[{'UserId':null},{'UserId':_0x3c3d0a[_0x24fd('0x64')]['id']}]};var _0x453954={'$or':[_0x26195c,_0x47bcc8]};var _0x5cc786=[];if(_0x3c3d0a[_0x24fd('0x56')][_0x24fd('0x7f')]&&_0x3c3d0a[_0x24fd('0x56')]['direction']==='prev'){if(!_[_0x24fd('0x80')](_0x3c3d0a['body']['hopperIds'])){_0x453954['id']={'$in':_0x3c3d0a['body'][_0x24fd('0x81')]};}_0x5cc786=[[_0x24fd('0x82'),'ASC'],['scheduledAt',_0x5d008f[0x0][_0x24fd('0x79')]===_0x24fd('0x83')?_0x24fd('0x84'):_0x24fd('0x83')],db[_0x24fd('0x7b')]['literal'](_0x24fd('0x85')),['id',_0x24fd('0x84')]];}else{if(!_[_0x24fd('0x80')](_0x3c3d0a['body'][_0x24fd('0x81')])){_0x453954['id']={'$notIn':_0x3c3d0a[_0x24fd('0x56')][_0x24fd('0x81')]};}_0x5cc786=[[_0x24fd('0x82'),_0x24fd('0x84')],['scheduledAt',_0x5d008f[0x0]['dialOrderByScheduledAt']],db['sequelize']['literal'](_0x24fd('0x86')),['id','ASC']];}return db[_0x24fd('0x26')][_0x24fd('0x87')]({'attributes':['id',_0x24fd('0x88'),_0x24fd('0x69'),_0x24fd('0x89')],'where':_0x453954,'order':_0x5cc786,'transaction':_0x582657,'lock':_0x582657[_0x24fd('0x8a')]['UPDATE'],'include':[{'model':db[_0x24fd('0x6d')],'as':_0x24fd('0x8b'),'attributes':_0x240831,'include':[{'model':db[_0x24fd('0x8c')],'as':_0x24fd('0x8d'),'attributes':['id',_0x24fd('0x29')]}]},{'model':db[_0x24fd('0x8e')],'as':_0x24fd('0x8f'),'attributes':['id','name']},{'model':db[_0x24fd('0x5a')],'as':'Queue','attributes':['id',_0x24fd('0x29'),_0x24fd('0x90')]}]})['then'](function(_0x30d88c){if(_0x30d88c){return _0x30d88c[_0x24fd('0x91')]({'UserId':_0x3c3d0a[_0x24fd('0x64')]['id']},{'transaction':_0x582657});}});});}})[_0x24fd('0x1f')](handleEntityNotFound(_0x981369,null))['then'](respondWithResult(_0x981369,null))[_0x24fd('0x50')](handleError(_0x981369,null));};exports[_0x24fd('0x92')]=function(_0x7c070c,_0x3a466e,_0x1794e1){var _0x46a09f=[];return db[_0x24fd('0x6d')][_0x24fd('0x57')]()[_0x24fd('0x1f')](function(_0x59c730){_0x46a09f=_[_0x24fd('0x2b')](_0x59c730);return _0x7c070c[_0x24fd('0x64')]['getVoiceQueues']({'where':{'type':_0x24fd('0x77'),'dialActive':!![],'dialMethod':_0x24fd('0x78')},'attributes':['id','dialOrderByScheduledAt',_0x24fd('0x7a')],'raw':!![]});})[_0x24fd('0x1f')](function(_0x55d10a){if(_0x55d10a&&_0x55d10a[_0x24fd('0x53')]){return db[_0x24fd('0x7b')][_0x24fd('0x7c')](function(_0x2318d1){var _0x49ad92={'active':![],'recallme':!![],'id':_0x7c070c[_0x24fd('0x56')][_0x24fd('0x93')]};return db[_0x24fd('0x26')][_0x24fd('0x87')]({'attributes':['id','scheduledat',_0x24fd('0x89')],'where':_0x49ad92,'transaction':_0x2318d1,'lock':_0x2318d1['LOCK'][_0x24fd('0x94')],'include':[{'model':db['CmContact'],'as':_0x24fd('0x8b'),'attributes':_0x46a09f,'include':[{'model':db['CmCompany'],'as':_0x24fd('0x8d'),'attributes':['id',_0x24fd('0x29')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x24fd('0x29')]},{'model':db[_0x24fd('0x5a')],'as':_0x24fd('0x95'),'attributes':['id',_0x24fd('0x29'),_0x24fd('0x90')]}]})[_0x24fd('0x1f')](function(_0x539722){if(_0x539722){return _0x539722['update']({'UserId':_0x7c070c['user']['id']},{'transaction':_0x2318d1});}});});}})[_0x24fd('0x1f')](handleEntityNotFound(_0x3a466e,null))[_0x24fd('0x1f')](respondWithResult(_0x3a466e,null))[_0x24fd('0x50')](handleError(_0x3a466e,null));};exports[_0x24fd('0x96')]=function(_0x3bc1a0,_0x12dccb,_0x26e460){return _0x3bc1a0['user'][_0x24fd('0x76')]({'where':{'type':_0x24fd('0x77'),'dialActive':!![],'dialMethod':_0x24fd('0x78')},'attributes':['id'],'raw':!![]})[_0x24fd('0x1f')](function(_0x2d208e){if(_0x2d208e&&_0x2d208e[_0x24fd('0x53')]){return db[_0x24fd('0x26')][_0x24fd('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x24fd('0x7d')](_0x24fd('0x67'))},'VoiceQueueId':{'$in':_[_0x24fd('0x25')](_0x2d208e,'id')},'$or':[{'UserId':null},{'UserId':_0x3bc1a0[_0x24fd('0x64')]['id']}]}});}return 0x0;})['then'](function(_0x191820){if(!_['isNil'](_0x191820)&&_[_0x24fd('0x97')](_0x191820)){return _0x12dccb[_0x24fd('0x14')](0xc8)['json']({'contacts':_0x191820});}else{logger[_0x24fd('0x21')](_0x24fd('0x98'),_0x24fd('0x96'),0x194,_0x24fd('0x99'));_0x12dccb[_0x24fd('0x13')](0x194);}})['catch'](handleError(_0x12dccb,null));};exports[_0x24fd('0x9a')]=function(_0x12fad5,_0x14120f,_0x2859a8){var _0x5e80bb=shared[_0x24fd('0x9b')];var _0x1ffc87=[];_[_0x24fd('0x25')](_0x5e80bb,function(_0x507048){_0x1ffc87[_0x24fd('0x9c')]({'id':_0x507048[_0x24fd('0x29')],'name':_0x507048[_0x24fd('0x29')],'utcOffset':_0x507048['utcOffset']});});return _0x14120f[_0x24fd('0x14')](0xc8)['json']({'tz':_0x1ffc87});};exports[_0x24fd('0x9d')]=function(_0x381d44,_0x407383,_0x112ec2){var _0x1595b9=shared[_0x24fd('0x9b')];var _0x36250a={};if(!_['isNil'](_0x1595b9[_0x381d44[_0x24fd('0x56')]['id']]))_0x36250a=_0x1595b9[_0x381d44[_0x24fd('0x56')]['id']];return _0x407383[_0x24fd('0x14')](0xc8)[_0x24fd('0x16')](_0x36250a);}; \ No newline at end of file +var _0x4860=['$overlap','$contains','$any','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','options','includeAll','include','findAll','show','params','length','merge','find','create','catch','update','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','createdAt','updatedAt','statedesc','deleted','membername','user','UserId','deletedat','format','calleridnum','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','finally','CmHopperFinal','CmHopperAdditionalPhone','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','dialPreviewAutoRecallMe','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','CmCompany','Company','List','Queue','dialActive','preview','hopperId','CmList','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','end','json','offset','limit','undefined','count','status','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0x4860,0xf8));var _0x0486=function(_0x5e9ba6,_0x4770e0){_0x5e9ba6=_0x5e9ba6-0x0;var _0x2ddc51=_0x4860[_0x5e9ba6];return _0x2ddc51;};'use strict';var emlformat=require(_0x0486('0x0'));var rimraf=require(_0x0486('0x1'));var zipdir=require(_0x0486('0x2'));var jsonpatch=require(_0x0486('0x3'));var rp=require(_0x0486('0x4'));var moment=require(_0x0486('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0486('0x6'));var util=require('util');var path=require(_0x0486('0x7'));var sox=require(_0x0486('0x8'));var csv=require(_0x0486('0x9'));var ejs=require(_0x0486('0xa'));var fs=require('fs');var fs_extra=require(_0x0486('0xb'));var _=require(_0x0486('0xc'));var squel=require(_0x0486('0xd'));var crypto=require('crypto');var jsforce=require(_0x0486('0xe'));var deskjs=require(_0x0486('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0486('0x10'));var Redis=require(_0x0486('0x11'));var authService=require(_0x0486('0x12'));var qs=require(_0x0486('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0486('0x14'));var logger=require(_0x0486('0x15'))(_0x0486('0x16'));var utils=require('../../config/utils');var config=require(_0x0486('0x17'));var shared=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x332706,_0x4344fb){_0x4344fb=_0x4344fb||0xcc;return function(_0x554f51){if(_0x554f51){return _0x332706['sendStatus'](_0x4344fb);}return _0x332706['status'](_0x4344fb)[_0x0486('0x18')]();};}function respondWithResult(_0x41864f,_0x4248ad){_0x4248ad=_0x4248ad||0xc8;return function(_0x208c7a){if(_0x208c7a){return _0x41864f['status'](_0x4248ad)[_0x0486('0x19')](_0x208c7a);}};}function respondWithFilteredResult(_0x7e64bb,_0x33ebc0){return function(_0x537639){if(_0x537639){var _0x2f6449=typeof _0x33ebc0[_0x0486('0x1a')]==='undefined'&&typeof _0x33ebc0[_0x0486('0x1b')]===_0x0486('0x1c');var _0xa25174=_0x537639[_0x0486('0x1d')];var _0x561bf9=_0x2f6449?0x0:_0x33ebc0[_0x0486('0x1a')];var _0x39f2e0=_0x2f6449?_0x537639['count']:_0x33ebc0[_0x0486('0x1a')]+_0x33ebc0[_0x0486('0x1b')];var _0x471d71;if(_0x39f2e0>=_0xa25174){_0x39f2e0=_0xa25174;_0x471d71=0xc8;}else{_0x471d71=0xce;}_0x7e64bb[_0x0486('0x1e')](_0x471d71);return _0x7e64bb['set'](_0x0486('0x1f'),_0x561bf9+'-'+_0x39f2e0+'/'+_0xa25174)[_0x0486('0x19')](_0x537639);}return null;};}function patchUpdates(_0x10a0e3){return function(_0x243c09){try{jsonpatch[_0x0486('0x20')](_0x243c09,_0x10a0e3,!![]);}catch(_0x5834cb){return BPromise['reject'](_0x5834cb);}return _0x243c09[_0x0486('0x21')]();};}function saveUpdates(_0x379e72,_0xeb0adb){return function(_0x417cef){if(_0x417cef){return _0x417cef['update'](_0x379e72)[_0x0486('0x22')](function(_0xb2cb1f){return _0xb2cb1f;});}return null;};}function removeEntity(_0x51df0a,_0x10b464){return function(_0x45c4a2){if(_0x45c4a2){return _0x45c4a2[_0x0486('0x23')]()[_0x0486('0x22')](function(){_0x51df0a[_0x0486('0x1e')](0xcc)[_0x0486('0x18')]();});}};}function handleEntityNotFound(_0x9f81c4,_0x561d07){return function(_0x315fce){if(!_0x315fce){_0x9f81c4[_0x0486('0x24')](0x194);}return _0x315fce;};}function handleError(_0x8fcbf4,_0x4a74fc){_0x4a74fc=_0x4a74fc||0x1f4;return function(_0x1fc701){logger['error'](_0x1fc701[_0x0486('0x25')]);if(_0x1fc701[_0x0486('0x26')]){delete _0x1fc701[_0x0486('0x26')];}_0x8fcbf4[_0x0486('0x1e')](_0x4a74fc)[_0x0486('0x27')](_0x1fc701);};}exports[_0x0486('0x28')]=function(_0x13d998,_0x36eb9d){var _0x4a79c7={},_0x42a3d5={},_0x20bea0={'count':0x0,'rows':[]};var _0x3a5ecd=_[_0x0486('0x29')](db[_0x0486('0x2a')][_0x0486('0x2b')],function(_0x47623a){return{'name':_0x47623a[_0x0486('0x2c')],'type':_0x47623a[_0x0486('0x2d')]['key']};});_0x42a3d5[_0x0486('0x2e')]=_['map'](_0x3a5ecd,'name');_0x42a3d5[_0x0486('0x2f')]=_[_0x0486('0x30')](_0x13d998['query']);_0x42a3d5[_0x0486('0x31')]=_['intersection'](_0x42a3d5[_0x0486('0x2e')],_0x42a3d5[_0x0486('0x2f')]);_0x42a3d5['filters']=_['concat'](_0x42a3d5['filters'],[_0x0486('0x32'),_0x0486('0x33'),_0x0486('0x34'),_0x0486('0x35'),'$lt',_0x0486('0x36'),_0x0486('0x37'),_0x0486('0x38'),_0x0486('0x39'),_0x0486('0x3a'),_0x0486('0x3b'),_0x0486('0x3c'),_0x0486('0x3d'),'$like',_0x0486('0x3e'),_0x0486('0x3f'),_0x0486('0x40'),_0x0486('0x41'),_0x0486('0x42'),_0x0486('0x43'),'$contained',_0x0486('0x44')]);_0x4a79c7['attributes']=_[_0x0486('0x45')](_0x42a3d5[_0x0486('0x2e')],qs['fields'](_0x13d998[_0x0486('0x2f')][_0x0486('0x46')]));_0x4a79c7[_0x0486('0x47')]=_0x4a79c7[_0x0486('0x47')]['length']?_0x4a79c7[_0x0486('0x47')]:_0x42a3d5[_0x0486('0x2e')];if(!_0x13d998[_0x0486('0x2f')][_0x0486('0x48')](_0x0486('0x49'))){_0x4a79c7[_0x0486('0x1b')]=qs[_0x0486('0x1b')](_0x13d998['query'][_0x0486('0x1b')]);_0x4a79c7[_0x0486('0x1a')]=qs[_0x0486('0x1a')](_0x13d998[_0x0486('0x2f')][_0x0486('0x1a')]);}_0x4a79c7[_0x0486('0x4a')]=qs[_0x0486('0x4b')](_0x13d998[_0x0486('0x2f')][_0x0486('0x4b')]);_0x4a79c7[_0x0486('0x4c')]=qs[_0x0486('0x31')](_[_0x0486('0x4d')](_0x13d998['query'],_0x42a3d5[_0x0486('0x31')]),_0x3a5ecd);if(_0x13d998[_0x0486('0x2f')]['filter']){_0x4a79c7['where']=_['merge'](_0x4a79c7['where'],{'$or':_[_0x0486('0x29')](_0x3a5ecd,function(_0x14a7d7){if(_0x14a7d7['type']!=='VIRTUAL'){var _0x14d095={};_0x14d095[_0x14a7d7[_0x0486('0x26')]]={'$like':'%'+_0x13d998[_0x0486('0x2f')]['filter']+'%'};return _0x14d095;}})});}_0x4a79c7=_['merge']({},_0x4a79c7,_0x13d998[_0x0486('0x4e')]);var _0x3c1d32={'where':_0x4a79c7[_0x0486('0x4c')]};return db[_0x0486('0x2a')]['count'](_0x3c1d32)[_0x0486('0x22')](function(_0x3eb729){_0x20bea0[_0x0486('0x1d')]=_0x3eb729;if(_0x13d998[_0x0486('0x2f')][_0x0486('0x4f')]){_0x4a79c7[_0x0486('0x50')]=[{'all':!![]}];}return db[_0x0486('0x2a')][_0x0486('0x51')](_0x4a79c7);})['then'](function(_0x2b1607){_0x20bea0['rows']=_0x2b1607;return _0x20bea0;})[_0x0486('0x22')](respondWithFilteredResult(_0x36eb9d,_0x4a79c7))['catch'](handleError(_0x36eb9d,null));};exports[_0x0486('0x52')]=function(_0x1f1306,_0x28c1c8){var _0x3283e8={'raw':!![],'where':{'id':_0x1f1306[_0x0486('0x53')]['id']}},_0x5b692a={};_0x5b692a[_0x0486('0x2e')]=_[_0x0486('0x30')](db[_0x0486('0x2a')][_0x0486('0x2b')]);_0x5b692a[_0x0486('0x2f')]=_[_0x0486('0x30')](_0x1f1306[_0x0486('0x2f')]);_0x5b692a[_0x0486('0x31')]=_['intersection'](_0x5b692a['model'],_0x5b692a[_0x0486('0x2f')]);_0x3283e8[_0x0486('0x47')]=_[_0x0486('0x45')](_0x5b692a[_0x0486('0x2e')],qs[_0x0486('0x46')](_0x1f1306[_0x0486('0x2f')][_0x0486('0x46')]));_0x3283e8['attributes']=_0x3283e8[_0x0486('0x47')][_0x0486('0x54')]?_0x3283e8[_0x0486('0x47')]:_0x5b692a['model'];if(_0x1f1306[_0x0486('0x2f')]['includeAll']){_0x3283e8['include']=[{'all':!![]}];}_0x3283e8=_[_0x0486('0x55')]({},_0x3283e8,_0x1f1306['options']);return db['CmHopper'][_0x0486('0x56')](_0x3283e8)[_0x0486('0x22')](handleEntityNotFound(_0x28c1c8,null))[_0x0486('0x22')](respondWithResult(_0x28c1c8,null))['catch'](handleError(_0x28c1c8,null));};exports[_0x0486('0x57')]=function(_0x52589a,_0x47fe34){return db[_0x0486('0x2a')][_0x0486('0x57')](_0x52589a['body'],{})[_0x0486('0x22')](respondWithResult(_0x47fe34,0xc9))[_0x0486('0x58')](handleError(_0x47fe34,null));};exports[_0x0486('0x59')]=function(_0x3943dc,_0x1b373f){if(_0x3943dc[_0x0486('0x5a')]['id']){delete _0x3943dc['body']['id'];}return db[_0x0486('0x2a')][_0x0486('0x56')]({'where':{'id':_0x3943dc[_0x0486('0x53')]['id']}})[_0x0486('0x22')](handleEntityNotFound(_0x1b373f,null))['then'](saveUpdates(_0x3943dc[_0x0486('0x5a')],null))['then'](respondWithResult(_0x1b373f,null))[_0x0486('0x58')](handleError(_0x1b373f,null));};exports['describe']=function(_0xfaca93,_0x1122ff){return db[_0x0486('0x2a')][_0x0486('0x5b')]()[_0x0486('0x22')](respondWithResult(_0x1122ff,null))[_0x0486('0x58')](handleError(_0x1122ff,null));};exports[_0x0486('0x23')]=function(_0x10c8df,_0xcb2348){var _0x14d844;var _0x317fa3=_0x10c8df[_0x0486('0x53')]['id'];return db['CmHopper'][_0x0486('0x56')]({'where':{'id':_0x10c8df['params']['id']}})[_0x0486('0x22')](handleEntityNotFound(_0xcb2348,null))[_0x0486('0x22')](function(_0x13509c){if(_0x13509c){return _0x13509c['destroy']()[_0x0486('0x22')](function(_0x368675){return _0x368675;});}})[_0x0486('0x22')](function(_0x3a5973){_0x14d844=_0x3a5973;if(_0x3a5973){if(_0x3a5973[_0x0486('0x5c')]||_0x3a5973['CampaignId']){return db[_0x3a5973[_0x0486('0x5c')]?_0x0486('0x5d'):_0x0486('0x5e')][_0x0486('0x56')]({'where':{'id':_0x3a5973[_0x0486('0x5c')]?_0x3a5973['VoiceQueueId']:_0x3a5973[_0x0486('0x5f')]},'attributes':['id',_0x0486('0x26')],'raw':!![]});}}})[_0x0486('0x22')](function(_0xa6a540){var _0x51a874={};if(_0xa6a540){_[_0x0486('0x55')](_0x51a874,_['omit'](_0x14d844[_0x0486('0x60')],[_0x0486('0x61'),_0x0486('0x62'),'id']));_0x51a874['state']=0x15;_0x51a874[_0x0486('0x63')]=_0x0486('0x64');_0x51a874['campaign']=_0xa6a540[_0x0486('0x26')];_0x51a874[_0x0486('0x65')]=_0x10c8df[_0x0486('0x66')][_0x0486('0x26')];_0x51a874[_0x0486('0x67')]=_0x10c8df[_0x0486('0x66')]['id'];_0x51a874['deleted']=!![];_0x51a874[_0x0486('0x68')]=moment()[_0x0486('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x51a874[_0x0486('0x6a')]=_0x14d844['phone'];_0x51a874['campaigntype']=_0x14d844[_0x0486('0x5c')]?_0x0486('0x6b'):_0x0486('0x6c');return db[_0x0486('0x6d')][_0x0486('0x56')]({'where':{'id':_0x51a874[_0x0486('0x6e')]},'attributes':[_0x0486('0x6f'),_0x0486('0x70')]})[_0x0486('0x22')](function(_0x2c91f5){if(!_['isNil'](_0xcb2348)&&!_[_0x0486('0x71')](_0x2c91f5[_0x0486('0x6f')])){_0x51a874['calleridname']=_0x2c91f5[_0x0486('0x6f')];if(!_[_0x0486('0x71')](_0x2c91f5[_0x0486('0x70')])){_0x51a874['calleridname']+='\x20'+_0x2c91f5[_0x0486('0x70')];}}})[_0x0486('0x72')](function(){return db[_0x0486('0x73')]['create'](_0x51a874);});}})[_0x0486('0x22')](function(_0x49ce40){return db[_0x0486('0x74')][_0x0486('0x23')]({'where':{'CmHopperId':_0x317fa3}});})[_0x0486('0x22')](function(){return _0xcb2348[_0x0486('0x1e')](0xcc)['end']();})['catch'](handleError(_0xcb2348,null));};exports['getPreview']=function(_0x15e525,_0x58bb91,_0x45ec1f){var _0x3a70af=[];return db[_0x0486('0x6d')][_0x0486('0x5b')]()[_0x0486('0x22')](function(_0x238849){_0x3a70af=_[_0x0486('0x30')](_0x238849);return _0x15e525['user'][_0x0486('0x75')]({'where':{'type':_0x0486('0x76'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x0486('0x77'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x0486('0x22')](function(_0x4fa6bc){if(_0x4fa6bc&&_0x4fa6bc['length']){return db[_0x0486('0x78')][_0x0486('0x79')](function(_0x22f411){var _0x1c0369={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0486('0x69')](_0x0486('0x7a'))},'VoiceQueueId':{'$in':_[_0x0486('0x29')](_0x4fa6bc,'id')},'$or':[{'UserId':null},{'UserId':_0x15e525[_0x0486('0x66')]['id']}]};var _0x380384={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4fa6bc)['filter']([_0x0486('0x7b'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x15e525['user']['id']}]};var _0x4d5d72={'$or':[_0x1c0369,_0x380384]};var _0x57f2d2=[];if(_0x15e525['body'][_0x0486('0x7c')]&&_0x15e525['body'][_0x0486('0x7c')]===_0x0486('0x7d')){if(!_[_0x0486('0x7e')](_0x15e525['body'][_0x0486('0x7f')])){_0x4d5d72['id']={'$in':_0x15e525[_0x0486('0x5a')][_0x0486('0x7f')]};}_0x57f2d2=[[_0x0486('0x80'),_0x0486('0x81')],[_0x0486('0x82'),_0x4fa6bc[0x0][_0x0486('0x77')]==='ASC'?'DESC':_0x0486('0x81')],db[_0x0486('0x78')]['literal'](_0x0486('0x83')),['id',_0x0486('0x84')]];}else{if(!_[_0x0486('0x7e')](_0x15e525[_0x0486('0x5a')][_0x0486('0x7f')])){_0x4d5d72['id']={'$notIn':_0x15e525[_0x0486('0x5a')][_0x0486('0x7f')]};}_0x57f2d2=[[_0x0486('0x80'),_0x0486('0x84')],[_0x0486('0x82'),_0x4fa6bc[0x0]['dialOrderByScheduledAt']],db[_0x0486('0x78')][_0x0486('0x85')](_0x0486('0x86')),['id','ASC']];}return db['CmHopper']['findOne']({'attributes':['id',_0x0486('0x87'),_0x0486('0x88'),_0x0486('0x89')],'where':_0x4d5d72,'order':_0x57f2d2,'transaction':_0x22f411,'lock':_0x22f411[_0x0486('0x8a')][_0x0486('0x8b')],'include':[{'model':db[_0x0486('0x6d')],'as':'Contact','attributes':_0x3a70af,'include':[{'model':db[_0x0486('0x8c')],'as':_0x0486('0x8d'),'attributes':['id',_0x0486('0x26')]}]},{'model':db['CmList'],'as':_0x0486('0x8e'),'attributes':['id','name']},{'model':db[_0x0486('0x5d')],'as':_0x0486('0x8f'),'attributes':['id','name',_0x0486('0x90')]}]})[_0x0486('0x22')](function(_0x2006f2){if(_0x2006f2){return _0x2006f2['update']({'UserId':_0x15e525[_0x0486('0x66')]['id']},{'transaction':_0x22f411});}});});}})[_0x0486('0x22')](handleEntityNotFound(_0x58bb91,null))[_0x0486('0x22')](respondWithResult(_0x58bb91,null))[_0x0486('0x58')](handleError(_0x58bb91,null));};exports['getPreviewRecall']=function(_0x1c6634,_0x435cf6,_0x52ce5a){var _0x2ca432=[];return db[_0x0486('0x6d')][_0x0486('0x5b')]()[_0x0486('0x22')](function(_0x3e840f){_0x2ca432=_[_0x0486('0x30')](_0x3e840f);return _0x1c6634[_0x0486('0x66')]['getVoiceQueues']({'where':{'type':_0x0486('0x76'),'dialActive':!![],'dialMethod':_0x0486('0x91')},'attributes':['id',_0x0486('0x77'),_0x0486('0x7b')],'raw':!![]});})[_0x0486('0x22')](function(_0x12a887){if(_0x12a887&&_0x12a887[_0x0486('0x54')]){return db[_0x0486('0x78')][_0x0486('0x79')](function(_0x1d2d51){var _0x3ddacb={'active':![],'recallme':!![],'id':_0x1c6634[_0x0486('0x5a')][_0x0486('0x92')]};return db['CmHopper']['findOne']({'attributes':['id',_0x0486('0x87'),_0x0486('0x89')],'where':_0x3ddacb,'transaction':_0x1d2d51,'lock':_0x1d2d51['LOCK']['UPDATE'],'include':[{'model':db[_0x0486('0x6d')],'as':'Contact','attributes':_0x2ca432,'include':[{'model':db[_0x0486('0x8c')],'as':'Company','attributes':['id',_0x0486('0x26')]}]},{'model':db[_0x0486('0x93')],'as':'List','attributes':['id','name']},{'model':db[_0x0486('0x5d')],'as':'Queue','attributes':['id',_0x0486('0x26'),_0x0486('0x90')]}]})[_0x0486('0x22')](function(_0x1862cd){if(_0x1862cd){return _0x1862cd[_0x0486('0x59')]({'UserId':_0x1c6634['user']['id']},{'transaction':_0x1d2d51});}});});}})[_0x0486('0x22')](handleEntityNotFound(_0x435cf6,null))[_0x0486('0x22')](respondWithResult(_0x435cf6,null))['catch'](handleError(_0x435cf6,null));};exports[_0x0486('0x94')]=function(_0x3adbbd,_0xdf4bfa,_0x149de9){return _0x3adbbd[_0x0486('0x66')][_0x0486('0x75')]({'where':{'type':_0x0486('0x76'),'dialActive':!![],'dialMethod':_0x0486('0x91')},'attributes':['id'],'raw':!![]})[_0x0486('0x22')](function(_0x54788f){if(_0x54788f&&_0x54788f[_0x0486('0x54')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0486('0x69')](_0x0486('0x7a'))},'VoiceQueueId':{'$in':_['map'](_0x54788f,'id')},'$or':[{'UserId':null},{'UserId':_0x3adbbd[_0x0486('0x66')]['id']}]}});}return 0x0;})[_0x0486('0x22')](function(_0x4b41a0){if(!_[_0x0486('0x71')](_0x4b41a0)&&_[_0x0486('0x95')](_0x4b41a0)){return _0xdf4bfa[_0x0486('0x1e')](0xc8)[_0x0486('0x19')]({'contacts':_0x4b41a0});}else{logger[_0x0486('0x96')](_0x0486('0x97'),'getOpenContacts',0x194,_0x0486('0x98'));_0xdf4bfa[_0x0486('0x24')](0x194);}})[_0x0486('0x58')](handleError(_0xdf4bfa,null));};exports[_0x0486('0x99')]=function(_0x2093b2,_0x2d4dad,_0x4bcdfd){var _0x6188f2=shared['timezones'];var _0x177c14=[];_[_0x0486('0x29')](_0x6188f2,function(_0x444149){_0x177c14[_0x0486('0x9a')]({'id':_0x444149[_0x0486('0x26')],'name':_0x444149[_0x0486('0x26')],'utcOffset':_0x444149[_0x0486('0x9b')]});});return _0x2d4dad['status'](0xc8)['json']({'tz':_0x177c14});};exports[_0x0486('0x9c')]=function(_0x5ef939,_0x517912,_0x442276){var _0x56964c=shared['timezones'];var _0x3d881a={};if(!_[_0x0486('0x71')](_0x56964c[_0x5ef939[_0x0486('0x5a')]['id']]))_0x3d881a=_0x56964c[_0x5ef939[_0x0486('0x5a')]['id']];return _0x517912['status'](0xc8)[_0x0486('0x19')](_0x3d881a);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 21bbf98..37e8fc8 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 _0x1261=['path','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x40e22e,_0x457644){var _0x3089ee=function(_0x26fe80){while(--_0x26fe80){_0x40e22e['push'](_0x40e22e['shift']());}};_0x3089ee(++_0x457644);}(_0x1261,0x144));var _0x1126=function(_0x188d31,_0x576e87){_0x188d31=_0x188d31-0x0;var _0x30ed33=_0x1261[_0x188d31];return _0x30ed33;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('CmHopper',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]},{'name':_0x1126('0xd'),'fields':[_0x1126('0xd')]},{'name':'priority','fields':[_0x1126('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmHopper.attributes','exports'];(function(_0x599b33,_0x1bf3db){var _0x568e2d=function(_0x21c490){while(--_0x21c490){_0x599b33['push'](_0x599b33['shift']());}};_0x568e2d(++_0x1bf3db);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xac4a('0xc'),'fields':[_0xac4a('0xc')]},{'name':_0xac4a('0xd'),'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 cc10ebb..f94ed50 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 _0x18c6=['UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','order','GetCmHopperPreview','keys','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','\x20MINUTE','CmList','List','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','model','map','then','find','raw','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length'];(function(_0x147f71,_0xa77d8b){var _0x24a2f2=function(_0xfea605){while(--_0xfea605){_0x147f71['push'](_0x147f71['shift']());}};_0x24a2f2(++_0xa77d8b);}(_0x18c6,0x182));var _0x618c=function(_0x3b77bf,_0x1c7826){_0x3b77bf=_0x3b77bf-0x0;var _0x4cdac6=_0x18c6[_0x3b77bf];return _0x4cdac6;};'use strict';var _=require('lodash');var util=require(_0x618c('0x0'));var moment=require(_0x618c('0x1'));var BPromise=require(_0x618c('0x2'));var rs=require(_0x618c('0x3'));var fs=require('fs');var Redis=require(_0x618c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x618c('0x5'));var logger=require(_0x618c('0x6'))(_0x618c('0x7'));var config=require(_0x618c('0x8'));var jayson=require(_0x618c('0x9'));const {validateExpressRequest}=require(_0x618c('0xa'));var client=jayson[_0x618c('0xb')][_0x618c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21687d,_0x523c65,_0x4c4313){return new BPromise(function(_0xf91f0a,_0x2ae550){return client[_0x618c('0xd')](_0x21687d,_0x4c4313)['then'](function(_0x44ddad){logger['info'](_0x618c('0xe'),_0x523c65,_0x618c('0xf'));logger[_0x618c('0x10')](_0x618c('0x11'),_0x523c65,'request\x20sent',JSON[_0x618c('0x12')](_0x44ddad));if(_0x44ddad[_0x618c('0x13')]){if(_0x44ddad[_0x618c('0x13')]['code']===0x1f4){logger['error'](_0x618c('0xe'),_0x523c65,_0x44ddad[_0x618c('0x13')][_0x618c('0x14')]);return _0x2ae550(_0x44ddad[_0x618c('0x13')][_0x618c('0x14')]);}logger[_0x618c('0x13')](_0x618c('0xe'),_0x523c65,_0x44ddad[_0x618c('0x13')][_0x618c('0x14')]);return _0xf91f0a(_0x44ddad[_0x618c('0x13')]['message']);}else{logger[_0x618c('0x15')](_0x618c('0xe'),_0x523c65,_0x618c('0xf'));_0xf91f0a(_0x44ddad[_0x618c('0x16')][_0x618c('0x14')]);}})[_0x618c('0x17')](function(_0x31fe9c){logger[_0x618c('0x13')]('CmHopper,\x20%s,\x20%s',_0x523c65,_0x31fe9c);_0x2ae550(_0x31fe9c);});});}exports[_0x618c('0x18')]=function(_0x2cd497){var _0x1ce350=this;return new Promise(function(_0x5091ae,_0x436fd7){return db[_0x618c('0x19')][_0x618c('0x1a')]({'raw':_0x2cd497[_0x618c('0x1b')]?_0x2cd497[_0x618c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2cd497[_0x618c('0x1b')]?_0x2cd497[_0x618c('0x1b')][_0x618c('0x1c')]||null:null,'attributes':_0x2cd497[_0x618c('0x1b')]?_0x2cd497[_0x618c('0x1b')][_0x618c('0x1d')]||null:null,'limit':_0x2cd497[_0x618c('0x1b')]?_0x2cd497[_0x618c('0x1b')][_0x618c('0x1e')]||null:null,'include':_0x2cd497[_0x618c('0x1b')]?_0x2cd497['options'][_0x618c('0x1f')]?_['map'](_0x2cd497[_0x618c('0x1b')][_0x618c('0x1f')],function(_0x41cdc4){return{'model':db[_0x41cdc4[_0x618c('0x20')]],'as':_0x41cdc4['as'],'attributes':_0x41cdc4[_0x618c('0x1d')],'include':_0x41cdc4[_0x618c('0x1f')]?_[_0x618c('0x21')](_0x41cdc4[_0x618c('0x1f')],function(_0x4586b5){return{'model':db[_0x4586b5[_0x618c('0x20')]],'as':_0x4586b5['as'],'attributes':_0x4586b5[_0x618c('0x1d')],'include':_0x4586b5[_0x618c('0x1f')]?_[_0x618c('0x21')](_0x4586b5['include'],function(_0x4c329f){return{'model':db[_0x4c329f[_0x618c('0x20')]],'as':_0x4c329f['as'],'attributes':_0x4c329f['attributes']};}):[]};}):[]};}):[]:[]})[_0x618c('0x22')](function(_0x346cfc){logger['info'](_0x618c('0x18'),_0x2cd497);logger[_0x618c('0x10')]('GetCmHopper',_0x2cd497,JSON[_0x618c('0x12')](_0x346cfc));_0x5091ae(_0x346cfc);})[_0x618c('0x17')](function(_0x4cf2cf){logger['error'](_0x618c('0x18'),_0x4cf2cf['message'],_0x2cd497);_0x436fd7(_0x1ce350[_0x618c('0x13')](0x1f4,_0x4cf2cf[_0x618c('0x14')]));});});};exports['ShowCmHopper']=function(_0x337e39){var _0x3ec499=this;return new Promise(function(_0x15d0c1,_0x5ba062){return db[_0x618c('0x19')][_0x618c('0x23')]({'raw':_0x337e39['options']?_0x337e39[_0x618c('0x1b')][_0x618c('0x24')]===undefined?!![]:![]:!![],'where':_0x337e39[_0x618c('0x1b')]?_0x337e39[_0x618c('0x1b')][_0x618c('0x1c')]||null:null,'attributes':_0x337e39[_0x618c('0x1b')]?_0x337e39['options']['attributes']||null:null,'include':_0x337e39[_0x618c('0x1b')]?_0x337e39[_0x618c('0x1b')]['include']?_['map'](_0x337e39['options'][_0x618c('0x1f')],function(_0x34d942){return{'model':db[_0x34d942[_0x618c('0x20')]],'as':_0x34d942['as'],'attributes':_0x34d942[_0x618c('0x1d')],'include':_0x34d942[_0x618c('0x1f')]?_[_0x618c('0x21')](_0x34d942[_0x618c('0x1f')],function(_0x129475){return{'model':db[_0x129475[_0x618c('0x20')]],'as':_0x129475['as'],'attributes':_0x129475[_0x618c('0x1d')],'include':_0x129475[_0x618c('0x1f')]?_[_0x618c('0x21')](_0x129475[_0x618c('0x1f')],function(_0x524359){return{'model':db[_0x524359['model']],'as':_0x524359['as'],'attributes':_0x524359[_0x618c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x618c('0x22')](function(_0x2cc9b1){logger[_0x618c('0x15')](_0x618c('0x25'),_0x337e39);logger[_0x618c('0x10')](_0x618c('0x25'),_0x337e39,JSON['stringify'](_0x2cc9b1));_0x15d0c1(_0x2cc9b1);})[_0x618c('0x17')](function(_0x1d9fb4){logger[_0x618c('0x13')]('ShowCmHopper',_0x1d9fb4[_0x618c('0x14')],_0x337e39);_0x5ba062(_0x3ec499['error'](0x1f4,_0x1d9fb4[_0x618c('0x14')]));});});};exports[_0x618c('0x26')]=function(_0x2b1826){var _0xc34854=this;return new Promise(function(_0x262d51,_0x58c687){return db[_0x618c('0x19')][_0x618c('0x27')](_0x2b1826[_0x618c('0x28')],{'raw':_0x2b1826[_0x618c('0x1b')]?_0x2b1826['options'][_0x618c('0x24')]===undefined?!![]:![]:!![]})[_0x618c('0x22')](function(_0x28a9bc){logger[_0x618c('0x15')](_0x618c('0x26'),_0x2b1826);logger[_0x618c('0x10')](_0x618c('0x26'),_0x2b1826,JSON['stringify'](_0x28a9bc));_0x262d51(_0x28a9bc);})[_0x618c('0x17')](function(_0x1ae682){logger[_0x618c('0x13')](_0x618c('0x26'),_0x1ae682[_0x618c('0x14')],_0x2b1826);_0x58c687(_0xc34854[_0x618c('0x13')](0x1f4,_0x1ae682['message']));});});};exports[_0x618c('0x29')]=function(_0x34a5e1){var _0x1efa3e=this;return new Promise(function(_0x531e43,_0x176ccd){return db[_0x618c('0x19')][_0x618c('0x2a')](_0x34a5e1[_0x618c('0x28')],{'raw':_0x34a5e1[_0x618c('0x1b')]?_0x34a5e1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34a5e1[_0x618c('0x1b')]?_0x34a5e1[_0x618c('0x1b')][_0x618c('0x1c')]||null:null,'attributes':_0x34a5e1['options']?_0x34a5e1[_0x618c('0x1b')]['attributes']||null:null,'limit':_0x34a5e1['options']?_0x34a5e1[_0x618c('0x1b')][_0x618c('0x1e')]||null:null})['then'](function(_0x229315){logger[_0x618c('0x15')](_0x618c('0x29'),_0x34a5e1);logger[_0x618c('0x15')](_0x618c('0x2b'),JSON[_0x618c('0x12')](_0x34a5e1[_0x618c('0x1b')]['where']),_0x34a5e1[_0x618c('0x28')][_0x618c('0x2c')]);logger[_0x618c('0x10')](_0x618c('0x29'),_0x34a5e1,JSON[_0x618c('0x12')](_0x229315));_0x531e43(_0x229315);})['catch'](function(_0x59baef){logger['error'](_0x618c('0x29'),_0x59baef[_0x618c('0x14')],_0x34a5e1);_0x176ccd(_0x1efa3e[_0x618c('0x13')](0x1f4,_0x59baef[_0x618c('0x14')]));});});};exports[_0x618c('0x2d')]=function(_0x1b55be){var _0x4a2755=this;return new Promise(function(_0x2f6590,_0x1766a1){return db[_0x618c('0x19')]['destroy']({'where':_0x1b55be[_0x618c('0x1b')]?_0x1b55be[_0x618c('0x1b')][_0x618c('0x1c')]||null:null})[_0x618c('0x22')](function(_0x2ab1d5){logger['info']('DestroyCmHopper',_0x1b55be);logger[_0x618c('0x10')](_0x618c('0x2d'),_0x1b55be,JSON[_0x618c('0x12')](_0x2ab1d5));_0x2f6590(_0x2ab1d5);})[_0x618c('0x17')](function(_0x928e4b){logger[_0x618c('0x13')](_0x618c('0x2d'),_0x928e4b[_0x618c('0x14')],_0x1b55be);_0x1766a1(_0x4a2755['error'](0x1f4,_0x928e4b[_0x618c('0x14')]));});});};exports[_0x618c('0x2e')]=function(_0x243590){var _0x39a9d5=this;return new Promise(function(_0x4f41b4,_0x38f9cb){return db[_0x618c('0x2f')][_0x618c('0x30')]()[_0x618c('0x22')](function(_0x4f71fe){return db[_0x618c('0x31')][_0x618c('0x32')](function(_0x3f0070){return db[_0x618c('0x19')][_0x618c('0x1a')]({'where':_0x243590[_0x618c('0x1b')]?_0x243590[_0x618c('0x1b')]['where']||null:null,'attributes':_0x243590[_0x618c('0x1b')]?_0x243590['options']['attributes']||null:null,'limit':_0x243590[_0x618c('0x1b')]?_0x243590[_0x618c('0x1b')][_0x618c('0x1e')]||null:null,'order':_0x243590[_0x618c('0x1b')]?_0x243590[_0x618c('0x1b')]['order']||null:null,'transaction':_0x3f0070,'lock':_0x3f0070[_0x618c('0x33')][_0x618c('0x34')],'include':[{'model':db[_0x618c('0x2f')],'as':_0x618c('0x35'),'attributes':_['keys'](_0x4f71fe)},{'model':db[_0x618c('0x36')],'as':_0x618c('0x37'),'attributes':['id',_0x618c('0x38'),_0x618c('0x39')]}]})[_0x618c('0x22')](function(_0x20a5cc){var _0x1a2c9c=[];var _0x4f1a83=[];for(var _0x3a7571=0x0;_0x3a7571<_0x20a5cc[_0x618c('0x3a')];_0x3a7571+=0x1){var _0x413d4e=_0x20a5cc[_0x3a7571][_0x618c('0x3b')];if(_0x413d4e===null){_0x1a2c9c['push'](_0x20a5cc[_0x3a7571][_0x618c('0x2a')](_0x243590['body'],{'transaction':_0x3f0070}));}else if(!_0x4f1a83['includes'](_0x413d4e)){_0x4f1a83['push'](_0x413d4e);_0x1a2c9c[_0x618c('0x3c')](_0x20a5cc[_0x3a7571]['update'](_0x243590[_0x618c('0x28')],{'transaction':_0x3f0070}));}}return BPromise[_0x618c('0x3d')](_0x1a2c9c);});})[_0x618c('0x22')](function(_0x1ffc61){logger[_0x618c('0x15')](_0x618c('0x2e'),_0x243590);if(_0x1ffc61[_0x618c('0x3a')]>0x0){logger[_0x618c('0x15')](_0x618c('0x3e'),_0x1ffc61[0x0][_0x618c('0x3f')]['id'],_0x1ffc61[0x0]['dataValues']['ContactId'],_0x1ffc61[0x0]['dataValues']['active']);}logger[_0x618c('0x10')](_0x618c('0x2e'),_0x243590,JSON['stringify'](_0x1ffc61));_0x4f41b4(_0x1ffc61);})[_0x618c('0x17')](function(_0x5c90fe){logger[_0x618c('0x13')](_0x618c('0x2e'),_0x5c90fe[_0x618c('0x14')],_0x243590);_0x38f9cb(_0x39a9d5[_0x618c('0x13')](0x1f4,_0x5c90fe[_0x618c('0x14')]));});});});};exports[_0x618c('0x40')]=function(_0x25a77d){var _0x27420f=this;return new Promise(function(_0x30aecd,_0x187a28){return db[_0x618c('0x31')][_0x618c('0x32')](function(_0x5bce28){return db['CmHopperFinal'][_0x618c('0x27')](_0x25a77d[_0x618c('0x28')],{'raw':_0x25a77d[_0x618c('0x1b')]?_0x25a77d[_0x618c('0x1b')][_0x618c('0x24')]===undefined?!![]:![]:!![],'transaction':_0x5bce28})[_0x618c('0x22')](function(){logger[_0x618c('0x15')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x25a77d[_0x618c('0x1b')][_0x618c('0x1c')]),_0x25a77d['options'][_0x618c('0x1c')]['active']);return db['CmHopper']['destroy']({'where':_0x25a77d[_0x618c('0x1b')]?_0x25a77d[_0x618c('0x1b')][_0x618c('0x1c')]||null:null,'transaction':_0x5bce28});});})['then'](function(_0x24827b){logger[_0x618c('0x15')](_0x618c('0x40'),_0x25a77d);logger[_0x618c('0x10')](_0x618c('0x40'),_0x25a77d,JSON[_0x618c('0x12')](_0x24827b));_0x30aecd(_0x24827b);})['catch'](function(_0x156aa5){logger[_0x618c('0x13')](_0x618c('0x40'),_0x156aa5['message'],_0x25a77d);_0x187a28(_0x27420f[_0x618c('0x13')](0x1f4,_0x156aa5[_0x618c('0x14')]));});});};exports['CountReScheduled']=function(_0x2535c4){var _0x5e2d70=this;return new Promise(function(_0x549127,_0x176ab7){return db[_0x618c('0x19')][_0x618c('0x1a')]({'raw':_0x2535c4['options']?_0x2535c4[_0x618c('0x1b')][_0x618c('0x24')]===undefined?!![]:![]:!![],'where':_0x2535c4[_0x618c('0x1b')]?_0x2535c4[_0x618c('0x1b')][_0x618c('0x1c')]||null:null,'attributes':[[db[_0x618c('0x31')]['fn'](_0x618c('0x41'),db[_0x618c('0x31')]['fn']('IF',db[_0x618c('0x31')][_0x618c('0x42')](_0x618c('0x43')+util[_0x618c('0x44')](_0x618c('0x45'),moment()[_0x618c('0x44')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x618c('0x46')))),_0x618c('0x47')]]})[_0x618c('0x22')](function(_0x2ecc70){logger[_0x618c('0x15')](_0x618c('0x48'),_0x2535c4);logger[_0x618c('0x10')]('CountReScheduled',_0x2535c4,JSON[_0x618c('0x12')](_0x2ecc70));_0x549127(_0x2ecc70);})[_0x618c('0x17')](function(_0x9d9ff7){logger[_0x618c('0x13')](_0x618c('0x48'),_0x9d9ff7[_0x618c('0x14')],_0x2535c4);_0x176ab7(_0x5e2d70[_0x618c('0x13')](0x1f4,_0x9d9ff7[_0x618c('0x14')]));});});};exports[_0x618c('0x49')]=function(_0x1fdaf6){var _0x5b99b0=this;return new Promise(function(_0x1461fb,_0xc9ee0c){return db[_0x618c('0x2f')][_0x618c('0x30')]()['then'](function(_0x162dbe){return db[_0x618c('0x31')][_0x618c('0x32')](function(_0x24db02){return db[_0x618c('0x19')][_0x618c('0x1a')]({'where':_0x1fdaf6['options']?_0x1fdaf6[_0x618c('0x1b')][_0x618c('0x1c')]||null:null,'attributes':_0x1fdaf6['options']?_0x1fdaf6[_0x618c('0x1b')]['attributes']||null:null,'limit':0x1,'order':_0x1fdaf6[_0x618c('0x1b')]?_0x1fdaf6['options'][_0x618c('0x4a')]||null:null,'group':db[_0x618c('0x19')]['UserId'],'transaction':_0x24db02,'lock':_0x24db02[_0x618c('0x33')][_0x618c('0x34')],'include':_0x1fdaf6[_0x618c('0x1b')]?_0x1fdaf6[_0x618c('0x1b')][_0x618c('0x1f')]?_[_0x618c('0x21')](_0x1fdaf6[_0x618c('0x1b')][_0x618c('0x1f')],function(_0x25ed86){return{'model':db[_0x25ed86[_0x618c('0x20')]],'as':_0x25ed86['as'],'attributes':_0x25ed86[_0x618c('0x1d')],'include':_0x25ed86[_0x618c('0x1f')]?_[_0x618c('0x21')](_0x25ed86['include'],function(_0xe25724){return{'model':db[_0xe25724['model']],'as':_0xe25724['as'],'attributes':_0xe25724[_0x618c('0x1d')],'include':_0xe25724['include']?_[_0x618c('0x21')](_0xe25724[_0x618c('0x1f')],function(_0x57df35){return{'model':db[_0x57df35[_0x618c('0x20')]],'as':_0x57df35['as'],'attributes':_0x57df35[_0x618c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9042de){var _0x802f6b=[];for(var _0x13867f=0x0;_0x13867f<_0x9042de['length'];_0x13867f+=0x1){_0x802f6b[_0x618c('0x3c')](_0x9042de[_0x13867f][_0x618c('0x2a')](_0x1fdaf6['body'],{'transaction':_0x24db02}));}return BPromise['all'](_0x802f6b);});})['then'](function(_0x4650c9){logger['info'](_0x618c('0x49'),_0x1fdaf6);logger[_0x618c('0x10')](_0x618c('0x49'),_0x1fdaf6,JSON[_0x618c('0x12')](_0x4650c9));_0x1461fb(_0x4650c9);})['catch'](function(_0x26db25){logger[_0x618c('0x13')](_0x618c('0x49'),_0x26db25[_0x618c('0x14')],_0x1fdaf6);_0xc9ee0c(_0x5b99b0['error'](0x1f4,_0x26db25[_0x618c('0x14')]));});});});};exports[_0x618c('0x4b')]=function(_0x562b53){var _0x1e8014=this;return new Promise(function(_0x595ae4,_0x3ed3fc){db[_0x618c('0x2f')]['describe']()['then'](function(_0x13a0cc){return db[_0x618c('0x19')][_0x618c('0x1a')]({'raw':_0x562b53['options']?_0x562b53['options'][_0x618c('0x24')]===undefined?!![]:![]:!![],'where':_0x562b53[_0x618c('0x1b')]?_0x562b53[_0x618c('0x1b')][_0x618c('0x1c')]||null:null,'attributes':_0x562b53[_0x618c('0x1b')]?_0x562b53[_0x618c('0x1b')][_0x618c('0x1d')]||null:null,'limit':_0x562b53['options']?_0x562b53[_0x618c('0x1b')][_0x618c('0x1e')]||null:null,'include':_0x562b53[_0x618c('0x1b')]?_0x562b53[_0x618c('0x1b')][_0x618c('0x1f')]?_['map'](_0x562b53[_0x618c('0x1b')][_0x618c('0x1f')],function(_0x334e25){return{'model':db[_0x334e25[_0x618c('0x20')]],'as':_0x334e25['as'],'attributes':_0x334e25['as']==='Contact'?_[_0x618c('0x4c')](_0x13a0cc):_0x334e25['attributes'],'include':_0x334e25[_0x618c('0x1f')]?_['map'](_0x334e25[_0x618c('0x1f')],function(_0x2c31c4){return{'model':db[_0x2c31c4[_0x618c('0x20')]],'as':_0x2c31c4['as'],'attributes':_0x2c31c4[_0x618c('0x1d')],'include':_0x2c31c4['include']?_['map'](_0x2c31c4[_0x618c('0x1f')],function(_0x207e5d){return{'model':db[_0x207e5d[_0x618c('0x20')]],'as':_0x207e5d['as'],'attributes':_0x207e5d[_0x618c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x618c('0x22')](function(_0x477d27){logger[_0x618c('0x15')](_0x618c('0x18'),_0x562b53);logger[_0x618c('0x10')](_0x618c('0x18'),_0x562b53,JSON[_0x618c('0x12')](_0x477d27));_0x595ae4(_0x477d27);})['catch'](function(_0x52df41){logger[_0x618c('0x13')](_0x618c('0x18'),_0x52df41['message'],_0x562b53);_0x3ed3fc(_0x1e8014[_0x618c('0x13')](0x1f4,_0x52df41[_0x618c('0x14')]));});});});};exports[_0x618c('0x4d')]=function(_0x34295d){var _0x3f4e5a=this;return new Promise(function(_0x1c2831,_0x146141){return db[_0x618c('0x2f')][_0x618c('0x4e')]({'raw':!![],'where':{'phone':_0x34295d['options'][_0x618c('0x1c')][_0x618c('0x4f')]},'attributes':['id',_0x618c('0x50')],'order':[['id','DESC']]})['then'](function(_0x5afcdc){logger[_0x618c('0x15')](_0x618c('0x51'),_0x34295d);logger['debug'](_0x618c('0x51'),_0x34295d,JSON['stringify'](_0x5afcdc));_0x1c2831(_0x5afcdc);})[_0x618c('0x17')](function(_0x2117f1){logger[_0x618c('0x13')](_0x618c('0x51'),_0x2117f1[_0x618c('0x14')],_0x34295d);_0x146141(_0x3f4e5a[_0x618c('0x13')](0x1f4,_0x2117f1[_0x618c('0x14')]));});});};exports['ResetActiveCalls']=function(_0x9482c1){var _0x1899b2=this;return new Promise(function(_0x3c5d5c,_0x9c725e){return db[_0x618c('0x31')][_0x618c('0x32')](function(_0x3fc140){return db[_0x618c('0x19')][_0x618c('0x2a')]({'active':![]},{'where':{},'transaction':_0x3fc140})[_0x618c('0x22')](function(_0x3056a9){logger[_0x618c('0x15')](_0x618c('0x52'),_0x9482c1);logger['debug'](_0x618c('0x52'),_0x9482c1,JSON[_0x618c('0x12')](_0x3056a9));_0x3c5d5c(_0x3056a9);})[_0x618c('0x17')](function(_0x357613){logger['error'](_0x618c('0x52'),_0x357613['message'],_0x9482c1);_0x9c725e(_0x1899b2[_0x618c('0x13')](0x1f4,_0x357613['message']));});});});};exports[_0x618c('0x53')]=function(_0x48895b){var _0x4eff30=this;var _0x41afdf=_0x48895b[_0x618c('0x28')][_0x618c('0x1c')][_0x618c('0x54')];var _0x5ad52f=_0x48895b[_0x618c('0x28')]['where'][_0x618c('0x55')];return new Promise(function(_0x590a59,_0x3620c3){return db[_0x618c('0x19')][_0x618c('0x1a')]({'where':{'voiceQueueId':_0x41afdf,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x618c('0x31')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x5ad52f+_0x618c('0x56'))}},'include':[{'model':db[_0x618c('0x2f')],'as':_0x618c('0x35')},{'model':db[_0x618c('0x36')],'as':'Agent','attributes':['id','name',_0x618c('0x39')]},{'model':db[_0x618c('0x57')],'as':_0x618c('0x58')}]})[_0x618c('0x22')](function(_0x292c7f){return db[_0x618c('0x31')]['transaction'](function(_0x35dd72){return db['CmHopper'][_0x618c('0x2a')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x41afdf,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x618c('0x31')][_0x618c('0x42')]('NOW()\x20+\x20INTERVAL\x20'+_0x5ad52f+_0x618c('0x56'))}},'transaction':_0x35dd72})[_0x618c('0x22')](function(_0x29a9b8){_0x590a59(_0x292c7f);})['catch'](function(_0x34b500){logger[_0x618c('0x13')](_0x618c('0x53'),_0x34b500[_0x618c('0x14')],_0x48895b);_0x3620c3(validateExpressRequest);});});})[_0x618c('0x17')](function(_0x5821e3){logger['error'](_0x618c('0x53'),_0x5821e3[_0x618c('0x14')],_0x48895b);_0x3620c3(_0x4eff30[_0x618c('0x13')](0x1f4,_0x5821e3[_0x618c('0x14')]));});});}; \ No newline at end of file +var _0x15c1=['ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','request','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw','where','limit','include','map','model','attributes','then','GetCmHopper','ShowCmHopper','CmHopper','find','CreateCmHopper','body','UpdateCmHopper','active','DestroyCmHopper','destroy','GetContactDialer','sequelize','transaction','order','LOCK','UPDATE','CmContact','Contact','keys','User','Agent','name','voicePause','UserId','includes','update','all','length','dataValues','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','GetContactRecallMe','describe','GetCmHopperPreview','GetContactByPhone','findOne','phone','DESC','getContactByPhone'];(function(_0x5d1a35,_0x32ec36){var _0xcd4eb5=function(_0x3f4e6c){while(--_0x3f4e6c){_0x5d1a35['push'](_0x5d1a35['shift']());}};_0xcd4eb5(++_0x32ec36);}(_0x15c1,0x167));var _0x115c=function(_0x47384b,_0x581154){_0x47384b=_0x47384b-0x0;var _0x1dc367=_0x15c1[_0x47384b];return _0x1dc367;};'use strict';var _=require(_0x115c('0x0'));var util=require('util');var moment=require(_0x115c('0x1'));var BPromise=require('bluebird');var rs=require(_0x115c('0x2'));var fs=require('fs');var Redis=require(_0x115c('0x3'));var db=require(_0x115c('0x4'))['db'];var utils=require(_0x115c('0x5'));var logger=require('../../config/logger')(_0x115c('0x6'));var config=require(_0x115c('0x7'));var jayson=require(_0x115c('0x8'));const {validateExpressRequest}=require(_0x115c('0x9'));var client=jayson[_0x115c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x434ab6,_0x3a59ed,_0x14f806){return new BPromise(function(_0x54d5a6,_0x41dea){return client[_0x115c('0xb')](_0x434ab6,_0x14f806)['then'](function(_0x51f222){logger['info']('CmHopper,\x20%s,\x20%s',_0x3a59ed,_0x115c('0xc'));logger[_0x115c('0xd')](_0x115c('0xe'),_0x3a59ed,_0x115c('0xc'),JSON[_0x115c('0xf')](_0x51f222));if(_0x51f222[_0x115c('0x10')]){if(_0x51f222[_0x115c('0x10')][_0x115c('0x11')]===0x1f4){logger[_0x115c('0x10')](_0x115c('0x12'),_0x3a59ed,_0x51f222[_0x115c('0x10')][_0x115c('0x13')]);return _0x41dea(_0x51f222[_0x115c('0x10')][_0x115c('0x13')]);}logger[_0x115c('0x10')](_0x115c('0x12'),_0x3a59ed,_0x51f222[_0x115c('0x10')][_0x115c('0x13')]);return _0x54d5a6(_0x51f222[_0x115c('0x10')][_0x115c('0x13')]);}else{logger[_0x115c('0x14')](_0x115c('0x12'),_0x3a59ed,_0x115c('0xc'));_0x54d5a6(_0x51f222[_0x115c('0x15')][_0x115c('0x13')]);}})[_0x115c('0x16')](function(_0x5e3178){logger['error'](_0x115c('0x12'),_0x3a59ed,_0x5e3178);_0x41dea(_0x5e3178);});});}exports['GetCmHopper']=function(_0x3964eb){var _0x302bfa=this;return new Promise(function(_0x256cd4,_0x1d6be8){return db['CmHopper'][_0x115c('0x17')]({'raw':_0x3964eb['options']?_0x3964eb[_0x115c('0x18')][_0x115c('0x19')]===undefined?!![]:![]:!![],'where':_0x3964eb[_0x115c('0x18')]?_0x3964eb[_0x115c('0x18')][_0x115c('0x1a')]||null:null,'attributes':_0x3964eb[_0x115c('0x18')]?_0x3964eb[_0x115c('0x18')]['attributes']||null:null,'limit':_0x3964eb[_0x115c('0x18')]?_0x3964eb[_0x115c('0x18')][_0x115c('0x1b')]||null:null,'include':_0x3964eb[_0x115c('0x18')]?_0x3964eb['options'][_0x115c('0x1c')]?_[_0x115c('0x1d')](_0x3964eb[_0x115c('0x18')][_0x115c('0x1c')],function(_0x1fe02c){return{'model':db[_0x1fe02c[_0x115c('0x1e')]],'as':_0x1fe02c['as'],'attributes':_0x1fe02c[_0x115c('0x1f')],'include':_0x1fe02c[_0x115c('0x1c')]?_[_0x115c('0x1d')](_0x1fe02c[_0x115c('0x1c')],function(_0x1f89e9){return{'model':db[_0x1f89e9[_0x115c('0x1e')]],'as':_0x1f89e9['as'],'attributes':_0x1f89e9[_0x115c('0x1f')],'include':_0x1f89e9['include']?_['map'](_0x1f89e9[_0x115c('0x1c')],function(_0x38a61a){return{'model':db[_0x38a61a['model']],'as':_0x38a61a['as'],'attributes':_0x38a61a['attributes']};}):[]};}):[]};}):[]:[]})[_0x115c('0x20')](function(_0x4fda9d){logger['info'](_0x115c('0x21'),_0x3964eb);logger['debug'](_0x115c('0x21'),_0x3964eb,JSON[_0x115c('0xf')](_0x4fda9d));_0x256cd4(_0x4fda9d);})[_0x115c('0x16')](function(_0x463461){logger['error'](_0x115c('0x21'),_0x463461[_0x115c('0x13')],_0x3964eb);_0x1d6be8(_0x302bfa[_0x115c('0x10')](0x1f4,_0x463461[_0x115c('0x13')]));});});};exports[_0x115c('0x22')]=function(_0x3d64ac){var _0x12fe05=this;return new Promise(function(_0x337468,_0xc9269e){return db[_0x115c('0x23')][_0x115c('0x24')]({'raw':_0x3d64ac[_0x115c('0x18')]?_0x3d64ac['options'][_0x115c('0x19')]===undefined?!![]:![]:!![],'where':_0x3d64ac['options']?_0x3d64ac[_0x115c('0x18')]['where']||null:null,'attributes':_0x3d64ac[_0x115c('0x18')]?_0x3d64ac[_0x115c('0x18')][_0x115c('0x1f')]||null:null,'include':_0x3d64ac[_0x115c('0x18')]?_0x3d64ac[_0x115c('0x18')][_0x115c('0x1c')]?_[_0x115c('0x1d')](_0x3d64ac[_0x115c('0x18')][_0x115c('0x1c')],function(_0x4806ca){return{'model':db[_0x4806ca[_0x115c('0x1e')]],'as':_0x4806ca['as'],'attributes':_0x4806ca[_0x115c('0x1f')],'include':_0x4806ca[_0x115c('0x1c')]?_[_0x115c('0x1d')](_0x4806ca[_0x115c('0x1c')],function(_0x3d3ab8){return{'model':db[_0x3d3ab8[_0x115c('0x1e')]],'as':_0x3d3ab8['as'],'attributes':_0x3d3ab8['attributes'],'include':_0x3d3ab8[_0x115c('0x1c')]?_[_0x115c('0x1d')](_0x3d3ab8[_0x115c('0x1c')],function(_0x110e4c){return{'model':db[_0x110e4c[_0x115c('0x1e')]],'as':_0x110e4c['as'],'attributes':_0x110e4c[_0x115c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41ab80){logger[_0x115c('0x14')]('ShowCmHopper',_0x3d64ac);logger[_0x115c('0xd')]('ShowCmHopper',_0x3d64ac,JSON[_0x115c('0xf')](_0x41ab80));_0x337468(_0x41ab80);})[_0x115c('0x16')](function(_0x518e60){logger[_0x115c('0x10')]('ShowCmHopper',_0x518e60[_0x115c('0x13')],_0x3d64ac);_0xc9269e(_0x12fe05[_0x115c('0x10')](0x1f4,_0x518e60[_0x115c('0x13')]));});});};exports[_0x115c('0x25')]=function(_0x4770da){var _0x4ae5b4=this;return new Promise(function(_0x154f1c,_0x4efb55){return db[_0x115c('0x23')]['create'](_0x4770da[_0x115c('0x26')],{'raw':_0x4770da[_0x115c('0x18')]?_0x4770da[_0x115c('0x18')][_0x115c('0x19')]===undefined?!![]:![]:!![]})[_0x115c('0x20')](function(_0x5bd578){logger['info'](_0x115c('0x25'),_0x4770da);logger[_0x115c('0xd')]('CreateCmHopper',_0x4770da,JSON['stringify'](_0x5bd578));_0x154f1c(_0x5bd578);})[_0x115c('0x16')](function(_0x291392){logger[_0x115c('0x10')](_0x115c('0x25'),_0x291392[_0x115c('0x13')],_0x4770da);_0x4efb55(_0x4ae5b4[_0x115c('0x10')](0x1f4,_0x291392[_0x115c('0x13')]));});});};exports[_0x115c('0x27')]=function(_0x251ef6){var _0x38121f=this;return new Promise(function(_0x68ae38,_0x2ebdfc){return db[_0x115c('0x23')]['update'](_0x251ef6['body'],{'raw':_0x251ef6[_0x115c('0x18')]?_0x251ef6[_0x115c('0x18')][_0x115c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x251ef6['options']?_0x251ef6[_0x115c('0x18')][_0x115c('0x1a')]||null:null,'attributes':_0x251ef6[_0x115c('0x18')]?_0x251ef6[_0x115c('0x18')][_0x115c('0x1f')]||null:null,'limit':_0x251ef6[_0x115c('0x18')]?_0x251ef6[_0x115c('0x18')]['limit']||null:null})[_0x115c('0x20')](function(_0x1b3d36){logger[_0x115c('0x14')](_0x115c('0x27'),_0x251ef6);logger[_0x115c('0x14')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x251ef6[_0x115c('0x18')][_0x115c('0x1a')]),_0x251ef6[_0x115c('0x26')][_0x115c('0x28')]);logger[_0x115c('0xd')](_0x115c('0x27'),_0x251ef6,JSON[_0x115c('0xf')](_0x1b3d36));_0x68ae38(_0x1b3d36);})[_0x115c('0x16')](function(_0xdad3e6){logger[_0x115c('0x10')]('UpdateCmHopper',_0xdad3e6[_0x115c('0x13')],_0x251ef6);_0x2ebdfc(_0x38121f[_0x115c('0x10')](0x1f4,_0xdad3e6['message']));});});};exports[_0x115c('0x29')]=function(_0x313176){var _0x479709=this;return new Promise(function(_0xc4df10,_0x16decd){return db[_0x115c('0x23')][_0x115c('0x2a')]({'where':_0x313176[_0x115c('0x18')]?_0x313176[_0x115c('0x18')][_0x115c('0x1a')]||null:null})[_0x115c('0x20')](function(_0x2f50dd){logger[_0x115c('0x14')]('DestroyCmHopper',_0x313176);logger[_0x115c('0xd')](_0x115c('0x29'),_0x313176,JSON[_0x115c('0xf')](_0x2f50dd));_0xc4df10(_0x2f50dd);})[_0x115c('0x16')](function(_0x26add5){logger[_0x115c('0x10')](_0x115c('0x29'),_0x26add5[_0x115c('0x13')],_0x313176);_0x16decd(_0x479709['error'](0x1f4,_0x26add5['message']));});});};exports[_0x115c('0x2b')]=function(_0x515cab){var _0x3d303b=this;return new Promise(function(_0x39b9de,_0x533e8e){return db['CmContact']['describe']()[_0x115c('0x20')](function(_0xe026c8){return db[_0x115c('0x2c')][_0x115c('0x2d')](function(_0x5bfb7e){return db['CmHopper'][_0x115c('0x17')]({'where':_0x515cab['options']?_0x515cab[_0x115c('0x18')]['where']||null:null,'attributes':_0x515cab['options']?_0x515cab['options'][_0x115c('0x1f')]||null:null,'limit':_0x515cab[_0x115c('0x18')]?_0x515cab[_0x115c('0x18')][_0x115c('0x1b')]||null:null,'order':_0x515cab[_0x115c('0x18')]?_0x515cab['options'][_0x115c('0x2e')]||null:null,'transaction':_0x5bfb7e,'lock':_0x5bfb7e[_0x115c('0x2f')][_0x115c('0x30')],'include':[{'model':db[_0x115c('0x31')],'as':_0x115c('0x32'),'attributes':_[_0x115c('0x33')](_0xe026c8)},{'model':db[_0x115c('0x34')],'as':_0x115c('0x35'),'attributes':['id',_0x115c('0x36'),_0x115c('0x37')]}]})['then'](function(_0x2c2e57){var _0x338aed=[];var _0x1cc940=[];for(var _0x40b0f8=0x0;_0x40b0f8<_0x2c2e57['length'];_0x40b0f8+=0x1){var _0x1d05f8=_0x2c2e57[_0x40b0f8][_0x115c('0x38')];if(_0x1d05f8===null){_0x338aed['push'](_0x2c2e57[_0x40b0f8]['update'](_0x515cab['body'],{'transaction':_0x5bfb7e}));}else if(!_0x1cc940[_0x115c('0x39')](_0x1d05f8)){_0x1cc940['push'](_0x1d05f8);_0x338aed['push'](_0x2c2e57[_0x40b0f8][_0x115c('0x3a')](_0x515cab[_0x115c('0x26')],{'transaction':_0x5bfb7e}));}}return BPromise[_0x115c('0x3b')](_0x338aed);});})[_0x115c('0x20')](function(_0x26c101){logger[_0x115c('0x14')]('GetContactDialer',_0x515cab);if(_0x26c101[_0x115c('0x3c')]>0x0){logger[_0x115c('0x14')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x26c101[0x0][_0x115c('0x3d')]['id'],_0x26c101[0x0][_0x115c('0x3d')]['ContactId'],_0x26c101[0x0][_0x115c('0x3d')]['active']);}logger[_0x115c('0xd')](_0x115c('0x2b'),_0x515cab,JSON[_0x115c('0xf')](_0x26c101));_0x39b9de(_0x26c101);})[_0x115c('0x16')](function(_0x413f67){logger[_0x115c('0x10')](_0x115c('0x2b'),_0x413f67[_0x115c('0x13')],_0x515cab);_0x533e8e(_0x3d303b[_0x115c('0x10')](0x1f4,_0x413f67[_0x115c('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x4d685f){var _0x273a5f=this;return new Promise(function(_0x58d4b7,_0x839e4c){return db[_0x115c('0x2c')][_0x115c('0x2d')](function(_0x2de699){return db[_0x115c('0x3e')][_0x115c('0x3f')](_0x4d685f[_0x115c('0x26')],{'raw':_0x4d685f[_0x115c('0x18')]?_0x4d685f[_0x115c('0x18')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2de699})[_0x115c('0x20')](function(){logger[_0x115c('0x14')](_0x115c('0x40'),JSON[_0x115c('0xf')](_0x4d685f[_0x115c('0x18')][_0x115c('0x1a')]),_0x4d685f[_0x115c('0x18')][_0x115c('0x1a')][_0x115c('0x28')]);return db['CmHopper']['destroy']({'where':_0x4d685f[_0x115c('0x18')]?_0x4d685f[_0x115c('0x18')]['where']||null:null,'transaction':_0x2de699});});})[_0x115c('0x20')](function(_0x5ab083){logger[_0x115c('0x14')](_0x115c('0x41'),_0x4d685f);logger[_0x115c('0xd')](_0x115c('0x41'),_0x4d685f,JSON['stringify'](_0x5ab083));_0x58d4b7(_0x5ab083);})[_0x115c('0x16')](function(_0x55c62d){logger[_0x115c('0x10')](_0x115c('0x41'),_0x55c62d[_0x115c('0x13')],_0x4d685f);_0x839e4c(_0x273a5f[_0x115c('0x10')](0x1f4,_0x55c62d[_0x115c('0x13')]));});});};exports[_0x115c('0x42')]=function(_0x72c013){var _0x277837=this;return new Promise(function(_0x31f46d,_0x51cff0){return db[_0x115c('0x23')][_0x115c('0x17')]({'raw':_0x72c013[_0x115c('0x18')]?_0x72c013[_0x115c('0x18')][_0x115c('0x19')]===undefined?!![]:![]:!![],'where':_0x72c013[_0x115c('0x18')]?_0x72c013[_0x115c('0x18')][_0x115c('0x1a')]||null:null,'attributes':[[db[_0x115c('0x2c')]['fn'](_0x115c('0x43'),db[_0x115c('0x2c')]['fn']('IF',db[_0x115c('0x2c')][_0x115c('0x44')](_0x115c('0x45')+util['format'](_0x115c('0x46'),moment()[_0x115c('0x47')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x115c('0x48')))),'contactsRescheduled']]})[_0x115c('0x20')](function(_0x190ffa){logger['info']('CountReScheduled',_0x72c013);logger[_0x115c('0xd')](_0x115c('0x42'),_0x72c013,JSON['stringify'](_0x190ffa));_0x31f46d(_0x190ffa);})[_0x115c('0x16')](function(_0xcdac47){logger[_0x115c('0x10')](_0x115c('0x42'),_0xcdac47[_0x115c('0x13')],_0x72c013);_0x51cff0(_0x277837[_0x115c('0x10')](0x1f4,_0xcdac47['message']));});});};exports[_0x115c('0x49')]=function(_0x90fad8){var _0x13ef6c=this;return new Promise(function(_0x46fe69,_0x3f7e1e){return db[_0x115c('0x31')][_0x115c('0x4a')]()[_0x115c('0x20')](function(_0x336366){return db[_0x115c('0x2c')][_0x115c('0x2d')](function(_0x56390d){return db['CmHopper'][_0x115c('0x17')]({'where':_0x90fad8['options']?_0x90fad8[_0x115c('0x18')]['where']||null:null,'attributes':_0x90fad8[_0x115c('0x18')]?_0x90fad8[_0x115c('0x18')][_0x115c('0x1f')]||null:null,'limit':0x1,'order':_0x90fad8[_0x115c('0x18')]?_0x90fad8[_0x115c('0x18')][_0x115c('0x2e')]||null:null,'group':db[_0x115c('0x23')][_0x115c('0x38')],'transaction':_0x56390d,'lock':_0x56390d[_0x115c('0x2f')][_0x115c('0x30')],'include':_0x90fad8['options']?_0x90fad8[_0x115c('0x18')][_0x115c('0x1c')]?_[_0x115c('0x1d')](_0x90fad8[_0x115c('0x18')]['include'],function(_0x23200e){return{'model':db[_0x23200e['model']],'as':_0x23200e['as'],'attributes':_0x23200e['attributes'],'include':_0x23200e['include']?_[_0x115c('0x1d')](_0x23200e[_0x115c('0x1c')],function(_0x39d865){return{'model':db[_0x39d865['model']],'as':_0x39d865['as'],'attributes':_0x39d865[_0x115c('0x1f')],'include':_0x39d865['include']?_[_0x115c('0x1d')](_0x39d865['include'],function(_0x21fc8d){return{'model':db[_0x21fc8d['model']],'as':_0x21fc8d['as'],'attributes':_0x21fc8d[_0x115c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57abca){var _0xa548d5=[];for(var _0x1c599f=0x0;_0x1c599f<_0x57abca[_0x115c('0x3c')];_0x1c599f+=0x1){_0xa548d5['push'](_0x57abca[_0x1c599f][_0x115c('0x3a')](_0x90fad8['body'],{'transaction':_0x56390d}));}return BPromise['all'](_0xa548d5);});})['then'](function(_0x53859c){logger[_0x115c('0x14')](_0x115c('0x49'),_0x90fad8);logger[_0x115c('0xd')](_0x115c('0x49'),_0x90fad8,JSON[_0x115c('0xf')](_0x53859c));_0x46fe69(_0x53859c);})[_0x115c('0x16')](function(_0x2f89a8){logger[_0x115c('0x10')](_0x115c('0x49'),_0x2f89a8[_0x115c('0x13')],_0x90fad8);_0x3f7e1e(_0x13ef6c['error'](0x1f4,_0x2f89a8[_0x115c('0x13')]));});});});};exports[_0x115c('0x4b')]=function(_0x176090){var _0x50fe41=this;return new Promise(function(_0x3dbaef,_0x1c42a1){db[_0x115c('0x31')][_0x115c('0x4a')]()[_0x115c('0x20')](function(_0x4781f3){return db[_0x115c('0x23')]['findAll']({'raw':_0x176090[_0x115c('0x18')]?_0x176090[_0x115c('0x18')][_0x115c('0x19')]===undefined?!![]:![]:!![],'where':_0x176090[_0x115c('0x18')]?_0x176090[_0x115c('0x18')][_0x115c('0x1a')]||null:null,'attributes':_0x176090[_0x115c('0x18')]?_0x176090[_0x115c('0x18')]['attributes']||null:null,'limit':_0x176090[_0x115c('0x18')]?_0x176090['options']['limit']||null:null,'include':_0x176090['options']?_0x176090[_0x115c('0x18')][_0x115c('0x1c')]?_[_0x115c('0x1d')](_0x176090['options']['include'],function(_0x43c57c){return{'model':db[_0x43c57c[_0x115c('0x1e')]],'as':_0x43c57c['as'],'attributes':_0x43c57c['as']==='Contact'?_[_0x115c('0x33')](_0x4781f3):_0x43c57c[_0x115c('0x1f')],'include':_0x43c57c[_0x115c('0x1c')]?_[_0x115c('0x1d')](_0x43c57c['include'],function(_0x5484d4){return{'model':db[_0x5484d4[_0x115c('0x1e')]],'as':_0x5484d4['as'],'attributes':_0x5484d4[_0x115c('0x1f')],'include':_0x5484d4[_0x115c('0x1c')]?_['map'](_0x5484d4[_0x115c('0x1c')],function(_0x1cda1b){return{'model':db[_0x1cda1b[_0x115c('0x1e')]],'as':_0x1cda1b['as'],'attributes':_0x1cda1b[_0x115c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b5554){logger[_0x115c('0x14')](_0x115c('0x21'),_0x176090);logger['debug'](_0x115c('0x21'),_0x176090,JSON[_0x115c('0xf')](_0x4b5554));_0x3dbaef(_0x4b5554);})['catch'](function(_0x2cbeae){logger[_0x115c('0x10')]('GetCmHopper',_0x2cbeae[_0x115c('0x13')],_0x176090);_0x1c42a1(_0x50fe41['error'](0x1f4,_0x2cbeae[_0x115c('0x13')]));});});});};exports[_0x115c('0x4c')]=function(_0x5e693c){var _0x3ccef6=this;return new Promise(function(_0x268ee7,_0x1e1d17){return db[_0x115c('0x31')][_0x115c('0x4d')]({'raw':!![],'where':{'phone':_0x5e693c[_0x115c('0x18')][_0x115c('0x1a')][_0x115c('0x4e')]},'attributes':['id','dialTimezone'],'order':[['id',_0x115c('0x4f')]]})[_0x115c('0x20')](function(_0x161d5a){logger[_0x115c('0x14')](_0x115c('0x50'),_0x5e693c);logger[_0x115c('0xd')](_0x115c('0x50'),_0x5e693c,JSON[_0x115c('0xf')](_0x161d5a));_0x268ee7(_0x161d5a);})[_0x115c('0x16')](function(_0x470b62){logger['error'](_0x115c('0x50'),_0x470b62[_0x115c('0x13')],_0x5e693c);_0x1e1d17(_0x3ccef6[_0x115c('0x10')](0x1f4,_0x470b62['message']));});});};exports[_0x115c('0x51')]=function(_0x320ad3){var _0x3d8287=this;return new Promise(function(_0xb92d33,_0x5d139e){return db['sequelize'][_0x115c('0x2d')](function(_0x3178fc){return db[_0x115c('0x23')]['update']({'active':![]},{'where':{},'transaction':_0x3178fc})[_0x115c('0x20')](function(_0x1ef964){logger['info'](_0x115c('0x51'),_0x320ad3);logger[_0x115c('0xd')](_0x115c('0x51'),_0x320ad3,JSON[_0x115c('0xf')](_0x1ef964));_0xb92d33(_0x1ef964);})[_0x115c('0x16')](function(_0x264f37){logger[_0x115c('0x10')](_0x115c('0x51'),_0x264f37[_0x115c('0x13')],_0x320ad3);_0x5d139e(_0x3d8287['error'](0x1f4,_0x264f37['message']));});});});};exports[_0x115c('0x52')]=function(_0xbdc0b0){var _0x45c377=this;var _0x3d6282=_0xbdc0b0[_0x115c('0x26')]['where'][_0x115c('0x53')];var _0xc03c03=_0xbdc0b0[_0x115c('0x26')][_0x115c('0x1a')][_0x115c('0x54')];return new Promise(function(_0x3e1146,_0x346979){return db[_0x115c('0x23')]['findAll']({'where':{'voiceQueueId':_0x3d6282,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x115c('0x2c')][_0x115c('0x44')](_0x115c('0x55')+_0xc03c03+_0x115c('0x56'))}},'include':[{'model':db[_0x115c('0x31')],'as':_0x115c('0x32')},{'model':db['User'],'as':'Agent','attributes':['id','name',_0x115c('0x37')]},{'model':db[_0x115c('0x57')],'as':'List'}]})[_0x115c('0x20')](function(_0x341e9f){return db[_0x115c('0x2c')]['transaction'](function(_0x593e06){return db[_0x115c('0x23')][_0x115c('0x3a')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x3d6282,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x115c('0x2c')][_0x115c('0x44')]('NOW()\x20+\x20INTERVAL\x20'+_0xc03c03+_0x115c('0x56'))}},'transaction':_0x593e06})[_0x115c('0x20')](function(_0x1219cb){_0x3e1146(_0x341e9f);})[_0x115c('0x16')](function(_0x19351a){logger[_0x115c('0x10')]('CmHopperHandlePreviewRecallNotifications',_0x19351a[_0x115c('0x13')],_0xbdc0b0);_0x346979(validateExpressRequest);});});})[_0x115c('0x16')](function(_0x2b4955){logger['error'](_0x115c('0x52'),_0x2b4955[_0x115c('0x13')],_0xbdc0b0);_0x346979(_0x45c377['error'](0x1f4,_0x2b4955[_0x115c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 4c6926b..40f34d8 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 _0xda6f=['get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','post','create','/preview','/timezone','/previewrecall','getPreviewRecall','put','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xda6f,0x148));var _0xfda6=function(_0x50707e,_0x14fc7c){_0x50707e=_0x50707e-0x0;var _0x12b962=_0xda6f[_0x50707e];return _0x12b962;};'use strict';var multer=require(_0xfda6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfda6('0x1'));var express=require('express');var router=express[_0xfda6('0x2')]();var fs_extra=require(_0xfda6('0x3'));var auth=require(_0xfda6('0x4'));var interaction=require(_0xfda6('0x5'));var config=require(_0xfda6('0x6'));var controller=require(_0xfda6('0x7'));router[_0xfda6('0x8')]('/',auth[_0xfda6('0x9')](),controller[_0xfda6('0xa')]);router[_0xfda6('0x8')]('/describe',auth[_0xfda6('0x9')](),controller[_0xfda6('0xb')]);router['get'](_0xfda6('0xc'),auth['isAuthenticated'](),controller[_0xfda6('0xd')]);router[_0xfda6('0x8')](_0xfda6('0xe'),auth['isAuthenticated'](),controller[_0xfda6('0xf')]);router[_0xfda6('0x8')](_0xfda6('0x10'),auth[_0xfda6('0x9')](),controller[_0xfda6('0x11')]);router[_0xfda6('0x12')]('/',auth['isAuthenticated'](),controller[_0xfda6('0x13')]);router['post'](_0xfda6('0x14'),auth[_0xfda6('0x9')](),controller['getPreview']);router[_0xfda6('0x12')](_0xfda6('0x15'),auth['isAuthenticated'](),controller['getTimezone']);router[_0xfda6('0x12')](_0xfda6('0x16'),auth[_0xfda6('0x9')](),controller[_0xfda6('0x17')]);router[_0xfda6('0x18')](_0xfda6('0x10'),auth[_0xfda6('0x9')](),controller[_0xfda6('0x19')]);router['delete'](_0xfda6('0x10'),auth[_0xfda6('0x9')](),controller[_0xfda6('0x1a')]);module[_0xfda6('0x1b')]=router; \ No newline at end of file +var _0xc01c=['/:id','show','post','/preview','/timezone','getTimezone','/previewrecall','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopper.controller','get','index','/describe','describe','/opencontacts','isAuthenticated','/timezones'];(function(_0x1e8758,_0x419ea2){var _0x195ad3=function(_0x2aeafd){while(--_0x2aeafd){_0x1e8758['push'](_0x1e8758['shift']());}};_0x195ad3(++_0x419ea2);}(_0xc01c,0x8e));var _0xcc01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc01c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcc01('0x0'));var util=require('util');var path=require(_0xcc01('0x1'));var timeout=require(_0xcc01('0x2'));var express=require(_0xcc01('0x3'));var router=express[_0xcc01('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcc01('0x5'));var config=require('../../config/environment');var controller=require(_0xcc01('0x6'));router[_0xcc01('0x7')]('/',auth['isAuthenticated'](),controller[_0xcc01('0x8')]);router[_0xcc01('0x7')](_0xcc01('0x9'),auth['isAuthenticated'](),controller[_0xcc01('0xa')]);router[_0xcc01('0x7')](_0xcc01('0xb'),auth[_0xcc01('0xc')](),controller['getOpenContacts']);router['get'](_0xcc01('0xd'),auth['isAuthenticated'](),controller['getTimezones']);router[_0xcc01('0x7')](_0xcc01('0xe'),auth['isAuthenticated'](),controller[_0xcc01('0xf')]);router[_0xcc01('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xcc01('0x11'),auth[_0xcc01('0xc')](),controller['getPreview']);router['post'](_0xcc01('0x12'),auth['isAuthenticated'](),controller[_0xcc01('0x13')]);router[_0xcc01('0x10')](_0xcc01('0x14'),auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0xcc01('0x15')](_0xcc01('0xe'),auth[_0xcc01('0xc')](),controller[_0xcc01('0x16')]);router[_0xcc01('0x17')](_0xcc01('0xe'),auth[_0xcc01('0xc')](),controller[_0xcc01('0x18')]);module[_0xcc01('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 10abfb6..016b110 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 _0x469a=['STRING','DATE','exports','INTEGER'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0x469a,0x166));var _0xa469=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x469a[_0x934425];return _0x31d596;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xa469('0x0')]={'CmHopperId':{'type':Sequelize[_0xa469('0x1')]},'phone':{'type':Sequelize[_0xa469('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa469('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa469('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa469('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa469('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa469('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa469('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa469('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9bd1=['exports','INTEGER','format','moment','sequelize'];(function(_0x902460,_0x317548){var _0x2234f7=function(_0x58c308){while(--_0x58c308){_0x902460['push'](_0x902460['shift']());}};_0x2234f7(++_0x317548);}(_0x9bd1,0x1ca));var _0x19bd=function(_0x2a3d62,_0x40a0be){_0x2a3d62=_0x2a3d62-0x0;var _0xfe304d=_0x9bd1[_0x2a3d62];return _0xfe304d;};'use strict';var moment=require(_0x19bd('0x0'));var Sequelize=require(_0x19bd('0x1'));module[_0x19bd('0x2')]={'CmHopperId':{'type':Sequelize[_0x19bd('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x19bd('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x19bd('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x19bd('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x19bd('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x19bd('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x19bd('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x19bd('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x19bd('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 0aa05dd..07e284c 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 _0xfb0b=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','CmHopperAdditionalPhones','UserProfileResource','end','name','send','index','map','rawAttributes','key','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperAdditionalPhone','count','includeAll','include','findAll','catch','show','params','keys','model','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto'];(function(_0x415774,_0x51ec60){var _0x3b1bfb=function(_0x647300){while(--_0x647300){_0x415774['push'](_0x415774['shift']());}};_0x3b1bfb(++_0x51ec60);}(_0xfb0b,0x94));var _0xbfb0=function(_0x146297,_0x17c702){_0x146297=_0x146297-0x0;var _0x4da9eb=_0xfb0b[_0x146297];return _0x4da9eb;};'use strict';var emlformat=require(_0xbfb0('0x0'));var rimraf=require(_0xbfb0('0x1'));var zipdir=require(_0xbfb0('0x2'));var jsonpatch=require(_0xbfb0('0x3'));var rp=require(_0xbfb0('0x4'));var moment=require(_0xbfb0('0x5'));var BPromise=require(_0xbfb0('0x6'));var Mustache=require(_0xbfb0('0x7'));var util=require('util');var path=require(_0xbfb0('0x8'));var sox=require(_0xbfb0('0x9'));var csv=require(_0xbfb0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfb0('0xb'));var _=require('lodash');var squel=require(_0xbfb0('0xc'));var crypto=require(_0xbfb0('0xd'));var jsforce=require(_0xbfb0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbfb0('0xa'));var querystring=require(_0xbfb0('0xf'));var Papa=require(_0xbfb0('0x10'));var Redis=require('ioredis');var authService=require(_0xbfb0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbfb0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbfb0('0x13'));var utils=require(_0xbfb0('0x14'));var config=require(_0xbfb0('0x15'));var licenseUtil=require(_0xbfb0('0x16'));var db=require(_0xbfb0('0x17'))['db'];function respondWithStatusCode(_0x2e5718,_0x8ed971){_0x8ed971=_0x8ed971||0xcc;return function(_0xa2f049){if(_0xa2f049){return _0x2e5718['sendStatus'](_0x8ed971);}return _0x2e5718[_0xbfb0('0x18')](_0x8ed971)['end']();};}function respondWithResult(_0x9278f9,_0x4b64b9){_0x4b64b9=_0x4b64b9||0xc8;return function(_0x42afd8){if(_0x42afd8){return _0x9278f9[_0xbfb0('0x18')](_0x4b64b9)[_0xbfb0('0x19')](_0x42afd8);}};}function respondWithFilteredResult(_0x246b50,_0x19031b){return function(_0x3c8a1a){if(_0x3c8a1a){var _0x245ec5=typeof _0x19031b[_0xbfb0('0x1a')]===_0xbfb0('0x1b')&&typeof _0x19031b[_0xbfb0('0x1c')]==='undefined';var _0xcec157=_0x3c8a1a['count'];var _0x10b096=_0x245ec5?0x0:_0x19031b['offset'];var _0x40f0a5=_0x245ec5?_0x3c8a1a['count']:_0x19031b['offset']+_0x19031b['limit'];var _0x3f9feb;if(_0x40f0a5>=_0xcec157){_0x40f0a5=_0xcec157;_0x3f9feb=0xc8;}else{_0x3f9feb=0xce;}_0x246b50[_0xbfb0('0x18')](_0x3f9feb);return _0x246b50[_0xbfb0('0x1d')](_0xbfb0('0x1e'),_0x10b096+'-'+_0x40f0a5+'/'+_0xcec157)['json'](_0x3c8a1a);}return null;};}function patchUpdates(_0x17802d){return function(_0x2feb81){try{jsonpatch['apply'](_0x2feb81,_0x17802d,!![]);}catch(_0x418569){return BPromise[_0xbfb0('0x1f')](_0x418569);}return _0x2feb81[_0xbfb0('0x20')]();};}function saveUpdates(_0xd1da6c,_0xd87897){return function(_0x22c0f0){if(_0x22c0f0){return _0x22c0f0['update'](_0xd1da6c)[_0xbfb0('0x21')](function(_0x3a6139){return _0x3a6139;});}return null;};}function removeEntity(_0x470a48,_0x3fb692){return function(_0x283b90){if(_0x283b90){return _0x283b90[_0xbfb0('0x22')]()[_0xbfb0('0x21')](function(){var _0x5096d5=_0x283b90['get']({'plain':!![]});var _0x2f4f84=_0xbfb0('0x23');return db[_0xbfb0('0x24')][_0xbfb0('0x22')]({'where':{'type':_0x2f4f84,'resourceId':_0x5096d5['id']}})[_0xbfb0('0x21')](function(){return _0x283b90;});})['then'](function(){_0x470a48[_0xbfb0('0x18')](0xcc)[_0xbfb0('0x25')]();});}};}function handleEntityNotFound(_0x2b905b,_0x2c95ae){return function(_0x4b8ec0){if(!_0x4b8ec0){_0x2b905b['sendStatus'](0x194);}return _0x4b8ec0;};}function handleError(_0x40ca5d,_0x55773a){_0x55773a=_0x55773a||0x1f4;return function(_0x2f7009){logger['error'](_0x2f7009['stack']);if(_0x2f7009[_0xbfb0('0x26')]){delete _0x2f7009[_0xbfb0('0x26')];}_0x40ca5d['status'](_0x55773a)[_0xbfb0('0x27')](_0x2f7009);};}exports[_0xbfb0('0x28')]=function(_0x30c82a,_0x2d65e8){var _0x2d4d2e={},_0x318cfe={},_0x274388={'count':0x0,'rows':[]};var _0x13ede2=_[_0xbfb0('0x29')](db['CmHopperAdditionalPhone'][_0xbfb0('0x2a')],function(_0x30ea57){return{'name':_0x30ea57['fieldName'],'type':_0x30ea57['type'][_0xbfb0('0x2b')]};});_0x318cfe['model']=_['map'](_0x13ede2,'name');_0x318cfe[_0xbfb0('0x2c')]=_['keys'](_0x30c82a[_0xbfb0('0x2c')]);_0x318cfe[_0xbfb0('0x2d')]=_['intersection'](_0x318cfe['model'],_0x318cfe[_0xbfb0('0x2c')]);_0x2d4d2e[_0xbfb0('0x2e')]=_[_0xbfb0('0x2f')](_0x318cfe['model'],qs[_0xbfb0('0x30')](_0x30c82a[_0xbfb0('0x2c')][_0xbfb0('0x30')]));_0x2d4d2e['attributes']=_0x2d4d2e[_0xbfb0('0x2e')][_0xbfb0('0x31')]?_0x2d4d2e[_0xbfb0('0x2e')]:_0x318cfe['model'];if(!_0x30c82a[_0xbfb0('0x2c')][_0xbfb0('0x32')]('nolimit')){_0x2d4d2e[_0xbfb0('0x1c')]=qs[_0xbfb0('0x1c')](_0x30c82a['query']['limit']);_0x2d4d2e[_0xbfb0('0x1a')]=qs[_0xbfb0('0x1a')](_0x30c82a[_0xbfb0('0x2c')]['offset']);}_0x2d4d2e[_0xbfb0('0x33')]=qs[_0xbfb0('0x34')](_0x30c82a[_0xbfb0('0x2c')][_0xbfb0('0x34')]);_0x2d4d2e[_0xbfb0('0x35')]=qs[_0xbfb0('0x2d')](_[_0xbfb0('0x36')](_0x30c82a[_0xbfb0('0x2c')],_0x318cfe['filters']),_0x13ede2);if(_0x30c82a[_0xbfb0('0x2c')][_0xbfb0('0x37')]){_0x2d4d2e[_0xbfb0('0x35')]=_[_0xbfb0('0x38')](_0x2d4d2e['where'],{'$or':_['map'](_0x13ede2,function(_0x37e398){if(_0x37e398[_0xbfb0('0x39')]!==_0xbfb0('0x3a')){var _0x13a750={};_0x13a750[_0x37e398[_0xbfb0('0x26')]]={'$like':'%'+_0x30c82a[_0xbfb0('0x2c')][_0xbfb0('0x37')]+'%'};return _0x13a750;}})});}_0x2d4d2e=_[_0xbfb0('0x38')]({},_0x2d4d2e,_0x30c82a[_0xbfb0('0x3b')]);var _0xd9e2f2={'where':_0x2d4d2e[_0xbfb0('0x35')]};return db[_0xbfb0('0x3c')]['count'](_0xd9e2f2)[_0xbfb0('0x21')](function(_0x41053e){_0x274388[_0xbfb0('0x3d')]=_0x41053e;if(_0x30c82a[_0xbfb0('0x2c')][_0xbfb0('0x3e')]){_0x2d4d2e[_0xbfb0('0x3f')]=[{'all':!![]}];}return db[_0xbfb0('0x3c')][_0xbfb0('0x40')](_0x2d4d2e);})[_0xbfb0('0x21')](function(_0x32d450){_0x274388['rows']=_0x32d450;return _0x274388;})[_0xbfb0('0x21')](respondWithFilteredResult(_0x2d65e8,_0x2d4d2e))[_0xbfb0('0x41')](handleError(_0x2d65e8,null));};exports[_0xbfb0('0x42')]=function(_0x5b1318,_0x68181c){var _0x551205={'raw':!![],'where':{'id':_0x5b1318[_0xbfb0('0x43')]['id']}},_0x43ad26={};_0x43ad26['model']=_[_0xbfb0('0x44')](db['CmHopperAdditionalPhone'][_0xbfb0('0x2a')]);_0x43ad26[_0xbfb0('0x2c')]=_['keys'](_0x5b1318['query']);_0x43ad26[_0xbfb0('0x2d')]=_[_0xbfb0('0x2f')](_0x43ad26[_0xbfb0('0x45')],_0x43ad26[_0xbfb0('0x2c')]);_0x551205[_0xbfb0('0x2e')]=_[_0xbfb0('0x2f')](_0x43ad26[_0xbfb0('0x45')],qs[_0xbfb0('0x30')](_0x5b1318['query'][_0xbfb0('0x30')]));_0x551205[_0xbfb0('0x2e')]=_0x551205[_0xbfb0('0x2e')][_0xbfb0('0x31')]?_0x551205[_0xbfb0('0x2e')]:_0x43ad26[_0xbfb0('0x45')];if(_0x5b1318[_0xbfb0('0x2c')][_0xbfb0('0x3e')]){_0x551205[_0xbfb0('0x3f')]=[{'all':!![]}];}_0x551205=_['merge']({},_0x551205,_0x5b1318[_0xbfb0('0x3b')]);return db[_0xbfb0('0x3c')][_0xbfb0('0x46')](_0x551205)[_0xbfb0('0x21')](handleEntityNotFound(_0x68181c,null))[_0xbfb0('0x21')](respondWithResult(_0x68181c,null))['catch'](handleError(_0x68181c,null));};exports[_0xbfb0('0x47')]=function(_0x53891c,_0x34e19b){return db[_0xbfb0('0x3c')][_0xbfb0('0x47')](_0x53891c['body'],{})['then'](function(_0x4ee50c){var _0x3b8bc9=_0x53891c[_0xbfb0('0x48')][_0xbfb0('0x49')]({'plain':!![]});if(!_0x3b8bc9)throw new Error(_0xbfb0('0x4a'));if(_0x3b8bc9['role']===_0xbfb0('0x48')){var _0x5ef65c=_0x4ee50c[_0xbfb0('0x49')]({'plain':!![]});var _0x5a9adc=_0xbfb0('0x23');return db[_0xbfb0('0x4b')]['find']({'where':{'name':_0x5a9adc,'userProfileId':_0x3b8bc9['userProfileId']},'raw':!![]})['then'](function(_0x5087ee){if(_0x5087ee&&_0x5087ee[_0xbfb0('0x4c')]===0x0){return db[_0xbfb0('0x24')]['create']({'name':_0x5ef65c['name'],'resourceId':_0x5ef65c['id'],'type':_0x5087ee[_0xbfb0('0x26')],'sectionId':_0x5087ee['id']},{})[_0xbfb0('0x21')](function(){return _0x4ee50c;});}else{return _0x4ee50c;}})[_0xbfb0('0x41')](function(_0x327489){logger[_0xbfb0('0x4d')](_0xbfb0('0x4e'),_0x327489);throw _0x327489;});}return _0x4ee50c;})['then'](respondWithResult(_0x34e19b,0xc9))['catch'](handleError(_0x34e19b,null));};exports[_0xbfb0('0x4f')]=function(_0x5e6e9f,_0x174482){if(_0x5e6e9f[_0xbfb0('0x50')]['id']){delete _0x5e6e9f['body']['id'];}return db[_0xbfb0('0x3c')]['find']({'where':{'id':_0x5e6e9f[_0xbfb0('0x43')]['id']}})[_0xbfb0('0x21')](handleEntityNotFound(_0x174482,null))[_0xbfb0('0x21')](saveUpdates(_0x5e6e9f[_0xbfb0('0x50')],null))[_0xbfb0('0x21')](respondWithResult(_0x174482,null))[_0xbfb0('0x41')](handleError(_0x174482,null));};exports[_0xbfb0('0x22')]=function(_0x1aab37,_0x11581f){return db[_0xbfb0('0x3c')][_0xbfb0('0x46')]({'where':{'id':_0x1aab37[_0xbfb0('0x43')]['id']}})[_0xbfb0('0x21')](handleEntityNotFound(_0x11581f,null))[_0xbfb0('0x21')](removeEntity(_0x11581f,null))[_0xbfb0('0x41')](handleError(_0x11581f,null));}; \ No newline at end of file +var _0xe9ca=['include','CmHopperAdditionalPhone','findAll','rows','catch','show','params','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','VIRTUAL','merge'];(function(_0x18febb,_0x15c517){var _0x16fc46=function(_0xc5eb94){while(--_0xc5eb94){_0x18febb['push'](_0x18febb['shift']());}};_0x16fc46(++_0x15c517);}(_0xe9ca,0x14d));var _0xae9c=function(_0x3f277a,_0x2e811a){_0x3f277a=_0x3f277a-0x0;var _0x9d27e1=_0xe9ca[_0x3f277a];return _0x9d27e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae9c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae9c('0x1'));var rp=require('request-promise');var moment=require(_0xae9c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xae9c('0x3'));var util=require('util');var path=require(_0xae9c('0x4'));var sox=require('sox');var csv=require(_0xae9c('0x5'));var ejs=require(_0xae9c('0x6'));var fs=require('fs');var fs_extra=require(_0xae9c('0x7'));var _=require(_0xae9c('0x8'));var squel=require(_0xae9c('0x9'));var crypto=require(_0xae9c('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xae9c('0x5'));var querystring=require(_0xae9c('0xb'));var Papa=require(_0xae9c('0xc'));var Redis=require('ioredis');var authService=require(_0xae9c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xae9c('0xe'));var hardwareService=require(_0xae9c('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xae9c('0x10'));var config=require(_0xae9c('0x11'));var licenseUtil=require(_0xae9c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f2b39,_0x33b330){_0x33b330=_0x33b330||0xcc;return function(_0x5b26a5){if(_0x5b26a5){return _0x5f2b39[_0xae9c('0x13')](_0x33b330);}return _0x5f2b39['status'](_0x33b330)[_0xae9c('0x14')]();};}function respondWithResult(_0x245685,_0x3c891e){_0x3c891e=_0x3c891e||0xc8;return function(_0xd00744){if(_0xd00744){return _0x245685[_0xae9c('0x15')](_0x3c891e)[_0xae9c('0x16')](_0xd00744);}};}function respondWithFilteredResult(_0x2e605d,_0x339376){return function(_0x210cf8){if(_0x210cf8){var _0x4ac56e=typeof _0x339376[_0xae9c('0x17')]===_0xae9c('0x18')&&typeof _0x339376['limit']===_0xae9c('0x18');var _0x5e095c=_0x210cf8['count'];var _0x196e6b=_0x4ac56e?0x0:_0x339376[_0xae9c('0x17')];var _0x27307d=_0x4ac56e?_0x210cf8[_0xae9c('0x19')]:_0x339376[_0xae9c('0x17')]+_0x339376['limit'];var _0x48078a;if(_0x27307d>=_0x5e095c){_0x27307d=_0x5e095c;_0x48078a=0xc8;}else{_0x48078a=0xce;}_0x2e605d[_0xae9c('0x15')](_0x48078a);return _0x2e605d[_0xae9c('0x1a')](_0xae9c('0x1b'),_0x196e6b+'-'+_0x27307d+'/'+_0x5e095c)['json'](_0x210cf8);}return null;};}function patchUpdates(_0x3cd135){return function(_0x55be5b){try{jsonpatch[_0xae9c('0x1c')](_0x55be5b,_0x3cd135,!![]);}catch(_0x3626c1){return BPromise[_0xae9c('0x1d')](_0x3626c1);}return _0x55be5b[_0xae9c('0x1e')]();};}function saveUpdates(_0x2a425c,_0x564e68){return function(_0x1668da){if(_0x1668da){return _0x1668da['update'](_0x2a425c)[_0xae9c('0x1f')](function(_0x1f5d79){return _0x1f5d79;});}return null;};}function removeEntity(_0x7dba75,_0x2882db){return function(_0xf31911){if(_0xf31911){return _0xf31911['destroy']()[_0xae9c('0x1f')](function(){var _0x566bc4=_0xf31911[_0xae9c('0x20')]({'plain':!![]});var _0x2dc281=_0xae9c('0x21');return db[_0xae9c('0x22')][_0xae9c('0x23')]({'where':{'type':_0x2dc281,'resourceId':_0x566bc4['id']}})[_0xae9c('0x1f')](function(){return _0xf31911;});})[_0xae9c('0x1f')](function(){_0x7dba75[_0xae9c('0x15')](0xcc)[_0xae9c('0x14')]();});}};}function handleEntityNotFound(_0x49a78f,_0x3b5567){return function(_0xe60a8){if(!_0xe60a8){_0x49a78f['sendStatus'](0x194);}return _0xe60a8;};}function handleError(_0x1a3283,_0x4a52c7){_0x4a52c7=_0x4a52c7||0x1f4;return function(_0x537891){logger[_0xae9c('0x24')](_0x537891[_0xae9c('0x25')]);if(_0x537891['name']){delete _0x537891[_0xae9c('0x26')];}_0x1a3283[_0xae9c('0x15')](_0x4a52c7)[_0xae9c('0x27')](_0x537891);};}exports[_0xae9c('0x28')]=function(_0x42f9de,_0x496f6c){var _0x4805cf={},_0x894d2e={},_0x5a9886={'count':0x0,'rows':[]};var _0x5647e1=_[_0xae9c('0x29')](db['CmHopperAdditionalPhone'][_0xae9c('0x2a')],function(_0x393396){return{'name':_0x393396[_0xae9c('0x2b')],'type':_0x393396[_0xae9c('0x2c')]['key']};});_0x894d2e['model']=_[_0xae9c('0x29')](_0x5647e1,_0xae9c('0x26'));_0x894d2e[_0xae9c('0x2d')]=_[_0xae9c('0x2e')](_0x42f9de[_0xae9c('0x2d')]);_0x894d2e['filters']=_[_0xae9c('0x2f')](_0x894d2e['model'],_0x894d2e[_0xae9c('0x2d')]);_0x4805cf[_0xae9c('0x30')]=_['intersection'](_0x894d2e[_0xae9c('0x31')],qs[_0xae9c('0x32')](_0x42f9de[_0xae9c('0x2d')][_0xae9c('0x32')]));_0x4805cf[_0xae9c('0x30')]=_0x4805cf[_0xae9c('0x30')][_0xae9c('0x33')]?_0x4805cf[_0xae9c('0x30')]:_0x894d2e[_0xae9c('0x31')];if(!_0x42f9de[_0xae9c('0x2d')][_0xae9c('0x34')](_0xae9c('0x35'))){_0x4805cf[_0xae9c('0x36')]=qs['limit'](_0x42f9de[_0xae9c('0x2d')][_0xae9c('0x36')]);_0x4805cf[_0xae9c('0x17')]=qs['offset'](_0x42f9de['query'][_0xae9c('0x17')]);}_0x4805cf[_0xae9c('0x37')]=qs['sort'](_0x42f9de[_0xae9c('0x2d')]['sort']);_0x4805cf[_0xae9c('0x38')]=qs[_0xae9c('0x39')](_[_0xae9c('0x3a')](_0x42f9de[_0xae9c('0x2d')],_0x894d2e[_0xae9c('0x39')]),_0x5647e1);if(_0x42f9de[_0xae9c('0x2d')][_0xae9c('0x3b')]){_0x4805cf[_0xae9c('0x38')]=_['merge'](_0x4805cf[_0xae9c('0x38')],{'$or':_[_0xae9c('0x29')](_0x5647e1,function(_0x5f0253){if(_0x5f0253[_0xae9c('0x2c')]!==_0xae9c('0x3c')){var _0x2d3dc9={};_0x2d3dc9[_0x5f0253[_0xae9c('0x26')]]={'$like':'%'+_0x42f9de[_0xae9c('0x2d')][_0xae9c('0x3b')]+'%'};return _0x2d3dc9;}})});}_0x4805cf=_[_0xae9c('0x3d')]({},_0x4805cf,_0x42f9de['options']);var _0x2aa8ad={'where':_0x4805cf[_0xae9c('0x38')]};return db['CmHopperAdditionalPhone'][_0xae9c('0x19')](_0x2aa8ad)[_0xae9c('0x1f')](function(_0x5a35f8){_0x5a9886[_0xae9c('0x19')]=_0x5a35f8;if(_0x42f9de['query']['includeAll']){_0x4805cf[_0xae9c('0x3e')]=[{'all':!![]}];}return db[_0xae9c('0x3f')][_0xae9c('0x40')](_0x4805cf);})[_0xae9c('0x1f')](function(_0x133eba){_0x5a9886[_0xae9c('0x41')]=_0x133eba;return _0x5a9886;})[_0xae9c('0x1f')](respondWithFilteredResult(_0x496f6c,_0x4805cf))[_0xae9c('0x42')](handleError(_0x496f6c,null));};exports[_0xae9c('0x43')]=function(_0x37eb2f,_0x58cb3c){var _0x1f72d6={'raw':!![],'where':{'id':_0x37eb2f[_0xae9c('0x44')]['id']}},_0x21c81c={};_0x21c81c['model']=_['keys'](db[_0xae9c('0x3f')][_0xae9c('0x2a')]);_0x21c81c[_0xae9c('0x2d')]=_[_0xae9c('0x2e')](_0x37eb2f[_0xae9c('0x2d')]);_0x21c81c[_0xae9c('0x39')]=_[_0xae9c('0x2f')](_0x21c81c['model'],_0x21c81c['query']);_0x1f72d6['attributes']=_[_0xae9c('0x2f')](_0x21c81c[_0xae9c('0x31')],qs[_0xae9c('0x32')](_0x37eb2f[_0xae9c('0x2d')][_0xae9c('0x32')]));_0x1f72d6['attributes']=_0x1f72d6[_0xae9c('0x30')][_0xae9c('0x33')]?_0x1f72d6[_0xae9c('0x30')]:_0x21c81c[_0xae9c('0x31')];if(_0x37eb2f[_0xae9c('0x2d')][_0xae9c('0x45')]){_0x1f72d6[_0xae9c('0x3e')]=[{'all':!![]}];}_0x1f72d6=_[_0xae9c('0x3d')]({},_0x1f72d6,_0x37eb2f[_0xae9c('0x46')]);return db[_0xae9c('0x3f')][_0xae9c('0x47')](_0x1f72d6)[_0xae9c('0x1f')](handleEntityNotFound(_0x58cb3c,null))[_0xae9c('0x1f')](respondWithResult(_0x58cb3c,null))[_0xae9c('0x42')](handleError(_0x58cb3c,null));};exports[_0xae9c('0x48')]=function(_0x221fa6,_0x46a75b){return db[_0xae9c('0x3f')][_0xae9c('0x48')](_0x221fa6[_0xae9c('0x49')],{})['then'](function(_0xb3bc11){var _0x499707=_0x221fa6['user'][_0xae9c('0x20')]({'plain':!![]});if(!_0x499707)throw new Error(_0xae9c('0x4a'));if(_0x499707['role']==='user'){var _0x57d2e3=_0xb3bc11[_0xae9c('0x20')]({'plain':!![]});var _0x200593=_0xae9c('0x21');return db[_0xae9c('0x4b')][_0xae9c('0x47')]({'where':{'name':_0x200593,'userProfileId':_0x499707['userProfileId']},'raw':!![]})[_0xae9c('0x1f')](function(_0x45395f){if(_0x45395f&&_0x45395f[_0xae9c('0x4c')]===0x0){return db[_0xae9c('0x22')][_0xae9c('0x48')]({'name':_0x57d2e3[_0xae9c('0x26')],'resourceId':_0x57d2e3['id'],'type':_0x45395f[_0xae9c('0x26')],'sectionId':_0x45395f['id']},{})['then'](function(){return _0xb3bc11;});}else{return _0xb3bc11;}})[_0xae9c('0x42')](function(_0x376291){logger[_0xae9c('0x24')](_0xae9c('0x4d'),_0x376291);throw _0x376291;});}return _0xb3bc11;})[_0xae9c('0x1f')](respondWithResult(_0x46a75b,0xc9))[_0xae9c('0x42')](handleError(_0x46a75b,null));};exports[_0xae9c('0x4e')]=function(_0x53b6ff,_0x40a909){if(_0x53b6ff[_0xae9c('0x49')]['id']){delete _0x53b6ff[_0xae9c('0x49')]['id'];}return db[_0xae9c('0x3f')][_0xae9c('0x47')]({'where':{'id':_0x53b6ff[_0xae9c('0x44')]['id']}})[_0xae9c('0x1f')](handleEntityNotFound(_0x40a909,null))['then'](saveUpdates(_0x53b6ff['body'],null))[_0xae9c('0x1f')](respondWithResult(_0x40a909,null))['catch'](handleError(_0x40a909,null));};exports[_0xae9c('0x23')]=function(_0x5238e0,_0xa1c6bb){return db[_0xae9c('0x3f')][_0xae9c('0x47')]({'where':{'id':_0x5238e0[_0xae9c('0x44')]['id']}})['then'](handleEntityNotFound(_0xa1c6bb,null))['then'](removeEntity(_0xa1c6bb,null))[_0xae9c('0x42')](handleError(_0xa1c6bb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index c6474b4..3c78150 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 _0xa21d=['path','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','request-promise'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa21d,0x8b));var _0xda21=function(_0xbd17dd,_0x4af886){_0xbd17dd=_0xbd17dd-0x0;var _0x5458ba=_0xa21d[_0xbd17dd];return _0x5458ba;};'use strict';var _=require(_0xda21('0x0'));var util=require('util');var logger=require(_0xda21('0x1'))(_0xda21('0x2'));var moment=require(_0xda21('0x3'));var BPromise=require('bluebird');var rp=require(_0xda21('0x4'));var fs=require('fs');var path=require(_0xda21('0x5'));var rimraf=require(_0xda21('0x6'));var config=require(_0xda21('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xda21('0x8')]=function(_0xd43f6b,_0x2e18bc){return _0xd43f6b[_0xda21('0x9')](_0xda21('0xa'),attributes,{'tableName':_0xda21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb42c=['moment','bluebird','request-promise','rimraf','exports','define','cm_hopper_additional_phones','lodash','util','api'];(function(_0x5e4759,_0x1f8793){var _0x1aefe3=function(_0x1be07e){while(--_0x1be07e){_0x5e4759['push'](_0x5e4759['shift']());}};_0x1aefe3(++_0x1f8793);}(_0xb42c,0x165));var _0xcb42=function(_0x52873f,_0x3b8c34){_0x52873f=_0x52873f-0x0;var _0xaed6e5=_0xb42c[_0x52873f];return _0xaed6e5;};'use strict';var _=require(_0xcb42('0x0'));var util=require(_0xcb42('0x1'));var logger=require('../../config/logger')(_0xcb42('0x2'));var moment=require(_0xcb42('0x3'));var BPromise=require(_0xcb42('0x4'));var rp=require(_0xcb42('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb42('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xcb42('0x7')]=function(_0x4f20d7,_0x3ddd69){return _0x4f20d7[_0xcb42('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xcb42('0x9'),'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 2fbee17..4b06d8e 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 _0xf915=['client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopper','body','ContactId','VoiceQueueId','CampaignId','OrderBy','countbusyretry','countdropretry','countmachineretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','findOne','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','catch','VerifyAdditionalPhones','SwapAdditionalPhones','ListId','ASC','duration','waitTime','isNil','scheduledat','add','minutes','phone','countagentrejectretry','createdAt','updatedAt','transaction','activateAdditionalPhone','update','field','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x284aac,_0x5a3201){var _0xe067ec=function(_0x16367e){while(--_0x16367e){_0x284aac['push'](_0x284aac['shift']());}};_0xe067ec(++_0x5a3201);}(_0xf915,0x6e));var _0x5f91=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf915[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x5f91('0x0'));var util=require(_0x5f91('0x1'));var moment=require('moment');var BPromise=require(_0x5f91('0x2'));var rs=require(_0x5f91('0x3'));var fs=require('fs');var Redis=require(_0x5f91('0x4'));var db=require(_0x5f91('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f91('0x6'))(_0x5f91('0x7'));var config=require(_0x5f91('0x8'));var jayson=require(_0x5f91('0x9'));var client=jayson[_0x5f91('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42928e,_0xe9c58c,_0x3a88a5){return new BPromise(function(_0x1f70e0,_0x126dc9){return client[_0x5f91('0xb')](_0x42928e,_0x3a88a5)[_0x5f91('0xc')](function(_0x238553){logger[_0x5f91('0xd')](_0x5f91('0xe'),_0xe9c58c,_0x5f91('0xf'));logger[_0x5f91('0x10')](_0x5f91('0x11'),_0xe9c58c,_0x5f91('0xf'),JSON[_0x5f91('0x12')](_0x238553));if(_0x238553[_0x5f91('0x13')]){if(_0x238553['error'][_0x5f91('0x14')]===0x1f4){logger[_0x5f91('0x13')](_0x5f91('0xe'),_0xe9c58c,_0x238553[_0x5f91('0x13')][_0x5f91('0x15')]);return _0x126dc9(_0x238553[_0x5f91('0x13')][_0x5f91('0x15')]);}logger[_0x5f91('0x13')](_0x5f91('0xe'),_0xe9c58c,_0x238553['error'][_0x5f91('0x15')]);return _0x1f70e0(_0x238553['error']['message']);}else{logger[_0x5f91('0xd')](_0x5f91('0xe'),_0xe9c58c,_0x5f91('0xf'));_0x1f70e0(_0x238553[_0x5f91('0x16')][_0x5f91('0x15')]);}})['catch'](function(_0x2ffda9){logger[_0x5f91('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xe9c58c,_0x2ffda9);_0x126dc9(_0x2ffda9);});});}exports['VerifyAdditionalPhones']=function(_0x247f13){var _0x1b8574=this;return new Promise(function(_0x2d7cec,_0x58b4a6){return db[_0x5f91('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x247f13[_0x5f91('0x18')][_0x5f91('0x19')],'ListId':_0x247f13[_0x5f91('0x18')]['ListId'],'VoiceQueueId':_0x247f13[_0x5f91('0x18')][_0x5f91('0x1a')]===undefined?null:_0x247f13[_0x5f91('0x18')][_0x5f91('0x1a')],'CampaignId':_0x247f13[_0x5f91('0x18')][_0x5f91('0x1b')]===undefined?null:_0x247f13[_0x5f91('0x18')][_0x5f91('0x1b')]}})[_0x5f91('0xc')](function(_0x33245d){if(_0x33245d!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x33245d['id'],'OrderBy':{'$gt':_0x33245d[_0x5f91('0x1c')]}},'order':[[_0x5f91('0x1c'),'ASC']]})['then'](function(_0x27e682){var _0x5bd86b=0x0;if(_0x27e682){if(_0x27e682[_0x5f91('0x1d')]+_0x27e682['countcongestionretry']+_0x27e682['countnoanswerretry']+_0x27e682['countnosuchnumberretry']+_0x27e682[_0x5f91('0x1e')]+_0x27e682['countabandonedretry']+_0x27e682[_0x5f91('0x1f')]+_0x27e682['countagentrejectretry']<_0x247f13[_0x5f91('0x20')][_0x5f91('0x21')])_0x5bd86b=0x1;_0x2d7cec({'additional':_0x5bd86b});}else{return db[_0x5f91('0x22')][_0x5f91('0x23')]({'raw':!![],'where':{'CmHopperId':_0x33245d['id']},'order':[[_0x5f91('0x1c'),'ASC']]})['then'](function(_0x1de9d9){var _0x3b5b2f=0x0;if(_0x1de9d9){if(_0x1de9d9[_0x5f91('0x1d')]+_0x1de9d9[_0x5f91('0x24')]+_0x1de9d9[_0x5f91('0x25')]+_0x1de9d9[_0x5f91('0x26')]+_0x1de9d9[_0x5f91('0x1e')]+_0x1de9d9[_0x5f91('0x27')]+_0x1de9d9[_0x5f91('0x1f')]+_0x1de9d9['countagentrejectretry']<_0x247f13[_0x5f91('0x20')][_0x5f91('0x21')])_0x3b5b2f=0x1;_0x2d7cec({'additional':_0x3b5b2f});}else{_0x2d7cec({'additional':0x0});}})[_0x5f91('0x28')](function(_0x3b27d2){logger[_0x5f91('0x13')](_0x5f91('0x29'),_0x3b27d2[_0x5f91('0x15')]);_0x58b4a6(_0x1b8574['error'](0x1f4,_0x3b27d2[_0x5f91('0x15')]));});}})[_0x5f91('0x28')](function(_0x216080){logger[_0x5f91('0x13')](_0x5f91('0x29'),_0x216080[_0x5f91('0x15')]);_0x58b4a6(_0x1b8574['error'](0x1f4,_0x216080[_0x5f91('0x15')]));});}else _0x2d7cec({'additional':0x0});});});};exports[_0x5f91('0x2a')]=function(_0x4ed477){var _0x266ea3=this;return new Promise(function(_0x220de8,_0x434391){return db[_0x5f91('0x17')][_0x5f91('0x23')]({'raw':!![],'where':{'ContactId':_0x4ed477[_0x5f91('0x18')]['ContactId'],'ListId':_0x4ed477[_0x5f91('0x18')][_0x5f91('0x2b')],'VoiceQueueId':_0x4ed477['body'][_0x5f91('0x1a')]===undefined?null:_0x4ed477[_0x5f91('0x18')][_0x5f91('0x1a')],'CampaignId':_0x4ed477[_0x5f91('0x18')]['CampaignId']===undefined?null:_0x4ed477[_0x5f91('0x18')][_0x5f91('0x1b')]}})['then'](function(_0x5effd9){if(_0x5effd9!=null){return db[_0x5f91('0x22')][_0x5f91('0x23')]({'raw':!![],'where':{'CmHopperId':_0x5effd9['id'],'OrderBy':{'$gte':_0x5effd9[_0x5f91('0x1c')]}},'order':[['OrderBy',_0x5f91('0x2c')]]})[_0x5f91('0xc')](function(_0x5ef258){if(_0x5ef258)return activateAdditionalPhone(_0x5effd9,_0x4ed477[_0x5f91('0x18')],_0x5ef258,_0x4ed477[_0x5f91('0x2d')],_0x4ed477[_0x5f91('0x2e')])[_0x5f91('0xc')](function(_0x180d10){_0x220de8(_0x180d10);});else{return db[_0x5f91('0x22')][_0x5f91('0x23')]({'raw':!![],'where':{'CmHopperId':_0x5effd9['id']},'order':[['OrderBy',_0x5f91('0x2c')]]})[_0x5f91('0xc')](function(_0x13f2e6){if(_0x13f2e6)return activateAdditionalPhone(_0x5effd9,_0x4ed477[_0x5f91('0x18')],_0x13f2e6,_0x4ed477[_0x5f91('0x2d')],_0x4ed477['waitTime'])[_0x5f91('0xc')](function(_0x39384c){_0x220de8(_0x39384c);});else{_0x220de8({'id':_0x5effd9['id'],'phone':''});}})[_0x5f91('0x28')](function(_0x44e493){logger['error'](_0x5f91('0x29'),_0x44e493[_0x5f91('0x15')]);_0x434391(_0x266ea3['error'](0x1f4,_0x44e493[_0x5f91('0x15')]));});}})[_0x5f91('0x28')](function(_0x5ef571){logger['error'](_0x5f91('0x29'),_0x5ef571['message']);_0x434391(_0x266ea3[_0x5f91('0x13')](0x1f4,_0x5ef571[_0x5f91('0x15')]));});}else _0x220de8(0x1);});});};function activateAdditionalPhone(_0x3c6636,_0x3999f8,_0xac3f6,_0x4e5749,_0x1967d6){return new Promise(function(_0x20c623,_0x2cf48a){var _0x371670;if(_[_0x5f91('0x2f')](_0xac3f6['scheduledat'])){_0xac3f6[_0x5f91('0x30')]=moment();}if(moment()>moment(_0xac3f6[_0x5f91('0x30')])){_0x371670=moment()[_0x5f91('0x31')](_0x1967d6||0x3,_0x5f91('0x32'));}else{if(_0xac3f6['OrderBy']==0x0){_0x371670=moment(_0xac3f6[_0x5f91('0x30')]);}else{_0x371670=moment()['add'](_0x1967d6||0x3,'minutes');}}if(_[_0x5f91('0x2f')](_0x371670)){_0x371670=moment()['add'](_0x1967d6||0x3,_0x5f91('0x32'));}var _0x49bd56={'phone':_0x3c6636[_0x5f91('0x33')],'active':0x0,'OrderBy':_[_0x5f91('0x2f')](_0x3c6636[_0x5f91('0x1c')])?0x0:_0x3c6636[_0x5f91('0x1c')],'scheduledat':moment()['add'](_0x4e5749||0x1,_0x5f91('0x32')),'countbusyretry':_0x3999f8[_0x5f91('0x1d')],'countcongestionretry':_0x3999f8['countcongestionretry'],'countnoanswerretry':_0x3999f8['countnoanswerretry'],'countnosuchnumberretry':_0x3999f8['countnosuchnumberretry'],'countdropretry':_0x3999f8['countdropretry'],'countabandonedretry':_0x3999f8[_0x5f91('0x27')],'countmachineretry':_0x3999f8[_0x5f91('0x1f')],'countagentrejectretry':_0x3999f8[_0x5f91('0x34')],'createdAt':_0x3999f8[_0x5f91('0x35')],'updatedAt':_0x3999f8[_0x5f91('0x36')]};var _0x3fc0b2={'CmHopperId':_0x3c6636['id'],'phone':_0xac3f6['phone'],'active':0x0,'OrderBy':_['isNil'](_0xac3f6[_0x5f91('0x1c')])?0x0:_0xac3f6[_0x5f91('0x1c')],'scheduledat':_0x371670,'countbusyretry':_0xac3f6['countbusyretry'],'countcongestionretry':_0xac3f6[_0x5f91('0x24')],'countnoanswerretry':_0xac3f6[_0x5f91('0x25')],'countnosuchnumberretry':_0xac3f6['countnosuchnumberretry'],'countdropretry':_0xac3f6[_0x5f91('0x1e')],'countabandonedretry':_0xac3f6[_0x5f91('0x27')],'countmachineretry':_0xac3f6['countmachineretry'],'countagentrejectretry':_0xac3f6[_0x5f91('0x34')],'createdAt':_0xac3f6[_0x5f91('0x35')],'updatedAt':_0xac3f6[_0x5f91('0x36')]};return db['sequelize'][_0x5f91('0x37')](function(_0x229c99){return db[_0x5f91('0x22')]['update'](_0x49bd56,{'where':{'id':_0xac3f6['id']}},{'transaction':_0x229c99})['then'](function(){return db['CmHopper']['update'](_0x3fc0b2,{'where':{'id':_0x3c6636['id']}},{'transaction':_0x229c99});});})['then'](function(_0x9e2f10){_0x20c623({'id':_0x3c6636['id'],'phone':_0xac3f6[_0x5f91('0x33')]});})['catch'](function(_0x2b50b7){logger[_0x5f91('0x13')](_0x5f91('0x38'),_0x2b50b7[_0x5f91('0x15')]);_0x2cf48a({'error':_0x2b50b7[_0x5f91('0x15')]});});});}exports['IncrementPreviewCounters']=function(_0x35f0cd){var _0x46e85f=this;return new Promise(function(_0x29c4d1,_0x56b2bb){return db[_0x5f91('0x17')][_0x5f91('0x39')](_0x35f0cd[_0x5f91('0x18')][_0x5f91('0x3a')],{'where':{'id':_0x35f0cd[_0x5f91('0x18')]['id']}})[_0x5f91('0xc')](function(_0x32c877){_0x29c4d1(_0x32c877);})[_0x5f91('0x28')](function(_0x114047){logger['error'](_0x5f91('0x3b'),_0x114047[_0x5f91('0x15')]);_0x56b2bb(_0x46e85f[_0x5f91('0x13')](0x1f4,_0x114047[_0x5f91('0x15')]));});});}; \ No newline at end of file +var _0x367e=['CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','findOne','dialGlobalMaxRetry','duration','waitTime','scheduledat','add','minutes','isNil','phone','countbusyretry','createdAt','updatedAt','countnosuchnumberretry','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2bbeb9,_0x479daf){var _0x1dd0f8=function(_0x53cf73){while(--_0x53cf73){_0x2bbeb9['push'](_0x2bbeb9['shift']());}};_0x1dd0f8(++_0x479daf);}(_0x367e,0xa1));var _0xe367=function(_0x3b4693,_0x3a608a){_0x3b4693=_0x3b4693-0x0;var _0x2750ed=_0x367e[_0x3b4693];return _0x2750ed;};'use strict';var _=require(_0xe367('0x0'));var util=require(_0xe367('0x1'));var moment=require('moment');var BPromise=require(_0xe367('0x2'));var rs=require(_0xe367('0x3'));var fs=require('fs');var Redis=require(_0xe367('0x4'));var db=require(_0xe367('0x5'))['db'];var utils=require(_0xe367('0x6'));var logger=require('../../config/logger')(_0xe367('0x7'));var config=require('../../config/environment');var jayson=require(_0xe367('0x8'));var client=jayson['client'][_0xe367('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a3434,_0x28396e,_0x1241cc){return new BPromise(function(_0x29888c,_0x3135dc){return client[_0xe367('0xa')](_0x3a3434,_0x1241cc)[_0xe367('0xb')](function(_0x166021){logger[_0xe367('0xc')](_0xe367('0xd'),_0x28396e,_0xe367('0xe'));logger[_0xe367('0xf')](_0xe367('0x10'),_0x28396e,_0xe367('0xe'),JSON[_0xe367('0x11')](_0x166021));if(_0x166021['error']){if(_0x166021[_0xe367('0x12')][_0xe367('0x13')]===0x1f4){logger['error'](_0xe367('0xd'),_0x28396e,_0x166021[_0xe367('0x12')][_0xe367('0x14')]);return _0x3135dc(_0x166021[_0xe367('0x12')][_0xe367('0x14')]);}logger[_0xe367('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x28396e,_0x166021[_0xe367('0x12')][_0xe367('0x14')]);return _0x29888c(_0x166021[_0xe367('0x12')]['message']);}else{logger[_0xe367('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x28396e,_0xe367('0xe'));_0x29888c(_0x166021[_0xe367('0x15')]['message']);}})[_0xe367('0x16')](function(_0x4b6da3){logger[_0xe367('0x12')](_0xe367('0xd'),_0x28396e,_0x4b6da3);_0x3135dc(_0x4b6da3);});});}exports[_0xe367('0x17')]=function(_0x23437c){var _0x30a963=this;return new Promise(function(_0xd1c9eb,_0x5e4f81){return db[_0xe367('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x23437c[_0xe367('0x19')][_0xe367('0x1a')],'ListId':_0x23437c['body'][_0xe367('0x1b')],'VoiceQueueId':_0x23437c[_0xe367('0x19')][_0xe367('0x1c')]===undefined?null:_0x23437c[_0xe367('0x19')][_0xe367('0x1c')],'CampaignId':_0x23437c['body']['CampaignId']===undefined?null:_0x23437c[_0xe367('0x19')][_0xe367('0x1d')]}})[_0xe367('0xb')](function(_0x8be5a3){if(_0x8be5a3!=null){return db[_0xe367('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x8be5a3['id'],'OrderBy':{'$gt':_0x8be5a3['OrderBy']}},'order':[[_0xe367('0x1f'),_0xe367('0x20')]]})[_0xe367('0xb')](function(_0x3e090d){var _0x49047f=0x0;if(_0x3e090d){if(_0x3e090d['countbusyretry']+_0x3e090d[_0xe367('0x21')]+_0x3e090d[_0xe367('0x22')]+_0x3e090d['countnosuchnumberretry']+_0x3e090d[_0xe367('0x23')]+_0x3e090d[_0xe367('0x24')]+_0x3e090d[_0xe367('0x25')]+_0x3e090d[_0xe367('0x26')]<_0x23437c[_0xe367('0x27')]['dialGlobalMaxRetry'])_0x49047f=0x1;_0xd1c9eb({'additional':_0x49047f});}else{return db[_0xe367('0x1e')][_0xe367('0x28')]({'raw':!![],'where':{'CmHopperId':_0x8be5a3['id']},'order':[[_0xe367('0x1f'),'ASC']]})[_0xe367('0xb')](function(_0x134c44){var _0x31bb71=0x0;if(_0x134c44){if(_0x134c44['countbusyretry']+_0x134c44[_0xe367('0x21')]+_0x134c44['countnoanswerretry']+_0x134c44['countnosuchnumberretry']+_0x134c44['countdropretry']+_0x134c44[_0xe367('0x24')]+_0x134c44[_0xe367('0x25')]+_0x134c44[_0xe367('0x26')]<_0x23437c[_0xe367('0x27')][_0xe367('0x29')])_0x31bb71=0x1;_0xd1c9eb({'additional':_0x31bb71});}else{_0xd1c9eb({'additional':0x0});}})[_0xe367('0x16')](function(_0x56a481){logger[_0xe367('0x12')](_0xe367('0x17'),_0x56a481[_0xe367('0x14')]);_0x5e4f81(_0x30a963['error'](0x1f4,_0x56a481[_0xe367('0x14')]));});}})[_0xe367('0x16')](function(_0x151c3d){logger[_0xe367('0x12')](_0xe367('0x17'),_0x151c3d[_0xe367('0x14')]);_0x5e4f81(_0x30a963[_0xe367('0x12')](0x1f4,_0x151c3d[_0xe367('0x14')]));});}else _0xd1c9eb({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x90206b){var _0x2105c1=this;return new Promise(function(_0x3de89d,_0x39bd17){return db[_0xe367('0x18')][_0xe367('0x28')]({'raw':!![],'where':{'ContactId':_0x90206b[_0xe367('0x19')][_0xe367('0x1a')],'ListId':_0x90206b['body'][_0xe367('0x1b')],'VoiceQueueId':_0x90206b[_0xe367('0x19')][_0xe367('0x1c')]===undefined?null:_0x90206b[_0xe367('0x19')]['VoiceQueueId'],'CampaignId':_0x90206b[_0xe367('0x19')][_0xe367('0x1d')]===undefined?null:_0x90206b[_0xe367('0x19')][_0xe367('0x1d')]}})[_0xe367('0xb')](function(_0x26e8b9){if(_0x26e8b9!=null){return db[_0xe367('0x1e')][_0xe367('0x28')]({'raw':!![],'where':{'CmHopperId':_0x26e8b9['id'],'OrderBy':{'$gte':_0x26e8b9[_0xe367('0x1f')]}},'order':[[_0xe367('0x1f'),_0xe367('0x20')]]})[_0xe367('0xb')](function(_0x38e5ff){if(_0x38e5ff)return activateAdditionalPhone(_0x26e8b9,_0x90206b[_0xe367('0x19')],_0x38e5ff,_0x90206b[_0xe367('0x2a')],_0x90206b[_0xe367('0x2b')])[_0xe367('0xb')](function(_0x43f79c){_0x3de89d(_0x43f79c);});else{return db[_0xe367('0x1e')][_0xe367('0x28')]({'raw':!![],'where':{'CmHopperId':_0x26e8b9['id']},'order':[[_0xe367('0x1f'),_0xe367('0x20')]]})[_0xe367('0xb')](function(_0x13f3a0){if(_0x13f3a0)return activateAdditionalPhone(_0x26e8b9,_0x90206b[_0xe367('0x19')],_0x13f3a0,_0x90206b['duration'],_0x90206b['waitTime'])['then'](function(_0x4082fe){_0x3de89d(_0x4082fe);});else{_0x3de89d({'id':_0x26e8b9['id'],'phone':''});}})[_0xe367('0x16')](function(_0x28616c){logger['error'](_0xe367('0x17'),_0x28616c[_0xe367('0x14')]);_0x39bd17(_0x2105c1[_0xe367('0x12')](0x1f4,_0x28616c[_0xe367('0x14')]));});}})[_0xe367('0x16')](function(_0x1c8b6c){logger[_0xe367('0x12')](_0xe367('0x17'),_0x1c8b6c[_0xe367('0x14')]);_0x39bd17(_0x2105c1[_0xe367('0x12')](0x1f4,_0x1c8b6c[_0xe367('0x14')]));});}else _0x3de89d(0x1);});});};function activateAdditionalPhone(_0x526079,_0x4b9dd0,_0x2aa8b8,_0x5d6105,_0x551f96){return new Promise(function(_0x55ac08,_0x3d9411){var _0x13bda1;if(_['isNil'](_0x2aa8b8[_0xe367('0x2c')])){_0x2aa8b8['scheduledat']=moment();}if(moment()>moment(_0x2aa8b8['scheduledat'])){_0x13bda1=moment()[_0xe367('0x2d')](_0x551f96||0x3,_0xe367('0x2e'));}else{if(_0x2aa8b8[_0xe367('0x1f')]==0x0){_0x13bda1=moment(_0x2aa8b8[_0xe367('0x2c')]);}else{_0x13bda1=moment()[_0xe367('0x2d')](_0x551f96||0x3,_0xe367('0x2e'));}}if(_[_0xe367('0x2f')](_0x13bda1)){_0x13bda1=moment()[_0xe367('0x2d')](_0x551f96||0x3,'minutes');}var _0x3d783c={'phone':_0x526079[_0xe367('0x30')],'active':0x0,'OrderBy':_[_0xe367('0x2f')](_0x526079[_0xe367('0x1f')])?0x0:_0x526079[_0xe367('0x1f')],'scheduledat':moment()[_0xe367('0x2d')](_0x5d6105||0x1,_0xe367('0x2e')),'countbusyretry':_0x4b9dd0[_0xe367('0x31')],'countcongestionretry':_0x4b9dd0[_0xe367('0x21')],'countnoanswerretry':_0x4b9dd0[_0xe367('0x22')],'countnosuchnumberretry':_0x4b9dd0['countnosuchnumberretry'],'countdropretry':_0x4b9dd0[_0xe367('0x23')],'countabandonedretry':_0x4b9dd0['countabandonedretry'],'countmachineretry':_0x4b9dd0[_0xe367('0x25')],'countagentrejectretry':_0x4b9dd0[_0xe367('0x26')],'createdAt':_0x4b9dd0[_0xe367('0x32')],'updatedAt':_0x4b9dd0[_0xe367('0x33')]};var _0x359e3c={'CmHopperId':_0x526079['id'],'phone':_0x2aa8b8['phone'],'active':0x0,'OrderBy':_[_0xe367('0x2f')](_0x2aa8b8[_0xe367('0x1f')])?0x0:_0x2aa8b8['OrderBy'],'scheduledat':_0x13bda1,'countbusyretry':_0x2aa8b8[_0xe367('0x31')],'countcongestionretry':_0x2aa8b8[_0xe367('0x21')],'countnoanswerretry':_0x2aa8b8[_0xe367('0x22')],'countnosuchnumberretry':_0x2aa8b8[_0xe367('0x34')],'countdropretry':_0x2aa8b8[_0xe367('0x23')],'countabandonedretry':_0x2aa8b8[_0xe367('0x24')],'countmachineretry':_0x2aa8b8[_0xe367('0x25')],'countagentrejectretry':_0x2aa8b8[_0xe367('0x26')],'createdAt':_0x2aa8b8['createdAt'],'updatedAt':_0x2aa8b8['updatedAt']};return db[_0xe367('0x35')][_0xe367('0x36')](function(_0x477e0e){return db[_0xe367('0x1e')][_0xe367('0x37')](_0x3d783c,{'where':{'id':_0x2aa8b8['id']}},{'transaction':_0x477e0e})[_0xe367('0xb')](function(){return db[_0xe367('0x18')]['update'](_0x359e3c,{'where':{'id':_0x526079['id']}},{'transaction':_0x477e0e});});})[_0xe367('0xb')](function(_0x469842){_0x55ac08({'id':_0x526079['id'],'phone':_0x2aa8b8[_0xe367('0x30')]});})[_0xe367('0x16')](function(_0x4affa1){logger['error'](_0xe367('0x38'),_0x4affa1[_0xe367('0x14')]);_0x3d9411({'error':_0x4affa1[_0xe367('0x14')]});});});}exports['IncrementPreviewCounters']=function(_0x56d135){var _0x19378e=this;return new Promise(function(_0x4beaf0,_0x730bc1){return db[_0xe367('0x18')][_0xe367('0x37')](_0x56d135[_0xe367('0x19')][_0xe367('0x39')],{'where':{'id':_0x56d135[_0xe367('0x19')]['id']}})[_0xe367('0xb')](function(_0x1cb146){_0x4beaf0(_0x1cb146);})[_0xe367('0x16')](function(_0x57dd60){logger[_0xe367('0x12')](_0xe367('0x3a'),_0x57dd60[_0xe367('0x14')]);_0x730bc1(_0x19378e[_0xe367('0x12')](0x1f4,_0x57dd60[_0xe367('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b1efa96..b911982 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 _0x8ba2=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path','express'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x8ba2,0x13f));var _0x28ba=function(_0x4a4caf,_0x16c73b){_0x4a4caf=_0x4a4caf-0x0;var _0x2d1049=_0x8ba2[_0x4a4caf];return _0x2d1049;};'use strict';var multer=require(_0x28ba('0x0'));var util=require(_0x28ba('0x1'));var path=require(_0x28ba('0x2'));var timeout=require('connect-timeout');var express=require(_0x28ba('0x3'));var router=express[_0x28ba('0x4')]();var fs_extra=require(_0x28ba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x28ba('0x6'));var config=require(_0x28ba('0x7'));var controller=require(_0x28ba('0x8'));router[_0x28ba('0x9')]('/',auth[_0x28ba('0xa')](),controller[_0x28ba('0xb')]);router['get'](_0x28ba('0xc'),auth[_0x28ba('0xa')](),controller[_0x28ba('0xd')]);router['post']('/',auth[_0x28ba('0xa')](),controller[_0x28ba('0xe')]);router[_0x28ba('0xf')](_0x28ba('0xc'),auth[_0x28ba('0xa')](),controller[_0x28ba('0x10')]);router[_0x28ba('0x11')](_0x28ba('0xc'),auth[_0x28ba('0xa')](),controller[_0x28ba('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9d8d=['get','isAuthenticated','index','/:id','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x35035c,_0x11d1f1){var _0x1f6691=function(_0x30cb98){while(--_0x30cb98){_0x35035c['push'](_0x35035c['shift']());}};_0x1f6691(++_0x11d1f1);}(_0x9d8d,0x8e));var _0xd9d8=function(_0x517378,_0x4f6ba6){_0x517378=_0x517378-0x0;var _0x271119=_0x9d8d[_0x517378];return _0x271119;};'use strict';var multer=require('multer');var util=require(_0xd9d8('0x0'));var path=require(_0xd9d8('0x1'));var timeout=require(_0xd9d8('0x2'));var express=require(_0xd9d8('0x3'));var router=express[_0xd9d8('0x4')]();var fs_extra=require(_0xd9d8('0x5'));var auth=require(_0xd9d8('0x6'));var interaction=require(_0xd9d8('0x7'));var config=require(_0xd9d8('0x8'));var controller=require(_0xd9d8('0x9'));router[_0xd9d8('0xa')]('/',auth[_0xd9d8('0xb')](),controller[_0xd9d8('0xc')]);router[_0xd9d8('0xa')](_0xd9d8('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd9d8('0xb')](),controller['create']);router[_0xd9d8('0xe')](_0xd9d8('0xd'),auth[_0xd9d8('0xb')](),controller[_0xd9d8('0xf')]);router[_0xd9d8('0x10')](_0xd9d8('0xd'),auth['isAuthenticated'](),controller[_0xd9d8('0x11')]);module[_0xd9d8('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 ed1a479..f8efa1d 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 _0x4fd7=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x5c5b73,_0x26c7e4){var _0x3975db=function(_0x129032){while(--_0x129032){_0x5c5b73['push'](_0x5c5b73['shift']());}};_0x3975db(++_0x26c7e4);}(_0x4fd7,0xe6));var _0x74fd=function(_0x14a207,_0x462179){_0x14a207=_0x14a207-0x0;var _0x5c81a9=_0x4fd7[_0x14a207];return _0x5c81a9;};'use strict';var moment=require(_0x74fd('0x0'));var Sequelize=require(_0x74fd('0x1'));module[_0x74fd('0x2')]={'phone':{'type':Sequelize[_0x74fd('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x74fd('0x4')],'unique':_0x74fd('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x74fd('0x5')}}; \ No newline at end of file +var _0xa1aa=['exports','STRING','INTEGER','contactListQueue'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xa1aa,0x88));var _0xaa1a=function(_0x5397c3,_0x5c6499){_0x5397c3=_0x5397c3-0x0;var _0x146d75=_0xa1aa[_0x5397c3];return _0x146d75;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xaa1a('0x0')]={'phone':{'type':Sequelize[_0xaa1a('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xaa1a('0x2')],'unique':_0xaa1a('0x3')},'ListId':{'type':Sequelize[_0xaa1a('0x2')],'unique':_0xaa1a('0x3')},'VoiceQueueId':{'type':Sequelize[_0xaa1a('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2296114..d8081bf 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 _0x3116=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','show','params','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x6277,_0x4f7d06){var _0x37f933=function(_0x30d4e5){while(--_0x30d4e5){_0x6277['push'](_0x6277['shift']());}};_0x37f933(++_0x4f7d06);}(_0x3116,0x17e));var _0x6311=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3116[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x6311('0x0'));var rimraf=require(_0x6311('0x1'));var zipdir=require(_0x6311('0x2'));var jsonpatch=require(_0x6311('0x3'));var rp=require(_0x6311('0x4'));var moment=require(_0x6311('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6311('0x6'));var util=require(_0x6311('0x7'));var path=require(_0x6311('0x8'));var sox=require(_0x6311('0x9'));var csv=require('to-csv');var ejs=require(_0x6311('0xa'));var fs=require('fs');var fs_extra=require(_0x6311('0xb'));var _=require(_0x6311('0xc'));var squel=require(_0x6311('0xd'));var crypto=require(_0x6311('0xe'));var jsforce=require(_0x6311('0xf'));var deskjs=require(_0x6311('0x10'));var toCsv=require(_0x6311('0x11'));var querystring=require(_0x6311('0x12'));var Papa=require(_0x6311('0x13'));var Redis=require('ioredis');var authService=require(_0x6311('0x14'));var qs=require(_0x6311('0x15'));var as=require(_0x6311('0x16'));var hardwareService=require(_0x6311('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x6311('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6311('0x19'));var db=require(_0x6311('0x1a'))['db'];function respondWithStatusCode(_0x17da35,_0x1c2823){_0x1c2823=_0x1c2823||0xcc;return function(_0xa07ef1){if(_0xa07ef1){return _0x17da35['sendStatus'](_0x1c2823);}return _0x17da35[_0x6311('0x1b')](_0x1c2823)[_0x6311('0x1c')]();};}function respondWithResult(_0x4cfbbc,_0x1e73fe){_0x1e73fe=_0x1e73fe||0xc8;return function(_0x5890cb){if(_0x5890cb){return _0x4cfbbc[_0x6311('0x1b')](_0x1e73fe)[_0x6311('0x1d')](_0x5890cb);}};}function respondWithFilteredResult(_0xadfb75,_0x59f929){return function(_0x3fefbe){if(_0x3fefbe){var _0x188d68=typeof _0x59f929[_0x6311('0x1e')]===_0x6311('0x1f')&&typeof _0x59f929[_0x6311('0x20')]==='undefined';var _0x41c7e6=_0x3fefbe[_0x6311('0x21')];var _0x195800=_0x188d68?0x0:_0x59f929['offset'];var _0x3a4931=_0x188d68?_0x3fefbe['count']:_0x59f929['offset']+_0x59f929[_0x6311('0x20')];var _0x39b9c3;if(_0x3a4931>=_0x41c7e6){_0x3a4931=_0x41c7e6;_0x39b9c3=0xc8;}else{_0x39b9c3=0xce;}_0xadfb75[_0x6311('0x1b')](_0x39b9c3);return _0xadfb75[_0x6311('0x22')](_0x6311('0x23'),_0x195800+'-'+_0x3a4931+'/'+_0x41c7e6)[_0x6311('0x1d')](_0x3fefbe);}return null;};}function patchUpdates(_0x40b582){return function(_0xd32155){try{jsonpatch[_0x6311('0x24')](_0xd32155,_0x40b582,!![]);}catch(_0x4e085a){return BPromise[_0x6311('0x25')](_0x4e085a);}return _0xd32155[_0x6311('0x26')]();};}function saveUpdates(_0x11519c,_0x754561){return function(_0x3ea7ef){if(_0x3ea7ef){return _0x3ea7ef[_0x6311('0x27')](_0x11519c)[_0x6311('0x28')](function(_0x494141){return _0x494141;});}return null;};}function removeEntity(_0x3a667b,_0x1f80f7){return function(_0x402be5){if(_0x402be5){return _0x402be5['destroy']()[_0x6311('0x28')](function(){_0x3a667b[_0x6311('0x1b')](0xcc)[_0x6311('0x1c')]();});}};}function handleEntityNotFound(_0x4c0a5d,_0x2015ee){return function(_0x371565){if(!_0x371565){_0x4c0a5d[_0x6311('0x29')](0x194);}return _0x371565;};}function handleError(_0x53df5d,_0x25a9a8){_0x25a9a8=_0x25a9a8||0x1f4;return function(_0x20ed99){logger[_0x6311('0x2a')](_0x20ed99[_0x6311('0x2b')]);if(_0x20ed99[_0x6311('0x2c')]){delete _0x20ed99[_0x6311('0x2c')];}_0x53df5d['status'](_0x25a9a8)[_0x6311('0x2d')](_0x20ed99);};}exports[_0x6311('0x2e')]=function(_0x5da083,_0x1fdf0a){var _0x5b0dbe={},_0x15f26d={},_0x1fe933={'count':0x0,'rows':[]};var _0x7edfed=_['map'](db[_0x6311('0x2f')][_0x6311('0x30')],function(_0x10b321){return{'name':_0x10b321[_0x6311('0x31')],'type':_0x10b321[_0x6311('0x32')]['key']};});_0x15f26d[_0x6311('0x33')]=_[_0x6311('0x34')](_0x7edfed,_0x6311('0x2c'));_0x15f26d[_0x6311('0x35')]=_[_0x6311('0x36')](_0x5da083['query']);_0x15f26d['filters']=_[_0x6311('0x37')](_0x15f26d['model'],_0x15f26d['query']);_0x5b0dbe[_0x6311('0x38')]=_['intersection'](_0x15f26d[_0x6311('0x33')],qs['fields'](_0x5da083[_0x6311('0x35')][_0x6311('0x39')]));_0x5b0dbe[_0x6311('0x38')]=_0x5b0dbe['attributes'][_0x6311('0x3a')]?_0x5b0dbe[_0x6311('0x38')]:_0x15f26d[_0x6311('0x33')];if(!_0x5da083[_0x6311('0x35')][_0x6311('0x3b')](_0x6311('0x3c'))){_0x5b0dbe['limit']=qs[_0x6311('0x20')](_0x5da083[_0x6311('0x35')][_0x6311('0x20')]);_0x5b0dbe[_0x6311('0x1e')]=qs['offset'](_0x5da083[_0x6311('0x35')][_0x6311('0x1e')]);}_0x5b0dbe[_0x6311('0x3d')]=qs[_0x6311('0x3e')](_0x5da083[_0x6311('0x35')]['sort']);_0x5b0dbe[_0x6311('0x3f')]=qs[_0x6311('0x40')](_[_0x6311('0x41')](_0x5da083[_0x6311('0x35')],_0x15f26d[_0x6311('0x40')]),_0x7edfed);if(_0x5da083[_0x6311('0x35')]['filter']){_0x5b0dbe[_0x6311('0x3f')]=_[_0x6311('0x42')](_0x5b0dbe[_0x6311('0x3f')],{'$or':_['map'](_0x7edfed,function(_0xc29758){if(_0xc29758[_0x6311('0x32')]!==_0x6311('0x43')){var _0x3b2f53={};_0x3b2f53[_0xc29758[_0x6311('0x2c')]]={'$like':'%'+_0x5da083[_0x6311('0x35')][_0x6311('0x44')]+'%'};return _0x3b2f53;}})});}_0x5b0dbe=_[_0x6311('0x42')]({},_0x5b0dbe,_0x5da083[_0x6311('0x45')]);var _0x35090f={'where':_0x5b0dbe['where']};return db[_0x6311('0x2f')][_0x6311('0x21')](_0x35090f)['then'](function(_0x2934b8){_0x1fe933['count']=_0x2934b8;if(_0x5da083[_0x6311('0x35')][_0x6311('0x46')]){_0x5b0dbe[_0x6311('0x47')]=[{'all':!![]}];}return db[_0x6311('0x2f')]['findAll'](_0x5b0dbe);})['then'](function(_0x7b0713){_0x1fe933['rows']=_0x7b0713;return _0x1fe933;})['then'](respondWithFilteredResult(_0x1fdf0a,_0x5b0dbe))['catch'](handleError(_0x1fdf0a,null));};exports[_0x6311('0x48')]=function(_0x426f7b,_0x17080d){var _0x10d2b5={'raw':!![],'where':{'id':_0x426f7b[_0x6311('0x49')]['id']}},_0x3112d8={};_0x3112d8[_0x6311('0x33')]=_['keys'](db[_0x6311('0x2f')][_0x6311('0x30')]);_0x3112d8[_0x6311('0x35')]=_[_0x6311('0x36')](_0x426f7b[_0x6311('0x35')]);_0x3112d8[_0x6311('0x40')]=_['intersection'](_0x3112d8['model'],_0x3112d8[_0x6311('0x35')]);_0x10d2b5['attributes']=_['intersection'](_0x3112d8[_0x6311('0x33')],qs['fields'](_0x426f7b[_0x6311('0x35')][_0x6311('0x39')]));_0x10d2b5[_0x6311('0x38')]=_0x10d2b5[_0x6311('0x38')][_0x6311('0x3a')]?_0x10d2b5[_0x6311('0x38')]:_0x3112d8[_0x6311('0x33')];if(_0x426f7b[_0x6311('0x35')]['includeAll']){_0x10d2b5[_0x6311('0x47')]=[{'all':!![]}];}_0x10d2b5=_[_0x6311('0x42')]({},_0x10d2b5,_0x426f7b[_0x6311('0x45')]);return db[_0x6311('0x2f')]['find'](_0x10d2b5)['then'](handleEntityNotFound(_0x17080d,null))['then'](respondWithResult(_0x17080d,null))[_0x6311('0x4a')](handleError(_0x17080d,null));};exports[_0x6311('0x27')]=function(_0x1b7bc3,_0x27f6cc){if(_0x1b7bc3[_0x6311('0x4b')]['id']){delete _0x1b7bc3['body']['id'];}return db['CmHopperBlack'][_0x6311('0x4c')]({'where':{'id':_0x1b7bc3[_0x6311('0x49')]['id']}})[_0x6311('0x28')](handleEntityNotFound(_0x27f6cc,null))[_0x6311('0x28')](saveUpdates(_0x1b7bc3[_0x6311('0x4b')],null))[_0x6311('0x28')](respondWithResult(_0x27f6cc,null))['catch'](handleError(_0x27f6cc,null));};exports['destroy']=function(_0xd96d7b,_0x187127){return db[_0x6311('0x2f')][_0x6311('0x4c')]({'where':{'id':_0xd96d7b[_0x6311('0x49')]['id']}})[_0x6311('0x28')](handleEntityNotFound(_0x187127,null))[_0x6311('0x28')](removeEntity(_0x187127,null))[_0x6311('0x4a')](handleError(_0x187127,null));};exports[_0x6311('0x4d')]=function(_0x5a6faf,_0x4ba102){return db[_0x6311('0x2f')][_0x6311('0x4d')]()[_0x6311('0x28')](respondWithResult(_0x4ba102,null))['catch'](handleError(_0x4ba102,null));}; \ No newline at end of file +var _0x6050=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','CmHopperBlack'];(function(_0x3938ff,_0x37393a){var _0x28a66c=function(_0x43d976){while(--_0x43d976){_0x3938ff['push'](_0x3938ff['shift']());}};_0x28a66c(++_0x37393a);}(_0x6050,0x196));var _0x0605=function(_0x309322,_0x1d5249){_0x309322=_0x309322-0x0;var _0x590192=_0x6050[_0x309322];return _0x590192;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['CmHopperBlack'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['CmHopperBlack'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){if(_0x1fb70b[_0x0605('0x49')]['id']){delete _0x1fb70b[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x1fb70b[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x45cc1a,null))['then'](saveUpdates(_0x1fb70b[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x45cc1a,null))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x26')]=function(_0x2f005a,_0x434289){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x2f005a[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x434289,null))['then'](removeEntity(_0x434289,null))['catch'](handleError(_0x434289,null));};exports['describe']=function(_0x2687a8,_0x7daeb7){return db[_0x0605('0x2b')][_0x0605('0x4a')]()[_0x0605('0x25')](respondWithResult(_0x7daeb7,null))[_0x0605('0x43')](handleError(_0x7daeb7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index baf7838..5029d72 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 _0x2d2a=['cm_hopper_black','lodash','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x27e1e8,_0x2464a5){var _0x222e19=function(_0x506bbb){while(--_0x506bbb){_0x27e1e8['push'](_0x27e1e8['shift']());}};_0x222e19(++_0x2464a5);}(_0x2d2a,0x1ba));var _0xa2d2=function(_0x91347f,_0x5998a5){_0x91347f=_0x91347f-0x0;var _0x5db4e1=_0x2d2a[_0x91347f];return _0x5db4e1;};'use strict';var _=require(_0xa2d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa2d2('0x1'));var moment=require('moment');var BPromise=require(_0xa2d2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2d2('0x3'));var rimraf=require(_0xa2d2('0x4'));var config=require(_0xa2d2('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0xa2d2('0x6')]=function(_0x1dfb58,_0x3c3df7){return _0x1dfb58[_0xa2d2('0x7')]('CmHopperBlack',attributes,{'tableName':_0xa2d2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c8b=['api','moment','bluebird','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger'];(function(_0x39665a,_0xc729df){var _0x173185=function(_0x2263f4){while(--_0x2263f4){_0x39665a['push'](_0x39665a['shift']());}};_0x173185(++_0xc729df);}(_0x7c8b,0xb3));var _0xb7c8=function(_0x36f971,_0x5afd21){_0x36f971=_0x36f971-0x0;var _0x385070=_0x7c8b[_0x36f971];return _0x385070;};'use strict';var _=require(_0xb7c8('0x0'));var util=require(_0xb7c8('0x1'));var logger=require(_0xb7c8('0x2'))(_0xb7c8('0x3'));var moment=require(_0xb7c8('0x4'));var BPromise=require(_0xb7c8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7c8('0x6'));var rimraf=require(_0xb7c8('0x7'));var config=require('../../config/environment');var attributes=require(_0xb7c8('0x8'));module[_0xb7c8('0x9')]=function(_0x445425,_0x8bad39){return _0x445425[_0xb7c8('0xa')](_0xb7c8('0xb'),attributes,{'tableName':_0xb7c8('0xc'),'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 c73f707..e400413 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 _0x1482=['limit','catch','DestroyCmHopperBlack','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CmHopperBlack','findAll','options','raw','where','attributes','map','model','include','then','debug','GetCmHopperBlack','UpdateCmHopperBlack','body'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x1482,0x1bf));var _0x2148=function(_0x167a41,_0x177dbe){_0x167a41=_0x167a41-0x0;var _0x2b7158=_0x1482[_0x167a41];return _0x2b7158;};'use strict';var _=require(_0x2148('0x0'));var util=require(_0x2148('0x1'));var moment=require(_0x2148('0x2'));var BPromise=require(_0x2148('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2148('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2148('0x5'));var logger=require(_0x2148('0x6'))(_0x2148('0x7'));var config=require(_0x2148('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2148('0x9')][_0x2148('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aaab3,_0x5b2f9b,_0x53d158){return new BPromise(function(_0x58504a,_0x11549e){return client[_0x2148('0xb')](_0x4aaab3,_0x53d158)['then'](function(_0x1edc50){logger[_0x2148('0xc')](_0x2148('0xd'),_0x5b2f9b,_0x2148('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5b2f9b,_0x2148('0xe'),JSON[_0x2148('0xf')](_0x1edc50));if(_0x1edc50[_0x2148('0x10')]){if(_0x1edc50['error'][_0x2148('0x11')]===0x1f4){logger['error'](_0x2148('0xd'),_0x5b2f9b,_0x1edc50[_0x2148('0x10')]['message']);return _0x11549e(_0x1edc50[_0x2148('0x10')][_0x2148('0x12')]);}logger['error'](_0x2148('0xd'),_0x5b2f9b,_0x1edc50['error'][_0x2148('0x12')]);return _0x58504a(_0x1edc50[_0x2148('0x10')][_0x2148('0x12')]);}else{logger[_0x2148('0xc')](_0x2148('0xd'),_0x5b2f9b,_0x2148('0xe'));_0x58504a(_0x1edc50[_0x2148('0x13')][_0x2148('0x12')]);}})['catch'](function(_0x43f9af){logger[_0x2148('0x10')](_0x2148('0xd'),_0x5b2f9b,_0x43f9af);_0x11549e(_0x43f9af);});});}exports['GetCmHopperBlack']=function(_0x5d570b){var _0x3637c0=this;return new Promise(function(_0x2c1fe1,_0x34fd6b){return db[_0x2148('0x14')][_0x2148('0x15')]({'raw':_0x5d570b[_0x2148('0x16')]?_0x5d570b['options'][_0x2148('0x17')]===undefined?!![]:![]:!![],'where':_0x5d570b['options']?_0x5d570b[_0x2148('0x16')][_0x2148('0x18')]||null:null,'attributes':_0x5d570b[_0x2148('0x16')]?_0x5d570b[_0x2148('0x16')][_0x2148('0x19')]||null:null,'limit':_0x5d570b[_0x2148('0x16')]?_0x5d570b[_0x2148('0x16')]['limit']||null:null,'include':_0x5d570b['options']?_0x5d570b['options']['include']?_[_0x2148('0x1a')](_0x5d570b[_0x2148('0x16')]['include'],function(_0x358492){return{'model':db[_0x358492[_0x2148('0x1b')]],'as':_0x358492['as'],'attributes':_0x358492[_0x2148('0x19')],'include':_0x358492[_0x2148('0x1c')]?_['map'](_0x358492['include'],function(_0x1fcc38){return{'model':db[_0x1fcc38[_0x2148('0x1b')]],'as':_0x1fcc38['as'],'attributes':_0x1fcc38['attributes'],'include':_0x1fcc38[_0x2148('0x1c')]?_['map'](_0x1fcc38[_0x2148('0x1c')],function(_0x4cb94d){return{'model':db[_0x4cb94d[_0x2148('0x1b')]],'as':_0x4cb94d['as'],'attributes':_0x4cb94d[_0x2148('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2148('0x1d')](function(_0x516b09){logger[_0x2148('0xc')]('GetCmHopperBlack',_0x5d570b);logger[_0x2148('0x1e')](_0x2148('0x1f'),_0x5d570b,JSON[_0x2148('0xf')](_0x516b09));_0x2c1fe1(_0x516b09);})['catch'](function(_0x54b0c9){logger[_0x2148('0x10')](_0x2148('0x1f'),_0x54b0c9[_0x2148('0x12')],_0x5d570b);_0x34fd6b(_0x3637c0[_0x2148('0x10')](0x1f4,_0x54b0c9[_0x2148('0x12')]));});});};exports[_0x2148('0x20')]=function(_0x7ca0a7){var _0x1a731e=this;return new Promise(function(_0x3dcd1a,_0x54f8f0){return db['CmHopperBlack']['update'](_0x7ca0a7[_0x2148('0x21')],{'raw':_0x7ca0a7[_0x2148('0x16')]?_0x7ca0a7[_0x2148('0x16')][_0x2148('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7ca0a7[_0x2148('0x16')]?_0x7ca0a7[_0x2148('0x16')][_0x2148('0x18')]||null:null,'attributes':_0x7ca0a7[_0x2148('0x16')]?_0x7ca0a7[_0x2148('0x16')][_0x2148('0x19')]||null:null,'limit':_0x7ca0a7[_0x2148('0x16')]?_0x7ca0a7['options'][_0x2148('0x22')]||null:null})[_0x2148('0x1d')](function(_0x407261){logger[_0x2148('0xc')](_0x2148('0x20'),_0x7ca0a7);logger[_0x2148('0x1e')](_0x2148('0x20'),_0x7ca0a7,JSON[_0x2148('0xf')](_0x407261));_0x3dcd1a(_0x407261);})[_0x2148('0x23')](function(_0x22eddf){logger[_0x2148('0x10')]('UpdateCmHopperBlack',_0x22eddf['message'],_0x7ca0a7);_0x54f8f0(_0x1a731e[_0x2148('0x10')](0x1f4,_0x22eddf[_0x2148('0x12')]));});});};exports[_0x2148('0x24')]=function(_0x3b7066){var _0x13cef1=this;return new Promise(function(_0x793f3b,_0x34f23f){return db[_0x2148('0x14')]['destroy']({'where':_0x3b7066[_0x2148('0x16')]?_0x3b7066[_0x2148('0x16')][_0x2148('0x18')]||null:null})['then'](function(_0x44d9a2){logger[_0x2148('0xc')]('DestroyCmHopperBlack',_0x3b7066);logger['debug'](_0x2148('0x24'),_0x3b7066,JSON[_0x2148('0xf')](_0x44d9a2));_0x793f3b(_0x44d9a2);})[_0x2148('0x23')](function(_0x28bc1b){logger[_0x2148('0x10')](_0x2148('0x24'),_0x28bc1b['message'],_0x3b7066);_0x34f23f(_0x13cef1[_0x2148('0x10')](0x1f4,_0x28bc1b[_0x2148('0x12')]));});});}; \ No newline at end of file +var _0xdff7=['include','model','debug','stringify','UpdateCmHopperBlack','update','body','where','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','attributes','limit','map'];(function(_0x3a2b52,_0x3b0ce4){var _0x225f6f=function(_0xda94d5){while(--_0xda94d5){_0x3a2b52['push'](_0x3a2b52['shift']());}};_0x225f6f(++_0x3b0ce4);}(_0xdff7,0x121));var _0x7dff=function(_0x932587,_0x31bd0d){_0x932587=_0x932587-0x0;var _0x2e0fa3=_0xdff7[_0x932587];return _0x2e0fa3;};'use strict';var _=require(_0x7dff('0x0'));var util=require(_0x7dff('0x1'));var moment=require(_0x7dff('0x2'));var BPromise=require(_0x7dff('0x3'));var rs=require(_0x7dff('0x4'));var fs=require('fs');var Redis=require(_0x7dff('0x5'));var db=require(_0x7dff('0x6'))['db'];var utils=require(_0x7dff('0x7'));var logger=require(_0x7dff('0x8'))(_0x7dff('0x9'));var config=require(_0x7dff('0xa'));var jayson=require(_0x7dff('0xb'));var client=jayson[_0x7dff('0xc')][_0x7dff('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a1e92,_0x1c8aa6,_0xa33cd2){return new BPromise(function(_0x1e6938,_0x12dad0){return client['request'](_0x1a1e92,_0xa33cd2)[_0x7dff('0xe')](function(_0xf2310c){logger[_0x7dff('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x1c8aa6,'request\x20sent');logger['debug'](_0x7dff('0x10'),_0x1c8aa6,_0x7dff('0x11'),JSON['stringify'](_0xf2310c));if(_0xf2310c[_0x7dff('0x12')]){if(_0xf2310c[_0x7dff('0x12')][_0x7dff('0x13')]===0x1f4){logger[_0x7dff('0x12')](_0x7dff('0x14'),_0x1c8aa6,_0xf2310c['error'][_0x7dff('0x15')]);return _0x12dad0(_0xf2310c[_0x7dff('0x12')][_0x7dff('0x15')]);}logger['error'](_0x7dff('0x14'),_0x1c8aa6,_0xf2310c[_0x7dff('0x12')][_0x7dff('0x15')]);return _0x1e6938(_0xf2310c[_0x7dff('0x12')]['message']);}else{logger[_0x7dff('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x1c8aa6,_0x7dff('0x11'));_0x1e6938(_0xf2310c[_0x7dff('0x16')]['message']);}})[_0x7dff('0x17')](function(_0x1e4165){logger['error'](_0x7dff('0x14'),_0x1c8aa6,_0x1e4165);_0x12dad0(_0x1e4165);});});}exports[_0x7dff('0x18')]=function(_0x2bdff3){var _0x1a3cab=this;return new Promise(function(_0x3b6b99,_0x4509aa){return db[_0x7dff('0x19')]['findAll']({'raw':_0x2bdff3[_0x7dff('0x1a')]?_0x2bdff3[_0x7dff('0x1a')][_0x7dff('0x1b')]===undefined?!![]:![]:!![],'where':_0x2bdff3['options']?_0x2bdff3[_0x7dff('0x1a')]['where']||null:null,'attributes':_0x2bdff3['options']?_0x2bdff3[_0x7dff('0x1a')][_0x7dff('0x1c')]||null:null,'limit':_0x2bdff3[_0x7dff('0x1a')]?_0x2bdff3['options'][_0x7dff('0x1d')]||null:null,'include':_0x2bdff3['options']?_0x2bdff3[_0x7dff('0x1a')]['include']?_[_0x7dff('0x1e')](_0x2bdff3[_0x7dff('0x1a')][_0x7dff('0x1f')],function(_0x796d36){return{'model':db[_0x796d36[_0x7dff('0x20')]],'as':_0x796d36['as'],'attributes':_0x796d36[_0x7dff('0x1c')],'include':_0x796d36[_0x7dff('0x1f')]?_[_0x7dff('0x1e')](_0x796d36[_0x7dff('0x1f')],function(_0x2c17bb){return{'model':db[_0x2c17bb['model']],'as':_0x2c17bb['as'],'attributes':_0x2c17bb[_0x7dff('0x1c')],'include':_0x2c17bb[_0x7dff('0x1f')]?_[_0x7dff('0x1e')](_0x2c17bb[_0x7dff('0x1f')],function(_0x104f6e){return{'model':db[_0x104f6e['model']],'as':_0x104f6e['as'],'attributes':_0x104f6e[_0x7dff('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7dff('0xe')](function(_0x946228){logger['info'](_0x7dff('0x18'),_0x2bdff3);logger[_0x7dff('0x21')](_0x7dff('0x18'),_0x2bdff3,JSON[_0x7dff('0x22')](_0x946228));_0x3b6b99(_0x946228);})[_0x7dff('0x17')](function(_0x55052e){logger[_0x7dff('0x12')](_0x7dff('0x18'),_0x55052e[_0x7dff('0x15')],_0x2bdff3);_0x4509aa(_0x1a3cab['error'](0x1f4,_0x55052e[_0x7dff('0x15')]));});});};exports[_0x7dff('0x23')]=function(_0xbc10a3){var _0x332e81=this;return new Promise(function(_0x53567a,_0x542f8d){return db[_0x7dff('0x19')][_0x7dff('0x24')](_0xbc10a3[_0x7dff('0x25')],{'raw':_0xbc10a3['options']?_0xbc10a3[_0x7dff('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbc10a3[_0x7dff('0x1a')]?_0xbc10a3['options'][_0x7dff('0x26')]||null:null,'attributes':_0xbc10a3[_0x7dff('0x1a')]?_0xbc10a3[_0x7dff('0x1a')]['attributes']||null:null,'limit':_0xbc10a3['options']?_0xbc10a3[_0x7dff('0x1a')][_0x7dff('0x1d')]||null:null})[_0x7dff('0xe')](function(_0x515be5){logger[_0x7dff('0xf')](_0x7dff('0x23'),_0xbc10a3);logger[_0x7dff('0x21')](_0x7dff('0x23'),_0xbc10a3,JSON[_0x7dff('0x22')](_0x515be5));_0x53567a(_0x515be5);})[_0x7dff('0x17')](function(_0x447eb3){logger[_0x7dff('0x12')](_0x7dff('0x23'),_0x447eb3['message'],_0xbc10a3);_0x542f8d(_0x332e81['error'](0x1f4,_0x447eb3[_0x7dff('0x15')]));});});};exports[_0x7dff('0x27')]=function(_0xbbf584){var _0x17ab58=this;return new Promise(function(_0x59b994,_0x23e73c){return db[_0x7dff('0x19')]['destroy']({'where':_0xbbf584[_0x7dff('0x1a')]?_0xbbf584['options'][_0x7dff('0x26')]||null:null})[_0x7dff('0xe')](function(_0x4a4dd3){logger[_0x7dff('0xf')](_0x7dff('0x27'),_0xbbf584);logger[_0x7dff('0x21')](_0x7dff('0x27'),_0xbbf584,JSON[_0x7dff('0x22')](_0x4a4dd3));_0x59b994(_0x4a4dd3);})['catch'](function(_0x34656e){logger['error'](_0x7dff('0x27'),_0x34656e[_0x7dff('0x15')],_0xbbf584);_0x23e73c(_0x17ab58[_0x7dff('0x12')](0x1f4,_0x34656e[_0x7dff('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5264a6c..2a86ac2 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 _0xbff5=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4ef991,_0x3273d8){var _0x1ff040=function(_0x582253){while(--_0x582253){_0x4ef991['push'](_0x4ef991['shift']());}};_0x1ff040(++_0x3273d8);}(_0xbff5,0x1bc));var _0x5bff=function(_0xa67db1,_0x1078d1){_0xa67db1=_0xa67db1-0x0;var _0x5f3a34=_0xbff5[_0xa67db1];return _0x5f3a34;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['put'](_0x5bff('0xd'),auth[_0x5bff('0x9')](),controller['update']);router[_0x5bff('0xf')]('/:id',auth[_0x5bff('0x9')](),controller['destroy']);module[_0x5bff('0x10')]=router; \ No newline at end of file +var _0x5d17=['index','/describe','isAuthenticated','describe','/:id','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x5d17,0x114));var _0x75d1=function(_0x452630,_0x1c0fc4){_0x452630=_0x452630-0x0;var _0x31ebec=_0x5d17[_0x452630];return _0x31ebec;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0xf')]);router[_0x75d1('0x10')]('/:id',auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);module[_0x75d1('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 48828a7..5078fbf 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 _0x2b75=['BOOLEAN','moment','exports','INTEGER','STRING','DATE','endtime','setDataValue','diff','seconds'];(function(_0x38b777,_0x58b31e){var _0x41da2c=function(_0x1e929a){while(--_0x1e929a){_0x38b777['push'](_0x38b777['shift']());}};_0x41da2c(++_0x58b31e);}(_0x2b75,0x141));var _0x52b7=function(_0x346470,_0x544e8b){_0x346470=_0x346470-0x0;var _0x48c17a=_0x2b75[_0x346470];return _0x48c17a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x52b7('0x0'));module[_0x52b7('0x1')]={'state':{'type':Sequelize[_0x52b7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x52b7('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x52b7('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x52b7('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x52b7('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x52b7('0x3')]},'originatecalleridname':{'type':Sequelize[_0x52b7('0x3')]},'calleridnum':{'type':Sequelize[_0x52b7('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x52b7('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x52b7('0x4')]},'droptime':{'type':Sequelize[_0x52b7('0x4')]},'endtime':{'type':Sequelize[_0x52b7('0x4')]},'ringtime':{'type':Sequelize[_0x52b7('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x52b7('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x52b7('0x3')]},'campaign':{'type':Sequelize[_0x52b7('0x3')]},'campaigntype':{'type':Sequelize[_0x52b7('0x3')]},'membername':{'type':Sequelize[_0x52b7('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x52b7('0x3')]},'secondDisposition':{'type':Sequelize[_0x52b7('0x3')]},'thirdDisposition':{'type':Sequelize[_0x52b7('0x3')]},'dispositionat':{'type':Sequelize[_0x52b7('0x4')],'set':function(_0x237e88){var _0x25a13f=this['getDataValue'](_0x52b7('0x5'));if(_0x25a13f&&_0x237e88){this[_0x52b7('0x6')]('followuptime',moment(_0x237e88)[_0x52b7('0x7')](moment(_0x25a13f),_0x52b7('0x8')));}}},'amd':{'type':Sequelize[_0x52b7('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x52b7('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x52b7('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x52b7('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x52b7('0x4')]},'deleted':{'type':Sequelize[_0x52b7('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x52b7('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x52b7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x52b7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5ce3=['followuptime','diff','seconds','BOOLEAN','moment','INTEGER','STRING','DATE','getDataValue','setDataValue'];(function(_0x24042c,_0x35da16){var _0x3be2a5=function(_0x1ef87c){while(--_0x1ef87c){_0x24042c['push'](_0x24042c['shift']());}};_0x3be2a5(++_0x35da16);}(_0x5ce3,0x126));var _0x35ce=function(_0x45f4e9,_0x5246fd){_0x45f4e9=_0x45f4e9-0x0;var _0x559d8f=_0x5ce3[_0x45f4e9];return _0x559d8f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x35ce('0x0'));module['exports']={'state':{'type':Sequelize[_0x35ce('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x35ce('0x2')]},'scheduledat':{'type':Sequelize[_0x35ce('0x3')]},'countbusyretry':{'type':Sequelize[_0x35ce('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x35ce('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x35ce('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x35ce('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x35ce('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x35ce('0x2')]},'originatecalleridname':{'type':Sequelize[_0x35ce('0x2')]},'calleridnum':{'type':Sequelize[_0x35ce('0x2')]},'calleridname':{'type':Sequelize[_0x35ce('0x2')]},'starttime':{'type':Sequelize[_0x35ce('0x3')]},'responsetime':{'type':Sequelize[_0x35ce('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x35ce('0x3')]},'endtime':{'type':Sequelize[_0x35ce('0x3')]},'ringtime':{'type':Sequelize[_0x35ce('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x35ce('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x35ce('0x2')]},'campaign':{'type':Sequelize[_0x35ce('0x2')]},'campaigntype':{'type':Sequelize[_0x35ce('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x35ce('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x35ce('0x2')]},'dispositionat':{'type':Sequelize[_0x35ce('0x3')],'set':function(_0x554b75){var _0x36b4ce=this[_0x35ce('0x4')]('endtime');if(_0x36b4ce&&_0x554b75){this[_0x35ce('0x5')](_0x35ce('0x6'),moment(_0x554b75)[_0x35ce('0x7')](moment(_0x36b4ce),_0x35ce('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x35ce('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x35ce('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x35ce('0x3')]},'callback':{'type':Sequelize[_0x35ce('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x35ce('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x35ce('0x3')]},'deleted':{'type':Sequelize[_0x35ce('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x35ce('0x3')]},'recallme':{'type':Sequelize[_0x35ce('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x35ce('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x35ce('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x35ce('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x35ce('0x1')],'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 f90964d..2f68988 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 _0x5496=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','dropContacts','abandonedContacts','reCallContacts','answeringMachine','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count'];(function(_0x4d9c7c,_0x55e6ec){var _0x437f57=function(_0x4026f2){while(--_0x4026f2){_0x4d9c7c['push'](_0x4d9c7c['shift']());}};_0x437f57(++_0x55e6ec);}(_0x5496,0x175));var _0x6549=function(_0x5b53d7,_0x2eecbc){_0x5b53d7=_0x5b53d7-0x0;var _0x331ec6=_0x5496[_0x5b53d7];return _0x331ec6;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':!![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['describe']()[_0x6549('0x26')](respondWithResult(_0x1712f3,null))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0x6121af,_0xa4c650){if(_0x6121af[_0x6549('0x4c')][_0x6549('0x4d')]){delete _0x6121af[_0x6549('0x4c')]['uniqueid'];}return db[_0x6549('0x2b')]['find']({'where':{'uniqueid':_0x6121af[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0xa4c650,null))[_0x6549('0x26')](saveUpdates(_0x6121af['body'],null))[_0x6549('0x26')](respondWithResult(_0xa4c650,null))[_0x6549('0x43')](handleError(_0xa4c650,null));};exports[_0x6549('0x4e')]=function(_0x5300c8,_0x19ac50,_0x17d7ce){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x5300c8[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn']('COUNT',db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x52')))),_0x6549('0x53')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x55')))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x57')))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),'dropContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5c')))),'abandonedContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5d')))),'reCallContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x5e')))),'answeringMachine']]})[_0x6549('0x26')](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x26')](respondWithResult(_0x19ac50,null))[_0x6549('0x43')](handleError(_0x19ac50,null));};exports[_0x6549('0x5f')]=function(_0x2da535,_0x45eb28,_0x3b01d9){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'CampaignId':_0x2da535[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x52')))),_0x6549('0x53')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),_0x6549('0x60')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5c')))),_0x6549('0x61')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5d')))),_0x6549('0x62')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6549('0x63')]]})['then'](handleEntityNotFound(_0x45eb28,null))[_0x6549('0x26')](respondWithResult(_0x45eb28,null))[_0x6549('0x43')](handleError(_0x45eb28,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x372b67,_0x2c00a1,_0x2e6b4b){return db['VoiceQueue'][_0x6549('0x4a')]({'where':{'id':_0x372b67[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x2c00a1,null))[_0x6549('0x26')](function(_0x15b906){var _0x34c5f9;if(_0x15b906){_0x34c5f9=squel['insert']()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone','scheduledAt','ContactId',_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69'),'updatedAt'],squel['select']()[_0x6549('0x6a')]('ANY_VALUE(calleridnum)',_0x6549('0x6b'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x6d'))[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))['field'](_0x6549('0x70'),_0x6549('0x67'))[_0x6549('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x6549('0x68'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x69'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x71'))['from'](_0x6549('0x72'))['where'](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x372b67[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())['where'](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67['params']['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db[_0x6549('0x50')]['query'](_0x34c5f9);}return[];})[_0x6549('0x26')](respondWithResult(_0x2c00a1,null))[_0x6549('0x43')](handleError(_0x2c00a1,null));};exports[_0x6549('0x7e')]=function(_0x35bad6,_0x371d8a,_0xfde69e){return db[_0x6549('0x7f')][_0x6549('0x4a')]({'where':{'id':_0x35bad6[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x371d8a,null))[_0x6549('0x26')](function(_0x1da2d7){var _0x348d55;if(_0x1da2d7){_0x348d55=squel[_0x6549('0x80')]()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone',_0x6549('0x6d'),_0x6549('0x6f'),_0x6549('0x67'),_0x6549('0x81'),_0x6549('0x69'),_0x6549('0x71')],squel[_0x6549('0x79')]()['field'](_0x6549('0x82'),'phone')['field'](_0x6549('0x6c'),'scheduledAt')[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))[_0x6549('0x6a')](_0x6549('0x70'),'ListId')[_0x6549('0x6a')]('ANY_VALUE(CampaignId)',_0x6549('0x81'))[_0x6549('0x6a')](_0x6549('0x6c'),'createdAt')[_0x6549('0x6a')](_0x6549('0x6c'),'updatedAt')['from'](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x83'),_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x35bad6[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))['where']('CampaignId\x20=\x20?',_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')]('CampaignId\x20=\x20?',_0x35bad6['params']['id']['toString']())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db['sequelize'][_0x6549('0x32')](_0x348d55);}return[];})[_0x6549('0x26')](respondWithResult(_0x371d8a,null))[_0x6549('0x43')](handleError(_0x371d8a,null));};exports[_0x6549('0x84')]=function(_0x230874,_0x3be369,_0xaf1a80){return db[_0x6549('0x85')][_0x6549('0x86')]({'where':{'VoiceQueueId':_0x230874[_0x6549('0x4c')][_0x6549('0x68')],'CampaignId':_0x230874['body'][_0x6549('0x81')],'ContactId':_0x230874[_0x6549('0x4c')][_0x6549('0x6f')]}})[_0x6549('0x26')](handleEntityNotFound(_0x3be369,null))['then'](function(_0x158c92){if(_0x158c92){return _0x158c92;}return null;})[_0x6549('0x26')](respondWithResult(_0x3be369,null))[_0x6549('0x43')](handleError(_0x3be369,null));}; \ No newline at end of file +var _0x430c=['field','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','createdAt','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','from','checkContactHopper','CmHopper','findOne','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','describe','update','uniqueid','body','find','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x208,\x201,\x20null','dropContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select'];(function(_0x2eb47c,_0x43bdf3){var _0x13097b=function(_0x1e6c94){while(--_0x1e6c94){_0x2eb47c['push'](_0x2eb47c['shift']());}};_0x13097b(++_0x43bdf3);}(_0x430c,0x1a1));var _0xc430=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0x430c[_0x364cf8];return _0x6a59ee;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':!![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['describe']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')]()[_0xc430('0x1e')](respondWithResult(_0x4eafae,null))['catch'](handleError(_0x4eafae,null));};exports[_0xc430('0x45')]=function(_0x2e7052,_0x19e563){if(_0x2e7052['body'][_0xc430('0x46')]){delete _0x2e7052[_0xc430('0x47')][_0xc430('0x46')];}return db[_0xc430('0x25')][_0xc430('0x48')]({'where':{'uniqueid':_0x2e7052[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19e563,null))['then'](saveUpdates(_0x2e7052[_0xc430('0x47')],null))[_0xc430('0x1e')](respondWithResult(_0x19e563,null))[_0xc430('0x40')](handleError(_0x19e563,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x23cb41,_0x4178d7,_0x2d064b){return db[_0xc430('0x25')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x23cb41[_0xc430('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x4e')))),_0xc430('0x4f')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x50')))),_0xc430('0x51')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc430('0x52')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x53')))),'dropContacts'],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x58')))),'answeringMachine']]})[_0xc430('0x1e')](handleEntityNotFound(_0x4178d7,null))[_0xc430('0x1e')](respondWithResult(_0x4178d7,null))[_0xc430('0x40')](handleError(_0x4178d7,null));};exports[_0xc430('0x59')]=function(_0x147062,_0x45eec6,_0x5d3393){return db[_0xc430('0x25')][_0xc430('0x3e')]({'raw':![],'where':{'CampaignId':_0x147062['params']['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4e')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x205,\x201,\x20null'))),_0xc430('0x51')],[db['sequelize']['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x5a')))),'congestionContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc430('0x5b')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x58')))),_0xc430('0x5c')]]})['then'](handleEntityNotFound(_0x45eec6,null))['then'](respondWithResult(_0x45eec6,null))[_0xc430('0x40')](handleError(_0x45eec6,null));};exports[_0xc430('0x5d')]=function(_0x31ae3c,_0x19c080,_0x256290){return db[_0xc430('0x5e')][_0xc430('0x48')]({'where':{'id':_0x31ae3c[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19c080,null))[_0xc430('0x1e')](function(_0x5ca0f2){var _0x6debfb;if(_0x5ca0f2){_0x6debfb=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery'](['phone',_0xc430('0x61'),_0xc430('0x62'),_0xc430('0x63'),_0xc430('0x64'),'createdAt',_0xc430('0x65')],squel[_0xc430('0x66')]()[_0xc430('0x67')]('ANY_VALUE(calleridnum)',_0xc430('0x68'))['field'](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),_0xc430('0x62'))['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x6c'),'VoiceQueueId')['field'](_0xc430('0x69'),'createdAt')['field'](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x6e'),_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())[_0xc430('0x34')]('state\x20=\x20?',_0x31ae3c[_0xc430('0x47')][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()['field'](_0xc430('0x68'))['from']('cm_hopper')[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id']['toString']()))[_0xc430('0x34')](_0xc430('0x71'),squel['select']()[_0xc430('0x67')](_0xc430('0x72'))['from'](_0xc430('0x6d'))[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())['where'](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x6debfb);}return[];})[_0xc430('0x1e')](respondWithResult(_0x19c080,null))[_0xc430('0x40')](handleError(_0x19c080,null));};exports[_0xc430('0x75')]=function(_0x19789f,_0x24b380,_0x4fe467){return db[_0xc430('0x76')][_0xc430('0x48')]({'where':{'id':_0x19789f[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x24b380,null))['then'](function(_0x150a8a){var _0x4edead;if(_0x150a8a){_0x4edead=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery']([_0xc430('0x68'),_0xc430('0x61'),_0xc430('0x62'),'ListId',_0xc430('0x77'),'createdAt','updatedAt'],squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x78'),'phone')[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),'ContactId')['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x79'),_0xc430('0x77'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x7a'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())['where'](_0xc430('0x7c'),_0x19789f['body'][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')](_0xc430('0x7d'))[_0xc430('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0xc430('0x7e')]('cm_hopper')['where'](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id'][_0xc430('0x6f')]()))[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x72'))[_0xc430('0x7e')](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())[_0xc430('0x34')](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x4edead);}return[];})[_0xc430('0x1e')](respondWithResult(_0x24b380,null))['catch'](handleError(_0x24b380,null));};exports[_0xc430('0x7f')]=function(_0x6e48a3,_0x5be78a,_0x3bd6e1){return db[_0xc430('0x80')][_0xc430('0x81')]({'where':{'VoiceQueueId':_0x6e48a3[_0xc430('0x47')]['VoiceQueueId'],'CampaignId':_0x6e48a3[_0xc430('0x47')]['CampaignId'],'ContactId':_0x6e48a3['body'][_0xc430('0x62')]}})[_0xc430('0x1e')](handleEntityNotFound(_0x5be78a,null))[_0xc430('0x1e')](function(_0x207067){if(_0x207067){return _0x207067;}return null;})[_0xc430('0x1e')](respondWithResult(_0x5be78a,null))[_0xc430('0x40')](handleError(_0x5be78a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 09fad50..5b61843 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 _0xa88f=['uniqueid','lodash','util','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x47c882,_0x8a92aa){var _0x205ede=function(_0x2bf8ae){while(--_0x2bf8ae){_0x47c882['push'](_0x47c882['shift']());}};_0x205ede(++_0x8a92aa);}(_0xa88f,0x1e1));var _0xfa88=function(_0x36f6b8,_0x9c05ef){_0x36f6b8=_0x36f6b8-0x0;var _0x341b4c=_0xa88f[_0x36f6b8];return _0x341b4c;};'use strict';var _=require(_0xfa88('0x0'));var util=require(_0xfa88('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfa88('0x2'));var rp=require(_0xfa88('0x3'));var fs=require('fs');var path=require(_0xfa88('0x4'));var rimraf=require(_0xfa88('0x5'));var config=require('../../config/environment');var attributes=require(_0xfa88('0x6'));module[_0xfa88('0x7')]=function(_0x46567b,_0x29afe2){return _0x46567b['define'](_0xfa88('0x8'),attributes,{'tableName':_0xfa88('0x9'),'paranoid':![],'indexes':[{'name':_0xfa88('0xa'),'fields':[_0xfa88('0xa')]},{'name':_0xfa88('0xb'),'fields':[_0xfa88('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc9d=['CmHopperFinal','calleridnum','util','../../config/logger','moment','bluebird','request-promise','rimraf','./cmHopperFinal.attributes','exports','define'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xdc9d,0xa7));var _0xddc9=function(_0x4e1b54,_0x55659f){_0x4e1b54=_0x4e1b54-0x0;var _0x46ee67=_0xdc9d[_0x4e1b54];return _0x46ee67;};'use strict';var _=require('lodash');var util=require(_0xddc9('0x0'));var logger=require(_0xddc9('0x1'))('api');var moment=require(_0xddc9('0x2'));var BPromise=require(_0xddc9('0x3'));var rp=require(_0xddc9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xddc9('0x5'));var config=require('../../config/environment');var attributes=require(_0xddc9('0x6'));module[_0xddc9('0x7')]=function(_0x5e7c66,_0x456a9f){return _0x5e7c66[_0xddc9('0x8')](_0xddc9('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xddc9('0xa'),'fields':[_0xddc9('0xa')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index cb0642e..e4bda7d 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x27fdab,_0x398484){var _0x3782b7=function(_0xe936e8){while(--_0xe936e8){_0x27fdab['push'](_0x27fdab['shift']());}};_0x3782b7(++_0x398484);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d0c0a,_0x569519){_0x3d0c0a=_0x3d0c0a-0x0;var _0x338e0e=_0xb10b[_0x3d0c0a];return _0x338e0e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x35ea31,_0x59be4c){var _0x19f1d0=function(_0x20b01d){while(--_0x20b01d){_0x35ea31['push'](_0x35ea31['shift']());}};_0x19f1d0(++_0x59be4c);}(_0x7a54,0x106));var _0x47a5=function(_0x565048,_0x356e90){_0x565048=_0x565048-0x0;var _0x12017f=_0x7a54[_0x565048];return _0x12017f;};'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 diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index ea32bde..3b20829 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 _0x283b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','index','get','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x283b,0x188));var _0xb283=function(_0x2993e4,_0x2af2db){_0x2993e4=_0x2993e4-0x0;var _0x4167b5=_0x283b[_0x2993e4];return _0x4167b5;};'use strict';var multer=require(_0xb283('0x0'));var util=require(_0xb283('0x1'));var path=require(_0xb283('0x2'));var timeout=require(_0xb283('0x3'));var express=require(_0xb283('0x4'));var router=express[_0xb283('0x5')]();var fs_extra=require(_0xb283('0x6'));var auth=require(_0xb283('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb283('0x8')]);router[_0xb283('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb283('0xa')]);router[_0xb283('0x9')](_0xb283('0xb'),auth[_0xb283('0xc')](),controller[_0xb283('0xd')]);router[_0xb283('0x9')](_0xb283('0xe'),auth[_0xb283('0xc')](),controller[_0xb283('0xf')]);router[_0xb283('0x9')](_0xb283('0x10'),auth[_0xb283('0xc')](),controller[_0xb283('0x11')]);router[_0xb283('0x12')](_0xb283('0x13'),auth[_0xb283('0xc')](),controller[_0xb283('0x14')]);router[_0xb283('0x12')](_0xb283('0x15'),auth['isAuthenticated'](),controller[_0xb283('0x16')]);router['post'](_0xb283('0x17'),auth[_0xb283('0xc')](),controller[_0xb283('0x18')]);router[_0xb283('0x19')](_0xb283('0xb'),auth[_0xb283('0xc')](),controller[_0xb283('0x1a')]);module[_0xb283('0x1b')]=router; \ No newline at end of file +var _0x2786=['exports','multer','util','path','express','Router','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','/describe','describe','get','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update'];(function(_0x467529,_0xe6e1ca){var _0x3be783=function(_0x401f88){while(--_0x401f88){_0x467529['push'](_0x467529['shift']());}};_0x3be783(++_0xe6e1ca);}(_0x2786,0xc1));var _0x6278=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2786[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x6278('0x0'));var util=require(_0x6278('0x1'));var path=require(_0x6278('0x2'));var timeout=require('connect-timeout');var express=require(_0x6278('0x3'));var router=express[_0x6278('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6278('0x5'));var controller=require(_0x6278('0x6'));router['get']('/',auth[_0x6278('0x7')](),controller[_0x6278('0x8')]);router['get'](_0x6278('0x9'),auth[_0x6278('0x7')](),controller[_0x6278('0xa')]);router[_0x6278('0xb')](_0x6278('0xc'),auth[_0x6278('0x7')](),controller[_0x6278('0xd')]);router[_0x6278('0xb')]('/voice/queue/countAttributes/:id',auth[_0x6278('0x7')](),controller[_0x6278('0xe')]);router[_0x6278('0xb')](_0x6278('0xf'),auth[_0x6278('0x7')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x6278('0x10')](_0x6278('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x6278('0x10')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0x6278('0x12')]);router['post'](_0x6278('0x13'),auth[_0x6278('0x7')](),controller[_0x6278('0x14')]);router[_0x6278('0x15')](_0x6278('0xc'),auth[_0x6278('0x7')](),controller[_0x6278('0x16')]);module[_0x6278('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 454de42..8dec9e8 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 _0x3e0c=['exports','INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x263a0a,_0x2aebeb){var _0x9fdcb=function(_0x335ae4){while(--_0x335ae4){_0x263a0a['push'](_0x263a0a['shift']());}};_0x9fdcb(++_0x2aebeb);}(_0x3e0c,0x16d));var _0xc3e0=function(_0x2a3982,_0x4b55ab){_0x2a3982=_0x2a3982-0x0;var _0x1a72c2=_0x3e0c[_0x2a3982];return _0x1a72c2;};'use strict';var Sequelize=require(_0xc3e0('0x0'));module[_0xc3e0('0x1')]={'state':{'type':Sequelize[_0xc3e0('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xc3e0('0x3')]},'countbusyretry':{'type':Sequelize[_0xc3e0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc3e0('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc3e0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc3e0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xc3e0('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xc3e0('0x3')]},'answertime':{'type':Sequelize[_0xc3e0('0x3')]},'droptime':{'type':Sequelize[_0xc3e0('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc3e0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc3e0('0x4')]},'campaign':{'type':Sequelize[_0xc3e0('0x4')]},'campaigntype':{'type':Sequelize[_0xc3e0('0x4')]},'membername':{'type':Sequelize[_0xc3e0('0x4')]},'reason':{'type':Sequelize[_0xc3e0('0x4')]},'amd':{'type':Sequelize[_0xc3e0('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xc3e0('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc3e0('0x3')]},'recallme':{'type':Sequelize[_0xc3e0('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xc3e0('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc3e0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc3e0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc3e0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc3e0('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc3e0('0x4')]}}; \ No newline at end of file +var _0x3301=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x54aff6,_0xc4c096){var _0x487a36=function(_0x332e3a){while(--_0x332e3a){_0x54aff6['push'](_0x54aff6['shift']());}};_0x487a36(++_0xc4c096);}(_0x3301,0x69));var _0x1330=function(_0x1ea3b9,_0x3c6b2c){_0x1ea3b9=_0x1ea3b9-0x0;var _0x206d41=_0x3301[_0x1ea3b9];return _0x206d41;};'use strict';var Sequelize=require(_0x1330('0x0'));module[_0x1330('0x1')]={'state':{'type':Sequelize[_0x1330('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1330('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1330('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1330('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1330('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x1330('0x4')]},'calleridnum':{'type':Sequelize[_0x1330('0x4')]},'calleridname':{'type':Sequelize[_0x1330('0x4')]},'starttime':{'type':Sequelize[_0x1330('0x3')]},'responsetime':{'type':Sequelize[_0x1330('0x3')]},'answertime':{'type':Sequelize[_0x1330('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x1330('0x3')]},'ringtime':{'type':Sequelize[_0x1330('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1330('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1330('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1330('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1330('0x4')]},'campaign':{'type':Sequelize[_0x1330('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1330('0x4')]},'reason':{'type':Sequelize[_0x1330('0x4')]},'amd':{'type':Sequelize[_0x1330('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x1330('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1330('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1330('0x3')]},'recallme':{'type':Sequelize[_0x1330('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1330('0x3')]},'edited':{'type':Sequelize[_0x1330('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1330('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1330('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1330('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1330('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1330('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 3678163..cd5ca2e 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 _0xf8cb=['limit','count','set','reject','save','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','include','CmHopperHistory','findAll','rows','catch','show','params','includeAll','options','find','create','body','describe','update','uniqueid','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x450d4e,_0xcacc3){var _0x300304=function(_0x49ab27){while(--_0x49ab27){_0x450d4e['push'](_0x450d4e['shift']());}};_0x300304(++_0xcacc3);}(_0xf8cb,0x71));var _0xbf8c=function(_0x5b490a,_0x58ad91){_0x5b490a=_0x5b490a-0x0;var _0x71482c=_0xf8cb[_0x5b490a];return _0x71482c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf8c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf8c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbf8c('0x2'));var Mustache=require(_0xbf8c('0x3'));var util=require(_0xbf8c('0x4'));var path=require(_0xbf8c('0x5'));var sox=require(_0xbf8c('0x6'));var csv=require(_0xbf8c('0x7'));var ejs=require(_0xbf8c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbf8c('0x9'));var crypto=require(_0xbf8c('0xa'));var jsforce=require(_0xbf8c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbf8c('0x7'));var querystring=require(_0xbf8c('0xc'));var Papa=require('papaparse');var Redis=require(_0xbf8c('0xd'));var authService=require(_0xbf8c('0xe'));var qs=require(_0xbf8c('0xf'));var as=require(_0xbf8c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf8c('0x11'))(_0xbf8c('0x12'));var utils=require(_0xbf8c('0x13'));var config=require(_0xbf8c('0x14'));var licenseUtil=require(_0xbf8c('0x15'));var db=require(_0xbf8c('0x16'))['db'];function respondWithStatusCode(_0x67f209,_0x1b1ca1){_0x1b1ca1=_0x1b1ca1||0xcc;return function(_0x2a4959){if(_0x2a4959){return _0x67f209['sendStatus'](_0x1b1ca1);}return _0x67f209[_0xbf8c('0x17')](_0x1b1ca1)[_0xbf8c('0x18')]();};}function respondWithResult(_0x5ba0bd,_0x106363){_0x106363=_0x106363||0xc8;return function(_0x33185b){if(_0x33185b){return _0x5ba0bd[_0xbf8c('0x17')](_0x106363)[_0xbf8c('0x19')](_0x33185b);}};}function respondWithFilteredResult(_0x4e42c0,_0x28ddf5){return function(_0xc4d57){if(_0xc4d57){var _0x2836a2=typeof _0x28ddf5[_0xbf8c('0x1a')]==='undefined'&&typeof _0x28ddf5[_0xbf8c('0x1b')]==='undefined';var _0xe6fb36=_0xc4d57[_0xbf8c('0x1c')];var _0x5a1fd3=_0x2836a2?0x0:_0x28ddf5[_0xbf8c('0x1a')];var _0x28e7ce=_0x2836a2?_0xc4d57['count']:_0x28ddf5['offset']+_0x28ddf5['limit'];var _0x2c9e2d;if(_0x28e7ce>=_0xe6fb36){_0x28e7ce=_0xe6fb36;_0x2c9e2d=0xc8;}else{_0x2c9e2d=0xce;}_0x4e42c0['status'](_0x2c9e2d);return _0x4e42c0[_0xbf8c('0x1d')]('Content-Range',_0x5a1fd3+'-'+_0x28e7ce+'/'+_0xe6fb36)[_0xbf8c('0x19')](_0xc4d57);}return null;};}function patchUpdates(_0x502f1a){return function(_0x2c8931){try{jsonpatch['apply'](_0x2c8931,_0x502f1a,!![]);}catch(_0x2768e0){return BPromise[_0xbf8c('0x1e')](_0x2768e0);}return _0x2c8931[_0xbf8c('0x1f')]();};}function saveUpdates(_0x210b4d,_0x24ed67){return function(_0x17845e){if(_0x17845e){return _0x17845e['update'](_0x210b4d)[_0xbf8c('0x20')](function(_0x3f939d){return _0x3f939d;});}return null;};}function removeEntity(_0x4c55eb,_0x54b62c){return function(_0x4fe1e9){if(_0x4fe1e9){return _0x4fe1e9[_0xbf8c('0x21')]()[_0xbf8c('0x20')](function(){_0x4c55eb[_0xbf8c('0x17')](0xcc)[_0xbf8c('0x18')]();});}};}function handleEntityNotFound(_0x32506e,_0x51d962){return function(_0x35317c){if(!_0x35317c){_0x32506e['sendStatus'](0x194);}return _0x35317c;};}function handleError(_0x3597fa,_0x280d4e){_0x280d4e=_0x280d4e||0x1f4;return function(_0x801fd4){logger['error'](_0x801fd4[_0xbf8c('0x22')]);if(_0x801fd4[_0xbf8c('0x23')]){delete _0x801fd4[_0xbf8c('0x23')];}_0x3597fa[_0xbf8c('0x17')](_0x280d4e)['send'](_0x801fd4);};}exports['index']=function(_0x340401,_0x10c1d6){var _0x2ddaed={},_0x2f32b7={},_0x1c1b07={'count':0x0,'rows':[]};var _0xe6ec4a=_[_0xbf8c('0x24')](db['CmHopperHistory'][_0xbf8c('0x25')],function(_0x145117){return{'name':_0x145117[_0xbf8c('0x26')],'type':_0x145117[_0xbf8c('0x27')][_0xbf8c('0x28')]};});_0x2f32b7[_0xbf8c('0x29')]=_['map'](_0xe6ec4a,_0xbf8c('0x23'));_0x2f32b7[_0xbf8c('0x2a')]=_[_0xbf8c('0x2b')](_0x340401['query']);_0x2f32b7[_0xbf8c('0x2c')]=_[_0xbf8c('0x2d')](_0x2f32b7[_0xbf8c('0x29')],_0x2f32b7['query']);_0x2ddaed[_0xbf8c('0x2e')]=_['intersection'](_0x2f32b7[_0xbf8c('0x29')],qs[_0xbf8c('0x2f')](_0x340401[_0xbf8c('0x2a')][_0xbf8c('0x2f')]));_0x2ddaed['attributes']=_0x2ddaed[_0xbf8c('0x2e')][_0xbf8c('0x30')]?_0x2ddaed[_0xbf8c('0x2e')]:_0x2f32b7[_0xbf8c('0x29')];if(!_0x340401[_0xbf8c('0x2a')][_0xbf8c('0x31')](_0xbf8c('0x32'))){_0x2ddaed[_0xbf8c('0x1b')]=qs[_0xbf8c('0x1b')](_0x340401[_0xbf8c('0x2a')][_0xbf8c('0x1b')]);_0x2ddaed[_0xbf8c('0x1a')]=qs['offset'](_0x340401[_0xbf8c('0x2a')]['offset']);}_0x2ddaed['order']=qs[_0xbf8c('0x33')](_0x340401['query'][_0xbf8c('0x33')]);_0x2ddaed[_0xbf8c('0x34')]=qs[_0xbf8c('0x2c')](_[_0xbf8c('0x35')](_0x340401[_0xbf8c('0x2a')],_0x2f32b7[_0xbf8c('0x2c')]),_0xe6ec4a);if(_0x340401[_0xbf8c('0x2a')]['filter']){_0x2ddaed[_0xbf8c('0x34')]=_['merge'](_0x2ddaed[_0xbf8c('0x34')],{'$or':_[_0xbf8c('0x24')](_0xe6ec4a,function(_0x1cdbe2){if(_0x1cdbe2[_0xbf8c('0x27')]!==_0xbf8c('0x36')){var _0x3df3ca={};_0x3df3ca[_0x1cdbe2[_0xbf8c('0x23')]]={'$like':'%'+_0x340401[_0xbf8c('0x2a')]['filter']+'%'};return _0x3df3ca;}})});}_0x2ddaed=_['merge']({},_0x2ddaed,_0x340401['options']);var _0x226520={'where':_0x2ddaed[_0xbf8c('0x34')]};return db['CmHopperHistory'][_0xbf8c('0x1c')](_0x226520)[_0xbf8c('0x20')](function(_0x5a759e){_0x1c1b07[_0xbf8c('0x1c')]=_0x5a759e;if(_0x340401[_0xbf8c('0x2a')]['includeAll']){_0x2ddaed[_0xbf8c('0x37')]=[{'all':!![]}];}return db[_0xbf8c('0x38')][_0xbf8c('0x39')](_0x2ddaed);})[_0xbf8c('0x20')](function(_0x20375b){_0x1c1b07[_0xbf8c('0x3a')]=_0x20375b;return _0x1c1b07;})[_0xbf8c('0x20')](respondWithFilteredResult(_0x10c1d6,_0x2ddaed))[_0xbf8c('0x3b')](handleError(_0x10c1d6,null));};exports[_0xbf8c('0x3c')]=function(_0x50f565,_0x114835){var _0x22365f={'raw':!![],'where':{'id':_0x50f565[_0xbf8c('0x3d')]['id']}},_0x9c99be={};_0x9c99be[_0xbf8c('0x29')]=_[_0xbf8c('0x2b')](db[_0xbf8c('0x38')][_0xbf8c('0x25')]);_0x9c99be[_0xbf8c('0x2a')]=_[_0xbf8c('0x2b')](_0x50f565[_0xbf8c('0x2a')]);_0x9c99be['filters']=_['intersection'](_0x9c99be[_0xbf8c('0x29')],_0x9c99be[_0xbf8c('0x2a')]);_0x22365f[_0xbf8c('0x2e')]=_['intersection'](_0x9c99be[_0xbf8c('0x29')],qs[_0xbf8c('0x2f')](_0x50f565['query'][_0xbf8c('0x2f')]));_0x22365f[_0xbf8c('0x2e')]=_0x22365f[_0xbf8c('0x2e')][_0xbf8c('0x30')]?_0x22365f[_0xbf8c('0x2e')]:_0x9c99be[_0xbf8c('0x29')];if(_0x50f565[_0xbf8c('0x2a')][_0xbf8c('0x3e')]){_0x22365f[_0xbf8c('0x37')]=[{'all':!![]}];}_0x22365f=_['merge']({},_0x22365f,_0x50f565[_0xbf8c('0x3f')]);return db['CmHopperHistory'][_0xbf8c('0x40')](_0x22365f)[_0xbf8c('0x20')](handleEntityNotFound(_0x114835,null))[_0xbf8c('0x20')](respondWithResult(_0x114835,null))['catch'](handleError(_0x114835,null));};exports['create']=function(_0x53a7dc,_0xa8577f){return db['CmHopperHistory'][_0xbf8c('0x41')](_0x53a7dc[_0xbf8c('0x42')],{})[_0xbf8c('0x20')](respondWithResult(_0xa8577f,0xc9))[_0xbf8c('0x3b')](handleError(_0xa8577f,null));};exports['describe']=function(_0x5d74a2,_0x49a01c){return db[_0xbf8c('0x38')][_0xbf8c('0x43')]()[_0xbf8c('0x20')](respondWithResult(_0x49a01c,null))[_0xbf8c('0x3b')](handleError(_0x49a01c,null));};exports[_0xbf8c('0x44')]=function(_0x1eaa20,_0xd5313f){if(_0x1eaa20[_0xbf8c('0x42')]['uniqueid']){delete _0x1eaa20['body'][_0xbf8c('0x45')];}return db[_0xbf8c('0x38')]['find']({'where':{'uniqueid':_0x1eaa20['params']['id']}})[_0xbf8c('0x20')](handleEntityNotFound(_0xd5313f,null))[_0xbf8c('0x20')](saveUpdates(_0x1eaa20[_0xbf8c('0x42')],null))[_0xbf8c('0x20')](respondWithResult(_0xd5313f,null))[_0xbf8c('0x3b')](handleError(_0xd5313f,null));}; \ No newline at end of file +var _0x0575=['limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','CmHopperHistory','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','create','body','describe','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0xe49991,_0x347b6b){var _0x291433=function(_0x4c54a9){while(--_0x4c54a9){_0xe49991['push'](_0xe49991['shift']());}};_0x291433(++_0x347b6b);}(_0x0575,0x1a1));var _0x5057=function(_0x237e2e,_0x1931f4){_0x237e2e=_0x237e2e-0x0;var _0x4c124d=_0x0575[_0x237e2e];return _0x4c124d;};'use strict';var emlformat=require(_0x5057('0x0'));var rimraf=require(_0x5057('0x1'));var zipdir=require(_0x5057('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5057('0x3'));var moment=require('moment');var BPromise=require(_0x5057('0x4'));var Mustache=require(_0x5057('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5057('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5057('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5057('0x8'));var jsforce=require(_0x5057('0x9'));var deskjs=require(_0x5057('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5057('0xb'));var Papa=require(_0x5057('0xc'));var Redis=require('ioredis');var authService=require(_0x5057('0xd'));var qs=require(_0x5057('0xe'));var as=require(_0x5057('0xf'));var hardwareService=require(_0x5057('0x10'));var logger=require(_0x5057('0x11'))(_0x5057('0x12'));var utils=require(_0x5057('0x13'));var config=require(_0x5057('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5057('0x15'))['db'];function respondWithStatusCode(_0xe6c1ee,_0x35317b){_0x35317b=_0x35317b||0xcc;return function(_0x256bc1){if(_0x256bc1){return _0xe6c1ee[_0x5057('0x16')](_0x35317b);}return _0xe6c1ee[_0x5057('0x17')](_0x35317b)['end']();};}function respondWithResult(_0x4e649a,_0xe6e5bd){_0xe6e5bd=_0xe6e5bd||0xc8;return function(_0x4cf4fb){if(_0x4cf4fb){return _0x4e649a[_0x5057('0x17')](_0xe6e5bd)[_0x5057('0x18')](_0x4cf4fb);}};}function respondWithFilteredResult(_0x8eb21e,_0x1d0cd9){return function(_0x7b5ea5){if(_0x7b5ea5){var _0x9fbe8a=typeof _0x1d0cd9[_0x5057('0x19')]===_0x5057('0x1a')&&typeof _0x1d0cd9[_0x5057('0x1b')]===_0x5057('0x1a');var _0x44ec57=_0x7b5ea5[_0x5057('0x1c')];var _0x1e6514=_0x9fbe8a?0x0:_0x1d0cd9[_0x5057('0x19')];var _0x43ade9=_0x9fbe8a?_0x7b5ea5[_0x5057('0x1c')]:_0x1d0cd9[_0x5057('0x19')]+_0x1d0cd9[_0x5057('0x1b')];var _0x50231f;if(_0x43ade9>=_0x44ec57){_0x43ade9=_0x44ec57;_0x50231f=0xc8;}else{_0x50231f=0xce;}_0x8eb21e[_0x5057('0x17')](_0x50231f);return _0x8eb21e[_0x5057('0x1d')](_0x5057('0x1e'),_0x1e6514+'-'+_0x43ade9+'/'+_0x44ec57)['json'](_0x7b5ea5);}return null;};}function patchUpdates(_0x531acd){return function(_0x4a1e1a){try{jsonpatch[_0x5057('0x1f')](_0x4a1e1a,_0x531acd,!![]);}catch(_0x3ed515){return BPromise[_0x5057('0x20')](_0x3ed515);}return _0x4a1e1a['save']();};}function saveUpdates(_0x6f1e1c,_0x41c84f){return function(_0x5826aa){if(_0x5826aa){return _0x5826aa[_0x5057('0x21')](_0x6f1e1c)['then'](function(_0x191cdb){return _0x191cdb;});}return null;};}function removeEntity(_0xb73e20,_0x5c41e2){return function(_0xc33d4c){if(_0xc33d4c){return _0xc33d4c[_0x5057('0x22')]()[_0x5057('0x23')](function(){_0xb73e20[_0x5057('0x17')](0xcc)[_0x5057('0x24')]();});}};}function handleEntityNotFound(_0x4978a7,_0x3108cc){return function(_0x865888){if(!_0x865888){_0x4978a7[_0x5057('0x16')](0x194);}return _0x865888;};}function handleError(_0x3ba0c4,_0x413b2e){_0x413b2e=_0x413b2e||0x1f4;return function(_0x351721){logger[_0x5057('0x25')](_0x351721[_0x5057('0x26')]);if(_0x351721['name']){delete _0x351721[_0x5057('0x27')];}_0x3ba0c4['status'](_0x413b2e)[_0x5057('0x28')](_0x351721);};}exports['index']=function(_0x4e1bce,_0x550e68){var _0x2d4524={},_0x55c3ea={},_0x3dc2b9={'count':0x0,'rows':[]};var _0x345237=_['map'](db[_0x5057('0x29')]['rawAttributes'],function(_0x420231){return{'name':_0x420231[_0x5057('0x2a')],'type':_0x420231[_0x5057('0x2b')][_0x5057('0x2c')]};});_0x55c3ea[_0x5057('0x2d')]=_[_0x5057('0x2e')](_0x345237,_0x5057('0x27'));_0x55c3ea['query']=_['keys'](_0x4e1bce[_0x5057('0x2f')]);_0x55c3ea['filters']=_['intersection'](_0x55c3ea[_0x5057('0x2d')],_0x55c3ea['query']);_0x2d4524[_0x5057('0x30')]=_[_0x5057('0x31')](_0x55c3ea[_0x5057('0x2d')],qs[_0x5057('0x32')](_0x4e1bce['query']['fields']));_0x2d4524[_0x5057('0x30')]=_0x2d4524[_0x5057('0x30')][_0x5057('0x33')]?_0x2d4524['attributes']:_0x55c3ea[_0x5057('0x2d')];if(!_0x4e1bce[_0x5057('0x2f')][_0x5057('0x34')](_0x5057('0x35'))){_0x2d4524[_0x5057('0x1b')]=qs[_0x5057('0x1b')](_0x4e1bce[_0x5057('0x2f')][_0x5057('0x1b')]);_0x2d4524[_0x5057('0x19')]=qs[_0x5057('0x19')](_0x4e1bce[_0x5057('0x2f')][_0x5057('0x19')]);}_0x2d4524['order']=qs[_0x5057('0x36')](_0x4e1bce[_0x5057('0x2f')][_0x5057('0x36')]);_0x2d4524[_0x5057('0x37')]=qs[_0x5057('0x38')](_[_0x5057('0x39')](_0x4e1bce[_0x5057('0x2f')],_0x55c3ea[_0x5057('0x38')]),_0x345237);if(_0x4e1bce[_0x5057('0x2f')][_0x5057('0x3a')]){_0x2d4524[_0x5057('0x37')]=_[_0x5057('0x3b')](_0x2d4524[_0x5057('0x37')],{'$or':_['map'](_0x345237,function(_0x3a32dd){if(_0x3a32dd['type']!==_0x5057('0x3c')){var _0x33cc3d={};_0x33cc3d[_0x3a32dd[_0x5057('0x27')]]={'$like':'%'+_0x4e1bce['query'][_0x5057('0x3a')]+'%'};return _0x33cc3d;}})});}_0x2d4524=_[_0x5057('0x3b')]({},_0x2d4524,_0x4e1bce[_0x5057('0x3d')]);var _0x5901eb={'where':_0x2d4524[_0x5057('0x37')]};return db['CmHopperHistory'][_0x5057('0x1c')](_0x5901eb)['then'](function(_0x5b79d1){_0x3dc2b9[_0x5057('0x1c')]=_0x5b79d1;if(_0x4e1bce[_0x5057('0x2f')][_0x5057('0x3e')]){_0x2d4524['include']=[{'all':!![]}];}return db[_0x5057('0x29')][_0x5057('0x3f')](_0x2d4524);})[_0x5057('0x23')](function(_0x167736){_0x3dc2b9[_0x5057('0x40')]=_0x167736;return _0x3dc2b9;})[_0x5057('0x23')](respondWithFilteredResult(_0x550e68,_0x2d4524))[_0x5057('0x41')](handleError(_0x550e68,null));};exports[_0x5057('0x42')]=function(_0x1078db,_0x323515){var _0x4eda53={'raw':!![],'where':{'id':_0x1078db[_0x5057('0x43')]['id']}},_0x27b379={};_0x27b379[_0x5057('0x2d')]=_[_0x5057('0x44')](db[_0x5057('0x29')][_0x5057('0x45')]);_0x27b379[_0x5057('0x2f')]=_[_0x5057('0x44')](_0x1078db['query']);_0x27b379['filters']=_['intersection'](_0x27b379['model'],_0x27b379['query']);_0x4eda53[_0x5057('0x30')]=_[_0x5057('0x31')](_0x27b379[_0x5057('0x2d')],qs[_0x5057('0x32')](_0x1078db['query']['fields']));_0x4eda53[_0x5057('0x30')]=_0x4eda53[_0x5057('0x30')][_0x5057('0x33')]?_0x4eda53['attributes']:_0x27b379[_0x5057('0x2d')];if(_0x1078db[_0x5057('0x2f')][_0x5057('0x3e')]){_0x4eda53['include']=[{'all':!![]}];}_0x4eda53=_['merge']({},_0x4eda53,_0x1078db[_0x5057('0x3d')]);return db['CmHopperHistory']['find'](_0x4eda53)['then'](handleEntityNotFound(_0x323515,null))[_0x5057('0x23')](respondWithResult(_0x323515,null))[_0x5057('0x41')](handleError(_0x323515,null));};exports[_0x5057('0x46')]=function(_0x468aa4,_0x49b4e8){return db[_0x5057('0x29')][_0x5057('0x46')](_0x468aa4[_0x5057('0x47')],{})[_0x5057('0x23')](respondWithResult(_0x49b4e8,0xc9))[_0x5057('0x41')](handleError(_0x49b4e8,null));};exports['describe']=function(_0x3d5ca0,_0x576c92){return db[_0x5057('0x29')][_0x5057('0x48')]()[_0x5057('0x23')](respondWithResult(_0x576c92,null))[_0x5057('0x41')](handleError(_0x576c92,null));};exports[_0x5057('0x21')]=function(_0x140062,_0x1cde3b){if(_0x140062[_0x5057('0x47')]['uniqueid']){delete _0x140062[_0x5057('0x47')]['uniqueid'];}return db[_0x5057('0x29')][_0x5057('0x49')]({'where':{'uniqueid':_0x140062[_0x5057('0x43')]['id']}})[_0x5057('0x23')](handleEntityNotFound(_0x1cde3b,null))['then'](saveUpdates(_0x140062[_0x5057('0x47')],null))[_0x5057('0x23')](respondWithResult(_0x1cde3b,null))[_0x5057('0x41')](handleError(_0x1cde3b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 1b4f0d5..07169d6 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 _0xd1d3=['rimraf','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x3f0a9b,_0x1f2b9b){_0x3f0a9b=_0x3f0a9b-0x0;var _0xb989a0=_0xd1d3[_0x3f0a9b];return _0xb989a0;};'use strict';var _=require(_0x3d1d('0x0'));var util=require('util');var logger=require(_0x3d1d('0x1'))('api');var moment=require(_0x3d1d('0x2'));var BPromise=require(_0x3d1d('0x3'));var rp=require(_0x3d1d('0x4'));var fs=require('fs');var path=require(_0x3d1d('0x5'));var rimraf=require(_0x3d1d('0x6'));var config=require('../../config/environment');var attributes=require(_0x3d1d('0x7'));module[_0x3d1d('0x8')]=function(_0x55c165,_0x2d3a52){return _0x55c165[_0x3d1d('0x9')]('CmHopperHistory',attributes,{'tableName':_0x3d1d('0xa'),'paranoid':![],'indexes':[{'name':_0x3d1d('0xb'),'fields':[_0x3d1d('0xb')]},{'name':_0x3d1d('0xc'),'fields':[_0x3d1d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1893=['rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x1893,0xa2));var _0x3189=function(_0x6fcc6e,_0x5d1c4e){_0x6fcc6e=_0x6fcc6e-0x0;var _0x234cee=_0x1893[_0x6fcc6e];return _0x234cee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));module[_0x3189('0x8')]=function(_0x2333e6,_0x4080a9){return _0x2333e6[_0x3189('0x9')](_0x3189('0xa'),attributes,{'tableName':_0x3189('0xb'),'paranoid':![],'indexes':[{'name':_0x3189('0xc'),'fields':['endtime']},{'name':_0x3189('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 72dbad1..8745090 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 _0x876b=['predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','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','campaign','GetCampaignHopperHistory','ivrAnswerCallsDay','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','then','AvgHandleTime','findAll','where','COUNT','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null'];(function(_0x462224,_0x308a88){var _0x6839bc=function(_0x1ac2c2){while(--_0x1ac2c2){_0x462224['push'](_0x462224['shift']());}};_0x6839bc(++_0x308a88);}(_0x876b,0x1ba));var _0xb876=function(_0x296236,_0x224e5d){_0x296236=_0x296236-0x0;var _0x3c17f4=_0x876b[_0x296236];return _0x3c17f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb876('0x0'));var BPromise=require(_0xb876('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb876('0x2'))['db'];var utils=require(_0xb876('0x3'));var logger=require('../../config/logger')(_0xb876('0x4'));var config=require(_0xb876('0x5'));var jayson=require(_0xb876('0x6'));var client=jayson['client'][_0xb876('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4353cf,_0x4b2634,_0x309bfd){return new BPromise(function(_0xcbf343,_0x1a79d3){return client[_0xb876('0x8')](_0x4353cf,_0x309bfd)['then'](function(_0x45bd6f){logger['info'](_0xb876('0x9'),_0x4b2634,_0xb876('0xa'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4b2634,'request\x20sent',JSON[_0xb876('0xb')](_0x45bd6f));if(_0x45bd6f['error']){if(_0x45bd6f[_0xb876('0xc')][_0xb876('0xd')]===0x1f4){logger['error'](_0xb876('0x9'),_0x4b2634,_0x45bd6f[_0xb876('0xc')][_0xb876('0xe')]);return _0x1a79d3(_0x45bd6f[_0xb876('0xc')][_0xb876('0xe')]);}logger[_0xb876('0xc')](_0xb876('0x9'),_0x4b2634,_0x45bd6f[_0xb876('0xc')][_0xb876('0xe')]);return _0xcbf343(_0x45bd6f[_0xb876('0xc')][_0xb876('0xe')]);}else{logger[_0xb876('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x4b2634,_0xb876('0xa'));_0xcbf343(_0x45bd6f[_0xb876('0x10')][_0xb876('0xe')]);}})[_0xb876('0x11')](function(_0x2c7ad2){logger[_0xb876('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x4b2634,_0x2c7ad2);_0x1a79d3(_0x2c7ad2);});});}exports[_0xb876('0x12')]=function(_0x3da83a){var _0x4e2048=this;return new Promise(function(_0x5eb24a,_0x1e3561){return db[_0xb876('0x13')][_0xb876('0x14')](_0x3da83a['body'],{'raw':_0x3da83a[_0xb876('0x15')]?_0x3da83a[_0xb876('0x15')][_0xb876('0x16')]===undefined?!![]:![]:!![]})[_0xb876('0x17')](function(_0x10b085){logger['info']('CreateCmHopperHistory',_0x3da83a);logger['debug'](_0xb876('0x12'),_0x3da83a,JSON[_0xb876('0xb')](_0x10b085));_0x5eb24a(_0x10b085);})[_0xb876('0x11')](function(_0x115f17){logger['error'](_0xb876('0x12'),_0x115f17[_0xb876('0xe')],_0x3da83a);_0x1e3561(_0x4e2048[_0xb876('0xc')](0x1f4,_0x115f17[_0xb876('0xe')]));});});};exports[_0xb876('0x18')]=function(_0x351dc3){var _0x183e7e=this;return new Promise(function(_0x43d94a,_0x3589db){return db[_0xb876('0x13')][_0xb876('0x19')]({'raw':_0x351dc3[_0xb876('0x15')]?_0x351dc3[_0xb876('0x15')][_0xb876('0x16')]===undefined?!![]:![]:!![],'where':_0x351dc3[_0xb876('0x15')]?_0x351dc3[_0xb876('0x15')][_0xb876('0x1a')]||null:null,'attributes':[[db['sequelize']['fn'](_0xb876('0x1b'),db[_0xb876('0x1c')][_0xb876('0x1d')]('id')),'predictiveIntervalTotalCalls'],[db[_0xb876('0x1c')]['fn'](_0xb876('0x1b'),db[_0xb876('0x1c')]['fn']('IF',db['sequelize'][_0xb876('0x1e')](_0xb876('0x1f')))),'predictiveIntervalAnsweredCalls'],[db[_0xb876('0x1c')]['fn']('COUNT',db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')][_0xb876('0x1e')](_0xb876('0x20')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xb876('0x1c')]['fn'](_0xb876('0x1b'),db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')][_0xb876('0x1e')](_0xb876('0x21')))),_0xb876('0x22')],[db['sequelize']['fn'](_0xb876('0x23'),db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xb876('0x24')],[db[_0xb876('0x1c')]['fn'](_0xb876('0x23'),db['sequelize']['fn']('IF',db[_0xb876('0x1c')]['literal'](_0xb876('0x25')))),_0xb876('0x26')]]})[_0xb876('0x17')](function(_0x5a0c8d){logger[_0xb876('0xf')](_0xb876('0x18'),_0x351dc3);logger[_0xb876('0x27')](_0xb876('0x18'),_0x351dc3,JSON[_0xb876('0xb')](_0x5a0c8d));_0x43d94a(_0x5a0c8d);})[_0xb876('0x11')](function(_0x36fef8){logger[_0xb876('0xc')]('AvgHandleTime',_0x36fef8['message'],_0x351dc3);_0x3589db(_0x183e7e[_0xb876('0xc')](0x1f4,_0x36fef8[_0xb876('0xe')]));});});};exports[_0xb876('0x28')]=function(_0x2371de){var _0x5e50ee=this;return new Promise(function(_0x3c644b,_0x3d162c){return db[_0xb876('0x13')][_0xb876('0x19')]({'raw':_0x2371de[_0xb876('0x15')]?_0x2371de[_0xb876('0x15')][_0xb876('0x16')]===undefined?!![]:![]:!![],'where':_0x2371de[_0xb876('0x15')]?_0x2371de['options'][_0xb876('0x1a')]||null:null,'attributes':[['campaign',_0xb876('0x29')],[db[_0xb876('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb876('0x1c')]['literal'](_0xb876('0x2a')))),_0xb876('0x2b')],[db[_0xb876('0x1c')]['fn'](_0xb876('0x1b'),db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')][_0xb876('0x1e')](_0xb876('0x2c')))),_0xb876('0x2d')],[db[_0xb876('0x1c')]['fn'](_0xb876('0x1b'),db['sequelize']['fn']('IF',db[_0xb876('0x1c')]['literal'](_0xb876('0x1f')))),'outboundAnswerCallsDay'],[db[_0xb876('0x1c')]['fn'](_0xb876('0x1b'),db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')][_0xb876('0x1e')](_0xb876('0x2e')))),_0xb876('0x2f')],[db[_0xb876('0x1c')]['fn'](_0xb876('0x1b'),db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')]['literal'](_0xb876('0x30')))),_0xb876('0x31')],[db[_0xb876('0x1c')]['fn']('COUNT',db[_0xb876('0x1c')]['fn']('IF',db['sequelize'][_0xb876('0x1e')](_0xb876('0x32')))),_0xb876('0x33')],[db['sequelize']['fn'](_0xb876('0x1b'),db['sequelize']['fn']('IF',db[_0xb876('0x1c')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb876('0x34')],[db[_0xb876('0x1c')]['fn']('COUNT',db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')][_0xb876('0x1e')]('`state`\x20=\x2012,\x201,\x20null'))),_0xb876('0x35')],[db[_0xb876('0x1c')]['fn'](_0xb876('0x1b'),db['sequelize']['fn']('IF',db[_0xb876('0x1c')]['literal'](_0xb876('0x36')))),_0xb876('0x37')],[db['sequelize']['fn'](_0xb876('0x1b'),db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')][_0xb876('0x1e')](_0xb876('0x38')))),_0xb876('0x39')],[db[_0xb876('0x1c')]['fn'](_0xb876('0x1b'),db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')][_0xb876('0x1e')](_0xb876('0x3a')))),_0xb876('0x3b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb876('0x1c')][_0xb876('0x1e')](_0xb876('0x3c')))),_0xb876('0x3d')],[db[_0xb876('0x1c')]['fn'](_0xb876('0x1b'),db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')]['literal'](_0xb876('0x3e')))),_0xb876('0x3b')],[db[_0xb876('0x1c')]['fn'](_0xb876('0x1b'),db['sequelize']['fn']('IF',db[_0xb876('0x1c')][_0xb876('0x1e')](_0xb876('0x3f')))),_0xb876('0x40')]],'group':[_0xb876('0x41')]})[_0xb876('0x17')](function(_0x4e683d){logger['info'](_0xb876('0x28'),_0x2371de);logger[_0xb876('0x27')](_0xb876('0x28'),_0x2371de,JSON[_0xb876('0xb')](_0x4e683d));_0x3c644b(_0x4e683d);})[_0xb876('0x11')](function(_0x5cd816){logger[_0xb876('0xc')](_0xb876('0x28'),_0x5cd816[_0xb876('0xe')],_0x2371de);_0x3d162c(_0x5e50ee[_0xb876('0xc')](0x1f4,_0x5cd816[_0xb876('0xe')]));});});};exports[_0xb876('0x42')]=function(_0x5cf321){var _0x1ce34b=this;return new Promise(function(_0x2ceaeb,_0x45f543){return db[_0xb876('0x13')][_0xb876('0x19')]({'raw':_0x5cf321[_0xb876('0x15')]?_0x5cf321[_0xb876('0x15')][_0xb876('0x16')]===undefined?!![]:![]:!![],'where':_0x5cf321[_0xb876('0x15')]?_0x5cf321[_0xb876('0x15')][_0xb876('0x1a')]||null:null,'attributes':[[_0xb876('0x41'),_0xb876('0x29')],[db['sequelize']['fn'](_0xb876('0x1b'),db[_0xb876('0x1c')][_0xb876('0x1d')]('id')),'ivrTotalCallsDays'],[db[_0xb876('0x1c')]['fn']('COUNT',db[_0xb876('0x1c')]['fn']('IF',db[_0xb876('0x1c')][_0xb876('0x1e')](_0xb876('0x1f')))),_0xb876('0x43')]],'group':[_0xb876('0x41')]})[_0xb876('0x17')](function(_0x3e3ab7){logger[_0xb876('0xf')](_0xb876('0x42'),_0x5cf321);logger['debug'](_0xb876('0x42'),_0x5cf321,JSON[_0xb876('0xb')](_0x3e3ab7));_0x2ceaeb(_0x3e3ab7);})['catch'](function(_0x5cb8c4){logger[_0xb876('0xc')]('GetCampaignHopperHistory',_0x5cb8c4[_0xb876('0xe')],_0x5cf321);_0x45f543(_0x1ce34b[_0xb876('0xc')](0x1f4,_0x5cb8c4[_0xb876('0xe')]));});});}; \ No newline at end of file +var _0x88f5=['sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','stringify','GetCampaignHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','then','AvgHandleTime','findAll','raw'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x88f5,0x79));var _0x588f=function(_0x46df46,_0x52e174){_0x46df46=_0x46df46-0x0;var _0x9e13a3=_0x88f5[_0x46df46];return _0x9e13a3;};'use strict';var _=require(_0x588f('0x0'));var util=require(_0x588f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x588f('0x2'));var fs=require('fs');var Redis=require(_0x588f('0x3'));var db=require(_0x588f('0x4'))['db'];var utils=require(_0x588f('0x5'));var logger=require('../../config/logger')(_0x588f('0x6'));var config=require(_0x588f('0x7'));var jayson=require(_0x588f('0x8'));var client=jayson[_0x588f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dcc66,_0x1eb086,_0x34d057){return new BPromise(function(_0x2e63ca,_0x15b45a){return client[_0x588f('0xa')](_0x3dcc66,_0x34d057)['then'](function(_0x389128){logger[_0x588f('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x1eb086,'request\x20sent');logger[_0x588f('0xc')](_0x588f('0xd'),_0x1eb086,_0x588f('0xe'),JSON['stringify'](_0x389128));if(_0x389128[_0x588f('0xf')]){if(_0x389128['error'][_0x588f('0x10')]===0x1f4){logger[_0x588f('0xf')](_0x588f('0x11'),_0x1eb086,_0x389128[_0x588f('0xf')][_0x588f('0x12')]);return _0x15b45a(_0x389128['error'][_0x588f('0x12')]);}logger[_0x588f('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x1eb086,_0x389128[_0x588f('0xf')][_0x588f('0x12')]);return _0x2e63ca(_0x389128[_0x588f('0xf')]['message']);}else{logger[_0x588f('0xb')](_0x588f('0x11'),_0x1eb086,'request\x20sent');_0x2e63ca(_0x389128[_0x588f('0x13')][_0x588f('0x12')]);}})[_0x588f('0x14')](function(_0x2fe759){logger[_0x588f('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x1eb086,_0x2fe759);_0x15b45a(_0x2fe759);});});}exports[_0x588f('0x15')]=function(_0x1a1fac){var _0x3aa544=this;return new Promise(function(_0x140814,_0x5589ce){return db[_0x588f('0x16')]['create'](_0x1a1fac[_0x588f('0x17')],{'raw':_0x1a1fac[_0x588f('0x18')]?_0x1a1fac['options']['raw']===undefined?!![]:![]:!![]})[_0x588f('0x19')](function(_0x433ab3){logger[_0x588f('0xb')](_0x588f('0x15'),_0x1a1fac);logger[_0x588f('0xc')](_0x588f('0x15'),_0x1a1fac,JSON['stringify'](_0x433ab3));_0x140814(_0x433ab3);})[_0x588f('0x14')](function(_0x360475){logger['error'](_0x588f('0x15'),_0x360475['message'],_0x1a1fac);_0x5589ce(_0x3aa544[_0x588f('0xf')](0x1f4,_0x360475[_0x588f('0x12')]));});});};exports[_0x588f('0x1a')]=function(_0xe96914){var _0x534aa8=this;return new Promise(function(_0x153213,_0x16c6a9){return db[_0x588f('0x16')][_0x588f('0x1b')]({'raw':_0xe96914['options']?_0xe96914['options'][_0x588f('0x1c')]===undefined?!![]:![]:!![],'where':_0xe96914[_0x588f('0x18')]?_0xe96914[_0x588f('0x18')]['where']||null:null,'attributes':[[db[_0x588f('0x1d')]['fn']('COUNT',db[_0x588f('0x1d')][_0x588f('0x1e')]('id')),_0x588f('0x1f')],[db['sequelize']['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x22')))),_0x588f('0x23')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x588f('0x20'),db['sequelize']['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x25')))),_0x588f('0x26')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x27'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x28')))),_0x588f('0x29')],[db[_0x588f('0x1d')]['fn']('AVG',db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x2a')))),_0x588f('0x2b')]]})[_0x588f('0x19')](function(_0x399395){logger['info'](_0x588f('0x1a'),_0xe96914);logger[_0x588f('0xc')](_0x588f('0x1a'),_0xe96914,JSON['stringify'](_0x399395));_0x153213(_0x399395);})[_0x588f('0x14')](function(_0x3b6f77){logger['error']('AvgHandleTime',_0x3b6f77[_0x588f('0x12')],_0xe96914);_0x16c6a9(_0x534aa8[_0x588f('0xf')](0x1f4,_0x3b6f77[_0x588f('0x12')]));});});};exports[_0x588f('0x2c')]=function(_0x5bc965){var _0x1e5279=this;return new Promise(function(_0x287bda,_0x3eff69){return db[_0x588f('0x16')][_0x588f('0x1b')]({'raw':_0x5bc965[_0x588f('0x18')]?_0x5bc965[_0x588f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5bc965[_0x588f('0x18')]?_0x5bc965[_0x588f('0x18')]['where']||null:null,'attributes':[[_0x588f('0x2d'),_0x588f('0x2e')],[db['sequelize']['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x588f('0x2f')))),_0x588f('0x30')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x31')))),'outboundNoAnswerCallsDay'],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x22')))),_0x588f('0x32')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x33')))),_0x588f('0x34')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x35')))),_0x588f('0x36')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db['sequelize']['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x37')))),_0x588f('0x38')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x39')))),_0x588f('0x3a')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x3b')))),_0x588f('0x3c')],[db['sequelize']['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')]['literal'](_0x588f('0x3d')))),_0x588f('0x3e')],[db[_0x588f('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x3f')))),'outboundOriginateFailureCallsDay'],[db[_0x588f('0x1d')]['fn']('COUNT',db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')]['literal'](_0x588f('0x40')))),_0x588f('0x41')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db['sequelize'][_0x588f('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0x588f('0x42')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db['sequelize'][_0x588f('0x21')](_0x588f('0x43')))),_0x588f('0x41')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')]['literal'](_0x588f('0x44')))),_0x588f('0x45')]],'group':['campaign']})['then'](function(_0x196f75){logger[_0x588f('0xb')](_0x588f('0x2c'),_0x5bc965);logger[_0x588f('0xc')](_0x588f('0x2c'),_0x5bc965,JSON[_0x588f('0x46')](_0x196f75));_0x287bda(_0x196f75);})['catch'](function(_0x102586){logger[_0x588f('0xf')](_0x588f('0x2c'),_0x102586['message'],_0x5bc965);_0x3eff69(_0x1e5279[_0x588f('0xf')](0x1f4,_0x102586['message']));});});};exports[_0x588f('0x47')]=function(_0x4eb373){var _0x327bd9=this;return new Promise(function(_0x5997a6,_0x30f902){return db['CmHopperHistory'][_0x588f('0x1b')]({'raw':_0x4eb373[_0x588f('0x18')]?_0x4eb373[_0x588f('0x18')][_0x588f('0x1c')]===undefined?!![]:![]:!![],'where':_0x4eb373[_0x588f('0x18')]?_0x4eb373['options'][_0x588f('0x48')]||null:null,'attributes':[[_0x588f('0x2d'),_0x588f('0x2e')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')][_0x588f('0x1e')]('id')),_0x588f('0x49')],[db['sequelize']['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x22')))),_0x588f('0x4a')]],'group':[_0x588f('0x2d')]})[_0x588f('0x19')](function(_0x5a31da){logger[_0x588f('0xb')]('GetCampaignHopperHistory',_0x4eb373);logger['debug'](_0x588f('0x47'),_0x4eb373,JSON[_0x588f('0x46')](_0x5a31da));_0x5997a6(_0x5a31da);})['catch'](function(_0x5616c6){logger[_0x588f('0xf')]('GetCampaignHopperHistory',_0x5616c6['message'],_0x4eb373);_0x30f902(_0x327bd9[_0x588f('0xf')](0x1f4,_0x5616c6[_0x588f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 2f321fd..5f52ce0 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 _0x5f15=['get','isAuthenticated','index','/describe','/:id','create','put','update','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x4c9444,_0x29476e){var _0x207126=function(_0x45a30f){while(--_0x45a30f){_0x4c9444['push'](_0x4c9444['shift']());}};_0x207126(++_0x29476e);}(_0x5f15,0x139));var _0x55f1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5f15[_0x46e363];return _0x3fb059;};'use strict';var multer=require('multer');var util=require(_0x55f1('0x0'));var path=require('path');var timeout=require(_0x55f1('0x1'));var express=require(_0x55f1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x55f1('0x3'));var interaction=require(_0x55f1('0x4'));var config=require(_0x55f1('0x5'));var controller=require(_0x55f1('0x6'));router[_0x55f1('0x7')]('/',auth[_0x55f1('0x8')](),controller[_0x55f1('0x9')]);router['get'](_0x55f1('0xa'),auth[_0x55f1('0x8')](),controller['describe']);router['get'](_0x55f1('0xb'),auth[_0x55f1('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x55f1('0xc')]);router[_0x55f1('0xd')](_0x55f1('0xb'),auth[_0x55f1('0x8')](),controller[_0x55f1('0xe')]);module[_0x55f1('0xf')]=router; \ No newline at end of file +var _0xc595=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout'];(function(_0x17ff4f,_0x338899){var _0x16e6da=function(_0x48bbbc){while(--_0x48bbbc){_0x17ff4f['push'](_0x17ff4f['shift']());}};_0x16e6da(++_0x338899);}(_0xc595,0x114));var _0x5c59=function(_0x369177,_0x1cee45){_0x369177=_0x369177-0x0;var _0x325699=_0xc595[_0x369177];return _0x325699;};'use strict';var multer=require(_0x5c59('0x0'));var util=require(_0x5c59('0x1'));var path=require(_0x5c59('0x2'));var timeout=require(_0x5c59('0x3'));var express=require('express');var router=express[_0x5c59('0x4')]();var fs_extra=require(_0x5c59('0x5'));var auth=require(_0x5c59('0x6'));var interaction=require(_0x5c59('0x7'));var config=require(_0x5c59('0x8'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x5c59('0x9')](),controller['index']);router[_0x5c59('0xa')](_0x5c59('0xb'),auth['isAuthenticated'](),controller[_0x5c59('0xc')]);router['get'](_0x5c59('0xd'),auth['isAuthenticated'](),controller[_0x5c59('0xe')]);router[_0x5c59('0xf')]('/',auth['isAuthenticated'](),controller[_0x5c59('0x10')]);router[_0x5c59('0x11')](_0x5c59('0xd'),auth[_0x5c59('0x9')](),controller[_0x5c59('0x12')]);module[_0x5c59('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a62a726..39ed7dd 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 _0x3c7b=['name','sequelize','exports','STRING'];(function(_0x42d35d,_0x33e6fc){var _0x445dbc=function(_0x45fb03){while(--_0x45fb03){_0x42d35d['push'](_0x42d35d['shift']());}};_0x445dbc(++_0x33e6fc);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x17e801,_0x3b7885){_0x17e801=_0x17e801-0x0;var _0x123ce6=_0x3c7b[_0x17e801];return _0x123ce6;};'use strict';var Sequelize=require(_0xb3c7('0x0'));module[_0xb3c7('0x1')]={'name':{'type':Sequelize[_0xb3c7('0x2')],'unique':_0xb3c7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb3c7('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1da1=['sequelize','exports','STRING','name'];(function(_0x3d3684,_0x29df28){var _0x4fa8a8=function(_0x21e0a2){while(--_0x21e0a2){_0x3d3684['push'](_0x3d3684['shift']());}};_0x4fa8a8(++_0x29df28);}(_0x1da1,0x1a4));var _0x11da=function(_0x1681ca,_0xfbfd09){_0x1681ca=_0x1681ca-0x0;var _0x5d4c53=_0x1da1[_0x1681ca];return _0x5d4c53;};'use strict';var Sequelize=require(_0x11da('0x0'));module[_0x11da('0x1')]={'name':{'type':Sequelize[_0x11da('0x2')],'unique':_0x11da('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x11da('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 7817150..46f53e1 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 _0xab10=['dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','getContacts','ContactItemType','OrderBy','select','from','cm_contacts','c.deletedAt\x20is\x20null','field','c.cf_','customField_','alias','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','type','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Lists','UserProfileResource','destroy','error','stack','name','send','map','CmList','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','pick','ListId','options','rows','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','omit','ids','success'];(function(_0x3ef1b8,_0x49073d){var _0x422941=function(_0x95e358){while(--_0x95e358){_0x3ef1b8['push'](_0x3ef1b8['shift']());}};_0x422941(++_0x49073d);}(_0xab10,0x181));var _0x0ab1=function(_0x39e40c,_0x4ead18){_0x39e40c=_0x39e40c-0x0;var _0x151859=_0xab10[_0x39e40c];return _0x151859;};'use strict';var emlformat=require(_0x0ab1('0x0'));var rimraf=require(_0x0ab1('0x1'));var zipdir=require(_0x0ab1('0x2'));var jsonpatch=require(_0x0ab1('0x3'));var rp=require(_0x0ab1('0x4'));var moment=require('moment');var BPromise=require(_0x0ab1('0x5'));var Mustache=require(_0x0ab1('0x6'));var util=require(_0x0ab1('0x7'));var path=require(_0x0ab1('0x8'));var sox=require(_0x0ab1('0x9'));var csv=require('to-csv');var ejs=require(_0x0ab1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab1('0xb'));var squel=require(_0x0ab1('0xc'));var crypto=require(_0x0ab1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ab1('0xe'));var querystring=require(_0x0ab1('0xf'));var Papa=require(_0x0ab1('0x10'));var Redis=require(_0x0ab1('0x11'));var authService=require(_0x0ab1('0x12'));var qs=require(_0x0ab1('0x13'));var as=require(_0x0ab1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ab1('0x15'))(_0x0ab1('0x16'));var utils=require(_0x0ab1('0x17'));var config=require(_0x0ab1('0x18'));var licenseUtil=require(_0x0ab1('0x19'));var db=require(_0x0ab1('0x1a'))['db'];var csv_results;config[_0x0ab1('0x1b')]=_[_0x0ab1('0x1c')](config[_0x0ab1('0x1b')],{'host':_0x0ab1('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ab1('0x1b')]));require(_0x0ab1('0x1e'))['register'](socket);function respondWithStatusCode(_0x5ce498,_0x433933){_0x433933=_0x433933||0xcc;return function(_0x8b7b21){if(_0x8b7b21){return _0x5ce498[_0x0ab1('0x1f')](_0x433933);}return _0x5ce498[_0x0ab1('0x20')](_0x433933)[_0x0ab1('0x21')]();};}function respondWithResult(_0x56b1bf,_0x227168){_0x227168=_0x227168||0xc8;return function(_0x2bc27d){if(_0x2bc27d){return _0x56b1bf[_0x0ab1('0x20')](_0x227168)[_0x0ab1('0x22')](_0x2bc27d);}};}function respondWithFilteredResult(_0x539831,_0xbbc1f8){return function(_0xb9effb){if(_0xb9effb){var _0x4cd836=typeof _0xbbc1f8[_0x0ab1('0x23')]==='undefined'&&typeof _0xbbc1f8[_0x0ab1('0x24')]===_0x0ab1('0x25');var _0xb4332d=_0xb9effb[_0x0ab1('0x26')];var _0x3db18c=_0x4cd836?0x0:_0xbbc1f8[_0x0ab1('0x23')];var _0x4f84a3=_0x4cd836?_0xb9effb[_0x0ab1('0x26')]:_0xbbc1f8[_0x0ab1('0x23')]+_0xbbc1f8[_0x0ab1('0x24')];var _0x24d6b4;if(_0x4f84a3>=_0xb4332d){_0x4f84a3=_0xb4332d;_0x24d6b4=0xc8;}else{_0x24d6b4=0xce;}_0x539831[_0x0ab1('0x20')](_0x24d6b4);return _0x539831[_0x0ab1('0x27')](_0x0ab1('0x28'),_0x3db18c+'-'+_0x4f84a3+'/'+_0xb4332d)[_0x0ab1('0x22')](_0xb9effb);}return null;};}function patchUpdates(_0x51b210){return function(_0xabf688){try{jsonpatch[_0x0ab1('0x29')](_0xabf688,_0x51b210,!![]);}catch(_0x6a15bf){return BPromise[_0x0ab1('0x2a')](_0x6a15bf);}return _0xabf688[_0x0ab1('0x2b')]();};}function saveUpdates(_0x58448e,_0x32dbf2){return function(_0x503fe3){if(_0x503fe3){return _0x503fe3[_0x0ab1('0x2c')](_0x58448e)['then'](function(_0x132a25){return _0x132a25;});}return null;};}function removeEntity(_0x3bdc87,_0x182fae){return function(_0x147e16){if(_0x147e16){return _0x147e16['destroy']()[_0x0ab1('0x2d')](function(){var _0x1cc991=_0x147e16[_0x0ab1('0x2e')]({'plain':!![]});var _0x1f1f1a=_0x0ab1('0x2f');return db[_0x0ab1('0x30')][_0x0ab1('0x31')]({'where':{'type':_0x1f1f1a,'resourceId':_0x1cc991['id']}})[_0x0ab1('0x2d')](function(){return _0x147e16;});})['then'](function(){_0x3bdc87['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b9b3c,_0x329c36){return function(_0x37998b){if(!_0x37998b){_0x3b9b3c['sendStatus'](0x194);}return _0x37998b;};}function handleError(_0x5dd296,_0x4b7902){_0x4b7902=_0x4b7902||0x1f4;return function(_0x3cb1c1){logger[_0x0ab1('0x32')](_0x3cb1c1[_0x0ab1('0x33')]);if(_0x3cb1c1[_0x0ab1('0x34')]){delete _0x3cb1c1['name'];}_0x5dd296[_0x0ab1('0x20')](_0x4b7902)[_0x0ab1('0x35')](_0x3cb1c1);};}exports['index']=function(_0x131a1f,_0x440dbb){var _0x40db14={},_0x13cede={},_0x227321={'count':0x0,'rows':[]};var _0xe561dc=_[_0x0ab1('0x36')](db[_0x0ab1('0x37')][_0x0ab1('0x38')],function(_0x271459){return{'name':_0x271459[_0x0ab1('0x39')],'type':_0x271459['type'][_0x0ab1('0x3a')]};});_0x13cede['model']=_[_0x0ab1('0x36')](_0xe561dc,_0x0ab1('0x34'));_0x13cede[_0x0ab1('0x3b')]=_[_0x0ab1('0x3c')](_0x131a1f[_0x0ab1('0x3b')]);_0x13cede[_0x0ab1('0x3d')]=_[_0x0ab1('0x3e')](_0x13cede[_0x0ab1('0x3f')],_0x13cede[_0x0ab1('0x3b')]);_0x40db14[_0x0ab1('0x40')]=_['intersection'](_0x13cede['model'],qs[_0x0ab1('0x41')](_0x131a1f[_0x0ab1('0x3b')][_0x0ab1('0x41')]));_0x40db14[_0x0ab1('0x40')]=_0x40db14[_0x0ab1('0x40')][_0x0ab1('0x42')]?_0x40db14[_0x0ab1('0x40')]:_0x13cede[_0x0ab1('0x3f')];if(!_0x131a1f[_0x0ab1('0x3b')][_0x0ab1('0x43')](_0x0ab1('0x44'))){_0x40db14[_0x0ab1('0x24')]=qs['limit'](_0x131a1f[_0x0ab1('0x3b')][_0x0ab1('0x24')]);_0x40db14[_0x0ab1('0x23')]=qs['offset'](_0x131a1f[_0x0ab1('0x3b')][_0x0ab1('0x23')]);}_0x40db14[_0x0ab1('0x45')]=qs[_0x0ab1('0x46')](_0x131a1f['query']['sort']);_0x40db14[_0x0ab1('0x47')]=qs[_0x0ab1('0x3d')](_['pick'](_0x131a1f['query'],_0x13cede[_0x0ab1('0x3d')]),_0xe561dc);if(_0x131a1f[_0x0ab1('0x3b')][_0x0ab1('0x48')]){_0x40db14[_0x0ab1('0x47')]=_[_0x0ab1('0x49')](_0x40db14[_0x0ab1('0x47')],{'$or':_[_0x0ab1('0x36')](_0xe561dc,function(_0x4584ee){if(_0x4584ee['type']!==_0x0ab1('0x4a')){var _0xa855b9={};_0xa855b9[_0x4584ee['name']]={'$like':'%'+_0x131a1f[_0x0ab1('0x3b')][_0x0ab1('0x48')]+'%'};return _0xa855b9;}})});}_0x40db14=_['merge']({},_0x40db14,_0x131a1f['options']);var _0x132de1={'where':_0x40db14[_0x0ab1('0x47')]};return db[_0x0ab1('0x37')][_0x0ab1('0x26')](_0x132de1)[_0x0ab1('0x2d')](function(_0x2307e7){_0x227321['count']=_0x2307e7;if(_0x131a1f['query'][_0x0ab1('0x4b')]){_0x40db14[_0x0ab1('0x4c')]=[{'all':!![]}];}return db[_0x0ab1('0x37')][_0x0ab1('0x4d')](_0x40db14);})[_0x0ab1('0x2d')](function(_0x5b8370){_0x227321['rows']=_0x5b8370;return _0x227321;})[_0x0ab1('0x2d')](respondWithFilteredResult(_0x440dbb,_0x40db14))[_0x0ab1('0x4e')](handleError(_0x440dbb,null));};exports['show']=function(_0x346507,_0x54a56f){var _0x49609d={'raw':![],'where':{'id':_0x346507[_0x0ab1('0x4f')]['id']}},_0x488d8e={};_0x488d8e[_0x0ab1('0x3f')]=_[_0x0ab1('0x3c')](db[_0x0ab1('0x37')][_0x0ab1('0x38')]);_0x488d8e[_0x0ab1('0x3b')]=_[_0x0ab1('0x3c')](_0x346507[_0x0ab1('0x3b')]);_0x488d8e['filters']=_['intersection'](_0x488d8e[_0x0ab1('0x3f')],_0x488d8e[_0x0ab1('0x3b')]);_0x49609d['attributes']=_['intersection'](_0x488d8e[_0x0ab1('0x3f')],qs[_0x0ab1('0x41')](_0x346507['query']['fields']));_0x49609d[_0x0ab1('0x40')]=_0x49609d[_0x0ab1('0x40')]['length']?_0x49609d[_0x0ab1('0x40')]:_0x488d8e[_0x0ab1('0x3f')];if(_0x346507[_0x0ab1('0x3b')][_0x0ab1('0x4b')]){_0x49609d['include']=[{'all':!![]}];}_0x49609d=_[_0x0ab1('0x49')]({},_0x49609d,_0x346507['options']);return db[_0x0ab1('0x37')][_0x0ab1('0x50')](_0x49609d)[_0x0ab1('0x2d')](handleEntityNotFound(_0x54a56f,null))['then'](respondWithResult(_0x54a56f,null))[_0x0ab1('0x4e')](handleError(_0x54a56f,null));};exports[_0x0ab1('0x51')]=function(_0x7c13d5,_0x271627){return db[_0x0ab1('0x37')][_0x0ab1('0x51')](_0x7c13d5[_0x0ab1('0x52')],{})[_0x0ab1('0x2d')](function(_0x3455bf){var _0x18d7d7=_0x7c13d5[_0x0ab1('0x53')][_0x0ab1('0x2e')]({'plain':!![]});if(!_0x18d7d7)throw new Error(_0x0ab1('0x54'));if(_0x18d7d7['role']===_0x0ab1('0x53')){var _0x15b0f5=_0x3455bf['get']({'plain':!![]});var _0x2b67eb='Lists';return db[_0x0ab1('0x55')][_0x0ab1('0x50')]({'where':{'name':_0x2b67eb,'userProfileId':_0x18d7d7[_0x0ab1('0x56')]},'raw':!![]})[_0x0ab1('0x2d')](function(_0x1f2887){if(_0x1f2887&&_0x1f2887['autoAssociation']===0x0){return db[_0x0ab1('0x30')]['create']({'name':_0x15b0f5[_0x0ab1('0x34')],'resourceId':_0x15b0f5['id'],'type':_0x1f2887['name'],'sectionId':_0x1f2887['id']},{})[_0x0ab1('0x2d')](function(){return _0x3455bf;});}else{return _0x3455bf;}})[_0x0ab1('0x4e')](function(_0x376327){logger[_0x0ab1('0x32')](_0x0ab1('0x57'),_0x376327);throw _0x376327;});}return _0x3455bf;})['then'](respondWithResult(_0x271627,0xc9))[_0x0ab1('0x4e')](handleError(_0x271627,null));};exports[_0x0ab1('0x2c')]=function(_0x43d34e,_0x526d35){if(_0x43d34e[_0x0ab1('0x52')]['id']){delete _0x43d34e[_0x0ab1('0x52')]['id'];}return db[_0x0ab1('0x37')][_0x0ab1('0x50')]({'where':{'id':_0x43d34e[_0x0ab1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x526d35,null))[_0x0ab1('0x2d')](saveUpdates(_0x43d34e['body'],null))[_0x0ab1('0x2d')](respondWithResult(_0x526d35,null))[_0x0ab1('0x4e')](handleError(_0x526d35,null));};exports[_0x0ab1('0x31')]=function(_0x370c83,_0x5cef74){return db['CmList'][_0x0ab1('0x50')]({'where':{'id':_0x370c83['params']['id']}})['then'](handleEntityNotFound(_0x5cef74,null))[_0x0ab1('0x2d')](removeEntity(_0x5cef74,null))[_0x0ab1('0x4e')](handleError(_0x5cef74,null));};exports[_0x0ab1('0x58')]=function(_0x2f50d7,_0x5807f1){return db[_0x0ab1('0x37')]['describe']()['then'](respondWithResult(_0x5807f1,null))[_0x0ab1('0x4e')](handleError(_0x5807f1,null));};exports['addDisposition']=function(_0x48c541,_0x10464c,_0x57704f){if(_0x48c541[_0x0ab1('0x52')]['id']){delete _0x48c541[_0x0ab1('0x52')]['id'];}return db[_0x0ab1('0x37')][_0x0ab1('0x50')]({'where':{'id':_0x48c541[_0x0ab1('0x4f')]['id']}})[_0x0ab1('0x2d')](handleEntityNotFound(_0x10464c,null))['then'](function(_0x326f6e){if(_0x326f6e){_0x48c541[_0x0ab1('0x52')]['ListId']=_0x326f6e['id'];return db[_0x0ab1('0x59')][_0x0ab1('0x51')](_0x48c541[_0x0ab1('0x52')]);}})['then'](respondWithResult(_0x10464c,null))[_0x0ab1('0x4e')](handleError(_0x10464c,null));};exports[_0x0ab1('0x5a')]=function(_0x51f882,_0xf02122,_0x170030){var _0x419e40={'raw':![],'where':{}};var _0xfcf688={};var _0x2c6e0f={'count':0x0,'rows':[]};return db['CmList'][_0x0ab1('0x5b')]({'where':{'id':_0x51f882[_0x0ab1('0x4f')]['id']}})[_0x0ab1('0x2d')](handleEntityNotFound(_0xf02122,null))['then'](function(_0x52c0d3){if(_0x52c0d3){_0xfcf688[_0x0ab1('0x3f')]=_['keys'](db[_0x0ab1('0x59')][_0x0ab1('0x38')]);_0xfcf688[_0x0ab1('0x3b')]=_['keys'](_0x51f882[_0x0ab1('0x3b')]);_0xfcf688[_0x0ab1('0x3d')]=_[_0x0ab1('0x3e')](_0xfcf688[_0x0ab1('0x3f')],_0xfcf688['query']);_0x419e40['attributes']=_[_0x0ab1('0x3e')](_0xfcf688[_0x0ab1('0x3f')],qs[_0x0ab1('0x41')](_0x51f882[_0x0ab1('0x3b')][_0x0ab1('0x41')]));_0x419e40[_0x0ab1('0x40')]=_0x419e40[_0x0ab1('0x40')][_0x0ab1('0x42')]?_0x419e40[_0x0ab1('0x40')]:_0xfcf688[_0x0ab1('0x3f')];if(!_0x51f882[_0x0ab1('0x3b')]['hasOwnProperty'](_0x0ab1('0x44'))){_0x419e40[_0x0ab1('0x24')]=qs[_0x0ab1('0x24')](_0x51f882[_0x0ab1('0x3b')][_0x0ab1('0x24')]);_0x419e40[_0x0ab1('0x23')]=qs['offset'](_0x51f882[_0x0ab1('0x3b')]['offset']);}_0x419e40[_0x0ab1('0x45')]=qs['sort'](_0x51f882[_0x0ab1('0x3b')]['sort']);_0x419e40[_0x0ab1('0x47')]=qs[_0x0ab1('0x3d')](_[_0x0ab1('0x5c')](_0x51f882[_0x0ab1('0x3b')],_0xfcf688[_0x0ab1('0x3d')]));_0x419e40[_0x0ab1('0x47')][_0x0ab1('0x5d')]=_0x52c0d3['id'];if(_0x51f882[_0x0ab1('0x3b')]['filter']){_0x419e40[_0x0ab1('0x47')]=_[_0x0ab1('0x49')](_0x419e40[_0x0ab1('0x47')],{'$or':_[_0x0ab1('0x36')](_0x419e40[_0x0ab1('0x40')],function(_0xd8049e){var _0x682cae={};_0x682cae[_0xd8049e]={'$like':'%'+_0x51f882[_0x0ab1('0x3b')][_0x0ab1('0x48')]+'%'};return _0x682cae;})});}_0x419e40=_[_0x0ab1('0x49')]({},_0x419e40,_0x51f882[_0x0ab1('0x5e')]);return db[_0x0ab1('0x59')][_0x0ab1('0x26')]({'where':_0x419e40[_0x0ab1('0x47')]})[_0x0ab1('0x2d')](function(_0x3ee825){_0x2c6e0f[_0x0ab1('0x26')]=_0x3ee825;if(_0x51f882[_0x0ab1('0x3b')]['includeAll']){_0x419e40[_0x0ab1('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0x0ab1('0x4d')](_0x419e40);})[_0x0ab1('0x2d')](function(_0x141b14){_0x2c6e0f[_0x0ab1('0x5f')]=_0x141b14;return _0x2c6e0f;});}})['then'](respondWithFilteredResult(_0xf02122,_0x419e40))[_0x0ab1('0x4e')](handleError(_0xf02122,null));};exports[_0x0ab1('0x60')]=function(_0x1f8ebc,_0x40d10f,_0x2ec95f){return db[_0x0ab1('0x37')][_0x0ab1('0x50')]({'where':{'id':_0x1f8ebc[_0x0ab1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x40d10f,null))[_0x0ab1('0x2d')](function(_0x17d920){if(_0x17d920){return _0x17d920[_0x0ab1('0x60')](_0x1f8ebc['query']['ids']);}})[_0x0ab1('0x2d')](respondWithStatusCode(_0x40d10f,null))[_0x0ab1('0x4e')](handleError(_0x40d10f,null));};exports[_0x0ab1('0x61')]=function(_0x2a5e36,_0x12969b,_0x29fdfd){return db['CmList'][_0x0ab1('0x50')]({'where':{'id':_0x2a5e36[_0x0ab1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x12969b,null))[_0x0ab1('0x2d')](function(_0x4409bb){if(_0x4409bb){var _0x5054ce=[];var _0x2c5cdc={'success':[],'errors':[]};return db[_0x0ab1('0x62')]['describe']()['then'](function(_0x1a3205){if(_0x2a5e36[_0x0ab1('0x52')][_0x0ab1('0x63')]&&_[_0x0ab1('0x64')](_0x2a5e36['body'][_0x0ab1('0x63')])){if(_0x2a5e36[_0x0ab1('0x52')][_0x0ab1('0x63')][_0x0ab1('0x42')]){_0x2a5e36[_0x0ab1('0x52')][_0x0ab1('0x63')]=_0x2a5e36[_0x0ab1('0x52')]['tags'][_0x0ab1('0x65')](';')+';';}else{_0x2a5e36[_0x0ab1('0x52')][_0x0ab1('0x63')]=null;}}else{_0x2a5e36[_0x0ab1('0x52')][_0x0ab1('0x63')]=null;}if(_0x2a5e36[_0x0ab1('0x52')]&&_['isArray'](_0x2a5e36[_0x0ab1('0x52')])){for(var _0x1b229c=0x0;_0x1b229c<_0x2a5e36[_0x0ab1('0x52')][_0x0ab1('0x42')];_0x1b229c+=0x1){_0x2a5e36['body'][_0x1b229c][_0x0ab1('0x5d')]=_0x2a5e36[_0x0ab1('0x4f')]['id'];_0x5054ce[_0x0ab1('0x66')](_0x2a5e36[_0x0ab1('0x52')][_0x1b229c]);}return BPromise[_0x0ab1('0x67')](_0x5054ce,function(_0x1500c1){return db[_0x0ab1('0x62')][_0x0ab1('0x51')](_[_0x0ab1('0x68')](_0x1500c1,[_0x0ab1('0x69'),'id'])||{},{'fields':_[_0x0ab1('0x3c')](_0x1a3205),'raw':!![]})[_0x0ab1('0x2d')](function(_0x172ec5){_0x2c5cdc[_0x0ab1('0x6a')][_0x0ab1('0x66')](_0x172ec5[_0x0ab1('0x6b')]);})[_0x0ab1('0x4e')](function(_0xfaf301){_0x2c5cdc[_0x0ab1('0x6c')][_0x0ab1('0x66')]({'data':_0x1500c1,'error':_0xfaf301[_0x0ab1('0x6d')]});});})[_0x0ab1('0x2d')](function(_0x2d183f){return _0x2c5cdc;})['catch'](function(_0x3637e9){return _0x3637e9;});}else{_0x12969b[_0x0ab1('0x20')](0x190)[_0x0ab1('0x22')]({'message':_0x0ab1('0x6e')});}});}})[_0x0ab1('0x2d')](respondWithResult(_0x12969b,null))['catch'](handleError(_0x12969b,null));};exports['getContacts']=function(_0x4cb443,_0x39660a,_0x29b622){var _0x46c58f;return db['CmList'][_0x0ab1('0x50')]({'where':{'id':_0x4cb443[_0x0ab1('0x4f')]['id']},'include':[{'model':db[_0x0ab1('0x6f')],'as':_0x0ab1('0x70')}]})[_0x0ab1('0x2d')](handleEntityNotFound(_0x39660a,null))['then'](function(_0xf85db){if(_0xf85db){_0x46c58f=_0xf85db;return db['CmContact'][_0x0ab1('0x38')];}})[_0x0ab1('0x2d')](function(_0xae49ff){if(_0xae49ff){var _0x32d3ea={};var _0x26c07f={};_0x26c07f[_0x0ab1('0x3f')]=_[_0x0ab1('0x71')](_[_0x0ab1('0x3c')](_0xae49ff),_['map'](_0x46c58f[_0x0ab1('0x70')],function(_0x17da18){return util[_0x0ab1('0x72')](_0x0ab1('0x73'),_0x17da18['id']);}));_0x26c07f[_0x0ab1('0x3b')]=_[_0x0ab1('0x3c')](_0x4cb443[_0x0ab1('0x3b')]);_0x26c07f[_0x0ab1('0x3d')]=_[_0x0ab1('0x3e')](_0x26c07f[_0x0ab1('0x3f')],_0x26c07f[_0x0ab1('0x3b')]);_0x32d3ea[_0x0ab1('0x40')]=_[_0x0ab1('0x3e')](_0x26c07f['model'],qs[_0x0ab1('0x41')](_0x4cb443[_0x0ab1('0x3b')][_0x0ab1('0x41')]));_0x32d3ea['attributes']=_0x32d3ea[_0x0ab1('0x40')][_0x0ab1('0x42')]?_0x32d3ea[_0x0ab1('0x40')]:_0x26c07f[_0x0ab1('0x3f')];if(!_0x4cb443[_0x0ab1('0x3b')][_0x0ab1('0x43')]('nolimit')){_0x32d3ea[_0x0ab1('0x24')]=qs[_0x0ab1('0x24')](_0x4cb443[_0x0ab1('0x3b')]['limit']);_0x32d3ea[_0x0ab1('0x23')]=qs[_0x0ab1('0x23')](_0x4cb443[_0x0ab1('0x3b')][_0x0ab1('0x23')]);}_0x32d3ea[_0x0ab1('0x45')]=qs['sort'](_0x4cb443['query']['sort']);_0x32d3ea[_0x0ab1('0x47')]=qs[_0x0ab1('0x3d')](_[_0x0ab1('0x5c')](_0x4cb443['query'],_0x26c07f[_0x0ab1('0x3d')]));_0x32d3ea['raw']=!![];if(_0x4cb443[_0x0ab1('0x3b')]['filter']){_0x32d3ea[_0x0ab1('0x47')]=_['merge'](_0x32d3ea[_0x0ab1('0x47')],{'$or':_[_0x0ab1('0x36')](_0x32d3ea['attributes'],function(_0x407399){var _0x1f24b9={};_0x1f24b9[_0x407399]={'$like':'%'+_0x4cb443['query'][_0x0ab1('0x48')]+'%'};return _0x1f24b9;})});}_0x32d3ea=_['merge']({},_0x32d3ea,_0x4cb443['options']);return _0x46c58f[_0x0ab1('0x74')](_0x32d3ea);}})[_0x0ab1('0x2d')](respondWithResult(_0x39660a,null))[_0x0ab1('0x4e')](handleError(_0x39660a,null));};exports['getContactsCsv']=function(_0x4bfc3b,_0x5acaae,_0x1d79b6){var _0x17d5c9;var _0x323bc3;var _0x4ccfcc;var _0x4b8132=_0x4bfc3b[_0x0ab1('0x4f')]['id'];csv_results=[];return db[_0x0ab1('0x75')]['findAll']({'attributes':['id',_0x0ab1('0x34')],'raw':!![],'order':[_0x0ab1('0x76')]})['then'](function(_0x1c01d0){_0x17d5c9=_0x1c01d0;var _0x21d29b=_[_0x0ab1('0x3c')](db[_0x0ab1('0x62')][_0x0ab1('0x38')]);return db['CmCustomField'][_0x0ab1('0x4d')]({'raw':!![],'attributes':['id','alias']})[_0x0ab1('0x2d')](function(_0x16c69f){_0x323bc3=_0x16c69f;var _0xd73566=squel[_0x0ab1('0x77')]()[_0x0ab1('0x41')](_0x21d29b)[_0x0ab1('0x78')](_0x0ab1('0x79'),'c')[_0x0ab1('0x47')]('c.ListId\x20=\x20?',_0x4b8132)['where'](_0x0ab1('0x7a'))['distinct']();for(var _0x49ad76=0x0;_0x49ad76<_0x323bc3['length'];_0x49ad76++){_0xd73566[_0x0ab1('0x7b')](_0x0ab1('0x7c')+_0x323bc3[_0x49ad76]['id'],_0x0ab1('0x7d')+_0x323bc3[_0x49ad76][_0x0ab1('0x7e')]);}for(var _0x49ad76=0x0;_0x49ad76<_0x17d5c9[_0x0ab1('0x42')];_0x49ad76++){_0xd73566[_0x0ab1('0x7b')](squel[_0x0ab1('0x77')]()['field']('item')[_0x0ab1('0x78')](_0x0ab1('0x7f'))[_0x0ab1('0x47')](_0x0ab1('0x80'),_0x17d5c9[_0x49ad76]['id'])['where'](_0x0ab1('0x81')),_0x0ab1('0x82')+_0x17d5c9[_0x49ad76]['name']);_0xd73566[_0x0ab1('0x7b')](squel['select']()[_0x0ab1('0x7b')](_0x0ab1('0x83'))[_0x0ab1('0x78')]('cm_contact_has_items')[_0x0ab1('0x47')](_0x0ab1('0x80'),_0x17d5c9[_0x49ad76]['id'])[_0x0ab1('0x47')](_0x0ab1('0x81')),'description_additionalPhone_'+_0x17d5c9[_0x49ad76][_0x0ab1('0x34')]);}var _0x3511b7=[];_0x3511b7[_0x0ab1('0x66')](_0xd73566[_0x0ab1('0x84')]());BPromise[_0x0ab1('0x67')](_0x3511b7,handleQuery)[_0x0ab1('0x2d')](function(_0x4ce36e){handleQuery(_0xd73566['toString']());var _0xed2829=csv_results[0x0];if(!_[_0x0ab1('0x85')](_0xed2829)){var _0xec84f6=toCsv(_0xed2829);var _0x36738d=Date['now']();fs['writeFileSync'](util['format'](_0x0ab1('0x86'),_0x4b8132,_0x36738d),_0xec84f6);_0x5acaae[_0x0ab1('0x87')]('Content-disposition',_0x0ab1('0x88')+util[_0x0ab1('0x72')](_0x0ab1('0x89'),_0x4b8132,_0x36738d));_0x5acaae[_0x0ab1('0x87')](_0x0ab1('0x8a'),'text/csv');return _0x5acaae['download'](util[_0x0ab1('0x72')]('/tmp/list_%d_%s.csv',_0x4b8132,_0x36738d));}else{return _0x5acaae[_0x0ab1('0x1f')](0xcc);}});});});};exports[_0x0ab1('0x8b')]=function(_0x43d8d3,_0x3f427e,_0xcd4491){var _0x5b60db;delete _0x43d8d3[_0x0ab1('0x52')]['id'];return db[_0x0ab1('0x37')][_0x0ab1('0x5b')]({'where':{'id':_0x43d8d3[_0x0ab1('0x4f')]['id']}})[_0x0ab1('0x2d')](handleEntityNotFound(_0x3f427e,null))[_0x0ab1('0x2d')](function(_0x2ab481){if(_0x2ab481){return db[_0x0ab1('0x8c')][_0x0ab1('0x8d')](function(_0x302a6e){return db['CmCustomField'][_0x0ab1('0x51')](_0x43d8d3[_0x0ab1('0x52')],{'transaction':_0x302a6e})[_0x0ab1('0x2d')](function(_0x1f0abb){_0x5b60db=_0x1f0abb;return _0x2ab481['addCustomFields'](_0x1f0abb,{'transaction':_0x302a6e});})[_0x0ab1('0x2d')](function(){var _0x57229b={'type':db[_0x0ab1('0x8e')][_0x0ab1('0x8f')],'transaction':_0x302a6e};switch(_0x43d8d3['body']['type']){case _0x0ab1('0x90'):_0x57229b['type']=db['Sequelize'][_0x0ab1('0x8f')];break;case _0x0ab1('0x91'):_0x57229b[_0x0ab1('0x92')]=db['Sequelize'][_0x0ab1('0x93')];break;case _0x0ab1('0x94'):_0x57229b[_0x0ab1('0x92')]=db[_0x0ab1('0x8e')]['BOOLEAN'];_0x57229b[_0x0ab1('0x95')]=![];break;default:}return db['sequelize'][_0x0ab1('0x96')][_0x0ab1('0x97')]('cm_contacts',util[_0x0ab1('0x72')](_0x0ab1('0x98'),_0x5b60db['id']),_0x57229b);})[_0x0ab1('0x2d')](function(){return _0x5b60db;});});}})[_0x0ab1('0x2d')](respondWithResult(_0x3f427e,null))[_0x0ab1('0x4e')](handleError(_0x3f427e,null));};exports[_0x0ab1('0x99')]=function(_0x3de373,_0x34724d,_0x2effe8){var _0x30aa70={};var _0x516b31={};var _0x1be69e;var _0x5c33ea;return db[_0x0ab1('0x37')][_0x0ab1('0x5b')]({'where':{'id':_0x3de373['params']['id']}})[_0x0ab1('0x2d')](handleEntityNotFound(_0x34724d,null))[_0x0ab1('0x2d')](function(_0x3f6581){if(_0x3f6581){_0x1be69e=_0x3f6581;_0x516b31[_0x0ab1('0x3f')]=_[_0x0ab1('0x3c')](db[_0x0ab1('0x6f')][_0x0ab1('0x38')]);_0x516b31[_0x0ab1('0x3b')]=_['keys'](_0x3de373[_0x0ab1('0x3b')]);_0x516b31['filters']=_[_0x0ab1('0x3e')](_0x516b31['model'],_0x516b31[_0x0ab1('0x3b')]);_0x30aa70['attributes']=_[_0x0ab1('0x3e')](_0x516b31[_0x0ab1('0x3f')],qs[_0x0ab1('0x41')](_0x3de373[_0x0ab1('0x3b')][_0x0ab1('0x41')]));_0x30aa70[_0x0ab1('0x40')]=_0x30aa70[_0x0ab1('0x40')][_0x0ab1('0x42')]?_0x30aa70['attributes']:_0x516b31['model'];_0x30aa70[_0x0ab1('0x45')]=qs[_0x0ab1('0x46')](_0x3de373[_0x0ab1('0x3b')][_0x0ab1('0x46')]);_0x30aa70[_0x0ab1('0x47')]=qs['filters'](_[_0x0ab1('0x5c')](_0x3de373['query'],_0x516b31[_0x0ab1('0x3d')]));_0x30aa70['where']=_[_0x0ab1('0x49')](_0x30aa70[_0x0ab1('0x47')],{'$or':[{'ListId':_0x3f6581['id']},{'ListId':null}]});if(_0x3de373[_0x0ab1('0x3b')]['filter']){_0x30aa70[_0x0ab1('0x47')]=_[_0x0ab1('0x49')](_0x30aa70['where'],{'$or':_[_0x0ab1('0x36')](_0x30aa70[_0x0ab1('0x40')],function(_0x51197c){var _0x3ea3f2={};_0x3ea3f2[_0x51197c]={'$like':'%'+_0x3de373[_0x0ab1('0x3b')][_0x0ab1('0x48')]+'%'};return _0x3ea3f2;})});}_0x30aa70=_[_0x0ab1('0x49')]({},_0x30aa70,_0x3de373[_0x0ab1('0x5e')]);return db[_0x0ab1('0x6f')]['findAndCountAll'](_0x30aa70);}})[_0x0ab1('0x2d')](respondWithResult(_0x34724d,null))['catch'](handleError(_0x34724d,null));};exports[_0x0ab1('0x9a')]=function(_0x1ae25e,_0x1bd986){return db[_0x0ab1('0x6f')][_0x0ab1('0x9b')]({'where':{'ListId':null}})[_0x0ab1('0x2d')](handleEntityNotFound(_0x1bd986,null))[_0x0ab1('0x2d')](function(_0x23308a){return _0x23308a;})[_0x0ab1('0x2d')](respondWithResult(_0x1bd986,null))[_0x0ab1('0x4e')](handleError(_0x1bd986,null));};exports[_0x0ab1('0x9c')]=function(_0x3c7755,_0x13dcd2,_0x4ac282){return db['CmList'][_0x0ab1('0x50')]({'where':{'id':_0x3c7755[_0x0ab1('0x4f')]['id']}})[_0x0ab1('0x2d')](handleEntityNotFound(_0x13dcd2,null))[_0x0ab1('0x2d')](function(_0x10d3fe){if(_0x10d3fe){return _0x10d3fe[_0x0ab1('0x9c')](_0x3c7755[_0x0ab1('0x52')]['ids'],_[_0x0ab1('0x68')](_0x3c7755[_0x0ab1('0x52')],[_0x0ab1('0x69'),'id'])||{})[_0x0ab1('0x9d')](function(_0x5c3d6d){for(var _0x386499=0x0;_0x386499<_0x3c7755[_0x0ab1('0x52')][_0x0ab1('0x69')][_0x0ab1('0x42')];_0x386499+=0x1){socket[_0x0ab1('0x9e')](_0x0ab1('0x9f'),{'UserId':Number(_0x3c7755[_0x0ab1('0x52')][_0x0ab1('0x69')][_0x386499]),'CmListId':Number(_0x3c7755['params']['id'])});}return _0x5c3d6d;});}})[_0x0ab1('0x2d')](respondWithResult(_0x13dcd2,null))[_0x0ab1('0x4e')](handleError(_0x13dcd2,null));};exports['removeAgents']=function(_0x52c78c,_0x16e03b,_0x3f5fb0){return db[_0x0ab1('0x37')]['find']({'where':{'id':_0x52c78c[_0x0ab1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x16e03b,null))[_0x0ab1('0x2d')](function(_0x21c95d){if(_0x21c95d){return _0x21c95d[_0x0ab1('0xa0')](_0x52c78c[_0x0ab1('0x3b')]['ids'])['then'](function(){if(_['isArray'](_0x52c78c[_0x0ab1('0x3b')][_0x0ab1('0x69')])){for(var _0x5c6014=0x0;_0x5c6014<_0x52c78c[_0x0ab1('0x3b')][_0x0ab1('0x69')][_0x0ab1('0x42')];_0x5c6014+=0x1){socket[_0x0ab1('0x9e')](_0x0ab1('0xa1'),{'UserId':Number(_0x52c78c[_0x0ab1('0x3b')]['ids'][_0x5c6014]),'CmListId':Number(_0x52c78c['params']['id'])});}}else{socket[_0x0ab1('0x9e')](_0x0ab1('0xa1'),{'UserId':Number(_0x52c78c[_0x0ab1('0x3b')][_0x0ab1('0x69')]),'CmListId':Number(_0x52c78c[_0x0ab1('0x4f')]['id'])});}});}})[_0x0ab1('0x2d')](respondWithStatusCode(_0x16e03b,null))[_0x0ab1('0x4e')](handleError(_0x16e03b,null));};exports['getAgents']=function(_0x5b2418,_0x393528,_0x34d80d){var _0x9fb80c={};var _0x732f9={};var _0x188ce8;var _0x40cb93;return db[_0x0ab1('0x37')]['findOne']({'where':{'id':_0x5b2418[_0x0ab1('0x4f')]['id']}})[_0x0ab1('0x2d')](handleEntityNotFound(_0x393528,null))[_0x0ab1('0x2d')](function(_0x2fc6e7){if(_0x2fc6e7){_0x188ce8=_0x2fc6e7;_0x732f9[_0x0ab1('0x3f')]=_[_0x0ab1('0x3c')](db[_0x0ab1('0xa2')][_0x0ab1('0x38')]);_0x732f9[_0x0ab1('0x3b')]=_[_0x0ab1('0x3c')](_0x5b2418[_0x0ab1('0x3b')]);_0x732f9[_0x0ab1('0x3d')]=_[_0x0ab1('0x3e')](_0x732f9['model'],_0x732f9[_0x0ab1('0x3b')]);_0x9fb80c[_0x0ab1('0x40')]=_['intersection'](_0x732f9['model'],qs[_0x0ab1('0x41')](_0x5b2418[_0x0ab1('0x3b')]['fields']));_0x9fb80c[_0x0ab1('0x40')]=_0x9fb80c[_0x0ab1('0x40')][_0x0ab1('0x42')]?_0x9fb80c['attributes']:_0x732f9[_0x0ab1('0x3f')];_0x9fb80c[_0x0ab1('0x45')]=qs['sort'](_0x5b2418[_0x0ab1('0x3b')][_0x0ab1('0x46')]);_0x9fb80c['where']=qs[_0x0ab1('0x3d')](_[_0x0ab1('0x5c')](_0x5b2418[_0x0ab1('0x3b')],_0x732f9['filters']));if(_0x5b2418[_0x0ab1('0x3b')]['filter']){_0x9fb80c[_0x0ab1('0x47')]=_[_0x0ab1('0x49')](_0x9fb80c['where'],{'$or':_['map'](_0x9fb80c[_0x0ab1('0x40')],function(_0x524bc1){var _0x4141a7={};_0x4141a7[_0x524bc1]={'$like':'%'+_0x5b2418[_0x0ab1('0x3b')][_0x0ab1('0x48')]+'%'};return _0x4141a7;})});}_0x9fb80c=_['merge']({},_0x9fb80c,_0x5b2418['options']);return _0x188ce8[_0x0ab1('0xa3')](_0x9fb80c);}})[_0x0ab1('0x2d')](function(_0x41a379){if(_0x41a379){_0x40cb93=_0x41a379[_0x0ab1('0x42')];if(!_0x5b2418['query'][_0x0ab1('0x43')]('nolimit')){_0x9fb80c[_0x0ab1('0x24')]=qs[_0x0ab1('0x24')](_0x5b2418[_0x0ab1('0x3b')][_0x0ab1('0x24')]);_0x9fb80c[_0x0ab1('0x23')]=qs[_0x0ab1('0x23')](_0x5b2418[_0x0ab1('0x3b')][_0x0ab1('0x23')]);}return _0x188ce8[_0x0ab1('0xa3')](_0x9fb80c);}})[_0x0ab1('0x2d')](function(_0x4dbb82){if(_0x4dbb82){return _0x4dbb82?{'count':_0x40cb93,'rows':_0x4dbb82}:null;}})['then'](respondWithResult(_0x393528,null))[_0x0ab1('0x4e')](handleError(_0x393528,null));};function handleQuery(_0x35f0e1){logger['info'](_0x35f0e1);return db['sequelize'][_0x0ab1('0x3b')](_0x35f0e1)[_0x0ab1('0x9d')](function(_0x59ab3a){csv_results[_0x0ab1('0x66')](_0x59ab3a);})['catch'](function(_0x2ed4cc){logger[_0x0ab1('0x32')](_0x2ed4cc[_0x0ab1('0x6d')]);});} \ No newline at end of file +var _0x5857=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','/tmp/list_%d_%s.csv','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','userCmList:save','removeAgents','userCmList:remove','emit','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','Lists','destroy','stack','name','send','index','map','CmList','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','filters','create','body','user','get'];(function(_0x2c887e,_0x28ffe0){var _0x573d3b=function(_0x335909){while(--_0x335909){_0x2c887e['push'](_0x2c887e['shift']());}};_0x573d3b(++_0x28ffe0);}(_0x5857,0x19f));var _0x7585=function(_0x5b4fca,_0x42c726){_0x5b4fca=_0x5b4fca-0x0;var _0x5b5c56=_0x5857[_0x5b4fca];return _0x5b5c56;};'use strict';var emlformat=require(_0x7585('0x0'));var rimraf=require(_0x7585('0x1'));var zipdir=require(_0x7585('0x2'));var jsonpatch=require(_0x7585('0x3'));var rp=require(_0x7585('0x4'));var moment=require(_0x7585('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7585('0x6'));var util=require(_0x7585('0x7'));var path=require(_0x7585('0x8'));var sox=require(_0x7585('0x9'));var csv=require(_0x7585('0xa'));var ejs=require(_0x7585('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7585('0xc'));var crypto=require('crypto');var jsforce=require(_0x7585('0xd'));var deskjs=require(_0x7585('0xe'));var toCsv=require(_0x7585('0xa'));var querystring=require(_0x7585('0xf'));var Papa=require(_0x7585('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7585('0x11'));var as=require(_0x7585('0x12'));var hardwareService=require(_0x7585('0x13'));var logger=require(_0x7585('0x14'))(_0x7585('0x15'));var utils=require(_0x7585('0x16'));var config=require(_0x7585('0x17'));var licenseUtil=require(_0x7585('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x7585('0x19')]=_[_0x7585('0x1a')](config[_0x7585('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x7585('0x1b'))(new Redis(config[_0x7585('0x19')]));require(_0x7585('0x1c'))[_0x7585('0x1d')](socket);function respondWithStatusCode(_0x5a042d,_0x5f4690){_0x5f4690=_0x5f4690||0xcc;return function(_0x1c1438){if(_0x1c1438){return _0x5a042d[_0x7585('0x1e')](_0x5f4690);}return _0x5a042d[_0x7585('0x1f')](_0x5f4690)[_0x7585('0x20')]();};}function respondWithResult(_0x4e1840,_0x40f367){_0x40f367=_0x40f367||0xc8;return function(_0x104d2a){if(_0x104d2a){return _0x4e1840[_0x7585('0x1f')](_0x40f367)[_0x7585('0x21')](_0x104d2a);}};}function respondWithFilteredResult(_0x4987ed,_0x3f2ab2){return function(_0x350a57){if(_0x350a57){var _0x1c5c90=typeof _0x3f2ab2[_0x7585('0x22')]===_0x7585('0x23')&&typeof _0x3f2ab2['limit']===_0x7585('0x23');var _0x18a2bc=_0x350a57[_0x7585('0x24')];var _0x446540=_0x1c5c90?0x0:_0x3f2ab2[_0x7585('0x22')];var _0x5b1b36=_0x1c5c90?_0x350a57[_0x7585('0x24')]:_0x3f2ab2['offset']+_0x3f2ab2[_0x7585('0x25')];var _0x18fd81;if(_0x5b1b36>=_0x18a2bc){_0x5b1b36=_0x18a2bc;_0x18fd81=0xc8;}else{_0x18fd81=0xce;}_0x4987ed[_0x7585('0x1f')](_0x18fd81);return _0x4987ed[_0x7585('0x26')](_0x7585('0x27'),_0x446540+'-'+_0x5b1b36+'/'+_0x18a2bc)[_0x7585('0x21')](_0x350a57);}return null;};}function patchUpdates(_0x16bcd9){return function(_0x2a81c3){try{jsonpatch[_0x7585('0x28')](_0x2a81c3,_0x16bcd9,!![]);}catch(_0x22e7b7){return BPromise['reject'](_0x22e7b7);}return _0x2a81c3[_0x7585('0x29')]();};}function saveUpdates(_0x51cb65,_0x46c40c){return function(_0x8523cb){if(_0x8523cb){return _0x8523cb[_0x7585('0x2a')](_0x51cb65)[_0x7585('0x2b')](function(_0x289b59){return _0x289b59;});}return null;};}function removeEntity(_0x23f3b6,_0xb8204){return function(_0x484ace){if(_0x484ace){return _0x484ace['destroy']()[_0x7585('0x2b')](function(){var _0x574f43=_0x484ace['get']({'plain':!![]});var _0x39b3f4=_0x7585('0x2c');return db['UserProfileResource'][_0x7585('0x2d')]({'where':{'type':_0x39b3f4,'resourceId':_0x574f43['id']}})[_0x7585('0x2b')](function(){return _0x484ace;});})['then'](function(){_0x23f3b6[_0x7585('0x1f')](0xcc)[_0x7585('0x20')]();});}};}function handleEntityNotFound(_0x2b78be,_0x127248){return function(_0x2f7d3b){if(!_0x2f7d3b){_0x2b78be['sendStatus'](0x194);}return _0x2f7d3b;};}function handleError(_0x1e18e6,_0x24deda){_0x24deda=_0x24deda||0x1f4;return function(_0x1ac8a6){logger['error'](_0x1ac8a6[_0x7585('0x2e')]);if(_0x1ac8a6[_0x7585('0x2f')]){delete _0x1ac8a6['name'];}_0x1e18e6['status'](_0x24deda)[_0x7585('0x30')](_0x1ac8a6);};}exports[_0x7585('0x31')]=function(_0x2c47e5,_0x2a3416){var _0x2a3c83={},_0x29437d={},_0x5543ad={'count':0x0,'rows':[]};var _0x4f24c7=_[_0x7585('0x32')](db[_0x7585('0x33')][_0x7585('0x34')],function(_0xf99cb8){return{'name':_0xf99cb8['fieldName'],'type':_0xf99cb8[_0x7585('0x35')][_0x7585('0x36')]};});_0x29437d[_0x7585('0x37')]=_['map'](_0x4f24c7,_0x7585('0x2f'));_0x29437d['query']=_[_0x7585('0x38')](_0x2c47e5[_0x7585('0x39')]);_0x29437d['filters']=_[_0x7585('0x3a')](_0x29437d[_0x7585('0x37')],_0x29437d[_0x7585('0x39')]);_0x2a3c83[_0x7585('0x3b')]=_[_0x7585('0x3a')](_0x29437d[_0x7585('0x37')],qs[_0x7585('0x3c')](_0x2c47e5[_0x7585('0x39')][_0x7585('0x3c')]));_0x2a3c83[_0x7585('0x3b')]=_0x2a3c83[_0x7585('0x3b')][_0x7585('0x3d')]?_0x2a3c83[_0x7585('0x3b')]:_0x29437d['model'];if(!_0x2c47e5[_0x7585('0x39')][_0x7585('0x3e')](_0x7585('0x3f'))){_0x2a3c83[_0x7585('0x25')]=qs[_0x7585('0x25')](_0x2c47e5[_0x7585('0x39')][_0x7585('0x25')]);_0x2a3c83[_0x7585('0x22')]=qs[_0x7585('0x22')](_0x2c47e5['query'][_0x7585('0x22')]);}_0x2a3c83[_0x7585('0x40')]=qs['sort'](_0x2c47e5[_0x7585('0x39')][_0x7585('0x41')]);_0x2a3c83['where']=qs['filters'](_[_0x7585('0x42')](_0x2c47e5[_0x7585('0x39')],_0x29437d['filters']),_0x4f24c7);if(_0x2c47e5[_0x7585('0x39')][_0x7585('0x43')]){_0x2a3c83[_0x7585('0x44')]=_[_0x7585('0x45')](_0x2a3c83[_0x7585('0x44')],{'$or':_['map'](_0x4f24c7,function(_0x2d53a7){if(_0x2d53a7[_0x7585('0x35')]!==_0x7585('0x46')){var _0x5e180a={};_0x5e180a[_0x2d53a7[_0x7585('0x2f')]]={'$like':'%'+_0x2c47e5[_0x7585('0x39')]['filter']+'%'};return _0x5e180a;}})});}_0x2a3c83=_[_0x7585('0x45')]({},_0x2a3c83,_0x2c47e5[_0x7585('0x47')]);var _0x501e6f={'where':_0x2a3c83['where']};return db[_0x7585('0x33')][_0x7585('0x24')](_0x501e6f)[_0x7585('0x2b')](function(_0x399f33){_0x5543ad[_0x7585('0x24')]=_0x399f33;if(_0x2c47e5[_0x7585('0x39')][_0x7585('0x48')]){_0x2a3c83[_0x7585('0x49')]=[{'all':!![]}];}return db[_0x7585('0x33')][_0x7585('0x4a')](_0x2a3c83);})['then'](function(_0x506452){_0x5543ad[_0x7585('0x4b')]=_0x506452;return _0x5543ad;})[_0x7585('0x2b')](respondWithFilteredResult(_0x2a3416,_0x2a3c83))[_0x7585('0x4c')](handleError(_0x2a3416,null));};exports['show']=function(_0x4235ed,_0x449bd8){var _0x1ec326={'raw':![],'where':{'id':_0x4235ed[_0x7585('0x4d')]['id']}},_0x324e26={};_0x324e26[_0x7585('0x37')]=_['keys'](db[_0x7585('0x33')][_0x7585('0x34')]);_0x324e26[_0x7585('0x39')]=_['keys'](_0x4235ed[_0x7585('0x39')]);_0x324e26[_0x7585('0x4e')]=_['intersection'](_0x324e26[_0x7585('0x37')],_0x324e26[_0x7585('0x39')]);_0x1ec326[_0x7585('0x3b')]=_[_0x7585('0x3a')](_0x324e26['model'],qs[_0x7585('0x3c')](_0x4235ed[_0x7585('0x39')][_0x7585('0x3c')]));_0x1ec326[_0x7585('0x3b')]=_0x1ec326[_0x7585('0x3b')][_0x7585('0x3d')]?_0x1ec326['attributes']:_0x324e26['model'];if(_0x4235ed['query'][_0x7585('0x48')]){_0x1ec326[_0x7585('0x49')]=[{'all':!![]}];}_0x1ec326=_[_0x7585('0x45')]({},_0x1ec326,_0x4235ed[_0x7585('0x47')]);return db[_0x7585('0x33')]['find'](_0x1ec326)[_0x7585('0x2b')](handleEntityNotFound(_0x449bd8,null))[_0x7585('0x2b')](respondWithResult(_0x449bd8,null))[_0x7585('0x4c')](handleError(_0x449bd8,null));};exports[_0x7585('0x4f')]=function(_0x2e6522,_0x212d35){return db[_0x7585('0x33')][_0x7585('0x4f')](_0x2e6522[_0x7585('0x50')],{})[_0x7585('0x2b')](function(_0x557b1e){var _0x52cd09=_0x2e6522[_0x7585('0x51')][_0x7585('0x52')]({'plain':!![]});if(!_0x52cd09)throw new Error(_0x7585('0x53'));if(_0x52cd09[_0x7585('0x54')]===_0x7585('0x51')){var _0x33b7c9=_0x557b1e[_0x7585('0x52')]({'plain':!![]});var _0x149d55=_0x7585('0x2c');return db[_0x7585('0x55')][_0x7585('0x56')]({'where':{'name':_0x149d55,'userProfileId':_0x52cd09[_0x7585('0x57')]},'raw':!![]})[_0x7585('0x2b')](function(_0x1f103d){if(_0x1f103d&&_0x1f103d[_0x7585('0x58')]===0x0){return db[_0x7585('0x59')][_0x7585('0x4f')]({'name':_0x33b7c9[_0x7585('0x2f')],'resourceId':_0x33b7c9['id'],'type':_0x1f103d[_0x7585('0x2f')],'sectionId':_0x1f103d['id']},{})['then'](function(){return _0x557b1e;});}else{return _0x557b1e;}})[_0x7585('0x4c')](function(_0x3a03a4){logger['error'](_0x7585('0x5a'),_0x3a03a4);throw _0x3a03a4;});}return _0x557b1e;})[_0x7585('0x2b')](respondWithResult(_0x212d35,0xc9))[_0x7585('0x4c')](handleError(_0x212d35,null));};exports['update']=function(_0x3d4962,_0x1a2927){if(_0x3d4962[_0x7585('0x50')]['id']){delete _0x3d4962['body']['id'];}return db[_0x7585('0x33')][_0x7585('0x56')]({'where':{'id':_0x3d4962['params']['id']}})[_0x7585('0x2b')](handleEntityNotFound(_0x1a2927,null))['then'](saveUpdates(_0x3d4962[_0x7585('0x50')],null))['then'](respondWithResult(_0x1a2927,null))[_0x7585('0x4c')](handleError(_0x1a2927,null));};exports['destroy']=function(_0x15c7df,_0x1c7d30){return db[_0x7585('0x33')][_0x7585('0x56')]({'where':{'id':_0x15c7df[_0x7585('0x4d')]['id']}})[_0x7585('0x2b')](handleEntityNotFound(_0x1c7d30,null))['then'](removeEntity(_0x1c7d30,null))[_0x7585('0x4c')](handleError(_0x1c7d30,null));};exports[_0x7585('0x5b')]=function(_0x3a5922,_0x5dd325){return db[_0x7585('0x33')]['describe']()[_0x7585('0x2b')](respondWithResult(_0x5dd325,null))['catch'](handleError(_0x5dd325,null));};exports['addDisposition']=function(_0x5be664,_0x42032e,_0x33c0bd){if(_0x5be664[_0x7585('0x50')]['id']){delete _0x5be664[_0x7585('0x50')]['id'];}return db[_0x7585('0x33')][_0x7585('0x56')]({'where':{'id':_0x5be664['params']['id']}})[_0x7585('0x2b')](handleEntityNotFound(_0x42032e,null))[_0x7585('0x2b')](function(_0x4d77d8){if(_0x4d77d8){_0x5be664[_0x7585('0x50')][_0x7585('0x5c')]=_0x4d77d8['id'];return db[_0x7585('0x5d')]['create'](_0x5be664[_0x7585('0x50')]);}})['then'](respondWithResult(_0x42032e,null))['catch'](handleError(_0x42032e,null));};exports[_0x7585('0x5e')]=function(_0x28e592,_0x1f4066,_0x118632){var _0x1bb500={'raw':![],'where':{}};var _0x147f61={};var _0x103b24={'count':0x0,'rows':[]};return db[_0x7585('0x33')]['findOne']({'where':{'id':_0x28e592[_0x7585('0x4d')]['id']}})[_0x7585('0x2b')](handleEntityNotFound(_0x1f4066,null))[_0x7585('0x2b')](function(_0x248729){if(_0x248729){_0x147f61[_0x7585('0x37')]=_['keys'](db[_0x7585('0x5d')][_0x7585('0x34')]);_0x147f61[_0x7585('0x39')]=_[_0x7585('0x38')](_0x28e592[_0x7585('0x39')]);_0x147f61[_0x7585('0x4e')]=_[_0x7585('0x3a')](_0x147f61[_0x7585('0x37')],_0x147f61['query']);_0x1bb500[_0x7585('0x3b')]=_[_0x7585('0x3a')](_0x147f61['model'],qs[_0x7585('0x3c')](_0x28e592[_0x7585('0x39')][_0x7585('0x3c')]));_0x1bb500[_0x7585('0x3b')]=_0x1bb500['attributes'][_0x7585('0x3d')]?_0x1bb500[_0x7585('0x3b')]:_0x147f61[_0x7585('0x37')];if(!_0x28e592[_0x7585('0x39')][_0x7585('0x3e')]('nolimit')){_0x1bb500[_0x7585('0x25')]=qs[_0x7585('0x25')](_0x28e592['query'][_0x7585('0x25')]);_0x1bb500[_0x7585('0x22')]=qs[_0x7585('0x22')](_0x28e592['query']['offset']);}_0x1bb500[_0x7585('0x40')]=qs['sort'](_0x28e592[_0x7585('0x39')]['sort']);_0x1bb500[_0x7585('0x44')]=qs['filters'](_[_0x7585('0x42')](_0x28e592[_0x7585('0x39')],_0x147f61[_0x7585('0x4e')]));_0x1bb500['where'][_0x7585('0x5c')]=_0x248729['id'];if(_0x28e592[_0x7585('0x39')][_0x7585('0x43')]){_0x1bb500[_0x7585('0x44')]=_[_0x7585('0x45')](_0x1bb500[_0x7585('0x44')],{'$or':_['map'](_0x1bb500[_0x7585('0x3b')],function(_0x588abb){var _0x541762={};_0x541762[_0x588abb]={'$like':'%'+_0x28e592[_0x7585('0x39')][_0x7585('0x43')]+'%'};return _0x541762;})});}_0x1bb500=_[_0x7585('0x45')]({},_0x1bb500,_0x28e592['options']);return db['Disposition'][_0x7585('0x24')]({'where':_0x1bb500[_0x7585('0x44')]})['then'](function(_0x275bba){_0x103b24[_0x7585('0x24')]=_0x275bba;if(_0x28e592[_0x7585('0x39')]['includeAll']){_0x1bb500[_0x7585('0x49')]=[{'all':!![]}];}return db[_0x7585('0x5d')][_0x7585('0x4a')](_0x1bb500);})[_0x7585('0x2b')](function(_0x1ad62f){_0x103b24[_0x7585('0x4b')]=_0x1ad62f;return _0x103b24;});}})['then'](respondWithFilteredResult(_0x1f4066,_0x1bb500))[_0x7585('0x4c')](handleError(_0x1f4066,null));};exports[_0x7585('0x5f')]=function(_0x4103a7,_0x3b4af3,_0x4b974d){return db[_0x7585('0x33')][_0x7585('0x56')]({'where':{'id':_0x4103a7['params']['id']}})['then'](handleEntityNotFound(_0x3b4af3,null))[_0x7585('0x2b')](function(_0x306b1a){if(_0x306b1a){return _0x306b1a[_0x7585('0x5f')](_0x4103a7[_0x7585('0x39')][_0x7585('0x60')]);}})[_0x7585('0x2b')](respondWithStatusCode(_0x3b4af3,null))[_0x7585('0x4c')](handleError(_0x3b4af3,null));};exports[_0x7585('0x61')]=function(_0x543ded,_0x285bcb,_0x38bb80){return db[_0x7585('0x33')]['find']({'where':{'id':_0x543ded['params']['id']}})[_0x7585('0x2b')](handleEntityNotFound(_0x285bcb,null))[_0x7585('0x2b')](function(_0x514649){if(_0x514649){var _0x5d4cee=[];var _0x1f058d={'success':[],'errors':[]};return db[_0x7585('0x62')][_0x7585('0x5b')]()[_0x7585('0x2b')](function(_0x42f3e7){if(_0x543ded[_0x7585('0x50')][_0x7585('0x63')]&&_['isArray'](_0x543ded['body'][_0x7585('0x63')])){if(_0x543ded[_0x7585('0x50')][_0x7585('0x63')][_0x7585('0x3d')]){_0x543ded[_0x7585('0x50')][_0x7585('0x63')]=_0x543ded[_0x7585('0x50')][_0x7585('0x63')][_0x7585('0x64')](';')+';';}else{_0x543ded[_0x7585('0x50')][_0x7585('0x63')]=null;}}else{_0x543ded[_0x7585('0x50')][_0x7585('0x63')]=null;}if(_0x543ded[_0x7585('0x50')]&&_[_0x7585('0x65')](_0x543ded['body'])){for(var _0x1dad25=0x0;_0x1dad25<_0x543ded[_0x7585('0x50')][_0x7585('0x3d')];_0x1dad25+=0x1){_0x543ded['body'][_0x1dad25][_0x7585('0x5c')]=_0x543ded['params']['id'];_0x5d4cee[_0x7585('0x66')](_0x543ded[_0x7585('0x50')][_0x1dad25]);}return BPromise[_0x7585('0x67')](_0x5d4cee,function(_0xfb7754){return db['CmContact'][_0x7585('0x4f')](_[_0x7585('0x68')](_0xfb7754,[_0x7585('0x60'),'id'])||{},{'fields':_[_0x7585('0x38')](_0x42f3e7),'raw':!![]})[_0x7585('0x2b')](function(_0xf76c30){_0x1f058d[_0x7585('0x69')][_0x7585('0x66')](_0xf76c30[_0x7585('0x6a')]);})['catch'](function(_0x2ae949){_0x1f058d[_0x7585('0x6b')]['push']({'data':_0xfb7754,'error':_0x2ae949[_0x7585('0x6c')]});});})['then'](function(_0x5592f6){return _0x1f058d;})[_0x7585('0x4c')](function(_0x5b5b08){return _0x5b5b08;});}else{_0x285bcb['status'](0x190)[_0x7585('0x21')]({'message':_0x7585('0x6d')});}});}})[_0x7585('0x2b')](respondWithResult(_0x285bcb,null))[_0x7585('0x4c')](handleError(_0x285bcb,null));};exports[_0x7585('0x6e')]=function(_0x47744d,_0x269d97,_0x2b0839){var _0x4abbed;return db[_0x7585('0x33')]['find']({'where':{'id':_0x47744d[_0x7585('0x4d')]['id']},'include':[{'model':db[_0x7585('0x6f')],'as':'CustomFields'}]})[_0x7585('0x2b')](handleEntityNotFound(_0x269d97,null))[_0x7585('0x2b')](function(_0xfb4c5e){if(_0xfb4c5e){_0x4abbed=_0xfb4c5e;return db[_0x7585('0x62')][_0x7585('0x34')];}})['then'](function(_0x20591d){if(_0x20591d){var _0x1da460={};var _0x5add1d={};_0x5add1d[_0x7585('0x37')]=_['concat'](_[_0x7585('0x38')](_0x20591d),_['map'](_0x4abbed[_0x7585('0x70')],function(_0x31ec14){return util[_0x7585('0x71')](_0x7585('0x72'),_0x31ec14['id']);}));_0x5add1d[_0x7585('0x39')]=_[_0x7585('0x38')](_0x47744d[_0x7585('0x39')]);_0x5add1d[_0x7585('0x4e')]=_['intersection'](_0x5add1d[_0x7585('0x37')],_0x5add1d[_0x7585('0x39')]);_0x1da460[_0x7585('0x3b')]=_[_0x7585('0x3a')](_0x5add1d['model'],qs[_0x7585('0x3c')](_0x47744d[_0x7585('0x39')][_0x7585('0x3c')]));_0x1da460[_0x7585('0x3b')]=_0x1da460[_0x7585('0x3b')][_0x7585('0x3d')]?_0x1da460[_0x7585('0x3b')]:_0x5add1d[_0x7585('0x37')];if(!_0x47744d[_0x7585('0x39')][_0x7585('0x3e')](_0x7585('0x3f'))){_0x1da460[_0x7585('0x25')]=qs[_0x7585('0x25')](_0x47744d[_0x7585('0x39')][_0x7585('0x25')]);_0x1da460[_0x7585('0x22')]=qs['offset'](_0x47744d[_0x7585('0x39')][_0x7585('0x22')]);}_0x1da460[_0x7585('0x40')]=qs[_0x7585('0x41')](_0x47744d['query'][_0x7585('0x41')]);_0x1da460['where']=qs[_0x7585('0x4e')](_[_0x7585('0x42')](_0x47744d[_0x7585('0x39')],_0x5add1d['filters']));_0x1da460[_0x7585('0x73')]=!![];if(_0x47744d[_0x7585('0x39')]['filter']){_0x1da460[_0x7585('0x44')]=_['merge'](_0x1da460[_0x7585('0x44')],{'$or':_[_0x7585('0x32')](_0x1da460[_0x7585('0x3b')],function(_0x3669ff){var _0x158896={};_0x158896[_0x3669ff]={'$like':'%'+_0x47744d['query'][_0x7585('0x43')]+'%'};return _0x158896;})});}_0x1da460=_['merge']({},_0x1da460,_0x47744d['options']);return _0x4abbed[_0x7585('0x6e')](_0x1da460);}})[_0x7585('0x2b')](respondWithResult(_0x269d97,null))[_0x7585('0x4c')](handleError(_0x269d97,null));};exports[_0x7585('0x74')]=function(_0x52ac7b,_0x20ae16,_0x1623f9){var _0x492f5d;var _0x160f14;var _0x305bf7;var _0x222399=_0x52ac7b[_0x7585('0x4d')]['id'];csv_results=[];return db[_0x7585('0x75')]['findAll']({'attributes':['id',_0x7585('0x2f')],'raw':!![],'order':['OrderBy']})[_0x7585('0x2b')](function(_0x3962aa){_0x492f5d=_0x3962aa;var _0x4360fc=_[_0x7585('0x38')](db[_0x7585('0x62')][_0x7585('0x34')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x7585('0x76')]})[_0x7585('0x2b')](function(_0x3f8f58){_0x160f14=_0x3f8f58;var _0x5d18c2=squel[_0x7585('0x77')]()[_0x7585('0x3c')](_0x4360fc)[_0x7585('0x78')](_0x7585('0x79'),'c')[_0x7585('0x44')]('c.ListId\x20=\x20?',_0x222399)[_0x7585('0x44')](_0x7585('0x7a'))[_0x7585('0x7b')]();for(var _0x245786=0x0;_0x245786<_0x160f14['length'];_0x245786++){_0x5d18c2[_0x7585('0x7c')](_0x7585('0x7d')+_0x160f14[_0x245786]['id'],'customField_'+_0x160f14[_0x245786][_0x7585('0x76')]);}for(var _0x245786=0x0;_0x245786<_0x492f5d[_0x7585('0x3d')];_0x245786++){_0x5d18c2['field'](squel[_0x7585('0x77')]()[_0x7585('0x7c')]('item')[_0x7585('0x78')](_0x7585('0x7e'))[_0x7585('0x44')](_0x7585('0x7f'),_0x492f5d[_0x245786]['id'])[_0x7585('0x44')](_0x7585('0x80')),_0x7585('0x81')+_0x492f5d[_0x245786][_0x7585('0x2f')]);_0x5d18c2['field'](squel[_0x7585('0x77')]()[_0x7585('0x7c')](_0x7585('0x82'))[_0x7585('0x78')](_0x7585('0x7e'))['where'](_0x7585('0x7f'),_0x492f5d[_0x245786]['id'])[_0x7585('0x44')](_0x7585('0x80')),'description_additionalPhone_'+_0x492f5d[_0x245786][_0x7585('0x2f')]);}var _0x8e8d88=[];_0x8e8d88[_0x7585('0x66')](_0x5d18c2[_0x7585('0x83')]());BPromise[_0x7585('0x67')](_0x8e8d88,handleQuery)[_0x7585('0x2b')](function(_0x205755){handleQuery(_0x5d18c2['toString']());var _0x5c713d=csv_results[0x0];if(!_[_0x7585('0x84')](_0x5c713d)){var _0x40838b=toCsv(_0x5c713d);var _0x3ff1b4=Date[_0x7585('0x85')]();fs[_0x7585('0x86')](util['format']('/tmp/list_%d_%s.csv',_0x222399,_0x3ff1b4),_0x40838b);_0x20ae16[_0x7585('0x87')](_0x7585('0x88'),_0x7585('0x89')+util[_0x7585('0x71')]('list_%d_%s.csv',_0x222399,_0x3ff1b4));_0x20ae16[_0x7585('0x87')]('Content-type',_0x7585('0x8a'));return _0x20ae16[_0x7585('0x8b')](util[_0x7585('0x71')](_0x7585('0x8c'),_0x222399,_0x3ff1b4));}else{return _0x20ae16['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x364c4c,_0x245016,_0x392e2b){var _0x37884d;delete _0x364c4c[_0x7585('0x50')]['id'];return db[_0x7585('0x33')][_0x7585('0x8d')]({'where':{'id':_0x364c4c[_0x7585('0x4d')]['id']}})['then'](handleEntityNotFound(_0x245016,null))[_0x7585('0x2b')](function(_0x42c678){if(_0x42c678){return db[_0x7585('0x8e')][_0x7585('0x8f')](function(_0x5c5047){return db[_0x7585('0x6f')][_0x7585('0x4f')](_0x364c4c['body'],{'transaction':_0x5c5047})[_0x7585('0x2b')](function(_0x1fdc71){_0x37884d=_0x1fdc71;return _0x42c678[_0x7585('0x90')](_0x1fdc71,{'transaction':_0x5c5047});})[_0x7585('0x2b')](function(){var _0x2f2a8e={'type':db[_0x7585('0x91')][_0x7585('0x92')],'transaction':_0x5c5047};switch(_0x364c4c[_0x7585('0x50')]['type']){case _0x7585('0x93'):_0x2f2a8e[_0x7585('0x35')]=db[_0x7585('0x91')][_0x7585('0x92')];break;case _0x7585('0x94'):_0x2f2a8e[_0x7585('0x35')]=db[_0x7585('0x91')][_0x7585('0x95')];break;case _0x7585('0x96'):_0x2f2a8e[_0x7585('0x35')]=db[_0x7585('0x91')][_0x7585('0x97')];_0x2f2a8e[_0x7585('0x98')]=![];break;default:}return db[_0x7585('0x8e')][_0x7585('0x99')][_0x7585('0x9a')](_0x7585('0x79'),util['format']('cf_%s',_0x37884d['id']),_0x2f2a8e);})[_0x7585('0x2b')](function(){return _0x37884d;});});}})[_0x7585('0x2b')](respondWithResult(_0x245016,null))[_0x7585('0x4c')](handleError(_0x245016,null));};exports[_0x7585('0x9b')]=function(_0x193be8,_0x19967c,_0x1369d7){var _0x1ad9db={};var _0x25aa3a={};var _0x7f4360;var _0x767093;return db[_0x7585('0x33')][_0x7585('0x8d')]({'where':{'id':_0x193be8['params']['id']}})[_0x7585('0x2b')](handleEntityNotFound(_0x19967c,null))[_0x7585('0x2b')](function(_0x400591){if(_0x400591){_0x7f4360=_0x400591;_0x25aa3a[_0x7585('0x37')]=_['keys'](db[_0x7585('0x6f')][_0x7585('0x34')]);_0x25aa3a['query']=_[_0x7585('0x38')](_0x193be8[_0x7585('0x39')]);_0x25aa3a['filters']=_['intersection'](_0x25aa3a[_0x7585('0x37')],_0x25aa3a[_0x7585('0x39')]);_0x1ad9db[_0x7585('0x3b')]=_['intersection'](_0x25aa3a['model'],qs['fields'](_0x193be8[_0x7585('0x39')][_0x7585('0x3c')]));_0x1ad9db[_0x7585('0x3b')]=_0x1ad9db[_0x7585('0x3b')][_0x7585('0x3d')]?_0x1ad9db[_0x7585('0x3b')]:_0x25aa3a[_0x7585('0x37')];_0x1ad9db[_0x7585('0x40')]=qs['sort'](_0x193be8[_0x7585('0x39')][_0x7585('0x41')]);_0x1ad9db['where']=qs[_0x7585('0x4e')](_[_0x7585('0x42')](_0x193be8['query'],_0x25aa3a[_0x7585('0x4e')]));_0x1ad9db['where']=_[_0x7585('0x45')](_0x1ad9db[_0x7585('0x44')],{'$or':[{'ListId':_0x400591['id']},{'ListId':null}]});if(_0x193be8['query']['filter']){_0x1ad9db[_0x7585('0x44')]=_[_0x7585('0x45')](_0x1ad9db['where'],{'$or':_['map'](_0x1ad9db[_0x7585('0x3b')],function(_0x55cfe7){var _0x3427d3={};_0x3427d3[_0x55cfe7]={'$like':'%'+_0x193be8[_0x7585('0x39')]['filter']+'%'};return _0x3427d3;})});}_0x1ad9db=_[_0x7585('0x45')]({},_0x1ad9db,_0x193be8['options']);return db[_0x7585('0x6f')][_0x7585('0x9c')](_0x1ad9db);}})[_0x7585('0x2b')](respondWithResult(_0x19967c,null))[_0x7585('0x4c')](handleError(_0x19967c,null));};exports[_0x7585('0x9d')]=function(_0x5bb3e1,_0x3897f1){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})[_0x7585('0x2b')](handleEntityNotFound(_0x3897f1,null))[_0x7585('0x2b')](function(_0x59e583){return _0x59e583;})[_0x7585('0x2b')](respondWithResult(_0x3897f1,null))[_0x7585('0x4c')](handleError(_0x3897f1,null));};exports[_0x7585('0x9e')]=function(_0xa5947c,_0x5e90b1,_0x190fd9){return db['CmList'][_0x7585('0x56')]({'where':{'id':_0xa5947c['params']['id']}})[_0x7585('0x2b')](handleEntityNotFound(_0x5e90b1,null))[_0x7585('0x2b')](function(_0x251b52){if(_0x251b52){return _0x251b52[_0x7585('0x9e')](_0xa5947c[_0x7585('0x50')]['ids'],_[_0x7585('0x68')](_0xa5947c[_0x7585('0x50')],[_0x7585('0x60'),'id'])||{})['spread'](function(_0x474ec3){for(var _0x4aab68=0x0;_0x4aab68<_0xa5947c[_0x7585('0x50')][_0x7585('0x60')][_0x7585('0x3d')];_0x4aab68+=0x1){socket['emit'](_0x7585('0x9f'),{'UserId':Number(_0xa5947c[_0x7585('0x50')][_0x7585('0x60')][_0x4aab68]),'CmListId':Number(_0xa5947c[_0x7585('0x4d')]['id'])});}return _0x474ec3;});}})['then'](respondWithResult(_0x5e90b1,null))[_0x7585('0x4c')](handleError(_0x5e90b1,null));};exports[_0x7585('0xa0')]=function(_0xab9798,_0x26af23,_0x1b3b90){return db[_0x7585('0x33')]['find']({'where':{'id':_0xab9798[_0x7585('0x4d')]['id']}})[_0x7585('0x2b')](handleEntityNotFound(_0x26af23,null))[_0x7585('0x2b')](function(_0x4eca8c){if(_0x4eca8c){return _0x4eca8c[_0x7585('0xa0')](_0xab9798[_0x7585('0x39')][_0x7585('0x60')])[_0x7585('0x2b')](function(){if(_['isArray'](_0xab9798[_0x7585('0x39')][_0x7585('0x60')])){for(var _0x32807a=0x0;_0x32807a<_0xab9798[_0x7585('0x39')][_0x7585('0x60')][_0x7585('0x3d')];_0x32807a+=0x1){socket['emit'](_0x7585('0xa1'),{'UserId':Number(_0xab9798['query'][_0x7585('0x60')][_0x32807a]),'CmListId':Number(_0xab9798['params']['id'])});}}else{socket[_0x7585('0xa2')](_0x7585('0xa1'),{'UserId':Number(_0xab9798[_0x7585('0x39')][_0x7585('0x60')]),'CmListId':Number(_0xab9798[_0x7585('0x4d')]['id'])});}});}})[_0x7585('0x2b')](respondWithStatusCode(_0x26af23,null))[_0x7585('0x4c')](handleError(_0x26af23,null));};exports[_0x7585('0xa3')]=function(_0x2081e1,_0x14e813,_0x56da9a){var _0x5dda2d={};var _0x5ac0e6={};var _0x239949;var _0x2b58b0;return db[_0x7585('0x33')][_0x7585('0x8d')]({'where':{'id':_0x2081e1[_0x7585('0x4d')]['id']}})[_0x7585('0x2b')](handleEntityNotFound(_0x14e813,null))['then'](function(_0x2bf364){if(_0x2bf364){_0x239949=_0x2bf364;_0x5ac0e6['model']=_[_0x7585('0x38')](db[_0x7585('0xa4')]['rawAttributes']);_0x5ac0e6[_0x7585('0x39')]=_['keys'](_0x2081e1[_0x7585('0x39')]);_0x5ac0e6[_0x7585('0x4e')]=_[_0x7585('0x3a')](_0x5ac0e6['model'],_0x5ac0e6[_0x7585('0x39')]);_0x5dda2d[_0x7585('0x3b')]=_[_0x7585('0x3a')](_0x5ac0e6[_0x7585('0x37')],qs[_0x7585('0x3c')](_0x2081e1[_0x7585('0x39')][_0x7585('0x3c')]));_0x5dda2d[_0x7585('0x3b')]=_0x5dda2d[_0x7585('0x3b')]['length']?_0x5dda2d[_0x7585('0x3b')]:_0x5ac0e6[_0x7585('0x37')];_0x5dda2d['order']=qs[_0x7585('0x41')](_0x2081e1[_0x7585('0x39')][_0x7585('0x41')]);_0x5dda2d[_0x7585('0x44')]=qs[_0x7585('0x4e')](_[_0x7585('0x42')](_0x2081e1[_0x7585('0x39')],_0x5ac0e6['filters']));if(_0x2081e1[_0x7585('0x39')][_0x7585('0x43')]){_0x5dda2d[_0x7585('0x44')]=_[_0x7585('0x45')](_0x5dda2d[_0x7585('0x44')],{'$or':_[_0x7585('0x32')](_0x5dda2d[_0x7585('0x3b')],function(_0xf338a8){var _0x43168a={};_0x43168a[_0xf338a8]={'$like':'%'+_0x2081e1[_0x7585('0x39')][_0x7585('0x43')]+'%'};return _0x43168a;})});}_0x5dda2d=_['merge']({},_0x5dda2d,_0x2081e1[_0x7585('0x47')]);return _0x239949['getAgents'](_0x5dda2d);}})['then'](function(_0x4e6c83){if(_0x4e6c83){_0x2b58b0=_0x4e6c83['length'];if(!_0x2081e1[_0x7585('0x39')][_0x7585('0x3e')](_0x7585('0x3f'))){_0x5dda2d[_0x7585('0x25')]=qs[_0x7585('0x25')](_0x2081e1['query'][_0x7585('0x25')]);_0x5dda2d['offset']=qs['offset'](_0x2081e1[_0x7585('0x39')]['offset']);}return _0x239949['getAgents'](_0x5dda2d);}})['then'](function(_0x10dbc9){if(_0x10dbc9){return _0x10dbc9?{'count':_0x2b58b0,'rows':_0x10dbc9}:null;}})[_0x7585('0x2b')](respondWithResult(_0x14e813,null))[_0x7585('0x4c')](handleError(_0x14e813,null));};function handleQuery(_0x5a7745){logger[_0x7585('0xa5')](_0x5a7745);return db[_0x7585('0x8e')]['query'](_0x5a7745)['spread'](function(_0x1ce189){csv_results[_0x7585('0x66')](_0x1ce189);})['catch'](function(_0x6ab26b){logger['error'](_0x6ab26b['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 51880ce..dcfcc83 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0xf60cd0,_0x34bf81){var _0x32ad56=function(_0x44cf0b){while(--_0x44cf0b){_0xf60cd0['push'](_0xf60cd0['shift']());}};_0x32ad56(++_0x34bf81);}(_0x7217,0x19e));var _0x7721=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x7217[_0xf50820];return _0x2a9b10;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x45923f,_0xaa32da){var _0x3072f4=function(_0xa97f78){while(--_0xa97f78){_0x45923f['push'](_0x45923f['shift']());}};_0x3072f4(++_0xaa32da);}(_0x814b,0x1a2));var _0xb814=function(_0x4ca288,_0x254dd8){_0x4ca288=_0x4ca288-0x0;var _0x2362c1=_0x814b[_0x4ca288];return _0x2362c1;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a9e1950..436541c 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(_0xf3556b,_0x5d16ce){var _0x16d23b=function(_0x3cd758){while(--_0x3cd758){_0xf3556b['push'](_0xf3556b['shift']());}};_0x16d23b(++_0x5d16ce);}(_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 _0x6c76=['define','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x2c267e,_0x1c7210){var _0x5c63a7=function(_0x4c03e5){while(--_0x4c03e5){_0x2c267e['push'](_0x2c267e['shift']());}};_0x5c63a7(++_0x1c7210);}(_0x6c76,0x184));var _0x66c7=function(_0x540260,_0x34aed3){_0x540260=_0x540260-0x0;var _0x250bc6=_0x6c76[_0x540260];return _0x250bc6;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./cmList.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 9479a60..e56e1ab 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 _0x479c=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','moment','randomstring'];(function(_0x171446,_0x341df4){var _0x309220=function(_0x1b4e2d){while(--_0x1b4e2d){_0x171446['push'](_0x171446['shift']());}};_0x309220(++_0x341df4);}(_0x479c,0x7e));var _0xc479=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x479c[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xc479('0x0'));var util=require(_0xc479('0x1'));var moment=require(_0xc479('0x2'));var BPromise=require('bluebird');var rs=require(_0xc479('0x3'));var fs=require('fs');var Redis=require(_0xc479('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc479('0x5'));var logger=require(_0xc479('0x6'))('rpc');var config=require(_0xc479('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc479('0x8')][_0xc479('0x9')]({'port':0x232a});config[_0xc479('0xa')]=_['defaults'](config[_0xc479('0xa')],{'host':_0xc479('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc479('0xc'))[_0xc479('0xd')](socket);function respondWithRpcPromise(_0x5505bc,_0x176452,_0x531012){return new BPromise(function(_0x1dcc05,_0x250e74){return client[_0xc479('0xe')](_0x5505bc,_0x531012)[_0xc479('0xf')](function(_0x22430c){logger[_0xc479('0x10')]('CmList,\x20%s,\x20%s',_0x176452,'request\x20sent');logger['debug'](_0xc479('0x11'),_0x176452,'request\x20sent',JSON[_0xc479('0x12')](_0x22430c));if(_0x22430c[_0xc479('0x13')]){if(_0x22430c[_0xc479('0x13')][_0xc479('0x14')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x176452,_0x22430c[_0xc479('0x13')][_0xc479('0x15')]);return _0x250e74(_0x22430c[_0xc479('0x13')][_0xc479('0x15')]);}logger[_0xc479('0x13')](_0xc479('0x16'),_0x176452,_0x22430c[_0xc479('0x13')][_0xc479('0x15')]);return _0x1dcc05(_0x22430c[_0xc479('0x13')][_0xc479('0x15')]);}else{logger[_0xc479('0x10')](_0xc479('0x16'),_0x176452,_0xc479('0x17'));_0x1dcc05(_0x22430c[_0xc479('0x18')][_0xc479('0x15')]);}})[_0xc479('0x19')](function(_0x36d3a2){logger[_0xc479('0x13')]('CmList,\x20%s,\x20%s',_0x176452,_0x36d3a2);_0x250e74(_0x36d3a2);});});} \ No newline at end of file +var _0x7cc1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','then','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x191104,_0x239398){var _0x26eb49=function(_0x4dfca0){while(--_0x4dfca0){_0x191104['push'](_0x191104['shift']());}};_0x26eb49(++_0x239398);}(_0x7cc1,0x1c9));var _0x17cc=function(_0x4db9f5,_0x4de109){_0x4db9f5=_0x4db9f5-0x0;var _0x4ba821=_0x7cc1[_0x4db9f5];return _0x4ba821;};'use strict';var _=require('lodash');var util=require(_0x17cc('0x0'));var moment=require(_0x17cc('0x1'));var BPromise=require(_0x17cc('0x2'));var rs=require(_0x17cc('0x3'));var fs=require('fs');var Redis=require(_0x17cc('0x4'));var db=require(_0x17cc('0x5'))['db'];var utils=require(_0x17cc('0x6'));var logger=require(_0x17cc('0x7'))('rpc');var config=require(_0x17cc('0x8'));var jayson=require(_0x17cc('0x9'));var client=jayson['client'][_0x17cc('0xa')]({'port':0x232a});config[_0x17cc('0xb')]=_[_0x17cc('0xc')](config[_0x17cc('0xb')],{'host':_0x17cc('0xd'),'port':0x18eb});var socket=require(_0x17cc('0xe'))(new Redis(config[_0x17cc('0xb')]));require(_0x17cc('0xf'))['register'](socket);function respondWithRpcPromise(_0x49b893,_0x32fc80,_0x4f9126){return new BPromise(function(_0x3aedbf,_0x14ba18){return client[_0x17cc('0x10')](_0x49b893,_0x4f9126)[_0x17cc('0x11')](function(_0x3696d1){logger[_0x17cc('0x12')]('CmList,\x20%s,\x20%s',_0x32fc80,_0x17cc('0x13'));logger['debug'](_0x17cc('0x14'),_0x32fc80,'request\x20sent',JSON[_0x17cc('0x15')](_0x3696d1));if(_0x3696d1[_0x17cc('0x16')]){if(_0x3696d1[_0x17cc('0x16')][_0x17cc('0x17')]===0x1f4){logger['error'](_0x17cc('0x18'),_0x32fc80,_0x3696d1[_0x17cc('0x16')][_0x17cc('0x19')]);return _0x14ba18(_0x3696d1[_0x17cc('0x16')][_0x17cc('0x19')]);}logger['error'](_0x17cc('0x18'),_0x32fc80,_0x3696d1[_0x17cc('0x16')][_0x17cc('0x19')]);return _0x3aedbf(_0x3696d1[_0x17cc('0x16')]['message']);}else{logger[_0x17cc('0x12')](_0x17cc('0x18'),_0x32fc80,_0x17cc('0x13'));_0x3aedbf(_0x3696d1['result'][_0x17cc('0x19')]);}})[_0x17cc('0x1a')](function(_0x553771){logger[_0x17cc('0x16')](_0x17cc('0x18'),_0x32fc80,_0x553771);_0x14ba18(_0x553771);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0e5bea0..bdd73b0 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 _0x96a3=['./cmList.events','remove','removeListener','register','length','cmList:'];(function(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0x96a3,0x126));var _0x396a=function(_0x480a48,_0x2ca5a8){_0x480a48=_0x480a48-0x0;var _0x2b34ec=_0x96a3[_0x480a48];return _0x2b34ec;};'use strict';var CmListEvents=require(_0x396a('0x0'));var events=['save',_0x396a('0x1'),'update'];function createListener(_0x12092f,_0x483652){return function(_0x7222c9){_0x483652['emit'](_0x12092f,_0x7222c9);};}function removeListener(_0x43ae58,_0x38a348){return function(){CmListEvents[_0x396a('0x2')](_0x43ae58,_0x38a348);};}exports[_0x396a('0x3')]=function(_0x8d54b1){for(var _0x179d44=0x0,_0x64dfa5=events[_0x396a('0x4')];_0x179d44<_0x64dfa5;_0x179d44++){var _0x48a482=events[_0x179d44];var _0x157240=createListener(_0x396a('0x5')+_0x48a482,_0x8d54b1);CmListEvents['on'](_0x48a482,_0x157240);}}; \ No newline at end of file +var _0xa79a=['update','emit','removeListener','length','cmList:','./cmList.events','save'];(function(_0x29f438,_0x1f8613){var _0x2cbba4=function(_0x1589cd){while(--_0x1589cd){_0x29f438['push'](_0x29f438['shift']());}};_0x2cbba4(++_0x1f8613);}(_0xa79a,0x18d));var _0xaa79=function(_0x3ddbeb,_0x1ca101){_0x3ddbeb=_0x3ddbeb-0x0;var _0x1fee10=_0xa79a[_0x3ddbeb];return _0x1fee10;};'use strict';var CmListEvents=require(_0xaa79('0x0'));var events=[_0xaa79('0x1'),'remove',_0xaa79('0x2')];function createListener(_0x2512ba,_0x5b2cc3){return function(_0x2ae0fe){_0x5b2cc3[_0xaa79('0x3')](_0x2512ba,_0x2ae0fe);};}function removeListener(_0x38c1c7,_0x35cbf6){return function(){CmListEvents[_0xaa79('0x4')](_0x38c1c7,_0x35cbf6);};}exports['register']=function(_0x4c3710){for(var _0x6e2250=0x0,_0x50d1a3=events[_0xaa79('0x5')];_0x6e2250<_0x50d1a3;_0x6e2250++){var _0xe3e52f=events[_0x6e2250];var _0x2fea24=createListener(_0xaa79('0x6')+_0xe3e52f,_0x4c3710);CmListEvents['on'](_0xe3e52f,_0x2fea24);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a23f1fa..266869a 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 _0xc694=['path','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addCustomField','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','util'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0xc694,0x11e));var _0x4c69=function(_0x141177,_0x2944fc){_0x141177=_0x141177-0x0;var _0x3014ad=_0xc694[_0x141177];return _0x3014ad;};'use strict';var multer=require(_0x4c69('0x0'));var util=require(_0x4c69('0x1'));var path=require(_0x4c69('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4c69('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4c69('0x4'));var interaction=require(_0x4c69('0x5'));var config=require('../../config/environment');var controller=require(_0x4c69('0x6'));router[_0x4c69('0x7')]('/',auth[_0x4c69('0x8')](),controller[_0x4c69('0x9')]);router[_0x4c69('0x7')](_0x4c69('0xa'),auth[_0x4c69('0x8')](),controller[_0x4c69('0xb')]);router[_0x4c69('0x7')](_0x4c69('0xc'),auth[_0x4c69('0x8')](),controller[_0x4c69('0xd')]);router[_0x4c69('0x7')](_0x4c69('0xe'),auth['isAuthenticated'](),controller[_0x4c69('0xf')]);router[_0x4c69('0x7')](_0x4c69('0x10'),auth[_0x4c69('0x8')](),controller['getDispositions']);router[_0x4c69('0x7')](_0x4c69('0x11'),auth['isAuthenticated'](),controller[_0x4c69('0x12')]);router[_0x4c69('0x7')](_0x4c69('0x13'),auth['isAuthenticated'](),controller[_0x4c69('0x14')]);router[_0x4c69('0x7')](_0x4c69('0x15'),auth['isAuthenticated'](),controller[_0x4c69('0x16')]);router[_0x4c69('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x4c69('0x17')]);router[_0x4c69('0x18')]('/',auth[_0x4c69('0x8')](),controller[_0x4c69('0x19')]);router[_0x4c69('0x18')]('/:id/dispositions',auth[_0x4c69('0x8')](),controller[_0x4c69('0x1a')]);router[_0x4c69('0x18')](_0x4c69('0x11'),auth[_0x4c69('0x8')](),controller['addContacts']);router[_0x4c69('0x18')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4c69('0x1b')]);router[_0x4c69('0x18')](_0x4c69('0x1c'),auth[_0x4c69('0x8')](),controller[_0x4c69('0x1d')]);router[_0x4c69('0x1e')]('/:id',auth[_0x4c69('0x8')](),controller[_0x4c69('0x1f')]);router[_0x4c69('0x20')](_0x4c69('0xe'),auth[_0x4c69('0x8')](),controller[_0x4c69('0x21')]);router[_0x4c69('0x20')](_0x4c69('0x10'),auth[_0x4c69('0x8')](),controller[_0x4c69('0x22')]);router[_0x4c69('0x20')](_0x4c69('0x1c'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x4c69('0x23')]=router; \ No newline at end of file +var _0x9366=['isAuthenticated','index','describe','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','/:id/fields','getAgents','post','create','/:id/contacts','addContacts','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get'];(function(_0x52caa7,_0x1ae5bc){var _0x217612=function(_0x39fb8b){while(--_0x39fb8b){_0x52caa7['push'](_0x52caa7['shift']());}};_0x217612(++_0x1ae5bc);}(_0x9366,0x14a));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6936('0x0'));var path=require(_0x6936('0x1'));var timeout=require(_0x6936('0x2'));var express=require(_0x6936('0x3'));var router=express[_0x6936('0x4')]();var fs_extra=require(_0x6936('0x5'));var auth=require(_0x6936('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6936('0x7'));var controller=require(_0x6936('0x8'));router[_0x6936('0x9')]('/',auth[_0x6936('0xa')](),controller[_0x6936('0xb')]);router['get']('/describe',auth[_0x6936('0xa')](),controller[_0x6936('0xc')]);router['get']('/global_fields',auth['isAuthenticated'](),controller[_0x6936('0xd')]);router[_0x6936('0x9')](_0x6936('0xe'),auth[_0x6936('0xa')](),controller[_0x6936('0xf')]);router['get'](_0x6936('0x10'),auth['isAuthenticated'](),controller[_0x6936('0x11')]);router[_0x6936('0x9')]('/:id/contacts',auth[_0x6936('0xa')](),controller[_0x6936('0x12')]);router[_0x6936('0x9')](_0x6936('0x13'),auth[_0x6936('0xa')](),controller['getContactsCsv']);router[_0x6936('0x9')](_0x6936('0x14'),auth[_0x6936('0xa')](),controller['getCustomFields']);router[_0x6936('0x9')]('/:id/users',auth[_0x6936('0xa')](),controller[_0x6936('0x15')]);router[_0x6936('0x16')]('/',auth[_0x6936('0xa')](),controller[_0x6936('0x17')]);router[_0x6936('0x16')](_0x6936('0x10'),auth[_0x6936('0xa')](),controller['addDisposition']);router['post'](_0x6936('0x18'),auth['isAuthenticated'](),controller[_0x6936('0x19')]);router[_0x6936('0x16')]('/:id/fields',auth['isAuthenticated'](),controller['addCustomField']);router[_0x6936('0x16')](_0x6936('0x1a'),auth[_0x6936('0xa')](),controller[_0x6936('0x1b')]);router[_0x6936('0x1c')](_0x6936('0xe'),auth[_0x6936('0xa')](),controller[_0x6936('0x1d')]);router[_0x6936('0x1e')](_0x6936('0xe'),auth[_0x6936('0xa')](),controller[_0x6936('0x1f')]);router[_0x6936('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x6936('0x20')]);router['delete'](_0x6936('0x1a'),auth[_0x6936('0xa')](),controller[_0x6936('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 60ad11d..6828c43 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 _0x086f=['exports','VIRTUAL','getDataValue','STRING','sequelize'];(function(_0x1e65b9,_0x949ce8){var _0x45cdf8=function(_0x1f766f){while(--_0x1f766f){_0x1e65b9['push'](_0x1e65b9['shift']());}};_0x45cdf8(++_0x949ce8);}(_0x086f,0x72));var _0xf086=function(_0x778c05,_0x368acd){_0x778c05=_0x778c05-0x0;var _0x5c849b=_0x086f[_0x778c05];return _0x5c849b;};'use strict';var Sequelize=require(_0xf086('0x0'));module[_0xf086('0x1')]={'name':{'type':Sequelize[_0xf086('0x2')],'get':function(_0x217a80){return this[_0xf086('0x3')]('field');}},'field':{'type':Sequelize[_0xf086('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xf086('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xf086('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9ccf=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x53130d,_0x1376ad){var _0x29557d=function(_0x6a2482){while(--_0x6a2482){_0x53130d['push'](_0x53130d['shift']());}};_0x29557d(++_0x1376ad);}(_0x9ccf,0xd2));var _0xf9cc=function(_0x57e3f6,_0x52bedc){_0x57e3f6=_0x57e3f6-0x0;var _0xb052d3=_0x9ccf[_0x57e3f6];return _0xb052d3;};'use strict';var Sequelize=require(_0xf9cc('0x0'));module[_0xf9cc('0x1')]={'name':{'type':Sequelize[_0xf9cc('0x2')],'get':function(_0x906351){return this[_0xf9cc('0x3')](_0xf9cc('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xf9cc('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xf9cc('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 7cb3d90..6007fc7 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x440a67,_0x59104){var _0xb6d702=function(_0x1d7fab){while(--_0x1d7fab){_0x440a67['push'](_0x440a67['shift']());}};_0xb6d702(++_0x59104);}(_0x7a54,0x106));var _0x47a5=function(_0x35fdce,_0x4646aa){_0x35fdce=_0x35fdce-0x0;var _0x523e34=_0x7a54[_0x35fdce];return _0x523e34;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x15f161,_0x3378df){var _0x167240=function(_0x4796fb){while(--_0x4796fb){_0x15f161['push'](_0x15f161['shift']());}};_0x167240(++_0x3378df);}(_0x7a54,0x106));var _0x47a5=function(_0x3cb784,_0x59fd07){_0x3cb784=_0x3cb784-0x0;var _0x214994=_0x7a54[_0x3cb784];return _0x214994;};'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 ed1c146..783693d 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 _0xd9b6=['Condition','tools_conditions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xd9b6,0x1a2));var _0x6d9b=function(_0x7a4b16,_0x2c3b70){_0x7a4b16=_0x7a4b16-0x0;var _0x59e441=_0xd9b6[_0x7a4b16];return _0x59e441;};'use strict';var _=require('lodash');var util=require(_0x6d9b('0x0'));var logger=require(_0x6d9b('0x1'))(_0x6d9b('0x2'));var moment=require(_0x6d9b('0x3'));var BPromise=require(_0x6d9b('0x4'));var rp=require(_0x6d9b('0x5'));var fs=require('fs');var path=require(_0x6d9b('0x6'));var rimraf=require(_0x6d9b('0x7'));var config=require(_0x6d9b('0x8'));var attributes=require(_0x6d9b('0x9'));module[_0x6d9b('0xa')]=function(_0x5e11ec,_0x4b58cb){return _0x5e11ec['define'](_0x6d9b('0xb'),attributes,{'tableName':_0x6d9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x060e=['tools_conditions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./condition.attributes','exports','define','Condition'];(function(_0x4aed38,_0x123a62){var _0x1c6b76=function(_0x511d38){while(--_0x511d38){_0x4aed38['push'](_0x4aed38['shift']());}};_0x1c6b76(++_0x123a62);}(_0x060e,0xaa));var _0xe060=function(_0xd37e3d,_0x5c9573){_0xd37e3d=_0xd37e3d-0x0;var _0xff1ac0=_0x060e[_0xd37e3d];return _0xff1ac0;};'use strict';var _=require(_0xe060('0x0'));var util=require(_0xe060('0x1'));var logger=require(_0xe060('0x2'))('api');var moment=require(_0xe060('0x3'));var BPromise=require(_0xe060('0x4'));var rp=require(_0xe060('0x5'));var fs=require('fs');var path=require(_0xe060('0x6'));var rimraf=require(_0xe060('0x7'));var config=require('../../config/environment');var attributes=require(_0xe060('0x8'));module[_0xe060('0x9')]=function(_0x58574a,_0x50c2c7){return _0x58574a[_0xe060('0xa')](_0xe060('0xb'),attributes,{'tableName':_0xe060('0xc'),'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 4444708..cf83d40 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 _0xacd3=['moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x51f130,_0x880c0f){var _0x2af9e2=function(_0x4f0d22){while(--_0x4f0d22){_0x51f130['push'](_0x51f130['shift']());}};_0x2af9e2(++_0x880c0f);}(_0xacd3,0x18d));var _0x3acd=function(_0x45a0c8,_0x2c58ef){_0x45a0c8=_0x45a0c8-0x0;var _0x2599a4=_0xacd3[_0x45a0c8];return _0x2599a4;};'use strict';var _=require(_0x3acd('0x0'));var util=require(_0x3acd('0x1'));var moment=require(_0x3acd('0x2'));var BPromise=require(_0x3acd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3acd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3acd('0x5'))('rpc');var config=require(_0x3acd('0x6'));var jayson=require(_0x3acd('0x7'));var client=jayson[_0x3acd('0x8')][_0x3acd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17b447,_0x4e631e,_0x50cb4b){return new BPromise(function(_0x1c1952,_0x112719){return client['request'](_0x17b447,_0x50cb4b)[_0x3acd('0xa')](function(_0xdcb52){logger[_0x3acd('0xb')](_0x3acd('0xc'),_0x4e631e,_0x3acd('0xd'));logger['debug'](_0x3acd('0xe'),_0x4e631e,_0x3acd('0xd'),JSON[_0x3acd('0xf')](_0xdcb52));if(_0xdcb52[_0x3acd('0x10')]){if(_0xdcb52[_0x3acd('0x10')][_0x3acd('0x11')]===0x1f4){logger[_0x3acd('0x10')]('Condition,\x20%s,\x20%s',_0x4e631e,_0xdcb52[_0x3acd('0x10')][_0x3acd('0x12')]);return _0x112719(_0xdcb52['error']['message']);}logger['error'](_0x3acd('0xc'),_0x4e631e,_0xdcb52['error'][_0x3acd('0x12')]);return _0x1c1952(_0xdcb52[_0x3acd('0x10')][_0x3acd('0x12')]);}else{logger[_0x3acd('0xb')](_0x3acd('0xc'),_0x4e631e,_0x3acd('0xd'));_0x1c1952(_0xdcb52[_0x3acd('0x13')]['message']);}})[_0x3acd('0x14')](function(_0x23d0d7){logger['error'](_0x3acd('0xc'),_0x4e631e,_0x23d0d7);_0x112719(_0x23d0d7);});});} \ No newline at end of file +var _0x2ccf=['Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','../../mysqldb','../../config/utils','rpc','client','http','request','then','info'];(function(_0x4ba177,_0x199ee3){var _0x10b673=function(_0x3f0fee){while(--_0x3f0fee){_0x4ba177['push'](_0x4ba177['shift']());}};_0x10b673(++_0x199ee3);}(_0x2ccf,0x119));var _0xf2cc=function(_0xc5ff05,_0x12a592){_0xc5ff05=_0xc5ff05-0x0;var _0x1926ff=_0x2ccf[_0xc5ff05];return _0x1926ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2cc('0x0'))['db'];var utils=require(_0xf2cc('0x1'));var logger=require('../../config/logger')(_0xf2cc('0x2'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf2cc('0x3')][_0xf2cc('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x412cb7,_0x1f9b81,_0x1cc1fa){return new BPromise(function(_0x766067,_0x465e19){return client[_0xf2cc('0x5')](_0x412cb7,_0x1cc1fa)[_0xf2cc('0x6')](function(_0x27a941){logger[_0xf2cc('0x7')](_0xf2cc('0x8'),_0x1f9b81,'request\x20sent');logger[_0xf2cc('0x9')](_0xf2cc('0xa'),_0x1f9b81,'request\x20sent',JSON[_0xf2cc('0xb')](_0x27a941));if(_0x27a941[_0xf2cc('0xc')]){if(_0x27a941['error'][_0xf2cc('0xd')]===0x1f4){logger[_0xf2cc('0xc')](_0xf2cc('0x8'),_0x1f9b81,_0x27a941[_0xf2cc('0xc')][_0xf2cc('0xe')]);return _0x465e19(_0x27a941['error']['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x1f9b81,_0x27a941[_0xf2cc('0xc')][_0xf2cc('0xe')]);return _0x766067(_0x27a941[_0xf2cc('0xc')][_0xf2cc('0xe')]);}else{logger[_0xf2cc('0x7')]('Condition,\x20%s,\x20%s',_0x1f9b81,_0xf2cc('0xf'));_0x766067(_0x27a941['result'][_0xf2cc('0xe')]);}})[_0xf2cc('0x10')](function(_0x48b03b){logger[_0xf2cc('0xc')](_0xf2cc('0x8'),_0x1f9b81,_0x48b03b);_0x465e19(_0x48b03b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 396cc68..2d2e688 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 _0xf09b=['update','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x3fff53,_0xf8d045){var _0x41d153=function(_0x432fc5){while(--_0x432fc5){_0x3fff53['push'](_0x3fff53['shift']());}};_0x41d153(++_0xf8d045);}(_0xf09b,0xb4));var _0xbf09=function(_0x4b1edc,_0x412675){_0x4b1edc=_0x4b1edc-0x0;var _0x1f235f=_0xf09b[_0x4b1edc];return _0x1f235f;};'use strict';var multer=require(_0xbf09('0x0'));var util=require(_0xbf09('0x1'));var path=require(_0xbf09('0x2'));var timeout=require(_0xbf09('0x3'));var express=require(_0xbf09('0x4'));var router=express[_0xbf09('0x5')]();var fs_extra=require(_0xbf09('0x6'));var auth=require(_0xbf09('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbf09('0x8'));var controller=require(_0xbf09('0x9'));router[_0xbf09('0xa')](_0xbf09('0xb'),auth['isAuthenticated'](),controller[_0xbf09('0xc')]);router['delete'](_0xbf09('0xb'),auth[_0xbf09('0xd')](),controller[_0xbf09('0xe')]);module[_0xbf09('0xf')]=router; \ No newline at end of file +var _0x64af=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','isAuthenticated','update','delete','/:id','destroy','multer','path'];(function(_0x20a07f,_0x2b3b32){var _0x21757d=function(_0x3768fe){while(--_0x3768fe){_0x20a07f['push'](_0x20a07f['shift']());}};_0x21757d(++_0x2b3b32);}(_0x64af,0x194));var _0xf64a=function(_0x128d75,_0x7ef83c){_0x128d75=_0x128d75-0x0;var _0x2034e3=_0x64af[_0x128d75];return _0x2034e3;};'use strict';var multer=require(_0xf64a('0x0'));var util=require('util');var path=require(_0xf64a('0x1'));var timeout=require(_0xf64a('0x2'));var express=require(_0xf64a('0x3'));var router=express[_0xf64a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf64a('0x5'));var interaction=require(_0xf64a('0x6'));var config=require(_0xf64a('0x7'));var controller=require(_0xf64a('0x8'));router['put']('/:id',auth[_0xf64a('0x9')](),controller[_0xf64a('0xa')]);router[_0xf64a('0xb')](_0xf64a('0xc'),auth[_0xf64a('0x9')](),controller[_0xf64a('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 ae80023..c6ef423 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 _0x3978=['STRING','sequelize','exports','name','INTEGER'];(function(_0x16e50a,_0x5aec08){var _0x1bf2b6=function(_0x449873){while(--_0x449873){_0x16e50a['push'](_0x16e50a['shift']());}};_0x1bf2b6(++_0x5aec08);}(_0x3978,0xb0));var _0x8397=function(_0x4d6b23,_0x2001fc){_0x4d6b23=_0x4d6b23-0x0;var _0x4fbb27=_0x3978[_0x4d6b23];return _0x4fbb27;};'use strict';var Sequelize=require(_0x8397('0x0'));module[_0x8397('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8397('0x2')},'OrderBy':{'type':Sequelize[_0x8397('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8397('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x9993=['STRING','sequelize','name'];(function(_0x4bd301,_0x46ff81){var _0x39a588=function(_0x564e9f){while(--_0x564e9f){_0x4bd301['push'](_0x4bd301['shift']());}};_0x39a588(++_0x46ff81);}(_0x9993,0x109));var _0x3999=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x9993[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0x3999('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3999('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3999('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index d871e0d..178a9f2 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 _0x2032=['limit','count','set','Content-Range','apply','save','then','destroy','get','ContactItemTypes','sendStatus','error','stack','name','send','index','map','ContactItemType','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined'];(function(_0x3342fe,_0x1b35bf){var _0x3e1183=function(_0x2ee2b6){while(--_0x2ee2b6){_0x3342fe['push'](_0x3342fe['shift']());}};_0x3e1183(++_0x1b35bf);}(_0x2032,0xd9));var _0x2203=function(_0x398c04,_0x4d9dcf){_0x398c04=_0x398c04-0x0;var _0x343aba=_0x2032[_0x398c04];return _0x343aba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){var _0x1244f4=_0x2718f5[_0x2203('0x25')]({'plain':!![]});var _0x49c12=_0x2203('0x26');return db['UserProfileResource'][_0x2203('0x24')]({'where':{'type':_0x49c12,'resourceId':_0x1244f4['id']}})[_0x2203('0x23')](function(){return _0x2718f5;});})[_0x2203('0x23')](function(){_0x5c8da9['status'](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x1cec17,_0x5c5fd3){return function(_0xd6e109){if(!_0xd6e109){_0x1cec17[_0x2203('0x27')](0x194);}return _0xd6e109;};}function handleError(_0x1c6a77,_0x46b8b9){_0x46b8b9=_0x46b8b9||0x1f4;return function(_0x28ae02){logger[_0x2203('0x28')](_0x28ae02[_0x2203('0x29')]);if(_0x28ae02['name']){delete _0x28ae02[_0x2203('0x2a')];}_0x1c6a77[_0x2203('0x19')](_0x46b8b9)[_0x2203('0x2b')](_0x28ae02);};}exports[_0x2203('0x2c')]=function(_0x52a426,_0x3a8e23){var _0x21ff0d={},_0x287c95={},_0xf59954={'count':0x0,'rows':[]};var _0x520602=_[_0x2203('0x2d')](db[_0x2203('0x2e')]['rawAttributes'],function(_0x5c0157){return{'name':_0x5c0157[_0x2203('0x2f')],'type':_0x5c0157['type']['key']};});_0x287c95[_0x2203('0x30')]=_[_0x2203('0x2d')](_0x520602,_0x2203('0x2a'));_0x287c95[_0x2203('0x31')]=_[_0x2203('0x32')](_0x52a426['query']);_0x287c95[_0x2203('0x33')]=_[_0x2203('0x34')](_0x287c95['model'],_0x287c95[_0x2203('0x31')]);_0x21ff0d[_0x2203('0x35')]=_[_0x2203('0x34')](_0x287c95[_0x2203('0x30')],qs[_0x2203('0x36')](_0x52a426[_0x2203('0x31')][_0x2203('0x36')]));_0x21ff0d[_0x2203('0x35')]=_0x21ff0d[_0x2203('0x35')]['length']?_0x21ff0d[_0x2203('0x35')]:_0x287c95[_0x2203('0x30')];if(!_0x52a426['query']['hasOwnProperty'](_0x2203('0x37'))){_0x21ff0d['limit']=qs[_0x2203('0x1d')](_0x52a426[_0x2203('0x31')][_0x2203('0x1d')]);_0x21ff0d['offset']=qs['offset'](_0x52a426[_0x2203('0x31')]['offset']);}_0x21ff0d[_0x2203('0x38')]=qs['sort'](_0x52a426[_0x2203('0x31')]['sort']);_0x21ff0d[_0x2203('0x39')]=qs[_0x2203('0x33')](_[_0x2203('0x3a')](_0x52a426[_0x2203('0x31')],_0x287c95[_0x2203('0x33')]),_0x520602);if(_0x52a426['query']['filter']){_0x21ff0d['where']=_[_0x2203('0x3b')](_0x21ff0d[_0x2203('0x39')],{'$or':_[_0x2203('0x2d')](_0x520602,function(_0x3b0c7a){if(_0x3b0c7a[_0x2203('0x3c')]!==_0x2203('0x3d')){var _0x1c7e3d={};_0x1c7e3d[_0x3b0c7a['name']]={'$like':'%'+_0x52a426[_0x2203('0x31')][_0x2203('0x3e')]+'%'};return _0x1c7e3d;}})});}_0x21ff0d=_[_0x2203('0x3b')]({},_0x21ff0d,_0x52a426[_0x2203('0x3f')]);var _0x493d12={'where':_0x21ff0d['where']};return db[_0x2203('0x2e')]['count'](_0x493d12)[_0x2203('0x23')](function(_0x446209){_0xf59954[_0x2203('0x1e')]=_0x446209;if(_0x52a426['query']['includeAll']){_0x21ff0d[_0x2203('0x40')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x41')](_0x21ff0d);})[_0x2203('0x23')](function(_0x372709){_0xf59954[_0x2203('0x42')]=_0x372709;return _0xf59954;})['then'](respondWithFilteredResult(_0x3a8e23,_0x21ff0d))[_0x2203('0x43')](handleError(_0x3a8e23,null));};exports[_0x2203('0x44')]=function(_0x3a866c,_0x266076){var _0x16b452={'raw':!![],'where':{'id':_0x3a866c[_0x2203('0x45')]['id']}},_0x36b99f={};_0x36b99f[_0x2203('0x30')]=_[_0x2203('0x32')](db[_0x2203('0x2e')]['rawAttributes']);_0x36b99f[_0x2203('0x31')]=_[_0x2203('0x32')](_0x3a866c[_0x2203('0x31')]);_0x36b99f[_0x2203('0x33')]=_['intersection'](_0x36b99f['model'],_0x36b99f[_0x2203('0x31')]);_0x16b452['attributes']=_[_0x2203('0x34')](_0x36b99f[_0x2203('0x30')],qs[_0x2203('0x36')](_0x3a866c[_0x2203('0x31')]['fields']));_0x16b452[_0x2203('0x35')]=_0x16b452[_0x2203('0x35')]['length']?_0x16b452[_0x2203('0x35')]:_0x36b99f[_0x2203('0x30')];if(_0x3a866c[_0x2203('0x31')][_0x2203('0x46')]){_0x16b452['include']=[{'all':!![]}];}_0x16b452=_['merge']({},_0x16b452,_0x3a866c[_0x2203('0x3f')]);return db['ContactItemType']['find'](_0x16b452)[_0x2203('0x23')](handleEntityNotFound(_0x266076,null))[_0x2203('0x23')](respondWithResult(_0x266076,null))[_0x2203('0x43')](handleError(_0x266076,null));};exports['create']=function(_0x4c1496,_0x131aec){return db[_0x2203('0x2e')][_0x2203('0x47')](_0x4c1496[_0x2203('0x48')],{})[_0x2203('0x23')](function(_0x21fd78){var _0x4a7f4e=_0x4c1496[_0x2203('0x49')]['get']({'plain':!![]});if(!_0x4a7f4e)throw new Error(_0x2203('0x4a'));if(_0x4a7f4e[_0x2203('0x4b')]===_0x2203('0x49')){var _0x1e49dd=_0x21fd78['get']({'plain':!![]});var _0x506795=_0x2203('0x26');return db[_0x2203('0x4c')][_0x2203('0x4d')]({'where':{'name':_0x506795,'userProfileId':_0x4a7f4e[_0x2203('0x4e')]},'raw':!![]})['then'](function(_0x4de47a){if(_0x4de47a&&_0x4de47a['autoAssociation']===0x0){return db[_0x2203('0x4f')][_0x2203('0x47')]({'name':_0x1e49dd['name'],'resourceId':_0x1e49dd['id'],'type':_0x4de47a[_0x2203('0x2a')],'sectionId':_0x4de47a['id']},{})[_0x2203('0x23')](function(){return _0x21fd78;});}else{return _0x21fd78;}})['catch'](function(_0x32b1db){logger[_0x2203('0x28')](_0x2203('0x50'),_0x32b1db);throw _0x32b1db;});}return _0x21fd78;})[_0x2203('0x23')](respondWithResult(_0x131aec,0xc9))['catch'](handleError(_0x131aec,null));};exports[_0x2203('0x51')]=function(_0x5268d6,_0x3858f0){if(_0x5268d6[_0x2203('0x48')]['id']){delete _0x5268d6['body']['id'];}return db[_0x2203('0x2e')][_0x2203('0x4d')]({'where':{'id':_0x5268d6[_0x2203('0x45')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x3858f0,null))[_0x2203('0x23')](saveUpdates(_0x5268d6[_0x2203('0x48')],null))['then'](respondWithResult(_0x3858f0,null))['catch'](handleError(_0x3858f0,null));};exports[_0x2203('0x24')]=function(_0x524356,_0x56e881){return db[_0x2203('0x2e')][_0x2203('0x4d')]({'where':{'id':_0x524356[_0x2203('0x45')]['id']}})['then'](handleEntityNotFound(_0x56e881,null))[_0x2203('0x23')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x524356[_0x2203('0x45')]['id']}}))['then'](removeEntity(_0x56e881,null))['catch'](handleError(_0x56e881,null));}; \ No newline at end of file +var _0xbbbc=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','fields','include','options','create','body','user','ContactItemTypes','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x24f6fe,_0x428c76){var _0xee93d9=function(_0x14b056){while(--_0x14b056){_0x24f6fe['push'](_0x24f6fe['shift']());}};_0xee93d9(++_0x428c76);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x1a034b,_0x4f5831){_0x1a034b=_0x1a034b-0x0;var _0x3e9195=_0xbbbc[_0x1a034b];return _0x3e9195;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){var _0x4c543a=_0x5e3970[_0xcbbb('0x27')]({'plain':!![]});var _0x4ffa80='ContactItemTypes';return db[_0xcbbb('0x28')][_0xcbbb('0x26')]({'where':{'type':_0x4ffa80,'resourceId':_0x4c543a['id']}})['then'](function(){return _0x5e3970;});})['then'](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x55e1d8,_0x4da775){return function(_0x21e3b1){if(!_0x21e3b1){_0x55e1d8[_0xcbbb('0x18')](0x194);}return _0x21e3b1;};}function handleError(_0x38f1c6,_0x13121e){_0x13121e=_0x13121e||0x1f4;return function(_0x372024){logger[_0xcbbb('0x29')](_0x372024[_0xcbbb('0x2a')]);if(_0x372024[_0xcbbb('0x2b')]){delete _0x372024[_0xcbbb('0x2b')];}_0x38f1c6[_0xcbbb('0x19')](_0x13121e)[_0xcbbb('0x2c')](_0x372024);};}exports[_0xcbbb('0x2d')]=function(_0xfa973b,_0x1ce741){var _0x2a9639={},_0xcae72c={},_0x117739={'count':0x0,'rows':[]};var _0x21c560=_['map'](db[_0xcbbb('0x2e')][_0xcbbb('0x2f')],function(_0x5332f9){return{'name':_0x5332f9[_0xcbbb('0x30')],'type':_0x5332f9['type'][_0xcbbb('0x31')]};});_0xcae72c[_0xcbbb('0x32')]=_[_0xcbbb('0x33')](_0x21c560,'name');_0xcae72c[_0xcbbb('0x34')]=_[_0xcbbb('0x35')](_0xfa973b[_0xcbbb('0x34')]);_0xcae72c[_0xcbbb('0x36')]=_[_0xcbbb('0x37')](_0xcae72c[_0xcbbb('0x32')],_0xcae72c[_0xcbbb('0x34')]);_0x2a9639[_0xcbbb('0x38')]=_[_0xcbbb('0x37')](_0xcae72c[_0xcbbb('0x32')],qs['fields'](_0xfa973b['query']['fields']));_0x2a9639['attributes']=_0x2a9639[_0xcbbb('0x38')][_0xcbbb('0x39')]?_0x2a9639[_0xcbbb('0x38')]:_0xcae72c[_0xcbbb('0x32')];if(!_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3a')](_0xcbbb('0x3b'))){_0x2a9639[_0xcbbb('0x1f')]=qs[_0xcbbb('0x1f')](_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x1f')]);_0x2a9639[_0xcbbb('0x1c')]=qs['offset'](_0xfa973b['query'][_0xcbbb('0x1c')]);}_0x2a9639['order']=qs['sort'](_0xfa973b['query'][_0xcbbb('0x3c')]);_0x2a9639[_0xcbbb('0x3d')]=qs[_0xcbbb('0x36')](_[_0xcbbb('0x3e')](_0xfa973b[_0xcbbb('0x34')],_0xcae72c[_0xcbbb('0x36')]),_0x21c560);if(_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3f')]){_0x2a9639[_0xcbbb('0x3d')]=_[_0xcbbb('0x40')](_0x2a9639[_0xcbbb('0x3d')],{'$or':_['map'](_0x21c560,function(_0x21ec4b){if(_0x21ec4b['type']!==_0xcbbb('0x41')){var _0xf5b6f9={};_0xf5b6f9[_0x21ec4b[_0xcbbb('0x2b')]]={'$like':'%'+_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3f')]+'%'};return _0xf5b6f9;}})});}_0x2a9639=_[_0xcbbb('0x40')]({},_0x2a9639,_0xfa973b['options']);var _0x4d31d2={'where':_0x2a9639['where']};return db[_0xcbbb('0x2e')][_0xcbbb('0x1e')](_0x4d31d2)[_0xcbbb('0x25')](function(_0x162979){_0x117739[_0xcbbb('0x1e')]=_0x162979;if(_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x42')]){_0x2a9639['include']=[{'all':!![]}];}return db[_0xcbbb('0x2e')][_0xcbbb('0x43')](_0x2a9639);})['then'](function(_0x15b3bc){_0x117739[_0xcbbb('0x44')]=_0x15b3bc;return _0x117739;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x1ce741,_0x2a9639))[_0xcbbb('0x45')](handleError(_0x1ce741,null));};exports[_0xcbbb('0x46')]=function(_0x50adf5,_0x224682){var _0x58d5cb={'raw':!![],'where':{'id':_0x50adf5[_0xcbbb('0x47')]['id']}},_0x520448={};_0x520448[_0xcbbb('0x32')]=_[_0xcbbb('0x35')](db[_0xcbbb('0x2e')][_0xcbbb('0x2f')]);_0x520448[_0xcbbb('0x34')]=_[_0xcbbb('0x35')](_0x50adf5[_0xcbbb('0x34')]);_0x520448[_0xcbbb('0x36')]=_[_0xcbbb('0x37')](_0x520448[_0xcbbb('0x32')],_0x520448[_0xcbbb('0x34')]);_0x58d5cb[_0xcbbb('0x38')]=_[_0xcbbb('0x37')](_0x520448['model'],qs[_0xcbbb('0x48')](_0x50adf5[_0xcbbb('0x34')][_0xcbbb('0x48')]));_0x58d5cb[_0xcbbb('0x38')]=_0x58d5cb['attributes']['length']?_0x58d5cb['attributes']:_0x520448[_0xcbbb('0x32')];if(_0x50adf5[_0xcbbb('0x34')][_0xcbbb('0x42')]){_0x58d5cb[_0xcbbb('0x49')]=[{'all':!![]}];}_0x58d5cb=_[_0xcbbb('0x40')]({},_0x58d5cb,_0x50adf5[_0xcbbb('0x4a')]);return db[_0xcbbb('0x2e')]['find'](_0x58d5cb)[_0xcbbb('0x25')](handleEntityNotFound(_0x224682,null))[_0xcbbb('0x25')](respondWithResult(_0x224682,null))[_0xcbbb('0x45')](handleError(_0x224682,null));};exports[_0xcbbb('0x4b')]=function(_0x478c22,_0x3378cd){return db[_0xcbbb('0x2e')][_0xcbbb('0x4b')](_0x478c22[_0xcbbb('0x4c')],{})['then'](function(_0x5e0366){var _0x3e1fdc=_0x478c22[_0xcbbb('0x4d')][_0xcbbb('0x27')]({'plain':!![]});if(!_0x3e1fdc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e1fdc['role']==='user'){var _0x189a40=_0x5e0366[_0xcbbb('0x27')]({'plain':!![]});var _0x4b866e=_0xcbbb('0x4e');return db[_0xcbbb('0x4f')][_0xcbbb('0x50')]({'where':{'name':_0x4b866e,'userProfileId':_0x3e1fdc[_0xcbbb('0x51')]},'raw':!![]})['then'](function(_0x33d21c){if(_0x33d21c&&_0x33d21c[_0xcbbb('0x52')]===0x0){return db[_0xcbbb('0x28')][_0xcbbb('0x4b')]({'name':_0x189a40[_0xcbbb('0x2b')],'resourceId':_0x189a40['id'],'type':_0x33d21c[_0xcbbb('0x2b')],'sectionId':_0x33d21c['id']},{})[_0xcbbb('0x25')](function(){return _0x5e0366;});}else{return _0x5e0366;}})[_0xcbbb('0x45')](function(_0x2d3990){logger[_0xcbbb('0x29')](_0xcbbb('0x53'),_0x2d3990);throw _0x2d3990;});}return _0x5e0366;})['then'](respondWithResult(_0x3378cd,0xc9))['catch'](handleError(_0x3378cd,null));};exports[_0xcbbb('0x24')]=function(_0x1eb822,_0x354efc){if(_0x1eb822['body']['id']){delete _0x1eb822[_0xcbbb('0x4c')]['id'];}return db['ContactItemType'][_0xcbbb('0x50')]({'where':{'id':_0x1eb822[_0xcbbb('0x47')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x354efc,null))[_0xcbbb('0x25')](saveUpdates(_0x1eb822[_0xcbbb('0x4c')],null))[_0xcbbb('0x25')](respondWithResult(_0x354efc,null))['catch'](handleError(_0x354efc,null));};exports['destroy']=function(_0x4cc098,_0x370e6d){return db[_0xcbbb('0x2e')][_0xcbbb('0x50')]({'where':{'id':_0x4cc098[_0xcbbb('0x47')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x370e6d,null))[_0xcbbb('0x25')](db[_0xcbbb('0x54')][_0xcbbb('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4cc098[_0xcbbb('0x47')]['id']}}))[_0xcbbb('0x25')](removeEntity(_0x370e6d,null))[_0xcbbb('0x45')](handleError(_0x370e6d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 71e08e0..67f3280 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 _0xe389=['../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x407c14,_0x226f5b){var _0x16c1e3=function(_0xdb2995){while(--_0xdb2995){_0x407c14['push'](_0x407c14['shift']());}};_0x16c1e3(++_0x226f5b);}(_0xe389,0x186));var _0x9e38=function(_0x5b3255,_0x526121){_0x5b3255=_0x5b3255-0x0;var _0x46cca0=_0xe389[_0x5b3255];return _0x46cca0;};'use strict';var _=require(_0x9e38('0x0'));var util=require('util');var logger=require(_0x9e38('0x1'))(_0x9e38('0x2'));var moment=require('moment');var BPromise=require(_0x9e38('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e38('0x4'));var rimraf=require(_0x9e38('0x5'));var config=require(_0x9e38('0x6'));var attributes=require(_0x9e38('0x7'));module[_0x9e38('0x8')]=function(_0x8eef37,_0x2cc2ef){return _0x8eef37['define'](_0x9e38('0x9'),attributes,{'tableName':_0x9e38('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd20e=['rimraf','../../config/environment','define','ContactItemType','lodash','../../config/logger','api','moment','path'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xd20e,0xca));var _0xed20=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xd20e[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xed20('0x0'));var util=require('util');var logger=require(_0xed20('0x1'))(_0xed20('0x2'));var moment=require(_0xed20('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xed20('0x4'));var rimraf=require(_0xed20('0x5'));var config=require(_0xed20('0x6'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x91d284,_0x391903){return _0x91d284[_0xed20('0x7')](_0xed20('0x8'),attributes,{'tableName':'tools_contact_item_types','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 521cc5e..4a440fd 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 _0x054f=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x054f,0x1a6));var _0xf054=function(_0x24a7b8,_0x4a203e){_0x24a7b8=_0x24a7b8-0x0;var _0xd84a8e=_0x054f[_0x24a7b8];return _0xd84a8e;};'use strict';var _=require(_0xf054('0x0'));var util=require(_0xf054('0x1'));var moment=require(_0xf054('0x2'));var BPromise=require(_0xf054('0x3'));var rs=require(_0xf054('0x4'));var fs=require('fs');var Redis=require(_0xf054('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf054('0x6'));var logger=require(_0xf054('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf054('0x8'));var client=jayson['client'][_0xf054('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x113205,_0x5a9681,_0x2e8bb8){return new BPromise(function(_0x155c76,_0x13d111){return client[_0xf054('0xa')](_0x113205,_0x2e8bb8)[_0xf054('0xb')](function(_0xfb30a9){logger[_0xf054('0xc')](_0xf054('0xd'),_0x5a9681,_0xf054('0xe'));logger[_0xf054('0xf')](_0xf054('0x10'),_0x5a9681,_0xf054('0xe'),JSON[_0xf054('0x11')](_0xfb30a9));if(_0xfb30a9[_0xf054('0x12')]){if(_0xfb30a9[_0xf054('0x12')]['code']===0x1f4){logger[_0xf054('0x12')](_0xf054('0xd'),_0x5a9681,_0xfb30a9[_0xf054('0x12')][_0xf054('0x13')]);return _0x13d111(_0xfb30a9[_0xf054('0x12')][_0xf054('0x13')]);}logger['error'](_0xf054('0xd'),_0x5a9681,_0xfb30a9[_0xf054('0x12')][_0xf054('0x13')]);return _0x155c76(_0xfb30a9[_0xf054('0x12')]['message']);}else{logger[_0xf054('0xc')](_0xf054('0xd'),_0x5a9681,_0xf054('0xe'));_0x155c76(_0xfb30a9['result'][_0xf054('0x13')]);}})[_0xf054('0x14')](function(_0x47f87c){logger['error'](_0xf054('0xd'),_0x5a9681,_0x47f87c);_0x13d111(_0x47f87c);});});} \ No newline at end of file +var _0x35d4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x35d4,0x170));var _0x435d=function(_0xcbf378,_0x3bbbfb){_0xcbf378=_0xcbf378-0x0;var _0x44ea08=_0x35d4[_0xcbf378];return _0x44ea08;};'use strict';var _=require(_0x435d('0x0'));var util=require(_0x435d('0x1'));var moment=require('moment');var BPromise=require(_0x435d('0x2'));var rs=require(_0x435d('0x3'));var fs=require('fs');var Redis=require(_0x435d('0x4'));var db=require(_0x435d('0x5'))['db'];var utils=require(_0x435d('0x6'));var logger=require(_0x435d('0x7'))(_0x435d('0x8'));var config=require(_0x435d('0x9'));var jayson=require(_0x435d('0xa'));var client=jayson[_0x435d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ae369,_0x11f02d,_0x445109){return new BPromise(function(_0x291e3c,_0x132c98){return client['request'](_0x1ae369,_0x445109)['then'](function(_0x135998){logger[_0x435d('0xc')](_0x435d('0xd'),_0x11f02d,_0x435d('0xe'));logger[_0x435d('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x11f02d,_0x435d('0xe'),JSON[_0x435d('0x10')](_0x135998));if(_0x135998[_0x435d('0x11')]){if(_0x135998[_0x435d('0x11')][_0x435d('0x12')]===0x1f4){logger[_0x435d('0x11')](_0x435d('0xd'),_0x11f02d,_0x135998['error'][_0x435d('0x13')]);return _0x132c98(_0x135998['error'][_0x435d('0x13')]);}logger['error'](_0x435d('0xd'),_0x11f02d,_0x135998['error'][_0x435d('0x13')]);return _0x291e3c(_0x135998[_0x435d('0x11')][_0x435d('0x13')]);}else{logger[_0x435d('0xc')](_0x435d('0xd'),_0x11f02d,'request\x20sent');_0x291e3c(_0x135998[_0x435d('0x14')][_0x435d('0x13')]);}})[_0x435d('0x15')](function(_0x329f3e){logger[_0x435d('0x11')](_0x435d('0xd'),_0x11f02d,_0x329f3e);_0x132c98(_0x329f3e);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index c8c058d..efa2a78 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 _0x4a47=['delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','put','update'];(function(_0x6f3b8f,_0xefbfb2){var _0x2b38b7=function(_0x2ef32c){while(--_0x2ef32c){_0x6f3b8f['push'](_0x6f3b8f['shift']());}};_0x2b38b7(++_0xefbfb2);}(_0x4a47,0x92));var _0x74a4=function(_0x1707f0,_0x23f136){_0x1707f0=_0x1707f0-0x0;var _0xccacd1=_0x4a47[_0x1707f0];return _0xccacd1;};'use strict';var multer=require('multer');var util=require(_0x74a4('0x0'));var path=require('path');var timeout=require(_0x74a4('0x1'));var express=require(_0x74a4('0x2'));var router=express[_0x74a4('0x3')]();var fs_extra=require(_0x74a4('0x4'));var auth=require(_0x74a4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x74a4('0x6'));var controller=require(_0x74a4('0x7'));router[_0x74a4('0x8')]('/',auth[_0x74a4('0x9')](),controller[_0x74a4('0xa')]);router[_0x74a4('0x8')](_0x74a4('0xb'),auth[_0x74a4('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x74a4('0xc')](_0x74a4('0xb'),auth[_0x74a4('0x9')](),controller[_0x74a4('0xd')]);router[_0x74a4('0xe')](_0x74a4('0xb'),auth[_0x74a4('0x9')](),controller['destroy']);module[_0x74a4('0xf')]=router; \ No newline at end of file +var _0x0334=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0334,0x141));var _0x4033=function(_0x34cce7,_0x8d6146){_0x34cce7=_0x34cce7-0x0;var _0x56d6d4=_0x0334[_0x34cce7];return _0x56d6d4;};'use strict';var multer=require('multer');var util=require(_0x4033('0x0'));var path=require(_0x4033('0x1'));var timeout=require(_0x4033('0x2'));var express=require(_0x4033('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4033('0x4'));var interaction=require(_0x4033('0x5'));var config=require(_0x4033('0x6'));var controller=require(_0x4033('0x7'));router[_0x4033('0x8')]('/',auth[_0x4033('0x9')](),controller[_0x4033('0xa')]);router[_0x4033('0x8')]('/:id',auth[_0x4033('0x9')](),controller['show']);router[_0x4033('0xb')]('/',auth[_0x4033('0x9')](),controller[_0x4033('0xc')]);router[_0x4033('0xd')](_0x4033('0xe'),auth[_0x4033('0x9')](),controller[_0x4033('0xf')]);router['delete'](_0x4033('0xe'),auth['isAuthenticated'](),controller[_0x4033('0x10')]);module[_0x4033('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 9345e49..ea3f46c 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0xe2b546,_0x21839e){var _0x299ee6=function(_0x44c0a4){while(--_0x44c0a4){_0xe2b546['push'](_0xe2b546['shift']());}};_0x299ee6(++_0x21839e);}(_0x2032,0xd9));var _0x2203=function(_0x48baaa,_0x497be5){_0x48baaa=_0x48baaa-0x0;var _0xb5ca2=_0x2032[_0x48baaa];return _0xb5ca2;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index afbfa09..0eba631 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 _0xbde0=['count','limit','set','reject','save','update','destroy','then','get','CustomDashboards','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','error','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrWhatsappAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','hasOwnProperty','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined'];(function(_0x3cd318,_0x23cbfa){var _0x443604=function(_0x21c38a){while(--_0x21c38a){_0x3cd318['push'](_0x3cd318['shift']());}};_0x443604(++_0x23cbfa);}(_0xbde0,0xe7));var _0x0bde=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xbde0[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bde('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0bde('0x1'));var moment=require(_0x0bde('0x2'));var BPromise=require(_0x0bde('0x3'));var Mustache=require(_0x0bde('0x4'));var util=require('util');var path=require(_0x0bde('0x5'));var sox=require('sox');var csv=require(_0x0bde('0x6'));var ejs=require(_0x0bde('0x7'));var fs=require('fs');var fs_extra=require(_0x0bde('0x8'));var _=require('lodash');var squel=require(_0x0bde('0x9'));var crypto=require(_0x0bde('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0bde('0xb'));var toCsv=require(_0x0bde('0x6'));var querystring=require('querystring');var Papa=require(_0x0bde('0xc'));var Redis=require(_0x0bde('0xd'));var authService=require(_0x0bde('0xe'));var qs=require(_0x0bde('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bde('0x10'));var logger=require(_0x0bde('0x11'))('api');var utils=require(_0x0bde('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0bde('0x13'));var db=require('../../mysqldb')['db'];config[_0x0bde('0x14')]=_[_0x0bde('0x15')](config[_0x0bde('0x14')],{'host':_0x0bde('0x16'),'port':0x18eb});var socket=require(_0x0bde('0x17'))(new Redis(config[_0x0bde('0x14')]));require(_0x0bde('0x18'))[_0x0bde('0x19')](socket);function respondWithStatusCode(_0x380c63,_0x41f1b6){_0x41f1b6=_0x41f1b6||0xcc;return function(_0x53e93d){if(_0x53e93d){return _0x380c63['sendStatus'](_0x41f1b6);}return _0x380c63[_0x0bde('0x1a')](_0x41f1b6)[_0x0bde('0x1b')]();};}function respondWithResult(_0x2a4bce,_0x13918a){_0x13918a=_0x13918a||0xc8;return function(_0x5dc905){if(_0x5dc905){return _0x2a4bce[_0x0bde('0x1a')](_0x13918a)[_0x0bde('0x1c')](_0x5dc905);}};}function respondWithFilteredResult(_0x4c0acb,_0x10d92e){return function(_0x4c4c78){if(_0x4c4c78){var _0x2386bb=typeof _0x10d92e[_0x0bde('0x1d')]==='undefined'&&typeof _0x10d92e['limit']===_0x0bde('0x1e');var _0xb7c23d=_0x4c4c78[_0x0bde('0x1f')];var _0x517d9f=_0x2386bb?0x0:_0x10d92e[_0x0bde('0x1d')];var _0x13f19e=_0x2386bb?_0x4c4c78[_0x0bde('0x1f')]:_0x10d92e['offset']+_0x10d92e[_0x0bde('0x20')];var _0x44ae5d;if(_0x13f19e>=_0xb7c23d){_0x13f19e=_0xb7c23d;_0x44ae5d=0xc8;}else{_0x44ae5d=0xce;}_0x4c0acb['status'](_0x44ae5d);return _0x4c0acb[_0x0bde('0x21')]('Content-Range',_0x517d9f+'-'+_0x13f19e+'/'+_0xb7c23d)['json'](_0x4c4c78);}return null;};}function patchUpdates(_0x5f5a24){return function(_0x224ddc){try{jsonpatch['apply'](_0x224ddc,_0x5f5a24,!![]);}catch(_0x341d1b){return BPromise[_0x0bde('0x22')](_0x341d1b);}return _0x224ddc[_0x0bde('0x23')]();};}function saveUpdates(_0xd7be22,_0x6e8195){return function(_0x90d9b7){if(_0x90d9b7){return _0x90d9b7[_0x0bde('0x24')](_0xd7be22)['then'](function(_0x56589c){return _0x56589c;});}return null;};}function removeEntity(_0x57b33c,_0x5c67c2){return function(_0x6fd21e){if(_0x6fd21e){return _0x6fd21e[_0x0bde('0x25')]()[_0x0bde('0x26')](function(){var _0x444d97=_0x6fd21e[_0x0bde('0x27')]({'plain':!![]});var _0x4e2a1b=_0x0bde('0x28');return db[_0x0bde('0x29')][_0x0bde('0x25')]({'where':{'type':_0x4e2a1b,'resourceId':_0x444d97['id']}})['then'](function(){return _0x6fd21e;});})[_0x0bde('0x26')](function(){_0x57b33c[_0x0bde('0x1a')](0xcc)[_0x0bde('0x1b')]();});}};}function handleEntityNotFound(_0x69af69,_0x160e2f){return function(_0x2ee332){if(!_0x2ee332){_0x69af69[_0x0bde('0x2a')](0x194);}return _0x2ee332;};}function handleError(_0x2e3b93,_0x5ed713){_0x5ed713=_0x5ed713||0x1f4;return function(_0x14b5f6){logger['error'](_0x14b5f6[_0x0bde('0x2b')]);if(_0x14b5f6[_0x0bde('0x2c')]){delete _0x14b5f6[_0x0bde('0x2c')];}_0x2e3b93[_0x0bde('0x1a')](_0x5ed713)[_0x0bde('0x2d')](_0x14b5f6);};}exports[_0x0bde('0x2e')]=function(_0x286791,_0x4607fb){var _0x5206d7={},_0x435461={},_0x410cad={'count':0x0,'rows':[]};var _0x24e0a1=_[_0x0bde('0x2f')](db['Dashboard']['rawAttributes'],function(_0x2444b1){return{'name':_0x2444b1[_0x0bde('0x30')],'type':_0x2444b1[_0x0bde('0x31')][_0x0bde('0x32')]};});_0x435461[_0x0bde('0x33')]=_[_0x0bde('0x2f')](_0x24e0a1,_0x0bde('0x2c'));_0x435461[_0x0bde('0x34')]=_[_0x0bde('0x35')](_0x286791['query']);_0x435461[_0x0bde('0x36')]=_['intersection'](_0x435461['model'],_0x435461[_0x0bde('0x34')]);_0x5206d7[_0x0bde('0x37')]=_[_0x0bde('0x38')](_0x435461[_0x0bde('0x33')],qs['fields'](_0x286791[_0x0bde('0x34')][_0x0bde('0x39')]));_0x5206d7[_0x0bde('0x37')]=_0x5206d7[_0x0bde('0x37')]['length']?_0x5206d7['attributes']:_0x435461[_0x0bde('0x33')];if(!_0x286791[_0x0bde('0x34')]['hasOwnProperty'](_0x0bde('0x3a'))){_0x5206d7[_0x0bde('0x20')]=qs[_0x0bde('0x20')](_0x286791[_0x0bde('0x34')][_0x0bde('0x20')]);_0x5206d7[_0x0bde('0x1d')]=qs[_0x0bde('0x1d')](_0x286791['query']['offset']);}_0x5206d7['order']=qs['sort'](_0x286791['query'][_0x0bde('0x3b')]);_0x5206d7['where']=qs['filters'](_[_0x0bde('0x3c')](_0x286791[_0x0bde('0x34')],_0x435461[_0x0bde('0x36')]),_0x24e0a1);if(_0x286791[_0x0bde('0x34')][_0x0bde('0x3d')]){_0x5206d7[_0x0bde('0x3e')]=_[_0x0bde('0x3f')](_0x5206d7[_0x0bde('0x3e')],{'$or':_[_0x0bde('0x2f')](_0x24e0a1,function(_0x109fff){if(_0x109fff[_0x0bde('0x31')]!==_0x0bde('0x40')){var _0x41fd66={};_0x41fd66[_0x109fff[_0x0bde('0x2c')]]={'$like':'%'+_0x286791['query'][_0x0bde('0x3d')]+'%'};return _0x41fd66;}})});}_0x5206d7=_[_0x0bde('0x3f')]({},_0x5206d7,_0x286791[_0x0bde('0x41')]);var _0x2c5a86={'where':_0x5206d7[_0x0bde('0x3e')]};return db[_0x0bde('0x42')][_0x0bde('0x1f')](_0x2c5a86)[_0x0bde('0x26')](function(_0x714276){_0x410cad[_0x0bde('0x1f')]=_0x714276;if(_0x286791[_0x0bde('0x34')][_0x0bde('0x43')]){_0x5206d7[_0x0bde('0x44')]=[{'all':!![]}];}return db[_0x0bde('0x42')][_0x0bde('0x45')](_0x5206d7);})[_0x0bde('0x26')](function(_0xaccd11){_0x410cad[_0x0bde('0x46')]=_0xaccd11;return _0x410cad;})[_0x0bde('0x26')](respondWithFilteredResult(_0x4607fb,_0x5206d7))[_0x0bde('0x47')](handleError(_0x4607fb,null));};exports[_0x0bde('0x48')]=function(_0x578fc0,_0x3fc80b){var _0x113c0e={'raw':![],'where':{'id':_0x578fc0['params']['id']}},_0x24204d={};_0x24204d[_0x0bde('0x33')]=_[_0x0bde('0x35')](db[_0x0bde('0x42')][_0x0bde('0x49')]);_0x24204d[_0x0bde('0x34')]=_['keys'](_0x578fc0[_0x0bde('0x34')]);_0x24204d[_0x0bde('0x36')]=_[_0x0bde('0x38')](_0x24204d['model'],_0x24204d[_0x0bde('0x34')]);_0x113c0e[_0x0bde('0x37')]=_[_0x0bde('0x38')](_0x24204d[_0x0bde('0x33')],qs[_0x0bde('0x39')](_0x578fc0[_0x0bde('0x34')][_0x0bde('0x39')]));_0x113c0e[_0x0bde('0x37')]=_0x113c0e[_0x0bde('0x37')][_0x0bde('0x4a')]?_0x113c0e[_0x0bde('0x37')]:_0x24204d[_0x0bde('0x33')];if(_0x578fc0[_0x0bde('0x34')]['includeAll']){_0x113c0e[_0x0bde('0x44')]=[{'all':!![]}];}_0x113c0e=_[_0x0bde('0x3f')]({},_0x113c0e,_0x578fc0[_0x0bde('0x41')]);return db[_0x0bde('0x42')][_0x0bde('0x4b')](_0x113c0e)['then'](handleEntityNotFound(_0x3fc80b,null))[_0x0bde('0x26')](respondWithResult(_0x3fc80b,null))[_0x0bde('0x47')](handleError(_0x3fc80b,null));};exports[_0x0bde('0x4c')]=function(_0x9dfa3c,_0x254ed4){return db['Dashboard'][_0x0bde('0x4c')](_0x9dfa3c[_0x0bde('0x4d')],{})[_0x0bde('0x26')](function(_0x30d72a){var _0x2fc289=_0x9dfa3c[_0x0bde('0x4e')]['get']({'plain':!![]});if(!_0x2fc289)throw new Error(_0x0bde('0x4f'));if(_0x2fc289[_0x0bde('0x50')]==='user'){var _0xa94c1b=_0x30d72a[_0x0bde('0x27')]({'plain':!![]});var _0x53b300=_0x0bde('0x28');return db[_0x0bde('0x51')][_0x0bde('0x4b')]({'where':{'name':_0x53b300,'userProfileId':_0x2fc289[_0x0bde('0x52')]},'raw':!![]})[_0x0bde('0x26')](function(_0x124adc){if(_0x124adc&&_0x124adc[_0x0bde('0x53')]===0x0){return db[_0x0bde('0x29')][_0x0bde('0x4c')]({'name':_0xa94c1b[_0x0bde('0x2c')],'resourceId':_0xa94c1b['id'],'type':_0x124adc[_0x0bde('0x2c')],'sectionId':_0x124adc['id']},{})[_0x0bde('0x26')](function(){return _0x30d72a;});}else{return _0x30d72a;}})[_0x0bde('0x47')](function(_0x3b6f33){logger['error'](_0x0bde('0x54'),_0x3b6f33);throw _0x3b6f33;});}return _0x30d72a;})['then'](respondWithResult(_0x254ed4,0xc9))[_0x0bde('0x47')](handleError(_0x254ed4,null));};exports[_0x0bde('0x55')]=function(_0xdbd993,_0x4981b3){var _0x5c1dc6={'where':{'id':_0xdbd993[_0x0bde('0x56')]['id']}},_0x54fa3d={};_0x54fa3d[_0x0bde('0x33')]=_[_0x0bde('0x35')](db[_0x0bde('0x42')][_0x0bde('0x49')]);_0x5c1dc6['attributes']=_[_0x0bde('0x38')](_0x54fa3d[_0x0bde('0x33')],qs[_0x0bde('0x39')](_0xdbd993[_0x0bde('0x34')][_0x0bde('0x39')]));_0x5c1dc6['attributes']=_0x5c1dc6[_0x0bde('0x37')]['length']?_0x5c1dc6[_0x0bde('0x37')]:_0x54fa3d[_0x0bde('0x33')];if(_0xdbd993['query'][_0x0bde('0x43')]){_0x5c1dc6[_0x0bde('0x44')]=[{'all':!![]}];}_0x5c1dc6=_[_0x0bde('0x3f')]({},_0x5c1dc6,_0xdbd993[_0x0bde('0x41')]);return db[_0x0bde('0x42')][_0x0bde('0x4b')](_0x5c1dc6)[_0x0bde('0x26')](handleEntityNotFound(_0x4981b3,null))['then'](function(_0x5c8d64){if(_0x5c8d64){var _0xb8daea=_0x5c8d64[_0x0bde('0x27')]({'plain':!![]});_0xb8daea=qs['omit'](_0xb8daea,['id',_0x0bde('0x57'),_0x0bde('0x58')]);_0xdbd993[_0x0bde('0x4d')]=_[_0x0bde('0x59')](_0xdbd993[_0x0bde('0x4d')],['id',_0x0bde('0x57'),_0x0bde('0x58')]);return db[_0x0bde('0x42')][_0x0bde('0x4c')](_[_0x0bde('0x3f')](_0xb8daea,_0xdbd993[_0x0bde('0x4d')]),{'include':_0xdbd993[_0x0bde('0x34')][_0x0bde('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x4a7509){var _0x57ded5=_0xdbd993[_0x0bde('0x4e')][_0x0bde('0x27')]({'plain':!![]});if(!_0x57ded5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57ded5[_0x0bde('0x50')]===_0x0bde('0x4e')){var _0x4ead3e=_0x4a7509[_0x0bde('0x27')]({'plain':!![]});var _0x4fbc0a=_0x0bde('0x28');return db[_0x0bde('0x51')][_0x0bde('0x4b')]({'where':{'name':_0x4fbc0a,'userProfileId':_0x57ded5[_0x0bde('0x52')]},'raw':!![]})[_0x0bde('0x26')](function(_0x5653e6){if(_0x5653e6&&_0x5653e6[_0x0bde('0x53')]===0x0){return db[_0x0bde('0x29')][_0x0bde('0x4c')]({'name':_0x4ead3e[_0x0bde('0x2c')],'resourceId':_0x4ead3e['id'],'type':_0x5653e6['name'],'sectionId':_0x5653e6['id']},{})[_0x0bde('0x26')](function(){return _0x4a7509;});}else{return _0x4a7509;}})[_0x0bde('0x47')](function(_0x14692e){logger[_0x0bde('0x5a')](_0x0bde('0x54'),_0x14692e);throw _0x14692e;});}return _0x4a7509;});}})['then'](respondWithResult(_0x4981b3,0xc9))[_0x0bde('0x47')](handleError(_0x4981b3,null));};exports[_0x0bde('0x24')]=function(_0xdc9cb9,_0xe5a655){if(_0xdc9cb9['body']['id']){delete _0xdc9cb9[_0x0bde('0x4d')]['id'];}return db[_0x0bde('0x42')][_0x0bde('0x4b')]({'where':{'id':_0xdc9cb9[_0x0bde('0x56')]['id']}})[_0x0bde('0x26')](handleEntityNotFound(_0xe5a655,null))[_0x0bde('0x26')](saveUpdates(_0xdc9cb9[_0x0bde('0x4d')],null))[_0x0bde('0x26')](respondWithResult(_0xe5a655,null))[_0x0bde('0x47')](handleError(_0xe5a655,null));};exports[_0x0bde('0x25')]=function(_0x359117,_0x369812){return db[_0x0bde('0x42')]['find']({'where':{'id':_0x359117[_0x0bde('0x56')]['id']}})[_0x0bde('0x26')](handleEntityNotFound(_0x369812,null))[_0x0bde('0x26')](removeEntity(_0x369812,null))['catch'](handleError(_0x369812,null));};function widgetAttributes(_0x4cd0cc){try{switch(_0x4cd0cc['type']){case _0x0bde('0x5b'):return[{'name':_0x0bde('0x5c'),'value':_0x4cd0cc[_0x0bde('0x5c')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x0]?_0x4cd0cc['attrs'][0x0][_0x0bde('0x5e')]:undefined)||_0x0bde('0x5f')}];case _0x0bde('0x60'):return[{'name':_0x0bde('0x61'),'value':_0x4cd0cc[_0x0bde('0x61')]||(_0x4cd0cc['attrs']&&_0x4cd0cc[_0x0bde('0x5d')][0x0]?_0x4cd0cc['attrs'][0x0][_0x0bde('0x5e')]:undefined)||''}];case _0x0bde('0x62'):return[{'name':_0x0bde('0x63'),'value':_0x4cd0cc[_0x0bde('0x63')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x0]?_0x4cd0cc[_0x0bde('0x5d')][0x0]['value']:undefined)||_0x0bde('0x64')},{'name':_0x0bde('0x65'),'value':_0x4cd0cc[_0x0bde('0x65')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x1]?_0x4cd0cc[_0x0bde('0x5d')][0x1][_0x0bde('0x5e')]:undefined)||_0x0bde('0x66')},{'name':_0x0bde('0x67'),'value':_0x4cd0cc[_0x0bde('0x67')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc['attrs'][0x2]?_0x4cd0cc[_0x0bde('0x5d')][0x2][_0x0bde('0x5e')]:undefined)||0xc}];case _0x0bde('0x68'):return[{'name':'attrMetric','value':_0x4cd0cc['attrMetric']||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x0]?_0x4cd0cc['attrs'][0x0][_0x0bde('0x5e')]:undefined)||_0x0bde('0x69')},{'name':_0x0bde('0x6a'),'value':_0x4cd0cc[_0x0bde('0x6a')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc['attrs'][0x1]?_0x4cd0cc[_0x0bde('0x5d')][0x1][_0x0bde('0x5e')]:undefined)||[]},{'name':_0x0bde('0x67'),'value':_0x4cd0cc[_0x0bde('0x67')]||(_0x4cd0cc['attrs']&&_0x4cd0cc[_0x0bde('0x5d')][0x2]?_0x4cd0cc[_0x0bde('0x5d')][0x2]['value']:undefined)||0x14},{'name':_0x0bde('0x6b'),'value':_0x4cd0cc[_0x0bde('0x6b')]||(_0x4cd0cc['attrs']&&_0x4cd0cc[_0x0bde('0x5d')][0x3]?_0x4cd0cc[_0x0bde('0x5d')][0x3][_0x0bde('0x5e')]:undefined)||'voice'},{'name':_0x0bde('0x6c'),'value':_0x4cd0cc['attrEmailAccounts']||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x4]?_0x4cd0cc[_0x0bde('0x5d')][0x4][_0x0bde('0x5e')]:undefined)||''},{'name':_0x0bde('0x6d'),'value':_0x4cd0cc[_0x0bde('0x6d')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x5]?_0x4cd0cc[_0x0bde('0x5d')][0x5][_0x0bde('0x5e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4cd0cc[_0x0bde('0x6e')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x6]?_0x4cd0cc[_0x0bde('0x5d')][0x6][_0x0bde('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4cd0cc[_0x0bde('0x6f')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x7]?_0x4cd0cc[_0x0bde('0x5d')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4cd0cc['attrWhatsappAccounts']||(_0x4cd0cc['attrs']&&_0x4cd0cc[_0x0bde('0x5d')][0x8]?_0x4cd0cc[_0x0bde('0x5d')][0x8][_0x0bde('0x5e')]:undefined)||''},{'name':_0x0bde('0x70'),'value':_0x4cd0cc[_0x0bde('0x70')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x9]?_0x4cd0cc['attrs'][0x9][_0x0bde('0x5e')]:undefined)||''}];case'multibar-chart':case _0x0bde('0x71'):return[{'name':_0x0bde('0x72'),'value':_0x4cd0cc[_0x0bde('0x72')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x0]?_0x4cd0cc['attrs'][0x0][_0x0bde('0x5e')]:undefined)||_0x0bde('0x69')},{'name':_0x0bde('0x73'),'value':_0x4cd0cc[_0x0bde('0x73')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc['attrs'][0x1]?_0x4cd0cc[_0x0bde('0x5d')][0x1][_0x0bde('0x5e')]:undefined)||null},{'name':_0x0bde('0x74'),'value':_0x4cd0cc[_0x0bde('0x74')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x2]?_0x4cd0cc['attrs'][0x2][_0x0bde('0x5e')]:undefined)||null},{'name':_0x0bde('0x6a'),'value':_0x4cd0cc[_0x0bde('0x6a')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x3]?_0x4cd0cc['attrs'][0x3][_0x0bde('0x5e')]:undefined)||[]},{'name':_0x0bde('0x6b'),'value':_0x4cd0cc[_0x0bde('0x6b')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x4]?_0x4cd0cc['attrs'][0x4][_0x0bde('0x5e')]:undefined)||_0x0bde('0x75')},{'name':'attrEmailAccounts','value':_0x4cd0cc[_0x0bde('0x6c')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc['attrs'][0x5]?_0x4cd0cc['attrs'][0x5][_0x0bde('0x5e')]:undefined)||''},{'name':_0x0bde('0x6d'),'value':_0x4cd0cc[_0x0bde('0x6d')]||(_0x4cd0cc['attrs']&&_0x4cd0cc['attrs'][0x6]?_0x4cd0cc[_0x0bde('0x5d')][0x6]['value']:undefined)||''},{'name':_0x0bde('0x6e'),'value':_0x4cd0cc[_0x0bde('0x6e')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x7]?_0x4cd0cc['attrs'][0x7][_0x0bde('0x5e')]:undefined)||''},{'name':_0x0bde('0x6f'),'value':_0x4cd0cc[_0x0bde('0x6f')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x8]?_0x4cd0cc['attrs'][0x8][_0x0bde('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4cd0cc[_0x0bde('0x76')]||(_0x4cd0cc['attrs']&&_0x4cd0cc[_0x0bde('0x5d')][0x9]?_0x4cd0cc[_0x0bde('0x5d')][0x9]['value']:undefined)||''},{'name':_0x0bde('0x70'),'value':_0x4cd0cc[_0x0bde('0x70')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0xa]?_0x4cd0cc['attrs'][0xa][_0x0bde('0x5e')]:undefined)||''}];case'web-report':return[{'name':_0x0bde('0x77'),'type':_0x4cd0cc[_0x0bde('0x78')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x0]?_0x4cd0cc[_0x0bde('0x5d')][0x0]['type']:undefined)||null,'value':_0x4cd0cc[_0x0bde('0x77')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x0]?_0x4cd0cc[_0x0bde('0x5d')][0x0][_0x0bde('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x4cd0cc[_0x0bde('0x79')]||(_0x4cd0cc[_0x0bde('0x5d')]&&_0x4cd0cc[_0x0bde('0x5d')][0x1]?_0x4cd0cc[_0x0bde('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1a8d42){logger['error'](_0x0bde('0x7a'),JSON[_0x0bde('0x7b')](_0x1a8d42));return[];}}exports[_0x0bde('0x7c')]=function(_0x44d28d,_0x5268d5,_0xfbf73){if(_0x44d28d[_0x0bde('0x4d')]['id']){delete _0x44d28d['body']['id'];}return db[_0x0bde('0x42')]['find']({'where':{'id':_0x44d28d[_0x0bde('0x56')]['id']}})[_0x0bde('0x26')](handleEntityNotFound(_0x5268d5,null))[_0x0bde('0x26')](function(_0x11b7e1){if(_0x11b7e1){_0x44d28d[_0x0bde('0x4d')][_0x0bde('0x7d')]=_0x11b7e1['id'];_0x44d28d['body']['attrs']=widgetAttributes(_0x44d28d[_0x0bde('0x4d')]);return db[_0x0bde('0x7e')][_0x0bde('0x4c')](_0x44d28d[_0x0bde('0x4d')]);}})[_0x0bde('0x26')](respondWithResult(_0x5268d5,null))[_0x0bde('0x47')](handleError(_0x5268d5,null));};exports[_0x0bde('0x7f')]=function(_0x143600,_0x5db950,_0x2fa22e){var _0x15147d={};var _0x119b94={};var _0x1fdb93;var _0x2d8b9d;return db[_0x0bde('0x42')][_0x0bde('0x80')]({'where':{'id':_0x143600['params']['id']}})[_0x0bde('0x26')](handleEntityNotFound(_0x5db950,null))[_0x0bde('0x26')](function(_0x5a853d){if(_0x5a853d){_0x1fdb93=_0x5a853d;_0x119b94['model']=_[_0x0bde('0x35')](db[_0x0bde('0x7e')][_0x0bde('0x49')]);_0x119b94[_0x0bde('0x34')]=_['keys'](_0x143600[_0x0bde('0x34')]);_0x119b94[_0x0bde('0x36')]=_[_0x0bde('0x38')](_0x119b94['model'],_0x119b94[_0x0bde('0x34')]);_0x15147d[_0x0bde('0x37')]=_[_0x0bde('0x38')](_0x119b94['model'],qs['fields'](_0x143600[_0x0bde('0x34')][_0x0bde('0x39')]));_0x15147d[_0x0bde('0x37')]=_0x15147d[_0x0bde('0x37')][_0x0bde('0x4a')]?_0x15147d['attributes']:_0x119b94[_0x0bde('0x33')];_0x15147d[_0x0bde('0x81')]=qs[_0x0bde('0x3b')](_0x143600[_0x0bde('0x34')][_0x0bde('0x3b')]);_0x15147d['where']=qs[_0x0bde('0x36')](_[_0x0bde('0x3c')](_0x143600[_0x0bde('0x34')],_0x119b94['filters']));if(_0x143600[_0x0bde('0x34')][_0x0bde('0x3d')]){_0x15147d['where']=_['merge'](_0x15147d[_0x0bde('0x3e')],{'$or':_[_0x0bde('0x2f')](_0x15147d[_0x0bde('0x37')],function(_0xd53bcb){var _0x5959bb={};_0x5959bb[_0xd53bcb]={'$like':'%'+_0x143600[_0x0bde('0x34')][_0x0bde('0x3d')]+'%'};return _0x5959bb;})});}_0x15147d=_[_0x0bde('0x3f')]({},_0x15147d,_0x143600['options']);return _0x1fdb93[_0x0bde('0x7f')](_0x15147d);}})[_0x0bde('0x26')](function(_0x2a4f88){if(_0x2a4f88){_0x2d8b9d=_0x2a4f88[_0x0bde('0x4a')];if(!_0x143600[_0x0bde('0x34')][_0x0bde('0x82')](_0x0bde('0x3a'))){_0x15147d[_0x0bde('0x20')]=qs[_0x0bde('0x20')](_0x143600[_0x0bde('0x34')]['limit']);_0x15147d[_0x0bde('0x1d')]=qs[_0x0bde('0x1d')](_0x143600[_0x0bde('0x34')][_0x0bde('0x1d')]);}return _0x1fdb93[_0x0bde('0x7f')](_0x15147d);}})[_0x0bde('0x26')](function(_0x181cfb){if(_0x181cfb){return _0x181cfb?{'count':_0x2d8b9d,'rows':_0x181cfb}:null;}})[_0x0bde('0x26')](respondWithResult(_0x5db950,null))[_0x0bde('0x47')](handleError(_0x5db950,null));}; \ No newline at end of file +var _0x199a=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./dashboard.socket','register','sendStatus','end','status','json','offset','limit','count','set','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','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','clone','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','DashboardItem','getItems','zip-dir'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x199a,0x83));var _0xa199=function(_0x2f718d,_0x111df3){_0x2f718d=_0x2f718d-0x0;var _0x12459c=_0x199a[_0x2f718d];return _0x12459c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa199('0x0'));var jsonpatch=require(_0xa199('0x1'));var rp=require(_0xa199('0x2'));var moment=require(_0xa199('0x3'));var BPromise=require(_0xa199('0x4'));var Mustache=require(_0xa199('0x5'));var util=require(_0xa199('0x6'));var path=require(_0xa199('0x7'));var sox=require(_0xa199('0x8'));var csv=require(_0xa199('0x9'));var ejs=require(_0xa199('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa199('0xb'));var squel=require(_0xa199('0xc'));var crypto=require(_0xa199('0xd'));var jsforce=require(_0xa199('0xe'));var deskjs=require(_0xa199('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa199('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa199('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa199('0x12'));var hardwareService=require(_0xa199('0x13'));var logger=require('../../config/logger')(_0xa199('0x14'));var utils=require(_0xa199('0x15'));var config=require(_0xa199('0x16'));var licenseUtil=require(_0xa199('0x17'));var db=require(_0xa199('0x18'))['db'];config['redis']=_[_0xa199('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa199('0x1a')]));require(_0xa199('0x1b'))[_0xa199('0x1c')](socket);function respondWithStatusCode(_0x227a26,_0x527fd2){_0x527fd2=_0x527fd2||0xcc;return function(_0x32a547){if(_0x32a547){return _0x227a26[_0xa199('0x1d')](_0x527fd2);}return _0x227a26['status'](_0x527fd2)[_0xa199('0x1e')]();};}function respondWithResult(_0x2d1e89,_0x511ed7){_0x511ed7=_0x511ed7||0xc8;return function(_0x566b09){if(_0x566b09){return _0x2d1e89[_0xa199('0x1f')](_0x511ed7)[_0xa199('0x20')](_0x566b09);}};}function respondWithFilteredResult(_0x555aa5,_0x2b02c9){return function(_0x37f70d){if(_0x37f70d){var _0x5c5e1d=typeof _0x2b02c9[_0xa199('0x21')]==='undefined'&&typeof _0x2b02c9[_0xa199('0x22')]==='undefined';var _0x446f90=_0x37f70d['count'];var _0x18d4fb=_0x5c5e1d?0x0:_0x2b02c9['offset'];var _0x21ab4e=_0x5c5e1d?_0x37f70d[_0xa199('0x23')]:_0x2b02c9[_0xa199('0x21')]+_0x2b02c9[_0xa199('0x22')];var _0x48f7d1;if(_0x21ab4e>=_0x446f90){_0x21ab4e=_0x446f90;_0x48f7d1=0xc8;}else{_0x48f7d1=0xce;}_0x555aa5[_0xa199('0x1f')](_0x48f7d1);return _0x555aa5[_0xa199('0x24')]('Content-Range',_0x18d4fb+'-'+_0x21ab4e+'/'+_0x446f90)['json'](_0x37f70d);}return null;};}function patchUpdates(_0x4ff118){return function(_0x1d97b8){try{jsonpatch[_0xa199('0x25')](_0x1d97b8,_0x4ff118,!![]);}catch(_0x101379){return BPromise[_0xa199('0x26')](_0x101379);}return _0x1d97b8[_0xa199('0x27')]();};}function saveUpdates(_0x4f7244,_0x9f3b5d){return function(_0x207d50){if(_0x207d50){return _0x207d50[_0xa199('0x28')](_0x4f7244)[_0xa199('0x29')](function(_0x32ae50){return _0x32ae50;});}return null;};}function removeEntity(_0x502aea,_0x286b56){return function(_0x44894a){if(_0x44894a){return _0x44894a[_0xa199('0x2a')]()[_0xa199('0x29')](function(){var _0xae28b5=_0x44894a[_0xa199('0x2b')]({'plain':!![]});var _0xe16693=_0xa199('0x2c');return db[_0xa199('0x2d')][_0xa199('0x2a')]({'where':{'type':_0xe16693,'resourceId':_0xae28b5['id']}})[_0xa199('0x29')](function(){return _0x44894a;});})[_0xa199('0x29')](function(){_0x502aea[_0xa199('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59cf83,_0x28a041){return function(_0x4104f2){if(!_0x4104f2){_0x59cf83[_0xa199('0x1d')](0x194);}return _0x4104f2;};}function handleError(_0x1b1ac0,_0x40ef9e){_0x40ef9e=_0x40ef9e||0x1f4;return function(_0x1c94d0){logger[_0xa199('0x2e')](_0x1c94d0[_0xa199('0x2f')]);if(_0x1c94d0[_0xa199('0x30')]){delete _0x1c94d0[_0xa199('0x30')];}_0x1b1ac0[_0xa199('0x1f')](_0x40ef9e)[_0xa199('0x31')](_0x1c94d0);};}exports[_0xa199('0x32')]=function(_0x1d7584,_0x1ddd60){var _0x649073={},_0x26910a={},_0x513a30={'count':0x0,'rows':[]};var _0x29da6e=_[_0xa199('0x33')](db[_0xa199('0x34')][_0xa199('0x35')],function(_0x1357c7){return{'name':_0x1357c7[_0xa199('0x36')],'type':_0x1357c7[_0xa199('0x37')][_0xa199('0x38')]};});_0x26910a[_0xa199('0x39')]=_[_0xa199('0x33')](_0x29da6e,_0xa199('0x30'));_0x26910a[_0xa199('0x3a')]=_['keys'](_0x1d7584[_0xa199('0x3a')]);_0x26910a[_0xa199('0x3b')]=_[_0xa199('0x3c')](_0x26910a[_0xa199('0x39')],_0x26910a[_0xa199('0x3a')]);_0x649073[_0xa199('0x3d')]=_[_0xa199('0x3c')](_0x26910a[_0xa199('0x39')],qs[_0xa199('0x3e')](_0x1d7584[_0xa199('0x3a')][_0xa199('0x3e')]));_0x649073[_0xa199('0x3d')]=_0x649073[_0xa199('0x3d')][_0xa199('0x3f')]?_0x649073[_0xa199('0x3d')]:_0x26910a[_0xa199('0x39')];if(!_0x1d7584[_0xa199('0x3a')][_0xa199('0x40')](_0xa199('0x41'))){_0x649073[_0xa199('0x22')]=qs[_0xa199('0x22')](_0x1d7584[_0xa199('0x3a')][_0xa199('0x22')]);_0x649073['offset']=qs[_0xa199('0x21')](_0x1d7584[_0xa199('0x3a')][_0xa199('0x21')]);}_0x649073['order']=qs[_0xa199('0x42')](_0x1d7584[_0xa199('0x3a')][_0xa199('0x42')]);_0x649073[_0xa199('0x43')]=qs[_0xa199('0x3b')](_['pick'](_0x1d7584[_0xa199('0x3a')],_0x26910a[_0xa199('0x3b')]),_0x29da6e);if(_0x1d7584[_0xa199('0x3a')]['filter']){_0x649073[_0xa199('0x43')]=_[_0xa199('0x44')](_0x649073[_0xa199('0x43')],{'$or':_[_0xa199('0x33')](_0x29da6e,function(_0x4f5ab4){if(_0x4f5ab4[_0xa199('0x37')]!==_0xa199('0x45')){var _0xff9458={};_0xff9458[_0x4f5ab4[_0xa199('0x30')]]={'$like':'%'+_0x1d7584[_0xa199('0x3a')][_0xa199('0x46')]+'%'};return _0xff9458;}})});}_0x649073=_[_0xa199('0x44')]({},_0x649073,_0x1d7584[_0xa199('0x47')]);var _0x198b25={'where':_0x649073[_0xa199('0x43')]};return db['Dashboard'][_0xa199('0x23')](_0x198b25)[_0xa199('0x29')](function(_0x8b5dee){_0x513a30[_0xa199('0x23')]=_0x8b5dee;if(_0x1d7584[_0xa199('0x3a')][_0xa199('0x48')]){_0x649073[_0xa199('0x49')]=[{'all':!![]}];}return db[_0xa199('0x34')][_0xa199('0x4a')](_0x649073);})[_0xa199('0x29')](function(_0x6c479){_0x513a30[_0xa199('0x4b')]=_0x6c479;return _0x513a30;})['then'](respondWithFilteredResult(_0x1ddd60,_0x649073))[_0xa199('0x4c')](handleError(_0x1ddd60,null));};exports[_0xa199('0x4d')]=function(_0x5023b5,_0x12aec9){var _0x4d0322={'raw':![],'where':{'id':_0x5023b5[_0xa199('0x4e')]['id']}},_0x287caa={};_0x287caa[_0xa199('0x39')]=_[_0xa199('0x4f')](db[_0xa199('0x34')][_0xa199('0x35')]);_0x287caa[_0xa199('0x3a')]=_[_0xa199('0x4f')](_0x5023b5[_0xa199('0x3a')]);_0x287caa[_0xa199('0x3b')]=_[_0xa199('0x3c')](_0x287caa[_0xa199('0x39')],_0x287caa[_0xa199('0x3a')]);_0x4d0322[_0xa199('0x3d')]=_[_0xa199('0x3c')](_0x287caa[_0xa199('0x39')],qs[_0xa199('0x3e')](_0x5023b5['query'][_0xa199('0x3e')]));_0x4d0322[_0xa199('0x3d')]=_0x4d0322[_0xa199('0x3d')][_0xa199('0x3f')]?_0x4d0322['attributes']:_0x287caa[_0xa199('0x39')];if(_0x5023b5[_0xa199('0x3a')][_0xa199('0x48')]){_0x4d0322[_0xa199('0x49')]=[{'all':!![]}];}_0x4d0322=_[_0xa199('0x44')]({},_0x4d0322,_0x5023b5[_0xa199('0x47')]);return db[_0xa199('0x34')]['find'](_0x4d0322)[_0xa199('0x29')](handleEntityNotFound(_0x12aec9,null))[_0xa199('0x29')](respondWithResult(_0x12aec9,null))[_0xa199('0x4c')](handleError(_0x12aec9,null));};exports['create']=function(_0x1a77a7,_0x137059){return db[_0xa199('0x34')][_0xa199('0x50')](_0x1a77a7[_0xa199('0x51')],{})[_0xa199('0x29')](function(_0x2dbb46){var _0x54feb0=_0x1a77a7[_0xa199('0x52')][_0xa199('0x2b')]({'plain':!![]});if(!_0x54feb0)throw new Error(_0xa199('0x53'));if(_0x54feb0[_0xa199('0x54')]==='user'){var _0x2120e1=_0x2dbb46['get']({'plain':!![]});var _0x4bd505=_0xa199('0x2c');return db[_0xa199('0x55')][_0xa199('0x56')]({'where':{'name':_0x4bd505,'userProfileId':_0x54feb0[_0xa199('0x57')]},'raw':!![]})[_0xa199('0x29')](function(_0x50885f){if(_0x50885f&&_0x50885f[_0xa199('0x58')]===0x0){return db[_0xa199('0x2d')]['create']({'name':_0x2120e1['name'],'resourceId':_0x2120e1['id'],'type':_0x50885f['name'],'sectionId':_0x50885f['id']},{})[_0xa199('0x29')](function(){return _0x2dbb46;});}else{return _0x2dbb46;}})[_0xa199('0x4c')](function(_0x37b578){logger[_0xa199('0x2e')](_0xa199('0x59'),_0x37b578);throw _0x37b578;});}return _0x2dbb46;})['then'](respondWithResult(_0x137059,0xc9))[_0xa199('0x4c')](handleError(_0x137059,null));};exports[_0xa199('0x5a')]=function(_0x1e2455,_0x56961b){var _0x302e92={'where':{'id':_0x1e2455[_0xa199('0x4e')]['id']}},_0x50fdf2={};_0x50fdf2[_0xa199('0x39')]=_[_0xa199('0x4f')](db[_0xa199('0x34')][_0xa199('0x35')]);_0x302e92[_0xa199('0x3d')]=_[_0xa199('0x3c')](_0x50fdf2[_0xa199('0x39')],qs['fields'](_0x1e2455[_0xa199('0x3a')][_0xa199('0x3e')]));_0x302e92[_0xa199('0x3d')]=_0x302e92['attributes']['length']?_0x302e92[_0xa199('0x3d')]:_0x50fdf2['model'];if(_0x1e2455[_0xa199('0x3a')]['includeAll']){_0x302e92['include']=[{'all':!![]}];}_0x302e92=_[_0xa199('0x44')]({},_0x302e92,_0x1e2455[_0xa199('0x47')]);return db[_0xa199('0x34')]['find'](_0x302e92)[_0xa199('0x29')](handleEntityNotFound(_0x56961b,null))[_0xa199('0x29')](function(_0x2c7204){if(_0x2c7204){var _0x59fca5=_0x2c7204[_0xa199('0x2b')]({'plain':!![]});_0x59fca5=qs[_0xa199('0x5b')](_0x59fca5,['id',_0xa199('0x5c'),_0xa199('0x5d')]);_0x1e2455[_0xa199('0x51')]=_['omit'](_0x1e2455[_0xa199('0x51')],['id',_0xa199('0x5c'),_0xa199('0x5d')]);return db[_0xa199('0x34')][_0xa199('0x50')](_[_0xa199('0x44')](_0x59fca5,_0x1e2455[_0xa199('0x51')]),{'include':_0x1e2455[_0xa199('0x3a')][_0xa199('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x598429){var _0x5864dc=_0x1e2455[_0xa199('0x52')][_0xa199('0x2b')]({'plain':!![]});if(!_0x5864dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5864dc[_0xa199('0x54')]==='user'){var _0x11e653=_0x598429[_0xa199('0x2b')]({'plain':!![]});var _0xf49cc3=_0xa199('0x2c');return db[_0xa199('0x55')]['find']({'where':{'name':_0xf49cc3,'userProfileId':_0x5864dc[_0xa199('0x57')]},'raw':!![]})[_0xa199('0x29')](function(_0x7dad7d){if(_0x7dad7d&&_0x7dad7d[_0xa199('0x58')]===0x0){return db[_0xa199('0x2d')][_0xa199('0x50')]({'name':_0x11e653[_0xa199('0x30')],'resourceId':_0x11e653['id'],'type':_0x7dad7d[_0xa199('0x30')],'sectionId':_0x7dad7d['id']},{})['then'](function(){return _0x598429;});}else{return _0x598429;}})[_0xa199('0x4c')](function(_0x55e95e){logger[_0xa199('0x2e')](_0xa199('0x59'),_0x55e95e);throw _0x55e95e;});}return _0x598429;});}})[_0xa199('0x29')](respondWithResult(_0x56961b,0xc9))['catch'](handleError(_0x56961b,null));};exports['update']=function(_0x595987,_0xa2c9fe){if(_0x595987[_0xa199('0x51')]['id']){delete _0x595987[_0xa199('0x51')]['id'];}return db['Dashboard'][_0xa199('0x56')]({'where':{'id':_0x595987[_0xa199('0x4e')]['id']}})['then'](handleEntityNotFound(_0xa2c9fe,null))[_0xa199('0x29')](saveUpdates(_0x595987[_0xa199('0x51')],null))[_0xa199('0x29')](respondWithResult(_0xa2c9fe,null))[_0xa199('0x4c')](handleError(_0xa2c9fe,null));};exports[_0xa199('0x2a')]=function(_0x2a43a7,_0x581d4d){return db[_0xa199('0x34')][_0xa199('0x56')]({'where':{'id':_0x2a43a7[_0xa199('0x4e')]['id']}})['then'](handleEntityNotFound(_0x581d4d,null))[_0xa199('0x29')](removeEntity(_0x581d4d,null))['catch'](handleError(_0x581d4d,null));};function widgetAttributes(_0x57194c){try{switch(_0x57194c[_0xa199('0x37')]){case _0xa199('0x5e'):return[{'name':_0xa199('0x5f'),'value':_0x57194c[_0xa199('0x5f')]||(_0x57194c['attrs']&&_0x57194c['attrs'][0x0]?_0x57194c[_0xa199('0x60')][0x0][_0xa199('0x61')]:undefined)||_0xa199('0x62')}];case _0xa199('0x63'):return[{'name':_0xa199('0x64'),'value':_0x57194c[_0xa199('0x64')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x0]?_0x57194c[_0xa199('0x60')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xa199('0x65'),'value':_0x57194c['attrHourFormat']||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x0]?_0x57194c[_0xa199('0x60')][0x0][_0xa199('0x61')]:undefined)||_0xa199('0x66')},{'name':_0xa199('0x67'),'value':_0x57194c[_0xa199('0x67')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x1]?_0x57194c[_0xa199('0x60')][0x1][_0xa199('0x61')]:undefined)||_0xa199('0x68')},{'name':_0xa199('0x69'),'value':_0x57194c[_0xa199('0x69')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c['attrs'][0x2]?_0x57194c[_0xa199('0x60')][0x2][_0xa199('0x61')]:undefined)||0xc}];case _0xa199('0x6a'):return[{'name':_0xa199('0x6b'),'value':_0x57194c[_0xa199('0x6b')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x0]?_0x57194c[_0xa199('0x60')][0x0][_0xa199('0x61')]:undefined)||'total'},{'name':_0xa199('0x6c'),'value':_0x57194c[_0xa199('0x6c')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x1]?_0x57194c['attrs'][0x1][_0xa199('0x61')]:undefined)||[]},{'name':_0xa199('0x69'),'value':_0x57194c[_0xa199('0x69')]||(_0x57194c['attrs']&&_0x57194c[_0xa199('0x60')][0x2]?_0x57194c[_0xa199('0x60')][0x2][_0xa199('0x61')]:undefined)||0x14},{'name':_0xa199('0x6d'),'value':_0x57194c[_0xa199('0x6d')]||(_0x57194c['attrs']&&_0x57194c[_0xa199('0x60')][0x3]?_0x57194c['attrs'][0x3]['value']:undefined)||'voice'},{'name':_0xa199('0x6e'),'value':_0x57194c['attrEmailAccounts']||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x4]?_0x57194c[_0xa199('0x60')][0x4][_0xa199('0x61')]:undefined)||''},{'name':_0xa199('0x6f'),'value':_0x57194c['attrFaxAccounts']||(_0x57194c['attrs']&&_0x57194c[_0xa199('0x60')][0x5]?_0x57194c[_0xa199('0x60')][0x5]['value']:undefined)||''},{'name':_0xa199('0x70'),'value':_0x57194c[_0xa199('0x70')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c['attrs'][0x6]?_0x57194c[_0xa199('0x60')][0x6][_0xa199('0x61')]:undefined)||''},{'name':_0xa199('0x71'),'value':_0x57194c[_0xa199('0x71')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x7]?_0x57194c['attrs'][0x7]['value']:undefined)||''},{'name':_0xa199('0x72'),'value':_0x57194c[_0xa199('0x72')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x8]?_0x57194c[_0xa199('0x60')][0x8][_0xa199('0x61')]:undefined)||''},{'name':_0xa199('0x73'),'value':_0x57194c[_0xa199('0x73')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x9]?_0x57194c[_0xa199('0x60')][0x9][_0xa199('0x61')]:undefined)||''}];case _0xa199('0x74'):case'pie-chart':return[{'name':_0xa199('0x75'),'value':_0x57194c[_0xa199('0x75')]||(_0x57194c['attrs']&&_0x57194c['attrs'][0x0]?_0x57194c[_0xa199('0x60')][0x0][_0xa199('0x61')]:undefined)||_0xa199('0x76')},{'name':_0xa199('0x77'),'value':_0x57194c[_0xa199('0x77')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x1]?_0x57194c['attrs'][0x1][_0xa199('0x61')]:undefined)||null},{'name':_0xa199('0x78'),'value':_0x57194c[_0xa199('0x78')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x2]?_0x57194c[_0xa199('0x60')][0x2][_0xa199('0x61')]:undefined)||null},{'name':_0xa199('0x6c'),'value':_0x57194c[_0xa199('0x6c')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x3]?_0x57194c[_0xa199('0x60')][0x3]['value']:undefined)||[]},{'name':_0xa199('0x6d'),'value':_0x57194c[_0xa199('0x6d')]||(_0x57194c['attrs']&&_0x57194c[_0xa199('0x60')][0x4]?_0x57194c[_0xa199('0x60')][0x4][_0xa199('0x61')]:undefined)||_0xa199('0x79')},{'name':_0xa199('0x6e'),'value':_0x57194c[_0xa199('0x6e')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x5]?_0x57194c[_0xa199('0x60')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x57194c['attrFaxAccounts']||(_0x57194c['attrs']&&_0x57194c[_0xa199('0x60')][0x6]?_0x57194c['attrs'][0x6][_0xa199('0x61')]:undefined)||''},{'name':_0xa199('0x70'),'value':_0x57194c[_0xa199('0x70')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x7]?_0x57194c[_0xa199('0x60')][0x7][_0xa199('0x61')]:undefined)||''},{'name':_0xa199('0x71'),'value':_0x57194c[_0xa199('0x71')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x8]?_0x57194c[_0xa199('0x60')][0x8][_0xa199('0x61')]:undefined)||''},{'name':_0xa199('0x72'),'value':_0x57194c[_0xa199('0x72')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x9]?_0x57194c[_0xa199('0x60')][0x9]['value']:undefined)||''},{'name':_0xa199('0x73'),'value':_0x57194c[_0xa199('0x73')]||(_0x57194c[_0xa199('0x60')]&&_0x57194c['attrs'][0xa]?_0x57194c[_0xa199('0x60')][0xa]['value']:undefined)||''}];case _0xa199('0x7a'):return[{'name':_0xa199('0x7b'),'type':_0x57194c['reportType']||(_0x57194c['attrs']&&_0x57194c['attrs'][0x0]?_0x57194c[_0xa199('0x60')][0x0][_0xa199('0x37')]:undefined)||null,'value':_0x57194c['attrReport']||(_0x57194c[_0xa199('0x60')]&&_0x57194c[_0xa199('0x60')][0x0]?_0x57194c[_0xa199('0x60')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x57194c[_0xa199('0x7c')]||(_0x57194c['attrs']&&_0x57194c[_0xa199('0x60')][0x1]?_0x57194c['attrs'][0x1][_0xa199('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x256c7e){logger[_0xa199('0x2e')](_0xa199('0x7d'),JSON[_0xa199('0x7e')](_0x256c7e));return[];}}exports[_0xa199('0x7f')]=function(_0x876171,_0x50c192,_0x138c32){if(_0x876171[_0xa199('0x51')]['id']){delete _0x876171[_0xa199('0x51')]['id'];}return db[_0xa199('0x34')]['find']({'where':{'id':_0x876171[_0xa199('0x4e')]['id']}})['then'](handleEntityNotFound(_0x50c192,null))[_0xa199('0x29')](function(_0x5eee29){if(_0x5eee29){_0x876171['body'][_0xa199('0x80')]=_0x5eee29['id'];_0x876171['body'][_0xa199('0x60')]=widgetAttributes(_0x876171[_0xa199('0x51')]);return db['DashboardItem'][_0xa199('0x50')](_0x876171['body']);}})[_0xa199('0x29')](respondWithResult(_0x50c192,null))['catch'](handleError(_0x50c192,null));};exports['getItems']=function(_0x4c6d9e,_0x4780b8,_0x5923e0){var _0x1d7f72={};var _0x6db1ea={};var _0x200f2a;var _0x335c3f;return db['Dashboard'][_0xa199('0x81')]({'where':{'id':_0x4c6d9e[_0xa199('0x4e')]['id']}})[_0xa199('0x29')](handleEntityNotFound(_0x4780b8,null))['then'](function(_0x237850){if(_0x237850){_0x200f2a=_0x237850;_0x6db1ea[_0xa199('0x39')]=_[_0xa199('0x4f')](db[_0xa199('0x82')]['rawAttributes']);_0x6db1ea[_0xa199('0x3a')]=_['keys'](_0x4c6d9e[_0xa199('0x3a')]);_0x6db1ea[_0xa199('0x3b')]=_[_0xa199('0x3c')](_0x6db1ea[_0xa199('0x39')],_0x6db1ea[_0xa199('0x3a')]);_0x1d7f72['attributes']=_[_0xa199('0x3c')](_0x6db1ea['model'],qs[_0xa199('0x3e')](_0x4c6d9e[_0xa199('0x3a')][_0xa199('0x3e')]));_0x1d7f72['attributes']=_0x1d7f72[_0xa199('0x3d')][_0xa199('0x3f')]?_0x1d7f72[_0xa199('0x3d')]:_0x6db1ea[_0xa199('0x39')];_0x1d7f72['order']=qs[_0xa199('0x42')](_0x4c6d9e[_0xa199('0x3a')][_0xa199('0x42')]);_0x1d7f72[_0xa199('0x43')]=qs['filters'](_['pick'](_0x4c6d9e['query'],_0x6db1ea['filters']));if(_0x4c6d9e['query'][_0xa199('0x46')]){_0x1d7f72['where']=_[_0xa199('0x44')](_0x1d7f72['where'],{'$or':_[_0xa199('0x33')](_0x1d7f72['attributes'],function(_0x336c7d){var _0x2eed82={};_0x2eed82[_0x336c7d]={'$like':'%'+_0x4c6d9e[_0xa199('0x3a')]['filter']+'%'};return _0x2eed82;})});}_0x1d7f72=_[_0xa199('0x44')]({},_0x1d7f72,_0x4c6d9e['options']);return _0x200f2a[_0xa199('0x83')](_0x1d7f72);}})['then'](function(_0x2d0bfc){if(_0x2d0bfc){_0x335c3f=_0x2d0bfc[_0xa199('0x3f')];if(!_0x4c6d9e[_0xa199('0x3a')][_0xa199('0x40')]('nolimit')){_0x1d7f72[_0xa199('0x22')]=qs['limit'](_0x4c6d9e[_0xa199('0x3a')][_0xa199('0x22')]);_0x1d7f72['offset']=qs[_0xa199('0x21')](_0x4c6d9e[_0xa199('0x3a')][_0xa199('0x21')]);}return _0x200f2a[_0xa199('0x83')](_0x1d7f72);}})[_0xa199('0x29')](function(_0x30d126){if(_0x30d126){return _0x30d126?{'count':_0x335c3f,'rows':_0x30d126}:null;}})[_0xa199('0x29')](respondWithResult(_0x4780b8,null))['catch'](handleError(_0x4780b8,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7cc0a95..f571ddb 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 _0x45bb=['update','remove','emit','hook','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x45bb,0x79));var _0xb45b=function(_0x31d422,_0x3b39aa){_0x31d422=_0x31d422-0x0;var _0x598462=_0x45bb[_0x31d422];return _0x598462;};'use strict';var EventEmitter=require(_0xb45b('0x0'));var Dashboard=require(_0xb45b('0x1'))['db'][_0xb45b('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb45b('0x3')](0x0);var events={'afterCreate':_0xb45b('0x4'),'afterUpdate':_0xb45b('0x5'),'afterDestroy':_0xb45b('0x6')};function emitEvent(_0x431dea){return function(_0xac5ee2,_0x145e7a,_0x2802b0){DashboardEvents[_0xb45b('0x7')](_0x431dea+':'+_0xac5ee2['id'],_0xac5ee2);DashboardEvents['emit'](_0x431dea,_0xac5ee2);_0x2802b0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xb45b('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x042a=['exports','events','Dashboard','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x356367,_0x303dd0){var _0xb639f1=function(_0x47157c){while(--_0x47157c){_0x356367['push'](_0x356367['shift']());}};_0xb639f1(++_0x303dd0);}(_0x042a,0x1d9));var _0xa042=function(_0x3f4668,_0x111967){_0x3f4668=_0x3f4668-0x0;var _0x5893e1=_0x042a[_0x3f4668];return _0x5893e1;};'use strict';var EventEmitter=require(_0xa042('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xa042('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa042('0x2')](0x0);var events={'afterCreate':_0xa042('0x3'),'afterUpdate':'update','afterDestroy':_0xa042('0x4')};function emitEvent(_0x368f0d){return function(_0xc28407,_0x37c7a8,_0x3580d6){DashboardEvents[_0xa042('0x5')](_0x368f0d+':'+_0xc28407['id'],_0xc28407);DashboardEvents[_0xa042('0x5')](_0x368f0d,_0xc28407);_0x3580d6(null);};}for(var e in events){if(events[_0xa042('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xa042('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index fad3068..8a11dcf 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 _0x843b=['./dashboard.attributes','exports','define','dashboards','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x314864,_0x49fbd2){var _0x1a7005=function(_0x54e475){while(--_0x54e475){_0x314864['push'](_0x314864['shift']());}};_0x1a7005(++_0x49fbd2);}(_0x843b,0x143));var _0xb843=function(_0x56f972,_0x5f3bd3){_0x56f972=_0x56f972-0x0;var _0x3f299e=_0x843b[_0x56f972];return _0x3f299e;};'use strict';var _=require(_0xb843('0x0'));var util=require(_0xb843('0x1'));var logger=require('../../config/logger')(_0xb843('0x2'));var moment=require('moment');var BPromise=require(_0xb843('0x3'));var rp=require(_0xb843('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb843('0x5'));var config=require(_0xb843('0x6'));var attributes=require(_0xb843('0x7'));module[_0xb843('0x8')]=function(_0x2274cc,_0x574710){return _0x2274cc[_0xb843('0x9')]('Dashboard',attributes,{'tableName':_0xb843('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa316=['api','moment','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','../../config/logger'];(function(_0x423a82,_0x5e6c40){var _0x5a7a2c=function(_0x475803){while(--_0x475803){_0x423a82['push'](_0x423a82['shift']());}};_0x5a7a2c(++_0x5e6c40);}(_0xa316,0x1af));var _0x6a31=function(_0x495f0e,_0x5e71e2){_0x495f0e=_0x495f0e-0x0;var _0x450187=_0xa316[_0x495f0e];return _0x450187;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a31('0x0'))(_0x6a31('0x1'));var moment=require(_0x6a31('0x2'));var BPromise=require(_0x6a31('0x3'));var rp=require(_0x6a31('0x4'));var fs=require('fs');var path=require(_0x6a31('0x5'));var rimraf=require(_0x6a31('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a31('0x7'));module[_0x6a31('0x8')]=function(_0x41c24d,_0x2f4987){return _0x41c24d[_0x6a31('0x9')](_0x6a31('0xa'),attributes,{'tableName':_0x6a31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 08479f0..4fa4b9d 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 _0xa03e=['localhost','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x197683,_0x21df72){var _0x137639=function(_0x46b902){while(--_0x46b902){_0x197683['push'](_0x197683['shift']());}};_0x137639(++_0x21df72);}(_0xa03e,0xda));var _0xea03=function(_0x12dede,_0x41b01a){_0x12dede=_0x12dede-0x0;var _0x391367=_0xa03e[_0x12dede];return _0x391367;};'use strict';var _=require('lodash');var util=require(_0xea03('0x0'));var moment=require(_0xea03('0x1'));var BPromise=require(_0xea03('0x2'));var rs=require(_0xea03('0x3'));var fs=require('fs');var Redis=require(_0xea03('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea03('0x5'));var logger=require(_0xea03('0x6'))(_0xea03('0x7'));var config=require(_0xea03('0x8'));var jayson=require(_0xea03('0x9'));var client=jayson[_0xea03('0xa')][_0xea03('0xb')]({'port':0x232a});config[_0xea03('0xc')]=_[_0xea03('0xd')](config[_0xea03('0xc')],{'host':_0xea03('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xea03('0xf'))[_0xea03('0x10')](socket);function respondWithRpcPromise(_0x43e1b0,_0x40758c,_0x3b5a02){return new BPromise(function(_0x1b35ef,_0x36e370){return client[_0xea03('0x11')](_0x43e1b0,_0x3b5a02)[_0xea03('0x12')](function(_0x5f337f){logger['info'](_0xea03('0x13'),_0x40758c,_0xea03('0x14'));logger['debug'](_0xea03('0x15'),_0x40758c,_0xea03('0x14'),JSON[_0xea03('0x16')](_0x5f337f));if(_0x5f337f['error']){if(_0x5f337f[_0xea03('0x17')][_0xea03('0x18')]===0x1f4){logger[_0xea03('0x17')](_0xea03('0x13'),_0x40758c,_0x5f337f[_0xea03('0x17')][_0xea03('0x19')]);return _0x36e370(_0x5f337f['error']['message']);}logger[_0xea03('0x17')]('Dashboard,\x20%s,\x20%s',_0x40758c,_0x5f337f[_0xea03('0x17')][_0xea03('0x19')]);return _0x1b35ef(_0x5f337f[_0xea03('0x17')]['message']);}else{logger[_0xea03('0x1a')]('Dashboard,\x20%s,\x20%s',_0x40758c,_0xea03('0x14'));_0x1b35ef(_0x5f337f[_0xea03('0x1b')]['message']);}})[_0xea03('0x1c')](function(_0x5ba016){logger[_0xea03('0x17')](_0xea03('0x13'),_0x40758c,_0x5ba016);_0x36e370(_0x5ba016);});});} \ No newline at end of file +var _0x2f91=['stringify','error','Dashboard,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x14c24b,_0x376eac){var _0x703557=function(_0x2daf4b){while(--_0x2daf4b){_0x14c24b['push'](_0x14c24b['shift']());}};_0x703557(++_0x376eac);}(_0x2f91,0xd4));var _0x12f9=function(_0x31f6d7,_0x29c889){_0x31f6d7=_0x31f6d7-0x0;var _0x3ee936=_0x2f91[_0x31f6d7];return _0x3ee936;};'use strict';var _=require(_0x12f9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x12f9('0x1'));var rs=require(_0x12f9('0x2'));var fs=require('fs');var Redis=require(_0x12f9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x12f9('0x4'))(_0x12f9('0x5'));var config=require(_0x12f9('0x6'));var jayson=require(_0x12f9('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x12f9('0x8')],{'host':_0x12f9('0x9'),'port':0x18eb});var socket=require(_0x12f9('0xa'))(new Redis(config['redis']));require(_0x12f9('0xb'))['register'](socket);function respondWithRpcPromise(_0x33e65d,_0x40de21,_0xf9985e){return new BPromise(function(_0x42c31a,_0xdfec3d){return client[_0x12f9('0xc')](_0x33e65d,_0xf9985e)[_0x12f9('0xd')](function(_0x541fd5){logger[_0x12f9('0xe')]('Dashboard,\x20%s,\x20%s',_0x40de21,_0x12f9('0xf'));logger[_0x12f9('0x10')](_0x12f9('0x11'),_0x40de21,_0x12f9('0xf'),JSON[_0x12f9('0x12')](_0x541fd5));if(_0x541fd5[_0x12f9('0x13')]){if(_0x541fd5[_0x12f9('0x13')]['code']===0x1f4){logger[_0x12f9('0x13')](_0x12f9('0x14'),_0x40de21,_0x541fd5[_0x12f9('0x13')][_0x12f9('0x15')]);return _0xdfec3d(_0x541fd5[_0x12f9('0x13')][_0x12f9('0x15')]);}logger[_0x12f9('0x13')]('Dashboard,\x20%s,\x20%s',_0x40de21,_0x541fd5[_0x12f9('0x13')]['message']);return _0x42c31a(_0x541fd5[_0x12f9('0x13')][_0x12f9('0x15')]);}else{logger[_0x12f9('0xe')](_0x12f9('0x14'),_0x40de21,_0x12f9('0xf'));_0x42c31a(_0x541fd5['result'][_0x12f9('0x15')]);}})[_0x12f9('0x16')](function(_0x362b0f){logger[_0x12f9('0x13')]('Dashboard,\x20%s,\x20%s',_0x40de21,_0x362b0f);_0xdfec3d(_0x362b0f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 6160ec1..66f7a30 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 _0xa68f=['emit','removeListener','register','length','dashboard:','./dashboard.events','save','update'];(function(_0x68eab0,_0xa8c589){var _0x4e481c=function(_0x49c097){while(--_0x49c097){_0x68eab0['push'](_0x68eab0['shift']());}};_0x4e481c(++_0xa8c589);}(_0xa68f,0x7d));var _0xfa68=function(_0xa25253,_0x33b4a0){_0xa25253=_0xa25253-0x0;var _0xb946cd=_0xa68f[_0xa25253];return _0xb946cd;};'use strict';var DashboardEvents=require(_0xfa68('0x0'));var events=[_0xfa68('0x1'),'remove',_0xfa68('0x2')];function createListener(_0x25ddce,_0x26015e){return function(_0x7d6b1){_0x26015e[_0xfa68('0x3')](_0x25ddce,_0x7d6b1);};}function removeListener(_0xbc8463,_0x50d286){return function(){DashboardEvents[_0xfa68('0x4')](_0xbc8463,_0x50d286);};}exports[_0xfa68('0x5')]=function(_0x264980){for(var _0x450bc4=0x0,_0x2975b7=events[_0xfa68('0x6')];_0x450bc4<_0x2975b7;_0x450bc4++){var _0x141994=events[_0x450bc4];var _0x1f7e32=createListener(_0xfa68('0x7')+_0x141994,_0x264980);DashboardEvents['on'](_0x141994,_0x1f7e32);}}; \ No newline at end of file +var _0x8ae9=['save','remove','emit','register','length','dashboard:'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8ae9,0x1e6));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x98ae('0x0'),_0x98ae('0x1'),'update'];function createListener(_0x1f0830,_0x265536){return function(_0x5489cb){_0x265536[_0x98ae('0x2')](_0x1f0830,_0x5489cb);};}function removeListener(_0x328c68,_0x591dd0){return function(){DashboardEvents['removeListener'](_0x328c68,_0x591dd0);};}exports[_0x98ae('0x3')]=function(_0x4da4cc){for(var _0x408c79=0x0,_0x386b19=events[_0x98ae('0x4')];_0x408c79<_0x386b19;_0x408c79++){var _0x222183=events[_0x408c79];var _0x1e178f=createListener(_0x98ae('0x5')+_0x222183,_0x4da4cc);DashboardEvents['on'](_0x222183,_0x1e178f);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3091d1a..b558d2f 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 _0x7327=['delete','destroy','exports','path','connect-timeout','express','fs-extra','../../config/environment','./dashboard.controller','isAuthenticated','/:id','show','get','/:id/items','getItems','post','create','/:id/clone','clone','put','update'];(function(_0x143057,_0x2689bd){var _0x55f417=function(_0x42ce62){while(--_0x42ce62){_0x143057['push'](_0x143057['shift']());}};_0x55f417(++_0x2689bd);}(_0x7327,0xff));var _0x7732=function(_0x32b181,_0x590b0f){_0x32b181=_0x32b181-0x0;var _0x50d5ef=_0x7327[_0x32b181];return _0x50d5ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7732('0x0'));var timeout=require(_0x7732('0x1'));var express=require(_0x7732('0x2'));var router=express['Router']();var fs_extra=require(_0x7732('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7732('0x4'));var controller=require(_0x7732('0x5'));router['get']('/',auth[_0x7732('0x6')](),controller['index']);router['get'](_0x7732('0x7'),auth[_0x7732('0x6')](),controller[_0x7732('0x8')]);router[_0x7732('0x9')](_0x7732('0xa'),auth['isAuthenticated'](),controller[_0x7732('0xb')]);router[_0x7732('0xc')]('/',auth[_0x7732('0x6')](),controller[_0x7732('0xd')]);router[_0x7732('0xc')](_0x7732('0xe'),auth[_0x7732('0x6')](),controller[_0x7732('0xf')]);router[_0x7732('0xc')](_0x7732('0xa'),auth['isAuthenticated'](),controller['addItem']);router[_0x7732('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x7732('0x11')]);router[_0x7732('0x12')](_0x7732('0x7'),auth[_0x7732('0x6')](),controller[_0x7732('0x13')]);module[_0x7732('0x14')]=router; \ No newline at end of file +var _0xc5e7=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','getItems','post','create','addItem','put','update','delete','destroy'];(function(_0x19d61d,_0x536c67){var _0x2af680=function(_0x409bdc){while(--_0x409bdc){_0x19d61d['push'](_0x19d61d['shift']());}};_0x2af680(++_0x536c67);}(_0xc5e7,0x8b));var _0x7c5e=function(_0x2f1343,_0x59bd6a){_0x2f1343=_0x2f1343-0x0;var _0x2d8268=_0xc5e7[_0x2f1343];return _0x2d8268;};'use strict';var multer=require(_0x7c5e('0x0'));var util=require(_0x7c5e('0x1'));var path=require(_0x7c5e('0x2'));var timeout=require(_0x7c5e('0x3'));var express=require(_0x7c5e('0x4'));var router=express[_0x7c5e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7c5e('0x6'));var interaction=require(_0x7c5e('0x7'));var config=require('../../config/environment');var controller=require(_0x7c5e('0x8'));router[_0x7c5e('0x9')]('/',auth[_0x7c5e('0xa')](),controller['index']);router[_0x7c5e('0x9')](_0x7c5e('0xb'),auth['isAuthenticated'](),controller[_0x7c5e('0xc')]);router['get'](_0x7c5e('0xd'),auth[_0x7c5e('0xa')](),controller[_0x7c5e('0xe')]);router[_0x7c5e('0xf')]('/',auth[_0x7c5e('0xa')](),controller[_0x7c5e('0x10')]);router[_0x7c5e('0xf')]('/:id/clone',auth[_0x7c5e('0xa')](),controller['clone']);router[_0x7c5e('0xf')]('/:id/items',auth['isAuthenticated'](),controller[_0x7c5e('0x11')]);router[_0x7c5e('0x12')](_0x7c5e('0xb'),auth[_0x7c5e('0xa')](),controller[_0x7c5e('0x13')]);router[_0x7c5e('0x14')](_0x7c5e('0xb'),auth['isAuthenticated'](),controller[_0x7c5e('0x15')]);module[_0x7c5e('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index e578ed6..8efa5f6 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 _0xafc4=['TEXT','long','setDataValue','attrs','stringify','INTEGER','sequelize','lodash','STRING'];(function(_0x224742,_0x2c1bd2){var _0x31ed17=function(_0x1d7dcb){while(--_0x1d7dcb){_0x224742['push'](_0x224742['shift']());}};_0x31ed17(++_0x2c1bd2);}(_0xafc4,0x69));var _0x4afc=function(_0x390ad2,_0x3f1550){_0x390ad2=_0x390ad2-0x0;var _0x36c5e1=_0xafc4[_0x390ad2];return _0x36c5e1;};'use strict';var Sequelize=require(_0x4afc('0x0'));var squel=require('squel');var _=require(_0x4afc('0x1'));module['exports']={'title':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4afc('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4afc('0x3')](_0x4afc('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue']('attrs'));}catch(_0x36cb50){return[];}},'set':function(_0x471d45){try{this[_0x4afc('0x5')](_0x4afc('0x6'),JSON[_0x4afc('0x7')](_0x471d45));}catch(_0xaf053d){this['setDataValue'](_0x4afc('0x6'),JSON[_0x4afc('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4afc('0x8')]},'col':{'type':Sequelize[_0x4afc('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4afc('0x2')]},'titleFontSize':{'type':Sequelize[_0x4afc('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0x33af=['attrs','setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse'];(function(_0x407034,_0x5c8aee){var _0x26b266=function(_0x635231){while(--_0x635231){_0x407034['push'](_0x407034['shift']());}};_0x26b266(++_0x5c8aee);}(_0x33af,0xec));var _0xf33a=function(_0x4e0403,_0x23bb0a){_0x4e0403=_0x4e0403-0x0;var _0xb4ab4f=_0x33af[_0x4e0403];return _0xb4ab4f;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xf33a('0x0'));var _=require('lodash');module[_0xf33a('0x1')]={'title':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf33a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf33a('0x3')](_0xf33a('0x4')),'get':function(){try{return JSON[_0xf33a('0x5')](this['getDataValue'](_0xf33a('0x6')));}catch(_0x44cfa5){return[];}},'set':function(_0x583e54){try{this[_0xf33a('0x7')](_0xf33a('0x6'),JSON[_0xf33a('0x8')](_0x583e54));}catch(_0x2f3730){this[_0xf33a('0x7')](_0xf33a('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf33a('0x9')]},'col':{'type':Sequelize[_0xf33a('0x9')]},'background':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![],'defaultValue':_0xf33a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf33a('0x2')]},'titleFontSize':{'type':Sequelize[_0xf33a('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index e2d44d1..006c939 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 _0xa5aa=['attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','merge','catch','find','type','iframe','attrUrl','attrs','https://','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel'];(function(_0x5e6506,_0x1ab5bb){var _0x43e803=function(_0x3471e3){while(--_0x3471e3){_0x5e6506['push'](_0x5e6506['shift']());}};_0x43e803(++_0x1ab5bb);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0x535980,_0x138a0a){_0x535980=_0x535980-0x0;var _0x49349d=_0xa5aa[_0x535980];return _0x49349d;};'use strict';var emlformat=require(_0xaa5a('0x0'));var rimraf=require(_0xaa5a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa5a('0x2'));var rp=require(_0xaa5a('0x3'));var moment=require(_0xaa5a('0x4'));var BPromise=require(_0xaa5a('0x5'));var Mustache=require(_0xaa5a('0x6'));var util=require(_0xaa5a('0x7'));var path=require('path');var sox=require(_0xaa5a('0x8'));var csv=require(_0xaa5a('0x9'));var ejs=require(_0xaa5a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaa5a('0xb'));var crypto=require(_0xaa5a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaa5a('0xd'));var toCsv=require(_0xaa5a('0x9'));var querystring=require(_0xaa5a('0xe'));var Papa=require('papaparse');var Redis=require(_0xaa5a('0xf'));var authService=require(_0xaa5a('0x10'));var qs=require(_0xaa5a('0x11'));var as=require(_0xaa5a('0x12'));var hardwareService=require(_0xaa5a('0x13'));var logger=require(_0xaa5a('0x14'))('api');var utils=require(_0xaa5a('0x15'));var config=require(_0xaa5a('0x16'));var licenseUtil=require(_0xaa5a('0x17'));var db=require(_0xaa5a('0x18'))['db'];config[_0xaa5a('0x19')]=_[_0xaa5a('0x1a')](config[_0xaa5a('0x19')],{'host':_0xaa5a('0x1b'),'port':0x18eb});var socket=require(_0xaa5a('0x1c'))(new Redis(config[_0xaa5a('0x19')]));require(_0xaa5a('0x1d'))[_0xaa5a('0x1e')](socket);function respondWithStatusCode(_0x5eaa9c,_0x2d931c){_0x2d931c=_0x2d931c||0xcc;return function(_0x40b34f){if(_0x40b34f){return _0x5eaa9c[_0xaa5a('0x1f')](_0x2d931c);}return _0x5eaa9c['status'](_0x2d931c)[_0xaa5a('0x20')]();};}function respondWithResult(_0x10ba31,_0x286f17){_0x286f17=_0x286f17||0xc8;return function(_0x2b6fd0){if(_0x2b6fd0){return _0x10ba31[_0xaa5a('0x21')](_0x286f17)[_0xaa5a('0x22')](_0x2b6fd0);}};}function respondWithFilteredResult(_0x1b3eba,_0x1c7320){return function(_0xef5dd3){if(_0xef5dd3){var _0x3a8ccf=typeof _0x1c7320[_0xaa5a('0x23')]===_0xaa5a('0x24')&&typeof _0x1c7320[_0xaa5a('0x25')]===_0xaa5a('0x24');var _0x44279b=_0xef5dd3[_0xaa5a('0x26')];var _0x222e5e=_0x3a8ccf?0x0:_0x1c7320['offset'];var _0x20ec46=_0x3a8ccf?_0xef5dd3[_0xaa5a('0x26')]:_0x1c7320[_0xaa5a('0x23')]+_0x1c7320[_0xaa5a('0x25')];var _0x5af50f;if(_0x20ec46>=_0x44279b){_0x20ec46=_0x44279b;_0x5af50f=0xc8;}else{_0x5af50f=0xce;}_0x1b3eba[_0xaa5a('0x21')](_0x5af50f);return _0x1b3eba[_0xaa5a('0x27')](_0xaa5a('0x28'),_0x222e5e+'-'+_0x20ec46+'/'+_0x44279b)[_0xaa5a('0x22')](_0xef5dd3);}return null;};}function patchUpdates(_0xf50dd0){return function(_0x3b6083){try{jsonpatch[_0xaa5a('0x29')](_0x3b6083,_0xf50dd0,!![]);}catch(_0x1d3fbc){return BPromise[_0xaa5a('0x2a')](_0x1d3fbc);}return _0x3b6083['save']();};}function saveUpdates(_0x1e4e12,_0x4c9035){return function(_0x416351){if(_0x416351){return _0x416351[_0xaa5a('0x2b')](_0x1e4e12)[_0xaa5a('0x2c')](function(_0x3e6ac1){return _0x3e6ac1;});}return null;};}function removeEntity(_0x1d0c9b,_0x47cdcf){return function(_0x36a491){if(_0x36a491){return _0x36a491[_0xaa5a('0x2d')]()['then'](function(){_0x1d0c9b[_0xaa5a('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36582e,_0xc915c1){return function(_0x24c8e5){if(!_0x24c8e5){_0x36582e[_0xaa5a('0x1f')](0x194);}return _0x24c8e5;};}function handleError(_0x4117a6,_0x10208d){_0x10208d=_0x10208d||0x1f4;return function(_0x57cd56){logger[_0xaa5a('0x2e')](_0x57cd56[_0xaa5a('0x2f')]);if(_0x57cd56['name']){delete _0x57cd56[_0xaa5a('0x30')];}_0x4117a6[_0xaa5a('0x21')](_0x10208d)['send'](_0x57cd56);};}exports[_0xaa5a('0x31')]=function(_0x453a46,_0x186413){var _0x115f03={'raw':![],'where':{'id':_0x453a46[_0xaa5a('0x32')]['id']}},_0x24ff37={};_0x24ff37['model']=_[_0xaa5a('0x33')](db[_0xaa5a('0x34')][_0xaa5a('0x35')]);_0x24ff37[_0xaa5a('0x36')]=_['keys'](_0x453a46['query']);_0x24ff37[_0xaa5a('0x37')]=_[_0xaa5a('0x38')](_0x24ff37['model'],_0x24ff37[_0xaa5a('0x36')]);_0x115f03['attributes']=_['intersection'](_0x24ff37[_0xaa5a('0x39')],qs[_0xaa5a('0x3a')](_0x453a46[_0xaa5a('0x36')][_0xaa5a('0x3a')]));_0x115f03[_0xaa5a('0x3b')]=_0x115f03[_0xaa5a('0x3b')][_0xaa5a('0x3c')]?_0x115f03['attributes']:_0x24ff37[_0xaa5a('0x39')];if(_0x453a46[_0xaa5a('0x36')][_0xaa5a('0x3d')]){_0x115f03['include']=[{'all':!![]}];}_0x115f03=_[_0xaa5a('0x3e')]({},_0x115f03,_0x453a46['options']);return db[_0xaa5a('0x34')]['find'](_0x115f03)['then'](handleEntityNotFound(_0x186413,null))[_0xaa5a('0x2c')](respondWithResult(_0x186413,null))[_0xaa5a('0x3f')](handleError(_0x186413,null));};exports[_0xaa5a('0x2d')]=function(_0x21e0b1,_0x401fb8){return db[_0xaa5a('0x34')][_0xaa5a('0x40')]({'where':{'id':_0x21e0b1[_0xaa5a('0x32')]['id']}})['then'](handleEntityNotFound(_0x401fb8,null))['then'](removeEntity(_0x401fb8,null))['catch'](handleError(_0x401fb8,null));};function widgetAttributes(_0xbb00cc){try{switch(_0xbb00cc[_0xaa5a('0x41')]){case _0xaa5a('0x42'):return[{'name':_0xaa5a('0x43'),'value':_0xbb00cc[_0xaa5a('0x43')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc['attrs'][0x0]?_0xbb00cc['attrs'][0x0]['value']:undefined)||_0xaa5a('0x45')}];case'custom':return[{'name':'attrPath','value':_0xbb00cc['attrPath']||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x0]?_0xbb00cc[_0xaa5a('0x44')][0x0]['value']:undefined)||''}];case _0xaa5a('0x46'):return[{'name':_0xaa5a('0x47'),'value':_0xbb00cc[_0xaa5a('0x47')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x0]?_0xbb00cc['attrs'][0x0][_0xaa5a('0x48')]:undefined)||_0xaa5a('0x49')},{'name':_0xaa5a('0x4a'),'value':_0xbb00cc[_0xaa5a('0x4a')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x1]?_0xbb00cc[_0xaa5a('0x44')][0x1][_0xaa5a('0x48')]:undefined)||_0xaa5a('0x4b')},{'name':'attrFontSize','value':_0xbb00cc['attrFontSize']||(_0xbb00cc['attrs']&&_0xbb00cc['attrs'][0x2]?_0xbb00cc[_0xaa5a('0x44')][0x2][_0xaa5a('0x48')]:undefined)||0xc}];case _0xaa5a('0x4c'):return[{'name':_0xaa5a('0x4d'),'value':_0xbb00cc[_0xaa5a('0x4d')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x0]?_0xbb00cc[_0xaa5a('0x44')][0x0][_0xaa5a('0x48')]:undefined)||_0xaa5a('0x4e')},{'name':'attrVoiceQueues','value':_0xbb00cc[_0xaa5a('0x4f')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x1]?_0xbb00cc[_0xaa5a('0x44')][0x1][_0xaa5a('0x48')]:undefined)||[]},{'name':_0xaa5a('0x50'),'value':_0xbb00cc[_0xaa5a('0x50')]||(_0xbb00cc['attrs']&&_0xbb00cc[_0xaa5a('0x44')][0x2]?_0xbb00cc[_0xaa5a('0x44')][0x2][_0xaa5a('0x48')]:undefined)||0x14},{'name':_0xaa5a('0x51'),'value':_0xbb00cc[_0xaa5a('0x51')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x3]?_0xbb00cc[_0xaa5a('0x44')][0x3][_0xaa5a('0x48')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0xbb00cc[_0xaa5a('0x52')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x4]?_0xbb00cc[_0xaa5a('0x44')][0x4][_0xaa5a('0x48')]:undefined)||''},{'name':_0xaa5a('0x53'),'value':_0xbb00cc[_0xaa5a('0x53')]||(_0xbb00cc['attrs']&&_0xbb00cc[_0xaa5a('0x44')][0x5]?_0xbb00cc[_0xaa5a('0x44')][0x5][_0xaa5a('0x48')]:undefined)||''},{'name':_0xaa5a('0x54'),'value':_0xbb00cc[_0xaa5a('0x54')]||(_0xbb00cc['attrs']&&_0xbb00cc['attrs'][0x6]?_0xbb00cc['attrs'][0x6]['value']:undefined)||''},{'name':_0xaa5a('0x55'),'value':_0xbb00cc[_0xaa5a('0x55')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x7]?_0xbb00cc[_0xaa5a('0x44')][0x7][_0xaa5a('0x48')]:undefined)||''},{'name':_0xaa5a('0x56'),'value':_0xbb00cc[_0xaa5a('0x56')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x8]?_0xbb00cc[_0xaa5a('0x44')][0x8][_0xaa5a('0x48')]:undefined)||''},{'name':_0xaa5a('0x57'),'value':_0xbb00cc[_0xaa5a('0x57')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc['attrs'][0x9]?_0xbb00cc['attrs'][0x9]['value']:undefined)||''}];case _0xaa5a('0x58'):case _0xaa5a('0x59'):return[{'name':_0xaa5a('0x5a'),'value':_0xbb00cc[_0xaa5a('0x5a')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x0]?_0xbb00cc[_0xaa5a('0x44')][0x0][_0xaa5a('0x48')]:undefined)||_0xaa5a('0x4e')},{'name':_0xaa5a('0x5b'),'value':_0xbb00cc[_0xaa5a('0x5b')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x1]?_0xbb00cc[_0xaa5a('0x44')][0x1][_0xaa5a('0x48')]:undefined)||null},{'name':'attrSerie3','value':_0xbb00cc[_0xaa5a('0x5c')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x2]?_0xbb00cc[_0xaa5a('0x44')][0x2][_0xaa5a('0x48')]:undefined)||null},{'name':_0xaa5a('0x4f'),'value':_0xbb00cc[_0xaa5a('0x4f')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x3]?_0xbb00cc[_0xaa5a('0x44')][0x3][_0xaa5a('0x48')]:undefined)||[]},{'name':_0xaa5a('0x51'),'value':_0xbb00cc[_0xaa5a('0x51')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x4]?_0xbb00cc[_0xaa5a('0x44')][0x4][_0xaa5a('0x48')]:undefined)||_0xaa5a('0x5d')},{'name':'attrEmailAccounts','value':_0xbb00cc[_0xaa5a('0x52')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x5]?_0xbb00cc['attrs'][0x5][_0xaa5a('0x48')]:undefined)||''},{'name':_0xaa5a('0x53'),'value':_0xbb00cc[_0xaa5a('0x53')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x6]?_0xbb00cc[_0xaa5a('0x44')][0x6][_0xaa5a('0x48')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xbb00cc[_0xaa5a('0x54')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x7]?_0xbb00cc[_0xaa5a('0x44')][0x7][_0xaa5a('0x48')]:undefined)||''},{'name':_0xaa5a('0x55'),'value':_0xbb00cc['attrOpenchannelAccounts']||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc['attrs'][0x8]?_0xbb00cc[_0xaa5a('0x44')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xbb00cc[_0xaa5a('0x56')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x9]?_0xbb00cc[_0xaa5a('0x44')][0x9][_0xaa5a('0x48')]:undefined)||''},{'name':_0xaa5a('0x57'),'value':_0xbb00cc[_0xaa5a('0x57')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0xa]?_0xbb00cc[_0xaa5a('0x44')][0xa]['value']:undefined)||''}];case _0xaa5a('0x5e'):return[{'name':_0xaa5a('0x5f'),'type':_0xbb00cc[_0xaa5a('0x60')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x0]?_0xbb00cc[_0xaa5a('0x44')][0x0]['type']:undefined)||null,'value':_0xbb00cc[_0xaa5a('0x5f')]||(_0xbb00cc[_0xaa5a('0x44')]&&_0xbb00cc[_0xaa5a('0x44')][0x0]?_0xbb00cc[_0xaa5a('0x44')][0x0]['value']:undefined)||null},{'name':_0xaa5a('0x61'),'value':_0xbb00cc[_0xaa5a('0x61')]||(_0xbb00cc['attrs']&&_0xbb00cc[_0xaa5a('0x44')][0x1]?_0xbb00cc['attrs'][0x1][_0xaa5a('0x48')]:undefined)||0x0}];default:return[];}}catch(_0x2fac84){logger[_0xaa5a('0x2e')](_0xaa5a('0x62'),JSON[_0xaa5a('0x63')](_0x2fac84));return[];}}exports[_0xaa5a('0x64')]=function(_0x2a2924,_0x4a001e){if(_0x2a2924[_0xaa5a('0x65')]){_0x2a2924[_0xaa5a('0x65')][_0xaa5a('0x44')]=widgetAttributes(_0x2a2924['body']);}return db[_0xaa5a('0x34')][_0xaa5a('0x64')](_0x2a2924[_0xaa5a('0x65')],{})[_0xaa5a('0x2c')](respondWithResult(_0x4a001e,0xc9))[_0xaa5a('0x3f')](handleError(_0x4a001e,null));};exports[_0xaa5a('0x2b')]=function(_0x73c40a,_0x2f5e1e){if(_0x73c40a['body']['id']){delete _0x73c40a['body']['id'];}_0x73c40a[_0xaa5a('0x65')]['attrs']=widgetAttributes(_0x73c40a['body']);return db[_0xaa5a('0x34')][_0xaa5a('0x40')]({'where':{'id':_0x73c40a[_0xaa5a('0x32')]['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x2f5e1e,null))[_0xaa5a('0x2c')](saveUpdates(_0x73c40a[_0xaa5a('0x65')],null))[_0xaa5a('0x2c')](respondWithResult(_0x2f5e1e,null))[_0xaa5a('0x3f')](handleError(_0x2f5e1e,null));}; \ No newline at end of file +var _0x0760=['apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','params','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','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','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x4f1ece,_0x4a81b1){var _0x27fab3=function(_0x4f938a){while(--_0x4f938a){_0x4f1ece['push'](_0x4f1ece['shift']());}};_0x27fab3(++_0x4a81b1);}(_0x0760,0xa9));var _0x0076=function(_0x3e2462,_0x4a53e2){_0x3e2462=_0x3e2462-0x0;var _0x15f043=_0x0760[_0x3e2462];return _0x15f043;};'use strict';var emlformat=require(_0x0076('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0076('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0076('0x2'));var Mustache=require(_0x0076('0x3'));var util=require(_0x0076('0x4'));var path=require(_0x0076('0x5'));var sox=require(_0x0076('0x6'));var csv=require('to-csv');var ejs=require(_0x0076('0x7'));var fs=require('fs');var fs_extra=require(_0x0076('0x8'));var _=require(_0x0076('0x9'));var squel=require(_0x0076('0xa'));var crypto=require(_0x0076('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0076('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0076('0xd'));var Papa=require(_0x0076('0xe'));var Redis=require('ioredis');var authService=require(_0x0076('0xf'));var qs=require(_0x0076('0x10'));var as=require(_0x0076('0x11'));var hardwareService=require(_0x0076('0x12'));var logger=require(_0x0076('0x13'))(_0x0076('0x14'));var utils=require('../../config/utils');var config=require(_0x0076('0x15'));var licenseUtil=require(_0x0076('0x16'));var db=require(_0x0076('0x17'))['db'];config[_0x0076('0x18')]=_[_0x0076('0x19')](config[_0x0076('0x18')],{'host':_0x0076('0x1a'),'port':0x18eb});var socket=require(_0x0076('0x1b'))(new Redis(config[_0x0076('0x18')]));require(_0x0076('0x1c'))[_0x0076('0x1d')](socket);function respondWithStatusCode(_0x5175c7,_0x34faa2){_0x34faa2=_0x34faa2||0xcc;return function(_0x50a737){if(_0x50a737){return _0x5175c7['sendStatus'](_0x34faa2);}return _0x5175c7[_0x0076('0x1e')](_0x34faa2)[_0x0076('0x1f')]();};}function respondWithResult(_0x4ce381,_0x46641d){_0x46641d=_0x46641d||0xc8;return function(_0x58c9f9){if(_0x58c9f9){return _0x4ce381[_0x0076('0x1e')](_0x46641d)[_0x0076('0x20')](_0x58c9f9);}};}function respondWithFilteredResult(_0x5a5623,_0x540edf){return function(_0x5761a4){if(_0x5761a4){var _0xc0a663=typeof _0x540edf[_0x0076('0x21')]===_0x0076('0x22')&&typeof _0x540edf[_0x0076('0x23')]===_0x0076('0x22');var _0x371498=_0x5761a4[_0x0076('0x24')];var _0x1394ab=_0xc0a663?0x0:_0x540edf[_0x0076('0x21')];var _0x252d78=_0xc0a663?_0x5761a4[_0x0076('0x24')]:_0x540edf[_0x0076('0x21')]+_0x540edf[_0x0076('0x23')];var _0x26b89c;if(_0x252d78>=_0x371498){_0x252d78=_0x371498;_0x26b89c=0xc8;}else{_0x26b89c=0xce;}_0x5a5623['status'](_0x26b89c);return _0x5a5623[_0x0076('0x25')](_0x0076('0x26'),_0x1394ab+'-'+_0x252d78+'/'+_0x371498)[_0x0076('0x20')](_0x5761a4);}return null;};}function patchUpdates(_0x58ee11){return function(_0x4369b0){try{jsonpatch[_0x0076('0x27')](_0x4369b0,_0x58ee11,!![]);}catch(_0x2dd436){return BPromise[_0x0076('0x28')](_0x2dd436);}return _0x4369b0[_0x0076('0x29')]();};}function saveUpdates(_0x5b73ac,_0x20df42){return function(_0x25f0af){if(_0x25f0af){return _0x25f0af[_0x0076('0x2a')](_0x5b73ac)[_0x0076('0x2b')](function(_0x2c7def){return _0x2c7def;});}return null;};}function removeEntity(_0x336661,_0x59f20c){return function(_0x1fbe92){if(_0x1fbe92){return _0x1fbe92[_0x0076('0x2c')]()[_0x0076('0x2b')](function(){_0x336661[_0x0076('0x1e')](0xcc)[_0x0076('0x1f')]();});}};}function handleEntityNotFound(_0x5203a6,_0xd481f4){return function(_0x712db9){if(!_0x712db9){_0x5203a6[_0x0076('0x2d')](0x194);}return _0x712db9;};}function handleError(_0x1e30b6,_0x12c8c4){_0x12c8c4=_0x12c8c4||0x1f4;return function(_0xd4009d){logger[_0x0076('0x2e')](_0xd4009d[_0x0076('0x2f')]);if(_0xd4009d[_0x0076('0x30')]){delete _0xd4009d[_0x0076('0x30')];}_0x1e30b6['status'](_0x12c8c4)[_0x0076('0x31')](_0xd4009d);};}exports[_0x0076('0x32')]=function(_0x3366a8,_0x1cfad4){var _0x365049={'raw':![],'where':{'id':_0x3366a8['params']['id']}},_0x501b23={};_0x501b23[_0x0076('0x33')]=_[_0x0076('0x34')](db[_0x0076('0x35')][_0x0076('0x36')]);_0x501b23['query']=_['keys'](_0x3366a8[_0x0076('0x37')]);_0x501b23[_0x0076('0x38')]=_[_0x0076('0x39')](_0x501b23['model'],_0x501b23[_0x0076('0x37')]);_0x365049[_0x0076('0x3a')]=_[_0x0076('0x39')](_0x501b23[_0x0076('0x33')],qs[_0x0076('0x3b')](_0x3366a8[_0x0076('0x37')][_0x0076('0x3b')]));_0x365049[_0x0076('0x3a')]=_0x365049[_0x0076('0x3a')][_0x0076('0x3c')]?_0x365049[_0x0076('0x3a')]:_0x501b23['model'];if(_0x3366a8[_0x0076('0x37')][_0x0076('0x3d')]){_0x365049[_0x0076('0x3e')]=[{'all':!![]}];}_0x365049=_[_0x0076('0x3f')]({},_0x365049,_0x3366a8[_0x0076('0x40')]);return db[_0x0076('0x35')][_0x0076('0x41')](_0x365049)['then'](handleEntityNotFound(_0x1cfad4,null))[_0x0076('0x2b')](respondWithResult(_0x1cfad4,null))[_0x0076('0x42')](handleError(_0x1cfad4,null));};exports[_0x0076('0x2c')]=function(_0x2c8958,_0x4a4cff){return db[_0x0076('0x35')]['find']({'where':{'id':_0x2c8958[_0x0076('0x43')]['id']}})[_0x0076('0x2b')](handleEntityNotFound(_0x4a4cff,null))[_0x0076('0x2b')](removeEntity(_0x4a4cff,null))[_0x0076('0x42')](handleError(_0x4a4cff,null));};function widgetAttributes(_0x3ac727){try{switch(_0x3ac727[_0x0076('0x44')]){case _0x0076('0x45'):return[{'name':_0x0076('0x46'),'value':_0x3ac727[_0x0076('0x46')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x0]?_0x3ac727[_0x0076('0x47')][0x0][_0x0076('0x48')]:undefined)||'https://'}];case _0x0076('0x49'):return[{'name':_0x0076('0x4a'),'value':_0x3ac727[_0x0076('0x4a')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x0]?_0x3ac727[_0x0076('0x47')][0x0]['value']:undefined)||''}];case _0x0076('0x4b'):return[{'name':'attrHourFormat','value':_0x3ac727[_0x0076('0x4c')]||(_0x3ac727['attrs']&&_0x3ac727[_0x0076('0x47')][0x0]?_0x3ac727[_0x0076('0x47')][0x0][_0x0076('0x48')]:undefined)||'HH:mm:ss'},{'name':_0x0076('0x4d'),'value':_0x3ac727[_0x0076('0x4d')]||(_0x3ac727['attrs']&&_0x3ac727[_0x0076('0x47')][0x1]?_0x3ac727[_0x0076('0x47')][0x1][_0x0076('0x48')]:undefined)||_0x0076('0x4e')},{'name':_0x0076('0x4f'),'value':_0x3ac727[_0x0076('0x4f')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x2]?_0x3ac727[_0x0076('0x47')][0x2][_0x0076('0x48')]:undefined)||0xc}];case _0x0076('0x50'):return[{'name':_0x0076('0x51'),'value':_0x3ac727[_0x0076('0x51')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x0]?_0x3ac727['attrs'][0x0][_0x0076('0x48')]:undefined)||_0x0076('0x52')},{'name':_0x0076('0x53'),'value':_0x3ac727[_0x0076('0x53')]||(_0x3ac727['attrs']&&_0x3ac727[_0x0076('0x47')][0x1]?_0x3ac727[_0x0076('0x47')][0x1][_0x0076('0x48')]:undefined)||[]},{'name':_0x0076('0x4f'),'value':_0x3ac727['attrFontSize']||(_0x3ac727['attrs']&&_0x3ac727[_0x0076('0x47')][0x2]?_0x3ac727[_0x0076('0x47')][0x2]['value']:undefined)||0x14},{'name':_0x0076('0x54'),'value':_0x3ac727[_0x0076('0x54')]||(_0x3ac727['attrs']&&_0x3ac727[_0x0076('0x47')][0x3]?_0x3ac727['attrs'][0x3][_0x0076('0x48')]:undefined)||_0x0076('0x55')},{'name':_0x0076('0x56'),'value':_0x3ac727[_0x0076('0x56')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727['attrs'][0x4]?_0x3ac727[_0x0076('0x47')][0x4][_0x0076('0x48')]:undefined)||''},{'name':_0x0076('0x57'),'value':_0x3ac727[_0x0076('0x57')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x5]?_0x3ac727['attrs'][0x5][_0x0076('0x48')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3ac727[_0x0076('0x58')]||(_0x3ac727['attrs']&&_0x3ac727[_0x0076('0x47')][0x6]?_0x3ac727[_0x0076('0x47')][0x6][_0x0076('0x48')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3ac727[_0x0076('0x59')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x7]?_0x3ac727['attrs'][0x7][_0x0076('0x48')]:undefined)||''},{'name':_0x0076('0x5a'),'value':_0x3ac727['attrWhatsappAccounts']||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x8]?_0x3ac727[_0x0076('0x47')][0x8][_0x0076('0x48')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3ac727[_0x0076('0x5b')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x9]?_0x3ac727[_0x0076('0x47')][0x9][_0x0076('0x48')]:undefined)||''}];case _0x0076('0x5c'):case'pie-chart':return[{'name':_0x0076('0x5d'),'value':_0x3ac727[_0x0076('0x5d')]||(_0x3ac727['attrs']&&_0x3ac727[_0x0076('0x47')][0x0]?_0x3ac727[_0x0076('0x47')][0x0][_0x0076('0x48')]:undefined)||_0x0076('0x52')},{'name':'attrSerie2','value':_0x3ac727[_0x0076('0x5e')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x1]?_0x3ac727[_0x0076('0x47')][0x1][_0x0076('0x48')]:undefined)||null},{'name':_0x0076('0x5f'),'value':_0x3ac727[_0x0076('0x5f')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x2]?_0x3ac727['attrs'][0x2][_0x0076('0x48')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3ac727[_0x0076('0x53')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x3]?_0x3ac727[_0x0076('0x47')][0x3][_0x0076('0x48')]:undefined)||[]},{'name':_0x0076('0x54'),'value':_0x3ac727[_0x0076('0x54')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x4]?_0x3ac727[_0x0076('0x47')][0x4][_0x0076('0x48')]:undefined)||'voice'},{'name':_0x0076('0x56'),'value':_0x3ac727['attrEmailAccounts']||(_0x3ac727['attrs']&&_0x3ac727[_0x0076('0x47')][0x5]?_0x3ac727['attrs'][0x5][_0x0076('0x48')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3ac727['attrFaxAccounts']||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x6]?_0x3ac727[_0x0076('0x47')][0x6][_0x0076('0x48')]:undefined)||''},{'name':_0x0076('0x58'),'value':_0x3ac727[_0x0076('0x58')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727['attrs'][0x7]?_0x3ac727[_0x0076('0x47')][0x7][_0x0076('0x48')]:undefined)||''},{'name':_0x0076('0x59'),'value':_0x3ac727['attrOpenchannelAccounts']||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x8]?_0x3ac727['attrs'][0x8][_0x0076('0x48')]:undefined)||''},{'name':_0x0076('0x5a'),'value':_0x3ac727[_0x0076('0x5a')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x9]?_0x3ac727['attrs'][0x9][_0x0076('0x48')]:undefined)||''},{'name':_0x0076('0x5b'),'value':_0x3ac727[_0x0076('0x5b')]||(_0x3ac727['attrs']&&_0x3ac727['attrs'][0xa]?_0x3ac727[_0x0076('0x47')][0xa][_0x0076('0x48')]:undefined)||''}];case _0x0076('0x60'):return[{'name':_0x0076('0x61'),'type':_0x3ac727[_0x0076('0x62')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x0]?_0x3ac727[_0x0076('0x47')][0x0][_0x0076('0x44')]:undefined)||null,'value':_0x3ac727[_0x0076('0x61')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x0]?_0x3ac727[_0x0076('0x47')][0x0][_0x0076('0x48')]:undefined)||null},{'name':_0x0076('0x63'),'value':_0x3ac727[_0x0076('0x63')]||(_0x3ac727[_0x0076('0x47')]&&_0x3ac727[_0x0076('0x47')][0x1]?_0x3ac727[_0x0076('0x47')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x444616){logger[_0x0076('0x2e')](_0x0076('0x64'),JSON[_0x0076('0x65')](_0x444616));return[];}}exports[_0x0076('0x66')]=function(_0x2a9eff,_0xdfc74d){if(_0x2a9eff[_0x0076('0x67')]){_0x2a9eff[_0x0076('0x67')][_0x0076('0x47')]=widgetAttributes(_0x2a9eff[_0x0076('0x67')]);}return db[_0x0076('0x35')][_0x0076('0x66')](_0x2a9eff[_0x0076('0x67')],{})['then'](respondWithResult(_0xdfc74d,0xc9))[_0x0076('0x42')](handleError(_0xdfc74d,null));};exports['update']=function(_0x3e170d,_0x3bac5e){if(_0x3e170d[_0x0076('0x67')]['id']){delete _0x3e170d[_0x0076('0x67')]['id'];}_0x3e170d[_0x0076('0x67')][_0x0076('0x47')]=widgetAttributes(_0x3e170d['body']);return db[_0x0076('0x35')]['find']({'where':{'id':_0x3e170d[_0x0076('0x43')]['id']}})[_0x0076('0x2b')](handleEntityNotFound(_0x3bac5e,null))[_0x0076('0x2b')](saveUpdates(_0x3e170d[_0x0076('0x67')],null))[_0x0076('0x2b')](respondWithResult(_0x3bac5e,null))['catch'](handleError(_0x3bac5e,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a34c57e..4933797 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 _0x3762=['emit','hook','exports','events','../../mysqldb','save','update'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x3762,0x7a));var _0x2376=function(_0x524caa,_0x579544){_0x524caa=_0x524caa-0x0;var _0x1c91df=_0x3762[_0x524caa];return _0x1c91df;};'use strict';var EventEmitter=require(_0x2376('0x0'));var DashboardItem=require(_0x2376('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2376('0x2'),'afterUpdate':_0x2376('0x3'),'afterDestroy':'remove'};function emitEvent(_0x35e672){return function(_0x35358b,_0xa2f7c,_0x4ed940){DashboardItemEvents[_0x2376('0x4')](_0x35e672+':'+_0x35358b['id'],_0x35358b);DashboardItemEvents[_0x2376('0x4')](_0x35e672,_0x35358b);_0x4ed940(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x2376('0x5')](e,emitEvent(event));}}module[_0x2376('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xa091=['save','update','remove','emit','hook','exports','events','../../mysqldb','DashboardItem'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa091,0xf0));var _0x1a09=function(_0x1b6175,_0x478542){_0x1b6175=_0x1b6175-0x0;var _0x77498=_0xa091[_0x1b6175];return _0x77498;};'use strict';var EventEmitter=require(_0x1a09('0x0'));var DashboardItem=require(_0x1a09('0x1'))['db'][_0x1a09('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1a09('0x3'),'afterUpdate':_0x1a09('0x4'),'afterDestroy':_0x1a09('0x5')};function emitEvent(_0x331cdf){return function(_0x2a5c77,_0x29a799,_0x18df2e){DashboardItemEvents[_0x1a09('0x6')](_0x331cdf+':'+_0x2a5c77['id'],_0x2a5c77);DashboardItemEvents[_0x1a09('0x6')](_0x331cdf,_0x2a5c77);_0x18df2e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x1a09('0x7')](e,emitEvent(event));}}module[_0x1a09('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 376ddb6..12deb78 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 _0x3fc6=['rimraf','../../config/environment','define','dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x23c791,_0xa8bee3){var _0x57b777=function(_0x25f8c4){while(--_0x25f8c4){_0x23c791['push'](_0x23c791['shift']());}};_0x57b777(++_0xa8bee3);}(_0x3fc6,0x159));var _0x63fc=function(_0x3b4056,_0x522895){_0x3b4056=_0x3b4056-0x0;var _0x456850=_0x3fc6[_0x3b4056];return _0x456850;};'use strict';var _=require(_0x63fc('0x0'));var util=require(_0x63fc('0x1'));var logger=require(_0x63fc('0x2'))('api');var moment=require(_0x63fc('0x3'));var BPromise=require(_0x63fc('0x4'));var rp=require(_0x63fc('0x5'));var fs=require('fs');var path=require(_0x63fc('0x6'));var rimraf=require(_0x63fc('0x7'));var config=require(_0x63fc('0x8'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0xdb65b8,_0x7d24f){return _0xdb65b8[_0x63fc('0x9')]('DashboardItem',attributes,{'tableName':_0x63fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x351d=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash'];(function(_0xd51abc,_0x2590ff){var _0x46cdd1=function(_0x500270){while(--_0x500270){_0xd51abc['push'](_0xd51abc['shift']());}};_0x46cdd1(++_0x2590ff);}(_0x351d,0x137));var _0xd351=function(_0x4d7441,_0x3cc720){_0x4d7441=_0x4d7441-0x0;var _0x434aae=_0x351d[_0x4d7441];return _0x434aae;};'use strict';var _=require(_0xd351('0x0'));var util=require(_0xd351('0x1'));var logger=require(_0xd351('0x2'))(_0xd351('0x3'));var moment=require(_0xd351('0x4'));var BPromise=require(_0xd351('0x5'));var rp=require(_0xd351('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x7'));var config=require('../../config/environment');var attributes=require(_0xd351('0x8'));module['exports']=function(_0x3c9939,_0x5657e4){return _0x3c9939[_0xd351('0x9')](_0xd351('0xa'),attributes,{'tableName':_0xd351('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 2efb6aa..615afc8 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 _0x4ef2=['message','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4727f1,_0x2ff773){var _0x2977ce=function(_0x29be89){while(--_0x29be89){_0x4727f1['push'](_0x4727f1['shift']());}};_0x2977ce(++_0x2ff773);}(_0x4ef2,0x17b));var _0x24ef=function(_0x320a2b,_0x519e2a){_0x320a2b=_0x320a2b-0x0;var _0x128ae3=_0x4ef2[_0x320a2b];return _0x128ae3;};'use strict';var _=require('lodash');var util=require(_0x24ef('0x0'));var moment=require(_0x24ef('0x1'));var BPromise=require(_0x24ef('0x2'));var rs=require(_0x24ef('0x3'));var fs=require('fs');var Redis=require(_0x24ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x24ef('0x5'))(_0x24ef('0x6'));var config=require(_0x24ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x24ef('0x8')][_0x24ef('0x9')]({'port':0x232a});config[_0x24ef('0xa')]=_['defaults'](config[_0x24ef('0xa')],{'host':_0x24ef('0xb'),'port':0x18eb});var socket=require(_0x24ef('0xc'))(new Redis(config['redis']));require(_0x24ef('0xd'))[_0x24ef('0xe')](socket);function respondWithRpcPromise(_0x1d517c,_0x36171a,_0x4b685d){return new BPromise(function(_0x3f0b26,_0xcc334c){return client[_0x24ef('0xf')](_0x1d517c,_0x4b685d)[_0x24ef('0x10')](function(_0x402f03){logger['info'](_0x24ef('0x11'),_0x36171a,_0x24ef('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x36171a,_0x24ef('0x12'),JSON['stringify'](_0x402f03));if(_0x402f03[_0x24ef('0x13')]){if(_0x402f03[_0x24ef('0x13')]['code']===0x1f4){logger[_0x24ef('0x13')](_0x24ef('0x11'),_0x36171a,_0x402f03[_0x24ef('0x13')]['message']);return _0xcc334c(_0x402f03[_0x24ef('0x13')][_0x24ef('0x14')]);}logger[_0x24ef('0x13')]('DashboardItem,\x20%s,\x20%s',_0x36171a,_0x402f03['error'][_0x24ef('0x14')]);return _0x3f0b26(_0x402f03[_0x24ef('0x13')]['message']);}else{logger['info'](_0x24ef('0x11'),_0x36171a,_0x24ef('0x12'));_0x3f0b26(_0x402f03['result']['message']);}})['catch'](function(_0x1430a2){logger[_0x24ef('0x13')]('DashboardItem,\x20%s,\x20%s',_0x36171a,_0x1430a2);_0xcc334c(_0x1430a2);});});} \ No newline at end of file +var _0xee12=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash'];(function(_0x5b096e,_0x25bdef){var _0x507b57=function(_0x2aa70e){while(--_0x2aa70e){_0x5b096e['push'](_0x5b096e['shift']());}};_0x507b57(++_0x25bdef);}(_0xee12,0x1ca));var _0x2ee1=function(_0x23be16,_0xd0f996){_0x23be16=_0x23be16-0x0;var _0x3f8d3a=_0xee12[_0x23be16];return _0x3f8d3a;};'use strict';var _=require(_0x2ee1('0x0'));var util=require(_0x2ee1('0x1'));var moment=require(_0x2ee1('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ee1('0x3'));var fs=require('fs');var Redis=require(_0x2ee1('0x4'));var db=require(_0x2ee1('0x5'))['db'];var utils=require(_0x2ee1('0x6'));var logger=require(_0x2ee1('0x7'))('rpc');var config=require(_0x2ee1('0x8'));var jayson=require(_0x2ee1('0x9'));var client=jayson[_0x2ee1('0xa')][_0x2ee1('0xb')]({'port':0x232a});config[_0x2ee1('0xc')]=_[_0x2ee1('0xd')](config[_0x2ee1('0xc')],{'host':_0x2ee1('0xe'),'port':0x18eb});var socket=require(_0x2ee1('0xf'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x2ee1('0x10')](socket);function respondWithRpcPromise(_0x42e85b,_0xb2d7ab,_0x182070){return new BPromise(function(_0x3ac44b,_0x57ddd9){return client[_0x2ee1('0x11')](_0x42e85b,_0x182070)[_0x2ee1('0x12')](function(_0x3d325d){logger['info'](_0x2ee1('0x13'),_0xb2d7ab,_0x2ee1('0x14'));logger[_0x2ee1('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0xb2d7ab,'request\x20sent',JSON[_0x2ee1('0x16')](_0x3d325d));if(_0x3d325d[_0x2ee1('0x17')]){if(_0x3d325d[_0x2ee1('0x17')]['code']===0x1f4){logger[_0x2ee1('0x17')]('DashboardItem,\x20%s,\x20%s',_0xb2d7ab,_0x3d325d['error'][_0x2ee1('0x18')]);return _0x57ddd9(_0x3d325d[_0x2ee1('0x17')][_0x2ee1('0x18')]);}logger[_0x2ee1('0x17')](_0x2ee1('0x13'),_0xb2d7ab,_0x3d325d[_0x2ee1('0x17')][_0x2ee1('0x18')]);return _0x3ac44b(_0x3d325d['error'][_0x2ee1('0x18')]);}else{logger[_0x2ee1('0x19')](_0x2ee1('0x13'),_0xb2d7ab,_0x2ee1('0x14'));_0x3ac44b(_0x3d325d[_0x2ee1('0x1a')][_0x2ee1('0x18')]);}})['catch'](function(_0x3a2cef){logger[_0x2ee1('0x17')]('DashboardItem,\x20%s,\x20%s',_0xb2d7ab,_0x3a2cef);_0x57ddd9(_0x3a2cef);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c1c11e6..ef446dd 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 _0x36f0=['save','remove','update','removeListener','register','length','./dashboardItem.events'];(function(_0x1680d6,_0x2b495f){var _0x183572=function(_0xea8a0f){while(--_0xea8a0f){_0x1680d6['push'](_0x1680d6['shift']());}};_0x183572(++_0x2b495f);}(_0x36f0,0x195));var _0x036f=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x36f0[_0x22ee1e];return _0x49a5c9;};'use strict';var DashboardItemEvents=require(_0x036f('0x0'));var events=[_0x036f('0x1'),_0x036f('0x2'),_0x036f('0x3')];function createListener(_0x2c1afd,_0x50d586){return function(_0x4371af){_0x50d586['emit'](_0x2c1afd,_0x4371af);};}function removeListener(_0x49e9b0,_0x44baed){return function(){DashboardItemEvents[_0x036f('0x4')](_0x49e9b0,_0x44baed);};}exports[_0x036f('0x5')]=function(_0x1e4cb3){for(var _0x112817=0x0,_0xa05ffc=events[_0x036f('0x6')];_0x112817<_0xa05ffc;_0x112817++){var _0x2358ea=events[_0x112817];var _0x52215f=createListener('dashboardItem:'+_0x2358ea,_0x1e4cb3);DashboardItemEvents['on'](_0x2358ea,_0x52215f);}}; \ No newline at end of file +var _0x8a3d=['save','update','emit','removeListener','register','length','dashboardItem:'];(function(_0x579107,_0x2ac35c){var _0x5d8512=function(_0x7bc371){while(--_0x7bc371){_0x579107['push'](_0x579107['shift']());}};_0x5d8512(++_0x2ac35c);}(_0x8a3d,0x111));var _0xd8a3=function(_0x14103e,_0xdc6bb8){_0x14103e=_0x14103e-0x0;var _0x36e5fb=_0x8a3d[_0x14103e];return _0x36e5fb;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xd8a3('0x0'),'remove',_0xd8a3('0x1')];function createListener(_0x1b0632,_0x3751ba){return function(_0x2b87ef){_0x3751ba[_0xd8a3('0x2')](_0x1b0632,_0x2b87ef);};}function removeListener(_0x3ab503,_0x2399bd){return function(){DashboardItemEvents[_0xd8a3('0x3')](_0x3ab503,_0x2399bd);};}exports[_0xd8a3('0x4')]=function(_0xc9b2fb){for(var _0x22ebbf=0x0,_0xc57d8f=events[_0xd8a3('0x5')];_0x22ebbf<_0xc57d8f;_0x22ebbf++){var _0x225a7c=events[_0x22ebbf];var _0x4be41c=createListener(_0xd8a3('0x6')+_0x225a7c,_0xc9b2fb);DashboardItemEvents['on'](_0x225a7c,_0x4be41c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index eae8556..ae089a5 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 _0x1e7e=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','update','exports','multer'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0x1e7e,0x8e));var _0xe1e7=function(_0x250453,_0x2a0799){_0x250453=_0x250453-0x0;var _0x471c1a=_0x1e7e[_0x250453];return _0x471c1a;};'use strict';var multer=require(_0xe1e7('0x0'));var util=require('util');var path=require(_0xe1e7('0x1'));var timeout=require(_0xe1e7('0x2'));var express=require(_0xe1e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe1e7('0x4'));var config=require(_0xe1e7('0x5'));var controller=require('./dashboardItem.controller');router[_0xe1e7('0x6')](_0xe1e7('0x7'),auth[_0xe1e7('0x8')](),controller['show']);router[_0xe1e7('0x9')]('/',auth[_0xe1e7('0x8')](),controller[_0xe1e7('0xa')]);router['put'](_0xe1e7('0x7'),auth[_0xe1e7('0x8')](),controller[_0xe1e7('0xb')]);router['delete'](_0xe1e7('0x7'),auth[_0xe1e7('0x8')](),controller['destroy']);module[_0xe1e7('0xc')]=router; \ No newline at end of file +var _0xc66f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','util','path'];(function(_0x4c8833,_0x14e755){var _0x30df54=function(_0x197811){while(--_0x197811){_0x4c8833['push'](_0x4c8833['shift']());}};_0x30df54(++_0x14e755);}(_0xc66f,0x1e4));var _0xfc66=function(_0x419eb4,_0x5dc8e9){_0x419eb4=_0x419eb4-0x0;var _0x2416e7=_0xc66f[_0x419eb4];return _0x2416e7;};'use strict';var multer=require('multer');var util=require(_0xfc66('0x0'));var path=require(_0xfc66('0x1'));var timeout=require(_0xfc66('0x2'));var express=require(_0xfc66('0x3'));var router=express[_0xfc66('0x4')]();var fs_extra=require(_0xfc66('0x5'));var auth=require(_0xfc66('0x6'));var interaction=require(_0xfc66('0x7'));var config=require('../../config/environment');var controller=require(_0xfc66('0x8'));router[_0xfc66('0x9')]('/:id',auth[_0xfc66('0xa')](),controller[_0xfc66('0xb')]);router[_0xfc66('0xc')]('/',auth[_0xfc66('0xa')](),controller[_0xfc66('0xd')]);router['put'](_0xfc66('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xfc66('0xf')](_0xfc66('0xe'),auth[_0xfc66('0xa')](),controller[_0xfc66('0x10')]);module[_0xfc66('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 0ac7222..30e5c92 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 _0xcbc9=['ENUM','second','third','first','sequelize','exports'];(function(_0x58aad3,_0x2a1647){var _0x2618d9=function(_0x3b760a){while(--_0x3b760a){_0x58aad3['push'](_0x58aad3['shift']());}};_0x2618d9(++_0x2a1647);}(_0xcbc9,0x196));var _0x9cbc=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xcbc9[_0x5311e8];return _0x582ad8;};'use strict';var Sequelize=require(_0x9cbc('0x0'));module[_0x9cbc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x9cbc('0x2')]('first',_0x9cbc('0x3'),_0x9cbc('0x4')),'allowNull':![],'defaultValue':_0x9cbc('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde52=['exports','ENUM','first','second','third','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xde52,0xb4));var _0x2de5=function(_0x22a9b7,_0x58e5d4){_0x22a9b7=_0x22a9b7-0x0;var _0x8a8568=_0xde52[_0x22a9b7];return _0x8a8568;};'use strict';var Sequelize=require('sequelize');module[_0x2de5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x2de5('0x1')](_0x2de5('0x2'),_0x2de5('0x3'),_0x2de5('0x4')),'allowNull':![],'defaultValue':_0x2de5('0x2')},'description':{'type':Sequelize[_0x2de5('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 987af95..1b0ace7 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 _0x1caf=['show','params','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','zip-dir','bluebird','util','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','get','Dispositions','UserProfileResource','destroy','then','error','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','count','includeAll','include','findAll'];(function(_0x4f6607,_0x383d7e){var _0x1fbc46=function(_0x4cd813){while(--_0x4cd813){_0x4f6607['push'](_0x4f6607['shift']());}};_0x1fbc46(++_0x383d7e);}(_0x1caf,0x1e1));var _0xf1ca=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x1caf[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require(_0xf1ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf1ca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf1ca('0x2'));var Mustache=require('mustache');var util=require(_0xf1ca('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf1ca('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1ca('0x5'));var squel=require(_0xf1ca('0x6'));var crypto=require(_0xf1ca('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf1ca('0x8'));var querystring=require(_0xf1ca('0x9'));var Papa=require(_0xf1ca('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf1ca('0xb'));var as=require(_0xf1ca('0xc'));var hardwareService=require(_0xf1ca('0xd'));var logger=require(_0xf1ca('0xe'))('api');var utils=require(_0xf1ca('0xf'));var config=require(_0xf1ca('0x10'));var licenseUtil=require(_0xf1ca('0x11'));var db=require(_0xf1ca('0x12'))['db'];function respondWithStatusCode(_0x45180b,_0x1d8a26){_0x1d8a26=_0x1d8a26||0xcc;return function(_0x27f35f){if(_0x27f35f){return _0x45180b[_0xf1ca('0x13')](_0x1d8a26);}return _0x45180b[_0xf1ca('0x14')](_0x1d8a26)[_0xf1ca('0x15')]();};}function respondWithResult(_0x58eb02,_0x3ca34f){_0x3ca34f=_0x3ca34f||0xc8;return function(_0x275875){if(_0x275875){return _0x58eb02[_0xf1ca('0x14')](_0x3ca34f)[_0xf1ca('0x16')](_0x275875);}};}function respondWithFilteredResult(_0x3c47f7,_0x166907){return function(_0x3ebed9){if(_0x3ebed9){var _0x5176ac=typeof _0x166907[_0xf1ca('0x17')]===_0xf1ca('0x18')&&typeof _0x166907[_0xf1ca('0x19')]===_0xf1ca('0x18');var _0x30c9b2=_0x3ebed9['count'];var _0x3ce46b=_0x5176ac?0x0:_0x166907['offset'];var _0x7d67bc=_0x5176ac?_0x3ebed9['count']:_0x166907[_0xf1ca('0x17')]+_0x166907[_0xf1ca('0x19')];var _0x401a3d;if(_0x7d67bc>=_0x30c9b2){_0x7d67bc=_0x30c9b2;_0x401a3d=0xc8;}else{_0x401a3d=0xce;}_0x3c47f7[_0xf1ca('0x14')](_0x401a3d);return _0x3c47f7[_0xf1ca('0x1a')](_0xf1ca('0x1b'),_0x3ce46b+'-'+_0x7d67bc+'/'+_0x30c9b2)['json'](_0x3ebed9);}return null;};}function patchUpdates(_0x13a37d){return function(_0x240e50){try{jsonpatch[_0xf1ca('0x1c')](_0x240e50,_0x13a37d,!![]);}catch(_0xb5462b){return BPromise[_0xf1ca('0x1d')](_0xb5462b);}return _0x240e50['save']();};}function saveUpdates(_0x95aa51,_0x175a25){return function(_0x28b8f5){if(_0x28b8f5){return _0x28b8f5[_0xf1ca('0x1e')](_0x95aa51)['then'](function(_0x1c2a35){return _0x1c2a35;});}return null;};}function removeEntity(_0x140597,_0x361204){return function(_0xbeca02){if(_0xbeca02){return _0xbeca02['destroy']()['then'](function(){var _0x3af470=_0xbeca02[_0xf1ca('0x1f')]({'plain':!![]});var _0x37d2f5=_0xf1ca('0x20');return db[_0xf1ca('0x21')][_0xf1ca('0x22')]({'where':{'type':_0x37d2f5,'resourceId':_0x3af470['id']}})[_0xf1ca('0x23')](function(){return _0xbeca02;});})[_0xf1ca('0x23')](function(){_0x140597['status'](0xcc)[_0xf1ca('0x15')]();});}};}function handleEntityNotFound(_0x1a3bc3,_0x146186){return function(_0x1ae59c){if(!_0x1ae59c){_0x1a3bc3[_0xf1ca('0x13')](0x194);}return _0x1ae59c;};}function handleError(_0x30631f,_0x57f433){_0x57f433=_0x57f433||0x1f4;return function(_0x14ef58){logger[_0xf1ca('0x24')](_0x14ef58[_0xf1ca('0x25')]);if(_0x14ef58[_0xf1ca('0x26')]){delete _0x14ef58[_0xf1ca('0x26')];}_0x30631f[_0xf1ca('0x14')](_0x57f433)[_0xf1ca('0x27')](_0x14ef58);};}exports['index']=function(_0x5a105d,_0xf98f9e){var _0x5b8ed2={},_0x24f3e5={},_0x52447d={'count':0x0,'rows':[]};var _0x944b52=_[_0xf1ca('0x28')](db[_0xf1ca('0x29')][_0xf1ca('0x2a')],function(_0x393f69){return{'name':_0x393f69[_0xf1ca('0x2b')],'type':_0x393f69[_0xf1ca('0x2c')][_0xf1ca('0x2d')]};});_0x24f3e5[_0xf1ca('0x2e')]=_[_0xf1ca('0x28')](_0x944b52,_0xf1ca('0x26'));_0x24f3e5[_0xf1ca('0x2f')]=_['keys'](_0x5a105d['query']);_0x24f3e5[_0xf1ca('0x30')]=_[_0xf1ca('0x31')](_0x24f3e5['model'],_0x24f3e5[_0xf1ca('0x2f')]);_0x5b8ed2[_0xf1ca('0x32')]=_[_0xf1ca('0x31')](_0x24f3e5[_0xf1ca('0x2e')],qs['fields'](_0x5a105d[_0xf1ca('0x2f')][_0xf1ca('0x33')]));_0x5b8ed2[_0xf1ca('0x32')]=_0x5b8ed2[_0xf1ca('0x32')][_0xf1ca('0x34')]?_0x5b8ed2[_0xf1ca('0x32')]:_0x24f3e5[_0xf1ca('0x2e')];if(!_0x5a105d[_0xf1ca('0x2f')][_0xf1ca('0x35')](_0xf1ca('0x36'))){_0x5b8ed2[_0xf1ca('0x19')]=qs[_0xf1ca('0x19')](_0x5a105d['query'][_0xf1ca('0x19')]);_0x5b8ed2[_0xf1ca('0x17')]=qs[_0xf1ca('0x17')](_0x5a105d['query'][_0xf1ca('0x17')]);}_0x5b8ed2[_0xf1ca('0x37')]=qs['sort'](_0x5a105d['query']['sort']);_0x5b8ed2[_0xf1ca('0x38')]=qs['filters'](_[_0xf1ca('0x39')](_0x5a105d['query'],_0x24f3e5['filters']),_0x944b52);if(_0x5a105d[_0xf1ca('0x2f')]['filter']){_0x5b8ed2[_0xf1ca('0x38')]=_[_0xf1ca('0x3a')](_0x5b8ed2[_0xf1ca('0x38')],{'$or':_[_0xf1ca('0x28')](_0x944b52,function(_0x366110){if(_0x366110[_0xf1ca('0x2c')]!=='VIRTUAL'){var _0x4d04ef={};_0x4d04ef[_0x366110[_0xf1ca('0x26')]]={'$like':'%'+_0x5a105d['query'][_0xf1ca('0x3b')]+'%'};return _0x4d04ef;}})});}_0x5b8ed2=_[_0xf1ca('0x3a')]({},_0x5b8ed2,_0x5a105d[_0xf1ca('0x3c')]);var _0xa98e7e={'where':_0x5b8ed2[_0xf1ca('0x38')]};return db[_0xf1ca('0x29')]['count'](_0xa98e7e)['then'](function(_0x5bf91a){_0x52447d[_0xf1ca('0x3d')]=_0x5bf91a;if(_0x5a105d[_0xf1ca('0x2f')][_0xf1ca('0x3e')]){_0x5b8ed2[_0xf1ca('0x3f')]=[{'all':!![]}];}return db['Disposition'][_0xf1ca('0x40')](_0x5b8ed2);})[_0xf1ca('0x23')](function(_0x3962c7){_0x52447d['rows']=_0x3962c7;return _0x52447d;})[_0xf1ca('0x23')](respondWithFilteredResult(_0xf98f9e,_0x5b8ed2))['catch'](handleError(_0xf98f9e,null));};exports[_0xf1ca('0x41')]=function(_0x2cfc77,_0x51d1f6){var _0x2cf980={'raw':!![],'where':{'id':_0x2cfc77[_0xf1ca('0x42')]['id']}},_0x3d900d={};_0x3d900d[_0xf1ca('0x2e')]=_['keys'](db[_0xf1ca('0x29')]['rawAttributes']);_0x3d900d['query']=_[_0xf1ca('0x43')](_0x2cfc77[_0xf1ca('0x2f')]);_0x3d900d[_0xf1ca('0x30')]=_[_0xf1ca('0x31')](_0x3d900d['model'],_0x3d900d[_0xf1ca('0x2f')]);_0x2cf980[_0xf1ca('0x32')]=_[_0xf1ca('0x31')](_0x3d900d[_0xf1ca('0x2e')],qs[_0xf1ca('0x33')](_0x2cfc77[_0xf1ca('0x2f')][_0xf1ca('0x33')]));_0x2cf980[_0xf1ca('0x32')]=_0x2cf980[_0xf1ca('0x32')][_0xf1ca('0x34')]?_0x2cf980[_0xf1ca('0x32')]:_0x3d900d[_0xf1ca('0x2e')];if(_0x2cfc77[_0xf1ca('0x2f')][_0xf1ca('0x3e')]){_0x2cf980[_0xf1ca('0x3f')]=[{'all':!![]}];}_0x2cf980=_['merge']({},_0x2cf980,_0x2cfc77['options']);return db[_0xf1ca('0x29')]['find'](_0x2cf980)['then'](handleEntityNotFound(_0x51d1f6,null))[_0xf1ca('0x23')](respondWithResult(_0x51d1f6,null))[_0xf1ca('0x44')](handleError(_0x51d1f6,null));};exports[_0xf1ca('0x45')]=function(_0x477fe0,_0x193064){return db[_0xf1ca('0x29')][_0xf1ca('0x45')](_0x477fe0[_0xf1ca('0x46')],{})[_0xf1ca('0x23')](function(_0x75346){var _0x4928a6=_0x477fe0[_0xf1ca('0x47')][_0xf1ca('0x1f')]({'plain':!![]});if(!_0x4928a6)throw new Error(_0xf1ca('0x48'));if(_0x4928a6[_0xf1ca('0x49')]==='user'){var _0x5a9ca4=_0x75346[_0xf1ca('0x1f')]({'plain':!![]});var _0x159c1f=_0xf1ca('0x20');return db[_0xf1ca('0x4a')]['find']({'where':{'name':_0x159c1f,'userProfileId':_0x4928a6['userProfileId']},'raw':!![]})[_0xf1ca('0x23')](function(_0x673b2d){if(_0x673b2d&&_0x673b2d[_0xf1ca('0x4b')]===0x0){return db[_0xf1ca('0x21')][_0xf1ca('0x45')]({'name':_0x5a9ca4['name'],'resourceId':_0x5a9ca4['id'],'type':_0x673b2d[_0xf1ca('0x26')],'sectionId':_0x673b2d['id']},{})[_0xf1ca('0x23')](function(){return _0x75346;});}else{return _0x75346;}})[_0xf1ca('0x44')](function(_0x31446d){logger['error'](_0xf1ca('0x4c'),_0x31446d);throw _0x31446d;});}return _0x75346;})[_0xf1ca('0x23')](respondWithResult(_0x193064,0xc9))[_0xf1ca('0x44')](handleError(_0x193064,null));};exports['update']=function(_0x57f67a,_0x481f28){if(_0x57f67a['body']['id']){delete _0x57f67a[_0xf1ca('0x46')]['id'];}return db[_0xf1ca('0x29')][_0xf1ca('0x4d')]({'where':{'id':_0x57f67a[_0xf1ca('0x42')]['id']}})[_0xf1ca('0x23')](handleEntityNotFound(_0x481f28,null))[_0xf1ca('0x23')](saveUpdates(_0x57f67a[_0xf1ca('0x46')],null))['then'](respondWithResult(_0x481f28,null))[_0xf1ca('0x44')](handleError(_0x481f28,null));};exports['destroy']=function(_0x4deeba,_0x1360fe){return db[_0xf1ca('0x29')][_0xf1ca('0x4d')]({'where':{'id':_0x4deeba['params']['id']}})[_0xf1ca('0x23')](handleEntityNotFound(_0x1360fe,null))['then'](removeEntity(_0x1360fe,null))[_0xf1ca('0x44')](handleError(_0x1360fe,null));}; \ No newline at end of file +var _0x6bfc=['UserProfileResource','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','findAll','catch','show','params','includeAll','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','update','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','then','destroy','Dispositions'];(function(_0x8c51b6,_0x431aff){var _0x2fe4b7=function(_0x58051a){while(--_0x58051a){_0x8c51b6['push'](_0x8c51b6['shift']());}};_0x2fe4b7(++_0x431aff);}(_0x6bfc,0x159));var _0xc6bf=function(_0x18db6d,_0x4a6283){_0x18db6d=_0x18db6d-0x0;var _0x144b95=_0x6bfc[_0x18db6d];return _0x144b95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6bf('0x0'));var zipdir=require(_0xc6bf('0x1'));var jsonpatch=require(_0xc6bf('0x2'));var rp=require('request-promise');var moment=require(_0xc6bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6bf('0x4'));var util=require('util');var path=require(_0xc6bf('0x5'));var sox=require(_0xc6bf('0x6'));var csv=require(_0xc6bf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6bf('0x8'));var _=require(_0xc6bf('0x9'));var squel=require(_0xc6bf('0xa'));var crypto=require(_0xc6bf('0xb'));var jsforce=require(_0xc6bf('0xc'));var deskjs=require(_0xc6bf('0xd'));var toCsv=require(_0xc6bf('0x7'));var querystring=require(_0xc6bf('0xe'));var Papa=require('papaparse');var Redis=require(_0xc6bf('0xf'));var authService=require(_0xc6bf('0x10'));var qs=require(_0xc6bf('0x11'));var as=require(_0xc6bf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc6bf('0x13'));var utils=require(_0xc6bf('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc6bf('0x15'))['db'];function respondWithStatusCode(_0x303ae7,_0x49db35){_0x49db35=_0x49db35||0xcc;return function(_0x1cbc07){if(_0x1cbc07){return _0x303ae7[_0xc6bf('0x16')](_0x49db35);}return _0x303ae7[_0xc6bf('0x17')](_0x49db35)[_0xc6bf('0x18')]();};}function respondWithResult(_0x42e25e,_0x503364){_0x503364=_0x503364||0xc8;return function(_0x58dd19){if(_0x58dd19){return _0x42e25e[_0xc6bf('0x17')](_0x503364)[_0xc6bf('0x19')](_0x58dd19);}};}function respondWithFilteredResult(_0x5b5567,_0x18f81c){return function(_0x331f31){if(_0x331f31){var _0x368195=typeof _0x18f81c[_0xc6bf('0x1a')]==='undefined'&&typeof _0x18f81c[_0xc6bf('0x1b')]==='undefined';var _0x4dec90=_0x331f31[_0xc6bf('0x1c')];var _0x23a9e9=_0x368195?0x0:_0x18f81c['offset'];var _0x370150=_0x368195?_0x331f31[_0xc6bf('0x1c')]:_0x18f81c['offset']+_0x18f81c[_0xc6bf('0x1b')];var _0x4adc0a;if(_0x370150>=_0x4dec90){_0x370150=_0x4dec90;_0x4adc0a=0xc8;}else{_0x4adc0a=0xce;}_0x5b5567['status'](_0x4adc0a);return _0x5b5567['set'](_0xc6bf('0x1d'),_0x23a9e9+'-'+_0x370150+'/'+_0x4dec90)[_0xc6bf('0x19')](_0x331f31);}return null;};}function patchUpdates(_0x5ac1b0){return function(_0x539ef2){try{jsonpatch[_0xc6bf('0x1e')](_0x539ef2,_0x5ac1b0,!![]);}catch(_0x2e47ce){return BPromise['reject'](_0x2e47ce);}return _0x539ef2[_0xc6bf('0x1f')]();};}function saveUpdates(_0x41ca5a,_0x1e2110){return function(_0x56e899){if(_0x56e899){return _0x56e899['update'](_0x41ca5a)[_0xc6bf('0x20')](function(_0x202856){return _0x202856;});}return null;};}function removeEntity(_0x3822bb,_0x1a0a50){return function(_0x3b5dd7){if(_0x3b5dd7){return _0x3b5dd7[_0xc6bf('0x21')]()[_0xc6bf('0x20')](function(){var _0x1cf65d=_0x3b5dd7['get']({'plain':!![]});var _0x312138=_0xc6bf('0x22');return db[_0xc6bf('0x23')]['destroy']({'where':{'type':_0x312138,'resourceId':_0x1cf65d['id']}})[_0xc6bf('0x20')](function(){return _0x3b5dd7;});})[_0xc6bf('0x20')](function(){_0x3822bb[_0xc6bf('0x17')](0xcc)[_0xc6bf('0x18')]();});}};}function handleEntityNotFound(_0x1346d5,_0x15396c){return function(_0x5abf52){if(!_0x5abf52){_0x1346d5['sendStatus'](0x194);}return _0x5abf52;};}function handleError(_0x1b6e7c,_0x519dc8){_0x519dc8=_0x519dc8||0x1f4;return function(_0x36b1c7){logger['error'](_0x36b1c7['stack']);if(_0x36b1c7[_0xc6bf('0x24')]){delete _0x36b1c7[_0xc6bf('0x24')];}_0x1b6e7c[_0xc6bf('0x17')](_0x519dc8)[_0xc6bf('0x25')](_0x36b1c7);};}exports['index']=function(_0x478af5,_0x543ad5){var _0x4f0234={},_0x32407b={},_0xf49ed7={'count':0x0,'rows':[]};var _0x1d46bd=_[_0xc6bf('0x26')](db[_0xc6bf('0x27')][_0xc6bf('0x28')],function(_0xb127da){return{'name':_0xb127da[_0xc6bf('0x29')],'type':_0xb127da[_0xc6bf('0x2a')][_0xc6bf('0x2b')]};});_0x32407b[_0xc6bf('0x2c')]=_[_0xc6bf('0x26')](_0x1d46bd,_0xc6bf('0x24'));_0x32407b[_0xc6bf('0x2d')]=_[_0xc6bf('0x2e')](_0x478af5['query']);_0x32407b[_0xc6bf('0x2f')]=_[_0xc6bf('0x30')](_0x32407b[_0xc6bf('0x2c')],_0x32407b[_0xc6bf('0x2d')]);_0x4f0234['attributes']=_['intersection'](_0x32407b[_0xc6bf('0x2c')],qs[_0xc6bf('0x31')](_0x478af5[_0xc6bf('0x2d')][_0xc6bf('0x31')]));_0x4f0234[_0xc6bf('0x32')]=_0x4f0234['attributes'][_0xc6bf('0x33')]?_0x4f0234['attributes']:_0x32407b['model'];if(!_0x478af5[_0xc6bf('0x2d')][_0xc6bf('0x34')](_0xc6bf('0x35'))){_0x4f0234[_0xc6bf('0x1b')]=qs[_0xc6bf('0x1b')](_0x478af5['query'][_0xc6bf('0x1b')]);_0x4f0234[_0xc6bf('0x1a')]=qs['offset'](_0x478af5[_0xc6bf('0x2d')][_0xc6bf('0x1a')]);}_0x4f0234[_0xc6bf('0x36')]=qs['sort'](_0x478af5['query']['sort']);_0x4f0234[_0xc6bf('0x37')]=qs[_0xc6bf('0x2f')](_[_0xc6bf('0x38')](_0x478af5['query'],_0x32407b[_0xc6bf('0x2f')]),_0x1d46bd);if(_0x478af5['query']['filter']){_0x4f0234[_0xc6bf('0x37')]=_[_0xc6bf('0x39')](_0x4f0234[_0xc6bf('0x37')],{'$or':_['map'](_0x1d46bd,function(_0x583e28){if(_0x583e28[_0xc6bf('0x2a')]!==_0xc6bf('0x3a')){var _0x45b346={};_0x45b346[_0x583e28[_0xc6bf('0x24')]]={'$like':'%'+_0x478af5[_0xc6bf('0x2d')][_0xc6bf('0x3b')]+'%'};return _0x45b346;}})});}_0x4f0234=_[_0xc6bf('0x39')]({},_0x4f0234,_0x478af5['options']);var _0x3e813c={'where':_0x4f0234[_0xc6bf('0x37')]};return db[_0xc6bf('0x27')]['count'](_0x3e813c)[_0xc6bf('0x20')](function(_0x2976ee){_0xf49ed7[_0xc6bf('0x1c')]=_0x2976ee;if(_0x478af5['query']['includeAll']){_0x4f0234['include']=[{'all':!![]}];}return db['Disposition'][_0xc6bf('0x3c')](_0x4f0234);})[_0xc6bf('0x20')](function(_0x552c30){_0xf49ed7['rows']=_0x552c30;return _0xf49ed7;})[_0xc6bf('0x20')](respondWithFilteredResult(_0x543ad5,_0x4f0234))[_0xc6bf('0x3d')](handleError(_0x543ad5,null));};exports[_0xc6bf('0x3e')]=function(_0x4b6461,_0x1087ff){var _0x1203bc={'raw':!![],'where':{'id':_0x4b6461[_0xc6bf('0x3f')]['id']}},_0x15e05a={};_0x15e05a[_0xc6bf('0x2c')]=_[_0xc6bf('0x2e')](db[_0xc6bf('0x27')]['rawAttributes']);_0x15e05a['query']=_[_0xc6bf('0x2e')](_0x4b6461[_0xc6bf('0x2d')]);_0x15e05a[_0xc6bf('0x2f')]=_[_0xc6bf('0x30')](_0x15e05a[_0xc6bf('0x2c')],_0x15e05a[_0xc6bf('0x2d')]);_0x1203bc[_0xc6bf('0x32')]=_[_0xc6bf('0x30')](_0x15e05a[_0xc6bf('0x2c')],qs[_0xc6bf('0x31')](_0x4b6461[_0xc6bf('0x2d')][_0xc6bf('0x31')]));_0x1203bc[_0xc6bf('0x32')]=_0x1203bc[_0xc6bf('0x32')][_0xc6bf('0x33')]?_0x1203bc[_0xc6bf('0x32')]:_0x15e05a[_0xc6bf('0x2c')];if(_0x4b6461['query'][_0xc6bf('0x40')]){_0x1203bc[_0xc6bf('0x41')]=[{'all':!![]}];}_0x1203bc=_[_0xc6bf('0x39')]({},_0x1203bc,_0x4b6461[_0xc6bf('0x42')]);return db['Disposition'][_0xc6bf('0x43')](_0x1203bc)[_0xc6bf('0x20')](handleEntityNotFound(_0x1087ff,null))[_0xc6bf('0x20')](respondWithResult(_0x1087ff,null))['catch'](handleError(_0x1087ff,null));};exports[_0xc6bf('0x44')]=function(_0x199d76,_0x1654c2){return db[_0xc6bf('0x27')]['create'](_0x199d76[_0xc6bf('0x45')],{})[_0xc6bf('0x20')](function(_0x45f47e){var _0x5274d6=_0x199d76['user']['get']({'plain':!![]});if(!_0x5274d6)throw new Error(_0xc6bf('0x46'));if(_0x5274d6['role']==='user'){var _0x32f4b0=_0x45f47e['get']({'plain':!![]});var _0x18913e=_0xc6bf('0x22');return db[_0xc6bf('0x47')][_0xc6bf('0x43')]({'where':{'name':_0x18913e,'userProfileId':_0x5274d6[_0xc6bf('0x48')]},'raw':!![]})[_0xc6bf('0x20')](function(_0x1e6cf7){if(_0x1e6cf7&&_0x1e6cf7[_0xc6bf('0x49')]===0x0){return db[_0xc6bf('0x23')][_0xc6bf('0x44')]({'name':_0x32f4b0[_0xc6bf('0x24')],'resourceId':_0x32f4b0['id'],'type':_0x1e6cf7['name'],'sectionId':_0x1e6cf7['id']},{})['then'](function(){return _0x45f47e;});}else{return _0x45f47e;}})['catch'](function(_0xf67cd1){logger[_0xc6bf('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf67cd1);throw _0xf67cd1;});}return _0x45f47e;})['then'](respondWithResult(_0x1654c2,0xc9))['catch'](handleError(_0x1654c2,null));};exports[_0xc6bf('0x4b')]=function(_0x3825fc,_0x469217){if(_0x3825fc['body']['id']){delete _0x3825fc[_0xc6bf('0x45')]['id'];}return db[_0xc6bf('0x27')]['find']({'where':{'id':_0x3825fc[_0xc6bf('0x3f')]['id']}})[_0xc6bf('0x20')](handleEntityNotFound(_0x469217,null))[_0xc6bf('0x20')](saveUpdates(_0x3825fc[_0xc6bf('0x45')],null))[_0xc6bf('0x20')](respondWithResult(_0x469217,null))[_0xc6bf('0x3d')](handleError(_0x469217,null));};exports['destroy']=function(_0x5c55b3,_0x1dbc34){return db[_0xc6bf('0x27')][_0xc6bf('0x43')]({'where':{'id':_0x5c55b3[_0xc6bf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1dbc34,null))[_0xc6bf('0x20')](removeEntity(_0x1dbc34,null))[_0xc6bf('0x3d')](handleError(_0x1dbc34,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0a7d2fa..cd78bfa 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 _0xf1d1=['name_whatsapp','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','ListId','name_chat','ChatWebsiteId','name_mail','name','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId'];(function(_0x52f926,_0x3e9c33){var _0x416c69=function(_0x1b4096){while(--_0x1b4096){_0x52f926['push'](_0x52f926['shift']());}};_0x416c69(++_0x3e9c33);}(_0xf1d1,0xb7));var _0x1f1d=function(_0x426e5c,_0x5767ae){_0x426e5c=_0x426e5c-0x0;var _0x3558b4=_0xf1d1[_0x426e5c];return _0x3558b4;};'use strict';var _=require(_0x1f1d('0x0'));var util=require(_0x1f1d('0x1'));var logger=require(_0x1f1d('0x2'))(_0x1f1d('0x3'));var moment=require(_0x1f1d('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f1d('0x5'));var fs=require('fs');var path=require(_0x1f1d('0x6'));var rimraf=require(_0x1f1d('0x7'));var config=require(_0x1f1d('0x8'));var attributes=require(_0x1f1d('0x9'));module[_0x1f1d('0xa')]=function(_0x574a4b,_0x619b3c){return _0x574a4b[_0x1f1d('0xb')](_0x1f1d('0xc'),attributes,{'tableName':_0x1f1d('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0x1f1d('0xe')]},{'unique':!![],'name':_0x1f1d('0xf'),'fields':['name',_0x1f1d('0x10')]},{'unique':!![],'name':_0x1f1d('0x11'),'fields':[_0x1f1d('0x12'),_0x1f1d('0x13')]},{'unique':!![],'name':_0x1f1d('0x14'),'fields':['name',_0x1f1d('0x15')]},{'unique':!![],'name':'name_fax','fields':[_0x1f1d('0x12'),_0x1f1d('0x16')]},{'unique':!![],'name':_0x1f1d('0x17'),'fields':[_0x1f1d('0x12'),_0x1f1d('0x18')]},{'unique':!![],'name':_0x1f1d('0x19'),'fields':[_0x1f1d('0x12'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf14e=['SmsAccountId','name_fax','OpenchannelAccountId','WhatsappAccountId','util','../../config/logger','api','bluebird','path','rimraf','./disposition.attributes','exports','Disposition','name_voice','name','ListId','name_mail','name_sms'];(function(_0x3ce0d5,_0x203024){var _0x2e5731=function(_0x4be620){while(--_0x4be620){_0x3ce0d5['push'](_0x3ce0d5['shift']());}};_0x2e5731(++_0x203024);}(_0xf14e,0x17e));var _0xef14=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xf14e[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require(_0xef14('0x0'));var logger=require(_0xef14('0x1'))(_0xef14('0x2'));var moment=require('moment');var BPromise=require(_0xef14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef14('0x4'));var rimraf=require(_0xef14('0x5'));var config=require('../../config/environment');var attributes=require(_0xef14('0x6'));module[_0xef14('0x7')]=function(_0x4e5a07,_0x489301){return _0x4e5a07['define'](_0xef14('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xef14('0x9'),'fields':[_0xef14('0xa'),_0xef14('0xb')]},{'unique':!![],'name':'name_chat','fields':[_0xef14('0xa'),'ChatWebsiteId']},{'unique':!![],'name':_0xef14('0xc'),'fields':[_0xef14('0xa'),'MailAccountId']},{'unique':!![],'name':_0xef14('0xd'),'fields':[_0xef14('0xa'),_0xef14('0xe')]},{'unique':!![],'name':_0xef14('0xf'),'fields':['name','FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':['name',_0xef14('0x10')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0xef14('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e63b2e0..fb94154 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(_0x212311,_0xb9ac85){var _0x1b407a=function(_0x16a73d){while(--_0x16a73d){_0x212311['push'](_0x212311['shift']());}};_0x1b407a(++_0xb9ac85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x124d29,_0x1fefc2){var _0x4d6752=function(_0x291dd5){while(--_0x291dd5){_0x124d29['push'](_0x124d29['shift']());}};_0x4d6752(++_0x1fefc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 d5c76ef..7afb0e9 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 _0x8d72=['index','/:id','show','post','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated'];(function(_0x1f68a0,_0x169293){var _0x2d2f71=function(_0x43d895){while(--_0x43d895){_0x1f68a0['push'](_0x1f68a0['shift']());}};_0x2d2f71(++_0x169293);}(_0x8d72,0x13a));var _0x28d7=function(_0x23e034,_0x1e1bfc){_0x23e034=_0x23e034-0x0;var _0x1d13a6=_0x8d72[_0x23e034];return _0x1d13a6;};'use strict';var multer=require(_0x28d7('0x0'));var util=require(_0x28d7('0x1'));var path=require(_0x28d7('0x2'));var timeout=require('connect-timeout');var express=require(_0x28d7('0x3'));var router=express[_0x28d7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x28d7('0x5'));var config=require(_0x28d7('0x6'));var controller=require(_0x28d7('0x7'));router[_0x28d7('0x8')]('/',auth[_0x28d7('0x9')](),controller[_0x28d7('0xa')]);router[_0x28d7('0x8')](_0x28d7('0xb'),auth['isAuthenticated'](),controller[_0x28d7('0xc')]);router[_0x28d7('0xd')]('/',auth[_0x28d7('0x9')](),controller['create']);router['put'](_0x28d7('0xb'),auth[_0x28d7('0x9')](),controller[_0x28d7('0xe')]);router[_0x28d7('0xf')](_0x28d7('0xb'),auth[_0x28d7('0x9')](),controller[_0x28d7('0x10')]);module[_0x28d7('0x11')]=router; \ No newline at end of file +var _0x7183=['put','update','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create'];(function(_0x62b58e,_0x46fe1e){var _0x37fe84=function(_0x12a2ca){while(--_0x12a2ca){_0x62b58e['push'](_0x62b58e['shift']());}};_0x37fe84(++_0x46fe1e);}(_0x7183,0x124));var _0x3718=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7183[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3718('0x0'));var timeout=require(_0x3718('0x1'));var express=require('express');var router=express[_0x3718('0x2')]();var fs_extra=require(_0x3718('0x3'));var auth=require(_0x3718('0x4'));var interaction=require(_0x3718('0x5'));var config=require(_0x3718('0x6'));var controller=require('./disposition.controller');router[_0x3718('0x7')]('/',auth[_0x3718('0x8')](),controller['index']);router[_0x3718('0x7')](_0x3718('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x3718('0xa')]('/',auth[_0x3718('0x8')](),controller[_0x3718('0xb')]);router[_0x3718('0xc')](_0x3718('0x9'),auth[_0x3718('0x8')](),controller[_0x3718('0xd')]);router['delete'](_0x3718('0x9'),auth[_0x3718('0x8')](),controller[_0x3718('0xe')]);module[_0x3718('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 79cb708..96a2e36 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 _0xa516=['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','sequelize','exports','ENUM','yes','STRING','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP'];(function(_0x3a41e7,_0x5af6a3){var _0xbf867f=function(_0x2ff239){while(--_0x2ff239){_0x3a41e7['push'](_0x3a41e7['shift']());}};_0xbf867f(++_0x5af6a3);}(_0xa516,0x1c9));var _0x6a51=function(_0x210528,_0x3d9c9b){_0x210528=_0x210528-0x0;var _0x4a8782=_0xa516[_0x210528];return _0x4a8782;};'use strict';var Sequelize=require(_0x6a51('0x0'));module[_0x6a51('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x6a51('0x2')](_0x6a51('0x3'),'no'),'defaultValue':_0x6a51('0x3')},'headerinfo':{'type':Sequelize[_0x6a51('0x4')],'defaultValue':_0x6a51('0x5')},'localstationid':{'type':Sequelize[_0x6a51('0x4')],'unique':_0x6a51('0x6')},'minrate':{'type':Sequelize[_0x6a51('0x2')]('2400',_0x6a51('0x7'),_0x6a51('0x8'),_0x6a51('0x9'),_0x6a51('0xa'),_0x6a51('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x6a51('0xc'),_0x6a51('0x7'),'7200',_0x6a51('0x9'),_0x6a51('0xa'),_0x6a51('0xb')),'defaultValue':_0x6a51('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x6a51('0xd')},'gateway':{'type':Sequelize[_0x6a51('0x4')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6a51('0x4')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6a51('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6a51('0x2')](_0x6a51('0xf'),'IAX',_0x6a51('0x10'),_0x6a51('0x11')),'defaultValue':_0x6a51('0xf')},'key':{'type':Sequelize[_0x6a51('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6a51('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6a51('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6a51('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6a51('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6a51('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6a51('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6a51('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x6a51('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x6a51('0x13')],'defaultValue':![],'comment':_0x6a51('0x15'),'set':function(_0x181c3d){if(!_0x181c3d)this[_0x6a51('0x16')](_0x6a51('0x17'),null);this[_0x6a51('0x16')](_0x6a51('0x18'),_0x181c3d);}}}; \ No newline at end of file +var _0xa6c6=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x20a023,_0x5edca8){var _0xb1bd99=function(_0x2b2292){while(--_0x2b2292){_0x20a023['push'](_0x20a023['shift']());}};_0xb1bd99(++_0x5edca8);}(_0xa6c6,0x167));var _0x6a6c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa6c6[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x6a6c('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a6c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6a6c('0x1')]},'ecm':{'type':Sequelize[_0x6a6c('0x2')](_0x6a6c('0x3'),'no'),'defaultValue':_0x6a6c('0x3')},'headerinfo':{'type':Sequelize[_0x6a6c('0x1')],'defaultValue':_0x6a6c('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x6a6c('0x5')},'minrate':{'type':Sequelize[_0x6a6c('0x2')](_0x6a6c('0x6'),_0x6a6c('0x7'),_0x6a6c('0x8'),_0x6a6c('0x9'),_0x6a6c('0xa'),_0x6a6c('0xb')),'defaultValue':_0x6a6c('0x7')},'maxrate':{'type':Sequelize[_0x6a6c('0x2')](_0x6a6c('0x6'),'4800',_0x6a6c('0x8'),_0x6a6c('0x9'),_0x6a6c('0xa'),_0x6a6c('0xb')),'defaultValue':_0x6a6c('0xb')},'modem':{'type':Sequelize[_0x6a6c('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x6a6c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6a6c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x6a6c('0xc'),_0x6a6c('0xd'),_0x6a6c('0xe'),_0x6a6c('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x6a6c('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6a6c('0x10')],'defaultValue':function(){return _0x6a6c('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6a6c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6a6c('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6a6c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6a6c('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6a6c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6a6c('0x12')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6a6c('0x13')],'defaultValue':![],'comment':_0x6a6c('0x14'),'set':function(_0x105d8e){if(!_0x105d8e)this[_0x6a6c('0x15')](_0x6a6c('0x16'),null);this[_0x6a6c('0x15')](_0x6a6c('0x17'),_0x105d8e);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 650e1f7..b211498 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 _0xbc88=['appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','FaxAccount','include','rows','rawAttributes','includeAll','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','userProfileId','autoAssociation','params','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','filter','findAll','removeDispositions','ids','CannedAnswer','create','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','hasOwnProperty','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','localstationid','app','system','Fax\x20Extension'];(function(_0xd688ab,_0x6eb877){var _0x188138=function(_0x3acc5b){while(--_0x3acc5b){_0xd688ab['push'](_0xd688ab['shift']());}};_0x188138(++_0x6eb877);}(_0xbc88,0xf3));var _0x8bc8=function(_0x1fb0f9,_0x55f4e1){_0x1fb0f9=_0x1fb0f9-0x0;var _0x318ee0=_0xbc88[_0x1fb0f9];return _0x318ee0;};'use strict';var emlformat=require(_0x8bc8('0x0'));var rimraf=require(_0x8bc8('0x1'));var zipdir=require(_0x8bc8('0x2'));var jsonpatch=require(_0x8bc8('0x3'));var rp=require(_0x8bc8('0x4'));var moment=require(_0x8bc8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8bc8('0x6'));var util=require(_0x8bc8('0x7'));var path=require(_0x8bc8('0x8'));var sox=require(_0x8bc8('0x9'));var csv=require(_0x8bc8('0xa'));var ejs=require(_0x8bc8('0xb'));var fs=require('fs');var fs_extra=require(_0x8bc8('0xc'));var _=require(_0x8bc8('0xd'));var squel=require('squel');var crypto=require(_0x8bc8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8bc8('0xf'));var toCsv=require(_0x8bc8('0xa'));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(_0x8bc8('0x10'));var hardwareService=require(_0x8bc8('0x11'));var logger=require('../../config/logger')(_0x8bc8('0x12'));var utils=require(_0x8bc8('0x13'));var config=require(_0x8bc8('0x14'));var licenseUtil=require(_0x8bc8('0x15'));var db=require(_0x8bc8('0x16'))['db'];config[_0x8bc8('0x17')]=_[_0x8bc8('0x18')](config[_0x8bc8('0x17')],{'host':_0x8bc8('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8bc8('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8bc8('0x1b')][_0x8bc8('0x1c')]({'port':0x232c});var client9002=jayson[_0x8bc8('0x1b')][_0x8bc8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x16ac11,_0x4712b0,_0x37a0e0,_0x4491b7){return new BPromise(function(_0x4ea473,_0x18c802){var _0x5279f0=_0x4491b7||client;return _0x5279f0[_0x8bc8('0x1d')](_0x16ac11,_0x37a0e0)[_0x8bc8('0x1e')](function(_0xfdadf8){logger[_0x8bc8('0x1f')](_0x8bc8('0x20'),_0x4712b0,'request\x20sent');logger[_0x8bc8('0x21')](_0x8bc8('0x22'),_0x4712b0,'request\x20sent',JSON['stringify'](_0xfdadf8));if(_0xfdadf8[_0x8bc8('0x23')]){if(_0xfdadf8['error']['code']===0x1f4){logger['error'](_0x8bc8('0x20'),_0x4712b0,_0xfdadf8['error'][_0x8bc8('0x24')]);return _0x18c802(_0xfdadf8[_0x8bc8('0x23')][_0x8bc8('0x24')]);}logger[_0x8bc8('0x23')](_0x8bc8('0x20'),_0x4712b0,_0xfdadf8[_0x8bc8('0x23')][_0x8bc8('0x24')]);return _0x4ea473(_0xfdadf8['error'][_0x8bc8('0x24')]);}else{logger[_0x8bc8('0x1f')](_0x8bc8('0x20'),_0x4712b0,_0x8bc8('0x25'));_0x4ea473(_0xfdadf8[_0x8bc8('0x26')]['message']);}})[_0x8bc8('0x27')](function(_0x4562b0){logger[_0x8bc8('0x23')](_0x8bc8('0x20'),_0x4712b0,_0x4562b0);_0x18c802(_0x4562b0);});});}function respondWithStatusCode(_0x53e9e7,_0x319c60){_0x319c60=_0x319c60||0xcc;return function(_0x528aa9){if(_0x528aa9){return _0x53e9e7[_0x8bc8('0x28')](_0x319c60);}return _0x53e9e7[_0x8bc8('0x29')](_0x319c60)[_0x8bc8('0x2a')]();};}function respondWithResult(_0x11d829,_0x5ce0de){_0x5ce0de=_0x5ce0de||0xc8;return function(_0x5b3422){if(_0x5b3422){return _0x11d829['status'](_0x5ce0de)[_0x8bc8('0x2b')](_0x5b3422);}};}function respondWithFilteredResult(_0x5c59bb,_0x4ebfad){return function(_0x22f744){if(_0x22f744){var _0x27a588=typeof _0x4ebfad[_0x8bc8('0x2c')]===_0x8bc8('0x2d')&&typeof _0x4ebfad[_0x8bc8('0x2e')]===_0x8bc8('0x2d');var _0xf06044=_0x22f744[_0x8bc8('0x2f')];var _0x41bb5f=_0x27a588?0x0:_0x4ebfad[_0x8bc8('0x2c')];var _0xd8d7df=_0x27a588?_0x22f744[_0x8bc8('0x2f')]:_0x4ebfad[_0x8bc8('0x2c')]+_0x4ebfad[_0x8bc8('0x2e')];var _0x523007;if(_0xd8d7df>=_0xf06044){_0xd8d7df=_0xf06044;_0x523007=0xc8;}else{_0x523007=0xce;}_0x5c59bb[_0x8bc8('0x29')](_0x523007);return _0x5c59bb['set']('Content-Range',_0x41bb5f+'-'+_0xd8d7df+'/'+_0xf06044)[_0x8bc8('0x2b')](_0x22f744);}return null;};}function patchUpdates(_0x34a563){return function(_0xd6d815){try{jsonpatch[_0x8bc8('0x30')](_0xd6d815,_0x34a563,!![]);}catch(_0xff6656){return BPromise[_0x8bc8('0x31')](_0xff6656);}return _0xd6d815[_0x8bc8('0x32')]();};}function saveUpdates(_0x459190,_0x37b962){return function(_0x524217){if(_0x524217){return _0x524217[_0x8bc8('0x33')](_0x459190)[_0x8bc8('0x1e')](function(_0x33fc55){return _0x33fc55;});}return null;};}function removeEntity(_0x1e349f,_0x253b5f){return function(_0x2c6176){if(_0x2c6176){return _0x2c6176[_0x8bc8('0x34')]()['then'](function(){var _0x5197e6=_0x2c6176['get']({'plain':!![]});var _0x1a5fc1='FaxAccounts';return db[_0x8bc8('0x35')]['destroy']({'where':{'type':_0x1a5fc1,'resourceId':_0x5197e6['id']}})[_0x8bc8('0x1e')](function(){return _0x2c6176;});})[_0x8bc8('0x1e')](function(){_0x1e349f[_0x8bc8('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8c210,_0x4c181f){return function(_0x1f3ac8){if(!_0x1f3ac8){_0xe8c210['sendStatus'](0x194);}return _0x1f3ac8;};}function handleError(_0x1c83df,_0x4ab9ca){_0x4ab9ca=_0x4ab9ca||0x1f4;return function(_0x40fe96){logger[_0x8bc8('0x23')](_0x40fe96[_0x8bc8('0x36')]);if(_0x40fe96['name']){delete _0x40fe96[_0x8bc8('0x37')];}_0x1c83df[_0x8bc8('0x29')](_0x4ab9ca)[_0x8bc8('0x38')](_0x40fe96);};}exports[_0x8bc8('0x39')]=function(_0x273069,_0x5cbaef){var _0x19d48a={'include':[{'model':db[_0x8bc8('0x3a')],'as':_0x8bc8('0x3b')}]},_0x27b70a={},_0x3ba218={'count':0x0,'rows':[]};var _0x4b0d9c=_['map'](db['FaxAccount']['rawAttributes'],function(_0x4eb7e5){return{'name':_0x4eb7e5['fieldName'],'type':_0x4eb7e5[_0x8bc8('0x3c')][_0x8bc8('0x3d')]};});_0x27b70a[_0x8bc8('0x3e')]=_[_0x8bc8('0x3f')](_0x4b0d9c,_0x8bc8('0x37'));_0x27b70a[_0x8bc8('0x40')]=_[_0x8bc8('0x41')](_0x273069['query']);_0x27b70a['filters']=_[_0x8bc8('0x42')](_0x27b70a[_0x8bc8('0x3e')],_0x27b70a[_0x8bc8('0x40')]);_0x19d48a[_0x8bc8('0x43')]=_[_0x8bc8('0x42')](_0x27b70a['model'],qs[_0x8bc8('0x44')](_0x273069[_0x8bc8('0x40')]['fields']));_0x19d48a['attributes']=_0x19d48a['attributes'][_0x8bc8('0x45')]?_0x19d48a[_0x8bc8('0x43')]:_0x27b70a[_0x8bc8('0x3e')];if(!_0x273069[_0x8bc8('0x40')]['hasOwnProperty'](_0x8bc8('0x46'))){_0x19d48a['limit']=qs[_0x8bc8('0x2e')](_0x273069['query'][_0x8bc8('0x2e')]);_0x19d48a['offset']=qs[_0x8bc8('0x2c')](_0x273069[_0x8bc8('0x40')][_0x8bc8('0x2c')]);}_0x19d48a[_0x8bc8('0x47')]=qs['sort'](_0x273069[_0x8bc8('0x40')][_0x8bc8('0x48')]);_0x19d48a[_0x8bc8('0x49')]=qs[_0x8bc8('0x4a')](_[_0x8bc8('0x4b')](_0x273069[_0x8bc8('0x40')],_0x27b70a[_0x8bc8('0x4a')]),_0x4b0d9c);if(_0x273069[_0x8bc8('0x40')]['filter']){_0x19d48a[_0x8bc8('0x49')]=_['merge'](_0x19d48a[_0x8bc8('0x49')],{'$or':_[_0x8bc8('0x3f')](_0x4b0d9c,function(_0x5e31b3){if(_0x5e31b3[_0x8bc8('0x3c')]!==_0x8bc8('0x4c')){var _0x268d31={};_0x268d31[_0x5e31b3[_0x8bc8('0x37')]]={'$like':'%'+_0x273069['query']['filter']+'%'};return _0x268d31;}})});}_0x19d48a=_[_0x8bc8('0x4d')]({},_0x19d48a,_0x273069['options']);var _0x5b99b5={'where':_0x19d48a[_0x8bc8('0x49')]};return db[_0x8bc8('0x4e')]['count'](_0x5b99b5)['then'](function(_0xadcf9){_0x3ba218[_0x8bc8('0x2f')]=_0xadcf9;if(_0x273069[_0x8bc8('0x40')]['includeAll']){_0x19d48a[_0x8bc8('0x4f')]=[{'all':!![]}];}return db[_0x8bc8('0x4e')]['findAll'](_0x19d48a);})[_0x8bc8('0x1e')](function(_0x451eaf){_0x3ba218[_0x8bc8('0x50')]=_0x451eaf;return _0x3ba218;})['then'](respondWithFilteredResult(_0x5cbaef,_0x19d48a))[_0x8bc8('0x27')](handleError(_0x5cbaef,null));};exports['show']=function(_0x52b634,_0x53880c){var _0x3f2413={'raw':![],'where':{'id':_0x52b634['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3c61fa={};_0x3c61fa[_0x8bc8('0x3e')]=_['keys'](db[_0x8bc8('0x4e')][_0x8bc8('0x51')]);_0x3c61fa[_0x8bc8('0x40')]=_[_0x8bc8('0x41')](_0x52b634['query']);_0x3c61fa[_0x8bc8('0x4a')]=_[_0x8bc8('0x42')](_0x3c61fa[_0x8bc8('0x3e')],_0x3c61fa['query']);_0x3f2413[_0x8bc8('0x43')]=_[_0x8bc8('0x42')](_0x3c61fa[_0x8bc8('0x3e')],qs[_0x8bc8('0x44')](_0x52b634[_0x8bc8('0x40')]['fields']));_0x3f2413[_0x8bc8('0x43')]=_0x3f2413[_0x8bc8('0x43')][_0x8bc8('0x45')]?_0x3f2413['attributes']:_0x3c61fa['model'];if(_0x52b634[_0x8bc8('0x40')][_0x8bc8('0x52')]){_0x3f2413[_0x8bc8('0x4f')]=[{'all':!![]}];}_0x3f2413=_[_0x8bc8('0x4d')]({},_0x3f2413,_0x52b634[_0x8bc8('0x53')]);return db[_0x8bc8('0x4e')][_0x8bc8('0x54')](_0x3f2413)[_0x8bc8('0x1e')](handleEntityNotFound(_0x53880c,null))[_0x8bc8('0x1e')](respondWithResult(_0x53880c,null))['catch'](handleError(_0x53880c,null));};exports['create']=function(_0x1e7b11,_0x48b063){return db[_0x8bc8('0x4e')]['create'](_0x1e7b11[_0x8bc8('0x55')],{})[_0x8bc8('0x1e')](function(_0x3f93af){var _0x1dedf=_0x1e7b11[_0x8bc8('0x56')][_0x8bc8('0x57')]({'plain':!![]});if(!_0x1dedf)throw new Error(_0x8bc8('0x58'));if(_0x1dedf[_0x8bc8('0x59')]==='user'){var _0x5150b8=_0x3f93af[_0x8bc8('0x57')]({'plain':!![]});var _0x25b687=_0x8bc8('0x5a');return db['UserProfileSection'][_0x8bc8('0x54')]({'where':{'name':_0x25b687,'userProfileId':_0x1dedf[_0x8bc8('0x5b')]},'raw':!![]})[_0x8bc8('0x1e')](function(_0x203af7){if(_0x203af7&&_0x203af7[_0x8bc8('0x5c')]===0x0){return db[_0x8bc8('0x35')]['create']({'name':_0x5150b8[_0x8bc8('0x37')],'resourceId':_0x5150b8['id'],'type':_0x203af7['name'],'sectionId':_0x203af7['id']},{})[_0x8bc8('0x1e')](function(){return _0x3f93af;});}else{return _0x3f93af;}})[_0x8bc8('0x27')](function(_0x581877){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x581877);throw _0x581877;});}return _0x3f93af;})['then'](respondWithResult(_0x48b063,0xc9))[_0x8bc8('0x27')](handleError(_0x48b063,null));};exports[_0x8bc8('0x33')]=function(_0x5a1210,_0x5e2515){if(_0x5a1210[_0x8bc8('0x55')]['id']){delete _0x5a1210[_0x8bc8('0x55')]['id'];}return db[_0x8bc8('0x4e')][_0x8bc8('0x54')]({'where':{'id':_0x5a1210[_0x8bc8('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x8bc8('0x1e')](handleEntityNotFound(_0x5e2515,null))['then'](saveUpdates(_0x5a1210[_0x8bc8('0x55')],null))[_0x8bc8('0x1e')](respondWithResult(_0x5e2515,null))[_0x8bc8('0x27')](handleError(_0x5e2515,null));};exports[_0x8bc8('0x34')]=function(_0x1cd040,_0x4cb520){return db[_0x8bc8('0x4e')][_0x8bc8('0x54')]({'where':{'id':_0x1cd040[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x4cb520,null))[_0x8bc8('0x1e')](removeEntity(_0x4cb520,null))[_0x8bc8('0x27')](handleError(_0x4cb520,null));};exports['describe']=function(_0x13a113,_0x5222c9){return db[_0x8bc8('0x4e')][_0x8bc8('0x5e')]()['then'](respondWithResult(_0x5222c9,null))[_0x8bc8('0x27')](handleError(_0x5222c9,null));};exports[_0x8bc8('0x5f')]=function(_0x1710d1,_0x16f212,_0x2322fc){if(_0x1710d1[_0x8bc8('0x55')]['id']){delete _0x1710d1[_0x8bc8('0x55')]['id'];}return db[_0x8bc8('0x4e')]['find']({'where':{'id':_0x1710d1[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x16f212,null))[_0x8bc8('0x1e')](function(_0x1dfb3d){if(_0x1dfb3d){_0x1710d1[_0x8bc8('0x55')]['FaxAccountId']=_0x1dfb3d['id'];return db[_0x8bc8('0x60')]['create'](_0x1710d1['body']);}})[_0x8bc8('0x1e')](respondWithResult(_0x16f212,null))['catch'](handleError(_0x16f212,null));};exports[_0x8bc8('0x61')]=function(_0x5508c1,_0x5ed0fb,_0x3bba67){var _0x4272ae={'raw':![],'where':{}};var _0x8d9d5c={};var _0x442371={'count':0x0,'rows':[]};return db[_0x8bc8('0x4e')][_0x8bc8('0x62')]({'where':{'id':_0x5508c1[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x5ed0fb,null))[_0x8bc8('0x1e')](function(_0x58684a){if(_0x58684a){_0x8d9d5c[_0x8bc8('0x3e')]=_[_0x8bc8('0x41')](db[_0x8bc8('0x60')][_0x8bc8('0x51')]);_0x8d9d5c['query']=_['keys'](_0x5508c1['query']);_0x8d9d5c['filters']=_[_0x8bc8('0x42')](_0x8d9d5c['model'],_0x8d9d5c[_0x8bc8('0x40')]);_0x4272ae[_0x8bc8('0x43')]=_['intersection'](_0x8d9d5c[_0x8bc8('0x3e')],qs[_0x8bc8('0x44')](_0x5508c1[_0x8bc8('0x40')][_0x8bc8('0x44')]));_0x4272ae[_0x8bc8('0x43')]=_0x4272ae[_0x8bc8('0x43')][_0x8bc8('0x45')]?_0x4272ae[_0x8bc8('0x43')]:_0x8d9d5c[_0x8bc8('0x3e')];if(!_0x5508c1['query']['hasOwnProperty'](_0x8bc8('0x46'))){_0x4272ae[_0x8bc8('0x2e')]=qs['limit'](_0x5508c1[_0x8bc8('0x40')]['limit']);_0x4272ae[_0x8bc8('0x2c')]=qs[_0x8bc8('0x2c')](_0x5508c1[_0x8bc8('0x40')][_0x8bc8('0x2c')]);}_0x4272ae[_0x8bc8('0x47')]=qs['sort'](_0x5508c1[_0x8bc8('0x40')][_0x8bc8('0x48')]);_0x4272ae[_0x8bc8('0x49')]=qs[_0x8bc8('0x4a')](_[_0x8bc8('0x4b')](_0x5508c1[_0x8bc8('0x40')],_0x8d9d5c[_0x8bc8('0x4a')]));_0x4272ae['where'][_0x8bc8('0x63')]=_0x58684a['id'];if(_0x5508c1[_0x8bc8('0x40')]['filter']){_0x4272ae[_0x8bc8('0x49')]=_[_0x8bc8('0x4d')](_0x4272ae[_0x8bc8('0x49')],{'$or':_[_0x8bc8('0x3f')](_0x4272ae[_0x8bc8('0x43')],function(_0x3c1a34){var _0x262f7a={};_0x262f7a[_0x3c1a34]={'$like':'%'+_0x5508c1[_0x8bc8('0x40')][_0x8bc8('0x64')]+'%'};return _0x262f7a;})});}_0x4272ae=_[_0x8bc8('0x4d')]({},_0x4272ae,_0x5508c1['options']);return db['Disposition'][_0x8bc8('0x2f')]({'where':_0x4272ae['where']})['then'](function(_0x7a26bf){_0x442371[_0x8bc8('0x2f')]=_0x7a26bf;if(_0x5508c1[_0x8bc8('0x40')][_0x8bc8('0x52')]){_0x4272ae['include']=[{'all':!![]}];}return db['Disposition'][_0x8bc8('0x65')](_0x4272ae);})[_0x8bc8('0x1e')](function(_0x15df76){_0x442371['rows']=_0x15df76;return _0x442371;});}})[_0x8bc8('0x1e')](respondWithFilteredResult(_0x5ed0fb,_0x4272ae))['catch'](handleError(_0x5ed0fb,null));};exports[_0x8bc8('0x66')]=function(_0x4f0c19,_0x54ae0a,_0x4b677f){return db[_0x8bc8('0x4e')][_0x8bc8('0x54')]({'where':{'id':_0x4f0c19[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x54ae0a,null))[_0x8bc8('0x1e')](function(_0x43a984){if(_0x43a984){return _0x43a984[_0x8bc8('0x66')](_0x4f0c19[_0x8bc8('0x40')][_0x8bc8('0x67')]);}})['then'](respondWithStatusCode(_0x54ae0a,null))[_0x8bc8('0x27')](handleError(_0x54ae0a,null));};exports['addAnswer']=function(_0x488149,_0x57ec35,_0x14ca20){if(_0x488149[_0x8bc8('0x55')]['id']){delete _0x488149[_0x8bc8('0x55')]['id'];}return db['FaxAccount'][_0x8bc8('0x54')]({'where':{'id':_0x488149[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x57ec35,null))[_0x8bc8('0x1e')](function(_0x84d5a1){if(_0x84d5a1){_0x488149[_0x8bc8('0x55')][_0x8bc8('0x63')]=_0x84d5a1['id'];return db[_0x8bc8('0x68')][_0x8bc8('0x69')](_0x488149[_0x8bc8('0x55')]);}})[_0x8bc8('0x1e')](respondWithResult(_0x57ec35,null))[_0x8bc8('0x27')](handleError(_0x57ec35,null));};exports[_0x8bc8('0x6a')]=function(_0x2712d3,_0x1813c1,_0x5b1409){var _0xaf0d22={'raw':![],'where':{}};var _0x4839a0={};var _0x33cf06={'count':0x0,'rows':[]};return db[_0x8bc8('0x4e')]['findOne']({'where':{'id':_0x2712d3[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x1813c1,null))[_0x8bc8('0x1e')](function(_0xa5a46c){if(_0xa5a46c){_0x4839a0[_0x8bc8('0x3e')]=_[_0x8bc8('0x41')](db[_0x8bc8('0x68')][_0x8bc8('0x51')]);_0x4839a0[_0x8bc8('0x40')]=_[_0x8bc8('0x41')](_0x2712d3[_0x8bc8('0x40')]);_0x4839a0['filters']=_[_0x8bc8('0x42')](_0x4839a0['model'],_0x4839a0[_0x8bc8('0x40')]);_0xaf0d22['attributes']=_[_0x8bc8('0x42')](_0x4839a0['model'],qs[_0x8bc8('0x44')](_0x2712d3[_0x8bc8('0x40')][_0x8bc8('0x44')]));_0xaf0d22[_0x8bc8('0x43')]=_0xaf0d22[_0x8bc8('0x43')][_0x8bc8('0x45')]?_0xaf0d22['attributes']:_0x4839a0['model'];if(!_0x2712d3[_0x8bc8('0x40')]['hasOwnProperty']('nolimit')){_0xaf0d22['limit']=qs[_0x8bc8('0x2e')](_0x2712d3[_0x8bc8('0x40')][_0x8bc8('0x2e')]);_0xaf0d22[_0x8bc8('0x2c')]=qs['offset'](_0x2712d3[_0x8bc8('0x40')]['offset']);}_0xaf0d22[_0x8bc8('0x47')]=qs[_0x8bc8('0x48')](_0x2712d3[_0x8bc8('0x40')][_0x8bc8('0x48')]);_0xaf0d22['where']=qs[_0x8bc8('0x4a')](_[_0x8bc8('0x4b')](_0x2712d3['query'],_0x4839a0[_0x8bc8('0x4a')]));_0xaf0d22['where'][_0x8bc8('0x63')]=_0xa5a46c['id'];if(_0x2712d3['query'][_0x8bc8('0x64')]){_0xaf0d22['where']=_[_0x8bc8('0x4d')](_0xaf0d22[_0x8bc8('0x49')],{'$or':_[_0x8bc8('0x3f')](_0xaf0d22['attributes'],function(_0xf0429b){var _0x15ca2b={};_0x15ca2b[_0xf0429b]={'$like':'%'+_0x2712d3[_0x8bc8('0x40')]['filter']+'%'};return _0x15ca2b;})});}_0xaf0d22=_[_0x8bc8('0x4d')]({},_0xaf0d22,_0x2712d3[_0x8bc8('0x53')]);return db[_0x8bc8('0x68')][_0x8bc8('0x2f')]({'where':_0xaf0d22[_0x8bc8('0x49')]})['then'](function(_0x562504){_0x33cf06[_0x8bc8('0x2f')]=_0x562504;if(_0x2712d3[_0x8bc8('0x40')][_0x8bc8('0x52')]){_0xaf0d22[_0x8bc8('0x4f')]=[{'all':!![]}];}return db[_0x8bc8('0x68')][_0x8bc8('0x65')](_0xaf0d22);})['then'](function(_0x2cf8bd){_0x33cf06[_0x8bc8('0x50')]=_0x2cf8bd;return _0x33cf06;});}})[_0x8bc8('0x1e')](respondWithFilteredResult(_0x1813c1,_0xaf0d22))['catch'](handleError(_0x1813c1,null));};exports['removeAnswers']=function(_0x3d6905,_0x36641e,_0x31fba3){return db[_0x8bc8('0x4e')][_0x8bc8('0x54')]({'where':{'id':_0x3d6905[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x36641e,null))[_0x8bc8('0x1e')](function(_0x42e722){if(_0x42e722){return _0x42e722[_0x8bc8('0x6b')](_0x3d6905['query'][_0x8bc8('0x67')]);}})[_0x8bc8('0x1e')](respondWithStatusCode(_0x36641e,null))['catch'](handleError(_0x36641e,null));};exports[_0x8bc8('0x6c')]=function(_0x5b67d9,_0x29f1f6,_0x5b6914){return db['FaxInteraction'][_0x8bc8('0x54')]({'where':{'id':_0x5b67d9[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x29f1f6,null))[_0x8bc8('0x1e')](function(_0x33426c){if(_0x33426c){return _0x33426c[_0x8bc8('0x6c')](_0x5b67d9['body'][_0x8bc8('0x67')],_[_0x8bc8('0x6d')](_0x5b67d9['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x29f1f6,null))[_0x8bc8('0x27')](handleError(_0x29f1f6,null));};exports[_0x8bc8('0x6e')]=function(_0x4bfe01,_0x52d633,_0x59f6cb){var _0x1b16e4={'raw':![],'where':{}};var _0x2b1368={};var _0x12bb01={'count':0x0,'rows':[]};return db[_0x8bc8('0x4e')][_0x8bc8('0x62')]({'where':{'id':_0x4bfe01[_0x8bc8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x52d633,null))['then'](function(_0x1b905a){if(_0x1b905a){_0x2b1368[_0x8bc8('0x3e')]=_[_0x8bc8('0x41')](db[_0x8bc8('0x6f')][_0x8bc8('0x51')]);_0x2b1368[_0x8bc8('0x40')]=_[_0x8bc8('0x41')](_0x4bfe01['query']);_0x2b1368[_0x8bc8('0x4a')]=_[_0x8bc8('0x42')](_0x2b1368['model'],_0x2b1368[_0x8bc8('0x40')]);_0x1b16e4[_0x8bc8('0x43')]=_[_0x8bc8('0x42')](_0x2b1368[_0x8bc8('0x3e')],qs[_0x8bc8('0x44')](_0x4bfe01[_0x8bc8('0x40')][_0x8bc8('0x44')]));_0x1b16e4[_0x8bc8('0x43')]=_0x1b16e4[_0x8bc8('0x43')][_0x8bc8('0x45')]?_0x1b16e4[_0x8bc8('0x43')]:_0x2b1368['model'];if(!_0x4bfe01[_0x8bc8('0x40')][_0x8bc8('0x70')](_0x8bc8('0x46'))){_0x1b16e4['limit']=qs[_0x8bc8('0x2e')](_0x4bfe01[_0x8bc8('0x40')][_0x8bc8('0x2e')]);_0x1b16e4[_0x8bc8('0x2c')]=qs[_0x8bc8('0x2c')](_0x4bfe01[_0x8bc8('0x40')]['offset']);}_0x1b16e4[_0x8bc8('0x47')]=qs[_0x8bc8('0x48')](_0x4bfe01[_0x8bc8('0x40')][_0x8bc8('0x48')]);_0x1b16e4[_0x8bc8('0x49')]=qs['filters'](_[_0x8bc8('0x4b')](_0x4bfe01[_0x8bc8('0x40')],_0x2b1368['filters']));_0x1b16e4[_0x8bc8('0x49')]['FaxAccountId']=_0x1b905a['id'];if(_0x4bfe01[_0x8bc8('0x40')][_0x8bc8('0x64')]){_0x1b16e4[_0x8bc8('0x49')]=_['merge'](_0x1b16e4[_0x8bc8('0x49')],{'$or':_['map'](_0x1b16e4[_0x8bc8('0x43')],function(_0x39b5a7){var _0x21381f={};_0x21381f[_0x39b5a7]={'$like':'%'+_0x4bfe01[_0x8bc8('0x40')][_0x8bc8('0x64')]+'%'};return _0x21381f;})});}_0x1b16e4=_[_0x8bc8('0x4d')]({},_0x1b16e4,_0x4bfe01['options']);return db['FaxInteraction'][_0x8bc8('0x2f')]({'where':_0x1b16e4[_0x8bc8('0x49')]})[_0x8bc8('0x1e')](function(_0x27792f){_0x12bb01['count']=_0x27792f;if(_0x4bfe01[_0x8bc8('0x40')][_0x8bc8('0x52')]){_0x1b16e4[_0x8bc8('0x4f')]=[{'model':db[_0x8bc8('0x71')],'as':_0x8bc8('0x72'),'required':![]},{'model':db[_0x8bc8('0x73')],'as':'Owner','attributes':['name','fullname',_0x8bc8('0x74')],'required':![]},{'model':db[_0x8bc8('0x75')],'as':_0x8bc8('0x76'),'attributes':['id',_0x8bc8('0x37'),_0x8bc8('0x77')],'where':_0x4bfe01[_0x8bc8('0x40')][_0x8bc8('0x78')]?{'id':_0x4bfe01[_0x8bc8('0x40')][_0x8bc8('0x78')]}:undefined,'required':_0x4bfe01['query'][_0x8bc8('0x78')]?!![]:![]}];}return db[_0x8bc8('0x6f')]['findAll'](_0x1b16e4);})['then'](function(_0x2ad90e){_0x12bb01[_0x8bc8('0x50')]=_0x2ad90e;return _0x12bb01;});}})['then'](respondWithFilteredResult(_0x52d633,_0x1b16e4))['catch'](handleError(_0x52d633,null));};exports[_0x8bc8('0x79')]=function(_0x1bb67b,_0x1b64c2){var _0x10cc4d=_0x1bb67b[_0x8bc8('0x5d')]['id'];var _0x5b327d=_0x1bb67b[_0x8bc8('0x55')];var _0x3f018d=0xc8;var _0x4b1027=null;return db['sequelize'][_0x8bc8('0x7a')]({'isolationLevel':db[_0x8bc8('0x7b')]['Transaction'][_0x8bc8('0x7c')][_0x8bc8('0x7d')]},function(_0x45a4e2){return db[_0x8bc8('0x4e')][_0x8bc8('0x62')]({'where':{'id':_0x10cc4d},'transaction':_0x45a4e2})[_0x8bc8('0x1e')](function(_0x90f3d4){if(_0x90f3d4){return db[_0x8bc8('0x7e')][_0x8bc8('0x34')]({'where':{'FaxAccountId':_0x10cc4d},'transaction':_0x45a4e2})[_0x8bc8('0x1e')](function(){var _0x4bce90=_['map'](_0x5b327d,function(_0x245d74){_0x245d74[_0x8bc8('0x63')]=_0x10cc4d;return _0x245d74;});return db[_0x8bc8('0x7e')][_0x8bc8('0x7f')](_0x4bce90,{'transaction':_0x45a4e2});});}else{_0x3f018d=0x194;_0x4b1027=[];}});})[_0x8bc8('0x1e')](function(){if(_0x3f018d!==0x194){return db['FaxApplication'][_0x8bc8('0x80')]({'where':{'FaxAccountId':_0x10cc4d},'order':_0x8bc8('0x81')})['then'](function(_0x1a2684){_0x4b1027=_0x1a2684;});}})[_0x8bc8('0x27')](function(_0x50a3a8){_0x3f018d=0x1f4;logger[_0x8bc8('0x23')](_0x50a3a8[_0x8bc8('0x36')]);if(_0x50a3a8[_0x8bc8('0x37')]){delete _0x50a3a8['name'];}_0x4b1027=_0x50a3a8;})['finally'](function(){if(_0x4b1027===null){_0x1b64c2[_0x8bc8('0x28')](_0x3f018d);}else{if(_0x3f018d===0x1f4){_0x1b64c2['status'](_0x3f018d)[_0x8bc8('0x38')](_0x4b1027);}else{_0x1b64c2[_0x8bc8('0x29')](_0x3f018d)[_0x8bc8('0x2b')](_0x4b1027);}}});};exports[_0x8bc8('0x82')]=function(_0x306b92,_0x15c7da,_0x21ed8b){var _0x25099a={};var _0x2704f6={};var _0x6f23b9;var _0x1c6291;return db['FaxAccount']['findOne']({'where':{'id':_0x306b92[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x15c7da,null))[_0x8bc8('0x1e')](function(_0x5c9251){if(_0x5c9251){_0x6f23b9=_0x5c9251;_0x2704f6[_0x8bc8('0x3e')]=_['keys'](db['FaxApplication'][_0x8bc8('0x51')]);_0x2704f6[_0x8bc8('0x40')]=_[_0x8bc8('0x41')](_0x306b92[_0x8bc8('0x40')]);_0x2704f6['filters']=_[_0x8bc8('0x42')](_0x2704f6[_0x8bc8('0x3e')],_0x2704f6[_0x8bc8('0x40')]);_0x25099a[_0x8bc8('0x43')]=_[_0x8bc8('0x42')](_0x2704f6[_0x8bc8('0x3e')],qs[_0x8bc8('0x44')](_0x306b92[_0x8bc8('0x40')][_0x8bc8('0x44')]));_0x25099a['attributes']=_0x25099a[_0x8bc8('0x43')][_0x8bc8('0x45')]?_0x25099a[_0x8bc8('0x43')]:_0x2704f6[_0x8bc8('0x3e')];_0x25099a['order']=qs['sort'](_0x306b92[_0x8bc8('0x40')]['sort']);_0x25099a[_0x8bc8('0x49')]=qs[_0x8bc8('0x4a')](_[_0x8bc8('0x4b')](_0x306b92[_0x8bc8('0x40')],_0x2704f6[_0x8bc8('0x4a')]));if(_0x306b92[_0x8bc8('0x40')]['filter']){_0x25099a[_0x8bc8('0x49')]=_[_0x8bc8('0x4d')](_0x25099a['where'],{'$or':_[_0x8bc8('0x3f')](_0x25099a[_0x8bc8('0x43')],function(_0x5179f2){var _0x35ca2d={};_0x35ca2d[_0x5179f2]={'$like':'%'+_0x306b92[_0x8bc8('0x40')][_0x8bc8('0x64')]+'%'};return _0x35ca2d;})});}_0x25099a=_[_0x8bc8('0x4d')]({},_0x25099a,_0x306b92['options']);return _0x6f23b9['getApplications'](_0x25099a);}})[_0x8bc8('0x1e')](function(_0x416d42){if(_0x416d42){_0x1c6291=_0x416d42[_0x8bc8('0x45')];if(!_0x306b92['query'][_0x8bc8('0x70')](_0x8bc8('0x46'))){_0x25099a[_0x8bc8('0x2e')]=qs[_0x8bc8('0x2e')](_0x306b92['query'][_0x8bc8('0x2e')]);_0x25099a['offset']=qs[_0x8bc8('0x2c')](_0x306b92[_0x8bc8('0x40')][_0x8bc8('0x2c')]);}return _0x6f23b9['getApplications'](_0x25099a);}})[_0x8bc8('0x1e')](function(_0x2d0849){if(_0x2d0849){return _0x2d0849?{'count':_0x1c6291,'rows':_0x2d0849}:null;}})[_0x8bc8('0x1e')](respondWithResult(_0x15c7da,null))[_0x8bc8('0x27')](handleError(_0x15c7da,null));};function Extension(_0x3ca640,_0x578151,_0x4eea89,_0x8036e9){this['context']='from-voip-provider';this['exten']=_0x3ca640[_0x8bc8('0x83')];this[_0x8bc8('0x84')]=_0x8036e9;this[_0x8bc8('0x3c')]=_0x8bc8('0x85');this['description']=_0x8bc8('0x86');this[_0x8bc8('0x63')]=_0x3ca640['id'];this[_0x8bc8('0x81')]=_0x578151;this[_0x8bc8('0x87')]=_0x4eea89;}function createExtensionsReciveFax(_0x109510){var _0x2a795b=0x1;var _0x5e4c2f=[];_0x5e4c2f['push'](new Extension(_0x109510,_0x2a795b,'',_0x8bc8('0x88')));_0x2a795b+=0x1;_0x5e4c2f[_0x8bc8('0x89')](new Extension(_0x109510,_0x2a795b,_0x8bc8('0x8a'),_0x8bc8('0x8b')));_0x2a795b+=0x1;for(var _0x4a65f9 in _0x109510){if(_0x109510[_0x8bc8('0x70')](_0x4a65f9)&&(_0x4a65f9===_0x8bc8('0x8c')||_0x4a65f9==='localstationid'||_0x4a65f9===_0x8bc8('0x8d')||_0x4a65f9==='faxdetect'||_0x4a65f9===_0x8bc8('0x8e')||_0x4a65f9===_0x8bc8('0x8f')||_0x4a65f9===_0x8bc8('0x90')||_0x4a65f9==='modem'||_0x4a65f9===_0x8bc8('0x91'))){_0x5e4c2f[_0x8bc8('0x89')](new Extension(_0x109510,_0x2a795b,_0x8bc8('0x92')+_0x4a65f9+')='+_0x109510[_0x4a65f9],'Set'));_0x2a795b+=0x1;}}_0x5e4c2f[_0x8bc8('0x89')](new Extension(_0x109510,_0x2a795b,'6',_0x8bc8('0x93')));_0x2a795b+=0x1;_0x5e4c2f[_0x8bc8('0x89')](new Extension(_0x109510,_0x2a795b,_0x8bc8('0x94'),_0x8bc8('0x95')));_0x2a795b=0x0;return _0x5e4c2f;}exports[_0x8bc8('0x96')]=function(_0xd39c42,_0x18fc9d,_0x107afd){var _0x15ca44;return db[_0x8bc8('0x7b')][_0x8bc8('0x7a')](function(_0x5bf4f4){return db['FaxAccount'][_0x8bc8('0x69')](_0xd39c42[_0x8bc8('0x55')],{'transaction':_0x5bf4f4})[_0x8bc8('0x1e')](function(_0xe2135d){_0x15ca44=_0xe2135d[_0x8bc8('0x57')]({'plain':!![]});return db[_0x8bc8('0x97')][_0x8bc8('0x7f')](createExtensionsReciveFax(_0x15ca44),{'transaction':_0x5bf4f4});});})[_0x8bc8('0x1e')](function(){return _0x15ca44;})['then'](respondWithResult(_0x18fc9d,null))['catch'](handleError(_0x18fc9d,null));};exports[_0x8bc8('0x98')]=function(_0x45a4be,_0x23fd56,_0x56d56f){var _0x3f31f1;return db[_0x8bc8('0x7b')]['transaction'](function(_0x10e258){return db[_0x8bc8('0x4e')][_0x8bc8('0x33')](_0x45a4be[_0x8bc8('0x55')],{'where':{'id':_0x45a4be['body']['id']},'transaction':_0x10e258})[_0x8bc8('0x1e')](function(_0x1ede7d){return db[_0x8bc8('0x97')][_0x8bc8('0x34')]({'where':{'FaxAccountId':_0x45a4be[_0x8bc8('0x55')]['id']},'transaction':_0x10e258})[_0x8bc8('0x1e')](function(_0x29626d){return db['VoiceExtension'][_0x8bc8('0x7f')](createExtensionsReciveFax(_[_0x8bc8('0x6d')](_0x45a4be[_0x8bc8('0x55')],[_0x8bc8('0x99'),_0x8bc8('0x3d'),_0x8bc8('0x9a'),_0x8bc8('0x9b'),'TrunkId',_0x8bc8('0x9c')])),{'transaction':_0x10e258});});});})[_0x8bc8('0x1e')](function(){return db[_0x8bc8('0x4e')]['findById'](_0x45a4be[_0x8bc8('0x55')]['id']);})['then'](respondWithResult(_0x23fd56,null))[_0x8bc8('0x27')](handleError(_0x23fd56,null));};exports[_0x8bc8('0x9d')]=function(_0x5aab4b,_0x389b44,_0x5319a1){var _0x1fc579={'raw':!![],'where':{}};var _0x2d6c38={};var _0x232b74={'count':0x0,'rows':[]};return db[_0x8bc8('0x4e')][_0x8bc8('0x62')]({'where':{'id':_0x5aab4b[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x389b44,null))['then'](function(_0x88e6ce){if(_0x88e6ce){_0x2d6c38[_0x8bc8('0x3e')]=_[_0x8bc8('0x41')](db[_0x8bc8('0x9e')][_0x8bc8('0x51')]);_0x2d6c38[_0x8bc8('0x40')]=_[_0x8bc8('0x41')](_0x5aab4b[_0x8bc8('0x40')]);_0x2d6c38['filters']=_[_0x8bc8('0x42')](_0x2d6c38['model'],_0x2d6c38[_0x8bc8('0x40')]);_0x1fc579[_0x8bc8('0x43')]=_[_0x8bc8('0x42')](_0x2d6c38[_0x8bc8('0x3e')],qs[_0x8bc8('0x44')](_0x5aab4b[_0x8bc8('0x40')][_0x8bc8('0x44')]));_0x1fc579['attributes']=_0x1fc579[_0x8bc8('0x43')][_0x8bc8('0x45')]?_0x1fc579[_0x8bc8('0x43')]:_0x2d6c38[_0x8bc8('0x3e')];if(!_0x5aab4b[_0x8bc8('0x40')][_0x8bc8('0x70')](_0x8bc8('0x46'))){_0x1fc579[_0x8bc8('0x2e')]=qs[_0x8bc8('0x2e')](_0x5aab4b[_0x8bc8('0x40')][_0x8bc8('0x2e')]);_0x1fc579[_0x8bc8('0x2c')]=qs['offset'](_0x5aab4b[_0x8bc8('0x40')]['offset']);}_0x1fc579[_0x8bc8('0x47')]=qs[_0x8bc8('0x48')](_0x5aab4b[_0x8bc8('0x40')]['sort']);_0x1fc579[_0x8bc8('0x49')]=qs[_0x8bc8('0x4a')](_[_0x8bc8('0x4b')](_0x5aab4b[_0x8bc8('0x40')],_0x2d6c38[_0x8bc8('0x4a')]));_0x1fc579[_0x8bc8('0x49')][_0x8bc8('0x63')]=_0x88e6ce['id'];if(_0x5aab4b[_0x8bc8('0x40')][_0x8bc8('0x64')]){_0x1fc579['where']=_[_0x8bc8('0x4d')](_0x1fc579['where'],{'$or':_[_0x8bc8('0x3f')](_0x1fc579[_0x8bc8('0x43')],function(_0x3779b4){var _0x52aa5c={};_0x52aa5c[_0x3779b4]={'$like':'%'+_0x5aab4b['query'][_0x8bc8('0x64')]+'%'};return _0x52aa5c;})});}if(_0x5aab4b[_0x8bc8('0x40')][_0x8bc8('0x9f')]){var _0x509d69=_0x5aab4b[_0x8bc8('0x40')][_0x8bc8('0x9f')][_0x8bc8('0xa0')](',');var _0x130fa6={};_0x130fa6[_0x509d69[0x0]]={'$gte':moment(_0x509d69[0x1])[_0x8bc8('0xa1')](_0x8bc8('0xa2'))};_0x1fc579['where']=_[_0x8bc8('0x4d')](_0x1fc579[_0x8bc8('0x49')],_0x130fa6);}_0x1fc579=_['merge']({},_0x1fc579,_0x5aab4b[_0x8bc8('0x53')]);return db[_0x8bc8('0x9e')][_0x8bc8('0x2f')]({'where':_0x1fc579['where']})['then'](function(_0x8593df){_0x232b74['count']=_0x8593df;if(_0x5aab4b[_0x8bc8('0x40')][_0x8bc8('0x52')]){_0x1fc579['include']=[{'all':!![]}];}return db[_0x8bc8('0x9e')][_0x8bc8('0x65')](_0x1fc579);})[_0x8bc8('0x1e')](function(_0x51e5df){_0x232b74['rows']=_0x51e5df;return _0x232b74;});}})['then'](respondWithFilteredResult(_0x389b44,_0x1fc579))[_0x8bc8('0x27')](handleError(_0x389b44,null));};exports['send']=function(_0x4cbb5f,_0x3e7188,_0x280d9a){var _0x23412f,_0x38c019={},_0x1713a9;if(_0x4cbb5f[_0x8bc8('0x55')]['to']){_0x1713a9=_0x4cbb5f[_0x8bc8('0x55')]['to'][0x0];}return db[_0x8bc8('0x4e')][_0x8bc8('0x54')]({'where':{'id':_0x4cbb5f[_0x8bc8('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x8bc8('0xa3'),'include':[{'model':db[_0x8bc8('0x71')],'as':_0x8bc8('0xa4'),'where':{'fax':_0x1713a9},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x8bc8('0x1e')](handleEntityNotFound(_0x3e7188,null))[_0x8bc8('0x1e')](function(_0xac8183){_0x23412f=_0xac8183;if(_0x4cbb5f[_0x8bc8('0x55')][_0x8bc8('0xa5')]&&_0x4cbb5f['body'][_0x8bc8('0xa5')]['length']){for(var _0x5362f1=0x0;_0x5362f1<_0x4cbb5f[_0x8bc8('0x55')][_0x8bc8('0xa5')]['length'];_0x5362f1+=0x1){_0x4cbb5f['body']['attachments'][_0x5362f1]={'filename':_0x4cbb5f[_0x8bc8('0x55')][_0x8bc8('0xa5')][_0x5362f1]['name'],'id':_0x4cbb5f['body']['attachments'][_0x5362f1]['id'],'path':path['join'](config[_0x8bc8('0xa6')],'server/files/attachments',_0x4cbb5f[_0x8bc8('0x55')]['attachments'][_0x5362f1][_0x8bc8('0xa7')])};}}return respondWithRpcPromise('CheckAfterSend',_0x8bc8('0xa8'),{'FaxAccountId':_['isNil'](_0x4cbb5f['params']['id'])?undefined:_0x4cbb5f[_0x8bc8('0x5d')]['id'],'path':_[_0x8bc8('0xa9')](_0x4cbb5f['body'][_0x8bc8('0xa5')][0x0][_0x8bc8('0x8')])?undefined:_0x4cbb5f[_0x8bc8('0x55')]['attachments'][0x0][_0x8bc8('0x8')],'fax':_[_0x8bc8('0xa9')](_0x4cbb5f['body']['to'][0x0])?undefined:_0x4cbb5f['body']['to'][0x0]},client9002);})[_0x8bc8('0x1e')](function(){if(_0x23412f){if(_[_0x8bc8('0xa9')](_0x4cbb5f[_0x8bc8('0x55')]['from'])){_0x4cbb5f[_0x8bc8('0x55')][_0x8bc8('0xaa')]=util['format'](_0x8bc8('0xab'),_0x23412f[_0x8bc8('0x37')],_0x23412f['fax']);}if(_0x23412f['List']){if(_0x23412f[_0x8bc8('0xa3')][_0x8bc8('0xa4')][_0x8bc8('0x45')]){return _0x23412f[_0x8bc8('0xa3')][_0x8bc8('0xa4')][0x0];}else{return db['CmContact'][_0x8bc8('0x69')](_[_0x8bc8('0x18')](_0x4cbb5f[_0x8bc8('0x55')],{'firstName':_0x4cbb5f['body']['to'][0x0],'phone':_0x4cbb5f[_0x8bc8('0x55')]['to'][0x0],'fax':_0x4cbb5f[_0x8bc8('0x55')]['to'][0x0],'ListId':_0x23412f['ListId']}));}}else{throw new Error(_0x8bc8('0xac'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x8bc8('0x1e')](function(_0xab3748){if(_0xab3748){return db[_0x8bc8('0x6f')]['find']({'where':{'ContactId':_0xab3748['id'],'closed':![],'FaxAccountId':_0x23412f['id']}})[_0x8bc8('0x1e')](function(_0x351402){if(_0x351402){return[_0x351402,![]];}return db[_0x8bc8('0x6f')][_0x8bc8('0x69')]({'UserId':_0x4cbb5f[_0x8bc8('0x56')]['id'],'ContactId':_0xab3748['id'],'FaxAccountId':_0x23412f['id'],'fax':_0x4cbb5f[_0x8bc8('0x55')]['to'][0x0],'firstMsgDirection':_0x8bc8('0xad'),'Messages':[_[_0x8bc8('0x4d')](_0x4cbb5f[_0x8bc8('0x55')],{'read':![],'body':_0x4cbb5f[_0x8bc8('0x55')][_0x8bc8('0xa5')][0x0]['filename'],'FaxAccountId':_0x23412f['id'],'UserId':_0x4cbb5f[_0x8bc8('0x56')]['id'],'ContactId':_0xab3748['id'],'AttachmentId':_0x4cbb5f[_0x8bc8('0x55')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x8bc8('0x9e')],'as':_0x8bc8('0xae')}]})[_0x8bc8('0x1e')](function(_0x28b1b1){return[_0x28b1b1,!![]];});});}else{throw new Error(_0x8bc8('0xaf'));}})[_0x8bc8('0xb0')](function(_0x53eb70,_0x33a7fb){if(_0x33a7fb){return _0x53eb70;}return db[_0x8bc8('0x9e')]['create']({'direction':_0x8bc8('0xad'),'read':![],'body':_0x4cbb5f['body']['attachments'][0x0][_0x8bc8('0xb1')],'FaxAccountId':_0x23412f['id'],'FaxInteractionId':_0x53eb70['id'],'UserId':_0x4cbb5f[_0x8bc8('0x56')]['id'],'ContactId':_0x53eb70[_0x8bc8('0xb2')],'AttachmentId':_0x4cbb5f[_0x8bc8('0x55')][_0x8bc8('0xa5')][0x0]['id']})['then'](function(_0x3c5f76){_0x53eb70[_0x8bc8('0xb3')][_0x8bc8('0xae')]=[];_0x53eb70[_0x8bc8('0xb3')][_0x8bc8('0xae')]['push'](_0x3c5f76['dataValues']);return _0x53eb70;});})['then'](function(_0x56855d){respondWithRpcPromise(_0x8bc8('0xb4'),_0x8bc8('0xb4'),{'FaxAccountId':_[_0x8bc8('0xa9')](_0x4cbb5f[_0x8bc8('0x5d')]['id'])?undefined:_0x4cbb5f[_0x8bc8('0x5d')]['id'],'path':_['isNil'](_0x4cbb5f[_0x8bc8('0x55')][_0x8bc8('0xa5')][0x0][_0x8bc8('0x8')])?undefined:_0x4cbb5f[_0x8bc8('0x55')][_0x8bc8('0xa5')][0x0][_0x8bc8('0x8')],'fax':_[_0x8bc8('0xa9')](_0x4cbb5f['body']['to'][0x0])?undefined:_0x4cbb5f[_0x8bc8('0x55')]['to'][0x0],'AttachmentId':_0x4cbb5f[_0x8bc8('0x55')][_0x8bc8('0xa5')][0x0]['id']},client9002)[_0x8bc8('0x1e')](function(_0x209ae5){logger[_0x8bc8('0x1f')](_0x8bc8('0xb5'),_0x209ae5);})['catch'](function(_0x37eac2){logger[_0x8bc8('0x1f')](_0x8bc8('0xb5'),_0x37eac2);});return _0x56855d;})[_0x8bc8('0x1e')](respondWithResult(_0x3e7188,null))[_0x8bc8('0x27')](handleError(_0x3e7188,null));};exports[_0x8bc8('0xb6')]=function(_0x1525ff,_0x2b6005,_0x482d21){return db[_0x8bc8('0x4e')][_0x8bc8('0x54')]({'where':{'id':_0x1525ff[_0x8bc8('0x5d')]['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x2b6005,null))[_0x8bc8('0x1e')](function(_0x5cb4b4){if(_0x5cb4b4){return _0x5cb4b4[_0x8bc8('0xb6')](_0x1525ff[_0x8bc8('0x55')]['ids'],_[_0x8bc8('0x6d')](_0x1525ff[_0x8bc8('0x55')],[_0x8bc8('0x67'),'id'])||{})[_0x8bc8('0xb0')](function(_0x4272d3){for(var _0x12f7cd=0x0;_0x12f7cd<_0x1525ff[_0x8bc8('0x55')][_0x8bc8('0x67')]['length'];_0x12f7cd+=0x1){socket[_0x8bc8('0xb7')](_0x8bc8('0xb8'),{'UserId':Number(_0x1525ff[_0x8bc8('0x55')][_0x8bc8('0x67')][_0x12f7cd]),'FaxAccountId':Number(_0x1525ff[_0x8bc8('0x5d')]['id'])});}return _0x4272d3;});}})[_0x8bc8('0x1e')](respondWithResult(_0x2b6005,null))['catch'](handleError(_0x2b6005,null));};exports[_0x8bc8('0xb9')]=function(_0x5224da,_0x475a88,_0x2527a1){return db[_0x8bc8('0x4e')]['find']({'where':{'id':_0x5224da['params']['id']}})['then'](handleEntityNotFound(_0x475a88,null))[_0x8bc8('0x1e')](function(_0x31f10f){if(_0x31f10f){return _0x31f10f[_0x8bc8('0xb9')](_0x5224da[_0x8bc8('0x40')][_0x8bc8('0x67')])[_0x8bc8('0x1e')](function(){if(_[_0x8bc8('0xba')](_0x5224da[_0x8bc8('0x40')][_0x8bc8('0x67')])){for(var _0x471caf=0x0;_0x471caf<_0x5224da['query'][_0x8bc8('0x67')]['length'];_0x471caf+=0x1){socket[_0x8bc8('0xb7')](_0x8bc8('0xbb'),{'UserId':Number(_0x5224da['query']['ids'][_0x471caf]),'FaxAccountId':Number(_0x5224da[_0x8bc8('0x5d')]['id'])});}}else{socket[_0x8bc8('0xb7')](_0x8bc8('0xbb'),{'UserId':Number(_0x5224da[_0x8bc8('0x40')][_0x8bc8('0x67')]),'FaxAccountId':Number(_0x5224da[_0x8bc8('0x5d')]['id'])});}});}})[_0x8bc8('0x1e')](respondWithStatusCode(_0x475a88,null))[_0x8bc8('0x27')](handleError(_0x475a88,null));};exports[_0x8bc8('0xbc')]=function(_0x2845e8,_0x38ba7f,_0x3bd7cc){var _0xa09ead={};var _0x197151={};var _0x274872;var _0xaf6058;return db[_0x8bc8('0x4e')][_0x8bc8('0x62')]({'where':{'id':_0x2845e8['params']['id']}})[_0x8bc8('0x1e')](handleEntityNotFound(_0x38ba7f,null))[_0x8bc8('0x1e')](function(_0x205c93){if(_0x205c93){_0x274872=_0x205c93;_0x197151['model']=_['keys'](db[_0x8bc8('0x73')]['rawAttributes']);_0x197151[_0x8bc8('0x40')]=_['keys'](_0x2845e8[_0x8bc8('0x40')]);_0x197151['filters']=_[_0x8bc8('0x42')](_0x197151[_0x8bc8('0x3e')],_0x197151[_0x8bc8('0x40')]);_0xa09ead[_0x8bc8('0x43')]=_[_0x8bc8('0x42')](_0x197151[_0x8bc8('0x3e')],qs[_0x8bc8('0x44')](_0x2845e8['query'][_0x8bc8('0x44')]));_0xa09ead[_0x8bc8('0x43')]=_0xa09ead[_0x8bc8('0x43')]['length']?_0xa09ead[_0x8bc8('0x43')]:_0x197151[_0x8bc8('0x3e')];_0xa09ead[_0x8bc8('0x47')]=qs[_0x8bc8('0x48')](_0x2845e8[_0x8bc8('0x40')][_0x8bc8('0x48')]);_0xa09ead[_0x8bc8('0x49')]=qs[_0x8bc8('0x4a')](_[_0x8bc8('0x4b')](_0x2845e8[_0x8bc8('0x40')],_0x197151[_0x8bc8('0x4a')]));if(_0x2845e8['query']['filter']){_0xa09ead['where']=_['merge'](_0xa09ead['where'],{'$or':_[_0x8bc8('0x3f')](_0xa09ead[_0x8bc8('0x43')],function(_0x3242ba){var _0x500bd1={};_0x500bd1[_0x3242ba]={'$like':'%'+_0x2845e8['query'][_0x8bc8('0x64')]+'%'};return _0x500bd1;})});}_0xa09ead=_[_0x8bc8('0x4d')]({},_0xa09ead,_0x2845e8[_0x8bc8('0x53')]);return _0x274872[_0x8bc8('0xbc')](_0xa09ead);}})[_0x8bc8('0x1e')](function(_0x143ef1){if(_0x143ef1){_0xaf6058=_0x143ef1['length'];if(!_0x2845e8[_0x8bc8('0x40')][_0x8bc8('0x70')](_0x8bc8('0x46'))){_0xa09ead[_0x8bc8('0x2e')]=qs['limit'](_0x2845e8['query']['limit']);_0xa09ead[_0x8bc8('0x2c')]=qs[_0x8bc8('0x2c')](_0x2845e8[_0x8bc8('0x40')][_0x8bc8('0x2c')]);}return _0x274872[_0x8bc8('0xbc')](_0xa09ead);}})[_0x8bc8('0x1e')](function(_0x503342){if(_0x503342){return _0x503342?{'count':_0xaf6058,'rows':_0x503342}:null;}})[_0x8bc8('0x1e')](respondWithResult(_0x38ba7f,null))[_0x8bc8('0x27')](handleError(_0x38ba7f,null));}; \ No newline at end of file +var _0xbefe=['system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','maxrate','minrate','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','VoiceExtension','updateAccountApplications','omit','tech','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','root','basename','CheckAfterSend','isNil','path','\x22%s\x22\x20<%s>','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','client','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','FaxAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','nolimit','findAll','removeDispositions','addAnswer','CannedAnswer','filter','removeAnswers','addInteraction','FaxInteraction','ids','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','json','getApplications','context','from-voip-provider','exten'];(function(_0x222c33,_0x53d29a){var _0x75b81b=function(_0x5206b3){while(--_0x5206b3){_0x222c33['push'](_0x222c33['shift']());}};_0x75b81b(++_0x53d29a);}(_0xbefe,0xfc));var _0xebef=function(_0x32825e,_0x5981c1){_0x32825e=_0x32825e-0x0;var _0x119578=_0xbefe[_0x32825e];return _0x119578;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebef('0x0'));var jsonpatch=require(_0xebef('0x1'));var rp=require(_0xebef('0x2'));var moment=require(_0xebef('0x3'));var BPromise=require(_0xebef('0x4'));var Mustache=require('mustache');var util=require(_0xebef('0x5'));var path=require('path');var sox=require(_0xebef('0x6'));var csv=require(_0xebef('0x7'));var ejs=require(_0xebef('0x8'));var fs=require('fs');var fs_extra=require(_0xebef('0x9'));var _=require(_0xebef('0xa'));var squel=require(_0xebef('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xebef('0xc'));var toCsv=require(_0xebef('0x7'));var querystring=require(_0xebef('0xd'));var Papa=require(_0xebef('0xe'));var Redis=require(_0xebef('0xf'));var authService=require(_0xebef('0x10'));var qs=require(_0xebef('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xebef('0x12'))(_0xebef('0x13'));var utils=require(_0xebef('0x14'));var config=require(_0xebef('0x15'));var licenseUtil=require(_0xebef('0x16'));var db=require(_0xebef('0x17'))['db'];config[_0xebef('0x18')]=_[_0xebef('0x19')](config[_0xebef('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xebef('0x1a'))(new Redis(config[_0xebef('0x18')]));require(_0xebef('0x1b'))[_0xebef('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xebef('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ae812,_0xce7ecd,_0x26c1f0,_0x452654){return new BPromise(function(_0xfbddf7,_0x4e85c1){var _0x50d24d=_0x452654||client;return _0x50d24d['request'](_0x2ae812,_0x26c1f0)[_0xebef('0x1e')](function(_0xd3352){logger['info']('FaxAccount,\x20%s,\x20%s',_0xce7ecd,_0xebef('0x1f'));logger[_0xebef('0x20')](_0xebef('0x21'),_0xce7ecd,_0xebef('0x1f'),JSON['stringify'](_0xd3352));if(_0xd3352[_0xebef('0x22')]){if(_0xd3352[_0xebef('0x22')][_0xebef('0x23')]===0x1f4){logger[_0xebef('0x22')](_0xebef('0x24'),_0xce7ecd,_0xd3352['error'][_0xebef('0x25')]);return _0x4e85c1(_0xd3352['error'][_0xebef('0x25')]);}logger[_0xebef('0x22')](_0xebef('0x24'),_0xce7ecd,_0xd3352[_0xebef('0x22')][_0xebef('0x25')]);return _0xfbddf7(_0xd3352[_0xebef('0x22')]['message']);}else{logger[_0xebef('0x26')](_0xebef('0x24'),_0xce7ecd,_0xebef('0x1f'));_0xfbddf7(_0xd3352[_0xebef('0x27')][_0xebef('0x25')]);}})[_0xebef('0x28')](function(_0x4e9dfb){logger[_0xebef('0x22')](_0xebef('0x24'),_0xce7ecd,_0x4e9dfb);_0x4e85c1(_0x4e9dfb);});});}function respondWithStatusCode(_0x3a6097,_0x2e381e){_0x2e381e=_0x2e381e||0xcc;return function(_0x1e0fe4){if(_0x1e0fe4){return _0x3a6097[_0xebef('0x29')](_0x2e381e);}return _0x3a6097[_0xebef('0x2a')](_0x2e381e)[_0xebef('0x2b')]();};}function respondWithResult(_0x239f82,_0x3fb725){_0x3fb725=_0x3fb725||0xc8;return function(_0x1dfbe9){if(_0x1dfbe9){return _0x239f82[_0xebef('0x2a')](_0x3fb725)['json'](_0x1dfbe9);}};}function respondWithFilteredResult(_0x28e4c2,_0x252940){return function(_0x1c8da3){if(_0x1c8da3){var _0x43b749=typeof _0x252940['offset']===_0xebef('0x2c')&&typeof _0x252940[_0xebef('0x2d')]==='undefined';var _0x2ebbeb=_0x1c8da3[_0xebef('0x2e')];var _0x484cbc=_0x43b749?0x0:_0x252940[_0xebef('0x2f')];var _0x22cd30=_0x43b749?_0x1c8da3['count']:_0x252940[_0xebef('0x2f')]+_0x252940[_0xebef('0x2d')];var _0x208cb9;if(_0x22cd30>=_0x2ebbeb){_0x22cd30=_0x2ebbeb;_0x208cb9=0xc8;}else{_0x208cb9=0xce;}_0x28e4c2[_0xebef('0x2a')](_0x208cb9);return _0x28e4c2[_0xebef('0x30')](_0xebef('0x31'),_0x484cbc+'-'+_0x22cd30+'/'+_0x2ebbeb)['json'](_0x1c8da3);}return null;};}function patchUpdates(_0x2cb895){return function(_0xef7a28){try{jsonpatch['apply'](_0xef7a28,_0x2cb895,!![]);}catch(_0x3a4126){return BPromise[_0xebef('0x32')](_0x3a4126);}return _0xef7a28[_0xebef('0x33')]();};}function saveUpdates(_0xb333cd,_0x4b335e){return function(_0x57be69){if(_0x57be69){return _0x57be69[_0xebef('0x34')](_0xb333cd)['then'](function(_0x2aa7f9){return _0x2aa7f9;});}return null;};}function removeEntity(_0x3d3b76,_0x1de97){return function(_0x3992cc){if(_0x3992cc){return _0x3992cc['destroy']()[_0xebef('0x1e')](function(){var _0x3fde08=_0x3992cc['get']({'plain':!![]});var _0x44fa2f=_0xebef('0x35');return db['UserProfileResource'][_0xebef('0x36')]({'where':{'type':_0x44fa2f,'resourceId':_0x3fde08['id']}})[_0xebef('0x1e')](function(){return _0x3992cc;});})[_0xebef('0x1e')](function(){_0x3d3b76[_0xebef('0x2a')](0xcc)[_0xebef('0x2b')]();});}};}function handleEntityNotFound(_0x1cad3d,_0x492a07){return function(_0x3062db){if(!_0x3062db){_0x1cad3d[_0xebef('0x29')](0x194);}return _0x3062db;};}function handleError(_0x49db08,_0x54631e){_0x54631e=_0x54631e||0x1f4;return function(_0x205718){logger[_0xebef('0x22')](_0x205718[_0xebef('0x37')]);if(_0x205718[_0xebef('0x38')]){delete _0x205718[_0xebef('0x38')];}_0x49db08['status'](_0x54631e)[_0xebef('0x39')](_0x205718);};}exports[_0xebef('0x3a')]=function(_0x4ec9ee,_0x2d6f78){var _0x1acd95={'include':[{'model':db[_0xebef('0x3b')],'as':_0xebef('0x3c')}]},_0x4c7878={},_0x562f0d={'count':0x0,'rows':[]};var _0x19178d=_[_0xebef('0x3d')](db[_0xebef('0x3e')]['rawAttributes'],function(_0x596b21){return{'name':_0x596b21['fieldName'],'type':_0x596b21[_0xebef('0x3f')][_0xebef('0x40')]};});_0x4c7878[_0xebef('0x41')]=_[_0xebef('0x3d')](_0x19178d,_0xebef('0x38'));_0x4c7878['query']=_[_0xebef('0x42')](_0x4ec9ee['query']);_0x4c7878['filters']=_['intersection'](_0x4c7878[_0xebef('0x41')],_0x4c7878[_0xebef('0x43')]);_0x1acd95[_0xebef('0x44')]=_[_0xebef('0x45')](_0x4c7878[_0xebef('0x41')],qs['fields'](_0x4ec9ee['query'][_0xebef('0x46')]));_0x1acd95['attributes']=_0x1acd95['attributes'][_0xebef('0x47')]?_0x1acd95['attributes']:_0x4c7878[_0xebef('0x41')];if(!_0x4ec9ee[_0xebef('0x43')][_0xebef('0x48')]('nolimit')){_0x1acd95['limit']=qs[_0xebef('0x2d')](_0x4ec9ee[_0xebef('0x43')][_0xebef('0x2d')]);_0x1acd95[_0xebef('0x2f')]=qs[_0xebef('0x2f')](_0x4ec9ee[_0xebef('0x43')][_0xebef('0x2f')]);}_0x1acd95[_0xebef('0x49')]=qs[_0xebef('0x4a')](_0x4ec9ee[_0xebef('0x43')]['sort']);_0x1acd95[_0xebef('0x4b')]=qs[_0xebef('0x4c')](_[_0xebef('0x4d')](_0x4ec9ee[_0xebef('0x43')],_0x4c7878['filters']),_0x19178d);if(_0x4ec9ee[_0xebef('0x43')]['filter']){_0x1acd95['where']=_[_0xebef('0x4e')](_0x1acd95[_0xebef('0x4b')],{'$or':_[_0xebef('0x3d')](_0x19178d,function(_0x29b237){if(_0x29b237[_0xebef('0x3f')]!==_0xebef('0x4f')){var _0xcf4ba7={};_0xcf4ba7[_0x29b237['name']]={'$like':'%'+_0x4ec9ee[_0xebef('0x43')]['filter']+'%'};return _0xcf4ba7;}})});}_0x1acd95=_['merge']({},_0x1acd95,_0x4ec9ee[_0xebef('0x50')]);var _0x109cfe={'where':_0x1acd95[_0xebef('0x4b')]};return db[_0xebef('0x3e')][_0xebef('0x2e')](_0x109cfe)[_0xebef('0x1e')](function(_0x5f2a8c){_0x562f0d[_0xebef('0x2e')]=_0x5f2a8c;if(_0x4ec9ee[_0xebef('0x43')][_0xebef('0x51')]){_0x1acd95[_0xebef('0x52')]=[{'all':!![]}];}return db[_0xebef('0x3e')]['findAll'](_0x1acd95);})[_0xebef('0x1e')](function(_0x4f24b6){_0x562f0d[_0xebef('0x53')]=_0x4f24b6;return _0x562f0d;})[_0xebef('0x1e')](respondWithFilteredResult(_0x2d6f78,_0x1acd95))['catch'](handleError(_0x2d6f78,null));};exports[_0xebef('0x54')]=function(_0xc47014,_0x326e2e){var _0x5c1eb3={'raw':![],'where':{'id':_0xc47014[_0xebef('0x55')]['id']},'include':[{'model':db[_0xebef('0x3b')],'as':'mandatoryDispositionPause'}]},_0x3aad6f={};_0x3aad6f[_0xebef('0x41')]=_[_0xebef('0x42')](db[_0xebef('0x3e')][_0xebef('0x56')]);_0x3aad6f['query']=_[_0xebef('0x42')](_0xc47014[_0xebef('0x43')]);_0x3aad6f['filters']=_[_0xebef('0x45')](_0x3aad6f['model'],_0x3aad6f[_0xebef('0x43')]);_0x5c1eb3['attributes']=_[_0xebef('0x45')](_0x3aad6f['model'],qs[_0xebef('0x46')](_0xc47014[_0xebef('0x43')][_0xebef('0x46')]));_0x5c1eb3[_0xebef('0x44')]=_0x5c1eb3[_0xebef('0x44')]['length']?_0x5c1eb3[_0xebef('0x44')]:_0x3aad6f[_0xebef('0x41')];if(_0xc47014[_0xebef('0x43')][_0xebef('0x51')]){_0x5c1eb3[_0xebef('0x52')]=[{'all':!![]}];}_0x5c1eb3=_[_0xebef('0x4e')]({},_0x5c1eb3,_0xc47014[_0xebef('0x50')]);return db[_0xebef('0x3e')][_0xebef('0x57')](_0x5c1eb3)[_0xebef('0x1e')](handleEntityNotFound(_0x326e2e,null))['then'](respondWithResult(_0x326e2e,null))[_0xebef('0x28')](handleError(_0x326e2e,null));};exports[_0xebef('0x58')]=function(_0x47a9aa,_0x29a168){return db[_0xebef('0x3e')][_0xebef('0x58')](_0x47a9aa[_0xebef('0x59')],{})[_0xebef('0x1e')](function(_0x14a1c6){var _0x3bbe87=_0x47a9aa[_0xebef('0x5a')][_0xebef('0x5b')]({'plain':!![]});if(!_0x3bbe87)throw new Error(_0xebef('0x5c'));if(_0x3bbe87[_0xebef('0x5d')]===_0xebef('0x5a')){var _0x868ccc=_0x14a1c6[_0xebef('0x5b')]({'plain':!![]});var _0x477152='FaxAccounts';return db[_0xebef('0x5e')][_0xebef('0x57')]({'where':{'name':_0x477152,'userProfileId':_0x3bbe87['userProfileId']},'raw':!![]})[_0xebef('0x1e')](function(_0x417619){if(_0x417619&&_0x417619['autoAssociation']===0x0){return db[_0xebef('0x5f')][_0xebef('0x58')]({'name':_0x868ccc['name'],'resourceId':_0x868ccc['id'],'type':_0x417619['name'],'sectionId':_0x417619['id']},{})[_0xebef('0x1e')](function(){return _0x14a1c6;});}else{return _0x14a1c6;}})[_0xebef('0x28')](function(_0x1cee5c){logger[_0xebef('0x22')](_0xebef('0x60'),_0x1cee5c);throw _0x1cee5c;});}return _0x14a1c6;})[_0xebef('0x1e')](respondWithResult(_0x29a168,0xc9))[_0xebef('0x28')](handleError(_0x29a168,null));};exports[_0xebef('0x34')]=function(_0x546443,_0x4340a3){if(_0x546443[_0xebef('0x59')]['id']){delete _0x546443[_0xebef('0x59')]['id'];}return db[_0xebef('0x3e')][_0xebef('0x57')]({'where':{'id':_0x546443['params']['id']},'include':[{'model':db['Pause'],'as':_0xebef('0x3c')}]})[_0xebef('0x1e')](handleEntityNotFound(_0x4340a3,null))[_0xebef('0x1e')](saveUpdates(_0x546443['body'],null))[_0xebef('0x1e')](respondWithResult(_0x4340a3,null))[_0xebef('0x28')](handleError(_0x4340a3,null));};exports[_0xebef('0x36')]=function(_0x942f5f,_0xfe3b25){return db['FaxAccount'][_0xebef('0x57')]({'where':{'id':_0x942f5f[_0xebef('0x55')]['id']}})['then'](handleEntityNotFound(_0xfe3b25,null))['then'](removeEntity(_0xfe3b25,null))['catch'](handleError(_0xfe3b25,null));};exports[_0xebef('0x61')]=function(_0x3a0258,_0x6a438d){return db[_0xebef('0x3e')][_0xebef('0x61')]()['then'](respondWithResult(_0x6a438d,null))[_0xebef('0x28')](handleError(_0x6a438d,null));};exports[_0xebef('0x62')]=function(_0x442f14,_0x4fc3d5,_0x5c9dd4){if(_0x442f14[_0xebef('0x59')]['id']){delete _0x442f14[_0xebef('0x59')]['id'];}return db['FaxAccount'][_0xebef('0x57')]({'where':{'id':_0x442f14['params']['id']}})[_0xebef('0x1e')](handleEntityNotFound(_0x4fc3d5,null))['then'](function(_0xa0df33){if(_0xa0df33){_0x442f14[_0xebef('0x59')][_0xebef('0x63')]=_0xa0df33['id'];return db[_0xebef('0x64')][_0xebef('0x58')](_0x442f14[_0xebef('0x59')]);}})[_0xebef('0x1e')](respondWithResult(_0x4fc3d5,null))[_0xebef('0x28')](handleError(_0x4fc3d5,null));};exports['getDispositions']=function(_0x1fb734,_0x5c5bef,_0xd2d786){var _0x4c30d6={'raw':![],'where':{}};var _0xf91d26={};var _0x547f51={'count':0x0,'rows':[]};return db[_0xebef('0x3e')][_0xebef('0x65')]({'where':{'id':_0x1fb734['params']['id']}})['then'](handleEntityNotFound(_0x5c5bef,null))[_0xebef('0x1e')](function(_0x21cf3e){if(_0x21cf3e){_0xf91d26[_0xebef('0x41')]=_['keys'](db[_0xebef('0x64')]['rawAttributes']);_0xf91d26[_0xebef('0x43')]=_[_0xebef('0x42')](_0x1fb734['query']);_0xf91d26[_0xebef('0x4c')]=_[_0xebef('0x45')](_0xf91d26[_0xebef('0x41')],_0xf91d26[_0xebef('0x43')]);_0x4c30d6['attributes']=_[_0xebef('0x45')](_0xf91d26[_0xebef('0x41')],qs[_0xebef('0x46')](_0x1fb734['query'][_0xebef('0x46')]));_0x4c30d6[_0xebef('0x44')]=_0x4c30d6[_0xebef('0x44')][_0xebef('0x47')]?_0x4c30d6[_0xebef('0x44')]:_0xf91d26[_0xebef('0x41')];if(!_0x1fb734[_0xebef('0x43')][_0xebef('0x48')](_0xebef('0x66'))){_0x4c30d6['limit']=qs['limit'](_0x1fb734[_0xebef('0x43')][_0xebef('0x2d')]);_0x4c30d6[_0xebef('0x2f')]=qs[_0xebef('0x2f')](_0x1fb734['query'][_0xebef('0x2f')]);}_0x4c30d6[_0xebef('0x49')]=qs['sort'](_0x1fb734[_0xebef('0x43')]['sort']);_0x4c30d6[_0xebef('0x4b')]=qs[_0xebef('0x4c')](_[_0xebef('0x4d')](_0x1fb734['query'],_0xf91d26['filters']));_0x4c30d6[_0xebef('0x4b')][_0xebef('0x63')]=_0x21cf3e['id'];if(_0x1fb734['query']['filter']){_0x4c30d6[_0xebef('0x4b')]=_[_0xebef('0x4e')](_0x4c30d6['where'],{'$or':_[_0xebef('0x3d')](_0x4c30d6[_0xebef('0x44')],function(_0x44982f){var _0x3dbdf6={};_0x3dbdf6[_0x44982f]={'$like':'%'+_0x1fb734['query']['filter']+'%'};return _0x3dbdf6;})});}_0x4c30d6=_[_0xebef('0x4e')]({},_0x4c30d6,_0x1fb734[_0xebef('0x50')]);return db[_0xebef('0x64')]['count']({'where':_0x4c30d6[_0xebef('0x4b')]})['then'](function(_0x5f13e9){_0x547f51[_0xebef('0x2e')]=_0x5f13e9;if(_0x1fb734[_0xebef('0x43')][_0xebef('0x51')]){_0x4c30d6['include']=[{'all':!![]}];}return db[_0xebef('0x64')][_0xebef('0x67')](_0x4c30d6);})[_0xebef('0x1e')](function(_0x3d6155){_0x547f51[_0xebef('0x53')]=_0x3d6155;return _0x547f51;});}})[_0xebef('0x1e')](respondWithFilteredResult(_0x5c5bef,_0x4c30d6))[_0xebef('0x28')](handleError(_0x5c5bef,null));};exports[_0xebef('0x68')]=function(_0x2623be,_0x41d72d,_0x4d196b){return db[_0xebef('0x3e')][_0xebef('0x57')]({'where':{'id':_0x2623be[_0xebef('0x55')]['id']}})[_0xebef('0x1e')](handleEntityNotFound(_0x41d72d,null))[_0xebef('0x1e')](function(_0x3a29da){if(_0x3a29da){return _0x3a29da[_0xebef('0x68')](_0x2623be[_0xebef('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x41d72d,null))[_0xebef('0x28')](handleError(_0x41d72d,null));};exports[_0xebef('0x69')]=function(_0x396e60,_0x31242a,_0x3377e3){if(_0x396e60[_0xebef('0x59')]['id']){delete _0x396e60[_0xebef('0x59')]['id'];}return db[_0xebef('0x3e')][_0xebef('0x57')]({'where':{'id':_0x396e60[_0xebef('0x55')]['id']}})['then'](handleEntityNotFound(_0x31242a,null))[_0xebef('0x1e')](function(_0x65b254){if(_0x65b254){_0x396e60[_0xebef('0x59')]['FaxAccountId']=_0x65b254['id'];return db[_0xebef('0x6a')][_0xebef('0x58')](_0x396e60[_0xebef('0x59')]);}})[_0xebef('0x1e')](respondWithResult(_0x31242a,null))[_0xebef('0x28')](handleError(_0x31242a,null));};exports['getAnswers']=function(_0x1f03ef,_0x5f25ab,_0x58c728){var _0x1612b1={'raw':![],'where':{}};var _0x4d5673={};var _0x59f5c0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xebef('0x65')]({'where':{'id':_0x1f03ef[_0xebef('0x55')]['id']}})[_0xebef('0x1e')](handleEntityNotFound(_0x5f25ab,null))[_0xebef('0x1e')](function(_0x4e5988){if(_0x4e5988){_0x4d5673[_0xebef('0x41')]=_[_0xebef('0x42')](db[_0xebef('0x6a')][_0xebef('0x56')]);_0x4d5673['query']=_[_0xebef('0x42')](_0x1f03ef[_0xebef('0x43')]);_0x4d5673['filters']=_[_0xebef('0x45')](_0x4d5673[_0xebef('0x41')],_0x4d5673['query']);_0x1612b1[_0xebef('0x44')]=_['intersection'](_0x4d5673[_0xebef('0x41')],qs[_0xebef('0x46')](_0x1f03ef[_0xebef('0x43')][_0xebef('0x46')]));_0x1612b1['attributes']=_0x1612b1[_0xebef('0x44')][_0xebef('0x47')]?_0x1612b1[_0xebef('0x44')]:_0x4d5673[_0xebef('0x41')];if(!_0x1f03ef['query'][_0xebef('0x48')](_0xebef('0x66'))){_0x1612b1[_0xebef('0x2d')]=qs[_0xebef('0x2d')](_0x1f03ef[_0xebef('0x43')][_0xebef('0x2d')]);_0x1612b1[_0xebef('0x2f')]=qs['offset'](_0x1f03ef[_0xebef('0x43')][_0xebef('0x2f')]);}_0x1612b1['order']=qs[_0xebef('0x4a')](_0x1f03ef[_0xebef('0x43')][_0xebef('0x4a')]);_0x1612b1[_0xebef('0x4b')]=qs['filters'](_['pick'](_0x1f03ef['query'],_0x4d5673[_0xebef('0x4c')]));_0x1612b1[_0xebef('0x4b')][_0xebef('0x63')]=_0x4e5988['id'];if(_0x1f03ef[_0xebef('0x43')][_0xebef('0x6b')]){_0x1612b1[_0xebef('0x4b')]=_[_0xebef('0x4e')](_0x1612b1[_0xebef('0x4b')],{'$or':_['map'](_0x1612b1['attributes'],function(_0x27fcb7){var _0x1022e2={};_0x1022e2[_0x27fcb7]={'$like':'%'+_0x1f03ef['query'][_0xebef('0x6b')]+'%'};return _0x1022e2;})});}_0x1612b1=_[_0xebef('0x4e')]({},_0x1612b1,_0x1f03ef[_0xebef('0x50')]);return db['CannedAnswer'][_0xebef('0x2e')]({'where':_0x1612b1[_0xebef('0x4b')]})[_0xebef('0x1e')](function(_0x2c1707){_0x59f5c0[_0xebef('0x2e')]=_0x2c1707;if(_0x1f03ef[_0xebef('0x43')][_0xebef('0x51')]){_0x1612b1['include']=[{'all':!![]}];}return db[_0xebef('0x6a')][_0xebef('0x67')](_0x1612b1);})[_0xebef('0x1e')](function(_0x5acb54){_0x59f5c0['rows']=_0x5acb54;return _0x59f5c0;});}})['then'](respondWithFilteredResult(_0x5f25ab,_0x1612b1))[_0xebef('0x28')](handleError(_0x5f25ab,null));};exports['removeAnswers']=function(_0x166f68,_0x4dbfc4,_0x30efde){return db[_0xebef('0x3e')]['find']({'where':{'id':_0x166f68[_0xebef('0x55')]['id']}})[_0xebef('0x1e')](handleEntityNotFound(_0x4dbfc4,null))[_0xebef('0x1e')](function(_0x45bceb){if(_0x45bceb){return _0x45bceb[_0xebef('0x6c')](_0x166f68[_0xebef('0x43')]['ids']);}})[_0xebef('0x1e')](respondWithStatusCode(_0x4dbfc4,null))[_0xebef('0x28')](handleError(_0x4dbfc4,null));};exports[_0xebef('0x6d')]=function(_0x4ceee6,_0x1bdbb9,_0x52e879){return db[_0xebef('0x6e')][_0xebef('0x57')]({'where':{'id':_0x4ceee6[_0xebef('0x55')]['id']}})[_0xebef('0x1e')](handleEntityNotFound(_0x1bdbb9,null))[_0xebef('0x1e')](function(_0x58b437){if(_0x58b437){return _0x58b437[_0xebef('0x6d')](_0x4ceee6[_0xebef('0x59')][_0xebef('0x6f')],_['omit'](_0x4ceee6[_0xebef('0x59')],[_0xebef('0x6f'),'id'])||{});}})[_0xebef('0x1e')](respondWithResult(_0x1bdbb9,null))['catch'](handleError(_0x1bdbb9,null));};exports['getInteractions']=function(_0x3d7b8f,_0x21fd59,_0x2fb422){var _0x5cbd01={'raw':![],'where':{}};var _0x303660={};var _0x3271a6={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3d7b8f[_0xebef('0x55')]['id']}})[_0xebef('0x1e')](handleEntityNotFound(_0x21fd59,null))[_0xebef('0x1e')](function(_0x47d176){if(_0x47d176){_0x303660[_0xebef('0x41')]=_['keys'](db[_0xebef('0x6e')]['rawAttributes']);_0x303660['query']=_[_0xebef('0x42')](_0x3d7b8f['query']);_0x303660[_0xebef('0x4c')]=_[_0xebef('0x45')](_0x303660[_0xebef('0x41')],_0x303660[_0xebef('0x43')]);_0x5cbd01['attributes']=_[_0xebef('0x45')](_0x303660[_0xebef('0x41')],qs[_0xebef('0x46')](_0x3d7b8f['query'][_0xebef('0x46')]));_0x5cbd01['attributes']=_0x5cbd01[_0xebef('0x44')][_0xebef('0x47')]?_0x5cbd01[_0xebef('0x44')]:_0x303660['model'];if(!_0x3d7b8f['query'][_0xebef('0x48')](_0xebef('0x66'))){_0x5cbd01[_0xebef('0x2d')]=qs['limit'](_0x3d7b8f[_0xebef('0x43')]['limit']);_0x5cbd01[_0xebef('0x2f')]=qs[_0xebef('0x2f')](_0x3d7b8f[_0xebef('0x43')][_0xebef('0x2f')]);}_0x5cbd01[_0xebef('0x49')]=qs[_0xebef('0x4a')](_0x3d7b8f[_0xebef('0x43')][_0xebef('0x4a')]);_0x5cbd01[_0xebef('0x4b')]=qs[_0xebef('0x4c')](_[_0xebef('0x4d')](_0x3d7b8f[_0xebef('0x43')],_0x303660[_0xebef('0x4c')]));_0x5cbd01['where'][_0xebef('0x63')]=_0x47d176['id'];if(_0x3d7b8f[_0xebef('0x43')]['filter']){_0x5cbd01[_0xebef('0x4b')]=_['merge'](_0x5cbd01['where'],{'$or':_['map'](_0x5cbd01[_0xebef('0x44')],function(_0x54ed8a){var _0x128411={};_0x128411[_0x54ed8a]={'$like':'%'+_0x3d7b8f[_0xebef('0x43')][_0xebef('0x6b')]+'%'};return _0x128411;})});}_0x5cbd01=_['merge']({},_0x5cbd01,_0x3d7b8f[_0xebef('0x50')]);return db[_0xebef('0x6e')]['count']({'where':_0x5cbd01['where']})[_0xebef('0x1e')](function(_0x52a8c1){_0x3271a6['count']=_0x52a8c1;if(_0x3d7b8f[_0xebef('0x43')]['includeAll']){_0x5cbd01[_0xebef('0x52')]=[{'model':db['CmContact'],'as':_0xebef('0x70'),'required':![]},{'model':db[_0xebef('0x71')],'as':_0xebef('0x72'),'attributes':[_0xebef('0x38'),_0xebef('0x73'),_0xebef('0x74')],'required':![]},{'model':db[_0xebef('0x75')],'as':_0xebef('0x76'),'attributes':['id',_0xebef('0x38'),_0xebef('0x77')],'where':_0x3d7b8f[_0xebef('0x43')]['tag']?{'id':_0x3d7b8f[_0xebef('0x43')][_0xebef('0x78')]}:undefined,'required':_0x3d7b8f['query']['tag']?!![]:![]}];}return db[_0xebef('0x6e')][_0xebef('0x67')](_0x5cbd01);})['then'](function(_0x22270a){_0x3271a6[_0xebef('0x53')]=_0x22270a;return _0x3271a6;});}})['then'](respondWithFilteredResult(_0x21fd59,_0x5cbd01))['catch'](handleError(_0x21fd59,null));};exports[_0xebef('0x79')]=function(_0x53bcd5,_0x148ef8){var _0x5d0877=_0x53bcd5[_0xebef('0x55')]['id'];var _0x56cd2c=_0x53bcd5[_0xebef('0x59')];var _0x4f6fcd=0xc8;var _0x5b59d6=null;return db['sequelize'][_0xebef('0x7a')]({'isolationLevel':db[_0xebef('0x7b')][_0xebef('0x7c')][_0xebef('0x7d')]['READ_COMMITTED']},function(_0x516cd0){return db[_0xebef('0x3e')][_0xebef('0x65')]({'where':{'id':_0x5d0877},'transaction':_0x516cd0})[_0xebef('0x1e')](function(_0x36f391){if(_0x36f391){return db[_0xebef('0x7e')][_0xebef('0x36')]({'where':{'FaxAccountId':_0x5d0877},'transaction':_0x516cd0})[_0xebef('0x1e')](function(){var _0x189f72=_[_0xebef('0x3d')](_0x56cd2c,function(_0x2db1b0){_0x2db1b0[_0xebef('0x63')]=_0x5d0877;return _0x2db1b0;});return db['FaxApplication'][_0xebef('0x7f')](_0x189f72,{'transaction':_0x516cd0});});}else{_0x4f6fcd=0x194;_0x5b59d6=[];}});})['then'](function(){if(_0x4f6fcd!==0x194){return db['FaxApplication'][_0xebef('0x80')]({'where':{'FaxAccountId':_0x5d0877},'order':_0xebef('0x81')})[_0xebef('0x1e')](function(_0x1c3663){_0x5b59d6=_0x1c3663;});}})[_0xebef('0x28')](function(_0x54979a){_0x4f6fcd=0x1f4;logger['error'](_0x54979a[_0xebef('0x37')]);if(_0x54979a['name']){delete _0x54979a[_0xebef('0x38')];}_0x5b59d6=_0x54979a;})[_0xebef('0x82')](function(){if(_0x5b59d6===null){_0x148ef8[_0xebef('0x29')](_0x4f6fcd);}else{if(_0x4f6fcd===0x1f4){_0x148ef8[_0xebef('0x2a')](_0x4f6fcd)[_0xebef('0x39')](_0x5b59d6);}else{_0x148ef8[_0xebef('0x2a')](_0x4f6fcd)[_0xebef('0x83')](_0x5b59d6);}}});};exports['getApplications']=function(_0x362bcd,_0xd047d9,_0x2af804){var _0x544e06={};var _0x1c941f={};var _0x38df6f;var _0x5f32c7;return db['FaxAccount'][_0xebef('0x65')]({'where':{'id':_0x362bcd['params']['id']}})[_0xebef('0x1e')](handleEntityNotFound(_0xd047d9,null))[_0xebef('0x1e')](function(_0x41c826){if(_0x41c826){_0x38df6f=_0x41c826;_0x1c941f[_0xebef('0x41')]=_[_0xebef('0x42')](db[_0xebef('0x7e')][_0xebef('0x56')]);_0x1c941f[_0xebef('0x43')]=_['keys'](_0x362bcd[_0xebef('0x43')]);_0x1c941f['filters']=_['intersection'](_0x1c941f['model'],_0x1c941f[_0xebef('0x43')]);_0x544e06[_0xebef('0x44')]=_['intersection'](_0x1c941f[_0xebef('0x41')],qs['fields'](_0x362bcd[_0xebef('0x43')][_0xebef('0x46')]));_0x544e06[_0xebef('0x44')]=_0x544e06[_0xebef('0x44')]['length']?_0x544e06[_0xebef('0x44')]:_0x1c941f['model'];_0x544e06[_0xebef('0x49')]=qs[_0xebef('0x4a')](_0x362bcd[_0xebef('0x43')]['sort']);_0x544e06[_0xebef('0x4b')]=qs[_0xebef('0x4c')](_[_0xebef('0x4d')](_0x362bcd[_0xebef('0x43')],_0x1c941f[_0xebef('0x4c')]));if(_0x362bcd[_0xebef('0x43')][_0xebef('0x6b')]){_0x544e06['where']=_[_0xebef('0x4e')](_0x544e06['where'],{'$or':_[_0xebef('0x3d')](_0x544e06[_0xebef('0x44')],function(_0x490ecc){var _0x1d4a43={};_0x1d4a43[_0x490ecc]={'$like':'%'+_0x362bcd[_0xebef('0x43')][_0xebef('0x6b')]+'%'};return _0x1d4a43;})});}_0x544e06=_['merge']({},_0x544e06,_0x362bcd[_0xebef('0x50')]);return _0x38df6f[_0xebef('0x84')](_0x544e06);}})[_0xebef('0x1e')](function(_0x4e6a3e){if(_0x4e6a3e){_0x5f32c7=_0x4e6a3e[_0xebef('0x47')];if(!_0x362bcd['query'][_0xebef('0x48')](_0xebef('0x66'))){_0x544e06[_0xebef('0x2d')]=qs[_0xebef('0x2d')](_0x362bcd['query']['limit']);_0x544e06[_0xebef('0x2f')]=qs[_0xebef('0x2f')](_0x362bcd[_0xebef('0x43')][_0xebef('0x2f')]);}return _0x38df6f[_0xebef('0x84')](_0x544e06);}})[_0xebef('0x1e')](function(_0x52b3ff){if(_0x52b3ff){return _0x52b3ff?{'count':_0x5f32c7,'rows':_0x52b3ff}:null;}})[_0xebef('0x1e')](respondWithResult(_0xd047d9,null))[_0xebef('0x28')](handleError(_0xd047d9,null));};function Extension(_0x427b4a,_0x1306e0,_0x5e7c32,_0x31267d){this[_0xebef('0x85')]=_0xebef('0x86');this[_0xebef('0x87')]=_0x427b4a['localstationid'];this['app']=_0x31267d;this[_0xebef('0x3f')]=_0xebef('0x88');this['description']=_0xebef('0x89');this['FaxAccountId']=_0x427b4a['id'];this[_0xebef('0x81')]=_0x1306e0;this[_0xebef('0x8a')]=_0x5e7c32;}function createExtensionsReciveFax(_0x411b70){var _0x1e86eb=0x1;var _0x429b33=[];_0x429b33[_0xebef('0x8b')](new Extension(_0x411b70,_0x1e86eb,'',_0xebef('0x8c')));_0x1e86eb+=0x1;_0x429b33[_0xebef('0x8b')](new Extension(_0x411b70,_0x1e86eb,_0xebef('0x8d'),_0xebef('0x8e')));_0x1e86eb+=0x1;for(var _0x59b21e in _0x411b70){if(_0x411b70[_0xebef('0x48')](_0x59b21e)&&(_0x59b21e===_0xebef('0x8f')||_0x59b21e===_0xebef('0x90')||_0x59b21e===_0xebef('0x91')||_0x59b21e===_0xebef('0x92')||_0x59b21e==='headerinfo'||_0x59b21e===_0xebef('0x93')||_0x59b21e===_0xebef('0x94')||_0x59b21e===_0xebef('0x95')||_0x59b21e===_0xebef('0x96'))){_0x429b33[_0xebef('0x8b')](new Extension(_0x411b70,_0x1e86eb,_0xebef('0x97')+_0x59b21e+')='+_0x411b70[_0x59b21e],_0xebef('0x8e')));_0x1e86eb+=0x1;}}_0x429b33['push'](new Extension(_0x411b70,_0x1e86eb,'6','Wait'));_0x1e86eb+=0x1;_0x429b33[_0xebef('0x8b')](new Extension(_0x411b70,_0x1e86eb,_0xebef('0x98'),_0xebef('0x99')));_0x1e86eb=0x0;return _0x429b33;}exports[_0xebef('0x9a')]=function(_0x3ec47c,_0x572c1d,_0x40e5b6){var _0x4e42b3;return db['sequelize'][_0xebef('0x7a')](function(_0x6f944b){return db[_0xebef('0x3e')][_0xebef('0x58')](_0x3ec47c[_0xebef('0x59')],{'transaction':_0x6f944b})[_0xebef('0x1e')](function(_0x31bfa7){_0x4e42b3=_0x31bfa7[_0xebef('0x5b')]({'plain':!![]});return db[_0xebef('0x9b')][_0xebef('0x7f')](createExtensionsReciveFax(_0x4e42b3),{'transaction':_0x6f944b});});})[_0xebef('0x1e')](function(){return _0x4e42b3;})[_0xebef('0x1e')](respondWithResult(_0x572c1d,null))[_0xebef('0x28')](handleError(_0x572c1d,null));};exports[_0xebef('0x9c')]=function(_0x48d475,_0xb3e386,_0x16a60f){var _0x48b29e;return db[_0xebef('0x7b')][_0xebef('0x7a')](function(_0x29c860){return db[_0xebef('0x3e')]['update'](_0x48d475[_0xebef('0x59')],{'where':{'id':_0x48d475[_0xebef('0x59')]['id']},'transaction':_0x29c860})[_0xebef('0x1e')](function(_0x14984e){return db[_0xebef('0x9b')]['destroy']({'where':{'FaxAccountId':_0x48d475[_0xebef('0x59')]['id']},'transaction':_0x29c860})[_0xebef('0x1e')](function(_0x2690af){return db['VoiceExtension'][_0xebef('0x7f')](createExtensionsReciveFax(_[_0xebef('0x9d')](_0x48d475[_0xebef('0x59')],[_0xebef('0x9e'),_0xebef('0x40'),'createdAt','updatedAt',_0xebef('0x9f'),_0xebef('0xa0')])),{'transaction':_0x29c860});});});})[_0xebef('0x1e')](function(){return db[_0xebef('0x3e')][_0xebef('0xa1')](_0x48d475[_0xebef('0x59')]['id']);})['then'](respondWithResult(_0xb3e386,null))[_0xebef('0x28')](handleError(_0xb3e386,null));};exports[_0xebef('0xa2')]=function(_0xfae2fe,_0x39f6a2,_0x3a57b4){var _0xbda6ec={'raw':!![],'where':{}};var _0x565687={};var _0x386b78={'count':0x0,'rows':[]};return db[_0xebef('0x3e')][_0xebef('0x65')]({'where':{'id':_0xfae2fe['params']['id']}})['then'](handleEntityNotFound(_0x39f6a2,null))[_0xebef('0x1e')](function(_0x25267b){if(_0x25267b){_0x565687[_0xebef('0x41')]=_[_0xebef('0x42')](db[_0xebef('0xa3')][_0xebef('0x56')]);_0x565687['query']=_['keys'](_0xfae2fe[_0xebef('0x43')]);_0x565687['filters']=_[_0xebef('0x45')](_0x565687[_0xebef('0x41')],_0x565687[_0xebef('0x43')]);_0xbda6ec[_0xebef('0x44')]=_[_0xebef('0x45')](_0x565687[_0xebef('0x41')],qs[_0xebef('0x46')](_0xfae2fe['query'][_0xebef('0x46')]));_0xbda6ec[_0xebef('0x44')]=_0xbda6ec[_0xebef('0x44')][_0xebef('0x47')]?_0xbda6ec[_0xebef('0x44')]:_0x565687[_0xebef('0x41')];if(!_0xfae2fe[_0xebef('0x43')][_0xebef('0x48')](_0xebef('0x66'))){_0xbda6ec[_0xebef('0x2d')]=qs[_0xebef('0x2d')](_0xfae2fe[_0xebef('0x43')][_0xebef('0x2d')]);_0xbda6ec[_0xebef('0x2f')]=qs[_0xebef('0x2f')](_0xfae2fe[_0xebef('0x43')][_0xebef('0x2f')]);}_0xbda6ec[_0xebef('0x49')]=qs[_0xebef('0x4a')](_0xfae2fe[_0xebef('0x43')][_0xebef('0x4a')]);_0xbda6ec[_0xebef('0x4b')]=qs[_0xebef('0x4c')](_['pick'](_0xfae2fe[_0xebef('0x43')],_0x565687[_0xebef('0x4c')]));_0xbda6ec[_0xebef('0x4b')]['FaxAccountId']=_0x25267b['id'];if(_0xfae2fe[_0xebef('0x43')][_0xebef('0x6b')]){_0xbda6ec['where']=_[_0xebef('0x4e')](_0xbda6ec[_0xebef('0x4b')],{'$or':_['map'](_0xbda6ec[_0xebef('0x44')],function(_0x57ee0e){var _0x15ae8d={};_0x15ae8d[_0x57ee0e]={'$like':'%'+_0xfae2fe[_0xebef('0x43')][_0xebef('0x6b')]+'%'};return _0x15ae8d;})});}if(_0xfae2fe[_0xebef('0x43')][_0xebef('0xa4')]){var _0x7978ce=_0xfae2fe[_0xebef('0x43')]['$gte'][_0xebef('0xa5')](',');var _0x3eb3a9={};_0x3eb3a9[_0x7978ce[0x0]]={'$gte':moment(_0x7978ce[0x1])[_0xebef('0xa6')](_0xebef('0xa7'))};_0xbda6ec[_0xebef('0x4b')]=_[_0xebef('0x4e')](_0xbda6ec[_0xebef('0x4b')],_0x3eb3a9);}_0xbda6ec=_[_0xebef('0x4e')]({},_0xbda6ec,_0xfae2fe[_0xebef('0x50')]);return db[_0xebef('0xa3')][_0xebef('0x2e')]({'where':_0xbda6ec[_0xebef('0x4b')]})[_0xebef('0x1e')](function(_0x126043){_0x386b78['count']=_0x126043;if(_0xfae2fe[_0xebef('0x43')][_0xebef('0x51')]){_0xbda6ec[_0xebef('0x52')]=[{'all':!![]}];}return db[_0xebef('0xa3')][_0xebef('0x67')](_0xbda6ec);})[_0xebef('0x1e')](function(_0x1449cb){_0x386b78['rows']=_0x1449cb;return _0x386b78;});}})[_0xebef('0x1e')](respondWithFilteredResult(_0x39f6a2,_0xbda6ec))[_0xebef('0x28')](handleError(_0x39f6a2,null));};exports['send']=function(_0x5d7a57,_0x470e00,_0x3148e7){var _0x403bf2,_0x299540={},_0x4e5f8c;if(_0x5d7a57[_0xebef('0x59')]['to']){_0x4e5f8c=_0x5d7a57[_0xebef('0x59')]['to'][0x0];}return db['FaxAccount'][_0xebef('0x57')]({'where':{'id':_0x5d7a57['params']['id']},'include':[{'model':db[_0xebef('0xa8')],'as':_0xebef('0xa9'),'include':[{'model':db[_0xebef('0xaa')],'as':_0xebef('0xab'),'where':{'fax':_0x4e5f8c},'limit':0x1,'order':[['updatedAt',_0xebef('0xac')]]}]}]})[_0xebef('0x1e')](handleEntityNotFound(_0x470e00,null))[_0xebef('0x1e')](function(_0x101101){_0x403bf2=_0x101101;if(_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')]&&_0x5d7a57[_0xebef('0x59')]['attachments'][_0xebef('0x47')]){for(var _0x497ef4=0x0;_0x497ef4<_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')]['length'];_0x497ef4+=0x1){_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')][_0x497ef4]={'filename':_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')][_0x497ef4]['name'],'id':_0x5d7a57['body'][_0xebef('0xad')][_0x497ef4]['id'],'path':path['join'](config[_0xebef('0xae')],'server/files/attachments',_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')][_0x497ef4][_0xebef('0xaf')])};}}return respondWithRpcPromise(_0xebef('0xb0'),'CheckAfterSend',{'FaxAccountId':_[_0xebef('0xb1')](_0x5d7a57[_0xebef('0x55')]['id'])?undefined:_0x5d7a57[_0xebef('0x55')]['id'],'path':_[_0xebef('0xb1')](_0x5d7a57['body'][_0xebef('0xad')][0x0][_0xebef('0xb2')])?undefined:_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')][0x0]['path'],'fax':_[_0xebef('0xb1')](_0x5d7a57[_0xebef('0x59')]['to'][0x0])?undefined:_0x5d7a57['body']['to'][0x0]},client9002);})['then'](function(){if(_0x403bf2){if(_[_0xebef('0xb1')](_0x5d7a57[_0xebef('0x59')]['from'])){_0x5d7a57[_0xebef('0x59')]['from']=util['format'](_0xebef('0xb3'),_0x403bf2[_0xebef('0x38')],_0x403bf2['fax']);}if(_0x403bf2[_0xebef('0xa9')]){if(_0x403bf2['List']['Contacts'][_0xebef('0x47')]){return _0x403bf2['List'][_0xebef('0xab')][0x0];}else{return db[_0xebef('0xaa')]['create'](_[_0xebef('0x19')](_0x5d7a57['body'],{'firstName':_0x5d7a57[_0xebef('0x59')]['to'][0x0],'phone':_0x5d7a57[_0xebef('0x59')]['to'][0x0],'fax':_0x5d7a57[_0xebef('0x59')]['to'][0x0],'ListId':_0x403bf2[_0xebef('0xa0')]}));}}else{throw new Error(_0xebef('0xb4'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x306ce9){if(_0x306ce9){return db[_0xebef('0x6e')][_0xebef('0x57')]({'where':{'ContactId':_0x306ce9['id'],'closed':![],'FaxAccountId':_0x403bf2['id']}})['then'](function(_0x4c73d4){if(_0x4c73d4){return[_0x4c73d4,![]];}return db[_0xebef('0x6e')]['create']({'UserId':_0x5d7a57[_0xebef('0x5a')]['id'],'ContactId':_0x306ce9['id'],'FaxAccountId':_0x403bf2['id'],'fax':_0x5d7a57[_0xebef('0x59')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x5d7a57[_0xebef('0x59')],{'read':![],'body':_0x5d7a57['body'][_0xebef('0xad')][0x0][_0xebef('0xb5')],'FaxAccountId':_0x403bf2['id'],'UserId':_0x5d7a57[_0xebef('0x5a')]['id'],'ContactId':_0x306ce9['id'],'AttachmentId':_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xebef('0xb6')}]})[_0xebef('0x1e')](function(_0x5cf601){return[_0x5cf601,!![]];});});}else{throw new Error(_0xebef('0xb7'));}})[_0xebef('0xb8')](function(_0x42cb24,_0x1436dd){if(_0x1436dd){return _0x42cb24;}return db[_0xebef('0xa3')][_0xebef('0x58')]({'direction':'out','read':![],'body':_0x5d7a57['body']['attachments'][0x0][_0xebef('0xb5')],'FaxAccountId':_0x403bf2['id'],'FaxInteractionId':_0x42cb24['id'],'UserId':_0x5d7a57[_0xebef('0x5a')]['id'],'ContactId':_0x42cb24['ContactId'],'AttachmentId':_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')][0x0]['id']})[_0xebef('0x1e')](function(_0x345b59){_0x42cb24['dataValues'][_0xebef('0xb6')]=[];_0x42cb24[_0xebef('0xb9')][_0xebef('0xb6')][_0xebef('0x8b')](_0x345b59[_0xebef('0xb9')]);return _0x42cb24;});})['then'](function(_0x7674cc){respondWithRpcPromise(_0xebef('0xba'),_0xebef('0xba'),{'FaxAccountId':_[_0xebef('0xb1')](_0x5d7a57[_0xebef('0x55')]['id'])?undefined:_0x5d7a57[_0xebef('0x55')]['id'],'path':_[_0xebef('0xb1')](_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')][0x0][_0xebef('0xb2')])?undefined:_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')][0x0][_0xebef('0xb2')],'fax':_[_0xebef('0xb1')](_0x5d7a57[_0xebef('0x59')]['to'][0x0])?undefined:_0x5d7a57[_0xebef('0x59')]['to'][0x0],'AttachmentId':_0x5d7a57[_0xebef('0x59')][_0xebef('0xad')][0x0]['id']},client9002)[_0xebef('0x1e')](function(_0x58fe17){logger[_0xebef('0x26')](_0xebef('0xbb'),_0x58fe17);})['catch'](function(_0x1becb3){logger[_0xebef('0x26')](_0xebef('0xbb'),_0x1becb3);});return _0x7674cc;})[_0xebef('0x1e')](respondWithResult(_0x470e00,null))[_0xebef('0x28')](handleError(_0x470e00,null));};exports[_0xebef('0xbc')]=function(_0x1275f0,_0x4fd408,_0x75549){return db[_0xebef('0x3e')][_0xebef('0x57')]({'where':{'id':_0x1275f0[_0xebef('0x55')]['id']}})[_0xebef('0x1e')](handleEntityNotFound(_0x4fd408,null))[_0xebef('0x1e')](function(_0x11effd){if(_0x11effd){return _0x11effd['addAgents'](_0x1275f0[_0xebef('0x59')]['ids'],_['omit'](_0x1275f0[_0xebef('0x59')],[_0xebef('0x6f'),'id'])||{})[_0xebef('0xb8')](function(_0x163478){for(var _0x3a9625=0x0;_0x3a9625<_0x1275f0['body'][_0xebef('0x6f')]['length'];_0x3a9625+=0x1){socket['emit'](_0xebef('0xbd'),{'UserId':Number(_0x1275f0[_0xebef('0x59')][_0xebef('0x6f')][_0x3a9625]),'FaxAccountId':Number(_0x1275f0[_0xebef('0x55')]['id'])});}return _0x163478;});}})[_0xebef('0x1e')](respondWithResult(_0x4fd408,null))['catch'](handleError(_0x4fd408,null));};exports['removeAgents']=function(_0x4e3504,_0x43c5a6,_0x5d832d){return db[_0xebef('0x3e')]['find']({'where':{'id':_0x4e3504['params']['id']}})['then'](handleEntityNotFound(_0x43c5a6,null))[_0xebef('0x1e')](function(_0x961a6e){if(_0x961a6e){return _0x961a6e[_0xebef('0xbe')](_0x4e3504[_0xebef('0x43')][_0xebef('0x6f')])['then'](function(){if(_[_0xebef('0xbf')](_0x4e3504[_0xebef('0x43')][_0xebef('0x6f')])){for(var _0x11120f=0x0;_0x11120f<_0x4e3504[_0xebef('0x43')]['ids'][_0xebef('0x47')];_0x11120f+=0x1){socket[_0xebef('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x4e3504[_0xebef('0x43')][_0xebef('0x6f')][_0x11120f]),'FaxAccountId':Number(_0x4e3504[_0xebef('0x55')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x4e3504['query'][_0xebef('0x6f')]),'FaxAccountId':Number(_0x4e3504[_0xebef('0x55')]['id'])});}});}})[_0xebef('0x1e')](respondWithStatusCode(_0x43c5a6,null))['catch'](handleError(_0x43c5a6,null));};exports[_0xebef('0xc1')]=function(_0x2d130a,_0x4e1700,_0x4a8b54){var _0x181cf5={};var _0x16e403={};var _0x30494a;var _0x53bbca;return db[_0xebef('0x3e')][_0xebef('0x65')]({'where':{'id':_0x2d130a[_0xebef('0x55')]['id']}})[_0xebef('0x1e')](handleEntityNotFound(_0x4e1700,null))['then'](function(_0x15fa2a){if(_0x15fa2a){_0x30494a=_0x15fa2a;_0x16e403['model']=_[_0xebef('0x42')](db['User'][_0xebef('0x56')]);_0x16e403[_0xebef('0x43')]=_[_0xebef('0x42')](_0x2d130a[_0xebef('0x43')]);_0x16e403['filters']=_[_0xebef('0x45')](_0x16e403[_0xebef('0x41')],_0x16e403[_0xebef('0x43')]);_0x181cf5[_0xebef('0x44')]=_['intersection'](_0x16e403[_0xebef('0x41')],qs[_0xebef('0x46')](_0x2d130a['query'][_0xebef('0x46')]));_0x181cf5['attributes']=_0x181cf5[_0xebef('0x44')][_0xebef('0x47')]?_0x181cf5['attributes']:_0x16e403[_0xebef('0x41')];_0x181cf5['order']=qs[_0xebef('0x4a')](_0x2d130a[_0xebef('0x43')][_0xebef('0x4a')]);_0x181cf5['where']=qs['filters'](_[_0xebef('0x4d')](_0x2d130a[_0xebef('0x43')],_0x16e403[_0xebef('0x4c')]));if(_0x2d130a[_0xebef('0x43')][_0xebef('0x6b')]){_0x181cf5['where']=_[_0xebef('0x4e')](_0x181cf5[_0xebef('0x4b')],{'$or':_[_0xebef('0x3d')](_0x181cf5['attributes'],function(_0x2732d1){var _0x1e31d0={};_0x1e31d0[_0x2732d1]={'$like':'%'+_0x2d130a[_0xebef('0x43')][_0xebef('0x6b')]+'%'};return _0x1e31d0;})});}_0x181cf5=_[_0xebef('0x4e')]({},_0x181cf5,_0x2d130a[_0xebef('0x50')]);return _0x30494a[_0xebef('0xc1')](_0x181cf5);}})['then'](function(_0x248640){if(_0x248640){_0x53bbca=_0x248640['length'];if(!_0x2d130a[_0xebef('0x43')][_0xebef('0x48')](_0xebef('0x66'))){_0x181cf5[_0xebef('0x2d')]=qs[_0xebef('0x2d')](_0x2d130a[_0xebef('0x43')][_0xebef('0x2d')]);_0x181cf5[_0xebef('0x2f')]=qs[_0xebef('0x2f')](_0x2d130a[_0xebef('0x43')][_0xebef('0x2f')]);}return _0x30494a[_0xebef('0xc1')](_0x181cf5);}})[_0xebef('0x1e')](function(_0x49294b){if(_0x49294b){return _0x49294b?{'count':_0x53bbca,'rows':_0x49294b}:null;}})[_0xebef('0x1e')](respondWithResult(_0x4e1700,null))[_0xebef('0x28')](handleError(_0x4e1700,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index fcc0b9f..631d108 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 _0xec12=['FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x325343,_0x16c135){var _0x1ce89f=function(_0x53856d){while(--_0x53856d){_0x325343['push'](_0x325343['shift']());}};_0x1ce89f(++_0x16c135);}(_0xec12,0xff));var _0x2ec1=function(_0x113b88,_0x147c10){_0x113b88=_0x113b88-0x0;var _0x2bc637=_0xec12[_0x113b88];return _0x2bc637;};'use strict';var EventEmitter=require(_0x2ec1('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x2ec1('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2ec1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2ec1('0x3'),'afterDestroy':_0x2ec1('0x4')};function emitEvent(_0x249f70){return function(_0x485cad,_0x5a40f4,_0x3274c2){FaxAccountEvents[_0x2ec1('0x5')](_0x249f70+':'+_0x485cad['id'],_0x485cad);FaxAccountEvents[_0x2ec1('0x5')](_0x249f70,_0x485cad);_0x3274c2(null);};}for(var e in events){if(events[_0x2ec1('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x2ec1('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xacb8=['save','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0xacb8,0xbc));var _0x8acb=function(_0x216a28,_0x4f021e){_0x216a28=_0x216a28-0x0;var _0x4f4901=_0xacb8[_0x216a28];return _0x4f4901;};'use strict';var EventEmitter=require(_0x8acb('0x0'));var FaxAccount=require(_0x8acb('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8acb('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2dd44f){return function(_0x5e7f04,_0x211834,_0x335e4c){FaxAccountEvents['emit'](_0x2dd44f+':'+_0x5e7f04['id'],_0x5e7f04);FaxAccountEvents['emit'](_0x2dd44f,_0x5e7f04);_0x335e4c(null);};}for(var e in events){if(events[_0x8acb('0x3')](e)){var event=events[e];FaxAccount[_0x8acb('0x4')](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 406b67f..49a9191 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 _0x8474=['fax_accounts','lodash','../../config/logger','api','bluebird','path','rimraf','define'];(function(_0x2c6f03,_0x3ca413){var _0x4b1114=function(_0x4233a2){while(--_0x4233a2){_0x2c6f03['push'](_0x2c6f03['shift']());}};_0x4b1114(++_0x3ca413);}(_0x8474,0x89));var _0x4847=function(_0x57d47d,_0x6c8523){_0x57d47d=_0x57d47d-0x0;var _0x3b511e=_0x8474[_0x57d47d];return _0x3b511e;};'use strict';var _=require(_0x4847('0x0'));var util=require('util');var logger=require(_0x4847('0x1'))(_0x4847('0x2'));var moment=require('moment');var BPromise=require(_0x4847('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4847('0x4'));var rimraf=require(_0x4847('0x5'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module['exports']=function(_0x5c9720,_0x13068b){return _0x5c9720[_0x4847('0x6')]('FaxAccount',attributes,{'tableName':_0x4847('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97de=['moment','bluebird','path','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','api'];(function(_0x652c92,_0x549c1e){var _0x3057e8=function(_0x415758){while(--_0x415758){_0x652c92['push'](_0x652c92['shift']());}};_0x3057e8(++_0x549c1e);}(_0x97de,0xaa));var _0xe97d=function(_0x592125,_0x3c3e4a){_0x592125=_0x592125-0x0;var _0x536040=_0x97de[_0x592125];return _0x536040;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe97d('0x0'));var moment=require(_0xe97d('0x1'));var BPromise=require(_0xe97d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe97d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe97d('0x4'));module[_0xe97d('0x5')]=function(_0x41bcc2,_0x237fb9){return _0x41bcc2[_0xe97d('0x6')](_0xe97d('0x7'),attributes,{'tableName':_0xe97d('0x8'),'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 a438ca9..bb0a7c1 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 _0x5915=['attributes','limit','include','map','model','debug','catch','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','from','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','List','CmContact','DESC','FaxApplication','Applications','get','applications','list','priority','asc','account','Contacts','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','FaxMessage','ContactId','AttachmentId','UserId','User','name','interaction','agent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','where'];(function(_0x3df9dd,_0x26f5cd){var _0x4f11e4=function(_0x1993fe){while(--_0x1993fe){_0x3df9dd['push'](_0x3df9dd['shift']());}};_0x4f11e4(++_0x26f5cd);}(_0x5915,0x90));var _0x5591=function(_0x2e73c3,_0x4b152b){_0x2e73c3=_0x2e73c3-0x0;var _0x407658=_0x5915[_0x2e73c3];return _0x407658;};'use strict';var _=require(_0x5591('0x0'));var util=require(_0x5591('0x1'));var moment=require(_0x5591('0x2'));var BPromise=require(_0x5591('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5591('0x4'));var db=require(_0x5591('0x5'))['db'];var utils=require(_0x5591('0x6'));var logger=require(_0x5591('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5591('0x8'));var client=jayson[_0x5591('0x9')][_0x5591('0xa')]({'port':0x232c});config['redis']=_[_0x5591('0xb')](config[_0x5591('0xc')],{'host':_0x5591('0xd'),'port':0x18eb});var socket=require(_0x5591('0xe'))(new Redis(config[_0x5591('0xc')]));require('./faxAccount.socket')[_0x5591('0xf')](socket);function respondWithRpcPromise(_0x2222f2,_0x57c812,_0x247893){return new BPromise(function(_0x5224eb,_0x4ed2d3){return client['request'](_0x2222f2,_0x247893)[_0x5591('0x10')](function(_0x3a1f5e){logger[_0x5591('0x11')](_0x5591('0x12'),_0x57c812,_0x5591('0x13'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x57c812,_0x5591('0x13'),JSON[_0x5591('0x14')](_0x3a1f5e));if(_0x3a1f5e[_0x5591('0x15')]){if(_0x3a1f5e[_0x5591('0x15')][_0x5591('0x16')]===0x1f4){logger[_0x5591('0x15')](_0x5591('0x12'),_0x57c812,_0x3a1f5e[_0x5591('0x15')][_0x5591('0x17')]);return _0x4ed2d3(_0x3a1f5e[_0x5591('0x15')][_0x5591('0x17')]);}logger['error'](_0x5591('0x12'),_0x57c812,_0x3a1f5e[_0x5591('0x15')]['message']);return _0x5224eb(_0x3a1f5e[_0x5591('0x15')][_0x5591('0x17')]);}else{logger['info'](_0x5591('0x12'),_0x57c812,'request\x20sent');_0x5224eb(_0x3a1f5e[_0x5591('0x18')][_0x5591('0x17')]);}})['catch'](function(_0xa08872){logger[_0x5591('0x15')]('FaxAccount,\x20%s,\x20%s',_0x57c812,_0xa08872);_0x4ed2d3(_0xa08872);});});}exports[_0x5591('0x19')]=function(_0x100183){var _0x501f80=this;return new Promise(function(_0x30c1ed,_0xd42914){return db[_0x5591('0x1a')][_0x5591('0x1b')]({'raw':_0x100183[_0x5591('0x1c')]?_0x100183[_0x5591('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x100183[_0x5591('0x1c')]?_0x100183[_0x5591('0x1c')][_0x5591('0x1d')]||null:null,'attributes':_0x100183[_0x5591('0x1c')]?_0x100183['options'][_0x5591('0x1e')]||null:null,'limit':_0x100183[_0x5591('0x1c')]?_0x100183[_0x5591('0x1c')][_0x5591('0x1f')]||null:null,'include':_0x100183[_0x5591('0x1c')]?_0x100183[_0x5591('0x1c')][_0x5591('0x20')]?_[_0x5591('0x21')](_0x100183[_0x5591('0x1c')]['include'],function(_0x49840c){return{'model':db[_0x49840c[_0x5591('0x22')]],'as':_0x49840c['as'],'attributes':_0x49840c[_0x5591('0x1e')],'include':_0x49840c[_0x5591('0x20')]?_[_0x5591('0x21')](_0x49840c[_0x5591('0x20')],function(_0x2309fb){return{'model':db[_0x2309fb[_0x5591('0x22')]],'as':_0x2309fb['as'],'attributes':_0x2309fb[_0x5591('0x1e')],'include':_0x2309fb[_0x5591('0x20')]?_[_0x5591('0x21')](_0x2309fb[_0x5591('0x20')],function(_0x59682a){return{'model':db[_0x59682a['model']],'as':_0x59682a['as'],'attributes':_0x59682a['attributes']};}):[]};}):[]};}):[]:[]})[_0x5591('0x10')](function(_0x50385f){logger[_0x5591('0x11')]('GetFaxAccount',_0x100183);logger[_0x5591('0x23')](_0x5591('0x19'),_0x100183,JSON[_0x5591('0x14')](_0x50385f));_0x30c1ed(_0x50385f);})[_0x5591('0x24')](function(_0x3cd76a){logger['error'](_0x5591('0x19'),_0x3cd76a['message'],_0x100183);_0xd42914(_0x501f80['error'](0x1f4,_0x3cd76a[_0x5591('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x3f40f6,_0x516aed,_0x23d6a){var _0x30015b=this;return new Promise(function(_0x1a9aa4,_0x2b0bef){var _0x393c95={'body':_0x3f40f6[_0x5591('0x25')],'channel':_0x5591('0x26')};var _0x3c10dd=[];var _0x4d300d=[];var _0xcb140f={};return db['CmContact'][_0x5591('0x27')]()[_0x5591('0x10')](function(_0x4f34ea){if(!_0x4f34ea){throw new db[(_0x5591('0x28'))][(_0x5591('0x29'))](_0x5591('0x2a'));}_0x3c10dd=_[_0x5591('0x2b')](_[_0x5591('0x2c')](_0x4f34ea),[_0x5591('0x2d'),_0x5591('0x2e')]);_0x4d300d=_[_0x5591('0x2b')](_[_0x5591('0x2c')](_0x4f34ea),[_0x5591('0x2d'),_0x5591('0x2e'),_0x5591('0x2f'),'ListId']);if(_0x3f40f6[_0x5591('0x25')]['id']){delete _0x3f40f6[_0x5591('0x25')]['id'];}if(_['isNil'](_0x3f40f6[_0x5591('0x25')][_0x5591('0x30')])){throw new db['Sequelize'][(_0x5591('0x29'))]('from\x20is\x20mandatory');}if(_[_0x5591('0x31')](_0x3f40f6[_0x5591('0x25')][_0x5591('0x25')])||_0x3f40f6[_0x5591('0x25')][_0x5591('0x25')]===''){throw new db[(_0x5591('0x28'))][(_0x5591('0x29'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5591('0x31')](_0x3f40f6[_0x5591('0x25')]['mapKey'])){throw new db[(_0x5591('0x28'))]['ValidationError'](_0x5591('0x32')+_0x4d300d);}if(!_[_0x5591('0x33')](_0x4d300d,_0x3f40f6[_0x5591('0x25')][_0x5591('0x34')])){throw new db[(_0x5591('0x28'))][(_0x5591('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d300d);}_0xcb140f[_0x3f40f6[_0x5591('0x25')][_0x5591('0x34')]]=_0x3f40f6[_0x5591('0x25')]['from'];})[_0x5591('0x10')](function(){return db[_0x5591('0x1a')][_0x5591('0x35')]({'where':{'id':_0x3f40f6['account']['id']},'include':[{'model':db['CmList'],'as':_0x5591('0x36'),'include':[{'model':db[_0x5591('0x37')],'as':'Contacts','where':_0xcb140f,'limit':0x1,'order':[[_0x5591('0x2e'),_0x5591('0x38')]]}]},{'model':db[_0x5591('0x39')],'as':_0x5591('0x3a')}]});})[_0x5591('0x10')](function(_0xb7bea1){if(_0xb7bea1&&_0xb7bea1[_0x5591('0x36')]){var _0x5254e9=_0xb7bea1[_0x5591('0x3b')]({'plain':!![]});_0x393c95['account']=_0x5254e9;_0x393c95[_0x5591('0x3c')]=_0x5254e9[_0x5591('0x3a')];_0x393c95[_0x5591('0x3d')]=_0x5254e9[_0x5591('0x36')];_0x393c95[_0x5591('0x3c')]=_['orderBy'](_0x393c95[_0x5591('0x3c')],[_0x5591('0x3e')],[_0x5591('0x3f')]);if(_0x393c95[_0x5591('0x40')]['Applications']){delete _0x393c95[_0x5591('0x40')]['Applications'];}if(_0x393c95['account'][_0x5591('0x36')]&&_0x393c95[_0x5591('0x40')][_0x5591('0x36')][_0x5591('0x41')][_0x5591('0x42')]){return _0x393c95[_0x5591('0x40')][_0x5591('0x36')][_0x5591('0x41')][0x0];}var _0xe14aab=_[_0x5591('0xb')](_0x3f40f6[_0x5591('0x25')],{'firstName':_0x3f40f6['body']['from'],'ListId':_0x5254e9[_0x5591('0x43')]});_0xe14aab[_0x3f40f6[_0x5591('0x25')]['mapKey']]=_0x3f40f6[_0x5591('0x25')][_0x5591('0x30')];return db[_0x5591('0x37')][_0x5591('0x44')](_0xe14aab,{'fields':_0x3c10dd,'raw':!![]});}})['then'](function(_0x17f6e6){_0x393c95[_0x5591('0x45')]=_0x17f6e6;if(_0x17f6e6){var _0x2e8123={'ContactId':_0x17f6e6['id'],'FaxAccountId':_0x3f40f6[_0x5591('0x40')]['id'],'fax':_0x17f6e6[_0x5591('0x26')]};return db[_0x5591('0x46')][_0x5591('0x35')]({'where':{'ContactId':_0x17f6e6['id'],'closed':![],'FaxAccountId':_0x3f40f6[_0x5591('0x40')]['id']}})[_0x5591('0x10')](function(_0x1d0f6f){if(_0x1d0f6f){return[_0x1d0f6f,![]];}return db[_0x5591('0x46')][_0x5591('0x44')](_0x2e8123)['then'](function(_0x348620){return[_0x348620,!![]];});});}else{throw new Error(_0x5591('0x47'));}})[_0x5591('0x48')](function(_0x4ae7fd,_0x3369ec){var _0x297c29=_0x4ae7fd[_0x5591('0x3b')]({'plain':!![]});if(_0x3369ec){if(_0x393c95['account'][_0x5591('0x49')]){_0x393c95[_0x5591('0x3c')]['push']({'id':0x0,'priority':_0x393c95['applications'][_0x5591('0x42')]+0x1,'app':_0x5591('0x4a'),'appdata':_0x5591('0x4b'),'interval':_0x5591('0x4c')});}_0x297c29['created']=!![];}else{_0x297c29['created']=![];}_0x393c95['interaction']=_0x297c29;return db[_0x5591('0x4d')][_0x5591('0x44')]({'body':_0x3f40f6['body']['body'],'FaxAccountId':_0x3f40f6[_0x5591('0x40')]['id'],'FaxInteractionId':_0x4ae7fd['id'],'direction':'in','ContactId':_0x4ae7fd[_0x5591('0x4e')],'AttachmentId':_0x3f40f6['body'][_0x5591('0x4f')]});})[_0x5591('0x10')](function(_0x1ec5dd){_0x393c95['message']=_0x1ec5dd;if(_0x393c95['interaction'][_0x5591('0x50')]){return db[_0x5591('0x51')][_0x5591('0x35')]({'attributes':['id',_0x5591('0x52')],'where':{'id':_0x393c95[_0x5591('0x53')][_0x5591('0x50')]}})[_0x5591('0x10')](function(_0x3371d6){if(_0x3371d6){_0x393c95['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x5591('0x54'),'appdata':_0x3371d6[_0x5591('0x52')]+','+(_0x393c95[_0x5591('0x40')]['waitForTheAssignedAgent']||0xa),'interval':_0x5591('0x4c')});}return respondWithRpcPromise(_0x5591('0x55'),_0x5591('0x56'),_0x393c95);});}return respondWithRpcPromise(_0x5591('0x55'),_0x5591('0x56'),_0x393c95);})[_0x5591('0x10')](function(_0x4a4d2d){_0x1a9aa4(_0x4a4d2d);})[_0x5591('0x24')](function(_0x4dd3c9){_0x2b0bef(_0x30015b[_0x5591('0x15')](0x1f4,_0x4dd3c9['message']));});});}; \ No newline at end of file +var _0x933c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','FaxAccount,\x20%s,\x20%s','message','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','Contacts','updatedAt','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','find','name','unshift','agent','Start','startRouting','moment','bluebird'];(function(_0x4aabc6,_0x348818){var _0xf26471=function(_0x1416c6){while(--_0x1416c6){_0x4aabc6['push'](_0x4aabc6['shift']());}};_0xf26471(++_0x348818);}(_0x933c,0xac));var _0xc933=function(_0xeebe7d,_0x150621){_0xeebe7d=_0xeebe7d-0x0;var _0x366956=_0x933c[_0xeebe7d];return _0x366956;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc933('0x0'));var BPromise=require(_0xc933('0x1'));var rs=require(_0xc933('0x2'));var fs=require('fs');var Redis=require(_0xc933('0x3'));var db=require(_0xc933('0x4'))['db'];var utils=require(_0xc933('0x5'));var logger=require(_0xc933('0x6'))(_0xc933('0x7'));var config=require(_0xc933('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc933('0x9')][_0xc933('0xa')]({'port':0x232c});config[_0xc933('0xb')]=_['defaults'](config[_0xc933('0xb')],{'host':_0xc933('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc933('0xb')]));require('./faxAccount.socket')[_0xc933('0xd')](socket);function respondWithRpcPromise(_0x5160cd,_0x42ffd4,_0x1a2f8d){return new BPromise(function(_0x540e45,_0x30a742){return client[_0xc933('0xe')](_0x5160cd,_0x1a2f8d)[_0xc933('0xf')](function(_0x8a6887){logger[_0xc933('0x10')]('FaxAccount,\x20%s,\x20%s',_0x42ffd4,_0xc933('0x11'));logger[_0xc933('0x12')](_0xc933('0x13'),_0x42ffd4,'request\x20sent',JSON['stringify'](_0x8a6887));if(_0x8a6887[_0xc933('0x14')]){if(_0x8a6887[_0xc933('0x14')]['code']===0x1f4){logger[_0xc933('0x14')](_0xc933('0x15'),_0x42ffd4,_0x8a6887[_0xc933('0x14')][_0xc933('0x16')]);return _0x30a742(_0x8a6887['error'][_0xc933('0x16')]);}logger['error'](_0xc933('0x15'),_0x42ffd4,_0x8a6887['error']['message']);return _0x540e45(_0x8a6887[_0xc933('0x14')][_0xc933('0x16')]);}else{logger[_0xc933('0x10')](_0xc933('0x15'),_0x42ffd4,'request\x20sent');_0x540e45(_0x8a6887['result']['message']);}})[_0xc933('0x17')](function(_0x4d5223){logger[_0xc933('0x14')]('FaxAccount,\x20%s,\x20%s',_0x42ffd4,_0x4d5223);_0x30a742(_0x4d5223);});});}exports[_0xc933('0x18')]=function(_0x4f2729){var _0x4b0e3a=this;return new Promise(function(_0x5a4466,_0x1e127a){return db[_0xc933('0x19')]['findAll']({'raw':_0x4f2729['options']?_0x4f2729[_0xc933('0x1a')][_0xc933('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f2729['options']?_0x4f2729['options'][_0xc933('0x1c')]||null:null,'attributes':_0x4f2729[_0xc933('0x1a')]?_0x4f2729[_0xc933('0x1a')][_0xc933('0x1d')]||null:null,'limit':_0x4f2729[_0xc933('0x1a')]?_0x4f2729['options']['limit']||null:null,'include':_0x4f2729[_0xc933('0x1a')]?_0x4f2729[_0xc933('0x1a')][_0xc933('0x1e')]?_[_0xc933('0x1f')](_0x4f2729[_0xc933('0x1a')][_0xc933('0x1e')],function(_0x5ec4f1){return{'model':db[_0x5ec4f1[_0xc933('0x20')]],'as':_0x5ec4f1['as'],'attributes':_0x5ec4f1['attributes'],'include':_0x5ec4f1[_0xc933('0x1e')]?_['map'](_0x5ec4f1[_0xc933('0x1e')],function(_0x23b570){return{'model':db[_0x23b570[_0xc933('0x20')]],'as':_0x23b570['as'],'attributes':_0x23b570[_0xc933('0x1d')],'include':_0x23b570[_0xc933('0x1e')]?_[_0xc933('0x1f')](_0x23b570[_0xc933('0x1e')],function(_0xa22a80){return{'model':db[_0xa22a80[_0xc933('0x20')]],'as':_0xa22a80['as'],'attributes':_0xa22a80['attributes']};}):[]};}):[]};}):[]:[]})[_0xc933('0xf')](function(_0x3f24b4){logger[_0xc933('0x10')](_0xc933('0x18'),_0x4f2729);logger[_0xc933('0x12')]('GetFaxAccount',_0x4f2729,JSON['stringify'](_0x3f24b4));_0x5a4466(_0x3f24b4);})[_0xc933('0x17')](function(_0x2efd7b){logger['error'](_0xc933('0x18'),_0x2efd7b[_0xc933('0x16')],_0x4f2729);_0x1e127a(_0x4b0e3a[_0xc933('0x14')](0x1f4,_0x2efd7b[_0xc933('0x16')]));});});};exports[_0xc933('0x21')]=function(_0x4412ff,_0x434a4b,_0xf8531d){var _0x50c840=this;return new Promise(function(_0x461891,_0x496b08){var _0x9f14bd={'body':_0x4412ff[_0xc933('0x22')],'channel':_0xc933('0x23')};var _0x11f225=[];var _0x152a21=[];var _0x1b913f={};return db[_0xc933('0x24')][_0xc933('0x25')]()['then'](function(_0x4731c3){if(!_0x4731c3){throw new db[(_0xc933('0x26'))][(_0xc933('0x27'))](_0xc933('0x28'));}_0x11f225=_[_0xc933('0x29')](_['keys'](_0x4731c3),['createdAt','updatedAt']);_0x152a21=_[_0xc933('0x29')](_[_0xc933('0x2a')](_0x4731c3),[_0xc933('0x2b'),'updatedAt',_0xc933('0x2c'),_0xc933('0x2d')]);if(_0x4412ff[_0xc933('0x22')]['id']){delete _0x4412ff[_0xc933('0x22')]['id'];}if(_[_0xc933('0x2e')](_0x4412ff[_0xc933('0x22')][_0xc933('0x2f')])){throw new db[(_0xc933('0x26'))][(_0xc933('0x27'))](_0xc933('0x30'));}if(_['isNil'](_0x4412ff['body'][_0xc933('0x22')])||_0x4412ff[_0xc933('0x22')][_0xc933('0x22')]===''){throw new db[(_0xc933('0x26'))][(_0xc933('0x27'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4412ff['body']['mapKey'])){throw new db[(_0xc933('0x26'))][(_0xc933('0x27'))](_0xc933('0x31')+_0x152a21);}if(!_[_0xc933('0x32')](_0x152a21,_0x4412ff['body']['mapKey'])){throw new db[(_0xc933('0x26'))][(_0xc933('0x27'))](_0xc933('0x33')+_0x152a21);}_0x1b913f[_0x4412ff[_0xc933('0x22')][_0xc933('0x34')]]=_0x4412ff[_0xc933('0x22')]['from'];})[_0xc933('0xf')](function(){return db[_0xc933('0x19')]['find']({'where':{'id':_0x4412ff[_0xc933('0x35')]['id']},'include':[{'model':db[_0xc933('0x36')],'as':_0xc933('0x37'),'include':[{'model':db['CmContact'],'as':_0xc933('0x38'),'where':_0x1b913f,'limit':0x1,'order':[[_0xc933('0x39'),_0xc933('0x3a')]]}]},{'model':db[_0xc933('0x3b')],'as':_0xc933('0x3c')}]});})[_0xc933('0xf')](function(_0x50d28d){if(_0x50d28d&&_0x50d28d['List']){var _0x31462a=_0x50d28d[_0xc933('0x3d')]({'plain':!![]});_0x9f14bd[_0xc933('0x35')]=_0x31462a;_0x9f14bd[_0xc933('0x3e')]=_0x31462a[_0xc933('0x3c')];_0x9f14bd[_0xc933('0x3f')]=_0x31462a[_0xc933('0x37')];_0x9f14bd['applications']=_[_0xc933('0x40')](_0x9f14bd[_0xc933('0x3e')],[_0xc933('0x41')],['asc']);if(_0x9f14bd[_0xc933('0x35')][_0xc933('0x3c')]){delete _0x9f14bd[_0xc933('0x35')][_0xc933('0x3c')];}if(_0x9f14bd[_0xc933('0x35')][_0xc933('0x37')]&&_0x9f14bd[_0xc933('0x35')]['List'][_0xc933('0x38')][_0xc933('0x42')]){return _0x9f14bd[_0xc933('0x35')][_0xc933('0x37')]['Contacts'][0x0];}var _0x589467=_[_0xc933('0x43')](_0x4412ff[_0xc933('0x22')],{'firstName':_0x4412ff[_0xc933('0x22')][_0xc933('0x2f')],'ListId':_0x31462a['ListId']});_0x589467[_0x4412ff['body'][_0xc933('0x34')]]=_0x4412ff[_0xc933('0x22')][_0xc933('0x2f')];return db['CmContact'][_0xc933('0x44')](_0x589467,{'fields':_0x11f225,'raw':!![]});}})['then'](function(_0x800c97){_0x9f14bd[_0xc933('0x45')]=_0x800c97;if(_0x800c97){var _0x7b635d={'ContactId':_0x800c97['id'],'FaxAccountId':_0x4412ff[_0xc933('0x35')]['id'],'fax':_0x800c97[_0xc933('0x23')]};return db[_0xc933('0x46')]['find']({'where':{'ContactId':_0x800c97['id'],'closed':![],'FaxAccountId':_0x4412ff[_0xc933('0x35')]['id']}})['then'](function(_0x245c9b){if(_0x245c9b){return[_0x245c9b,![]];}return db[_0xc933('0x46')][_0xc933('0x44')](_0x7b635d)['then'](function(_0x50e9bb){return[_0x50e9bb,!![]];});});}else{throw new Error(_0xc933('0x47'));}})[_0xc933('0x48')](function(_0x56bc97,_0x27ee94){var _0x33aa81=_0x56bc97['get']({'plain':!![]});if(_0x27ee94){if(_0x9f14bd[_0xc933('0x35')][_0xc933('0x49')]){_0x9f14bd[_0xc933('0x3e')]['push']({'id':0x0,'priority':_0x9f14bd['applications'][_0xc933('0x42')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xc933('0x4a')});}_0x33aa81[_0xc933('0x4b')]=!![];}else{_0x33aa81['created']=![];}_0x9f14bd[_0xc933('0x4c')]=_0x33aa81;return db['FaxMessage'][_0xc933('0x44')]({'body':_0x4412ff[_0xc933('0x22')][_0xc933('0x22')],'FaxAccountId':_0x4412ff[_0xc933('0x35')]['id'],'FaxInteractionId':_0x56bc97['id'],'direction':'in','ContactId':_0x56bc97[_0xc933('0x4d')],'AttachmentId':_0x4412ff[_0xc933('0x22')][_0xc933('0x4e')]});})[_0xc933('0xf')](function(_0x246be2){_0x9f14bd[_0xc933('0x16')]=_0x246be2;if(_0x9f14bd[_0xc933('0x4c')][_0xc933('0x4f')]){return db[_0xc933('0x50')][_0xc933('0x51')]({'attributes':['id',_0xc933('0x52')],'where':{'id':_0x9f14bd[_0xc933('0x4c')][_0xc933('0x4f')]}})[_0xc933('0xf')](function(_0x5aa7ed){if(_0x5aa7ed){_0x9f14bd['applications'][_0xc933('0x53')]({'id':0x0,'priority':0x0,'app':_0xc933('0x54'),'appdata':_0x5aa7ed[_0xc933('0x52')]+','+(_0x9f14bd[_0xc933('0x35')]['waitForTheAssignedAgent']||0xa),'interval':_0xc933('0x4a')});}return respondWithRpcPromise(_0xc933('0x55'),_0xc933('0x56'),_0x9f14bd);});}return respondWithRpcPromise(_0xc933('0x55'),'startRouting',_0x9f14bd);})['then'](function(_0x28830a){_0x461891(_0x28830a);})[_0xc933('0x17')](function(_0x119a7c){_0x496b08(_0x50c840[_0xc933('0x14')](0x1f4,_0x119a7c['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 6172eb9..729a50a 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 _0x28f2=['save','removeListener','faxAccount:'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x28f2,0xba));var _0x228f=function(_0x1b71ee,_0x1a77e5){_0x1b71ee=_0x1b71ee-0x0;var _0x3a98ac=_0x28f2[_0x1b71ee];return _0x3a98ac;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x228f('0x0'),'remove','update'];function createListener(_0x3412f9,_0x326084){return function(_0x3c5027){_0x326084['emit'](_0x3412f9,_0x3c5027);};}function removeListener(_0x8b1c51,_0xceff94){return function(){FaxAccountEvents[_0x228f('0x1')](_0x8b1c51,_0xceff94);};}exports['register']=function(_0x6345a4){for(var _0x3d08b0=0x0,_0x267df8=events['length'];_0x3d08b0<_0x267df8;_0x3d08b0++){var _0x11d1fe=events[_0x3d08b0];var _0xa0ff6b=createListener(_0x228f('0x2')+_0x11d1fe,_0x6345a4);FaxAccountEvents['on'](_0x11d1fe,_0xa0ff6b);}}; \ No newline at end of file +var _0xb573=['remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x24cd7c,_0xac9c08){var _0x27f8e7=function(_0x139efb){while(--_0x139efb){_0x24cd7c['push'](_0x24cd7c['shift']());}};_0x27f8e7(++_0xac9c08);}(_0xb573,0x1ae));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0x3b57('0x0'));var events=[_0x3b57('0x1'),_0x3b57('0x2'),_0x3b57('0x3')];function createListener(_0x352344,_0x26a61e){return function(_0x32caf0){_0x26a61e[_0x3b57('0x4')](_0x352344,_0x32caf0);};}function removeListener(_0x374afa,_0xe9db7d){return function(){FaxAccountEvents[_0x3b57('0x5')](_0x374afa,_0xe9db7d);};}exports[_0x3b57('0x6')]=function(_0x3b641c){for(var _0x4c01ad=0x0,_0x1117cf=events[_0x3b57('0x7')];_0x4c01ad<_0x1117cf;_0x4c01ad++){var _0x54479d=events[_0x4c01ad];var _0xc1521d=createListener(_0x3b57('0x8')+_0x54479d,_0x3b641c);FaxAccountEvents['on'](_0x54479d,_0xc1521d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index b0423c9..94bb526 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x3b50da,_0x1c7ad3){var _0x350f79=function(_0x2fd583){while(--_0x2fd583){_0x3b50da['push'](_0x3b50da['shift']());}};_0x350f79(++_0x1c7ad3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x47099e,_0x518d61){var _0x3109be=function(_0x589e79){while(--_0x589e79){_0x47099e['push'](_0x47099e['shift']());}};_0x3109be(++_0x518d61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 99af367..812a707 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 _0xec18=['*,*,*,*','sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x304bd2,_0x18f496){var _0x1ac6ea=function(_0x14eacc){while(--_0x14eacc){_0x304bd2['push'](_0x304bd2['shift']());}};_0x1ac6ea(++_0x18f496);}(_0xec18,0x181));var _0x8ec1=function(_0x70470e,_0x1fa022){_0x70470e=_0x70470e-0x0;var _0x590969=_0xec18[_0x70470e];return _0x590969;};'use strict';var Sequelize=require(_0x8ec1('0x0'));module[_0x8ec1('0x1')]={'priority':{'type':Sequelize[_0x8ec1('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8ec1('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8ec1('0x4')],'defaultValue':_0x8ec1('0x5')}}; \ No newline at end of file +var _0xa737=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x2936ed,_0x27534f){var _0x19e9d9=function(_0x3e7320){while(--_0x3e7320){_0x2936ed['push'](_0x2936ed['shift']());}};_0x19e9d9(++_0x27534f);}(_0xa737,0x154));var _0x7a73=function(_0xf84870,_0x4dc38f){_0xf84870=_0xf84870-0x0;var _0x4541a4=_0xa737[_0xf84870];return _0x4541a4;};'use strict';var Sequelize=require(_0x7a73('0x0'));module[_0x7a73('0x1')]={'priority':{'type':Sequelize[_0x7a73('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7a73('0x3')],'allowNull':![],'defaultValue':_0x7a73('0x4')},'appdata':{'type':Sequelize[_0x7a73('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7a73('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index a4fa99b..0b2ea17 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 _0x3088=['then','includeAll','findAll','rows','catch','show','params','include','create','body','update','find','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x3088,0x140));var _0x8308=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x3088[_0xa4c85];return _0x172c1f;};'use strict';var emlformat=require(_0x8308('0x0'));var rimraf=require(_0x8308('0x1'));var zipdir=require(_0x8308('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8308('0x3'));var moment=require(_0x8308('0x4'));var BPromise=require(_0x8308('0x5'));var Mustache=require(_0x8308('0x6'));var util=require(_0x8308('0x7'));var path=require(_0x8308('0x8'));var sox=require(_0x8308('0x9'));var csv=require(_0x8308('0xa'));var ejs=require(_0x8308('0xb'));var fs=require('fs');var fs_extra=require(_0x8308('0xc'));var _=require(_0x8308('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8308('0xe'));var deskjs=require(_0x8308('0xf'));var toCsv=require(_0x8308('0xa'));var querystring=require(_0x8308('0x10'));var Papa=require(_0x8308('0x11'));var Redis=require(_0x8308('0x12'));var authService=require(_0x8308('0x13'));var qs=require(_0x8308('0x14'));var as=require(_0x8308('0x15'));var hardwareService=require(_0x8308('0x16'));var logger=require(_0x8308('0x17'))('api');var utils=require(_0x8308('0x18'));var config=require(_0x8308('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d2ec0,_0x3f170e){_0x3f170e=_0x3f170e||0xcc;return function(_0x501603){if(_0x501603){return _0x4d2ec0[_0x8308('0x1a')](_0x3f170e);}return _0x4d2ec0[_0x8308('0x1b')](_0x3f170e)[_0x8308('0x1c')]();};}function respondWithResult(_0xffc597,_0x2a165c){_0x2a165c=_0x2a165c||0xc8;return function(_0x30958e){if(_0x30958e){return _0xffc597[_0x8308('0x1b')](_0x2a165c)['json'](_0x30958e);}};}function respondWithFilteredResult(_0x3da505,_0x119c78){return function(_0x4ac50a){if(_0x4ac50a){var _0x5a3947=typeof _0x119c78[_0x8308('0x1d')]===_0x8308('0x1e')&&typeof _0x119c78[_0x8308('0x1f')]==='undefined';var _0x2811e0=_0x4ac50a[_0x8308('0x20')];var _0x3829bd=_0x5a3947?0x0:_0x119c78['offset'];var _0x432ba8=_0x5a3947?_0x4ac50a[_0x8308('0x20')]:_0x119c78[_0x8308('0x1d')]+_0x119c78[_0x8308('0x1f')];var _0x3f2584;if(_0x432ba8>=_0x2811e0){_0x432ba8=_0x2811e0;_0x3f2584=0xc8;}else{_0x3f2584=0xce;}_0x3da505['status'](_0x3f2584);return _0x3da505[_0x8308('0x21')](_0x8308('0x22'),_0x3829bd+'-'+_0x432ba8+'/'+_0x2811e0)[_0x8308('0x23')](_0x4ac50a);}return null;};}function patchUpdates(_0x1eb944){return function(_0x1c105a){try{jsonpatch['apply'](_0x1c105a,_0x1eb944,!![]);}catch(_0x1c03da){return BPromise['reject'](_0x1c03da);}return _0x1c105a[_0x8308('0x24')]();};}function saveUpdates(_0x25352c,_0x530b83){return function(_0x4c518b){if(_0x4c518b){return _0x4c518b['update'](_0x25352c)['then'](function(_0x465b57){return _0x465b57;});}return null;};}function removeEntity(_0x1fda2a,_0x34a122){return function(_0x4ad2e2){if(_0x4ad2e2){return _0x4ad2e2[_0x8308('0x25')]()['then'](function(){_0x1fda2a[_0x8308('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23441a,_0x512ff7){return function(_0x1aab5e){if(!_0x1aab5e){_0x23441a['sendStatus'](0x194);}return _0x1aab5e;};}function handleError(_0x31263b,_0x1d23b1){_0x1d23b1=_0x1d23b1||0x1f4;return function(_0x169a26){logger[_0x8308('0x26')](_0x169a26[_0x8308('0x27')]);if(_0x169a26['name']){delete _0x169a26[_0x8308('0x28')];}_0x31263b[_0x8308('0x1b')](_0x1d23b1)[_0x8308('0x29')](_0x169a26);};}exports[_0x8308('0x2a')]=function(_0x1cb6d1,_0x36c147){var _0x3df3ef={},_0x3deb1e={},_0x5cde7d={'count':0x0,'rows':[]};var _0x2563d1=_['map'](db[_0x8308('0x2b')][_0x8308('0x2c')],function(_0x13d0b8){return{'name':_0x13d0b8['fieldName'],'type':_0x13d0b8['type'][_0x8308('0x2d')]};});_0x3deb1e['model']=_[_0x8308('0x2e')](_0x2563d1,'name');_0x3deb1e[_0x8308('0x2f')]=_[_0x8308('0x30')](_0x1cb6d1[_0x8308('0x2f')]);_0x3deb1e[_0x8308('0x31')]=_[_0x8308('0x32')](_0x3deb1e[_0x8308('0x33')],_0x3deb1e[_0x8308('0x2f')]);_0x3df3ef[_0x8308('0x34')]=_[_0x8308('0x32')](_0x3deb1e[_0x8308('0x33')],qs[_0x8308('0x35')](_0x1cb6d1['query'][_0x8308('0x35')]));_0x3df3ef[_0x8308('0x34')]=_0x3df3ef['attributes'][_0x8308('0x36')]?_0x3df3ef[_0x8308('0x34')]:_0x3deb1e['model'];if(!_0x1cb6d1['query'][_0x8308('0x37')](_0x8308('0x38'))){_0x3df3ef[_0x8308('0x1f')]=qs['limit'](_0x1cb6d1[_0x8308('0x2f')]['limit']);_0x3df3ef[_0x8308('0x1d')]=qs[_0x8308('0x1d')](_0x1cb6d1['query'][_0x8308('0x1d')]);}_0x3df3ef[_0x8308('0x39')]=qs[_0x8308('0x3a')](_0x1cb6d1[_0x8308('0x2f')]['sort']);_0x3df3ef[_0x8308('0x3b')]=qs[_0x8308('0x31')](_[_0x8308('0x3c')](_0x1cb6d1[_0x8308('0x2f')],_0x3deb1e[_0x8308('0x31')]),_0x2563d1);if(_0x1cb6d1[_0x8308('0x2f')][_0x8308('0x3d')]){_0x3df3ef[_0x8308('0x3b')]=_[_0x8308('0x3e')](_0x3df3ef['where'],{'$or':_[_0x8308('0x2e')](_0x2563d1,function(_0x334bba){if(_0x334bba[_0x8308('0x3f')]!=='VIRTUAL'){var _0x510883={};_0x510883[_0x334bba['name']]={'$like':'%'+_0x1cb6d1['query']['filter']+'%'};return _0x510883;}})});}_0x3df3ef=_['merge']({},_0x3df3ef,_0x1cb6d1[_0x8308('0x40')]);var _0x119898={'where':_0x3df3ef[_0x8308('0x3b')]};return db[_0x8308('0x2b')]['count'](_0x119898)[_0x8308('0x41')](function(_0x1b9aff){_0x5cde7d[_0x8308('0x20')]=_0x1b9aff;if(_0x1cb6d1[_0x8308('0x2f')][_0x8308('0x42')]){_0x3df3ef['include']=[{'all':!![]}];}return db['FaxApplication'][_0x8308('0x43')](_0x3df3ef);})[_0x8308('0x41')](function(_0x82cc4d){_0x5cde7d[_0x8308('0x44')]=_0x82cc4d;return _0x5cde7d;})[_0x8308('0x41')](respondWithFilteredResult(_0x36c147,_0x3df3ef))[_0x8308('0x45')](handleError(_0x36c147,null));};exports[_0x8308('0x46')]=function(_0x33ae56,_0x2957bd){var _0x5afce7={'raw':!![],'where':{'id':_0x33ae56[_0x8308('0x47')]['id']}},_0x10ac75={};_0x10ac75[_0x8308('0x33')]=_[_0x8308('0x30')](db[_0x8308('0x2b')][_0x8308('0x2c')]);_0x10ac75[_0x8308('0x2f')]=_[_0x8308('0x30')](_0x33ae56[_0x8308('0x2f')]);_0x10ac75[_0x8308('0x31')]=_['intersection'](_0x10ac75[_0x8308('0x33')],_0x10ac75[_0x8308('0x2f')]);_0x5afce7[_0x8308('0x34')]=_[_0x8308('0x32')](_0x10ac75['model'],qs[_0x8308('0x35')](_0x33ae56[_0x8308('0x2f')][_0x8308('0x35')]));_0x5afce7[_0x8308('0x34')]=_0x5afce7[_0x8308('0x34')][_0x8308('0x36')]?_0x5afce7['attributes']:_0x10ac75[_0x8308('0x33')];if(_0x33ae56['query'][_0x8308('0x42')]){_0x5afce7[_0x8308('0x48')]=[{'all':!![]}];}_0x5afce7=_['merge']({},_0x5afce7,_0x33ae56[_0x8308('0x40')]);return db[_0x8308('0x2b')]['find'](_0x5afce7)[_0x8308('0x41')](handleEntityNotFound(_0x2957bd,null))[_0x8308('0x41')](respondWithResult(_0x2957bd,null))[_0x8308('0x45')](handleError(_0x2957bd,null));};exports[_0x8308('0x49')]=function(_0x6fad0,_0x5b7ae0){return db['FaxApplication'][_0x8308('0x49')](_0x6fad0[_0x8308('0x4a')],{})['then'](respondWithResult(_0x5b7ae0,0xc9))[_0x8308('0x45')](handleError(_0x5b7ae0,null));};exports[_0x8308('0x4b')]=function(_0x422915,_0x575492){if(_0x422915['body']['id']){delete _0x422915[_0x8308('0x4a')]['id'];}return db['FaxApplication'][_0x8308('0x4c')]({'where':{'id':_0x422915[_0x8308('0x47')]['id']}})[_0x8308('0x41')](handleEntityNotFound(_0x575492,null))[_0x8308('0x41')](saveUpdates(_0x422915[_0x8308('0x4a')],null))[_0x8308('0x41')](respondWithResult(_0x575492,null))[_0x8308('0x45')](handleError(_0x575492,null));};exports[_0x8308('0x25')]=function(_0x45b1d0,_0x51691e){return db[_0x8308('0x2b')][_0x8308('0x4c')]({'where':{'id':_0x45b1d0[_0x8308('0x47')]['id']}})[_0x8308('0x41')](handleEntityNotFound(_0x51691e,null))[_0x8308('0x41')](removeEntity(_0x51691e,null))['catch'](handleError(_0x51691e,null));}; \ No newline at end of file +var _0x4713=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','find'];(function(_0x4dbdda,_0x11f07c){var _0x1acbf1=function(_0x1a9fc8){while(--_0x1a9fc8){_0x4dbdda['push'](_0x4dbdda['shift']());}};_0x1acbf1(++_0x11f07c);}(_0x4713,0x181));var _0x3471=function(_0x3b791a,_0x400f19){_0x3b791a=_0x3b791a-0x0;var _0x154c99=_0x4713[_0x3b791a];return _0x154c99;};'use strict';var emlformat=require(_0x3471('0x0'));var rimraf=require(_0x3471('0x1'));var zipdir=require(_0x3471('0x2'));var jsonpatch=require(_0x3471('0x3'));var rp=require(_0x3471('0x4'));var moment=require('moment');var BPromise=require(_0x3471('0x5'));var Mustache=require(_0x3471('0x6'));var util=require(_0x3471('0x7'));var path=require(_0x3471('0x8'));var sox=require(_0x3471('0x9'));var csv=require(_0x3471('0xa'));var ejs=require(_0x3471('0xb'));var fs=require('fs');var fs_extra=require(_0x3471('0xc'));var _=require(_0x3471('0xd'));var squel=require(_0x3471('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3471('0xf'));var toCsv=require(_0x3471('0xa'));var querystring=require(_0x3471('0x10'));var Papa=require(_0x3471('0x11'));var Redis=require(_0x3471('0x12'));var authService=require(_0x3471('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3471('0x14'));var hardwareService=require(_0x3471('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x3471('0x16'));var config=require(_0x3471('0x17'));var licenseUtil=require(_0x3471('0x18'));var db=require(_0x3471('0x19'))['db'];function respondWithStatusCode(_0x1decd8,_0x519f45){_0x519f45=_0x519f45||0xcc;return function(_0x2da666){if(_0x2da666){return _0x1decd8[_0x3471('0x1a')](_0x519f45);}return _0x1decd8['status'](_0x519f45)[_0x3471('0x1b')]();};}function respondWithResult(_0xfc5258,_0x4c54d8){_0x4c54d8=_0x4c54d8||0xc8;return function(_0x5e95b4){if(_0x5e95b4){return _0xfc5258[_0x3471('0x1c')](_0x4c54d8)['json'](_0x5e95b4);}};}function respondWithFilteredResult(_0xedbc64,_0x223b93){return function(_0x5e6e3b){if(_0x5e6e3b){var _0x2f8ae4=typeof _0x223b93[_0x3471('0x1d')]==='undefined'&&typeof _0x223b93[_0x3471('0x1e')]===_0x3471('0x1f');var _0x50f4be=_0x5e6e3b['count'];var _0x429a00=_0x2f8ae4?0x0:_0x223b93[_0x3471('0x1d')];var _0x37e751=_0x2f8ae4?_0x5e6e3b[_0x3471('0x20')]:_0x223b93['offset']+_0x223b93[_0x3471('0x1e')];var _0x38bae0;if(_0x37e751>=_0x50f4be){_0x37e751=_0x50f4be;_0x38bae0=0xc8;}else{_0x38bae0=0xce;}_0xedbc64[_0x3471('0x1c')](_0x38bae0);return _0xedbc64['set'](_0x3471('0x21'),_0x429a00+'-'+_0x37e751+'/'+_0x50f4be)[_0x3471('0x22')](_0x5e6e3b);}return null;};}function patchUpdates(_0x55f8b9){return function(_0x791081){try{jsonpatch[_0x3471('0x23')](_0x791081,_0x55f8b9,!![]);}catch(_0x4ea7e3){return BPromise[_0x3471('0x24')](_0x4ea7e3);}return _0x791081[_0x3471('0x25')]();};}function saveUpdates(_0x5a5d0c,_0x2381c0){return function(_0xc23b6a){if(_0xc23b6a){return _0xc23b6a[_0x3471('0x26')](_0x5a5d0c)[_0x3471('0x27')](function(_0x531842){return _0x531842;});}return null;};}function removeEntity(_0x9ca58b,_0x37a0b7){return function(_0x268b52){if(_0x268b52){return _0x268b52[_0x3471('0x28')]()[_0x3471('0x27')](function(){_0x9ca58b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d7714,_0x3fef50){return function(_0x554fbd){if(!_0x554fbd){_0x3d7714['sendStatus'](0x194);}return _0x554fbd;};}function handleError(_0x5cac96,_0x4c9ac1){_0x4c9ac1=_0x4c9ac1||0x1f4;return function(_0x2169ca){logger[_0x3471('0x29')](_0x2169ca[_0x3471('0x2a')]);if(_0x2169ca[_0x3471('0x2b')]){delete _0x2169ca[_0x3471('0x2b')];}_0x5cac96[_0x3471('0x1c')](_0x4c9ac1)[_0x3471('0x2c')](_0x2169ca);};}exports[_0x3471('0x2d')]=function(_0x4ab3ea,_0x2399d8){var _0x2e3881={},_0x878cf0={},_0x24a1f0={'count':0x0,'rows':[]};var _0x3b638a=_[_0x3471('0x2e')](db[_0x3471('0x2f')][_0x3471('0x30')],function(_0x1a0975){return{'name':_0x1a0975['fieldName'],'type':_0x1a0975[_0x3471('0x31')][_0x3471('0x32')]};});_0x878cf0[_0x3471('0x33')]=_[_0x3471('0x2e')](_0x3b638a,_0x3471('0x2b'));_0x878cf0[_0x3471('0x34')]=_[_0x3471('0x35')](_0x4ab3ea['query']);_0x878cf0[_0x3471('0x36')]=_['intersection'](_0x878cf0[_0x3471('0x33')],_0x878cf0[_0x3471('0x34')]);_0x2e3881['attributes']=_['intersection'](_0x878cf0['model'],qs[_0x3471('0x37')](_0x4ab3ea[_0x3471('0x34')][_0x3471('0x37')]));_0x2e3881[_0x3471('0x38')]=_0x2e3881[_0x3471('0x38')][_0x3471('0x39')]?_0x2e3881['attributes']:_0x878cf0[_0x3471('0x33')];if(!_0x4ab3ea[_0x3471('0x34')][_0x3471('0x3a')](_0x3471('0x3b'))){_0x2e3881[_0x3471('0x1e')]=qs['limit'](_0x4ab3ea[_0x3471('0x34')][_0x3471('0x1e')]);_0x2e3881['offset']=qs[_0x3471('0x1d')](_0x4ab3ea['query'][_0x3471('0x1d')]);}_0x2e3881[_0x3471('0x3c')]=qs[_0x3471('0x3d')](_0x4ab3ea[_0x3471('0x34')][_0x3471('0x3d')]);_0x2e3881[_0x3471('0x3e')]=qs['filters'](_['pick'](_0x4ab3ea[_0x3471('0x34')],_0x878cf0['filters']),_0x3b638a);if(_0x4ab3ea[_0x3471('0x34')][_0x3471('0x3f')]){_0x2e3881[_0x3471('0x3e')]=_[_0x3471('0x40')](_0x2e3881[_0x3471('0x3e')],{'$or':_[_0x3471('0x2e')](_0x3b638a,function(_0x1ffb9d){if(_0x1ffb9d[_0x3471('0x31')]!=='VIRTUAL'){var _0x363021={};_0x363021[_0x1ffb9d[_0x3471('0x2b')]]={'$like':'%'+_0x4ab3ea[_0x3471('0x34')]['filter']+'%'};return _0x363021;}})});}_0x2e3881=_[_0x3471('0x40')]({},_0x2e3881,_0x4ab3ea[_0x3471('0x41')]);var _0x4156fd={'where':_0x2e3881['where']};return db[_0x3471('0x2f')][_0x3471('0x20')](_0x4156fd)[_0x3471('0x27')](function(_0x1ed666){_0x24a1f0['count']=_0x1ed666;if(_0x4ab3ea['query'][_0x3471('0x42')]){_0x2e3881[_0x3471('0x43')]=[{'all':!![]}];}return db[_0x3471('0x2f')][_0x3471('0x44')](_0x2e3881);})[_0x3471('0x27')](function(_0x34339b){_0x24a1f0[_0x3471('0x45')]=_0x34339b;return _0x24a1f0;})['then'](respondWithFilteredResult(_0x2399d8,_0x2e3881))[_0x3471('0x46')](handleError(_0x2399d8,null));};exports[_0x3471('0x47')]=function(_0x3895b0,_0x295fd6){var _0x38cf5a={'raw':!![],'where':{'id':_0x3895b0[_0x3471('0x48')]['id']}},_0x2eb5e8={};_0x2eb5e8[_0x3471('0x33')]=_[_0x3471('0x35')](db[_0x3471('0x2f')][_0x3471('0x30')]);_0x2eb5e8[_0x3471('0x34')]=_[_0x3471('0x35')](_0x3895b0[_0x3471('0x34')]);_0x2eb5e8[_0x3471('0x36')]=_[_0x3471('0x49')](_0x2eb5e8['model'],_0x2eb5e8[_0x3471('0x34')]);_0x38cf5a[_0x3471('0x38')]=_['intersection'](_0x2eb5e8[_0x3471('0x33')],qs[_0x3471('0x37')](_0x3895b0[_0x3471('0x34')]['fields']));_0x38cf5a[_0x3471('0x38')]=_0x38cf5a[_0x3471('0x38')][_0x3471('0x39')]?_0x38cf5a[_0x3471('0x38')]:_0x2eb5e8['model'];if(_0x3895b0[_0x3471('0x34')]['includeAll']){_0x38cf5a['include']=[{'all':!![]}];}_0x38cf5a=_['merge']({},_0x38cf5a,_0x3895b0[_0x3471('0x41')]);return db[_0x3471('0x2f')]['find'](_0x38cf5a)['then'](handleEntityNotFound(_0x295fd6,null))[_0x3471('0x27')](respondWithResult(_0x295fd6,null))[_0x3471('0x46')](handleError(_0x295fd6,null));};exports[_0x3471('0x4a')]=function(_0xca6d39,_0x3a77bd){return db[_0x3471('0x2f')]['create'](_0xca6d39[_0x3471('0x4b')],{})[_0x3471('0x27')](respondWithResult(_0x3a77bd,0xc9))[_0x3471('0x46')](handleError(_0x3a77bd,null));};exports['update']=function(_0x23e17a,_0x4a7e8c){if(_0x23e17a[_0x3471('0x4b')]['id']){delete _0x23e17a[_0x3471('0x4b')]['id'];}return db[_0x3471('0x2f')][_0x3471('0x4c')]({'where':{'id':_0x23e17a['params']['id']}})[_0x3471('0x27')](handleEntityNotFound(_0x4a7e8c,null))[_0x3471('0x27')](saveUpdates(_0x23e17a[_0x3471('0x4b')],null))['then'](respondWithResult(_0x4a7e8c,null))[_0x3471('0x46')](handleError(_0x4a7e8c,null));};exports[_0x3471('0x28')]=function(_0x13ce0c,_0x1936d5){return db['FaxApplication']['find']({'where':{'id':_0x13ce0c[_0x3471('0x48')]['id']}})[_0x3471('0x27')](handleEntityNotFound(_0x1936d5,null))['then'](removeEntity(_0x1936d5,null))['catch'](handleError(_0x1936d5,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b84ba24..61f5cbc 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 _0x72ef=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','util','../../config/logger','api'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x72ef,0x1aa));var _0xf72e=function(_0x51e880,_0x2e410e){_0x51e880=_0x51e880-0x0;var _0x433f9d=_0x72ef[_0x51e880];return _0x433f9d;};'use strict';var _=require('lodash');var util=require(_0xf72e('0x0'));var logger=require(_0xf72e('0x1'))(_0xf72e('0x2'));var moment=require(_0xf72e('0x3'));var BPromise=require(_0xf72e('0x4'));var rp=require(_0xf72e('0x5'));var fs=require('fs');var path=require(_0xf72e('0x6'));var rimraf=require(_0xf72e('0x7'));var config=require(_0xf72e('0x8'));var attributes=require(_0xf72e('0x9'));module[_0xf72e('0xa')]=function(_0x411b9f,_0x32946f){return _0x411b9f[_0xf72e('0xb')](_0xf72e('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2637=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0x2637,0x1b3));var _0x7263=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x2637[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x7263('0x0'));var util=require('util');var logger=require(_0x7263('0x1'))(_0x7263('0x2'));var moment=require(_0x7263('0x3'));var BPromise=require(_0x7263('0x4'));var rp=require(_0x7263('0x5'));var fs=require('fs');var path=require(_0x7263('0x6'));var rimraf=require(_0x7263('0x7'));var config=require(_0x7263('0x8'));var attributes=require('./faxApplication.attributes');module[_0x7263('0x9')]=function(_0x4864b2,_0x595eaa){return _0x4864b2[_0x7263('0xa')]('FaxApplication',attributes,{'tableName':_0x7263('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7263('0xc'),'collate':_0x7263('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 04047e8..6141350 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 _0x1b91=['result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1a485b,_0x248119){var _0x4d2842=function(_0x38708b){while(--_0x38708b){_0x1a485b['push'](_0x1a485b['shift']());}};_0x4d2842(++_0x248119);}(_0x1b91,0x171));var _0x11b9=function(_0x3fe491,_0x4d2e93){_0x3fe491=_0x3fe491-0x0;var _0x19c2e6=_0x1b91[_0x3fe491];return _0x19c2e6;};'use strict';var _=require(_0x11b9('0x0'));var util=require(_0x11b9('0x1'));var moment=require(_0x11b9('0x2'));var BPromise=require(_0x11b9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11b9('0x4'));var db=require(_0x11b9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x11b9('0x6'))(_0x11b9('0x7'));var config=require(_0x11b9('0x8'));var jayson=require(_0x11b9('0x9'));var client=jayson['client'][_0x11b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506dc3,_0x14815d,_0x2509fa){return new BPromise(function(_0x162775,_0x1f56f0){return client[_0x11b9('0xb')](_0x506dc3,_0x2509fa)[_0x11b9('0xc')](function(_0x78e435){logger[_0x11b9('0xd')](_0x11b9('0xe'),_0x14815d,_0x11b9('0xf'));logger[_0x11b9('0x10')](_0x11b9('0x11'),_0x14815d,'request\x20sent',JSON[_0x11b9('0x12')](_0x78e435));if(_0x78e435[_0x11b9('0x13')]){if(_0x78e435[_0x11b9('0x13')]['code']===0x1f4){logger[_0x11b9('0x13')]('FaxApplication,\x20%s,\x20%s',_0x14815d,_0x78e435['error'][_0x11b9('0x14')]);return _0x1f56f0(_0x78e435['error']['message']);}logger[_0x11b9('0x13')]('FaxApplication,\x20%s,\x20%s',_0x14815d,_0x78e435[_0x11b9('0x13')][_0x11b9('0x14')]);return _0x162775(_0x78e435['error'][_0x11b9('0x14')]);}else{logger[_0x11b9('0xd')]('FaxApplication,\x20%s,\x20%s',_0x14815d,_0x11b9('0xf'));_0x162775(_0x78e435[_0x11b9('0x15')][_0x11b9('0x14')]);}})[_0x11b9('0x16')](function(_0x40b021){logger['error'](_0x11b9('0xe'),_0x14815d,_0x40b021);_0x1f56f0(_0x40b021);});});}exports[_0x11b9('0x17')]=function(_0x254069){var _0x46017e=this;return new Promise(function(_0x28cf64,_0x11419c){return db['FaxApplication'][_0x11b9('0x18')](_0x254069[_0x11b9('0x19')],{'raw':_0x254069[_0x11b9('0x1a')]?_0x254069[_0x11b9('0x1a')][_0x11b9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x254069[_0x11b9('0x1a')]?_0x254069['options'][_0x11b9('0x1c')]||null:null,'attributes':_0x254069[_0x11b9('0x1a')]?_0x254069[_0x11b9('0x1a')][_0x11b9('0x1d')]||null:null,'limit':_0x254069[_0x11b9('0x1a')]?_0x254069[_0x11b9('0x1a')]['limit']||null:null})['then'](function(_0x1e66f6){logger['info']('UpdateFaxApplication',_0x254069);logger[_0x11b9('0x10')](_0x11b9('0x17'),_0x254069,JSON[_0x11b9('0x12')](_0x1e66f6));_0x28cf64(_0x1e66f6);})['catch'](function(_0x20cad4){logger['error']('UpdateFaxApplication',_0x20cad4[_0x11b9('0x14')],_0x254069);_0x11419c(_0x46017e['error'](0x1f4,_0x20cad4[_0x11b9('0x14')]));});});}; \ No newline at end of file +var _0x993c=['options','raw','where','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FaxApplication','update','body'];(function(_0x17f51e,_0x52700a){var _0x5d0284=function(_0x6d8ae4){while(--_0x6d8ae4){_0x17f51e['push'](_0x17f51e['shift']());}};_0x5d0284(++_0x52700a);}(_0x993c,0x1c6));var _0xc993=function(_0x318df8,_0x132f30){_0x318df8=_0x318df8-0x0;var _0x59746a=_0x993c[_0x318df8];return _0x59746a;};'use strict';var _=require(_0xc993('0x0'));var util=require(_0xc993('0x1'));var moment=require(_0xc993('0x2'));var BPromise=require(_0xc993('0x3'));var rs=require(_0xc993('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc993('0x5'))['db'];var utils=require(_0xc993('0x6'));var logger=require(_0xc993('0x7'))(_0xc993('0x8'));var config=require('../../config/environment');var jayson=require(_0xc993('0x9'));var client=jayson[_0xc993('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x261df0,_0x5e59bb,_0x4cd750){return new BPromise(function(_0x2c90a1,_0x5165bb){return client[_0xc993('0xb')](_0x261df0,_0x4cd750)[_0xc993('0xc')](function(_0x22f9ca){logger['info'](_0xc993('0xd'),_0x5e59bb,_0xc993('0xe'));logger[_0xc993('0xf')](_0xc993('0x10'),_0x5e59bb,'request\x20sent',JSON[_0xc993('0x11')](_0x22f9ca));if(_0x22f9ca[_0xc993('0x12')]){if(_0x22f9ca[_0xc993('0x12')][_0xc993('0x13')]===0x1f4){logger[_0xc993('0x12')](_0xc993('0xd'),_0x5e59bb,_0x22f9ca[_0xc993('0x12')][_0xc993('0x14')]);return _0x5165bb(_0x22f9ca[_0xc993('0x12')][_0xc993('0x14')]);}logger['error'](_0xc993('0xd'),_0x5e59bb,_0x22f9ca[_0xc993('0x12')]['message']);return _0x2c90a1(_0x22f9ca[_0xc993('0x12')][_0xc993('0x14')]);}else{logger[_0xc993('0x15')]('FaxApplication,\x20%s,\x20%s',_0x5e59bb,_0xc993('0xe'));_0x2c90a1(_0x22f9ca['result']['message']);}})[_0xc993('0x16')](function(_0x2d33de){logger['error'](_0xc993('0xd'),_0x5e59bb,_0x2d33de);_0x5165bb(_0x2d33de);});});}exports['UpdateFaxApplication']=function(_0x3fb24a){var _0x305d27=this;return new Promise(function(_0x34ff11,_0x2b5e73){return db[_0xc993('0x17')][_0xc993('0x18')](_0x3fb24a[_0xc993('0x19')],{'raw':_0x3fb24a[_0xc993('0x1a')]?_0x3fb24a[_0xc993('0x1a')][_0xc993('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb24a[_0xc993('0x1a')]?_0x3fb24a[_0xc993('0x1a')][_0xc993('0x1c')]||null:null,'attributes':_0x3fb24a[_0xc993('0x1a')]?_0x3fb24a[_0xc993('0x1a')]['attributes']||null:null,'limit':_0x3fb24a[_0xc993('0x1a')]?_0x3fb24a[_0xc993('0x1a')]['limit']||null:null})[_0xc993('0xc')](function(_0x5bcc4a){logger[_0xc993('0x15')]('UpdateFaxApplication',_0x3fb24a);logger[_0xc993('0xf')](_0xc993('0x1d'),_0x3fb24a,JSON[_0xc993('0x11')](_0x5bcc4a));_0x34ff11(_0x5bcc4a);})[_0xc993('0x16')](function(_0x2b0b13){logger[_0xc993('0x12')](_0xc993('0x1d'),_0x2b0b13[_0xc993('0x14')],_0x3fb24a);_0x2b5e73(_0x305d27[_0xc993('0x12')](0x1f4,_0x2b0b13['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 4735691..2bccaa5 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x27ce2c,_0x537242){var _0x58408c=function(_0x4f24b7){while(--_0x4f24b7){_0x27ce2c['push'](_0x27ce2c['shift']());}};_0x58408c(++_0x537242);}(_0x5eb8,0xb0));var _0x85eb=function(_0x509d9e,_0x2d1197){_0x509d9e=_0x509d9e-0x0;var _0x56b488=_0x5eb8[_0x509d9e];return _0x56b488;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0x93e9=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x3eff0b,_0x116bc4){var _0x4eea6d=function(_0x1bda78){while(--_0x1bda78){_0x3eff0b['push'](_0x3eff0b['shift']());}};_0x4eea6d(++_0x116bc4);}(_0x93e9,0xcc));var _0x993e=function(_0x5e9f06,_0x3dd75c){_0x5e9f06=_0x5e9f06-0x0;var _0x4c9dd5=_0x93e9[_0x5e9f06];return _0x4c9dd5;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['show']);router[_0x993e('0xd')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0xf')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller[_0x993e('0x10')]);router['delete'](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2042080..3fe777d 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 _0xdfdf=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0x19288f,_0x593b58){var _0x280b73=function(_0x344efa){while(--_0x344efa){_0x19288f['push'](_0x19288f['shift']());}};_0x280b73(++_0x593b58);}(_0xdfdf,0xbc));var _0xfdfd=function(_0x1a6bc2,_0xded309){_0x1a6bc2=_0x1a6bc2-0x0;var _0x50faf8=_0xdfdf[_0x1a6bc2];return _0x50faf8;};'use strict';var Sequelize=require(_0xfdfd('0x0'));module[_0xfdfd('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfdfd('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfdfd('0x3')]},'note':{'type':Sequelize[_0xfdfd('0x3')]},'read1stAt':{'type':Sequelize[_0xfdfd('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xfdfd('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfdfd('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfdfd('0x4')]('in',_0xfdfd('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe606=['ENUM','out','sequelize','DATE','STRING'];(function(_0x145e4f,_0x1e072e){var _0x2356d0=function(_0xdfa0d9){while(--_0xdfa0d9){_0x145e4f['push'](_0x145e4f['shift']());}};_0x2356d0(++_0x1e072e);}(_0xe606,0x101));var _0x6e60=function(_0x1673a5,_0x39ad51){_0x1673a5=_0x1673a5-0x0;var _0x2d11ce=_0xe606[_0x1673a5];return _0x2d11ce;};'use strict';var Sequelize=require(_0x6e60('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e60('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6e60('0x2')]},'note':{'type':Sequelize[_0x6e60('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x6e60('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6e60('0x3')]('in',_0x6e60('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 03f7f7f..b40cd50 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 _0xdfc0=['../../config/environment','../../config/license/util','redis','socket.io-emitter','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','Users','fullname','TagIds','Tags','split','forEach','push','waiting','talking','answered','total','closed','UserId','unmanaged','FaxInteraction','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','options','catch','describe','addMessage','FaxMessage','ids','getMessages','findOne','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','omit','spread','findAll','faxInteractionTags:save','download','join','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','log','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x4772d6,_0x5e344a){var _0x25ffa2=function(_0x26dbb5){while(--_0x26dbb5){_0x4772d6['push'](_0x4772d6['shift']());}};_0x25ffa2(++_0x5e344a);}(_0xdfc0,0x1aa));var _0x0dfc=function(_0x173cab,_0x599609){_0x173cab=_0x173cab-0x0;var _0x199aa1=_0xdfc0[_0x173cab];return _0x199aa1;};'use strict';var emlformat=require(_0x0dfc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0dfc('0x1'));var jsonpatch=require(_0x0dfc('0x2'));var rp=require(_0x0dfc('0x3'));var moment=require(_0x0dfc('0x4'));var BPromise=require(_0x0dfc('0x5'));var Mustache=require(_0x0dfc('0x6'));var util=require(_0x0dfc('0x7'));var path=require('path');var sox=require(_0x0dfc('0x8'));var csv=require('to-csv');var ejs=require(_0x0dfc('0x9'));var fs=require('fs');var fs_extra=require(_0x0dfc('0xa'));var _=require(_0x0dfc('0xb'));var squel=require(_0x0dfc('0xc'));var crypto=require(_0x0dfc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0dfc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0dfc('0xf'));var Papa=require('papaparse');var Redis=require(_0x0dfc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0dfc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0dfc('0x12'))(_0x0dfc('0x13'));var utils=require('../../config/utils');var config=require(_0x0dfc('0x14'));var licenseUtil=require(_0x0dfc('0x15'));var db=require('../../mysqldb')['db'];config[_0x0dfc('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0dfc('0x17'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x0dfc('0x18')](socket);function respondWithStatusCode(_0x3f5f3d,_0x4c8766){_0x4c8766=_0x4c8766||0xcc;return function(_0x4c6068){if(_0x4c6068){return _0x3f5f3d[_0x0dfc('0x19')](_0x4c8766);}return _0x3f5f3d[_0x0dfc('0x1a')](_0x4c8766)['end']();};}function respondWithResult(_0x120868,_0x357889){_0x357889=_0x357889||0xc8;return function(_0x287870){if(_0x287870){return _0x120868[_0x0dfc('0x1a')](_0x357889)['json'](_0x287870);}};}function respondWithFilteredResult(_0x1823de,_0x299743){return function(_0x316627){if(_0x316627){var _0x7acf01=typeof _0x299743[_0x0dfc('0x1b')]==='undefined'&&typeof _0x299743[_0x0dfc('0x1c')]===_0x0dfc('0x1d');var _0xa064ad=_0x316627['count'];var _0x41cbbd=_0x7acf01?0x0:_0x299743[_0x0dfc('0x1b')];var _0x233a11=_0x7acf01?_0x316627[_0x0dfc('0x1e')]:_0x299743[_0x0dfc('0x1b')]+_0x299743[_0x0dfc('0x1c')];var _0x3fe8d1;if(_0x233a11>=_0xa064ad){_0x233a11=_0xa064ad;_0x3fe8d1=0xc8;}else{_0x3fe8d1=0xce;}_0x1823de[_0x0dfc('0x1a')](_0x3fe8d1);return _0x1823de[_0x0dfc('0x1f')](_0x0dfc('0x20'),_0x41cbbd+'-'+_0x233a11+'/'+_0xa064ad)[_0x0dfc('0x21')](_0x316627);}return null;};}function patchUpdates(_0x47d636){return function(_0xd5e727){try{jsonpatch[_0x0dfc('0x22')](_0xd5e727,_0x47d636,!![]);}catch(_0x4afdb9){return BPromise[_0x0dfc('0x23')](_0x4afdb9);}return _0xd5e727[_0x0dfc('0x24')]();};}function saveUpdates(_0x58b9a0,_0x3b27e8){return function(_0x3c6fad){if(_0x3c6fad){return _0x3c6fad[_0x0dfc('0x25')](_0x58b9a0)[_0x0dfc('0x26')](function(_0x548bbc){return _0x548bbc;});}return null;};}function removeEntity(_0x20303b,_0x2bac84){return function(_0x4fde26){if(_0x4fde26){return _0x4fde26[_0x0dfc('0x27')]()[_0x0dfc('0x26')](function(){_0x20303b['status'](0xcc)[_0x0dfc('0x28')]();});}};}function handleEntityNotFound(_0x12927f,_0x29eac8){return function(_0x570fa2){if(!_0x570fa2){_0x12927f[_0x0dfc('0x19')](0x194);}return _0x570fa2;};}function handleError(_0x15468d,_0x176716){_0x176716=_0x176716||0x1f4;return function(_0x50c1da){logger['error'](_0x50c1da['stack']);if(_0x50c1da[_0x0dfc('0x29')]){delete _0x50c1da[_0x0dfc('0x29')];}_0x15468d['status'](_0x176716)['send'](_0x50c1da);};}function getInteractionUsers(_0x23fa8b,_0x51f8da){return new BPromise(function(_0x4570ca,_0x937888){try{if(_0x51f8da[_0x23fa8b['id']]){_0x23fa8b[_0x0dfc('0x2a')]=_['map'](_0x51f8da[_0x23fa8b['id']],function(_0x243ad0){return{'id':_0x243ad0['id'],'fullname':_0x243ad0[_0x0dfc('0x2b')]};});}}catch(_0x5715d0){_0x937888(_0x5715d0);}_0x4570ca(_0x23fa8b);});}function getInteractionTags(_0x237633,_0x795bf0){return new BPromise(function(_0x248509,_0x4f5858){try{if(_0x237633[_0x0dfc('0x2c')]){_0x237633[_0x0dfc('0x2d')]=[];_0x237633[_0x0dfc('0x2c')][_0x0dfc('0x2e')](',')[_0x0dfc('0x2f')](function(_0x21bd55){_0x237633[_0x0dfc('0x2d')][_0x0dfc('0x30')](_0x795bf0[_0x21bd55]);});}delete _0x237633[_0x0dfc('0x2c')];}catch(_0x49f058){_0x4f5858(_0x49f058);}_0x248509(_0x237633);});}function updateFaxInteraction(_0x2108ea,_0x5887ec,_0x5ed49a){return new BPromise(function(_0x33f6fc,_0x3f7d6a){return getInteractionUsers(_0x2108ea,_0x5ed49a)[_0x0dfc('0x26')](function(_0xc4dfc8){return getInteractionTags(_0xc4dfc8,_0x5887ec);})[_0x0dfc('0x26')](function(_0x468ed4){return getStateInteraction(_0x468ed4);})[_0x0dfc('0x26')](function(_0x15f142){_0x33f6fc(_0x15f142);})['catch'](function(_0x394e61){_0x3f7d6a(_0x394e61);});});}function getStateInteraction(_0x17e19f){return new BPromise(function(_0x5e3353){_0x17e19f[_0x0dfc('0x31')]=0x0;_0x17e19f[_0x0dfc('0x32')]=0x0;_0x17e19f[_0x0dfc('0x33')]=0x0;_0x17e19f['unmanaged']=0x0;_0x17e19f[_0x0dfc('0x34')]=0x0;if(!_0x17e19f['closed']&&!_0x17e19f['UserId']){_0x17e19f[_0x0dfc('0x31')]+=0x1;}if(!_0x17e19f[_0x0dfc('0x35')]&&_0x17e19f[_0x0dfc('0x36')]){_0x17e19f[_0x0dfc('0x32')]+=0x1;if(_0x17e19f[_0x0dfc('0x31')]){_0x17e19f[_0x0dfc('0x31')]-=0x1;}}if(_0x17e19f[_0x0dfc('0x35')]&&_0x17e19f[_0x0dfc('0x36')]){_0x17e19f['answered']+=0x1;if(_0x17e19f[_0x0dfc('0x32')]){_0x17e19f[_0x0dfc('0x32')]-=0x1;}}if(_0x17e19f['closed']&&!_0x17e19f[_0x0dfc('0x36')]){_0x17e19f[_0x0dfc('0x37')]+=0x1;if(_0x17e19f[_0x0dfc('0x31')]){_0x17e19f[_0x0dfc('0x31')]-=0x1;}}_0x17e19f[_0x0dfc('0x34')]+=0x1;_0x5e3353(_0x17e19f);});}exports['index']=function(_0x175e54,_0x5fb942){var _0x5c123={},_0x35bd2b={},_0x528915={'count':0x0,'rows':[]};var _0x5e0da7=_['map'](db[_0x0dfc('0x38')][_0x0dfc('0x39')],function(_0x579b0d){return{'name':_0x579b0d['fieldName'],'type':_0x579b0d['type'][_0x0dfc('0x3a')]};});_0x35bd2b[_0x0dfc('0x3b')]=_[_0x0dfc('0x3c')](_0x5e0da7,_0x0dfc('0x29'));_0x35bd2b[_0x0dfc('0x3d')]=_[_0x0dfc('0x3e')](_0x175e54['query']);_0x35bd2b[_0x0dfc('0x3f')]=_[_0x0dfc('0x40')](_0x35bd2b[_0x0dfc('0x3b')],_0x35bd2b['query']);_0x5c123[_0x0dfc('0x41')]=_['intersection'](_0x35bd2b[_0x0dfc('0x3b')],qs[_0x0dfc('0x42')](_0x175e54['query'][_0x0dfc('0x42')]));_0x5c123[_0x0dfc('0x41')]=_0x5c123[_0x0dfc('0x41')][_0x0dfc('0x43')]?_0x5c123[_0x0dfc('0x41')]:_0x35bd2b[_0x0dfc('0x3b')];if(!_0x175e54['query']['hasOwnProperty'](_0x0dfc('0x44'))){_0x5c123[_0x0dfc('0x1c')]=qs[_0x0dfc('0x1c')](_0x175e54[_0x0dfc('0x3d')][_0x0dfc('0x1c')]);_0x5c123[_0x0dfc('0x1b')]=qs[_0x0dfc('0x1b')](_0x175e54[_0x0dfc('0x3d')][_0x0dfc('0x1b')]);}_0x5c123['order']=qs[_0x0dfc('0x45')](_0x175e54[_0x0dfc('0x3d')]['sort']);_0x5c123['where']=qs[_0x0dfc('0x3f')](_['pick'](_0x175e54['query'],_0x35bd2b[_0x0dfc('0x3f')]),_0x5e0da7);var _0x48800e=[];var _0xb942a8=squel[_0x0dfc('0x46')]()['field']('id')[_0x0dfc('0x47')](_0x0dfc('0x29'))[_0x0dfc('0x47')](_0x0dfc('0x48'))[_0x0dfc('0x49')](_0x0dfc('0x4a'));var _0x45f7ac=squel['select']()[_0x0dfc('0x47')](_0x0dfc('0x4b'))['field']('u.fullname')['field'](_0x0dfc('0x4c'))[_0x0dfc('0x49')](_0x0dfc('0x4d'),'ui')[_0x0dfc('0x4e')](_0x0dfc('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0xb0d643=squel['select']()[_0x0dfc('0x49')]('fax_interactions','i')['left_join'](_0x0dfc('0x50'),'c',_0x0dfc('0x51'))[_0x0dfc('0x4e')]('users','o',_0x0dfc('0x52'))['left_join'](_0x0dfc('0x53'),'a',_0x0dfc('0x54'))['left_join'](_0x0dfc('0x55'),'me',_0x0dfc('0x56'))[_0x0dfc('0x4e')](_0x0dfc('0x57'),'it',_0x0dfc('0x58'))[_0x0dfc('0x4e')](_0x0dfc('0x4a'),'t',_0x0dfc('0x59'));var _0x10107a=squel[_0x0dfc('0x5a')]();var _0x5160a8=[];var _0x166325=squel[_0x0dfc('0x5a')]();var _0x4d987f;if(_0x175e54[_0x0dfc('0x3d')]['search']){_0x4d987f=as[_0x0dfc('0x5b')](_0x175e54[_0x0dfc('0x3d')][_0x0dfc('0x5c')]);var _0x4e8278=_0x4d987f[_0x0dfc('0x5d')];for(var _0x2c0f7e=0x0;_0x2c0f7e<_0x4d987f[_0x0dfc('0x5e')][_0x0dfc('0x43')];_0x2c0f7e++){var _0x328fbe=_0x4d987f['conditions'][_0x2c0f7e];var _0x4f78aa='i';var _0x5e1bdc=_[_0x0dfc('0x5f')](_0x5e0da7,[_0x0dfc('0x29'),_0x328fbe[_0x0dfc('0x47')]]);if(!_0x5e1bdc){switch(_0x328fbe['field']){case _0x0dfc('0x60'):if(_0x328fbe[_0x0dfc('0x61')]==0x1){_0xb0d643['having']('`'+_0x328fbe['field']+_0x0dfc('0x62'));}else{_0xb0d643[_0x0dfc('0x63')]('`'+_0x328fbe[_0x0dfc('0x47')]+_0x0dfc('0x64'));}break;case _0x0dfc('0x65'):if(_0x328fbe[_0x0dfc('0x66')]==='$substring'){if(_0x328fbe[_0x0dfc('0x61')][_0x0dfc('0x2e')]('\x20')[_0x0dfc('0x43')]>0x1){_0x10107a[_0x4e8278](_0x0dfc('0x67'),qs[_0x0dfc('0x68')](_0x328fbe['value']),null);}else{var _0x1842f4='%'+_0x328fbe[_0x0dfc('0x61')]+'%';_0x10107a[_0x4e8278](_0x0dfc('0x69'),_0x1842f4,_0x1842f4,_0x1842f4);}}else{_0x5e1bdc=_[_0x0dfc('0x5f')](_0x5e0da7,[_0x0dfc('0x29'),_0x0dfc('0x6a')]);_0x328fbe[_0x0dfc('0x47')]=_0x0dfc('0x6a');_0x32813a=as[_0x0dfc('0x6b')](_0x4f78aa,_0x5e1bdc[_0x0dfc('0x6c')],_0x328fbe);_0x10107a[_0x4e8278](_0x32813a[_0x0dfc('0x6d')],_0x32813a[_0x0dfc('0x61')][_0x0dfc('0x6e')],_0x32813a[_0x0dfc('0x61')][_0x0dfc('0x28')]);}break;case _0x0dfc('0x6f'):var _0x129cf7=_0x328fbe[_0x0dfc('0x61')][_0x0dfc('0x2e')](',')[_0x0dfc('0x3c')](function(_0x19b7aa){return Number(_0x19b7aa);});_0x129cf7[_0x0dfc('0x2f')](function(_0x30ae65){_0x166325['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x30ae65+',%');});_0x5160a8=_[_0x0dfc('0x70')](_0x5160a8,_0x129cf7);break;case _0x0dfc('0x71'):if(_0x328fbe[_0x0dfc('0x66')]===_0x0dfc('0x72')){_0x10107a[_0x4e8278](_0x0dfc('0x73'),'%'+_0x328fbe['value']+'%',null);}else{_0x5e1bdc=_[_0x0dfc('0x5f')](_0x5e0da7,[_0x0dfc('0x29'),_0x0dfc('0x36')]);_0x328fbe[_0x0dfc('0x47')]=_0x0dfc('0x36');_0x32813a=as[_0x0dfc('0x6b')](_0x4f78aa,_0x5e1bdc['type'],_0x328fbe);_0x10107a[_0x4e8278](_0x32813a[_0x0dfc('0x6d')],_0x32813a[_0x0dfc('0x61')]['start'],_0x32813a[_0x0dfc('0x61')][_0x0dfc('0x28')]);}break;case _0x0dfc('0x74'):_0x32813a=as[_0x0dfc('0x6b')]('me',null,_0x328fbe);_0x10107a[_0x4e8278](_0x32813a[_0x0dfc('0x6d')],_0x32813a[_0x0dfc('0x61')][_0x0dfc('0x6e')],_0x32813a[_0x0dfc('0x61')]['end']);break;}}else{var _0x32813a=as['buildExpression'](_0x4f78aa,_0x5e1bdc[_0x0dfc('0x6c')],_0x328fbe);_0x10107a[_0x4e8278](_0x32813a['text'],_0x32813a[_0x0dfc('0x61')][_0x0dfc('0x6e')],_0x32813a[_0x0dfc('0x61')]['end']);}}}else{var _0x1d6519=_(_0x175e54[_0x0dfc('0x3d')])[_0x0dfc('0x3e')]()[_0x0dfc('0x3c')](function(_0x40b9c3){return _[_0x0dfc('0x75')](_0x5e0da7,['name',_0x40b9c3])?_0x40b9c3:undefined;})[_0x0dfc('0x76')]()[_0x0dfc('0x61')]();if(!_[_0x0dfc('0x77')](_0x1d6519)){_0x1d6519[_0x0dfc('0x2f')](function(_0x3898fa){if(_0x3898fa===_0x0dfc('0x78')){_0xb0d643[_0x0dfc('0x79')](_0x0dfc('0x7a'),[][_0x0dfc('0x7b')](_0x175e54[_0x0dfc('0x3d')][_0x3898fa]));}else if(_0x3898fa===_0x0dfc('0x7c')){var _0x20696b=JSON[_0x0dfc('0x7d')](_0x175e54['query'][_0x3898fa])[_0x0dfc('0x7e')];var _0x1f39b7=JSON[_0x0dfc('0x7d')](_0x175e54[_0x0dfc('0x3d')][_0x3898fa])[_0x0dfc('0x7f')];_0xb0d643[_0x0dfc('0x79')](_0x0dfc('0x80'),_0x20696b,_0x1f39b7);}else{if(_0x175e54['query'][_0x3898fa]===_0x0dfc('0x81')){_0xb0d643['where']('i.'+_0x3898fa+_0x0dfc('0x82'));}else{_0xb0d643['where']('i.'+_0x3898fa+_0x0dfc('0x83'),_0x175e54[_0x0dfc('0x3d')][_0x3898fa]);}}});}if(_0x175e54['query'][_0x0dfc('0x84')]){if(_0x175e54['query'][_0x0dfc('0x84')]==0x1){_0xb0d643[_0x0dfc('0x63')](_0x0dfc('0x85'));}else{_0xb0d643[_0x0dfc('0x63')](_0x0dfc('0x86'));}}if(_0x175e54[_0x0dfc('0x3d')]['tag']){_0x5160a8=_[_0x0dfc('0x87')](_0x175e54[_0x0dfc('0x3d')][_0x0dfc('0x88')])?_0x175e54[_0x0dfc('0x3d')][_0x0dfc('0x88')]:new Array(_0x175e54[_0x0dfc('0x3d')]['tag']);_0x5160a8[_0x0dfc('0x2f')](function(_0xf4507e){_0x166325['or'](_0x0dfc('0x89'),'%,'+_0xf4507e+',%');});}if(_0x175e54[_0x0dfc('0x3d')]['filter']){var _0xac940d=_0x175e54[_0x0dfc('0x3d')][_0x0dfc('0x8a')][_0x0dfc('0x8b')]('\x5c','\x5c\x5c')[_0x0dfc('0x8b')](/'/g,'\x27\x27');if(qs[_0x0dfc('0x8c')](_0xac940d)){_0x10107a['or'](_0x0dfc('0x8d'),_0xac940d+'%')['or'](_0x0dfc('0x8e'),_0xac940d+'%');}_0x10107a['or'](_0x0dfc('0x8f'),_0xac940d+'%');}}_0xb0d643['where'](_0x10107a);_0xb0d643['group'](_0x0dfc('0x90'));var _0x26c91d={'type':db[_0x0dfc('0x91')][_0x0dfc('0x92')][_0x0dfc('0x93')],'raw':!![]};var _0x169e68=_0xb0d643[_0x0dfc('0x94')]();_0x169e68[_0x0dfc('0x47')](_0x0dfc('0x90'));_0x169e68[_0x0dfc('0x47')](_0x0dfc('0x95'),_0x0dfc('0x60'));if(_0x5c123[_0x0dfc('0x96')]){_0x5c123[_0x0dfc('0x96')][_0x0dfc('0x2f')](function(_0x4e5dbf){var _0x4baaf5=_0x4e5dbf[0x0]==='contactName'?_0x4e5dbf[0x0]:'i.'+_0x4e5dbf[0x0];_0xb0d643[_0x0dfc('0x96')](_0x4baaf5,_0x4e5dbf[0x1]===_0x0dfc('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x5160a8)){_0xb0d643['having'](_0x166325);_0x169e68[_0x0dfc('0x79')]('t.id\x20IN\x20?',_0x5160a8);}BPromise[_0x0dfc('0x98')]()['then'](function(){if(!_0x4d987f){if(_0x175e54[_0x0dfc('0x3d')][_0x0dfc('0x78')])return;_0x169e68[_0x0dfc('0x79')](_0x0dfc('0x99'));_0xb0d643[_0x0dfc('0x79')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x175e54['user'][_0x0dfc('0x9a')]!==_0x0dfc('0x9b'))return;return _0x175e54[_0x0dfc('0x9c')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x0dfc('0x26')](function(_0x29ca6c){if(_[_0x0dfc('0x77')](_0x29ca6c)){_0x169e68[_0x0dfc('0x79')](_0x0dfc('0x9d'));_0xb0d643[_0x0dfc('0x79')](_0x0dfc('0x9d'));}else{_0x169e68[_0x0dfc('0x79')]('i.FaxAccountId\x20IN\x20?',_[_0x0dfc('0x3c')](_0x29ca6c,'id'));_0xb0d643['where'](_0x0dfc('0x7a'),_[_0x0dfc('0x3c')](_0x29ca6c,'id'));}});})['then'](function(){if(_0x175e54['user'][_0x0dfc('0x9a')]==='agent'&&!_0x4d987f&&!_0x175e54[_0x0dfc('0x3d')]['FaxAccountId'])return[];return db[_0x0dfc('0x9e')][_0x0dfc('0x3d')](_0x169e68['toString'](),_0x26c91d);})[_0x0dfc('0x26')](function(_0x456e2b){_0x528915[_0x0dfc('0x1e')]=_0x456e2b[_0x0dfc('0x43')];if(_0x528915[_0x0dfc('0x1e')]===0x0)return[];return db[_0x0dfc('0x9e')][_0x0dfc('0x3d')](_0xb942a8[_0x0dfc('0x9f')](),_0x26c91d)[_0x0dfc('0x26')](function(_0x26d17d){_0x48800e=_[_0x0dfc('0xa0')](_0x26d17d,'id');_0x26c91d=_[_0x0dfc('0xa1')](_0x26c91d,{'model':db[_0x0dfc('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x175e54[_0x0dfc('0x3d')]['fields']){_0x5c123[_0x0dfc('0x41')][_0x0dfc('0x2f')](function(_0x5970e9){_0xb0d643[_0x0dfc('0x47')]('i.'+_0x5970e9);});}else{_0xb0d643[_0x0dfc('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0dfc('0x60'));_0xb0d643[_0x0dfc('0x47')](_0x0dfc('0xa2'),_0x0dfc('0xa3'));_0xb0d643['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0xb0d643[_0x0dfc('0x47')](_0x0dfc('0xa4'),_0x0dfc('0xa5'));_0xb0d643[_0x0dfc('0x47')]('i.*');_0xb0d643[_0x0dfc('0x47')](_0x0dfc('0xa6'),_0x0dfc('0xa7'));_0xb0d643['field'](_0x0dfc('0xa8'),_0x0dfc('0xa9'));_0xb0d643['field'](_0x0dfc('0xaa'),'Contact.email');_0xb0d643[_0x0dfc('0x47')](_0x0dfc('0xab'),_0x0dfc('0xac'));_0xb0d643[_0x0dfc('0x47')](_0x0dfc('0xad'),_0x0dfc('0xae'));_0xb0d643[_0x0dfc('0x47')](_0x0dfc('0xaf'),_0x0dfc('0xb0'));_0xb0d643[_0x0dfc('0x47')](_0x0dfc('0xb1'),_0x0dfc('0xb2'));_0xb0d643[_0x0dfc('0x47')](_0x0dfc('0xb3'),_0x0dfc('0xb4'));_0xb0d643[_0x0dfc('0x47')](_0x0dfc('0xb5'),'TagIds');}if(_0x5c123['limit'])_0xb0d643[_0x0dfc('0x1c')](_0x5c123[_0x0dfc('0x1c')]);if(_0x5c123[_0x0dfc('0x1b')])_0xb0d643[_0x0dfc('0x1b')](_0x5c123[_0x0dfc('0x1b')]);return db['sequelize'][_0x0dfc('0x3d')](_0xb0d643['toString'](),_0x26c91d);})['then'](function(_0x508d86){if(_0x508d86[_0x0dfc('0x43')]>0x0)_0x45f7ac[_0x0dfc('0x79')](_0x0dfc('0xb6'),_[_0x0dfc('0x3c')](_0x508d86,'id'));return db[_0x0dfc('0x9e')][_0x0dfc('0x3d')](_0x45f7ac[_0x0dfc('0x9f')](),_0x26c91d)['then'](function(_0x47ff17){var _0x1ad862=_[_0x0dfc('0xb7')](_0x47ff17,_0x0dfc('0xb8'));var _0x31ea5d=[];_0x508d86[_0x0dfc('0x2f')](function(_0x4fceb4){_0x31ea5d[_0x0dfc('0x30')](updateFaxInteraction(_0x4fceb4,_0x48800e,_0x1ad862));});return BPromise[_0x0dfc('0xb9')](_0x31ea5d);});});})[_0x0dfc('0x26')](function(_0x42dd06){_0x528915[_0x0dfc('0xba')]=_0x42dd06;return _0x528915;})['then'](respondWithFilteredResult(_0x5fb942,_0x5c123))['catch'](handleError(_0x5fb942,null));};exports[_0x0dfc('0xbb')]=function(_0x2f97f2,_0x3dfb0b){var _0x36e560={'raw':![],'where':{'id':_0x2f97f2[_0x0dfc('0xbc')]['id']}},_0x384e06={};_0x384e06['model']=_['keys'](db[_0x0dfc('0x38')][_0x0dfc('0x39')]);_0x384e06['query']=_[_0x0dfc('0x3e')](_0x2f97f2[_0x0dfc('0x3d')]);_0x384e06['filters']=_[_0x0dfc('0x40')](_0x384e06[_0x0dfc('0x3b')],_0x384e06['query']);_0x36e560['attributes']=_[_0x0dfc('0x40')](_0x384e06['model'],qs[_0x0dfc('0x42')](_0x2f97f2[_0x0dfc('0x3d')][_0x0dfc('0x42')]));_0x36e560[_0x0dfc('0x41')]=_0x36e560[_0x0dfc('0x41')][_0x0dfc('0x43')]?_0x36e560[_0x0dfc('0x41')]:_0x384e06['model'];if(_0x2f97f2[_0x0dfc('0x3d')][_0x0dfc('0xbd')]){_0x36e560[_0x0dfc('0xbe')]=[{'all':!![]}];}_0x36e560=_[_0x0dfc('0xa1')]({},_0x36e560,_0x2f97f2[_0x0dfc('0xbf')]);return db['FaxInteraction'][_0x0dfc('0x5f')](_0x36e560)[_0x0dfc('0x26')](handleEntityNotFound(_0x3dfb0b,null))[_0x0dfc('0x26')](respondWithResult(_0x3dfb0b,null))[_0x0dfc('0xc0')](handleError(_0x3dfb0b,null));};exports['create']=function(_0x572f64,_0x231a30){return db['FaxInteraction']['create'](_0x572f64['body'],{})[_0x0dfc('0x26')](respondWithResult(_0x231a30,0xc9))[_0x0dfc('0xc0')](handleError(_0x231a30,null));};exports[_0x0dfc('0x25')]=function(_0x20f54e,_0x11c1f8){if(_0x20f54e['body']['id']){delete _0x20f54e[_0x0dfc('0x74')]['id'];}return db[_0x0dfc('0x38')]['find']({'where':{'id':_0x20f54e[_0x0dfc('0xbc')]['id']}})['then'](handleEntityNotFound(_0x11c1f8,null))[_0x0dfc('0x26')](saveUpdates(_0x20f54e[_0x0dfc('0x74')],null))[_0x0dfc('0x26')](respondWithResult(_0x11c1f8,null))[_0x0dfc('0xc0')](handleError(_0x11c1f8,null));};exports[_0x0dfc('0x27')]=function(_0x4ec4bc,_0x683780){return db[_0x0dfc('0x38')][_0x0dfc('0x5f')]({'where':{'id':_0x4ec4bc[_0x0dfc('0xbc')]['id']}})[_0x0dfc('0x26')](handleEntityNotFound(_0x683780,null))[_0x0dfc('0x26')](removeEntity(_0x683780,null))['catch'](handleError(_0x683780,null));};exports[_0x0dfc('0xc1')]=function(_0x5831d5,_0x1f47de){return db[_0x0dfc('0x38')][_0x0dfc('0xc1')]()[_0x0dfc('0x26')](respondWithResult(_0x1f47de,null))['catch'](handleError(_0x1f47de,null));};exports[_0x0dfc('0xc2')]=function(_0x1b3192,_0x3ab54a,_0x1c8423){return db[_0x0dfc('0xc3')][_0x0dfc('0x5f')]({'where':{'id':_0x1b3192[_0x0dfc('0xbc')]['id']}})['then'](handleEntityNotFound(_0x3ab54a,null))['then'](function(_0x1e60ec){if(_0x1e60ec){return _0x1e60ec[_0x0dfc('0xc2')](_0x1b3192[_0x0dfc('0x74')][_0x0dfc('0xc4')],_['omit'](_0x1b3192[_0x0dfc('0x74')],[_0x0dfc('0xc4'),'id'])||{});}})[_0x0dfc('0x26')](respondWithResult(_0x3ab54a,null))[_0x0dfc('0xc0')](handleError(_0x3ab54a,null));};exports[_0x0dfc('0xc5')]=function(_0x35c502,_0x368c84,_0x522592){var _0x3825f6={'raw':![],'where':{}};var _0x535534={};var _0x4fa292={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x0dfc('0xc6')]({'where':{'id':_0x35c502[_0x0dfc('0xbc')]['id']}})[_0x0dfc('0x26')](handleEntityNotFound(_0x368c84,null))[_0x0dfc('0x26')](function(_0x5e445d){if(_0x5e445d){_0x535534[_0x0dfc('0x3b')]=_[_0x0dfc('0x3e')](db[_0x0dfc('0xc3')][_0x0dfc('0x39')]);_0x535534['query']=_['keys'](_0x35c502[_0x0dfc('0x3d')]);_0x535534[_0x0dfc('0x3f')]=_[_0x0dfc('0x40')](_0x535534[_0x0dfc('0x3b')],_0x535534[_0x0dfc('0x3d')]);_0x3825f6['attributes']=_[_0x0dfc('0x40')](_0x535534[_0x0dfc('0x3b')],qs[_0x0dfc('0x42')](_0x35c502[_0x0dfc('0x3d')]['fields']));_0x3825f6[_0x0dfc('0x41')]=_0x3825f6['attributes']['length']?_0x3825f6[_0x0dfc('0x41')]:_0x535534[_0x0dfc('0x3b')];if(!_0x35c502[_0x0dfc('0x3d')][_0x0dfc('0xc7')]('nolimit')){_0x3825f6[_0x0dfc('0x1c')]=qs[_0x0dfc('0x1c')](_0x35c502['query'][_0x0dfc('0x1c')]);_0x3825f6['offset']=qs['offset'](_0x35c502[_0x0dfc('0x3d')][_0x0dfc('0x1b')]);}_0x3825f6['order']=qs[_0x0dfc('0x45')](_0x35c502[_0x0dfc('0x3d')][_0x0dfc('0x45')]);_0x3825f6['where']=qs[_0x0dfc('0x3f')](_[_0x0dfc('0xc8')](_0x35c502['query'],_0x535534[_0x0dfc('0x3f')]));_0x3825f6['where'][_0x0dfc('0xb8')]=_0x5e445d['id'];if(_0x35c502[_0x0dfc('0x3d')][_0x0dfc('0x8a')]){_0x3825f6[_0x0dfc('0x79')]=_[_0x0dfc('0xa1')](_0x3825f6[_0x0dfc('0x79')],{'$or':_['map'](_0x3825f6['attributes'],function(_0x2a557c){var _0x3e7b7b={};_0x3e7b7b[_0x2a557c]={'$like':'%'+_0x35c502['query'][_0x0dfc('0x8a')]+'%'};return _0x3e7b7b;})});}if(_0x35c502[_0x0dfc('0x3d')]['$gte']){var _0x4f87e0=_0x35c502[_0x0dfc('0x3d')][_0x0dfc('0x7e')]['split'](',');var _0x454933={};_0x454933[_0x4f87e0[0x0]]={'$gte':moment(_0x4f87e0[0x1])[_0x0dfc('0xc9')](_0x0dfc('0xca'))};_0x3825f6['where']=_[_0x0dfc('0xa1')](_0x3825f6[_0x0dfc('0x79')],_0x454933);}_0x3825f6=_[_0x0dfc('0xa1')]({},_0x3825f6,_0x35c502[_0x0dfc('0xbf')]);return db['FaxMessage'][_0x0dfc('0x1e')]({'where':_0x3825f6['where']})[_0x0dfc('0x26')](function(_0xe7fcf3){_0x4fa292[_0x0dfc('0x1e')]=_0xe7fcf3;if(_0x35c502[_0x0dfc('0x3d')][_0x0dfc('0xbd')]){_0x3825f6[_0x0dfc('0xbe')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3825f6);})[_0x0dfc('0x26')](function(_0x423ad5){_0x4fa292[_0x0dfc('0xba')]=_0x423ad5;return _0x4fa292;});}})[_0x0dfc('0x26')](respondWithFilteredResult(_0x368c84,_0x3825f6))[_0x0dfc('0xc0')](handleError(_0x368c84,null));};exports['addTags']=function(_0x3acea4,_0x4fe997,_0x4d3ed1){return db['FaxInteraction'][_0x0dfc('0x5f')]({'where':{'id':_0x3acea4[_0x0dfc('0xbc')]['id']}})[_0x0dfc('0x26')](handleEntityNotFound(_0x4fe997,null))[_0x0dfc('0x26')](function(_0x8f41f){if(_0x8f41f){return _0x8f41f['setTags'](_0x3acea4[_0x0dfc('0x74')]['ids'],_[_0x0dfc('0xcb')](_0x3acea4[_0x0dfc('0x74')],[_0x0dfc('0xc4'),'id'])||{})[_0x0dfc('0xcc')](function(){return db[_0x0dfc('0x6f')][_0x0dfc('0xcd')]({'attributes':['id','name',_0x0dfc('0x48')],'where':{'id':_0x3acea4['body'][_0x0dfc('0xc4')]}});})[_0x0dfc('0x26')](function(_0xed35c1){socket['emit'](_0x0dfc('0xce'),{'id':Number(_0x3acea4[_0x0dfc('0xbc')]['id']),'tags':_0xed35c1||[]});return{'id':Number(_0x3acea4[_0x0dfc('0xbc')]['id']),'tags':_0xed35c1||[]};});}})[_0x0dfc('0x26')](respondWithResult(_0x4fe997,null))['catch'](handleError(_0x4fe997,null));};exports['removeTags']=function(_0x5340c0,_0x458d10,_0x1a39b7){return db[_0x0dfc('0x38')][_0x0dfc('0x5f')]({'where':{'id':_0x5340c0[_0x0dfc('0xbc')]['id']}})[_0x0dfc('0x26')](handleEntityNotFound(_0x458d10,null))[_0x0dfc('0x26')](function(_0xcf6a1a){if(_0xcf6a1a){return _0xcf6a1a['removeTags'](_0x5340c0[_0x0dfc('0x3d')][_0x0dfc('0xc4')]);}})['then'](respondWithStatusCode(_0x458d10,null))[_0x0dfc('0xc0')](handleError(_0x458d10,null));};exports[_0x0dfc('0xcf')]=function(_0x3a75c7,_0x5a5010){var _0x457c0d=moment()['unix']()[_0x0dfc('0x9f')]();var _0x26c823=path[_0x0dfc('0xd0')](config['root'],'server',_0x0dfc('0xd1'),_0x0dfc('0xd2'));var _0xbfa8de=path['join'](config['root'],_0x0dfc('0xd3'),_0x0dfc('0xd1'),_0x0dfc('0xd4'));var _0x52f548=path['join'](_0x26c823,_0x457c0d);var _0x20f596=util[_0x0dfc('0xc9')](_0x0dfc('0xd5'),_0x3a75c7[_0x0dfc('0xbc')]['id'],_0x457c0d);var _0x2f1cd9=path[_0x0dfc('0xd0')](_0x26c823,_0x20f596);var _0x579c2c=[];_0x579c2c[_0x0dfc('0x30')]({'model':db[_0x0dfc('0xd6')],'as':_0x0dfc('0xd6'),'raw':!![]});var _0xbcfedd=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body',_0x0dfc('0x7c')],'include':_0x579c2c}];return db['FaxInteraction'][_0x0dfc('0x5f')]({'where':{'id':_0x3a75c7[_0x0dfc('0xbc')]['id']},'include':_0xbcfedd})[_0x0dfc('0x26')](handleEntityNotFound(_0x5a5010,null))[_0x0dfc('0x26')](function(_0x46c3be){if(_0x46c3be&&_0x46c3be[_0x0dfc('0xd7')]){var _0x9e4aa3=_0x46c3be[_0x0dfc('0xd8')]({'plain':!![]});fs[_0x0dfc('0xd9')](_0x52f548);for(var _0x38989c=0x0;_0x38989c<_0x9e4aa3[_0x0dfc('0xd7')][_0x0dfc('0x43')];_0x38989c++){var _0x6a55d7=_0x9e4aa3[_0x0dfc('0xd7')][_0x38989c][_0x0dfc('0xd6')];if(_0x6a55d7){var _0x5b968e=path[_0x0dfc('0xd0')](_0xbfa8de,_0x6a55d7[_0x0dfc('0xda')]);if(fs['existsSync'](_0x5b968e)){fs[_0x0dfc('0xdb')](_0x5b968e)[_0x0dfc('0xdc')](fs[_0x0dfc('0xdd')](path[_0x0dfc('0xd0')](_0x52f548,_0x6a55d7[_0x0dfc('0xda')])));}}}return BPromise[_0x0dfc('0x98')]()[_0x0dfc('0x26')](function(){return new BPromise(function(_0x307fbc,_0x490c9f){zipdir(_0x52f548,{'saveTo':_0x2f1cd9},function(_0x42aa76,_0x46ca53){if(_0x42aa76)return _0x490c9f(_0x42aa76);return _0x307fbc(_0x46ca53);});})[_0x0dfc('0x26')](function(){return new BPromise(function(_0x1383a2,_0x339236){rimraf(_0x52f548,function(_0x2c2e1d){if(_0x2c2e1d)_0x339236(_0x2c2e1d);return _0x1383a2();});});})[_0x0dfc('0x26')](function(){return _0x5a5010['download'](_0x2f1cd9,_0x20f596,function(_0x21bcbe){if(_0x21bcbe){console[_0x0dfc('0xde')]('err',_0x21bcbe);}else{fs['unlinkSync'](_0x2f1cd9);}});});});}else{return _0x5a5010[_0x0dfc('0x19')](0xc8);}})[_0x0dfc('0xc0')](handleError(_0x5a5010,null));}; \ No newline at end of file +var _0x3385=['find','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','text','keys','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','merge','options','create','describe','addMessage','ids','getMessages','findOne','FaxMessage','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','faxInteractionTags:save','removeTags','download','unix','join','server','files','root','attachments','format','transcript-%d-%s.zip','Attachment','mkdirSync','Messages','basename','existsSync','pipe','createWriteStream','log','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','talking','answered','unmanaged','total','UserId','waiting','closed','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','u.id\x20=\x20ui.UserId','select','fax_interactions','left_join','users','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions'];(function(_0x1b3c82,_0x4cf0ca){var _0x435a72=function(_0x2653a8){while(--_0x2653a8){_0x1b3c82['push'](_0x1b3c82['shift']());}};_0x435a72(++_0x4cf0ca);}(_0x3385,0x15a));var _0x5338=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x3385[_0x424501];return _0xb719af;};'use strict';var emlformat=require(_0x5338('0x0'));var rimraf=require(_0x5338('0x1'));var zipdir=require(_0x5338('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5338('0x3'));var moment=require(_0x5338('0x4'));var BPromise=require(_0x5338('0x5'));var Mustache=require(_0x5338('0x6'));var util=require('util');var path=require(_0x5338('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5338('0x8'));var fs=require('fs');var fs_extra=require(_0x5338('0x9'));var _=require(_0x5338('0xa'));var squel=require('squel');var crypto=require(_0x5338('0xb'));var jsforce=require(_0x5338('0xc'));var deskjs=require(_0x5338('0xd'));var toCsv=require(_0x5338('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5338('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5338('0x10'));var hardwareService=require(_0x5338('0x11'));var logger=require('../../config/logger')(_0x5338('0x12'));var utils=require(_0x5338('0x13'));var config=require(_0x5338('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5338('0x15'))['db'];config[_0x5338('0x16')]=_[_0x5338('0x17')](config[_0x5338('0x16')],{'host':_0x5338('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5338('0x16')]));require(_0x5338('0x19'))[_0x5338('0x1a')](socket);function respondWithStatusCode(_0x4255e6,_0x405a25){_0x405a25=_0x405a25||0xcc;return function(_0x573e27){if(_0x573e27){return _0x4255e6[_0x5338('0x1b')](_0x405a25);}return _0x4255e6[_0x5338('0x1c')](_0x405a25)['end']();};}function respondWithResult(_0x39b7a6,_0x4c5c8f){_0x4c5c8f=_0x4c5c8f||0xc8;return function(_0x135ed6){if(_0x135ed6){return _0x39b7a6[_0x5338('0x1c')](_0x4c5c8f)['json'](_0x135ed6);}};}function respondWithFilteredResult(_0x102db3,_0x122086){return function(_0x104c97){if(_0x104c97){var _0x4b30e2=typeof _0x122086['offset']===_0x5338('0x1d')&&typeof _0x122086[_0x5338('0x1e')]==='undefined';var _0x29cacc=_0x104c97['count'];var _0x21f705=_0x4b30e2?0x0:_0x122086[_0x5338('0x1f')];var _0x42e1f2=_0x4b30e2?_0x104c97[_0x5338('0x20')]:_0x122086[_0x5338('0x1f')]+_0x122086[_0x5338('0x1e')];var _0x3b131a;if(_0x42e1f2>=_0x29cacc){_0x42e1f2=_0x29cacc;_0x3b131a=0xc8;}else{_0x3b131a=0xce;}_0x102db3['status'](_0x3b131a);return _0x102db3[_0x5338('0x21')](_0x5338('0x22'),_0x21f705+'-'+_0x42e1f2+'/'+_0x29cacc)['json'](_0x104c97);}return null;};}function patchUpdates(_0x29f0c6){return function(_0x490f37){try{jsonpatch[_0x5338('0x23')](_0x490f37,_0x29f0c6,!![]);}catch(_0x2b78d4){return BPromise[_0x5338('0x24')](_0x2b78d4);}return _0x490f37[_0x5338('0x25')]();};}function saveUpdates(_0x1bd34e,_0x3e4c77){return function(_0x3c6bce){if(_0x3c6bce){return _0x3c6bce[_0x5338('0x26')](_0x1bd34e)[_0x5338('0x27')](function(_0x860165){return _0x860165;});}return null;};}function removeEntity(_0x29bf50,_0x27b94b){return function(_0x1e3375){if(_0x1e3375){return _0x1e3375[_0x5338('0x28')]()[_0x5338('0x27')](function(){_0x29bf50[_0x5338('0x1c')](0xcc)[_0x5338('0x29')]();});}};}function handleEntityNotFound(_0xb591db,_0x4eab64){return function(_0x58b85d){if(!_0x58b85d){_0xb591db[_0x5338('0x1b')](0x194);}return _0x58b85d;};}function handleError(_0x319668,_0x5b8948){_0x5b8948=_0x5b8948||0x1f4;return function(_0x402f74){logger[_0x5338('0x2a')](_0x402f74[_0x5338('0x2b')]);if(_0x402f74['name']){delete _0x402f74[_0x5338('0x2c')];}_0x319668[_0x5338('0x1c')](_0x5b8948)['send'](_0x402f74);};}function getInteractionUsers(_0x47954f,_0x8798fb){return new BPromise(function(_0x372c4b,_0x4bc2d9){try{if(_0x8798fb[_0x47954f['id']]){_0x47954f[_0x5338('0x2d')]=_[_0x5338('0x2e')](_0x8798fb[_0x47954f['id']],function(_0x273d44){return{'id':_0x273d44['id'],'fullname':_0x273d44[_0x5338('0x2f')]};});}}catch(_0x38e4ca){_0x4bc2d9(_0x38e4ca);}_0x372c4b(_0x47954f);});}function getInteractionTags(_0xd261ab,_0x4ccfbb){return new BPromise(function(_0x575758,_0x70946a){try{if(_0xd261ab[_0x5338('0x30')]){_0xd261ab['Tags']=[];_0xd261ab[_0x5338('0x30')][_0x5338('0x31')](',')[_0x5338('0x32')](function(_0x226e0c){_0xd261ab[_0x5338('0x33')][_0x5338('0x34')](_0x4ccfbb[_0x226e0c]);});}delete _0xd261ab[_0x5338('0x30')];}catch(_0x199828){_0x70946a(_0x199828);}_0x575758(_0xd261ab);});}function updateFaxInteraction(_0x290136,_0x516ea9,_0x228bd6){return new BPromise(function(_0x140a28,_0x331150){return getInteractionUsers(_0x290136,_0x228bd6)[_0x5338('0x27')](function(_0x511de4){return getInteractionTags(_0x511de4,_0x516ea9);})[_0x5338('0x27')](function(_0x5ebeec){return getStateInteraction(_0x5ebeec);})[_0x5338('0x27')](function(_0x4c00a2){_0x140a28(_0x4c00a2);})[_0x5338('0x35')](function(_0x328a71){_0x331150(_0x328a71);});});}function getStateInteraction(_0x11e63e){return new BPromise(function(_0x32e8c9){_0x11e63e['waiting']=0x0;_0x11e63e[_0x5338('0x36')]=0x0;_0x11e63e[_0x5338('0x37')]=0x0;_0x11e63e[_0x5338('0x38')]=0x0;_0x11e63e[_0x5338('0x39')]=0x0;if(!_0x11e63e['closed']&&!_0x11e63e[_0x5338('0x3a')]){_0x11e63e[_0x5338('0x3b')]+=0x1;}if(!_0x11e63e[_0x5338('0x3c')]&&_0x11e63e[_0x5338('0x3a')]){_0x11e63e[_0x5338('0x36')]+=0x1;if(_0x11e63e['waiting']){_0x11e63e[_0x5338('0x3b')]-=0x1;}}if(_0x11e63e[_0x5338('0x3c')]&&_0x11e63e[_0x5338('0x3a')]){_0x11e63e[_0x5338('0x37')]+=0x1;if(_0x11e63e[_0x5338('0x36')]){_0x11e63e[_0x5338('0x36')]-=0x1;}}if(_0x11e63e['closed']&&!_0x11e63e[_0x5338('0x3a')]){_0x11e63e['unmanaged']+=0x1;if(_0x11e63e[_0x5338('0x3b')]){_0x11e63e[_0x5338('0x3b')]-=0x1;}}_0x11e63e[_0x5338('0x39')]+=0x1;_0x32e8c9(_0x11e63e);});}exports[_0x5338('0x3d')]=function(_0x40060a,_0x248695){var _0x5cfc95={},_0x582c51={},_0x172086={'count':0x0,'rows':[]};var _0x2a9275=_[_0x5338('0x2e')](db[_0x5338('0x3e')][_0x5338('0x3f')],function(_0x50a18f){return{'name':_0x50a18f[_0x5338('0x40')],'type':_0x50a18f[_0x5338('0x41')][_0x5338('0x42')]};});_0x582c51[_0x5338('0x43')]=_['map'](_0x2a9275,_0x5338('0x2c'));_0x582c51['query']=_['keys'](_0x40060a[_0x5338('0x44')]);_0x582c51[_0x5338('0x45')]=_['intersection'](_0x582c51[_0x5338('0x43')],_0x582c51[_0x5338('0x44')]);_0x5cfc95['attributes']=_[_0x5338('0x46')](_0x582c51[_0x5338('0x43')],qs[_0x5338('0x47')](_0x40060a[_0x5338('0x44')][_0x5338('0x47')]));_0x5cfc95[_0x5338('0x48')]=_0x5cfc95[_0x5338('0x48')][_0x5338('0x49')]?_0x5cfc95[_0x5338('0x48')]:_0x582c51[_0x5338('0x43')];if(!_0x40060a['query'][_0x5338('0x4a')](_0x5338('0x4b'))){_0x5cfc95[_0x5338('0x1e')]=qs[_0x5338('0x1e')](_0x40060a[_0x5338('0x44')][_0x5338('0x1e')]);_0x5cfc95[_0x5338('0x1f')]=qs[_0x5338('0x1f')](_0x40060a[_0x5338('0x44')]['offset']);}_0x5cfc95['order']=qs[_0x5338('0x4c')](_0x40060a['query']['sort']);_0x5cfc95['where']=qs['filters'](_['pick'](_0x40060a[_0x5338('0x44')],_0x582c51[_0x5338('0x45')]),_0x2a9275);var _0x2332db=[];var _0x501dcf=squel['select']()[_0x5338('0x4d')]('id')[_0x5338('0x4d')](_0x5338('0x2c'))[_0x5338('0x4d')](_0x5338('0x4e'))[_0x5338('0x4f')](_0x5338('0x50'));var _0x53838a=squel['select']()[_0x5338('0x4d')](_0x5338('0x51'))[_0x5338('0x4d')](_0x5338('0x52'))['field'](_0x5338('0x53'))['from'](_0x5338('0x54'),'ui')['left_join']('users','u',_0x5338('0x55'));var _0x28f3a5=squel[_0x5338('0x56')]()[_0x5338('0x4f')](_0x5338('0x57'),'i')[_0x5338('0x58')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x5338('0x58')](_0x5338('0x59'),'o','o.id\x20=\x20i.UserId')[_0x5338('0x58')](_0x5338('0x5a'),'a',_0x5338('0x5b'))['left_join']('fax_messages','me',_0x5338('0x5c'))[_0x5338('0x58')](_0x5338('0x5d'),'it',_0x5338('0x5e'))[_0x5338('0x58')](_0x5338('0x50'),'t',_0x5338('0x5f'));var _0x8d8970=squel['expr']();var _0x487aac=[];var _0x317152=squel[_0x5338('0x60')]();var _0xecbc80;if(_0x40060a[_0x5338('0x44')][_0x5338('0x61')]){_0xecbc80=as[_0x5338('0x62')](_0x40060a['query'][_0x5338('0x61')]);var _0x5f1f99=_0xecbc80['sqlOperator'];for(var _0x57cab8=0x0;_0x57cab8<_0xecbc80['conditions'][_0x5338('0x49')];_0x57cab8++){var _0x3e968d=_0xecbc80[_0x5338('0x63')][_0x57cab8];var _0x4a2962='i';var _0x15dc3e=_[_0x5338('0x64')](_0x2a9275,['name',_0x3e968d['field']]);if(!_0x15dc3e){switch(_0x3e968d[_0x5338('0x4d')]){case'unreadMessages':if(_0x3e968d[_0x5338('0x65')]==0x1){_0x28f3a5['having']('`'+_0x3e968d['field']+_0x5338('0x66'));}else{_0x28f3a5[_0x5338('0x67')]('`'+_0x3e968d[_0x5338('0x4d')]+_0x5338('0x68'));}break;case _0x5338('0x69'):if(_0x3e968d[_0x5338('0x6a')]===_0x5338('0x6b')){if(_0x3e968d[_0x5338('0x65')][_0x5338('0x31')]('\x20')['length']>0x1){_0x8d8970[_0x5f1f99](_0x5338('0x6c'),qs['getFullTextValue'](_0x3e968d[_0x5338('0x65')]),null);}else{var _0xd33bd4='%'+_0x3e968d[_0x5338('0x65')]+'%';_0x8d8970[_0x5f1f99]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xd33bd4,_0xd33bd4,_0xd33bd4);}}else{_0x15dc3e=_['find'](_0x2a9275,[_0x5338('0x2c'),_0x5338('0x6d')]);_0x3e968d[_0x5338('0x4d')]=_0x5338('0x6d');_0x1cfdb3=as['buildExpression'](_0x4a2962,_0x15dc3e['type'],_0x3e968d);_0x8d8970[_0x5f1f99](_0x1cfdb3['text'],_0x1cfdb3[_0x5338('0x65')][_0x5338('0x6e')],_0x1cfdb3[_0x5338('0x65')][_0x5338('0x29')]);}break;case _0x5338('0x6f'):var _0x438e63=_0x3e968d[_0x5338('0x65')][_0x5338('0x31')](',')[_0x5338('0x2e')](function(_0x670abf){return Number(_0x670abf);});_0x438e63[_0x5338('0x32')](function(_0x46994e){_0x317152['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x46994e+',%');});_0x487aac=_[_0x5338('0x70')](_0x487aac,_0x438e63);break;case'User':if(_0x3e968d['operator']===_0x5338('0x6b')){_0x8d8970[_0x5f1f99](_0x5338('0x71'),'%'+_0x3e968d[_0x5338('0x65')]+'%',null);}else{_0x15dc3e=_['find'](_0x2a9275,['name',_0x5338('0x3a')]);_0x3e968d[_0x5338('0x4d')]='UserId';_0x1cfdb3=as['buildExpression'](_0x4a2962,_0x15dc3e[_0x5338('0x41')],_0x3e968d);_0x8d8970[_0x5f1f99](_0x1cfdb3['text'],_0x1cfdb3[_0x5338('0x65')]['start'],_0x1cfdb3['value'][_0x5338('0x29')]);}break;case _0x5338('0x72'):_0x1cfdb3=as['buildExpression']('me',null,_0x3e968d);_0x8d8970[_0x5f1f99](_0x1cfdb3[_0x5338('0x73')],_0x1cfdb3[_0x5338('0x65')][_0x5338('0x6e')],_0x1cfdb3[_0x5338('0x65')][_0x5338('0x29')]);break;}}else{var _0x1cfdb3=as['buildExpression'](_0x4a2962,_0x15dc3e[_0x5338('0x41')],_0x3e968d);_0x8d8970[_0x5f1f99](_0x1cfdb3[_0x5338('0x73')],_0x1cfdb3[_0x5338('0x65')]['start'],_0x1cfdb3[_0x5338('0x65')][_0x5338('0x29')]);}}}else{var _0x59d2f3=_(_0x40060a[_0x5338('0x44')])[_0x5338('0x74')]()[_0x5338('0x2e')](function(_0x4f78e1){return _[_0x5338('0x75')](_0x2a9275,[_0x5338('0x2c'),_0x4f78e1])?_0x4f78e1:undefined;})[_0x5338('0x76')]()[_0x5338('0x65')]();if(!_[_0x5338('0x77')](_0x59d2f3)){_0x59d2f3['forEach'](function(_0x5a1d58){if(_0x5a1d58===_0x5338('0x78')){_0x28f3a5[_0x5338('0x79')](_0x5338('0x7a'),[][_0x5338('0x7b')](_0x40060a['query'][_0x5a1d58]));}else if(_0x5a1d58===_0x5338('0x7c')){var _0x45ba67=JSON[_0x5338('0x7d')](_0x40060a[_0x5338('0x44')][_0x5a1d58])[_0x5338('0x7e')];var _0x143b6c=JSON[_0x5338('0x7d')](_0x40060a[_0x5338('0x44')][_0x5a1d58])[_0x5338('0x7f')];_0x28f3a5[_0x5338('0x79')](_0x5338('0x80'),_0x45ba67,_0x143b6c);}else{if(_0x40060a['query'][_0x5a1d58]===_0x5338('0x81')){_0x28f3a5[_0x5338('0x79')]('i.'+_0x5a1d58+_0x5338('0x82'));}else{_0x28f3a5[_0x5338('0x79')]('i.'+_0x5a1d58+_0x5338('0x83'),_0x40060a[_0x5338('0x44')][_0x5a1d58]);}}});}if(_0x40060a[_0x5338('0x44')][_0x5338('0x84')]){if(_0x40060a[_0x5338('0x44')]['read']==0x1){_0x28f3a5[_0x5338('0x67')]('`unreadMessages`\x20=\x200');}else{_0x28f3a5[_0x5338('0x67')](_0x5338('0x85'));}}if(_0x40060a['query'][_0x5338('0x86')]){_0x487aac=_[_0x5338('0x87')](_0x40060a[_0x5338('0x44')][_0x5338('0x86')])?_0x40060a[_0x5338('0x44')]['tag']:new Array(_0x40060a[_0x5338('0x44')]['tag']);_0x487aac[_0x5338('0x32')](function(_0x3b20e0){_0x317152['or'](_0x5338('0x88'),'%,'+_0x3b20e0+',%');});}if(_0x40060a['query']['filter']){var _0x2c5032=_0x40060a[_0x5338('0x44')][_0x5338('0x89')][_0x5338('0x8a')]('\x5c','\x5c\x5c')[_0x5338('0x8a')](/'/g,'\x27\x27');if(qs[_0x5338('0x8b')](_0x2c5032)){_0x8d8970['or'](_0x5338('0x8c'),_0x2c5032+'%')['or']('i.fax\x20LIKE\x20?',_0x2c5032+'%');}_0x8d8970['or'](_0x5338('0x8d'),_0x2c5032+'%');}}_0x28f3a5[_0x5338('0x79')](_0x8d8970);_0x28f3a5[_0x5338('0x8e')](_0x5338('0x8f'));var _0x13adad={'type':db[_0x5338('0x90')]['QueryTypes'][_0x5338('0x91')],'raw':!![]};var _0x45dc50=_0x28f3a5[_0x5338('0x92')]();_0x45dc50[_0x5338('0x4d')](_0x5338('0x8f'));_0x45dc50[_0x5338('0x4d')](_0x5338('0x93'),_0x5338('0x94'));if(_0x5cfc95[_0x5338('0x95')]){_0x5cfc95[_0x5338('0x95')]['forEach'](function(_0x309a6e){var _0x4a89a5=_0x309a6e[0x0]==='contactName'?_0x309a6e[0x0]:'i.'+_0x309a6e[0x0];_0x28f3a5[_0x5338('0x95')](_0x4a89a5,_0x309a6e[0x1]===_0x5338('0x96')?![]:!![]);});}if(!_[_0x5338('0x77')](_0x487aac)){_0x28f3a5[_0x5338('0x67')](_0x317152);_0x45dc50['where'](_0x5338('0x97'),_0x487aac);}BPromise[_0x5338('0x98')]()[_0x5338('0x27')](function(){if(!_0xecbc80){if(_0x40060a[_0x5338('0x44')][_0x5338('0x78')])return;_0x45dc50[_0x5338('0x79')](_0x5338('0x99'));_0x28f3a5['where'](_0x5338('0x99'));return;}if(_0x40060a[_0x5338('0x9a')][_0x5338('0x9b')]!==_0x5338('0x9c'))return;return _0x40060a[_0x5338('0x9a')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x5338('0x27')](function(_0x4d92cf){if(_[_0x5338('0x77')](_0x4d92cf)){_0x45dc50[_0x5338('0x79')](_0x5338('0x9d'));_0x28f3a5['where'](_0x5338('0x9d'));}else{_0x45dc50[_0x5338('0x79')](_0x5338('0x7a'),_['map'](_0x4d92cf,'id'));_0x28f3a5[_0x5338('0x79')](_0x5338('0x7a'),_[_0x5338('0x2e')](_0x4d92cf,'id'));}});})['then'](function(){if(_0x40060a['user'][_0x5338('0x9b')]==='agent'&&!_0xecbc80&&!_0x40060a[_0x5338('0x44')][_0x5338('0x78')])return[];return db[_0x5338('0x9e')][_0x5338('0x44')](_0x45dc50['toString'](),_0x13adad);})['then'](function(_0x5ca8a3){_0x172086['count']=_0x5ca8a3[_0x5338('0x49')];if(_0x172086[_0x5338('0x20')]===0x0)return[];return db[_0x5338('0x9e')][_0x5338('0x44')](_0x501dcf[_0x5338('0x9f')](),_0x13adad)['then'](function(_0x1cf372){_0x2332db=_['keyBy'](_0x1cf372,'id');_0x13adad=_['merge'](_0x13adad,{'model':db[_0x5338('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40060a['query'][_0x5338('0x47')]){_0x5cfc95[_0x5338('0x48')][_0x5338('0x32')](function(_0x2e5d73){_0x28f3a5[_0x5338('0x4d')]('i.'+_0x2e5d73);});}else{_0x28f3a5[_0x5338('0x4d')](_0x5338('0x93'),'unreadMessages');_0x28f3a5['field']('a.key',_0x5338('0xa0'));_0x28f3a5[_0x5338('0x4d')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x28f3a5[_0x5338('0x4d')](_0x5338('0xa1'),_0x5338('0xa2'));_0x28f3a5[_0x5338('0x4d')](_0x5338('0xa3'));_0x28f3a5[_0x5338('0x4d')](_0x5338('0xa4'),_0x5338('0xa5'));_0x28f3a5[_0x5338('0x4d')](_0x5338('0xa6'),_0x5338('0xa7'));_0x28f3a5[_0x5338('0x4d')](_0x5338('0xa8'),'Contact.email');_0x28f3a5[_0x5338('0x4d')](_0x5338('0xa9'),_0x5338('0xaa'));_0x28f3a5['field'](_0x5338('0xab'),_0x5338('0xac'));_0x28f3a5[_0x5338('0x4d')](_0x5338('0xad'),_0x5338('0xae'));_0x28f3a5[_0x5338('0x4d')](_0x5338('0xaf'),_0x5338('0xb0'));_0x28f3a5[_0x5338('0x4d')]('o.internal',_0x5338('0xb1'));_0x28f3a5[_0x5338('0x4d')](_0x5338('0xb2'),_0x5338('0x30'));}if(_0x5cfc95[_0x5338('0x1e')])_0x28f3a5['limit'](_0x5cfc95[_0x5338('0x1e')]);if(_0x5cfc95['offset'])_0x28f3a5[_0x5338('0x1f')](_0x5cfc95[_0x5338('0x1f')]);return db[_0x5338('0x9e')]['query'](_0x28f3a5[_0x5338('0x9f')](),_0x13adad);})[_0x5338('0x27')](function(_0x11de46){if(_0x11de46['length']>0x0)_0x53838a[_0x5338('0x79')](_0x5338('0xb3'),_[_0x5338('0x2e')](_0x11de46,'id'));return db['sequelize'][_0x5338('0x44')](_0x53838a[_0x5338('0x9f')](),_0x13adad)['then'](function(_0x5519fd){var _0x18371e=_[_0x5338('0xb4')](_0x5519fd,_0x5338('0xb5'));var _0x48339c=[];_0x11de46['forEach'](function(_0x3a088c){_0x48339c['push'](updateFaxInteraction(_0x3a088c,_0x2332db,_0x18371e));});return BPromise[_0x5338('0xb6')](_0x48339c);});});})[_0x5338('0x27')](function(_0x6353ea){_0x172086[_0x5338('0xb7')]=_0x6353ea;return _0x172086;})[_0x5338('0x27')](respondWithFilteredResult(_0x248695,_0x5cfc95))['catch'](handleError(_0x248695,null));};exports[_0x5338('0xb8')]=function(_0x1f37b4,_0xf1a858){var _0x8e6865={'raw':![],'where':{'id':_0x1f37b4[_0x5338('0xb9')]['id']}},_0x97f207={};_0x97f207['model']=_['keys'](db[_0x5338('0x3e')][_0x5338('0x3f')]);_0x97f207[_0x5338('0x44')]=_[_0x5338('0x74')](_0x1f37b4[_0x5338('0x44')]);_0x97f207[_0x5338('0x45')]=_[_0x5338('0x46')](_0x97f207[_0x5338('0x43')],_0x97f207[_0x5338('0x44')]);_0x8e6865[_0x5338('0x48')]=_[_0x5338('0x46')](_0x97f207['model'],qs[_0x5338('0x47')](_0x1f37b4[_0x5338('0x44')][_0x5338('0x47')]));_0x8e6865[_0x5338('0x48')]=_0x8e6865[_0x5338('0x48')][_0x5338('0x49')]?_0x8e6865[_0x5338('0x48')]:_0x97f207['model'];if(_0x1f37b4[_0x5338('0x44')][_0x5338('0xba')]){_0x8e6865[_0x5338('0xbb')]=[{'all':!![]}];}_0x8e6865=_[_0x5338('0xbc')]({},_0x8e6865,_0x1f37b4[_0x5338('0xbd')]);return db['FaxInteraction'][_0x5338('0x64')](_0x8e6865)[_0x5338('0x27')](handleEntityNotFound(_0xf1a858,null))[_0x5338('0x27')](respondWithResult(_0xf1a858,null))[_0x5338('0x35')](handleError(_0xf1a858,null));};exports[_0x5338('0xbe')]=function(_0x4bb0a7,_0x35e440){return db[_0x5338('0x3e')][_0x5338('0xbe')](_0x4bb0a7['body'],{})[_0x5338('0x27')](respondWithResult(_0x35e440,0xc9))[_0x5338('0x35')](handleError(_0x35e440,null));};exports[_0x5338('0x26')]=function(_0x59cf51,_0x443294){if(_0x59cf51[_0x5338('0x72')]['id']){delete _0x59cf51[_0x5338('0x72')]['id'];}return db[_0x5338('0x3e')][_0x5338('0x64')]({'where':{'id':_0x59cf51[_0x5338('0xb9')]['id']}})[_0x5338('0x27')](handleEntityNotFound(_0x443294,null))['then'](saveUpdates(_0x59cf51[_0x5338('0x72')],null))[_0x5338('0x27')](respondWithResult(_0x443294,null))[_0x5338('0x35')](handleError(_0x443294,null));};exports[_0x5338('0x28')]=function(_0x6e5131,_0x35e3cc){return db['FaxInteraction']['find']({'where':{'id':_0x6e5131[_0x5338('0xb9')]['id']}})['then'](handleEntityNotFound(_0x35e3cc,null))[_0x5338('0x27')](removeEntity(_0x35e3cc,null))[_0x5338('0x35')](handleError(_0x35e3cc,null));};exports[_0x5338('0xbf')]=function(_0x21a85b,_0x34d72c){return db[_0x5338('0x3e')]['describe']()[_0x5338('0x27')](respondWithResult(_0x34d72c,null))['catch'](handleError(_0x34d72c,null));};exports[_0x5338('0xc0')]=function(_0x5ef15a,_0x1eef65,_0x37df81){return db['FaxMessage']['find']({'where':{'id':_0x5ef15a[_0x5338('0xb9')]['id']}})[_0x5338('0x27')](handleEntityNotFound(_0x1eef65,null))['then'](function(_0x9a8386){if(_0x9a8386){return _0x9a8386['addMessage'](_0x5ef15a[_0x5338('0x72')][_0x5338('0xc1')],_['omit'](_0x5ef15a[_0x5338('0x72')],[_0x5338('0xc1'),'id'])||{});}})[_0x5338('0x27')](respondWithResult(_0x1eef65,null))[_0x5338('0x35')](handleError(_0x1eef65,null));};exports[_0x5338('0xc2')]=function(_0x19599b,_0x577120,_0x4b2056){var _0x428030={'raw':![],'where':{}};var _0x186c44={};var _0x47329e={'count':0x0,'rows':[]};return db[_0x5338('0x3e')][_0x5338('0xc3')]({'where':{'id':_0x19599b[_0x5338('0xb9')]['id']}})[_0x5338('0x27')](handleEntityNotFound(_0x577120,null))[_0x5338('0x27')](function(_0x58a669){if(_0x58a669){_0x186c44[_0x5338('0x43')]=_['keys'](db[_0x5338('0xc4')][_0x5338('0x3f')]);_0x186c44[_0x5338('0x44')]=_['keys'](_0x19599b['query']);_0x186c44[_0x5338('0x45')]=_['intersection'](_0x186c44['model'],_0x186c44[_0x5338('0x44')]);_0x428030[_0x5338('0x48')]=_[_0x5338('0x46')](_0x186c44['model'],qs[_0x5338('0x47')](_0x19599b['query'][_0x5338('0x47')]));_0x428030[_0x5338('0x48')]=_0x428030[_0x5338('0x48')][_0x5338('0x49')]?_0x428030[_0x5338('0x48')]:_0x186c44[_0x5338('0x43')];if(!_0x19599b[_0x5338('0x44')][_0x5338('0x4a')](_0x5338('0x4b'))){_0x428030[_0x5338('0x1e')]=qs[_0x5338('0x1e')](_0x19599b['query'][_0x5338('0x1e')]);_0x428030[_0x5338('0x1f')]=qs['offset'](_0x19599b[_0x5338('0x44')]['offset']);}_0x428030[_0x5338('0x95')]=qs[_0x5338('0x4c')](_0x19599b[_0x5338('0x44')][_0x5338('0x4c')]);_0x428030[_0x5338('0x79')]=qs[_0x5338('0x45')](_[_0x5338('0xc5')](_0x19599b[_0x5338('0x44')],_0x186c44[_0x5338('0x45')]));_0x428030[_0x5338('0x79')][_0x5338('0xb5')]=_0x58a669['id'];if(_0x19599b[_0x5338('0x44')][_0x5338('0x89')]){_0x428030['where']=_[_0x5338('0xbc')](_0x428030[_0x5338('0x79')],{'$or':_[_0x5338('0x2e')](_0x428030[_0x5338('0x48')],function(_0x5e886c){var _0x5a831e={};_0x5a831e[_0x5e886c]={'$like':'%'+_0x19599b[_0x5338('0x44')][_0x5338('0x89')]+'%'};return _0x5a831e;})});}if(_0x19599b['query'][_0x5338('0x7e')]){var _0x14dd55=_0x19599b['query'][_0x5338('0x7e')]['split'](',');var _0xbe7513={};_0xbe7513[_0x14dd55[0x0]]={'$gte':moment(_0x14dd55[0x1])['format'](_0x5338('0xc6'))};_0x428030[_0x5338('0x79')]=_[_0x5338('0xbc')](_0x428030['where'],_0xbe7513);}_0x428030=_[_0x5338('0xbc')]({},_0x428030,_0x19599b[_0x5338('0xbd')]);return db[_0x5338('0xc4')][_0x5338('0x20')]({'where':_0x428030[_0x5338('0x79')]})['then'](function(_0x21eb88){_0x47329e[_0x5338('0x20')]=_0x21eb88;if(_0x19599b[_0x5338('0x44')][_0x5338('0xba')]){_0x428030[_0x5338('0xbb')]=[{'all':!![]}];}return db[_0x5338('0xc4')][_0x5338('0xc7')](_0x428030);})[_0x5338('0x27')](function(_0x4c8e5a){_0x47329e[_0x5338('0xb7')]=_0x4c8e5a;return _0x47329e;});}})['then'](respondWithFilteredResult(_0x577120,_0x428030))[_0x5338('0x35')](handleError(_0x577120,null));};exports[_0x5338('0xc8')]=function(_0x28fd24,_0x53e368,_0x23e4ee){return db[_0x5338('0x3e')]['find']({'where':{'id':_0x28fd24[_0x5338('0xb9')]['id']}})['then'](handleEntityNotFound(_0x53e368,null))[_0x5338('0x27')](function(_0x272d0e){if(_0x272d0e){return _0x272d0e['setTags'](_0x28fd24[_0x5338('0x72')][_0x5338('0xc1')],_[_0x5338('0xc9')](_0x28fd24[_0x5338('0x72')],['ids','id'])||{})[_0x5338('0xca')](function(){return db[_0x5338('0x6f')][_0x5338('0xc7')]({'attributes':['id','name',_0x5338('0x4e')],'where':{'id':_0x28fd24[_0x5338('0x72')][_0x5338('0xc1')]}});})['then'](function(_0x9ffdeb){socket['emit'](_0x5338('0xcb'),{'id':Number(_0x28fd24[_0x5338('0xb9')]['id']),'tags':_0x9ffdeb||[]});return{'id':Number(_0x28fd24['params']['id']),'tags':_0x9ffdeb||[]};});}})[_0x5338('0x27')](respondWithResult(_0x53e368,null))['catch'](handleError(_0x53e368,null));};exports['removeTags']=function(_0x54cb66,_0x4e6132,_0x3086b0){return db[_0x5338('0x3e')]['find']({'where':{'id':_0x54cb66[_0x5338('0xb9')]['id']}})['then'](handleEntityNotFound(_0x4e6132,null))[_0x5338('0x27')](function(_0x5c8858){if(_0x5c8858){return _0x5c8858[_0x5338('0xcc')](_0x54cb66[_0x5338('0x44')][_0x5338('0xc1')]);}})['then'](respondWithStatusCode(_0x4e6132,null))[_0x5338('0x35')](handleError(_0x4e6132,null));};exports[_0x5338('0xcd')]=function(_0x2d24dc,_0x354617){var _0x301121=moment()[_0x5338('0xce')]()[_0x5338('0x9f')]();var _0x30e258=path[_0x5338('0xcf')](config['root'],_0x5338('0xd0'),_0x5338('0xd1'),'tmp');var _0x500889=path['join'](config[_0x5338('0xd2')],'server','files',_0x5338('0xd3'));var _0x1c7479=path[_0x5338('0xcf')](_0x30e258,_0x301121);var _0x111ab6=util[_0x5338('0xd4')](_0x5338('0xd5'),_0x2d24dc[_0x5338('0xb9')]['id'],_0x301121);var _0x277463=path[_0x5338('0xcf')](_0x30e258,_0x111ab6);var _0x27f76d=[];_0x27f76d['push']({'model':db[_0x5338('0xd6')],'as':_0x5338('0xd6'),'raw':!![]});var _0x9f8bd3=[{'model':db[_0x5338('0xc4')],'as':'Messages','attributes':['id',_0x5338('0x72'),_0x5338('0x7c')],'include':_0x27f76d}];return db[_0x5338('0x3e')]['find']({'where':{'id':_0x2d24dc[_0x5338('0xb9')]['id']},'include':_0x9f8bd3})[_0x5338('0x27')](handleEntityNotFound(_0x354617,null))[_0x5338('0x27')](function(_0x5a010d){if(_0x5a010d&&_0x5a010d['Messages']){var _0x3b0bc3=_0x5a010d['get']({'plain':!![]});fs[_0x5338('0xd7')](_0x1c7479);for(var _0x115b78=0x0;_0x115b78<_0x3b0bc3[_0x5338('0xd8')][_0x5338('0x49')];_0x115b78++){var _0x4e19eb=_0x3b0bc3['Messages'][_0x115b78][_0x5338('0xd6')];if(_0x4e19eb){var _0x1d0a80=path[_0x5338('0xcf')](_0x500889,_0x4e19eb[_0x5338('0xd9')]);if(fs[_0x5338('0xda')](_0x1d0a80)){fs['createReadStream'](_0x1d0a80)[_0x5338('0xdb')](fs[_0x5338('0xdc')](path[_0x5338('0xcf')](_0x1c7479,_0x4e19eb[_0x5338('0xd9')])));}}}return BPromise[_0x5338('0x98')]()['then'](function(){return new BPromise(function(_0x38ee2d,_0x46e578){zipdir(_0x1c7479,{'saveTo':_0x277463},function(_0xc5bc81,_0x4e9b8a){if(_0xc5bc81)return _0x46e578(_0xc5bc81);return _0x38ee2d(_0x4e9b8a);});})['then'](function(){return new BPromise(function(_0x190a3c,_0xc0a387){rimraf(_0x1c7479,function(_0x2aecf2){if(_0x2aecf2)_0xc0a387(_0x2aecf2);return _0x190a3c();});});})['then'](function(){return _0x354617['download'](_0x277463,_0x111ab6,function(_0xd3c189){if(_0xd3c189){console[_0x5338('0xdd')]('err',_0xd3c189);}else{fs[_0x5338('0xde')](_0x277463);}});});});}else{return _0x354617[_0x5338('0x1b')](0xc8);}})['catch'](handleError(_0x354617,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 94a05ba..b7cb3da 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 _0x38cc=['FaxInteraction','FaxMessage','save','remove','then','Users','map','setDataValue','unreadMessages','length','emit','catch','hook','../../mysqldb'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0x38cc,0x195));var _0xc38c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x38cc[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xc38c('0x0'))['db'][_0xc38c('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0xc38c('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc38c('0x3'),'afterUpdate':'update','afterDestroy':_0xc38c('0x4')};function emitEvent(_0xadfe12){return function(_0x17a8cc,_0x9a70ba,_0x442d12){_0x17a8cc['getUsers']({'attributes':['id'],'raw':!![]})[_0xc38c('0x5')](function(_0x44ca75){_0x17a8cc['setDataValue'](_0xc38c('0x6'),_0x44ca75[_0xc38c('0x7')](function(_0x348886){return{'id':_0x348886['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x17a8cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc38c('0x5')](function(_0x115b33){_0x17a8cc[_0xc38c('0x8')](_0xc38c('0x9'),_0x115b33[_0xc38c('0xa')]);FaxInteractionEvents[_0xc38c('0xb')](_0xadfe12+':'+_0x17a8cc['id'],_0x17a8cc);FaxInteractionEvents[_0xc38c('0xb')](_0xadfe12,_0x17a8cc);_0x442d12(null);})[_0xc38c('0xc')](_0x442d12(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xc38c('0xd')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x0b48=['getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','save','remove'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0x0b48,0x15b));var _0x80b4=function(_0x2584c5,_0x2f29c5){_0x2584c5=_0x2584c5-0x0;var _0x35c648=_0x0b48[_0x2584c5];return _0x35c648;};'use strict';var EventEmitter=require(_0x80b4('0x0'));var FaxInteraction=require(_0x80b4('0x1'))['db'][_0x80b4('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x80b4('0x3'),'afterUpdate':'update','afterDestroy':_0x80b4('0x4')};function emitEvent(_0x2c6fd2){return function(_0x21631a,_0x4d32ca,_0xe07853){_0x21631a[_0x80b4('0x5')]({'attributes':['id'],'raw':!![]})[_0x80b4('0x6')](function(_0x11c7d8){_0x21631a[_0x80b4('0x7')](_0x80b4('0x8'),_0x11c7d8['map'](function(_0x499bad){return{'id':_0x499bad['id']};}));return FaxMessage[_0x80b4('0x9')]({'where':{'FaxInteractionId':_0x21631a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x47df4d){_0x21631a[_0x80b4('0x7')](_0x80b4('0xa'),_0x47df4d[_0x80b4('0xb')]);FaxInteractionEvents[_0x80b4('0xc')](_0x2c6fd2+':'+_0x21631a['id'],_0x21631a);FaxInteractionEvents[_0x80b4('0xc')](_0x2c6fd2,_0x21631a);_0xe07853(null);})[_0x80b4('0xd')](_0xe07853(null));};}for(var e in events){if(events[_0x80b4('0xe')](e)){var event=events[e];FaxInteraction[_0x80b4('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 a290f00..674f795 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 _0x419f=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x39e4ea,_0x1dcd57){var _0x2cf329=function(_0x7d9620){while(--_0x7d9620){_0x39e4ea['push'](_0x39e4ea['shift']());}};_0x2cf329(++_0x1dcd57);}(_0x419f,0x176));var _0xf419=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x419f[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xf419('0x0'));var util=require(_0xf419('0x1'));var logger=require(_0xf419('0x2'))(_0xf419('0x3'));var moment=require(_0xf419('0x4'));var BPromise=require(_0xf419('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf419('0x6'));var rimraf=require('rimraf');var config=require(_0xf419('0x7'));var attributes=require(_0xf419('0x8'));module[_0xf419('0x9')]=function(_0x38f2fa,_0x2d8430){return _0x38f2fa[_0xf419('0xa')](_0xf419('0xb'),attributes,{'tableName':_0xf419('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f0c3e,_0x4bb5fd,_0x33fbb2){if(_0x3f0c3e[_0xf419('0xd')]('closed')){_0x3f0c3e[_0xf419('0xe')]=moment()[_0xf419('0xf')](_0xf419('0x10'));}_0x33fbb2(null,_0x3f0c3e);}}});}; \ No newline at end of file +var _0x2dca=['request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed','closedAt','format','lodash','util','../../config/logger','moment','bluebird'];(function(_0x28bf40,_0x2ad609){var _0x14fa22=function(_0x58a736){while(--_0x58a736){_0x28bf40['push'](_0x28bf40['shift']());}};_0x14fa22(++_0x2ad609);}(_0x2dca,0xdb));var _0xa2dc=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x2dca[_0x2fd69d];return _0x5d5ef3;};'use strict';var _=require(_0xa2dc('0x0'));var util=require(_0xa2dc('0x1'));var logger=require(_0xa2dc('0x2'))('api');var moment=require(_0xa2dc('0x3'));var BPromise=require(_0xa2dc('0x4'));var rp=require(_0xa2dc('0x5'));var fs=require('fs');var path=require(_0xa2dc('0x6'));var rimraf=require('rimraf');var config=require(_0xa2dc('0x7'));var attributes=require(_0xa2dc('0x8'));module[_0xa2dc('0x9')]=function(_0x50c3b5,_0x37ba2a){return _0x50c3b5[_0xa2dc('0xa')](_0xa2dc('0xb'),attributes,{'tableName':_0xa2dc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xaeb26d,_0x57863d,_0x541064){if(_0xaeb26d['changed'](_0xa2dc('0xd'))){_0xaeb26d[_0xa2dc('0xe')]=moment()[_0xa2dc('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x541064(null,_0xaeb26d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 85ee9a5..995f6ca 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 _0x0713=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','./faxInteraction.socket','request','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','options','raw','where','limit','then','body','ids','omit','AddTags','catch','lodash'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0x0713,0xe6));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3071('0x0'));var util=require('util');var moment=require(_0x3071('0x1'));var BPromise=require(_0x3071('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require(_0x3071('0x5'));var logger=require('../../config/logger')(_0x3071('0x6'));var config=require('../../config/environment');var jayson=require(_0x3071('0x7'));var client=jayson[_0x3071('0x8')]['http']({'port':0x232a});config[_0x3071('0x9')]=_['defaults'](config[_0x3071('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3071('0x9')]));require(_0x3071('0xa'))['register'](socket);function respondWithRpcPromise(_0x433cf5,_0x2e66d0,_0x2e6335){return new BPromise(function(_0x51605b,_0x23d055){return client[_0x3071('0xb')](_0x433cf5,_0x2e6335)['then'](function(_0x71cfc4){logger[_0x3071('0xc')](_0x3071('0xd'),_0x2e66d0,'request\x20sent');logger[_0x3071('0xe')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2e66d0,_0x3071('0xf'),JSON[_0x3071('0x10')](_0x71cfc4));if(_0x71cfc4['error']){if(_0x71cfc4[_0x3071('0x11')][_0x3071('0x12')]===0x1f4){logger[_0x3071('0x11')](_0x3071('0xd'),_0x2e66d0,_0x71cfc4[_0x3071('0x11')]['message']);return _0x23d055(_0x71cfc4[_0x3071('0x11')][_0x3071('0x13')]);}logger['error'](_0x3071('0xd'),_0x2e66d0,_0x71cfc4['error'][_0x3071('0x13')]);return _0x51605b(_0x71cfc4[_0x3071('0x11')][_0x3071('0x13')]);}else{logger['info'](_0x3071('0xd'),_0x2e66d0,_0x3071('0xf'));_0x51605b(_0x71cfc4[_0x3071('0x14')][_0x3071('0x13')]);}})['catch'](function(_0x16d4f8){logger[_0x3071('0x11')](_0x3071('0xd'),_0x2e66d0,_0x16d4f8);_0x23d055(_0x16d4f8);});});}exports[_0x3071('0x15')]=function(_0x517c6b){var _0x2a8252=this;return new Promise(function(_0x53cfd5,_0x2a07c4){return db[_0x3071('0x16')]['update'](_0x517c6b['body'],{'raw':_0x517c6b[_0x3071('0x17')]?_0x517c6b[_0x3071('0x17')][_0x3071('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x517c6b[_0x3071('0x17')]?_0x517c6b[_0x3071('0x17')][_0x3071('0x19')]||null:null,'attributes':_0x517c6b[_0x3071('0x17')]?_0x517c6b[_0x3071('0x17')]['attributes']||null:null,'limit':_0x517c6b['options']?_0x517c6b[_0x3071('0x17')][_0x3071('0x1a')]||null:null})[_0x3071('0x1b')](function(_0x3ed2c8){logger['info'](_0x3071('0x15'),_0x517c6b);logger[_0x3071('0xe')](_0x3071('0x15'),_0x517c6b,JSON[_0x3071('0x10')](_0x3ed2c8));_0x53cfd5(_0x3ed2c8);})['catch'](function(_0x15c159){logger[_0x3071('0x11')](_0x3071('0x15'),_0x15c159['message'],_0x517c6b);_0x2a07c4(_0x2a8252[_0x3071('0x11')](0x1f4,_0x15c159['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x5a2f5b){return new Promise(function(_0x19e10a,_0x22a22c){return db[_0x3071('0x16')]['find']({'where':_0x5a2f5b[_0x3071('0x17')]?_0x5a2f5b[_0x3071('0x17')][_0x3071('0x19')]||null:null})[_0x3071('0x1b')](function(_0x4dc0d3){if(_0x4dc0d3){return _0x4dc0d3['addTags'](_0x5a2f5b[_0x3071('0x1c')][_0x3071('0x1d')],_[_0x3071('0x1e')](_0x5a2f5b[_0x3071('0x1c')],[_0x3071('0x1d'),'id'])||{});}})['spread'](function(_0x732034){logger['info']('AddTags',_0x5a2f5b);logger['debug'](_0x3071('0x1f'),_0x5a2f5b,JSON[_0x3071('0x10')](_0x732034));_0x19e10a(_0x732034);})[_0x3071('0x20')](function(_0x44bca9){logger[_0x3071('0x11')](_0x3071('0x1f'),_0x44bca9[_0x3071('0x13')],_0x5a2f5b);_0x22a22c(_this[_0x3071('0x11')](0x1f4,_0x44bca9['message']));});});}; \ No newline at end of file +var _0x7572=['defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxInteraction','update','options','raw','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','where','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3e6401,_0x12ef0e){var _0x3b1f5a=function(_0x543cd7){while(--_0x543cd7){_0x3e6401['push'](_0x3e6401['shift']());}};_0x3b1f5a(++_0x12ef0e);}(_0x7572,0xd0));var _0x2757=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x7572[_0xca1f0e];return _0x35e4ef;};'use strict';var _=require(_0x2757('0x0'));var util=require(_0x2757('0x1'));var moment=require('moment');var BPromise=require(_0x2757('0x2'));var rs=require(_0x2757('0x3'));var fs=require('fs');var Redis=require(_0x2757('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2757('0x5'))(_0x2757('0x6'));var config=require(_0x2757('0x7'));var jayson=require(_0x2757('0x8'));var client=jayson[_0x2757('0x9')][_0x2757('0xa')]({'port':0x232a});config[_0x2757('0xb')]=_[_0x2757('0xc')](config[_0x2757('0xb')],{'host':_0x2757('0xd'),'port':0x18eb});var socket=require(_0x2757('0xe'))(new Redis(config[_0x2757('0xb')]));require(_0x2757('0xf'))[_0x2757('0x10')](socket);function respondWithRpcPromise(_0x2ad47e,_0x3ce094,_0x4c987e){return new BPromise(function(_0x5be1ae,_0x52532a){return client['request'](_0x2ad47e,_0x4c987e)[_0x2757('0x11')](function(_0x2c302d){logger[_0x2757('0x12')](_0x2757('0x13'),_0x3ce094,_0x2757('0x14'));logger[_0x2757('0x15')](_0x2757('0x16'),_0x3ce094,_0x2757('0x14'),JSON[_0x2757('0x17')](_0x2c302d));if(_0x2c302d['error']){if(_0x2c302d[_0x2757('0x18')][_0x2757('0x19')]===0x1f4){logger[_0x2757('0x18')](_0x2757('0x13'),_0x3ce094,_0x2c302d[_0x2757('0x18')][_0x2757('0x1a')]);return _0x52532a(_0x2c302d[_0x2757('0x18')][_0x2757('0x1a')]);}logger[_0x2757('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x3ce094,_0x2c302d[_0x2757('0x18')][_0x2757('0x1a')]);return _0x5be1ae(_0x2c302d['error'][_0x2757('0x1a')]);}else{logger[_0x2757('0x12')](_0x2757('0x13'),_0x3ce094,_0x2757('0x14'));_0x5be1ae(_0x2c302d[_0x2757('0x1b')][_0x2757('0x1a')]);}})[_0x2757('0x1c')](function(_0x56e489){logger['error'](_0x2757('0x13'),_0x3ce094,_0x56e489);_0x52532a(_0x56e489);});});}exports['UpdateFaxInteraction']=function(_0x398465){var _0x580b9b=this;return new Promise(function(_0x4698ee,_0x5be3ea){return db[_0x2757('0x1d')][_0x2757('0x1e')](_0x398465['body'],{'raw':_0x398465[_0x2757('0x1f')]?_0x398465[_0x2757('0x1f')][_0x2757('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x398465['options']?_0x398465['options']['where']||null:null,'attributes':_0x398465[_0x2757('0x1f')]?_0x398465[_0x2757('0x1f')][_0x2757('0x21')]||null:null,'limit':_0x398465[_0x2757('0x1f')]?_0x398465[_0x2757('0x1f')][_0x2757('0x22')]||null:null})[_0x2757('0x11')](function(_0x3d11f1){logger[_0x2757('0x12')](_0x2757('0x23'),_0x398465);logger[_0x2757('0x15')](_0x2757('0x23'),_0x398465,JSON[_0x2757('0x17')](_0x3d11f1));_0x4698ee(_0x3d11f1);})[_0x2757('0x1c')](function(_0xe1ac6a){logger['error'](_0x2757('0x23'),_0xe1ac6a['message'],_0x398465);_0x5be3ea(_0x580b9b[_0x2757('0x18')](0x1f4,_0xe1ac6a['message']));});});};exports[_0x2757('0x24')]=function(_0xa52088){return new Promise(function(_0x411f5f,_0x5b3fbc){return db[_0x2757('0x1d')]['find']({'where':_0xa52088[_0x2757('0x1f')]?_0xa52088[_0x2757('0x1f')][_0x2757('0x25')]||null:null})[_0x2757('0x11')](function(_0x299953){if(_0x299953){return _0x299953[_0x2757('0x26')](_0xa52088[_0x2757('0x27')][_0x2757('0x28')],_[_0x2757('0x29')](_0xa52088[_0x2757('0x27')],[_0x2757('0x28'),'id'])||{});}})[_0x2757('0x2a')](function(_0xc2fdde){logger[_0x2757('0x12')](_0x2757('0x2b'),_0xa52088);logger['debug'](_0x2757('0x2b'),_0xa52088,JSON[_0x2757('0x17')](_0xc2fdde));_0x411f5f(_0xc2fdde);})[_0x2757('0x1c')](function(_0x38727b){logger[_0x2757('0x18')](_0x2757('0x2b'),_0x38727b['message'],_0xa52088);_0x5b3fbc(_this[_0x2757('0x18')](0x1f4,_0x38727b[_0x2757('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c16fee2..f06d70f 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 _0xfcc6=['./faxInteraction.events','save','update','register','length'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfcc6,0x1bd));var _0x6fcc=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0xfcc6[_0x53f0db];return _0xae0a5c;};'use strict';var FaxInteractionEvents=require(_0x6fcc('0x0'));var events=[_0x6fcc('0x1'),'remove',_0x6fcc('0x2')];function createListener(_0x397147,_0x2ed6cb){return function(_0x9597fc){_0x2ed6cb['emit'](_0x397147,_0x9597fc);};}function removeListener(_0xdcef78,_0x562410){return function(){FaxInteractionEvents['removeListener'](_0xdcef78,_0x562410);};}exports[_0x6fcc('0x3')]=function(_0x5d02ab){for(var _0x2b69c7=0x0,_0x4bff93=events[_0x6fcc('0x4')];_0x2b69c7<_0x4bff93;_0x2b69c7++){var _0x3cd856=events[_0x2b69c7];var _0x42036b=createListener('faxInteraction:'+_0x3cd856,_0x5d02ab);FaxInteractionEvents['on'](_0x3cd856,_0x42036b);}}; \ No newline at end of file +var _0x0e31=['removeListener','register','length','./faxInteraction.events','save'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0x0e31,0xda));var _0x10e3=function(_0x4147b1,_0x34bf45){_0x4147b1=_0x4147b1-0x0;var _0x5b1d00=_0x0e31[_0x4147b1];return _0x5b1d00;};'use strict';var FaxInteractionEvents=require(_0x10e3('0x0'));var events=[_0x10e3('0x1'),'remove','update'];function createListener(_0x253215,_0x409797){return function(_0x110015){_0x409797['emit'](_0x253215,_0x110015);};}function removeListener(_0x21b08b,_0x17f1a0){return function(){FaxInteractionEvents[_0x10e3('0x2')](_0x21b08b,_0x17f1a0);};}exports[_0x10e3('0x3')]=function(_0x42ef83){for(var _0x4dd78a=0x0,_0x2ad5ee=events[_0x10e3('0x4')];_0x4dd78a<_0x2ad5ee;_0x4dd78a++){var _0x5ba411=events[_0x4dd78a];var _0x140a04=createListener('faxInteraction:'+_0x5ba411,_0x42ef83);FaxInteractionEvents['on'](_0x5ba411,_0x140a04);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9098c5a..3eafc3e 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 _0xe318=['faxinteraction:destroy','destroy','delete','removeTags','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update'];(function(_0x38ac7b,_0x2dc75f){var _0x2c3cd5=function(_0x10ddc9){while(--_0x10ddc9){_0x38ac7b['push'](_0x38ac7b['shift']());}};_0x2c3cd5(++_0x2dc75f);}(_0xe318,0xdd));var _0x8e31=function(_0x33788f,_0x589b57){_0x33788f=_0x33788f-0x0;var _0x77e425=_0xe318[_0x33788f];return _0x77e425;};'use strict';var multer=require(_0x8e31('0x0'));var util=require(_0x8e31('0x1'));var path=require('path');var timeout=require(_0x8e31('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8e31('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8e31('0x4'));var config=require(_0x8e31('0x5'));var controller=require('./faxInteraction.controller');router[_0x8e31('0x6')]('/',auth[_0x8e31('0x7')](),controller[_0x8e31('0x8')]);router[_0x8e31('0x6')](_0x8e31('0x9'),auth[_0x8e31('0x7')](),controller[_0x8e31('0xa')]);router[_0x8e31('0x6')](_0x8e31('0xb'),auth[_0x8e31('0x7')](),controller[_0x8e31('0xc')]);router['get'](_0x8e31('0xd'),auth[_0x8e31('0x7')](),controller[_0x8e31('0xe')]);router['get'](_0x8e31('0xf'),auth[_0x8e31('0x7')](),controller[_0x8e31('0x10')]);router['post']('/',auth[_0x8e31('0x7')](),controller['create']);router[_0x8e31('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0x8e31('0x12')]);router[_0x8e31('0x11')](_0x8e31('0x13'),auth[_0x8e31('0x7')](),interaction[_0x8e31('0x14')](_0x8e31('0x15'),_0x8e31('0x16')),controller[_0x8e31('0x17')]);router[_0x8e31('0x18')](_0x8e31('0xb'),auth[_0x8e31('0x7')](),interaction[_0x8e31('0x14')](_0x8e31('0x15'),_0x8e31('0x19')),controller[_0x8e31('0x1a')]);router['delete'](_0x8e31('0xb'),auth[_0x8e31('0x7')](),interaction['tracked']('fax',_0x8e31('0x1b')),controller[_0x8e31('0x1c')]);router[_0x8e31('0x1d')]('/:id/tags',auth[_0x8e31('0x7')](),controller[_0x8e31('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xd235=['tracked','faxinteraction:addtags','addTags','put','/:id','update','delete','fax','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xd235,0x114));var _0x5d23=function(_0x5d5fb1,_0x301366){_0x5d5fb1=_0x5d5fb1-0x0;var _0x38a2db=_0xd235[_0x5d5fb1];return _0x38a2db;};'use strict';var multer=require(_0x5d23('0x0'));var util=require(_0x5d23('0x1'));var path=require('path');var timeout=require(_0x5d23('0x2'));var express=require(_0x5d23('0x3'));var router=express['Router']();var fs_extra=require(_0x5d23('0x4'));var auth=require(_0x5d23('0x5'));var interaction=require(_0x5d23('0x6'));var config=require(_0x5d23('0x7'));var controller=require(_0x5d23('0x8'));router[_0x5d23('0x9')]('/',auth[_0x5d23('0xa')](),controller[_0x5d23('0xb')]);router[_0x5d23('0x9')](_0x5d23('0xc'),auth[_0x5d23('0xa')](),controller[_0x5d23('0xd')]);router[_0x5d23('0x9')]('/:id',auth[_0x5d23('0xa')](),controller[_0x5d23('0xe')]);router['get'](_0x5d23('0xf'),auth[_0x5d23('0xa')](),controller[_0x5d23('0x10')]);router[_0x5d23('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x5d23('0x11')]('/',auth[_0x5d23('0xa')](),controller[_0x5d23('0x12')]);router[_0x5d23('0x11')](_0x5d23('0xf'),auth[_0x5d23('0xa')](),controller[_0x5d23('0x13')]);router[_0x5d23('0x11')](_0x5d23('0x14'),auth[_0x5d23('0xa')](),interaction[_0x5d23('0x15')]('fax',_0x5d23('0x16')),controller[_0x5d23('0x17')]);router[_0x5d23('0x18')](_0x5d23('0x19'),auth[_0x5d23('0xa')](),interaction[_0x5d23('0x15')]('fax','faxinteraction:update'),controller[_0x5d23('0x1a')]);router[_0x5d23('0x1b')](_0x5d23('0x19'),auth['isAuthenticated'](),interaction[_0x5d23('0x15')](_0x5d23('0x1c'),_0x5d23('0x1d')),controller[_0x5d23('0x1e')]);router[_0x5d23('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x5d23('0x1f')]);module[_0x5d23('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index bfe9118..6261d65 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 _0x255f=['TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x4c7423,_0x117200){var _0x5f0094=function(_0x2f0448){while(--_0x2f0448){_0x4c7423['push'](_0x4c7423['shift']());}};_0x5f0094(++_0x117200);}(_0x255f,0x185));var _0xf255=function(_0x4a8935,_0x159d0f){_0x4a8935=_0x4a8935-0x0;var _0x3516fb=_0x255f[_0x4a8935];return _0x3516fb;};'use strict';var Sequelize=require(_0xf255('0x0'));module['exports']={'body':{'type':Sequelize[_0xf255('0x1')](_0xf255('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf255('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf255('0x4')),'defaultValue':_0xf255('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf255('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf255('0x5')]}}; \ No newline at end of file +var _0x7a72=['BOOLEAN','out','exports','TEXT'];(function(_0x3ba0cc,_0x46e9fc){var _0x22625e=function(_0x5e69cb){while(--_0x5e69cb){_0x3ba0cc['push'](_0x3ba0cc['shift']());}};_0x22625e(++_0x46e9fc);}(_0x7a72,0x1be));var _0x27a7=function(_0x1c776d,_0x23f9f9){_0x1c776d=_0x1c776d-0x0;var _0x4998de=_0x7a72[_0x1c776d];return _0x4998de;};'use strict';var Sequelize=require('sequelize');module[_0x27a7('0x0')]={'body':{'type':Sequelize[_0x27a7('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x27a7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x27a7('0x3')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x27a7('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 01e13ca..23f5f2a 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 _0x5cee=['hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','update','body','find','params','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','FaxInteraction','FaxInteractionId','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','RejectMessage','rejectMessage','SELECT','SIP/%s','reject','rejectmessage','create','CmContact','findOne','isNil','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','files','attachments','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','register','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','then','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length'];(function(_0x5b2d3b,_0x1040cb){var _0x1cf324=function(_0x232689){while(--_0x232689){_0x5b2d3b['push'](_0x5b2d3b['shift']());}};_0x1cf324(++_0x1040cb);}(_0x5cee,0xdc));var _0xe5ce=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x5cee[_0x616290];return _0x453879;};'use strict';var emlformat=require(_0xe5ce('0x0'));var rimraf=require(_0xe5ce('0x1'));var zipdir=require(_0xe5ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe5ce('0x3'));var BPromise=require(_0xe5ce('0x4'));var Mustache=require(_0xe5ce('0x5'));var util=require(_0xe5ce('0x6'));var path=require(_0xe5ce('0x7'));var sox=require(_0xe5ce('0x8'));var csv=require(_0xe5ce('0x9'));var ejs=require(_0xe5ce('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5ce('0xb'));var squel=require(_0xe5ce('0xc'));var crypto=require(_0xe5ce('0xd'));var jsforce=require(_0xe5ce('0xe'));var deskjs=require(_0xe5ce('0xf'));var toCsv=require(_0xe5ce('0x9'));var querystring=require(_0xe5ce('0x10'));var Papa=require(_0xe5ce('0x11'));var Redis=require(_0xe5ce('0x12'));var authService=require(_0xe5ce('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe5ce('0x14'));var hardwareService=require(_0xe5ce('0x15'));var logger=require(_0xe5ce('0x16'))(_0xe5ce('0x17'));var utils=require(_0xe5ce('0x18'));var config=require(_0xe5ce('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe5ce('0x1a'))['db'];config['redis']=_[_0xe5ce('0x1b')](config['redis'],{'host':_0xe5ce('0x1c'),'port':0x18eb});var socket=require(_0xe5ce('0x1d'))(new Redis(config[_0xe5ce('0x1e')]));require(_0xe5ce('0x1f'))[_0xe5ce('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe5ce('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xe5ce('0x21')][_0xe5ce('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x32c2b9,_0x170753,_0x331e2f,_0x112560){return new BPromise(function(_0x415655,_0x5d9038){var _0x5d114d=_0x112560||client;return _0x5d114d[_0xe5ce('0x23')](_0x32c2b9,_0x331e2f)['then'](function(_0x3edeae){logger[_0xe5ce('0x24')](_0xe5ce('0x25'),_0x170753,_0xe5ce('0x26'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x170753,'request\x20sent',JSON[_0xe5ce('0x27')](_0x3edeae));if(_0x3edeae[_0xe5ce('0x28')]){if(_0x3edeae[_0xe5ce('0x28')]['code']===0x1f4){logger[_0xe5ce('0x28')](_0xe5ce('0x25'),_0x170753,_0x3edeae[_0xe5ce('0x28')][_0xe5ce('0x29')]);return _0x5d9038(_0x3edeae[_0xe5ce('0x28')][_0xe5ce('0x29')]);}logger['error'](_0xe5ce('0x25'),_0x170753,_0x3edeae[_0xe5ce('0x28')]['message']);return _0x415655(_0x3edeae['error']['message']);}else{logger[_0xe5ce('0x24')](_0xe5ce('0x25'),_0x170753,'request\x20sent');_0x415655(_0x3edeae['result'][_0xe5ce('0x29')]);}})[_0xe5ce('0x2a')](function(_0x5cf5a4){logger['error'](_0xe5ce('0x25'),_0x170753,_0x5cf5a4);_0x5d9038(_0x5cf5a4);});});}function respondWithStatusCode(_0x2b8f3c,_0x1ff0a5){_0x1ff0a5=_0x1ff0a5||0xcc;return function(_0x387b9d){if(_0x387b9d){return _0x2b8f3c[_0xe5ce('0x2b')](_0x1ff0a5);}return _0x2b8f3c[_0xe5ce('0x2c')](_0x1ff0a5)[_0xe5ce('0x2d')]();};}function respondWithResult(_0x47601b,_0x49f013){_0x49f013=_0x49f013||0xc8;return function(_0x342ce0){if(_0x342ce0){return _0x47601b[_0xe5ce('0x2c')](_0x49f013)[_0xe5ce('0x2e')](_0x342ce0);}};}function respondWithFilteredResult(_0x28b83f,_0x58b093){return function(_0x129396){if(_0x129396){var _0x53b599=typeof _0x58b093['offset']==='undefined'&&typeof _0x58b093[_0xe5ce('0x2f')]===_0xe5ce('0x30');var _0x2371e6=_0x129396[_0xe5ce('0x31')];var _0x5c3412=_0x53b599?0x0:_0x58b093['offset'];var _0x14b22c=_0x53b599?_0x129396[_0xe5ce('0x31')]:_0x58b093[_0xe5ce('0x32')]+_0x58b093[_0xe5ce('0x2f')];var _0x503c5a;if(_0x14b22c>=_0x2371e6){_0x14b22c=_0x2371e6;_0x503c5a=0xc8;}else{_0x503c5a=0xce;}_0x28b83f[_0xe5ce('0x2c')](_0x503c5a);return _0x28b83f[_0xe5ce('0x33')]('Content-Range',_0x5c3412+'-'+_0x14b22c+'/'+_0x2371e6)[_0xe5ce('0x2e')](_0x129396);}return null;};}function patchUpdates(_0x34c3f4){return function(_0xe0a7de){try{jsonpatch[_0xe5ce('0x34')](_0xe0a7de,_0x34c3f4,!![]);}catch(_0x2e8d71){return BPromise['reject'](_0x2e8d71);}return _0xe0a7de[_0xe5ce('0x35')]();};}function saveUpdates(_0x21dc18,_0x2df0d0){return function(_0x25e6f7){if(_0x25e6f7){return _0x25e6f7['update'](_0x21dc18)[_0xe5ce('0x36')](function(_0x44859e){return _0x44859e;});}return null;};}function removeEntity(_0x2b9180,_0x8f693c){return function(_0x12c220){if(_0x12c220){return _0x12c220['destroy']()[_0xe5ce('0x36')](function(){_0x2b9180[_0xe5ce('0x2c')](0xcc)[_0xe5ce('0x2d')]();});}};}function handleEntityNotFound(_0x109bba,_0x52bf8c){return function(_0x3e85b3){if(!_0x3e85b3){_0x109bba[_0xe5ce('0x2b')](0x194);}return _0x3e85b3;};}function handleError(_0x4efe47,_0x430726){_0x430726=_0x430726||0x1f4;return function(_0x587971){logger[_0xe5ce('0x28')](_0x587971[_0xe5ce('0x37')]);if(_0x587971[_0xe5ce('0x38')]){delete _0x587971[_0xe5ce('0x38')];}_0x4efe47['status'](_0x430726)[_0xe5ce('0x39')](_0x587971);};}exports[_0xe5ce('0x3a')]=function(_0x2c1a1e,_0x2e69b0){var _0x5ebb95={},_0x52e4e7={},_0x2ff9a0={'count':0x0,'rows':[]};var _0x18cdc4=_[_0xe5ce('0x3b')](db[_0xe5ce('0x3c')][_0xe5ce('0x3d')],function(_0x4863c1){return{'name':_0x4863c1[_0xe5ce('0x3e')],'type':_0x4863c1[_0xe5ce('0x3f')][_0xe5ce('0x40')]};});_0x52e4e7[_0xe5ce('0x41')]=_[_0xe5ce('0x3b')](_0x18cdc4,_0xe5ce('0x38'));_0x52e4e7[_0xe5ce('0x42')]=_[_0xe5ce('0x43')](_0x2c1a1e[_0xe5ce('0x42')]);_0x52e4e7['filters']=_[_0xe5ce('0x44')](_0x52e4e7[_0xe5ce('0x41')],_0x52e4e7['query']);_0x5ebb95['attributes']=_[_0xe5ce('0x44')](_0x52e4e7['model'],qs[_0xe5ce('0x45')](_0x2c1a1e[_0xe5ce('0x42')]['fields']));_0x5ebb95[_0xe5ce('0x46')]=_0x5ebb95[_0xe5ce('0x46')][_0xe5ce('0x47')]?_0x5ebb95['attributes']:_0x52e4e7[_0xe5ce('0x41')];if(!_0x2c1a1e['query'][_0xe5ce('0x48')]('nolimit')){_0x5ebb95[_0xe5ce('0x2f')]=qs[_0xe5ce('0x2f')](_0x2c1a1e[_0xe5ce('0x42')]['limit']);_0x5ebb95[_0xe5ce('0x32')]=qs[_0xe5ce('0x32')](_0x2c1a1e[_0xe5ce('0x42')]['offset']);}_0x5ebb95[_0xe5ce('0x49')]=qs['sort'](_0x2c1a1e[_0xe5ce('0x42')][_0xe5ce('0x4a')]);_0x5ebb95[_0xe5ce('0x4b')]=qs[_0xe5ce('0x4c')](_[_0xe5ce('0x4d')](_0x2c1a1e[_0xe5ce('0x42')],_0x52e4e7[_0xe5ce('0x4c')]),_0x18cdc4);if(_0x2c1a1e['query'][_0xe5ce('0x4e')]){_0x5ebb95[_0xe5ce('0x4b')]=_[_0xe5ce('0x4f')](_0x5ebb95['where'],{'$or':_[_0xe5ce('0x3b')](_0x18cdc4,function(_0x2cf2af){if(_0x2cf2af[_0xe5ce('0x3f')]!==_0xe5ce('0x50')){var _0xcad177={};_0xcad177[_0x2cf2af[_0xe5ce('0x38')]]={'$like':'%'+_0x2c1a1e['query'][_0xe5ce('0x4e')]+'%'};return _0xcad177;}})});}_0x5ebb95=_[_0xe5ce('0x4f')]({},_0x5ebb95,_0x2c1a1e[_0xe5ce('0x51')]);var _0x4c141c={'where':_0x5ebb95['where']};return db['FaxMessage']['count'](_0x4c141c)[_0xe5ce('0x36')](function(_0x20a9a9){_0x2ff9a0[_0xe5ce('0x31')]=_0x20a9a9;if(_0x2c1a1e['query'][_0xe5ce('0x52')]){_0x5ebb95[_0xe5ce('0x53')]=[{'all':!![]}];}return db[_0xe5ce('0x3c')][_0xe5ce('0x54')](_0x5ebb95);})[_0xe5ce('0x36')](function(_0x30df7e){_0x2ff9a0['rows']=_0x30df7e;return _0x2ff9a0;})[_0xe5ce('0x36')](respondWithFilteredResult(_0x2e69b0,_0x5ebb95))[_0xe5ce('0x2a')](handleError(_0x2e69b0,null));};exports[_0xe5ce('0x55')]=function(_0x4b45ca,_0x1b23c8){var _0x41ef03={'raw':!![],'where':{'id':_0x4b45ca['params']['id']}},_0x5e8206={};_0x5e8206[_0xe5ce('0x41')]=_[_0xe5ce('0x43')](db['FaxMessage']['rawAttributes']);_0x5e8206[_0xe5ce('0x42')]=_[_0xe5ce('0x43')](_0x4b45ca[_0xe5ce('0x42')]);_0x5e8206[_0xe5ce('0x4c')]=_[_0xe5ce('0x44')](_0x5e8206[_0xe5ce('0x41')],_0x5e8206['query']);_0x41ef03[_0xe5ce('0x46')]=_[_0xe5ce('0x44')](_0x5e8206['model'],qs[_0xe5ce('0x45')](_0x4b45ca[_0xe5ce('0x42')][_0xe5ce('0x45')]));_0x41ef03[_0xe5ce('0x46')]=_0x41ef03['attributes']['length']?_0x41ef03['attributes']:_0x5e8206[_0xe5ce('0x41')];if(_0x4b45ca['query']['includeAll']){_0x41ef03[_0xe5ce('0x53')]=[{'all':!![]}];}_0x41ef03=_[_0xe5ce('0x4f')]({},_0x41ef03,_0x4b45ca[_0xe5ce('0x51')]);return db[_0xe5ce('0x3c')]['find'](_0x41ef03)[_0xe5ce('0x36')](handleEntityNotFound(_0x1b23c8,null))[_0xe5ce('0x36')](respondWithResult(_0x1b23c8,null))[_0xe5ce('0x2a')](handleError(_0x1b23c8,null));};exports[_0xe5ce('0x56')]=function(_0x1f29d9,_0x53e62e){if(_0x1f29d9[_0xe5ce('0x57')]['id']){delete _0x1f29d9[_0xe5ce('0x57')]['id'];}return db[_0xe5ce('0x3c')][_0xe5ce('0x58')]({'where':{'id':_0x1f29d9[_0xe5ce('0x59')]['id']}})[_0xe5ce('0x36')](handleEntityNotFound(_0x53e62e,null))[_0xe5ce('0x36')](saveUpdates(_0x1f29d9['body'],null))[_0xe5ce('0x36')](respondWithResult(_0x53e62e,null))[_0xe5ce('0x2a')](handleError(_0x53e62e,null));};exports['destroy']=function(_0x58a846,_0x513099){return db['FaxMessage'][_0xe5ce('0x58')]({'where':{'id':_0x58a846['params']['id']}})['then'](handleEntityNotFound(_0x513099,null))['then'](removeEntity(_0x513099,null))[_0xe5ce('0x2a')](handleError(_0x513099,null));};exports[_0xe5ce('0x5a')]=function(_0x4b2975,_0x1817cc){return db[_0xe5ce('0x3c')][_0xe5ce('0x5a')]()[_0xe5ce('0x36')](respondWithResult(_0x1817cc,null))[_0xe5ce('0x2a')](handleError(_0x1817cc,null));};var interaction_log=require(_0xe5ce('0x16'))(_0xe5ce('0x5b'));exports[_0xe5ce('0x5c')]=function(_0x350c65,_0x52f85e,_0x32863b){var _0x144def={'agent':{},'channel':_0xe5ce('0x5d')};if(_0x350c65['body']['id']){delete _0x350c65[_0xe5ce('0x57')]['id'];}_0x350c65[_0xe5ce('0x57')][_0xe5ce('0x5e')]=!![];_0x350c65['body'][_0xe5ce('0x5f')]=moment()[_0xe5ce('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x350c65[_0xe5ce('0x57')][_0xe5ce('0x61')]=_0x350c65[_0xe5ce('0x57')]['UserId']||_0x350c65[_0xe5ce('0x62')]['id'];_0x144def[_0xe5ce('0x63')]['id']=_0x350c65[_0xe5ce('0x57')][_0xe5ce('0x61')];return db['FaxMessage']['find']({'where':{'id':_0x350c65[_0xe5ce('0x59')]['id'],'UserId':null}})[_0xe5ce('0x36')](handleEntityNotFound(_0x52f85e,null))[_0xe5ce('0x36')](saveUpdates(_0x350c65[_0xe5ce('0x57')],null))[_0xe5ce('0x36')](function(_0x48dc45){if(_0x48dc45){_0x144def['message']=_0x48dc45['get']({'plain':!![]});return db[_0xe5ce('0x64')]['find']({'where':{'id':_0x48dc45[_0xe5ce('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x52f85e,null))[_0xe5ce('0x36')](function(_0x1e1579){if(_0x1e1579){return _0x1e1579['update']({'UserId':_0x350c65[_0xe5ce('0x57')][_0xe5ce('0x61')],'read1stAt':_['isNil'](_0x1e1579['read1stAt'])?moment()['format'](_0xe5ce('0x66')):undefined});}return null;})['then'](function(_0x36db30){if(_0x36db30){_0x144def[_0xe5ce('0x67')]=_0x36db30[_0xe5ce('0x68')]({'plain':!![]});interaction_log['info'](_0xe5ce('0x69'),_0x350c65['user']['id'],_0x350c65['user'][_0xe5ce('0x38')],_0x350c65[_0xe5ce('0x62')][_0xe5ce('0x6a')],_0x144def[_0xe5ce('0x67')]['id'],_0x350c65[_0xe5ce('0x57')]?JSON[_0xe5ce('0x27')](_0x350c65['body']):_0xe5ce('0x6b'));return respondWithRpcPromise(_0xe5ce('0x6c'),_0xe5ce('0x6d'),_0x144def);}return null;})['then'](function(_0x1e742e){var _0x1b1b8e=_0xe5ce('0x6e')+_0x1e742e[_0xe5ce('0x29')][_0xe5ce('0x6f')];return db[_0xe5ce('0x70')][_0xe5ce('0x42')](_0x1b1b8e,{'type':db[_0xe5ce('0x71')][_0xe5ce('0x72')]['SELECT'],'raw':!![]})[_0xe5ce('0x36')](function(_0x2d7ce8){return _0x2d7ce8;});})[_0xe5ce('0x36')](function(_0x47a058){if(_0x47a058){_0x144def[_0xe5ce('0x29')][_0xe5ce('0x73')]=_0x47a058[0x0];if(!_0x350c65[_0xe5ce('0x57')]['UserId'])return;return db[_0xe5ce('0x74')][_0xe5ce('0x58')]({'where':{'id':_0x350c65[_0xe5ce('0x57')][_0xe5ce('0x61')],'role':'agent'},'attributes':['id',_0xe5ce('0x38'),_0xe5ce('0x75'),_0xe5ce('0x76'),_0xe5ce('0x77')],'raw':!![]});}return null;})[_0xe5ce('0x36')](function(_0xe74c8a){if(!_0xe74c8a)return null;_0x144def['message']['agent']=_0xe74c8a;return _0x144def;})[_0xe5ce('0x36')](function(_0x3548a1){if(_0x3548a1){if(_0x350c65[_0xe5ce('0x57')][_0xe5ce('0x78')]){_0x144def[_0xe5ce('0x29')][_0xe5ce('0x79')]=util[_0xe5ce('0x60')]('SIP/%s',_0x350c65[_0xe5ce('0x62')]['name']);_0x144def[_0xe5ce('0x29')][_0xe5ce('0x7a')]=_0x144def[_0xe5ce('0x7a')];_0x144def[_0xe5ce('0x29')][_0xe5ce('0x7b')]=_0x144def[_0xe5ce('0x7a')];_0x144def[_0xe5ce('0x29')]['event']=_0xe5ce('0x5c');return respondWithRpcPromise(_0xe5ce('0x7c'),_0xe5ce('0x7c'),{'event':_0xe5ce('0x7d'),'message':_0x144def[_0xe5ce('0x29')]},client9002)[_0xe5ce('0x36')](function(){return _0x144def;});}return _0x144def;}return null;})[_0xe5ce('0x36')](respondWithResult(_0x52f85e,null))[_0xe5ce('0x2a')](handleError(_0x52f85e,null));};var interaction_log=require(_0xe5ce('0x16'))(_0xe5ce('0x5b'));exports['reject']=function(_0x281d94,_0x24280a,_0xbdb420){var _0x40da15={'agent':{},'channel':_0xe5ce('0x5d')};if(_0x281d94[_0xe5ce('0x57')]['id']){delete _0x281d94[_0xe5ce('0x57')]['id'];}_0x281d94['body'][_0xe5ce('0x61')]=_0x281d94[_0xe5ce('0x57')][_0xe5ce('0x61')]||_0x281d94[_0xe5ce('0x62')]['id'];_0x40da15[_0xe5ce('0x63')]['id']=_0x281d94[_0xe5ce('0x57')]['UserId'];return db['FaxMessage'][_0xe5ce('0x58')]({'where':{'id':_0x281d94[_0xe5ce('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x24280a,null))['then'](function(_0x49d89e){if(_0x49d89e){_0x40da15[_0xe5ce('0x29')]=_0x49d89e['get']({'plain':!![]});return db[_0xe5ce('0x64')][_0xe5ce('0x58')]({'where':{'id':_0x49d89e[_0xe5ce('0x65')]}});}return null;})[_0xe5ce('0x36')](handleEntityNotFound(_0x24280a,null))[_0xe5ce('0x36')](function(_0x3cb12f){if(_0x3cb12f){_0x40da15['interaction']=_0x3cb12f['get']({'plain':!![]});interaction_log[_0xe5ce('0x24')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x281d94['user']['id'],_0x281d94[_0xe5ce('0x62')][_0xe5ce('0x38')],_0x281d94['user'][_0xe5ce('0x6a')],_0x40da15[_0xe5ce('0x67')]['id'],_0x281d94['body']?JSON[_0xe5ce('0x27')](_0x281d94['body']):_0xe5ce('0x6b'));return respondWithRpcPromise(_0xe5ce('0x7e'),_0xe5ce('0x7f'),_0x40da15);}return null;})[_0xe5ce('0x36')](function(_0x53d4aa){var _0x481240='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x53d4aa[_0xe5ce('0x29')][_0xe5ce('0x6f')];return db[_0xe5ce('0x70')][_0xe5ce('0x42')](_0x481240,{'type':db[_0xe5ce('0x71')]['QueryTypes'][_0xe5ce('0x80')],'raw':!![]})[_0xe5ce('0x36')](function(_0x39c582){return _0x39c582;});})[_0xe5ce('0x36')](function(_0x4c540c){if(_0x4c540c){_0x40da15[_0xe5ce('0x29')][_0xe5ce('0x73')]=_0x4c540c[0x0];if(!_0x281d94['body'][_0xe5ce('0x61')])return;return db[_0xe5ce('0x74')]['find']({'where':{'id':_0x281d94[_0xe5ce('0x57')][_0xe5ce('0x61')],'role':_0xe5ce('0x63')},'attributes':['id',_0xe5ce('0x38'),_0xe5ce('0x75'),_0xe5ce('0x76'),_0xe5ce('0x77')],'raw':!![]});}return null;})[_0xe5ce('0x36')](function(_0x50b669){if(!_0x50b669)return null;_0x40da15[_0xe5ce('0x29')]['agent']=_0x50b669;return _0x40da15;})[_0xe5ce('0x36')](function(_0x2f9eaf){if(_0x2f9eaf){_0x2f9eaf[_0xe5ce('0x29')][_0xe5ce('0x79')]=util[_0xe5ce('0x60')](_0xe5ce('0x81'),_0x281d94[_0xe5ce('0x62')][_0xe5ce('0x38')]);_0x2f9eaf[_0xe5ce('0x29')][_0xe5ce('0x7a')]=_0x40da15['channel'];_0x2f9eaf[_0xe5ce('0x29')]['motionChannel']=_0x40da15['channel'];_0x2f9eaf['message']['event']=_0xe5ce('0x82');respondWithRpcPromise('EventManager',_0xe5ce('0x7c'),{'event':_0xe5ce('0x83'),'message':_0x2f9eaf['message']},client9002);return _0x40da15;}return null;})[_0xe5ce('0x36')](respondWithResult(_0x24280a,null))['catch'](handleError(_0x24280a,null));};exports[_0xe5ce('0x84')]=function(_0x483435,_0x568432){var _0x28d611;return db['FaxMessage'][_0xe5ce('0x84')](_0x483435[_0xe5ce('0x57')],{})[_0xe5ce('0x36')](function(_0x138c01){_0x28d611=_0x138c01;return db[_0xe5ce('0x85')][_0xe5ce('0x86')]({'where':{'id':_0x28d611[_0xe5ce('0x6f')]}});})[_0xe5ce('0x36')](function(_0x43b893){if(_[_0xe5ce('0x87')](_0x43b893)){return;}else{_0x28d611['fax']=_0x43b893[_0xe5ce('0x5d')];return db[_0xe5ce('0x88')][_0xe5ce('0x86')]({'where':{'id':_0x28d611['AttachmentId']}});}})[_0xe5ce('0x36')](function(_0x1e6d2c){return respondWithRpcPromise(_0xe5ce('0x89'),_0xe5ce('0x89'),{'FaxAccountId':_[_0xe5ce('0x87')](_0x483435['body'])?undefined:_0x483435[_0xe5ce('0x57')]['FaxAccountId'],'path':_[_0xe5ce('0x87')](_0x1e6d2c)?undefined:util['format'](_0xe5ce('0x8a'),_0x1e6d2c[_0xe5ce('0x8b')]),'fax':_[_0xe5ce('0x87')](_0x28d611[_0xe5ce('0x5d')])?undefined:_0x28d611[_0xe5ce('0x5d')],'AttachmentId':_0x28d611[_0xe5ce('0x8c')]},client9002);})['then'](respondWithResult(_0x568432,0xc9))[_0xe5ce('0x2a')](handleError(_0x568432,null));};exports[_0xe5ce('0x8d')]=function(_0x15e14c,_0xf6e2ac){var _0x5cd474=path[_0xe5ce('0x8e')](config[_0xe5ce('0x8f')],'server',_0xe5ce('0x90'),_0xe5ce('0x91'));return db[_0xe5ce('0x3c')][_0xe5ce('0x58')]({'where':{'id':_0x15e14c[_0xe5ce('0x59')]['id']},'include':[{'model':db[_0xe5ce('0x88')],'as':'Attachment'}]})[_0xe5ce('0x36')](handleEntityNotFound(_0xf6e2ac,null))['then'](function(_0x24e519){if(_0x24e519){return _0xf6e2ac[_0xe5ce('0x8d')](path[_0xe5ce('0x8e')](_0x5cd474,_0x24e519[_0xe5ce('0x88')][_0xe5ce('0x8b')]));}})['catch'](handleError(_0xf6e2ac,null));}; \ No newline at end of file +var _0x0f1a=['FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','end','json','undefined','limit','Content-Range','apply','reject','save','update','status','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','offset','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','rows','show','params','length','find','body','destroy','describe','fax-interactions','fax','format','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT','internal','create','CmContact','Attachment','findOne','SendFax','FaxAccountId','download','root','files','attachments','basename','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0x13b98d,_0x2361af){var _0x1530d0=function(_0x589877){while(--_0x589877){_0x13b98d['push'](_0x13b98d['shift']());}};_0x1530d0(++_0x2361af);}(_0x0f1a,0xfb));var _0xa0f1=function(_0x44d487,_0x13ba53){_0x44d487=_0x44d487-0x0;var _0x2a01ee=_0x0f1a[_0x44d487];return _0x2a01ee;};'use strict';var emlformat=require(_0xa0f1('0x0'));var rimraf=require(_0xa0f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0f1('0x2'));var rp=require(_0xa0f1('0x3'));var moment=require(_0xa0f1('0x4'));var BPromise=require(_0xa0f1('0x5'));var Mustache=require(_0xa0f1('0x6'));var util=require(_0xa0f1('0x7'));var path=require(_0xa0f1('0x8'));var sox=require('sox');var csv=require(_0xa0f1('0x9'));var ejs=require(_0xa0f1('0xa'));var fs=require('fs');var fs_extra=require(_0xa0f1('0xb'));var _=require('lodash');var squel=require(_0xa0f1('0xc'));var crypto=require(_0xa0f1('0xd'));var jsforce=require(_0xa0f1('0xe'));var deskjs=require(_0xa0f1('0xf'));var toCsv=require(_0xa0f1('0x9'));var querystring=require(_0xa0f1('0x10'));var Papa=require(_0xa0f1('0x11'));var Redis=require('ioredis');var authService=require(_0xa0f1('0x12'));var qs=require(_0xa0f1('0x13'));var as=require(_0xa0f1('0x14'));var hardwareService=require(_0xa0f1('0x15'));var logger=require(_0xa0f1('0x16'))(_0xa0f1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa0f1('0x18'));var db=require(_0xa0f1('0x19'))['db'];config[_0xa0f1('0x1a')]=_[_0xa0f1('0x1b')](config[_0xa0f1('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0f1('0x1c'))(new Redis(config[_0xa0f1('0x1a')]));require(_0xa0f1('0x1d'))['register'](socket);var jayson=require(_0xa0f1('0x1e'));var client=jayson[_0xa0f1('0x1f')][_0xa0f1('0x20')]({'port':0x232c});var client9002=jayson[_0xa0f1('0x1f')][_0xa0f1('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x23b461,_0x5c96cf,_0x359ac,_0x41b7ca){return new BPromise(function(_0x5499e8,_0x1cf22f){var _0x4204cd=_0x41b7ca||client;return _0x4204cd[_0xa0f1('0x21')](_0x23b461,_0x359ac)[_0xa0f1('0x22')](function(_0x244ce3){logger[_0xa0f1('0x23')](_0xa0f1('0x24'),_0x5c96cf,'request\x20sent');logger['debug'](_0xa0f1('0x25'),_0x5c96cf,'request\x20sent',JSON[_0xa0f1('0x26')](_0x244ce3));if(_0x244ce3[_0xa0f1('0x27')]){if(_0x244ce3[_0xa0f1('0x27')][_0xa0f1('0x28')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5c96cf,_0x244ce3[_0xa0f1('0x27')][_0xa0f1('0x29')]);return _0x1cf22f(_0x244ce3['error']['message']);}logger[_0xa0f1('0x27')](_0xa0f1('0x24'),_0x5c96cf,_0x244ce3[_0xa0f1('0x27')]['message']);return _0x5499e8(_0x244ce3['error'][_0xa0f1('0x29')]);}else{logger[_0xa0f1('0x23')](_0xa0f1('0x24'),_0x5c96cf,_0xa0f1('0x2a'));_0x5499e8(_0x244ce3[_0xa0f1('0x2b')][_0xa0f1('0x29')]);}})[_0xa0f1('0x2c')](function(_0x407b2f){logger[_0xa0f1('0x27')](_0xa0f1('0x24'),_0x5c96cf,_0x407b2f);_0x1cf22f(_0x407b2f);});});}function respondWithStatusCode(_0x543a85,_0x507d1e){_0x507d1e=_0x507d1e||0xcc;return function(_0x1b6a1e){if(_0x1b6a1e){return _0x543a85['sendStatus'](_0x507d1e);}return _0x543a85['status'](_0x507d1e)[_0xa0f1('0x2d')]();};}function respondWithResult(_0xb68921,_0x51917e){_0x51917e=_0x51917e||0xc8;return function(_0x59e8e7){if(_0x59e8e7){return _0xb68921['status'](_0x51917e)[_0xa0f1('0x2e')](_0x59e8e7);}};}function respondWithFilteredResult(_0xc7078,_0x3a6e67){return function(_0x377fed){if(_0x377fed){var _0x44c2ec=typeof _0x3a6e67['offset']===_0xa0f1('0x2f')&&typeof _0x3a6e67[_0xa0f1('0x30')]===_0xa0f1('0x2f');var _0x4b41a9=_0x377fed['count'];var _0x3a774a=_0x44c2ec?0x0:_0x3a6e67['offset'];var _0x31579c=_0x44c2ec?_0x377fed['count']:_0x3a6e67['offset']+_0x3a6e67[_0xa0f1('0x30')];var _0x564cde;if(_0x31579c>=_0x4b41a9){_0x31579c=_0x4b41a9;_0x564cde=0xc8;}else{_0x564cde=0xce;}_0xc7078['status'](_0x564cde);return _0xc7078['set'](_0xa0f1('0x31'),_0x3a774a+'-'+_0x31579c+'/'+_0x4b41a9)[_0xa0f1('0x2e')](_0x377fed);}return null;};}function patchUpdates(_0x3656df){return function(_0x5e5f02){try{jsonpatch[_0xa0f1('0x32')](_0x5e5f02,_0x3656df,!![]);}catch(_0x42d1a5){return BPromise[_0xa0f1('0x33')](_0x42d1a5);}return _0x5e5f02[_0xa0f1('0x34')]();};}function saveUpdates(_0x572a5d,_0x4224aa){return function(_0x247c7f){if(_0x247c7f){return _0x247c7f[_0xa0f1('0x35')](_0x572a5d)[_0xa0f1('0x22')](function(_0x5a1d7c){return _0x5a1d7c;});}return null;};}function removeEntity(_0x333ae1,_0x105d15){return function(_0x10859d){if(_0x10859d){return _0x10859d['destroy']()[_0xa0f1('0x22')](function(){_0x333ae1[_0xa0f1('0x36')](0xcc)[_0xa0f1('0x2d')]();});}};}function handleEntityNotFound(_0x497f6a,_0x4c6749){return function(_0x1c5223){if(!_0x1c5223){_0x497f6a[_0xa0f1('0x37')](0x194);}return _0x1c5223;};}function handleError(_0x34e0d9,_0x28a232){_0x28a232=_0x28a232||0x1f4;return function(_0x464fcc){logger['error'](_0x464fcc[_0xa0f1('0x38')]);if(_0x464fcc[_0xa0f1('0x39')]){delete _0x464fcc['name'];}_0x34e0d9[_0xa0f1('0x36')](_0x28a232)[_0xa0f1('0x3a')](_0x464fcc);};}exports[_0xa0f1('0x3b')]=function(_0x52c7d4,_0x3d8887){var _0x5bdc44={},_0x5113a3={},_0x11aece={'count':0x0,'rows':[]};var _0x3b904e=_[_0xa0f1('0x3c')](db[_0xa0f1('0x3d')][_0xa0f1('0x3e')],function(_0x2991f0){return{'name':_0x2991f0[_0xa0f1('0x3f')],'type':_0x2991f0[_0xa0f1('0x40')][_0xa0f1('0x41')]};});_0x5113a3[_0xa0f1('0x42')]=_['map'](_0x3b904e,'name');_0x5113a3[_0xa0f1('0x43')]=_[_0xa0f1('0x44')](_0x52c7d4[_0xa0f1('0x43')]);_0x5113a3['filters']=_['intersection'](_0x5113a3[_0xa0f1('0x42')],_0x5113a3[_0xa0f1('0x43')]);_0x5bdc44[_0xa0f1('0x45')]=_[_0xa0f1('0x46')](_0x5113a3[_0xa0f1('0x42')],qs[_0xa0f1('0x47')](_0x52c7d4['query'][_0xa0f1('0x47')]));_0x5bdc44[_0xa0f1('0x45')]=_0x5bdc44[_0xa0f1('0x45')]['length']?_0x5bdc44['attributes']:_0x5113a3[_0xa0f1('0x42')];if(!_0x52c7d4['query'][_0xa0f1('0x48')]('nolimit')){_0x5bdc44['limit']=qs[_0xa0f1('0x30')](_0x52c7d4[_0xa0f1('0x43')]['limit']);_0x5bdc44[_0xa0f1('0x49')]=qs[_0xa0f1('0x49')](_0x52c7d4[_0xa0f1('0x43')][_0xa0f1('0x49')]);}_0x5bdc44[_0xa0f1('0x4a')]=qs[_0xa0f1('0x4b')](_0x52c7d4[_0xa0f1('0x43')][_0xa0f1('0x4b')]);_0x5bdc44[_0xa0f1('0x4c')]=qs[_0xa0f1('0x4d')](_['pick'](_0x52c7d4[_0xa0f1('0x43')],_0x5113a3['filters']),_0x3b904e);if(_0x52c7d4[_0xa0f1('0x43')][_0xa0f1('0x4e')]){_0x5bdc44['where']=_[_0xa0f1('0x4f')](_0x5bdc44[_0xa0f1('0x4c')],{'$or':_[_0xa0f1('0x3c')](_0x3b904e,function(_0x2a4c91){if(_0x2a4c91[_0xa0f1('0x40')]!==_0xa0f1('0x50')){var _0xc4ec4a={};_0xc4ec4a[_0x2a4c91[_0xa0f1('0x39')]]={'$like':'%'+_0x52c7d4[_0xa0f1('0x43')][_0xa0f1('0x4e')]+'%'};return _0xc4ec4a;}})});}_0x5bdc44=_[_0xa0f1('0x4f')]({},_0x5bdc44,_0x52c7d4[_0xa0f1('0x51')]);var _0x5a9080={'where':_0x5bdc44[_0xa0f1('0x4c')]};return db[_0xa0f1('0x3d')]['count'](_0x5a9080)[_0xa0f1('0x22')](function(_0x33513f){_0x11aece[_0xa0f1('0x52')]=_0x33513f;if(_0x52c7d4[_0xa0f1('0x43')][_0xa0f1('0x53')]){_0x5bdc44['include']=[{'all':!![]}];}return db[_0xa0f1('0x3d')]['findAll'](_0x5bdc44);})[_0xa0f1('0x22')](function(_0x2e56ff){_0x11aece[_0xa0f1('0x54')]=_0x2e56ff;return _0x11aece;})[_0xa0f1('0x22')](respondWithFilteredResult(_0x3d8887,_0x5bdc44))[_0xa0f1('0x2c')](handleError(_0x3d8887,null));};exports[_0xa0f1('0x55')]=function(_0x409541,_0x231c6a){var _0x1555a7={'raw':!![],'where':{'id':_0x409541[_0xa0f1('0x56')]['id']}},_0x536d84={};_0x536d84[_0xa0f1('0x42')]=_[_0xa0f1('0x44')](db['FaxMessage'][_0xa0f1('0x3e')]);_0x536d84[_0xa0f1('0x43')]=_[_0xa0f1('0x44')](_0x409541[_0xa0f1('0x43')]);_0x536d84[_0xa0f1('0x4d')]=_['intersection'](_0x536d84[_0xa0f1('0x42')],_0x536d84['query']);_0x1555a7[_0xa0f1('0x45')]=_['intersection'](_0x536d84[_0xa0f1('0x42')],qs[_0xa0f1('0x47')](_0x409541[_0xa0f1('0x43')][_0xa0f1('0x47')]));_0x1555a7[_0xa0f1('0x45')]=_0x1555a7[_0xa0f1('0x45')][_0xa0f1('0x57')]?_0x1555a7[_0xa0f1('0x45')]:_0x536d84[_0xa0f1('0x42')];if(_0x409541['query'][_0xa0f1('0x53')]){_0x1555a7['include']=[{'all':!![]}];}_0x1555a7=_['merge']({},_0x1555a7,_0x409541[_0xa0f1('0x51')]);return db['FaxMessage'][_0xa0f1('0x58')](_0x1555a7)[_0xa0f1('0x22')](handleEntityNotFound(_0x231c6a,null))['then'](respondWithResult(_0x231c6a,null))['catch'](handleError(_0x231c6a,null));};exports[_0xa0f1('0x35')]=function(_0x5e403c,_0x53d571){if(_0x5e403c['body']['id']){delete _0x5e403c[_0xa0f1('0x59')]['id'];}return db[_0xa0f1('0x3d')][_0xa0f1('0x58')]({'where':{'id':_0x5e403c['params']['id']}})[_0xa0f1('0x22')](handleEntityNotFound(_0x53d571,null))[_0xa0f1('0x22')](saveUpdates(_0x5e403c[_0xa0f1('0x59')],null))[_0xa0f1('0x22')](respondWithResult(_0x53d571,null))['catch'](handleError(_0x53d571,null));};exports[_0xa0f1('0x5a')]=function(_0x35657b,_0x586583){return db[_0xa0f1('0x3d')][_0xa0f1('0x58')]({'where':{'id':_0x35657b['params']['id']}})[_0xa0f1('0x22')](handleEntityNotFound(_0x586583,null))[_0xa0f1('0x22')](removeEntity(_0x586583,null))[_0xa0f1('0x2c')](handleError(_0x586583,null));};exports[_0xa0f1('0x5b')]=function(_0x3ed44d,_0x322fc6){return db[_0xa0f1('0x3d')][_0xa0f1('0x5b')]()['then'](respondWithResult(_0x322fc6,null))[_0xa0f1('0x2c')](handleError(_0x322fc6,null));};var interaction_log=require(_0xa0f1('0x16'))(_0xa0f1('0x5c'));exports['accept']=function(_0x237737,_0x2336fe,_0x139781){var _0xe2e58={'agent':{},'channel':_0xa0f1('0x5d')};if(_0x237737['body']['id']){delete _0x237737[_0xa0f1('0x59')]['id'];}_0x237737[_0xa0f1('0x59')]['read']=!![];_0x237737['body']['readAt']=moment()[_0xa0f1('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x237737[_0xa0f1('0x59')][_0xa0f1('0x5f')]=_0x237737[_0xa0f1('0x59')][_0xa0f1('0x5f')]||_0x237737[_0xa0f1('0x60')]['id'];_0xe2e58['agent']['id']=_0x237737[_0xa0f1('0x59')][_0xa0f1('0x5f')];return db[_0xa0f1('0x3d')][_0xa0f1('0x58')]({'where':{'id':_0x237737[_0xa0f1('0x56')]['id'],'UserId':null}})[_0xa0f1('0x22')](handleEntityNotFound(_0x2336fe,null))['then'](saveUpdates(_0x237737[_0xa0f1('0x59')],null))['then'](function(_0x175329){if(_0x175329){_0xe2e58[_0xa0f1('0x29')]=_0x175329[_0xa0f1('0x61')]({'plain':!![]});return db[_0xa0f1('0x62')]['find']({'where':{'id':_0x175329[_0xa0f1('0x63')]}});}return null;})[_0xa0f1('0x22')](handleEntityNotFound(_0x2336fe,null))['then'](function(_0x3e5ec1){if(_0x3e5ec1){return _0x3e5ec1[_0xa0f1('0x35')]({'UserId':_0x237737[_0xa0f1('0x59')][_0xa0f1('0x5f')],'read1stAt':_[_0xa0f1('0x64')](_0x3e5ec1[_0xa0f1('0x65')])?moment()[_0xa0f1('0x5e')](_0xa0f1('0x66')):undefined});}return null;})[_0xa0f1('0x22')](function(_0x4bd9a0){if(_0x4bd9a0){_0xe2e58[_0xa0f1('0x67')]=_0x4bd9a0[_0xa0f1('0x61')]({'plain':!![]});interaction_log[_0xa0f1('0x23')](_0xa0f1('0x68'),_0x237737[_0xa0f1('0x60')]['id'],_0x237737[_0xa0f1('0x60')][_0xa0f1('0x39')],_0x237737[_0xa0f1('0x60')][_0xa0f1('0x69')],_0xe2e58[_0xa0f1('0x67')]['id'],_0x237737[_0xa0f1('0x59')]?JSON[_0xa0f1('0x26')](_0x237737[_0xa0f1('0x59')]):'null');return respondWithRpcPromise(_0xa0f1('0x6a'),_0xa0f1('0x6b'),_0xe2e58);}return null;})[_0xa0f1('0x22')](function(_0x108463){var _0x5d71b4=_0xa0f1('0x6c')+_0x108463[_0xa0f1('0x29')][_0xa0f1('0x6d')];return db[_0xa0f1('0x6e')]['query'](_0x5d71b4,{'type':db[_0xa0f1('0x6f')][_0xa0f1('0x70')]['SELECT'],'raw':!![]})[_0xa0f1('0x22')](function(_0x5e8abf){return _0x5e8abf;});})['then'](function(_0xab6315){if(_0xab6315){_0xe2e58[_0xa0f1('0x29')][_0xa0f1('0x71')]=_0xab6315[0x0];if(!_0x237737[_0xa0f1('0x59')][_0xa0f1('0x5f')])return;return db[_0xa0f1('0x72')][_0xa0f1('0x58')]({'where':{'id':_0x237737[_0xa0f1('0x59')][_0xa0f1('0x5f')],'role':_0xa0f1('0x73')},'attributes':['id','name',_0xa0f1('0x74'),_0xa0f1('0x75'),'internal'],'raw':!![]});}return null;})[_0xa0f1('0x22')](function(_0x2af9b7){if(!_0x2af9b7)return null;_0xe2e58[_0xa0f1('0x29')][_0xa0f1('0x73')]=_0x2af9b7;return _0xe2e58;})['then'](function(_0x5efd04){if(_0x5efd04){if(_0x237737[_0xa0f1('0x59')][_0xa0f1('0x76')]){_0xe2e58[_0xa0f1('0x29')][_0xa0f1('0x77')]=util[_0xa0f1('0x5e')](_0xa0f1('0x78'),_0x237737[_0xa0f1('0x60')][_0xa0f1('0x39')]);_0xe2e58[_0xa0f1('0x29')][_0xa0f1('0x79')]=_0xe2e58['channel'];_0xe2e58[_0xa0f1('0x29')][_0xa0f1('0x7a')]=_0xe2e58[_0xa0f1('0x79')];_0xe2e58[_0xa0f1('0x29')][_0xa0f1('0x7b')]=_0xa0f1('0x7c');return respondWithRpcPromise(_0xa0f1('0x7d'),_0xa0f1('0x7d'),{'event':_0xa0f1('0x7e'),'message':_0xe2e58[_0xa0f1('0x29')]},client9002)[_0xa0f1('0x22')](function(){return _0xe2e58;});}return _0xe2e58;}return null;})[_0xa0f1('0x22')](respondWithResult(_0x2336fe,null))[_0xa0f1('0x2c')](handleError(_0x2336fe,null));};var interaction_log=require('../../config/logger')(_0xa0f1('0x5c'));exports[_0xa0f1('0x33')]=function(_0x69c673,_0x3e65ee,_0x333a57){var _0x564f11={'agent':{},'channel':_0xa0f1('0x5d')};if(_0x69c673[_0xa0f1('0x59')]['id']){delete _0x69c673[_0xa0f1('0x59')]['id'];}_0x69c673[_0xa0f1('0x59')][_0xa0f1('0x5f')]=_0x69c673['body'][_0xa0f1('0x5f')]||_0x69c673[_0xa0f1('0x60')]['id'];_0x564f11[_0xa0f1('0x73')]['id']=_0x69c673['body'][_0xa0f1('0x5f')];return db[_0xa0f1('0x3d')][_0xa0f1('0x58')]({'where':{'id':_0x69c673[_0xa0f1('0x56')]['id'],'UserId':null}})[_0xa0f1('0x22')](handleEntityNotFound(_0x3e65ee,null))[_0xa0f1('0x22')](function(_0x4422ab){if(_0x4422ab){_0x564f11[_0xa0f1('0x29')]=_0x4422ab[_0xa0f1('0x61')]({'plain':!![]});return db[_0xa0f1('0x62')][_0xa0f1('0x58')]({'where':{'id':_0x4422ab[_0xa0f1('0x63')]}});}return null;})[_0xa0f1('0x22')](handleEntityNotFound(_0x3e65ee,null))['then'](function(_0x3c9486){if(_0x3c9486){_0x564f11[_0xa0f1('0x67')]=_0x3c9486['get']({'plain':!![]});interaction_log[_0xa0f1('0x23')](_0xa0f1('0x7f'),_0x69c673[_0xa0f1('0x60')]['id'],_0x69c673[_0xa0f1('0x60')][_0xa0f1('0x39')],_0x69c673[_0xa0f1('0x60')]['role'],_0x564f11[_0xa0f1('0x67')]['id'],_0x69c673[_0xa0f1('0x59')]?JSON[_0xa0f1('0x26')](_0x69c673[_0xa0f1('0x59')]):_0xa0f1('0x80'));return respondWithRpcPromise(_0xa0f1('0x81'),_0xa0f1('0x82'),_0x564f11);}return null;})[_0xa0f1('0x22')](function(_0x215a0e){var _0x52d3e3=_0xa0f1('0x6c')+_0x215a0e['message']['ContactId'];return db[_0xa0f1('0x6e')][_0xa0f1('0x43')](_0x52d3e3,{'type':db[_0xa0f1('0x6f')][_0xa0f1('0x70')][_0xa0f1('0x83')],'raw':!![]})[_0xa0f1('0x22')](function(_0x18e0d9){return _0x18e0d9;});})['then'](function(_0x22e91a){if(_0x22e91a){_0x564f11[_0xa0f1('0x29')]['contact']=_0x22e91a[0x0];if(!_0x69c673[_0xa0f1('0x59')][_0xa0f1('0x5f')])return;return db[_0xa0f1('0x72')][_0xa0f1('0x58')]({'where':{'id':_0x69c673['body'][_0xa0f1('0x5f')],'role':'agent'},'attributes':['id',_0xa0f1('0x39'),_0xa0f1('0x74'),_0xa0f1('0x75'),_0xa0f1('0x84')],'raw':!![]});}return null;})['then'](function(_0x477383){if(!_0x477383)return null;_0x564f11[_0xa0f1('0x29')][_0xa0f1('0x73')]=_0x477383;return _0x564f11;})[_0xa0f1('0x22')](function(_0x26ac9b){if(_0x26ac9b){_0x26ac9b[_0xa0f1('0x29')][_0xa0f1('0x77')]=util['format'](_0xa0f1('0x78'),_0x69c673['user'][_0xa0f1('0x39')]);_0x26ac9b[_0xa0f1('0x29')][_0xa0f1('0x79')]=_0x564f11['channel'];_0x26ac9b[_0xa0f1('0x29')][_0xa0f1('0x7a')]=_0x564f11['channel'];_0x26ac9b[_0xa0f1('0x29')][_0xa0f1('0x7b')]=_0xa0f1('0x33');respondWithRpcPromise('EventManager',_0xa0f1('0x7d'),{'event':'rejectmessage','message':_0x26ac9b[_0xa0f1('0x29')]},client9002);return _0x564f11;}return null;})[_0xa0f1('0x22')](respondWithResult(_0x3e65ee,null))[_0xa0f1('0x2c')](handleError(_0x3e65ee,null));};exports[_0xa0f1('0x85')]=function(_0x4e246d,_0x460442){var _0x5de8b9;return db[_0xa0f1('0x3d')]['create'](_0x4e246d['body'],{})[_0xa0f1('0x22')](function(_0x358205){_0x5de8b9=_0x358205;return db[_0xa0f1('0x86')]['findOne']({'where':{'id':_0x5de8b9[_0xa0f1('0x6d')]}});})[_0xa0f1('0x22')](function(_0x14e824){if(_[_0xa0f1('0x64')](_0x14e824)){return;}else{_0x5de8b9[_0xa0f1('0x5d')]=_0x14e824[_0xa0f1('0x5d')];return db[_0xa0f1('0x87')][_0xa0f1('0x88')]({'where':{'id':_0x5de8b9['AttachmentId']}});}})['then'](function(_0x4459ca){return respondWithRpcPromise(_0xa0f1('0x89'),_0xa0f1('0x89'),{'FaxAccountId':_[_0xa0f1('0x64')](_0x4e246d[_0xa0f1('0x59')])?undefined:_0x4e246d[_0xa0f1('0x59')][_0xa0f1('0x8a')],'path':_[_0xa0f1('0x64')](_0x4459ca)?undefined:util[_0xa0f1('0x5e')]('/var/opt/motion2/server/files/attachments/%s',_0x4459ca['basename']),'fax':_[_0xa0f1('0x64')](_0x5de8b9[_0xa0f1('0x5d')])?undefined:_0x5de8b9[_0xa0f1('0x5d')],'AttachmentId':_0x5de8b9['AttachmentId']},client9002);})[_0xa0f1('0x22')](respondWithResult(_0x460442,0xc9))[_0xa0f1('0x2c')](handleError(_0x460442,null));};exports[_0xa0f1('0x8b')]=function(_0x357dcf,_0x479081){var _0x5e2e15=path['join'](config[_0xa0f1('0x8c')],'server',_0xa0f1('0x8d'),_0xa0f1('0x8e'));return db[_0xa0f1('0x3d')]['find']({'where':{'id':_0x357dcf[_0xa0f1('0x56')]['id']},'include':[{'model':db[_0xa0f1('0x87')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x479081,null))[_0xa0f1('0x22')](function(_0x3524a3){if(_0x3524a3){return _0x479081[_0xa0f1('0x8b')](path['join'](_0x5e2e15,_0x3524a3[_0xa0f1('0x87')][_0xa0f1('0x8f')]));}})[_0xa0f1('0x2c')](handleError(_0x479081,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 5207f36..a31418f 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 _0x2f4a=['events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x187718,_0x427383){var _0x29ddf4=function(_0x2ec62a){while(--_0x2ec62a){_0x187718['push'](_0x187718['shift']());}};_0x29ddf4(++_0x427383);}(_0x2f4a,0x8f));var _0xa2f4=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x2f4a[_0x24237f];return _0x48298e;};'use strict';var EventEmitter=require(_0xa2f4('0x0'));var FaxMessage=require(_0xa2f4('0x1'))['db'][_0xa2f4('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa2f4('0x3')](0x0);var events={'afterCreate':_0xa2f4('0x4'),'afterUpdate':_0xa2f4('0x5'),'afterDestroy':_0xa2f4('0x6')};function emitEvent(_0x17ea32){return function(_0x3ba23a,_0x24aaf4,_0x4b22d6){FaxMessageEvents[_0xa2f4('0x7')](_0x17ea32+':'+_0x3ba23a['id'],_0x3ba23a);FaxMessageEvents[_0xa2f4('0x7')](_0x17ea32,_0x3ba23a);_0x4b22d6(null);};}for(var e in events){if(events[_0xa2f4('0x8')](e)){var event=events[e];FaxMessage[_0xa2f4('0x9')](e,emitEvent(event));}}module[_0xa2f4('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0x2b29=['emit','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners','save','remove'];(function(_0x2b6047,_0x1480eb){var _0x3e9611=function(_0x2a7940){while(--_0x2a7940){_0x2b6047['push'](_0x2b6047['shift']());}};_0x3e9611(++_0x1480eb);}(_0x2b29,0x163));var _0x92b2=function(_0x2bc001,_0x48e3a9){_0x2bc001=_0x2bc001-0x0;var _0x107e01=_0x2b29[_0x2bc001];return _0x107e01;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x92b2('0x0'))['db'][_0x92b2('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x92b2('0x2')](0x0);var events={'afterCreate':_0x92b2('0x3'),'afterUpdate':'update','afterDestroy':_0x92b2('0x4')};function emitEvent(_0xdb5991){return function(_0xbc7de4,_0x3963eb,_0x16c1b0){FaxMessageEvents[_0x92b2('0x5')](_0xdb5991+':'+_0xbc7de4['id'],_0xbc7de4);FaxMessageEvents['emit'](_0xdb5991,_0xbc7de4);_0x16c1b0(null);};}for(var e in events){if(events[_0x92b2('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x92b2('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c5d23c7..d9c423d 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 _0x2a43=['body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','FaxInteractionId','then','update','createdAt','direction','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x2a43,0xcd));var _0x32a4=function(_0x1a7d0d,_0x5d67ce){_0x1a7d0d=_0x1a7d0d-0x0;var _0x6cc93=_0x2a43[_0x1a7d0d];return _0x6cc93;};'use strict';var _=require(_0x32a4('0x0'));var util=require(_0x32a4('0x1'));var logger=require(_0x32a4('0x2'))(_0x32a4('0x3'));var moment=require(_0x32a4('0x4'));var BPromise=require('bluebird');var rp=require(_0x32a4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x32a4('0x6'));var config=require(_0x32a4('0x7'));var attributes=require(_0x32a4('0x8'));module['exports']=function(_0x5d0a00,_0x5290cd){return _0x5d0a00[_0x32a4('0x9')]('FaxMessage',attributes,{'tableName':_0x32a4('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x32a4('0xb')],'type':_0x32a4('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e37a5,_0x42aa8a,_0xc83518){var _0x1015af=_0x5d0a00[_0x32a4('0xd')];var _0x17ffde=_0x3e37a5[_0x32a4('0xe')]({'plain':!![]});if(_0x17ffde['direction']['toLowerCase']()==='in'||_0x17ffde['direction'][_0x32a4('0xf')]()===_0x32a4('0x10')&&!_0x17ffde[_0x32a4('0x11')]&&!_[_0x32a4('0x12')](_0x17ffde['UserId'])){_0x1015af['FaxInteraction']['findOne']({'where':{'id':_0x17ffde[_0x32a4('0x13')]}})[_0x32a4('0x14')](function(_0x31f179){if(_0x31f179){_0x31f179[_0x32a4('0x15')]({'lastMsgAt':_0x17ffde[_0x32a4('0x16')],'lastMsgDirection':_0x17ffde[_0x32a4('0x17')]['toLowerCase']()});}})['catch'](function(_0x70acfd){console[_0x32a4('0x18')](_0x70acfd);});}_0xc83518();}},'charset':_0x32a4('0x19'),'collate':_0x32a4('0x1a')});}; \ No newline at end of file +var _0xff09=['../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4fe879,_0x1179c8){var _0x1c8a96=function(_0x3cc25e){while(--_0x3cc25e){_0x4fe879['push'](_0x4fe879['shift']());}};_0x1c8a96(++_0x1179c8);}(_0xff09,0x1da));var _0x9ff0=function(_0x14210f,_0x5aa48c){_0x14210f=_0x14210f-0x0;var _0x158fa8=_0xff09[_0x14210f];return _0x158fa8;};'use strict';var _=require(_0x9ff0('0x0'));var util=require(_0x9ff0('0x1'));var logger=require(_0x9ff0('0x2'))(_0x9ff0('0x3'));var moment=require('moment');var BPromise=require(_0x9ff0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ff0('0x5'));var rimraf=require('rimraf');var config=require(_0x9ff0('0x6'));var attributes=require(_0x9ff0('0x7'));module[_0x9ff0('0x8')]=function(_0x30e198,_0x5c4f8d){return _0x30e198['define'](_0x9ff0('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x9ff0('0xa'),'fields':[_0x9ff0('0xb')],'type':_0x9ff0('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c0ed2,_0x50feb0,_0x4e0b37){var _0x12fe5d=_0x30e198[_0x9ff0('0xd')];var _0x29fdd7=_0x3c0ed2['get']({'plain':!![]});if(_0x29fdd7['direction'][_0x9ff0('0xe')]()==='in'||_0x29fdd7[_0x9ff0('0xf')]['toLowerCase']()===_0x9ff0('0x10')&&!_0x29fdd7[_0x9ff0('0x11')]&&!_[_0x9ff0('0x12')](_0x29fdd7[_0x9ff0('0x13')])){_0x12fe5d[_0x9ff0('0x14')][_0x9ff0('0x15')]({'where':{'id':_0x29fdd7[_0x9ff0('0x16')]}})[_0x9ff0('0x17')](function(_0x2a6771){if(_0x2a6771){_0x2a6771[_0x9ff0('0x18')]({'lastMsgAt':_0x29fdd7[_0x9ff0('0x19')],'lastMsgDirection':_0x29fdd7['direction'][_0x9ff0('0xe')]()});}})[_0x9ff0('0x1a')](function(_0x12bc3e){console[_0x9ff0('0x1b')](_0x12bc3e);});}_0x4e0b37();}},'charset':_0x9ff0('0x1c'),'collate':_0x9ff0('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 4dd8217..673f1a8 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x21164a,_0x45f57c){var _0x3fbb17=function(_0x172926){while(--_0x172926){_0x21164a['push'](_0x21164a['shift']());}};_0x3fbb17(++_0x45f57c);}(_0x9f62,0x154));var _0x29f6=function(_0x28475d,_0x25773c){_0x28475d=_0x28475d-0x0;var _0x2d94db=_0x9f62[_0x28475d];return _0x2d94db;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0x008c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','then','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','moment','bluebird'];(function(_0x197923,_0x47d2a1){var _0x331ad2=function(_0x137694){while(--_0x137694){_0x197923['push'](_0x197923['shift']());}};_0x331ad2(++_0x47d2a1);}(_0x008c,0x188));var _0xc008=function(_0xca1585,_0x219dfb){_0xca1585=_0xca1585-0x0;var _0x117736=_0x008c[_0xca1585];return _0x117736;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x7231b4,_0x57c46d,_0x51ba7d){return new BPromise(function(_0x543eb8,_0x1eacfa){return client[_0xc008('0x10')](_0x7231b4,_0x51ba7d)['then'](function(_0xae2dab){logger[_0xc008('0x11')](_0xc008('0x12'),_0x57c46d,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x57c46d,_0xc008('0x13'),JSON['stringify'](_0xae2dab));if(_0xae2dab['error']){if(_0xae2dab[_0xc008('0x16')]['code']===0x1f4){logger[_0xc008('0x16')](_0xc008('0x12'),_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x1eacfa(_0xae2dab[_0xc008('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x543eb8(_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57c46d,'request\x20sent');_0x543eb8(_0xae2dab['result'][_0xc008('0x17')]);}})[_0xc008('0x18')](function(_0x501137){logger[_0xc008('0x16')]('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0x501137);_0x1eacfa(_0x501137);});});}exports['CreateFaxMessage']=function(_0x543e5d){var _0x50261c=this;return new Promise(function(_0x5754a0,_0x4b9726){return db['FaxMessage']['create'](_0x543e5d['body'],{'raw':_0x543e5d['options']?_0x543e5d[_0xc008('0x19')][_0xc008('0x1a')]===undefined?!![]:![]:!![]})[_0xc008('0x1b')](function(_0x415af3){logger[_0xc008('0x11')](_0xc008('0x1c'),_0x543e5d);logger['debug'](_0xc008('0x1c'),_0x543e5d,JSON['stringify'](_0x415af3));_0x5754a0(_0x415af3);})['catch'](function(_0x218599){logger[_0xc008('0x16')](_0xc008('0x1c'),_0x218599[_0xc008('0x17')],_0x543e5d);_0x4b9726(_0x50261c['error'](0x1f4,_0x218599['message']));});});};exports['UpdateFaxMessage']=function(_0x3f7b07){var _0x15dade=this;return new Promise(function(_0x92c582,_0x2e31c2){return db['FaxMessage']['update'](_0x3f7b07['body'],{'raw':_0x3f7b07['options']?_0x3f7b07['options'][_0xc008('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')]['where']||null:null,'attributes':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')][_0xc008('0x1d')]||null:null,'limit':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07['options'][_0xc008('0x1e')]||null:null})[_0xc008('0x1b')](function(_0x53ed35){logger['info']('UpdateFaxMessage',_0x3f7b07);logger[_0xc008('0x14')](_0xc008('0x1f'),_0x3f7b07,JSON[_0xc008('0x20')](_0x53ed35));_0x92c582(_0x53ed35);})[_0xc008('0x18')](function(_0x1de04b){logger[_0xc008('0x16')](_0xc008('0x1f'),_0x1de04b[_0xc008('0x17')],_0x3f7b07);_0x2e31c2(_0x15dade[_0xc008('0x16')](0x1f4,_0x1de04b[_0xc008('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 65e7670..2f155bf 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 _0x2fcf=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2fcf,0x73));var _0xf2fc=function(_0x4d2169,_0x353eb9){_0x4d2169=_0x4d2169-0x0;var _0x52e417=_0x2fcf[_0x4d2169];return _0x52e417;};'use strict';var FaxMessageEvents=require(_0xf2fc('0x0'));var events=[_0xf2fc('0x1'),_0xf2fc('0x2'),'update'];function createListener(_0x547f0c,_0x4a93da){return function(_0x2e64f7){_0x4a93da[_0xf2fc('0x3')](_0x547f0c,_0x2e64f7);};}function removeListener(_0x3c2ed7,_0x535089){return function(){FaxMessageEvents[_0xf2fc('0x4')](_0x3c2ed7,_0x535089);};}exports[_0xf2fc('0x5')]=function(_0x48c95b){for(var _0x14a984=0x0,_0x5dcd8d=events[_0xf2fc('0x6')];_0x14a984<_0x5dcd8d;_0x14a984++){var _0x204277=events[_0x14a984];var _0x2ae8f1=createListener(_0xf2fc('0x7')+_0x204277,_0x48c95b);FaxMessageEvents['on'](_0x204277,_0x2ae8f1);}}; \ No newline at end of file +var _0x9117=['removeListener','length','./faxMessage.events','save','remove','update','emit'];(function(_0x46b1e8,_0x26c30f){var _0x43439f=function(_0x200f2a){while(--_0x200f2a){_0x46b1e8['push'](_0x46b1e8['shift']());}};_0x43439f(++_0x26c30f);}(_0x9117,0x12f));var _0x7911=function(_0x5bffa3,_0x4a21ea){_0x5bffa3=_0x5bffa3-0x0;var _0x44780b=_0x9117[_0x5bffa3];return _0x44780b;};'use strict';var FaxMessageEvents=require(_0x7911('0x0'));var events=[_0x7911('0x1'),_0x7911('0x2'),_0x7911('0x3')];function createListener(_0x2b8429,_0x1362c5){return function(_0x571eec){_0x1362c5[_0x7911('0x4')](_0x2b8429,_0x571eec);};}function removeListener(_0x18d899,_0x1f046a){return function(){FaxMessageEvents[_0x7911('0x5')](_0x18d899,_0x1f046a);};}exports['register']=function(_0x4d2913){for(var _0x49ddf2=0x0,_0x9b6650=events[_0x7911('0x6')];_0x49ddf2<_0x9b6650;_0x49ddf2++){var _0x4c04f6=events[_0x49ddf2];var _0x39fabe=createListener('faxMessage:'+_0x4c04f6,_0x4d2913);FaxMessageEvents['on'](_0x4c04f6,_0x39fabe);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ba98667..00eb2c9 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 _0xcea2=['create','put','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked'];(function(_0x4f4d19,_0x574245){var _0x27a258=function(_0x38da3e){while(--_0x38da3e){_0x4f4d19['push'](_0x4f4d19['shift']());}};_0x27a258(++_0x574245);}(_0xcea2,0x15a));var _0x2cea=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xcea2[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0xd')]);router[_0x2cea('0x9')](_0x2cea('0xe'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xf')]);router[_0x2cea('0x10')]('/',auth[_0x2cea('0x8')](),interaction[_0x2cea('0x11')]('fax','faxmessage:create'),controller[_0x2cea('0x12')]);router[_0x2cea('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2cea('0x14')]);router['put'](_0x2cea('0x15'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x2cea('0x17')]);router['delete'](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x18')]);module[_0x2cea('0x19')]=router; \ No newline at end of file +var _0x6f7a=['tracked','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post'];(function(_0x1b0597,_0xeffacc){var _0x2b6a2a=function(_0x4da070){while(--_0x4da070){_0x1b0597['push'](_0x1b0597['shift']());}};_0x2b6a2a(++_0xeffacc);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x74512b,_0x49ca70){_0x74512b=_0x74512b-0x0;var _0xfd56d2=_0x6f7a[_0x74512b];return _0xfd56d2;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var fs_extra=require(_0xa6f7('0x5'));var auth=require(_0xa6f7('0x6'));var interaction=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var controller=require(_0xa6f7('0x9'));router[_0xa6f7('0xa')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xc')]);router[_0xa6f7('0xa')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xa6f7('0xa')](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xf')]);router[_0xa6f7('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xa6f7('0x10')]);router[_0xa6f7('0x11')]('/',auth['isAuthenticated'](),interaction[_0xa6f7('0x12')]('fax',_0xa6f7('0x13')),controller[_0xa6f7('0x14')]);router[_0xa6f7('0x15')](_0xa6f7('0xe'),auth['isAuthenticated'](),controller[_0xa6f7('0x16')]);router['put'](_0xa6f7('0x17'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x18')]);router['put'](_0xa6f7('0x19'),auth['isAuthenticated'](),controller[_0xa6f7('0x1a')]);router['delete'](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 143bc51..e004af5 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 _0x082a=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x3b0c93,_0x1d4e5d){var _0x14fd4a=function(_0x22ed7c){while(--_0x22ed7c){_0x3b0c93['push'](_0x3b0c93['shift']());}};_0x14fd4a(++_0x1d4e5d);}(_0x082a,0x154));var _0xa082=function(_0x3ed7f0,_0x7ad532){_0x3ed7f0=_0x3ed7f0-0x0;var _0x260fab=_0x082a[_0x3ed7f0];return _0x260fab;};'use strict';var Sequelize=require('sequelize');module[_0xa082('0x0')]={'name':{'type':Sequelize[_0xa082('0x1')],'unique':_0xa082('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa082('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa082('0x4')](_0xa082('0x5'),_0xa082('0x6'),_0xa082('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x25ee=['exports','STRING','rrmemory','beepall','INTEGER','sequelize'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x25ee,0x14f));var _0xe25e=function(_0x1d931a,_0x5cdeaa){_0x1d931a=_0x1d931a-0x0;var _0xbefcc6=_0x25ee[_0x1d931a];return _0xbefcc6;};'use strict';var Sequelize=require(_0xe25e('0x0'));module[_0xe25e('0x1')]={'name':{'type':Sequelize[_0xe25e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe25e('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe25e('0x3'),_0xe25e('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe25e('0x5')],'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 3b561ff..d1a2498 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 _0xed23=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','merge','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','findAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','Team','getTeams','addTeams','flatMap','Agents','transaction','each','findOrCreate','emit','ids','User','select','field','tq.TeamId','from','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','sequelize','removeTeams','removeAgents','forEach','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','end','status','json','offset','limit','count','set','apply','update','then','destroy','FaxQueues','UserProfileResource','sendStatus','error','stack','name','send','map','FaxQueue','rawAttributes','type','key','query','filters','intersection','model'];(function(_0x3610ba,_0x562f07){var _0x4e6aac=function(_0x54aebe){while(--_0x54aebe){_0x3610ba['push'](_0x3610ba['shift']());}};_0x4e6aac(++_0x562f07);}(_0xed23,0x160));var _0x3ed2=function(_0x32353f,_0x1e1573){_0x32353f=_0x32353f-0x0;var _0x229365=_0xed23[_0x32353f];return _0x229365;};'use strict';var emlformat=require(_0x3ed2('0x0'));var rimraf=require(_0x3ed2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ed2('0x2'));var rp=require(_0x3ed2('0x3'));var moment=require('moment');var BPromise=require(_0x3ed2('0x4'));var Mustache=require(_0x3ed2('0x5'));var util=require(_0x3ed2('0x6'));var path=require(_0x3ed2('0x7'));var sox=require(_0x3ed2('0x8'));var csv=require(_0x3ed2('0x9'));var ejs=require(_0x3ed2('0xa'));var fs=require('fs');var fs_extra=require(_0x3ed2('0xb'));var _=require(_0x3ed2('0xc'));var squel=require(_0x3ed2('0xd'));var crypto=require(_0x3ed2('0xe'));var jsforce=require(_0x3ed2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3ed2('0x9'));var querystring=require(_0x3ed2('0x10'));var Papa=require('papaparse');var Redis=require(_0x3ed2('0x11'));var authService=require(_0x3ed2('0x12'));var qs=require(_0x3ed2('0x13'));var as=require(_0x3ed2('0x14'));var hardwareService=require(_0x3ed2('0x15'));var logger=require('../../config/logger')(_0x3ed2('0x16'));var utils=require(_0x3ed2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3ed2('0x18'));var db=require(_0x3ed2('0x19'))['db'];config[_0x3ed2('0x1a')]=_[_0x3ed2('0x1b')](config['redis'],{'host':_0x3ed2('0x1c'),'port':0x18eb});var socket=require(_0x3ed2('0x1d'))(new Redis(config[_0x3ed2('0x1a')]));require(_0x3ed2('0x1e'))[_0x3ed2('0x1f')](socket);function respondWithStatusCode(_0x10395b,_0xf5b7a3){_0xf5b7a3=_0xf5b7a3||0xcc;return function(_0x46120d){if(_0x46120d){return _0x10395b['sendStatus'](_0xf5b7a3);}return _0x10395b['status'](_0xf5b7a3)[_0x3ed2('0x20')]();};}function respondWithResult(_0x45f0d3,_0x14dbb2){_0x14dbb2=_0x14dbb2||0xc8;return function(_0x5edbf6){if(_0x5edbf6){return _0x45f0d3[_0x3ed2('0x21')](_0x14dbb2)[_0x3ed2('0x22')](_0x5edbf6);}};}function respondWithFilteredResult(_0x563a10,_0x3478ed){return function(_0x4590d1){if(_0x4590d1){var _0x5e04ca=typeof _0x3478ed[_0x3ed2('0x23')]==='undefined'&&typeof _0x3478ed[_0x3ed2('0x24')]==='undefined';var _0x26a993=_0x4590d1[_0x3ed2('0x25')];var _0x28a1e0=_0x5e04ca?0x0:_0x3478ed[_0x3ed2('0x23')];var _0x25f6b8=_0x5e04ca?_0x4590d1[_0x3ed2('0x25')]:_0x3478ed[_0x3ed2('0x23')]+_0x3478ed[_0x3ed2('0x24')];var _0x4091cb;if(_0x25f6b8>=_0x26a993){_0x25f6b8=_0x26a993;_0x4091cb=0xc8;}else{_0x4091cb=0xce;}_0x563a10[_0x3ed2('0x21')](_0x4091cb);return _0x563a10[_0x3ed2('0x26')]('Content-Range',_0x28a1e0+'-'+_0x25f6b8+'/'+_0x26a993)[_0x3ed2('0x22')](_0x4590d1);}return null;};}function patchUpdates(_0x5c7dd3){return function(_0x51b76b){try{jsonpatch[_0x3ed2('0x27')](_0x51b76b,_0x5c7dd3,!![]);}catch(_0x38354d){return BPromise['reject'](_0x38354d);}return _0x51b76b['save']();};}function saveUpdates(_0x5a382e,_0x34e4b2){return function(_0x5bd08d){if(_0x5bd08d){return _0x5bd08d[_0x3ed2('0x28')](_0x5a382e)[_0x3ed2('0x29')](function(_0x1a4a5e){return _0x1a4a5e;});}return null;};}function removeEntity(_0x2d16a8,_0x232912){return function(_0x5737ca){if(_0x5737ca){return _0x5737ca[_0x3ed2('0x2a')]()[_0x3ed2('0x29')](function(){var _0x471193=_0x5737ca['get']({'plain':!![]});var _0x47b6f6=_0x3ed2('0x2b');return db[_0x3ed2('0x2c')][_0x3ed2('0x2a')]({'where':{'type':_0x47b6f6,'resourceId':_0x471193['id']}})[_0x3ed2('0x29')](function(){return _0x5737ca;});})['then'](function(){_0x2d16a8[_0x3ed2('0x21')](0xcc)[_0x3ed2('0x20')]();});}};}function handleEntityNotFound(_0x473d6a,_0x961637){return function(_0x2b3b97){if(!_0x2b3b97){_0x473d6a[_0x3ed2('0x2d')](0x194);}return _0x2b3b97;};}function handleError(_0x273b56,_0x41400e){_0x41400e=_0x41400e||0x1f4;return function(_0x5c1826){logger[_0x3ed2('0x2e')](_0x5c1826[_0x3ed2('0x2f')]);if(_0x5c1826[_0x3ed2('0x30')]){delete _0x5c1826[_0x3ed2('0x30')];}_0x273b56[_0x3ed2('0x21')](_0x41400e)[_0x3ed2('0x31')](_0x5c1826);};}exports['index']=function(_0x1f4a1e,_0x4454ef){var _0x1f45b8={},_0x1791b5={},_0x3af8be={'count':0x0,'rows':[]};var _0x3d89e4=_[_0x3ed2('0x32')](db[_0x3ed2('0x33')][_0x3ed2('0x34')],function(_0x3d2f64){return{'name':_0x3d2f64['fieldName'],'type':_0x3d2f64[_0x3ed2('0x35')][_0x3ed2('0x36')]};});_0x1791b5['model']=_['map'](_0x3d89e4,'name');_0x1791b5[_0x3ed2('0x37')]=_['keys'](_0x1f4a1e[_0x3ed2('0x37')]);_0x1791b5[_0x3ed2('0x38')]=_[_0x3ed2('0x39')](_0x1791b5[_0x3ed2('0x3a')],_0x1791b5[_0x3ed2('0x37')]);_0x1f45b8['attributes']=_['intersection'](_0x1791b5[_0x3ed2('0x3a')],qs[_0x3ed2('0x3b')](_0x1f4a1e[_0x3ed2('0x37')]['fields']));_0x1f45b8['attributes']=_0x1f45b8[_0x3ed2('0x3c')][_0x3ed2('0x3d')]?_0x1f45b8['attributes']:_0x1791b5['model'];if(!_0x1f4a1e[_0x3ed2('0x37')][_0x3ed2('0x3e')](_0x3ed2('0x3f'))){_0x1f45b8[_0x3ed2('0x24')]=qs[_0x3ed2('0x24')](_0x1f4a1e[_0x3ed2('0x37')]['limit']);_0x1f45b8[_0x3ed2('0x23')]=qs['offset'](_0x1f4a1e[_0x3ed2('0x37')][_0x3ed2('0x23')]);}_0x1f45b8[_0x3ed2('0x40')]=qs[_0x3ed2('0x41')](_0x1f4a1e[_0x3ed2('0x37')][_0x3ed2('0x41')]);_0x1f45b8[_0x3ed2('0x42')]=qs[_0x3ed2('0x38')](_[_0x3ed2('0x43')](_0x1f4a1e['query'],_0x1791b5[_0x3ed2('0x38')]),_0x3d89e4);if(_0x1f4a1e['query']['filter']){_0x1f45b8[_0x3ed2('0x42')]=_['merge'](_0x1f45b8['where'],{'$or':_[_0x3ed2('0x32')](_0x3d89e4,function(_0xb4d5bb){if(_0xb4d5bb[_0x3ed2('0x35')]!==_0x3ed2('0x44')){var _0x1cb6a8={};_0x1cb6a8[_0xb4d5bb['name']]={'$like':'%'+_0x1f4a1e[_0x3ed2('0x37')][_0x3ed2('0x45')]+'%'};return _0x1cb6a8;}})});}_0x1f45b8=_['merge']({},_0x1f45b8,_0x1f4a1e[_0x3ed2('0x46')]);var _0x3adbed={'where':_0x1f45b8[_0x3ed2('0x42')]};return db[_0x3ed2('0x33')][_0x3ed2('0x25')](_0x3adbed)[_0x3ed2('0x29')](function(_0xc4354b){_0x3af8be['count']=_0xc4354b;if(_0x1f4a1e[_0x3ed2('0x37')][_0x3ed2('0x47')]){_0x1f45b8[_0x3ed2('0x48')]=[{'all':!![]}];}return db[_0x3ed2('0x33')]['findAll'](_0x1f45b8);})[_0x3ed2('0x29')](function(_0x4c8012){_0x3af8be[_0x3ed2('0x49')]=_0x4c8012;return _0x3af8be;})[_0x3ed2('0x29')](respondWithFilteredResult(_0x4454ef,_0x1f45b8))[_0x3ed2('0x4a')](handleError(_0x4454ef,null));};exports[_0x3ed2('0x4b')]=function(_0xc15ddb,_0x20b667){var _0x13ee36={'raw':!![],'where':{'id':_0xc15ddb[_0x3ed2('0x4c')]['id']}},_0x3060da={};_0x3060da['model']=_['keys'](db[_0x3ed2('0x33')][_0x3ed2('0x34')]);_0x3060da[_0x3ed2('0x37')]=_[_0x3ed2('0x4d')](_0xc15ddb[_0x3ed2('0x37')]);_0x3060da[_0x3ed2('0x38')]=_['intersection'](_0x3060da[_0x3ed2('0x3a')],_0x3060da['query']);_0x13ee36['attributes']=_[_0x3ed2('0x39')](_0x3060da[_0x3ed2('0x3a')],qs['fields'](_0xc15ddb[_0x3ed2('0x37')][_0x3ed2('0x3b')]));_0x13ee36['attributes']=_0x13ee36[_0x3ed2('0x3c')][_0x3ed2('0x3d')]?_0x13ee36[_0x3ed2('0x3c')]:_0x3060da[_0x3ed2('0x3a')];if(_0xc15ddb['query'][_0x3ed2('0x47')]){_0x13ee36['include']=[{'all':!![]}];}_0x13ee36=_[_0x3ed2('0x4e')]({},_0x13ee36,_0xc15ddb['options']);return db[_0x3ed2('0x33')][_0x3ed2('0x4f')](_0x13ee36)[_0x3ed2('0x29')](handleEntityNotFound(_0x20b667,null))['then'](respondWithResult(_0x20b667,null))['catch'](handleError(_0x20b667,null));};exports[_0x3ed2('0x50')]=function(_0x54e911,_0x221080){return db['FaxQueue'][_0x3ed2('0x50')](_0x54e911['body'],{})[_0x3ed2('0x29')](function(_0x47ac8f){var _0x473beb=_0x54e911['user'][_0x3ed2('0x51')]({'plain':!![]});if(!_0x473beb)throw new Error(_0x3ed2('0x52'));if(_0x473beb[_0x3ed2('0x53')]==='user'){var _0x37c3ea=_0x47ac8f[_0x3ed2('0x51')]({'plain':!![]});var _0x445a48=_0x3ed2('0x2b');return db[_0x3ed2('0x54')][_0x3ed2('0x4f')]({'where':{'name':_0x445a48,'userProfileId':_0x473beb[_0x3ed2('0x55')]},'raw':!![]})['then'](function(_0x43dab9){if(_0x43dab9&&_0x43dab9['autoAssociation']===0x0){return db[_0x3ed2('0x2c')][_0x3ed2('0x50')]({'name':_0x37c3ea[_0x3ed2('0x30')],'resourceId':_0x37c3ea['id'],'type':_0x43dab9[_0x3ed2('0x30')],'sectionId':_0x43dab9['id']},{})[_0x3ed2('0x29')](function(){return _0x47ac8f;});}else{return _0x47ac8f;}})['catch'](function(_0x47e64a){logger[_0x3ed2('0x2e')](_0x3ed2('0x56'),_0x47e64a);throw _0x47e64a;});}return _0x47ac8f;})[_0x3ed2('0x29')](respondWithResult(_0x221080,0xc9))[_0x3ed2('0x4a')](handleError(_0x221080,null));};exports['update']=function(_0x5728a8,_0x4c6533){if(_0x5728a8['body']['id']){delete _0x5728a8[_0x3ed2('0x57')]['id'];}return db[_0x3ed2('0x33')]['find']({'where':{'id':_0x5728a8['params']['id']}})[_0x3ed2('0x29')](handleEntityNotFound(_0x4c6533,null))['then'](saveUpdates(_0x5728a8[_0x3ed2('0x57')],null))['then'](respondWithResult(_0x4c6533,null))[_0x3ed2('0x4a')](handleError(_0x4c6533,null));};exports['destroy']=function(_0x49aff1,_0x4d7408){return db[_0x3ed2('0x33')][_0x3ed2('0x4f')]({'where':{'id':_0x49aff1[_0x3ed2('0x4c')]['id']}})[_0x3ed2('0x29')](handleEntityNotFound(_0x4d7408,null))[_0x3ed2('0x29')](removeEntity(_0x4d7408,null))['catch'](handleError(_0x4d7408,null));};exports[_0x3ed2('0x58')]=function(_0x334a78,_0x2b5d80){return db[_0x3ed2('0x33')][_0x3ed2('0x58')]()['then'](respondWithResult(_0x2b5d80,null))[_0x3ed2('0x4a')](handleError(_0x2b5d80,null));};exports[_0x3ed2('0x59')]=function(_0x1e904b,_0x39e68e,_0xb0b3ed){var _0x3328bc={'raw':!![],'where':{}},_0x8b53e7={},_0x4141f4;return db['FaxQueue'][_0x3ed2('0x5a')]({'where':{'id':_0x1e904b[_0x3ed2('0x4c')]['id']}})[_0x3ed2('0x29')](handleEntityNotFound(_0x39e68e,null))[_0x3ed2('0x29')](function(_0x1cc2a0){if(_0x1cc2a0){_0x4141f4=_0x1cc2a0[_0x3ed2('0x51')]({'plain':!![]});_0x8b53e7[_0x3ed2('0x3a')]=_[_0x3ed2('0x4d')](db[_0x3ed2('0x5b')][_0x3ed2('0x34')]);_0x8b53e7['query']=_['keys'](_0x1e904b[_0x3ed2('0x37')]);_0x8b53e7['filters']=_[_0x3ed2('0x39')](_0x8b53e7['model'],_0x8b53e7[_0x3ed2('0x37')]);_0x3328bc['attributes']=_[_0x3ed2('0x39')](_0x8b53e7[_0x3ed2('0x3a')],qs[_0x3ed2('0x3b')](_0x1e904b[_0x3ed2('0x37')]['fields']));_0x3328bc[_0x3ed2('0x3c')]=_0x3328bc[_0x3ed2('0x3c')][_0x3ed2('0x3d')]?_0x3328bc['attributes']:_0x8b53e7[_0x3ed2('0x3a')];if(!_0x1e904b['query']['hasOwnProperty']('nolimit')){_0x3328bc[_0x3ed2('0x24')]=qs[_0x3ed2('0x24')](_0x1e904b[_0x3ed2('0x37')][_0x3ed2('0x24')]);_0x3328bc[_0x3ed2('0x23')]=qs[_0x3ed2('0x23')](_0x1e904b[_0x3ed2('0x37')][_0x3ed2('0x23')]);}_0x3328bc[_0x3ed2('0x40')]=qs['sort'](_0x1e904b[_0x3ed2('0x37')][_0x3ed2('0x41')]);_0x3328bc[_0x3ed2('0x42')]=qs[_0x3ed2('0x38')](_[_0x3ed2('0x43')](_0x1e904b['query'],_0x8b53e7[_0x3ed2('0x38')]));_0x3328bc[_0x3ed2('0x42')]['FaxQueueId']=_0x1cc2a0['id'];if(_0x1e904b['query'][_0x3ed2('0x45')]){_0x3328bc[_0x3ed2('0x42')]=_[_0x3ed2('0x4e')](_0x3328bc[_0x3ed2('0x42')],{'$or':_['map'](_0x3328bc[_0x3ed2('0x3c')],function(_0x1a058d){var _0xdb46f1={};_0xdb46f1[_0x1a058d]={'$like':'%'+_0x1e904b['query'][_0x3ed2('0x45')]+'%'};return _0xdb46f1;})});}_0x3328bc=_[_0x3ed2('0x4e')]({},_0x3328bc,_0x1e904b[_0x3ed2('0x46')]);return db[_0x3ed2('0x5b')][_0x3ed2('0x5c')](_0x3328bc);}})[_0x3ed2('0x29')](function(_0xc933c){if(_0xc933c){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0xc933c,_0x3ed2('0x5d')),'role':'agent'},'attributes':['id',_0x3ed2('0x30'),_0x3ed2('0x5e'),_0x3ed2('0x5f'),_0x3ed2('0x60')]});}})[_0x3ed2('0x29')](function(_0x48de5e){if(_0x48de5e){return{'count':_0x48de5e[_0x3ed2('0x25')],'rows':_[_0x3ed2('0x32')](_0x48de5e[_0x3ed2('0x49')],function(_0x6a54c5){return{'membername':_0x6a54c5[_0x3ed2('0x30')],'UserId':_0x6a54c5['id'],'queue_name':_0x4141f4['name'],'FaxQueueId':_0x4141f4['id'],'interface':util[_0x3ed2('0x61')](_0x3ed2('0x62'),'SIP',_0x6a54c5[_0x3ed2('0x30')]),'penalty':0x0,'paused':_0x6a54c5[_0x3ed2('0x5e')],'createdAt':_0x6a54c5[_0x3ed2('0x60')],'updatedAt':_0x6a54c5[_0x3ed2('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3ed2('0x29')](respondWithFilteredResult(_0x39e68e,_0x3328bc))['catch'](handleError(_0x39e68e,null));};exports['getTeams']=function(_0x1c11a9,_0x5952e0,_0x586b2c){var _0x3962df={};var _0x57570f={};var _0x27ed96;var _0x4f85ff;return db[_0x3ed2('0x33')][_0x3ed2('0x5a')]({'where':{'id':_0x1c11a9[_0x3ed2('0x4c')]['id']}})[_0x3ed2('0x29')](handleEntityNotFound(_0x5952e0,null))[_0x3ed2('0x29')](function(_0x5e666f){if(_0x5e666f){_0x27ed96=_0x5e666f;_0x57570f[_0x3ed2('0x3a')]=_[_0x3ed2('0x4d')](db[_0x3ed2('0x63')]['rawAttributes']);_0x57570f['query']=_[_0x3ed2('0x4d')](_0x1c11a9[_0x3ed2('0x37')]);_0x57570f[_0x3ed2('0x38')]=_['intersection'](_0x57570f[_0x3ed2('0x3a')],_0x57570f['query']);_0x3962df[_0x3ed2('0x3c')]=_['intersection'](_0x57570f[_0x3ed2('0x3a')],qs[_0x3ed2('0x3b')](_0x1c11a9[_0x3ed2('0x37')][_0x3ed2('0x3b')]));_0x3962df[_0x3ed2('0x3c')]=_0x3962df[_0x3ed2('0x3c')]['length']?_0x3962df[_0x3ed2('0x3c')]:_0x57570f[_0x3ed2('0x3a')];_0x3962df[_0x3ed2('0x40')]=qs[_0x3ed2('0x41')](_0x1c11a9['query'][_0x3ed2('0x41')]);_0x3962df['where']=qs[_0x3ed2('0x38')](_[_0x3ed2('0x43')](_0x1c11a9[_0x3ed2('0x37')],_0x57570f[_0x3ed2('0x38')]));if(_0x1c11a9[_0x3ed2('0x37')][_0x3ed2('0x45')]){_0x3962df['where']=_[_0x3ed2('0x4e')](_0x3962df[_0x3ed2('0x42')],{'$or':_[_0x3ed2('0x32')](_0x3962df[_0x3ed2('0x3c')],function(_0x5c8aca){var _0x43ee9d={};_0x43ee9d[_0x5c8aca]={'$like':'%'+_0x1c11a9[_0x3ed2('0x37')][_0x3ed2('0x45')]+'%'};return _0x43ee9d;})});}_0x3962df=_[_0x3ed2('0x4e')]({},_0x3962df,_0x1c11a9[_0x3ed2('0x46')]);return _0x27ed96['getTeams'](_0x3962df);}})[_0x3ed2('0x29')](function(_0x209dcb){if(_0x209dcb){_0x4f85ff=_0x209dcb[_0x3ed2('0x3d')];if(!_0x1c11a9[_0x3ed2('0x37')][_0x3ed2('0x3e')](_0x3ed2('0x3f'))){_0x3962df[_0x3ed2('0x24')]=qs[_0x3ed2('0x24')](_0x1c11a9[_0x3ed2('0x37')]['limit']);_0x3962df['offset']=qs['offset'](_0x1c11a9[_0x3ed2('0x37')]['offset']);}return _0x27ed96[_0x3ed2('0x64')](_0x3962df);}})[_0x3ed2('0x29')](function(_0x31e1a5){if(_0x31e1a5){return _0x31e1a5?{'count':_0x4f85ff,'rows':_0x31e1a5}:null;}})[_0x3ed2('0x29')](respondWithResult(_0x5952e0,null))['catch'](handleError(_0x5952e0,null));};exports[_0x3ed2('0x65')]=function(_0x127ca7,_0x4a94bd,_0x4d7a8f){var _0x3bae92=_0x127ca7[_0x3ed2('0x57')]['ids'];return db[_0x3ed2('0x63')][_0x3ed2('0x5c')]({'where':{'id':_0x3bae92},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x3ed2('0x30'),'online','voicePause','interface'],'raw':!![]}]})[_0x3ed2('0x29')](function(_0x25c75b){if(_0x25c75b){var _0x44d241=_[_0x3ed2('0x66')](_0x25c75b,function(_0x5f49a4){var _0x149ddf=_0x5f49a4[_0x3ed2('0x51')]({'plain':!![]});return _0x149ddf[_0x3ed2('0x67')];});return db[_0x3ed2('0x33')]['find']({'where':{'id':_0x127ca7[_0x3ed2('0x4c')]['id']}})[_0x3ed2('0x29')](function(_0xd9058e){return db['sequelize'][_0x3ed2('0x68')](function(_0x48b996){return _0xd9058e[_0x3ed2('0x65')](_0x3bae92,{'transaction':_0x48b996})[_0x3ed2('0x29')](function(){return BPromise[_0x3ed2('0x69')](_0x44d241,function(_0x471a59){return db[_0x3ed2('0x5b')][_0x3ed2('0x6a')]({'where':{'UserId':_0x471a59['id'],'FaxQueueId':_0x127ca7[_0x3ed2('0x4c')]['id']},'transaction':_0x48b996});});})[_0x3ed2('0x29')](function(){_0x44d241['forEach'](function(_0x77e6a4){socket[_0x3ed2('0x6b')]('userFaxQueue:save',{'UserId':_0x77e6a4['id'],'FaxQueueId':_0xd9058e['id']});});});});});}})[_0x3ed2('0x29')](respondWithStatusCode(_0x4a94bd,null))[_0x3ed2('0x4a')](handleError(_0x4a94bd,null));};exports['removeTeams']=function(_0x121639,_0x17a8ea,_0x4085f4){return db[_0x3ed2('0x63')]['findAll']({'where':{'id':_0x121639['query'][_0x3ed2('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x3ed2('0x6d')],'as':_0x3ed2('0x67'),'attributes':['id'],'raw':!![]}]})[_0x3ed2('0x29')](handleEntityNotFound(_0x17a8ea,null))[_0x3ed2('0x29')](function(_0x15c54f){var _0x1105da=_['map'](_0x15c54f,'id');var _0x56b16d=[];var _0x197ff9=[];var _0x15a1b2=squel[_0x3ed2('0x6e')]();_0x15a1b2[_0x3ed2('0x6f')](_0x3ed2('0x70'))[_0x3ed2('0x71')]('team_has_fax_queues','tq')[_0x3ed2('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x3ed2('0x73'),_0x121639[_0x3ed2('0x4c')]['id']);for(var _0x272abc=0x0;_0x272abc<_0x15c54f[_0x3ed2('0x3d')];_0x272abc+=0x1){let _0x4fb020=_0x15c54f[_0x272abc];for(var _0x10973d=0x0;_0x10973d<_0x4fb020[_0x3ed2('0x67')][_0x3ed2('0x3d')];_0x10973d+=0x1){let _0x208e28=_0x4fb020[_0x3ed2('0x67')][_0x10973d];var _0x2e3603=_0x15a1b2[_0x3ed2('0x74')]();_0x2e3603[_0x3ed2('0x42')](_0x3ed2('0x75'),_0x208e28['id']);_0x197ff9[_0x3ed2('0x76')](db['sequelize'][_0x3ed2('0x37')](_0x2e3603[_0x3ed2('0x77')](),{'type':db['sequelize'][_0x3ed2('0x78')][_0x3ed2('0x79')]})[_0x3ed2('0x29')](function(_0x45fd08){if(_0x45fd08[_0x3ed2('0x3d')]===0x1){return _0x208e28['id'];}else{var _0x12f3fd=_[_0x3ed2('0x7a')](_['map'](_0x45fd08,'TeamId'),function(_0x498db4){return _[_0x3ed2('0x7b')](_0x1105da,_0x498db4);});if(_0x12f3fd){return _0x208e28['id'];}}}));}}return BPromise['all'](_0x197ff9)[_0x3ed2('0x29')](function(_0x11f8e9){_0x56b16d=_(_0x56b16d)[_0x3ed2('0x7c')](_0x11f8e9)[_0x3ed2('0x7d')]()[_0x3ed2('0x7e')]();return db[_0x3ed2('0x33')][_0x3ed2('0x4f')]({'where':{'id':_0x121639[_0x3ed2('0x4c')]['id']}})[_0x3ed2('0x29')](function(_0x45ce78){return db[_0x3ed2('0x7f')]['transaction'](function(_0x450a00){return _0x45ce78[_0x3ed2('0x80')](_0x121639['query'][_0x3ed2('0x6c')],{'transaction':_0x450a00})[_0x3ed2('0x29')](function(){if(!_['isEmpty'](_0x56b16d)){return _0x45ce78[_0x3ed2('0x81')](_0x56b16d,{'transaction':_0x450a00});}})['then'](function(){_0x56b16d[_0x3ed2('0x82')](function(_0x1ded26){socket[_0x3ed2('0x6b')](_0x3ed2('0x83'),{'UserId':_0x1ded26,'FaxQueueId':_0x45ce78['id']});});});});});});})[_0x3ed2('0x29')](respondWithStatusCode(_0x17a8ea,null))[_0x3ed2('0x4a')](handleError(_0x17a8ea,null));};exports[_0x3ed2('0x84')]=function(_0x23f3fe,_0xaa007,_0x10c985){return db[_0x3ed2('0x33')][_0x3ed2('0x4f')]({'where':{'id':_0x23f3fe[_0x3ed2('0x4c')]['id']}})[_0x3ed2('0x29')](handleEntityNotFound(_0xaa007,null))[_0x3ed2('0x29')](function(_0x41f194){if(_0x41f194){return _0x41f194[_0x3ed2('0x84')](_0x23f3fe[_0x3ed2('0x57')][_0x3ed2('0x6c')],_['omit'](_0x23f3fe[_0x3ed2('0x57')],['ids','id'])||{})[_0x3ed2('0x85')](function(_0x23b4cc){for(var _0xe507d2=0x0;_0xe507d2<_0x23f3fe[_0x3ed2('0x57')]['ids'][_0x3ed2('0x3d')];_0xe507d2+=0x1){socket[_0x3ed2('0x6b')](_0x3ed2('0x86'),{'UserId':Number(_0x23f3fe[_0x3ed2('0x57')][_0x3ed2('0x6c')][_0xe507d2]),'FaxQueueId':Number(_0x23f3fe[_0x3ed2('0x4c')]['id'])});}return _0x23b4cc;});}})[_0x3ed2('0x29')](respondWithResult(_0xaa007,null))['catch'](handleError(_0xaa007,null));};exports[_0x3ed2('0x81')]=function(_0x314150,_0x202455,_0x32edad){return db[_0x3ed2('0x33')][_0x3ed2('0x4f')]({'where':{'id':_0x314150['params']['id']}})[_0x3ed2('0x29')](handleEntityNotFound(_0x202455,null))[_0x3ed2('0x29')](function(_0x262d78){if(_0x262d78){return _0x262d78[_0x3ed2('0x81')](_0x314150[_0x3ed2('0x37')][_0x3ed2('0x6c')])['then'](function(){if(_[_0x3ed2('0x87')](_0x314150[_0x3ed2('0x37')][_0x3ed2('0x6c')])){for(var _0x58da2f=0x0;_0x58da2f<_0x314150[_0x3ed2('0x37')][_0x3ed2('0x6c')][_0x3ed2('0x3d')];_0x58da2f+=0x1){socket[_0x3ed2('0x6b')](_0x3ed2('0x83'),{'UserId':Number(_0x314150[_0x3ed2('0x37')][_0x3ed2('0x6c')][_0x58da2f]),'FaxQueueId':Number(_0x314150[_0x3ed2('0x4c')]['id'])});}}else{socket['emit'](_0x3ed2('0x83'),{'UserId':Number(_0x314150[_0x3ed2('0x37')][_0x3ed2('0x6c')]),'FaxQueueId':Number(_0x314150[_0x3ed2('0x4c')]['id'])});}});}})[_0x3ed2('0x29')](respondWithStatusCode(_0x202455,null))['catch'](handleError(_0x202455,null));};exports[_0x3ed2('0x88')]=function(_0x123e64,_0x39a42c,_0x32be47){var _0x52127d={};var _0x48cc2f={};var _0x2c3f40;var _0x101a1e;return db[_0x3ed2('0x33')][_0x3ed2('0x5a')]({'where':{'id':_0x123e64[_0x3ed2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x39a42c,null))['then'](function(_0x432fd8){if(_0x432fd8){_0x2c3f40=_0x432fd8;_0x48cc2f[_0x3ed2('0x3a')]=_[_0x3ed2('0x4d')](db[_0x3ed2('0x6d')][_0x3ed2('0x34')]);_0x48cc2f['query']=_[_0x3ed2('0x4d')](_0x123e64[_0x3ed2('0x37')]);_0x48cc2f[_0x3ed2('0x38')]=_[_0x3ed2('0x39')](_0x48cc2f[_0x3ed2('0x3a')],_0x48cc2f[_0x3ed2('0x37')]);_0x52127d['attributes']=_[_0x3ed2('0x39')](_0x48cc2f[_0x3ed2('0x3a')],qs[_0x3ed2('0x3b')](_0x123e64['query'][_0x3ed2('0x3b')]));_0x52127d[_0x3ed2('0x3c')]=_0x52127d[_0x3ed2('0x3c')]['length']?_0x52127d['attributes']:_0x48cc2f['model'];_0x52127d['order']=qs[_0x3ed2('0x41')](_0x123e64[_0x3ed2('0x37')][_0x3ed2('0x41')]);_0x52127d[_0x3ed2('0x42')]=qs[_0x3ed2('0x38')](_[_0x3ed2('0x43')](_0x123e64[_0x3ed2('0x37')],_0x48cc2f[_0x3ed2('0x38')]));if(_0x123e64[_0x3ed2('0x37')][_0x3ed2('0x45')]){_0x52127d['where']=_[_0x3ed2('0x4e')](_0x52127d[_0x3ed2('0x42')],{'$or':_[_0x3ed2('0x32')](_0x52127d['attributes'],function(_0x4df986){var _0x210186={};_0x210186[_0x4df986]={'$like':'%'+_0x123e64[_0x3ed2('0x37')][_0x3ed2('0x45')]+'%'};return _0x210186;})});}_0x52127d=_[_0x3ed2('0x4e')]({},_0x52127d,_0x123e64[_0x3ed2('0x46')]);return _0x2c3f40['getAgents'](_0x52127d);}})[_0x3ed2('0x29')](function(_0x3123d5){if(_0x3123d5){_0x101a1e=_0x3123d5['length'];if(!_0x123e64['query'][_0x3ed2('0x3e')](_0x3ed2('0x3f'))){_0x52127d['limit']=qs['limit'](_0x123e64[_0x3ed2('0x37')][_0x3ed2('0x24')]);_0x52127d[_0x3ed2('0x23')]=qs['offset'](_0x123e64['query']['offset']);}return _0x2c3f40['getAgents'](_0x52127d);}})['then'](function(_0x11bc31){if(_0x11bc31){return _0x11bc31?{'count':_0x101a1e,'rows':_0x11bc31}:null;}})[_0x3ed2('0x29')](respondWithResult(_0x39a42c,null))['catch'](handleError(_0x39a42c,null));}; \ No newline at end of file +var _0x34cd=['team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','keys','options','create','body','user','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','pick','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId'];(function(_0x53df1a,_0x388217){var _0x5ee595=function(_0xdee45e){while(--_0xdee45e){_0x53df1a['push'](_0x53df1a['shift']());}};_0x5ee595(++_0x388217);}(_0x34cd,0xa4));var _0xd34c=function(_0x2fd90a,_0x1c9116){_0x2fd90a=_0x2fd90a-0x0;var _0x4b2cf9=_0x34cd[_0x2fd90a];return _0x4b2cf9;};'use strict';var emlformat=require(_0xd34c('0x0'));var rimraf=require(_0xd34c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd34c('0x2'));var rp=require(_0xd34c('0x3'));var moment=require(_0xd34c('0x4'));var BPromise=require(_0xd34c('0x5'));var Mustache=require('mustache');var util=require(_0xd34c('0x6'));var path=require('path');var sox=require(_0xd34c('0x7'));var csv=require(_0xd34c('0x8'));var ejs=require(_0xd34c('0x9'));var fs=require('fs');var fs_extra=require(_0xd34c('0xa'));var _=require(_0xd34c('0xb'));var squel=require(_0xd34c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd34c('0xd'));var deskjs=require(_0xd34c('0xe'));var toCsv=require(_0xd34c('0x8'));var querystring=require(_0xd34c('0xf'));var Papa=require(_0xd34c('0x10'));var Redis=require(_0xd34c('0x11'));var authService=require(_0xd34c('0x12'));var qs=require(_0xd34c('0x13'));var as=require(_0xd34c('0x14'));var hardwareService=require(_0xd34c('0x15'));var logger=require('../../config/logger')(_0xd34c('0x16'));var utils=require(_0xd34c('0x17'));var config=require(_0xd34c('0x18'));var licenseUtil=require(_0xd34c('0x19'));var db=require(_0xd34c('0x1a'))['db'];config[_0xd34c('0x1b')]=_['defaults'](config[_0xd34c('0x1b')],{'host':_0xd34c('0x1c'),'port':0x18eb});var socket=require(_0xd34c('0x1d'))(new Redis(config['redis']));require(_0xd34c('0x1e'))[_0xd34c('0x1f')](socket);function respondWithStatusCode(_0x220c05,_0x5e0fea){_0x5e0fea=_0x5e0fea||0xcc;return function(_0x3b545f){if(_0x3b545f){return _0x220c05[_0xd34c('0x20')](_0x5e0fea);}return _0x220c05[_0xd34c('0x21')](_0x5e0fea)[_0xd34c('0x22')]();};}function respondWithResult(_0x1be984,_0x43d99b){_0x43d99b=_0x43d99b||0xc8;return function(_0x2c6b3f){if(_0x2c6b3f){return _0x1be984[_0xd34c('0x21')](_0x43d99b)[_0xd34c('0x23')](_0x2c6b3f);}};}function respondWithFilteredResult(_0x59dbe6,_0x275d20){return function(_0x4f1962){if(_0x4f1962){var _0x31d045=typeof _0x275d20[_0xd34c('0x24')]==='undefined'&&typeof _0x275d20[_0xd34c('0x25')]==='undefined';var _0x25e3be=_0x4f1962['count'];var _0x1cef62=_0x31d045?0x0:_0x275d20['offset'];var _0x331d92=_0x31d045?_0x4f1962['count']:_0x275d20['offset']+_0x275d20[_0xd34c('0x25')];var _0x2476a5;if(_0x331d92>=_0x25e3be){_0x331d92=_0x25e3be;_0x2476a5=0xc8;}else{_0x2476a5=0xce;}_0x59dbe6[_0xd34c('0x21')](_0x2476a5);return _0x59dbe6[_0xd34c('0x26')](_0xd34c('0x27'),_0x1cef62+'-'+_0x331d92+'/'+_0x25e3be)[_0xd34c('0x23')](_0x4f1962);}return null;};}function patchUpdates(_0x22578d){return function(_0x35e98e){try{jsonpatch[_0xd34c('0x28')](_0x35e98e,_0x22578d,!![]);}catch(_0x546a26){return BPromise['reject'](_0x546a26);}return _0x35e98e[_0xd34c('0x29')]();};}function saveUpdates(_0x55ddd6,_0x475a46){return function(_0x579e0e){if(_0x579e0e){return _0x579e0e[_0xd34c('0x2a')](_0x55ddd6)[_0xd34c('0x2b')](function(_0x361a49){return _0x361a49;});}return null;};}function removeEntity(_0x13bcce,_0x2d3d44){return function(_0x24f681){if(_0x24f681){return _0x24f681[_0xd34c('0x2c')]()[_0xd34c('0x2b')](function(){var _0x21f3b3=_0x24f681[_0xd34c('0x2d')]({'plain':!![]});var _0x52c897=_0xd34c('0x2e');return db[_0xd34c('0x2f')][_0xd34c('0x2c')]({'where':{'type':_0x52c897,'resourceId':_0x21f3b3['id']}})[_0xd34c('0x2b')](function(){return _0x24f681;});})[_0xd34c('0x2b')](function(){_0x13bcce[_0xd34c('0x21')](0xcc)[_0xd34c('0x22')]();});}};}function handleEntityNotFound(_0x5cba48,_0x26053a){return function(_0x2c1634){if(!_0x2c1634){_0x5cba48['sendStatus'](0x194);}return _0x2c1634;};}function handleError(_0x598c74,_0x3a0ce7){_0x3a0ce7=_0x3a0ce7||0x1f4;return function(_0x4b0136){logger['error'](_0x4b0136[_0xd34c('0x30')]);if(_0x4b0136[_0xd34c('0x31')]){delete _0x4b0136[_0xd34c('0x31')];}_0x598c74[_0xd34c('0x21')](_0x3a0ce7)[_0xd34c('0x32')](_0x4b0136);};}exports['index']=function(_0x3edf99,_0x2390f5){var _0x479d9d={},_0x4d0310={},_0x6b722d={'count':0x0,'rows':[]};var _0x1d85a2=_[_0xd34c('0x33')](db[_0xd34c('0x34')][_0xd34c('0x35')],function(_0x57067b){return{'name':_0x57067b[_0xd34c('0x36')],'type':_0x57067b[_0xd34c('0x37')][_0xd34c('0x38')]};});_0x4d0310['model']=_[_0xd34c('0x33')](_0x1d85a2,_0xd34c('0x31'));_0x4d0310[_0xd34c('0x39')]=_['keys'](_0x3edf99[_0xd34c('0x39')]);_0x4d0310[_0xd34c('0x3a')]=_[_0xd34c('0x3b')](_0x4d0310[_0xd34c('0x3c')],_0x4d0310[_0xd34c('0x39')]);_0x479d9d[_0xd34c('0x3d')]=_['intersection'](_0x4d0310['model'],qs[_0xd34c('0x3e')](_0x3edf99['query']['fields']));_0x479d9d[_0xd34c('0x3d')]=_0x479d9d[_0xd34c('0x3d')][_0xd34c('0x3f')]?_0x479d9d[_0xd34c('0x3d')]:_0x4d0310['model'];if(!_0x3edf99[_0xd34c('0x39')][_0xd34c('0x40')](_0xd34c('0x41'))){_0x479d9d[_0xd34c('0x25')]=qs['limit'](_0x3edf99['query']['limit']);_0x479d9d['offset']=qs[_0xd34c('0x24')](_0x3edf99['query'][_0xd34c('0x24')]);}_0x479d9d[_0xd34c('0x42')]=qs[_0xd34c('0x43')](_0x3edf99[_0xd34c('0x39')][_0xd34c('0x43')]);_0x479d9d['where']=qs[_0xd34c('0x3a')](_['pick'](_0x3edf99[_0xd34c('0x39')],_0x4d0310[_0xd34c('0x3a')]),_0x1d85a2);if(_0x3edf99[_0xd34c('0x39')][_0xd34c('0x44')]){_0x479d9d['where']=_[_0xd34c('0x45')](_0x479d9d[_0xd34c('0x46')],{'$or':_[_0xd34c('0x33')](_0x1d85a2,function(_0x3c97e9){if(_0x3c97e9[_0xd34c('0x37')]!==_0xd34c('0x47')){var _0x35a1f5={};_0x35a1f5[_0x3c97e9['name']]={'$like':'%'+_0x3edf99[_0xd34c('0x39')][_0xd34c('0x44')]+'%'};return _0x35a1f5;}})});}_0x479d9d=_[_0xd34c('0x45')]({},_0x479d9d,_0x3edf99['options']);var _0x4af3dd={'where':_0x479d9d[_0xd34c('0x46')]};return db[_0xd34c('0x34')][_0xd34c('0x48')](_0x4af3dd)[_0xd34c('0x2b')](function(_0x31c3bc){_0x6b722d['count']=_0x31c3bc;if(_0x3edf99[_0xd34c('0x39')][_0xd34c('0x49')]){_0x479d9d[_0xd34c('0x4a')]=[{'all':!![]}];}return db[_0xd34c('0x34')][_0xd34c('0x4b')](_0x479d9d);})['then'](function(_0x4a1770){_0x6b722d[_0xd34c('0x4c')]=_0x4a1770;return _0x6b722d;})[_0xd34c('0x2b')](respondWithFilteredResult(_0x2390f5,_0x479d9d))[_0xd34c('0x4d')](handleError(_0x2390f5,null));};exports['show']=function(_0x21a8a5,_0x24d933){var _0x292f73={'raw':!![],'where':{'id':_0x21a8a5[_0xd34c('0x4e')]['id']}},_0x1922c1={};_0x1922c1[_0xd34c('0x3c')]=_[_0xd34c('0x4f')](db['FaxQueue'][_0xd34c('0x35')]);_0x1922c1[_0xd34c('0x39')]=_['keys'](_0x21a8a5['query']);_0x1922c1[_0xd34c('0x3a')]=_[_0xd34c('0x3b')](_0x1922c1[_0xd34c('0x3c')],_0x1922c1[_0xd34c('0x39')]);_0x292f73[_0xd34c('0x3d')]=_['intersection'](_0x1922c1['model'],qs[_0xd34c('0x3e')](_0x21a8a5[_0xd34c('0x39')][_0xd34c('0x3e')]));_0x292f73[_0xd34c('0x3d')]=_0x292f73[_0xd34c('0x3d')][_0xd34c('0x3f')]?_0x292f73['attributes']:_0x1922c1[_0xd34c('0x3c')];if(_0x21a8a5[_0xd34c('0x39')][_0xd34c('0x49')]){_0x292f73[_0xd34c('0x4a')]=[{'all':!![]}];}_0x292f73=_[_0xd34c('0x45')]({},_0x292f73,_0x21a8a5[_0xd34c('0x50')]);return db[_0xd34c('0x34')]['find'](_0x292f73)[_0xd34c('0x2b')](handleEntityNotFound(_0x24d933,null))[_0xd34c('0x2b')](respondWithResult(_0x24d933,null))[_0xd34c('0x4d')](handleError(_0x24d933,null));};exports[_0xd34c('0x51')]=function(_0x4f1dae,_0x118630){return db[_0xd34c('0x34')][_0xd34c('0x51')](_0x4f1dae[_0xd34c('0x52')],{})[_0xd34c('0x2b')](function(_0x4abe39){var _0x2fb1dc=_0x4f1dae[_0xd34c('0x53')][_0xd34c('0x2d')]({'plain':!![]});if(!_0x2fb1dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fb1dc['role']===_0xd34c('0x53')){var _0x16937b=_0x4abe39[_0xd34c('0x2d')]({'plain':!![]});var _0x10b663='FaxQueues';return db[_0xd34c('0x54')][_0xd34c('0x55')]({'where':{'name':_0x10b663,'userProfileId':_0x2fb1dc['userProfileId']},'raw':!![]})[_0xd34c('0x2b')](function(_0x1077c9){if(_0x1077c9&&_0x1077c9['autoAssociation']===0x0){return db['UserProfileResource'][_0xd34c('0x51')]({'name':_0x16937b[_0xd34c('0x31')],'resourceId':_0x16937b['id'],'type':_0x1077c9[_0xd34c('0x31')],'sectionId':_0x1077c9['id']},{})['then'](function(){return _0x4abe39;});}else{return _0x4abe39;}})[_0xd34c('0x4d')](function(_0x2d4e49){logger[_0xd34c('0x56')](_0xd34c('0x57'),_0x2d4e49);throw _0x2d4e49;});}return _0x4abe39;})[_0xd34c('0x2b')](respondWithResult(_0x118630,0xc9))[_0xd34c('0x4d')](handleError(_0x118630,null));};exports['update']=function(_0x2735d8,_0x543504){if(_0x2735d8[_0xd34c('0x52')]['id']){delete _0x2735d8[_0xd34c('0x52')]['id'];}return db[_0xd34c('0x34')]['find']({'where':{'id':_0x2735d8[_0xd34c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x543504,null))[_0xd34c('0x2b')](saveUpdates(_0x2735d8['body'],null))[_0xd34c('0x2b')](respondWithResult(_0x543504,null))[_0xd34c('0x4d')](handleError(_0x543504,null));};exports[_0xd34c('0x2c')]=function(_0x4c112d,_0x11f70f){return db['FaxQueue'][_0xd34c('0x55')]({'where':{'id':_0x4c112d[_0xd34c('0x4e')]['id']}})[_0xd34c('0x2b')](handleEntityNotFound(_0x11f70f,null))[_0xd34c('0x2b')](removeEntity(_0x11f70f,null))[_0xd34c('0x4d')](handleError(_0x11f70f,null));};exports[_0xd34c('0x58')]=function(_0x2d96b9,_0x23749f){return db[_0xd34c('0x34')][_0xd34c('0x58')]()['then'](respondWithResult(_0x23749f,null))['catch'](handleError(_0x23749f,null));};exports[_0xd34c('0x59')]=function(_0xc422f6,_0x18015e,_0x555e55){var _0x3890f3={'raw':!![],'where':{}},_0x192996={},_0xee1e8f;return db[_0xd34c('0x34')][_0xd34c('0x5a')]({'where':{'id':_0xc422f6[_0xd34c('0x4e')]['id']}})[_0xd34c('0x2b')](handleEntityNotFound(_0x18015e,null))[_0xd34c('0x2b')](function(_0x5d1e6d){if(_0x5d1e6d){_0xee1e8f=_0x5d1e6d[_0xd34c('0x2d')]({'plain':!![]});_0x192996[_0xd34c('0x3c')]=_[_0xd34c('0x4f')](db[_0xd34c('0x5b')][_0xd34c('0x35')]);_0x192996[_0xd34c('0x39')]=_[_0xd34c('0x4f')](_0xc422f6['query']);_0x192996[_0xd34c('0x3a')]=_[_0xd34c('0x3b')](_0x192996[_0xd34c('0x3c')],_0x192996[_0xd34c('0x39')]);_0x3890f3[_0xd34c('0x3d')]=_[_0xd34c('0x3b')](_0x192996[_0xd34c('0x3c')],qs['fields'](_0xc422f6[_0xd34c('0x39')]['fields']));_0x3890f3['attributes']=_0x3890f3[_0xd34c('0x3d')][_0xd34c('0x3f')]?_0x3890f3[_0xd34c('0x3d')]:_0x192996[_0xd34c('0x3c')];if(!_0xc422f6[_0xd34c('0x39')][_0xd34c('0x40')]('nolimit')){_0x3890f3[_0xd34c('0x25')]=qs[_0xd34c('0x25')](_0xc422f6[_0xd34c('0x39')][_0xd34c('0x25')]);_0x3890f3['offset']=qs[_0xd34c('0x24')](_0xc422f6['query'][_0xd34c('0x24')]);}_0x3890f3[_0xd34c('0x42')]=qs[_0xd34c('0x43')](_0xc422f6['query'][_0xd34c('0x43')]);_0x3890f3[_0xd34c('0x46')]=qs[_0xd34c('0x3a')](_[_0xd34c('0x5c')](_0xc422f6['query'],_0x192996[_0xd34c('0x3a')]));_0x3890f3[_0xd34c('0x46')][_0xd34c('0x5d')]=_0x5d1e6d['id'];if(_0xc422f6[_0xd34c('0x39')][_0xd34c('0x44')]){_0x3890f3['where']=_[_0xd34c('0x45')](_0x3890f3['where'],{'$or':_[_0xd34c('0x33')](_0x3890f3[_0xd34c('0x3d')],function(_0xd54152){var _0x3d8ffc={};_0x3d8ffc[_0xd54152]={'$like':'%'+_0xc422f6[_0xd34c('0x39')][_0xd34c('0x44')]+'%'};return _0x3d8ffc;})});}_0x3890f3=_[_0xd34c('0x45')]({},_0x3890f3,_0xc422f6[_0xd34c('0x50')]);return db[_0xd34c('0x5b')][_0xd34c('0x4b')](_0x3890f3);}})[_0xd34c('0x2b')](function(_0x399a17){if(_0x399a17){return db[_0xd34c('0x5e')][_0xd34c('0x5f')]({'where':{'id':_[_0xd34c('0x33')](_0x399a17,_0xd34c('0x60')),'role':_0xd34c('0x61')},'attributes':['id',_0xd34c('0x31'),_0xd34c('0x62'),_0xd34c('0x63'),_0xd34c('0x64')]});}})[_0xd34c('0x2b')](function(_0x5c6287){if(_0x5c6287){return{'count':_0x5c6287['count'],'rows':_[_0xd34c('0x33')](_0x5c6287[_0xd34c('0x4c')],function(_0x1f20fa){return{'membername':_0x1f20fa[_0xd34c('0x31')],'UserId':_0x1f20fa['id'],'queue_name':_0xee1e8f[_0xd34c('0x31')],'FaxQueueId':_0xee1e8f['id'],'interface':util[_0xd34c('0x65')]('%s/%s',_0xd34c('0x66'),_0x1f20fa[_0xd34c('0x31')]),'penalty':0x0,'paused':_0x1f20fa[_0xd34c('0x62')],'createdAt':_0x1f20fa['createdAt'],'updatedAt':_0x1f20fa['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd34c('0x2b')](respondWithFilteredResult(_0x18015e,_0x3890f3))[_0xd34c('0x4d')](handleError(_0x18015e,null));};exports[_0xd34c('0x67')]=function(_0x110946,_0x43cfed,_0x598cbd){var _0x2dd3c9={};var _0x4fbd78={};var _0x571bad;var _0xc1b7d0;return db[_0xd34c('0x34')][_0xd34c('0x5a')]({'where':{'id':_0x110946[_0xd34c('0x4e')]['id']}})[_0xd34c('0x2b')](handleEntityNotFound(_0x43cfed,null))['then'](function(_0xcac09a){if(_0xcac09a){_0x571bad=_0xcac09a;_0x4fbd78['model']=_[_0xd34c('0x4f')](db[_0xd34c('0x68')][_0xd34c('0x35')]);_0x4fbd78[_0xd34c('0x39')]=_[_0xd34c('0x4f')](_0x110946[_0xd34c('0x39')]);_0x4fbd78[_0xd34c('0x3a')]=_['intersection'](_0x4fbd78[_0xd34c('0x3c')],_0x4fbd78[_0xd34c('0x39')]);_0x2dd3c9['attributes']=_['intersection'](_0x4fbd78[_0xd34c('0x3c')],qs[_0xd34c('0x3e')](_0x110946[_0xd34c('0x39')][_0xd34c('0x3e')]));_0x2dd3c9[_0xd34c('0x3d')]=_0x2dd3c9['attributes'][_0xd34c('0x3f')]?_0x2dd3c9[_0xd34c('0x3d')]:_0x4fbd78[_0xd34c('0x3c')];_0x2dd3c9[_0xd34c('0x42')]=qs['sort'](_0x110946[_0xd34c('0x39')][_0xd34c('0x43')]);_0x2dd3c9[_0xd34c('0x46')]=qs[_0xd34c('0x3a')](_[_0xd34c('0x5c')](_0x110946[_0xd34c('0x39')],_0x4fbd78[_0xd34c('0x3a')]));if(_0x110946[_0xd34c('0x39')][_0xd34c('0x44')]){_0x2dd3c9[_0xd34c('0x46')]=_['merge'](_0x2dd3c9[_0xd34c('0x46')],{'$or':_[_0xd34c('0x33')](_0x2dd3c9[_0xd34c('0x3d')],function(_0x5ea68f){var _0x26170e={};_0x26170e[_0x5ea68f]={'$like':'%'+_0x110946['query']['filter']+'%'};return _0x26170e;})});}_0x2dd3c9=_[_0xd34c('0x45')]({},_0x2dd3c9,_0x110946[_0xd34c('0x50')]);return _0x571bad[_0xd34c('0x67')](_0x2dd3c9);}})[_0xd34c('0x2b')](function(_0x2f7e64){if(_0x2f7e64){_0xc1b7d0=_0x2f7e64[_0xd34c('0x3f')];if(!_0x110946[_0xd34c('0x39')][_0xd34c('0x40')]('nolimit')){_0x2dd3c9[_0xd34c('0x25')]=qs[_0xd34c('0x25')](_0x110946[_0xd34c('0x39')][_0xd34c('0x25')]);_0x2dd3c9['offset']=qs[_0xd34c('0x24')](_0x110946[_0xd34c('0x39')]['offset']);}return _0x571bad[_0xd34c('0x67')](_0x2dd3c9);}})[_0xd34c('0x2b')](function(_0x57054b){if(_0x57054b){return _0x57054b?{'count':_0xc1b7d0,'rows':_0x57054b}:null;}})[_0xd34c('0x2b')](respondWithResult(_0x43cfed,null))[_0xd34c('0x4d')](handleError(_0x43cfed,null));};exports[_0xd34c('0x69')]=function(_0x2c89f8,_0x4d228b,_0x29f672){var _0x225b7f=_0x2c89f8[_0xd34c('0x52')][_0xd34c('0x6a')];return db[_0xd34c('0x68')][_0xd34c('0x4b')]({'where':{'id':_0x225b7f},'attributes':['id'],'include':[{'model':db[_0xd34c('0x5e')],'as':_0xd34c('0x6b'),'attributes':['id','name',_0xd34c('0x6c'),'voicePause',_0xd34c('0x6d')],'raw':!![]}]})['then'](function(_0x477258){if(_0x477258){var _0x3feaab=_[_0xd34c('0x6e')](_0x477258,function(_0x53a10c){var _0x52110a=_0x53a10c['get']({'plain':!![]});return _0x52110a['Agents'];});return db[_0xd34c('0x34')]['find']({'where':{'id':_0x2c89f8[_0xd34c('0x4e')]['id']}})[_0xd34c('0x2b')](function(_0x16037d){return db[_0xd34c('0x6f')]['transaction'](function(_0x2c1043){return _0x16037d[_0xd34c('0x69')](_0x225b7f,{'transaction':_0x2c1043})[_0xd34c('0x2b')](function(){return BPromise['each'](_0x3feaab,function(_0x591b04){return db[_0xd34c('0x5b')][_0xd34c('0x70')]({'where':{'UserId':_0x591b04['id'],'FaxQueueId':_0x2c89f8[_0xd34c('0x4e')]['id']},'transaction':_0x2c1043});});})['then'](function(){_0x3feaab[_0xd34c('0x71')](function(_0x1aea40){socket[_0xd34c('0x72')](_0xd34c('0x73'),{'UserId':_0x1aea40['id'],'FaxQueueId':_0x16037d['id']});});});});});}})[_0xd34c('0x2b')](respondWithStatusCode(_0x4d228b,null))[_0xd34c('0x4d')](handleError(_0x4d228b,null));};exports[_0xd34c('0x74')]=function(_0x117c7d,_0x580414,_0x16974b){return db[_0xd34c('0x68')][_0xd34c('0x4b')]({'where':{'id':_0x117c7d[_0xd34c('0x39')][_0xd34c('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xd34c('0x5e')],'as':_0xd34c('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xd34c('0x2b')](handleEntityNotFound(_0x580414,null))[_0xd34c('0x2b')](function(_0x44380c){var _0x5d7c84=_['map'](_0x44380c,'id');var _0x66ecdd=[];var _0x50085e=[];var _0x551e7a=squel[_0xd34c('0x75')]();_0x551e7a[_0xd34c('0x76')](_0xd34c('0x77'))['from'](_0xd34c('0x78'),'tq')[_0xd34c('0x79')]('user_has_teams','ut',_0xd34c('0x7a'))[_0xd34c('0x46')]('FaxQueueId\x20=\x20?',_0x117c7d[_0xd34c('0x4e')]['id']);for(var _0x5bcdc5=0x0;_0x5bcdc5<_0x44380c['length'];_0x5bcdc5+=0x1){let _0x4bb52c=_0x44380c[_0x5bcdc5];for(var _0x5ab19a=0x0;_0x5ab19a<_0x4bb52c[_0xd34c('0x6b')][_0xd34c('0x3f')];_0x5ab19a+=0x1){let _0x457278=_0x4bb52c[_0xd34c('0x6b')][_0x5ab19a];var _0x44c9c0=_0x551e7a[_0xd34c('0x7b')]();_0x44c9c0[_0xd34c('0x46')](_0xd34c('0x7c'),_0x457278['id']);_0x50085e[_0xd34c('0x7d')](db['sequelize'][_0xd34c('0x39')](_0x44c9c0[_0xd34c('0x7e')](),{'type':db[_0xd34c('0x6f')][_0xd34c('0x7f')]['SELECT']})[_0xd34c('0x2b')](function(_0x62a713){if(_0x62a713['length']===0x1){return _0x457278['id'];}else{var _0x396ee4=_[_0xd34c('0x80')](_[_0xd34c('0x33')](_0x62a713,_0xd34c('0x81')),function(_0x99fb4c){return _[_0xd34c('0x82')](_0x5d7c84,_0x99fb4c);});if(_0x396ee4){return _0x457278['id'];}}}));}}return BPromise[_0xd34c('0x83')](_0x50085e)['then'](function(_0x2c03c1){_0x66ecdd=_(_0x66ecdd)[_0xd34c('0x84')](_0x2c03c1)[_0xd34c('0x85')]()['value']();return db[_0xd34c('0x34')][_0xd34c('0x55')]({'where':{'id':_0x117c7d[_0xd34c('0x4e')]['id']}})['then'](function(_0x359fd4){return db[_0xd34c('0x6f')][_0xd34c('0x86')](function(_0x59b746){return _0x359fd4[_0xd34c('0x74')](_0x117c7d['query']['ids'],{'transaction':_0x59b746})[_0xd34c('0x2b')](function(){if(!_[_0xd34c('0x87')](_0x66ecdd)){return _0x359fd4[_0xd34c('0x88')](_0x66ecdd,{'transaction':_0x59b746});}})[_0xd34c('0x2b')](function(){_0x66ecdd[_0xd34c('0x71')](function(_0x4bcb28){socket[_0xd34c('0x72')](_0xd34c('0x89'),{'UserId':_0x4bcb28,'FaxQueueId':_0x359fd4['id']});});});});});});})['then'](respondWithStatusCode(_0x580414,null))[_0xd34c('0x4d')](handleError(_0x580414,null));};exports[_0xd34c('0x8a')]=function(_0x3075e2,_0x5260d0,_0x662b8b){return db[_0xd34c('0x34')][_0xd34c('0x55')]({'where':{'id':_0x3075e2[_0xd34c('0x4e')]['id']}})[_0xd34c('0x2b')](handleEntityNotFound(_0x5260d0,null))[_0xd34c('0x2b')](function(_0x1a76cd){if(_0x1a76cd){return _0x1a76cd['addAgents'](_0x3075e2[_0xd34c('0x52')][_0xd34c('0x6a')],_[_0xd34c('0x8b')](_0x3075e2[_0xd34c('0x52')],['ids','id'])||{})[_0xd34c('0x8c')](function(_0x19e9b9){for(var _0x22f540=0x0;_0x22f540<_0x3075e2[_0xd34c('0x52')][_0xd34c('0x6a')][_0xd34c('0x3f')];_0x22f540+=0x1){socket[_0xd34c('0x72')](_0xd34c('0x73'),{'UserId':Number(_0x3075e2[_0xd34c('0x52')][_0xd34c('0x6a')][_0x22f540]),'FaxQueueId':Number(_0x3075e2['params']['id'])});}return _0x19e9b9;});}})[_0xd34c('0x2b')](respondWithResult(_0x5260d0,null))['catch'](handleError(_0x5260d0,null));};exports[_0xd34c('0x88')]=function(_0x512b48,_0x46861b,_0x2bad65){return db[_0xd34c('0x34')][_0xd34c('0x55')]({'where':{'id':_0x512b48[_0xd34c('0x4e')]['id']}})[_0xd34c('0x2b')](handleEntityNotFound(_0x46861b,null))[_0xd34c('0x2b')](function(_0x4d91b0){if(_0x4d91b0){return _0x4d91b0['removeAgents'](_0x512b48[_0xd34c('0x39')]['ids'])['then'](function(){if(_['isArray'](_0x512b48[_0xd34c('0x39')][_0xd34c('0x6a')])){for(var _0x2f03d5=0x0;_0x2f03d5<_0x512b48[_0xd34c('0x39')][_0xd34c('0x6a')]['length'];_0x2f03d5+=0x1){socket[_0xd34c('0x72')](_0xd34c('0x89'),{'UserId':Number(_0x512b48['query']['ids'][_0x2f03d5]),'FaxQueueId':Number(_0x512b48[_0xd34c('0x4e')]['id'])});}}else{socket['emit'](_0xd34c('0x89'),{'UserId':Number(_0x512b48[_0xd34c('0x39')]['ids']),'FaxQueueId':Number(_0x512b48['params']['id'])});}});}})[_0xd34c('0x2b')](respondWithStatusCode(_0x46861b,null))[_0xd34c('0x4d')](handleError(_0x46861b,null));};exports[_0xd34c('0x8d')]=function(_0x523730,_0x4db67e,_0x461d89){var _0x2bd9bd={};var _0x9f18e9={};var _0x2a37a7;var _0xa12b48;return db[_0xd34c('0x34')][_0xd34c('0x5a')]({'where':{'id':_0x523730[_0xd34c('0x4e')]['id']}})[_0xd34c('0x2b')](handleEntityNotFound(_0x4db67e,null))[_0xd34c('0x2b')](function(_0x9f96b1){if(_0x9f96b1){_0x2a37a7=_0x9f96b1;_0x9f18e9[_0xd34c('0x3c')]=_[_0xd34c('0x4f')](db['User'][_0xd34c('0x35')]);_0x9f18e9['query']=_[_0xd34c('0x4f')](_0x523730[_0xd34c('0x39')]);_0x9f18e9['filters']=_[_0xd34c('0x3b')](_0x9f18e9['model'],_0x9f18e9[_0xd34c('0x39')]);_0x2bd9bd['attributes']=_['intersection'](_0x9f18e9[_0xd34c('0x3c')],qs['fields'](_0x523730[_0xd34c('0x39')]['fields']));_0x2bd9bd[_0xd34c('0x3d')]=_0x2bd9bd[_0xd34c('0x3d')]['length']?_0x2bd9bd[_0xd34c('0x3d')]:_0x9f18e9['model'];_0x2bd9bd[_0xd34c('0x42')]=qs['sort'](_0x523730[_0xd34c('0x39')]['sort']);_0x2bd9bd[_0xd34c('0x46')]=qs['filters'](_[_0xd34c('0x5c')](_0x523730[_0xd34c('0x39')],_0x9f18e9[_0xd34c('0x3a')]));if(_0x523730[_0xd34c('0x39')][_0xd34c('0x44')]){_0x2bd9bd[_0xd34c('0x46')]=_[_0xd34c('0x45')](_0x2bd9bd[_0xd34c('0x46')],{'$or':_[_0xd34c('0x33')](_0x2bd9bd[_0xd34c('0x3d')],function(_0x554162){var _0x377ce9={};_0x377ce9[_0x554162]={'$like':'%'+_0x523730[_0xd34c('0x39')][_0xd34c('0x44')]+'%'};return _0x377ce9;})});}_0x2bd9bd=_[_0xd34c('0x45')]({},_0x2bd9bd,_0x523730[_0xd34c('0x50')]);return _0x2a37a7[_0xd34c('0x8d')](_0x2bd9bd);}})[_0xd34c('0x2b')](function(_0x5d0f93){if(_0x5d0f93){_0xa12b48=_0x5d0f93[_0xd34c('0x3f')];if(!_0x523730['query']['hasOwnProperty'](_0xd34c('0x41'))){_0x2bd9bd[_0xd34c('0x25')]=qs['limit'](_0x523730[_0xd34c('0x39')][_0xd34c('0x25')]);_0x2bd9bd[_0xd34c('0x24')]=qs[_0xd34c('0x24')](_0x523730['query'][_0xd34c('0x24')]);}return _0x2a37a7[_0xd34c('0x8d')](_0x2bd9bd);}})[_0xd34c('0x2b')](function(_0xa45e1d){if(_0xa45e1d){return _0xa45e1d?{'count':_0xa12b48,'rows':_0xa45e1d}:null;}})[_0xd34c('0x2b')](respondWithResult(_0x4db67e,null))[_0xd34c('0x4d')](handleError(_0x4db67e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ae888dc..ba89651 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 _0xc3cc=['events','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0xc3cc,0x1ce));var _0xcc3c=function(_0x23e02e,_0x4d26cb){_0x23e02e=_0x23e02e-0x0;var _0x2a6db8=_0xc3cc[_0x23e02e];return _0x2a6db8;};'use strict';var EventEmitter=require(_0xcc3c('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc3c('0x1'),'afterUpdate':_0xcc3c('0x2'),'afterDestroy':_0xcc3c('0x3')};function emitEvent(_0x565db9){return function(_0x24caaa,_0x4a7c1e,_0x3d48c2){FaxQueueEvents[_0xcc3c('0x4')](_0x565db9+':'+_0x24caaa['id'],_0x24caaa);FaxQueueEvents[_0xcc3c('0x4')](_0x565db9,_0x24caaa);_0x3d48c2(null);};}for(var e in events){if(events[_0xcc3c('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xcc3c('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x9c39=['remove','emit','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x2531fb,_0x1075f6){var _0x3afcc2=function(_0x5b644f){while(--_0x5b644f){_0x2531fb['push'](_0x2531fb['shift']());}};_0x3afcc2(++_0x1075f6);}(_0x9c39,0xb8));var _0x99c3=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x9c39[_0xfcbcb8];return _0x1b1f97;};'use strict';var EventEmitter=require(_0x99c3('0x0'));var FaxQueue=require(_0x99c3('0x1'))['db'][_0x99c3('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x99c3('0x3')](0x0);var events={'afterCreate':_0x99c3('0x4'),'afterUpdate':'update','afterDestroy':_0x99c3('0x5')};function emitEvent(_0xaaabf9){return function(_0x1cc03d,_0x37c48d,_0x2578ee){FaxQueueEvents[_0x99c3('0x6')](_0xaaabf9+':'+_0x1cc03d['id'],_0x1cc03d);FaxQueueEvents[_0x99c3('0x6')](_0xaaabf9,_0x1cc03d);_0x2578ee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x99c3('0x7')](e,emitEvent(event));}}module[_0x99c3('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index b856f57..61ba9c5 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 _0xe413=['fax_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x36790f,_0x46a2c6){var _0x36103b=function(_0x1e0dec){while(--_0x1e0dec){_0x36790f['push'](_0x36790f['shift']());}};_0x36103b(++_0x46a2c6);}(_0xe413,0x9d));var _0x3e41=function(_0x95d9e9,_0x1754f7){_0x95d9e9=_0x95d9e9-0x0;var _0x5013a1=_0xe413[_0x95d9e9];return _0x5013a1;};'use strict';var _=require('lodash');var util=require(_0x3e41('0x0'));var logger=require('../../config/logger')(_0x3e41('0x1'));var moment=require(_0x3e41('0x2'));var BPromise=require(_0x3e41('0x3'));var rp=require(_0x3e41('0x4'));var fs=require('fs');var path=require(_0x3e41('0x5'));var rimraf=require(_0x3e41('0x6'));var config=require(_0x3e41('0x7'));var attributes=require(_0x3e41('0x8'));module[_0x3e41('0x9')]=function(_0x2610bd,_0x48006e){return _0x2610bd[_0x3e41('0xa')](_0x3e41('0xb'),attributes,{'tableName':_0x3e41('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6005=['request-promise','rimraf','../../config/environment','./faxQueue.attributes','define','fax_queues','lodash','api','moment','bluebird'];(function(_0x5e7457,_0x5f2447){var _0x131937=function(_0x598227){while(--_0x598227){_0x5e7457['push'](_0x5e7457['shift']());}};_0x131937(++_0x5f2447);}(_0x6005,0x6a));var _0x5600=function(_0x746fce,_0xa31110){_0x746fce=_0x746fce-0x0;var _0x197ac0=_0x6005[_0x746fce];return _0x197ac0;};'use strict';var _=require(_0x5600('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5600('0x1'));var moment=require(_0x5600('0x2'));var BPromise=require(_0x5600('0x3'));var rp=require(_0x5600('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5600('0x5'));var config=require(_0x5600('0x6'));var attributes=require(_0x5600('0x7'));module['exports']=function(_0x41f2c2,_0x19fe73){return _0x41f2c2[_0x5600('0x8')]('FaxQueue',attributes,{'tableName':_0x5600('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 54ff94d..256ee67 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 _0x0bb4=['register','request','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','debug','ShowFaxQueue','find','raw','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','defaults','redis','./faxQueue.socket'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0x0bb4,0x7e));var _0x40bb=function(_0x412e09,_0x491e8d){_0x412e09=_0x412e09-0x0;var _0x55b506=_0x0bb4[_0x412e09];return _0x55b506;};'use strict';var _=require(_0x40bb('0x0'));var util=require(_0x40bb('0x1'));var moment=require('moment');var BPromise=require(_0x40bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40bb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x40bb('0x4'))('rpc');var config=require(_0x40bb('0x5'));var jayson=require(_0x40bb('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x40bb('0x7')](config[_0x40bb('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40bb('0x8')]));require(_0x40bb('0x9'))[_0x40bb('0xa')](socket);function respondWithRpcPromise(_0x1e8112,_0x2156af,_0x2496ec){return new BPromise(function(_0x1be62f,_0x6bbf1){return client[_0x40bb('0xb')](_0x1e8112,_0x2496ec)['then'](function(_0x11e4e8){logger['info']('FaxQueue,\x20%s,\x20%s',_0x2156af,_0x40bb('0xc'));logger['debug'](_0x40bb('0xd'),_0x2156af,'request\x20sent',JSON[_0x40bb('0xe')](_0x11e4e8));if(_0x11e4e8[_0x40bb('0xf')]){if(_0x11e4e8['error']['code']===0x1f4){logger[_0x40bb('0xf')](_0x40bb('0x10'),_0x2156af,_0x11e4e8[_0x40bb('0xf')][_0x40bb('0x11')]);return _0x6bbf1(_0x11e4e8[_0x40bb('0xf')][_0x40bb('0x11')]);}logger[_0x40bb('0xf')]('FaxQueue,\x20%s,\x20%s',_0x2156af,_0x11e4e8[_0x40bb('0xf')]['message']);return _0x1be62f(_0x11e4e8['error'][_0x40bb('0x11')]);}else{logger['info'](_0x40bb('0x10'),_0x2156af,_0x40bb('0xc'));_0x1be62f(_0x11e4e8[_0x40bb('0x12')][_0x40bb('0x11')]);}})[_0x40bb('0x13')](function(_0x89b035){logger[_0x40bb('0xf')](_0x40bb('0x10'),_0x2156af,_0x89b035);_0x6bbf1(_0x89b035);});});}exports[_0x40bb('0x14')]=function(_0x47dfac){var _0x5537ef=this;return new Promise(function(_0x910e45,_0xbfe893){return db[_0x40bb('0x15')][_0x40bb('0x16')]({'raw':_0x47dfac[_0x40bb('0x17')]?_0x47dfac[_0x40bb('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x47dfac[_0x40bb('0x17')]?_0x47dfac[_0x40bb('0x17')][_0x40bb('0x18')]||null:null,'attributes':_0x47dfac[_0x40bb('0x17')]?_0x47dfac[_0x40bb('0x17')][_0x40bb('0x19')]||null:null,'limit':_0x47dfac[_0x40bb('0x17')]?_0x47dfac['options'][_0x40bb('0x1a')]||null:null,'include':_0x47dfac[_0x40bb('0x17')]?_0x47dfac[_0x40bb('0x17')][_0x40bb('0x1b')]?_['map'](_0x47dfac['options'][_0x40bb('0x1b')],function(_0xadbebe){return{'model':db[_0xadbebe['model']],'as':_0xadbebe['as'],'attributes':_0xadbebe[_0x40bb('0x19')],'include':_0xadbebe[_0x40bb('0x1b')]?_[_0x40bb('0x1c')](_0xadbebe['include'],function(_0x2f3176){return{'model':db[_0x2f3176['model']],'as':_0x2f3176['as'],'attributes':_0x2f3176[_0x40bb('0x19')],'include':_0x2f3176[_0x40bb('0x1b')]?_['map'](_0x2f3176['include'],function(_0x15f652){return{'model':db[_0x15f652[_0x40bb('0x1d')]],'as':_0x15f652['as'],'attributes':_0x15f652[_0x40bb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x75a677){logger['info'](_0x40bb('0x14'),_0x47dfac);logger[_0x40bb('0x1e')](_0x40bb('0x14'),_0x47dfac,JSON[_0x40bb('0xe')](_0x75a677));_0x910e45(_0x75a677);})[_0x40bb('0x13')](function(_0x554228){logger[_0x40bb('0xf')]('GetFaxQueue',_0x554228[_0x40bb('0x11')],_0x47dfac);_0xbfe893(_0x5537ef[_0x40bb('0xf')](0x1f4,_0x554228[_0x40bb('0x11')]));});});};exports[_0x40bb('0x1f')]=function(_0x3d2b90){var _0x5c1ffa=this;return new Promise(function(_0x52628b,_0x2757ef){return db[_0x40bb('0x15')][_0x40bb('0x20')]({'raw':_0x3d2b90[_0x40bb('0x17')]?_0x3d2b90[_0x40bb('0x17')][_0x40bb('0x21')]===undefined?!![]:![]:!![],'where':_0x3d2b90['options']?_0x3d2b90['options'][_0x40bb('0x18')]||null:null,'attributes':_0x3d2b90[_0x40bb('0x17')]?_0x3d2b90[_0x40bb('0x17')]['attributes']||null:null,'include':_0x3d2b90[_0x40bb('0x17')]?_0x3d2b90['options'][_0x40bb('0x1b')]?_[_0x40bb('0x1c')](_0x3d2b90[_0x40bb('0x17')][_0x40bb('0x1b')],function(_0x195717){return{'model':db[_0x195717[_0x40bb('0x1d')]],'as':_0x195717['as'],'attributes':_0x195717[_0x40bb('0x19')],'include':_0x195717[_0x40bb('0x1b')]?_[_0x40bb('0x1c')](_0x195717['include'],function(_0x2aa809){return{'model':db[_0x2aa809[_0x40bb('0x1d')]],'as':_0x2aa809['as'],'attributes':_0x2aa809['attributes'],'include':_0x2aa809[_0x40bb('0x1b')]?_[_0x40bb('0x1c')](_0x2aa809['include'],function(_0x2d78a7){return{'model':db[_0x2d78a7[_0x40bb('0x1d')]],'as':_0x2d78a7['as'],'attributes':_0x2d78a7[_0x40bb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30a6b5){logger['info'](_0x40bb('0x1f'),_0x3d2b90);logger[_0x40bb('0x1e')]('ShowFaxQueue',_0x3d2b90,JSON[_0x40bb('0xe')](_0x30a6b5));_0x52628b(_0x30a6b5);})['catch'](function(_0x24271d){logger[_0x40bb('0xf')](_0x40bb('0x1f'),_0x24271d['message'],_0x3d2b90);_0x2757ef(_0x5c1ffa[_0x40bb('0xf')](0x1f4,_0x24271d[_0x40bb('0x11')]));});});}; \ No newline at end of file +var _0x0e3c=['redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','find','ShowFaxQueue','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x18109d,_0x39b36a){var _0xabeaea=function(_0x7457aa){while(--_0x7457aa){_0x18109d['push'](_0x18109d['shift']());}};_0xabeaea(++_0x39b36a);}(_0x0e3c,0x128));var _0xc0e3=function(_0x5daa15,_0x57c7d7){_0x5daa15=_0x5daa15-0x0;var _0x2a1fbe=_0x0e3c[_0x5daa15];return _0x2a1fbe;};'use strict';var _=require('lodash');var util=require(_0xc0e3('0x0'));var moment=require(_0xc0e3('0x1'));var BPromise=require('bluebird');var rs=require(_0xc0e3('0x2'));var fs=require('fs');var Redis=require(_0xc0e3('0x3'));var db=require(_0xc0e3('0x4'))['db'];var utils=require(_0xc0e3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc0e3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc0e3('0x7')]['http']({'port':0x232a});config[_0xc0e3('0x8')]=_[_0xc0e3('0x9')](config[_0xc0e3('0x8')],{'host':_0xc0e3('0xa'),'port':0x18eb});var socket=require(_0xc0e3('0xb'))(new Redis(config[_0xc0e3('0x8')]));require(_0xc0e3('0xc'))[_0xc0e3('0xd')](socket);function respondWithRpcPromise(_0x5ee5e0,_0x3446bb,_0x244904){return new BPromise(function(_0x334109,_0x542169){return client[_0xc0e3('0xe')](_0x5ee5e0,_0x244904)[_0xc0e3('0xf')](function(_0x4cc097){logger['info'](_0xc0e3('0x10'),_0x3446bb,_0xc0e3('0x11'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3446bb,'request\x20sent',JSON['stringify'](_0x4cc097));if(_0x4cc097[_0xc0e3('0x12')]){if(_0x4cc097[_0xc0e3('0x12')][_0xc0e3('0x13')]===0x1f4){logger[_0xc0e3('0x12')]('FaxQueue,\x20%s,\x20%s',_0x3446bb,_0x4cc097[_0xc0e3('0x12')][_0xc0e3('0x14')]);return _0x542169(_0x4cc097[_0xc0e3('0x12')][_0xc0e3('0x14')]);}logger['error'](_0xc0e3('0x10'),_0x3446bb,_0x4cc097[_0xc0e3('0x12')][_0xc0e3('0x14')]);return _0x334109(_0x4cc097[_0xc0e3('0x12')][_0xc0e3('0x14')]);}else{logger[_0xc0e3('0x15')](_0xc0e3('0x10'),_0x3446bb,_0xc0e3('0x11'));_0x334109(_0x4cc097[_0xc0e3('0x16')][_0xc0e3('0x14')]);}})[_0xc0e3('0x17')](function(_0x57c634){logger[_0xc0e3('0x12')](_0xc0e3('0x10'),_0x3446bb,_0x57c634);_0x542169(_0x57c634);});});}exports[_0xc0e3('0x18')]=function(_0x45e582){var _0x19543f=this;return new Promise(function(_0x16d115,_0x444697){return db['FaxQueue'][_0xc0e3('0x19')]({'raw':_0x45e582[_0xc0e3('0x1a')]?_0x45e582[_0xc0e3('0x1a')][_0xc0e3('0x1b')]===undefined?!![]:![]:!![],'where':_0x45e582[_0xc0e3('0x1a')]?_0x45e582['options'][_0xc0e3('0x1c')]||null:null,'attributes':_0x45e582[_0xc0e3('0x1a')]?_0x45e582['options'][_0xc0e3('0x1d')]||null:null,'limit':_0x45e582[_0xc0e3('0x1a')]?_0x45e582[_0xc0e3('0x1a')][_0xc0e3('0x1e')]||null:null,'include':_0x45e582[_0xc0e3('0x1a')]?_0x45e582['options'][_0xc0e3('0x1f')]?_['map'](_0x45e582[_0xc0e3('0x1a')][_0xc0e3('0x1f')],function(_0x377c81){return{'model':db[_0x377c81[_0xc0e3('0x20')]],'as':_0x377c81['as'],'attributes':_0x377c81[_0xc0e3('0x1d')],'include':_0x377c81[_0xc0e3('0x1f')]?_[_0xc0e3('0x21')](_0x377c81[_0xc0e3('0x1f')],function(_0x31855f){return{'model':db[_0x31855f[_0xc0e3('0x20')]],'as':_0x31855f['as'],'attributes':_0x31855f[_0xc0e3('0x1d')],'include':_0x31855f[_0xc0e3('0x1f')]?_[_0xc0e3('0x21')](_0x31855f[_0xc0e3('0x1f')],function(_0x25702b){return{'model':db[_0x25702b[_0xc0e3('0x20')]],'as':_0x25702b['as'],'attributes':_0x25702b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x533f24){logger['info'](_0xc0e3('0x18'),_0x45e582);logger[_0xc0e3('0x22')](_0xc0e3('0x18'),_0x45e582,JSON['stringify'](_0x533f24));_0x16d115(_0x533f24);})[_0xc0e3('0x17')](function(_0x116c4a){logger[_0xc0e3('0x12')](_0xc0e3('0x18'),_0x116c4a[_0xc0e3('0x14')],_0x45e582);_0x444697(_0x19543f['error'](0x1f4,_0x116c4a['message']));});});};exports['ShowFaxQueue']=function(_0x25a46d){var _0x53f086=this;return new Promise(function(_0x118871,_0x5af28d){return db['FaxQueue'][_0xc0e3('0x23')]({'raw':_0x25a46d[_0xc0e3('0x1a')]?_0x25a46d['options'][_0xc0e3('0x1b')]===undefined?!![]:![]:!![],'where':_0x25a46d['options']?_0x25a46d[_0xc0e3('0x1a')][_0xc0e3('0x1c')]||null:null,'attributes':_0x25a46d['options']?_0x25a46d[_0xc0e3('0x1a')][_0xc0e3('0x1d')]||null:null,'include':_0x25a46d[_0xc0e3('0x1a')]?_0x25a46d[_0xc0e3('0x1a')]['include']?_['map'](_0x25a46d[_0xc0e3('0x1a')]['include'],function(_0x478b3e){return{'model':db[_0x478b3e[_0xc0e3('0x20')]],'as':_0x478b3e['as'],'attributes':_0x478b3e['attributes'],'include':_0x478b3e[_0xc0e3('0x1f')]?_[_0xc0e3('0x21')](_0x478b3e[_0xc0e3('0x1f')],function(_0x1c150a){return{'model':db[_0x1c150a[_0xc0e3('0x20')]],'as':_0x1c150a['as'],'attributes':_0x1c150a[_0xc0e3('0x1d')],'include':_0x1c150a[_0xc0e3('0x1f')]?_[_0xc0e3('0x21')](_0x1c150a[_0xc0e3('0x1f')],function(_0x1a6a4d){return{'model':db[_0x1a6a4d[_0xc0e3('0x20')]],'as':_0x1a6a4d['as'],'attributes':_0x1a6a4d['attributes']};}):[]};}):[]};}):[]:[]})[_0xc0e3('0xf')](function(_0x17c027){logger[_0xc0e3('0x15')]('ShowFaxQueue',_0x25a46d);logger[_0xc0e3('0x22')](_0xc0e3('0x24'),_0x25a46d,JSON[_0xc0e3('0x25')](_0x17c027));_0x118871(_0x17c027);})['catch'](function(_0x57b1fd){logger['error'](_0xc0e3('0x24'),_0x57b1fd[_0xc0e3('0x14')],_0x25a46d);_0x5af28d(_0x53f086[_0xc0e3('0x12')](0x1f4,_0x57b1fd[_0xc0e3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 2ef8190..8a05a0f 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 _0x7fcf=['removeListener','register','faxQueue:','save','remove','update','emit'];(function(_0x446d28,_0x4a0eab){var _0x3fcf3e=function(_0x1965e9){while(--_0x1965e9){_0x446d28['push'](_0x446d28['shift']());}};_0x3fcf3e(++_0x4a0eab);}(_0x7fcf,0xce));var _0xf7fc=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x7fcf[_0x433a86];return _0x23000c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xf7fc('0x0'),_0xf7fc('0x1'),_0xf7fc('0x2')];function createListener(_0x4fd1d0,_0x1081aa){return function(_0x49a1f3){_0x1081aa[_0xf7fc('0x3')](_0x4fd1d0,_0x49a1f3);};}function removeListener(_0x4f89a6,_0x49538e){return function(){FaxQueueEvents[_0xf7fc('0x4')](_0x4f89a6,_0x49538e);};}exports[_0xf7fc('0x5')]=function(_0x11b96a){for(var _0x54325e=0x0,_0x87869b=events['length'];_0x54325e<_0x87869b;_0x54325e++){var _0x44007d=events[_0x54325e];var _0x246819=createListener(_0xf7fc('0x6')+_0x44007d,_0x11b96a);FaxQueueEvents['on'](_0x44007d,_0x246819);}}; \ No newline at end of file +var _0xb4c7=['remove','update','emit','removeListener','./faxQueue.events','save'];(function(_0x38170a,_0x18cfa0){var _0x4ef7a7=function(_0x5af823){while(--_0x5af823){_0x38170a['push'](_0x38170a['shift']());}};_0x4ef7a7(++_0x18cfa0);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x369907,_0x2ac19d){_0x369907=_0x369907-0x0;var _0xa387df=_0xb4c7[_0x369907];return _0xa387df;};'use strict';var FaxQueueEvents=require(_0x7b4c('0x0'));var events=[_0x7b4c('0x1'),_0x7b4c('0x2'),_0x7b4c('0x3')];function createListener(_0x286a79,_0x4bef48){return function(_0x387199){_0x4bef48[_0x7b4c('0x4')](_0x286a79,_0x387199);};}function removeListener(_0x3ebc75,_0x17cea2){return function(){FaxQueueEvents[_0x7b4c('0x5')](_0x3ebc75,_0x17cea2);};}exports['register']=function(_0x1b0f57){for(var _0x10e197=0x0,_0x2dd5c7=events['length'];_0x10e197<_0x2dd5c7;_0x10e197++){var _0x2d7b7e=events[_0x10e197];var _0x21687f=createListener('faxQueue:'+_0x2d7b7e,_0x1b0f57);FaxQueueEvents['on'](_0x2d7b7e,_0x21687f);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 9d9d866..3f6ed9e 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 _0x444e=['addAgents','put','update','delete','destroy','/:id/users','removeAgents','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getAgents','post'];(function(_0x15deda,_0x1ac756){var _0x110de0=function(_0x73bf57){while(--_0x73bf57){_0x15deda['push'](_0x15deda['shift']());}};_0x110de0(++_0x1ac756);}(_0x444e,0xe8));var _0xe444=function(_0xe44e08,_0x512e68){_0xe44e08=_0xe44e08-0x0;var _0x448bef=_0x444e[_0xe44e08];return _0x448bef;};'use strict';var multer=require(_0xe444('0x0'));var util=require('util');var path=require(_0xe444('0x1'));var timeout=require('connect-timeout');var express=require(_0xe444('0x2'));var router=express['Router']();var fs_extra=require(_0xe444('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var controller=require(_0xe444('0x6'));router[_0xe444('0x7')]('/',auth[_0xe444('0x8')](),controller[_0xe444('0x9')]);router['get'](_0xe444('0xa'),auth['isAuthenticated'](),controller[_0xe444('0xb')]);router['get'](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0xd')]);router['get']('/:id/members',auth[_0xe444('0x8')](),controller[_0xe444('0xe')]);router['get'](_0xe444('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0xe444('0x7')]('/:id/users',auth[_0xe444('0x8')](),controller[_0xe444('0x10')]);router['post']('/',auth[_0xe444('0x8')](),controller['create']);router['post'](_0xe444('0xf'),auth[_0xe444('0x8')](),controller['addTeams']);router[_0xe444('0x11')]('/:id/users',auth[_0xe444('0x8')](),controller[_0xe444('0x12')]);router[_0xe444('0x13')](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0x14')]);router[_0xe444('0x15')](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0x16')]);router[_0xe444('0x15')](_0xe444('0xf'),auth[_0xe444('0x8')](),controller['removeTeams']);router[_0xe444('0x15')](_0xe444('0x17'),auth[_0xe444('0x8')](),controller[_0xe444('0x18')]);module['exports']=router; \ No newline at end of file +var _0x38b8=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','get','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x838b('0x0'));var util=require('util');var path=require(_0x838b('0x1'));var timeout=require(_0x838b('0x2'));var express=require('express');var router=express[_0x838b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x838b('0x4'));var config=require(_0x838b('0x5'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0x838b('0x6')](),controller[_0x838b('0x7')]);router['get'](_0x838b('0x8'),auth[_0x838b('0x6')](),controller['describe']);router['get'](_0x838b('0x9'),auth[_0x838b('0x6')](),controller[_0x838b('0xa')]);router['get'](_0x838b('0xb'),auth['isAuthenticated'](),controller[_0x838b('0xc')]);router[_0x838b('0xd')](_0x838b('0xe'),auth[_0x838b('0x6')](),controller[_0x838b('0xf')]);router[_0x838b('0xd')]('/:id/users',auth[_0x838b('0x6')](),controller[_0x838b('0x10')]);router[_0x838b('0x11')]('/',auth[_0x838b('0x6')](),controller[_0x838b('0x12')]);router[_0x838b('0x11')](_0x838b('0xe'),auth[_0x838b('0x6')](),controller[_0x838b('0x13')]);router['post'](_0x838b('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x838b('0x9'),auth[_0x838b('0x6')](),controller[_0x838b('0x15')]);router[_0x838b('0x16')](_0x838b('0x9'),auth['isAuthenticated'](),controller[_0x838b('0x17')]);router[_0x838b('0x16')](_0x838b('0xe'),auth[_0x838b('0x6')](),controller['removeTeams']);router[_0x838b('0x16')](_0x838b('0x14'),auth['isAuthenticated'](),controller[_0x838b('0x18')]);module[_0x838b('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 67f5d4b..0aef0f5 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 _0x52f6=['sequelize','STRING','DATE','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x52f6,0x11f));var _0x652f=function(_0x305b6b,_0x4ecf07){_0x305b6b=_0x305b6b-0x0;var _0x19918e=_0x52f6[_0x305b6b];return _0x19918e;};'use strict';var moment=require(_0x652f('0x0'));var Sequelize=require(_0x652f('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x652f('0x2')]},'joinAt':{'type':Sequelize[_0x652f('0x3')]},'leaveAt':{'type':Sequelize[_0x652f('0x3')]},'acceptAt':{'type':Sequelize[_0x652f('0x3')]},'exitAt':{'type':Sequelize[_0x652f('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3b64=['STRING','DATE','moment','sequelize','exports'];(function(_0xd1cf76,_0x1e667d){var _0x580cbf=function(_0x51dc24){while(--_0x51dc24){_0xd1cf76['push'](_0xd1cf76['shift']());}};_0x580cbf(++_0x1e667d);}(_0x3b64,0x1b0));var _0x43b6=function(_0x18e730,_0x164b38){_0x18e730=_0x18e730-0x0;var _0x19215a=_0x3b64[_0x18e730];return _0x19215a;};'use strict';var moment=require(_0x43b6('0x0'));var Sequelize=require(_0x43b6('0x1'));module[_0x43b6('0x2')]={'uniqueid':{'type':Sequelize[_0x43b6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x43b6('0x3')]},'joinAt':{'type':Sequelize[_0x43b6('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x43b6('0x4')]},'exitAt':{'type':Sequelize[_0x43b6('0x4')]},'reason':{'type':Sequelize[_0x43b6('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index f5823eb..810cbb7 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 _0xdadd=['path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','reject','destroy','then','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','options','count','include','FaxQueueReport','findAll','catch','params','keys','includeAll','create','update','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0xdadd,0x1c8));var _0xddad=function(_0x1e93fa,_0x210f48){_0x1e93fa=_0x1e93fa-0x0;var _0xd4e1e6=_0xdadd[_0x1e93fa];return _0xd4e1e6;};'use strict';var emlformat=require(_0xddad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xddad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddad('0x2'));var moment=require(_0xddad('0x3'));var BPromise=require(_0xddad('0x4'));var Mustache=require('mustache');var util=require(_0xddad('0x5'));var path=require(_0xddad('0x6'));var sox=require(_0xddad('0x7'));var csv=require(_0xddad('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xddad('0x9'));var squel=require(_0xddad('0xa'));var crypto=require('crypto');var jsforce=require(_0xddad('0xb'));var deskjs=require(_0xddad('0xc'));var toCsv=require(_0xddad('0x8'));var querystring=require(_0xddad('0xd'));var Papa=require(_0xddad('0xe'));var Redis=require(_0xddad('0xf'));var authService=require(_0xddad('0x10'));var qs=require(_0xddad('0x11'));var as=require(_0xddad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddad('0x13'))(_0xddad('0x14'));var utils=require(_0xddad('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xddad('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x193c44,_0x248c9b){_0x248c9b=_0x248c9b||0xcc;return function(_0xc8973d){if(_0xc8973d){return _0x193c44[_0xddad('0x17')](_0x248c9b);}return _0x193c44[_0xddad('0x18')](_0x248c9b)[_0xddad('0x19')]();};}function respondWithResult(_0x4f8c2e,_0x353723){_0x353723=_0x353723||0xc8;return function(_0x2c7b40){if(_0x2c7b40){return _0x4f8c2e[_0xddad('0x18')](_0x353723)[_0xddad('0x1a')](_0x2c7b40);}};}function respondWithFilteredResult(_0x2ac2ac,_0x1b4b94){return function(_0x4e0ca3){if(_0x4e0ca3){var _0x50c3e4=typeof _0x1b4b94[_0xddad('0x1b')]===_0xddad('0x1c')&&typeof _0x1b4b94[_0xddad('0x1d')]===_0xddad('0x1c');var _0x413fe9=_0x4e0ca3['count'];var _0x282b69=_0x50c3e4?0x0:_0x1b4b94[_0xddad('0x1b')];var _0x3c4a8a=_0x50c3e4?_0x4e0ca3['count']:_0x1b4b94[_0xddad('0x1b')]+_0x1b4b94['limit'];var _0x46ac1f;if(_0x3c4a8a>=_0x413fe9){_0x3c4a8a=_0x413fe9;_0x46ac1f=0xc8;}else{_0x46ac1f=0xce;}_0x2ac2ac['status'](_0x46ac1f);return _0x2ac2ac['set']('Content-Range',_0x282b69+'-'+_0x3c4a8a+'/'+_0x413fe9)[_0xddad('0x1a')](_0x4e0ca3);}return null;};}function patchUpdates(_0x49acbf){return function(_0x567986){try{jsonpatch['apply'](_0x567986,_0x49acbf,!![]);}catch(_0x4ea1e9){return BPromise[_0xddad('0x1e')](_0x4ea1e9);}return _0x567986['save']();};}function saveUpdates(_0x1c4db9,_0x450080){return function(_0x2598c3){if(_0x2598c3){return _0x2598c3['update'](_0x1c4db9)['then'](function(_0x59739e){return _0x59739e;});}return null;};}function removeEntity(_0x321b25,_0x5e9e62){return function(_0x3a6c68){if(_0x3a6c68){return _0x3a6c68[_0xddad('0x1f')]()[_0xddad('0x20')](function(){_0x321b25[_0xddad('0x18')](0xcc)[_0xddad('0x19')]();});}};}function handleEntityNotFound(_0x561f35,_0x17b9ce){return function(_0x5b3a5b){if(!_0x5b3a5b){_0x561f35['sendStatus'](0x194);}return _0x5b3a5b;};}function handleError(_0x3040d1,_0x74c3ea){_0x74c3ea=_0x74c3ea||0x1f4;return function(_0x3b4bc8){logger['error'](_0x3b4bc8[_0xddad('0x21')]);if(_0x3b4bc8[_0xddad('0x22')]){delete _0x3b4bc8['name'];}_0x3040d1[_0xddad('0x18')](_0x74c3ea)['send'](_0x3b4bc8);};}exports[_0xddad('0x23')]=function(_0x53c761,_0x35a882){var _0x1823b0={},_0x55ea75={},_0x108192={'count':0x0,'rows':[]};var _0x5617c0=_[_0xddad('0x24')](db['FaxQueueReport'][_0xddad('0x25')],function(_0xf5daec){return{'name':_0xf5daec[_0xddad('0x26')],'type':_0xf5daec[_0xddad('0x27')]['key']};});_0x55ea75[_0xddad('0x28')]=_[_0xddad('0x24')](_0x5617c0,'name');_0x55ea75[_0xddad('0x29')]=_['keys'](_0x53c761['query']);_0x55ea75[_0xddad('0x2a')]=_[_0xddad('0x2b')](_0x55ea75[_0xddad('0x28')],_0x55ea75[_0xddad('0x29')]);_0x1823b0[_0xddad('0x2c')]=_['intersection'](_0x55ea75[_0xddad('0x28')],qs[_0xddad('0x2d')](_0x53c761[_0xddad('0x29')]['fields']));_0x1823b0[_0xddad('0x2c')]=_0x1823b0['attributes'][_0xddad('0x2e')]?_0x1823b0['attributes']:_0x55ea75[_0xddad('0x28')];if(!_0x53c761[_0xddad('0x29')]['hasOwnProperty'](_0xddad('0x2f'))){_0x1823b0['limit']=qs['limit'](_0x53c761['query']['limit']);_0x1823b0[_0xddad('0x1b')]=qs[_0xddad('0x1b')](_0x53c761['query']['offset']);}_0x1823b0['order']=qs[_0xddad('0x30')](_0x53c761['query'][_0xddad('0x30')]);_0x1823b0['where']=qs['filters'](_['pick'](_0x53c761['query'],_0x55ea75['filters']),_0x5617c0);if(_0x53c761[_0xddad('0x29')][_0xddad('0x31')]){_0x1823b0[_0xddad('0x32')]=_[_0xddad('0x33')](_0x1823b0[_0xddad('0x32')],{'$or':_[_0xddad('0x24')](_0x5617c0,function(_0xdb46ad){if(_0xdb46ad[_0xddad('0x27')]!==_0xddad('0x34')){var _0x6f717d={};_0x6f717d[_0xdb46ad[_0xddad('0x22')]]={'$like':'%'+_0x53c761[_0xddad('0x29')]['filter']+'%'};return _0x6f717d;}})});}_0x1823b0=_[_0xddad('0x33')]({},_0x1823b0,_0x53c761[_0xddad('0x35')]);var _0x5ed1e2={'where':_0x1823b0[_0xddad('0x32')]};return db['FaxQueueReport'][_0xddad('0x36')](_0x5ed1e2)[_0xddad('0x20')](function(_0x1ea76d){_0x108192[_0xddad('0x36')]=_0x1ea76d;if(_0x53c761['query']['includeAll']){_0x1823b0[_0xddad('0x37')]=[{'all':!![]}];}return db[_0xddad('0x38')][_0xddad('0x39')](_0x1823b0);})[_0xddad('0x20')](function(_0x33c930){_0x108192['rows']=_0x33c930;return _0x108192;})[_0xddad('0x20')](respondWithFilteredResult(_0x35a882,_0x1823b0))[_0xddad('0x3a')](handleError(_0x35a882,null));};exports['show']=function(_0x229d7a,_0x3a9ed6){var _0x17bded={'raw':!![],'where':{'id':_0x229d7a[_0xddad('0x3b')]['id']}},_0x47a6af={};_0x47a6af[_0xddad('0x28')]=_[_0xddad('0x3c')](db[_0xddad('0x38')][_0xddad('0x25')]);_0x47a6af[_0xddad('0x29')]=_[_0xddad('0x3c')](_0x229d7a[_0xddad('0x29')]);_0x47a6af[_0xddad('0x2a')]=_['intersection'](_0x47a6af[_0xddad('0x28')],_0x47a6af[_0xddad('0x29')]);_0x17bded[_0xddad('0x2c')]=_[_0xddad('0x2b')](_0x47a6af['model'],qs['fields'](_0x229d7a[_0xddad('0x29')][_0xddad('0x2d')]));_0x17bded['attributes']=_0x17bded[_0xddad('0x2c')][_0xddad('0x2e')]?_0x17bded['attributes']:_0x47a6af['model'];if(_0x229d7a[_0xddad('0x29')][_0xddad('0x3d')]){_0x17bded[_0xddad('0x37')]=[{'all':!![]}];}_0x17bded=_[_0xddad('0x33')]({},_0x17bded,_0x229d7a['options']);return db['FaxQueueReport']['find'](_0x17bded)[_0xddad('0x20')](handleEntityNotFound(_0x3a9ed6,null))[_0xddad('0x20')](respondWithResult(_0x3a9ed6,null))['catch'](handleError(_0x3a9ed6,null));};exports['create']=function(_0x3693ee,_0x43b19c){return db[_0xddad('0x38')][_0xddad('0x3e')](_0x3693ee['body'],{})[_0xddad('0x20')](respondWithResult(_0x43b19c,0xc9))['catch'](handleError(_0x43b19c,null));};exports[_0xddad('0x3f')]=function(_0x1ada5e,_0x4ba42d){if(_0x1ada5e[_0xddad('0x40')]['id']){delete _0x1ada5e[_0xddad('0x40')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x1ada5e[_0xddad('0x3b')]['id']}})[_0xddad('0x20')](handleEntityNotFound(_0x4ba42d,null))[_0xddad('0x20')](saveUpdates(_0x1ada5e[_0xddad('0x40')],null))[_0xddad('0x20')](respondWithResult(_0x4ba42d,null))[_0xddad('0x3a')](handleError(_0x4ba42d,null));};exports['destroy']=function(_0x43dd61,_0x440124){return db['FaxQueueReport']['find']({'where':{'id':_0x43dd61['params']['id']}})[_0xddad('0x20')](handleEntityNotFound(_0x440124,null))[_0xddad('0x20')](removeEntity(_0x440124,null))['catch'](handleError(_0x440124,null));};exports[_0xddad('0x41')]=function(_0x2e168e,_0x2fe117){return db['FaxQueueReport'][_0xddad('0x41')]()[_0xddad('0x20')](respondWithResult(_0x2fe117,null))['catch'](handleError(_0x2fe117,null));}; \ No newline at end of file +var _0x03ce=['query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','keys','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x03ce,0x1a1));var _0xe03c=function(_0x31de3d,_0x3e858e){_0x31de3d=_0x31de3d-0x0;var _0x3e717a=_0x03ce[_0x31de3d];return _0x3e717a;};'use strict';var emlformat=require(_0xe03c('0x0'));var rimraf=require(_0xe03c('0x1'));var zipdir=require(_0xe03c('0x2'));var jsonpatch=require(_0xe03c('0x3'));var rp=require('request-promise');var moment=require(_0xe03c('0x4'));var BPromise=require(_0xe03c('0x5'));var Mustache=require(_0xe03c('0x6'));var util=require('util');var path=require(_0xe03c('0x7'));var sox=require(_0xe03c('0x8'));var csv=require(_0xe03c('0x9'));var ejs=require(_0xe03c('0xa'));var fs=require('fs');var fs_extra=require(_0xe03c('0xb'));var _=require(_0xe03c('0xc'));var squel=require(_0xe03c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe03c('0xe'));var toCsv=require(_0xe03c('0x9'));var querystring=require(_0xe03c('0xf'));var Papa=require(_0xe03c('0x10'));var Redis=require(_0xe03c('0x11'));var authService=require(_0xe03c('0x12'));var qs=require(_0xe03c('0x13'));var as=require(_0xe03c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe03c('0x15'))(_0xe03c('0x16'));var utils=require(_0xe03c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe03c('0x18'));var db=require(_0xe03c('0x19'))['db'];function respondWithStatusCode(_0x4d8249,_0x27838b){_0x27838b=_0x27838b||0xcc;return function(_0x476349){if(_0x476349){return _0x4d8249['sendStatus'](_0x27838b);}return _0x4d8249[_0xe03c('0x1a')](_0x27838b)[_0xe03c('0x1b')]();};}function respondWithResult(_0x25a5e9,_0x4f7139){_0x4f7139=_0x4f7139||0xc8;return function(_0x2ffd1f){if(_0x2ffd1f){return _0x25a5e9[_0xe03c('0x1a')](_0x4f7139)[_0xe03c('0x1c')](_0x2ffd1f);}};}function respondWithFilteredResult(_0x408a8f,_0x417a9e){return function(_0x54b705){if(_0x54b705){var _0x3d6287=typeof _0x417a9e[_0xe03c('0x1d')]==='undefined'&&typeof _0x417a9e[_0xe03c('0x1e')]===_0xe03c('0x1f');var _0x3b3ecc=_0x54b705['count'];var _0x56ec58=_0x3d6287?0x0:_0x417a9e[_0xe03c('0x1d')];var _0x386cb7=_0x3d6287?_0x54b705['count']:_0x417a9e[_0xe03c('0x1d')]+_0x417a9e[_0xe03c('0x1e')];var _0x157882;if(_0x386cb7>=_0x3b3ecc){_0x386cb7=_0x3b3ecc;_0x157882=0xc8;}else{_0x157882=0xce;}_0x408a8f['status'](_0x157882);return _0x408a8f['set'](_0xe03c('0x20'),_0x56ec58+'-'+_0x386cb7+'/'+_0x3b3ecc)[_0xe03c('0x1c')](_0x54b705);}return null;};}function patchUpdates(_0x3bf505){return function(_0x4741ed){try{jsonpatch[_0xe03c('0x21')](_0x4741ed,_0x3bf505,!![]);}catch(_0x3f8564){return BPromise[_0xe03c('0x22')](_0x3f8564);}return _0x4741ed[_0xe03c('0x23')]();};}function saveUpdates(_0x4c9597,_0x1cbf9f){return function(_0x4d5c40){if(_0x4d5c40){return _0x4d5c40[_0xe03c('0x24')](_0x4c9597)[_0xe03c('0x25')](function(_0x3ae889){return _0x3ae889;});}return null;};}function removeEntity(_0x28ac91,_0x3afdea){return function(_0x95a4b3){if(_0x95a4b3){return _0x95a4b3[_0xe03c('0x26')]()['then'](function(){_0x28ac91[_0xe03c('0x1a')](0xcc)[_0xe03c('0x1b')]();});}};}function handleEntityNotFound(_0x353def,_0x1ec81e){return function(_0x35dc82){if(!_0x35dc82){_0x353def[_0xe03c('0x27')](0x194);}return _0x35dc82;};}function handleError(_0x10675b,_0x87b4a1){_0x87b4a1=_0x87b4a1||0x1f4;return function(_0x2d3644){logger[_0xe03c('0x28')](_0x2d3644[_0xe03c('0x29')]);if(_0x2d3644[_0xe03c('0x2a')]){delete _0x2d3644[_0xe03c('0x2a')];}_0x10675b[_0xe03c('0x1a')](_0x87b4a1)[_0xe03c('0x2b')](_0x2d3644);};}exports[_0xe03c('0x2c')]=function(_0x4f475b,_0x590d3c){var _0x4c0618={},_0x29a0fe={},_0x2d8f30={'count':0x0,'rows':[]};var _0x2586b8=_[_0xe03c('0x2d')](db[_0xe03c('0x2e')][_0xe03c('0x2f')],function(_0x136f23){return{'name':_0x136f23[_0xe03c('0x30')],'type':_0x136f23['type'][_0xe03c('0x31')]};});_0x29a0fe[_0xe03c('0x32')]=_[_0xe03c('0x2d')](_0x2586b8,_0xe03c('0x2a'));_0x29a0fe[_0xe03c('0x33')]=_['keys'](_0x4f475b[_0xe03c('0x33')]);_0x29a0fe[_0xe03c('0x34')]=_[_0xe03c('0x35')](_0x29a0fe[_0xe03c('0x32')],_0x29a0fe[_0xe03c('0x33')]);_0x4c0618[_0xe03c('0x36')]=_[_0xe03c('0x35')](_0x29a0fe[_0xe03c('0x32')],qs[_0xe03c('0x37')](_0x4f475b[_0xe03c('0x33')][_0xe03c('0x37')]));_0x4c0618[_0xe03c('0x36')]=_0x4c0618[_0xe03c('0x36')][_0xe03c('0x38')]?_0x4c0618[_0xe03c('0x36')]:_0x29a0fe[_0xe03c('0x32')];if(!_0x4f475b[_0xe03c('0x33')]['hasOwnProperty'](_0xe03c('0x39'))){_0x4c0618[_0xe03c('0x1e')]=qs[_0xe03c('0x1e')](_0x4f475b[_0xe03c('0x33')]['limit']);_0x4c0618[_0xe03c('0x1d')]=qs['offset'](_0x4f475b['query'][_0xe03c('0x1d')]);}_0x4c0618[_0xe03c('0x3a')]=qs[_0xe03c('0x3b')](_0x4f475b[_0xe03c('0x33')]['sort']);_0x4c0618[_0xe03c('0x3c')]=qs[_0xe03c('0x34')](_['pick'](_0x4f475b['query'],_0x29a0fe['filters']),_0x2586b8);if(_0x4f475b['query'][_0xe03c('0x3d')]){_0x4c0618['where']=_[_0xe03c('0x3e')](_0x4c0618['where'],{'$or':_['map'](_0x2586b8,function(_0x37a765){if(_0x37a765[_0xe03c('0x3f')]!==_0xe03c('0x40')){var _0x229136={};_0x229136[_0x37a765['name']]={'$like':'%'+_0x4f475b[_0xe03c('0x33')]['filter']+'%'};return _0x229136;}})});}_0x4c0618=_[_0xe03c('0x3e')]({},_0x4c0618,_0x4f475b[_0xe03c('0x41')]);var _0x3f6e06={'where':_0x4c0618[_0xe03c('0x3c')]};return db[_0xe03c('0x2e')][_0xe03c('0x42')](_0x3f6e06)[_0xe03c('0x25')](function(_0x5e3218){_0x2d8f30[_0xe03c('0x42')]=_0x5e3218;if(_0x4f475b['query'][_0xe03c('0x43')]){_0x4c0618[_0xe03c('0x44')]=[{'all':!![]}];}return db[_0xe03c('0x2e')][_0xe03c('0x45')](_0x4c0618);})[_0xe03c('0x25')](function(_0x1fa14d){_0x2d8f30['rows']=_0x1fa14d;return _0x2d8f30;})['then'](respondWithFilteredResult(_0x590d3c,_0x4c0618))['catch'](handleError(_0x590d3c,null));};exports[_0xe03c('0x46')]=function(_0x471568,_0x48e9eb){var _0x3bc3af={'raw':!![],'where':{'id':_0x471568[_0xe03c('0x47')]['id']}},_0x43dc4f={};_0x43dc4f[_0xe03c('0x32')]=_['keys'](db[_0xe03c('0x2e')][_0xe03c('0x2f')]);_0x43dc4f[_0xe03c('0x33')]=_[_0xe03c('0x48')](_0x471568[_0xe03c('0x33')]);_0x43dc4f[_0xe03c('0x34')]=_['intersection'](_0x43dc4f[_0xe03c('0x32')],_0x43dc4f[_0xe03c('0x33')]);_0x3bc3af[_0xe03c('0x36')]=_['intersection'](_0x43dc4f['model'],qs[_0xe03c('0x37')](_0x471568['query']['fields']));_0x3bc3af[_0xe03c('0x36')]=_0x3bc3af[_0xe03c('0x36')]['length']?_0x3bc3af[_0xe03c('0x36')]:_0x43dc4f[_0xe03c('0x32')];if(_0x471568[_0xe03c('0x33')][_0xe03c('0x43')]){_0x3bc3af['include']=[{'all':!![]}];}_0x3bc3af=_[_0xe03c('0x3e')]({},_0x3bc3af,_0x471568['options']);return db[_0xe03c('0x2e')][_0xe03c('0x49')](_0x3bc3af)[_0xe03c('0x25')](handleEntityNotFound(_0x48e9eb,null))[_0xe03c('0x25')](respondWithResult(_0x48e9eb,null))['catch'](handleError(_0x48e9eb,null));};exports[_0xe03c('0x4a')]=function(_0x4df64b,_0x44ff92){return db[_0xe03c('0x2e')]['create'](_0x4df64b[_0xe03c('0x4b')],{})[_0xe03c('0x25')](respondWithResult(_0x44ff92,0xc9))[_0xe03c('0x4c')](handleError(_0x44ff92,null));};exports[_0xe03c('0x24')]=function(_0x1a5e16,_0x2dfa79){if(_0x1a5e16[_0xe03c('0x4b')]['id']){delete _0x1a5e16[_0xe03c('0x4b')]['id'];}return db[_0xe03c('0x2e')][_0xe03c('0x49')]({'where':{'id':_0x1a5e16[_0xe03c('0x47')]['id']}})[_0xe03c('0x25')](handleEntityNotFound(_0x2dfa79,null))[_0xe03c('0x25')](saveUpdates(_0x1a5e16[_0xe03c('0x4b')],null))[_0xe03c('0x25')](respondWithResult(_0x2dfa79,null))[_0xe03c('0x4c')](handleError(_0x2dfa79,null));};exports['destroy']=function(_0x14a025,_0x117ddc){return db[_0xe03c('0x2e')][_0xe03c('0x49')]({'where':{'id':_0x14a025[_0xe03c('0x47')]['id']}})[_0xe03c('0x25')](handleEntityNotFound(_0x117ddc,null))[_0xe03c('0x25')](removeEntity(_0x117ddc,null))[_0xe03c('0x4c')](handleError(_0x117ddc,null));};exports['describe']=function(_0x627c1b,_0x21b510){return db[_0xe03c('0x2e')][_0xe03c('0x4d')]()['then'](respondWithResult(_0x21b510,null))['catch'](handleError(_0x21b510,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2c84272..fad9ee6 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(_0x46220d,_0x2c6675){var _0x428f57=function(_0x47bb8f){while(--_0x47bb8f){_0x46220d['push'](_0x46220d['shift']());}};_0x428f57(++_0x2c6675);}(_0x326f,0xd1));var _0xf326=function(_0x5e679e,_0x481dd9){_0x5e679e=_0x5e679e-0x0;var _0x260e54=_0x326f[_0x5e679e];return _0x260e54;};'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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47eb7a,_0x149a40){var _0x33d99f=function(_0x53c3c0){while(--_0x53c3c0){_0x47eb7a['push'](_0x47eb7a['shift']());}};_0x33d99f(++_0x149a40);}(_0x4975,0x86));var _0x5497=function(_0x2465de,_0x35ccad){_0x2465de=_0x2465de-0x0;var _0x22f1e0=_0x4975[_0x2465de];return _0x22f1e0;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ef67004..8419ce9 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 _0x1a41=['client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','stringify','UpdateFaxQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4a7fd1,_0x4bdde1){var _0x12ef10=function(_0x234855){while(--_0x234855){_0x4a7fd1['push'](_0x4a7fd1['shift']());}};_0x12ef10(++_0x4bdde1);}(_0x1a41,0x18d));var _0x11a4=function(_0x4ddc7e,_0xcb9b8){_0x4ddc7e=_0x4ddc7e-0x0;var _0xfbf0ec=_0x1a41[_0x4ddc7e];return _0xfbf0ec;};'use strict';var _=require(_0x11a4('0x0'));var util=require(_0x11a4('0x1'));var moment=require(_0x11a4('0x2'));var BPromise=require(_0x11a4('0x3'));var rs=require(_0x11a4('0x4'));var fs=require('fs');var Redis=require(_0x11a4('0x5'));var db=require(_0x11a4('0x6'))['db'];var utils=require(_0x11a4('0x7'));var logger=require(_0x11a4('0x8'))(_0x11a4('0x9'));var config=require('../../config/environment');var jayson=require(_0x11a4('0xa'));var client=jayson[_0x11a4('0xb')][_0x11a4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x547988,_0x1e3f1c,_0x2d8d53){return new BPromise(function(_0x2230af,_0x361744){return client[_0x11a4('0xd')](_0x547988,_0x2d8d53)[_0x11a4('0xe')](function(_0x141e0e){logger[_0x11a4('0xf')](_0x11a4('0x10'),_0x1e3f1c,_0x11a4('0x11'));logger[_0x11a4('0x12')](_0x11a4('0x13'),_0x1e3f1c,_0x11a4('0x11'),JSON['stringify'](_0x141e0e));if(_0x141e0e[_0x11a4('0x14')]){if(_0x141e0e[_0x11a4('0x14')][_0x11a4('0x15')]===0x1f4){logger[_0x11a4('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x1e3f1c,_0x141e0e[_0x11a4('0x14')][_0x11a4('0x16')]);return _0x361744(_0x141e0e[_0x11a4('0x14')]['message']);}logger[_0x11a4('0x14')](_0x11a4('0x10'),_0x1e3f1c,_0x141e0e['error']['message']);return _0x2230af(_0x141e0e[_0x11a4('0x14')]['message']);}else{logger[_0x11a4('0xf')](_0x11a4('0x10'),_0x1e3f1c,_0x11a4('0x11'));_0x2230af(_0x141e0e[_0x11a4('0x17')][_0x11a4('0x16')]);}})[_0x11a4('0x18')](function(_0x3f11ee){logger[_0x11a4('0x14')](_0x11a4('0x10'),_0x1e3f1c,_0x3f11ee);_0x361744(_0x3f11ee);});});}exports[_0x11a4('0x19')]=function(_0x32a379){var _0x48f390=this;return new Promise(function(_0x39adbb,_0x5ac11d){return db[_0x11a4('0x1a')][_0x11a4('0x1b')](_0x32a379['body'],{'raw':_0x32a379[_0x11a4('0x1c')]?_0x32a379[_0x11a4('0x1c')][_0x11a4('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2efd0b){logger[_0x11a4('0xf')]('CreateFaxQueueReport',_0x32a379);logger[_0x11a4('0x12')](_0x11a4('0x19'),_0x32a379,JSON[_0x11a4('0x1e')](_0x2efd0b));_0x39adbb(_0x2efd0b);})[_0x11a4('0x18')](function(_0x203736){logger[_0x11a4('0x14')](_0x11a4('0x19'),_0x203736[_0x11a4('0x16')],_0x32a379);_0x5ac11d(_0x48f390[_0x11a4('0x14')](0x1f4,_0x203736['message']));});});};exports[_0x11a4('0x1f')]=function(_0x868456){var _0x43fc5a=this;return new Promise(function(_0x316c15,_0x54aaf5){return db[_0x11a4('0x1a')]['update'](_0x868456['body'],{'raw':_0x868456[_0x11a4('0x1c')]?_0x868456[_0x11a4('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x868456[_0x11a4('0x1c')]?_0x868456[_0x11a4('0x1c')]['where']||null:null,'attributes':_0x868456[_0x11a4('0x1c')]?_0x868456[_0x11a4('0x1c')][_0x11a4('0x20')]||null:null,'limit':_0x868456[_0x11a4('0x1c')]?_0x868456[_0x11a4('0x1c')][_0x11a4('0x21')]||null:null})['then'](function(_0xb23bcd){logger[_0x11a4('0xf')](_0x11a4('0x1f'),_0x868456);logger[_0x11a4('0x12')]('UpdateFaxQueueReport',_0x868456,JSON[_0x11a4('0x1e')](_0xb23bcd));_0x316c15(_0xb23bcd);})[_0x11a4('0x18')](function(_0x47c2f3){logger['error']('UpdateFaxQueueReport',_0x47c2f3[_0x11a4('0x16')],_0x868456);_0x54aaf5(_0x43fc5a[_0x11a4('0x14')](0x1f4,_0x47c2f3[_0x11a4('0x16')]));});});}; \ No newline at end of file +var _0xf0fe=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','update','attributes','limit','UpdateFaxQueueReport'];(function(_0x1e948b,_0x548563){var _0x238555=function(_0x47ebe2){while(--_0x47ebe2){_0x1e948b['push'](_0x1e948b['shift']());}};_0x238555(++_0x548563);}(_0xf0fe,0x156));var _0xef0f=function(_0x2d7cff,_0x2b9fa3){_0x2d7cff=_0x2d7cff-0x0;var _0xfcd59c=_0xf0fe[_0x2d7cff];return _0xfcd59c;};'use strict';var _=require('lodash');var util=require(_0xef0f('0x0'));var moment=require(_0xef0f('0x1'));var BPromise=require(_0xef0f('0x2'));var rs=require(_0xef0f('0x3'));var fs=require('fs');var Redis=require(_0xef0f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef0f('0x5'));var logger=require(_0xef0f('0x6'))(_0xef0f('0x7'));var config=require(_0xef0f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef0f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e0cf5,_0x2825c9,_0x3c4729){return new BPromise(function(_0x523661,_0x36ee17){return client[_0xef0f('0xa')](_0x5e0cf5,_0x3c4729)['then'](function(_0x49078d){logger[_0xef0f('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x2825c9,_0xef0f('0xc'));logger[_0xef0f('0xd')](_0xef0f('0xe'),_0x2825c9,_0xef0f('0xc'),JSON[_0xef0f('0xf')](_0x49078d));if(_0x49078d[_0xef0f('0x10')]){if(_0x49078d['error']['code']===0x1f4){logger[_0xef0f('0x10')](_0xef0f('0x11'),_0x2825c9,_0x49078d[_0xef0f('0x10')][_0xef0f('0x12')]);return _0x36ee17(_0x49078d[_0xef0f('0x10')]['message']);}logger[_0xef0f('0x10')](_0xef0f('0x11'),_0x2825c9,_0x49078d[_0xef0f('0x10')][_0xef0f('0x12')]);return _0x523661(_0x49078d[_0xef0f('0x10')]['message']);}else{logger['info'](_0xef0f('0x11'),_0x2825c9,_0xef0f('0xc'));_0x523661(_0x49078d['result'][_0xef0f('0x12')]);}})['catch'](function(_0x10a10c){logger[_0xef0f('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x2825c9,_0x10a10c);_0x36ee17(_0x10a10c);});});}exports[_0xef0f('0x13')]=function(_0x34e1e7){var _0x56193e=this;return new Promise(function(_0x83346a,_0x32bcd8){return db[_0xef0f('0x14')][_0xef0f('0x15')](_0x34e1e7[_0xef0f('0x16')],{'raw':_0x34e1e7[_0xef0f('0x17')]?_0x34e1e7[_0xef0f('0x17')][_0xef0f('0x18')]===undefined?!![]:![]:!![]})[_0xef0f('0x19')](function(_0x30c25f){logger[_0xef0f('0xb')](_0xef0f('0x13'),_0x34e1e7);logger['debug'](_0xef0f('0x13'),_0x34e1e7,JSON[_0xef0f('0xf')](_0x30c25f));_0x83346a(_0x30c25f);})['catch'](function(_0x116de4){logger[_0xef0f('0x10')](_0xef0f('0x13'),_0x116de4[_0xef0f('0x12')],_0x34e1e7);_0x32bcd8(_0x56193e[_0xef0f('0x10')](0x1f4,_0x116de4['message']));});});};exports['UpdateFaxQueueReport']=function(_0x1da9e3){var _0x587f9d=this;return new Promise(function(_0x2b3f8c,_0x1414d8){return db['FaxQueueReport'][_0xef0f('0x1a')](_0x1da9e3[_0xef0f('0x16')],{'raw':_0x1da9e3[_0xef0f('0x17')]?_0x1da9e3[_0xef0f('0x17')][_0xef0f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1da9e3[_0xef0f('0x17')]?_0x1da9e3[_0xef0f('0x17')]['where']||null:null,'attributes':_0x1da9e3[_0xef0f('0x17')]?_0x1da9e3[_0xef0f('0x17')][_0xef0f('0x1b')]||null:null,'limit':_0x1da9e3[_0xef0f('0x17')]?_0x1da9e3[_0xef0f('0x17')][_0xef0f('0x1c')]||null:null})['then'](function(_0x452de9){logger[_0xef0f('0xb')](_0xef0f('0x1d'),_0x1da9e3);logger[_0xef0f('0xd')]('UpdateFaxQueueReport',_0x1da9e3,JSON[_0xef0f('0xf')](_0x452de9));_0x2b3f8c(_0x452de9);})[_0xef0f('0x1e')](function(_0x4dec29){logger[_0xef0f('0x10')](_0xef0f('0x1d'),_0x4dec29[_0xef0f('0x12')],_0x1da9e3);_0x1414d8(_0x587f9d['error'](0x1f4,_0x4dec29[_0xef0f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 77ae92f..d024b65 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 _0x1e8c=['post','create','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x165fd9,_0x735c52){var _0x34611f=function(_0xb44329){while(--_0xb44329){_0x165fd9['push'](_0x165fd9['shift']());}};_0x34611f(++_0x735c52);}(_0x1e8c,0xf2));var _0xc1e8=function(_0xdcda3,_0x4252fb){_0xdcda3=_0xdcda3-0x0;var _0x2bec82=_0x1e8c[_0xdcda3];return _0x2bec82;};'use strict';var multer=require('multer');var util=require(_0xc1e8('0x0'));var path=require(_0xc1e8('0x1'));var timeout=require(_0xc1e8('0x2'));var express=require(_0xc1e8('0x3'));var router=express[_0xc1e8('0x4')]();var fs_extra=require(_0xc1e8('0x5'));var auth=require(_0xc1e8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0xc1e8('0x7')]('/',auth[_0xc1e8('0x8')](),controller['index']);router[_0xc1e8('0x7')](_0xc1e8('0x9'),auth[_0xc1e8('0x8')](),controller[_0xc1e8('0xa')]);router[_0xc1e8('0x7')](_0xc1e8('0xb'),auth[_0xc1e8('0x8')](),controller[_0xc1e8('0xc')]);router[_0xc1e8('0xd')]('/',auth[_0xc1e8('0x8')](),controller[_0xc1e8('0xe')]);router['put'](_0xc1e8('0xb'),auth[_0xc1e8('0x8')](),controller[_0xc1e8('0xf')]);router['delete'](_0xc1e8('0xb'),auth['isAuthenticated'](),controller[_0xc1e8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0c2e=['index','/describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xf62b4c,_0xe58520){var _0x2a55d9=function(_0x105957){while(--_0x105957){_0xf62b4c['push'](_0xf62b4c['shift']());}};_0x2a55d9(++_0xe58520);}(_0x0c2e,0xe5));var _0xe0c2=function(_0x4ecfdb,_0x2f96da){_0x4ecfdb=_0x4ecfdb-0x0;var _0x393f9c=_0x0c2e[_0x4ecfdb];return _0x393f9c;};'use strict';var multer=require(_0xe0c2('0x0'));var util=require(_0xe0c2('0x1'));var path=require(_0xe0c2('0x2'));var timeout=require(_0xe0c2('0x3'));var express=require('express');var router=express[_0xe0c2('0x4')]();var fs_extra=require(_0xe0c2('0x5'));var auth=require(_0xe0c2('0x6'));var interaction=require(_0xe0c2('0x7'));var config=require(_0xe0c2('0x8'));var controller=require('./faxQueueReport.controller');router[_0xe0c2('0x9')]('/',auth[_0xe0c2('0xa')](),controller[_0xe0c2('0xb')]);router[_0xe0c2('0x9')](_0xe0c2('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe0c2('0x9')](_0xe0c2('0xd'),auth[_0xe0c2('0xa')](),controller['show']);router[_0xe0c2('0xe')]('/',auth[_0xe0c2('0xa')](),controller[_0xe0c2('0xf')]);router['put'](_0xe0c2('0xd'),auth['isAuthenticated'](),controller[_0xe0c2('0x10')]);router[_0xe0c2('0x11')]('/:id',auth[_0xe0c2('0xa')](),controller[_0xe0c2('0x12')]);module[_0xe0c2('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 6e9a5ef..2588d4a 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xc7ddda,_0xccda4d){var _0x4cbc07=function(_0x46e730){while(--_0x46e730){_0xc7ddda['push'](_0xc7ddda['shift']());}};_0x4cbc07(++_0xccda4d);}(_0x70e0,0x17b));var _0x070e=function(_0x36e6f3,_0x5d9ac6){_0x36e6f3=_0x36e6f3-0x0;var _0xe485e7=_0x70e0[_0x36e6f3];return _0xe485e7;};'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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x227cce,_0x46477b){var _0x339dfb=function(_0x43ef09){while(--_0x43ef09){_0x227cce['push'](_0x227cce['shift']());}};_0x339dfb(++_0x46477b);}(_0x54ef,0x112));var _0xf54e=function(_0xc57859,_0xc7b231){_0xc57859=_0xc57859-0x0;var _0x2671b4=_0x54ef[_0xc57859];return _0x2671b4;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5a64891..6feae67 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 _0xa264=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','status','index','map','FaxTransferReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0xa264,0xd6));var _0x4a26=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0xa264[_0x3cbe1c];return _0x5ee08b;};'use strict';var emlformat=require(_0x4a26('0x0'));var rimraf=require(_0x4a26('0x1'));var zipdir=require(_0x4a26('0x2'));var jsonpatch=require(_0x4a26('0x3'));var rp=require(_0x4a26('0x4'));var moment=require(_0x4a26('0x5'));var BPromise=require(_0x4a26('0x6'));var Mustache=require(_0x4a26('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4a26('0x8'));var fs=require('fs');var fs_extra=require(_0x4a26('0x9'));var _=require(_0x4a26('0xa'));var squel=require('squel');var crypto=require(_0x4a26('0xb'));var jsforce=require(_0x4a26('0xc'));var deskjs=require(_0x4a26('0xd'));var toCsv=require(_0x4a26('0xe'));var querystring=require(_0x4a26('0xf'));var Papa=require(_0x4a26('0x10'));var Redis=require(_0x4a26('0x11'));var authService=require(_0x4a26('0x12'));var qs=require(_0x4a26('0x13'));var as=require(_0x4a26('0x14'));var hardwareService=require(_0x4a26('0x15'));var logger=require(_0x4a26('0x16'))('api');var utils=require(_0x4a26('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4a26('0x18'));var db=require(_0x4a26('0x19'))['db'];function respondWithStatusCode(_0x4934ce,_0x25612c){_0x25612c=_0x25612c||0xcc;return function(_0x2c1ea6){if(_0x2c1ea6){return _0x4934ce[_0x4a26('0x1a')](_0x25612c);}return _0x4934ce['status'](_0x25612c)[_0x4a26('0x1b')]();};}function respondWithResult(_0x127baa,_0x2cb158){_0x2cb158=_0x2cb158||0xc8;return function(_0x485358){if(_0x485358){return _0x127baa['status'](_0x2cb158)[_0x4a26('0x1c')](_0x485358);}};}function respondWithFilteredResult(_0x3974d8,_0x2f3be9){return function(_0x5653f2){if(_0x5653f2){var _0x4c8eab=typeof _0x2f3be9[_0x4a26('0x1d')]==='undefined'&&typeof _0x2f3be9['limit']===_0x4a26('0x1e');var _0x3c2390=_0x5653f2[_0x4a26('0x1f')];var _0x19245b=_0x4c8eab?0x0:_0x2f3be9[_0x4a26('0x1d')];var _0x40f050=_0x4c8eab?_0x5653f2[_0x4a26('0x1f')]:_0x2f3be9[_0x4a26('0x1d')]+_0x2f3be9[_0x4a26('0x20')];var _0x173a53;if(_0x40f050>=_0x3c2390){_0x40f050=_0x3c2390;_0x173a53=0xc8;}else{_0x173a53=0xce;}_0x3974d8['status'](_0x173a53);return _0x3974d8[_0x4a26('0x21')](_0x4a26('0x22'),_0x19245b+'-'+_0x40f050+'/'+_0x3c2390)[_0x4a26('0x1c')](_0x5653f2);}return null;};}function patchUpdates(_0x317eec){return function(_0x3d869b){try{jsonpatch['apply'](_0x3d869b,_0x317eec,!![]);}catch(_0x1a56ab){return BPromise[_0x4a26('0x23')](_0x1a56ab);}return _0x3d869b['save']();};}function saveUpdates(_0x573c7b,_0x321e4c){return function(_0x3fc7f1){if(_0x3fc7f1){return _0x3fc7f1[_0x4a26('0x24')](_0x573c7b)['then'](function(_0x180e16){return _0x180e16;});}return null;};}function removeEntity(_0x18d3a6,_0x1e08a0){return function(_0x152acf){if(_0x152acf){return _0x152acf[_0x4a26('0x25')]()['then'](function(){_0x18d3a6['status'](0xcc)[_0x4a26('0x1b')]();});}};}function handleEntityNotFound(_0x42e72a,_0x22ca5e){return function(_0x4868a4){if(!_0x4868a4){_0x42e72a['sendStatus'](0x194);}return _0x4868a4;};}function handleError(_0x2dd4bb,_0x21bddf){_0x21bddf=_0x21bddf||0x1f4;return function(_0x32a258){logger[_0x4a26('0x26')](_0x32a258[_0x4a26('0x27')]);if(_0x32a258['name']){delete _0x32a258[_0x4a26('0x28')];}_0x2dd4bb[_0x4a26('0x29')](_0x21bddf)['send'](_0x32a258);};}exports[_0x4a26('0x2a')]=function(_0xf1d7ef,_0x2f4f6c){var _0x10d29e={},_0x46165f={},_0x7688ab={'count':0x0,'rows':[]};var _0x560794=_[_0x4a26('0x2b')](db[_0x4a26('0x2c')][_0x4a26('0x2d')],function(_0x952477){return{'name':_0x952477['fieldName'],'type':_0x952477['type'][_0x4a26('0x2e')]};});_0x46165f[_0x4a26('0x2f')]=_['map'](_0x560794,_0x4a26('0x28'));_0x46165f[_0x4a26('0x30')]=_[_0x4a26('0x31')](_0xf1d7ef['query']);_0x46165f[_0x4a26('0x32')]=_[_0x4a26('0x33')](_0x46165f[_0x4a26('0x2f')],_0x46165f[_0x4a26('0x30')]);_0x10d29e[_0x4a26('0x34')]=_[_0x4a26('0x33')](_0x46165f[_0x4a26('0x2f')],qs['fields'](_0xf1d7ef[_0x4a26('0x30')][_0x4a26('0x35')]));_0x10d29e[_0x4a26('0x34')]=_0x10d29e[_0x4a26('0x34')][_0x4a26('0x36')]?_0x10d29e[_0x4a26('0x34')]:_0x46165f[_0x4a26('0x2f')];if(!_0xf1d7ef[_0x4a26('0x30')][_0x4a26('0x37')](_0x4a26('0x38'))){_0x10d29e[_0x4a26('0x20')]=qs[_0x4a26('0x20')](_0xf1d7ef[_0x4a26('0x30')][_0x4a26('0x20')]);_0x10d29e[_0x4a26('0x1d')]=qs['offset'](_0xf1d7ef['query']['offset']);}_0x10d29e[_0x4a26('0x39')]=qs[_0x4a26('0x3a')](_0xf1d7ef['query']['sort']);_0x10d29e[_0x4a26('0x3b')]=qs[_0x4a26('0x32')](_[_0x4a26('0x3c')](_0xf1d7ef[_0x4a26('0x30')],_0x46165f['filters']),_0x560794);if(_0xf1d7ef['query']['filter']){_0x10d29e['where']=_[_0x4a26('0x3d')](_0x10d29e[_0x4a26('0x3b')],{'$or':_['map'](_0x560794,function(_0x4a11ef){if(_0x4a11ef['type']!==_0x4a26('0x3e')){var _0x1f9549={};_0x1f9549[_0x4a11ef['name']]={'$like':'%'+_0xf1d7ef[_0x4a26('0x30')][_0x4a26('0x3f')]+'%'};return _0x1f9549;}})});}_0x10d29e=_['merge']({},_0x10d29e,_0xf1d7ef[_0x4a26('0x40')]);var _0x41a19e={'where':_0x10d29e[_0x4a26('0x3b')]};return db[_0x4a26('0x2c')][_0x4a26('0x1f')](_0x41a19e)[_0x4a26('0x41')](function(_0x1a5126){_0x7688ab[_0x4a26('0x1f')]=_0x1a5126;if(_0xf1d7ef[_0x4a26('0x30')][_0x4a26('0x42')]){_0x10d29e['include']=[{'all':!![]}];}return db[_0x4a26('0x2c')][_0x4a26('0x43')](_0x10d29e);})[_0x4a26('0x41')](function(_0x1950b7){_0x7688ab['rows']=_0x1950b7;return _0x7688ab;})['then'](respondWithFilteredResult(_0x2f4f6c,_0x10d29e))[_0x4a26('0x44')](handleError(_0x2f4f6c,null));};exports[_0x4a26('0x45')]=function(_0x11e5f7,_0x578cc1){var _0x4454a0={'raw':!![],'where':{'id':_0x11e5f7[_0x4a26('0x46')]['id']}},_0xb06ffa={};_0xb06ffa[_0x4a26('0x2f')]=_[_0x4a26('0x31')](db[_0x4a26('0x2c')][_0x4a26('0x2d')]);_0xb06ffa[_0x4a26('0x30')]=_[_0x4a26('0x31')](_0x11e5f7[_0x4a26('0x30')]);_0xb06ffa[_0x4a26('0x32')]=_[_0x4a26('0x33')](_0xb06ffa[_0x4a26('0x2f')],_0xb06ffa[_0x4a26('0x30')]);_0x4454a0[_0x4a26('0x34')]=_[_0x4a26('0x33')](_0xb06ffa[_0x4a26('0x2f')],qs[_0x4a26('0x35')](_0x11e5f7[_0x4a26('0x30')]['fields']));_0x4454a0[_0x4a26('0x34')]=_0x4454a0[_0x4a26('0x34')][_0x4a26('0x36')]?_0x4454a0[_0x4a26('0x34')]:_0xb06ffa[_0x4a26('0x2f')];if(_0x11e5f7[_0x4a26('0x30')][_0x4a26('0x42')]){_0x4454a0['include']=[{'all':!![]}];}_0x4454a0=_[_0x4a26('0x3d')]({},_0x4454a0,_0x11e5f7[_0x4a26('0x40')]);return db[_0x4a26('0x2c')][_0x4a26('0x47')](_0x4454a0)[_0x4a26('0x41')](handleEntityNotFound(_0x578cc1,null))['then'](respondWithResult(_0x578cc1,null))[_0x4a26('0x44')](handleError(_0x578cc1,null));};exports[_0x4a26('0x48')]=function(_0x111804,_0x3967b4){return db[_0x4a26('0x2c')][_0x4a26('0x48')](_0x111804[_0x4a26('0x49')],{})[_0x4a26('0x41')](respondWithResult(_0x3967b4,0xc9))['catch'](handleError(_0x3967b4,null));};exports[_0x4a26('0x24')]=function(_0x3fa488,_0x4d1b3e){if(_0x3fa488[_0x4a26('0x49')]['id']){delete _0x3fa488[_0x4a26('0x49')]['id'];}return db[_0x4a26('0x2c')][_0x4a26('0x47')]({'where':{'id':_0x3fa488[_0x4a26('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d1b3e,null))[_0x4a26('0x41')](saveUpdates(_0x3fa488['body'],null))[_0x4a26('0x41')](respondWithResult(_0x4d1b3e,null))['catch'](handleError(_0x4d1b3e,null));};exports['destroy']=function(_0x24b6d0,_0x4aad6e){return db['FaxTransferReport'][_0x4a26('0x47')]({'where':{'id':_0x24b6d0[_0x4a26('0x46')]['id']}})[_0x4a26('0x41')](handleEntityNotFound(_0x4aad6e,null))[_0x4a26('0x41')](removeEntity(_0x4aad6e,null))[_0x4a26('0x44')](handleError(_0x4aad6e,null));};exports['describe']=function(_0x57115f,_0x120dbc){return db[_0x4a26('0x2c')][_0x4a26('0x4a')]()['then'](respondWithResult(_0x120dbc,null))[_0x4a26('0x44')](handleError(_0x120dbc,null));}; \ No newline at end of file +var _0x1b99=['error','stack','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','name','query','filters','intersection','attributes','fields','length','model','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','then'];(function(_0x2c02bb,_0x4f32a4){var _0x35c7ae=function(_0x1d8dd2){while(--_0x1d8dd2){_0x2c02bb['push'](_0x2c02bb['shift']());}};_0x35c7ae(++_0x4f32a4);}(_0x1b99,0x6c));var _0x91b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1b99[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x91b9('0x0'));var rimraf=require(_0x91b9('0x1'));var zipdir=require(_0x91b9('0x2'));var jsonpatch=require(_0x91b9('0x3'));var rp=require(_0x91b9('0x4'));var moment=require(_0x91b9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91b9('0x6'));var util=require(_0x91b9('0x7'));var path=require(_0x91b9('0x8'));var sox=require(_0x91b9('0x9'));var csv=require(_0x91b9('0xa'));var ejs=require(_0x91b9('0xb'));var fs=require('fs');var fs_extra=require(_0x91b9('0xc'));var _=require(_0x91b9('0xd'));var squel=require('squel');var crypto=require(_0x91b9('0xe'));var jsforce=require(_0x91b9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x91b9('0xa'));var querystring=require(_0x91b9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x91b9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x91b9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91b9('0x13'))(_0x91b9('0x14'));var utils=require('../../config/utils');var config=require(_0x91b9('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e86f2,_0x480976){_0x480976=_0x480976||0xcc;return function(_0x53617e){if(_0x53617e){return _0x1e86f2[_0x91b9('0x16')](_0x480976);}return _0x1e86f2[_0x91b9('0x17')](_0x480976)['end']();};}function respondWithResult(_0x52bd9d,_0x365434){_0x365434=_0x365434||0xc8;return function(_0x354beb){if(_0x354beb){return _0x52bd9d[_0x91b9('0x17')](_0x365434)['json'](_0x354beb);}};}function respondWithFilteredResult(_0x3985a9,_0x53cfc8){return function(_0x5206b5){if(_0x5206b5){var _0x441fd3=typeof _0x53cfc8[_0x91b9('0x18')]===_0x91b9('0x19')&&typeof _0x53cfc8[_0x91b9('0x1a')]===_0x91b9('0x19');var _0x3c308c=_0x5206b5[_0x91b9('0x1b')];var _0x52dd65=_0x441fd3?0x0:_0x53cfc8[_0x91b9('0x18')];var _0x3241a3=_0x441fd3?_0x5206b5[_0x91b9('0x1b')]:_0x53cfc8['offset']+_0x53cfc8[_0x91b9('0x1a')];var _0x19d2c0;if(_0x3241a3>=_0x3c308c){_0x3241a3=_0x3c308c;_0x19d2c0=0xc8;}else{_0x19d2c0=0xce;}_0x3985a9['status'](_0x19d2c0);return _0x3985a9[_0x91b9('0x1c')]('Content-Range',_0x52dd65+'-'+_0x3241a3+'/'+_0x3c308c)[_0x91b9('0x1d')](_0x5206b5);}return null;};}function patchUpdates(_0x225114){return function(_0x16f2c6){try{jsonpatch[_0x91b9('0x1e')](_0x16f2c6,_0x225114,!![]);}catch(_0x247e1b){return BPromise[_0x91b9('0x1f')](_0x247e1b);}return _0x16f2c6[_0x91b9('0x20')]();};}function saveUpdates(_0x4813af,_0x1f04eb){return function(_0x1abb96){if(_0x1abb96){return _0x1abb96['update'](_0x4813af)[_0x91b9('0x21')](function(_0x27c526){return _0x27c526;});}return null;};}function removeEntity(_0x503aaf,_0x2b472f){return function(_0x5f00dd){if(_0x5f00dd){return _0x5f00dd['destroy']()[_0x91b9('0x21')](function(){_0x503aaf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f4933,_0x45194b){return function(_0x5caab1){if(!_0x5caab1){_0x4f4933[_0x91b9('0x16')](0x194);}return _0x5caab1;};}function handleError(_0x349323,_0x460fce){_0x460fce=_0x460fce||0x1f4;return function(_0x49df91){logger[_0x91b9('0x22')](_0x49df91[_0x91b9('0x23')]);if(_0x49df91['name']){delete _0x49df91['name'];}_0x349323['status'](_0x460fce)[_0x91b9('0x24')](_0x49df91);};}exports['index']=function(_0x32226b,_0x5479f9){var _0x221a51={},_0xb27f7e={},_0x148393={'count':0x0,'rows':[]};var _0x491a6d=_[_0x91b9('0x25')](db[_0x91b9('0x26')][_0x91b9('0x27')],function(_0x248cbf){return{'name':_0x248cbf[_0x91b9('0x28')],'type':_0x248cbf[_0x91b9('0x29')][_0x91b9('0x2a')]};});_0xb27f7e['model']=_['map'](_0x491a6d,_0x91b9('0x2b'));_0xb27f7e[_0x91b9('0x2c')]=_['keys'](_0x32226b[_0x91b9('0x2c')]);_0xb27f7e[_0x91b9('0x2d')]=_[_0x91b9('0x2e')](_0xb27f7e['model'],_0xb27f7e[_0x91b9('0x2c')]);_0x221a51[_0x91b9('0x2f')]=_[_0x91b9('0x2e')](_0xb27f7e['model'],qs[_0x91b9('0x30')](_0x32226b[_0x91b9('0x2c')][_0x91b9('0x30')]));_0x221a51[_0x91b9('0x2f')]=_0x221a51[_0x91b9('0x2f')][_0x91b9('0x31')]?_0x221a51[_0x91b9('0x2f')]:_0xb27f7e[_0x91b9('0x32')];if(!_0x32226b[_0x91b9('0x2c')]['hasOwnProperty']('nolimit')){_0x221a51['limit']=qs[_0x91b9('0x1a')](_0x32226b[_0x91b9('0x2c')]['limit']);_0x221a51['offset']=qs['offset'](_0x32226b[_0x91b9('0x2c')][_0x91b9('0x18')]);}_0x221a51['order']=qs['sort'](_0x32226b[_0x91b9('0x2c')][_0x91b9('0x33')]);_0x221a51[_0x91b9('0x34')]=qs[_0x91b9('0x2d')](_[_0x91b9('0x35')](_0x32226b[_0x91b9('0x2c')],_0xb27f7e[_0x91b9('0x2d')]),_0x491a6d);if(_0x32226b[_0x91b9('0x2c')][_0x91b9('0x36')]){_0x221a51['where']=_[_0x91b9('0x37')](_0x221a51[_0x91b9('0x34')],{'$or':_[_0x91b9('0x25')](_0x491a6d,function(_0x5729cb){if(_0x5729cb[_0x91b9('0x29')]!==_0x91b9('0x38')){var _0x374960={};_0x374960[_0x5729cb['name']]={'$like':'%'+_0x32226b[_0x91b9('0x2c')][_0x91b9('0x36')]+'%'};return _0x374960;}})});}_0x221a51=_[_0x91b9('0x37')]({},_0x221a51,_0x32226b[_0x91b9('0x39')]);var _0x361ebd={'where':_0x221a51[_0x91b9('0x34')]};return db['FaxTransferReport'][_0x91b9('0x1b')](_0x361ebd)[_0x91b9('0x21')](function(_0x376060){_0x148393[_0x91b9('0x1b')]=_0x376060;if(_0x32226b['query'][_0x91b9('0x3a')]){_0x221a51['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x91b9('0x3b')](_0x221a51);})[_0x91b9('0x21')](function(_0x2fb57d){_0x148393[_0x91b9('0x3c')]=_0x2fb57d;return _0x148393;})[_0x91b9('0x21')](respondWithFilteredResult(_0x5479f9,_0x221a51))[_0x91b9('0x3d')](handleError(_0x5479f9,null));};exports[_0x91b9('0x3e')]=function(_0xfafe8c,_0x29f984){var _0x5029ce={'raw':!![],'where':{'id':_0xfafe8c['params']['id']}},_0x359dc7={};_0x359dc7[_0x91b9('0x32')]=_[_0x91b9('0x3f')](db[_0x91b9('0x26')][_0x91b9('0x27')]);_0x359dc7[_0x91b9('0x2c')]=_[_0x91b9('0x3f')](_0xfafe8c[_0x91b9('0x2c')]);_0x359dc7[_0x91b9('0x2d')]=_[_0x91b9('0x2e')](_0x359dc7[_0x91b9('0x32')],_0x359dc7[_0x91b9('0x2c')]);_0x5029ce[_0x91b9('0x2f')]=_[_0x91b9('0x2e')](_0x359dc7[_0x91b9('0x32')],qs[_0x91b9('0x30')](_0xfafe8c[_0x91b9('0x2c')][_0x91b9('0x30')]));_0x5029ce[_0x91b9('0x2f')]=_0x5029ce[_0x91b9('0x2f')][_0x91b9('0x31')]?_0x5029ce[_0x91b9('0x2f')]:_0x359dc7['model'];if(_0xfafe8c['query'][_0x91b9('0x3a')]){_0x5029ce[_0x91b9('0x40')]=[{'all':!![]}];}_0x5029ce=_[_0x91b9('0x37')]({},_0x5029ce,_0xfafe8c[_0x91b9('0x39')]);return db[_0x91b9('0x26')][_0x91b9('0x41')](_0x5029ce)[_0x91b9('0x21')](handleEntityNotFound(_0x29f984,null))[_0x91b9('0x21')](respondWithResult(_0x29f984,null))[_0x91b9('0x3d')](handleError(_0x29f984,null));};exports['create']=function(_0x49203b,_0x42b25d){return db[_0x91b9('0x26')][_0x91b9('0x42')](_0x49203b[_0x91b9('0x43')],{})['then'](respondWithResult(_0x42b25d,0xc9))['catch'](handleError(_0x42b25d,null));};exports[_0x91b9('0x44')]=function(_0x20071e,_0x2ecbb3){if(_0x20071e[_0x91b9('0x43')]['id']){delete _0x20071e['body']['id'];}return db[_0x91b9('0x26')][_0x91b9('0x41')]({'where':{'id':_0x20071e[_0x91b9('0x45')]['id']}})[_0x91b9('0x21')](handleEntityNotFound(_0x2ecbb3,null))[_0x91b9('0x21')](saveUpdates(_0x20071e[_0x91b9('0x43')],null))['then'](respondWithResult(_0x2ecbb3,null))[_0x91b9('0x3d')](handleError(_0x2ecbb3,null));};exports['destroy']=function(_0x59d74f,_0x19673f){return db[_0x91b9('0x26')][_0x91b9('0x41')]({'where':{'id':_0x59d74f[_0x91b9('0x45')]['id']}})[_0x91b9('0x21')](handleEntityNotFound(_0x19673f,null))[_0x91b9('0x21')](removeEntity(_0x19673f,null))[_0x91b9('0x3d')](handleError(_0x19673f,null));};exports[_0x91b9('0x46')]=function(_0x3d35f1,_0x413810){return db[_0x91b9('0x26')]['describe']()[_0x91b9('0x21')](respondWithResult(_0x413810,null))[_0x91b9('0x3d')](handleError(_0x413810,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index f5f95f8..080929b 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 _0x0715=['bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x0715,0x1f4));var _0x5071=function(_0x4380d2,_0x5ba89b){_0x4380d2=_0x4380d2-0x0;var _0x4b4abd=_0x0715[_0x4380d2];return _0x4b4abd;};'use strict';var _=require('lodash');var util=require(_0x5071('0x0'));var logger=require(_0x5071('0x1'))(_0x5071('0x2'));var moment=require(_0x5071('0x3'));var BPromise=require(_0x5071('0x4'));var rp=require(_0x5071('0x5'));var fs=require('fs');var path=require(_0x5071('0x6'));var rimraf=require(_0x5071('0x7'));var config=require('../../config/environment');var attributes=require(_0x5071('0x8'));module[_0x5071('0x9')]=function(_0x439932,_0x11466a){return _0x439932[_0x5071('0xa')](_0x5071('0xb'),attributes,{'tableName':_0x5071('0xc'),'paranoid':![],'indexes':[{'name':_0x5071('0xd'),'fields':[_0x5071('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb503=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x1c7bc6,_0x5f4af6){var _0x14c2d5=function(_0x27e571){while(--_0x27e571){_0x1c7bc6['push'](_0x1c7bc6['shift']());}};_0x14c2d5(++_0x5f4af6);}(_0xb503,0x161));var _0x3b50=function(_0x78b607,_0x5801c1){_0x78b607=_0x78b607-0x0;var _0x585bdd=_0xb503[_0x78b607];return _0x585bdd;};'use strict';var _=require(_0x3b50('0x0'));var util=require(_0x3b50('0x1'));var logger=require(_0x3b50('0x2'))(_0x3b50('0x3'));var moment=require(_0x3b50('0x4'));var BPromise=require(_0x3b50('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3b50('0x6'));var config=require(_0x3b50('0x7'));var attributes=require(_0x3b50('0x8'));module[_0x3b50('0x9')]=function(_0x13c98d,_0x158013){return _0x13c98d[_0x3b50('0xa')]('FaxTransferReport',attributes,{'tableName':_0x3b50('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3b50('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index d41f6af..ae2259e 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 _0x40bf=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x27a283,_0x2fe54a){var _0x255f0e=function(_0x45a784){while(--_0x45a784){_0x27a283['push'](_0x27a283['shift']());}};_0x255f0e(++_0x2fe54a);}(_0x40bf,0x126));var _0xf40b=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x40bf[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0xf40b('0x0'));var util=require('util');var moment=require(_0xf40b('0x1'));var BPromise=require('bluebird');var rs=require(_0xf40b('0x2'));var fs=require('fs');var Redis=require(_0xf40b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf40b('0x4'));var logger=require(_0xf40b('0x5'))(_0xf40b('0x6'));var config=require(_0xf40b('0x7'));var jayson=require(_0xf40b('0x8'));var client=jayson[_0xf40b('0x9')][_0xf40b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38bf33,_0x190bb1,_0x3d9bb6){return new BPromise(function(_0x4509ef,_0x2534e2){return client['request'](_0x38bf33,_0x3d9bb6)['then'](function(_0x20d5f1){logger['info'](_0xf40b('0xb'),_0x190bb1,_0xf40b('0xc'));logger[_0xf40b('0xd')](_0xf40b('0xe'),_0x190bb1,'request\x20sent',JSON['stringify'](_0x20d5f1));if(_0x20d5f1[_0xf40b('0xf')]){if(_0x20d5f1[_0xf40b('0xf')][_0xf40b('0x10')]===0x1f4){logger[_0xf40b('0xf')](_0xf40b('0xb'),_0x190bb1,_0x20d5f1[_0xf40b('0xf')]['message']);return _0x2534e2(_0x20d5f1[_0xf40b('0xf')][_0xf40b('0x11')]);}logger[_0xf40b('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x190bb1,_0x20d5f1[_0xf40b('0xf')][_0xf40b('0x11')]);return _0x4509ef(_0x20d5f1[_0xf40b('0xf')][_0xf40b('0x11')]);}else{logger[_0xf40b('0x12')](_0xf40b('0xb'),_0x190bb1,'request\x20sent');_0x4509ef(_0x20d5f1[_0xf40b('0x13')][_0xf40b('0x11')]);}})[_0xf40b('0x14')](function(_0x410c43){logger['error'](_0xf40b('0xb'),_0x190bb1,_0x410c43);_0x2534e2(_0x410c43);});});} \ No newline at end of file +var _0xaf8b=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','info','FaxTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x5612a1,_0x2d78f9){var _0x5655cc=function(_0x386588){while(--_0x386588){_0x5612a1['push'](_0x5612a1['shift']());}};_0x5655cc(++_0x2d78f9);}(_0xaf8b,0x1cb));var _0xbaf8=function(_0x3e2516,_0x283803){_0x3e2516=_0x3e2516-0x0;var _0x4d4fc3=_0xaf8b[_0x3e2516];return _0x4d4fc3;};'use strict';var _=require(_0xbaf8('0x0'));var util=require(_0xbaf8('0x1'));var moment=require(_0xbaf8('0x2'));var BPromise=require(_0xbaf8('0x3'));var rs=require(_0xbaf8('0x4'));var fs=require('fs');var Redis=require(_0xbaf8('0x5'));var db=require(_0xbaf8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbaf8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbaf8('0x8'));var client=jayson[_0xbaf8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45a24d,_0x152b35,_0x1fe0ff){return new BPromise(function(_0x39c455,_0x31c4b5){return client['request'](_0x45a24d,_0x1fe0ff)['then'](function(_0x459376){logger[_0xbaf8('0xa')](_0xbaf8('0xb'),_0x152b35,'request\x20sent');logger[_0xbaf8('0xc')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x152b35,_0xbaf8('0xd'),JSON['stringify'](_0x459376));if(_0x459376['error']){if(_0x459376[_0xbaf8('0xe')][_0xbaf8('0xf')]===0x1f4){logger[_0xbaf8('0xe')](_0xbaf8('0xb'),_0x152b35,_0x459376['error'][_0xbaf8('0x10')]);return _0x31c4b5(_0x459376[_0xbaf8('0xe')][_0xbaf8('0x10')]);}logger[_0xbaf8('0xe')](_0xbaf8('0xb'),_0x152b35,_0x459376[_0xbaf8('0xe')]['message']);return _0x39c455(_0x459376[_0xbaf8('0xe')][_0xbaf8('0x10')]);}else{logger['info'](_0xbaf8('0xb'),_0x152b35,_0xbaf8('0xd'));_0x39c455(_0x459376[_0xbaf8('0x11')][_0xbaf8('0x10')]);}})[_0xbaf8('0x12')](function(_0x4426bc){logger['error'](_0xbaf8('0xb'),_0x152b35,_0x4426bc);_0x31c4b5(_0x4426bc);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2861ac2..54ae9b0 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 _0x3ae2=['index','isAuthenticated','describe','/:id','show','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x3ae2,0x7f));var _0x23ae=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0x3ae2[_0x333798];return _0x389f4e;};'use strict';var multer=require('multer');var util=require(_0x23ae('0x0'));var path=require(_0x23ae('0x1'));var timeout=require(_0x23ae('0x2'));var express=require(_0x23ae('0x3'));var router=express[_0x23ae('0x4')]();var fs_extra=require(_0x23ae('0x5'));var auth=require(_0x23ae('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x23ae('0x7'));var controller=require('./faxTransferReport.controller');router[_0x23ae('0x8')]('/',auth['isAuthenticated'](),controller[_0x23ae('0x9')]);router[_0x23ae('0x8')]('/describe',auth[_0x23ae('0xa')](),controller[_0x23ae('0xb')]);router[_0x23ae('0x8')](_0x23ae('0xc'),auth[_0x23ae('0xa')](),controller[_0x23ae('0xd')]);router['post']('/',auth[_0x23ae('0xa')](),controller['create']);router[_0x23ae('0xe')](_0x23ae('0xc'),auth[_0x23ae('0xa')](),controller['update']);router[_0x23ae('0xf')](_0x23ae('0xc'),auth[_0x23ae('0xa')](),controller[_0x23ae('0x10')]);module['exports']=router; \ No newline at end of file +var _0xda37=['show','post','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id'];(function(_0x95a136,_0x47dc90){var _0x72d60b=function(_0x11b8a1){while(--_0x11b8a1){_0x95a136['push'](_0x95a136['shift']());}};_0x72d60b(++_0x47dc90);}(_0xda37,0xd1));var _0x7da3=function(_0x432a71,_0x44296e){_0x432a71=_0x432a71-0x0;var _0x25fdba=_0xda37[_0x432a71];return _0x25fdba;};'use strict';var multer=require(_0x7da3('0x0'));var util=require('util');var path=require(_0x7da3('0x1'));var timeout=require(_0x7da3('0x2'));var express=require(_0x7da3('0x3'));var router=express['Router']();var fs_extra=require(_0x7da3('0x4'));var auth=require(_0x7da3('0x5'));var interaction=require(_0x7da3('0x6'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x7da3('0x7')]('/',auth[_0x7da3('0x8')](),controller['index']);router[_0x7da3('0x7')](_0x7da3('0x9'),auth[_0x7da3('0x8')](),controller[_0x7da3('0xa')]);router['get'](_0x7da3('0xb'),auth[_0x7da3('0x8')](),controller[_0x7da3('0xc')]);router[_0x7da3('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x7da3('0x8')](),controller['update']);router[_0x7da3('0xe')](_0x7da3('0xb'),auth['isAuthenticated'](),controller[_0x7da3('0xf')]);module[_0x7da3('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 6e44fde..1e66eb2 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 _0x3185=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports'];(function(_0x17ba7d,_0x3d1ace){var _0x8fd171=function(_0xc08d1f){while(--_0xc08d1f){_0x17ba7d['push'](_0x17ba7d['shift']());}};_0x8fd171(++_0x3d1ace);}(_0x3185,0x177));var _0x5318=function(_0xbdd98b,_0x4d4052){_0xbdd98b=_0xbdd98b-0x0;var _0x37ee6e=_0x3185[_0xbdd98b];return _0x37ee6e;};'use strict';var multer=require(_0x5318('0x0'));var util=require(_0x5318('0x1'));var path=require(_0x5318('0x2'));var timeout=require(_0x5318('0x3'));var express=require(_0x5318('0x4'));var router=express[_0x5318('0x5')]();var fs_extra=require(_0x5318('0x6'));var auth=require(_0x5318('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5318('0x8'));var controller=require(_0x5318('0x9'));router[_0x5318('0xa')]('/',auth[_0x5318('0xb')](),controller['index']);router[_0x5318('0xa')](_0x5318('0xc'),auth['isAuthenticated'](),controller[_0x5318('0xd')]);router[_0x5318('0xa')](_0x5318('0xe'),auth['isAuthenticated'](),controller[_0x5318('0xf')]);router[_0x5318('0xa')](_0x5318('0x10'),auth[_0x5318('0xb')](),controller[_0x5318('0x11')]);router[_0x5318('0x12')]('/',auth[_0x5318('0xb')](),controller[_0x5318('0x13')]);router['post'](_0x5318('0xe'),auth[_0x5318('0xb')](),controller[_0x5318('0x14')]);router[_0x5318('0x15')](_0x5318('0xc'),auth[_0x5318('0xb')](),controller['update']);router[_0x5318('0x16')](_0x5318('0xc'),auth['isAuthenticated'](),controller[_0x5318('0x17')]);module[_0x5318('0x18')]=router; \ No newline at end of file +var _0xb7d9=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','path'];(function(_0x583876,_0x51a46e){var _0x2feda9=function(_0x323f49){while(--_0x323f49){_0x583876['push'](_0x583876['shift']());}};_0x2feda9(++_0x51a46e);}(_0xb7d9,0xb3));var _0x9b7d=function(_0x321c52,_0x268c2a){_0x321c52=_0x321c52-0x0;var _0x1f1c39=_0xb7d9[_0x321c52];return _0x1f1c39;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9b7d('0x0'));var timeout=require(_0x9b7d('0x1'));var express=require(_0x9b7d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9b7d('0x3'));var interaction=require(_0x9b7d('0x4'));var config=require(_0x9b7d('0x5'));var controller=require(_0x9b7d('0x6'));router['get']('/',auth[_0x9b7d('0x7')](),controller['index']);router['get']('/:id',auth[_0x9b7d('0x7')](),controller['show']);router[_0x9b7d('0x8')](_0x9b7d('0x9'),auth[_0x9b7d('0x7')](),controller[_0x9b7d('0xa')]);router[_0x9b7d('0x8')](_0x9b7d('0xb'),auth[_0x9b7d('0x7')](),controller[_0x9b7d('0xc')]);router[_0x9b7d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9b7d('0xd')](_0x9b7d('0x9'),auth[_0x9b7d('0x7')](),controller[_0x9b7d('0xe')]);router[_0x9b7d('0xf')](_0x9b7d('0x10'),auth['isAuthenticated'](),controller[_0x9b7d('0x11')]);router[_0x9b7d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9b7d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 53d8d2e..730d259 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 _0x94cf=['newTab','integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x1bfc4c,_0x13383e){var _0x141d23=function(_0x15a68c){while(--_0x15a68c){_0x1bfc4c['push'](_0x1bfc4c['shift']());}};_0x141d23(++_0x13383e);}(_0x94cf,0xb8));var _0xf94c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94cf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf94c('0x0'));module[_0xf94c('0x1')]={'name':{'type':Sequelize[_0xf94c('0x2')]},'description':{'type':Sequelize[_0xf94c('0x2')]},'username':{'type':Sequelize[_0xf94c('0x2')]},'remoteUri':{'type':Sequelize[_0xf94c('0x2')]},'authType':{'type':Sequelize[_0xf94c('0x3')](_0xf94c('0x4')),'defaultValue':_0xf94c('0x4')},'password':{'type':Sequelize[_0xf94c('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xf94c('0x2')]},'token':{'type':Sequelize[_0xf94c('0x2')]},'tokenSecret':{'type':Sequelize[_0xf94c('0x2')]},'serverUrl':{'type':Sequelize[_0xf94c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf94c('0x3')]('integrationTab',_0xf94c('0x5')),'defaultValue':_0xf94c('0x6')}}; \ No newline at end of file +var _0x1a0a=['sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x4fc6ac,_0x150650){var _0xd05d46=function(_0x3b977b){while(--_0x3b977b){_0x4fc6ac['push'](_0x4fc6ac['shift']());}};_0xd05d46(++_0x150650);}(_0x1a0a,0x90));var _0xa1a0=function(_0x794cdc,_0x59809d){_0x794cdc=_0x794cdc-0x0;var _0x4a65a6=_0x1a0a[_0x794cdc];return _0x4a65a6;};'use strict';var Sequelize=require(_0xa1a0('0x0'));module[_0xa1a0('0x1')]={'name':{'type':Sequelize[_0xa1a0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa1a0('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xa1a0('0x3')](_0xa1a0('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xa1a0('0x2')]},'consumerSecret':{'type':Sequelize[_0xa1a0('0x2')]},'token':{'type':Sequelize[_0xa1a0('0x2')]},'tokenSecret':{'type':Sequelize[_0xa1a0('0x2')]},'serverUrl':{'type':Sequelize[_0xa1a0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa1a0('0x3')](_0xa1a0('0x5'),'newTab'),'defaultValue':_0xa1a0('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 9cfbcdd..bef18c7 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 _0xd1e2=['findAll','rows','catch','show','params','length','find','body','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','DeskField','getFields','priority','remoteUri','authType','token','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Basic\x20%s','%s:%s','username','password','toString','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x4b49c9,_0x290d55){var _0xab2d67=function(_0x3a8e9c){while(--_0x3a8e9c){_0x4b49c9['push'](_0x4b49c9['shift']());}};_0xab2d67(++_0x290d55);}(_0xd1e2,0x9f));var _0x2d1e=function(_0x3c0c5d,_0x5e4829){_0x3c0c5d=_0x3c0c5d-0x0;var _0x2b9552=_0xd1e2[_0x3c0c5d];return _0x2b9552;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d1e('0x0'));var rp=require(_0x2d1e('0x1'));var moment=require('moment');var BPromise=require(_0x2d1e('0x2'));var Mustache=require(_0x2d1e('0x3'));var util=require(_0x2d1e('0x4'));var path=require(_0x2d1e('0x5'));var sox=require(_0x2d1e('0x6'));var csv=require(_0x2d1e('0x7'));var ejs=require(_0x2d1e('0x8'));var fs=require('fs');var fs_extra=require(_0x2d1e('0x9'));var _=require(_0x2d1e('0xa'));var squel=require('squel');var crypto=require(_0x2d1e('0xb'));var jsforce=require(_0x2d1e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2d1e('0xd'));var Papa=require(_0x2d1e('0xe'));var Redis=require(_0x2d1e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d1e('0x10'));var hardwareService=require(_0x2d1e('0x11'));var logger=require(_0x2d1e('0x12'))(_0x2d1e('0x13'));var utils=require(_0x2d1e('0x14'));var config=require(_0x2d1e('0x15'));var licenseUtil=require(_0x2d1e('0x16'));var db=require(_0x2d1e('0x17'))['db'];var integrations=require(_0x2d1e('0x18'));function respondWithStatusCode(_0xa8e634,_0x417a18){_0x417a18=_0x417a18||0xcc;return function(_0x141ecc){if(_0x141ecc){return _0xa8e634['sendStatus'](_0x417a18);}return _0xa8e634[_0x2d1e('0x19')](_0x417a18)[_0x2d1e('0x1a')]();};}function respondWithResult(_0x4e2697,_0x6b3b57){_0x6b3b57=_0x6b3b57||0xc8;return function(_0x1485af){if(_0x1485af){return _0x4e2697[_0x2d1e('0x19')](_0x6b3b57)[_0x2d1e('0x1b')](_0x1485af);}};}function respondWithFilteredResult(_0x730699,_0x3a8aa4){return function(_0x191032){if(_0x191032){var _0x2f4e4b=typeof _0x3a8aa4['offset']==='undefined'&&typeof _0x3a8aa4[_0x2d1e('0x1c')]==='undefined';var _0x1dba1d=_0x191032['count'];var _0x536178=_0x2f4e4b?0x0:_0x3a8aa4['offset'];var _0x5e8b6c=_0x2f4e4b?_0x191032[_0x2d1e('0x1d')]:_0x3a8aa4['offset']+_0x3a8aa4[_0x2d1e('0x1c')];var _0x1ff05e;if(_0x5e8b6c>=_0x1dba1d){_0x5e8b6c=_0x1dba1d;_0x1ff05e=0xc8;}else{_0x1ff05e=0xce;}_0x730699[_0x2d1e('0x19')](_0x1ff05e);return _0x730699[_0x2d1e('0x1e')](_0x2d1e('0x1f'),_0x536178+'-'+_0x5e8b6c+'/'+_0x1dba1d)[_0x2d1e('0x1b')](_0x191032);}return null;};}function patchUpdates(_0x34fbae){return function(_0x648cb7){try{jsonpatch[_0x2d1e('0x20')](_0x648cb7,_0x34fbae,!![]);}catch(_0x363d64){return BPromise[_0x2d1e('0x21')](_0x363d64);}return _0x648cb7['save']();};}function saveUpdates(_0x2ba5ff,_0x38f71d){return function(_0x266906){if(_0x266906){return _0x266906[_0x2d1e('0x22')](_0x2ba5ff)[_0x2d1e('0x23')](function(_0x33051e){return _0x33051e;});}return null;};}function removeEntity(_0x53bbec,_0x33cdd7){return function(_0x147d88){if(_0x147d88){return _0x147d88[_0x2d1e('0x24')]()['then'](function(){_0x53bbec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x156c30,_0x19013f){return function(_0x33c826){if(!_0x33c826){_0x156c30[_0x2d1e('0x25')](0x194);}return _0x33c826;};}function handleError(_0x4a5077,_0x4f60a5){_0x4f60a5=_0x4f60a5||0x1f4;return function(_0x4786d0){logger['error'](_0x4786d0[_0x2d1e('0x26')]);if(_0x4786d0[_0x2d1e('0x27')]){delete _0x4786d0[_0x2d1e('0x27')];}_0x4a5077[_0x2d1e('0x19')](_0x4f60a5)[_0x2d1e('0x28')](_0x4786d0);};}exports[_0x2d1e('0x29')]=function(_0x51a8a0,_0x11054f){var _0x45f39a={},_0x915247={},_0x523be1={'count':0x0,'rows':[]};var _0x55d6d5=_[_0x2d1e('0x2a')](db[_0x2d1e('0x2b')][_0x2d1e('0x2c')],function(_0x2acf43){return{'name':_0x2acf43['fieldName'],'type':_0x2acf43[_0x2d1e('0x2d')][_0x2d1e('0x2e')]};});_0x915247[_0x2d1e('0x2f')]=_[_0x2d1e('0x2a')](_0x55d6d5,'name');_0x915247[_0x2d1e('0x30')]=_[_0x2d1e('0x31')](_0x51a8a0['query']);_0x915247[_0x2d1e('0x32')]=_[_0x2d1e('0x33')](_0x915247[_0x2d1e('0x2f')],_0x915247[_0x2d1e('0x30')]);_0x45f39a['attributes']=_['intersection'](_0x915247[_0x2d1e('0x2f')],qs['fields'](_0x51a8a0[_0x2d1e('0x30')][_0x2d1e('0x34')]));_0x45f39a[_0x2d1e('0x35')]=_0x45f39a['attributes']['length']?_0x45f39a[_0x2d1e('0x35')]:_0x915247[_0x2d1e('0x2f')];if(!_0x51a8a0[_0x2d1e('0x30')][_0x2d1e('0x36')](_0x2d1e('0x37'))){_0x45f39a[_0x2d1e('0x1c')]=qs[_0x2d1e('0x1c')](_0x51a8a0[_0x2d1e('0x30')]['limit']);_0x45f39a['offset']=qs[_0x2d1e('0x38')](_0x51a8a0[_0x2d1e('0x30')][_0x2d1e('0x38')]);}_0x45f39a[_0x2d1e('0x39')]=qs[_0x2d1e('0x3a')](_0x51a8a0['query'][_0x2d1e('0x3a')]);_0x45f39a[_0x2d1e('0x3b')]=qs[_0x2d1e('0x32')](_[_0x2d1e('0x3c')](_0x51a8a0[_0x2d1e('0x30')],_0x915247[_0x2d1e('0x32')]),_0x55d6d5);if(_0x51a8a0[_0x2d1e('0x30')]['filter']){_0x45f39a[_0x2d1e('0x3b')]=_[_0x2d1e('0x3d')](_0x45f39a[_0x2d1e('0x3b')],{'$or':_[_0x2d1e('0x2a')](_0x55d6d5,function(_0x15cc1e){if(_0x15cc1e[_0x2d1e('0x2d')]!==_0x2d1e('0x3e')){var _0x497c86={};_0x497c86[_0x15cc1e[_0x2d1e('0x27')]]={'$like':'%'+_0x51a8a0[_0x2d1e('0x30')][_0x2d1e('0x3f')]+'%'};return _0x497c86;}})});}_0x45f39a=_[_0x2d1e('0x3d')]({},_0x45f39a,_0x51a8a0[_0x2d1e('0x40')]);var _0x3be758={'where':_0x45f39a[_0x2d1e('0x3b')]};return db[_0x2d1e('0x2b')][_0x2d1e('0x1d')](_0x3be758)[_0x2d1e('0x23')](function(_0x37cc5c){_0x523be1[_0x2d1e('0x1d')]=_0x37cc5c;if(_0x51a8a0[_0x2d1e('0x30')][_0x2d1e('0x41')]){_0x45f39a[_0x2d1e('0x42')]=[{'all':!![]}];}return db[_0x2d1e('0x2b')][_0x2d1e('0x43')](_0x45f39a);})['then'](function(_0x1a8dda){_0x523be1[_0x2d1e('0x44')]=_0x1a8dda;return _0x523be1;})[_0x2d1e('0x23')](respondWithFilteredResult(_0x11054f,_0x45f39a))[_0x2d1e('0x45')](handleError(_0x11054f,null));};exports[_0x2d1e('0x46')]=function(_0x343dc0,_0x35cac2){var _0x3ca236={'raw':![],'where':{'id':_0x343dc0[_0x2d1e('0x47')]['id']}},_0x328632={};_0x328632[_0x2d1e('0x2f')]=_[_0x2d1e('0x31')](db[_0x2d1e('0x2b')][_0x2d1e('0x2c')]);_0x328632[_0x2d1e('0x30')]=_[_0x2d1e('0x31')](_0x343dc0[_0x2d1e('0x30')]);_0x328632['filters']=_[_0x2d1e('0x33')](_0x328632[_0x2d1e('0x2f')],_0x328632['query']);_0x3ca236[_0x2d1e('0x35')]=_[_0x2d1e('0x33')](_0x328632['model'],qs['fields'](_0x343dc0[_0x2d1e('0x30')][_0x2d1e('0x34')]));_0x3ca236[_0x2d1e('0x35')]=_0x3ca236['attributes'][_0x2d1e('0x48')]?_0x3ca236[_0x2d1e('0x35')]:_0x328632[_0x2d1e('0x2f')];if(_0x343dc0[_0x2d1e('0x30')]['includeAll']){_0x3ca236[_0x2d1e('0x42')]=[{'all':!![]}];}_0x3ca236=_[_0x2d1e('0x3d')]({},_0x3ca236,_0x343dc0[_0x2d1e('0x40')]);return db[_0x2d1e('0x2b')][_0x2d1e('0x49')](_0x3ca236)[_0x2d1e('0x23')](handleEntityNotFound(_0x35cac2,null))[_0x2d1e('0x23')](respondWithResult(_0x35cac2,null))['catch'](handleError(_0x35cac2,null));};exports['create']=function(_0xb95e2,_0xa7f114){return db[_0x2d1e('0x2b')]['create'](_0xb95e2['body'],{})[_0x2d1e('0x23')](respondWithResult(_0xa7f114,0xc9))[_0x2d1e('0x45')](handleError(_0xa7f114,null));};exports[_0x2d1e('0x22')]=function(_0x1ca52e,_0x9c78d7){if(_0x1ca52e['body']['id']){delete _0x1ca52e[_0x2d1e('0x4a')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x1ca52e['params']['id']}})[_0x2d1e('0x23')](handleEntityNotFound(_0x9c78d7,null))[_0x2d1e('0x23')](saveUpdates(_0x1ca52e[_0x2d1e('0x4a')],null))[_0x2d1e('0x23')](respondWithResult(_0x9c78d7,null))[_0x2d1e('0x45')](handleError(_0x9c78d7,null));};exports[_0x2d1e('0x24')]=function(_0x29f85f,_0x3f9cde){return db['DeskAccount'][_0x2d1e('0x49')]({'where':{'id':_0x29f85f[_0x2d1e('0x47')]['id']}})[_0x2d1e('0x23')](handleEntityNotFound(_0x3f9cde,null))[_0x2d1e('0x23')](removeEntity(_0x3f9cde,null))['catch'](handleError(_0x3f9cde,null));};exports['getConfigurations']=function(_0x672ccb,_0x22b2e0,_0x73b2c4){var _0x433595={};var _0x55dc77={};var _0x3f7b64;var _0x10e13c;return db['DeskAccount']['findOne']({'where':{'id':_0x672ccb['params']['id']}})[_0x2d1e('0x23')](handleEntityNotFound(_0x22b2e0,null))[_0x2d1e('0x23')](function(_0x399f96){if(_0x399f96){_0x3f7b64=_0x399f96;_0x55dc77[_0x2d1e('0x2f')]=_[_0x2d1e('0x31')](db['DeskConfiguration']['rawAttributes']);_0x55dc77[_0x2d1e('0x30')]=_[_0x2d1e('0x31')](_0x672ccb['query']);_0x55dc77['filters']=_[_0x2d1e('0x33')](_0x55dc77[_0x2d1e('0x2f')],_0x55dc77[_0x2d1e('0x30')]);_0x433595[_0x2d1e('0x35')]=_[_0x2d1e('0x33')](_0x55dc77[_0x2d1e('0x2f')],qs[_0x2d1e('0x34')](_0x672ccb[_0x2d1e('0x30')]['fields']));_0x433595[_0x2d1e('0x35')]=_0x433595[_0x2d1e('0x35')][_0x2d1e('0x48')]?_0x433595[_0x2d1e('0x35')]:_0x55dc77[_0x2d1e('0x2f')];_0x433595['order']=qs['sort'](_0x672ccb[_0x2d1e('0x30')]['sort']);_0x433595[_0x2d1e('0x3b')]=qs[_0x2d1e('0x32')](_[_0x2d1e('0x3c')](_0x672ccb[_0x2d1e('0x30')],_0x55dc77[_0x2d1e('0x32')]));if(_0x672ccb['query'][_0x2d1e('0x3f')]){_0x433595[_0x2d1e('0x3b')]=_['merge'](_0x433595[_0x2d1e('0x3b')],{'$or':_['map'](_0x433595[_0x2d1e('0x35')],function(_0x3ad519){var _0x521c04={};_0x521c04[_0x3ad519]={'$like':'%'+_0x672ccb[_0x2d1e('0x30')][_0x2d1e('0x3f')]+'%'};return _0x521c04;})});}_0x433595=_[_0x2d1e('0x3d')]({},_0x433595,_0x672ccb[_0x2d1e('0x40')]);return _0x3f7b64[_0x2d1e('0x4b')](_0x433595);}})[_0x2d1e('0x23')](function(_0x3c83ff){if(_0x3c83ff){_0x10e13c=_0x3c83ff[_0x2d1e('0x48')];if(!_0x672ccb[_0x2d1e('0x30')][_0x2d1e('0x36')](_0x2d1e('0x37'))){_0x433595[_0x2d1e('0x1c')]=qs[_0x2d1e('0x1c')](_0x672ccb[_0x2d1e('0x30')]['limit']);_0x433595['offset']=qs['offset'](_0x672ccb['query']['offset']);}return _0x3f7b64[_0x2d1e('0x4b')](_0x433595);}})[_0x2d1e('0x23')](function(_0x3cd137){if(_0x3cd137){return _0x3cd137?{'count':_0x10e13c,'rows':_0x3cd137}:null;}})[_0x2d1e('0x23')](respondWithResult(_0x22b2e0,null))['catch'](handleError(_0x22b2e0,null));};exports['addConfiguration']=function(_0x1d092f,_0x319df8,_0x1363ca){if(_0x1d092f['body']['id']){delete _0x1d092f['body']['id'];}return db[_0x2d1e('0x2b')][_0x2d1e('0x4c')]({'where':{'id':_0x1d092f['params']['id']}})[_0x2d1e('0x23')](handleEntityNotFound(_0x319df8,null))[_0x2d1e('0x23')](function(_0x1fdb9d){if(_0x1fdb9d){_0x1d092f[_0x2d1e('0x4a')][_0x2d1e('0x4d')]=_0x1fdb9d['id'];_0x1d092f[_0x2d1e('0x4a')][_0x2d1e('0x4e')]=integrations[_0x2d1e('0x4f')](_0x1d092f[_0x2d1e('0x4a')][_0x2d1e('0x50')],_0x1d092f[_0x2d1e('0x4a')]['type']);_0x1d092f['body'][_0x2d1e('0x51')]=integrations[_0x2d1e('0x52')](_0x1d092f[_0x2d1e('0x4a')][_0x2d1e('0x50')],_0x1d092f[_0x2d1e('0x4a')][_0x2d1e('0x2d')]);return db['DeskConfiguration'][_0x2d1e('0x53')](_0x1d092f[_0x2d1e('0x4a')],{'include':[{'model':db[_0x2d1e('0x54')],'as':_0x2d1e('0x4e')},{'model':db[_0x2d1e('0x54')],'as':_0x2d1e('0x51')}]});}return null;})[_0x2d1e('0x23')](respondWithResult(_0x319df8,null))['catch'](handleError(_0x319df8,null));};exports[_0x2d1e('0x55')]=function(_0x4862e9,_0x1ee054,_0x5b3d2d){var _0x160760=[{'name':_0x2d1e('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1776ad='';return db['DeskAccount'][_0x2d1e('0x4c')]({'where':{'id':_0x4862e9[_0x2d1e('0x47')]['id']},'attributes':['id',_0x2d1e('0x57'),_0x2d1e('0x58'),'username','password','consumerKey','consumerSecret',_0x2d1e('0x59'),'tokenSecret']})[_0x2d1e('0x23')](handleEntityNotFound(_0x1ee054,null))[_0x2d1e('0x23')](function(_0x5d41bf){if(_0x5d41bf){_0x1776ad=_0x5d41bf[_0x2d1e('0x57')];var _0x5561ae=_0x1776ad[_0x2d1e('0x5a')](-0x1);if(_0x5561ae==='/'){_0x1776ad=_0x1776ad['substring'](0x0,_0x1776ad[_0x2d1e('0x5b')](_0x5561ae));}var _0x2bf896={'method':_0x2d1e('0x5c'),'uri':util[_0x2d1e('0x5d')](_0x2d1e('0x5e'),_0x1776ad),'headers':{'Content-Type':'application/json','Accept':_0x2d1e('0x5f')},'json':!![]};if(_0x5d41bf[_0x2d1e('0x58')]===_0x2d1e('0x60')){_0x2bf896['headers']['Authorization']=util[_0x2d1e('0x5d')](_0x2d1e('0x61'),new Buffer(util['format'](_0x2d1e('0x62'),_0x5d41bf[_0x2d1e('0x63')],_0x5d41bf[_0x2d1e('0x64')]))[_0x2d1e('0x65')](_0x2d1e('0x66')));}return rp(_0x2bf896)['then'](function(_0x1a9275){return _0x160760[_0x2d1e('0x67')](_[_0x2d1e('0x2a')](_0x1a9275[_0x2d1e('0x68')][_0x2d1e('0x69')],function(_0x4bbf66){return{'id':_0x4bbf66[_0x2d1e('0x27')],'name':_0x4bbf66['name'],'type':_0x4bbf66[_0x2d1e('0x2d')],'active':_0x4bbf66[_0x2d1e('0x6a')],'label':_0x4bbf66[_0x2d1e('0x6b')],'custom':!![]};}));});}})[_0x2d1e('0x23')](function(_0x3217f){return{'count':_0x3217f['length'],'rows':_0x3217f};})[_0x2d1e('0x23')](respondWithResult(_0x1ee054,null))[_0x2d1e('0x45')](function(_0x72edcf){var _0x46e079=_0x4862e9['query'][_0x2d1e('0x6c')]?0x1f4:_0x72edcf[_0x2d1e('0x6d')]||0x1f4;logger['error'](_0x2d1e('0x6e'),_0x2d1e('0x55'),_0x46e079,JSON[_0x2d1e('0x6f')](_0x72edcf));delete _0x72edcf[_0x2d1e('0x27')];if(_0x46e079===0x191){_0x46e079=0x190;}_0x1ee054[_0x2d1e('0x19')](_0x46e079)[_0x2d1e('0x28')](_0x4862e9[_0x2d1e('0x30')][_0x2d1e('0x6c')]?{'message':_0x2d1e('0x70'),'statusCode':_0x72edcf[_0x2d1e('0x6d')]}:_0x72edcf);});}; \ No newline at end of file +var _0xa7eb=['Descriptions','priority','remoteUri','authType','password','consumerSecret','token','tokenSecret','slice','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','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','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','DeskConfiguration','order','addConfiguration','AccountId','getSubjects','channel','type','DeskField','Subjects'];(function(_0x1152a0,_0x12205d){var _0x5a0e17=function(_0x40443d){while(--_0x40443d){_0x1152a0['push'](_0x1152a0['shift']());}};_0x5a0e17(++_0x12205d);}(_0xa7eb,0x1d8));var _0xba7e=function(_0x54ab89,_0x673b3){_0x54ab89=_0x54ab89-0x0;var _0x3cd353=_0xa7eb[_0x54ab89];return _0x3cd353;};'use strict';var emlformat=require(_0xba7e('0x0'));var rimraf=require(_0xba7e('0x1'));var zipdir=require(_0xba7e('0x2'));var jsonpatch=require(_0xba7e('0x3'));var rp=require(_0xba7e('0x4'));var moment=require('moment');var BPromise=require(_0xba7e('0x5'));var Mustache=require('mustache');var util=require(_0xba7e('0x6'));var path=require('path');var sox=require(_0xba7e('0x7'));var csv=require(_0xba7e('0x8'));var ejs=require(_0xba7e('0x9'));var fs=require('fs');var fs_extra=require(_0xba7e('0xa'));var _=require(_0xba7e('0xb'));var squel=require(_0xba7e('0xc'));var crypto=require('crypto');var jsforce=require(_0xba7e('0xd'));var deskjs=require(_0xba7e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba7e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xba7e('0x10'));var as=require(_0xba7e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba7e('0x12'))(_0xba7e('0x13'));var utils=require(_0xba7e('0x14'));var config=require(_0xba7e('0x15'));var licenseUtil=require(_0xba7e('0x16'));var db=require(_0xba7e('0x17'))['db'];var integrations=require(_0xba7e('0x18'));function respondWithStatusCode(_0x3e80e6,_0x4bb1ad){_0x4bb1ad=_0x4bb1ad||0xcc;return function(_0x475e6e){if(_0x475e6e){return _0x3e80e6['sendStatus'](_0x4bb1ad);}return _0x3e80e6[_0xba7e('0x19')](_0x4bb1ad)[_0xba7e('0x1a')]();};}function respondWithResult(_0x1851c9,_0x123b5c){_0x123b5c=_0x123b5c||0xc8;return function(_0x56ad1a){if(_0x56ad1a){return _0x1851c9[_0xba7e('0x19')](_0x123b5c)[_0xba7e('0x1b')](_0x56ad1a);}};}function respondWithFilteredResult(_0x4d8888,_0x3699d2){return function(_0xb7c188){if(_0xb7c188){var _0x46a127=typeof _0x3699d2[_0xba7e('0x1c')]===_0xba7e('0x1d')&&typeof _0x3699d2['limit']===_0xba7e('0x1d');var _0x4cd30b=_0xb7c188[_0xba7e('0x1e')];var _0x1e0a8e=_0x46a127?0x0:_0x3699d2[_0xba7e('0x1c')];var _0x3352a1=_0x46a127?_0xb7c188[_0xba7e('0x1e')]:_0x3699d2[_0xba7e('0x1c')]+_0x3699d2[_0xba7e('0x1f')];var _0x1f6357;if(_0x3352a1>=_0x4cd30b){_0x3352a1=_0x4cd30b;_0x1f6357=0xc8;}else{_0x1f6357=0xce;}_0x4d8888[_0xba7e('0x19')](_0x1f6357);return _0x4d8888[_0xba7e('0x20')]('Content-Range',_0x1e0a8e+'-'+_0x3352a1+'/'+_0x4cd30b)[_0xba7e('0x1b')](_0xb7c188);}return null;};}function patchUpdates(_0x14f804){return function(_0x5d5b5b){try{jsonpatch[_0xba7e('0x21')](_0x5d5b5b,_0x14f804,!![]);}catch(_0x3b2f05){return BPromise[_0xba7e('0x22')](_0x3b2f05);}return _0x5d5b5b[_0xba7e('0x23')]();};}function saveUpdates(_0x4fe4ca,_0x1dabf3){return function(_0x3a6d3d){if(_0x3a6d3d){return _0x3a6d3d[_0xba7e('0x24')](_0x4fe4ca)[_0xba7e('0x25')](function(_0x5231ab){return _0x5231ab;});}return null;};}function removeEntity(_0x4c68b4,_0xfb1000){return function(_0x2caade){if(_0x2caade){return _0x2caade[_0xba7e('0x26')]()[_0xba7e('0x25')](function(){_0x4c68b4[_0xba7e('0x19')](0xcc)[_0xba7e('0x1a')]();});}};}function handleEntityNotFound(_0x1bd3a5,_0xd48ffe){return function(_0x1c8c1e){if(!_0x1c8c1e){_0x1bd3a5['sendStatus'](0x194);}return _0x1c8c1e;};}function handleError(_0x46d5da,_0x421113){_0x421113=_0x421113||0x1f4;return function(_0x17ed7e){logger[_0xba7e('0x27')](_0x17ed7e[_0xba7e('0x28')]);if(_0x17ed7e[_0xba7e('0x29')]){delete _0x17ed7e['name'];}_0x46d5da[_0xba7e('0x19')](_0x421113)[_0xba7e('0x2a')](_0x17ed7e);};}exports[_0xba7e('0x2b')]=function(_0x4ec9c6,_0x2a37eb){var _0x3e1a97={},_0xcba515={},_0x41bd23={'count':0x0,'rows':[]};var _0x211735=_[_0xba7e('0x2c')](db[_0xba7e('0x2d')][_0xba7e('0x2e')],function(_0x347798){return{'name':_0x347798['fieldName'],'type':_0x347798['type']['key']};});_0xcba515['model']=_['map'](_0x211735,_0xba7e('0x29'));_0xcba515[_0xba7e('0x2f')]=_[_0xba7e('0x30')](_0x4ec9c6[_0xba7e('0x2f')]);_0xcba515[_0xba7e('0x31')]=_[_0xba7e('0x32')](_0xcba515[_0xba7e('0x33')],_0xcba515[_0xba7e('0x2f')]);_0x3e1a97[_0xba7e('0x34')]=_[_0xba7e('0x32')](_0xcba515[_0xba7e('0x33')],qs['fields'](_0x4ec9c6[_0xba7e('0x2f')][_0xba7e('0x35')]));_0x3e1a97[_0xba7e('0x34')]=_0x3e1a97['attributes']['length']?_0x3e1a97[_0xba7e('0x34')]:_0xcba515['model'];if(!_0x4ec9c6[_0xba7e('0x2f')][_0xba7e('0x36')]('nolimit')){_0x3e1a97['limit']=qs['limit'](_0x4ec9c6[_0xba7e('0x2f')][_0xba7e('0x1f')]);_0x3e1a97['offset']=qs['offset'](_0x4ec9c6[_0xba7e('0x2f')][_0xba7e('0x1c')]);}_0x3e1a97['order']=qs['sort'](_0x4ec9c6[_0xba7e('0x2f')][_0xba7e('0x37')]);_0x3e1a97[_0xba7e('0x38')]=qs['filters'](_[_0xba7e('0x39')](_0x4ec9c6[_0xba7e('0x2f')],_0xcba515[_0xba7e('0x31')]),_0x211735);if(_0x4ec9c6[_0xba7e('0x2f')][_0xba7e('0x3a')]){_0x3e1a97[_0xba7e('0x38')]=_[_0xba7e('0x3b')](_0x3e1a97[_0xba7e('0x38')],{'$or':_[_0xba7e('0x2c')](_0x211735,function(_0x1e55b0){if(_0x1e55b0['type']!==_0xba7e('0x3c')){var _0x2f4321={};_0x2f4321[_0x1e55b0[_0xba7e('0x29')]]={'$like':'%'+_0x4ec9c6[_0xba7e('0x2f')][_0xba7e('0x3a')]+'%'};return _0x2f4321;}})});}_0x3e1a97=_[_0xba7e('0x3b')]({},_0x3e1a97,_0x4ec9c6[_0xba7e('0x3d')]);var _0x2ff88b={'where':_0x3e1a97[_0xba7e('0x38')]};return db[_0xba7e('0x2d')]['count'](_0x2ff88b)[_0xba7e('0x25')](function(_0x1db1a7){_0x41bd23[_0xba7e('0x1e')]=_0x1db1a7;if(_0x4ec9c6[_0xba7e('0x2f')][_0xba7e('0x3e')]){_0x3e1a97[_0xba7e('0x3f')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x3e1a97);})['then'](function(_0x4115f9){_0x41bd23[_0xba7e('0x40')]=_0x4115f9;return _0x41bd23;})['then'](respondWithFilteredResult(_0x2a37eb,_0x3e1a97))[_0xba7e('0x41')](handleError(_0x2a37eb,null));};exports[_0xba7e('0x42')]=function(_0x119690,_0x13b04b){var _0x5e332a={'raw':![],'where':{'id':_0x119690[_0xba7e('0x43')]['id']}},_0x59ccea={};_0x59ccea[_0xba7e('0x33')]=_[_0xba7e('0x30')](db[_0xba7e('0x2d')]['rawAttributes']);_0x59ccea[_0xba7e('0x2f')]=_[_0xba7e('0x30')](_0x119690[_0xba7e('0x2f')]);_0x59ccea[_0xba7e('0x31')]=_['intersection'](_0x59ccea['model'],_0x59ccea['query']);_0x5e332a['attributes']=_['intersection'](_0x59ccea[_0xba7e('0x33')],qs[_0xba7e('0x35')](_0x119690['query'][_0xba7e('0x35')]));_0x5e332a[_0xba7e('0x34')]=_0x5e332a[_0xba7e('0x34')][_0xba7e('0x44')]?_0x5e332a[_0xba7e('0x34')]:_0x59ccea[_0xba7e('0x33')];if(_0x119690[_0xba7e('0x2f')][_0xba7e('0x3e')]){_0x5e332a[_0xba7e('0x3f')]=[{'all':!![]}];}_0x5e332a=_[_0xba7e('0x3b')]({},_0x5e332a,_0x119690[_0xba7e('0x3d')]);return db[_0xba7e('0x2d')][_0xba7e('0x45')](_0x5e332a)['then'](handleEntityNotFound(_0x13b04b,null))['then'](respondWithResult(_0x13b04b,null))[_0xba7e('0x41')](handleError(_0x13b04b,null));};exports['create']=function(_0x2a703e,_0x1c7dc8){return db['DeskAccount'][_0xba7e('0x46')](_0x2a703e[_0xba7e('0x47')],{})['then'](respondWithResult(_0x1c7dc8,0xc9))[_0xba7e('0x41')](handleError(_0x1c7dc8,null));};exports[_0xba7e('0x24')]=function(_0x506617,_0x2a264d){if(_0x506617[_0xba7e('0x47')]['id']){delete _0x506617[_0xba7e('0x47')]['id'];}return db[_0xba7e('0x2d')][_0xba7e('0x45')]({'where':{'id':_0x506617[_0xba7e('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a264d,null))[_0xba7e('0x25')](saveUpdates(_0x506617[_0xba7e('0x47')],null))[_0xba7e('0x25')](respondWithResult(_0x2a264d,null))[_0xba7e('0x41')](handleError(_0x2a264d,null));};exports['destroy']=function(_0x79f7c6,_0x2a3187){return db[_0xba7e('0x2d')]['find']({'where':{'id':_0x79f7c6[_0xba7e('0x43')]['id']}})[_0xba7e('0x25')](handleEntityNotFound(_0x2a3187,null))[_0xba7e('0x25')](removeEntity(_0x2a3187,null))[_0xba7e('0x41')](handleError(_0x2a3187,null));};exports[_0xba7e('0x48')]=function(_0x514227,_0x484aec,_0x56df01){var _0x3ca242={};var _0x28d370={};var _0x290405;var _0x21773d;return db[_0xba7e('0x2d')][_0xba7e('0x49')]({'where':{'id':_0x514227['params']['id']}})['then'](handleEntityNotFound(_0x484aec,null))[_0xba7e('0x25')](function(_0xf315db){if(_0xf315db){_0x290405=_0xf315db;_0x28d370[_0xba7e('0x33')]=_[_0xba7e('0x30')](db[_0xba7e('0x4a')][_0xba7e('0x2e')]);_0x28d370[_0xba7e('0x2f')]=_[_0xba7e('0x30')](_0x514227[_0xba7e('0x2f')]);_0x28d370[_0xba7e('0x31')]=_[_0xba7e('0x32')](_0x28d370[_0xba7e('0x33')],_0x28d370[_0xba7e('0x2f')]);_0x3ca242[_0xba7e('0x34')]=_[_0xba7e('0x32')](_0x28d370['model'],qs['fields'](_0x514227[_0xba7e('0x2f')][_0xba7e('0x35')]));_0x3ca242['attributes']=_0x3ca242[_0xba7e('0x34')]['length']?_0x3ca242[_0xba7e('0x34')]:_0x28d370[_0xba7e('0x33')];_0x3ca242[_0xba7e('0x4b')]=qs['sort'](_0x514227[_0xba7e('0x2f')]['sort']);_0x3ca242[_0xba7e('0x38')]=qs['filters'](_[_0xba7e('0x39')](_0x514227[_0xba7e('0x2f')],_0x28d370[_0xba7e('0x31')]));if(_0x514227[_0xba7e('0x2f')][_0xba7e('0x3a')]){_0x3ca242[_0xba7e('0x38')]=_[_0xba7e('0x3b')](_0x3ca242[_0xba7e('0x38')],{'$or':_[_0xba7e('0x2c')](_0x3ca242[_0xba7e('0x34')],function(_0x495fbb){var _0x3358cd={};_0x3358cd[_0x495fbb]={'$like':'%'+_0x514227[_0xba7e('0x2f')][_0xba7e('0x3a')]+'%'};return _0x3358cd;})});}_0x3ca242=_[_0xba7e('0x3b')]({},_0x3ca242,_0x514227['options']);return _0x290405[_0xba7e('0x48')](_0x3ca242);}})[_0xba7e('0x25')](function(_0x5b7ca3){if(_0x5b7ca3){_0x21773d=_0x5b7ca3[_0xba7e('0x44')];if(!_0x514227[_0xba7e('0x2f')][_0xba7e('0x36')]('nolimit')){_0x3ca242[_0xba7e('0x1f')]=qs[_0xba7e('0x1f')](_0x514227[_0xba7e('0x2f')][_0xba7e('0x1f')]);_0x3ca242['offset']=qs['offset'](_0x514227[_0xba7e('0x2f')]['offset']);}return _0x290405[_0xba7e('0x48')](_0x3ca242);}})[_0xba7e('0x25')](function(_0x18dbfa){if(_0x18dbfa){return _0x18dbfa?{'count':_0x21773d,'rows':_0x18dbfa}:null;}})[_0xba7e('0x25')](respondWithResult(_0x484aec,null))[_0xba7e('0x41')](handleError(_0x484aec,null));};exports[_0xba7e('0x4c')]=function(_0x3cd56c,_0x195e8c,_0x384403){if(_0x3cd56c['body']['id']){delete _0x3cd56c['body']['id'];}return db[_0xba7e('0x2d')][_0xba7e('0x49')]({'where':{'id':_0x3cd56c[_0xba7e('0x43')]['id']}})[_0xba7e('0x25')](handleEntityNotFound(_0x195e8c,null))[_0xba7e('0x25')](function(_0x284c57){if(_0x284c57){_0x3cd56c['body'][_0xba7e('0x4d')]=_0x284c57['id'];_0x3cd56c[_0xba7e('0x47')]['Subjects']=integrations[_0xba7e('0x4e')](_0x3cd56c['body'][_0xba7e('0x4f')],_0x3cd56c[_0xba7e('0x47')][_0xba7e('0x50')]);_0x3cd56c['body']['Descriptions']=integrations['getDescriptions'](_0x3cd56c[_0xba7e('0x47')]['channel'],_0x3cd56c['body']['type']);return db[_0xba7e('0x4a')][_0xba7e('0x46')](_0x3cd56c[_0xba7e('0x47')],{'include':[{'model':db[_0xba7e('0x51')],'as':_0xba7e('0x52')},{'model':db['DeskField'],'as':_0xba7e('0x53')}]});}return null;})[_0xba7e('0x25')](respondWithResult(_0x195e8c,null))[_0xba7e('0x41')](handleError(_0x195e8c,null));};exports['getFields']=function(_0x32afcc,_0x51fee5,_0x38e282){var _0x1d65f3=[{'name':_0xba7e('0x54'),'label':_0xba7e('0x54'),'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 _0x11b504='';return db[_0xba7e('0x2d')][_0xba7e('0x49')]({'where':{'id':_0x32afcc[_0xba7e('0x43')]['id']},'attributes':['id',_0xba7e('0x55'),_0xba7e('0x56'),'username',_0xba7e('0x57'),'consumerKey',_0xba7e('0x58'),_0xba7e('0x59'),_0xba7e('0x5a')]})['then'](handleEntityNotFound(_0x51fee5,null))[_0xba7e('0x25')](function(_0x5877c4){if(_0x5877c4){_0x11b504=_0x5877c4[_0xba7e('0x55')];var _0x58b370=_0x11b504[_0xba7e('0x5b')](-0x1);if(_0x58b370==='/'){_0x11b504=_0x11b504['substring'](0x0,_0x11b504['lastIndexOf'](_0x58b370));}var _0x5f21e9={'method':'GET','uri':util['format']('%s/custom_fields',_0x11b504),'headers':{'Content-Type':_0xba7e('0x5c'),'Accept':'application/json'},'json':!![]};if(_0x5877c4[_0xba7e('0x56')]===_0xba7e('0x5d')){_0x5f21e9[_0xba7e('0x5e')][_0xba7e('0x5f')]=util[_0xba7e('0x60')](_0xba7e('0x61'),new Buffer(util[_0xba7e('0x60')](_0xba7e('0x62'),_0x5877c4['username'],_0x5877c4[_0xba7e('0x57')]))[_0xba7e('0x63')](_0xba7e('0x64')));}return rp(_0x5f21e9)[_0xba7e('0x25')](function(_0xbcaf29){return _0x1d65f3[_0xba7e('0x65')](_[_0xba7e('0x2c')](_0xbcaf29[_0xba7e('0x66')][_0xba7e('0x67')],function(_0x30f0ab){return{'id':_0x30f0ab['name'],'name':_0x30f0ab['name'],'type':_0x30f0ab[_0xba7e('0x50')],'active':_0x30f0ab[_0xba7e('0x68')],'label':_0x30f0ab[_0xba7e('0x69')],'custom':!![]};}));});}})[_0xba7e('0x25')](function(_0x31fe55){return{'count':_0x31fe55[_0xba7e('0x44')],'rows':_0x31fe55};})[_0xba7e('0x25')](respondWithResult(_0x51fee5,null))[_0xba7e('0x41')](function(_0x239ec5){var _0x28a185=_0x32afcc[_0xba7e('0x2f')][_0xba7e('0x6a')]?0x1f4:_0x239ec5[_0xba7e('0x6b')]||0x1f4;logger[_0xba7e('0x27')](_0xba7e('0x6c'),'getFields',_0x28a185,JSON[_0xba7e('0x6d')](_0x239ec5));delete _0x239ec5[_0xba7e('0x29')];if(_0x28a185===0x191){_0x28a185=0x190;}_0x51fee5[_0xba7e('0x19')](_0x28a185)[_0xba7e('0x2a')](_0x32afcc[_0xba7e('0x2f')][_0xba7e('0x6a')]?{'message':_0xba7e('0x6e'),'statusCode':_0x239ec5[_0xba7e('0x6b')]}:_0x239ec5);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2a26f7f..217263d 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 _0xd9a3=['../../config/environment','../../components/integrations/configuration','define','lodash','util','api','request-promise','path'];(function(_0x457d5c,_0x7c8200){var _0x517081=function(_0x43f091){while(--_0x43f091){_0x457d5c['push'](_0x457d5c['shift']());}};_0x517081(++_0x7c8200);}(_0xd9a3,0x103));var _0x3d9a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9a3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3d9a('0x0'));var util=require(_0x3d9a('0x1'));var logger=require('../../config/logger')(_0x3d9a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3d9a('0x3'));var fs=require('fs');var path=require(_0x3d9a('0x4'));var rimraf=require('rimraf');var config=require(_0x3d9a('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x3d9a('0x6'));module['exports']=function(_0x4503a6,_0x3bf469){return _0x4503a6[_0x3d9a('0x7')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf738=['request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1a7691,_0xc6a24c){var _0x11d89b=function(_0x52018d){while(--_0x52018d){_0x1a7691['push'](_0x1a7691['shift']());}};_0x11d89b(++_0xc6a24c);}(_0xf738,0x10c));var _0x8f73=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0xf738[_0x5027b1];return _0x4a46cf;};'use strict';var _=require(_0x8f73('0x0'));var util=require(_0x8f73('0x1'));var logger=require(_0x8f73('0x2'))(_0x8f73('0x3'));var moment=require(_0x8f73('0x4'));var BPromise=require('bluebird');var rp=require(_0x8f73('0x5'));var fs=require('fs');var path=require(_0x8f73('0x6'));var rimraf=require('rimraf');var config=require(_0x8f73('0x7'));var attributes=require(_0x8f73('0x8'));var integrations=require(_0x8f73('0x9'));module[_0x8f73('0xa')]=function(_0x5df949,_0x26bc9c){return _0x5df949[_0x8f73('0xb')]('DeskAccount',attributes,{'tableName':_0x8f73('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 89b92cc..b616856 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 _0xc822=['options','raw','where','attributes','limit','map','include','model','GetDeskAccount','catch','ShowDeskAccount','find','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','findAll'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xc822,0x70));var _0x2c82=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xc822[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x2c82('0x0'));var util=require('util');var moment=require(_0x2c82('0x1'));var BPromise=require(_0x2c82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c82('0x3'));var db=require(_0x2c82('0x4'))['db'];var utils=require(_0x2c82('0x5'));var logger=require(_0x2c82('0x6'))(_0x2c82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2c82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43e7b7,_0xc3fd43,_0x4e0678){return new BPromise(function(_0x489734,_0x263d0b){return client[_0x2c82('0x9')](_0x43e7b7,_0x4e0678)['then'](function(_0x1da99f){logger[_0x2c82('0xa')](_0x2c82('0xb'),_0xc3fd43,'request\x20sent');logger[_0x2c82('0xc')](_0x2c82('0xd'),_0xc3fd43,'request\x20sent',JSON[_0x2c82('0xe')](_0x1da99f));if(_0x1da99f['error']){if(_0x1da99f[_0x2c82('0xf')][_0x2c82('0x10')]===0x1f4){logger[_0x2c82('0xf')](_0x2c82('0xb'),_0xc3fd43,_0x1da99f[_0x2c82('0xf')][_0x2c82('0x11')]);return _0x263d0b(_0x1da99f[_0x2c82('0xf')][_0x2c82('0x11')]);}logger[_0x2c82('0xf')](_0x2c82('0xb'),_0xc3fd43,_0x1da99f[_0x2c82('0xf')][_0x2c82('0x11')]);return _0x489734(_0x1da99f[_0x2c82('0xf')][_0x2c82('0x11')]);}else{logger[_0x2c82('0xa')]('DeskAccount,\x20%s,\x20%s',_0xc3fd43,_0x2c82('0x12'));_0x489734(_0x1da99f['result'][_0x2c82('0x11')]);}})['catch'](function(_0x12c361){logger['error'](_0x2c82('0xb'),_0xc3fd43,_0x12c361);_0x263d0b(_0x12c361);});});}exports['GetDeskAccount']=function(_0x49c45d){var _0x1e7729=this;return new Promise(function(_0x181136,_0x4482bd){return db['DeskAccount'][_0x2c82('0x13')]({'raw':_0x49c45d[_0x2c82('0x14')]?_0x49c45d['options'][_0x2c82('0x15')]===undefined?!![]:![]:!![],'where':_0x49c45d[_0x2c82('0x14')]?_0x49c45d[_0x2c82('0x14')][_0x2c82('0x16')]||null:null,'attributes':_0x49c45d[_0x2c82('0x14')]?_0x49c45d['options'][_0x2c82('0x17')]||null:null,'limit':_0x49c45d[_0x2c82('0x14')]?_0x49c45d['options'][_0x2c82('0x18')]||null:null,'include':_0x49c45d[_0x2c82('0x14')]?_0x49c45d[_0x2c82('0x14')]['include']?_[_0x2c82('0x19')](_0x49c45d['options'][_0x2c82('0x1a')],function(_0x2f8759){return{'model':db[_0x2f8759[_0x2c82('0x1b')]],'as':_0x2f8759['as'],'attributes':_0x2f8759[_0x2c82('0x17')],'include':_0x2f8759['include']?_[_0x2c82('0x19')](_0x2f8759[_0x2c82('0x1a')],function(_0x4ce8b4){return{'model':db[_0x4ce8b4[_0x2c82('0x1b')]],'as':_0x4ce8b4['as'],'attributes':_0x4ce8b4[_0x2c82('0x17')],'include':_0x4ce8b4[_0x2c82('0x1a')]?_[_0x2c82('0x19')](_0x4ce8b4[_0x2c82('0x1a')],function(_0x55fcb1){return{'model':db[_0x55fcb1['model']],'as':_0x55fcb1['as'],'attributes':_0x55fcb1[_0x2c82('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f2d21){logger[_0x2c82('0xa')](_0x2c82('0x1c'),_0x49c45d);logger[_0x2c82('0xc')](_0x2c82('0x1c'),_0x49c45d,JSON[_0x2c82('0xe')](_0x1f2d21));_0x181136(_0x1f2d21);})[_0x2c82('0x1d')](function(_0x24729d){logger[_0x2c82('0xf')](_0x2c82('0x1c'),_0x24729d[_0x2c82('0x11')],_0x49c45d);_0x4482bd(_0x1e7729['error'](0x1f4,_0x24729d['message']));});});};exports[_0x2c82('0x1e')]=function(_0x2d9897){var _0x31e0a8=this;return new Promise(function(_0x5e7290,_0xb96bfd){return db['DeskAccount'][_0x2c82('0x1f')]({'raw':_0x2d9897['options']?_0x2d9897[_0x2c82('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2d9897['options']?_0x2d9897[_0x2c82('0x14')][_0x2c82('0x16')]||null:null,'attributes':_0x2d9897[_0x2c82('0x14')]?_0x2d9897['options'][_0x2c82('0x17')]||null:null,'include':_0x2d9897[_0x2c82('0x14')]?_0x2d9897[_0x2c82('0x14')][_0x2c82('0x1a')]?_['map'](_0x2d9897[_0x2c82('0x14')][_0x2c82('0x1a')],function(_0xe7ef4){return{'model':db[_0xe7ef4[_0x2c82('0x1b')]],'as':_0xe7ef4['as'],'attributes':_0xe7ef4[_0x2c82('0x17')],'include':_0xe7ef4['include']?_[_0x2c82('0x19')](_0xe7ef4[_0x2c82('0x1a')],function(_0x487577){return{'model':db[_0x487577[_0x2c82('0x1b')]],'as':_0x487577['as'],'attributes':_0x487577['attributes'],'include':_0x487577['include']?_['map'](_0x487577[_0x2c82('0x1a')],function(_0x3ef3f2){return{'model':db[_0x3ef3f2['model']],'as':_0x3ef3f2['as'],'attributes':_0x3ef3f2[_0x2c82('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2c82('0x20')](function(_0x316032){logger['info'](_0x2c82('0x1e'),_0x2d9897);logger['debug'](_0x2c82('0x1e'),_0x2d9897,JSON[_0x2c82('0xe')](_0x316032));_0x5e7290(_0x316032);})[_0x2c82('0x1d')](function(_0x45a2b0){logger[_0x2c82('0xf')](_0x2c82('0x1e'),_0x45a2b0[_0x2c82('0x11')],_0x2d9897);_0xb96bfd(_0x31e0a8[_0x2c82('0xf')](0x1f4,_0x45a2b0[_0x2c82('0x11')]));});});}; \ No newline at end of file +var _0x0379=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','include','map','attributes','model','find','info','ShowDeskAccount','lodash','moment','bluebird'];(function(_0x9eb6c0,_0x4a1995){var _0x2a4010=function(_0x305652){while(--_0x305652){_0x9eb6c0['push'](_0x9eb6c0['shift']());}};_0x2a4010(++_0x4a1995);}(_0x0379,0xa7));var _0x9037=function(_0x5e5fe7,_0x129419){_0x5e5fe7=_0x5e5fe7-0x0;var _0x390754=_0x0379[_0x5e5fe7];return _0x390754;};'use strict';var _=require(_0x9037('0x0'));var util=require('util');var moment=require(_0x9037('0x1'));var BPromise=require(_0x9037('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9037('0x3'));var db=require(_0x9037('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9037('0x5'))(_0x9037('0x6'));var config=require(_0x9037('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9037('0x8')][_0x9037('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x107d27,_0x57b913,_0x3e6ee4){return new BPromise(function(_0x18cf39,_0x3f0380){return client[_0x9037('0xa')](_0x107d27,_0x3e6ee4)[_0x9037('0xb')](function(_0x3601a4){logger['info'](_0x9037('0xc'),_0x57b913,_0x9037('0xd'));logger[_0x9037('0xe')](_0x9037('0xf'),_0x57b913,_0x9037('0xd'),JSON[_0x9037('0x10')](_0x3601a4));if(_0x3601a4[_0x9037('0x11')]){if(_0x3601a4[_0x9037('0x11')]['code']===0x1f4){logger[_0x9037('0x11')](_0x9037('0xc'),_0x57b913,_0x3601a4['error'][_0x9037('0x12')]);return _0x3f0380(_0x3601a4['error'][_0x9037('0x12')]);}logger[_0x9037('0x11')](_0x9037('0xc'),_0x57b913,_0x3601a4[_0x9037('0x11')][_0x9037('0x12')]);return _0x18cf39(_0x3601a4['error'][_0x9037('0x12')]);}else{logger['info'](_0x9037('0xc'),_0x57b913,_0x9037('0xd'));_0x18cf39(_0x3601a4[_0x9037('0x13')][_0x9037('0x12')]);}})[_0x9037('0x14')](function(_0x269aaf){logger['error'](_0x9037('0xc'),_0x57b913,_0x269aaf);_0x3f0380(_0x269aaf);});});}exports[_0x9037('0x15')]=function(_0x198cc9){var _0x3f7f37=this;return new Promise(function(_0x2a6e11,_0x2a9f11){return db[_0x9037('0x16')][_0x9037('0x17')]({'raw':_0x198cc9[_0x9037('0x18')]?_0x198cc9[_0x9037('0x18')][_0x9037('0x19')]===undefined?!![]:![]:!![],'where':_0x198cc9[_0x9037('0x18')]?_0x198cc9[_0x9037('0x18')][_0x9037('0x1a')]||null:null,'attributes':_0x198cc9['options']?_0x198cc9['options']['attributes']||null:null,'limit':_0x198cc9[_0x9037('0x18')]?_0x198cc9[_0x9037('0x18')]['limit']||null:null,'include':_0x198cc9[_0x9037('0x18')]?_0x198cc9[_0x9037('0x18')][_0x9037('0x1b')]?_[_0x9037('0x1c')](_0x198cc9[_0x9037('0x18')]['include'],function(_0x3dd523){return{'model':db[_0x3dd523['model']],'as':_0x3dd523['as'],'attributes':_0x3dd523[_0x9037('0x1d')],'include':_0x3dd523[_0x9037('0x1b')]?_[_0x9037('0x1c')](_0x3dd523[_0x9037('0x1b')],function(_0x1420e0){return{'model':db[_0x1420e0[_0x9037('0x1e')]],'as':_0x1420e0['as'],'attributes':_0x1420e0['attributes'],'include':_0x1420e0[_0x9037('0x1b')]?_[_0x9037('0x1c')](_0x1420e0[_0x9037('0x1b')],function(_0x4c9840){return{'model':db[_0x4c9840['model']],'as':_0x4c9840['as'],'attributes':_0x4c9840[_0x9037('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9037('0xb')](function(_0xd83ac1){logger['info'](_0x9037('0x15'),_0x198cc9);logger[_0x9037('0xe')](_0x9037('0x15'),_0x198cc9,JSON['stringify'](_0xd83ac1));_0x2a6e11(_0xd83ac1);})[_0x9037('0x14')](function(_0x57787c){logger[_0x9037('0x11')](_0x9037('0x15'),_0x57787c[_0x9037('0x12')],_0x198cc9);_0x2a9f11(_0x3f7f37['error'](0x1f4,_0x57787c[_0x9037('0x12')]));});});};exports['ShowDeskAccount']=function(_0xf461f8){var _0x202a2c=this;return new Promise(function(_0x3ee4be,_0xa25dbd){return db[_0x9037('0x16')][_0x9037('0x1f')]({'raw':_0xf461f8[_0x9037('0x18')]?_0xf461f8[_0x9037('0x18')][_0x9037('0x19')]===undefined?!![]:![]:!![],'where':_0xf461f8['options']?_0xf461f8[_0x9037('0x18')]['where']||null:null,'attributes':_0xf461f8[_0x9037('0x18')]?_0xf461f8[_0x9037('0x18')][_0x9037('0x1d')]||null:null,'include':_0xf461f8[_0x9037('0x18')]?_0xf461f8[_0x9037('0x18')][_0x9037('0x1b')]?_[_0x9037('0x1c')](_0xf461f8[_0x9037('0x18')][_0x9037('0x1b')],function(_0x4a5abc){return{'model':db[_0x4a5abc[_0x9037('0x1e')]],'as':_0x4a5abc['as'],'attributes':_0x4a5abc[_0x9037('0x1d')],'include':_0x4a5abc[_0x9037('0x1b')]?_[_0x9037('0x1c')](_0x4a5abc['include'],function(_0x3d098c){return{'model':db[_0x3d098c['model']],'as':_0x3d098c['as'],'attributes':_0x3d098c[_0x9037('0x1d')],'include':_0x3d098c[_0x9037('0x1b')]?_[_0x9037('0x1c')](_0x3d098c['include'],function(_0x2f36e1){return{'model':db[_0x2f36e1[_0x9037('0x1e')]],'as':_0x2f36e1['as'],'attributes':_0x2f36e1[_0x9037('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9037('0xb')](function(_0x5b95df){logger[_0x9037('0x20')](_0x9037('0x21'),_0xf461f8);logger[_0x9037('0xe')](_0x9037('0x21'),_0xf461f8,JSON['stringify'](_0x5b95df));_0x3ee4be(_0x5b95df);})['catch'](function(_0x52367e){logger[_0x9037('0x11')](_0x9037('0x21'),_0x52367e[_0x9037('0x12')],_0xf461f8);_0xa25dbd(_0x202a2c[_0x9037('0x11')](0x1f4,_0x52367e['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index fa8034f..e5960c6 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0x55ca,0x126));var _0xa55c=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x55ca[_0x2af29a];return _0x5ef02f;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x124522,_0x258044){var _0xde49c3=function(_0xc0983){while(--_0xc0983){_0x124522['push'](_0x124522['shift']());}};_0xde49c3(++_0x258044);}(_0x008c,0x188));var _0xc008=function(_0x3d2fe5,_0x2f9c71){_0x3d2fe5=_0x3d2fe5-0x0;var _0x48de9d=_0x008c[_0x3d2fe5];return _0x48de9d;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index bb610be..7ee7c06 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 _0x0ebe=['exports','STRING','sequelize'];(function(_0x559bc4,_0x1c5809){var _0x140122=function(_0x2785a4){while(--_0x2785a4){_0x559bc4['push'](_0x559bc4['shift']());}};_0x140122(++_0x1c5809);}(_0x0ebe,0x1f4));var _0xe0eb=function(_0x300d11,_0x49cefd){_0x300d11=_0x300d11-0x0;var _0x2ceb31=_0x0ebe[_0x300d11];return _0x2ceb31;};'use strict';var Sequelize=require(_0xe0eb('0x0'));module[_0xe0eb('0x1')]={'name':{'type':Sequelize[_0xe0eb('0x2')]},'description':{'type':Sequelize[_0xe0eb('0x2')]}}; \ No newline at end of file +var _0xae3f=['STRING','exports'];(function(_0x29fcf3,_0x26cbdd){var _0x3ee6e4=function(_0x395422){while(--_0x395422){_0x29fcf3['push'](_0x29fcf3['shift']());}};_0x3ee6e4(++_0x26cbdd);}(_0xae3f,0x19d));var _0xfae3=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xae3f[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require('sequelize');module[_0xfae3('0x0')]={'name':{'type':Sequelize[_0xfae3('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 752808f..44fbaca 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 _0xb8f5=['limit','set','Content-Range','apply','then','error','stack','name','index','map','DeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','destroy','getFields','findOne','pick','hasOwnProperty','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0xb8f5,0x88));var _0x5b8f=function(_0x480d28,_0x2de8ef){_0x480d28=_0x480d28-0x0;var _0x2f609d=_0xb8f5[_0x480d28];return _0x2f609d;};'use strict';var emlformat=require(_0x5b8f('0x0'));var rimraf=require(_0x5b8f('0x1'));var zipdir=require(_0x5b8f('0x2'));var jsonpatch=require(_0x5b8f('0x3'));var rp=require(_0x5b8f('0x4'));var moment=require('moment');var BPromise=require(_0x5b8f('0x5'));var Mustache=require(_0x5b8f('0x6'));var util=require(_0x5b8f('0x7'));var path=require(_0x5b8f('0x8'));var sox=require('sox');var csv=require(_0x5b8f('0x9'));var ejs=require(_0x5b8f('0xa'));var fs=require('fs');var fs_extra=require(_0x5b8f('0xb'));var _=require(_0x5b8f('0xc'));var squel=require(_0x5b8f('0xd'));var crypto=require(_0x5b8f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5b8f('0xf'));var toCsv=require(_0x5b8f('0x9'));var querystring=require(_0x5b8f('0x10'));var Papa=require(_0x5b8f('0x11'));var Redis=require(_0x5b8f('0x12'));var authService=require(_0x5b8f('0x13'));var qs=require(_0x5b8f('0x14'));var as=require(_0x5b8f('0x15'));var hardwareService=require(_0x5b8f('0x16'));var logger=require(_0x5b8f('0x17'))('api');var utils=require(_0x5b8f('0x18'));var config=require(_0x5b8f('0x19'));var licenseUtil=require(_0x5b8f('0x1a'));var db=require(_0x5b8f('0x1b'))['db'];function respondWithStatusCode(_0x28a510,_0x40766e){_0x40766e=_0x40766e||0xcc;return function(_0x535ebc){if(_0x535ebc){return _0x28a510[_0x5b8f('0x1c')](_0x40766e);}return _0x28a510[_0x5b8f('0x1d')](_0x40766e)[_0x5b8f('0x1e')]();};}function respondWithResult(_0x31d2ec,_0x1feb13){_0x1feb13=_0x1feb13||0xc8;return function(_0x54f901){if(_0x54f901){return _0x31d2ec[_0x5b8f('0x1d')](_0x1feb13)['json'](_0x54f901);}};}function respondWithFilteredResult(_0x508bd0,_0x31b2c1){return function(_0x294f5f){if(_0x294f5f){var _0x47d240=typeof _0x31b2c1['offset']===_0x5b8f('0x1f')&&typeof _0x31b2c1['limit']===_0x5b8f('0x1f');var _0x3ebda0=_0x294f5f['count'];var _0x25ce1f=_0x47d240?0x0:_0x31b2c1[_0x5b8f('0x20')];var _0x48094=_0x47d240?_0x294f5f[_0x5b8f('0x21')]:_0x31b2c1[_0x5b8f('0x20')]+_0x31b2c1[_0x5b8f('0x22')];var _0x57402d;if(_0x48094>=_0x3ebda0){_0x48094=_0x3ebda0;_0x57402d=0xc8;}else{_0x57402d=0xce;}_0x508bd0[_0x5b8f('0x1d')](_0x57402d);return _0x508bd0[_0x5b8f('0x23')](_0x5b8f('0x24'),_0x25ce1f+'-'+_0x48094+'/'+_0x3ebda0)['json'](_0x294f5f);}return null;};}function patchUpdates(_0x34cfc8){return function(_0x12583a){try{jsonpatch[_0x5b8f('0x25')](_0x12583a,_0x34cfc8,!![]);}catch(_0x5d44d5){return BPromise['reject'](_0x5d44d5);}return _0x12583a['save']();};}function saveUpdates(_0x2abf8a,_0x1ce4a9){return function(_0xe1efbd){if(_0xe1efbd){return _0xe1efbd['update'](_0x2abf8a)[_0x5b8f('0x26')](function(_0x8ef49b){return _0x8ef49b;});}return null;};}function removeEntity(_0x4cabfc,_0x18ddf1){return function(_0x13b180){if(_0x13b180){return _0x13b180['destroy']()['then'](function(){_0x4cabfc['status'](0xcc)[_0x5b8f('0x1e')]();});}};}function handleEntityNotFound(_0x9eeac4,_0x5a7de1){return function(_0x53458d){if(!_0x53458d){_0x9eeac4[_0x5b8f('0x1c')](0x194);}return _0x53458d;};}function handleError(_0x5b317c,_0x26e489){_0x26e489=_0x26e489||0x1f4;return function(_0x407d3d){logger[_0x5b8f('0x27')](_0x407d3d[_0x5b8f('0x28')]);if(_0x407d3d[_0x5b8f('0x29')]){delete _0x407d3d[_0x5b8f('0x29')];}_0x5b317c[_0x5b8f('0x1d')](_0x26e489)['send'](_0x407d3d);};}exports[_0x5b8f('0x2a')]=function(_0x5c652e,_0x5b6cc0){var _0x6408f6={},_0x3b5255={},_0x65e11d={'count':0x0,'rows':[]};var _0x40f09c=_[_0x5b8f('0x2b')](db[_0x5b8f('0x2c')]['rawAttributes'],function(_0x20aeeb){return{'name':_0x20aeeb[_0x5b8f('0x2d')],'type':_0x20aeeb[_0x5b8f('0x2e')][_0x5b8f('0x2f')]};});_0x3b5255[_0x5b8f('0x30')]=_[_0x5b8f('0x2b')](_0x40f09c,'name');_0x3b5255[_0x5b8f('0x31')]=_[_0x5b8f('0x32')](_0x5c652e[_0x5b8f('0x31')]);_0x3b5255[_0x5b8f('0x33')]=_[_0x5b8f('0x34')](_0x3b5255[_0x5b8f('0x30')],_0x3b5255[_0x5b8f('0x31')]);_0x6408f6[_0x5b8f('0x35')]=_[_0x5b8f('0x34')](_0x3b5255[_0x5b8f('0x30')],qs[_0x5b8f('0x36')](_0x5c652e[_0x5b8f('0x31')]['fields']));_0x6408f6['attributes']=_0x6408f6['attributes'][_0x5b8f('0x37')]?_0x6408f6['attributes']:_0x3b5255[_0x5b8f('0x30')];if(!_0x5c652e[_0x5b8f('0x31')]['hasOwnProperty'](_0x5b8f('0x38'))){_0x6408f6[_0x5b8f('0x22')]=qs[_0x5b8f('0x22')](_0x5c652e[_0x5b8f('0x31')]['limit']);_0x6408f6[_0x5b8f('0x20')]=qs['offset'](_0x5c652e['query'][_0x5b8f('0x20')]);}_0x6408f6[_0x5b8f('0x39')]=qs[_0x5b8f('0x3a')](_0x5c652e[_0x5b8f('0x31')][_0x5b8f('0x3a')]);_0x6408f6['where']=qs['filters'](_['pick'](_0x5c652e['query'],_0x3b5255[_0x5b8f('0x33')]),_0x40f09c);if(_0x5c652e[_0x5b8f('0x31')][_0x5b8f('0x3b')]){_0x6408f6[_0x5b8f('0x3c')]=_['merge'](_0x6408f6['where'],{'$or':_[_0x5b8f('0x2b')](_0x40f09c,function(_0x37ca25){if(_0x37ca25[_0x5b8f('0x2e')]!==_0x5b8f('0x3d')){var _0x772086={};_0x772086[_0x37ca25[_0x5b8f('0x29')]]={'$like':'%'+_0x5c652e[_0x5b8f('0x31')][_0x5b8f('0x3b')]+'%'};return _0x772086;}})});}_0x6408f6=_[_0x5b8f('0x3e')]({},_0x6408f6,_0x5c652e[_0x5b8f('0x3f')]);var _0xe8749f={'where':_0x6408f6[_0x5b8f('0x3c')]};return db[_0x5b8f('0x2c')][_0x5b8f('0x21')](_0xe8749f)[_0x5b8f('0x26')](function(_0x7a5191){_0x65e11d[_0x5b8f('0x21')]=_0x7a5191;if(_0x5c652e['query'][_0x5b8f('0x40')]){_0x6408f6[_0x5b8f('0x41')]=[{'all':!![]}];}return db[_0x5b8f('0x2c')][_0x5b8f('0x42')](_0x6408f6);})[_0x5b8f('0x26')](function(_0x127c44){_0x65e11d['rows']=_0x127c44;return _0x65e11d;})['then'](respondWithFilteredResult(_0x5b6cc0,_0x6408f6))[_0x5b8f('0x43')](handleError(_0x5b6cc0,null));};exports[_0x5b8f('0x44')]=function(_0xb432d5,_0x2f724f){var _0x35c67d={'raw':![],'where':{'id':_0xb432d5[_0x5b8f('0x45')]['id']}},_0x32b125={};_0x32b125['model']=_[_0x5b8f('0x32')](db[_0x5b8f('0x2c')][_0x5b8f('0x46')]);_0x32b125[_0x5b8f('0x31')]=_[_0x5b8f('0x32')](_0xb432d5[_0x5b8f('0x31')]);_0x32b125['filters']=_[_0x5b8f('0x34')](_0x32b125[_0x5b8f('0x30')],_0x32b125[_0x5b8f('0x31')]);_0x35c67d[_0x5b8f('0x35')]=_[_0x5b8f('0x34')](_0x32b125[_0x5b8f('0x30')],qs[_0x5b8f('0x36')](_0xb432d5['query'][_0x5b8f('0x36')]));_0x35c67d['attributes']=_0x35c67d['attributes'][_0x5b8f('0x37')]?_0x35c67d[_0x5b8f('0x35')]:_0x32b125[_0x5b8f('0x30')];if(_0xb432d5[_0x5b8f('0x31')][_0x5b8f('0x40')]){_0x35c67d[_0x5b8f('0x41')]=[{'all':!![]}];}_0x35c67d=_[_0x5b8f('0x3e')]({},_0x35c67d,_0xb432d5[_0x5b8f('0x3f')]);return db[_0x5b8f('0x2c')][_0x5b8f('0x47')](_0x35c67d)[_0x5b8f('0x26')](handleEntityNotFound(_0x2f724f,null))[_0x5b8f('0x26')](respondWithResult(_0x2f724f,null))['catch'](handleError(_0x2f724f,null));};exports[_0x5b8f('0x48')]=function(_0x138b3a,_0x30aefd){return db[_0x5b8f('0x2c')]['create'](_0x138b3a[_0x5b8f('0x49')],{})[_0x5b8f('0x26')](respondWithResult(_0x30aefd,0xc9))['catch'](handleError(_0x30aefd,null));};exports['update']=function(_0x565ed3,_0x3ffda3){if(_0x565ed3['body']['id']){delete _0x565ed3[_0x5b8f('0x49')]['id'];}return db[_0x5b8f('0x2c')][_0x5b8f('0x47')]({'where':{'id':_0x565ed3[_0x5b8f('0x45')]['id']}})[_0x5b8f('0x26')](handleEntityNotFound(_0x3ffda3,null))[_0x5b8f('0x26')](saveUpdates(_0x565ed3[_0x5b8f('0x49')],null))[_0x5b8f('0x26')](respondWithResult(_0x3ffda3,null))[_0x5b8f('0x43')](handleError(_0x3ffda3,null));};exports[_0x5b8f('0x4a')]=function(_0x43ab8b,_0x4cfee8){return db[_0x5b8f('0x2c')]['find']({'where':{'id':_0x43ab8b[_0x5b8f('0x45')]['id']}})[_0x5b8f('0x26')](handleEntityNotFound(_0x4cfee8,null))[_0x5b8f('0x26')](removeEntity(_0x4cfee8,null))[_0x5b8f('0x43')](handleError(_0x4cfee8,null));};exports[_0x5b8f('0x4b')]=function(_0x18eceb,_0xa04f8f,_0x4d65e1){var _0x47b0a6={};var _0x501336={};var _0x276529;var _0x16b561;return db[_0x5b8f('0x2c')][_0x5b8f('0x4c')]({'where':{'id':_0x18eceb[_0x5b8f('0x45')]['id']}})['then'](handleEntityNotFound(_0xa04f8f,null))[_0x5b8f('0x26')](function(_0x33cc84){if(_0x33cc84){_0x276529=_0x33cc84;_0x501336[_0x5b8f('0x30')]=_['keys'](db['DeskField']['rawAttributes']);_0x501336[_0x5b8f('0x31')]=_[_0x5b8f('0x32')](_0x18eceb[_0x5b8f('0x31')]);_0x501336['filters']=_[_0x5b8f('0x34')](_0x501336[_0x5b8f('0x30')],_0x501336['query']);_0x47b0a6[_0x5b8f('0x35')]=_[_0x5b8f('0x34')](_0x501336[_0x5b8f('0x30')],qs['fields'](_0x18eceb[_0x5b8f('0x31')]['fields']));_0x47b0a6['attributes']=_0x47b0a6[_0x5b8f('0x35')][_0x5b8f('0x37')]?_0x47b0a6[_0x5b8f('0x35')]:_0x501336[_0x5b8f('0x30')];_0x47b0a6[_0x5b8f('0x39')]=qs[_0x5b8f('0x3a')](_0x18eceb[_0x5b8f('0x31')][_0x5b8f('0x3a')]);_0x47b0a6[_0x5b8f('0x3c')]=qs[_0x5b8f('0x33')](_[_0x5b8f('0x4d')](_0x18eceb[_0x5b8f('0x31')],_0x501336[_0x5b8f('0x33')]));if(_0x18eceb[_0x5b8f('0x31')][_0x5b8f('0x3b')]){_0x47b0a6[_0x5b8f('0x3c')]=_[_0x5b8f('0x3e')](_0x47b0a6[_0x5b8f('0x3c')],{'$or':_[_0x5b8f('0x2b')](_0x47b0a6[_0x5b8f('0x35')],function(_0x46abfb){var _0x13e724={};_0x13e724[_0x46abfb]={'$like':'%'+_0x18eceb[_0x5b8f('0x31')][_0x5b8f('0x3b')]+'%'};return _0x13e724;})});}_0x47b0a6=_[_0x5b8f('0x3e')]({},_0x47b0a6,_0x18eceb['options']);return _0x276529[_0x5b8f('0x4b')](_0x47b0a6);}})[_0x5b8f('0x26')](function(_0x4bbf40){if(_0x4bbf40){_0x16b561=_0x4bbf40[_0x5b8f('0x37')];if(!_0x18eceb[_0x5b8f('0x31')][_0x5b8f('0x4e')](_0x5b8f('0x38'))){_0x47b0a6[_0x5b8f('0x22')]=qs[_0x5b8f('0x22')](_0x18eceb[_0x5b8f('0x31')][_0x5b8f('0x22')]);_0x47b0a6[_0x5b8f('0x20')]=qs[_0x5b8f('0x20')](_0x18eceb['query'][_0x5b8f('0x20')]);}return _0x276529[_0x5b8f('0x4b')](_0x47b0a6);}})[_0x5b8f('0x26')](function(_0x5b3797){if(_0x5b3797){return _0x5b3797?{'count':_0x16b561,'rows':_0x5b3797}:null;}})[_0x5b8f('0x26')](respondWithResult(_0xa04f8f,null))[_0x5b8f('0x43')](handleError(_0xa04f8f,null));};exports[_0x5b8f('0x4f')]=function(_0x29e95c,_0x2ebead,_0xac1465){var _0x1ef073={};var _0x5de7bb={};var _0x555806;var _0x207d62;return db[_0x5b8f('0x2c')]['findOne']({'where':{'id':_0x29e95c[_0x5b8f('0x45')]['id']}})[_0x5b8f('0x26')](handleEntityNotFound(_0x2ebead,null))['then'](function(_0xb702bc){if(_0xb702bc){_0x555806=_0xb702bc;_0x5de7bb[_0x5b8f('0x30')]=_['keys'](db[_0x5b8f('0x50')][_0x5b8f('0x46')]);_0x5de7bb['query']=_[_0x5b8f('0x32')](_0x29e95c['query']);_0x5de7bb[_0x5b8f('0x33')]=_[_0x5b8f('0x34')](_0x5de7bb[_0x5b8f('0x30')],_0x5de7bb['query']);_0x1ef073['attributes']=_[_0x5b8f('0x34')](_0x5de7bb[_0x5b8f('0x30')],qs[_0x5b8f('0x36')](_0x29e95c[_0x5b8f('0x31')][_0x5b8f('0x36')]));_0x1ef073['attributes']=_0x1ef073[_0x5b8f('0x35')][_0x5b8f('0x37')]?_0x1ef073[_0x5b8f('0x35')]:_0x5de7bb[_0x5b8f('0x30')];_0x1ef073[_0x5b8f('0x39')]=qs['sort'](_0x29e95c[_0x5b8f('0x31')]['sort']);_0x1ef073[_0x5b8f('0x3c')]=qs[_0x5b8f('0x33')](_[_0x5b8f('0x4d')](_0x29e95c['query'],_0x5de7bb[_0x5b8f('0x33')]));if(_0x29e95c[_0x5b8f('0x31')][_0x5b8f('0x3b')]){_0x1ef073['where']=_['merge'](_0x1ef073[_0x5b8f('0x3c')],{'$or':_[_0x5b8f('0x2b')](_0x1ef073['attributes'],function(_0x2c696b){var _0x5e2177={};_0x5e2177[_0x2c696b]={'$like':'%'+_0x29e95c[_0x5b8f('0x31')][_0x5b8f('0x3b')]+'%'};return _0x5e2177;})});}_0x1ef073=_['merge']({},_0x1ef073,_0x29e95c['options']);return _0x555806['getSubjects'](_0x1ef073);}})[_0x5b8f('0x26')](function(_0x2141fe){if(_0x2141fe){_0x207d62=_0x2141fe[_0x5b8f('0x37')];if(!_0x29e95c[_0x5b8f('0x31')][_0x5b8f('0x4e')](_0x5b8f('0x38'))){_0x1ef073[_0x5b8f('0x22')]=qs[_0x5b8f('0x22')](_0x29e95c[_0x5b8f('0x31')][_0x5b8f('0x22')]);_0x1ef073[_0x5b8f('0x20')]=qs['offset'](_0x29e95c[_0x5b8f('0x31')][_0x5b8f('0x20')]);}return _0x555806[_0x5b8f('0x4f')](_0x1ef073);}})[_0x5b8f('0x26')](function(_0x1a9325){if(_0x1a9325){return _0x1a9325?{'count':_0x207d62,'rows':_0x1a9325}:null;}})[_0x5b8f('0x26')](respondWithResult(_0x2ebead,null))[_0x5b8f('0x43')](handleError(_0x2ebead,null));};exports[_0x5b8f('0x51')]=function(_0x2f392f,_0x2f90f3,_0x19e1d8){var _0x52504f={};var _0x1c8e3f={};var _0x1e4ab3;var _0x1d2009;return db[_0x5b8f('0x2c')][_0x5b8f('0x4c')]({'where':{'id':_0x2f392f['params']['id']}})['then'](handleEntityNotFound(_0x2f90f3,null))[_0x5b8f('0x26')](function(_0x4a617b){if(_0x4a617b){_0x1e4ab3=_0x4a617b;_0x1c8e3f[_0x5b8f('0x30')]=_[_0x5b8f('0x32')](db[_0x5b8f('0x50')][_0x5b8f('0x46')]);_0x1c8e3f[_0x5b8f('0x31')]=_[_0x5b8f('0x32')](_0x2f392f[_0x5b8f('0x31')]);_0x1c8e3f[_0x5b8f('0x33')]=_[_0x5b8f('0x34')](_0x1c8e3f['model'],_0x1c8e3f[_0x5b8f('0x31')]);_0x52504f[_0x5b8f('0x35')]=_[_0x5b8f('0x34')](_0x1c8e3f[_0x5b8f('0x30')],qs[_0x5b8f('0x36')](_0x2f392f[_0x5b8f('0x31')]['fields']));_0x52504f[_0x5b8f('0x35')]=_0x52504f['attributes'][_0x5b8f('0x37')]?_0x52504f['attributes']:_0x1c8e3f['model'];_0x52504f[_0x5b8f('0x39')]=qs['sort'](_0x2f392f[_0x5b8f('0x31')][_0x5b8f('0x3a')]);_0x52504f[_0x5b8f('0x3c')]=qs['filters'](_[_0x5b8f('0x4d')](_0x2f392f[_0x5b8f('0x31')],_0x1c8e3f[_0x5b8f('0x33')]));if(_0x2f392f[_0x5b8f('0x31')][_0x5b8f('0x3b')]){_0x52504f[_0x5b8f('0x3c')]=_[_0x5b8f('0x3e')](_0x52504f[_0x5b8f('0x3c')],{'$or':_[_0x5b8f('0x2b')](_0x52504f[_0x5b8f('0x35')],function(_0xffe8e0){var _0x45b6c2={};_0x45b6c2[_0xffe8e0]={'$like':'%'+_0x2f392f[_0x5b8f('0x31')][_0x5b8f('0x3b')]+'%'};return _0x45b6c2;})});}_0x52504f=_['merge']({},_0x52504f,_0x2f392f[_0x5b8f('0x3f')]);return _0x1e4ab3[_0x5b8f('0x51')](_0x52504f);}})[_0x5b8f('0x26')](function(_0x12e1b7){if(_0x12e1b7){_0x1d2009=_0x12e1b7[_0x5b8f('0x37')];if(!_0x2f392f[_0x5b8f('0x31')][_0x5b8f('0x4e')](_0x5b8f('0x38'))){_0x52504f[_0x5b8f('0x22')]=qs[_0x5b8f('0x22')](_0x2f392f['query']['limit']);_0x52504f['offset']=qs[_0x5b8f('0x20')](_0x2f392f[_0x5b8f('0x31')][_0x5b8f('0x20')]);}return _0x1e4ab3['getDescriptions'](_0x52504f);}})['then'](function(_0x7341fc){if(_0x7341fc){return _0x7341fc?{'count':_0x1d2009,'rows':_0x7341fc}:null;}})[_0x5b8f('0x26')](respondWithResult(_0x2f90f3,null))['catch'](handleError(_0x2f90f3,null));};exports[_0x5b8f('0x52')]=function(_0x5232c9,_0x314706,_0x8e4072){var _0x199460={};var _0x5bdd71={};var _0x3e6a26;var _0x5170df;return db[_0x5b8f('0x2c')][_0x5b8f('0x4c')]({'where':{'id':_0x5232c9[_0x5b8f('0x45')]['id']}})[_0x5b8f('0x26')](handleEntityNotFound(_0x314706,null))['then'](function(_0x33229b){if(_0x33229b){_0x3e6a26=_0x33229b;_0x5bdd71[_0x5b8f('0x30')]=_[_0x5b8f('0x32')](db['Tag'][_0x5b8f('0x46')]);_0x5bdd71[_0x5b8f('0x31')]=_[_0x5b8f('0x32')](_0x5232c9['query']);_0x5bdd71[_0x5b8f('0x33')]=_[_0x5b8f('0x34')](_0x5bdd71[_0x5b8f('0x30')],_0x5bdd71['query']);_0x199460[_0x5b8f('0x35')]=_[_0x5b8f('0x34')](_0x5bdd71[_0x5b8f('0x30')],qs[_0x5b8f('0x36')](_0x5232c9['query']['fields']));_0x199460[_0x5b8f('0x35')]=_0x199460[_0x5b8f('0x35')]['length']?_0x199460[_0x5b8f('0x35')]:_0x5bdd71[_0x5b8f('0x30')];_0x199460[_0x5b8f('0x39')]=qs[_0x5b8f('0x3a')](_0x5232c9['query'][_0x5b8f('0x3a')]);_0x199460['where']=qs['filters'](_[_0x5b8f('0x4d')](_0x5232c9['query'],_0x5bdd71['filters']));if(_0x5232c9[_0x5b8f('0x31')][_0x5b8f('0x3b')]){_0x199460['where']=_[_0x5b8f('0x3e')](_0x199460['where'],{'$or':_[_0x5b8f('0x2b')](_0x199460[_0x5b8f('0x35')],function(_0x2025df){var _0x46d306={};_0x46d306[_0x2025df]={'$like':'%'+_0x5232c9[_0x5b8f('0x31')][_0x5b8f('0x3b')]+'%'};return _0x46d306;})});}_0x199460=_['merge']({},_0x199460,_0x5232c9['options']);return _0x3e6a26[_0x5b8f('0x52')](_0x199460);}})[_0x5b8f('0x26')](function(_0x265fd5){if(_0x265fd5){_0x5170df=_0x265fd5[_0x5b8f('0x37')];if(!_0x5232c9['query'][_0x5b8f('0x4e')](_0x5b8f('0x38'))){_0x199460['limit']=qs[_0x5b8f('0x22')](_0x5232c9[_0x5b8f('0x31')][_0x5b8f('0x22')]);_0x199460[_0x5b8f('0x20')]=qs[_0x5b8f('0x20')](_0x5232c9[_0x5b8f('0x31')][_0x5b8f('0x20')]);}return _0x3e6a26[_0x5b8f('0x52')](_0x199460);}})[_0x5b8f('0x26')](function(_0x2a15c4){if(_0x2a15c4){return _0x2a15c4?{'count':_0x5170df,'rows':_0x2a15c4}:null;}})[_0x5b8f('0x26')](respondWithResult(_0x314706,null))['catch'](handleError(_0x314706,null));};exports['setTags']=function(_0x5c0d14,_0x3aab12,_0x372fd8){if(_0x5c0d14[_0x5b8f('0x49')]['id']){delete _0x5c0d14[_0x5b8f('0x49')]['id'];}return db[_0x5b8f('0x2c')][_0x5b8f('0x4c')]({'where':{'id':_0x5c0d14['params']['id']}})[_0x5b8f('0x26')](handleEntityNotFound(_0x3aab12,null))[_0x5b8f('0x26')](function(_0x21dfdd){if(_0x21dfdd){return _0x21dfdd[_0x5b8f('0x53')](_0x5c0d14['body'][_0x5b8f('0x54')]||[]);}return null;})['then'](respondWithResult(_0x3aab12,null))[_0x5b8f('0x43')](handleError(_0x3aab12,null));}; \ No newline at end of file +var _0xec9f=['find','catch','create','body','params','getFields','pick','hasOwnProperty','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','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','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','keys','includeAll'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xec9f,0x112));var _0xfec9=function(_0x1be386,_0x11e0ba){_0x1be386=_0x1be386-0x0;var _0x2ea485=_0xec9f[_0x1be386];return _0x2ea485;};'use strict';var emlformat=require(_0xfec9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfec9('0x1'));var jsonpatch=require(_0xfec9('0x2'));var rp=require(_0xfec9('0x3'));var moment=require(_0xfec9('0x4'));var BPromise=require(_0xfec9('0x5'));var Mustache=require(_0xfec9('0x6'));var util=require(_0xfec9('0x7'));var path=require(_0xfec9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfec9('0x9'));var _=require(_0xfec9('0xa'));var squel=require(_0xfec9('0xb'));var crypto=require('crypto');var jsforce=require(_0xfec9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfec9('0xd'));var querystring=require(_0xfec9('0xe'));var Papa=require(_0xfec9('0xf'));var Redis=require('ioredis');var authService=require(_0xfec9('0x10'));var qs=require(_0xfec9('0x11'));var as=require(_0xfec9('0x12'));var hardwareService=require(_0xfec9('0x13'));var logger=require(_0xfec9('0x14'))(_0xfec9('0x15'));var utils=require(_0xfec9('0x16'));var config=require(_0xfec9('0x17'));var licenseUtil=require(_0xfec9('0x18'));var db=require(_0xfec9('0x19'))['db'];function respondWithStatusCode(_0x203345,_0x5d0fdd){_0x5d0fdd=_0x5d0fdd||0xcc;return function(_0x3f008){if(_0x3f008){return _0x203345[_0xfec9('0x1a')](_0x5d0fdd);}return _0x203345[_0xfec9('0x1b')](_0x5d0fdd)[_0xfec9('0x1c')]();};}function respondWithResult(_0x21380b,_0x3ae337){_0x3ae337=_0x3ae337||0xc8;return function(_0xe46a8f){if(_0xe46a8f){return _0x21380b[_0xfec9('0x1b')](_0x3ae337)[_0xfec9('0x1d')](_0xe46a8f);}};}function respondWithFilteredResult(_0x231e9d,_0x55d412){return function(_0x1bcedc){if(_0x1bcedc){var _0x10f084=typeof _0x55d412['offset']===_0xfec9('0x1e')&&typeof _0x55d412[_0xfec9('0x1f')]==='undefined';var _0x576d14=_0x1bcedc[_0xfec9('0x20')];var _0x140531=_0x10f084?0x0:_0x55d412[_0xfec9('0x21')];var _0x2279be=_0x10f084?_0x1bcedc['count']:_0x55d412['offset']+_0x55d412[_0xfec9('0x1f')];var _0x3a4098;if(_0x2279be>=_0x576d14){_0x2279be=_0x576d14;_0x3a4098=0xc8;}else{_0x3a4098=0xce;}_0x231e9d[_0xfec9('0x1b')](_0x3a4098);return _0x231e9d[_0xfec9('0x22')]('Content-Range',_0x140531+'-'+_0x2279be+'/'+_0x576d14)[_0xfec9('0x1d')](_0x1bcedc);}return null;};}function patchUpdates(_0x251056){return function(_0x4955fd){try{jsonpatch[_0xfec9('0x23')](_0x4955fd,_0x251056,!![]);}catch(_0x2d375b){return BPromise[_0xfec9('0x24')](_0x2d375b);}return _0x4955fd[_0xfec9('0x25')]();};}function saveUpdates(_0x342a02,_0x3f39ed){return function(_0x2c3454){if(_0x2c3454){return _0x2c3454[_0xfec9('0x26')](_0x342a02)[_0xfec9('0x27')](function(_0x48b183){return _0x48b183;});}return null;};}function removeEntity(_0x4a0cc6,_0x5bb486){return function(_0x5b67b2){if(_0x5b67b2){return _0x5b67b2[_0xfec9('0x28')]()['then'](function(){_0x4a0cc6['status'](0xcc)[_0xfec9('0x1c')]();});}};}function handleEntityNotFound(_0x1006ad,_0x3b7423){return function(_0x4003a1){if(!_0x4003a1){_0x1006ad['sendStatus'](0x194);}return _0x4003a1;};}function handleError(_0x3e2736,_0x147b7c){_0x147b7c=_0x147b7c||0x1f4;return function(_0x2d2a3a){logger[_0xfec9('0x29')](_0x2d2a3a[_0xfec9('0x2a')]);if(_0x2d2a3a['name']){delete _0x2d2a3a[_0xfec9('0x2b')];}_0x3e2736['status'](_0x147b7c)['send'](_0x2d2a3a);};}exports['index']=function(_0x3366ec,_0x1a8e8d){var _0x46e76a={},_0x5dcd38={},_0x99c6f0={'count':0x0,'rows':[]};var _0x408bfc=_[_0xfec9('0x2c')](db[_0xfec9('0x2d')][_0xfec9('0x2e')],function(_0x2c7544){return{'name':_0x2c7544[_0xfec9('0x2f')],'type':_0x2c7544[_0xfec9('0x30')][_0xfec9('0x31')]};});_0x5dcd38[_0xfec9('0x32')]=_[_0xfec9('0x2c')](_0x408bfc,_0xfec9('0x2b'));_0x5dcd38['query']=_['keys'](_0x3366ec[_0xfec9('0x33')]);_0x5dcd38['filters']=_[_0xfec9('0x34')](_0x5dcd38[_0xfec9('0x32')],_0x5dcd38[_0xfec9('0x33')]);_0x46e76a['attributes']=_[_0xfec9('0x34')](_0x5dcd38[_0xfec9('0x32')],qs[_0xfec9('0x35')](_0x3366ec[_0xfec9('0x33')]['fields']));_0x46e76a['attributes']=_0x46e76a[_0xfec9('0x36')][_0xfec9('0x37')]?_0x46e76a[_0xfec9('0x36')]:_0x5dcd38['model'];if(!_0x3366ec[_0xfec9('0x33')]['hasOwnProperty'](_0xfec9('0x38'))){_0x46e76a[_0xfec9('0x1f')]=qs[_0xfec9('0x1f')](_0x3366ec[_0xfec9('0x33')][_0xfec9('0x1f')]);_0x46e76a[_0xfec9('0x21')]=qs['offset'](_0x3366ec[_0xfec9('0x33')][_0xfec9('0x21')]);}_0x46e76a[_0xfec9('0x39')]=qs['sort'](_0x3366ec[_0xfec9('0x33')][_0xfec9('0x3a')]);_0x46e76a[_0xfec9('0x3b')]=qs[_0xfec9('0x3c')](_['pick'](_0x3366ec[_0xfec9('0x33')],_0x5dcd38[_0xfec9('0x3c')]),_0x408bfc);if(_0x3366ec[_0xfec9('0x33')][_0xfec9('0x3d')]){_0x46e76a[_0xfec9('0x3b')]=_[_0xfec9('0x3e')](_0x46e76a['where'],{'$or':_['map'](_0x408bfc,function(_0x43612a){if(_0x43612a[_0xfec9('0x30')]!==_0xfec9('0x3f')){var _0x5c2f1d={};_0x5c2f1d[_0x43612a['name']]={'$like':'%'+_0x3366ec[_0xfec9('0x33')]['filter']+'%'};return _0x5c2f1d;}})});}_0x46e76a=_[_0xfec9('0x3e')]({},_0x46e76a,_0x3366ec[_0xfec9('0x40')]);var _0xca578a={'where':_0x46e76a[_0xfec9('0x3b')]};return db[_0xfec9('0x2d')][_0xfec9('0x20')](_0xca578a)[_0xfec9('0x27')](function(_0x3d2684){_0x99c6f0[_0xfec9('0x20')]=_0x3d2684;if(_0x3366ec[_0xfec9('0x33')]['includeAll']){_0x46e76a[_0xfec9('0x41')]=[{'all':!![]}];}return db[_0xfec9('0x2d')][_0xfec9('0x42')](_0x46e76a);})['then'](function(_0x41e5ab){_0x99c6f0[_0xfec9('0x43')]=_0x41e5ab;return _0x99c6f0;})[_0xfec9('0x27')](respondWithFilteredResult(_0x1a8e8d,_0x46e76a))['catch'](handleError(_0x1a8e8d,null));};exports['show']=function(_0x8a65e6,_0x4cb517){var _0x129cda={'raw':![],'where':{'id':_0x8a65e6['params']['id']}},_0x4553e6={};_0x4553e6['model']=_[_0xfec9('0x44')](db[_0xfec9('0x2d')][_0xfec9('0x2e')]);_0x4553e6['query']=_[_0xfec9('0x44')](_0x8a65e6[_0xfec9('0x33')]);_0x4553e6[_0xfec9('0x3c')]=_[_0xfec9('0x34')](_0x4553e6['model'],_0x4553e6[_0xfec9('0x33')]);_0x129cda[_0xfec9('0x36')]=_[_0xfec9('0x34')](_0x4553e6[_0xfec9('0x32')],qs['fields'](_0x8a65e6[_0xfec9('0x33')][_0xfec9('0x35')]));_0x129cda[_0xfec9('0x36')]=_0x129cda[_0xfec9('0x36')]['length']?_0x129cda[_0xfec9('0x36')]:_0x4553e6['model'];if(_0x8a65e6['query'][_0xfec9('0x45')]){_0x129cda[_0xfec9('0x41')]=[{'all':!![]}];}_0x129cda=_[_0xfec9('0x3e')]({},_0x129cda,_0x8a65e6[_0xfec9('0x40')]);return db[_0xfec9('0x2d')][_0xfec9('0x46')](_0x129cda)[_0xfec9('0x27')](handleEntityNotFound(_0x4cb517,null))[_0xfec9('0x27')](respondWithResult(_0x4cb517,null))[_0xfec9('0x47')](handleError(_0x4cb517,null));};exports['create']=function(_0x2ccc55,_0x207401){return db[_0xfec9('0x2d')][_0xfec9('0x48')](_0x2ccc55[_0xfec9('0x49')],{})[_0xfec9('0x27')](respondWithResult(_0x207401,0xc9))[_0xfec9('0x47')](handleError(_0x207401,null));};exports[_0xfec9('0x26')]=function(_0x4eda4e,_0x4b116c){if(_0x4eda4e[_0xfec9('0x49')]['id']){delete _0x4eda4e['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x4eda4e[_0xfec9('0x4a')]['id']}})[_0xfec9('0x27')](handleEntityNotFound(_0x4b116c,null))[_0xfec9('0x27')](saveUpdates(_0x4eda4e[_0xfec9('0x49')],null))[_0xfec9('0x27')](respondWithResult(_0x4b116c,null))[_0xfec9('0x47')](handleError(_0x4b116c,null));};exports[_0xfec9('0x28')]=function(_0x2844ec,_0x7657ea){return db['DeskConfiguration'][_0xfec9('0x46')]({'where':{'id':_0x2844ec[_0xfec9('0x4a')]['id']}})[_0xfec9('0x27')](handleEntityNotFound(_0x7657ea,null))[_0xfec9('0x27')](removeEntity(_0x7657ea,null))[_0xfec9('0x47')](handleError(_0x7657ea,null));};exports[_0xfec9('0x4b')]=function(_0x1df34d,_0x300ae9,_0x4e9c24){var _0x5f5633={};var _0x5e5f52={};var _0x47ef30;var _0x28d673;return db[_0xfec9('0x2d')]['findOne']({'where':{'id':_0x1df34d[_0xfec9('0x4a')]['id']}})[_0xfec9('0x27')](handleEntityNotFound(_0x300ae9,null))[_0xfec9('0x27')](function(_0x331086){if(_0x331086){_0x47ef30=_0x331086;_0x5e5f52['model']=_[_0xfec9('0x44')](db['DeskField']['rawAttributes']);_0x5e5f52[_0xfec9('0x33')]=_[_0xfec9('0x44')](_0x1df34d['query']);_0x5e5f52[_0xfec9('0x3c')]=_[_0xfec9('0x34')](_0x5e5f52[_0xfec9('0x32')],_0x5e5f52[_0xfec9('0x33')]);_0x5f5633[_0xfec9('0x36')]=_[_0xfec9('0x34')](_0x5e5f52[_0xfec9('0x32')],qs[_0xfec9('0x35')](_0x1df34d['query']['fields']));_0x5f5633[_0xfec9('0x36')]=_0x5f5633[_0xfec9('0x36')][_0xfec9('0x37')]?_0x5f5633[_0xfec9('0x36')]:_0x5e5f52[_0xfec9('0x32')];_0x5f5633[_0xfec9('0x39')]=qs['sort'](_0x1df34d['query']['sort']);_0x5f5633[_0xfec9('0x3b')]=qs[_0xfec9('0x3c')](_[_0xfec9('0x4c')](_0x1df34d[_0xfec9('0x33')],_0x5e5f52['filters']));if(_0x1df34d['query'][_0xfec9('0x3d')]){_0x5f5633['where']=_[_0xfec9('0x3e')](_0x5f5633[_0xfec9('0x3b')],{'$or':_[_0xfec9('0x2c')](_0x5f5633['attributes'],function(_0x54ab8b){var _0x25e4c7={};_0x25e4c7[_0x54ab8b]={'$like':'%'+_0x1df34d[_0xfec9('0x33')][_0xfec9('0x3d')]+'%'};return _0x25e4c7;})});}_0x5f5633=_[_0xfec9('0x3e')]({},_0x5f5633,_0x1df34d[_0xfec9('0x40')]);return _0x47ef30[_0xfec9('0x4b')](_0x5f5633);}})[_0xfec9('0x27')](function(_0x49c43c){if(_0x49c43c){_0x28d673=_0x49c43c[_0xfec9('0x37')];if(!_0x1df34d[_0xfec9('0x33')][_0xfec9('0x4d')](_0xfec9('0x38'))){_0x5f5633['limit']=qs[_0xfec9('0x1f')](_0x1df34d[_0xfec9('0x33')][_0xfec9('0x1f')]);_0x5f5633[_0xfec9('0x21')]=qs['offset'](_0x1df34d[_0xfec9('0x33')]['offset']);}return _0x47ef30['getFields'](_0x5f5633);}})[_0xfec9('0x27')](function(_0x5f542a){if(_0x5f542a){return _0x5f542a?{'count':_0x28d673,'rows':_0x5f542a}:null;}})[_0xfec9('0x27')](respondWithResult(_0x300ae9,null))[_0xfec9('0x47')](handleError(_0x300ae9,null));};exports['getSubjects']=function(_0x56f0d9,_0x2cd743,_0x2b3156){var _0x31155a={};var _0x4f4928={};var _0x3d9c35;var _0x508ed5;return db[_0xfec9('0x2d')][_0xfec9('0x4e')]({'where':{'id':_0x56f0d9[_0xfec9('0x4a')]['id']}})[_0xfec9('0x27')](handleEntityNotFound(_0x2cd743,null))[_0xfec9('0x27')](function(_0xe281f0){if(_0xe281f0){_0x3d9c35=_0xe281f0;_0x4f4928[_0xfec9('0x32')]=_[_0xfec9('0x44')](db[_0xfec9('0x4f')][_0xfec9('0x2e')]);_0x4f4928[_0xfec9('0x33')]=_['keys'](_0x56f0d9[_0xfec9('0x33')]);_0x4f4928['filters']=_[_0xfec9('0x34')](_0x4f4928['model'],_0x4f4928[_0xfec9('0x33')]);_0x31155a[_0xfec9('0x36')]=_[_0xfec9('0x34')](_0x4f4928[_0xfec9('0x32')],qs['fields'](_0x56f0d9[_0xfec9('0x33')]['fields']));_0x31155a[_0xfec9('0x36')]=_0x31155a['attributes'][_0xfec9('0x37')]?_0x31155a[_0xfec9('0x36')]:_0x4f4928[_0xfec9('0x32')];_0x31155a['order']=qs[_0xfec9('0x3a')](_0x56f0d9[_0xfec9('0x33')]['sort']);_0x31155a[_0xfec9('0x3b')]=qs[_0xfec9('0x3c')](_[_0xfec9('0x4c')](_0x56f0d9[_0xfec9('0x33')],_0x4f4928[_0xfec9('0x3c')]));if(_0x56f0d9[_0xfec9('0x33')]['filter']){_0x31155a[_0xfec9('0x3b')]=_[_0xfec9('0x3e')](_0x31155a[_0xfec9('0x3b')],{'$or':_['map'](_0x31155a[_0xfec9('0x36')],function(_0x31e862){var _0x413496={};_0x413496[_0x31e862]={'$like':'%'+_0x56f0d9[_0xfec9('0x33')][_0xfec9('0x3d')]+'%'};return _0x413496;})});}_0x31155a=_[_0xfec9('0x3e')]({},_0x31155a,_0x56f0d9[_0xfec9('0x40')]);return _0x3d9c35[_0xfec9('0x50')](_0x31155a);}})[_0xfec9('0x27')](function(_0x5cc82e){if(_0x5cc82e){_0x508ed5=_0x5cc82e[_0xfec9('0x37')];if(!_0x56f0d9[_0xfec9('0x33')][_0xfec9('0x4d')](_0xfec9('0x38'))){_0x31155a[_0xfec9('0x1f')]=qs[_0xfec9('0x1f')](_0x56f0d9['query'][_0xfec9('0x1f')]);_0x31155a['offset']=qs[_0xfec9('0x21')](_0x56f0d9[_0xfec9('0x33')][_0xfec9('0x21')]);}return _0x3d9c35[_0xfec9('0x50')](_0x31155a);}})[_0xfec9('0x27')](function(_0x5700f5){if(_0x5700f5){return _0x5700f5?{'count':_0x508ed5,'rows':_0x5700f5}:null;}})[_0xfec9('0x27')](respondWithResult(_0x2cd743,null))[_0xfec9('0x47')](handleError(_0x2cd743,null));};exports[_0xfec9('0x51')]=function(_0x3cb075,_0x535422,_0x57035f){var _0x17f67a={};var _0x30992a={};var _0x217438;var _0x4798dd;return db[_0xfec9('0x2d')][_0xfec9('0x4e')]({'where':{'id':_0x3cb075['params']['id']}})[_0xfec9('0x27')](handleEntityNotFound(_0x535422,null))[_0xfec9('0x27')](function(_0x4dec0c){if(_0x4dec0c){_0x217438=_0x4dec0c;_0x30992a['model']=_[_0xfec9('0x44')](db[_0xfec9('0x4f')][_0xfec9('0x2e')]);_0x30992a[_0xfec9('0x33')]=_[_0xfec9('0x44')](_0x3cb075[_0xfec9('0x33')]);_0x30992a['filters']=_[_0xfec9('0x34')](_0x30992a[_0xfec9('0x32')],_0x30992a[_0xfec9('0x33')]);_0x17f67a[_0xfec9('0x36')]=_['intersection'](_0x30992a[_0xfec9('0x32')],qs['fields'](_0x3cb075[_0xfec9('0x33')]['fields']));_0x17f67a['attributes']=_0x17f67a[_0xfec9('0x36')]['length']?_0x17f67a['attributes']:_0x30992a[_0xfec9('0x32')];_0x17f67a[_0xfec9('0x39')]=qs[_0xfec9('0x3a')](_0x3cb075[_0xfec9('0x33')][_0xfec9('0x3a')]);_0x17f67a[_0xfec9('0x3b')]=qs[_0xfec9('0x3c')](_[_0xfec9('0x4c')](_0x3cb075[_0xfec9('0x33')],_0x30992a[_0xfec9('0x3c')]));if(_0x3cb075[_0xfec9('0x33')][_0xfec9('0x3d')]){_0x17f67a[_0xfec9('0x3b')]=_['merge'](_0x17f67a['where'],{'$or':_['map'](_0x17f67a['attributes'],function(_0x585ce9){var _0x1a6ee8={};_0x1a6ee8[_0x585ce9]={'$like':'%'+_0x3cb075[_0xfec9('0x33')][_0xfec9('0x3d')]+'%'};return _0x1a6ee8;})});}_0x17f67a=_[_0xfec9('0x3e')]({},_0x17f67a,_0x3cb075[_0xfec9('0x40')]);return _0x217438[_0xfec9('0x51')](_0x17f67a);}})[_0xfec9('0x27')](function(_0x1e57f1){if(_0x1e57f1){_0x4798dd=_0x1e57f1['length'];if(!_0x3cb075[_0xfec9('0x33')][_0xfec9('0x4d')](_0xfec9('0x38'))){_0x17f67a[_0xfec9('0x1f')]=qs[_0xfec9('0x1f')](_0x3cb075[_0xfec9('0x33')][_0xfec9('0x1f')]);_0x17f67a[_0xfec9('0x21')]=qs['offset'](_0x3cb075[_0xfec9('0x33')][_0xfec9('0x21')]);}return _0x217438[_0xfec9('0x51')](_0x17f67a);}})[_0xfec9('0x27')](function(_0x2ea50f){if(_0x2ea50f){return _0x2ea50f?{'count':_0x4798dd,'rows':_0x2ea50f}:null;}})[_0xfec9('0x27')](respondWithResult(_0x535422,null))[_0xfec9('0x47')](handleError(_0x535422,null));};exports[_0xfec9('0x52')]=function(_0x2ad29e,_0x55a43c,_0xd38950){var _0x73ecb2={};var _0x201298={};var _0x4d6ffb;var _0x111fbf;return db[_0xfec9('0x2d')]['findOne']({'where':{'id':_0x2ad29e[_0xfec9('0x4a')]['id']}})[_0xfec9('0x27')](handleEntityNotFound(_0x55a43c,null))[_0xfec9('0x27')](function(_0x2d3032){if(_0x2d3032){_0x4d6ffb=_0x2d3032;_0x201298['model']=_['keys'](db[_0xfec9('0x53')]['rawAttributes']);_0x201298[_0xfec9('0x33')]=_[_0xfec9('0x44')](_0x2ad29e['query']);_0x201298['filters']=_['intersection'](_0x201298[_0xfec9('0x32')],_0x201298[_0xfec9('0x33')]);_0x73ecb2[_0xfec9('0x36')]=_[_0xfec9('0x34')](_0x201298[_0xfec9('0x32')],qs[_0xfec9('0x35')](_0x2ad29e['query'][_0xfec9('0x35')]));_0x73ecb2['attributes']=_0x73ecb2['attributes'][_0xfec9('0x37')]?_0x73ecb2[_0xfec9('0x36')]:_0x201298[_0xfec9('0x32')];_0x73ecb2['order']=qs[_0xfec9('0x3a')](_0x2ad29e[_0xfec9('0x33')]['sort']);_0x73ecb2[_0xfec9('0x3b')]=qs[_0xfec9('0x3c')](_[_0xfec9('0x4c')](_0x2ad29e[_0xfec9('0x33')],_0x201298['filters']));if(_0x2ad29e[_0xfec9('0x33')][_0xfec9('0x3d')]){_0x73ecb2[_0xfec9('0x3b')]=_[_0xfec9('0x3e')](_0x73ecb2[_0xfec9('0x3b')],{'$or':_[_0xfec9('0x2c')](_0x73ecb2[_0xfec9('0x36')],function(_0x550568){var _0x57a00c={};_0x57a00c[_0x550568]={'$like':'%'+_0x2ad29e[_0xfec9('0x33')][_0xfec9('0x3d')]+'%'};return _0x57a00c;})});}_0x73ecb2=_[_0xfec9('0x3e')]({},_0x73ecb2,_0x2ad29e['options']);return _0x4d6ffb[_0xfec9('0x52')](_0x73ecb2);}})[_0xfec9('0x27')](function(_0x5ebc25){if(_0x5ebc25){_0x111fbf=_0x5ebc25['length'];if(!_0x2ad29e[_0xfec9('0x33')][_0xfec9('0x4d')]('nolimit')){_0x73ecb2[_0xfec9('0x1f')]=qs['limit'](_0x2ad29e[_0xfec9('0x33')][_0xfec9('0x1f')]);_0x73ecb2['offset']=qs[_0xfec9('0x21')](_0x2ad29e[_0xfec9('0x33')]['offset']);}return _0x4d6ffb[_0xfec9('0x52')](_0x73ecb2);}})[_0xfec9('0x27')](function(_0x223895){if(_0x223895){return _0x223895?{'count':_0x111fbf,'rows':_0x223895}:null;}})[_0xfec9('0x27')](respondWithResult(_0x55a43c,null))[_0xfec9('0x47')](handleError(_0x55a43c,null));};exports[_0xfec9('0x54')]=function(_0x2d7135,_0x4f62d1,_0x940a39){if(_0x2d7135[_0xfec9('0x49')]['id']){delete _0x2d7135[_0xfec9('0x49')]['id'];}return db[_0xfec9('0x2d')][_0xfec9('0x4e')]({'where':{'id':_0x2d7135[_0xfec9('0x4a')]['id']}})[_0xfec9('0x27')](handleEntityNotFound(_0x4f62d1,null))[_0xfec9('0x27')](function(_0x429f95){if(_0x429f95){return _0x429f95[_0xfec9('0x54')](_0x2d7135[_0xfec9('0x49')][_0xfec9('0x55')]||[]);}return null;})['then'](respondWithResult(_0x4f62d1,null))[_0xfec9('0x47')](handleError(_0x4f62d1,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ed6108f..4ab9921 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 _0xddda=['exports','define','int_desk_configurations','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x562eea,_0x1f9ea7){var _0x39caf9=function(_0x14f022){while(--_0x14f022){_0x562eea['push'](_0x562eea['shift']());}};_0x39caf9(++_0x1f9ea7);}(_0xddda,0x8f));var _0xaddd=function(_0x1a24a0,_0x12f21f){_0x1a24a0=_0x1a24a0-0x0;var _0x2eca50=_0xddda[_0x1a24a0];return _0x2eca50;};'use strict';var _=require(_0xaddd('0x0'));var util=require(_0xaddd('0x1'));var logger=require(_0xaddd('0x2'))('api');var moment=require(_0xaddd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaddd('0x4'));var config=require(_0xaddd('0x5'));var attributes=require(_0xaddd('0x6'));module[_0xaddd('0x7')]=function(_0x3c4b14,_0xccb3ab){return _0x3c4b14[_0xaddd('0x8')]('DeskConfiguration',attributes,{'tableName':_0xaddd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b89=['moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','../../config/logger','api'];(function(_0xbfb594,_0x29abad){var _0x51e37b=function(_0x3d1f62){while(--_0x3d1f62){_0xbfb594['push'](_0xbfb594['shift']());}};_0x51e37b(++_0x29abad);}(_0x8b89,0x7e));var _0x98b8=function(_0x54df26,_0x5203ee){_0x54df26=_0x54df26-0x0;var _0xeff4b3=_0x8b89[_0x54df26];return _0xeff4b3;};'use strict';var _=require(_0x98b8('0x0'));var util=require(_0x98b8('0x1'));var logger=require(_0x98b8('0x2'))(_0x98b8('0x3'));var moment=require(_0x98b8('0x4'));var BPromise=require(_0x98b8('0x5'));var rp=require(_0x98b8('0x6'));var fs=require('fs');var path=require(_0x98b8('0x7'));var rimraf=require(_0x98b8('0x8'));var config=require('../../config/environment');var attributes=require(_0x98b8('0x9'));module[_0x98b8('0xa')]=function(_0x41fa2f,_0x48868c){return _0x41fa2f[_0x98b8('0xb')](_0x98b8('0xc'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index b899c43..7005e64 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 _0xb94c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0xb94c,0x176));var _0xcb94=function(_0x2cdc7a,_0x38d065){_0x2cdc7a=_0x2cdc7a-0x0;var _0xb32d2b=_0xb94c[_0x2cdc7a];return _0xb32d2b;};'use strict';var _=require(_0xcb94('0x0'));var util=require(_0xcb94('0x1'));var moment=require('moment');var BPromise=require(_0xcb94('0x2'));var rs=require(_0xcb94('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb94('0x5'))(_0xcb94('0x6'));var config=require(_0xcb94('0x7'));var jayson=require(_0xcb94('0x8'));var client=jayson[_0xcb94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ab328,_0x27441c,_0x20f879){return new BPromise(function(_0x22cac1,_0x16288f){return client['request'](_0x3ab328,_0x20f879)[_0xcb94('0xa')](function(_0x3305c9){logger[_0xcb94('0xb')](_0xcb94('0xc'),_0x27441c,'request\x20sent');logger[_0xcb94('0xd')](_0xcb94('0xe'),_0x27441c,_0xcb94('0xf'),JSON[_0xcb94('0x10')](_0x3305c9));if(_0x3305c9[_0xcb94('0x11')]){if(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x12')]===0x1f4){logger[_0xcb94('0x11')](_0xcb94('0xc'),_0x27441c,_0x3305c9[_0xcb94('0x11')]['message']);return _0x16288f(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x13')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x27441c,_0x3305c9['error']['message']);return _0x22cac1(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x13')]);}else{logger[_0xcb94('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x27441c,_0xcb94('0xf'));_0x22cac1(_0x3305c9['result'][_0xcb94('0x13')]);}})[_0xcb94('0x14')](function(_0x3dbfbb){logger[_0xcb94('0x11')](_0xcb94('0xc'),_0x27441c,_0x3dbfbb);_0x16288f(_0x3dbfbb);});});} \ No newline at end of file +var _0xf970=['../../config/logger','../../config/environment','jayson/promise','client','http','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f97('0x0'));var util=require('util');var moment=require(_0x0f97('0x1'));var BPromise=require(_0x0f97('0x2'));var rs=require(_0x0f97('0x3'));var fs=require('fs');var Redis=require(_0x0f97('0x4'));var db=require(_0x0f97('0x5'))['db'];var utils=require(_0x0f97('0x6'));var logger=require(_0x0f97('0x7'))('rpc');var config=require(_0x0f97('0x8'));var jayson=require(_0x0f97('0x9'));var client=jayson[_0x0f97('0xa')][_0x0f97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3515,_0x3244a6,_0x12fbb3){return new BPromise(function(_0x374083,_0x2891f7){return client['request'](_0x2e3515,_0x12fbb3)['then'](function(_0x12397b){logger['info'](_0x0f97('0xc'),_0x3244a6,_0x0f97('0xd'));logger[_0x0f97('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3244a6,_0x0f97('0xd'),JSON['stringify'](_0x12397b));if(_0x12397b[_0x0f97('0xf')]){if(_0x12397b[_0x0f97('0xf')][_0x0f97('0x10')]===0x1f4){logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x12397b['error'][_0x0f97('0x11')]);return _0x2891f7(_0x12397b[_0x0f97('0xf')][_0x0f97('0x11')]);}logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x12397b[_0x0f97('0xf')][_0x0f97('0x11')]);return _0x374083(_0x12397b['error']['message']);}else{logger[_0x0f97('0x12')](_0x0f97('0xc'),_0x3244a6,_0x0f97('0xd'));_0x374083(_0x12397b[_0x0f97('0x13')]['message']);}})['catch'](function(_0x336f61){logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x336f61);_0x2891f7(_0x336f61);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 0f7ce00..1242025 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 _0x91d2=['./intDeskField.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0xe14f77,_0x3ee4ad){var _0x178c57=function(_0x50b827){while(--_0x50b827){_0xe14f77['push'](_0xe14f77['shift']());}};_0x178c57(++_0x3ee4ad);}(_0x91d2,0x188));var _0x291d=function(_0x3d62b3,_0xacbab4){_0x3d62b3=_0x3d62b3-0x0;var _0x45b6dc=_0x91d2[_0x3d62b3];return _0x45b6dc;};'use strict';var multer=require(_0x291d('0x0'));var util=require(_0x291d('0x1'));var path=require(_0x291d('0x2'));var timeout=require('connect-timeout');var express=require(_0x291d('0x3'));var router=express[_0x291d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x291d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x291d('0x6'));var controller=require(_0x291d('0x7'));router[_0x291d('0x8')]('/',auth['isAuthenticated'](),controller[_0x291d('0x9')]);router[_0x291d('0x8')](_0x291d('0xa'),auth[_0x291d('0xb')](),controller[_0x291d('0xc')]);router[_0x291d('0xd')]('/',auth[_0x291d('0xb')](),controller['create']);router[_0x291d('0xe')](_0x291d('0xa'),auth[_0x291d('0xb')](),controller[_0x291d('0xf')]);router[_0x291d('0x10')](_0x291d('0xa'),auth[_0x291d('0xb')](),controller[_0x291d('0x11')]);module[_0x291d('0x12')]=router; \ No newline at end of file +var _0x0bd5=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x0bd5,0x189));var _0x50bd=function(_0xc7b672,_0x30bb04){_0xc7b672=_0xc7b672-0x0;var _0x24b2d0=_0x0bd5[_0xc7b672];return _0x24b2d0;};'use strict';var multer=require(_0x50bd('0x0'));var util=require(_0x50bd('0x1'));var path=require(_0x50bd('0x2'));var timeout=require(_0x50bd('0x3'));var express=require(_0x50bd('0x4'));var router=express[_0x50bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x50bd('0x6'));var interaction=require(_0x50bd('0x7'));var config=require(_0x50bd('0x8'));var controller=require(_0x50bd('0x9'));router[_0x50bd('0xa')]('/',auth[_0x50bd('0xb')](),controller[_0x50bd('0xc')]);router[_0x50bd('0xa')](_0x50bd('0xd'),auth[_0x50bd('0xb')](),controller[_0x50bd('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x50bd('0xf')]);router[_0x50bd('0x10')]('/:id',auth[_0x50bd('0xb')](),controller[_0x50bd('0x11')]);router['delete'](_0x50bd('0xd'),auth['isAuthenticated'](),controller[_0x50bd('0x12')]);module[_0x50bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index de9ac1b..e13d002 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 _0xb0f3=['exports','variable','customVariable','keyValue','string','STRING','ENUM','sequelize'];(function(_0x22e03a,_0x1063df){var _0x326c4b=function(_0x22ace9){while(--_0x22ace9){_0x22e03a['push'](_0x22e03a['shift']());}};_0x326c4b(++_0x1063df);}(_0xb0f3,0xa7));var _0x3b0f=function(_0x3f333c,_0x14f59a){_0x3f333c=_0x3f333c-0x0;var _0x6af3ad=_0xb0f3[_0x3f333c];return _0x6af3ad;};'use strict';var Sequelize=require(_0x3b0f('0x0'));module[_0x3b0f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x3b0f('0x2'),_0x3b0f('0x3'),_0x3b0f('0x4'),'picklist'),'defaultValue':_0x3b0f('0x5')},'content':{'type':Sequelize[_0x3b0f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3b0f('0x7')]('string',_0x3b0f('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x3b0f('0x6')]},'idField':{'type':Sequelize[_0x3b0f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3b0f('0x6')]}}; \ No newline at end of file +var _0xe9ff=['string','variable','keyValue','STRING','customVariable','exports','ENUM'];(function(_0x425c81,_0x5529b4){var _0x13b023=function(_0x38a778){while(--_0x38a778){_0x425c81['push'](_0x425c81['shift']());}};_0x13b023(++_0x5529b4);}(_0xe9ff,0xe5));var _0xfe9f=function(_0x59f51a,_0x104cb1){_0x59f51a=_0x59f51a-0x0;var _0x5dacb2=_0xe9ff[_0x59f51a];return _0x5dacb2;};'use strict';var Sequelize=require('sequelize');module[_0xfe9f('0x0')]={'type':{'type':Sequelize[_0xfe9f('0x1')](_0xfe9f('0x2'),_0xfe9f('0x3'),'customVariable',_0xfe9f('0x4'),'picklist'),'defaultValue':_0xfe9f('0x2')},'content':{'type':Sequelize[_0xfe9f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfe9f('0x1')]('string',_0xfe9f('0x3'),_0xfe9f('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfe9f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 45fd089..8cee3fa 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 _0xfd1b=['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','json','undefined','limit','count','status','set','reject','save','update','destroy','then','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','show','find','catch','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash'];(function(_0x13a275,_0x3959a5){var _0x45919a=function(_0x56cb70){while(--_0x56cb70){_0x13a275['push'](_0x13a275['shift']());}};_0x45919a(++_0x3959a5);}(_0xfd1b,0x1b1));var _0xbfd1=function(_0x1f924a,_0x1f096d){_0x1f924a=_0x1f924a-0x0;var _0x49d6d0=_0xfd1b[_0x1f924a];return _0x49d6d0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbfd1('0x0'));var jsonpatch=require(_0xbfd1('0x1'));var rp=require(_0xbfd1('0x2'));var moment=require(_0xbfd1('0x3'));var BPromise=require(_0xbfd1('0x4'));var Mustache=require('mustache');var util=require(_0xbfd1('0x5'));var path=require(_0xbfd1('0x6'));var sox=require(_0xbfd1('0x7'));var csv=require('to-csv');var ejs=require(_0xbfd1('0x8'));var fs=require('fs');var fs_extra=require(_0xbfd1('0x9'));var _=require(_0xbfd1('0xa'));var squel=require(_0xbfd1('0xb'));var crypto=require(_0xbfd1('0xc'));var jsforce=require(_0xbfd1('0xd'));var deskjs=require(_0xbfd1('0xe'));var toCsv=require(_0xbfd1('0xf'));var querystring=require('querystring');var Papa=require(_0xbfd1('0x10'));var Redis=require('ioredis');var authService=require(_0xbfd1('0x11'));var qs=require(_0xbfd1('0x12'));var as=require(_0xbfd1('0x13'));var hardwareService=require(_0xbfd1('0x14'));var logger=require(_0xbfd1('0x15'))(_0xbfd1('0x16'));var utils=require(_0xbfd1('0x17'));var config=require(_0xbfd1('0x18'));var licenseUtil=require(_0xbfd1('0x19'));var db=require(_0xbfd1('0x1a'))['db'];function respondWithStatusCode(_0x3390e2,_0x521c41){_0x521c41=_0x521c41||0xcc;return function(_0x12b4d2){if(_0x12b4d2){return _0x3390e2[_0xbfd1('0x1b')](_0x521c41);}return _0x3390e2['status'](_0x521c41)['end']();};}function respondWithResult(_0x9aebf2,_0x4a968e){_0x4a968e=_0x4a968e||0xc8;return function(_0xa2e380){if(_0xa2e380){return _0x9aebf2['status'](_0x4a968e)[_0xbfd1('0x1c')](_0xa2e380);}};}function respondWithFilteredResult(_0x6de36,_0x223ff5){return function(_0x4c8303){if(_0x4c8303){var _0x5d039f=typeof _0x223ff5['offset']===_0xbfd1('0x1d')&&typeof _0x223ff5[_0xbfd1('0x1e')]===_0xbfd1('0x1d');var _0x27381f=_0x4c8303[_0xbfd1('0x1f')];var _0x3f6913=_0x5d039f?0x0:_0x223ff5['offset'];var _0xf824d7=_0x5d039f?_0x4c8303[_0xbfd1('0x1f')]:_0x223ff5['offset']+_0x223ff5[_0xbfd1('0x1e')];var _0x4b1086;if(_0xf824d7>=_0x27381f){_0xf824d7=_0x27381f;_0x4b1086=0xc8;}else{_0x4b1086=0xce;}_0x6de36[_0xbfd1('0x20')](_0x4b1086);return _0x6de36[_0xbfd1('0x21')]('Content-Range',_0x3f6913+'-'+_0xf824d7+'/'+_0x27381f)[_0xbfd1('0x1c')](_0x4c8303);}return null;};}function patchUpdates(_0x44c3ba){return function(_0x3b8653){try{jsonpatch['apply'](_0x3b8653,_0x44c3ba,!![]);}catch(_0x52f02b){return BPromise[_0xbfd1('0x22')](_0x52f02b);}return _0x3b8653[_0xbfd1('0x23')]();};}function saveUpdates(_0x10480f,_0x813f06){return function(_0x1a27a7){if(_0x1a27a7){return _0x1a27a7[_0xbfd1('0x24')](_0x10480f)['then'](function(_0x53bebe){return _0x53bebe;});}return null;};}function removeEntity(_0x3f22d9,_0x9b225d){return function(_0x36aed3){if(_0x36aed3){return _0x36aed3[_0xbfd1('0x25')]()[_0xbfd1('0x26')](function(){_0x3f22d9[_0xbfd1('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28072a,_0x24df99){return function(_0x67df92){if(!_0x67df92){_0x28072a['sendStatus'](0x194);}return _0x67df92;};}function handleError(_0x306097,_0x55cdb2){_0x55cdb2=_0x55cdb2||0x1f4;return function(_0x3dbbc0){logger[_0xbfd1('0x27')](_0x3dbbc0[_0xbfd1('0x28')]);if(_0x3dbbc0[_0xbfd1('0x29')]){delete _0x3dbbc0[_0xbfd1('0x29')];}_0x306097[_0xbfd1('0x20')](_0x55cdb2)['send'](_0x3dbbc0);};}exports[_0xbfd1('0x2a')]=function(_0xe6f7b0,_0x1342dc){var _0x9a5bcc={},_0x5f144a={},_0x12d43d={'count':0x0,'rows':[]};var _0x5cafc6=_[_0xbfd1('0x2b')](db[_0xbfd1('0x2c')][_0xbfd1('0x2d')],function(_0x4e7727){return{'name':_0x4e7727[_0xbfd1('0x2e')],'type':_0x4e7727[_0xbfd1('0x2f')][_0xbfd1('0x30')]};});_0x5f144a[_0xbfd1('0x31')]=_['map'](_0x5cafc6,_0xbfd1('0x29'));_0x5f144a['query']=_[_0xbfd1('0x32')](_0xe6f7b0[_0xbfd1('0x33')]);_0x5f144a['filters']=_[_0xbfd1('0x34')](_0x5f144a['model'],_0x5f144a[_0xbfd1('0x33')]);_0x9a5bcc[_0xbfd1('0x35')]=_[_0xbfd1('0x34')](_0x5f144a['model'],qs[_0xbfd1('0x36')](_0xe6f7b0[_0xbfd1('0x33')]['fields']));_0x9a5bcc[_0xbfd1('0x35')]=_0x9a5bcc[_0xbfd1('0x35')]['length']?_0x9a5bcc[_0xbfd1('0x35')]:_0x5f144a[_0xbfd1('0x31')];if(!_0xe6f7b0[_0xbfd1('0x33')][_0xbfd1('0x37')](_0xbfd1('0x38'))){_0x9a5bcc[_0xbfd1('0x1e')]=qs['limit'](_0xe6f7b0[_0xbfd1('0x33')][_0xbfd1('0x1e')]);_0x9a5bcc[_0xbfd1('0x39')]=qs[_0xbfd1('0x39')](_0xe6f7b0[_0xbfd1('0x33')][_0xbfd1('0x39')]);}_0x9a5bcc[_0xbfd1('0x3a')]=qs[_0xbfd1('0x3b')](_0xe6f7b0[_0xbfd1('0x33')]['sort']);_0x9a5bcc[_0xbfd1('0x3c')]=qs[_0xbfd1('0x3d')](_['pick'](_0xe6f7b0['query'],_0x5f144a['filters']),_0x5cafc6);if(_0xe6f7b0[_0xbfd1('0x33')][_0xbfd1('0x3e')]){_0x9a5bcc[_0xbfd1('0x3c')]=_[_0xbfd1('0x3f')](_0x9a5bcc[_0xbfd1('0x3c')],{'$or':_['map'](_0x5cafc6,function(_0x44c5b6){if(_0x44c5b6['type']!=='VIRTUAL'){var _0x20b77d={};_0x20b77d[_0x44c5b6[_0xbfd1('0x29')]]={'$like':'%'+_0xe6f7b0[_0xbfd1('0x33')]['filter']+'%'};return _0x20b77d;}})});}_0x9a5bcc=_[_0xbfd1('0x3f')]({},_0x9a5bcc,_0xe6f7b0[_0xbfd1('0x40')]);var _0x116ad4={'where':_0x9a5bcc[_0xbfd1('0x3c')]};return db[_0xbfd1('0x2c')][_0xbfd1('0x1f')](_0x116ad4)['then'](function(_0x1b0267){_0x12d43d[_0xbfd1('0x1f')]=_0x1b0267;if(_0xe6f7b0[_0xbfd1('0x33')][_0xbfd1('0x41')]){_0x9a5bcc[_0xbfd1('0x42')]=[{'all':!![]}];}return db['DeskField'][_0xbfd1('0x43')](_0x9a5bcc);})[_0xbfd1('0x26')](function(_0xf03c46){_0x12d43d['rows']=_0xf03c46;return _0x12d43d;})['then'](respondWithFilteredResult(_0x1342dc,_0x9a5bcc))['catch'](handleError(_0x1342dc,null));};exports[_0xbfd1('0x44')]=function(_0x5263f8,_0x470869){var _0x4f5ac8={'raw':!![],'where':{'id':_0x5263f8['params']['id']}},_0x51ade4={};_0x51ade4[_0xbfd1('0x31')]=_[_0xbfd1('0x32')](db['DeskField'][_0xbfd1('0x2d')]);_0x51ade4[_0xbfd1('0x33')]=_[_0xbfd1('0x32')](_0x5263f8['query']);_0x51ade4['filters']=_['intersection'](_0x51ade4['model'],_0x51ade4[_0xbfd1('0x33')]);_0x4f5ac8['attributes']=_[_0xbfd1('0x34')](_0x51ade4[_0xbfd1('0x31')],qs[_0xbfd1('0x36')](_0x5263f8['query'][_0xbfd1('0x36')]));_0x4f5ac8[_0xbfd1('0x35')]=_0x4f5ac8[_0xbfd1('0x35')]['length']?_0x4f5ac8['attributes']:_0x51ade4['model'];if(_0x5263f8[_0xbfd1('0x33')][_0xbfd1('0x41')]){_0x4f5ac8[_0xbfd1('0x42')]=[{'all':!![]}];}_0x4f5ac8=_[_0xbfd1('0x3f')]({},_0x4f5ac8,_0x5263f8[_0xbfd1('0x40')]);return db[_0xbfd1('0x2c')][_0xbfd1('0x45')](_0x4f5ac8)[_0xbfd1('0x26')](handleEntityNotFound(_0x470869,null))[_0xbfd1('0x26')](respondWithResult(_0x470869,null))[_0xbfd1('0x46')](handleError(_0x470869,null));};exports[_0xbfd1('0x47')]=function(_0x17cd61,_0x1138be){return db['DeskField'][_0xbfd1('0x47')](_0x17cd61[_0xbfd1('0x48')],{})[_0xbfd1('0x26')](respondWithResult(_0x1138be,0xc9))[_0xbfd1('0x46')](handleError(_0x1138be,null));};exports['update']=function(_0x4f2a3c,_0x28ff3a){if(_0x4f2a3c[_0xbfd1('0x48')]['id']){delete _0x4f2a3c[_0xbfd1('0x48')]['id'];}return db[_0xbfd1('0x2c')][_0xbfd1('0x45')]({'where':{'id':_0x4f2a3c['params']['id']}})[_0xbfd1('0x26')](handleEntityNotFound(_0x28ff3a,null))[_0xbfd1('0x26')](saveUpdates(_0x4f2a3c[_0xbfd1('0x48')],null))[_0xbfd1('0x26')](respondWithResult(_0x28ff3a,null))[_0xbfd1('0x46')](handleError(_0x28ff3a,null));};exports['destroy']=function(_0x2fa869,_0xd8f84){return db[_0xbfd1('0x2c')]['find']({'where':{'id':_0x2fa869[_0xbfd1('0x49')]['id']}})[_0xbfd1('0x26')](handleEntityNotFound(_0xd8f84,null))[_0xbfd1('0x26')](removeEntity(_0xd8f84,null))[_0xbfd1('0x46')](handleError(_0xd8f84,null));}; \ No newline at end of file +var _0x9ab0=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model'];(function(_0x2ab059,_0x3ad983){var _0x59f1b2=function(_0x3c2e82){while(--_0x3c2e82){_0x2ab059['push'](_0x2ab059['shift']());}};_0x59f1b2(++_0x3ad983);}(_0x9ab0,0x195));var _0x09ab=function(_0xe95220,_0x3c1a43){_0xe95220=_0xe95220-0x0;var _0x2c506e=_0x9ab0[_0xe95220];return _0x2c506e;};'use strict';var emlformat=require(_0x09ab('0x0'));var rimraf=require(_0x09ab('0x1'));var zipdir=require(_0x09ab('0x2'));var jsonpatch=require(_0x09ab('0x3'));var rp=require(_0x09ab('0x4'));var moment=require(_0x09ab('0x5'));var BPromise=require(_0x09ab('0x6'));var Mustache=require(_0x09ab('0x7'));var util=require(_0x09ab('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x09ab('0x9'));var fs=require('fs');var fs_extra=require(_0x09ab('0xa'));var _=require(_0x09ab('0xb'));var squel=require(_0x09ab('0xc'));var crypto=require(_0x09ab('0xd'));var jsforce=require(_0x09ab('0xe'));var deskjs=require(_0x09ab('0xf'));var toCsv=require(_0x09ab('0x10'));var querystring=require(_0x09ab('0x11'));var Papa=require('papaparse');var Redis=require(_0x09ab('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x09ab('0x13'));var as=require(_0x09ab('0x14'));var hardwareService=require(_0x09ab('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x09ab('0x16'));var config=require(_0x09ab('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cd3d7,_0x1a667a){_0x1a667a=_0x1a667a||0xcc;return function(_0x367bc4){if(_0x367bc4){return _0x3cd3d7[_0x09ab('0x18')](_0x1a667a);}return _0x3cd3d7[_0x09ab('0x19')](_0x1a667a)[_0x09ab('0x1a')]();};}function respondWithResult(_0x18ecda,_0x25bb6b){_0x25bb6b=_0x25bb6b||0xc8;return function(_0x10971){if(_0x10971){return _0x18ecda[_0x09ab('0x19')](_0x25bb6b)[_0x09ab('0x1b')](_0x10971);}};}function respondWithFilteredResult(_0x27cf42,_0x5ac9da){return function(_0x24db01){if(_0x24db01){var _0x3ff3b2=typeof _0x5ac9da[_0x09ab('0x1c')]==='undefined'&&typeof _0x5ac9da[_0x09ab('0x1d')]===_0x09ab('0x1e');var _0x2f75a8=_0x24db01['count'];var _0x3d77d6=_0x3ff3b2?0x0:_0x5ac9da[_0x09ab('0x1c')];var _0x88f781=_0x3ff3b2?_0x24db01[_0x09ab('0x1f')]:_0x5ac9da[_0x09ab('0x1c')]+_0x5ac9da[_0x09ab('0x1d')];var _0x5c053b;if(_0x88f781>=_0x2f75a8){_0x88f781=_0x2f75a8;_0x5c053b=0xc8;}else{_0x5c053b=0xce;}_0x27cf42[_0x09ab('0x19')](_0x5c053b);return _0x27cf42[_0x09ab('0x20')]('Content-Range',_0x3d77d6+'-'+_0x88f781+'/'+_0x2f75a8)[_0x09ab('0x1b')](_0x24db01);}return null;};}function patchUpdates(_0x6a3b15){return function(_0x1be6af){try{jsonpatch[_0x09ab('0x21')](_0x1be6af,_0x6a3b15,!![]);}catch(_0x403d30){return BPromise[_0x09ab('0x22')](_0x403d30);}return _0x1be6af[_0x09ab('0x23')]();};}function saveUpdates(_0x1bde95,_0x48d46c){return function(_0x30304f){if(_0x30304f){return _0x30304f[_0x09ab('0x24')](_0x1bde95)[_0x09ab('0x25')](function(_0x33e2d8){return _0x33e2d8;});}return null;};}function removeEntity(_0x3314b8,_0x35ea70){return function(_0x597beb){if(_0x597beb){return _0x597beb[_0x09ab('0x26')]()[_0x09ab('0x25')](function(){_0x3314b8[_0x09ab('0x19')](0xcc)[_0x09ab('0x1a')]();});}};}function handleEntityNotFound(_0x293e54,_0x4c776b){return function(_0x50a95b){if(!_0x50a95b){_0x293e54[_0x09ab('0x18')](0x194);}return _0x50a95b;};}function handleError(_0x40932c,_0x5138d4){_0x5138d4=_0x5138d4||0x1f4;return function(_0x429b1b){logger[_0x09ab('0x27')](_0x429b1b[_0x09ab('0x28')]);if(_0x429b1b[_0x09ab('0x29')]){delete _0x429b1b[_0x09ab('0x29')];}_0x40932c[_0x09ab('0x19')](_0x5138d4)[_0x09ab('0x2a')](_0x429b1b);};}exports[_0x09ab('0x2b')]=function(_0x55c5f0,_0x1f4eed){var _0x2d4028={},_0x300e2a={},_0x333684={'count':0x0,'rows':[]};var _0x177069=_[_0x09ab('0x2c')](db[_0x09ab('0x2d')][_0x09ab('0x2e')],function(_0x222892){return{'name':_0x222892[_0x09ab('0x2f')],'type':_0x222892[_0x09ab('0x30')][_0x09ab('0x31')]};});_0x300e2a[_0x09ab('0x32')]=_['map'](_0x177069,_0x09ab('0x29'));_0x300e2a[_0x09ab('0x33')]=_[_0x09ab('0x34')](_0x55c5f0[_0x09ab('0x33')]);_0x300e2a[_0x09ab('0x35')]=_[_0x09ab('0x36')](_0x300e2a[_0x09ab('0x32')],_0x300e2a[_0x09ab('0x33')]);_0x2d4028[_0x09ab('0x37')]=_['intersection'](_0x300e2a['model'],qs[_0x09ab('0x38')](_0x55c5f0[_0x09ab('0x33')]['fields']));_0x2d4028[_0x09ab('0x37')]=_0x2d4028[_0x09ab('0x37')][_0x09ab('0x39')]?_0x2d4028['attributes']:_0x300e2a[_0x09ab('0x32')];if(!_0x55c5f0[_0x09ab('0x33')][_0x09ab('0x3a')]('nolimit')){_0x2d4028['limit']=qs[_0x09ab('0x1d')](_0x55c5f0[_0x09ab('0x33')][_0x09ab('0x1d')]);_0x2d4028[_0x09ab('0x1c')]=qs[_0x09ab('0x1c')](_0x55c5f0['query'][_0x09ab('0x1c')]);}_0x2d4028[_0x09ab('0x3b')]=qs['sort'](_0x55c5f0[_0x09ab('0x33')][_0x09ab('0x3c')]);_0x2d4028['where']=qs['filters'](_['pick'](_0x55c5f0['query'],_0x300e2a[_0x09ab('0x35')]),_0x177069);if(_0x55c5f0[_0x09ab('0x33')]['filter']){_0x2d4028[_0x09ab('0x3d')]=_[_0x09ab('0x3e')](_0x2d4028[_0x09ab('0x3d')],{'$or':_[_0x09ab('0x2c')](_0x177069,function(_0x5e2597){if(_0x5e2597[_0x09ab('0x30')]!==_0x09ab('0x3f')){var _0x3f8011={};_0x3f8011[_0x5e2597[_0x09ab('0x29')]]={'$like':'%'+_0x55c5f0[_0x09ab('0x33')][_0x09ab('0x40')]+'%'};return _0x3f8011;}})});}_0x2d4028=_[_0x09ab('0x3e')]({},_0x2d4028,_0x55c5f0[_0x09ab('0x41')]);var _0x3d8a67={'where':_0x2d4028[_0x09ab('0x3d')]};return db[_0x09ab('0x2d')][_0x09ab('0x1f')](_0x3d8a67)['then'](function(_0x24a7c6){_0x333684[_0x09ab('0x1f')]=_0x24a7c6;if(_0x55c5f0[_0x09ab('0x33')][_0x09ab('0x42')]){_0x2d4028[_0x09ab('0x43')]=[{'all':!![]}];}return db['DeskField'][_0x09ab('0x44')](_0x2d4028);})['then'](function(_0x12f859){_0x333684[_0x09ab('0x45')]=_0x12f859;return _0x333684;})[_0x09ab('0x25')](respondWithFilteredResult(_0x1f4eed,_0x2d4028))[_0x09ab('0x46')](handleError(_0x1f4eed,null));};exports[_0x09ab('0x47')]=function(_0x5ded5d,_0x171383){var _0x277ea6={'raw':!![],'where':{'id':_0x5ded5d[_0x09ab('0x48')]['id']}},_0x4430f2={};_0x4430f2[_0x09ab('0x32')]=_[_0x09ab('0x34')](db[_0x09ab('0x2d')][_0x09ab('0x2e')]);_0x4430f2[_0x09ab('0x33')]=_[_0x09ab('0x34')](_0x5ded5d[_0x09ab('0x33')]);_0x4430f2[_0x09ab('0x35')]=_[_0x09ab('0x36')](_0x4430f2[_0x09ab('0x32')],_0x4430f2[_0x09ab('0x33')]);_0x277ea6[_0x09ab('0x37')]=_[_0x09ab('0x36')](_0x4430f2[_0x09ab('0x32')],qs[_0x09ab('0x38')](_0x5ded5d['query']['fields']));_0x277ea6[_0x09ab('0x37')]=_0x277ea6[_0x09ab('0x37')]['length']?_0x277ea6[_0x09ab('0x37')]:_0x4430f2[_0x09ab('0x32')];if(_0x5ded5d['query'][_0x09ab('0x42')]){_0x277ea6[_0x09ab('0x43')]=[{'all':!![]}];}_0x277ea6=_['merge']({},_0x277ea6,_0x5ded5d[_0x09ab('0x41')]);return db[_0x09ab('0x2d')][_0x09ab('0x49')](_0x277ea6)[_0x09ab('0x25')](handleEntityNotFound(_0x171383,null))[_0x09ab('0x25')](respondWithResult(_0x171383,null))[_0x09ab('0x46')](handleError(_0x171383,null));};exports[_0x09ab('0x4a')]=function(_0x361424,_0x4a582c){return db[_0x09ab('0x2d')][_0x09ab('0x4a')](_0x361424[_0x09ab('0x4b')],{})['then'](respondWithResult(_0x4a582c,0xc9))[_0x09ab('0x46')](handleError(_0x4a582c,null));};exports[_0x09ab('0x24')]=function(_0x3e45a1,_0xc2a33b){if(_0x3e45a1['body']['id']){delete _0x3e45a1['body']['id'];}return db['DeskField']['find']({'where':{'id':_0x3e45a1[_0x09ab('0x48')]['id']}})[_0x09ab('0x25')](handleEntityNotFound(_0xc2a33b,null))[_0x09ab('0x25')](saveUpdates(_0x3e45a1['body'],null))[_0x09ab('0x25')](respondWithResult(_0xc2a33b,null))[_0x09ab('0x46')](handleError(_0xc2a33b,null));};exports['destroy']=function(_0x21b10c,_0xee2f7b){return db[_0x09ab('0x2d')][_0x09ab('0x49')]({'where':{'id':_0x21b10c['params']['id']}})[_0x09ab('0x25')](handleEntityNotFound(_0xee2f7b,null))[_0x09ab('0x25')](removeEntity(_0xee2f7b,null))[_0x09ab('0x46')](handleError(_0xee2f7b,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 41c4bf9..a1d3003 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 _0xb240=['idField','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index'];(function(_0x16e762,_0x147162){var _0x143736=function(_0x1f754d){while(--_0x1f754d){_0x16e762['push'](_0x16e762['shift']());}};_0x143736(++_0x147162);}(_0xb240,0x16d));var _0x0b24=function(_0x5b2adb,_0x56aa23){_0x5b2adb=_0x5b2adb-0x0;var _0x501756=_0xb240[_0x5b2adb];return _0x501756;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var logger=require(_0x0b24('0x2'))(_0x0b24('0x3'));var moment=require(_0x0b24('0x4'));var BPromise=require(_0x0b24('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b24('0x6'));var rimraf=require(_0x0b24('0x7'));var config=require('../../config/environment');var attributes=require(_0x0b24('0x8'));module[_0x0b24('0x9')]=function(_0x57c83b,_0x42f468){return _0x57c83b[_0x0b24('0xa')]('DeskField',attributes,{'tableName':_0x0b24('0xb'),'paranoid':![],'indexes':[{'name':_0x0b24('0xc'),'fields':[_0x0b24('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc6f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x49e143,_0x2ffa0a){var _0x7aae03=function(_0x2cbe09){while(--_0x2cbe09){_0x49e143['push'](_0x49e143['shift']());}};_0x7aae03(++_0x2ffa0a);}(_0xcc6f,0x95));var _0xfcc6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xcc6f[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xfcc6('0x0'));var util=require(_0xfcc6('0x1'));var logger=require(_0xfcc6('0x2'))(_0xfcc6('0x3'));var moment=require(_0xfcc6('0x4'));var BPromise=require(_0xfcc6('0x5'));var rp=require(_0xfcc6('0x6'));var fs=require('fs');var path=require(_0xfcc6('0x7'));var rimraf=require(_0xfcc6('0x8'));var config=require(_0xfcc6('0x9'));var attributes=require('./intDeskField.attributes');module[_0xfcc6('0xa')]=function(_0x41c176,_0x37fcdf){return _0x41c176[_0xfcc6('0xb')](_0xfcc6('0xc'),attributes,{'tableName':_0xfcc6('0xd'),'paranoid':![],'indexes':[{'name':_0xfcc6('0xe'),'fields':[_0xfcc6('0xf'),_0xfcc6('0x10')],'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 33c30ab..ab5a991 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 _0x172e=['then','info','request\x20sent','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x42f5de,_0x310589){var _0x3f5776=function(_0x18d9c6){while(--_0x18d9c6){_0x42f5de['push'](_0x42f5de['shift']());}};_0x3f5776(++_0x310589);}(_0x172e,0x13e));var _0xe172=function(_0xfc6749,_0x25395a){_0xfc6749=_0xfc6749-0x0;var _0x8a243f=_0x172e[_0xfc6749];return _0x8a243f;};'use strict';var _=require(_0xe172('0x0'));var util=require(_0xe172('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe172('0x2'));var fs=require('fs');var Redis=require(_0xe172('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe172('0x4'));var logger=require(_0xe172('0x5'))(_0xe172('0x6'));var config=require(_0xe172('0x7'));var jayson=require(_0xe172('0x8'));var client=jayson[_0xe172('0x9')][_0xe172('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382c35,_0x3e7c7d,_0x3143f8){return new BPromise(function(_0x88b285,_0x32e50b){return client[_0xe172('0xb')](_0x382c35,_0x3143f8)[_0xe172('0xc')](function(_0x535093){logger[_0xe172('0xd')]('DeskField,\x20%s,\x20%s',_0x3e7c7d,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x3e7c7d,_0xe172('0xe'),JSON[_0xe172('0xf')](_0x535093));if(_0x535093[_0xe172('0x10')]){if(_0x535093[_0xe172('0x10')][_0xe172('0x11')]===0x1f4){logger[_0xe172('0x10')](_0xe172('0x12'),_0x3e7c7d,_0x535093[_0xe172('0x10')][_0xe172('0x13')]);return _0x32e50b(_0x535093[_0xe172('0x10')][_0xe172('0x13')]);}logger[_0xe172('0x10')]('DeskField,\x20%s,\x20%s',_0x3e7c7d,_0x535093[_0xe172('0x10')]['message']);return _0x88b285(_0x535093[_0xe172('0x10')]['message']);}else{logger[_0xe172('0xd')](_0xe172('0x12'),_0x3e7c7d,_0xe172('0xe'));_0x88b285(_0x535093[_0xe172('0x14')][_0xe172('0x13')]);}})[_0xe172('0x15')](function(_0x56047c){logger[_0xe172('0x10')]('DeskField,\x20%s,\x20%s',_0x3e7c7d,_0x56047c);_0x32e50b(_0x56047c);});});} \ No newline at end of file +var _0x1296=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s'];(function(_0xd5dc89,_0x45f21b){var _0x28d15c=function(_0x1137a4){while(--_0x1137a4){_0xd5dc89['push'](_0xd5dc89['shift']());}};_0x28d15c(++_0x45f21b);}(_0x1296,0x1cf));var _0x6129=function(_0x33c2cf,_0x5f7f73){_0x33c2cf=_0x33c2cf-0x0;var _0x2b7607=_0x1296[_0x33c2cf];return _0x2b7607;};'use strict';var _=require(_0x6129('0x0'));var util=require(_0x6129('0x1'));var moment=require(_0x6129('0x2'));var BPromise=require(_0x6129('0x3'));var rs=require(_0x6129('0x4'));var fs=require('fs');var Redis=require(_0x6129('0x5'));var db=require(_0x6129('0x6'))['db'];var utils=require(_0x6129('0x7'));var logger=require(_0x6129('0x8'))(_0x6129('0x9'));var config=require(_0x6129('0xa'));var jayson=require(_0x6129('0xb'));var client=jayson[_0x6129('0xc')][_0x6129('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x333d3b,_0x76c321,_0x45e26d){return new BPromise(function(_0x586b6a,_0x31bcce){return client[_0x6129('0xe')](_0x333d3b,_0x45e26d)[_0x6129('0xf')](function(_0x1cf0c6){logger['info'](_0x6129('0x10'),_0x76c321,_0x6129('0x11'));logger[_0x6129('0x12')](_0x6129('0x13'),_0x76c321,_0x6129('0x11'),JSON['stringify'](_0x1cf0c6));if(_0x1cf0c6[_0x6129('0x14')]){if(_0x1cf0c6[_0x6129('0x14')][_0x6129('0x15')]===0x1f4){logger[_0x6129('0x14')](_0x6129('0x10'),_0x76c321,_0x1cf0c6[_0x6129('0x14')]['message']);return _0x31bcce(_0x1cf0c6[_0x6129('0x14')][_0x6129('0x16')]);}logger[_0x6129('0x14')](_0x6129('0x10'),_0x76c321,_0x1cf0c6[_0x6129('0x14')][_0x6129('0x16')]);return _0x586b6a(_0x1cf0c6[_0x6129('0x14')][_0x6129('0x16')]);}else{logger[_0x6129('0x17')](_0x6129('0x10'),_0x76c321,_0x6129('0x11'));_0x586b6a(_0x1cf0c6['result']['message']);}})['catch'](function(_0x58b488){logger[_0x6129('0x14')]('DeskField,\x20%s,\x20%s',_0x76c321,_0x58b488);_0x31bcce(_0x58b488);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 1860fda..e762694 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 _0xc9fb=['multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/fields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xc9fb,0xfc));var _0xbc9f=function(_0x15e782,_0x4f825d){_0x15e782=_0x15e782-0x0;var _0x2ea84b=_0xc9fb[_0x15e782];return _0x2ea84b;};'use strict';var multer=require(_0xbc9f('0x0'));var util=require(_0xbc9f('0x1'));var path=require(_0xbc9f('0x2'));var timeout=require(_0xbc9f('0x3'));var express=require(_0xbc9f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbc9f('0x5'));var config=require(_0xbc9f('0x6'));var controller=require(_0xbc9f('0x7'));router[_0xbc9f('0x8')]('/',auth[_0xbc9f('0x9')](),controller['index']);router[_0xbc9f('0x8')](_0xbc9f('0xa'),auth['isAuthenticated'](),controller[_0xbc9f('0xb')]);router[_0xbc9f('0x8')]('/:id/configurations',auth[_0xbc9f('0x9')](),controller['getConfigurations']);router['get'](_0xbc9f('0xc'),auth[_0xbc9f('0x9')](),controller['getFields']);router[_0xbc9f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xbc9f('0xe'),auth[_0xbc9f('0x9')](),controller[_0xbc9f('0xf')]);router[_0xbc9f('0x10')](_0xbc9f('0xa'),auth[_0xbc9f('0x9')](),controller[_0xbc9f('0x11')]);router[_0xbc9f('0x12')](_0xbc9f('0xa'),auth[_0xbc9f('0x9')](),controller[_0xbc9f('0x13')]);module[_0xbc9f('0x14')]=router; \ No newline at end of file +var _0x70ff=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','/:id','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x279d15,_0x4c35c8){var _0x20f246=function(_0xa22d6f){while(--_0xa22d6f){_0x279d15['push'](_0x279d15['shift']());}};_0x20f246(++_0x4c35c8);}(_0x70ff,0x141));var _0xf70f=function(_0x17575f,_0x2ac70a){_0x17575f=_0x17575f-0x0;var _0x3741d4=_0x70ff[_0x17575f];return _0x3741d4;};'use strict';var multer=require('multer');var util=require(_0xf70f('0x0'));var path=require('path');var timeout=require(_0xf70f('0x1'));var express=require(_0xf70f('0x2'));var router=express[_0xf70f('0x3')]();var fs_extra=require(_0xf70f('0x4'));var auth=require(_0xf70f('0x5'));var interaction=require(_0xf70f('0x6'));var config=require(_0xf70f('0x7'));var controller=require(_0xf70f('0x8'));router['get']('/',auth[_0xf70f('0x9')](),controller[_0xf70f('0xa')]);router['get'](_0xf70f('0xb'),auth[_0xf70f('0x9')](),controller['show']);router[_0xf70f('0xc')](_0xf70f('0xd'),auth[_0xf70f('0x9')](),controller[_0xf70f('0xe')]);router[_0xf70f('0xc')](_0xf70f('0xf'),auth[_0xf70f('0x9')](),controller[_0xf70f('0x10')]);router[_0xf70f('0x11')]('/',auth[_0xf70f('0x9')](),controller[_0xf70f('0x12')]);router[_0xf70f('0x11')](_0xf70f('0xd'),auth[_0xf70f('0x9')](),controller[_0xf70f('0x13')]);router[_0xf70f('0x14')]('/:id',auth[_0xf70f('0x9')](),controller[_0xf70f('0x15')]);router[_0xf70f('0x16')](_0xf70f('0xb'),auth['isAuthenticated'](),controller[_0xf70f('0x17')]);module[_0xf70f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index b132d56..2bf8554 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 _0x94ba=['STRING','sequelize','exports'];(function(_0x53cebc,_0x165766){var _0x3ce28b=function(_0x1913ec){while(--_0x1913ec){_0x53cebc['push'](_0x53cebc['shift']());}};_0x3ce28b(++_0x165766);}(_0x94ba,0xbe));var _0xa94b=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0x94ba[_0x4d3a2b];return _0xdd32c8;};'use strict';var Sequelize=require(_0xa94b('0x0'));module[_0xa94b('0x1')]={'name':{'type':Sequelize[_0xa94b('0x2')]},'username':{'type':Sequelize[_0xa94b('0x2')]},'password':{'type':Sequelize[_0xa94b('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xa94b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xa94b('0x2')]},'serverUrl':{'type':Sequelize[_0xa94b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xf23b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1de61,_0x5705e3){var _0x50f73d=function(_0x29168d){while(--_0x29168d){_0x1de61['push'](_0x1de61['shift']());}};_0x50f73d(++_0x5705e3);}(_0xf23b,0x133));var _0xbf23=function(_0x424f24,_0x307493){_0x424f24=_0x424f24-0x0;var _0x247665=_0xf23b[_0x424f24];return _0x247665;};'use strict';var Sequelize=require(_0xbf23('0x0'));module[_0xbf23('0x1')]={'name':{'type':Sequelize[_0xbf23('0x2')]},'username':{'type':Sequelize[_0xbf23('0x2')]},'password':{'type':Sequelize[_0xbf23('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xbf23('0x2')]},'clientId':{'type':Sequelize[_0xbf23('0x2')]},'clientSecret':{'type':Sequelize[_0xbf23('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xbf23('0x2')]},'modernAuthentication':{'type':Sequelize[_0xbf23('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 935be8f..6f3aa8a 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 _0x064b=['BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','limit','undefined','count','offset','status','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','params','create','body','find','Dynamics365Configuration','getConfigurations','addConfiguration','Subjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil'];(function(_0x4ffa09,_0xfd49e8){var _0x1fcb94=function(_0x40e4c7){while(--_0x40e4c7){_0x4ffa09['push'](_0x4ffa09['shift']());}};_0x1fcb94(++_0xfd49e8);}(_0x064b,0xd9));var _0xb064=function(_0x11c89a,_0x306026){_0x11c89a=_0x11c89a-0x0;var _0x563c7a=_0x064b[_0x11c89a];return _0x563c7a;};'use strict';var rp=require(_0xb064('0x0'));var util=require(_0xb064('0x1'));var _=require(_0xb064('0x2'));var qs=require(_0xb064('0x3'));var logger=require('../../config/logger')(_0xb064('0x4'));var db=require(_0xb064('0x5'))['db'];var integrations=require(_0xb064('0x6'));function respondWithResult(_0x27fc05,_0x16d040){_0x16d040=_0x16d040||0xc8;return function(_0x4884c3){if(_0x4884c3){return _0x27fc05['status'](_0x16d040)['json'](_0x4884c3);}};}function respondWithFilteredResult(_0xe5fb85,_0x72a5cc){return function(_0x10a51e){if(_0x10a51e){var _0x300188=typeof _0x72a5cc['offset']==='undefined'&&typeof _0x72a5cc[_0xb064('0x7')]===_0xb064('0x8');var _0x475fbe=_0x10a51e[_0xb064('0x9')];var _0x12510d=_0x300188?0x0:_0x72a5cc[_0xb064('0xa')];var _0x3efffe=_0x300188?_0x10a51e[_0xb064('0x9')]:_0x72a5cc[_0xb064('0xa')]+_0x72a5cc[_0xb064('0x7')];var _0x3b0577;if(_0x3efffe>=_0x475fbe){_0x3efffe=_0x475fbe;_0x3b0577=0xc8;}else{_0x3b0577=0xce;}_0xe5fb85[_0xb064('0xb')](_0x3b0577);return _0xe5fb85[_0xb064('0xc')](_0xb064('0xd'),_0x12510d+'-'+_0x3efffe+'/'+_0x475fbe)[_0xb064('0xe')](_0x10a51e);}return null;};}function saveUpdates(_0x54872c){return function(_0x2bd86b){if(_0x2bd86b){return _0x2bd86b[_0xb064('0xf')](_0x54872c)[_0xb064('0x10')](function(_0x3797c){return _0x3797c;});}return null;};}function removeEntity(_0x5770bd){return function(_0x324806){if(_0x324806){return _0x324806[_0xb064('0x11')]()[_0xb064('0x10')](function(){_0x5770bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2b9c){return function(_0xd19cb4){if(!_0xd19cb4){_0x1e2b9c[_0xb064('0x12')](0x194);}return _0xd19cb4;};}function handleError(_0x39a846,_0xe92104){_0xe92104=_0xe92104||0x1f4;return function(_0x3c5fd0){logger[_0xb064('0x13')](_0x3c5fd0[_0xb064('0x14')]);if(_0x3c5fd0['name']){delete _0x3c5fd0[_0xb064('0x15')];}_0x39a846[_0xb064('0xb')](_0xe92104)[_0xb064('0x16')](_0x3c5fd0);};}exports[_0xb064('0x17')]=function(_0x4e8efd,_0x278c50){var _0x2e3270={},_0x120cd0={},_0x39a9e3={'count':0x0,'rows':[]};var _0xfaa1bf=_[_0xb064('0x18')](db[_0xb064('0x19')][_0xb064('0x1a')],function(_0x1ed50a){return{'name':_0x1ed50a['fieldName'],'type':_0x1ed50a['type'][_0xb064('0x1b')]};});_0x120cd0[_0xb064('0x1c')]=_[_0xb064('0x18')](_0xfaa1bf,'name');_0x120cd0[_0xb064('0x1d')]=_[_0xb064('0x1e')](_0x4e8efd[_0xb064('0x1d')]);_0x120cd0[_0xb064('0x1f')]=_[_0xb064('0x20')](_0x120cd0['model'],_0x120cd0['query']);_0x2e3270[_0xb064('0x21')]=_[_0xb064('0x20')](_0x120cd0[_0xb064('0x1c')],qs[_0xb064('0x22')](_0x4e8efd[_0xb064('0x1d')][_0xb064('0x22')]));_0x2e3270[_0xb064('0x21')]=_0x2e3270[_0xb064('0x21')][_0xb064('0x23')]?_0x2e3270['attributes']:_0x120cd0[_0xb064('0x1c')];if(!_0x4e8efd[_0xb064('0x1d')][_0xb064('0x24')](_0xb064('0x25'))){_0x2e3270['limit']=qs[_0xb064('0x7')](_0x4e8efd[_0xb064('0x1d')][_0xb064('0x7')]);_0x2e3270[_0xb064('0xa')]=qs['offset'](_0x4e8efd[_0xb064('0x1d')][_0xb064('0xa')]);}_0x2e3270[_0xb064('0x26')]=qs[_0xb064('0x27')](_0x4e8efd[_0xb064('0x1d')]['sort']);_0x2e3270[_0xb064('0x28')]=qs[_0xb064('0x1f')](_[_0xb064('0x29')](_0x4e8efd[_0xb064('0x1d')],_0x120cd0[_0xb064('0x1f')]),_0xfaa1bf);if(_0x4e8efd[_0xb064('0x1d')]['filter']){_0x2e3270['where']=_[_0xb064('0x2a')](_0x2e3270[_0xb064('0x28')],{'$or':_[_0xb064('0x18')](_0xfaa1bf,function(_0x420fce){if(_0x420fce[_0xb064('0x2b')]!=='VIRTUAL'){var _0x1f2374={};_0x1f2374[_0x420fce['name']]={'$like':'%'+_0x4e8efd['query'][_0xb064('0x2c')]+'%'};return _0x1f2374;}})});}_0x2e3270=_[_0xb064('0x2a')]({},_0x2e3270,_0x4e8efd[_0xb064('0x2d')]);var _0x534e0f={'where':_0x2e3270['where']};return db[_0xb064('0x19')][_0xb064('0x9')](_0x534e0f)[_0xb064('0x10')](function(_0x42c86b){_0x39a9e3['count']=_0x42c86b;if(_0x4e8efd[_0xb064('0x1d')][_0xb064('0x2e')]){_0x2e3270[_0xb064('0x2f')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xb064('0x30')](_0x2e3270);})['then'](function(_0x1d3ab4){_0x39a9e3[_0xb064('0x31')]=_0x1d3ab4;return _0x39a9e3;})['then'](respondWithFilteredResult(_0x278c50,_0x2e3270))[_0xb064('0x32')](handleError(_0x278c50,null));};exports['show']=function(_0x2f1ee0,_0x1bda58){var _0x330cfb={'raw':![],'where':{'id':_0x2f1ee0[_0xb064('0x33')]['id']}},_0x4de849={};_0x4de849[_0xb064('0x1c')]=_[_0xb064('0x1e')](db[_0xb064('0x19')][_0xb064('0x1a')]);_0x4de849['query']=_['keys'](_0x2f1ee0[_0xb064('0x1d')]);_0x4de849['filters']=_[_0xb064('0x20')](_0x4de849[_0xb064('0x1c')],_0x4de849['query']);_0x330cfb['attributes']=_[_0xb064('0x20')](_0x4de849[_0xb064('0x1c')],qs[_0xb064('0x22')](_0x2f1ee0[_0xb064('0x1d')][_0xb064('0x22')]));_0x330cfb['attributes']=_0x330cfb[_0xb064('0x21')][_0xb064('0x23')]?_0x330cfb['attributes']:_0x4de849['model'];if(_0x2f1ee0['query'][_0xb064('0x2e')]){_0x330cfb[_0xb064('0x2f')]=[{'all':!![]}];}_0x330cfb=_[_0xb064('0x2a')]({},_0x330cfb,_0x2f1ee0[_0xb064('0x2d')]);return db['Dynamics365Account']['find'](_0x330cfb)[_0xb064('0x10')](handleEntityNotFound(_0x1bda58,null))[_0xb064('0x10')](respondWithResult(_0x1bda58,null))[_0xb064('0x32')](handleError(_0x1bda58,null));};exports['create']=function(_0xb02382,_0xcf13a){return db[_0xb064('0x19')][_0xb064('0x34')](_0xb02382['body'],{})[_0xb064('0x10')](respondWithResult(_0xcf13a,0xc9))[_0xb064('0x32')](handleError(_0xcf13a,null));};exports[_0xb064('0xf')]=function(_0x2049c9,_0x5321ae){if(_0x2049c9['body']['id']){delete _0x2049c9[_0xb064('0x35')]['id'];}return db[_0xb064('0x19')][_0xb064('0x36')]({'where':{'id':_0x2049c9['params']['id']}})[_0xb064('0x10')](handleEntityNotFound(_0x5321ae,null))['then'](saveUpdates(_0x2049c9[_0xb064('0x35')],null))[_0xb064('0x10')](respondWithResult(_0x5321ae,null))[_0xb064('0x32')](handleError(_0x5321ae,null));};exports[_0xb064('0x11')]=function(_0x3708b3,_0x1d4acd){return db[_0xb064('0x19')][_0xb064('0x36')]({'where':{'id':_0x3708b3[_0xb064('0x33')]['id']}})[_0xb064('0x10')](handleEntityNotFound(_0x1d4acd,null))[_0xb064('0x10')](removeEntity(_0x1d4acd,null))[_0xb064('0x32')](handleError(_0x1d4acd,null));};exports['getConfigurations']=function(_0x73af3,_0x16a779){var _0x4277a4={};var _0x2d71e0={};var _0x2ca2e1;var _0x2f6b24;return db[_0xb064('0x19')]['findOne']({'where':{'id':_0x73af3[_0xb064('0x33')]['id']}})[_0xb064('0x10')](handleEntityNotFound(_0x16a779,null))[_0xb064('0x10')](function(_0x12d19d){if(_0x12d19d){_0x2ca2e1=_0x12d19d;_0x2d71e0[_0xb064('0x1c')]=_[_0xb064('0x1e')](db[_0xb064('0x37')][_0xb064('0x1a')]);_0x2d71e0[_0xb064('0x1d')]=_[_0xb064('0x1e')](_0x73af3[_0xb064('0x1d')]);_0x2d71e0[_0xb064('0x1f')]=_[_0xb064('0x20')](_0x2d71e0['model'],_0x2d71e0['query']);_0x4277a4[_0xb064('0x21')]=_['intersection'](_0x2d71e0[_0xb064('0x1c')],qs[_0xb064('0x22')](_0x73af3[_0xb064('0x1d')][_0xb064('0x22')]));_0x4277a4[_0xb064('0x21')]=_0x4277a4[_0xb064('0x21')]['length']?_0x4277a4[_0xb064('0x21')]:_0x2d71e0[_0xb064('0x1c')];_0x4277a4['order']=qs[_0xb064('0x27')](_0x73af3[_0xb064('0x1d')][_0xb064('0x27')]);_0x4277a4[_0xb064('0x28')]=qs['filters'](_[_0xb064('0x29')](_0x73af3[_0xb064('0x1d')],_0x2d71e0[_0xb064('0x1f')]));if(_0x73af3[_0xb064('0x1d')][_0xb064('0x2c')]){_0x4277a4[_0xb064('0x28')]=_['merge'](_0x4277a4['where'],{'$or':_['map'](_0x4277a4[_0xb064('0x21')],function(_0x87217a){var _0x47a40b={};_0x47a40b[_0x87217a]={'$like':'%'+_0x73af3['query'][_0xb064('0x2c')]+'%'};return _0x47a40b;})});}_0x4277a4=_['merge']({},_0x4277a4,_0x73af3[_0xb064('0x2d')]);return _0x2ca2e1[_0xb064('0x38')](_0x4277a4);}})[_0xb064('0x10')](function(_0x539f42){if(_0x539f42){_0x2f6b24=_0x539f42[_0xb064('0x23')];if(!_0x73af3[_0xb064('0x1d')][_0xb064('0x24')]('nolimit')){_0x4277a4[_0xb064('0x7')]=qs[_0xb064('0x7')](_0x73af3['query'][_0xb064('0x7')]);_0x4277a4[_0xb064('0xa')]=qs[_0xb064('0xa')](_0x73af3['query'][_0xb064('0xa')]);}return _0x2ca2e1[_0xb064('0x38')](_0x4277a4);}})[_0xb064('0x10')](function(_0xf3c850){if(_0xf3c850){return _0xf3c850?{'count':_0x2f6b24,'rows':_0xf3c850}:null;}})['then'](respondWithResult(_0x16a779,null))[_0xb064('0x32')](handleError(_0x16a779,null));};exports[_0xb064('0x39')]=function(_0x3d42f7,_0x4f7e92){if(_0x3d42f7[_0xb064('0x35')]['id']){delete _0x3d42f7[_0xb064('0x35')]['id'];}return db[_0xb064('0x19')]['findOne']({'where':{'id':_0x3d42f7[_0xb064('0x33')]['id']}})[_0xb064('0x10')](handleEntityNotFound(_0x4f7e92,null))['then'](function(_0x46d26b){if(_0x46d26b){_0x3d42f7['body']['AccountId']=_0x46d26b['id'];_0x3d42f7[_0xb064('0x35')][_0xb064('0x3a')]=integrations['getSubjects'](_0x3d42f7[_0xb064('0x35')][_0xb064('0x3b')],_0x3d42f7['body']['type']);_0x3d42f7[_0xb064('0x35')][_0xb064('0x3c')]=integrations['getDescriptions'](_0x3d42f7[_0xb064('0x35')][_0xb064('0x3b')],_0x3d42f7[_0xb064('0x35')][_0xb064('0x2b')]);return db[_0xb064('0x37')][_0xb064('0x34')](_0x3d42f7[_0xb064('0x35')],{'include':[{'model':db[_0xb064('0x3d')],'as':_0xb064('0x3a')},{'model':db[_0xb064('0x3d')],'as':_0xb064('0x3c')}]});}return null;})[_0xb064('0x10')](respondWithResult(_0x4f7e92,null))[_0xb064('0x32')](handleError(_0x4f7e92,null));};function sanitizeRemoteUri(_0x54c87d){var _0x499644=_0x54c87d[_0xb064('0x3e')](-0x1);if(_0x499644==='/')return _0x54c87d[_0xb064('0x3f')](0x0,_0x54c87d[_0xb064('0x40')](_0x499644));return _0x54c87d;}function getWebApiUrl(_0x292daf){return util[_0xb064('0x41')](_0xb064('0x42'),_0x292daf);}exports[_0xb064('0x43')]=function(_0xebf88d,_0x3fcc28){var _0x2f03a3=_0xebf88d[_0xb064('0x1d')]['ticketType'];var _0x14aa44=_0x2f03a3===_0xb064('0x44')?_0xb064('0x45'):_0xb064('0x46');var _0x265671='';var _0x5c50f9='';var _0x390e24='';var _0x3fc924='';var _0x56f424='';var _0x490990='';var _0x45a4cb='';var _0x572732='';var _0xb10475=['title',_0xb064('0x47'),_0xb064('0x48'),'ownerid',_0xb064('0x49'),_0xb064('0x4a'),_0xb064('0x4b'),_0xb064('0x4c'),_0xb064('0x4d'),_0xb064('0x4e')];var _0xb7ef73=[_0xb064('0x4f'),_0xb064('0x50'),_0xb064('0x51'),_0xb064('0x52'),_0xb064('0x53'),'contactidyominame','contractdetailidname',_0xb064('0x54'),_0xb064('0x55'),_0xb064('0x56'),_0xb064('0x57'),_0xb064('0x58'),'createdon','createdonbehalfbyname',_0xb064('0x59'),_0xb064('0x5a'),_0xb064('0x5b'),_0xb064('0x5c'),_0xb064('0x5d'),_0xb064('0x5e'),_0xb064('0x5f'),_0xb064('0x60'),_0xb064('0x61'),_0xb064('0x62'),'firstresponsebykpiidname',_0xb064('0x63'),'importsequencenumber',_0xb064('0x64'),_0xb064('0x65'),_0xb064('0x66'),_0xb064('0x67'),_0xb064('0x68'),_0xb064('0x69'),_0xb064('0x6a'),_0xb064('0x6b'),_0xb064('0x6c'),_0xb064('0x6d'),_0xb064('0x6e'),_0xb064('0x6f'),_0xb064('0x70'),_0xb064('0x71'),_0xb064('0x72'),'overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname',_0xb064('0x73'),_0xb064('0x74'),_0xb064('0x75'),_0xb064('0x76'),'resolveby',_0xb064('0x77'),_0xb064('0x78'),_0xb064('0x79'),_0xb064('0x7a'),_0xb064('0x7b'),_0xb064('0x7c'),_0xb064('0x7d'),_0xb064('0x7e'),_0xb064('0x7f'),_0xb064('0x80'),_0xb064('0x81'),_0xb064('0x82'),'timezoneruleversionnumber',_0xb064('0x83'),_0xb064('0x84'),_0xb064('0x85'),_0xb064('0x86')];var _0x21a245=_0xb10475[_0xb064('0x87')](_0xb7ef73);return db[_0xb064('0x19')][_0xb064('0x88')]({'where':{'id':_0xebf88d[_0xb064('0x33')]['id']},'attributes':['id','username',_0xb064('0x89'),_0xb064('0x8a'),_0xb064('0x8b'),_0xb064('0x8c'),_0xb064('0x8d'),_0xb064('0x8e')],'include':[{'model':db[_0xb064('0x8f')],'as':_0xb064('0x8f'),'attributes':['id',_0xb064('0x90'),'data7']}]})[_0xb064('0x10')](handleEntityNotFound(_0x3fcc28,null))[_0xb064('0x10')](function(_0x5d5e8d){if(_0x5d5e8d){if(_0x5d5e8d[_0xb064('0x8e')]){_0x5d5e8d[_0xb064('0x91')]=_0x5d5e8d[_0xb064('0x8f')][_0xb064('0x90')];_0x572732=sanitizeRemoteUri(_0x5d5e8d[_0xb064('0x8f')]['data7']);_0x45a4cb=getWebApiUrl(_0x572732);return _0x5d5e8d;}_0x572732=sanitizeRemoteUri(_0x5d5e8d[_0xb064('0x8a')]);_0x45a4cb=getWebApiUrl(_0x572732);var _0x2fd265={'method':_0xb064('0x92'),'uri':_0xb064('0x93')+_0x5d5e8d[_0xb064('0x8b')]+_0xb064('0x94'),'form':{'client_id':_0x5d5e8d['clientId'],'resource':_0x572732,'username':_0x5d5e8d[_0xb064('0x95')],'password':_0x5d5e8d['password'],'grant_type':_0xb064('0x89'),'client_secret':_0x5d5e8d[_0xb064('0x8d')]},'json':!![]};return rp(_0x2fd265);}})[_0xb064('0x10')](function(_0x1bf6f8){_0x490990=_0x1bf6f8['access_token'];var _0x5b25da={'method':_0xb064('0x96'),'uri':encodeURI(_0x45a4cb+_0xb064('0x97')+_0x14aa44+'\x27'),'headers':{'Authorization':_0xb064('0x98')+_0x490990,'If-None-Match':null,'OData-Version':_0xb064('0x99')},'json':!![]};return rp(_0x5b25da);})[_0xb064('0x10')](function(_0x4f9d8c){var _0x1c6718=_0x4f9d8c['value'][0x0];var _0x2a3e37=_0x1c6718[_0xb064('0x9a')];var _0x5a9c66={'method':_0xb064('0x96'),'uri':_0x45a4cb+_0xb064('0x9b')+_0x2a3e37+_0xb064('0x9c'),'headers':{'Authorization':_0xb064('0x98')+_0x490990,'If-None-Match':null,'OData-Version':_0xb064('0x99')},'json':!![]};return rp(_0x5a9c66);})[_0xb064('0x10')](function(_0x343e18){_0x265671=_0x343e18;_0x5c50f9=_0x265671[_0xb064('0x9d')];_0x5c50f9=_[_0xb064('0x9e')](_0x5c50f9,function(_0x2f8795){return!_0x21a245['includes'](_0x2f8795['LogicalName']);});var _0x576184=[];var _0x2293c3=[];_0x5c50f9[_0xb064('0x9f')](function(_0x257cc1){if(_0x257cc1[_0xb064('0xa0')]){var _0x49a01f=_0x257cc1['@odata.type']['substring'](_0x257cc1[_0xb064('0xa0')][_0xb064('0x40')]('.')+0x1);if(_0x49a01f===_0xb064('0xa1')){_0x576184[_0xb064('0xa2')](getSelectList(_0x45a4cb,_0x2f03a3,_0x2293c3,_0x265671[_0xb064('0x9a')],_0x257cc1[_0xb064('0x9a')],_0x490990));}}});return Promise[_0xb064('0xa3')](_0x576184);})['then'](function(_0x3ba7d6){_0x390e24=_0x3ba7d6[0x0];var _0x52a57b=[];var _0x2c4cc2=[];_0x5c50f9[_0xb064('0x9f')](function(_0x2d6028){if(!_[_0xb064('0xa4')](_0x2d6028[_0xb064('0xa0')])){var _0x41ff96=_0x2d6028['@odata.type']['substring'](_0x2d6028[_0xb064('0xa0')][_0xb064('0x40')]('.')+0x1);if(_0x41ff96===_0xb064('0xa5')){_0x52a57b[_0xb064('0xa2')](getBooleanList(_0x45a4cb,_0x2f03a3,_0x2c4cc2,_0x265671[_0xb064('0x9a')],_0x2d6028[_0xb064('0x9a')],_0x490990));}}});return Promise['all'](_0x52a57b);})['then'](function(_0x3603d1){_0x3fc924=_0x3603d1[0x0];var _0x464513=[];var _0x37a668=[];_0x5c50f9[_0xb064('0x9f')](function(_0x107b22){if(_0x107b22['@odata.type']){var _0x119c57=_0x107b22[_0xb064('0xa0')][_0xb064('0x3f')](_0x107b22[_0xb064('0xa0')]['lastIndexOf']('.')+0x1);if(_0x119c57===_0xb064('0xa6')||_0x119c57===_0xb064('0xa7')||_0x119c57===_0xb064('0xa8')||_0x119c57===_0xb064('0xa9')||_0x119c57==='MemoAttributeMetadata'||_0x119c57===_0xb064('0xaa')||_0x119c57===_0xb064('0xab')||_0x119c57===_0xb064('0xac')||_0x119c57===_0xb064('0xad')||_0x119c57==='DecimalAttributeMetadata'){_0x464513[_0xb064('0xa2')](getInputList(_0x45a4cb,_0x2f03a3,_0x119c57,_0x37a668,_0x265671['MetadataId'],_0x107b22[_0xb064('0x9a')],_0x490990));}}});return Promise['all'](_0x464513);})['then'](function(_0x2efcec){_0x56f424=_0x2efcec[0x0];var _0x41a5cb=_0x390e24['concat'](_0x3fc924)[_0xb064('0x87')](_0x56f424);var _0x23e97a={'count':_0x41a5cb[_0xb064('0x23')],'rows':_0x41a5cb};return _0x23e97a;})['then'](respondWithResult(_0x3fcc28,null))['catch'](function(_0x41f5c2){var _0xfb0918=_0xebf88d[_0xb064('0x1d')][_0xb064('0xae')]?0x1f4:_0x41f5c2[_0xb064('0xaf')]||0x1f4;logger[_0xb064('0x13')](_0x41f5c2[_0xb064('0x14')]);delete _0x41f5c2[_0xb064('0x15')];if(_0xfb0918===0x191){_0xfb0918=0x190;}_0x3fcc28[_0xb064('0xb')](_0xfb0918)[_0xb064('0x16')](_0xebf88d['query'][_0xb064('0xae')]?{'message':_0xb064('0xb0'),'statusCode':_0x41f5c2[_0xb064('0xaf')]}:_0x41f5c2);});};function getSelectList(_0x2fe45a,_0x31d3e8,_0x1dcd57,_0x26f220,_0x1b514b,_0x5f4bd0){var _0x4de3f5={'method':_0xb064('0x96'),'uri':_0x2fe45a+_0xb064('0x9b')+_0x26f220+_0xb064('0xb1')+_0x1b514b+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xb064('0xb2'),'headers':{'Authorization':_0xb064('0x98')+_0x5f4bd0,'If-None-Match':null,'OData-Version':_0xb064('0x99')},'json':!![]};return rp(_0x4de3f5)[_0xb064('0x10')](function(_0x5695f6){var _0x46bda4=[];var _0x33a355=_0x5695f6[_0xb064('0xb3')][_0xb064('0xb4')];_0x33a355['forEach'](function(_0x335062){_0x46bda4['push']({'name':_0x335062[_0xb064('0xb5')][_0xb064('0xb6')][_0xb064('0xb5')],'value':String(_0x335062[_0xb064('0xb7')])});});var _0x509c79={'id':_0x31d3e8+'_'+_0x5695f6[_0xb064('0xb8')],'name':_0x5695f6[_0xb064('0xb9')][_0xb064('0xb6')][_0xb064('0xb5')],'custom':![],'options':_0x46bda4};_0x1dcd57[_0xb064('0xa2')](_0x509c79);return _0x1dcd57;});}function getBooleanList(_0x3f5874,_0x585108,_0x51eb10,_0x436c31,_0x34dfb6,_0x281d10){var _0x15373e={'method':_0xb064('0x96'),'uri':_0x3f5874+'EntityDefinitions('+_0x436c31+')/Attributes('+_0x34dfb6+_0xb064('0xba'),'headers':{'Authorization':_0xb064('0x98')+_0x281d10,'If-None-Match':null,'OData-Version':_0xb064('0x99')},'json':!![]};return rp(_0x15373e)['then'](function(_0x1ae37f){var _0x442a91=[];_0x442a91[_0xb064('0xa2')]({'name':_0x1ae37f[_0xb064('0xb3')][_0xb064('0xbb')][_0xb064('0xb5')][_0xb064('0xb6')][_0xb064('0xb5')],'value':'true'},{'name':_0x1ae37f[_0xb064('0xb3')]['FalseOption'][_0xb064('0xb5')]['UserLocalizedLabel'][_0xb064('0xb5')],'value':_0xb064('0xbc')});var _0x430b25={'id':_0x585108+'_'+_0x1ae37f[_0xb064('0xb8')],'name':_0x1ae37f[_0xb064('0xb9')]['UserLocalizedLabel'][_0xb064('0xb5')],'custom':![],'options':_0x442a91};_0x51eb10[_0xb064('0xa2')](_0x430b25);return _0x51eb10;});}function getInputList(_0x423c98,_0x5ee819,_0x37dadd,_0x5d276a,_0x15df74,_0x48ff8d,_0x4a5ef1){var _0x2d4fdd={'method':'GET','uri':_0x423c98+'EntityDefinitions('+_0x15df74+_0xb064('0xb1')+_0x48ff8d+_0xb064('0xbd')+_0x37dadd+_0xb064('0xbe'),'headers':{'Authorization':_0xb064('0x98')+_0x4a5ef1,'If-None-Match':null,'OData-Version':_0xb064('0x99')},'json':!![]};return rp(_0x2d4fdd)[_0xb064('0x10')](function(_0x4ee2b1){var _0x53e3d1={'id':_0x5ee819+'_'+_0x4ee2b1[_0xb064('0xb8')],'name':_0x4ee2b1[_0xb064('0xb9')]['UserLocalizedLabel']?_0x4ee2b1['DisplayName']['UserLocalizedLabel'][_0xb064('0xb5')]:_0x4ee2b1[_0xb064('0xb8')],'custom':![],'options':[]};_0x5d276a['push'](_0x53e3d1);return _0x5d276a;});} \ No newline at end of file +var _0x06f7=['access_token','GET','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','includes','LogicalName','forEach','@odata.type','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','test','statusCode','send',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','4.0','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','Content-Range','update','then','status','end','sendStatus','error','stack','index','Dynamics365Account','rawAttributes','type','key','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','catch','destroy','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','Incident','title','customerid','ownerid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','username'];(function(_0x57dfe5,_0x2b1b1d){var _0x239cc8=function(_0x321d4){while(--_0x321d4){_0x57dfe5['push'](_0x57dfe5['shift']());}};_0x239cc8(++_0x2b1b1d);}(_0x06f7,0xd7));var _0x706f=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0x06f7[_0x3f8743];return _0x1f844c;};'use strict';var rp=require(_0x706f('0x0'));var util=require(_0x706f('0x1'));var _=require(_0x706f('0x2'));var qs=require(_0x706f('0x3'));var logger=require(_0x706f('0x4'))(_0x706f('0x5'));var db=require(_0x706f('0x6'))['db'];var integrations=require(_0x706f('0x7'));function respondWithResult(_0x59239f,_0xe669e){_0xe669e=_0xe669e||0xc8;return function(_0x28f98b){if(_0x28f98b){return _0x59239f['status'](_0xe669e)[_0x706f('0x8')](_0x28f98b);}};}function respondWithFilteredResult(_0x3f8f3e,_0x30a043){return function(_0x2d2332){if(_0x2d2332){var _0x2204c9=typeof _0x30a043[_0x706f('0x9')]===_0x706f('0xa')&&typeof _0x30a043[_0x706f('0xb')]==='undefined';var _0x40661a=_0x2d2332[_0x706f('0xc')];var _0x5c5007=_0x2204c9?0x0:_0x30a043[_0x706f('0x9')];var _0x4db264=_0x2204c9?_0x2d2332[_0x706f('0xc')]:_0x30a043['offset']+_0x30a043[_0x706f('0xb')];var _0xe2730;if(_0x4db264>=_0x40661a){_0x4db264=_0x40661a;_0xe2730=0xc8;}else{_0xe2730=0xce;}_0x3f8f3e['status'](_0xe2730);return _0x3f8f3e['set'](_0x706f('0xd'),_0x5c5007+'-'+_0x4db264+'/'+_0x40661a)[_0x706f('0x8')](_0x2d2332);}return null;};}function saveUpdates(_0x8fad09){return function(_0x3f7eb8){if(_0x3f7eb8){return _0x3f7eb8[_0x706f('0xe')](_0x8fad09)[_0x706f('0xf')](function(_0x2daa57){return _0x2daa57;});}return null;};}function removeEntity(_0x209b50){return function(_0x5dfca2){if(_0x5dfca2){return _0x5dfca2['destroy']()[_0x706f('0xf')](function(){_0x209b50[_0x706f('0x10')](0xcc)[_0x706f('0x11')]();});}};}function handleEntityNotFound(_0x419c03){return function(_0xbd6b50){if(!_0xbd6b50){_0x419c03[_0x706f('0x12')](0x194);}return _0xbd6b50;};}function handleError(_0x7e592d,_0x4e87b1){_0x4e87b1=_0x4e87b1||0x1f4;return function(_0x302c03){logger[_0x706f('0x13')](_0x302c03[_0x706f('0x14')]);if(_0x302c03['name']){delete _0x302c03['name'];}_0x7e592d[_0x706f('0x10')](_0x4e87b1)['send'](_0x302c03);};}exports[_0x706f('0x15')]=function(_0x25355a,_0x13ac2a){var _0x39fe80={},_0x2d93b4={},_0xf032b={'count':0x0,'rows':[]};var _0x22cc3b=_['map'](db[_0x706f('0x16')][_0x706f('0x17')],function(_0x415d1a){return{'name':_0x415d1a['fieldName'],'type':_0x415d1a[_0x706f('0x18')][_0x706f('0x19')]};});_0x2d93b4[_0x706f('0x1a')]=_[_0x706f('0x1b')](_0x22cc3b,_0x706f('0x1c'));_0x2d93b4[_0x706f('0x1d')]=_[_0x706f('0x1e')](_0x25355a[_0x706f('0x1d')]);_0x2d93b4['filters']=_[_0x706f('0x1f')](_0x2d93b4[_0x706f('0x1a')],_0x2d93b4[_0x706f('0x1d')]);_0x39fe80[_0x706f('0x20')]=_[_0x706f('0x1f')](_0x2d93b4[_0x706f('0x1a')],qs[_0x706f('0x21')](_0x25355a[_0x706f('0x1d')][_0x706f('0x21')]));_0x39fe80[_0x706f('0x20')]=_0x39fe80['attributes'][_0x706f('0x22')]?_0x39fe80[_0x706f('0x20')]:_0x2d93b4['model'];if(!_0x25355a[_0x706f('0x1d')][_0x706f('0x23')](_0x706f('0x24'))){_0x39fe80['limit']=qs[_0x706f('0xb')](_0x25355a[_0x706f('0x1d')][_0x706f('0xb')]);_0x39fe80[_0x706f('0x9')]=qs['offset'](_0x25355a[_0x706f('0x1d')][_0x706f('0x9')]);}_0x39fe80['order']=qs[_0x706f('0x25')](_0x25355a[_0x706f('0x1d')][_0x706f('0x25')]);_0x39fe80[_0x706f('0x26')]=qs['filters'](_[_0x706f('0x27')](_0x25355a[_0x706f('0x1d')],_0x2d93b4[_0x706f('0x28')]),_0x22cc3b);if(_0x25355a[_0x706f('0x1d')][_0x706f('0x29')]){_0x39fe80['where']=_[_0x706f('0x2a')](_0x39fe80[_0x706f('0x26')],{'$or':_[_0x706f('0x1b')](_0x22cc3b,function(_0x325872){if(_0x325872[_0x706f('0x18')]!==_0x706f('0x2b')){var _0x39dcc4={};_0x39dcc4[_0x325872['name']]={'$like':'%'+_0x25355a['query'][_0x706f('0x29')]+'%'};return _0x39dcc4;}})});}_0x39fe80=_[_0x706f('0x2a')]({},_0x39fe80,_0x25355a[_0x706f('0x2c')]);var _0x2e009c={'where':_0x39fe80[_0x706f('0x26')]};return db['Dynamics365Account'][_0x706f('0xc')](_0x2e009c)[_0x706f('0xf')](function(_0x2215f3){_0xf032b['count']=_0x2215f3;if(_0x25355a['query'][_0x706f('0x2d')]){_0x39fe80[_0x706f('0x2e')]=[{'all':!![]}];}return db[_0x706f('0x16')][_0x706f('0x2f')](_0x39fe80);})['then'](function(_0x474d51){_0xf032b[_0x706f('0x30')]=_0x474d51;return _0xf032b;})[_0x706f('0xf')](respondWithFilteredResult(_0x13ac2a,_0x39fe80))['catch'](handleError(_0x13ac2a,null));};exports['show']=function(_0x1ccdca,_0x4592cf){var _0x54122e={'raw':![],'where':{'id':_0x1ccdca[_0x706f('0x31')]['id']}},_0x34260a={};_0x34260a[_0x706f('0x1a')]=_['keys'](db[_0x706f('0x16')]['rawAttributes']);_0x34260a['query']=_[_0x706f('0x1e')](_0x1ccdca['query']);_0x34260a[_0x706f('0x28')]=_[_0x706f('0x1f')](_0x34260a['model'],_0x34260a[_0x706f('0x1d')]);_0x54122e[_0x706f('0x20')]=_[_0x706f('0x1f')](_0x34260a[_0x706f('0x1a')],qs[_0x706f('0x21')](_0x1ccdca[_0x706f('0x1d')][_0x706f('0x21')]));_0x54122e[_0x706f('0x20')]=_0x54122e['attributes'][_0x706f('0x22')]?_0x54122e[_0x706f('0x20')]:_0x34260a['model'];if(_0x1ccdca[_0x706f('0x1d')][_0x706f('0x2d')]){_0x54122e['include']=[{'all':!![]}];}_0x54122e=_[_0x706f('0x2a')]({},_0x54122e,_0x1ccdca['options']);return db[_0x706f('0x16')][_0x706f('0x32')](_0x54122e)['then'](handleEntityNotFound(_0x4592cf,null))['then'](respondWithResult(_0x4592cf,null))['catch'](handleError(_0x4592cf,null));};exports[_0x706f('0x33')]=function(_0x1cc4eb,_0x4fb60d){return db[_0x706f('0x16')]['create'](_0x1cc4eb[_0x706f('0x34')],{})[_0x706f('0xf')](respondWithResult(_0x4fb60d,0xc9))['catch'](handleError(_0x4fb60d,null));};exports[_0x706f('0xe')]=function(_0x546e5b,_0x137ef3){if(_0x546e5b[_0x706f('0x34')]['id']){delete _0x546e5b[_0x706f('0x34')]['id'];}return db[_0x706f('0x16')]['find']({'where':{'id':_0x546e5b[_0x706f('0x31')]['id']}})[_0x706f('0xf')](handleEntityNotFound(_0x137ef3,null))['then'](saveUpdates(_0x546e5b[_0x706f('0x34')],null))[_0x706f('0xf')](respondWithResult(_0x137ef3,null))[_0x706f('0x35')](handleError(_0x137ef3,null));};exports[_0x706f('0x36')]=function(_0x1afa75,_0x42db78){return db['Dynamics365Account'][_0x706f('0x32')]({'where':{'id':_0x1afa75['params']['id']}})[_0x706f('0xf')](handleEntityNotFound(_0x42db78,null))['then'](removeEntity(_0x42db78,null))['catch'](handleError(_0x42db78,null));};exports['getConfigurations']=function(_0x4cefaf,_0xbd0828){var _0x497913={};var _0x7cc2ea={};var _0x567d31;var _0x4b0b39;return db[_0x706f('0x16')][_0x706f('0x37')]({'where':{'id':_0x4cefaf['params']['id']}})[_0x706f('0xf')](handleEntityNotFound(_0xbd0828,null))[_0x706f('0xf')](function(_0x14b7e0){if(_0x14b7e0){_0x567d31=_0x14b7e0;_0x7cc2ea['model']=_[_0x706f('0x1e')](db['Dynamics365Configuration'][_0x706f('0x17')]);_0x7cc2ea['query']=_['keys'](_0x4cefaf['query']);_0x7cc2ea[_0x706f('0x28')]=_['intersection'](_0x7cc2ea[_0x706f('0x1a')],_0x7cc2ea[_0x706f('0x1d')]);_0x497913[_0x706f('0x20')]=_[_0x706f('0x1f')](_0x7cc2ea['model'],qs[_0x706f('0x21')](_0x4cefaf['query'][_0x706f('0x21')]));_0x497913[_0x706f('0x20')]=_0x497913[_0x706f('0x20')][_0x706f('0x22')]?_0x497913[_0x706f('0x20')]:_0x7cc2ea[_0x706f('0x1a')];_0x497913['order']=qs[_0x706f('0x25')](_0x4cefaf['query'][_0x706f('0x25')]);_0x497913[_0x706f('0x26')]=qs['filters'](_[_0x706f('0x27')](_0x4cefaf[_0x706f('0x1d')],_0x7cc2ea['filters']));if(_0x4cefaf[_0x706f('0x1d')]['filter']){_0x497913[_0x706f('0x26')]=_[_0x706f('0x2a')](_0x497913['where'],{'$or':_[_0x706f('0x1b')](_0x497913[_0x706f('0x20')],function(_0x440f6d){var _0x4aecca={};_0x4aecca[_0x440f6d]={'$like':'%'+_0x4cefaf[_0x706f('0x1d')][_0x706f('0x29')]+'%'};return _0x4aecca;})});}_0x497913=_['merge']({},_0x497913,_0x4cefaf[_0x706f('0x2c')]);return _0x567d31[_0x706f('0x38')](_0x497913);}})[_0x706f('0xf')](function(_0x4d17d1){if(_0x4d17d1){_0x4b0b39=_0x4d17d1[_0x706f('0x22')];if(!_0x4cefaf[_0x706f('0x1d')]['hasOwnProperty'](_0x706f('0x24'))){_0x497913[_0x706f('0xb')]=qs[_0x706f('0xb')](_0x4cefaf[_0x706f('0x1d')][_0x706f('0xb')]);_0x497913[_0x706f('0x9')]=qs[_0x706f('0x9')](_0x4cefaf[_0x706f('0x1d')][_0x706f('0x9')]);}return _0x567d31[_0x706f('0x38')](_0x497913);}})[_0x706f('0xf')](function(_0x163147){if(_0x163147){return _0x163147?{'count':_0x4b0b39,'rows':_0x163147}:null;}})[_0x706f('0xf')](respondWithResult(_0xbd0828,null))[_0x706f('0x35')](handleError(_0xbd0828,null));};exports[_0x706f('0x39')]=function(_0x2d9a74,_0x239259){if(_0x2d9a74[_0x706f('0x34')]['id']){delete _0x2d9a74['body']['id'];}return db[_0x706f('0x16')][_0x706f('0x37')]({'where':{'id':_0x2d9a74[_0x706f('0x31')]['id']}})[_0x706f('0xf')](handleEntityNotFound(_0x239259,null))[_0x706f('0xf')](function(_0x16dcce){if(_0x16dcce){_0x2d9a74[_0x706f('0x34')][_0x706f('0x3a')]=_0x16dcce['id'];_0x2d9a74[_0x706f('0x34')][_0x706f('0x3b')]=integrations[_0x706f('0x3c')](_0x2d9a74['body']['channel'],_0x2d9a74['body'][_0x706f('0x18')]);_0x2d9a74[_0x706f('0x34')][_0x706f('0x3d')]=integrations[_0x706f('0x3e')](_0x2d9a74[_0x706f('0x34')][_0x706f('0x3f')],_0x2d9a74[_0x706f('0x34')][_0x706f('0x18')]);return db[_0x706f('0x40')][_0x706f('0x33')](_0x2d9a74[_0x706f('0x34')],{'include':[{'model':db[_0x706f('0x41')],'as':_0x706f('0x3b')},{'model':db['Dynamics365Field'],'as':_0x706f('0x3d')}]});}return null;})['then'](respondWithResult(_0x239259,null))[_0x706f('0x35')](handleError(_0x239259,null));};function sanitizeRemoteUri(_0x43d20f){var _0xf5c1ef=_0x43d20f['slice'](-0x1);if(_0xf5c1ef==='/')return _0x43d20f[_0x706f('0x42')](0x0,_0x43d20f[_0x706f('0x43')](_0xf5c1ef));return _0x43d20f;}function getWebApiUrl(_0x379abd){return util[_0x706f('0x44')](_0x706f('0x45'),_0x379abd);}exports['getFields']=function(_0x17ea19,_0x5cd27a){var _0xcba8d7=_0x17ea19[_0x706f('0x1d')]['ticketType'];var _0x5eb6e9=_0xcba8d7==='incident'?_0x706f('0x46'):'PhoneCall';var _0x72c1fa='';var _0x1763ff='';var _0xa5d0a0='';var _0x5126b1='';var _0x47001a='';var _0xdafc53='';var _0x48a82b='';var _0x451426='';var _0x1c815b=[_0x706f('0x47'),'description',_0x706f('0x48'),_0x706f('0x49'),'caseorigincode','subject','phonenumber','regardingobjectid','directioncode',_0x706f('0x4a')];var _0x206de0=[_0x706f('0x4b'),_0x706f('0x4c'),_0x706f('0x4d'),'billedserviceunits',_0x706f('0x4e'),_0x706f('0x4f'),_0x706f('0x50'),_0x706f('0x51'),_0x706f('0x52'),_0x706f('0x53'),_0x706f('0x54'),_0x706f('0x55'),_0x706f('0x56'),_0x706f('0x57'),_0x706f('0x58'),_0x706f('0x59'),_0x706f('0x5a'),_0x706f('0x5b'),'emailaddress',_0x706f('0x5c'),_0x706f('0x5d'),_0x706f('0x5e'),'escalatedon',_0x706f('0x5f'),'firstresponsebykpiidname','followupby',_0x706f('0x60'),'influencescore',_0x706f('0x61'),_0x706f('0x62'),_0x706f('0x63'),'modifiedbyexternalpartyname',_0x706f('0x64'),'modifiedbyname','modifiedbyyominame',_0x706f('0x65'),_0x706f('0x66'),_0x706f('0x67'),'msdyn_incidenttypename',_0x706f('0x68'),_0x706f('0x69'),_0x706f('0x6a'),_0x706f('0x6b'),'owneridname','owneridtype',_0x706f('0x6c'),_0x706f('0x6d'),'primarycontactidname','primarycontactidyominame',_0x706f('0x6e'),_0x706f('0x6f'),'productserialnumber','resolveby',_0x706f('0x70'),_0x706f('0x71'),_0x706f('0x72'),_0x706f('0x73'),_0x706f('0x74'),_0x706f('0x75'),'slaname',_0x706f('0x76'),_0x706f('0x77'),_0x706f('0x78'),_0x706f('0x79'),_0x706f('0x7a'),_0x706f('0x7b'),_0x706f('0x7c'),_0x706f('0x7d'),_0x706f('0x7e'),_0x706f('0x7f')];var _0x3b6b28=_0x1c815b[_0x706f('0x80')](_0x206de0);return db[_0x706f('0x16')][_0x706f('0x37')]({'where':{'id':_0x17ea19[_0x706f('0x31')]['id']},'attributes':['id','username',_0x706f('0x81'),_0x706f('0x82'),_0x706f('0x83'),'clientId',_0x706f('0x84'),_0x706f('0x85')],'include':[{'model':db[_0x706f('0x86')],'as':'CloudProvider','attributes':['id',_0x706f('0x87'),'data7']}]})[_0x706f('0xf')](handleEntityNotFound(_0x5cd27a,null))[_0x706f('0xf')](function(_0x397c68){if(_0x397c68){if(_0x397c68[_0x706f('0x85')]){_0x397c68['access_token']=_0x397c68['CloudProvider'][_0x706f('0x87')];_0x451426=sanitizeRemoteUri(_0x397c68[_0x706f('0x86')]['data7']);_0x48a82b=getWebApiUrl(_0x451426);return _0x397c68;}_0x451426=sanitizeRemoteUri(_0x397c68[_0x706f('0x82')]);_0x48a82b=getWebApiUrl(_0x451426);var _0x165154={'method':_0x706f('0x88'),'uri':_0x706f('0x89')+_0x397c68['tenantId']+_0x706f('0x8a'),'form':{'client_id':_0x397c68[_0x706f('0x8b')],'resource':_0x451426,'username':_0x397c68[_0x706f('0x8c')],'password':_0x397c68[_0x706f('0x81')],'grant_type':_0x706f('0x81'),'client_secret':_0x397c68[_0x706f('0x84')]},'json':!![]};return rp(_0x165154);}})[_0x706f('0xf')](function(_0x46664c){_0xdafc53=_0x46664c[_0x706f('0x8d')];var _0x55fe84={'method':_0x706f('0x8e'),'uri':encodeURI(_0x48a82b+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x5eb6e9+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xdafc53,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x55fe84);})[_0x706f('0xf')](function(_0x35763b){var _0x1b46fb=_0x35763b['value'][0x0];var _0xfcd7e=_0x1b46fb[_0x706f('0x8f')];var _0x236faa={'method':'GET','uri':_0x48a82b+_0x706f('0x90')+_0xfcd7e+_0x706f('0x91'),'headers':{'Authorization':_0x706f('0x92')+_0xdafc53,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x236faa);})[_0x706f('0xf')](function(_0x14c20b){_0x72c1fa=_0x14c20b;_0x1763ff=_0x72c1fa['Attributes'];_0x1763ff=_['remove'](_0x1763ff,function(_0x709f3c){return!_0x3b6b28[_0x706f('0x93')](_0x709f3c[_0x706f('0x94')]);});var _0x56fbdc=[];var _0x4fa24d=[];_0x1763ff[_0x706f('0x95')](function(_0x3f0004){if(_0x3f0004[_0x706f('0x96')]){var _0x20bbb5=_0x3f0004[_0x706f('0x96')][_0x706f('0x42')](_0x3f0004[_0x706f('0x96')][_0x706f('0x43')]('.')+0x1);if(_0x20bbb5==='PicklistAttributeMetadata'){_0x56fbdc[_0x706f('0x97')](getSelectList(_0x48a82b,_0xcba8d7,_0x4fa24d,_0x72c1fa[_0x706f('0x8f')],_0x3f0004[_0x706f('0x8f')],_0xdafc53));}}});return Promise[_0x706f('0x98')](_0x56fbdc);})['then'](function(_0x263831){_0xa5d0a0=_0x263831[0x0];var _0x4024be=[];var _0x373e37=[];_0x1763ff[_0x706f('0x95')](function(_0x10c432){if(!_['isNil'](_0x10c432[_0x706f('0x96')])){var _0x52e559=_0x10c432['@odata.type']['substring'](_0x10c432[_0x706f('0x96')][_0x706f('0x43')]('.')+0x1);if(_0x52e559==='BooleanAttributeMetadata'){_0x4024be['push'](getBooleanList(_0x48a82b,_0xcba8d7,_0x373e37,_0x72c1fa[_0x706f('0x8f')],_0x10c432[_0x706f('0x8f')],_0xdafc53));}}});return Promise[_0x706f('0x98')](_0x4024be);})[_0x706f('0xf')](function(_0x2fa7da){_0x5126b1=_0x2fa7da[0x0];var _0x379b5d=[];var _0x29ffcd=[];_0x1763ff[_0x706f('0x95')](function(_0x209d4b){if(_0x209d4b[_0x706f('0x96')]){var _0x51c2e1=_0x209d4b[_0x706f('0x96')]['substring'](_0x209d4b[_0x706f('0x96')]['lastIndexOf']('.')+0x1);if(_0x51c2e1===_0x706f('0x99')||_0x51c2e1===_0x706f('0x9a')||_0x51c2e1===_0x706f('0x9b')||_0x51c2e1==='IntegerAttributeMetadata'||_0x51c2e1===_0x706f('0x9c')||_0x51c2e1===_0x706f('0x9d')||_0x51c2e1===_0x706f('0x9e')||_0x51c2e1===_0x706f('0x9f')||_0x51c2e1==='StateAttributeMetadata'||_0x51c2e1==='DecimalAttributeMetadata'){_0x379b5d[_0x706f('0x97')](getInputList(_0x48a82b,_0xcba8d7,_0x51c2e1,_0x29ffcd,_0x72c1fa['MetadataId'],_0x209d4b['MetadataId'],_0xdafc53));}}});return Promise[_0x706f('0x98')](_0x379b5d);})[_0x706f('0xf')](function(_0x44feca){_0x47001a=_0x44feca[0x0];var _0x398cb7=_0xa5d0a0['concat'](_0x5126b1)[_0x706f('0x80')](_0x47001a);var _0x27b51b={'count':_0x398cb7[_0x706f('0x22')],'rows':_0x398cb7};return _0x27b51b;})[_0x706f('0xf')](respondWithResult(_0x5cd27a,null))[_0x706f('0x35')](function(_0x1e4557){var _0x10bfe2=_0x17ea19[_0x706f('0x1d')][_0x706f('0xa0')]?0x1f4:_0x1e4557[_0x706f('0xa1')]||0x1f4;logger['error'](_0x1e4557['stack']);delete _0x1e4557[_0x706f('0x1c')];if(_0x10bfe2===0x191){_0x10bfe2=0x190;}_0x5cd27a['status'](_0x10bfe2)[_0x706f('0xa2')](_0x17ea19['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x1e4557['statusCode']}:_0x1e4557);});};function getSelectList(_0x4e6618,_0x123bf8,_0x412951,_0x5047c2,_0x51bc43,_0x57a404){var _0x106e8d={'method':'GET','uri':_0x4e6618+'EntityDefinitions('+_0x5047c2+_0x706f('0xa3')+_0x51bc43+_0x706f('0xa4')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x57a404,'If-None-Match':null,'OData-Version':_0x706f('0xa5')},'json':!![]};return rp(_0x106e8d)['then'](function(_0x460f59){var _0x31bc0f=[];var _0x42e2e6=_0x460f59[_0x706f('0xa6')][_0x706f('0xa7')];_0x42e2e6['forEach'](function(_0x416f12){_0x31bc0f[_0x706f('0x97')]({'name':_0x416f12[_0x706f('0xa8')]['UserLocalizedLabel'][_0x706f('0xa8')],'value':String(_0x416f12[_0x706f('0xa9')])});});var _0x3b5336={'id':_0x123bf8+'_'+_0x460f59[_0x706f('0x94')],'name':_0x460f59[_0x706f('0xaa')][_0x706f('0xab')][_0x706f('0xa8')],'custom':![],'options':_0x31bc0f};_0x412951[_0x706f('0x97')](_0x3b5336);return _0x412951;});}function getBooleanList(_0x1e0c49,_0x158b65,_0x307e74,_0x366c36,_0x19625e,_0x347f6a){var _0x1c3b66={'method':_0x706f('0x8e'),'uri':_0x1e0c49+_0x706f('0x90')+_0x366c36+')/Attributes('+_0x19625e+_0x706f('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x347f6a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c3b66)[_0x706f('0xf')](function(_0x1a7dec){var _0x5a9398=[];_0x5a9398[_0x706f('0x97')]({'name':_0x1a7dec[_0x706f('0xa6')][_0x706f('0xad')][_0x706f('0xa8')][_0x706f('0xab')][_0x706f('0xa8')],'value':_0x706f('0xae')},{'name':_0x1a7dec['OptionSet'][_0x706f('0xaf')][_0x706f('0xa8')][_0x706f('0xab')][_0x706f('0xa8')],'value':'false'});var _0x3c52b5={'id':_0x158b65+'_'+_0x1a7dec[_0x706f('0x94')],'name':_0x1a7dec['DisplayName'][_0x706f('0xab')]['Label'],'custom':![],'options':_0x5a9398};_0x307e74['push'](_0x3c52b5);return _0x307e74;});}function getInputList(_0x4e3905,_0x500d29,_0x18464b,_0x559925,_0x4024f5,_0x412fc5,_0x4679ad){var _0x608661={'method':_0x706f('0x8e'),'uri':_0x4e3905+_0x706f('0x90')+_0x4024f5+')/Attributes('+_0x412fc5+_0x706f('0xb0')+_0x18464b+_0x706f('0xb1'),'headers':{'Authorization':_0x706f('0x92')+_0x4679ad,'If-None-Match':null,'OData-Version':_0x706f('0xa5')},'json':!![]};return rp(_0x608661)[_0x706f('0xf')](function(_0x28d4ad){var _0x398035={'id':_0x500d29+'_'+_0x28d4ad[_0x706f('0x94')],'name':_0x28d4ad[_0x706f('0xaa')][_0x706f('0xab')]?_0x28d4ad[_0x706f('0xaa')][_0x706f('0xab')][_0x706f('0xa8')]:_0x28d4ad[_0x706f('0x94')],'custom':![],'options':[]};_0x559925[_0x706f('0x97')](_0x398035);return _0x559925;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6916c34..8ba814d 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x3138c1,_0x2020ed){var _0x4d0fce=function(_0x39d429){while(--_0x39d429){_0x3138c1['push'](_0x3138c1['shift']());}};_0x4d0fce(++_0x2020ed);}(_0xe706,0xa3));var _0x6e70=function(_0x358fb5,_0x4407b8){_0x358fb5=_0x358fb5-0x0;var _0x4abfeb=_0xe706[_0x358fb5];return _0x4abfeb;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 1723ff2..1be349a 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 _0x3558=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','options','where','map','attributes','include','model','ShowDynamics365Account','Dynamics365Account','find','raw'];(function(_0x22cd62,_0x3f322d){var _0x5e8bf3=function(_0x19319c){while(--_0x19319c){_0x22cd62['push'](_0x22cd62['shift']());}};_0x5e8bf3(++_0x3f322d);}(_0x3558,0xc6));var _0x8355=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x3558[_0xa3463d];return _0x50fd67;};'use strict';var _=require(_0x8355('0x0'));var util=require(_0x8355('0x1'));var moment=require('moment');var BPromise=require(_0x8355('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8355('0x3'));var db=require(_0x8355('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8355('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8355('0x6'));var client=jayson[_0x8355('0x7')][_0x8355('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53a299,_0x12779c,_0x31c7d5){return new BPromise(function(_0x5c1729,_0x33b9da){return client[_0x8355('0x9')](_0x53a299,_0x31c7d5)[_0x8355('0xa')](function(_0x10661b){logger[_0x8355('0xb')](_0x8355('0xc'),_0x12779c,'request\x20sent');logger[_0x8355('0xd')](_0x8355('0xe'),_0x12779c,_0x8355('0xf'),JSON[_0x8355('0x10')](_0x10661b));if(_0x10661b[_0x8355('0x11')]){if(_0x10661b[_0x8355('0x11')][_0x8355('0x12')]===0x1f4){logger[_0x8355('0x11')](_0x8355('0xc'),_0x12779c,_0x10661b[_0x8355('0x11')][_0x8355('0x13')]);return _0x33b9da(_0x10661b[_0x8355('0x11')][_0x8355('0x13')]);}logger['error'](_0x8355('0xc'),_0x12779c,_0x10661b[_0x8355('0x11')][_0x8355('0x13')]);return _0x5c1729(_0x10661b[_0x8355('0x11')][_0x8355('0x13')]);}else{logger[_0x8355('0xb')](_0x8355('0xc'),_0x12779c,'request\x20sent');_0x5c1729(_0x10661b[_0x8355('0x14')]['message']);}})[_0x8355('0x15')](function(_0x1cf1ba){logger[_0x8355('0x11')](_0x8355('0xc'),_0x12779c,_0x1cf1ba);_0x33b9da(_0x1cf1ba);});});}exports[_0x8355('0x16')]=function(_0x344cb3){var _0x4643e5=this;return new Promise(function(_0x281792,_0x5bcd80){return db['Dynamics365Account']['findAll']({'raw':_0x344cb3[_0x8355('0x17')]?_0x344cb3[_0x8355('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x344cb3['options']?_0x344cb3[_0x8355('0x17')][_0x8355('0x18')]||null:null,'attributes':_0x344cb3['options']?_0x344cb3[_0x8355('0x17')]['attributes']||null:null,'limit':_0x344cb3[_0x8355('0x17')]?_0x344cb3[_0x8355('0x17')]['limit']||null:null,'include':_0x344cb3[_0x8355('0x17')]?_0x344cb3[_0x8355('0x17')]['include']?_[_0x8355('0x19')](_0x344cb3[_0x8355('0x17')]['include'],function(_0x48ad9a){return{'model':db[_0x48ad9a['model']],'as':_0x48ad9a['as'],'attributes':_0x48ad9a[_0x8355('0x1a')],'include':_0x48ad9a[_0x8355('0x1b')]?_[_0x8355('0x19')](_0x48ad9a[_0x8355('0x1b')],function(_0xc41c71){return{'model':db[_0xc41c71[_0x8355('0x1c')]],'as':_0xc41c71['as'],'attributes':_0xc41c71[_0x8355('0x1a')],'include':_0xc41c71[_0x8355('0x1b')]?_[_0x8355('0x19')](_0xc41c71['include'],function(_0x4b98a5){return{'model':db[_0x4b98a5[_0x8355('0x1c')]],'as':_0x4b98a5['as'],'attributes':_0x4b98a5[_0x8355('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dde9d){logger['info'](_0x8355('0x16'),_0x344cb3);logger['debug'](_0x8355('0x16'),_0x344cb3,JSON[_0x8355('0x10')](_0x2dde9d));_0x281792(_0x2dde9d);})['catch'](function(_0x22aeb4){logger['error'](_0x8355('0x16'),_0x22aeb4[_0x8355('0x13')],_0x344cb3);_0x5bcd80(_0x4643e5[_0x8355('0x11')](0x1f4,_0x22aeb4[_0x8355('0x13')]));});});};exports[_0x8355('0x1d')]=function(_0x33e7f9){var _0x5d2447=this;return new Promise(function(_0x21659d,_0x358547){return db[_0x8355('0x1e')][_0x8355('0x1f')]({'raw':_0x33e7f9[_0x8355('0x17')]?_0x33e7f9['options'][_0x8355('0x20')]===undefined?!![]:![]:!![],'where':_0x33e7f9[_0x8355('0x17')]?_0x33e7f9[_0x8355('0x17')][_0x8355('0x18')]||null:null,'attributes':_0x33e7f9[_0x8355('0x17')]?_0x33e7f9[_0x8355('0x17')][_0x8355('0x1a')]||null:null,'include':_0x33e7f9[_0x8355('0x17')]?_0x33e7f9[_0x8355('0x17')]['include']?_[_0x8355('0x19')](_0x33e7f9[_0x8355('0x17')][_0x8355('0x1b')],function(_0x32e013){return{'model':db[_0x32e013[_0x8355('0x1c')]],'as':_0x32e013['as'],'attributes':_0x32e013['attributes'],'include':_0x32e013[_0x8355('0x1b')]?_[_0x8355('0x19')](_0x32e013[_0x8355('0x1b')],function(_0x481b46){return{'model':db[_0x481b46['model']],'as':_0x481b46['as'],'attributes':_0x481b46['attributes'],'include':_0x481b46[_0x8355('0x1b')]?_[_0x8355('0x19')](_0x481b46[_0x8355('0x1b')],function(_0x52fe61){return{'model':db[_0x52fe61['model']],'as':_0x52fe61['as'],'attributes':_0x52fe61[_0x8355('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8355('0xa')](function(_0x52f749){logger[_0x8355('0xb')](_0x8355('0x1d'),_0x33e7f9);logger[_0x8355('0xd')](_0x8355('0x1d'),_0x33e7f9,JSON['stringify'](_0x52f749));_0x21659d(_0x52f749);})[_0x8355('0x15')](function(_0x1a0e8a){logger[_0x8355('0x11')](_0x8355('0x1d'),_0x1a0e8a['message'],_0x33e7f9);_0x358547(_0x5d2447[_0x8355('0x11')](0x1f4,_0x1a0e8a[_0x8355('0x13')]));});});}; \ No newline at end of file +var _0x44b6=['jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','findAll','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account','catch','ShowDynamics365Account','Dynamics365Account','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x275722,_0x245fa4){var _0x11e729=function(_0x46ea6f){while(--_0x46ea6f){_0x275722['push'](_0x275722['shift']());}};_0x11e729(++_0x245fa4);}(_0x44b6,0x14c));var _0x644b=function(_0x2c5231,_0x51913c){_0x2c5231=_0x2c5231-0x0;var _0x569090=_0x44b6[_0x2c5231];return _0x569090;};'use strict';var _=require(_0x644b('0x0'));var util=require('util');var moment=require(_0x644b('0x1'));var BPromise=require(_0x644b('0x2'));var rs=require(_0x644b('0x3'));var fs=require('fs');var Redis=require(_0x644b('0x4'));var db=require(_0x644b('0x5'))['db'];var utils=require(_0x644b('0x6'));var logger=require('../../config/logger')(_0x644b('0x7'));var config=require('../../config/environment');var jayson=require(_0x644b('0x8'));var client=jayson[_0x644b('0x9')][_0x644b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5acdd1,_0x412c14,_0x2ee4de){return new BPromise(function(_0x1ebd0d,_0x4e5f09){return client['request'](_0x5acdd1,_0x2ee4de)[_0x644b('0xb')](function(_0x229532){logger[_0x644b('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x412c14,_0x644b('0xd'));logger[_0x644b('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x412c14,_0x644b('0xd'),JSON[_0x644b('0xf')](_0x229532));if(_0x229532[_0x644b('0x10')]){if(_0x229532[_0x644b('0x10')][_0x644b('0x11')]===0x1f4){logger[_0x644b('0x10')](_0x644b('0x12'),_0x412c14,_0x229532[_0x644b('0x10')]['message']);return _0x4e5f09(_0x229532[_0x644b('0x10')][_0x644b('0x13')]);}logger['error'](_0x644b('0x12'),_0x412c14,_0x229532[_0x644b('0x10')]['message']);return _0x1ebd0d(_0x229532[_0x644b('0x10')][_0x644b('0x13')]);}else{logger[_0x644b('0xc')](_0x644b('0x12'),_0x412c14,_0x644b('0xd'));_0x1ebd0d(_0x229532[_0x644b('0x14')][_0x644b('0x13')]);}})['catch'](function(_0x185ed4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x412c14,_0x185ed4);_0x4e5f09(_0x185ed4);});});}exports['GetDynamics365Account']=function(_0x4f1878){var _0x2d429f=this;return new Promise(function(_0x8ef9d4,_0x3caf34){return db['Dynamics365Account'][_0x644b('0x15')]({'raw':_0x4f1878['options']?_0x4f1878[_0x644b('0x16')][_0x644b('0x17')]===undefined?!![]:![]:!![],'where':_0x4f1878[_0x644b('0x16')]?_0x4f1878[_0x644b('0x16')][_0x644b('0x18')]||null:null,'attributes':_0x4f1878[_0x644b('0x16')]?_0x4f1878[_0x644b('0x16')][_0x644b('0x19')]||null:null,'limit':_0x4f1878[_0x644b('0x16')]?_0x4f1878[_0x644b('0x16')][_0x644b('0x1a')]||null:null,'include':_0x4f1878[_0x644b('0x16')]?_0x4f1878[_0x644b('0x16')][_0x644b('0x1b')]?_[_0x644b('0x1c')](_0x4f1878['options'][_0x644b('0x1b')],function(_0x5b48d1){return{'model':db[_0x5b48d1[_0x644b('0x1d')]],'as':_0x5b48d1['as'],'attributes':_0x5b48d1[_0x644b('0x19')],'include':_0x5b48d1[_0x644b('0x1b')]?_[_0x644b('0x1c')](_0x5b48d1[_0x644b('0x1b')],function(_0x50d895){return{'model':db[_0x50d895[_0x644b('0x1d')]],'as':_0x50d895['as'],'attributes':_0x50d895[_0x644b('0x19')],'include':_0x50d895[_0x644b('0x1b')]?_[_0x644b('0x1c')](_0x50d895['include'],function(_0x157741){return{'model':db[_0x157741[_0x644b('0x1d')]],'as':_0x157741['as'],'attributes':_0x157741['attributes']};}):[]};}):[]};}):[]:[]})[_0x644b('0xb')](function(_0x530f79){logger[_0x644b('0xc')]('GetDynamics365Account',_0x4f1878);logger['debug'](_0x644b('0x1e'),_0x4f1878,JSON['stringify'](_0x530f79));_0x8ef9d4(_0x530f79);})[_0x644b('0x1f')](function(_0x2f6e39){logger['error'](_0x644b('0x1e'),_0x2f6e39[_0x644b('0x13')],_0x4f1878);_0x3caf34(_0x2d429f[_0x644b('0x10')](0x1f4,_0x2f6e39[_0x644b('0x13')]));});});};exports[_0x644b('0x20')]=function(_0x1ca56c){var _0x267cc4=this;return new Promise(function(_0x4db3a7,_0x35ea2a){return db[_0x644b('0x21')]['find']({'raw':_0x1ca56c[_0x644b('0x16')]?_0x1ca56c[_0x644b('0x16')][_0x644b('0x17')]===undefined?!![]:![]:!![],'where':_0x1ca56c[_0x644b('0x16')]?_0x1ca56c[_0x644b('0x16')][_0x644b('0x18')]||null:null,'attributes':_0x1ca56c['options']?_0x1ca56c[_0x644b('0x16')][_0x644b('0x19')]||null:null,'include':_0x1ca56c['options']?_0x1ca56c[_0x644b('0x16')][_0x644b('0x1b')]?_[_0x644b('0x1c')](_0x1ca56c[_0x644b('0x16')][_0x644b('0x1b')],function(_0x33a860){return{'model':db[_0x33a860[_0x644b('0x1d')]],'as':_0x33a860['as'],'attributes':_0x33a860['attributes'],'include':_0x33a860[_0x644b('0x1b')]?_[_0x644b('0x1c')](_0x33a860['include'],function(_0x58292c){return{'model':db[_0x58292c[_0x644b('0x1d')]],'as':_0x58292c['as'],'attributes':_0x58292c[_0x644b('0x19')],'include':_0x58292c[_0x644b('0x1b')]?_['map'](_0x58292c[_0x644b('0x1b')],function(_0x46bb9f){return{'model':db[_0x46bb9f['model']],'as':_0x46bb9f['as'],'attributes':_0x46bb9f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21f99f){logger[_0x644b('0xc')](_0x644b('0x20'),_0x1ca56c);logger[_0x644b('0xe')](_0x644b('0x20'),_0x1ca56c,JSON[_0x644b('0xf')](_0x21f99f));_0x4db3a7(_0x21f99f);})[_0x644b('0x1f')](function(_0x365213){logger[_0x644b('0x10')](_0x644b('0x20'),_0x365213[_0x644b('0x13')],_0x1ca56c);_0x35ea2a(_0x267cc4['error'](0x1f4,_0x365213[_0x644b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9bfce6f..f93426d 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 _0xc759=['isAuthenticated','/:id','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0xde91d9,_0x15fe0b){var _0x55a65e=function(_0x1456a3){while(--_0x1456a3){_0xde91d9['push'](_0xde91d9['shift']());}};_0x55a65e(++_0x15fe0b);}(_0xc759,0xa0));var _0x9c75=function(_0x3bf696,_0x45040e){_0x3bf696=_0x3bf696-0x0;var _0x50a06e=_0xc759[_0x3bf696];return _0x50a06e;};'use strict';var multer=require('multer');var util=require(_0x9c75('0x0'));var path=require(_0x9c75('0x1'));var timeout=require(_0x9c75('0x2'));var express=require(_0x9c75('0x3'));var router=express['Router']();var fs_extra=require(_0x9c75('0x4'));var auth=require(_0x9c75('0x5'));var interaction=require(_0x9c75('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x9c75('0x7')]('/',auth[_0x9c75('0x8')](),controller['index']);router[_0x9c75('0x7')](_0x9c75('0x9'),auth[_0x9c75('0x8')](),controller['show']);router[_0x9c75('0x7')](_0x9c75('0xa'),auth[_0x9c75('0x8')](),controller['getFields']);router[_0x9c75('0x7')](_0x9c75('0xb'),auth[_0x9c75('0x8')](),controller['getSubjects']);router[_0x9c75('0x7')](_0x9c75('0xc'),auth[_0x9c75('0x8')](),controller[_0x9c75('0xd')]);router[_0x9c75('0xe')]('/',auth[_0x9c75('0x8')](),controller[_0x9c75('0xf')]);router[_0x9c75('0x10')](_0x9c75('0x9'),auth['isAuthenticated'](),controller[_0x9c75('0x11')]);router[_0x9c75('0x12')](_0x9c75('0x9'),auth['isAuthenticated'](),controller[_0x9c75('0x13')]);module[_0x9c75('0x14')]=router; \ No newline at end of file +var _0x4f3c=['index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x4915be,_0x3fbdd3){var _0x115aba=function(_0x4b496b){while(--_0x4b496b){_0x4915be['push'](_0x4915be['shift']());}};_0x115aba(++_0x3fbdd3);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x12aba8,_0x40a036){_0x12aba8=_0x12aba8-0x0;var _0x2aac66=_0x4f3c[_0x12aba8];return _0x2aac66;};'use strict';var multer=require(_0xc4f3('0x0'));var util=require(_0xc4f3('0x1'));var path=require(_0xc4f3('0x2'));var timeout=require(_0xc4f3('0x3'));var express=require(_0xc4f3('0x4'));var router=express[_0xc4f3('0x5')]();var fs_extra=require(_0xc4f3('0x6'));var auth=require(_0xc4f3('0x7'));var interaction=require(_0xc4f3('0x8'));var config=require(_0xc4f3('0x9'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0xc4f3('0xa')](),controller[_0xc4f3('0xb')]);router[_0xc4f3('0xc')](_0xc4f3('0xd'),auth[_0xc4f3('0xa')](),controller[_0xc4f3('0xe')]);router[_0xc4f3('0xc')](_0xc4f3('0xf'),auth[_0xc4f3('0xa')](),controller[_0xc4f3('0x10')]);router['get'](_0xc4f3('0x11'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xc4f3('0xc')]('/:id/descriptions',auth[_0xc4f3('0xa')](),controller[_0xc4f3('0x12')]);router[_0xc4f3('0x13')]('/',auth['isAuthenticated'](),controller[_0xc4f3('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc4f3('0x15')]);router[_0xc4f3('0x16')](_0xc4f3('0xd'),auth[_0xc4f3('0xa')](),controller['destroy']);module[_0xc4f3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index abb2814..ef83799 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 _0xaa6b=['ENUM','incident','phonecall','contact','nothing','sequelize','exports','STRING'];(function(_0x597b14,_0x4eadc8){var _0x32dd31=function(_0x388ba3){while(--_0x388ba3){_0x597b14['push'](_0x597b14['shift']());}};_0x32dd31(++_0x4eadc8);}(_0xaa6b,0x12d));var _0xbaa6=function(_0x4308b9,_0xe07b97){_0x4308b9=_0x4308b9-0x0;var _0x455976=_0xaa6b[_0x4308b9];return _0x455976;};'use strict';var Sequelize=require(_0xbaa6('0x0'));module[_0xbaa6('0x1')]={'name':{'type':Sequelize[_0xbaa6('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xbaa6('0x3')](_0xbaa6('0x4'),_0xbaa6('0x5')),'defaultValue':_0xbaa6('0x4')},'moduleCreate':{'type':Sequelize[_0xbaa6('0x3')](_0xbaa6('0x6'),_0xbaa6('0x7')),'defaultValue':_0xbaa6('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xbaa6('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x6e99=['incident','phonecall','nothing','contact','sequelize','exports','STRING','ENUM'];(function(_0x40cf97,_0x3465d5){var _0x1f28b8=function(_0x101e80){while(--_0x101e80){_0x40cf97['push'](_0x40cf97['shift']());}};_0x1f28b8(++_0x3465d5);}(_0x6e99,0x14c));var _0x96e9=function(_0x5dc3d2,_0xf015a){_0x5dc3d2=_0x5dc3d2-0x0;var _0x34ab3f=_0x6e99[_0x5dc3d2];return _0x34ab3f;};'use strict';var Sequelize=require(_0x96e9('0x0'));module[_0x96e9('0x1')]={'name':{'type':Sequelize[_0x96e9('0x2')]},'description':{'type':Sequelize[_0x96e9('0x2')]},'ticketType':{'type':Sequelize[_0x96e9('0x3')](_0x96e9('0x4'),_0x96e9('0x5')),'defaultValue':_0x96e9('0x4')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x96e9('0x6')),'defaultValue':_0x96e9('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x96e9('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 9fa7abf..f1bcacb 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 _0x6846=['undefined','count','offset','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','merge','options','Dynamics365Configuration','include','findAll','rows','catch','keys','length','find','create','body','params','getFields','findOne','Dynamics365Field','filter','hasOwnProperty','getSubjects','getDescriptions','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','limit'];(function(_0x59fc6f,_0x4a71cf){var _0x2687ce=function(_0x40cb18){while(--_0x40cb18){_0x59fc6f['push'](_0x59fc6f['shift']());}};_0x2687ce(++_0x4a71cf);}(_0x6846,0x15f));var _0x6684=function(_0x24a234,_0x504c09){_0x24a234=_0x24a234-0x0;var _0xbc39b8=_0x6846[_0x24a234];return _0xbc39b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6684('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6684('0x1'));var moment=require(_0x6684('0x2'));var BPromise=require(_0x6684('0x3'));var Mustache=require(_0x6684('0x4'));var util=require(_0x6684('0x5'));var path=require('path');var sox=require(_0x6684('0x6'));var csv=require(_0x6684('0x7'));var ejs=require(_0x6684('0x8'));var fs=require('fs');var fs_extra=require(_0x6684('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6684('0xa'));var jsforce=require(_0x6684('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6684('0x7'));var querystring=require('querystring');var Papa=require(_0x6684('0xc'));var Redis=require(_0x6684('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6684('0xe'));var hardwareService=require(_0x6684('0xf'));var logger=require(_0x6684('0x10'))(_0x6684('0x11'));var utils=require('../../config/utils');var config=require(_0x6684('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x6684('0x13'))['db'];function respondWithStatusCode(_0x1478ae,_0x57c7af){_0x57c7af=_0x57c7af||0xcc;return function(_0x23dc9f){if(_0x23dc9f){return _0x1478ae[_0x6684('0x14')](_0x57c7af);}return _0x1478ae[_0x6684('0x15')](_0x57c7af)[_0x6684('0x16')]();};}function respondWithResult(_0x28eaf0,_0xba927){_0xba927=_0xba927||0xc8;return function(_0x3d1b59){if(_0x3d1b59){return _0x28eaf0[_0x6684('0x15')](_0xba927)['json'](_0x3d1b59);}};}function respondWithFilteredResult(_0x40a37f,_0x2cf04e){return function(_0x2d9ec0){if(_0x2d9ec0){var _0x35d060=typeof _0x2cf04e['offset']==='undefined'&&typeof _0x2cf04e[_0x6684('0x17')]===_0x6684('0x18');var _0x2e3034=_0x2d9ec0[_0x6684('0x19')];var _0x2f180a=_0x35d060?0x0:_0x2cf04e[_0x6684('0x1a')];var _0xd5272b=_0x35d060?_0x2d9ec0['count']:_0x2cf04e[_0x6684('0x1a')]+_0x2cf04e[_0x6684('0x17')];var _0x181d47;if(_0xd5272b>=_0x2e3034){_0xd5272b=_0x2e3034;_0x181d47=0xc8;}else{_0x181d47=0xce;}_0x40a37f['status'](_0x181d47);return _0x40a37f[_0x6684('0x1b')](_0x6684('0x1c'),_0x2f180a+'-'+_0xd5272b+'/'+_0x2e3034)[_0x6684('0x1d')](_0x2d9ec0);}return null;};}function patchUpdates(_0x5179d9){return function(_0x2cb27d){try{jsonpatch['apply'](_0x2cb27d,_0x5179d9,!![]);}catch(_0x2de210){return BPromise[_0x6684('0x1e')](_0x2de210);}return _0x2cb27d['save']();};}function saveUpdates(_0x594dcd,_0xba1642){return function(_0x4997af){if(_0x4997af){return _0x4997af[_0x6684('0x1f')](_0x594dcd)[_0x6684('0x20')](function(_0x2ece65){return _0x2ece65;});}return null;};}function removeEntity(_0x472f62,_0x3f9670){return function(_0x409964){if(_0x409964){return _0x409964[_0x6684('0x21')]()[_0x6684('0x20')](function(){_0x472f62[_0x6684('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ab4d5,_0x3c15b1){return function(_0x4865a3){if(!_0x4865a3){_0x4ab4d5[_0x6684('0x14')](0x194);}return _0x4865a3;};}function handleError(_0x5aa0b2,_0x126de5){_0x126de5=_0x126de5||0x1f4;return function(_0xa917f6){logger[_0x6684('0x22')](_0xa917f6[_0x6684('0x23')]);if(_0xa917f6[_0x6684('0x24')]){delete _0xa917f6['name'];}_0x5aa0b2[_0x6684('0x15')](_0x126de5)[_0x6684('0x25')](_0xa917f6);};}exports[_0x6684('0x26')]=function(_0x4da832,_0x1056da){var _0x4b757a={},_0x4497fa={},_0x27268d={'count':0x0,'rows':[]};var _0x371ce6=_[_0x6684('0x27')](db['Dynamics365Configuration'][_0x6684('0x28')],function(_0x56dad5){return{'name':_0x56dad5['fieldName'],'type':_0x56dad5[_0x6684('0x29')][_0x6684('0x2a')]};});_0x4497fa[_0x6684('0x2b')]=_['map'](_0x371ce6,'name');_0x4497fa[_0x6684('0x2c')]=_['keys'](_0x4da832['query']);_0x4497fa[_0x6684('0x2d')]=_[_0x6684('0x2e')](_0x4497fa['model'],_0x4497fa[_0x6684('0x2c')]);_0x4b757a[_0x6684('0x2f')]=_[_0x6684('0x2e')](_0x4497fa[_0x6684('0x2b')],qs['fields'](_0x4da832[_0x6684('0x2c')][_0x6684('0x30')]));_0x4b757a['attributes']=_0x4b757a[_0x6684('0x2f')]['length']?_0x4b757a[_0x6684('0x2f')]:_0x4497fa['model'];if(!_0x4da832[_0x6684('0x2c')]['hasOwnProperty'](_0x6684('0x31'))){_0x4b757a[_0x6684('0x17')]=qs[_0x6684('0x17')](_0x4da832[_0x6684('0x2c')][_0x6684('0x17')]);_0x4b757a[_0x6684('0x1a')]=qs['offset'](_0x4da832[_0x6684('0x2c')]['offset']);}_0x4b757a[_0x6684('0x32')]=qs['sort'](_0x4da832[_0x6684('0x2c')][_0x6684('0x33')]);_0x4b757a[_0x6684('0x34')]=qs['filters'](_[_0x6684('0x35')](_0x4da832['query'],_0x4497fa[_0x6684('0x2d')]),_0x371ce6);if(_0x4da832[_0x6684('0x2c')]['filter']){_0x4b757a[_0x6684('0x34')]=_['merge'](_0x4b757a[_0x6684('0x34')],{'$or':_['map'](_0x371ce6,function(_0x4ce4c8){if(_0x4ce4c8[_0x6684('0x29')]!==_0x6684('0x36')){var _0x10344b={};_0x10344b[_0x4ce4c8['name']]={'$like':'%'+_0x4da832[_0x6684('0x2c')]['filter']+'%'};return _0x10344b;}})});}_0x4b757a=_[_0x6684('0x37')]({},_0x4b757a,_0x4da832[_0x6684('0x38')]);var _0x13e5c8={'where':_0x4b757a[_0x6684('0x34')]};return db[_0x6684('0x39')][_0x6684('0x19')](_0x13e5c8)[_0x6684('0x20')](function(_0x224061){_0x27268d[_0x6684('0x19')]=_0x224061;if(_0x4da832[_0x6684('0x2c')]['includeAll']){_0x4b757a[_0x6684('0x3a')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x6684('0x3b')](_0x4b757a);})[_0x6684('0x20')](function(_0xfd1a74){_0x27268d[_0x6684('0x3c')]=_0xfd1a74;return _0x27268d;})['then'](respondWithFilteredResult(_0x1056da,_0x4b757a))[_0x6684('0x3d')](handleError(_0x1056da,null));};exports['show']=function(_0x4ade38,_0x56597a){var _0x42d145={'raw':![],'where':{'id':_0x4ade38['params']['id']}},_0x54f02b={};_0x54f02b['model']=_[_0x6684('0x3e')](db[_0x6684('0x39')][_0x6684('0x28')]);_0x54f02b['query']=_['keys'](_0x4ade38['query']);_0x54f02b[_0x6684('0x2d')]=_[_0x6684('0x2e')](_0x54f02b[_0x6684('0x2b')],_0x54f02b[_0x6684('0x2c')]);_0x42d145[_0x6684('0x2f')]=_[_0x6684('0x2e')](_0x54f02b[_0x6684('0x2b')],qs['fields'](_0x4ade38[_0x6684('0x2c')][_0x6684('0x30')]));_0x42d145['attributes']=_0x42d145[_0x6684('0x2f')][_0x6684('0x3f')]?_0x42d145[_0x6684('0x2f')]:_0x54f02b['model'];if(_0x4ade38['query']['includeAll']){_0x42d145[_0x6684('0x3a')]=[{'all':!![]}];}_0x42d145=_[_0x6684('0x37')]({},_0x42d145,_0x4ade38['options']);return db['Dynamics365Configuration'][_0x6684('0x40')](_0x42d145)[_0x6684('0x20')](handleEntityNotFound(_0x56597a,null))[_0x6684('0x20')](respondWithResult(_0x56597a,null))['catch'](handleError(_0x56597a,null));};exports[_0x6684('0x41')]=function(_0x406b99,_0xc27afb){return db[_0x6684('0x39')][_0x6684('0x41')](_0x406b99[_0x6684('0x42')],{})['then'](respondWithResult(_0xc27afb,0xc9))[_0x6684('0x3d')](handleError(_0xc27afb,null));};exports[_0x6684('0x1f')]=function(_0x296114,_0x3ee65b){if(_0x296114['body']['id']){delete _0x296114[_0x6684('0x42')]['id'];}return db['Dynamics365Configuration'][_0x6684('0x40')]({'where':{'id':_0x296114['params']['id']}})[_0x6684('0x20')](handleEntityNotFound(_0x3ee65b,null))[_0x6684('0x20')](saveUpdates(_0x296114[_0x6684('0x42')],null))[_0x6684('0x20')](respondWithResult(_0x3ee65b,null))['catch'](handleError(_0x3ee65b,null));};exports['destroy']=function(_0x1fcfb9,_0x132e55){return db[_0x6684('0x39')][_0x6684('0x40')]({'where':{'id':_0x1fcfb9[_0x6684('0x43')]['id']}})[_0x6684('0x20')](handleEntityNotFound(_0x132e55,null))[_0x6684('0x20')](removeEntity(_0x132e55,null))[_0x6684('0x3d')](handleError(_0x132e55,null));};exports[_0x6684('0x44')]=function(_0x5add44,_0x55633b,_0x5716de){var _0x24ac7b={};var _0x55ddfd={};var _0x5f23f9;var _0x1c28f9;return db[_0x6684('0x39')][_0x6684('0x45')]({'where':{'id':_0x5add44[_0x6684('0x43')]['id']}})[_0x6684('0x20')](handleEntityNotFound(_0x55633b,null))[_0x6684('0x20')](function(_0x1c5c95){if(_0x1c5c95){_0x5f23f9=_0x1c5c95;_0x55ddfd[_0x6684('0x2b')]=_['keys'](db[_0x6684('0x46')][_0x6684('0x28')]);_0x55ddfd['query']=_[_0x6684('0x3e')](_0x5add44['query']);_0x55ddfd[_0x6684('0x2d')]=_['intersection'](_0x55ddfd['model'],_0x55ddfd[_0x6684('0x2c')]);_0x24ac7b[_0x6684('0x2f')]=_[_0x6684('0x2e')](_0x55ddfd[_0x6684('0x2b')],qs['fields'](_0x5add44[_0x6684('0x2c')][_0x6684('0x30')]));_0x24ac7b[_0x6684('0x2f')]=_0x24ac7b[_0x6684('0x2f')][_0x6684('0x3f')]?_0x24ac7b[_0x6684('0x2f')]:_0x55ddfd['model'];_0x24ac7b[_0x6684('0x32')]=qs[_0x6684('0x33')](_0x5add44[_0x6684('0x2c')][_0x6684('0x33')]);_0x24ac7b[_0x6684('0x34')]=qs[_0x6684('0x2d')](_[_0x6684('0x35')](_0x5add44[_0x6684('0x2c')],_0x55ddfd[_0x6684('0x2d')]));if(_0x5add44['query'][_0x6684('0x47')]){_0x24ac7b['where']=_[_0x6684('0x37')](_0x24ac7b[_0x6684('0x34')],{'$or':_[_0x6684('0x27')](_0x24ac7b[_0x6684('0x2f')],function(_0x124fc5){var _0x41bab1={};_0x41bab1[_0x124fc5]={'$like':'%'+_0x5add44[_0x6684('0x2c')][_0x6684('0x47')]+'%'};return _0x41bab1;})});}_0x24ac7b=_[_0x6684('0x37')]({},_0x24ac7b,_0x5add44[_0x6684('0x38')]);return _0x5f23f9['getFields'](_0x24ac7b);}})[_0x6684('0x20')](function(_0x475b71){if(_0x475b71){_0x1c28f9=_0x475b71[_0x6684('0x3f')];if(!_0x5add44['query'][_0x6684('0x48')](_0x6684('0x31'))){_0x24ac7b['limit']=qs[_0x6684('0x17')](_0x5add44['query'][_0x6684('0x17')]);_0x24ac7b[_0x6684('0x1a')]=qs[_0x6684('0x1a')](_0x5add44[_0x6684('0x2c')][_0x6684('0x1a')]);}return _0x5f23f9[_0x6684('0x44')](_0x24ac7b);}})[_0x6684('0x20')](function(_0x1ac243){if(_0x1ac243){return _0x1ac243?{'count':_0x1c28f9,'rows':_0x1ac243}:null;}})[_0x6684('0x20')](respondWithResult(_0x55633b,null))[_0x6684('0x3d')](handleError(_0x55633b,null));};exports[_0x6684('0x49')]=function(_0x52a281,_0x49bdfe,_0x1388aa){var _0x576847={};var _0x8aa304={};var _0x392444;var _0x5934f6;return db[_0x6684('0x39')][_0x6684('0x45')]({'where':{'id':_0x52a281[_0x6684('0x43')]['id']}})[_0x6684('0x20')](handleEntityNotFound(_0x49bdfe,null))[_0x6684('0x20')](function(_0x31bf42){if(_0x31bf42){_0x392444=_0x31bf42;_0x8aa304[_0x6684('0x2b')]=_[_0x6684('0x3e')](db[_0x6684('0x46')][_0x6684('0x28')]);_0x8aa304[_0x6684('0x2c')]=_[_0x6684('0x3e')](_0x52a281[_0x6684('0x2c')]);_0x8aa304[_0x6684('0x2d')]=_[_0x6684('0x2e')](_0x8aa304[_0x6684('0x2b')],_0x8aa304[_0x6684('0x2c')]);_0x576847[_0x6684('0x2f')]=_[_0x6684('0x2e')](_0x8aa304[_0x6684('0x2b')],qs[_0x6684('0x30')](_0x52a281[_0x6684('0x2c')]['fields']));_0x576847['attributes']=_0x576847[_0x6684('0x2f')][_0x6684('0x3f')]?_0x576847[_0x6684('0x2f')]:_0x8aa304[_0x6684('0x2b')];_0x576847['order']=qs['sort'](_0x52a281[_0x6684('0x2c')][_0x6684('0x33')]);_0x576847[_0x6684('0x34')]=qs['filters'](_['pick'](_0x52a281[_0x6684('0x2c')],_0x8aa304['filters']));if(_0x52a281['query'][_0x6684('0x47')]){_0x576847[_0x6684('0x34')]=_[_0x6684('0x37')](_0x576847[_0x6684('0x34')],{'$or':_['map'](_0x576847[_0x6684('0x2f')],function(_0x6dd6fd){var _0x1b1080={};_0x1b1080[_0x6dd6fd]={'$like':'%'+_0x52a281['query']['filter']+'%'};return _0x1b1080;})});}_0x576847=_[_0x6684('0x37')]({},_0x576847,_0x52a281[_0x6684('0x38')]);return _0x392444[_0x6684('0x49')](_0x576847);}})[_0x6684('0x20')](function(_0x77dcb0){if(_0x77dcb0){_0x5934f6=_0x77dcb0[_0x6684('0x3f')];if(!_0x52a281['query'][_0x6684('0x48')]('nolimit')){_0x576847[_0x6684('0x17')]=qs[_0x6684('0x17')](_0x52a281[_0x6684('0x2c')][_0x6684('0x17')]);_0x576847['offset']=qs[_0x6684('0x1a')](_0x52a281[_0x6684('0x2c')][_0x6684('0x1a')]);}return _0x392444[_0x6684('0x49')](_0x576847);}})[_0x6684('0x20')](function(_0x1ec325){if(_0x1ec325){return _0x1ec325?{'count':_0x5934f6,'rows':_0x1ec325}:null;}})['then'](respondWithResult(_0x49bdfe,null))['catch'](handleError(_0x49bdfe,null));};exports['getDescriptions']=function(_0x1cfa5e,_0x1f0ecf,_0x14cca2){var _0x5fb4bd={};var _0x2be291={};var _0x78e6cd;var _0x330454;return db['Dynamics365Configuration'][_0x6684('0x45')]({'where':{'id':_0x1cfa5e[_0x6684('0x43')]['id']}})[_0x6684('0x20')](handleEntityNotFound(_0x1f0ecf,null))[_0x6684('0x20')](function(_0x124a3a){if(_0x124a3a){_0x78e6cd=_0x124a3a;_0x2be291[_0x6684('0x2b')]=_['keys'](db[_0x6684('0x46')][_0x6684('0x28')]);_0x2be291[_0x6684('0x2c')]=_[_0x6684('0x3e')](_0x1cfa5e[_0x6684('0x2c')]);_0x2be291[_0x6684('0x2d')]=_[_0x6684('0x2e')](_0x2be291[_0x6684('0x2b')],_0x2be291[_0x6684('0x2c')]);_0x5fb4bd['attributes']=_[_0x6684('0x2e')](_0x2be291[_0x6684('0x2b')],qs['fields'](_0x1cfa5e[_0x6684('0x2c')][_0x6684('0x30')]));_0x5fb4bd[_0x6684('0x2f')]=_0x5fb4bd[_0x6684('0x2f')]['length']?_0x5fb4bd[_0x6684('0x2f')]:_0x2be291[_0x6684('0x2b')];_0x5fb4bd['order']=qs[_0x6684('0x33')](_0x1cfa5e[_0x6684('0x2c')][_0x6684('0x33')]);_0x5fb4bd['where']=qs['filters'](_[_0x6684('0x35')](_0x1cfa5e[_0x6684('0x2c')],_0x2be291[_0x6684('0x2d')]));if(_0x1cfa5e[_0x6684('0x2c')][_0x6684('0x47')]){_0x5fb4bd[_0x6684('0x34')]=_[_0x6684('0x37')](_0x5fb4bd[_0x6684('0x34')],{'$or':_['map'](_0x5fb4bd[_0x6684('0x2f')],function(_0x31aa24){var _0x50145e={};_0x50145e[_0x31aa24]={'$like':'%'+_0x1cfa5e[_0x6684('0x2c')][_0x6684('0x47')]+'%'};return _0x50145e;})});}_0x5fb4bd=_[_0x6684('0x37')]({},_0x5fb4bd,_0x1cfa5e['options']);return _0x78e6cd[_0x6684('0x4a')](_0x5fb4bd);}})['then'](function(_0x47d5c3){if(_0x47d5c3){_0x330454=_0x47d5c3[_0x6684('0x3f')];if(!_0x1cfa5e['query']['hasOwnProperty'](_0x6684('0x31'))){_0x5fb4bd[_0x6684('0x17')]=qs[_0x6684('0x17')](_0x1cfa5e['query'][_0x6684('0x17')]);_0x5fb4bd['offset']=qs[_0x6684('0x1a')](_0x1cfa5e[_0x6684('0x2c')][_0x6684('0x1a')]);}return _0x78e6cd[_0x6684('0x4a')](_0x5fb4bd);}})['then'](function(_0x146307){if(_0x146307){return _0x146307?{'count':_0x330454,'rows':_0x146307}:null;}})['then'](respondWithResult(_0x1f0ecf,null))[_0x6684('0x3d')](handleError(_0x1f0ecf,null));}; \ No newline at end of file +var _0x2b6b=['pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','getFields','findOne','getSubjects','hasOwnProperty','getDescriptions','Dynamics365Field','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','destroy','then','error','name','send','map','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x13f178,_0x16fa74){var _0x4d031f=function(_0x396adf){while(--_0x396adf){_0x13f178['push'](_0x13f178['shift']());}};_0x4d031f(++_0x16fa74);}(_0x2b6b,0xa8));var _0xb2b6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2b6b[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2b6('0x0'));var zipdir=require(_0xb2b6('0x1'));var jsonpatch=require(_0xb2b6('0x2'));var rp=require(_0xb2b6('0x3'));var moment=require(_0xb2b6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb2b6('0x5'));var path=require(_0xb2b6('0x6'));var sox=require('sox');var csv=require(_0xb2b6('0x7'));var ejs=require(_0xb2b6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2b6('0x9'));var squel=require('squel');var crypto=require(_0xb2b6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb2b6('0xb'));var Papa=require('papaparse');var Redis=require(_0xb2b6('0xc'));var authService=require(_0xb2b6('0xd'));var qs=require(_0xb2b6('0xe'));var as=require(_0xb2b6('0xf'));var hardwareService=require(_0xb2b6('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xb2b6('0x11'));var config=require(_0xb2b6('0x12'));var licenseUtil=require(_0xb2b6('0x13'));var db=require(_0xb2b6('0x14'))['db'];function respondWithStatusCode(_0x5bb63f,_0x6b91a0){_0x6b91a0=_0x6b91a0||0xcc;return function(_0x104271){if(_0x104271){return _0x5bb63f[_0xb2b6('0x15')](_0x6b91a0);}return _0x5bb63f[_0xb2b6('0x16')](_0x6b91a0)[_0xb2b6('0x17')]();};}function respondWithResult(_0xc5c03,_0x347448){_0x347448=_0x347448||0xc8;return function(_0x131a26){if(_0x131a26){return _0xc5c03[_0xb2b6('0x16')](_0x347448)[_0xb2b6('0x18')](_0x131a26);}};}function respondWithFilteredResult(_0x572094,_0x5a6fca){return function(_0x366ea0){if(_0x366ea0){var _0x308c49=typeof _0x5a6fca[_0xb2b6('0x19')]===_0xb2b6('0x1a')&&typeof _0x5a6fca['limit']==='undefined';var _0x45e7eb=_0x366ea0[_0xb2b6('0x1b')];var _0x105072=_0x308c49?0x0:_0x5a6fca['offset'];var _0xd7d17a=_0x308c49?_0x366ea0[_0xb2b6('0x1b')]:_0x5a6fca[_0xb2b6('0x19')]+_0x5a6fca[_0xb2b6('0x1c')];var _0x18436a;if(_0xd7d17a>=_0x45e7eb){_0xd7d17a=_0x45e7eb;_0x18436a=0xc8;}else{_0x18436a=0xce;}_0x572094[_0xb2b6('0x16')](_0x18436a);return _0x572094['set'](_0xb2b6('0x1d'),_0x105072+'-'+_0xd7d17a+'/'+_0x45e7eb)[_0xb2b6('0x18')](_0x366ea0);}return null;};}function patchUpdates(_0x2ac301){return function(_0x3b0654){try{jsonpatch['apply'](_0x3b0654,_0x2ac301,!![]);}catch(_0x553377){return BPromise[_0xb2b6('0x1e')](_0x553377);}return _0x3b0654[_0xb2b6('0x1f')]();};}function saveUpdates(_0xd1764,_0x24c132){return function(_0x4f056d){if(_0x4f056d){return _0x4f056d['update'](_0xd1764)['then'](function(_0xdb9a2e){return _0xdb9a2e;});}return null;};}function removeEntity(_0x3062e4,_0x1ca5a0){return function(_0x53f7d9){if(_0x53f7d9){return _0x53f7d9[_0xb2b6('0x20')]()[_0xb2b6('0x21')](function(){_0x3062e4['status'](0xcc)[_0xb2b6('0x17')]();});}};}function handleEntityNotFound(_0x1ce7af,_0x2076d4){return function(_0x42afb9){if(!_0x42afb9){_0x1ce7af[_0xb2b6('0x15')](0x194);}return _0x42afb9;};}function handleError(_0x22ca5a,_0x644f55){_0x644f55=_0x644f55||0x1f4;return function(_0x273b59){logger[_0xb2b6('0x22')](_0x273b59['stack']);if(_0x273b59[_0xb2b6('0x23')]){delete _0x273b59[_0xb2b6('0x23')];}_0x22ca5a[_0xb2b6('0x16')](_0x644f55)[_0xb2b6('0x24')](_0x273b59);};}exports['index']=function(_0x4d4110,_0x2fcbf0){var _0x4b488d={},_0x175a06={},_0x4a820a={'count':0x0,'rows':[]};var _0x4bc43f=_[_0xb2b6('0x25')](db[_0xb2b6('0x26')][_0xb2b6('0x27')],function(_0x2b35e1){return{'name':_0x2b35e1['fieldName'],'type':_0x2b35e1[_0xb2b6('0x28')][_0xb2b6('0x29')]};});_0x175a06[_0xb2b6('0x2a')]=_['map'](_0x4bc43f,_0xb2b6('0x23'));_0x175a06[_0xb2b6('0x2b')]=_[_0xb2b6('0x2c')](_0x4d4110[_0xb2b6('0x2b')]);_0x175a06[_0xb2b6('0x2d')]=_[_0xb2b6('0x2e')](_0x175a06['model'],_0x175a06[_0xb2b6('0x2b')]);_0x4b488d[_0xb2b6('0x2f')]=_[_0xb2b6('0x2e')](_0x175a06[_0xb2b6('0x2a')],qs['fields'](_0x4d4110[_0xb2b6('0x2b')][_0xb2b6('0x30')]));_0x4b488d['attributes']=_0x4b488d[_0xb2b6('0x2f')][_0xb2b6('0x31')]?_0x4b488d['attributes']:_0x175a06[_0xb2b6('0x2a')];if(!_0x4d4110[_0xb2b6('0x2b')]['hasOwnProperty'](_0xb2b6('0x32'))){_0x4b488d[_0xb2b6('0x1c')]=qs[_0xb2b6('0x1c')](_0x4d4110[_0xb2b6('0x2b')]['limit']);_0x4b488d[_0xb2b6('0x19')]=qs[_0xb2b6('0x19')](_0x4d4110[_0xb2b6('0x2b')]['offset']);}_0x4b488d[_0xb2b6('0x33')]=qs[_0xb2b6('0x34')](_0x4d4110[_0xb2b6('0x2b')][_0xb2b6('0x34')]);_0x4b488d[_0xb2b6('0x35')]=qs['filters'](_[_0xb2b6('0x36')](_0x4d4110[_0xb2b6('0x2b')],_0x175a06[_0xb2b6('0x2d')]),_0x4bc43f);if(_0x4d4110[_0xb2b6('0x2b')][_0xb2b6('0x37')]){_0x4b488d['where']=_[_0xb2b6('0x38')](_0x4b488d[_0xb2b6('0x35')],{'$or':_[_0xb2b6('0x25')](_0x4bc43f,function(_0x139343){if(_0x139343[_0xb2b6('0x28')]!=='VIRTUAL'){var _0x56f1ad={};_0x56f1ad[_0x139343[_0xb2b6('0x23')]]={'$like':'%'+_0x4d4110[_0xb2b6('0x2b')][_0xb2b6('0x37')]+'%'};return _0x56f1ad;}})});}_0x4b488d=_[_0xb2b6('0x38')]({},_0x4b488d,_0x4d4110['options']);var _0xb6f3b8={'where':_0x4b488d[_0xb2b6('0x35')]};return db[_0xb2b6('0x26')][_0xb2b6('0x1b')](_0xb6f3b8)[_0xb2b6('0x21')](function(_0x10d809){_0x4a820a[_0xb2b6('0x1b')]=_0x10d809;if(_0x4d4110['query'][_0xb2b6('0x39')]){_0x4b488d[_0xb2b6('0x3a')]=[{'all':!![]}];}return db[_0xb2b6('0x26')][_0xb2b6('0x3b')](_0x4b488d);})[_0xb2b6('0x21')](function(_0x1c25d8){_0x4a820a[_0xb2b6('0x3c')]=_0x1c25d8;return _0x4a820a;})[_0xb2b6('0x21')](respondWithFilteredResult(_0x2fcbf0,_0x4b488d))['catch'](handleError(_0x2fcbf0,null));};exports[_0xb2b6('0x3d')]=function(_0x123eb3,_0x1cdcf3){var _0x3ffa11={'raw':![],'where':{'id':_0x123eb3[_0xb2b6('0x3e')]['id']}},_0x524264={};_0x524264[_0xb2b6('0x2a')]=_[_0xb2b6('0x2c')](db[_0xb2b6('0x26')][_0xb2b6('0x27')]);_0x524264[_0xb2b6('0x2b')]=_[_0xb2b6('0x2c')](_0x123eb3[_0xb2b6('0x2b')]);_0x524264[_0xb2b6('0x2d')]=_[_0xb2b6('0x2e')](_0x524264[_0xb2b6('0x2a')],_0x524264[_0xb2b6('0x2b')]);_0x3ffa11[_0xb2b6('0x2f')]=_['intersection'](_0x524264[_0xb2b6('0x2a')],qs[_0xb2b6('0x30')](_0x123eb3[_0xb2b6('0x2b')][_0xb2b6('0x30')]));_0x3ffa11['attributes']=_0x3ffa11[_0xb2b6('0x2f')]['length']?_0x3ffa11[_0xb2b6('0x2f')]:_0x524264[_0xb2b6('0x2a')];if(_0x123eb3[_0xb2b6('0x2b')]['includeAll']){_0x3ffa11[_0xb2b6('0x3a')]=[{'all':!![]}];}_0x3ffa11=_[_0xb2b6('0x38')]({},_0x3ffa11,_0x123eb3[_0xb2b6('0x3f')]);return db[_0xb2b6('0x26')][_0xb2b6('0x40')](_0x3ffa11)['then'](handleEntityNotFound(_0x1cdcf3,null))[_0xb2b6('0x21')](respondWithResult(_0x1cdcf3,null))[_0xb2b6('0x41')](handleError(_0x1cdcf3,null));};exports[_0xb2b6('0x42')]=function(_0x4dd79e,_0x24b5d6){return db['Dynamics365Configuration'][_0xb2b6('0x42')](_0x4dd79e[_0xb2b6('0x43')],{})[_0xb2b6('0x21')](respondWithResult(_0x24b5d6,0xc9))[_0xb2b6('0x41')](handleError(_0x24b5d6,null));};exports['update']=function(_0x2ca25d,_0x3b5418){if(_0x2ca25d[_0xb2b6('0x43')]['id']){delete _0x2ca25d[_0xb2b6('0x43')]['id'];}return db[_0xb2b6('0x26')]['find']({'where':{'id':_0x2ca25d[_0xb2b6('0x3e')]['id']}})[_0xb2b6('0x21')](handleEntityNotFound(_0x3b5418,null))[_0xb2b6('0x21')](saveUpdates(_0x2ca25d[_0xb2b6('0x43')],null))[_0xb2b6('0x21')](respondWithResult(_0x3b5418,null))[_0xb2b6('0x41')](handleError(_0x3b5418,null));};exports[_0xb2b6('0x20')]=function(_0x3a42a9,_0x5d9412){return db[_0xb2b6('0x26')][_0xb2b6('0x40')]({'where':{'id':_0x3a42a9['params']['id']}})[_0xb2b6('0x21')](handleEntityNotFound(_0x5d9412,null))['then'](removeEntity(_0x5d9412,null))[_0xb2b6('0x41')](handleError(_0x5d9412,null));};exports[_0xb2b6('0x44')]=function(_0x4eacf4,_0xfc55d6,_0x2886ac){var _0x480011={};var _0x12d5a9={};var _0x2db4f0;var _0x5363c5;return db[_0xb2b6('0x26')][_0xb2b6('0x45')]({'where':{'id':_0x4eacf4[_0xb2b6('0x3e')]['id']}})[_0xb2b6('0x21')](handleEntityNotFound(_0xfc55d6,null))[_0xb2b6('0x21')](function(_0x3f2517){if(_0x3f2517){_0x2db4f0=_0x3f2517;_0x12d5a9[_0xb2b6('0x2a')]=_[_0xb2b6('0x2c')](db['Dynamics365Field'][_0xb2b6('0x27')]);_0x12d5a9[_0xb2b6('0x2b')]=_[_0xb2b6('0x2c')](_0x4eacf4[_0xb2b6('0x2b')]);_0x12d5a9[_0xb2b6('0x2d')]=_['intersection'](_0x12d5a9[_0xb2b6('0x2a')],_0x12d5a9[_0xb2b6('0x2b')]);_0x480011[_0xb2b6('0x2f')]=_[_0xb2b6('0x2e')](_0x12d5a9['model'],qs[_0xb2b6('0x30')](_0x4eacf4[_0xb2b6('0x2b')][_0xb2b6('0x30')]));_0x480011['attributes']=_0x480011['attributes'][_0xb2b6('0x31')]?_0x480011[_0xb2b6('0x2f')]:_0x12d5a9[_0xb2b6('0x2a')];_0x480011[_0xb2b6('0x33')]=qs[_0xb2b6('0x34')](_0x4eacf4['query'][_0xb2b6('0x34')]);_0x480011[_0xb2b6('0x35')]=qs['filters'](_['pick'](_0x4eacf4['query'],_0x12d5a9[_0xb2b6('0x2d')]));if(_0x4eacf4[_0xb2b6('0x2b')][_0xb2b6('0x37')]){_0x480011[_0xb2b6('0x35')]=_[_0xb2b6('0x38')](_0x480011[_0xb2b6('0x35')],{'$or':_[_0xb2b6('0x25')](_0x480011['attributes'],function(_0x495e2f){var _0x4bacc3={};_0x4bacc3[_0x495e2f]={'$like':'%'+_0x4eacf4[_0xb2b6('0x2b')][_0xb2b6('0x37')]+'%'};return _0x4bacc3;})});}_0x480011=_['merge']({},_0x480011,_0x4eacf4[_0xb2b6('0x3f')]);return _0x2db4f0[_0xb2b6('0x44')](_0x480011);}})[_0xb2b6('0x21')](function(_0x430647){if(_0x430647){_0x5363c5=_0x430647[_0xb2b6('0x31')];if(!_0x4eacf4['query']['hasOwnProperty'](_0xb2b6('0x32'))){_0x480011[_0xb2b6('0x1c')]=qs[_0xb2b6('0x1c')](_0x4eacf4[_0xb2b6('0x2b')]['limit']);_0x480011[_0xb2b6('0x19')]=qs[_0xb2b6('0x19')](_0x4eacf4[_0xb2b6('0x2b')][_0xb2b6('0x19')]);}return _0x2db4f0[_0xb2b6('0x44')](_0x480011);}})['then'](function(_0x4cf3ad){if(_0x4cf3ad){return _0x4cf3ad?{'count':_0x5363c5,'rows':_0x4cf3ad}:null;}})[_0xb2b6('0x21')](respondWithResult(_0xfc55d6,null))[_0xb2b6('0x41')](handleError(_0xfc55d6,null));};exports['getSubjects']=function(_0x20410c,_0x1a1cb2,_0x1a860e){var _0x2f6106={};var _0x35cd98={};var _0x4fa1a8;var _0x23653d;return db[_0xb2b6('0x26')][_0xb2b6('0x45')]({'where':{'id':_0x20410c[_0xb2b6('0x3e')]['id']}})[_0xb2b6('0x21')](handleEntityNotFound(_0x1a1cb2,null))[_0xb2b6('0x21')](function(_0x21621f){if(_0x21621f){_0x4fa1a8=_0x21621f;_0x35cd98[_0xb2b6('0x2a')]=_['keys'](db['Dynamics365Field'][_0xb2b6('0x27')]);_0x35cd98[_0xb2b6('0x2b')]=_[_0xb2b6('0x2c')](_0x20410c['query']);_0x35cd98[_0xb2b6('0x2d')]=_[_0xb2b6('0x2e')](_0x35cd98[_0xb2b6('0x2a')],_0x35cd98[_0xb2b6('0x2b')]);_0x2f6106['attributes']=_[_0xb2b6('0x2e')](_0x35cd98['model'],qs['fields'](_0x20410c[_0xb2b6('0x2b')][_0xb2b6('0x30')]));_0x2f6106[_0xb2b6('0x2f')]=_0x2f6106[_0xb2b6('0x2f')][_0xb2b6('0x31')]?_0x2f6106[_0xb2b6('0x2f')]:_0x35cd98[_0xb2b6('0x2a')];_0x2f6106[_0xb2b6('0x33')]=qs[_0xb2b6('0x34')](_0x20410c[_0xb2b6('0x2b')][_0xb2b6('0x34')]);_0x2f6106[_0xb2b6('0x35')]=qs[_0xb2b6('0x2d')](_[_0xb2b6('0x36')](_0x20410c[_0xb2b6('0x2b')],_0x35cd98[_0xb2b6('0x2d')]));if(_0x20410c[_0xb2b6('0x2b')][_0xb2b6('0x37')]){_0x2f6106['where']=_[_0xb2b6('0x38')](_0x2f6106[_0xb2b6('0x35')],{'$or':_['map'](_0x2f6106[_0xb2b6('0x2f')],function(_0x107738){var _0x2a50f4={};_0x2a50f4[_0x107738]={'$like':'%'+_0x20410c['query']['filter']+'%'};return _0x2a50f4;})});}_0x2f6106=_[_0xb2b6('0x38')]({},_0x2f6106,_0x20410c[_0xb2b6('0x3f')]);return _0x4fa1a8[_0xb2b6('0x46')](_0x2f6106);}})[_0xb2b6('0x21')](function(_0x20684e){if(_0x20684e){_0x23653d=_0x20684e['length'];if(!_0x20410c[_0xb2b6('0x2b')][_0xb2b6('0x47')](_0xb2b6('0x32'))){_0x2f6106[_0xb2b6('0x1c')]=qs['limit'](_0x20410c[_0xb2b6('0x2b')][_0xb2b6('0x1c')]);_0x2f6106[_0xb2b6('0x19')]=qs[_0xb2b6('0x19')](_0x20410c['query'][_0xb2b6('0x19')]);}return _0x4fa1a8[_0xb2b6('0x46')](_0x2f6106);}})[_0xb2b6('0x21')](function(_0x430e7e){if(_0x430e7e){return _0x430e7e?{'count':_0x23653d,'rows':_0x430e7e}:null;}})['then'](respondWithResult(_0x1a1cb2,null))[_0xb2b6('0x41')](handleError(_0x1a1cb2,null));};exports[_0xb2b6('0x48')]=function(_0x24ac1d,_0x76c388,_0x238063){var _0x3fcf53={};var _0x5be5cd={};var _0x27108d;var _0x4fe952;return db[_0xb2b6('0x26')][_0xb2b6('0x45')]({'where':{'id':_0x24ac1d['params']['id']}})['then'](handleEntityNotFound(_0x76c388,null))['then'](function(_0x42eb4a){if(_0x42eb4a){_0x27108d=_0x42eb4a;_0x5be5cd['model']=_[_0xb2b6('0x2c')](db[_0xb2b6('0x49')][_0xb2b6('0x27')]);_0x5be5cd[_0xb2b6('0x2b')]=_[_0xb2b6('0x2c')](_0x24ac1d[_0xb2b6('0x2b')]);_0x5be5cd['filters']=_[_0xb2b6('0x2e')](_0x5be5cd[_0xb2b6('0x2a')],_0x5be5cd['query']);_0x3fcf53[_0xb2b6('0x2f')]=_[_0xb2b6('0x2e')](_0x5be5cd[_0xb2b6('0x2a')],qs['fields'](_0x24ac1d[_0xb2b6('0x2b')][_0xb2b6('0x30')]));_0x3fcf53['attributes']=_0x3fcf53['attributes']['length']?_0x3fcf53[_0xb2b6('0x2f')]:_0x5be5cd[_0xb2b6('0x2a')];_0x3fcf53[_0xb2b6('0x33')]=qs[_0xb2b6('0x34')](_0x24ac1d[_0xb2b6('0x2b')][_0xb2b6('0x34')]);_0x3fcf53['where']=qs[_0xb2b6('0x2d')](_['pick'](_0x24ac1d['query'],_0x5be5cd[_0xb2b6('0x2d')]));if(_0x24ac1d[_0xb2b6('0x2b')]['filter']){_0x3fcf53[_0xb2b6('0x35')]=_[_0xb2b6('0x38')](_0x3fcf53[_0xb2b6('0x35')],{'$or':_['map'](_0x3fcf53[_0xb2b6('0x2f')],function(_0x2792a6){var _0x40022f={};_0x40022f[_0x2792a6]={'$like':'%'+_0x24ac1d[_0xb2b6('0x2b')][_0xb2b6('0x37')]+'%'};return _0x40022f;})});}_0x3fcf53=_[_0xb2b6('0x38')]({},_0x3fcf53,_0x24ac1d['options']);return _0x27108d[_0xb2b6('0x48')](_0x3fcf53);}})[_0xb2b6('0x21')](function(_0x4646dd){if(_0x4646dd){_0x4fe952=_0x4646dd[_0xb2b6('0x31')];if(!_0x24ac1d['query'][_0xb2b6('0x47')](_0xb2b6('0x32'))){_0x3fcf53['limit']=qs[_0xb2b6('0x1c')](_0x24ac1d['query'][_0xb2b6('0x1c')]);_0x3fcf53[_0xb2b6('0x19')]=qs[_0xb2b6('0x19')](_0x24ac1d['query'][_0xb2b6('0x19')]);}return _0x27108d[_0xb2b6('0x48')](_0x3fcf53);}})['then'](function(_0x364f22){if(_0x364f22){return _0x364f22?{'count':_0x4fe952,'rows':_0x364f22}:null;}})[_0xb2b6('0x21')](respondWithResult(_0x76c388,null))[_0xb2b6('0x41')](handleError(_0x76c388,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 69268f4..0bebffd 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 _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x2bb18c,_0x4413dd){var _0x299c02=function(_0x33cd37){while(--_0x33cd37){_0x2bb18c['push'](_0x2bb18c['shift']());}};_0x299c02(++_0x4413dd);}(_0xb43b,0x1b2));var _0xbb43=function(_0x541831,_0x4aa10e){_0x541831=_0x541831-0x0;var _0x3550fc=_0xb43b[_0x541831];return _0x3550fc;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x59538e,_0x2cd506){var _0x26dc13=function(_0x3f93ea){while(--_0x3f93ea){_0x59538e['push'](_0x59538e['shift']());}};_0x26dc13(++_0x2cd506);}(_0x9bde,0xe1));var _0xe9bd=function(_0x23be8c,_0x297557){_0x23be8c=_0x23be8c-0x0;var _0x404f2a=_0x9bde[_0x23be8c];return _0x404f2a;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'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 7b62a23..a7be3c4 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 _0x892d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x119f8d,_0x2e792f){var _0x10c3f8=function(_0x306ed6){while(--_0x306ed6){_0x119f8d['push'](_0x119f8d['shift']());}};_0x10c3f8(++_0x2e792f);}(_0x892d,0x14a));var _0xd892=function(_0x108b75,_0x38bab7){_0x108b75=_0x108b75-0x0;var _0x5f50c2=_0x892d[_0x108b75];return _0x5f50c2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd892('0x0'));var BPromise=require(_0xd892('0x1'));var rs=require(_0xd892('0x2'));var fs=require('fs');var Redis=require(_0xd892('0x3'));var db=require(_0xd892('0x4'))['db'];var utils=require(_0xd892('0x5'));var logger=require(_0xd892('0x6'))(_0xd892('0x7'));var config=require(_0xd892('0x8'));var jayson=require(_0xd892('0x9'));var client=jayson['client'][_0xd892('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x195caa,_0x62474e,_0x3b2885){return new BPromise(function(_0x4d7bc7,_0x471413){return client[_0xd892('0xb')](_0x195caa,_0x3b2885)['then'](function(_0x5bde0f){logger[_0xd892('0xc')](_0xd892('0xd'),_0x62474e,_0xd892('0xe'));logger['debug'](_0xd892('0xf'),_0x62474e,_0xd892('0xe'),JSON[_0xd892('0x10')](_0x5bde0f));if(_0x5bde0f[_0xd892('0x11')]){if(_0x5bde0f[_0xd892('0x11')]['code']===0x1f4){logger['error'](_0xd892('0xd'),_0x62474e,_0x5bde0f['error'][_0xd892('0x12')]);return _0x471413(_0x5bde0f[_0xd892('0x11')][_0xd892('0x12')]);}logger[_0xd892('0x11')](_0xd892('0xd'),_0x62474e,_0x5bde0f[_0xd892('0x11')][_0xd892('0x12')]);return _0x4d7bc7(_0x5bde0f[_0xd892('0x11')][_0xd892('0x12')]);}else{logger[_0xd892('0xc')](_0xd892('0xd'),_0x62474e,_0xd892('0xe'));_0x4d7bc7(_0x5bde0f[_0xd892('0x13')][_0xd892('0x12')]);}})[_0xd892('0x14')](function(_0x358001){logger[_0xd892('0x11')](_0xd892('0xd'),_0x62474e,_0x358001);_0x471413(_0x358001);});});} \ No newline at end of file +var _0x2564=['request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x1158ef,_0x41d1f5){var _0x3e9ac4=function(_0x37fe43){while(--_0x37fe43){_0x1158ef['push'](_0x1158ef['shift']());}};_0x3e9ac4(++_0x41d1f5);}(_0x2564,0xaf));var _0x4256=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2564[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4256('0x0'));var util=require(_0x4256('0x1'));var moment=require(_0x4256('0x2'));var BPromise=require('bluebird');var rs=require(_0x4256('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4256('0x4'))['db'];var utils=require(_0x4256('0x5'));var logger=require(_0x4256('0x6'))('rpc');var config=require(_0x4256('0x7'));var jayson=require(_0x4256('0x8'));var client=jayson['client'][_0x4256('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10c4cf,_0x59a9db,_0x2870c3){return new BPromise(function(_0x3027b2,_0x2677a0){return client[_0x4256('0xa')](_0x10c4cf,_0x2870c3)[_0x4256('0xb')](function(_0x2f5943){logger[_0x4256('0xc')](_0x4256('0xd'),_0x59a9db,_0x4256('0xe'));logger[_0x4256('0xf')](_0x4256('0x10'),_0x59a9db,_0x4256('0xe'),JSON['stringify'](_0x2f5943));if(_0x2f5943[_0x4256('0x11')]){if(_0x2f5943[_0x4256('0x11')][_0x4256('0x12')]===0x1f4){logger['error'](_0x4256('0xd'),_0x59a9db,_0x2f5943['error'][_0x4256('0x13')]);return _0x2677a0(_0x2f5943[_0x4256('0x11')][_0x4256('0x13')]);}logger[_0x4256('0x11')](_0x4256('0xd'),_0x59a9db,_0x2f5943[_0x4256('0x11')][_0x4256('0x13')]);return _0x3027b2(_0x2f5943['error'][_0x4256('0x13')]);}else{logger[_0x4256('0xc')](_0x4256('0xd'),_0x59a9db,'request\x20sent');_0x3027b2(_0x2f5943[_0x4256('0x14')]['message']);}})['catch'](function(_0xe8d293){logger['error'](_0x4256('0xd'),_0x59a9db,_0xe8d293);_0x2677a0(_0xe8d293);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 634a766..36a3641 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 _0xaced=['post','create','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','/:id'];(function(_0x3d024f,_0x551806){var _0xec6028=function(_0x14c9a1){while(--_0x14c9a1){_0x3d024f['push'](_0x3d024f['shift']());}};_0xec6028(++_0x551806);}(_0xaced,0xd6));var _0xdace=function(_0x4fad8f,_0x1b4193){_0x4fad8f=_0x4fad8f-0x0;var _0x47741f=_0xaced[_0x4fad8f];return _0x47741f;};'use strict';var multer=require('multer');var util=require(_0xdace('0x0'));var path=require(_0xdace('0x1'));var timeout=require(_0xdace('0x2'));var express=require('express');var router=express[_0xdace('0x3')]();var fs_extra=require(_0xdace('0x4'));var auth=require(_0xdace('0x5'));var interaction=require(_0xdace('0x6'));var config=require('../../config/environment');var controller=require(_0xdace('0x7'));router[_0xdace('0x8')]('/',auth[_0xdace('0x9')](),controller['index']);router[_0xdace('0x8')](_0xdace('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xdace('0xb')]('/',auth[_0xdace('0x9')](),controller[_0xdace('0xc')]);router['put'](_0xdace('0xa'),auth[_0xdace('0x9')](),controller['update']);router[_0xdace('0xd')]('/:id',auth[_0xdace('0x9')](),controller[_0xdace('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd932=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','update'];(function(_0x32f7f7,_0x5e930b){var _0x561636=function(_0x29ed41){while(--_0x29ed41){_0x32f7f7['push'](_0x32f7f7['shift']());}};_0x561636(++_0x5e930b);}(_0xd932,0xa1));var _0x2d93=function(_0x7dfb1a,_0xa98399){_0x7dfb1a=_0x7dfb1a-0x0;var _0x4d4fae=_0xd932[_0x7dfb1a];return _0x4d4fae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d93('0x0'));var timeout=require(_0x2d93('0x1'));var express=require(_0x2d93('0x2'));var router=express[_0x2d93('0x3')]();var fs_extra=require(_0x2d93('0x4'));var auth=require(_0x2d93('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2d93('0x6'));var controller=require(_0x2d93('0x7'));router[_0x2d93('0x8')]('/',auth['isAuthenticated'](),controller[_0x2d93('0x9')]);router[_0x2d93('0x8')](_0x2d93('0xa'),auth[_0x2d93('0xb')](),controller[_0x2d93('0xc')]);router[_0x2d93('0xd')]('/',auth[_0x2d93('0xb')](),controller['create']);router['put']('/:id',auth[_0x2d93('0xb')](),controller[_0x2d93('0xe')]);router['delete'](_0x2d93('0xa'),auth[_0x2d93('0xb')](),controller[_0x2d93('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2e2aee8..8485ae3 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 _0x3399=['BOOLEAN','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x375bfd,_0x7c9e97){var _0x5ae9af=function(_0x1b8e61){while(--_0x1b8e61){_0x375bfd['push'](_0x375bfd['shift']());}};_0x5ae9af(++_0x7c9e97);}(_0x3399,0x71));var _0x9339=function(_0x2783fd,_0xd18827){_0x2783fd=_0x2783fd-0x0;var _0x77dee6=_0x3399[_0x2783fd];return _0x77dee6;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9339('0x0')]('string',_0x9339('0x1'),_0x9339('0x2'),_0x9339('0x3'),'picklist'),'defaultValue':_0x9339('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9339('0x5')]},'keyType':{'type':Sequelize[_0x9339('0x0')](_0x9339('0x4'),'variable',_0x9339('0x2'))},'keyContent':{'type':Sequelize[_0x9339('0x5')]},'idField':{'type':Sequelize[_0x9339('0x5')]},'nameField':{'type':Sequelize[_0x9339('0x5')]},'customField':{'type':Sequelize[_0x9339('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9339('0x5')]}}; \ No newline at end of file +var _0x755a=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x755a,0x1a5));var _0xa755=function(_0x3aa470,_0xcfe512){_0x3aa470=_0x3aa470-0x0;var _0x3870fd=_0x755a[_0x3aa470];return _0x3870fd;};'use strict';var Sequelize=require(_0xa755('0x0'));module[_0xa755('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa755('0x2'),_0xa755('0x3'),_0xa755('0x4'),_0xa755('0x5'),_0xa755('0x6')),'defaultValue':_0xa755('0x2')},'content':{'type':Sequelize[_0xa755('0x7')]},'key':{'type':Sequelize[_0xa755('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xa755('0x2'),_0xa755('0x3'),_0xa755('0x4'))},'keyContent':{'type':Sequelize[_0xa755('0x7')]},'idField':{'type':Sequelize[_0xa755('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa755('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa755('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 136438f..bf72bc7 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 _0x5cba=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../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','error','stack','name','index','map','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','Dynamics365Field','then','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js'];(function(_0xcaf223,_0xd39f07){var _0x17e00d=function(_0xe2852e){while(--_0xe2852e){_0xcaf223['push'](_0xcaf223['shift']());}};_0x17e00d(++_0xd39f07);}(_0x5cba,0xc8));var _0xa5cb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5cba[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xa5cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5cb('0x1'));var jsonpatch=require(_0xa5cb('0x2'));var rp=require(_0xa5cb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa5cb('0x4'));var util=require(_0xa5cb('0x5'));var path=require(_0xa5cb('0x6'));var sox=require(_0xa5cb('0x7'));var csv=require(_0xa5cb('0x8'));var ejs=require(_0xa5cb('0x9'));var fs=require('fs');var fs_extra=require(_0xa5cb('0xa'));var _=require('lodash');var squel=require(_0xa5cb('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5cb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa5cb('0xd'));var Papa=require(_0xa5cb('0xe'));var Redis=require('ioredis');var authService=require(_0xa5cb('0xf'));var qs=require(_0xa5cb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5cb('0x11'));var logger=require(_0xa5cb('0x12'))(_0xa5cb('0x13'));var utils=require('../../config/utils');var config=require(_0xa5cb('0x14'));var licenseUtil=require(_0xa5cb('0x15'));var db=require(_0xa5cb('0x16'))['db'];function respondWithStatusCode(_0x26a6ff,_0x21dbd8){_0x21dbd8=_0x21dbd8||0xcc;return function(_0x30a95d){if(_0x30a95d){return _0x26a6ff[_0xa5cb('0x17')](_0x21dbd8);}return _0x26a6ff[_0xa5cb('0x18')](_0x21dbd8)[_0xa5cb('0x19')]();};}function respondWithResult(_0x213aa8,_0x3ae2b9){_0x3ae2b9=_0x3ae2b9||0xc8;return function(_0x4caf52){if(_0x4caf52){return _0x213aa8[_0xa5cb('0x18')](_0x3ae2b9)[_0xa5cb('0x1a')](_0x4caf52);}};}function respondWithFilteredResult(_0x202195,_0x26d6c7){return function(_0x3a61a3){if(_0x3a61a3){var _0xda4a7a=typeof _0x26d6c7[_0xa5cb('0x1b')]===_0xa5cb('0x1c')&&typeof _0x26d6c7[_0xa5cb('0x1d')]===_0xa5cb('0x1c');var _0x177652=_0x3a61a3[_0xa5cb('0x1e')];var _0x34bc7f=_0xda4a7a?0x0:_0x26d6c7[_0xa5cb('0x1b')];var _0x3725bc=_0xda4a7a?_0x3a61a3['count']:_0x26d6c7['offset']+_0x26d6c7[_0xa5cb('0x1d')];var _0x1ae470;if(_0x3725bc>=_0x177652){_0x3725bc=_0x177652;_0x1ae470=0xc8;}else{_0x1ae470=0xce;}_0x202195[_0xa5cb('0x18')](_0x1ae470);return _0x202195['set'](_0xa5cb('0x1f'),_0x34bc7f+'-'+_0x3725bc+'/'+_0x177652)[_0xa5cb('0x1a')](_0x3a61a3);}return null;};}function patchUpdates(_0xdf8b4a){return function(_0x21377c){try{jsonpatch[_0xa5cb('0x20')](_0x21377c,_0xdf8b4a,!![]);}catch(_0x1008ba){return BPromise[_0xa5cb('0x21')](_0x1008ba);}return _0x21377c['save']();};}function saveUpdates(_0x2d42af,_0x24834f){return function(_0x7dd43c){if(_0x7dd43c){return _0x7dd43c[_0xa5cb('0x22')](_0x2d42af)['then'](function(_0xb40a87){return _0xb40a87;});}return null;};}function removeEntity(_0x22cd59,_0x2153c0){return function(_0x13b7d6){if(_0x13b7d6){return _0x13b7d6['destroy']()['then'](function(){_0x22cd59[_0xa5cb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30ddb1,_0x2067e2){return function(_0xada32b){if(!_0xada32b){_0x30ddb1[_0xa5cb('0x17')](0x194);}return _0xada32b;};}function handleError(_0x3c7b2d,_0x3f59f3){_0x3f59f3=_0x3f59f3||0x1f4;return function(_0x5cf8b9){logger[_0xa5cb('0x23')](_0x5cf8b9[_0xa5cb('0x24')]);if(_0x5cf8b9[_0xa5cb('0x25')]){delete _0x5cf8b9['name'];}_0x3c7b2d[_0xa5cb('0x18')](_0x3f59f3)['send'](_0x5cf8b9);};}exports[_0xa5cb('0x26')]=function(_0x1b9f6f,_0x437b22){var _0xad972={},_0x3328ee={},_0x2d94f2={'count':0x0,'rows':[]};var _0xb42048=_[_0xa5cb('0x27')](db['Dynamics365Field'][_0xa5cb('0x28')],function(_0x476a70){return{'name':_0x476a70['fieldName'],'type':_0x476a70[_0xa5cb('0x29')][_0xa5cb('0x2a')]};});_0x3328ee[_0xa5cb('0x2b')]=_[_0xa5cb('0x27')](_0xb42048,_0xa5cb('0x25'));_0x3328ee['query']=_[_0xa5cb('0x2c')](_0x1b9f6f[_0xa5cb('0x2d')]);_0x3328ee['filters']=_[_0xa5cb('0x2e')](_0x3328ee[_0xa5cb('0x2b')],_0x3328ee[_0xa5cb('0x2d')]);_0xad972[_0xa5cb('0x2f')]=_[_0xa5cb('0x2e')](_0x3328ee[_0xa5cb('0x2b')],qs[_0xa5cb('0x30')](_0x1b9f6f[_0xa5cb('0x2d')]['fields']));_0xad972[_0xa5cb('0x2f')]=_0xad972[_0xa5cb('0x2f')][_0xa5cb('0x31')]?_0xad972[_0xa5cb('0x2f')]:_0x3328ee[_0xa5cb('0x2b')];if(!_0x1b9f6f[_0xa5cb('0x2d')][_0xa5cb('0x32')](_0xa5cb('0x33'))){_0xad972['limit']=qs[_0xa5cb('0x1d')](_0x1b9f6f[_0xa5cb('0x2d')][_0xa5cb('0x1d')]);_0xad972[_0xa5cb('0x1b')]=qs['offset'](_0x1b9f6f[_0xa5cb('0x2d')][_0xa5cb('0x1b')]);}_0xad972['order']=qs['sort'](_0x1b9f6f[_0xa5cb('0x2d')][_0xa5cb('0x34')]);_0xad972[_0xa5cb('0x35')]=qs['filters'](_['pick'](_0x1b9f6f[_0xa5cb('0x2d')],_0x3328ee['filters']),_0xb42048);if(_0x1b9f6f['query'][_0xa5cb('0x36')]){_0xad972[_0xa5cb('0x35')]=_['merge'](_0xad972['where'],{'$or':_[_0xa5cb('0x27')](_0xb42048,function(_0x1ac202){if(_0x1ac202[_0xa5cb('0x29')]!==_0xa5cb('0x37')){var _0x5574a5={};_0x5574a5[_0x1ac202[_0xa5cb('0x25')]]={'$like':'%'+_0x1b9f6f['query']['filter']+'%'};return _0x5574a5;}})});}_0xad972=_[_0xa5cb('0x38')]({},_0xad972,_0x1b9f6f['options']);var _0x12dc77={'where':_0xad972[_0xa5cb('0x35')]};return db[_0xa5cb('0x39')][_0xa5cb('0x1e')](_0x12dc77)[_0xa5cb('0x3a')](function(_0x4af4ed){_0x2d94f2[_0xa5cb('0x1e')]=_0x4af4ed;if(_0x1b9f6f[_0xa5cb('0x2d')][_0xa5cb('0x3b')]){_0xad972[_0xa5cb('0x3c')]=[{'all':!![]}];}return db[_0xa5cb('0x39')][_0xa5cb('0x3d')](_0xad972);})[_0xa5cb('0x3a')](function(_0x29bc15){_0x2d94f2[_0xa5cb('0x3e')]=_0x29bc15;return _0x2d94f2;})['then'](respondWithFilteredResult(_0x437b22,_0xad972))[_0xa5cb('0x3f')](handleError(_0x437b22,null));};exports[_0xa5cb('0x40')]=function(_0x3bc1e5,_0x5e5b32){var _0x44848d={'raw':!![],'where':{'id':_0x3bc1e5[_0xa5cb('0x41')]['id']}},_0x160f33={};_0x160f33['model']=_['keys'](db[_0xa5cb('0x39')][_0xa5cb('0x28')]);_0x160f33[_0xa5cb('0x2d')]=_[_0xa5cb('0x2c')](_0x3bc1e5[_0xa5cb('0x2d')]);_0x160f33[_0xa5cb('0x42')]=_['intersection'](_0x160f33[_0xa5cb('0x2b')],_0x160f33[_0xa5cb('0x2d')]);_0x44848d[_0xa5cb('0x2f')]=_[_0xa5cb('0x2e')](_0x160f33[_0xa5cb('0x2b')],qs['fields'](_0x3bc1e5[_0xa5cb('0x2d')][_0xa5cb('0x30')]));_0x44848d[_0xa5cb('0x2f')]=_0x44848d[_0xa5cb('0x2f')][_0xa5cb('0x31')]?_0x44848d[_0xa5cb('0x2f')]:_0x160f33[_0xa5cb('0x2b')];if(_0x3bc1e5[_0xa5cb('0x2d')][_0xa5cb('0x3b')]){_0x44848d[_0xa5cb('0x3c')]=[{'all':!![]}];}_0x44848d=_['merge']({},_0x44848d,_0x3bc1e5['options']);return db['Dynamics365Field'][_0xa5cb('0x43')](_0x44848d)[_0xa5cb('0x3a')](handleEntityNotFound(_0x5e5b32,null))['then'](respondWithResult(_0x5e5b32,null))[_0xa5cb('0x3f')](handleError(_0x5e5b32,null));};exports[_0xa5cb('0x44')]=function(_0x534458,_0x268239){return db['Dynamics365Field'][_0xa5cb('0x44')](_0x534458[_0xa5cb('0x45')],{})[_0xa5cb('0x3a')](respondWithResult(_0x268239,0xc9))[_0xa5cb('0x3f')](handleError(_0x268239,null));};exports[_0xa5cb('0x22')]=function(_0x5de08f,_0xa9e0d3){if(_0x5de08f['body']['id']){delete _0x5de08f[_0xa5cb('0x45')]['id'];}return db[_0xa5cb('0x39')][_0xa5cb('0x43')]({'where':{'id':_0x5de08f[_0xa5cb('0x41')]['id']}})[_0xa5cb('0x3a')](handleEntityNotFound(_0xa9e0d3,null))['then'](saveUpdates(_0x5de08f[_0xa5cb('0x45')],null))[_0xa5cb('0x3a')](respondWithResult(_0xa9e0d3,null))['catch'](handleError(_0xa9e0d3,null));};exports[_0xa5cb('0x46')]=function(_0x47f04c,_0x4b7138){return db[_0xa5cb('0x39')][_0xa5cb('0x43')]({'where':{'id':_0x47f04c['params']['id']}})[_0xa5cb('0x3a')](handleEntityNotFound(_0x4b7138,null))[_0xa5cb('0x3a')](removeEntity(_0x4b7138,null))[_0xa5cb('0x3f')](handleError(_0x4b7138,null));}; \ No newline at end of file +var _0x5374=['query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','map','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','rawAttributes','merge','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','Dynamics365Field','key','model'];(function(_0x4ad32d,_0x5840d5){var _0x231098=function(_0x183350){while(--_0x183350){_0x4ad32d['push'](_0x4ad32d['shift']());}};_0x231098(++_0x5840d5);}(_0x5374,0xfb));var _0x4537=function(_0x27962d,_0x4875e5){_0x27962d=_0x27962d-0x0;var _0x3ba85b=_0x5374[_0x27962d];return _0x3ba85b;};'use strict';var emlformat=require(_0x4537('0x0'));var rimraf=require(_0x4537('0x1'));var zipdir=require(_0x4537('0x2'));var jsonpatch=require(_0x4537('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4537('0x4'));var Mustache=require(_0x4537('0x5'));var util=require(_0x4537('0x6'));var path=require(_0x4537('0x7'));var sox=require('sox');var csv=require(_0x4537('0x8'));var ejs=require(_0x4537('0x9'));var fs=require('fs');var fs_extra=require(_0x4537('0xa'));var _=require(_0x4537('0xb'));var squel=require('squel');var crypto=require(_0x4537('0xc'));var jsforce=require(_0x4537('0xd'));var deskjs=require(_0x4537('0xe'));var toCsv=require(_0x4537('0x8'));var querystring=require(_0x4537('0xf'));var Papa=require('papaparse');var Redis=require(_0x4537('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4537('0x11'));var hardwareService=require(_0x4537('0x12'));var logger=require(_0x4537('0x13'))(_0x4537('0x14'));var utils=require(_0x4537('0x15'));var config=require(_0x4537('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x567e45,_0x3f2efc){_0x3f2efc=_0x3f2efc||0xcc;return function(_0x4f581e){if(_0x4f581e){return _0x567e45[_0x4537('0x17')](_0x3f2efc);}return _0x567e45[_0x4537('0x18')](_0x3f2efc)[_0x4537('0x19')]();};}function respondWithResult(_0x3054ea,_0x3ef287){_0x3ef287=_0x3ef287||0xc8;return function(_0x2c42ae){if(_0x2c42ae){return _0x3054ea[_0x4537('0x18')](_0x3ef287)[_0x4537('0x1a')](_0x2c42ae);}};}function respondWithFilteredResult(_0x1302b6,_0x32361b){return function(_0x33cf60){if(_0x33cf60){var _0x3eae0e=typeof _0x32361b[_0x4537('0x1b')]===_0x4537('0x1c')&&typeof _0x32361b['limit']==='undefined';var _0x25f93c=_0x33cf60[_0x4537('0x1d')];var _0x35a5b5=_0x3eae0e?0x0:_0x32361b[_0x4537('0x1b')];var _0x3c4fd1=_0x3eae0e?_0x33cf60['count']:_0x32361b[_0x4537('0x1b')]+_0x32361b[_0x4537('0x1e')];var _0xaf5fd0;if(_0x3c4fd1>=_0x25f93c){_0x3c4fd1=_0x25f93c;_0xaf5fd0=0xc8;}else{_0xaf5fd0=0xce;}_0x1302b6[_0x4537('0x18')](_0xaf5fd0);return _0x1302b6['set']('Content-Range',_0x35a5b5+'-'+_0x3c4fd1+'/'+_0x25f93c)[_0x4537('0x1a')](_0x33cf60);}return null;};}function patchUpdates(_0x1aa371){return function(_0x25a5d1){try{jsonpatch[_0x4537('0x1f')](_0x25a5d1,_0x1aa371,!![]);}catch(_0x8990aa){return BPromise[_0x4537('0x20')](_0x8990aa);}return _0x25a5d1[_0x4537('0x21')]();};}function saveUpdates(_0x3e67c6,_0x49a95e){return function(_0x304941){if(_0x304941){return _0x304941[_0x4537('0x22')](_0x3e67c6)[_0x4537('0x23')](function(_0x36b4a6){return _0x36b4a6;});}return null;};}function removeEntity(_0x4bc4df,_0x5c3d20){return function(_0x1ea984){if(_0x1ea984){return _0x1ea984[_0x4537('0x24')]()[_0x4537('0x23')](function(){_0x4bc4df[_0x4537('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fe2f,_0xa27b30){return function(_0x34e984){if(!_0x34e984){_0x39fe2f[_0x4537('0x17')](0x194);}return _0x34e984;};}function handleError(_0x570bff,_0x12a8da){_0x12a8da=_0x12a8da||0x1f4;return function(_0x3134d8){logger[_0x4537('0x25')](_0x3134d8[_0x4537('0x26')]);if(_0x3134d8[_0x4537('0x27')]){delete _0x3134d8[_0x4537('0x27')];}_0x570bff[_0x4537('0x18')](_0x12a8da)[_0x4537('0x28')](_0x3134d8);};}exports[_0x4537('0x29')]=function(_0x30ca22,_0x5dce51){var _0x382320={},_0x3bf1d4={},_0x4d4baf={'count':0x0,'rows':[]};var _0x4207cc=_['map'](db[_0x4537('0x2a')]['rawAttributes'],function(_0x51add5){return{'name':_0x51add5['fieldName'],'type':_0x51add5['type'][_0x4537('0x2b')]};});_0x3bf1d4[_0x4537('0x2c')]=_['map'](_0x4207cc,_0x4537('0x27'));_0x3bf1d4[_0x4537('0x2d')]=_[_0x4537('0x2e')](_0x30ca22['query']);_0x3bf1d4[_0x4537('0x2f')]=_['intersection'](_0x3bf1d4['model'],_0x3bf1d4[_0x4537('0x2d')]);_0x382320[_0x4537('0x30')]=_[_0x4537('0x31')](_0x3bf1d4[_0x4537('0x2c')],qs[_0x4537('0x32')](_0x30ca22['query'][_0x4537('0x32')]));_0x382320[_0x4537('0x30')]=_0x382320[_0x4537('0x30')][_0x4537('0x33')]?_0x382320['attributes']:_0x3bf1d4[_0x4537('0x2c')];if(!_0x30ca22['query']['hasOwnProperty'](_0x4537('0x34'))){_0x382320[_0x4537('0x1e')]=qs[_0x4537('0x1e')](_0x30ca22[_0x4537('0x2d')][_0x4537('0x1e')]);_0x382320['offset']=qs[_0x4537('0x1b')](_0x30ca22[_0x4537('0x2d')]['offset']);}_0x382320[_0x4537('0x35')]=qs[_0x4537('0x36')](_0x30ca22[_0x4537('0x2d')][_0x4537('0x36')]);_0x382320[_0x4537('0x37')]=qs[_0x4537('0x2f')](_[_0x4537('0x38')](_0x30ca22[_0x4537('0x2d')],_0x3bf1d4[_0x4537('0x2f')]),_0x4207cc);if(_0x30ca22[_0x4537('0x2d')]['filter']){_0x382320['where']=_['merge'](_0x382320[_0x4537('0x37')],{'$or':_[_0x4537('0x39')](_0x4207cc,function(_0x2fd4c8){if(_0x2fd4c8[_0x4537('0x3a')]!==_0x4537('0x3b')){var _0x702884={};_0x702884[_0x2fd4c8['name']]={'$like':'%'+_0x30ca22[_0x4537('0x2d')][_0x4537('0x3c')]+'%'};return _0x702884;}})});}_0x382320=_['merge']({},_0x382320,_0x30ca22[_0x4537('0x3d')]);var _0x5f19a5={'where':_0x382320[_0x4537('0x37')]};return db[_0x4537('0x2a')][_0x4537('0x1d')](_0x5f19a5)['then'](function(_0x251bcd){_0x4d4baf[_0x4537('0x1d')]=_0x251bcd;if(_0x30ca22[_0x4537('0x2d')][_0x4537('0x3e')]){_0x382320[_0x4537('0x3f')]=[{'all':!![]}];}return db[_0x4537('0x2a')][_0x4537('0x40')](_0x382320);})['then'](function(_0x12c89f){_0x4d4baf[_0x4537('0x41')]=_0x12c89f;return _0x4d4baf;})[_0x4537('0x23')](respondWithFilteredResult(_0x5dce51,_0x382320))['catch'](handleError(_0x5dce51,null));};exports[_0x4537('0x42')]=function(_0x57491b,_0x50a4fc){var _0x412270={'raw':!![],'where':{'id':_0x57491b['params']['id']}},_0x31762f={};_0x31762f[_0x4537('0x2c')]=_['keys'](db[_0x4537('0x2a')][_0x4537('0x43')]);_0x31762f['query']=_[_0x4537('0x2e')](_0x57491b['query']);_0x31762f[_0x4537('0x2f')]=_[_0x4537('0x31')](_0x31762f['model'],_0x31762f[_0x4537('0x2d')]);_0x412270[_0x4537('0x30')]=_['intersection'](_0x31762f[_0x4537('0x2c')],qs[_0x4537('0x32')](_0x57491b[_0x4537('0x2d')]['fields']));_0x412270['attributes']=_0x412270[_0x4537('0x30')]['length']?_0x412270[_0x4537('0x30')]:_0x31762f['model'];if(_0x57491b[_0x4537('0x2d')][_0x4537('0x3e')]){_0x412270[_0x4537('0x3f')]=[{'all':!![]}];}_0x412270=_[_0x4537('0x44')]({},_0x412270,_0x57491b[_0x4537('0x3d')]);return db[_0x4537('0x2a')]['find'](_0x412270)[_0x4537('0x23')](handleEntityNotFound(_0x50a4fc,null))['then'](respondWithResult(_0x50a4fc,null))[_0x4537('0x45')](handleError(_0x50a4fc,null));};exports['create']=function(_0x3a7834,_0x3164a9){return db[_0x4537('0x2a')][_0x4537('0x46')](_0x3a7834[_0x4537('0x47')],{})['then'](respondWithResult(_0x3164a9,0xc9))[_0x4537('0x45')](handleError(_0x3164a9,null));};exports['update']=function(_0x390a1f,_0x1d3034){if(_0x390a1f['body']['id']){delete _0x390a1f[_0x4537('0x47')]['id'];}return db[_0x4537('0x2a')][_0x4537('0x48')]({'where':{'id':_0x390a1f['params']['id']}})[_0x4537('0x23')](handleEntityNotFound(_0x1d3034,null))[_0x4537('0x23')](saveUpdates(_0x390a1f[_0x4537('0x47')],null))[_0x4537('0x23')](respondWithResult(_0x1d3034,null))[_0x4537('0x45')](handleError(_0x1d3034,null));};exports[_0x4537('0x24')]=function(_0x1fac06,_0x168e07){return db[_0x4537('0x2a')][_0x4537('0x48')]({'where':{'id':_0x1fac06[_0x4537('0x49')]['id']}})[_0x4537('0x23')](handleEntityNotFound(_0x168e07,null))['then'](removeEntity(_0x168e07,null))[_0x4537('0x45')](handleError(_0x168e07,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 261e2be..e3b409b 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 _0x08fe=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','util'];(function(_0x517641,_0x1ebc8e){var _0x2a5de4=function(_0x4581c2){while(--_0x4581c2){_0x517641['push'](_0x517641['shift']());}};_0x2a5de4(++_0x1ebc8e);}(_0x08fe,0xcf));var _0xe08f=function(_0x45d80c,_0x35c0ff){_0x45d80c=_0x45d80c-0x0;var _0x449a98=_0x08fe[_0x45d80c];return _0x449a98;};'use strict';var _=require('lodash');var util=require(_0xe08f('0x0'));var logger=require(_0xe08f('0x1'))('api');var moment=require(_0xe08f('0x2'));var BPromise=require('bluebird');var rp=require(_0xe08f('0x3'));var fs=require('fs');var path=require(_0xe08f('0x4'));var rimraf=require(_0xe08f('0x5'));var config=require(_0xe08f('0x6'));var attributes=require(_0xe08f('0x7'));module['exports']=function(_0x3c378a,_0x17dea4){return _0x3c378a[_0xe08f('0x8')](_0xe08f('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xe08f('0xa'),'fields':[_0xe08f('0xb'),_0xe08f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeac7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xeac7,0x130));var _0x7eac=function(_0x37771c,_0x3d68da){_0x37771c=_0x37771c-0x0;var _0x16bb96=_0xeac7[_0x37771c];return _0x16bb96;};'use strict';var _=require(_0x7eac('0x0'));var util=require(_0x7eac('0x1'));var logger=require(_0x7eac('0x2'))(_0x7eac('0x3'));var moment=require(_0x7eac('0x4'));var BPromise=require(_0x7eac('0x5'));var rp=require(_0x7eac('0x6'));var fs=require('fs');var path=require(_0x7eac('0x7'));var rimraf=require('rimraf');var config=require(_0x7eac('0x8'));var attributes=require(_0x7eac('0x9'));module[_0x7eac('0xa')]=function(_0x388ef6,_0x570709){return _0x388ef6[_0x7eac('0xb')](_0x7eac('0xc'),attributes,{'tableName':_0x7eac('0xd'),'paranoid':![],'indexes':[{'name':_0x7eac('0xe'),'fields':[_0x7eac('0xf'),'FieldId'],'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 d2263c9..023fb96 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 _0xf1a9=['Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0xf1a9,0x1e7));var _0x9f1a=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xf1a9[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x9f1a('0x0'));var util=require(_0x9f1a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f1a('0x2'));var fs=require('fs');var Redis=require(_0x9f1a('0x3'));var db=require(_0x9f1a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9f1a('0x5'));var config=require('../../config/environment');var jayson=require(_0x9f1a('0x6'));var client=jayson[_0x9f1a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31ad56,_0x45a5d8,_0x368e7c){return new BPromise(function(_0x13a0fd,_0x40942d){return client[_0x9f1a('0x8')](_0x31ad56,_0x368e7c)[_0x9f1a('0x9')](function(_0x2fc169){logger['info'](_0x9f1a('0xa'),_0x45a5d8,_0x9f1a('0xb'));logger[_0x9f1a('0xc')](_0x9f1a('0xd'),_0x45a5d8,'request\x20sent',JSON[_0x9f1a('0xe')](_0x2fc169));if(_0x2fc169[_0x9f1a('0xf')]){if(_0x2fc169[_0x9f1a('0xf')]['code']===0x1f4){logger['error'](_0x9f1a('0xa'),_0x45a5d8,_0x2fc169[_0x9f1a('0xf')][_0x9f1a('0x10')]);return _0x40942d(_0x2fc169[_0x9f1a('0xf')]['message']);}logger[_0x9f1a('0xf')](_0x9f1a('0xa'),_0x45a5d8,_0x2fc169['error'][_0x9f1a('0x10')]);return _0x13a0fd(_0x2fc169[_0x9f1a('0xf')][_0x9f1a('0x10')]);}else{logger[_0x9f1a('0x11')](_0x9f1a('0xa'),_0x45a5d8,_0x9f1a('0xb'));_0x13a0fd(_0x2fc169[_0x9f1a('0x12')]['message']);}})[_0x9f1a('0x13')](function(_0x427901){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x45a5d8,_0x427901);_0x40942d(_0x427901);});});} \ No newline at end of file +var _0xf5a9=['../../config/utils','rpc','jayson/promise','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x465623,_0x2d58a8){var _0x57c8ba=function(_0x528942){while(--_0x528942){_0x465623['push'](_0x465623['shift']());}};_0x57c8ba(++_0x2d58a8);}(_0xf5a9,0x127));var _0x9f5a=function(_0x58d482,_0xed443f){_0x58d482=_0x58d482-0x0;var _0x2b367a=_0xf5a9[_0x58d482];return _0x2b367a;};'use strict';var _=require(_0x9f5a('0x0'));var util=require('util');var moment=require(_0x9f5a('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f5a('0x2'));var fs=require('fs');var Redis=require(_0x9f5a('0x3'));var db=require(_0x9f5a('0x4'))['db'];var utils=require(_0x9f5a('0x5'));var logger=require('../../config/logger')(_0x9f5a('0x6'));var config=require('../../config/environment');var jayson=require(_0x9f5a('0x7'));var client=jayson['client'][_0x9f5a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x483f7b,_0x25f7c2,_0x3b3a73){return new BPromise(function(_0x6b6b8f,_0x3c77d0){return client[_0x9f5a('0x9')](_0x483f7b,_0x3b3a73)['then'](function(_0x2408f3){logger[_0x9f5a('0xa')](_0x9f5a('0xb'),_0x25f7c2,_0x9f5a('0xc'));logger[_0x9f5a('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x25f7c2,_0x9f5a('0xc'),JSON[_0x9f5a('0xe')](_0x2408f3));if(_0x2408f3[_0x9f5a('0xf')]){if(_0x2408f3[_0x9f5a('0xf')][_0x9f5a('0x10')]===0x1f4){logger['error'](_0x9f5a('0xb'),_0x25f7c2,_0x2408f3[_0x9f5a('0xf')][_0x9f5a('0x11')]);return _0x3c77d0(_0x2408f3[_0x9f5a('0xf')][_0x9f5a('0x11')]);}logger[_0x9f5a('0xf')](_0x9f5a('0xb'),_0x25f7c2,_0x2408f3[_0x9f5a('0xf')][_0x9f5a('0x11')]);return _0x6b6b8f(_0x2408f3[_0x9f5a('0xf')]['message']);}else{logger[_0x9f5a('0xa')](_0x9f5a('0xb'),_0x25f7c2,'request\x20sent');_0x6b6b8f(_0x2408f3[_0x9f5a('0x12')][_0x9f5a('0x11')]);}})[_0x9f5a('0x13')](function(_0x59842c){logger[_0x9f5a('0xf')](_0x9f5a('0xb'),_0x25f7c2,_0x59842c);_0x3c77d0(_0x59842c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index cc540a4..e1e1244 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 _0x752d=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','delete','exports','multer'];(function(_0x230f48,_0x3734dd){var _0x15d00f=function(_0x4faf44){while(--_0x4faf44){_0x230f48['push'](_0x230f48['shift']());}};_0x15d00f(++_0x3734dd);}(_0x752d,0x8f));var _0xd752=function(_0x587497,_0x27c8af){_0x587497=_0x587497-0x0;var _0x21c65c=_0x752d[_0x587497];return _0x21c65c;};'use strict';var multer=require(_0xd752('0x0'));var util=require(_0xd752('0x1'));var path=require(_0xd752('0x2'));var timeout=require('connect-timeout');var express=require(_0xd752('0x3'));var router=express[_0xd752('0x4')]();var fs_extra=require(_0xd752('0x5'));var auth=require(_0xd752('0x6'));var interaction=require(_0xd752('0x7'));var config=require(_0xd752('0x8'));var controller=require(_0xd752('0x9'));router[_0xd752('0xa')]('/',auth[_0xd752('0xb')](),controller[_0xd752('0xc')]);router['get'](_0xd752('0xd'),auth[_0xd752('0xb')](),controller[_0xd752('0xe')]);router[_0xd752('0xa')](_0xd752('0xf'),auth[_0xd752('0xb')](),controller[_0xd752('0x10')]);router['get']('/:id/fields',auth[_0xd752('0xb')](),controller[_0xd752('0x11')]);router[_0xd752('0x12')]('/',auth[_0xd752('0xb')](),controller[_0xd752('0x13')]);router[_0xd752('0x12')]('/:id/configurations',auth[_0xd752('0xb')](),controller[_0xd752('0x14')]);router['put'](_0xd752('0xd'),auth[_0xd752('0xb')](),controller[_0xd752('0x15')]);router[_0xd752('0x16')](_0xd752('0xd'),auth[_0xd752('0xb')](),controller['destroy']);module[_0xd752('0x17')]=router; \ No newline at end of file +var _0xa3d4=['index','/:id','show','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0xa3d4,0xf4));var _0x4a3d=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xa3d4[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0x4a3d('0x0'));var util=require(_0x4a3d('0x1'));var path=require('path');var timeout=require(_0x4a3d('0x2'));var express=require('express');var router=express[_0x4a3d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4a3d('0x4'));var interaction=require(_0x4a3d('0x5'));var config=require(_0x4a3d('0x6'));var controller=require(_0x4a3d('0x7'));router['get']('/',auth[_0x4a3d('0x8')](),controller[_0x4a3d('0x9')]);router['get'](_0x4a3d('0xa'),auth[_0x4a3d('0x8')](),controller[_0x4a3d('0xb')]);router[_0x4a3d('0xc')](_0x4a3d('0xd'),auth[_0x4a3d('0x8')](),controller[_0x4a3d('0xe')]);router[_0x4a3d('0xc')]('/:id/fields',auth[_0x4a3d('0x8')](),controller[_0x4a3d('0xf')]);router[_0x4a3d('0x10')]('/',auth[_0x4a3d('0x8')](),controller[_0x4a3d('0x11')]);router[_0x4a3d('0x10')](_0x4a3d('0xd'),auth['isAuthenticated'](),controller[_0x4a3d('0x12')]);router[_0x4a3d('0x13')](_0x4a3d('0xa'),auth[_0x4a3d('0x8')](),controller['update']);router[_0x4a3d('0x14')](_0x4a3d('0xa'),auth[_0x4a3d('0x8')](),controller[_0x4a3d('0x15')]);module[_0x4a3d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 3de8fed..90da94c 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 _0x056b=['username','remoteUri','exports','STRING'];(function(_0x2fd9d5,_0x2017bd){var _0x3b4276=function(_0x929d64){while(--_0x929d64){_0x2fd9d5['push'](_0x2fd9d5['shift']());}};_0x3b4276(++_0x2017bd);}(_0x056b,0xb6));var _0xb056=function(_0x3fa29a,_0x218173){_0x3fa29a=_0x3fa29a-0x0;var _0x4486d8=_0x056b[_0x3fa29a];return _0x4486d8;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')]},'description':{'type':Sequelize[_0xb056('0x1')]},'username':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x2')},'apiKey':{'type':Sequelize[_0xb056('0x1')]},'remoteUri':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x3')},'serverUrl':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x66fa=['exports','STRING','username','remoteUri','sequelize'];(function(_0x32163c,_0x31db61){var _0x213632=function(_0x2010f5){while(--_0x2010f5){_0x32163c['push'](_0x32163c['shift']());}};_0x213632(++_0x31db61);}(_0x66fa,0x117));var _0xa66f=function(_0x48f4f5,_0x5e91f0){_0x48f4f5=_0x48f4f5-0x0;var _0x27de93=_0x66fa[_0x48f4f5];return _0x27de93;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa66f('0x2')]},'username':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x3')},'apiKey':{'type':Sequelize[_0xa66f('0x2')]},'remoteUri':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x4')},'serverUrl':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index bcefc0c..dd4eb8e 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 _0xab23=['path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','type','key','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','FreshdeskAccount','includeAll','include','findAll','rows','catch','show','params','model','keys','rawAttributes','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','FreshdeskField','getFields','slice','substring','lastIndexOf','GET','format','%s/%s','%s:X','base64','requester','subject','agent','description','priority','source','ticket_type','group','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x19a9fa,_0x174540){var _0x40a47f=function(_0x340721){while(--_0x340721){_0x19a9fa['push'](_0x19a9fa['shift']());}};_0x40a47f(++_0x174540);}(_0xab23,0x1bc));var _0x3ab2=function(_0x41c3f6,_0x3729c4){_0x41c3f6=_0x41c3f6-0x0;var _0x99ef9=_0xab23[_0x41c3f6];return _0x99ef9;};'use strict';var emlformat=require(_0x3ab2('0x0'));var rimraf=require(_0x3ab2('0x1'));var zipdir=require(_0x3ab2('0x2'));var jsonpatch=require(_0x3ab2('0x3'));var rp=require(_0x3ab2('0x4'));var moment=require(_0x3ab2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3ab2('0x6'));var util=require(_0x3ab2('0x7'));var path=require(_0x3ab2('0x8'));var sox=require(_0x3ab2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ab2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3ab2('0xb'));var jsforce=require(_0x3ab2('0xc'));var deskjs=require(_0x3ab2('0xd'));var toCsv=require(_0x3ab2('0xe'));var querystring=require(_0x3ab2('0xf'));var Papa=require(_0x3ab2('0x10'));var Redis=require(_0x3ab2('0x11'));var authService=require(_0x3ab2('0x12'));var qs=require(_0x3ab2('0x13'));var as=require(_0x3ab2('0x14'));var hardwareService=require(_0x3ab2('0x15'));var logger=require('../../config/logger')(_0x3ab2('0x16'));var utils=require(_0x3ab2('0x17'));var config=require(_0x3ab2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3ab2('0x19'));function respondWithStatusCode(_0x2ec0e3,_0x1f967a){_0x1f967a=_0x1f967a||0xcc;return function(_0x42d017){if(_0x42d017){return _0x2ec0e3[_0x3ab2('0x1a')](_0x1f967a);}return _0x2ec0e3[_0x3ab2('0x1b')](_0x1f967a)[_0x3ab2('0x1c')]();};}function respondWithResult(_0x101769,_0x11d439){_0x11d439=_0x11d439||0xc8;return function(_0x4eecd3){if(_0x4eecd3){return _0x101769[_0x3ab2('0x1b')](_0x11d439)['json'](_0x4eecd3);}};}function respondWithFilteredResult(_0x1e4e9c,_0x458f08){return function(_0x5c152c){if(_0x5c152c){var _0x560437=typeof _0x458f08[_0x3ab2('0x1d')]===_0x3ab2('0x1e')&&typeof _0x458f08[_0x3ab2('0x1f')]===_0x3ab2('0x1e');var _0x170506=_0x5c152c['count'];var _0x4d129b=_0x560437?0x0:_0x458f08[_0x3ab2('0x1d')];var _0x1efcb9=_0x560437?_0x5c152c['count']:_0x458f08[_0x3ab2('0x1d')]+_0x458f08[_0x3ab2('0x1f')];var _0x192f94;if(_0x1efcb9>=_0x170506){_0x1efcb9=_0x170506;_0x192f94=0xc8;}else{_0x192f94=0xce;}_0x1e4e9c[_0x3ab2('0x1b')](_0x192f94);return _0x1e4e9c['set'](_0x3ab2('0x20'),_0x4d129b+'-'+_0x1efcb9+'/'+_0x170506)[_0x3ab2('0x21')](_0x5c152c);}return null;};}function patchUpdates(_0x16d0b2){return function(_0x143bfe){try{jsonpatch[_0x3ab2('0x22')](_0x143bfe,_0x16d0b2,!![]);}catch(_0xed8423){return BPromise[_0x3ab2('0x23')](_0xed8423);}return _0x143bfe[_0x3ab2('0x24')]();};}function saveUpdates(_0x5dbfdc,_0x186853){return function(_0x4e702d){if(_0x4e702d){return _0x4e702d[_0x3ab2('0x25')](_0x5dbfdc)[_0x3ab2('0x26')](function(_0x299a78){return _0x299a78;});}return null;};}function removeEntity(_0x53bbcc,_0x436433){return function(_0x3b05dd){if(_0x3b05dd){return _0x3b05dd[_0x3ab2('0x27')]()[_0x3ab2('0x26')](function(){_0x53bbcc[_0x3ab2('0x1b')](0xcc)[_0x3ab2('0x1c')]();});}};}function handleEntityNotFound(_0x40422d,_0x3e764a){return function(_0xfdb909){if(!_0xfdb909){_0x40422d[_0x3ab2('0x1a')](0x194);}return _0xfdb909;};}function handleError(_0xbef8f3,_0x393376){_0x393376=_0x393376||0x1f4;return function(_0x533688){logger[_0x3ab2('0x28')](_0x533688['stack']);if(_0x533688[_0x3ab2('0x29')]){delete _0x533688[_0x3ab2('0x29')];}_0xbef8f3[_0x3ab2('0x1b')](_0x393376)[_0x3ab2('0x2a')](_0x533688);};}exports[_0x3ab2('0x2b')]=function(_0x36005a,_0xb3a40e){var _0x5d5f56={},_0x3b7967={},_0x3402f6={'count':0x0,'rows':[]};var _0x2f20e4=_['map'](db['FreshdeskAccount']['rawAttributes'],function(_0x27f666){return{'name':_0x27f666['fieldName'],'type':_0x27f666[_0x3ab2('0x2c')][_0x3ab2('0x2d')]};});_0x3b7967['model']=_[_0x3ab2('0x2e')](_0x2f20e4,_0x3ab2('0x29'));_0x3b7967[_0x3ab2('0x2f')]=_['keys'](_0x36005a[_0x3ab2('0x2f')]);_0x3b7967[_0x3ab2('0x30')]=_[_0x3ab2('0x31')](_0x3b7967['model'],_0x3b7967['query']);_0x5d5f56[_0x3ab2('0x32')]=_[_0x3ab2('0x31')](_0x3b7967['model'],qs['fields'](_0x36005a[_0x3ab2('0x2f')][_0x3ab2('0x33')]));_0x5d5f56[_0x3ab2('0x32')]=_0x5d5f56['attributes'][_0x3ab2('0x34')]?_0x5d5f56[_0x3ab2('0x32')]:_0x3b7967['model'];if(!_0x36005a[_0x3ab2('0x2f')][_0x3ab2('0x35')](_0x3ab2('0x36'))){_0x5d5f56[_0x3ab2('0x1f')]=qs['limit'](_0x36005a[_0x3ab2('0x2f')][_0x3ab2('0x1f')]);_0x5d5f56[_0x3ab2('0x1d')]=qs[_0x3ab2('0x1d')](_0x36005a[_0x3ab2('0x2f')][_0x3ab2('0x1d')]);}_0x5d5f56['order']=qs[_0x3ab2('0x37')](_0x36005a[_0x3ab2('0x2f')][_0x3ab2('0x37')]);_0x5d5f56[_0x3ab2('0x38')]=qs[_0x3ab2('0x30')](_['pick'](_0x36005a[_0x3ab2('0x2f')],_0x3b7967[_0x3ab2('0x30')]),_0x2f20e4);if(_0x36005a['query'][_0x3ab2('0x39')]){_0x5d5f56[_0x3ab2('0x38')]=_[_0x3ab2('0x3a')](_0x5d5f56[_0x3ab2('0x38')],{'$or':_[_0x3ab2('0x2e')](_0x2f20e4,function(_0x569d34){if(_0x569d34[_0x3ab2('0x2c')]!==_0x3ab2('0x3b')){var _0xd0ee49={};_0xd0ee49[_0x569d34[_0x3ab2('0x29')]]={'$like':'%'+_0x36005a[_0x3ab2('0x2f')][_0x3ab2('0x39')]+'%'};return _0xd0ee49;}})});}_0x5d5f56=_[_0x3ab2('0x3a')]({},_0x5d5f56,_0x36005a['options']);var _0x3a5277={'where':_0x5d5f56['where']};return db[_0x3ab2('0x3c')]['count'](_0x3a5277)[_0x3ab2('0x26')](function(_0x41dd27){_0x3402f6['count']=_0x41dd27;if(_0x36005a[_0x3ab2('0x2f')][_0x3ab2('0x3d')]){_0x5d5f56[_0x3ab2('0x3e')]=[{'all':!![]}];}return db[_0x3ab2('0x3c')][_0x3ab2('0x3f')](_0x5d5f56);})[_0x3ab2('0x26')](function(_0x1afe4c){_0x3402f6[_0x3ab2('0x40')]=_0x1afe4c;return _0x3402f6;})[_0x3ab2('0x26')](respondWithFilteredResult(_0xb3a40e,_0x5d5f56))[_0x3ab2('0x41')](handleError(_0xb3a40e,null));};exports[_0x3ab2('0x42')]=function(_0x83b4fc,_0x5e7a25){var _0x127b10={'raw':![],'where':{'id':_0x83b4fc[_0x3ab2('0x43')]['id']}},_0x40f6d8={};_0x40f6d8[_0x3ab2('0x44')]=_[_0x3ab2('0x45')](db[_0x3ab2('0x3c')][_0x3ab2('0x46')]);_0x40f6d8['query']=_[_0x3ab2('0x45')](_0x83b4fc[_0x3ab2('0x2f')]);_0x40f6d8[_0x3ab2('0x30')]=_['intersection'](_0x40f6d8[_0x3ab2('0x44')],_0x40f6d8[_0x3ab2('0x2f')]);_0x127b10[_0x3ab2('0x32')]=_[_0x3ab2('0x31')](_0x40f6d8['model'],qs[_0x3ab2('0x33')](_0x83b4fc[_0x3ab2('0x2f')]['fields']));_0x127b10[_0x3ab2('0x32')]=_0x127b10['attributes'][_0x3ab2('0x34')]?_0x127b10['attributes']:_0x40f6d8[_0x3ab2('0x44')];if(_0x83b4fc[_0x3ab2('0x2f')]['includeAll']){_0x127b10[_0x3ab2('0x3e')]=[{'all':!![]}];}_0x127b10=_[_0x3ab2('0x3a')]({},_0x127b10,_0x83b4fc[_0x3ab2('0x47')]);return db[_0x3ab2('0x3c')][_0x3ab2('0x48')](_0x127b10)[_0x3ab2('0x26')](handleEntityNotFound(_0x5e7a25,null))['then'](respondWithResult(_0x5e7a25,null))[_0x3ab2('0x41')](handleError(_0x5e7a25,null));};exports['create']=function(_0x4b70ee,_0x1aad66){return db[_0x3ab2('0x3c')][_0x3ab2('0x49')](_0x4b70ee[_0x3ab2('0x4a')],{})[_0x3ab2('0x26')](respondWithResult(_0x1aad66,0xc9))[_0x3ab2('0x41')](handleError(_0x1aad66,null));};exports[_0x3ab2('0x25')]=function(_0x586b89,_0x59d980){if(_0x586b89[_0x3ab2('0x4a')]['id']){delete _0x586b89['body']['id'];}return db[_0x3ab2('0x3c')][_0x3ab2('0x48')]({'where':{'id':_0x586b89[_0x3ab2('0x43')]['id']}})[_0x3ab2('0x26')](handleEntityNotFound(_0x59d980,null))[_0x3ab2('0x26')](saveUpdates(_0x586b89[_0x3ab2('0x4a')],null))[_0x3ab2('0x26')](respondWithResult(_0x59d980,null))['catch'](handleError(_0x59d980,null));};exports[_0x3ab2('0x27')]=function(_0x4b658b,_0x28f546){return db[_0x3ab2('0x3c')][_0x3ab2('0x48')]({'where':{'id':_0x4b658b[_0x3ab2('0x43')]['id']}})[_0x3ab2('0x26')](handleEntityNotFound(_0x28f546,null))[_0x3ab2('0x26')](removeEntity(_0x28f546,null))[_0x3ab2('0x41')](handleError(_0x28f546,null));};exports[_0x3ab2('0x4b')]=function(_0x2d4745,_0xdf4c3a,_0x296e26){var _0x31b89e={};var _0x3f688b={};var _0x4bbba8;var _0x1a6e71;return db['FreshdeskAccount'][_0x3ab2('0x4c')]({'where':{'id':_0x2d4745[_0x3ab2('0x43')]['id']}})['then'](handleEntityNotFound(_0xdf4c3a,null))[_0x3ab2('0x26')](function(_0x3fd928){if(_0x3fd928){_0x4bbba8=_0x3fd928;_0x3f688b['model']=_[_0x3ab2('0x45')](db[_0x3ab2('0x4d')][_0x3ab2('0x46')]);_0x3f688b[_0x3ab2('0x2f')]=_[_0x3ab2('0x45')](_0x2d4745[_0x3ab2('0x2f')]);_0x3f688b[_0x3ab2('0x30')]=_[_0x3ab2('0x31')](_0x3f688b[_0x3ab2('0x44')],_0x3f688b[_0x3ab2('0x2f')]);_0x31b89e[_0x3ab2('0x32')]=_[_0x3ab2('0x31')](_0x3f688b[_0x3ab2('0x44')],qs['fields'](_0x2d4745[_0x3ab2('0x2f')][_0x3ab2('0x33')]));_0x31b89e[_0x3ab2('0x32')]=_0x31b89e[_0x3ab2('0x32')][_0x3ab2('0x34')]?_0x31b89e['attributes']:_0x3f688b[_0x3ab2('0x44')];_0x31b89e[_0x3ab2('0x4e')]=qs[_0x3ab2('0x37')](_0x2d4745[_0x3ab2('0x2f')]['sort']);_0x31b89e[_0x3ab2('0x38')]=qs[_0x3ab2('0x30')](_['pick'](_0x2d4745['query'],_0x3f688b[_0x3ab2('0x30')]));if(_0x2d4745[_0x3ab2('0x2f')]['filter']){_0x31b89e['where']=_[_0x3ab2('0x3a')](_0x31b89e['where'],{'$or':_[_0x3ab2('0x2e')](_0x31b89e[_0x3ab2('0x32')],function(_0xd70b68){var _0x5e585d={};_0x5e585d[_0xd70b68]={'$like':'%'+_0x2d4745[_0x3ab2('0x2f')][_0x3ab2('0x39')]+'%'};return _0x5e585d;})});}_0x31b89e=_[_0x3ab2('0x3a')]({},_0x31b89e,_0x2d4745['options']);return _0x4bbba8[_0x3ab2('0x4b')](_0x31b89e);}})[_0x3ab2('0x26')](function(_0x411914){if(_0x411914){_0x1a6e71=_0x411914[_0x3ab2('0x34')];if(!_0x2d4745[_0x3ab2('0x2f')][_0x3ab2('0x35')](_0x3ab2('0x36'))){_0x31b89e[_0x3ab2('0x1f')]=qs['limit'](_0x2d4745['query']['limit']);_0x31b89e[_0x3ab2('0x1d')]=qs[_0x3ab2('0x1d')](_0x2d4745[_0x3ab2('0x2f')][_0x3ab2('0x1d')]);}return _0x4bbba8[_0x3ab2('0x4b')](_0x31b89e);}})[_0x3ab2('0x26')](function(_0xb2e7d2){if(_0xb2e7d2){return _0xb2e7d2?{'count':_0x1a6e71,'rows':_0xb2e7d2}:null;}})[_0x3ab2('0x26')](respondWithResult(_0xdf4c3a,null))[_0x3ab2('0x41')](handleError(_0xdf4c3a,null));};exports[_0x3ab2('0x4f')]=function(_0x50b6ee,_0x9b1249,_0x1af902){if(_0x50b6ee[_0x3ab2('0x4a')]['id']){delete _0x50b6ee[_0x3ab2('0x4a')]['id'];}return db[_0x3ab2('0x3c')][_0x3ab2('0x4c')]({'where':{'id':_0x50b6ee['params']['id']}})[_0x3ab2('0x26')](handleEntityNotFound(_0x9b1249,null))[_0x3ab2('0x26')](function(_0x5ea5e6){if(_0x5ea5e6){_0x50b6ee[_0x3ab2('0x4a')][_0x3ab2('0x50')]=_0x5ea5e6['id'];_0x50b6ee[_0x3ab2('0x4a')][_0x3ab2('0x51')]=integrations['getSubjects'](_0x50b6ee[_0x3ab2('0x4a')]['channel'],_0x50b6ee['body'][_0x3ab2('0x2c')]);_0x50b6ee[_0x3ab2('0x4a')][_0x3ab2('0x52')]=integrations[_0x3ab2('0x53')](_0x50b6ee['body']['channel'],_0x50b6ee[_0x3ab2('0x4a')][_0x3ab2('0x2c')]);return db[_0x3ab2('0x4d')][_0x3ab2('0x49')](_0x50b6ee['body'],{'include':[{'model':db[_0x3ab2('0x54')],'as':_0x3ab2('0x51')},{'model':db[_0x3ab2('0x54')],'as':_0x3ab2('0x52')}]});}return null;})[_0x3ab2('0x26')](respondWithResult(_0x9b1249,null))[_0x3ab2('0x41')](handleError(_0x9b1249,null));};exports[_0x3ab2('0x55')]=function(_0x3c98ca,_0x23df14,_0x392967){var _0x38dbec='';return db[_0x3ab2('0x3c')][_0x3ab2('0x4c')]({'where':{'id':_0x3c98ca[_0x3ab2('0x43')]['id']},'attributes':['id','remoteUri','apiKey']})[_0x3ab2('0x26')](handleEntityNotFound(_0x23df14,null))['then'](function(_0x3ea475){if(_0x3ea475){_0x38dbec=_0x3ea475['remoteUri'];var _0x279253=_0x38dbec[_0x3ab2('0x56')](-0x1);if(_0x279253==='/'){_0x38dbec=_0x38dbec[_0x3ab2('0x57')](0x0,_0x38dbec[_0x3ab2('0x58')](_0x279253));}return rp({'method':_0x3ab2('0x59'),'uri':util[_0x3ab2('0x5a')](_0x3ab2('0x5b'),_0x38dbec,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x3ab2('0x5a')]('Basic\x20%s',new Buffer(util['format'](_0x3ab2('0x5c'),_0x3ea475['apiKey']))['toString'](_0x3ab2('0x5d')))},'json':!![]});}})[_0x3ab2('0x26')](function(_0x5b646c){if(_0x5b646c){var _0x5305a0=[_0x3ab2('0x5e'),_0x3ab2('0x5f'),_0x3ab2('0x60'),_0x3ab2('0x61'),_0x3ab2('0x1b'),_0x3ab2('0x62'),'group',_0x3ab2('0x63'),_0x3ab2('0x64'),_0x3ab2('0x65'),'company'];_['remove'](_0x5b646c,function(_0x3c302a){return _0x5305a0[_0x3ab2('0x66')](_0x3c302a[_0x3ab2('0x29')])||!_0x3c302a[_0x3ab2('0x67')]&&_0x3c302a[_0x3ab2('0x2c')]!=='custom_text'&&_0x3c302a[_0x3ab2('0x2c')]!==_0x3ab2('0x68');});return{'count':_0x5b646c['length'],'rows':_[_0x3ab2('0x2e')](_0x5b646c,function(_0x56290a){return{'id':_0x56290a[_0x3ab2('0x29')],'name':_0x56290a[_0x3ab2('0x69')],'custom':!_0x56290a['default'],'options':_0x56290a[_0x3ab2('0x6a')]?_[_0x3ab2('0x2e')](_0x56290a[_0x3ab2('0x6a')],function(_0x19da58){return{'name':_[_0x3ab2('0x6b')](_0x19da58),'value':_0x19da58};}):[]};})};}})[_0x3ab2('0x26')](respondWithResult(_0x23df14,null))['catch'](function(_0x407b87){var _0xde806f=_0x3c98ca[_0x3ab2('0x2f')][_0x3ab2('0x6c')]?0x1f4:_0x407b87[_0x3ab2('0x6d')]||0x1f4;logger[_0x3ab2('0x28')](_0x3ab2('0x6e'),_0x3ab2('0x55'),_0xde806f,JSON[_0x3ab2('0x6f')](_0x407b87));delete _0x407b87[_0x3ab2('0x29')];if(_0xde806f===0x191){_0xde806f=0x190;}_0x23df14[_0x3ab2('0x1b')](_0xde806f)[_0x3ab2('0x2a')](_0x3c98ca[_0x3ab2('0x2f')]['test']?{'message':_0x3ab2('0x70'),'statusCode':_0x407b87['statusCode']}:_0x407b87);});}; \ No newline at end of file +var _0xb04a=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','sendStatus','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','params','includeAll','find','create','body','getConfigurations','FreshdeskConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','includes','default','custom_text','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','desk.js'];(function(_0x2987cf,_0x469d64){var _0x4eca35=function(_0x345021){while(--_0x345021){_0x2987cf['push'](_0x2987cf['shift']());}};_0x4eca35(++_0x469d64);}(_0xb04a,0xcf));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xab04('0x0'));var rimraf=require(_0xab04('0x1'));var zipdir=require(_0xab04('0x2'));var jsonpatch=require(_0xab04('0x3'));var rp=require('request-promise');var moment=require(_0xab04('0x4'));var BPromise=require(_0xab04('0x5'));var Mustache=require(_0xab04('0x6'));var util=require('util');var path=require(_0xab04('0x7'));var sox=require(_0xab04('0x8'));var csv=require(_0xab04('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab04('0xa'));var _=require(_0xab04('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab04('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab04('0xd'));var authService=require(_0xab04('0xe'));var qs=require(_0xab04('0xf'));var as=require(_0xab04('0x10'));var hardwareService=require(_0xab04('0x11'));var logger=require(_0xab04('0x12'))(_0xab04('0x13'));var utils=require(_0xab04('0x14'));var config=require(_0xab04('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xab04('0x16'));function respondWithStatusCode(_0x3cf546,_0x4160d5){_0x4160d5=_0x4160d5||0xcc;return function(_0x44dab9){if(_0x44dab9){return _0x3cf546['sendStatus'](_0x4160d5);}return _0x3cf546[_0xab04('0x17')](_0x4160d5)[_0xab04('0x18')]();};}function respondWithResult(_0x5e3471,_0x233a8d){_0x233a8d=_0x233a8d||0xc8;return function(_0x178595){if(_0x178595){return _0x5e3471[_0xab04('0x17')](_0x233a8d)[_0xab04('0x19')](_0x178595);}};}function respondWithFilteredResult(_0x2cff48,_0x523c51){return function(_0x3371ed){if(_0x3371ed){var _0x1cc965=typeof _0x523c51[_0xab04('0x1a')]===_0xab04('0x1b')&&typeof _0x523c51[_0xab04('0x1c')]==='undefined';var _0x47da0e=_0x3371ed[_0xab04('0x1d')];var _0x278c93=_0x1cc965?0x0:_0x523c51[_0xab04('0x1a')];var _0x4eb15e=_0x1cc965?_0x3371ed['count']:_0x523c51[_0xab04('0x1a')]+_0x523c51[_0xab04('0x1c')];var _0x45bce0;if(_0x4eb15e>=_0x47da0e){_0x4eb15e=_0x47da0e;_0x45bce0=0xc8;}else{_0x45bce0=0xce;}_0x2cff48['status'](_0x45bce0);return _0x2cff48[_0xab04('0x1e')]('Content-Range',_0x278c93+'-'+_0x4eb15e+'/'+_0x47da0e)[_0xab04('0x19')](_0x3371ed);}return null;};}function patchUpdates(_0x2ac32c){return function(_0x580a4f){try{jsonpatch['apply'](_0x580a4f,_0x2ac32c,!![]);}catch(_0xd9958f){return BPromise[_0xab04('0x1f')](_0xd9958f);}return _0x580a4f['save']();};}function saveUpdates(_0x3f0d72,_0x19d9cb){return function(_0x359c63){if(_0x359c63){return _0x359c63[_0xab04('0x20')](_0x3f0d72)[_0xab04('0x21')](function(_0x4c7a19){return _0x4c7a19;});}return null;};}function removeEntity(_0x19fcab,_0x4df287){return function(_0x1fced6){if(_0x1fced6){return _0x1fced6[_0xab04('0x22')]()['then'](function(){_0x19fcab[_0xab04('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59f287,_0x587620){return function(_0x75912d){if(!_0x75912d){_0x59f287[_0xab04('0x23')](0x194);}return _0x75912d;};}function handleError(_0x2f5a8c,_0x9a1b1){_0x9a1b1=_0x9a1b1||0x1f4;return function(_0x2d9128){logger['error'](_0x2d9128['stack']);if(_0x2d9128[_0xab04('0x24')]){delete _0x2d9128['name'];}_0x2f5a8c[_0xab04('0x17')](_0x9a1b1)[_0xab04('0x25')](_0x2d9128);};}exports[_0xab04('0x26')]=function(_0x2fb6e4,_0x331aa9){var _0x3c61bd={},_0x5d2d94={},_0xcd6008={'count':0x0,'rows':[]};var _0x36afb6=_['map'](db[_0xab04('0x27')][_0xab04('0x28')],function(_0x15e080){return{'name':_0x15e080[_0xab04('0x29')],'type':_0x15e080[_0xab04('0x2a')][_0xab04('0x2b')]};});_0x5d2d94['model']=_[_0xab04('0x2c')](_0x36afb6,'name');_0x5d2d94[_0xab04('0x2d')]=_[_0xab04('0x2e')](_0x2fb6e4[_0xab04('0x2d')]);_0x5d2d94[_0xab04('0x2f')]=_['intersection'](_0x5d2d94[_0xab04('0x30')],_0x5d2d94['query']);_0x3c61bd[_0xab04('0x31')]=_[_0xab04('0x32')](_0x5d2d94[_0xab04('0x30')],qs[_0xab04('0x33')](_0x2fb6e4[_0xab04('0x2d')][_0xab04('0x33')]));_0x3c61bd[_0xab04('0x31')]=_0x3c61bd['attributes']['length']?_0x3c61bd[_0xab04('0x31')]:_0x5d2d94[_0xab04('0x30')];if(!_0x2fb6e4[_0xab04('0x2d')]['hasOwnProperty'](_0xab04('0x34'))){_0x3c61bd[_0xab04('0x1c')]=qs['limit'](_0x2fb6e4[_0xab04('0x2d')][_0xab04('0x1c')]);_0x3c61bd[_0xab04('0x1a')]=qs[_0xab04('0x1a')](_0x2fb6e4[_0xab04('0x2d')]['offset']);}_0x3c61bd[_0xab04('0x35')]=qs['sort'](_0x2fb6e4['query'][_0xab04('0x36')]);_0x3c61bd[_0xab04('0x37')]=qs[_0xab04('0x2f')](_[_0xab04('0x38')](_0x2fb6e4['query'],_0x5d2d94[_0xab04('0x2f')]),_0x36afb6);if(_0x2fb6e4[_0xab04('0x2d')]['filter']){_0x3c61bd[_0xab04('0x37')]=_[_0xab04('0x39')](_0x3c61bd['where'],{'$or':_[_0xab04('0x2c')](_0x36afb6,function(_0x3e235d){if(_0x3e235d[_0xab04('0x2a')]!=='VIRTUAL'){var _0x40e9c5={};_0x40e9c5[_0x3e235d['name']]={'$like':'%'+_0x2fb6e4[_0xab04('0x2d')][_0xab04('0x3a')]+'%'};return _0x40e9c5;}})});}_0x3c61bd=_[_0xab04('0x39')]({},_0x3c61bd,_0x2fb6e4[_0xab04('0x3b')]);var _0x1746e8={'where':_0x3c61bd['where']};return db[_0xab04('0x27')]['count'](_0x1746e8)[_0xab04('0x21')](function(_0xc66c31){_0xcd6008[_0xab04('0x1d')]=_0xc66c31;if(_0x2fb6e4[_0xab04('0x2d')]['includeAll']){_0x3c61bd[_0xab04('0x3c')]=[{'all':!![]}];}return db[_0xab04('0x27')][_0xab04('0x3d')](_0x3c61bd);})[_0xab04('0x21')](function(_0x42679f){_0xcd6008[_0xab04('0x3e')]=_0x42679f;return _0xcd6008;})[_0xab04('0x21')](respondWithFilteredResult(_0x331aa9,_0x3c61bd))[_0xab04('0x3f')](handleError(_0x331aa9,null));};exports['show']=function(_0x5e6f05,_0x5c2d0b){var _0xa72dd2={'raw':![],'where':{'id':_0x5e6f05[_0xab04('0x40')]['id']}},_0x27ef76={};_0x27ef76[_0xab04('0x30')]=_[_0xab04('0x2e')](db[_0xab04('0x27')][_0xab04('0x28')]);_0x27ef76['query']=_[_0xab04('0x2e')](_0x5e6f05[_0xab04('0x2d')]);_0x27ef76[_0xab04('0x2f')]=_['intersection'](_0x27ef76[_0xab04('0x30')],_0x27ef76['query']);_0xa72dd2[_0xab04('0x31')]=_['intersection'](_0x27ef76[_0xab04('0x30')],qs[_0xab04('0x33')](_0x5e6f05[_0xab04('0x2d')][_0xab04('0x33')]));_0xa72dd2[_0xab04('0x31')]=_0xa72dd2[_0xab04('0x31')]['length']?_0xa72dd2[_0xab04('0x31')]:_0x27ef76[_0xab04('0x30')];if(_0x5e6f05[_0xab04('0x2d')][_0xab04('0x41')]){_0xa72dd2[_0xab04('0x3c')]=[{'all':!![]}];}_0xa72dd2=_['merge']({},_0xa72dd2,_0x5e6f05[_0xab04('0x3b')]);return db[_0xab04('0x27')][_0xab04('0x42')](_0xa72dd2)[_0xab04('0x21')](handleEntityNotFound(_0x5c2d0b,null))[_0xab04('0x21')](respondWithResult(_0x5c2d0b,null))[_0xab04('0x3f')](handleError(_0x5c2d0b,null));};exports[_0xab04('0x43')]=function(_0x32cc59,_0x4936b0){return db['FreshdeskAccount']['create'](_0x32cc59['body'],{})[_0xab04('0x21')](respondWithResult(_0x4936b0,0xc9))['catch'](handleError(_0x4936b0,null));};exports['update']=function(_0x154c60,_0x34b295){if(_0x154c60['body']['id']){delete _0x154c60['body']['id'];}return db[_0xab04('0x27')][_0xab04('0x42')]({'where':{'id':_0x154c60[_0xab04('0x40')]['id']}})[_0xab04('0x21')](handleEntityNotFound(_0x34b295,null))[_0xab04('0x21')](saveUpdates(_0x154c60[_0xab04('0x44')],null))['then'](respondWithResult(_0x34b295,null))[_0xab04('0x3f')](handleError(_0x34b295,null));};exports[_0xab04('0x22')]=function(_0x16c81e,_0x2f18f0){return db['FreshdeskAccount'][_0xab04('0x42')]({'where':{'id':_0x16c81e[_0xab04('0x40')]['id']}})[_0xab04('0x21')](handleEntityNotFound(_0x2f18f0,null))[_0xab04('0x21')](removeEntity(_0x2f18f0,null))['catch'](handleError(_0x2f18f0,null));};exports[_0xab04('0x45')]=function(_0x580ceb,_0x57436b,_0x3886c0){var _0x17a31b={};var _0xc68f8c={};var _0x5b447d;var _0x1aa5a0;return db[_0xab04('0x27')]['findOne']({'where':{'id':_0x580ceb[_0xab04('0x40')]['id']}})['then'](handleEntityNotFound(_0x57436b,null))['then'](function(_0x4b84a1){if(_0x4b84a1){_0x5b447d=_0x4b84a1;_0xc68f8c[_0xab04('0x30')]=_[_0xab04('0x2e')](db[_0xab04('0x46')][_0xab04('0x28')]);_0xc68f8c[_0xab04('0x2d')]=_[_0xab04('0x2e')](_0x580ceb[_0xab04('0x2d')]);_0xc68f8c['filters']=_[_0xab04('0x32')](_0xc68f8c[_0xab04('0x30')],_0xc68f8c['query']);_0x17a31b[_0xab04('0x31')]=_[_0xab04('0x32')](_0xc68f8c[_0xab04('0x30')],qs[_0xab04('0x33')](_0x580ceb['query'][_0xab04('0x33')]));_0x17a31b['attributes']=_0x17a31b['attributes']['length']?_0x17a31b[_0xab04('0x31')]:_0xc68f8c['model'];_0x17a31b[_0xab04('0x35')]=qs['sort'](_0x580ceb[_0xab04('0x2d')][_0xab04('0x36')]);_0x17a31b['where']=qs[_0xab04('0x2f')](_['pick'](_0x580ceb['query'],_0xc68f8c[_0xab04('0x2f')]));if(_0x580ceb[_0xab04('0x2d')]['filter']){_0x17a31b[_0xab04('0x37')]=_[_0xab04('0x39')](_0x17a31b[_0xab04('0x37')],{'$or':_['map'](_0x17a31b[_0xab04('0x31')],function(_0x155b4d){var _0x165d6f={};_0x165d6f[_0x155b4d]={'$like':'%'+_0x580ceb[_0xab04('0x2d')][_0xab04('0x3a')]+'%'};return _0x165d6f;})});}_0x17a31b=_[_0xab04('0x39')]({},_0x17a31b,_0x580ceb[_0xab04('0x3b')]);return _0x5b447d[_0xab04('0x45')](_0x17a31b);}})[_0xab04('0x21')](function(_0x15ce74){if(_0x15ce74){_0x1aa5a0=_0x15ce74['length'];if(!_0x580ceb[_0xab04('0x2d')][_0xab04('0x47')](_0xab04('0x34'))){_0x17a31b['limit']=qs[_0xab04('0x1c')](_0x580ceb[_0xab04('0x2d')][_0xab04('0x1c')]);_0x17a31b['offset']=qs[_0xab04('0x1a')](_0x580ceb[_0xab04('0x2d')][_0xab04('0x1a')]);}return _0x5b447d[_0xab04('0x45')](_0x17a31b);}})[_0xab04('0x21')](function(_0x235167){if(_0x235167){return _0x235167?{'count':_0x1aa5a0,'rows':_0x235167}:null;}})[_0xab04('0x21')](respondWithResult(_0x57436b,null))[_0xab04('0x3f')](handleError(_0x57436b,null));};exports[_0xab04('0x48')]=function(_0x7cc31a,_0x4ed95a,_0x5e1e9c){if(_0x7cc31a[_0xab04('0x44')]['id']){delete _0x7cc31a[_0xab04('0x44')]['id'];}return db[_0xab04('0x27')][_0xab04('0x49')]({'where':{'id':_0x7cc31a['params']['id']}})['then'](handleEntityNotFound(_0x4ed95a,null))[_0xab04('0x21')](function(_0x372583){if(_0x372583){_0x7cc31a['body'][_0xab04('0x4a')]=_0x372583['id'];_0x7cc31a[_0xab04('0x44')][_0xab04('0x4b')]=integrations[_0xab04('0x4c')](_0x7cc31a[_0xab04('0x44')][_0xab04('0x4d')],_0x7cc31a[_0xab04('0x44')]['type']);_0x7cc31a[_0xab04('0x44')][_0xab04('0x4e')]=integrations[_0xab04('0x4f')](_0x7cc31a[_0xab04('0x44')]['channel'],_0x7cc31a[_0xab04('0x44')]['type']);return db[_0xab04('0x46')][_0xab04('0x43')](_0x7cc31a[_0xab04('0x44')],{'include':[{'model':db['FreshdeskField'],'as':_0xab04('0x4b')},{'model':db['FreshdeskField'],'as':_0xab04('0x4e')}]});}return null;})[_0xab04('0x21')](respondWithResult(_0x4ed95a,null))[_0xab04('0x3f')](handleError(_0x4ed95a,null));};exports['getFields']=function(_0x170a31,_0x329537,_0xd11660){var _0x2a60e1='';return db[_0xab04('0x27')][_0xab04('0x49')]({'where':{'id':_0x170a31[_0xab04('0x40')]['id']},'attributes':['id',_0xab04('0x50'),_0xab04('0x51')]})[_0xab04('0x21')](handleEntityNotFound(_0x329537,null))[_0xab04('0x21')](function(_0x3e7e1e){if(_0x3e7e1e){_0x2a60e1=_0x3e7e1e[_0xab04('0x50')];var _0x36ef4b=_0x2a60e1[_0xab04('0x52')](-0x1);if(_0x36ef4b==='/'){_0x2a60e1=_0x2a60e1['substring'](0x0,_0x2a60e1[_0xab04('0x53')](_0x36ef4b));}return rp({'method':'GET','uri':util[_0xab04('0x54')](_0xab04('0x55'),_0x2a60e1,_0xab04('0x56')),'headers':{'Authorization':util[_0xab04('0x54')](_0xab04('0x57'),new Buffer(util[_0xab04('0x54')]('%s:X',_0x3e7e1e['apiKey']))[_0xab04('0x58')](_0xab04('0x59')))},'json':!![]});}})[_0xab04('0x21')](function(_0x441098){if(_0x441098){var _0x38d65e=[_0xab04('0x5a'),_0xab04('0x5b'),_0xab04('0x5c'),_0xab04('0x5d'),_0xab04('0x17'),_0xab04('0x5e'),_0xab04('0x5f'),_0xab04('0x60'),_0xab04('0x61'),_0xab04('0x5f'),'company'];_['remove'](_0x441098,function(_0xd17ffc){return _0x38d65e[_0xab04('0x62')](_0xd17ffc['name'])||!_0xd17ffc[_0xab04('0x63')]&&_0xd17ffc[_0xab04('0x2a')]!==_0xab04('0x64')&&_0xd17ffc[_0xab04('0x2a')]!=='custom_dropdown';});return{'count':_0x441098['length'],'rows':_[_0xab04('0x2c')](_0x441098,function(_0x5d1911){return{'id':_0x5d1911[_0xab04('0x24')],'name':_0x5d1911[_0xab04('0x65')],'custom':!_0x5d1911[_0xab04('0x63')],'options':_0x5d1911[_0xab04('0x66')]?_[_0xab04('0x2c')](_0x5d1911[_0xab04('0x66')],function(_0x2bddc0){return{'name':_[_0xab04('0x67')](_0x2bddc0),'value':_0x2bddc0};}):[]};})};}})['then'](respondWithResult(_0x329537,null))[_0xab04('0x3f')](function(_0x529362){var _0x20e30d=_0x170a31['query'][_0xab04('0x68')]?0x1f4:_0x529362[_0xab04('0x69')]||0x1f4;logger[_0xab04('0x6a')](_0xab04('0x6b'),'getFields',_0x20e30d,JSON[_0xab04('0x6c')](_0x529362));delete _0x529362[_0xab04('0x24')];if(_0x20e30d===0x191){_0x20e30d=0x190;}_0x329537[_0xab04('0x17')](_0x20e30d)[_0xab04('0x25')](_0x170a31[_0xab04('0x2d')][_0xab04('0x68')]?{'message':_0xab04('0x6d'),'statusCode':_0x529362[_0xab04('0x69')]}:_0x529362);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index de630c5..a9da3d5 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 _0xfdd7=['int_freshdesk_accounts','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x5a7fbc,_0xa081de){var _0xcba0fc=function(_0x4f083b){while(--_0x4f083b){_0x5a7fbc['push'](_0x5a7fbc['shift']());}};_0xcba0fc(++_0xa081de);}(_0xfdd7,0xa9));var _0x7fdd=function(_0x57fd18,_0x590abf){_0x57fd18=_0x57fd18-0x0;var _0x1e7199=_0xfdd7[_0x57fd18];return _0x1e7199;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7fdd('0x0'));var moment=require(_0x7fdd('0x1'));var BPromise=require('bluebird');var rp=require(_0x7fdd('0x2'));var fs=require('fs');var path=require(_0x7fdd('0x3'));var rimraf=require(_0x7fdd('0x4'));var config=require(_0x7fdd('0x5'));var attributes=require(_0x7fdd('0x6'));var integrations=require(_0x7fdd('0x7'));module[_0x7fdd('0x8')]=function(_0x32f476,_0x49ea87){return _0x32f476[_0x7fdd('0x9')](_0x7fdd('0xa'),attributes,{'tableName':_0x7fdd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcda8=['../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','../../config/logger','bluebird','rimraf'];(function(_0x3333bd,_0x23cf4c){var _0x5edb96=function(_0x53f786){while(--_0x53f786){_0x3333bd['push'](_0x3333bd['shift']());}};_0x5edb96(++_0x23cf4c);}(_0xcda8,0x115));var _0x8cda=function(_0x5c9f2d,_0xeee094){_0x5c9f2d=_0x5c9f2d-0x0;var _0x4007f0=_0xcda8[_0x5c9f2d];return _0x4007f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8cda('0x0'))('api');var moment=require('moment');var BPromise=require(_0x8cda('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8cda('0x2'));var config=require(_0x8cda('0x3'));var attributes=require(_0x8cda('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8cda('0x5')]=function(_0x368bdd,_0x8a658f){return _0x368bdd[_0x8cda('0x6')](_0x8cda('0x7'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 90e8560..9103844 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 _0x0a1c=['request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','findAll','options','raw','where','limit','map','include','model','attributes','ShowFreshdeskAccount','FreshdeskAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0x0a1c,0x7a));var _0xc0a1=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x0a1c[_0x496333];return _0x44256e;};'use strict';var _=require(_0xc0a1('0x0'));var util=require(_0xc0a1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc0a1('0x2'));var fs=require('fs');var Redis=require(_0xc0a1('0x3'));var db=require(_0xc0a1('0x4'))['db'];var utils=require(_0xc0a1('0x5'));var logger=require('../../config/logger')(_0xc0a1('0x6'));var config=require(_0xc0a1('0x7'));var jayson=require(_0xc0a1('0x8'));var client=jayson[_0xc0a1('0x9')][_0xc0a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x199b79,_0x2522c8,_0x570f44){return new BPromise(function(_0x2c8f26,_0x4dcaf2){return client[_0xc0a1('0xb')](_0x199b79,_0x570f44)[_0xc0a1('0xc')](function(_0x4a1f22){logger[_0xc0a1('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x2522c8,_0xc0a1('0xe'));logger[_0xc0a1('0xf')](_0xc0a1('0x10'),_0x2522c8,'request\x20sent',JSON[_0xc0a1('0x11')](_0x4a1f22));if(_0x4a1f22[_0xc0a1('0x12')]){if(_0x4a1f22[_0xc0a1('0x12')]['code']===0x1f4){logger[_0xc0a1('0x12')](_0xc0a1('0x13'),_0x2522c8,_0x4a1f22[_0xc0a1('0x12')][_0xc0a1('0x14')]);return _0x4dcaf2(_0x4a1f22[_0xc0a1('0x12')][_0xc0a1('0x14')]);}logger[_0xc0a1('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x2522c8,_0x4a1f22[_0xc0a1('0x12')][_0xc0a1('0x14')]);return _0x2c8f26(_0x4a1f22[_0xc0a1('0x12')]['message']);}else{logger[_0xc0a1('0xd')](_0xc0a1('0x13'),_0x2522c8,_0xc0a1('0xe'));_0x2c8f26(_0x4a1f22['result'][_0xc0a1('0x14')]);}})[_0xc0a1('0x15')](function(_0xaee3be){logger['error'](_0xc0a1('0x13'),_0x2522c8,_0xaee3be);_0x4dcaf2(_0xaee3be);});});}exports[_0xc0a1('0x16')]=function(_0x176850){var _0xaa69f8=this;return new Promise(function(_0x33a91f,_0x1d9e41){return db['FreshdeskAccount'][_0xc0a1('0x17')]({'raw':_0x176850[_0xc0a1('0x18')]?_0x176850[_0xc0a1('0x18')][_0xc0a1('0x19')]===undefined?!![]:![]:!![],'where':_0x176850['options']?_0x176850[_0xc0a1('0x18')][_0xc0a1('0x1a')]||null:null,'attributes':_0x176850[_0xc0a1('0x18')]?_0x176850[_0xc0a1('0x18')]['attributes']||null:null,'limit':_0x176850[_0xc0a1('0x18')]?_0x176850[_0xc0a1('0x18')][_0xc0a1('0x1b')]||null:null,'include':_0x176850[_0xc0a1('0x18')]?_0x176850[_0xc0a1('0x18')]['include']?_[_0xc0a1('0x1c')](_0x176850[_0xc0a1('0x18')][_0xc0a1('0x1d')],function(_0x1e19d5){return{'model':db[_0x1e19d5[_0xc0a1('0x1e')]],'as':_0x1e19d5['as'],'attributes':_0x1e19d5['attributes'],'include':_0x1e19d5['include']?_[_0xc0a1('0x1c')](_0x1e19d5[_0xc0a1('0x1d')],function(_0x549197){return{'model':db[_0x549197[_0xc0a1('0x1e')]],'as':_0x549197['as'],'attributes':_0x549197[_0xc0a1('0x1f')],'include':_0x549197[_0xc0a1('0x1d')]?_[_0xc0a1('0x1c')](_0x549197[_0xc0a1('0x1d')],function(_0x47f927){return{'model':db[_0x47f927[_0xc0a1('0x1e')]],'as':_0x47f927['as'],'attributes':_0x47f927[_0xc0a1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc0a1('0xc')](function(_0xe06e27){logger['info'](_0xc0a1('0x16'),_0x176850);logger[_0xc0a1('0xf')]('GetFreshdeskAccount',_0x176850,JSON[_0xc0a1('0x11')](_0xe06e27));_0x33a91f(_0xe06e27);})[_0xc0a1('0x15')](function(_0x5249c0){logger[_0xc0a1('0x12')](_0xc0a1('0x16'),_0x5249c0[_0xc0a1('0x14')],_0x176850);_0x1d9e41(_0xaa69f8[_0xc0a1('0x12')](0x1f4,_0x5249c0[_0xc0a1('0x14')]));});});};exports[_0xc0a1('0x20')]=function(_0x1da577){var _0x5d1310=this;return new Promise(function(_0x2346a1,_0x2830fa){return db[_0xc0a1('0x21')]['find']({'raw':_0x1da577['options']?_0x1da577[_0xc0a1('0x18')][_0xc0a1('0x19')]===undefined?!![]:![]:!![],'where':_0x1da577['options']?_0x1da577[_0xc0a1('0x18')][_0xc0a1('0x1a')]||null:null,'attributes':_0x1da577[_0xc0a1('0x18')]?_0x1da577[_0xc0a1('0x18')]['attributes']||null:null,'include':_0x1da577[_0xc0a1('0x18')]?_0x1da577[_0xc0a1('0x18')][_0xc0a1('0x1d')]?_[_0xc0a1('0x1c')](_0x1da577[_0xc0a1('0x18')][_0xc0a1('0x1d')],function(_0x290b55){return{'model':db[_0x290b55[_0xc0a1('0x1e')]],'as':_0x290b55['as'],'attributes':_0x290b55[_0xc0a1('0x1f')],'include':_0x290b55[_0xc0a1('0x1d')]?_[_0xc0a1('0x1c')](_0x290b55[_0xc0a1('0x1d')],function(_0x335c9f){return{'model':db[_0x335c9f[_0xc0a1('0x1e')]],'as':_0x335c9f['as'],'attributes':_0x335c9f['attributes'],'include':_0x335c9f['include']?_[_0xc0a1('0x1c')](_0x335c9f[_0xc0a1('0x1d')],function(_0x516e87){return{'model':db[_0x516e87['model']],'as':_0x516e87['as'],'attributes':_0x516e87[_0xc0a1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc0a1('0xc')](function(_0x109792){logger['info'](_0xc0a1('0x20'),_0x1da577);logger[_0xc0a1('0xf')](_0xc0a1('0x20'),_0x1da577,JSON[_0xc0a1('0x11')](_0x109792));_0x2346a1(_0x109792);})['catch'](function(_0x6760d1){logger[_0xc0a1('0x12')](_0xc0a1('0x20'),_0x6760d1[_0xc0a1('0x14')],_0x1da577);_0x2830fa(_0x5d1310[_0xc0a1('0x12')](0x1f4,_0x6760d1[_0xc0a1('0x14')]));});});}; \ No newline at end of file +var _0x02ee=['request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http'];(function(_0x4789af,_0x52bdc4){var _0xf2cde7=function(_0x414ffe){while(--_0x414ffe){_0x4789af['push'](_0x4789af['shift']());}};_0xf2cde7(++_0x52bdc4);}(_0x02ee,0xe4));var _0xe02e=function(_0x5e2af1,_0x183d9b){_0x5e2af1=_0x5e2af1-0x0;var _0x4d0c8b=_0x02ee[_0x5e2af1];return _0x4d0c8b;};'use strict';var _=require(_0xe02e('0x0'));var util=require(_0xe02e('0x1'));var moment=require(_0xe02e('0x2'));var BPromise=require(_0xe02e('0x3'));var rs=require(_0xe02e('0x4'));var fs=require('fs');var Redis=require(_0xe02e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe02e('0x6'));var config=require('../../config/environment');var jayson=require(_0xe02e('0x7'));var client=jayson[_0xe02e('0x8')][_0xe02e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bb298,_0x89d20f,_0x5c2dbf){return new BPromise(function(_0x3d7989,_0x15e9bf){return client[_0xe02e('0xa')](_0x3bb298,_0x5c2dbf)['then'](function(_0x22e171){logger[_0xe02e('0xb')](_0xe02e('0xc'),_0x89d20f,_0xe02e('0xd'));logger[_0xe02e('0xe')](_0xe02e('0xf'),_0x89d20f,_0xe02e('0xd'),JSON[_0xe02e('0x10')](_0x22e171));if(_0x22e171[_0xe02e('0x11')]){if(_0x22e171[_0xe02e('0x11')][_0xe02e('0x12')]===0x1f4){logger['error'](_0xe02e('0xc'),_0x89d20f,_0x22e171['error'][_0xe02e('0x13')]);return _0x15e9bf(_0x22e171[_0xe02e('0x11')][_0xe02e('0x13')]);}logger['error'](_0xe02e('0xc'),_0x89d20f,_0x22e171['error'][_0xe02e('0x13')]);return _0x3d7989(_0x22e171[_0xe02e('0x11')][_0xe02e('0x13')]);}else{logger['info'](_0xe02e('0xc'),_0x89d20f,_0xe02e('0xd'));_0x3d7989(_0x22e171[_0xe02e('0x14')][_0xe02e('0x13')]);}})[_0xe02e('0x15')](function(_0x4a702b){logger[_0xe02e('0x11')](_0xe02e('0xc'),_0x89d20f,_0x4a702b);_0x15e9bf(_0x4a702b);});});}exports[_0xe02e('0x16')]=function(_0x38e446){var _0x390c0a=this;return new Promise(function(_0x189fda,_0x27740b){return db['FreshdeskAccount'][_0xe02e('0x17')]({'raw':_0x38e446[_0xe02e('0x18')]?_0x38e446[_0xe02e('0x18')][_0xe02e('0x19')]===undefined?!![]:![]:!![],'where':_0x38e446[_0xe02e('0x18')]?_0x38e446['options'][_0xe02e('0x1a')]||null:null,'attributes':_0x38e446[_0xe02e('0x18')]?_0x38e446[_0xe02e('0x18')][_0xe02e('0x1b')]||null:null,'limit':_0x38e446[_0xe02e('0x18')]?_0x38e446[_0xe02e('0x18')][_0xe02e('0x1c')]||null:null,'include':_0x38e446[_0xe02e('0x18')]?_0x38e446[_0xe02e('0x18')][_0xe02e('0x1d')]?_[_0xe02e('0x1e')](_0x38e446[_0xe02e('0x18')]['include'],function(_0x417958){return{'model':db[_0x417958[_0xe02e('0x1f')]],'as':_0x417958['as'],'attributes':_0x417958[_0xe02e('0x1b')],'include':_0x417958['include']?_[_0xe02e('0x1e')](_0x417958[_0xe02e('0x1d')],function(_0x33792d){return{'model':db[_0x33792d[_0xe02e('0x1f')]],'as':_0x33792d['as'],'attributes':_0x33792d[_0xe02e('0x1b')],'include':_0x33792d[_0xe02e('0x1d')]?_['map'](_0x33792d[_0xe02e('0x1d')],function(_0x28d835){return{'model':db[_0x28d835[_0xe02e('0x1f')]],'as':_0x28d835['as'],'attributes':_0x28d835[_0xe02e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe02e('0x20')](function(_0x2777bb){logger[_0xe02e('0xb')]('GetFreshdeskAccount',_0x38e446);logger[_0xe02e('0xe')]('GetFreshdeskAccount',_0x38e446,JSON[_0xe02e('0x10')](_0x2777bb));_0x189fda(_0x2777bb);})['catch'](function(_0x3a03bd){logger[_0xe02e('0x11')]('GetFreshdeskAccount',_0x3a03bd[_0xe02e('0x13')],_0x38e446);_0x27740b(_0x390c0a[_0xe02e('0x11')](0x1f4,_0x3a03bd[_0xe02e('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0x2b0f6d){var _0x2df1e8=this;return new Promise(function(_0x284687,_0x9e956d){return db['FreshdeskAccount']['find']({'raw':_0x2b0f6d[_0xe02e('0x18')]?_0x2b0f6d[_0xe02e('0x18')][_0xe02e('0x19')]===undefined?!![]:![]:!![],'where':_0x2b0f6d[_0xe02e('0x18')]?_0x2b0f6d[_0xe02e('0x18')][_0xe02e('0x1a')]||null:null,'attributes':_0x2b0f6d['options']?_0x2b0f6d['options']['attributes']||null:null,'include':_0x2b0f6d['options']?_0x2b0f6d['options'][_0xe02e('0x1d')]?_[_0xe02e('0x1e')](_0x2b0f6d[_0xe02e('0x18')][_0xe02e('0x1d')],function(_0x1b12a9){return{'model':db[_0x1b12a9[_0xe02e('0x1f')]],'as':_0x1b12a9['as'],'attributes':_0x1b12a9[_0xe02e('0x1b')],'include':_0x1b12a9[_0xe02e('0x1d')]?_[_0xe02e('0x1e')](_0x1b12a9['include'],function(_0x3c6fca){return{'model':db[_0x3c6fca[_0xe02e('0x1f')]],'as':_0x3c6fca['as'],'attributes':_0x3c6fca[_0xe02e('0x1b')],'include':_0x3c6fca[_0xe02e('0x1d')]?_[_0xe02e('0x1e')](_0x3c6fca[_0xe02e('0x1d')],function(_0x3a6ab7){return{'model':db[_0x3a6ab7['model']],'as':_0x3a6ab7['as'],'attributes':_0x3a6ab7[_0xe02e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe02e('0x20')](function(_0x331bec){logger[_0xe02e('0xb')](_0xe02e('0x21'),_0x2b0f6d);logger[_0xe02e('0xe')](_0xe02e('0x21'),_0x2b0f6d,JSON[_0xe02e('0x10')](_0x331bec));_0x284687(_0x331bec);})[_0xe02e('0x15')](function(_0x2e2b8a){logger[_0xe02e('0x11')](_0xe02e('0x21'),_0x2e2b8a[_0xe02e('0x13')],_0x2b0f6d);_0x9e956d(_0x2df1e8[_0xe02e('0x11')](0x1f4,_0x2e2b8a['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index bf0eb6e..32ec120 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 _0x7d09=['delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update'];(function(_0x47dde9,_0x1e8683){var _0x291547=function(_0x488c0a){while(--_0x488c0a){_0x47dde9['push'](_0x47dde9['shift']());}};_0x291547(++_0x1e8683);}(_0x7d09,0x137));var _0x97d0=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x7d09[_0x491cbe];return _0x59449d;};'use strict';var multer=require(_0x97d0('0x0'));var util=require('util');var path=require(_0x97d0('0x1'));var timeout=require(_0x97d0('0x2'));var express=require('express');var router=express[_0x97d0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x97d0('0x4'));var interaction=require(_0x97d0('0x5'));var config=require(_0x97d0('0x6'));var controller=require(_0x97d0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x97d0('0x8')]);router[_0x97d0('0x9')](_0x97d0('0xa'),auth[_0x97d0('0xb')](),controller[_0x97d0('0xc')]);router['get'](_0x97d0('0xd'),auth['isAuthenticated'](),controller[_0x97d0('0xe')]);router[_0x97d0('0x9')](_0x97d0('0xf'),auth[_0x97d0('0xb')](),controller['getSubjects']);router[_0x97d0('0x9')](_0x97d0('0x10'),auth['isAuthenticated'](),controller[_0x97d0('0x11')]);router[_0x97d0('0x9')](_0x97d0('0x12'),auth['isAuthenticated'](),controller[_0x97d0('0x13')]);router['post']('/',auth[_0x97d0('0xb')](),controller[_0x97d0('0x14')]);router[_0x97d0('0x15')](_0x97d0('0x12'),auth[_0x97d0('0xb')](),controller[_0x97d0('0x16')]);router[_0x97d0('0x17')](_0x97d0('0xa'),auth[_0x97d0('0xb')](),controller[_0x97d0('0x18')]);router[_0x97d0('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x97d0('0x1a')]);module[_0x97d0('0x1b')]=router; \ No newline at end of file +var _0x9f44=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f44,0xb5));var _0x49f4=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x9f44[_0x20ef64];return _0x3707d8;};'use strict';var multer=require(_0x49f4('0x0'));var util=require(_0x49f4('0x1'));var path=require(_0x49f4('0x2'));var timeout=require(_0x49f4('0x3'));var express=require(_0x49f4('0x4'));var router=express[_0x49f4('0x5')]();var fs_extra=require(_0x49f4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x49f4('0x7'));var config=require(_0x49f4('0x8'));var controller=require(_0x49f4('0x9'));router[_0x49f4('0xa')]('/',auth[_0x49f4('0xb')](),controller[_0x49f4('0xc')]);router[_0x49f4('0xa')](_0x49f4('0xd'),auth[_0x49f4('0xb')](),controller[_0x49f4('0xe')]);router[_0x49f4('0xa')](_0x49f4('0xf'),auth[_0x49f4('0xb')](),controller[_0x49f4('0x10')]);router[_0x49f4('0xa')](_0x49f4('0x11'),auth[_0x49f4('0xb')](),controller[_0x49f4('0x12')]);router['get'](_0x49f4('0x13'),auth[_0x49f4('0xb')](),controller['getDescriptions']);router[_0x49f4('0xa')](_0x49f4('0x14'),auth['isAuthenticated'](),controller['getTags']);router[_0x49f4('0x15')]('/',auth[_0x49f4('0xb')](),controller['create']);router['post'](_0x49f4('0x14'),auth['isAuthenticated'](),controller[_0x49f4('0x16')]);router[_0x49f4('0x17')](_0x49f4('0xd'),auth[_0x49f4('0xb')](),controller[_0x49f4('0x18')]);router[_0x49f4('0x19')](_0x49f4('0xd'),auth['isAuthenticated'](),controller[_0x49f4('0x1a')]);module[_0x49f4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 16cf635..cf07e74 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 _0x1830=['exports','STRING','sequelize'];(function(_0x507945,_0x1a7f6d){var _0x2a1916=function(_0x345d3f){while(--_0x345d3f){_0x507945['push'](_0x507945['shift']());}};_0x2a1916(++_0x1a7f6d);}(_0x1830,0xb6));var _0x0183=function(_0x741334,_0x4dadd8){_0x741334=_0x741334-0x0;var _0x11f9e0=_0x1830[_0x741334];return _0x11f9e0;};'use strict';var Sequelize=require(_0x0183('0x0'));module[_0x0183('0x1')]={'name':{'type':Sequelize[_0x0183('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7020=['STRING','exports'];(function(_0x1b5792,_0x16b34b){var _0xc25239=function(_0x21808f){while(--_0x21808f){_0x1b5792['push'](_0x1b5792['shift']());}};_0xc25239(++_0x16b34b);}(_0x7020,0xd1));var _0x0702=function(_0x37f148,_0x1edd34){_0x37f148=_0x37f148-0x0;var _0x45959e=_0x7020[_0x37f148];return _0x45959e;};'use strict';var Sequelize=require('sequelize');module[_0x0702('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0702('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 01988f7..e14348c 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 _0x6021=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','map','FreshdeskConfiguration','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','findOne','FreshdeskField','options','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6021,0x1d0));var _0x1602=function(_0x23fd7a,_0x193ac1){_0x23fd7a=_0x23fd7a-0x0;var _0x1e6e80=_0x6021[_0x23fd7a];return _0x1e6e80;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1602('0x0'));var jsonpatch=require(_0x1602('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1602('0x2'));var Mustache=require(_0x1602('0x3'));var util=require('util');var path=require(_0x1602('0x4'));var sox=require(_0x1602('0x5'));var csv=require(_0x1602('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1602('0x7'));var _=require(_0x1602('0x8'));var squel=require('squel');var crypto=require(_0x1602('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1602('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1602('0xb'));var Redis=require('ioredis');var authService=require(_0x1602('0xc'));var qs=require(_0x1602('0xd'));var as=require(_0x1602('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1602('0xf'))(_0x1602('0x10'));var utils=require('../../config/utils');var config=require(_0x1602('0x11'));var licenseUtil=require(_0x1602('0x12'));var db=require(_0x1602('0x13'))['db'];function respondWithStatusCode(_0xb71833,_0x1ff7c0){_0x1ff7c0=_0x1ff7c0||0xcc;return function(_0x3b7c15){if(_0x3b7c15){return _0xb71833[_0x1602('0x14')](_0x1ff7c0);}return _0xb71833[_0x1602('0x15')](_0x1ff7c0)[_0x1602('0x16')]();};}function respondWithResult(_0xd111a3,_0x19309f){_0x19309f=_0x19309f||0xc8;return function(_0xb7fdc7){if(_0xb7fdc7){return _0xd111a3['status'](_0x19309f)[_0x1602('0x17')](_0xb7fdc7);}};}function respondWithFilteredResult(_0x1b4df7,_0x4c2743){return function(_0x44e18a){if(_0x44e18a){var _0x4a8bae=typeof _0x4c2743['offset']===_0x1602('0x18')&&typeof _0x4c2743['limit']===_0x1602('0x18');var _0x561792=_0x44e18a['count'];var _0x15cf4e=_0x4a8bae?0x0:_0x4c2743[_0x1602('0x19')];var _0x416073=_0x4a8bae?_0x44e18a[_0x1602('0x1a')]:_0x4c2743[_0x1602('0x19')]+_0x4c2743[_0x1602('0x1b')];var _0x41bfe2;if(_0x416073>=_0x561792){_0x416073=_0x561792;_0x41bfe2=0xc8;}else{_0x41bfe2=0xce;}_0x1b4df7['status'](_0x41bfe2);return _0x1b4df7[_0x1602('0x1c')]('Content-Range',_0x15cf4e+'-'+_0x416073+'/'+_0x561792)[_0x1602('0x17')](_0x44e18a);}return null;};}function patchUpdates(_0x161241){return function(_0x4d1da5){try{jsonpatch[_0x1602('0x1d')](_0x4d1da5,_0x161241,!![]);}catch(_0x28072d){return BPromise[_0x1602('0x1e')](_0x28072d);}return _0x4d1da5['save']();};}function saveUpdates(_0x3018c8,_0x114eb0){return function(_0x216854){if(_0x216854){return _0x216854[_0x1602('0x1f')](_0x3018c8)[_0x1602('0x20')](function(_0x265790){return _0x265790;});}return null;};}function removeEntity(_0x3cf3dc,_0x1edbd8){return function(_0x577a57){if(_0x577a57){return _0x577a57[_0x1602('0x21')]()['then'](function(){_0x3cf3dc[_0x1602('0x15')](0xcc)[_0x1602('0x16')]();});}};}function handleEntityNotFound(_0x39837a,_0x4dd95c){return function(_0x51e21d){if(!_0x51e21d){_0x39837a[_0x1602('0x14')](0x194);}return _0x51e21d;};}function handleError(_0x55945e,_0x2116b6){_0x2116b6=_0x2116b6||0x1f4;return function(_0x183fdf){logger['error'](_0x183fdf[_0x1602('0x22')]);if(_0x183fdf[_0x1602('0x23')]){delete _0x183fdf['name'];}_0x55945e[_0x1602('0x15')](_0x2116b6)[_0x1602('0x24')](_0x183fdf);};}exports[_0x1602('0x25')]=function(_0x49d761,_0x2f1984){var _0x202a4e={},_0x4dea90={},_0x8c5862={'count':0x0,'rows':[]};var _0x5a9787=_['map'](db['FreshdeskConfiguration'][_0x1602('0x26')],function(_0x3cb417){return{'name':_0x3cb417[_0x1602('0x27')],'type':_0x3cb417[_0x1602('0x28')][_0x1602('0x29')]};});_0x4dea90[_0x1602('0x2a')]=_['map'](_0x5a9787,_0x1602('0x23'));_0x4dea90[_0x1602('0x2b')]=_[_0x1602('0x2c')](_0x49d761[_0x1602('0x2b')]);_0x4dea90[_0x1602('0x2d')]=_['intersection'](_0x4dea90[_0x1602('0x2a')],_0x4dea90[_0x1602('0x2b')]);_0x202a4e[_0x1602('0x2e')]=_[_0x1602('0x2f')](_0x4dea90[_0x1602('0x2a')],qs[_0x1602('0x30')](_0x49d761['query'][_0x1602('0x30')]));_0x202a4e[_0x1602('0x2e')]=_0x202a4e[_0x1602('0x2e')][_0x1602('0x31')]?_0x202a4e['attributes']:_0x4dea90[_0x1602('0x2a')];if(!_0x49d761[_0x1602('0x2b')]['hasOwnProperty']('nolimit')){_0x202a4e[_0x1602('0x1b')]=qs[_0x1602('0x1b')](_0x49d761['query'][_0x1602('0x1b')]);_0x202a4e[_0x1602('0x19')]=qs[_0x1602('0x19')](_0x49d761['query'][_0x1602('0x19')]);}_0x202a4e[_0x1602('0x32')]=qs[_0x1602('0x33')](_0x49d761[_0x1602('0x2b')][_0x1602('0x33')]);_0x202a4e[_0x1602('0x34')]=qs[_0x1602('0x2d')](_[_0x1602('0x35')](_0x49d761[_0x1602('0x2b')],_0x4dea90['filters']),_0x5a9787);if(_0x49d761[_0x1602('0x2b')][_0x1602('0x36')]){_0x202a4e[_0x1602('0x34')]=_[_0x1602('0x37')](_0x202a4e[_0x1602('0x34')],{'$or':_[_0x1602('0x38')](_0x5a9787,function(_0x2123b9){if(_0x2123b9[_0x1602('0x28')]!=='VIRTUAL'){var _0x1eaa8d={};_0x1eaa8d[_0x2123b9[_0x1602('0x23')]]={'$like':'%'+_0x49d761[_0x1602('0x2b')][_0x1602('0x36')]+'%'};return _0x1eaa8d;}})});}_0x202a4e=_['merge']({},_0x202a4e,_0x49d761['options']);var _0x4585d0={'where':_0x202a4e['where']};return db[_0x1602('0x39')][_0x1602('0x1a')](_0x4585d0)[_0x1602('0x20')](function(_0x3d9484){_0x8c5862[_0x1602('0x1a')]=_0x3d9484;if(_0x49d761[_0x1602('0x2b')][_0x1602('0x3a')]){_0x202a4e['include']=[{'all':!![]}];}return db[_0x1602('0x39')][_0x1602('0x3b')](_0x202a4e);})['then'](function(_0x5226f4){_0x8c5862[_0x1602('0x3c')]=_0x5226f4;return _0x8c5862;})['then'](respondWithFilteredResult(_0x2f1984,_0x202a4e))[_0x1602('0x3d')](handleError(_0x2f1984,null));};exports[_0x1602('0x3e')]=function(_0x586cb,_0x1626b6){var _0x13fbeb={'raw':![],'where':{'id':_0x586cb[_0x1602('0x3f')]['id']}},_0x54811f={};_0x54811f[_0x1602('0x2a')]=_[_0x1602('0x2c')](db['FreshdeskConfiguration'][_0x1602('0x26')]);_0x54811f[_0x1602('0x2b')]=_[_0x1602('0x2c')](_0x586cb[_0x1602('0x2b')]);_0x54811f[_0x1602('0x2d')]=_['intersection'](_0x54811f[_0x1602('0x2a')],_0x54811f[_0x1602('0x2b')]);_0x13fbeb['attributes']=_[_0x1602('0x2f')](_0x54811f[_0x1602('0x2a')],qs['fields'](_0x586cb['query'][_0x1602('0x30')]));_0x13fbeb['attributes']=_0x13fbeb[_0x1602('0x2e')][_0x1602('0x31')]?_0x13fbeb['attributes']:_0x54811f['model'];if(_0x586cb['query'][_0x1602('0x3a')]){_0x13fbeb[_0x1602('0x40')]=[{'all':!![]}];}_0x13fbeb=_[_0x1602('0x37')]({},_0x13fbeb,_0x586cb['options']);return db[_0x1602('0x39')][_0x1602('0x41')](_0x13fbeb)[_0x1602('0x20')](handleEntityNotFound(_0x1626b6,null))['then'](respondWithResult(_0x1626b6,null))['catch'](handleError(_0x1626b6,null));};exports['create']=function(_0x3600a9,_0x2095ce){return db[_0x1602('0x39')][_0x1602('0x42')](_0x3600a9[_0x1602('0x43')],{})[_0x1602('0x20')](respondWithResult(_0x2095ce,0xc9))[_0x1602('0x3d')](handleError(_0x2095ce,null));};exports[_0x1602('0x1f')]=function(_0x241ad8,_0x1a5fc0){if(_0x241ad8[_0x1602('0x43')]['id']){delete _0x241ad8[_0x1602('0x43')]['id'];}return db[_0x1602('0x39')][_0x1602('0x41')]({'where':{'id':_0x241ad8[_0x1602('0x3f')]['id']}})[_0x1602('0x20')](handleEntityNotFound(_0x1a5fc0,null))[_0x1602('0x20')](saveUpdates(_0x241ad8[_0x1602('0x43')],null))[_0x1602('0x20')](respondWithResult(_0x1a5fc0,null))[_0x1602('0x3d')](handleError(_0x1a5fc0,null));};exports[_0x1602('0x21')]=function(_0x5f130b,_0xb8f86c){return db['FreshdeskConfiguration'][_0x1602('0x41')]({'where':{'id':_0x5f130b[_0x1602('0x3f')]['id']}})[_0x1602('0x20')](handleEntityNotFound(_0xb8f86c,null))[_0x1602('0x20')](removeEntity(_0xb8f86c,null))[_0x1602('0x3d')](handleError(_0xb8f86c,null));};exports[_0x1602('0x44')]=function(_0x2f3206,_0x3e48f3,_0x1c2b46){var _0x49f873={};var _0x528dac={};var _0x474d6b;var _0x363c99;return db[_0x1602('0x39')][_0x1602('0x45')]({'where':{'id':_0x2f3206[_0x1602('0x3f')]['id']}})[_0x1602('0x20')](handleEntityNotFound(_0x3e48f3,null))[_0x1602('0x20')](function(_0x4b1281){if(_0x4b1281){_0x474d6b=_0x4b1281;_0x528dac['model']=_[_0x1602('0x2c')](db[_0x1602('0x46')][_0x1602('0x26')]);_0x528dac[_0x1602('0x2b')]=_[_0x1602('0x2c')](_0x2f3206[_0x1602('0x2b')]);_0x528dac[_0x1602('0x2d')]=_[_0x1602('0x2f')](_0x528dac[_0x1602('0x2a')],_0x528dac[_0x1602('0x2b')]);_0x49f873[_0x1602('0x2e')]=_['intersection'](_0x528dac['model'],qs[_0x1602('0x30')](_0x2f3206['query'][_0x1602('0x30')]));_0x49f873[_0x1602('0x2e')]=_0x49f873[_0x1602('0x2e')][_0x1602('0x31')]?_0x49f873[_0x1602('0x2e')]:_0x528dac[_0x1602('0x2a')];_0x49f873[_0x1602('0x32')]=qs['sort'](_0x2f3206[_0x1602('0x2b')][_0x1602('0x33')]);_0x49f873[_0x1602('0x34')]=qs[_0x1602('0x2d')](_[_0x1602('0x35')](_0x2f3206[_0x1602('0x2b')],_0x528dac['filters']));if(_0x2f3206[_0x1602('0x2b')][_0x1602('0x36')]){_0x49f873[_0x1602('0x34')]=_[_0x1602('0x37')](_0x49f873['where'],{'$or':_['map'](_0x49f873[_0x1602('0x2e')],function(_0x2e2a5c){var _0x499fe7={};_0x499fe7[_0x2e2a5c]={'$like':'%'+_0x2f3206[_0x1602('0x2b')][_0x1602('0x36')]+'%'};return _0x499fe7;})});}_0x49f873=_['merge']({},_0x49f873,_0x2f3206[_0x1602('0x47')]);return _0x474d6b[_0x1602('0x44')](_0x49f873);}})[_0x1602('0x20')](function(_0x355e44){if(_0x355e44){_0x363c99=_0x355e44[_0x1602('0x31')];if(!_0x2f3206[_0x1602('0x2b')][_0x1602('0x48')](_0x1602('0x49'))){_0x49f873[_0x1602('0x1b')]=qs[_0x1602('0x1b')](_0x2f3206[_0x1602('0x2b')]['limit']);_0x49f873[_0x1602('0x19')]=qs[_0x1602('0x19')](_0x2f3206[_0x1602('0x2b')]['offset']);}return _0x474d6b[_0x1602('0x44')](_0x49f873);}})[_0x1602('0x20')](function(_0x47a252){if(_0x47a252){return _0x47a252?{'count':_0x363c99,'rows':_0x47a252}:null;}})['then'](respondWithResult(_0x3e48f3,null))[_0x1602('0x3d')](handleError(_0x3e48f3,null));};exports[_0x1602('0x4a')]=function(_0x47ca09,_0x428478,_0x447d7c){var _0x2ccbda={};var _0x17f4bb={};var _0x20e83b;var _0x1d3a98;return db[_0x1602('0x39')][_0x1602('0x45')]({'where':{'id':_0x47ca09[_0x1602('0x3f')]['id']}})[_0x1602('0x20')](handleEntityNotFound(_0x428478,null))[_0x1602('0x20')](function(_0x1a2e07){if(_0x1a2e07){_0x20e83b=_0x1a2e07;_0x17f4bb[_0x1602('0x2a')]=_[_0x1602('0x2c')](db[_0x1602('0x46')][_0x1602('0x26')]);_0x17f4bb['query']=_['keys'](_0x47ca09['query']);_0x17f4bb['filters']=_['intersection'](_0x17f4bb['model'],_0x17f4bb[_0x1602('0x2b')]);_0x2ccbda[_0x1602('0x2e')]=_[_0x1602('0x2f')](_0x17f4bb['model'],qs['fields'](_0x47ca09['query'][_0x1602('0x30')]));_0x2ccbda[_0x1602('0x2e')]=_0x2ccbda[_0x1602('0x2e')][_0x1602('0x31')]?_0x2ccbda[_0x1602('0x2e')]:_0x17f4bb[_0x1602('0x2a')];_0x2ccbda[_0x1602('0x32')]=qs[_0x1602('0x33')](_0x47ca09[_0x1602('0x2b')]['sort']);_0x2ccbda['where']=qs[_0x1602('0x2d')](_[_0x1602('0x35')](_0x47ca09[_0x1602('0x2b')],_0x17f4bb['filters']));if(_0x47ca09['query'][_0x1602('0x36')]){_0x2ccbda['where']=_[_0x1602('0x37')](_0x2ccbda[_0x1602('0x34')],{'$or':_['map'](_0x2ccbda[_0x1602('0x2e')],function(_0x4425e2){var _0x31abb1={};_0x31abb1[_0x4425e2]={'$like':'%'+_0x47ca09[_0x1602('0x2b')][_0x1602('0x36')]+'%'};return _0x31abb1;})});}_0x2ccbda=_[_0x1602('0x37')]({},_0x2ccbda,_0x47ca09[_0x1602('0x47')]);return _0x20e83b[_0x1602('0x4a')](_0x2ccbda);}})['then'](function(_0x350c5c){if(_0x350c5c){_0x1d3a98=_0x350c5c[_0x1602('0x31')];if(!_0x47ca09[_0x1602('0x2b')][_0x1602('0x48')](_0x1602('0x49'))){_0x2ccbda['limit']=qs['limit'](_0x47ca09['query']['limit']);_0x2ccbda[_0x1602('0x19')]=qs[_0x1602('0x19')](_0x47ca09[_0x1602('0x2b')]['offset']);}return _0x20e83b[_0x1602('0x4a')](_0x2ccbda);}})['then'](function(_0x56b705){if(_0x56b705){return _0x56b705?{'count':_0x1d3a98,'rows':_0x56b705}:null;}})[_0x1602('0x20')](respondWithResult(_0x428478,null))[_0x1602('0x3d')](handleError(_0x428478,null));};exports[_0x1602('0x4b')]=function(_0x5d9a58,_0x4817c6,_0xb4826){var _0xdeecdb={};var _0xc53bfa={};var _0xf9e58f;var _0x301f6c;return db[_0x1602('0x39')][_0x1602('0x45')]({'where':{'id':_0x5d9a58[_0x1602('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4817c6,null))[_0x1602('0x20')](function(_0x4e1079){if(_0x4e1079){_0xf9e58f=_0x4e1079;_0xc53bfa[_0x1602('0x2a')]=_['keys'](db[_0x1602('0x46')][_0x1602('0x26')]);_0xc53bfa[_0x1602('0x2b')]=_[_0x1602('0x2c')](_0x5d9a58[_0x1602('0x2b')]);_0xc53bfa['filters']=_[_0x1602('0x2f')](_0xc53bfa[_0x1602('0x2a')],_0xc53bfa['query']);_0xdeecdb[_0x1602('0x2e')]=_[_0x1602('0x2f')](_0xc53bfa[_0x1602('0x2a')],qs[_0x1602('0x30')](_0x5d9a58[_0x1602('0x2b')][_0x1602('0x30')]));_0xdeecdb['attributes']=_0xdeecdb[_0x1602('0x2e')][_0x1602('0x31')]?_0xdeecdb[_0x1602('0x2e')]:_0xc53bfa[_0x1602('0x2a')];_0xdeecdb[_0x1602('0x32')]=qs['sort'](_0x5d9a58[_0x1602('0x2b')][_0x1602('0x33')]);_0xdeecdb[_0x1602('0x34')]=qs[_0x1602('0x2d')](_[_0x1602('0x35')](_0x5d9a58[_0x1602('0x2b')],_0xc53bfa[_0x1602('0x2d')]));if(_0x5d9a58[_0x1602('0x2b')][_0x1602('0x36')]){_0xdeecdb[_0x1602('0x34')]=_[_0x1602('0x37')](_0xdeecdb['where'],{'$or':_[_0x1602('0x38')](_0xdeecdb[_0x1602('0x2e')],function(_0xc32b1b){var _0x5bb0e8={};_0x5bb0e8[_0xc32b1b]={'$like':'%'+_0x5d9a58[_0x1602('0x2b')][_0x1602('0x36')]+'%'};return _0x5bb0e8;})});}_0xdeecdb=_[_0x1602('0x37')]({},_0xdeecdb,_0x5d9a58[_0x1602('0x47')]);return _0xf9e58f['getDescriptions'](_0xdeecdb);}})['then'](function(_0x45cccf){if(_0x45cccf){_0x301f6c=_0x45cccf[_0x1602('0x31')];if(!_0x5d9a58[_0x1602('0x2b')][_0x1602('0x48')](_0x1602('0x49'))){_0xdeecdb[_0x1602('0x1b')]=qs['limit'](_0x5d9a58['query'][_0x1602('0x1b')]);_0xdeecdb[_0x1602('0x19')]=qs[_0x1602('0x19')](_0x5d9a58[_0x1602('0x2b')][_0x1602('0x19')]);}return _0xf9e58f[_0x1602('0x4b')](_0xdeecdb);}})[_0x1602('0x20')](function(_0xd973a2){if(_0xd973a2){return _0xd973a2?{'count':_0x301f6c,'rows':_0xd973a2}:null;}})[_0x1602('0x20')](respondWithResult(_0x4817c6,null))[_0x1602('0x3d')](handleError(_0x4817c6,null));};exports[_0x1602('0x4c')]=function(_0x1aa405,_0x3a48d7,_0x1c963e){var _0x5c0055={};var _0x18d1c6={};var _0x469ae3;var _0x30a894;return db[_0x1602('0x39')]['findOne']({'where':{'id':_0x1aa405[_0x1602('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3a48d7,null))[_0x1602('0x20')](function(_0x3c2f01){if(_0x3c2f01){_0x469ae3=_0x3c2f01;_0x18d1c6[_0x1602('0x2a')]=_[_0x1602('0x2c')](db[_0x1602('0x4d')][_0x1602('0x26')]);_0x18d1c6['query']=_[_0x1602('0x2c')](_0x1aa405[_0x1602('0x2b')]);_0x18d1c6[_0x1602('0x2d')]=_[_0x1602('0x2f')](_0x18d1c6['model'],_0x18d1c6['query']);_0x5c0055[_0x1602('0x2e')]=_[_0x1602('0x2f')](_0x18d1c6[_0x1602('0x2a')],qs['fields'](_0x1aa405[_0x1602('0x2b')][_0x1602('0x30')]));_0x5c0055[_0x1602('0x2e')]=_0x5c0055['attributes'][_0x1602('0x31')]?_0x5c0055[_0x1602('0x2e')]:_0x18d1c6[_0x1602('0x2a')];_0x5c0055[_0x1602('0x32')]=qs[_0x1602('0x33')](_0x1aa405[_0x1602('0x2b')]['sort']);_0x5c0055['where']=qs[_0x1602('0x2d')](_[_0x1602('0x35')](_0x1aa405[_0x1602('0x2b')],_0x18d1c6[_0x1602('0x2d')]));if(_0x1aa405[_0x1602('0x2b')][_0x1602('0x36')]){_0x5c0055[_0x1602('0x34')]=_[_0x1602('0x37')](_0x5c0055[_0x1602('0x34')],{'$or':_[_0x1602('0x38')](_0x5c0055[_0x1602('0x2e')],function(_0x555dab){var _0x47ab7a={};_0x47ab7a[_0x555dab]={'$like':'%'+_0x1aa405[_0x1602('0x2b')]['filter']+'%'};return _0x47ab7a;})});}_0x5c0055=_[_0x1602('0x37')]({},_0x5c0055,_0x1aa405[_0x1602('0x47')]);return _0x469ae3['getTags'](_0x5c0055);}})[_0x1602('0x20')](function(_0x419a90){if(_0x419a90){_0x30a894=_0x419a90[_0x1602('0x31')];if(!_0x1aa405[_0x1602('0x2b')][_0x1602('0x48')](_0x1602('0x49'))){_0x5c0055['limit']=qs[_0x1602('0x1b')](_0x1aa405['query'][_0x1602('0x1b')]);_0x5c0055[_0x1602('0x19')]=qs[_0x1602('0x19')](_0x1aa405['query']['offset']);}return _0x469ae3[_0x1602('0x4c')](_0x5c0055);}})['then'](function(_0x48ef80){if(_0x48ef80){return _0x48ef80?{'count':_0x30a894,'rows':_0x48ef80}:null;}})[_0x1602('0x20')](respondWithResult(_0x3a48d7,null))[_0x1602('0x3d')](handleError(_0x3a48d7,null));};exports[_0x1602('0x4e')]=function(_0x579959,_0x2bbe85,_0x2b3673){if(_0x579959[_0x1602('0x43')]['id']){delete _0x579959[_0x1602('0x43')]['id'];}return db[_0x1602('0x39')][_0x1602('0x45')]({'where':{'id':_0x579959[_0x1602('0x3f')]['id']}})[_0x1602('0x20')](handleEntityNotFound(_0x2bbe85,null))['then'](function(_0x1e385a){if(_0x1e385a){return _0x1e385a[_0x1602('0x4e')](_0x579959[_0x1602('0x43')][_0x1602('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x2bbe85,null))[_0x1602('0x3d')](handleError(_0x2bbe85,null));}; \ No newline at end of file +var _0xb70f=['../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x161e02,_0x94171b){var _0xfca8f4=function(_0x242cd5){while(--_0x242cd5){_0x161e02['push'](_0x161e02['shift']());}};_0xfca8f4(++_0x94171b);}(_0xb70f,0x13a));var _0xfb70=function(_0x1e0394,_0x2572e0){_0x1e0394=_0x1e0394-0x0;var _0x2834ff=_0xb70f[_0x1e0394];return _0x2834ff;};'use strict';var emlformat=require(_0xfb70('0x0'));var rimraf=require(_0xfb70('0x1'));var zipdir=require(_0xfb70('0x2'));var jsonpatch=require(_0xfb70('0x3'));var rp=require('request-promise');var moment=require(_0xfb70('0x4'));var BPromise=require(_0xfb70('0x5'));var Mustache=require(_0xfb70('0x6'));var util=require(_0xfb70('0x7'));var path=require('path');var sox=require(_0xfb70('0x8'));var csv=require(_0xfb70('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb70('0xa'));var _=require(_0xfb70('0xb'));var squel=require(_0xfb70('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfb70('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfb70('0xe'));var Papa=require(_0xfb70('0xf'));var Redis=require(_0xfb70('0x10'));var authService=require(_0xfb70('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfb70('0x12'));var hardwareService=require(_0xfb70('0x13'));var logger=require('../../config/logger')(_0xfb70('0x14'));var utils=require('../../config/utils');var config=require(_0xfb70('0x15'));var licenseUtil=require(_0xfb70('0x16'));var db=require(_0xfb70('0x17'))['db'];function respondWithStatusCode(_0x1ba515,_0x479acc){_0x479acc=_0x479acc||0xcc;return function(_0x5b4497){if(_0x5b4497){return _0x1ba515['sendStatus'](_0x479acc);}return _0x1ba515[_0xfb70('0x18')](_0x479acc)['end']();};}function respondWithResult(_0x54f9ef,_0x45d0d1){_0x45d0d1=_0x45d0d1||0xc8;return function(_0x159d82){if(_0x159d82){return _0x54f9ef['status'](_0x45d0d1)[_0xfb70('0x19')](_0x159d82);}};}function respondWithFilteredResult(_0x3f3908,_0x10b62c){return function(_0x48c035){if(_0x48c035){var _0x599100=typeof _0x10b62c[_0xfb70('0x1a')]===_0xfb70('0x1b')&&typeof _0x10b62c[_0xfb70('0x1c')]===_0xfb70('0x1b');var _0x1fa608=_0x48c035[_0xfb70('0x1d')];var _0x223ad1=_0x599100?0x0:_0x10b62c[_0xfb70('0x1a')];var _0x5d4e6d=_0x599100?_0x48c035[_0xfb70('0x1d')]:_0x10b62c[_0xfb70('0x1a')]+_0x10b62c['limit'];var _0x4fa691;if(_0x5d4e6d>=_0x1fa608){_0x5d4e6d=_0x1fa608;_0x4fa691=0xc8;}else{_0x4fa691=0xce;}_0x3f3908[_0xfb70('0x18')](_0x4fa691);return _0x3f3908['set']('Content-Range',_0x223ad1+'-'+_0x5d4e6d+'/'+_0x1fa608)['json'](_0x48c035);}return null;};}function patchUpdates(_0x7fc768){return function(_0x85c243){try{jsonpatch[_0xfb70('0x1e')](_0x85c243,_0x7fc768,!![]);}catch(_0x56113e){return BPromise[_0xfb70('0x1f')](_0x56113e);}return _0x85c243[_0xfb70('0x20')]();};}function saveUpdates(_0x85ca21,_0x26f15f){return function(_0x1c4803){if(_0x1c4803){return _0x1c4803[_0xfb70('0x21')](_0x85ca21)['then'](function(_0x1f5480){return _0x1f5480;});}return null;};}function removeEntity(_0x23110f,_0x2622d5){return function(_0x5be9c2){if(_0x5be9c2){return _0x5be9c2['destroy']()[_0xfb70('0x22')](function(){_0x23110f[_0xfb70('0x18')](0xcc)[_0xfb70('0x23')]();});}};}function handleEntityNotFound(_0xb6a102,_0x45de05){return function(_0x3cd7c9){if(!_0x3cd7c9){_0xb6a102[_0xfb70('0x24')](0x194);}return _0x3cd7c9;};}function handleError(_0x438d4f,_0x5805d3){_0x5805d3=_0x5805d3||0x1f4;return function(_0x5af42a){logger['error'](_0x5af42a[_0xfb70('0x25')]);if(_0x5af42a['name']){delete _0x5af42a[_0xfb70('0x26')];}_0x438d4f[_0xfb70('0x18')](_0x5805d3)[_0xfb70('0x27')](_0x5af42a);};}exports[_0xfb70('0x28')]=function(_0x26069f,_0x2de7ec){var _0x28084f={},_0x23a589={},_0x53a9e1={'count':0x0,'rows':[]};var _0x4054bd=_[_0xfb70('0x29')](db[_0xfb70('0x2a')][_0xfb70('0x2b')],function(_0x2234e9){return{'name':_0x2234e9['fieldName'],'type':_0x2234e9[_0xfb70('0x2c')][_0xfb70('0x2d')]};});_0x23a589['model']=_[_0xfb70('0x29')](_0x4054bd,'name');_0x23a589['query']=_[_0xfb70('0x2e')](_0x26069f[_0xfb70('0x2f')]);_0x23a589[_0xfb70('0x30')]=_[_0xfb70('0x31')](_0x23a589[_0xfb70('0x32')],_0x23a589['query']);_0x28084f['attributes']=_[_0xfb70('0x31')](_0x23a589['model'],qs[_0xfb70('0x33')](_0x26069f[_0xfb70('0x2f')][_0xfb70('0x33')]));_0x28084f[_0xfb70('0x34')]=_0x28084f[_0xfb70('0x34')][_0xfb70('0x35')]?_0x28084f[_0xfb70('0x34')]:_0x23a589[_0xfb70('0x32')];if(!_0x26069f[_0xfb70('0x2f')]['hasOwnProperty'](_0xfb70('0x36'))){_0x28084f[_0xfb70('0x1c')]=qs[_0xfb70('0x1c')](_0x26069f[_0xfb70('0x2f')][_0xfb70('0x1c')]);_0x28084f[_0xfb70('0x1a')]=qs[_0xfb70('0x1a')](_0x26069f[_0xfb70('0x2f')]['offset']);}_0x28084f[_0xfb70('0x37')]=qs[_0xfb70('0x38')](_0x26069f['query'][_0xfb70('0x38')]);_0x28084f['where']=qs[_0xfb70('0x30')](_[_0xfb70('0x39')](_0x26069f[_0xfb70('0x2f')],_0x23a589[_0xfb70('0x30')]),_0x4054bd);if(_0x26069f[_0xfb70('0x2f')][_0xfb70('0x3a')]){_0x28084f[_0xfb70('0x3b')]=_[_0xfb70('0x3c')](_0x28084f['where'],{'$or':_[_0xfb70('0x29')](_0x4054bd,function(_0xf3d441){if(_0xf3d441[_0xfb70('0x2c')]!==_0xfb70('0x3d')){var _0x41dbac={};_0x41dbac[_0xf3d441[_0xfb70('0x26')]]={'$like':'%'+_0x26069f[_0xfb70('0x2f')][_0xfb70('0x3a')]+'%'};return _0x41dbac;}})});}_0x28084f=_[_0xfb70('0x3c')]({},_0x28084f,_0x26069f[_0xfb70('0x3e')]);var _0x3c9cd4={'where':_0x28084f[_0xfb70('0x3b')]};return db[_0xfb70('0x2a')][_0xfb70('0x1d')](_0x3c9cd4)[_0xfb70('0x22')](function(_0x1e776b){_0x53a9e1['count']=_0x1e776b;if(_0x26069f[_0xfb70('0x2f')][_0xfb70('0x3f')]){_0x28084f['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xfb70('0x40')](_0x28084f);})['then'](function(_0x1d61de){_0x53a9e1[_0xfb70('0x41')]=_0x1d61de;return _0x53a9e1;})[_0xfb70('0x22')](respondWithFilteredResult(_0x2de7ec,_0x28084f))[_0xfb70('0x42')](handleError(_0x2de7ec,null));};exports[_0xfb70('0x43')]=function(_0x667d1b,_0x5315a7){var _0x1fed9f={'raw':![],'where':{'id':_0x667d1b[_0xfb70('0x44')]['id']}},_0x249589={};_0x249589[_0xfb70('0x32')]=_['keys'](db[_0xfb70('0x2a')]['rawAttributes']);_0x249589[_0xfb70('0x2f')]=_[_0xfb70('0x2e')](_0x667d1b[_0xfb70('0x2f')]);_0x249589[_0xfb70('0x30')]=_[_0xfb70('0x31')](_0x249589['model'],_0x249589[_0xfb70('0x2f')]);_0x1fed9f['attributes']=_[_0xfb70('0x31')](_0x249589['model'],qs[_0xfb70('0x33')](_0x667d1b[_0xfb70('0x2f')][_0xfb70('0x33')]));_0x1fed9f[_0xfb70('0x34')]=_0x1fed9f[_0xfb70('0x34')][_0xfb70('0x35')]?_0x1fed9f[_0xfb70('0x34')]:_0x249589[_0xfb70('0x32')];if(_0x667d1b[_0xfb70('0x2f')][_0xfb70('0x3f')]){_0x1fed9f[_0xfb70('0x45')]=[{'all':!![]}];}_0x1fed9f=_[_0xfb70('0x3c')]({},_0x1fed9f,_0x667d1b[_0xfb70('0x3e')]);return db[_0xfb70('0x2a')][_0xfb70('0x46')](_0x1fed9f)[_0xfb70('0x22')](handleEntityNotFound(_0x5315a7,null))[_0xfb70('0x22')](respondWithResult(_0x5315a7,null))[_0xfb70('0x42')](handleError(_0x5315a7,null));};exports[_0xfb70('0x47')]=function(_0x3b6012,_0x1d403b){return db[_0xfb70('0x2a')]['create'](_0x3b6012[_0xfb70('0x48')],{})[_0xfb70('0x22')](respondWithResult(_0x1d403b,0xc9))['catch'](handleError(_0x1d403b,null));};exports[_0xfb70('0x21')]=function(_0x2f7944,_0x2ec665){if(_0x2f7944[_0xfb70('0x48')]['id']){delete _0x2f7944[_0xfb70('0x48')]['id'];}return db[_0xfb70('0x2a')][_0xfb70('0x46')]({'where':{'id':_0x2f7944[_0xfb70('0x44')]['id']}})[_0xfb70('0x22')](handleEntityNotFound(_0x2ec665,null))[_0xfb70('0x22')](saveUpdates(_0x2f7944[_0xfb70('0x48')],null))[_0xfb70('0x22')](respondWithResult(_0x2ec665,null))[_0xfb70('0x42')](handleError(_0x2ec665,null));};exports[_0xfb70('0x49')]=function(_0x1ba1e0,_0x2d4b1e){return db[_0xfb70('0x2a')]['find']({'where':{'id':_0x1ba1e0[_0xfb70('0x44')]['id']}})[_0xfb70('0x22')](handleEntityNotFound(_0x2d4b1e,null))[_0xfb70('0x22')](removeEntity(_0x2d4b1e,null))[_0xfb70('0x42')](handleError(_0x2d4b1e,null));};exports[_0xfb70('0x4a')]=function(_0x116cd1,_0x1ac9f6,_0x562f05){var _0x2cbd89={};var _0x34baa7={};var _0x4bc86e;var _0x29bf43;return db[_0xfb70('0x2a')][_0xfb70('0x4b')]({'where':{'id':_0x116cd1['params']['id']}})[_0xfb70('0x22')](handleEntityNotFound(_0x1ac9f6,null))[_0xfb70('0x22')](function(_0x1d8e13){if(_0x1d8e13){_0x4bc86e=_0x1d8e13;_0x34baa7['model']=_[_0xfb70('0x2e')](db[_0xfb70('0x4c')][_0xfb70('0x2b')]);_0x34baa7[_0xfb70('0x2f')]=_[_0xfb70('0x2e')](_0x116cd1[_0xfb70('0x2f')]);_0x34baa7['filters']=_[_0xfb70('0x31')](_0x34baa7[_0xfb70('0x32')],_0x34baa7[_0xfb70('0x2f')]);_0x2cbd89[_0xfb70('0x34')]=_[_0xfb70('0x31')](_0x34baa7[_0xfb70('0x32')],qs[_0xfb70('0x33')](_0x116cd1[_0xfb70('0x2f')][_0xfb70('0x33')]));_0x2cbd89[_0xfb70('0x34')]=_0x2cbd89[_0xfb70('0x34')]['length']?_0x2cbd89['attributes']:_0x34baa7['model'];_0x2cbd89[_0xfb70('0x37')]=qs[_0xfb70('0x38')](_0x116cd1[_0xfb70('0x2f')][_0xfb70('0x38')]);_0x2cbd89[_0xfb70('0x3b')]=qs[_0xfb70('0x30')](_['pick'](_0x116cd1['query'],_0x34baa7['filters']));if(_0x116cd1[_0xfb70('0x2f')][_0xfb70('0x3a')]){_0x2cbd89[_0xfb70('0x3b')]=_['merge'](_0x2cbd89[_0xfb70('0x3b')],{'$or':_[_0xfb70('0x29')](_0x2cbd89[_0xfb70('0x34')],function(_0x466206){var _0x427837={};_0x427837[_0x466206]={'$like':'%'+_0x116cd1['query'][_0xfb70('0x3a')]+'%'};return _0x427837;})});}_0x2cbd89=_['merge']({},_0x2cbd89,_0x116cd1[_0xfb70('0x3e')]);return _0x4bc86e[_0xfb70('0x4a')](_0x2cbd89);}})[_0xfb70('0x22')](function(_0xa89a8e){if(_0xa89a8e){_0x29bf43=_0xa89a8e['length'];if(!_0x116cd1['query'][_0xfb70('0x4d')](_0xfb70('0x36'))){_0x2cbd89['limit']=qs[_0xfb70('0x1c')](_0x116cd1[_0xfb70('0x2f')][_0xfb70('0x1c')]);_0x2cbd89[_0xfb70('0x1a')]=qs[_0xfb70('0x1a')](_0x116cd1[_0xfb70('0x2f')][_0xfb70('0x1a')]);}return _0x4bc86e[_0xfb70('0x4a')](_0x2cbd89);}})['then'](function(_0x2283df){if(_0x2283df){return _0x2283df?{'count':_0x29bf43,'rows':_0x2283df}:null;}})[_0xfb70('0x22')](respondWithResult(_0x1ac9f6,null))[_0xfb70('0x42')](handleError(_0x1ac9f6,null));};exports[_0xfb70('0x4e')]=function(_0xdc581b,_0x3c6012,_0x463de9){var _0x219e5d={};var _0x1912c0={};var _0x2c516e;var _0x1b39ac;return db['FreshdeskConfiguration'][_0xfb70('0x4b')]({'where':{'id':_0xdc581b['params']['id']}})[_0xfb70('0x22')](handleEntityNotFound(_0x3c6012,null))[_0xfb70('0x22')](function(_0x59592b){if(_0x59592b){_0x2c516e=_0x59592b;_0x1912c0[_0xfb70('0x32')]=_[_0xfb70('0x2e')](db[_0xfb70('0x4c')]['rawAttributes']);_0x1912c0[_0xfb70('0x2f')]=_[_0xfb70('0x2e')](_0xdc581b['query']);_0x1912c0['filters']=_[_0xfb70('0x31')](_0x1912c0[_0xfb70('0x32')],_0x1912c0[_0xfb70('0x2f')]);_0x219e5d['attributes']=_['intersection'](_0x1912c0['model'],qs[_0xfb70('0x33')](_0xdc581b['query'][_0xfb70('0x33')]));_0x219e5d['attributes']=_0x219e5d['attributes']['length']?_0x219e5d['attributes']:_0x1912c0[_0xfb70('0x32')];_0x219e5d[_0xfb70('0x37')]=qs[_0xfb70('0x38')](_0xdc581b[_0xfb70('0x2f')][_0xfb70('0x38')]);_0x219e5d[_0xfb70('0x3b')]=qs['filters'](_[_0xfb70('0x39')](_0xdc581b[_0xfb70('0x2f')],_0x1912c0[_0xfb70('0x30')]));if(_0xdc581b[_0xfb70('0x2f')][_0xfb70('0x3a')]){_0x219e5d[_0xfb70('0x3b')]=_[_0xfb70('0x3c')](_0x219e5d[_0xfb70('0x3b')],{'$or':_['map'](_0x219e5d['attributes'],function(_0x3495f9){var _0x2608fa={};_0x2608fa[_0x3495f9]={'$like':'%'+_0xdc581b['query']['filter']+'%'};return _0x2608fa;})});}_0x219e5d=_[_0xfb70('0x3c')]({},_0x219e5d,_0xdc581b[_0xfb70('0x3e')]);return _0x2c516e['getSubjects'](_0x219e5d);}})['then'](function(_0x15a328){if(_0x15a328){_0x1b39ac=_0x15a328['length'];if(!_0xdc581b[_0xfb70('0x2f')][_0xfb70('0x4d')](_0xfb70('0x36'))){_0x219e5d['limit']=qs['limit'](_0xdc581b[_0xfb70('0x2f')][_0xfb70('0x1c')]);_0x219e5d['offset']=qs[_0xfb70('0x1a')](_0xdc581b[_0xfb70('0x2f')][_0xfb70('0x1a')]);}return _0x2c516e[_0xfb70('0x4e')](_0x219e5d);}})[_0xfb70('0x22')](function(_0x1a6d0e){if(_0x1a6d0e){return _0x1a6d0e?{'count':_0x1b39ac,'rows':_0x1a6d0e}:null;}})['then'](respondWithResult(_0x3c6012,null))[_0xfb70('0x42')](handleError(_0x3c6012,null));};exports['getDescriptions']=function(_0x24511e,_0x4df9af,_0x192a3a){var _0x331eb5={};var _0x98523c={};var _0xcb50d5;var _0x27861a;return db[_0xfb70('0x2a')][_0xfb70('0x4b')]({'where':{'id':_0x24511e[_0xfb70('0x44')]['id']}})[_0xfb70('0x22')](handleEntityNotFound(_0x4df9af,null))[_0xfb70('0x22')](function(_0x3297f7){if(_0x3297f7){_0xcb50d5=_0x3297f7;_0x98523c[_0xfb70('0x32')]=_[_0xfb70('0x2e')](db['FreshdeskField'][_0xfb70('0x2b')]);_0x98523c['query']=_[_0xfb70('0x2e')](_0x24511e[_0xfb70('0x2f')]);_0x98523c[_0xfb70('0x30')]=_[_0xfb70('0x31')](_0x98523c['model'],_0x98523c[_0xfb70('0x2f')]);_0x331eb5['attributes']=_[_0xfb70('0x31')](_0x98523c['model'],qs['fields'](_0x24511e[_0xfb70('0x2f')][_0xfb70('0x33')]));_0x331eb5['attributes']=_0x331eb5[_0xfb70('0x34')][_0xfb70('0x35')]?_0x331eb5['attributes']:_0x98523c[_0xfb70('0x32')];_0x331eb5[_0xfb70('0x37')]=qs[_0xfb70('0x38')](_0x24511e['query'][_0xfb70('0x38')]);_0x331eb5[_0xfb70('0x3b')]=qs[_0xfb70('0x30')](_[_0xfb70('0x39')](_0x24511e[_0xfb70('0x2f')],_0x98523c[_0xfb70('0x30')]));if(_0x24511e['query'][_0xfb70('0x3a')]){_0x331eb5[_0xfb70('0x3b')]=_[_0xfb70('0x3c')](_0x331eb5[_0xfb70('0x3b')],{'$or':_['map'](_0x331eb5[_0xfb70('0x34')],function(_0x1201d6){var _0x731fe1={};_0x731fe1[_0x1201d6]={'$like':'%'+_0x24511e[_0xfb70('0x2f')]['filter']+'%'};return _0x731fe1;})});}_0x331eb5=_[_0xfb70('0x3c')]({},_0x331eb5,_0x24511e[_0xfb70('0x3e')]);return _0xcb50d5[_0xfb70('0x4f')](_0x331eb5);}})['then'](function(_0x3d246b){if(_0x3d246b){_0x27861a=_0x3d246b[_0xfb70('0x35')];if(!_0x24511e[_0xfb70('0x2f')][_0xfb70('0x4d')](_0xfb70('0x36'))){_0x331eb5[_0xfb70('0x1c')]=qs[_0xfb70('0x1c')](_0x24511e['query'][_0xfb70('0x1c')]);_0x331eb5[_0xfb70('0x1a')]=qs[_0xfb70('0x1a')](_0x24511e[_0xfb70('0x2f')][_0xfb70('0x1a')]);}return _0xcb50d5[_0xfb70('0x4f')](_0x331eb5);}})[_0xfb70('0x22')](function(_0x37731d){if(_0x37731d){return _0x37731d?{'count':_0x27861a,'rows':_0x37731d}:null;}})[_0xfb70('0x22')](respondWithResult(_0x4df9af,null))['catch'](handleError(_0x4df9af,null));};exports['getTags']=function(_0x354f73,_0x5ec863,_0x57a738){var _0x31cbce={};var _0x3c5844={};var _0x5f5d63;var _0x508117;return db[_0xfb70('0x2a')][_0xfb70('0x4b')]({'where':{'id':_0x354f73[_0xfb70('0x44')]['id']}})[_0xfb70('0x22')](handleEntityNotFound(_0x5ec863,null))[_0xfb70('0x22')](function(_0x220258){if(_0x220258){_0x5f5d63=_0x220258;_0x3c5844[_0xfb70('0x32')]=_[_0xfb70('0x2e')](db[_0xfb70('0x50')][_0xfb70('0x2b')]);_0x3c5844[_0xfb70('0x2f')]=_[_0xfb70('0x2e')](_0x354f73[_0xfb70('0x2f')]);_0x3c5844['filters']=_[_0xfb70('0x31')](_0x3c5844[_0xfb70('0x32')],_0x3c5844[_0xfb70('0x2f')]);_0x31cbce[_0xfb70('0x34')]=_['intersection'](_0x3c5844[_0xfb70('0x32')],qs[_0xfb70('0x33')](_0x354f73[_0xfb70('0x2f')][_0xfb70('0x33')]));_0x31cbce['attributes']=_0x31cbce[_0xfb70('0x34')][_0xfb70('0x35')]?_0x31cbce[_0xfb70('0x34')]:_0x3c5844[_0xfb70('0x32')];_0x31cbce[_0xfb70('0x37')]=qs[_0xfb70('0x38')](_0x354f73[_0xfb70('0x2f')]['sort']);_0x31cbce[_0xfb70('0x3b')]=qs[_0xfb70('0x30')](_[_0xfb70('0x39')](_0x354f73['query'],_0x3c5844[_0xfb70('0x30')]));if(_0x354f73['query'][_0xfb70('0x3a')]){_0x31cbce[_0xfb70('0x3b')]=_[_0xfb70('0x3c')](_0x31cbce[_0xfb70('0x3b')],{'$or':_[_0xfb70('0x29')](_0x31cbce[_0xfb70('0x34')],function(_0x583904){var _0x714af8={};_0x714af8[_0x583904]={'$like':'%'+_0x354f73[_0xfb70('0x2f')][_0xfb70('0x3a')]+'%'};return _0x714af8;})});}_0x31cbce=_['merge']({},_0x31cbce,_0x354f73['options']);return _0x5f5d63[_0xfb70('0x51')](_0x31cbce);}})[_0xfb70('0x22')](function(_0x50f577){if(_0x50f577){_0x508117=_0x50f577[_0xfb70('0x35')];if(!_0x354f73[_0xfb70('0x2f')]['hasOwnProperty'](_0xfb70('0x36'))){_0x31cbce[_0xfb70('0x1c')]=qs['limit'](_0x354f73[_0xfb70('0x2f')][_0xfb70('0x1c')]);_0x31cbce[_0xfb70('0x1a')]=qs[_0xfb70('0x1a')](_0x354f73[_0xfb70('0x2f')]['offset']);}return _0x5f5d63[_0xfb70('0x51')](_0x31cbce);}})[_0xfb70('0x22')](function(_0x467d61){if(_0x467d61){return _0x467d61?{'count':_0x508117,'rows':_0x467d61}:null;}})[_0xfb70('0x22')](respondWithResult(_0x5ec863,null))[_0xfb70('0x42')](handleError(_0x5ec863,null));};exports['setTags']=function(_0x9c4fb4,_0x4272cc,_0xbf27e2){if(_0x9c4fb4[_0xfb70('0x48')]['id']){delete _0x9c4fb4['body']['id'];}return db[_0xfb70('0x2a')]['findOne']({'where':{'id':_0x9c4fb4[_0xfb70('0x44')]['id']}})['then'](handleEntityNotFound(_0x4272cc,null))[_0xfb70('0x22')](function(_0x5352de){if(_0x5352de){return _0x5352de[_0xfb70('0x52')](_0x9c4fb4[_0xfb70('0x48')][_0xfb70('0x53')]||[]);}return null;})[_0xfb70('0x22')](respondWithResult(_0x4272cc,null))[_0xfb70('0x42')](handleError(_0x4272cc,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3926605..f14ebb7 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 _0xc079=['exports','define','FreshdeskConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x362cc3,_0x246771){var _0x409b3b=function(_0x1b3979){while(--_0x1b3979){_0x362cc3['push'](_0x362cc3['shift']());}};_0x409b3b(++_0x246771);}(_0xc079,0x17c));var _0x9c07=function(_0x536280,_0x432d96){_0x536280=_0x536280-0x0;var _0x58845c=_0xc079[_0x536280];return _0x58845c;};'use strict';var _=require(_0x9c07('0x0'));var util=require(_0x9c07('0x1'));var logger=require('../../config/logger')(_0x9c07('0x2'));var moment=require(_0x9c07('0x3'));var BPromise=require(_0x9c07('0x4'));var rp=require(_0x9c07('0x5'));var fs=require('fs');var path=require(_0x9c07('0x6'));var rimraf=require(_0x9c07('0x7'));var config=require(_0x9c07('0x8'));var attributes=require(_0x9c07('0x9'));module[_0x9c07('0xa')]=function(_0x19b379,_0x3637c3){return _0x19b379[_0x9c07('0xb')](_0x9c07('0xc'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa34f=['int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','FreshdeskConfiguration'];(function(_0x267ce9,_0x1dfacf){var _0x368bf7=function(_0x33e199){while(--_0x33e199){_0x267ce9['push'](_0x267ce9['shift']());}};_0x368bf7(++_0x1dfacf);}(_0xa34f,0x151));var _0xfa34=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0xa34f[_0x2eb3db];return _0x358f33;};'use strict';var _=require(_0xfa34('0x0'));var util=require(_0xfa34('0x1'));var logger=require(_0xfa34('0x2'))(_0xfa34('0x3'));var moment=require(_0xfa34('0x4'));var BPromise=require(_0xfa34('0x5'));var rp=require(_0xfa34('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa34('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xfa34('0x8')]=function(_0x58c895,_0x248ee7){return _0x58c895[_0xfa34('0x9')](_0xfa34('0xa'),attributes,{'tableName':_0xfa34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 5c85cfc..2c27545 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 _0xcd4c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4de4f9,_0x380d76){var _0x1b894d=function(_0xe6aeb7){while(--_0xe6aeb7){_0x4de4f9['push'](_0x4de4f9['shift']());}};_0x1b894d(++_0x380d76);}(_0xcd4c,0x161));var _0xccd4=function(_0x3e76a3,_0x28373e){_0x3e76a3=_0x3e76a3-0x0;var _0x2c67d2=_0xcd4c[_0x3e76a3];return _0x2c67d2;};'use strict';var _=require(_0xccd4('0x0'));var util=require(_0xccd4('0x1'));var moment=require(_0xccd4('0x2'));var BPromise=require(_0xccd4('0x3'));var rs=require(_0xccd4('0x4'));var fs=require('fs');var Redis=require(_0xccd4('0x5'));var db=require(_0xccd4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xccd4('0x7'))(_0xccd4('0x8'));var config=require(_0xccd4('0x9'));var jayson=require(_0xccd4('0xa'));var client=jayson[_0xccd4('0xb')][_0xccd4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5db9be,_0x5a301d,_0x3a9d06){return new BPromise(function(_0x5c5017,_0x474094){return client['request'](_0x5db9be,_0x3a9d06)[_0xccd4('0xd')](function(_0x188af9){logger['info'](_0xccd4('0xe'),_0x5a301d,'request\x20sent');logger[_0xccd4('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5a301d,_0xccd4('0x10'),JSON[_0xccd4('0x11')](_0x188af9));if(_0x188af9[_0xccd4('0x12')]){if(_0x188af9[_0xccd4('0x12')][_0xccd4('0x13')]===0x1f4){logger[_0xccd4('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5a301d,_0x188af9[_0xccd4('0x12')][_0xccd4('0x14')]);return _0x474094(_0x188af9[_0xccd4('0x12')][_0xccd4('0x14')]);}logger[_0xccd4('0x12')](_0xccd4('0xe'),_0x5a301d,_0x188af9[_0xccd4('0x12')]['message']);return _0x5c5017(_0x188af9[_0xccd4('0x12')][_0xccd4('0x14')]);}else{logger[_0xccd4('0x15')](_0xccd4('0xe'),_0x5a301d,'request\x20sent');_0x5c5017(_0x188af9[_0xccd4('0x16')]['message']);}})[_0xccd4('0x17')](function(_0x335cad){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5a301d,_0x335cad);_0x474094(_0x335cad);});});} \ No newline at end of file +var _0x6ee3=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x6ee3,0x90));var _0x36ee=function(_0x7c2426,_0x22f605){_0x7c2426=_0x7c2426-0x0;var _0x52e33d=_0x6ee3[_0x7c2426];return _0x52e33d;};'use strict';var _=require('lodash');var util=require(_0x36ee('0x0'));var moment=require(_0x36ee('0x1'));var BPromise=require(_0x36ee('0x2'));var rs=require(_0x36ee('0x3'));var fs=require('fs');var Redis=require(_0x36ee('0x4'));var db=require(_0x36ee('0x5'))['db'];var utils=require(_0x36ee('0x6'));var logger=require(_0x36ee('0x7'))(_0x36ee('0x8'));var config=require('../../config/environment');var jayson=require(_0x36ee('0x9'));var client=jayson[_0x36ee('0xa')][_0x36ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fcf52,_0x1c2b6e,_0x4f2f2a){return new BPromise(function(_0x3d788b,_0xd854e3){return client[_0x36ee('0xc')](_0x4fcf52,_0x4f2f2a)['then'](function(_0x41d15c){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1c2b6e,_0x36ee('0xd'));logger[_0x36ee('0xe')](_0x36ee('0xf'),_0x1c2b6e,_0x36ee('0xd'),JSON[_0x36ee('0x10')](_0x41d15c));if(_0x41d15c['error']){if(_0x41d15c[_0x36ee('0x11')][_0x36ee('0x12')]===0x1f4){logger[_0x36ee('0x11')](_0x36ee('0x13'),_0x1c2b6e,_0x41d15c[_0x36ee('0x11')]['message']);return _0xd854e3(_0x41d15c['error'][_0x36ee('0x14')]);}logger['error'](_0x36ee('0x13'),_0x1c2b6e,_0x41d15c['error']['message']);return _0x3d788b(_0x41d15c[_0x36ee('0x11')][_0x36ee('0x14')]);}else{logger[_0x36ee('0x15')](_0x36ee('0x13'),_0x1c2b6e,'request\x20sent');_0x3d788b(_0x41d15c[_0x36ee('0x16')]['message']);}})[_0x36ee('0x17')](function(_0x3b6934){logger[_0x36ee('0x11')](_0x36ee('0x13'),_0x1c2b6e,_0x3b6934);_0xd854e3(_0x3b6934);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index aab9754..f8f6cd2 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 _0x4d6a=['destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','isAuthenticated','show','create','put','/:id','update','delete'];(function(_0x482a1f,_0x26da54){var _0x2a0c0a=function(_0x136b24){while(--_0x136b24){_0x482a1f['push'](_0x482a1f['shift']());}};_0x2a0c0a(++_0x26da54);}(_0x4d6a,0x17e));var _0xa4d6=function(_0x259c86,_0x5a7ce9){_0x259c86=_0x259c86-0x0;var _0x1bd2fc=_0x4d6a[_0x259c86];return _0x1bd2fc;};'use strict';var multer=require(_0xa4d6('0x0'));var util=require('util');var path=require(_0xa4d6('0x1'));var timeout=require('connect-timeout');var express=require(_0xa4d6('0x2'));var router=express[_0xa4d6('0x3')]();var fs_extra=require(_0xa4d6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa4d6('0x5'));var config=require(_0xa4d6('0x6'));var controller=require(_0xa4d6('0x7'));router[_0xa4d6('0x8')]('/',auth['isAuthenticated'](),controller[_0xa4d6('0x9')]);router[_0xa4d6('0x8')]('/:id',auth[_0xa4d6('0xa')](),controller[_0xa4d6('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa4d6('0xc')]);router[_0xa4d6('0xd')](_0xa4d6('0xe'),auth[_0xa4d6('0xa')](),controller[_0xa4d6('0xf')]);router[_0xa4d6('0x10')]('/:id',auth[_0xa4d6('0xa')](),controller[_0xa4d6('0x11')]);module[_0xa4d6('0x12')]=router; \ No newline at end of file +var _0x6cd0=['connect-timeout','express','fs-extra','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','path'];(function(_0x36d83e,_0x505ef3){var _0x23ba27=function(_0x2af517){while(--_0x2af517){_0x36d83e['push'](_0x36d83e['shift']());}};_0x23ba27(++_0x505ef3);}(_0x6cd0,0xa8));var _0x06cd=function(_0x3d2761,_0x2696bf){_0x3d2761=_0x3d2761-0x0;var _0x531ae9=_0x6cd0[_0x3d2761];return _0x531ae9;};'use strict';var multer=require(_0x06cd('0x0'));var util=require('util');var path=require(_0x06cd('0x1'));var timeout=require(_0x06cd('0x2'));var express=require(_0x06cd('0x3'));var router=express['Router']();var fs_extra=require(_0x06cd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x06cd('0x5'));var controller=require(_0x06cd('0x6'));router[_0x06cd('0x7')]('/',auth[_0x06cd('0x8')](),controller['index']);router[_0x06cd('0x7')](_0x06cd('0x9'),auth[_0x06cd('0x8')](),controller[_0x06cd('0xa')]);router[_0x06cd('0xb')]('/',auth[_0x06cd('0x8')](),controller['create']);router[_0x06cd('0xc')](_0x06cd('0x9'),auth[_0x06cd('0x8')](),controller[_0x06cd('0xd')]);router[_0x06cd('0xe')](_0x06cd('0x9'),auth['isAuthenticated'](),controller[_0x06cd('0xf')]);module[_0x06cd('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6671026..3d96720 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 _0x2779=['BOOLEAN','sequelize','exports','string','keyValue','picklist','STRING','ENUM','variable','customVariable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2779,0x1eb));var _0x9277=function(_0x331b78,_0x533fd9){_0x331b78=_0x331b78-0x0;var _0x2de754=_0x2779[_0x331b78];return _0x2de754;};'use strict';var Sequelize=require(_0x9277('0x0'));module[_0x9277('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9277('0x2'),'variable','customVariable',_0x9277('0x3'),_0x9277('0x4')),'defaultValue':_0x9277('0x2')},'content':{'type':Sequelize[_0x9277('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9277('0x6')]('string',_0x9277('0x7'),_0x9277('0x8'))},'keyContent':{'type':Sequelize[_0x9277('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9277('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfa6e=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa6e,0xba));var _0xefa6=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xfa6e[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0xefa6('0x0')]={'type':{'type':Sequelize[_0xefa6('0x1')](_0xefa6('0x2'),'variable',_0xefa6('0x3'),_0xefa6('0x4'),_0xefa6('0x5')),'defaultValue':_0xefa6('0x2')},'content':{'type':Sequelize[_0xefa6('0x6')]},'key':{'type':Sequelize[_0xefa6('0x6')]},'keyType':{'type':Sequelize[_0xefa6('0x1')](_0xefa6('0x2'),_0xefa6('0x7'),_0xefa6('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xefa6('0x6')]},'nameField':{'type':Sequelize[_0xefa6('0x6')]},'customField':{'type':Sequelize[_0xefa6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xefa6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index fdaa809..ddf35dc 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 _0xa902=['sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','FreshdeskField','findAll','rows','catch','params','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path'];(function(_0x1abd00,_0x37fcde){var _0x2424d3=function(_0x508d8b){while(--_0x508d8b){_0x1abd00['push'](_0x1abd00['shift']());}};_0x2424d3(++_0x37fcde);}(_0xa902,0x8d));var _0x2a90=function(_0x1c0d28,_0x2d366d){_0x1c0d28=_0x1c0d28-0x0;var _0x357de8=_0xa902[_0x1c0d28];return _0x357de8;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x2a212c,_0x1303d9){return function(_0x29ed73){if(!_0x29ed73){_0x2a212c[_0x2a90('0x17')](0x194);}return _0x29ed73;};}function handleError(_0x48c2f9,_0x27f883){_0x27f883=_0x27f883||0x1f4;return function(_0x17f978){logger[_0x2a90('0x27')](_0x17f978[_0x2a90('0x28')]);if(_0x17f978[_0x2a90('0x29')]){delete _0x17f978['name'];}_0x48c2f9['status'](_0x27f883)[_0x2a90('0x2a')](_0x17f978);};}exports['index']=function(_0x53391e,_0x4969c3){var _0x2d83b3={},_0x3c78f5={},_0x595638={'count':0x0,'rows':[]};var _0x5bd700=_[_0x2a90('0x2b')](db['FreshdeskField'][_0x2a90('0x2c')],function(_0x6892e1){return{'name':_0x6892e1[_0x2a90('0x2d')],'type':_0x6892e1[_0x2a90('0x2e')][_0x2a90('0x2f')]};});_0x3c78f5[_0x2a90('0x30')]=_[_0x2a90('0x2b')](_0x5bd700,'name');_0x3c78f5[_0x2a90('0x31')]=_[_0x2a90('0x32')](_0x53391e[_0x2a90('0x31')]);_0x3c78f5['filters']=_[_0x2a90('0x33')](_0x3c78f5[_0x2a90('0x30')],_0x3c78f5[_0x2a90('0x31')]);_0x2d83b3[_0x2a90('0x34')]=_['intersection'](_0x3c78f5[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x53391e[_0x2a90('0x31')][_0x2a90('0x35')]));_0x2d83b3[_0x2a90('0x34')]=_0x2d83b3[_0x2a90('0x34')]['length']?_0x2d83b3[_0x2a90('0x34')]:_0x3c78f5[_0x2a90('0x30')];if(!_0x53391e[_0x2a90('0x31')][_0x2a90('0x36')]('nolimit')){_0x2d83b3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x53391e['query'][_0x2a90('0x1d')]);_0x2d83b3[_0x2a90('0x1b')]=qs['offset'](_0x53391e['query'][_0x2a90('0x1b')]);}_0x2d83b3[_0x2a90('0x37')]=qs[_0x2a90('0x38')](_0x53391e['query'][_0x2a90('0x38')]);_0x2d83b3['where']=qs[_0x2a90('0x39')](_['pick'](_0x53391e[_0x2a90('0x31')],_0x3c78f5['filters']),_0x5bd700);if(_0x53391e['query'][_0x2a90('0x3a')]){_0x2d83b3['where']=_[_0x2a90('0x3b')](_0x2d83b3[_0x2a90('0x3c')],{'$or':_[_0x2a90('0x2b')](_0x5bd700,function(_0x573aee){if(_0x573aee[_0x2a90('0x2e')]!==_0x2a90('0x3d')){var _0x3be438={};_0x3be438[_0x573aee['name']]={'$like':'%'+_0x53391e[_0x2a90('0x31')][_0x2a90('0x3a')]+'%'};return _0x3be438;}})});}_0x2d83b3=_[_0x2a90('0x3b')]({},_0x2d83b3,_0x53391e['options']);var _0x1aa096={'where':_0x2d83b3[_0x2a90('0x3c')]};return db['FreshdeskField'][_0x2a90('0x1e')](_0x1aa096)[_0x2a90('0x25')](function(_0x2a6bea){_0x595638[_0x2a90('0x1e')]=_0x2a6bea;if(_0x53391e[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x2d83b3[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x41')](_0x2d83b3);})[_0x2a90('0x25')](function(_0x45b41c){_0x595638[_0x2a90('0x42')]=_0x45b41c;return _0x595638;})[_0x2a90('0x25')](respondWithFilteredResult(_0x4969c3,_0x2d83b3))[_0x2a90('0x43')](handleError(_0x4969c3,null));};exports['show']=function(_0x45cbc2,_0x3a70fe){var _0x528b41={'raw':!![],'where':{'id':_0x45cbc2[_0x2a90('0x44')]['id']}},_0x1045bb={};_0x1045bb[_0x2a90('0x30')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')]['rawAttributes']);_0x1045bb[_0x2a90('0x31')]=_['keys'](_0x45cbc2[_0x2a90('0x31')]);_0x1045bb['filters']=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],_0x1045bb[_0x2a90('0x31')]);_0x528b41[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x45cbc2['query']['fields']));_0x528b41[_0x2a90('0x34')]=_0x528b41[_0x2a90('0x34')][_0x2a90('0x45')]?_0x528b41[_0x2a90('0x34')]:_0x1045bb[_0x2a90('0x30')];if(_0x45cbc2[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x528b41[_0x2a90('0x3f')]=[{'all':!![]}];}_0x528b41=_['merge']({},_0x528b41,_0x45cbc2[_0x2a90('0x46')]);return db['FreshdeskField'][_0x2a90('0x47')](_0x528b41)[_0x2a90('0x25')](handleEntityNotFound(_0x3a70fe,null))['then'](respondWithResult(_0x3a70fe,null))[_0x2a90('0x43')](handleError(_0x3a70fe,null));};exports[_0x2a90('0x48')]=function(_0x280e63,_0x1d55db){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x280e63[_0x2a90('0x49')],{})['then'](respondWithResult(_0x1d55db,0xc9))['catch'](handleError(_0x1d55db,null));};exports[_0x2a90('0x24')]=function(_0x2611d0,_0x42c890){if(_0x2611d0[_0x2a90('0x49')]['id']){delete _0x2611d0[_0x2a90('0x49')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x2611d0[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x42c890,null))['then'](saveUpdates(_0x2611d0['body'],null))['then'](respondWithResult(_0x42c890,null))[_0x2a90('0x43')](handleError(_0x42c890,null));};exports['destroy']=function(_0x370da3,_0x3dfe72){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x370da3[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3dfe72,null))['then'](removeEntity(_0x3dfe72,null))[_0x2a90('0x43')](handleError(_0x3dfe72,null));}; \ No newline at end of file +var _0x54f3=['show','params','keys','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','stack','name','send','map','FreshdeskField','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x490486,_0x27180f){var _0xa7f14e=function(_0x5d9990){while(--_0x5d9990){_0x490486['push'](_0x490486['shift']());}};_0xa7f14e(++_0x27180f);}(_0x54f3,0x120));var _0x354f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x54f3[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x354f('0x0'));var zipdir=require(_0x354f('0x1'));var jsonpatch=require(_0x354f('0x2'));var rp=require(_0x354f('0x3'));var moment=require(_0x354f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x354f('0x5'));var path=require(_0x354f('0x6'));var sox=require(_0x354f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x354f('0x8'));var _=require('lodash');var squel=require(_0x354f('0x9'));var crypto=require(_0x354f('0xa'));var jsforce=require(_0x354f('0xb'));var deskjs=require(_0x354f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x354f('0xd'));var Papa=require('papaparse');var Redis=require(_0x354f('0xe'));var authService=require(_0x354f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x354f('0x10'));var logger=require(_0x354f('0x11'))('api');var utils=require(_0x354f('0x12'));var config=require(_0x354f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x354f('0x14'))['db'];function respondWithStatusCode(_0x824bf4,_0x13d871){_0x13d871=_0x13d871||0xcc;return function(_0x97c0da){if(_0x97c0da){return _0x824bf4[_0x354f('0x15')](_0x13d871);}return _0x824bf4[_0x354f('0x16')](_0x13d871)[_0x354f('0x17')]();};}function respondWithResult(_0x4ff8e7,_0xf2e013){_0xf2e013=_0xf2e013||0xc8;return function(_0x4b811d){if(_0x4b811d){return _0x4ff8e7[_0x354f('0x16')](_0xf2e013)['json'](_0x4b811d);}};}function respondWithFilteredResult(_0x103388,_0x234484){return function(_0x18cf66){if(_0x18cf66){var _0x4cc0e9=typeof _0x234484['offset']===_0x354f('0x18')&&typeof _0x234484[_0x354f('0x19')]===_0x354f('0x18');var _0x2ef866=_0x18cf66[_0x354f('0x1a')];var _0x36402d=_0x4cc0e9?0x0:_0x234484[_0x354f('0x1b')];var _0x598777=_0x4cc0e9?_0x18cf66[_0x354f('0x1a')]:_0x234484[_0x354f('0x1b')]+_0x234484[_0x354f('0x19')];var _0x4b87dd;if(_0x598777>=_0x2ef866){_0x598777=_0x2ef866;_0x4b87dd=0xc8;}else{_0x4b87dd=0xce;}_0x103388[_0x354f('0x16')](_0x4b87dd);return _0x103388['set'](_0x354f('0x1c'),_0x36402d+'-'+_0x598777+'/'+_0x2ef866)[_0x354f('0x1d')](_0x18cf66);}return null;};}function patchUpdates(_0x5e930c){return function(_0x14c4be){try{jsonpatch[_0x354f('0x1e')](_0x14c4be,_0x5e930c,!![]);}catch(_0x4ef4f1){return BPromise['reject'](_0x4ef4f1);}return _0x14c4be[_0x354f('0x1f')]();};}function saveUpdates(_0x574753,_0x52e7cb){return function(_0xa6050f){if(_0xa6050f){return _0xa6050f[_0x354f('0x20')](_0x574753)[_0x354f('0x21')](function(_0x2f4277){return _0x2f4277;});}return null;};}function removeEntity(_0xc0d4ca,_0x158117){return function(_0x273603){if(_0x273603){return _0x273603['destroy']()[_0x354f('0x21')](function(){_0xc0d4ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22594b,_0x4c9b18){return function(_0x4b1820){if(!_0x4b1820){_0x22594b[_0x354f('0x15')](0x194);}return _0x4b1820;};}function handleError(_0x4e2ad6,_0x3f0bfe){_0x3f0bfe=_0x3f0bfe||0x1f4;return function(_0x393622){logger['error'](_0x393622[_0x354f('0x22')]);if(_0x393622[_0x354f('0x23')]){delete _0x393622[_0x354f('0x23')];}_0x4e2ad6['status'](_0x3f0bfe)[_0x354f('0x24')](_0x393622);};}exports['index']=function(_0x227d9b,_0x26373d){var _0x16a376={},_0x2816cf={},_0x596b48={'count':0x0,'rows':[]};var _0x21c121=_[_0x354f('0x25')](db[_0x354f('0x26')][_0x354f('0x27')],function(_0x223464){return{'name':_0x223464['fieldName'],'type':_0x223464['type'][_0x354f('0x28')]};});_0x2816cf[_0x354f('0x29')]=_[_0x354f('0x25')](_0x21c121,_0x354f('0x23'));_0x2816cf['query']=_['keys'](_0x227d9b[_0x354f('0x2a')]);_0x2816cf[_0x354f('0x2b')]=_[_0x354f('0x2c')](_0x2816cf[_0x354f('0x29')],_0x2816cf['query']);_0x16a376[_0x354f('0x2d')]=_[_0x354f('0x2c')](_0x2816cf[_0x354f('0x29')],qs[_0x354f('0x2e')](_0x227d9b['query']['fields']));_0x16a376[_0x354f('0x2d')]=_0x16a376[_0x354f('0x2d')][_0x354f('0x2f')]?_0x16a376[_0x354f('0x2d')]:_0x2816cf[_0x354f('0x29')];if(!_0x227d9b[_0x354f('0x2a')][_0x354f('0x30')](_0x354f('0x31'))){_0x16a376[_0x354f('0x19')]=qs[_0x354f('0x19')](_0x227d9b[_0x354f('0x2a')]['limit']);_0x16a376[_0x354f('0x1b')]=qs['offset'](_0x227d9b[_0x354f('0x2a')][_0x354f('0x1b')]);}_0x16a376[_0x354f('0x32')]=qs[_0x354f('0x33')](_0x227d9b[_0x354f('0x2a')][_0x354f('0x33')]);_0x16a376['where']=qs[_0x354f('0x2b')](_[_0x354f('0x34')](_0x227d9b['query'],_0x2816cf[_0x354f('0x2b')]),_0x21c121);if(_0x227d9b[_0x354f('0x2a')][_0x354f('0x35')]){_0x16a376['where']=_[_0x354f('0x36')](_0x16a376[_0x354f('0x37')],{'$or':_[_0x354f('0x25')](_0x21c121,function(_0x389f82){if(_0x389f82['type']!==_0x354f('0x38')){var _0x4db9a4={};_0x4db9a4[_0x389f82[_0x354f('0x23')]]={'$like':'%'+_0x227d9b[_0x354f('0x2a')][_0x354f('0x35')]+'%'};return _0x4db9a4;}})});}_0x16a376=_[_0x354f('0x36')]({},_0x16a376,_0x227d9b[_0x354f('0x39')]);var _0x589c69={'where':_0x16a376['where']};return db[_0x354f('0x26')][_0x354f('0x1a')](_0x589c69)[_0x354f('0x21')](function(_0x327fb2){_0x596b48[_0x354f('0x1a')]=_0x327fb2;if(_0x227d9b[_0x354f('0x2a')]['includeAll']){_0x16a376[_0x354f('0x3a')]=[{'all':!![]}];}return db[_0x354f('0x26')][_0x354f('0x3b')](_0x16a376);})[_0x354f('0x21')](function(_0x512592){_0x596b48[_0x354f('0x3c')]=_0x512592;return _0x596b48;})[_0x354f('0x21')](respondWithFilteredResult(_0x26373d,_0x16a376))[_0x354f('0x3d')](handleError(_0x26373d,null));};exports[_0x354f('0x3e')]=function(_0x1da53d,_0x344666){var _0x5f33b2={'raw':!![],'where':{'id':_0x1da53d[_0x354f('0x3f')]['id']}},_0x66b4cc={};_0x66b4cc[_0x354f('0x29')]=_['keys'](db['FreshdeskField'][_0x354f('0x27')]);_0x66b4cc[_0x354f('0x2a')]=_[_0x354f('0x40')](_0x1da53d[_0x354f('0x2a')]);_0x66b4cc[_0x354f('0x2b')]=_[_0x354f('0x2c')](_0x66b4cc[_0x354f('0x29')],_0x66b4cc[_0x354f('0x2a')]);_0x5f33b2['attributes']=_[_0x354f('0x2c')](_0x66b4cc[_0x354f('0x29')],qs[_0x354f('0x2e')](_0x1da53d[_0x354f('0x2a')][_0x354f('0x2e')]));_0x5f33b2[_0x354f('0x2d')]=_0x5f33b2[_0x354f('0x2d')][_0x354f('0x2f')]?_0x5f33b2[_0x354f('0x2d')]:_0x66b4cc['model'];if(_0x1da53d[_0x354f('0x2a')][_0x354f('0x41')]){_0x5f33b2['include']=[{'all':!![]}];}_0x5f33b2=_['merge']({},_0x5f33b2,_0x1da53d[_0x354f('0x39')]);return db[_0x354f('0x26')][_0x354f('0x42')](_0x5f33b2)[_0x354f('0x21')](handleEntityNotFound(_0x344666,null))[_0x354f('0x21')](respondWithResult(_0x344666,null))[_0x354f('0x3d')](handleError(_0x344666,null));};exports['create']=function(_0x558332,_0x178313){return db[_0x354f('0x26')][_0x354f('0x43')](_0x558332[_0x354f('0x44')],{})[_0x354f('0x21')](respondWithResult(_0x178313,0xc9))[_0x354f('0x3d')](handleError(_0x178313,null));};exports['update']=function(_0x55f2c9,_0x6b7a2c){if(_0x55f2c9['body']['id']){delete _0x55f2c9[_0x354f('0x44')]['id'];}return db[_0x354f('0x26')][_0x354f('0x42')]({'where':{'id':_0x55f2c9['params']['id']}})['then'](handleEntityNotFound(_0x6b7a2c,null))[_0x354f('0x21')](saveUpdates(_0x55f2c9[_0x354f('0x44')],null))['then'](respondWithResult(_0x6b7a2c,null))[_0x354f('0x3d')](handleError(_0x6b7a2c,null));};exports[_0x354f('0x45')]=function(_0xf71a4f,_0x2dd012){return db[_0x354f('0x26')][_0x354f('0x42')]({'where':{'id':_0xf71a4f[_0x354f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2dd012,null))[_0x354f('0x21')](removeEntity(_0x2dd012,null))[_0x354f('0x3d')](handleError(_0x2dd012,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f63e5aa..7c16f2a 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 _0x8bc9=['./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','util','api','moment','bluebird','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8bc9,0x89));var _0x98bc=function(_0x1265e8,_0x8385ba){_0x1265e8=_0x1265e8-0x0;var _0x1ee567=_0x8bc9[_0x1265e8];return _0x1ee567;};'use strict';var _=require('lodash');var util=require(_0x98bc('0x0'));var logger=require('../../config/logger')(_0x98bc('0x1'));var moment=require(_0x98bc('0x2'));var BPromise=require(_0x98bc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98bc('0x4'));var rimraf=require(_0x98bc('0x5'));var config=require('../../config/environment');var attributes=require(_0x98bc('0x6'));module[_0x98bc('0x7')]=function(_0x3f5ec2,_0x3177dc){return _0x3f5ec2[_0x98bc('0x8')](_0x98bc('0x9'),attributes,{'tableName':_0x98bc('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x98bc('0xb'),_0x98bc('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd1b=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2a2dbd,_0x53fd40){var _0x297c72=function(_0x4e8e78){while(--_0x4e8e78){_0x2a2dbd['push'](_0x2a2dbd['shift']());}};_0x297c72(++_0x53fd40);}(_0xcd1b,0x18e));var _0xbcd1=function(_0x2d2d56,_0x11c384){_0x2d2d56=_0x2d2d56-0x0;var _0x44663e=_0xcd1b[_0x2d2d56];return _0x44663e;};'use strict';var _=require(_0xbcd1('0x0'));var util=require(_0xbcd1('0x1'));var logger=require('../../config/logger')(_0xbcd1('0x2'));var moment=require(_0xbcd1('0x3'));var BPromise=require(_0xbcd1('0x4'));var rp=require(_0xbcd1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbcd1('0x6'));var config=require(_0xbcd1('0x7'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x1352af,_0x5ac3c0){return _0x1352af[_0xbcd1('0x8')](_0xbcd1('0x9'),attributes,{'tableName':_0xbcd1('0xa'),'paranoid':![],'indexes':[{'name':_0xbcd1('0xb'),'fields':[_0xbcd1('0xc'),_0xbcd1('0xd')],'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 fe01d91..6bb03b2 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 _0xc23d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc23d,0x90));var _0xdc23=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0xc23d[_0x51674a];return _0x13fca6;};'use strict';var _=require(_0xdc23('0x0'));var util=require('util');var moment=require(_0xdc23('0x1'));var BPromise=require(_0xdc23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc23('0x3'));var db=require(_0xdc23('0x4'))['db'];var utils=require(_0xdc23('0x5'));var logger=require(_0xdc23('0x6'))('rpc');var config=require(_0xdc23('0x7'));var jayson=require(_0xdc23('0x8'));var client=jayson['client'][_0xdc23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28d271,_0x584c36,_0x5a7381){return new BPromise(function(_0x254d4f,_0x40033c){return client[_0xdc23('0xa')](_0x28d271,_0x5a7381)['then'](function(_0x449758){logger[_0xdc23('0xb')](_0xdc23('0xc'),_0x584c36,_0xdc23('0xd'));logger['debug'](_0xdc23('0xe'),_0x584c36,'request\x20sent',JSON[_0xdc23('0xf')](_0x449758));if(_0x449758[_0xdc23('0x10')]){if(_0x449758['error'][_0xdc23('0x11')]===0x1f4){logger[_0xdc23('0x10')](_0xdc23('0xc'),_0x584c36,_0x449758[_0xdc23('0x10')][_0xdc23('0x12')]);return _0x40033c(_0x449758[_0xdc23('0x10')][_0xdc23('0x12')]);}logger[_0xdc23('0x10')](_0xdc23('0xc'),_0x584c36,_0x449758[_0xdc23('0x10')][_0xdc23('0x12')]);return _0x254d4f(_0x449758['error'][_0xdc23('0x12')]);}else{logger[_0xdc23('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x584c36,'request\x20sent');_0x254d4f(_0x449758[_0xdc23('0x13')]['message']);}})[_0xdc23('0x14')](function(_0x1d258a){logger[_0xdc23('0x10')](_0xdc23('0xc'),_0x584c36,_0x1d258a);_0x40033c(_0x1d258a);});});} \ No newline at end of file +var _0xca9d=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3ef4c8,_0x4762ce){var _0x25a54e=function(_0x1361d2){while(--_0x1361d2){_0x3ef4c8['push'](_0x3ef4c8['shift']());}};_0x25a54e(++_0x4762ce);}(_0xca9d,0x1bf));var _0xdca9=function(_0x1f6769,_0x53a0d0){_0x1f6769=_0x1f6769-0x0;var _0x49db84=_0xca9d[_0x1f6769];return _0x49db84;};'use strict';var _=require(_0xdca9('0x0'));var util=require(_0xdca9('0x1'));var moment=require('moment');var BPromise=require(_0xdca9('0x2'));var rs=require(_0xdca9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdca9('0x4'));var logger=require(_0xdca9('0x5'))(_0xdca9('0x6'));var config=require(_0xdca9('0x7'));var jayson=require(_0xdca9('0x8'));var client=jayson['client'][_0xdca9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f6179,_0x5c0560,_0x3a5816){return new BPromise(function(_0x438d88,_0x232dfc){return client[_0xdca9('0xa')](_0x2f6179,_0x3a5816)[_0xdca9('0xb')](function(_0x700bcd){logger[_0xdca9('0xc')](_0xdca9('0xd'),_0x5c0560,_0xdca9('0xe'));logger[_0xdca9('0xf')](_0xdca9('0x10'),_0x5c0560,_0xdca9('0xe'),JSON[_0xdca9('0x11')](_0x700bcd));if(_0x700bcd[_0xdca9('0x12')]){if(_0x700bcd[_0xdca9('0x12')][_0xdca9('0x13')]===0x1f4){logger[_0xdca9('0x12')](_0xdca9('0xd'),_0x5c0560,_0x700bcd['error'][_0xdca9('0x14')]);return _0x232dfc(_0x700bcd[_0xdca9('0x12')][_0xdca9('0x14')]);}logger['error'](_0xdca9('0xd'),_0x5c0560,_0x700bcd[_0xdca9('0x12')][_0xdca9('0x14')]);return _0x438d88(_0x700bcd[_0xdca9('0x12')][_0xdca9('0x14')]);}else{logger[_0xdca9('0xc')](_0xdca9('0xd'),_0x5c0560,'request\x20sent');_0x438d88(_0x700bcd['result'][_0xdca9('0x14')]);}})[_0xdca9('0x15')](function(_0x1d0419){logger[_0xdca9('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x5c0560,_0x1d0419);_0x232dfc(_0x1d0419);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 6d3e8c9..5a5d399 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 _0x16d2=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x16d2,0x123));var _0x216d=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x16d2[_0x5ba549];return _0x36e3a1;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['getFields']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),controller[_0x216d('0x13')]);router[_0x216d('0x12')](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x14')]);router[_0x216d('0x15')]('/:id',auth[_0x216d('0xb')](),controller['update']);router[_0x216d('0x16')](_0x216d('0xd'),auth['isAuthenticated'](),controller[_0x216d('0x17')]);module[_0x216d('0x18')]=router; \ No newline at end of file +var _0xac4a=['show','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','get'];(function(_0x1d7599,_0x49929f){var _0x55da12=function(_0x3f7a5f){while(--_0x3f7a5f){_0x1d7599['push'](_0x1d7599['shift']());}};_0x55da12(++_0x49929f);}(_0xac4a,0x13f));var _0xaac4=function(_0x196620,_0x329632){_0x196620=_0x196620-0x0;var _0x319e3f=_0xac4a[_0x196620];return _0x319e3f;};'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/configurations',auth[_0xaac4('0x9')](),controller['getConfigurations']);router[_0xaac4('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xd')]('/',auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router[_0xaac4('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0x11'),auth['isAuthenticated'](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0x14')]);module[_0xaac4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 79f593e..3b9333c 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 _0x3d04=['STRING','username','sequelize','exports'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x43d0('0x0'));module[_0x43d0('0x1')]={'name':{'type':Sequelize[_0x43d0('0x2')]},'description':{'type':Sequelize[_0x43d0('0x2')]},'username':{'type':Sequelize[_0x43d0('0x2')],'unique':_0x43d0('0x3')},'apiKey':{'type':Sequelize[_0x43d0('0x2')]},'remoteUri':{'type':Sequelize[_0x43d0('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x43d0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0598=['exports','STRING','sequelize'];(function(_0x5a125c,_0x155fa2){var _0x4c70af=function(_0x5dccb6){while(--_0x5dccb6){_0x5a125c['push'](_0x5a125c['shift']());}};_0x4c70af(++_0x155fa2);}(_0x0598,0x92));var _0x8059=function(_0x4f3028,_0xaa800){_0x4f3028=_0x4f3028-0x0;var _0x40a585=_0x0598[_0x4f3028];return _0x40a585;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8059('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x8059('0x2')]},'remoteUri':{'type':Sequelize[_0x8059('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 130f399..4fada70 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 _0x481e=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','FreshsalesConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','findOne','username','remoteUri','apiKey','substring','%s%s','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','reject','update','then','destroy','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x481e,0x83));var _0xe481=function(_0x1bb8e0,_0xd66e71){_0x1bb8e0=_0x1bb8e0-0x0;var _0x3f497f=_0x481e[_0x1bb8e0];return _0x3f497f;};'use strict';var emlformat=require(_0xe481('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe481('0x1'));var jsonpatch=require(_0xe481('0x2'));var rp=require(_0xe481('0x3'));var moment=require('moment');var BPromise=require(_0xe481('0x4'));var Mustache=require(_0xe481('0x5'));var util=require(_0xe481('0x6'));var path=require(_0xe481('0x7'));var sox=require(_0xe481('0x8'));var csv=require(_0xe481('0x9'));var ejs=require(_0xe481('0xa'));var fs=require('fs');var fs_extra=require(_0xe481('0xb'));var _=require('lodash');var squel=require(_0xe481('0xc'));var crypto=require('crypto');var jsforce=require(_0xe481('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe481('0xe'));var Papa=require('papaparse');var Redis=require(_0xe481('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe481('0x10'));var as=require(_0xe481('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe481('0x12'))(_0xe481('0x13'));var utils=require('../../config/utils');var config=require(_0xe481('0x14'));var licenseUtil=require(_0xe481('0x15'));var db=require(_0xe481('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5151f,_0x114692){_0x114692=_0x114692||0xcc;return function(_0x13a793){if(_0x13a793){return _0x5151f[_0xe481('0x17')](_0x114692);}return _0x5151f[_0xe481('0x18')](_0x114692)[_0xe481('0x19')]();};}function respondWithResult(_0x2c252c,_0x34b5df){_0x34b5df=_0x34b5df||0xc8;return function(_0x21be5e){if(_0x21be5e){return _0x2c252c[_0xe481('0x18')](_0x34b5df)['json'](_0x21be5e);}};}function respondWithFilteredResult(_0x321c94,_0x48acbf){return function(_0x10b9df){if(_0x10b9df){var _0x44af26=typeof _0x48acbf['offset']===_0xe481('0x1a')&&typeof _0x48acbf[_0xe481('0x1b')]==='undefined';var _0xf1bef6=_0x10b9df[_0xe481('0x1c')];var _0xf0d801=_0x44af26?0x0:_0x48acbf[_0xe481('0x1d')];var _0x49b2f2=_0x44af26?_0x10b9df[_0xe481('0x1c')]:_0x48acbf[_0xe481('0x1d')]+_0x48acbf[_0xe481('0x1b')];var _0x2ef390;if(_0x49b2f2>=_0xf1bef6){_0x49b2f2=_0xf1bef6;_0x2ef390=0xc8;}else{_0x2ef390=0xce;}_0x321c94[_0xe481('0x18')](_0x2ef390);return _0x321c94[_0xe481('0x1e')]('Content-Range',_0xf0d801+'-'+_0x49b2f2+'/'+_0xf1bef6)[_0xe481('0x1f')](_0x10b9df);}return null;};}function patchUpdates(_0x65dc55){return function(_0x73326e){try{jsonpatch['apply'](_0x73326e,_0x65dc55,!![]);}catch(_0x7d4790){return BPromise[_0xe481('0x20')](_0x7d4790);}return _0x73326e['save']();};}function saveUpdates(_0x316af8,_0x45b9f9){return function(_0x4f04fc){if(_0x4f04fc){return _0x4f04fc[_0xe481('0x21')](_0x316af8)[_0xe481('0x22')](function(_0x1c2c04){return _0x1c2c04;});}return null;};}function removeEntity(_0x2da3a7,_0x43f30b){return function(_0x533dd2){if(_0x533dd2){return _0x533dd2[_0xe481('0x23')]()[_0xe481('0x22')](function(){_0x2da3a7[_0xe481('0x18')](0xcc)[_0xe481('0x19')]();});}};}function handleEntityNotFound(_0x172014,_0x9858b){return function(_0x19f4df){if(!_0x19f4df){_0x172014[_0xe481('0x17')](0x194);}return _0x19f4df;};}function handleError(_0x1150e2,_0x383b7d){_0x383b7d=_0x383b7d||0x1f4;return function(_0xb9e5dd){logger[_0xe481('0x24')](_0xb9e5dd[_0xe481('0x25')]);if(_0xb9e5dd['name']){delete _0xb9e5dd[_0xe481('0x26')];}_0x1150e2[_0xe481('0x18')](_0x383b7d)[_0xe481('0x27')](_0xb9e5dd);};}exports['index']=function(_0x377a5c,_0x1470c8){var _0x144367={},_0x16d0f6={},_0x11e768={'count':0x0,'rows':[]};var _0x5cb8a0=_[_0xe481('0x28')](db[_0xe481('0x29')][_0xe481('0x2a')],function(_0x52d28f){return{'name':_0x52d28f[_0xe481('0x2b')],'type':_0x52d28f[_0xe481('0x2c')]['key']};});_0x16d0f6['model']=_['map'](_0x5cb8a0,_0xe481('0x26'));_0x16d0f6[_0xe481('0x2d')]=_[_0xe481('0x2e')](_0x377a5c['query']);_0x16d0f6[_0xe481('0x2f')]=_[_0xe481('0x30')](_0x16d0f6[_0xe481('0x31')],_0x16d0f6[_0xe481('0x2d')]);_0x144367[_0xe481('0x32')]=_[_0xe481('0x30')](_0x16d0f6[_0xe481('0x31')],qs['fields'](_0x377a5c[_0xe481('0x2d')][_0xe481('0x33')]));_0x144367[_0xe481('0x32')]=_0x144367[_0xe481('0x32')][_0xe481('0x34')]?_0x144367[_0xe481('0x32')]:_0x16d0f6[_0xe481('0x31')];if(!_0x377a5c[_0xe481('0x2d')][_0xe481('0x35')](_0xe481('0x36'))){_0x144367[_0xe481('0x1b')]=qs[_0xe481('0x1b')](_0x377a5c[_0xe481('0x2d')][_0xe481('0x1b')]);_0x144367[_0xe481('0x1d')]=qs[_0xe481('0x1d')](_0x377a5c[_0xe481('0x2d')][_0xe481('0x1d')]);}_0x144367[_0xe481('0x37')]=qs[_0xe481('0x38')](_0x377a5c[_0xe481('0x2d')][_0xe481('0x38')]);_0x144367[_0xe481('0x39')]=qs[_0xe481('0x2f')](_[_0xe481('0x3a')](_0x377a5c[_0xe481('0x2d')],_0x16d0f6['filters']),_0x5cb8a0);if(_0x377a5c['query'][_0xe481('0x3b')]){_0x144367[_0xe481('0x39')]=_[_0xe481('0x3c')](_0x144367[_0xe481('0x39')],{'$or':_[_0xe481('0x28')](_0x5cb8a0,function(_0x243240){if(_0x243240[_0xe481('0x2c')]!==_0xe481('0x3d')){var _0x3b934b={};_0x3b934b[_0x243240[_0xe481('0x26')]]={'$like':'%'+_0x377a5c[_0xe481('0x2d')][_0xe481('0x3b')]+'%'};return _0x3b934b;}})});}_0x144367=_[_0xe481('0x3c')]({},_0x144367,_0x377a5c[_0xe481('0x3e')]);var _0xf3134d={'where':_0x144367[_0xe481('0x39')]};return db[_0xe481('0x29')][_0xe481('0x1c')](_0xf3134d)[_0xe481('0x22')](function(_0x248196){_0x11e768['count']=_0x248196;if(_0x377a5c[_0xe481('0x2d')][_0xe481('0x3f')]){_0x144367[_0xe481('0x40')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xe481('0x41')](_0x144367);})[_0xe481('0x22')](function(_0x1a4149){_0x11e768[_0xe481('0x42')]=_0x1a4149;return _0x11e768;})[_0xe481('0x22')](respondWithFilteredResult(_0x1470c8,_0x144367))[_0xe481('0x43')](handleError(_0x1470c8,null));};exports[_0xe481('0x44')]=function(_0xf8e312,_0x1ccdb8){var _0x2c743f={'raw':![],'where':{'id':_0xf8e312[_0xe481('0x45')]['id']}},_0x4685f3={};_0x4685f3[_0xe481('0x31')]=_[_0xe481('0x2e')](db[_0xe481('0x29')][_0xe481('0x2a')]);_0x4685f3['query']=_[_0xe481('0x2e')](_0xf8e312[_0xe481('0x2d')]);_0x4685f3[_0xe481('0x2f')]=_[_0xe481('0x30')](_0x4685f3[_0xe481('0x31')],_0x4685f3[_0xe481('0x2d')]);_0x2c743f[_0xe481('0x32')]=_['intersection'](_0x4685f3[_0xe481('0x31')],qs[_0xe481('0x33')](_0xf8e312[_0xe481('0x2d')][_0xe481('0x33')]));_0x2c743f[_0xe481('0x32')]=_0x2c743f[_0xe481('0x32')][_0xe481('0x34')]?_0x2c743f[_0xe481('0x32')]:_0x4685f3[_0xe481('0x31')];if(_0xf8e312[_0xe481('0x2d')][_0xe481('0x3f')]){_0x2c743f[_0xe481('0x40')]=[{'all':!![]}];}_0x2c743f=_[_0xe481('0x3c')]({},_0x2c743f,_0xf8e312[_0xe481('0x3e')]);return db[_0xe481('0x29')][_0xe481('0x46')](_0x2c743f)[_0xe481('0x22')](handleEntityNotFound(_0x1ccdb8,null))[_0xe481('0x22')](respondWithResult(_0x1ccdb8,null))['catch'](handleError(_0x1ccdb8,null));};exports[_0xe481('0x47')]=function(_0x3ac04a,_0x3e9f74){return db[_0xe481('0x29')][_0xe481('0x47')](_0x3ac04a[_0xe481('0x48')],{})[_0xe481('0x22')](respondWithResult(_0x3e9f74,0xc9))['catch'](handleError(_0x3e9f74,null));};exports[_0xe481('0x21')]=function(_0x2b88c0,_0x1e11ce){if(_0x2b88c0['body']['id']){delete _0x2b88c0[_0xe481('0x48')]['id'];}return db[_0xe481('0x29')][_0xe481('0x46')]({'where':{'id':_0x2b88c0[_0xe481('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e11ce,null))['then'](saveUpdates(_0x2b88c0[_0xe481('0x48')],null))[_0xe481('0x22')](respondWithResult(_0x1e11ce,null))[_0xe481('0x43')](handleError(_0x1e11ce,null));};exports[_0xe481('0x23')]=function(_0x433792,_0x5ae6ee){return db[_0xe481('0x29')][_0xe481('0x46')]({'where':{'id':_0x433792[_0xe481('0x45')]['id']}})[_0xe481('0x22')](handleEntityNotFound(_0x5ae6ee,null))[_0xe481('0x22')](removeEntity(_0x5ae6ee,null))['catch'](handleError(_0x5ae6ee,null));};exports[_0xe481('0x49')]=function(_0x22898c,_0x4b33b6,_0x50b619){var _0x306ec4={};var _0x21ce12={};var _0x485ef;var _0x445781;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x22898c[_0xe481('0x45')]['id']}})[_0xe481('0x22')](handleEntityNotFound(_0x4b33b6,null))[_0xe481('0x22')](function(_0x3dcdeb){if(_0x3dcdeb){_0x485ef=_0x3dcdeb;_0x21ce12[_0xe481('0x31')]=_[_0xe481('0x2e')](db[_0xe481('0x4a')]['rawAttributes']);_0x21ce12[_0xe481('0x2d')]=_[_0xe481('0x2e')](_0x22898c[_0xe481('0x2d')]);_0x21ce12[_0xe481('0x2f')]=_[_0xe481('0x30')](_0x21ce12['model'],_0x21ce12['query']);_0x306ec4[_0xe481('0x32')]=_[_0xe481('0x30')](_0x21ce12[_0xe481('0x31')],qs[_0xe481('0x33')](_0x22898c[_0xe481('0x2d')][_0xe481('0x33')]));_0x306ec4[_0xe481('0x32')]=_0x306ec4[_0xe481('0x32')][_0xe481('0x34')]?_0x306ec4[_0xe481('0x32')]:_0x21ce12[_0xe481('0x31')];_0x306ec4['order']=qs[_0xe481('0x38')](_0x22898c['query'][_0xe481('0x38')]);_0x306ec4['where']=qs[_0xe481('0x2f')](_[_0xe481('0x3a')](_0x22898c[_0xe481('0x2d')],_0x21ce12[_0xe481('0x2f')]));if(_0x22898c[_0xe481('0x2d')][_0xe481('0x3b')]){_0x306ec4[_0xe481('0x39')]=_['merge'](_0x306ec4[_0xe481('0x39')],{'$or':_['map'](_0x306ec4[_0xe481('0x32')],function(_0x198b34){var _0x4685e4={};_0x4685e4[_0x198b34]={'$like':'%'+_0x22898c[_0xe481('0x2d')][_0xe481('0x3b')]+'%'};return _0x4685e4;})});}_0x306ec4=_[_0xe481('0x3c')]({},_0x306ec4,_0x22898c[_0xe481('0x3e')]);return _0x485ef[_0xe481('0x49')](_0x306ec4);}})[_0xe481('0x22')](function(_0x383be8){if(_0x383be8){_0x445781=_0x383be8['length'];if(!_0x22898c['query'][_0xe481('0x35')](_0xe481('0x36'))){_0x306ec4[_0xe481('0x1b')]=qs['limit'](_0x22898c[_0xe481('0x2d')]['limit']);_0x306ec4['offset']=qs[_0xe481('0x1d')](_0x22898c['query'][_0xe481('0x1d')]);}return _0x485ef[_0xe481('0x49')](_0x306ec4);}})[_0xe481('0x22')](function(_0x4b758f){if(_0x4b758f){return _0x4b758f?{'count':_0x445781,'rows':_0x4b758f}:null;}})[_0xe481('0x22')](respondWithResult(_0x4b33b6,null))[_0xe481('0x43')](handleError(_0x4b33b6,null));};exports['addConfiguration']=function(_0x188246,_0x2e9e5c,_0x2a730a){if(_0x188246[_0xe481('0x48')]['id']){delete _0x188246['body']['id'];}return db[_0xe481('0x29')]['findOne']({'where':{'id':_0x188246[_0xe481('0x45')]['id']}})[_0xe481('0x22')](handleEntityNotFound(_0x2e9e5c,null))['then'](function(_0xdb1dbe){if(_0xdb1dbe){_0x188246['body'][_0xe481('0x4b')]=_0xdb1dbe['id'];_0x188246[_0xe481('0x48')][_0xe481('0x4c')]=integrations[_0xe481('0x4d')](_0x188246[_0xe481('0x48')][_0xe481('0x4e')],_0x188246[_0xe481('0x48')][_0xe481('0x2c')]);_0x188246[_0xe481('0x48')][_0xe481('0x4f')]=integrations[_0xe481('0x50')](_0x188246[_0xe481('0x48')][_0xe481('0x4e')],_0x188246[_0xe481('0x48')][_0xe481('0x2c')]);return db['FreshsalesConfiguration']['create'](_0x188246['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xe481('0x4c')},{'model':db['FreshsalesField'],'as':_0xe481('0x4f')}]});}return null;})[_0xe481('0x22')](respondWithResult(_0x2e9e5c,null))[_0xe481('0x43')](handleError(_0x2e9e5c,null));};exports[_0xe481('0x51')]=function(_0x4b3089,_0x5edd66,_0x533ab5){var _0x8acfd5='';var _0x342d01='';return db[_0xe481('0x29')][_0xe481('0x52')]({'where':{'id':_0x4b3089[_0xe481('0x45')]['id']},'attributes':['id',_0xe481('0x53'),_0xe481('0x54'),_0xe481('0x55')]})['then'](handleEntityNotFound(_0x5edd66,null))[_0xe481('0x22')](function(_0x3eeef4){if(_0x3eeef4){_0x342d01=_0x3eeef4[_0xe481('0x53')];_0x8acfd5=_0x3eeef4[_0xe481('0x54')];var _0x7e7071=_0x3eeef4['remoteUri']['slice'](-0x1);if(_0x7e7071==='/'){_0x8acfd5=_0x8acfd5[_0xe481('0x56')](0x0,_0x8acfd5['lastIndexOf'](_0x7e7071));}return rp({'method':'GET','uri':util['format'](_0xe481('0x57'),_0x8acfd5,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x3eeef4[_0xe481('0x55')]},'json':!![]});}})[_0xe481('0x22')](function(_0x3fcae0){if(_0x3fcae0){var _0x42ebdc=_0x3fcae0[_0xe481('0x58')];var _0x38304b=![];var _0x3f6119=null;for(_0x3f6119=0x0;_0x3f6119<_0x42ebdc['length'];_0x3f6119++){if(_0x42ebdc[_0x3f6119]['email']===_0x342d01){_0x38304b=!![];}}if(_0x38304b){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xe481('0x59')});}}})['then'](respondWithResult(_0x5edd66,null))[_0xe481('0x43')](function(_0x109c5f){var _0x868d5a=_0x4b3089[_0xe481('0x2d')][_0xe481('0x5a')]?0x1f4:_0x109c5f[_0xe481('0x5b')]||0x1f4;logger[_0xe481('0x24')](_0xe481('0x5c'),_0xe481('0x51'),_0x868d5a,JSON[_0xe481('0x5d')](_0x109c5f));delete _0x109c5f[_0xe481('0x26')];if(_0x868d5a===0x191){_0x868d5a=0x190;}_0x5edd66[_0xe481('0x18')](_0x868d5a)[_0xe481('0x27')](_0x4b3089[_0xe481('0x2d')][_0xe481('0x5a')]?{'message':'Wrong\x20credentials','statusCode':_0x109c5f[_0xe481('0x5b')]}:_0x109c5f);});}; \ No newline at end of file +var _0x801c=['Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','name','send','FreshsalesAccount','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','filter','options','include','findAll','rows','catch','show','includeAll','merge','find','create','body','params','getConfigurations','findOne','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x97cba7,_0x404d4f){var _0x31b7fb=function(_0x13d61a){while(--_0x13d61a){_0x97cba7['push'](_0x97cba7['shift']());}};_0x31b7fb(++_0x404d4f);}(_0x801c,0xc8));var _0xc801=function(_0x5f59d2,_0x2a7aaf){_0x5f59d2=_0x5f59d2-0x0;var _0x11daa8=_0x801c[_0x5f59d2];return _0x11daa8;};'use strict';var emlformat=require(_0xc801('0x0'));var rimraf=require(_0xc801('0x1'));var zipdir=require(_0xc801('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc801('0x3'));var moment=require(_0xc801('0x4'));var BPromise=require(_0xc801('0x5'));var Mustache=require(_0xc801('0x6'));var util=require(_0xc801('0x7'));var path=require(_0xc801('0x8'));var sox=require('sox');var csv=require(_0xc801('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc801('0xa'));var _=require('lodash');var squel=require(_0xc801('0xb'));var crypto=require(_0xc801('0xc'));var jsforce=require(_0xc801('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc801('0xe'));var Redis=require('ioredis');var authService=require(_0xc801('0xf'));var qs=require(_0xc801('0x10'));var as=require(_0xc801('0x11'));var hardwareService=require(_0xc801('0x12'));var logger=require(_0xc801('0x13'))(_0xc801('0x14'));var utils=require('../../config/utils');var config=require(_0xc801('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x12d160,_0x24ea43){_0x24ea43=_0x24ea43||0xcc;return function(_0x2ad3f4){if(_0x2ad3f4){return _0x12d160[_0xc801('0x16')](_0x24ea43);}return _0x12d160[_0xc801('0x17')](_0x24ea43)[_0xc801('0x18')]();};}function respondWithResult(_0x5b5e11,_0x297bf0){_0x297bf0=_0x297bf0||0xc8;return function(_0x1b4b42){if(_0x1b4b42){return _0x5b5e11[_0xc801('0x17')](_0x297bf0)['json'](_0x1b4b42);}};}function respondWithFilteredResult(_0x5d3a15,_0x70c96f){return function(_0xbecfac){if(_0xbecfac){var _0x3889ec=typeof _0x70c96f[_0xc801('0x19')]==='undefined'&&typeof _0x70c96f[_0xc801('0x1a')]===_0xc801('0x1b');var _0xb111a2=_0xbecfac[_0xc801('0x1c')];var _0x59913b=_0x3889ec?0x0:_0x70c96f[_0xc801('0x19')];var _0x4701ee=_0x3889ec?_0xbecfac['count']:_0x70c96f[_0xc801('0x19')]+_0x70c96f[_0xc801('0x1a')];var _0x251174;if(_0x4701ee>=_0xb111a2){_0x4701ee=_0xb111a2;_0x251174=0xc8;}else{_0x251174=0xce;}_0x5d3a15[_0xc801('0x17')](_0x251174);return _0x5d3a15[_0xc801('0x1d')](_0xc801('0x1e'),_0x59913b+'-'+_0x4701ee+'/'+_0xb111a2)[_0xc801('0x1f')](_0xbecfac);}return null;};}function patchUpdates(_0xebf15b){return function(_0xb5d0d){try{jsonpatch[_0xc801('0x20')](_0xb5d0d,_0xebf15b,!![]);}catch(_0xcb2dd2){return BPromise[_0xc801('0x21')](_0xcb2dd2);}return _0xb5d0d[_0xc801('0x22')]();};}function saveUpdates(_0x3ea1c1,_0x384f9b){return function(_0x1345ed){if(_0x1345ed){return _0x1345ed[_0xc801('0x23')](_0x3ea1c1)[_0xc801('0x24')](function(_0x4098cd){return _0x4098cd;});}return null;};}function removeEntity(_0x4ae057,_0x143ea9){return function(_0x5b08d0){if(_0x5b08d0){return _0x5b08d0['destroy']()[_0xc801('0x24')](function(){_0x4ae057[_0xc801('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47e672,_0xf9d673){return function(_0x42586a){if(!_0x42586a){_0x47e672[_0xc801('0x16')](0x194);}return _0x42586a;};}function handleError(_0x2ceabf,_0x1dda5f){_0x1dda5f=_0x1dda5f||0x1f4;return function(_0x10c34e){logger[_0xc801('0x25')](_0x10c34e['stack']);if(_0x10c34e[_0xc801('0x26')]){delete _0x10c34e[_0xc801('0x26')];}_0x2ceabf[_0xc801('0x17')](_0x1dda5f)[_0xc801('0x27')](_0x10c34e);};}exports['index']=function(_0x2dfb9e,_0xb8dda4){var _0x5c8d1c={},_0x42a0f5={},_0x38eda4={'count':0x0,'rows':[]};var _0x5e9fc0=_['map'](db[_0xc801('0x28')][_0xc801('0x29')],function(_0x4f9197){return{'name':_0x4f9197[_0xc801('0x2a')],'type':_0x4f9197[_0xc801('0x2b')]['key']};});_0x42a0f5[_0xc801('0x2c')]=_[_0xc801('0x2d')](_0x5e9fc0,_0xc801('0x26'));_0x42a0f5['query']=_[_0xc801('0x2e')](_0x2dfb9e[_0xc801('0x2f')]);_0x42a0f5[_0xc801('0x30')]=_['intersection'](_0x42a0f5[_0xc801('0x2c')],_0x42a0f5[_0xc801('0x2f')]);_0x5c8d1c['attributes']=_[_0xc801('0x31')](_0x42a0f5[_0xc801('0x2c')],qs[_0xc801('0x32')](_0x2dfb9e[_0xc801('0x2f')][_0xc801('0x32')]));_0x5c8d1c[_0xc801('0x33')]=_0x5c8d1c[_0xc801('0x33')][_0xc801('0x34')]?_0x5c8d1c[_0xc801('0x33')]:_0x42a0f5[_0xc801('0x2c')];if(!_0x2dfb9e[_0xc801('0x2f')][_0xc801('0x35')]('nolimit')){_0x5c8d1c[_0xc801('0x1a')]=qs[_0xc801('0x1a')](_0x2dfb9e[_0xc801('0x2f')][_0xc801('0x1a')]);_0x5c8d1c[_0xc801('0x19')]=qs['offset'](_0x2dfb9e['query'][_0xc801('0x19')]);}_0x5c8d1c[_0xc801('0x36')]=qs[_0xc801('0x37')](_0x2dfb9e[_0xc801('0x2f')][_0xc801('0x37')]);_0x5c8d1c['where']=qs[_0xc801('0x30')](_[_0xc801('0x38')](_0x2dfb9e[_0xc801('0x2f')],_0x42a0f5['filters']),_0x5e9fc0);if(_0x2dfb9e[_0xc801('0x2f')]['filter']){_0x5c8d1c[_0xc801('0x39')]=_['merge'](_0x5c8d1c[_0xc801('0x39')],{'$or':_[_0xc801('0x2d')](_0x5e9fc0,function(_0x1c7272){if(_0x1c7272[_0xc801('0x2b')]!=='VIRTUAL'){var _0x345d71={};_0x345d71[_0x1c7272['name']]={'$like':'%'+_0x2dfb9e['query'][_0xc801('0x3a')]+'%'};return _0x345d71;}})});}_0x5c8d1c=_['merge']({},_0x5c8d1c,_0x2dfb9e[_0xc801('0x3b')]);var _0x5c70eb={'where':_0x5c8d1c['where']};return db[_0xc801('0x28')][_0xc801('0x1c')](_0x5c70eb)[_0xc801('0x24')](function(_0x454043){_0x38eda4['count']=_0x454043;if(_0x2dfb9e[_0xc801('0x2f')]['includeAll']){_0x5c8d1c[_0xc801('0x3c')]=[{'all':!![]}];}return db[_0xc801('0x28')][_0xc801('0x3d')](_0x5c8d1c);})[_0xc801('0x24')](function(_0x16de5a){_0x38eda4[_0xc801('0x3e')]=_0x16de5a;return _0x38eda4;})[_0xc801('0x24')](respondWithFilteredResult(_0xb8dda4,_0x5c8d1c))[_0xc801('0x3f')](handleError(_0xb8dda4,null));};exports[_0xc801('0x40')]=function(_0xfc4355,_0xaa295d){var _0x22832e={'raw':![],'where':{'id':_0xfc4355['params']['id']}},_0x330feb={};_0x330feb['model']=_[_0xc801('0x2e')](db[_0xc801('0x28')][_0xc801('0x29')]);_0x330feb[_0xc801('0x2f')]=_['keys'](_0xfc4355['query']);_0x330feb[_0xc801('0x30')]=_[_0xc801('0x31')](_0x330feb[_0xc801('0x2c')],_0x330feb[_0xc801('0x2f')]);_0x22832e[_0xc801('0x33')]=_[_0xc801('0x31')](_0x330feb[_0xc801('0x2c')],qs['fields'](_0xfc4355[_0xc801('0x2f')][_0xc801('0x32')]));_0x22832e[_0xc801('0x33')]=_0x22832e[_0xc801('0x33')][_0xc801('0x34')]?_0x22832e['attributes']:_0x330feb[_0xc801('0x2c')];if(_0xfc4355['query'][_0xc801('0x41')]){_0x22832e[_0xc801('0x3c')]=[{'all':!![]}];}_0x22832e=_[_0xc801('0x42')]({},_0x22832e,_0xfc4355[_0xc801('0x3b')]);return db[_0xc801('0x28')][_0xc801('0x43')](_0x22832e)[_0xc801('0x24')](handleEntityNotFound(_0xaa295d,null))[_0xc801('0x24')](respondWithResult(_0xaa295d,null))['catch'](handleError(_0xaa295d,null));};exports[_0xc801('0x44')]=function(_0x3f1b0f,_0x3b6a62){return db[_0xc801('0x28')][_0xc801('0x44')](_0x3f1b0f[_0xc801('0x45')],{})[_0xc801('0x24')](respondWithResult(_0x3b6a62,0xc9))[_0xc801('0x3f')](handleError(_0x3b6a62,null));};exports[_0xc801('0x23')]=function(_0x3957dc,_0x53d295){if(_0x3957dc[_0xc801('0x45')]['id']){delete _0x3957dc[_0xc801('0x45')]['id'];}return db[_0xc801('0x28')][_0xc801('0x43')]({'where':{'id':_0x3957dc[_0xc801('0x46')]['id']}})[_0xc801('0x24')](handleEntityNotFound(_0x53d295,null))['then'](saveUpdates(_0x3957dc[_0xc801('0x45')],null))[_0xc801('0x24')](respondWithResult(_0x53d295,null))[_0xc801('0x3f')](handleError(_0x53d295,null));};exports['destroy']=function(_0x4faa72,_0x55f7bc){return db['FreshsalesAccount'][_0xc801('0x43')]({'where':{'id':_0x4faa72[_0xc801('0x46')]['id']}})[_0xc801('0x24')](handleEntityNotFound(_0x55f7bc,null))['then'](removeEntity(_0x55f7bc,null))[_0xc801('0x3f')](handleError(_0x55f7bc,null));};exports[_0xc801('0x47')]=function(_0x1295dd,_0x9fcd1a,_0x49bec2){var _0x47cbaf={};var _0x19cbcf={};var _0x72b165;var _0x32c754;return db[_0xc801('0x28')][_0xc801('0x48')]({'where':{'id':_0x1295dd[_0xc801('0x46')]['id']}})[_0xc801('0x24')](handleEntityNotFound(_0x9fcd1a,null))['then'](function(_0x5a2e9e){if(_0x5a2e9e){_0x72b165=_0x5a2e9e;_0x19cbcf[_0xc801('0x2c')]=_[_0xc801('0x2e')](db['FreshsalesConfiguration']['rawAttributes']);_0x19cbcf['query']=_['keys'](_0x1295dd[_0xc801('0x2f')]);_0x19cbcf[_0xc801('0x30')]=_[_0xc801('0x31')](_0x19cbcf[_0xc801('0x2c')],_0x19cbcf[_0xc801('0x2f')]);_0x47cbaf['attributes']=_['intersection'](_0x19cbcf[_0xc801('0x2c')],qs['fields'](_0x1295dd[_0xc801('0x2f')][_0xc801('0x32')]));_0x47cbaf[_0xc801('0x33')]=_0x47cbaf['attributes'][_0xc801('0x34')]?_0x47cbaf['attributes']:_0x19cbcf[_0xc801('0x2c')];_0x47cbaf['order']=qs[_0xc801('0x37')](_0x1295dd[_0xc801('0x2f')][_0xc801('0x37')]);_0x47cbaf[_0xc801('0x39')]=qs[_0xc801('0x30')](_['pick'](_0x1295dd[_0xc801('0x2f')],_0x19cbcf[_0xc801('0x30')]));if(_0x1295dd[_0xc801('0x2f')][_0xc801('0x3a')]){_0x47cbaf[_0xc801('0x39')]=_[_0xc801('0x42')](_0x47cbaf[_0xc801('0x39')],{'$or':_[_0xc801('0x2d')](_0x47cbaf[_0xc801('0x33')],function(_0x59e177){var _0x5317f3={};_0x5317f3[_0x59e177]={'$like':'%'+_0x1295dd[_0xc801('0x2f')][_0xc801('0x3a')]+'%'};return _0x5317f3;})});}_0x47cbaf=_[_0xc801('0x42')]({},_0x47cbaf,_0x1295dd[_0xc801('0x3b')]);return _0x72b165[_0xc801('0x47')](_0x47cbaf);}})[_0xc801('0x24')](function(_0x2addf2){if(_0x2addf2){_0x32c754=_0x2addf2[_0xc801('0x34')];if(!_0x1295dd[_0xc801('0x2f')][_0xc801('0x35')](_0xc801('0x49'))){_0x47cbaf[_0xc801('0x1a')]=qs[_0xc801('0x1a')](_0x1295dd[_0xc801('0x2f')][_0xc801('0x1a')]);_0x47cbaf[_0xc801('0x19')]=qs[_0xc801('0x19')](_0x1295dd[_0xc801('0x2f')][_0xc801('0x19')]);}return _0x72b165[_0xc801('0x47')](_0x47cbaf);}})[_0xc801('0x24')](function(_0x216878){if(_0x216878){return _0x216878?{'count':_0x32c754,'rows':_0x216878}:null;}})[_0xc801('0x24')](respondWithResult(_0x9fcd1a,null))[_0xc801('0x3f')](handleError(_0x9fcd1a,null));};exports[_0xc801('0x4a')]=function(_0x53a667,_0x135dfd,_0x506d4a){if(_0x53a667[_0xc801('0x45')]['id']){delete _0x53a667[_0xc801('0x45')]['id'];}return db['FreshsalesAccount'][_0xc801('0x48')]({'where':{'id':_0x53a667[_0xc801('0x46')]['id']}})[_0xc801('0x24')](handleEntityNotFound(_0x135dfd,null))['then'](function(_0x3f4080){if(_0x3f4080){_0x53a667[_0xc801('0x45')]['AccountId']=_0x3f4080['id'];_0x53a667[_0xc801('0x45')][_0xc801('0x4b')]=integrations[_0xc801('0x4c')](_0x53a667[_0xc801('0x45')][_0xc801('0x4d')],_0x53a667['body'][_0xc801('0x2b')]);_0x53a667[_0xc801('0x45')][_0xc801('0x4e')]=integrations['getDescriptions'](_0x53a667[_0xc801('0x45')][_0xc801('0x4d')],_0x53a667[_0xc801('0x45')]['type']);return db[_0xc801('0x4f')][_0xc801('0x44')](_0x53a667[_0xc801('0x45')],{'include':[{'model':db[_0xc801('0x50')],'as':'Subjects'},{'model':db[_0xc801('0x50')],'as':_0xc801('0x4e')}]});}return null;})[_0xc801('0x24')](respondWithResult(_0x135dfd,null))[_0xc801('0x3f')](handleError(_0x135dfd,null));};exports[_0xc801('0x51')]=function(_0xa19be6,_0x2ff828,_0xb49973){var _0x4341e4='';var _0x2c8b15='';return db[_0xc801('0x28')][_0xc801('0x48')]({'where':{'id':_0xa19be6['params']['id']},'attributes':['id',_0xc801('0x52'),'remoteUri',_0xc801('0x53')]})[_0xc801('0x24')](handleEntityNotFound(_0x2ff828,null))[_0xc801('0x24')](function(_0x2902f8){if(_0x2902f8){_0x2c8b15=_0x2902f8[_0xc801('0x52')];_0x4341e4=_0x2902f8[_0xc801('0x54')];var _0xc8ef28=_0x2902f8[_0xc801('0x54')][_0xc801('0x55')](-0x1);if(_0xc8ef28==='/'){_0x4341e4=_0x4341e4[_0xc801('0x56')](0x0,_0x4341e4['lastIndexOf'](_0xc8ef28));}return rp({'method':_0xc801('0x57'),'uri':util[_0xc801('0x58')](_0xc801('0x59'),_0x4341e4,_0xc801('0x5a')),'headers':{'Authorization':_0xc801('0x5b')+_0x2902f8['apiKey']},'json':!![]});}})[_0xc801('0x24')](function(_0x58b5e8){if(_0x58b5e8){var _0x3e3814=_0x58b5e8[_0xc801('0x5c')];var _0x466b12=![];var _0x341308=null;for(_0x341308=0x0;_0x341308<_0x3e3814['length'];_0x341308++){if(_0x3e3814[_0x341308][_0xc801('0x5d')]===_0x2c8b15){_0x466b12=!![];}}if(_0x466b12){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xc801('0x5e')});}}})[_0xc801('0x24')](respondWithResult(_0x2ff828,null))[_0xc801('0x3f')](function(_0x4496ec){var _0x25307c=_0xa19be6[_0xc801('0x2f')]['test']?0x1f4:_0x4496ec['statusCode']||0x1f4;logger[_0xc801('0x25')](_0xc801('0x5f'),_0xc801('0x51'),_0x25307c,JSON[_0xc801('0x60')](_0x4496ec));delete _0x4496ec[_0xc801('0x26')];if(_0x25307c===0x191){_0x25307c=0x190;}_0x2ff828['status'](_0x25307c)['send'](_0xa19be6[_0xc801('0x2f')]['test']?{'message':_0xc801('0x61'),'statusCode':_0x4496ec[_0xc801('0x62')]}:_0x4496ec);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 904ffa9..c1b6f0f 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 _0x3d04=['bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','int_freshsales_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1aea5f,_0x5378c1){var _0x23dd26=function(_0x592800){while(--_0x592800){_0x1aea5f['push'](_0x1aea5f['shift']());}};_0x23dd26(++_0x5378c1);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));var integrations=require(_0x43d0('0xa'));module[_0x43d0('0xb')]=function(_0x5e284f,_0x484271){return _0x5e284f['define']('FreshsalesAccount',attributes,{'tableName':_0x43d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x53417c,_0x126dee){var _0x49407d=function(_0x1b1737){while(--_0x1b1737){_0x53417c['push'](_0x53417c['shift']());}};_0x49407d(++_0x126dee);}(_0x1883,0xab));var _0x3188=function(_0x12d0c4,_0x682221){_0x12d0c4=_0x12d0c4-0x0;var _0x4eed30=_0x1883[_0x12d0c4];return _0x4eed30;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));var integrations=require(_0x3188('0xb'));module[_0x3188('0xc')]=function(_0x33b62d,_0x24f2f1){return _0x33b62d[_0x3188('0xd')](_0x3188('0xe'),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 e3ddb27..23df197 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 _0x524e=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFreshsalesAccount','catch','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x49e5f9,_0x38d639){var _0x31aa57=function(_0x50d6ff){while(--_0x50d6ff){_0x49e5f9['push'](_0x49e5f9['shift']());}};_0x31aa57(++_0x38d639);}(_0x524e,0x15e));var _0xe524=function(_0x364f67,_0x2e0cb7){_0x364f67=_0x364f67-0x0;var _0x15f2f7=_0x524e[_0x364f67];return _0x15f2f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['GetFreshsalesAccount']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')]({'raw':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]===undefined?!![]:![]:!![],'where':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1c')]||null:null,'include':_0x3a4027[_0xe524('0x18')]?_0x3a4027['options'][_0xe524('0x1d')]?_['map'](_0x3a4027['options'][_0xe524('0x1d')],function(_0x23df5e){return{'model':db[_0x23df5e[_0xe524('0x1e')]],'as':_0x23df5e['as'],'attributes':_0x23df5e[_0xe524('0x1b')],'include':_0x23df5e['include']?_[_0xe524('0x1f')](_0x23df5e['include'],function(_0x17e245){return{'model':db[_0x17e245[_0xe524('0x1e')]],'as':_0x17e245['as'],'attributes':_0x17e245[_0xe524('0x1b')],'include':_0x17e245[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x17e245[_0xe524('0x1d')],function(_0x2141db){return{'model':db[_0x2141db['model']],'as':_0x2141db['as'],'attributes':_0x2141db['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x45abad){logger[_0xe524('0xd')](_0xe524('0x20'),_0x3a4027);logger[_0xe524('0x10')]('GetFreshsalesAccount',_0x3a4027,JSON['stringify'](_0x45abad));_0x11b2a1(_0x45abad);})[_0xe524('0x21')](function(_0x25e7a7){logger[_0xe524('0x13')](_0xe524('0x20'),_0x25e7a7[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb['error'](0x1f4,_0x25e7a7[_0xe524('0x15')]));});});};exports[_0xe524('0x22')]=function(_0x4a4e15){var _0x5b7ded=this;return new Promise(function(_0x20688e,_0x376324){return db['FreshsalesAccount'][_0xe524('0x23')]({'raw':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['attributes']||null:null,'include':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')]?_['map'](_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')],function(_0x49c43e){return{'model':db[_0x49c43e[_0xe524('0x1e')]],'as':_0x49c43e['as'],'attributes':_0x49c43e[_0xe524('0x1b')],'include':_0x49c43e[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x49c43e['include'],function(_0x415450){return{'model':db[_0x415450[_0xe524('0x1e')]],'as':_0x415450['as'],'attributes':_0x415450[_0xe524('0x1b')],'include':_0x415450[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x415450[_0xe524('0x1d')],function(_0x2741e8){return{'model':db[_0x2741e8[_0xe524('0x1e')]],'as':_0x2741e8['as'],'attributes':_0x2741e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x56f371){logger[_0xe524('0xd')](_0xe524('0x22'),_0x4a4e15);logger['debug'](_0xe524('0x22'),_0x4a4e15,JSON['stringify'](_0x56f371));_0x20688e(_0x56f371);})[_0xe524('0x21')](function(_0x41af26){logger[_0xe524('0x13')](_0xe524('0x22'),_0x41af26[_0xe524('0x15')],_0x4a4e15);_0x376324(_0x5b7ded[_0xe524('0x13')](0x1f4,_0x41af26[_0xe524('0x15')]));});});}; \ No newline at end of file +var _0x8952=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','raw','debug','util','moment','bluebird'];(function(_0x422b48,_0xf131fb){var _0x4a6f67=function(_0x13309e){while(--_0x13309e){_0x422b48['push'](_0x422b48['shift']());}};_0x4a6f67(++_0xf131fb);}(_0x8952,0x17e));var _0x2895=function(_0x51f778,_0xc6432f){_0x51f778=_0x51f778-0x0;var _0x230539=_0x8952[_0x51f778];return _0x230539;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});}exports[_0x2895('0x15')]=function(_0xbf8b63){var _0x2cb505=this;return new Promise(function(_0x155124,_0x184d11){return db[_0x2895('0x16')][_0x2895('0x17')]({'raw':_0xbf8b63['options']?_0xbf8b63['options']['raw']===undefined?!![]:![]:!![],'where':_0xbf8b63[_0x2895('0x18')]?_0xbf8b63[_0x2895('0x18')][_0x2895('0x19')]||null:null,'attributes':_0xbf8b63['options']?_0xbf8b63[_0x2895('0x18')][_0x2895('0x1a')]||null:null,'limit':_0xbf8b63[_0x2895('0x18')]?_0xbf8b63[_0x2895('0x18')][_0x2895('0x1b')]||null:null,'include':_0xbf8b63['options']?_0xbf8b63[_0x2895('0x18')][_0x2895('0x1c')]?_['map'](_0xbf8b63[_0x2895('0x18')][_0x2895('0x1c')],function(_0x6f8ad4){return{'model':db[_0x6f8ad4['model']],'as':_0x6f8ad4['as'],'attributes':_0x6f8ad4['attributes'],'include':_0x6f8ad4[_0x2895('0x1c')]?_[_0x2895('0x1d')](_0x6f8ad4[_0x2895('0x1c')],function(_0x4a21cf){return{'model':db[_0x4a21cf[_0x2895('0x1e')]],'as':_0x4a21cf['as'],'attributes':_0x4a21cf[_0x2895('0x1a')],'include':_0x4a21cf['include']?_[_0x2895('0x1d')](_0x4a21cf[_0x2895('0x1c')],function(_0x2cd4df){return{'model':db[_0x2cd4df['model']],'as':_0x2cd4df['as'],'attributes':_0x2cd4df[_0x2895('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2895('0xc')](function(_0x5eedfc){logger[_0x2895('0xd')]('GetFreshsalesAccount',_0xbf8b63);logger['debug'](_0x2895('0x15'),_0xbf8b63,JSON['stringify'](_0x5eedfc));_0x155124(_0x5eedfc);})[_0x2895('0x14')](function(_0x381538){logger['error']('GetFreshsalesAccount',_0x381538[_0x2895('0x12')],_0xbf8b63);_0x184d11(_0x2cb505[_0x2895('0x10')](0x1f4,_0x381538[_0x2895('0x12')]));});});};exports[_0x2895('0x1f')]=function(_0x14d150){var _0xa61689=this;return new Promise(function(_0x34e110,_0x546514){return db[_0x2895('0x16')][_0x2895('0x20')]({'raw':_0x14d150[_0x2895('0x18')]?_0x14d150['options'][_0x2895('0x21')]===undefined?!![]:![]:!![],'where':_0x14d150[_0x2895('0x18')]?_0x14d150[_0x2895('0x18')][_0x2895('0x19')]||null:null,'attributes':_0x14d150['options']?_0x14d150[_0x2895('0x18')][_0x2895('0x1a')]||null:null,'include':_0x14d150[_0x2895('0x18')]?_0x14d150[_0x2895('0x18')][_0x2895('0x1c')]?_['map'](_0x14d150['options'][_0x2895('0x1c')],function(_0xf3c8f7){return{'model':db[_0xf3c8f7['model']],'as':_0xf3c8f7['as'],'attributes':_0xf3c8f7[_0x2895('0x1a')],'include':_0xf3c8f7['include']?_[_0x2895('0x1d')](_0xf3c8f7[_0x2895('0x1c')],function(_0x586c4a){return{'model':db[_0x586c4a[_0x2895('0x1e')]],'as':_0x586c4a['as'],'attributes':_0x586c4a['attributes'],'include':_0x586c4a[_0x2895('0x1c')]?_['map'](_0x586c4a['include'],function(_0xa6fe9e){return{'model':db[_0xa6fe9e[_0x2895('0x1e')]],'as':_0xa6fe9e['as'],'attributes':_0xa6fe9e[_0x2895('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e4348){logger[_0x2895('0xd')](_0x2895('0x1f'),_0x14d150);logger[_0x2895('0x22')](_0x2895('0x1f'),_0x14d150,JSON[_0x2895('0xf')](_0x1e4348));_0x34e110(_0x1e4348);})[_0x2895('0x14')](function(_0x240230){logger[_0x2895('0x10')](_0x2895('0x1f'),_0x240230['message'],_0x14d150);_0x546514(_0xa61689[_0x2895('0x10')](0x1f4,_0x240230[_0x2895('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index f37a174..417bac7 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 _0xfd6e=['/:id','show','getSubjects','/:id/fields','getFields','post','create','put','update','destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xfd6e,0xee));var _0xefd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd6e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xefd6('0x0'));var timeout=require(_0xefd6('0x1'));var express=require(_0xefd6('0x2'));var router=express['Router']();var fs_extra=require(_0xefd6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xefd6('0x4'));var config=require('../../config/environment');var controller=require(_0xefd6('0x5'));router[_0xefd6('0x6')]('/',auth[_0xefd6('0x7')](),controller[_0xefd6('0x8')]);router[_0xefd6('0x6')](_0xefd6('0x9'),auth[_0xefd6('0x7')](),controller[_0xefd6('0xa')]);router[_0xefd6('0x6')]('/:id/subjects',auth[_0xefd6('0x7')](),controller[_0xefd6('0xb')]);router[_0xefd6('0x6')]('/:id/descriptions',auth[_0xefd6('0x7')](),controller['getDescriptions']);router[_0xefd6('0x6')](_0xefd6('0xc'),auth[_0xefd6('0x7')](),controller[_0xefd6('0xd')]);router[_0xefd6('0xe')]('/',auth['isAuthenticated'](),controller[_0xefd6('0xf')]);router[_0xefd6('0x10')]('/:id',auth[_0xefd6('0x7')](),controller[_0xefd6('0x11')]);router['delete']('/:id',auth[_0xefd6('0x7')](),controller[_0xefd6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x24c7=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','show','/:id/subjects','getDescriptions','/:id/fields','getFields','post','create','put','/:id','update'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0x24c7,0x118));var _0x724c=function(_0x187bf5,_0x3b978e){_0x187bf5=_0x187bf5-0x0;var _0x5f3ff5=_0x24c7[_0x187bf5];return _0x5f3ff5;};'use strict';var multer=require(_0x724c('0x0'));var util=require(_0x724c('0x1'));var path=require(_0x724c('0x2'));var timeout=require(_0x724c('0x3'));var express=require(_0x724c('0x4'));var router=express[_0x724c('0x5')]();var fs_extra=require(_0x724c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x724c('0x7'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x724c('0x8')]('/',auth[_0x724c('0x9')](),controller['index']);router[_0x724c('0x8')]('/:id',auth[_0x724c('0x9')](),controller[_0x724c('0xa')]);router[_0x724c('0x8')](_0x724c('0xb'),auth[_0x724c('0x9')](),controller['getSubjects']);router[_0x724c('0x8')]('/:id/descriptions',auth[_0x724c('0x9')](),controller[_0x724c('0xc')]);router['get'](_0x724c('0xd'),auth[_0x724c('0x9')](),controller[_0x724c('0xe')]);router[_0x724c('0xf')]('/',auth[_0x724c('0x9')](),controller[_0x724c('0x10')]);router[_0x724c('0x11')](_0x724c('0x12'),auth[_0x724c('0x9')](),controller[_0x724c('0x13')]);router['delete'](_0x724c('0x12'),auth[_0x724c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 3d3b425..1617066 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 _0xee59=['exports','STRING','sequelize'];(function(_0x47f47b,_0x33d82a){var _0x3e629f=function(_0x5f508a){while(--_0x5f508a){_0x47f47b['push'](_0x47f47b['shift']());}};_0x3e629f(++_0x33d82a);}(_0xee59,0x1b8));var _0x9ee5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee59[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9ee5('0x0'));module[_0x9ee5('0x1')]={'name':{'type':Sequelize[_0x9ee5('0x2')]},'description':{'type':Sequelize[_0x9ee5('0x2')]}}; \ No newline at end of file +var _0x5016=['exports','STRING'];(function(_0x3f60e6,_0x2f4955){var _0x32a9ab=function(_0x376f28){while(--_0x376f28){_0x3f60e6['push'](_0x3f60e6['shift']());}};_0x32a9ab(++_0x2f4955);}(_0x5016,0x17a));var _0x6501=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0x5016[_0x1b4002];return _0x1716f3;};'use strict';var Sequelize=require('sequelize');module[_0x6501('0x0')]={'name':{'type':Sequelize[_0x6501('0x1')]},'description':{'type':Sequelize[_0x6501('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index bc7c7a4..637cd5c 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 _0x7b95=['pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x12728f,_0x3a3ac2){var _0x242959=function(_0x56d3ca){while(--_0x56d3ca){_0x12728f['push'](_0x12728f['shift']());}};_0x242959(++_0x3a3ac2);}(_0x7b95,0x66));var _0x57b9=function(_0x3ba89a,_0x3f4ec5){_0x3ba89a=_0x3ba89a-0x0;var _0xf8e0bc=_0x7b95[_0x3ba89a];return _0xf8e0bc;};'use strict';var emlformat=require(_0x57b9('0x0'));var rimraf=require(_0x57b9('0x1'));var zipdir=require(_0x57b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57b9('0x3'));var moment=require('moment');var BPromise=require(_0x57b9('0x4'));var Mustache=require(_0x57b9('0x5'));var util=require('util');var path=require(_0x57b9('0x6'));var sox=require(_0x57b9('0x7'));var csv=require('to-csv');var ejs=require(_0x57b9('0x8'));var fs=require('fs');var fs_extra=require(_0x57b9('0x9'));var _=require(_0x57b9('0xa'));var squel=require(_0x57b9('0xb'));var crypto=require(_0x57b9('0xc'));var jsforce=require(_0x57b9('0xd'));var deskjs=require(_0x57b9('0xe'));var toCsv=require(_0x57b9('0xf'));var querystring=require(_0x57b9('0x10'));var Papa=require('papaparse');var Redis=require(_0x57b9('0x11'));var authService=require(_0x57b9('0x12'));var qs=require(_0x57b9('0x13'));var as=require(_0x57b9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x57b9('0x15'))('api');var utils=require(_0x57b9('0x16'));var config=require(_0x57b9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x57b9('0x18'))['db'];function respondWithStatusCode(_0x36371a,_0x59f21c){_0x59f21c=_0x59f21c||0xcc;return function(_0x4229d6){if(_0x4229d6){return _0x36371a['sendStatus'](_0x59f21c);}return _0x36371a[_0x57b9('0x19')](_0x59f21c)[_0x57b9('0x1a')]();};}function respondWithResult(_0x2936a9,_0xba1157){_0xba1157=_0xba1157||0xc8;return function(_0x27eb51){if(_0x27eb51){return _0x2936a9[_0x57b9('0x19')](_0xba1157)[_0x57b9('0x1b')](_0x27eb51);}};}function respondWithFilteredResult(_0x4dbeb9,_0x5afb16){return function(_0x4af6ce){if(_0x4af6ce){var _0x33d246=typeof _0x5afb16[_0x57b9('0x1c')]==='undefined'&&typeof _0x5afb16[_0x57b9('0x1d')]===_0x57b9('0x1e');var _0x456b23=_0x4af6ce[_0x57b9('0x1f')];var _0x50f968=_0x33d246?0x0:_0x5afb16[_0x57b9('0x1c')];var _0x4f6ec6=_0x33d246?_0x4af6ce[_0x57b9('0x1f')]:_0x5afb16[_0x57b9('0x1c')]+_0x5afb16[_0x57b9('0x1d')];var _0x3d3315;if(_0x4f6ec6>=_0x456b23){_0x4f6ec6=_0x456b23;_0x3d3315=0xc8;}else{_0x3d3315=0xce;}_0x4dbeb9[_0x57b9('0x19')](_0x3d3315);return _0x4dbeb9['set'](_0x57b9('0x20'),_0x50f968+'-'+_0x4f6ec6+'/'+_0x456b23)[_0x57b9('0x1b')](_0x4af6ce);}return null;};}function patchUpdates(_0x1a93fe){return function(_0x1c6fbf){try{jsonpatch[_0x57b9('0x21')](_0x1c6fbf,_0x1a93fe,!![]);}catch(_0x4dfabb){return BPromise[_0x57b9('0x22')](_0x4dfabb);}return _0x1c6fbf['save']();};}function saveUpdates(_0x51046e,_0x5a787d){return function(_0x1dd73f){if(_0x1dd73f){return _0x1dd73f[_0x57b9('0x23')](_0x51046e)[_0x57b9('0x24')](function(_0x2f5eb0){return _0x2f5eb0;});}return null;};}function removeEntity(_0x312eb6,_0x5a649a){return function(_0x4be9aa){if(_0x4be9aa){return _0x4be9aa[_0x57b9('0x25')]()[_0x57b9('0x24')](function(){_0x312eb6['status'](0xcc)[_0x57b9('0x1a')]();});}};}function handleEntityNotFound(_0x116a84,_0x2c663f){return function(_0x4c3337){if(!_0x4c3337){_0x116a84[_0x57b9('0x26')](0x194);}return _0x4c3337;};}function handleError(_0x238616,_0x135a95){_0x135a95=_0x135a95||0x1f4;return function(_0x1e4ddd){logger[_0x57b9('0x27')](_0x1e4ddd[_0x57b9('0x28')]);if(_0x1e4ddd[_0x57b9('0x29')]){delete _0x1e4ddd[_0x57b9('0x29')];}_0x238616[_0x57b9('0x19')](_0x135a95)[_0x57b9('0x2a')](_0x1e4ddd);};}exports['index']=function(_0x1ee40c,_0x2748ed){var _0x4953be={},_0x1dd51a={},_0x52e60f={'count':0x0,'rows':[]};var _0x35f8e3=_[_0x57b9('0x2b')](db[_0x57b9('0x2c')][_0x57b9('0x2d')],function(_0x5557a6){return{'name':_0x5557a6[_0x57b9('0x2e')],'type':_0x5557a6['type']['key']};});_0x1dd51a[_0x57b9('0x2f')]=_[_0x57b9('0x2b')](_0x35f8e3,_0x57b9('0x29'));_0x1dd51a[_0x57b9('0x30')]=_[_0x57b9('0x31')](_0x1ee40c[_0x57b9('0x30')]);_0x1dd51a['filters']=_[_0x57b9('0x32')](_0x1dd51a[_0x57b9('0x2f')],_0x1dd51a[_0x57b9('0x30')]);_0x4953be[_0x57b9('0x33')]=_[_0x57b9('0x32')](_0x1dd51a[_0x57b9('0x2f')],qs['fields'](_0x1ee40c[_0x57b9('0x30')][_0x57b9('0x34')]));_0x4953be['attributes']=_0x4953be[_0x57b9('0x33')]['length']?_0x4953be['attributes']:_0x1dd51a['model'];if(!_0x1ee40c['query'][_0x57b9('0x35')](_0x57b9('0x36'))){_0x4953be['limit']=qs[_0x57b9('0x1d')](_0x1ee40c[_0x57b9('0x30')]['limit']);_0x4953be[_0x57b9('0x1c')]=qs[_0x57b9('0x1c')](_0x1ee40c[_0x57b9('0x30')][_0x57b9('0x1c')]);}_0x4953be[_0x57b9('0x37')]=qs[_0x57b9('0x38')](_0x1ee40c['query'][_0x57b9('0x38')]);_0x4953be[_0x57b9('0x39')]=qs['filters'](_[_0x57b9('0x3a')](_0x1ee40c[_0x57b9('0x30')],_0x1dd51a[_0x57b9('0x3b')]),_0x35f8e3);if(_0x1ee40c[_0x57b9('0x30')][_0x57b9('0x3c')]){_0x4953be['where']=_[_0x57b9('0x3d')](_0x4953be['where'],{'$or':_['map'](_0x35f8e3,function(_0x302875){if(_0x302875[_0x57b9('0x3e')]!==_0x57b9('0x3f')){var _0x20fe28={};_0x20fe28[_0x302875['name']]={'$like':'%'+_0x1ee40c['query']['filter']+'%'};return _0x20fe28;}})});}_0x4953be=_[_0x57b9('0x3d')]({},_0x4953be,_0x1ee40c[_0x57b9('0x40')]);var _0x3d78c9={'where':_0x4953be[_0x57b9('0x39')]};return db[_0x57b9('0x2c')][_0x57b9('0x1f')](_0x3d78c9)[_0x57b9('0x24')](function(_0xfd70d1){_0x52e60f['count']=_0xfd70d1;if(_0x1ee40c[_0x57b9('0x30')][_0x57b9('0x41')]){_0x4953be[_0x57b9('0x42')]=[{'all':!![]}];}return db[_0x57b9('0x2c')]['findAll'](_0x4953be);})[_0x57b9('0x24')](function(_0x48dda8){_0x52e60f[_0x57b9('0x43')]=_0x48dda8;return _0x52e60f;})['then'](respondWithFilteredResult(_0x2748ed,_0x4953be))[_0x57b9('0x44')](handleError(_0x2748ed,null));};exports[_0x57b9('0x45')]=function(_0x4487f1,_0x58244b){var _0x168cdc={'raw':![],'where':{'id':_0x4487f1[_0x57b9('0x46')]['id']}},_0x405ead={};_0x405ead[_0x57b9('0x2f')]=_[_0x57b9('0x31')](db[_0x57b9('0x2c')]['rawAttributes']);_0x405ead[_0x57b9('0x30')]=_[_0x57b9('0x31')](_0x4487f1[_0x57b9('0x30')]);_0x405ead[_0x57b9('0x3b')]=_[_0x57b9('0x32')](_0x405ead['model'],_0x405ead[_0x57b9('0x30')]);_0x168cdc[_0x57b9('0x33')]=_[_0x57b9('0x32')](_0x405ead['model'],qs[_0x57b9('0x34')](_0x4487f1['query'][_0x57b9('0x34')]));_0x168cdc[_0x57b9('0x33')]=_0x168cdc[_0x57b9('0x33')][_0x57b9('0x47')]?_0x168cdc[_0x57b9('0x33')]:_0x405ead[_0x57b9('0x2f')];if(_0x4487f1[_0x57b9('0x30')][_0x57b9('0x41')]){_0x168cdc['include']=[{'all':!![]}];}_0x168cdc=_[_0x57b9('0x3d')]({},_0x168cdc,_0x4487f1['options']);return db[_0x57b9('0x2c')][_0x57b9('0x48')](_0x168cdc)['then'](handleEntityNotFound(_0x58244b,null))[_0x57b9('0x24')](respondWithResult(_0x58244b,null))[_0x57b9('0x44')](handleError(_0x58244b,null));};exports[_0x57b9('0x49')]=function(_0x478c45,_0x365a47){return db['FreshsalesConfiguration'][_0x57b9('0x49')](_0x478c45['body'],{})[_0x57b9('0x24')](respondWithResult(_0x365a47,0xc9))['catch'](handleError(_0x365a47,null));};exports[_0x57b9('0x23')]=function(_0x4ffc5d,_0x52f4a7){if(_0x4ffc5d[_0x57b9('0x4a')]['id']){delete _0x4ffc5d[_0x57b9('0x4a')]['id'];}return db[_0x57b9('0x2c')]['find']({'where':{'id':_0x4ffc5d[_0x57b9('0x46')]['id']}})[_0x57b9('0x24')](handleEntityNotFound(_0x52f4a7,null))[_0x57b9('0x24')](saveUpdates(_0x4ffc5d['body'],null))[_0x57b9('0x24')](respondWithResult(_0x52f4a7,null))[_0x57b9('0x44')](handleError(_0x52f4a7,null));};exports[_0x57b9('0x25')]=function(_0x289173,_0x203fbc){return db['FreshsalesConfiguration'][_0x57b9('0x48')]({'where':{'id':_0x289173[_0x57b9('0x46')]['id']}})[_0x57b9('0x24')](handleEntityNotFound(_0x203fbc,null))[_0x57b9('0x24')](removeEntity(_0x203fbc,null))[_0x57b9('0x44')](handleError(_0x203fbc,null));};exports[_0x57b9('0x4b')]=function(_0x2a2cfd,_0x296f65,_0x5b9af1){var _0x1c5413={};var _0x19d7e5={};var _0x542eb7;var _0x3e4435;return db[_0x57b9('0x2c')][_0x57b9('0x4c')]({'where':{'id':_0x2a2cfd[_0x57b9('0x46')]['id']}})[_0x57b9('0x24')](handleEntityNotFound(_0x296f65,null))['then'](function(_0x59a2ca){if(_0x59a2ca){_0x542eb7=_0x59a2ca;_0x19d7e5[_0x57b9('0x2f')]=_[_0x57b9('0x31')](db[_0x57b9('0x4d')]['rawAttributes']);_0x19d7e5['query']=_[_0x57b9('0x31')](_0x2a2cfd[_0x57b9('0x30')]);_0x19d7e5[_0x57b9('0x3b')]=_['intersection'](_0x19d7e5[_0x57b9('0x2f')],_0x19d7e5['query']);_0x1c5413[_0x57b9('0x33')]=_[_0x57b9('0x32')](_0x19d7e5[_0x57b9('0x2f')],qs['fields'](_0x2a2cfd[_0x57b9('0x30')]['fields']));_0x1c5413[_0x57b9('0x33')]=_0x1c5413[_0x57b9('0x33')][_0x57b9('0x47')]?_0x1c5413[_0x57b9('0x33')]:_0x19d7e5[_0x57b9('0x2f')];_0x1c5413['order']=qs[_0x57b9('0x38')](_0x2a2cfd['query'][_0x57b9('0x38')]);_0x1c5413[_0x57b9('0x39')]=qs[_0x57b9('0x3b')](_[_0x57b9('0x3a')](_0x2a2cfd[_0x57b9('0x30')],_0x19d7e5['filters']));if(_0x2a2cfd[_0x57b9('0x30')]['filter']){_0x1c5413[_0x57b9('0x39')]=_[_0x57b9('0x3d')](_0x1c5413[_0x57b9('0x39')],{'$or':_[_0x57b9('0x2b')](_0x1c5413[_0x57b9('0x33')],function(_0x2468a9){var _0x236dbc={};_0x236dbc[_0x2468a9]={'$like':'%'+_0x2a2cfd[_0x57b9('0x30')][_0x57b9('0x3c')]+'%'};return _0x236dbc;})});}_0x1c5413=_['merge']({},_0x1c5413,_0x2a2cfd[_0x57b9('0x40')]);return _0x542eb7[_0x57b9('0x4b')](_0x1c5413);}})['then'](function(_0x5b04a6){if(_0x5b04a6){_0x3e4435=_0x5b04a6['length'];if(!_0x2a2cfd[_0x57b9('0x30')][_0x57b9('0x35')](_0x57b9('0x36'))){_0x1c5413[_0x57b9('0x1d')]=qs[_0x57b9('0x1d')](_0x2a2cfd[_0x57b9('0x30')][_0x57b9('0x1d')]);_0x1c5413[_0x57b9('0x1c')]=qs[_0x57b9('0x1c')](_0x2a2cfd['query'][_0x57b9('0x1c')]);}return _0x542eb7[_0x57b9('0x4b')](_0x1c5413);}})[_0x57b9('0x24')](function(_0x435d71){if(_0x435d71){return _0x435d71?{'count':_0x3e4435,'rows':_0x435d71}:null;}})[_0x57b9('0x24')](respondWithResult(_0x296f65,null))[_0x57b9('0x44')](handleError(_0x296f65,null));};exports['getDescriptions']=function(_0x3e3c01,_0x407129,_0x4d488c){var _0x3c71ef={};var _0x1dd507={};var _0x579437;var _0x50884a;return db[_0x57b9('0x2c')][_0x57b9('0x4c')]({'where':{'id':_0x3e3c01[_0x57b9('0x46')]['id']}})[_0x57b9('0x24')](handleEntityNotFound(_0x407129,null))[_0x57b9('0x24')](function(_0x3dc086){if(_0x3dc086){_0x579437=_0x3dc086;_0x1dd507[_0x57b9('0x2f')]=_[_0x57b9('0x31')](db[_0x57b9('0x4d')]['rawAttributes']);_0x1dd507[_0x57b9('0x30')]=_['keys'](_0x3e3c01[_0x57b9('0x30')]);_0x1dd507[_0x57b9('0x3b')]=_[_0x57b9('0x32')](_0x1dd507[_0x57b9('0x2f')],_0x1dd507[_0x57b9('0x30')]);_0x3c71ef[_0x57b9('0x33')]=_[_0x57b9('0x32')](_0x1dd507[_0x57b9('0x2f')],qs[_0x57b9('0x34')](_0x3e3c01['query']['fields']));_0x3c71ef[_0x57b9('0x33')]=_0x3c71ef[_0x57b9('0x33')]['length']?_0x3c71ef['attributes']:_0x1dd507[_0x57b9('0x2f')];_0x3c71ef['order']=qs[_0x57b9('0x38')](_0x3e3c01['query']['sort']);_0x3c71ef[_0x57b9('0x39')]=qs[_0x57b9('0x3b')](_[_0x57b9('0x3a')](_0x3e3c01[_0x57b9('0x30')],_0x1dd507[_0x57b9('0x3b')]));if(_0x3e3c01[_0x57b9('0x30')][_0x57b9('0x3c')]){_0x3c71ef[_0x57b9('0x39')]=_[_0x57b9('0x3d')](_0x3c71ef['where'],{'$or':_[_0x57b9('0x2b')](_0x3c71ef['attributes'],function(_0x5e8bfc){var _0x20416a={};_0x20416a[_0x5e8bfc]={'$like':'%'+_0x3e3c01[_0x57b9('0x30')][_0x57b9('0x3c')]+'%'};return _0x20416a;})});}_0x3c71ef=_[_0x57b9('0x3d')]({},_0x3c71ef,_0x3e3c01[_0x57b9('0x40')]);return _0x579437[_0x57b9('0x4e')](_0x3c71ef);}})[_0x57b9('0x24')](function(_0x4010ad){if(_0x4010ad){_0x50884a=_0x4010ad['length'];if(!_0x3e3c01['query'][_0x57b9('0x35')](_0x57b9('0x36'))){_0x3c71ef[_0x57b9('0x1d')]=qs[_0x57b9('0x1d')](_0x3e3c01[_0x57b9('0x30')][_0x57b9('0x1d')]);_0x3c71ef['offset']=qs['offset'](_0x3e3c01[_0x57b9('0x30')][_0x57b9('0x1c')]);}return _0x579437['getDescriptions'](_0x3c71ef);}})['then'](function(_0x38766e){if(_0x38766e){return _0x38766e?{'count':_0x50884a,'rows':_0x38766e}:null;}})[_0x57b9('0x24')](respondWithResult(_0x407129,null))[_0x57b9('0x44')](handleError(_0x407129,null));};exports[_0x57b9('0x4f')]=function(_0x4543dc,_0x6641c6,_0x3dc5f){var _0x46f940={};var _0x16df3f={};var _0x4a1a95;var _0x595be6;return db['FreshsalesConfiguration'][_0x57b9('0x4c')]({'where':{'id':_0x4543dc['params']['id']}})[_0x57b9('0x24')](handleEntityNotFound(_0x6641c6,null))['then'](function(_0x4f6908){if(_0x4f6908){_0x4a1a95=_0x4f6908;_0x16df3f[_0x57b9('0x2f')]=_['keys'](db[_0x57b9('0x4d')][_0x57b9('0x2d')]);_0x16df3f['query']=_[_0x57b9('0x31')](_0x4543dc[_0x57b9('0x30')]);_0x16df3f[_0x57b9('0x3b')]=_[_0x57b9('0x32')](_0x16df3f[_0x57b9('0x2f')],_0x16df3f[_0x57b9('0x30')]);_0x46f940[_0x57b9('0x33')]=_[_0x57b9('0x32')](_0x16df3f[_0x57b9('0x2f')],qs['fields'](_0x4543dc['query'][_0x57b9('0x34')]));_0x46f940[_0x57b9('0x33')]=_0x46f940[_0x57b9('0x33')][_0x57b9('0x47')]?_0x46f940[_0x57b9('0x33')]:_0x16df3f[_0x57b9('0x2f')];_0x46f940[_0x57b9('0x37')]=qs['sort'](_0x4543dc['query'][_0x57b9('0x38')]);_0x46f940[_0x57b9('0x39')]=qs[_0x57b9('0x3b')](_[_0x57b9('0x3a')](_0x4543dc[_0x57b9('0x30')],_0x16df3f[_0x57b9('0x3b')]));if(_0x4543dc['query'][_0x57b9('0x3c')]){_0x46f940[_0x57b9('0x39')]=_['merge'](_0x46f940[_0x57b9('0x39')],{'$or':_[_0x57b9('0x2b')](_0x46f940[_0x57b9('0x33')],function(_0x479d76){var _0x3c98d8={};_0x3c98d8[_0x479d76]={'$like':'%'+_0x4543dc['query'][_0x57b9('0x3c')]+'%'};return _0x3c98d8;})});}_0x46f940=_['merge']({},_0x46f940,_0x4543dc[_0x57b9('0x40')]);return _0x4a1a95[_0x57b9('0x4f')](_0x46f940);}})[_0x57b9('0x24')](function(_0x590729){if(_0x590729){_0x595be6=_0x590729['length'];if(!_0x4543dc[_0x57b9('0x30')][_0x57b9('0x35')]('nolimit')){_0x46f940[_0x57b9('0x1d')]=qs[_0x57b9('0x1d')](_0x4543dc[_0x57b9('0x30')][_0x57b9('0x1d')]);_0x46f940['offset']=qs[_0x57b9('0x1c')](_0x4543dc['query'][_0x57b9('0x1c')]);}return _0x4a1a95[_0x57b9('0x4f')](_0x46f940);}})['then'](function(_0x2825de){if(_0x2825de){return _0x2825de?{'count':_0x595be6,'rows':_0x2825de}:null;}})[_0x57b9('0x24')](respondWithResult(_0x6641c6,null))[_0x57b9('0x44')](handleError(_0x6641c6,null));}; \ No newline at end of file +var _0xb4d5=['fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','getSubjects','FreshsalesField','getDescriptions','nolimit','findOne','getFields','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','reject','destroy','then','sendStatus','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','query','keys','intersection','attributes','model'];(function(_0x14947c,_0x12b2df){var _0xe29056=function(_0x59482c){while(--_0x59482c){_0x14947c['push'](_0x14947c['shift']());}};_0xe29056(++_0x12b2df);}(_0xb4d5,0x162));var _0x5b4d=function(_0x44b8e7,_0xfad39e){_0x44b8e7=_0x44b8e7-0x0;var _0xf742e4=_0xb4d5[_0x44b8e7];return _0xf742e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b4d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b4d('0x1'));var rp=require(_0x5b4d('0x2'));var moment=require(_0x5b4d('0x3'));var BPromise=require(_0x5b4d('0x4'));var Mustache=require('mustache');var util=require(_0x5b4d('0x5'));var path=require(_0x5b4d('0x6'));var sox=require('sox');var csv=require(_0x5b4d('0x7'));var ejs=require(_0x5b4d('0x8'));var fs=require('fs');var fs_extra=require(_0x5b4d('0x9'));var _=require(_0x5b4d('0xa'));var squel=require(_0x5b4d('0xb'));var crypto=require(_0x5b4d('0xc'));var jsforce=require(_0x5b4d('0xd'));var deskjs=require(_0x5b4d('0xe'));var toCsv=require(_0x5b4d('0x7'));var querystring=require(_0x5b4d('0xf'));var Papa=require('papaparse');var Redis=require(_0x5b4d('0x10'));var authService=require(_0x5b4d('0x11'));var qs=require(_0x5b4d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b4d('0x13'))(_0x5b4d('0x14'));var utils=require(_0x5b4d('0x15'));var config=require(_0x5b4d('0x16'));var licenseUtil=require(_0x5b4d('0x17'));var db=require(_0x5b4d('0x18'))['db'];function respondWithStatusCode(_0x4b3b2f,_0x37a564){_0x37a564=_0x37a564||0xcc;return function(_0x407f1d){if(_0x407f1d){return _0x4b3b2f['sendStatus'](_0x37a564);}return _0x4b3b2f[_0x5b4d('0x19')](_0x37a564)[_0x5b4d('0x1a')]();};}function respondWithResult(_0x991dc2,_0x211eb6){_0x211eb6=_0x211eb6||0xc8;return function(_0x145d5e){if(_0x145d5e){return _0x991dc2[_0x5b4d('0x19')](_0x211eb6)['json'](_0x145d5e);}};}function respondWithFilteredResult(_0x30a6c7,_0x3a3281){return function(_0x16aa3c){if(_0x16aa3c){var _0x23b9a3=typeof _0x3a3281[_0x5b4d('0x1b')]==='undefined'&&typeof _0x3a3281[_0x5b4d('0x1c')]===_0x5b4d('0x1d');var _0x2152cd=_0x16aa3c[_0x5b4d('0x1e')];var _0x12aa05=_0x23b9a3?0x0:_0x3a3281[_0x5b4d('0x1b')];var _0x307d7e=_0x23b9a3?_0x16aa3c[_0x5b4d('0x1e')]:_0x3a3281[_0x5b4d('0x1b')]+_0x3a3281[_0x5b4d('0x1c')];var _0x452d05;if(_0x307d7e>=_0x2152cd){_0x307d7e=_0x2152cd;_0x452d05=0xc8;}else{_0x452d05=0xce;}_0x30a6c7['status'](_0x452d05);return _0x30a6c7[_0x5b4d('0x1f')](_0x5b4d('0x20'),_0x12aa05+'-'+_0x307d7e+'/'+_0x2152cd)['json'](_0x16aa3c);}return null;};}function patchUpdates(_0x75d752){return function(_0x416a0d){try{jsonpatch['apply'](_0x416a0d,_0x75d752,!![]);}catch(_0x28fd72){return BPromise[_0x5b4d('0x21')](_0x28fd72);}return _0x416a0d['save']();};}function saveUpdates(_0x1028f4,_0x3e8ad5){return function(_0x514fc1){if(_0x514fc1){return _0x514fc1['update'](_0x1028f4)['then'](function(_0x1bc214){return _0x1bc214;});}return null;};}function removeEntity(_0x11a96a,_0x5de624){return function(_0x3e9198){if(_0x3e9198){return _0x3e9198[_0x5b4d('0x22')]()[_0x5b4d('0x23')](function(){_0x11a96a[_0x5b4d('0x19')](0xcc)[_0x5b4d('0x1a')]();});}};}function handleEntityNotFound(_0x31f636,_0x27fb6f){return function(_0xfdc8e3){if(!_0xfdc8e3){_0x31f636[_0x5b4d('0x24')](0x194);}return _0xfdc8e3;};}function handleError(_0x99cdb7,_0x33716a){_0x33716a=_0x33716a||0x1f4;return function(_0x585957){logger[_0x5b4d('0x25')](_0x585957['stack']);if(_0x585957['name']){delete _0x585957[_0x5b4d('0x26')];}_0x99cdb7[_0x5b4d('0x19')](_0x33716a)[_0x5b4d('0x27')](_0x585957);};}exports[_0x5b4d('0x28')]=function(_0x4057e9,_0x4e93ff){var _0x6dd2a={},_0x5b3424={},_0x1bf990={'count':0x0,'rows':[]};var _0x1ea4cf=_[_0x5b4d('0x29')](db[_0x5b4d('0x2a')][_0x5b4d('0x2b')],function(_0x505c06){return{'name':_0x505c06[_0x5b4d('0x2c')],'type':_0x505c06['type'][_0x5b4d('0x2d')]};});_0x5b3424['model']=_['map'](_0x1ea4cf,_0x5b4d('0x26'));_0x5b3424[_0x5b4d('0x2e')]=_[_0x5b4d('0x2f')](_0x4057e9[_0x5b4d('0x2e')]);_0x5b3424['filters']=_[_0x5b4d('0x30')](_0x5b3424['model'],_0x5b3424[_0x5b4d('0x2e')]);_0x6dd2a[_0x5b4d('0x31')]=_[_0x5b4d('0x30')](_0x5b3424[_0x5b4d('0x32')],qs[_0x5b4d('0x33')](_0x4057e9[_0x5b4d('0x2e')][_0x5b4d('0x33')]));_0x6dd2a[_0x5b4d('0x31')]=_0x6dd2a[_0x5b4d('0x31')]['length']?_0x6dd2a[_0x5b4d('0x31')]:_0x5b3424[_0x5b4d('0x32')];if(!_0x4057e9['query'][_0x5b4d('0x34')]('nolimit')){_0x6dd2a[_0x5b4d('0x1c')]=qs[_0x5b4d('0x1c')](_0x4057e9[_0x5b4d('0x2e')][_0x5b4d('0x1c')]);_0x6dd2a[_0x5b4d('0x1b')]=qs[_0x5b4d('0x1b')](_0x4057e9[_0x5b4d('0x2e')][_0x5b4d('0x1b')]);}_0x6dd2a[_0x5b4d('0x35')]=qs[_0x5b4d('0x36')](_0x4057e9[_0x5b4d('0x2e')]['sort']);_0x6dd2a[_0x5b4d('0x37')]=qs[_0x5b4d('0x38')](_[_0x5b4d('0x39')](_0x4057e9[_0x5b4d('0x2e')],_0x5b3424[_0x5b4d('0x38')]),_0x1ea4cf);if(_0x4057e9[_0x5b4d('0x2e')][_0x5b4d('0x3a')]){_0x6dd2a[_0x5b4d('0x37')]=_[_0x5b4d('0x3b')](_0x6dd2a[_0x5b4d('0x37')],{'$or':_[_0x5b4d('0x29')](_0x1ea4cf,function(_0x59f6d7){if(_0x59f6d7[_0x5b4d('0x3c')]!==_0x5b4d('0x3d')){var _0x4ac969={};_0x4ac969[_0x59f6d7[_0x5b4d('0x26')]]={'$like':'%'+_0x4057e9['query'][_0x5b4d('0x3a')]+'%'};return _0x4ac969;}})});}_0x6dd2a=_['merge']({},_0x6dd2a,_0x4057e9[_0x5b4d('0x3e')]);var _0x22f844={'where':_0x6dd2a[_0x5b4d('0x37')]};return db[_0x5b4d('0x2a')][_0x5b4d('0x1e')](_0x22f844)[_0x5b4d('0x23')](function(_0x9e5572){_0x1bf990[_0x5b4d('0x1e')]=_0x9e5572;if(_0x4057e9[_0x5b4d('0x2e')][_0x5b4d('0x3f')]){_0x6dd2a[_0x5b4d('0x40')]=[{'all':!![]}];}return db[_0x5b4d('0x2a')][_0x5b4d('0x41')](_0x6dd2a);})[_0x5b4d('0x23')](function(_0x3430fe){_0x1bf990[_0x5b4d('0x42')]=_0x3430fe;return _0x1bf990;})[_0x5b4d('0x23')](respondWithFilteredResult(_0x4e93ff,_0x6dd2a))[_0x5b4d('0x43')](handleError(_0x4e93ff,null));};exports[_0x5b4d('0x44')]=function(_0x498e64,_0xe41017){var _0x2c7dd4={'raw':![],'where':{'id':_0x498e64[_0x5b4d('0x45')]['id']}},_0x4f460f={};_0x4f460f[_0x5b4d('0x32')]=_[_0x5b4d('0x2f')](db[_0x5b4d('0x2a')][_0x5b4d('0x2b')]);_0x4f460f[_0x5b4d('0x2e')]=_['keys'](_0x498e64[_0x5b4d('0x2e')]);_0x4f460f[_0x5b4d('0x38')]=_[_0x5b4d('0x30')](_0x4f460f[_0x5b4d('0x32')],_0x4f460f[_0x5b4d('0x2e')]);_0x2c7dd4[_0x5b4d('0x31')]=_[_0x5b4d('0x30')](_0x4f460f['model'],qs[_0x5b4d('0x33')](_0x498e64[_0x5b4d('0x2e')][_0x5b4d('0x33')]));_0x2c7dd4['attributes']=_0x2c7dd4[_0x5b4d('0x31')][_0x5b4d('0x46')]?_0x2c7dd4[_0x5b4d('0x31')]:_0x4f460f[_0x5b4d('0x32')];if(_0x498e64['query'][_0x5b4d('0x3f')]){_0x2c7dd4[_0x5b4d('0x40')]=[{'all':!![]}];}_0x2c7dd4=_[_0x5b4d('0x3b')]({},_0x2c7dd4,_0x498e64[_0x5b4d('0x3e')]);return db[_0x5b4d('0x2a')][_0x5b4d('0x47')](_0x2c7dd4)['then'](handleEntityNotFound(_0xe41017,null))['then'](respondWithResult(_0xe41017,null))['catch'](handleError(_0xe41017,null));};exports['create']=function(_0x38b1e0,_0x2bcb4e){return db[_0x5b4d('0x2a')][_0x5b4d('0x48')](_0x38b1e0[_0x5b4d('0x49')],{})['then'](respondWithResult(_0x2bcb4e,0xc9))['catch'](handleError(_0x2bcb4e,null));};exports[_0x5b4d('0x4a')]=function(_0x2f84a1,_0x1ffb80){if(_0x2f84a1[_0x5b4d('0x49')]['id']){delete _0x2f84a1['body']['id'];}return db[_0x5b4d('0x2a')][_0x5b4d('0x47')]({'where':{'id':_0x2f84a1[_0x5b4d('0x45')]['id']}})[_0x5b4d('0x23')](handleEntityNotFound(_0x1ffb80,null))['then'](saveUpdates(_0x2f84a1[_0x5b4d('0x49')],null))['then'](respondWithResult(_0x1ffb80,null))['catch'](handleError(_0x1ffb80,null));};exports[_0x5b4d('0x22')]=function(_0x4fcd69,_0x530b5c){return db[_0x5b4d('0x2a')][_0x5b4d('0x47')]({'where':{'id':_0x4fcd69[_0x5b4d('0x45')]['id']}})[_0x5b4d('0x23')](handleEntityNotFound(_0x530b5c,null))[_0x5b4d('0x23')](removeEntity(_0x530b5c,null))[_0x5b4d('0x43')](handleError(_0x530b5c,null));};exports[_0x5b4d('0x4b')]=function(_0x55991a,_0x5f084b,_0x1f8663){var _0x5c399a={};var _0x307dab={};var _0x3598ff;var _0x560085;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x55991a['params']['id']}})[_0x5b4d('0x23')](handleEntityNotFound(_0x5f084b,null))[_0x5b4d('0x23')](function(_0x4ef6ad){if(_0x4ef6ad){_0x3598ff=_0x4ef6ad;_0x307dab[_0x5b4d('0x32')]=_[_0x5b4d('0x2f')](db[_0x5b4d('0x4c')][_0x5b4d('0x2b')]);_0x307dab[_0x5b4d('0x2e')]=_[_0x5b4d('0x2f')](_0x55991a[_0x5b4d('0x2e')]);_0x307dab['filters']=_[_0x5b4d('0x30')](_0x307dab[_0x5b4d('0x32')],_0x307dab['query']);_0x5c399a[_0x5b4d('0x31')]=_[_0x5b4d('0x30')](_0x307dab[_0x5b4d('0x32')],qs[_0x5b4d('0x33')](_0x55991a[_0x5b4d('0x2e')]['fields']));_0x5c399a[_0x5b4d('0x31')]=_0x5c399a['attributes']['length']?_0x5c399a['attributes']:_0x307dab[_0x5b4d('0x32')];_0x5c399a[_0x5b4d('0x35')]=qs[_0x5b4d('0x36')](_0x55991a[_0x5b4d('0x2e')]['sort']);_0x5c399a['where']=qs['filters'](_[_0x5b4d('0x39')](_0x55991a['query'],_0x307dab[_0x5b4d('0x38')]));if(_0x55991a[_0x5b4d('0x2e')][_0x5b4d('0x3a')]){_0x5c399a[_0x5b4d('0x37')]=_[_0x5b4d('0x3b')](_0x5c399a['where'],{'$or':_[_0x5b4d('0x29')](_0x5c399a['attributes'],function(_0x1d89d1){var _0x4634d8={};_0x4634d8[_0x1d89d1]={'$like':'%'+_0x55991a[_0x5b4d('0x2e')]['filter']+'%'};return _0x4634d8;})});}_0x5c399a=_[_0x5b4d('0x3b')]({},_0x5c399a,_0x55991a[_0x5b4d('0x3e')]);return _0x3598ff[_0x5b4d('0x4b')](_0x5c399a);}})['then'](function(_0x488027){if(_0x488027){_0x560085=_0x488027[_0x5b4d('0x46')];if(!_0x55991a[_0x5b4d('0x2e')]['hasOwnProperty']('nolimit')){_0x5c399a['limit']=qs[_0x5b4d('0x1c')](_0x55991a[_0x5b4d('0x2e')]['limit']);_0x5c399a[_0x5b4d('0x1b')]=qs[_0x5b4d('0x1b')](_0x55991a[_0x5b4d('0x2e')]['offset']);}return _0x3598ff[_0x5b4d('0x4b')](_0x5c399a);}})[_0x5b4d('0x23')](function(_0x41f005){if(_0x41f005){return _0x41f005?{'count':_0x560085,'rows':_0x41f005}:null;}})[_0x5b4d('0x23')](respondWithResult(_0x5f084b,null))['catch'](handleError(_0x5f084b,null));};exports['getDescriptions']=function(_0x44746b,_0x325cff,_0x3ec1e4){var _0x93dcf9={};var _0x4f49cf={};var _0x4ad10f;var _0x3c9e80;return db[_0x5b4d('0x2a')]['findOne']({'where':{'id':_0x44746b[_0x5b4d('0x45')]['id']}})['then'](handleEntityNotFound(_0x325cff,null))[_0x5b4d('0x23')](function(_0xd4d962){if(_0xd4d962){_0x4ad10f=_0xd4d962;_0x4f49cf['model']=_[_0x5b4d('0x2f')](db[_0x5b4d('0x4c')][_0x5b4d('0x2b')]);_0x4f49cf[_0x5b4d('0x2e')]=_[_0x5b4d('0x2f')](_0x44746b[_0x5b4d('0x2e')]);_0x4f49cf[_0x5b4d('0x38')]=_[_0x5b4d('0x30')](_0x4f49cf[_0x5b4d('0x32')],_0x4f49cf[_0x5b4d('0x2e')]);_0x93dcf9[_0x5b4d('0x31')]=_['intersection'](_0x4f49cf[_0x5b4d('0x32')],qs['fields'](_0x44746b['query'][_0x5b4d('0x33')]));_0x93dcf9[_0x5b4d('0x31')]=_0x93dcf9['attributes'][_0x5b4d('0x46')]?_0x93dcf9[_0x5b4d('0x31')]:_0x4f49cf[_0x5b4d('0x32')];_0x93dcf9['order']=qs['sort'](_0x44746b[_0x5b4d('0x2e')]['sort']);_0x93dcf9[_0x5b4d('0x37')]=qs[_0x5b4d('0x38')](_['pick'](_0x44746b[_0x5b4d('0x2e')],_0x4f49cf[_0x5b4d('0x38')]));if(_0x44746b['query'][_0x5b4d('0x3a')]){_0x93dcf9[_0x5b4d('0x37')]=_[_0x5b4d('0x3b')](_0x93dcf9[_0x5b4d('0x37')],{'$or':_['map'](_0x93dcf9['attributes'],function(_0x1adb8e){var _0x4a92c7={};_0x4a92c7[_0x1adb8e]={'$like':'%'+_0x44746b[_0x5b4d('0x2e')][_0x5b4d('0x3a')]+'%'};return _0x4a92c7;})});}_0x93dcf9=_['merge']({},_0x93dcf9,_0x44746b[_0x5b4d('0x3e')]);return _0x4ad10f[_0x5b4d('0x4d')](_0x93dcf9);}})['then'](function(_0x59d56d){if(_0x59d56d){_0x3c9e80=_0x59d56d['length'];if(!_0x44746b[_0x5b4d('0x2e')][_0x5b4d('0x34')](_0x5b4d('0x4e'))){_0x93dcf9[_0x5b4d('0x1c')]=qs['limit'](_0x44746b[_0x5b4d('0x2e')][_0x5b4d('0x1c')]);_0x93dcf9[_0x5b4d('0x1b')]=qs[_0x5b4d('0x1b')](_0x44746b['query'][_0x5b4d('0x1b')]);}return _0x4ad10f[_0x5b4d('0x4d')](_0x93dcf9);}})['then'](function(_0x1d99be){if(_0x1d99be){return _0x1d99be?{'count':_0x3c9e80,'rows':_0x1d99be}:null;}})['then'](respondWithResult(_0x325cff,null))[_0x5b4d('0x43')](handleError(_0x325cff,null));};exports['getFields']=function(_0x146ed5,_0x42286a,_0xc70390){var _0x45ff18={};var _0x1c7856={};var _0x191287;var _0x20bd71;return db[_0x5b4d('0x2a')][_0x5b4d('0x4f')]({'where':{'id':_0x146ed5[_0x5b4d('0x45')]['id']}})['then'](handleEntityNotFound(_0x42286a,null))['then'](function(_0x310dbf){if(_0x310dbf){_0x191287=_0x310dbf;_0x1c7856['model']=_['keys'](db[_0x5b4d('0x4c')]['rawAttributes']);_0x1c7856['query']=_['keys'](_0x146ed5['query']);_0x1c7856['filters']=_[_0x5b4d('0x30')](_0x1c7856[_0x5b4d('0x32')],_0x1c7856[_0x5b4d('0x2e')]);_0x45ff18['attributes']=_[_0x5b4d('0x30')](_0x1c7856[_0x5b4d('0x32')],qs[_0x5b4d('0x33')](_0x146ed5[_0x5b4d('0x2e')][_0x5b4d('0x33')]));_0x45ff18[_0x5b4d('0x31')]=_0x45ff18[_0x5b4d('0x31')]['length']?_0x45ff18[_0x5b4d('0x31')]:_0x1c7856[_0x5b4d('0x32')];_0x45ff18[_0x5b4d('0x35')]=qs[_0x5b4d('0x36')](_0x146ed5[_0x5b4d('0x2e')][_0x5b4d('0x36')]);_0x45ff18[_0x5b4d('0x37')]=qs['filters'](_[_0x5b4d('0x39')](_0x146ed5[_0x5b4d('0x2e')],_0x1c7856[_0x5b4d('0x38')]));if(_0x146ed5['query'][_0x5b4d('0x3a')]){_0x45ff18['where']=_[_0x5b4d('0x3b')](_0x45ff18[_0x5b4d('0x37')],{'$or':_[_0x5b4d('0x29')](_0x45ff18['attributes'],function(_0x3fcda8){var _0x3f354c={};_0x3f354c[_0x3fcda8]={'$like':'%'+_0x146ed5[_0x5b4d('0x2e')][_0x5b4d('0x3a')]+'%'};return _0x3f354c;})});}_0x45ff18=_[_0x5b4d('0x3b')]({},_0x45ff18,_0x146ed5['options']);return _0x191287[_0x5b4d('0x50')](_0x45ff18);}})[_0x5b4d('0x23')](function(_0x43e4d6){if(_0x43e4d6){_0x20bd71=_0x43e4d6['length'];if(!_0x146ed5['query'][_0x5b4d('0x34')](_0x5b4d('0x4e'))){_0x45ff18[_0x5b4d('0x1c')]=qs['limit'](_0x146ed5[_0x5b4d('0x2e')][_0x5b4d('0x1c')]);_0x45ff18['offset']=qs['offset'](_0x146ed5[_0x5b4d('0x2e')][_0x5b4d('0x1b')]);}return _0x191287[_0x5b4d('0x50')](_0x45ff18);}})[_0x5b4d('0x23')](function(_0x13fd59){if(_0x13fd59){return _0x13fd59?{'count':_0x20bd71,'rows':_0x13fd59}:null;}})[_0x5b4d('0x23')](respondWithResult(_0x42286a,null))[_0x5b4d('0x43')](handleError(_0x42286a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 96d260d..e24cb56 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 _0xfc79=['moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','lodash','api'];(function(_0x4c1518,_0x4051d4){var _0x31aeba=function(_0x4bf611){while(--_0x4bf611){_0x4c1518['push'](_0x4c1518['shift']());}};_0x31aeba(++_0x4051d4);}(_0xfc79,0x1de));var _0x9fc7=function(_0xa40e2c,_0x43921b){_0xa40e2c=_0xa40e2c-0x0;var _0xaa7b25=_0xfc79[_0xa40e2c];return _0xaa7b25;};'use strict';var _=require(_0x9fc7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9fc7('0x1'));var moment=require(_0x9fc7('0x2'));var BPromise=require(_0x9fc7('0x3'));var rp=require(_0x9fc7('0x4'));var fs=require('fs');var path=require(_0x9fc7('0x5'));var rimraf=require('rimraf');var config=require(_0x9fc7('0x6'));var attributes=require(_0x9fc7('0x7'));module[_0x9fc7('0x8')]=function(_0x2c95d4,_0x3c5f56){return _0x2c95d4['define'](_0x9fc7('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd77=['api','bluebird','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','../../config/logger'];(function(_0x292444,_0x53802a){var _0x2481ce=function(_0x110210){while(--_0x110210){_0x292444['push'](_0x292444['shift']());}};_0x2481ce(++_0x53802a);}(_0xbd77,0xb7));var _0x7bd7=function(_0x136dbe,_0x15d953){_0x136dbe=_0x136dbe-0x0;var _0x2e574f=_0xbd77[_0x136dbe];return _0x2e574f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7bd7('0x0'))(_0x7bd7('0x1'));var moment=require('moment');var BPromise=require(_0x7bd7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bd7('0x3'));var rimraf=require('rimraf');var config=require(_0x7bd7('0x4'));var attributes=require(_0x7bd7('0x5'));module[_0x7bd7('0x6')]=function(_0x232a8f,_0x33a496){return _0x232a8f['define'](_0x7bd7('0x7'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index b54b60b..1923f2e 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 _0xe2d3=['util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe2d3,0x97));var _0x3e2d=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xe2d3[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0x3e2d('0x0'));var util=require(_0x3e2d('0x1'));var moment=require(_0x3e2d('0x2'));var BPromise=require(_0x3e2d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e2d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3e2d('0x5'));var config=require(_0x3e2d('0x6'));var jayson=require(_0x3e2d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7ce2e1,_0x105d1a,_0x123324){return new BPromise(function(_0x4679d6,_0x113e10){return client[_0x3e2d('0x8')](_0x7ce2e1,_0x123324)[_0x3e2d('0x9')](function(_0x2dc111){logger[_0x3e2d('0xa')](_0x3e2d('0xb'),_0x105d1a,'request\x20sent');logger[_0x3e2d('0xc')](_0x3e2d('0xd'),_0x105d1a,_0x3e2d('0xe'),JSON[_0x3e2d('0xf')](_0x2dc111));if(_0x2dc111['error']){if(_0x2dc111[_0x3e2d('0x10')]['code']===0x1f4){logger[_0x3e2d('0x10')](_0x3e2d('0xb'),_0x105d1a,_0x2dc111[_0x3e2d('0x10')][_0x3e2d('0x11')]);return _0x113e10(_0x2dc111[_0x3e2d('0x10')][_0x3e2d('0x11')]);}logger[_0x3e2d('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x105d1a,_0x2dc111['error'][_0x3e2d('0x11')]);return _0x4679d6(_0x2dc111[_0x3e2d('0x10')][_0x3e2d('0x11')]);}else{logger[_0x3e2d('0xa')](_0x3e2d('0xb'),_0x105d1a,_0x3e2d('0xe'));_0x4679d6(_0x2dc111[_0x3e2d('0x12')][_0x3e2d('0x11')]);}})['catch'](function(_0x596493){logger['error'](_0x3e2d('0xb'),_0x105d1a,_0x596493);_0x113e10(_0x596493);});});} \ No newline at end of file +var _0xe4c3=['http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x58df44,_0x5643cc){var _0x47271c=function(_0x1c07f6){while(--_0x1c07f6){_0x58df44['push'](_0x58df44['shift']());}};_0x47271c(++_0x5643cc);}(_0xe4c3,0x173));var _0x3e4c=function(_0x543d54,_0x16208c){_0x543d54=_0x543d54-0x0;var _0xd2beb8=_0xe4c3[_0x543d54];return _0xd2beb8;};'use strict';var _=require(_0x3e4c('0x0'));var util=require(_0x3e4c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e4c('0x2'))['db'];var utils=require(_0x3e4c('0x3'));var logger=require(_0x3e4c('0x4'))(_0x3e4c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3e4c('0x6')][_0x3e4c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x886564,_0x2214e1,_0x42a92d){return new BPromise(function(_0x5d68f8,_0x10457e){return client[_0x3e4c('0x8')](_0x886564,_0x42a92d)[_0x3e4c('0x9')](function(_0x527775){logger[_0x3e4c('0xa')](_0x3e4c('0xb'),_0x2214e1,'request\x20sent');logger[_0x3e4c('0xc')](_0x3e4c('0xd'),_0x2214e1,'request\x20sent',JSON[_0x3e4c('0xe')](_0x527775));if(_0x527775['error']){if(_0x527775[_0x3e4c('0xf')][_0x3e4c('0x10')]===0x1f4){logger[_0x3e4c('0xf')](_0x3e4c('0xb'),_0x2214e1,_0x527775[_0x3e4c('0xf')][_0x3e4c('0x11')]);return _0x10457e(_0x527775['error'][_0x3e4c('0x11')]);}logger['error'](_0x3e4c('0xb'),_0x2214e1,_0x527775[_0x3e4c('0xf')][_0x3e4c('0x11')]);return _0x5d68f8(_0x527775[_0x3e4c('0xf')]['message']);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2214e1,_0x3e4c('0x12'));_0x5d68f8(_0x527775[_0x3e4c('0x13')]['message']);}})[_0x3e4c('0x14')](function(_0x4383ea){logger[_0x3e4c('0xf')](_0x3e4c('0xb'),_0x2214e1,_0x4383ea);_0x10457e(_0x4383ea);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 12ce4f9..760f7c0 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 _0x2dae=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x5d815b,_0x4c422d){var _0x5440a9=function(_0xd527f7){while(--_0xd527f7){_0x5d815b['push'](_0x5d815b['shift']());}};_0x5440a9(++_0x4c422d);}(_0x2dae,0xc3));var _0xe2da=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0x2dae[_0x54eab6];return _0x1e7435;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0xe')]('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router[_0xe2da('0x10')]('/:id',auth[_0xe2da('0xc')](),controller[_0xe2da('0x11')]);router[_0xe2da('0x12')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x13')]);module[_0xe2da('0x14')]=router; \ No newline at end of file +var _0x94b1=['put','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0xf8168d,_0x518638){var _0x4431e3=function(_0x183f43){while(--_0x183f43){_0xf8168d['push'](_0xf8168d['shift']());}};_0x4431e3(++_0x518638);}(_0x94b1,0x102));var _0x194b=function(_0x42c88d,_0x14e87b){_0x42c88d=_0x42c88d-0x0;var _0x205ad9=_0x94b1[_0x42c88d];return _0x205ad9;};'use strict';var multer=require('multer');var util=require(_0x194b('0x0'));var path=require('path');var timeout=require(_0x194b('0x1'));var express=require(_0x194b('0x2'));var router=express[_0x194b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x194b('0x4'));var interaction=require(_0x194b('0x5'));var config=require(_0x194b('0x6'));var controller=require(_0x194b('0x7'));router['get']('/',auth[_0x194b('0x8')](),controller[_0x194b('0x9')]);router['get'](_0x194b('0xa'),auth[_0x194b('0x8')](),controller[_0x194b('0xb')]);router[_0x194b('0xc')]('/',auth[_0x194b('0x8')](),controller[_0x194b('0xd')]);router[_0x194b('0xe')](_0x194b('0xa'),auth[_0x194b('0x8')](),controller['update']);router[_0x194b('0xf')](_0x194b('0xa'),auth[_0x194b('0x8')](),controller['destroy']);module[_0x194b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ba6e3f1..7658efb 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 _0xbb01=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x1ed010,_0x734e0b){var _0x6e22bf=function(_0x1ffe15){while(--_0x1ffe15){_0x1ed010['push'](_0x1ed010['shift']());}};_0x6e22bf(++_0x734e0b);}(_0xbb01,0x12c));var _0x1bb0=function(_0x51f4fc,_0x1fe3ef){_0x51f4fc=_0x51f4fc-0x0;var _0x4d96fc=_0xbb01[_0x51f4fc];return _0x4d96fc;};'use strict';var Sequelize=require(_0x1bb0('0x0'));module[_0x1bb0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1bb0('0x2'),_0x1bb0('0x3'),_0x1bb0('0x4'),_0x1bb0('0x5'),_0x1bb0('0x6')),'defaultValue':_0x1bb0('0x2')},'content':{'type':Sequelize[_0x1bb0('0x7')]},'key':{'type':Sequelize[_0x1bb0('0x7')]},'keyType':{'type':Sequelize[_0x1bb0('0x8')](_0x1bb0('0x2'),_0x1bb0('0x3'),_0x1bb0('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1bb0('0x7')]},'nameField':{'type':Sequelize[_0x1bb0('0x7')]},'customField':{'type':Sequelize[_0x1bb0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1bb0('0x7')]}}; \ No newline at end of file +var _0x8c78=['ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue','picklist','STRING'];(function(_0x19114a,_0x4611e5){var _0x258a19=function(_0x448f30){while(--_0x448f30){_0x19114a['push'](_0x19114a['shift']());}};_0x258a19(++_0x4611e5);}(_0x8c78,0x189));var _0x88c7=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8c78[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x88c7('0x0'));module[_0x88c7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x88c7('0x2'),'variable',_0x88c7('0x3'),_0x88c7('0x4'),_0x88c7('0x5')),'defaultValue':_0x88c7('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x88c7('0x6')]},'keyType':{'type':Sequelize[_0x88c7('0x7')](_0x88c7('0x2'),_0x88c7('0x8'),_0x88c7('0x3'))},'keyContent':{'type':Sequelize[_0x88c7('0x6')]},'idField':{'type':Sequelize[_0x88c7('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x88c7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 101e7e2..8ae8caa 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 _0xa831=['undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','index','map','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshsalesField','include','findAll','catch','params','rawAttributes','fields','includeAll','find','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x1ce71d,_0x3c9783){var _0x58484a=function(_0x484751){while(--_0x484751){_0x1ce71d['push'](_0x1ce71d['shift']());}};_0x58484a(++_0x3c9783);}(_0xa831,0x156));var _0x1a83=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0xa831[_0x1de43c];return _0x296d3e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a83('0x0'));var jsonpatch=require(_0x1a83('0x1'));var rp=require(_0x1a83('0x2'));var moment=require(_0x1a83('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1a83('0x4'));var util=require('util');var path=require(_0x1a83('0x5'));var sox=require(_0x1a83('0x6'));var csv=require(_0x1a83('0x7'));var ejs=require(_0x1a83('0x8'));var fs=require('fs');var fs_extra=require(_0x1a83('0x9'));var _=require(_0x1a83('0xa'));var squel=require(_0x1a83('0xb'));var crypto=require(_0x1a83('0xc'));var jsforce=require(_0x1a83('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1a83('0x7'));var querystring=require('querystring');var Papa=require(_0x1a83('0xe'));var Redis=require(_0x1a83('0xf'));var authService=require(_0x1a83('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a83('0x11'));var logger=require(_0x1a83('0x12'))(_0x1a83('0x13'));var utils=require(_0x1a83('0x14'));var config=require(_0x1a83('0x15'));var licenseUtil=require(_0x1a83('0x16'));var db=require(_0x1a83('0x17'))['db'];function respondWithStatusCode(_0x300127,_0x26828f){_0x26828f=_0x26828f||0xcc;return function(_0x4dbb70){if(_0x4dbb70){return _0x300127[_0x1a83('0x18')](_0x26828f);}return _0x300127[_0x1a83('0x19')](_0x26828f)[_0x1a83('0x1a')]();};}function respondWithResult(_0x10bc1e,_0x54440a){_0x54440a=_0x54440a||0xc8;return function(_0x468ca5){if(_0x468ca5){return _0x10bc1e[_0x1a83('0x19')](_0x54440a)[_0x1a83('0x1b')](_0x468ca5);}};}function respondWithFilteredResult(_0x2b9dad,_0x2b00c1){return function(_0xc2ee45){if(_0xc2ee45){var _0x16f34f=typeof _0x2b00c1['offset']===_0x1a83('0x1c')&&typeof _0x2b00c1[_0x1a83('0x1d')]==='undefined';var _0x86392=_0xc2ee45[_0x1a83('0x1e')];var _0x8d621b=_0x16f34f?0x0:_0x2b00c1[_0x1a83('0x1f')];var _0x7ca371=_0x16f34f?_0xc2ee45[_0x1a83('0x1e')]:_0x2b00c1[_0x1a83('0x1f')]+_0x2b00c1[_0x1a83('0x1d')];var _0x5e47de;if(_0x7ca371>=_0x86392){_0x7ca371=_0x86392;_0x5e47de=0xc8;}else{_0x5e47de=0xce;}_0x2b9dad['status'](_0x5e47de);return _0x2b9dad[_0x1a83('0x20')]('Content-Range',_0x8d621b+'-'+_0x7ca371+'/'+_0x86392)[_0x1a83('0x1b')](_0xc2ee45);}return null;};}function patchUpdates(_0x3bd9a9){return function(_0x258604){try{jsonpatch[_0x1a83('0x21')](_0x258604,_0x3bd9a9,!![]);}catch(_0x236fa4){return BPromise[_0x1a83('0x22')](_0x236fa4);}return _0x258604[_0x1a83('0x23')]();};}function saveUpdates(_0x859656,_0x398fea){return function(_0x2e2ca6){if(_0x2e2ca6){return _0x2e2ca6[_0x1a83('0x24')](_0x859656)[_0x1a83('0x25')](function(_0x436c73){return _0x436c73;});}return null;};}function removeEntity(_0x269480,_0x47ee9e){return function(_0x1be2aa){if(_0x1be2aa){return _0x1be2aa['destroy']()[_0x1a83('0x25')](function(){_0x269480[_0x1a83('0x19')](0xcc)[_0x1a83('0x1a')]();});}};}function handleEntityNotFound(_0x535c5e,_0x3ef17d){return function(_0x2a0460){if(!_0x2a0460){_0x535c5e[_0x1a83('0x18')](0x194);}return _0x2a0460;};}function handleError(_0x47401a,_0x5acb96){_0x5acb96=_0x5acb96||0x1f4;return function(_0x3e618a){logger[_0x1a83('0x26')](_0x3e618a[_0x1a83('0x27')]);if(_0x3e618a[_0x1a83('0x28')]){delete _0x3e618a[_0x1a83('0x28')];}_0x47401a['status'](_0x5acb96)['send'](_0x3e618a);};}exports[_0x1a83('0x29')]=function(_0x1eee9c,_0x1e9e5f){var _0x1ba422={},_0x1808a5={},_0x2d0b03={'count':0x0,'rows':[]};var _0x21933c=_[_0x1a83('0x2a')](db['FreshsalesField']['rawAttributes'],function(_0x314eec){return{'name':_0x314eec['fieldName'],'type':_0x314eec['type'][_0x1a83('0x2b')]};});_0x1808a5[_0x1a83('0x2c')]=_[_0x1a83('0x2a')](_0x21933c,_0x1a83('0x28'));_0x1808a5[_0x1a83('0x2d')]=_[_0x1a83('0x2e')](_0x1eee9c['query']);_0x1808a5[_0x1a83('0x2f')]=_['intersection'](_0x1808a5[_0x1a83('0x2c')],_0x1808a5[_0x1a83('0x2d')]);_0x1ba422['attributes']=_[_0x1a83('0x30')](_0x1808a5[_0x1a83('0x2c')],qs['fields'](_0x1eee9c[_0x1a83('0x2d')]['fields']));_0x1ba422[_0x1a83('0x31')]=_0x1ba422[_0x1a83('0x31')][_0x1a83('0x32')]?_0x1ba422['attributes']:_0x1808a5['model'];if(!_0x1eee9c[_0x1a83('0x2d')][_0x1a83('0x33')](_0x1a83('0x34'))){_0x1ba422['limit']=qs[_0x1a83('0x1d')](_0x1eee9c[_0x1a83('0x2d')][_0x1a83('0x1d')]);_0x1ba422[_0x1a83('0x1f')]=qs['offset'](_0x1eee9c['query'][_0x1a83('0x1f')]);}_0x1ba422[_0x1a83('0x35')]=qs[_0x1a83('0x36')](_0x1eee9c[_0x1a83('0x2d')][_0x1a83('0x36')]);_0x1ba422[_0x1a83('0x37')]=qs[_0x1a83('0x2f')](_[_0x1a83('0x38')](_0x1eee9c[_0x1a83('0x2d')],_0x1808a5['filters']),_0x21933c);if(_0x1eee9c['query'][_0x1a83('0x39')]){_0x1ba422[_0x1a83('0x37')]=_[_0x1a83('0x3a')](_0x1ba422[_0x1a83('0x37')],{'$or':_[_0x1a83('0x2a')](_0x21933c,function(_0x349703){if(_0x349703[_0x1a83('0x3b')]!==_0x1a83('0x3c')){var _0x11bd0f={};_0x11bd0f[_0x349703['name']]={'$like':'%'+_0x1eee9c[_0x1a83('0x2d')][_0x1a83('0x39')]+'%'};return _0x11bd0f;}})});}_0x1ba422=_[_0x1a83('0x3a')]({},_0x1ba422,_0x1eee9c[_0x1a83('0x3d')]);var _0x3c74a7={'where':_0x1ba422[_0x1a83('0x37')]};return db[_0x1a83('0x3e')]['count'](_0x3c74a7)[_0x1a83('0x25')](function(_0x6f762c){_0x2d0b03['count']=_0x6f762c;if(_0x1eee9c[_0x1a83('0x2d')]['includeAll']){_0x1ba422[_0x1a83('0x3f')]=[{'all':!![]}];}return db['FreshsalesField'][_0x1a83('0x40')](_0x1ba422);})[_0x1a83('0x25')](function(_0x56a574){_0x2d0b03['rows']=_0x56a574;return _0x2d0b03;})[_0x1a83('0x25')](respondWithFilteredResult(_0x1e9e5f,_0x1ba422))[_0x1a83('0x41')](handleError(_0x1e9e5f,null));};exports['show']=function(_0x2900aa,_0x128f63){var _0xd34e24={'raw':!![],'where':{'id':_0x2900aa[_0x1a83('0x42')]['id']}},_0x3dbb84={};_0x3dbb84[_0x1a83('0x2c')]=_[_0x1a83('0x2e')](db[_0x1a83('0x3e')][_0x1a83('0x43')]);_0x3dbb84[_0x1a83('0x2d')]=_[_0x1a83('0x2e')](_0x2900aa[_0x1a83('0x2d')]);_0x3dbb84[_0x1a83('0x2f')]=_['intersection'](_0x3dbb84['model'],_0x3dbb84['query']);_0xd34e24[_0x1a83('0x31')]=_[_0x1a83('0x30')](_0x3dbb84[_0x1a83('0x2c')],qs[_0x1a83('0x44')](_0x2900aa[_0x1a83('0x2d')][_0x1a83('0x44')]));_0xd34e24['attributes']=_0xd34e24[_0x1a83('0x31')][_0x1a83('0x32')]?_0xd34e24[_0x1a83('0x31')]:_0x3dbb84['model'];if(_0x2900aa[_0x1a83('0x2d')][_0x1a83('0x45')]){_0xd34e24[_0x1a83('0x3f')]=[{'all':!![]}];}_0xd34e24=_[_0x1a83('0x3a')]({},_0xd34e24,_0x2900aa[_0x1a83('0x3d')]);return db['FreshsalesField'][_0x1a83('0x46')](_0xd34e24)['then'](handleEntityNotFound(_0x128f63,null))[_0x1a83('0x25')](respondWithResult(_0x128f63,null))[_0x1a83('0x41')](handleError(_0x128f63,null));};exports[_0x1a83('0x47')]=function(_0x3fba01,_0x3b556d){return db['FreshsalesField'][_0x1a83('0x47')](_0x3fba01['body'],{})[_0x1a83('0x25')](respondWithResult(_0x3b556d,0xc9))[_0x1a83('0x41')](handleError(_0x3b556d,null));};exports[_0x1a83('0x24')]=function(_0x46f265,_0x325397){if(_0x46f265[_0x1a83('0x48')]['id']){delete _0x46f265[_0x1a83('0x48')]['id'];}return db[_0x1a83('0x3e')][_0x1a83('0x46')]({'where':{'id':_0x46f265[_0x1a83('0x42')]['id']}})[_0x1a83('0x25')](handleEntityNotFound(_0x325397,null))['then'](saveUpdates(_0x46f265[_0x1a83('0x48')],null))['then'](respondWithResult(_0x325397,null))['catch'](handleError(_0x325397,null));};exports[_0x1a83('0x49')]=function(_0x318c47,_0x2edba8){return db[_0x1a83('0x3e')][_0x1a83('0x46')]({'where':{'id':_0x318c47['params']['id']}})[_0x1a83('0x25')](handleEntityNotFound(_0x2edba8,null))[_0x1a83('0x25')](removeEntity(_0x2edba8,null))[_0x1a83('0x41')](handleError(_0x2edba8,null));}; \ No newline at end of file +var _0x49a1=['index','FreshsalesField','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','include','merge','find','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack'];(function(_0x39a5a3,_0xc92a9f){var _0x526aee=function(_0x2483f9){while(--_0x2483f9){_0x39a5a3['push'](_0x39a5a3['shift']());}};_0x526aee(++_0xc92a9f);}(_0x49a1,0x67));var _0x149a=function(_0x208c14,_0x4e7c51){_0x208c14=_0x208c14-0x0;var _0x5c0f59=_0x49a1[_0x208c14];return _0x5c0f59;};'use strict';var emlformat=require(_0x149a('0x0'));var rimraf=require(_0x149a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x149a('0x2'));var rp=require(_0x149a('0x3'));var moment=require(_0x149a('0x4'));var BPromise=require(_0x149a('0x5'));var Mustache=require(_0x149a('0x6'));var util=require(_0x149a('0x7'));var path=require(_0x149a('0x8'));var sox=require('sox');var csv=require(_0x149a('0x9'));var ejs=require(_0x149a('0xa'));var fs=require('fs');var fs_extra=require(_0x149a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x149a('0xc'));var jsforce=require(_0x149a('0xd'));var deskjs=require(_0x149a('0xe'));var toCsv=require(_0x149a('0x9'));var querystring=require('querystring');var Papa=require(_0x149a('0xf'));var Redis=require(_0x149a('0x10'));var authService=require(_0x149a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x149a('0x12'));var hardwareService=require(_0x149a('0x13'));var logger=require(_0x149a('0x14'))('api');var utils=require(_0x149a('0x15'));var config=require(_0x149a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49941d,_0x5de896){_0x5de896=_0x5de896||0xcc;return function(_0x344040){if(_0x344040){return _0x49941d[_0x149a('0x17')](_0x5de896);}return _0x49941d[_0x149a('0x18')](_0x5de896)[_0x149a('0x19')]();};}function respondWithResult(_0x255385,_0x1c9964){_0x1c9964=_0x1c9964||0xc8;return function(_0x57a452){if(_0x57a452){return _0x255385['status'](_0x1c9964)[_0x149a('0x1a')](_0x57a452);}};}function respondWithFilteredResult(_0x45e583,_0x5e4fd4){return function(_0x2ddc0a){if(_0x2ddc0a){var _0x58d1fc=typeof _0x5e4fd4[_0x149a('0x1b')]===_0x149a('0x1c')&&typeof _0x5e4fd4[_0x149a('0x1d')]===_0x149a('0x1c');var _0x307c66=_0x2ddc0a[_0x149a('0x1e')];var _0x45c2b2=_0x58d1fc?0x0:_0x5e4fd4['offset'];var _0x12c4b0=_0x58d1fc?_0x2ddc0a[_0x149a('0x1e')]:_0x5e4fd4['offset']+_0x5e4fd4[_0x149a('0x1d')];var _0x10b16e;if(_0x12c4b0>=_0x307c66){_0x12c4b0=_0x307c66;_0x10b16e=0xc8;}else{_0x10b16e=0xce;}_0x45e583['status'](_0x10b16e);return _0x45e583[_0x149a('0x1f')](_0x149a('0x20'),_0x45c2b2+'-'+_0x12c4b0+'/'+_0x307c66)[_0x149a('0x1a')](_0x2ddc0a);}return null;};}function patchUpdates(_0x38a765){return function(_0x51f784){try{jsonpatch[_0x149a('0x21')](_0x51f784,_0x38a765,!![]);}catch(_0x363bc0){return BPromise[_0x149a('0x22')](_0x363bc0);}return _0x51f784[_0x149a('0x23')]();};}function saveUpdates(_0x418850,_0x325db0){return function(_0x424174){if(_0x424174){return _0x424174['update'](_0x418850)[_0x149a('0x24')](function(_0x23f65e){return _0x23f65e;});}return null;};}function removeEntity(_0x2dfc00,_0x46f977){return function(_0x1e7cb1){if(_0x1e7cb1){return _0x1e7cb1[_0x149a('0x25')]()[_0x149a('0x24')](function(){_0x2dfc00[_0x149a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c690,_0x11f769){return function(_0x6516a3){if(!_0x6516a3){_0x52c690[_0x149a('0x17')](0x194);}return _0x6516a3;};}function handleError(_0xa6f704,_0x5c1b99){_0x5c1b99=_0x5c1b99||0x1f4;return function(_0x3d310f){logger['error'](_0x3d310f[_0x149a('0x26')]);if(_0x3d310f['name']){delete _0x3d310f['name'];}_0xa6f704[_0x149a('0x18')](_0x5c1b99)['send'](_0x3d310f);};}exports[_0x149a('0x27')]=function(_0x3ddf86,_0x2f6139){var _0x42f420={},_0x227d1d={},_0x21dbca={'count':0x0,'rows':[]};var _0x2551a0=_['map'](db[_0x149a('0x28')]['rawAttributes'],function(_0x37a9c3){return{'name':_0x37a9c3['fieldName'],'type':_0x37a9c3['type']['key']};});_0x227d1d[_0x149a('0x29')]=_[_0x149a('0x2a')](_0x2551a0,_0x149a('0x2b'));_0x227d1d[_0x149a('0x2c')]=_[_0x149a('0x2d')](_0x3ddf86[_0x149a('0x2c')]);_0x227d1d[_0x149a('0x2e')]=_['intersection'](_0x227d1d[_0x149a('0x29')],_0x227d1d[_0x149a('0x2c')]);_0x42f420[_0x149a('0x2f')]=_[_0x149a('0x30')](_0x227d1d['model'],qs[_0x149a('0x31')](_0x3ddf86['query'][_0x149a('0x31')]));_0x42f420[_0x149a('0x2f')]=_0x42f420[_0x149a('0x2f')][_0x149a('0x32')]?_0x42f420[_0x149a('0x2f')]:_0x227d1d[_0x149a('0x29')];if(!_0x3ddf86[_0x149a('0x2c')][_0x149a('0x33')](_0x149a('0x34'))){_0x42f420[_0x149a('0x1d')]=qs[_0x149a('0x1d')](_0x3ddf86[_0x149a('0x2c')][_0x149a('0x1d')]);_0x42f420['offset']=qs[_0x149a('0x1b')](_0x3ddf86[_0x149a('0x2c')][_0x149a('0x1b')]);}_0x42f420[_0x149a('0x35')]=qs[_0x149a('0x36')](_0x3ddf86[_0x149a('0x2c')][_0x149a('0x36')]);_0x42f420[_0x149a('0x37')]=qs[_0x149a('0x2e')](_[_0x149a('0x38')](_0x3ddf86[_0x149a('0x2c')],_0x227d1d[_0x149a('0x2e')]),_0x2551a0);if(_0x3ddf86[_0x149a('0x2c')][_0x149a('0x39')]){_0x42f420[_0x149a('0x37')]=_['merge'](_0x42f420[_0x149a('0x37')],{'$or':_['map'](_0x2551a0,function(_0xd1f51c){if(_0xd1f51c['type']!==_0x149a('0x3a')){var _0x2f4d1c={};_0x2f4d1c[_0xd1f51c[_0x149a('0x2b')]]={'$like':'%'+_0x3ddf86[_0x149a('0x2c')][_0x149a('0x39')]+'%'};return _0x2f4d1c;}})});}_0x42f420=_['merge']({},_0x42f420,_0x3ddf86[_0x149a('0x3b')]);var _0x198d75={'where':_0x42f420[_0x149a('0x37')]};return db[_0x149a('0x28')][_0x149a('0x1e')](_0x198d75)[_0x149a('0x24')](function(_0x23953c){_0x21dbca['count']=_0x23953c;if(_0x3ddf86['query']['includeAll']){_0x42f420['include']=[{'all':!![]}];}return db[_0x149a('0x28')][_0x149a('0x3c')](_0x42f420);})[_0x149a('0x24')](function(_0x17df1d){_0x21dbca[_0x149a('0x3d')]=_0x17df1d;return _0x21dbca;})[_0x149a('0x24')](respondWithFilteredResult(_0x2f6139,_0x42f420))[_0x149a('0x3e')](handleError(_0x2f6139,null));};exports[_0x149a('0x3f')]=function(_0xef6df0,_0x916ee){var _0x238d28={'raw':!![],'where':{'id':_0xef6df0[_0x149a('0x40')]['id']}},_0x4006be={};_0x4006be[_0x149a('0x29')]=_['keys'](db[_0x149a('0x28')][_0x149a('0x41')]);_0x4006be[_0x149a('0x2c')]=_[_0x149a('0x2d')](_0xef6df0['query']);_0x4006be[_0x149a('0x2e')]=_['intersection'](_0x4006be[_0x149a('0x29')],_0x4006be[_0x149a('0x2c')]);_0x238d28[_0x149a('0x2f')]=_['intersection'](_0x4006be[_0x149a('0x29')],qs[_0x149a('0x31')](_0xef6df0[_0x149a('0x2c')]['fields']));_0x238d28['attributes']=_0x238d28[_0x149a('0x2f')][_0x149a('0x32')]?_0x238d28[_0x149a('0x2f')]:_0x4006be[_0x149a('0x29')];if(_0xef6df0[_0x149a('0x2c')]['includeAll']){_0x238d28[_0x149a('0x42')]=[{'all':!![]}];}_0x238d28=_[_0x149a('0x43')]({},_0x238d28,_0xef6df0[_0x149a('0x3b')]);return db[_0x149a('0x28')][_0x149a('0x44')](_0x238d28)[_0x149a('0x24')](handleEntityNotFound(_0x916ee,null))[_0x149a('0x24')](respondWithResult(_0x916ee,null))[_0x149a('0x3e')](handleError(_0x916ee,null));};exports['create']=function(_0x47a322,_0x14a541){return db[_0x149a('0x28')]['create'](_0x47a322[_0x149a('0x45')],{})[_0x149a('0x24')](respondWithResult(_0x14a541,0xc9))[_0x149a('0x3e')](handleError(_0x14a541,null));};exports[_0x149a('0x46')]=function(_0x1fb37d,_0x4a8f67){if(_0x1fb37d[_0x149a('0x45')]['id']){delete _0x1fb37d[_0x149a('0x45')]['id'];}return db[_0x149a('0x28')][_0x149a('0x44')]({'where':{'id':_0x1fb37d[_0x149a('0x40')]['id']}})[_0x149a('0x24')](handleEntityNotFound(_0x4a8f67,null))[_0x149a('0x24')](saveUpdates(_0x1fb37d['body'],null))[_0x149a('0x24')](respondWithResult(_0x4a8f67,null))[_0x149a('0x3e')](handleError(_0x4a8f67,null));};exports[_0x149a('0x25')]=function(_0x18229b,_0x15edb0){return db[_0x149a('0x28')][_0x149a('0x44')]({'where':{'id':_0x18229b['params']['id']}})[_0x149a('0x24')](handleEntityNotFound(_0x15edb0,null))[_0x149a('0x24')](removeEntity(_0x15edb0,null))[_0x149a('0x3e')](handleError(_0x15edb0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index ed7a737..1a1a445 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 _0xa3fe=['request-promise','path','../../config/environment','exports','int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','api','bluebird'];(function(_0x3e967f,_0x28027a){var _0x54bffd=function(_0x2bf5db){while(--_0x2bf5db){_0x3e967f['push'](_0x3e967f['shift']());}};_0x54bffd(++_0x28027a);}(_0xa3fe,0xd8));var _0xea3f=function(_0x1bdf25,_0x2db6b5){_0x1bdf25=_0x1bdf25-0x0;var _0x20a96d=_0xa3fe[_0x1bdf25];return _0x20a96d;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var logger=require(_0xea3f('0x1'))(_0xea3f('0x2'));var moment=require('moment');var BPromise=require(_0xea3f('0x3'));var rp=require(_0xea3f('0x4'));var fs=require('fs');var path=require(_0xea3f('0x5'));var rimraf=require('rimraf');var config=require(_0xea3f('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xea3f('0x7')]=function(_0x7ea359,_0x4150b2){return _0x7ea359['define']('FreshsalesField',attributes,{'tableName':_0xea3f('0x8'),'paranoid':![],'indexes':[{'name':_0xea3f('0x9'),'fields':[_0xea3f('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfef9=['rimraf','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','api','moment','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfef9,0xd3));var _0x9fef=function(_0x11bf1b,_0x50581b){_0x11bf1b=_0x11bf1b-0x0;var _0x387d1c=_0xfef9[_0x11bf1b];return _0x387d1c;};'use strict';var _=require(_0x9fef('0x0'));var util=require(_0x9fef('0x1'));var logger=require('../../config/logger')(_0x9fef('0x2'));var moment=require(_0x9fef('0x3'));var BPromise=require('bluebird');var rp=require(_0x9fef('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fef('0x5'));var config=require('../../config/environment');var attributes=require(_0x9fef('0x6'));module[_0x9fef('0x7')]=function(_0x4d86cb,_0x366ea9){return _0x4d86cb[_0x9fef('0x8')]('FreshsalesField',attributes,{'tableName':_0x9fef('0x9'),'paranoid':![],'indexes':[{'name':_0x9fef('0xa'),'fields':[_0x9fef('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 26806d9..b44748d 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 _0xacf4=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xacf4,0xe7));var _0x4acf=function(_0x54a3cc,_0x480b4b){_0x54a3cc=_0x54a3cc-0x0;var _0x18d0aa=_0xacf4[_0x54a3cc];return _0x18d0aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x39f9f2,_0x37fc06){var _0x3febf8=function(_0x2811f2){while(--_0x2811f2){_0x39f9f2['push'](_0x39f9f2['shift']());}};_0x3febf8(++_0x37fc06);}(_0x524e,0x15e));var _0xe524=function(_0x5446ad,_0x14c2c8){_0x5446ad=_0x5446ad-0x0;var _0x3c0924=_0x524e[_0x5446ad];return _0x3c0924;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0b67d3a..d78dbe1 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xda5a5a,_0x3944b8){var _0x3f468a=function(_0x3b1f31){while(--_0x3b1f31){_0xda5a5a['push'](_0xda5a5a['shift']());}};_0x3f468a(++_0x3944b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1a05ec,_0xc68024){var _0x21db22=function(_0x542174){while(--_0x542174){_0x1a05ec['push'](_0x1a05ec['shift']());}};_0x21db22(++_0xc68024);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 9435f93..d1a1f95 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 _0xb36b=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x11ae05,_0xb34f47){var _0x239c2f=function(_0xd35c61){while(--_0xd35c61){_0x11ae05['push'](_0x11ae05['shift']());}};_0x239c2f(++_0xb34f47);}(_0xb36b,0xac));var _0xbb36=function(_0x2423cc,_0x5b382e){_0x2423cc=_0x2423cc-0x0;var _0x2b8110=_0xb36b[_0x2423cc];return _0x2b8110;};'use strict';var Sequelize=require(_0xbb36('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb36('0x1')]},'description':{'type':Sequelize[_0xbb36('0x1')]},'username':{'type':Sequelize[_0xbb36('0x1')],'unique':_0xbb36('0x2')},'remoteUri':{'type':Sequelize[_0xbb36('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbb36('0x1')]},'clientSecret':{'type':Sequelize[_0xbb36('0x1')]},'securityToken':{'type':Sequelize[_0xbb36('0x1')]},'serverUrl':{'type':Sequelize[_0xbb36('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb36('0x3')](_0xbb36('0x4'),_0xbb36('0x5')),'defaultValue':_0xbb36('0x4')}}; \ No newline at end of file +var _0xcfcb=['integrationTab','newTab','sequelize','STRING','username','ENUM'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x41eb93,_0x19c6f1){_0x41eb93=_0x41eb93-0x0;var _0x4ddf78=_0xcfcb[_0x41eb93];return _0x4ddf78;};'use strict';var Sequelize=require(_0xbcfc('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbcfc('0x1')],'unique':_0xbcfc('0x2')},'remoteUri':{'type':Sequelize[_0xbcfc('0x1')]},'password':{'type':Sequelize[_0xbcfc('0x1')]},'clientId':{'type':Sequelize[_0xbcfc('0x1')]},'clientSecret':{'type':Sequelize[_0xbcfc('0x1')]},'securityToken':{'type':Sequelize[_0xbcfc('0x1')]},'serverUrl':{'type':Sequelize[_0xbcfc('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbcfc('0x3')](_0xbcfc('0x4'),_0xbcfc('0x5')),'defaultValue':_0xbcfc('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 015aaa2..6145aef 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 _0xea58=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','send','map','SalesforceAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','name','merge','options','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','Task','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','login','password','concat','isNil','ticketType','describe','OwnerId','Subject','Description','string','picklist','boolean','email','textarea','remove','includes','label','custom','picklistValues','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js'];(function(_0x9f7bd7,_0x3860dc){var _0x57c810=function(_0x4e0a92){while(--_0x4e0a92){_0x9f7bd7['push'](_0x9f7bd7['shift']());}};_0x57c810(++_0x3860dc);}(_0xea58,0xe0));var _0x8ea5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea58[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ea5('0x0'));var zipdir=require(_0x8ea5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ea5('0x2'));var moment=require('moment');var BPromise=require(_0x8ea5('0x3'));var Mustache=require(_0x8ea5('0x4'));var util=require(_0x8ea5('0x5'));var path=require(_0x8ea5('0x6'));var sox=require(_0x8ea5('0x7'));var csv=require('to-csv');var ejs=require(_0x8ea5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8ea5('0x9'));var jsforce=require(_0x8ea5('0xa'));var deskjs=require(_0x8ea5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8ea5('0xc'));var Papa=require(_0x8ea5('0xd'));var Redis=require(_0x8ea5('0xe'));var authService=require(_0x8ea5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8ea5('0x10'));var hardwareService=require(_0x8ea5('0x11'));var logger=require(_0x8ea5('0x12'))(_0x8ea5('0x13'));var utils=require(_0x8ea5('0x14'));var config=require(_0x8ea5('0x15'));var licenseUtil=require(_0x8ea5('0x16'));var db=require(_0x8ea5('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x31d475,_0x456f23){_0x456f23=_0x456f23||0xcc;return function(_0x417de5){if(_0x417de5){return _0x31d475[_0x8ea5('0x18')](_0x456f23);}return _0x31d475[_0x8ea5('0x19')](_0x456f23)[_0x8ea5('0x1a')]();};}function respondWithResult(_0x36726e,_0x5083f0){_0x5083f0=_0x5083f0||0xc8;return function(_0x104e07){if(_0x104e07){return _0x36726e[_0x8ea5('0x19')](_0x5083f0)[_0x8ea5('0x1b')](_0x104e07);}};}function respondWithFilteredResult(_0x4fbb76,_0xafbfd4){return function(_0x201d76){if(_0x201d76){var _0x5a33ad=typeof _0xafbfd4[_0x8ea5('0x1c')]===_0x8ea5('0x1d')&&typeof _0xafbfd4[_0x8ea5('0x1e')]==='undefined';var _0x24e6d0=_0x201d76['count'];var _0x163eb4=_0x5a33ad?0x0:_0xafbfd4[_0x8ea5('0x1c')];var _0x163019=_0x5a33ad?_0x201d76[_0x8ea5('0x1f')]:_0xafbfd4[_0x8ea5('0x1c')]+_0xafbfd4[_0x8ea5('0x1e')];var _0x3863ef;if(_0x163019>=_0x24e6d0){_0x163019=_0x24e6d0;_0x3863ef=0xc8;}else{_0x3863ef=0xce;}_0x4fbb76[_0x8ea5('0x19')](_0x3863ef);return _0x4fbb76[_0x8ea5('0x20')]('Content-Range',_0x163eb4+'-'+_0x163019+'/'+_0x24e6d0)[_0x8ea5('0x1b')](_0x201d76);}return null;};}function patchUpdates(_0x185c00){return function(_0x2b8d34){try{jsonpatch[_0x8ea5('0x21')](_0x2b8d34,_0x185c00,!![]);}catch(_0x22d4b0){return BPromise['reject'](_0x22d4b0);}return _0x2b8d34[_0x8ea5('0x22')]();};}function saveUpdates(_0x5a587d,_0x63857b){return function(_0x2c2822){if(_0x2c2822){return _0x2c2822[_0x8ea5('0x23')](_0x5a587d)[_0x8ea5('0x24')](function(_0x2104d7){return _0x2104d7;});}return null;};}function removeEntity(_0x8d326b,_0x23ca52){return function(_0x3b4cb7){if(_0x3b4cb7){return _0x3b4cb7['destroy']()[_0x8ea5('0x24')](function(){_0x8d326b[_0x8ea5('0x19')](0xcc)[_0x8ea5('0x1a')]();});}};}function handleEntityNotFound(_0x9192f6,_0x454b38){return function(_0x14608a){if(!_0x14608a){_0x9192f6[_0x8ea5('0x18')](0x194);}return _0x14608a;};}function handleError(_0x3d0020,_0x446872){_0x446872=_0x446872||0x1f4;return function(_0x32ef1e){logger[_0x8ea5('0x25')](_0x32ef1e[_0x8ea5('0x26')]);if(_0x32ef1e['name']){delete _0x32ef1e['name'];}_0x3d0020['status'](_0x446872)[_0x8ea5('0x27')](_0x32ef1e);};}exports['index']=function(_0x579c76,_0x5163b0){var _0x1750f4={},_0x300684={},_0x2924d9={'count':0x0,'rows':[]};var _0x132150=_[_0x8ea5('0x28')](db[_0x8ea5('0x29')]['rawAttributes'],function(_0x5f24d0){return{'name':_0x5f24d0[_0x8ea5('0x2a')],'type':_0x5f24d0['type'][_0x8ea5('0x2b')]};});_0x300684[_0x8ea5('0x2c')]=_[_0x8ea5('0x28')](_0x132150,'name');_0x300684[_0x8ea5('0x2d')]=_[_0x8ea5('0x2e')](_0x579c76['query']);_0x300684[_0x8ea5('0x2f')]=_[_0x8ea5('0x30')](_0x300684['model'],_0x300684['query']);_0x1750f4[_0x8ea5('0x31')]=_[_0x8ea5('0x30')](_0x300684[_0x8ea5('0x2c')],qs[_0x8ea5('0x32')](_0x579c76[_0x8ea5('0x2d')][_0x8ea5('0x32')]));_0x1750f4[_0x8ea5('0x31')]=_0x1750f4[_0x8ea5('0x31')][_0x8ea5('0x33')]?_0x1750f4['attributes']:_0x300684[_0x8ea5('0x2c')];if(!_0x579c76['query'][_0x8ea5('0x34')](_0x8ea5('0x35'))){_0x1750f4[_0x8ea5('0x1e')]=qs[_0x8ea5('0x1e')](_0x579c76[_0x8ea5('0x2d')][_0x8ea5('0x1e')]);_0x1750f4[_0x8ea5('0x1c')]=qs[_0x8ea5('0x1c')](_0x579c76[_0x8ea5('0x2d')]['offset']);}_0x1750f4[_0x8ea5('0x36')]=qs[_0x8ea5('0x37')](_0x579c76['query'][_0x8ea5('0x37')]);_0x1750f4[_0x8ea5('0x38')]=qs[_0x8ea5('0x2f')](_[_0x8ea5('0x39')](_0x579c76[_0x8ea5('0x2d')],_0x300684[_0x8ea5('0x2f')]),_0x132150);if(_0x579c76[_0x8ea5('0x2d')][_0x8ea5('0x3a')]){_0x1750f4[_0x8ea5('0x38')]=_['merge'](_0x1750f4['where'],{'$or':_[_0x8ea5('0x28')](_0x132150,function(_0x3ad9cd){if(_0x3ad9cd[_0x8ea5('0x3b')]!=='VIRTUAL'){var _0x5ddbc6={};_0x5ddbc6[_0x3ad9cd[_0x8ea5('0x3c')]]={'$like':'%'+_0x579c76[_0x8ea5('0x2d')][_0x8ea5('0x3a')]+'%'};return _0x5ddbc6;}})});}_0x1750f4=_[_0x8ea5('0x3d')]({},_0x1750f4,_0x579c76[_0x8ea5('0x3e')]);var _0x50c1c0={'where':_0x1750f4['where']};return db['SalesforceAccount'][_0x8ea5('0x1f')](_0x50c1c0)[_0x8ea5('0x24')](function(_0x23bf38){_0x2924d9[_0x8ea5('0x1f')]=_0x23bf38;if(_0x579c76['query']['includeAll']){_0x1750f4['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x8ea5('0x3f')](_0x1750f4);})[_0x8ea5('0x24')](function(_0x16916e){_0x2924d9[_0x8ea5('0x40')]=_0x16916e;return _0x2924d9;})[_0x8ea5('0x24')](respondWithFilteredResult(_0x5163b0,_0x1750f4))[_0x8ea5('0x41')](handleError(_0x5163b0,null));};exports[_0x8ea5('0x42')]=function(_0x2deff6,_0x1f398e){var _0x3c5b2d={'raw':![],'where':{'id':_0x2deff6[_0x8ea5('0x43')]['id']}},_0x235f0c={};_0x235f0c[_0x8ea5('0x2c')]=_['keys'](db[_0x8ea5('0x29')][_0x8ea5('0x44')]);_0x235f0c[_0x8ea5('0x2d')]=_[_0x8ea5('0x2e')](_0x2deff6[_0x8ea5('0x2d')]);_0x235f0c[_0x8ea5('0x2f')]=_[_0x8ea5('0x30')](_0x235f0c['model'],_0x235f0c['query']);_0x3c5b2d[_0x8ea5('0x31')]=_[_0x8ea5('0x30')](_0x235f0c[_0x8ea5('0x2c')],qs[_0x8ea5('0x32')](_0x2deff6[_0x8ea5('0x2d')][_0x8ea5('0x32')]));_0x3c5b2d[_0x8ea5('0x31')]=_0x3c5b2d[_0x8ea5('0x31')][_0x8ea5('0x33')]?_0x3c5b2d[_0x8ea5('0x31')]:_0x235f0c[_0x8ea5('0x2c')];if(_0x2deff6[_0x8ea5('0x2d')]['includeAll']){_0x3c5b2d[_0x8ea5('0x45')]=[{'all':!![]}];}_0x3c5b2d=_[_0x8ea5('0x3d')]({},_0x3c5b2d,_0x2deff6[_0x8ea5('0x3e')]);return db[_0x8ea5('0x29')][_0x8ea5('0x46')](_0x3c5b2d)['then'](handleEntityNotFound(_0x1f398e,null))[_0x8ea5('0x24')](respondWithResult(_0x1f398e,null))[_0x8ea5('0x41')](handleError(_0x1f398e,null));};exports[_0x8ea5('0x47')]=function(_0x52f1b6,_0x3ef08c){return db[_0x8ea5('0x29')][_0x8ea5('0x47')](_0x52f1b6[_0x8ea5('0x48')],{})[_0x8ea5('0x24')](respondWithResult(_0x3ef08c,0xc9))['catch'](handleError(_0x3ef08c,null));};exports[_0x8ea5('0x23')]=function(_0x7fe75b,_0x2ee68d){if(_0x7fe75b[_0x8ea5('0x48')]['id']){delete _0x7fe75b[_0x8ea5('0x48')]['id'];}return db[_0x8ea5('0x29')]['find']({'where':{'id':_0x7fe75b[_0x8ea5('0x43')]['id']}})[_0x8ea5('0x24')](handleEntityNotFound(_0x2ee68d,null))['then'](saveUpdates(_0x7fe75b[_0x8ea5('0x48')],null))[_0x8ea5('0x24')](respondWithResult(_0x2ee68d,null))[_0x8ea5('0x41')](handleError(_0x2ee68d,null));};exports[_0x8ea5('0x49')]=function(_0x357387,_0x169026){return db['SalesforceAccount'][_0x8ea5('0x46')]({'where':{'id':_0x357387[_0x8ea5('0x43')]['id']}})['then'](handleEntityNotFound(_0x169026,null))[_0x8ea5('0x24')](removeEntity(_0x169026,null))['catch'](handleError(_0x169026,null));};exports[_0x8ea5('0x4a')]=function(_0x5925ee,_0x43d0ee,_0x25d53b){var _0x27602a={};var _0x52f8b2={};var _0x118e1c;var _0x31b1f6;return db[_0x8ea5('0x29')][_0x8ea5('0x4b')]({'where':{'id':_0x5925ee[_0x8ea5('0x43')]['id']}})[_0x8ea5('0x24')](handleEntityNotFound(_0x43d0ee,null))['then'](function(_0x5f49b7){if(_0x5f49b7){_0x118e1c=_0x5f49b7;_0x52f8b2[_0x8ea5('0x2c')]=_['keys'](db[_0x8ea5('0x4c')]['rawAttributes']);_0x52f8b2['query']=_[_0x8ea5('0x2e')](_0x5925ee[_0x8ea5('0x2d')]);_0x52f8b2[_0x8ea5('0x2f')]=_[_0x8ea5('0x30')](_0x52f8b2[_0x8ea5('0x2c')],_0x52f8b2[_0x8ea5('0x2d')]);_0x27602a['attributes']=_[_0x8ea5('0x30')](_0x52f8b2[_0x8ea5('0x2c')],qs[_0x8ea5('0x32')](_0x5925ee[_0x8ea5('0x2d')][_0x8ea5('0x32')]));_0x27602a['attributes']=_0x27602a[_0x8ea5('0x31')][_0x8ea5('0x33')]?_0x27602a[_0x8ea5('0x31')]:_0x52f8b2['model'];_0x27602a[_0x8ea5('0x36')]=qs['sort'](_0x5925ee[_0x8ea5('0x2d')]['sort']);_0x27602a['where']=qs[_0x8ea5('0x2f')](_[_0x8ea5('0x39')](_0x5925ee[_0x8ea5('0x2d')],_0x52f8b2['filters']));if(_0x5925ee[_0x8ea5('0x2d')][_0x8ea5('0x3a')]){_0x27602a[_0x8ea5('0x38')]=_['merge'](_0x27602a[_0x8ea5('0x38')],{'$or':_[_0x8ea5('0x28')](_0x27602a[_0x8ea5('0x31')],function(_0x5022ba){var _0x237392={};_0x237392[_0x5022ba]={'$like':'%'+_0x5925ee[_0x8ea5('0x2d')][_0x8ea5('0x3a')]+'%'};return _0x237392;})});}_0x27602a=_[_0x8ea5('0x3d')]({},_0x27602a,_0x5925ee['options']);return _0x118e1c[_0x8ea5('0x4a')](_0x27602a);}})[_0x8ea5('0x24')](function(_0x4fdae0){if(_0x4fdae0){_0x31b1f6=_0x4fdae0[_0x8ea5('0x33')];if(!_0x5925ee[_0x8ea5('0x2d')]['hasOwnProperty'](_0x8ea5('0x35'))){_0x27602a[_0x8ea5('0x1e')]=qs[_0x8ea5('0x1e')](_0x5925ee[_0x8ea5('0x2d')][_0x8ea5('0x1e')]);_0x27602a[_0x8ea5('0x1c')]=qs[_0x8ea5('0x1c')](_0x5925ee[_0x8ea5('0x2d')]['offset']);}return _0x118e1c[_0x8ea5('0x4a')](_0x27602a);}})[_0x8ea5('0x24')](function(_0x32868f){if(_0x32868f){return _0x32868f?{'count':_0x31b1f6,'rows':_0x32868f}:null;}})['then'](respondWithResult(_0x43d0ee,null))[_0x8ea5('0x41')](handleError(_0x43d0ee,null));};exports['addConfiguration']=function(_0x56a62b,_0x3b033d,_0x563165){if(_0x56a62b[_0x8ea5('0x48')]['id']){delete _0x56a62b[_0x8ea5('0x48')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x56a62b[_0x8ea5('0x43')]['id']}})[_0x8ea5('0x24')](handleEntityNotFound(_0x3b033d,null))['then'](function(_0x3f4aa5){if(_0x3f4aa5){_0x56a62b['body'][_0x8ea5('0x4d')]=_0x3f4aa5['id'];_0x56a62b[_0x8ea5('0x48')][_0x8ea5('0x4e')]=integrations[_0x8ea5('0x4f')](_0x56a62b[_0x8ea5('0x48')]['channel'],_0x56a62b[_0x8ea5('0x48')]['type']);_0x56a62b[_0x8ea5('0x48')][_0x8ea5('0x50')]=integrations[_0x8ea5('0x51')](_0x56a62b[_0x8ea5('0x48')][_0x8ea5('0x52')],_0x56a62b[_0x8ea5('0x48')][_0x8ea5('0x3b')]);return db['SalesforceConfiguration'][_0x8ea5('0x47')](_0x56a62b[_0x8ea5('0x48')],{'include':[{'model':db[_0x8ea5('0x53')],'as':'Subjects'},{'model':db[_0x8ea5('0x53')],'as':'Descriptions'}]});}return null;})[_0x8ea5('0x24')](respondWithResult(_0x3b033d,null))['catch'](handleError(_0x3b033d,null));};exports['getFields']=function(_0x43223f,_0x342986,_0x2272e3){var _0x18e12e;var _0x24ce70='';var _0x428ed8=_0x8ea5('0x54');return db[_0x8ea5('0x29')][_0x8ea5('0x4b')]({'where':{'id':_0x43223f[_0x8ea5('0x43')]['id']},'attributes':['id','remoteUri',_0x8ea5('0x55'),_0x8ea5('0x56'),_0x8ea5('0x57'),'password',_0x8ea5('0x58')]})[_0x8ea5('0x24')](handleEntityNotFound(_0x342986,null))[_0x8ea5('0x24')](function(_0x1e8167){if(_0x1e8167){_0x24ce70=_0x1e8167['remoteUri'];var _0x46a480=_0x24ce70[_0x8ea5('0x59')](-0x1);if(_0x46a480==='/'){_0x24ce70=_0x24ce70[_0x8ea5('0x5a')](0x0,_0x24ce70[_0x8ea5('0x5b')](_0x46a480));}_0x18e12e=new jsforce[(_0x8ea5('0x5c'))]({'oauth2':{'loginUrl':_0x24ce70,'clientId':_0x1e8167[_0x8ea5('0x55')],'clientSecret':_0x1e8167[_0x8ea5('0x56')]}});return _0x18e12e[_0x8ea5('0x5d')](_0x1e8167['username'],_0x1e8167[_0x8ea5('0x5e')][_0x8ea5('0x5f')](_0x1e8167[_0x8ea5('0x58')]));}})['then'](function(_0x51e612){if(_0x51e612){if(!_[_0x8ea5('0x60')](_0x43223f[_0x8ea5('0x2d')][_0x8ea5('0x61')])){_0x428ed8=_0x43223f[_0x8ea5('0x2d')][_0x8ea5('0x61')];}return _0x18e12e['sobject'](_0x428ed8)[_0x8ea5('0x62')]();}})[_0x8ea5('0x24')](function(_0xb4de5d){var _0x5ea09e=[_0x8ea5('0x63'),'ActivityDate','IsReminderSet','IsRecurrence',_0x8ea5('0x64'),_0x8ea5('0x65')];var _0x4a7205=[_0x8ea5('0x66'),'int',_0x8ea5('0x67'),_0x8ea5('0x68'),_0x8ea5('0x69'),_0x8ea5('0x6a'),'phone'];if(_0xb4de5d){_[_0x8ea5('0x6b')](_0xb4de5d['fields'],function(_0x25d59c){return _0x5ea09e[_0x8ea5('0x6c')](_0x25d59c[_0x8ea5('0x3c')])||!_0x4a7205[_0x8ea5('0x6c')](_0x25d59c[_0x8ea5('0x3b')]);});return{'count':_0xb4de5d[_0x8ea5('0x32')]['length'],'rows':_['map'](_0xb4de5d[_0x8ea5('0x32')],function(_0x442e19){return{'id':_0x442e19[_0x8ea5('0x3c')],'name':_0x442e19[_0x8ea5('0x6d')],'custom':_0x442e19[_0x8ea5('0x6e')],'options':_0x442e19['picklistValues'][_0x8ea5('0x33')]>0x0?_[_0x8ea5('0x28')](_0x442e19[_0x8ea5('0x6f')],function(_0xea7d3b){return{'name':_0xea7d3b[_0x8ea5('0x6d')],'value':_0xea7d3b['value']};}):_0x442e19[_0x8ea5('0x3b')]=='boolean'?[{'name':_0x8ea5('0x70'),'value':_0x8ea5('0x71')},{'name':_0x8ea5('0x72'),'value':'false'}]:[]};})};}})[_0x8ea5('0x24')](respondWithResult(_0x342986,null))[_0x8ea5('0x41')](function(_0x1db949){var _0x43fdc5=_0x43223f[_0x8ea5('0x2d')][_0x8ea5('0x73')]?0x1f4:_0x1db949[_0x8ea5('0x74')]||0x1f4;logger[_0x8ea5('0x25')](_0x8ea5('0x75'),'getFields',_0x43fdc5,JSON['stringify'](_0x1db949));delete _0x1db949[_0x8ea5('0x3c')];if(_0x43fdc5===0x191){_0x43fdc5=0x190;}_0x342986[_0x8ea5('0x19')](_0x43fdc5)[_0x8ea5('0x27')](_0x43223f[_0x8ea5('0x2d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1db949[_0x8ea5('0x74')]}:_0x1db949);});}; \ No newline at end of file +var _0x2704=['pick','getConfigurations','nolimit','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','login','username','concat','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','boolean','email','textarea','phone','includes','picklistValues','value','true','False','false','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','length','includeAll','find','create','body','SalesforceConfiguration'];(function(_0x149c8c,_0x209ef2){var _0x2a429b=function(_0x3d4339){while(--_0x3d4339){_0x149c8c['push'](_0x149c8c['shift']());}};_0x2a429b(++_0x209ef2);}(_0x2704,0x1a8));var _0x4270=function(_0x4d093a,_0x15d59c){_0x4d093a=_0x4d093a-0x0;var _0x5d7227=_0x2704[_0x4d093a];return _0x5d7227;};'use strict';var emlformat=require(_0x4270('0x0'));var rimraf=require(_0x4270('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4270('0x2'));var moment=require(_0x4270('0x3'));var BPromise=require(_0x4270('0x4'));var Mustache=require(_0x4270('0x5'));var util=require('util');var path=require(_0x4270('0x6'));var sox=require('sox');var csv=require(_0x4270('0x7'));var ejs=require(_0x4270('0x8'));var fs=require('fs');var fs_extra=require(_0x4270('0x9'));var _=require(_0x4270('0xa'));var squel=require(_0x4270('0xb'));var crypto=require(_0x4270('0xc'));var jsforce=require(_0x4270('0xd'));var deskjs=require(_0x4270('0xe'));var toCsv=require(_0x4270('0x7'));var querystring=require('querystring');var Papa=require(_0x4270('0xf'));var Redis=require(_0x4270('0x10'));var authService=require(_0x4270('0x11'));var qs=require(_0x4270('0x12'));var as=require(_0x4270('0x13'));var hardwareService=require(_0x4270('0x14'));var logger=require(_0x4270('0x15'))(_0x4270('0x16'));var utils=require(_0x4270('0x17'));var config=require(_0x4270('0x18'));var licenseUtil=require(_0x4270('0x19'));var db=require(_0x4270('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x21bbb1,_0x465641){_0x465641=_0x465641||0xcc;return function(_0x2e9493){if(_0x2e9493){return _0x21bbb1['sendStatus'](_0x465641);}return _0x21bbb1[_0x4270('0x1b')](_0x465641)[_0x4270('0x1c')]();};}function respondWithResult(_0x660c6a,_0x368c11){_0x368c11=_0x368c11||0xc8;return function(_0x25e9c0){if(_0x25e9c0){return _0x660c6a[_0x4270('0x1b')](_0x368c11)[_0x4270('0x1d')](_0x25e9c0);}};}function respondWithFilteredResult(_0x1e6316,_0x125207){return function(_0x5f0240){if(_0x5f0240){var _0x2b05e2=typeof _0x125207[_0x4270('0x1e')]===_0x4270('0x1f')&&typeof _0x125207[_0x4270('0x20')]==='undefined';var _0x1fdad3=_0x5f0240[_0x4270('0x21')];var _0x142505=_0x2b05e2?0x0:_0x125207[_0x4270('0x1e')];var _0x773f0c=_0x2b05e2?_0x5f0240[_0x4270('0x21')]:_0x125207[_0x4270('0x1e')]+_0x125207[_0x4270('0x20')];var _0x3e647c;if(_0x773f0c>=_0x1fdad3){_0x773f0c=_0x1fdad3;_0x3e647c=0xc8;}else{_0x3e647c=0xce;}_0x1e6316[_0x4270('0x1b')](_0x3e647c);return _0x1e6316['set'](_0x4270('0x22'),_0x142505+'-'+_0x773f0c+'/'+_0x1fdad3)[_0x4270('0x1d')](_0x5f0240);}return null;};}function patchUpdates(_0x51b6df){return function(_0x380168){try{jsonpatch['apply'](_0x380168,_0x51b6df,!![]);}catch(_0x26a9e2){return BPromise[_0x4270('0x23')](_0x26a9e2);}return _0x380168[_0x4270('0x24')]();};}function saveUpdates(_0x486f1b,_0x2c6b1d){return function(_0x2a6602){if(_0x2a6602){return _0x2a6602[_0x4270('0x25')](_0x486f1b)[_0x4270('0x26')](function(_0x1886c9){return _0x1886c9;});}return null;};}function removeEntity(_0xbd721d,_0x3e72d5){return function(_0x37873d){if(_0x37873d){return _0x37873d[_0x4270('0x27')]()[_0x4270('0x26')](function(){_0xbd721d[_0x4270('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a1b54,_0x4dbcac){return function(_0x33cc05){if(!_0x33cc05){_0x5a1b54[_0x4270('0x28')](0x194);}return _0x33cc05;};}function handleError(_0xb1c41f,_0x39f451){_0x39f451=_0x39f451||0x1f4;return function(_0x441c29){logger['error'](_0x441c29['stack']);if(_0x441c29[_0x4270('0x29')]){delete _0x441c29[_0x4270('0x29')];}_0xb1c41f[_0x4270('0x1b')](_0x39f451)[_0x4270('0x2a')](_0x441c29);};}exports[_0x4270('0x2b')]=function(_0x5a828c,_0x34f9cb){var _0x3bccd2={},_0x351c61={},_0x2de2b6={'count':0x0,'rows':[]};var _0x2c730c=_['map'](db[_0x4270('0x2c')][_0x4270('0x2d')],function(_0x3ce751){return{'name':_0x3ce751[_0x4270('0x2e')],'type':_0x3ce751[_0x4270('0x2f')][_0x4270('0x30')]};});_0x351c61[_0x4270('0x31')]=_[_0x4270('0x32')](_0x2c730c,'name');_0x351c61['query']=_['keys'](_0x5a828c[_0x4270('0x33')]);_0x351c61[_0x4270('0x34')]=_[_0x4270('0x35')](_0x351c61[_0x4270('0x31')],_0x351c61[_0x4270('0x33')]);_0x3bccd2['attributes']=_[_0x4270('0x35')](_0x351c61['model'],qs[_0x4270('0x36')](_0x5a828c[_0x4270('0x33')][_0x4270('0x36')]));_0x3bccd2[_0x4270('0x37')]=_0x3bccd2[_0x4270('0x37')]['length']?_0x3bccd2[_0x4270('0x37')]:_0x351c61[_0x4270('0x31')];if(!_0x5a828c[_0x4270('0x33')][_0x4270('0x38')]('nolimit')){_0x3bccd2[_0x4270('0x20')]=qs[_0x4270('0x20')](_0x5a828c['query'][_0x4270('0x20')]);_0x3bccd2[_0x4270('0x1e')]=qs[_0x4270('0x1e')](_0x5a828c[_0x4270('0x33')][_0x4270('0x1e')]);}_0x3bccd2[_0x4270('0x39')]=qs[_0x4270('0x3a')](_0x5a828c[_0x4270('0x33')][_0x4270('0x3a')]);_0x3bccd2['where']=qs[_0x4270('0x34')](_['pick'](_0x5a828c[_0x4270('0x33')],_0x351c61[_0x4270('0x34')]),_0x2c730c);if(_0x5a828c[_0x4270('0x33')][_0x4270('0x3b')]){_0x3bccd2[_0x4270('0x3c')]=_[_0x4270('0x3d')](_0x3bccd2['where'],{'$or':_[_0x4270('0x32')](_0x2c730c,function(_0x4f4c1d){if(_0x4f4c1d[_0x4270('0x2f')]!==_0x4270('0x3e')){var _0x41749e={};_0x41749e[_0x4f4c1d[_0x4270('0x29')]]={'$like':'%'+_0x5a828c[_0x4270('0x33')][_0x4270('0x3b')]+'%'};return _0x41749e;}})});}_0x3bccd2=_[_0x4270('0x3d')]({},_0x3bccd2,_0x5a828c[_0x4270('0x3f')]);var _0x1480f0={'where':_0x3bccd2[_0x4270('0x3c')]};return db[_0x4270('0x2c')][_0x4270('0x21')](_0x1480f0)[_0x4270('0x26')](function(_0x1095d4){_0x2de2b6[_0x4270('0x21')]=_0x1095d4;if(_0x5a828c['query']['includeAll']){_0x3bccd2[_0x4270('0x40')]=[{'all':!![]}];}return db[_0x4270('0x2c')][_0x4270('0x41')](_0x3bccd2);})[_0x4270('0x26')](function(_0x5a495d){_0x2de2b6['rows']=_0x5a495d;return _0x2de2b6;})[_0x4270('0x26')](respondWithFilteredResult(_0x34f9cb,_0x3bccd2))[_0x4270('0x42')](handleError(_0x34f9cb,null));};exports[_0x4270('0x43')]=function(_0x1ae6c6,_0x2422bd){var _0x5958b1={'raw':![],'where':{'id':_0x1ae6c6[_0x4270('0x44')]['id']}},_0x3f74cd={};_0x3f74cd[_0x4270('0x31')]=_[_0x4270('0x45')](db[_0x4270('0x2c')][_0x4270('0x2d')]);_0x3f74cd[_0x4270('0x33')]=_[_0x4270('0x45')](_0x1ae6c6[_0x4270('0x33')]);_0x3f74cd[_0x4270('0x34')]=_[_0x4270('0x35')](_0x3f74cd[_0x4270('0x31')],_0x3f74cd[_0x4270('0x33')]);_0x5958b1[_0x4270('0x37')]=_[_0x4270('0x35')](_0x3f74cd[_0x4270('0x31')],qs[_0x4270('0x36')](_0x1ae6c6[_0x4270('0x33')][_0x4270('0x36')]));_0x5958b1['attributes']=_0x5958b1[_0x4270('0x37')][_0x4270('0x46')]?_0x5958b1[_0x4270('0x37')]:_0x3f74cd[_0x4270('0x31')];if(_0x1ae6c6['query'][_0x4270('0x47')]){_0x5958b1['include']=[{'all':!![]}];}_0x5958b1=_[_0x4270('0x3d')]({},_0x5958b1,_0x1ae6c6['options']);return db[_0x4270('0x2c')][_0x4270('0x48')](_0x5958b1)[_0x4270('0x26')](handleEntityNotFound(_0x2422bd,null))[_0x4270('0x26')](respondWithResult(_0x2422bd,null))['catch'](handleError(_0x2422bd,null));};exports['create']=function(_0x78ce84,_0x5d4f44){return db[_0x4270('0x2c')][_0x4270('0x49')](_0x78ce84[_0x4270('0x4a')],{})[_0x4270('0x26')](respondWithResult(_0x5d4f44,0xc9))[_0x4270('0x42')](handleError(_0x5d4f44,null));};exports[_0x4270('0x25')]=function(_0x4b062f,_0x418229){if(_0x4b062f[_0x4270('0x4a')]['id']){delete _0x4b062f['body']['id'];}return db['SalesforceAccount'][_0x4270('0x48')]({'where':{'id':_0x4b062f[_0x4270('0x44')]['id']}})[_0x4270('0x26')](handleEntityNotFound(_0x418229,null))[_0x4270('0x26')](saveUpdates(_0x4b062f[_0x4270('0x4a')],null))[_0x4270('0x26')](respondWithResult(_0x418229,null))[_0x4270('0x42')](handleError(_0x418229,null));};exports[_0x4270('0x27')]=function(_0x452921,_0x448bff){return db[_0x4270('0x2c')]['find']({'where':{'id':_0x452921[_0x4270('0x44')]['id']}})[_0x4270('0x26')](handleEntityNotFound(_0x448bff,null))[_0x4270('0x26')](removeEntity(_0x448bff,null))['catch'](handleError(_0x448bff,null));};exports['getConfigurations']=function(_0x5c65f0,_0x51bac3,_0x10d513){var _0x535d39={};var _0x2a43de={};var _0x29e386;var _0x456704;return db[_0x4270('0x2c')]['findOne']({'where':{'id':_0x5c65f0['params']['id']}})[_0x4270('0x26')](handleEntityNotFound(_0x51bac3,null))[_0x4270('0x26')](function(_0x151c0a){if(_0x151c0a){_0x29e386=_0x151c0a;_0x2a43de[_0x4270('0x31')]=_[_0x4270('0x45')](db[_0x4270('0x4b')][_0x4270('0x2d')]);_0x2a43de[_0x4270('0x33')]=_[_0x4270('0x45')](_0x5c65f0[_0x4270('0x33')]);_0x2a43de[_0x4270('0x34')]=_[_0x4270('0x35')](_0x2a43de[_0x4270('0x31')],_0x2a43de[_0x4270('0x33')]);_0x535d39['attributes']=_[_0x4270('0x35')](_0x2a43de['model'],qs[_0x4270('0x36')](_0x5c65f0[_0x4270('0x33')][_0x4270('0x36')]));_0x535d39[_0x4270('0x37')]=_0x535d39[_0x4270('0x37')][_0x4270('0x46')]?_0x535d39[_0x4270('0x37')]:_0x2a43de[_0x4270('0x31')];_0x535d39[_0x4270('0x39')]=qs[_0x4270('0x3a')](_0x5c65f0[_0x4270('0x33')][_0x4270('0x3a')]);_0x535d39[_0x4270('0x3c')]=qs[_0x4270('0x34')](_[_0x4270('0x4c')](_0x5c65f0[_0x4270('0x33')],_0x2a43de['filters']));if(_0x5c65f0[_0x4270('0x33')][_0x4270('0x3b')]){_0x535d39[_0x4270('0x3c')]=_[_0x4270('0x3d')](_0x535d39[_0x4270('0x3c')],{'$or':_['map'](_0x535d39['attributes'],function(_0x1000c3){var _0x45eccf={};_0x45eccf[_0x1000c3]={'$like':'%'+_0x5c65f0[_0x4270('0x33')][_0x4270('0x3b')]+'%'};return _0x45eccf;})});}_0x535d39=_[_0x4270('0x3d')]({},_0x535d39,_0x5c65f0['options']);return _0x29e386[_0x4270('0x4d')](_0x535d39);}})[_0x4270('0x26')](function(_0x13a60f){if(_0x13a60f){_0x456704=_0x13a60f['length'];if(!_0x5c65f0[_0x4270('0x33')][_0x4270('0x38')](_0x4270('0x4e'))){_0x535d39['limit']=qs[_0x4270('0x20')](_0x5c65f0[_0x4270('0x33')][_0x4270('0x20')]);_0x535d39[_0x4270('0x1e')]=qs[_0x4270('0x1e')](_0x5c65f0[_0x4270('0x33')]['offset']);}return _0x29e386[_0x4270('0x4d')](_0x535d39);}})[_0x4270('0x26')](function(_0xf5f8ba){if(_0xf5f8ba){return _0xf5f8ba?{'count':_0x456704,'rows':_0xf5f8ba}:null;}})[_0x4270('0x26')](respondWithResult(_0x51bac3,null))['catch'](handleError(_0x51bac3,null));};exports['addConfiguration']=function(_0x5d460d,_0x43e2fb,_0x71b055){if(_0x5d460d['body']['id']){delete _0x5d460d[_0x4270('0x4a')]['id'];}return db[_0x4270('0x2c')][_0x4270('0x4f')]({'where':{'id':_0x5d460d[_0x4270('0x44')]['id']}})[_0x4270('0x26')](handleEntityNotFound(_0x43e2fb,null))[_0x4270('0x26')](function(_0xf29e8c){if(_0xf29e8c){_0x5d460d['body'][_0x4270('0x50')]=_0xf29e8c['id'];_0x5d460d['body']['Subjects']=integrations[_0x4270('0x51')](_0x5d460d[_0x4270('0x4a')][_0x4270('0x52')],_0x5d460d[_0x4270('0x4a')][_0x4270('0x2f')]);_0x5d460d[_0x4270('0x4a')][_0x4270('0x53')]=integrations[_0x4270('0x54')](_0x5d460d[_0x4270('0x4a')]['channel'],_0x5d460d[_0x4270('0x4a')][_0x4270('0x2f')]);return db[_0x4270('0x4b')]['create'](_0x5d460d[_0x4270('0x4a')],{'include':[{'model':db[_0x4270('0x55')],'as':_0x4270('0x56')},{'model':db['SalesforceField'],'as':_0x4270('0x53')}]});}return null;})[_0x4270('0x26')](respondWithResult(_0x43e2fb,null))[_0x4270('0x42')](handleError(_0x43e2fb,null));};exports[_0x4270('0x57')]=function(_0x4eac82,_0x43be7f,_0x12ba23){var _0x4e8b5e;var _0x4a428a='';var _0x42c9bf=_0x4270('0x58');return db[_0x4270('0x2c')]['findOne']({'where':{'id':_0x4eac82[_0x4270('0x44')]['id']},'attributes':['id',_0x4270('0x59'),_0x4270('0x5a'),_0x4270('0x5b'),'username',_0x4270('0x5c'),_0x4270('0x5d')]})[_0x4270('0x26')](handleEntityNotFound(_0x43be7f,null))[_0x4270('0x26')](function(_0x236676){if(_0x236676){_0x4a428a=_0x236676[_0x4270('0x59')];var _0x5c655b=_0x4a428a[_0x4270('0x5e')](-0x1);if(_0x5c655b==='/'){_0x4a428a=_0x4a428a[_0x4270('0x5f')](0x0,_0x4a428a[_0x4270('0x60')](_0x5c655b));}_0x4e8b5e=new jsforce[(_0x4270('0x61'))]({'oauth2':{'loginUrl':_0x4a428a,'clientId':_0x236676[_0x4270('0x5a')],'clientSecret':_0x236676[_0x4270('0x5b')]}});return _0x4e8b5e[_0x4270('0x62')](_0x236676[_0x4270('0x63')],_0x236676[_0x4270('0x5c')][_0x4270('0x64')](_0x236676[_0x4270('0x5d')]));}})[_0x4270('0x26')](function(_0x2b9a31){if(_0x2b9a31){if(!_['isNil'](_0x4eac82[_0x4270('0x33')]['ticketType'])){_0x42c9bf=_0x4eac82[_0x4270('0x33')][_0x4270('0x65')];}return _0x4e8b5e[_0x4270('0x66')](_0x42c9bf)['describe']();}})[_0x4270('0x26')](function(_0x2eb981){var _0xd6e7db=[_0x4270('0x67'),_0x4270('0x68'),_0x4270('0x69'),_0x4270('0x6a'),_0x4270('0x6b'),_0x4270('0x6c')];var _0x4730e2=[_0x4270('0x6d'),'int','picklist',_0x4270('0x6e'),_0x4270('0x6f'),_0x4270('0x70'),_0x4270('0x71')];if(_0x2eb981){_['remove'](_0x2eb981[_0x4270('0x36')],function(_0x1ee6da){return _0xd6e7db[_0x4270('0x72')](_0x1ee6da[_0x4270('0x29')])||!_0x4730e2[_0x4270('0x72')](_0x1ee6da[_0x4270('0x2f')]);});return{'count':_0x2eb981[_0x4270('0x36')][_0x4270('0x46')],'rows':_['map'](_0x2eb981[_0x4270('0x36')],function(_0x1a3ad9){return{'id':_0x1a3ad9[_0x4270('0x29')],'name':_0x1a3ad9['label'],'custom':_0x1a3ad9['custom'],'options':_0x1a3ad9[_0x4270('0x73')]['length']>0x0?_['map'](_0x1a3ad9['picklistValues'],function(_0x4c4f32){return{'name':_0x4c4f32['label'],'value':_0x4c4f32[_0x4270('0x74')]};}):_0x1a3ad9[_0x4270('0x2f')]=='boolean'?[{'name':'True','value':_0x4270('0x75')},{'name':_0x4270('0x76'),'value':_0x4270('0x77')}]:[]};})};}})[_0x4270('0x26')](respondWithResult(_0x43be7f,null))['catch'](function(_0x324aa4){var _0x173192=_0x4eac82[_0x4270('0x33')][_0x4270('0x78')]?0x1f4:_0x324aa4['statusCode']||0x1f4;logger[_0x4270('0x79')](_0x4270('0x7a'),_0x4270('0x57'),_0x173192,JSON[_0x4270('0x7b')](_0x324aa4));delete _0x324aa4[_0x4270('0x29')];if(_0x173192===0x191){_0x173192=0x190;}_0x43be7f[_0x4270('0x1b')](_0x173192)[_0x4270('0x2a')](_0x4eac82[_0x4270('0x33')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x324aa4[_0x4270('0x7c')]}:_0x324aa4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index d01983f..02eb295 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 _0xe32f=['request-promise','path','rimraf','../../config/environment','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','moment','bluebird'];(function(_0x4c862c,_0x58b07f){var _0x50a68e=function(_0x2eaa9a){while(--_0x2eaa9a){_0x4c862c['push'](_0x4c862c['shift']());}};_0x50a68e(++_0x58b07f);}(_0xe32f,0x80));var _0xfe32=function(_0x18d91a,_0x59d42c){_0x18d91a=_0x18d91a-0x0;var _0x2835fd=_0xe32f[_0x18d91a];return _0x2835fd;};'use strict';var _=require(_0xfe32('0x0'));var util=require('util');var logger=require(_0xfe32('0x1'))('api');var moment=require(_0xfe32('0x2'));var BPromise=require(_0xfe32('0x3'));var rp=require(_0xfe32('0x4'));var fs=require('fs');var path=require(_0xfe32('0x5'));var rimraf=require(_0xfe32('0x6'));var config=require(_0xfe32('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xfe32('0x8')]=function(_0xc9b52c,_0x15116c){return _0xc9b52c[_0xfe32('0x9')](_0xfe32('0xa'),attributes,{'tableName':_0xfe32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce1=['api','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','SalesforceAccount','lodash','util','../../config/logger'];(function(_0x1afeda,_0x2298c3){var _0x10725d=function(_0x5e5898){while(--_0x5e5898){_0x1afeda['push'](_0x1afeda['shift']());}};_0x10725d(++_0x2298c3);}(_0x8ce1,0x97));var _0x18ce=function(_0x4a3dc4,_0x5a6b9d){_0x4a3dc4=_0x4a3dc4-0x0;var _0x36ea02=_0x8ce1[_0x4a3dc4];return _0x36ea02;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require('moment');var BPromise=require(_0x18ce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18ce('0x5'));var rimraf=require(_0x18ce('0x6'));var config=require(_0x18ce('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x18ce('0x8'));module[_0x18ce('0x9')]=function(_0x48a416,_0x4b5d84){return _0x48a416['define'](_0x18ce('0xa'),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 63f16b0..8fe9ebe 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 _0xc053=['then','ShowSalesforceAccount','find','map','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model'];(function(_0x14caf6,_0x23de34){var _0x3b0248=function(_0x13aa8d){while(--_0x13aa8d){_0x14caf6['push'](_0x14caf6['shift']());}};_0x3b0248(++_0x23de34);}(_0xc053,0x170));var _0x3c05=function(_0x3434a8,_0x5571b1){_0x3434a8=_0x3434a8-0x0;var _0x555665=_0xc053[_0x3434a8];return _0x555665;};'use strict';var _=require(_0x3c05('0x0'));var util=require(_0x3c05('0x1'));var moment=require(_0x3c05('0x2'));var BPromise=require('bluebird');var rs=require(_0x3c05('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c05('0x4'))['db'];var utils=require(_0x3c05('0x5'));var logger=require(_0x3c05('0x6'))(_0x3c05('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c05('0x8')][_0x3c05('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53b755,_0x4fe2a7,_0x200985){return new BPromise(function(_0x3972c4,_0x2479e7){return client['request'](_0x53b755,_0x200985)['then'](function(_0x2ebe69){logger[_0x3c05('0xa')](_0x3c05('0xb'),_0x4fe2a7,'request\x20sent');logger[_0x3c05('0xc')](_0x3c05('0xd'),_0x4fe2a7,'request\x20sent',JSON[_0x3c05('0xe')](_0x2ebe69));if(_0x2ebe69[_0x3c05('0xf')]){if(_0x2ebe69[_0x3c05('0xf')]['code']===0x1f4){logger[_0x3c05('0xf')](_0x3c05('0xb'),_0x4fe2a7,_0x2ebe69[_0x3c05('0xf')][_0x3c05('0x10')]);return _0x2479e7(_0x2ebe69[_0x3c05('0xf')]['message']);}logger[_0x3c05('0xf')](_0x3c05('0xb'),_0x4fe2a7,_0x2ebe69[_0x3c05('0xf')]['message']);return _0x3972c4(_0x2ebe69[_0x3c05('0xf')][_0x3c05('0x10')]);}else{logger[_0x3c05('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x4fe2a7,'request\x20sent');_0x3972c4(_0x2ebe69[_0x3c05('0x11')][_0x3c05('0x10')]);}})['catch'](function(_0x53b2a6){logger[_0x3c05('0xf')](_0x3c05('0xb'),_0x4fe2a7,_0x53b2a6);_0x2479e7(_0x53b2a6);});});}exports[_0x3c05('0x12')]=function(_0x1d2204){var _0x4021df=this;return new Promise(function(_0x5d4541,_0x5324eb){return db[_0x3c05('0x13')][_0x3c05('0x14')]({'raw':_0x1d2204[_0x3c05('0x15')]?_0x1d2204[_0x3c05('0x15')][_0x3c05('0x16')]===undefined?!![]:![]:!![],'where':_0x1d2204['options']?_0x1d2204[_0x3c05('0x15')][_0x3c05('0x17')]||null:null,'attributes':_0x1d2204[_0x3c05('0x15')]?_0x1d2204[_0x3c05('0x15')][_0x3c05('0x18')]||null:null,'limit':_0x1d2204[_0x3c05('0x15')]?_0x1d2204[_0x3c05('0x15')][_0x3c05('0x19')]||null:null,'include':_0x1d2204[_0x3c05('0x15')]?_0x1d2204[_0x3c05('0x15')][_0x3c05('0x1a')]?_['map'](_0x1d2204[_0x3c05('0x15')]['include'],function(_0x3ea83f){return{'model':db[_0x3ea83f[_0x3c05('0x1b')]],'as':_0x3ea83f['as'],'attributes':_0x3ea83f['attributes'],'include':_0x3ea83f['include']?_['map'](_0x3ea83f[_0x3c05('0x1a')],function(_0x333c9f){return{'model':db[_0x333c9f[_0x3c05('0x1b')]],'as':_0x333c9f['as'],'attributes':_0x333c9f['attributes'],'include':_0x333c9f[_0x3c05('0x1a')]?_['map'](_0x333c9f[_0x3c05('0x1a')],function(_0x4d7781){return{'model':db[_0x4d7781[_0x3c05('0x1b')]],'as':_0x4d7781['as'],'attributes':_0x4d7781['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c05('0x1c')](function(_0x218185){logger['info'](_0x3c05('0x12'),_0x1d2204);logger[_0x3c05('0xc')](_0x3c05('0x12'),_0x1d2204,JSON[_0x3c05('0xe')](_0x218185));_0x5d4541(_0x218185);})['catch'](function(_0x226ee5){logger[_0x3c05('0xf')](_0x3c05('0x12'),_0x226ee5[_0x3c05('0x10')],_0x1d2204);_0x5324eb(_0x4021df['error'](0x1f4,_0x226ee5[_0x3c05('0x10')]));});});};exports[_0x3c05('0x1d')]=function(_0x1100e4){var _0x4063a3=this;return new Promise(function(_0x30eecd,_0x56a09d){return db[_0x3c05('0x13')][_0x3c05('0x1e')]({'raw':_0x1100e4['options']?_0x1100e4[_0x3c05('0x15')][_0x3c05('0x16')]===undefined?!![]:![]:!![],'where':_0x1100e4['options']?_0x1100e4[_0x3c05('0x15')][_0x3c05('0x17')]||null:null,'attributes':_0x1100e4[_0x3c05('0x15')]?_0x1100e4[_0x3c05('0x15')]['attributes']||null:null,'include':_0x1100e4['options']?_0x1100e4[_0x3c05('0x15')][_0x3c05('0x1a')]?_[_0x3c05('0x1f')](_0x1100e4[_0x3c05('0x15')]['include'],function(_0x1e458b){return{'model':db[_0x1e458b[_0x3c05('0x1b')]],'as':_0x1e458b['as'],'attributes':_0x1e458b[_0x3c05('0x18')],'include':_0x1e458b[_0x3c05('0x1a')]?_['map'](_0x1e458b[_0x3c05('0x1a')],function(_0x140c3a){return{'model':db[_0x140c3a[_0x3c05('0x1b')]],'as':_0x140c3a['as'],'attributes':_0x140c3a[_0x3c05('0x18')],'include':_0x140c3a[_0x3c05('0x1a')]?_[_0x3c05('0x1f')](_0x140c3a[_0x3c05('0x1a')],function(_0x5c378c){return{'model':db[_0x5c378c[_0x3c05('0x1b')]],'as':_0x5c378c['as'],'attributes':_0x5c378c[_0x3c05('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3c05('0x1c')](function(_0x1370ac){logger['info'](_0x3c05('0x1d'),_0x1100e4);logger[_0x3c05('0xc')](_0x3c05('0x1d'),_0x1100e4,JSON[_0x3c05('0xe')](_0x1370ac));_0x30eecd(_0x1370ac);})[_0x3c05('0x20')](function(_0x4e948c){logger[_0x3c05('0xf')](_0x3c05('0x1d'),_0x4e948c[_0x3c05('0x10')],_0x1100e4);_0x56a09d(_0x4063a3[_0x3c05('0xf')](0x1f4,_0x4e948c[_0x3c05('0x10')]));});});}; \ No newline at end of file +var _0x4f1b=['info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','map','include','model','attributes','then','ShowSalesforceAccount','find','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4f1b,0x1e5));var _0xb4f1=function(_0x2735a6,_0xcdecb4){_0x2735a6=_0x2735a6-0x0;var _0x25c467=_0x4f1b[_0x2735a6];return _0x25c467;};'use strict';var _=require(_0xb4f1('0x0'));var util=require(_0xb4f1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb4f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb4f1('0x3'));var logger=require(_0xb4f1('0x4'))(_0xb4f1('0x5'));var config=require(_0xb4f1('0x6'));var jayson=require(_0xb4f1('0x7'));var client=jayson['client'][_0xb4f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30802f,_0x646331,_0x1072d2){return new BPromise(function(_0x144f05,_0x42d5fc){return client[_0xb4f1('0x9')](_0x30802f,_0x1072d2)['then'](function(_0x5a7b10){logger[_0xb4f1('0xa')](_0xb4f1('0xb'),_0x646331,_0xb4f1('0xc'));logger[_0xb4f1('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x646331,_0xb4f1('0xc'),JSON[_0xb4f1('0xe')](_0x5a7b10));if(_0x5a7b10['error']){if(_0x5a7b10[_0xb4f1('0xf')]['code']===0x1f4){logger[_0xb4f1('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x646331,_0x5a7b10[_0xb4f1('0xf')][_0xb4f1('0x10')]);return _0x42d5fc(_0x5a7b10[_0xb4f1('0xf')][_0xb4f1('0x10')]);}logger['error'](_0xb4f1('0xb'),_0x646331,_0x5a7b10[_0xb4f1('0xf')]['message']);return _0x144f05(_0x5a7b10[_0xb4f1('0xf')]['message']);}else{logger[_0xb4f1('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x646331,'request\x20sent');_0x144f05(_0x5a7b10[_0xb4f1('0x11')][_0xb4f1('0x10')]);}})[_0xb4f1('0x12')](function(_0x56c073){logger['error'](_0xb4f1('0xb'),_0x646331,_0x56c073);_0x42d5fc(_0x56c073);});});}exports[_0xb4f1('0x13')]=function(_0x5d6fc0){var _0x53f8a6=this;return new Promise(function(_0x226f24,_0x1ecf41){return db[_0xb4f1('0x14')][_0xb4f1('0x15')]({'raw':_0x5d6fc0[_0xb4f1('0x16')]?_0x5d6fc0[_0xb4f1('0x16')][_0xb4f1('0x17')]===undefined?!![]:![]:!![],'where':_0x5d6fc0[_0xb4f1('0x16')]?_0x5d6fc0[_0xb4f1('0x16')][_0xb4f1('0x18')]||null:null,'attributes':_0x5d6fc0['options']?_0x5d6fc0['options']['attributes']||null:null,'limit':_0x5d6fc0[_0xb4f1('0x16')]?_0x5d6fc0['options'][_0xb4f1('0x19')]||null:null,'include':_0x5d6fc0[_0xb4f1('0x16')]?_0x5d6fc0[_0xb4f1('0x16')]['include']?_[_0xb4f1('0x1a')](_0x5d6fc0[_0xb4f1('0x16')][_0xb4f1('0x1b')],function(_0x510600){return{'model':db[_0x510600[_0xb4f1('0x1c')]],'as':_0x510600['as'],'attributes':_0x510600[_0xb4f1('0x1d')],'include':_0x510600[_0xb4f1('0x1b')]?_[_0xb4f1('0x1a')](_0x510600[_0xb4f1('0x1b')],function(_0x40fac5){return{'model':db[_0x40fac5[_0xb4f1('0x1c')]],'as':_0x40fac5['as'],'attributes':_0x40fac5[_0xb4f1('0x1d')],'include':_0x40fac5[_0xb4f1('0x1b')]?_[_0xb4f1('0x1a')](_0x40fac5['include'],function(_0x17054e){return{'model':db[_0x17054e[_0xb4f1('0x1c')]],'as':_0x17054e['as'],'attributes':_0x17054e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4f1('0x1e')](function(_0x3332c2){logger[_0xb4f1('0xa')](_0xb4f1('0x13'),_0x5d6fc0);logger[_0xb4f1('0xd')](_0xb4f1('0x13'),_0x5d6fc0,JSON[_0xb4f1('0xe')](_0x3332c2));_0x226f24(_0x3332c2);})['catch'](function(_0x3cf51c){logger[_0xb4f1('0xf')](_0xb4f1('0x13'),_0x3cf51c['message'],_0x5d6fc0);_0x1ecf41(_0x53f8a6[_0xb4f1('0xf')](0x1f4,_0x3cf51c['message']));});});};exports[_0xb4f1('0x1f')]=function(_0x366cc2){var _0x22fdc4=this;return new Promise(function(_0x4a1565,_0x54b9f6){return db[_0xb4f1('0x14')][_0xb4f1('0x20')]({'raw':_0x366cc2['options']?_0x366cc2[_0xb4f1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x366cc2[_0xb4f1('0x16')]?_0x366cc2[_0xb4f1('0x16')][_0xb4f1('0x18')]||null:null,'attributes':_0x366cc2[_0xb4f1('0x16')]?_0x366cc2[_0xb4f1('0x16')][_0xb4f1('0x1d')]||null:null,'include':_0x366cc2['options']?_0x366cc2[_0xb4f1('0x16')][_0xb4f1('0x1b')]?_['map'](_0x366cc2[_0xb4f1('0x16')][_0xb4f1('0x1b')],function(_0x27613d){return{'model':db[_0x27613d['model']],'as':_0x27613d['as'],'attributes':_0x27613d[_0xb4f1('0x1d')],'include':_0x27613d[_0xb4f1('0x1b')]?_[_0xb4f1('0x1a')](_0x27613d[_0xb4f1('0x1b')],function(_0x2777f9){return{'model':db[_0x2777f9[_0xb4f1('0x1c')]],'as':_0x2777f9['as'],'attributes':_0x2777f9[_0xb4f1('0x1d')],'include':_0x2777f9[_0xb4f1('0x1b')]?_[_0xb4f1('0x1a')](_0x2777f9['include'],function(_0xa34d74){return{'model':db[_0xa34d74[_0xb4f1('0x1c')]],'as':_0xa34d74['as'],'attributes':_0xa34d74[_0xb4f1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb4f1('0x1e')](function(_0x48cae2){logger[_0xb4f1('0xa')](_0xb4f1('0x1f'),_0x366cc2);logger[_0xb4f1('0xd')](_0xb4f1('0x1f'),_0x366cc2,JSON[_0xb4f1('0xe')](_0x48cae2));_0x4a1565(_0x48cae2);})[_0xb4f1('0x12')](function(_0x1e0df0){logger[_0xb4f1('0xf')](_0xb4f1('0x1f'),_0x1e0df0[_0xb4f1('0x10')],_0x366cc2);_0x54b9f6(_0x22fdc4[_0xb4f1('0xf')](0x1f4,_0x1e0df0[_0xb4f1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9c9a4b2..469e4ee 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x476278,_0x536d36){var _0x545d7d=function(_0x392ec3){while(--_0x392ec3){_0x476278['push'](_0x476278['shift']());}};_0x545d7d(++_0x536d36);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdb28,0x106));var _0x8db2=function(_0x1f3128,_0x1d7e23){_0x1f3128=_0x1f3128-0x0;var _0x22c80c=_0xdb28[_0x1f3128];return _0x22c80c;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 7225ba4..f1c75b7 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 _0x2902=['nothing','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account'];(function(_0x1b01e8,_0x2897ec){var _0x2e3c14=function(_0x4a2c08){while(--_0x4a2c08){_0x1b01e8['push'](_0x1b01e8['shift']());}};_0x2e3c14(++_0x2897ec);}(_0x2902,0xc1));var _0x2290=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x2902[_0x3e0763];return _0x351ca2;};'use strict';var Sequelize=require(_0x2290('0x0'));module[_0x2290('0x1')]={'name':{'type':Sequelize[_0x2290('0x2')]},'description':{'type':Sequelize[_0x2290('0x2')]},'ticketType':{'type':Sequelize[_0x2290('0x3')](_0x2290('0x4'),_0x2290('0x5')),'defaultValue':_0x2290('0x4')},'moduleSearch':{'type':Sequelize[_0x2290('0x3')](_0x2290('0x6'),_0x2290('0x7'),_0x2290('0x8'),_0x2290('0x9'),_0x2290('0xa')),'defaultValue':_0x2290('0x6')},'moduleCreate':{'type':Sequelize[_0x2290('0x3')](_0x2290('0xb'),_0x2290('0x7'),_0x2290('0x8'),_0x2290('0xa')),'defaultValue':_0x2290('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x2290('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x2290('0x2')]}}; \ No newline at end of file +var _0x2300=['Task','Case','ENUM','contact_lead','contact','lead','account_contact_lead','nothing','account','sequelize','exports','STRING'];(function(_0x2f6e2a,_0x559421){var _0x3afca1=function(_0x39ea49){while(--_0x39ea49){_0x2f6e2a['push'](_0x2f6e2a['shift']());}};_0x3afca1(++_0x559421);}(_0x2300,0xb1));var _0x0230=function(_0x2d6676,_0x54e307){_0x2d6676=_0x2d6676-0x0;var _0x27419b=_0x2300[_0x2d6676];return _0x27419b;};'use strict';var Sequelize=require(_0x0230('0x0'));module[_0x0230('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0230('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x0230('0x3'),_0x0230('0x4')),'defaultValue':_0x0230('0x3')},'moduleSearch':{'type':Sequelize[_0x0230('0x5')](_0x0230('0x6'),_0x0230('0x7'),_0x0230('0x8'),_0x0230('0x9'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x0230('0x5')](_0x0230('0xa'),_0x0230('0x7'),'lead',_0x0230('0xb')),'defaultValue':_0x0230('0x8')},'leadId':{'type':Sequelize[_0x0230('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x0230('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x0230('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 43bdb3b..f394762 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 _0x2d66=['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','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','model','keys','filters','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','intersection','getFields','getSubjects','SalesforceField','getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x2f13eb,_0x1539d8){var _0x9df8ef=function(_0x4b62f9){while(--_0x4b62f9){_0x2f13eb['push'](_0x2f13eb['shift']());}};_0x9df8ef(++_0x1539d8);}(_0x2d66,0x18c));var _0x62d6=function(_0x6c36ed,_0x5a4176){_0x6c36ed=_0x6c36ed-0x0;var _0x120f72=_0x2d66[_0x6c36ed];return _0x120f72;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62d6('0x0'));var zipdir=require(_0x62d6('0x1'));var jsonpatch=require(_0x62d6('0x2'));var rp=require('request-promise');var moment=require(_0x62d6('0x3'));var BPromise=require(_0x62d6('0x4'));var Mustache=require('mustache');var util=require(_0x62d6('0x5'));var path=require(_0x62d6('0x6'));var sox=require(_0x62d6('0x7'));var csv=require(_0x62d6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62d6('0x9'));var _=require('lodash');var squel=require(_0x62d6('0xa'));var crypto=require(_0x62d6('0xb'));var jsforce=require(_0x62d6('0xc'));var deskjs=require(_0x62d6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x62d6('0xe'));var Papa=require(_0x62d6('0xf'));var Redis=require(_0x62d6('0x10'));var authService=require(_0x62d6('0x11'));var qs=require(_0x62d6('0x12'));var as=require(_0x62d6('0x13'));var hardwareService=require(_0x62d6('0x14'));var logger=require(_0x62d6('0x15'))(_0x62d6('0x16'));var utils=require('../../config/utils');var config=require(_0x62d6('0x17'));var licenseUtil=require(_0x62d6('0x18'));var db=require(_0x62d6('0x19'))['db'];function respondWithStatusCode(_0x393ee6,_0x18bb95){_0x18bb95=_0x18bb95||0xcc;return function(_0x316684){if(_0x316684){return _0x393ee6[_0x62d6('0x1a')](_0x18bb95);}return _0x393ee6[_0x62d6('0x1b')](_0x18bb95)[_0x62d6('0x1c')]();};}function respondWithResult(_0x44fa8b,_0x207f67){_0x207f67=_0x207f67||0xc8;return function(_0x5420a3){if(_0x5420a3){return _0x44fa8b[_0x62d6('0x1b')](_0x207f67)[_0x62d6('0x1d')](_0x5420a3);}};}function respondWithFilteredResult(_0x7eb493,_0x309ccb){return function(_0x1e7ff4){if(_0x1e7ff4){var _0x1af65a=typeof _0x309ccb[_0x62d6('0x1e')]===_0x62d6('0x1f')&&typeof _0x309ccb['limit']===_0x62d6('0x1f');var _0x293366=_0x1e7ff4[_0x62d6('0x20')];var _0x4d5135=_0x1af65a?0x0:_0x309ccb[_0x62d6('0x1e')];var _0x53c804=_0x1af65a?_0x1e7ff4[_0x62d6('0x20')]:_0x309ccb[_0x62d6('0x1e')]+_0x309ccb[_0x62d6('0x21')];var _0x4c3f4f;if(_0x53c804>=_0x293366){_0x53c804=_0x293366;_0x4c3f4f=0xc8;}else{_0x4c3f4f=0xce;}_0x7eb493[_0x62d6('0x1b')](_0x4c3f4f);return _0x7eb493[_0x62d6('0x22')](_0x62d6('0x23'),_0x4d5135+'-'+_0x53c804+'/'+_0x293366)['json'](_0x1e7ff4);}return null;};}function patchUpdates(_0x10a6da){return function(_0xb4653f){try{jsonpatch[_0x62d6('0x24')](_0xb4653f,_0x10a6da,!![]);}catch(_0x59b0bd){return BPromise[_0x62d6('0x25')](_0x59b0bd);}return _0xb4653f[_0x62d6('0x26')]();};}function saveUpdates(_0x287aa5,_0x25897a){return function(_0x1ee373){if(_0x1ee373){return _0x1ee373['update'](_0x287aa5)[_0x62d6('0x27')](function(_0x39034d){return _0x39034d;});}return null;};}function removeEntity(_0x1fb0b2,_0x26f80c){return function(_0x292309){if(_0x292309){return _0x292309[_0x62d6('0x28')]()[_0x62d6('0x27')](function(){_0x1fb0b2[_0x62d6('0x1b')](0xcc)[_0x62d6('0x1c')]();});}};}function handleEntityNotFound(_0x5c60e9,_0x4a160e){return function(_0x3ea920){if(!_0x3ea920){_0x5c60e9[_0x62d6('0x1a')](0x194);}return _0x3ea920;};}function handleError(_0x54935f,_0x2c895f){_0x2c895f=_0x2c895f||0x1f4;return function(_0x4ddb59){logger['error'](_0x4ddb59[_0x62d6('0x29')]);if(_0x4ddb59['name']){delete _0x4ddb59[_0x62d6('0x2a')];}_0x54935f[_0x62d6('0x1b')](_0x2c895f)[_0x62d6('0x2b')](_0x4ddb59);};}exports[_0x62d6('0x2c')]=function(_0x26ecee,_0x2609e8){var _0x3329ad={},_0x2704e4={},_0x516f6d={'count':0x0,'rows':[]};var _0x4f235e=_[_0x62d6('0x2d')](db[_0x62d6('0x2e')][_0x62d6('0x2f')],function(_0x3565b7){return{'name':_0x3565b7['fieldName'],'type':_0x3565b7[_0x62d6('0x30')]['key']};});_0x2704e4[_0x62d6('0x31')]=_['map'](_0x4f235e,'name');_0x2704e4['query']=_[_0x62d6('0x32')](_0x26ecee['query']);_0x2704e4[_0x62d6('0x33')]=_['intersection'](_0x2704e4[_0x62d6('0x31')],_0x2704e4[_0x62d6('0x34')]);_0x3329ad['attributes']=_['intersection'](_0x2704e4[_0x62d6('0x31')],qs[_0x62d6('0x35')](_0x26ecee[_0x62d6('0x34')][_0x62d6('0x35')]));_0x3329ad[_0x62d6('0x36')]=_0x3329ad['attributes'][_0x62d6('0x37')]?_0x3329ad[_0x62d6('0x36')]:_0x2704e4[_0x62d6('0x31')];if(!_0x26ecee[_0x62d6('0x34')][_0x62d6('0x38')](_0x62d6('0x39'))){_0x3329ad['limit']=qs[_0x62d6('0x21')](_0x26ecee[_0x62d6('0x34')][_0x62d6('0x21')]);_0x3329ad[_0x62d6('0x1e')]=qs['offset'](_0x26ecee[_0x62d6('0x34')]['offset']);}_0x3329ad[_0x62d6('0x3a')]=qs['sort'](_0x26ecee[_0x62d6('0x34')][_0x62d6('0x3b')]);_0x3329ad[_0x62d6('0x3c')]=qs[_0x62d6('0x33')](_[_0x62d6('0x3d')](_0x26ecee[_0x62d6('0x34')],_0x2704e4[_0x62d6('0x33')]),_0x4f235e);if(_0x26ecee['query'][_0x62d6('0x3e')]){_0x3329ad[_0x62d6('0x3c')]=_[_0x62d6('0x3f')](_0x3329ad[_0x62d6('0x3c')],{'$or':_[_0x62d6('0x2d')](_0x4f235e,function(_0x3281ee){if(_0x3281ee['type']!==_0x62d6('0x40')){var _0x137f45={};_0x137f45[_0x3281ee[_0x62d6('0x2a')]]={'$like':'%'+_0x26ecee[_0x62d6('0x34')][_0x62d6('0x3e')]+'%'};return _0x137f45;}})});}_0x3329ad=_[_0x62d6('0x3f')]({},_0x3329ad,_0x26ecee[_0x62d6('0x41')]);var _0x49b5c1={'where':_0x3329ad[_0x62d6('0x3c')]};return db[_0x62d6('0x2e')][_0x62d6('0x20')](_0x49b5c1)[_0x62d6('0x27')](function(_0x40d118){_0x516f6d[_0x62d6('0x20')]=_0x40d118;if(_0x26ecee[_0x62d6('0x34')][_0x62d6('0x42')]){_0x3329ad[_0x62d6('0x43')]=[{'all':!![]}];}return db[_0x62d6('0x2e')][_0x62d6('0x44')](_0x3329ad);})[_0x62d6('0x27')](function(_0x46f5b2){_0x516f6d[_0x62d6('0x45')]=_0x46f5b2;return _0x516f6d;})[_0x62d6('0x27')](respondWithFilteredResult(_0x2609e8,_0x3329ad))[_0x62d6('0x46')](handleError(_0x2609e8,null));};exports[_0x62d6('0x47')]=function(_0xad9878,_0x34fc68){var _0x58a4a5={'raw':![],'where':{'id':_0xad9878['params']['id']}},_0x58d93d={};_0x58d93d[_0x62d6('0x31')]=_['keys'](db[_0x62d6('0x2e')]['rawAttributes']);_0x58d93d[_0x62d6('0x34')]=_['keys'](_0xad9878[_0x62d6('0x34')]);_0x58d93d[_0x62d6('0x33')]=_['intersection'](_0x58d93d[_0x62d6('0x31')],_0x58d93d[_0x62d6('0x34')]);_0x58a4a5[_0x62d6('0x36')]=_['intersection'](_0x58d93d['model'],qs[_0x62d6('0x35')](_0xad9878['query'][_0x62d6('0x35')]));_0x58a4a5['attributes']=_0x58a4a5['attributes'][_0x62d6('0x37')]?_0x58a4a5['attributes']:_0x58d93d[_0x62d6('0x31')];if(_0xad9878['query'][_0x62d6('0x42')]){_0x58a4a5[_0x62d6('0x43')]=[{'all':!![]}];}_0x58a4a5=_[_0x62d6('0x3f')]({},_0x58a4a5,_0xad9878[_0x62d6('0x41')]);return db['SalesforceConfiguration'][_0x62d6('0x48')](_0x58a4a5)[_0x62d6('0x27')](handleEntityNotFound(_0x34fc68,null))[_0x62d6('0x27')](respondWithResult(_0x34fc68,null))[_0x62d6('0x46')](handleError(_0x34fc68,null));};exports[_0x62d6('0x49')]=function(_0x57aae1,_0x2b86fc){return db[_0x62d6('0x2e')][_0x62d6('0x49')](_0x57aae1[_0x62d6('0x4a')],{})['then'](respondWithResult(_0x2b86fc,0xc9))['catch'](handleError(_0x2b86fc,null));};exports['update']=function(_0xbfc3f,_0x73e8b5){if(_0xbfc3f['body']['id']){delete _0xbfc3f[_0x62d6('0x4a')]['id'];}return db[_0x62d6('0x2e')][_0x62d6('0x48')]({'where':{'id':_0xbfc3f[_0x62d6('0x4b')]['id']}})[_0x62d6('0x27')](handleEntityNotFound(_0x73e8b5,null))[_0x62d6('0x27')](saveUpdates(_0xbfc3f[_0x62d6('0x4a')],null))[_0x62d6('0x27')](respondWithResult(_0x73e8b5,null))[_0x62d6('0x46')](handleError(_0x73e8b5,null));};exports[_0x62d6('0x28')]=function(_0x31c64c,_0x494ba2){return db['SalesforceConfiguration'][_0x62d6('0x48')]({'where':{'id':_0x31c64c[_0x62d6('0x4b')]['id']}})[_0x62d6('0x27')](handleEntityNotFound(_0x494ba2,null))[_0x62d6('0x27')](removeEntity(_0x494ba2,null))[_0x62d6('0x46')](handleError(_0x494ba2,null));};exports['getFields']=function(_0xb2d6a1,_0x298add,_0x1e5c4d){var _0x244dae={};var _0x313f16={};var _0x56440c;var _0x656fe8;return db[_0x62d6('0x2e')]['findOne']({'where':{'id':_0xb2d6a1[_0x62d6('0x4b')]['id']}})[_0x62d6('0x27')](handleEntityNotFound(_0x298add,null))[_0x62d6('0x27')](function(_0x488747){if(_0x488747){_0x56440c=_0x488747;_0x313f16[_0x62d6('0x31')]=_[_0x62d6('0x32')](db['SalesforceField']['rawAttributes']);_0x313f16[_0x62d6('0x34')]=_['keys'](_0xb2d6a1[_0x62d6('0x34')]);_0x313f16['filters']=_[_0x62d6('0x4c')](_0x313f16[_0x62d6('0x31')],_0x313f16[_0x62d6('0x34')]);_0x244dae[_0x62d6('0x36')]=_['intersection'](_0x313f16[_0x62d6('0x31')],qs[_0x62d6('0x35')](_0xb2d6a1[_0x62d6('0x34')][_0x62d6('0x35')]));_0x244dae[_0x62d6('0x36')]=_0x244dae[_0x62d6('0x36')][_0x62d6('0x37')]?_0x244dae[_0x62d6('0x36')]:_0x313f16[_0x62d6('0x31')];_0x244dae[_0x62d6('0x3a')]=qs['sort'](_0xb2d6a1[_0x62d6('0x34')][_0x62d6('0x3b')]);_0x244dae['where']=qs[_0x62d6('0x33')](_['pick'](_0xb2d6a1[_0x62d6('0x34')],_0x313f16['filters']));if(_0xb2d6a1[_0x62d6('0x34')]['filter']){_0x244dae[_0x62d6('0x3c')]=_['merge'](_0x244dae[_0x62d6('0x3c')],{'$or':_[_0x62d6('0x2d')](_0x244dae[_0x62d6('0x36')],function(_0xb3f9e6){var _0x5b0644={};_0x5b0644[_0xb3f9e6]={'$like':'%'+_0xb2d6a1[_0x62d6('0x34')][_0x62d6('0x3e')]+'%'};return _0x5b0644;})});}_0x244dae=_[_0x62d6('0x3f')]({},_0x244dae,_0xb2d6a1[_0x62d6('0x41')]);return _0x56440c[_0x62d6('0x4d')](_0x244dae);}})[_0x62d6('0x27')](function(_0x5ad586){if(_0x5ad586){_0x656fe8=_0x5ad586[_0x62d6('0x37')];if(!_0xb2d6a1[_0x62d6('0x34')]['hasOwnProperty'](_0x62d6('0x39'))){_0x244dae[_0x62d6('0x21')]=qs[_0x62d6('0x21')](_0xb2d6a1[_0x62d6('0x34')]['limit']);_0x244dae[_0x62d6('0x1e')]=qs['offset'](_0xb2d6a1[_0x62d6('0x34')][_0x62d6('0x1e')]);}return _0x56440c[_0x62d6('0x4d')](_0x244dae);}})[_0x62d6('0x27')](function(_0x3e7a94){if(_0x3e7a94){return _0x3e7a94?{'count':_0x656fe8,'rows':_0x3e7a94}:null;}})[_0x62d6('0x27')](respondWithResult(_0x298add,null))['catch'](handleError(_0x298add,null));};exports[_0x62d6('0x4e')]=function(_0x480ea1,_0x482531,_0x1e38f8){var _0x161177={};var _0x13647a={};var _0xb08f0f;var _0x3a8838;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x480ea1[_0x62d6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x482531,null))[_0x62d6('0x27')](function(_0x5b0075){if(_0x5b0075){_0xb08f0f=_0x5b0075;_0x13647a[_0x62d6('0x31')]=_['keys'](db[_0x62d6('0x4f')][_0x62d6('0x2f')]);_0x13647a[_0x62d6('0x34')]=_[_0x62d6('0x32')](_0x480ea1[_0x62d6('0x34')]);_0x13647a[_0x62d6('0x33')]=_['intersection'](_0x13647a['model'],_0x13647a[_0x62d6('0x34')]);_0x161177[_0x62d6('0x36')]=_[_0x62d6('0x4c')](_0x13647a['model'],qs[_0x62d6('0x35')](_0x480ea1[_0x62d6('0x34')][_0x62d6('0x35')]));_0x161177['attributes']=_0x161177[_0x62d6('0x36')][_0x62d6('0x37')]?_0x161177[_0x62d6('0x36')]:_0x13647a[_0x62d6('0x31')];_0x161177[_0x62d6('0x3a')]=qs[_0x62d6('0x3b')](_0x480ea1[_0x62d6('0x34')][_0x62d6('0x3b')]);_0x161177['where']=qs[_0x62d6('0x33')](_['pick'](_0x480ea1[_0x62d6('0x34')],_0x13647a[_0x62d6('0x33')]));if(_0x480ea1[_0x62d6('0x34')][_0x62d6('0x3e')]){_0x161177[_0x62d6('0x3c')]=_[_0x62d6('0x3f')](_0x161177[_0x62d6('0x3c')],{'$or':_[_0x62d6('0x2d')](_0x161177[_0x62d6('0x36')],function(_0x2874bd){var _0x34037a={};_0x34037a[_0x2874bd]={'$like':'%'+_0x480ea1[_0x62d6('0x34')][_0x62d6('0x3e')]+'%'};return _0x34037a;})});}_0x161177=_[_0x62d6('0x3f')]({},_0x161177,_0x480ea1['options']);return _0xb08f0f['getSubjects'](_0x161177);}})[_0x62d6('0x27')](function(_0x5e24b3){if(_0x5e24b3){_0x3a8838=_0x5e24b3[_0x62d6('0x37')];if(!_0x480ea1[_0x62d6('0x34')][_0x62d6('0x38')]('nolimit')){_0x161177[_0x62d6('0x21')]=qs['limit'](_0x480ea1[_0x62d6('0x34')][_0x62d6('0x21')]);_0x161177[_0x62d6('0x1e')]=qs[_0x62d6('0x1e')](_0x480ea1['query'][_0x62d6('0x1e')]);}return _0xb08f0f[_0x62d6('0x4e')](_0x161177);}})['then'](function(_0x2945a2){if(_0x2945a2){return _0x2945a2?{'count':_0x3a8838,'rows':_0x2945a2}:null;}})[_0x62d6('0x27')](respondWithResult(_0x482531,null))['catch'](handleError(_0x482531,null));};exports[_0x62d6('0x50')]=function(_0x2d91ea,_0x9b0a1e,_0x47f8b7){var _0x841b31={};var _0x1f92d3={};var _0x14e52f;var _0x5a42ac;return db['SalesforceConfiguration'][_0x62d6('0x51')]({'where':{'id':_0x2d91ea['params']['id']}})['then'](handleEntityNotFound(_0x9b0a1e,null))[_0x62d6('0x27')](function(_0x3190ac){if(_0x3190ac){_0x14e52f=_0x3190ac;_0x1f92d3['model']=_[_0x62d6('0x32')](db[_0x62d6('0x4f')]['rawAttributes']);_0x1f92d3[_0x62d6('0x34')]=_['keys'](_0x2d91ea[_0x62d6('0x34')]);_0x1f92d3[_0x62d6('0x33')]=_[_0x62d6('0x4c')](_0x1f92d3[_0x62d6('0x31')],_0x1f92d3[_0x62d6('0x34')]);_0x841b31[_0x62d6('0x36')]=_[_0x62d6('0x4c')](_0x1f92d3[_0x62d6('0x31')],qs[_0x62d6('0x35')](_0x2d91ea[_0x62d6('0x34')][_0x62d6('0x35')]));_0x841b31[_0x62d6('0x36')]=_0x841b31[_0x62d6('0x36')][_0x62d6('0x37')]?_0x841b31[_0x62d6('0x36')]:_0x1f92d3[_0x62d6('0x31')];_0x841b31[_0x62d6('0x3a')]=qs[_0x62d6('0x3b')](_0x2d91ea[_0x62d6('0x34')][_0x62d6('0x3b')]);_0x841b31[_0x62d6('0x3c')]=qs['filters'](_[_0x62d6('0x3d')](_0x2d91ea['query'],_0x1f92d3[_0x62d6('0x33')]));if(_0x2d91ea[_0x62d6('0x34')]['filter']){_0x841b31[_0x62d6('0x3c')]=_[_0x62d6('0x3f')](_0x841b31[_0x62d6('0x3c')],{'$or':_[_0x62d6('0x2d')](_0x841b31[_0x62d6('0x36')],function(_0x532531){var _0x3a9f7b={};_0x3a9f7b[_0x532531]={'$like':'%'+_0x2d91ea[_0x62d6('0x34')][_0x62d6('0x3e')]+'%'};return _0x3a9f7b;})});}_0x841b31=_['merge']({},_0x841b31,_0x2d91ea[_0x62d6('0x41')]);return _0x14e52f[_0x62d6('0x50')](_0x841b31);}})[_0x62d6('0x27')](function(_0x2bbee8){if(_0x2bbee8){_0x5a42ac=_0x2bbee8['length'];if(!_0x2d91ea[_0x62d6('0x34')][_0x62d6('0x38')](_0x62d6('0x39'))){_0x841b31['limit']=qs[_0x62d6('0x21')](_0x2d91ea[_0x62d6('0x34')][_0x62d6('0x21')]);_0x841b31[_0x62d6('0x1e')]=qs[_0x62d6('0x1e')](_0x2d91ea['query'][_0x62d6('0x1e')]);}return _0x14e52f[_0x62d6('0x50')](_0x841b31);}})['then'](function(_0x5d178a){if(_0x5d178a){return _0x5d178a?{'count':_0x5a42ac,'rows':_0x5d178a}:null;}})[_0x62d6('0x27')](respondWithResult(_0x9b0a1e,null))[_0x62d6('0x46')](handleError(_0x9b0a1e,null));}; \ No newline at end of file +var _0xa74a=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','options','count','includeAll','include','rows','catch','find','create','body','params','getFields','findOne','sort','pick','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','save','update','then','name','send','map','SalesforceConfiguration','rawAttributes','type','model','query','keys'];(function(_0x2a4506,_0x4a7113){var _0x3d3518=function(_0x95c77e){while(--_0x95c77e){_0x2a4506['push'](_0x2a4506['shift']());}};_0x3d3518(++_0x4a7113);}(_0xa74a,0x66));var _0xaa74=function(_0x3994c2,_0x3efb77){_0x3994c2=_0x3994c2-0x0;var _0x4cd709=_0xa74a[_0x3994c2];return _0x4cd709;};'use strict';var emlformat=require(_0xaa74('0x0'));var rimraf=require(_0xaa74('0x1'));var zipdir=require(_0xaa74('0x2'));var jsonpatch=require(_0xaa74('0x3'));var rp=require(_0xaa74('0x4'));var moment=require(_0xaa74('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaa74('0x6'));var util=require(_0xaa74('0x7'));var path=require(_0xaa74('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaa74('0x9'));var fs=require('fs');var fs_extra=require(_0xaa74('0xa'));var _=require(_0xaa74('0xb'));var squel=require(_0xaa74('0xc'));var crypto=require(_0xaa74('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa74('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaa74('0xf'));var Papa=require('papaparse');var Redis=require(_0xaa74('0x10'));var authService=require(_0xaa74('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaa74('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa74('0x13'))(_0xaa74('0x14'));var utils=require('../../config/utils');var config=require(_0xaa74('0x15'));var licenseUtil=require(_0xaa74('0x16'));var db=require(_0xaa74('0x17'))['db'];function respondWithStatusCode(_0x1abe28,_0x1455ab){_0x1455ab=_0x1455ab||0xcc;return function(_0x1f68a4){if(_0x1f68a4){return _0x1abe28[_0xaa74('0x18')](_0x1455ab);}return _0x1abe28[_0xaa74('0x19')](_0x1455ab)[_0xaa74('0x1a')]();};}function respondWithResult(_0x222c99,_0xbd140c){_0xbd140c=_0xbd140c||0xc8;return function(_0x4e2f4a){if(_0x4e2f4a){return _0x222c99[_0xaa74('0x19')](_0xbd140c)[_0xaa74('0x1b')](_0x4e2f4a);}};}function respondWithFilteredResult(_0x545064,_0x3185f4){return function(_0x587a89){if(_0x587a89){var _0x513a8b=typeof _0x3185f4['offset']==='undefined'&&typeof _0x3185f4[_0xaa74('0x1c')]===_0xaa74('0x1d');var _0x3d9b94=_0x587a89['count'];var _0x1c81ef=_0x513a8b?0x0:_0x3185f4[_0xaa74('0x1e')];var _0xe1c07d=_0x513a8b?_0x587a89['count']:_0x3185f4['offset']+_0x3185f4['limit'];var _0x59751f;if(_0xe1c07d>=_0x3d9b94){_0xe1c07d=_0x3d9b94;_0x59751f=0xc8;}else{_0x59751f=0xce;}_0x545064[_0xaa74('0x19')](_0x59751f);return _0x545064[_0xaa74('0x1f')](_0xaa74('0x20'),_0x1c81ef+'-'+_0xe1c07d+'/'+_0x3d9b94)[_0xaa74('0x1b')](_0x587a89);}return null;};}function patchUpdates(_0xcfc5ba){return function(_0x2b1d10){try{jsonpatch[_0xaa74('0x21')](_0x2b1d10,_0xcfc5ba,!![]);}catch(_0x106a19){return BPromise['reject'](_0x106a19);}return _0x2b1d10[_0xaa74('0x22')]();};}function saveUpdates(_0x18f54c,_0x99721e){return function(_0x34f649){if(_0x34f649){return _0x34f649[_0xaa74('0x23')](_0x18f54c)[_0xaa74('0x24')](function(_0x40a60a){return _0x40a60a;});}return null;};}function removeEntity(_0x8aae9a,_0x2f284f){return function(_0x20ca32){if(_0x20ca32){return _0x20ca32['destroy']()[_0xaa74('0x24')](function(){_0x8aae9a[_0xaa74('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f87d6,_0x4920a8){return function(_0x44c2f7){if(!_0x44c2f7){_0x2f87d6[_0xaa74('0x18')](0x194);}return _0x44c2f7;};}function handleError(_0x5971ee,_0x1361d6){_0x1361d6=_0x1361d6||0x1f4;return function(_0x393a1f){logger['error'](_0x393a1f['stack']);if(_0x393a1f[_0xaa74('0x25')]){delete _0x393a1f['name'];}_0x5971ee[_0xaa74('0x19')](_0x1361d6)[_0xaa74('0x26')](_0x393a1f);};}exports['index']=function(_0x40bc29,_0x2eb111){var _0x4d6130={},_0x58e640={},_0x34c982={'count':0x0,'rows':[]};var _0x2d1dd1=_[_0xaa74('0x27')](db[_0xaa74('0x28')][_0xaa74('0x29')],function(_0x25e24f){return{'name':_0x25e24f['fieldName'],'type':_0x25e24f[_0xaa74('0x2a')]['key']};});_0x58e640[_0xaa74('0x2b')]=_['map'](_0x2d1dd1,_0xaa74('0x25'));_0x58e640[_0xaa74('0x2c')]=_[_0xaa74('0x2d')](_0x40bc29[_0xaa74('0x2c')]);_0x58e640['filters']=_[_0xaa74('0x2e')](_0x58e640['model'],_0x58e640[_0xaa74('0x2c')]);_0x4d6130['attributes']=_[_0xaa74('0x2e')](_0x58e640['model'],qs[_0xaa74('0x2f')](_0x40bc29['query'][_0xaa74('0x2f')]));_0x4d6130['attributes']=_0x4d6130[_0xaa74('0x30')][_0xaa74('0x31')]?_0x4d6130[_0xaa74('0x30')]:_0x58e640['model'];if(!_0x40bc29[_0xaa74('0x2c')][_0xaa74('0x32')](_0xaa74('0x33'))){_0x4d6130[_0xaa74('0x1c')]=qs['limit'](_0x40bc29[_0xaa74('0x2c')][_0xaa74('0x1c')]);_0x4d6130['offset']=qs[_0xaa74('0x1e')](_0x40bc29[_0xaa74('0x2c')]['offset']);}_0x4d6130[_0xaa74('0x34')]=qs['sort'](_0x40bc29[_0xaa74('0x2c')]['sort']);_0x4d6130[_0xaa74('0x35')]=qs[_0xaa74('0x36')](_['pick'](_0x40bc29[_0xaa74('0x2c')],_0x58e640['filters']),_0x2d1dd1);if(_0x40bc29[_0xaa74('0x2c')][_0xaa74('0x37')]){_0x4d6130['where']=_[_0xaa74('0x38')](_0x4d6130[_0xaa74('0x35')],{'$or':_[_0xaa74('0x27')](_0x2d1dd1,function(_0x145e8c){if(_0x145e8c[_0xaa74('0x2a')]!=='VIRTUAL'){var _0x469fe9={};_0x469fe9[_0x145e8c[_0xaa74('0x25')]]={'$like':'%'+_0x40bc29[_0xaa74('0x2c')][_0xaa74('0x37')]+'%'};return _0x469fe9;}})});}_0x4d6130=_[_0xaa74('0x38')]({},_0x4d6130,_0x40bc29[_0xaa74('0x39')]);var _0x4efdf2={'where':_0x4d6130[_0xaa74('0x35')]};return db[_0xaa74('0x28')][_0xaa74('0x3a')](_0x4efdf2)[_0xaa74('0x24')](function(_0x1882e7){_0x34c982[_0xaa74('0x3a')]=_0x1882e7;if(_0x40bc29['query'][_0xaa74('0x3b')]){_0x4d6130[_0xaa74('0x3c')]=[{'all':!![]}];}return db[_0xaa74('0x28')]['findAll'](_0x4d6130);})[_0xaa74('0x24')](function(_0x90ebf7){_0x34c982[_0xaa74('0x3d')]=_0x90ebf7;return _0x34c982;})['then'](respondWithFilteredResult(_0x2eb111,_0x4d6130))[_0xaa74('0x3e')](handleError(_0x2eb111,null));};exports['show']=function(_0x151d2a,_0x5f1df5){var _0x4a7891={'raw':![],'where':{'id':_0x151d2a['params']['id']}},_0x5009b2={};_0x5009b2[_0xaa74('0x2b')]=_[_0xaa74('0x2d')](db[_0xaa74('0x28')][_0xaa74('0x29')]);_0x5009b2['query']=_[_0xaa74('0x2d')](_0x151d2a[_0xaa74('0x2c')]);_0x5009b2[_0xaa74('0x36')]=_[_0xaa74('0x2e')](_0x5009b2[_0xaa74('0x2b')],_0x5009b2['query']);_0x4a7891[_0xaa74('0x30')]=_[_0xaa74('0x2e')](_0x5009b2['model'],qs[_0xaa74('0x2f')](_0x151d2a['query'][_0xaa74('0x2f')]));_0x4a7891[_0xaa74('0x30')]=_0x4a7891['attributes'][_0xaa74('0x31')]?_0x4a7891[_0xaa74('0x30')]:_0x5009b2[_0xaa74('0x2b')];if(_0x151d2a[_0xaa74('0x2c')][_0xaa74('0x3b')]){_0x4a7891[_0xaa74('0x3c')]=[{'all':!![]}];}_0x4a7891=_['merge']({},_0x4a7891,_0x151d2a[_0xaa74('0x39')]);return db[_0xaa74('0x28')][_0xaa74('0x3f')](_0x4a7891)['then'](handleEntityNotFound(_0x5f1df5,null))[_0xaa74('0x24')](respondWithResult(_0x5f1df5,null))[_0xaa74('0x3e')](handleError(_0x5f1df5,null));};exports[_0xaa74('0x40')]=function(_0x5aa277,_0x764c14){return db['SalesforceConfiguration'][_0xaa74('0x40')](_0x5aa277[_0xaa74('0x41')],{})['then'](respondWithResult(_0x764c14,0xc9))[_0xaa74('0x3e')](handleError(_0x764c14,null));};exports[_0xaa74('0x23')]=function(_0x28c34c,_0x2f8254){if(_0x28c34c[_0xaa74('0x41')]['id']){delete _0x28c34c[_0xaa74('0x41')]['id'];}return db[_0xaa74('0x28')][_0xaa74('0x3f')]({'where':{'id':_0x28c34c['params']['id']}})['then'](handleEntityNotFound(_0x2f8254,null))[_0xaa74('0x24')](saveUpdates(_0x28c34c[_0xaa74('0x41')],null))[_0xaa74('0x24')](respondWithResult(_0x2f8254,null))['catch'](handleError(_0x2f8254,null));};exports['destroy']=function(_0x59bae3,_0x12bc97){return db[_0xaa74('0x28')][_0xaa74('0x3f')]({'where':{'id':_0x59bae3[_0xaa74('0x42')]['id']}})['then'](handleEntityNotFound(_0x12bc97,null))['then'](removeEntity(_0x12bc97,null))['catch'](handleError(_0x12bc97,null));};exports[_0xaa74('0x43')]=function(_0x161ed5,_0x17025f,_0x5a43cb){var _0x52205f={};var _0x262914={};var _0x38ab13;var _0x2b6884;return db[_0xaa74('0x28')][_0xaa74('0x44')]({'where':{'id':_0x161ed5['params']['id']}})[_0xaa74('0x24')](handleEntityNotFound(_0x17025f,null))[_0xaa74('0x24')](function(_0x242be9){if(_0x242be9){_0x38ab13=_0x242be9;_0x262914['model']=_[_0xaa74('0x2d')](db['SalesforceField']['rawAttributes']);_0x262914['query']=_[_0xaa74('0x2d')](_0x161ed5[_0xaa74('0x2c')]);_0x262914['filters']=_['intersection'](_0x262914[_0xaa74('0x2b')],_0x262914[_0xaa74('0x2c')]);_0x52205f[_0xaa74('0x30')]=_[_0xaa74('0x2e')](_0x262914[_0xaa74('0x2b')],qs[_0xaa74('0x2f')](_0x161ed5[_0xaa74('0x2c')][_0xaa74('0x2f')]));_0x52205f[_0xaa74('0x30')]=_0x52205f[_0xaa74('0x30')][_0xaa74('0x31')]?_0x52205f[_0xaa74('0x30')]:_0x262914[_0xaa74('0x2b')];_0x52205f[_0xaa74('0x34')]=qs['sort'](_0x161ed5[_0xaa74('0x2c')][_0xaa74('0x45')]);_0x52205f[_0xaa74('0x35')]=qs[_0xaa74('0x36')](_[_0xaa74('0x46')](_0x161ed5[_0xaa74('0x2c')],_0x262914[_0xaa74('0x36')]));if(_0x161ed5['query'][_0xaa74('0x37')]){_0x52205f['where']=_[_0xaa74('0x38')](_0x52205f[_0xaa74('0x35')],{'$or':_[_0xaa74('0x27')](_0x52205f[_0xaa74('0x30')],function(_0x5a8e9a){var _0x898033={};_0x898033[_0x5a8e9a]={'$like':'%'+_0x161ed5['query'][_0xaa74('0x37')]+'%'};return _0x898033;})});}_0x52205f=_[_0xaa74('0x38')]({},_0x52205f,_0x161ed5[_0xaa74('0x39')]);return _0x38ab13[_0xaa74('0x43')](_0x52205f);}})[_0xaa74('0x24')](function(_0x98ec1b){if(_0x98ec1b){_0x2b6884=_0x98ec1b['length'];if(!_0x161ed5[_0xaa74('0x2c')][_0xaa74('0x32')]('nolimit')){_0x52205f[_0xaa74('0x1c')]=qs['limit'](_0x161ed5[_0xaa74('0x2c')][_0xaa74('0x1c')]);_0x52205f[_0xaa74('0x1e')]=qs['offset'](_0x161ed5[_0xaa74('0x2c')]['offset']);}return _0x38ab13[_0xaa74('0x43')](_0x52205f);}})[_0xaa74('0x24')](function(_0x44b824){if(_0x44b824){return _0x44b824?{'count':_0x2b6884,'rows':_0x44b824}:null;}})[_0xaa74('0x24')](respondWithResult(_0x17025f,null))[_0xaa74('0x3e')](handleError(_0x17025f,null));};exports[_0xaa74('0x47')]=function(_0xf533b1,_0x269d8f,_0x21676e){var _0x511dae={};var _0x3fff6d={};var _0x42b388;var _0x438966;return db[_0xaa74('0x28')]['findOne']({'where':{'id':_0xf533b1[_0xaa74('0x42')]['id']}})[_0xaa74('0x24')](handleEntityNotFound(_0x269d8f,null))['then'](function(_0x4af754){if(_0x4af754){_0x42b388=_0x4af754;_0x3fff6d['model']=_[_0xaa74('0x2d')](db[_0xaa74('0x48')][_0xaa74('0x29')]);_0x3fff6d[_0xaa74('0x2c')]=_[_0xaa74('0x2d')](_0xf533b1['query']);_0x3fff6d['filters']=_['intersection'](_0x3fff6d[_0xaa74('0x2b')],_0x3fff6d[_0xaa74('0x2c')]);_0x511dae[_0xaa74('0x30')]=_[_0xaa74('0x2e')](_0x3fff6d[_0xaa74('0x2b')],qs[_0xaa74('0x2f')](_0xf533b1[_0xaa74('0x2c')]['fields']));_0x511dae['attributes']=_0x511dae[_0xaa74('0x30')]['length']?_0x511dae[_0xaa74('0x30')]:_0x3fff6d[_0xaa74('0x2b')];_0x511dae[_0xaa74('0x34')]=qs[_0xaa74('0x45')](_0xf533b1[_0xaa74('0x2c')][_0xaa74('0x45')]);_0x511dae[_0xaa74('0x35')]=qs[_0xaa74('0x36')](_[_0xaa74('0x46')](_0xf533b1['query'],_0x3fff6d[_0xaa74('0x36')]));if(_0xf533b1[_0xaa74('0x2c')]['filter']){_0x511dae[_0xaa74('0x35')]=_[_0xaa74('0x38')](_0x511dae['where'],{'$or':_[_0xaa74('0x27')](_0x511dae[_0xaa74('0x30')],function(_0xe6323b){var _0x17058d={};_0x17058d[_0xe6323b]={'$like':'%'+_0xf533b1['query'][_0xaa74('0x37')]+'%'};return _0x17058d;})});}_0x511dae=_['merge']({},_0x511dae,_0xf533b1[_0xaa74('0x39')]);return _0x42b388[_0xaa74('0x47')](_0x511dae);}})[_0xaa74('0x24')](function(_0x44d8b9){if(_0x44d8b9){_0x438966=_0x44d8b9[_0xaa74('0x31')];if(!_0xf533b1[_0xaa74('0x2c')][_0xaa74('0x32')]('nolimit')){_0x511dae[_0xaa74('0x1c')]=qs[_0xaa74('0x1c')](_0xf533b1[_0xaa74('0x2c')][_0xaa74('0x1c')]);_0x511dae[_0xaa74('0x1e')]=qs['offset'](_0xf533b1[_0xaa74('0x2c')][_0xaa74('0x1e')]);}return _0x42b388['getSubjects'](_0x511dae);}})[_0xaa74('0x24')](function(_0x316ae0){if(_0x316ae0){return _0x316ae0?{'count':_0x438966,'rows':_0x316ae0}:null;}})[_0xaa74('0x24')](respondWithResult(_0x269d8f,null))[_0xaa74('0x3e')](handleError(_0x269d8f,null));};exports[_0xaa74('0x49')]=function(_0x5535d6,_0x32cf32,_0x9d88c4){var _0x537c2a={};var _0x4c5ad3={};var _0x3a7796;var _0x4c6574;return db[_0xaa74('0x28')][_0xaa74('0x44')]({'where':{'id':_0x5535d6['params']['id']}})['then'](handleEntityNotFound(_0x32cf32,null))[_0xaa74('0x24')](function(_0x1e08c9){if(_0x1e08c9){_0x3a7796=_0x1e08c9;_0x4c5ad3[_0xaa74('0x2b')]=_[_0xaa74('0x2d')](db['SalesforceField'][_0xaa74('0x29')]);_0x4c5ad3[_0xaa74('0x2c')]=_[_0xaa74('0x2d')](_0x5535d6['query']);_0x4c5ad3[_0xaa74('0x36')]=_['intersection'](_0x4c5ad3[_0xaa74('0x2b')],_0x4c5ad3[_0xaa74('0x2c')]);_0x537c2a[_0xaa74('0x30')]=_['intersection'](_0x4c5ad3[_0xaa74('0x2b')],qs[_0xaa74('0x2f')](_0x5535d6[_0xaa74('0x2c')][_0xaa74('0x2f')]));_0x537c2a[_0xaa74('0x30')]=_0x537c2a[_0xaa74('0x30')][_0xaa74('0x31')]?_0x537c2a['attributes']:_0x4c5ad3[_0xaa74('0x2b')];_0x537c2a['order']=qs[_0xaa74('0x45')](_0x5535d6[_0xaa74('0x2c')][_0xaa74('0x45')]);_0x537c2a[_0xaa74('0x35')]=qs[_0xaa74('0x36')](_[_0xaa74('0x46')](_0x5535d6[_0xaa74('0x2c')],_0x4c5ad3[_0xaa74('0x36')]));if(_0x5535d6[_0xaa74('0x2c')][_0xaa74('0x37')]){_0x537c2a[_0xaa74('0x35')]=_[_0xaa74('0x38')](_0x537c2a[_0xaa74('0x35')],{'$or':_[_0xaa74('0x27')](_0x537c2a['attributes'],function(_0x423536){var _0x49bcc4={};_0x49bcc4[_0x423536]={'$like':'%'+_0x5535d6[_0xaa74('0x2c')]['filter']+'%'};return _0x49bcc4;})});}_0x537c2a=_[_0xaa74('0x38')]({},_0x537c2a,_0x5535d6[_0xaa74('0x39')]);return _0x3a7796[_0xaa74('0x49')](_0x537c2a);}})[_0xaa74('0x24')](function(_0x273946){if(_0x273946){_0x4c6574=_0x273946[_0xaa74('0x31')];if(!_0x5535d6[_0xaa74('0x2c')]['hasOwnProperty']('nolimit')){_0x537c2a['limit']=qs[_0xaa74('0x1c')](_0x5535d6[_0xaa74('0x2c')]['limit']);_0x537c2a[_0xaa74('0x1e')]=qs[_0xaa74('0x1e')](_0x5535d6['query'][_0xaa74('0x1e')]);}return _0x3a7796[_0xaa74('0x49')](_0x537c2a);}})['then'](function(_0x3b628d){if(_0x3b628d){return _0x3b628d?{'count':_0x4c6574,'rows':_0x3b628d}:null;}})[_0xaa74('0x24')](respondWithResult(_0x32cf32,null))[_0xaa74('0x3e')](handleError(_0x32cf32,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 85b84b4..4851121 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 _0x0d40=['moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','api'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x0d40,0x8d));var _0x00d4=function(_0x24b1ea,_0x642a66){_0x24b1ea=_0x24b1ea-0x0;var _0x1eb3b0=_0x0d40[_0x24b1ea];return _0x1eb3b0;};'use strict';var _=require(_0x00d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x00d4('0x1'));var moment=require(_0x00d4('0x2'));var BPromise=require(_0x00d4('0x3'));var rp=require(_0x00d4('0x4'));var fs=require('fs');var path=require(_0x00d4('0x5'));var rimraf=require('rimraf');var config=require(_0x00d4('0x6'));var attributes=require(_0x00d4('0x7'));module[_0x00d4('0x8')]=function(_0x649d79,_0x40298a){return _0x649d79[_0x00d4('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x00d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cb8=['exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes'];(function(_0x698c61,_0x5e6a2a){var _0x294b64=function(_0x10c615){while(--_0x10c615){_0x698c61['push'](_0x698c61['shift']());}};_0x294b64(++_0x5e6a2a);}(_0x3cb8,0xba));var _0x83cb=function(_0x5da3e0,_0x5419db){_0x5da3e0=_0x5da3e0-0x0;var _0x1b0a9b=_0x3cb8[_0x5da3e0];return _0x1b0a9b;};'use strict';var _=require(_0x83cb('0x0'));var util=require(_0x83cb('0x1'));var logger=require(_0x83cb('0x2'))(_0x83cb('0x3'));var moment=require('moment');var BPromise=require(_0x83cb('0x4'));var rp=require(_0x83cb('0x5'));var fs=require('fs');var path=require(_0x83cb('0x6'));var rimraf=require(_0x83cb('0x7'));var config=require('../../config/environment');var attributes=require(_0x83cb('0x8'));module[_0x83cb('0x9')]=function(_0x395eec,_0x541916){return _0x395eec[_0x83cb('0xa')](_0x83cb('0xb'),attributes,{'tableName':_0x83cb('0xc'),'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 cf3d81e..5f6d0d2 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 _0x5ecf=['rpc','../../config/environment','client','then','info','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x392357,_0x1ffd71){var _0x57c7dd=function(_0x28efcf){while(--_0x28efcf){_0x392357['push'](_0x392357['shift']());}};_0x57c7dd(++_0x1ffd71);}(_0x5ecf,0x11e));var _0xf5ec=function(_0x269a37,_0x2415c5){_0x269a37=_0x269a37-0x0;var _0x1448f1=_0x5ecf[_0x269a37];return _0x1448f1;};'use strict';var _=require(_0xf5ec('0x0'));var util=require(_0xf5ec('0x1'));var moment=require(_0xf5ec('0x2'));var BPromise=require(_0xf5ec('0x3'));var rs=require(_0xf5ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5ec('0x5'))['db'];var utils=require(_0xf5ec('0x6'));var logger=require(_0xf5ec('0x7'))(_0xf5ec('0x8'));var config=require(_0xf5ec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf5ec('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c8025,_0x58536e,_0x10d1d){return new BPromise(function(_0x2e9d4c,_0x4f16ac){return client['request'](_0x3c8025,_0x10d1d)[_0xf5ec('0xb')](function(_0xc53431){logger[_0xf5ec('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x58536e,'request\x20sent');logger['debug'](_0xf5ec('0xd'),_0x58536e,'request\x20sent',JSON[_0xf5ec('0xe')](_0xc53431));if(_0xc53431[_0xf5ec('0xf')]){if(_0xc53431['error']['code']===0x1f4){logger[_0xf5ec('0xf')](_0xf5ec('0x10'),_0x58536e,_0xc53431[_0xf5ec('0xf')][_0xf5ec('0x11')]);return _0x4f16ac(_0xc53431[_0xf5ec('0xf')][_0xf5ec('0x11')]);}logger['error'](_0xf5ec('0x10'),_0x58536e,_0xc53431[_0xf5ec('0xf')][_0xf5ec('0x11')]);return _0x2e9d4c(_0xc53431[_0xf5ec('0xf')][_0xf5ec('0x11')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x58536e,_0xf5ec('0x12'));_0x2e9d4c(_0xc53431[_0xf5ec('0x13')][_0xf5ec('0x11')]);}})[_0xf5ec('0x14')](function(_0x255c1b){logger[_0xf5ec('0xf')](_0xf5ec('0x10'),_0x58536e,_0x255c1b);_0x4f16ac(_0x255c1b);});});} \ No newline at end of file +var _0x312a=['error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3c3d59,_0x369b04){var _0x25d467=function(_0x991667){while(--_0x991667){_0x3c3d59['push'](_0x3c3d59['shift']());}};_0x25d467(++_0x369b04);}(_0x312a,0x12a));var _0xa312=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x312a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa312('0x0'));var moment=require(_0xa312('0x1'));var BPromise=require(_0xa312('0x2'));var rs=require(_0xa312('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa312('0x4'))['db'];var utils=require(_0xa312('0x5'));var logger=require(_0xa312('0x6'))('rpc');var config=require(_0xa312('0x7'));var jayson=require(_0xa312('0x8'));var client=jayson[_0xa312('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13fd1f,_0x3967ed,_0x1ae5bb){return new BPromise(function(_0x11a21a,_0x28a044){return client['request'](_0x13fd1f,_0x1ae5bb)[_0xa312('0xa')](function(_0x11d4ce){logger[_0xa312('0xb')](_0xa312('0xc'),_0x3967ed,'request\x20sent');logger[_0xa312('0xd')](_0xa312('0xe'),_0x3967ed,_0xa312('0xf'),JSON[_0xa312('0x10')](_0x11d4ce));if(_0x11d4ce['error']){if(_0x11d4ce[_0xa312('0x11')]['code']===0x1f4){logger['error'](_0xa312('0xc'),_0x3967ed,_0x11d4ce[_0xa312('0x11')][_0xa312('0x12')]);return _0x28a044(_0x11d4ce[_0xa312('0x11')]['message']);}logger[_0xa312('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3967ed,_0x11d4ce['error'][_0xa312('0x12')]);return _0x11a21a(_0x11d4ce[_0xa312('0x11')][_0xa312('0x12')]);}else{logger[_0xa312('0xb')](_0xa312('0xc'),_0x3967ed,'request\x20sent');_0x11a21a(_0x11d4ce[_0xa312('0x13')][_0xa312('0x12')]);}})[_0xa312('0x14')](function(_0x28f05c){logger[_0xa312('0x11')](_0xa312('0xc'),_0x3967ed,_0x28f05c);_0x28a044(_0x28f05c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index d67baba..a1855a0 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 _0x6e94=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6e94,0x1a9));var _0x46e9=function(_0x57ec17,_0x5cd112){_0x57ec17=_0x57ec17-0x0;var _0x7933b9=_0x6e94[_0x57ec17];return _0x7933b9;};'use strict';var multer=require(_0x46e9('0x0'));var util=require(_0x46e9('0x1'));var path=require(_0x46e9('0x2'));var timeout=require(_0x46e9('0x3'));var express=require(_0x46e9('0x4'));var router=express[_0x46e9('0x5')]();var fs_extra=require(_0x46e9('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x46e9('0x7'));var controller=require('./intSalesforceField.controller');router[_0x46e9('0x8')]('/',auth[_0x46e9('0x9')](),controller[_0x46e9('0xa')]);router[_0x46e9('0x8')](_0x46e9('0xb'),auth[_0x46e9('0x9')](),controller[_0x46e9('0xc')]);router[_0x46e9('0xd')]('/',auth[_0x46e9('0x9')](),controller[_0x46e9('0xe')]);router['put'](_0x46e9('0xb'),auth['isAuthenticated'](),controller[_0x46e9('0xf')]);router[_0x46e9('0x10')]('/:id',auth[_0x46e9('0x9')](),controller[_0x46e9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8718=['update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x305b1c,_0x50c0f0){var _0x4389c7=function(_0x3986b1){while(--_0x3986b1){_0x305b1c['push'](_0x305b1c['shift']());}};_0x4389c7(++_0x50c0f0);}(_0x8718,0x178));var _0x8871=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x8718[_0x695b76];return _0x1dc21f;};'use strict';var multer=require(_0x8871('0x0'));var util=require(_0x8871('0x1'));var path=require('path');var timeout=require(_0x8871('0x2'));var express=require('express');var router=express[_0x8871('0x3')]();var fs_extra=require(_0x8871('0x4'));var auth=require(_0x8871('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8871('0x6'));var controller=require(_0x8871('0x7'));router[_0x8871('0x8')]('/',auth[_0x8871('0x9')](),controller[_0x8871('0xa')]);router[_0x8871('0x8')](_0x8871('0xb'),auth[_0x8871('0x9')](),controller['show']);router[_0x8871('0xc')]('/',auth['isAuthenticated'](),controller[_0x8871('0xd')]);router[_0x8871('0xe')](_0x8871('0xb'),auth[_0x8871('0x9')](),controller[_0x8871('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8871('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 296ba60..e84b1ef 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 _0x1a92=['variable','customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM'];(function(_0x48d00f,_0xc344c6){var _0x527ffa=function(_0x469548){while(--_0x469548){_0x48d00f['push'](_0x48d00f['shift']());}};_0x527ffa(++_0xc344c6);}(_0x1a92,0xba));var _0x21a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a92[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x21a9('0x0'));module[_0x21a9('0x1')]={'type':{'type':Sequelize[_0x21a9('0x2')]('string',_0x21a9('0x3'),_0x21a9('0x4'),_0x21a9('0x5'),_0x21a9('0x6')),'defaultValue':_0x21a9('0x7')},'content':{'type':Sequelize[_0x21a9('0x8')]},'key':{'type':Sequelize[_0x21a9('0x8')]},'keyType':{'type':Sequelize[_0x21a9('0x2')](_0x21a9('0x7'),'variable',_0x21a9('0x4'))},'keyContent':{'type':Sequelize[_0x21a9('0x8')]},'idField':{'type':Sequelize[_0x21a9('0x8')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf50a=['string','variable','customVariable','picklist','STRING','sequelize','exports','ENUM'];(function(_0x3ad71e,_0x3ba1b2){var _0x2d55dc=function(_0x41ad71){while(--_0x41ad71){_0x3ad71e['push'](_0x3ad71e['shift']());}};_0x2d55dc(++_0x3ba1b2);}(_0xf50a,0x175));var _0xaf50=function(_0x30780e,_0x537b34){_0x30780e=_0x30780e-0x0;var _0x5b9129=_0xf50a[_0x30780e];return _0x5b9129;};'use strict';var Sequelize=require(_0xaf50('0x0'));module[_0xaf50('0x1')]={'type':{'type':Sequelize[_0xaf50('0x2')](_0xaf50('0x3'),_0xaf50('0x4'),_0xaf50('0x5'),'keyValue',_0xaf50('0x6')),'defaultValue':_0xaf50('0x3')},'content':{'type':Sequelize[_0xaf50('0x7')]},'key':{'type':Sequelize[_0xaf50('0x7')]},'keyType':{'type':Sequelize[_0xaf50('0x2')]('string',_0xaf50('0x4'),_0xaf50('0x5'))},'keyContent':{'type':Sequelize[_0xaf50('0x7')]},'idField':{'type':Sequelize[_0xaf50('0x7')]},'variableName':{'type':Sequelize[_0xaf50('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6650340..403ac9f 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 _0x14b4=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','order','sort','where','filters','filter','merge','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14b4,0x8b));var _0x414b=function(_0xd26500,_0xfa64ae){_0xd26500=_0xd26500-0x0;var _0x16cdba=_0x14b4[_0xd26500];return _0x16cdba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x414b('0x0'));var jsonpatch=require(_0x414b('0x1'));var rp=require(_0x414b('0x2'));var moment=require('moment');var BPromise=require(_0x414b('0x3'));var Mustache=require(_0x414b('0x4'));var util=require(_0x414b('0x5'));var path=require('path');var sox=require(_0x414b('0x6'));var csv=require(_0x414b('0x7'));var ejs=require(_0x414b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x414b('0x9'));var squel=require(_0x414b('0xa'));var crypto=require(_0x414b('0xb'));var jsforce=require(_0x414b('0xc'));var deskjs=require(_0x414b('0xd'));var toCsv=require(_0x414b('0x7'));var querystring=require('querystring');var Papa=require(_0x414b('0xe'));var Redis=require(_0x414b('0xf'));var authService=require(_0x414b('0x10'));var qs=require(_0x414b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x414b('0x12'));var logger=require(_0x414b('0x13'))(_0x414b('0x14'));var utils=require(_0x414b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x414b('0x16'));var db=require(_0x414b('0x17'))['db'];function respondWithStatusCode(_0x41a76c,_0x36d033){_0x36d033=_0x36d033||0xcc;return function(_0x37b242){if(_0x37b242){return _0x41a76c[_0x414b('0x18')](_0x36d033);}return _0x41a76c[_0x414b('0x19')](_0x36d033)[_0x414b('0x1a')]();};}function respondWithResult(_0x1e3452,_0x163bc9){_0x163bc9=_0x163bc9||0xc8;return function(_0x2bd6b3){if(_0x2bd6b3){return _0x1e3452[_0x414b('0x19')](_0x163bc9)[_0x414b('0x1b')](_0x2bd6b3);}};}function respondWithFilteredResult(_0x39c4d7,_0x45f93c){return function(_0x4b072e){if(_0x4b072e){var _0x5e0a18=typeof _0x45f93c['offset']===_0x414b('0x1c')&&typeof _0x45f93c[_0x414b('0x1d')]===_0x414b('0x1c');var _0x2bb787=_0x4b072e[_0x414b('0x1e')];var _0xce1b57=_0x5e0a18?0x0:_0x45f93c[_0x414b('0x1f')];var _0x383f04=_0x5e0a18?_0x4b072e[_0x414b('0x1e')]:_0x45f93c['offset']+_0x45f93c[_0x414b('0x1d')];var _0x59a5d6;if(_0x383f04>=_0x2bb787){_0x383f04=_0x2bb787;_0x59a5d6=0xc8;}else{_0x59a5d6=0xce;}_0x39c4d7[_0x414b('0x19')](_0x59a5d6);return _0x39c4d7[_0x414b('0x20')](_0x414b('0x21'),_0xce1b57+'-'+_0x383f04+'/'+_0x2bb787)[_0x414b('0x1b')](_0x4b072e);}return null;};}function patchUpdates(_0x4ee659){return function(_0x4254cd){try{jsonpatch['apply'](_0x4254cd,_0x4ee659,!![]);}catch(_0x270e42){return BPromise['reject'](_0x270e42);}return _0x4254cd[_0x414b('0x22')]();};}function saveUpdates(_0x5c6704,_0x34023e){return function(_0x42625d){if(_0x42625d){return _0x42625d[_0x414b('0x23')](_0x5c6704)[_0x414b('0x24')](function(_0x9acd46){return _0x9acd46;});}return null;};}function removeEntity(_0x3b5099,_0x5b3de5){return function(_0x3a6731){if(_0x3a6731){return _0x3a6731['destroy']()[_0x414b('0x24')](function(){_0x3b5099[_0x414b('0x19')](0xcc)[_0x414b('0x1a')]();});}};}function handleEntityNotFound(_0x5177ed,_0x400e1a){return function(_0xfb3182){if(!_0xfb3182){_0x5177ed[_0x414b('0x18')](0x194);}return _0xfb3182;};}function handleError(_0x3c097a,_0x1c8d81){_0x1c8d81=_0x1c8d81||0x1f4;return function(_0x16dc32){logger[_0x414b('0x25')](_0x16dc32['stack']);if(_0x16dc32[_0x414b('0x26')]){delete _0x16dc32[_0x414b('0x26')];}_0x3c097a[_0x414b('0x19')](_0x1c8d81)[_0x414b('0x27')](_0x16dc32);};}exports[_0x414b('0x28')]=function(_0x4d08da,_0x119633){var _0x380603={},_0x1d7d7e={},_0x388639={'count':0x0,'rows':[]};var _0x59f538=_[_0x414b('0x29')](db[_0x414b('0x2a')][_0x414b('0x2b')],function(_0x268985){return{'name':_0x268985[_0x414b('0x2c')],'type':_0x268985[_0x414b('0x2d')][_0x414b('0x2e')]};});_0x1d7d7e[_0x414b('0x2f')]=_['map'](_0x59f538,_0x414b('0x26'));_0x1d7d7e[_0x414b('0x30')]=_[_0x414b('0x31')](_0x4d08da[_0x414b('0x30')]);_0x1d7d7e['filters']=_['intersection'](_0x1d7d7e[_0x414b('0x2f')],_0x1d7d7e[_0x414b('0x30')]);_0x380603[_0x414b('0x32')]=_[_0x414b('0x33')](_0x1d7d7e[_0x414b('0x2f')],qs[_0x414b('0x34')](_0x4d08da[_0x414b('0x30')][_0x414b('0x34')]));_0x380603[_0x414b('0x32')]=_0x380603[_0x414b('0x32')][_0x414b('0x35')]?_0x380603['attributes']:_0x1d7d7e[_0x414b('0x2f')];if(!_0x4d08da[_0x414b('0x30')]['hasOwnProperty']('nolimit')){_0x380603[_0x414b('0x1d')]=qs[_0x414b('0x1d')](_0x4d08da['query'][_0x414b('0x1d')]);_0x380603[_0x414b('0x1f')]=qs[_0x414b('0x1f')](_0x4d08da[_0x414b('0x30')][_0x414b('0x1f')]);}_0x380603[_0x414b('0x36')]=qs[_0x414b('0x37')](_0x4d08da[_0x414b('0x30')]['sort']);_0x380603[_0x414b('0x38')]=qs[_0x414b('0x39')](_['pick'](_0x4d08da[_0x414b('0x30')],_0x1d7d7e[_0x414b('0x39')]),_0x59f538);if(_0x4d08da[_0x414b('0x30')][_0x414b('0x3a')]){_0x380603[_0x414b('0x38')]=_[_0x414b('0x3b')](_0x380603[_0x414b('0x38')],{'$or':_[_0x414b('0x29')](_0x59f538,function(_0x1066c9){if(_0x1066c9[_0x414b('0x2d')]!=='VIRTUAL'){var _0x392f5d={};_0x392f5d[_0x1066c9['name']]={'$like':'%'+_0x4d08da[_0x414b('0x30')][_0x414b('0x3a')]+'%'};return _0x392f5d;}})});}_0x380603=_[_0x414b('0x3b')]({},_0x380603,_0x4d08da['options']);var _0x137668={'where':_0x380603[_0x414b('0x38')]};return db[_0x414b('0x2a')][_0x414b('0x1e')](_0x137668)[_0x414b('0x24')](function(_0x156652){_0x388639[_0x414b('0x1e')]=_0x156652;if(_0x4d08da[_0x414b('0x30')][_0x414b('0x3c')]){_0x380603['include']=[{'all':!![]}];}return db[_0x414b('0x2a')][_0x414b('0x3d')](_0x380603);})[_0x414b('0x24')](function(_0x49a803){_0x388639[_0x414b('0x3e')]=_0x49a803;return _0x388639;})[_0x414b('0x24')](respondWithFilteredResult(_0x119633,_0x380603))[_0x414b('0x3f')](handleError(_0x119633,null));};exports[_0x414b('0x40')]=function(_0x3fa62e,_0x4fea54){var _0x3ec8f1={'raw':!![],'where':{'id':_0x3fa62e['params']['id']}},_0xb8165f={};_0xb8165f[_0x414b('0x2f')]=_[_0x414b('0x31')](db[_0x414b('0x2a')][_0x414b('0x2b')]);_0xb8165f[_0x414b('0x30')]=_[_0x414b('0x31')](_0x3fa62e[_0x414b('0x30')]);_0xb8165f['filters']=_[_0x414b('0x33')](_0xb8165f[_0x414b('0x2f')],_0xb8165f['query']);_0x3ec8f1[_0x414b('0x32')]=_[_0x414b('0x33')](_0xb8165f[_0x414b('0x2f')],qs[_0x414b('0x34')](_0x3fa62e[_0x414b('0x30')][_0x414b('0x34')]));_0x3ec8f1[_0x414b('0x32')]=_0x3ec8f1['attributes'][_0x414b('0x35')]?_0x3ec8f1['attributes']:_0xb8165f['model'];if(_0x3fa62e[_0x414b('0x30')]['includeAll']){_0x3ec8f1[_0x414b('0x41')]=[{'all':!![]}];}_0x3ec8f1=_[_0x414b('0x3b')]({},_0x3ec8f1,_0x3fa62e[_0x414b('0x42')]);return db[_0x414b('0x2a')][_0x414b('0x43')](_0x3ec8f1)[_0x414b('0x24')](handleEntityNotFound(_0x4fea54,null))[_0x414b('0x24')](respondWithResult(_0x4fea54,null))[_0x414b('0x3f')](handleError(_0x4fea54,null));};exports[_0x414b('0x44')]=function(_0x15aede,_0x3be1c9){return db[_0x414b('0x2a')][_0x414b('0x44')](_0x15aede[_0x414b('0x45')],{})[_0x414b('0x24')](respondWithResult(_0x3be1c9,0xc9))[_0x414b('0x3f')](handleError(_0x3be1c9,null));};exports[_0x414b('0x23')]=function(_0x5c5d07,_0x5bc7a7){if(_0x5c5d07[_0x414b('0x45')]['id']){delete _0x5c5d07[_0x414b('0x45')]['id'];}return db[_0x414b('0x2a')][_0x414b('0x43')]({'where':{'id':_0x5c5d07[_0x414b('0x46')]['id']}})[_0x414b('0x24')](handleEntityNotFound(_0x5bc7a7,null))['then'](saveUpdates(_0x5c5d07[_0x414b('0x45')],null))['then'](respondWithResult(_0x5bc7a7,null))[_0x414b('0x3f')](handleError(_0x5bc7a7,null));};exports['destroy']=function(_0x25e223,_0x51391a){return db[_0x414b('0x2a')]['find']({'where':{'id':_0x25e223[_0x414b('0x46')]['id']}})[_0x414b('0x24')](handleEntityNotFound(_0x51391a,null))[_0x414b('0x24')](removeEntity(_0x51391a,null))[_0x414b('0x3f')](handleError(_0x51391a,null));}; \ No newline at end of file +var _0x9a5f=['length','nolimit','order','sort','where','filter','merge','type','count','includeAll','include','findAll','rows','catch','options','create','body','params','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','update','then','destroy','end','sendStatus','error','name','send','index','SalesforceField','fieldName','map','query','keys','filters','intersection','model','attributes','fields'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x9a5f,0x95));var _0xf9a5=function(_0x29ab8e,_0x67c0c1){_0x29ab8e=_0x29ab8e-0x0;var _0xc602a3=_0x9a5f[_0x29ab8e];return _0xc602a3;};'use strict';var emlformat=require(_0xf9a5('0x0'));var rimraf=require(_0xf9a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf9a5('0x2'));var rp=require(_0xf9a5('0x3'));var moment=require(_0xf9a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf9a5('0x5'));var util=require('util');var path=require(_0xf9a5('0x6'));var sox=require('sox');var csv=require(_0xf9a5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf9a5('0x8'));var _=require(_0xf9a5('0x9'));var squel=require(_0xf9a5('0xa'));var crypto=require(_0xf9a5('0xb'));var jsforce=require(_0xf9a5('0xc'));var deskjs=require(_0xf9a5('0xd'));var toCsv=require(_0xf9a5('0x7'));var querystring=require(_0xf9a5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf9a5('0xf'));var qs=require(_0xf9a5('0x10'));var as=require(_0xf9a5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf9a5('0x12'))(_0xf9a5('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf9a5('0x14'));var db=require(_0xf9a5('0x15'))['db'];function respondWithStatusCode(_0x5e2c34,_0x5f44b7){_0x5f44b7=_0x5f44b7||0xcc;return function(_0x386b58){if(_0x386b58){return _0x5e2c34['sendStatus'](_0x5f44b7);}return _0x5e2c34[_0xf9a5('0x16')](_0x5f44b7)['end']();};}function respondWithResult(_0x4da1fa,_0x3bcfa1){_0x3bcfa1=_0x3bcfa1||0xc8;return function(_0x47ef48){if(_0x47ef48){return _0x4da1fa[_0xf9a5('0x16')](_0x3bcfa1)[_0xf9a5('0x17')](_0x47ef48);}};}function respondWithFilteredResult(_0x372ed5,_0x3c419a){return function(_0x2c74a2){if(_0x2c74a2){var _0x5f369=typeof _0x3c419a[_0xf9a5('0x18')]==='undefined'&&typeof _0x3c419a[_0xf9a5('0x19')]===_0xf9a5('0x1a');var _0x1124eb=_0x2c74a2['count'];var _0x4a4c1f=_0x5f369?0x0:_0x3c419a['offset'];var _0x1aa1bd=_0x5f369?_0x2c74a2['count']:_0x3c419a[_0xf9a5('0x18')]+_0x3c419a['limit'];var _0x2a50d2;if(_0x1aa1bd>=_0x1124eb){_0x1aa1bd=_0x1124eb;_0x2a50d2=0xc8;}else{_0x2a50d2=0xce;}_0x372ed5[_0xf9a5('0x16')](_0x2a50d2);return _0x372ed5['set']('Content-Range',_0x4a4c1f+'-'+_0x1aa1bd+'/'+_0x1124eb)[_0xf9a5('0x17')](_0x2c74a2);}return null;};}function patchUpdates(_0x1bc800){return function(_0x91c942){try{jsonpatch['apply'](_0x91c942,_0x1bc800,!![]);}catch(_0x3dc7cf){return BPromise['reject'](_0x3dc7cf);}return _0x91c942['save']();};}function saveUpdates(_0x26064a,_0x391d78){return function(_0x46d75b){if(_0x46d75b){return _0x46d75b[_0xf9a5('0x1b')](_0x26064a)[_0xf9a5('0x1c')](function(_0x13fa54){return _0x13fa54;});}return null;};}function removeEntity(_0x57b6f3,_0x4328d6){return function(_0x52c7d1){if(_0x52c7d1){return _0x52c7d1[_0xf9a5('0x1d')]()[_0xf9a5('0x1c')](function(){_0x57b6f3[_0xf9a5('0x16')](0xcc)[_0xf9a5('0x1e')]();});}};}function handleEntityNotFound(_0x20079a,_0x532285){return function(_0xd06568){if(!_0xd06568){_0x20079a[_0xf9a5('0x1f')](0x194);}return _0xd06568;};}function handleError(_0x1a71aa,_0x2a798c){_0x2a798c=_0x2a798c||0x1f4;return function(_0x4ab10f){logger[_0xf9a5('0x20')](_0x4ab10f['stack']);if(_0x4ab10f[_0xf9a5('0x21')]){delete _0x4ab10f[_0xf9a5('0x21')];}_0x1a71aa[_0xf9a5('0x16')](_0x2a798c)[_0xf9a5('0x22')](_0x4ab10f);};}exports[_0xf9a5('0x23')]=function(_0x4caaae,_0x448b11){var _0x48183c={},_0x31c162={},_0x58a427={'count':0x0,'rows':[]};var _0x45532e=_['map'](db[_0xf9a5('0x24')]['rawAttributes'],function(_0x146e52){return{'name':_0x146e52[_0xf9a5('0x25')],'type':_0x146e52['type']['key']};});_0x31c162['model']=_[_0xf9a5('0x26')](_0x45532e,_0xf9a5('0x21'));_0x31c162[_0xf9a5('0x27')]=_[_0xf9a5('0x28')](_0x4caaae[_0xf9a5('0x27')]);_0x31c162[_0xf9a5('0x29')]=_[_0xf9a5('0x2a')](_0x31c162[_0xf9a5('0x2b')],_0x31c162['query']);_0x48183c[_0xf9a5('0x2c')]=_[_0xf9a5('0x2a')](_0x31c162[_0xf9a5('0x2b')],qs[_0xf9a5('0x2d')](_0x4caaae[_0xf9a5('0x27')][_0xf9a5('0x2d')]));_0x48183c['attributes']=_0x48183c[_0xf9a5('0x2c')][_0xf9a5('0x2e')]?_0x48183c['attributes']:_0x31c162[_0xf9a5('0x2b')];if(!_0x4caaae[_0xf9a5('0x27')]['hasOwnProperty'](_0xf9a5('0x2f'))){_0x48183c[_0xf9a5('0x19')]=qs[_0xf9a5('0x19')](_0x4caaae[_0xf9a5('0x27')]['limit']);_0x48183c[_0xf9a5('0x18')]=qs[_0xf9a5('0x18')](_0x4caaae[_0xf9a5('0x27')][_0xf9a5('0x18')]);}_0x48183c[_0xf9a5('0x30')]=qs['sort'](_0x4caaae['query'][_0xf9a5('0x31')]);_0x48183c[_0xf9a5('0x32')]=qs[_0xf9a5('0x29')](_['pick'](_0x4caaae['query'],_0x31c162[_0xf9a5('0x29')]),_0x45532e);if(_0x4caaae[_0xf9a5('0x27')][_0xf9a5('0x33')]){_0x48183c[_0xf9a5('0x32')]=_[_0xf9a5('0x34')](_0x48183c['where'],{'$or':_[_0xf9a5('0x26')](_0x45532e,function(_0x12fc7d){if(_0x12fc7d[_0xf9a5('0x35')]!=='VIRTUAL'){var _0x2d4a8b={};_0x2d4a8b[_0x12fc7d['name']]={'$like':'%'+_0x4caaae[_0xf9a5('0x27')][_0xf9a5('0x33')]+'%'};return _0x2d4a8b;}})});}_0x48183c=_[_0xf9a5('0x34')]({},_0x48183c,_0x4caaae['options']);var _0x2d731d={'where':_0x48183c[_0xf9a5('0x32')]};return db[_0xf9a5('0x24')][_0xf9a5('0x36')](_0x2d731d)[_0xf9a5('0x1c')](function(_0x4d3138){_0x58a427['count']=_0x4d3138;if(_0x4caaae[_0xf9a5('0x27')][_0xf9a5('0x37')]){_0x48183c[_0xf9a5('0x38')]=[{'all':!![]}];}return db['SalesforceField'][_0xf9a5('0x39')](_0x48183c);})['then'](function(_0x48ab9f){_0x58a427[_0xf9a5('0x3a')]=_0x48ab9f;return _0x58a427;})[_0xf9a5('0x1c')](respondWithFilteredResult(_0x448b11,_0x48183c))[_0xf9a5('0x3b')](handleError(_0x448b11,null));};exports['show']=function(_0x2ac67d,_0x232aaf){var _0x1c0ec6={'raw':!![],'where':{'id':_0x2ac67d['params']['id']}},_0x2bae99={};_0x2bae99[_0xf9a5('0x2b')]=_[_0xf9a5('0x28')](db[_0xf9a5('0x24')]['rawAttributes']);_0x2bae99[_0xf9a5('0x27')]=_['keys'](_0x2ac67d[_0xf9a5('0x27')]);_0x2bae99[_0xf9a5('0x29')]=_[_0xf9a5('0x2a')](_0x2bae99[_0xf9a5('0x2b')],_0x2bae99['query']);_0x1c0ec6[_0xf9a5('0x2c')]=_['intersection'](_0x2bae99[_0xf9a5('0x2b')],qs[_0xf9a5('0x2d')](_0x2ac67d[_0xf9a5('0x27')]['fields']));_0x1c0ec6[_0xf9a5('0x2c')]=_0x1c0ec6[_0xf9a5('0x2c')][_0xf9a5('0x2e')]?_0x1c0ec6['attributes']:_0x2bae99[_0xf9a5('0x2b')];if(_0x2ac67d[_0xf9a5('0x27')][_0xf9a5('0x37')]){_0x1c0ec6[_0xf9a5('0x38')]=[{'all':!![]}];}_0x1c0ec6=_[_0xf9a5('0x34')]({},_0x1c0ec6,_0x2ac67d[_0xf9a5('0x3c')]);return db[_0xf9a5('0x24')]['find'](_0x1c0ec6)[_0xf9a5('0x1c')](handleEntityNotFound(_0x232aaf,null))[_0xf9a5('0x1c')](respondWithResult(_0x232aaf,null))[_0xf9a5('0x3b')](handleError(_0x232aaf,null));};exports['create']=function(_0x3e4f50,_0x802331){return db[_0xf9a5('0x24')][_0xf9a5('0x3d')](_0x3e4f50[_0xf9a5('0x3e')],{})['then'](respondWithResult(_0x802331,0xc9))[_0xf9a5('0x3b')](handleError(_0x802331,null));};exports[_0xf9a5('0x1b')]=function(_0x384e0b,_0x5afbdf){if(_0x384e0b[_0xf9a5('0x3e')]['id']){delete _0x384e0b[_0xf9a5('0x3e')]['id'];}return db[_0xf9a5('0x24')]['find']({'where':{'id':_0x384e0b[_0xf9a5('0x3f')]['id']}})[_0xf9a5('0x1c')](handleEntityNotFound(_0x5afbdf,null))[_0xf9a5('0x1c')](saveUpdates(_0x384e0b[_0xf9a5('0x3e')],null))[_0xf9a5('0x1c')](respondWithResult(_0x5afbdf,null))[_0xf9a5('0x3b')](handleError(_0x5afbdf,null));};exports['destroy']=function(_0x3813cb,_0x5ca1a0){return db[_0xf9a5('0x24')][_0xf9a5('0x40')]({'where':{'id':_0x3813cb['params']['id']}})['then'](handleEntityNotFound(_0x5ca1a0,null))[_0xf9a5('0x1c')](removeEntity(_0x5ca1a0,null))['catch'](handleError(_0x5ca1a0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 2324c43..0fe8743 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 _0x5ba8=['SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x3de1a6,_0x500005){var _0xa747b5=function(_0x3a5aaf){while(--_0x3a5aaf){_0x3de1a6['push'](_0x3de1a6['shift']());}};_0xa747b5(++_0x500005);}(_0x5ba8,0x115));var _0x85ba=function(_0x46f5a7,_0x5ad6a4){_0x46f5a7=_0x46f5a7-0x0;var _0x3108f0=_0x5ba8[_0x46f5a7];return _0x3108f0;};'use strict';var _=require(_0x85ba('0x0'));var util=require(_0x85ba('0x1'));var logger=require(_0x85ba('0x2'))('api');var moment=require(_0x85ba('0x3'));var BPromise=require(_0x85ba('0x4'));var rp=require(_0x85ba('0x5'));var fs=require('fs');var path=require(_0x85ba('0x6'));var rimraf=require(_0x85ba('0x7'));var config=require(_0x85ba('0x8'));var attributes=require(_0x85ba('0x9'));module[_0x85ba('0xa')]=function(_0x4b759a,_0x2adcb7){return _0x4b759a['define'](_0x85ba('0xb'),attributes,{'tableName':_0x85ba('0xc'),'paranoid':![],'indexes':[{'name':_0x85ba('0xd'),'fields':[_0x85ba('0xe'),_0x85ba('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0934=['FieldId','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports','define','SalesforceField','salesforce_unique_index','idField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0934,0x187));var _0x4093=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x0934[_0x1fc84d];return _0x2658fa;};'use strict';var _=require(_0x4093('0x0'));var util=require(_0x4093('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4093('0x2'));var BPromise=require(_0x4093('0x3'));var rp=require(_0x4093('0x4'));var fs=require('fs');var path=require(_0x4093('0x5'));var rimraf=require('rimraf');var config=require(_0x4093('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0x4093('0x7')]=function(_0x482eb3,_0x59bdc1){return _0x482eb3[_0x4093('0x8')](_0x4093('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x4093('0xa'),'fields':[_0x4093('0xb'),_0x4093('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index a47f2db..8e2a02a 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 _0xd225=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x47645e,_0x3418b4){var _0x4d7399=function(_0x863c50){while(--_0x863c50){_0x47645e['push'](_0x47645e['shift']());}};_0x4d7399(++_0x3418b4);}(_0xd225,0x181));var _0x5d22=function(_0x2bf10a,_0x4e9c77){_0x2bf10a=_0x2bf10a-0x0;var _0x5aa870=_0xd225[_0x2bf10a];return _0x5aa870;};'use strict';var _=require(_0x5d22('0x0'));var util=require(_0x5d22('0x1'));var moment=require('moment');var BPromise=require(_0x5d22('0x2'));var rs=require(_0x5d22('0x3'));var fs=require('fs');var Redis=require(_0x5d22('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d22('0x5'));var logger=require(_0x5d22('0x6'))(_0x5d22('0x7'));var config=require(_0x5d22('0x8'));var jayson=require(_0x5d22('0x9'));var client=jayson[_0x5d22('0xa')][_0x5d22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe7ee6c,_0x5bdc0d,_0x2f197d){return new BPromise(function(_0xceee82,_0x430ccc){return client['request'](_0xe7ee6c,_0x2f197d)[_0x5d22('0xc')](function(_0x2b4186){logger[_0x5d22('0xd')](_0x5d22('0xe'),_0x5bdc0d,'request\x20sent');logger[_0x5d22('0xf')](_0x5d22('0x10'),_0x5bdc0d,_0x5d22('0x11'),JSON[_0x5d22('0x12')](_0x2b4186));if(_0x2b4186[_0x5d22('0x13')]){if(_0x2b4186[_0x5d22('0x13')][_0x5d22('0x14')]===0x1f4){logger[_0x5d22('0x13')](_0x5d22('0xe'),_0x5bdc0d,_0x2b4186[_0x5d22('0x13')][_0x5d22('0x15')]);return _0x430ccc(_0x2b4186['error'][_0x5d22('0x15')]);}logger['error'](_0x5d22('0xe'),_0x5bdc0d,_0x2b4186[_0x5d22('0x13')][_0x5d22('0x15')]);return _0xceee82(_0x2b4186[_0x5d22('0x13')][_0x5d22('0x15')]);}else{logger['info'](_0x5d22('0xe'),_0x5bdc0d,_0x5d22('0x11'));_0xceee82(_0x2b4186['result'][_0x5d22('0x15')]);}})[_0x5d22('0x16')](function(_0x449c10){logger[_0x5d22('0x13')](_0x5d22('0xe'),_0x5bdc0d,_0x449c10);_0x430ccc(_0x449c10);});});} \ No newline at end of file +var _0xc421=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x2ec89e,_0x1c1a1e){var _0x56c10b=function(_0x245ff7){while(--_0x245ff7){_0x2ec89e['push'](_0x2ec89e['shift']());}};_0x56c10b(++_0x1c1a1e);}(_0xc421,0x135));var _0x1c42=function(_0x5d6e80,_0xc7bfff){_0x5d6e80=_0x5d6e80-0x0;var _0x59facb=_0xc421[_0x5d6e80];return _0x59facb;};'use strict';var _=require(_0x1c42('0x0'));var util=require(_0x1c42('0x1'));var moment=require(_0x1c42('0x2'));var BPromise=require(_0x1c42('0x3'));var rs=require(_0x1c42('0x4'));var fs=require('fs');var Redis=require(_0x1c42('0x5'));var db=require(_0x1c42('0x6'))['db'];var utils=require(_0x1c42('0x7'));var logger=require(_0x1c42('0x8'))(_0x1c42('0x9'));var config=require(_0x1c42('0xa'));var jayson=require(_0x1c42('0xb'));var client=jayson[_0x1c42('0xc')][_0x1c42('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x367f09,_0x5ec3dc,_0x4d1474){return new BPromise(function(_0x26b14f,_0x2f4a24){return client[_0x1c42('0xe')](_0x367f09,_0x4d1474)[_0x1c42('0xf')](function(_0x23a47d){logger[_0x1c42('0x10')](_0x1c42('0x11'),_0x5ec3dc,_0x1c42('0x12'));logger[_0x1c42('0x13')](_0x1c42('0x14'),_0x5ec3dc,_0x1c42('0x12'),JSON[_0x1c42('0x15')](_0x23a47d));if(_0x23a47d[_0x1c42('0x16')]){if(_0x23a47d[_0x1c42('0x16')]['code']===0x1f4){logger[_0x1c42('0x16')](_0x1c42('0x11'),_0x5ec3dc,_0x23a47d['error'][_0x1c42('0x17')]);return _0x2f4a24(_0x23a47d[_0x1c42('0x16')][_0x1c42('0x17')]);}logger[_0x1c42('0x16')]('SalesforceField,\x20%s,\x20%s',_0x5ec3dc,_0x23a47d[_0x1c42('0x16')]['message']);return _0x26b14f(_0x23a47d['error'][_0x1c42('0x17')]);}else{logger[_0x1c42('0x10')]('SalesforceField,\x20%s,\x20%s',_0x5ec3dc,_0x1c42('0x12'));_0x26b14f(_0x23a47d[_0x1c42('0x18')][_0x1c42('0x17')]);}})[_0x1c42('0x19')](function(_0x2df1c8){logger['error'](_0x1c42('0x11'),_0x5ec3dc,_0x2df1c8);_0x2f4a24(_0x2df1c8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 5b4a18f..8053926 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 _0x552d=['post','addConfiguration','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','getFields','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x552d,0xbe));var _0xd552=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x552d[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require(_0xd552('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd552('0x1'));var express=require(_0xd552('0x2'));var router=express[_0xd552('0x3')]();var fs_extra=require(_0xd552('0x4'));var auth=require(_0xd552('0x5'));var interaction=require(_0xd552('0x6'));var config=require(_0xd552('0x7'));var controller=require(_0xd552('0x8'));router[_0xd552('0x9')]('/',auth['isAuthenticated'](),controller[_0xd552('0xa')]);router[_0xd552('0x9')](_0xd552('0xb'),auth[_0xd552('0xc')](),controller[_0xd552('0xd')]);router[_0xd552('0x9')]('/:id/configurations',auth[_0xd552('0xc')](),controller[_0xd552('0xe')]);router[_0xd552('0x9')]('/:id/fields',auth[_0xd552('0xc')](),controller[_0xd552('0xf')]);router['post']('/',auth[_0xd552('0xc')](),controller[_0xd552('0x10')]);router[_0xd552('0x11')]('/:id/configurations',auth[_0xd552('0xc')](),controller[_0xd552('0x12')]);router[_0xd552('0x13')]('/:id',auth[_0xd552('0xc')](),controller[_0xd552('0x14')]);router['delete']('/:id',auth[_0xd552('0xc')](),controller[_0xd552('0x15')]);module[_0xd552('0x16')]=router; \ No newline at end of file +var _0x1df5=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x2eff26,_0x5a9a59){var _0x506540=function(_0x1f4ba4){while(--_0x1f4ba4){_0x2eff26['push'](_0x2eff26['shift']());}};_0x506540(++_0x5a9a59);}(_0x1df5,0xfd));var _0x51df=function(_0x2926dd,_0x25a378){_0x2926dd=_0x2926dd-0x0;var _0x4212ea=_0x1df5[_0x2926dd];return _0x4212ea;};'use strict';var multer=require(_0x51df('0x0'));var util=require(_0x51df('0x1'));var path=require(_0x51df('0x2'));var timeout=require(_0x51df('0x3'));var express=require(_0x51df('0x4'));var router=express['Router']();var fs_extra=require(_0x51df('0x5'));var auth=require(_0x51df('0x6'));var interaction=require(_0x51df('0x7'));var config=require(_0x51df('0x8'));var controller=require(_0x51df('0x9'));router[_0x51df('0xa')]('/',auth[_0x51df('0xb')](),controller[_0x51df('0xc')]);router['get'](_0x51df('0xd'),auth['isAuthenticated'](),controller[_0x51df('0xe')]);router[_0x51df('0xa')](_0x51df('0xf'),auth[_0x51df('0xb')](),controller[_0x51df('0x10')]);router[_0x51df('0xa')](_0x51df('0x11'),auth[_0x51df('0xb')](),controller['getFields']);router[_0x51df('0x12')]('/',auth[_0x51df('0xb')](),controller[_0x51df('0x13')]);router[_0x51df('0x12')](_0x51df('0xf'),auth[_0x51df('0xb')](),controller[_0x51df('0x14')]);router[_0x51df('0x15')](_0x51df('0xd'),auth[_0x51df('0xb')](),controller[_0x51df('0x16')]);router[_0x51df('0x17')](_0x51df('0xd'),auth[_0x51df('0xb')](),controller[_0x51df('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d242b74..bfed84d 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 _0x6b63=['STRING','username','exports'];(function(_0x407396,_0x4c2610){var _0x56ef4c=function(_0x5e593d){while(--_0x5e593d){_0x407396['push'](_0x407396['shift']());}};_0x56ef4c(++_0x4c2610);}(_0x6b63,0x158));var _0x36b6=function(_0x4588bd,_0x5d3153){_0x4588bd=_0x4588bd-0x0;var _0x234247=_0x6b63[_0x4588bd];return _0x234247;};'use strict';var Sequelize=require('sequelize');module[_0x36b6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x36b6('0x1')]},'username':{'type':Sequelize[_0x36b6('0x1')],'unique':_0x36b6('0x2')},'password':{'type':Sequelize[_0x36b6('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x36b6('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x36b6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4096=['STRING','username','remoteUri','sequelize'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4096,0x17f));var _0x6409=function(_0x3621c5,_0x573965){_0x3621c5=_0x3621c5-0x0;var _0x4430bd=_0x4096[_0x3621c5];return _0x4430bd;};'use strict';var Sequelize=require(_0x6409('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6409('0x1')],'unique':_0x6409('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6409('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x6409('0x3')},'serverUrl':{'type':Sequelize[_0x6409('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 954f977..a4d2ae9 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 _0x4109=['cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','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','correlation_id','location','email','remoteUri','slice','lastIndexOf','format','%s/api/now/table/','password','GET','result','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','send','test','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','ServicenowAccount','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','include','findAll','show','params','keys','rawAttributes','fields','includeAll','create','body','find','catch','getConfigurations','order','pick','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','close_code','notify','incident_state','severity','parent','caused_by','upon_reject','sys_updated_on','hold_reason','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at'];(function(_0x5be677,_0x43ce21){var _0x54e9ca=function(_0x42d5dc){while(--_0x42d5dc){_0x5be677['push'](_0x5be677['shift']());}};_0x54e9ca(++_0x43ce21);}(_0x4109,0x10a));var _0x9410=function(_0x5dd75d,_0x34a12c){_0x5dd75d=_0x5dd75d-0x0;var _0xd3788a=_0x4109[_0x5dd75d];return _0xd3788a;};'use strict';var emlformat=require(_0x9410('0x0'));var rimraf=require(_0x9410('0x1'));var zipdir=require(_0x9410('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9410('0x3'));var moment=require(_0x9410('0x4'));var BPromise=require(_0x9410('0x5'));var Mustache=require(_0x9410('0x6'));var util=require(_0x9410('0x7'));var path=require(_0x9410('0x8'));var sox=require(_0x9410('0x9'));var csv=require('to-csv');var ejs=require(_0x9410('0xa'));var fs=require('fs');var fs_extra=require(_0x9410('0xb'));var _=require(_0x9410('0xc'));var squel=require('squel');var crypto=require(_0x9410('0xd'));var jsforce=require(_0x9410('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9410('0xf'));var querystring=require(_0x9410('0x10'));var Papa=require(_0x9410('0x11'));var Redis=require(_0x9410('0x12'));var authService=require(_0x9410('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9410('0x14'));var hardwareService=require(_0x9410('0x15'));var logger=require(_0x9410('0x16'))('api');var utils=require(_0x9410('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9410('0x18'));var db=require(_0x9410('0x19'))['db'];var integrations=require(_0x9410('0x1a'));function respondWithStatusCode(_0x5d7238,_0x723fff){_0x723fff=_0x723fff||0xcc;return function(_0x1b2c59){if(_0x1b2c59){return _0x5d7238[_0x9410('0x1b')](_0x723fff);}return _0x5d7238[_0x9410('0x1c')](_0x723fff)['end']();};}function respondWithResult(_0x5d04be,_0x59dea5){_0x59dea5=_0x59dea5||0xc8;return function(_0xfeea30){if(_0xfeea30){return _0x5d04be['status'](_0x59dea5)[_0x9410('0x1d')](_0xfeea30);}};}function respondWithFilteredResult(_0x3e78c3,_0x5d76b2){return function(_0x50f52b){if(_0x50f52b){var _0x4d6fd6=typeof _0x5d76b2['offset']===_0x9410('0x1e')&&typeof _0x5d76b2[_0x9410('0x1f')]===_0x9410('0x1e');var _0x11831e=_0x50f52b['count'];var _0x4b3359=_0x4d6fd6?0x0:_0x5d76b2[_0x9410('0x20')];var _0x3a95d8=_0x4d6fd6?_0x50f52b[_0x9410('0x21')]:_0x5d76b2[_0x9410('0x20')]+_0x5d76b2[_0x9410('0x1f')];var _0x15dc3c;if(_0x3a95d8>=_0x11831e){_0x3a95d8=_0x11831e;_0x15dc3c=0xc8;}else{_0x15dc3c=0xce;}_0x3e78c3[_0x9410('0x1c')](_0x15dc3c);return _0x3e78c3[_0x9410('0x22')](_0x9410('0x23'),_0x4b3359+'-'+_0x3a95d8+'/'+_0x11831e)['json'](_0x50f52b);}return null;};}function patchUpdates(_0x521021){return function(_0x2fa6b8){try{jsonpatch[_0x9410('0x24')](_0x2fa6b8,_0x521021,!![]);}catch(_0x2270e3){return BPromise[_0x9410('0x25')](_0x2270e3);}return _0x2fa6b8['save']();};}function saveUpdates(_0x41d218,_0x557b5d){return function(_0x40be36){if(_0x40be36){return _0x40be36[_0x9410('0x26')](_0x41d218)[_0x9410('0x27')](function(_0x3fc167){return _0x3fc167;});}return null;};}function removeEntity(_0x64696e,_0x5da0c1){return function(_0x2fc822){if(_0x2fc822){return _0x2fc822[_0x9410('0x28')]()[_0x9410('0x27')](function(){_0x64696e[_0x9410('0x1c')](0xcc)[_0x9410('0x29')]();});}};}function handleEntityNotFound(_0x5ed60b,_0x20ff1c){return function(_0x58d514){if(!_0x58d514){_0x5ed60b[_0x9410('0x1b')](0x194);}return _0x58d514;};}function handleError(_0x5d6b3b,_0x19b862){_0x19b862=_0x19b862||0x1f4;return function(_0x36ed64){logger[_0x9410('0x2a')](_0x36ed64[_0x9410('0x2b')]);if(_0x36ed64['name']){delete _0x36ed64[_0x9410('0x2c')];}_0x5d6b3b[_0x9410('0x1c')](_0x19b862)['send'](_0x36ed64);};}exports[_0x9410('0x2d')]=function(_0x1cb779,_0x21fefa){var _0x5ac0fe={},_0x226099={},_0x167572={'count':0x0,'rows':[]};var _0x4fb03b=_[_0x9410('0x2e')](db[_0x9410('0x2f')]['rawAttributes'],function(_0x56f44d){return{'name':_0x56f44d[_0x9410('0x30')],'type':_0x56f44d[_0x9410('0x31')][_0x9410('0x32')]};});_0x226099[_0x9410('0x33')]=_[_0x9410('0x2e')](_0x4fb03b,_0x9410('0x2c'));_0x226099['query']=_['keys'](_0x1cb779[_0x9410('0x34')]);_0x226099['filters']=_[_0x9410('0x35')](_0x226099['model'],_0x226099[_0x9410('0x34')]);_0x5ac0fe[_0x9410('0x36')]=_[_0x9410('0x35')](_0x226099[_0x9410('0x33')],qs['fields'](_0x1cb779[_0x9410('0x34')]['fields']));_0x5ac0fe[_0x9410('0x36')]=_0x5ac0fe[_0x9410('0x36')][_0x9410('0x37')]?_0x5ac0fe[_0x9410('0x36')]:_0x226099['model'];if(!_0x1cb779[_0x9410('0x34')][_0x9410('0x38')](_0x9410('0x39'))){_0x5ac0fe[_0x9410('0x1f')]=qs[_0x9410('0x1f')](_0x1cb779[_0x9410('0x34')][_0x9410('0x1f')]);_0x5ac0fe['offset']=qs[_0x9410('0x20')](_0x1cb779[_0x9410('0x34')][_0x9410('0x20')]);}_0x5ac0fe['order']=qs[_0x9410('0x3a')](_0x1cb779[_0x9410('0x34')][_0x9410('0x3a')]);_0x5ac0fe[_0x9410('0x3b')]=qs[_0x9410('0x3c')](_['pick'](_0x1cb779[_0x9410('0x34')],_0x226099[_0x9410('0x3c')]),_0x4fb03b);if(_0x1cb779[_0x9410('0x34')]['filter']){_0x5ac0fe[_0x9410('0x3b')]=_[_0x9410('0x3d')](_0x5ac0fe[_0x9410('0x3b')],{'$or':_[_0x9410('0x2e')](_0x4fb03b,function(_0xfdbe36){if(_0xfdbe36[_0x9410('0x31')]!==_0x9410('0x3e')){var _0x411183={};_0x411183[_0xfdbe36[_0x9410('0x2c')]]={'$like':'%'+_0x1cb779['query'][_0x9410('0x3f')]+'%'};return _0x411183;}})});}_0x5ac0fe=_['merge']({},_0x5ac0fe,_0x1cb779[_0x9410('0x40')]);var _0x44b7f9={'where':_0x5ac0fe['where']};return db[_0x9410('0x2f')]['count'](_0x44b7f9)[_0x9410('0x27')](function(_0x25c1ee){_0x167572[_0x9410('0x21')]=_0x25c1ee;if(_0x1cb779[_0x9410('0x34')]['includeAll']){_0x5ac0fe[_0x9410('0x41')]=[{'all':!![]}];}return db[_0x9410('0x2f')][_0x9410('0x42')](_0x5ac0fe);})[_0x9410('0x27')](function(_0x13952d){_0x167572['rows']=_0x13952d;return _0x167572;})['then'](respondWithFilteredResult(_0x21fefa,_0x5ac0fe))['catch'](handleError(_0x21fefa,null));};exports[_0x9410('0x43')]=function(_0x35478f,_0x1011b1){var _0x5de3d4={'raw':![],'where':{'id':_0x35478f[_0x9410('0x44')]['id']}},_0x4e4950={};_0x4e4950[_0x9410('0x33')]=_[_0x9410('0x45')](db[_0x9410('0x2f')][_0x9410('0x46')]);_0x4e4950[_0x9410('0x34')]=_[_0x9410('0x45')](_0x35478f['query']);_0x4e4950[_0x9410('0x3c')]=_[_0x9410('0x35')](_0x4e4950[_0x9410('0x33')],_0x4e4950[_0x9410('0x34')]);_0x5de3d4[_0x9410('0x36')]=_[_0x9410('0x35')](_0x4e4950[_0x9410('0x33')],qs['fields'](_0x35478f[_0x9410('0x34')][_0x9410('0x47')]));_0x5de3d4['attributes']=_0x5de3d4[_0x9410('0x36')]['length']?_0x5de3d4[_0x9410('0x36')]:_0x4e4950[_0x9410('0x33')];if(_0x35478f[_0x9410('0x34')][_0x9410('0x48')]){_0x5de3d4[_0x9410('0x41')]=[{'all':!![]}];}_0x5de3d4=_[_0x9410('0x3d')]({},_0x5de3d4,_0x35478f[_0x9410('0x40')]);return db[_0x9410('0x2f')]['find'](_0x5de3d4)[_0x9410('0x27')](handleEntityNotFound(_0x1011b1,null))[_0x9410('0x27')](respondWithResult(_0x1011b1,null))['catch'](handleError(_0x1011b1,null));};exports[_0x9410('0x49')]=function(_0x4df576,_0x54103b){return db[_0x9410('0x2f')][_0x9410('0x49')](_0x4df576['body'],{})[_0x9410('0x27')](respondWithResult(_0x54103b,0xc9))['catch'](handleError(_0x54103b,null));};exports[_0x9410('0x26')]=function(_0xcc3762,_0xc46e4e){if(_0xcc3762[_0x9410('0x4a')]['id']){delete _0xcc3762['body']['id'];}return db[_0x9410('0x2f')][_0x9410('0x4b')]({'where':{'id':_0xcc3762[_0x9410('0x44')]['id']}})['then'](handleEntityNotFound(_0xc46e4e,null))[_0x9410('0x27')](saveUpdates(_0xcc3762['body'],null))['then'](respondWithResult(_0xc46e4e,null))[_0x9410('0x4c')](handleError(_0xc46e4e,null));};exports[_0x9410('0x28')]=function(_0x3b42ec,_0x145098){return db[_0x9410('0x2f')][_0x9410('0x4b')]({'where':{'id':_0x3b42ec[_0x9410('0x44')]['id']}})[_0x9410('0x27')](handleEntityNotFound(_0x145098,null))[_0x9410('0x27')](removeEntity(_0x145098,null))[_0x9410('0x4c')](handleError(_0x145098,null));};exports[_0x9410('0x4d')]=function(_0x5379c5,_0x5af622,_0x4b0e91){var _0x90bb37={};var _0x4f406f={};var _0xf84eac;var _0x1291ec;return db[_0x9410('0x2f')]['findOne']({'where':{'id':_0x5379c5[_0x9410('0x44')]['id']}})[_0x9410('0x27')](handleEntityNotFound(_0x5af622,null))[_0x9410('0x27')](function(_0x341d72){if(_0x341d72){_0xf84eac=_0x341d72;_0x4f406f[_0x9410('0x33')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x4f406f['query']=_[_0x9410('0x45')](_0x5379c5[_0x9410('0x34')]);_0x4f406f[_0x9410('0x3c')]=_[_0x9410('0x35')](_0x4f406f[_0x9410('0x33')],_0x4f406f['query']);_0x90bb37[_0x9410('0x36')]=_[_0x9410('0x35')](_0x4f406f['model'],qs[_0x9410('0x47')](_0x5379c5[_0x9410('0x34')][_0x9410('0x47')]));_0x90bb37['attributes']=_0x90bb37[_0x9410('0x36')][_0x9410('0x37')]?_0x90bb37[_0x9410('0x36')]:_0x4f406f[_0x9410('0x33')];_0x90bb37[_0x9410('0x4e')]=qs['sort'](_0x5379c5[_0x9410('0x34')][_0x9410('0x3a')]);_0x90bb37['where']=qs[_0x9410('0x3c')](_[_0x9410('0x4f')](_0x5379c5[_0x9410('0x34')],_0x4f406f[_0x9410('0x3c')]));if(_0x5379c5[_0x9410('0x34')][_0x9410('0x3f')]){_0x90bb37[_0x9410('0x3b')]=_[_0x9410('0x3d')](_0x90bb37[_0x9410('0x3b')],{'$or':_[_0x9410('0x2e')](_0x90bb37[_0x9410('0x36')],function(_0x1ee8f2){var _0x4a5ad4={};_0x4a5ad4[_0x1ee8f2]={'$like':'%'+_0x5379c5[_0x9410('0x34')]['filter']+'%'};return _0x4a5ad4;})});}_0x90bb37=_['merge']({},_0x90bb37,_0x5379c5['options']);return _0xf84eac['getConfigurations'](_0x90bb37);}})[_0x9410('0x27')](function(_0x4019de){if(_0x4019de){_0x1291ec=_0x4019de['length'];if(!_0x5379c5['query'][_0x9410('0x38')](_0x9410('0x39'))){_0x90bb37[_0x9410('0x1f')]=qs['limit'](_0x5379c5[_0x9410('0x34')][_0x9410('0x1f')]);_0x90bb37[_0x9410('0x20')]=qs[_0x9410('0x20')](_0x5379c5[_0x9410('0x34')][_0x9410('0x20')]);}return _0xf84eac[_0x9410('0x4d')](_0x90bb37);}})[_0x9410('0x27')](function(_0x55d8fe){if(_0x55d8fe){return _0x55d8fe?{'count':_0x1291ec,'rows':_0x55d8fe}:null;}})['then'](respondWithResult(_0x5af622,null))[_0x9410('0x4c')](handleError(_0x5af622,null));};exports[_0x9410('0x50')]=function(_0x5983ff,_0x45fb3d,_0x4e15c8){if(_0x5983ff[_0x9410('0x4a')]['id']){delete _0x5983ff[_0x9410('0x4a')]['id'];}return db['ServicenowAccount'][_0x9410('0x51')]({'where':{'id':_0x5983ff['params']['id']}})[_0x9410('0x27')](handleEntityNotFound(_0x45fb3d,null))['then'](function(_0x4b2279){if(_0x4b2279){_0x5983ff[_0x9410('0x4a')][_0x9410('0x52')]=_0x4b2279['id'];_0x5983ff[_0x9410('0x4a')][_0x9410('0x53')]=integrations['getSubjects'](_0x5983ff[_0x9410('0x4a')]['channel'],_0x5983ff['body'][_0x9410('0x31')]);_0x5983ff[_0x9410('0x4a')][_0x9410('0x54')]=integrations[_0x9410('0x55')](_0x5983ff[_0x9410('0x4a')]['channel'],_0x5983ff[_0x9410('0x4a')][_0x9410('0x31')]);return db['ServicenowConfiguration'][_0x9410('0x49')](_0x5983ff['body'],{'include':[{'model':db[_0x9410('0x56')],'as':_0x9410('0x53')},{'model':db[_0x9410('0x56')],'as':_0x9410('0x54')}]});}return null;})['then'](respondWithResult(_0x45fb3d,null))['catch'](handleError(_0x45fb3d,null));};exports[_0x9410('0x57')]=function(_0x247f18,_0x2539b0,_0x54713c){var _0x231b34=[_0x9410('0x58'),'hold_reason','knowledge','subcategory',_0x9410('0x59'),_0x9410('0x5a'),_0x9410('0x5b'),_0x9410('0x5c'),'category'];var _0x24a0c3=[_0x9410('0x5d'),_0x9410('0x58'),_0x9410('0x5e'),'watch_list',_0x9410('0x5f'),_0x9410('0x60'),'child_incidents',_0x9410('0x61'),'approval_history',_0x9410('0x62'),_0x9410('0x63'),_0x9410('0x64'),_0x9410('0x65'),'user_input',_0x9410('0x66'),_0x9410('0x67'),_0x9410('0x68'),_0x9410('0x69'),'knowledge',_0x9410('0x4e'),_0x9410('0x6a'),_0x9410('0x6b'),_0x9410('0x6c'),_0x9410('0x6d'),_0x9410('0x6e'),_0x9410('0x6f'),_0x9410('0x70'),_0x9410('0x71'),_0x9410('0x72'),_0x9410('0x73'),'rfc','time_worked',_0x9410('0x74'),_0x9410('0x75'),_0x9410('0x76'),_0x9410('0x77'),_0x9410('0x78'),'reopened_time',_0x9410('0x79'),_0x9410('0x7a'),'approval_set',_0x9410('0x7b'),_0x9410('0x7c'),_0x9410('0x7d'),_0x9410('0x59'),_0x9410('0x7e'),_0x9410('0x7f'),_0x9410('0x80'),_0x9410('0x81'),'business_stc',_0x9410('0x82'),_0x9410('0x83'),_0x9410('0x84'),_0x9410('0x5a'),_0x9410('0x85'),_0x9410('0x86'),_0x9410('0x87'),_0x9410('0x88'),'parent_incident',_0x9410('0x89'),_0x9410('0x8a'),_0x9410('0x8b'),_0x9410('0x5b'),_0x9410('0x8c'),_0x9410('0x8d'),_0x9410('0x8e'),_0x9410('0x8f'),_0x9410('0x90'),_0x9410('0x91'),'severity',_0x9410('0x92'),_0x9410('0x93'),_0x9410('0x94'),_0x9410('0x95'),_0x9410('0x96'),_0x9410('0x97'),_0x9410('0x98'),'sys_tags',_0x9410('0x99'),_0x9410('0x9a'),_0x9410('0x9b'),_0x9410('0x9c'),'category'];var _0x367f0c='';var _0x443aad='';var _0x412679=[];var _0xe055c0='';var _0x69a02f='';var _0x3eacdb=[];var _0x7c52be='';var _0x117a96='';var _0x32e3ad={};var _0x34f21f='';return db[_0x9410('0x2f')][_0x9410('0x51')]({'where':{'id':_0x247f18[_0x9410('0x44')]['id']},'attributes':['id','username','password',_0x9410('0x9d'),_0x9410('0x9e'),'serverUrl']})[_0x9410('0x27')](handleEntityNotFound(_0x2539b0,null))[_0x9410('0x27')](function(_0x484157){if(_0x484157){_0x34f21f=_0x484157['remoteUri'];var _0x56567b=_0x34f21f[_0x9410('0x9f')](-0x1);if(_0x56567b==='/'){_0x34f21f=_0x34f21f['substring'](0x0,_0x34f21f[_0x9410('0xa0')](_0x56567b));}_0x117a96=util['format']('%s/api/now/doc/table/schema/',_0x34f21f);_0x7c52be=util[_0x9410('0xa1')](_0x9410('0xa2'),_0x34f21f);_0x32e3ad={'user':_0x484157['username'],'pass':_0x484157[_0x9410('0xa3')]};var _0x4b411a={'method':_0x9410('0xa4'),'uri':_0x117a96+'incident?sysparm_display_value=all','auth':_0x32e3ad,'json':!![]};return rp(_0x4b411a);}})[_0x9410('0x27')](function(_0x37536c){if(_0x37536c['result'][_0x9410('0x37')]>0x0){_0x367f0c=_0x37536c[_0x9410('0xa5')];}console['log'](_0x9410('0xa6'),_0x367f0c);_0x3eacdb=[];_0x443aad=Object[_0x9410('0xa7')]([],_0x367f0c);_[_0x9410('0xa8')](_0x443aad,function(_0xb34549){return!_0x231b34[_0x9410('0xa9')](_0xb34549[_0x9410('0x2c')]);});_0x443aad[_0x9410('0xaa')](function(_0x19eabc){var _0x3139e7=createFieldObject(_0x7c52be,_0x32e3ad,_0x19eabc['internalType'],_0x19eabc[_0x9410('0x2c')],_0x19eabc[_0x9410('0xab')],![]);_0x3eacdb[_0x9410('0xac')](_0x3139e7);});return Promise[_0x9410('0xad')](_0x3eacdb);})[_0x9410('0x27')](function(_0x3f8ab2){_0x412679=_0x3f8ab2;_0xe055c0=Object[_0x9410('0xa7')]([],_0x367f0c);console[_0x9410('0xae')](_0x9410('0xaf'),_0x367f0c);_['remove'](_0xe055c0,function(_0x4e4df8){return _0x24a0c3[_0x9410('0xa9')](_0x4e4df8['name']);});console[_0x9410('0xae')](_0x9410('0xb0'),_0xe055c0);_0x3eacdb=[];_0xe055c0[_0x9410('0xaa')](function(_0x32975f){var _0x1f8cc4=createFieldObject(_0x7c52be,_0x32e3ad,_0x32975f['internalType'],_0x32975f['name'],_0x32975f[_0x9410('0xab')],!![]);_0x3eacdb[_0x9410('0xac')](_0x1f8cc4);});return Promise[_0x9410('0xad')](_0x3eacdb);})[_0x9410('0x27')](function(_0xda48f1){_0x69a02f=_0xda48f1;var _0x408e83=_0x412679[_0x9410('0xb1')](_0x69a02f);return{'count':_0x408e83[_0x9410('0x37')],'rows':_0x408e83};})['then'](respondWithResult(_0x2539b0,null))[_0x9410('0x4c')](function(_0x3077ff){console['log'](_0x9410('0xb2')+_0x3077ff);var _0x1f2ca0=_0x247f18[_0x9410('0x34')]['test']?0x1f4:_0x3077ff[_0x9410('0xb3')]||0x1f4;logger[_0x9410('0x2a')](_0x3077ff[_0x9410('0x2b')]);delete _0x3077ff[_0x9410('0x2c')];if(_0x1f2ca0===0x191){_0x1f2ca0=0x190;}_0x2539b0[_0x9410('0x1c')](_0x1f2ca0)[_0x9410('0xb4')](_0x247f18[_0x9410('0x34')][_0x9410('0xb5')]?{'message':'Wrong\x20credentials','statusCode':_0x3077ff[_0x9410('0xb3')]}:_0x3077ff);});};function createFieldObject(_0x26ff73,_0x12e5e2,_0x4455dc,_0x153626,_0xb93bcd,_0x4aea56){return new Promise(function(_0x56af61,_0x298c1a){var _0x404050={'id':_0x153626,'name':_0xb93bcd,'custom':_0x4aea56};if(_0x4455dc==='boolean'){_0x404050['options']=[{'name':'True','value':'true'},{'name':_0x9410('0xb6'),'value':_0x9410('0xb7')}];_0x56af61(_0x404050);}else{var _0x53f531={'method':_0x9410('0xa4'),'uri':_0x26ff73+_0x9410('0xb8')+_0x153626,'auth':_0x12e5e2,'json':!![]};return rp(_0x53f531)[_0x9410('0x27')](function(_0xbdb8a7){var _0x8ffc83=[];if(_0xbdb8a7[_0x9410('0xa5')][_0x9410('0x37')]>0x0){_0xbdb8a7['result'][_0x9410('0xaa')](function(_0x278cce){if(_0x278cce[_0x9410('0xb9')]===_0x9410('0xb7')){var _0x3d5cda={'name':_0x278cce['label'],'value':_0x278cce[_0x9410('0xba')]};_0x8ffc83[_0x9410('0xac')](_0x3d5cda);}});}_0x404050[_0x9410('0x40')]=_0x8ffc83;if(_0x404050[_0x9410('0x40')][_0x9410('0x37')]>0x0){_0x56af61(_0x404050);}else{if(_0x4aea56==![]){_0x56af61();}else{_0x56af61(_0x404050);}}});}});} \ No newline at end of file +var _0x1caa=['substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','stack','send','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','error','name','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','update','getConfigurations','findOne','sort','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','subcategory','notify','severity','category','parent','made_sla','watch_list','upon_reject','sys_updated_on','approval_history','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','business_duration','group_list','reopened_time','resolved_at','caller_id','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','parent_incident','sys_id','reopened_by','incident_state','urgency','company','reassignment_count','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','correlation_id','location','username','password','email','serverUrl','remoteUri','slice'];(function(_0x34c7e8,_0x16f1a3){var _0x3ec838=function(_0x1e9512){while(--_0x1e9512){_0x34c7e8['push'](_0x34c7e8['shift']());}};_0x3ec838(++_0x16f1a3);}(_0x1caa,0x19b));var _0xa1ca=function(_0x48079d,_0x1bab5e){_0x48079d=_0x48079d-0x0;var _0x77a9ab=_0x1caa[_0x48079d];return _0x77a9ab;};'use strict';var emlformat=require(_0xa1ca('0x0'));var rimraf=require(_0xa1ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1ca('0x2'));var rp=require(_0xa1ca('0x3'));var moment=require(_0xa1ca('0x4'));var BPromise=require(_0xa1ca('0x5'));var Mustache=require(_0xa1ca('0x6'));var util=require(_0xa1ca('0x7'));var path=require(_0xa1ca('0x8'));var sox=require(_0xa1ca('0x9'));var csv=require(_0xa1ca('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1ca('0xb'));var _=require('lodash');var squel=require(_0xa1ca('0xc'));var crypto=require(_0xa1ca('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa1ca('0xe'));var toCsv=require(_0xa1ca('0xa'));var querystring=require(_0xa1ca('0xf'));var Papa=require('papaparse');var Redis=require(_0xa1ca('0x10'));var authService=require(_0xa1ca('0x11'));var qs=require(_0xa1ca('0x12'));var as=require(_0xa1ca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1ca('0x14'))(_0xa1ca('0x15'));var utils=require(_0xa1ca('0x16'));var config=require(_0xa1ca('0x17'));var licenseUtil=require(_0xa1ca('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa1ca('0x19'));function respondWithStatusCode(_0x344597,_0x5ba1e7){_0x5ba1e7=_0x5ba1e7||0xcc;return function(_0x273b08){if(_0x273b08){return _0x344597[_0xa1ca('0x1a')](_0x5ba1e7);}return _0x344597[_0xa1ca('0x1b')](_0x5ba1e7)['end']();};}function respondWithResult(_0x4b5962,_0x3d7afb){_0x3d7afb=_0x3d7afb||0xc8;return function(_0x15f3ab){if(_0x15f3ab){return _0x4b5962[_0xa1ca('0x1b')](_0x3d7afb)[_0xa1ca('0x1c')](_0x15f3ab);}};}function respondWithFilteredResult(_0xf0162b,_0x50b274){return function(_0x2dddc0){if(_0x2dddc0){var _0x373c13=typeof _0x50b274[_0xa1ca('0x1d')]===_0xa1ca('0x1e')&&typeof _0x50b274[_0xa1ca('0x1f')]===_0xa1ca('0x1e');var _0x26df68=_0x2dddc0[_0xa1ca('0x20')];var _0x4131d3=_0x373c13?0x0:_0x50b274[_0xa1ca('0x1d')];var _0x2fa536=_0x373c13?_0x2dddc0[_0xa1ca('0x20')]:_0x50b274[_0xa1ca('0x1d')]+_0x50b274['limit'];var _0x55bd5e;if(_0x2fa536>=_0x26df68){_0x2fa536=_0x26df68;_0x55bd5e=0xc8;}else{_0x55bd5e=0xce;}_0xf0162b[_0xa1ca('0x1b')](_0x55bd5e);return _0xf0162b[_0xa1ca('0x21')]('Content-Range',_0x4131d3+'-'+_0x2fa536+'/'+_0x26df68)[_0xa1ca('0x1c')](_0x2dddc0);}return null;};}function patchUpdates(_0x55c7b6){return function(_0x4f844c){try{jsonpatch[_0xa1ca('0x22')](_0x4f844c,_0x55c7b6,!![]);}catch(_0x4a8036){return BPromise[_0xa1ca('0x23')](_0x4a8036);}return _0x4f844c[_0xa1ca('0x24')]();};}function saveUpdates(_0x3a9250,_0x56d8d8){return function(_0x22055a){if(_0x22055a){return _0x22055a['update'](_0x3a9250)['then'](function(_0x3714d1){return _0x3714d1;});}return null;};}function removeEntity(_0xf4cb66,_0x5c73cf){return function(_0x4f63dc){if(_0x4f63dc){return _0x4f63dc[_0xa1ca('0x25')]()[_0xa1ca('0x26')](function(){_0xf4cb66[_0xa1ca('0x1b')](0xcc)[_0xa1ca('0x27')]();});}};}function handleEntityNotFound(_0x4d8747,_0x4ea57b){return function(_0x39839d){if(!_0x39839d){_0x4d8747['sendStatus'](0x194);}return _0x39839d;};}function handleError(_0x1ae1c4,_0x46f65c){_0x46f65c=_0x46f65c||0x1f4;return function(_0x55e93d){logger[_0xa1ca('0x28')](_0x55e93d['stack']);if(_0x55e93d[_0xa1ca('0x29')]){delete _0x55e93d[_0xa1ca('0x29')];}_0x1ae1c4[_0xa1ca('0x1b')](_0x46f65c)['send'](_0x55e93d);};}exports['index']=function(_0x1861b2,_0x557cf4){var _0x166fd4={},_0x4cdd37={},_0x30b230={'count':0x0,'rows':[]};var _0x49c5dd=_[_0xa1ca('0x2a')](db[_0xa1ca('0x2b')][_0xa1ca('0x2c')],function(_0x330132){return{'name':_0x330132[_0xa1ca('0x2d')],'type':_0x330132[_0xa1ca('0x2e')][_0xa1ca('0x2f')]};});_0x4cdd37[_0xa1ca('0x30')]=_[_0xa1ca('0x2a')](_0x49c5dd,'name');_0x4cdd37[_0xa1ca('0x31')]=_[_0xa1ca('0x32')](_0x1861b2[_0xa1ca('0x31')]);_0x4cdd37[_0xa1ca('0x33')]=_[_0xa1ca('0x34')](_0x4cdd37['model'],_0x4cdd37[_0xa1ca('0x31')]);_0x166fd4['attributes']=_[_0xa1ca('0x34')](_0x4cdd37[_0xa1ca('0x30')],qs['fields'](_0x1861b2[_0xa1ca('0x31')][_0xa1ca('0x35')]));_0x166fd4[_0xa1ca('0x36')]=_0x166fd4[_0xa1ca('0x36')][_0xa1ca('0x37')]?_0x166fd4[_0xa1ca('0x36')]:_0x4cdd37[_0xa1ca('0x30')];if(!_0x1861b2[_0xa1ca('0x31')][_0xa1ca('0x38')](_0xa1ca('0x39'))){_0x166fd4[_0xa1ca('0x1f')]=qs[_0xa1ca('0x1f')](_0x1861b2[_0xa1ca('0x31')][_0xa1ca('0x1f')]);_0x166fd4[_0xa1ca('0x1d')]=qs[_0xa1ca('0x1d')](_0x1861b2[_0xa1ca('0x31')]['offset']);}_0x166fd4[_0xa1ca('0x3a')]=qs['sort'](_0x1861b2['query']['sort']);_0x166fd4[_0xa1ca('0x3b')]=qs[_0xa1ca('0x33')](_['pick'](_0x1861b2[_0xa1ca('0x31')],_0x4cdd37[_0xa1ca('0x33')]),_0x49c5dd);if(_0x1861b2[_0xa1ca('0x31')][_0xa1ca('0x3c')]){_0x166fd4[_0xa1ca('0x3b')]=_['merge'](_0x166fd4[_0xa1ca('0x3b')],{'$or':_['map'](_0x49c5dd,function(_0x241cdc){if(_0x241cdc[_0xa1ca('0x2e')]!=='VIRTUAL'){var _0xbc3705={};_0xbc3705[_0x241cdc[_0xa1ca('0x29')]]={'$like':'%'+_0x1861b2[_0xa1ca('0x31')][_0xa1ca('0x3c')]+'%'};return _0xbc3705;}})});}_0x166fd4=_[_0xa1ca('0x3d')]({},_0x166fd4,_0x1861b2['options']);var _0x4d669c={'where':_0x166fd4[_0xa1ca('0x3b')]};return db['ServicenowAccount'][_0xa1ca('0x20')](_0x4d669c)[_0xa1ca('0x26')](function(_0x394bf4){_0x30b230[_0xa1ca('0x20')]=_0x394bf4;if(_0x1861b2[_0xa1ca('0x31')][_0xa1ca('0x3e')]){_0x166fd4[_0xa1ca('0x3f')]=[{'all':!![]}];}return db[_0xa1ca('0x2b')][_0xa1ca('0x40')](_0x166fd4);})[_0xa1ca('0x26')](function(_0x4041f6){_0x30b230[_0xa1ca('0x41')]=_0x4041f6;return _0x30b230;})[_0xa1ca('0x26')](respondWithFilteredResult(_0x557cf4,_0x166fd4))['catch'](handleError(_0x557cf4,null));};exports[_0xa1ca('0x42')]=function(_0x361a10,_0x15bdc9){var _0x1180d7={'raw':![],'where':{'id':_0x361a10[_0xa1ca('0x43')]['id']}},_0xcb3d03={};_0xcb3d03[_0xa1ca('0x30')]=_[_0xa1ca('0x32')](db['ServicenowAccount'][_0xa1ca('0x2c')]);_0xcb3d03[_0xa1ca('0x31')]=_[_0xa1ca('0x32')](_0x361a10['query']);_0xcb3d03['filters']=_[_0xa1ca('0x34')](_0xcb3d03[_0xa1ca('0x30')],_0xcb3d03[_0xa1ca('0x31')]);_0x1180d7[_0xa1ca('0x36')]=_[_0xa1ca('0x34')](_0xcb3d03['model'],qs[_0xa1ca('0x35')](_0x361a10['query'][_0xa1ca('0x35')]));_0x1180d7['attributes']=_0x1180d7[_0xa1ca('0x36')][_0xa1ca('0x37')]?_0x1180d7[_0xa1ca('0x36')]:_0xcb3d03[_0xa1ca('0x30')];if(_0x361a10[_0xa1ca('0x31')][_0xa1ca('0x3e')]){_0x1180d7[_0xa1ca('0x3f')]=[{'all':!![]}];}_0x1180d7=_[_0xa1ca('0x3d')]({},_0x1180d7,_0x361a10[_0xa1ca('0x44')]);return db[_0xa1ca('0x2b')][_0xa1ca('0x45')](_0x1180d7)[_0xa1ca('0x26')](handleEntityNotFound(_0x15bdc9,null))['then'](respondWithResult(_0x15bdc9,null))['catch'](handleError(_0x15bdc9,null));};exports[_0xa1ca('0x46')]=function(_0x109435,_0x277a04){return db[_0xa1ca('0x2b')][_0xa1ca('0x46')](_0x109435[_0xa1ca('0x47')],{})['then'](respondWithResult(_0x277a04,0xc9))[_0xa1ca('0x48')](handleError(_0x277a04,null));};exports[_0xa1ca('0x49')]=function(_0x467d2b,_0x4c7eed){if(_0x467d2b[_0xa1ca('0x47')]['id']){delete _0x467d2b[_0xa1ca('0x47')]['id'];}return db[_0xa1ca('0x2b')][_0xa1ca('0x45')]({'where':{'id':_0x467d2b[_0xa1ca('0x43')]['id']}})[_0xa1ca('0x26')](handleEntityNotFound(_0x4c7eed,null))[_0xa1ca('0x26')](saveUpdates(_0x467d2b['body'],null))['then'](respondWithResult(_0x4c7eed,null))[_0xa1ca('0x48')](handleError(_0x4c7eed,null));};exports['destroy']=function(_0x5cb20d,_0x554244){return db[_0xa1ca('0x2b')][_0xa1ca('0x45')]({'where':{'id':_0x5cb20d['params']['id']}})[_0xa1ca('0x26')](handleEntityNotFound(_0x554244,null))[_0xa1ca('0x26')](removeEntity(_0x554244,null))['catch'](handleError(_0x554244,null));};exports[_0xa1ca('0x4a')]=function(_0x2fb16b,_0x2cd6e2,_0xf7c2e9){var _0x25feac={};var _0x3ac5b8={};var _0x424376;var _0x9c3c75;return db[_0xa1ca('0x2b')][_0xa1ca('0x4b')]({'where':{'id':_0x2fb16b[_0xa1ca('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cd6e2,null))[_0xa1ca('0x26')](function(_0x4387d2){if(_0x4387d2){_0x424376=_0x4387d2;_0x3ac5b8[_0xa1ca('0x30')]=_[_0xa1ca('0x32')](db['ServicenowConfiguration'][_0xa1ca('0x2c')]);_0x3ac5b8['query']=_[_0xa1ca('0x32')](_0x2fb16b['query']);_0x3ac5b8[_0xa1ca('0x33')]=_[_0xa1ca('0x34')](_0x3ac5b8[_0xa1ca('0x30')],_0x3ac5b8[_0xa1ca('0x31')]);_0x25feac[_0xa1ca('0x36')]=_['intersection'](_0x3ac5b8['model'],qs['fields'](_0x2fb16b['query']['fields']));_0x25feac[_0xa1ca('0x36')]=_0x25feac[_0xa1ca('0x36')]['length']?_0x25feac['attributes']:_0x3ac5b8[_0xa1ca('0x30')];_0x25feac[_0xa1ca('0x3a')]=qs[_0xa1ca('0x4c')](_0x2fb16b[_0xa1ca('0x31')][_0xa1ca('0x4c')]);_0x25feac[_0xa1ca('0x3b')]=qs[_0xa1ca('0x33')](_[_0xa1ca('0x4d')](_0x2fb16b[_0xa1ca('0x31')],_0x3ac5b8[_0xa1ca('0x33')]));if(_0x2fb16b[_0xa1ca('0x31')][_0xa1ca('0x3c')]){_0x25feac[_0xa1ca('0x3b')]=_[_0xa1ca('0x3d')](_0x25feac[_0xa1ca('0x3b')],{'$or':_[_0xa1ca('0x2a')](_0x25feac['attributes'],function(_0x2131ea){var _0x1323f9={};_0x1323f9[_0x2131ea]={'$like':'%'+_0x2fb16b[_0xa1ca('0x31')][_0xa1ca('0x3c')]+'%'};return _0x1323f9;})});}_0x25feac=_[_0xa1ca('0x3d')]({},_0x25feac,_0x2fb16b['options']);return _0x424376[_0xa1ca('0x4a')](_0x25feac);}})[_0xa1ca('0x26')](function(_0x8f4cf8){if(_0x8f4cf8){_0x9c3c75=_0x8f4cf8[_0xa1ca('0x37')];if(!_0x2fb16b[_0xa1ca('0x31')][_0xa1ca('0x38')](_0xa1ca('0x39'))){_0x25feac[_0xa1ca('0x1f')]=qs[_0xa1ca('0x1f')](_0x2fb16b[_0xa1ca('0x31')]['limit']);_0x25feac[_0xa1ca('0x1d')]=qs[_0xa1ca('0x1d')](_0x2fb16b[_0xa1ca('0x31')][_0xa1ca('0x1d')]);}return _0x424376['getConfigurations'](_0x25feac);}})[_0xa1ca('0x26')](function(_0x5ad6ac){if(_0x5ad6ac){return _0x5ad6ac?{'count':_0x9c3c75,'rows':_0x5ad6ac}:null;}})[_0xa1ca('0x26')](respondWithResult(_0x2cd6e2,null))['catch'](handleError(_0x2cd6e2,null));};exports[_0xa1ca('0x4e')]=function(_0x4a4325,_0x22cee7,_0x363f36){if(_0x4a4325['body']['id']){delete _0x4a4325[_0xa1ca('0x47')]['id'];}return db['ServicenowAccount'][_0xa1ca('0x4b')]({'where':{'id':_0x4a4325[_0xa1ca('0x43')]['id']}})[_0xa1ca('0x26')](handleEntityNotFound(_0x22cee7,null))[_0xa1ca('0x26')](function(_0x33be5e){if(_0x33be5e){_0x4a4325[_0xa1ca('0x47')][_0xa1ca('0x4f')]=_0x33be5e['id'];_0x4a4325[_0xa1ca('0x47')][_0xa1ca('0x50')]=integrations['getSubjects'](_0x4a4325[_0xa1ca('0x47')][_0xa1ca('0x51')],_0x4a4325[_0xa1ca('0x47')][_0xa1ca('0x2e')]);_0x4a4325[_0xa1ca('0x47')][_0xa1ca('0x52')]=integrations[_0xa1ca('0x53')](_0x4a4325[_0xa1ca('0x47')]['channel'],_0x4a4325['body'][_0xa1ca('0x2e')]);return db[_0xa1ca('0x54')]['create'](_0x4a4325['body'],{'include':[{'model':db[_0xa1ca('0x55')],'as':_0xa1ca('0x50')},{'model':db[_0xa1ca('0x55')],'as':_0xa1ca('0x52')}]});}return null;})[_0xa1ca('0x26')](respondWithResult(_0x22cee7,null))['catch'](handleError(_0x22cee7,null));};exports[_0xa1ca('0x56')]=function(_0x1f9bee,_0x318849,_0x36cfc3){var _0x16a273=['made_sla',_0xa1ca('0x57'),'knowledge',_0xa1ca('0x58'),'close_code',_0xa1ca('0x59'),'incident_state',_0xa1ca('0x5a'),_0xa1ca('0x5b')];var _0x194d19=[_0xa1ca('0x5c'),_0xa1ca('0x5d'),'caused_by',_0xa1ca('0x5e'),_0xa1ca('0x5f'),_0xa1ca('0x60'),'child_incidents',_0xa1ca('0x57'),_0xa1ca('0x61'),'number',_0xa1ca('0x62'),_0xa1ca('0x63'),'opened_by',_0xa1ca('0x64'),_0xa1ca('0x65'),_0xa1ca('0x66'),_0xa1ca('0x67'),'sys_created_by',_0xa1ca('0x68'),_0xa1ca('0x3a'),_0xa1ca('0x69'),_0xa1ca('0x6a'),_0xa1ca('0x6b'),_0xa1ca('0x6c'),'impact',_0xa1ca('0x6d'),_0xa1ca('0x6e'),_0xa1ca('0x6f'),_0xa1ca('0x70'),_0xa1ca('0x71'),_0xa1ca('0x72'),_0xa1ca('0x73'),'expected_start','opened_at',_0xa1ca('0x74'),_0xa1ca('0x75'),'work_end',_0xa1ca('0x76'),_0xa1ca('0x77'),_0xa1ca('0x78'),'approval_set','subcategory','work_notes',_0xa1ca('0x79'),_0xa1ca('0x7a'),_0xa1ca('0x7b'),_0xa1ca('0x7c'),_0xa1ca('0x7d'),_0xa1ca('0x7e'),_0xa1ca('0x7f'),_0xa1ca('0x80'),_0xa1ca('0x81'),'calendar_duration',_0xa1ca('0x59'),_0xa1ca('0x82'),_0xa1ca('0x83'),_0xa1ca('0x84'),'follow_up',_0xa1ca('0x85'),_0xa1ca('0x86'),'contact_type',_0xa1ca('0x87'),_0xa1ca('0x88'),_0xa1ca('0x89'),'problem_id',_0xa1ca('0x8a'),_0xa1ca('0x8b'),'activity_due',_0xa1ca('0x8c'),_0xa1ca('0x5a'),_0xa1ca('0x8d'),_0xa1ca('0x8e'),'approval',_0xa1ca('0x8f'),_0xa1ca('0x90'),_0xa1ca('0x91'),_0xa1ca('0x92'),'sys_tags',_0xa1ca('0x93'),'upon_approval',_0xa1ca('0x94'),_0xa1ca('0x95'),_0xa1ca('0x5b')];var _0x3f1473='';var _0x1074cd='';var _0x424d5f=[];var _0x27d206='';var _0x523006='';var _0x51c4e3=[];var _0x153cf7='';var _0x1f8998='';var _0x1d7c86={};var _0x191892='';return db[_0xa1ca('0x2b')][_0xa1ca('0x4b')]({'where':{'id':_0x1f9bee[_0xa1ca('0x43')]['id']},'attributes':['id',_0xa1ca('0x96'),_0xa1ca('0x97'),_0xa1ca('0x98'),'remoteUri',_0xa1ca('0x99')]})[_0xa1ca('0x26')](handleEntityNotFound(_0x318849,null))['then'](function(_0x4ee47d){if(_0x4ee47d){_0x191892=_0x4ee47d[_0xa1ca('0x9a')];var _0x573982=_0x191892[_0xa1ca('0x9b')](-0x1);if(_0x573982==='/'){_0x191892=_0x191892[_0xa1ca('0x9c')](0x0,_0x191892[_0xa1ca('0x9d')](_0x573982));}_0x1f8998=util['format'](_0xa1ca('0x9e'),_0x191892);_0x153cf7=util[_0xa1ca('0x9f')](_0xa1ca('0xa0'),_0x191892);_0x1d7c86={'user':_0x4ee47d[_0xa1ca('0x96')],'pass':_0x4ee47d[_0xa1ca('0x97')]};var _0x4e5490={'method':_0xa1ca('0xa1'),'uri':_0x1f8998+_0xa1ca('0xa2'),'auth':_0x1d7c86,'json':!![]};return rp(_0x4e5490);}})[_0xa1ca('0x26')](function(_0x1ca34a){if(_0x1ca34a[_0xa1ca('0xa3')]['length']>0x0){_0x3f1473=_0x1ca34a[_0xa1ca('0xa3')];}console[_0xa1ca('0xa4')](_0xa1ca('0xa5'),_0x3f1473);_0x51c4e3=[];_0x1074cd=Object[_0xa1ca('0xa6')]([],_0x3f1473);_[_0xa1ca('0xa7')](_0x1074cd,function(_0x344037){return!_0x16a273['includes'](_0x344037['name']);});_0x1074cd[_0xa1ca('0xa8')](function(_0x2b696b){var _0x55015a=createFieldObject(_0x153cf7,_0x1d7c86,_0x2b696b[_0xa1ca('0xa9')],_0x2b696b['name'],_0x2b696b[_0xa1ca('0xaa')],![]);_0x51c4e3[_0xa1ca('0xab')](_0x55015a);});return Promise['all'](_0x51c4e3);})[_0xa1ca('0x26')](function(_0x9086c9){_0x424d5f=_0x9086c9;_0x27d206=Object['assign']([],_0x3f1473);console[_0xa1ca('0xa4')](_0xa1ca('0xac'),_0x3f1473);_[_0xa1ca('0xa7')](_0x27d206,function(_0x6ad41d){return _0x194d19[_0xa1ca('0xad')](_0x6ad41d[_0xa1ca('0x29')]);});console[_0xa1ca('0xa4')](_0xa1ca('0xae'),_0x27d206);_0x51c4e3=[];_0x27d206['forEach'](function(_0x418558){var _0x378940=createFieldObject(_0x153cf7,_0x1d7c86,_0x418558[_0xa1ca('0xa9')],_0x418558[_0xa1ca('0x29')],_0x418558[_0xa1ca('0xaa')],!![]);_0x51c4e3[_0xa1ca('0xab')](_0x378940);});return Promise[_0xa1ca('0xaf')](_0x51c4e3);})[_0xa1ca('0x26')](function(_0x7cfb33){_0x523006=_0x7cfb33;var _0x2de1a6=_0x424d5f[_0xa1ca('0xb0')](_0x523006);return{'count':_0x2de1a6[_0xa1ca('0x37')],'rows':_0x2de1a6};})['then'](respondWithResult(_0x318849,null))[_0xa1ca('0x48')](function(_0x2674fe){console[_0xa1ca('0xa4')](_0xa1ca('0xb1')+_0x2674fe);var _0x195f65=_0x1f9bee[_0xa1ca('0x31')]['test']?0x1f4:_0x2674fe['statusCode']||0x1f4;logger[_0xa1ca('0x28')](_0x2674fe[_0xa1ca('0xb2')]);delete _0x2674fe['name'];if(_0x195f65===0x191){_0x195f65=0x190;}_0x318849['status'](_0x195f65)[_0xa1ca('0xb3')](_0x1f9bee[_0xa1ca('0x31')][_0xa1ca('0xb4')]?{'message':'Wrong\x20credentials','statusCode':_0x2674fe[_0xa1ca('0xb5')]}:_0x2674fe);});};function createFieldObject(_0x202a4e,_0xf85cb2,_0x513089,_0x1b9129,_0x1e9836,_0x44e1ce){return new Promise(function(_0x2a81e6,_0x3ab078){var _0x169a9f={'id':_0x1b9129,'name':_0x1e9836,'custom':_0x44e1ce};if(_0x513089===_0xa1ca('0xb6')){_0x169a9f[_0xa1ca('0x44')]=[{'name':_0xa1ca('0xb7'),'value':_0xa1ca('0xb8')},{'name':_0xa1ca('0xb9'),'value':_0xa1ca('0xba')}];_0x2a81e6(_0x169a9f);}else{var _0x182ea9={'method':'GET','uri':_0x202a4e+_0xa1ca('0xbb')+_0x1b9129,'auth':_0xf85cb2,'json':!![]};return rp(_0x182ea9)['then'](function(_0x24a2ec){var _0xd41cc2=[];if(_0x24a2ec['result']['length']>0x0){_0x24a2ec[_0xa1ca('0xa3')]['forEach'](function(_0x3fb0ad){if(_0x3fb0ad['inactive']===_0xa1ca('0xba')){var _0x3a9933={'name':_0x3fb0ad[_0xa1ca('0xaa')],'value':_0x3fb0ad[_0xa1ca('0xbc')]};_0xd41cc2[_0xa1ca('0xab')](_0x3a9933);}});}_0x169a9f[_0xa1ca('0x44')]=_0xd41cc2;if(_0x169a9f[_0xa1ca('0x44')][_0xa1ca('0x37')]>0x0){_0x2a81e6(_0x169a9f);}else{if(_0x44e1ce==![]){_0x2a81e6();}else{_0x2a81e6(_0x169a9f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9cdbb71..5b1e773 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(_0xef34c5,_0xd17a9d){var _0x1de207=function(_0x3e8169){while(--_0x3e8169){_0xef34c5['push'](_0xef34c5['shift']());}};_0x1de207(++_0xd17a9d);}(_0x2675,0x75));var _0x5267=function(_0x411ee3,_0x4a8b80){_0x411ee3=_0x411ee3-0x0;var _0x2f4597=_0x2675[_0x411ee3];return _0x2f4597;};'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 _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2c4627,_0x1c9116){var _0x30e6ee=function(_0x556195){while(--_0x556195){_0x2c4627['push'](_0x2c4627['shift']());}};_0x30e6ee(++_0x1c9116);}(_0x687b,0x14a));var _0xb687=function(_0x45fbc7,_0x2cf50d){_0x45fbc7=_0x45fbc7-0x0;var _0x392cfd=_0x687b[_0x45fbc7];return _0x392cfd;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'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 3b925c0..b7a8bbf 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 _0x8b3e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','include','map','attributes','model','then','debug','ShowServicenowAccount','find','lodash','util','moment'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x8b3e,0x1c5));var _0xe8b3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe8b3('0x0'));var util=require(_0xe8b3('0x1'));var moment=require(_0xe8b3('0x2'));var BPromise=require(_0xe8b3('0x3'));var rs=require(_0xe8b3('0x4'));var fs=require('fs');var Redis=require(_0xe8b3('0x5'));var db=require(_0xe8b3('0x6'))['db'];var utils=require(_0xe8b3('0x7'));var logger=require(_0xe8b3('0x8'))(_0xe8b3('0x9'));var config=require(_0xe8b3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe8b3('0xb')][_0xe8b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21aab4,_0x3ad777,_0x310e52){return new BPromise(function(_0xec3dd3,_0x3035ce){return client[_0xe8b3('0xd')](_0x21aab4,_0x310e52)['then'](function(_0x3cec2d){logger[_0xe8b3('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x3ad777,'request\x20sent');logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3ad777,'request\x20sent',JSON[_0xe8b3('0xf')](_0x3cec2d));if(_0x3cec2d[_0xe8b3('0x10')]){if(_0x3cec2d[_0xe8b3('0x10')][_0xe8b3('0x11')]===0x1f4){logger[_0xe8b3('0x10')](_0xe8b3('0x12'),_0x3ad777,_0x3cec2d[_0xe8b3('0x10')][_0xe8b3('0x13')]);return _0x3035ce(_0x3cec2d[_0xe8b3('0x10')][_0xe8b3('0x13')]);}logger[_0xe8b3('0x10')](_0xe8b3('0x12'),_0x3ad777,_0x3cec2d[_0xe8b3('0x10')][_0xe8b3('0x13')]);return _0xec3dd3(_0x3cec2d[_0xe8b3('0x10')]['message']);}else{logger[_0xe8b3('0xe')](_0xe8b3('0x12'),_0x3ad777,_0xe8b3('0x14'));_0xec3dd3(_0x3cec2d[_0xe8b3('0x15')][_0xe8b3('0x13')]);}})[_0xe8b3('0x16')](function(_0x4dabf7){logger[_0xe8b3('0x10')](_0xe8b3('0x12'),_0x3ad777,_0x4dabf7);_0x3035ce(_0x4dabf7);});});}exports[_0xe8b3('0x17')]=function(_0x3efc36){var _0x36a8bb=this;return new Promise(function(_0x2804a4,_0xd40f70){return db[_0xe8b3('0x18')][_0xe8b3('0x19')]({'raw':_0x3efc36[_0xe8b3('0x1a')]?_0x3efc36[_0xe8b3('0x1a')][_0xe8b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x3efc36['options']?_0x3efc36[_0xe8b3('0x1a')][_0xe8b3('0x1c')]||null:null,'attributes':_0x3efc36[_0xe8b3('0x1a')]?_0x3efc36['options']['attributes']||null:null,'limit':_0x3efc36['options']?_0x3efc36['options'][_0xe8b3('0x1d')]||null:null,'include':_0x3efc36[_0xe8b3('0x1a')]?_0x3efc36['options'][_0xe8b3('0x1e')]?_[_0xe8b3('0x1f')](_0x3efc36[_0xe8b3('0x1a')][_0xe8b3('0x1e')],function(_0x5df835){return{'model':db[_0x5df835['model']],'as':_0x5df835['as'],'attributes':_0x5df835[_0xe8b3('0x20')],'include':_0x5df835[_0xe8b3('0x1e')]?_['map'](_0x5df835['include'],function(_0x2de182){return{'model':db[_0x2de182['model']],'as':_0x2de182['as'],'attributes':_0x2de182[_0xe8b3('0x20')],'include':_0x2de182[_0xe8b3('0x1e')]?_[_0xe8b3('0x1f')](_0x2de182['include'],function(_0x34afd1){return{'model':db[_0x34afd1[_0xe8b3('0x21')]],'as':_0x34afd1['as'],'attributes':_0x34afd1[_0xe8b3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe8b3('0x22')](function(_0x2601e3){logger[_0xe8b3('0xe')]('GetServicenowAccount',_0x3efc36);logger[_0xe8b3('0x23')](_0xe8b3('0x17'),_0x3efc36,JSON[_0xe8b3('0xf')](_0x2601e3));_0x2804a4(_0x2601e3);})[_0xe8b3('0x16')](function(_0x1dff72){logger[_0xe8b3('0x10')]('GetServicenowAccount',_0x1dff72['message'],_0x3efc36);_0xd40f70(_0x36a8bb[_0xe8b3('0x10')](0x1f4,_0x1dff72[_0xe8b3('0x13')]));});});};exports[_0xe8b3('0x24')]=function(_0x5580ae){var _0x5072ec=this;return new Promise(function(_0x54b41b,_0x445331){return db[_0xe8b3('0x18')][_0xe8b3('0x25')]({'raw':_0x5580ae['options']?_0x5580ae['options'][_0xe8b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x5580ae[_0xe8b3('0x1a')]?_0x5580ae[_0xe8b3('0x1a')][_0xe8b3('0x1c')]||null:null,'attributes':_0x5580ae[_0xe8b3('0x1a')]?_0x5580ae[_0xe8b3('0x1a')][_0xe8b3('0x20')]||null:null,'include':_0x5580ae[_0xe8b3('0x1a')]?_0x5580ae[_0xe8b3('0x1a')][_0xe8b3('0x1e')]?_[_0xe8b3('0x1f')](_0x5580ae[_0xe8b3('0x1a')]['include'],function(_0x787e86){return{'model':db[_0x787e86[_0xe8b3('0x21')]],'as':_0x787e86['as'],'attributes':_0x787e86['attributes'],'include':_0x787e86[_0xe8b3('0x1e')]?_['map'](_0x787e86['include'],function(_0x31920a){return{'model':db[_0x31920a[_0xe8b3('0x21')]],'as':_0x31920a['as'],'attributes':_0x31920a['attributes'],'include':_0x31920a[_0xe8b3('0x1e')]?_['map'](_0x31920a[_0xe8b3('0x1e')],function(_0x3a05a5){return{'model':db[_0x3a05a5[_0xe8b3('0x21')]],'as':_0x3a05a5['as'],'attributes':_0x3a05a5[_0xe8b3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe8b3('0x22')](function(_0x36c733){logger['info']('ShowServicenowAccount',_0x5580ae);logger[_0xe8b3('0x23')](_0xe8b3('0x24'),_0x5580ae,JSON[_0xe8b3('0xf')](_0x36c733));_0x54b41b(_0x36c733);})['catch'](function(_0x3c0086){logger[_0xe8b3('0x10')](_0xe8b3('0x24'),_0x3c0086[_0xe8b3('0x13')],_0x5580ae);_0x445331(_0x5072ec[_0xe8b3('0x10')](0x1f4,_0x3c0086[_0xe8b3('0x13')]));});});}; \ No newline at end of file +var _0xffdb=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','findAll','options','raw','limit','include','map','model','attributes','GetServicenowAccount','debug','ShowServicenowAccount','ServicenowAccount','find','where','stringify'];(function(_0x1231c9,_0x15ae6d){var _0x3df06e=function(_0x340001){while(--_0x340001){_0x1231c9['push'](_0x1231c9['shift']());}};_0x3df06e(++_0x15ae6d);}(_0xffdb,0xfd));var _0xbffd=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xffdb[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xbffd('0x0'));var util=require('util');var moment=require(_0xbffd('0x1'));var BPromise=require('bluebird');var rs=require(_0xbffd('0x2'));var fs=require('fs');var Redis=require(_0xbffd('0x3'));var db=require(_0xbffd('0x4'))['db'];var utils=require(_0xbffd('0x5'));var logger=require('../../config/logger')(_0xbffd('0x6'));var config=require(_0xbffd('0x7'));var jayson=require(_0xbffd('0x8'));var client=jayson[_0xbffd('0x9')][_0xbffd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c5034,_0x109be,_0x90b939){return new BPromise(function(_0x5d67e3,_0x3caf5a){return client[_0xbffd('0xb')](_0x1c5034,_0x90b939)[_0xbffd('0xc')](function(_0x379bda){logger['info'](_0xbffd('0xd'),_0x109be,_0xbffd('0xe'));logger['debug'](_0xbffd('0xf'),_0x109be,_0xbffd('0xe'),JSON['stringify'](_0x379bda));if(_0x379bda[_0xbffd('0x10')]){if(_0x379bda[_0xbffd('0x10')]['code']===0x1f4){logger[_0xbffd('0x10')](_0xbffd('0xd'),_0x109be,_0x379bda[_0xbffd('0x10')][_0xbffd('0x11')]);return _0x3caf5a(_0x379bda['error']['message']);}logger[_0xbffd('0x10')](_0xbffd('0xd'),_0x109be,_0x379bda['error']['message']);return _0x5d67e3(_0x379bda[_0xbffd('0x10')]['message']);}else{logger[_0xbffd('0x12')](_0xbffd('0xd'),_0x109be,_0xbffd('0xe'));_0x5d67e3(_0x379bda[_0xbffd('0x13')][_0xbffd('0x11')]);}})['catch'](function(_0x94ae82){logger[_0xbffd('0x10')](_0xbffd('0xd'),_0x109be,_0x94ae82);_0x3caf5a(_0x94ae82);});});}exports['GetServicenowAccount']=function(_0x3d73fc){var _0x17a345=this;return new Promise(function(_0x13b467,_0x1058e8){return db['ServicenowAccount'][_0xbffd('0x14')]({'raw':_0x3d73fc[_0xbffd('0x15')]?_0x3d73fc[_0xbffd('0x15')][_0xbffd('0x16')]===undefined?!![]:![]:!![],'where':_0x3d73fc[_0xbffd('0x15')]?_0x3d73fc[_0xbffd('0x15')]['where']||null:null,'attributes':_0x3d73fc['options']?_0x3d73fc[_0xbffd('0x15')]['attributes']||null:null,'limit':_0x3d73fc['options']?_0x3d73fc['options'][_0xbffd('0x17')]||null:null,'include':_0x3d73fc[_0xbffd('0x15')]?_0x3d73fc[_0xbffd('0x15')][_0xbffd('0x18')]?_[_0xbffd('0x19')](_0x3d73fc[_0xbffd('0x15')]['include'],function(_0x536901){return{'model':db[_0x536901[_0xbffd('0x1a')]],'as':_0x536901['as'],'attributes':_0x536901[_0xbffd('0x1b')],'include':_0x536901[_0xbffd('0x18')]?_[_0xbffd('0x19')](_0x536901[_0xbffd('0x18')],function(_0x5e0be6){return{'model':db[_0x5e0be6[_0xbffd('0x1a')]],'as':_0x5e0be6['as'],'attributes':_0x5e0be6[_0xbffd('0x1b')],'include':_0x5e0be6[_0xbffd('0x18')]?_['map'](_0x5e0be6[_0xbffd('0x18')],function(_0x598584){return{'model':db[_0x598584[_0xbffd('0x1a')]],'as':_0x598584['as'],'attributes':_0x598584['attributes']};}):[]};}):[]};}):[]:[]})[_0xbffd('0xc')](function(_0x5164a5){logger[_0xbffd('0x12')](_0xbffd('0x1c'),_0x3d73fc);logger[_0xbffd('0x1d')](_0xbffd('0x1c'),_0x3d73fc,JSON['stringify'](_0x5164a5));_0x13b467(_0x5164a5);})['catch'](function(_0x8c2b3e){logger[_0xbffd('0x10')]('GetServicenowAccount',_0x8c2b3e[_0xbffd('0x11')],_0x3d73fc);_0x1058e8(_0x17a345[_0xbffd('0x10')](0x1f4,_0x8c2b3e[_0xbffd('0x11')]));});});};exports[_0xbffd('0x1e')]=function(_0x39c620){var _0x19ade0=this;return new Promise(function(_0x1af7ec,_0x32fdbc){return db[_0xbffd('0x1f')][_0xbffd('0x20')]({'raw':_0x39c620['options']?_0x39c620[_0xbffd('0x15')][_0xbffd('0x16')]===undefined?!![]:![]:!![],'where':_0x39c620[_0xbffd('0x15')]?_0x39c620['options'][_0xbffd('0x21')]||null:null,'attributes':_0x39c620['options']?_0x39c620[_0xbffd('0x15')][_0xbffd('0x1b')]||null:null,'include':_0x39c620[_0xbffd('0x15')]?_0x39c620[_0xbffd('0x15')][_0xbffd('0x18')]?_[_0xbffd('0x19')](_0x39c620[_0xbffd('0x15')][_0xbffd('0x18')],function(_0x1d7f1f){return{'model':db[_0x1d7f1f[_0xbffd('0x1a')]],'as':_0x1d7f1f['as'],'attributes':_0x1d7f1f[_0xbffd('0x1b')],'include':_0x1d7f1f['include']?_[_0xbffd('0x19')](_0x1d7f1f[_0xbffd('0x18')],function(_0x56f9c6){return{'model':db[_0x56f9c6[_0xbffd('0x1a')]],'as':_0x56f9c6['as'],'attributes':_0x56f9c6['attributes'],'include':_0x56f9c6[_0xbffd('0x18')]?_[_0xbffd('0x19')](_0x56f9c6[_0xbffd('0x18')],function(_0x5d3fed){return{'model':db[_0x5d3fed[_0xbffd('0x1a')]],'as':_0x5d3fed['as'],'attributes':_0x5d3fed[_0xbffd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbffd('0xc')](function(_0x2c2ca3){logger['info'](_0xbffd('0x1e'),_0x39c620);logger[_0xbffd('0x1d')](_0xbffd('0x1e'),_0x39c620,JSON[_0xbffd('0x22')](_0x2c2ca3));_0x1af7ec(_0x2c2ca3);})[_0xbffd('0x23')](function(_0x5b2f3e){logger[_0xbffd('0x10')]('ShowServicenowAccount',_0x5b2f3e[_0xbffd('0x11')],_0x39c620);_0x32fdbc(_0x19ade0['error'](0x1f4,_0x5b2f3e[_0xbffd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index be60996..21e7ea5 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 _0xbdf4=['/:id/descriptions','getDescriptions','post','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x38fa81,_0x4bfb78){var _0x17af8a=function(_0x15c0cf){while(--_0x15c0cf){_0x38fa81['push'](_0x38fa81['shift']());}};_0x17af8a(++_0x4bfb78);}(_0xbdf4,0x101));var _0x4bdf=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xbdf4[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x4bdf('0x0'));var util=require(_0x4bdf('0x1'));var path=require(_0x4bdf('0x2'));var timeout=require(_0x4bdf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4bdf('0x4'));var auth=require(_0x4bdf('0x5'));var interaction=require(_0x4bdf('0x6'));var config=require(_0x4bdf('0x7'));var controller=require(_0x4bdf('0x8'));router[_0x4bdf('0x9')]('/',auth[_0x4bdf('0xa')](),controller[_0x4bdf('0xb')]);router[_0x4bdf('0x9')](_0x4bdf('0xc'),auth[_0x4bdf('0xa')](),controller[_0x4bdf('0xd')]);router[_0x4bdf('0x9')](_0x4bdf('0xe'),auth['isAuthenticated'](),controller[_0x4bdf('0xf')]);router[_0x4bdf('0x9')](_0x4bdf('0x10'),auth[_0x4bdf('0xa')](),controller[_0x4bdf('0x11')]);router[_0x4bdf('0x9')](_0x4bdf('0x12'),auth['isAuthenticated'](),controller[_0x4bdf('0x13')]);router[_0x4bdf('0x14')]('/',auth[_0x4bdf('0xa')](),controller['create']);router[_0x4bdf('0x15')](_0x4bdf('0xc'),auth[_0x4bdf('0xa')](),controller[_0x4bdf('0x16')]);router[_0x4bdf('0x17')]('/:id',auth[_0x4bdf('0xa')](),controller[_0x4bdf('0x18')]);module['exports']=router; \ No newline at end of file +var _0x8bc1=['create','/:id','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getFields','post'];(function(_0x21c02a,_0x459a1e){var _0x483ca7=function(_0x42cc6b){while(--_0x42cc6b){_0x21c02a['push'](_0x21c02a['shift']());}};_0x483ca7(++_0x459a1e);}(_0x8bc1,0x95));var _0x18bc=function(_0x2d96ec,_0x3e4ed6){_0x2d96ec=_0x2d96ec-0x0;var _0x3eeeaf=_0x8bc1[_0x2d96ec];return _0x3eeeaf;};'use strict';var multer=require(_0x18bc('0x0'));var util=require(_0x18bc('0x1'));var path=require('path');var timeout=require(_0x18bc('0x2'));var express=require('express');var router=express[_0x18bc('0x3')]();var fs_extra=require(_0x18bc('0x4'));var auth=require(_0x18bc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x18bc('0x6'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x18bc('0x7')](),controller[_0x18bc('0x8')]);router[_0x18bc('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x18bc('0x9')](_0x18bc('0xa'),auth[_0x18bc('0x7')](),controller[_0x18bc('0xb')]);router['get']('/:id/subjects',auth[_0x18bc('0x7')](),controller['getSubjects']);router[_0x18bc('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x18bc('0xc')]('/',auth[_0x18bc('0x7')](),controller[_0x18bc('0xd')]);router['put'](_0x18bc('0xe'),auth['isAuthenticated'](),controller[_0x18bc('0xf')]);router[_0x18bc('0x10')]('/:id',auth[_0x18bc('0x7')](),controller[_0x18bc('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 1335fff..d7620ae 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 _0x064a=['sequelize','STRING'];(function(_0x339123,_0x13cf39){var _0x510cdb=function(_0x7d4ce7){while(--_0x7d4ce7){_0x339123['push'](_0x339123['shift']());}};_0x510cdb(++_0x13cf39);}(_0x064a,0x13a));var _0xa064=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x064a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa064('0x0'));module['exports']={'name':{'type':Sequelize[_0xa064('0x1')]},'description':{'type':Sequelize[_0xa064('0x1')]}}; \ No newline at end of file +var _0xd8f8=['sequelize','STRING'];(function(_0x2b9d54,_0x4ad9ee){var _0x3edc0e=function(_0x372425){while(--_0x372425){_0x2b9d54['push'](_0x2b9d54['shift']());}};_0x3edc0e(++_0x4ad9ee);}(_0xd8f8,0x13c));var _0x8d8f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8f8[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x8d8f('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d8f('0x1')]},'description':{'type':Sequelize[_0x8d8f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a05cbc8..5bd9af0 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 _0xdc71=['mustache','util','path','sox','to-csv','ejs','lodash','squel','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','sendStatus','status','offset','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','where','merge','options','ServicenowConfiguration','includeAll','include','catch','show','params','intersection','length','find','create','body','update','getFields','findOne','ServicenowField','order','sort','pick','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x33ef54,_0x241f9f){var _0xd49c20=function(_0x16bb1f){while(--_0x16bb1f){_0x33ef54['push'](_0x33ef54['shift']());}};_0xd49c20(++_0x241f9f);}(_0xdc71,0x1cf));var _0x1dc7=function(_0x25f3e9,_0x29870b){_0x25f3e9=_0x25f3e9-0x0;var _0x1c0b28=_0xdc71[_0x25f3e9];return _0x1c0b28;};'use strict';var emlformat=require(_0x1dc7('0x0'));var rimraf=require(_0x1dc7('0x1'));var zipdir=require(_0x1dc7('0x2'));var jsonpatch=require(_0x1dc7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1dc7('0x4'));var Mustache=require(_0x1dc7('0x5'));var util=require(_0x1dc7('0x6'));var path=require(_0x1dc7('0x7'));var sox=require(_0x1dc7('0x8'));var csv=require(_0x1dc7('0x9'));var ejs=require(_0x1dc7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1dc7('0xb'));var squel=require(_0x1dc7('0xc'));var crypto=require('crypto');var jsforce=require(_0x1dc7('0xd'));var deskjs=require(_0x1dc7('0xe'));var toCsv=require(_0x1dc7('0x9'));var querystring=require(_0x1dc7('0xf'));var Papa=require(_0x1dc7('0x10'));var Redis=require('ioredis');var authService=require(_0x1dc7('0x11'));var qs=require(_0x1dc7('0x12'));var as=require(_0x1dc7('0x13'));var hardwareService=require(_0x1dc7('0x14'));var logger=require(_0x1dc7('0x15'))(_0x1dc7('0x16'));var utils=require('../../config/utils');var config=require(_0x1dc7('0x17'));var licenseUtil=require(_0x1dc7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c5ebf,_0x4aa79b){_0x4aa79b=_0x4aa79b||0xcc;return function(_0x13ec0e){if(_0x13ec0e){return _0x4c5ebf[_0x1dc7('0x19')](_0x4aa79b);}return _0x4c5ebf[_0x1dc7('0x1a')](_0x4aa79b)['end']();};}function respondWithResult(_0x442c1f,_0x7d4367){_0x7d4367=_0x7d4367||0xc8;return function(_0x4bab72){if(_0x4bab72){return _0x442c1f['status'](_0x7d4367)['json'](_0x4bab72);}};}function respondWithFilteredResult(_0x226964,_0x44893a){return function(_0xc43965){if(_0xc43965){var _0x2ecbe4=typeof _0x44893a[_0x1dc7('0x1b')]==='undefined'&&typeof _0x44893a[_0x1dc7('0x1c')]==='undefined';var _0x359617=_0xc43965[_0x1dc7('0x1d')];var _0x34f166=_0x2ecbe4?0x0:_0x44893a['offset'];var _0x52f2b1=_0x2ecbe4?_0xc43965[_0x1dc7('0x1d')]:_0x44893a['offset']+_0x44893a[_0x1dc7('0x1c')];var _0x4765af;if(_0x52f2b1>=_0x359617){_0x52f2b1=_0x359617;_0x4765af=0xc8;}else{_0x4765af=0xce;}_0x226964['status'](_0x4765af);return _0x226964[_0x1dc7('0x1e')](_0x1dc7('0x1f'),_0x34f166+'-'+_0x52f2b1+'/'+_0x359617)['json'](_0xc43965);}return null;};}function patchUpdates(_0xd490a6){return function(_0x577ed5){try{jsonpatch[_0x1dc7('0x20')](_0x577ed5,_0xd490a6,!![]);}catch(_0x1f1885){return BPromise['reject'](_0x1f1885);}return _0x577ed5[_0x1dc7('0x21')]();};}function saveUpdates(_0x427e58,_0x1784ad){return function(_0x4c3943){if(_0x4c3943){return _0x4c3943['update'](_0x427e58)[_0x1dc7('0x22')](function(_0x401b17){return _0x401b17;});}return null;};}function removeEntity(_0x20d253,_0x29c845){return function(_0x50c1bc){if(_0x50c1bc){return _0x50c1bc[_0x1dc7('0x23')]()['then'](function(){_0x20d253[_0x1dc7('0x1a')](0xcc)[_0x1dc7('0x24')]();});}};}function handleEntityNotFound(_0x6db4e5,_0x38a282){return function(_0x2ca5a0){if(!_0x2ca5a0){_0x6db4e5[_0x1dc7('0x19')](0x194);}return _0x2ca5a0;};}function handleError(_0xdf40c3,_0x2947e2){_0x2947e2=_0x2947e2||0x1f4;return function(_0x453ba7){logger[_0x1dc7('0x25')](_0x453ba7[_0x1dc7('0x26')]);if(_0x453ba7[_0x1dc7('0x27')]){delete _0x453ba7['name'];}_0xdf40c3['status'](_0x2947e2)['send'](_0x453ba7);};}exports[_0x1dc7('0x28')]=function(_0x544d87,_0x514680){var _0x2a3a93={},_0x4cbb36={},_0x522982={'count':0x0,'rows':[]};var _0x474fa7=_['map'](db['ServicenowConfiguration'][_0x1dc7('0x29')],function(_0x111ff3){return{'name':_0x111ff3[_0x1dc7('0x2a')],'type':_0x111ff3[_0x1dc7('0x2b')][_0x1dc7('0x2c')]};});_0x4cbb36[_0x1dc7('0x2d')]=_[_0x1dc7('0x2e')](_0x474fa7,_0x1dc7('0x27'));_0x4cbb36[_0x1dc7('0x2f')]=_[_0x1dc7('0x30')](_0x544d87[_0x1dc7('0x2f')]);_0x4cbb36[_0x1dc7('0x31')]=_['intersection'](_0x4cbb36[_0x1dc7('0x2d')],_0x4cbb36['query']);_0x2a3a93[_0x1dc7('0x32')]=_['intersection'](_0x4cbb36['model'],qs[_0x1dc7('0x33')](_0x544d87[_0x1dc7('0x2f')][_0x1dc7('0x33')]));_0x2a3a93['attributes']=_0x2a3a93['attributes']['length']?_0x2a3a93[_0x1dc7('0x32')]:_0x4cbb36[_0x1dc7('0x2d')];if(!_0x544d87[_0x1dc7('0x2f')][_0x1dc7('0x34')](_0x1dc7('0x35'))){_0x2a3a93[_0x1dc7('0x1c')]=qs[_0x1dc7('0x1c')](_0x544d87['query'][_0x1dc7('0x1c')]);_0x2a3a93[_0x1dc7('0x1b')]=qs[_0x1dc7('0x1b')](_0x544d87[_0x1dc7('0x2f')][_0x1dc7('0x1b')]);}_0x2a3a93['order']=qs['sort'](_0x544d87['query']['sort']);_0x2a3a93[_0x1dc7('0x36')]=qs[_0x1dc7('0x31')](_['pick'](_0x544d87[_0x1dc7('0x2f')],_0x4cbb36[_0x1dc7('0x31')]),_0x474fa7);if(_0x544d87['query']['filter']){_0x2a3a93['where']=_['merge'](_0x2a3a93[_0x1dc7('0x36')],{'$or':_[_0x1dc7('0x2e')](_0x474fa7,function(_0x54eaa8){if(_0x54eaa8[_0x1dc7('0x2b')]!=='VIRTUAL'){var _0x250d55={};_0x250d55[_0x54eaa8[_0x1dc7('0x27')]]={'$like':'%'+_0x544d87[_0x1dc7('0x2f')]['filter']+'%'};return _0x250d55;}})});}_0x2a3a93=_[_0x1dc7('0x37')]({},_0x2a3a93,_0x544d87[_0x1dc7('0x38')]);var _0x505ae4={'where':_0x2a3a93[_0x1dc7('0x36')]};return db[_0x1dc7('0x39')]['count'](_0x505ae4)[_0x1dc7('0x22')](function(_0x1e0a90){_0x522982[_0x1dc7('0x1d')]=_0x1e0a90;if(_0x544d87[_0x1dc7('0x2f')][_0x1dc7('0x3a')]){_0x2a3a93[_0x1dc7('0x3b')]=[{'all':!![]}];}return db[_0x1dc7('0x39')]['findAll'](_0x2a3a93);})['then'](function(_0x4c3104){_0x522982['rows']=_0x4c3104;return _0x522982;})[_0x1dc7('0x22')](respondWithFilteredResult(_0x514680,_0x2a3a93))[_0x1dc7('0x3c')](handleError(_0x514680,null));};exports[_0x1dc7('0x3d')]=function(_0x2a3e31,_0x6f7ae7){var _0x525ca4={'raw':![],'where':{'id':_0x2a3e31[_0x1dc7('0x3e')]['id']}},_0x158c7c={};_0x158c7c[_0x1dc7('0x2d')]=_[_0x1dc7('0x30')](db[_0x1dc7('0x39')][_0x1dc7('0x29')]);_0x158c7c[_0x1dc7('0x2f')]=_['keys'](_0x2a3e31['query']);_0x158c7c['filters']=_[_0x1dc7('0x3f')](_0x158c7c[_0x1dc7('0x2d')],_0x158c7c['query']);_0x525ca4['attributes']=_['intersection'](_0x158c7c[_0x1dc7('0x2d')],qs[_0x1dc7('0x33')](_0x2a3e31[_0x1dc7('0x2f')][_0x1dc7('0x33')]));_0x525ca4['attributes']=_0x525ca4[_0x1dc7('0x32')][_0x1dc7('0x40')]?_0x525ca4[_0x1dc7('0x32')]:_0x158c7c[_0x1dc7('0x2d')];if(_0x2a3e31[_0x1dc7('0x2f')][_0x1dc7('0x3a')]){_0x525ca4[_0x1dc7('0x3b')]=[{'all':!![]}];}_0x525ca4=_[_0x1dc7('0x37')]({},_0x525ca4,_0x2a3e31[_0x1dc7('0x38')]);return db[_0x1dc7('0x39')][_0x1dc7('0x41')](_0x525ca4)[_0x1dc7('0x22')](handleEntityNotFound(_0x6f7ae7,null))['then'](respondWithResult(_0x6f7ae7,null))[_0x1dc7('0x3c')](handleError(_0x6f7ae7,null));};exports[_0x1dc7('0x42')]=function(_0x8b9b78,_0x405402){return db[_0x1dc7('0x39')]['create'](_0x8b9b78[_0x1dc7('0x43')],{})[_0x1dc7('0x22')](respondWithResult(_0x405402,0xc9))[_0x1dc7('0x3c')](handleError(_0x405402,null));};exports[_0x1dc7('0x44')]=function(_0x2f6455,_0x1d7883){if(_0x2f6455[_0x1dc7('0x43')]['id']){delete _0x2f6455[_0x1dc7('0x43')]['id'];}return db[_0x1dc7('0x39')][_0x1dc7('0x41')]({'where':{'id':_0x2f6455[_0x1dc7('0x3e')]['id']}})[_0x1dc7('0x22')](handleEntityNotFound(_0x1d7883,null))[_0x1dc7('0x22')](saveUpdates(_0x2f6455[_0x1dc7('0x43')],null))[_0x1dc7('0x22')](respondWithResult(_0x1d7883,null))['catch'](handleError(_0x1d7883,null));};exports[_0x1dc7('0x23')]=function(_0x353c4b,_0x12b002){return db[_0x1dc7('0x39')][_0x1dc7('0x41')]({'where':{'id':_0x353c4b[_0x1dc7('0x3e')]['id']}})[_0x1dc7('0x22')](handleEntityNotFound(_0x12b002,null))[_0x1dc7('0x22')](removeEntity(_0x12b002,null))['catch'](handleError(_0x12b002,null));};exports[_0x1dc7('0x45')]=function(_0x5a84ed,_0x30baf6,_0x46b474){var _0x27f073={};var _0x261bd5={};var _0x330e77;var _0x443858;return db[_0x1dc7('0x39')][_0x1dc7('0x46')]({'where':{'id':_0x5a84ed[_0x1dc7('0x3e')]['id']}})[_0x1dc7('0x22')](handleEntityNotFound(_0x30baf6,null))[_0x1dc7('0x22')](function(_0x2f407c){if(_0x2f407c){_0x330e77=_0x2f407c;_0x261bd5['model']=_[_0x1dc7('0x30')](db[_0x1dc7('0x47')][_0x1dc7('0x29')]);_0x261bd5[_0x1dc7('0x2f')]=_[_0x1dc7('0x30')](_0x5a84ed[_0x1dc7('0x2f')]);_0x261bd5[_0x1dc7('0x31')]=_[_0x1dc7('0x3f')](_0x261bd5[_0x1dc7('0x2d')],_0x261bd5[_0x1dc7('0x2f')]);_0x27f073[_0x1dc7('0x32')]=_['intersection'](_0x261bd5[_0x1dc7('0x2d')],qs[_0x1dc7('0x33')](_0x5a84ed['query'][_0x1dc7('0x33')]));_0x27f073['attributes']=_0x27f073['attributes']['length']?_0x27f073[_0x1dc7('0x32')]:_0x261bd5['model'];_0x27f073[_0x1dc7('0x48')]=qs['sort'](_0x5a84ed[_0x1dc7('0x2f')][_0x1dc7('0x49')]);_0x27f073[_0x1dc7('0x36')]=qs[_0x1dc7('0x31')](_[_0x1dc7('0x4a')](_0x5a84ed['query'],_0x261bd5[_0x1dc7('0x31')]));if(_0x5a84ed[_0x1dc7('0x2f')][_0x1dc7('0x4b')]){_0x27f073['where']=_[_0x1dc7('0x37')](_0x27f073[_0x1dc7('0x36')],{'$or':_[_0x1dc7('0x2e')](_0x27f073[_0x1dc7('0x32')],function(_0x4527a7){var _0x15e112={};_0x15e112[_0x4527a7]={'$like':'%'+_0x5a84ed[_0x1dc7('0x2f')]['filter']+'%'};return _0x15e112;})});}_0x27f073=_['merge']({},_0x27f073,_0x5a84ed[_0x1dc7('0x38')]);return _0x330e77[_0x1dc7('0x45')](_0x27f073);}})[_0x1dc7('0x22')](function(_0x569d12){if(_0x569d12){_0x443858=_0x569d12[_0x1dc7('0x40')];if(!_0x5a84ed[_0x1dc7('0x2f')][_0x1dc7('0x34')](_0x1dc7('0x35'))){_0x27f073['limit']=qs[_0x1dc7('0x1c')](_0x5a84ed['query']['limit']);_0x27f073[_0x1dc7('0x1b')]=qs[_0x1dc7('0x1b')](_0x5a84ed[_0x1dc7('0x2f')]['offset']);}return _0x330e77[_0x1dc7('0x45')](_0x27f073);}})['then'](function(_0x3aa7e4){if(_0x3aa7e4){return _0x3aa7e4?{'count':_0x443858,'rows':_0x3aa7e4}:null;}})[_0x1dc7('0x22')](respondWithResult(_0x30baf6,null))[_0x1dc7('0x3c')](handleError(_0x30baf6,null));};exports[_0x1dc7('0x4c')]=function(_0x512451,_0xf56ece,_0x1c7ee7){var _0x274398={};var _0x1b136f={};var _0x36a55f;var _0x4178c0;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x512451[_0x1dc7('0x3e')]['id']}})[_0x1dc7('0x22')](handleEntityNotFound(_0xf56ece,null))['then'](function(_0x4e76e5){if(_0x4e76e5){_0x36a55f=_0x4e76e5;_0x1b136f[_0x1dc7('0x2d')]=_[_0x1dc7('0x30')](db[_0x1dc7('0x47')][_0x1dc7('0x29')]);_0x1b136f[_0x1dc7('0x2f')]=_[_0x1dc7('0x30')](_0x512451[_0x1dc7('0x2f')]);_0x1b136f['filters']=_[_0x1dc7('0x3f')](_0x1b136f[_0x1dc7('0x2d')],_0x1b136f['query']);_0x274398[_0x1dc7('0x32')]=_['intersection'](_0x1b136f[_0x1dc7('0x2d')],qs[_0x1dc7('0x33')](_0x512451[_0x1dc7('0x2f')]['fields']));_0x274398[_0x1dc7('0x32')]=_0x274398[_0x1dc7('0x32')][_0x1dc7('0x40')]?_0x274398['attributes']:_0x1b136f['model'];_0x274398[_0x1dc7('0x48')]=qs['sort'](_0x512451[_0x1dc7('0x2f')]['sort']);_0x274398[_0x1dc7('0x36')]=qs[_0x1dc7('0x31')](_['pick'](_0x512451[_0x1dc7('0x2f')],_0x1b136f[_0x1dc7('0x31')]));if(_0x512451['query'][_0x1dc7('0x4b')]){_0x274398[_0x1dc7('0x36')]=_[_0x1dc7('0x37')](_0x274398[_0x1dc7('0x36')],{'$or':_[_0x1dc7('0x2e')](_0x274398[_0x1dc7('0x32')],function(_0x3fe6b4){var _0x5c10e4={};_0x5c10e4[_0x3fe6b4]={'$like':'%'+_0x512451[_0x1dc7('0x2f')][_0x1dc7('0x4b')]+'%'};return _0x5c10e4;})});}_0x274398=_['merge']({},_0x274398,_0x512451['options']);return _0x36a55f[_0x1dc7('0x4c')](_0x274398);}})[_0x1dc7('0x22')](function(_0x1ea5a1){if(_0x1ea5a1){_0x4178c0=_0x1ea5a1[_0x1dc7('0x40')];if(!_0x512451[_0x1dc7('0x2f')][_0x1dc7('0x34')](_0x1dc7('0x35'))){_0x274398[_0x1dc7('0x1c')]=qs[_0x1dc7('0x1c')](_0x512451[_0x1dc7('0x2f')][_0x1dc7('0x1c')]);_0x274398[_0x1dc7('0x1b')]=qs[_0x1dc7('0x1b')](_0x512451[_0x1dc7('0x2f')][_0x1dc7('0x1b')]);}return _0x36a55f['getSubjects'](_0x274398);}})[_0x1dc7('0x22')](function(_0x389321){if(_0x389321){return _0x389321?{'count':_0x4178c0,'rows':_0x389321}:null;}})['then'](respondWithResult(_0xf56ece,null))[_0x1dc7('0x3c')](handleError(_0xf56ece,null));};exports[_0x1dc7('0x4d')]=function(_0x519baf,_0x42fe6b,_0x247d8a){var _0x3bd259={};var _0x1d8f1f={};var _0x53dbd1;var _0x263052;return db[_0x1dc7('0x39')]['findOne']({'where':{'id':_0x519baf['params']['id']}})[_0x1dc7('0x22')](handleEntityNotFound(_0x42fe6b,null))[_0x1dc7('0x22')](function(_0xc13c6d){if(_0xc13c6d){_0x53dbd1=_0xc13c6d;_0x1d8f1f[_0x1dc7('0x2d')]=_[_0x1dc7('0x30')](db[_0x1dc7('0x47')]['rawAttributes']);_0x1d8f1f[_0x1dc7('0x2f')]=_[_0x1dc7('0x30')](_0x519baf[_0x1dc7('0x2f')]);_0x1d8f1f[_0x1dc7('0x31')]=_['intersection'](_0x1d8f1f['model'],_0x1d8f1f[_0x1dc7('0x2f')]);_0x3bd259[_0x1dc7('0x32')]=_[_0x1dc7('0x3f')](_0x1d8f1f[_0x1dc7('0x2d')],qs[_0x1dc7('0x33')](_0x519baf['query'][_0x1dc7('0x33')]));_0x3bd259[_0x1dc7('0x32')]=_0x3bd259['attributes'][_0x1dc7('0x40')]?_0x3bd259[_0x1dc7('0x32')]:_0x1d8f1f['model'];_0x3bd259[_0x1dc7('0x48')]=qs[_0x1dc7('0x49')](_0x519baf['query'][_0x1dc7('0x49')]);_0x3bd259[_0x1dc7('0x36')]=qs['filters'](_[_0x1dc7('0x4a')](_0x519baf[_0x1dc7('0x2f')],_0x1d8f1f[_0x1dc7('0x31')]));if(_0x519baf[_0x1dc7('0x2f')][_0x1dc7('0x4b')]){_0x3bd259[_0x1dc7('0x36')]=_[_0x1dc7('0x37')](_0x3bd259['where'],{'$or':_[_0x1dc7('0x2e')](_0x3bd259['attributes'],function(_0x36a609){var _0x48e166={};_0x48e166[_0x36a609]={'$like':'%'+_0x519baf[_0x1dc7('0x2f')][_0x1dc7('0x4b')]+'%'};return _0x48e166;})});}_0x3bd259=_[_0x1dc7('0x37')]({},_0x3bd259,_0x519baf['options']);return _0x53dbd1[_0x1dc7('0x4d')](_0x3bd259);}})[_0x1dc7('0x22')](function(_0x578296){if(_0x578296){_0x263052=_0x578296[_0x1dc7('0x40')];if(!_0x519baf['query'][_0x1dc7('0x34')]('nolimit')){_0x3bd259['limit']=qs[_0x1dc7('0x1c')](_0x519baf[_0x1dc7('0x2f')][_0x1dc7('0x1c')]);_0x3bd259[_0x1dc7('0x1b')]=qs[_0x1dc7('0x1b')](_0x519baf[_0x1dc7('0x2f')]['offset']);}return _0x53dbd1['getDescriptions'](_0x3bd259);}})[_0x1dc7('0x22')](function(_0x508b17){if(_0x508b17){return _0x508b17?{'count':_0x263052,'rows':_0x508b17}:null;}})[_0x1dc7('0x22')](respondWithResult(_0x42fe6b,null))[_0x1dc7('0x3c')](handleError(_0x42fe6b,null));}; \ No newline at end of file +var _0xeca8=['VIRTUAL','include','findAll','rows','show','params','includeAll','find','catch','create','body','update','getFields','ServicenowField','rawAttributes','pick','options','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','destroy','then','error','stack','name','send','index','map','ServicenowConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge'];(function(_0x5eaefe,_0xc72159){var _0xe64929=function(_0x15f626){while(--_0x15f626){_0x5eaefe['push'](_0x5eaefe['shift']());}};_0xe64929(++_0xc72159);}(_0xeca8,0xbd));var _0x8eca=function(_0x365bbd,_0x105785){_0x365bbd=_0x365bbd-0x0;var _0x10f084=_0xeca8[_0x365bbd];return _0x10f084;};'use strict';var emlformat=require(_0x8eca('0x0'));var rimraf=require(_0x8eca('0x1'));var zipdir=require(_0x8eca('0x2'));var jsonpatch=require(_0x8eca('0x3'));var rp=require(_0x8eca('0x4'));var moment=require('moment');var BPromise=require(_0x8eca('0x5'));var Mustache=require(_0x8eca('0x6'));var util=require('util');var path=require(_0x8eca('0x7'));var sox=require(_0x8eca('0x8'));var csv=require('to-csv');var ejs=require(_0x8eca('0x9'));var fs=require('fs');var fs_extra=require(_0x8eca('0xa'));var _=require(_0x8eca('0xb'));var squel=require(_0x8eca('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eca('0xd'));var deskjs=require(_0x8eca('0xe'));var toCsv=require(_0x8eca('0xf'));var querystring=require(_0x8eca('0x10'));var Papa=require(_0x8eca('0x11'));var Redis=require(_0x8eca('0x12'));var authService=require(_0x8eca('0x13'));var qs=require(_0x8eca('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8eca('0x15'));var logger=require(_0x8eca('0x16'))('api');var utils=require(_0x8eca('0x17'));var config=require(_0x8eca('0x18'));var licenseUtil=require(_0x8eca('0x19'));var db=require(_0x8eca('0x1a'))['db'];function respondWithStatusCode(_0x2fed22,_0x17117a){_0x17117a=_0x17117a||0xcc;return function(_0x38766e){if(_0x38766e){return _0x2fed22[_0x8eca('0x1b')](_0x17117a);}return _0x2fed22[_0x8eca('0x1c')](_0x17117a)[_0x8eca('0x1d')]();};}function respondWithResult(_0x511f2a,_0x473c64){_0x473c64=_0x473c64||0xc8;return function(_0x37f607){if(_0x37f607){return _0x511f2a[_0x8eca('0x1c')](_0x473c64)['json'](_0x37f607);}};}function respondWithFilteredResult(_0xd31854,_0x254f9a){return function(_0x2a921a){if(_0x2a921a){var _0x762110=typeof _0x254f9a[_0x8eca('0x1e')]===_0x8eca('0x1f')&&typeof _0x254f9a[_0x8eca('0x20')]===_0x8eca('0x1f');var _0x6a2393=_0x2a921a[_0x8eca('0x21')];var _0x294733=_0x762110?0x0:_0x254f9a[_0x8eca('0x1e')];var _0x2dade8=_0x762110?_0x2a921a[_0x8eca('0x21')]:_0x254f9a[_0x8eca('0x1e')]+_0x254f9a['limit'];var _0x5a9f38;if(_0x2dade8>=_0x6a2393){_0x2dade8=_0x6a2393;_0x5a9f38=0xc8;}else{_0x5a9f38=0xce;}_0xd31854[_0x8eca('0x1c')](_0x5a9f38);return _0xd31854[_0x8eca('0x22')]('Content-Range',_0x294733+'-'+_0x2dade8+'/'+_0x6a2393)[_0x8eca('0x23')](_0x2a921a);}return null;};}function patchUpdates(_0x3c818b){return function(_0x3869df){try{jsonpatch[_0x8eca('0x24')](_0x3869df,_0x3c818b,!![]);}catch(_0x44a0e3){return BPromise['reject'](_0x44a0e3);}return _0x3869df[_0x8eca('0x25')]();};}function saveUpdates(_0x58dc29,_0x57f4cf){return function(_0x5628ca){if(_0x5628ca){return _0x5628ca['update'](_0x58dc29)['then'](function(_0x1fc33b){return _0x1fc33b;});}return null;};}function removeEntity(_0xce539a,_0x1a4e54){return function(_0x25d0d1){if(_0x25d0d1){return _0x25d0d1[_0x8eca('0x26')]()[_0x8eca('0x27')](function(){_0xce539a['status'](0xcc)[_0x8eca('0x1d')]();});}};}function handleEntityNotFound(_0x3a2151,_0x44b5d6){return function(_0x1cdfcf){if(!_0x1cdfcf){_0x3a2151[_0x8eca('0x1b')](0x194);}return _0x1cdfcf;};}function handleError(_0x1ffc28,_0x14e564){_0x14e564=_0x14e564||0x1f4;return function(_0x14b881){logger[_0x8eca('0x28')](_0x14b881[_0x8eca('0x29')]);if(_0x14b881[_0x8eca('0x2a')]){delete _0x14b881['name'];}_0x1ffc28[_0x8eca('0x1c')](_0x14e564)[_0x8eca('0x2b')](_0x14b881);};}exports[_0x8eca('0x2c')]=function(_0x15a1f1,_0x27452c){var _0x15bbac={},_0x4f7dd7={},_0xb44fdf={'count':0x0,'rows':[]};var _0x41bf32=_[_0x8eca('0x2d')](db[_0x8eca('0x2e')]['rawAttributes'],function(_0x12eb3b){return{'name':_0x12eb3b['fieldName'],'type':_0x12eb3b[_0x8eca('0x2f')][_0x8eca('0x30')]};});_0x4f7dd7[_0x8eca('0x31')]=_[_0x8eca('0x2d')](_0x41bf32,_0x8eca('0x2a'));_0x4f7dd7[_0x8eca('0x32')]=_[_0x8eca('0x33')](_0x15a1f1[_0x8eca('0x32')]);_0x4f7dd7[_0x8eca('0x34')]=_[_0x8eca('0x35')](_0x4f7dd7[_0x8eca('0x31')],_0x4f7dd7[_0x8eca('0x32')]);_0x15bbac[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x4f7dd7[_0x8eca('0x31')],qs['fields'](_0x15a1f1[_0x8eca('0x32')][_0x8eca('0x37')]));_0x15bbac['attributes']=_0x15bbac['attributes'][_0x8eca('0x38')]?_0x15bbac['attributes']:_0x4f7dd7[_0x8eca('0x31')];if(!_0x15a1f1[_0x8eca('0x32')]['hasOwnProperty'](_0x8eca('0x39'))){_0x15bbac[_0x8eca('0x20')]=qs[_0x8eca('0x20')](_0x15a1f1[_0x8eca('0x32')]['limit']);_0x15bbac[_0x8eca('0x1e')]=qs[_0x8eca('0x1e')](_0x15a1f1[_0x8eca('0x32')][_0x8eca('0x1e')]);}_0x15bbac[_0x8eca('0x3a')]=qs[_0x8eca('0x3b')](_0x15a1f1[_0x8eca('0x32')][_0x8eca('0x3b')]);_0x15bbac[_0x8eca('0x3c')]=qs[_0x8eca('0x34')](_['pick'](_0x15a1f1[_0x8eca('0x32')],_0x4f7dd7[_0x8eca('0x34')]),_0x41bf32);if(_0x15a1f1[_0x8eca('0x32')][_0x8eca('0x3d')]){_0x15bbac['where']=_[_0x8eca('0x3e')](_0x15bbac[_0x8eca('0x3c')],{'$or':_[_0x8eca('0x2d')](_0x41bf32,function(_0x4fb0a1){if(_0x4fb0a1[_0x8eca('0x2f')]!==_0x8eca('0x3f')){var _0x1d67a0={};_0x1d67a0[_0x4fb0a1[_0x8eca('0x2a')]]={'$like':'%'+_0x15a1f1[_0x8eca('0x32')][_0x8eca('0x3d')]+'%'};return _0x1d67a0;}})});}_0x15bbac=_['merge']({},_0x15bbac,_0x15a1f1['options']);var _0x1fc962={'where':_0x15bbac[_0x8eca('0x3c')]};return db['ServicenowConfiguration'][_0x8eca('0x21')](_0x1fc962)[_0x8eca('0x27')](function(_0x2dab6d){_0xb44fdf[_0x8eca('0x21')]=_0x2dab6d;if(_0x15a1f1[_0x8eca('0x32')]['includeAll']){_0x15bbac[_0x8eca('0x40')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8eca('0x41')](_0x15bbac);})['then'](function(_0x14b731){_0xb44fdf[_0x8eca('0x42')]=_0x14b731;return _0xb44fdf;})[_0x8eca('0x27')](respondWithFilteredResult(_0x27452c,_0x15bbac))['catch'](handleError(_0x27452c,null));};exports[_0x8eca('0x43')]=function(_0x101859,_0x5b7f06){var _0x3a9f8c={'raw':![],'where':{'id':_0x101859[_0x8eca('0x44')]['id']}},_0x492c85={};_0x492c85['model']=_[_0x8eca('0x33')](db['ServicenowConfiguration']['rawAttributes']);_0x492c85[_0x8eca('0x32')]=_[_0x8eca('0x33')](_0x101859[_0x8eca('0x32')]);_0x492c85['filters']=_[_0x8eca('0x35')](_0x492c85[_0x8eca('0x31')],_0x492c85[_0x8eca('0x32')]);_0x3a9f8c['attributes']=_['intersection'](_0x492c85[_0x8eca('0x31')],qs[_0x8eca('0x37')](_0x101859[_0x8eca('0x32')][_0x8eca('0x37')]));_0x3a9f8c['attributes']=_0x3a9f8c[_0x8eca('0x36')][_0x8eca('0x38')]?_0x3a9f8c[_0x8eca('0x36')]:_0x492c85[_0x8eca('0x31')];if(_0x101859[_0x8eca('0x32')][_0x8eca('0x45')]){_0x3a9f8c[_0x8eca('0x40')]=[{'all':!![]}];}_0x3a9f8c=_[_0x8eca('0x3e')]({},_0x3a9f8c,_0x101859['options']);return db[_0x8eca('0x2e')][_0x8eca('0x46')](_0x3a9f8c)[_0x8eca('0x27')](handleEntityNotFound(_0x5b7f06,null))[_0x8eca('0x27')](respondWithResult(_0x5b7f06,null))[_0x8eca('0x47')](handleError(_0x5b7f06,null));};exports[_0x8eca('0x48')]=function(_0x1d0d9e,_0x2fe748){return db['ServicenowConfiguration'][_0x8eca('0x48')](_0x1d0d9e[_0x8eca('0x49')],{})['then'](respondWithResult(_0x2fe748,0xc9))[_0x8eca('0x47')](handleError(_0x2fe748,null));};exports[_0x8eca('0x4a')]=function(_0x508d41,_0x2b4345){if(_0x508d41[_0x8eca('0x49')]['id']){delete _0x508d41[_0x8eca('0x49')]['id'];}return db[_0x8eca('0x2e')][_0x8eca('0x46')]({'where':{'id':_0x508d41[_0x8eca('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b4345,null))[_0x8eca('0x27')](saveUpdates(_0x508d41['body'],null))[_0x8eca('0x27')](respondWithResult(_0x2b4345,null))[_0x8eca('0x47')](handleError(_0x2b4345,null));};exports[_0x8eca('0x26')]=function(_0x4d64b4,_0x29eacd){return db[_0x8eca('0x2e')]['find']({'where':{'id':_0x4d64b4[_0x8eca('0x44')]['id']}})[_0x8eca('0x27')](handleEntityNotFound(_0x29eacd,null))[_0x8eca('0x27')](removeEntity(_0x29eacd,null))[_0x8eca('0x47')](handleError(_0x29eacd,null));};exports[_0x8eca('0x4b')]=function(_0x59f893,_0x451ea5,_0x44bf6f){var _0x53d005={};var _0x1772fd={};var _0x29c8f3;var _0x136d58;return db[_0x8eca('0x2e')]['findOne']({'where':{'id':_0x59f893[_0x8eca('0x44')]['id']}})[_0x8eca('0x27')](handleEntityNotFound(_0x451ea5,null))[_0x8eca('0x27')](function(_0xc5c9e){if(_0xc5c9e){_0x29c8f3=_0xc5c9e;_0x1772fd['model']=_[_0x8eca('0x33')](db[_0x8eca('0x4c')][_0x8eca('0x4d')]);_0x1772fd['query']=_[_0x8eca('0x33')](_0x59f893[_0x8eca('0x32')]);_0x1772fd['filters']=_['intersection'](_0x1772fd[_0x8eca('0x31')],_0x1772fd['query']);_0x53d005[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x1772fd[_0x8eca('0x31')],qs['fields'](_0x59f893[_0x8eca('0x32')][_0x8eca('0x37')]));_0x53d005['attributes']=_0x53d005[_0x8eca('0x36')]['length']?_0x53d005[_0x8eca('0x36')]:_0x1772fd[_0x8eca('0x31')];_0x53d005[_0x8eca('0x3a')]=qs['sort'](_0x59f893[_0x8eca('0x32')][_0x8eca('0x3b')]);_0x53d005[_0x8eca('0x3c')]=qs['filters'](_[_0x8eca('0x4e')](_0x59f893[_0x8eca('0x32')],_0x1772fd[_0x8eca('0x34')]));if(_0x59f893[_0x8eca('0x32')][_0x8eca('0x3d')]){_0x53d005[_0x8eca('0x3c')]=_[_0x8eca('0x3e')](_0x53d005[_0x8eca('0x3c')],{'$or':_[_0x8eca('0x2d')](_0x53d005[_0x8eca('0x36')],function(_0x1d30dd){var _0x571bda={};_0x571bda[_0x1d30dd]={'$like':'%'+_0x59f893[_0x8eca('0x32')][_0x8eca('0x3d')]+'%'};return _0x571bda;})});}_0x53d005=_['merge']({},_0x53d005,_0x59f893[_0x8eca('0x4f')]);return _0x29c8f3[_0x8eca('0x4b')](_0x53d005);}})[_0x8eca('0x27')](function(_0x3d04d3){if(_0x3d04d3){_0x136d58=_0x3d04d3[_0x8eca('0x38')];if(!_0x59f893[_0x8eca('0x32')][_0x8eca('0x50')](_0x8eca('0x39'))){_0x53d005['limit']=qs['limit'](_0x59f893[_0x8eca('0x32')][_0x8eca('0x20')]);_0x53d005[_0x8eca('0x1e')]=qs[_0x8eca('0x1e')](_0x59f893[_0x8eca('0x32')][_0x8eca('0x1e')]);}return _0x29c8f3[_0x8eca('0x4b')](_0x53d005);}})[_0x8eca('0x27')](function(_0x4f6b89){if(_0x4f6b89){return _0x4f6b89?{'count':_0x136d58,'rows':_0x4f6b89}:null;}})[_0x8eca('0x27')](respondWithResult(_0x451ea5,null))[_0x8eca('0x47')](handleError(_0x451ea5,null));};exports[_0x8eca('0x51')]=function(_0x26f923,_0x39095c,_0x434c6a){var _0x6d4fc4={};var _0x54245c={};var _0x5a5a14;var _0xdf9c9;return db['ServicenowConfiguration'][_0x8eca('0x52')]({'where':{'id':_0x26f923['params']['id']}})[_0x8eca('0x27')](handleEntityNotFound(_0x39095c,null))[_0x8eca('0x27')](function(_0x3787ba){if(_0x3787ba){_0x5a5a14=_0x3787ba;_0x54245c['model']=_['keys'](db[_0x8eca('0x4c')][_0x8eca('0x4d')]);_0x54245c[_0x8eca('0x32')]=_[_0x8eca('0x33')](_0x26f923[_0x8eca('0x32')]);_0x54245c[_0x8eca('0x34')]=_['intersection'](_0x54245c[_0x8eca('0x31')],_0x54245c['query']);_0x6d4fc4[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x54245c[_0x8eca('0x31')],qs[_0x8eca('0x37')](_0x26f923[_0x8eca('0x32')][_0x8eca('0x37')]));_0x6d4fc4['attributes']=_0x6d4fc4['attributes']['length']?_0x6d4fc4['attributes']:_0x54245c[_0x8eca('0x31')];_0x6d4fc4[_0x8eca('0x3a')]=qs[_0x8eca('0x3b')](_0x26f923[_0x8eca('0x32')][_0x8eca('0x3b')]);_0x6d4fc4[_0x8eca('0x3c')]=qs[_0x8eca('0x34')](_['pick'](_0x26f923[_0x8eca('0x32')],_0x54245c[_0x8eca('0x34')]));if(_0x26f923['query'][_0x8eca('0x3d')]){_0x6d4fc4[_0x8eca('0x3c')]=_[_0x8eca('0x3e')](_0x6d4fc4[_0x8eca('0x3c')],{'$or':_[_0x8eca('0x2d')](_0x6d4fc4[_0x8eca('0x36')],function(_0x15925d){var _0x3a3cf4={};_0x3a3cf4[_0x15925d]={'$like':'%'+_0x26f923[_0x8eca('0x32')][_0x8eca('0x3d')]+'%'};return _0x3a3cf4;})});}_0x6d4fc4=_[_0x8eca('0x3e')]({},_0x6d4fc4,_0x26f923[_0x8eca('0x4f')]);return _0x5a5a14[_0x8eca('0x51')](_0x6d4fc4);}})[_0x8eca('0x27')](function(_0xe44934){if(_0xe44934){_0xdf9c9=_0xe44934['length'];if(!_0x26f923[_0x8eca('0x32')][_0x8eca('0x50')](_0x8eca('0x39'))){_0x6d4fc4[_0x8eca('0x20')]=qs[_0x8eca('0x20')](_0x26f923[_0x8eca('0x32')][_0x8eca('0x20')]);_0x6d4fc4[_0x8eca('0x1e')]=qs[_0x8eca('0x1e')](_0x26f923[_0x8eca('0x32')][_0x8eca('0x1e')]);}return _0x5a5a14[_0x8eca('0x51')](_0x6d4fc4);}})[_0x8eca('0x27')](function(_0x14566c){if(_0x14566c){return _0x14566c?{'count':_0xdf9c9,'rows':_0x14566c}:null;}})[_0x8eca('0x27')](respondWithResult(_0x39095c,null))['catch'](handleError(_0x39095c,null));};exports[_0x8eca('0x53')]=function(_0x26ce62,_0x372bbf,_0x3def60){var _0x3c56c3={};var _0x105468={};var _0x52b88e;var _0x1c6535;return db[_0x8eca('0x2e')]['findOne']({'where':{'id':_0x26ce62[_0x8eca('0x44')]['id']}})[_0x8eca('0x27')](handleEntityNotFound(_0x372bbf,null))[_0x8eca('0x27')](function(_0xa20d56){if(_0xa20d56){_0x52b88e=_0xa20d56;_0x105468['model']=_[_0x8eca('0x33')](db[_0x8eca('0x4c')][_0x8eca('0x4d')]);_0x105468[_0x8eca('0x32')]=_[_0x8eca('0x33')](_0x26ce62[_0x8eca('0x32')]);_0x105468[_0x8eca('0x34')]=_[_0x8eca('0x35')](_0x105468[_0x8eca('0x31')],_0x105468[_0x8eca('0x32')]);_0x3c56c3[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x105468['model'],qs[_0x8eca('0x37')](_0x26ce62[_0x8eca('0x32')][_0x8eca('0x37')]));_0x3c56c3[_0x8eca('0x36')]=_0x3c56c3[_0x8eca('0x36')][_0x8eca('0x38')]?_0x3c56c3['attributes']:_0x105468[_0x8eca('0x31')];_0x3c56c3[_0x8eca('0x3a')]=qs['sort'](_0x26ce62[_0x8eca('0x32')][_0x8eca('0x3b')]);_0x3c56c3[_0x8eca('0x3c')]=qs[_0x8eca('0x34')](_[_0x8eca('0x4e')](_0x26ce62[_0x8eca('0x32')],_0x105468[_0x8eca('0x34')]));if(_0x26ce62[_0x8eca('0x32')][_0x8eca('0x3d')]){_0x3c56c3[_0x8eca('0x3c')]=_[_0x8eca('0x3e')](_0x3c56c3[_0x8eca('0x3c')],{'$or':_[_0x8eca('0x2d')](_0x3c56c3[_0x8eca('0x36')],function(_0x188e2c){var _0x263058={};_0x263058[_0x188e2c]={'$like':'%'+_0x26ce62[_0x8eca('0x32')][_0x8eca('0x3d')]+'%'};return _0x263058;})});}_0x3c56c3=_[_0x8eca('0x3e')]({},_0x3c56c3,_0x26ce62['options']);return _0x52b88e['getDescriptions'](_0x3c56c3);}})['then'](function(_0x52bcaf){if(_0x52bcaf){_0x1c6535=_0x52bcaf[_0x8eca('0x38')];if(!_0x26ce62[_0x8eca('0x32')][_0x8eca('0x50')]('nolimit')){_0x3c56c3[_0x8eca('0x20')]=qs['limit'](_0x26ce62[_0x8eca('0x32')][_0x8eca('0x20')]);_0x3c56c3[_0x8eca('0x1e')]=qs[_0x8eca('0x1e')](_0x26ce62[_0x8eca('0x32')][_0x8eca('0x1e')]);}return _0x52b88e['getDescriptions'](_0x3c56c3);}})[_0x8eca('0x27')](function(_0x40ff12){if(_0x40ff12){return _0x40ff12?{'count':_0x1c6535,'rows':_0x40ff12}:null;}})[_0x8eca('0x27')](respondWithResult(_0x372bbf,null))[_0x8eca('0x47')](handleError(_0x372bbf,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ce8d82b..1956ad8 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 _0x38d0=['int_servicenow_configurations','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','ServicenowConfiguration'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x38d0,0x123));var _0x038d=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x38d0[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x038d('0x0'));var logger=require(_0x038d('0x1'))(_0x038d('0x2'));var moment=require('moment');var BPromise=require(_0x038d('0x3'));var rp=require(_0x038d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x038d('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x038d('0x6')]=function(_0x2dd6b0,_0x5914cb){return _0x2dd6b0[_0x038d('0x7')](_0x038d('0x8'),attributes,{'tableName':_0x038d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb79a=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','moment','bluebird'];(function(_0x461e7b,_0x200b80){var _0x5ea12e=function(_0x348e87){while(--_0x348e87){_0x461e7b['push'](_0x461e7b['shift']());}};_0x5ea12e(++_0x200b80);}(_0xb79a,0x18e));var _0xab79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb79a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var logger=require('../../config/logger')(_0xab79('0x2'));var moment=require(_0xab79('0x3'));var BPromise=require(_0xab79('0x4'));var rp=require(_0xab79('0x5'));var fs=require('fs');var path=require(_0xab79('0x6'));var rimraf=require(_0xab79('0x7'));var config=require(_0xab79('0x8'));var attributes=require(_0xab79('0x9'));module['exports']=function(_0x1dae4,_0x4b0ad5){return _0x1dae4[_0xab79('0xa')](_0xab79('0xb'),attributes,{'tableName':_0xab79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 6b8a770..b54c9be 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 _0x3926=['info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0x186783,_0x52c982){var _0x13ffbe=function(_0x6dda86){while(--_0x6dda86){_0x186783['push'](_0x186783['shift']());}};_0x13ffbe(++_0x52c982);}(_0x3926,0xb1));var _0x6392=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x3926[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x6392('0x0'));var moment=require(_0x6392('0x1'));var BPromise=require(_0x6392('0x2'));var rs=require(_0x6392('0x3'));var fs=require('fs');var Redis=require(_0x6392('0x4'));var db=require(_0x6392('0x5'))['db'];var utils=require(_0x6392('0x6'));var logger=require(_0x6392('0x7'))(_0x6392('0x8'));var config=require(_0x6392('0x9'));var jayson=require(_0x6392('0xa'));var client=jayson[_0x6392('0xb')][_0x6392('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2406b2,_0x1c5407,_0x50988c){return new BPromise(function(_0x7cfe81,_0x331baf){return client[_0x6392('0xd')](_0x2406b2,_0x50988c)[_0x6392('0xe')](function(_0x3ad6d6){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x1c5407,_0x6392('0xf'));logger[_0x6392('0x10')](_0x6392('0x11'),_0x1c5407,_0x6392('0xf'),JSON[_0x6392('0x12')](_0x3ad6d6));if(_0x3ad6d6['error']){if(_0x3ad6d6[_0x6392('0x13')][_0x6392('0x14')]===0x1f4){logger[_0x6392('0x13')](_0x6392('0x15'),_0x1c5407,_0x3ad6d6['error'][_0x6392('0x16')]);return _0x331baf(_0x3ad6d6[_0x6392('0x13')][_0x6392('0x16')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x1c5407,_0x3ad6d6[_0x6392('0x13')][_0x6392('0x16')]);return _0x7cfe81(_0x3ad6d6['error']['message']);}else{logger[_0x6392('0x17')](_0x6392('0x15'),_0x1c5407,'request\x20sent');_0x7cfe81(_0x3ad6d6['result'][_0x6392('0x16')]);}})[_0x6392('0x18')](function(_0x606e59){logger[_0x6392('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1c5407,_0x606e59);_0x331baf(_0x606e59);});});} \ No newline at end of file +var _0x9ecc=['info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2fde12,_0x32874){var _0x129efe=function(_0x209581){while(--_0x209581){_0x2fde12['push'](_0x2fde12['shift']());}};_0x129efe(++_0x32874);}(_0x9ecc,0x95));var _0xc9ec=function(_0x4d1cc6,_0x26bebe){_0x4d1cc6=_0x4d1cc6-0x0;var _0x1a6fee=_0x9ecc[_0x4d1cc6];return _0x1a6fee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc9ec('0x0'));var BPromise=require(_0xc9ec('0x1'));var rs=require(_0xc9ec('0x2'));var fs=require('fs');var Redis=require(_0xc9ec('0x3'));var db=require(_0xc9ec('0x4'))['db'];var utils=require(_0xc9ec('0x5'));var logger=require(_0xc9ec('0x6'))(_0xc9ec('0x7'));var config=require(_0xc9ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc9ec('0x9')][_0xc9ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4542ca,_0x54368c,_0x5bc951){return new BPromise(function(_0xf5050a,_0xa3ab3b){return client[_0xc9ec('0xb')](_0x4542ca,_0x5bc951)['then'](function(_0x3d5b4a){logger['info'](_0xc9ec('0xc'),_0x54368c,_0xc9ec('0xd'));logger[_0xc9ec('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x54368c,_0xc9ec('0xd'),JSON[_0xc9ec('0xf')](_0x3d5b4a));if(_0x3d5b4a[_0xc9ec('0x10')]){if(_0x3d5b4a[_0xc9ec('0x10')][_0xc9ec('0x11')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x54368c,_0x3d5b4a[_0xc9ec('0x10')][_0xc9ec('0x12')]);return _0xa3ab3b(_0x3d5b4a[_0xc9ec('0x10')][_0xc9ec('0x12')]);}logger['error'](_0xc9ec('0xc'),_0x54368c,_0x3d5b4a[_0xc9ec('0x10')][_0xc9ec('0x12')]);return _0xf5050a(_0x3d5b4a[_0xc9ec('0x10')][_0xc9ec('0x12')]);}else{logger[_0xc9ec('0x13')](_0xc9ec('0xc'),_0x54368c,_0xc9ec('0xd'));_0xf5050a(_0x3d5b4a[_0xc9ec('0x14')][_0xc9ec('0x12')]);}})['catch'](function(_0x8132e){logger[_0xc9ec('0x10')](_0xc9ec('0xc'),_0x54368c,_0x8132e);_0xa3ab3b(_0x8132e);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 581082f..7d1ed52 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 _0xcd0b=['./intServicenowField.controller','get','index','/:id','show','post','create','put','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x13abf5,_0x55539d){var _0x24c51e=function(_0x30c4f8){while(--_0x30c4f8){_0x13abf5['push'](_0x13abf5['shift']());}};_0x24c51e(++_0x55539d);}(_0xcd0b,0x116));var _0xbcd0=function(_0x49c4de,_0xac4172){_0x49c4de=_0x49c4de-0x0;var _0xdcc4d3=_0xcd0b[_0x49c4de];return _0xdcc4d3;};'use strict';var multer=require(_0xbcd0('0x0'));var util=require(_0xbcd0('0x1'));var path=require(_0xbcd0('0x2'));var timeout=require(_0xbcd0('0x3'));var express=require(_0xbcd0('0x4'));var router=express['Router']();var fs_extra=require(_0xbcd0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbcd0('0x6'));var config=require('../../config/environment');var controller=require(_0xbcd0('0x7'));router[_0xbcd0('0x8')]('/',auth['isAuthenticated'](),controller[_0xbcd0('0x9')]);router['get'](_0xbcd0('0xa'),auth['isAuthenticated'](),controller[_0xbcd0('0xb')]);router[_0xbcd0('0xc')]('/',auth['isAuthenticated'](),controller[_0xbcd0('0xd')]);router[_0xbcd0('0xe')]('/:id',auth[_0xbcd0('0xf')](),controller[_0xbcd0('0x10')]);router['delete'](_0xbcd0('0xa'),auth[_0xbcd0('0xf')](),controller[_0xbcd0('0x11')]);module[_0xbcd0('0x12')]=router; \ No newline at end of file +var _0x7a19=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4be02a,_0x5791c0){var _0x228fc7=function(_0x3a6f6e){while(--_0x3a6f6e){_0x4be02a['push'](_0x4be02a['shift']());}};_0x228fc7(++_0x5791c0);}(_0x7a19,0xa8));var _0x97a1=function(_0x2674a9,_0x3be5a7){_0x2674a9=_0x2674a9-0x0;var _0x2272ab=_0x7a19[_0x2674a9];return _0x2272ab;};'use strict';var multer=require(_0x97a1('0x0'));var util=require(_0x97a1('0x1'));var path=require(_0x97a1('0x2'));var timeout=require(_0x97a1('0x3'));var express=require(_0x97a1('0x4'));var router=express[_0x97a1('0x5')]();var fs_extra=require(_0x97a1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x97a1('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x97a1('0x8')](),controller[_0x97a1('0x9')]);router['get'](_0x97a1('0xa'),auth[_0x97a1('0x8')](),controller[_0x97a1('0xb')]);router[_0x97a1('0xc')]('/',auth[_0x97a1('0x8')](),controller[_0x97a1('0xd')]);router[_0x97a1('0xe')]('/:id',auth[_0x97a1('0x8')](),controller[_0x97a1('0xf')]);router[_0x97a1('0x10')](_0x97a1('0xa'),auth[_0x97a1('0x8')](),controller[_0x97a1('0x11')]);module[_0x97a1('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 93d28d0..8771c0c 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 _0x462b=['customVariable','BOOLEAN','sequelize','exports','string','keyValue','picklist','STRING','ENUM','variable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x462b,0xe8));var _0xb462=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x462b[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xb462('0x0'));module[_0xb462('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb462('0x2'),'variable','customVariable',_0xb462('0x3'),_0xb462('0x4')),'defaultValue':_0xb462('0x2')},'content':{'type':Sequelize[_0xb462('0x5')]},'key':{'type':Sequelize[_0xb462('0x5')]},'keyType':{'type':Sequelize[_0xb462('0x6')](_0xb462('0x2'),_0xb462('0x7'),_0xb462('0x8'))},'keyContent':{'type':Sequelize[_0xb462('0x5')]},'idField':{'type':Sequelize[_0xb462('0x5')]},'nameField':{'type':Sequelize[_0xb462('0x5')]},'customField':{'type':Sequelize[_0xb462('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb462('0x5')]}}; \ No newline at end of file +var _0x18ec=['customVariable','picklist','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x1b4818,_0x4e4453){var _0x57b0c6=function(_0x220287){while(--_0x220287){_0x1b4818['push'](_0x1b4818['shift']());}};_0x57b0c6(++_0x4e4453);}(_0x18ec,0xe4));var _0xc18e=function(_0x166c0b,_0x3123db){_0x166c0b=_0x166c0b-0x0;var _0x3dc1cc=_0x18ec[_0x166c0b];return _0x3dc1cc;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xc18e('0x0')](_0xc18e('0x1'),_0xc18e('0x2'),_0xc18e('0x3'),'keyValue',_0xc18e('0x4')),'defaultValue':_0xc18e('0x1')},'content':{'type':Sequelize[_0xc18e('0x5')]},'key':{'type':Sequelize[_0xc18e('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xc18e('0x2'),_0xc18e('0x3'))},'keyContent':{'type':Sequelize[_0xc18e('0x5')]},'idField':{'type':Sequelize[_0xc18e('0x5')]},'nameField':{'type':Sequelize[_0xc18e('0x5')]},'customField':{'type':Sequelize[_0xc18e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc18e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 665a2b7..3280078 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 _0x00d9=['bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','ServicenowField','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x2bf526,_0xeca6fc){var _0x4e4886=function(_0xcd8f33){while(--_0xcd8f33){_0x2bf526['push'](_0x2bf526['shift']());}};_0x4e4886(++_0xeca6fc);}(_0x00d9,0xd3));var _0x900d=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x00d9[_0x45783c];return _0x1161da;};'use strict';var emlformat=require(_0x900d('0x0'));var rimraf=require(_0x900d('0x1'));var zipdir=require(_0x900d('0x2'));var jsonpatch=require(_0x900d('0x3'));var rp=require('request-promise');var moment=require(_0x900d('0x4'));var BPromise=require(_0x900d('0x5'));var Mustache=require(_0x900d('0x6'));var util=require(_0x900d('0x7'));var path=require('path');var sox=require(_0x900d('0x8'));var csv=require(_0x900d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x900d('0xa'));var squel=require(_0x900d('0xb'));var crypto=require(_0x900d('0xc'));var jsforce=require(_0x900d('0xd'));var deskjs=require(_0x900d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x900d('0xf'));var Redis=require(_0x900d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x900d('0x11'));var as=require(_0x900d('0x12'));var hardwareService=require(_0x900d('0x13'));var logger=require(_0x900d('0x14'))('api');var utils=require(_0x900d('0x15'));var config=require(_0x900d('0x16'));var licenseUtil=require(_0x900d('0x17'));var db=require(_0x900d('0x18'))['db'];function respondWithStatusCode(_0x5ab185,_0x46f150){_0x46f150=_0x46f150||0xcc;return function(_0x1190a4){if(_0x1190a4){return _0x5ab185[_0x900d('0x19')](_0x46f150);}return _0x5ab185[_0x900d('0x1a')](_0x46f150)['end']();};}function respondWithResult(_0x5b1a6b,_0x50e2cd){_0x50e2cd=_0x50e2cd||0xc8;return function(_0x2b81c5){if(_0x2b81c5){return _0x5b1a6b[_0x900d('0x1a')](_0x50e2cd)[_0x900d('0x1b')](_0x2b81c5);}};}function respondWithFilteredResult(_0x262c27,_0xbecf1f){return function(_0x2edac2){if(_0x2edac2){var _0x41f80a=typeof _0xbecf1f['offset']===_0x900d('0x1c')&&typeof _0xbecf1f[_0x900d('0x1d')]===_0x900d('0x1c');var _0x2cb35c=_0x2edac2[_0x900d('0x1e')];var _0x291fde=_0x41f80a?0x0:_0xbecf1f[_0x900d('0x1f')];var _0x32ba97=_0x41f80a?_0x2edac2[_0x900d('0x1e')]:_0xbecf1f[_0x900d('0x1f')]+_0xbecf1f['limit'];var _0x2042bd;if(_0x32ba97>=_0x2cb35c){_0x32ba97=_0x2cb35c;_0x2042bd=0xc8;}else{_0x2042bd=0xce;}_0x262c27['status'](_0x2042bd);return _0x262c27[_0x900d('0x20')](_0x900d('0x21'),_0x291fde+'-'+_0x32ba97+'/'+_0x2cb35c)[_0x900d('0x1b')](_0x2edac2);}return null;};}function patchUpdates(_0x1bb8f3){return function(_0x10d6aa){try{jsonpatch[_0x900d('0x22')](_0x10d6aa,_0x1bb8f3,!![]);}catch(_0x4ee06e){return BPromise[_0x900d('0x23')](_0x4ee06e);}return _0x10d6aa[_0x900d('0x24')]();};}function saveUpdates(_0x5e7672,_0xfe6b48){return function(_0x2e3027){if(_0x2e3027){return _0x2e3027['update'](_0x5e7672)[_0x900d('0x25')](function(_0x57c697){return _0x57c697;});}return null;};}function removeEntity(_0x414873,_0x57f255){return function(_0x38a686){if(_0x38a686){return _0x38a686['destroy']()[_0x900d('0x25')](function(){_0x414873[_0x900d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b0a62,_0x6bff08){return function(_0x275a04){if(!_0x275a04){_0x4b0a62[_0x900d('0x19')](0x194);}return _0x275a04;};}function handleError(_0x34a28b,_0xf27de6){_0xf27de6=_0xf27de6||0x1f4;return function(_0x1260b4){logger[_0x900d('0x26')](_0x1260b4[_0x900d('0x27')]);if(_0x1260b4[_0x900d('0x28')]){delete _0x1260b4[_0x900d('0x28')];}_0x34a28b[_0x900d('0x1a')](_0xf27de6)['send'](_0x1260b4);};}exports['index']=function(_0x20a0e1,_0x5a07ea){var _0x1fca35={},_0x176246={},_0x14be64={'count':0x0,'rows':[]};var _0x1ffbf4=_['map'](db[_0x900d('0x29')]['rawAttributes'],function(_0xabbe1a){return{'name':_0xabbe1a['fieldName'],'type':_0xabbe1a[_0x900d('0x2a')]['key']};});_0x176246[_0x900d('0x2b')]=_['map'](_0x1ffbf4,_0x900d('0x28'));_0x176246['query']=_[_0x900d('0x2c')](_0x20a0e1['query']);_0x176246[_0x900d('0x2d')]=_[_0x900d('0x2e')](_0x176246['model'],_0x176246[_0x900d('0x2f')]);_0x1fca35[_0x900d('0x30')]=_['intersection'](_0x176246[_0x900d('0x2b')],qs[_0x900d('0x31')](_0x20a0e1['query'][_0x900d('0x31')]));_0x1fca35[_0x900d('0x30')]=_0x1fca35[_0x900d('0x30')][_0x900d('0x32')]?_0x1fca35[_0x900d('0x30')]:_0x176246[_0x900d('0x2b')];if(!_0x20a0e1[_0x900d('0x2f')][_0x900d('0x33')](_0x900d('0x34'))){_0x1fca35[_0x900d('0x1d')]=qs[_0x900d('0x1d')](_0x20a0e1[_0x900d('0x2f')]['limit']);_0x1fca35[_0x900d('0x1f')]=qs[_0x900d('0x1f')](_0x20a0e1['query'][_0x900d('0x1f')]);}_0x1fca35[_0x900d('0x35')]=qs['sort'](_0x20a0e1['query'][_0x900d('0x36')]);_0x1fca35[_0x900d('0x37')]=qs['filters'](_[_0x900d('0x38')](_0x20a0e1[_0x900d('0x2f')],_0x176246[_0x900d('0x2d')]),_0x1ffbf4);if(_0x20a0e1[_0x900d('0x2f')][_0x900d('0x39')]){_0x1fca35[_0x900d('0x37')]=_[_0x900d('0x3a')](_0x1fca35[_0x900d('0x37')],{'$or':_[_0x900d('0x3b')](_0x1ffbf4,function(_0x15b366){if(_0x15b366[_0x900d('0x2a')]!=='VIRTUAL'){var _0x42c855={};_0x42c855[_0x15b366[_0x900d('0x28')]]={'$like':'%'+_0x20a0e1[_0x900d('0x2f')][_0x900d('0x39')]+'%'};return _0x42c855;}})});}_0x1fca35=_[_0x900d('0x3a')]({},_0x1fca35,_0x20a0e1[_0x900d('0x3c')]);var _0xeffeea={'where':_0x1fca35[_0x900d('0x37')]};return db[_0x900d('0x29')]['count'](_0xeffeea)[_0x900d('0x25')](function(_0x17103e){_0x14be64['count']=_0x17103e;if(_0x20a0e1[_0x900d('0x2f')][_0x900d('0x3d')]){_0x1fca35['include']=[{'all':!![]}];}return db[_0x900d('0x29')]['findAll'](_0x1fca35);})[_0x900d('0x25')](function(_0x30962b){_0x14be64[_0x900d('0x3e')]=_0x30962b;return _0x14be64;})[_0x900d('0x25')](respondWithFilteredResult(_0x5a07ea,_0x1fca35))[_0x900d('0x3f')](handleError(_0x5a07ea,null));};exports[_0x900d('0x40')]=function(_0x3a2e17,_0x3524e0){var _0x166309={'raw':!![],'where':{'id':_0x3a2e17[_0x900d('0x41')]['id']}},_0x3fa208={};_0x3fa208['model']=_[_0x900d('0x2c')](db[_0x900d('0x29')][_0x900d('0x42')]);_0x3fa208[_0x900d('0x2f')]=_[_0x900d('0x2c')](_0x3a2e17['query']);_0x3fa208[_0x900d('0x2d')]=_[_0x900d('0x2e')](_0x3fa208['model'],_0x3fa208[_0x900d('0x2f')]);_0x166309[_0x900d('0x30')]=_[_0x900d('0x2e')](_0x3fa208[_0x900d('0x2b')],qs['fields'](_0x3a2e17[_0x900d('0x2f')][_0x900d('0x31')]));_0x166309['attributes']=_0x166309[_0x900d('0x30')][_0x900d('0x32')]?_0x166309[_0x900d('0x30')]:_0x3fa208['model'];if(_0x3a2e17[_0x900d('0x2f')][_0x900d('0x3d')]){_0x166309['include']=[{'all':!![]}];}_0x166309=_[_0x900d('0x3a')]({},_0x166309,_0x3a2e17[_0x900d('0x3c')]);return db[_0x900d('0x29')][_0x900d('0x43')](_0x166309)[_0x900d('0x25')](handleEntityNotFound(_0x3524e0,null))['then'](respondWithResult(_0x3524e0,null))[_0x900d('0x3f')](handleError(_0x3524e0,null));};exports[_0x900d('0x44')]=function(_0x722fcd,_0x1d6f30){return db[_0x900d('0x29')][_0x900d('0x44')](_0x722fcd[_0x900d('0x45')],{})['then'](respondWithResult(_0x1d6f30,0xc9))[_0x900d('0x3f')](handleError(_0x1d6f30,null));};exports[_0x900d('0x46')]=function(_0x492b94,_0x4d35be){if(_0x492b94[_0x900d('0x45')]['id']){delete _0x492b94[_0x900d('0x45')]['id'];}return db[_0x900d('0x29')]['find']({'where':{'id':_0x492b94[_0x900d('0x41')]['id']}})['then'](handleEntityNotFound(_0x4d35be,null))[_0x900d('0x25')](saveUpdates(_0x492b94[_0x900d('0x45')],null))[_0x900d('0x25')](respondWithResult(_0x4d35be,null))[_0x900d('0x3f')](handleError(_0x4d35be,null));};exports[_0x900d('0x47')]=function(_0x41d13b,_0x4d6f33){return db[_0x900d('0x29')][_0x900d('0x43')]({'where':{'id':_0x41d13b['params']['id']}})[_0x900d('0x25')](handleEntityNotFound(_0x4d6f33,null))[_0x900d('0x25')](removeEntity(_0x4d6f33,null))['catch'](handleError(_0x4d6f33,null));}; \ No newline at end of file +var _0x4cb7=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0x4cb7,0x80));var _0x74cb=function(_0x21993f,_0xa34a1b){_0x21993f=_0x21993f-0x0;var _0x3cb4f0=_0x4cb7[_0x21993f];return _0x3cb4f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74cb('0x0'));var zipdir=require(_0x74cb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74cb('0x2'));var moment=require(_0x74cb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74cb('0x4'));var util=require(_0x74cb('0x5'));var path=require(_0x74cb('0x6'));var sox=require(_0x74cb('0x7'));var csv=require(_0x74cb('0x8'));var ejs=require(_0x74cb('0x9'));var fs=require('fs');var fs_extra=require(_0x74cb('0xa'));var _=require(_0x74cb('0xb'));var squel=require(_0x74cb('0xc'));var crypto=require(_0x74cb('0xd'));var jsforce=require(_0x74cb('0xe'));var deskjs=require(_0x74cb('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x74cb('0x10'));var Redis=require(_0x74cb('0x11'));var authService=require(_0x74cb('0x12'));var qs=require(_0x74cb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74cb('0x14'));var logger=require(_0x74cb('0x15'))(_0x74cb('0x16'));var utils=require('../../config/utils');var config=require(_0x74cb('0x17'));var licenseUtil=require(_0x74cb('0x18'));var db=require(_0x74cb('0x19'))['db'];function respondWithStatusCode(_0x44391a,_0x4f5df4){_0x4f5df4=_0x4f5df4||0xcc;return function(_0x48b7b1){if(_0x48b7b1){return _0x44391a[_0x74cb('0x1a')](_0x4f5df4);}return _0x44391a['status'](_0x4f5df4)[_0x74cb('0x1b')]();};}function respondWithResult(_0x169d08,_0x5b55da){_0x5b55da=_0x5b55da||0xc8;return function(_0x3de6e5){if(_0x3de6e5){return _0x169d08[_0x74cb('0x1c')](_0x5b55da)[_0x74cb('0x1d')](_0x3de6e5);}};}function respondWithFilteredResult(_0x29bd9c,_0x4554e9){return function(_0x127d71){if(_0x127d71){var _0x442ca0=typeof _0x4554e9[_0x74cb('0x1e')]==='undefined'&&typeof _0x4554e9[_0x74cb('0x1f')]===_0x74cb('0x20');var _0x3f27f6=_0x127d71['count'];var _0x5efcfc=_0x442ca0?0x0:_0x4554e9[_0x74cb('0x1e')];var _0x3dfc0e=_0x442ca0?_0x127d71[_0x74cb('0x21')]:_0x4554e9[_0x74cb('0x1e')]+_0x4554e9[_0x74cb('0x1f')];var _0x269c3d;if(_0x3dfc0e>=_0x3f27f6){_0x3dfc0e=_0x3f27f6;_0x269c3d=0xc8;}else{_0x269c3d=0xce;}_0x29bd9c['status'](_0x269c3d);return _0x29bd9c[_0x74cb('0x22')](_0x74cb('0x23'),_0x5efcfc+'-'+_0x3dfc0e+'/'+_0x3f27f6)[_0x74cb('0x1d')](_0x127d71);}return null;};}function patchUpdates(_0x4c9a66){return function(_0x35df0b){try{jsonpatch[_0x74cb('0x24')](_0x35df0b,_0x4c9a66,!![]);}catch(_0x52fd34){return BPromise['reject'](_0x52fd34);}return _0x35df0b[_0x74cb('0x25')]();};}function saveUpdates(_0x47bcea,_0x277be3){return function(_0x32498d){if(_0x32498d){return _0x32498d[_0x74cb('0x26')](_0x47bcea)[_0x74cb('0x27')](function(_0x458f8e){return _0x458f8e;});}return null;};}function removeEntity(_0x5b1218,_0x2e4798){return function(_0x24c3ea){if(_0x24c3ea){return _0x24c3ea[_0x74cb('0x28')]()[_0x74cb('0x27')](function(){_0x5b1218['status'](0xcc)[_0x74cb('0x1b')]();});}};}function handleEntityNotFound(_0x5dfac0,_0x425dda){return function(_0x45f176){if(!_0x45f176){_0x5dfac0[_0x74cb('0x1a')](0x194);}return _0x45f176;};}function handleError(_0x18731e,_0x540a04){_0x540a04=_0x540a04||0x1f4;return function(_0x393404){logger['error'](_0x393404[_0x74cb('0x29')]);if(_0x393404[_0x74cb('0x2a')]){delete _0x393404['name'];}_0x18731e[_0x74cb('0x1c')](_0x540a04)['send'](_0x393404);};}exports['index']=function(_0x3dc0ab,_0x22ef0f){var _0x4a1570={},_0x3e7db9={},_0x1edd56={'count':0x0,'rows':[]};var _0x2f6c18=_[_0x74cb('0x2b')](db[_0x74cb('0x2c')][_0x74cb('0x2d')],function(_0x4eb5b1){return{'name':_0x4eb5b1[_0x74cb('0x2e')],'type':_0x4eb5b1[_0x74cb('0x2f')][_0x74cb('0x30')]};});_0x3e7db9[_0x74cb('0x31')]=_['map'](_0x2f6c18,'name');_0x3e7db9['query']=_[_0x74cb('0x32')](_0x3dc0ab[_0x74cb('0x33')]);_0x3e7db9[_0x74cb('0x34')]=_[_0x74cb('0x35')](_0x3e7db9[_0x74cb('0x31')],_0x3e7db9[_0x74cb('0x33')]);_0x4a1570[_0x74cb('0x36')]=_[_0x74cb('0x35')](_0x3e7db9[_0x74cb('0x31')],qs['fields'](_0x3dc0ab[_0x74cb('0x33')][_0x74cb('0x37')]));_0x4a1570['attributes']=_0x4a1570['attributes']['length']?_0x4a1570[_0x74cb('0x36')]:_0x3e7db9[_0x74cb('0x31')];if(!_0x3dc0ab[_0x74cb('0x33')]['hasOwnProperty'](_0x74cb('0x38'))){_0x4a1570[_0x74cb('0x1f')]=qs['limit'](_0x3dc0ab['query']['limit']);_0x4a1570[_0x74cb('0x1e')]=qs['offset'](_0x3dc0ab[_0x74cb('0x33')]['offset']);}_0x4a1570[_0x74cb('0x39')]=qs['sort'](_0x3dc0ab[_0x74cb('0x33')][_0x74cb('0x3a')]);_0x4a1570[_0x74cb('0x3b')]=qs['filters'](_['pick'](_0x3dc0ab['query'],_0x3e7db9[_0x74cb('0x34')]),_0x2f6c18);if(_0x3dc0ab['query']['filter']){_0x4a1570['where']=_[_0x74cb('0x3c')](_0x4a1570[_0x74cb('0x3b')],{'$or':_['map'](_0x2f6c18,function(_0x52e718){if(_0x52e718[_0x74cb('0x2f')]!=='VIRTUAL'){var _0x5d3c29={};_0x5d3c29[_0x52e718[_0x74cb('0x2a')]]={'$like':'%'+_0x3dc0ab['query'][_0x74cb('0x3d')]+'%'};return _0x5d3c29;}})});}_0x4a1570=_['merge']({},_0x4a1570,_0x3dc0ab['options']);var _0x256f4c={'where':_0x4a1570[_0x74cb('0x3b')]};return db[_0x74cb('0x2c')][_0x74cb('0x21')](_0x256f4c)[_0x74cb('0x27')](function(_0x18bc06){_0x1edd56['count']=_0x18bc06;if(_0x3dc0ab[_0x74cb('0x33')][_0x74cb('0x3e')]){_0x4a1570[_0x74cb('0x3f')]=[{'all':!![]}];}return db[_0x74cb('0x2c')][_0x74cb('0x40')](_0x4a1570);})[_0x74cb('0x27')](function(_0x5e016b){_0x1edd56[_0x74cb('0x41')]=_0x5e016b;return _0x1edd56;})[_0x74cb('0x27')](respondWithFilteredResult(_0x22ef0f,_0x4a1570))[_0x74cb('0x42')](handleError(_0x22ef0f,null));};exports[_0x74cb('0x43')]=function(_0x391484,_0x155063){var _0x4cca13={'raw':!![],'where':{'id':_0x391484[_0x74cb('0x44')]['id']}},_0x28ee89={};_0x28ee89[_0x74cb('0x31')]=_[_0x74cb('0x32')](db[_0x74cb('0x2c')][_0x74cb('0x2d')]);_0x28ee89[_0x74cb('0x33')]=_[_0x74cb('0x32')](_0x391484[_0x74cb('0x33')]);_0x28ee89[_0x74cb('0x34')]=_[_0x74cb('0x35')](_0x28ee89[_0x74cb('0x31')],_0x28ee89[_0x74cb('0x33')]);_0x4cca13[_0x74cb('0x36')]=_[_0x74cb('0x35')](_0x28ee89['model'],qs[_0x74cb('0x37')](_0x391484[_0x74cb('0x33')][_0x74cb('0x37')]));_0x4cca13[_0x74cb('0x36')]=_0x4cca13[_0x74cb('0x36')][_0x74cb('0x45')]?_0x4cca13['attributes']:_0x28ee89[_0x74cb('0x31')];if(_0x391484[_0x74cb('0x33')][_0x74cb('0x3e')]){_0x4cca13[_0x74cb('0x3f')]=[{'all':!![]}];}_0x4cca13=_[_0x74cb('0x3c')]({},_0x4cca13,_0x391484[_0x74cb('0x46')]);return db[_0x74cb('0x2c')][_0x74cb('0x47')](_0x4cca13)[_0x74cb('0x27')](handleEntityNotFound(_0x155063,null))[_0x74cb('0x27')](respondWithResult(_0x155063,null))[_0x74cb('0x42')](handleError(_0x155063,null));};exports[_0x74cb('0x48')]=function(_0x1df4c2,_0x28e6c5){return db[_0x74cb('0x2c')][_0x74cb('0x48')](_0x1df4c2[_0x74cb('0x49')],{})[_0x74cb('0x27')](respondWithResult(_0x28e6c5,0xc9))[_0x74cb('0x42')](handleError(_0x28e6c5,null));};exports[_0x74cb('0x26')]=function(_0x3659dc,_0x3e020d){if(_0x3659dc[_0x74cb('0x49')]['id']){delete _0x3659dc['body']['id'];}return db[_0x74cb('0x2c')]['find']({'where':{'id':_0x3659dc['params']['id']}})[_0x74cb('0x27')](handleEntityNotFound(_0x3e020d,null))[_0x74cb('0x27')](saveUpdates(_0x3659dc[_0x74cb('0x49')],null))[_0x74cb('0x27')](respondWithResult(_0x3e020d,null))[_0x74cb('0x42')](handleError(_0x3e020d,null));};exports[_0x74cb('0x28')]=function(_0x83b305,_0x12ab4e){return db[_0x74cb('0x2c')][_0x74cb('0x47')]({'where':{'id':_0x83b305[_0x74cb('0x44')]['id']}})['then'](handleEntityNotFound(_0x12ab4e,null))[_0x74cb('0x27')](removeEntity(_0x12ab4e,null))[_0x74cb('0x42')](handleError(_0x12ab4e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 6c3c2df..45c8029 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 _0xab29=['./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xab29,0x1b6));var _0x9ab2=function(_0x32cf27,_0x5c30d3){_0x32cf27=_0x32cf27-0x0;var _0x5422b0=_0xab29[_0x32cf27];return _0x5422b0;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var logger=require(_0x9ab2('0x2'))(_0x9ab2('0x3'));var moment=require(_0x9ab2('0x4'));var BPromise=require(_0x9ab2('0x5'));var rp=require(_0x9ab2('0x6'));var fs=require('fs');var path=require(_0x9ab2('0x7'));var rimraf=require(_0x9ab2('0x8'));var config=require(_0x9ab2('0x9'));var attributes=require(_0x9ab2('0xa'));module[_0x9ab2('0xb')]=function(_0x3ec89a,_0x1cc379){return _0x3ec89a['define'](_0x9ab2('0xc'),attributes,{'tableName':_0x9ab2('0xd'),'paranoid':![],'indexes':[{'name':_0x9ab2('0xe'),'fields':['idField',_0x9ab2('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf452=['idField','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','ServicenowField','int_servicenow_fields'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0xf452,0x70));var _0x2f45=function(_0x4598db,_0x1cb1e8){_0x4598db=_0x4598db-0x0;var _0x3169f3=_0xf452[_0x4598db];return _0x3169f3;};'use strict';var _=require(_0x2f45('0x0'));var util=require(_0x2f45('0x1'));var logger=require(_0x2f45('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f45('0x3'));var fs=require('fs');var path=require(_0x2f45('0x4'));var rimraf=require(_0x2f45('0x5'));var config=require(_0x2f45('0x6'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x1988e7,_0x2aefee){return _0x1988e7['define'](_0x2f45('0x7'),attributes,{'tableName':_0x2f45('0x8'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x2f45('0x9'),_0x2f45('0xa')],'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 e055ca9..723d0a7 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x52b62b,_0x1100cd){var _0x3d14d0=function(_0x1b5ef7){while(--_0x1b5ef7){_0x52b62b['push'](_0x52b62b['shift']());}};_0x3d14d0(++_0x1100cd);}(_0xaa88,0x137));var _0x8aa8=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xaa88[_0x466247];return _0x4b352e;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x441af2,_0x48dbb0){var _0x12fe1e=function(_0x3ecd4f){while(--_0x3ecd4f){_0x441af2['push'](_0x441af2['shift']());}};_0x12fe1e(++_0x48dbb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 49e72db..9d45337 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(_0x1563f5,_0x731195){var _0x52cfb2=function(_0x7e239e){while(--_0x7e239e){_0x1563f5['push'](_0x1563f5['shift']());}};_0x52cfb2(++_0x731195);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5a2b73,_0x17fd76){var _0x492b1c=function(_0x33539f){while(--_0x33539f){_0x5a2b73['push'](_0x5a2b73['shift']());}};_0x492b1c(++_0x17fd76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 7b50723..16e0af6 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(_0x3499c1,_0x24f84f){var _0xbc25d7=function(_0x3b81ba){while(--_0x3b81ba){_0x3499c1['push'](_0x3499c1['shift']());}};_0xbc25d7(++_0x24f84f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0xc50562,_0x2073f6){var _0x123128=function(_0x380cfa){while(--_0x380cfa){_0xc50562['push'](_0xc50562['shift']());}};_0x123128(++_0x2073f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 15d93b6..b9b63a1 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 _0x9320=['direction','username','password','remoteUri','slice','substring','POST','%s%s','/service/v4_1/rest.php','JSON','xCALLY\x20Motion\x20Integration','Password\x20Expired','format','get_module_fields','stringify','values','remove','includes','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','SugarcrmAccount','rawAttributes','fieldName','type','model','map','filters','intersection','query','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','keys','includeAll','options','find','create','body','params','destroy','getConfigurations','findOne','SugarcrmConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_minutes','parent_type','parent_name'];(function(_0x493cb4,_0x416b68){var _0x13ba41=function(_0x5a119b){while(--_0x5a119b){_0x493cb4['push'](_0x493cb4['shift']());}};_0x13ba41(++_0x416b68);}(_0x9320,0x17d));var _0x0932=function(_0x450198,_0x4f11d0){_0x450198=_0x450198-0x0;var _0xb77fdc=_0x9320[_0x450198];return _0xb77fdc;};'use strict';var emlformat=require(_0x0932('0x0'));var rimraf=require(_0x0932('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0932('0x2'));var rp=require(_0x0932('0x3'));var moment=require(_0x0932('0x4'));var BPromise=require(_0x0932('0x5'));var Mustache=require(_0x0932('0x6'));var util=require(_0x0932('0x7'));var path=require(_0x0932('0x8'));var sox=require(_0x0932('0x9'));var csv=require(_0x0932('0xa'));var ejs=require(_0x0932('0xb'));var fs=require('fs');var fs_extra=require(_0x0932('0xc'));var _=require(_0x0932('0xd'));var squel=require(_0x0932('0xe'));var crypto=require(_0x0932('0xf'));var jsforce=require(_0x0932('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0932('0x11'));var Redis=require(_0x0932('0x12'));var authService=require(_0x0932('0x13'));var qs=require(_0x0932('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0932('0x15'))('api');var utils=require(_0x0932('0x16'));var config=require(_0x0932('0x17'));var licenseUtil=require(_0x0932('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0932('0x19'));function respondWithStatusCode(_0x47281e,_0x5bc8ea){_0x5bc8ea=_0x5bc8ea||0xcc;return function(_0xd2a2ec){if(_0xd2a2ec){return _0x47281e['sendStatus'](_0x5bc8ea);}return _0x47281e[_0x0932('0x1a')](_0x5bc8ea)[_0x0932('0x1b')]();};}function respondWithResult(_0x1ae8b2,_0x1f6546){_0x1f6546=_0x1f6546||0xc8;return function(_0x3f35a2){if(_0x3f35a2){return _0x1ae8b2[_0x0932('0x1a')](_0x1f6546)['json'](_0x3f35a2);}};}function respondWithFilteredResult(_0x1b1480,_0x14b318){return function(_0x487ef2){if(_0x487ef2){var _0x41500d=typeof _0x14b318[_0x0932('0x1c')]===_0x0932('0x1d')&&typeof _0x14b318[_0x0932('0x1e')]===_0x0932('0x1d');var _0x99996e=_0x487ef2[_0x0932('0x1f')];var _0xcd4586=_0x41500d?0x0:_0x14b318[_0x0932('0x1c')];var _0x8a95fd=_0x41500d?_0x487ef2[_0x0932('0x1f')]:_0x14b318[_0x0932('0x1c')]+_0x14b318[_0x0932('0x1e')];var _0x1610ea;if(_0x8a95fd>=_0x99996e){_0x8a95fd=_0x99996e;_0x1610ea=0xc8;}else{_0x1610ea=0xce;}_0x1b1480[_0x0932('0x1a')](_0x1610ea);return _0x1b1480[_0x0932('0x20')](_0x0932('0x21'),_0xcd4586+'-'+_0x8a95fd+'/'+_0x99996e)[_0x0932('0x22')](_0x487ef2);}return null;};}function patchUpdates(_0x34a69a){return function(_0x17838b){try{jsonpatch[_0x0932('0x23')](_0x17838b,_0x34a69a,!![]);}catch(_0x2dd20c){return BPromise[_0x0932('0x24')](_0x2dd20c);}return _0x17838b[_0x0932('0x25')]();};}function saveUpdates(_0xef34db,_0x387b9e){return function(_0x258832){if(_0x258832){return _0x258832[_0x0932('0x26')](_0xef34db)[_0x0932('0x27')](function(_0x1d2cc4){return _0x1d2cc4;});}return null;};}function removeEntity(_0x59551f,_0x333955){return function(_0x508662){if(_0x508662){return _0x508662['destroy']()[_0x0932('0x27')](function(){_0x59551f[_0x0932('0x1a')](0xcc)[_0x0932('0x1b')]();});}};}function handleEntityNotFound(_0x85cdf4,_0x52b601){return function(_0x3b92cb){if(!_0x3b92cb){_0x85cdf4[_0x0932('0x28')](0x194);}return _0x3b92cb;};}function handleError(_0x5a9b47,_0x1756d8){_0x1756d8=_0x1756d8||0x1f4;return function(_0x1ba84d){logger[_0x0932('0x29')](_0x1ba84d['stack']);if(_0x1ba84d[_0x0932('0x2a')]){delete _0x1ba84d[_0x0932('0x2a')];}_0x5a9b47[_0x0932('0x1a')](_0x1756d8)[_0x0932('0x2b')](_0x1ba84d);};}exports['index']=function(_0x26b90f,_0x1896c5){var _0x274376={},_0x5310af={},_0x5772b9={'count':0x0,'rows':[]};var _0x33c718=_['map'](db[_0x0932('0x2c')][_0x0932('0x2d')],function(_0x305fc1){return{'name':_0x305fc1[_0x0932('0x2e')],'type':_0x305fc1[_0x0932('0x2f')]['key']};});_0x5310af[_0x0932('0x30')]=_[_0x0932('0x31')](_0x33c718,_0x0932('0x2a'));_0x5310af['query']=_['keys'](_0x26b90f['query']);_0x5310af[_0x0932('0x32')]=_[_0x0932('0x33')](_0x5310af[_0x0932('0x30')],_0x5310af[_0x0932('0x34')]);_0x274376['attributes']=_[_0x0932('0x33')](_0x5310af[_0x0932('0x30')],qs[_0x0932('0x35')](_0x26b90f[_0x0932('0x34')][_0x0932('0x35')]));_0x274376[_0x0932('0x36')]=_0x274376[_0x0932('0x36')][_0x0932('0x37')]?_0x274376[_0x0932('0x36')]:_0x5310af[_0x0932('0x30')];if(!_0x26b90f[_0x0932('0x34')]['hasOwnProperty']('nolimit')){_0x274376[_0x0932('0x1e')]=qs[_0x0932('0x1e')](_0x26b90f[_0x0932('0x34')][_0x0932('0x1e')]);_0x274376[_0x0932('0x1c')]=qs[_0x0932('0x1c')](_0x26b90f['query']['offset']);}_0x274376[_0x0932('0x38')]=qs[_0x0932('0x39')](_0x26b90f[_0x0932('0x34')][_0x0932('0x39')]);_0x274376[_0x0932('0x3a')]=qs['filters'](_['pick'](_0x26b90f[_0x0932('0x34')],_0x5310af[_0x0932('0x32')]),_0x33c718);if(_0x26b90f[_0x0932('0x34')][_0x0932('0x3b')]){_0x274376['where']=_[_0x0932('0x3c')](_0x274376[_0x0932('0x3a')],{'$or':_[_0x0932('0x31')](_0x33c718,function(_0x503c77){if(_0x503c77[_0x0932('0x2f')]!==_0x0932('0x3d')){var _0x5671d1={};_0x5671d1[_0x503c77[_0x0932('0x2a')]]={'$like':'%'+_0x26b90f[_0x0932('0x34')][_0x0932('0x3b')]+'%'};return _0x5671d1;}})});}_0x274376=_[_0x0932('0x3c')]({},_0x274376,_0x26b90f['options']);var _0x1e8907={'where':_0x274376['where']};return db[_0x0932('0x2c')][_0x0932('0x1f')](_0x1e8907)[_0x0932('0x27')](function(_0x3c1cfa){_0x5772b9['count']=_0x3c1cfa;if(_0x26b90f[_0x0932('0x34')]['includeAll']){_0x274376[_0x0932('0x3e')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x0932('0x3f')](_0x274376);})['then'](function(_0x5226b8){_0x5772b9[_0x0932('0x40')]=_0x5226b8;return _0x5772b9;})[_0x0932('0x27')](respondWithFilteredResult(_0x1896c5,_0x274376))[_0x0932('0x41')](handleError(_0x1896c5,null));};exports['show']=function(_0x2bac63,_0x231e40){var _0x3ad4a6={'raw':![],'where':{'id':_0x2bac63['params']['id']}},_0x2982b5={};_0x2982b5[_0x0932('0x30')]=_['keys'](db[_0x0932('0x2c')][_0x0932('0x2d')]);_0x2982b5[_0x0932('0x34')]=_[_0x0932('0x42')](_0x2bac63[_0x0932('0x34')]);_0x2982b5['filters']=_[_0x0932('0x33')](_0x2982b5[_0x0932('0x30')],_0x2982b5[_0x0932('0x34')]);_0x3ad4a6[_0x0932('0x36')]=_[_0x0932('0x33')](_0x2982b5[_0x0932('0x30')],qs['fields'](_0x2bac63[_0x0932('0x34')]['fields']));_0x3ad4a6[_0x0932('0x36')]=_0x3ad4a6[_0x0932('0x36')][_0x0932('0x37')]?_0x3ad4a6[_0x0932('0x36')]:_0x2982b5[_0x0932('0x30')];if(_0x2bac63[_0x0932('0x34')][_0x0932('0x43')]){_0x3ad4a6['include']=[{'all':!![]}];}_0x3ad4a6=_['merge']({},_0x3ad4a6,_0x2bac63[_0x0932('0x44')]);return db[_0x0932('0x2c')][_0x0932('0x45')](_0x3ad4a6)[_0x0932('0x27')](handleEntityNotFound(_0x231e40,null))[_0x0932('0x27')](respondWithResult(_0x231e40,null))[_0x0932('0x41')](handleError(_0x231e40,null));};exports[_0x0932('0x46')]=function(_0x281fb9,_0xf474cc){return db[_0x0932('0x2c')][_0x0932('0x46')](_0x281fb9[_0x0932('0x47')],{})['then'](respondWithResult(_0xf474cc,0xc9))[_0x0932('0x41')](handleError(_0xf474cc,null));};exports[_0x0932('0x26')]=function(_0x71d377,_0x5d6a2a){if(_0x71d377[_0x0932('0x47')]['id']){delete _0x71d377[_0x0932('0x47')]['id'];}return db[_0x0932('0x2c')]['find']({'where':{'id':_0x71d377[_0x0932('0x48')]['id']}})[_0x0932('0x27')](handleEntityNotFound(_0x5d6a2a,null))[_0x0932('0x27')](saveUpdates(_0x71d377[_0x0932('0x47')],null))[_0x0932('0x27')](respondWithResult(_0x5d6a2a,null))[_0x0932('0x41')](handleError(_0x5d6a2a,null));};exports[_0x0932('0x49')]=function(_0x431268,_0x30bff9){return db[_0x0932('0x2c')][_0x0932('0x45')]({'where':{'id':_0x431268[_0x0932('0x48')]['id']}})[_0x0932('0x27')](handleEntityNotFound(_0x30bff9,null))[_0x0932('0x27')](removeEntity(_0x30bff9,null))[_0x0932('0x41')](handleError(_0x30bff9,null));};exports[_0x0932('0x4a')]=function(_0x36896a,_0x4c94e9,_0x83580b){var _0x4345aa={};var _0x419261={};var _0x11afc3;var _0x2c926c;return db['SugarcrmAccount'][_0x0932('0x4b')]({'where':{'id':_0x36896a[_0x0932('0x48')]['id']}})[_0x0932('0x27')](handleEntityNotFound(_0x4c94e9,null))[_0x0932('0x27')](function(_0x2566d3){if(_0x2566d3){_0x11afc3=_0x2566d3;_0x419261[_0x0932('0x30')]=_['keys'](db[_0x0932('0x4c')]['rawAttributes']);_0x419261[_0x0932('0x34')]=_[_0x0932('0x42')](_0x36896a['query']);_0x419261[_0x0932('0x32')]=_['intersection'](_0x419261['model'],_0x419261[_0x0932('0x34')]);_0x4345aa['attributes']=_[_0x0932('0x33')](_0x419261[_0x0932('0x30')],qs[_0x0932('0x35')](_0x36896a['query'][_0x0932('0x35')]));_0x4345aa[_0x0932('0x36')]=_0x4345aa['attributes'][_0x0932('0x37')]?_0x4345aa[_0x0932('0x36')]:_0x419261[_0x0932('0x30')];_0x4345aa['order']=qs[_0x0932('0x39')](_0x36896a[_0x0932('0x34')][_0x0932('0x39')]);_0x4345aa[_0x0932('0x3a')]=qs['filters'](_[_0x0932('0x4d')](_0x36896a[_0x0932('0x34')],_0x419261['filters']));if(_0x36896a[_0x0932('0x34')]['filter']){_0x4345aa['where']=_[_0x0932('0x3c')](_0x4345aa[_0x0932('0x3a')],{'$or':_['map'](_0x4345aa[_0x0932('0x36')],function(_0x3bb082){var _0x3ed921={};_0x3ed921[_0x3bb082]={'$like':'%'+_0x36896a[_0x0932('0x34')][_0x0932('0x3b')]+'%'};return _0x3ed921;})});}_0x4345aa=_['merge']({},_0x4345aa,_0x36896a['options']);return _0x11afc3[_0x0932('0x4a')](_0x4345aa);}})[_0x0932('0x27')](function(_0x26560d){if(_0x26560d){_0x2c926c=_0x26560d[_0x0932('0x37')];if(!_0x36896a[_0x0932('0x34')][_0x0932('0x4e')](_0x0932('0x4f'))){_0x4345aa[_0x0932('0x1e')]=qs[_0x0932('0x1e')](_0x36896a['query']['limit']);_0x4345aa[_0x0932('0x1c')]=qs[_0x0932('0x1c')](_0x36896a[_0x0932('0x34')]['offset']);}return _0x11afc3[_0x0932('0x4a')](_0x4345aa);}})['then'](function(_0x29311f){if(_0x29311f){return _0x29311f?{'count':_0x2c926c,'rows':_0x29311f}:null;}})['then'](respondWithResult(_0x4c94e9,null))[_0x0932('0x41')](handleError(_0x4c94e9,null));};exports[_0x0932('0x50')]=function(_0xd0ee41,_0x5edfde,_0xd7f9bf){if(_0xd0ee41[_0x0932('0x47')]['id']){delete _0xd0ee41['body']['id'];}return db[_0x0932('0x2c')][_0x0932('0x4b')]({'where':{'id':_0xd0ee41['params']['id']}})[_0x0932('0x27')](handleEntityNotFound(_0x5edfde,null))[_0x0932('0x27')](function(_0x1d8bea){if(_0x1d8bea){_0xd0ee41[_0x0932('0x47')][_0x0932('0x51')]=_0x1d8bea['id'];_0xd0ee41[_0x0932('0x47')][_0x0932('0x52')]=integrations[_0x0932('0x53')](_0xd0ee41['body'][_0x0932('0x54')],_0xd0ee41[_0x0932('0x47')][_0x0932('0x2f')]);_0xd0ee41[_0x0932('0x47')][_0x0932('0x55')]=integrations[_0x0932('0x56')](_0xd0ee41[_0x0932('0x47')][_0x0932('0x54')],_0xd0ee41[_0x0932('0x47')][_0x0932('0x2f')]);return db[_0x0932('0x4c')][_0x0932('0x46')](_0xd0ee41['body'],{'include':[{'model':db[_0x0932('0x57')],'as':'Subjects'},{'model':db[_0x0932('0x57')],'as':'Descriptions'}]});}return null;})[_0x0932('0x27')](respondWithResult(_0x5edfde,null))['catch'](handleError(_0x5edfde,null));};exports[_0x0932('0x58')]=function(_0x2d68ba,_0x9f987e,_0x94031e){var _0x2a9ff5='';var _0x3bfaa8=['id','name',_0x0932('0x59'),'created_by',_0x0932('0x5a'),_0x0932('0x5b'),'duration_hours',_0x0932('0x5c'),'parent_id',_0x0932('0x5d'),_0x0932('0x5e'),_0x0932('0x5f')];return db['SugarcrmAccount'][_0x0932('0x4b')]({'where':{'id':_0x2d68ba[_0x0932('0x48')]['id']},'attributes':['id',_0x0932('0x60'),_0x0932('0x61'),'remoteUri']})[_0x0932('0x27')](handleEntityNotFound(_0x9f987e,null))['then'](function(_0x25b7dd){if(_0x25b7dd){_0x2a9ff5=_0x25b7dd[_0x0932('0x62')];var _0x517933=_0x2a9ff5[_0x0932('0x63')](-0x1);if(_0x517933==='/'){_0x2a9ff5=_0x2a9ff5[_0x0932('0x64')](0x0,_0x2a9ff5['lastIndexOf'](_0x517933));}return rp({'method':_0x0932('0x65'),'uri':util['format'](_0x0932('0x66'),_0x2a9ff5,_0x0932('0x67')),'json':!![],'form':{'method':'login','input_type':_0x0932('0x68'),'response_type':_0x0932('0x68'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x25b7dd[_0x0932('0x60')],'password':_0x25b7dd[_0x0932('0x61')],'encryption':'PLAIN'},'application':_0x0932('0x69')})}});}})['then'](function(_0x4b4ee9){if(_0x4b4ee9&&_0x4b4ee9[_0x0932('0x2a')]!=='Invalid\x20Login'&&_0x4b4ee9['name']!==_0x0932('0x6a')){return rp({'method':'POST','uri':util[_0x0932('0x6b')](_0x0932('0x66'),_0x2a9ff5,_0x0932('0x67')),'json':!![],'form':{'method':_0x0932('0x6c'),'input_type':_0x0932('0x68'),'response_type':'JSON','rest_data':JSON[_0x0932('0x6d')]({'session':_0x4b4ee9['id'],'module_name':'Calls'})}})[_0x0932('0x27')](function(_0x2c91f0){if(_0x2c91f0){var _0x5393a5=_[_0x0932('0x6e')](_0x2c91f0['module_fields']);_[_0x0932('0x6f')](_0x5393a5,function(_0x1cdd39){return _0x3bfaa8[_0x0932('0x70')](_0x1cdd39['name']);});return{'count':_0x5393a5[_0x0932('0x37')],'rows':_[_0x0932('0x31')](_0x5393a5,function(_0xcc84f0){return{'id':_0xcc84f0['name'],'name':_0xcc84f0[_0x0932('0x71')],'custom':_[_0x0932('0x72')](_0xcc84f0[_0x0932('0x2a')],'_c')?!![]:![],'options':_0xcc84f0['options']?_[_0x0932('0x31')](_[_0x0932('0x6e')](_0xcc84f0['options']),function(_0x206e66){return{'name':_0x206e66[_0x0932('0x73')],'value':_0x206e66[_0x0932('0x2a')]};}):[]};})};}})['then'](respondWithResult(_0x9f987e,null))[_0x0932('0x41')](function(_0x3de001){var _0x117457=_0x2d68ba[_0x0932('0x34')][_0x0932('0x74')]?0x1f4:_0x3de001['statusCode']||0x1f4;logger['error'](_0x0932('0x75'),_0x0932('0x58'),_0x117457,JSON[_0x0932('0x6d')](_0x3de001));delete _0x3de001[_0x0932('0x2a')];if(_0x117457===0x191){_0x117457=0x190;}_0x9f987e[_0x0932('0x1a')](_0x117457)['send'](_0x2d68ba[_0x0932('0x34')][_0x0932('0x74')]?{'message':_0x0932('0x76'),'statusCode':_0x3de001['statusCode']}:_0x3de001);});}else{var _0x4191a3=0x1f4;_0x9f987e['status'](_0x4191a3)[_0x0932('0x2b')]({'message':_0x0932('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xbbd6=['name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','limit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','getConfigurations','findOne','keys','SugarcrmConfiguration','order','pick','length','addConfiguration','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','slice','substring','format','/service/v4_1/rest.php','login','JSON','PLAIN','Password\x20Expired','POST','%s%s','get_module_fields','stringify','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','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','../../mysqldb','sendStatus','status','offset','undefined','count','Content-Range','json','save','then','destroy','error','stack'];(function(_0xdb20ee,_0x529393){var _0x443675=function(_0x254e11){while(--_0x254e11){_0xdb20ee['push'](_0xdb20ee['shift']());}};_0x443675(++_0x529393);}(_0xbbd6,0x1be));var _0x6bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6bbd('0x0'));var rimraf=require(_0x6bbd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6bbd('0x2'));var rp=require(_0x6bbd('0x3'));var moment=require('moment');var BPromise=require(_0x6bbd('0x4'));var Mustache=require('mustache');var util=require(_0x6bbd('0x5'));var path=require(_0x6bbd('0x6'));var sox=require('sox');var csv=require(_0x6bbd('0x7'));var ejs=require(_0x6bbd('0x8'));var fs=require('fs');var fs_extra=require(_0x6bbd('0x9'));var _=require(_0x6bbd('0xa'));var squel=require(_0x6bbd('0xb'));var crypto=require('crypto');var jsforce=require(_0x6bbd('0xc'));var deskjs=require(_0x6bbd('0xd'));var toCsv=require(_0x6bbd('0x7'));var querystring=require(_0x6bbd('0xe'));var Papa=require(_0x6bbd('0xf'));var Redis=require(_0x6bbd('0x10'));var authService=require(_0x6bbd('0x11'));var qs=require(_0x6bbd('0x12'));var as=require(_0x6bbd('0x13'));var hardwareService=require(_0x6bbd('0x14'));var logger=require(_0x6bbd('0x15'))(_0x6bbd('0x16'));var utils=require(_0x6bbd('0x17'));var config=require(_0x6bbd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6bbd('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59289e,_0x45a415){_0x45a415=_0x45a415||0xcc;return function(_0x192ef9){if(_0x192ef9){return _0x59289e[_0x6bbd('0x1a')](_0x45a415);}return _0x59289e[_0x6bbd('0x1b')](_0x45a415)['end']();};}function respondWithResult(_0x8915ba,_0x1c715d){_0x1c715d=_0x1c715d||0xc8;return function(_0x11467e){if(_0x11467e){return _0x8915ba[_0x6bbd('0x1b')](_0x1c715d)['json'](_0x11467e);}};}function respondWithFilteredResult(_0x261306,_0x3883a2){return function(_0x2a3e2b){if(_0x2a3e2b){var _0x1e705e=typeof _0x3883a2[_0x6bbd('0x1c')]==='undefined'&&typeof _0x3883a2['limit']===_0x6bbd('0x1d');var _0x1d1fad=_0x2a3e2b[_0x6bbd('0x1e')];var _0x820cba=_0x1e705e?0x0:_0x3883a2[_0x6bbd('0x1c')];var _0x4b4646=_0x1e705e?_0x2a3e2b[_0x6bbd('0x1e')]:_0x3883a2['offset']+_0x3883a2['limit'];var _0xc5f49e;if(_0x4b4646>=_0x1d1fad){_0x4b4646=_0x1d1fad;_0xc5f49e=0xc8;}else{_0xc5f49e=0xce;}_0x261306[_0x6bbd('0x1b')](_0xc5f49e);return _0x261306['set'](_0x6bbd('0x1f'),_0x820cba+'-'+_0x4b4646+'/'+_0x1d1fad)[_0x6bbd('0x20')](_0x2a3e2b);}return null;};}function patchUpdates(_0x203920){return function(_0x3b2ad4){try{jsonpatch['apply'](_0x3b2ad4,_0x203920,!![]);}catch(_0x449fcd){return BPromise['reject'](_0x449fcd);}return _0x3b2ad4[_0x6bbd('0x21')]();};}function saveUpdates(_0x3d6092,_0x2493ec){return function(_0x28df1a){if(_0x28df1a){return _0x28df1a['update'](_0x3d6092)[_0x6bbd('0x22')](function(_0x221e06){return _0x221e06;});}return null;};}function removeEntity(_0x3c318e,_0x49e20f){return function(_0x13e445){if(_0x13e445){return _0x13e445[_0x6bbd('0x23')]()[_0x6bbd('0x22')](function(){_0x3c318e[_0x6bbd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46f4e4,_0x4ca3ef){return function(_0x2e6d7b){if(!_0x2e6d7b){_0x46f4e4[_0x6bbd('0x1a')](0x194);}return _0x2e6d7b;};}function handleError(_0x47b1fa,_0x5ef416){_0x5ef416=_0x5ef416||0x1f4;return function(_0x5d376d){logger[_0x6bbd('0x24')](_0x5d376d[_0x6bbd('0x25')]);if(_0x5d376d[_0x6bbd('0x26')]){delete _0x5d376d[_0x6bbd('0x26')];}_0x47b1fa[_0x6bbd('0x1b')](_0x5ef416)[_0x6bbd('0x27')](_0x5d376d);};}exports[_0x6bbd('0x28')]=function(_0x27aa73,_0x31e500){var _0x23dc7c={},_0x1464b2={},_0xee562f={'count':0x0,'rows':[]};var _0x5bb09e=_[_0x6bbd('0x29')](db[_0x6bbd('0x2a')][_0x6bbd('0x2b')],function(_0x19095f){return{'name':_0x19095f[_0x6bbd('0x2c')],'type':_0x19095f[_0x6bbd('0x2d')][_0x6bbd('0x2e')]};});_0x1464b2['model']=_['map'](_0x5bb09e,_0x6bbd('0x26'));_0x1464b2[_0x6bbd('0x2f')]=_['keys'](_0x27aa73[_0x6bbd('0x2f')]);_0x1464b2[_0x6bbd('0x30')]=_[_0x6bbd('0x31')](_0x1464b2[_0x6bbd('0x32')],_0x1464b2[_0x6bbd('0x2f')]);_0x23dc7c[_0x6bbd('0x33')]=_[_0x6bbd('0x31')](_0x1464b2['model'],qs[_0x6bbd('0x34')](_0x27aa73[_0x6bbd('0x2f')]['fields']));_0x23dc7c[_0x6bbd('0x33')]=_0x23dc7c['attributes']['length']?_0x23dc7c['attributes']:_0x1464b2[_0x6bbd('0x32')];if(!_0x27aa73['query']['hasOwnProperty']('nolimit')){_0x23dc7c[_0x6bbd('0x35')]=qs[_0x6bbd('0x35')](_0x27aa73['query']['limit']);_0x23dc7c['offset']=qs[_0x6bbd('0x1c')](_0x27aa73[_0x6bbd('0x2f')]['offset']);}_0x23dc7c['order']=qs[_0x6bbd('0x36')](_0x27aa73[_0x6bbd('0x2f')][_0x6bbd('0x36')]);_0x23dc7c[_0x6bbd('0x37')]=qs[_0x6bbd('0x30')](_['pick'](_0x27aa73[_0x6bbd('0x2f')],_0x1464b2[_0x6bbd('0x30')]),_0x5bb09e);if(_0x27aa73['query'][_0x6bbd('0x38')]){_0x23dc7c[_0x6bbd('0x37')]=_[_0x6bbd('0x39')](_0x23dc7c[_0x6bbd('0x37')],{'$or':_['map'](_0x5bb09e,function(_0xe3342d){if(_0xe3342d[_0x6bbd('0x2d')]!==_0x6bbd('0x3a')){var _0x1aea47={};_0x1aea47[_0xe3342d['name']]={'$like':'%'+_0x27aa73[_0x6bbd('0x2f')][_0x6bbd('0x38')]+'%'};return _0x1aea47;}})});}_0x23dc7c=_[_0x6bbd('0x39')]({},_0x23dc7c,_0x27aa73[_0x6bbd('0x3b')]);var _0x383133={'where':_0x23dc7c['where']};return db[_0x6bbd('0x2a')][_0x6bbd('0x1e')](_0x383133)[_0x6bbd('0x22')](function(_0x4bbfa5){_0xee562f[_0x6bbd('0x1e')]=_0x4bbfa5;if(_0x27aa73[_0x6bbd('0x2f')]['includeAll']){_0x23dc7c[_0x6bbd('0x3c')]=[{'all':!![]}];}return db[_0x6bbd('0x2a')][_0x6bbd('0x3d')](_0x23dc7c);})[_0x6bbd('0x22')](function(_0x37b3cf){_0xee562f[_0x6bbd('0x3e')]=_0x37b3cf;return _0xee562f;})['then'](respondWithFilteredResult(_0x31e500,_0x23dc7c))[_0x6bbd('0x3f')](handleError(_0x31e500,null));};exports[_0x6bbd('0x40')]=function(_0x4a6965,_0x310393){var _0x4f03c6={'raw':![],'where':{'id':_0x4a6965[_0x6bbd('0x41')]['id']}},_0x28d91c={};_0x28d91c[_0x6bbd('0x32')]=_['keys'](db[_0x6bbd('0x2a')][_0x6bbd('0x2b')]);_0x28d91c[_0x6bbd('0x2f')]=_['keys'](_0x4a6965[_0x6bbd('0x2f')]);_0x28d91c[_0x6bbd('0x30')]=_[_0x6bbd('0x31')](_0x28d91c[_0x6bbd('0x32')],_0x28d91c[_0x6bbd('0x2f')]);_0x4f03c6[_0x6bbd('0x33')]=_[_0x6bbd('0x31')](_0x28d91c[_0x6bbd('0x32')],qs[_0x6bbd('0x34')](_0x4a6965[_0x6bbd('0x2f')][_0x6bbd('0x34')]));_0x4f03c6[_0x6bbd('0x33')]=_0x4f03c6[_0x6bbd('0x33')]['length']?_0x4f03c6[_0x6bbd('0x33')]:_0x28d91c[_0x6bbd('0x32')];if(_0x4a6965[_0x6bbd('0x2f')][_0x6bbd('0x42')]){_0x4f03c6[_0x6bbd('0x3c')]=[{'all':!![]}];}_0x4f03c6=_[_0x6bbd('0x39')]({},_0x4f03c6,_0x4a6965['options']);return db[_0x6bbd('0x2a')][_0x6bbd('0x43')](_0x4f03c6)[_0x6bbd('0x22')](handleEntityNotFound(_0x310393,null))[_0x6bbd('0x22')](respondWithResult(_0x310393,null))[_0x6bbd('0x3f')](handleError(_0x310393,null));};exports[_0x6bbd('0x44')]=function(_0x770311,_0x1a47bf){return db['SugarcrmAccount'][_0x6bbd('0x44')](_0x770311['body'],{})[_0x6bbd('0x22')](respondWithResult(_0x1a47bf,0xc9))[_0x6bbd('0x3f')](handleError(_0x1a47bf,null));};exports[_0x6bbd('0x45')]=function(_0x26c1f0,_0x45b352){if(_0x26c1f0['body']['id']){delete _0x26c1f0[_0x6bbd('0x46')]['id'];}return db[_0x6bbd('0x2a')]['find']({'where':{'id':_0x26c1f0[_0x6bbd('0x41')]['id']}})[_0x6bbd('0x22')](handleEntityNotFound(_0x45b352,null))['then'](saveUpdates(_0x26c1f0[_0x6bbd('0x46')],null))[_0x6bbd('0x22')](respondWithResult(_0x45b352,null))['catch'](handleError(_0x45b352,null));};exports[_0x6bbd('0x23')]=function(_0x10fbb1,_0x2610ce){return db[_0x6bbd('0x2a')]['find']({'where':{'id':_0x10fbb1['params']['id']}})[_0x6bbd('0x22')](handleEntityNotFound(_0x2610ce,null))[_0x6bbd('0x22')](removeEntity(_0x2610ce,null))['catch'](handleError(_0x2610ce,null));};exports[_0x6bbd('0x47')]=function(_0x1246b7,_0x47f965,_0x3e9e93){var _0x3b10e2={};var _0x5c41ec={};var _0xaa114f;var _0x81a68a;return db[_0x6bbd('0x2a')][_0x6bbd('0x48')]({'where':{'id':_0x1246b7['params']['id']}})[_0x6bbd('0x22')](handleEntityNotFound(_0x47f965,null))[_0x6bbd('0x22')](function(_0x3f0607){if(_0x3f0607){_0xaa114f=_0x3f0607;_0x5c41ec[_0x6bbd('0x32')]=_[_0x6bbd('0x49')](db[_0x6bbd('0x4a')][_0x6bbd('0x2b')]);_0x5c41ec[_0x6bbd('0x2f')]=_[_0x6bbd('0x49')](_0x1246b7[_0x6bbd('0x2f')]);_0x5c41ec['filters']=_[_0x6bbd('0x31')](_0x5c41ec[_0x6bbd('0x32')],_0x5c41ec[_0x6bbd('0x2f')]);_0x3b10e2[_0x6bbd('0x33')]=_[_0x6bbd('0x31')](_0x5c41ec[_0x6bbd('0x32')],qs[_0x6bbd('0x34')](_0x1246b7[_0x6bbd('0x2f')]['fields']));_0x3b10e2[_0x6bbd('0x33')]=_0x3b10e2[_0x6bbd('0x33')]['length']?_0x3b10e2[_0x6bbd('0x33')]:_0x5c41ec['model'];_0x3b10e2[_0x6bbd('0x4b')]=qs['sort'](_0x1246b7[_0x6bbd('0x2f')]['sort']);_0x3b10e2[_0x6bbd('0x37')]=qs[_0x6bbd('0x30')](_[_0x6bbd('0x4c')](_0x1246b7[_0x6bbd('0x2f')],_0x5c41ec[_0x6bbd('0x30')]));if(_0x1246b7[_0x6bbd('0x2f')]['filter']){_0x3b10e2['where']=_[_0x6bbd('0x39')](_0x3b10e2[_0x6bbd('0x37')],{'$or':_[_0x6bbd('0x29')](_0x3b10e2['attributes'],function(_0x2efaf7){var _0x46aa0d={};_0x46aa0d[_0x2efaf7]={'$like':'%'+_0x1246b7[_0x6bbd('0x2f')][_0x6bbd('0x38')]+'%'};return _0x46aa0d;})});}_0x3b10e2=_[_0x6bbd('0x39')]({},_0x3b10e2,_0x1246b7[_0x6bbd('0x3b')]);return _0xaa114f['getConfigurations'](_0x3b10e2);}})[_0x6bbd('0x22')](function(_0xd4041a){if(_0xd4041a){_0x81a68a=_0xd4041a[_0x6bbd('0x4d')];if(!_0x1246b7[_0x6bbd('0x2f')]['hasOwnProperty']('nolimit')){_0x3b10e2[_0x6bbd('0x35')]=qs[_0x6bbd('0x35')](_0x1246b7[_0x6bbd('0x2f')][_0x6bbd('0x35')]);_0x3b10e2[_0x6bbd('0x1c')]=qs[_0x6bbd('0x1c')](_0x1246b7[_0x6bbd('0x2f')][_0x6bbd('0x1c')]);}return _0xaa114f[_0x6bbd('0x47')](_0x3b10e2);}})['then'](function(_0x515d4a){if(_0x515d4a){return _0x515d4a?{'count':_0x81a68a,'rows':_0x515d4a}:null;}})[_0x6bbd('0x22')](respondWithResult(_0x47f965,null))[_0x6bbd('0x3f')](handleError(_0x47f965,null));};exports[_0x6bbd('0x4e')]=function(_0x3bbe65,_0x193be9,_0x3d5bd5){if(_0x3bbe65[_0x6bbd('0x46')]['id']){delete _0x3bbe65[_0x6bbd('0x46')]['id'];}return db[_0x6bbd('0x2a')][_0x6bbd('0x48')]({'where':{'id':_0x3bbe65[_0x6bbd('0x41')]['id']}})[_0x6bbd('0x22')](handleEntityNotFound(_0x193be9,null))[_0x6bbd('0x22')](function(_0x1a19ed){if(_0x1a19ed){_0x3bbe65[_0x6bbd('0x46')]['AccountId']=_0x1a19ed['id'];_0x3bbe65['body'][_0x6bbd('0x4f')]=integrations[_0x6bbd('0x50')](_0x3bbe65[_0x6bbd('0x46')][_0x6bbd('0x51')],_0x3bbe65[_0x6bbd('0x46')][_0x6bbd('0x2d')]);_0x3bbe65['body']['Descriptions']=integrations[_0x6bbd('0x52')](_0x3bbe65['body']['channel'],_0x3bbe65[_0x6bbd('0x46')]['type']);return db[_0x6bbd('0x4a')][_0x6bbd('0x44')](_0x3bbe65[_0x6bbd('0x46')],{'include':[{'model':db[_0x6bbd('0x53')],'as':_0x6bbd('0x4f')},{'model':db[_0x6bbd('0x53')],'as':_0x6bbd('0x54')}]});}return null;})[_0x6bbd('0x22')](respondWithResult(_0x193be9,null))[_0x6bbd('0x3f')](handleError(_0x193be9,null));};exports[_0x6bbd('0x55')]=function(_0xad6bd,_0x14b985,_0x5a35b1){var _0x554578='';var _0x1bb9c3=['id','name',_0x6bbd('0x56'),_0x6bbd('0x57'),_0x6bbd('0x58'),_0x6bbd('0x59'),_0x6bbd('0x5a'),_0x6bbd('0x5b'),_0x6bbd('0x5c'),'parent_type',_0x6bbd('0x5d'),'direction'];return db['SugarcrmAccount'][_0x6bbd('0x48')]({'where':{'id':_0xad6bd[_0x6bbd('0x41')]['id']},'attributes':['id',_0x6bbd('0x5e'),_0x6bbd('0x5f'),_0x6bbd('0x60')]})[_0x6bbd('0x22')](handleEntityNotFound(_0x14b985,null))['then'](function(_0x5a95c6){if(_0x5a95c6){_0x554578=_0x5a95c6[_0x6bbd('0x60')];var _0x274353=_0x554578[_0x6bbd('0x61')](-0x1);if(_0x274353==='/'){_0x554578=_0x554578[_0x6bbd('0x62')](0x0,_0x554578['lastIndexOf'](_0x274353));}return rp({'method':'POST','uri':util[_0x6bbd('0x63')]('%s%s',_0x554578,_0x6bbd('0x64')),'json':!![],'form':{'method':_0x6bbd('0x65'),'input_type':'JSON','response_type':_0x6bbd('0x66'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5a95c6[_0x6bbd('0x5e')],'password':_0x5a95c6[_0x6bbd('0x5f')],'encryption':_0x6bbd('0x67')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x21235a){if(_0x21235a&&_0x21235a[_0x6bbd('0x26')]!=='Invalid\x20Login'&&_0x21235a[_0x6bbd('0x26')]!==_0x6bbd('0x68')){return rp({'method':_0x6bbd('0x69'),'uri':util[_0x6bbd('0x63')](_0x6bbd('0x6a'),_0x554578,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x6bbd('0x6b'),'input_type':'JSON','response_type':_0x6bbd('0x66'),'rest_data':JSON[_0x6bbd('0x6c')]({'session':_0x21235a['id'],'module_name':_0x6bbd('0x6d')})}})['then'](function(_0x5921c8){if(_0x5921c8){var _0x438013=_[_0x6bbd('0x6e')](_0x5921c8[_0x6bbd('0x6f')]);_[_0x6bbd('0x70')](_0x438013,function(_0xbfa30b){return _0x1bb9c3[_0x6bbd('0x71')](_0xbfa30b['name']);});return{'count':_0x438013[_0x6bbd('0x4d')],'rows':_[_0x6bbd('0x29')](_0x438013,function(_0x37d4c3){return{'id':_0x37d4c3[_0x6bbd('0x26')],'name':_0x37d4c3[_0x6bbd('0x72')],'custom':_[_0x6bbd('0x73')](_0x37d4c3[_0x6bbd('0x26')],'_c')?!![]:![],'options':_0x37d4c3[_0x6bbd('0x3b')]?_['map'](_['values'](_0x37d4c3['options']),function(_0x380546){return{'name':_0x380546[_0x6bbd('0x74')],'value':_0x380546[_0x6bbd('0x26')]};}):[]};})};}})['then'](respondWithResult(_0x14b985,null))[_0x6bbd('0x3f')](function(_0x113d14){var _0x4d27ed=_0xad6bd[_0x6bbd('0x2f')][_0x6bbd('0x75')]?0x1f4:_0x113d14[_0x6bbd('0x76')]||0x1f4;logger[_0x6bbd('0x24')](_0x6bbd('0x77'),_0x6bbd('0x55'),_0x4d27ed,JSON['stringify'](_0x113d14));delete _0x113d14[_0x6bbd('0x26')];if(_0x4d27ed===0x191){_0x4d27ed=0x190;}_0x14b985[_0x6bbd('0x1b')](_0x4d27ed)[_0x6bbd('0x27')](_0xad6bd[_0x6bbd('0x2f')][_0x6bbd('0x75')]?{'message':_0x6bbd('0x78'),'statusCode':_0x113d14[_0x6bbd('0x76')]}:_0x113d14);});}else{var _0x113b4e=0x1f4;_0x14b985[_0x6bbd('0x1b')](_0x113b4e)[_0x6bbd('0x27')]({'message':_0x6bbd('0x78'),'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 6aa98db..26f2b4d 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 _0xc11e=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','moment','request-promise'];(function(_0x1facc6,_0x541448){var _0x174763=function(_0x4abcc0){while(--_0x4abcc0){_0x1facc6['push'](_0x1facc6['shift']());}};_0x174763(++_0x541448);}(_0xc11e,0xf8));var _0xec11=function(_0x35a3da,_0x286c6a){_0x35a3da=_0x35a3da-0x0;var _0x568a40=_0xc11e[_0x35a3da];return _0x568a40;};'use strict';var _=require(_0xec11('0x0'));var util=require('util');var logger=require(_0xec11('0x1'))('api');var moment=require(_0xec11('0x2'));var BPromise=require('bluebird');var rp=require(_0xec11('0x3'));var fs=require('fs');var path=require(_0xec11('0x4'));var rimraf=require(_0xec11('0x5'));var config=require(_0xec11('0x6'));var attributes=require(_0xec11('0x7'));var integrations=require(_0xec11('0x8'));module['exports']=function(_0x23cd66,_0x120483){return _0x23cd66[_0xec11('0x9')](_0xec11('0xa'),attributes,{'tableName':_0xec11('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9fc=['api','moment','request-promise','rimraf','../../config/environment','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xa9fc,0x19f));var _0xca9f=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0xa9fc[_0x531d15];return _0x271a18;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var logger=require(_0xca9f('0x2'))(_0xca9f('0x3'));var moment=require(_0xca9f('0x4'));var BPromise=require('bluebird');var rp=require(_0xca9f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca9f('0x6'));var config=require(_0xca9f('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x234d90,_0x48f9ca){return _0x234d90[_0xca9f('0x8')](_0xca9f('0x9'),attributes,{'tableName':_0xca9f('0xa'),'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 5dd27ee..c08418b 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 _0x25b8=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','limit','map','include','model','attributes','then','catch','ShowSugarcrmAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1abf7b,_0x320253){var _0x423b0a=function(_0x485cea){while(--_0x485cea){_0x1abf7b['push'](_0x1abf7b['shift']());}};_0x423b0a(++_0x320253);}(_0x25b8,0x135));var _0x825b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x25b8[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x825b('0x0'));var util=require('util');var moment=require(_0x825b('0x1'));var BPromise=require(_0x825b('0x2'));var rs=require(_0x825b('0x3'));var fs=require('fs');var Redis=require(_0x825b('0x4'));var db=require(_0x825b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x825b('0x6'))(_0x825b('0x7'));var config=require(_0x825b('0x8'));var jayson=require(_0x825b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x356540,_0x3da9a7,_0x2a2605){return new BPromise(function(_0x11a3ca,_0x4c0060){return client[_0x825b('0xa')](_0x356540,_0x2a2605)['then'](function(_0x49bf12){logger[_0x825b('0xb')](_0x825b('0xc'),_0x3da9a7,_0x825b('0xd'));logger[_0x825b('0xe')](_0x825b('0xf'),_0x3da9a7,_0x825b('0xd'),JSON[_0x825b('0x10')](_0x49bf12));if(_0x49bf12[_0x825b('0x11')]){if(_0x49bf12[_0x825b('0x11')]['code']===0x1f4){logger['error'](_0x825b('0xc'),_0x3da9a7,_0x49bf12[_0x825b('0x11')][_0x825b('0x12')]);return _0x4c0060(_0x49bf12[_0x825b('0x11')][_0x825b('0x12')]);}logger[_0x825b('0x11')](_0x825b('0xc'),_0x3da9a7,_0x49bf12[_0x825b('0x11')]['message']);return _0x11a3ca(_0x49bf12[_0x825b('0x11')][_0x825b('0x12')]);}else{logger[_0x825b('0xb')](_0x825b('0xc'),_0x3da9a7,'request\x20sent');_0x11a3ca(_0x49bf12[_0x825b('0x13')][_0x825b('0x12')]);}})['catch'](function(_0x32d3d7){logger[_0x825b('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x3da9a7,_0x32d3d7);_0x4c0060(_0x32d3d7);});});}exports[_0x825b('0x14')]=function(_0x42f040){var _0xbde8ae=this;return new Promise(function(_0x547b15,_0x1bec81){return db[_0x825b('0x15')][_0x825b('0x16')]({'raw':_0x42f040[_0x825b('0x17')]?_0x42f040['options'][_0x825b('0x18')]===undefined?!![]:![]:!![],'where':_0x42f040[_0x825b('0x17')]?_0x42f040[_0x825b('0x17')]['where']||null:null,'attributes':_0x42f040['options']?_0x42f040[_0x825b('0x17')]['attributes']||null:null,'limit':_0x42f040[_0x825b('0x17')]?_0x42f040[_0x825b('0x17')][_0x825b('0x19')]||null:null,'include':_0x42f040['options']?_0x42f040[_0x825b('0x17')]['include']?_[_0x825b('0x1a')](_0x42f040[_0x825b('0x17')][_0x825b('0x1b')],function(_0x53c1e2){return{'model':db[_0x53c1e2[_0x825b('0x1c')]],'as':_0x53c1e2['as'],'attributes':_0x53c1e2[_0x825b('0x1d')],'include':_0x53c1e2['include']?_[_0x825b('0x1a')](_0x53c1e2[_0x825b('0x1b')],function(_0x2bb370){return{'model':db[_0x2bb370[_0x825b('0x1c')]],'as':_0x2bb370['as'],'attributes':_0x2bb370[_0x825b('0x1d')],'include':_0x2bb370[_0x825b('0x1b')]?_[_0x825b('0x1a')](_0x2bb370[_0x825b('0x1b')],function(_0x183e6a){return{'model':db[_0x183e6a['model']],'as':_0x183e6a['as'],'attributes':_0x183e6a[_0x825b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x825b('0x1e')](function(_0x37f46c){logger['info']('GetSugarcrmAccount',_0x42f040);logger[_0x825b('0xe')](_0x825b('0x14'),_0x42f040,JSON[_0x825b('0x10')](_0x37f46c));_0x547b15(_0x37f46c);})[_0x825b('0x1f')](function(_0x4617a1){logger[_0x825b('0x11')](_0x825b('0x14'),_0x4617a1[_0x825b('0x12')],_0x42f040);_0x1bec81(_0xbde8ae[_0x825b('0x11')](0x1f4,_0x4617a1[_0x825b('0x12')]));});});};exports[_0x825b('0x20')]=function(_0x3a53ef){var _0x1fd3cf=this;return new Promise(function(_0x36bbe0,_0x27af1c){return db[_0x825b('0x15')][_0x825b('0x21')]({'raw':_0x3a53ef[_0x825b('0x17')]?_0x3a53ef[_0x825b('0x17')][_0x825b('0x18')]===undefined?!![]:![]:!![],'where':_0x3a53ef[_0x825b('0x17')]?_0x3a53ef[_0x825b('0x17')][_0x825b('0x22')]||null:null,'attributes':_0x3a53ef[_0x825b('0x17')]?_0x3a53ef[_0x825b('0x17')][_0x825b('0x1d')]||null:null,'include':_0x3a53ef[_0x825b('0x17')]?_0x3a53ef[_0x825b('0x17')]['include']?_[_0x825b('0x1a')](_0x3a53ef[_0x825b('0x17')]['include'],function(_0x4311f9){return{'model':db[_0x4311f9[_0x825b('0x1c')]],'as':_0x4311f9['as'],'attributes':_0x4311f9[_0x825b('0x1d')],'include':_0x4311f9[_0x825b('0x1b')]?_[_0x825b('0x1a')](_0x4311f9[_0x825b('0x1b')],function(_0x2e41a8){return{'model':db[_0x2e41a8[_0x825b('0x1c')]],'as':_0x2e41a8['as'],'attributes':_0x2e41a8[_0x825b('0x1d')],'include':_0x2e41a8[_0x825b('0x1b')]?_[_0x825b('0x1a')](_0x2e41a8[_0x825b('0x1b')],function(_0x22894a){return{'model':db[_0x22894a[_0x825b('0x1c')]],'as':_0x22894a['as'],'attributes':_0x22894a[_0x825b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x825b('0x1e')](function(_0x5cd1cf){logger[_0x825b('0xb')]('ShowSugarcrmAccount',_0x3a53ef);logger['debug'](_0x825b('0x20'),_0x3a53ef,JSON['stringify'](_0x5cd1cf));_0x36bbe0(_0x5cd1cf);})[_0x825b('0x1f')](function(_0x5500e2){logger[_0x825b('0x11')](_0x825b('0x20'),_0x5500e2[_0x825b('0x12')],_0x3a53ef);_0x27af1c(_0x1fd3cf[_0x825b('0x11')](0x1f4,_0x5500e2[_0x825b('0x12')]));});});}; \ No newline at end of file +var _0xeb06=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','then','GetSugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','moment','randomstring','ioredis'];(function(_0x3aea92,_0x145c0a){var _0x3e9c65=function(_0xefe1d1){while(--_0xefe1d1){_0x3aea92['push'](_0x3aea92['shift']());}};_0x3e9c65(++_0x145c0a);}(_0xeb06,0x1ab));var _0x6eb0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeb06[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x6eb0('0x0'));var util=require(_0x6eb0('0x1'));var moment=require(_0x6eb0('0x2'));var BPromise=require('bluebird');var rs=require(_0x6eb0('0x3'));var fs=require('fs');var Redis=require(_0x6eb0('0x4'));var db=require(_0x6eb0('0x5'))['db'];var utils=require(_0x6eb0('0x6'));var logger=require(_0x6eb0('0x7'))(_0x6eb0('0x8'));var config=require('../../config/environment');var jayson=require(_0x6eb0('0x9'));var client=jayson['client'][_0x6eb0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e90d0,_0x547498,_0x2554a7){return new BPromise(function(_0x5ee341,_0x11ff3c){return client[_0x6eb0('0xb')](_0x5e90d0,_0x2554a7)['then'](function(_0x171bbd){logger[_0x6eb0('0xc')](_0x6eb0('0xd'),_0x547498,'request\x20sent');logger[_0x6eb0('0xe')](_0x6eb0('0xf'),_0x547498,_0x6eb0('0x10'),JSON[_0x6eb0('0x11')](_0x171bbd));if(_0x171bbd['error']){if(_0x171bbd[_0x6eb0('0x12')][_0x6eb0('0x13')]===0x1f4){logger[_0x6eb0('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x547498,_0x171bbd['error'][_0x6eb0('0x14')]);return _0x11ff3c(_0x171bbd['error'][_0x6eb0('0x14')]);}logger[_0x6eb0('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x547498,_0x171bbd[_0x6eb0('0x12')][_0x6eb0('0x14')]);return _0x5ee341(_0x171bbd[_0x6eb0('0x12')][_0x6eb0('0x14')]);}else{logger[_0x6eb0('0xc')](_0x6eb0('0xd'),_0x547498,_0x6eb0('0x10'));_0x5ee341(_0x171bbd[_0x6eb0('0x15')]['message']);}})[_0x6eb0('0x16')](function(_0x3938fd){logger[_0x6eb0('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x547498,_0x3938fd);_0x11ff3c(_0x3938fd);});});}exports['GetSugarcrmAccount']=function(_0x4f6193){var _0xc4e2cb=this;return new Promise(function(_0x581261,_0x8fcdfe){return db[_0x6eb0('0x17')][_0x6eb0('0x18')]({'raw':_0x4f6193[_0x6eb0('0x19')]?_0x4f6193[_0x6eb0('0x19')][_0x6eb0('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f6193['options']?_0x4f6193[_0x6eb0('0x19')][_0x6eb0('0x1b')]||null:null,'attributes':_0x4f6193[_0x6eb0('0x19')]?_0x4f6193['options'][_0x6eb0('0x1c')]||null:null,'limit':_0x4f6193[_0x6eb0('0x19')]?_0x4f6193[_0x6eb0('0x19')]['limit']||null:null,'include':_0x4f6193[_0x6eb0('0x19')]?_0x4f6193[_0x6eb0('0x19')][_0x6eb0('0x1d')]?_['map'](_0x4f6193[_0x6eb0('0x19')][_0x6eb0('0x1d')],function(_0x47d9c4){return{'model':db[_0x47d9c4['model']],'as':_0x47d9c4['as'],'attributes':_0x47d9c4[_0x6eb0('0x1c')],'include':_0x47d9c4['include']?_[_0x6eb0('0x1e')](_0x47d9c4['include'],function(_0x2ade3d){return{'model':db[_0x2ade3d[_0x6eb0('0x1f')]],'as':_0x2ade3d['as'],'attributes':_0x2ade3d[_0x6eb0('0x1c')],'include':_0x2ade3d[_0x6eb0('0x1d')]?_[_0x6eb0('0x1e')](_0x2ade3d[_0x6eb0('0x1d')],function(_0x1dafa8){return{'model':db[_0x1dafa8[_0x6eb0('0x1f')]],'as':_0x1dafa8['as'],'attributes':_0x1dafa8[_0x6eb0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6eb0('0x20')](function(_0x31b519){logger[_0x6eb0('0xc')]('GetSugarcrmAccount',_0x4f6193);logger[_0x6eb0('0xe')](_0x6eb0('0x21'),_0x4f6193,JSON[_0x6eb0('0x11')](_0x31b519));_0x581261(_0x31b519);})[_0x6eb0('0x16')](function(_0x3092d2){logger[_0x6eb0('0x12')](_0x6eb0('0x21'),_0x3092d2[_0x6eb0('0x14')],_0x4f6193);_0x8fcdfe(_0xc4e2cb[_0x6eb0('0x12')](0x1f4,_0x3092d2[_0x6eb0('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x1253c9){var _0x526c23=this;return new Promise(function(_0x56bb60,_0x732a79){return db[_0x6eb0('0x17')][_0x6eb0('0x22')]({'raw':_0x1253c9[_0x6eb0('0x19')]?_0x1253c9[_0x6eb0('0x19')][_0x6eb0('0x1a')]===undefined?!![]:![]:!![],'where':_0x1253c9['options']?_0x1253c9[_0x6eb0('0x19')][_0x6eb0('0x1b')]||null:null,'attributes':_0x1253c9[_0x6eb0('0x19')]?_0x1253c9['options'][_0x6eb0('0x1c')]||null:null,'include':_0x1253c9[_0x6eb0('0x19')]?_0x1253c9[_0x6eb0('0x19')]['include']?_['map'](_0x1253c9[_0x6eb0('0x19')][_0x6eb0('0x1d')],function(_0x302c38){return{'model':db[_0x302c38[_0x6eb0('0x1f')]],'as':_0x302c38['as'],'attributes':_0x302c38[_0x6eb0('0x1c')],'include':_0x302c38[_0x6eb0('0x1d')]?_[_0x6eb0('0x1e')](_0x302c38[_0x6eb0('0x1d')],function(_0x3f4abd){return{'model':db[_0x3f4abd[_0x6eb0('0x1f')]],'as':_0x3f4abd['as'],'attributes':_0x3f4abd[_0x6eb0('0x1c')],'include':_0x3f4abd[_0x6eb0('0x1d')]?_['map'](_0x3f4abd[_0x6eb0('0x1d')],function(_0x3f5479){return{'model':db[_0x3f5479[_0x6eb0('0x1f')]],'as':_0x3f5479['as'],'attributes':_0x3f5479[_0x6eb0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6eb0('0x20')](function(_0x11a171){logger[_0x6eb0('0xc')]('ShowSugarcrmAccount',_0x1253c9);logger[_0x6eb0('0xe')]('ShowSugarcrmAccount',_0x1253c9,JSON['stringify'](_0x11a171));_0x56bb60(_0x11a171);})[_0x6eb0('0x16')](function(_0x202da8){logger[_0x6eb0('0x12')](_0x6eb0('0x23'),_0x202da8[_0x6eb0('0x14')],_0x1253c9);_0x732a79(_0x526c23[_0x6eb0('0x12')](0x1f4,_0x202da8['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 78e6444..f7d248d 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 _0xe661=['get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x79f5bd,_0x347c29){var _0x1e77d7=function(_0x6e3805){while(--_0x6e3805){_0x79f5bd['push'](_0x79f5bd['shift']());}};_0x1e77d7(++_0x347c29);}(_0xe661,0x179));var _0x1e66=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe661[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x1e66('0x0'));var path=require(_0x1e66('0x1'));var timeout=require(_0x1e66('0x2'));var express=require(_0x1e66('0x3'));var router=express[_0x1e66('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1e66('0x5'));var controller=require(_0x1e66('0x6'));router[_0x1e66('0x7')]('/',auth[_0x1e66('0x8')](),controller[_0x1e66('0x9')]);router[_0x1e66('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1e66('0xa')]);router[_0x1e66('0x7')](_0x1e66('0xb'),auth[_0x1e66('0x8')](),controller[_0x1e66('0xc')]);router[_0x1e66('0x7')](_0x1e66('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x1e66('0xe'),auth[_0x1e66('0x8')](),controller[_0x1e66('0xf')]);router[_0x1e66('0x10')]('/',auth[_0x1e66('0x8')](),controller[_0x1e66('0x11')]);router[_0x1e66('0x12')](_0x1e66('0x13'),auth[_0x1e66('0x8')](),controller[_0x1e66('0x14')]);router[_0x1e66('0x15')](_0x1e66('0x13'),auth[_0x1e66('0x8')](),controller[_0x1e66('0x16')]);module[_0x1e66('0x17')]=router; \ No newline at end of file +var _0x927e=['getDescriptions','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','/:id/descriptions'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x927e,0x147));var _0xe927=function(_0x110e11,_0x2386fb){_0x110e11=_0x110e11-0x0;var _0x16d509=_0x927e[_0x110e11];return _0x16d509;};'use strict';var multer=require(_0xe927('0x0'));var util=require('util');var path=require(_0xe927('0x1'));var timeout=require(_0xe927('0x2'));var express=require(_0xe927('0x3'));var router=express['Router']();var fs_extra=require(_0xe927('0x4'));var auth=require(_0xe927('0x5'));var interaction=require(_0xe927('0x6'));var config=require(_0xe927('0x7'));var controller=require(_0xe927('0x8'));router[_0xe927('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe927('0x9')](_0xe927('0xa'),auth[_0xe927('0xb')](),controller['show']);router['get']('/:id/fields',auth[_0xe927('0xb')](),controller['getFields']);router[_0xe927('0x9')]('/:id/subjects',auth[_0xe927('0xb')](),controller['getSubjects']);router['get'](_0xe927('0xc'),auth[_0xe927('0xb')](),controller[_0xe927('0xd')]);router[_0xe927('0xe')]('/',auth[_0xe927('0xb')](),controller[_0xe927('0xf')]);router[_0xe927('0x10')]('/:id',auth[_0xe927('0xb')](),controller['update']);router[_0xe927('0x11')](_0xe927('0xa'),auth['isAuthenticated'](),controller[_0xe927('0x12')]);module[_0xe927('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 9f63505..974c879 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 _0x3742=['STRING','sequelize','exports'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x3742,0x109));var _0x2374=function(_0x4a0f60,_0x298c30){_0x4a0f60=_0x4a0f60-0x0;var _0x59b579=_0x3742[_0x4a0f60];return _0x59b579;};'use strict';var Sequelize=require(_0x2374('0x0'));module[_0x2374('0x1')]={'name':{'type':Sequelize[_0x2374('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0aa2=['sequelize','exports','STRING'];(function(_0x2054bb,_0x3c7e1d){var _0x5f175f=function(_0x32eadf){while(--_0x32eadf){_0x2054bb['push'](_0x2054bb['shift']());}};_0x5f175f(++_0x3c7e1d);}(_0x0aa2,0x14a));var _0x20aa=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0aa2[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x20aa('0x0'));module[_0x20aa('0x1')]={'name':{'type':Sequelize[_0x20aa('0x2')]},'description':{'type':Sequelize[_0x20aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 7a28174..0fa0bd6 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 _0xc35b=['desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','reject','save','then','destroy','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','show','catch','create','body','update','find','params','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce'];(function(_0xb497ba,_0x19ea31){var _0x5212d1=function(_0xeea100){while(--_0xeea100){_0xb497ba['push'](_0xb497ba['shift']());}};_0x5212d1(++_0x19ea31);}(_0xc35b,0x12a));var _0xbc35=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xc35b[_0x550d12];return _0x12103d;};'use strict';var emlformat=require(_0xbc35('0x0'));var rimraf=require(_0xbc35('0x1'));var zipdir=require(_0xbc35('0x2'));var jsonpatch=require(_0xbc35('0x3'));var rp=require(_0xbc35('0x4'));var moment=require(_0xbc35('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbc35('0x6'));var util=require(_0xbc35('0x7'));var path=require(_0xbc35('0x8'));var sox=require(_0xbc35('0x9'));var csv=require('to-csv');var ejs=require(_0xbc35('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbc35('0xb'));var crypto=require(_0xbc35('0xc'));var jsforce=require(_0xbc35('0xd'));var deskjs=require(_0xbc35('0xe'));var toCsv=require(_0xbc35('0xf'));var querystring=require(_0xbc35('0x10'));var Papa=require(_0xbc35('0x11'));var Redis=require('ioredis');var authService=require(_0xbc35('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbc35('0x13'));var hardwareService=require(_0xbc35('0x14'));var logger=require('../../config/logger')(_0xbc35('0x15'));var utils=require(_0xbc35('0x16'));var config=require(_0xbc35('0x17'));var licenseUtil=require(_0xbc35('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x428f49,_0x2c4295){_0x2c4295=_0x2c4295||0xcc;return function(_0x55478d){if(_0x55478d){return _0x428f49[_0xbc35('0x19')](_0x2c4295);}return _0x428f49['status'](_0x2c4295)[_0xbc35('0x1a')]();};}function respondWithResult(_0x2bae91,_0x269992){_0x269992=_0x269992||0xc8;return function(_0xddff39){if(_0xddff39){return _0x2bae91[_0xbc35('0x1b')](_0x269992)[_0xbc35('0x1c')](_0xddff39);}};}function respondWithFilteredResult(_0x53221,_0x2e2783){return function(_0x75516b){if(_0x75516b){var _0x3d845b=typeof _0x2e2783['offset']===_0xbc35('0x1d')&&typeof _0x2e2783[_0xbc35('0x1e')]===_0xbc35('0x1d');var _0x12f64a=_0x75516b[_0xbc35('0x1f')];var _0x114c9c=_0x3d845b?0x0:_0x2e2783[_0xbc35('0x20')];var _0x4edc3c=_0x3d845b?_0x75516b[_0xbc35('0x1f')]:_0x2e2783['offset']+_0x2e2783[_0xbc35('0x1e')];var _0x5b9807;if(_0x4edc3c>=_0x12f64a){_0x4edc3c=_0x12f64a;_0x5b9807=0xc8;}else{_0x5b9807=0xce;}_0x53221[_0xbc35('0x1b')](_0x5b9807);return _0x53221['set']('Content-Range',_0x114c9c+'-'+_0x4edc3c+'/'+_0x12f64a)[_0xbc35('0x1c')](_0x75516b);}return null;};}function patchUpdates(_0x9c1684){return function(_0x4c3d1b){try{jsonpatch['apply'](_0x4c3d1b,_0x9c1684,!![]);}catch(_0x44bcdd){return BPromise[_0xbc35('0x21')](_0x44bcdd);}return _0x4c3d1b[_0xbc35('0x22')]();};}function saveUpdates(_0x4dad35,_0x452fbf){return function(_0x402d8e){if(_0x402d8e){return _0x402d8e['update'](_0x4dad35)[_0xbc35('0x23')](function(_0x268210){return _0x268210;});}return null;};}function removeEntity(_0x3f90f3,_0x8dd1ad){return function(_0x2bff62){if(_0x2bff62){return _0x2bff62[_0xbc35('0x24')]()[_0xbc35('0x23')](function(){_0x3f90f3['status'](0xcc)[_0xbc35('0x1a')]();});}};}function handleEntityNotFound(_0x2569b9,_0xb538ae){return function(_0x1806e5){if(!_0x1806e5){_0x2569b9['sendStatus'](0x194);}return _0x1806e5;};}function handleError(_0xa4c3e8,_0x1ce336){_0x1ce336=_0x1ce336||0x1f4;return function(_0x59ec42){logger['error'](_0x59ec42['stack']);if(_0x59ec42['name']){delete _0x59ec42[_0xbc35('0x25')];}_0xa4c3e8[_0xbc35('0x1b')](_0x1ce336)[_0xbc35('0x26')](_0x59ec42);};}exports[_0xbc35('0x27')]=function(_0x10e25a,_0x425dc4){var _0x45f55e={},_0x33d3c2={},_0xdc5e9d={'count':0x0,'rows':[]};var _0x474479=_['map'](db[_0xbc35('0x28')][_0xbc35('0x29')],function(_0x5db910){return{'name':_0x5db910[_0xbc35('0x2a')],'type':_0x5db910['type'][_0xbc35('0x2b')]};});_0x33d3c2[_0xbc35('0x2c')]=_[_0xbc35('0x2d')](_0x474479,'name');_0x33d3c2[_0xbc35('0x2e')]=_[_0xbc35('0x2f')](_0x10e25a[_0xbc35('0x2e')]);_0x33d3c2[_0xbc35('0x30')]=_[_0xbc35('0x31')](_0x33d3c2[_0xbc35('0x2c')],_0x33d3c2[_0xbc35('0x2e')]);_0x45f55e[_0xbc35('0x32')]=_['intersection'](_0x33d3c2[_0xbc35('0x2c')],qs[_0xbc35('0x33')](_0x10e25a['query'][_0xbc35('0x33')]));_0x45f55e[_0xbc35('0x32')]=_0x45f55e[_0xbc35('0x32')][_0xbc35('0x34')]?_0x45f55e[_0xbc35('0x32')]:_0x33d3c2[_0xbc35('0x2c')];if(!_0x10e25a[_0xbc35('0x2e')][_0xbc35('0x35')](_0xbc35('0x36'))){_0x45f55e[_0xbc35('0x1e')]=qs['limit'](_0x10e25a['query'][_0xbc35('0x1e')]);_0x45f55e[_0xbc35('0x20')]=qs[_0xbc35('0x20')](_0x10e25a[_0xbc35('0x2e')][_0xbc35('0x20')]);}_0x45f55e[_0xbc35('0x37')]=qs['sort'](_0x10e25a[_0xbc35('0x2e')][_0xbc35('0x38')]);_0x45f55e[_0xbc35('0x39')]=qs['filters'](_[_0xbc35('0x3a')](_0x10e25a[_0xbc35('0x2e')],_0x33d3c2[_0xbc35('0x30')]),_0x474479);if(_0x10e25a[_0xbc35('0x2e')][_0xbc35('0x3b')]){_0x45f55e[_0xbc35('0x39')]=_[_0xbc35('0x3c')](_0x45f55e[_0xbc35('0x39')],{'$or':_[_0xbc35('0x2d')](_0x474479,function(_0x4b738e){if(_0x4b738e[_0xbc35('0x3d')]!==_0xbc35('0x3e')){var _0xf9eed2={};_0xf9eed2[_0x4b738e[_0xbc35('0x25')]]={'$like':'%'+_0x10e25a[_0xbc35('0x2e')][_0xbc35('0x3b')]+'%'};return _0xf9eed2;}})});}_0x45f55e=_[_0xbc35('0x3c')]({},_0x45f55e,_0x10e25a[_0xbc35('0x3f')]);var _0x3f5e2a={'where':_0x45f55e[_0xbc35('0x39')]};return db['SugarcrmConfiguration'][_0xbc35('0x1f')](_0x3f5e2a)[_0xbc35('0x23')](function(_0x50148c){_0xdc5e9d['count']=_0x50148c;if(_0x10e25a[_0xbc35('0x2e')][_0xbc35('0x40')]){_0x45f55e['include']=[{'all':!![]}];}return db[_0xbc35('0x28')]['findAll'](_0x45f55e);})[_0xbc35('0x23')](function(_0xd81ac7){_0xdc5e9d[_0xbc35('0x41')]=_0xd81ac7;return _0xdc5e9d;})['then'](respondWithFilteredResult(_0x425dc4,_0x45f55e))['catch'](handleError(_0x425dc4,null));};exports[_0xbc35('0x42')]=function(_0x5a470e,_0x2300f4){var _0x949021={'raw':![],'where':{'id':_0x5a470e['params']['id']}},_0x517633={};_0x517633[_0xbc35('0x2c')]=_[_0xbc35('0x2f')](db['SugarcrmConfiguration']['rawAttributes']);_0x517633[_0xbc35('0x2e')]=_[_0xbc35('0x2f')](_0x5a470e[_0xbc35('0x2e')]);_0x517633[_0xbc35('0x30')]=_[_0xbc35('0x31')](_0x517633[_0xbc35('0x2c')],_0x517633[_0xbc35('0x2e')]);_0x949021['attributes']=_[_0xbc35('0x31')](_0x517633['model'],qs[_0xbc35('0x33')](_0x5a470e['query'][_0xbc35('0x33')]));_0x949021[_0xbc35('0x32')]=_0x949021[_0xbc35('0x32')]['length']?_0x949021['attributes']:_0x517633[_0xbc35('0x2c')];if(_0x5a470e[_0xbc35('0x2e')][_0xbc35('0x40')]){_0x949021['include']=[{'all':!![]}];}_0x949021=_[_0xbc35('0x3c')]({},_0x949021,_0x5a470e[_0xbc35('0x3f')]);return db[_0xbc35('0x28')]['find'](_0x949021)[_0xbc35('0x23')](handleEntityNotFound(_0x2300f4,null))['then'](respondWithResult(_0x2300f4,null))[_0xbc35('0x43')](handleError(_0x2300f4,null));};exports[_0xbc35('0x44')]=function(_0x226758,_0x5eafa5){return db['SugarcrmConfiguration'][_0xbc35('0x44')](_0x226758[_0xbc35('0x45')],{})[_0xbc35('0x23')](respondWithResult(_0x5eafa5,0xc9))[_0xbc35('0x43')](handleError(_0x5eafa5,null));};exports[_0xbc35('0x46')]=function(_0x627ec7,_0x28cab6){if(_0x627ec7[_0xbc35('0x45')]['id']){delete _0x627ec7[_0xbc35('0x45')]['id'];}return db[_0xbc35('0x28')][_0xbc35('0x47')]({'where':{'id':_0x627ec7[_0xbc35('0x48')]['id']}})[_0xbc35('0x23')](handleEntityNotFound(_0x28cab6,null))['then'](saveUpdates(_0x627ec7[_0xbc35('0x45')],null))[_0xbc35('0x23')](respondWithResult(_0x28cab6,null))[_0xbc35('0x43')](handleError(_0x28cab6,null));};exports['destroy']=function(_0x53d9b9,_0x1d859c){return db[_0xbc35('0x28')][_0xbc35('0x47')]({'where':{'id':_0x53d9b9[_0xbc35('0x48')]['id']}})[_0xbc35('0x23')](handleEntityNotFound(_0x1d859c,null))[_0xbc35('0x23')](removeEntity(_0x1d859c,null))['catch'](handleError(_0x1d859c,null));};exports[_0xbc35('0x49')]=function(_0x531e1c,_0x1030bc,_0x352b14){var _0x8db7eb={};var _0x3f939e={};var _0x357c4c;var _0x42f287;return db[_0xbc35('0x28')][_0xbc35('0x4a')]({'where':{'id':_0x531e1c[_0xbc35('0x48')]['id']}})[_0xbc35('0x23')](handleEntityNotFound(_0x1030bc,null))[_0xbc35('0x23')](function(_0xb1677a){if(_0xb1677a){_0x357c4c=_0xb1677a;_0x3f939e[_0xbc35('0x2c')]=_['keys'](db[_0xbc35('0x4b')][_0xbc35('0x29')]);_0x3f939e[_0xbc35('0x2e')]=_[_0xbc35('0x2f')](_0x531e1c[_0xbc35('0x2e')]);_0x3f939e[_0xbc35('0x30')]=_[_0xbc35('0x31')](_0x3f939e[_0xbc35('0x2c')],_0x3f939e[_0xbc35('0x2e')]);_0x8db7eb[_0xbc35('0x32')]=_[_0xbc35('0x31')](_0x3f939e[_0xbc35('0x2c')],qs['fields'](_0x531e1c[_0xbc35('0x2e')][_0xbc35('0x33')]));_0x8db7eb[_0xbc35('0x32')]=_0x8db7eb[_0xbc35('0x32')]['length']?_0x8db7eb[_0xbc35('0x32')]:_0x3f939e[_0xbc35('0x2c')];_0x8db7eb[_0xbc35('0x37')]=qs['sort'](_0x531e1c[_0xbc35('0x2e')][_0xbc35('0x38')]);_0x8db7eb[_0xbc35('0x39')]=qs[_0xbc35('0x30')](_[_0xbc35('0x3a')](_0x531e1c[_0xbc35('0x2e')],_0x3f939e[_0xbc35('0x30')]));if(_0x531e1c[_0xbc35('0x2e')][_0xbc35('0x3b')]){_0x8db7eb['where']=_[_0xbc35('0x3c')](_0x8db7eb['where'],{'$or':_[_0xbc35('0x2d')](_0x8db7eb['attributes'],function(_0x4ee0c5){var _0x11cb13={};_0x11cb13[_0x4ee0c5]={'$like':'%'+_0x531e1c[_0xbc35('0x2e')]['filter']+'%'};return _0x11cb13;})});}_0x8db7eb=_[_0xbc35('0x3c')]({},_0x8db7eb,_0x531e1c[_0xbc35('0x3f')]);return _0x357c4c[_0xbc35('0x49')](_0x8db7eb);}})[_0xbc35('0x23')](function(_0x174dab){if(_0x174dab){_0x42f287=_0x174dab[_0xbc35('0x34')];if(!_0x531e1c['query']['hasOwnProperty'](_0xbc35('0x36'))){_0x8db7eb['limit']=qs[_0xbc35('0x1e')](_0x531e1c['query']['limit']);_0x8db7eb['offset']=qs[_0xbc35('0x20')](_0x531e1c['query'][_0xbc35('0x20')]);}return _0x357c4c[_0xbc35('0x49')](_0x8db7eb);}})[_0xbc35('0x23')](function(_0x3bfe83){if(_0x3bfe83){return _0x3bfe83?{'count':_0x42f287,'rows':_0x3bfe83}:null;}})[_0xbc35('0x23')](respondWithResult(_0x1030bc,null))[_0xbc35('0x43')](handleError(_0x1030bc,null));};exports['getSubjects']=function(_0x20521c,_0x3650e2,_0x5029ce){var _0x2f9afd={};var _0x50e3ff={};var _0xfc4524;var _0x4267d2;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x20521c[_0xbc35('0x48')]['id']}})['then'](handleEntityNotFound(_0x3650e2,null))['then'](function(_0x1837d){if(_0x1837d){_0xfc4524=_0x1837d;_0x50e3ff[_0xbc35('0x2c')]=_[_0xbc35('0x2f')](db[_0xbc35('0x4b')][_0xbc35('0x29')]);_0x50e3ff[_0xbc35('0x2e')]=_[_0xbc35('0x2f')](_0x20521c[_0xbc35('0x2e')]);_0x50e3ff[_0xbc35('0x30')]=_[_0xbc35('0x31')](_0x50e3ff[_0xbc35('0x2c')],_0x50e3ff[_0xbc35('0x2e')]);_0x2f9afd[_0xbc35('0x32')]=_[_0xbc35('0x31')](_0x50e3ff[_0xbc35('0x2c')],qs[_0xbc35('0x33')](_0x20521c['query']['fields']));_0x2f9afd[_0xbc35('0x32')]=_0x2f9afd['attributes'][_0xbc35('0x34')]?_0x2f9afd[_0xbc35('0x32')]:_0x50e3ff[_0xbc35('0x2c')];_0x2f9afd[_0xbc35('0x37')]=qs[_0xbc35('0x38')](_0x20521c[_0xbc35('0x2e')][_0xbc35('0x38')]);_0x2f9afd[_0xbc35('0x39')]=qs[_0xbc35('0x30')](_[_0xbc35('0x3a')](_0x20521c['query'],_0x50e3ff['filters']));if(_0x20521c['query'][_0xbc35('0x3b')]){_0x2f9afd[_0xbc35('0x39')]=_[_0xbc35('0x3c')](_0x2f9afd[_0xbc35('0x39')],{'$or':_[_0xbc35('0x2d')](_0x2f9afd[_0xbc35('0x32')],function(_0x1bf69){var _0x1018e9={};_0x1018e9[_0x1bf69]={'$like':'%'+_0x20521c[_0xbc35('0x2e')][_0xbc35('0x3b')]+'%'};return _0x1018e9;})});}_0x2f9afd=_[_0xbc35('0x3c')]({},_0x2f9afd,_0x20521c[_0xbc35('0x3f')]);return _0xfc4524[_0xbc35('0x4c')](_0x2f9afd);}})[_0xbc35('0x23')](function(_0x23d55b){if(_0x23d55b){_0x4267d2=_0x23d55b['length'];if(!_0x20521c[_0xbc35('0x2e')][_0xbc35('0x35')](_0xbc35('0x36'))){_0x2f9afd[_0xbc35('0x1e')]=qs[_0xbc35('0x1e')](_0x20521c['query']['limit']);_0x2f9afd[_0xbc35('0x20')]=qs['offset'](_0x20521c['query'][_0xbc35('0x20')]);}return _0xfc4524[_0xbc35('0x4c')](_0x2f9afd);}})[_0xbc35('0x23')](function(_0x3c59fd){if(_0x3c59fd){return _0x3c59fd?{'count':_0x4267d2,'rows':_0x3c59fd}:null;}})[_0xbc35('0x23')](respondWithResult(_0x3650e2,null))[_0xbc35('0x43')](handleError(_0x3650e2,null));};exports['getDescriptions']=function(_0x30c0bf,_0x17e9f3,_0x2b6566){var _0x4995e0={};var _0x3bd012={};var _0x4f10d5;var _0x448999;return db['SugarcrmConfiguration'][_0xbc35('0x4a')]({'where':{'id':_0x30c0bf[_0xbc35('0x48')]['id']}})['then'](handleEntityNotFound(_0x17e9f3,null))[_0xbc35('0x23')](function(_0x7cd8){if(_0x7cd8){_0x4f10d5=_0x7cd8;_0x3bd012[_0xbc35('0x2c')]=_[_0xbc35('0x2f')](db[_0xbc35('0x4b')][_0xbc35('0x29')]);_0x3bd012[_0xbc35('0x2e')]=_['keys'](_0x30c0bf[_0xbc35('0x2e')]);_0x3bd012['filters']=_[_0xbc35('0x31')](_0x3bd012[_0xbc35('0x2c')],_0x3bd012[_0xbc35('0x2e')]);_0x4995e0[_0xbc35('0x32')]=_['intersection'](_0x3bd012[_0xbc35('0x2c')],qs['fields'](_0x30c0bf['query'][_0xbc35('0x33')]));_0x4995e0[_0xbc35('0x32')]=_0x4995e0[_0xbc35('0x32')][_0xbc35('0x34')]?_0x4995e0[_0xbc35('0x32')]:_0x3bd012[_0xbc35('0x2c')];_0x4995e0[_0xbc35('0x37')]=qs[_0xbc35('0x38')](_0x30c0bf['query'][_0xbc35('0x38')]);_0x4995e0[_0xbc35('0x39')]=qs[_0xbc35('0x30')](_[_0xbc35('0x3a')](_0x30c0bf[_0xbc35('0x2e')],_0x3bd012[_0xbc35('0x30')]));if(_0x30c0bf['query'][_0xbc35('0x3b')]){_0x4995e0['where']=_[_0xbc35('0x3c')](_0x4995e0[_0xbc35('0x39')],{'$or':_[_0xbc35('0x2d')](_0x4995e0[_0xbc35('0x32')],function(_0x439589){var _0x2d11ee={};_0x2d11ee[_0x439589]={'$like':'%'+_0x30c0bf[_0xbc35('0x2e')][_0xbc35('0x3b')]+'%'};return _0x2d11ee;})});}_0x4995e0=_['merge']({},_0x4995e0,_0x30c0bf['options']);return _0x4f10d5['getDescriptions'](_0x4995e0);}})[_0xbc35('0x23')](function(_0x490dba){if(_0x490dba){_0x448999=_0x490dba[_0xbc35('0x34')];if(!_0x30c0bf['query'][_0xbc35('0x35')](_0xbc35('0x36'))){_0x4995e0[_0xbc35('0x1e')]=qs[_0xbc35('0x1e')](_0x30c0bf[_0xbc35('0x2e')][_0xbc35('0x1e')]);_0x4995e0[_0xbc35('0x20')]=qs['offset'](_0x30c0bf[_0xbc35('0x2e')][_0xbc35('0x20')]);}return _0x4f10d5[_0xbc35('0x4d')](_0x4995e0);}})[_0xbc35('0x23')](function(_0x2e2607){if(_0x2e2607){return _0x2e2607?{'count':_0x448999,'rows':_0x2e2607}:null;}})['then'](respondWithResult(_0x17e9f3,null))[_0xbc35('0x43')](handleError(_0x17e9f3,null));}; \ No newline at end of file +var _0x917b=['rawAttributes','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','includeAll','include','SugarcrmConfiguration','findAll','rows','catch','show','keys','length','find','create','body','params','getFields','order','getSubjects','findOne','SugarcrmField','getDescriptions','zip-dir','moment','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','status','stack','name','send','index'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x917b,0x14c));var _0xb917=function(_0x30dfa3,_0x102e98){_0x30dfa3=_0x30dfa3-0x0;var _0x5c3e99=_0x917b[_0x30dfa3];return _0x5c3e99;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb917('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb917('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb917('0x2'));var sox=require(_0xb917('0x3'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb917('0x4'));var _=require(_0xb917('0x5'));var squel=require(_0xb917('0x6'));var crypto=require(_0xb917('0x7'));var jsforce=require(_0xb917('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xb917('0x9'));var querystring=require(_0xb917('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb917('0xb'));var as=require(_0xb917('0xc'));var hardwareService=require(_0xb917('0xd'));var logger=require(_0xb917('0xe'))(_0xb917('0xf'));var utils=require(_0xb917('0x10'));var config=require(_0xb917('0x11'));var licenseUtil=require(_0xb917('0x12'));var db=require(_0xb917('0x13'))['db'];function respondWithStatusCode(_0x2be714,_0x55789b){_0x55789b=_0x55789b||0xcc;return function(_0x11d0e0){if(_0x11d0e0){return _0x2be714[_0xb917('0x14')](_0x55789b);}return _0x2be714['status'](_0x55789b)[_0xb917('0x15')]();};}function respondWithResult(_0x47853b,_0x59b483){_0x59b483=_0x59b483||0xc8;return function(_0x1d4aa9){if(_0x1d4aa9){return _0x47853b['status'](_0x59b483)[_0xb917('0x16')](_0x1d4aa9);}};}function respondWithFilteredResult(_0x2ce7f3,_0x536f7c){return function(_0x452ab9){if(_0x452ab9){var _0x3c65a7=typeof _0x536f7c[_0xb917('0x17')]===_0xb917('0x18')&&typeof _0x536f7c[_0xb917('0x19')]===_0xb917('0x18');var _0x5c3fbb=_0x452ab9[_0xb917('0x1a')];var _0x613380=_0x3c65a7?0x0:_0x536f7c['offset'];var _0x2c75c6=_0x3c65a7?_0x452ab9['count']:_0x536f7c[_0xb917('0x17')]+_0x536f7c['limit'];var _0x5135e0;if(_0x2c75c6>=_0x5c3fbb){_0x2c75c6=_0x5c3fbb;_0x5135e0=0xc8;}else{_0x5135e0=0xce;}_0x2ce7f3['status'](_0x5135e0);return _0x2ce7f3[_0xb917('0x1b')]('Content-Range',_0x613380+'-'+_0x2c75c6+'/'+_0x5c3fbb)['json'](_0x452ab9);}return null;};}function patchUpdates(_0x134f0e){return function(_0x56bad){try{jsonpatch[_0xb917('0x1c')](_0x56bad,_0x134f0e,!![]);}catch(_0x5256b3){return BPromise[_0xb917('0x1d')](_0x5256b3);}return _0x56bad['save']();};}function saveUpdates(_0x4f3bf4,_0x4af449){return function(_0x2c8902){if(_0x2c8902){return _0x2c8902[_0xb917('0x1e')](_0x4f3bf4)[_0xb917('0x1f')](function(_0x5a2e5e){return _0x5a2e5e;});}return null;};}function removeEntity(_0x309136,_0x56fff0){return function(_0x314d9c){if(_0x314d9c){return _0x314d9c[_0xb917('0x20')]()['then'](function(){_0x309136[_0xb917('0x21')](0xcc)[_0xb917('0x15')]();});}};}function handleEntityNotFound(_0x318eba,_0x405ea7){return function(_0x159372){if(!_0x159372){_0x318eba[_0xb917('0x14')](0x194);}return _0x159372;};}function handleError(_0x28038d,_0x436abd){_0x436abd=_0x436abd||0x1f4;return function(_0x1cab7a){logger['error'](_0x1cab7a[_0xb917('0x22')]);if(_0x1cab7a[_0xb917('0x23')]){delete _0x1cab7a[_0xb917('0x23')];}_0x28038d['status'](_0x436abd)[_0xb917('0x24')](_0x1cab7a);};}exports[_0xb917('0x25')]=function(_0x25fc96,_0x918d5e){var _0x2cce3f={},_0x8bccad={},_0x441b51={'count':0x0,'rows':[]};var _0x3fb3ef=_['map'](db['SugarcrmConfiguration'][_0xb917('0x26')],function(_0x4508c6){return{'name':_0x4508c6['fieldName'],'type':_0x4508c6['type'][_0xb917('0x27')]};});_0x8bccad['model']=_[_0xb917('0x28')](_0x3fb3ef,_0xb917('0x23'));_0x8bccad[_0xb917('0x29')]=_['keys'](_0x25fc96['query']);_0x8bccad[_0xb917('0x2a')]=_[_0xb917('0x2b')](_0x8bccad[_0xb917('0x2c')],_0x8bccad[_0xb917('0x29')]);_0x2cce3f[_0xb917('0x2d')]=_['intersection'](_0x8bccad['model'],qs[_0xb917('0x2e')](_0x25fc96[_0xb917('0x29')][_0xb917('0x2e')]));_0x2cce3f['attributes']=_0x2cce3f[_0xb917('0x2d')]['length']?_0x2cce3f[_0xb917('0x2d')]:_0x8bccad['model'];if(!_0x25fc96[_0xb917('0x29')][_0xb917('0x2f')](_0xb917('0x30'))){_0x2cce3f[_0xb917('0x19')]=qs[_0xb917('0x19')](_0x25fc96[_0xb917('0x29')]['limit']);_0x2cce3f[_0xb917('0x17')]=qs[_0xb917('0x17')](_0x25fc96[_0xb917('0x29')]['offset']);}_0x2cce3f['order']=qs['sort'](_0x25fc96[_0xb917('0x29')][_0xb917('0x31')]);_0x2cce3f['where']=qs[_0xb917('0x2a')](_[_0xb917('0x32')](_0x25fc96[_0xb917('0x29')],_0x8bccad[_0xb917('0x2a')]),_0x3fb3ef);if(_0x25fc96[_0xb917('0x29')][_0xb917('0x33')]){_0x2cce3f['where']=_[_0xb917('0x34')](_0x2cce3f[_0xb917('0x35')],{'$or':_[_0xb917('0x28')](_0x3fb3ef,function(_0x575781){if(_0x575781['type']!=='VIRTUAL'){var _0x5a8d5d={};_0x5a8d5d[_0x575781[_0xb917('0x23')]]={'$like':'%'+_0x25fc96[_0xb917('0x29')][_0xb917('0x33')]+'%'};return _0x5a8d5d;}})});}_0x2cce3f=_[_0xb917('0x34')]({},_0x2cce3f,_0x25fc96[_0xb917('0x36')]);var _0x5cc687={'where':_0x2cce3f[_0xb917('0x35')]};return db['SugarcrmConfiguration']['count'](_0x5cc687)['then'](function(_0x3e89e7){_0x441b51[_0xb917('0x1a')]=_0x3e89e7;if(_0x25fc96['query'][_0xb917('0x37')]){_0x2cce3f[_0xb917('0x38')]=[{'all':!![]}];}return db[_0xb917('0x39')][_0xb917('0x3a')](_0x2cce3f);})['then'](function(_0x524efc){_0x441b51[_0xb917('0x3b')]=_0x524efc;return _0x441b51;})['then'](respondWithFilteredResult(_0x918d5e,_0x2cce3f))[_0xb917('0x3c')](handleError(_0x918d5e,null));};exports[_0xb917('0x3d')]=function(_0xb3e1e5,_0x1e7583){var _0x183586={'raw':![],'where':{'id':_0xb3e1e5['params']['id']}},_0x1654df={};_0x1654df[_0xb917('0x2c')]=_['keys'](db[_0xb917('0x39')]['rawAttributes']);_0x1654df[_0xb917('0x29')]=_[_0xb917('0x3e')](_0xb3e1e5[_0xb917('0x29')]);_0x1654df[_0xb917('0x2a')]=_[_0xb917('0x2b')](_0x1654df[_0xb917('0x2c')],_0x1654df['query']);_0x183586[_0xb917('0x2d')]=_['intersection'](_0x1654df[_0xb917('0x2c')],qs[_0xb917('0x2e')](_0xb3e1e5['query'][_0xb917('0x2e')]));_0x183586[_0xb917('0x2d')]=_0x183586[_0xb917('0x2d')][_0xb917('0x3f')]?_0x183586['attributes']:_0x1654df[_0xb917('0x2c')];if(_0xb3e1e5[_0xb917('0x29')][_0xb917('0x37')]){_0x183586[_0xb917('0x38')]=[{'all':!![]}];}_0x183586=_[_0xb917('0x34')]({},_0x183586,_0xb3e1e5['options']);return db[_0xb917('0x39')][_0xb917('0x40')](_0x183586)[_0xb917('0x1f')](handleEntityNotFound(_0x1e7583,null))['then'](respondWithResult(_0x1e7583,null))['catch'](handleError(_0x1e7583,null));};exports[_0xb917('0x41')]=function(_0x3ec774,_0x33a35a){return db[_0xb917('0x39')][_0xb917('0x41')](_0x3ec774['body'],{})[_0xb917('0x1f')](respondWithResult(_0x33a35a,0xc9))[_0xb917('0x3c')](handleError(_0x33a35a,null));};exports['update']=function(_0x53d190,_0x451a94){if(_0x53d190[_0xb917('0x42')]['id']){delete _0x53d190[_0xb917('0x42')]['id'];}return db['SugarcrmConfiguration'][_0xb917('0x40')]({'where':{'id':_0x53d190[_0xb917('0x43')]['id']}})['then'](handleEntityNotFound(_0x451a94,null))[_0xb917('0x1f')](saveUpdates(_0x53d190[_0xb917('0x42')],null))[_0xb917('0x1f')](respondWithResult(_0x451a94,null))[_0xb917('0x3c')](handleError(_0x451a94,null));};exports['destroy']=function(_0xfdc985,_0x5316f3){return db['SugarcrmConfiguration']['find']({'where':{'id':_0xfdc985[_0xb917('0x43')]['id']}})[_0xb917('0x1f')](handleEntityNotFound(_0x5316f3,null))['then'](removeEntity(_0x5316f3,null))[_0xb917('0x3c')](handleError(_0x5316f3,null));};exports[_0xb917('0x44')]=function(_0x5e0acb,_0x56353b,_0x54467c){var _0x1e5d2e={};var _0x3c2ebd={};var _0x3305cd;var _0x1a6c0f;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x5e0acb[_0xb917('0x43')]['id']}})[_0xb917('0x1f')](handleEntityNotFound(_0x56353b,null))[_0xb917('0x1f')](function(_0x45ecf3){if(_0x45ecf3){_0x3305cd=_0x45ecf3;_0x3c2ebd['model']=_['keys'](db['SugarcrmField'][_0xb917('0x26')]);_0x3c2ebd[_0xb917('0x29')]=_[_0xb917('0x3e')](_0x5e0acb['query']);_0x3c2ebd[_0xb917('0x2a')]=_[_0xb917('0x2b')](_0x3c2ebd[_0xb917('0x2c')],_0x3c2ebd[_0xb917('0x29')]);_0x1e5d2e[_0xb917('0x2d')]=_[_0xb917('0x2b')](_0x3c2ebd[_0xb917('0x2c')],qs[_0xb917('0x2e')](_0x5e0acb['query'][_0xb917('0x2e')]));_0x1e5d2e[_0xb917('0x2d')]=_0x1e5d2e[_0xb917('0x2d')][_0xb917('0x3f')]?_0x1e5d2e[_0xb917('0x2d')]:_0x3c2ebd[_0xb917('0x2c')];_0x1e5d2e[_0xb917('0x45')]=qs[_0xb917('0x31')](_0x5e0acb[_0xb917('0x29')][_0xb917('0x31')]);_0x1e5d2e[_0xb917('0x35')]=qs[_0xb917('0x2a')](_[_0xb917('0x32')](_0x5e0acb[_0xb917('0x29')],_0x3c2ebd[_0xb917('0x2a')]));if(_0x5e0acb['query'][_0xb917('0x33')]){_0x1e5d2e['where']=_[_0xb917('0x34')](_0x1e5d2e[_0xb917('0x35')],{'$or':_['map'](_0x1e5d2e[_0xb917('0x2d')],function(_0x4d29e4){var _0xccb045={};_0xccb045[_0x4d29e4]={'$like':'%'+_0x5e0acb[_0xb917('0x29')]['filter']+'%'};return _0xccb045;})});}_0x1e5d2e=_[_0xb917('0x34')]({},_0x1e5d2e,_0x5e0acb['options']);return _0x3305cd[_0xb917('0x44')](_0x1e5d2e);}})[_0xb917('0x1f')](function(_0xdde5b2){if(_0xdde5b2){_0x1a6c0f=_0xdde5b2[_0xb917('0x3f')];if(!_0x5e0acb[_0xb917('0x29')][_0xb917('0x2f')]('nolimit')){_0x1e5d2e[_0xb917('0x19')]=qs[_0xb917('0x19')](_0x5e0acb[_0xb917('0x29')]['limit']);_0x1e5d2e['offset']=qs['offset'](_0x5e0acb['query'][_0xb917('0x17')]);}return _0x3305cd[_0xb917('0x44')](_0x1e5d2e);}})[_0xb917('0x1f')](function(_0xbb2261){if(_0xbb2261){return _0xbb2261?{'count':_0x1a6c0f,'rows':_0xbb2261}:null;}})[_0xb917('0x1f')](respondWithResult(_0x56353b,null))[_0xb917('0x3c')](handleError(_0x56353b,null));};exports[_0xb917('0x46')]=function(_0x27b0c0,_0x4a2f01,_0x42c47b){var _0x950bad={};var _0x16af29={};var _0x554539;var _0x1bf341;return db[_0xb917('0x39')][_0xb917('0x47')]({'where':{'id':_0x27b0c0[_0xb917('0x43')]['id']}})[_0xb917('0x1f')](handleEntityNotFound(_0x4a2f01,null))[_0xb917('0x1f')](function(_0x147a6c){if(_0x147a6c){_0x554539=_0x147a6c;_0x16af29[_0xb917('0x2c')]=_[_0xb917('0x3e')](db[_0xb917('0x48')][_0xb917('0x26')]);_0x16af29[_0xb917('0x29')]=_[_0xb917('0x3e')](_0x27b0c0[_0xb917('0x29')]);_0x16af29[_0xb917('0x2a')]=_[_0xb917('0x2b')](_0x16af29['model'],_0x16af29[_0xb917('0x29')]);_0x950bad[_0xb917('0x2d')]=_[_0xb917('0x2b')](_0x16af29[_0xb917('0x2c')],qs[_0xb917('0x2e')](_0x27b0c0['query'][_0xb917('0x2e')]));_0x950bad[_0xb917('0x2d')]=_0x950bad[_0xb917('0x2d')][_0xb917('0x3f')]?_0x950bad[_0xb917('0x2d')]:_0x16af29['model'];_0x950bad['order']=qs['sort'](_0x27b0c0[_0xb917('0x29')][_0xb917('0x31')]);_0x950bad[_0xb917('0x35')]=qs['filters'](_[_0xb917('0x32')](_0x27b0c0[_0xb917('0x29')],_0x16af29[_0xb917('0x2a')]));if(_0x27b0c0['query']['filter']){_0x950bad[_0xb917('0x35')]=_[_0xb917('0x34')](_0x950bad[_0xb917('0x35')],{'$or':_[_0xb917('0x28')](_0x950bad[_0xb917('0x2d')],function(_0xcd289c){var _0x621578={};_0x621578[_0xcd289c]={'$like':'%'+_0x27b0c0[_0xb917('0x29')][_0xb917('0x33')]+'%'};return _0x621578;})});}_0x950bad=_[_0xb917('0x34')]({},_0x950bad,_0x27b0c0[_0xb917('0x36')]);return _0x554539[_0xb917('0x46')](_0x950bad);}})[_0xb917('0x1f')](function(_0x5c2b5b){if(_0x5c2b5b){_0x1bf341=_0x5c2b5b[_0xb917('0x3f')];if(!_0x27b0c0[_0xb917('0x29')]['hasOwnProperty'](_0xb917('0x30'))){_0x950bad[_0xb917('0x19')]=qs[_0xb917('0x19')](_0x27b0c0['query'][_0xb917('0x19')]);_0x950bad[_0xb917('0x17')]=qs[_0xb917('0x17')](_0x27b0c0[_0xb917('0x29')][_0xb917('0x17')]);}return _0x554539[_0xb917('0x46')](_0x950bad);}})['then'](function(_0x495730){if(_0x495730){return _0x495730?{'count':_0x1bf341,'rows':_0x495730}:null;}})['then'](respondWithResult(_0x4a2f01,null))[_0xb917('0x3c')](handleError(_0x4a2f01,null));};exports[_0xb917('0x49')]=function(_0x28575c,_0x4e9110,_0x1cde20){var _0x5c4179={};var _0x432e7f={};var _0x31e74a;var _0x3d3bfb;return db[_0xb917('0x39')][_0xb917('0x47')]({'where':{'id':_0x28575c['params']['id']}})[_0xb917('0x1f')](handleEntityNotFound(_0x4e9110,null))[_0xb917('0x1f')](function(_0x2f573c){if(_0x2f573c){_0x31e74a=_0x2f573c;_0x432e7f[_0xb917('0x2c')]=_[_0xb917('0x3e')](db[_0xb917('0x48')][_0xb917('0x26')]);_0x432e7f[_0xb917('0x29')]=_[_0xb917('0x3e')](_0x28575c[_0xb917('0x29')]);_0x432e7f[_0xb917('0x2a')]=_[_0xb917('0x2b')](_0x432e7f['model'],_0x432e7f[_0xb917('0x29')]);_0x5c4179[_0xb917('0x2d')]=_[_0xb917('0x2b')](_0x432e7f[_0xb917('0x2c')],qs[_0xb917('0x2e')](_0x28575c['query'][_0xb917('0x2e')]));_0x5c4179[_0xb917('0x2d')]=_0x5c4179[_0xb917('0x2d')][_0xb917('0x3f')]?_0x5c4179[_0xb917('0x2d')]:_0x432e7f[_0xb917('0x2c')];_0x5c4179[_0xb917('0x45')]=qs[_0xb917('0x31')](_0x28575c[_0xb917('0x29')]['sort']);_0x5c4179['where']=qs[_0xb917('0x2a')](_[_0xb917('0x32')](_0x28575c[_0xb917('0x29')],_0x432e7f[_0xb917('0x2a')]));if(_0x28575c[_0xb917('0x29')][_0xb917('0x33')]){_0x5c4179[_0xb917('0x35')]=_[_0xb917('0x34')](_0x5c4179[_0xb917('0x35')],{'$or':_[_0xb917('0x28')](_0x5c4179[_0xb917('0x2d')],function(_0x2d5edd){var _0x489c7b={};_0x489c7b[_0x2d5edd]={'$like':'%'+_0x28575c[_0xb917('0x29')][_0xb917('0x33')]+'%'};return _0x489c7b;})});}_0x5c4179=_['merge']({},_0x5c4179,_0x28575c[_0xb917('0x36')]);return _0x31e74a[_0xb917('0x49')](_0x5c4179);}})[_0xb917('0x1f')](function(_0x6f7d5e){if(_0x6f7d5e){_0x3d3bfb=_0x6f7d5e[_0xb917('0x3f')];if(!_0x28575c['query'][_0xb917('0x2f')](_0xb917('0x30'))){_0x5c4179[_0xb917('0x19')]=qs[_0xb917('0x19')](_0x28575c[_0xb917('0x29')]['limit']);_0x5c4179[_0xb917('0x17')]=qs[_0xb917('0x17')](_0x28575c[_0xb917('0x29')][_0xb917('0x17')]);}return _0x31e74a[_0xb917('0x49')](_0x5c4179);}})['then'](function(_0x3c38bf){if(_0x3c38bf){return _0x3c38bf?{'count':_0x3d3bfb,'rows':_0x3c38bf}:null;}})[_0xb917('0x1f')](respondWithResult(_0x4e9110,null))['catch'](handleError(_0x4e9110,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 3dcb4bf..1ff8419 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 _0x9d30=['request-promise','path','rimraf','../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9d30,0xf9));var _0x09d3=function(_0x30077a,_0x232d23){_0x30077a=_0x30077a-0x0;var _0x195189=_0x9d30[_0x30077a];return _0x195189;};'use strict';var _=require(_0x09d3('0x0'));var util=require(_0x09d3('0x1'));var logger=require(_0x09d3('0x2'))(_0x09d3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x09d3('0x4'));var fs=require('fs');var path=require(_0x09d3('0x5'));var rimraf=require(_0x09d3('0x6'));var config=require(_0x09d3('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x51f142,_0xa48705){return _0x51f142[_0x09d3('0x8')](_0x09d3('0x9'),attributes,{'tableName':_0x09d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0f4=['request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','util','../../config/logger','api','moment'];(function(_0x213650,_0x51cdc1){var _0x5d0add=function(_0x511589){while(--_0x511589){_0x213650['push'](_0x213650['shift']());}};_0x5d0add(++_0x51cdc1);}(_0xc0f4,0x10f));var _0x4c0f=function(_0x5c70e4,_0x5a8638){_0x5c70e4=_0x5c70e4-0x0;var _0x4c981a=_0xc0f4[_0x5c70e4];return _0x4c981a;};'use strict';var _=require('lodash');var util=require(_0x4c0f('0x0'));var logger=require(_0x4c0f('0x1'))(_0x4c0f('0x2'));var moment=require(_0x4c0f('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c0f('0x4'));var fs=require('fs');var path=require(_0x4c0f('0x5'));var rimraf=require(_0x4c0f('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c0f('0x7'));module[_0x4c0f('0x8')]=function(_0x1dc577,_0x248db2){return _0x1dc577[_0x4c0f('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0x4c0f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 1f4ced8..23affd0 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 _0x96cf=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x14596d,_0x1a4568){var _0x55696a=function(_0x103e27){while(--_0x103e27){_0x14596d['push'](_0x14596d['shift']());}};_0x55696a(++_0x1a4568);}(_0x96cf,0x171));var _0xf96c=function(_0x557592,_0x1885ec){_0x557592=_0x557592-0x0;var _0x44b748=_0x96cf[_0x557592];return _0x44b748;};'use strict';var _=require(_0xf96c('0x0'));var util=require(_0xf96c('0x1'));var moment=require(_0xf96c('0x2'));var BPromise=require(_0xf96c('0x3'));var rs=require(_0xf96c('0x4'));var fs=require('fs');var Redis=require(_0xf96c('0x5'));var db=require(_0xf96c('0x6'))['db'];var utils=require(_0xf96c('0x7'));var logger=require(_0xf96c('0x8'))(_0xf96c('0x9'));var config=require(_0xf96c('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf96c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc30cda,_0x1dfd96,_0x3699af){return new BPromise(function(_0x2e9146,_0x9df3ef){return client[_0xf96c('0xc')](_0xc30cda,_0x3699af)['then'](function(_0x4f43e8){logger['info'](_0xf96c('0xd'),_0x1dfd96,'request\x20sent');logger['debug'](_0xf96c('0xe'),_0x1dfd96,_0xf96c('0xf'),JSON[_0xf96c('0x10')](_0x4f43e8));if(_0x4f43e8[_0xf96c('0x11')]){if(_0x4f43e8[_0xf96c('0x11')]['code']===0x1f4){logger[_0xf96c('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1dfd96,_0x4f43e8[_0xf96c('0x11')][_0xf96c('0x12')]);return _0x9df3ef(_0x4f43e8['error'][_0xf96c('0x12')]);}logger[_0xf96c('0x11')](_0xf96c('0xd'),_0x1dfd96,_0x4f43e8[_0xf96c('0x11')][_0xf96c('0x12')]);return _0x2e9146(_0x4f43e8[_0xf96c('0x11')][_0xf96c('0x12')]);}else{logger[_0xf96c('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1dfd96,'request\x20sent');_0x2e9146(_0x4f43e8[_0xf96c('0x14')][_0xf96c('0x12')]);}})[_0xf96c('0x15')](function(_0x2fb7e7){logger[_0xf96c('0x11')](_0xf96c('0xd'),_0x1dfd96,_0x2fb7e7);_0x9df3ef(_0x2fb7e7);});});} \ No newline at end of file +var _0xe0ec=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x4cb1b6,_0x5ef04c){var _0x27e891=function(_0x955668){while(--_0x955668){_0x4cb1b6['push'](_0x4cb1b6['shift']());}};_0x27e891(++_0x5ef04c);}(_0xe0ec,0xf0));var _0xce0e=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0xe0ec[_0x8e9386];return _0x4abf26;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xce0e('0x0'));var BPromise=require('bluebird');var rs=require(_0xce0e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce0e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xce0e('0x3'))(_0xce0e('0x4'));var config=require(_0xce0e('0x5'));var jayson=require(_0xce0e('0x6'));var client=jayson[_0xce0e('0x7')][_0xce0e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7dbf53,_0x3e79de,_0x3a6457){return new BPromise(function(_0x586f38,_0x13813b){return client[_0xce0e('0x9')](_0x7dbf53,_0x3a6457)[_0xce0e('0xa')](function(_0x439904){logger['info'](_0xce0e('0xb'),_0x3e79de,_0xce0e('0xc'));logger[_0xce0e('0xd')](_0xce0e('0xe'),_0x3e79de,_0xce0e('0xc'),JSON['stringify'](_0x439904));if(_0x439904[_0xce0e('0xf')]){if(_0x439904[_0xce0e('0xf')][_0xce0e('0x10')]===0x1f4){logger['error'](_0xce0e('0xb'),_0x3e79de,_0x439904[_0xce0e('0xf')][_0xce0e('0x11')]);return _0x13813b(_0x439904[_0xce0e('0xf')][_0xce0e('0x11')]);}logger[_0xce0e('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3e79de,_0x439904[_0xce0e('0xf')][_0xce0e('0x11')]);return _0x586f38(_0x439904['error'][_0xce0e('0x11')]);}else{logger[_0xce0e('0x12')](_0xce0e('0xb'),_0x3e79de,_0xce0e('0xc'));_0x586f38(_0x439904[_0xce0e('0x13')][_0xce0e('0x11')]);}})['catch'](function(_0x527b0c){logger['error'](_0xce0e('0xb'),_0x3e79de,_0x527b0c);_0x13813b(_0x527b0c);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1bb6d48..f09e58d 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 _0x2360=['../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','create','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x2360,0x18b));var _0x0236=function(_0x397ae9,_0x316ca6){_0x397ae9=_0x397ae9-0x0;var _0x19d565=_0x2360[_0x397ae9];return _0x19d565;};'use strict';var multer=require(_0x0236('0x0'));var util=require(_0x0236('0x1'));var path=require(_0x0236('0x2'));var timeout=require(_0x0236('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0236('0x4'));var interaction=require(_0x0236('0x5'));var config=require(_0x0236('0x6'));var controller=require(_0x0236('0x7'));router[_0x0236('0x8')]('/',auth[_0x0236('0x9')](),controller[_0x0236('0xa')]);router[_0x0236('0x8')](_0x0236('0xb'),auth[_0x0236('0x9')](),controller['show']);router[_0x0236('0xc')]('/',auth[_0x0236('0x9')](),controller[_0x0236('0xd')]);router['put'](_0x0236('0xb'),auth[_0x0236('0x9')](),controller['update']);router[_0x0236('0xe')](_0x0236('0xb'),auth[_0x0236('0x9')](),controller[_0x0236('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1f32=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','index','isAuthenticated','create','/:id','update','delete','exports','multer','util'];(function(_0x31b4e1,_0x4cbd36){var _0x149492=function(_0x46ea18){while(--_0x46ea18){_0x31b4e1['push'](_0x31b4e1['shift']());}};_0x149492(++_0x4cbd36);}(_0x1f32,0xce));var _0x21f3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1f32[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x21f3('0x0'));var util=require(_0x21f3('0x1'));var path=require(_0x21f3('0x2'));var timeout=require(_0x21f3('0x3'));var express=require('express');var router=express[_0x21f3('0x4')]();var fs_extra=require(_0x21f3('0x5'));var auth=require(_0x21f3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x21f3('0x7'));var controller=require(_0x21f3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x21f3('0x9')]);router['get']('/:id',auth[_0x21f3('0xa')](),controller['show']);router['post']('/',auth[_0x21f3('0xa')](),controller[_0x21f3('0xb')]);router['put'](_0x21f3('0xc'),auth[_0x21f3('0xa')](),controller[_0x21f3('0xd')]);router[_0x21f3('0xe')](_0x21f3('0xc'),auth[_0x21f3('0xa')](),controller['destroy']);module[_0x21f3('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5330b58..b428422 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 _0x6a45=['keyValue','picklist','STRING','BOOLEAN','ENUM','string','variable','customVariable'];(function(_0x8491bd,_0xd0c9da){var _0x2ab523=function(_0x3ce169){while(--_0x3ce169){_0x8491bd['push'](_0x8491bd['shift']());}};_0x2ab523(++_0xd0c9da);}(_0x6a45,0xf4));var _0x56a4=function(_0x2d8af7,_0x266491){_0x2d8af7=_0x2d8af7-0x0;var _0x4f2151=_0x6a45[_0x2d8af7];return _0x4f2151;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x56a4('0x0')](_0x56a4('0x1'),_0x56a4('0x2'),_0x56a4('0x3'),_0x56a4('0x4'),_0x56a4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x56a4('0x6')]},'keyType':{'type':Sequelize[_0x56a4('0x0')](_0x56a4('0x1'),'variable',_0x56a4('0x3'))},'keyContent':{'type':Sequelize[_0x56a4('0x6')]},'idField':{'type':Sequelize[_0x56a4('0x6')]},'nameField':{'type':Sequelize[_0x56a4('0x6')]},'customField':{'type':Sequelize[_0x56a4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x56a4('0x6')]}}; \ No newline at end of file +var _0x00ba=['keyValue','picklist','STRING','ENUM','BOOLEAN','string','variable','customVariable'];(function(_0x26a8cf,_0xfc1e2f){var _0x16eb3f=function(_0x12ae8c){while(--_0x12ae8c){_0x26a8cf['push'](_0x26a8cf['shift']());}};_0x16eb3f(++_0xfc1e2f);}(_0x00ba,0x17d));var _0xa00b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x00ba[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xa00b('0x0'),_0xa00b('0x1'),_0xa00b('0x2'),_0xa00b('0x3'),_0xa00b('0x4')),'defaultValue':_0xa00b('0x0')},'content':{'type':Sequelize[_0xa00b('0x5')]},'key':{'type':Sequelize[_0xa00b('0x5')]},'keyType':{'type':Sequelize[_0xa00b('0x6')]('string',_0xa00b('0x1'),_0xa00b('0x2'))},'keyContent':{'type':Sequelize[_0xa00b('0x5')]},'idField':{'type':Sequelize[_0xa00b('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa00b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa00b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c4c5487..d99a958 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 _0x120a=['show','rawAttributes','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x3799a1,_0x202382){var _0x534d7e=function(_0x18620e){while(--_0x18620e){_0x3799a1['push'](_0x3799a1['shift']());}};_0x534d7e(++_0x202382);}(_0x120a,0x99));var _0xa120=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x120a[_0x121b1a];return _0x2d89a6;};'use strict';var emlformat=require(_0xa120('0x0'));var rimraf=require(_0xa120('0x1'));var zipdir=require(_0xa120('0x2'));var jsonpatch=require(_0xa120('0x3'));var rp=require(_0xa120('0x4'));var moment=require(_0xa120('0x5'));var BPromise=require(_0xa120('0x6'));var Mustache=require(_0xa120('0x7'));var util=require('util');var path=require(_0xa120('0x8'));var sox=require(_0xa120('0x9'));var csv=require(_0xa120('0xa'));var ejs=require(_0xa120('0xb'));var fs=require('fs');var fs_extra=require(_0xa120('0xc'));var _=require(_0xa120('0xd'));var squel=require(_0xa120('0xe'));var crypto=require(_0xa120('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa120('0xa'));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(_0xa120('0x10'));var hardwareService=require(_0xa120('0x11'));var logger=require(_0xa120('0x12'))(_0xa120('0x13'));var utils=require(_0xa120('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa120('0x15'));var db=require(_0xa120('0x16'))['db'];function respondWithStatusCode(_0x144164,_0x399858){_0x399858=_0x399858||0xcc;return function(_0x4c1720){if(_0x4c1720){return _0x144164[_0xa120('0x17')](_0x399858);}return _0x144164['status'](_0x399858)[_0xa120('0x18')]();};}function respondWithResult(_0x435eab,_0x39ce62){_0x39ce62=_0x39ce62||0xc8;return function(_0x56cad4){if(_0x56cad4){return _0x435eab['status'](_0x39ce62)[_0xa120('0x19')](_0x56cad4);}};}function respondWithFilteredResult(_0x5d3865,_0x468d5b){return function(_0x560a28){if(_0x560a28){var _0x47c71f=typeof _0x468d5b[_0xa120('0x1a')]===_0xa120('0x1b')&&typeof _0x468d5b[_0xa120('0x1c')]===_0xa120('0x1b');var _0x422b9c=_0x560a28[_0xa120('0x1d')];var _0xbd6b51=_0x47c71f?0x0:_0x468d5b[_0xa120('0x1a')];var _0x235047=_0x47c71f?_0x560a28['count']:_0x468d5b[_0xa120('0x1a')]+_0x468d5b['limit'];var _0x3a1217;if(_0x235047>=_0x422b9c){_0x235047=_0x422b9c;_0x3a1217=0xc8;}else{_0x3a1217=0xce;}_0x5d3865[_0xa120('0x1e')](_0x3a1217);return _0x5d3865['set'](_0xa120('0x1f'),_0xbd6b51+'-'+_0x235047+'/'+_0x422b9c)[_0xa120('0x19')](_0x560a28);}return null;};}function patchUpdates(_0x244cca){return function(_0xb1f8bc){try{jsonpatch[_0xa120('0x20')](_0xb1f8bc,_0x244cca,!![]);}catch(_0x4c3af8){return BPromise[_0xa120('0x21')](_0x4c3af8);}return _0xb1f8bc[_0xa120('0x22')]();};}function saveUpdates(_0x3e950a,_0x4bf053){return function(_0x3e5a35){if(_0x3e5a35){return _0x3e5a35[_0xa120('0x23')](_0x3e950a)[_0xa120('0x24')](function(_0x2a2295){return _0x2a2295;});}return null;};}function removeEntity(_0x1c3f0b,_0x2a70ef){return function(_0x2c395e){if(_0x2c395e){return _0x2c395e[_0xa120('0x25')]()['then'](function(){_0x1c3f0b[_0xa120('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46bc01,_0x48f871){return function(_0x132415){if(!_0x132415){_0x46bc01['sendStatus'](0x194);}return _0x132415;};}function handleError(_0xd87cc4,_0x31ee8b){_0x31ee8b=_0x31ee8b||0x1f4;return function(_0xf479e9){logger[_0xa120('0x26')](_0xf479e9[_0xa120('0x27')]);if(_0xf479e9[_0xa120('0x28')]){delete _0xf479e9[_0xa120('0x28')];}_0xd87cc4[_0xa120('0x1e')](_0x31ee8b)[_0xa120('0x29')](_0xf479e9);};}exports[_0xa120('0x2a')]=function(_0x35ff3b,_0x2ff902){var _0x483605={},_0x267d23={},_0x3bead3={'count':0x0,'rows':[]};var _0x201523=_[_0xa120('0x2b')](db[_0xa120('0x2c')]['rawAttributes'],function(_0x183111){return{'name':_0x183111[_0xa120('0x2d')],'type':_0x183111[_0xa120('0x2e')][_0xa120('0x2f')]};});_0x267d23[_0xa120('0x30')]=_['map'](_0x201523,_0xa120('0x28'));_0x267d23[_0xa120('0x31')]=_[_0xa120('0x32')](_0x35ff3b['query']);_0x267d23[_0xa120('0x33')]=_[_0xa120('0x34')](_0x267d23['model'],_0x267d23[_0xa120('0x31')]);_0x483605[_0xa120('0x35')]=_[_0xa120('0x34')](_0x267d23['model'],qs[_0xa120('0x36')](_0x35ff3b[_0xa120('0x31')][_0xa120('0x36')]));_0x483605[_0xa120('0x35')]=_0x483605[_0xa120('0x35')][_0xa120('0x37')]?_0x483605[_0xa120('0x35')]:_0x267d23[_0xa120('0x30')];if(!_0x35ff3b[_0xa120('0x31')]['hasOwnProperty']('nolimit')){_0x483605[_0xa120('0x1c')]=qs[_0xa120('0x1c')](_0x35ff3b[_0xa120('0x31')][_0xa120('0x1c')]);_0x483605[_0xa120('0x1a')]=qs[_0xa120('0x1a')](_0x35ff3b[_0xa120('0x31')][_0xa120('0x1a')]);}_0x483605[_0xa120('0x38')]=qs[_0xa120('0x39')](_0x35ff3b[_0xa120('0x31')]['sort']);_0x483605[_0xa120('0x3a')]=qs[_0xa120('0x33')](_[_0xa120('0x3b')](_0x35ff3b['query'],_0x267d23[_0xa120('0x33')]),_0x201523);if(_0x35ff3b['query']['filter']){_0x483605[_0xa120('0x3a')]=_[_0xa120('0x3c')](_0x483605['where'],{'$or':_[_0xa120('0x2b')](_0x201523,function(_0xd3e0c8){if(_0xd3e0c8['type']!==_0xa120('0x3d')){var _0x14441a={};_0x14441a[_0xd3e0c8[_0xa120('0x28')]]={'$like':'%'+_0x35ff3b[_0xa120('0x31')][_0xa120('0x3e')]+'%'};return _0x14441a;}})});}_0x483605=_[_0xa120('0x3c')]({},_0x483605,_0x35ff3b[_0xa120('0x3f')]);var _0x52806a={'where':_0x483605[_0xa120('0x3a')]};return db[_0xa120('0x2c')]['count'](_0x52806a)[_0xa120('0x24')](function(_0x1b6d9b){_0x3bead3['count']=_0x1b6d9b;if(_0x35ff3b[_0xa120('0x31')][_0xa120('0x40')]){_0x483605[_0xa120('0x41')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x483605);})[_0xa120('0x24')](function(_0x532521){_0x3bead3['rows']=_0x532521;return _0x3bead3;})['then'](respondWithFilteredResult(_0x2ff902,_0x483605))['catch'](handleError(_0x2ff902,null));};exports[_0xa120('0x42')]=function(_0x25ae91,_0x13d2a8){var _0x43cec0={'raw':!![],'where':{'id':_0x25ae91['params']['id']}},_0x214b0a={};_0x214b0a['model']=_[_0xa120('0x32')](db[_0xa120('0x2c')][_0xa120('0x43')]);_0x214b0a[_0xa120('0x31')]=_[_0xa120('0x32')](_0x25ae91[_0xa120('0x31')]);_0x214b0a['filters']=_['intersection'](_0x214b0a[_0xa120('0x30')],_0x214b0a[_0xa120('0x31')]);_0x43cec0[_0xa120('0x35')]=_['intersection'](_0x214b0a['model'],qs[_0xa120('0x36')](_0x25ae91['query']['fields']));_0x43cec0[_0xa120('0x35')]=_0x43cec0['attributes'][_0xa120('0x37')]?_0x43cec0[_0xa120('0x35')]:_0x214b0a['model'];if(_0x25ae91[_0xa120('0x31')]['includeAll']){_0x43cec0[_0xa120('0x41')]=[{'all':!![]}];}_0x43cec0=_[_0xa120('0x3c')]({},_0x43cec0,_0x25ae91[_0xa120('0x3f')]);return db[_0xa120('0x2c')][_0xa120('0x44')](_0x43cec0)[_0xa120('0x24')](handleEntityNotFound(_0x13d2a8,null))[_0xa120('0x24')](respondWithResult(_0x13d2a8,null))[_0xa120('0x45')](handleError(_0x13d2a8,null));};exports[_0xa120('0x46')]=function(_0x10bae3,_0x1042a6){return db[_0xa120('0x2c')][_0xa120('0x46')](_0x10bae3[_0xa120('0x47')],{})['then'](respondWithResult(_0x1042a6,0xc9))[_0xa120('0x45')](handleError(_0x1042a6,null));};exports[_0xa120('0x23')]=function(_0x421f20,_0x579708){if(_0x421f20[_0xa120('0x47')]['id']){delete _0x421f20[_0xa120('0x47')]['id'];}return db[_0xa120('0x2c')]['find']({'where':{'id':_0x421f20[_0xa120('0x48')]['id']}})['then'](handleEntityNotFound(_0x579708,null))['then'](saveUpdates(_0x421f20[_0xa120('0x47')],null))[_0xa120('0x24')](respondWithResult(_0x579708,null))[_0xa120('0x45')](handleError(_0x579708,null));};exports[_0xa120('0x25')]=function(_0x1074e3,_0x8bd8d2){return db[_0xa120('0x2c')][_0xa120('0x44')]({'where':{'id':_0x1074e3[_0xa120('0x48')]['id']}})[_0xa120('0x24')](handleEntityNotFound(_0x8bd8d2,null))['then'](removeEntity(_0x8bd8d2,null))[_0xa120('0x45')](handleError(_0x8bd8d2,null));}; \ No newline at end of file +var _0x5fb8=['count','json','apply','reject','update','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','SugarcrmField','rows','params','keys','fields','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit'];(function(_0x107616,_0x4c4c91){var _0x48079e=function(_0x52cd51){while(--_0x52cd51){_0x107616['push'](_0x107616['shift']());}};_0x48079e(++_0x4c4c91);}(_0x5fb8,0x6f));var _0x85fb=function(_0x2a4d11,_0x2668fd){_0x2a4d11=_0x2a4d11-0x0;var _0x193026=_0x5fb8[_0x2a4d11];return _0x193026;};'use strict';var emlformat=require(_0x85fb('0x0'));var rimraf=require(_0x85fb('0x1'));var zipdir=require(_0x85fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85fb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85fb('0x4'));var util=require(_0x85fb('0x5'));var path=require('path');var sox=require(_0x85fb('0x6'));var csv=require('to-csv');var ejs=require(_0x85fb('0x7'));var fs=require('fs');var fs_extra=require(_0x85fb('0x8'));var _=require(_0x85fb('0x9'));var squel=require(_0x85fb('0xa'));var crypto=require(_0x85fb('0xb'));var jsforce=require(_0x85fb('0xc'));var deskjs=require(_0x85fb('0xd'));var toCsv=require(_0x85fb('0xe'));var querystring=require(_0x85fb('0xf'));var Papa=require('papaparse');var Redis=require(_0x85fb('0x10'));var authService=require(_0x85fb('0x11'));var qs=require(_0x85fb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85fb('0x13'));var logger=require(_0x85fb('0x14'))(_0x85fb('0x15'));var utils=require('../../config/utils');var config=require(_0x85fb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x85fb('0x17'))['db'];function respondWithStatusCode(_0x500fc0,_0x4bd7a9){_0x4bd7a9=_0x4bd7a9||0xcc;return function(_0x503ba6){if(_0x503ba6){return _0x500fc0['sendStatus'](_0x4bd7a9);}return _0x500fc0[_0x85fb('0x18')](_0x4bd7a9)[_0x85fb('0x19')]();};}function respondWithResult(_0x41addc,_0x51b839){_0x51b839=_0x51b839||0xc8;return function(_0x568828){if(_0x568828){return _0x41addc[_0x85fb('0x18')](_0x51b839)['json'](_0x568828);}};}function respondWithFilteredResult(_0x1b5197,_0xadb06e){return function(_0x4d51a3){if(_0x4d51a3){var _0x5cdb72=typeof _0xadb06e[_0x85fb('0x1a')]===_0x85fb('0x1b')&&typeof _0xadb06e[_0x85fb('0x1c')]===_0x85fb('0x1b');var _0x31d603=_0x4d51a3[_0x85fb('0x1d')];var _0x13b56e=_0x5cdb72?0x0:_0xadb06e[_0x85fb('0x1a')];var _0x216fdf=_0x5cdb72?_0x4d51a3['count']:_0xadb06e[_0x85fb('0x1a')]+_0xadb06e['limit'];var _0x4e87d5;if(_0x216fdf>=_0x31d603){_0x216fdf=_0x31d603;_0x4e87d5=0xc8;}else{_0x4e87d5=0xce;}_0x1b5197[_0x85fb('0x18')](_0x4e87d5);return _0x1b5197['set']('Content-Range',_0x13b56e+'-'+_0x216fdf+'/'+_0x31d603)[_0x85fb('0x1e')](_0x4d51a3);}return null;};}function patchUpdates(_0x11fed2){return function(_0x345f4a){try{jsonpatch[_0x85fb('0x1f')](_0x345f4a,_0x11fed2,!![]);}catch(_0x213637){return BPromise[_0x85fb('0x20')](_0x213637);}return _0x345f4a['save']();};}function saveUpdates(_0x2e3dc3,_0x531378){return function(_0x19a75b){if(_0x19a75b){return _0x19a75b[_0x85fb('0x21')](_0x2e3dc3)[_0x85fb('0x22')](function(_0x2054f3){return _0x2054f3;});}return null;};}function removeEntity(_0x2ca383,_0x10d578){return function(_0x590da3){if(_0x590da3){return _0x590da3['destroy']()[_0x85fb('0x22')](function(){_0x2ca383[_0x85fb('0x18')](0xcc)[_0x85fb('0x19')]();});}};}function handleEntityNotFound(_0x593976,_0x578ce6){return function(_0x2ffb86){if(!_0x2ffb86){_0x593976[_0x85fb('0x23')](0x194);}return _0x2ffb86;};}function handleError(_0x83679c,_0x5a3655){_0x5a3655=_0x5a3655||0x1f4;return function(_0x6f4a5e){logger[_0x85fb('0x24')](_0x6f4a5e[_0x85fb('0x25')]);if(_0x6f4a5e[_0x85fb('0x26')]){delete _0x6f4a5e[_0x85fb('0x26')];}_0x83679c[_0x85fb('0x18')](_0x5a3655)[_0x85fb('0x27')](_0x6f4a5e);};}exports['index']=function(_0x355130,_0xd2cf3e){var _0x12448a={},_0x135c8c={},_0x13a5b5={'count':0x0,'rows':[]};var _0x380000=_[_0x85fb('0x28')](db['SugarcrmField'][_0x85fb('0x29')],function(_0x22cb39){return{'name':_0x22cb39[_0x85fb('0x2a')],'type':_0x22cb39[_0x85fb('0x2b')][_0x85fb('0x2c')]};});_0x135c8c[_0x85fb('0x2d')]=_['map'](_0x380000,'name');_0x135c8c['query']=_['keys'](_0x355130[_0x85fb('0x2e')]);_0x135c8c['filters']=_[_0x85fb('0x2f')](_0x135c8c['model'],_0x135c8c[_0x85fb('0x2e')]);_0x12448a[_0x85fb('0x30')]=_['intersection'](_0x135c8c[_0x85fb('0x2d')],qs['fields'](_0x355130[_0x85fb('0x2e')]['fields']));_0x12448a['attributes']=_0x12448a[_0x85fb('0x30')]['length']?_0x12448a[_0x85fb('0x30')]:_0x135c8c[_0x85fb('0x2d')];if(!_0x355130['query'][_0x85fb('0x31')]('nolimit')){_0x12448a[_0x85fb('0x1c')]=qs[_0x85fb('0x1c')](_0x355130[_0x85fb('0x2e')][_0x85fb('0x1c')]);_0x12448a[_0x85fb('0x1a')]=qs[_0x85fb('0x1a')](_0x355130[_0x85fb('0x2e')][_0x85fb('0x1a')]);}_0x12448a[_0x85fb('0x32')]=qs[_0x85fb('0x33')](_0x355130['query'][_0x85fb('0x33')]);_0x12448a[_0x85fb('0x34')]=qs[_0x85fb('0x35')](_[_0x85fb('0x36')](_0x355130[_0x85fb('0x2e')],_0x135c8c[_0x85fb('0x35')]),_0x380000);if(_0x355130['query'][_0x85fb('0x37')]){_0x12448a[_0x85fb('0x34')]=_[_0x85fb('0x38')](_0x12448a[_0x85fb('0x34')],{'$or':_[_0x85fb('0x28')](_0x380000,function(_0x2be245){if(_0x2be245[_0x85fb('0x2b')]!==_0x85fb('0x39')){var _0x27f2be={};_0x27f2be[_0x2be245['name']]={'$like':'%'+_0x355130['query']['filter']+'%'};return _0x27f2be;}})});}_0x12448a=_[_0x85fb('0x38')]({},_0x12448a,_0x355130[_0x85fb('0x3a')]);var _0x436cbb={'where':_0x12448a[_0x85fb('0x34')]};return db['SugarcrmField'][_0x85fb('0x1d')](_0x436cbb)[_0x85fb('0x22')](function(_0x40c596){_0x13a5b5[_0x85fb('0x1d')]=_0x40c596;if(_0x355130[_0x85fb('0x2e')][_0x85fb('0x3b')]){_0x12448a[_0x85fb('0x3c')]=[{'all':!![]}];}return db[_0x85fb('0x3d')]['findAll'](_0x12448a);})[_0x85fb('0x22')](function(_0xf8660c){_0x13a5b5[_0x85fb('0x3e')]=_0xf8660c;return _0x13a5b5;})[_0x85fb('0x22')](respondWithFilteredResult(_0xd2cf3e,_0x12448a))['catch'](handleError(_0xd2cf3e,null));};exports['show']=function(_0x5a4135,_0x53522f){var _0x38eb39={'raw':!![],'where':{'id':_0x5a4135[_0x85fb('0x3f')]['id']}},_0x3b93b5={};_0x3b93b5['model']=_[_0x85fb('0x40')](db[_0x85fb('0x3d')][_0x85fb('0x29')]);_0x3b93b5[_0x85fb('0x2e')]=_[_0x85fb('0x40')](_0x5a4135[_0x85fb('0x2e')]);_0x3b93b5[_0x85fb('0x35')]=_[_0x85fb('0x2f')](_0x3b93b5[_0x85fb('0x2d')],_0x3b93b5[_0x85fb('0x2e')]);_0x38eb39[_0x85fb('0x30')]=_['intersection'](_0x3b93b5['model'],qs[_0x85fb('0x41')](_0x5a4135['query'][_0x85fb('0x41')]));_0x38eb39[_0x85fb('0x30')]=_0x38eb39[_0x85fb('0x30')]['length']?_0x38eb39[_0x85fb('0x30')]:_0x3b93b5[_0x85fb('0x2d')];if(_0x5a4135[_0x85fb('0x2e')][_0x85fb('0x3b')]){_0x38eb39['include']=[{'all':!![]}];}_0x38eb39=_[_0x85fb('0x38')]({},_0x38eb39,_0x5a4135[_0x85fb('0x3a')]);return db[_0x85fb('0x3d')]['find'](_0x38eb39)[_0x85fb('0x22')](handleEntityNotFound(_0x53522f,null))[_0x85fb('0x22')](respondWithResult(_0x53522f,null))[_0x85fb('0x42')](handleError(_0x53522f,null));};exports[_0x85fb('0x43')]=function(_0x2ee8a6,_0xac5ba7){return db[_0x85fb('0x3d')][_0x85fb('0x43')](_0x2ee8a6[_0x85fb('0x44')],{})[_0x85fb('0x22')](respondWithResult(_0xac5ba7,0xc9))['catch'](handleError(_0xac5ba7,null));};exports['update']=function(_0x5718aa,_0x29b0b4){if(_0x5718aa['body']['id']){delete _0x5718aa[_0x85fb('0x44')]['id'];}return db[_0x85fb('0x3d')][_0x85fb('0x45')]({'where':{'id':_0x5718aa[_0x85fb('0x3f')]['id']}})[_0x85fb('0x22')](handleEntityNotFound(_0x29b0b4,null))['then'](saveUpdates(_0x5718aa['body'],null))[_0x85fb('0x22')](respondWithResult(_0x29b0b4,null))[_0x85fb('0x42')](handleError(_0x29b0b4,null));};exports['destroy']=function(_0x306ca8,_0x2cf616){return db[_0x85fb('0x3d')][_0x85fb('0x45')]({'where':{'id':_0x306ca8[_0x85fb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2cf616,null))[_0x85fb('0x22')](removeEntity(_0x2cf616,null))[_0x85fb('0x42')](handleError(_0x2cf616,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index f901c6c..285ab17 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 _0x31a4=['../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5374eb,_0x4e5e18){var _0x406a25=function(_0x3dfa42){while(--_0x3dfa42){_0x5374eb['push'](_0x5374eb['shift']());}};_0x406a25(++_0x4e5e18);}(_0x31a4,0x19d));var _0x431a=function(_0x235955,_0x2c8565){_0x235955=_0x235955-0x0;var _0x58c0f9=_0x31a4[_0x235955];return _0x58c0f9;};'use strict';var _=require('lodash');var util=require(_0x431a('0x0'));var logger=require(_0x431a('0x1'))(_0x431a('0x2'));var moment=require(_0x431a('0x3'));var BPromise=require('bluebird');var rp=require(_0x431a('0x4'));var fs=require('fs');var path=require(_0x431a('0x5'));var rimraf=require(_0x431a('0x6'));var config=require(_0x431a('0x7'));var attributes=require(_0x431a('0x8'));module[_0x431a('0x9')]=function(_0x2b411c,_0x489c7a){return _0x2b411c[_0x431a('0xa')](_0x431a('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x431a('0xc'),'fields':[_0x431a('0xd'),_0x431a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea47=['path','rimraf','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','api','moment','request-promise'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0xea47,0x98));var _0x7ea4=function(_0x4995ec,_0x488d2b){_0x4995ec=_0x4995ec-0x0;var _0x3d4078=_0xea47[_0x4995ec];return _0x3d4078;};'use strict';var _=require(_0x7ea4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7ea4('0x1'));var moment=require(_0x7ea4('0x2'));var BPromise=require('bluebird');var rp=require(_0x7ea4('0x3'));var fs=require('fs');var path=require(_0x7ea4('0x4'));var rimraf=require(_0x7ea4('0x5'));var config=require('../../config/environment');var attributes=require(_0x7ea4('0x6'));module[_0x7ea4('0x7')]=function(_0x3c25c7,_0x2a60fd){return _0x3c25c7[_0x7ea4('0x8')]('SugarcrmField',attributes,{'tableName':_0x7ea4('0x9'),'paranoid':![],'indexes':[{'name':_0x7ea4('0xa'),'fields':[_0x7ea4('0xb'),_0x7ea4('0xc')],'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 8d749ae..787c178 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 _0xa02f=['jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3a801c,_0x384c52){var _0x37f999=function(_0x412595){while(--_0x412595){_0x3a801c['push'](_0x3a801c['shift']());}};_0x37f999(++_0x384c52);}(_0xa02f,0xbe));var _0xfa02=function(_0x21837e,_0x137b5d){_0x21837e=_0x21837e-0x0;var _0x3d0b4d=_0xa02f[_0x21837e];return _0x3d0b4d;};'use strict';var _=require(_0xfa02('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfa02('0x1'));var rs=require(_0xfa02('0x2'));var fs=require('fs');var Redis=require(_0xfa02('0x3'));var db=require(_0xfa02('0x4'))['db'];var utils=require(_0xfa02('0x5'));var logger=require(_0xfa02('0x6'))('rpc');var config=require(_0xfa02('0x7'));var jayson=require(_0xfa02('0x8'));var client=jayson[_0xfa02('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35a56d,_0x20d13b,_0x4e6338){return new BPromise(function(_0x467b62,_0x3c62cf){return client[_0xfa02('0xa')](_0x35a56d,_0x4e6338)[_0xfa02('0xb')](function(_0x5399ea){logger['info'](_0xfa02('0xc'),_0x20d13b,'request\x20sent');logger['debug'](_0xfa02('0xd'),_0x20d13b,_0xfa02('0xe'),JSON[_0xfa02('0xf')](_0x5399ea));if(_0x5399ea[_0xfa02('0x10')]){if(_0x5399ea['error'][_0xfa02('0x11')]===0x1f4){logger[_0xfa02('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x20d13b,_0x5399ea[_0xfa02('0x10')]['message']);return _0x3c62cf(_0x5399ea[_0xfa02('0x10')][_0xfa02('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x20d13b,_0x5399ea[_0xfa02('0x10')][_0xfa02('0x12')]);return _0x467b62(_0x5399ea[_0xfa02('0x10')][_0xfa02('0x12')]);}else{logger[_0xfa02('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x20d13b,'request\x20sent');_0x467b62(_0x5399ea[_0xfa02('0x14')]['message']);}})[_0xfa02('0x15')](function(_0xaa3669){logger['error'](_0xfa02('0xc'),_0x20d13b,_0xaa3669);_0x3c62cf(_0xaa3669);});});} \ No newline at end of file +var _0x5f39=['client','request','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0x5f39,0x1f0));var _0x95f3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5f39[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x95f3('0x0'));var moment=require(_0x95f3('0x1'));var BPromise=require(_0x95f3('0x2'));var rs=require(_0x95f3('0x3'));var fs=require('fs');var Redis=require(_0x95f3('0x4'));var db=require(_0x95f3('0x5'))['db'];var utils=require(_0x95f3('0x6'));var logger=require(_0x95f3('0x7'))(_0x95f3('0x8'));var config=require('../../config/environment');var jayson=require(_0x95f3('0x9'));var client=jayson[_0x95f3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ca64e,_0x2dd0c8,_0x2db621){return new BPromise(function(_0x162ab4,_0x409dee){return client[_0x95f3('0xb')](_0x4ca64e,_0x2db621)['then'](function(_0x2ceb56){logger[_0x95f3('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x2dd0c8,_0x95f3('0xd'));logger[_0x95f3('0xe')](_0x95f3('0xf'),_0x2dd0c8,_0x95f3('0xd'),JSON[_0x95f3('0x10')](_0x2ceb56));if(_0x2ceb56[_0x95f3('0x11')]){if(_0x2ceb56[_0x95f3('0x11')][_0x95f3('0x12')]===0x1f4){logger[_0x95f3('0x11')](_0x95f3('0x13'),_0x2dd0c8,_0x2ceb56['error'][_0x95f3('0x14')]);return _0x409dee(_0x2ceb56[_0x95f3('0x11')][_0x95f3('0x14')]);}logger[_0x95f3('0x11')](_0x95f3('0x13'),_0x2dd0c8,_0x2ceb56[_0x95f3('0x11')]['message']);return _0x162ab4(_0x2ceb56[_0x95f3('0x11')][_0x95f3('0x14')]);}else{logger[_0x95f3('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x2dd0c8,'request\x20sent');_0x162ab4(_0x2ceb56[_0x95f3('0x15')]['message']);}})['catch'](function(_0x3bd336){logger[_0x95f3('0x11')](_0x95f3('0x13'),_0x2dd0c8,_0x3bd336);_0x409dee(_0x3bd336);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4118468..30c55a0 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 _0xb43b=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2b9e6b,_0x3c2eb1){var _0x1982b7=function(_0x27f978){while(--_0x27f978){_0x2b9e6b['push'](_0x2b9e6b['shift']());}};_0x1982b7(++_0x3c2eb1);}(_0xb43b,0x1b2));var _0xbb43=function(_0x101df6,_0x5b488e){_0x101df6=_0x101df6-0x0;var _0x507b57=_0xb43b[_0x101df6];return _0x507b57;};'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('0xd')]('/:id/fields',auth[_0xbb43('0xb')](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')]('/',auth[_0xbb43('0xb')](),controller[_0xbb43('0x12')]);router[_0xbb43('0x11')]('/:id/configurations',auth[_0xbb43('0xb')](),controller[_0xbb43('0x13')]);router['put']('/:id',auth[_0xbb43('0xb')](),controller['update']);router['delete'](_0xbb43('0xa'),auth['isAuthenticated'](),controller[_0xbb43('0x14')]);module[_0xbb43('0x15')]=router; \ No newline at end of file +var _0x9f4b=['destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete'];(function(_0x22441f,_0x2dcda9){var _0x55f696=function(_0x1963a2){while(--_0x1963a2){_0x22441f['push'](_0x22441f['shift']());}};_0x55f696(++_0x2dcda9);}(_0x9f4b,0xfc));var _0xb9f4=function(_0x140aec,_0x9eb82d){_0x140aec=_0x140aec-0x0;var _0x356b69=_0x9f4b[_0x140aec];return _0x356b69;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb9f4('0x0'));var timeout=require(_0xb9f4('0x1'));var express=require(_0xb9f4('0x2'));var router=express[_0xb9f4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb9f4('0x4'));var interaction=require(_0xb9f4('0x5'));var config=require(_0xb9f4('0x6'));var controller=require(_0xb9f4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb9f4('0x8')]);router[_0xb9f4('0x9')](_0xb9f4('0xa'),auth[_0xb9f4('0xb')](),controller[_0xb9f4('0xc')]);router['get'](_0xb9f4('0xd'),auth['isAuthenticated'](),controller[_0xb9f4('0xe')]);router[_0xb9f4('0x9')](_0xb9f4('0xf'),auth[_0xb9f4('0xb')](),controller[_0xb9f4('0x10')]);router['post']('/',auth[_0xb9f4('0xb')](),controller[_0xb9f4('0x11')]);router[_0xb9f4('0x12')](_0xb9f4('0xd'),auth['isAuthenticated'](),controller[_0xb9f4('0x13')]);router[_0xb9f4('0x14')](_0xb9f4('0xa'),auth['isAuthenticated'](),controller[_0xb9f4('0x15')]);router[_0xb9f4('0x16')](_0xb9f4('0xa'),auth['isAuthenticated'](),controller[_0xb9f4('0x17')]);module[_0xb9f4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 654c339..71154ea 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 _0x0d5d=['exports','STRING','HelpDesk'];(function(_0x36ccbf,_0x45a895){var _0x495ea0=function(_0x4d37b2){while(--_0x4d37b2){_0x36ccbf['push'](_0x36ccbf['shift']());}};_0x495ea0(++_0x45a895);}(_0x0d5d,0x7e));var _0xd0d5=function(_0xc1bfb9,_0x4538c6){_0xc1bfb9=_0xc1bfb9-0x0;var _0x2296a7=_0x0d5d[_0xc1bfb9];return _0x2296a7;};'use strict';var Sequelize=require('sequelize');module[_0xd0d5('0x0')]={'name':{'type':Sequelize[_0xd0d5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd0d5('0x1')]},'username':{'type':Sequelize[_0xd0d5('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd0d5('0x1')],'allowNull':![],'defaultValue':_0xd0d5('0x2')},'remoteUri':{'type':Sequelize[_0xd0d5('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xc01d=['sequelize','exports','STRING','HelpDesk'];(function(_0x4be3e7,_0x3a7f05){var _0x4d44a0=function(_0x3eafee){while(--_0x3eafee){_0x4be3e7['push'](_0x4be3e7['shift']());}};_0x4d44a0(++_0x3a7f05);}(_0xc01d,0x184));var _0xdc01=function(_0x508a44,_0x4dcc33){_0x508a44=_0x508a44-0x0;var _0x15092d=_0xc01d[_0x508a44];return _0x15092d;};'use strict';var Sequelize=require(_0xdc01('0x0'));module[_0xdc01('0x1')]={'name':{'type':Sequelize[_0xdc01('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xdc01('0x2')],'allowNull':![],'defaultValue':_0xdc01('0x3')},'remoteUri':{'type':Sequelize[_0xdc01('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xdc01('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index bda6cbe..eea31bc 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 _0x256b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','remoteUri','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','success','POST','login','token','GET','describe','sessionName','autogenerated','reference','remove','result','includes','editable','false','startsWith','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','getFields','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x256b,0xd9));var _0xb256=function(_0x2fa2e5,_0x48fa14){_0x2fa2e5=_0x2fa2e5-0x0;var _0x2e6480=_0x256b[_0x2fa2e5];return _0x2e6480;};'use strict';var emlformat=require(_0xb256('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb256('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb256('0x2'));var moment=require(_0xb256('0x3'));var BPromise=require(_0xb256('0x4'));var Mustache=require(_0xb256('0x5'));var util=require(_0xb256('0x6'));var path=require(_0xb256('0x7'));var sox=require(_0xb256('0x8'));var csv=require(_0xb256('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb256('0xa'));var crypto=require(_0xb256('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb256('0xc'));var toCsv=require(_0xb256('0x9'));var querystring=require(_0xb256('0xd'));var Papa=require(_0xb256('0xe'));var Redis=require(_0xb256('0xf'));var authService=require(_0xb256('0x10'));var qs=require(_0xb256('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb256('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb256('0x13'));var config=require(_0xb256('0x14'));var licenseUtil=require(_0xb256('0x15'));var db=require(_0xb256('0x16'))['db'];var integrations=require(_0xb256('0x17'));function respondWithStatusCode(_0x35510c,_0x256885){_0x256885=_0x256885||0xcc;return function(_0x5594ae){if(_0x5594ae){return _0x35510c[_0xb256('0x18')](_0x256885);}return _0x35510c[_0xb256('0x19')](_0x256885)[_0xb256('0x1a')]();};}function respondWithResult(_0x53845b,_0x3c0cd2){_0x3c0cd2=_0x3c0cd2||0xc8;return function(_0x5c183f){if(_0x5c183f){return _0x53845b[_0xb256('0x19')](_0x3c0cd2)[_0xb256('0x1b')](_0x5c183f);}};}function respondWithFilteredResult(_0x2ba99b,_0x17f102){return function(_0x56342c){if(_0x56342c){var _0x5fb73c=typeof _0x17f102[_0xb256('0x1c')]===_0xb256('0x1d')&&typeof _0x17f102[_0xb256('0x1e')]==='undefined';var _0x245574=_0x56342c[_0xb256('0x1f')];var _0x8ccf57=_0x5fb73c?0x0:_0x17f102[_0xb256('0x1c')];var _0x2e1cf4=_0x5fb73c?_0x56342c[_0xb256('0x1f')]:_0x17f102[_0xb256('0x1c')]+_0x17f102[_0xb256('0x1e')];var _0x4619bb;if(_0x2e1cf4>=_0x245574){_0x2e1cf4=_0x245574;_0x4619bb=0xc8;}else{_0x4619bb=0xce;}_0x2ba99b[_0xb256('0x19')](_0x4619bb);return _0x2ba99b[_0xb256('0x20')](_0xb256('0x21'),_0x8ccf57+'-'+_0x2e1cf4+'/'+_0x245574)[_0xb256('0x1b')](_0x56342c);}return null;};}function patchUpdates(_0x4eb452){return function(_0x217ee6){try{jsonpatch[_0xb256('0x22')](_0x217ee6,_0x4eb452,!![]);}catch(_0xadb37f){return BPromise['reject'](_0xadb37f);}return _0x217ee6['save']();};}function saveUpdates(_0x125a15,_0x7acb01){return function(_0x2e0cf7){if(_0x2e0cf7){return _0x2e0cf7[_0xb256('0x23')](_0x125a15)['then'](function(_0x22e5de){return _0x22e5de;});}return null;};}function removeEntity(_0x3bbc23,_0x391bf7){return function(_0x8a5c1d){if(_0x8a5c1d){return _0x8a5c1d[_0xb256('0x24')]()['then'](function(){_0x3bbc23['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe4229b,_0x343b31){return function(_0x5427bb){if(!_0x5427bb){_0xe4229b[_0xb256('0x18')](0x194);}return _0x5427bb;};}function handleError(_0x169eb3,_0x2c9e8e){_0x2c9e8e=_0x2c9e8e||0x1f4;return function(_0x2ad709){logger['error'](_0x2ad709[_0xb256('0x25')]);if(_0x2ad709['name']){delete _0x2ad709[_0xb256('0x26')];}_0x169eb3[_0xb256('0x19')](_0x2c9e8e)[_0xb256('0x27')](_0x2ad709);};}exports['index']=function(_0x3f57e3,_0x2ba0fa){var _0xf7f3de={},_0x341696={},_0x1338f9={'count':0x0,'rows':[]};var _0x3697c1=_[_0xb256('0x28')](db[_0xb256('0x29')][_0xb256('0x2a')],function(_0x416f00){return{'name':_0x416f00[_0xb256('0x2b')],'type':_0x416f00[_0xb256('0x2c')][_0xb256('0x2d')]};});_0x341696[_0xb256('0x2e')]=_[_0xb256('0x28')](_0x3697c1,'name');_0x341696[_0xb256('0x2f')]=_[_0xb256('0x30')](_0x3f57e3[_0xb256('0x2f')]);_0x341696[_0xb256('0x31')]=_[_0xb256('0x32')](_0x341696[_0xb256('0x2e')],_0x341696[_0xb256('0x2f')]);_0xf7f3de['attributes']=_[_0xb256('0x32')](_0x341696[_0xb256('0x2e')],qs[_0xb256('0x33')](_0x3f57e3[_0xb256('0x2f')]['fields']));_0xf7f3de[_0xb256('0x34')]=_0xf7f3de[_0xb256('0x34')][_0xb256('0x35')]?_0xf7f3de['attributes']:_0x341696[_0xb256('0x2e')];if(!_0x3f57e3[_0xb256('0x2f')][_0xb256('0x36')](_0xb256('0x37'))){_0xf7f3de[_0xb256('0x1e')]=qs['limit'](_0x3f57e3['query'][_0xb256('0x1e')]);_0xf7f3de[_0xb256('0x1c')]=qs[_0xb256('0x1c')](_0x3f57e3['query'][_0xb256('0x1c')]);}_0xf7f3de[_0xb256('0x38')]=qs[_0xb256('0x39')](_0x3f57e3[_0xb256('0x2f')][_0xb256('0x39')]);_0xf7f3de[_0xb256('0x3a')]=qs['filters'](_[_0xb256('0x3b')](_0x3f57e3[_0xb256('0x2f')],_0x341696[_0xb256('0x31')]),_0x3697c1);if(_0x3f57e3['query'][_0xb256('0x3c')]){_0xf7f3de['where']=_[_0xb256('0x3d')](_0xf7f3de[_0xb256('0x3a')],{'$or':_[_0xb256('0x28')](_0x3697c1,function(_0x5bf620){if(_0x5bf620[_0xb256('0x2c')]!=='VIRTUAL'){var _0x3ef276={};_0x3ef276[_0x5bf620[_0xb256('0x26')]]={'$like':'%'+_0x3f57e3[_0xb256('0x2f')][_0xb256('0x3c')]+'%'};return _0x3ef276;}})});}_0xf7f3de=_[_0xb256('0x3d')]({},_0xf7f3de,_0x3f57e3[_0xb256('0x3e')]);var _0x545e39={'where':_0xf7f3de[_0xb256('0x3a')]};return db[_0xb256('0x29')][_0xb256('0x1f')](_0x545e39)[_0xb256('0x3f')](function(_0x3dba43){_0x1338f9['count']=_0x3dba43;if(_0x3f57e3[_0xb256('0x2f')][_0xb256('0x40')]){_0xf7f3de[_0xb256('0x41')]=[{'all':!![]}];}return db[_0xb256('0x29')]['findAll'](_0xf7f3de);})[_0xb256('0x3f')](function(_0x58f247){_0x1338f9[_0xb256('0x42')]=_0x58f247;return _0x1338f9;})['then'](respondWithFilteredResult(_0x2ba0fa,_0xf7f3de))[_0xb256('0x43')](handleError(_0x2ba0fa,null));};exports[_0xb256('0x44')]=function(_0x54d16d,_0x4aaf5e){var _0x597718={'raw':![],'where':{'id':_0x54d16d[_0xb256('0x45')]['id']}},_0x182662={};_0x182662['model']=_[_0xb256('0x30')](db[_0xb256('0x29')][_0xb256('0x2a')]);_0x182662[_0xb256('0x2f')]=_[_0xb256('0x30')](_0x54d16d[_0xb256('0x2f')]);_0x182662[_0xb256('0x31')]=_[_0xb256('0x32')](_0x182662[_0xb256('0x2e')],_0x182662[_0xb256('0x2f')]);_0x597718[_0xb256('0x34')]=_['intersection'](_0x182662[_0xb256('0x2e')],qs['fields'](_0x54d16d['query'][_0xb256('0x33')]));_0x597718[_0xb256('0x34')]=_0x597718[_0xb256('0x34')]['length']?_0x597718[_0xb256('0x34')]:_0x182662[_0xb256('0x2e')];if(_0x54d16d[_0xb256('0x2f')][_0xb256('0x40')]){_0x597718[_0xb256('0x41')]=[{'all':!![]}];}_0x597718=_['merge']({},_0x597718,_0x54d16d[_0xb256('0x3e')]);return db['VtigerAccount']['find'](_0x597718)[_0xb256('0x3f')](handleEntityNotFound(_0x4aaf5e,null))[_0xb256('0x3f')](respondWithResult(_0x4aaf5e,null))['catch'](handleError(_0x4aaf5e,null));};exports[_0xb256('0x46')]=function(_0x44ac4c,_0x21dd67){return db['VtigerAccount'][_0xb256('0x46')](_0x44ac4c[_0xb256('0x47')],{})[_0xb256('0x3f')](respondWithResult(_0x21dd67,0xc9))[_0xb256('0x43')](handleError(_0x21dd67,null));};exports[_0xb256('0x23')]=function(_0x6ecc4,_0xe39d81){if(_0x6ecc4[_0xb256('0x47')]['id']){delete _0x6ecc4[_0xb256('0x47')]['id'];}return db[_0xb256('0x29')]['find']({'where':{'id':_0x6ecc4[_0xb256('0x45')]['id']}})[_0xb256('0x3f')](handleEntityNotFound(_0xe39d81,null))[_0xb256('0x3f')](saveUpdates(_0x6ecc4[_0xb256('0x47')],null))[_0xb256('0x3f')](respondWithResult(_0xe39d81,null))[_0xb256('0x43')](handleError(_0xe39d81,null));};exports['destroy']=function(_0x4af0f1,_0x3e03c3){return db[_0xb256('0x29')][_0xb256('0x48')]({'where':{'id':_0x4af0f1[_0xb256('0x45')]['id']}})[_0xb256('0x3f')](handleEntityNotFound(_0x3e03c3,null))['then'](removeEntity(_0x3e03c3,null))[_0xb256('0x43')](handleError(_0x3e03c3,null));};exports[_0xb256('0x49')]=function(_0x55b051,_0x55793a,_0x246c76){var _0x2f0c74={};var _0x4ec6be={};var _0x516c87;var _0x1b01ee;return db[_0xb256('0x29')][_0xb256('0x4a')]({'where':{'id':_0x55b051[_0xb256('0x45')]['id']}})[_0xb256('0x3f')](handleEntityNotFound(_0x55793a,null))['then'](function(_0x35a601){if(_0x35a601){_0x516c87=_0x35a601;_0x4ec6be['model']=_[_0xb256('0x30')](db[_0xb256('0x4b')][_0xb256('0x2a')]);_0x4ec6be[_0xb256('0x2f')]=_[_0xb256('0x30')](_0x55b051[_0xb256('0x2f')]);_0x4ec6be[_0xb256('0x31')]=_['intersection'](_0x4ec6be[_0xb256('0x2e')],_0x4ec6be[_0xb256('0x2f')]);_0x2f0c74[_0xb256('0x34')]=_['intersection'](_0x4ec6be[_0xb256('0x2e')],qs[_0xb256('0x33')](_0x55b051[_0xb256('0x2f')][_0xb256('0x33')]));_0x2f0c74[_0xb256('0x34')]=_0x2f0c74['attributes'][_0xb256('0x35')]?_0x2f0c74['attributes']:_0x4ec6be[_0xb256('0x2e')];_0x2f0c74[_0xb256('0x38')]=qs[_0xb256('0x39')](_0x55b051[_0xb256('0x2f')]['sort']);_0x2f0c74[_0xb256('0x3a')]=qs[_0xb256('0x31')](_[_0xb256('0x3b')](_0x55b051[_0xb256('0x2f')],_0x4ec6be[_0xb256('0x31')]));if(_0x55b051[_0xb256('0x2f')][_0xb256('0x3c')]){_0x2f0c74[_0xb256('0x3a')]=_['merge'](_0x2f0c74['where'],{'$or':_[_0xb256('0x28')](_0x2f0c74[_0xb256('0x34')],function(_0x3c4b90){var _0x5d5761={};_0x5d5761[_0x3c4b90]={'$like':'%'+_0x55b051[_0xb256('0x2f')][_0xb256('0x3c')]+'%'};return _0x5d5761;})});}_0x2f0c74=_[_0xb256('0x3d')]({},_0x2f0c74,_0x55b051[_0xb256('0x3e')]);return _0x516c87[_0xb256('0x49')](_0x2f0c74);}})[_0xb256('0x3f')](function(_0x3fc618){if(_0x3fc618){_0x1b01ee=_0x3fc618[_0xb256('0x35')];if(!_0x55b051[_0xb256('0x2f')][_0xb256('0x36')](_0xb256('0x37'))){_0x2f0c74[_0xb256('0x1e')]=qs[_0xb256('0x1e')](_0x55b051[_0xb256('0x2f')][_0xb256('0x1e')]);_0x2f0c74[_0xb256('0x1c')]=qs[_0xb256('0x1c')](_0x55b051['query'][_0xb256('0x1c')]);}return _0x516c87[_0xb256('0x49')](_0x2f0c74);}})[_0xb256('0x3f')](function(_0x579734){if(_0x579734){return _0x579734?{'count':_0x1b01ee,'rows':_0x579734}:null;}})[_0xb256('0x3f')](respondWithResult(_0x55793a,null))['catch'](handleError(_0x55793a,null));};exports[_0xb256('0x4c')]=function(_0x5ccac9,_0x1c90d2,_0xcd2bc0){if(_0x5ccac9[_0xb256('0x47')]['id']){delete _0x5ccac9['body']['id'];}return db[_0xb256('0x29')][_0xb256('0x4a')]({'where':{'id':_0x5ccac9['params']['id']}})[_0xb256('0x3f')](handleEntityNotFound(_0x1c90d2,null))[_0xb256('0x3f')](function(_0x5f4c6c){if(_0x5f4c6c){_0x5ccac9['body'][_0xb256('0x4d')]=_0x5f4c6c['id'];_0x5ccac9[_0xb256('0x47')][_0xb256('0x4e')]=integrations[_0xb256('0x4f')](_0x5ccac9[_0xb256('0x47')][_0xb256('0x50')],_0x5ccac9[_0xb256('0x47')][_0xb256('0x2c')]);_0x5ccac9[_0xb256('0x47')][_0xb256('0x51')]=integrations['getDescriptions'](_0x5ccac9[_0xb256('0x47')][_0xb256('0x50')],_0x5ccac9[_0xb256('0x47')][_0xb256('0x2c')]);return db['VtigerConfiguration'][_0xb256('0x46')](_0x5ccac9[_0xb256('0x47')],{'include':[{'model':db[_0xb256('0x52')],'as':_0xb256('0x4e')},{'model':db[_0xb256('0x52')],'as':'Descriptions'}]});}return null;})[_0xb256('0x3f')](respondWithResult(_0x1c90d2,null))['catch'](handleError(_0x1c90d2,null));};var md5=require('md5');exports['getFields']=function(_0x225331,_0x5b6e02,_0x1fd1ca){var _0x843c63=null;var _0x10cab2=null;var _0x3d13ac=null;var _0x387919=null;var _0x94f253='';return db[_0xb256('0x29')][_0xb256('0x4a')]({'where':{'id':_0x225331[_0xb256('0x45')]['id']},'attributes':['id',_0xb256('0x26'),'username','description','moduleName',_0xb256('0x53'),'serverUrl',_0xb256('0x54')]})[_0xb256('0x3f')](handleEntityNotFound(_0x5b6e02,null))[_0xb256('0x3f')](function(_0x3fdea4){if(_0x3fdea4){_0x843c63=_0x3fdea4['username'];_0x10cab2=_0x3fdea4[_0xb256('0x54')];_0x3d13ac=_0x3fdea4[_0xb256('0x55')];_0x94f253=_0x3fdea4[_0xb256('0x53')];var _0xfd74a2=_0x94f253[_0xb256('0x56')](-0x1);if(_0xfd74a2==='/'){_0x94f253=_0x94f253[_0xb256('0x57')](0x0,_0x94f253[_0xb256('0x58')](_0xfd74a2));}_0x387919=util[_0xb256('0x59')](_0xb256('0x5a'),_0x94f253);var _0x204919={'method':'GET','uri':_0x387919,'qs':{'operation':'getchallenge','username':_0x3fdea4['username']},'json':!![]};return rp(_0x204919);}})[_0xb256('0x3f')](function(_0x5ab95e){if(_0x5ab95e[_0xb256('0x5b')]){var _0x3c9158={'method':_0xb256('0x5c'),'uri':_0x387919,'form':{'operation':_0xb256('0x5d'),'username':_0x843c63,'accessKey':md5(_0x5ab95e['result'][_0xb256('0x5e')]+_0x10cab2)},'json':!![]};return rp(_0x3c9158);}})['then'](function(_0x2df2df){if(_0x2df2df[_0xb256('0x5b')]){var _0x1d91ea={'method':_0xb256('0x5f'),'uri':_0x387919,'qs':{'operation':_0xb256('0x60'),'username':_0x843c63,'sessionName':_0x2df2df['result'][_0xb256('0x61')],'elementType':_0x3d13ac},'json':!![]};return rp(_0x1d91ea);}})[_0xb256('0x3f')](function(_0x4ee907){if(_0x4ee907['success']){var _0x43e986=[_0xb256('0x62'),_0xb256('0x63'),'owner'];_[_0xb256('0x64')](_0x4ee907[_0xb256('0x65')][_0xb256('0x33')],function(_0x400834){return _0x43e986[_0xb256('0x66')](_0x400834[_0xb256('0x2c')][_0xb256('0x26')]);});_[_0xb256('0x64')](_0x4ee907['result'][_0xb256('0x33')],function(_0x3ca8c8){return _0x3ca8c8[_0xb256('0x67')]===_0xb256('0x68');});return{'count':_0x4ee907['result'][_0xb256('0x33')]['length'],'rows':_[_0xb256('0x28')](_0x4ee907[_0xb256('0x65')][_0xb256('0x33')],function(_0x25b55d){return{'id':_0x25b55d[_0xb256('0x26')],'name':_0x25b55d['label'],'custom':_[_0xb256('0x69')](_0x25b55d[_0xb256('0x26')],'cf_')?!![]:![],'options':_0x25b55d[_0xb256('0x2c')][_0xb256('0x26')]===_0xb256('0x6a')&&_0x25b55d[_0xb256('0x2c')][_0xb256('0x6b')][_0xb256('0x35')]>0x0?_[_0xb256('0x28')](_0x25b55d[_0xb256('0x2c')][_0xb256('0x6b')],function(_0x563ac9){return{'name':_0x563ac9[_0xb256('0x6c')],'value':_0x563ac9[_0xb256('0x6d')]};}):[]};})};}})['then'](respondWithResult(_0x5b6e02,null))[_0xb256('0x43')](function(_0x48fec3){console[_0xb256('0x6e')](_0xb256('0x6f')+_0x48fec3);var _0x50ac06=_0x225331[_0xb256('0x2f')]['test']?0x1f4:_0x48fec3['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb256('0x70'),_0x50ac06,JSON['stringify'](_0x48fec3));delete _0x48fec3['name'];if(_0x50ac06===0x191){_0x50ac06=0x190;}_0x5b6e02['status'](_0x50ac06)[_0xb256('0x27')](_0x225331[_0xb256('0x2f')][_0xb256('0x71')]?{'message':_0xb256('0x72'),'statusCode':_0x48fec3[_0xb256('0x73')]}:_0x48fec3);});}; \ No newline at end of file +var _0x1b09=['rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','limit','undefined','count','offset','set','save','update','then','destroy','end','error','stack','name','send','VtigerAccount','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','keys','includeAll','options','find','catch','create','body','params','VtigerConfiguration','order','getConfigurations','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','picklist','picklistValues','label','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format'];(function(_0x992e79,_0x63df74){var _0x1c7ee5=function(_0x4a3a92){while(--_0x4a3a92){_0x992e79['push'](_0x992e79['shift']());}};_0x1c7ee5(++_0x63df74);}(_0x1b09,0xe9));var _0x91b0=function(_0x2caf3a,_0x1d65d6){_0x2caf3a=_0x2caf3a-0x0;var _0x34f044=_0x1b09[_0x2caf3a];return _0x34f044;};'use strict';var emlformat=require(_0x91b0('0x0'));var rimraf=require(_0x91b0('0x1'));var zipdir=require(_0x91b0('0x2'));var jsonpatch=require(_0x91b0('0x3'));var rp=require('request-promise');var moment=require(_0x91b0('0x4'));var BPromise=require(_0x91b0('0x5'));var Mustache=require('mustache');var util=require(_0x91b0('0x6'));var path=require(_0x91b0('0x7'));var sox=require(_0x91b0('0x8'));var csv=require('to-csv');var ejs=require(_0x91b0('0x9'));var fs=require('fs');var fs_extra=require(_0x91b0('0xa'));var _=require(_0x91b0('0xb'));var squel=require('squel');var crypto=require(_0x91b0('0xc'));var jsforce=require(_0x91b0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x91b0('0xe'));var Papa=require(_0x91b0('0xf'));var Redis=require('ioredis');var authService=require(_0x91b0('0x10'));var qs=require(_0x91b0('0x11'));var as=require(_0x91b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91b0('0x13'))(_0x91b0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x91b0('0x15'));var db=require(_0x91b0('0x16'))['db'];var integrations=require(_0x91b0('0x17'));function respondWithStatusCode(_0x520839,_0x54597f){_0x54597f=_0x54597f||0xcc;return function(_0x16a191){if(_0x16a191){return _0x520839[_0x91b0('0x18')](_0x54597f);}return _0x520839[_0x91b0('0x19')](_0x54597f)['end']();};}function respondWithResult(_0x563ade,_0x454e1a){_0x454e1a=_0x454e1a||0xc8;return function(_0xd1296b){if(_0xd1296b){return _0x563ade['status'](_0x454e1a)[_0x91b0('0x1a')](_0xd1296b);}};}function respondWithFilteredResult(_0x11040a,_0x1376af){return function(_0x5b7f6d){if(_0x5b7f6d){var _0x179b23=typeof _0x1376af['offset']==='undefined'&&typeof _0x1376af[_0x91b0('0x1b')]===_0x91b0('0x1c');var _0x121cd9=_0x5b7f6d[_0x91b0('0x1d')];var _0x4b3f5c=_0x179b23?0x0:_0x1376af[_0x91b0('0x1e')];var _0x405c3c=_0x179b23?_0x5b7f6d[_0x91b0('0x1d')]:_0x1376af[_0x91b0('0x1e')]+_0x1376af[_0x91b0('0x1b')];var _0x4e79d5;if(_0x405c3c>=_0x121cd9){_0x405c3c=_0x121cd9;_0x4e79d5=0xc8;}else{_0x4e79d5=0xce;}_0x11040a[_0x91b0('0x19')](_0x4e79d5);return _0x11040a[_0x91b0('0x1f')]('Content-Range',_0x4b3f5c+'-'+_0x405c3c+'/'+_0x121cd9)[_0x91b0('0x1a')](_0x5b7f6d);}return null;};}function patchUpdates(_0x581db1){return function(_0x29c5a7){try{jsonpatch['apply'](_0x29c5a7,_0x581db1,!![]);}catch(_0x18b710){return BPromise['reject'](_0x18b710);}return _0x29c5a7[_0x91b0('0x20')]();};}function saveUpdates(_0x5605e7,_0x25936d){return function(_0x550022){if(_0x550022){return _0x550022[_0x91b0('0x21')](_0x5605e7)[_0x91b0('0x22')](function(_0x265ba0){return _0x265ba0;});}return null;};}function removeEntity(_0x20ddd0,_0x1ea3d5){return function(_0x4d7321){if(_0x4d7321){return _0x4d7321[_0x91b0('0x23')]()[_0x91b0('0x22')](function(){_0x20ddd0[_0x91b0('0x19')](0xcc)[_0x91b0('0x24')]();});}};}function handleEntityNotFound(_0x354adf,_0x2ab7e4){return function(_0x36aa3f){if(!_0x36aa3f){_0x354adf[_0x91b0('0x18')](0x194);}return _0x36aa3f;};}function handleError(_0x667fc9,_0x4cb129){_0x4cb129=_0x4cb129||0x1f4;return function(_0x59d38a){logger[_0x91b0('0x25')](_0x59d38a[_0x91b0('0x26')]);if(_0x59d38a[_0x91b0('0x27')]){delete _0x59d38a[_0x91b0('0x27')];}_0x667fc9[_0x91b0('0x19')](_0x4cb129)[_0x91b0('0x28')](_0x59d38a);};}exports['index']=function(_0x4f4638,_0x575bd9){var _0x51d00f={},_0x4941bd={},_0x587c29={'count':0x0,'rows':[]};var _0x5a97dc=_['map'](db[_0x91b0('0x29')]['rawAttributes'],function(_0x51e298){return{'name':_0x51e298[_0x91b0('0x2a')],'type':_0x51e298[_0x91b0('0x2b')][_0x91b0('0x2c')]};});_0x4941bd[_0x91b0('0x2d')]=_[_0x91b0('0x2e')](_0x5a97dc,_0x91b0('0x27'));_0x4941bd[_0x91b0('0x2f')]=_['keys'](_0x4f4638[_0x91b0('0x2f')]);_0x4941bd[_0x91b0('0x30')]=_['intersection'](_0x4941bd[_0x91b0('0x2d')],_0x4941bd[_0x91b0('0x2f')]);_0x51d00f['attributes']=_[_0x91b0('0x31')](_0x4941bd[_0x91b0('0x2d')],qs[_0x91b0('0x32')](_0x4f4638['query'][_0x91b0('0x32')]));_0x51d00f[_0x91b0('0x33')]=_0x51d00f[_0x91b0('0x33')][_0x91b0('0x34')]?_0x51d00f[_0x91b0('0x33')]:_0x4941bd['model'];if(!_0x4f4638[_0x91b0('0x2f')][_0x91b0('0x35')](_0x91b0('0x36'))){_0x51d00f['limit']=qs[_0x91b0('0x1b')](_0x4f4638['query'][_0x91b0('0x1b')]);_0x51d00f['offset']=qs[_0x91b0('0x1e')](_0x4f4638['query'][_0x91b0('0x1e')]);}_0x51d00f['order']=qs[_0x91b0('0x37')](_0x4f4638['query'][_0x91b0('0x37')]);_0x51d00f[_0x91b0('0x38')]=qs['filters'](_[_0x91b0('0x39')](_0x4f4638['query'],_0x4941bd[_0x91b0('0x30')]),_0x5a97dc);if(_0x4f4638[_0x91b0('0x2f')][_0x91b0('0x3a')]){_0x51d00f['where']=_['merge'](_0x51d00f[_0x91b0('0x38')],{'$or':_['map'](_0x5a97dc,function(_0x4a1f1a){if(_0x4a1f1a[_0x91b0('0x2b')]!==_0x91b0('0x3b')){var _0x33b714={};_0x33b714[_0x4a1f1a[_0x91b0('0x27')]]={'$like':'%'+_0x4f4638[_0x91b0('0x2f')]['filter']+'%'};return _0x33b714;}})});}_0x51d00f=_[_0x91b0('0x3c')]({},_0x51d00f,_0x4f4638['options']);var _0x3497ef={'where':_0x51d00f['where']};return db[_0x91b0('0x29')][_0x91b0('0x1d')](_0x3497ef)[_0x91b0('0x22')](function(_0xb2172c){_0x587c29[_0x91b0('0x1d')]=_0xb2172c;if(_0x4f4638[_0x91b0('0x2f')]['includeAll']){_0x51d00f[_0x91b0('0x3d')]=[{'all':!![]}];}return db[_0x91b0('0x29')][_0x91b0('0x3e')](_0x51d00f);})['then'](function(_0x2d810e){_0x587c29[_0x91b0('0x3f')]=_0x2d810e;return _0x587c29;})[_0x91b0('0x22')](respondWithFilteredResult(_0x575bd9,_0x51d00f))['catch'](handleError(_0x575bd9,null));};exports[_0x91b0('0x40')]=function(_0x5bb724,_0x1c445b){var _0x1c1d35={'raw':![],'where':{'id':_0x5bb724['params']['id']}},_0x5c8221={};_0x5c8221[_0x91b0('0x2d')]=_['keys'](db[_0x91b0('0x29')]['rawAttributes']);_0x5c8221[_0x91b0('0x2f')]=_[_0x91b0('0x41')](_0x5bb724[_0x91b0('0x2f')]);_0x5c8221['filters']=_[_0x91b0('0x31')](_0x5c8221[_0x91b0('0x2d')],_0x5c8221['query']);_0x1c1d35[_0x91b0('0x33')]=_[_0x91b0('0x31')](_0x5c8221[_0x91b0('0x2d')],qs['fields'](_0x5bb724['query'][_0x91b0('0x32')]));_0x1c1d35['attributes']=_0x1c1d35[_0x91b0('0x33')][_0x91b0('0x34')]?_0x1c1d35[_0x91b0('0x33')]:_0x5c8221[_0x91b0('0x2d')];if(_0x5bb724['query'][_0x91b0('0x42')]){_0x1c1d35['include']=[{'all':!![]}];}_0x1c1d35=_[_0x91b0('0x3c')]({},_0x1c1d35,_0x5bb724[_0x91b0('0x43')]);return db[_0x91b0('0x29')][_0x91b0('0x44')](_0x1c1d35)[_0x91b0('0x22')](handleEntityNotFound(_0x1c445b,null))[_0x91b0('0x22')](respondWithResult(_0x1c445b,null))[_0x91b0('0x45')](handleError(_0x1c445b,null));};exports[_0x91b0('0x46')]=function(_0x2a9067,_0xd3b41b){return db[_0x91b0('0x29')]['create'](_0x2a9067[_0x91b0('0x47')],{})[_0x91b0('0x22')](respondWithResult(_0xd3b41b,0xc9))[_0x91b0('0x45')](handleError(_0xd3b41b,null));};exports['update']=function(_0x39fee6,_0x315023){if(_0x39fee6[_0x91b0('0x47')]['id']){delete _0x39fee6[_0x91b0('0x47')]['id'];}return db['VtigerAccount'][_0x91b0('0x44')]({'where':{'id':_0x39fee6['params']['id']}})[_0x91b0('0x22')](handleEntityNotFound(_0x315023,null))[_0x91b0('0x22')](saveUpdates(_0x39fee6[_0x91b0('0x47')],null))[_0x91b0('0x22')](respondWithResult(_0x315023,null))['catch'](handleError(_0x315023,null));};exports[_0x91b0('0x23')]=function(_0x3ae925,_0x482a2a){return db[_0x91b0('0x29')]['find']({'where':{'id':_0x3ae925[_0x91b0('0x48')]['id']}})['then'](handleEntityNotFound(_0x482a2a,null))[_0x91b0('0x22')](removeEntity(_0x482a2a,null))['catch'](handleError(_0x482a2a,null));};exports['getConfigurations']=function(_0x3c87d5,_0x3cf895,_0x5286b6){var _0x4a7381={};var _0x3e70b4={};var _0x4fb7b5;var _0x6f9672;return db[_0x91b0('0x29')]['findOne']({'where':{'id':_0x3c87d5[_0x91b0('0x48')]['id']}})[_0x91b0('0x22')](handleEntityNotFound(_0x3cf895,null))['then'](function(_0x194730){if(_0x194730){_0x4fb7b5=_0x194730;_0x3e70b4[_0x91b0('0x2d')]=_[_0x91b0('0x41')](db[_0x91b0('0x49')]['rawAttributes']);_0x3e70b4[_0x91b0('0x2f')]=_[_0x91b0('0x41')](_0x3c87d5[_0x91b0('0x2f')]);_0x3e70b4[_0x91b0('0x30')]=_['intersection'](_0x3e70b4[_0x91b0('0x2d')],_0x3e70b4[_0x91b0('0x2f')]);_0x4a7381[_0x91b0('0x33')]=_[_0x91b0('0x31')](_0x3e70b4['model'],qs[_0x91b0('0x32')](_0x3c87d5[_0x91b0('0x2f')][_0x91b0('0x32')]));_0x4a7381[_0x91b0('0x33')]=_0x4a7381[_0x91b0('0x33')][_0x91b0('0x34')]?_0x4a7381['attributes']:_0x3e70b4[_0x91b0('0x2d')];_0x4a7381[_0x91b0('0x4a')]=qs[_0x91b0('0x37')](_0x3c87d5['query'][_0x91b0('0x37')]);_0x4a7381[_0x91b0('0x38')]=qs[_0x91b0('0x30')](_[_0x91b0('0x39')](_0x3c87d5['query'],_0x3e70b4[_0x91b0('0x30')]));if(_0x3c87d5['query'][_0x91b0('0x3a')]){_0x4a7381[_0x91b0('0x38')]=_['merge'](_0x4a7381[_0x91b0('0x38')],{'$or':_[_0x91b0('0x2e')](_0x4a7381[_0x91b0('0x33')],function(_0x12cdec){var _0x1044e4={};_0x1044e4[_0x12cdec]={'$like':'%'+_0x3c87d5[_0x91b0('0x2f')][_0x91b0('0x3a')]+'%'};return _0x1044e4;})});}_0x4a7381=_[_0x91b0('0x3c')]({},_0x4a7381,_0x3c87d5[_0x91b0('0x43')]);return _0x4fb7b5[_0x91b0('0x4b')](_0x4a7381);}})[_0x91b0('0x22')](function(_0x3f8fe8){if(_0x3f8fe8){_0x6f9672=_0x3f8fe8[_0x91b0('0x34')];if(!_0x3c87d5[_0x91b0('0x2f')][_0x91b0('0x35')]('nolimit')){_0x4a7381['limit']=qs[_0x91b0('0x1b')](_0x3c87d5[_0x91b0('0x2f')]['limit']);_0x4a7381[_0x91b0('0x1e')]=qs[_0x91b0('0x1e')](_0x3c87d5['query'][_0x91b0('0x1e')]);}return _0x4fb7b5['getConfigurations'](_0x4a7381);}})['then'](function(_0xafa82a){if(_0xafa82a){return _0xafa82a?{'count':_0x6f9672,'rows':_0xafa82a}:null;}})[_0x91b0('0x22')](respondWithResult(_0x3cf895,null))[_0x91b0('0x45')](handleError(_0x3cf895,null));};exports['addConfiguration']=function(_0x551a2c,_0x3a82ea,_0x3ca908){if(_0x551a2c['body']['id']){delete _0x551a2c[_0x91b0('0x47')]['id'];}return db[_0x91b0('0x29')][_0x91b0('0x4c')]({'where':{'id':_0x551a2c[_0x91b0('0x48')]['id']}})[_0x91b0('0x22')](handleEntityNotFound(_0x3a82ea,null))[_0x91b0('0x22')](function(_0x294776){if(_0x294776){_0x551a2c[_0x91b0('0x47')][_0x91b0('0x4d')]=_0x294776['id'];_0x551a2c['body'][_0x91b0('0x4e')]=integrations[_0x91b0('0x4f')](_0x551a2c[_0x91b0('0x47')]['channel'],_0x551a2c[_0x91b0('0x47')][_0x91b0('0x2b')]);_0x551a2c['body'][_0x91b0('0x50')]=integrations[_0x91b0('0x51')](_0x551a2c[_0x91b0('0x47')]['channel'],_0x551a2c[_0x91b0('0x47')][_0x91b0('0x2b')]);return db[_0x91b0('0x49')][_0x91b0('0x46')](_0x551a2c[_0x91b0('0x47')],{'include':[{'model':db[_0x91b0('0x52')],'as':_0x91b0('0x4e')},{'model':db[_0x91b0('0x52')],'as':_0x91b0('0x50')}]});}return null;})['then'](respondWithResult(_0x3a82ea,null))['catch'](handleError(_0x3a82ea,null));};var md5=require(_0x91b0('0x53'));exports[_0x91b0('0x54')]=function(_0x2a92e0,_0x13c675,_0x2b247f){var _0x137c33=null;var _0x21d3bb=null;var _0x514f51=null;var _0x2eec15=null;var _0x29c8ed='';return db[_0x91b0('0x29')][_0x91b0('0x4c')]({'where':{'id':_0x2a92e0[_0x91b0('0x48')]['id']},'attributes':['id',_0x91b0('0x27'),_0x91b0('0x55'),_0x91b0('0x56'),_0x91b0('0x57'),_0x91b0('0x58'),_0x91b0('0x59'),_0x91b0('0x5a')]})[_0x91b0('0x22')](handleEntityNotFound(_0x13c675,null))[_0x91b0('0x22')](function(_0x5aeba0){if(_0x5aeba0){_0x137c33=_0x5aeba0[_0x91b0('0x55')];_0x21d3bb=_0x5aeba0[_0x91b0('0x5a')];_0x514f51=_0x5aeba0[_0x91b0('0x57')];_0x29c8ed=_0x5aeba0[_0x91b0('0x58')];var _0x203bb4=_0x29c8ed[_0x91b0('0x5b')](-0x1);if(_0x203bb4==='/'){_0x29c8ed=_0x29c8ed[_0x91b0('0x5c')](0x0,_0x29c8ed[_0x91b0('0x5d')](_0x203bb4));}_0x2eec15=util[_0x91b0('0x5e')](_0x91b0('0x5f'),_0x29c8ed);var _0x263a13={'method':_0x91b0('0x60'),'uri':_0x2eec15,'qs':{'operation':'getchallenge','username':_0x5aeba0['username']},'json':!![]};return rp(_0x263a13);}})['then'](function(_0x45faec){if(_0x45faec[_0x91b0('0x61')]){var _0x47783e={'method':'POST','uri':_0x2eec15,'form':{'operation':'login','username':_0x137c33,'accessKey':md5(_0x45faec[_0x91b0('0x62')][_0x91b0('0x63')]+_0x21d3bb)},'json':!![]};return rp(_0x47783e);}})[_0x91b0('0x22')](function(_0x9d219d){if(_0x9d219d[_0x91b0('0x61')]){var _0x75d2e1={'method':_0x91b0('0x60'),'uri':_0x2eec15,'qs':{'operation':_0x91b0('0x64'),'username':_0x137c33,'sessionName':_0x9d219d[_0x91b0('0x62')][_0x91b0('0x65')],'elementType':_0x514f51},'json':!![]};return rp(_0x75d2e1);}})[_0x91b0('0x22')](function(_0x3e036a){if(_0x3e036a[_0x91b0('0x61')]){var _0x4ba9b2=[_0x91b0('0x66'),_0x91b0('0x67'),'owner'];_[_0x91b0('0x68')](_0x3e036a['result']['fields'],function(_0x46fd85){return _0x4ba9b2[_0x91b0('0x69')](_0x46fd85[_0x91b0('0x2b')][_0x91b0('0x27')]);});_['remove'](_0x3e036a[_0x91b0('0x62')][_0x91b0('0x32')],function(_0x1b4405){return _0x1b4405[_0x91b0('0x6a')]==='false';});return{'count':_0x3e036a[_0x91b0('0x62')][_0x91b0('0x32')][_0x91b0('0x34')],'rows':_['map'](_0x3e036a[_0x91b0('0x62')][_0x91b0('0x32')],function(_0x3fea86){return{'id':_0x3fea86[_0x91b0('0x27')],'name':_0x3fea86['label'],'custom':_['startsWith'](_0x3fea86[_0x91b0('0x27')],'cf_')?!![]:![],'options':_0x3fea86[_0x91b0('0x2b')][_0x91b0('0x27')]===_0x91b0('0x6b')&&_0x3fea86[_0x91b0('0x2b')][_0x91b0('0x6c')][_0x91b0('0x34')]>0x0?_['map'](_0x3fea86[_0x91b0('0x2b')][_0x91b0('0x6c')],function(_0x416b1a){return{'name':_0x416b1a[_0x91b0('0x6d')],'value':_0x416b1a['value']};}):[]};})};}})[_0x91b0('0x22')](respondWithResult(_0x13c675,null))['catch'](function(_0x543d16){console[_0x91b0('0x6e')](_0x91b0('0x6f')+_0x543d16);var _0x201ff4=_0x2a92e0[_0x91b0('0x2f')]['test']?0x1f4:_0x543d16[_0x91b0('0x70')]||0x1f4;logger[_0x91b0('0x25')](_0x91b0('0x71'),_0x91b0('0x54'),_0x201ff4,JSON[_0x91b0('0x72')](_0x543d16));delete _0x543d16[_0x91b0('0x27')];if(_0x201ff4===0x191){_0x201ff4=0x190;}_0x13c675['status'](_0x201ff4)[_0x91b0('0x28')](_0x2a92e0[_0x91b0('0x2f')][_0x91b0('0x73')]?{'message':_0x91b0('0x74'),'statusCode':_0x543d16[_0x91b0('0x70')]}:_0x543d16);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index a81529a..fc95c79 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 _0xd774=['./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xd774,0x122));var _0x4d77=function(_0x47f418,_0x11d15e){_0x47f418=_0x47f418-0x0;var _0x131dd6=_0xd774[_0x47f418];return _0x131dd6;};'use strict';var _=require(_0x4d77('0x0'));var util=require(_0x4d77('0x1'));var logger=require(_0x4d77('0x2'))(_0x4d77('0x3'));var moment=require(_0x4d77('0x4'));var BPromise=require(_0x4d77('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d77('0x6'));var config=require('../../config/environment');var attributes=require(_0x4d77('0x7'));var integrations=require(_0x4d77('0x8'));module['exports']=function(_0x5e22ba,_0x5dc1af){return _0x5e22ba['define'](_0x4d77('0x9'),attributes,{'tableName':_0x4d77('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14d5=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x11c7b4,_0x32b5b7){var _0xaaeff8=function(_0x3d84b8){while(--_0x3d84b8){_0x11c7b4['push'](_0x11c7b4['shift']());}};_0xaaeff8(++_0x32b5b7);}(_0x14d5,0xa2));var _0x514d=function(_0x3e3d0a,_0x4745dd){_0x3e3d0a=_0x3e3d0a-0x0;var _0x3fc765=_0x14d5[_0x3e3d0a];return _0x3fc765;};'use strict';var _=require('lodash');var util=require(_0x514d('0x0'));var logger=require(_0x514d('0x1'))(_0x514d('0x2'));var moment=require(_0x514d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x514d('0x4'));var rimraf=require(_0x514d('0x5'));var config=require(_0x514d('0x6'));var attributes=require(_0x514d('0x7'));var integrations=require(_0x514d('0x8'));module[_0x514d('0x9')]=function(_0x363fec,_0x5b8cfa){return _0x363fec[_0x514d('0xa')](_0x514d('0xb'),attributes,{'tableName':_0x514d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index b82fe53..ee5aeb6 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 _0x1c7c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','limit','include','map','model','attributes','ShowVtigerAccount','raw','lodash','util','moment','bluebird'];(function(_0x5daefc,_0x213300){var _0x5f126f=function(_0xa7a198){while(--_0xa7a198){_0x5daefc['push'](_0x5daefc['shift']());}};_0x5f126f(++_0x213300);}(_0x1c7c,0x164));var _0xc1c7=function(_0x3ce9fd,_0x387f73){_0x3ce9fd=_0x3ce9fd-0x0;var _0x27ed12=_0x1c7c[_0x3ce9fd];return _0x27ed12;};'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')]({'raw':_0xb42702[_0xc1c7('0x1b')]?_0xb42702[_0xc1c7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xb42702[_0xc1c7('0x1b')]?_0xb42702['options'][_0xc1c7('0x1c')]||null:null,'attributes':_0xb42702[_0xc1c7('0x1b')]?_0xb42702['options']['attributes']||null:null,'limit':_0xb42702[_0xc1c7('0x1b')]?_0xb42702[_0xc1c7('0x1b')][_0xc1c7('0x1d')]||null:null,'include':_0xb42702['options']?_0xb42702[_0xc1c7('0x1b')][_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0xb42702[_0xc1c7('0x1b')][_0xc1c7('0x1e')],function(_0x3a2483){return{'model':db[_0x3a2483[_0xc1c7('0x20')]],'as':_0x3a2483['as'],'attributes':_0x3a2483[_0xc1c7('0x21')],'include':_0x3a2483[_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x3a2483[_0xc1c7('0x1e')],function(_0x363fbc){return{'model':db[_0x363fbc[_0xc1c7('0x20')]],'as':_0x363fbc['as'],'attributes':_0x363fbc[_0xc1c7('0x21')],'include':_0x363fbc[_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x363fbc['include'],function(_0xf0ab9c){return{'model':db[_0xf0ab9c[_0xc1c7('0x20')]],'as':_0xf0ab9c['as'],'attributes':_0xf0ab9c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x352f24){logger['info']('GetVtigerAccount',_0xb42702);logger[_0xc1c7('0x10')](_0xc1c7('0x18'),_0xb42702,JSON[_0xc1c7('0x12')](_0x352f24));_0x2e93e5(_0x352f24);})[_0xc1c7('0x17')](function(_0x461360){logger['error']('GetVtigerAccount',_0x461360[_0xc1c7('0x14')],_0xb42702);_0x5d44e9(_0x21758a[_0xc1c7('0x13')](0x1f4,_0x461360[_0xc1c7('0x14')]));});});};exports[_0xc1c7('0x22')]=function(_0x2e35f1){var _0x4968b0=this;return new Promise(function(_0x50042f,_0x125920){return db[_0xc1c7('0x19')]['find']({'raw':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x23')]===undefined?!![]:![]:!![],'where':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x1c')]||null:null,'attributes':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1['options'][_0xc1c7('0x21')]||null:null,'include':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x1e')],function(_0xef703f){return{'model':db[_0xef703f[_0xc1c7('0x20')]],'as':_0xef703f['as'],'attributes':_0xef703f['attributes'],'include':_0xef703f['include']?_[_0xc1c7('0x1f')](_0xef703f[_0xc1c7('0x1e')],function(_0x263900){return{'model':db[_0x263900[_0xc1c7('0x20')]],'as':_0x263900['as'],'attributes':_0x263900[_0xc1c7('0x21')],'include':_0x263900[_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x263900[_0xc1c7('0x1e')],function(_0x3bd3b0){return{'model':db[_0x3bd3b0[_0xc1c7('0x20')]],'as':_0x3bd3b0['as'],'attributes':_0x3bd3b0[_0xc1c7('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc1c7('0xd')](function(_0x154476){logger[_0xc1c7('0xe')](_0xc1c7('0x22'),_0x2e35f1);logger[_0xc1c7('0x10')](_0xc1c7('0x22'),_0x2e35f1,JSON[_0xc1c7('0x12')](_0x154476));_0x50042f(_0x154476);})[_0xc1c7('0x17')](function(_0x239a91){logger[_0xc1c7('0x13')]('ShowVtigerAccount',_0x239a91['message'],_0x2e35f1);_0x125920(_0x4968b0['error'](0x1f4,_0x239a91[_0xc1c7('0x14')]));});});}; \ No newline at end of file +var _0xf45e=['options','raw','where','attributes','limit','include','model','map','VtigerAccount','find','ShowVtigerAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','findAll'];(function(_0x5fcf82,_0x582e33){var _0x4b312e=function(_0x1a84b5){while(--_0x1a84b5){_0x5fcf82['push'](_0x5fcf82['shift']());}};_0x4b312e(++_0x582e33);}(_0xf45e,0x115));var _0xef45=function(_0x57d2bf,_0x3858a7){_0x57d2bf=_0x57d2bf-0x0;var _0x56140d=_0xf45e[_0x57d2bf];return _0x56140d;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});}exports[_0xef45('0x19')]=function(_0x219778){var _0x3ba1f4=this;return new Promise(function(_0x258785,_0x4ca902){return db['VtigerAccount'][_0xef45('0x1a')]({'raw':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1c')]===undefined?!![]:![]:!![],'where':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x219778['options']?_0x219778[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'limit':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1f')]||null:null,'include':_0x219778['options']?_0x219778[_0xef45('0x1b')]['include']?_['map'](_0x219778[_0xef45('0x1b')][_0xef45('0x20')],function(_0xbb859b){return{'model':db[_0xbb859b[_0xef45('0x21')]],'as':_0xbb859b['as'],'attributes':_0xbb859b[_0xef45('0x1e')],'include':_0xbb859b[_0xef45('0x20')]?_[_0xef45('0x22')](_0xbb859b['include'],function(_0x208b35){return{'model':db[_0x208b35['model']],'as':_0x208b35['as'],'attributes':_0x208b35[_0xef45('0x1e')],'include':_0x208b35[_0xef45('0x20')]?_['map'](_0x208b35[_0xef45('0x20')],function(_0x2c356d){return{'model':db[_0x2c356d['model']],'as':_0x2c356d['as'],'attributes':_0x2c356d[_0xef45('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550e18){logger['info']('GetVtigerAccount',_0x219778);logger[_0xef45('0x10')](_0xef45('0x19'),_0x219778,JSON[_0xef45('0x12')](_0x550e18));_0x258785(_0x550e18);})[_0xef45('0x18')](function(_0x5782d0){logger[_0xef45('0x13')]('GetVtigerAccount',_0x5782d0[_0xef45('0x16')],_0x219778);_0x4ca902(_0x3ba1f4['error'](0x1f4,_0x5782d0[_0xef45('0x16')]));});});};exports['ShowVtigerAccount']=function(_0x575734){var _0x14ce5a=this;return new Promise(function(_0x3e45de,_0x390a7a){return db[_0xef45('0x23')][_0xef45('0x24')]({'raw':_0x575734['options']?_0x575734['options']['raw']===undefined?!![]:![]:!![],'where':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'include':_0x575734[_0xef45('0x1b')]?_0x575734['options']['include']?_[_0xef45('0x22')](_0x575734['options'][_0xef45('0x20')],function(_0x5116b0){return{'model':db[_0x5116b0[_0xef45('0x21')]],'as':_0x5116b0['as'],'attributes':_0x5116b0[_0xef45('0x1e')],'include':_0x5116b0[_0xef45('0x20')]?_[_0xef45('0x22')](_0x5116b0[_0xef45('0x20')],function(_0x5b7d73){return{'model':db[_0x5b7d73[_0xef45('0x21')]],'as':_0x5b7d73['as'],'attributes':_0x5b7d73[_0xef45('0x1e')],'include':_0x5b7d73[_0xef45('0x20')]?_['map'](_0x5b7d73['include'],function(_0x787387){return{'model':db[_0x787387[_0xef45('0x21')]],'as':_0x787387['as'],'attributes':_0x787387['attributes']};}):[]};}):[]};}):[]:[]})[_0xef45('0xd')](function(_0x501eb3){logger['info'](_0xef45('0x25'),_0x575734);logger[_0xef45('0x10')](_0xef45('0x25'),_0x575734,JSON['stringify'](_0x501eb3));_0x3e45de(_0x501eb3);})[_0xef45('0x18')](function(_0x3a1bcc){logger[_0xef45('0x13')](_0xef45('0x25'),_0x3a1bcc['message'],_0x575734);_0x390a7a(_0x14ce5a['error'](0x1f4,_0x3a1bcc[_0xef45('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 529e012..8bd14dd 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 _0x4b04=['multer','util','Router','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','/:id','delete','destroy','exports'];(function(_0x34f0fb,_0x1a69b6){var _0x73790=function(_0xdeeb68){while(--_0xdeeb68){_0x34f0fb['push'](_0x34f0fb['shift']());}};_0x73790(++_0x1a69b6);}(_0x4b04,0x17a));var _0x44b0=function(_0xb65be,_0x269947){_0xb65be=_0xb65be-0x0;var _0x2200dc=_0x4b04[_0xb65be];return _0x2200dc;};'use strict';var multer=require(_0x44b0('0x0'));var util=require(_0x44b0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x44b0('0x2')]();var fs_extra=require(_0x44b0('0x3'));var auth=require(_0x44b0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x44b0('0x5'));router[_0x44b0('0x6')]('/',auth['isAuthenticated'](),controller[_0x44b0('0x7')]);router[_0x44b0('0x6')]('/:id',auth[_0x44b0('0x8')](),controller[_0x44b0('0x9')]);router[_0x44b0('0x6')](_0x44b0('0xa'),auth['isAuthenticated'](),controller[_0x44b0('0xb')]);router[_0x44b0('0x6')](_0x44b0('0xc'),auth[_0x44b0('0x8')](),controller['getSubjects']);router[_0x44b0('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x44b0('0xd')]);router[_0x44b0('0xe')]('/',auth[_0x44b0('0x8')](),controller[_0x44b0('0xf')]);router[_0x44b0('0x10')](_0x44b0('0x11'),auth[_0x44b0('0x8')](),controller['update']);router[_0x44b0('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x44b0('0x13')]);module[_0x44b0('0x14')]=router; \ No newline at end of file +var _0x35bb=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields'];(function(_0x18b3ad,_0x2a0be7){var _0x23057a=function(_0x3a1d84){while(--_0x3a1d84){_0x18b3ad['push'](_0x18b3ad['shift']());}};_0x23057a(++_0x2a0be7);}(_0x35bb,0x1be));var _0xb35b=function(_0x250ddb,_0x367099){_0x250ddb=_0x250ddb-0x0;var _0x150e54=_0x35bb[_0x250ddb];return _0x150e54;};'use strict';var multer=require(_0xb35b('0x0'));var util=require(_0xb35b('0x1'));var path=require('path');var timeout=require(_0xb35b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb35b('0x3'));var auth=require(_0xb35b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb35b('0x5'));var controller=require(_0xb35b('0x6'));router[_0xb35b('0x7')]('/',auth['isAuthenticated'](),controller[_0xb35b('0x8')]);router[_0xb35b('0x7')](_0xb35b('0x9'),auth['isAuthenticated'](),controller[_0xb35b('0xa')]);router[_0xb35b('0x7')](_0xb35b('0xb'),auth[_0xb35b('0xc')](),controller[_0xb35b('0xd')]);router[_0xb35b('0x7')](_0xb35b('0xe'),auth[_0xb35b('0xc')](),controller[_0xb35b('0xf')]);router['get'](_0xb35b('0x10'),auth[_0xb35b('0xc')](),controller[_0xb35b('0x11')]);router['post']('/',auth[_0xb35b('0xc')](),controller[_0xb35b('0x12')]);router[_0xb35b('0x13')](_0xb35b('0x9'),auth[_0xb35b('0xc')](),controller[_0xb35b('0x14')]);router['delete'](_0xb35b('0x9'),auth[_0xb35b('0xc')](),controller[_0xb35b('0x15')]);module[_0xb35b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index a99b6a8..fcb75e1 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 _0xa0fb=['exports','sequelize'];(function(_0x32a1eb,_0x43c306){var _0x2944b1=function(_0x35594d){while(--_0x35594d){_0x32a1eb['push'](_0x32a1eb['shift']());}};_0x2944b1(++_0x43c306);}(_0xa0fb,0x105));var _0xba0f=function(_0x158a35,_0xae92e5){_0x158a35=_0x158a35-0x0;var _0x375dbd=_0xa0fb[_0x158a35];return _0x375dbd;};'use strict';var Sequelize=require(_0xba0f('0x0'));module[_0xba0f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7806=['STRING'];(function(_0xe8f3bc,_0x12985f){var _0x4d1fe2=function(_0xd4eb9a){while(--_0xd4eb9a){_0xe8f3bc['push'](_0xe8f3bc['shift']());}};_0x4d1fe2(++_0x12985f);}(_0x7806,0x1a4));var _0x6780=function(_0x27fd07,_0x49b532){_0x27fd07=_0x27fd07-0x0;var _0x253e18=_0x7806[_0x27fd07];return _0x253e18;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6780('0x0')]},'description':{'type':Sequelize[_0x6780('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4649aa3..c8b6f8a 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 _0x9d86=['show','include','create','body','params','find','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch'];(function(_0x3547ac,_0x4d7e59){var _0x5ac6ff=function(_0x1d1b79){while(--_0x1d1b79){_0x3547ac['push'](_0x3547ac['shift']());}};_0x5ac6ff(++_0x4d7e59);}(_0x9d86,0x1a5));var _0x69d8=function(_0x2b9ef0,_0x475182){_0x2b9ef0=_0x2b9ef0-0x0;var _0x26f42c=_0x9d86[_0x2b9ef0];return _0x26f42c;};'use strict';var emlformat=require(_0x69d8('0x0'));var rimraf=require(_0x69d8('0x1'));var zipdir=require(_0x69d8('0x2'));var jsonpatch=require(_0x69d8('0x3'));var rp=require(_0x69d8('0x4'));var moment=require(_0x69d8('0x5'));var BPromise=require(_0x69d8('0x6'));var Mustache=require(_0x69d8('0x7'));var util=require(_0x69d8('0x8'));var path=require(_0x69d8('0x9'));var sox=require(_0x69d8('0xa'));var csv=require(_0x69d8('0xb'));var ejs=require(_0x69d8('0xc'));var fs=require('fs');var fs_extra=require(_0x69d8('0xd'));var _=require(_0x69d8('0xe'));var squel=require('squel');var crypto=require(_0x69d8('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x69d8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x69d8('0x11'));var Papa=require(_0x69d8('0x12'));var Redis=require(_0x69d8('0x13'));var authService=require(_0x69d8('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x69d8('0x15'));var hardwareService=require(_0x69d8('0x16'));var logger=require(_0x69d8('0x17'))(_0x69d8('0x18'));var utils=require(_0x69d8('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x69d8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x309f34,_0x38e924){_0x38e924=_0x38e924||0xcc;return function(_0x51f93f){if(_0x51f93f){return _0x309f34[_0x69d8('0x1b')](_0x38e924);}return _0x309f34[_0x69d8('0x1c')](_0x38e924)[_0x69d8('0x1d')]();};}function respondWithResult(_0x5de503,_0x90227f){_0x90227f=_0x90227f||0xc8;return function(_0x370bf4){if(_0x370bf4){return _0x5de503[_0x69d8('0x1c')](_0x90227f)[_0x69d8('0x1e')](_0x370bf4);}};}function respondWithFilteredResult(_0x142899,_0x2bc71f){return function(_0x1a2874){if(_0x1a2874){var _0xeab49e=typeof _0x2bc71f[_0x69d8('0x1f')]==='undefined'&&typeof _0x2bc71f[_0x69d8('0x20')]==='undefined';var _0x414979=_0x1a2874[_0x69d8('0x21')];var _0x2c94b5=_0xeab49e?0x0:_0x2bc71f[_0x69d8('0x1f')];var _0x4cdcf4=_0xeab49e?_0x1a2874['count']:_0x2bc71f['offset']+_0x2bc71f[_0x69d8('0x20')];var _0x48adfb;if(_0x4cdcf4>=_0x414979){_0x4cdcf4=_0x414979;_0x48adfb=0xc8;}else{_0x48adfb=0xce;}_0x142899[_0x69d8('0x1c')](_0x48adfb);return _0x142899[_0x69d8('0x22')]('Content-Range',_0x2c94b5+'-'+_0x4cdcf4+'/'+_0x414979)[_0x69d8('0x1e')](_0x1a2874);}return null;};}function patchUpdates(_0x1e2c7b){return function(_0x5a4453){try{jsonpatch[_0x69d8('0x23')](_0x5a4453,_0x1e2c7b,!![]);}catch(_0x20391e){return BPromise[_0x69d8('0x24')](_0x20391e);}return _0x5a4453[_0x69d8('0x25')]();};}function saveUpdates(_0x556496,_0x354b80){return function(_0x5885c3){if(_0x5885c3){return _0x5885c3[_0x69d8('0x26')](_0x556496)[_0x69d8('0x27')](function(_0x1cab68){return _0x1cab68;});}return null;};}function removeEntity(_0x5c76bf,_0x2a7a3e){return function(_0x381551){if(_0x381551){return _0x381551[_0x69d8('0x28')]()['then'](function(){_0x5c76bf[_0x69d8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58a88c,_0x14b259){return function(_0x3cfcac){if(!_0x3cfcac){_0x58a88c[_0x69d8('0x1b')](0x194);}return _0x3cfcac;};}function handleError(_0x3833a4,_0x48a7c7){_0x48a7c7=_0x48a7c7||0x1f4;return function(_0x8c7160){logger[_0x69d8('0x29')](_0x8c7160[_0x69d8('0x2a')]);if(_0x8c7160['name']){delete _0x8c7160[_0x69d8('0x2b')];}_0x3833a4[_0x69d8('0x1c')](_0x48a7c7)[_0x69d8('0x2c')](_0x8c7160);};}exports['index']=function(_0x20f0d4,_0x56eabb){var _0x4508eb={},_0x196e70={},_0x7466c0={'count':0x0,'rows':[]};var _0x1b50f3=_[_0x69d8('0x2d')](db[_0x69d8('0x2e')][_0x69d8('0x2f')],function(_0x573d08){return{'name':_0x573d08[_0x69d8('0x30')],'type':_0x573d08[_0x69d8('0x31')][_0x69d8('0x32')]};});_0x196e70['model']=_[_0x69d8('0x2d')](_0x1b50f3,_0x69d8('0x2b'));_0x196e70[_0x69d8('0x33')]=_[_0x69d8('0x34')](_0x20f0d4['query']);_0x196e70[_0x69d8('0x35')]=_['intersection'](_0x196e70[_0x69d8('0x36')],_0x196e70['query']);_0x4508eb['attributes']=_[_0x69d8('0x37')](_0x196e70[_0x69d8('0x36')],qs['fields'](_0x20f0d4[_0x69d8('0x33')][_0x69d8('0x38')]));_0x4508eb['attributes']=_0x4508eb[_0x69d8('0x39')][_0x69d8('0x3a')]?_0x4508eb[_0x69d8('0x39')]:_0x196e70[_0x69d8('0x36')];if(!_0x20f0d4[_0x69d8('0x33')][_0x69d8('0x3b')](_0x69d8('0x3c'))){_0x4508eb[_0x69d8('0x20')]=qs[_0x69d8('0x20')](_0x20f0d4[_0x69d8('0x33')][_0x69d8('0x20')]);_0x4508eb[_0x69d8('0x1f')]=qs[_0x69d8('0x1f')](_0x20f0d4['query'][_0x69d8('0x1f')]);}_0x4508eb[_0x69d8('0x3d')]=qs[_0x69d8('0x3e')](_0x20f0d4['query'][_0x69d8('0x3e')]);_0x4508eb[_0x69d8('0x3f')]=qs[_0x69d8('0x35')](_[_0x69d8('0x40')](_0x20f0d4['query'],_0x196e70[_0x69d8('0x35')]),_0x1b50f3);if(_0x20f0d4[_0x69d8('0x33')]['filter']){_0x4508eb['where']=_[_0x69d8('0x41')](_0x4508eb['where'],{'$or':_[_0x69d8('0x2d')](_0x1b50f3,function(_0x4138e3){if(_0x4138e3[_0x69d8('0x31')]!==_0x69d8('0x42')){var _0x36f349={};_0x36f349[_0x4138e3[_0x69d8('0x2b')]]={'$like':'%'+_0x20f0d4[_0x69d8('0x33')][_0x69d8('0x43')]+'%'};return _0x36f349;}})});}_0x4508eb=_['merge']({},_0x4508eb,_0x20f0d4[_0x69d8('0x44')]);var _0x1e7bb0={'where':_0x4508eb[_0x69d8('0x3f')]};return db[_0x69d8('0x2e')][_0x69d8('0x21')](_0x1e7bb0)[_0x69d8('0x27')](function(_0x31b89d){_0x7466c0['count']=_0x31b89d;if(_0x20f0d4[_0x69d8('0x33')]['includeAll']){_0x4508eb['include']=[{'all':!![]}];}return db[_0x69d8('0x2e')]['findAll'](_0x4508eb);})[_0x69d8('0x27')](function(_0x5e2fe5){_0x7466c0[_0x69d8('0x45')]=_0x5e2fe5;return _0x7466c0;})[_0x69d8('0x27')](respondWithFilteredResult(_0x56eabb,_0x4508eb))[_0x69d8('0x46')](handleError(_0x56eabb,null));};exports[_0x69d8('0x47')]=function(_0x789b18,_0x2f4b2f){var _0x2943b7={'raw':![],'where':{'id':_0x789b18['params']['id']}},_0x49e1e3={};_0x49e1e3[_0x69d8('0x36')]=_[_0x69d8('0x34')](db[_0x69d8('0x2e')][_0x69d8('0x2f')]);_0x49e1e3[_0x69d8('0x33')]=_[_0x69d8('0x34')](_0x789b18[_0x69d8('0x33')]);_0x49e1e3[_0x69d8('0x35')]=_[_0x69d8('0x37')](_0x49e1e3[_0x69d8('0x36')],_0x49e1e3[_0x69d8('0x33')]);_0x2943b7[_0x69d8('0x39')]=_[_0x69d8('0x37')](_0x49e1e3['model'],qs[_0x69d8('0x38')](_0x789b18[_0x69d8('0x33')][_0x69d8('0x38')]));_0x2943b7[_0x69d8('0x39')]=_0x2943b7[_0x69d8('0x39')]['length']?_0x2943b7[_0x69d8('0x39')]:_0x49e1e3[_0x69d8('0x36')];if(_0x789b18[_0x69d8('0x33')]['includeAll']){_0x2943b7[_0x69d8('0x48')]=[{'all':!![]}];}_0x2943b7=_[_0x69d8('0x41')]({},_0x2943b7,_0x789b18[_0x69d8('0x44')]);return db[_0x69d8('0x2e')]['find'](_0x2943b7)[_0x69d8('0x27')](handleEntityNotFound(_0x2f4b2f,null))[_0x69d8('0x27')](respondWithResult(_0x2f4b2f,null))[_0x69d8('0x46')](handleError(_0x2f4b2f,null));};exports['create']=function(_0x56bc71,_0x5e5b12){return db[_0x69d8('0x2e')][_0x69d8('0x49')](_0x56bc71['body'],{})[_0x69d8('0x27')](respondWithResult(_0x5e5b12,0xc9))['catch'](handleError(_0x5e5b12,null));};exports[_0x69d8('0x26')]=function(_0x3af55e,_0xaeec1e){if(_0x3af55e[_0x69d8('0x4a')]['id']){delete _0x3af55e['body']['id'];}return db[_0x69d8('0x2e')]['find']({'where':{'id':_0x3af55e[_0x69d8('0x4b')]['id']}})[_0x69d8('0x27')](handleEntityNotFound(_0xaeec1e,null))[_0x69d8('0x27')](saveUpdates(_0x3af55e[_0x69d8('0x4a')],null))[_0x69d8('0x27')](respondWithResult(_0xaeec1e,null))[_0x69d8('0x46')](handleError(_0xaeec1e,null));};exports[_0x69d8('0x28')]=function(_0x4d2ca3,_0x88ac8){return db['VtigerConfiguration'][_0x69d8('0x4c')]({'where':{'id':_0x4d2ca3[_0x69d8('0x4b')]['id']}})[_0x69d8('0x27')](handleEntityNotFound(_0x88ac8,null))[_0x69d8('0x27')](removeEntity(_0x88ac8,null))[_0x69d8('0x46')](handleError(_0x88ac8,null));};exports['getFields']=function(_0x362b3e,_0x394d9a,_0x2e38d5){var _0x5a8115={};var _0x274dd0={};var _0x4bda12;var _0x4a02fb;return db[_0x69d8('0x2e')][_0x69d8('0x4d')]({'where':{'id':_0x362b3e[_0x69d8('0x4b')]['id']}})[_0x69d8('0x27')](handleEntityNotFound(_0x394d9a,null))[_0x69d8('0x27')](function(_0x3b305d){if(_0x3b305d){_0x4bda12=_0x3b305d;_0x274dd0[_0x69d8('0x36')]=_['keys'](db[_0x69d8('0x4e')][_0x69d8('0x2f')]);_0x274dd0[_0x69d8('0x33')]=_[_0x69d8('0x34')](_0x362b3e[_0x69d8('0x33')]);_0x274dd0[_0x69d8('0x35')]=_['intersection'](_0x274dd0[_0x69d8('0x36')],_0x274dd0[_0x69d8('0x33')]);_0x5a8115['attributes']=_['intersection'](_0x274dd0[_0x69d8('0x36')],qs['fields'](_0x362b3e[_0x69d8('0x33')][_0x69d8('0x38')]));_0x5a8115[_0x69d8('0x39')]=_0x5a8115[_0x69d8('0x39')]['length']?_0x5a8115[_0x69d8('0x39')]:_0x274dd0[_0x69d8('0x36')];_0x5a8115['order']=qs[_0x69d8('0x3e')](_0x362b3e[_0x69d8('0x33')][_0x69d8('0x3e')]);_0x5a8115[_0x69d8('0x3f')]=qs[_0x69d8('0x35')](_[_0x69d8('0x40')](_0x362b3e['query'],_0x274dd0['filters']));if(_0x362b3e['query'][_0x69d8('0x43')]){_0x5a8115[_0x69d8('0x3f')]=_[_0x69d8('0x41')](_0x5a8115['where'],{'$or':_[_0x69d8('0x2d')](_0x5a8115[_0x69d8('0x39')],function(_0x36436d){var _0x462b5a={};_0x462b5a[_0x36436d]={'$like':'%'+_0x362b3e[_0x69d8('0x33')][_0x69d8('0x43')]+'%'};return _0x462b5a;})});}_0x5a8115=_[_0x69d8('0x41')]({},_0x5a8115,_0x362b3e[_0x69d8('0x44')]);return _0x4bda12['getFields'](_0x5a8115);}})['then'](function(_0x366655){if(_0x366655){_0x4a02fb=_0x366655[_0x69d8('0x3a')];if(!_0x362b3e[_0x69d8('0x33')][_0x69d8('0x3b')](_0x69d8('0x3c'))){_0x5a8115['limit']=qs[_0x69d8('0x20')](_0x362b3e[_0x69d8('0x33')][_0x69d8('0x20')]);_0x5a8115[_0x69d8('0x1f')]=qs[_0x69d8('0x1f')](_0x362b3e[_0x69d8('0x33')][_0x69d8('0x1f')]);}return _0x4bda12[_0x69d8('0x4f')](_0x5a8115);}})[_0x69d8('0x27')](function(_0x2590f6){if(_0x2590f6){return _0x2590f6?{'count':_0x4a02fb,'rows':_0x2590f6}:null;}})[_0x69d8('0x27')](respondWithResult(_0x394d9a,null))[_0x69d8('0x46')](handleError(_0x394d9a,null));};exports[_0x69d8('0x50')]=function(_0x6aa732,_0x34ac2d,_0x27b819){var _0x40a12d={};var _0x32e1bc={};var _0x5de024;var _0x37b024;return db[_0x69d8('0x2e')]['findOne']({'where':{'id':_0x6aa732[_0x69d8('0x4b')]['id']}})[_0x69d8('0x27')](handleEntityNotFound(_0x34ac2d,null))[_0x69d8('0x27')](function(_0x26184a){if(_0x26184a){_0x5de024=_0x26184a;_0x32e1bc[_0x69d8('0x36')]=_['keys'](db[_0x69d8('0x4e')][_0x69d8('0x2f')]);_0x32e1bc[_0x69d8('0x33')]=_[_0x69d8('0x34')](_0x6aa732[_0x69d8('0x33')]);_0x32e1bc['filters']=_[_0x69d8('0x37')](_0x32e1bc[_0x69d8('0x36')],_0x32e1bc['query']);_0x40a12d['attributes']=_[_0x69d8('0x37')](_0x32e1bc[_0x69d8('0x36')],qs[_0x69d8('0x38')](_0x6aa732[_0x69d8('0x33')][_0x69d8('0x38')]));_0x40a12d['attributes']=_0x40a12d['attributes'][_0x69d8('0x3a')]?_0x40a12d[_0x69d8('0x39')]:_0x32e1bc[_0x69d8('0x36')];_0x40a12d[_0x69d8('0x3d')]=qs[_0x69d8('0x3e')](_0x6aa732[_0x69d8('0x33')][_0x69d8('0x3e')]);_0x40a12d[_0x69d8('0x3f')]=qs[_0x69d8('0x35')](_['pick'](_0x6aa732[_0x69d8('0x33')],_0x32e1bc[_0x69d8('0x35')]));if(_0x6aa732[_0x69d8('0x33')]['filter']){_0x40a12d[_0x69d8('0x3f')]=_[_0x69d8('0x41')](_0x40a12d[_0x69d8('0x3f')],{'$or':_[_0x69d8('0x2d')](_0x40a12d['attributes'],function(_0x34ad59){var _0x24766c={};_0x24766c[_0x34ad59]={'$like':'%'+_0x6aa732[_0x69d8('0x33')]['filter']+'%'};return _0x24766c;})});}_0x40a12d=_[_0x69d8('0x41')]({},_0x40a12d,_0x6aa732[_0x69d8('0x44')]);return _0x5de024[_0x69d8('0x50')](_0x40a12d);}})[_0x69d8('0x27')](function(_0x4c1aaf){if(_0x4c1aaf){_0x37b024=_0x4c1aaf['length'];if(!_0x6aa732[_0x69d8('0x33')]['hasOwnProperty']('nolimit')){_0x40a12d['limit']=qs[_0x69d8('0x20')](_0x6aa732[_0x69d8('0x33')]['limit']);_0x40a12d[_0x69d8('0x1f')]=qs['offset'](_0x6aa732[_0x69d8('0x33')][_0x69d8('0x1f')]);}return _0x5de024['getSubjects'](_0x40a12d);}})[_0x69d8('0x27')](function(_0x4d2261){if(_0x4d2261){return _0x4d2261?{'count':_0x37b024,'rows':_0x4d2261}:null;}})[_0x69d8('0x27')](respondWithResult(_0x34ac2d,null))[_0x69d8('0x46')](handleError(_0x34ac2d,null));};exports[_0x69d8('0x51')]=function(_0x144579,_0x7acca3,_0x43d626){var _0x310d30={};var _0x14a392={};var _0x4655ca;var _0x156d6c;return db[_0x69d8('0x2e')]['findOne']({'where':{'id':_0x144579[_0x69d8('0x4b')]['id']}})[_0x69d8('0x27')](handleEntityNotFound(_0x7acca3,null))['then'](function(_0x1487ed){if(_0x1487ed){_0x4655ca=_0x1487ed;_0x14a392[_0x69d8('0x36')]=_[_0x69d8('0x34')](db[_0x69d8('0x4e')][_0x69d8('0x2f')]);_0x14a392[_0x69d8('0x33')]=_[_0x69d8('0x34')](_0x144579[_0x69d8('0x33')]);_0x14a392[_0x69d8('0x35')]=_[_0x69d8('0x37')](_0x14a392[_0x69d8('0x36')],_0x14a392['query']);_0x310d30[_0x69d8('0x39')]=_[_0x69d8('0x37')](_0x14a392['model'],qs[_0x69d8('0x38')](_0x144579['query'][_0x69d8('0x38')]));_0x310d30['attributes']=_0x310d30[_0x69d8('0x39')]['length']?_0x310d30[_0x69d8('0x39')]:_0x14a392[_0x69d8('0x36')];_0x310d30[_0x69d8('0x3d')]=qs[_0x69d8('0x3e')](_0x144579['query'][_0x69d8('0x3e')]);_0x310d30[_0x69d8('0x3f')]=qs[_0x69d8('0x35')](_[_0x69d8('0x40')](_0x144579[_0x69d8('0x33')],_0x14a392['filters']));if(_0x144579[_0x69d8('0x33')][_0x69d8('0x43')]){_0x310d30[_0x69d8('0x3f')]=_[_0x69d8('0x41')](_0x310d30['where'],{'$or':_[_0x69d8('0x2d')](_0x310d30[_0x69d8('0x39')],function(_0x2c6433){var _0x1a1e02={};_0x1a1e02[_0x2c6433]={'$like':'%'+_0x144579[_0x69d8('0x33')][_0x69d8('0x43')]+'%'};return _0x1a1e02;})});}_0x310d30=_['merge']({},_0x310d30,_0x144579[_0x69d8('0x44')]);return _0x4655ca[_0x69d8('0x51')](_0x310d30);}})[_0x69d8('0x27')](function(_0x43774f){if(_0x43774f){_0x156d6c=_0x43774f['length'];if(!_0x144579[_0x69d8('0x33')][_0x69d8('0x3b')](_0x69d8('0x3c'))){_0x310d30[_0x69d8('0x20')]=qs[_0x69d8('0x20')](_0x144579[_0x69d8('0x33')][_0x69d8('0x20')]);_0x310d30[_0x69d8('0x1f')]=qs[_0x69d8('0x1f')](_0x144579[_0x69d8('0x33')]['offset']);}return _0x4655ca[_0x69d8('0x51')](_0x310d30);}})[_0x69d8('0x27')](function(_0xf17de5){if(_0xf17de5){return _0xf17de5?{'count':_0x156d6c,'rows':_0xf17de5}:null;}})['then'](respondWithResult(_0x7acca3,null))[_0x69d8('0x46')](handleError(_0x7acca3,null));}; \ No newline at end of file +var _0x1c2a=['order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','findOne','VtigerField','pick','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','undefined','limit','count','offset','json','reject','save','update','then','destroy','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x40a0a3,_0x22df2b){var _0x28d841=function(_0x257359){while(--_0x257359){_0x40a0a3['push'](_0x40a0a3['shift']());}};_0x28d841(++_0x22df2b);}(_0x1c2a,0xb6));var _0xa1c2=function(_0x135215,_0x44bcf0){_0x135215=_0x135215-0x0;var _0x2552ee=_0x1c2a[_0x135215];return _0x2552ee;};'use strict';var emlformat=require(_0xa1c2('0x0'));var rimraf=require(_0xa1c2('0x1'));var zipdir=require(_0xa1c2('0x2'));var jsonpatch=require(_0xa1c2('0x3'));var rp=require(_0xa1c2('0x4'));var moment=require(_0xa1c2('0x5'));var BPromise=require(_0xa1c2('0x6'));var Mustache=require(_0xa1c2('0x7'));var util=require(_0xa1c2('0x8'));var path=require(_0xa1c2('0x9'));var sox=require(_0xa1c2('0xa'));var csv=require(_0xa1c2('0xb'));var ejs=require(_0xa1c2('0xc'));var fs=require('fs');var fs_extra=require(_0xa1c2('0xd'));var _=require(_0xa1c2('0xe'));var squel=require(_0xa1c2('0xf'));var crypto=require(_0xa1c2('0x10'));var jsforce=require(_0xa1c2('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xa1c2('0xb'));var querystring=require(_0xa1c2('0x12'));var Papa=require(_0xa1c2('0x13'));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(_0xa1c2('0x14'));var logger=require(_0xa1c2('0x15'))('api');var utils=require(_0xa1c2('0x16'));var config=require(_0xa1c2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1c2('0x18'))['db'];function respondWithStatusCode(_0x4a49b0,_0x3357ba){_0x3357ba=_0x3357ba||0xcc;return function(_0x2c4ae6){if(_0x2c4ae6){return _0x4a49b0['sendStatus'](_0x3357ba);}return _0x4a49b0['status'](_0x3357ba)[_0xa1c2('0x19')]();};}function respondWithResult(_0x2f9061,_0x55c29c){_0x55c29c=_0x55c29c||0xc8;return function(_0x37ca44){if(_0x37ca44){return _0x2f9061[_0xa1c2('0x1a')](_0x55c29c)['json'](_0x37ca44);}};}function respondWithFilteredResult(_0x1e4343,_0x838bf9){return function(_0x637bb0){if(_0x637bb0){var _0x1b6821=typeof _0x838bf9['offset']===_0xa1c2('0x1b')&&typeof _0x838bf9[_0xa1c2('0x1c')]===_0xa1c2('0x1b');var _0x34462e=_0x637bb0[_0xa1c2('0x1d')];var _0x3bda34=_0x1b6821?0x0:_0x838bf9[_0xa1c2('0x1e')];var _0x21f345=_0x1b6821?_0x637bb0[_0xa1c2('0x1d')]:_0x838bf9[_0xa1c2('0x1e')]+_0x838bf9['limit'];var _0x266b0e;if(_0x21f345>=_0x34462e){_0x21f345=_0x34462e;_0x266b0e=0xc8;}else{_0x266b0e=0xce;}_0x1e4343[_0xa1c2('0x1a')](_0x266b0e);return _0x1e4343['set']('Content-Range',_0x3bda34+'-'+_0x21f345+'/'+_0x34462e)[_0xa1c2('0x1f')](_0x637bb0);}return null;};}function patchUpdates(_0x107d02){return function(_0x106c58){try{jsonpatch['apply'](_0x106c58,_0x107d02,!![]);}catch(_0x302132){return BPromise[_0xa1c2('0x20')](_0x302132);}return _0x106c58[_0xa1c2('0x21')]();};}function saveUpdates(_0x182201,_0x3dbab4){return function(_0x5cd274){if(_0x5cd274){return _0x5cd274[_0xa1c2('0x22')](_0x182201)[_0xa1c2('0x23')](function(_0x358ce0){return _0x358ce0;});}return null;};}function removeEntity(_0x488d5b,_0x77e46d){return function(_0x2640f4){if(_0x2640f4){return _0x2640f4[_0xa1c2('0x24')]()[_0xa1c2('0x23')](function(){_0x488d5b[_0xa1c2('0x1a')](0xcc)[_0xa1c2('0x19')]();});}};}function handleEntityNotFound(_0x305b0b,_0x134d77){return function(_0x14cbc9){if(!_0x14cbc9){_0x305b0b['sendStatus'](0x194);}return _0x14cbc9;};}function handleError(_0x77b43d,_0x47ec2f){_0x47ec2f=_0x47ec2f||0x1f4;return function(_0x101ee9){logger[_0xa1c2('0x25')](_0x101ee9['stack']);if(_0x101ee9[_0xa1c2('0x26')]){delete _0x101ee9[_0xa1c2('0x26')];}_0x77b43d[_0xa1c2('0x1a')](_0x47ec2f)[_0xa1c2('0x27')](_0x101ee9);};}exports[_0xa1c2('0x28')]=function(_0x1d9e7d,_0x877626){var _0x149970={},_0x228ff7={},_0x1fb445={'count':0x0,'rows':[]};var _0x2a8310=_[_0xa1c2('0x29')](db[_0xa1c2('0x2a')][_0xa1c2('0x2b')],function(_0x392b36){return{'name':_0x392b36[_0xa1c2('0x2c')],'type':_0x392b36[_0xa1c2('0x2d')][_0xa1c2('0x2e')]};});_0x228ff7[_0xa1c2('0x2f')]=_[_0xa1c2('0x29')](_0x2a8310,'name');_0x228ff7['query']=_[_0xa1c2('0x30')](_0x1d9e7d[_0xa1c2('0x31')]);_0x228ff7[_0xa1c2('0x32')]=_[_0xa1c2('0x33')](_0x228ff7[_0xa1c2('0x2f')],_0x228ff7[_0xa1c2('0x31')]);_0x149970[_0xa1c2('0x34')]=_[_0xa1c2('0x33')](_0x228ff7[_0xa1c2('0x2f')],qs[_0xa1c2('0x35')](_0x1d9e7d['query'][_0xa1c2('0x35')]));_0x149970['attributes']=_0x149970[_0xa1c2('0x34')]['length']?_0x149970['attributes']:_0x228ff7[_0xa1c2('0x2f')];if(!_0x1d9e7d[_0xa1c2('0x31')][_0xa1c2('0x36')]('nolimit')){_0x149970[_0xa1c2('0x1c')]=qs['limit'](_0x1d9e7d[_0xa1c2('0x31')][_0xa1c2('0x1c')]);_0x149970[_0xa1c2('0x1e')]=qs[_0xa1c2('0x1e')](_0x1d9e7d[_0xa1c2('0x31')][_0xa1c2('0x1e')]);}_0x149970[_0xa1c2('0x37')]=qs[_0xa1c2('0x38')](_0x1d9e7d[_0xa1c2('0x31')]['sort']);_0x149970[_0xa1c2('0x39')]=qs['filters'](_['pick'](_0x1d9e7d[_0xa1c2('0x31')],_0x228ff7[_0xa1c2('0x32')]),_0x2a8310);if(_0x1d9e7d[_0xa1c2('0x31')]['filter']){_0x149970['where']=_[_0xa1c2('0x3a')](_0x149970[_0xa1c2('0x39')],{'$or':_[_0xa1c2('0x29')](_0x2a8310,function(_0x5ed22a){if(_0x5ed22a[_0xa1c2('0x2d')]!==_0xa1c2('0x3b')){var _0x213558={};_0x213558[_0x5ed22a[_0xa1c2('0x26')]]={'$like':'%'+_0x1d9e7d[_0xa1c2('0x31')][_0xa1c2('0x3c')]+'%'};return _0x213558;}})});}_0x149970=_['merge']({},_0x149970,_0x1d9e7d[_0xa1c2('0x3d')]);var _0x5827f4={'where':_0x149970['where']};return db['VtigerConfiguration'][_0xa1c2('0x1d')](_0x5827f4)[_0xa1c2('0x23')](function(_0x257177){_0x1fb445['count']=_0x257177;if(_0x1d9e7d[_0xa1c2('0x31')][_0xa1c2('0x3e')]){_0x149970[_0xa1c2('0x3f')]=[{'all':!![]}];}return db[_0xa1c2('0x2a')][_0xa1c2('0x40')](_0x149970);})['then'](function(_0x2b6b17){_0x1fb445[_0xa1c2('0x41')]=_0x2b6b17;return _0x1fb445;})[_0xa1c2('0x23')](respondWithFilteredResult(_0x877626,_0x149970))['catch'](handleError(_0x877626,null));};exports[_0xa1c2('0x42')]=function(_0x2a3abc,_0x66c38a){var _0x4add8b={'raw':![],'where':{'id':_0x2a3abc[_0xa1c2('0x43')]['id']}},_0xc7182b={};_0xc7182b[_0xa1c2('0x2f')]=_[_0xa1c2('0x30')](db[_0xa1c2('0x2a')]['rawAttributes']);_0xc7182b[_0xa1c2('0x31')]=_[_0xa1c2('0x30')](_0x2a3abc[_0xa1c2('0x31')]);_0xc7182b[_0xa1c2('0x32')]=_[_0xa1c2('0x33')](_0xc7182b[_0xa1c2('0x2f')],_0xc7182b[_0xa1c2('0x31')]);_0x4add8b[_0xa1c2('0x34')]=_['intersection'](_0xc7182b[_0xa1c2('0x2f')],qs[_0xa1c2('0x35')](_0x2a3abc[_0xa1c2('0x31')]['fields']));_0x4add8b[_0xa1c2('0x34')]=_0x4add8b['attributes'][_0xa1c2('0x44')]?_0x4add8b[_0xa1c2('0x34')]:_0xc7182b[_0xa1c2('0x2f')];if(_0x2a3abc[_0xa1c2('0x31')]['includeAll']){_0x4add8b[_0xa1c2('0x3f')]=[{'all':!![]}];}_0x4add8b=_[_0xa1c2('0x3a')]({},_0x4add8b,_0x2a3abc[_0xa1c2('0x3d')]);return db[_0xa1c2('0x2a')][_0xa1c2('0x45')](_0x4add8b)[_0xa1c2('0x23')](handleEntityNotFound(_0x66c38a,null))[_0xa1c2('0x23')](respondWithResult(_0x66c38a,null))[_0xa1c2('0x46')](handleError(_0x66c38a,null));};exports[_0xa1c2('0x47')]=function(_0x4716c8,_0x1233f2){return db[_0xa1c2('0x2a')]['create'](_0x4716c8[_0xa1c2('0x48')],{})[_0xa1c2('0x23')](respondWithResult(_0x1233f2,0xc9))[_0xa1c2('0x46')](handleError(_0x1233f2,null));};exports[_0xa1c2('0x22')]=function(_0x2d5794,_0x2503c1){if(_0x2d5794[_0xa1c2('0x48')]['id']){delete _0x2d5794[_0xa1c2('0x48')]['id'];}return db['VtigerConfiguration'][_0xa1c2('0x45')]({'where':{'id':_0x2d5794['params']['id']}})[_0xa1c2('0x23')](handleEntityNotFound(_0x2503c1,null))[_0xa1c2('0x23')](saveUpdates(_0x2d5794['body'],null))['then'](respondWithResult(_0x2503c1,null))[_0xa1c2('0x46')](handleError(_0x2503c1,null));};exports[_0xa1c2('0x24')]=function(_0x5216ac,_0x4ae945){return db[_0xa1c2('0x2a')][_0xa1c2('0x45')]({'where':{'id':_0x5216ac[_0xa1c2('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ae945,null))[_0xa1c2('0x23')](removeEntity(_0x4ae945,null))[_0xa1c2('0x46')](handleError(_0x4ae945,null));};exports['getFields']=function(_0x306cf6,_0x490a69,_0x2c03c5){var _0x3f7ace={};var _0x1491be={};var _0x2dffb3;var _0x47cc71;return db[_0xa1c2('0x2a')][_0xa1c2('0x49')]({'where':{'id':_0x306cf6[_0xa1c2('0x43')]['id']}})['then'](handleEntityNotFound(_0x490a69,null))[_0xa1c2('0x23')](function(_0xb0418c){if(_0xb0418c){_0x2dffb3=_0xb0418c;_0x1491be[_0xa1c2('0x2f')]=_[_0xa1c2('0x30')](db[_0xa1c2('0x4a')][_0xa1c2('0x2b')]);_0x1491be[_0xa1c2('0x31')]=_[_0xa1c2('0x30')](_0x306cf6['query']);_0x1491be['filters']=_['intersection'](_0x1491be['model'],_0x1491be['query']);_0x3f7ace['attributes']=_[_0xa1c2('0x33')](_0x1491be[_0xa1c2('0x2f')],qs[_0xa1c2('0x35')](_0x306cf6['query'][_0xa1c2('0x35')]));_0x3f7ace[_0xa1c2('0x34')]=_0x3f7ace['attributes'][_0xa1c2('0x44')]?_0x3f7ace[_0xa1c2('0x34')]:_0x1491be[_0xa1c2('0x2f')];_0x3f7ace[_0xa1c2('0x37')]=qs[_0xa1c2('0x38')](_0x306cf6['query'][_0xa1c2('0x38')]);_0x3f7ace[_0xa1c2('0x39')]=qs[_0xa1c2('0x32')](_[_0xa1c2('0x4b')](_0x306cf6[_0xa1c2('0x31')],_0x1491be[_0xa1c2('0x32')]));if(_0x306cf6[_0xa1c2('0x31')][_0xa1c2('0x3c')]){_0x3f7ace[_0xa1c2('0x39')]=_['merge'](_0x3f7ace[_0xa1c2('0x39')],{'$or':_[_0xa1c2('0x29')](_0x3f7ace['attributes'],function(_0x521f22){var _0x4de57f={};_0x4de57f[_0x521f22]={'$like':'%'+_0x306cf6[_0xa1c2('0x31')]['filter']+'%'};return _0x4de57f;})});}_0x3f7ace=_[_0xa1c2('0x3a')]({},_0x3f7ace,_0x306cf6[_0xa1c2('0x3d')]);return _0x2dffb3['getFields'](_0x3f7ace);}})[_0xa1c2('0x23')](function(_0x79c500){if(_0x79c500){_0x47cc71=_0x79c500[_0xa1c2('0x44')];if(!_0x306cf6['query'][_0xa1c2('0x36')]('nolimit')){_0x3f7ace['limit']=qs[_0xa1c2('0x1c')](_0x306cf6[_0xa1c2('0x31')][_0xa1c2('0x1c')]);_0x3f7ace[_0xa1c2('0x1e')]=qs[_0xa1c2('0x1e')](_0x306cf6[_0xa1c2('0x31')][_0xa1c2('0x1e')]);}return _0x2dffb3['getFields'](_0x3f7ace);}})['then'](function(_0x18b742){if(_0x18b742){return _0x18b742?{'count':_0x47cc71,'rows':_0x18b742}:null;}})['then'](respondWithResult(_0x490a69,null))['catch'](handleError(_0x490a69,null));};exports[_0xa1c2('0x4c')]=function(_0x25a923,_0x3fe66c,_0x4732ab){var _0x579aed={};var _0x152b94={};var _0x4523c6;var _0x2984cf;return db[_0xa1c2('0x2a')][_0xa1c2('0x49')]({'where':{'id':_0x25a923[_0xa1c2('0x43')]['id']}})['then'](handleEntityNotFound(_0x3fe66c,null))['then'](function(_0x448073){if(_0x448073){_0x4523c6=_0x448073;_0x152b94[_0xa1c2('0x2f')]=_['keys'](db[_0xa1c2('0x4a')]['rawAttributes']);_0x152b94[_0xa1c2('0x31')]=_[_0xa1c2('0x30')](_0x25a923[_0xa1c2('0x31')]);_0x152b94[_0xa1c2('0x32')]=_[_0xa1c2('0x33')](_0x152b94[_0xa1c2('0x2f')],_0x152b94['query']);_0x579aed[_0xa1c2('0x34')]=_[_0xa1c2('0x33')](_0x152b94[_0xa1c2('0x2f')],qs[_0xa1c2('0x35')](_0x25a923[_0xa1c2('0x31')][_0xa1c2('0x35')]));_0x579aed[_0xa1c2('0x34')]=_0x579aed['attributes'][_0xa1c2('0x44')]?_0x579aed['attributes']:_0x152b94['model'];_0x579aed[_0xa1c2('0x37')]=qs[_0xa1c2('0x38')](_0x25a923[_0xa1c2('0x31')][_0xa1c2('0x38')]);_0x579aed[_0xa1c2('0x39')]=qs[_0xa1c2('0x32')](_['pick'](_0x25a923[_0xa1c2('0x31')],_0x152b94[_0xa1c2('0x32')]));if(_0x25a923['query'][_0xa1c2('0x3c')]){_0x579aed[_0xa1c2('0x39')]=_[_0xa1c2('0x3a')](_0x579aed[_0xa1c2('0x39')],{'$or':_[_0xa1c2('0x29')](_0x579aed[_0xa1c2('0x34')],function(_0x1d5cc9){var _0x26a758={};_0x26a758[_0x1d5cc9]={'$like':'%'+_0x25a923[_0xa1c2('0x31')]['filter']+'%'};return _0x26a758;})});}_0x579aed=_[_0xa1c2('0x3a')]({},_0x579aed,_0x25a923['options']);return _0x4523c6[_0xa1c2('0x4c')](_0x579aed);}})[_0xa1c2('0x23')](function(_0x404112){if(_0x404112){_0x2984cf=_0x404112[_0xa1c2('0x44')];if(!_0x25a923[_0xa1c2('0x31')][_0xa1c2('0x36')](_0xa1c2('0x4d'))){_0x579aed[_0xa1c2('0x1c')]=qs[_0xa1c2('0x1c')](_0x25a923[_0xa1c2('0x31')][_0xa1c2('0x1c')]);_0x579aed[_0xa1c2('0x1e')]=qs[_0xa1c2('0x1e')](_0x25a923[_0xa1c2('0x31')][_0xa1c2('0x1e')]);}return _0x4523c6[_0xa1c2('0x4c')](_0x579aed);}})['then'](function(_0x47e615){if(_0x47e615){return _0x47e615?{'count':_0x2984cf,'rows':_0x47e615}:null;}})[_0xa1c2('0x23')](respondWithResult(_0x3fe66c,null))[_0xa1c2('0x46')](handleError(_0x3fe66c,null));};exports[_0xa1c2('0x4e')]=function(_0x45506f,_0xfd5bf1,_0x3d14a2){var _0x5a46d6={};var _0x27b0f0={};var _0x4aa387;var _0x52e084;return db['VtigerConfiguration'][_0xa1c2('0x49')]({'where':{'id':_0x45506f[_0xa1c2('0x43')]['id']}})[_0xa1c2('0x23')](handleEntityNotFound(_0xfd5bf1,null))[_0xa1c2('0x23')](function(_0x24b5a5){if(_0x24b5a5){_0x4aa387=_0x24b5a5;_0x27b0f0[_0xa1c2('0x2f')]=_[_0xa1c2('0x30')](db[_0xa1c2('0x4a')][_0xa1c2('0x2b')]);_0x27b0f0['query']=_[_0xa1c2('0x30')](_0x45506f[_0xa1c2('0x31')]);_0x27b0f0['filters']=_[_0xa1c2('0x33')](_0x27b0f0[_0xa1c2('0x2f')],_0x27b0f0[_0xa1c2('0x31')]);_0x5a46d6[_0xa1c2('0x34')]=_[_0xa1c2('0x33')](_0x27b0f0[_0xa1c2('0x2f')],qs['fields'](_0x45506f[_0xa1c2('0x31')]['fields']));_0x5a46d6[_0xa1c2('0x34')]=_0x5a46d6['attributes'][_0xa1c2('0x44')]?_0x5a46d6[_0xa1c2('0x34')]:_0x27b0f0[_0xa1c2('0x2f')];_0x5a46d6[_0xa1c2('0x37')]=qs[_0xa1c2('0x38')](_0x45506f[_0xa1c2('0x31')][_0xa1c2('0x38')]);_0x5a46d6[_0xa1c2('0x39')]=qs['filters'](_[_0xa1c2('0x4b')](_0x45506f[_0xa1c2('0x31')],_0x27b0f0['filters']));if(_0x45506f[_0xa1c2('0x31')][_0xa1c2('0x3c')]){_0x5a46d6[_0xa1c2('0x39')]=_[_0xa1c2('0x3a')](_0x5a46d6[_0xa1c2('0x39')],{'$or':_[_0xa1c2('0x29')](_0x5a46d6[_0xa1c2('0x34')],function(_0x5e1af7){var _0x35ddd2={};_0x35ddd2[_0x5e1af7]={'$like':'%'+_0x45506f[_0xa1c2('0x31')]['filter']+'%'};return _0x35ddd2;})});}_0x5a46d6=_[_0xa1c2('0x3a')]({},_0x5a46d6,_0x45506f[_0xa1c2('0x3d')]);return _0x4aa387[_0xa1c2('0x4e')](_0x5a46d6);}})[_0xa1c2('0x23')](function(_0x2c0d46){if(_0x2c0d46){_0x52e084=_0x2c0d46[_0xa1c2('0x44')];if(!_0x45506f['query'][_0xa1c2('0x36')](_0xa1c2('0x4d'))){_0x5a46d6[_0xa1c2('0x1c')]=qs[_0xa1c2('0x1c')](_0x45506f[_0xa1c2('0x31')][_0xa1c2('0x1c')]);_0x5a46d6['offset']=qs[_0xa1c2('0x1e')](_0x45506f[_0xa1c2('0x31')][_0xa1c2('0x1e')]);}return _0x4aa387[_0xa1c2('0x4e')](_0x5a46d6);}})['then'](function(_0x327d7c){if(_0x327d7c){return _0x327d7c?{'count':_0x52e084,'rows':_0x327d7c}:null;}})['then'](respondWithResult(_0xfd5bf1,null))[_0xa1c2('0x46')](handleError(_0xfd5bf1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b10a29a..61e139a 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 _0x800c=['rimraf','define','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x800c,0x77));var _0xc800=function(_0x34fea2,_0x596681){_0x34fea2=_0x34fea2-0x0;var _0x18f042=_0x800c[_0x34fea2];return _0x18f042;};'use strict';var _=require(_0xc800('0x0'));var util=require(_0xc800('0x1'));var logger=require(_0xc800('0x2'))(_0xc800('0x3'));var moment=require('moment');var BPromise=require(_0xc800('0x4'));var rp=require(_0xc800('0x5'));var fs=require('fs');var path=require(_0xc800('0x6'));var rimraf=require(_0xc800('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x2957b0,_0x54565){return _0x2957b0[_0xc800('0x8')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4a4=['../../config/logger','api','request-promise','path','rimraf','exports','define','VtigerConfiguration','lodash'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe4a4,0x131));var _0x4e4a=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0xe4a4[_0x1e6e4e];return _0x3d746b;};'use strict';var _=require(_0x4e4a('0x0'));var util=require('util');var logger=require(_0x4e4a('0x1'))(_0x4e4a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e4a('0x3'));var fs=require('fs');var path=require(_0x4e4a('0x4'));var rimraf=require(_0x4e4a('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x4e4a('0x6')]=function(_0xd05656,_0x3d56f6){return _0xd05656[_0x4e4a('0x7')](_0x4e4a('0x8'),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 89e1123..99cc8e3 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 _0x2cd8=['catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2cd8,0x13c));var _0x82cd=function(_0x522e0c,_0x3d69cb){_0x522e0c=_0x522e0c-0x0;var _0x58eb18=_0x2cd8[_0x522e0c];return _0x58eb18;};'use strict';var _=require('lodash');var util=require(_0x82cd('0x0'));var moment=require('moment');var BPromise=require(_0x82cd('0x1'));var rs=require(_0x82cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82cd('0x3'))['db'];var utils=require(_0x82cd('0x4'));var logger=require('../../config/logger')(_0x82cd('0x5'));var config=require(_0x82cd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x82cd('0x7')][_0x82cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14d100,_0x39d013,_0x3d866f){return new BPromise(function(_0x3196b8,_0x19a1f6){return client[_0x82cd('0x9')](_0x14d100,_0x3d866f)[_0x82cd('0xa')](function(_0x3376d1){logger['info'](_0x82cd('0xb'),_0x39d013,_0x82cd('0xc'));logger[_0x82cd('0xd')](_0x82cd('0xe'),_0x39d013,_0x82cd('0xc'),JSON[_0x82cd('0xf')](_0x3376d1));if(_0x3376d1[_0x82cd('0x10')]){if(_0x3376d1[_0x82cd('0x10')]['code']===0x1f4){logger[_0x82cd('0x10')](_0x82cd('0xb'),_0x39d013,_0x3376d1[_0x82cd('0x10')]['message']);return _0x19a1f6(_0x3376d1['error'][_0x82cd('0x11')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x39d013,_0x3376d1['error'][_0x82cd('0x11')]);return _0x3196b8(_0x3376d1['error'][_0x82cd('0x11')]);}else{logger[_0x82cd('0x12')](_0x82cd('0xb'),_0x39d013,_0x82cd('0xc'));_0x3196b8(_0x3376d1[_0x82cd('0x13')][_0x82cd('0x11')]);}})[_0x82cd('0x14')](function(_0x186541){logger[_0x82cd('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x39d013,_0x186541);_0x19a1f6(_0x186541);});});} \ No newline at end of file +var _0x4919=['debug','stringify','error','code','message','request\x20sent','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x4919,0x133));var _0x9491=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x4919[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x9491('0x0'));var util=require(_0x9491('0x1'));var moment=require('moment');var BPromise=require(_0x9491('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9491('0x3'));var db=require(_0x9491('0x4'))['db'];var utils=require(_0x9491('0x5'));var logger=require(_0x9491('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9491('0x7'));var client=jayson[_0x9491('0x8')][_0x9491('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43d1b5,_0xdecf4e,_0x27e160){return new BPromise(function(_0x365cf1,_0x4fe29c){return client[_0x9491('0xa')](_0x43d1b5,_0x27e160)['then'](function(_0x384a00){logger[_0x9491('0xb')](_0x9491('0xc'),_0xdecf4e,'request\x20sent');logger[_0x9491('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xdecf4e,'request\x20sent',JSON[_0x9491('0xe')](_0x384a00));if(_0x384a00['error']){if(_0x384a00[_0x9491('0xf')][_0x9491('0x10')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0xdecf4e,_0x384a00[_0x9491('0xf')][_0x9491('0x11')]);return _0x4fe29c(_0x384a00[_0x9491('0xf')][_0x9491('0x11')]);}logger[_0x9491('0xf')](_0x9491('0xc'),_0xdecf4e,_0x384a00['error'][_0x9491('0x11')]);return _0x365cf1(_0x384a00[_0x9491('0xf')]['message']);}else{logger[_0x9491('0xb')](_0x9491('0xc'),_0xdecf4e,_0x9491('0x12'));_0x365cf1(_0x384a00[_0x9491('0x13')][_0x9491('0x11')]);}})['catch'](function(_0x470703){logger[_0x9491('0xf')](_0x9491('0xc'),_0xdecf4e,_0x470703);_0x4fe29c(_0x470703);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6b36a01..f307887 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 _0x59e4=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./intVtigerField.controller','get','index','/:id','isAuthenticated','post','put','delete','destroy'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x59e4,0xe1));var _0x459e=function(_0x300d0e,_0x4fcd1b){_0x300d0e=_0x300d0e-0x0;var _0x1903cb=_0x59e4[_0x300d0e];return _0x1903cb;};'use strict';var multer=require(_0x459e('0x0'));var util=require('util');var path=require(_0x459e('0x1'));var timeout=require(_0x459e('0x2'));var express=require(_0x459e('0x3'));var router=express[_0x459e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x459e('0x5'));var config=require('../../config/environment');var controller=require(_0x459e('0x6'));router[_0x459e('0x7')]('/',auth['isAuthenticated'](),controller[_0x459e('0x8')]);router[_0x459e('0x7')](_0x459e('0x9'),auth[_0x459e('0xa')](),controller['show']);router[_0x459e('0xb')]('/',auth[_0x459e('0xa')](),controller['create']);router[_0x459e('0xc')](_0x459e('0x9'),auth[_0x459e('0xa')](),controller['update']);router[_0x459e('0xd')](_0x459e('0x9'),auth['isAuthenticated'](),controller[_0x459e('0xe')]);module[_0x459e('0xf')]=router; \ No newline at end of file +var _0xf914=['fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x55424a,_0x425c29){var _0x40db54=function(_0x16b8f7){while(--_0x16b8f7){_0x55424a['push'](_0x55424a['shift']());}};_0x40db54(++_0x425c29);}(_0xf914,0x13e));var _0x4f91=function(_0x580409,_0x11a6e8){_0x580409=_0x580409-0x0;var _0x126a85=_0xf914[_0x580409];return _0x126a85;};'use strict';var multer=require(_0x4f91('0x0'));var util=require(_0x4f91('0x1'));var path=require(_0x4f91('0x2'));var timeout=require(_0x4f91('0x3'));var express=require('express');var router=express[_0x4f91('0x4')]();var fs_extra=require(_0x4f91('0x5'));var auth=require(_0x4f91('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f91('0x7'));var controller=require(_0x4f91('0x8'));router[_0x4f91('0x9')]('/',auth[_0x4f91('0xa')](),controller['index']);router[_0x4f91('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4f91('0xb')]);router[_0x4f91('0xc')]('/',auth[_0x4f91('0xa')](),controller['create']);router[_0x4f91('0xd')](_0x4f91('0xe'),auth[_0x4f91('0xa')](),controller[_0x4f91('0xf')]);router[_0x4f91('0x10')](_0x4f91('0xe'),auth[_0x4f91('0xa')](),controller[_0x4f91('0x11')]);module[_0x4f91('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 5eb742b..c267375 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 _0x1b1f=['ENUM','sequelize','exports','variable','customVariable','keyValue','picklist','STRING'];(function(_0x479730,_0x42f634){var _0x27b98b=function(_0xb88c4a){while(--_0xb88c4a){_0x479730['push'](_0x479730['shift']());}};_0x27b98b(++_0x42f634);}(_0x1b1f,0x69));var _0xf1b1=function(_0x4d92c,_0x1eb40d){_0x4d92c=_0x4d92c-0x0;var _0x39163e=_0x1b1f[_0x4d92c];return _0x39163e;};'use strict';var Sequelize=require(_0xf1b1('0x0'));module[_0xf1b1('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xf1b1('0x2'),_0xf1b1('0x3'),_0xf1b1('0x4'),_0xf1b1('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf1b1('0x6')]},'key':{'type':Sequelize[_0xf1b1('0x6')]},'keyType':{'type':Sequelize[_0xf1b1('0x7')]('string',_0xf1b1('0x2'),_0xf1b1('0x3'))},'keyContent':{'type':Sequelize[_0xf1b1('0x6')]},'idField':{'type':Sequelize[_0xf1b1('0x6')]},'nameField':{'type':Sequelize[_0xf1b1('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf1b1('0x6')]}}; \ No newline at end of file +var _0x6f01=['string','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6f01,0xe5));var _0x16f0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f01[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x16f0('0x0'));module[_0x16f0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x16f0('0x2'),'variable','customVariable','keyValue','picklist'),'defaultValue':_0x16f0('0x2')},'content':{'type':Sequelize[_0x16f0('0x3')]},'key':{'type':Sequelize[_0x16f0('0x3')]},'keyType':{'type':Sequelize[_0x16f0('0x4')](_0x16f0('0x2'),_0x16f0('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0x16f0('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x16f0('0x3')]},'customField':{'type':Sequelize[_0x16f0('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x16f0('0x3')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 8f86355..f8a6dcf 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 _0xeccc=['includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VtigerField'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0xeccc,0x147));var _0xcecc=function(_0x2d10f7,_0x36abd0){_0x2d10f7=_0x2d10f7-0x0;var _0x94c2f7=_0xeccc[_0x2d10f7];return _0x94c2f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcecc('0x0'));var zipdir=require(_0xcecc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcecc('0x2'));var BPromise=require(_0xcecc('0x3'));var Mustache=require(_0xcecc('0x4'));var util=require(_0xcecc('0x5'));var path=require(_0xcecc('0x6'));var sox=require(_0xcecc('0x7'));var csv=require(_0xcecc('0x8'));var ejs=require(_0xcecc('0x9'));var fs=require('fs');var fs_extra=require(_0xcecc('0xa'));var _=require('lodash');var squel=require(_0xcecc('0xb'));var crypto=require(_0xcecc('0xc'));var jsforce=require(_0xcecc('0xd'));var deskjs=require(_0xcecc('0xe'));var toCsv=require(_0xcecc('0x8'));var querystring=require(_0xcecc('0xf'));var Papa=require(_0xcecc('0x10'));var Redis=require(_0xcecc('0x11'));var authService=require(_0xcecc('0x12'));var qs=require(_0xcecc('0x13'));var as=require(_0xcecc('0x14'));var hardwareService=require(_0xcecc('0x15'));var logger=require(_0xcecc('0x16'))(_0xcecc('0x17'));var utils=require(_0xcecc('0x18'));var config=require(_0xcecc('0x19'));var licenseUtil=require(_0xcecc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18ef86,_0x4f6fbd){_0x4f6fbd=_0x4f6fbd||0xcc;return function(_0x52fb62){if(_0x52fb62){return _0x18ef86[_0xcecc('0x1b')](_0x4f6fbd);}return _0x18ef86[_0xcecc('0x1c')](_0x4f6fbd)[_0xcecc('0x1d')]();};}function respondWithResult(_0x5ae229,_0x2417ff){_0x2417ff=_0x2417ff||0xc8;return function(_0x4e322e){if(_0x4e322e){return _0x5ae229[_0xcecc('0x1c')](_0x2417ff)['json'](_0x4e322e);}};}function respondWithFilteredResult(_0x1541ce,_0x246256){return function(_0x323568){if(_0x323568){var _0x336b8b=typeof _0x246256[_0xcecc('0x1e')]===_0xcecc('0x1f')&&typeof _0x246256[_0xcecc('0x20')]===_0xcecc('0x1f');var _0x323044=_0x323568[_0xcecc('0x21')];var _0x124443=_0x336b8b?0x0:_0x246256['offset'];var _0x5cdcba=_0x336b8b?_0x323568['count']:_0x246256[_0xcecc('0x1e')]+_0x246256[_0xcecc('0x20')];var _0x49884c;if(_0x5cdcba>=_0x323044){_0x5cdcba=_0x323044;_0x49884c=0xc8;}else{_0x49884c=0xce;}_0x1541ce['status'](_0x49884c);return _0x1541ce[_0xcecc('0x22')](_0xcecc('0x23'),_0x124443+'-'+_0x5cdcba+'/'+_0x323044)[_0xcecc('0x24')](_0x323568);}return null;};}function patchUpdates(_0x4aeb89){return function(_0x157ad0){try{jsonpatch[_0xcecc('0x25')](_0x157ad0,_0x4aeb89,!![]);}catch(_0x3c6d31){return BPromise[_0xcecc('0x26')](_0x3c6d31);}return _0x157ad0[_0xcecc('0x27')]();};}function saveUpdates(_0x3ea521,_0x236fc2){return function(_0x8af1f1){if(_0x8af1f1){return _0x8af1f1[_0xcecc('0x28')](_0x3ea521)[_0xcecc('0x29')](function(_0x4287da){return _0x4287da;});}return null;};}function removeEntity(_0x21da89,_0x40bc7d){return function(_0x22ab34){if(_0x22ab34){return _0x22ab34[_0xcecc('0x2a')]()['then'](function(){_0x21da89[_0xcecc('0x1c')](0xcc)[_0xcecc('0x1d')]();});}};}function handleEntityNotFound(_0x5c7b79,_0x4a6289){return function(_0x3f8ec4){if(!_0x3f8ec4){_0x5c7b79[_0xcecc('0x1b')](0x194);}return _0x3f8ec4;};}function handleError(_0x1f14e1,_0x8624ca){_0x8624ca=_0x8624ca||0x1f4;return function(_0x5113ab){logger['error'](_0x5113ab[_0xcecc('0x2b')]);if(_0x5113ab[_0xcecc('0x2c')]){delete _0x5113ab[_0xcecc('0x2c')];}_0x1f14e1[_0xcecc('0x1c')](_0x8624ca)[_0xcecc('0x2d')](_0x5113ab);};}exports['index']=function(_0x548e6e,_0x47e336){var _0x162be8={},_0x3a4ef2={},_0x199e7c={'count':0x0,'rows':[]};var _0x930bcf=_['map'](db['VtigerField']['rawAttributes'],function(_0x4c03de){return{'name':_0x4c03de[_0xcecc('0x2e')],'type':_0x4c03de[_0xcecc('0x2f')][_0xcecc('0x30')]};});_0x3a4ef2[_0xcecc('0x31')]=_[_0xcecc('0x32')](_0x930bcf,_0xcecc('0x2c'));_0x3a4ef2['query']=_[_0xcecc('0x33')](_0x548e6e[_0xcecc('0x34')]);_0x3a4ef2[_0xcecc('0x35')]=_['intersection'](_0x3a4ef2[_0xcecc('0x31')],_0x3a4ef2['query']);_0x162be8[_0xcecc('0x36')]=_[_0xcecc('0x37')](_0x3a4ef2[_0xcecc('0x31')],qs[_0xcecc('0x38')](_0x548e6e[_0xcecc('0x34')]['fields']));_0x162be8[_0xcecc('0x36')]=_0x162be8['attributes'][_0xcecc('0x39')]?_0x162be8[_0xcecc('0x36')]:_0x3a4ef2['model'];if(!_0x548e6e['query'][_0xcecc('0x3a')](_0xcecc('0x3b'))){_0x162be8['limit']=qs['limit'](_0x548e6e[_0xcecc('0x34')]['limit']);_0x162be8[_0xcecc('0x1e')]=qs['offset'](_0x548e6e[_0xcecc('0x34')]['offset']);}_0x162be8[_0xcecc('0x3c')]=qs[_0xcecc('0x3d')](_0x548e6e[_0xcecc('0x34')][_0xcecc('0x3d')]);_0x162be8[_0xcecc('0x3e')]=qs['filters'](_['pick'](_0x548e6e[_0xcecc('0x34')],_0x3a4ef2[_0xcecc('0x35')]),_0x930bcf);if(_0x548e6e['query'][_0xcecc('0x3f')]){_0x162be8['where']=_[_0xcecc('0x40')](_0x162be8[_0xcecc('0x3e')],{'$or':_[_0xcecc('0x32')](_0x930bcf,function(_0x236afa){if(_0x236afa[_0xcecc('0x2f')]!==_0xcecc('0x41')){var _0x570b5d={};_0x570b5d[_0x236afa[_0xcecc('0x2c')]]={'$like':'%'+_0x548e6e[_0xcecc('0x34')][_0xcecc('0x3f')]+'%'};return _0x570b5d;}})});}_0x162be8=_[_0xcecc('0x40')]({},_0x162be8,_0x548e6e[_0xcecc('0x42')]);var _0x2945be={'where':_0x162be8['where']};return db[_0xcecc('0x43')][_0xcecc('0x21')](_0x2945be)[_0xcecc('0x29')](function(_0xd2f0ee){_0x199e7c['count']=_0xd2f0ee;if(_0x548e6e[_0xcecc('0x34')][_0xcecc('0x44')]){_0x162be8[_0xcecc('0x45')]=[{'all':!![]}];}return db['VtigerField'][_0xcecc('0x46')](_0x162be8);})[_0xcecc('0x29')](function(_0x4dae8e){_0x199e7c[_0xcecc('0x47')]=_0x4dae8e;return _0x199e7c;})[_0xcecc('0x29')](respondWithFilteredResult(_0x47e336,_0x162be8))[_0xcecc('0x48')](handleError(_0x47e336,null));};exports[_0xcecc('0x49')]=function(_0x2803ba,_0xb0afb9){var _0x29feaa={'raw':!![],'where':{'id':_0x2803ba['params']['id']}},_0x464fcc={};_0x464fcc['model']=_[_0xcecc('0x33')](db[_0xcecc('0x43')][_0xcecc('0x4a')]);_0x464fcc[_0xcecc('0x34')]=_[_0xcecc('0x33')](_0x2803ba[_0xcecc('0x34')]);_0x464fcc[_0xcecc('0x35')]=_[_0xcecc('0x37')](_0x464fcc[_0xcecc('0x31')],_0x464fcc[_0xcecc('0x34')]);_0x29feaa[_0xcecc('0x36')]=_[_0xcecc('0x37')](_0x464fcc[_0xcecc('0x31')],qs['fields'](_0x2803ba[_0xcecc('0x34')][_0xcecc('0x38')]));_0x29feaa[_0xcecc('0x36')]=_0x29feaa[_0xcecc('0x36')][_0xcecc('0x39')]?_0x29feaa['attributes']:_0x464fcc[_0xcecc('0x31')];if(_0x2803ba['query'][_0xcecc('0x44')]){_0x29feaa[_0xcecc('0x45')]=[{'all':!![]}];}_0x29feaa=_['merge']({},_0x29feaa,_0x2803ba[_0xcecc('0x42')]);return db[_0xcecc('0x43')]['find'](_0x29feaa)[_0xcecc('0x29')](handleEntityNotFound(_0xb0afb9,null))[_0xcecc('0x29')](respondWithResult(_0xb0afb9,null))[_0xcecc('0x48')](handleError(_0xb0afb9,null));};exports[_0xcecc('0x4b')]=function(_0x1a5f37,_0x403f03){return db[_0xcecc('0x43')][_0xcecc('0x4b')](_0x1a5f37[_0xcecc('0x4c')],{})[_0xcecc('0x29')](respondWithResult(_0x403f03,0xc9))[_0xcecc('0x48')](handleError(_0x403f03,null));};exports['update']=function(_0xdf0800,_0x2f5d40){if(_0xdf0800[_0xcecc('0x4c')]['id']){delete _0xdf0800['body']['id'];}return db['VtigerField'][_0xcecc('0x4d')]({'where':{'id':_0xdf0800[_0xcecc('0x4e')]['id']}})[_0xcecc('0x29')](handleEntityNotFound(_0x2f5d40,null))[_0xcecc('0x29')](saveUpdates(_0xdf0800[_0xcecc('0x4c')],null))[_0xcecc('0x29')](respondWithResult(_0x2f5d40,null))['catch'](handleError(_0x2f5d40,null));};exports['destroy']=function(_0x4e354d,_0x7863b){return db[_0xcecc('0x43')]['find']({'where':{'id':_0x4e354d[_0xcecc('0x4e')]['id']}})[_0xcecc('0x29')](handleEntityNotFound(_0x7863b,null))[_0xcecc('0x29')](removeEntity(_0x7863b,null))[_0xcecc('0x48')](handleError(_0x7863b,null));}; \ No newline at end of file +var _0x7f96=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','name','send','index','VtigerField','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x396ead,_0x2b4d16){var _0x4a55a1=function(_0x971acc){while(--_0x971acc){_0x396ead['push'](_0x396ead['shift']());}};_0x4a55a1(++_0x2b4d16);}(_0x7f96,0x145));var _0x67f9=function(_0x4212de,_0x1d71bb){_0x4212de=_0x4212de-0x0;var _0x1f76b6=_0x7f96[_0x4212de];return _0x1f76b6;};'use strict';var emlformat=require(_0x67f9('0x0'));var rimraf=require(_0x67f9('0x1'));var zipdir=require(_0x67f9('0x2'));var jsonpatch=require(_0x67f9('0x3'));var rp=require(_0x67f9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x67f9('0x5'));var path=require(_0x67f9('0x6'));var sox=require(_0x67f9('0x7'));var csv=require(_0x67f9('0x8'));var ejs=require(_0x67f9('0x9'));var fs=require('fs');var fs_extra=require(_0x67f9('0xa'));var _=require(_0x67f9('0xb'));var squel=require(_0x67f9('0xc'));var crypto=require('crypto');var jsforce=require(_0x67f9('0xd'));var deskjs=require(_0x67f9('0xe'));var toCsv=require(_0x67f9('0x8'));var querystring=require(_0x67f9('0xf'));var Papa=require(_0x67f9('0x10'));var Redis=require(_0x67f9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x67f9('0x12'));var as=require(_0x67f9('0x13'));var hardwareService=require(_0x67f9('0x14'));var logger=require(_0x67f9('0x15'))(_0x67f9('0x16'));var utils=require(_0x67f9('0x17'));var config=require(_0x67f9('0x18'));var licenseUtil=require(_0x67f9('0x19'));var db=require(_0x67f9('0x1a'))['db'];function respondWithStatusCode(_0x45a6c9,_0x7b9461){_0x7b9461=_0x7b9461||0xcc;return function(_0x1165b3){if(_0x1165b3){return _0x45a6c9['sendStatus'](_0x7b9461);}return _0x45a6c9[_0x67f9('0x1b')](_0x7b9461)['end']();};}function respondWithResult(_0x5a2fbd,_0x1af7cb){_0x1af7cb=_0x1af7cb||0xc8;return function(_0x196630){if(_0x196630){return _0x5a2fbd[_0x67f9('0x1b')](_0x1af7cb)[_0x67f9('0x1c')](_0x196630);}};}function respondWithFilteredResult(_0xe8f933,_0x2aface){return function(_0x1cb90c){if(_0x1cb90c){var _0x219d1a=typeof _0x2aface[_0x67f9('0x1d')]==='undefined'&&typeof _0x2aface['limit']===_0x67f9('0x1e');var _0x5a756f=_0x1cb90c[_0x67f9('0x1f')];var _0x414f2b=_0x219d1a?0x0:_0x2aface['offset'];var _0x1a599d=_0x219d1a?_0x1cb90c[_0x67f9('0x1f')]:_0x2aface[_0x67f9('0x1d')]+_0x2aface[_0x67f9('0x20')];var _0x3e1941;if(_0x1a599d>=_0x5a756f){_0x1a599d=_0x5a756f;_0x3e1941=0xc8;}else{_0x3e1941=0xce;}_0xe8f933[_0x67f9('0x1b')](_0x3e1941);return _0xe8f933[_0x67f9('0x21')]('Content-Range',_0x414f2b+'-'+_0x1a599d+'/'+_0x5a756f)[_0x67f9('0x1c')](_0x1cb90c);}return null;};}function patchUpdates(_0x4c936c){return function(_0x308c4e){try{jsonpatch[_0x67f9('0x22')](_0x308c4e,_0x4c936c,!![]);}catch(_0x474b0f){return BPromise[_0x67f9('0x23')](_0x474b0f);}return _0x308c4e[_0x67f9('0x24')]();};}function saveUpdates(_0x1f1e1d,_0xad4b9f){return function(_0x2118a4){if(_0x2118a4){return _0x2118a4[_0x67f9('0x25')](_0x1f1e1d)[_0x67f9('0x26')](function(_0x19d60a){return _0x19d60a;});}return null;};}function removeEntity(_0x572b7d,_0x17db7d){return function(_0x36803c){if(_0x36803c){return _0x36803c[_0x67f9('0x27')]()[_0x67f9('0x26')](function(){_0x572b7d[_0x67f9('0x1b')](0xcc)[_0x67f9('0x28')]();});}};}function handleEntityNotFound(_0x5b55fc,_0x305558){return function(_0x49e32b){if(!_0x49e32b){_0x5b55fc['sendStatus'](0x194);}return _0x49e32b;};}function handleError(_0x36aa8d,_0x195d2e){_0x195d2e=_0x195d2e||0x1f4;return function(_0x150727){logger['error'](_0x150727['stack']);if(_0x150727[_0x67f9('0x29')]){delete _0x150727[_0x67f9('0x29')];}_0x36aa8d[_0x67f9('0x1b')](_0x195d2e)[_0x67f9('0x2a')](_0x150727);};}exports[_0x67f9('0x2b')]=function(_0xf4c14c,_0x1c6bcc){var _0x4cb47a={},_0x5c1ced={},_0x5104f8={'count':0x0,'rows':[]};var _0x160241=_['map'](db[_0x67f9('0x2c')]['rawAttributes'],function(_0x198409){return{'name':_0x198409['fieldName'],'type':_0x198409[_0x67f9('0x2d')][_0x67f9('0x2e')]};});_0x5c1ced[_0x67f9('0x2f')]=_[_0x67f9('0x30')](_0x160241,'name');_0x5c1ced[_0x67f9('0x31')]=_[_0x67f9('0x32')](_0xf4c14c[_0x67f9('0x31')]);_0x5c1ced[_0x67f9('0x33')]=_['intersection'](_0x5c1ced['model'],_0x5c1ced['query']);_0x4cb47a[_0x67f9('0x34')]=_[_0x67f9('0x35')](_0x5c1ced[_0x67f9('0x2f')],qs['fields'](_0xf4c14c['query'][_0x67f9('0x36')]));_0x4cb47a[_0x67f9('0x34')]=_0x4cb47a['attributes'][_0x67f9('0x37')]?_0x4cb47a[_0x67f9('0x34')]:_0x5c1ced[_0x67f9('0x2f')];if(!_0xf4c14c[_0x67f9('0x31')][_0x67f9('0x38')](_0x67f9('0x39'))){_0x4cb47a[_0x67f9('0x20')]=qs[_0x67f9('0x20')](_0xf4c14c['query'][_0x67f9('0x20')]);_0x4cb47a[_0x67f9('0x1d')]=qs[_0x67f9('0x1d')](_0xf4c14c['query']['offset']);}_0x4cb47a[_0x67f9('0x3a')]=qs[_0x67f9('0x3b')](_0xf4c14c[_0x67f9('0x31')]['sort']);_0x4cb47a[_0x67f9('0x3c')]=qs['filters'](_[_0x67f9('0x3d')](_0xf4c14c[_0x67f9('0x31')],_0x5c1ced[_0x67f9('0x33')]),_0x160241);if(_0xf4c14c[_0x67f9('0x31')][_0x67f9('0x3e')]){_0x4cb47a[_0x67f9('0x3c')]=_[_0x67f9('0x3f')](_0x4cb47a[_0x67f9('0x3c')],{'$or':_[_0x67f9('0x30')](_0x160241,function(_0x1fcf89){if(_0x1fcf89[_0x67f9('0x2d')]!==_0x67f9('0x40')){var _0x258a41={};_0x258a41[_0x1fcf89[_0x67f9('0x29')]]={'$like':'%'+_0xf4c14c['query'][_0x67f9('0x3e')]+'%'};return _0x258a41;}})});}_0x4cb47a=_[_0x67f9('0x3f')]({},_0x4cb47a,_0xf4c14c[_0x67f9('0x41')]);var _0x4c4097={'where':_0x4cb47a[_0x67f9('0x3c')]};return db['VtigerField']['count'](_0x4c4097)[_0x67f9('0x26')](function(_0x5d5edd){_0x5104f8[_0x67f9('0x1f')]=_0x5d5edd;if(_0xf4c14c[_0x67f9('0x31')][_0x67f9('0x42')]){_0x4cb47a[_0x67f9('0x43')]=[{'all':!![]}];}return db[_0x67f9('0x2c')][_0x67f9('0x44')](_0x4cb47a);})[_0x67f9('0x26')](function(_0x5f3321){_0x5104f8[_0x67f9('0x45')]=_0x5f3321;return _0x5104f8;})['then'](respondWithFilteredResult(_0x1c6bcc,_0x4cb47a))['catch'](handleError(_0x1c6bcc,null));};exports[_0x67f9('0x46')]=function(_0x3b4c23,_0x5217ce){var _0x207b19={'raw':!![],'where':{'id':_0x3b4c23[_0x67f9('0x47')]['id']}},_0x22bccc={};_0x22bccc[_0x67f9('0x2f')]=_[_0x67f9('0x32')](db[_0x67f9('0x2c')][_0x67f9('0x48')]);_0x22bccc[_0x67f9('0x31')]=_[_0x67f9('0x32')](_0x3b4c23['query']);_0x22bccc[_0x67f9('0x33')]=_[_0x67f9('0x35')](_0x22bccc['model'],_0x22bccc[_0x67f9('0x31')]);_0x207b19['attributes']=_[_0x67f9('0x35')](_0x22bccc[_0x67f9('0x2f')],qs[_0x67f9('0x36')](_0x3b4c23[_0x67f9('0x31')][_0x67f9('0x36')]));_0x207b19[_0x67f9('0x34')]=_0x207b19[_0x67f9('0x34')][_0x67f9('0x37')]?_0x207b19['attributes']:_0x22bccc[_0x67f9('0x2f')];if(_0x3b4c23[_0x67f9('0x31')][_0x67f9('0x42')]){_0x207b19[_0x67f9('0x43')]=[{'all':!![]}];}_0x207b19=_['merge']({},_0x207b19,_0x3b4c23[_0x67f9('0x41')]);return db[_0x67f9('0x2c')][_0x67f9('0x49')](_0x207b19)[_0x67f9('0x26')](handleEntityNotFound(_0x5217ce,null))[_0x67f9('0x26')](respondWithResult(_0x5217ce,null))[_0x67f9('0x4a')](handleError(_0x5217ce,null));};exports[_0x67f9('0x4b')]=function(_0x10cbdf,_0x3661bb){return db[_0x67f9('0x2c')]['create'](_0x10cbdf[_0x67f9('0x4c')],{})[_0x67f9('0x26')](respondWithResult(_0x3661bb,0xc9))[_0x67f9('0x4a')](handleError(_0x3661bb,null));};exports[_0x67f9('0x25')]=function(_0x518e93,_0x4324f8){if(_0x518e93[_0x67f9('0x4c')]['id']){delete _0x518e93[_0x67f9('0x4c')]['id'];}return db[_0x67f9('0x2c')][_0x67f9('0x49')]({'where':{'id':_0x518e93['params']['id']}})[_0x67f9('0x26')](handleEntityNotFound(_0x4324f8,null))[_0x67f9('0x26')](saveUpdates(_0x518e93['body'],null))[_0x67f9('0x26')](respondWithResult(_0x4324f8,null))[_0x67f9('0x4a')](handleError(_0x4324f8,null));};exports[_0x67f9('0x27')]=function(_0x363137,_0x281b98){return db[_0x67f9('0x2c')]['find']({'where':{'id':_0x363137[_0x67f9('0x47')]['id']}})[_0x67f9('0x26')](handleEntityNotFound(_0x281b98,null))[_0x67f9('0x26')](removeEntity(_0x281b98,null))[_0x67f9('0x4a')](handleError(_0x281b98,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b6b0963..0191cfe 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 _0x703c=['moment','request-promise','path','rimraf','../../config/environment','define','VtigerField','int_vtiger_fields','idField','lodash','util','../../config/logger','api'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x703c,0x168));var _0xc703=function(_0x4fd64a,_0x55368b){_0x4fd64a=_0x4fd64a-0x0;var _0x5a3c3f=_0x703c[_0x4fd64a];return _0x5a3c3f;};'use strict';var _=require(_0xc703('0x0'));var util=require(_0xc703('0x1'));var logger=require(_0xc703('0x2'))(_0xc703('0x3'));var moment=require(_0xc703('0x4'));var BPromise=require('bluebird');var rp=require(_0xc703('0x5'));var fs=require('fs');var path=require(_0xc703('0x6'));var rimraf=require(_0xc703('0x7'));var config=require(_0xc703('0x8'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x852740,_0x5ddf2a){return _0x852740[_0xc703('0x9')](_0xc703('0xa'),attributes,{'tableName':_0xc703('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xc703('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cf9=['exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','api','moment','rimraf','./intVtigerField.attributes'];(function(_0x2e1c53,_0x3b9436){var _0x5e68be=function(_0x5ccad6){while(--_0x5ccad6){_0x2e1c53['push'](_0x2e1c53['shift']());}};_0x5e68be(++_0x3b9436);}(_0x3cf9,0x1ac));var _0x93cf=function(_0x14696e,_0x2f6835){_0x14696e=_0x14696e-0x0;var _0x183d45=_0x3cf9[_0x14696e];return _0x183d45;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x93cf('0x0'));var moment=require(_0x93cf('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x93cf('0x2'));var config=require('../../config/environment');var attributes=require(_0x93cf('0x3'));module[_0x93cf('0x4')]=function(_0x6b4185,_0x2e1dd9){return _0x6b4185[_0x93cf('0x5')](_0x93cf('0x6'),attributes,{'tableName':_0x93cf('0x7'),'paranoid':![],'indexes':[{'name':_0x93cf('0x8'),'fields':['idField','FieldId'],'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 906f01e..0d93462 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 _0x19e6=['jayson/promise','client','http','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4247e5,_0x30b7bb){var _0x5ee3d5=function(_0x5056cd){while(--_0x5056cd){_0x4247e5['push'](_0x4247e5['shift']());}};_0x5ee3d5(++_0x30b7bb);}(_0x19e6,0x1ac));var _0x619e=function(_0x51e206,_0x1cdc2d){_0x51e206=_0x51e206-0x0;var _0x44b6f8=_0x19e6[_0x51e206];return _0x44b6f8;};'use strict';var _=require(_0x619e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x619e('0x1'));var rs=require(_0x619e('0x2'));var fs=require('fs');var Redis=require(_0x619e('0x3'));var db=require(_0x619e('0x4'))['db'];var utils=require(_0x619e('0x5'));var logger=require(_0x619e('0x6'))(_0x619e('0x7'));var config=require(_0x619e('0x8'));var jayson=require(_0x619e('0x9'));var client=jayson[_0x619e('0xa')][_0x619e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x249a59,_0x36dd9a,_0x3b76c3){return new BPromise(function(_0x590c10,_0x2be90e){return client['request'](_0x249a59,_0x3b76c3)[_0x619e('0xc')](function(_0xb964c9){logger[_0x619e('0xd')]('VtigerField,\x20%s,\x20%s',_0x36dd9a,_0x619e('0xe'));logger[_0x619e('0xf')](_0x619e('0x10'),_0x36dd9a,_0x619e('0xe'),JSON[_0x619e('0x11')](_0xb964c9));if(_0xb964c9[_0x619e('0x12')]){if(_0xb964c9[_0x619e('0x12')][_0x619e('0x13')]===0x1f4){logger['error'](_0x619e('0x14'),_0x36dd9a,_0xb964c9[_0x619e('0x12')][_0x619e('0x15')]);return _0x2be90e(_0xb964c9['error'][_0x619e('0x15')]);}logger[_0x619e('0x12')]('VtigerField,\x20%s,\x20%s',_0x36dd9a,_0xb964c9['error'][_0x619e('0x15')]);return _0x590c10(_0xb964c9[_0x619e('0x12')]['message']);}else{logger[_0x619e('0xd')](_0x619e('0x14'),_0x36dd9a,'request\x20sent');_0x590c10(_0xb964c9[_0x619e('0x16')][_0x619e('0x15')]);}})['catch'](function(_0x554a4b){logger[_0x619e('0x12')]('VtigerField,\x20%s,\x20%s',_0x36dd9a,_0x554a4b);_0x2be90e(_0x554a4b);});});} \ No newline at end of file +var _0x0de9=['then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x56b12d,_0x2d35c8){var _0x48430a=function(_0x3f6ec4){while(--_0x3f6ec4){_0x56b12d['push'](_0x56b12d['shift']());}};_0x48430a(++_0x2d35c8);}(_0x0de9,0xe4));var _0x90de=function(_0x4f5279,_0x1a1413){_0x4f5279=_0x4f5279-0x0;var _0x318486=_0x0de9[_0x4f5279];return _0x318486;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x90de('0x0'));var BPromise=require(_0x90de('0x1'));var rs=require(_0x90de('0x2'));var fs=require('fs');var Redis=require(_0x90de('0x3'));var db=require(_0x90de('0x4'))['db'];var utils=require(_0x90de('0x5'));var logger=require('../../config/logger')(_0x90de('0x6'));var config=require(_0x90de('0x7'));var jayson=require(_0x90de('0x8'));var client=jayson[_0x90de('0x9')][_0x90de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a9940,_0x31950e,_0x24c8b2){return new BPromise(function(_0x4c3582,_0x41ade5){return client[_0x90de('0xb')](_0x2a9940,_0x24c8b2)[_0x90de('0xc')](function(_0x404119){logger[_0x90de('0xd')](_0x90de('0xe'),_0x31950e,'request\x20sent');logger[_0x90de('0xf')](_0x90de('0x10'),_0x31950e,_0x90de('0x11'),JSON[_0x90de('0x12')](_0x404119));if(_0x404119[_0x90de('0x13')]){if(_0x404119[_0x90de('0x13')][_0x90de('0x14')]===0x1f4){logger[_0x90de('0x13')](_0x90de('0xe'),_0x31950e,_0x404119['error']['message']);return _0x41ade5(_0x404119[_0x90de('0x13')][_0x90de('0x15')]);}logger[_0x90de('0x13')](_0x90de('0xe'),_0x31950e,_0x404119[_0x90de('0x13')][_0x90de('0x15')]);return _0x4c3582(_0x404119[_0x90de('0x13')][_0x90de('0x15')]);}else{logger[_0x90de('0xd')]('VtigerField,\x20%s,\x20%s',_0x31950e,_0x90de('0x11'));_0x4c3582(_0x404119[_0x90de('0x16')][_0x90de('0x15')]);}})[_0x90de('0x17')](function(_0xe3aacc){logger[_0x90de('0x13')](_0x90de('0xe'),_0x31950e,_0xe3aacc);_0x41ade5(_0xe3aacc);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 959a47f..d4f5b32 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 _0x5302=['../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','path','connect-timeout','fs-extra'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5302,0x1b5));var _0x2530=function(_0x125666,_0x3b928c){_0x125666=_0x125666-0x0;var _0x1e52be=_0x5302[_0x125666];return _0x1e52be;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2530('0x0'));var timeout=require(_0x2530('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2530('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x2530('0x3'));var config=require('../../config/environment');var controller=require(_0x2530('0x4'));router[_0x2530('0x5')]('/',auth[_0x2530('0x6')](),controller[_0x2530('0x7')]);router[_0x2530('0x5')]('/:id',auth[_0x2530('0x6')](),controller[_0x2530('0x8')]);router[_0x2530('0x5')](_0x2530('0x9'),auth[_0x2530('0x6')](),controller[_0x2530('0xa')]);router[_0x2530('0x5')](_0x2530('0xb'),auth[_0x2530('0x6')](),controller[_0x2530('0xc')]);router[_0x2530('0xd')]('/',auth[_0x2530('0x6')](),controller[_0x2530('0xe')]);router[_0x2530('0xd')](_0x2530('0x9'),auth[_0x2530('0x6')](),controller[_0x2530('0xf')]);router['put'](_0x2530('0x10'),auth[_0x2530('0x6')](),controller[_0x2530('0x11')]);router[_0x2530('0x12')](_0x2530('0x10'),auth[_0x2530('0x6')](),controller[_0x2530('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd061=['get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller'];(function(_0x230553,_0x267f31){var _0x29b3bc=function(_0x51a655){while(--_0x51a655){_0x230553['push'](_0x230553['shift']());}};_0x29b3bc(++_0x267f31);}(_0xd061,0x150));var _0x1d06=function(_0x55ba90,_0x3ab4bc){_0x55ba90=_0x55ba90-0x0;var _0x536129=_0xd061[_0x55ba90];return _0x536129;};'use strict';var multer=require(_0x1d06('0x0'));var util=require(_0x1d06('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d06('0x2'));var router=express[_0x1d06('0x3')]();var fs_extra=require(_0x1d06('0x4'));var auth=require(_0x1d06('0x5'));var interaction=require(_0x1d06('0x6'));var config=require(_0x1d06('0x7'));var controller=require(_0x1d06('0x8'));router[_0x1d06('0x9')]('/',auth['isAuthenticated'](),controller[_0x1d06('0xa')]);router[_0x1d06('0x9')](_0x1d06('0xb'),auth[_0x1d06('0xc')](),controller['show']);router[_0x1d06('0x9')](_0x1d06('0xd'),auth[_0x1d06('0xc')](),controller[_0x1d06('0xe')]);router['get'](_0x1d06('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x1d06('0x10')]('/',auth[_0x1d06('0xc')](),controller[_0x1d06('0x11')]);router[_0x1d06('0x10')](_0x1d06('0xd'),auth[_0x1d06('0xc')](),controller[_0x1d06('0x12')]);router[_0x1d06('0x13')](_0x1d06('0xb'),auth[_0x1d06('0xc')](),controller[_0x1d06('0x14')]);router[_0x1d06('0x15')](_0x1d06('0xb'),auth[_0x1d06('0xc')](),controller['destroy']);module[_0x1d06('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 7d89ca1..61e8599 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 _0x4489=['exports','STRING','username','token','integrationTab','newTab','sequelize'];(function(_0x144049,_0x4e6ccf){var _0x517caa=function(_0x7416b8){while(--_0x7416b8){_0x144049['push'](_0x144049['shift']());}};_0x517caa(++_0x4e6ccf);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9448('0x0'));module[_0x9448('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9448('0x2')]},'username':{'type':Sequelize[_0x9448('0x2')],'unique':_0x9448('0x3')},'password':{'type':Sequelize[_0x9448('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password',_0x9448('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x9448('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9448('0x5'),_0x9448('0x6')),'defaultValue':_0x9448('0x5')}}; \ No newline at end of file +var _0x044a=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','password','token'];(function(_0x3c79ed,_0x424a37){var _0x3351ea=function(_0x181f9c){while(--_0x181f9c){_0x3c79ed['push'](_0x3c79ed['shift']());}};_0x3351ea(++_0x424a37);}(_0x044a,0x173));var _0xa044=function(_0x51d424,_0x3d1305){_0x51d424=_0x51d424-0x0;var _0x5d3745=_0x044a[_0x51d424];return _0x5d3745;};'use strict';var Sequelize=require(_0xa044('0x0'));module[_0xa044('0x1')]={'name':{'type':Sequelize[_0xa044('0x2')]},'description':{'type':Sequelize[_0xa044('0x2')]},'username':{'type':Sequelize[_0xa044('0x2')],'unique':_0xa044('0x3')},'password':{'type':Sequelize[_0xa044('0x2')]},'token':{'type':Sequelize[_0xa044('0x2')]},'remoteUri':{'type':Sequelize[_0xa044('0x2')],'unique':_0xa044('0x4')},'authType':{'type':Sequelize['ENUM'](_0xa044('0x5'),_0xa044('0x6')),'defaultValue':_0xa044('0x5')},'serverUrl':{'type':Sequelize[_0xa044('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa044('0x7'),_0xa044('0x8')),'defaultValue':_0xa044('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 3dc7417..981f072 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 _0x36ee=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../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','limit','count','set','apply','reject','update','then','destroy','error','name','index','map','ZendeskAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','pick','options','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','token','remoteUri','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','includes','position','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','zip-dir','request-promise','moment','bluebird'];(function(_0x2d2511,_0x1a5ed5){var _0x5a8ee1=function(_0x13a8a9){while(--_0x13a8a9){_0x2d2511['push'](_0x2d2511['shift']());}};_0x5a8ee1(++_0x1a5ed5);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x32981d,_0x27841e){_0x27841e=_0x27841e||0xcc;return function(_0x23abfb){if(_0x23abfb){return _0x32981d[_0xe36e('0x19')](_0x27841e);}return _0x32981d['status'](_0x27841e)[_0xe36e('0x1a')]();};}function respondWithResult(_0x521afa,_0x525155){_0x525155=_0x525155||0xc8;return function(_0x27ff47){if(_0x27ff47){return _0x521afa[_0xe36e('0x1b')](_0x525155)[_0xe36e('0x1c')](_0x27ff47);}};}function respondWithFilteredResult(_0x278135,_0xd6828e){return function(_0x924cd5){if(_0x924cd5){var _0x2096f6=typeof _0xd6828e[_0xe36e('0x1d')]===_0xe36e('0x1e')&&typeof _0xd6828e[_0xe36e('0x1f')]==='undefined';var _0x333554=_0x924cd5[_0xe36e('0x20')];var _0x56c019=_0x2096f6?0x0:_0xd6828e[_0xe36e('0x1d')];var _0x533c06=_0x2096f6?_0x924cd5[_0xe36e('0x20')]:_0xd6828e[_0xe36e('0x1d')]+_0xd6828e['limit'];var _0x472825;if(_0x533c06>=_0x333554){_0x533c06=_0x333554;_0x472825=0xc8;}else{_0x472825=0xce;}_0x278135[_0xe36e('0x1b')](_0x472825);return _0x278135[_0xe36e('0x21')]('Content-Range',_0x56c019+'-'+_0x533c06+'/'+_0x333554)[_0xe36e('0x1c')](_0x924cd5);}return null;};}function patchUpdates(_0x21bcf9){return function(_0x3f0ae3){try{jsonpatch[_0xe36e('0x22')](_0x3f0ae3,_0x21bcf9,!![]);}catch(_0x2c4e30){return BPromise[_0xe36e('0x23')](_0x2c4e30);}return _0x3f0ae3['save']();};}function saveUpdates(_0xd71137,_0x4f214a){return function(_0x23bcf3){if(_0x23bcf3){return _0x23bcf3[_0xe36e('0x24')](_0xd71137)[_0xe36e('0x25')](function(_0x53e13a){return _0x53e13a;});}return null;};}function removeEntity(_0x598a7a,_0x4749a8){return function(_0x10818d){if(_0x10818d){return _0x10818d[_0xe36e('0x26')]()[_0xe36e('0x25')](function(){_0x598a7a[_0xe36e('0x1b')](0xcc)[_0xe36e('0x1a')]();});}};}function handleEntityNotFound(_0x1a045c,_0x5ac484){return function(_0x3cafbf){if(!_0x3cafbf){_0x1a045c[_0xe36e('0x19')](0x194);}return _0x3cafbf;};}function handleError(_0x10597f,_0x262caa){_0x262caa=_0x262caa||0x1f4;return function(_0x5e58d8){logger[_0xe36e('0x27')](_0x5e58d8['stack']);if(_0x5e58d8[_0xe36e('0x28')]){delete _0x5e58d8['name'];}_0x10597f[_0xe36e('0x1b')](_0x262caa)['send'](_0x5e58d8);};}exports[_0xe36e('0x29')]=function(_0x4c5d98,_0x3b1045){var _0x59548b={},_0x4bb75b={},_0x5d8fd8={'count':0x0,'rows':[]};var _0x5b5d53=_[_0xe36e('0x2a')](db[_0xe36e('0x2b')]['rawAttributes'],function(_0x4ac819){return{'name':_0x4ac819[_0xe36e('0x2c')],'type':_0x4ac819[_0xe36e('0x2d')][_0xe36e('0x2e')]};});_0x4bb75b[_0xe36e('0x2f')]=_[_0xe36e('0x2a')](_0x5b5d53,_0xe36e('0x28'));_0x4bb75b['query']=_[_0xe36e('0x30')](_0x4c5d98[_0xe36e('0x31')]);_0x4bb75b['filters']=_[_0xe36e('0x32')](_0x4bb75b[_0xe36e('0x2f')],_0x4bb75b[_0xe36e('0x31')]);_0x59548b[_0xe36e('0x33')]=_[_0xe36e('0x32')](_0x4bb75b[_0xe36e('0x2f')],qs[_0xe36e('0x34')](_0x4c5d98[_0xe36e('0x31')][_0xe36e('0x34')]));_0x59548b[_0xe36e('0x33')]=_0x59548b[_0xe36e('0x33')]['length']?_0x59548b[_0xe36e('0x33')]:_0x4bb75b['model'];if(!_0x4c5d98['query'][_0xe36e('0x35')]('nolimit')){_0x59548b[_0xe36e('0x1f')]=qs[_0xe36e('0x1f')](_0x4c5d98[_0xe36e('0x31')][_0xe36e('0x1f')]);_0x59548b['offset']=qs['offset'](_0x4c5d98[_0xe36e('0x31')][_0xe36e('0x1d')]);}_0x59548b[_0xe36e('0x36')]=qs[_0xe36e('0x37')](_0x4c5d98['query'][_0xe36e('0x37')]);_0x59548b[_0xe36e('0x38')]=qs[_0xe36e('0x39')](_['pick'](_0x4c5d98[_0xe36e('0x31')],_0x4bb75b[_0xe36e('0x39')]),_0x5b5d53);if(_0x4c5d98['query'][_0xe36e('0x3a')]){_0x59548b[_0xe36e('0x38')]=_[_0xe36e('0x3b')](_0x59548b[_0xe36e('0x38')],{'$or':_[_0xe36e('0x2a')](_0x5b5d53,function(_0x2fc909){if(_0x2fc909[_0xe36e('0x2d')]!==_0xe36e('0x3c')){var _0x458a4e={};_0x458a4e[_0x2fc909[_0xe36e('0x28')]]={'$like':'%'+_0x4c5d98[_0xe36e('0x31')][_0xe36e('0x3a')]+'%'};return _0x458a4e;}})});}_0x59548b=_[_0xe36e('0x3b')]({},_0x59548b,_0x4c5d98['options']);var _0x23d36e={'where':_0x59548b[_0xe36e('0x38')]};return db[_0xe36e('0x2b')][_0xe36e('0x20')](_0x23d36e)[_0xe36e('0x25')](function(_0x4d133b){_0x5d8fd8['count']=_0x4d133b;if(_0x4c5d98[_0xe36e('0x31')][_0xe36e('0x3d')]){_0x59548b[_0xe36e('0x3e')]=[{'all':!![]}];}return db[_0xe36e('0x2b')][_0xe36e('0x3f')](_0x59548b);})[_0xe36e('0x25')](function(_0xff4f63){_0x5d8fd8[_0xe36e('0x40')]=_0xff4f63;return _0x5d8fd8;})['then'](respondWithFilteredResult(_0x3b1045,_0x59548b))[_0xe36e('0x41')](handleError(_0x3b1045,null));};exports[_0xe36e('0x42')]=function(_0x4788a0,_0x21dc35){var _0x5ef3e4={'raw':![],'where':{'id':_0x4788a0[_0xe36e('0x43')]['id']}},_0x23e344={};_0x23e344[_0xe36e('0x2f')]=_[_0xe36e('0x30')](db[_0xe36e('0x2b')]['rawAttributes']);_0x23e344[_0xe36e('0x31')]=_[_0xe36e('0x30')](_0x4788a0[_0xe36e('0x31')]);_0x23e344[_0xe36e('0x39')]=_[_0xe36e('0x32')](_0x23e344[_0xe36e('0x2f')],_0x23e344['query']);_0x5ef3e4[_0xe36e('0x33')]=_[_0xe36e('0x32')](_0x23e344[_0xe36e('0x2f')],qs[_0xe36e('0x34')](_0x4788a0[_0xe36e('0x31')]['fields']));_0x5ef3e4[_0xe36e('0x33')]=_0x5ef3e4[_0xe36e('0x33')][_0xe36e('0x44')]?_0x5ef3e4[_0xe36e('0x33')]:_0x23e344[_0xe36e('0x2f')];if(_0x4788a0[_0xe36e('0x31')][_0xe36e('0x3d')]){_0x5ef3e4[_0xe36e('0x3e')]=[{'all':!![]}];}_0x5ef3e4=_[_0xe36e('0x3b')]({},_0x5ef3e4,_0x4788a0['options']);return db['ZendeskAccount'][_0xe36e('0x45')](_0x5ef3e4)['then'](handleEntityNotFound(_0x21dc35,null))[_0xe36e('0x25')](respondWithResult(_0x21dc35,null))[_0xe36e('0x41')](handleError(_0x21dc35,null));};exports[_0xe36e('0x46')]=function(_0x25aa09,_0x51641c){return db[_0xe36e('0x2b')][_0xe36e('0x46')](_0x25aa09['body'],{})[_0xe36e('0x25')](respondWithResult(_0x51641c,0xc9))[_0xe36e('0x41')](handleError(_0x51641c,null));};exports[_0xe36e('0x24')]=function(_0x42eae5,_0x15895d){if(_0x42eae5[_0xe36e('0x47')]['id']){delete _0x42eae5[_0xe36e('0x47')]['id'];}return db[_0xe36e('0x2b')][_0xe36e('0x45')]({'where':{'id':_0x42eae5[_0xe36e('0x43')]['id']}})[_0xe36e('0x25')](handleEntityNotFound(_0x15895d,null))[_0xe36e('0x25')](saveUpdates(_0x42eae5[_0xe36e('0x47')],null))[_0xe36e('0x25')](respondWithResult(_0x15895d,null))[_0xe36e('0x41')](handleError(_0x15895d,null));};exports['destroy']=function(_0x3262bf,_0x55aadf){return db['ZendeskAccount'][_0xe36e('0x45')]({'where':{'id':_0x3262bf[_0xe36e('0x43')]['id']}})['then'](handleEntityNotFound(_0x55aadf,null))[_0xe36e('0x25')](removeEntity(_0x55aadf,null))[_0xe36e('0x41')](handleError(_0x55aadf,null));};exports[_0xe36e('0x48')]=function(_0x1f4a5d,_0xa4be24,_0x22788b){var _0x935e84={};var _0x41e10d={};var _0x4d5762;var _0x55d190;return db[_0xe36e('0x2b')][_0xe36e('0x49')]({'where':{'id':_0x1f4a5d['params']['id']}})[_0xe36e('0x25')](handleEntityNotFound(_0xa4be24,null))[_0xe36e('0x25')](function(_0x3e1040){if(_0x3e1040){_0x4d5762=_0x3e1040;_0x41e10d[_0xe36e('0x2f')]=_[_0xe36e('0x30')](db['ZendeskConfiguration']['rawAttributes']);_0x41e10d['query']=_['keys'](_0x1f4a5d[_0xe36e('0x31')]);_0x41e10d[_0xe36e('0x39')]=_[_0xe36e('0x32')](_0x41e10d[_0xe36e('0x2f')],_0x41e10d[_0xe36e('0x31')]);_0x935e84[_0xe36e('0x33')]=_[_0xe36e('0x32')](_0x41e10d[_0xe36e('0x2f')],qs[_0xe36e('0x34')](_0x1f4a5d['query'][_0xe36e('0x34')]));_0x935e84[_0xe36e('0x33')]=_0x935e84['attributes'][_0xe36e('0x44')]?_0x935e84[_0xe36e('0x33')]:_0x41e10d[_0xe36e('0x2f')];_0x935e84[_0xe36e('0x36')]=qs[_0xe36e('0x37')](_0x1f4a5d[_0xe36e('0x31')][_0xe36e('0x37')]);_0x935e84[_0xe36e('0x38')]=qs[_0xe36e('0x39')](_[_0xe36e('0x4a')](_0x1f4a5d[_0xe36e('0x31')],_0x41e10d[_0xe36e('0x39')]));if(_0x1f4a5d[_0xe36e('0x31')][_0xe36e('0x3a')]){_0x935e84[_0xe36e('0x38')]=_[_0xe36e('0x3b')](_0x935e84[_0xe36e('0x38')],{'$or':_[_0xe36e('0x2a')](_0x935e84[_0xe36e('0x33')],function(_0x3e7d8d){var _0x362204={};_0x362204[_0x3e7d8d]={'$like':'%'+_0x1f4a5d[_0xe36e('0x31')][_0xe36e('0x3a')]+'%'};return _0x362204;})});}_0x935e84=_[_0xe36e('0x3b')]({},_0x935e84,_0x1f4a5d[_0xe36e('0x4b')]);return _0x4d5762['getConfigurations'](_0x935e84);}})[_0xe36e('0x25')](function(_0xedaa96){if(_0xedaa96){_0x55d190=_0xedaa96['length'];if(!_0x1f4a5d[_0xe36e('0x31')][_0xe36e('0x35')](_0xe36e('0x4c'))){_0x935e84[_0xe36e('0x1f')]=qs[_0xe36e('0x1f')](_0x1f4a5d[_0xe36e('0x31')]['limit']);_0x935e84[_0xe36e('0x1d')]=qs['offset'](_0x1f4a5d[_0xe36e('0x31')][_0xe36e('0x1d')]);}return _0x4d5762[_0xe36e('0x48')](_0x935e84);}})[_0xe36e('0x25')](function(_0x2a767d){if(_0x2a767d){return _0x2a767d?{'count':_0x55d190,'rows':_0x2a767d}:null;}})[_0xe36e('0x25')](respondWithResult(_0xa4be24,null))[_0xe36e('0x41')](handleError(_0xa4be24,null));};exports[_0xe36e('0x4d')]=function(_0x4c8d2b,_0x34c7a5,_0xcafb87){if(_0x4c8d2b['body']['id']){delete _0x4c8d2b[_0xe36e('0x47')]['id'];}return db[_0xe36e('0x2b')][_0xe36e('0x49')]({'where':{'id':_0x4c8d2b[_0xe36e('0x43')]['id']}})[_0xe36e('0x25')](handleEntityNotFound(_0x34c7a5,null))[_0xe36e('0x25')](function(_0x3d4874){if(_0x3d4874){_0x4c8d2b['body'][_0xe36e('0x4e')]=_0x3d4874['id'];_0x4c8d2b[_0xe36e('0x47')][_0xe36e('0x4f')]=integrations[_0xe36e('0x50')](_0x4c8d2b[_0xe36e('0x47')][_0xe36e('0x51')],_0x4c8d2b[_0xe36e('0x47')][_0xe36e('0x2d')]);_0x4c8d2b[_0xe36e('0x47')][_0xe36e('0x52')]=integrations[_0xe36e('0x53')](_0x4c8d2b['body'][_0xe36e('0x51')],_0x4c8d2b[_0xe36e('0x47')][_0xe36e('0x2d')]);return db[_0xe36e('0x54')]['create'](_0x4c8d2b['body'],{'include':[{'model':db[_0xe36e('0x55')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xe36e('0x25')](respondWithResult(_0x34c7a5,null))['catch'](handleError(_0x34c7a5,null));};exports[_0xe36e('0x56')]=function(_0x2f7093,_0x258a63,_0x221a90){var _0x1bd60d='';return db[_0xe36e('0x2b')][_0xe36e('0x49')]({'where':{'id':_0x2f7093[_0xe36e('0x43')]['id']},'attributes':['id',_0xe36e('0x57'),'password',_0xe36e('0x58'),'authType',_0xe36e('0x59')]})['then'](handleEntityNotFound(_0x258a63,null))[_0xe36e('0x25')](function(_0x209e45){if(_0x209e45){_0x1bd60d=_0x209e45[_0xe36e('0x59')];var _0x29a372=_0x1bd60d['slice'](-0x1);if(_0x29a372==='/'){_0x1bd60d=_0x1bd60d['substring'](0x0,_0x1bd60d[_0xe36e('0x5a')](_0x29a372));}var _0x2b44a6={'method':_0xe36e('0x5b'),'uri':util[_0xe36e('0x5c')](_0xe36e('0x5d'),_0x1bd60d,_0xe36e('0x5e')),'json':!![]};switch(_0x209e45['authType']){case _0xe36e('0x5f'):_0x2b44a6[_0xe36e('0x60')]={'Authorization':util['format'](_0xe36e('0x61'),new Buffer(util['format'](_0xe36e('0x62'),_0x209e45[_0xe36e('0x57')],_0x209e45[_0xe36e('0x5f')]))[_0xe36e('0x63')]('base64'))};break;case _0xe36e('0x58'):_0x2b44a6['headers']={'Authorization':util['format'](_0xe36e('0x61'),new Buffer(util[_0xe36e('0x5c')]('%s/token:%s',_0x209e45['username'],_0x209e45[_0xe36e('0x58')]))['toString'](_0xe36e('0x64')))};break;default:throw new db[(_0xe36e('0x65'))][(_0xe36e('0x66'))](_0xe36e('0x67'));}return rp(_0x2b44a6);}})[_0xe36e('0x25')](function(_0x16c26a){if(_0x16c26a){var _0x590885=[_0xe36e('0x68'),_0xe36e('0x69'),_0xe36e('0x6a'),_0xe36e('0x6b')];_['remove'](_0x16c26a[_0xe36e('0x5e')],function(_0x37409f){return _0x590885[_0xe36e('0x6c')](_0x37409f[_0xe36e('0x2d')]);});return{'count':_0x16c26a['ticket_fields'][_0xe36e('0x44')],'rows':_['map'](_0x16c26a[_0xe36e('0x5e')],function(_0x5d3dac){return{'id':_0x5d3dac['id'],'name':_0x5d3dac[_0xe36e('0x6d')]>0x7?_0x5d3dac['title']:_0x5d3dac['type'],'custom':_0x5d3dac[_0xe36e('0x6d')]>0x7?!![]:![],'options':_0x5d3dac[_0xe36e('0x6e')]?_0x5d3dac[_0xe36e('0x6e')]:_0x5d3dac['custom_field_options']?_0x5d3dac[_0xe36e('0x6f')]:[]};})};}})[_0xe36e('0x25')](respondWithResult(_0x258a63,null))['catch'](function(_0x3beba7){var _0x369576=_0x2f7093[_0xe36e('0x31')]['test']?0x1f4:_0x3beba7['statusCode']||0x1f4;logger[_0xe36e('0x27')](_0xe36e('0x70'),_0xe36e('0x56'),_0x369576,JSON[_0xe36e('0x71')](_0x3beba7));delete _0x3beba7[_0xe36e('0x28')];if(_0x369576===0x191){_0x369576=0x190;}_0x258a63['status'](_0x369576)[_0xe36e('0x72')](_0x2f7093[_0xe36e('0x31')][_0xe36e('0x73')]?{'message':_0xe36e('0x74'),'statusCode':_0x3beba7[_0xe36e('0x75')]}:_0x3beba7);});}; \ No newline at end of file +var _0xbaf0=['findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','ZendeskConfiguration','pick','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','%s:%s','toString','headers','%s/token:%s','base64','Sequelize','ValidationError','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','options','includeAll','include'];(function(_0x5cf103,_0x422c80){var _0x5c59e6=function(_0x5b7277){while(--_0x5b7277){_0x5cf103['push'](_0x5cf103['shift']());}};_0x5c59e6(++_0x422c80);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0baf('0x1b'));function respondWithStatusCode(_0xe4378c,_0x5db689){_0x5db689=_0x5db689||0xcc;return function(_0x13df17){if(_0x13df17){return _0xe4378c['sendStatus'](_0x5db689);}return _0xe4378c[_0x0baf('0x1c')](_0x5db689)['end']();};}function respondWithResult(_0x1c76a8,_0x1f50c3){_0x1f50c3=_0x1f50c3||0xc8;return function(_0x7fbf67){if(_0x7fbf67){return _0x1c76a8[_0x0baf('0x1c')](_0x1f50c3)[_0x0baf('0x1d')](_0x7fbf67);}};}function respondWithFilteredResult(_0x469599,_0x4f80a8){return function(_0x4cd79d){if(_0x4cd79d){var _0x2312c7=typeof _0x4f80a8[_0x0baf('0x1e')]===_0x0baf('0x1f')&&typeof _0x4f80a8[_0x0baf('0x20')]===_0x0baf('0x1f');var _0x288a98=_0x4cd79d['count'];var _0x63c820=_0x2312c7?0x0:_0x4f80a8[_0x0baf('0x1e')];var _0x1ef0e5=_0x2312c7?_0x4cd79d[_0x0baf('0x21')]:_0x4f80a8[_0x0baf('0x1e')]+_0x4f80a8[_0x0baf('0x20')];var _0x4ff793;if(_0x1ef0e5>=_0x288a98){_0x1ef0e5=_0x288a98;_0x4ff793=0xc8;}else{_0x4ff793=0xce;}_0x469599['status'](_0x4ff793);return _0x469599[_0x0baf('0x22')](_0x0baf('0x23'),_0x63c820+'-'+_0x1ef0e5+'/'+_0x288a98)[_0x0baf('0x1d')](_0x4cd79d);}return null;};}function patchUpdates(_0x1848e8){return function(_0x1fa92b){try{jsonpatch[_0x0baf('0x24')](_0x1fa92b,_0x1848e8,!![]);}catch(_0x210cd8){return BPromise[_0x0baf('0x25')](_0x210cd8);}return _0x1fa92b[_0x0baf('0x26')]();};}function saveUpdates(_0x15a2c3,_0x54f2fa){return function(_0x334bd6){if(_0x334bd6){return _0x334bd6['update'](_0x15a2c3)[_0x0baf('0x27')](function(_0x5dbf00){return _0x5dbf00;});}return null;};}function removeEntity(_0x4de74c,_0x2ef0aa){return function(_0x48a0e9){if(_0x48a0e9){return _0x48a0e9['destroy']()[_0x0baf('0x27')](function(){_0x4de74c[_0x0baf('0x1c')](0xcc)[_0x0baf('0x28')]();});}};}function handleEntityNotFound(_0x19d9fd,_0x3a1ba1){return function(_0x56b299){if(!_0x56b299){_0x19d9fd[_0x0baf('0x29')](0x194);}return _0x56b299;};}function handleError(_0x4681c5,_0x1ca35a){_0x1ca35a=_0x1ca35a||0x1f4;return function(_0x366e71){logger[_0x0baf('0x2a')](_0x366e71[_0x0baf('0x2b')]);if(_0x366e71[_0x0baf('0x2c')]){delete _0x366e71['name'];}_0x4681c5[_0x0baf('0x1c')](_0x1ca35a)[_0x0baf('0x2d')](_0x366e71);};}exports[_0x0baf('0x2e')]=function(_0x265915,_0x55c715){var _0x29dbdf={},_0x34a58a={},_0x5d9d7f={'count':0x0,'rows':[]};var _0x44ec31=_[_0x0baf('0x2f')](db[_0x0baf('0x30')][_0x0baf('0x31')],function(_0xd14f0f){return{'name':_0xd14f0f[_0x0baf('0x32')],'type':_0xd14f0f[_0x0baf('0x33')]['key']};});_0x34a58a[_0x0baf('0x34')]=_[_0x0baf('0x2f')](_0x44ec31,_0x0baf('0x2c'));_0x34a58a[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x265915[_0x0baf('0x35')]);_0x34a58a[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x34a58a[_0x0baf('0x34')],_0x34a58a[_0x0baf('0x35')]);_0x29dbdf[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x34a58a[_0x0baf('0x34')],qs[_0x0baf('0x3a')](_0x265915['query'][_0x0baf('0x3a')]));_0x29dbdf['attributes']=_0x29dbdf[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x29dbdf[_0x0baf('0x39')]:_0x34a58a[_0x0baf('0x34')];if(!_0x265915['query'][_0x0baf('0x3c')](_0x0baf('0x3d'))){_0x29dbdf['limit']=qs[_0x0baf('0x20')](_0x265915[_0x0baf('0x35')][_0x0baf('0x20')]);_0x29dbdf[_0x0baf('0x1e')]=qs[_0x0baf('0x1e')](_0x265915[_0x0baf('0x35')][_0x0baf('0x1e')]);}_0x29dbdf[_0x0baf('0x3e')]=qs['sort'](_0x265915[_0x0baf('0x35')][_0x0baf('0x3f')]);_0x29dbdf['where']=qs[_0x0baf('0x37')](_['pick'](_0x265915['query'],_0x34a58a[_0x0baf('0x37')]),_0x44ec31);if(_0x265915[_0x0baf('0x35')]['filter']){_0x29dbdf['where']=_[_0x0baf('0x40')](_0x29dbdf[_0x0baf('0x41')],{'$or':_[_0x0baf('0x2f')](_0x44ec31,function(_0xb2d9ab){if(_0xb2d9ab[_0x0baf('0x33')]!==_0x0baf('0x42')){var _0x290464={};_0x290464[_0xb2d9ab[_0x0baf('0x2c')]]={'$like':'%'+_0x265915[_0x0baf('0x35')][_0x0baf('0x43')]+'%'};return _0x290464;}})});}_0x29dbdf=_[_0x0baf('0x40')]({},_0x29dbdf,_0x265915[_0x0baf('0x44')]);var _0x354cb1={'where':_0x29dbdf[_0x0baf('0x41')]};return db['ZendeskAccount'][_0x0baf('0x21')](_0x354cb1)[_0x0baf('0x27')](function(_0x4f1de9){_0x5d9d7f[_0x0baf('0x21')]=_0x4f1de9;if(_0x265915[_0x0baf('0x35')][_0x0baf('0x45')]){_0x29dbdf[_0x0baf('0x46')]=[{'all':!![]}];}return db[_0x0baf('0x30')][_0x0baf('0x47')](_0x29dbdf);})['then'](function(_0x23ad34){_0x5d9d7f[_0x0baf('0x48')]=_0x23ad34;return _0x5d9d7f;})['then'](respondWithFilteredResult(_0x55c715,_0x29dbdf))[_0x0baf('0x49')](handleError(_0x55c715,null));};exports[_0x0baf('0x4a')]=function(_0x45c6aa,_0x57903e){var _0x504031={'raw':![],'where':{'id':_0x45c6aa[_0x0baf('0x4b')]['id']}},_0x193fd3={};_0x193fd3[_0x0baf('0x34')]=_[_0x0baf('0x36')](db[_0x0baf('0x30')][_0x0baf('0x31')]);_0x193fd3[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x45c6aa[_0x0baf('0x35')]);_0x193fd3[_0x0baf('0x37')]=_['intersection'](_0x193fd3[_0x0baf('0x34')],_0x193fd3[_0x0baf('0x35')]);_0x504031[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x193fd3[_0x0baf('0x34')],qs['fields'](_0x45c6aa[_0x0baf('0x35')][_0x0baf('0x3a')]));_0x504031[_0x0baf('0x39')]=_0x504031[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x504031['attributes']:_0x193fd3[_0x0baf('0x34')];if(_0x45c6aa[_0x0baf('0x35')][_0x0baf('0x45')]){_0x504031[_0x0baf('0x46')]=[{'all':!![]}];}_0x504031=_[_0x0baf('0x40')]({},_0x504031,_0x45c6aa[_0x0baf('0x44')]);return db[_0x0baf('0x30')]['find'](_0x504031)[_0x0baf('0x27')](handleEntityNotFound(_0x57903e,null))[_0x0baf('0x27')](respondWithResult(_0x57903e,null))[_0x0baf('0x49')](handleError(_0x57903e,null));};exports['create']=function(_0x3c9de3,_0x2222b6){return db[_0x0baf('0x30')][_0x0baf('0x4c')](_0x3c9de3[_0x0baf('0x4d')],{})[_0x0baf('0x27')](respondWithResult(_0x2222b6,0xc9))[_0x0baf('0x49')](handleError(_0x2222b6,null));};exports['update']=function(_0x22c451,_0x428c9b){if(_0x22c451[_0x0baf('0x4d')]['id']){delete _0x22c451[_0x0baf('0x4d')]['id'];}return db[_0x0baf('0x30')][_0x0baf('0x4e')]({'where':{'id':_0x22c451[_0x0baf('0x4b')]['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0x428c9b,null))[_0x0baf('0x27')](saveUpdates(_0x22c451[_0x0baf('0x4d')],null))[_0x0baf('0x27')](respondWithResult(_0x428c9b,null))['catch'](handleError(_0x428c9b,null));};exports['destroy']=function(_0x354329,_0x3d6b19){return db[_0x0baf('0x30')][_0x0baf('0x4e')]({'where':{'id':_0x354329[_0x0baf('0x4b')]['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0x3d6b19,null))[_0x0baf('0x27')](removeEntity(_0x3d6b19,null))['catch'](handleError(_0x3d6b19,null));};exports[_0x0baf('0x4f')]=function(_0x2ef4c1,_0xf2424,_0x16d9fb){var _0x3fdb41={};var _0x1e2671={};var _0x5e1849;var _0x3eebe5;return db['ZendeskAccount'][_0x0baf('0x50')]({'where':{'id':_0x2ef4c1['params']['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0xf2424,null))['then'](function(_0x35b1a5){if(_0x35b1a5){_0x5e1849=_0x35b1a5;_0x1e2671['model']=_[_0x0baf('0x36')](db[_0x0baf('0x51')][_0x0baf('0x31')]);_0x1e2671[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x2ef4c1['query']);_0x1e2671[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x1e2671[_0x0baf('0x34')],_0x1e2671[_0x0baf('0x35')]);_0x3fdb41[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x1e2671['model'],qs[_0x0baf('0x3a')](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x3a')]));_0x3fdb41[_0x0baf('0x39')]=_0x3fdb41[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x3fdb41[_0x0baf('0x39')]:_0x1e2671['model'];_0x3fdb41['order']=qs[_0x0baf('0x3f')](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x3f')]);_0x3fdb41[_0x0baf('0x41')]=qs[_0x0baf('0x37')](_[_0x0baf('0x52')](_0x2ef4c1[_0x0baf('0x35')],_0x1e2671[_0x0baf('0x37')]));if(_0x2ef4c1[_0x0baf('0x35')]['filter']){_0x3fdb41[_0x0baf('0x41')]=_[_0x0baf('0x40')](_0x3fdb41[_0x0baf('0x41')],{'$or':_[_0x0baf('0x2f')](_0x3fdb41[_0x0baf('0x39')],function(_0xebfc0c){var _0x26f5c9={};_0x26f5c9[_0xebfc0c]={'$like':'%'+_0x2ef4c1['query'][_0x0baf('0x43')]+'%'};return _0x26f5c9;})});}_0x3fdb41=_[_0x0baf('0x40')]({},_0x3fdb41,_0x2ef4c1[_0x0baf('0x44')]);return _0x5e1849[_0x0baf('0x4f')](_0x3fdb41);}})[_0x0baf('0x27')](function(_0x1a6d22){if(_0x1a6d22){_0x3eebe5=_0x1a6d22[_0x0baf('0x3b')];if(!_0x2ef4c1[_0x0baf('0x35')]['hasOwnProperty'](_0x0baf('0x3d'))){_0x3fdb41['limit']=qs[_0x0baf('0x20')](_0x2ef4c1['query']['limit']);_0x3fdb41[_0x0baf('0x1e')]=qs['offset'](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x1e')]);}return _0x5e1849['getConfigurations'](_0x3fdb41);}})[_0x0baf('0x27')](function(_0xfb6708){if(_0xfb6708){return _0xfb6708?{'count':_0x3eebe5,'rows':_0xfb6708}:null;}})[_0x0baf('0x27')](respondWithResult(_0xf2424,null))['catch'](handleError(_0xf2424,null));};exports['addConfiguration']=function(_0x2438df,_0x7e8946,_0x6d789f){if(_0x2438df[_0x0baf('0x4d')]['id']){delete _0x2438df[_0x0baf('0x4d')]['id'];}return db['ZendeskAccount'][_0x0baf('0x50')]({'where':{'id':_0x2438df['params']['id']}})['then'](handleEntityNotFound(_0x7e8946,null))['then'](function(_0x427ed1){if(_0x427ed1){_0x2438df['body']['AccountId']=_0x427ed1['id'];_0x2438df[_0x0baf('0x4d')][_0x0baf('0x53')]=integrations[_0x0baf('0x54')](_0x2438df[_0x0baf('0x4d')][_0x0baf('0x55')],_0x2438df[_0x0baf('0x4d')]['type']);_0x2438df[_0x0baf('0x4d')][_0x0baf('0x56')]=integrations[_0x0baf('0x57')](_0x2438df[_0x0baf('0x4d')][_0x0baf('0x55')],_0x2438df[_0x0baf('0x4d')]['type']);return db[_0x0baf('0x51')][_0x0baf('0x4c')](_0x2438df[_0x0baf('0x4d')],{'include':[{'model':db['ZendeskField'],'as':_0x0baf('0x53')},{'model':db[_0x0baf('0x58')],'as':_0x0baf('0x56')}]});}return null;})[_0x0baf('0x27')](respondWithResult(_0x7e8946,null))[_0x0baf('0x49')](handleError(_0x7e8946,null));};exports[_0x0baf('0x59')]=function(_0x4cc046,_0x5874cc,_0x54353a){var _0x4b7caa='';return db[_0x0baf('0x30')][_0x0baf('0x50')]({'where':{'id':_0x4cc046[_0x0baf('0x4b')]['id']},'attributes':['id',_0x0baf('0x5a'),_0x0baf('0x5b'),_0x0baf('0x5c'),'authType','remoteUri']})[_0x0baf('0x27')](handleEntityNotFound(_0x5874cc,null))['then'](function(_0x22cd07){if(_0x22cd07){_0x4b7caa=_0x22cd07[_0x0baf('0x5d')];var _0x4cca39=_0x4b7caa[_0x0baf('0x5e')](-0x1);if(_0x4cca39==='/'){_0x4b7caa=_0x4b7caa[_0x0baf('0x5f')](0x0,_0x4b7caa[_0x0baf('0x60')](_0x4cca39));}var _0xb1d719={'method':_0x0baf('0x61'),'uri':util[_0x0baf('0x62')](_0x0baf('0x63'),_0x4b7caa,_0x0baf('0x64')),'json':!![]};switch(_0x22cd07[_0x0baf('0x65')]){case'password':_0xb1d719['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x0baf('0x66'),_0x22cd07[_0x0baf('0x5a')],_0x22cd07[_0x0baf('0x5b')]))[_0x0baf('0x67')]('base64'))};break;case _0x0baf('0x5c'):_0xb1d719[_0x0baf('0x68')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x0baf('0x62')](_0x0baf('0x69'),_0x22cd07[_0x0baf('0x5a')],_0x22cd07[_0x0baf('0x5c')]))[_0x0baf('0x67')](_0x0baf('0x6a')))};break;default:throw new db[(_0x0baf('0x6b'))][(_0x0baf('0x6c'))]('Unknown\x20authentication\x20type');}return rp(_0xb1d719);}})[_0x0baf('0x27')](function(_0x1a3b7b){if(_0x1a3b7b){var _0x560c0f=[_0x0baf('0x6d'),_0x0baf('0x6e'),'group',_0x0baf('0x6f')];_[_0x0baf('0x70')](_0x1a3b7b[_0x0baf('0x64')],function(_0x2baede){return _0x560c0f[_0x0baf('0x71')](_0x2baede['type']);});return{'count':_0x1a3b7b['ticket_fields'][_0x0baf('0x3b')],'rows':_[_0x0baf('0x2f')](_0x1a3b7b['ticket_fields'],function(_0x28bc1c){return{'id':_0x28bc1c['id'],'name':_0x28bc1c[_0x0baf('0x72')]>0x7?_0x28bc1c[_0x0baf('0x73')]:_0x28bc1c['type'],'custom':_0x28bc1c[_0x0baf('0x72')]>0x7?!![]:![],'options':_0x28bc1c[_0x0baf('0x74')]?_0x28bc1c[_0x0baf('0x74')]:_0x28bc1c['custom_field_options']?_0x28bc1c[_0x0baf('0x75')]:[]};})};}})['then'](respondWithResult(_0x5874cc,null))[_0x0baf('0x49')](function(_0x3fee46){var _0x3fd039=_0x4cc046[_0x0baf('0x35')][_0x0baf('0x76')]?0x1f4:_0x3fee46['statusCode']||0x1f4;logger[_0x0baf('0x2a')](_0x0baf('0x77'),'getFields',_0x3fd039,JSON[_0x0baf('0x78')](_0x3fee46));delete _0x3fee46[_0x0baf('0x2c')];if(_0x3fd039===0x191){_0x3fd039=0x190;}_0x5874cc[_0x0baf('0x1c')](_0x3fd039)[_0x0baf('0x2d')](_0x4cc046[_0x0baf('0x35')][_0x0baf('0x76')]?{'message':_0x0baf('0x79'),'statusCode':_0x3fee46[_0x0baf('0x7a')]}:_0x3fee46);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5db79f6..ba2449c 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 _0x953e=['moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','define','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x31fed9,_0x30dd29){var _0x11e83c=function(_0x5e4e0c){while(--_0x5e4e0c){_0x31fed9['push'](_0x31fed9['shift']());}};_0x11e83c(++_0x30dd29);}(_0x953e,0x164));var _0xe953=function(_0x26686f,_0x5e95a4){_0x26686f=_0x26686f-0x0;var _0x2e2a45=_0x953e[_0x26686f];return _0x2e2a45;};'use strict';var _=require(_0xe953('0x0'));var util=require(_0xe953('0x1'));var logger=require(_0xe953('0x2'))(_0xe953('0x3'));var moment=require(_0xe953('0x4'));var BPromise=require(_0xe953('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe953('0x6'));var rimraf=require(_0xe953('0x7'));var config=require(_0xe953('0x8'));var attributes=require(_0xe953('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3f9693,_0x288da4){return _0x3f9693[_0xe953('0xa')]('ZendeskAccount',attributes,{'tableName':_0xe953('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4080=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4080,0x84));var _0x0408=function(_0x44c325,_0x19c625){_0x44c325=_0x44c325-0x0;var _0x55f09e=_0x4080[_0x44c325];return _0x55f09e;};'use strict';var _=require(_0x0408('0x0'));var util=require(_0x0408('0x1'));var logger=require(_0x0408('0x2'))(_0x0408('0x3'));var moment=require(_0x0408('0x4'));var BPromise=require(_0x0408('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0408('0x6'));var attributes=require(_0x0408('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x0408('0x8')]=function(_0x2db57e,_0x3614ce){return _0x2db57e[_0x0408('0x9')](_0x0408('0xa'),attributes,{'tableName':_0x0408('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 3fdc7a9..e7d15f1 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 _0xfaf1=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','message','error','request\x20sent','result','catch','ZendeskAccount','options','raw','attributes','include','map','model','GetZendeskAccount','find','where','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x461eff,_0x283cd4){var _0x4fa4e5=function(_0x199915){while(--_0x199915){_0x461eff['push'](_0x461eff['shift']());}};_0x4fa4e5(++_0x283cd4);}(_0xfaf1,0xd3));var _0x1faf=function(_0x4339dc,_0x562095){_0x4339dc=_0x4339dc-0x0;var _0x387b4a=_0xfaf1[_0x4339dc];return _0x387b4a;};'use strict';var _=require(_0x1faf('0x0'));var util=require(_0x1faf('0x1'));var moment=require(_0x1faf('0x2'));var BPromise=require(_0x1faf('0x3'));var rs=require(_0x1faf('0x4'));var fs=require('fs');var Redis=require(_0x1faf('0x5'));var db=require(_0x1faf('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1faf('0x7'));var jayson=require(_0x1faf('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33135c,_0x326e87,_0x61c29a){return new BPromise(function(_0x3c5ef8,_0x5b145d){return client[_0x1faf('0x9')](_0x33135c,_0x61c29a)[_0x1faf('0xa')](function(_0x1e09a4){logger[_0x1faf('0xb')](_0x1faf('0xc'),_0x326e87,'request\x20sent');logger[_0x1faf('0xd')](_0x1faf('0xe'),_0x326e87,'request\x20sent',JSON[_0x1faf('0xf')](_0x1e09a4));if(_0x1e09a4['error']){if(_0x1e09a4['error']['code']===0x1f4){logger['error'](_0x1faf('0xc'),_0x326e87,_0x1e09a4['error'][_0x1faf('0x10')]);return _0x5b145d(_0x1e09a4['error'][_0x1faf('0x10')]);}logger[_0x1faf('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x326e87,_0x1e09a4[_0x1faf('0x11')][_0x1faf('0x10')]);return _0x3c5ef8(_0x1e09a4[_0x1faf('0x11')][_0x1faf('0x10')]);}else{logger[_0x1faf('0xb')](_0x1faf('0xc'),_0x326e87,_0x1faf('0x12'));_0x3c5ef8(_0x1e09a4[_0x1faf('0x13')][_0x1faf('0x10')]);}})[_0x1faf('0x14')](function(_0x4a37ad){logger[_0x1faf('0x11')](_0x1faf('0xc'),_0x326e87,_0x4a37ad);_0x5b145d(_0x4a37ad);});});}exports['GetZendeskAccount']=function(_0x415db9){var _0x4b83a4=this;return new Promise(function(_0x36f463,_0x5e5f4e){return db[_0x1faf('0x15')]['findAll']({'raw':_0x415db9[_0x1faf('0x16')]?_0x415db9[_0x1faf('0x16')][_0x1faf('0x17')]===undefined?!![]:![]:!![],'where':_0x415db9[_0x1faf('0x16')]?_0x415db9[_0x1faf('0x16')]['where']||null:null,'attributes':_0x415db9[_0x1faf('0x16')]?_0x415db9[_0x1faf('0x16')][_0x1faf('0x18')]||null:null,'limit':_0x415db9[_0x1faf('0x16')]?_0x415db9['options']['limit']||null:null,'include':_0x415db9[_0x1faf('0x16')]?_0x415db9[_0x1faf('0x16')][_0x1faf('0x19')]?_[_0x1faf('0x1a')](_0x415db9[_0x1faf('0x16')][_0x1faf('0x19')],function(_0x2d8c28){return{'model':db[_0x2d8c28['model']],'as':_0x2d8c28['as'],'attributes':_0x2d8c28[_0x1faf('0x18')],'include':_0x2d8c28[_0x1faf('0x19')]?_[_0x1faf('0x1a')](_0x2d8c28['include'],function(_0x1d911a){return{'model':db[_0x1d911a[_0x1faf('0x1b')]],'as':_0x1d911a['as'],'attributes':_0x1d911a[_0x1faf('0x18')],'include':_0x1d911a[_0x1faf('0x19')]?_[_0x1faf('0x1a')](_0x1d911a[_0x1faf('0x19')],function(_0x1c4b77){return{'model':db[_0x1c4b77[_0x1faf('0x1b')]],'as':_0x1c4b77['as'],'attributes':_0x1c4b77[_0x1faf('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1faf('0xa')](function(_0x443a8b){logger[_0x1faf('0xb')]('GetZendeskAccount',_0x415db9);logger[_0x1faf('0xd')]('GetZendeskAccount',_0x415db9,JSON['stringify'](_0x443a8b));_0x36f463(_0x443a8b);})['catch'](function(_0x44ea3e){logger[_0x1faf('0x11')](_0x1faf('0x1c'),_0x44ea3e[_0x1faf('0x10')],_0x415db9);_0x5e5f4e(_0x4b83a4[_0x1faf('0x11')](0x1f4,_0x44ea3e[_0x1faf('0x10')]));});});};exports['ShowZendeskAccount']=function(_0x14fea8){var _0xce2a80=this;return new Promise(function(_0x48ecc7,_0x4fc7f7){return db[_0x1faf('0x15')][_0x1faf('0x1d')]({'raw':_0x14fea8[_0x1faf('0x16')]?_0x14fea8[_0x1faf('0x16')][_0x1faf('0x17')]===undefined?!![]:![]:!![],'where':_0x14fea8[_0x1faf('0x16')]?_0x14fea8[_0x1faf('0x16')][_0x1faf('0x1e')]||null:null,'attributes':_0x14fea8[_0x1faf('0x16')]?_0x14fea8[_0x1faf('0x16')][_0x1faf('0x18')]||null:null,'include':_0x14fea8['options']?_0x14fea8['options']['include']?_[_0x1faf('0x1a')](_0x14fea8['options'][_0x1faf('0x19')],function(_0x127ce8){return{'model':db[_0x127ce8[_0x1faf('0x1b')]],'as':_0x127ce8['as'],'attributes':_0x127ce8[_0x1faf('0x18')],'include':_0x127ce8[_0x1faf('0x19')]?_['map'](_0x127ce8['include'],function(_0x499a97){return{'model':db[_0x499a97[_0x1faf('0x1b')]],'as':_0x499a97['as'],'attributes':_0x499a97[_0x1faf('0x18')],'include':_0x499a97[_0x1faf('0x19')]?_[_0x1faf('0x1a')](_0x499a97[_0x1faf('0x19')],function(_0x39dced){return{'model':db[_0x39dced['model']],'as':_0x39dced['as'],'attributes':_0x39dced[_0x1faf('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1faf('0xa')](function(_0x1adf50){logger[_0x1faf('0xb')](_0x1faf('0x1f'),_0x14fea8);logger[_0x1faf('0xd')]('ShowZendeskAccount',_0x14fea8,JSON['stringify'](_0x1adf50));_0x48ecc7(_0x1adf50);})[_0x1faf('0x14')](function(_0x5df738){logger[_0x1faf('0x11')](_0x1faf('0x1f'),_0x5df738[_0x1faf('0x10')],_0x14fea8);_0x4fc7f7(_0xce2a80['error'](0x1f4,_0x5df738['message']));});});}; \ No newline at end of file +var _0x6e45=['rpc','../../config/environment','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','model','map','ShowZendeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x192cff,_0x361327){var _0x20d2f6=function(_0x37baf9){while(--_0x37baf9){_0x192cff['push'](_0x192cff['shift']());}};_0x20d2f6(++_0x361327);}(_0x6e45,0x133));var _0x56e4=function(_0xdc5263,_0x5b7e37){_0xdc5263=_0xdc5263-0x0;var _0x5deede=_0x6e45[_0xdc5263];return _0x5deede;};'use strict';var _=require(_0x56e4('0x0'));var util=require(_0x56e4('0x1'));var moment=require(_0x56e4('0x2'));var BPromise=require(_0x56e4('0x3'));var rs=require(_0x56e4('0x4'));var fs=require('fs');var Redis=require(_0x56e4('0x5'));var db=require(_0x56e4('0x6'))['db'];var utils=require(_0x56e4('0x7'));var logger=require('../../config/logger')(_0x56e4('0x8'));var config=require(_0x56e4('0x9'));var jayson=require(_0x56e4('0xa'));var client=jayson[_0x56e4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4af854,_0x1962d5,_0x40e4d7){return new BPromise(function(_0x386d61,_0x5dcbc6){return client[_0x56e4('0xc')](_0x4af854,_0x40e4d7)[_0x56e4('0xd')](function(_0x443d88){logger['info'](_0x56e4('0xe'),_0x1962d5,_0x56e4('0xf'));logger[_0x56e4('0x10')](_0x56e4('0x11'),_0x1962d5,_0x56e4('0xf'),JSON[_0x56e4('0x12')](_0x443d88));if(_0x443d88[_0x56e4('0x13')]){if(_0x443d88['error']['code']===0x1f4){logger[_0x56e4('0x13')](_0x56e4('0xe'),_0x1962d5,_0x443d88[_0x56e4('0x13')]['message']);return _0x5dcbc6(_0x443d88[_0x56e4('0x13')]['message']);}logger[_0x56e4('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x1962d5,_0x443d88[_0x56e4('0x13')]['message']);return _0x386d61(_0x443d88[_0x56e4('0x13')][_0x56e4('0x14')]);}else{logger[_0x56e4('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x1962d5,'request\x20sent');_0x386d61(_0x443d88['result'][_0x56e4('0x14')]);}})[_0x56e4('0x16')](function(_0x5285ec){logger[_0x56e4('0x13')](_0x56e4('0xe'),_0x1962d5,_0x5285ec);_0x5dcbc6(_0x5285ec);});});}exports[_0x56e4('0x17')]=function(_0x195a7c){var _0x372b09=this;return new Promise(function(_0x50193e,_0x4c25a3){return db[_0x56e4('0x18')][_0x56e4('0x19')]({'raw':_0x195a7c[_0x56e4('0x1a')]?_0x195a7c['options'][_0x56e4('0x1b')]===undefined?!![]:![]:!![],'where':_0x195a7c[_0x56e4('0x1a')]?_0x195a7c['options']['where']||null:null,'attributes':_0x195a7c[_0x56e4('0x1a')]?_0x195a7c[_0x56e4('0x1a')][_0x56e4('0x1c')]||null:null,'limit':_0x195a7c[_0x56e4('0x1a')]?_0x195a7c['options']['limit']||null:null,'include':_0x195a7c[_0x56e4('0x1a')]?_0x195a7c[_0x56e4('0x1a')][_0x56e4('0x1d')]?_['map'](_0x195a7c[_0x56e4('0x1a')][_0x56e4('0x1d')],function(_0x1288f5){return{'model':db[_0x1288f5[_0x56e4('0x1e')]],'as':_0x1288f5['as'],'attributes':_0x1288f5[_0x56e4('0x1c')],'include':_0x1288f5[_0x56e4('0x1d')]?_['map'](_0x1288f5[_0x56e4('0x1d')],function(_0x4e5c5d){return{'model':db[_0x4e5c5d[_0x56e4('0x1e')]],'as':_0x4e5c5d['as'],'attributes':_0x4e5c5d[_0x56e4('0x1c')],'include':_0x4e5c5d[_0x56e4('0x1d')]?_[_0x56e4('0x1f')](_0x4e5c5d['include'],function(_0x2414b8){return{'model':db[_0x2414b8[_0x56e4('0x1e')]],'as':_0x2414b8['as'],'attributes':_0x2414b8[_0x56e4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x56e4('0xd')](function(_0x4c32b3){logger[_0x56e4('0x15')]('GetZendeskAccount',_0x195a7c);logger[_0x56e4('0x10')](_0x56e4('0x17'),_0x195a7c,JSON[_0x56e4('0x12')](_0x4c32b3));_0x50193e(_0x4c32b3);})[_0x56e4('0x16')](function(_0x44f92e){logger[_0x56e4('0x13')](_0x56e4('0x17'),_0x44f92e['message'],_0x195a7c);_0x4c25a3(_0x372b09['error'](0x1f4,_0x44f92e[_0x56e4('0x14')]));});});};exports[_0x56e4('0x20')]=function(_0x4327c2){var _0x153de8=this;return new Promise(function(_0x524af2,_0x134fe2){return db[_0x56e4('0x18')][_0x56e4('0x21')]({'raw':_0x4327c2[_0x56e4('0x1a')]?_0x4327c2[_0x56e4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4327c2[_0x56e4('0x1a')]?_0x4327c2[_0x56e4('0x1a')][_0x56e4('0x22')]||null:null,'attributes':_0x4327c2[_0x56e4('0x1a')]?_0x4327c2['options'][_0x56e4('0x1c')]||null:null,'include':_0x4327c2[_0x56e4('0x1a')]?_0x4327c2[_0x56e4('0x1a')][_0x56e4('0x1d')]?_['map'](_0x4327c2[_0x56e4('0x1a')]['include'],function(_0x398262){return{'model':db[_0x398262[_0x56e4('0x1e')]],'as':_0x398262['as'],'attributes':_0x398262[_0x56e4('0x1c')],'include':_0x398262[_0x56e4('0x1d')]?_[_0x56e4('0x1f')](_0x398262[_0x56e4('0x1d')],function(_0x367a03){return{'model':db[_0x367a03[_0x56e4('0x1e')]],'as':_0x367a03['as'],'attributes':_0x367a03[_0x56e4('0x1c')],'include':_0x367a03[_0x56e4('0x1d')]?_[_0x56e4('0x1f')](_0x367a03[_0x56e4('0x1d')],function(_0x11cec0){return{'model':db[_0x11cec0[_0x56e4('0x1e')]],'as':_0x11cec0['as'],'attributes':_0x11cec0[_0x56e4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x56e4('0xd')](function(_0x68fd3b){logger[_0x56e4('0x15')](_0x56e4('0x20'),_0x4327c2);logger[_0x56e4('0x10')](_0x56e4('0x20'),_0x4327c2,JSON[_0x56e4('0x12')](_0x68fd3b));_0x524af2(_0x68fd3b);})[_0x56e4('0x16')](function(_0x27eed9){logger[_0x56e4('0x13')](_0x56e4('0x20'),_0x27eed9[_0x56e4('0x14')],_0x4327c2);_0x134fe2(_0x153de8['error'](0x1f4,_0x27eed9[_0x56e4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6208e1b..3c4ac03 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 _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3dad57,_0x1dd8b3){var _0x47a6b5=function(_0x6e545d){while(--_0x6e545d){_0x3dad57['push'](_0x3dad57['shift']());}};_0x47a6b5(++_0x1dd8b3);}(_0xea28,0x13a));var _0x8ea2=function(_0x8c44d8,_0x1cd536){_0x8c44d8=_0x8c44d8-0x0;var _0x570a16=_0xea28[_0x8c44d8];return _0x570a16;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getSubjects']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['get'](_0x8ea2('0x14'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x15')]);router[_0x8ea2('0x16')]('/',auth[_0x8ea2('0xd')](),controller['create']);router[_0x8ea2('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router; \ No newline at end of file +var _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0abf[_0x2f5ac5];return _0x37c9a8;};'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('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 593a301..3686750 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 _0x6f65=['exports','sequelize'];(function(_0x4cc262,_0x4827b){var _0x49a208=function(_0x2151ee){while(--_0x2151ee){_0x4cc262['push'](_0x4cc262['shift']());}};_0x49a208(++_0x4827b);}(_0x6f65,0xbf));var _0x56f6=function(_0xb93e8d,_0x11e30e){_0xb93e8d=_0xb93e8d-0x0;var _0xeda55b=_0x6f65[_0xb93e8d];return _0xeda55b;};'use strict';var Sequelize=require(_0x56f6('0x0'));module[_0x56f6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x07a9=['STRING','sequelize','exports'];(function(_0x5a4fe4,_0x13daca){var _0x42aa6e=function(_0x42703c){while(--_0x42703c){_0x5a4fe4['push'](_0x5a4fe4['shift']());}};_0x42aa6e(++_0x13daca);}(_0x07a9,0xb2));var _0x907a=function(_0xf25284,_0x34b45b){_0xf25284=_0xf25284-0x0;var _0xa31537=_0x07a9[_0xf25284];return _0xa31537;};'use strict';var Sequelize=require(_0x907a('0x0'));module[_0x907a('0x1')]={'name':{'type':Sequelize[_0x907a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index f369bac..7d680cb 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 _0x0c57=['body','destroy','getFields','findOne','getSubjects','getDescriptions','ZendeskField','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','then','name','send','index','ZendeskConfiguration','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','catch','show','params','keys','rawAttributes','includeAll','find','create'];(function(_0x32a884,_0x183853){var _0x242f9b=function(_0x556c63){while(--_0x556c63){_0x32a884['push'](_0x32a884['shift']());}};_0x242f9b(++_0x183853);}(_0x0c57,0x107));var _0x70c5=function(_0x40d73f,_0x1422dc){_0x40d73f=_0x40d73f-0x0;var _0x123a9c=_0x0c57[_0x40d73f];return _0x123a9c;};'use strict';var emlformat=require(_0x70c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70c5('0x1'));var jsonpatch=require(_0x70c5('0x2'));var rp=require(_0x70c5('0x3'));var moment=require('moment');var BPromise=require(_0x70c5('0x4'));var Mustache=require(_0x70c5('0x5'));var util=require(_0x70c5('0x6'));var path=require(_0x70c5('0x7'));var sox=require(_0x70c5('0x8'));var csv=require(_0x70c5('0x9'));var ejs=require(_0x70c5('0xa'));var fs=require('fs');var fs_extra=require(_0x70c5('0xb'));var _=require(_0x70c5('0xc'));var squel=require(_0x70c5('0xd'));var crypto=require(_0x70c5('0xe'));var jsforce=require(_0x70c5('0xf'));var deskjs=require(_0x70c5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x70c5('0x11'));var Papa=require(_0x70c5('0x12'));var Redis=require(_0x70c5('0x13'));var authService=require(_0x70c5('0x14'));var qs=require(_0x70c5('0x15'));var as=require(_0x70c5('0x16'));var hardwareService=require(_0x70c5('0x17'));var logger=require(_0x70c5('0x18'))('api');var utils=require(_0x70c5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x70c5('0x1a'));var db=require(_0x70c5('0x1b'))['db'];function respondWithStatusCode(_0x46c0a1,_0x13f0f5){_0x13f0f5=_0x13f0f5||0xcc;return function(_0x2f3805){if(_0x2f3805){return _0x46c0a1[_0x70c5('0x1c')](_0x13f0f5);}return _0x46c0a1[_0x70c5('0x1d')](_0x13f0f5)[_0x70c5('0x1e')]();};}function respondWithResult(_0x295866,_0x54e421){_0x54e421=_0x54e421||0xc8;return function(_0x5d6112){if(_0x5d6112){return _0x295866[_0x70c5('0x1d')](_0x54e421)[_0x70c5('0x1f')](_0x5d6112);}};}function respondWithFilteredResult(_0x4f7f1a,_0x3e56f8){return function(_0x336584){if(_0x336584){var _0x5866b5=typeof _0x3e56f8[_0x70c5('0x20')]===_0x70c5('0x21')&&typeof _0x3e56f8[_0x70c5('0x22')]===_0x70c5('0x21');var _0x2969cc=_0x336584[_0x70c5('0x23')];var _0x25eaab=_0x5866b5?0x0:_0x3e56f8[_0x70c5('0x20')];var _0x19ee07=_0x5866b5?_0x336584[_0x70c5('0x23')]:_0x3e56f8[_0x70c5('0x20')]+_0x3e56f8[_0x70c5('0x22')];var _0x44e1f0;if(_0x19ee07>=_0x2969cc){_0x19ee07=_0x2969cc;_0x44e1f0=0xc8;}else{_0x44e1f0=0xce;}_0x4f7f1a[_0x70c5('0x1d')](_0x44e1f0);return _0x4f7f1a['set']('Content-Range',_0x25eaab+'-'+_0x19ee07+'/'+_0x2969cc)['json'](_0x336584);}return null;};}function patchUpdates(_0x1f6220){return function(_0x12d817){try{jsonpatch[_0x70c5('0x24')](_0x12d817,_0x1f6220,!![]);}catch(_0x54e48f){return BPromise['reject'](_0x54e48f);}return _0x12d817[_0x70c5('0x25')]();};}function saveUpdates(_0x622cbb,_0x233cf7){return function(_0x4b9826){if(_0x4b9826){return _0x4b9826['update'](_0x622cbb)['then'](function(_0x143653){return _0x143653;});}return null;};}function removeEntity(_0x2dc6f3,_0xd2c458){return function(_0x1481b6){if(_0x1481b6){return _0x1481b6['destroy']()[_0x70c5('0x26')](function(){_0x2dc6f3[_0x70c5('0x1d')](0xcc)[_0x70c5('0x1e')]();});}};}function handleEntityNotFound(_0x4ea497,_0x58d67c){return function(_0x4f307e){if(!_0x4f307e){_0x4ea497['sendStatus'](0x194);}return _0x4f307e;};}function handleError(_0x2a5a9d,_0x36f4eb){_0x36f4eb=_0x36f4eb||0x1f4;return function(_0x42e989){logger['error'](_0x42e989['stack']);if(_0x42e989[_0x70c5('0x27')]){delete _0x42e989['name'];}_0x2a5a9d[_0x70c5('0x1d')](_0x36f4eb)[_0x70c5('0x28')](_0x42e989);};}exports[_0x70c5('0x29')]=function(_0x449c87,_0x20fb01){var _0x31146e={},_0x2ceeaa={},_0x3c9f40={'count':0x0,'rows':[]};var _0x179085=_['map'](db[_0x70c5('0x2a')]['rawAttributes'],function(_0x1357b4){return{'name':_0x1357b4[_0x70c5('0x2b')],'type':_0x1357b4[_0x70c5('0x2c')][_0x70c5('0x2d')]};});_0x2ceeaa[_0x70c5('0x2e')]=_[_0x70c5('0x2f')](_0x179085,_0x70c5('0x27'));_0x2ceeaa[_0x70c5('0x30')]=_['keys'](_0x449c87[_0x70c5('0x30')]);_0x2ceeaa[_0x70c5('0x31')]=_[_0x70c5('0x32')](_0x2ceeaa[_0x70c5('0x2e')],_0x2ceeaa[_0x70c5('0x30')]);_0x31146e['attributes']=_[_0x70c5('0x32')](_0x2ceeaa[_0x70c5('0x2e')],qs[_0x70c5('0x33')](_0x449c87[_0x70c5('0x30')][_0x70c5('0x33')]));_0x31146e['attributes']=_0x31146e[_0x70c5('0x34')][_0x70c5('0x35')]?_0x31146e[_0x70c5('0x34')]:_0x2ceeaa[_0x70c5('0x2e')];if(!_0x449c87['query'][_0x70c5('0x36')](_0x70c5('0x37'))){_0x31146e[_0x70c5('0x22')]=qs['limit'](_0x449c87['query'][_0x70c5('0x22')]);_0x31146e[_0x70c5('0x20')]=qs[_0x70c5('0x20')](_0x449c87[_0x70c5('0x30')][_0x70c5('0x20')]);}_0x31146e[_0x70c5('0x38')]=qs[_0x70c5('0x39')](_0x449c87[_0x70c5('0x30')][_0x70c5('0x39')]);_0x31146e[_0x70c5('0x3a')]=qs[_0x70c5('0x31')](_[_0x70c5('0x3b')](_0x449c87[_0x70c5('0x30')],_0x2ceeaa[_0x70c5('0x31')]),_0x179085);if(_0x449c87['query']['filter']){_0x31146e[_0x70c5('0x3a')]=_[_0x70c5('0x3c')](_0x31146e['where'],{'$or':_[_0x70c5('0x2f')](_0x179085,function(_0x587c8f){if(_0x587c8f['type']!=='VIRTUAL'){var _0x1ffc1f={};_0x1ffc1f[_0x587c8f[_0x70c5('0x27')]]={'$like':'%'+_0x449c87[_0x70c5('0x30')][_0x70c5('0x3d')]+'%'};return _0x1ffc1f;}})});}_0x31146e=_[_0x70c5('0x3c')]({},_0x31146e,_0x449c87[_0x70c5('0x3e')]);var _0x5d148f={'where':_0x31146e[_0x70c5('0x3a')]};return db[_0x70c5('0x2a')][_0x70c5('0x23')](_0x5d148f)[_0x70c5('0x26')](function(_0x63177b){_0x3c9f40['count']=_0x63177b;if(_0x449c87[_0x70c5('0x30')]['includeAll']){_0x31146e[_0x70c5('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x70c5('0x40')](_0x31146e);})['then'](function(_0x42f50a){_0x3c9f40['rows']=_0x42f50a;return _0x3c9f40;})['then'](respondWithFilteredResult(_0x20fb01,_0x31146e))[_0x70c5('0x41')](handleError(_0x20fb01,null));};exports[_0x70c5('0x42')]=function(_0x5a162f,_0x3270b1){var _0x42a350={'raw':![],'where':{'id':_0x5a162f[_0x70c5('0x43')]['id']}},_0x2a1a24={};_0x2a1a24['model']=_[_0x70c5('0x44')](db[_0x70c5('0x2a')][_0x70c5('0x45')]);_0x2a1a24[_0x70c5('0x30')]=_[_0x70c5('0x44')](_0x5a162f[_0x70c5('0x30')]);_0x2a1a24[_0x70c5('0x31')]=_['intersection'](_0x2a1a24['model'],_0x2a1a24[_0x70c5('0x30')]);_0x42a350[_0x70c5('0x34')]=_[_0x70c5('0x32')](_0x2a1a24['model'],qs[_0x70c5('0x33')](_0x5a162f[_0x70c5('0x30')][_0x70c5('0x33')]));_0x42a350[_0x70c5('0x34')]=_0x42a350[_0x70c5('0x34')]['length']?_0x42a350[_0x70c5('0x34')]:_0x2a1a24[_0x70c5('0x2e')];if(_0x5a162f[_0x70c5('0x30')][_0x70c5('0x46')]){_0x42a350[_0x70c5('0x3f')]=[{'all':!![]}];}_0x42a350=_[_0x70c5('0x3c')]({},_0x42a350,_0x5a162f[_0x70c5('0x3e')]);return db[_0x70c5('0x2a')][_0x70c5('0x47')](_0x42a350)[_0x70c5('0x26')](handleEntityNotFound(_0x3270b1,null))[_0x70c5('0x26')](respondWithResult(_0x3270b1,null))[_0x70c5('0x41')](handleError(_0x3270b1,null));};exports[_0x70c5('0x48')]=function(_0xababaa,_0x4d8a82){return db[_0x70c5('0x2a')][_0x70c5('0x48')](_0xababaa[_0x70c5('0x49')],{})[_0x70c5('0x26')](respondWithResult(_0x4d8a82,0xc9))[_0x70c5('0x41')](handleError(_0x4d8a82,null));};exports['update']=function(_0x48e237,_0x57f098){if(_0x48e237[_0x70c5('0x49')]['id']){delete _0x48e237[_0x70c5('0x49')]['id'];}return db['ZendeskConfiguration'][_0x70c5('0x47')]({'where':{'id':_0x48e237[_0x70c5('0x43')]['id']}})[_0x70c5('0x26')](handleEntityNotFound(_0x57f098,null))[_0x70c5('0x26')](saveUpdates(_0x48e237[_0x70c5('0x49')],null))[_0x70c5('0x26')](respondWithResult(_0x57f098,null))[_0x70c5('0x41')](handleError(_0x57f098,null));};exports[_0x70c5('0x4a')]=function(_0x2633aa,_0x42528f){return db['ZendeskConfiguration'][_0x70c5('0x47')]({'where':{'id':_0x2633aa[_0x70c5('0x43')]['id']}})[_0x70c5('0x26')](handleEntityNotFound(_0x42528f,null))[_0x70c5('0x26')](removeEntity(_0x42528f,null))['catch'](handleError(_0x42528f,null));};exports[_0x70c5('0x4b')]=function(_0x3b78c6,_0x375e04,_0x218421){var _0x444b01={};var _0x158615={};var _0x2e09d7;var _0x10a8c1;return db[_0x70c5('0x2a')][_0x70c5('0x4c')]({'where':{'id':_0x3b78c6[_0x70c5('0x43')]['id']}})[_0x70c5('0x26')](handleEntityNotFound(_0x375e04,null))[_0x70c5('0x26')](function(_0x135df8){if(_0x135df8){_0x2e09d7=_0x135df8;_0x158615[_0x70c5('0x2e')]=_[_0x70c5('0x44')](db['ZendeskField'][_0x70c5('0x45')]);_0x158615[_0x70c5('0x30')]=_[_0x70c5('0x44')](_0x3b78c6[_0x70c5('0x30')]);_0x158615[_0x70c5('0x31')]=_[_0x70c5('0x32')](_0x158615[_0x70c5('0x2e')],_0x158615[_0x70c5('0x30')]);_0x444b01[_0x70c5('0x34')]=_['intersection'](_0x158615[_0x70c5('0x2e')],qs[_0x70c5('0x33')](_0x3b78c6[_0x70c5('0x30')]['fields']));_0x444b01[_0x70c5('0x34')]=_0x444b01['attributes'][_0x70c5('0x35')]?_0x444b01[_0x70c5('0x34')]:_0x158615[_0x70c5('0x2e')];_0x444b01[_0x70c5('0x38')]=qs[_0x70c5('0x39')](_0x3b78c6['query']['sort']);_0x444b01[_0x70c5('0x3a')]=qs[_0x70c5('0x31')](_[_0x70c5('0x3b')](_0x3b78c6[_0x70c5('0x30')],_0x158615[_0x70c5('0x31')]));if(_0x3b78c6['query'][_0x70c5('0x3d')]){_0x444b01[_0x70c5('0x3a')]=_[_0x70c5('0x3c')](_0x444b01['where'],{'$or':_[_0x70c5('0x2f')](_0x444b01[_0x70c5('0x34')],function(_0x41475d){var _0x21c8dd={};_0x21c8dd[_0x41475d]={'$like':'%'+_0x3b78c6[_0x70c5('0x30')][_0x70c5('0x3d')]+'%'};return _0x21c8dd;})});}_0x444b01=_[_0x70c5('0x3c')]({},_0x444b01,_0x3b78c6[_0x70c5('0x3e')]);return _0x2e09d7[_0x70c5('0x4b')](_0x444b01);}})[_0x70c5('0x26')](function(_0x3713bd){if(_0x3713bd){_0x10a8c1=_0x3713bd[_0x70c5('0x35')];if(!_0x3b78c6['query']['hasOwnProperty'](_0x70c5('0x37'))){_0x444b01[_0x70c5('0x22')]=qs[_0x70c5('0x22')](_0x3b78c6[_0x70c5('0x30')][_0x70c5('0x22')]);_0x444b01[_0x70c5('0x20')]=qs[_0x70c5('0x20')](_0x3b78c6[_0x70c5('0x30')][_0x70c5('0x20')]);}return _0x2e09d7[_0x70c5('0x4b')](_0x444b01);}})[_0x70c5('0x26')](function(_0x1eed6f){if(_0x1eed6f){return _0x1eed6f?{'count':_0x10a8c1,'rows':_0x1eed6f}:null;}})[_0x70c5('0x26')](respondWithResult(_0x375e04,null))[_0x70c5('0x41')](handleError(_0x375e04,null));};exports[_0x70c5('0x4d')]=function(_0x56e4e8,_0x2ca94a,_0x2ac1e0){var _0x5783ef={};var _0x417b05={};var _0x6ccde3;var _0x455798;return db['ZendeskConfiguration'][_0x70c5('0x4c')]({'where':{'id':_0x56e4e8[_0x70c5('0x43')]['id']}})[_0x70c5('0x26')](handleEntityNotFound(_0x2ca94a,null))[_0x70c5('0x26')](function(_0x5b8dbb){if(_0x5b8dbb){_0x6ccde3=_0x5b8dbb;_0x417b05['model']=_[_0x70c5('0x44')](db['ZendeskField'][_0x70c5('0x45')]);_0x417b05[_0x70c5('0x30')]=_[_0x70c5('0x44')](_0x56e4e8[_0x70c5('0x30')]);_0x417b05['filters']=_[_0x70c5('0x32')](_0x417b05[_0x70c5('0x2e')],_0x417b05[_0x70c5('0x30')]);_0x5783ef[_0x70c5('0x34')]=_[_0x70c5('0x32')](_0x417b05['model'],qs[_0x70c5('0x33')](_0x56e4e8['query'][_0x70c5('0x33')]));_0x5783ef[_0x70c5('0x34')]=_0x5783ef[_0x70c5('0x34')][_0x70c5('0x35')]?_0x5783ef[_0x70c5('0x34')]:_0x417b05[_0x70c5('0x2e')];_0x5783ef[_0x70c5('0x38')]=qs['sort'](_0x56e4e8[_0x70c5('0x30')][_0x70c5('0x39')]);_0x5783ef['where']=qs[_0x70c5('0x31')](_['pick'](_0x56e4e8[_0x70c5('0x30')],_0x417b05[_0x70c5('0x31')]));if(_0x56e4e8[_0x70c5('0x30')][_0x70c5('0x3d')]){_0x5783ef[_0x70c5('0x3a')]=_[_0x70c5('0x3c')](_0x5783ef[_0x70c5('0x3a')],{'$or':_['map'](_0x5783ef['attributes'],function(_0x3b718b){var _0x1ac07f={};_0x1ac07f[_0x3b718b]={'$like':'%'+_0x56e4e8[_0x70c5('0x30')][_0x70c5('0x3d')]+'%'};return _0x1ac07f;})});}_0x5783ef=_['merge']({},_0x5783ef,_0x56e4e8[_0x70c5('0x3e')]);return _0x6ccde3[_0x70c5('0x4d')](_0x5783ef);}})[_0x70c5('0x26')](function(_0x3aced4){if(_0x3aced4){_0x455798=_0x3aced4[_0x70c5('0x35')];if(!_0x56e4e8[_0x70c5('0x30')][_0x70c5('0x36')](_0x70c5('0x37'))){_0x5783ef['limit']=qs[_0x70c5('0x22')](_0x56e4e8[_0x70c5('0x30')][_0x70c5('0x22')]);_0x5783ef[_0x70c5('0x20')]=qs[_0x70c5('0x20')](_0x56e4e8[_0x70c5('0x30')][_0x70c5('0x20')]);}return _0x6ccde3[_0x70c5('0x4d')](_0x5783ef);}})[_0x70c5('0x26')](function(_0x50d718){if(_0x50d718){return _0x50d718?{'count':_0x455798,'rows':_0x50d718}:null;}})[_0x70c5('0x26')](respondWithResult(_0x2ca94a,null))[_0x70c5('0x41')](handleError(_0x2ca94a,null));};exports[_0x70c5('0x4e')]=function(_0x46d4d1,_0x1860c9,_0x20b9ff){var _0x3a4974={};var _0x1197db={};var _0x5c9bc3;var _0x4daf1b;return db['ZendeskConfiguration'][_0x70c5('0x4c')]({'where':{'id':_0x46d4d1[_0x70c5('0x43')]['id']}})[_0x70c5('0x26')](handleEntityNotFound(_0x1860c9,null))[_0x70c5('0x26')](function(_0x2d3020){if(_0x2d3020){_0x5c9bc3=_0x2d3020;_0x1197db[_0x70c5('0x2e')]=_['keys'](db[_0x70c5('0x4f')][_0x70c5('0x45')]);_0x1197db[_0x70c5('0x30')]=_[_0x70c5('0x44')](_0x46d4d1[_0x70c5('0x30')]);_0x1197db[_0x70c5('0x31')]=_[_0x70c5('0x32')](_0x1197db[_0x70c5('0x2e')],_0x1197db[_0x70c5('0x30')]);_0x3a4974['attributes']=_[_0x70c5('0x32')](_0x1197db['model'],qs[_0x70c5('0x33')](_0x46d4d1[_0x70c5('0x30')][_0x70c5('0x33')]));_0x3a4974['attributes']=_0x3a4974['attributes'][_0x70c5('0x35')]?_0x3a4974['attributes']:_0x1197db[_0x70c5('0x2e')];_0x3a4974[_0x70c5('0x38')]=qs['sort'](_0x46d4d1[_0x70c5('0x30')][_0x70c5('0x39')]);_0x3a4974[_0x70c5('0x3a')]=qs[_0x70c5('0x31')](_[_0x70c5('0x3b')](_0x46d4d1[_0x70c5('0x30')],_0x1197db['filters']));if(_0x46d4d1[_0x70c5('0x30')][_0x70c5('0x3d')]){_0x3a4974[_0x70c5('0x3a')]=_[_0x70c5('0x3c')](_0x3a4974[_0x70c5('0x3a')],{'$or':_[_0x70c5('0x2f')](_0x3a4974[_0x70c5('0x34')],function(_0x21cc56){var _0x41f95f={};_0x41f95f[_0x21cc56]={'$like':'%'+_0x46d4d1[_0x70c5('0x30')][_0x70c5('0x3d')]+'%'};return _0x41f95f;})});}_0x3a4974=_[_0x70c5('0x3c')]({},_0x3a4974,_0x46d4d1[_0x70c5('0x3e')]);return _0x5c9bc3['getDescriptions'](_0x3a4974);}})[_0x70c5('0x26')](function(_0x1ac048){if(_0x1ac048){_0x4daf1b=_0x1ac048[_0x70c5('0x35')];if(!_0x46d4d1[_0x70c5('0x30')]['hasOwnProperty'](_0x70c5('0x37'))){_0x3a4974['limit']=qs[_0x70c5('0x22')](_0x46d4d1['query'][_0x70c5('0x22')]);_0x3a4974[_0x70c5('0x20')]=qs['offset'](_0x46d4d1[_0x70c5('0x30')][_0x70c5('0x20')]);}return _0x5c9bc3[_0x70c5('0x4e')](_0x3a4974);}})[_0x70c5('0x26')](function(_0x1ab817){if(_0x1ab817){return _0x1ab817?{'count':_0x4daf1b,'rows':_0x1ab817}:null;}})[_0x70c5('0x26')](respondWithResult(_0x1860c9,null))[_0x70c5('0x41')](handleError(_0x1860c9,null));};exports[_0x70c5('0x50')]=function(_0x1bbd48,_0x24d360,_0x2ac3ef){var _0x15bf39={};var _0xd1c142={};var _0xb616d3;var _0xff2c30;return db[_0x70c5('0x2a')][_0x70c5('0x4c')]({'where':{'id':_0x1bbd48['params']['id']}})['then'](handleEntityNotFound(_0x24d360,null))[_0x70c5('0x26')](function(_0x110a41){if(_0x110a41){_0xb616d3=_0x110a41;_0xd1c142['model']=_['keys'](db[_0x70c5('0x51')][_0x70c5('0x45')]);_0xd1c142[_0x70c5('0x30')]=_['keys'](_0x1bbd48[_0x70c5('0x30')]);_0xd1c142[_0x70c5('0x31')]=_[_0x70c5('0x32')](_0xd1c142[_0x70c5('0x2e')],_0xd1c142[_0x70c5('0x30')]);_0x15bf39[_0x70c5('0x34')]=_[_0x70c5('0x32')](_0xd1c142[_0x70c5('0x2e')],qs['fields'](_0x1bbd48[_0x70c5('0x30')][_0x70c5('0x33')]));_0x15bf39[_0x70c5('0x34')]=_0x15bf39[_0x70c5('0x34')][_0x70c5('0x35')]?_0x15bf39['attributes']:_0xd1c142[_0x70c5('0x2e')];_0x15bf39['order']=qs[_0x70c5('0x39')](_0x1bbd48['query'][_0x70c5('0x39')]);_0x15bf39[_0x70c5('0x3a')]=qs['filters'](_[_0x70c5('0x3b')](_0x1bbd48[_0x70c5('0x30')],_0xd1c142[_0x70c5('0x31')]));if(_0x1bbd48['query']['filter']){_0x15bf39[_0x70c5('0x3a')]=_[_0x70c5('0x3c')](_0x15bf39[_0x70c5('0x3a')],{'$or':_[_0x70c5('0x2f')](_0x15bf39[_0x70c5('0x34')],function(_0x3b67a7){var _0x920b86={};_0x920b86[_0x3b67a7]={'$like':'%'+_0x1bbd48['query'][_0x70c5('0x3d')]+'%'};return _0x920b86;})});}_0x15bf39=_[_0x70c5('0x3c')]({},_0x15bf39,_0x1bbd48['options']);return _0xb616d3[_0x70c5('0x50')](_0x15bf39);}})['then'](function(_0x5d55b3){if(_0x5d55b3){_0xff2c30=_0x5d55b3[_0x70c5('0x35')];if(!_0x1bbd48[_0x70c5('0x30')][_0x70c5('0x36')](_0x70c5('0x37'))){_0x15bf39[_0x70c5('0x22')]=qs['limit'](_0x1bbd48[_0x70c5('0x30')][_0x70c5('0x22')]);_0x15bf39[_0x70c5('0x20')]=qs[_0x70c5('0x20')](_0x1bbd48[_0x70c5('0x30')][_0x70c5('0x20')]);}return _0xb616d3[_0x70c5('0x50')](_0x15bf39);}})[_0x70c5('0x26')](function(_0x278162){if(_0x278162){return _0x278162?{'count':_0xff2c30,'rows':_0x278162}:null;}})['then'](respondWithResult(_0x24d360,null))[_0x70c5('0x41')](handleError(_0x24d360,null));};exports['setTags']=function(_0x14421b,_0x4b18d9,_0x30d155){if(_0x14421b[_0x70c5('0x49')]['id']){delete _0x14421b[_0x70c5('0x49')]['id'];}return db[_0x70c5('0x2a')]['findOne']({'where':{'id':_0x14421b[_0x70c5('0x43')]['id']}})[_0x70c5('0x26')](handleEntityNotFound(_0x4b18d9,null))['then'](function(_0x3bdc07){if(_0x3bdc07){return _0x3bdc07[_0x70c5('0x52')](_0x14421b[_0x70c5('0x49')][_0x70c5('0x53')]||[]);}return null;})[_0x70c5('0x26')](respondWithResult(_0x4b18d9,null))[_0x70c5('0x41')](handleError(_0x4b18d9,null));}; \ No newline at end of file +var _0x81f1=['status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','options','include','includeAll','find','catch','create','body','params','getFields','findOne','sort','getSubjects','ZendeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x211564,_0x461363){var _0x35570b=function(_0xf4eacb){while(--_0xf4eacb){_0x211564['push'](_0x211564['shift']());}};_0x35570b(++_0x461363);}(_0x81f1,0x12e));var _0x181f=function(_0x11fc7f,_0x4d2b14){_0x11fc7f=_0x11fc7f-0x0;var _0x5356c7=_0x81f1[_0x11fc7f];return _0x5356c7;};'use strict';var emlformat=require(_0x181f('0x0'));var rimraf=require(_0x181f('0x1'));var zipdir=require(_0x181f('0x2'));var jsonpatch=require(_0x181f('0x3'));var rp=require(_0x181f('0x4'));var moment=require(_0x181f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x181f('0x6'));var util=require('util');var path=require(_0x181f('0x7'));var sox=require(_0x181f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x181f('0x9'));var squel=require(_0x181f('0xa'));var crypto=require(_0x181f('0xb'));var jsforce=require(_0x181f('0xc'));var deskjs=require(_0x181f('0xd'));var toCsv=require(_0x181f('0xe'));var querystring=require('querystring');var Papa=require(_0x181f('0xf'));var Redis=require(_0x181f('0x10'));var authService=require(_0x181f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x181f('0x12'));var hardwareService=require(_0x181f('0x13'));var logger=require(_0x181f('0x14'))(_0x181f('0x15'));var utils=require('../../config/utils');var config=require(_0x181f('0x16'));var licenseUtil=require(_0x181f('0x17'));var db=require(_0x181f('0x18'))['db'];function respondWithStatusCode(_0x14f0b2,_0x50e856){_0x50e856=_0x50e856||0xcc;return function(_0x21f716){if(_0x21f716){return _0x14f0b2[_0x181f('0x19')](_0x50e856);}return _0x14f0b2[_0x181f('0x1a')](_0x50e856)[_0x181f('0x1b')]();};}function respondWithResult(_0x594063,_0x470395){_0x470395=_0x470395||0xc8;return function(_0x55b173){if(_0x55b173){return _0x594063['status'](_0x470395)[_0x181f('0x1c')](_0x55b173);}};}function respondWithFilteredResult(_0x5447f1,_0x1d664c){return function(_0xddb25f){if(_0xddb25f){var _0x127193=typeof _0x1d664c['offset']===_0x181f('0x1d')&&typeof _0x1d664c[_0x181f('0x1e')]===_0x181f('0x1d');var _0x46ee64=_0xddb25f[_0x181f('0x1f')];var _0x2fe3e0=_0x127193?0x0:_0x1d664c[_0x181f('0x20')];var _0x487326=_0x127193?_0xddb25f[_0x181f('0x1f')]:_0x1d664c[_0x181f('0x20')]+_0x1d664c[_0x181f('0x1e')];var _0x4954c8;if(_0x487326>=_0x46ee64){_0x487326=_0x46ee64;_0x4954c8=0xc8;}else{_0x4954c8=0xce;}_0x5447f1[_0x181f('0x1a')](_0x4954c8);return _0x5447f1[_0x181f('0x21')](_0x181f('0x22'),_0x2fe3e0+'-'+_0x487326+'/'+_0x46ee64)[_0x181f('0x1c')](_0xddb25f);}return null;};}function patchUpdates(_0x4fc663){return function(_0x5e804e){try{jsonpatch['apply'](_0x5e804e,_0x4fc663,!![]);}catch(_0x1c9e42){return BPromise[_0x181f('0x23')](_0x1c9e42);}return _0x5e804e[_0x181f('0x24')]();};}function saveUpdates(_0x54813e,_0x537cfa){return function(_0x2ac2f7){if(_0x2ac2f7){return _0x2ac2f7[_0x181f('0x25')](_0x54813e)[_0x181f('0x26')](function(_0x58e7fb){return _0x58e7fb;});}return null;};}function removeEntity(_0x3bc708,_0x2254f1){return function(_0x5c66d1){if(_0x5c66d1){return _0x5c66d1[_0x181f('0x27')]()[_0x181f('0x26')](function(){_0x3bc708[_0x181f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25fbde,_0xfa7c49){return function(_0x204e7a){if(!_0x204e7a){_0x25fbde[_0x181f('0x19')](0x194);}return _0x204e7a;};}function handleError(_0x3842c6,_0x459e8e){_0x459e8e=_0x459e8e||0x1f4;return function(_0x3fb0d0){logger['error'](_0x3fb0d0[_0x181f('0x28')]);if(_0x3fb0d0[_0x181f('0x29')]){delete _0x3fb0d0[_0x181f('0x29')];}_0x3842c6[_0x181f('0x1a')](_0x459e8e)[_0x181f('0x2a')](_0x3fb0d0);};}exports['index']=function(_0x2cd1c6,_0x7298f8){var _0x598d85={},_0x2cb35d={},_0x48c1f6={'count':0x0,'rows':[]};var _0x4f652d=_['map'](db[_0x181f('0x2b')][_0x181f('0x2c')],function(_0x4762b8){return{'name':_0x4762b8[_0x181f('0x2d')],'type':_0x4762b8[_0x181f('0x2e')][_0x181f('0x2f')]};});_0x2cb35d[_0x181f('0x30')]=_[_0x181f('0x31')](_0x4f652d,_0x181f('0x29'));_0x2cb35d[_0x181f('0x32')]=_[_0x181f('0x33')](_0x2cd1c6[_0x181f('0x32')]);_0x2cb35d['filters']=_[_0x181f('0x34')](_0x2cb35d[_0x181f('0x30')],_0x2cb35d[_0x181f('0x32')]);_0x598d85[_0x181f('0x35')]=_[_0x181f('0x34')](_0x2cb35d[_0x181f('0x30')],qs['fields'](_0x2cd1c6['query'][_0x181f('0x36')]));_0x598d85[_0x181f('0x35')]=_0x598d85[_0x181f('0x35')][_0x181f('0x37')]?_0x598d85[_0x181f('0x35')]:_0x2cb35d['model'];if(!_0x2cd1c6['query'][_0x181f('0x38')](_0x181f('0x39'))){_0x598d85[_0x181f('0x1e')]=qs[_0x181f('0x1e')](_0x2cd1c6[_0x181f('0x32')][_0x181f('0x1e')]);_0x598d85[_0x181f('0x20')]=qs[_0x181f('0x20')](_0x2cd1c6[_0x181f('0x32')][_0x181f('0x20')]);}_0x598d85[_0x181f('0x3a')]=qs['sort'](_0x2cd1c6[_0x181f('0x32')]['sort']);_0x598d85[_0x181f('0x3b')]=qs[_0x181f('0x3c')](_[_0x181f('0x3d')](_0x2cd1c6[_0x181f('0x32')],_0x2cb35d[_0x181f('0x3c')]),_0x4f652d);if(_0x2cd1c6[_0x181f('0x32')][_0x181f('0x3e')]){_0x598d85[_0x181f('0x3b')]=_['merge'](_0x598d85[_0x181f('0x3b')],{'$or':_[_0x181f('0x31')](_0x4f652d,function(_0x5e3771){if(_0x5e3771[_0x181f('0x2e')]!==_0x181f('0x3f')){var _0x2be6c2={};_0x2be6c2[_0x5e3771[_0x181f('0x29')]]={'$like':'%'+_0x2cd1c6[_0x181f('0x32')][_0x181f('0x3e')]+'%'};return _0x2be6c2;}})});}_0x598d85=_[_0x181f('0x40')]({},_0x598d85,_0x2cd1c6[_0x181f('0x41')]);var _0x3b23ac={'where':_0x598d85[_0x181f('0x3b')]};return db[_0x181f('0x2b')]['count'](_0x3b23ac)[_0x181f('0x26')](function(_0x254c8f){_0x48c1f6['count']=_0x254c8f;if(_0x2cd1c6[_0x181f('0x32')]['includeAll']){_0x598d85[_0x181f('0x42')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x598d85);})[_0x181f('0x26')](function(_0x485f43){_0x48c1f6['rows']=_0x485f43;return _0x48c1f6;})['then'](respondWithFilteredResult(_0x7298f8,_0x598d85))['catch'](handleError(_0x7298f8,null));};exports['show']=function(_0x4bfab7,_0x5138a2){var _0x29b659={'raw':![],'where':{'id':_0x4bfab7['params']['id']}},_0x4fe690={};_0x4fe690['model']=_[_0x181f('0x33')](db[_0x181f('0x2b')][_0x181f('0x2c')]);_0x4fe690['query']=_[_0x181f('0x33')](_0x4bfab7[_0x181f('0x32')]);_0x4fe690[_0x181f('0x3c')]=_[_0x181f('0x34')](_0x4fe690[_0x181f('0x30')],_0x4fe690['query']);_0x29b659[_0x181f('0x35')]=_[_0x181f('0x34')](_0x4fe690[_0x181f('0x30')],qs[_0x181f('0x36')](_0x4bfab7[_0x181f('0x32')][_0x181f('0x36')]));_0x29b659[_0x181f('0x35')]=_0x29b659['attributes'][_0x181f('0x37')]?_0x29b659[_0x181f('0x35')]:_0x4fe690[_0x181f('0x30')];if(_0x4bfab7['query'][_0x181f('0x43')]){_0x29b659[_0x181f('0x42')]=[{'all':!![]}];}_0x29b659=_[_0x181f('0x40')]({},_0x29b659,_0x4bfab7['options']);return db[_0x181f('0x2b')][_0x181f('0x44')](_0x29b659)[_0x181f('0x26')](handleEntityNotFound(_0x5138a2,null))[_0x181f('0x26')](respondWithResult(_0x5138a2,null))[_0x181f('0x45')](handleError(_0x5138a2,null));};exports[_0x181f('0x46')]=function(_0xf6ab8e,_0x3b48c4){return db[_0x181f('0x2b')][_0x181f('0x46')](_0xf6ab8e[_0x181f('0x47')],{})[_0x181f('0x26')](respondWithResult(_0x3b48c4,0xc9))[_0x181f('0x45')](handleError(_0x3b48c4,null));};exports[_0x181f('0x25')]=function(_0x7933e2,_0x131317){if(_0x7933e2['body']['id']){delete _0x7933e2[_0x181f('0x47')]['id'];}return db[_0x181f('0x2b')][_0x181f('0x44')]({'where':{'id':_0x7933e2['params']['id']}})['then'](handleEntityNotFound(_0x131317,null))['then'](saveUpdates(_0x7933e2[_0x181f('0x47')],null))[_0x181f('0x26')](respondWithResult(_0x131317,null))['catch'](handleError(_0x131317,null));};exports['destroy']=function(_0x41cd5b,_0x1817d2){return db[_0x181f('0x2b')][_0x181f('0x44')]({'where':{'id':_0x41cd5b[_0x181f('0x48')]['id']}})['then'](handleEntityNotFound(_0x1817d2,null))[_0x181f('0x26')](removeEntity(_0x1817d2,null))['catch'](handleError(_0x1817d2,null));};exports[_0x181f('0x49')]=function(_0xfa500,_0x5d4bcf,_0x4fdf6c){var _0x399f73={};var _0x3c7687={};var _0x18277e;var _0x1853d7;return db[_0x181f('0x2b')][_0x181f('0x4a')]({'where':{'id':_0xfa500['params']['id']}})[_0x181f('0x26')](handleEntityNotFound(_0x5d4bcf,null))[_0x181f('0x26')](function(_0x5e467c){if(_0x5e467c){_0x18277e=_0x5e467c;_0x3c7687[_0x181f('0x30')]=_[_0x181f('0x33')](db['ZendeskField']['rawAttributes']);_0x3c7687[_0x181f('0x32')]=_['keys'](_0xfa500[_0x181f('0x32')]);_0x3c7687['filters']=_[_0x181f('0x34')](_0x3c7687[_0x181f('0x30')],_0x3c7687[_0x181f('0x32')]);_0x399f73[_0x181f('0x35')]=_[_0x181f('0x34')](_0x3c7687[_0x181f('0x30')],qs['fields'](_0xfa500['query'][_0x181f('0x36')]));_0x399f73[_0x181f('0x35')]=_0x399f73[_0x181f('0x35')][_0x181f('0x37')]?_0x399f73[_0x181f('0x35')]:_0x3c7687[_0x181f('0x30')];_0x399f73[_0x181f('0x3a')]=qs[_0x181f('0x4b')](_0xfa500[_0x181f('0x32')][_0x181f('0x4b')]);_0x399f73['where']=qs[_0x181f('0x3c')](_['pick'](_0xfa500['query'],_0x3c7687['filters']));if(_0xfa500[_0x181f('0x32')]['filter']){_0x399f73[_0x181f('0x3b')]=_[_0x181f('0x40')](_0x399f73[_0x181f('0x3b')],{'$or':_[_0x181f('0x31')](_0x399f73[_0x181f('0x35')],function(_0x4f2799){var _0x4db2eb={};_0x4db2eb[_0x4f2799]={'$like':'%'+_0xfa500['query'][_0x181f('0x3e')]+'%'};return _0x4db2eb;})});}_0x399f73=_['merge']({},_0x399f73,_0xfa500[_0x181f('0x41')]);return _0x18277e[_0x181f('0x49')](_0x399f73);}})[_0x181f('0x26')](function(_0x5388d6){if(_0x5388d6){_0x1853d7=_0x5388d6[_0x181f('0x37')];if(!_0xfa500[_0x181f('0x32')]['hasOwnProperty'](_0x181f('0x39'))){_0x399f73[_0x181f('0x1e')]=qs['limit'](_0xfa500[_0x181f('0x32')][_0x181f('0x1e')]);_0x399f73[_0x181f('0x20')]=qs[_0x181f('0x20')](_0xfa500[_0x181f('0x32')]['offset']);}return _0x18277e[_0x181f('0x49')](_0x399f73);}})[_0x181f('0x26')](function(_0x28cf68){if(_0x28cf68){return _0x28cf68?{'count':_0x1853d7,'rows':_0x28cf68}:null;}})[_0x181f('0x26')](respondWithResult(_0x5d4bcf,null))[_0x181f('0x45')](handleError(_0x5d4bcf,null));};exports[_0x181f('0x4c')]=function(_0x42c2df,_0x61bd8b,_0x194500){var _0x6f306c={};var _0x83941c={};var _0x4effc8;var _0x3741c8;return db[_0x181f('0x2b')]['findOne']({'where':{'id':_0x42c2df[_0x181f('0x48')]['id']}})[_0x181f('0x26')](handleEntityNotFound(_0x61bd8b,null))[_0x181f('0x26')](function(_0x5a2b2f){if(_0x5a2b2f){_0x4effc8=_0x5a2b2f;_0x83941c[_0x181f('0x30')]=_[_0x181f('0x33')](db[_0x181f('0x4d')][_0x181f('0x2c')]);_0x83941c['query']=_[_0x181f('0x33')](_0x42c2df[_0x181f('0x32')]);_0x83941c[_0x181f('0x3c')]=_[_0x181f('0x34')](_0x83941c['model'],_0x83941c[_0x181f('0x32')]);_0x6f306c[_0x181f('0x35')]=_[_0x181f('0x34')](_0x83941c[_0x181f('0x30')],qs[_0x181f('0x36')](_0x42c2df[_0x181f('0x32')][_0x181f('0x36')]));_0x6f306c[_0x181f('0x35')]=_0x6f306c[_0x181f('0x35')][_0x181f('0x37')]?_0x6f306c[_0x181f('0x35')]:_0x83941c[_0x181f('0x30')];_0x6f306c[_0x181f('0x3a')]=qs['sort'](_0x42c2df[_0x181f('0x32')][_0x181f('0x4b')]);_0x6f306c[_0x181f('0x3b')]=qs[_0x181f('0x3c')](_[_0x181f('0x3d')](_0x42c2df[_0x181f('0x32')],_0x83941c[_0x181f('0x3c')]));if(_0x42c2df[_0x181f('0x32')][_0x181f('0x3e')]){_0x6f306c[_0x181f('0x3b')]=_[_0x181f('0x40')](_0x6f306c['where'],{'$or':_[_0x181f('0x31')](_0x6f306c[_0x181f('0x35')],function(_0x3d2eee){var _0x3b8806={};_0x3b8806[_0x3d2eee]={'$like':'%'+_0x42c2df[_0x181f('0x32')][_0x181f('0x3e')]+'%'};return _0x3b8806;})});}_0x6f306c=_[_0x181f('0x40')]({},_0x6f306c,_0x42c2df[_0x181f('0x41')]);return _0x4effc8[_0x181f('0x4c')](_0x6f306c);}})[_0x181f('0x26')](function(_0x25eb18){if(_0x25eb18){_0x3741c8=_0x25eb18['length'];if(!_0x42c2df[_0x181f('0x32')][_0x181f('0x38')](_0x181f('0x39'))){_0x6f306c[_0x181f('0x1e')]=qs['limit'](_0x42c2df[_0x181f('0x32')][_0x181f('0x1e')]);_0x6f306c[_0x181f('0x20')]=qs[_0x181f('0x20')](_0x42c2df[_0x181f('0x32')][_0x181f('0x20')]);}return _0x4effc8['getSubjects'](_0x6f306c);}})['then'](function(_0x5b63ff){if(_0x5b63ff){return _0x5b63ff?{'count':_0x3741c8,'rows':_0x5b63ff}:null;}})[_0x181f('0x26')](respondWithResult(_0x61bd8b,null))[_0x181f('0x45')](handleError(_0x61bd8b,null));};exports[_0x181f('0x4e')]=function(_0x1fd54c,_0x444b36,_0x1372f5){var _0x465fc5={};var _0x1d6316={};var _0x5be614;var _0x396633;return db[_0x181f('0x2b')][_0x181f('0x4a')]({'where':{'id':_0x1fd54c[_0x181f('0x48')]['id']}})[_0x181f('0x26')](handleEntityNotFound(_0x444b36,null))[_0x181f('0x26')](function(_0x59d580){if(_0x59d580){_0x5be614=_0x59d580;_0x1d6316['model']=_['keys'](db[_0x181f('0x4d')]['rawAttributes']);_0x1d6316['query']=_[_0x181f('0x33')](_0x1fd54c[_0x181f('0x32')]);_0x1d6316['filters']=_[_0x181f('0x34')](_0x1d6316[_0x181f('0x30')],_0x1d6316[_0x181f('0x32')]);_0x465fc5[_0x181f('0x35')]=_['intersection'](_0x1d6316['model'],qs[_0x181f('0x36')](_0x1fd54c['query'][_0x181f('0x36')]));_0x465fc5[_0x181f('0x35')]=_0x465fc5['attributes'][_0x181f('0x37')]?_0x465fc5['attributes']:_0x1d6316['model'];_0x465fc5[_0x181f('0x3a')]=qs[_0x181f('0x4b')](_0x1fd54c[_0x181f('0x32')]['sort']);_0x465fc5[_0x181f('0x3b')]=qs[_0x181f('0x3c')](_[_0x181f('0x3d')](_0x1fd54c['query'],_0x1d6316[_0x181f('0x3c')]));if(_0x1fd54c[_0x181f('0x32')][_0x181f('0x3e')]){_0x465fc5[_0x181f('0x3b')]=_[_0x181f('0x40')](_0x465fc5[_0x181f('0x3b')],{'$or':_['map'](_0x465fc5[_0x181f('0x35')],function(_0x293e4d){var _0x5e8059={};_0x5e8059[_0x293e4d]={'$like':'%'+_0x1fd54c[_0x181f('0x32')]['filter']+'%'};return _0x5e8059;})});}_0x465fc5=_[_0x181f('0x40')]({},_0x465fc5,_0x1fd54c[_0x181f('0x41')]);return _0x5be614[_0x181f('0x4e')](_0x465fc5);}})[_0x181f('0x26')](function(_0x25c36e){if(_0x25c36e){_0x396633=_0x25c36e[_0x181f('0x37')];if(!_0x1fd54c[_0x181f('0x32')][_0x181f('0x38')](_0x181f('0x39'))){_0x465fc5[_0x181f('0x1e')]=qs['limit'](_0x1fd54c[_0x181f('0x32')][_0x181f('0x1e')]);_0x465fc5['offset']=qs[_0x181f('0x20')](_0x1fd54c[_0x181f('0x32')][_0x181f('0x20')]);}return _0x5be614[_0x181f('0x4e')](_0x465fc5);}})[_0x181f('0x26')](function(_0x3e2a6b){if(_0x3e2a6b){return _0x3e2a6b?{'count':_0x396633,'rows':_0x3e2a6b}:null;}})[_0x181f('0x26')](respondWithResult(_0x444b36,null))[_0x181f('0x45')](handleError(_0x444b36,null));};exports[_0x181f('0x4f')]=function(_0x2f49cf,_0x4fd2d9,_0x526346){var _0x313b9d={};var _0x519ca3={};var _0x243c7a;var _0x3927b4;return db[_0x181f('0x2b')]['findOne']({'where':{'id':_0x2f49cf[_0x181f('0x48')]['id']}})[_0x181f('0x26')](handleEntityNotFound(_0x4fd2d9,null))[_0x181f('0x26')](function(_0xbae595){if(_0xbae595){_0x243c7a=_0xbae595;_0x519ca3[_0x181f('0x30')]=_[_0x181f('0x33')](db['Tag'][_0x181f('0x2c')]);_0x519ca3[_0x181f('0x32')]=_[_0x181f('0x33')](_0x2f49cf[_0x181f('0x32')]);_0x519ca3[_0x181f('0x3c')]=_['intersection'](_0x519ca3[_0x181f('0x30')],_0x519ca3[_0x181f('0x32')]);_0x313b9d[_0x181f('0x35')]=_[_0x181f('0x34')](_0x519ca3[_0x181f('0x30')],qs[_0x181f('0x36')](_0x2f49cf[_0x181f('0x32')]['fields']));_0x313b9d[_0x181f('0x35')]=_0x313b9d[_0x181f('0x35')][_0x181f('0x37')]?_0x313b9d[_0x181f('0x35')]:_0x519ca3[_0x181f('0x30')];_0x313b9d[_0x181f('0x3a')]=qs['sort'](_0x2f49cf[_0x181f('0x32')][_0x181f('0x4b')]);_0x313b9d['where']=qs[_0x181f('0x3c')](_[_0x181f('0x3d')](_0x2f49cf[_0x181f('0x32')],_0x519ca3[_0x181f('0x3c')]));if(_0x2f49cf[_0x181f('0x32')][_0x181f('0x3e')]){_0x313b9d[_0x181f('0x3b')]=_[_0x181f('0x40')](_0x313b9d[_0x181f('0x3b')],{'$or':_['map'](_0x313b9d[_0x181f('0x35')],function(_0x31395e){var _0x3c8583={};_0x3c8583[_0x31395e]={'$like':'%'+_0x2f49cf['query'][_0x181f('0x3e')]+'%'};return _0x3c8583;})});}_0x313b9d=_['merge']({},_0x313b9d,_0x2f49cf[_0x181f('0x41')]);return _0x243c7a[_0x181f('0x4f')](_0x313b9d);}})['then'](function(_0x270ca7){if(_0x270ca7){_0x3927b4=_0x270ca7[_0x181f('0x37')];if(!_0x2f49cf['query'][_0x181f('0x38')](_0x181f('0x39'))){_0x313b9d[_0x181f('0x1e')]=qs[_0x181f('0x1e')](_0x2f49cf['query'][_0x181f('0x1e')]);_0x313b9d[_0x181f('0x20')]=qs[_0x181f('0x20')](_0x2f49cf[_0x181f('0x32')]['offset']);}return _0x243c7a[_0x181f('0x4f')](_0x313b9d);}})[_0x181f('0x26')](function(_0xf71aea){if(_0xf71aea){return _0xf71aea?{'count':_0x3927b4,'rows':_0xf71aea}:null;}})['then'](respondWithResult(_0x4fd2d9,null))['catch'](handleError(_0x4fd2d9,null));};exports[_0x181f('0x50')]=function(_0x527df8,_0x35859f,_0x192c7d){if(_0x527df8['body']['id']){delete _0x527df8[_0x181f('0x47')]['id'];}return db[_0x181f('0x2b')][_0x181f('0x4a')]({'where':{'id':_0x527df8[_0x181f('0x48')]['id']}})[_0x181f('0x26')](handleEntityNotFound(_0x35859f,null))[_0x181f('0x26')](function(_0x339a1d){if(_0x339a1d){return _0x339a1d[_0x181f('0x50')](_0x527df8[_0x181f('0x47')][_0x181f('0x51')]||[]);}return null;})[_0x181f('0x26')](respondWithResult(_0x35859f,null))[_0x181f('0x45')](handleError(_0x35859f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 107ff88..6271c8f 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 _0x351d=['../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x44ee06,_0x5ae651){var _0x1032d8=function(_0x14a742){while(--_0x14a742){_0x44ee06['push'](_0x44ee06['shift']());}};_0x1032d8(++_0x5ae651);}(_0x351d,0x90));var _0xd351=function(_0x310449,_0x49ef86){_0x310449=_0x310449-0x0;var _0x570713=_0x351d[_0x310449];return _0x570713;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2cf=['request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','util','api','bluebird'];(function(_0x364ccd,_0x27a439){var _0x388ae5=function(_0x43d062){while(--_0x43d062){_0x364ccd['push'](_0x364ccd['shift']());}};_0x388ae5(++_0x27a439);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x5a3785,_0x2de636){_0x5a3785=_0x5a3785-0x0;var _0x4d058a=_0xe2cf[_0x5a3785];return _0x4d058a;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var logger=require('../../config/logger')(_0xfe2c('0x1'));var moment=require('moment');var BPromise=require(_0xfe2c('0x2'));var rp=require(_0xfe2c('0x3'));var fs=require('fs');var path=require(_0xfe2c('0x4'));var rimraf=require(_0xfe2c('0x5'));var config=require('../../config/environment');var attributes=require(_0xfe2c('0x6'));module[_0xfe2c('0x7')]=function(_0x55bb12,_0x4fa079){return _0x55bb12[_0xfe2c('0x8')](_0xfe2c('0x9'),attributes,{'tableName':'int_zendesk_configurations','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 75d796a..dfd493d 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 _0x498e=['request','then','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x498e,0xe7));var _0xe498=function(_0x402fa6,_0x307f1b){_0x402fa6=_0x402fa6-0x0;var _0x19f0c5=_0x498e[_0x402fa6];return _0x19f0c5;};'use strict';var _=require(_0xe498('0x0'));var util=require(_0xe498('0x1'));var moment=require(_0xe498('0x2'));var BPromise=require('bluebird');var rs=require(_0xe498('0x3'));var fs=require('fs');var Redis=require(_0xe498('0x4'));var db=require(_0xe498('0x5'))['db'];var utils=require(_0xe498('0x6'));var logger=require('../../config/logger')(_0xe498('0x7'));var config=require(_0xe498('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe498('0x9')][_0xe498('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50236a,_0x14f013,_0x17ac78){return new BPromise(function(_0x5262de,_0x2a7072){return client[_0xe498('0xb')](_0x50236a,_0x17ac78)[_0xe498('0xc')](function(_0x352c4e){logger['info'](_0xe498('0xd'),_0x14f013,'request\x20sent');logger['debug'](_0xe498('0xe'),_0x14f013,_0xe498('0xf'),JSON[_0xe498('0x10')](_0x352c4e));if(_0x352c4e[_0xe498('0x11')]){if(_0x352c4e[_0xe498('0x11')][_0xe498('0x12')]===0x1f4){logger[_0xe498('0x11')](_0xe498('0xd'),_0x14f013,_0x352c4e['error']['message']);return _0x2a7072(_0x352c4e[_0xe498('0x11')][_0xe498('0x13')]);}logger[_0xe498('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x14f013,_0x352c4e['error']['message']);return _0x5262de(_0x352c4e['error']['message']);}else{logger['info'](_0xe498('0xd'),_0x14f013,'request\x20sent');_0x5262de(_0x352c4e[_0xe498('0x14')][_0xe498('0x13')]);}})[_0xe498('0x15')](function(_0x8ef84c){logger[_0xe498('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x14f013,_0x8ef84c);_0x2a7072(_0x8ef84c);});});} \ No newline at end of file +var _0xc177=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0xc177,0x100));var _0x7c17=function(_0xba5268,_0x1c5031){_0xba5268=_0xba5268-0x0;var _0x45dddd=_0xc177[_0xba5268];return _0x45dddd;};'use strict';var _=require(_0x7c17('0x0'));var util=require(_0x7c17('0x1'));var moment=require(_0x7c17('0x2'));var BPromise=require(_0x7c17('0x3'));var rs=require(_0x7c17('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c17('0x5'))['db'];var utils=require(_0x7c17('0x6'));var logger=require(_0x7c17('0x7'))(_0x7c17('0x8'));var config=require(_0x7c17('0x9'));var jayson=require(_0x7c17('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e581b,_0x3769a9,_0x4c35d7){return new BPromise(function(_0x2f3741,_0x3a8d1e){return client['request'](_0x2e581b,_0x4c35d7)['then'](function(_0x54eb55){logger[_0x7c17('0xb')](_0x7c17('0xc'),_0x3769a9,_0x7c17('0xd'));logger[_0x7c17('0xe')](_0x7c17('0xf'),_0x3769a9,_0x7c17('0xd'),JSON[_0x7c17('0x10')](_0x54eb55));if(_0x54eb55[_0x7c17('0x11')]){if(_0x54eb55['error']['code']===0x1f4){logger[_0x7c17('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3769a9,_0x54eb55[_0x7c17('0x11')][_0x7c17('0x12')]);return _0x3a8d1e(_0x54eb55[_0x7c17('0x11')][_0x7c17('0x12')]);}logger[_0x7c17('0x11')](_0x7c17('0xc'),_0x3769a9,_0x54eb55[_0x7c17('0x11')][_0x7c17('0x12')]);return _0x2f3741(_0x54eb55['error'][_0x7c17('0x12')]);}else{logger[_0x7c17('0xb')](_0x7c17('0xc'),_0x3769a9,_0x7c17('0xd'));_0x2f3741(_0x54eb55['result'][_0x7c17('0x12')]);}})[_0x7c17('0x13')](function(_0xf119a8){logger[_0x7c17('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3769a9,_0xf119a8);_0x3a8d1e(_0xf119a8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index a5cbecb..c09945a 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 _0xa0e9=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0xa0e9,0x18c));var _0x9a0e=function(_0x2d5cbd,_0x286551){_0x2d5cbd=_0x2d5cbd-0x0;var _0x432a42=_0xa0e9[_0x2d5cbd];return _0x432a42;};'use strict';var multer=require('multer');var util=require(_0x9a0e('0x0'));var path=require(_0x9a0e('0x1'));var timeout=require(_0x9a0e('0x2'));var express=require(_0x9a0e('0x3'));var router=express[_0x9a0e('0x4')]();var fs_extra=require(_0x9a0e('0x5'));var auth=require(_0x9a0e('0x6'));var interaction=require(_0x9a0e('0x7'));var config=require(_0x9a0e('0x8'));var controller=require(_0x9a0e('0x9'));router[_0x9a0e('0xa')]('/',auth[_0x9a0e('0xb')](),controller[_0x9a0e('0xc')]);router[_0x9a0e('0xa')](_0x9a0e('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9a0e('0xb')](),controller[_0x9a0e('0xe')]);router[_0x9a0e('0xf')](_0x9a0e('0xd'),auth['isAuthenticated'](),controller[_0x9a0e('0x10')]);router[_0x9a0e('0x11')](_0x9a0e('0xd'),auth[_0x9a0e('0xb')](),controller[_0x9a0e('0x12')]);module[_0x9a0e('0x13')]=router; \ No newline at end of file +var _0xfed1=['../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','index','isAuthenticated','show','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3c37f5,_0x464875){var _0x5c25d7=function(_0x5e0265){while(--_0x5e0265){_0x3c37f5['push'](_0x3c37f5['shift']());}};_0x5c25d7(++_0x464875);}(_0xfed1,0xcb));var _0x1fed=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xfed1[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0x1fed('0x0'));var util=require(_0x1fed('0x1'));var path=require(_0x1fed('0x2'));var timeout=require('connect-timeout');var express=require(_0x1fed('0x3'));var router=express[_0x1fed('0x4')]();var fs_extra=require(_0x1fed('0x5'));var auth=require(_0x1fed('0x6'));var interaction=require(_0x1fed('0x7'));var config=require('../../config/environment');var controller=require(_0x1fed('0x8'));router[_0x1fed('0x9')]('/',auth['isAuthenticated'](),controller[_0x1fed('0xa')]);router[_0x1fed('0x9')]('/:id',auth[_0x1fed('0xb')](),controller[_0x1fed('0xc')]);router['post']('/',auth[_0x1fed('0xb')](),controller[_0x1fed('0xd')]);router[_0x1fed('0xe')](_0x1fed('0xf'),auth[_0x1fed('0xb')](),controller['update']);router[_0x1fed('0x10')](_0x1fed('0xf'),auth[_0x1fed('0xb')](),controller[_0x1fed('0x11')]);module[_0x1fed('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 ccd4d31..9d38e35 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 _0x6f9a=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x4aad38,_0x1acb99){var _0x1cf2d3=function(_0x4b1598){while(--_0x4b1598){_0x4aad38['push'](_0x4aad38['shift']());}};_0x1cf2d3(++_0x1acb99);}(_0x6f9a,0x118));var _0xa6f9=function(_0x9b4a6c,_0x503cf8){_0x9b4a6c=_0x9b4a6c-0x0;var _0x4b2310=_0x6f9a[_0x9b4a6c];return _0x4b2310;};'use strict';var Sequelize=require(_0xa6f9('0x0'));module[_0xa6f9('0x1')]={'type':{'type':Sequelize[_0xa6f9('0x2')](_0xa6f9('0x3'),_0xa6f9('0x4'),_0xa6f9('0x5'),_0xa6f9('0x6'),'picklist'),'defaultValue':_0xa6f9('0x3')},'content':{'type':Sequelize[_0xa6f9('0x7')]},'key':{'type':Sequelize[_0xa6f9('0x7')]},'keyType':{'type':Sequelize[_0xa6f9('0x2')](_0xa6f9('0x3'),'variable',_0xa6f9('0x5'))},'keyContent':{'type':Sequelize[_0xa6f9('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa6f9('0x7')]},'customField':{'type':Sequelize[_0xa6f9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa6f9('0x7')]}}; \ No newline at end of file +var _0x1754=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x5886a9,_0x2d3633){var _0x698c29=function(_0x3c4361){while(--_0x3c4361){_0x5886a9['push'](_0x5886a9['shift']());}};_0x698c29(++_0x2d3633);}(_0x1754,0xe7));var _0x4175=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x1754[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0x4175('0x0'));module['exports']={'type':{'type':Sequelize[_0x4175('0x1')](_0x4175('0x2'),_0x4175('0x3'),_0x4175('0x4'),_0x4175('0x5'),_0x4175('0x6')),'defaultValue':_0x4175('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4175('0x1')]('string','variable',_0x4175('0x4'))},'keyContent':{'type':Sequelize[_0x4175('0x7')]},'idField':{'type':Sequelize[_0x4175('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4175('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4175('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e1d3950..15685e1 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 _0xf498=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','update','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','ZendeskField','type','key','model','map','query','keys'];(function(_0x34fcb3,_0x4c412f){var _0x488710=function(_0x3e0d03){while(--_0x3e0d03){_0x34fcb3['push'](_0x34fcb3['shift']());}};_0x488710(++_0x4c412f);}(_0xf498,0x108));var _0x8f49=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xf498[_0x47aa64];return _0x549c7a;};'use strict';var emlformat=require(_0x8f49('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f49('0x1'));var jsonpatch=require(_0x8f49('0x2'));var rp=require('request-promise');var moment=require(_0x8f49('0x3'));var BPromise=require(_0x8f49('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8f49('0x5'));var sox=require(_0x8f49('0x6'));var csv=require(_0x8f49('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f49('0x8'));var _=require(_0x8f49('0x9'));var squel=require(_0x8f49('0xa'));var crypto=require(_0x8f49('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8f49('0xc'));var toCsv=require(_0x8f49('0x7'));var querystring=require('querystring');var Papa=require(_0x8f49('0xd'));var Redis=require(_0x8f49('0xe'));var authService=require(_0x8f49('0xf'));var qs=require(_0x8f49('0x10'));var as=require(_0x8f49('0x11'));var hardwareService=require(_0x8f49('0x12'));var logger=require(_0x8f49('0x13'))(_0x8f49('0x14'));var utils=require(_0x8f49('0x15'));var config=require(_0x8f49('0x16'));var licenseUtil=require(_0x8f49('0x17'));var db=require(_0x8f49('0x18'))['db'];function respondWithStatusCode(_0x231660,_0x3eb7d4){_0x3eb7d4=_0x3eb7d4||0xcc;return function(_0x1d050d){if(_0x1d050d){return _0x231660[_0x8f49('0x19')](_0x3eb7d4);}return _0x231660['status'](_0x3eb7d4)[_0x8f49('0x1a')]();};}function respondWithResult(_0x14dbbd,_0x1d5b82){_0x1d5b82=_0x1d5b82||0xc8;return function(_0x3d38f2){if(_0x3d38f2){return _0x14dbbd[_0x8f49('0x1b')](_0x1d5b82)[_0x8f49('0x1c')](_0x3d38f2);}};}function respondWithFilteredResult(_0x1fdb2b,_0x305613){return function(_0x2b44df){if(_0x2b44df){var _0x28324c=typeof _0x305613[_0x8f49('0x1d')]===_0x8f49('0x1e')&&typeof _0x305613['limit']===_0x8f49('0x1e');var _0x205cfa=_0x2b44df['count'];var _0x2cee85=_0x28324c?0x0:_0x305613[_0x8f49('0x1d')];var _0x1ed6eb=_0x28324c?_0x2b44df[_0x8f49('0x1f')]:_0x305613[_0x8f49('0x1d')]+_0x305613[_0x8f49('0x20')];var _0x397b6b;if(_0x1ed6eb>=_0x205cfa){_0x1ed6eb=_0x205cfa;_0x397b6b=0xc8;}else{_0x397b6b=0xce;}_0x1fdb2b[_0x8f49('0x1b')](_0x397b6b);return _0x1fdb2b[_0x8f49('0x21')](_0x8f49('0x22'),_0x2cee85+'-'+_0x1ed6eb+'/'+_0x205cfa)[_0x8f49('0x1c')](_0x2b44df);}return null;};}function patchUpdates(_0x4ae4e1){return function(_0x3b4cee){try{jsonpatch[_0x8f49('0x23')](_0x3b4cee,_0x4ae4e1,!![]);}catch(_0x1692ff){return BPromise[_0x8f49('0x24')](_0x1692ff);}return _0x3b4cee[_0x8f49('0x25')]();};}function saveUpdates(_0x4f957d,_0x3e5957){return function(_0x9e0bed){if(_0x9e0bed){return _0x9e0bed['update'](_0x4f957d)['then'](function(_0x2af6e8){return _0x2af6e8;});}return null;};}function removeEntity(_0x448ac3,_0x2dad23){return function(_0x5f2f88){if(_0x5f2f88){return _0x5f2f88[_0x8f49('0x26')]()[_0x8f49('0x27')](function(){_0x448ac3[_0x8f49('0x1b')](0xcc)[_0x8f49('0x1a')]();});}};}function handleEntityNotFound(_0x175526,_0x2a34c0){return function(_0x5ea5f5){if(!_0x5ea5f5){_0x175526[_0x8f49('0x19')](0x194);}return _0x5ea5f5;};}function handleError(_0x9fd032,_0x3ad2f5){_0x3ad2f5=_0x3ad2f5||0x1f4;return function(_0x42fdd2){logger[_0x8f49('0x28')](_0x42fdd2[_0x8f49('0x29')]);if(_0x42fdd2[_0x8f49('0x2a')]){delete _0x42fdd2[_0x8f49('0x2a')];}_0x9fd032[_0x8f49('0x1b')](_0x3ad2f5)[_0x8f49('0x2b')](_0x42fdd2);};}exports[_0x8f49('0x2c')]=function(_0x354ad4,_0xfe4cb2){var _0x4eac20={},_0x566258={},_0x2d0041={'count':0x0,'rows':[]};var _0x596911=_['map'](db[_0x8f49('0x2d')]['rawAttributes'],function(_0x47d4c1){return{'name':_0x47d4c1['fieldName'],'type':_0x47d4c1[_0x8f49('0x2e')][_0x8f49('0x2f')]};});_0x566258[_0x8f49('0x30')]=_[_0x8f49('0x31')](_0x596911,_0x8f49('0x2a'));_0x566258[_0x8f49('0x32')]=_[_0x8f49('0x33')](_0x354ad4[_0x8f49('0x32')]);_0x566258[_0x8f49('0x34')]=_[_0x8f49('0x35')](_0x566258[_0x8f49('0x30')],_0x566258[_0x8f49('0x32')]);_0x4eac20[_0x8f49('0x36')]=_[_0x8f49('0x35')](_0x566258['model'],qs[_0x8f49('0x37')](_0x354ad4[_0x8f49('0x32')]['fields']));_0x4eac20[_0x8f49('0x36')]=_0x4eac20[_0x8f49('0x36')]['length']?_0x4eac20['attributes']:_0x566258[_0x8f49('0x30')];if(!_0x354ad4[_0x8f49('0x32')][_0x8f49('0x38')](_0x8f49('0x39'))){_0x4eac20[_0x8f49('0x20')]=qs['limit'](_0x354ad4[_0x8f49('0x32')][_0x8f49('0x20')]);_0x4eac20['offset']=qs[_0x8f49('0x1d')](_0x354ad4[_0x8f49('0x32')][_0x8f49('0x1d')]);}_0x4eac20[_0x8f49('0x3a')]=qs[_0x8f49('0x3b')](_0x354ad4[_0x8f49('0x32')][_0x8f49('0x3b')]);_0x4eac20[_0x8f49('0x3c')]=qs[_0x8f49('0x34')](_[_0x8f49('0x3d')](_0x354ad4[_0x8f49('0x32')],_0x566258['filters']),_0x596911);if(_0x354ad4[_0x8f49('0x32')][_0x8f49('0x3e')]){_0x4eac20[_0x8f49('0x3c')]=_[_0x8f49('0x3f')](_0x4eac20[_0x8f49('0x3c')],{'$or':_[_0x8f49('0x31')](_0x596911,function(_0x3fc1f8){if(_0x3fc1f8[_0x8f49('0x2e')]!==_0x8f49('0x40')){var _0x3c5c7d={};_0x3c5c7d[_0x3fc1f8[_0x8f49('0x2a')]]={'$like':'%'+_0x354ad4[_0x8f49('0x32')][_0x8f49('0x3e')]+'%'};return _0x3c5c7d;}})});}_0x4eac20=_[_0x8f49('0x3f')]({},_0x4eac20,_0x354ad4[_0x8f49('0x41')]);var _0x57462e={'where':_0x4eac20[_0x8f49('0x3c')]};return db[_0x8f49('0x2d')][_0x8f49('0x1f')](_0x57462e)[_0x8f49('0x27')](function(_0x397830){_0x2d0041[_0x8f49('0x1f')]=_0x397830;if(_0x354ad4[_0x8f49('0x32')][_0x8f49('0x42')]){_0x4eac20[_0x8f49('0x43')]=[{'all':!![]}];}return db[_0x8f49('0x2d')][_0x8f49('0x44')](_0x4eac20);})['then'](function(_0x327134){_0x2d0041[_0x8f49('0x45')]=_0x327134;return _0x2d0041;})[_0x8f49('0x27')](respondWithFilteredResult(_0xfe4cb2,_0x4eac20))['catch'](handleError(_0xfe4cb2,null));};exports[_0x8f49('0x46')]=function(_0xf29c03,_0x5f0230){var _0x5166fb={'raw':!![],'where':{'id':_0xf29c03[_0x8f49('0x47')]['id']}},_0x488416={};_0x488416[_0x8f49('0x30')]=_[_0x8f49('0x33')](db[_0x8f49('0x2d')][_0x8f49('0x48')]);_0x488416[_0x8f49('0x32')]=_[_0x8f49('0x33')](_0xf29c03[_0x8f49('0x32')]);_0x488416[_0x8f49('0x34')]=_['intersection'](_0x488416[_0x8f49('0x30')],_0x488416[_0x8f49('0x32')]);_0x5166fb[_0x8f49('0x36')]=_[_0x8f49('0x35')](_0x488416[_0x8f49('0x30')],qs[_0x8f49('0x37')](_0xf29c03['query'][_0x8f49('0x37')]));_0x5166fb['attributes']=_0x5166fb['attributes'][_0x8f49('0x49')]?_0x5166fb[_0x8f49('0x36')]:_0x488416[_0x8f49('0x30')];if(_0xf29c03[_0x8f49('0x32')][_0x8f49('0x42')]){_0x5166fb['include']=[{'all':!![]}];}_0x5166fb=_[_0x8f49('0x3f')]({},_0x5166fb,_0xf29c03[_0x8f49('0x41')]);return db[_0x8f49('0x2d')][_0x8f49('0x4a')](_0x5166fb)[_0x8f49('0x27')](handleEntityNotFound(_0x5f0230,null))[_0x8f49('0x27')](respondWithResult(_0x5f0230,null))[_0x8f49('0x4b')](handleError(_0x5f0230,null));};exports[_0x8f49('0x4c')]=function(_0x3f05d1,_0x551e90){return db[_0x8f49('0x2d')][_0x8f49('0x4c')](_0x3f05d1[_0x8f49('0x4d')],{})[_0x8f49('0x27')](respondWithResult(_0x551e90,0xc9))[_0x8f49('0x4b')](handleError(_0x551e90,null));};exports[_0x8f49('0x4e')]=function(_0x3f09ee,_0x5159d5){if(_0x3f09ee[_0x8f49('0x4d')]['id']){delete _0x3f09ee[_0x8f49('0x4d')]['id'];}return db[_0x8f49('0x2d')][_0x8f49('0x4a')]({'where':{'id':_0x3f09ee[_0x8f49('0x47')]['id']}})['then'](handleEntityNotFound(_0x5159d5,null))[_0x8f49('0x27')](saveUpdates(_0x3f09ee['body'],null))['then'](respondWithResult(_0x5159d5,null))[_0x8f49('0x4b')](handleError(_0x5159d5,null));};exports[_0x8f49('0x26')]=function(_0x5702ad,_0x544bcd){return db[_0x8f49('0x2d')][_0x8f49('0x4a')]({'where':{'id':_0x5702ad[_0x8f49('0x47')]['id']}})[_0x8f49('0x27')](handleEntityNotFound(_0x544bcd,null))[_0x8f49('0x27')](removeEntity(_0x544bcd,null))[_0x8f49('0x4b')](handleError(_0x544bcd,null));}; \ No newline at end of file +var _0x4b6c=['update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','attributes','model','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskField','includeAll','include','findAll','catch','params','intersection','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','Content-Range','json','apply','reject','save'];(function(_0xc05e87,_0x5c6dba){var _0x47c69f=function(_0x2720df){while(--_0x2720df){_0xc05e87['push'](_0xc05e87['shift']());}};_0x47c69f(++_0x5c6dba);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc4b6('0x0'));var rimraf=require(_0xc4b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4b6('0x2'));var rp=require(_0xc4b6('0x3'));var moment=require(_0xc4b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc4b6('0x5'));var util=require(_0xc4b6('0x6'));var path=require(_0xc4b6('0x7'));var sox=require('sox');var csv=require(_0xc4b6('0x8'));var ejs=require(_0xc4b6('0x9'));var fs=require('fs');var fs_extra=require(_0xc4b6('0xa'));var _=require(_0xc4b6('0xb'));var squel=require('squel');var crypto=require(_0xc4b6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc4b6('0x8'));var querystring=require(_0xc4b6('0xd'));var Papa=require(_0xc4b6('0xe'));var Redis=require(_0xc4b6('0xf'));var authService=require(_0xc4b6('0x10'));var qs=require(_0xc4b6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4b6('0x12'));var logger=require(_0xc4b6('0x13'))('api');var utils=require(_0xc4b6('0x14'));var config=require(_0xc4b6('0x15'));var licenseUtil=require(_0xc4b6('0x16'));var db=require(_0xc4b6('0x17'))['db'];function respondWithStatusCode(_0x286a5a,_0xd6208e){_0xd6208e=_0xd6208e||0xcc;return function(_0xf2a30e){if(_0xf2a30e){return _0x286a5a[_0xc4b6('0x18')](_0xd6208e);}return _0x286a5a[_0xc4b6('0x19')](_0xd6208e)['end']();};}function respondWithResult(_0x21ee35,_0x2b7aab){_0x2b7aab=_0x2b7aab||0xc8;return function(_0x5d9008){if(_0x5d9008){return _0x21ee35[_0xc4b6('0x19')](_0x2b7aab)['json'](_0x5d9008);}};}function respondWithFilteredResult(_0x41be8d,_0x408652){return function(_0x20c517){if(_0x20c517){var _0x23144b=typeof _0x408652['offset']==='undefined'&&typeof _0x408652[_0xc4b6('0x1a')]===_0xc4b6('0x1b');var _0x403f94=_0x20c517[_0xc4b6('0x1c')];var _0x220dfd=_0x23144b?0x0:_0x408652[_0xc4b6('0x1d')];var _0x471bf8=_0x23144b?_0x20c517[_0xc4b6('0x1c')]:_0x408652[_0xc4b6('0x1d')]+_0x408652[_0xc4b6('0x1a')];var _0x5c1f92;if(_0x471bf8>=_0x403f94){_0x471bf8=_0x403f94;_0x5c1f92=0xc8;}else{_0x5c1f92=0xce;}_0x41be8d[_0xc4b6('0x19')](_0x5c1f92);return _0x41be8d['set'](_0xc4b6('0x1e'),_0x220dfd+'-'+_0x471bf8+'/'+_0x403f94)[_0xc4b6('0x1f')](_0x20c517);}return null;};}function patchUpdates(_0x44618b){return function(_0x15a3de){try{jsonpatch[_0xc4b6('0x20')](_0x15a3de,_0x44618b,!![]);}catch(_0x2f207d){return BPromise[_0xc4b6('0x21')](_0x2f207d);}return _0x15a3de[_0xc4b6('0x22')]();};}function saveUpdates(_0x51090f,_0x8fcdde){return function(_0x41fedf){if(_0x41fedf){return _0x41fedf[_0xc4b6('0x23')](_0x51090f)[_0xc4b6('0x24')](function(_0x24592a){return _0x24592a;});}return null;};}function removeEntity(_0x214801,_0x2c2d35){return function(_0x81b146){if(_0x81b146){return _0x81b146[_0xc4b6('0x25')]()['then'](function(){_0x214801['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x392b0f,_0x31a69f){return function(_0x4f5949){if(!_0x4f5949){_0x392b0f[_0xc4b6('0x18')](0x194);}return _0x4f5949;};}function handleError(_0x2e3468,_0x50b946){_0x50b946=_0x50b946||0x1f4;return function(_0x1209db){logger[_0xc4b6('0x26')](_0x1209db[_0xc4b6('0x27')]);if(_0x1209db[_0xc4b6('0x28')]){delete _0x1209db[_0xc4b6('0x28')];}_0x2e3468[_0xc4b6('0x19')](_0x50b946)[_0xc4b6('0x29')](_0x1209db);};}exports[_0xc4b6('0x2a')]=function(_0x31a9de,_0x473e8d){var _0x4a7b99={},_0x317924={},_0x17a744={'count':0x0,'rows':[]};var _0xb6ec64=_['map'](db['ZendeskField'][_0xc4b6('0x2b')],function(_0x4ef594){return{'name':_0x4ef594[_0xc4b6('0x2c')],'type':_0x4ef594[_0xc4b6('0x2d')][_0xc4b6('0x2e')]};});_0x317924['model']=_[_0xc4b6('0x2f')](_0xb6ec64,_0xc4b6('0x28'));_0x317924['query']=_[_0xc4b6('0x30')](_0x31a9de[_0xc4b6('0x31')]);_0x317924[_0xc4b6('0x32')]=_['intersection'](_0x317924['model'],_0x317924[_0xc4b6('0x31')]);_0x4a7b99[_0xc4b6('0x33')]=_['intersection'](_0x317924[_0xc4b6('0x34')],qs['fields'](_0x31a9de[_0xc4b6('0x31')][_0xc4b6('0x35')]));_0x4a7b99[_0xc4b6('0x33')]=_0x4a7b99[_0xc4b6('0x33')][_0xc4b6('0x36')]?_0x4a7b99[_0xc4b6('0x33')]:_0x317924[_0xc4b6('0x34')];if(!_0x31a9de['query']['hasOwnProperty']('nolimit')){_0x4a7b99[_0xc4b6('0x1a')]=qs[_0xc4b6('0x1a')](_0x31a9de[_0xc4b6('0x31')][_0xc4b6('0x1a')]);_0x4a7b99['offset']=qs['offset'](_0x31a9de[_0xc4b6('0x31')][_0xc4b6('0x1d')]);}_0x4a7b99[_0xc4b6('0x37')]=qs[_0xc4b6('0x38')](_0x31a9de[_0xc4b6('0x31')][_0xc4b6('0x38')]);_0x4a7b99[_0xc4b6('0x39')]=qs['filters'](_[_0xc4b6('0x3a')](_0x31a9de[_0xc4b6('0x31')],_0x317924['filters']),_0xb6ec64);if(_0x31a9de[_0xc4b6('0x31')][_0xc4b6('0x3b')]){_0x4a7b99[_0xc4b6('0x39')]=_[_0xc4b6('0x3c')](_0x4a7b99[_0xc4b6('0x39')],{'$or':_[_0xc4b6('0x2f')](_0xb6ec64,function(_0x413da2){if(_0x413da2[_0xc4b6('0x2d')]!==_0xc4b6('0x3d')){var _0x542b54={};_0x542b54[_0x413da2[_0xc4b6('0x28')]]={'$like':'%'+_0x31a9de['query'][_0xc4b6('0x3b')]+'%'};return _0x542b54;}})});}_0x4a7b99=_[_0xc4b6('0x3c')]({},_0x4a7b99,_0x31a9de[_0xc4b6('0x3e')]);var _0x58ffb8={'where':_0x4a7b99[_0xc4b6('0x39')]};return db[_0xc4b6('0x3f')][_0xc4b6('0x1c')](_0x58ffb8)[_0xc4b6('0x24')](function(_0x4c6d87){_0x17a744['count']=_0x4c6d87;if(_0x31a9de[_0xc4b6('0x31')][_0xc4b6('0x40')]){_0x4a7b99[_0xc4b6('0x41')]=[{'all':!![]}];}return db[_0xc4b6('0x3f')][_0xc4b6('0x42')](_0x4a7b99);})['then'](function(_0x3ec107){_0x17a744['rows']=_0x3ec107;return _0x17a744;})['then'](respondWithFilteredResult(_0x473e8d,_0x4a7b99))[_0xc4b6('0x43')](handleError(_0x473e8d,null));};exports['show']=function(_0x3024fd,_0x2f29e5){var _0x2f709d={'raw':!![],'where':{'id':_0x3024fd[_0xc4b6('0x44')]['id']}},_0x555acf={};_0x555acf[_0xc4b6('0x34')]=_[_0xc4b6('0x30')](db[_0xc4b6('0x3f')][_0xc4b6('0x2b')]);_0x555acf[_0xc4b6('0x31')]=_['keys'](_0x3024fd['query']);_0x555acf[_0xc4b6('0x32')]=_[_0xc4b6('0x45')](_0x555acf['model'],_0x555acf['query']);_0x2f709d['attributes']=_[_0xc4b6('0x45')](_0x555acf[_0xc4b6('0x34')],qs[_0xc4b6('0x35')](_0x3024fd[_0xc4b6('0x31')][_0xc4b6('0x35')]));_0x2f709d[_0xc4b6('0x33')]=_0x2f709d[_0xc4b6('0x33')]['length']?_0x2f709d[_0xc4b6('0x33')]:_0x555acf[_0xc4b6('0x34')];if(_0x3024fd[_0xc4b6('0x31')][_0xc4b6('0x40')]){_0x2f709d[_0xc4b6('0x41')]=[{'all':!![]}];}_0x2f709d=_[_0xc4b6('0x3c')]({},_0x2f709d,_0x3024fd[_0xc4b6('0x3e')]);return db['ZendeskField']['find'](_0x2f709d)[_0xc4b6('0x24')](handleEntityNotFound(_0x2f29e5,null))[_0xc4b6('0x24')](respondWithResult(_0x2f29e5,null))[_0xc4b6('0x43')](handleError(_0x2f29e5,null));};exports[_0xc4b6('0x46')]=function(_0x4ba005,_0x5c7772){return db[_0xc4b6('0x3f')][_0xc4b6('0x46')](_0x4ba005[_0xc4b6('0x47')],{})['then'](respondWithResult(_0x5c7772,0xc9))[_0xc4b6('0x43')](handleError(_0x5c7772,null));};exports['update']=function(_0x1b66b5,_0x2f272f){if(_0x1b66b5['body']['id']){delete _0x1b66b5[_0xc4b6('0x47')]['id'];}return db['ZendeskField'][_0xc4b6('0x48')]({'where':{'id':_0x1b66b5[_0xc4b6('0x44')]['id']}})[_0xc4b6('0x24')](handleEntityNotFound(_0x2f272f,null))[_0xc4b6('0x24')](saveUpdates(_0x1b66b5[_0xc4b6('0x47')],null))['then'](respondWithResult(_0x2f272f,null))[_0xc4b6('0x43')](handleError(_0x2f272f,null));};exports[_0xc4b6('0x25')]=function(_0x444b8b,_0xd1643f){return db[_0xc4b6('0x3f')][_0xc4b6('0x48')]({'where':{'id':_0x444b8b[_0xc4b6('0x44')]['id']}})[_0xc4b6('0x24')](handleEntityNotFound(_0xd1643f,null))[_0xc4b6('0x24')](removeEntity(_0xd1643f,null))['catch'](handleError(_0xd1643f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 79cf7a3..31dc071 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 _0xec59=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x25e995,_0x143cdc){var _0x446a58=function(_0x545ebc){while(--_0x545ebc){_0x25e995['push'](_0x25e995['shift']());}};_0x446a58(++_0x143cdc);}(_0xec59,0x1c0));var _0x9ec5=function(_0x399338,_0x11496b){_0x399338=_0x399338-0x0;var _0x3c4485=_0xec59[_0x399338];return _0x3c4485;};'use strict';var _=require(_0x9ec5('0x0'));var util=require(_0x9ec5('0x1'));var logger=require(_0x9ec5('0x2'))(_0x9ec5('0x3'));var moment=require(_0x9ec5('0x4'));var BPromise=require(_0x9ec5('0x5'));var rp=require(_0x9ec5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ec5('0x7'));var attributes=require(_0x9ec5('0x8'));module[_0x9ec5('0x9')]=function(_0x2e51c2,_0x4ee1f0){return _0x2e51c2['define'](_0x9ec5('0xa'),attributes,{'tableName':_0x9ec5('0xb'),'paranoid':![],'indexes':[{'name':_0x9ec5('0xc'),'fields':[_0x9ec5('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d5c=['moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','FieldId','lodash','util','../../config/logger','api'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x7d5c,0x184));var _0xc7d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc7d5('0x0'));var util=require(_0xc7d5('0x1'));var logger=require(_0xc7d5('0x2'))(_0xc7d5('0x3'));var moment=require(_0xc7d5('0x4'));var BPromise=require(_0xc7d5('0x5'));var rp=require(_0xc7d5('0x6'));var fs=require('fs');var path=require(_0xc7d5('0x7'));var rimraf=require(_0xc7d5('0x8'));var config=require('../../config/environment');var attributes=require(_0xc7d5('0x9'));module[_0xc7d5('0xa')]=function(_0x218af1,_0x2a2551){return _0x218af1['define'](_0xc7d5('0xb'),attributes,{'tableName':_0xc7d5('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xc7d5('0xd')],'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 0911343..d20efc5 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 _0xeb3c=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3a60a0,_0x3a761b){var _0x4a0977=function(_0xa4ee73){while(--_0xa4ee73){_0x3a60a0['push'](_0x3a60a0['shift']());}};_0x4a0977(++_0x3a761b);}(_0xeb3c,0x15b));var _0xceb3=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xeb3c[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xceb3('0x0'));var util=require(_0xceb3('0x1'));var moment=require(_0xceb3('0x2'));var BPromise=require('bluebird');var rs=require(_0xceb3('0x3'));var fs=require('fs');var Redis=require(_0xceb3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xceb3('0x5'));var logger=require(_0xceb3('0x6'))(_0xceb3('0x7'));var config=require(_0xceb3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xceb3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfc39ec,_0x2abb47,_0x57ebbd){return new BPromise(function(_0x38599b,_0xbc7561){return client[_0xceb3('0xa')](_0xfc39ec,_0x57ebbd)[_0xceb3('0xb')](function(_0x212772){logger[_0xceb3('0xc')](_0xceb3('0xd'),_0x2abb47,_0xceb3('0xe'));logger['debug'](_0xceb3('0xf'),_0x2abb47,_0xceb3('0xe'),JSON[_0xceb3('0x10')](_0x212772));if(_0x212772[_0xceb3('0x11')]){if(_0x212772[_0xceb3('0x11')][_0xceb3('0x12')]===0x1f4){logger[_0xceb3('0x11')](_0xceb3('0xd'),_0x2abb47,_0x212772[_0xceb3('0x11')][_0xceb3('0x13')]);return _0xbc7561(_0x212772[_0xceb3('0x11')]['message']);}logger[_0xceb3('0x11')](_0xceb3('0xd'),_0x2abb47,_0x212772['error'][_0xceb3('0x13')]);return _0x38599b(_0x212772[_0xceb3('0x11')][_0xceb3('0x13')]);}else{logger[_0xceb3('0xc')]('ZendeskField,\x20%s,\x20%s',_0x2abb47,_0xceb3('0xe'));_0x38599b(_0x212772['result'][_0xceb3('0x13')]);}})[_0xceb3('0x14')](function(_0x1ab989){logger['error'](_0xceb3('0xd'),_0x2abb47,_0x1ab989);_0xbc7561(_0x1ab989);});});} \ No newline at end of file +var _0x1587=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x18f02f,_0x15220c){var _0x4a72a1=function(_0x517e7d){while(--_0x517e7d){_0x18f02f['push'](_0x18f02f['shift']());}};_0x4a72a1(++_0x15220c);}(_0x1587,0x114));var _0x7158=function(_0x3e2d2b,_0x4fb4c1){_0x3e2d2b=_0x3e2d2b-0x0;var _0x482636=_0x1587[_0x3e2d2b];return _0x482636;};'use strict';var _=require('lodash');var util=require(_0x7158('0x0'));var moment=require(_0x7158('0x1'));var BPromise=require(_0x7158('0x2'));var rs=require(_0x7158('0x3'));var fs=require('fs');var Redis=require(_0x7158('0x4'));var db=require(_0x7158('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7158('0x6'));var config=require(_0x7158('0x7'));var jayson=require(_0x7158('0x8'));var client=jayson[_0x7158('0x9')][_0x7158('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x398819,_0x30e3df,_0x4add31){return new BPromise(function(_0x1c9478,_0x589db7){return client[_0x7158('0xb')](_0x398819,_0x4add31)[_0x7158('0xc')](function(_0x38d3bd){logger[_0x7158('0xd')](_0x7158('0xe'),_0x30e3df,_0x7158('0xf'));logger[_0x7158('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x30e3df,_0x7158('0xf'),JSON[_0x7158('0x11')](_0x38d3bd));if(_0x38d3bd[_0x7158('0x12')]){if(_0x38d3bd[_0x7158('0x12')][_0x7158('0x13')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x30e3df,_0x38d3bd[_0x7158('0x12')][_0x7158('0x14')]);return _0x589db7(_0x38d3bd[_0x7158('0x12')][_0x7158('0x14')]);}logger[_0x7158('0x12')](_0x7158('0xe'),_0x30e3df,_0x38d3bd[_0x7158('0x12')]['message']);return _0x1c9478(_0x38d3bd[_0x7158('0x12')]['message']);}else{logger[_0x7158('0xd')](_0x7158('0xe'),_0x30e3df,_0x7158('0xf'));_0x1c9478(_0x38d3bd[_0x7158('0x15')][_0x7158('0x14')]);}})[_0x7158('0x16')](function(_0x57cc8f){logger[_0x7158('0x12')](_0x7158('0xe'),_0x30e3df,_0x57cc8f);_0x589db7(_0x57cc8f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 1c54063..030c937 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 _0xf98f=['index','/:id','show','/:id/configurations','getFields','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x1d6ec9,_0x997c5d){var _0x4ba1e7=function(_0x1677c0){while(--_0x1677c0){_0x1d6ec9['push'](_0x1d6ec9['shift']());}};_0x4ba1e7(++_0x997c5d);}(_0xf98f,0x1da));var _0xff98=function(_0x46293e,_0x55fd36){_0x46293e=_0x46293e-0x0;var _0x6cc314=_0xf98f[_0x46293e];return _0x6cc314;};'use strict';var multer=require(_0xff98('0x0'));var util=require(_0xff98('0x1'));var path=require(_0xff98('0x2'));var timeout=require('connect-timeout');var express=require(_0xff98('0x3'));var router=express[_0xff98('0x4')]();var fs_extra=require(_0xff98('0x5'));var auth=require(_0xff98('0x6'));var interaction=require(_0xff98('0x7'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xff98('0x8')]('/',auth[_0xff98('0x9')](),controller[_0xff98('0xa')]);router[_0xff98('0x8')](_0xff98('0xb'),auth[_0xff98('0x9')](),controller[_0xff98('0xc')]);router[_0xff98('0x8')](_0xff98('0xd'),auth[_0xff98('0x9')](),controller['getConfigurations']);router[_0xff98('0x8')]('/:id/fields',auth[_0xff98('0x9')](),controller[_0xff98('0xe')]);router['post']('/',auth[_0xff98('0x9')](),controller[_0xff98('0xf')]);router['post'](_0xff98('0xd'),auth[_0xff98('0x9')](),controller[_0xff98('0x10')]);router[_0xff98('0x11')](_0xff98('0xb'),auth[_0xff98('0x9')](),controller[_0xff98('0x12')]);router[_0xff98('0x13')](_0xff98('0xb'),auth[_0xff98('0x9')](),controller[_0xff98('0x14')]);module[_0xff98('0x15')]=router; \ No newline at end of file +var _0x312d=['delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','index','/:id','get','getConfigurations','getFields','post','create','/:id/configurations','put','update'];(function(_0x4e221e,_0x22329a){var _0x2297eb=function(_0x59a4cd){while(--_0x59a4cd){_0x4e221e['push'](_0x4e221e['shift']());}};_0x2297eb(++_0x22329a);}(_0x312d,0x1bc));var _0xd312=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x312d[_0x24061a];return _0x82054e;};'use strict';var multer=require(_0xd312('0x0'));var util=require('util');var path=require(_0xd312('0x1'));var timeout=require('connect-timeout');var express=require(_0xd312('0x2'));var router=express[_0xd312('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd312('0x4'));var interaction=require(_0xd312('0x5'));var config=require('../../config/environment');var controller=require(_0xd312('0x6'));router['get']('/',auth[_0xd312('0x7')](),controller[_0xd312('0x8')]);router['get'](_0xd312('0x9'),auth[_0xd312('0x7')](),controller['show']);router[_0xd312('0xa')]('/:id/configurations',auth[_0xd312('0x7')](),controller[_0xd312('0xb')]);router[_0xd312('0xa')]('/:id/fields',auth[_0xd312('0x7')](),controller[_0xd312('0xc')]);router[_0xd312('0xd')]('/',auth[_0xd312('0x7')](),controller[_0xd312('0xe')]);router[_0xd312('0xd')](_0xd312('0xf'),auth[_0xd312('0x7')](),controller['addConfiguration']);router[_0xd312('0x10')](_0xd312('0x9'),auth[_0xd312('0x7')](),controller[_0xd312('0x11')]);router[_0xd312('0x12')](_0xd312('0x9'),auth['isAuthenticated'](),controller[_0xd312('0x13')]);module[_0xd312('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 190dc0c..f103028 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 _0xe5b3=['STRING','exports'];(function(_0x19a927,_0xe4a166){var _0x3ba90=function(_0x3d9ef1){while(--_0x3d9ef1){_0x19a927['push'](_0x19a927['shift']());}};_0x3ba90(++_0xe4a166);}(_0xe5b3,0x133));var _0x3e5b=function(_0x42efa7,_0x2d5d92){_0x42efa7=_0x42efa7-0x0;var _0x5d1b50=_0xe5b3[_0x42efa7];return _0x5d1b50;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'name':{'type':Sequelize[_0x3e5b('0x1')]},'description':{'type':Sequelize[_0x3e5b('0x1')]},'host':{'type':Sequelize[_0x3e5b('0x1')]},'zone':{'type':Sequelize[_0x3e5b('0x1')]},'clientId':{'type':Sequelize[_0x3e5b('0x1')]},'clientSecret':{'type':Sequelize[_0x3e5b('0x1')]},'serverUrl':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3e5b('0x1')]},'refreshToken':{'type':Sequelize[_0x3e5b('0x1')]}}; \ No newline at end of file +var _0xbd50=['STRING','sequelize','exports'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xbd50,0x196));var _0x0bd5=function(_0x53c82e,_0x5c92e2){_0x53c82e=_0x53c82e-0x0;var _0x525cf7=_0xbd50[_0x53c82e];return _0x525cf7;};'use strict';var Sequelize=require(_0x0bd5('0x0'));module[_0x0bd5('0x1')]={'name':{'type':Sequelize[_0x0bd5('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0bd5('0x2')]},'zone':{'type':Sequelize[_0x0bd5('0x2')]},'clientId':{'type':Sequelize[_0x0bd5('0x2')]},'clientSecret':{'type':Sequelize[_0x0bd5('0x2')]},'serverUrl':{'type':Sequelize[_0x0bd5('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index ce7cf60..d7a6a90 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 _0x3762=['status','undefined','limit','count','offset','set','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','catch','show','params','fields','length','include','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Description','Call_Duration','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3762,0x68));var _0x2376=function(_0x3688d5,_0x51d2b7){_0x3688d5=_0x3688d5-0x0;var _0x3013c4=_0x3762[_0x3688d5];return _0x3013c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2376('0x0'));var rp=require(_0x2376('0x1'));var moment=require(_0x2376('0x2'));var BPromise=require(_0x2376('0x3'));var Mustache=require(_0x2376('0x4'));var util=require(_0x2376('0x5'));var path=require(_0x2376('0x6'));var sox=require(_0x2376('0x7'));var csv=require(_0x2376('0x8'));var ejs=require(_0x2376('0x9'));var fs=require('fs');var fs_extra=require(_0x2376('0xa'));var _=require(_0x2376('0xb'));var squel=require('squel');var crypto=require(_0x2376('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2376('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2376('0xd'));var as=require(_0x2376('0xe'));var hardwareService=require(_0x2376('0xf'));var logger=require(_0x2376('0x10'))(_0x2376('0x11'));var utils=require(_0x2376('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2376('0x13'));var db=require(_0x2376('0x14'))['db'];var integrations=require(_0x2376('0x15'));function respondWithStatusCode(_0xb06862,_0x352118){_0x352118=_0x352118||0xcc;return function(_0x18c09f){if(_0x18c09f){return _0xb06862['sendStatus'](_0x352118);}return _0xb06862['status'](_0x352118)[_0x2376('0x16')]();};}function respondWithResult(_0x2d4e11,_0x5be1a1){_0x5be1a1=_0x5be1a1||0xc8;return function(_0x387971){if(_0x387971){return _0x2d4e11[_0x2376('0x17')](_0x5be1a1)['json'](_0x387971);}};}function respondWithFilteredResult(_0x4e5489,_0x15dce4){return function(_0x7b7869){if(_0x7b7869){var _0x42fdc7=typeof _0x15dce4['offset']===_0x2376('0x18')&&typeof _0x15dce4[_0x2376('0x19')]===_0x2376('0x18');var _0x4f5789=_0x7b7869[_0x2376('0x1a')];var _0x4858ef=_0x42fdc7?0x0:_0x15dce4[_0x2376('0x1b')];var _0x1ad484=_0x42fdc7?_0x7b7869[_0x2376('0x1a')]:_0x15dce4[_0x2376('0x1b')]+_0x15dce4[_0x2376('0x19')];var _0x4975c8;if(_0x1ad484>=_0x4f5789){_0x1ad484=_0x4f5789;_0x4975c8=0xc8;}else{_0x4975c8=0xce;}_0x4e5489['status'](_0x4975c8);return _0x4e5489[_0x2376('0x1c')]('Content-Range',_0x4858ef+'-'+_0x1ad484+'/'+_0x4f5789)[_0x2376('0x1d')](_0x7b7869);}return null;};}function patchUpdates(_0x3b9078){return function(_0x24270f){try{jsonpatch[_0x2376('0x1e')](_0x24270f,_0x3b9078,!![]);}catch(_0x391472){return BPromise['reject'](_0x391472);}return _0x24270f[_0x2376('0x1f')]();};}function saveUpdates(_0x593f09,_0x115fb7){return function(_0x571f17){if(_0x571f17){return _0x571f17[_0x2376('0x20')](_0x593f09)[_0x2376('0x21')](function(_0x19f660){return _0x19f660;});}return null;};}function removeEntity(_0x463f99,_0x2dd1fa){return function(_0x40f3e7){if(_0x40f3e7){return _0x40f3e7[_0x2376('0x22')]()[_0x2376('0x21')](function(){_0x463f99[_0x2376('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x416567,_0x34360c){return function(_0x5e4edd){if(!_0x5e4edd){_0x416567[_0x2376('0x23')](0x194);}return _0x5e4edd;};}function handleError(_0x318d05,_0x4a037d){_0x4a037d=_0x4a037d||0x1f4;return function(_0x1d036a){logger[_0x2376('0x24')](_0x1d036a[_0x2376('0x25')]);if(_0x1d036a[_0x2376('0x26')]){delete _0x1d036a[_0x2376('0x26')];}_0x318d05[_0x2376('0x17')](_0x4a037d)[_0x2376('0x27')](_0x1d036a);};}exports[_0x2376('0x28')]=function(_0x304d98,_0x1af634){var _0x4db5b8={},_0x379f13={},_0x8cf771={'count':0x0,'rows':[]};var _0x4d2a04=_[_0x2376('0x29')](db[_0x2376('0x2a')][_0x2376('0x2b')],function(_0x107938){return{'name':_0x107938[_0x2376('0x2c')],'type':_0x107938[_0x2376('0x2d')]['key']};});_0x379f13[_0x2376('0x2e')]=_[_0x2376('0x29')](_0x4d2a04,_0x2376('0x26'));_0x379f13[_0x2376('0x2f')]=_[_0x2376('0x30')](_0x304d98['query']);_0x379f13[_0x2376('0x31')]=_[_0x2376('0x32')](_0x379f13[_0x2376('0x2e')],_0x379f13[_0x2376('0x2f')]);_0x4db5b8[_0x2376('0x33')]=_[_0x2376('0x32')](_0x379f13['model'],qs['fields'](_0x304d98['query']['fields']));_0x4db5b8['attributes']=_0x4db5b8['attributes']['length']?_0x4db5b8[_0x2376('0x33')]:_0x379f13['model'];if(!_0x304d98[_0x2376('0x2f')][_0x2376('0x34')](_0x2376('0x35'))){_0x4db5b8[_0x2376('0x19')]=qs['limit'](_0x304d98[_0x2376('0x2f')][_0x2376('0x19')]);_0x4db5b8['offset']=qs['offset'](_0x304d98[_0x2376('0x2f')][_0x2376('0x1b')]);}_0x4db5b8[_0x2376('0x36')]=qs[_0x2376('0x37')](_0x304d98['query']['sort']);_0x4db5b8[_0x2376('0x38')]=qs['filters'](_[_0x2376('0x39')](_0x304d98[_0x2376('0x2f')],_0x379f13['filters']),_0x4d2a04);if(_0x304d98[_0x2376('0x2f')][_0x2376('0x3a')]){_0x4db5b8[_0x2376('0x38')]=_[_0x2376('0x3b')](_0x4db5b8['where'],{'$or':_['map'](_0x4d2a04,function(_0x537533){if(_0x537533[_0x2376('0x2d')]!=='VIRTUAL'){var _0xd05b5d={};_0xd05b5d[_0x537533['name']]={'$like':'%'+_0x304d98[_0x2376('0x2f')][_0x2376('0x3a')]+'%'};return _0xd05b5d;}})});}_0x4db5b8=_[_0x2376('0x3b')]({},_0x4db5b8,_0x304d98['options']);var _0x4b5f39={'where':_0x4db5b8[_0x2376('0x38')]};return db[_0x2376('0x2a')][_0x2376('0x1a')](_0x4b5f39)['then'](function(_0x1e60e8){_0x8cf771[_0x2376('0x1a')]=_0x1e60e8;if(_0x304d98[_0x2376('0x2f')][_0x2376('0x3c')]){_0x4db5b8['include']=[{'all':!![]}];}return db[_0x2376('0x2a')][_0x2376('0x3d')](_0x4db5b8);})[_0x2376('0x21')](function(_0x17f656){_0x8cf771['rows']=_0x17f656;return _0x8cf771;})[_0x2376('0x21')](respondWithFilteredResult(_0x1af634,_0x4db5b8))[_0x2376('0x3e')](handleError(_0x1af634,null));};exports[_0x2376('0x3f')]=function(_0x58f788,_0x174763){var _0x237878={'raw':![],'where':{'id':_0x58f788[_0x2376('0x40')]['id']}},_0xc3f5d6={};_0xc3f5d6[_0x2376('0x2e')]=_['keys'](db[_0x2376('0x2a')][_0x2376('0x2b')]);_0xc3f5d6[_0x2376('0x2f')]=_[_0x2376('0x30')](_0x58f788[_0x2376('0x2f')]);_0xc3f5d6[_0x2376('0x31')]=_[_0x2376('0x32')](_0xc3f5d6[_0x2376('0x2e')],_0xc3f5d6['query']);_0x237878[_0x2376('0x33')]=_['intersection'](_0xc3f5d6[_0x2376('0x2e')],qs[_0x2376('0x41')](_0x58f788[_0x2376('0x2f')]['fields']));_0x237878[_0x2376('0x33')]=_0x237878['attributes'][_0x2376('0x42')]?_0x237878[_0x2376('0x33')]:_0xc3f5d6[_0x2376('0x2e')];if(_0x58f788[_0x2376('0x2f')]['includeAll']){_0x237878[_0x2376('0x43')]=[{'all':!![]}];}_0x237878=_['merge']({},_0x237878,_0x58f788[_0x2376('0x44')]);return db[_0x2376('0x2a')][_0x2376('0x45')](_0x237878)[_0x2376('0x21')](handleEntityNotFound(_0x174763,null))['then'](respondWithResult(_0x174763,null))[_0x2376('0x3e')](handleError(_0x174763,null));};exports[_0x2376('0x46')]=function(_0x5a0dbc,_0xdbe2e){return db[_0x2376('0x2a')]['create'](_0x5a0dbc['body'],{})['then'](respondWithResult(_0xdbe2e,0xc9))['catch'](handleError(_0xdbe2e,null));};exports[_0x2376('0x20')]=function(_0xba25f9,_0x5afddc){if(_0xba25f9[_0x2376('0x47')]['id']){delete _0xba25f9[_0x2376('0x47')]['id'];}return db[_0x2376('0x2a')][_0x2376('0x45')]({'where':{'id':_0xba25f9[_0x2376('0x40')]['id']}})[_0x2376('0x21')](handleEntityNotFound(_0x5afddc,null))['then'](saveUpdates(_0xba25f9[_0x2376('0x47')],null))['then'](respondWithResult(_0x5afddc,null))[_0x2376('0x3e')](handleError(_0x5afddc,null));};exports['destroy']=function(_0x4cff06,_0x29dfc3){return db[_0x2376('0x2a')][_0x2376('0x45')]({'where':{'id':_0x4cff06[_0x2376('0x40')]['id']}})[_0x2376('0x21')](handleEntityNotFound(_0x29dfc3,null))['then'](removeEntity(_0x29dfc3,null))[_0x2376('0x3e')](handleError(_0x29dfc3,null));};exports[_0x2376('0x48')]=function(_0x367204,_0x133246,_0x1aad76){var _0x263d36={};var _0x288381={};var _0x2d2fd3;var _0x52dd46;return db[_0x2376('0x2a')][_0x2376('0x49')]({'where':{'id':_0x367204['params']['id']}})[_0x2376('0x21')](handleEntityNotFound(_0x133246,null))[_0x2376('0x21')](function(_0x1ceb5a){if(_0x1ceb5a){_0x2d2fd3=_0x1ceb5a;_0x288381[_0x2376('0x2e')]=_[_0x2376('0x30')](db[_0x2376('0x4a')][_0x2376('0x2b')]);_0x288381[_0x2376('0x2f')]=_[_0x2376('0x30')](_0x367204['query']);_0x288381[_0x2376('0x31')]=_['intersection'](_0x288381[_0x2376('0x2e')],_0x288381[_0x2376('0x2f')]);_0x263d36[_0x2376('0x33')]=_[_0x2376('0x32')](_0x288381[_0x2376('0x2e')],qs[_0x2376('0x41')](_0x367204[_0x2376('0x2f')][_0x2376('0x41')]));_0x263d36[_0x2376('0x33')]=_0x263d36[_0x2376('0x33')][_0x2376('0x42')]?_0x263d36[_0x2376('0x33')]:_0x288381[_0x2376('0x2e')];_0x263d36[_0x2376('0x36')]=qs[_0x2376('0x37')](_0x367204[_0x2376('0x2f')][_0x2376('0x37')]);_0x263d36[_0x2376('0x38')]=qs[_0x2376('0x31')](_[_0x2376('0x39')](_0x367204[_0x2376('0x2f')],_0x288381[_0x2376('0x31')]));if(_0x367204[_0x2376('0x2f')][_0x2376('0x3a')]){_0x263d36[_0x2376('0x38')]=_['merge'](_0x263d36[_0x2376('0x38')],{'$or':_[_0x2376('0x29')](_0x263d36[_0x2376('0x33')],function(_0x354034){var _0xe39c39={};_0xe39c39[_0x354034]={'$like':'%'+_0x367204[_0x2376('0x2f')][_0x2376('0x3a')]+'%'};return _0xe39c39;})});}_0x263d36=_[_0x2376('0x3b')]({},_0x263d36,_0x367204[_0x2376('0x44')]);return _0x2d2fd3[_0x2376('0x48')](_0x263d36);}})['then'](function(_0x127a9f){if(_0x127a9f){_0x52dd46=_0x127a9f[_0x2376('0x42')];if(!_0x367204['query'][_0x2376('0x34')](_0x2376('0x35'))){_0x263d36[_0x2376('0x19')]=qs[_0x2376('0x19')](_0x367204[_0x2376('0x2f')]['limit']);_0x263d36[_0x2376('0x1b')]=qs[_0x2376('0x1b')](_0x367204[_0x2376('0x2f')][_0x2376('0x1b')]);}return _0x2d2fd3[_0x2376('0x48')](_0x263d36);}})[_0x2376('0x21')](function(_0x6f5a36){if(_0x6f5a36){return _0x6f5a36?{'count':_0x52dd46,'rows':_0x6f5a36}:null;}})['then'](respondWithResult(_0x133246,null))[_0x2376('0x3e')](handleError(_0x133246,null));};exports[_0x2376('0x4b')]=function(_0x2d4d43,_0xf2858,_0x2d1469){if(_0x2d4d43['body']['id']){delete _0x2d4d43[_0x2376('0x47')]['id'];}return db[_0x2376('0x2a')][_0x2376('0x49')]({'where':{'id':_0x2d4d43[_0x2376('0x40')]['id']}})['then'](handleEntityNotFound(_0xf2858,null))[_0x2376('0x21')](function(_0x53a4c7){if(_0x53a4c7){_0x2d4d43[_0x2376('0x47')][_0x2376('0x4c')]=_0x53a4c7['id'];_0x2d4d43[_0x2376('0x47')][_0x2376('0x4d')]=integrations[_0x2376('0x4e')](_0x2d4d43[_0x2376('0x47')]['channel'],_0x2d4d43['body'][_0x2376('0x2d')]);_0x2d4d43[_0x2376('0x47')][_0x2376('0x4f')]=integrations[_0x2376('0x50')](_0x2d4d43[_0x2376('0x47')][_0x2376('0x51')],_0x2d4d43[_0x2376('0x47')][_0x2376('0x2d')]);return db[_0x2376('0x4a')][_0x2376('0x46')](_0x2d4d43['body'],{'include':[{'model':db[_0x2376('0x52')],'as':_0x2376('0x4d')},{'model':db['ZohoField'],'as':_0x2376('0x4f')}]});}return null;})[_0x2376('0x21')](respondWithResult(_0xf2858,null))['catch'](handleError(_0xf2858,null));};function getAccessToken(_0x1a715a){return new Promise(function(_0x20fe3f,_0x1703b6){var _0x444adf;switch(_0x1a715a[_0x2376('0x53')]){case'US':_0x444adf=_0x2376('0x54');break;case'AU':_0x444adf=_0x2376('0x55');break;case'EU':_0x444adf=_0x2376('0x56');break;case'IN':_0x444adf=_0x2376('0x57');break;case'CN':_0x444adf=_0x2376('0x58');break;default:_0x444adf=_0x2376('0x56');break;}var _0x6edf14={'method':'POST','uri':_0x444adf+_0x2376('0x59'),'qs':{'refresh_token':_0x1a715a[_0x2376('0x5a')],'client_id':_0x1a715a[_0x2376('0x5b')],'client_secret':_0x1a715a[_0x2376('0x5c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x6edf14)[_0x2376('0x21')](function(_0x417be3){if(_0x417be3[_0x2376('0x5d')]){_0x20fe3f(_0x417be3[_0x2376('0x5d')]);}else{_0x1703b6(_0x2376('0x5e'));}})[_0x2376('0x3e')](function(_0x1240fb){_0x1703b6(_0x1240fb);});});}exports[_0x2376('0x5f')]=function(_0x3ce019,_0x1202e8,_0x41ea5f){var _0x46acac,_0xad90f5,_0x2f013a,_0x252fce,_0x5a562b;return db['ZohoAccount'][_0x2376('0x49')]({'where':{'id':_0x3ce019[_0x2376('0x40')]['id']},'attributes':['id','host','zone',_0x2376('0x5b'),_0x2376('0x5c'),'serverUrl','code',_0x2376('0x5a')]})[_0x2376('0x21')](handleEntityNotFound(_0x1202e8,null))['then'](function(_0x38a031){_0x5a562b=_0x38a031;_0x46acac=_0x5a562b[_0x2376('0x60')];_0xad90f5=_0x46acac===_0x2376('0x61')?'eu':_0x2376('0x62');_0x2f013a=_0x5a562b[_0x2376('0x63')];var _0x117b0e=_0x2f013a[_0x2376('0x64')](-0x1);if(_0x117b0e==='/'||_0x117b0e==='\x5c'||_0x117b0e===':'){_0x2f013a=_0x2f013a[_0x2376('0x65')](0x0,_0x2f013a[_0x2376('0x66')](_0x117b0e));}if(!_0x5a562b[_0x2376('0x5a')]){throw new Error(_0x2376('0x67'));}return getAccessToken(_0x5a562b);})[_0x2376('0x21')](function(_0x2e5584){if(_0x2e5584){return rp({'method':_0x2376('0x68'),'uri':util[_0x2376('0x69')](_0x2376('0x6a'),_0xad90f5),'qs':{'module':_0x2376('0x6b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2e5584},'json':!![]});}})[_0x2376('0x21')](function(_0x522026){if(_0x522026){if(_0x522026[_0x2376('0x6c')]&&_0x522026['response']['error']){throw new Error(_0x522026[_0x2376('0x6c')]['error'][_0x2376('0x6d')]);}var _0x573b20=[];var _0x2413ac=[];var _0x52040f=[_0x2376('0x6e'),'Subject',_0x2376('0x6f'),'WhoId',_0x2376('0x70'),'Call_Result','Call_Start_Time',_0x2376('0x71')];_0x2413ac=_[_0x2376('0x72')](_0x522026['fields'],function(_0x36acc5){return _0x52040f[_0x2376('0x73')](_0x36acc5[_0x2376('0x74')]);});for(var _0x2951da=0x0;_0x2951da<_0x2413ac[_0x2376('0x42')];_0x2951da++){if(_0x2413ac[_0x2951da][_0x2376('0x75')]===![]){_0x573b20[_0x2376('0x76')]({'id':_0x2413ac[_0x2951da]['id'],'name':_0x2413ac[_0x2951da][_0x2376('0x77')],'custom':_0x2413ac[_0x2951da][_0x2376('0x78')],'options':_0x2413ac[_0x2951da]['data_type']===_0x2376('0x79')&&_0x2413ac[_0x2951da][_0x2376('0x7a')][_0x2376('0x42')]>-0x1?_['map'](_0x2413ac[_0x2951da][_0x2376('0x7a')],function(_0x43bf78){return{'name':_0x43bf78,'value':_0x43bf78};}):[]});}}return{'count':_0x573b20[_0x2376('0x42')],'rows':_0x573b20};}else{return{'count':0x0,'rows':[]};}})[_0x2376('0x21')](respondWithResult(_0x1202e8,null))['catch'](function(_0x34cf04){var _0xcf18bc=_0x3ce019[_0x2376('0x2f')][_0x2376('0x7b')]?0x1f4:_0x34cf04['statusCode']||0x1f4;logger[_0x2376('0x24')](_0x2376('0x7c'),_0x2376('0x5f'),_0xcf18bc,JSON[_0x2376('0x7d')](_0x34cf04));delete _0x34cf04[_0x2376('0x26')];if(_0xcf18bc===0x191){_0xcf18bc=0x190;}_0x1202e8[_0x2376('0x17')](_0xcf18bc)[_0x2376('0x27')](_0x3ce019[_0x2376('0x2f')][_0x2376('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x34cf04[_0x2376('0x7e')]}:_0x34cf04);});}; \ No newline at end of file +var _0xdbe2=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','stack','name','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','query','attributes','fields','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','intersection','length','find','create','body','params','getConfigurations','ZohoConfiguration','sort','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','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','host','zone','clientSecret','code','serverUrl','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3d0919,_0x31347f){var _0xad377b=function(_0x25d5f8){while(--_0x25d5f8){_0x3d0919['push'](_0x3d0919['shift']());}};_0xad377b(++_0x31347f);}(_0xdbe2,0x79));var _0x2dbe=function(_0x15f27e,_0x547fea){_0x15f27e=_0x15f27e-0x0;var _0x18da4f=_0xdbe2[_0x15f27e];return _0x18da4f;};'use strict';var emlformat=require(_0x2dbe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2dbe('0x1'));var rp=require(_0x2dbe('0x2'));var moment=require(_0x2dbe('0x3'));var BPromise=require(_0x2dbe('0x4'));var Mustache=require(_0x2dbe('0x5'));var util=require(_0x2dbe('0x6'));var path=require(_0x2dbe('0x7'));var sox=require(_0x2dbe('0x8'));var csv=require(_0x2dbe('0x9'));var ejs=require(_0x2dbe('0xa'));var fs=require('fs');var fs_extra=require(_0x2dbe('0xb'));var _=require(_0x2dbe('0xc'));var squel=require(_0x2dbe('0xd'));var crypto=require(_0x2dbe('0xe'));var jsforce=require(_0x2dbe('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2dbe('0x9'));var querystring=require('querystring');var Papa=require(_0x2dbe('0x10'));var Redis=require(_0x2dbe('0x11'));var authService=require(_0x2dbe('0x12'));var qs=require(_0x2dbe('0x13'));var as=require(_0x2dbe('0x14'));var hardwareService=require(_0x2dbe('0x15'));var logger=require('../../config/logger')(_0x2dbe('0x16'));var utils=require(_0x2dbe('0x17'));var config=require(_0x2dbe('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x2dbe('0x19'));function respondWithStatusCode(_0x5d24b9,_0x42e0cc){_0x42e0cc=_0x42e0cc||0xcc;return function(_0x35ebac){if(_0x35ebac){return _0x5d24b9[_0x2dbe('0x1a')](_0x42e0cc);}return _0x5d24b9['status'](_0x42e0cc)[_0x2dbe('0x1b')]();};}function respondWithResult(_0x41487e,_0x20f3c5){_0x20f3c5=_0x20f3c5||0xc8;return function(_0x34e2b9){if(_0x34e2b9){return _0x41487e[_0x2dbe('0x1c')](_0x20f3c5)[_0x2dbe('0x1d')](_0x34e2b9);}};}function respondWithFilteredResult(_0x370527,_0x57855a){return function(_0x3bae0b){if(_0x3bae0b){var _0x566ed2=typeof _0x57855a[_0x2dbe('0x1e')]===_0x2dbe('0x1f')&&typeof _0x57855a[_0x2dbe('0x20')]==='undefined';var _0x5c207c=_0x3bae0b[_0x2dbe('0x21')];var _0x9262b0=_0x566ed2?0x0:_0x57855a[_0x2dbe('0x1e')];var _0x342322=_0x566ed2?_0x3bae0b[_0x2dbe('0x21')]:_0x57855a[_0x2dbe('0x1e')]+_0x57855a[_0x2dbe('0x20')];var _0x2f8463;if(_0x342322>=_0x5c207c){_0x342322=_0x5c207c;_0x2f8463=0xc8;}else{_0x2f8463=0xce;}_0x370527[_0x2dbe('0x1c')](_0x2f8463);return _0x370527['set'](_0x2dbe('0x22'),_0x9262b0+'-'+_0x342322+'/'+_0x5c207c)[_0x2dbe('0x1d')](_0x3bae0b);}return null;};}function patchUpdates(_0xa71b3c){return function(_0x5abb14){try{jsonpatch['apply'](_0x5abb14,_0xa71b3c,!![]);}catch(_0x1f5b89){return BPromise[_0x2dbe('0x23')](_0x1f5b89);}return _0x5abb14['save']();};}function saveUpdates(_0x4315fb,_0x2ea3d5){return function(_0x137234){if(_0x137234){return _0x137234[_0x2dbe('0x24')](_0x4315fb)[_0x2dbe('0x25')](function(_0x20f0bc){return _0x20f0bc;});}return null;};}function removeEntity(_0x2c8dff,_0x1ebfde){return function(_0xa53578){if(_0xa53578){return _0xa53578[_0x2dbe('0x26')]()[_0x2dbe('0x25')](function(){_0x2c8dff[_0x2dbe('0x1c')](0xcc)[_0x2dbe('0x1b')]();});}};}function handleEntityNotFound(_0x2489fc,_0x6b017d){return function(_0x590d58){if(!_0x590d58){_0x2489fc[_0x2dbe('0x1a')](0x194);}return _0x590d58;};}function handleError(_0x298521,_0x2fd4ac){_0x2fd4ac=_0x2fd4ac||0x1f4;return function(_0x37a2d3){logger['error'](_0x37a2d3[_0x2dbe('0x27')]);if(_0x37a2d3[_0x2dbe('0x28')]){delete _0x37a2d3[_0x2dbe('0x28')];}_0x298521[_0x2dbe('0x1c')](_0x2fd4ac)['send'](_0x37a2d3);};}exports[_0x2dbe('0x29')]=function(_0x2e71b3,_0x515607){var _0xf83f43={},_0x2f41b1={},_0x1f71fb={'count':0x0,'rows':[]};var _0x172be8=_['map'](db[_0x2dbe('0x2a')][_0x2dbe('0x2b')],function(_0xc037ae){return{'name':_0xc037ae[_0x2dbe('0x2c')],'type':_0xc037ae[_0x2dbe('0x2d')][_0x2dbe('0x2e')]};});_0x2f41b1[_0x2dbe('0x2f')]=_[_0x2dbe('0x30')](_0x172be8,_0x2dbe('0x28'));_0x2f41b1['query']=_[_0x2dbe('0x31')](_0x2e71b3['query']);_0x2f41b1[_0x2dbe('0x32')]=_['intersection'](_0x2f41b1['model'],_0x2f41b1[_0x2dbe('0x33')]);_0xf83f43[_0x2dbe('0x34')]=_['intersection'](_0x2f41b1[_0x2dbe('0x2f')],qs[_0x2dbe('0x35')](_0x2e71b3[_0x2dbe('0x33')]['fields']));_0xf83f43['attributes']=_0xf83f43['attributes']['length']?_0xf83f43['attributes']:_0x2f41b1[_0x2dbe('0x2f')];if(!_0x2e71b3[_0x2dbe('0x33')][_0x2dbe('0x36')](_0x2dbe('0x37'))){_0xf83f43['limit']=qs[_0x2dbe('0x20')](_0x2e71b3[_0x2dbe('0x33')]['limit']);_0xf83f43['offset']=qs[_0x2dbe('0x1e')](_0x2e71b3[_0x2dbe('0x33')]['offset']);}_0xf83f43['order']=qs['sort'](_0x2e71b3['query']['sort']);_0xf83f43['where']=qs[_0x2dbe('0x32')](_[_0x2dbe('0x38')](_0x2e71b3[_0x2dbe('0x33')],_0x2f41b1[_0x2dbe('0x32')]),_0x172be8);if(_0x2e71b3[_0x2dbe('0x33')][_0x2dbe('0x39')]){_0xf83f43[_0x2dbe('0x3a')]=_[_0x2dbe('0x3b')](_0xf83f43['where'],{'$or':_['map'](_0x172be8,function(_0x56134a){if(_0x56134a[_0x2dbe('0x2d')]!==_0x2dbe('0x3c')){var _0x5b9c23={};_0x5b9c23[_0x56134a[_0x2dbe('0x28')]]={'$like':'%'+_0x2e71b3['query'][_0x2dbe('0x39')]+'%'};return _0x5b9c23;}})});}_0xf83f43=_['merge']({},_0xf83f43,_0x2e71b3[_0x2dbe('0x3d')]);var _0x28e63f={'where':_0xf83f43[_0x2dbe('0x3a')]};return db[_0x2dbe('0x2a')]['count'](_0x28e63f)[_0x2dbe('0x25')](function(_0x7ab080){_0x1f71fb[_0x2dbe('0x21')]=_0x7ab080;if(_0x2e71b3['query'][_0x2dbe('0x3e')]){_0xf83f43[_0x2dbe('0x3f')]=[{'all':!![]}];}return db[_0x2dbe('0x2a')]['findAll'](_0xf83f43);})[_0x2dbe('0x25')](function(_0x423bfb){_0x1f71fb['rows']=_0x423bfb;return _0x1f71fb;})['then'](respondWithFilteredResult(_0x515607,_0xf83f43))[_0x2dbe('0x40')](handleError(_0x515607,null));};exports[_0x2dbe('0x41')]=function(_0x1e17cb,_0x2c2341){var _0x3a987b={'raw':![],'where':{'id':_0x1e17cb['params']['id']}},_0x423567={};_0x423567[_0x2dbe('0x2f')]=_[_0x2dbe('0x31')](db[_0x2dbe('0x2a')][_0x2dbe('0x2b')]);_0x423567[_0x2dbe('0x33')]=_[_0x2dbe('0x31')](_0x1e17cb['query']);_0x423567[_0x2dbe('0x32')]=_[_0x2dbe('0x42')](_0x423567[_0x2dbe('0x2f')],_0x423567[_0x2dbe('0x33')]);_0x3a987b[_0x2dbe('0x34')]=_[_0x2dbe('0x42')](_0x423567['model'],qs[_0x2dbe('0x35')](_0x1e17cb[_0x2dbe('0x33')][_0x2dbe('0x35')]));_0x3a987b[_0x2dbe('0x34')]=_0x3a987b[_0x2dbe('0x34')][_0x2dbe('0x43')]?_0x3a987b[_0x2dbe('0x34')]:_0x423567[_0x2dbe('0x2f')];if(_0x1e17cb['query']['includeAll']){_0x3a987b['include']=[{'all':!![]}];}_0x3a987b=_[_0x2dbe('0x3b')]({},_0x3a987b,_0x1e17cb[_0x2dbe('0x3d')]);return db[_0x2dbe('0x2a')][_0x2dbe('0x44')](_0x3a987b)[_0x2dbe('0x25')](handleEntityNotFound(_0x2c2341,null))[_0x2dbe('0x25')](respondWithResult(_0x2c2341,null))['catch'](handleError(_0x2c2341,null));};exports[_0x2dbe('0x45')]=function(_0x3f18f7,_0x20bf33){return db[_0x2dbe('0x2a')][_0x2dbe('0x45')](_0x3f18f7[_0x2dbe('0x46')],{})[_0x2dbe('0x25')](respondWithResult(_0x20bf33,0xc9))['catch'](handleError(_0x20bf33,null));};exports[_0x2dbe('0x24')]=function(_0xbb823c,_0x445f01){if(_0xbb823c[_0x2dbe('0x46')]['id']){delete _0xbb823c[_0x2dbe('0x46')]['id'];}return db[_0x2dbe('0x2a')][_0x2dbe('0x44')]({'where':{'id':_0xbb823c[_0x2dbe('0x47')]['id']}})[_0x2dbe('0x25')](handleEntityNotFound(_0x445f01,null))['then'](saveUpdates(_0xbb823c['body'],null))[_0x2dbe('0x25')](respondWithResult(_0x445f01,null))['catch'](handleError(_0x445f01,null));};exports[_0x2dbe('0x26')]=function(_0xf95994,_0x53ceca){return db[_0x2dbe('0x2a')][_0x2dbe('0x44')]({'where':{'id':_0xf95994[_0x2dbe('0x47')]['id']}})[_0x2dbe('0x25')](handleEntityNotFound(_0x53ceca,null))[_0x2dbe('0x25')](removeEntity(_0x53ceca,null))['catch'](handleError(_0x53ceca,null));};exports[_0x2dbe('0x48')]=function(_0x1e99d8,_0x5ae023,_0x4825a9){var _0xef95ec={};var _0x4e1b36={};var _0x55ae67;var _0x5426f9;return db[_0x2dbe('0x2a')]['findOne']({'where':{'id':_0x1e99d8[_0x2dbe('0x47')]['id']}})[_0x2dbe('0x25')](handleEntityNotFound(_0x5ae023,null))[_0x2dbe('0x25')](function(_0x32be42){if(_0x32be42){_0x55ae67=_0x32be42;_0x4e1b36[_0x2dbe('0x2f')]=_[_0x2dbe('0x31')](db[_0x2dbe('0x49')]['rawAttributes']);_0x4e1b36[_0x2dbe('0x33')]=_[_0x2dbe('0x31')](_0x1e99d8[_0x2dbe('0x33')]);_0x4e1b36[_0x2dbe('0x32')]=_[_0x2dbe('0x42')](_0x4e1b36[_0x2dbe('0x2f')],_0x4e1b36['query']);_0xef95ec[_0x2dbe('0x34')]=_[_0x2dbe('0x42')](_0x4e1b36[_0x2dbe('0x2f')],qs[_0x2dbe('0x35')](_0x1e99d8[_0x2dbe('0x33')][_0x2dbe('0x35')]));_0xef95ec[_0x2dbe('0x34')]=_0xef95ec[_0x2dbe('0x34')][_0x2dbe('0x43')]?_0xef95ec[_0x2dbe('0x34')]:_0x4e1b36[_0x2dbe('0x2f')];_0xef95ec['order']=qs[_0x2dbe('0x4a')](_0x1e99d8[_0x2dbe('0x33')][_0x2dbe('0x4a')]);_0xef95ec['where']=qs[_0x2dbe('0x32')](_['pick'](_0x1e99d8[_0x2dbe('0x33')],_0x4e1b36[_0x2dbe('0x32')]));if(_0x1e99d8[_0x2dbe('0x33')][_0x2dbe('0x39')]){_0xef95ec[_0x2dbe('0x3a')]=_[_0x2dbe('0x3b')](_0xef95ec[_0x2dbe('0x3a')],{'$or':_[_0x2dbe('0x30')](_0xef95ec[_0x2dbe('0x34')],function(_0x3650b9){var _0x5d97c5={};_0x5d97c5[_0x3650b9]={'$like':'%'+_0x1e99d8['query']['filter']+'%'};return _0x5d97c5;})});}_0xef95ec=_['merge']({},_0xef95ec,_0x1e99d8['options']);return _0x55ae67['getConfigurations'](_0xef95ec);}})['then'](function(_0x533a22){if(_0x533a22){_0x5426f9=_0x533a22['length'];if(!_0x1e99d8[_0x2dbe('0x33')]['hasOwnProperty'](_0x2dbe('0x37'))){_0xef95ec[_0x2dbe('0x20')]=qs[_0x2dbe('0x20')](_0x1e99d8['query'][_0x2dbe('0x20')]);_0xef95ec[_0x2dbe('0x1e')]=qs[_0x2dbe('0x1e')](_0x1e99d8[_0x2dbe('0x33')][_0x2dbe('0x1e')]);}return _0x55ae67[_0x2dbe('0x48')](_0xef95ec);}})['then'](function(_0x4ecf5c){if(_0x4ecf5c){return _0x4ecf5c?{'count':_0x5426f9,'rows':_0x4ecf5c}:null;}})[_0x2dbe('0x25')](respondWithResult(_0x5ae023,null))[_0x2dbe('0x40')](handleError(_0x5ae023,null));};exports[_0x2dbe('0x4b')]=function(_0x42b464,_0x550da9,_0x1fa975){if(_0x42b464[_0x2dbe('0x46')]['id']){delete _0x42b464[_0x2dbe('0x46')]['id'];}return db[_0x2dbe('0x2a')][_0x2dbe('0x4c')]({'where':{'id':_0x42b464[_0x2dbe('0x47')]['id']}})[_0x2dbe('0x25')](handleEntityNotFound(_0x550da9,null))[_0x2dbe('0x25')](function(_0x27ab83){if(_0x27ab83){_0x42b464[_0x2dbe('0x46')]['AccountId']=_0x27ab83['id'];_0x42b464[_0x2dbe('0x46')]['Subjects']=integrations[_0x2dbe('0x4d')](_0x42b464[_0x2dbe('0x46')][_0x2dbe('0x4e')],_0x42b464[_0x2dbe('0x46')]['type']);_0x42b464[_0x2dbe('0x46')][_0x2dbe('0x4f')]=integrations[_0x2dbe('0x50')](_0x42b464['body'][_0x2dbe('0x4e')],_0x42b464[_0x2dbe('0x46')][_0x2dbe('0x2d')]);return db['ZohoConfiguration']['create'](_0x42b464[_0x2dbe('0x46')],{'include':[{'model':db[_0x2dbe('0x51')],'as':_0x2dbe('0x52')},{'model':db[_0x2dbe('0x51')],'as':'Descriptions'}]});}return null;})[_0x2dbe('0x25')](respondWithResult(_0x550da9,null))['catch'](handleError(_0x550da9,null));};function getAccessToken(_0x36f510){return new Promise(function(_0x19cf52,_0x28cc6f){var _0x12b7a5;switch(_0x36f510['zone']){case'US':_0x12b7a5=_0x2dbe('0x53');break;case'AU':_0x12b7a5='https://accounts.zoho.com.au';break;case'EU':_0x12b7a5=_0x2dbe('0x54');break;case'IN':_0x12b7a5=_0x2dbe('0x55');break;case'CN':_0x12b7a5=_0x2dbe('0x56');break;default:_0x12b7a5='https://accounts.zoho.eu';break;}var _0x62eb8f={'method':_0x2dbe('0x57'),'uri':_0x12b7a5+_0x2dbe('0x58'),'qs':{'refresh_token':_0x36f510[_0x2dbe('0x59')],'client_id':_0x36f510[_0x2dbe('0x5a')],'client_secret':_0x36f510['clientSecret'],'grant_type':_0x2dbe('0x5b')},'json':!![]};return rp(_0x62eb8f)[_0x2dbe('0x25')](function(_0x44991a){if(_0x44991a[_0x2dbe('0x5c')]){_0x19cf52(_0x44991a[_0x2dbe('0x5c')]);}else{_0x28cc6f(_0x2dbe('0x5d'));}})['catch'](function(_0xd3fc1d){_0x28cc6f(_0xd3fc1d);});});}exports['getFields']=function(_0xf315b4,_0x1b712c,_0x1aba03){var _0x42e8af,_0x9d512,_0x40d5c2,_0x1c69ef,_0x544a89;return db[_0x2dbe('0x2a')][_0x2dbe('0x4c')]({'where':{'id':_0xf315b4[_0x2dbe('0x47')]['id']},'attributes':['id',_0x2dbe('0x5e'),_0x2dbe('0x5f'),_0x2dbe('0x5a'),_0x2dbe('0x60'),'serverUrl',_0x2dbe('0x61'),_0x2dbe('0x59')]})[_0x2dbe('0x25')](handleEntityNotFound(_0x1b712c,null))[_0x2dbe('0x25')](function(_0x3a2377){_0x544a89=_0x3a2377;_0x42e8af=_0x544a89[_0x2dbe('0x5e')];_0x9d512=_0x42e8af==='zoho.eu'?'eu':'com';_0x40d5c2=_0x544a89[_0x2dbe('0x62')];var _0x1af6c2=_0x40d5c2[_0x2dbe('0x63')](-0x1);if(_0x1af6c2==='/'||_0x1af6c2==='\x5c'||_0x1af6c2===':'){_0x40d5c2=_0x40d5c2[_0x2dbe('0x64')](0x0,_0x40d5c2['lastIndexOf'](_0x1af6c2));}if(!_0x544a89['refreshToken']){throw new Error(_0x2dbe('0x65'));}return getAccessToken(_0x544a89);})[_0x2dbe('0x25')](function(_0x2ea39e){if(_0x2ea39e){return rp({'method':'GET','uri':util['format'](_0x2dbe('0x66'),_0x9d512),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2ea39e},'json':!![]});}})['then'](function(_0x1a6cf2){if(_0x1a6cf2){if(_0x1a6cf2[_0x2dbe('0x67')]&&_0x1a6cf2[_0x2dbe('0x67')]['error']){throw new Error(_0x1a6cf2[_0x2dbe('0x67')]['error'][_0x2dbe('0x68')]);}var _0x2464aa=[];var _0x479293=[];var _0x1c6d8a=[_0x2dbe('0x69'),_0x2dbe('0x6a'),'Description',_0x2dbe('0x6b'),_0x2dbe('0x6c'),_0x2dbe('0x6d'),_0x2dbe('0x6e'),_0x2dbe('0x6f')];_0x479293=_[_0x2dbe('0x70')](_0x1a6cf2[_0x2dbe('0x35')],function(_0xdf2819){return _0x1c6d8a['includes'](_0xdf2819[_0x2dbe('0x71')]);});for(var _0x1ba547=0x0;_0x1ba547<_0x479293['length'];_0x1ba547++){if(_0x479293[_0x1ba547][_0x2dbe('0x72')]===![]){_0x2464aa[_0x2dbe('0x73')]({'id':_0x479293[_0x1ba547]['id'],'name':_0x479293[_0x1ba547][_0x2dbe('0x74')],'custom':_0x479293[_0x1ba547][_0x2dbe('0x75')],'options':_0x479293[_0x1ba547][_0x2dbe('0x76')]===_0x2dbe('0x77')&&_0x479293[_0x1ba547][_0x2dbe('0x78')][_0x2dbe('0x43')]>-0x1?_[_0x2dbe('0x30')](_0x479293[_0x1ba547]['pick_list_values'],function(_0x17144a){return{'name':_0x17144a,'value':_0x17144a};}):[]});}}return{'count':_0x2464aa[_0x2dbe('0x43')],'rows':_0x2464aa};}else{return{'count':0x0,'rows':[]};}})[_0x2dbe('0x25')](respondWithResult(_0x1b712c,null))[_0x2dbe('0x40')](function(_0x4d2c9f){var _0xca3711=_0xf315b4[_0x2dbe('0x33')][_0x2dbe('0x79')]?0x1f4:_0x4d2c9f['statusCode']||0x1f4;logger['error'](_0x2dbe('0x7a'),_0x2dbe('0x7b'),_0xca3711,JSON[_0x2dbe('0x7c')](_0x4d2c9f));delete _0x4d2c9f['name'];if(_0xca3711===0x191){_0xca3711=0x190;}_0x1b712c['status'](_0xca3711)[_0x2dbe('0x7d')](_0xf315b4[_0x2dbe('0x33')]['test']?{'message':_0x2dbe('0x7e'),'statusCode':_0x4d2c9f[_0x2dbe('0x7f')]}:_0x4d2c9f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 8f6a6ec..22afd37 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 _0xc26e=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','error','host','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','code','catch','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','int_zoho_accounts','changed','zone','serverUrl','clientId','slice','substring'];(function(_0x25bca6,_0xe415ea){var _0x3f8d02=function(_0x3e581b){while(--_0x3e581b){_0x25bca6['push'](_0x25bca6['shift']());}};_0x3f8d02(++_0xe415ea);}(_0xc26e,0x103));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xec26('0x0'))('api');var moment=require(_0xec26('0x1'));var BPromise=require(_0xec26('0x2'));var rp=require(_0xec26('0x3'));var fs=require('fs');var path=require(_0xec26('0x4'));var rimraf=require('rimraf');var config=require(_0xec26('0x5'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xec26('0x6')]=function(_0x294a95,_0x380276){return _0x294a95['define']('ZohoAccount',attributes,{'tableName':_0xec26('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x40e0f6,_0x380f62,_0x31c978){if(_0x40e0f6[_0xec26('0x8')](_0xec26('0x9'))||_0x40e0f6[_0xec26('0x8')](_0xec26('0xa'))||_0x40e0f6[_0xec26('0x8')](_0xec26('0xb'))||_0x40e0f6['changed']('clientSecret')||_0x40e0f6[_0xec26('0x8')]('code')||_0x40e0f6[_0xec26('0x8')]('host')){var _0x59ad16,_0x545660;_0x59ad16=_0x40e0f6[_0xec26('0xa')];var _0x304b89=_0x59ad16[_0xec26('0xc')](-0x1);if(_0x304b89==='/'||_0x304b89==='\x5c'||_0x304b89===':'){_0x59ad16=_0x59ad16[_0xec26('0xd')](0x0,_0x59ad16[_0xec26('0xe')](_0x304b89));}switch(_0x40e0f6[_0xec26('0x9')]){case'US':_0x545660=_0xec26('0xf');break;case'AU':_0x545660='https://accounts.zoho.com.au';break;case'IN':_0x545660=_0xec26('0x10');break;case'CN':_0x545660='https://accounts.zoho.com.cn';break;default:_0x545660=_0xec26('0x11');break;}var _0x34e328={'method':_0xec26('0x12'),'uri':_0x545660+_0xec26('0x13'),'form':{'grant_type':_0xec26('0x14'),'client_id':_0x40e0f6['clientId'],'client_secret':_0x40e0f6[_0xec26('0x15')],'redirect_uri':_0x40e0f6[_0xec26('0xa')],'code':_0x40e0f6['code']},'headers':{'Content-Type':_0xec26('0x16')}};return rp(_0x34e328)[_0xec26('0x17')](function(_0x330d56){var _0x1e7b64=JSON[_0xec26('0x18')](_0x330d56);if(_0x1e7b64[_0xec26('0x19')]){_0x40e0f6[_0xec26('0x1a')]=_0x1e7b64['refresh_token'];logger[_0xec26('0x1b')](util[_0xec26('0x1c')](_0xec26('0x1d'),_0x40e0f6[_0xec26('0x1e')],_0x40e0f6['id']));}else{logger['error'](util[_0xec26('0x1c')](_0xec26('0x1f'),_0x40e0f6['name'],_0x40e0f6['id']),util[_0xec26('0x20')](_0x1e7b64,{'showHidden':![],'depth':null}));}return _0x31c978(null,_0x380f62);})['catch'](function(_0xb5eb98){logger[_0xec26('0x21')](util[_0xec26('0x1c')](_0xec26('0x1f'),_0x40e0f6[_0xec26('0x1e')],_0x40e0f6['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x31c978(_0xb5eb98);});}else{return _0x31c978(null,_0x380f62);}},'beforeUpdate':function(_0x4f88dc,_0x72e561,_0x43e0ec){if(_0x4f88dc[_0xec26('0x8')](_0xec26('0x9'))||_0x4f88dc[_0xec26('0x8')](_0xec26('0xa'))||_0x4f88dc['changed']('clientId')||_0x4f88dc[_0xec26('0x8')](_0xec26('0x15'))||_0x4f88dc[_0xec26('0x8')]('code')||_0x4f88dc[_0xec26('0x8')](_0xec26('0x22'))){var _0x4884a9,_0x4711bb;_0x4884a9=_0x4f88dc[_0xec26('0xa')];var _0x33f6d1=_0x4884a9[_0xec26('0xc')](-0x1);if(_0x33f6d1==='/'||_0x33f6d1==='\x5c'||_0x33f6d1===':'){_0x4884a9=_0x4884a9['substring'](0x0,_0x4884a9['lastIndexOf'](_0x33f6d1));}switch(_0x4f88dc['zone']){case'US':_0x4711bb='https://accounts.zoho.com';break;case'AU':_0x4711bb=_0xec26('0x23');break;case'IN':_0x4711bb=_0xec26('0x10');break;case'CN':_0x4711bb=_0xec26('0x24');break;default:_0x4711bb=_0xec26('0x11');break;}var _0x35b048={'method':_0xec26('0x12'),'uri':_0x4711bb+'/oauth/v2/token','form':{'grant_type':_0xec26('0x14'),'client_id':_0x4f88dc[_0xec26('0xb')],'client_secret':_0x4f88dc[_0xec26('0x15')],'redirect_uri':_0x4f88dc['serverUrl'],'code':_0x4f88dc[_0xec26('0x25')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x35b048)[_0xec26('0x17')](function(_0x503110){var _0x6a152b=JSON[_0xec26('0x18')](_0x503110);if(_0x6a152b['refresh_token']){_0x4f88dc[_0xec26('0x1a')]=_0x6a152b[_0xec26('0x19')];logger[_0xec26('0x1b')](util['format'](_0xec26('0x1d'),_0x4f88dc[_0xec26('0x1e')],_0x4f88dc['id']));}else{logger[_0xec26('0x21')](util['format'](_0xec26('0x1f'),_0x4f88dc[_0xec26('0x1e')],_0x4f88dc['id']),util[_0xec26('0x20')](_0x6a152b,{'showHidden':![],'depth':null}));}return _0x43e0ec(null,_0x72e561);})[_0xec26('0x26')](function(_0x1fcb11){logger[_0xec26('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4f88dc['name'],_0x4f88dc['id']),util[_0xec26('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x43e0ec(_0x1fcb11);});}else{return _0x43e0ec(null,_0x72e561);}}}});}; \ No newline at end of file +var _0xb553=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','name','error','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','substring','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','format','lodash'];(function(_0x3b7c34,_0x5d3ee3){var _0x3518e5=function(_0x3179f5){while(--_0x3179f5){_0x3b7c34['push'](_0x3b7c34['shift']());}};_0x3518e5(++_0x5d3ee3);}(_0xb553,0x1c1));var _0x3b55=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xb553[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x3b55('0x0'));var util=require(_0x3b55('0x1'));var logger=require(_0x3b55('0x2'))(_0x3b55('0x3'));var moment=require(_0x3b55('0x4'));var BPromise=require(_0x3b55('0x5'));var rp=require(_0x3b55('0x6'));var fs=require('fs');var path=require(_0x3b55('0x7'));var rimraf=require(_0x3b55('0x8'));var config=require(_0x3b55('0x9'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x3b55('0xa'));module[_0x3b55('0xb')]=function(_0x3e0ad8,_0x3aca06){return _0x3e0ad8['define'](_0x3b55('0xc'),attributes,{'tableName':_0x3b55('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x235710,_0xfa6fa7,_0x2d7972){if(_0x235710[_0x3b55('0xe')](_0x3b55('0xf'))||_0x235710['changed'](_0x3b55('0x10'))||_0x235710[_0x3b55('0xe')](_0x3b55('0x11'))||_0x235710[_0x3b55('0xe')](_0x3b55('0x12'))||_0x235710[_0x3b55('0xe')](_0x3b55('0x13'))||_0x235710[_0x3b55('0xe')]('host')){var _0x2c4eca,_0x3360ce;_0x2c4eca=_0x235710[_0x3b55('0x10')];var _0x2e3893=_0x2c4eca[_0x3b55('0x14')](-0x1);if(_0x2e3893==='/'||_0x2e3893==='\x5c'||_0x2e3893===':'){_0x2c4eca=_0x2c4eca['substring'](0x0,_0x2c4eca[_0x3b55('0x15')](_0x2e3893));}switch(_0x235710['zone']){case'US':_0x3360ce=_0x3b55('0x16');break;case'AU':_0x3360ce=_0x3b55('0x17');break;case'IN':_0x3360ce=_0x3b55('0x18');break;case'CN':_0x3360ce=_0x3b55('0x19');break;default:_0x3360ce=_0x3b55('0x1a');break;}var _0x41e8c0={'method':_0x3b55('0x1b'),'uri':_0x3360ce+_0x3b55('0x1c'),'form':{'grant_type':_0x3b55('0x1d'),'client_id':_0x235710[_0x3b55('0x11')],'client_secret':_0x235710[_0x3b55('0x12')],'redirect_uri':_0x235710[_0x3b55('0x10')],'code':_0x235710['code']},'headers':{'Content-Type':_0x3b55('0x1e')}};return rp(_0x41e8c0)[_0x3b55('0x1f')](function(_0x4ee928){var _0x3d7441=JSON[_0x3b55('0x20')](_0x4ee928);if(_0x3d7441[_0x3b55('0x21')]){_0x235710[_0x3b55('0x22')]=_0x3d7441[_0x3b55('0x21')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x235710[_0x3b55('0x23')],_0x235710['id']));}else{logger[_0x3b55('0x24')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x235710[_0x3b55('0x23')],_0x235710['id']),util['inspect'](_0x3d7441,{'showHidden':![],'depth':null}));}return _0x2d7972(null,_0xfa6fa7);})[_0x3b55('0x25')](function(_0x546bdb){logger[_0x3b55('0x24')](util['format'](_0x3b55('0x26'),_0x235710[_0x3b55('0x23')],_0x235710['id']),util[_0x3b55('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x2d7972(_0x546bdb);});}else{return _0x2d7972(null,_0xfa6fa7);}},'beforeUpdate':function(_0x572eba,_0x3e569b,_0x4cc4a7){if(_0x572eba['changed'](_0x3b55('0xf'))||_0x572eba[_0x3b55('0xe')](_0x3b55('0x10'))||_0x572eba[_0x3b55('0xe')]('clientId')||_0x572eba['changed'](_0x3b55('0x12'))||_0x572eba[_0x3b55('0xe')](_0x3b55('0x13'))||_0x572eba['changed'](_0x3b55('0x28'))){var _0x3845f6,_0x36c8a9;_0x3845f6=_0x572eba[_0x3b55('0x10')];var _0xd74582=_0x3845f6['slice'](-0x1);if(_0xd74582==='/'||_0xd74582==='\x5c'||_0xd74582===':'){_0x3845f6=_0x3845f6[_0x3b55('0x29')](0x0,_0x3845f6['lastIndexOf'](_0xd74582));}switch(_0x572eba[_0x3b55('0xf')]){case'US':_0x36c8a9='https://accounts.zoho.com';break;case'AU':_0x36c8a9='https://accounts.zoho.com.au';break;case'IN':_0x36c8a9=_0x3b55('0x18');break;case'CN':_0x36c8a9=_0x3b55('0x19');break;default:_0x36c8a9='https://accounts.zoho.eu';break;}var _0x45a94c={'method':'POST','uri':_0x36c8a9+_0x3b55('0x1c'),'form':{'grant_type':_0x3b55('0x1d'),'client_id':_0x572eba['clientId'],'client_secret':_0x572eba[_0x3b55('0x12')],'redirect_uri':_0x572eba[_0x3b55('0x10')],'code':_0x572eba['code']},'headers':{'Content-Type':_0x3b55('0x1e')}};return rp(_0x45a94c)[_0x3b55('0x1f')](function(_0x27cd3e){var _0x1209fa=JSON[_0x3b55('0x20')](_0x27cd3e);if(_0x1209fa[_0x3b55('0x21')]){_0x572eba[_0x3b55('0x22')]=_0x1209fa['refresh_token'];logger[_0x3b55('0x2a')](util['format'](_0x3b55('0x2b'),_0x572eba[_0x3b55('0x23')],_0x572eba['id']));}else{logger['error'](util[_0x3b55('0x2c')](_0x3b55('0x26'),_0x572eba[_0x3b55('0x23')],_0x572eba['id']),util[_0x3b55('0x27')](_0x1209fa,{'showHidden':![],'depth':null}));}return _0x4cc4a7(null,_0x3e569b);})[_0x3b55('0x25')](function(_0xd74d54){logger[_0x3b55('0x24')](util['format'](_0x3b55('0x26'),_0x572eba[_0x3b55('0x23')],_0x572eba['id']),util[_0x3b55('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x4cc4a7(_0xd74d54);});}else{return _0x4cc4a7(null,_0x3e569b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index ba2bff1..4245579 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 _0xc74c=['catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','debug','find','then','ShowZohoAccount','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc74c,0x163));var _0xcc74=function(_0x40f339,_0x463c1e){_0x40f339=_0x40f339-0x0;var _0x46948c=_0xc74c[_0x40f339];return _0x46948c;};'use strict';var _=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc74('0x2'));var fs=require('fs');var Redis=require(_0xcc74('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc74('0x4'));var logger=require(_0xcc74('0x5'))(_0xcc74('0x6'));var config=require(_0xcc74('0x7'));var jayson=require(_0xcc74('0x8'));var client=jayson[_0xcc74('0x9')][_0xcc74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d46a6,_0x15248f,_0x86f429){return new BPromise(function(_0x1eb886,_0x473308){return client[_0xcc74('0xb')](_0x5d46a6,_0x86f429)['then'](function(_0x4b4534){logger[_0xcc74('0xc')](_0xcc74('0xd'),_0x15248f,_0xcc74('0xe'));logger['debug'](_0xcc74('0xf'),_0x15248f,_0xcc74('0xe'),JSON[_0xcc74('0x10')](_0x4b4534));if(_0x4b4534['error']){if(_0x4b4534[_0xcc74('0x11')]['code']===0x1f4){logger[_0xcc74('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x15248f,_0x4b4534['error']['message']);return _0x473308(_0x4b4534[_0xcc74('0x11')][_0xcc74('0x12')]);}logger[_0xcc74('0x11')](_0xcc74('0xd'),_0x15248f,_0x4b4534[_0xcc74('0x11')]['message']);return _0x1eb886(_0x4b4534[_0xcc74('0x11')][_0xcc74('0x12')]);}else{logger[_0xcc74('0xc')](_0xcc74('0xd'),_0x15248f,_0xcc74('0xe'));_0x1eb886(_0x4b4534['result'][_0xcc74('0x12')]);}})[_0xcc74('0x13')](function(_0xe44014){logger[_0xcc74('0x11')](_0xcc74('0xd'),_0x15248f,_0xe44014);_0x473308(_0xe44014);});});}exports[_0xcc74('0x14')]=function(_0x170583){var _0x45d9bd=this;return new Promise(function(_0x30101f,_0x5a18b3){return db[_0xcc74('0x15')][_0xcc74('0x16')]({'raw':_0x170583[_0xcc74('0x17')]?_0x170583[_0xcc74('0x17')][_0xcc74('0x18')]===undefined?!![]:![]:!![],'where':_0x170583[_0xcc74('0x17')]?_0x170583['options'][_0xcc74('0x19')]||null:null,'attributes':_0x170583[_0xcc74('0x17')]?_0x170583['options'][_0xcc74('0x1a')]||null:null,'limit':_0x170583[_0xcc74('0x17')]?_0x170583[_0xcc74('0x17')]['limit']||null:null,'include':_0x170583[_0xcc74('0x17')]?_0x170583[_0xcc74('0x17')][_0xcc74('0x1b')]?_[_0xcc74('0x1c')](_0x170583['options'][_0xcc74('0x1b')],function(_0x11811d){return{'model':db[_0x11811d[_0xcc74('0x1d')]],'as':_0x11811d['as'],'attributes':_0x11811d['attributes'],'include':_0x11811d[_0xcc74('0x1b')]?_[_0xcc74('0x1c')](_0x11811d[_0xcc74('0x1b')],function(_0x5a9fa6){return{'model':db[_0x5a9fa6['model']],'as':_0x5a9fa6['as'],'attributes':_0x5a9fa6['attributes'],'include':_0x5a9fa6[_0xcc74('0x1b')]?_[_0xcc74('0x1c')](_0x5a9fa6[_0xcc74('0x1b')],function(_0x311cc2){return{'model':db[_0x311cc2[_0xcc74('0x1d')]],'as':_0x311cc2['as'],'attributes':_0x311cc2[_0xcc74('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x393e56){logger[_0xcc74('0xc')](_0xcc74('0x14'),_0x170583);logger[_0xcc74('0x1e')]('GetZohoAccount',_0x170583,JSON[_0xcc74('0x10')](_0x393e56));_0x30101f(_0x393e56);})[_0xcc74('0x13')](function(_0x46e47f){logger[_0xcc74('0x11')](_0xcc74('0x14'),_0x46e47f[_0xcc74('0x12')],_0x170583);_0x5a18b3(_0x45d9bd['error'](0x1f4,_0x46e47f[_0xcc74('0x12')]));});});};exports['ShowZohoAccount']=function(_0x3faeab){var _0x380134=this;return new Promise(function(_0x424718,_0x43513b){return db[_0xcc74('0x15')][_0xcc74('0x1f')]({'raw':_0x3faeab['options']?_0x3faeab['options'][_0xcc74('0x18')]===undefined?!![]:![]:!![],'where':_0x3faeab[_0xcc74('0x17')]?_0x3faeab[_0xcc74('0x17')]['where']||null:null,'attributes':_0x3faeab[_0xcc74('0x17')]?_0x3faeab[_0xcc74('0x17')]['attributes']||null:null,'include':_0x3faeab['options']?_0x3faeab[_0xcc74('0x17')][_0xcc74('0x1b')]?_['map'](_0x3faeab[_0xcc74('0x17')][_0xcc74('0x1b')],function(_0x1a8b20){return{'model':db[_0x1a8b20[_0xcc74('0x1d')]],'as':_0x1a8b20['as'],'attributes':_0x1a8b20[_0xcc74('0x1a')],'include':_0x1a8b20[_0xcc74('0x1b')]?_['map'](_0x1a8b20[_0xcc74('0x1b')],function(_0x2a4634){return{'model':db[_0x2a4634[_0xcc74('0x1d')]],'as':_0x2a4634['as'],'attributes':_0x2a4634[_0xcc74('0x1a')],'include':_0x2a4634[_0xcc74('0x1b')]?_[_0xcc74('0x1c')](_0x2a4634[_0xcc74('0x1b')],function(_0x5a361f){return{'model':db[_0x5a361f[_0xcc74('0x1d')]],'as':_0x5a361f['as'],'attributes':_0x5a361f['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc74('0x20')](function(_0xe7c08b){logger[_0xcc74('0xc')](_0xcc74('0x21'),_0x3faeab);logger[_0xcc74('0x1e')](_0xcc74('0x21'),_0x3faeab,JSON[_0xcc74('0x10')](_0xe7c08b));_0x424718(_0xe7c08b);})[_0xcc74('0x13')](function(_0x11d7d7){logger[_0xcc74('0x11')](_0xcc74('0x21'),_0x11d7d7[_0xcc74('0x12')],_0x3faeab);_0x43513b(_0x380134['error'](0x1f4,_0x11d7d7[_0xcc74('0x12')]));});});}; \ No newline at end of file +var _0xf55c=['GetZohoAccount','findAll','options','where','include','model','attributes','map','ShowZohoAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x8ae9ef,_0x22c791){var _0x5c29d4=function(_0x81dcf3){while(--_0x81dcf3){_0x8ae9ef['push'](_0x8ae9ef['shift']());}};_0x5c29d4(++_0x22c791);}(_0xf55c,0x1e7));var _0xcf55=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xf55c[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var moment=require(_0xcf55('0x1'));var BPromise=require(_0xcf55('0x2'));var rs=require(_0xcf55('0x3'));var fs=require('fs');var Redis=require(_0xcf55('0x4'));var db=require(_0xcf55('0x5'))['db'];var utils=require(_0xcf55('0x6'));var logger=require(_0xcf55('0x7'))('rpc');var config=require(_0xcf55('0x8'));var jayson=require(_0xcf55('0x9'));var client=jayson[_0xcf55('0xa')][_0xcf55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b3453,_0x29566b,_0x53deb4){return new BPromise(function(_0x7003f1,_0x3018aa){return client['request'](_0x4b3453,_0x53deb4)[_0xcf55('0xc')](function(_0x3ce5d2){logger[_0xcf55('0xd')](_0xcf55('0xe'),_0x29566b,_0xcf55('0xf'));logger[_0xcf55('0x10')](_0xcf55('0x11'),_0x29566b,'request\x20sent',JSON[_0xcf55('0x12')](_0x3ce5d2));if(_0x3ce5d2[_0xcf55('0x13')]){if(_0x3ce5d2['error']['code']===0x1f4){logger[_0xcf55('0x13')](_0xcf55('0xe'),_0x29566b,_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);return _0x3018aa(_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);}logger[_0xcf55('0x13')](_0xcf55('0xe'),_0x29566b,_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);return _0x7003f1(_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);}else{logger['info'](_0xcf55('0xe'),_0x29566b,_0xcf55('0xf'));_0x7003f1(_0x3ce5d2[_0xcf55('0x15')][_0xcf55('0x14')]);}})[_0xcf55('0x16')](function(_0x4b0c1a){logger[_0xcf55('0x13')](_0xcf55('0xe'),_0x29566b,_0x4b0c1a);_0x3018aa(_0x4b0c1a);});});}exports[_0xcf55('0x17')]=function(_0xeed93){var _0x30149a=this;return new Promise(function(_0x52195b,_0x12d3fc){return db['ZohoAccount'][_0xcf55('0x18')]({'raw':_0xeed93[_0xcf55('0x19')]?_0xeed93[_0xcf55('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xeed93['options']?_0xeed93['options'][_0xcf55('0x1a')]||null:null,'attributes':_0xeed93[_0xcf55('0x19')]?_0xeed93[_0xcf55('0x19')]['attributes']||null:null,'limit':_0xeed93[_0xcf55('0x19')]?_0xeed93[_0xcf55('0x19')]['limit']||null:null,'include':_0xeed93['options']?_0xeed93[_0xcf55('0x19')][_0xcf55('0x1b')]?_['map'](_0xeed93[_0xcf55('0x19')][_0xcf55('0x1b')],function(_0x1bb5cf){return{'model':db[_0x1bb5cf[_0xcf55('0x1c')]],'as':_0x1bb5cf['as'],'attributes':_0x1bb5cf[_0xcf55('0x1d')],'include':_0x1bb5cf[_0xcf55('0x1b')]?_[_0xcf55('0x1e')](_0x1bb5cf[_0xcf55('0x1b')],function(_0x524828){return{'model':db[_0x524828[_0xcf55('0x1c')]],'as':_0x524828['as'],'attributes':_0x524828['attributes'],'include':_0x524828[_0xcf55('0x1b')]?_[_0xcf55('0x1e')](_0x524828[_0xcf55('0x1b')],function(_0x51471f){return{'model':db[_0x51471f['model']],'as':_0x51471f['as'],'attributes':_0x51471f['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf55('0xc')](function(_0x34c18b){logger['info']('GetZohoAccount',_0xeed93);logger[_0xcf55('0x10')]('GetZohoAccount',_0xeed93,JSON[_0xcf55('0x12')](_0x34c18b));_0x52195b(_0x34c18b);})[_0xcf55('0x16')](function(_0x1f9ed9){logger[_0xcf55('0x13')](_0xcf55('0x17'),_0x1f9ed9[_0xcf55('0x14')],_0xeed93);_0x12d3fc(_0x30149a[_0xcf55('0x13')](0x1f4,_0x1f9ed9['message']));});});};exports[_0xcf55('0x1f')]=function(_0x4aee25){var _0x28f277=this;return new Promise(function(_0x222d5f,_0x13db24){return db['ZohoAccount'][_0xcf55('0x20')]({'raw':_0x4aee25[_0xcf55('0x19')]?_0x4aee25[_0xcf55('0x19')][_0xcf55('0x21')]===undefined?!![]:![]:!![],'where':_0x4aee25['options']?_0x4aee25[_0xcf55('0x19')]['where']||null:null,'attributes':_0x4aee25['options']?_0x4aee25['options'][_0xcf55('0x1d')]||null:null,'include':_0x4aee25['options']?_0x4aee25['options'][_0xcf55('0x1b')]?_[_0xcf55('0x1e')](_0x4aee25['options'][_0xcf55('0x1b')],function(_0x238f08){return{'model':db[_0x238f08['model']],'as':_0x238f08['as'],'attributes':_0x238f08['attributes'],'include':_0x238f08[_0xcf55('0x1b')]?_[_0xcf55('0x1e')](_0x238f08[_0xcf55('0x1b')],function(_0x44ffff){return{'model':db[_0x44ffff['model']],'as':_0x44ffff['as'],'attributes':_0x44ffff[_0xcf55('0x1d')],'include':_0x44ffff[_0xcf55('0x1b')]?_[_0xcf55('0x1e')](_0x44ffff[_0xcf55('0x1b')],function(_0x5dcc81){return{'model':db[_0x5dcc81[_0xcf55('0x1c')]],'as':_0x5dcc81['as'],'attributes':_0x5dcc81['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf55('0xc')](function(_0x42d7f8){logger[_0xcf55('0xd')](_0xcf55('0x1f'),_0x4aee25);logger['debug'](_0xcf55('0x1f'),_0x4aee25,JSON[_0xcf55('0x12')](_0x42d7f8));_0x222d5f(_0x42d7f8);})['catch'](function(_0xca2760){logger[_0xcf55('0x13')](_0xcf55('0x1f'),_0xca2760[_0xcf55('0x14')],_0x4aee25);_0x13db24(_0x28f277[_0xcf55('0x13')](0x1f4,_0xca2760[_0xcf55('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index cd5171d..86ffb64 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 _0x3c50=['show','getFields','getSubjects','getDescriptions','post','create','put','update','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x2a1452,_0x1e6d27){var _0x52725e=function(_0x497b0c){while(--_0x497b0c){_0x2a1452['push'](_0x2a1452['shift']());}};_0x52725e(++_0x1e6d27);}(_0x3c50,0x1d6));var _0x03c5=function(_0x9e0a51,_0x2fa12d){_0x9e0a51=_0x9e0a51-0x0;var _0x23a33e=_0x3c50[_0x9e0a51];return _0x23a33e;};'use strict';var multer=require('multer');var util=require(_0x03c5('0x0'));var path=require(_0x03c5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x03c5('0x2')]();var fs_extra=require(_0x03c5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x03c5('0x4'));var config=require('../../config/environment');var controller=require(_0x03c5('0x5'));router[_0x03c5('0x6')]('/',auth[_0x03c5('0x7')](),controller[_0x03c5('0x8')]);router['get'](_0x03c5('0x9'),auth[_0x03c5('0x7')](),controller[_0x03c5('0xa')]);router[_0x03c5('0x6')]('/:id/fields',auth[_0x03c5('0x7')](),controller[_0x03c5('0xb')]);router[_0x03c5('0x6')]('/:id/subjects',auth[_0x03c5('0x7')](),controller[_0x03c5('0xc')]);router[_0x03c5('0x6')]('/:id/descriptions',auth[_0x03c5('0x7')](),controller[_0x03c5('0xd')]);router[_0x03c5('0xe')]('/',auth['isAuthenticated'](),controller[_0x03c5('0xf')]);router[_0x03c5('0x10')](_0x03c5('0x9'),auth['isAuthenticated'](),controller[_0x03c5('0x11')]);router['delete'](_0x03c5('0x9'),auth[_0x03c5('0x7')](),controller[_0x03c5('0x12')]);module[_0x03c5('0x13')]=router; \ No newline at end of file +var _0x3a9a=['isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x22fdac,_0x29fb56){var _0x451d23=function(_0x584d12){while(--_0x584d12){_0x22fdac['push'](_0x22fdac['shift']());}};_0x451d23(++_0x29fb56);}(_0x3a9a,0x187));var _0xa3a9=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x3a9a[_0x462999];return _0x4b1366;};'use strict';var multer=require(_0xa3a9('0x0'));var util=require('util');var path=require(_0xa3a9('0x1'));var timeout=require(_0xa3a9('0x2'));var express=require(_0xa3a9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa3a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa3a9('0x5'));var controller=require(_0xa3a9('0x6'));router[_0xa3a9('0x7')]('/',auth[_0xa3a9('0x8')](),controller[_0xa3a9('0x9')]);router[_0xa3a9('0x7')](_0xa3a9('0xa'),auth[_0xa3a9('0x8')](),controller[_0xa3a9('0xb')]);router[_0xa3a9('0x7')]('/:id/fields',auth[_0xa3a9('0x8')](),controller[_0xa3a9('0xc')]);router['get'](_0xa3a9('0xd'),auth[_0xa3a9('0x8')](),controller[_0xa3a9('0xe')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xa3a9('0xf')]);router[_0xa3a9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa3a9('0x11')]('/:id',auth[_0xa3a9('0x8')](),controller[_0xa3a9('0x12')]);router[_0xa3a9('0x13')](_0xa3a9('0xa'),auth['isAuthenticated'](),controller[_0xa3a9('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 7464a1c..0667f06 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 _0x5e97=['ENUM','lead','nothing','contact_lead','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e97,0x155));var _0x75e9=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5e97[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x75e9('0x0'));module[_0x75e9('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x75e9('0x2')](_0x75e9('0x3'),'contact',_0x75e9('0x4')),'defaultValue':_0x75e9('0x3')},'moduleSearch':{'type':Sequelize[_0x75e9('0x2')](_0x75e9('0x5'),'contact',_0x75e9('0x3')),'defaultValue':_0x75e9('0x5')},'description':{'type':Sequelize[_0x75e9('0x6')]}}; \ No newline at end of file +var _0x7096=['exports','STRING','lead','contact','contact_lead','sequelize'];(function(_0x4fde66,_0x499d46){var _0x739ec=function(_0x80821a){while(--_0x80821a){_0x4fde66['push'](_0x4fde66['shift']());}};_0x739ec(++_0x499d46);}(_0x7096,0x1c7));var _0x6709=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x7096[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0x6709('0x0'));module[_0x6709('0x1')]={'name':{'type':Sequelize[_0x6709('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x6709('0x3'),_0x6709('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x6709('0x5'),_0x6709('0x4'),_0x6709('0x3')),'defaultValue':_0x6709('0x5')},'description':{'type':Sequelize[_0x6709('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 080350c..a5d6991 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 _0x1a0c=['update','params','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','destroy','then','sendStatus','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body'];(function(_0x3ed556,_0x1b89ce){var _0x5d2a21=function(_0x3eb557){while(--_0x3eb557){_0x3ed556['push'](_0x3ed556['shift']());}};_0x5d2a21(++_0x1b89ce);}(_0x1a0c,0xf9));var _0xc1a0=function(_0x58885f,_0x98e475){_0x58885f=_0x58885f-0x0;var _0x15b184=_0x1a0c[_0x58885f];return _0x15b184;};'use strict';var emlformat=require(_0xc1a0('0x0'));var rimraf=require(_0xc1a0('0x1'));var zipdir=require(_0xc1a0('0x2'));var jsonpatch=require(_0xc1a0('0x3'));var rp=require(_0xc1a0('0x4'));var moment=require('moment');var BPromise=require(_0xc1a0('0x5'));var Mustache=require(_0xc1a0('0x6'));var util=require(_0xc1a0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc1a0('0x8'));var ejs=require(_0xc1a0('0x9'));var fs=require('fs');var fs_extra=require(_0xc1a0('0xa'));var _=require(_0xc1a0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc1a0('0xc'));var toCsv=require(_0xc1a0('0x8'));var querystring=require(_0xc1a0('0xd'));var Papa=require(_0xc1a0('0xe'));var Redis=require(_0xc1a0('0xf'));var authService=require(_0xc1a0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc1a0('0x11'));var hardwareService=require(_0xc1a0('0x12'));var logger=require('../../config/logger')(_0xc1a0('0x13'));var utils=require('../../config/utils');var config=require(_0xc1a0('0x14'));var licenseUtil=require(_0xc1a0('0x15'));var db=require(_0xc1a0('0x16'))['db'];function respondWithStatusCode(_0x1f2143,_0x4e3d47){_0x4e3d47=_0x4e3d47||0xcc;return function(_0x15aa4f){if(_0x15aa4f){return _0x1f2143['sendStatus'](_0x4e3d47);}return _0x1f2143[_0xc1a0('0x17')](_0x4e3d47)[_0xc1a0('0x18')]();};}function respondWithResult(_0x4d9c76,_0x3a44f7){_0x3a44f7=_0x3a44f7||0xc8;return function(_0x5c218f){if(_0x5c218f){return _0x4d9c76[_0xc1a0('0x17')](_0x3a44f7)[_0xc1a0('0x19')](_0x5c218f);}};}function respondWithFilteredResult(_0xe568c7,_0x283be3){return function(_0x91716a){if(_0x91716a){var _0x27421c=typeof _0x283be3[_0xc1a0('0x1a')]==='undefined'&&typeof _0x283be3[_0xc1a0('0x1b')]===_0xc1a0('0x1c');var _0x76974d=_0x91716a[_0xc1a0('0x1d')];var _0x48d0e3=_0x27421c?0x0:_0x283be3[_0xc1a0('0x1a')];var _0x1ce4d1=_0x27421c?_0x91716a[_0xc1a0('0x1d')]:_0x283be3['offset']+_0x283be3[_0xc1a0('0x1b')];var _0x332abf;if(_0x1ce4d1>=_0x76974d){_0x1ce4d1=_0x76974d;_0x332abf=0xc8;}else{_0x332abf=0xce;}_0xe568c7[_0xc1a0('0x17')](_0x332abf);return _0xe568c7['set'](_0xc1a0('0x1e'),_0x48d0e3+'-'+_0x1ce4d1+'/'+_0x76974d)['json'](_0x91716a);}return null;};}function patchUpdates(_0x5997fa){return function(_0x5df6cc){try{jsonpatch[_0xc1a0('0x1f')](_0x5df6cc,_0x5997fa,!![]);}catch(_0xef2b76){return BPromise['reject'](_0xef2b76);}return _0x5df6cc[_0xc1a0('0x20')]();};}function saveUpdates(_0x18775e,_0x6cb4de){return function(_0x42adf1){if(_0x42adf1){return _0x42adf1['update'](_0x18775e)['then'](function(_0x5d2aba){return _0x5d2aba;});}return null;};}function removeEntity(_0x540563,_0x37cad4){return function(_0x4b2a7a){if(_0x4b2a7a){return _0x4b2a7a[_0xc1a0('0x21')]()[_0xc1a0('0x22')](function(){_0x540563[_0xc1a0('0x17')](0xcc)[_0xc1a0('0x18')]();});}};}function handleEntityNotFound(_0xd07e5a,_0x1f30cf){return function(_0x9066db){if(!_0x9066db){_0xd07e5a[_0xc1a0('0x23')](0x194);}return _0x9066db;};}function handleError(_0x5ca3b9,_0x1983ab){_0x1983ab=_0x1983ab||0x1f4;return function(_0x5c7b47){logger[_0xc1a0('0x24')](_0x5c7b47['stack']);if(_0x5c7b47[_0xc1a0('0x25')]){delete _0x5c7b47[_0xc1a0('0x25')];}_0x5ca3b9[_0xc1a0('0x17')](_0x1983ab)[_0xc1a0('0x26')](_0x5c7b47);};}exports[_0xc1a0('0x27')]=function(_0xda35c8,_0x2fc028){var _0x287587={},_0x282415={},_0x1828f2={'count':0x0,'rows':[]};var _0x28d248=_[_0xc1a0('0x28')](db[_0xc1a0('0x29')][_0xc1a0('0x2a')],function(_0x3e1ec5){return{'name':_0x3e1ec5[_0xc1a0('0x2b')],'type':_0x3e1ec5[_0xc1a0('0x2c')][_0xc1a0('0x2d')]};});_0x282415[_0xc1a0('0x2e')]=_[_0xc1a0('0x28')](_0x28d248,_0xc1a0('0x25'));_0x282415['query']=_[_0xc1a0('0x2f')](_0xda35c8['query']);_0x282415[_0xc1a0('0x30')]=_[_0xc1a0('0x31')](_0x282415[_0xc1a0('0x2e')],_0x282415[_0xc1a0('0x32')]);_0x287587['attributes']=_[_0xc1a0('0x31')](_0x282415[_0xc1a0('0x2e')],qs['fields'](_0xda35c8['query'][_0xc1a0('0x33')]));_0x287587[_0xc1a0('0x34')]=_0x287587[_0xc1a0('0x34')][_0xc1a0('0x35')]?_0x287587['attributes']:_0x282415['model'];if(!_0xda35c8[_0xc1a0('0x32')][_0xc1a0('0x36')]('nolimit')){_0x287587[_0xc1a0('0x1b')]=qs[_0xc1a0('0x1b')](_0xda35c8['query'][_0xc1a0('0x1b')]);_0x287587[_0xc1a0('0x1a')]=qs[_0xc1a0('0x1a')](_0xda35c8['query'][_0xc1a0('0x1a')]);}_0x287587['order']=qs[_0xc1a0('0x37')](_0xda35c8['query'][_0xc1a0('0x37')]);_0x287587['where']=qs[_0xc1a0('0x30')](_[_0xc1a0('0x38')](_0xda35c8[_0xc1a0('0x32')],_0x282415[_0xc1a0('0x30')]),_0x28d248);if(_0xda35c8['query'][_0xc1a0('0x39')]){_0x287587[_0xc1a0('0x3a')]=_[_0xc1a0('0x3b')](_0x287587[_0xc1a0('0x3a')],{'$or':_[_0xc1a0('0x28')](_0x28d248,function(_0x25113f){if(_0x25113f[_0xc1a0('0x2c')]!==_0xc1a0('0x3c')){var _0x1451d8={};_0x1451d8[_0x25113f[_0xc1a0('0x25')]]={'$like':'%'+_0xda35c8[_0xc1a0('0x32')]['filter']+'%'};return _0x1451d8;}})});}_0x287587=_[_0xc1a0('0x3b')]({},_0x287587,_0xda35c8[_0xc1a0('0x3d')]);var _0x1b987e={'where':_0x287587['where']};return db[_0xc1a0('0x29')][_0xc1a0('0x1d')](_0x1b987e)['then'](function(_0x3c8b87){_0x1828f2['count']=_0x3c8b87;if(_0xda35c8[_0xc1a0('0x32')][_0xc1a0('0x3e')]){_0x287587['include']=[{'all':!![]}];}return db[_0xc1a0('0x29')][_0xc1a0('0x3f')](_0x287587);})[_0xc1a0('0x22')](function(_0x571c65){_0x1828f2[_0xc1a0('0x40')]=_0x571c65;return _0x1828f2;})[_0xc1a0('0x22')](respondWithFilteredResult(_0x2fc028,_0x287587))[_0xc1a0('0x41')](handleError(_0x2fc028,null));};exports[_0xc1a0('0x42')]=function(_0x531a28,_0x1b912c){var _0xaeb016={'raw':![],'where':{'id':_0x531a28['params']['id']}},_0x10bc61={};_0x10bc61[_0xc1a0('0x2e')]=_[_0xc1a0('0x2f')](db[_0xc1a0('0x29')][_0xc1a0('0x2a')]);_0x10bc61[_0xc1a0('0x32')]=_[_0xc1a0('0x2f')](_0x531a28['query']);_0x10bc61['filters']=_[_0xc1a0('0x31')](_0x10bc61[_0xc1a0('0x2e')],_0x10bc61['query']);_0xaeb016['attributes']=_[_0xc1a0('0x31')](_0x10bc61[_0xc1a0('0x2e')],qs[_0xc1a0('0x33')](_0x531a28[_0xc1a0('0x32')][_0xc1a0('0x33')]));_0xaeb016[_0xc1a0('0x34')]=_0xaeb016['attributes']['length']?_0xaeb016[_0xc1a0('0x34')]:_0x10bc61['model'];if(_0x531a28[_0xc1a0('0x32')][_0xc1a0('0x3e')]){_0xaeb016[_0xc1a0('0x43')]=[{'all':!![]}];}_0xaeb016=_[_0xc1a0('0x3b')]({},_0xaeb016,_0x531a28[_0xc1a0('0x3d')]);return db[_0xc1a0('0x29')][_0xc1a0('0x44')](_0xaeb016)[_0xc1a0('0x22')](handleEntityNotFound(_0x1b912c,null))['then'](respondWithResult(_0x1b912c,null))[_0xc1a0('0x41')](handleError(_0x1b912c,null));};exports[_0xc1a0('0x45')]=function(_0x5baa72,_0x138c2e){return db[_0xc1a0('0x29')][_0xc1a0('0x45')](_0x5baa72[_0xc1a0('0x46')],{})[_0xc1a0('0x22')](respondWithResult(_0x138c2e,0xc9))['catch'](handleError(_0x138c2e,null));};exports[_0xc1a0('0x47')]=function(_0x42c159,_0x1ec56a){if(_0x42c159['body']['id']){delete _0x42c159['body']['id'];}return db[_0xc1a0('0x29')][_0xc1a0('0x44')]({'where':{'id':_0x42c159[_0xc1a0('0x48')]['id']}})[_0xc1a0('0x22')](handleEntityNotFound(_0x1ec56a,null))[_0xc1a0('0x22')](saveUpdates(_0x42c159['body'],null))[_0xc1a0('0x22')](respondWithResult(_0x1ec56a,null))[_0xc1a0('0x41')](handleError(_0x1ec56a,null));};exports[_0xc1a0('0x21')]=function(_0x34e56e,_0x1b4e61){return db[_0xc1a0('0x29')][_0xc1a0('0x44')]({'where':{'id':_0x34e56e['params']['id']}})[_0xc1a0('0x22')](handleEntityNotFound(_0x1b4e61,null))[_0xc1a0('0x22')](removeEntity(_0x1b4e61,null))[_0xc1a0('0x41')](handleError(_0x1b4e61,null));};exports['getFields']=function(_0x25e764,_0x57d843,_0x4d459b){var _0x13c8ed={};var _0x350edb={};var _0x2b58f5;var _0x4d1728;return db[_0xc1a0('0x29')][_0xc1a0('0x49')]({'where':{'id':_0x25e764['params']['id']}})[_0xc1a0('0x22')](handleEntityNotFound(_0x57d843,null))[_0xc1a0('0x22')](function(_0x37eecc){if(_0x37eecc){_0x2b58f5=_0x37eecc;_0x350edb[_0xc1a0('0x2e')]=_[_0xc1a0('0x2f')](db[_0xc1a0('0x4a')][_0xc1a0('0x2a')]);_0x350edb['query']=_[_0xc1a0('0x2f')](_0x25e764['query']);_0x350edb[_0xc1a0('0x30')]=_[_0xc1a0('0x31')](_0x350edb[_0xc1a0('0x2e')],_0x350edb['query']);_0x13c8ed[_0xc1a0('0x34')]=_[_0xc1a0('0x31')](_0x350edb[_0xc1a0('0x2e')],qs[_0xc1a0('0x33')](_0x25e764[_0xc1a0('0x32')]['fields']));_0x13c8ed[_0xc1a0('0x34')]=_0x13c8ed['attributes']['length']?_0x13c8ed['attributes']:_0x350edb[_0xc1a0('0x2e')];_0x13c8ed[_0xc1a0('0x4b')]=qs[_0xc1a0('0x37')](_0x25e764[_0xc1a0('0x32')][_0xc1a0('0x37')]);_0x13c8ed[_0xc1a0('0x3a')]=qs[_0xc1a0('0x30')](_[_0xc1a0('0x38')](_0x25e764['query'],_0x350edb[_0xc1a0('0x30')]));if(_0x25e764[_0xc1a0('0x32')][_0xc1a0('0x39')]){_0x13c8ed[_0xc1a0('0x3a')]=_[_0xc1a0('0x3b')](_0x13c8ed[_0xc1a0('0x3a')],{'$or':_[_0xc1a0('0x28')](_0x13c8ed[_0xc1a0('0x34')],function(_0xd3cfda){var _0x4d2b87={};_0x4d2b87[_0xd3cfda]={'$like':'%'+_0x25e764[_0xc1a0('0x32')]['filter']+'%'};return _0x4d2b87;})});}_0x13c8ed=_[_0xc1a0('0x3b')]({},_0x13c8ed,_0x25e764[_0xc1a0('0x3d')]);return _0x2b58f5[_0xc1a0('0x4c')](_0x13c8ed);}})['then'](function(_0x2ce3ef){if(_0x2ce3ef){_0x4d1728=_0x2ce3ef[_0xc1a0('0x35')];if(!_0x25e764[_0xc1a0('0x32')][_0xc1a0('0x36')]('nolimit')){_0x13c8ed[_0xc1a0('0x1b')]=qs[_0xc1a0('0x1b')](_0x25e764[_0xc1a0('0x32')][_0xc1a0('0x1b')]);_0x13c8ed[_0xc1a0('0x1a')]=qs['offset'](_0x25e764[_0xc1a0('0x32')]['offset']);}return _0x2b58f5[_0xc1a0('0x4c')](_0x13c8ed);}})[_0xc1a0('0x22')](function(_0x504a9f){if(_0x504a9f){return _0x504a9f?{'count':_0x4d1728,'rows':_0x504a9f}:null;}})[_0xc1a0('0x22')](respondWithResult(_0x57d843,null))[_0xc1a0('0x41')](handleError(_0x57d843,null));};exports[_0xc1a0('0x4d')]=function(_0xe5c3c1,_0x43a963,_0x41354f){var _0x19627f={};var _0x2e74f6={};var _0x7aa10b;var _0x58d47e;return db[_0xc1a0('0x29')][_0xc1a0('0x49')]({'where':{'id':_0xe5c3c1[_0xc1a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x43a963,null))[_0xc1a0('0x22')](function(_0x4c880b){if(_0x4c880b){_0x7aa10b=_0x4c880b;_0x2e74f6['model']=_[_0xc1a0('0x2f')](db[_0xc1a0('0x4a')]['rawAttributes']);_0x2e74f6[_0xc1a0('0x32')]=_[_0xc1a0('0x2f')](_0xe5c3c1[_0xc1a0('0x32')]);_0x2e74f6[_0xc1a0('0x30')]=_[_0xc1a0('0x31')](_0x2e74f6[_0xc1a0('0x2e')],_0x2e74f6[_0xc1a0('0x32')]);_0x19627f[_0xc1a0('0x34')]=_[_0xc1a0('0x31')](_0x2e74f6[_0xc1a0('0x2e')],qs['fields'](_0xe5c3c1[_0xc1a0('0x32')][_0xc1a0('0x33')]));_0x19627f[_0xc1a0('0x34')]=_0x19627f[_0xc1a0('0x34')][_0xc1a0('0x35')]?_0x19627f[_0xc1a0('0x34')]:_0x2e74f6[_0xc1a0('0x2e')];_0x19627f['order']=qs[_0xc1a0('0x37')](_0xe5c3c1[_0xc1a0('0x32')][_0xc1a0('0x37')]);_0x19627f[_0xc1a0('0x3a')]=qs[_0xc1a0('0x30')](_[_0xc1a0('0x38')](_0xe5c3c1['query'],_0x2e74f6['filters']));if(_0xe5c3c1[_0xc1a0('0x32')][_0xc1a0('0x39')]){_0x19627f[_0xc1a0('0x3a')]=_[_0xc1a0('0x3b')](_0x19627f[_0xc1a0('0x3a')],{'$or':_[_0xc1a0('0x28')](_0x19627f[_0xc1a0('0x34')],function(_0x5a91b2){var _0x31b969={};_0x31b969[_0x5a91b2]={'$like':'%'+_0xe5c3c1[_0xc1a0('0x32')][_0xc1a0('0x39')]+'%'};return _0x31b969;})});}_0x19627f=_[_0xc1a0('0x3b')]({},_0x19627f,_0xe5c3c1[_0xc1a0('0x3d')]);return _0x7aa10b['getSubjects'](_0x19627f);}})[_0xc1a0('0x22')](function(_0x29f0ab){if(_0x29f0ab){_0x58d47e=_0x29f0ab[_0xc1a0('0x35')];if(!_0xe5c3c1[_0xc1a0('0x32')][_0xc1a0('0x36')]('nolimit')){_0x19627f[_0xc1a0('0x1b')]=qs[_0xc1a0('0x1b')](_0xe5c3c1[_0xc1a0('0x32')]['limit']);_0x19627f[_0xc1a0('0x1a')]=qs[_0xc1a0('0x1a')](_0xe5c3c1[_0xc1a0('0x32')][_0xc1a0('0x1a')]);}return _0x7aa10b[_0xc1a0('0x4d')](_0x19627f);}})[_0xc1a0('0x22')](function(_0xc894fe){if(_0xc894fe){return _0xc894fe?{'count':_0x58d47e,'rows':_0xc894fe}:null;}})[_0xc1a0('0x22')](respondWithResult(_0x43a963,null))[_0xc1a0('0x41')](handleError(_0x43a963,null));};exports[_0xc1a0('0x4e')]=function(_0x4089a3,_0x3271e7,_0x456967){var _0x475b92={};var _0x403c37={};var _0x2c650b;var _0x544daf;return db[_0xc1a0('0x29')][_0xc1a0('0x49')]({'where':{'id':_0x4089a3['params']['id']}})[_0xc1a0('0x22')](handleEntityNotFound(_0x3271e7,null))[_0xc1a0('0x22')](function(_0x15e8df){if(_0x15e8df){_0x2c650b=_0x15e8df;_0x403c37[_0xc1a0('0x2e')]=_[_0xc1a0('0x2f')](db[_0xc1a0('0x4a')]['rawAttributes']);_0x403c37['query']=_[_0xc1a0('0x2f')](_0x4089a3[_0xc1a0('0x32')]);_0x403c37['filters']=_[_0xc1a0('0x31')](_0x403c37[_0xc1a0('0x2e')],_0x403c37[_0xc1a0('0x32')]);_0x475b92[_0xc1a0('0x34')]=_[_0xc1a0('0x31')](_0x403c37['model'],qs[_0xc1a0('0x33')](_0x4089a3['query'][_0xc1a0('0x33')]));_0x475b92[_0xc1a0('0x34')]=_0x475b92[_0xc1a0('0x34')][_0xc1a0('0x35')]?_0x475b92[_0xc1a0('0x34')]:_0x403c37[_0xc1a0('0x2e')];_0x475b92[_0xc1a0('0x4b')]=qs['sort'](_0x4089a3['query'][_0xc1a0('0x37')]);_0x475b92[_0xc1a0('0x3a')]=qs[_0xc1a0('0x30')](_[_0xc1a0('0x38')](_0x4089a3[_0xc1a0('0x32')],_0x403c37[_0xc1a0('0x30')]));if(_0x4089a3[_0xc1a0('0x32')][_0xc1a0('0x39')]){_0x475b92[_0xc1a0('0x3a')]=_[_0xc1a0('0x3b')](_0x475b92[_0xc1a0('0x3a')],{'$or':_[_0xc1a0('0x28')](_0x475b92[_0xc1a0('0x34')],function(_0x30a574){var _0xcb8e1b={};_0xcb8e1b[_0x30a574]={'$like':'%'+_0x4089a3[_0xc1a0('0x32')]['filter']+'%'};return _0xcb8e1b;})});}_0x475b92=_[_0xc1a0('0x3b')]({},_0x475b92,_0x4089a3[_0xc1a0('0x3d')]);return _0x2c650b[_0xc1a0('0x4e')](_0x475b92);}})['then'](function(_0x3dc757){if(_0x3dc757){_0x544daf=_0x3dc757[_0xc1a0('0x35')];if(!_0x4089a3[_0xc1a0('0x32')][_0xc1a0('0x36')](_0xc1a0('0x4f'))){_0x475b92[_0xc1a0('0x1b')]=qs['limit'](_0x4089a3['query'][_0xc1a0('0x1b')]);_0x475b92[_0xc1a0('0x1a')]=qs[_0xc1a0('0x1a')](_0x4089a3[_0xc1a0('0x32')]['offset']);}return _0x2c650b[_0xc1a0('0x4e')](_0x475b92);}})['then'](function(_0xe371c2){if(_0xe371c2){return _0xe371c2?{'count':_0x544daf,'rows':_0xe371c2}:null;}})[_0xc1a0('0x22')](respondWithResult(_0x3271e7,null))['catch'](handleError(_0x3271e7,null));}; \ No newline at end of file +var _0xa9f8=['save','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoConfiguration','includeAll','include','findAll','then','catch','show','params','rawAttributes','length','find','body','update','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xa9f8,0xd6));var _0x8a9f=function(_0x49c09f,_0x55a820){_0x49c09f=_0x49c09f-0x0;var _0xdc3087=_0xa9f8[_0x49c09f];return _0xdc3087;};'use strict';var emlformat=require(_0x8a9f('0x0'));var rimraf=require(_0x8a9f('0x1'));var zipdir=require(_0x8a9f('0x2'));var jsonpatch=require(_0x8a9f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a9f('0x4'));var Mustache=require('mustache');var util=require(_0x8a9f('0x5'));var path=require(_0x8a9f('0x6'));var sox=require(_0x8a9f('0x7'));var csv=require('to-csv');var ejs=require(_0x8a9f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8a9f('0x9'));var crypto=require(_0x8a9f('0xa'));var jsforce=require(_0x8a9f('0xb'));var deskjs=require(_0x8a9f('0xc'));var toCsv=require(_0x8a9f('0xd'));var querystring=require(_0x8a9f('0xe'));var Papa=require(_0x8a9f('0xf'));var Redis=require(_0x8a9f('0x10'));var authService=require(_0x8a9f('0x11'));var qs=require(_0x8a9f('0x12'));var as=require(_0x8a9f('0x13'));var hardwareService=require(_0x8a9f('0x14'));var logger=require(_0x8a9f('0x15'))(_0x8a9f('0x16'));var utils=require(_0x8a9f('0x17'));var config=require(_0x8a9f('0x18'));var licenseUtil=require(_0x8a9f('0x19'));var db=require(_0x8a9f('0x1a'))['db'];function respondWithStatusCode(_0x5d259a,_0x1cb284){_0x1cb284=_0x1cb284||0xcc;return function(_0x4b9c80){if(_0x4b9c80){return _0x5d259a[_0x8a9f('0x1b')](_0x1cb284);}return _0x5d259a[_0x8a9f('0x1c')](_0x1cb284)['end']();};}function respondWithResult(_0x5897ea,_0x4e0cc2){_0x4e0cc2=_0x4e0cc2||0xc8;return function(_0x1e0f9d){if(_0x1e0f9d){return _0x5897ea[_0x8a9f('0x1c')](_0x4e0cc2)['json'](_0x1e0f9d);}};}function respondWithFilteredResult(_0x533494,_0x102225){return function(_0x22dec5){if(_0x22dec5){var _0x2c7291=typeof _0x102225['offset']===_0x8a9f('0x1d')&&typeof _0x102225[_0x8a9f('0x1e')]===_0x8a9f('0x1d');var _0x491be8=_0x22dec5[_0x8a9f('0x1f')];var _0x3a0e36=_0x2c7291?0x0:_0x102225[_0x8a9f('0x20')];var _0x201d73=_0x2c7291?_0x22dec5[_0x8a9f('0x1f')]:_0x102225[_0x8a9f('0x20')]+_0x102225[_0x8a9f('0x1e')];var _0x58defc;if(_0x201d73>=_0x491be8){_0x201d73=_0x491be8;_0x58defc=0xc8;}else{_0x58defc=0xce;}_0x533494[_0x8a9f('0x1c')](_0x58defc);return _0x533494[_0x8a9f('0x21')](_0x8a9f('0x22'),_0x3a0e36+'-'+_0x201d73+'/'+_0x491be8)[_0x8a9f('0x23')](_0x22dec5);}return null;};}function patchUpdates(_0x1d53f8){return function(_0x181224){try{jsonpatch[_0x8a9f('0x24')](_0x181224,_0x1d53f8,!![]);}catch(_0x2afedd){return BPromise[_0x8a9f('0x25')](_0x2afedd);}return _0x181224[_0x8a9f('0x26')]();};}function saveUpdates(_0xba7f9e,_0xb29389){return function(_0x26e2dd){if(_0x26e2dd){return _0x26e2dd['update'](_0xba7f9e)['then'](function(_0xcd9ee5){return _0xcd9ee5;});}return null;};}function removeEntity(_0x135e6b,_0x328b03){return function(_0x27eea2){if(_0x27eea2){return _0x27eea2[_0x8a9f('0x27')]()['then'](function(){_0x135e6b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x271ba3,_0x3aff2a){return function(_0x1a728f){if(!_0x1a728f){_0x271ba3[_0x8a9f('0x1b')](0x194);}return _0x1a728f;};}function handleError(_0x4a5a61,_0x1feadf){_0x1feadf=_0x1feadf||0x1f4;return function(_0x32f84a){logger[_0x8a9f('0x28')](_0x32f84a[_0x8a9f('0x29')]);if(_0x32f84a[_0x8a9f('0x2a')]){delete _0x32f84a[_0x8a9f('0x2a')];}_0x4a5a61['status'](_0x1feadf)[_0x8a9f('0x2b')](_0x32f84a);};}exports[_0x8a9f('0x2c')]=function(_0xd96a89,_0x3e1608){var _0x31529f={},_0x50b4e7={},_0x1c91d2={'count':0x0,'rows':[]};var _0x4a1fdd=_[_0x8a9f('0x2d')](db['ZohoConfiguration']['rawAttributes'],function(_0x276265){return{'name':_0x276265[_0x8a9f('0x2e')],'type':_0x276265[_0x8a9f('0x2f')][_0x8a9f('0x30')]};});_0x50b4e7[_0x8a9f('0x31')]=_[_0x8a9f('0x2d')](_0x4a1fdd,'name');_0x50b4e7[_0x8a9f('0x32')]=_[_0x8a9f('0x33')](_0xd96a89['query']);_0x50b4e7[_0x8a9f('0x34')]=_[_0x8a9f('0x35')](_0x50b4e7[_0x8a9f('0x31')],_0x50b4e7['query']);_0x31529f[_0x8a9f('0x36')]=_[_0x8a9f('0x35')](_0x50b4e7['model'],qs[_0x8a9f('0x37')](_0xd96a89[_0x8a9f('0x32')]['fields']));_0x31529f[_0x8a9f('0x36')]=_0x31529f[_0x8a9f('0x36')]['length']?_0x31529f[_0x8a9f('0x36')]:_0x50b4e7[_0x8a9f('0x31')];if(!_0xd96a89['query'][_0x8a9f('0x38')](_0x8a9f('0x39'))){_0x31529f[_0x8a9f('0x1e')]=qs[_0x8a9f('0x1e')](_0xd96a89[_0x8a9f('0x32')][_0x8a9f('0x1e')]);_0x31529f[_0x8a9f('0x20')]=qs[_0x8a9f('0x20')](_0xd96a89['query'][_0x8a9f('0x20')]);}_0x31529f[_0x8a9f('0x3a')]=qs[_0x8a9f('0x3b')](_0xd96a89[_0x8a9f('0x32')][_0x8a9f('0x3b')]);_0x31529f[_0x8a9f('0x3c')]=qs[_0x8a9f('0x34')](_[_0x8a9f('0x3d')](_0xd96a89[_0x8a9f('0x32')],_0x50b4e7['filters']),_0x4a1fdd);if(_0xd96a89[_0x8a9f('0x32')][_0x8a9f('0x3e')]){_0x31529f[_0x8a9f('0x3c')]=_[_0x8a9f('0x3f')](_0x31529f['where'],{'$or':_[_0x8a9f('0x2d')](_0x4a1fdd,function(_0x251448){if(_0x251448['type']!==_0x8a9f('0x40')){var _0x3bf7cc={};_0x3bf7cc[_0x251448[_0x8a9f('0x2a')]]={'$like':'%'+_0xd96a89[_0x8a9f('0x32')][_0x8a9f('0x3e')]+'%'};return _0x3bf7cc;}})});}_0x31529f=_['merge']({},_0x31529f,_0xd96a89[_0x8a9f('0x41')]);var _0x5bcf16={'where':_0x31529f[_0x8a9f('0x3c')]};return db[_0x8a9f('0x42')][_0x8a9f('0x1f')](_0x5bcf16)['then'](function(_0x1fb6b2){_0x1c91d2[_0x8a9f('0x1f')]=_0x1fb6b2;if(_0xd96a89[_0x8a9f('0x32')][_0x8a9f('0x43')]){_0x31529f[_0x8a9f('0x44')]=[{'all':!![]}];}return db[_0x8a9f('0x42')][_0x8a9f('0x45')](_0x31529f);})[_0x8a9f('0x46')](function(_0x1e94bc){_0x1c91d2['rows']=_0x1e94bc;return _0x1c91d2;})['then'](respondWithFilteredResult(_0x3e1608,_0x31529f))[_0x8a9f('0x47')](handleError(_0x3e1608,null));};exports[_0x8a9f('0x48')]=function(_0x55c883,_0xc84327){var _0x11233e={'raw':![],'where':{'id':_0x55c883[_0x8a9f('0x49')]['id']}},_0x3d6df3={};_0x3d6df3[_0x8a9f('0x31')]=_[_0x8a9f('0x33')](db['ZohoConfiguration'][_0x8a9f('0x4a')]);_0x3d6df3['query']=_[_0x8a9f('0x33')](_0x55c883['query']);_0x3d6df3[_0x8a9f('0x34')]=_['intersection'](_0x3d6df3[_0x8a9f('0x31')],_0x3d6df3['query']);_0x11233e[_0x8a9f('0x36')]=_[_0x8a9f('0x35')](_0x3d6df3[_0x8a9f('0x31')],qs[_0x8a9f('0x37')](_0x55c883[_0x8a9f('0x32')][_0x8a9f('0x37')]));_0x11233e[_0x8a9f('0x36')]=_0x11233e['attributes'][_0x8a9f('0x4b')]?_0x11233e['attributes']:_0x3d6df3[_0x8a9f('0x31')];if(_0x55c883['query'][_0x8a9f('0x43')]){_0x11233e[_0x8a9f('0x44')]=[{'all':!![]}];}_0x11233e=_[_0x8a9f('0x3f')]({},_0x11233e,_0x55c883[_0x8a9f('0x41')]);return db[_0x8a9f('0x42')][_0x8a9f('0x4c')](_0x11233e)[_0x8a9f('0x46')](handleEntityNotFound(_0xc84327,null))['then'](respondWithResult(_0xc84327,null))[_0x8a9f('0x47')](handleError(_0xc84327,null));};exports['create']=function(_0x3cfbc1,_0x1f28dd){return db[_0x8a9f('0x42')]['create'](_0x3cfbc1[_0x8a9f('0x4d')],{})[_0x8a9f('0x46')](respondWithResult(_0x1f28dd,0xc9))['catch'](handleError(_0x1f28dd,null));};exports[_0x8a9f('0x4e')]=function(_0x56f47b,_0x4b906d){if(_0x56f47b[_0x8a9f('0x4d')]['id']){delete _0x56f47b[_0x8a9f('0x4d')]['id'];}return db[_0x8a9f('0x42')][_0x8a9f('0x4c')]({'where':{'id':_0x56f47b[_0x8a9f('0x49')]['id']}})[_0x8a9f('0x46')](handleEntityNotFound(_0x4b906d,null))[_0x8a9f('0x46')](saveUpdates(_0x56f47b[_0x8a9f('0x4d')],null))['then'](respondWithResult(_0x4b906d,null))[_0x8a9f('0x47')](handleError(_0x4b906d,null));};exports[_0x8a9f('0x27')]=function(_0x3d5a50,_0x44fc8b){return db['ZohoConfiguration'][_0x8a9f('0x4c')]({'where':{'id':_0x3d5a50[_0x8a9f('0x49')]['id']}})[_0x8a9f('0x46')](handleEntityNotFound(_0x44fc8b,null))['then'](removeEntity(_0x44fc8b,null))[_0x8a9f('0x47')](handleError(_0x44fc8b,null));};exports[_0x8a9f('0x4f')]=function(_0x12c9bf,_0x1fa6e4,_0x5db225){var _0x237305={};var _0x409178={};var _0x26987b;var _0x4fba27;return db[_0x8a9f('0x42')][_0x8a9f('0x50')]({'where':{'id':_0x12c9bf[_0x8a9f('0x49')]['id']}})['then'](handleEntityNotFound(_0x1fa6e4,null))[_0x8a9f('0x46')](function(_0x46f3ca){if(_0x46f3ca){_0x26987b=_0x46f3ca;_0x409178[_0x8a9f('0x31')]=_[_0x8a9f('0x33')](db[_0x8a9f('0x51')]['rawAttributes']);_0x409178['query']=_['keys'](_0x12c9bf[_0x8a9f('0x32')]);_0x409178['filters']=_[_0x8a9f('0x35')](_0x409178[_0x8a9f('0x31')],_0x409178[_0x8a9f('0x32')]);_0x237305['attributes']=_[_0x8a9f('0x35')](_0x409178[_0x8a9f('0x31')],qs[_0x8a9f('0x37')](_0x12c9bf[_0x8a9f('0x32')]['fields']));_0x237305[_0x8a9f('0x36')]=_0x237305['attributes'][_0x8a9f('0x4b')]?_0x237305[_0x8a9f('0x36')]:_0x409178['model'];_0x237305[_0x8a9f('0x3a')]=qs[_0x8a9f('0x3b')](_0x12c9bf[_0x8a9f('0x32')][_0x8a9f('0x3b')]);_0x237305[_0x8a9f('0x3c')]=qs[_0x8a9f('0x34')](_[_0x8a9f('0x3d')](_0x12c9bf[_0x8a9f('0x32')],_0x409178[_0x8a9f('0x34')]));if(_0x12c9bf[_0x8a9f('0x32')]['filter']){_0x237305[_0x8a9f('0x3c')]=_[_0x8a9f('0x3f')](_0x237305[_0x8a9f('0x3c')],{'$or':_[_0x8a9f('0x2d')](_0x237305[_0x8a9f('0x36')],function(_0x569efc){var _0xb51c3f={};_0xb51c3f[_0x569efc]={'$like':'%'+_0x12c9bf[_0x8a9f('0x32')][_0x8a9f('0x3e')]+'%'};return _0xb51c3f;})});}_0x237305=_[_0x8a9f('0x3f')]({},_0x237305,_0x12c9bf[_0x8a9f('0x41')]);return _0x26987b[_0x8a9f('0x4f')](_0x237305);}})[_0x8a9f('0x46')](function(_0x5adf73){if(_0x5adf73){_0x4fba27=_0x5adf73[_0x8a9f('0x4b')];if(!_0x12c9bf['query'][_0x8a9f('0x38')]('nolimit')){_0x237305[_0x8a9f('0x1e')]=qs['limit'](_0x12c9bf['query'][_0x8a9f('0x1e')]);_0x237305[_0x8a9f('0x20')]=qs[_0x8a9f('0x20')](_0x12c9bf[_0x8a9f('0x32')]['offset']);}return _0x26987b['getFields'](_0x237305);}})[_0x8a9f('0x46')](function(_0x51d570){if(_0x51d570){return _0x51d570?{'count':_0x4fba27,'rows':_0x51d570}:null;}})['then'](respondWithResult(_0x1fa6e4,null))['catch'](handleError(_0x1fa6e4,null));};exports[_0x8a9f('0x52')]=function(_0x353a3d,_0x10dd41,_0x3cdcfe){var _0x59d24b={};var _0x2ac7c8={};var _0x33e49f;var _0x2752c4;return db[_0x8a9f('0x42')][_0x8a9f('0x50')]({'where':{'id':_0x353a3d[_0x8a9f('0x49')]['id']}})[_0x8a9f('0x46')](handleEntityNotFound(_0x10dd41,null))[_0x8a9f('0x46')](function(_0x44e570){if(_0x44e570){_0x33e49f=_0x44e570;_0x2ac7c8[_0x8a9f('0x31')]=_[_0x8a9f('0x33')](db[_0x8a9f('0x51')][_0x8a9f('0x4a')]);_0x2ac7c8['query']=_[_0x8a9f('0x33')](_0x353a3d[_0x8a9f('0x32')]);_0x2ac7c8[_0x8a9f('0x34')]=_[_0x8a9f('0x35')](_0x2ac7c8[_0x8a9f('0x31')],_0x2ac7c8[_0x8a9f('0x32')]);_0x59d24b[_0x8a9f('0x36')]=_['intersection'](_0x2ac7c8[_0x8a9f('0x31')],qs['fields'](_0x353a3d[_0x8a9f('0x32')][_0x8a9f('0x37')]));_0x59d24b['attributes']=_0x59d24b[_0x8a9f('0x36')][_0x8a9f('0x4b')]?_0x59d24b['attributes']:_0x2ac7c8[_0x8a9f('0x31')];_0x59d24b[_0x8a9f('0x3a')]=qs['sort'](_0x353a3d[_0x8a9f('0x32')]['sort']);_0x59d24b['where']=qs[_0x8a9f('0x34')](_[_0x8a9f('0x3d')](_0x353a3d['query'],_0x2ac7c8[_0x8a9f('0x34')]));if(_0x353a3d[_0x8a9f('0x32')][_0x8a9f('0x3e')]){_0x59d24b[_0x8a9f('0x3c')]=_[_0x8a9f('0x3f')](_0x59d24b['where'],{'$or':_['map'](_0x59d24b[_0x8a9f('0x36')],function(_0x503c69){var _0x2e1af6={};_0x2e1af6[_0x503c69]={'$like':'%'+_0x353a3d['query'][_0x8a9f('0x3e')]+'%'};return _0x2e1af6;})});}_0x59d24b=_[_0x8a9f('0x3f')]({},_0x59d24b,_0x353a3d['options']);return _0x33e49f[_0x8a9f('0x52')](_0x59d24b);}})[_0x8a9f('0x46')](function(_0x172659){if(_0x172659){_0x2752c4=_0x172659[_0x8a9f('0x4b')];if(!_0x353a3d[_0x8a9f('0x32')][_0x8a9f('0x38')](_0x8a9f('0x39'))){_0x59d24b[_0x8a9f('0x1e')]=qs['limit'](_0x353a3d['query'][_0x8a9f('0x1e')]);_0x59d24b['offset']=qs['offset'](_0x353a3d[_0x8a9f('0x32')][_0x8a9f('0x20')]);}return _0x33e49f['getSubjects'](_0x59d24b);}})['then'](function(_0x584703){if(_0x584703){return _0x584703?{'count':_0x2752c4,'rows':_0x584703}:null;}})[_0x8a9f('0x46')](respondWithResult(_0x10dd41,null))[_0x8a9f('0x47')](handleError(_0x10dd41,null));};exports[_0x8a9f('0x53')]=function(_0x15edd8,_0x165333,_0x295ef7){var _0x224e52={};var _0xefbba={};var _0x4fd2a3;var _0x378784;return db[_0x8a9f('0x42')][_0x8a9f('0x50')]({'where':{'id':_0x15edd8[_0x8a9f('0x49')]['id']}})[_0x8a9f('0x46')](handleEntityNotFound(_0x165333,null))[_0x8a9f('0x46')](function(_0x269e44){if(_0x269e44){_0x4fd2a3=_0x269e44;_0xefbba['model']=_[_0x8a9f('0x33')](db[_0x8a9f('0x51')][_0x8a9f('0x4a')]);_0xefbba[_0x8a9f('0x32')]=_[_0x8a9f('0x33')](_0x15edd8[_0x8a9f('0x32')]);_0xefbba[_0x8a9f('0x34')]=_['intersection'](_0xefbba[_0x8a9f('0x31')],_0xefbba[_0x8a9f('0x32')]);_0x224e52[_0x8a9f('0x36')]=_['intersection'](_0xefbba[_0x8a9f('0x31')],qs[_0x8a9f('0x37')](_0x15edd8[_0x8a9f('0x32')][_0x8a9f('0x37')]));_0x224e52[_0x8a9f('0x36')]=_0x224e52[_0x8a9f('0x36')][_0x8a9f('0x4b')]?_0x224e52[_0x8a9f('0x36')]:_0xefbba['model'];_0x224e52['order']=qs[_0x8a9f('0x3b')](_0x15edd8['query'][_0x8a9f('0x3b')]);_0x224e52[_0x8a9f('0x3c')]=qs['filters'](_[_0x8a9f('0x3d')](_0x15edd8[_0x8a9f('0x32')],_0xefbba[_0x8a9f('0x34')]));if(_0x15edd8[_0x8a9f('0x32')]['filter']){_0x224e52[_0x8a9f('0x3c')]=_['merge'](_0x224e52['where'],{'$or':_[_0x8a9f('0x2d')](_0x224e52[_0x8a9f('0x36')],function(_0x4c143c){var _0x37ba92={};_0x37ba92[_0x4c143c]={'$like':'%'+_0x15edd8[_0x8a9f('0x32')][_0x8a9f('0x3e')]+'%'};return _0x37ba92;})});}_0x224e52=_[_0x8a9f('0x3f')]({},_0x224e52,_0x15edd8['options']);return _0x4fd2a3[_0x8a9f('0x53')](_0x224e52);}})[_0x8a9f('0x46')](function(_0x4ca884){if(_0x4ca884){_0x378784=_0x4ca884[_0x8a9f('0x4b')];if(!_0x15edd8[_0x8a9f('0x32')]['hasOwnProperty']('nolimit')){_0x224e52[_0x8a9f('0x1e')]=qs[_0x8a9f('0x1e')](_0x15edd8['query']['limit']);_0x224e52['offset']=qs[_0x8a9f('0x20')](_0x15edd8['query']['offset']);}return _0x4fd2a3['getDescriptions'](_0x224e52);}})[_0x8a9f('0x46')](function(_0x474528){if(_0x474528){return _0x474528?{'count':_0x378784,'rows':_0x474528}:null;}})[_0x8a9f('0x46')](respondWithResult(_0x165333,null))[_0x8a9f('0x47')](handleError(_0x165333,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 629761a..2b42766 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 _0xbf42=['ZohoConfiguration','int_zoho_configurations','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5738f7,_0x17df47){var _0x2e6d3c=function(_0x5c9b13){while(--_0x5c9b13){_0x5738f7['push'](_0x5738f7['shift']());}};_0x2e6d3c(++_0x17df47);}(_0xbf42,0xd3));var _0x2bf4=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xbf42[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2bf4('0x0'))('api');var moment=require(_0x2bf4('0x1'));var BPromise=require(_0x2bf4('0x2'));var rp=require(_0x2bf4('0x3'));var fs=require('fs');var path=require(_0x2bf4('0x4'));var rimraf=require(_0x2bf4('0x5'));var config=require(_0x2bf4('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x2bf4('0x7')]=function(_0x589a36,_0x2574b5){return _0x589a36[_0x2bf4('0x8')](_0x2bf4('0x9'),attributes,{'tableName':_0x2bf4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b7f=['int_zoho_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x5a7d02,_0x303ba9){var _0x5ab59c=function(_0x39d02e){while(--_0x39d02e){_0x5a7d02['push'](_0x5a7d02['shift']());}};_0x5ab59c(++_0x303ba9);}(_0x3b7f,0x12c));var _0xf3b7=function(_0xd46cb7,_0x56cb1d){_0xd46cb7=_0xd46cb7-0x0;var _0x3ff79b=_0x3b7f[_0xd46cb7];return _0x3ff79b;};'use strict';var _=require('lodash');var util=require(_0xf3b7('0x0'));var logger=require(_0xf3b7('0x1'))(_0xf3b7('0x2'));var moment=require(_0xf3b7('0x3'));var BPromise=require(_0xf3b7('0x4'));var rp=require(_0xf3b7('0x5'));var fs=require('fs');var path=require(_0xf3b7('0x6'));var rimraf=require('rimraf');var config=require(_0xf3b7('0x7'));var attributes=require(_0xf3b7('0x8'));module[_0xf3b7('0x9')]=function(_0x3ec2c4,_0x5a26fe){return _0x3ec2c4[_0xf3b7('0xa')](_0xf3b7('0xb'),attributes,{'tableName':_0xf3b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 6e53d54..e25fef0 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 _0x607d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util'];(function(_0x553145,_0x4f9ab8){var _0x11cfbd=function(_0x2e7702){while(--_0x2e7702){_0x553145['push'](_0x553145['shift']());}};_0x11cfbd(++_0x4f9ab8);}(_0x607d,0x89));var _0xd607=function(_0x451df2,_0x17991f){_0x451df2=_0x451df2-0x0;var _0x1f7bba=_0x607d[_0x451df2];return _0x1f7bba;};'use strict';var _=require('lodash');var util=require(_0xd607('0x0'));var moment=require(_0xd607('0x1'));var BPromise=require(_0xd607('0x2'));var rs=require(_0xd607('0x3'));var fs=require('fs');var Redis=require(_0xd607('0x4'));var db=require(_0xd607('0x5'))['db'];var utils=require(_0xd607('0x6'));var logger=require('../../config/logger')(_0xd607('0x7'));var config=require(_0xd607('0x8'));var jayson=require(_0xd607('0x9'));var client=jayson[_0xd607('0xa')][_0xd607('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aed75,_0x3ac8c3,_0x3197ae){return new BPromise(function(_0x308fe0,_0x3bc226){return client[_0xd607('0xc')](_0x5aed75,_0x3197ae)[_0xd607('0xd')](function(_0x331d4a){logger['info'](_0xd607('0xe'),_0x3ac8c3,_0xd607('0xf'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3ac8c3,_0xd607('0xf'),JSON[_0xd607('0x10')](_0x331d4a));if(_0x331d4a[_0xd607('0x11')]){if(_0x331d4a[_0xd607('0x11')][_0xd607('0x12')]===0x1f4){logger['error'](_0xd607('0xe'),_0x3ac8c3,_0x331d4a[_0xd607('0x11')]['message']);return _0x3bc226(_0x331d4a['error'][_0xd607('0x13')]);}logger[_0xd607('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x3ac8c3,_0x331d4a[_0xd607('0x11')][_0xd607('0x13')]);return _0x308fe0(_0x331d4a[_0xd607('0x11')][_0xd607('0x13')]);}else{logger[_0xd607('0x14')](_0xd607('0xe'),_0x3ac8c3,_0xd607('0xf'));_0x308fe0(_0x331d4a[_0xd607('0x15')]['message']);}})[_0xd607('0x16')](function(_0xe1f819){logger['error'](_0xd607('0xe'),_0x3ac8c3,_0xe1f819);_0x3bc226(_0xe1f819);});});} \ No newline at end of file +var _0x2655=['rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','ZohoConfiguration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1d6b4c,_0x43dd55){var _0x579008=function(_0x15df76){while(--_0x15df76){_0x1d6b4c['push'](_0x1d6b4c['shift']());}};_0x579008(++_0x43dd55);}(_0x2655,0xcf));var _0x5265=function(_0x155b66,_0x5e83dc){_0x155b66=_0x155b66-0x0;var _0x54067d=_0x2655[_0x155b66];return _0x54067d;};'use strict';var _=require(_0x5265('0x0'));var util=require(_0x5265('0x1'));var moment=require(_0x5265('0x2'));var BPromise=require(_0x5265('0x3'));var rs=require(_0x5265('0x4'));var fs=require('fs');var Redis=require(_0x5265('0x5'));var db=require(_0x5265('0x6'))['db'];var utils=require(_0x5265('0x7'));var logger=require(_0x5265('0x8'))(_0x5265('0x9'));var config=require('../../config/environment');var jayson=require(_0x5265('0xa'));var client=jayson[_0x5265('0xb')][_0x5265('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34f58b,_0x16c27d,_0x5084a5){return new BPromise(function(_0x5662ed,_0x27e31d){return client[_0x5265('0xd')](_0x34f58b,_0x5084a5)[_0x5265('0xe')](function(_0x14677c){logger[_0x5265('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x16c27d,_0x5265('0x10'));logger[_0x5265('0x11')](_0x5265('0x12'),_0x16c27d,_0x5265('0x10'),JSON[_0x5265('0x13')](_0x14677c));if(_0x14677c['error']){if(_0x14677c['error'][_0x5265('0x14')]===0x1f4){logger[_0x5265('0x15')](_0x5265('0x16'),_0x16c27d,_0x14677c[_0x5265('0x15')][_0x5265('0x17')]);return _0x27e31d(_0x14677c[_0x5265('0x15')]['message']);}logger[_0x5265('0x15')](_0x5265('0x16'),_0x16c27d,_0x14677c[_0x5265('0x15')][_0x5265('0x17')]);return _0x5662ed(_0x14677c[_0x5265('0x15')][_0x5265('0x17')]);}else{logger[_0x5265('0xf')](_0x5265('0x16'),_0x16c27d,'request\x20sent');_0x5662ed(_0x14677c['result'][_0x5265('0x17')]);}})['catch'](function(_0x5c8d38){logger[_0x5265('0x15')](_0x5265('0x16'),_0x16c27d,_0x5c8d38);_0x27e31d(_0x5c8d38);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index a11f32c..04b353b 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 _0x33c8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path'];(function(_0x1b7f41,_0x4889f4){var _0x1dc8e1=function(_0x150489){while(--_0x150489){_0x1b7f41['push'](_0x1b7f41['shift']());}};_0x1dc8e1(++_0x4889f4);}(_0x33c8,0xc6));var _0x833c=function(_0x32ff46,_0x3c4dbc){_0x32ff46=_0x32ff46-0x0;var _0x47f1c4=_0x33c8[_0x32ff46];return _0x47f1c4;};'use strict';var multer=require(_0x833c('0x0'));var util=require('util');var path=require(_0x833c('0x1'));var timeout=require(_0x833c('0x2'));var express=require(_0x833c('0x3'));var router=express[_0x833c('0x4')]();var fs_extra=require(_0x833c('0x5'));var auth=require(_0x833c('0x6'));var interaction=require(_0x833c('0x7'));var config=require(_0x833c('0x8'));var controller=require('./intZohoField.controller');router[_0x833c('0x9')]('/',auth[_0x833c('0xa')](),controller[_0x833c('0xb')]);router['get'](_0x833c('0xc'),auth[_0x833c('0xa')](),controller[_0x833c('0xd')]);router[_0x833c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x833c('0xf')]('/:id',auth[_0x833c('0xa')](),controller[_0x833c('0x10')]);router[_0x833c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x833c('0x12')]);module[_0x833c('0x13')]=router; \ No newline at end of file +var _0xee46=['show','post','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x58381c,_0x3b9374){var _0x1a7440=function(_0x2bc7f1){while(--_0x2bc7f1){_0x58381c['push'](_0x58381c['shift']());}};_0x1a7440(++_0x3b9374);}(_0xee46,0x7f));var _0x6ee4=function(_0x4abb08,_0x5be986){_0x4abb08=_0x4abb08-0x0;var _0x2888b0=_0xee46[_0x4abb08];return _0x2888b0;};'use strict';var multer=require(_0x6ee4('0x0'));var util=require(_0x6ee4('0x1'));var path=require(_0x6ee4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ee4('0x3')]();var fs_extra=require(_0x6ee4('0x4'));var auth=require(_0x6ee4('0x5'));var interaction=require(_0x6ee4('0x6'));var config=require(_0x6ee4('0x7'));var controller=require(_0x6ee4('0x8'));router[_0x6ee4('0x9')]('/',auth[_0x6ee4('0xa')](),controller[_0x6ee4('0xb')]);router[_0x6ee4('0x9')](_0x6ee4('0xc'),auth[_0x6ee4('0xa')](),controller[_0x6ee4('0xd')]);router[_0x6ee4('0xe')]('/',auth[_0x6ee4('0xa')](),controller['create']);router[_0x6ee4('0xf')](_0x6ee4('0xc'),auth['isAuthenticated'](),controller[_0x6ee4('0x10')]);router[_0x6ee4('0x11')](_0x6ee4('0xc'),auth[_0x6ee4('0xa')](),controller[_0x6ee4('0x12')]);module[_0x6ee4('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 46918a7..0522b6b 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 _0x583e=['customVariable','sequelize','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x3ce025,_0x1bbd23){var _0x19206a=function(_0x9ec5b2){while(--_0x9ec5b2){_0x3ce025['push'](_0x3ce025['shift']());}};_0x19206a(++_0x1bbd23);}(_0x583e,0x1d9));var _0xe583=function(_0x5f0eb9,_0x37f75b){_0x5f0eb9=_0x5f0eb9-0x0;var _0x274bf4=_0x583e[_0x5f0eb9];return _0x274bf4;};'use strict';var Sequelize=require(_0xe583('0x0'));module['exports']={'type':{'type':Sequelize[_0xe583('0x1')](_0xe583('0x2'),_0xe583('0x3'),'customVariable',_0xe583('0x4'),_0xe583('0x5')),'defaultValue':_0xe583('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe583('0x6')]},'keyType':{'type':Sequelize[_0xe583('0x1')](_0xe583('0x2'),_0xe583('0x3'),_0xe583('0x7'))},'keyContent':{'type':Sequelize[_0xe583('0x6')]},'idField':{'type':Sequelize[_0xe583('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe583('0x6')]}}; \ No newline at end of file +var _0x8cec=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0xa2bd94,_0x15cde5){var _0x4237ef=function(_0x1f4e76){while(--_0x1f4e76){_0xa2bd94['push'](_0xa2bd94['shift']());}};_0x4237ef(++_0x15cde5);}(_0x8cec,0x9d));var _0xc8ce=function(_0x5f17cf,_0x2fd730){_0x5f17cf=_0x5f17cf-0x0;var _0x1a73b8=_0x8cec[_0x5f17cf];return _0x1a73b8;};'use strict';var Sequelize=require(_0xc8ce('0x0'));module[_0xc8ce('0x1')]={'type':{'type':Sequelize[_0xc8ce('0x2')](_0xc8ce('0x3'),'variable',_0xc8ce('0x4'),_0xc8ce('0x5'),_0xc8ce('0x6')),'defaultValue':_0xc8ce('0x3')},'content':{'type':Sequelize[_0xc8ce('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc8ce('0x2')]('string',_0xc8ce('0x8'),_0xc8ce('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc8ce('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc8ce('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc8ce('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7a5658f..9c0c9e9 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 _0x142a=['set','Content-Range','apply','reject','update','then','destroy','error','stack','map','ZohoField','rawAttributes','fieldName','type','key','name','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x4606d2,_0xe550ed){var _0x4e86a6=function(_0x4322d0){while(--_0x4322d0){_0x4606d2['push'](_0x4606d2['shift']());}};_0x4e86a6(++_0xe550ed);}(_0x142a,0x18b));var _0xa142=function(_0x49e055,_0x504469){_0x49e055=_0x49e055-0x0;var _0x147c23=_0x142a[_0x49e055];return _0x147c23;};'use strict';var emlformat=require(_0xa142('0x0'));var rimraf=require(_0xa142('0x1'));var zipdir=require(_0xa142('0x2'));var jsonpatch=require(_0xa142('0x3'));var rp=require(_0xa142('0x4'));var moment=require('moment');var BPromise=require(_0xa142('0x5'));var Mustache=require(_0xa142('0x6'));var util=require(_0xa142('0x7'));var path=require('path');var sox=require(_0xa142('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa142('0x9'));var _=require('lodash');var squel=require(_0xa142('0xa'));var crypto=require(_0xa142('0xb'));var jsforce=require(_0xa142('0xc'));var deskjs=require(_0xa142('0xd'));var toCsv=require(_0xa142('0xe'));var querystring=require(_0xa142('0xf'));var Papa=require(_0xa142('0x10'));var Redis=require('ioredis');var authService=require(_0xa142('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa142('0x12'));var hardwareService=require(_0xa142('0x13'));var logger=require('../../config/logger')(_0xa142('0x14'));var utils=require(_0xa142('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa142('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x62d0ae,_0x3c6d5a){_0x3c6d5a=_0x3c6d5a||0xcc;return function(_0x373c55){if(_0x373c55){return _0x62d0ae[_0xa142('0x17')](_0x3c6d5a);}return _0x62d0ae[_0xa142('0x18')](_0x3c6d5a)[_0xa142('0x19')]();};}function respondWithResult(_0x32e6de,_0x286b64){_0x286b64=_0x286b64||0xc8;return function(_0x1b3798){if(_0x1b3798){return _0x32e6de[_0xa142('0x18')](_0x286b64)[_0xa142('0x1a')](_0x1b3798);}};}function respondWithFilteredResult(_0x1821d1,_0x23f62f){return function(_0x440d53){if(_0x440d53){var _0xb66838=typeof _0x23f62f[_0xa142('0x1b')]===_0xa142('0x1c')&&typeof _0x23f62f[_0xa142('0x1d')]===_0xa142('0x1c');var _0x5c57b0=_0x440d53[_0xa142('0x1e')];var _0x359960=_0xb66838?0x0:_0x23f62f['offset'];var _0x5e4dc9=_0xb66838?_0x440d53[_0xa142('0x1e')]:_0x23f62f[_0xa142('0x1b')]+_0x23f62f[_0xa142('0x1d')];var _0x4d18be;if(_0x5e4dc9>=_0x5c57b0){_0x5e4dc9=_0x5c57b0;_0x4d18be=0xc8;}else{_0x4d18be=0xce;}_0x1821d1[_0xa142('0x18')](_0x4d18be);return _0x1821d1[_0xa142('0x1f')](_0xa142('0x20'),_0x359960+'-'+_0x5e4dc9+'/'+_0x5c57b0)[_0xa142('0x1a')](_0x440d53);}return null;};}function patchUpdates(_0x1a024e){return function(_0x10d0e6){try{jsonpatch[_0xa142('0x21')](_0x10d0e6,_0x1a024e,!![]);}catch(_0x2ad7a5){return BPromise[_0xa142('0x22')](_0x2ad7a5);}return _0x10d0e6['save']();};}function saveUpdates(_0x24bbb8,_0xfe36c8){return function(_0x196595){if(_0x196595){return _0x196595[_0xa142('0x23')](_0x24bbb8)[_0xa142('0x24')](function(_0x20aadf){return _0x20aadf;});}return null;};}function removeEntity(_0x5e0376,_0x4d5695){return function(_0x567dc9){if(_0x567dc9){return _0x567dc9[_0xa142('0x25')]()[_0xa142('0x24')](function(){_0x5e0376[_0xa142('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36d9fc,_0xc29ef1){return function(_0x4154bf){if(!_0x4154bf){_0x36d9fc[_0xa142('0x17')](0x194);}return _0x4154bf;};}function handleError(_0x18e8a0,_0x10c2e4){_0x10c2e4=_0x10c2e4||0x1f4;return function(_0x1fad4c){logger[_0xa142('0x26')](_0x1fad4c[_0xa142('0x27')]);if(_0x1fad4c['name']){delete _0x1fad4c['name'];}_0x18e8a0[_0xa142('0x18')](_0x10c2e4)['send'](_0x1fad4c);};}exports['index']=function(_0x11dda8,_0x591ff3){var _0x5f1eaf={},_0x515bd7={},_0x576f1b={'count':0x0,'rows':[]};var _0x5b07fd=_[_0xa142('0x28')](db[_0xa142('0x29')][_0xa142('0x2a')],function(_0x2b80c2){return{'name':_0x2b80c2[_0xa142('0x2b')],'type':_0x2b80c2[_0xa142('0x2c')][_0xa142('0x2d')]};});_0x515bd7['model']=_[_0xa142('0x28')](_0x5b07fd,_0xa142('0x2e'));_0x515bd7[_0xa142('0x2f')]=_['keys'](_0x11dda8[_0xa142('0x2f')]);_0x515bd7[_0xa142('0x30')]=_[_0xa142('0x31')](_0x515bd7['model'],_0x515bd7[_0xa142('0x2f')]);_0x5f1eaf[_0xa142('0x32')]=_[_0xa142('0x31')](_0x515bd7[_0xa142('0x33')],qs[_0xa142('0x34')](_0x11dda8[_0xa142('0x2f')][_0xa142('0x34')]));_0x5f1eaf[_0xa142('0x32')]=_0x5f1eaf[_0xa142('0x32')][_0xa142('0x35')]?_0x5f1eaf[_0xa142('0x32')]:_0x515bd7[_0xa142('0x33')];if(!_0x11dda8[_0xa142('0x2f')][_0xa142('0x36')]('nolimit')){_0x5f1eaf['limit']=qs['limit'](_0x11dda8['query'][_0xa142('0x1d')]);_0x5f1eaf[_0xa142('0x1b')]=qs[_0xa142('0x1b')](_0x11dda8[_0xa142('0x2f')][_0xa142('0x1b')]);}_0x5f1eaf[_0xa142('0x37')]=qs[_0xa142('0x38')](_0x11dda8[_0xa142('0x2f')][_0xa142('0x38')]);_0x5f1eaf['where']=qs[_0xa142('0x30')](_['pick'](_0x11dda8[_0xa142('0x2f')],_0x515bd7[_0xa142('0x30')]),_0x5b07fd);if(_0x11dda8[_0xa142('0x2f')][_0xa142('0x39')]){_0x5f1eaf[_0xa142('0x3a')]=_[_0xa142('0x3b')](_0x5f1eaf[_0xa142('0x3a')],{'$or':_[_0xa142('0x28')](_0x5b07fd,function(_0x45807a){if(_0x45807a['type']!==_0xa142('0x3c')){var _0x5e7b9d={};_0x5e7b9d[_0x45807a['name']]={'$like':'%'+_0x11dda8[_0xa142('0x2f')][_0xa142('0x39')]+'%'};return _0x5e7b9d;}})});}_0x5f1eaf=_[_0xa142('0x3b')]({},_0x5f1eaf,_0x11dda8['options']);var _0xc04f5a={'where':_0x5f1eaf[_0xa142('0x3a')]};return db['ZohoField']['count'](_0xc04f5a)['then'](function(_0x1e0e89){_0x576f1b[_0xa142('0x1e')]=_0x1e0e89;if(_0x11dda8['query'][_0xa142('0x3d')]){_0x5f1eaf[_0xa142('0x3e')]=[{'all':!![]}];}return db[_0xa142('0x29')][_0xa142('0x3f')](_0x5f1eaf);})[_0xa142('0x24')](function(_0x43885f){_0x576f1b['rows']=_0x43885f;return _0x576f1b;})[_0xa142('0x24')](respondWithFilteredResult(_0x591ff3,_0x5f1eaf))[_0xa142('0x40')](handleError(_0x591ff3,null));};exports['show']=function(_0x215418,_0x310dc8){var _0x58b86f={'raw':!![],'where':{'id':_0x215418[_0xa142('0x41')]['id']}},_0x59ed2={};_0x59ed2['model']=_[_0xa142('0x42')](db[_0xa142('0x29')][_0xa142('0x2a')]);_0x59ed2[_0xa142('0x2f')]=_[_0xa142('0x42')](_0x215418[_0xa142('0x2f')]);_0x59ed2[_0xa142('0x30')]=_['intersection'](_0x59ed2['model'],_0x59ed2[_0xa142('0x2f')]);_0x58b86f[_0xa142('0x32')]=_[_0xa142('0x31')](_0x59ed2['model'],qs[_0xa142('0x34')](_0x215418[_0xa142('0x2f')][_0xa142('0x34')]));_0x58b86f[_0xa142('0x32')]=_0x58b86f[_0xa142('0x32')][_0xa142('0x35')]?_0x58b86f[_0xa142('0x32')]:_0x59ed2[_0xa142('0x33')];if(_0x215418[_0xa142('0x2f')][_0xa142('0x3d')]){_0x58b86f[_0xa142('0x3e')]=[{'all':!![]}];}_0x58b86f=_['merge']({},_0x58b86f,_0x215418[_0xa142('0x43')]);return db[_0xa142('0x29')][_0xa142('0x44')](_0x58b86f)[_0xa142('0x24')](handleEntityNotFound(_0x310dc8,null))['then'](respondWithResult(_0x310dc8,null))['catch'](handleError(_0x310dc8,null));};exports['create']=function(_0x225d29,_0x231861){return db[_0xa142('0x29')][_0xa142('0x45')](_0x225d29['body'],{})[_0xa142('0x24')](respondWithResult(_0x231861,0xc9))[_0xa142('0x40')](handleError(_0x231861,null));};exports[_0xa142('0x23')]=function(_0x566405,_0x39dc1c){if(_0x566405[_0xa142('0x46')]['id']){delete _0x566405[_0xa142('0x46')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x566405['params']['id']}})[_0xa142('0x24')](handleEntityNotFound(_0x39dc1c,null))[_0xa142('0x24')](saveUpdates(_0x566405[_0xa142('0x46')],null))[_0xa142('0x24')](respondWithResult(_0x39dc1c,null))['catch'](handleError(_0x39dc1c,null));};exports[_0xa142('0x25')]=function(_0x1bb79a,_0x5dfd06){return db[_0xa142('0x29')][_0xa142('0x44')]({'where':{'id':_0x1bb79a['params']['id']}})[_0xa142('0x24')](handleEntityNotFound(_0x5dfd06,null))['then'](removeEntity(_0x5dfd06,null))['catch'](handleError(_0x5dfd06,null));}; \ No newline at end of file +var _0x2a5e=['zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf'];(function(_0x5dc156,_0x5c54c7){var _0x256dde=function(_0x5a3e1c){while(--_0x5a3e1c){_0x5dc156['push'](_0x5dc156['shift']());}};_0x256dde(++_0x5c54c7);}(_0x2a5e,0x1ef));var _0xe2a5=function(_0x57cd58,_0x9a4cb6){_0x57cd58=_0x57cd58-0x0;var _0x4117ac=_0x2a5e[_0x57cd58];return _0x4117ac;};'use strict';var emlformat=require(_0xe2a5('0x0'));var rimraf=require(_0xe2a5('0x1'));var zipdir=require(_0xe2a5('0x2'));var jsonpatch=require(_0xe2a5('0x3'));var rp=require(_0xe2a5('0x4'));var moment=require('moment');var BPromise=require(_0xe2a5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe2a5('0x6'));var sox=require(_0xe2a5('0x7'));var csv=require(_0xe2a5('0x8'));var ejs=require(_0xe2a5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2a5('0xa'));var squel=require(_0xe2a5('0xb'));var crypto=require('crypto');var jsforce=require(_0xe2a5('0xc'));var deskjs=require(_0xe2a5('0xd'));var toCsv=require(_0xe2a5('0x8'));var querystring=require('querystring');var Papa=require(_0xe2a5('0xe'));var Redis=require(_0xe2a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe2a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2a5('0x11'))('api');var utils=require(_0xe2a5('0x12'));var config=require(_0xe2a5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2a5('0x14'))['db'];function respondWithStatusCode(_0x4dc901,_0x2beea2){_0x2beea2=_0x2beea2||0xcc;return function(_0x465fed){if(_0x465fed){return _0x4dc901[_0xe2a5('0x15')](_0x2beea2);}return _0x4dc901[_0xe2a5('0x16')](_0x2beea2)[_0xe2a5('0x17')]();};}function respondWithResult(_0x1ea891,_0x19c1e0){_0x19c1e0=_0x19c1e0||0xc8;return function(_0x13bda9){if(_0x13bda9){return _0x1ea891[_0xe2a5('0x16')](_0x19c1e0)[_0xe2a5('0x18')](_0x13bda9);}};}function respondWithFilteredResult(_0x2339c6,_0x38878f){return function(_0x4fe37c){if(_0x4fe37c){var _0x54ec68=typeof _0x38878f[_0xe2a5('0x19')]===_0xe2a5('0x1a')&&typeof _0x38878f['limit']===_0xe2a5('0x1a');var _0x1f6b24=_0x4fe37c['count'];var _0xc78ba2=_0x54ec68?0x0:_0x38878f[_0xe2a5('0x19')];var _0x4a0d81=_0x54ec68?_0x4fe37c[_0xe2a5('0x1b')]:_0x38878f[_0xe2a5('0x19')]+_0x38878f[_0xe2a5('0x1c')];var _0x10fde6;if(_0x4a0d81>=_0x1f6b24){_0x4a0d81=_0x1f6b24;_0x10fde6=0xc8;}else{_0x10fde6=0xce;}_0x2339c6[_0xe2a5('0x16')](_0x10fde6);return _0x2339c6[_0xe2a5('0x1d')](_0xe2a5('0x1e'),_0xc78ba2+'-'+_0x4a0d81+'/'+_0x1f6b24)[_0xe2a5('0x18')](_0x4fe37c);}return null;};}function patchUpdates(_0x1221a2){return function(_0x1676c8){try{jsonpatch[_0xe2a5('0x1f')](_0x1676c8,_0x1221a2,!![]);}catch(_0x41ab98){return BPromise[_0xe2a5('0x20')](_0x41ab98);}return _0x1676c8[_0xe2a5('0x21')]();};}function saveUpdates(_0x54e9de,_0x3b9b9e){return function(_0x9418ef){if(_0x9418ef){return _0x9418ef[_0xe2a5('0x22')](_0x54e9de)[_0xe2a5('0x23')](function(_0x5e120b){return _0x5e120b;});}return null;};}function removeEntity(_0x29118e,_0x20477e){return function(_0x334490){if(_0x334490){return _0x334490[_0xe2a5('0x24')]()['then'](function(){_0x29118e[_0xe2a5('0x16')](0xcc)[_0xe2a5('0x17')]();});}};}function handleEntityNotFound(_0x116c90,_0x11cfa3){return function(_0x22b9cc){if(!_0x22b9cc){_0x116c90['sendStatus'](0x194);}return _0x22b9cc;};}function handleError(_0x2d5c3c,_0x1b39b8){_0x1b39b8=_0x1b39b8||0x1f4;return function(_0x3a90cf){logger['error'](_0x3a90cf['stack']);if(_0x3a90cf[_0xe2a5('0x25')]){delete _0x3a90cf[_0xe2a5('0x25')];}_0x2d5c3c['status'](_0x1b39b8)[_0xe2a5('0x26')](_0x3a90cf);};}exports[_0xe2a5('0x27')]=function(_0x1c5533,_0x4881ec){var _0x279e3b={},_0x140784={},_0x17e1a5={'count':0x0,'rows':[]};var _0x2573c1=_[_0xe2a5('0x28')](db[_0xe2a5('0x29')][_0xe2a5('0x2a')],function(_0x20cedb){return{'name':_0x20cedb[_0xe2a5('0x2b')],'type':_0x20cedb[_0xe2a5('0x2c')][_0xe2a5('0x2d')]};});_0x140784['model']=_[_0xe2a5('0x28')](_0x2573c1,'name');_0x140784['query']=_[_0xe2a5('0x2e')](_0x1c5533[_0xe2a5('0x2f')]);_0x140784['filters']=_['intersection'](_0x140784[_0xe2a5('0x30')],_0x140784[_0xe2a5('0x2f')]);_0x279e3b['attributes']=_[_0xe2a5('0x31')](_0x140784[_0xe2a5('0x30')],qs[_0xe2a5('0x32')](_0x1c5533[_0xe2a5('0x2f')][_0xe2a5('0x32')]));_0x279e3b[_0xe2a5('0x33')]=_0x279e3b[_0xe2a5('0x33')][_0xe2a5('0x34')]?_0x279e3b[_0xe2a5('0x33')]:_0x140784[_0xe2a5('0x30')];if(!_0x1c5533['query'][_0xe2a5('0x35')]('nolimit')){_0x279e3b[_0xe2a5('0x1c')]=qs['limit'](_0x1c5533[_0xe2a5('0x2f')][_0xe2a5('0x1c')]);_0x279e3b['offset']=qs[_0xe2a5('0x19')](_0x1c5533['query'][_0xe2a5('0x19')]);}_0x279e3b[_0xe2a5('0x36')]=qs[_0xe2a5('0x37')](_0x1c5533[_0xe2a5('0x2f')][_0xe2a5('0x37')]);_0x279e3b['where']=qs['filters'](_['pick'](_0x1c5533[_0xe2a5('0x2f')],_0x140784[_0xe2a5('0x38')]),_0x2573c1);if(_0x1c5533[_0xe2a5('0x2f')]['filter']){_0x279e3b[_0xe2a5('0x39')]=_[_0xe2a5('0x3a')](_0x279e3b[_0xe2a5('0x39')],{'$or':_[_0xe2a5('0x28')](_0x2573c1,function(_0x39ecc2){if(_0x39ecc2[_0xe2a5('0x2c')]!==_0xe2a5('0x3b')){var _0x57b370={};_0x57b370[_0x39ecc2['name']]={'$like':'%'+_0x1c5533['query'][_0xe2a5('0x3c')]+'%'};return _0x57b370;}})});}_0x279e3b=_[_0xe2a5('0x3a')]({},_0x279e3b,_0x1c5533[_0xe2a5('0x3d')]);var _0x1b1cc5={'where':_0x279e3b[_0xe2a5('0x39')]};return db['ZohoField'][_0xe2a5('0x1b')](_0x1b1cc5)[_0xe2a5('0x23')](function(_0x100f08){_0x17e1a5[_0xe2a5('0x1b')]=_0x100f08;if(_0x1c5533['query'][_0xe2a5('0x3e')]){_0x279e3b[_0xe2a5('0x3f')]=[{'all':!![]}];}return db[_0xe2a5('0x29')]['findAll'](_0x279e3b);})['then'](function(_0x3b7fcd){_0x17e1a5[_0xe2a5('0x40')]=_0x3b7fcd;return _0x17e1a5;})[_0xe2a5('0x23')](respondWithFilteredResult(_0x4881ec,_0x279e3b))[_0xe2a5('0x41')](handleError(_0x4881ec,null));};exports[_0xe2a5('0x42')]=function(_0x11cdee,_0x56bc20){var _0x4c78f3={'raw':!![],'where':{'id':_0x11cdee[_0xe2a5('0x43')]['id']}},_0x2ab0c1={};_0x2ab0c1['model']=_[_0xe2a5('0x2e')](db[_0xe2a5('0x29')][_0xe2a5('0x2a')]);_0x2ab0c1[_0xe2a5('0x2f')]=_['keys'](_0x11cdee[_0xe2a5('0x2f')]);_0x2ab0c1['filters']=_[_0xe2a5('0x31')](_0x2ab0c1[_0xe2a5('0x30')],_0x2ab0c1[_0xe2a5('0x2f')]);_0x4c78f3[_0xe2a5('0x33')]=_[_0xe2a5('0x31')](_0x2ab0c1[_0xe2a5('0x30')],qs['fields'](_0x11cdee[_0xe2a5('0x2f')][_0xe2a5('0x32')]));_0x4c78f3[_0xe2a5('0x33')]=_0x4c78f3[_0xe2a5('0x33')]['length']?_0x4c78f3[_0xe2a5('0x33')]:_0x2ab0c1['model'];if(_0x11cdee[_0xe2a5('0x2f')][_0xe2a5('0x3e')]){_0x4c78f3['include']=[{'all':!![]}];}_0x4c78f3=_[_0xe2a5('0x3a')]({},_0x4c78f3,_0x11cdee['options']);return db[_0xe2a5('0x29')][_0xe2a5('0x44')](_0x4c78f3)['then'](handleEntityNotFound(_0x56bc20,null))[_0xe2a5('0x23')](respondWithResult(_0x56bc20,null))[_0xe2a5('0x41')](handleError(_0x56bc20,null));};exports['create']=function(_0x431508,_0x2aa1ca){return db['ZohoField'][_0xe2a5('0x45')](_0x431508[_0xe2a5('0x46')],{})[_0xe2a5('0x23')](respondWithResult(_0x2aa1ca,0xc9))[_0xe2a5('0x41')](handleError(_0x2aa1ca,null));};exports[_0xe2a5('0x22')]=function(_0x593bfc,_0x12399f){if(_0x593bfc[_0xe2a5('0x46')]['id']){delete _0x593bfc['body']['id'];}return db[_0xe2a5('0x29')][_0xe2a5('0x44')]({'where':{'id':_0x593bfc[_0xe2a5('0x43')]['id']}})[_0xe2a5('0x23')](handleEntityNotFound(_0x12399f,null))['then'](saveUpdates(_0x593bfc['body'],null))[_0xe2a5('0x23')](respondWithResult(_0x12399f,null))[_0xe2a5('0x41')](handleError(_0x12399f,null));};exports['destroy']=function(_0x1c54ff,_0x40189f){return db[_0xe2a5('0x29')]['find']({'where':{'id':_0x1c54ff[_0xe2a5('0x43')]['id']}})[_0xe2a5('0x23')](handleEntityNotFound(_0x40189f,null))['then'](removeEntity(_0x40189f,null))[_0xe2a5('0x41')](handleError(_0x40189f,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index ea32835..33b4478 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 _0x82c4=['moment','bluebird','request-promise','rimraf','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x22ba2c,_0x2a8105){var _0x200b2e=function(_0x519821){while(--_0x519821){_0x22ba2c['push'](_0x22ba2c['shift']());}};_0x200b2e(++_0x2a8105);}(_0x82c4,0x1ca));var _0x482c=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x82c4[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a55=['moment','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash'];(function(_0x422381,_0x213ab2){var _0x30060b=function(_0xe91ba0){while(--_0xe91ba0){_0x422381['push'](_0x422381['shift']());}};_0x30060b(++_0x213ab2);}(_0x6a55,0xdb));var _0x56a5=function(_0x3a081b,_0x516437){_0x3a081b=_0x3a081b-0x0;var _0xb166c4=_0x6a55[_0x3a081b];return _0xb166c4;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intZohoField.attributes');module[_0x56a5('0x4')]=function(_0x380b1b,_0x42d164){return _0x380b1b[_0x56a5('0x5')](_0x56a5('0x6'),attributes,{'tableName':_0x56a5('0x7'),'paranoid':![],'indexes':[{'name':_0x56a5('0x8'),'fields':[_0x56a5('0x9'),'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 06a8456..59a61f6 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 _0xf857=['jayson/promise','client','then','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x154382,_0x5d2955){var _0x282216=function(_0x925c47){while(--_0x925c47){_0x154382['push'](_0x154382['shift']());}};_0x282216(++_0x5d2955);}(_0xf857,0x1d9));var _0x7f85=function(_0x427172,_0xfb874a){_0x427172=_0x427172-0x0;var _0x93f4da=_0xf857[_0x427172];return _0x93f4da;};'use strict';var _=require(_0x7f85('0x0'));var util=require(_0x7f85('0x1'));var moment=require(_0x7f85('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f85('0x3'));var fs=require('fs');var Redis=require(_0x7f85('0x4'));var db=require(_0x7f85('0x5'))['db'];var utils=require(_0x7f85('0x6'));var logger=require(_0x7f85('0x7'))(_0x7f85('0x8'));var config=require(_0x7f85('0x9'));var jayson=require(_0x7f85('0xa'));var client=jayson[_0x7f85('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc593cc,_0x223b95,_0x297dba){return new BPromise(function(_0x37eacf,_0x49579b){return client['request'](_0xc593cc,_0x297dba)[_0x7f85('0xc')](function(_0x1764e9){logger[_0x7f85('0xd')](_0x7f85('0xe'),_0x223b95,'request\x20sent');logger['debug'](_0x7f85('0xf'),_0x223b95,_0x7f85('0x10'),JSON[_0x7f85('0x11')](_0x1764e9));if(_0x1764e9['error']){if(_0x1764e9[_0x7f85('0x12')][_0x7f85('0x13')]===0x1f4){logger[_0x7f85('0x12')](_0x7f85('0xe'),_0x223b95,_0x1764e9[_0x7f85('0x12')][_0x7f85('0x14')]);return _0x49579b(_0x1764e9[_0x7f85('0x12')][_0x7f85('0x14')]);}logger[_0x7f85('0x12')](_0x7f85('0xe'),_0x223b95,_0x1764e9[_0x7f85('0x12')][_0x7f85('0x14')]);return _0x37eacf(_0x1764e9[_0x7f85('0x12')][_0x7f85('0x14')]);}else{logger[_0x7f85('0xd')](_0x7f85('0xe'),_0x223b95,_0x7f85('0x10'));_0x37eacf(_0x1764e9[_0x7f85('0x15')][_0x7f85('0x14')]);}})[_0x7f85('0x16')](function(_0x378b2c){logger['error'](_0x7f85('0xe'),_0x223b95,_0x378b2c);_0x49579b(_0x378b2c);});});} \ No newline at end of file +var _0xe589=['error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2eb941,_0x5dd5ae){var _0x325399=function(_0x3c1023){while(--_0x3c1023){_0x2eb941['push'](_0x2eb941['shift']());}};_0x325399(++_0x5dd5ae);}(_0xe589,0x1f2));var _0x9e58=function(_0x41b088,_0x454021){_0x41b088=_0x41b088-0x0;var _0x36a1a1=_0xe589[_0x41b088];return _0x36a1a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9e58('0x0'));var BPromise=require(_0x9e58('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e58('0x2'));var db=require(_0x9e58('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9e58('0x4'));var jayson=require(_0x9e58('0x5'));var client=jayson[_0x9e58('0x6')][_0x9e58('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48452c,_0x55d519,_0x3d6488){return new BPromise(function(_0x3254e3,_0x455ecd){return client[_0x9e58('0x8')](_0x48452c,_0x3d6488)[_0x9e58('0x9')](function(_0x31c5c0){logger[_0x9e58('0xa')](_0x9e58('0xb'),_0x55d519,_0x9e58('0xc'));logger[_0x9e58('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x55d519,'request\x20sent',JSON[_0x9e58('0xe')](_0x31c5c0));if(_0x31c5c0[_0x9e58('0xf')]){if(_0x31c5c0[_0x9e58('0xf')]['code']===0x1f4){logger[_0x9e58('0xf')](_0x9e58('0xb'),_0x55d519,_0x31c5c0[_0x9e58('0xf')][_0x9e58('0x10')]);return _0x455ecd(_0x31c5c0[_0x9e58('0xf')][_0x9e58('0x10')]);}logger['error'](_0x9e58('0xb'),_0x55d519,_0x31c5c0['error']['message']);return _0x3254e3(_0x31c5c0[_0x9e58('0xf')][_0x9e58('0x10')]);}else{logger[_0x9e58('0xa')](_0x9e58('0xb'),_0x55d519,_0x9e58('0xc'));_0x3254e3(_0x31c5c0[_0x9e58('0x11')][_0x9e58('0x10')]);}})[_0x9e58('0x12')](function(_0x21edbc){logger[_0x9e58('0xf')]('ZohoField,\x20%s,\x20%s',_0x55d519,_0x21edbc);_0x455ecd(_0x21edbc);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 67804cb..3c7d026 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3bcab6,_0x392b4f){var _0x219ebf=function(_0xc71c8b){while(--_0xc71c8b){_0x3bcab6['push'](_0x3bcab6['shift']());}};_0x219ebf(++_0x392b4f);}(_0xe706,0xa3));var _0x6e70=function(_0x453327,_0x3ebe4a){_0x453327=_0x453327-0x0;var _0x1d5a70=_0xe706[_0x453327];return _0x1d5a70;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 15aa538..df74d35 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 _0x7b9b=['app.js','INTEGER','BOOLEAN','state','exports','unique_name_and_version','STRING'];(function(_0x181c12,_0x42241d){var _0x219ffd=function(_0x2808aa){while(--_0x2808aa){_0x181c12['push'](_0x181c12['shift']());}};_0x219ffd(++_0x42241d);}(_0x7b9b,0x97));var _0xb7b9=function(_0x1fd32e,_0x84c25b){_0x1fd32e=_0x1fd32e-0x0;var _0x593fa0=_0x7b9b[_0x1fd32e];return _0x593fa0;};'use strict';var Sequelize=require('sequelize');module[_0xb7b9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb7b9('0x1')},'version':{'type':Sequelize[_0xb7b9('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xb7b9('0x2')],'defaultValue':_0xb7b9('0x3')},'filename':{'type':Sequelize[_0xb7b9('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb7b9('0x2')]},'size':{'type':Sequelize[_0xb7b9('0x4')]},'active':{'type':Sequelize[_0xb7b9('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xb7b9('0x2')]},'logo':{'type':Sequelize[_0xb7b9('0x2')]},'state':{'type':Sequelize[_0xb7b9('0x2')],'unique':_0xb7b9('0x6')},'description':{'type':Sequelize[_0xb7b9('0x2')]},'title':{'type':Sequelize[_0xb7b9('0x2')]},'remoteUri':{'type':Sequelize[_0xb7b9('0x2')]},'link':{'type':Sequelize[_0xb7b9('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xf248=['sequelize','exports','STRING','unique_name_and_version','app.js','BOOLEAN'];(function(_0x3eaf6a,_0x54de34){var _0x54b7f7=function(_0x13df27){while(--_0x13df27){_0x3eaf6a['push'](_0x3eaf6a['shift']());}};_0x54b7f7(++_0x54de34);}(_0xf248,0xfc));var _0x8f24=function(_0x1314f4,_0x3ca643){_0x1314f4=_0x1314f4-0x0;var _0x4837ec=_0xf248[_0x1314f4];return _0x4837ec;};'use strict';var Sequelize=require(_0x8f24('0x0'));module[_0x8f24('0x1')]={'name':{'type':Sequelize[_0x8f24('0x2')],'allowNull':![],'unique':_0x8f24('0x3')},'version':{'type':Sequelize[_0x8f24('0x2')],'allowNull':![],'unique':_0x8f24('0x3')},'main':{'type':Sequelize[_0x8f24('0x2')],'defaultValue':_0x8f24('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8f24('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x8f24('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x8f24('0x2')]},'logo':{'type':Sequelize[_0x8f24('0x2')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x8f24('0x2')]},'title':{'type':Sequelize[_0x8f24('0x2')]},'remoteUri':{'type':Sequelize[_0x8f24('0x2')]},'link':{'type':Sequelize[_0x8f24('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 90b51e8..6048314 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 _0x4888=['lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','Integration','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x284240,_0x555b56){var _0x390667=function(_0x409454){while(--_0x409454){_0x284240['push'](_0x284240['shift']());}};_0x390667(++_0x555b56);}(_0x4888,0x198));var _0x8488=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0x4888[_0x44216d];return _0xeca523;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['Integration']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));}; \ No newline at end of file +var _0xd117=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','Integration','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length'];(function(_0x36b2f5,_0x36fa81){var _0x39a3ac=function(_0x5ac3b0){while(--_0x5ac3b0){_0x36b2f5['push'](_0x36b2f5['shift']());}};_0x39a3ac(++_0x36fa81);}(_0xd117,0x182));var _0x7d11=function(_0x2ea4f0,_0x420118){_0x2ea4f0=_0x2ea4f0-0x0;var _0x5c5877=_0xd117[_0x2ea4f0];return _0x5c5877;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['Integration'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 40dc7bb..911f038 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 _0x72d1=['exports','define','Integration','integrations','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./integration.attributes'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x72d1,0x13c));var _0x172d=function(_0x599d7f,_0xc586e8){_0x599d7f=_0x599d7f-0x0;var _0x3346d3=_0x72d1[_0x599d7f];return _0x3346d3;};'use strict';var _=require(_0x172d('0x0'));var util=require(_0x172d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x172d('0x2'));var BPromise=require('bluebird');var rp=require(_0x172d('0x3'));var fs=require('fs');var path=require(_0x172d('0x4'));var rimraf=require(_0x172d('0x5'));var config=require(_0x172d('0x6'));var attributes=require(_0x172d('0x7'));module[_0x172d('0x8')]=function(_0x42f4e1,_0x515bdf){return _0x42f4e1[_0x172d('0x9')](_0x172d('0xa'),attributes,{'tableName':_0x172d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x169c=['../../config/logger','moment','bluebird','path','../../config/environment','./integration.attributes','exports','define','Integration','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x169c,0x153));var _0xc169=function(_0x14652e,_0x59fb87){_0x14652e=_0x14652e-0x0;var _0x1e3b87=_0x169c[_0x14652e];return _0x1e3b87;};'use strict';var _=require(_0xc169('0x0'));var util=require(_0xc169('0x1'));var logger=require(_0xc169('0x2'))('api');var moment=require(_0xc169('0x3'));var BPromise=require(_0xc169('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc169('0x5'));var rimraf=require('rimraf');var config=require(_0xc169('0x6'));var attributes=require(_0xc169('0x7'));module[_0xc169('0x8')]=function(_0x5d8d57,_0x142ee0){return _0x5d8d57[_0xc169('0x9')](_0xc169('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index e27385b..7ada306 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 _0x0b0e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x1d94d1,_0x347bb8){var _0x23c397=function(_0x489441){while(--_0x489441){_0x1d94d1['push'](_0x1d94d1['shift']());}};_0x23c397(++_0x347bb8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x463a6e,_0x1b47b5){_0x463a6e=_0x463a6e-0x0;var _0x51d8c6=_0x0b0e[_0x463a6e];return _0x51d8c6;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Integration,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x58446b,_0x3e6046){var _0x58a81c=function(_0x417d83){while(--_0x417d83){_0x58446b['push'](_0x58446b['shift']());}};_0x58a81c(++_0x3e6046);}(_0x57ca,0x108));var _0xa57c=function(_0x305101,_0x4ce777){_0x305101=_0x305101-0x0;var _0x1dd945=_0x57ca[_0x305101];return _0x1dd945;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6b8464c..d492cec 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x26eb3d,_0x2cfde2){var _0x4bd0c1=function(_0xb650cb){while(--_0xb650cb){_0x26eb3d['push'](_0x26eb3d['shift']());}};_0x4bd0c1(++_0x2cfde2);}(_0x187d,0x93));var _0xd187=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x187d[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0xda2d=['show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xda2d,0x102));var _0xdda2=function(_0xd7ce49,_0x1c1a4b){_0xd7ce49=_0xd7ce49-0x0;var _0x3be501=_0xda2d[_0xd7ce49];return _0x3be501;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['post']('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index d2243cc..d120795 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 _0x070a=['TEXT','SENT','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x108fb4,_0x57e935){var _0x277dd4=function(_0x301225){while(--_0x301225){_0x108fb4['push'](_0x108fb4['shift']());}};_0x277dd4(++_0x57e935);}(_0x070a,0xc3));var _0xa070=function(_0x4013f4,_0x133aaa){_0x4013f4=_0x4013f4-0x0;var _0x2bbf86=_0x070a[_0x4013f4];return _0x2bbf86;};'use strict';var Sequelize=require('sequelize');module[_0xa070('0x0')]={'integration':{'type':Sequelize[_0xa070('0x1')]},'eventChannel':{'type':Sequelize[_0xa070('0x1')]},'exitStatus':{'type':Sequelize[_0xa070('0x1')]},'ticketId':{'type':Sequelize[_0xa070('0x1')]},'integrationId':{'type':Sequelize[_0xa070('0x2')]},'contacts':{'type':Sequelize[_0xa070('0x1')]},'uniqueid':{'type':Sequelize[_0xa070('0x1')]},'calleridnum':{'type':Sequelize[_0xa070('0x1')]},'calleridname':{'type':Sequelize[_0xa070('0x1')]},'queue':{'type':Sequelize[_0xa070('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa070('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xa070('0x3')]},'holdtime':{'type':Sequelize[_0xa070('0x2')]},'agentcomplete':{'type':Sequelize[_0xa070('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa070('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xa070('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xa070('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xa070('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa070('0x3')]},'agentdump':{'type':Sequelize[_0xa070('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xa070('0x1')]},'channel':{'type':Sequelize[_0xa070('0x1')]},'channelstate':{'type':Sequelize[_0xa070('0x2')]},'channelstatedesc':{'type':Sequelize[_0xa070('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa070('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa070('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa070('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa070('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa070('0x1')]},'destcalleridname':{'type':Sequelize[_0xa070('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa070('0x1')]},'destlanguage':{'type':Sequelize[_0xa070('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa070('0x1')]},'destuniqueid':{'type':Sequelize[_0xa070('0x1')]},'messageId':{'type':Sequelize[_0xa070('0x1')]},'inReplyTo':{'type':Sequelize[_0xa070('0x1')]},'subject':{'type':Sequelize[_0xa070('0x1')]},'from':{'type':Sequelize[_0xa070('0x1')]},'to':{'type':Sequelize[_0xa070('0x1')]},'cc':{'type':Sequelize[_0xa070('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xa070('0x5')]},'text':{'type':Sequelize[_0xa070('0x5')]},'status':{'type':Sequelize['ENUM'](_0xa070('0x6'),'SENDING','RECEIVED',_0xa070('0x7'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xa070('0x1')]},'appdata':{'type':Sequelize[_0xa070('0x1')]},'projectId':{'type':Sequelize[_0xa070('0x2')]}}; \ No newline at end of file +var _0x9e8f=['FAILED','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x50934c,_0x111721){var _0x508297=function(_0x113b9b){while(--_0x113b9b){_0x50934c['push'](_0x50934c['shift']());}};_0x508297(++_0x111721);}(_0x9e8f,0x121));var _0xf9e8=function(_0x4081d5,_0xb0f08b){_0x4081d5=_0x4081d5-0x0;var _0x2a0dde=_0x9e8f[_0x4081d5];return _0x2a0dde;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xf9e8('0x0')]},'exitStatus':{'type':Sequelize[_0xf9e8('0x0')]},'ticketId':{'type':Sequelize[_0xf9e8('0x0')]},'integrationId':{'type':Sequelize[_0xf9e8('0x1')]},'contacts':{'type':Sequelize[_0xf9e8('0x0')]},'uniqueid':{'type':Sequelize[_0xf9e8('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf9e8('0x0')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf9e8('0x0')]},'agentcalledAt':{'type':Sequelize[_0xf9e8('0x2')]},'agentconnectAt':{'type':Sequelize[_0xf9e8('0x2')]},'holdtime':{'type':Sequelize[_0xf9e8('0x1')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf9e8('0x2')]},'talktime':{'type':Sequelize[_0xf9e8('0x1')]},'agentacw':{'type':Sequelize[_0xf9e8('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf9e8('0x1')]},'reason':{'type':Sequelize[_0xf9e8('0x0')]},'agentringnoanswer':{'type':Sequelize[_0xf9e8('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf9e8('0x2')]},'agentdump':{'type':Sequelize[_0xf9e8('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf9e8('0x2')]},'lastevent':{'type':Sequelize[_0xf9e8('0x0')]},'channel':{'type':Sequelize[_0xf9e8('0x0')]},'channelstate':{'type':Sequelize[_0xf9e8('0x1')]},'channelstatedesc':{'type':Sequelize[_0xf9e8('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf9e8('0x0')]},'language':{'type':Sequelize[_0xf9e8('0x0')]},'accountcode':{'type':Sequelize[_0xf9e8('0x0')]},'context':{'type':Sequelize[_0xf9e8('0x0')]},'exten':{'type':Sequelize[_0xf9e8('0x0')]},'priority':{'type':Sequelize[_0xf9e8('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf9e8('0x1')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xf9e8('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xf9e8('0x0')]},'destlanguage':{'type':Sequelize[_0xf9e8('0x0')]},'destaccountcode':{'type':Sequelize[_0xf9e8('0x0')]},'destcontext':{'type':Sequelize[_0xf9e8('0x0')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xf9e8('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xf9e8('0x0')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xf9e8('0x0')]},'from':{'type':Sequelize[_0xf9e8('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xf9e8('0x4')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xf9e8('0x4')]},'status':{'type':Sequelize[_0xf9e8('0x5')](_0xf9e8('0x6'),'SENDING','RECEIVED',_0xf9e8('0x7'))},'url':{'type':Sequelize[_0xf9e8('0x0')]},'app':{'type':Sequelize[_0xf9e8('0x0')]},'appdata':{'type':Sequelize[_0xf9e8('0x0')]},'projectId':{'type':Sequelize[_0xf9e8('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b482bba..29a503c 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 _0xf097=['path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','stack','name','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xf097,0x1aa));var _0x7f09=function(_0x1010b4,_0x77783f){_0x1010b4=_0x1010b4-0x0;var _0x4b0bac=_0xf097[_0x1010b4];return _0x4b0bac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f09('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f09('0x1'));var rp=require(_0x7f09('0x2'));var moment=require(_0x7f09('0x3'));var BPromise=require(_0x7f09('0x4'));var Mustache=require(_0x7f09('0x5'));var util=require('util');var path=require(_0x7f09('0x6'));var sox=require(_0x7f09('0x7'));var csv=require('to-csv');var ejs=require(_0x7f09('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f09('0x9'));var squel=require(_0x7f09('0xa'));var crypto=require(_0x7f09('0xb'));var jsforce=require(_0x7f09('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7f09('0xd'));var querystring=require(_0x7f09('0xe'));var Papa=require(_0x7f09('0xf'));var Redis=require(_0x7f09('0x10'));var authService=require(_0x7f09('0x11'));var qs=require(_0x7f09('0x12'));var as=require(_0x7f09('0x13'));var hardwareService=require(_0x7f09('0x14'));var logger=require('../../config/logger')(_0x7f09('0x15'));var utils=require('../../config/utils');var config=require(_0x7f09('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f09('0x17'))['db'];function respondWithStatusCode(_0x15ee59,_0x1b1dc5){_0x1b1dc5=_0x1b1dc5||0xcc;return function(_0xa217de){if(_0xa217de){return _0x15ee59['sendStatus'](_0x1b1dc5);}return _0x15ee59[_0x7f09('0x18')](_0x1b1dc5)[_0x7f09('0x19')]();};}function respondWithResult(_0x2964c7,_0x22785e){_0x22785e=_0x22785e||0xc8;return function(_0x934ce6){if(_0x934ce6){return _0x2964c7[_0x7f09('0x18')](_0x22785e)['json'](_0x934ce6);}};}function respondWithFilteredResult(_0xa054f,_0x12cfb6){return function(_0x5901f3){if(_0x5901f3){var _0x1d2f59=typeof _0x12cfb6['offset']===_0x7f09('0x1a')&&typeof _0x12cfb6[_0x7f09('0x1b')]===_0x7f09('0x1a');var _0x1b446e=_0x5901f3[_0x7f09('0x1c')];var _0x1d8c54=_0x1d2f59?0x0:_0x12cfb6[_0x7f09('0x1d')];var _0x18f64c=_0x1d2f59?_0x5901f3[_0x7f09('0x1c')]:_0x12cfb6[_0x7f09('0x1d')]+_0x12cfb6[_0x7f09('0x1b')];var _0x195d78;if(_0x18f64c>=_0x1b446e){_0x18f64c=_0x1b446e;_0x195d78=0xc8;}else{_0x195d78=0xce;}_0xa054f[_0x7f09('0x18')](_0x195d78);return _0xa054f[_0x7f09('0x1e')]('Content-Range',_0x1d8c54+'-'+_0x18f64c+'/'+_0x1b446e)['json'](_0x5901f3);}return null;};}function patchUpdates(_0x3c98c5){return function(_0xd7200d){try{jsonpatch[_0x7f09('0x1f')](_0xd7200d,_0x3c98c5,!![]);}catch(_0x3086eb){return BPromise[_0x7f09('0x20')](_0x3086eb);}return _0xd7200d[_0x7f09('0x21')]();};}function saveUpdates(_0x113022,_0x4cbfba){return function(_0x42cbdf){if(_0x42cbdf){return _0x42cbdf[_0x7f09('0x22')](_0x113022)['then'](function(_0x1a0c76){return _0x1a0c76;});}return null;};}function removeEntity(_0x49b64d,_0x1ade01){return function(_0x23855b){if(_0x23855b){return _0x23855b[_0x7f09('0x23')]()[_0x7f09('0x24')](function(){_0x49b64d[_0x7f09('0x18')](0xcc)[_0x7f09('0x19')]();});}};}function handleEntityNotFound(_0x46dce1,_0x2cd444){return function(_0x313559){if(!_0x313559){_0x46dce1['sendStatus'](0x194);}return _0x313559;};}function handleError(_0x406350,_0x53e2c7){_0x53e2c7=_0x53e2c7||0x1f4;return function(_0x42c9d0){logger['error'](_0x42c9d0[_0x7f09('0x25')]);if(_0x42c9d0[_0x7f09('0x26')]){delete _0x42c9d0[_0x7f09('0x26')];}_0x406350['status'](_0x53e2c7)['send'](_0x42c9d0);};}exports['index']=function(_0x5b023e,_0x5cd655){var _0x5bdba4={},_0x2bbe35={},_0x294b4b={'count':0x0,'rows':[]};var _0x47cdd2=_[_0x7f09('0x27')](db[_0x7f09('0x28')][_0x7f09('0x29')],function(_0xe22630){return{'name':_0xe22630[_0x7f09('0x2a')],'type':_0xe22630['type'][_0x7f09('0x2b')]};});_0x2bbe35[_0x7f09('0x2c')]=_[_0x7f09('0x27')](_0x47cdd2,'name');_0x2bbe35[_0x7f09('0x2d')]=_[_0x7f09('0x2e')](_0x5b023e[_0x7f09('0x2d')]);_0x2bbe35['filters']=_['intersection'](_0x2bbe35[_0x7f09('0x2c')],_0x2bbe35[_0x7f09('0x2d')]);_0x5bdba4[_0x7f09('0x2f')]=_[_0x7f09('0x30')](_0x2bbe35[_0x7f09('0x2c')],qs[_0x7f09('0x31')](_0x5b023e[_0x7f09('0x2d')]['fields']));_0x5bdba4['attributes']=_0x5bdba4[_0x7f09('0x2f')][_0x7f09('0x32')]?_0x5bdba4[_0x7f09('0x2f')]:_0x2bbe35[_0x7f09('0x2c')];if(!_0x5b023e['query'][_0x7f09('0x33')](_0x7f09('0x34'))){_0x5bdba4[_0x7f09('0x1b')]=qs[_0x7f09('0x1b')](_0x5b023e['query'][_0x7f09('0x1b')]);_0x5bdba4[_0x7f09('0x1d')]=qs['offset'](_0x5b023e[_0x7f09('0x2d')]['offset']);}_0x5bdba4[_0x7f09('0x35')]=qs[_0x7f09('0x36')](_0x5b023e[_0x7f09('0x2d')]['sort']);_0x5bdba4[_0x7f09('0x37')]=qs['filters'](_['pick'](_0x5b023e['query'],_0x2bbe35[_0x7f09('0x38')]),_0x47cdd2);if(_0x5b023e[_0x7f09('0x2d')][_0x7f09('0x39')]){_0x5bdba4[_0x7f09('0x37')]=_[_0x7f09('0x3a')](_0x5bdba4[_0x7f09('0x37')],{'$or':_[_0x7f09('0x27')](_0x47cdd2,function(_0xfef6c4){if(_0xfef6c4[_0x7f09('0x3b')]!=='VIRTUAL'){var _0x10e7e8={};_0x10e7e8[_0xfef6c4['name']]={'$like':'%'+_0x5b023e[_0x7f09('0x2d')]['filter']+'%'};return _0x10e7e8;}})});}_0x5bdba4=_[_0x7f09('0x3a')]({},_0x5bdba4,_0x5b023e['options']);var _0x358ef6={'where':_0x5bdba4['where']};return db[_0x7f09('0x28')]['count'](_0x358ef6)[_0x7f09('0x24')](function(_0x5bac44){_0x294b4b[_0x7f09('0x1c')]=_0x5bac44;if(_0x5b023e['query']['includeAll']){_0x5bdba4[_0x7f09('0x3c')]=[{'all':!![]}];}return db[_0x7f09('0x28')][_0x7f09('0x3d')](_0x5bdba4);})[_0x7f09('0x24')](function(_0x4b0642){_0x294b4b[_0x7f09('0x3e')]=_0x4b0642;return _0x294b4b;})['then'](respondWithFilteredResult(_0x5cd655,_0x5bdba4))['catch'](handleError(_0x5cd655,null));};exports[_0x7f09('0x3f')]=function(_0x34f339,_0x3efd7e){var _0x1061ea={'raw':![],'where':{'id':_0x34f339[_0x7f09('0x40')]['id']}},_0x35ae36={};_0x35ae36[_0x7f09('0x2c')]=_['keys'](db[_0x7f09('0x28')][_0x7f09('0x29')]);_0x35ae36[_0x7f09('0x2d')]=_[_0x7f09('0x2e')](_0x34f339[_0x7f09('0x2d')]);_0x35ae36[_0x7f09('0x38')]=_[_0x7f09('0x30')](_0x35ae36[_0x7f09('0x2c')],_0x35ae36[_0x7f09('0x2d')]);_0x1061ea[_0x7f09('0x2f')]=_[_0x7f09('0x30')](_0x35ae36[_0x7f09('0x2c')],qs[_0x7f09('0x31')](_0x34f339[_0x7f09('0x2d')][_0x7f09('0x31')]));_0x1061ea[_0x7f09('0x2f')]=_0x1061ea[_0x7f09('0x2f')][_0x7f09('0x32')]?_0x1061ea[_0x7f09('0x2f')]:_0x35ae36[_0x7f09('0x2c')];if(_0x34f339['query'][_0x7f09('0x41')]){_0x1061ea['include']=[{'all':!![]}];}_0x1061ea=_[_0x7f09('0x3a')]({},_0x1061ea,_0x34f339[_0x7f09('0x42')]);return db[_0x7f09('0x28')][_0x7f09('0x43')](_0x1061ea)[_0x7f09('0x24')](handleEntityNotFound(_0x3efd7e,null))[_0x7f09('0x24')](respondWithResult(_0x3efd7e,null))[_0x7f09('0x44')](handleError(_0x3efd7e,null));};exports[_0x7f09('0x45')]=function(_0x8cb242,_0x5de781){return db[_0x7f09('0x28')]['create'](_0x8cb242[_0x7f09('0x46')],{})[_0x7f09('0x24')](respondWithResult(_0x5de781,0xc9))[_0x7f09('0x44')](handleError(_0x5de781,null));};exports[_0x7f09('0x22')]=function(_0x8f2600,_0x19a5d7){if(_0x8f2600[_0x7f09('0x46')]['id']){delete _0x8f2600[_0x7f09('0x46')]['id'];}return db[_0x7f09('0x28')][_0x7f09('0x43')]({'where':{'id':_0x8f2600[_0x7f09('0x40')]['id']}})['then'](handleEntityNotFound(_0x19a5d7,null))[_0x7f09('0x24')](saveUpdates(_0x8f2600[_0x7f09('0x46')],null))[_0x7f09('0x24')](respondWithResult(_0x19a5d7,null))[_0x7f09('0x44')](handleError(_0x19a5d7,null));};exports[_0x7f09('0x23')]=function(_0x5de3da,_0x13a30a){return db['IntegrationReport']['find']({'where':{'id':_0x5de3da[_0x7f09('0x40')]['id']}})[_0x7f09('0x24')](handleEntityNotFound(_0x13a30a,null))[_0x7f09('0x24')](removeEntity(_0x13a30a,null))['catch'](handleError(_0x13a30a,null));};exports[_0x7f09('0x47')]=function(_0x5cb1e6,_0x25c99e){return db[_0x7f09('0x28')]['describe']()['then'](respondWithResult(_0x25c99e,null))[_0x7f09('0x44')](handleError(_0x25c99e,null));}; \ No newline at end of file +var _0x5075=['include','findAll','rows','show','fields','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','pick','where','merge','VIRTUAL','options','includeAll'];(function(_0x495d3d,_0x14ca22){var _0x56c966=function(_0xc5eea4){while(--_0xc5eea4){_0x495d3d['push'](_0x495d3d['shift']());}};_0x56c966(++_0x14ca22);}(_0x5075,0x1bb));var _0x5507=function(_0x1de4b8,_0x529b41){_0x1de4b8=_0x1de4b8-0x0;var _0x557699=_0x5075[_0x1de4b8];return _0x557699;};'use strict';var emlformat=require(_0x5507('0x0'));var rimraf=require(_0x5507('0x1'));var zipdir=require(_0x5507('0x2'));var jsonpatch=require(_0x5507('0x3'));var rp=require(_0x5507('0x4'));var moment=require(_0x5507('0x5'));var BPromise=require(_0x5507('0x6'));var Mustache=require(_0x5507('0x7'));var util=require(_0x5507('0x8'));var path=require(_0x5507('0x9'));var sox=require(_0x5507('0xa'));var csv=require(_0x5507('0xb'));var ejs=require(_0x5507('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5507('0xd'));var crypto=require(_0x5507('0xe'));var jsforce=require(_0x5507('0xf'));var deskjs=require(_0x5507('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5507('0x11'));var Redis=require(_0x5507('0x12'));var authService=require(_0x5507('0x13'));var qs=require(_0x5507('0x14'));var as=require(_0x5507('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5507('0x16'));var licenseUtil=require(_0x5507('0x17'));var db=require(_0x5507('0x18'))['db'];function respondWithStatusCode(_0x183718,_0x19183a){_0x19183a=_0x19183a||0xcc;return function(_0x24fc02){if(_0x24fc02){return _0x183718['sendStatus'](_0x19183a);}return _0x183718['status'](_0x19183a)['end']();};}function respondWithResult(_0x104084,_0x348881){_0x348881=_0x348881||0xc8;return function(_0x1cc584){if(_0x1cc584){return _0x104084[_0x5507('0x19')](_0x348881)[_0x5507('0x1a')](_0x1cc584);}};}function respondWithFilteredResult(_0x3fecfb,_0xcdd07c){return function(_0x3d6336){if(_0x3d6336){var _0xb180ef=typeof _0xcdd07c[_0x5507('0x1b')]===_0x5507('0x1c')&&typeof _0xcdd07c['limit']===_0x5507('0x1c');var _0xdfe3f0=_0x3d6336[_0x5507('0x1d')];var _0x2a2cf7=_0xb180ef?0x0:_0xcdd07c[_0x5507('0x1b')];var _0x2621a1=_0xb180ef?_0x3d6336['count']:_0xcdd07c[_0x5507('0x1b')]+_0xcdd07c['limit'];var _0x97e89d;if(_0x2621a1>=_0xdfe3f0){_0x2621a1=_0xdfe3f0;_0x97e89d=0xc8;}else{_0x97e89d=0xce;}_0x3fecfb[_0x5507('0x19')](_0x97e89d);return _0x3fecfb['set'](_0x5507('0x1e'),_0x2a2cf7+'-'+_0x2621a1+'/'+_0xdfe3f0)['json'](_0x3d6336);}return null;};}function patchUpdates(_0x9a698a){return function(_0x1953f8){try{jsonpatch[_0x5507('0x1f')](_0x1953f8,_0x9a698a,!![]);}catch(_0x9f060b){return BPromise[_0x5507('0x20')](_0x9f060b);}return _0x1953f8['save']();};}function saveUpdates(_0x52e327,_0x4af6c2){return function(_0x373051){if(_0x373051){return _0x373051[_0x5507('0x21')](_0x52e327)[_0x5507('0x22')](function(_0x1bfe21){return _0x1bfe21;});}return null;};}function removeEntity(_0x437aa7,_0x32f443){return function(_0x42f758){if(_0x42f758){return _0x42f758['destroy']()[_0x5507('0x22')](function(){_0x437aa7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23728d,_0x5578ab){return function(_0x5b50c4){if(!_0x5b50c4){_0x23728d[_0x5507('0x23')](0x194);}return _0x5b50c4;};}function handleError(_0x219f63,_0x3980d2){_0x3980d2=_0x3980d2||0x1f4;return function(_0x197d6b){logger['error'](_0x197d6b[_0x5507('0x24')]);if(_0x197d6b[_0x5507('0x25')]){delete _0x197d6b['name'];}_0x219f63['status'](_0x3980d2)[_0x5507('0x26')](_0x197d6b);};}exports['index']=function(_0xdc1420,_0x1f7841){var _0x25176d={},_0x3b3a92={},_0x4a93f2={'count':0x0,'rows':[]};var _0x2a393c=_[_0x5507('0x27')](db[_0x5507('0x28')][_0x5507('0x29')],function(_0x13b200){return{'name':_0x13b200[_0x5507('0x2a')],'type':_0x13b200[_0x5507('0x2b')]['key']};});_0x3b3a92[_0x5507('0x2c')]=_[_0x5507('0x27')](_0x2a393c,_0x5507('0x25'));_0x3b3a92[_0x5507('0x2d')]=_[_0x5507('0x2e')](_0xdc1420[_0x5507('0x2d')]);_0x3b3a92[_0x5507('0x2f')]=_[_0x5507('0x30')](_0x3b3a92[_0x5507('0x2c')],_0x3b3a92[_0x5507('0x2d')]);_0x25176d[_0x5507('0x31')]=_['intersection'](_0x3b3a92[_0x5507('0x2c')],qs['fields'](_0xdc1420[_0x5507('0x2d')]['fields']));_0x25176d[_0x5507('0x31')]=_0x25176d[_0x5507('0x31')][_0x5507('0x32')]?_0x25176d[_0x5507('0x31')]:_0x3b3a92[_0x5507('0x2c')];if(!_0xdc1420[_0x5507('0x2d')][_0x5507('0x33')]('nolimit')){_0x25176d[_0x5507('0x34')]=qs[_0x5507('0x34')](_0xdc1420[_0x5507('0x2d')][_0x5507('0x34')]);_0x25176d['offset']=qs['offset'](_0xdc1420['query'][_0x5507('0x1b')]);}_0x25176d[_0x5507('0x35')]=qs['sort'](_0xdc1420[_0x5507('0x2d')][_0x5507('0x36')]);_0x25176d['where']=qs[_0x5507('0x2f')](_[_0x5507('0x37')](_0xdc1420['query'],_0x3b3a92[_0x5507('0x2f')]),_0x2a393c);if(_0xdc1420['query']['filter']){_0x25176d[_0x5507('0x38')]=_[_0x5507('0x39')](_0x25176d['where'],{'$or':_[_0x5507('0x27')](_0x2a393c,function(_0x2bcd8d){if(_0x2bcd8d[_0x5507('0x2b')]!==_0x5507('0x3a')){var _0x123b94={};_0x123b94[_0x2bcd8d[_0x5507('0x25')]]={'$like':'%'+_0xdc1420[_0x5507('0x2d')]['filter']+'%'};return _0x123b94;}})});}_0x25176d=_['merge']({},_0x25176d,_0xdc1420[_0x5507('0x3b')]);var _0x2250cd={'where':_0x25176d[_0x5507('0x38')]};return db[_0x5507('0x28')]['count'](_0x2250cd)[_0x5507('0x22')](function(_0x1c6d46){_0x4a93f2['count']=_0x1c6d46;if(_0xdc1420['query'][_0x5507('0x3c')]){_0x25176d[_0x5507('0x3d')]=[{'all':!![]}];}return db[_0x5507('0x28')][_0x5507('0x3e')](_0x25176d);})[_0x5507('0x22')](function(_0x7542c6){_0x4a93f2[_0x5507('0x3f')]=_0x7542c6;return _0x4a93f2;})[_0x5507('0x22')](respondWithFilteredResult(_0x1f7841,_0x25176d))['catch'](handleError(_0x1f7841,null));};exports[_0x5507('0x40')]=function(_0x53268f,_0x360262){var _0x2c3c87={'raw':![],'where':{'id':_0x53268f['params']['id']}},_0x228143={};_0x228143['model']=_[_0x5507('0x2e')](db[_0x5507('0x28')][_0x5507('0x29')]);_0x228143['query']=_['keys'](_0x53268f[_0x5507('0x2d')]);_0x228143[_0x5507('0x2f')]=_['intersection'](_0x228143[_0x5507('0x2c')],_0x228143[_0x5507('0x2d')]);_0x2c3c87[_0x5507('0x31')]=_[_0x5507('0x30')](_0x228143['model'],qs[_0x5507('0x41')](_0x53268f[_0x5507('0x2d')][_0x5507('0x41')]));_0x2c3c87[_0x5507('0x31')]=_0x2c3c87['attributes'][_0x5507('0x32')]?_0x2c3c87[_0x5507('0x31')]:_0x228143[_0x5507('0x2c')];if(_0x53268f[_0x5507('0x2d')][_0x5507('0x3c')]){_0x2c3c87[_0x5507('0x3d')]=[{'all':!![]}];}_0x2c3c87=_['merge']({},_0x2c3c87,_0x53268f[_0x5507('0x3b')]);return db[_0x5507('0x28')][_0x5507('0x42')](_0x2c3c87)[_0x5507('0x22')](handleEntityNotFound(_0x360262,null))['then'](respondWithResult(_0x360262,null))['catch'](handleError(_0x360262,null));};exports[_0x5507('0x43')]=function(_0x2b20ba,_0x4862b3){return db[_0x5507('0x28')][_0x5507('0x43')](_0x2b20ba[_0x5507('0x44')],{})[_0x5507('0x22')](respondWithResult(_0x4862b3,0xc9))[_0x5507('0x45')](handleError(_0x4862b3,null));};exports['update']=function(_0x33a4da,_0x1da53b){if(_0x33a4da['body']['id']){delete _0x33a4da['body']['id'];}return db[_0x5507('0x28')][_0x5507('0x42')]({'where':{'id':_0x33a4da[_0x5507('0x46')]['id']}})[_0x5507('0x22')](handleEntityNotFound(_0x1da53b,null))[_0x5507('0x22')](saveUpdates(_0x33a4da[_0x5507('0x44')],null))[_0x5507('0x22')](respondWithResult(_0x1da53b,null))[_0x5507('0x45')](handleError(_0x1da53b,null));};exports['destroy']=function(_0x4b19ee,_0x16a24c){return db[_0x5507('0x28')]['find']({'where':{'id':_0x4b19ee[_0x5507('0x46')]['id']}})[_0x5507('0x22')](handleEntityNotFound(_0x16a24c,null))[_0x5507('0x22')](removeEntity(_0x16a24c,null))[_0x5507('0x45')](handleError(_0x16a24c,null));};exports[_0x5507('0x47')]=function(_0x1782b5,_0x25810d){return db[_0x5507('0x28')][_0x5507('0x47')]()['then'](respondWithResult(_0x25810d,null))[_0x5507('0x45')](handleError(_0x25810d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 328c390..ae50fb4 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 _0x46a5=['bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api','moment'];(function(_0x5a5f1d,_0x3359d8){var _0x597cf4=function(_0x5456d2){while(--_0x5456d2){_0x5a5f1d['push'](_0x5a5f1d['shift']());}};_0x597cf4(++_0x3359d8);}(_0x46a5,0x7e));var _0x546a=function(_0x3539a4,_0x158e77){_0x3539a4=_0x3539a4-0x0;var _0x292388=_0x46a5[_0x3539a4];return _0x292388;};'use strict';var _=require(_0x546a('0x0'));var util=require('util');var logger=require(_0x546a('0x1'))(_0x546a('0x2'));var moment=require(_0x546a('0x3'));var BPromise=require(_0x546a('0x4'));var rp=require(_0x546a('0x5'));var fs=require('fs');var path=require(_0x546a('0x6'));var rimraf=require(_0x546a('0x7'));var config=require('../../config/environment');var attributes=require(_0x546a('0x8'));module[_0x546a('0x9')]=function(_0x458201,_0xed7103){return _0x458201[_0x546a('0xa')](_0x546a('0xb'),attributes,{'tableName':_0x546a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f55=['exports','define','../../config/logger','api','moment','bluebird','rimraf','./integrationReport.attributes'];(function(_0x129139,_0x18e068){var _0x274966=function(_0x1f8dfb){while(--_0x1f8dfb){_0x129139['push'](_0x129139['shift']());}};_0x274966(++_0x18e068);}(_0x3f55,0x1b2));var _0x53f5=function(_0x290492,_0x18cfad){_0x290492=_0x290492-0x0;var _0x52b5bf=_0x3f55[_0x290492];return _0x52b5bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x53f5('0x0'))(_0x53f5('0x1'));var moment=require(_0x53f5('0x2'));var BPromise=require(_0x53f5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x53f5('0x4'));var config=require('../../config/environment');var attributes=require(_0x53f5('0x5'));module[_0x53f5('0x6')]=function(_0x7c248b,_0xd1c610){return _0x7c248b[_0x53f5('0x7')]('IntegrationReport',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 1f60448..217c49c 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','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','../../mysqldb','../../config/utils'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x687b,0x14a));var _0xb687=function(_0x53b0f8,_0x459130){_0x53b0f8=_0x53b0f8-0x0;var _0x133415=_0x687b[_0x53b0f8];return _0x133415;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0x6d38=['request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4ddfa7,_0x1adf74){var _0x293307=function(_0x38a933){while(--_0x38a933){_0x4ddfa7['push'](_0x4ddfa7['shift']());}};_0x293307(++_0x1adf74);}(_0x6d38,0x1ef));var _0x86d3=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x6d38[_0x484e36];return _0xafc85d;};'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']('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index 4e9275a..e5c2564 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 _0xea98=['Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','post','create','addInterval','addIntervals','put','update','delete','destroy','multer','util','path','express'];(function(_0x2e8f08,_0x8a7f2e){var _0x4b5fcb=function(_0x4a4723){while(--_0x4a4723){_0x2e8f08['push'](_0x2e8f08['shift']());}};_0x4b5fcb(++_0x8a7f2e);}(_0xea98,0xd8));var _0x8ea9=function(_0x2c9caa,_0x4ab15f){_0x2c9caa=_0x2c9caa-0x0;var _0x27bf35=_0xea98[_0x2c9caa];return _0x27bf35;};'use strict';var multer=require(_0x8ea9('0x0'));var util=require(_0x8ea9('0x1'));var path=require(_0x8ea9('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ea9('0x3'));var router=express[_0x8ea9('0x4')]();var fs_extra=require(_0x8ea9('0x5'));var auth=require(_0x8ea9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea9('0x7'));var controller=require(_0x8ea9('0x8'));router[_0x8ea9('0x9')]('/',auth[_0x8ea9('0xa')](),controller[_0x8ea9('0xb')]);router[_0x8ea9('0x9')]('/:id',auth[_0x8ea9('0xa')](),controller[_0x8ea9('0xc')]);router[_0x8ea9('0x9')](_0x8ea9('0xd'),auth[_0x8ea9('0xa')](),controller['getIntervals']);router[_0x8ea9('0xe')]('/',auth[_0x8ea9('0xa')](),controller[_0x8ea9('0xf')]);router[_0x8ea9('0xe')](_0x8ea9('0xd'),auth[_0x8ea9('0xa')](),controller[_0x8ea9('0x10')]);router[_0x8ea9('0xe')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x8ea9('0x11')]);router[_0x8ea9('0x12')]('/:id',auth[_0x8ea9('0xa')](),controller[_0x8ea9('0x13')]);router[_0x8ea9('0x14')]('/:id',auth[_0x8ea9('0xa')](),controller[_0x8ea9('0x15')]);module['exports']=router; \ No newline at end of file +var _0x46e1=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x46e1,0x155));var _0x146e=function(_0x4f69f2,_0xfa0ade){_0x4f69f2=_0x4f69f2-0x0;var _0x19661a=_0x46e1[_0x4f69f2];return _0x19661a;};'use strict';var multer=require(_0x146e('0x0'));var util=require(_0x146e('0x1'));var path=require(_0x146e('0x2'));var timeout=require(_0x146e('0x3'));var express=require(_0x146e('0x4'));var router=express[_0x146e('0x5')]();var fs_extra=require(_0x146e('0x6'));var auth=require(_0x146e('0x7'));var interaction=require(_0x146e('0x8'));var config=require(_0x146e('0x9'));var controller=require('./interval.controller');router[_0x146e('0xa')]('/',auth[_0x146e('0xb')](),controller[_0x146e('0xc')]);router[_0x146e('0xa')](_0x146e('0xd'),auth[_0x146e('0xb')](),controller[_0x146e('0xe')]);router['get'](_0x146e('0xf'),auth['isAuthenticated'](),controller[_0x146e('0x10')]);router[_0x146e('0x11')]('/',auth[_0x146e('0xb')](),controller[_0x146e('0x12')]);router[_0x146e('0x11')](_0x146e('0xf'),auth['isAuthenticated'](),controller['addInterval']);router[_0x146e('0x11')](_0x146e('0x13'),auth[_0x146e('0xb')](),controller[_0x146e('0x14')]);router[_0x146e('0x15')](_0x146e('0xd'),auth[_0x146e('0xb')](),controller[_0x146e('0x16')]);router['delete']('/:id',auth[_0x146e('0xb')](),controller[_0x146e('0x17')]);module[_0x146e('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 5574b5e..c543410 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 _0xb542=['STRING','sequelize'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xb542,0x6b));var _0x2b54=function(_0x2cba1a,_0x13f55b){_0x2cba1a=_0x2cba1a-0x0;var _0x47e4ab=_0xb542[_0x2cba1a];return _0x47e4ab;};'use strict';var Sequelize=require(_0x2b54('0x0'));module['exports']={'name':{'type':Sequelize[_0x2b54('0x1')]},'description':{'type':Sequelize[_0x2b54('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x9a20=['STRING','sequelize','exports'];(function(_0x107ca9,_0x26e2c7){var _0x56ec3f=function(_0x875905){while(--_0x875905){_0x107ca9['push'](_0x107ca9['shift']());}};_0x56ec3f(++_0x26e2c7);}(_0x9a20,0x1f0));var _0x09a2=function(_0x1c8af0,_0x41a0a5){_0x1c8af0=_0x1c8af0-0x0;var _0x4f0550=_0x9a20[_0x1c8af0];return _0x4f0550;};'use strict';var Sequelize=require(_0x09a2('0x0'));module[_0x09a2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x09a2('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 b351ec4..d31b53e 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 _0xf2e4=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','get','Intervals','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','keys','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','bulkCreate','findAll','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf2e4,0x17a));var _0x4f2e=function(_0x243d26,_0x36a724){_0x243d26=_0x243d26-0x0;var _0x187c2d=_0xf2e4[_0x243d26];return _0x187c2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f2e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f2e('0x1'));var rp=require(_0x4f2e('0x2'));var moment=require(_0x4f2e('0x3'));var BPromise=require(_0x4f2e('0x4'));var Mustache=require('mustache');var util=require(_0x4f2e('0x5'));var path=require(_0x4f2e('0x6'));var sox=require(_0x4f2e('0x7'));var csv=require(_0x4f2e('0x8'));var ejs=require(_0x4f2e('0x9'));var fs=require('fs');var fs_extra=require(_0x4f2e('0xa'));var _=require(_0x4f2e('0xb'));var squel=require(_0x4f2e('0xc'));var crypto=require(_0x4f2e('0xd'));var jsforce=require(_0x4f2e('0xe'));var deskjs=require(_0x4f2e('0xf'));var toCsv=require(_0x4f2e('0x8'));var querystring=require(_0x4f2e('0x10'));var Papa=require(_0x4f2e('0x11'));var Redis=require(_0x4f2e('0x12'));var authService=require(_0x4f2e('0x13'));var qs=require(_0x4f2e('0x14'));var as=require(_0x4f2e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f2e('0x16'))(_0x4f2e('0x17'));var utils=require('../../config/utils');var config=require(_0x4f2e('0x18'));var licenseUtil=require(_0x4f2e('0x19'));var db=require(_0x4f2e('0x1a'))['db'];var extensions=require(_0x4f2e('0x1b'));function respondWithStatusCode(_0x382a2e,_0x1d73e5){_0x1d73e5=_0x1d73e5||0xcc;return function(_0x342609){if(_0x342609){return _0x382a2e[_0x4f2e('0x1c')](_0x1d73e5);}return _0x382a2e['status'](_0x1d73e5)[_0x4f2e('0x1d')]();};}function respondWithResult(_0x553683,_0x4d26da){_0x4d26da=_0x4d26da||0xc8;return function(_0x485de7){if(_0x485de7){return _0x553683[_0x4f2e('0x1e')](_0x4d26da)['json'](_0x485de7);}};}function respondWithFilteredResult(_0x114902,_0x2cb02b){return function(_0x170a99){if(_0x170a99){var _0x3b4e53=typeof _0x2cb02b[_0x4f2e('0x1f')]===_0x4f2e('0x20')&&typeof _0x2cb02b[_0x4f2e('0x21')]==='undefined';var _0x2cddc5=_0x170a99['count'];var _0x112b96=_0x3b4e53?0x0:_0x2cb02b['offset'];var _0xa0a03f=_0x3b4e53?_0x170a99[_0x4f2e('0x22')]:_0x2cb02b[_0x4f2e('0x1f')]+_0x2cb02b[_0x4f2e('0x21')];var _0x214719;if(_0xa0a03f>=_0x2cddc5){_0xa0a03f=_0x2cddc5;_0x214719=0xc8;}else{_0x214719=0xce;}_0x114902[_0x4f2e('0x1e')](_0x214719);return _0x114902[_0x4f2e('0x23')]('Content-Range',_0x112b96+'-'+_0xa0a03f+'/'+_0x2cddc5)[_0x4f2e('0x24')](_0x170a99);}return null;};}function patchUpdates(_0x55e50c){return function(_0x5874d1){try{jsonpatch[_0x4f2e('0x25')](_0x5874d1,_0x55e50c,!![]);}catch(_0x947b8){return BPromise[_0x4f2e('0x26')](_0x947b8);}return _0x5874d1[_0x4f2e('0x27')]();};}function saveUpdates(_0x50d71a,_0x525667){return function(_0x92e108){if(_0x92e108){return _0x92e108[_0x4f2e('0x28')](_0x50d71a)['then'](function(_0x5ae2c6){return _0x5ae2c6;});}return null;};}function removeEntity(_0x465d64,_0x30f428){return function(_0x37863b){if(_0x37863b){return _0x37863b[_0x4f2e('0x29')]()[_0x4f2e('0x2a')](function(){var _0x2ebb61=_0x37863b[_0x4f2e('0x2b')]({'plain':!![]});var _0x2be284=_0x4f2e('0x2c');return db['UserProfileResource'][_0x4f2e('0x29')]({'where':{'type':_0x2be284,'resourceId':_0x2ebb61['id']}})[_0x4f2e('0x2a')](function(){return _0x37863b;});})[_0x4f2e('0x2a')](function(){_0x465d64[_0x4f2e('0x1e')](0xcc)[_0x4f2e('0x1d')]();});}};}function handleEntityNotFound(_0x293990,_0x2c8f32){return function(_0x3f90e3){if(!_0x3f90e3){_0x293990[_0x4f2e('0x1c')](0x194);}return _0x3f90e3;};}function handleError(_0x3703b7,_0x29a001){_0x29a001=_0x29a001||0x1f4;return function(_0x137982){logger[_0x4f2e('0x2d')](_0x137982[_0x4f2e('0x2e')]);if(_0x137982[_0x4f2e('0x2f')]){delete _0x137982[_0x4f2e('0x2f')];}_0x3703b7[_0x4f2e('0x1e')](_0x29a001)[_0x4f2e('0x30')](_0x137982);};}exports['index']=function(_0x4205c5,_0x42fef9){var _0x1fab16={},_0x367126={},_0x502cdf={'count':0x0,'rows':[]};var _0x30315c=_[_0x4f2e('0x31')](db[_0x4f2e('0x32')][_0x4f2e('0x33')],function(_0x437c14){return{'name':_0x437c14[_0x4f2e('0x34')],'type':_0x437c14[_0x4f2e('0x35')][_0x4f2e('0x36')]};});_0x367126[_0x4f2e('0x37')]=_[_0x4f2e('0x31')](_0x30315c,'name');_0x367126[_0x4f2e('0x38')]=_['keys'](_0x4205c5[_0x4f2e('0x38')]);_0x367126['filters']=_[_0x4f2e('0x39')](_0x367126[_0x4f2e('0x37')],_0x367126[_0x4f2e('0x38')]);_0x1fab16['attributes']=_['intersection'](_0x367126[_0x4f2e('0x37')],qs['fields'](_0x4205c5['query'][_0x4f2e('0x3a')]));_0x1fab16['attributes']=_0x1fab16[_0x4f2e('0x3b')][_0x4f2e('0x3c')]?_0x1fab16[_0x4f2e('0x3b')]:_0x367126[_0x4f2e('0x37')];if(!_0x4205c5[_0x4f2e('0x38')][_0x4f2e('0x3d')](_0x4f2e('0x3e'))){_0x1fab16['limit']=qs[_0x4f2e('0x21')](_0x4205c5[_0x4f2e('0x38')]['limit']);_0x1fab16[_0x4f2e('0x1f')]=qs[_0x4f2e('0x1f')](_0x4205c5[_0x4f2e('0x38')][_0x4f2e('0x1f')]);}_0x1fab16[_0x4f2e('0x3f')]=qs['sort'](_0x4205c5[_0x4f2e('0x38')][_0x4f2e('0x40')]);_0x1fab16[_0x4f2e('0x41')]=qs[_0x4f2e('0x42')](_[_0x4f2e('0x43')](_0x4205c5[_0x4f2e('0x38')],_0x367126[_0x4f2e('0x42')]),_0x30315c);if(_0x4205c5[_0x4f2e('0x38')][_0x4f2e('0x44')]){_0x1fab16[_0x4f2e('0x41')]=_[_0x4f2e('0x45')](_0x1fab16[_0x4f2e('0x41')],{'$or':_[_0x4f2e('0x31')](_0x30315c,function(_0x390535){if(_0x390535['type']!==_0x4f2e('0x46')){var _0x4f8b0d={};_0x4f8b0d[_0x390535[_0x4f2e('0x2f')]]={'$like':'%'+_0x4205c5[_0x4f2e('0x38')][_0x4f2e('0x44')]+'%'};return _0x4f8b0d;}})});}_0x1fab16=_['merge']({},_0x1fab16,_0x4205c5[_0x4f2e('0x47')]);var _0x562da1={'where':_0x1fab16['where']};return db[_0x4f2e('0x32')]['count'](_0x562da1)[_0x4f2e('0x2a')](function(_0x162919){_0x502cdf['count']=_0x162919;if(_0x4205c5[_0x4f2e('0x38')][_0x4f2e('0x48')]){_0x1fab16[_0x4f2e('0x49')]=[{'all':!![]}];}return db[_0x4f2e('0x32')]['findAll'](_0x1fab16);})['then'](function(_0x315e34){_0x502cdf[_0x4f2e('0x4a')]=_0x315e34;return _0x502cdf;})[_0x4f2e('0x2a')](respondWithFilteredResult(_0x42fef9,_0x1fab16))['catch'](handleError(_0x42fef9,null));};exports[_0x4f2e('0x4b')]=function(_0x4ae3e8,_0x108c3d){var _0x58400a={'raw':!![],'where':{'id':_0x4ae3e8['params']['id']}},_0x43b3d1={};_0x43b3d1[_0x4f2e('0x37')]=_['keys'](db['Interval'][_0x4f2e('0x33')]);_0x43b3d1[_0x4f2e('0x38')]=_[_0x4f2e('0x4c')](_0x4ae3e8[_0x4f2e('0x38')]);_0x43b3d1[_0x4f2e('0x42')]=_[_0x4f2e('0x39')](_0x43b3d1['model'],_0x43b3d1['query']);_0x58400a['attributes']=_[_0x4f2e('0x39')](_0x43b3d1[_0x4f2e('0x37')],qs[_0x4f2e('0x3a')](_0x4ae3e8['query'][_0x4f2e('0x3a')]));_0x58400a['attributes']=_0x58400a[_0x4f2e('0x3b')][_0x4f2e('0x3c')]?_0x58400a[_0x4f2e('0x3b')]:_0x43b3d1['model'];if(_0x4ae3e8['query'][_0x4f2e('0x48')]){_0x58400a['include']=[{'all':!![]}];}_0x58400a=_[_0x4f2e('0x45')]({},_0x58400a,_0x4ae3e8[_0x4f2e('0x47')]);return db['Interval'][_0x4f2e('0x4d')](_0x58400a)[_0x4f2e('0x2a')](handleEntityNotFound(_0x108c3d,null))[_0x4f2e('0x2a')](respondWithResult(_0x108c3d,null))[_0x4f2e('0x4e')](handleError(_0x108c3d,null));};exports['create']=function(_0x369da5,_0x1629c0){return db['Interval'][_0x4f2e('0x4f')](_0x369da5[_0x4f2e('0x50')],{})[_0x4f2e('0x2a')](function(_0x39c227){var _0x4be669=_0x369da5[_0x4f2e('0x51')][_0x4f2e('0x2b')]({'plain':!![]});if(!_0x4be669)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4be669[_0x4f2e('0x52')]===_0x4f2e('0x51')){var _0x4d8eb9=_0x39c227[_0x4f2e('0x2b')]({'plain':!![]});var _0x410a40=_0x4f2e('0x2c');return db[_0x4f2e('0x53')][_0x4f2e('0x4d')]({'where':{'name':_0x410a40,'userProfileId':_0x4be669[_0x4f2e('0x54')]},'raw':!![]})[_0x4f2e('0x2a')](function(_0x3c9823){if(_0x3c9823&&_0x3c9823[_0x4f2e('0x55')]===0x0){return db[_0x4f2e('0x56')][_0x4f2e('0x4f')]({'name':_0x4d8eb9[_0x4f2e('0x2f')],'resourceId':_0x4d8eb9['id'],'type':_0x3c9823[_0x4f2e('0x2f')],'sectionId':_0x3c9823['id']},{})['then'](function(){return _0x39c227;});}else{return _0x39c227;}})['catch'](function(_0x4a04fd){logger[_0x4f2e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a04fd);throw _0x4a04fd;});}return _0x39c227;})[_0x4f2e('0x2a')](respondWithResult(_0x1629c0,0xc9))[_0x4f2e('0x4e')](handleError(_0x1629c0,null));};exports['update']=function(_0x450c5a,_0x290634){if(_0x450c5a[_0x4f2e('0x50')]['id']){delete _0x450c5a['body']['id'];}return db['Interval'][_0x4f2e('0x4d')]({'where':{'id':_0x450c5a[_0x4f2e('0x57')]['id']}})[_0x4f2e('0x2a')](handleEntityNotFound(_0x290634,null))[_0x4f2e('0x2a')](saveUpdates(_0x450c5a[_0x4f2e('0x50')],null))[_0x4f2e('0x2a')](respondWithResult(_0x290634,null))[_0x4f2e('0x4e')](handleError(_0x290634,null));};exports['destroy']=function(_0x59a140,_0x32828e){return db['Interval'][_0x4f2e('0x4d')]({'where':{'id':_0x59a140[_0x4f2e('0x57')]['id']}})['then'](handleEntityNotFound(_0x32828e,null))[_0x4f2e('0x2a')](removeEntity(_0x32828e,null))[_0x4f2e('0x4e')](handleError(_0x32828e,null));};exports['addInterval']=function(_0x4a6fd1,_0xdd461a,_0x42e1dd){if(_0x4a6fd1[_0x4f2e('0x50')]['id']){delete _0x4a6fd1[_0x4f2e('0x50')]['id'];}return db['Interval'][_0x4f2e('0x4d')]({'where':{'id':_0x4a6fd1[_0x4f2e('0x57')]['id']}})[_0x4f2e('0x2a')](handleEntityNotFound(_0xdd461a,null))['then'](function(_0x385229){if(_0x385229){_0x4a6fd1[_0x4f2e('0x50')]['IntervalId']=_0x385229['id'];return db[_0x4f2e('0x32')][_0x4f2e('0x4f')](_0x4a6fd1[_0x4f2e('0x50')]);}})[_0x4f2e('0x2a')](respondWithResult(_0xdd461a,null))[_0x4f2e('0x4e')](handleError(_0xdd461a,null));};exports[_0x4f2e('0x58')]=function(_0x3811c4,_0x327dc9,_0x5176cc){var _0x45abc5={};var _0x5e6a72={};var _0x4f81da;var _0x1ef073;return db[_0x4f2e('0x32')][_0x4f2e('0x59')]({'where':{'id':_0x3811c4['params']['id']}})[_0x4f2e('0x2a')](handleEntityNotFound(_0x327dc9,null))[_0x4f2e('0x2a')](function(_0x4036b6){if(_0x4036b6){_0x4f81da=_0x4036b6;_0x5e6a72[_0x4f2e('0x37')]=_[_0x4f2e('0x4c')](db[_0x4f2e('0x32')][_0x4f2e('0x33')]);_0x5e6a72[_0x4f2e('0x38')]=_[_0x4f2e('0x4c')](_0x3811c4['query']);_0x5e6a72[_0x4f2e('0x42')]=_[_0x4f2e('0x39')](_0x5e6a72[_0x4f2e('0x37')],_0x5e6a72['query']);_0x45abc5[_0x4f2e('0x3b')]=_[_0x4f2e('0x39')](_0x5e6a72[_0x4f2e('0x37')],qs[_0x4f2e('0x3a')](_0x3811c4['query']['fields']));_0x45abc5[_0x4f2e('0x3b')]=_0x45abc5[_0x4f2e('0x3b')][_0x4f2e('0x3c')]?_0x45abc5[_0x4f2e('0x3b')]:_0x5e6a72[_0x4f2e('0x37')];_0x45abc5[_0x4f2e('0x3f')]=qs['sort'](_0x3811c4[_0x4f2e('0x38')][_0x4f2e('0x40')]);_0x45abc5['where']=qs[_0x4f2e('0x42')](_[_0x4f2e('0x43')](_0x3811c4[_0x4f2e('0x38')],_0x5e6a72[_0x4f2e('0x42')]));if(_0x3811c4['query'][_0x4f2e('0x44')]){_0x45abc5[_0x4f2e('0x41')]=_[_0x4f2e('0x45')](_0x45abc5[_0x4f2e('0x41')],{'$or':_[_0x4f2e('0x31')](_0x45abc5[_0x4f2e('0x3b')],function(_0x24824c){var _0x5cbfb8={};_0x5cbfb8[_0x24824c]={'$like':'%'+_0x3811c4[_0x4f2e('0x38')]['filter']+'%'};return _0x5cbfb8;})});}_0x45abc5=_[_0x4f2e('0x45')]({},_0x45abc5,_0x3811c4[_0x4f2e('0x47')]);return _0x4f81da['getIntervals'](_0x45abc5);}})['then'](function(_0x1f8273){if(_0x1f8273){_0x1ef073=_0x1f8273[_0x4f2e('0x3c')];if(!_0x3811c4[_0x4f2e('0x38')][_0x4f2e('0x3d')](_0x4f2e('0x3e'))){_0x45abc5['limit']=qs['limit'](_0x3811c4[_0x4f2e('0x38')][_0x4f2e('0x21')]);_0x45abc5[_0x4f2e('0x1f')]=qs[_0x4f2e('0x1f')](_0x3811c4[_0x4f2e('0x38')][_0x4f2e('0x1f')]);}return _0x4f81da[_0x4f2e('0x58')](_0x45abc5);}})[_0x4f2e('0x2a')](function(_0x350fb8){if(_0x350fb8){return _0x350fb8?{'count':_0x1ef073,'rows':_0x350fb8}:null;}})[_0x4f2e('0x2a')](respondWithResult(_0x327dc9,null))[_0x4f2e('0x4e')](handleError(_0x327dc9,null));};exports[_0x4f2e('0x5a')]=function(_0x53c09e,_0x7c803d,_0x39b1c9){return db[_0x4f2e('0x32')]['findOne']({'where':{'id':_0x53c09e[_0x4f2e('0x57')]['id']}})[_0x4f2e('0x2a')](handleEntityNotFound(_0x7c803d,null))[_0x4f2e('0x2a')](function(_0x3e245f){if(_0x3e245f){return db[_0x4f2e('0x5b')][_0x4f2e('0x5c')](function(_0x38ca36){return db[_0x4f2e('0x32')][_0x4f2e('0x29')]({'where':{'IntervalId':_0x53c09e[_0x4f2e('0x57')]['id']},'transaction':_0x38ca36})[_0x4f2e('0x2a')](function(_0x49cb00){var _0x577686=_[_0x4f2e('0x31')](_0x53c09e[_0x4f2e('0x50')],function(_0x3951ce){delete _0x3951ce['id'];_0x3951ce[_0x4f2e('0x5d')]=_0x53c09e[_0x4f2e('0x57')]['id'];return _0x3951ce;});return db[_0x4f2e('0x32')][_0x4f2e('0x5e')](_0x577686,{'transaction':_0x38ca36});});})[_0x4f2e('0x2a')](function(){return db[_0x4f2e('0x32')][_0x4f2e('0x5f')]({'where':{'IntervalId':_0x53c09e[_0x4f2e('0x57')]['id']}});});}})[_0x4f2e('0x2a')](respondWithResult(_0x7c803d,null))[_0x4f2e('0x4e')](handleError(_0x7c803d,null));}; \ No newline at end of file +var _0x50bd=['lodash','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','save','destroy','then','Intervals','name','send','index','map','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','Interval','findAll','params','keys','rawAttributes','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','pick','nolimit','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x9c1f48,_0x25da55){var _0x52ecd4=function(_0x47aef6){while(--_0x47aef6){_0x9c1f48['push'](_0x9c1f48['shift']());}};_0x52ecd4(++_0x25da55);}(_0x50bd,0x14e));var _0xd50b=function(_0x33ad90,_0x15a43a){_0x33ad90=_0x33ad90-0x0;var _0x4f8373=_0x50bd[_0x33ad90];return _0x4f8373;};'use strict';var emlformat=require(_0xd50b('0x0'));var rimraf=require(_0xd50b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd50b('0x2'));var moment=require('moment');var BPromise=require(_0xd50b('0x3'));var Mustache=require(_0xd50b('0x4'));var util=require(_0xd50b('0x5'));var path=require('path');var sox=require(_0xd50b('0x6'));var csv=require(_0xd50b('0x7'));var ejs=require(_0xd50b('0x8'));var fs=require('fs');var fs_extra=require(_0xd50b('0x9'));var _=require(_0xd50b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd50b('0x7'));var querystring=require('querystring');var Papa=require(_0xd50b('0xb'));var Redis=require(_0xd50b('0xc'));var authService=require(_0xd50b('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd50b('0xe'));var logger=require(_0xd50b('0xf'))(_0xd50b('0x10'));var utils=require(_0xd50b('0x11'));var config=require(_0xd50b('0x12'));var licenseUtil=require(_0xd50b('0x13'));var db=require(_0xd50b('0x14'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x4dedc6,_0x4e28c9){_0x4e28c9=_0x4e28c9||0xcc;return function(_0x221c50){if(_0x221c50){return _0x4dedc6[_0xd50b('0x15')](_0x4e28c9);}return _0x4dedc6['status'](_0x4e28c9)[_0xd50b('0x16')]();};}function respondWithResult(_0x3c6eaa,_0x38f218){_0x38f218=_0x38f218||0xc8;return function(_0x1240fc){if(_0x1240fc){return _0x3c6eaa[_0xd50b('0x17')](_0x38f218)[_0xd50b('0x18')](_0x1240fc);}};}function respondWithFilteredResult(_0x1fe6c9,_0x426888){return function(_0x21dc61){if(_0x21dc61){var _0x11393f=typeof _0x426888[_0xd50b('0x19')]===_0xd50b('0x1a')&&typeof _0x426888['limit']===_0xd50b('0x1a');var _0x13e9bd=_0x21dc61['count'];var _0x3cf408=_0x11393f?0x0:_0x426888['offset'];var _0x1afef3=_0x11393f?_0x21dc61[_0xd50b('0x1b')]:_0x426888[_0xd50b('0x19')]+_0x426888[_0xd50b('0x1c')];var _0x5e1841;if(_0x1afef3>=_0x13e9bd){_0x1afef3=_0x13e9bd;_0x5e1841=0xc8;}else{_0x5e1841=0xce;}_0x1fe6c9[_0xd50b('0x17')](_0x5e1841);return _0x1fe6c9[_0xd50b('0x1d')]('Content-Range',_0x3cf408+'-'+_0x1afef3+'/'+_0x13e9bd)[_0xd50b('0x18')](_0x21dc61);}return null;};}function patchUpdates(_0xc7f296){return function(_0x459aa0){try{jsonpatch[_0xd50b('0x1e')](_0x459aa0,_0xc7f296,!![]);}catch(_0x3c3195){return BPromise['reject'](_0x3c3195);}return _0x459aa0[_0xd50b('0x1f')]();};}function saveUpdates(_0x1f1ac7,_0x5e95de){return function(_0x60c494){if(_0x60c494){return _0x60c494['update'](_0x1f1ac7)['then'](function(_0x238876){return _0x238876;});}return null;};}function removeEntity(_0x2e71db,_0x2808f3){return function(_0x3f3c64){if(_0x3f3c64){return _0x3f3c64[_0xd50b('0x20')]()[_0xd50b('0x21')](function(){var _0x44ed9d=_0x3f3c64['get']({'plain':!![]});var _0x4e9859=_0xd50b('0x22');return db['UserProfileResource'][_0xd50b('0x20')]({'where':{'type':_0x4e9859,'resourceId':_0x44ed9d['id']}})['then'](function(){return _0x3f3c64;});})[_0xd50b('0x21')](function(){_0x2e71db[_0xd50b('0x17')](0xcc)[_0xd50b('0x16')]();});}};}function handleEntityNotFound(_0x204acf,_0x1cf58a){return function(_0x3a2fec){if(!_0x3a2fec){_0x204acf[_0xd50b('0x15')](0x194);}return _0x3a2fec;};}function handleError(_0x22552e,_0x125418){_0x125418=_0x125418||0x1f4;return function(_0x59d52f){logger['error'](_0x59d52f['stack']);if(_0x59d52f[_0xd50b('0x23')]){delete _0x59d52f[_0xd50b('0x23')];}_0x22552e[_0xd50b('0x17')](_0x125418)[_0xd50b('0x24')](_0x59d52f);};}exports[_0xd50b('0x25')]=function(_0x469fad,_0x413391){var _0x3fef0b={},_0x316fbb={},_0x541c26={'count':0x0,'rows':[]};var _0x5f313c=_[_0xd50b('0x26')](db['Interval']['rawAttributes'],function(_0x8e632e){return{'name':_0x8e632e[_0xd50b('0x27')],'type':_0x8e632e['type'][_0xd50b('0x28')]};});_0x316fbb[_0xd50b('0x29')]=_['map'](_0x5f313c,_0xd50b('0x23'));_0x316fbb[_0xd50b('0x2a')]=_['keys'](_0x469fad[_0xd50b('0x2a')]);_0x316fbb['filters']=_[_0xd50b('0x2b')](_0x316fbb[_0xd50b('0x29')],_0x316fbb[_0xd50b('0x2a')]);_0x3fef0b[_0xd50b('0x2c')]=_[_0xd50b('0x2b')](_0x316fbb[_0xd50b('0x29')],qs[_0xd50b('0x2d')](_0x469fad[_0xd50b('0x2a')][_0xd50b('0x2d')]));_0x3fef0b[_0xd50b('0x2c')]=_0x3fef0b['attributes'][_0xd50b('0x2e')]?_0x3fef0b[_0xd50b('0x2c')]:_0x316fbb[_0xd50b('0x29')];if(!_0x469fad[_0xd50b('0x2a')][_0xd50b('0x2f')]('nolimit')){_0x3fef0b[_0xd50b('0x1c')]=qs[_0xd50b('0x1c')](_0x469fad[_0xd50b('0x2a')][_0xd50b('0x1c')]);_0x3fef0b[_0xd50b('0x19')]=qs['offset'](_0x469fad[_0xd50b('0x2a')][_0xd50b('0x19')]);}_0x3fef0b[_0xd50b('0x30')]=qs['sort'](_0x469fad['query'][_0xd50b('0x31')]);_0x3fef0b[_0xd50b('0x32')]=qs[_0xd50b('0x33')](_['pick'](_0x469fad[_0xd50b('0x2a')],_0x316fbb[_0xd50b('0x33')]),_0x5f313c);if(_0x469fad[_0xd50b('0x2a')][_0xd50b('0x34')]){_0x3fef0b[_0xd50b('0x32')]=_['merge'](_0x3fef0b[_0xd50b('0x32')],{'$or':_['map'](_0x5f313c,function(_0x1e0002){if(_0x1e0002[_0xd50b('0x35')]!==_0xd50b('0x36')){var _0x270fba={};_0x270fba[_0x1e0002[_0xd50b('0x23')]]={'$like':'%'+_0x469fad[_0xd50b('0x2a')][_0xd50b('0x34')]+'%'};return _0x270fba;}})});}_0x3fef0b=_[_0xd50b('0x37')]({},_0x3fef0b,_0x469fad[_0xd50b('0x38')]);var _0x2d129e={'where':_0x3fef0b[_0xd50b('0x32')]};return db['Interval']['count'](_0x2d129e)[_0xd50b('0x21')](function(_0x311e24){_0x541c26[_0xd50b('0x1b')]=_0x311e24;if(_0x469fad[_0xd50b('0x2a')][_0xd50b('0x39')]){_0x3fef0b[_0xd50b('0x3a')]=[{'all':!![]}];}return db[_0xd50b('0x3b')][_0xd50b('0x3c')](_0x3fef0b);})[_0xd50b('0x21')](function(_0x28f74c){_0x541c26['rows']=_0x28f74c;return _0x541c26;})[_0xd50b('0x21')](respondWithFilteredResult(_0x413391,_0x3fef0b))['catch'](handleError(_0x413391,null));};exports['show']=function(_0xb449de,_0x2d76bc){var _0x1b57ea={'raw':!![],'where':{'id':_0xb449de[_0xd50b('0x3d')]['id']}},_0x5a17d2={};_0x5a17d2[_0xd50b('0x29')]=_[_0xd50b('0x3e')](db[_0xd50b('0x3b')][_0xd50b('0x3f')]);_0x5a17d2[_0xd50b('0x2a')]=_['keys'](_0xb449de['query']);_0x5a17d2[_0xd50b('0x33')]=_[_0xd50b('0x2b')](_0x5a17d2[_0xd50b('0x29')],_0x5a17d2[_0xd50b('0x2a')]);_0x1b57ea[_0xd50b('0x2c')]=_[_0xd50b('0x2b')](_0x5a17d2[_0xd50b('0x29')],qs[_0xd50b('0x2d')](_0xb449de[_0xd50b('0x2a')][_0xd50b('0x2d')]));_0x1b57ea['attributes']=_0x1b57ea[_0xd50b('0x2c')][_0xd50b('0x2e')]?_0x1b57ea[_0xd50b('0x2c')]:_0x5a17d2[_0xd50b('0x29')];if(_0xb449de[_0xd50b('0x2a')][_0xd50b('0x39')]){_0x1b57ea[_0xd50b('0x3a')]=[{'all':!![]}];}_0x1b57ea=_[_0xd50b('0x37')]({},_0x1b57ea,_0xb449de[_0xd50b('0x38')]);return db[_0xd50b('0x3b')][_0xd50b('0x40')](_0x1b57ea)[_0xd50b('0x21')](handleEntityNotFound(_0x2d76bc,null))[_0xd50b('0x21')](respondWithResult(_0x2d76bc,null))[_0xd50b('0x41')](handleError(_0x2d76bc,null));};exports[_0xd50b('0x42')]=function(_0x37bd53,_0x20d55d){return db[_0xd50b('0x3b')][_0xd50b('0x42')](_0x37bd53[_0xd50b('0x43')],{})[_0xd50b('0x21')](function(_0x2465d6){var _0x4fd830=_0x37bd53[_0xd50b('0x44')][_0xd50b('0x45')]({'plain':!![]});if(!_0x4fd830)throw new Error(_0xd50b('0x46'));if(_0x4fd830[_0xd50b('0x47')]===_0xd50b('0x44')){var _0x59baed=_0x2465d6[_0xd50b('0x45')]({'plain':!![]});var _0x5d61e4=_0xd50b('0x22');return db['UserProfileSection'][_0xd50b('0x40')]({'where':{'name':_0x5d61e4,'userProfileId':_0x4fd830[_0xd50b('0x48')]},'raw':!![]})[_0xd50b('0x21')](function(_0x2c3dd2){if(_0x2c3dd2&&_0x2c3dd2['autoAssociation']===0x0){return db[_0xd50b('0x49')]['create']({'name':_0x59baed['name'],'resourceId':_0x59baed['id'],'type':_0x2c3dd2[_0xd50b('0x23')],'sectionId':_0x2c3dd2['id']},{})[_0xd50b('0x21')](function(){return _0x2465d6;});}else{return _0x2465d6;}})[_0xd50b('0x41')](function(_0x327e28){logger[_0xd50b('0x4a')](_0xd50b('0x4b'),_0x327e28);throw _0x327e28;});}return _0x2465d6;})[_0xd50b('0x21')](respondWithResult(_0x20d55d,0xc9))['catch'](handleError(_0x20d55d,null));};exports[_0xd50b('0x4c')]=function(_0x2ed392,_0x3def90){if(_0x2ed392[_0xd50b('0x43')]['id']){delete _0x2ed392['body']['id'];}return db['Interval'][_0xd50b('0x40')]({'where':{'id':_0x2ed392[_0xd50b('0x3d')]['id']}})[_0xd50b('0x21')](handleEntityNotFound(_0x3def90,null))[_0xd50b('0x21')](saveUpdates(_0x2ed392['body'],null))['then'](respondWithResult(_0x3def90,null))[_0xd50b('0x41')](handleError(_0x3def90,null));};exports['destroy']=function(_0x130d72,_0x23deb8){return db['Interval'][_0xd50b('0x40')]({'where':{'id':_0x130d72[_0xd50b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x23deb8,null))['then'](removeEntity(_0x23deb8,null))[_0xd50b('0x41')](handleError(_0x23deb8,null));};exports[_0xd50b('0x4d')]=function(_0x58443c,_0x3426a6,_0x282d24){if(_0x58443c[_0xd50b('0x43')]['id']){delete _0x58443c[_0xd50b('0x43')]['id'];}return db[_0xd50b('0x3b')][_0xd50b('0x40')]({'where':{'id':_0x58443c['params']['id']}})[_0xd50b('0x21')](handleEntityNotFound(_0x3426a6,null))[_0xd50b('0x21')](function(_0x11ec47){if(_0x11ec47){_0x58443c[_0xd50b('0x43')][_0xd50b('0x4e')]=_0x11ec47['id'];return db[_0xd50b('0x3b')][_0xd50b('0x42')](_0x58443c['body']);}})['then'](respondWithResult(_0x3426a6,null))[_0xd50b('0x41')](handleError(_0x3426a6,null));};exports[_0xd50b('0x4f')]=function(_0x3446d3,_0x30c020,_0x1af6c2){var _0x1f5c6d={};var _0x190007={};var _0x3b6548;var _0x39fc89;return db[_0xd50b('0x3b')]['findOne']({'where':{'id':_0x3446d3['params']['id']}})[_0xd50b('0x21')](handleEntityNotFound(_0x30c020,null))[_0xd50b('0x21')](function(_0x8fe749){if(_0x8fe749){_0x3b6548=_0x8fe749;_0x190007[_0xd50b('0x29')]=_[_0xd50b('0x3e')](db[_0xd50b('0x3b')][_0xd50b('0x3f')]);_0x190007[_0xd50b('0x2a')]=_[_0xd50b('0x3e')](_0x3446d3['query']);_0x190007['filters']=_[_0xd50b('0x2b')](_0x190007['model'],_0x190007[_0xd50b('0x2a')]);_0x1f5c6d[_0xd50b('0x2c')]=_[_0xd50b('0x2b')](_0x190007[_0xd50b('0x29')],qs[_0xd50b('0x2d')](_0x3446d3[_0xd50b('0x2a')]['fields']));_0x1f5c6d[_0xd50b('0x2c')]=_0x1f5c6d['attributes'][_0xd50b('0x2e')]?_0x1f5c6d[_0xd50b('0x2c')]:_0x190007[_0xd50b('0x29')];_0x1f5c6d[_0xd50b('0x30')]=qs[_0xd50b('0x31')](_0x3446d3[_0xd50b('0x2a')][_0xd50b('0x31')]);_0x1f5c6d[_0xd50b('0x32')]=qs['filters'](_[_0xd50b('0x50')](_0x3446d3['query'],_0x190007['filters']));if(_0x3446d3[_0xd50b('0x2a')][_0xd50b('0x34')]){_0x1f5c6d[_0xd50b('0x32')]=_[_0xd50b('0x37')](_0x1f5c6d[_0xd50b('0x32')],{'$or':_[_0xd50b('0x26')](_0x1f5c6d['attributes'],function(_0x62a4a6){var _0x522ccc={};_0x522ccc[_0x62a4a6]={'$like':'%'+_0x3446d3[_0xd50b('0x2a')]['filter']+'%'};return _0x522ccc;})});}_0x1f5c6d=_[_0xd50b('0x37')]({},_0x1f5c6d,_0x3446d3[_0xd50b('0x38')]);return _0x3b6548[_0xd50b('0x4f')](_0x1f5c6d);}})['then'](function(_0x2cfe9c){if(_0x2cfe9c){_0x39fc89=_0x2cfe9c[_0xd50b('0x2e')];if(!_0x3446d3[_0xd50b('0x2a')][_0xd50b('0x2f')](_0xd50b('0x51'))){_0x1f5c6d[_0xd50b('0x1c')]=qs['limit'](_0x3446d3[_0xd50b('0x2a')][_0xd50b('0x1c')]);_0x1f5c6d[_0xd50b('0x19')]=qs['offset'](_0x3446d3[_0xd50b('0x2a')][_0xd50b('0x19')]);}return _0x3b6548[_0xd50b('0x4f')](_0x1f5c6d);}})[_0xd50b('0x21')](function(_0x188429){if(_0x188429){return _0x188429?{'count':_0x39fc89,'rows':_0x188429}:null;}})[_0xd50b('0x21')](respondWithResult(_0x30c020,null))['catch'](handleError(_0x30c020,null));};exports[_0xd50b('0x52')]=function(_0x2bae45,_0x2fbfe6,_0xbd4d12){return db[_0xd50b('0x3b')]['findOne']({'where':{'id':_0x2bae45['params']['id']}})['then'](handleEntityNotFound(_0x2fbfe6,null))['then'](function(_0x39b9a5){if(_0x39b9a5){return db[_0xd50b('0x53')][_0xd50b('0x54')](function(_0x30f360){return db[_0xd50b('0x3b')][_0xd50b('0x20')]({'where':{'IntervalId':_0x2bae45[_0xd50b('0x3d')]['id']},'transaction':_0x30f360})[_0xd50b('0x21')](function(_0x3c576a){var _0x9be41c=_[_0xd50b('0x26')](_0x2bae45[_0xd50b('0x43')],function(_0x33c756){delete _0x33c756['id'];_0x33c756['IntervalId']=_0x2bae45[_0xd50b('0x3d')]['id'];return _0x33c756;});return db[_0xd50b('0x3b')][_0xd50b('0x55')](_0x9be41c,{'transaction':_0x30f360});});})[_0xd50b('0x21')](function(){return db[_0xd50b('0x3b')][_0xd50b('0x3c')]({'where':{'IntervalId':_0x2bae45[_0xd50b('0x3d')]['id']}});});}})['then'](respondWithResult(_0x2fbfe6,null))[_0xd50b('0x41')](handleError(_0x2fbfe6,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7e44526..3ff95a5 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 _0xfb9f=['../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4955ae,_0x2276b2){var _0x2fb44d=function(_0x2082c7){while(--_0x2082c7){_0x4955ae['push'](_0x4955ae['shift']());}};_0x2fb44d(++_0x2276b2);}(_0xfb9f,0x8c));var _0xffb9=function(_0x32d0eb,_0x1882d6){_0x32d0eb=_0x32d0eb-0x0;var _0x494b6f=_0xfb9f[_0x32d0eb];return _0x494b6f;};'use strict';var _=require(_0xffb9('0x0'));var util=require(_0xffb9('0x1'));var logger=require(_0xffb9('0x2'))(_0xffb9('0x3'));var moment=require(_0xffb9('0x4'));var BPromise=require(_0xffb9('0x5'));var rp=require(_0xffb9('0x6'));var fs=require('fs');var path=require(_0xffb9('0x7'));var rimraf=require(_0xffb9('0x8'));var config=require(_0xffb9('0x9'));var attributes=require('./interval.attributes');var extensions=require(_0xffb9('0xa'));module[_0xffb9('0xb')]=function(_0x2f2090,_0x23e4e5){return _0x2f2090['define'](_0xffb9('0xc'),attributes,{'tableName':_0xffb9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x43dd16,_0x5df9f3){extensions[_0xffb9('0xe')](_0x2f2090,_0x43dd16);},'afterBulkCreate':function(_0x467817,_0x14d69d,_0x179628){_0x179628();extensions[_0xffb9('0xe')](_0x2f2090,_0x467817[0x0]);},'afterUpdate':function(_0x5f0aaa,_0x184d2d){extensions[_0xffb9('0xe')](_0x2f2090,_0x5f0aaa);},'afterDestroy':function(_0x239e4a,_0x4e0214){extensions[_0xffb9('0xe')](_0x2f2090,_0x239e4a);}}});}; \ No newline at end of file +var _0xf93e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','exports','Interval','rewrite','lodash','util'];(function(_0x5955c9,_0x1c0a2d){var _0x4e909c=function(_0x27f12d){while(--_0x27f12d){_0x5955c9['push'](_0x5955c9['shift']());}};_0x4e909c(++_0x1c0a2d);}(_0xf93e,0x1be));var _0xef93=function(_0x38187a,_0x435bc5){_0x38187a=_0x38187a-0x0;var _0x31857b=_0xf93e[_0x38187a];return _0x31857b;};'use strict';var _=require(_0xef93('0x0'));var util=require(_0xef93('0x1'));var logger=require(_0xef93('0x2'))(_0xef93('0x3'));var moment=require(_0xef93('0x4'));var BPromise=require(_0xef93('0x5'));var rp=require(_0xef93('0x6'));var fs=require('fs');var path=require(_0xef93('0x7'));var rimraf=require(_0xef93('0x8'));var config=require(_0xef93('0x9'));var attributes=require(_0xef93('0xa'));var extensions=require('../../components/extensions/rewrite');module[_0xef93('0xb')]=function(_0x1827cc,_0x19b3a1){return _0x1827cc['define'](_0xef93('0xc'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1727c6,_0x5af979){extensions[_0xef93('0xd')](_0x1827cc,_0x1727c6);},'afterBulkCreate':function(_0x380554,_0x193d7c,_0x329142){_0x329142();extensions[_0xef93('0xd')](_0x1827cc,_0x380554[0x0]);},'afterUpdate':function(_0x40584e,_0x33665c){extensions[_0xef93('0xd')](_0x1827cc,_0x40584e);},'afterDestroy':function(_0x1295cc,_0x2b7737){extensions[_0xef93('0xd')](_0x1827cc,_0x1295cc);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 39ff446..c412d75 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 35085aa..9cc771c 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x57a002,_0x1197b9){var _0x278d89=function(_0x3fc91f){while(--_0x3fc91f){_0x57a002['push'](_0x57a002['shift']());}};_0x278d89(++_0x1197b9);}(_0xadb5,0xad));var _0x5adb=function(_0x1421bf,_0x102adb){_0x1421bf=_0x1421bf-0x0;var _0x2df471=_0xadb5[_0x1421bf];return _0x2df471;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x181fa1,_0x3af8dd){var _0x4e285d=function(_0x497a09){while(--_0x497a09){_0x181fa1['push'](_0x181fa1['shift']());}};_0x4e285d(++_0x3af8dd);}(_0xadb5,0xad));var _0x5adb=function(_0x490224,_0x310175){_0x490224=_0x490224-0x0;var _0xfe0380=_0xadb5[_0x490224];return _0xfe0380;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a906184..a2adc71 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 _0xc99e=['bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','description','stringify','issuetype','Bug','fields','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','POST','application/json','Basic\x20','toString','setEncoding','utf8','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress'];(function(_0x2f6828,_0x500886){var _0x48df7e=function(_0x25b766){while(--_0x25b766){_0x2f6828['push'](_0x2f6828['shift']());}};_0x48df7e(++_0x500886);}(_0xc99e,0x1ce));var _0xec99=function(_0x53433b,_0x144fa6){_0x53433b=_0x53433b-0x0;var _0x215546=_0xc99e[_0x53433b];return _0x215546;};'use strict';var BPromise=require(_0xec99('0x0'));var https=require(_0xec99('0x1'));var logger=require(_0xec99('0x2'))(_0xec99('0x3'));var USERNAME=_0xec99('0x4');var PASSWORD=_0xec99('0x5');function openIssue(_0x329980,_0x23982b){var _0x329264={'fields':{'project':{'key':_0x329980[_0xec99('0x6')]||_0xec99('0x7')},'summary':(_0x329980['summary']||'Report')+'\x20from\x20'+_0x329980['ip'],'description':_0x329980[_0xec99('0x8')]||JSON[_0xec99('0x9')](_0x329980),'issuetype':{'name':_0x329980[_0xec99('0xa')]||_0xec99('0xb')}}};_0x329264[_0xec99('0xc')]['customfield_11500']=_0x329980[_0xec99('0xd')];_0x329264['fields'][_0xec99('0xe')]=_0x329980['oldToken'];_0x329264[_0xec99('0xc')][_0xec99('0xf')]=_0x329980[_0xec99('0x10')];_0x329264['fields'][_0xec99('0x11')]=_0x329980[_0xec99('0x12')];_0x329264[_0xec99('0xc')][_0xec99('0x13')]=_0x329980[_0xec99('0x14')];_0x329264[_0xec99('0xc')][_0xec99('0x15')]=_0x329980['ip'];var _0x549cf2={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0xec99('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xec99('0x17'),'Authorization':_0xec99('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xec99('0x19')]('base64')}};var _0x3c12a8=JSON[_0xec99('0x9')](_0x329264);var _0xe13761=https['request'](_0x549cf2,function(_0x51e1eb){_0x51e1eb[_0xec99('0x1a')](_0xec99('0x1b'));var _0x617afb='';_0x51e1eb['on']('data',function(_0x32cf7f){_0x617afb+=_0x32cf7f;});_0x51e1eb['on'](_0xec99('0x1c'),function(){if(_0x23982b){return _0x23982b[_0xec99('0x1d')](_0x51e1eb['statusCode'])[_0xec99('0x1e')](JSON[_0xec99('0x1f')](_0x617afb));}});});_0xe13761['on'](_0xec99('0x20'),function(_0x1410a7){if(_0x23982b){return _0x23982b[_0xec99('0x1d')](0x1f4)[_0xec99('0x1e')]({'errors':[{'message':_0xec99('0x21'),'type':_0xec99('0x22')}]});}});_0xe13761[_0xec99('0x23')](_0x3c12a8);_0xe13761[_0xec99('0x1c')]();}exports[_0xec99('0x24')]=openIssue;exports[_0xec99('0x25')]=function(_0x182bac,_0x350d19){_0x182bac[_0xec99('0x26')]['ip']=_0x182bac[_0xec99('0x27')][_0xec99('0x28')]||_0x182bac['connection'][_0xec99('0x29')]||_0x182bac['socket'][_0xec99('0x29')]||_0x182bac['connection']['socket'][_0xec99('0x29')];return openIssue(_0x182bac[_0xec99('0x26')],_0x350d19);}; \ No newline at end of file +var _0xe252=['customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','data','end','status','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','send','body','headers','connection','remoteAddress','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','Report','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','newToken','customfield_11503','name'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xe252,0xb5));var _0x2e25=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xe252[_0x1b3564];return _0x504069;};'use strict';var BPromise=require('bluebird');var https=require(_0x2e25('0x0'));var logger=require(_0x2e25('0x1'))(_0x2e25('0x2'));var USERNAME=_0x2e25('0x3');var PASSWORD=_0x2e25('0x4');function openIssue(_0x42ce6c,_0x11027c){var _0xea67c5={'fields':{'project':{'key':_0x42ce6c['key']||_0x2e25('0x5')},'summary':(_0x42ce6c['summary']||_0x2e25('0x6'))+'\x20from\x20'+_0x42ce6c['ip'],'description':_0x42ce6c[_0x2e25('0x7')]||JSON[_0x2e25('0x8')](_0x42ce6c),'issuetype':{'name':_0x42ce6c[_0x2e25('0x9')]||_0x2e25('0xa')}}};_0xea67c5['fields'][_0x2e25('0xb')]=_0x42ce6c[_0x2e25('0xc')];_0xea67c5[_0x2e25('0xd')][_0x2e25('0xe')]=_0x42ce6c[_0x2e25('0xf')];_0xea67c5[_0x2e25('0xd')]['customfield_11502']=_0x42ce6c[_0x2e25('0x10')];_0xea67c5[_0x2e25('0xd')][_0x2e25('0x11')]=_0x42ce6c[_0x2e25('0x12')];_0xea67c5['fields'][_0x2e25('0x13')]=_0x42ce6c[_0x2e25('0x14')];_0xea67c5[_0x2e25('0xd')][_0x2e25('0x15')]=_0x42ce6c['ip'];var _0x5d1b88={'host':_0x2e25('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x2e25('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x2e25('0x18'),'Authorization':_0x2e25('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x2e25('0x1a')]('base64')}};var _0x31de94=JSON[_0x2e25('0x8')](_0xea67c5);var _0x1ab3d7=https[_0x2e25('0x1b')](_0x5d1b88,function(_0x300db2){_0x300db2['setEncoding']('utf8');var _0x4f789c='';_0x300db2['on'](_0x2e25('0x1c'),function(_0xdfc0b2){_0x4f789c+=_0xdfc0b2;});_0x300db2['on'](_0x2e25('0x1d'),function(){if(_0x11027c){return _0x11027c[_0x2e25('0x1e')](_0x300db2['statusCode'])['json'](JSON[_0x2e25('0x1f')](_0x4f789c));}});});_0x1ab3d7['on'](_0x2e25('0x20'),function(_0x17b613){if(_0x11027c){return _0x11027c[_0x2e25('0x1e')](0x1f4)[_0x2e25('0x21')]({'errors':[{'message':_0x2e25('0x22'),'type':'api.jira'}]});}});_0x1ab3d7['write'](_0x31de94);_0x1ab3d7[_0x2e25('0x1d')]();}exports['openIssue']=openIssue;exports[_0x2e25('0x23')]=function(_0x1fbac6,_0x1f951b){_0x1fbac6[_0x2e25('0x24')]['ip']=_0x1fbac6[_0x2e25('0x25')]['x-forwarded-for']||_0x1fbac6[_0x2e25('0x26')]['remoteAddress']||_0x1fbac6['socket'][_0x2e25('0x27')]||_0x1fbac6[_0x2e25('0x26')]['socket']['remoteAddress'];return openIssue(_0x1fbac6[_0x2e25('0x24')],_0x1f951b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 213250d..d91ca90 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 _0x0713=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x4346b8,_0x2ef4ec){var _0x55cc6c=function(_0x47b97c){while(--_0x47b97c){_0x4346b8['push'](_0x4346b8['shift']());}};_0x55cc6c(++_0x2ef4ec);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')](_0x3071('0xd'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);module['exports']=router; \ No newline at end of file +var _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x318cee,_0x4ce68f){var _0x39bbbf=function(_0xcfe3f){while(--_0xcfe3f){_0x318cee['push'](_0x318cee['shift']());}};_0x39bbbf(++_0x4ce68f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0xcb91[_0x4067ac];return _0x53d74d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5208a6e..95b7baa 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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x5415fa,_0xdb087f){_0x5415fa=_0x5415fa-0x0;var _0x4b7cc6=_0x7a54[_0x5415fa];return _0x4b7cc6;};'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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x1e3c3b,_0x5d6309){_0x1e3c3b=_0x1e3c3b-0x0;var _0x5226ae=_0x7a54[_0x1e3c3b];return _0x5226ae;};'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 9317a30..f62c365 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 _0x598a=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','JscriptyAnswerReport','include','findAll','rows','show','rawAttributes','includeAll','find','create','body','catch','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','index','map'];(function(_0x5144df,_0x5314ad){var _0xd04353=function(_0x36e7be){while(--_0x36e7be){_0x5144df['push'](_0x5144df['shift']());}};_0xd04353(++_0x5314ad);}(_0x598a,0xfb));var _0xa598=function(_0x50213c,_0x4cef54){_0x50213c=_0x50213c-0x0;var _0x1a45e5=_0x598a[_0x50213c];return _0x1a45e5;};'use strict';var emlformat=require(_0xa598('0x0'));var rimraf=require(_0xa598('0x1'));var zipdir=require(_0xa598('0x2'));var jsonpatch=require(_0xa598('0x3'));var rp=require(_0xa598('0x4'));var moment=require('moment');var BPromise=require(_0xa598('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa598('0x6'));var csv=require(_0xa598('0x7'));var ejs=require(_0xa598('0x8'));var fs=require('fs');var fs_extra=require(_0xa598('0x9'));var _=require(_0xa598('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa598('0xb'));var deskjs=require(_0xa598('0xc'));var toCsv=require(_0xa598('0x7'));var querystring=require(_0xa598('0xd'));var Papa=require(_0xa598('0xe'));var Redis=require(_0xa598('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa598('0x10'));var hardwareService=require(_0xa598('0x11'));var logger=require(_0xa598('0x12'))(_0xa598('0x13'));var utils=require(_0xa598('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa598('0x15'));var db=require(_0xa598('0x16'))['db'];function respondWithStatusCode(_0x468710,_0x5041d4){_0x5041d4=_0x5041d4||0xcc;return function(_0xe8f905){if(_0xe8f905){return _0x468710['sendStatus'](_0x5041d4);}return _0x468710[_0xa598('0x17')](_0x5041d4)[_0xa598('0x18')]();};}function respondWithResult(_0xb3288a,_0x38afa9){_0x38afa9=_0x38afa9||0xc8;return function(_0x1949b5){if(_0x1949b5){return _0xb3288a[_0xa598('0x17')](_0x38afa9)[_0xa598('0x19')](_0x1949b5);}};}function respondWithFilteredResult(_0x41d3fe,_0x28534a){return function(_0x4b100b){if(_0x4b100b){var _0x88df86=typeof _0x28534a[_0xa598('0x1a')]===_0xa598('0x1b')&&typeof _0x28534a[_0xa598('0x1c')]===_0xa598('0x1b');var _0xecb39d=_0x4b100b[_0xa598('0x1d')];var _0x2746e3=_0x88df86?0x0:_0x28534a[_0xa598('0x1a')];var _0x44c872=_0x88df86?_0x4b100b['count']:_0x28534a[_0xa598('0x1a')]+_0x28534a[_0xa598('0x1c')];var _0x3fd5a4;if(_0x44c872>=_0xecb39d){_0x44c872=_0xecb39d;_0x3fd5a4=0xc8;}else{_0x3fd5a4=0xce;}_0x41d3fe[_0xa598('0x17')](_0x3fd5a4);return _0x41d3fe[_0xa598('0x1e')](_0xa598('0x1f'),_0x2746e3+'-'+_0x44c872+'/'+_0xecb39d)['json'](_0x4b100b);}return null;};}function patchUpdates(_0x56fc63){return function(_0x2923d5){try{jsonpatch['apply'](_0x2923d5,_0x56fc63,!![]);}catch(_0x3ac469){return BPromise[_0xa598('0x20')](_0x3ac469);}return _0x2923d5[_0xa598('0x21')]();};}function saveUpdates(_0x2222b0,_0x261868){return function(_0x24f4f0){if(_0x24f4f0){return _0x24f4f0['update'](_0x2222b0)[_0xa598('0x22')](function(_0x46d225){return _0x46d225;});}return null;};}function removeEntity(_0x470663,_0x14643d){return function(_0x802679){if(_0x802679){return _0x802679[_0xa598('0x23')]()[_0xa598('0x22')](function(){_0x470663[_0xa598('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x473d07,_0x414d2c){return function(_0x499565){if(!_0x499565){_0x473d07['sendStatus'](0x194);}return _0x499565;};}function handleError(_0x35b669,_0x559038){_0x559038=_0x559038||0x1f4;return function(_0x527c9f){logger[_0xa598('0x24')](_0x527c9f['stack']);if(_0x527c9f[_0xa598('0x25')]){delete _0x527c9f['name'];}_0x35b669['status'](_0x559038)[_0xa598('0x26')](_0x527c9f);};}exports[_0xa598('0x27')]=function(_0x554d3b,_0x16f00d){var _0x2823f7={},_0x3cdc59={},_0x29bfe3={'count':0x0,'rows':[]};var _0x523392=_[_0xa598('0x28')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x587d11){return{'name':_0x587d11[_0xa598('0x29')],'type':_0x587d11['type'][_0xa598('0x2a')]};});_0x3cdc59[_0xa598('0x2b')]=_[_0xa598('0x28')](_0x523392,'name');_0x3cdc59[_0xa598('0x2c')]=_[_0xa598('0x2d')](_0x554d3b[_0xa598('0x2c')]);_0x3cdc59[_0xa598('0x2e')]=_[_0xa598('0x2f')](_0x3cdc59['model'],_0x3cdc59[_0xa598('0x2c')]);_0x2823f7[_0xa598('0x30')]=_[_0xa598('0x2f')](_0x3cdc59[_0xa598('0x2b')],qs['fields'](_0x554d3b[_0xa598('0x2c')][_0xa598('0x31')]));_0x2823f7['attributes']=_0x2823f7['attributes'][_0xa598('0x32')]?_0x2823f7[_0xa598('0x30')]:_0x3cdc59[_0xa598('0x2b')];if(!_0x554d3b['query'][_0xa598('0x33')](_0xa598('0x34'))){_0x2823f7['limit']=qs[_0xa598('0x1c')](_0x554d3b['query'][_0xa598('0x1c')]);_0x2823f7[_0xa598('0x1a')]=qs['offset'](_0x554d3b[_0xa598('0x2c')][_0xa598('0x1a')]);}_0x2823f7['order']=qs[_0xa598('0x35')](_0x554d3b[_0xa598('0x2c')][_0xa598('0x35')]);_0x2823f7['where']=qs[_0xa598('0x2e')](_[_0xa598('0x36')](_0x554d3b[_0xa598('0x2c')],_0x3cdc59['filters']),_0x523392);if(_0x554d3b[_0xa598('0x2c')]['filter']){_0x2823f7[_0xa598('0x37')]=_[_0xa598('0x38')](_0x2823f7[_0xa598('0x37')],{'$or':_['map'](_0x523392,function(_0x5bd98a){if(_0x5bd98a['type']!=='VIRTUAL'){var _0x3358ad={};_0x3358ad[_0x5bd98a[_0xa598('0x25')]]={'$like':'%'+_0x554d3b[_0xa598('0x2c')][_0xa598('0x39')]+'%'};return _0x3358ad;}})});}_0x2823f7=_[_0xa598('0x38')]({},_0x2823f7,_0x554d3b[_0xa598('0x3a')]);var _0x4526d7={'where':_0x2823f7[_0xa598('0x37')]};return db[_0xa598('0x3b')][_0xa598('0x1d')](_0x4526d7)['then'](function(_0x1833fb){_0x29bfe3[_0xa598('0x1d')]=_0x1833fb;if(_0x554d3b[_0xa598('0x2c')]['includeAll']){_0x2823f7[_0xa598('0x3c')]=[{'all':!![]}];}return db[_0xa598('0x3b')][_0xa598('0x3d')](_0x2823f7);})[_0xa598('0x22')](function(_0x307497){_0x29bfe3[_0xa598('0x3e')]=_0x307497;return _0x29bfe3;})['then'](respondWithFilteredResult(_0x16f00d,_0x2823f7))['catch'](handleError(_0x16f00d,null));};exports[_0xa598('0x3f')]=function(_0x10f2f7,_0x5a772d){var _0x45bc68={'raw':!![],'where':{'id':_0x10f2f7['params']['id']}},_0x54bb73={};_0x54bb73[_0xa598('0x2b')]=_['keys'](db[_0xa598('0x3b')][_0xa598('0x40')]);_0x54bb73[_0xa598('0x2c')]=_[_0xa598('0x2d')](_0x10f2f7[_0xa598('0x2c')]);_0x54bb73[_0xa598('0x2e')]=_[_0xa598('0x2f')](_0x54bb73[_0xa598('0x2b')],_0x54bb73[_0xa598('0x2c')]);_0x45bc68[_0xa598('0x30')]=_['intersection'](_0x54bb73[_0xa598('0x2b')],qs[_0xa598('0x31')](_0x10f2f7[_0xa598('0x2c')][_0xa598('0x31')]));_0x45bc68[_0xa598('0x30')]=_0x45bc68[_0xa598('0x30')][_0xa598('0x32')]?_0x45bc68['attributes']:_0x54bb73[_0xa598('0x2b')];if(_0x10f2f7[_0xa598('0x2c')][_0xa598('0x41')]){_0x45bc68[_0xa598('0x3c')]=[{'all':!![]}];}_0x45bc68=_[_0xa598('0x38')]({},_0x45bc68,_0x10f2f7[_0xa598('0x3a')]);return db[_0xa598('0x3b')][_0xa598('0x42')](_0x45bc68)['then'](handleEntityNotFound(_0x5a772d,null))[_0xa598('0x22')](respondWithResult(_0x5a772d,null))['catch'](handleError(_0x5a772d,null));};exports[_0xa598('0x43')]=function(_0x1ec7d8,_0x2710d){return db[_0xa598('0x3b')][_0xa598('0x43')](_0x1ec7d8[_0xa598('0x44')],{})[_0xa598('0x22')](respondWithResult(_0x2710d,0xc9))[_0xa598('0x45')](handleError(_0x2710d,null));};exports[_0xa598('0x46')]=function(_0x51e0e9,_0x57e82c){if(_0x51e0e9[_0xa598('0x44')]['id']){delete _0x51e0e9[_0xa598('0x44')]['id'];}return db[_0xa598('0x3b')][_0xa598('0x42')]({'where':{'id':_0x51e0e9['params']['id']}})['then'](handleEntityNotFound(_0x57e82c,null))['then'](saveUpdates(_0x51e0e9[_0xa598('0x44')],null))[_0xa598('0x22')](respondWithResult(_0x57e82c,null))['catch'](handleError(_0x57e82c,null));};exports['destroy']=function(_0x54b287,_0x315a01){return db[_0xa598('0x3b')][_0xa598('0x42')]({'where':{'id':_0x54b287[_0xa598('0x47')]['id']}})['then'](handleEntityNotFound(_0x315a01,null))[_0xa598('0x22')](removeEntity(_0x315a01,null))[_0xa598('0x45')](handleError(_0x315a01,null));};exports[_0xa598('0x48')]=function(_0x3a4ec4,_0x333182){return db[_0xa598('0x3b')][_0xa598('0x48')]()[_0xa598('0x22')](respondWithResult(_0x333182,null))[_0xa598('0x45')](handleError(_0x333182,null));}; \ No newline at end of file +var _0x5162=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','intersection','find','create','body','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5162,0x103));var _0x2516=function(_0x446f11,_0x95cf21){_0x446f11=_0x446f11-0x0;var _0x385cb5=_0x5162[_0x446f11];return _0x385cb5;};'use strict';var emlformat=require(_0x2516('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2516('0x1'));var BPromise=require(_0x2516('0x2'));var Mustache=require(_0x2516('0x3'));var util=require(_0x2516('0x4'));var path=require(_0x2516('0x5'));var sox=require(_0x2516('0x6'));var csv=require(_0x2516('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2516('0x8'));var crypto=require(_0x2516('0x9'));var jsforce=require(_0x2516('0xa'));var deskjs=require(_0x2516('0xb'));var toCsv=require(_0x2516('0x7'));var querystring=require(_0x2516('0xc'));var Papa=require(_0x2516('0xd'));var Redis=require('ioredis');var authService=require(_0x2516('0xe'));var qs=require(_0x2516('0xf'));var as=require(_0x2516('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2516('0x11'));var licenseUtil=require(_0x2516('0x12'));var db=require(_0x2516('0x13'))['db'];function respondWithStatusCode(_0x3ef6ff,_0x56c69c){_0x56c69c=_0x56c69c||0xcc;return function(_0x33496b){if(_0x33496b){return _0x3ef6ff[_0x2516('0x14')](_0x56c69c);}return _0x3ef6ff[_0x2516('0x15')](_0x56c69c)[_0x2516('0x16')]();};}function respondWithResult(_0x42c771,_0x558d20){_0x558d20=_0x558d20||0xc8;return function(_0x3e5e0f){if(_0x3e5e0f){return _0x42c771[_0x2516('0x15')](_0x558d20)[_0x2516('0x17')](_0x3e5e0f);}};}function respondWithFilteredResult(_0x181a28,_0x2637e8){return function(_0x2ec31f){if(_0x2ec31f){var _0x19aacb=typeof _0x2637e8[_0x2516('0x18')]===_0x2516('0x19')&&typeof _0x2637e8['limit']===_0x2516('0x19');var _0x1ced29=_0x2ec31f[_0x2516('0x1a')];var _0x564d05=_0x19aacb?0x0:_0x2637e8[_0x2516('0x18')];var _0x5e96c7=_0x19aacb?_0x2ec31f['count']:_0x2637e8[_0x2516('0x18')]+_0x2637e8[_0x2516('0x1b')];var _0x151168;if(_0x5e96c7>=_0x1ced29){_0x5e96c7=_0x1ced29;_0x151168=0xc8;}else{_0x151168=0xce;}_0x181a28[_0x2516('0x15')](_0x151168);return _0x181a28[_0x2516('0x1c')](_0x2516('0x1d'),_0x564d05+'-'+_0x5e96c7+'/'+_0x1ced29)[_0x2516('0x17')](_0x2ec31f);}return null;};}function patchUpdates(_0x113616){return function(_0x248c5a){try{jsonpatch[_0x2516('0x1e')](_0x248c5a,_0x113616,!![]);}catch(_0x39ba5b){return BPromise[_0x2516('0x1f')](_0x39ba5b);}return _0x248c5a[_0x2516('0x20')]();};}function saveUpdates(_0x4fb7d9,_0x559a3e){return function(_0x12db4d){if(_0x12db4d){return _0x12db4d[_0x2516('0x21')](_0x4fb7d9)[_0x2516('0x22')](function(_0x2d5b1b){return _0x2d5b1b;});}return null;};}function removeEntity(_0x3ffb6d,_0x32de7a){return function(_0x3d906d){if(_0x3d906d){return _0x3d906d[_0x2516('0x23')]()['then'](function(){_0x3ffb6d[_0x2516('0x15')](0xcc)[_0x2516('0x16')]();});}};}function handleEntityNotFound(_0x774b60,_0x434d54){return function(_0x47f4fb){if(!_0x47f4fb){_0x774b60[_0x2516('0x14')](0x194);}return _0x47f4fb;};}function handleError(_0x30eeb9,_0x1f722c){_0x1f722c=_0x1f722c||0x1f4;return function(_0x3d728a){logger[_0x2516('0x24')](_0x3d728a['stack']);if(_0x3d728a[_0x2516('0x25')]){delete _0x3d728a[_0x2516('0x25')];}_0x30eeb9[_0x2516('0x15')](_0x1f722c)[_0x2516('0x26')](_0x3d728a);};}exports[_0x2516('0x27')]=function(_0x285e67,_0x556f01){var _0x136893={},_0x20dc9f={},_0x493a3e={'count':0x0,'rows':[]};var _0x19d90d=_[_0x2516('0x28')](db[_0x2516('0x29')][_0x2516('0x2a')],function(_0x539704){return{'name':_0x539704[_0x2516('0x2b')],'type':_0x539704[_0x2516('0x2c')][_0x2516('0x2d')]};});_0x20dc9f[_0x2516('0x2e')]=_[_0x2516('0x28')](_0x19d90d,_0x2516('0x25'));_0x20dc9f[_0x2516('0x2f')]=_[_0x2516('0x30')](_0x285e67[_0x2516('0x2f')]);_0x20dc9f[_0x2516('0x31')]=_['intersection'](_0x20dc9f[_0x2516('0x2e')],_0x20dc9f['query']);_0x136893[_0x2516('0x32')]=_['intersection'](_0x20dc9f[_0x2516('0x2e')],qs['fields'](_0x285e67[_0x2516('0x2f')][_0x2516('0x33')]));_0x136893[_0x2516('0x32')]=_0x136893[_0x2516('0x32')][_0x2516('0x34')]?_0x136893[_0x2516('0x32')]:_0x20dc9f[_0x2516('0x2e')];if(!_0x285e67[_0x2516('0x2f')][_0x2516('0x35')]('nolimit')){_0x136893[_0x2516('0x1b')]=qs[_0x2516('0x1b')](_0x285e67[_0x2516('0x2f')][_0x2516('0x1b')]);_0x136893['offset']=qs['offset'](_0x285e67[_0x2516('0x2f')][_0x2516('0x18')]);}_0x136893[_0x2516('0x36')]=qs[_0x2516('0x37')](_0x285e67[_0x2516('0x2f')][_0x2516('0x37')]);_0x136893[_0x2516('0x38')]=qs[_0x2516('0x31')](_[_0x2516('0x39')](_0x285e67[_0x2516('0x2f')],_0x20dc9f['filters']),_0x19d90d);if(_0x285e67['query'][_0x2516('0x3a')]){_0x136893[_0x2516('0x38')]=_['merge'](_0x136893['where'],{'$or':_[_0x2516('0x28')](_0x19d90d,function(_0x3b310f){if(_0x3b310f['type']!==_0x2516('0x3b')){var _0x52ef6b={};_0x52ef6b[_0x3b310f[_0x2516('0x25')]]={'$like':'%'+_0x285e67[_0x2516('0x2f')]['filter']+'%'};return _0x52ef6b;}})});}_0x136893=_[_0x2516('0x3c')]({},_0x136893,_0x285e67[_0x2516('0x3d')]);var _0x155cf7={'where':_0x136893[_0x2516('0x38')]};return db[_0x2516('0x29')][_0x2516('0x1a')](_0x155cf7)[_0x2516('0x22')](function(_0x2371a8){_0x493a3e[_0x2516('0x1a')]=_0x2371a8;if(_0x285e67[_0x2516('0x2f')][_0x2516('0x3e')]){_0x136893[_0x2516('0x3f')]=[{'all':!![]}];}return db[_0x2516('0x29')]['findAll'](_0x136893);})[_0x2516('0x22')](function(_0x1bc0e){_0x493a3e['rows']=_0x1bc0e;return _0x493a3e;})[_0x2516('0x22')](respondWithFilteredResult(_0x556f01,_0x136893))[_0x2516('0x40')](handleError(_0x556f01,null));};exports[_0x2516('0x41')]=function(_0x1afefb,_0x421c58){var _0x582cb6={'raw':!![],'where':{'id':_0x1afefb[_0x2516('0x42')]['id']}},_0x1a8d2d={};_0x1a8d2d[_0x2516('0x2e')]=_[_0x2516('0x30')](db[_0x2516('0x29')][_0x2516('0x2a')]);_0x1a8d2d['query']=_[_0x2516('0x30')](_0x1afefb[_0x2516('0x2f')]);_0x1a8d2d[_0x2516('0x31')]=_[_0x2516('0x43')](_0x1a8d2d[_0x2516('0x2e')],_0x1a8d2d[_0x2516('0x2f')]);_0x582cb6[_0x2516('0x32')]=_['intersection'](_0x1a8d2d[_0x2516('0x2e')],qs['fields'](_0x1afefb[_0x2516('0x2f')]['fields']));_0x582cb6[_0x2516('0x32')]=_0x582cb6[_0x2516('0x32')][_0x2516('0x34')]?_0x582cb6['attributes']:_0x1a8d2d['model'];if(_0x1afefb[_0x2516('0x2f')][_0x2516('0x3e')]){_0x582cb6['include']=[{'all':!![]}];}_0x582cb6=_['merge']({},_0x582cb6,_0x1afefb[_0x2516('0x3d')]);return db[_0x2516('0x29')][_0x2516('0x44')](_0x582cb6)['then'](handleEntityNotFound(_0x421c58,null))[_0x2516('0x22')](respondWithResult(_0x421c58,null))['catch'](handleError(_0x421c58,null));};exports[_0x2516('0x45')]=function(_0x39fd32,_0x318128){return db[_0x2516('0x29')]['create'](_0x39fd32[_0x2516('0x46')],{})[_0x2516('0x22')](respondWithResult(_0x318128,0xc9))[_0x2516('0x40')](handleError(_0x318128,null));};exports[_0x2516('0x21')]=function(_0x43874c,_0x482883){if(_0x43874c[_0x2516('0x46')]['id']){delete _0x43874c[_0x2516('0x46')]['id'];}return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x43874c['params']['id']}})[_0x2516('0x22')](handleEntityNotFound(_0x482883,null))[_0x2516('0x22')](saveUpdates(_0x43874c[_0x2516('0x46')],null))[_0x2516('0x22')](respondWithResult(_0x482883,null))[_0x2516('0x40')](handleError(_0x482883,null));};exports['destroy']=function(_0x1c4be3,_0x1aa854){return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x1c4be3[_0x2516('0x42')]['id']}})[_0x2516('0x22')](handleEntityNotFound(_0x1aa854,null))['then'](removeEntity(_0x1aa854,null))['catch'](handleError(_0x1aa854,null));};exports['describe']=function(_0x323590,_0x4f7eb4){return db['JscriptyAnswerReport']['describe']()[_0x2516('0x22')](respondWithResult(_0x4f7eb4,null))[_0x2516('0x40')](handleError(_0x4f7eb4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 73cc570..b99fda5 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 _0x6926=['./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','request-promise','rimraf','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6926,0x1e9));var _0x6692=function(_0x53d56f,_0xbba3ad){_0x53d56f=_0x53d56f-0x0;var _0x7b6ebd=_0x6926[_0x53d56f];return _0x7b6ebd;};'use strict';var _=require(_0x6692('0x0'));var util=require(_0x6692('0x1'));var logger=require('../../config/logger')(_0x6692('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6692('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6692('0x4'));var config=require(_0x6692('0x5'));var attributes=require(_0x6692('0x6'));module[_0x6692('0x7')]=function(_0x63f3c2,_0x242781){return _0x63f3c2[_0x6692('0x8')](_0x6692('0x9'),attributes,{'tableName':_0x6692('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0285=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0xdf30dc,_0x470d25){var _0x9442f1=function(_0x593e85){while(--_0x593e85){_0xdf30dc['push'](_0xdf30dc['shift']());}};_0x9442f1(++_0x470d25);}(_0x0285,0x148));var _0x5028=function(_0x34c956,_0x2eed30){_0x34c956=_0x34c956-0x0;var _0x1bf1d0=_0x0285[_0x34c956];return _0x1bf1d0;};'use strict';var _=require(_0x5028('0x0'));var util=require(_0x5028('0x1'));var logger=require(_0x5028('0x2'))(_0x5028('0x3'));var moment=require(_0x5028('0x4'));var BPromise=require(_0x5028('0x5'));var rp=require(_0x5028('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5028('0x7'));var config=require(_0x5028('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x5028('0x9')]=function(_0x4ace4e,_0x242697){return _0x4ace4e[_0x5028('0xa')](_0x5028('0xb'),attributes,{'tableName':_0x5028('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index c28b9a8..456ff0c 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 _0xd335=['http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','request\x20sent','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xd335,0x181));var _0x5d33=function(_0x407a66,_0x4f6984){_0x407a66=_0x407a66-0x0;var _0x121b0e=_0xd335[_0x407a66];return _0x121b0e;};'use strict';var _=require(_0x5d33('0x0'));var util=require('util');var moment=require(_0x5d33('0x1'));var BPromise=require(_0x5d33('0x2'));var rs=require(_0x5d33('0x3'));var fs=require('fs');var Redis=require(_0x5d33('0x4'));var db=require(_0x5d33('0x5'))['db'];var utils=require(_0x5d33('0x6'));var logger=require(_0x5d33('0x7'))(_0x5d33('0x8'));var config=require('../../config/environment');var jayson=require(_0x5d33('0x9'));var client=jayson[_0x5d33('0xa')][_0x5d33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17b723,_0x283f44,_0x303ebc){return new BPromise(function(_0x2e6ecf,_0x5c919d){return client[_0x5d33('0xc')](_0x17b723,_0x303ebc)[_0x5d33('0xd')](function(_0x5d49b7){logger[_0x5d33('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x283f44,'request\x20sent');logger['debug'](_0x5d33('0xf'),_0x283f44,'request\x20sent',JSON[_0x5d33('0x10')](_0x5d49b7));if(_0x5d49b7[_0x5d33('0x11')]){if(_0x5d49b7[_0x5d33('0x11')]['code']===0x1f4){logger[_0x5d33('0x11')](_0x5d33('0x12'),_0x283f44,_0x5d49b7['error'][_0x5d33('0x13')]);return _0x5c919d(_0x5d49b7[_0x5d33('0x11')][_0x5d33('0x13')]);}logger['error'](_0x5d33('0x12'),_0x283f44,_0x5d49b7[_0x5d33('0x11')][_0x5d33('0x13')]);return _0x2e6ecf(_0x5d49b7['error'][_0x5d33('0x13')]);}else{logger['info'](_0x5d33('0x12'),_0x283f44,_0x5d33('0x14'));_0x2e6ecf(_0x5d49b7[_0x5d33('0x15')][_0x5d33('0x13')]);}})['catch'](function(_0x43be2d){logger[_0x5d33('0x11')](_0x5d33('0x12'),_0x283f44,_0x43be2d);_0x5c919d(_0x43be2d);});});} \ No newline at end of file +var _0xd5e6=['../../mysqldb','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x4070f8,_0x599ee1){var _0x4f1fa6=function(_0x50d888){while(--_0x50d888){_0x4070f8['push'](_0x4070f8['shift']());}};_0x4f1fa6(++_0x599ee1);}(_0xd5e6,0x9c));var _0x6d5e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd5e6[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x6d5e('0x0'));var util=require(_0x6d5e('0x1'));var moment=require('moment');var BPromise=require(_0x6d5e('0x2'));var rs=require(_0x6d5e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d5e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6d5e('0x5'));var config=require('../../config/environment');var jayson=require(_0x6d5e('0x6'));var client=jayson[_0x6d5e('0x7')][_0x6d5e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50edb9,_0x15a678,_0xc382de){return new BPromise(function(_0x31c7ab,_0x294bd8){return client[_0x6d5e('0x9')](_0x50edb9,_0xc382de)['then'](function(_0x5de0f5){logger[_0x6d5e('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x15a678,_0x6d5e('0xb'));logger[_0x6d5e('0xc')](_0x6d5e('0xd'),_0x15a678,_0x6d5e('0xb'),JSON[_0x6d5e('0xe')](_0x5de0f5));if(_0x5de0f5[_0x6d5e('0xf')]){if(_0x5de0f5[_0x6d5e('0xf')][_0x6d5e('0x10')]===0x1f4){logger[_0x6d5e('0xf')](_0x6d5e('0x11'),_0x15a678,_0x5de0f5[_0x6d5e('0xf')][_0x6d5e('0x12')]);return _0x294bd8(_0x5de0f5[_0x6d5e('0xf')][_0x6d5e('0x12')]);}logger[_0x6d5e('0xf')](_0x6d5e('0x11'),_0x15a678,_0x5de0f5[_0x6d5e('0xf')]['message']);return _0x31c7ab(_0x5de0f5[_0x6d5e('0xf')][_0x6d5e('0x12')]);}else{logger[_0x6d5e('0xa')](_0x6d5e('0x11'),_0x15a678,'request\x20sent');_0x31c7ab(_0x5de0f5[_0x6d5e('0x13')]['message']);}})['catch'](function(_0xd2b363){logger[_0x6d5e('0xf')](_0x6d5e('0x11'),_0x15a678,_0xd2b363);_0x294bd8(_0xd2b363);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index da64fcb..8a16e1b 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 _0x63ca=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util'];(function(_0x3e8ee9,_0x348e69){var _0x1e9fcf=function(_0x461bfd){while(--_0x461bfd){_0x3e8ee9['push'](_0x3e8ee9['shift']());}};_0x1e9fcf(++_0x348e69);}(_0x63ca,0x1de));var _0xa63c=function(_0x44a9fb,_0x5231f3){_0x44a9fb=_0x44a9fb-0x0;var _0x3b296e=_0x63ca[_0x44a9fb];return _0x3b296e;};'use strict';var multer=require(_0xa63c('0x0'));var util=require(_0xa63c('0x1'));var path=require(_0xa63c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa63c('0x3'));var router=express[_0xa63c('0x4')]();var fs_extra=require(_0xa63c('0x5'));var auth=require(_0xa63c('0x6'));var interaction=require(_0xa63c('0x7'));var config=require(_0xa63c('0x8'));var controller=require(_0xa63c('0x9'));router[_0xa63c('0xa')]('/',auth[_0xa63c('0xb')](),controller[_0xa63c('0xc')]);router['get'](_0xa63c('0xd'),auth[_0xa63c('0xb')](),controller['show']);router[_0xa63c('0xa')](_0xa63c('0xe'),auth[_0xa63c('0xb')](),controller[_0xa63c('0xf')]);router[_0xa63c('0xa')](_0xa63c('0x10'),auth['isAuthenticated'](),controller[_0xa63c('0x11')]);router[_0xa63c('0xa')](_0xa63c('0x12'),auth['isAuthenticated'](),timeout(_0xa63c('0x13')),controller[_0xa63c('0x14')]);router['post']('/',auth[_0xa63c('0xb')](),controller[_0xa63c('0x15')]);router[_0xa63c('0x16')](_0xa63c('0x17'),auth[_0xa63c('0xb')](),controller[_0xa63c('0x18')]);router[_0xa63c('0x19')](_0xa63c('0xd'),auth[_0xa63c('0xb')](),controller[_0xa63c('0x1a')]);router[_0xa63c('0x1b')](_0xa63c('0xd'),auth['isAuthenticated'](),controller[_0xa63c('0x1c')]);module[_0xa63c('0x1d')]=router; \ No newline at end of file +var _0x2b98=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x50c5b2,_0x48b455){var _0x4f914=function(_0x35f093){while(--_0x35f093){_0x50c5b2['push'](_0x50c5b2['shift']());}};_0x4f914(++_0x48b455);}(_0x2b98,0x184));var _0x82b9=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x2b98[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x82b9('0x0'));var util=require(_0x82b9('0x1'));var path=require('path');var timeout=require(_0x82b9('0x2'));var express=require('express');var router=express[_0x82b9('0x3')]();var fs_extra=require(_0x82b9('0x4'));var auth=require(_0x82b9('0x5'));var interaction=require(_0x82b9('0x6'));var config=require(_0x82b9('0x7'));var controller=require(_0x82b9('0x8'));router['get']('/',auth[_0x82b9('0x9')](),controller[_0x82b9('0xa')]);router[_0x82b9('0xb')](_0x82b9('0xc'),auth[_0x82b9('0x9')](),controller[_0x82b9('0xd')]);router['get'](_0x82b9('0xe'),auth[_0x82b9('0x9')](),controller[_0x82b9('0xf')]);router['get'](_0x82b9('0x10'),auth['isAuthenticated'](),controller[_0x82b9('0x11')]);router[_0x82b9('0xb')](_0x82b9('0x12'),auth[_0x82b9('0x9')](),timeout(_0x82b9('0x13')),controller[_0x82b9('0x14')]);router[_0x82b9('0x15')]('/',auth['isAuthenticated'](),controller[_0x82b9('0x16')]);router[_0x82b9('0x15')](_0x82b9('0x17'),auth[_0x82b9('0x9')](),controller[_0x82b9('0x18')]);router[_0x82b9('0x19')](_0x82b9('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x82b9('0xc'),auth[_0x82b9('0x9')](),controller[_0x82b9('0x1a')]);module[_0x82b9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index ed343f3..5c16275 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 _0x7686=['sequelize','util','exports','STRING','name','TEXT','long','isObjectLike','formData','stringify','setDataValue','format','getDataValue','BOOLEAN'];(function(_0x35ba5e,_0x57917e){var _0x59a09a=function(_0x3e904a){while(--_0x3e904a){_0x35ba5e['push'](_0x35ba5e['shift']());}};_0x59a09a(++_0x57917e);}(_0x7686,0x9a));var _0x6768=function(_0x2c7da8,_0x544b86){_0x2c7da8=_0x2c7da8-0x0;var _0x1b4179=_0x7686[_0x2c7da8];return _0x1b4179;};'use strict';var Sequelize=require(_0x6768('0x0'));var _=require('lodash');var util=require(_0x6768('0x1'));module[_0x6768('0x2')]={'name':{'type':Sequelize[_0x6768('0x3')],'unique':_0x6768('0x4')},'description':{'type':Sequelize[_0x6768('0x3')]},'formData':{'type':Sequelize[_0x6768('0x5')](_0x6768('0x6')),'set':function(_0x1ffa1a){if(_[_0x6768('0x7')](_0x1ffa1a)){this['setDataValue'](_0x6768('0x8'),JSON[_0x6768('0x9')](_0x1ffa1a));}else if(_['isString'](_0x1ffa1a)){this['setDataValue'](_0x6768('0x8'),_0x1ffa1a);}else{this[_0x6768('0xa')](_0x6768('0x8'),util[_0x6768('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x6768('0xc')](_0x6768('0x4'))||'',this[_0x6768('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6768('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0801=['stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x292132,_0x5bf5bf){var _0x4abb6c=function(_0x34c88a){while(--_0x34c88a){_0x292132['push'](_0x292132['shift']());}};_0x4abb6c(++_0x5bf5bf);}(_0x0801,0x165));var _0x1080=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x0801[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x1080('0x0'));var _=require(_0x1080('0x1'));var util=require(_0x1080('0x2'));module[_0x1080('0x3')]={'name':{'type':Sequelize[_0x1080('0x4')],'unique':_0x1080('0x5')},'description':{'type':Sequelize[_0x1080('0x4')]},'formData':{'type':Sequelize[_0x1080('0x6')](_0x1080('0x7')),'set':function(_0x14f13c){if(_[_0x1080('0x8')](_0x14f13c)){this[_0x1080('0x9')](_0x1080('0xa'),JSON[_0x1080('0xb')](_0x14f13c));}else if(_[_0x1080('0xc')](_0x14f13c)){this[_0x1080('0x9')](_0x1080('0xa'),_0x14f13c);}else{this[_0x1080('0x9')](_0x1080('0xa'),util['format'](_0x1080('0xd'),this[_0x1080('0xe')]('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1080('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index ca8d846..5ac332f 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 _0x3cd0=['number','toString','indexOf','replace','startTime','starttime','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','get','Projects','sendStatus','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','getSessions','JscriptySessionReport','hasOwnProperty','ProjectId','findOne','JscriptyAnswerReport'];(function(_0x56144a,_0x54ee8a){var _0x4e7919=function(_0x48bd2c){while(--_0x48bd2c){_0x56144a['push'](_0x56144a['shift']());}};_0x4e7919(++_0x54ee8a);}(_0x3cd0,0x8a));var _0x03cd=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0x3cd0[_0x1bf809];return _0x1caa4e;};'use strict';var emlformat=require(_0x03cd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x03cd('0x1'));var rp=require('request-promise');var moment=require(_0x03cd('0x2'));var BPromise=require(_0x03cd('0x3'));var Mustache=require(_0x03cd('0x4'));var util=require(_0x03cd('0x5'));var path=require(_0x03cd('0x6'));var sox=require('sox');var csv=require(_0x03cd('0x7'));var ejs=require(_0x03cd('0x8'));var fs=require('fs');var fs_extra=require(_0x03cd('0x9'));var _=require(_0x03cd('0xa'));var squel=require(_0x03cd('0xb'));var crypto=require('crypto');var jsforce=require(_0x03cd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x03cd('0x7'));var querystring=require(_0x03cd('0xd'));var Papa=require(_0x03cd('0xe'));var Redis=require(_0x03cd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x03cd('0x10'));var as=require(_0x03cd('0x11'));var hardwareService=require(_0x03cd('0x12'));var logger=require(_0x03cd('0x13'))(_0x03cd('0x14'));var utils=require(_0x03cd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x03cd('0x16'))['db'];function respondWithStatusCode(_0x315a6c,_0xaa6a21){_0xaa6a21=_0xaa6a21||0xcc;return function(_0x1d88e6){if(_0x1d88e6){return _0x315a6c['sendStatus'](_0xaa6a21);}return _0x315a6c[_0x03cd('0x17')](_0xaa6a21)[_0x03cd('0x18')]();};}function respondWithResult(_0x5d0c1c,_0x4f8f17){_0x4f8f17=_0x4f8f17||0xc8;return function(_0x58c000){if(_0x58c000){return _0x5d0c1c[_0x03cd('0x17')](_0x4f8f17)[_0x03cd('0x19')](_0x58c000);}};}function respondWithFilteredResult(_0x17961d,_0x77b1bf){return function(_0x526102){if(_0x526102){var _0xdf7488=typeof _0x77b1bf[_0x03cd('0x1a')]===_0x03cd('0x1b')&&typeof _0x77b1bf[_0x03cd('0x1c')]===_0x03cd('0x1b');var _0x5ac997=_0x526102[_0x03cd('0x1d')];var _0x27de4f=_0xdf7488?0x0:_0x77b1bf[_0x03cd('0x1a')];var _0x12b3ea=_0xdf7488?_0x526102[_0x03cd('0x1d')]:_0x77b1bf['offset']+_0x77b1bf[_0x03cd('0x1c')];var _0xa1122b;if(_0x12b3ea>=_0x5ac997){_0x12b3ea=_0x5ac997;_0xa1122b=0xc8;}else{_0xa1122b=0xce;}_0x17961d[_0x03cd('0x17')](_0xa1122b);return _0x17961d[_0x03cd('0x1e')]('Content-Range',_0x27de4f+'-'+_0x12b3ea+'/'+_0x5ac997)[_0x03cd('0x19')](_0x526102);}return null;};}function patchUpdates(_0x4d0a58){return function(_0x1d51fa){try{jsonpatch[_0x03cd('0x1f')](_0x1d51fa,_0x4d0a58,!![]);}catch(_0x85ac1b){return BPromise['reject'](_0x85ac1b);}return _0x1d51fa['save']();};}function saveUpdates(_0x255c96,_0x19ad78){return function(_0x4e8ff6){if(_0x4e8ff6){return _0x4e8ff6[_0x03cd('0x20')](_0x255c96)[_0x03cd('0x21')](function(_0x56ec2b){return _0x56ec2b;});}return null;};}function removeEntity(_0x440df7,_0x514c11){return function(_0x4f1b33){if(_0x4f1b33){return _0x4f1b33[_0x03cd('0x22')]()[_0x03cd('0x21')](function(){var _0x103de4=_0x4f1b33[_0x03cd('0x23')]({'plain':!![]});var _0x5173e9=_0x03cd('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x5173e9,'resourceId':_0x103de4['id']}})[_0x03cd('0x21')](function(){return _0x4f1b33;});})[_0x03cd('0x21')](function(){_0x440df7[_0x03cd('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f8b00,_0x709473){return function(_0x4f7fb5){if(!_0x4f7fb5){_0x4f8b00[_0x03cd('0x25')](0x194);}return _0x4f7fb5;};}function handleError(_0x1e8e6e,_0x5b976d){_0x5b976d=_0x5b976d||0x1f4;return function(_0x13242a){logger[_0x03cd('0x26')](_0x13242a[_0x03cd('0x27')]);if(_0x13242a[_0x03cd('0x28')]){delete _0x13242a[_0x03cd('0x28')];}_0x1e8e6e['status'](_0x5b976d)[_0x03cd('0x29')](_0x13242a);};}exports[_0x03cd('0x2a')]=function(_0x3bc711,_0x1e8827){var _0x4e43c2={},_0x1a3b3e={},_0x1e2eff={'count':0x0,'rows':[]};var _0x2b9e23=_[_0x03cd('0x2b')](db[_0x03cd('0x2c')][_0x03cd('0x2d')],function(_0x27e8a1){return{'name':_0x27e8a1[_0x03cd('0x2e')],'type':_0x27e8a1[_0x03cd('0x2f')][_0x03cd('0x30')]};});_0x1a3b3e[_0x03cd('0x31')]=_[_0x03cd('0x2b')](_0x2b9e23,_0x03cd('0x28'));_0x1a3b3e['query']=_['keys'](_0x3bc711[_0x03cd('0x32')]);_0x1a3b3e['filters']=_[_0x03cd('0x33')](_0x1a3b3e[_0x03cd('0x31')],_0x1a3b3e['query']);_0x4e43c2['attributes']=_[_0x03cd('0x33')](_0x1a3b3e[_0x03cd('0x31')],qs[_0x03cd('0x34')](_0x3bc711[_0x03cd('0x32')]['fields']));_0x4e43c2[_0x03cd('0x35')]=_0x4e43c2[_0x03cd('0x35')][_0x03cd('0x36')]?_0x4e43c2[_0x03cd('0x35')]:_0x1a3b3e[_0x03cd('0x31')];if(!_0x3bc711[_0x03cd('0x32')]['hasOwnProperty'](_0x03cd('0x37'))){_0x4e43c2[_0x03cd('0x1c')]=qs[_0x03cd('0x1c')](_0x3bc711['query'][_0x03cd('0x1c')]);_0x4e43c2[_0x03cd('0x1a')]=qs[_0x03cd('0x1a')](_0x3bc711[_0x03cd('0x32')][_0x03cd('0x1a')]);}_0x4e43c2[_0x03cd('0x38')]=qs[_0x03cd('0x39')](_0x3bc711['query'][_0x03cd('0x39')]);_0x4e43c2[_0x03cd('0x3a')]=qs['filters'](_[_0x03cd('0x3b')](_0x3bc711[_0x03cd('0x32')],_0x1a3b3e[_0x03cd('0x3c')]),_0x2b9e23);if(_0x3bc711[_0x03cd('0x32')]['filter']){_0x4e43c2[_0x03cd('0x3a')]=_[_0x03cd('0x3d')](_0x4e43c2[_0x03cd('0x3a')],{'$or':_[_0x03cd('0x2b')](_0x2b9e23,function(_0x163600){if(_0x163600[_0x03cd('0x2f')]!==_0x03cd('0x3e')){var _0x161d43={};_0x161d43[_0x163600['name']]={'$like':'%'+_0x3bc711['query'][_0x03cd('0x3f')]+'%'};return _0x161d43;}})});}_0x4e43c2=_[_0x03cd('0x3d')]({},_0x4e43c2,_0x3bc711[_0x03cd('0x40')]);var _0x37591c={'where':_0x4e43c2[_0x03cd('0x3a')]};return db['JscriptyProject'][_0x03cd('0x1d')](_0x37591c)[_0x03cd('0x21')](function(_0x473e2f){_0x1e2eff[_0x03cd('0x1d')]=_0x473e2f;if(_0x3bc711[_0x03cd('0x32')][_0x03cd('0x41')]){_0x4e43c2[_0x03cd('0x42')]=[{'all':!![]}];}return db[_0x03cd('0x2c')][_0x03cd('0x43')](_0x4e43c2);})[_0x03cd('0x21')](function(_0x59de59){_0x1e2eff[_0x03cd('0x44')]=_0x59de59;return _0x1e2eff;})[_0x03cd('0x21')](respondWithFilteredResult(_0x1e8827,_0x4e43c2))[_0x03cd('0x45')](handleError(_0x1e8827,null));};exports[_0x03cd('0x46')]=function(_0x24a9ce,_0x841ec){var _0xe7c542={'raw':![],'where':{'id':_0x24a9ce['params']['id']}},_0x55edce={};_0x55edce[_0x03cd('0x31')]=_[_0x03cd('0x47')](db[_0x03cd('0x2c')][_0x03cd('0x2d')]);_0x55edce[_0x03cd('0x32')]=_[_0x03cd('0x47')](_0x24a9ce[_0x03cd('0x32')]);_0x55edce['filters']=_[_0x03cd('0x33')](_0x55edce[_0x03cd('0x31')],_0x55edce[_0x03cd('0x32')]);_0xe7c542[_0x03cd('0x35')]=_[_0x03cd('0x33')](_0x55edce[_0x03cd('0x31')],qs['fields'](_0x24a9ce['query']['fields']));_0xe7c542['attributes']=_0xe7c542[_0x03cd('0x35')][_0x03cd('0x36')]?_0xe7c542[_0x03cd('0x35')]:_0x55edce[_0x03cd('0x31')];if(_0x24a9ce[_0x03cd('0x32')][_0x03cd('0x41')]){_0xe7c542[_0x03cd('0x42')]=[{'all':!![]}];}_0xe7c542=_[_0x03cd('0x3d')]({},_0xe7c542,_0x24a9ce['options']);return db['JscriptyProject'][_0x03cd('0x48')](_0xe7c542)[_0x03cd('0x21')](handleEntityNotFound(_0x841ec,null))['then'](respondWithResult(_0x841ec,null))['catch'](handleError(_0x841ec,null));};exports['create']=function(_0xbb7b57,_0x2e10c4){return db['JscriptyProject'][_0x03cd('0x49')](_0xbb7b57[_0x03cd('0x4a')],{})[_0x03cd('0x21')](function(_0x5cc9ff){var _0x3c624d=_0xbb7b57[_0x03cd('0x4b')][_0x03cd('0x23')]({'plain':!![]});if(!_0x3c624d)throw new Error(_0x03cd('0x4c'));if(_0x3c624d[_0x03cd('0x4d')]==='user'){var _0x27107b=_0x5cc9ff[_0x03cd('0x23')]({'plain':!![]});var _0x197a97=_0x03cd('0x24');return db[_0x03cd('0x4e')][_0x03cd('0x48')]({'where':{'name':_0x197a97,'userProfileId':_0x3c624d[_0x03cd('0x4f')]},'raw':!![]})['then'](function(_0x1129f5){if(_0x1129f5&&_0x1129f5[_0x03cd('0x50')]===0x0){return db[_0x03cd('0x51')][_0x03cd('0x49')]({'name':_0x27107b[_0x03cd('0x28')],'resourceId':_0x27107b['id'],'type':_0x1129f5[_0x03cd('0x28')],'sectionId':_0x1129f5['id']},{})[_0x03cd('0x21')](function(){return _0x5cc9ff;});}else{return _0x5cc9ff;}})['catch'](function(_0x437429){logger[_0x03cd('0x26')](_0x03cd('0x52'),_0x437429);throw _0x437429;});}return _0x5cc9ff;})[_0x03cd('0x21')](respondWithResult(_0x2e10c4,0xc9))['catch'](handleError(_0x2e10c4,null));};exports[_0x03cd('0x53')]=function(_0x27871b,_0x1299eb){var _0x3d611b={'where':{'id':_0x27871b[_0x03cd('0x54')]['id']}},_0x40a22c={};_0x40a22c[_0x03cd('0x31')]=_[_0x03cd('0x47')](db[_0x03cd('0x2c')]['rawAttributes']);_0x3d611b[_0x03cd('0x35')]=_[_0x03cd('0x33')](_0x40a22c['model'],qs[_0x03cd('0x34')](_0x27871b['query']['fields']));_0x3d611b['attributes']=_0x3d611b[_0x03cd('0x35')][_0x03cd('0x36')]?_0x3d611b[_0x03cd('0x35')]:_0x40a22c[_0x03cd('0x31')];if(_0x27871b['query'][_0x03cd('0x41')]){_0x3d611b[_0x03cd('0x42')]=[{'all':!![]}];}_0x3d611b=_[_0x03cd('0x3d')]({},_0x3d611b,_0x27871b[_0x03cd('0x40')]);return db[_0x03cd('0x2c')][_0x03cd('0x48')](_0x3d611b)['then'](handleEntityNotFound(_0x1299eb,null))['then'](function(_0x4eedb2){if(_0x4eedb2){var _0x1a0f56=_0x4eedb2[_0x03cd('0x23')]({'plain':!![]});_0x1a0f56=qs[_0x03cd('0x55')](_0x1a0f56,['id',_0x03cd('0x56'),_0x03cd('0x57')]);_0x27871b[_0x03cd('0x4a')]=_[_0x03cd('0x55')](_0x27871b[_0x03cd('0x4a')],['id','createdAt',_0x03cd('0x57')]);return db[_0x03cd('0x2c')][_0x03cd('0x49')](_[_0x03cd('0x3d')](_0x1a0f56,_0x27871b[_0x03cd('0x4a')]),{'include':_0x27871b['query'][_0x03cd('0x41')]?[{'all':!![]}]:undefined})[_0x03cd('0x21')](function(_0x35899c){var _0x33667e=_0x27871b['user'][_0x03cd('0x23')]({'plain':!![]});if(!_0x33667e)throw new Error(_0x03cd('0x4c'));if(_0x33667e[_0x03cd('0x4d')]===_0x03cd('0x4b')){var _0x1225ba=_0x35899c[_0x03cd('0x23')]({'plain':!![]});var _0x2d47ac=_0x03cd('0x24');return db[_0x03cd('0x4e')]['find']({'where':{'name':_0x2d47ac,'userProfileId':_0x33667e['userProfileId']},'raw':!![]})[_0x03cd('0x21')](function(_0x28b109){if(_0x28b109&&_0x28b109[_0x03cd('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x1225ba[_0x03cd('0x28')],'resourceId':_0x1225ba['id'],'type':_0x28b109[_0x03cd('0x28')],'sectionId':_0x28b109['id']},{})['then'](function(){return _0x35899c;});}else{return _0x35899c;}})[_0x03cd('0x45')](function(_0x122253){logger[_0x03cd('0x26')](_0x03cd('0x52'),_0x122253);throw _0x122253;});}return _0x35899c;});}})[_0x03cd('0x21')](respondWithResult(_0x1299eb,0xc9))[_0x03cd('0x45')](handleError(_0x1299eb,null));};exports[_0x03cd('0x20')]=function(_0xc012ca,_0x348393){if(_0xc012ca[_0x03cd('0x4a')]['id']){delete _0xc012ca[_0x03cd('0x4a')]['id'];}return db[_0x03cd('0x2c')]['find']({'where':{'id':_0xc012ca['params']['id']}})[_0x03cd('0x21')](handleEntityNotFound(_0x348393,null))[_0x03cd('0x21')](saveUpdates(_0xc012ca[_0x03cd('0x4a')],null))[_0x03cd('0x21')](respondWithResult(_0x348393,null))[_0x03cd('0x45')](handleError(_0x348393,null));};exports[_0x03cd('0x22')]=function(_0x5b5e3c,_0x35f1bb){return db[_0x03cd('0x2c')][_0x03cd('0x48')]({'where':{'id':_0x5b5e3c['params']['id']}})[_0x03cd('0x21')](handleEntityNotFound(_0x35f1bb,null))[_0x03cd('0x21')](removeEntity(_0x35f1bb,null))[_0x03cd('0x45')](handleError(_0x35f1bb,null));};exports[_0x03cd('0x58')]=function(_0x2bcfff,_0x5563b5,_0x453f4a){var _0x479271={'raw':!![],'where':{}};var _0x5a0c8f={};var _0x378f5f={'count':0x0,'rows':[]};return db[_0x03cd('0x2c')]['findOne']({'where':{'id':_0x2bcfff[_0x03cd('0x54')]['id']}})[_0x03cd('0x21')](handleEntityNotFound(_0x5563b5,null))['then'](function(_0x2d2921){if(_0x2d2921){_0x5a0c8f[_0x03cd('0x31')]=_[_0x03cd('0x47')](db[_0x03cd('0x59')][_0x03cd('0x2d')]);_0x5a0c8f[_0x03cd('0x32')]=_['keys'](_0x2bcfff[_0x03cd('0x32')]);_0x5a0c8f['filters']=_[_0x03cd('0x33')](_0x5a0c8f[_0x03cd('0x31')],_0x5a0c8f['query']);_0x479271[_0x03cd('0x35')]=_[_0x03cd('0x33')](_0x5a0c8f['model'],qs[_0x03cd('0x34')](_0x2bcfff[_0x03cd('0x32')][_0x03cd('0x34')]));_0x479271[_0x03cd('0x35')]=_0x479271['attributes']['length']?_0x479271[_0x03cd('0x35')]:_0x5a0c8f['model'];if(!_0x2bcfff['query'][_0x03cd('0x5a')](_0x03cd('0x37'))){_0x479271[_0x03cd('0x1c')]=qs[_0x03cd('0x1c')](_0x2bcfff[_0x03cd('0x32')]['limit']);_0x479271[_0x03cd('0x1a')]=qs[_0x03cd('0x1a')](_0x2bcfff[_0x03cd('0x32')][_0x03cd('0x1a')]);}_0x479271[_0x03cd('0x38')]=qs[_0x03cd('0x39')](_0x2bcfff['query'][_0x03cd('0x39')]);_0x479271['where']=qs[_0x03cd('0x3c')](_['pick'](_0x2bcfff['query'],_0x5a0c8f['filters']));_0x479271['where'][_0x03cd('0x5b')]=_0x2d2921['id'];if(_0x2bcfff[_0x03cd('0x32')][_0x03cd('0x3f')]){_0x479271[_0x03cd('0x3a')]=_[_0x03cd('0x3d')](_0x479271[_0x03cd('0x3a')],{'$or':_[_0x03cd('0x2b')](_0x479271['attributes'],function(_0x5e5168){var _0x4a2969={};_0x4a2969[_0x5e5168]={'$like':'%'+_0x2bcfff['query'][_0x03cd('0x3f')]+'%'};return _0x4a2969;})});}_0x479271=_[_0x03cd('0x3d')]({},_0x479271,_0x2bcfff['options']);return db[_0x03cd('0x59')][_0x03cd('0x1d')]({'where':_0x479271[_0x03cd('0x3a')]})['then'](function(_0x1e951e){_0x378f5f[_0x03cd('0x1d')]=_0x1e951e;if(_0x2bcfff[_0x03cd('0x32')]['includeAll']){_0x479271[_0x03cd('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x03cd('0x43')](_0x479271);})['then'](function(_0x5a278d){_0x378f5f['rows']=_0x5a278d;return _0x378f5f;});}})['then'](respondWithFilteredResult(_0x5563b5,_0x479271))[_0x03cd('0x45')](handleError(_0x5563b5,null));};exports['getAnswers']=function(_0x2edb21,_0x63ccbb,_0x612a8f){var _0x2663dc={'raw':!![],'where':{}};var _0x326b99={};var _0x3308c2={'count':0x0,'rows':[]};return db[_0x03cd('0x2c')][_0x03cd('0x5c')]({'where':{'id':_0x2edb21['params']['id']}})[_0x03cd('0x21')](handleEntityNotFound(_0x63ccbb,null))[_0x03cd('0x21')](function(_0x5b4d52){if(_0x5b4d52){_0x326b99['model']=_[_0x03cd('0x47')](db[_0x03cd('0x5d')][_0x03cd('0x2d')]);_0x326b99[_0x03cd('0x32')]=_[_0x03cd('0x47')](_0x2edb21['query']);_0x326b99[_0x03cd('0x3c')]=_['intersection'](_0x326b99[_0x03cd('0x31')],_0x326b99[_0x03cd('0x32')]);_0x2663dc[_0x03cd('0x35')]=_['intersection'](_0x326b99[_0x03cd('0x31')],qs[_0x03cd('0x34')](_0x2edb21[_0x03cd('0x32')]['fields']));_0x2663dc[_0x03cd('0x35')]=_0x2663dc[_0x03cd('0x35')][_0x03cd('0x36')]?_0x2663dc[_0x03cd('0x35')]:_0x326b99['model'];if(!_0x2edb21[_0x03cd('0x32')]['hasOwnProperty'](_0x03cd('0x37'))){_0x2663dc['limit']=qs[_0x03cd('0x1c')](_0x2edb21[_0x03cd('0x32')]['limit']);_0x2663dc[_0x03cd('0x1a')]=qs[_0x03cd('0x1a')](_0x2edb21[_0x03cd('0x32')][_0x03cd('0x1a')]);}_0x2663dc['order']=qs['sort'](_0x2edb21[_0x03cd('0x32')][_0x03cd('0x39')]);_0x2663dc[_0x03cd('0x3a')]=qs[_0x03cd('0x3c')](_[_0x03cd('0x3b')](_0x2edb21['query'],_0x326b99[_0x03cd('0x3c')]));_0x2663dc[_0x03cd('0x3a')]['ProjectId']=_0x5b4d52['id'];if(_0x2edb21[_0x03cd('0x32')][_0x03cd('0x3f')]){_0x2663dc[_0x03cd('0x3a')]=_[_0x03cd('0x3d')](_0x2663dc[_0x03cd('0x3a')],{'$or':_[_0x03cd('0x2b')](_0x2663dc['attributes'],function(_0x37a517){var _0x1c170e={};_0x1c170e[_0x37a517]={'$like':'%'+_0x2edb21['query'][_0x03cd('0x3f')]+'%'};return _0x1c170e;})});}_0x2663dc=_[_0x03cd('0x3d')]({},_0x2663dc,_0x2edb21[_0x03cd('0x40')]);return db[_0x03cd('0x5d')][_0x03cd('0x1d')]({'where':_0x2663dc[_0x03cd('0x3a')]})[_0x03cd('0x21')](function(_0x290b03){_0x3308c2[_0x03cd('0x1d')]=_0x290b03;if(_0x2edb21['query'][_0x03cd('0x41')]){_0x2663dc[_0x03cd('0x42')]=[{'all':!![]}];}return db[_0x03cd('0x5d')]['findAll'](_0x2663dc);})[_0x03cd('0x21')](function(_0x4991d7){_0x3308c2['rows']=_0x4991d7;return _0x3308c2;});}})[_0x03cd('0x21')](respondWithFilteredResult(_0x63ccbb,_0x2663dc))['catch'](handleError(_0x63ccbb,null));};function char(_0x2f8395){return _0x03cd('0x5e')===typeof _0x2f8395?String['fromCharCode']['apply'](null,arguments):_0x2f8395;}function needsEncapsulation(_0x307b0f){return!!_0x307b0f&&(_0x307b0f[_0x03cd('0x5f')]()[_0x03cd('0x60')](char(0xd))>=0x0||_0x307b0f[_0x03cd('0x5f')]()['indexOf'](char(0xa))>=0x0||_0x307b0f[_0x03cd('0x5f')]()[_0x03cd('0x60')](char(0x2c))>=0x0||_0x307b0f[_0x03cd('0x5f')]()[_0x03cd('0x60')](char(0x22))>=0x0);}function encapsulate(_0x420b20){var _0x4d995e=char(0x22),_0x4c98c2='\x5c'+char(0x22),_0x56be82=_0x420b20['toString']()[_0x03cd('0x61')](new RegExp(_0x4d995e,'g'),_0x4c98c2);return _0x4d995e+_0x56be82+_0x4d995e;}exports['getSummary']=function(_0x590cb3,_0x3a52f3,_0x29a2eb){var _0x8fa219,_0x32cf34;var _0x46ff2d={'where':{'ProjectId':_0x590cb3[_0x03cd('0x54')]['id']}};if(_0x590cb3[_0x03cd('0x32')][_0x03cd('0x62')]){_0x46ff2d[_0x03cd('0x3a')][_0x03cd('0x63')]=JSON['parse'](_0x590cb3[_0x03cd('0x32')][_0x03cd('0x62')]);}return db[_0x03cd('0x59')][_0x03cd('0x43')](_0x46ff2d)[_0x03cd('0x21')](handleEntityNotFound(_0x3a52f3,null))['then'](function(_0x19721f){if(_0x19721f){_0x8fa219=_0x19721f;return db[_0x03cd('0x64')][_0x03cd('0x43')]({'where':{'SessionId':{'$in':_[_0x03cd('0x2b')](_0x8fa219,'id')},'ProjectId':_0x590cb3[_0x03cd('0x54')]['id']},'order':'-createdAt'});}})[_0x03cd('0x21')](handleEntityNotFound(_0x3a52f3,null))['then'](function(_0x297afb){if(_0x297afb){_0x32cf34=_0x297afb;var _0x21deb7={};for(var _0x1cbd54=0x0,_0x3b3f88=_0x32cf34[_0x03cd('0x36')];_0x1cbd54<_0x3b3f88;_0x1cbd54++){if(!_0x21deb7[_0x03cd('0x5a')](_0x32cf34[_0x1cbd54][_0x03cd('0x65')])){_0x21deb7[_0x32cf34[_0x1cbd54]['questionId']]=needsEncapsulation(_0x32cf34[_0x1cbd54][_0x03cd('0x66')])?encapsulate(_0x32cf34[_0x1cbd54][_0x03cd('0x66')]):_0x32cf34[_0x1cbd54][_0x03cd('0x66')];}}var _0x428e58=[],_0x20654b={};for(var _0x595073=0x0,_0xe02492=_0x8fa219[_0x03cd('0x36')];_0x595073<_0xe02492;_0x595073++){_0x20654b={'ProjectId':_0x590cb3[_0x03cd('0x54')]['id'],'SessionId':_0x8fa219[_0x595073]['id'],'StartTime':moment(_0x8fa219[_0x595073][_0x03cd('0x63')])['format'](_0x03cd('0x67'))};for(var _0x177e76=0x0,_0x2f9489=_0x32cf34[_0x03cd('0x36')];_0x177e76<_0x2f9489;_0x177e76++){if(_0x32cf34[_0x177e76][_0x03cd('0x68')]==_0x8fa219[_0x595073]['id']&&_0x21deb7['hasOwnProperty'](_0x32cf34[_0x177e76][_0x03cd('0x65')])){_0x20654b[_0x21deb7[_0x32cf34[_0x177e76]['questionId']]]=_0x32cf34[_0x177e76][_0x03cd('0x69')];}}for(var _0x3df24d in _0x21deb7){if(!_0x20654b[_0x03cd('0x5a')](_0x21deb7[_0x3df24d])){_0x20654b[_0x21deb7[_0x3df24d]]=null;}}_0x428e58[_0x03cd('0x6a')](_0x20654b);}return _0x428e58;}})[_0x03cd('0x21')](function(_0x296563){if(!_[_0x03cd('0x6b')](_0x296563)){var _0xa487b3=toCsv(_0x296563);var _0x45342b=Date['now']();fs[_0x03cd('0x6c')](util[_0x03cd('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x590cb3['params']['id'],_0x45342b),_0xa487b3);_0x3a52f3[_0x03cd('0x6e')](_0x03cd('0x6f'),_0x03cd('0x70')+util[_0x03cd('0x6d')]('Jscripty_Project_%d_Summary_%s.csv',_0x590cb3[_0x03cd('0x54')]['id'],_0x45342b));_0x3a52f3[_0x03cd('0x6e')](_0x03cd('0x71'),_0x03cd('0x72'));return _0x3a52f3[_0x03cd('0x73')](util[_0x03cd('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x590cb3[_0x03cd('0x54')]['id'],_0x45342b));}else{return _0x3a52f3[_0x03cd('0x25')](0xcc);}})[_0x03cd('0x45')](handleError(_0x3a52f3,null));}; \ No newline at end of file +var _0x0b41=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','findAll','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x0b41,0x6a));var _0x10b4=function(_0x49611d,_0x539e45){_0x49611d=_0x49611d-0x0;var _0x26ab04=_0x0b41[_0x49611d];return _0x26ab04;};'use strict';var emlformat=require(_0x10b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10b4('0x1'));var jsonpatch=require(_0x10b4('0x2'));var rp=require('request-promise');var moment=require(_0x10b4('0x3'));var BPromise=require(_0x10b4('0x4'));var Mustache=require(_0x10b4('0x5'));var util=require('util');var path=require(_0x10b4('0x6'));var sox=require(_0x10b4('0x7'));var csv=require(_0x10b4('0x8'));var ejs=require(_0x10b4('0x9'));var fs=require('fs');var fs_extra=require(_0x10b4('0xa'));var _=require(_0x10b4('0xb'));var squel=require(_0x10b4('0xc'));var crypto=require(_0x10b4('0xd'));var jsforce=require(_0x10b4('0xe'));var deskjs=require(_0x10b4('0xf'));var toCsv=require(_0x10b4('0x8'));var querystring=require(_0x10b4('0x10'));var Papa=require(_0x10b4('0x11'));var Redis=require(_0x10b4('0x12'));var authService=require(_0x10b4('0x13'));var qs=require(_0x10b4('0x14'));var as=require(_0x10b4('0x15'));var hardwareService=require(_0x10b4('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x10b4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x10b4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f29ef,_0x26b748){_0x26b748=_0x26b748||0xcc;return function(_0x58ba27){if(_0x58ba27){return _0x5f29ef[_0x10b4('0x19')](_0x26b748);}return _0x5f29ef[_0x10b4('0x1a')](_0x26b748)[_0x10b4('0x1b')]();};}function respondWithResult(_0x301e7a,_0xb8a85b){_0xb8a85b=_0xb8a85b||0xc8;return function(_0xbf5214){if(_0xbf5214){return _0x301e7a[_0x10b4('0x1a')](_0xb8a85b)[_0x10b4('0x1c')](_0xbf5214);}};}function respondWithFilteredResult(_0x2f64d3,_0x4c500b){return function(_0x2dcdfe){if(_0x2dcdfe){var _0x490f36=typeof _0x4c500b[_0x10b4('0x1d')]==='undefined'&&typeof _0x4c500b[_0x10b4('0x1e')]===_0x10b4('0x1f');var _0x51b6cd=_0x2dcdfe[_0x10b4('0x20')];var _0x13e166=_0x490f36?0x0:_0x4c500b[_0x10b4('0x1d')];var _0x5adea8=_0x490f36?_0x2dcdfe[_0x10b4('0x20')]:_0x4c500b['offset']+_0x4c500b[_0x10b4('0x1e')];var _0xb14a5d;if(_0x5adea8>=_0x51b6cd){_0x5adea8=_0x51b6cd;_0xb14a5d=0xc8;}else{_0xb14a5d=0xce;}_0x2f64d3[_0x10b4('0x1a')](_0xb14a5d);return _0x2f64d3[_0x10b4('0x21')](_0x10b4('0x22'),_0x13e166+'-'+_0x5adea8+'/'+_0x51b6cd)[_0x10b4('0x1c')](_0x2dcdfe);}return null;};}function patchUpdates(_0x5df5e0){return function(_0xa81090){try{jsonpatch[_0x10b4('0x23')](_0xa81090,_0x5df5e0,!![]);}catch(_0x4c36ac){return BPromise[_0x10b4('0x24')](_0x4c36ac);}return _0xa81090[_0x10b4('0x25')]();};}function saveUpdates(_0x4e73f3,_0x198d80){return function(_0x10554e){if(_0x10554e){return _0x10554e[_0x10b4('0x26')](_0x4e73f3)[_0x10b4('0x27')](function(_0x54a117){return _0x54a117;});}return null;};}function removeEntity(_0x4b9c3a,_0x1488d2){return function(_0x29d091){if(_0x29d091){return _0x29d091[_0x10b4('0x28')]()[_0x10b4('0x27')](function(){var _0xf6a455=_0x29d091['get']({'plain':!![]});var _0x98ce5c=_0x10b4('0x29');return db[_0x10b4('0x2a')]['destroy']({'where':{'type':_0x98ce5c,'resourceId':_0xf6a455['id']}})[_0x10b4('0x27')](function(){return _0x29d091;});})[_0x10b4('0x27')](function(){_0x4b9c3a[_0x10b4('0x1a')](0xcc)[_0x10b4('0x1b')]();});}};}function handleEntityNotFound(_0x2c3049,_0xc4063e){return function(_0xcc5f28){if(!_0xcc5f28){_0x2c3049['sendStatus'](0x194);}return _0xcc5f28;};}function handleError(_0x1488de,_0x2c1a83){_0x2c1a83=_0x2c1a83||0x1f4;return function(_0x594323){logger[_0x10b4('0x2b')](_0x594323[_0x10b4('0x2c')]);if(_0x594323[_0x10b4('0x2d')]){delete _0x594323[_0x10b4('0x2d')];}_0x1488de[_0x10b4('0x1a')](_0x2c1a83)[_0x10b4('0x2e')](_0x594323);};}exports[_0x10b4('0x2f')]=function(_0x529085,_0x71062d){var _0x35c33c={},_0x283ce3={},_0x1611eb={'count':0x0,'rows':[]};var _0x5a4023=_[_0x10b4('0x30')](db[_0x10b4('0x31')][_0x10b4('0x32')],function(_0x3c1a0e){return{'name':_0x3c1a0e[_0x10b4('0x33')],'type':_0x3c1a0e[_0x10b4('0x34')][_0x10b4('0x35')]};});_0x283ce3[_0x10b4('0x36')]=_[_0x10b4('0x30')](_0x5a4023,_0x10b4('0x2d'));_0x283ce3[_0x10b4('0x37')]=_[_0x10b4('0x38')](_0x529085[_0x10b4('0x37')]);_0x283ce3['filters']=_[_0x10b4('0x39')](_0x283ce3[_0x10b4('0x36')],_0x283ce3[_0x10b4('0x37')]);_0x35c33c['attributes']=_[_0x10b4('0x39')](_0x283ce3[_0x10b4('0x36')],qs[_0x10b4('0x3a')](_0x529085[_0x10b4('0x37')][_0x10b4('0x3a')]));_0x35c33c[_0x10b4('0x3b')]=_0x35c33c[_0x10b4('0x3b')][_0x10b4('0x3c')]?_0x35c33c[_0x10b4('0x3b')]:_0x283ce3['model'];if(!_0x529085[_0x10b4('0x37')]['hasOwnProperty'](_0x10b4('0x3d'))){_0x35c33c['limit']=qs['limit'](_0x529085['query'][_0x10b4('0x1e')]);_0x35c33c[_0x10b4('0x1d')]=qs[_0x10b4('0x1d')](_0x529085[_0x10b4('0x37')][_0x10b4('0x1d')]);}_0x35c33c[_0x10b4('0x3e')]=qs[_0x10b4('0x3f')](_0x529085[_0x10b4('0x37')][_0x10b4('0x3f')]);_0x35c33c[_0x10b4('0x40')]=qs['filters'](_[_0x10b4('0x41')](_0x529085[_0x10b4('0x37')],_0x283ce3[_0x10b4('0x42')]),_0x5a4023);if(_0x529085[_0x10b4('0x37')][_0x10b4('0x43')]){_0x35c33c['where']=_[_0x10b4('0x44')](_0x35c33c['where'],{'$or':_[_0x10b4('0x30')](_0x5a4023,function(_0x225589){if(_0x225589['type']!==_0x10b4('0x45')){var _0xc16b99={};_0xc16b99[_0x225589['name']]={'$like':'%'+_0x529085['query'][_0x10b4('0x43')]+'%'};return _0xc16b99;}})});}_0x35c33c=_[_0x10b4('0x44')]({},_0x35c33c,_0x529085[_0x10b4('0x46')]);var _0x15cffc={'where':_0x35c33c[_0x10b4('0x40')]};return db[_0x10b4('0x31')]['count'](_0x15cffc)['then'](function(_0x597885){_0x1611eb[_0x10b4('0x20')]=_0x597885;if(_0x529085['query'][_0x10b4('0x47')]){_0x35c33c['include']=[{'all':!![]}];}return db[_0x10b4('0x31')]['findAll'](_0x35c33c);})[_0x10b4('0x27')](function(_0xa58063){_0x1611eb[_0x10b4('0x48')]=_0xa58063;return _0x1611eb;})[_0x10b4('0x27')](respondWithFilteredResult(_0x71062d,_0x35c33c))[_0x10b4('0x49')](handleError(_0x71062d,null));};exports[_0x10b4('0x4a')]=function(_0x1cf8f3,_0x553113){var _0x59ef64={'raw':![],'where':{'id':_0x1cf8f3[_0x10b4('0x4b')]['id']}},_0x18947a={};_0x18947a['model']=_[_0x10b4('0x38')](db['JscriptyProject']['rawAttributes']);_0x18947a[_0x10b4('0x37')]=_[_0x10b4('0x38')](_0x1cf8f3[_0x10b4('0x37')]);_0x18947a[_0x10b4('0x42')]=_[_0x10b4('0x39')](_0x18947a['model'],_0x18947a[_0x10b4('0x37')]);_0x59ef64[_0x10b4('0x3b')]=_[_0x10b4('0x39')](_0x18947a['model'],qs[_0x10b4('0x3a')](_0x1cf8f3[_0x10b4('0x37')][_0x10b4('0x3a')]));_0x59ef64[_0x10b4('0x3b')]=_0x59ef64[_0x10b4('0x3b')]['length']?_0x59ef64[_0x10b4('0x3b')]:_0x18947a[_0x10b4('0x36')];if(_0x1cf8f3['query'][_0x10b4('0x47')]){_0x59ef64[_0x10b4('0x4c')]=[{'all':!![]}];}_0x59ef64=_[_0x10b4('0x44')]({},_0x59ef64,_0x1cf8f3[_0x10b4('0x46')]);return db[_0x10b4('0x31')][_0x10b4('0x4d')](_0x59ef64)['then'](handleEntityNotFound(_0x553113,null))[_0x10b4('0x27')](respondWithResult(_0x553113,null))[_0x10b4('0x49')](handleError(_0x553113,null));};exports['create']=function(_0x32c17f,_0x378b11){return db[_0x10b4('0x31')][_0x10b4('0x4e')](_0x32c17f[_0x10b4('0x4f')],{})[_0x10b4('0x27')](function(_0x53efe7){var _0x22bd63=_0x32c17f[_0x10b4('0x50')][_0x10b4('0x51')]({'plain':!![]});if(!_0x22bd63)throw new Error(_0x10b4('0x52'));if(_0x22bd63[_0x10b4('0x53')]===_0x10b4('0x50')){var _0x21e4dd=_0x53efe7['get']({'plain':!![]});var _0x5a7690='Projects';return db[_0x10b4('0x54')][_0x10b4('0x4d')]({'where':{'name':_0x5a7690,'userProfileId':_0x22bd63[_0x10b4('0x55')]},'raw':!![]})['then'](function(_0x4951ff){if(_0x4951ff&&_0x4951ff[_0x10b4('0x56')]===0x0){return db['UserProfileResource'][_0x10b4('0x4e')]({'name':_0x21e4dd[_0x10b4('0x2d')],'resourceId':_0x21e4dd['id'],'type':_0x4951ff[_0x10b4('0x2d')],'sectionId':_0x4951ff['id']},{})[_0x10b4('0x27')](function(){return _0x53efe7;});}else{return _0x53efe7;}})[_0x10b4('0x49')](function(_0x1bef6c){logger['error'](_0x10b4('0x57'),_0x1bef6c);throw _0x1bef6c;});}return _0x53efe7;})['then'](respondWithResult(_0x378b11,0xc9))[_0x10b4('0x49')](handleError(_0x378b11,null));};exports[_0x10b4('0x58')]=function(_0x31bfe8,_0x30139e){var _0x567606={'where':{'id':_0x31bfe8['params']['id']}},_0x26ed7e={};_0x26ed7e['model']=_['keys'](db[_0x10b4('0x31')][_0x10b4('0x32')]);_0x567606[_0x10b4('0x3b')]=_[_0x10b4('0x39')](_0x26ed7e['model'],qs[_0x10b4('0x3a')](_0x31bfe8['query']['fields']));_0x567606[_0x10b4('0x3b')]=_0x567606['attributes']['length']?_0x567606[_0x10b4('0x3b')]:_0x26ed7e['model'];if(_0x31bfe8[_0x10b4('0x37')][_0x10b4('0x47')]){_0x567606[_0x10b4('0x4c')]=[{'all':!![]}];}_0x567606=_[_0x10b4('0x44')]({},_0x567606,_0x31bfe8[_0x10b4('0x46')]);return db[_0x10b4('0x31')][_0x10b4('0x4d')](_0x567606)[_0x10b4('0x27')](handleEntityNotFound(_0x30139e,null))[_0x10b4('0x27')](function(_0x23959c){if(_0x23959c){var _0x57dcf7=_0x23959c[_0x10b4('0x51')]({'plain':!![]});_0x57dcf7=qs[_0x10b4('0x59')](_0x57dcf7,['id',_0x10b4('0x5a'),'updatedAt']);_0x31bfe8[_0x10b4('0x4f')]=_[_0x10b4('0x59')](_0x31bfe8[_0x10b4('0x4f')],['id',_0x10b4('0x5a'),_0x10b4('0x5b')]);return db[_0x10b4('0x31')][_0x10b4('0x4e')](_[_0x10b4('0x44')](_0x57dcf7,_0x31bfe8['body']),{'include':_0x31bfe8['query']['includeAll']?[{'all':!![]}]:undefined})[_0x10b4('0x27')](function(_0x50b574){var _0xe36877=_0x31bfe8[_0x10b4('0x50')]['get']({'plain':!![]});if(!_0xe36877)throw new Error(_0x10b4('0x52'));if(_0xe36877[_0x10b4('0x53')]==='user'){var _0x30b275=_0x50b574[_0x10b4('0x51')]({'plain':!![]});var _0x13087a=_0x10b4('0x29');return db[_0x10b4('0x54')]['find']({'where':{'name':_0x13087a,'userProfileId':_0xe36877['userProfileId']},'raw':!![]})[_0x10b4('0x27')](function(_0x538eab){if(_0x538eab&&_0x538eab[_0x10b4('0x56')]===0x0){return db[_0x10b4('0x2a')][_0x10b4('0x4e')]({'name':_0x30b275[_0x10b4('0x2d')],'resourceId':_0x30b275['id'],'type':_0x538eab[_0x10b4('0x2d')],'sectionId':_0x538eab['id']},{})[_0x10b4('0x27')](function(){return _0x50b574;});}else{return _0x50b574;}})[_0x10b4('0x49')](function(_0x5c27ab){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c27ab);throw _0x5c27ab;});}return _0x50b574;});}})[_0x10b4('0x27')](respondWithResult(_0x30139e,0xc9))['catch'](handleError(_0x30139e,null));};exports[_0x10b4('0x26')]=function(_0x5d1291,_0x491db6){if(_0x5d1291[_0x10b4('0x4f')]['id']){delete _0x5d1291[_0x10b4('0x4f')]['id'];}return db['JscriptyProject'][_0x10b4('0x4d')]({'where':{'id':_0x5d1291[_0x10b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x491db6,null))[_0x10b4('0x27')](saveUpdates(_0x5d1291[_0x10b4('0x4f')],null))[_0x10b4('0x27')](respondWithResult(_0x491db6,null))[_0x10b4('0x49')](handleError(_0x491db6,null));};exports[_0x10b4('0x28')]=function(_0x1cac3f,_0x17c231){return db['JscriptyProject'][_0x10b4('0x4d')]({'where':{'id':_0x1cac3f['params']['id']}})[_0x10b4('0x27')](handleEntityNotFound(_0x17c231,null))[_0x10b4('0x27')](removeEntity(_0x17c231,null))[_0x10b4('0x49')](handleError(_0x17c231,null));};exports['getSessions']=function(_0x5d6869,_0x3ad8ef,_0x4a65cb){var _0x35fefe={'raw':!![],'where':{}};var _0x12888f={};var _0x185ce9={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x10b4('0x5c')]({'where':{'id':_0x5d6869[_0x10b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ad8ef,null))[_0x10b4('0x27')](function(_0x45d725){if(_0x45d725){_0x12888f[_0x10b4('0x36')]=_[_0x10b4('0x38')](db[_0x10b4('0x5d')][_0x10b4('0x32')]);_0x12888f[_0x10b4('0x37')]=_[_0x10b4('0x38')](_0x5d6869[_0x10b4('0x37')]);_0x12888f[_0x10b4('0x42')]=_[_0x10b4('0x39')](_0x12888f[_0x10b4('0x36')],_0x12888f[_0x10b4('0x37')]);_0x35fefe['attributes']=_[_0x10b4('0x39')](_0x12888f['model'],qs['fields'](_0x5d6869[_0x10b4('0x37')][_0x10b4('0x3a')]));_0x35fefe['attributes']=_0x35fefe[_0x10b4('0x3b')][_0x10b4('0x3c')]?_0x35fefe[_0x10b4('0x3b')]:_0x12888f[_0x10b4('0x36')];if(!_0x5d6869[_0x10b4('0x37')][_0x10b4('0x5e')](_0x10b4('0x3d'))){_0x35fefe['limit']=qs[_0x10b4('0x1e')](_0x5d6869[_0x10b4('0x37')]['limit']);_0x35fefe[_0x10b4('0x1d')]=qs[_0x10b4('0x1d')](_0x5d6869[_0x10b4('0x37')][_0x10b4('0x1d')]);}_0x35fefe['order']=qs['sort'](_0x5d6869[_0x10b4('0x37')][_0x10b4('0x3f')]);_0x35fefe['where']=qs[_0x10b4('0x42')](_[_0x10b4('0x41')](_0x5d6869[_0x10b4('0x37')],_0x12888f[_0x10b4('0x42')]));_0x35fefe[_0x10b4('0x40')][_0x10b4('0x5f')]=_0x45d725['id'];if(_0x5d6869['query'][_0x10b4('0x43')]){_0x35fefe['where']=_[_0x10b4('0x44')](_0x35fefe[_0x10b4('0x40')],{'$or':_[_0x10b4('0x30')](_0x35fefe[_0x10b4('0x3b')],function(_0x2b9289){var _0x58e1e8={};_0x58e1e8[_0x2b9289]={'$like':'%'+_0x5d6869['query']['filter']+'%'};return _0x58e1e8;})});}_0x35fefe=_[_0x10b4('0x44')]({},_0x35fefe,_0x5d6869['options']);return db[_0x10b4('0x5d')][_0x10b4('0x20')]({'where':_0x35fefe[_0x10b4('0x40')]})['then'](function(_0x2522c6){_0x185ce9[_0x10b4('0x20')]=_0x2522c6;if(_0x5d6869[_0x10b4('0x37')][_0x10b4('0x47')]){_0x35fefe[_0x10b4('0x4c')]=[{'all':!![]}];}return db[_0x10b4('0x5d')][_0x10b4('0x60')](_0x35fefe);})[_0x10b4('0x27')](function(_0x25ba3d){_0x185ce9['rows']=_0x25ba3d;return _0x185ce9;});}})[_0x10b4('0x27')](respondWithFilteredResult(_0x3ad8ef,_0x35fefe))[_0x10b4('0x49')](handleError(_0x3ad8ef,null));};exports[_0x10b4('0x61')]=function(_0x3837f3,_0x4427ac,_0xeeffb9){var _0x57ea50={'raw':!![],'where':{}};var _0x273fd0={};var _0x4f8ae9={'count':0x0,'rows':[]};return db[_0x10b4('0x31')][_0x10b4('0x5c')]({'where':{'id':_0x3837f3['params']['id']}})[_0x10b4('0x27')](handleEntityNotFound(_0x4427ac,null))[_0x10b4('0x27')](function(_0xe511b9){if(_0xe511b9){_0x273fd0['model']=_[_0x10b4('0x38')](db[_0x10b4('0x62')][_0x10b4('0x32')]);_0x273fd0[_0x10b4('0x37')]=_[_0x10b4('0x38')](_0x3837f3[_0x10b4('0x37')]);_0x273fd0[_0x10b4('0x42')]=_[_0x10b4('0x39')](_0x273fd0[_0x10b4('0x36')],_0x273fd0[_0x10b4('0x37')]);_0x57ea50[_0x10b4('0x3b')]=_[_0x10b4('0x39')](_0x273fd0[_0x10b4('0x36')],qs[_0x10b4('0x3a')](_0x3837f3[_0x10b4('0x37')][_0x10b4('0x3a')]));_0x57ea50[_0x10b4('0x3b')]=_0x57ea50[_0x10b4('0x3b')][_0x10b4('0x3c')]?_0x57ea50[_0x10b4('0x3b')]:_0x273fd0[_0x10b4('0x36')];if(!_0x3837f3[_0x10b4('0x37')][_0x10b4('0x5e')](_0x10b4('0x3d'))){_0x57ea50['limit']=qs['limit'](_0x3837f3[_0x10b4('0x37')]['limit']);_0x57ea50['offset']=qs[_0x10b4('0x1d')](_0x3837f3[_0x10b4('0x37')][_0x10b4('0x1d')]);}_0x57ea50[_0x10b4('0x3e')]=qs['sort'](_0x3837f3['query'][_0x10b4('0x3f')]);_0x57ea50[_0x10b4('0x40')]=qs[_0x10b4('0x42')](_[_0x10b4('0x41')](_0x3837f3['query'],_0x273fd0[_0x10b4('0x42')]));_0x57ea50['where'][_0x10b4('0x5f')]=_0xe511b9['id'];if(_0x3837f3['query'][_0x10b4('0x43')]){_0x57ea50[_0x10b4('0x40')]=_[_0x10b4('0x44')](_0x57ea50[_0x10b4('0x40')],{'$or':_[_0x10b4('0x30')](_0x57ea50[_0x10b4('0x3b')],function(_0x53541f){var _0x3cb815={};_0x3cb815[_0x53541f]={'$like':'%'+_0x3837f3['query'][_0x10b4('0x43')]+'%'};return _0x3cb815;})});}_0x57ea50=_[_0x10b4('0x44')]({},_0x57ea50,_0x3837f3[_0x10b4('0x46')]);return db[_0x10b4('0x62')]['count']({'where':_0x57ea50[_0x10b4('0x40')]})[_0x10b4('0x27')](function(_0x42fb76){_0x4f8ae9[_0x10b4('0x20')]=_0x42fb76;if(_0x3837f3[_0x10b4('0x37')][_0x10b4('0x47')]){_0x57ea50[_0x10b4('0x4c')]=[{'all':!![]}];}return db[_0x10b4('0x62')][_0x10b4('0x60')](_0x57ea50);})[_0x10b4('0x27')](function(_0x183452){_0x4f8ae9[_0x10b4('0x48')]=_0x183452;return _0x4f8ae9;});}})[_0x10b4('0x27')](respondWithFilteredResult(_0x4427ac,_0x57ea50))[_0x10b4('0x49')](handleError(_0x4427ac,null));};function char(_0x4f4adb){return'number'===typeof _0x4f4adb?String[_0x10b4('0x63')]['apply'](null,arguments):_0x4f4adb;}function needsEncapsulation(_0x4aad59){return!!_0x4aad59&&(_0x4aad59['toString']()['indexOf'](char(0xd))>=0x0||_0x4aad59[_0x10b4('0x64')]()['indexOf'](char(0xa))>=0x0||_0x4aad59['toString']()['indexOf'](char(0x2c))>=0x0||_0x4aad59[_0x10b4('0x64')]()[_0x10b4('0x65')](char(0x22))>=0x0);}function encapsulate(_0x39eb84){var _0x2b3681=char(0x22),_0x4f1119='\x5c'+char(0x22),_0x128d97=_0x39eb84['toString']()[_0x10b4('0x66')](new RegExp(_0x2b3681,'g'),_0x4f1119);return _0x2b3681+_0x128d97+_0x2b3681;}exports[_0x10b4('0x67')]=function(_0x3ad80a,_0xd27f4b,_0x3394ee){var _0x59faee,_0x4edd91;var _0x5c7c64={'where':{'ProjectId':_0x3ad80a[_0x10b4('0x4b')]['id']}};if(_0x3ad80a[_0x10b4('0x37')][_0x10b4('0x68')]){_0x5c7c64[_0x10b4('0x40')][_0x10b4('0x69')]=JSON['parse'](_0x3ad80a[_0x10b4('0x37')]['startTime']);}return db[_0x10b4('0x5d')][_0x10b4('0x60')](_0x5c7c64)[_0x10b4('0x27')](handleEntityNotFound(_0xd27f4b,null))[_0x10b4('0x27')](function(_0x5538e6){if(_0x5538e6){_0x59faee=_0x5538e6;return db[_0x10b4('0x6a')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x59faee,'id')},'ProjectId':_0x3ad80a[_0x10b4('0x4b')]['id']},'order':_0x10b4('0x6b')});}})[_0x10b4('0x27')](handleEntityNotFound(_0xd27f4b,null))['then'](function(_0x2492fe){if(_0x2492fe){_0x4edd91=_0x2492fe;var _0x26c3c2={};for(var _0xc6aa9d=0x0,_0x4581b4=_0x4edd91[_0x10b4('0x3c')];_0xc6aa9d<_0x4581b4;_0xc6aa9d++){if(!_0x26c3c2[_0x10b4('0x5e')](_0x4edd91[_0xc6aa9d][_0x10b4('0x6c')])){_0x26c3c2[_0x4edd91[_0xc6aa9d][_0x10b4('0x6c')]]=needsEncapsulation(_0x4edd91[_0xc6aa9d][_0x10b4('0x6d')])?encapsulate(_0x4edd91[_0xc6aa9d][_0x10b4('0x6d')]):_0x4edd91[_0xc6aa9d][_0x10b4('0x6d')];}}var _0x5b9faa=[],_0x361bbf={};for(var _0x49ea97=0x0,_0x2ede72=_0x59faee['length'];_0x49ea97<_0x2ede72;_0x49ea97++){_0x361bbf={'ProjectId':_0x3ad80a[_0x10b4('0x4b')]['id'],'SessionId':_0x59faee[_0x49ea97]['id'],'StartTime':moment(_0x59faee[_0x49ea97][_0x10b4('0x69')])[_0x10b4('0x6e')](_0x10b4('0x6f'))};for(var _0x407cc4=0x0,_0x27fd50=_0x4edd91['length'];_0x407cc4<_0x27fd50;_0x407cc4++){if(_0x4edd91[_0x407cc4]['SessionId']==_0x59faee[_0x49ea97]['id']&&_0x26c3c2[_0x10b4('0x5e')](_0x4edd91[_0x407cc4][_0x10b4('0x6c')])){_0x361bbf[_0x26c3c2[_0x4edd91[_0x407cc4][_0x10b4('0x6c')]]]=_0x4edd91[_0x407cc4][_0x10b4('0x70')];}}for(var _0x2fa056 in _0x26c3c2){if(!_0x361bbf[_0x10b4('0x5e')](_0x26c3c2[_0x2fa056])){_0x361bbf[_0x26c3c2[_0x2fa056]]=null;}}_0x5b9faa['push'](_0x361bbf);}return _0x5b9faa;}})[_0x10b4('0x27')](function(_0x1bc508){if(!_[_0x10b4('0x71')](_0x1bc508)){var _0x3dabe7=toCsv(_0x1bc508);var _0x57bac0=Date['now']();fs[_0x10b4('0x72')](util[_0x10b4('0x6e')](_0x10b4('0x73'),_0x3ad80a[_0x10b4('0x4b')]['id'],_0x57bac0),_0x3dabe7);_0xd27f4b['setHeader']('Content-disposition',_0x10b4('0x74')+util[_0x10b4('0x6e')](_0x10b4('0x75'),_0x3ad80a['params']['id'],_0x57bac0));_0xd27f4b[_0x10b4('0x76')](_0x10b4('0x77'),_0x10b4('0x78'));return _0xd27f4b[_0x10b4('0x79')](util[_0x10b4('0x6e')](_0x10b4('0x73'),_0x3ad80a['params']['id'],_0x57bac0));}else{return _0xd27f4b[_0x10b4('0x19')](0xcc);}})[_0x10b4('0x49')](handleError(_0xd27f4b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 3e0a5de..e079fff 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 _0x0f4d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x345802,_0x44c1b5){_0x345802=_0x345802-0x0;var _0x2308a5=_0x0f4d[_0x345802];return _0x2308a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36b2=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x1fb038,_0xc3f69b){var _0x1600dc=function(_0x2a040e){while(--_0x2a040e){_0x1fb038['push'](_0x1fb038['shift']());}};_0x1600dc(++_0xc3f69b);}(_0x36b2,0x6b));var _0x236b=function(_0x3e6dbe,_0x1e56e5){_0x3e6dbe=_0x3e6dbe-0x0;var _0x1a4330=_0x36b2[_0x3e6dbe];return _0x1a4330;};'use strict';var _=require(_0x236b('0x0'));var util=require(_0x236b('0x1'));var logger=require(_0x236b('0x2'))('api');var moment=require(_0x236b('0x3'));var BPromise=require(_0x236b('0x4'));var rp=require(_0x236b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x236b('0x6'));var config=require(_0x236b('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x236b('0x8')]=function(_0x27c095,_0x37867a){return _0x27c095[_0x236b('0x9')](_0x236b('0xa'),attributes,{'tableName':_0x236b('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 c1d1fcf..d08e5b1 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(_0x2398b8,_0x4acb6c){var _0x3b2af1=function(_0x57512a){while(--_0x57512a){_0x2398b8['push'](_0x2398b8['shift']());}};_0x3b2af1(++_0x4acb6c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x36e3a9,_0x24b7b3){_0x36e3a9=_0x36e3a9-0x0;var _0x43ac05=_0xf4eb[_0x36e3a9];return _0x43ac05;};'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 _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(_0x19f137,_0x69a6c5){var _0x13021f=function(_0x53e2c5){while(--_0x53e2c5){_0x19f137['push'](_0x19f137['shift']());}};_0x13021f(++_0x69a6c5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5c74e6,_0x1bb98d){_0x5c74e6=_0x5c74e6-0x0;var _0x639fb2=_0xf4eb[_0x5c74e6];return _0x639fb2;};'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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index dba5335..31b260f 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 _0x7bd6=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/:id'];(function(_0x72305e,_0xeea264){var _0xdcf144=function(_0x41812f){while(--_0x41812f){_0x72305e['push'](_0x72305e['shift']());}};_0xdcf144(++_0xeea264);}(_0x7bd6,0x15b));var _0x67bd=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0x7bd6[_0x124f88];return _0xed0e3b;};'use strict';var multer=require(_0x67bd('0x0'));var util=require(_0x67bd('0x1'));var path=require(_0x67bd('0x2'));var timeout=require(_0x67bd('0x3'));var express=require(_0x67bd('0x4'));var router=express[_0x67bd('0x5')]();var fs_extra=require(_0x67bd('0x6'));var auth=require(_0x67bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x67bd('0x8'));var controller=require(_0x67bd('0x9'));router[_0x67bd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x67bd('0xa')]('/describe',auth[_0x67bd('0xb')](),controller['describe']);router['get'](_0x67bd('0xc'),auth[_0x67bd('0xb')](),controller[_0x67bd('0xd')]);router[_0x67bd('0xe')]('/',auth[_0x67bd('0xb')](),controller['create']);router[_0x67bd('0xf')](_0x67bd('0xc'),auth[_0x67bd('0xb')](),controller[_0x67bd('0x10')]);router[_0x67bd('0x11')](_0x67bd('0xc'),auth[_0x67bd('0xb')](),controller[_0x67bd('0x12')]);module[_0x67bd('0x13')]=router; \ No newline at end of file +var _0xd93a=['put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','/:id','show','create'];(function(_0x5847a0,_0x4a60c7){var _0x21316f=function(_0x4d1f99){while(--_0x4d1f99){_0x5847a0['push'](_0x5847a0['shift']());}};_0x21316f(++_0x4a60c7);}(_0xd93a,0xb7));var _0xad93=function(_0x191489,_0x444a6e){_0x191489=_0x191489-0x0;var _0x1de5af=_0xd93a[_0x191489];return _0x1de5af;};'use strict';var multer=require(_0xad93('0x0'));var util=require(_0xad93('0x1'));var path=require(_0xad93('0x2'));var timeout=require(_0xad93('0x3'));var express=require(_0xad93('0x4'));var router=express[_0xad93('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xad93('0x6'));var interaction=require(_0xad93('0x7'));var config=require(_0xad93('0x8'));var controller=require(_0xad93('0x9'));router[_0xad93('0xa')]('/',auth['isAuthenticated'](),controller[_0xad93('0xb')]);router[_0xad93('0xa')](_0xad93('0xc'),auth[_0xad93('0xd')](),controller['describe']);router[_0xad93('0xa')](_0xad93('0xe'),auth[_0xad93('0xd')](),controller[_0xad93('0xf')]);router['post']('/',auth[_0xad93('0xd')](),controller[_0xad93('0x10')]);router[_0xad93('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xad93('0x12')]);router[_0xad93('0x13')](_0xad93('0xe'),auth[_0xad93('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 58f40b0..3642224 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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0xdee4ea,_0xce37fe){_0xdee4ea=_0xdee4ea-0x0;var _0x52f14e=_0x7a54[_0xdee4ea];return _0x52f14e;};'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(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7a54,0x106));var _0x47a5=function(_0x24338b,_0x5df50c){_0x24338b=_0x24338b-0x0;var _0x48b303=_0x7a54[_0x24338b];return _0x48b303;};'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 573e239..830d336 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 _0xcdc6=['map','VIRTUAL','filter','options','then','includeAll','findAll','catch','show','params','include','find','create','update','body','describe','eml-format','fast-json-patch','request-promise','moment','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcdc6,0xee));var _0x6cdc=function(_0x335adc,_0x2f61ed){_0x335adc=_0x335adc-0x0;var _0x4e8739=_0xcdc6[_0x335adc];return _0x4e8739;};'use strict';var emlformat=require(_0x6cdc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6cdc('0x1'));var rp=require(_0x6cdc('0x2'));var moment=require(_0x6cdc('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6cdc('0x4'));var sox=require(_0x6cdc('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cdc('0x6'));var _=require(_0x6cdc('0x7'));var squel=require('squel');var crypto=require(_0x6cdc('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x6cdc('0x9'));var toCsv=require(_0x6cdc('0xa'));var querystring=require(_0x6cdc('0xb'));var Papa=require(_0x6cdc('0xc'));var Redis=require(_0x6cdc('0xd'));var authService=require(_0x6cdc('0xe'));var qs=require(_0x6cdc('0xf'));var as=require(_0x6cdc('0x10'));var hardwareService=require(_0x6cdc('0x11'));var logger=require(_0x6cdc('0x12'))(_0x6cdc('0x13'));var utils=require(_0x6cdc('0x14'));var config=require(_0x6cdc('0x15'));var licenseUtil=require(_0x6cdc('0x16'));var db=require(_0x6cdc('0x17'))['db'];function respondWithStatusCode(_0x124b5f,_0x29a5be){_0x29a5be=_0x29a5be||0xcc;return function(_0x315e91){if(_0x315e91){return _0x124b5f[_0x6cdc('0x18')](_0x29a5be);}return _0x124b5f[_0x6cdc('0x19')](_0x29a5be)[_0x6cdc('0x1a')]();};}function respondWithResult(_0x290922,_0x5da817){_0x5da817=_0x5da817||0xc8;return function(_0x3eafdc){if(_0x3eafdc){return _0x290922[_0x6cdc('0x19')](_0x5da817)[_0x6cdc('0x1b')](_0x3eafdc);}};}function respondWithFilteredResult(_0x4522ab,_0x341d11){return function(_0x4fce63){if(_0x4fce63){var _0x344578=typeof _0x341d11[_0x6cdc('0x1c')]===_0x6cdc('0x1d')&&typeof _0x341d11[_0x6cdc('0x1e')]==='undefined';var _0x11ae53=_0x4fce63[_0x6cdc('0x1f')];var _0x591570=_0x344578?0x0:_0x341d11[_0x6cdc('0x1c')];var _0x5ad7d0=_0x344578?_0x4fce63[_0x6cdc('0x1f')]:_0x341d11[_0x6cdc('0x1c')]+_0x341d11['limit'];var _0x3f1c78;if(_0x5ad7d0>=_0x11ae53){_0x5ad7d0=_0x11ae53;_0x3f1c78=0xc8;}else{_0x3f1c78=0xce;}_0x4522ab[_0x6cdc('0x19')](_0x3f1c78);return _0x4522ab[_0x6cdc('0x20')](_0x6cdc('0x21'),_0x591570+'-'+_0x5ad7d0+'/'+_0x11ae53)[_0x6cdc('0x1b')](_0x4fce63);}return null;};}function patchUpdates(_0x5ca346){return function(_0x548f79){try{jsonpatch[_0x6cdc('0x22')](_0x548f79,_0x5ca346,!![]);}catch(_0x293212){return BPromise['reject'](_0x293212);}return _0x548f79[_0x6cdc('0x23')]();};}function saveUpdates(_0x4f4520,_0x31f328){return function(_0x27f8aa){if(_0x27f8aa){return _0x27f8aa['update'](_0x4f4520)['then'](function(_0x4c8e97){return _0x4c8e97;});}return null;};}function removeEntity(_0x91c2c1,_0x5eeef5){return function(_0x24dbde){if(_0x24dbde){return _0x24dbde[_0x6cdc('0x24')]()['then'](function(){_0x91c2c1[_0x6cdc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3686,_0x366e03){return function(_0x446ee3){if(!_0x446ee3){_0x1f3686[_0x6cdc('0x18')](0x194);}return _0x446ee3;};}function handleError(_0x50c3c8,_0xe2f088){_0xe2f088=_0xe2f088||0x1f4;return function(_0x4a8a4b){logger['error'](_0x4a8a4b['stack']);if(_0x4a8a4b[_0x6cdc('0x25')]){delete _0x4a8a4b[_0x6cdc('0x25')];}_0x50c3c8[_0x6cdc('0x19')](_0xe2f088)[_0x6cdc('0x26')](_0x4a8a4b);};}exports[_0x6cdc('0x27')]=function(_0x5220d6,_0x4731f3){var _0x142b59={},_0x30fbc6={},_0x14a43d={'count':0x0,'rows':[]};var _0x155e32=_['map'](db[_0x6cdc('0x28')][_0x6cdc('0x29')],function(_0x159ce2){return{'name':_0x159ce2[_0x6cdc('0x2a')],'type':_0x159ce2[_0x6cdc('0x2b')][_0x6cdc('0x2c')]};});_0x30fbc6[_0x6cdc('0x2d')]=_['map'](_0x155e32,'name');_0x30fbc6['query']=_[_0x6cdc('0x2e')](_0x5220d6['query']);_0x30fbc6[_0x6cdc('0x2f')]=_[_0x6cdc('0x30')](_0x30fbc6[_0x6cdc('0x2d')],_0x30fbc6[_0x6cdc('0x31')]);_0x142b59[_0x6cdc('0x32')]=_['intersection'](_0x30fbc6['model'],qs['fields'](_0x5220d6['query'][_0x6cdc('0x33')]));_0x142b59['attributes']=_0x142b59[_0x6cdc('0x32')]['length']?_0x142b59[_0x6cdc('0x32')]:_0x30fbc6[_0x6cdc('0x2d')];if(!_0x5220d6[_0x6cdc('0x31')]['hasOwnProperty'](_0x6cdc('0x34'))){_0x142b59[_0x6cdc('0x1e')]=qs['limit'](_0x5220d6['query'][_0x6cdc('0x1e')]);_0x142b59[_0x6cdc('0x1c')]=qs[_0x6cdc('0x1c')](_0x5220d6[_0x6cdc('0x31')][_0x6cdc('0x1c')]);}_0x142b59[_0x6cdc('0x35')]=qs[_0x6cdc('0x36')](_0x5220d6[_0x6cdc('0x31')][_0x6cdc('0x36')]);_0x142b59[_0x6cdc('0x37')]=qs[_0x6cdc('0x2f')](_[_0x6cdc('0x38')](_0x5220d6[_0x6cdc('0x31')],_0x30fbc6[_0x6cdc('0x2f')]),_0x155e32);if(_0x5220d6[_0x6cdc('0x31')]['filter']){_0x142b59[_0x6cdc('0x37')]=_[_0x6cdc('0x39')](_0x142b59[_0x6cdc('0x37')],{'$or':_[_0x6cdc('0x3a')](_0x155e32,function(_0x57977f){if(_0x57977f[_0x6cdc('0x2b')]!==_0x6cdc('0x3b')){var _0x212d33={};_0x212d33[_0x57977f[_0x6cdc('0x25')]]={'$like':'%'+_0x5220d6[_0x6cdc('0x31')][_0x6cdc('0x3c')]+'%'};return _0x212d33;}})});}_0x142b59=_[_0x6cdc('0x39')]({},_0x142b59,_0x5220d6[_0x6cdc('0x3d')]);var _0x446325={'where':_0x142b59[_0x6cdc('0x37')]};return db[_0x6cdc('0x28')][_0x6cdc('0x1f')](_0x446325)[_0x6cdc('0x3e')](function(_0x2efafe){_0x14a43d[_0x6cdc('0x1f')]=_0x2efafe;if(_0x5220d6[_0x6cdc('0x31')][_0x6cdc('0x3f')]){_0x142b59['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6cdc('0x40')](_0x142b59);})[_0x6cdc('0x3e')](function(_0x198188){_0x14a43d['rows']=_0x198188;return _0x14a43d;})['then'](respondWithFilteredResult(_0x4731f3,_0x142b59))[_0x6cdc('0x41')](handleError(_0x4731f3,null));};exports[_0x6cdc('0x42')]=function(_0x2fb9e2,_0xf77cbb){var _0xe48bac={'raw':!![],'where':{'id':_0x2fb9e2[_0x6cdc('0x43')]['id']}},_0x771d47={};_0x771d47['model']=_[_0x6cdc('0x2e')](db[_0x6cdc('0x28')][_0x6cdc('0x29')]);_0x771d47[_0x6cdc('0x31')]=_['keys'](_0x2fb9e2[_0x6cdc('0x31')]);_0x771d47['filters']=_[_0x6cdc('0x30')](_0x771d47[_0x6cdc('0x2d')],_0x771d47[_0x6cdc('0x31')]);_0xe48bac[_0x6cdc('0x32')]=_['intersection'](_0x771d47[_0x6cdc('0x2d')],qs[_0x6cdc('0x33')](_0x2fb9e2[_0x6cdc('0x31')][_0x6cdc('0x33')]));_0xe48bac[_0x6cdc('0x32')]=_0xe48bac[_0x6cdc('0x32')]['length']?_0xe48bac['attributes']:_0x771d47[_0x6cdc('0x2d')];if(_0x2fb9e2[_0x6cdc('0x31')]['includeAll']){_0xe48bac[_0x6cdc('0x44')]=[{'all':!![]}];}_0xe48bac=_[_0x6cdc('0x39')]({},_0xe48bac,_0x2fb9e2[_0x6cdc('0x3d')]);return db[_0x6cdc('0x28')][_0x6cdc('0x45')](_0xe48bac)['then'](handleEntityNotFound(_0xf77cbb,null))['then'](respondWithResult(_0xf77cbb,null))['catch'](handleError(_0xf77cbb,null));};exports['create']=function(_0x5d5010,_0x1f7e5a){return db[_0x6cdc('0x28')][_0x6cdc('0x46')](_0x5d5010['body'],{})['then'](respondWithResult(_0x1f7e5a,0xc9))[_0x6cdc('0x41')](handleError(_0x1f7e5a,null));};exports[_0x6cdc('0x47')]=function(_0x535f37,_0x364789){if(_0x535f37[_0x6cdc('0x48')]['id']){delete _0x535f37[_0x6cdc('0x48')]['id'];}return db[_0x6cdc('0x28')][_0x6cdc('0x45')]({'where':{'id':_0x535f37[_0x6cdc('0x43')]['id']}})[_0x6cdc('0x3e')](handleEntityNotFound(_0x364789,null))[_0x6cdc('0x3e')](saveUpdates(_0x535f37[_0x6cdc('0x48')],null))[_0x6cdc('0x3e')](respondWithResult(_0x364789,null))[_0x6cdc('0x41')](handleError(_0x364789,null));};exports[_0x6cdc('0x24')]=function(_0x1b5d38,_0x25c854){return db[_0x6cdc('0x28')][_0x6cdc('0x45')]({'where':{'id':_0x1b5d38['params']['id']}})[_0x6cdc('0x3e')](handleEntityNotFound(_0x25c854,null))[_0x6cdc('0x3e')](removeEntity(_0x25c854,null))[_0x6cdc('0x41')](handleError(_0x25c854,null));};exports['describe']=function(_0x2b5a7d,_0x513a31){return db[_0x6cdc('0x28')][_0x6cdc('0x49')]()[_0x6cdc('0x3e')](respondWithResult(_0x513a31,null))['catch'](handleError(_0x513a31,null));}; \ No newline at end of file +var _0x307c=['crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','JscriptyQuestionReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','fs-extra','squel'];(function(_0x259852,_0x53c24c){var _0x247879=function(_0x4e4ac6){while(--_0x4e4ac6){_0x259852['push'](_0x259852['shift']());}};_0x247879(++_0x53c24c);}(_0x307c,0x164));var _0xc307=function(_0x316d6d,_0xed8c8a){_0x316d6d=_0x316d6d-0x0;var _0x58c823=_0x307c[_0x316d6d];return _0x58c823;};'use strict';var emlformat=require(_0xc307('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc307('0x1'));var jsonpatch=require(_0xc307('0x2'));var rp=require('request-promise');var moment=require(_0xc307('0x3'));var BPromise=require(_0xc307('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc307('0x5'));var csv=require(_0xc307('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc307('0x7'));var _=require('lodash');var squel=require(_0xc307('0x8'));var crypto=require(_0xc307('0x9'));var jsforce=require(_0xc307('0xa'));var deskjs=require(_0xc307('0xb'));var toCsv=require(_0xc307('0x6'));var querystring=require(_0xc307('0xc'));var Papa=require(_0xc307('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc307('0xe'));var as=require(_0xc307('0xf'));var hardwareService=require(_0xc307('0x10'));var logger=require(_0xc307('0x11'))(_0xc307('0x12'));var utils=require(_0xc307('0x13'));var config=require(_0xc307('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc307('0x15'))['db'];function respondWithStatusCode(_0x1e307a,_0xe218d1){_0xe218d1=_0xe218d1||0xcc;return function(_0x5be9b3){if(_0x5be9b3){return _0x1e307a[_0xc307('0x16')](_0xe218d1);}return _0x1e307a[_0xc307('0x17')](_0xe218d1)[_0xc307('0x18')]();};}function respondWithResult(_0x831559,_0x32e1c3){_0x32e1c3=_0x32e1c3||0xc8;return function(_0x33ab2a){if(_0x33ab2a){return _0x831559['status'](_0x32e1c3)[_0xc307('0x19')](_0x33ab2a);}};}function respondWithFilteredResult(_0x3460f6,_0x2e960e){return function(_0x275f26){if(_0x275f26){var _0x27b866=typeof _0x2e960e[_0xc307('0x1a')]===_0xc307('0x1b')&&typeof _0x2e960e[_0xc307('0x1c')]===_0xc307('0x1b');var _0x1d8515=_0x275f26[_0xc307('0x1d')];var _0x4e8579=_0x27b866?0x0:_0x2e960e[_0xc307('0x1a')];var _0x38a4e3=_0x27b866?_0x275f26[_0xc307('0x1d')]:_0x2e960e[_0xc307('0x1a')]+_0x2e960e['limit'];var _0x27850f;if(_0x38a4e3>=_0x1d8515){_0x38a4e3=_0x1d8515;_0x27850f=0xc8;}else{_0x27850f=0xce;}_0x3460f6[_0xc307('0x17')](_0x27850f);return _0x3460f6[_0xc307('0x1e')](_0xc307('0x1f'),_0x4e8579+'-'+_0x38a4e3+'/'+_0x1d8515)[_0xc307('0x19')](_0x275f26);}return null;};}function patchUpdates(_0x4171c2){return function(_0x3dc02f){try{jsonpatch[_0xc307('0x20')](_0x3dc02f,_0x4171c2,!![]);}catch(_0x3d65b8){return BPromise[_0xc307('0x21')](_0x3d65b8);}return _0x3dc02f['save']();};}function saveUpdates(_0x39e05e,_0x48685e){return function(_0x4fd24f){if(_0x4fd24f){return _0x4fd24f[_0xc307('0x22')](_0x39e05e)[_0xc307('0x23')](function(_0x4a1d11){return _0x4a1d11;});}return null;};}function removeEntity(_0x3bb839,_0x3b28d3){return function(_0x82455b){if(_0x82455b){return _0x82455b[_0xc307('0x24')]()['then'](function(){_0x3bb839['status'](0xcc)[_0xc307('0x18')]();});}};}function handleEntityNotFound(_0x59c0ad,_0x2f4670){return function(_0x31f2f5){if(!_0x31f2f5){_0x59c0ad['sendStatus'](0x194);}return _0x31f2f5;};}function handleError(_0x4f9141,_0x3f8468){_0x3f8468=_0x3f8468||0x1f4;return function(_0x5f24ab){logger['error'](_0x5f24ab[_0xc307('0x25')]);if(_0x5f24ab['name']){delete _0x5f24ab[_0xc307('0x26')];}_0x4f9141[_0xc307('0x17')](_0x3f8468)[_0xc307('0x27')](_0x5f24ab);};}exports[_0xc307('0x28')]=function(_0x5eccc7,_0x2ce279){var _0x156cad={},_0xb9e6c5={},_0x4bd847={'count':0x0,'rows':[]};var _0x556c35=_[_0xc307('0x29')](db[_0xc307('0x2a')]['rawAttributes'],function(_0x137ad8){return{'name':_0x137ad8['fieldName'],'type':_0x137ad8[_0xc307('0x2b')][_0xc307('0x2c')]};});_0xb9e6c5[_0xc307('0x2d')]=_[_0xc307('0x29')](_0x556c35,_0xc307('0x26'));_0xb9e6c5[_0xc307('0x2e')]=_[_0xc307('0x2f')](_0x5eccc7[_0xc307('0x2e')]);_0xb9e6c5[_0xc307('0x30')]=_[_0xc307('0x31')](_0xb9e6c5[_0xc307('0x2d')],_0xb9e6c5[_0xc307('0x2e')]);_0x156cad[_0xc307('0x32')]=_[_0xc307('0x31')](_0xb9e6c5['model'],qs[_0xc307('0x33')](_0x5eccc7['query'][_0xc307('0x33')]));_0x156cad['attributes']=_0x156cad[_0xc307('0x32')]['length']?_0x156cad[_0xc307('0x32')]:_0xb9e6c5[_0xc307('0x2d')];if(!_0x5eccc7[_0xc307('0x2e')][_0xc307('0x34')]('nolimit')){_0x156cad[_0xc307('0x1c')]=qs['limit'](_0x5eccc7[_0xc307('0x2e')]['limit']);_0x156cad[_0xc307('0x1a')]=qs[_0xc307('0x1a')](_0x5eccc7['query']['offset']);}_0x156cad['order']=qs[_0xc307('0x35')](_0x5eccc7[_0xc307('0x2e')][_0xc307('0x35')]);_0x156cad[_0xc307('0x36')]=qs[_0xc307('0x30')](_[_0xc307('0x37')](_0x5eccc7[_0xc307('0x2e')],_0xb9e6c5[_0xc307('0x30')]),_0x556c35);if(_0x5eccc7['query'][_0xc307('0x38')]){_0x156cad[_0xc307('0x36')]=_['merge'](_0x156cad[_0xc307('0x36')],{'$or':_[_0xc307('0x29')](_0x556c35,function(_0x706ec9){if(_0x706ec9[_0xc307('0x2b')]!==_0xc307('0x39')){var _0x54a31d={};_0x54a31d[_0x706ec9['name']]={'$like':'%'+_0x5eccc7[_0xc307('0x2e')][_0xc307('0x38')]+'%'};return _0x54a31d;}})});}_0x156cad=_[_0xc307('0x3a')]({},_0x156cad,_0x5eccc7[_0xc307('0x3b')]);var _0x3532a5={'where':_0x156cad['where']};return db[_0xc307('0x2a')][_0xc307('0x1d')](_0x3532a5)[_0xc307('0x23')](function(_0x3ac202){_0x4bd847[_0xc307('0x1d')]=_0x3ac202;if(_0x5eccc7[_0xc307('0x2e')][_0xc307('0x3c')]){_0x156cad[_0xc307('0x3d')]=[{'all':!![]}];}return db[_0xc307('0x2a')][_0xc307('0x3e')](_0x156cad);})[_0xc307('0x23')](function(_0x1c673a){_0x4bd847[_0xc307('0x3f')]=_0x1c673a;return _0x4bd847;})[_0xc307('0x23')](respondWithFilteredResult(_0x2ce279,_0x156cad))['catch'](handleError(_0x2ce279,null));};exports[_0xc307('0x40')]=function(_0x170a1b,_0x3c3222){var _0x5c3520={'raw':!![],'where':{'id':_0x170a1b[_0xc307('0x41')]['id']}},_0x5e9f26={};_0x5e9f26[_0xc307('0x2d')]=_[_0xc307('0x2f')](db[_0xc307('0x2a')][_0xc307('0x42')]);_0x5e9f26['query']=_[_0xc307('0x2f')](_0x170a1b[_0xc307('0x2e')]);_0x5e9f26[_0xc307('0x30')]=_[_0xc307('0x31')](_0x5e9f26[_0xc307('0x2d')],_0x5e9f26[_0xc307('0x2e')]);_0x5c3520['attributes']=_['intersection'](_0x5e9f26[_0xc307('0x2d')],qs[_0xc307('0x33')](_0x170a1b['query'][_0xc307('0x33')]));_0x5c3520[_0xc307('0x32')]=_0x5c3520[_0xc307('0x32')][_0xc307('0x43')]?_0x5c3520[_0xc307('0x32')]:_0x5e9f26[_0xc307('0x2d')];if(_0x170a1b[_0xc307('0x2e')]['includeAll']){_0x5c3520[_0xc307('0x3d')]=[{'all':!![]}];}_0x5c3520=_[_0xc307('0x3a')]({},_0x5c3520,_0x170a1b[_0xc307('0x3b')]);return db[_0xc307('0x2a')][_0xc307('0x44')](_0x5c3520)['then'](handleEntityNotFound(_0x3c3222,null))[_0xc307('0x23')](respondWithResult(_0x3c3222,null))[_0xc307('0x45')](handleError(_0x3c3222,null));};exports[_0xc307('0x46')]=function(_0x4bf6e9,_0x3f81a2){return db[_0xc307('0x2a')][_0xc307('0x46')](_0x4bf6e9[_0xc307('0x47')],{})[_0xc307('0x23')](respondWithResult(_0x3f81a2,0xc9))[_0xc307('0x45')](handleError(_0x3f81a2,null));};exports[_0xc307('0x22')]=function(_0x2a45bd,_0x12bde3){if(_0x2a45bd[_0xc307('0x47')]['id']){delete _0x2a45bd[_0xc307('0x47')]['id'];}return db[_0xc307('0x2a')][_0xc307('0x44')]({'where':{'id':_0x2a45bd[_0xc307('0x41')]['id']}})[_0xc307('0x23')](handleEntityNotFound(_0x12bde3,null))[_0xc307('0x23')](saveUpdates(_0x2a45bd[_0xc307('0x47')],null))[_0xc307('0x23')](respondWithResult(_0x12bde3,null))[_0xc307('0x45')](handleError(_0x12bde3,null));};exports['destroy']=function(_0x1a49f0,_0x6425c3){return db[_0xc307('0x2a')][_0xc307('0x44')]({'where':{'id':_0x1a49f0[_0xc307('0x41')]['id']}})[_0xc307('0x23')](handleEntityNotFound(_0x6425c3,null))['then'](removeEntity(_0x6425c3,null))[_0xc307('0x45')](handleError(_0x6425c3,null));};exports[_0xc307('0x48')]=function(_0x40c8bc,_0xc8d00a){return db[_0xc307('0x2a')]['describe']()[_0xc307('0x23')](respondWithResult(_0xc8d00a,null))[_0xc307('0x45')](handleError(_0xc8d00a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7208118..f2ed729 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 _0x2a2a=['moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api'];(function(_0x133522,_0x1d2817){var _0x18219b=function(_0x39ffb8){while(--_0x39ffb8){_0x133522['push'](_0x133522['shift']());}};_0x18219b(++_0x1d2817);}(_0x2a2a,0x96));var _0xa2a2=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x2a2a[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0xa2a2('0x0'));var util=require(_0xa2a2('0x1'));var logger=require(_0xa2a2('0x2'))(_0xa2a2('0x3'));var moment=require(_0xa2a2('0x4'));var BPromise=require(_0xa2a2('0x5'));var rp=require(_0xa2a2('0x6'));var fs=require('fs');var path=require(_0xa2a2('0x7'));var rimraf=require(_0xa2a2('0x8'));var config=require('../../config/environment');var attributes=require(_0xa2a2('0x9'));module[_0xa2a2('0xa')]=function(_0x184b6b,_0x33777d){return _0x184b6b[_0xa2a2('0xb')](_0xa2a2('0xc'),attributes,{'tableName':_0xa2a2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dd1=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9dd1,0xae));var _0x19dd=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x9dd1[_0x1d2bc8];return _0x1857e1;};'use strict';var _=require('lodash');var util=require(_0x19dd('0x0'));var logger=require(_0x19dd('0x1'))(_0x19dd('0x2'));var moment=require(_0x19dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x19dd('0x4'));var fs=require('fs');var path=require(_0x19dd('0x5'));var rimraf=require(_0x19dd('0x6'));var config=require(_0x19dd('0x7'));var attributes=require(_0x19dd('0x8'));module['exports']=function(_0x22cc95,_0x435671){return _0x22cc95[_0x19dd('0x9')](_0x19dd('0xa'),attributes,{'tableName':_0x19dd('0xb'),'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 cebca52..cf5b17e 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 _0x4265=['info','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x3a9fc9,_0xa9fa32){var _0x50f586=function(_0xa8c702){while(--_0xa8c702){_0x3a9fc9['push'](_0x3a9fc9['shift']());}};_0x50f586(++_0xa9fa32);}(_0x4265,0x186));var _0x5426=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4265[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5426('0x0'));var util=require(_0x5426('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5426('0x2'));var fs=require('fs');var Redis=require(_0x5426('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5426('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5426('0x5'));var jayson=require(_0x5426('0x6'));var client=jayson[_0x5426('0x7')][_0x5426('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53515c,_0x56ab60,_0x5f04e0){return new BPromise(function(_0x531ba9,_0x25ee8e){return client[_0x5426('0x9')](_0x53515c,_0x5f04e0)['then'](function(_0x1fa0f8){logger[_0x5426('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x56ab60,'request\x20sent');logger[_0x5426('0xb')](_0x5426('0xc'),_0x56ab60,_0x5426('0xd'),JSON[_0x5426('0xe')](_0x1fa0f8));if(_0x1fa0f8['error']){if(_0x1fa0f8[_0x5426('0xf')][_0x5426('0x10')]===0x1f4){logger['error'](_0x5426('0x11'),_0x56ab60,_0x1fa0f8[_0x5426('0xf')][_0x5426('0x12')]);return _0x25ee8e(_0x1fa0f8[_0x5426('0xf')][_0x5426('0x12')]);}logger[_0x5426('0xf')](_0x5426('0x11'),_0x56ab60,_0x1fa0f8[_0x5426('0xf')][_0x5426('0x12')]);return _0x531ba9(_0x1fa0f8[_0x5426('0xf')][_0x5426('0x12')]);}else{logger[_0x5426('0xa')](_0x5426('0x11'),_0x56ab60,_0x5426('0xd'));_0x531ba9(_0x1fa0f8[_0x5426('0x13')]['message']);}})['catch'](function(_0x4b6cba){logger[_0x5426('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x56ab60,_0x4b6cba);_0x25ee8e(_0x4b6cba);});});} \ No newline at end of file +var _0xb6fe=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result'];(function(_0x31e9c3,_0x5563da){var _0x42230f=function(_0x3ee514){while(--_0x3ee514){_0x31e9c3['push'](_0x31e9c3['shift']());}};_0x42230f(++_0x5563da);}(_0xb6fe,0x1a3));var _0xeb6f=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xb6fe[_0x2d89ce];return _0x3fad10;};'use strict';var _=require(_0xeb6f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeb6f('0x1'));var rs=require(_0xeb6f('0x2'));var fs=require('fs');var Redis=require(_0xeb6f('0x3'));var db=require(_0xeb6f('0x4'))['db'];var utils=require(_0xeb6f('0x5'));var logger=require(_0xeb6f('0x6'))(_0xeb6f('0x7'));var config=require(_0xeb6f('0x8'));var jayson=require(_0xeb6f('0x9'));var client=jayson[_0xeb6f('0xa')][_0xeb6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x143268,_0x3860eb,_0x52e6ac){return new BPromise(function(_0x50dff7,_0x2253aa){return client['request'](_0x143268,_0x52e6ac)[_0xeb6f('0xc')](function(_0x2d0548){logger[_0xeb6f('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3860eb,'request\x20sent');logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3860eb,_0xeb6f('0xe'),JSON[_0xeb6f('0xf')](_0x2d0548));if(_0x2d0548[_0xeb6f('0x10')]){if(_0x2d0548[_0xeb6f('0x10')][_0xeb6f('0x11')]===0x1f4){logger['error'](_0xeb6f('0x12'),_0x3860eb,_0x2d0548[_0xeb6f('0x10')][_0xeb6f('0x13')]);return _0x2253aa(_0x2d0548['error'][_0xeb6f('0x13')]);}logger[_0xeb6f('0x10')](_0xeb6f('0x12'),_0x3860eb,_0x2d0548[_0xeb6f('0x10')][_0xeb6f('0x13')]);return _0x50dff7(_0x2d0548[_0xeb6f('0x10')][_0xeb6f('0x13')]);}else{logger[_0xeb6f('0xd')](_0xeb6f('0x12'),_0x3860eb,_0xeb6f('0xe'));_0x50dff7(_0x2d0548[_0xeb6f('0x14')][_0xeb6f('0x13')]);}})[_0xeb6f('0x15')](function(_0x54cf29){logger[_0xeb6f('0x10')](_0xeb6f('0x12'),_0x3860eb,_0x54cf29);_0x2253aa(_0x54cf29);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 713ebe2..ffb9d92 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 _0x30ba=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','get','describe','/:id','show','getQuestions','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30ba,0x1b3));var _0xa30b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x30ba[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xa30b('0x0'));var path=require(_0xa30b('0x1'));var timeout=require(_0xa30b('0x2'));var express=require(_0xa30b('0x3'));var router=express[_0xa30b('0x4')]();var fs_extra=require(_0xa30b('0x5'));var auth=require(_0xa30b('0x6'));var interaction=require(_0xa30b('0x7'));var config=require(_0xa30b('0x8'));var controller=require(_0xa30b('0x9'));router['get']('/',auth[_0xa30b('0xa')](),controller['index']);router[_0xa30b('0xb')]('/describe',auth[_0xa30b('0xa')](),controller[_0xa30b('0xc')]);router[_0xa30b('0xb')](_0xa30b('0xd'),auth[_0xa30b('0xa')](),controller[_0xa30b('0xe')]);router[_0xa30b('0xb')]('/:id/questions',auth[_0xa30b('0xa')](),controller[_0xa30b('0xf')]);router[_0xa30b('0x10')]('/',auth[_0xa30b('0xa')](),controller['create']);router[_0xa30b('0x11')](_0xa30b('0xd'),auth[_0xa30b('0xa')](),controller[_0xa30b('0x12')]);router[_0xa30b('0x13')](_0xa30b('0xd'),auth[_0xa30b('0xa')](),controller[_0xa30b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8395=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','create','put','delete','destroy','exports'];(function(_0x393525,_0x258412){var _0x5e8282=function(_0x24a496){while(--_0x24a496){_0x393525['push'](_0x393525['shift']());}};_0x5e8282(++_0x258412);}(_0x8395,0x1f4));var _0x5839=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x8395[_0xb833b1];return _0x1ab87a;};'use strict';var multer=require(_0x5839('0x0'));var util=require(_0x5839('0x1'));var path=require('path');var timeout=require(_0x5839('0x2'));var express=require(_0x5839('0x3'));var router=express['Router']();var fs_extra=require(_0x5839('0x4'));var auth=require(_0x5839('0x5'));var interaction=require(_0x5839('0x6'));var config=require('../../config/environment');var controller=require(_0x5839('0x7'));router[_0x5839('0x8')]('/',auth[_0x5839('0x9')](),controller['index']);router[_0x5839('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5839('0xa')]);router[_0x5839('0x8')](_0x5839('0xb'),auth['isAuthenticated'](),controller[_0x5839('0xc')]);router[_0x5839('0x8')](_0x5839('0xd'),auth['isAuthenticated'](),controller[_0x5839('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5839('0xf')]);router[_0x5839('0x10')](_0x5839('0xb'),auth[_0x5839('0x9')](),controller['update']);router[_0x5839('0x11')](_0x5839('0xb'),auth[_0x5839('0x9')](),controller[_0x5839('0x12')]);module[_0x5839('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 0c715b9..d3acc7d 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 _0x7896=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7896,0x127));var _0x6789=function(_0x5ac791,_0x504d37){_0x5ac791=_0x5ac791-0x0;var _0x9e3a19=_0x7896[_0x5ac791];return _0x9e3a19;};'use strict';var moment=require(_0x6789('0x0'));var Sequelize=require(_0x6789('0x1'));module[_0x6789('0x2')]={'starttime':{'type':Sequelize[_0x6789('0x3')],'set':function(_0x32e771){this[_0x6789('0x4')](_0x6789('0x5'),_0x32e771);this[_0x6789('0x4')](_0x6789('0x6'),moment()[_0x6789('0x7')](_0x6789('0x8')));}},'endtime':{'type':Sequelize[_0x6789('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x6789('0x9')]},'queue':{'type':Sequelize[_0x6789('0x9')]},'uniqueid':{'type':Sequelize[_0x6789('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6789('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xba73=['moment','sequelize','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN'];(function(_0x221fbf,_0x550215){var _0x343397=function(_0x343d7a){while(--_0x343d7a){_0x221fbf['push'](_0x221fbf['shift']());}};_0x343397(++_0x550215);}(_0xba73,0x18c));var _0x3ba7=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xba73[_0x500419];return _0x241c1a;};'use strict';var moment=require(_0x3ba7('0x0'));var Sequelize=require(_0x3ba7('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x31ef70){this[_0x3ba7('0x2')]('starttime',_0x31ef70);this[_0x3ba7('0x2')](_0x3ba7('0x3'),moment()[_0x3ba7('0x4')](_0x3ba7('0x5')));}},'endtime':{'type':Sequelize[_0x3ba7('0x6')]},'membername':{'type':Sequelize[_0x3ba7('0x7')]},'projectname':{'type':Sequelize[_0x3ba7('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3ba7('0x7')]},'calleridname':{'type':Sequelize[_0x3ba7('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x3ba7('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 a677b72..d449538 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 _0x48bf=['where','pick','merge','type','filter','options','includeAll','include','rows','catch','params','body','find','describe','JscriptyQuestionReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','JscriptySessionReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x64ff1c,_0x2eec47){var _0x44cce7=function(_0x6577ef){while(--_0x6577ef){_0x64ff1c['push'](_0x64ff1c['shift']());}};_0x44cce7(++_0x2eec47);}(_0x48bf,0xa4));var _0xf48b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x48bf[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require(_0xf48b('0x0'));var rimraf=require(_0xf48b('0x1'));var zipdir=require(_0xf48b('0x2'));var jsonpatch=require(_0xf48b('0x3'));var rp=require(_0xf48b('0x4'));var moment=require('moment');var BPromise=require(_0xf48b('0x5'));var Mustache=require(_0xf48b('0x6'));var util=require(_0xf48b('0x7'));var path=require(_0xf48b('0x8'));var sox=require(_0xf48b('0x9'));var csv=require(_0xf48b('0xa'));var ejs=require(_0xf48b('0xb'));var fs=require('fs');var fs_extra=require(_0xf48b('0xc'));var _=require(_0xf48b('0xd'));var squel=require(_0xf48b('0xe'));var crypto=require(_0xf48b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf48b('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf48b('0x11'));var qs=require(_0xf48b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf48b('0x13'));var logger=require(_0xf48b('0x14'))('api');var utils=require(_0xf48b('0x15'));var config=require(_0xf48b('0x16'));var licenseUtil=require(_0xf48b('0x17'));var db=require(_0xf48b('0x18'))['db'];function respondWithStatusCode(_0x483ac2,_0x47f5cf){_0x47f5cf=_0x47f5cf||0xcc;return function(_0x1fdeb6){if(_0x1fdeb6){return _0x483ac2[_0xf48b('0x19')](_0x47f5cf);}return _0x483ac2['status'](_0x47f5cf)['end']();};}function respondWithResult(_0x23698d,_0x5c6256){_0x5c6256=_0x5c6256||0xc8;return function(_0x555792){if(_0x555792){return _0x23698d['status'](_0x5c6256)[_0xf48b('0x1a')](_0x555792);}};}function respondWithFilteredResult(_0x50c231,_0x50af16){return function(_0x152397){if(_0x152397){var _0x2ba3ae=typeof _0x50af16[_0xf48b('0x1b')]==='undefined'&&typeof _0x50af16[_0xf48b('0x1c')]==='undefined';var _0x396daf=_0x152397['count'];var _0x3804d3=_0x2ba3ae?0x0:_0x50af16['offset'];var _0x28bc2a=_0x2ba3ae?_0x152397[_0xf48b('0x1d')]:_0x50af16['offset']+_0x50af16[_0xf48b('0x1c')];var _0x118ce7;if(_0x28bc2a>=_0x396daf){_0x28bc2a=_0x396daf;_0x118ce7=0xc8;}else{_0x118ce7=0xce;}_0x50c231[_0xf48b('0x1e')](_0x118ce7);return _0x50c231['set'](_0xf48b('0x1f'),_0x3804d3+'-'+_0x28bc2a+'/'+_0x396daf)['json'](_0x152397);}return null;};}function patchUpdates(_0x43a015){return function(_0x22354e){try{jsonpatch[_0xf48b('0x20')](_0x22354e,_0x43a015,!![]);}catch(_0x4e3553){return BPromise[_0xf48b('0x21')](_0x4e3553);}return _0x22354e[_0xf48b('0x22')]();};}function saveUpdates(_0x476736,_0xf089f4){return function(_0x55a48c){if(_0x55a48c){return _0x55a48c[_0xf48b('0x23')](_0x476736)[_0xf48b('0x24')](function(_0x4d4610){return _0x4d4610;});}return null;};}function removeEntity(_0x41cd09,_0x103bd8){return function(_0x5d60ea){if(_0x5d60ea){return _0x5d60ea[_0xf48b('0x25')]()[_0xf48b('0x24')](function(){_0x41cd09[_0xf48b('0x1e')](0xcc)[_0xf48b('0x26')]();});}};}function handleEntityNotFound(_0x19445a,_0xfbfe21){return function(_0x2bea70){if(!_0x2bea70){_0x19445a[_0xf48b('0x19')](0x194);}return _0x2bea70;};}function handleError(_0x1212d1,_0x52ce6a){_0x52ce6a=_0x52ce6a||0x1f4;return function(_0x22a99f){logger['error'](_0x22a99f[_0xf48b('0x27')]);if(_0x22a99f[_0xf48b('0x28')]){delete _0x22a99f[_0xf48b('0x28')];}_0x1212d1[_0xf48b('0x1e')](_0x52ce6a)[_0xf48b('0x29')](_0x22a99f);};}exports['index']=function(_0x476a85,_0x60f32){var _0x51a88c={},_0x1a8fc5={},_0x958ea4={'count':0x0,'rows':[]};var _0x22ce8a=_[_0xf48b('0x2a')](db[_0xf48b('0x2b')][_0xf48b('0x2c')],function(_0x5378c6){return{'name':_0x5378c6['fieldName'],'type':_0x5378c6['type'][_0xf48b('0x2d')]};});_0x1a8fc5[_0xf48b('0x2e')]=_[_0xf48b('0x2a')](_0x22ce8a,'name');_0x1a8fc5[_0xf48b('0x2f')]=_[_0xf48b('0x30')](_0x476a85['query']);_0x1a8fc5[_0xf48b('0x31')]=_[_0xf48b('0x32')](_0x1a8fc5[_0xf48b('0x2e')],_0x1a8fc5[_0xf48b('0x2f')]);_0x51a88c[_0xf48b('0x33')]=_[_0xf48b('0x32')](_0x1a8fc5[_0xf48b('0x2e')],qs[_0xf48b('0x34')](_0x476a85[_0xf48b('0x2f')][_0xf48b('0x34')]));_0x51a88c[_0xf48b('0x33')]=_0x51a88c[_0xf48b('0x33')][_0xf48b('0x35')]?_0x51a88c[_0xf48b('0x33')]:_0x1a8fc5[_0xf48b('0x2e')];if(!_0x476a85[_0xf48b('0x2f')][_0xf48b('0x36')](_0xf48b('0x37'))){_0x51a88c[_0xf48b('0x1c')]=qs[_0xf48b('0x1c')](_0x476a85['query'][_0xf48b('0x1c')]);_0x51a88c[_0xf48b('0x1b')]=qs['offset'](_0x476a85[_0xf48b('0x2f')][_0xf48b('0x1b')]);}_0x51a88c[_0xf48b('0x38')]=qs[_0xf48b('0x39')](_0x476a85[_0xf48b('0x2f')][_0xf48b('0x39')]);_0x51a88c[_0xf48b('0x3a')]=qs['filters'](_[_0xf48b('0x3b')](_0x476a85[_0xf48b('0x2f')],_0x1a8fc5[_0xf48b('0x31')]),_0x22ce8a);if(_0x476a85['query']['filter']){_0x51a88c[_0xf48b('0x3a')]=_[_0xf48b('0x3c')](_0x51a88c[_0xf48b('0x3a')],{'$or':_['map'](_0x22ce8a,function(_0x41be41){if(_0x41be41[_0xf48b('0x3d')]!=='VIRTUAL'){var _0x14c40b={};_0x14c40b[_0x41be41[_0xf48b('0x28')]]={'$like':'%'+_0x476a85[_0xf48b('0x2f')][_0xf48b('0x3e')]+'%'};return _0x14c40b;}})});}_0x51a88c=_[_0xf48b('0x3c')]({},_0x51a88c,_0x476a85[_0xf48b('0x3f')]);var _0x25d625={'where':_0x51a88c['where']};return db['JscriptySessionReport']['count'](_0x25d625)['then'](function(_0x15899b){_0x958ea4['count']=_0x15899b;if(_0x476a85[_0xf48b('0x2f')][_0xf48b('0x40')]){_0x51a88c[_0xf48b('0x41')]=[{'all':!![]}];}return db[_0xf48b('0x2b')]['findAll'](_0x51a88c);})[_0xf48b('0x24')](function(_0x3630e2){_0x958ea4[_0xf48b('0x42')]=_0x3630e2;return _0x958ea4;})[_0xf48b('0x24')](respondWithFilteredResult(_0x60f32,_0x51a88c))[_0xf48b('0x43')](handleError(_0x60f32,null));};exports['show']=function(_0x1dfd48,_0x493019){var _0x52e15b={'raw':!![],'where':{'id':_0x1dfd48[_0xf48b('0x44')]['id']}},_0x4e5734={};_0x4e5734[_0xf48b('0x2e')]=_[_0xf48b('0x30')](db['JscriptySessionReport']['rawAttributes']);_0x4e5734[_0xf48b('0x2f')]=_[_0xf48b('0x30')](_0x1dfd48[_0xf48b('0x2f')]);_0x4e5734['filters']=_[_0xf48b('0x32')](_0x4e5734[_0xf48b('0x2e')],_0x4e5734[_0xf48b('0x2f')]);_0x52e15b[_0xf48b('0x33')]=_[_0xf48b('0x32')](_0x4e5734[_0xf48b('0x2e')],qs[_0xf48b('0x34')](_0x1dfd48[_0xf48b('0x2f')][_0xf48b('0x34')]));_0x52e15b[_0xf48b('0x33')]=_0x52e15b[_0xf48b('0x33')][_0xf48b('0x35')]?_0x52e15b[_0xf48b('0x33')]:_0x4e5734['model'];if(_0x1dfd48['query'][_0xf48b('0x40')]){_0x52e15b['include']=[{'all':!![]}];}_0x52e15b=_[_0xf48b('0x3c')]({},_0x52e15b,_0x1dfd48['options']);return db[_0xf48b('0x2b')]['find'](_0x52e15b)[_0xf48b('0x24')](handleEntityNotFound(_0x493019,null))[_0xf48b('0x24')](respondWithResult(_0x493019,null))[_0xf48b('0x43')](handleError(_0x493019,null));};exports['create']=function(_0x1848dd,_0x3d5f6e){return db['JscriptySessionReport']['create'](_0x1848dd[_0xf48b('0x45')],{})[_0xf48b('0x24')](respondWithResult(_0x3d5f6e,0xc9))[_0xf48b('0x43')](handleError(_0x3d5f6e,null));};exports['update']=function(_0x112eca,_0x45c1e9){if(_0x112eca[_0xf48b('0x45')]['id']){delete _0x112eca['body']['id'];}return db[_0xf48b('0x2b')]['find']({'where':{'id':_0x112eca[_0xf48b('0x44')]['id']}})[_0xf48b('0x24')](handleEntityNotFound(_0x45c1e9,null))['then'](saveUpdates(_0x112eca[_0xf48b('0x45')],null))[_0xf48b('0x24')](respondWithResult(_0x45c1e9,null))[_0xf48b('0x43')](handleError(_0x45c1e9,null));};exports[_0xf48b('0x25')]=function(_0x53dba1,_0x579870){return db[_0xf48b('0x2b')][_0xf48b('0x46')]({'where':{'id':_0x53dba1['params']['id']}})[_0xf48b('0x24')](handleEntityNotFound(_0x579870,null))[_0xf48b('0x24')](removeEntity(_0x579870,null))[_0xf48b('0x43')](handleError(_0x579870,null));};exports['describe']=function(_0x491e82,_0x4f6d47){return db['JscriptySessionReport'][_0xf48b('0x47')]()[_0xf48b('0x24')](respondWithResult(_0x4f6d47,null))['catch'](handleError(_0x4f6d47,null));};exports['getQuestions']=function(_0x264767,_0x52031,_0xb269ad){var _0x5d1c06={'raw':!![],'where':{}};var _0x2e5467={};var _0x42e8cc={'count':0x0,'rows':[]};return db[_0xf48b('0x2b')]['findOne']({'where':{'id':_0x264767[_0xf48b('0x44')]['id']}})['then'](handleEntityNotFound(_0x52031,null))[_0xf48b('0x24')](function(_0x52446d){if(_0x52446d){_0x2e5467[_0xf48b('0x2e')]=_[_0xf48b('0x30')](db['JscriptyQuestionReport'][_0xf48b('0x2c')]);_0x2e5467['query']=_[_0xf48b('0x30')](_0x264767[_0xf48b('0x2f')]);_0x2e5467['filters']=_[_0xf48b('0x32')](_0x2e5467['model'],_0x2e5467[_0xf48b('0x2f')]);_0x5d1c06[_0xf48b('0x33')]=_['intersection'](_0x2e5467[_0xf48b('0x2e')],qs['fields'](_0x264767[_0xf48b('0x2f')]['fields']));_0x5d1c06['attributes']=_0x5d1c06['attributes'][_0xf48b('0x35')]?_0x5d1c06['attributes']:_0x2e5467[_0xf48b('0x2e')];if(!_0x264767[_0xf48b('0x2f')]['hasOwnProperty'](_0xf48b('0x37'))){_0x5d1c06['limit']=qs[_0xf48b('0x1c')](_0x264767[_0xf48b('0x2f')]['limit']);_0x5d1c06[_0xf48b('0x1b')]=qs['offset'](_0x264767[_0xf48b('0x2f')]['offset']);}_0x5d1c06[_0xf48b('0x38')]=qs['sort'](_0x264767['query'][_0xf48b('0x39')]);_0x5d1c06[_0xf48b('0x3a')]=qs[_0xf48b('0x31')](_['pick'](_0x264767[_0xf48b('0x2f')],_0x2e5467[_0xf48b('0x31')]));_0x5d1c06[_0xf48b('0x3a')]['SessionId']=_0x52446d['id'];if(_0x264767[_0xf48b('0x2f')][_0xf48b('0x3e')]){_0x5d1c06[_0xf48b('0x3a')]=_[_0xf48b('0x3c')](_0x5d1c06[_0xf48b('0x3a')],{'$or':_[_0xf48b('0x2a')](_0x5d1c06['attributes'],function(_0x34372c){var _0x38fc2c={};_0x38fc2c[_0x34372c]={'$like':'%'+_0x264767[_0xf48b('0x2f')]['filter']+'%'};return _0x38fc2c;})});}_0x5d1c06=_['merge']({},_0x5d1c06,_0x264767['options']);return db[_0xf48b('0x48')]['count']({'where':_0x5d1c06[_0xf48b('0x3a')]})[_0xf48b('0x24')](function(_0x4d739d){_0x42e8cc[_0xf48b('0x1d')]=_0x4d739d;if(_0x264767[_0xf48b('0x2f')][_0xf48b('0x40')]){_0x5d1c06[_0xf48b('0x41')]=[{'all':!![]}];}return db[_0xf48b('0x48')][_0xf48b('0x49')](_0x5d1c06);})[_0xf48b('0x24')](function(_0xb054de){_0x42e8cc['rows']=_0xb054de;return _0x42e8cc;});}})['then'](respondWithFilteredResult(_0x52031,_0x5d1c06))['catch'](handleError(_0x52031,null));}; \ No newline at end of file +var _0x3711=['find','catch','create','body','describe','findOne','JscriptyQuestionReport','order','SessionId','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','params'];(function(_0x3a9696,_0x5b3dee){var _0x269f27=function(_0x36dfd0){while(--_0x36dfd0){_0x3a9696['push'](_0x3a9696['shift']());}};_0x269f27(++_0x5b3dee);}(_0x3711,0xfd));var _0x1371=function(_0x2415c6,_0x435e58){_0x2415c6=_0x2415c6-0x0;var _0x526097=_0x3711[_0x2415c6];return _0x526097;};'use strict';var emlformat=require(_0x1371('0x0'));var rimraf=require(_0x1371('0x1'));var zipdir=require(_0x1371('0x2'));var jsonpatch=require(_0x1371('0x3'));var rp=require(_0x1371('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1371('0x5'));var util=require('util');var path=require(_0x1371('0x6'));var sox=require(_0x1371('0x7'));var csv=require('to-csv');var ejs=require(_0x1371('0x8'));var fs=require('fs');var fs_extra=require(_0x1371('0x9'));var _=require(_0x1371('0xa'));var squel=require(_0x1371('0xb'));var crypto=require(_0x1371('0xc'));var jsforce=require(_0x1371('0xd'));var deskjs=require(_0x1371('0xe'));var toCsv=require(_0x1371('0xf'));var querystring=require('querystring');var Papa=require(_0x1371('0x10'));var Redis=require(_0x1371('0x11'));var authService=require(_0x1371('0x12'));var qs=require(_0x1371('0x13'));var as=require(_0x1371('0x14'));var hardwareService=require(_0x1371('0x15'));var logger=require('../../config/logger')(_0x1371('0x16'));var utils=require('../../config/utils');var config=require(_0x1371('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1371('0x18'))['db'];function respondWithStatusCode(_0x29b1bc,_0x31248d){_0x31248d=_0x31248d||0xcc;return function(_0x418602){if(_0x418602){return _0x29b1bc[_0x1371('0x19')](_0x31248d);}return _0x29b1bc[_0x1371('0x1a')](_0x31248d)['end']();};}function respondWithResult(_0x165512,_0x171f5a){_0x171f5a=_0x171f5a||0xc8;return function(_0x5c705b){if(_0x5c705b){return _0x165512['status'](_0x171f5a)[_0x1371('0x1b')](_0x5c705b);}};}function respondWithFilteredResult(_0x315e5a,_0x2d27e9){return function(_0x2b12bf){if(_0x2b12bf){var _0x32d8ed=typeof _0x2d27e9[_0x1371('0x1c')]==='undefined'&&typeof _0x2d27e9[_0x1371('0x1d')]===_0x1371('0x1e');var _0x21d5af=_0x2b12bf[_0x1371('0x1f')];var _0x48e0a5=_0x32d8ed?0x0:_0x2d27e9['offset'];var _0x5ce243=_0x32d8ed?_0x2b12bf['count']:_0x2d27e9[_0x1371('0x1c')]+_0x2d27e9[_0x1371('0x1d')];var _0x155944;if(_0x5ce243>=_0x21d5af){_0x5ce243=_0x21d5af;_0x155944=0xc8;}else{_0x155944=0xce;}_0x315e5a[_0x1371('0x1a')](_0x155944);return _0x315e5a[_0x1371('0x20')](_0x1371('0x21'),_0x48e0a5+'-'+_0x5ce243+'/'+_0x21d5af)[_0x1371('0x1b')](_0x2b12bf);}return null;};}function patchUpdates(_0x7a25ab){return function(_0x486077){try{jsonpatch['apply'](_0x486077,_0x7a25ab,!![]);}catch(_0x46fa86){return BPromise[_0x1371('0x22')](_0x46fa86);}return _0x486077[_0x1371('0x23')]();};}function saveUpdates(_0x52594b,_0x4bfcc3){return function(_0x52352d){if(_0x52352d){return _0x52352d[_0x1371('0x24')](_0x52594b)[_0x1371('0x25')](function(_0x22ac72){return _0x22ac72;});}return null;};}function removeEntity(_0x28560b,_0x4b371f){return function(_0x2d2df4){if(_0x2d2df4){return _0x2d2df4[_0x1371('0x26')]()['then'](function(){_0x28560b[_0x1371('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d2049,_0x5d6ea3){return function(_0x400cf4){if(!_0x400cf4){_0x4d2049['sendStatus'](0x194);}return _0x400cf4;};}function handleError(_0x1a2e60,_0x3e47f5){_0x3e47f5=_0x3e47f5||0x1f4;return function(_0x522baf){logger[_0x1371('0x27')](_0x522baf[_0x1371('0x28')]);if(_0x522baf[_0x1371('0x29')]){delete _0x522baf[_0x1371('0x29')];}_0x1a2e60['status'](_0x3e47f5)[_0x1371('0x2a')](_0x522baf);};}exports[_0x1371('0x2b')]=function(_0x3822e6,_0x50e6b1){var _0x2fa636={},_0x47eb6b={},_0x432e8f={'count':0x0,'rows':[]};var _0x239725=_['map'](db[_0x1371('0x2c')][_0x1371('0x2d')],function(_0x72890){return{'name':_0x72890[_0x1371('0x2e')],'type':_0x72890[_0x1371('0x2f')][_0x1371('0x30')]};});_0x47eb6b[_0x1371('0x31')]=_[_0x1371('0x32')](_0x239725,_0x1371('0x29'));_0x47eb6b[_0x1371('0x33')]=_[_0x1371('0x34')](_0x3822e6['query']);_0x47eb6b[_0x1371('0x35')]=_[_0x1371('0x36')](_0x47eb6b[_0x1371('0x31')],_0x47eb6b[_0x1371('0x33')]);_0x2fa636[_0x1371('0x37')]=_[_0x1371('0x36')](_0x47eb6b[_0x1371('0x31')],qs[_0x1371('0x38')](_0x3822e6[_0x1371('0x33')]['fields']));_0x2fa636[_0x1371('0x37')]=_0x2fa636[_0x1371('0x37')][_0x1371('0x39')]?_0x2fa636['attributes']:_0x47eb6b['model'];if(!_0x3822e6[_0x1371('0x33')][_0x1371('0x3a')](_0x1371('0x3b'))){_0x2fa636[_0x1371('0x1d')]=qs[_0x1371('0x1d')](_0x3822e6[_0x1371('0x33')][_0x1371('0x1d')]);_0x2fa636[_0x1371('0x1c')]=qs['offset'](_0x3822e6[_0x1371('0x33')]['offset']);}_0x2fa636['order']=qs[_0x1371('0x3c')](_0x3822e6[_0x1371('0x33')][_0x1371('0x3c')]);_0x2fa636[_0x1371('0x3d')]=qs[_0x1371('0x35')](_[_0x1371('0x3e')](_0x3822e6[_0x1371('0x33')],_0x47eb6b[_0x1371('0x35')]),_0x239725);if(_0x3822e6[_0x1371('0x33')]['filter']){_0x2fa636[_0x1371('0x3d')]=_[_0x1371('0x3f')](_0x2fa636['where'],{'$or':_[_0x1371('0x32')](_0x239725,function(_0x3367ba){if(_0x3367ba[_0x1371('0x2f')]!==_0x1371('0x40')){var _0xdcb81a={};_0xdcb81a[_0x3367ba[_0x1371('0x29')]]={'$like':'%'+_0x3822e6['query'][_0x1371('0x41')]+'%'};return _0xdcb81a;}})});}_0x2fa636=_[_0x1371('0x3f')]({},_0x2fa636,_0x3822e6[_0x1371('0x42')]);var _0x15d74e={'where':_0x2fa636['where']};return db['JscriptySessionReport'][_0x1371('0x1f')](_0x15d74e)['then'](function(_0x35e384){_0x432e8f[_0x1371('0x1f')]=_0x35e384;if(_0x3822e6['query'][_0x1371('0x43')]){_0x2fa636[_0x1371('0x44')]=[{'all':!![]}];}return db[_0x1371('0x2c')][_0x1371('0x45')](_0x2fa636);})['then'](function(_0x817c90){_0x432e8f['rows']=_0x817c90;return _0x432e8f;})[_0x1371('0x25')](respondWithFilteredResult(_0x50e6b1,_0x2fa636))['catch'](handleError(_0x50e6b1,null));};exports['show']=function(_0x2c899c,_0x51f7f5){var _0x33b817={'raw':!![],'where':{'id':_0x2c899c[_0x1371('0x46')]['id']}},_0x30480f={};_0x30480f['model']=_[_0x1371('0x34')](db['JscriptySessionReport'][_0x1371('0x2d')]);_0x30480f[_0x1371('0x33')]=_[_0x1371('0x34')](_0x2c899c['query']);_0x30480f[_0x1371('0x35')]=_['intersection'](_0x30480f[_0x1371('0x31')],_0x30480f[_0x1371('0x33')]);_0x33b817[_0x1371('0x37')]=_[_0x1371('0x36')](_0x30480f[_0x1371('0x31')],qs['fields'](_0x2c899c[_0x1371('0x33')][_0x1371('0x38')]));_0x33b817['attributes']=_0x33b817[_0x1371('0x37')][_0x1371('0x39')]?_0x33b817[_0x1371('0x37')]:_0x30480f[_0x1371('0x31')];if(_0x2c899c[_0x1371('0x33')][_0x1371('0x43')]){_0x33b817['include']=[{'all':!![]}];}_0x33b817=_['merge']({},_0x33b817,_0x2c899c[_0x1371('0x42')]);return db['JscriptySessionReport'][_0x1371('0x47')](_0x33b817)[_0x1371('0x25')](handleEntityNotFound(_0x51f7f5,null))[_0x1371('0x25')](respondWithResult(_0x51f7f5,null))[_0x1371('0x48')](handleError(_0x51f7f5,null));};exports[_0x1371('0x49')]=function(_0x4763ed,_0x31a4b5){return db[_0x1371('0x2c')][_0x1371('0x49')](_0x4763ed[_0x1371('0x4a')],{})[_0x1371('0x25')](respondWithResult(_0x31a4b5,0xc9))['catch'](handleError(_0x31a4b5,null));};exports[_0x1371('0x24')]=function(_0x5e0fcf,_0x923c4b){if(_0x5e0fcf[_0x1371('0x4a')]['id']){delete _0x5e0fcf[_0x1371('0x4a')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x5e0fcf['params']['id']}})[_0x1371('0x25')](handleEntityNotFound(_0x923c4b,null))[_0x1371('0x25')](saveUpdates(_0x5e0fcf['body'],null))[_0x1371('0x25')](respondWithResult(_0x923c4b,null))[_0x1371('0x48')](handleError(_0x923c4b,null));};exports[_0x1371('0x26')]=function(_0x404f8d,_0xd8941a){return db[_0x1371('0x2c')][_0x1371('0x47')]({'where':{'id':_0x404f8d[_0x1371('0x46')]['id']}})[_0x1371('0x25')](handleEntityNotFound(_0xd8941a,null))['then'](removeEntity(_0xd8941a,null))[_0x1371('0x48')](handleError(_0xd8941a,null));};exports[_0x1371('0x4b')]=function(_0x3fcc2e,_0x184c6a){return db[_0x1371('0x2c')]['describe']()[_0x1371('0x25')](respondWithResult(_0x184c6a,null))[_0x1371('0x48')](handleError(_0x184c6a,null));};exports['getQuestions']=function(_0x5b2626,_0x2cb17d,_0x13d6d1){var _0x52b16f={'raw':!![],'where':{}};var _0x4709c5={};var _0x1cc624={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x1371('0x4c')]({'where':{'id':_0x5b2626[_0x1371('0x46')]['id']}})[_0x1371('0x25')](handleEntityNotFound(_0x2cb17d,null))['then'](function(_0xade686){if(_0xade686){_0x4709c5['model']=_[_0x1371('0x34')](db[_0x1371('0x4d')][_0x1371('0x2d')]);_0x4709c5[_0x1371('0x33')]=_['keys'](_0x5b2626[_0x1371('0x33')]);_0x4709c5['filters']=_[_0x1371('0x36')](_0x4709c5[_0x1371('0x31')],_0x4709c5[_0x1371('0x33')]);_0x52b16f['attributes']=_[_0x1371('0x36')](_0x4709c5[_0x1371('0x31')],qs[_0x1371('0x38')](_0x5b2626[_0x1371('0x33')][_0x1371('0x38')]));_0x52b16f[_0x1371('0x37')]=_0x52b16f[_0x1371('0x37')]['length']?_0x52b16f[_0x1371('0x37')]:_0x4709c5['model'];if(!_0x5b2626['query'][_0x1371('0x3a')](_0x1371('0x3b'))){_0x52b16f[_0x1371('0x1d')]=qs[_0x1371('0x1d')](_0x5b2626['query'][_0x1371('0x1d')]);_0x52b16f['offset']=qs['offset'](_0x5b2626[_0x1371('0x33')][_0x1371('0x1c')]);}_0x52b16f[_0x1371('0x4e')]=qs['sort'](_0x5b2626[_0x1371('0x33')][_0x1371('0x3c')]);_0x52b16f['where']=qs['filters'](_['pick'](_0x5b2626[_0x1371('0x33')],_0x4709c5[_0x1371('0x35')]));_0x52b16f['where'][_0x1371('0x4f')]=_0xade686['id'];if(_0x5b2626[_0x1371('0x33')]['filter']){_0x52b16f[_0x1371('0x3d')]=_[_0x1371('0x3f')](_0x52b16f['where'],{'$or':_[_0x1371('0x32')](_0x52b16f['attributes'],function(_0x29f8d4){var _0x27a28f={};_0x27a28f[_0x29f8d4]={'$like':'%'+_0x5b2626[_0x1371('0x33')][_0x1371('0x41')]+'%'};return _0x27a28f;})});}_0x52b16f=_['merge']({},_0x52b16f,_0x5b2626[_0x1371('0x42')]);return db['JscriptyQuestionReport'][_0x1371('0x1f')]({'where':_0x52b16f[_0x1371('0x3d')]})[_0x1371('0x25')](function(_0x4c4d58){_0x1cc624[_0x1371('0x1f')]=_0x4c4d58;if(_0x5b2626[_0x1371('0x33')][_0x1371('0x43')]){_0x52b16f[_0x1371('0x44')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x1371('0x45')](_0x52b16f);})[_0x1371('0x25')](function(_0x506162){_0x1cc624[_0x1371('0x50')]=_0x506162;return _0x1cc624;});}})['then'](respondWithFilteredResult(_0x2cb17d,_0x52b16f))[_0x1371('0x48')](handleError(_0x2cb17d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7d38067..1a4af76 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 _0xdc97=['path','../../config/environment','./jscriptySessionReport.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x2c0d7b,_0x4ec918){var _0x3c769f=function(_0x13fb48){while(--_0x13fb48){_0x2c0d7b['push'](_0x2c0d7b['shift']());}};_0x3c769f(++_0x4ec918);}(_0xdc97,0x13b));var _0x7dc9=function(_0x786898,_0x57fd09){_0x786898=_0x786898-0x0;var _0x55ea4f=_0xdc97[_0x786898];return _0x55ea4f;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b20=['../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x4a387f,_0x337520){var _0x17c56b=function(_0x582983){while(--_0x582983){_0x4a387f['push'](_0x4a387f['shift']());}};_0x17c56b(++_0x337520);}(_0x1b20,0x66));var _0x01b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b20[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x01b2('0x0'));var logger=require(_0x01b2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x01b2('0x2'));var rp=require(_0x01b2('0x3'));var fs=require('fs');var path=require(_0x01b2('0x4'));var rimraf=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var attributes=require(_0x01b2('0x7'));module[_0x01b2('0x8')]=function(_0x28de4a,_0x46e745){return _0x28de4a[_0x01b2('0x9')](_0x01b2('0xa'),attributes,{'tableName':_0x01b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index f6f3854..d0e8246 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32b6=['JscriptySessionReport,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0xe34142,_0x44815c){var _0x2c246b=function(_0x5ed43e){while(--_0x5ed43e){_0xe34142['push'](_0xe34142['shift']());}};_0x2c246b(++_0x44815c);}(_0x32b6,0x1d1));var _0x632b=function(_0x285484,_0x399c62){_0x285484=_0x285484-0x0;var _0x1252fe=_0x32b6[_0x285484];return _0x1252fe;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0xea4d79,_0xf55800){var _0x420400=function(_0x282516){while(--_0x282516){_0xea4d79['push'](_0xea4d79['shift']());}};_0x420400(++_0xf55800);}(_0x1a85,0x178));var _0x51a8=function(_0x344128,_0x9b9e88){_0x344128=_0x344128-0x0;var _0x693fae=_0x1a85[_0x344128];return _0x693fae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 6f1673e..28e6b4e 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 _0xc4d2=['isAuthenticated','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id'];(function(_0x2cab41,_0x8ef8fd){var _0x35fb3c=function(_0x9d6fe5){while(--_0x9d6fe5){_0x2cab41['push'](_0x2cab41['shift']());}};_0x35fb3c(++_0x8ef8fd);}(_0xc4d2,0x6c));var _0x2c4d=function(_0x2051cd,_0x3e0072){_0x2051cd=_0x2051cd-0x0;var _0x28a8aa=_0xc4d2[_0x2051cd];return _0x28a8aa;};'use strict';var multer=require(_0x2c4d('0x0'));var util=require('util');var path=require(_0x2c4d('0x1'));var timeout=require(_0x2c4d('0x2'));var express=require(_0x2c4d('0x3'));var router=express['Router']();var fs_extra=require(_0x2c4d('0x4'));var auth=require(_0x2c4d('0x5'));var interaction=require(_0x2c4d('0x6'));var config=require(_0x2c4d('0x7'));var controller=require(_0x2c4d('0x8'));router[_0x2c4d('0x9')]('/',controller['index']);router[_0x2c4d('0xa')](_0x2c4d('0xb'),auth[_0x2c4d('0xc')](),controller[_0x2c4d('0xd')]);router[_0x2c4d('0x9')]('/download_log_file',auth[_0x2c4d('0xc')](),controller['downloadLogFile']);module[_0x2c4d('0xe')]=router; \ No newline at end of file +var _0x164d=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','isAuthenticated','update','/download_log_file','exports','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x164d,0xc2));var _0xd164=function(_0x2d1cf4,_0x2ea9ee){_0x2d1cf4=_0x2d1cf4-0x0;var _0x554a7c=_0x164d[_0x2d1cf4];return _0x554a7c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd164('0x0'));var timeout=require(_0xd164('0x1'));var express=require('express');var router=express[_0xd164('0x2')]();var fs_extra=require(_0xd164('0x3'));var auth=require(_0xd164('0x4'));var interaction=require(_0xd164('0x5'));var config=require(_0xd164('0x6'));var controller=require(_0xd164('0x7'));router[_0xd164('0x8')]('/',controller['index']);router['put']('/:id',auth[_0xd164('0x9')](),controller[_0xd164('0xa')]);router['get'](_0xd164('0xb'),auth[_0xd164('0x9')](),controller['downloadLogFile']);module[_0xd164('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index e2fa3f4..f520306 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 _0xaef2=['STRING','sequelize','TEXT'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xaef2,0xe5));var _0x2aef=function(_0x4403e5,_0x32ddae){_0x4403e5=_0x4403e5-0x0;var _0x512114=_0xaef2[_0x4403e5];return _0x512114;};'use strict';var Sequelize=require(_0x2aef('0x0'));module['exports']={'license':{'type':Sequelize[_0x2aef('0x1')]},'data1':{'type':Sequelize[_0x2aef('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8251=['STRING','INTEGER','sequelize','TEXT'];(function(_0x5424cc,_0x3efb92){var _0x100fa4=function(_0x4d54a0){while(--_0x4d54a0){_0x5424cc['push'](_0x5424cc['shift']());}};_0x100fa4(++_0x3efb92);}(_0x8251,0x9e));var _0x1825=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x8251[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x1825('0x0'));module['exports']={'license':{'type':Sequelize[_0x1825('0x1')]},'data1':{'type':Sequelize[_0x1825('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x1825('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 737dfbd..f4e8271 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 _0x0273=['limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','../../config/license/util','index','model','keys','License','query','filters','intersection','attributes','fields','options','getLicense','catch','body','params','get','checkLicense','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','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/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'];(function(_0x1848b8,_0x3759c0){var _0x353e3e=function(_0x328e60){while(--_0x328e60){_0x1848b8['push'](_0x1848b8['shift']());}};_0x353e3e(++_0x3759c0);}(_0x0273,0x111));var _0x3027=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0273[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3027('0x0'));var rimraf=require(_0x3027('0x1'));var zipdir=require(_0x3027('0x2'));var jsonpatch=require(_0x3027('0x3'));var rp=require(_0x3027('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3027('0x5'));var util=require(_0x3027('0x6'));var path=require(_0x3027('0x7'));var sox=require(_0x3027('0x8'));var csv=require(_0x3027('0x9'));var ejs=require(_0x3027('0xa'));var fs=require('fs');var fs_extra=require(_0x3027('0xb'));var _=require(_0x3027('0xc'));var squel=require(_0x3027('0xd'));var crypto=require(_0x3027('0xe'));var jsforce=require(_0x3027('0xf'));var deskjs=require(_0x3027('0x10'));var toCsv=require(_0x3027('0x9'));var querystring=require(_0x3027('0x11'));var Papa=require(_0x3027('0x12'));var Redis=require(_0x3027('0x13'));var authService=require(_0x3027('0x14'));var qs=require(_0x3027('0x15'));var as=require(_0x3027('0x16'));var hardwareService=require(_0x3027('0x17'));var logger=require(_0x3027('0x18'))(_0x3027('0x19'));var utils=require(_0x3027('0x1a'));var config=require(_0x3027('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x3027('0x1c'))['db'];function respondWithStatusCode(_0x225abc,_0x1f0491){_0x1f0491=_0x1f0491||0xcc;return function(_0x4c127a){if(_0x4c127a){return _0x225abc[_0x3027('0x1d')](_0x1f0491);}return _0x225abc[_0x3027('0x1e')](_0x1f0491)[_0x3027('0x1f')]();};}function respondWithResult(_0x481e38,_0x5b12af){_0x5b12af=_0x5b12af||0xc8;return function(_0x424d78){if(_0x424d78){return _0x481e38[_0x3027('0x1e')](_0x5b12af)[_0x3027('0x20')](_0x424d78);}};}function respondWithFilteredResult(_0x1b8bf8,_0x32220d){return function(_0xa77946){if(_0xa77946){var _0x450633=typeof _0x32220d[_0x3027('0x21')]===_0x3027('0x22')&&typeof _0x32220d[_0x3027('0x23')]===_0x3027('0x22');var _0x2e6952=_0xa77946[_0x3027('0x24')];var _0x536bea=_0x450633?0x0:_0x32220d[_0x3027('0x21')];var _0x24ba2f=_0x450633?_0xa77946[_0x3027('0x24')]:_0x32220d[_0x3027('0x21')]+_0x32220d[_0x3027('0x23')];var _0x4c696a;if(_0x24ba2f>=_0x2e6952){_0x24ba2f=_0x2e6952;_0x4c696a=0xc8;}else{_0x4c696a=0xce;}_0x1b8bf8['status'](_0x4c696a);return _0x1b8bf8[_0x3027('0x25')](_0x3027('0x26'),_0x536bea+'-'+_0x24ba2f+'/'+_0x2e6952)['json'](_0xa77946);}return null;};}function patchUpdates(_0x44ee83){return function(_0x6afb79){try{jsonpatch[_0x3027('0x27')](_0x6afb79,_0x44ee83,!![]);}catch(_0x3ac496){return BPromise[_0x3027('0x28')](_0x3ac496);}return _0x6afb79['save']();};}function saveUpdates(_0xab5c80,_0x106a33){return function(_0x309405){if(_0x309405){return _0x309405[_0x3027('0x29')](_0xab5c80)[_0x3027('0x2a')](function(_0x46a987){return _0x46a987;});}return null;};}function removeEntity(_0x1077e6,_0x340b71){return function(_0x4993dc){if(_0x4993dc){return _0x4993dc[_0x3027('0x2b')]()[_0x3027('0x2a')](function(){_0x1077e6[_0x3027('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dded5,_0x107320){return function(_0x2dae0f){if(!_0x2dae0f){_0x3dded5[_0x3027('0x1d')](0x194);}return _0x2dae0f;};}function handleError(_0x2e0c76,_0x340a51){_0x340a51=_0x340a51||0x1f4;return function(_0x2ecc06){logger[_0x3027('0x2c')](_0x2ecc06[_0x3027('0x2d')]);if(_0x2ecc06[_0x3027('0x2e')]){delete _0x2ecc06['name'];}_0x2e0c76['status'](_0x340a51)[_0x3027('0x2f')](_0x2ecc06);};}var utilLicense=require(_0x3027('0x30'));exports[_0x3027('0x31')]=function(_0x5ab97b,_0x3e8547){var _0x5354f2={'raw':!![],'where':{'id':0x1}},_0x46d05f={};_0x46d05f[_0x3027('0x32')]=_[_0x3027('0x33')](db[_0x3027('0x34')]['rawAttributes']);_0x46d05f[_0x3027('0x35')]=_[_0x3027('0x33')](_0x5ab97b['query']);_0x46d05f[_0x3027('0x36')]=_[_0x3027('0x37')](_0x46d05f[_0x3027('0x32')],_0x46d05f[_0x3027('0x35')]);_0x5354f2[_0x3027('0x38')]=_['intersection'](_0x46d05f['model'],qs[_0x3027('0x39')](_0x5ab97b[_0x3027('0x35')][_0x3027('0x39')]));_0x5354f2['attributes']=_0x5354f2[_0x3027('0x38')]['length']?_0x5354f2['attributes']:_0x46d05f[_0x3027('0x32')];_0x5354f2=_['merge']({},_0x5354f2,_0x5ab97b[_0x3027('0x3a')]);return utilLicense[_0x3027('0x3b')](_0x5354f2)['then'](respondWithResult(_0x3e8547,null))[_0x3027('0x3c')](handleError(_0x3e8547,null));};exports['update']=function(_0x70e2a2,_0x47f6c0){if(_0x70e2a2[_0x3027('0x3d')]['id']){delete _0x70e2a2[_0x3027('0x3d')]['id'];}return db['License']['find']({'where':{'id':_0x70e2a2[_0x3027('0x3e')]['id']}})[_0x3027('0x2a')](handleEntityNotFound(_0x47f6c0,null))['then'](function(_0x2a7451){var _0x1723be=_0x2a7451[_0x3027('0x3f')]({'plain':!![]});return utilLicense[_0x3027('0x40')](_0x1723be,_0x70e2a2[_0x3027('0x3d')]['key']);})[_0x3027('0x2a')](function(_0x2def73){if(!_0x2def73['demo']){return saveUpdates(_0x70e2a2[_0x3027('0x3d')],null);}return _0x2def73;})[_0x3027('0x2a')](respondWithResult(_0x47f6c0,null))[_0x3027('0x3c')](handleError(_0x47f6c0,null));};exports[_0x3027('0x41')]=function(_0x129371,_0x1a9561){var _0x2e10e7=_0x3027('0x42');var _0x19bb08=path[_0x3027('0x43')](_0x3027('0x44'),_0x3027('0x45'),_0x3027('0x46'),_0x2e10e7);_0x1a9561[_0x3027('0x47')](_0x3027('0x48'),_0x3027('0x49')+_0x2e10e7);_0x1a9561[_0x3027('0x25')](_0x3027('0x4a'),_0x3027('0x4b'));_0x1a9561[_0x3027('0x4c')](_0x19bb08);}; \ No newline at end of file +var _0xd0b8=['util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','status','error','stack','send','index','model','keys','License','rawAttributes','filters','intersection','query','attributes','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd0b8,0x198));var _0x8d0b=function(_0x1c52ff,_0x250c0c){_0x1c52ff=_0x1c52ff-0x0;var _0x2a2710=_0xd0b8[_0x1c52ff];return _0x2a2710;};'use strict';var emlformat=require(_0x8d0b('0x0'));var rimraf=require(_0x8d0b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d0b('0x2'));var moment=require(_0x8d0b('0x3'));var BPromise=require(_0x8d0b('0x4'));var Mustache=require(_0x8d0b('0x5'));var util=require(_0x8d0b('0x6'));var path=require(_0x8d0b('0x7'));var sox=require('sox');var csv=require(_0x8d0b('0x8'));var ejs=require(_0x8d0b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d0b('0xa'));var squel=require(_0x8d0b('0xb'));var crypto=require(_0x8d0b('0xc'));var jsforce=require(_0x8d0b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8d0b('0x8'));var querystring=require('querystring');var Papa=require(_0x8d0b('0xe'));var Redis=require('ioredis');var authService=require(_0x8d0b('0xf'));var qs=require(_0x8d0b('0x10'));var as=require(_0x8d0b('0x11'));var hardwareService=require(_0x8d0b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x8d0b('0x13'));var config=require(_0x8d0b('0x14'));var licenseUtil=require(_0x8d0b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ab8df,_0x1483c3){_0x1483c3=_0x1483c3||0xcc;return function(_0x1b6311){if(_0x1b6311){return _0x3ab8df[_0x8d0b('0x16')](_0x1483c3);}return _0x3ab8df['status'](_0x1483c3)[_0x8d0b('0x17')]();};}function respondWithResult(_0x513912,_0x139040){_0x139040=_0x139040||0xc8;return function(_0x40926a){if(_0x40926a){return _0x513912['status'](_0x139040)[_0x8d0b('0x18')](_0x40926a);}};}function respondWithFilteredResult(_0x6f28dd,_0x2afd1f){return function(_0x44d7d7){if(_0x44d7d7){var _0x582395=typeof _0x2afd1f[_0x8d0b('0x19')]===_0x8d0b('0x1a')&&typeof _0x2afd1f[_0x8d0b('0x1b')]===_0x8d0b('0x1a');var _0x115a75=_0x44d7d7[_0x8d0b('0x1c')];var _0x35175c=_0x582395?0x0:_0x2afd1f[_0x8d0b('0x19')];var _0x13c661=_0x582395?_0x44d7d7[_0x8d0b('0x1c')]:_0x2afd1f[_0x8d0b('0x19')]+_0x2afd1f[_0x8d0b('0x1b')];var _0x2e5994;if(_0x13c661>=_0x115a75){_0x13c661=_0x115a75;_0x2e5994=0xc8;}else{_0x2e5994=0xce;}_0x6f28dd['status'](_0x2e5994);return _0x6f28dd[_0x8d0b('0x1d')](_0x8d0b('0x1e'),_0x35175c+'-'+_0x13c661+'/'+_0x115a75)[_0x8d0b('0x18')](_0x44d7d7);}return null;};}function patchUpdates(_0x5e5dcc){return function(_0x23dbfa){try{jsonpatch['apply'](_0x23dbfa,_0x5e5dcc,!![]);}catch(_0x5b21ae){return BPromise['reject'](_0x5b21ae);}return _0x23dbfa[_0x8d0b('0x1f')]();};}function saveUpdates(_0x5ae5db,_0x607b95){return function(_0x5a0028){if(_0x5a0028){return _0x5a0028[_0x8d0b('0x20')](_0x5ae5db)[_0x8d0b('0x21')](function(_0xc709fe){return _0xc709fe;});}return null;};}function removeEntity(_0x43ff25,_0x541b0d){return function(_0x15f704){if(_0x15f704){return _0x15f704['destroy']()[_0x8d0b('0x21')](function(){_0x43ff25[_0x8d0b('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7aca,_0x5325ca){return function(_0x3bff83){if(!_0x3bff83){_0x5e7aca[_0x8d0b('0x16')](0x194);}return _0x3bff83;};}function handleError(_0x53d841,_0x29aca3){_0x29aca3=_0x29aca3||0x1f4;return function(_0x489227){logger[_0x8d0b('0x23')](_0x489227[_0x8d0b('0x24')]);if(_0x489227['name']){delete _0x489227['name'];}_0x53d841['status'](_0x29aca3)[_0x8d0b('0x25')](_0x489227);};}var utilLicense=require('../../config/license/util');exports[_0x8d0b('0x26')]=function(_0x4dbe40,_0xd06257){var _0x342ee5={'raw':!![],'where':{'id':0x1}},_0x35d9e8={};_0x35d9e8[_0x8d0b('0x27')]=_[_0x8d0b('0x28')](db[_0x8d0b('0x29')][_0x8d0b('0x2a')]);_0x35d9e8['query']=_[_0x8d0b('0x28')](_0x4dbe40['query']);_0x35d9e8[_0x8d0b('0x2b')]=_[_0x8d0b('0x2c')](_0x35d9e8[_0x8d0b('0x27')],_0x35d9e8[_0x8d0b('0x2d')]);_0x342ee5[_0x8d0b('0x2e')]=_['intersection'](_0x35d9e8['model'],qs['fields'](_0x4dbe40['query']['fields']));_0x342ee5[_0x8d0b('0x2e')]=_0x342ee5[_0x8d0b('0x2e')][_0x8d0b('0x2f')]?_0x342ee5['attributes']:_0x35d9e8[_0x8d0b('0x27')];_0x342ee5=_[_0x8d0b('0x30')]({},_0x342ee5,_0x4dbe40[_0x8d0b('0x31')]);return utilLicense[_0x8d0b('0x32')](_0x342ee5)[_0x8d0b('0x21')](respondWithResult(_0xd06257,null))[_0x8d0b('0x33')](handleError(_0xd06257,null));};exports[_0x8d0b('0x20')]=function(_0x5e7a62,_0x1b8137){if(_0x5e7a62['body']['id']){delete _0x5e7a62[_0x8d0b('0x34')]['id'];}return db[_0x8d0b('0x29')][_0x8d0b('0x35')]({'where':{'id':_0x5e7a62[_0x8d0b('0x36')]['id']}})['then'](handleEntityNotFound(_0x1b8137,null))[_0x8d0b('0x21')](function(_0x13c3b6){var _0xd0374b=_0x13c3b6[_0x8d0b('0x37')]({'plain':!![]});return utilLicense[_0x8d0b('0x38')](_0xd0374b,_0x5e7a62[_0x8d0b('0x34')][_0x8d0b('0x39')]);})['then'](function(_0x1e9289){if(!_0x1e9289['demo']){return saveUpdates(_0x5e7a62[_0x8d0b('0x34')],null);}return _0x1e9289;})['then'](respondWithResult(_0x1b8137,null))[_0x8d0b('0x33')](handleError(_0x1b8137,null));};exports[_0x8d0b('0x3a')]=function(_0x44395c,_0x4740db){var _0x5969ea=_0x8d0b('0x3b');var _0x41ea68=path[_0x8d0b('0x3c')](_0x8d0b('0x3d'),_0x8d0b('0x3e'),_0x8d0b('0x3f'),_0x5969ea);_0x4740db[_0x8d0b('0x40')](_0x8d0b('0x41'),_0x8d0b('0x42')+_0x5969ea);_0x4740db[_0x8d0b('0x1d')](_0x8d0b('0x43'),_0x8d0b('0x44'));_0x4740db['download'](_0x41ea68);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 0d23ec3..5f04bcc 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 _0x5373=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','License','license','util'];(function(_0x5c9e32,_0x4001ac){var _0x39ff71=function(_0x1aa4a0){while(--_0x1aa4a0){_0x5c9e32['push'](_0x5c9e32['shift']());}};_0x39ff71(++_0x4001ac);}(_0x5373,0x12a));var _0x3537=function(_0x308b5e,_0x29091c){_0x308b5e=_0x308b5e-0x0;var _0xa01f50=_0x5373[_0x308b5e];return _0xa01f50;};'use strict';var _=require('lodash');var util=require(_0x3537('0x0'));var logger=require(_0x3537('0x1'))(_0x3537('0x2'));var moment=require(_0x3537('0x3'));var BPromise=require(_0x3537('0x4'));var rp=require(_0x3537('0x5'));var fs=require('fs');var path=require(_0x3537('0x6'));var rimraf=require(_0x3537('0x7'));var config=require(_0x3537('0x8'));var attributes=require(_0x3537('0x9'));module[_0x3537('0xa')]=function(_0x3f4d2d,_0x202270){return _0x3f4d2d['define'](_0x3537('0xb'),attributes,{'tableName':_0x3537('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaa0=['rimraf','./license.attributes','exports','define','License','license','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x29ff0b,_0x5ceb4d){var _0x1774c6=function(_0x4c0ea5){while(--_0x4c0ea5){_0x29ff0b['push'](_0x29ff0b['shift']());}};_0x1774c6(++_0x5ceb4d);}(_0xdaa0,0x66));var _0x0daa=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xdaa0[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x0daa('0x0'));var logger=require(_0x0daa('0x1'))(_0x0daa('0x2'));var moment=require('moment');var BPromise=require(_0x0daa('0x3'));var rp=require(_0x0daa('0x4'));var fs=require('fs');var path=require(_0x0daa('0x5'));var rimraf=require(_0x0daa('0x6'));var config=require('../../config/environment');var attributes=require(_0x0daa('0x7'));module[_0x0daa('0x8')]=function(_0x473587,_0x17a402){return _0x473587[_0x0daa('0x9')](_0x0daa('0xa'),attributes,{'tableName':_0x0daa('0xb'),'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 fbebf7e..e4b4eaa 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 _0x95fd=['../../config/environment','jayson/promise','client','request','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2280f9,_0x20175f){var _0x59aebf=function(_0x4c0255){while(--_0x4c0255){_0x2280f9['push'](_0x2280f9['shift']());}};_0x59aebf(++_0x20175f);}(_0x95fd,0x10b));var _0xd95f=function(_0x376c57,_0x499d38){_0x376c57=_0x376c57-0x0;var _0x36cdf0=_0x95fd[_0x376c57];return _0x36cdf0;};'use strict';var _=require(_0xd95f('0x0'));var util=require(_0xd95f('0x1'));var moment=require(_0xd95f('0x2'));var BPromise=require(_0xd95f('0x3'));var rs=require(_0xd95f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd95f('0x5'))['db'];var utils=require(_0xd95f('0x6'));var logger=require(_0xd95f('0x7'))(_0xd95f('0x8'));var config=require(_0xd95f('0x9'));var jayson=require(_0xd95f('0xa'));var client=jayson[_0xd95f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x293221,_0x10b093,_0x41b9fa){return new BPromise(function(_0x3e9ddc,_0x212151){return client[_0xd95f('0xc')](_0x293221,_0x41b9fa)['then'](function(_0x30ef7e){logger['info'](_0xd95f('0xd'),_0x10b093,_0xd95f('0xe'));logger['debug'](_0xd95f('0xf'),_0x10b093,_0xd95f('0xe'),JSON[_0xd95f('0x10')](_0x30ef7e));if(_0x30ef7e['error']){if(_0x30ef7e[_0xd95f('0x11')][_0xd95f('0x12')]===0x1f4){logger[_0xd95f('0x11')](_0xd95f('0xd'),_0x10b093,_0x30ef7e[_0xd95f('0x11')][_0xd95f('0x13')]);return _0x212151(_0x30ef7e['error'][_0xd95f('0x13')]);}logger['error']('License,\x20%s,\x20%s',_0x10b093,_0x30ef7e[_0xd95f('0x11')][_0xd95f('0x13')]);return _0x3e9ddc(_0x30ef7e[_0xd95f('0x11')][_0xd95f('0x13')]);}else{logger[_0xd95f('0x14')](_0xd95f('0xd'),_0x10b093,_0xd95f('0xe'));_0x3e9ddc(_0x30ef7e[_0xd95f('0x15')][_0xd95f('0x13')]);}})[_0xd95f('0x16')](function(_0x198a2d){logger[_0xd95f('0x11')](_0xd95f('0xd'),_0x10b093,_0x198a2d);_0x212151(_0x198a2d);});});} \ No newline at end of file +var _0x3122=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment'];(function(_0x30ba85,_0x503490){var _0x58b533=function(_0x131acf){while(--_0x131acf){_0x30ba85['push'](_0x30ba85['shift']());}};_0x58b533(++_0x503490);}(_0x3122,0xb2));var _0x2312=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3122[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x2312('0x0'));var util=require('util');var moment=require(_0x2312('0x1'));var BPromise=require('bluebird');var rs=require(_0x2312('0x2'));var fs=require('fs');var Redis=require(_0x2312('0x3'));var db=require(_0x2312('0x4'))['db'];var utils=require(_0x2312('0x5'));var logger=require(_0x2312('0x6'))(_0x2312('0x7'));var config=require(_0x2312('0x8'));var jayson=require(_0x2312('0x9'));var client=jayson['client'][_0x2312('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3af554,_0x9f0cbe,_0x46a5c4){return new BPromise(function(_0x2e2e46,_0xfa7565){return client[_0x2312('0xb')](_0x3af554,_0x46a5c4)[_0x2312('0xc')](function(_0x4c1fb1){logger[_0x2312('0xd')](_0x2312('0xe'),_0x9f0cbe,_0x2312('0xf'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x9f0cbe,_0x2312('0xf'),JSON['stringify'](_0x4c1fb1));if(_0x4c1fb1[_0x2312('0x10')]){if(_0x4c1fb1[_0x2312('0x10')][_0x2312('0x11')]===0x1f4){logger[_0x2312('0x10')]('License,\x20%s,\x20%s',_0x9f0cbe,_0x4c1fb1[_0x2312('0x10')][_0x2312('0x12')]);return _0xfa7565(_0x4c1fb1[_0x2312('0x10')][_0x2312('0x12')]);}logger[_0x2312('0x10')]('License,\x20%s,\x20%s',_0x9f0cbe,_0x4c1fb1['error'][_0x2312('0x12')]);return _0x2e2e46(_0x4c1fb1[_0x2312('0x10')][_0x2312('0x12')]);}else{logger[_0x2312('0xd')](_0x2312('0xe'),_0x9f0cbe,'request\x20sent');_0x2e2e46(_0x4c1fb1['result']['message']);}})[_0x2312('0x13')](function(_0x11552e){logger['error'](_0x2312('0xe'),_0x9f0cbe,_0x11552e);_0xfa7565(_0x11552e);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 2535887..ab3b0af 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 _0x2d1d=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addSmtp','addApplications','/:id/send','send','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x1f0873,_0x425151){var _0x5ba42d=function(_0x1fe478){while(--_0x1fe478){_0x1f0873['push'](_0x1f0873['shift']());}};_0x5ba42d(++_0x425151);}(_0x2d1d,0xb2));var _0xd2d1=function(_0xa4d38a,_0x149c93){_0xa4d38a=_0xa4d38a-0x0;var _0x450e43=_0x2d1d[_0xa4d38a];return _0x450e43;};'use strict';var multer=require(_0xd2d1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd2d1('0x1'));var express=require(_0xd2d1('0x2'));var router=express[_0xd2d1('0x3')]();var fs_extra=require(_0xd2d1('0x4'));var auth=require(_0xd2d1('0x5'));var interaction=require(_0xd2d1('0x6'));var config=require(_0xd2d1('0x7'));var controller=require(_0xd2d1('0x8'));router['get']('/',auth[_0xd2d1('0x9')](),controller[_0xd2d1('0xa')]);router[_0xd2d1('0xb')]('/describe',auth[_0xd2d1('0x9')](),controller[_0xd2d1('0xc')]);router[_0xd2d1('0xb')](_0xd2d1('0xd'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0xe')]);router[_0xd2d1('0xb')](_0xd2d1('0xf'),auth['isAuthenticated'](),controller[_0xd2d1('0x10')]);router['get'](_0xd2d1('0x11'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x12')]);router[_0xd2d1('0xb')](_0xd2d1('0x13'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x14')]);router[_0xd2d1('0xb')](_0xd2d1('0x15'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x16')]);router[_0xd2d1('0xb')](_0xd2d1('0x17'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x18')]);router['get']('/:id/applications',auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x19')]);router[_0xd2d1('0xb')](_0xd2d1('0x1a'),auth['isAuthenticated'](),controller[_0xd2d1('0x1b')]);router[_0xd2d1('0xb')](_0xd2d1('0x1c'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x1d')]);router[_0xd2d1('0xb')](_0xd2d1('0x1e'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x1f')]);router[_0xd2d1('0x20')]('/:id/dispositions',auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x21')]);router[_0xd2d1('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd2d1('0x22')]);router[_0xd2d1('0x20')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd2d1('0x20')](_0xd2d1('0x13'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x23')]);router[_0xd2d1('0x20')]('/:id/out_servers',auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x24')]);router[_0xd2d1('0x20')](_0xd2d1('0x17'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xd2d1('0x20')]('/:id/applications',auth['isAuthenticated'](),controller[_0xd2d1('0x25')]);router[_0xd2d1('0x20')](_0xd2d1('0x26'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x27')]);router[_0xd2d1('0x20')](_0xd2d1('0x1e'),auth[_0xd2d1('0x9')](),controller['addAgents']);router['put'](_0xd2d1('0xd'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x28')]);router[_0xd2d1('0x29')](_0xd2d1('0xf'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x2a')]);router[_0xd2d1('0x29')](_0xd2d1('0x11'),auth['isAuthenticated'](),controller[_0xd2d1('0x2b')]);router[_0xd2d1('0x29')](_0xd2d1('0x13'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x2c')]);router['delete'](_0xd2d1('0x15'),auth[_0xd2d1('0x9')](),controller['removeSmtp']);router[_0xd2d1('0x29')]('/:id',auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x2d')]);router[_0xd2d1('0x29')](_0xd2d1('0x1e'),auth[_0xd2d1('0x9')](),controller[_0xd2d1('0x2e')]);module[_0xd2d1('0x2f')]=router; \ No newline at end of file +var _0xb180=['/:id/applications','getApplications','/:id/verify','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xb180,0x180));var _0x0b18=function(_0x276871,_0x137e81){_0x276871=_0x276871-0x0;var _0x1f3976=_0xb180[_0x276871];return _0x1f3976;};'use strict';var multer=require(_0x0b18('0x0'));var util=require(_0x0b18('0x1'));var path=require(_0x0b18('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0b18('0x3')]();var fs_extra=require(_0x0b18('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0b18('0x5'));var config=require(_0x0b18('0x6'));var controller=require(_0x0b18('0x7'));router['get']('/',auth[_0x0b18('0x8')](),controller[_0x0b18('0x9')]);router[_0x0b18('0xa')](_0x0b18('0xb'),auth[_0x0b18('0x8')](),controller[_0x0b18('0xc')]);router[_0x0b18('0xa')](_0x0b18('0xd'),auth[_0x0b18('0x8')](),controller['show']);router[_0x0b18('0xa')]('/:id/dispositions',auth[_0x0b18('0x8')](),controller[_0x0b18('0xe')]);router[_0x0b18('0xa')](_0x0b18('0xf'),auth[_0x0b18('0x8')](),controller[_0x0b18('0x10')]);router[_0x0b18('0xa')](_0x0b18('0x11'),auth[_0x0b18('0x8')](),controller[_0x0b18('0x12')]);router[_0x0b18('0xa')]('/:id/out_servers',auth[_0x0b18('0x8')](),controller['getSmtp']);router['get'](_0x0b18('0x13'),auth['isAuthenticated'](),controller[_0x0b18('0x14')]);router['get'](_0x0b18('0x15'),auth['isAuthenticated'](),controller[_0x0b18('0x16')]);router['get']('/:id/messages',auth[_0x0b18('0x8')](),controller['getMessages']);router[_0x0b18('0xa')](_0x0b18('0x17'),auth['isAuthenticated'](),controller['verifySmtp']);router['get'](_0x0b18('0x18'),auth[_0x0b18('0x8')](),controller[_0x0b18('0x19')]);router[_0x0b18('0x1a')](_0x0b18('0x1b'),auth[_0x0b18('0x8')](),controller[_0x0b18('0x1c')]);router[_0x0b18('0x1a')]('/:id/canned_answers',auth[_0x0b18('0x8')](),controller[_0x0b18('0x1d')]);router[_0x0b18('0x1a')]('/',auth[_0x0b18('0x8')](),controller[_0x0b18('0x1e')]);router[_0x0b18('0x1a')](_0x0b18('0x11'),auth['isAuthenticated'](),controller['addImap']);router[_0x0b18('0x1a')](_0x0b18('0x1f'),auth['isAuthenticated'](),controller[_0x0b18('0x20')]);router[_0x0b18('0x1a')](_0x0b18('0x13'),auth['isAuthenticated'](),controller[_0x0b18('0x21')]);router[_0x0b18('0x1a')](_0x0b18('0x15'),auth[_0x0b18('0x8')](),controller[_0x0b18('0x22')]);router[_0x0b18('0x1a')](_0x0b18('0x23'),auth[_0x0b18('0x8')](),controller[_0x0b18('0x24')]);router['post'](_0x0b18('0x18'),auth[_0x0b18('0x8')](),controller[_0x0b18('0x25')]);router[_0x0b18('0x26')](_0x0b18('0xd'),auth[_0x0b18('0x8')](),controller[_0x0b18('0x27')]);router[_0x0b18('0x28')](_0x0b18('0x1b'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x0b18('0x28')]('/:id/canned_answers',auth[_0x0b18('0x8')](),controller[_0x0b18('0x29')]);router[_0x0b18('0x28')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0b18('0x2a')]);router[_0x0b18('0x28')]('/:id/out_servers',auth[_0x0b18('0x8')](),controller[_0x0b18('0x2b')]);router[_0x0b18('0x28')]('/:id',auth[_0x0b18('0x8')](),controller[_0x0b18('0x2c')]);router[_0x0b18('0x28')](_0x0b18('0x18'),auth[_0x0b18('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a60f388..24124ad 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 _0x2bc3=['BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','outlook365','getDataValue','provider','custom','sequelize','STRING'];(function(_0x4a753f,_0x33f3e9){var _0x117385=function(_0x76c316){while(--_0x76c316){_0x4a753f['push'](_0x4a753f['shift']());}};_0x117385(++_0x33f3e9);}(_0x2bc3,0x1d2));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x32bc('0x0'));module['exports']={'description':{'type':Sequelize[_0x32bc('0x1')]},'name':{'type':Sequelize[_0x32bc('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x32bc('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x32bc('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x32bc('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x32bc('0x1')],'allowNull':![],'defaultValue':_0x32bc('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x32bc('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x32bc('0x5')],'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[_0x32bc('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x32bc('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x32bc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x32bc('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x32bc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x32bc('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x32bc('0x2')],'defaultValue':![],'comment':_0x32bc('0x7'),'set':function(_0x35fc43){if(!_0x35fc43)this[_0x32bc('0x8')](_0x32bc('0x9'),null);this[_0x32bc('0x8')](_0x32bc('0xa'),_0x35fc43);}},'provider':{'type':Sequelize[_0x32bc('0xb')](_0x32bc('0xc'),_0x32bc('0xd'),'yahoo',_0x32bc('0xe')),'defaultValue':null,'get':function(){if(!this[_0x32bc('0xf')](_0x32bc('0x10')))return'custom';return this[_0x32bc('0xf')](_0x32bc('0x10'));},'set':function(_0x18f15a){if(_0x18f15a===_0x32bc('0x11'))_0x18f15a=null;return this[_0x32bc('0x8')]('provider',_0x18f15a);}}}; \ No newline at end of file +var _0x108e=['provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue'];(function(_0x3d034d,_0x7ec8ea){var _0x5cdf5a=function(_0x46429a){while(--_0x46429a){_0x3d034d['push'](_0x3d034d['shift']());}};_0x5cdf5a(++_0x7ec8ea);}(_0x108e,0xd4));var _0xe108=function(_0x17cc11,_0x121ef6){_0x17cc11=_0x17cc11-0x0;var _0x592301=_0x108e[_0x17cc11];return _0x592301;};'use strict';var Sequelize=require(_0xe108('0x0'));module['exports']={'description':{'type':Sequelize[_0xe108('0x1')]},'name':{'type':Sequelize[_0xe108('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xe108('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xe108('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xe108('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xe108('0x3')]},'markAsUnread':{'type':Sequelize[_0xe108('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe108('0x1')],'allowNull':![],'defaultValue':_0xe108('0x4')},'fontSize':{'type':Sequelize[_0xe108('0x5')](0x2)[_0xe108('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe108('0x7');}},'notificationSound':{'type':Sequelize[_0xe108('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe108('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe108('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe108('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe108('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe108('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe108('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xe108('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe108('0x2')],'defaultValue':![],'comment':_0xe108('0x9'),'set':function(_0x4c754c){if(!_0x4c754c)this[_0xe108('0xa')](_0xe108('0xb'),null);this['setDataValue'](_0xe108('0xc'),_0x4c754c);}},'provider':{'type':Sequelize[_0xe108('0xd')](_0xe108('0xe'),_0xe108('0xf'),_0xe108('0x10'),_0xe108('0x11')),'defaultValue':null,'get':function(){if(!this[_0xe108('0x12')](_0xe108('0x13')))return _0xe108('0x14');return this[_0xe108('0x12')]('provider');},'set':function(_0x5f143c){if(_0x5f143c===_0xe108('0x14'))_0x5f143c=null;return this[_0xe108('0xa')](_0xe108('0x13'),_0x5f143c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index d91900a..03a8aac 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 _0x2fa1=['bluebird','util','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','destroy','get','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','options','includeAll','include','rows','params','keys','rawAttributes','body','provider','find','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','custom','ListId','isNil','active','description','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','stack','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','messageId','out','Interaction','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment'];(function(_0x135acd,_0x54411c){var _0x38269e=function(_0x176122){while(--_0x176122){_0x135acd['push'](_0x135acd['shift']());}};_0x38269e(++_0x54411c);}(_0x2fa1,0xc4));var _0x12fa=function(_0x3e5e05,_0x522c1d){_0x3e5e05=_0x3e5e05-0x0;var _0x1cdc9f=_0x2fa1[_0x3e5e05];return _0x1cdc9f;};'use strict';var moment=require(_0x12fa('0x0'));var BPromise=require(_0x12fa('0x1'));var util=require(_0x12fa('0x2'));var path=require(_0x12fa('0x3'));var _=require(_0x12fa('0x4'));var juice=require(_0x12fa('0x5'));var Redis=require(_0x12fa('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x12fa('0x7'))(_0x12fa('0x8'));var config=require(_0x12fa('0x9'));var db=require('../../mysqldb')['db'];config[_0x12fa('0xa')]=_[_0x12fa('0xb')](config[_0x12fa('0xa')],{'host':_0x12fa('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x12fa('0xd'))[_0x12fa('0xe')](socket);var jayson=require(_0x12fa('0xf'));var client=jayson[_0x12fa('0x10')][_0x12fa('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x2598d3,_0x258c51,_0x674004,_0x2e0d67){return new BPromise(function(_0x40b763,_0x50167c){var _0x1daf95=_0x2e0d67||client;return _0x1daf95[_0x12fa('0x12')](_0x2598d3,_0x674004)[_0x12fa('0x13')](function(_0xeaa9c7){logger['info'](_0x12fa('0x14'),_0x258c51,'request\x20sent');logger['debug'](_0x12fa('0x15'),_0x258c51,_0x12fa('0x16'),JSON['stringify'](_0xeaa9c7));if(_0xeaa9c7[_0x12fa('0x17')]){if(_0xeaa9c7[_0x12fa('0x17')][_0x12fa('0x18')]===0x1f4){logger[_0x12fa('0x17')](_0x12fa('0x14'),_0x258c51,_0xeaa9c7[_0x12fa('0x17')][_0x12fa('0x19')]);return _0x50167c(_0xeaa9c7[_0x12fa('0x17')][_0x12fa('0x19')]);}logger[_0x12fa('0x17')](_0x12fa('0x14'),_0x258c51,_0xeaa9c7[_0x12fa('0x17')][_0x12fa('0x19')]);return _0x40b763(_0xeaa9c7['error'][_0x12fa('0x19')]);}else{logger['info'](_0x12fa('0x14'),_0x258c51,_0x12fa('0x16'));_0x40b763(_0xeaa9c7[_0x12fa('0x1a')]['message']);}})[_0x12fa('0x1b')](function(_0x4f4ff6){logger[_0x12fa('0x17')](_0x12fa('0x14'),_0x258c51,_0x4f4ff6);_0x50167c(_0x4f4ff6);});});}function respondWithStatusCode(_0x1cd9e3,_0x59d324){_0x59d324=_0x59d324||0xcc;return function(_0x5d076b){if(_0x5d076b){return _0x1cd9e3[_0x12fa('0x1c')](_0x59d324);}return _0x1cd9e3[_0x12fa('0x1d')](_0x59d324)[_0x12fa('0x1e')]();};}function respondWithResult(_0x55750a,_0x2e4ae8){_0x2e4ae8=_0x2e4ae8||0xc8;return function(_0x19a39e){if(_0x19a39e){return _0x55750a['status'](_0x2e4ae8)[_0x12fa('0x1f')](_0x19a39e);}};}function respondWithFilteredResult(_0x58d3b1,_0x534ada){return function(_0x938685){if(_0x938685){var _0x1faf36=typeof _0x534ada['offset']===_0x12fa('0x20')&&typeof _0x534ada['limit']===_0x12fa('0x20');var _0x91709f=_0x938685[_0x12fa('0x21')];var _0x369dc4=_0x1faf36?0x0:_0x534ada[_0x12fa('0x22')];var _0x642636=_0x1faf36?_0x938685[_0x12fa('0x21')]:_0x534ada[_0x12fa('0x22')]+_0x534ada[_0x12fa('0x23')];var _0x21e472;if(_0x642636>=_0x91709f){_0x642636=_0x91709f;_0x21e472=0xc8;}else{_0x21e472=0xce;}_0x58d3b1[_0x12fa('0x1d')](_0x21e472);return _0x58d3b1[_0x12fa('0x24')](_0x12fa('0x25'),_0x369dc4+'-'+_0x642636+'/'+_0x91709f)[_0x12fa('0x1f')](_0x938685);}return null;};}function saveUpdates(_0x598e25){return function(_0x14f625){if(_0x14f625){return _0x14f625[_0x12fa('0x26')](_0x598e25)[_0x12fa('0x13')](function(_0xe86375){return _0xe86375;});}return null;};}function removeEntity(_0x338b90){return function(_0x441ad1){if(_0x441ad1){return _0x441ad1[_0x12fa('0x27')]()[_0x12fa('0x13')](function(){var _0x45fe97=_0x441ad1[_0x12fa('0x28')]({'plain':!![]});var _0x401a75='MailAccounts';return db['UserProfileResource'][_0x12fa('0x27')]({'where':{'type':_0x401a75,'resourceId':_0x45fe97['id']}})[_0x12fa('0x13')](function(){return _0x441ad1;});})[_0x12fa('0x13')](function(){_0x338b90[_0x12fa('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dbdcb){return function(_0x3dc2fe){if(!_0x3dc2fe){_0x5dbdcb['sendStatus'](0x194);}return _0x3dc2fe;};}function handleError(_0x19e6e1,_0x22c1ce){_0x22c1ce=_0x22c1ce||0x1f4;return function(_0x5af093){logger['error'](_0x5af093['stack']);if(_0x5af093[_0x12fa('0x29')]){delete _0x5af093['name'];}_0x19e6e1['status'](_0x22c1ce)[_0x12fa('0x2a')](_0x5af093);};}function getImapHost(_0x219474){switch(_0x219474){case'gmail':return _0x12fa('0x2b');case _0x12fa('0x2c'):return _0x12fa('0x2d');case _0x12fa('0x2e'):return _0x12fa('0x2f');case _0x12fa('0x30'):return _0x12fa('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x219474);}function getSmtpHost(_0x42dad5){switch(_0x42dad5){case'gmail':return _0x12fa('0x32');case _0x12fa('0x2c'):return _0x12fa('0x33');case _0x12fa('0x2e'):return _0x12fa('0x34');case _0x12fa('0x30'):return _0x12fa('0x35');}throw new Error(_0x12fa('0x36'),_0x42dad5);}function getAuthenticationOptions(_0x187686,_0x1c9518){var _0x1f3a6b={};var _0x1c6c44={};if(_0x187686){_0x1f3a6b['user']=_0x1c6c44[_0x12fa('0x37')]=_0x1c9518['username'];_0x1f3a6b['password']=_0x1c6c44[_0x12fa('0x38')]=_0x1c9518[_0x12fa('0x39')];if(_0x1c9518[_0x12fa('0x3a')]){_0x1f3a6b[_0x12fa('0x3a')]=_0x1c6c44[_0x12fa('0x3a')]=!![];_0x1f3a6b['CloudProviderId']=_0x1c6c44['CloudProviderId']=_0x1c9518['CloudProviderId'];_0x1f3a6b['password']=_0x1c6c44[_0x12fa('0x38')]=null;}else{_0x1f3a6b[_0x12fa('0x3b')]=_0x1c6c44['CloudProviderId']=null;}_0x1f3a6b[_0x12fa('0x3c')]=getImapHost(_0x187686);_0x1f3a6b[_0x12fa('0x3d')]=0x3e1;_0x1c6c44[_0x12fa('0x3c')]=getSmtpHost(_0x187686);_0x1c6c44['port']=0x24b;_0x1c6c44[_0x12fa('0x3e')]=![];_0x1f3a6b[_0x12fa('0x3f')]=_0x1c6c44['service']=null;}else{if(_0x1c9518[_0x12fa('0x40')]){_0x1f3a6b['user']=_0x1c6c44[_0x12fa('0x37')]=_0x1c9518['username'];_0x1f3a6b[_0x12fa('0x39')]=_0x1c6c44['pass']=_0x1c9518['password'];}else{_0x1f3a6b[_0x12fa('0x40')]=_0x1c6c44[_0x12fa('0x40')]=![];_0x1f3a6b['user']=_0x1c6c44['user']=null;_0x1f3a6b[_0x12fa('0x39')]=_0x1c6c44[_0x12fa('0x38')]=null;}_0x1f3a6b[_0x12fa('0x3c')]=_0x1c9518[_0x12fa('0x41')][_0x12fa('0x3c')];_0x1f3a6b[_0x12fa('0x3d')]=_0x1c9518[_0x12fa('0x41')][_0x12fa('0x3d')];_0x1c6c44[_0x12fa('0x3c')]=_0x1c9518['Smtp'][_0x12fa('0x3c')];_0x1c6c44[_0x12fa('0x3d')]=_0x1c9518[_0x12fa('0x42')][_0x12fa('0x3d')];}return{'Imap':_0x1f3a6b,'Smtp':_0x1c6c44};}exports[_0x12fa('0x43')]=function(_0x2dd774,_0x54d768){var _0x190617={'include':[{'model':db[_0x12fa('0x44')],'as':_0x12fa('0x41')},{'model':db[_0x12fa('0x45')],'as':_0x12fa('0x42')},{'model':db[_0x12fa('0x46')],'as':_0x12fa('0x47')}]},_0x44a819={},_0x37cd1d={'count':0x0,'rows':[]};var _0x4db949=_[_0x12fa('0x48')](db[_0x12fa('0x49')]['rawAttributes'],function(_0x23f70a){return{'name':_0x23f70a[_0x12fa('0x4a')],'type':_0x23f70a[_0x12fa('0x4b')][_0x12fa('0x4c')]};});_0x44a819[_0x12fa('0x4d')]=_[_0x12fa('0x48')](_0x4db949,_0x12fa('0x29'));_0x44a819[_0x12fa('0x4e')]=_['keys'](_0x2dd774[_0x12fa('0x4e')]);_0x44a819[_0x12fa('0x4f')]=_['intersection'](_0x44a819[_0x12fa('0x4d')],_0x44a819[_0x12fa('0x4e')]);_0x190617[_0x12fa('0x50')]=_[_0x12fa('0x51')](_0x44a819[_0x12fa('0x4d')],qs[_0x12fa('0x52')](_0x2dd774[_0x12fa('0x4e')][_0x12fa('0x52')]));_0x190617[_0x12fa('0x50')]=_0x190617[_0x12fa('0x50')][_0x12fa('0x53')]?_0x190617[_0x12fa('0x50')]:_0x44a819[_0x12fa('0x4d')];if(!_0x2dd774['query']['hasOwnProperty']('nolimit')){_0x190617[_0x12fa('0x23')]=qs[_0x12fa('0x23')](_0x2dd774[_0x12fa('0x4e')][_0x12fa('0x23')]);_0x190617[_0x12fa('0x22')]=qs['offset'](_0x2dd774[_0x12fa('0x4e')][_0x12fa('0x22')]);}_0x190617[_0x12fa('0x54')]=qs[_0x12fa('0x55')](_0x2dd774['query']['sort']);_0x190617[_0x12fa('0x56')]=qs['filters'](_[_0x12fa('0x57')](_0x2dd774['query'],_0x44a819[_0x12fa('0x4f')]),_0x4db949);if(_0x2dd774[_0x12fa('0x4e')][_0x12fa('0x58')]){_0x190617['where']=_[_0x12fa('0x59')](_0x190617['where'],{'$or':_[_0x12fa('0x48')](_0x4db949,function(_0xb6659e){if(_0xb6659e[_0x12fa('0x4b')]!=='VIRTUAL'){var _0x53633b={};_0x53633b[_0xb6659e['name']]={'$like':'%'+_0x2dd774[_0x12fa('0x4e')][_0x12fa('0x58')]+'%'};return _0x53633b;}})});}_0x190617=_['merge']({},_0x190617,_0x2dd774[_0x12fa('0x5a')]);var _0x12e2ae={'where':_0x190617[_0x12fa('0x56')]};return db[_0x12fa('0x49')][_0x12fa('0x21')](_0x12e2ae)[_0x12fa('0x13')](function(_0x45a5f0){_0x37cd1d['count']=_0x45a5f0;if(_0x2dd774['query'][_0x12fa('0x5b')]){_0x190617[_0x12fa('0x5c')]=[{'all':!![]}];}return db[_0x12fa('0x49')]['findAll'](_0x190617);})[_0x12fa('0x13')](function(_0x4ffe9f){_0x37cd1d[_0x12fa('0x5d')]=_0x4ffe9f;return _0x37cd1d;})[_0x12fa('0x13')](respondWithFilteredResult(_0x54d768,_0x190617))[_0x12fa('0x1b')](handleError(_0x54d768,null));};exports['show']=function(_0x102d4e,_0x2015bd){var _0x4eda9c={'raw':![],'where':{'id':_0x102d4e[_0x12fa('0x5e')]['id']},'include':[{'model':db[_0x12fa('0x44')],'as':_0x12fa('0x41')},{'model':db['MailServerOut'],'as':_0x12fa('0x42')},{'model':db[_0x12fa('0x46')],'as':'mandatoryDispositionPause'}]},_0x11f098={};_0x11f098[_0x12fa('0x4d')]=_[_0x12fa('0x5f')](db[_0x12fa('0x49')][_0x12fa('0x60')]);_0x11f098['query']=_[_0x12fa('0x5f')](_0x102d4e[_0x12fa('0x4e')]);_0x11f098['filters']=_[_0x12fa('0x51')](_0x11f098[_0x12fa('0x4d')],_0x11f098[_0x12fa('0x4e')]);_0x4eda9c[_0x12fa('0x50')]=_[_0x12fa('0x51')](_0x11f098[_0x12fa('0x4d')],qs[_0x12fa('0x52')](_0x102d4e['query'][_0x12fa('0x52')]));_0x4eda9c[_0x12fa('0x50')]=_0x4eda9c[_0x12fa('0x50')][_0x12fa('0x53')]?_0x4eda9c[_0x12fa('0x50')]:_0x11f098[_0x12fa('0x4d')];if(_0x102d4e[_0x12fa('0x4e')]['includeAll']){_0x4eda9c[_0x12fa('0x5c')]=[{'all':!![]}];}_0x4eda9c=_[_0x12fa('0x59')]({},_0x4eda9c,_0x102d4e[_0x12fa('0x5a')]);return db['MailAccount']['find'](_0x4eda9c)[_0x12fa('0x13')](handleEntityNotFound(_0x2015bd,null))[_0x12fa('0x13')](respondWithResult(_0x2015bd,null))['catch'](handleError(_0x2015bd,null));};exports[_0x12fa('0x26')]=function(_0x41bab7,_0x11437e){if(_0x41bab7[_0x12fa('0x61')]['id']){delete _0x41bab7[_0x12fa('0x61')]['id'];}var _0x15c69b=_0x41bab7['body'][_0x12fa('0x62')]==='custom'?null:_0x41bab7[_0x12fa('0x61')][_0x12fa('0x62')];var _0x527146=_0x41bab7[_0x12fa('0x61')]['Imap']||{};var _0x238e77=_0x41bab7[_0x12fa('0x61')][_0x12fa('0x42')]||{};if(_0x15c69b){_0x527146['host']=getImapHost(_0x15c69b);_0x527146[_0x12fa('0x3d')]=0x3e1;_0x238e77[_0x12fa('0x3c')]=getSmtpHost(_0x15c69b);_0x238e77[_0x12fa('0x3d')]=0x24b;_0x238e77[_0x12fa('0x3e')]=![];}if(_0x238e77['modernAuthentication']){_0x238e77[_0x12fa('0x3e')]=![];}else{_0x238e77[_0x12fa('0x3b')]=null;}if(!_0x527146['modernAuthentication'])_0x527146[_0x12fa('0x3b')]=null;_0x41bab7['body'][_0x12fa('0x41')]=_0x527146;_0x41bab7[_0x12fa('0x61')][_0x12fa('0x42')]=_0x238e77;return db[_0x12fa('0x49')][_0x12fa('0x63')]({'where':{'id':_0x41bab7[_0x12fa('0x5e')]['id']},'include':[{'model':db[_0x12fa('0x44')],'as':_0x12fa('0x41')},{'model':db[_0x12fa('0x45')],'as':'Smtp'},{'model':db[_0x12fa('0x46')],'as':_0x12fa('0x47')}]})['then'](handleEntityNotFound(_0x11437e,null))['then'](function(_0x4820f2){if(!_0x4820f2)throw new Error(_0x12fa('0x64'));if(_0x4820f2[_0x12fa('0x3f')])delete _0x41bab7[_0x12fa('0x61')]['Imap'];return _0x4820f2;})[_0x12fa('0x13')](saveUpdates(_0x41bab7['body'],null))['then'](function(_0x3eb770){if(!_0x41bab7[_0x12fa('0x61')][_0x12fa('0x41')])return _0x3eb770;return db[_0x12fa('0x44')]['update'](_0x41bab7[_0x12fa('0x61')]['Imap'],{'where':{'MailAccountId':_0x3eb770['id']}})[_0x12fa('0x13')](function(){return _0x3eb770;});})[_0x12fa('0x13')](function(_0x4b1d6d){if(!_0x41bab7[_0x12fa('0x61')][_0x12fa('0x42')])return _0x4b1d6d;return db[_0x12fa('0x45')][_0x12fa('0x26')](_0x41bab7[_0x12fa('0x61')][_0x12fa('0x42')],{'where':{'MailAccountId':_0x4b1d6d['id']}})[_0x12fa('0x13')](function(){return _0x4b1d6d;});})['then'](respondWithResult(_0x11437e,null))[_0x12fa('0x1b')](handleError(_0x11437e,null));};exports[_0x12fa('0x65')]=function(_0x41d8c7,_0x126a0c){return db[_0x12fa('0x49')][_0x12fa('0x65')]()['then'](respondWithResult(_0x126a0c,null))[_0x12fa('0x1b')](handleError(_0x126a0c,null));};exports[_0x12fa('0x66')]=function(_0x3766ec,_0x2b5389){if(_0x3766ec['body']['id']){delete _0x3766ec[_0x12fa('0x61')]['id'];}return db[_0x12fa('0x49')][_0x12fa('0x63')]({'where':{'id':_0x3766ec['params']['id']}})['then'](handleEntityNotFound(_0x2b5389,null))['then'](function(_0x422c52){if(_0x422c52){_0x3766ec[_0x12fa('0x61')][_0x12fa('0x67')]=_0x422c52['id'];return db[_0x12fa('0x68')]['create'](_0x3766ec[_0x12fa('0x61')]);}})['then'](respondWithResult(_0x2b5389,null))[_0x12fa('0x1b')](handleError(_0x2b5389,null));};exports[_0x12fa('0x69')]=function(_0x2009c0,_0x51efbb){var _0x38de91={'raw':![],'where':{}};var _0x42ea78={};var _0x9e610e={'count':0x0,'rows':[]};return db[_0x12fa('0x49')][_0x12fa('0x6a')]({'where':{'id':_0x2009c0[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x51efbb,null))[_0x12fa('0x13')](function(_0xdd4f60){if(_0xdd4f60){_0x42ea78[_0x12fa('0x4d')]=_[_0x12fa('0x5f')](db[_0x12fa('0x68')]['rawAttributes']);_0x42ea78[_0x12fa('0x4e')]=_[_0x12fa('0x5f')](_0x2009c0['query']);_0x42ea78['filters']=_[_0x12fa('0x51')](_0x42ea78[_0x12fa('0x4d')],_0x42ea78[_0x12fa('0x4e')]);_0x38de91['attributes']=_[_0x12fa('0x51')](_0x42ea78[_0x12fa('0x4d')],qs[_0x12fa('0x52')](_0x2009c0['query'][_0x12fa('0x52')]));_0x38de91[_0x12fa('0x50')]=_0x38de91[_0x12fa('0x50')][_0x12fa('0x53')]?_0x38de91[_0x12fa('0x50')]:_0x42ea78[_0x12fa('0x4d')];if(!_0x2009c0[_0x12fa('0x4e')][_0x12fa('0x6b')](_0x12fa('0x6c'))){_0x38de91[_0x12fa('0x23')]=qs['limit'](_0x2009c0['query'][_0x12fa('0x23')]);_0x38de91[_0x12fa('0x22')]=qs[_0x12fa('0x22')](_0x2009c0[_0x12fa('0x4e')][_0x12fa('0x22')]);}_0x38de91[_0x12fa('0x54')]=qs['sort'](_0x2009c0['query'][_0x12fa('0x55')]);_0x38de91[_0x12fa('0x56')]=qs['filters'](_[_0x12fa('0x57')](_0x2009c0[_0x12fa('0x4e')],_0x42ea78[_0x12fa('0x4f')]));_0x38de91[_0x12fa('0x56')]['MailAccountId']=_0xdd4f60['id'];if(_0x2009c0[_0x12fa('0x4e')]['filter']){_0x38de91[_0x12fa('0x56')]=_[_0x12fa('0x59')](_0x38de91[_0x12fa('0x56')],{'$or':_[_0x12fa('0x48')](_0x38de91[_0x12fa('0x50')],function(_0x4c1d42){var _0x9c8208={};_0x9c8208[_0x4c1d42]={'$like':'%'+_0x2009c0[_0x12fa('0x4e')][_0x12fa('0x58')]+'%'};return _0x9c8208;})});}_0x38de91=_[_0x12fa('0x59')]({},_0x38de91,_0x2009c0[_0x12fa('0x5a')]);return db['Disposition'][_0x12fa('0x21')]({'where':_0x38de91[_0x12fa('0x56')]})[_0x12fa('0x13')](function(_0x12a0c9){_0x9e610e[_0x12fa('0x21')]=_0x12a0c9;if(_0x2009c0[_0x12fa('0x4e')]['includeAll']){_0x38de91['include']=[{'all':!![]}];}return db[_0x12fa('0x68')][_0x12fa('0x6d')](_0x38de91);})[_0x12fa('0x13')](function(_0x4fb31a){_0x9e610e[_0x12fa('0x5d')]=_0x4fb31a;return _0x9e610e;});}})[_0x12fa('0x13')](respondWithFilteredResult(_0x51efbb,_0x38de91))[_0x12fa('0x1b')](handleError(_0x51efbb,null));};exports[_0x12fa('0x6e')]=function(_0x56cf11,_0x302186){return db[_0x12fa('0x49')][_0x12fa('0x63')]({'where':{'id':_0x56cf11[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x302186,null))[_0x12fa('0x13')](function(_0x3f1a68){if(_0x3f1a68){return _0x3f1a68[_0x12fa('0x6e')](_0x56cf11[_0x12fa('0x4e')][_0x12fa('0x6f')]);}})[_0x12fa('0x13')](respondWithStatusCode(_0x302186,null))['catch'](handleError(_0x302186,null));};exports[_0x12fa('0x70')]=function(_0x53b838,_0x5a7453){if(_0x53b838[_0x12fa('0x61')]['id']){delete _0x53b838[_0x12fa('0x61')]['id'];}return db[_0x12fa('0x49')]['find']({'where':{'id':_0x53b838[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x5a7453,null))[_0x12fa('0x13')](function(_0x23ce0b){if(_0x23ce0b){_0x53b838[_0x12fa('0x61')][_0x12fa('0x67')]=_0x23ce0b['id'];return db[_0x12fa('0x71')]['create'](_0x53b838[_0x12fa('0x61')]);}})['then'](respondWithResult(_0x5a7453,null))['catch'](handleError(_0x5a7453,null));};exports['getAnswers']=function(_0x4b9099,_0x3f01dd){var _0x37a142={'raw':![],'where':{}};var _0x1cdf52={};var _0xbcacc2={'count':0x0,'rows':[]};return db[_0x12fa('0x49')][_0x12fa('0x6a')]({'where':{'id':_0x4b9099[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x3f01dd,null))[_0x12fa('0x13')](function(_0x1b9265){if(_0x1b9265){_0x1cdf52[_0x12fa('0x4d')]=_[_0x12fa('0x5f')](db[_0x12fa('0x71')][_0x12fa('0x60')]);_0x1cdf52[_0x12fa('0x4e')]=_[_0x12fa('0x5f')](_0x4b9099['query']);_0x1cdf52[_0x12fa('0x4f')]=_[_0x12fa('0x51')](_0x1cdf52['model'],_0x1cdf52[_0x12fa('0x4e')]);_0x37a142[_0x12fa('0x50')]=_[_0x12fa('0x51')](_0x1cdf52['model'],qs['fields'](_0x4b9099[_0x12fa('0x4e')][_0x12fa('0x52')]));_0x37a142[_0x12fa('0x50')]=_0x37a142[_0x12fa('0x50')][_0x12fa('0x53')]?_0x37a142[_0x12fa('0x50')]:_0x1cdf52[_0x12fa('0x4d')];if(!_0x4b9099[_0x12fa('0x4e')][_0x12fa('0x6b')](_0x12fa('0x6c'))){_0x37a142[_0x12fa('0x23')]=qs['limit'](_0x4b9099[_0x12fa('0x4e')][_0x12fa('0x23')]);_0x37a142[_0x12fa('0x22')]=qs['offset'](_0x4b9099[_0x12fa('0x4e')][_0x12fa('0x22')]);}_0x37a142[_0x12fa('0x54')]=qs[_0x12fa('0x55')](_0x4b9099[_0x12fa('0x4e')]['sort']);_0x37a142[_0x12fa('0x56')]=qs['filters'](_['pick'](_0x4b9099['query'],_0x1cdf52[_0x12fa('0x4f')]));_0x37a142[_0x12fa('0x56')][_0x12fa('0x67')]=_0x1b9265['id'];if(_0x4b9099[_0x12fa('0x4e')]['filter']){_0x37a142[_0x12fa('0x56')]=_[_0x12fa('0x59')](_0x37a142[_0x12fa('0x56')],{'$or':_['map'](_0x37a142[_0x12fa('0x50')],function(_0x525497){var _0xe3aee4={};_0xe3aee4[_0x525497]={'$like':'%'+_0x4b9099[_0x12fa('0x4e')][_0x12fa('0x58')]+'%'};return _0xe3aee4;})});}_0x37a142=_[_0x12fa('0x59')]({},_0x37a142,_0x4b9099[_0x12fa('0x5a')]);return db[_0x12fa('0x71')][_0x12fa('0x21')]({'where':_0x37a142[_0x12fa('0x56')]})[_0x12fa('0x13')](function(_0x5de2c3){_0xbcacc2[_0x12fa('0x21')]=_0x5de2c3;if(_0x4b9099[_0x12fa('0x4e')][_0x12fa('0x5b')]){_0x37a142[_0x12fa('0x5c')]=[{'all':!![]}];}return db[_0x12fa('0x71')][_0x12fa('0x6d')](_0x37a142);})[_0x12fa('0x13')](function(_0x3f0389){_0xbcacc2[_0x12fa('0x5d')]=_0x3f0389;return _0xbcacc2;});}})[_0x12fa('0x13')](respondWithFilteredResult(_0x3f01dd,_0x37a142))[_0x12fa('0x1b')](handleError(_0x3f01dd,null));};exports['removeAnswers']=function(_0x46e290,_0xe4910b){return db[_0x12fa('0x49')][_0x12fa('0x63')]({'where':{'id':_0x46e290[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0xe4910b,null))[_0x12fa('0x13')](function(_0x409a64){if(_0x409a64){return _0x409a64['removeAnswers'](_0x46e290[_0x12fa('0x4e')][_0x12fa('0x6f')]);}})[_0x12fa('0x13')](respondWithStatusCode(_0xe4910b,null))['catch'](handleError(_0xe4910b,null));};exports['create']=function(_0x3073e5,_0x3d0f63){var _0x283c81={'name':_0x3073e5[_0x12fa('0x61')][_0x12fa('0x29')],'key':_0x3073e5['body'][_0x12fa('0x4c')],'provider':_0x3073e5['body'][_0x12fa('0x62')]===_0x12fa('0x72')?null:_0x3073e5[_0x12fa('0x61')][_0x12fa('0x62')],'email':_0x3073e5[_0x12fa('0x61')]['email'],'ListId':_0x3073e5['body'][_0x12fa('0x73')],'active':!_[_0x12fa('0x74')](_0x3073e5[_0x12fa('0x61')][_0x12fa('0x75')])?_0x3073e5[_0x12fa('0x61')][_0x12fa('0x75')]:!![],'description':_0x3073e5['body'][_0x12fa('0x76')]||null};var _0x315171=getAuthenticationOptions(_0x283c81[_0x12fa('0x62')],_0x3073e5[_0x12fa('0x61')]);_0x283c81[_0x12fa('0x41')]=_0x315171[_0x12fa('0x41')];_0x283c81['Smtp']=_0x315171[_0x12fa('0x42')];return db[_0x12fa('0x49')][_0x12fa('0x77')](_0x283c81,{'include':[{'model':db[_0x12fa('0x45')],'as':_0x12fa('0x42')},{'model':db[_0x12fa('0x44')],'as':'Imap'}]})['then'](function(_0x23384b){var _0x28d26d=_0x3073e5[_0x12fa('0x37')][_0x12fa('0x28')]({'plain':!![]});if(!_0x28d26d)throw new Error(_0x12fa('0x78'));if(_0x28d26d['role']===_0x12fa('0x37')){var _0x22929f=_0x23384b['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x12fa('0x79'),'userProfileId':_0x28d26d[_0x12fa('0x7a')]},'raw':!![]})[_0x12fa('0x13')](function(_0x4b3aa5){if(_0x4b3aa5&&_0x4b3aa5[_0x12fa('0x7b')]===0x0){return db['UserProfileResource'][_0x12fa('0x77')]({'name':_0x22929f[_0x12fa('0x29')],'resourceId':_0x22929f['id'],'type':_0x4b3aa5[_0x12fa('0x29')],'sectionId':_0x4b3aa5['id']},{})[_0x12fa('0x13')](function(){return _0x23384b;});}else{return _0x23384b;}})[_0x12fa('0x1b')](function(_0x360a23){logger[_0x12fa('0x17')](_0x12fa('0x7c'),_0x360a23);throw _0x360a23;});}return _0x23384b;})[_0x12fa('0x13')](respondWithResult(_0x3d0f63,0xc9))[_0x12fa('0x1b')](handleError(_0x3d0f63,null));};exports['getImap']=function(_0x197ad8,_0x14335f){return db[_0x12fa('0x49')][_0x12fa('0x6a')]({'where':{'id':_0x197ad8[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x14335f,null))[_0x12fa('0x13')](function(_0x2bb7e){if(_0x2bb7e){return _0x2bb7e[_0x12fa('0x7d')]();}return null;})['then'](respondWithResult(_0x14335f,null))['catch'](handleError(_0x14335f,null));};exports[_0x12fa('0x7e')]=function(_0x3f5be7,_0x556238){if(_0x3f5be7[_0x12fa('0x61')]['id']){delete _0x3f5be7[_0x12fa('0x61')]['id'];}return db[_0x12fa('0x49')][_0x12fa('0x63')]({'where':{'id':_0x3f5be7[_0x12fa('0x5e')]['id']}})['then'](handleEntityNotFound(_0x556238,null))[_0x12fa('0x13')](function(_0x1094d4){if(_0x1094d4){_0x3f5be7['body'][_0x12fa('0x67')]=_0x1094d4['id'];return db[_0x12fa('0x44')][_0x12fa('0x77')](_0x3f5be7[_0x12fa('0x61')]);}})[_0x12fa('0x13')](respondWithResult(_0x556238,null))[_0x12fa('0x1b')](handleError(_0x556238,null));};exports[_0x12fa('0x7f')]=function(_0x425152,_0x136ceb){return db[_0x12fa('0x49')][_0x12fa('0x6a')]({'where':{'id':_0x425152[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x136ceb,null))[_0x12fa('0x13')](function(_0x28ac77){if(_0x28ac77){return _0x28ac77[_0x12fa('0x80')](null);}return null;})[_0x12fa('0x13')](respondWithStatusCode(_0x136ceb,null))['catch'](handleError(_0x136ceb,null));};exports['getSmtp']=function(_0x48e42e,_0x1c0230){return db[_0x12fa('0x49')][_0x12fa('0x6a')]({'where':{'id':_0x48e42e[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x1c0230,null))[_0x12fa('0x13')](function(_0x3dc1f5){if(_0x3dc1f5){return _0x3dc1f5[_0x12fa('0x81')]();}return null;})['then'](respondWithResult(_0x1c0230,null))['catch'](handleError(_0x1c0230,null));};exports['addSmtp']=function(_0x4850e4,_0xd14ce1){if(_0x4850e4[_0x12fa('0x61')]['id']){delete _0x4850e4['body']['id'];}return db['MailAccount'][_0x12fa('0x63')]({'where':{'id':_0x4850e4['params']['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0xd14ce1,null))[_0x12fa('0x13')](function(_0x264bef){if(_0x264bef){_0x4850e4[_0x12fa('0x61')][_0x12fa('0x67')]=_0x264bef['id'];return db[_0x12fa('0x45')][_0x12fa('0x77')](_0x4850e4[_0x12fa('0x61')]);}})[_0x12fa('0x13')](respondWithResult(_0xd14ce1,null))[_0x12fa('0x1b')](handleError(_0xd14ce1,null));};exports[_0x12fa('0x82')]=function(_0x2d1875,_0x38d2fb){return db[_0x12fa('0x49')][_0x12fa('0x6a')]({'where':{'id':_0x2d1875['params']['id']}})['then'](handleEntityNotFound(_0x38d2fb,null))['then'](function(_0x2ab19c){if(_0x2ab19c){return _0x2ab19c[_0x12fa('0x83')](null);}return null;})[_0x12fa('0x13')](respondWithStatusCode(_0x38d2fb,null))[_0x12fa('0x1b')](handleError(_0x38d2fb,null));};exports[_0x12fa('0x84')]=function(_0xa088d8,_0x5d5402){return db[_0x12fa('0x85')][_0x12fa('0x63')]({'where':{'id':_0xa088d8['params']['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x5d5402,null))[_0x12fa('0x13')](function(_0x255c2f){if(_0x255c2f){return _0x255c2f[_0x12fa('0x84')](_0xa088d8[_0x12fa('0x61')][_0x12fa('0x6f')],_[_0x12fa('0x86')](_0xa088d8[_0x12fa('0x61')],[_0x12fa('0x6f'),'id'])||{});}})[_0x12fa('0x13')](respondWithResult(_0x5d5402,null))['catch'](handleError(_0x5d5402,null));};exports[_0x12fa('0x87')]=function(_0x5bf5e8,_0x50d92b){var _0x2ca612={'raw':![],'where':{}};var _0x153819={};var _0x18f277={'count':0x0,'rows':[]};return db[_0x12fa('0x49')]['findOne']({'where':{'id':_0x5bf5e8[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x50d92b,null))[_0x12fa('0x13')](function(_0x2d475c){if(_0x2d475c){_0x153819[_0x12fa('0x4d')]=_[_0x12fa('0x5f')](db[_0x12fa('0x85')][_0x12fa('0x60')]);_0x153819[_0x12fa('0x4e')]=_['keys'](_0x5bf5e8[_0x12fa('0x4e')]);_0x153819[_0x12fa('0x4f')]=_[_0x12fa('0x51')](_0x153819[_0x12fa('0x4d')],_0x153819[_0x12fa('0x4e')]);_0x2ca612[_0x12fa('0x50')]=_[_0x12fa('0x51')](_0x153819[_0x12fa('0x4d')],qs['fields'](_0x5bf5e8[_0x12fa('0x4e')][_0x12fa('0x52')]));_0x2ca612[_0x12fa('0x50')]=_0x2ca612[_0x12fa('0x50')][_0x12fa('0x53')]?_0x2ca612['attributes']:_0x153819[_0x12fa('0x4d')];if(!_0x5bf5e8[_0x12fa('0x4e')][_0x12fa('0x6b')]('nolimit')){_0x2ca612[_0x12fa('0x23')]=qs['limit'](_0x5bf5e8['query'][_0x12fa('0x23')]);_0x2ca612[_0x12fa('0x22')]=qs[_0x12fa('0x22')](_0x5bf5e8[_0x12fa('0x4e')]['offset']);}_0x2ca612[_0x12fa('0x54')]=qs['sort'](_0x5bf5e8[_0x12fa('0x4e')]['sort']);_0x2ca612[_0x12fa('0x56')]=qs['filters'](_[_0x12fa('0x57')](_0x5bf5e8[_0x12fa('0x4e')],_0x153819[_0x12fa('0x4f')]));_0x2ca612[_0x12fa('0x56')][_0x12fa('0x67')]=_0x2d475c['id'];if(_0x5bf5e8[_0x12fa('0x4e')][_0x12fa('0x58')]){_0x2ca612[_0x12fa('0x56')]=_[_0x12fa('0x59')](_0x2ca612['where'],{'$or':_[_0x12fa('0x48')](_0x2ca612[_0x12fa('0x50')],function(_0x1082b4){var _0x2cbaeb={};_0x2cbaeb[_0x1082b4]={'$like':'%'+_0x5bf5e8['query'][_0x12fa('0x58')]+'%'};return _0x2cbaeb;})});}_0x2ca612=_[_0x12fa('0x59')]({},_0x2ca612,_0x5bf5e8[_0x12fa('0x5a')]);return db['MailInteraction']['count']({'where':_0x2ca612[_0x12fa('0x56')]})[_0x12fa('0x13')](function(_0x1a6118){_0x18f277[_0x12fa('0x21')]=_0x1a6118;if(_0x5bf5e8[_0x12fa('0x4e')]['includeAll']){_0x2ca612[_0x12fa('0x5c')]=[{'model':db[_0x12fa('0x88')],'as':_0x12fa('0x89'),'required':![]},{'model':db[_0x12fa('0x8a')],'as':_0x12fa('0x8b'),'attributes':[_0x12fa('0x29'),_0x12fa('0x8c'),_0x12fa('0x8d')],'required':![]},{'model':db['Tag'],'as':_0x12fa('0x8e'),'attributes':['id',_0x12fa('0x29'),_0x12fa('0x8f')],'where':_0x5bf5e8[_0x12fa('0x4e')]['tag']?{'id':_0x5bf5e8['query']['tag']}:undefined,'required':_0x5bf5e8[_0x12fa('0x4e')][_0x12fa('0x90')]?!![]:![]}];}return db['MailInteraction'][_0x12fa('0x6d')](_0x2ca612);})['then'](function(_0x4538aa){_0x18f277[_0x12fa('0x5d')]=_0x4538aa;return _0x18f277;});}})['then'](respondWithFilteredResult(_0x50d92b,_0x2ca612))[_0x12fa('0x1b')](handleError(_0x50d92b,null));};exports[_0x12fa('0x91')]=function addApplications(_0x53e46e,_0xb4a55c){var _0x5de13a=_0x53e46e['params']['id'];var _0x3dfd4e=_0x53e46e[_0x12fa('0x61')];var _0x5e029c=0xc8;var _0x56eb25=null;return db[_0x12fa('0x92')][_0x12fa('0x93')]({'isolationLevel':db['sequelize'][_0x12fa('0x94')][_0x12fa('0x95')]['READ_COMMITTED']},function(_0x3d3cd4){return db[_0x12fa('0x49')][_0x12fa('0x6a')]({'where':{'id':_0x5de13a},'transaction':_0x3d3cd4})[_0x12fa('0x13')](function(_0x188ca0){if(_0x188ca0){return db[_0x12fa('0x96')][_0x12fa('0x27')]({'where':{'MailAccountId':_0x5de13a},'transaction':_0x3d3cd4})[_0x12fa('0x13')](function(){var _0x20670a=_[_0x12fa('0x48')](_0x3dfd4e,function(_0x23d31){_0x23d31['MailAccountId']=_0x5de13a;return _0x23d31;});return db[_0x12fa('0x96')][_0x12fa('0x97')](_0x20670a,{'transaction':_0x3d3cd4});});}else{_0x5e029c=0x194;_0x56eb25=[];}});})[_0x12fa('0x13')](function(){if(_0x5e029c!==0x194){return db[_0x12fa('0x96')][_0x12fa('0x98')]({'where':{'MailAccountId':_0x5de13a},'order':_0x12fa('0x99')})[_0x12fa('0x13')](function(_0xc531ce){_0x56eb25=_0xc531ce;});}})['catch'](function(_0x1ac380){_0x5e029c=0x1f4;logger[_0x12fa('0x17')](_0x1ac380[_0x12fa('0x9a')]);if(_0x1ac380[_0x12fa('0x29')]){delete _0x1ac380[_0x12fa('0x29')];}_0x56eb25=_0x1ac380;})['finally'](function(){if(_0x56eb25===null){_0xb4a55c['sendStatus'](_0x5e029c);}else{if(_0x5e029c===0x1f4){_0xb4a55c['status'](_0x5e029c)[_0x12fa('0x2a')](_0x56eb25);}else{_0xb4a55c[_0x12fa('0x1d')](_0x5e029c)[_0x12fa('0x1f')](_0x56eb25);}}});};exports[_0x12fa('0x9b')]=function(_0x47058b,_0x2387ff){var _0x533de7={};var _0x5855c4={};var _0x540db3;var _0x48b86e;return db[_0x12fa('0x49')]['findOne']({'where':{'id':_0x47058b[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x2387ff,null))[_0x12fa('0x13')](function(_0x152c5c){if(_0x152c5c){_0x540db3=_0x152c5c;_0x5855c4[_0x12fa('0x4d')]=_[_0x12fa('0x5f')](db[_0x12fa('0x96')][_0x12fa('0x60')]);_0x5855c4[_0x12fa('0x4e')]=_['keys'](_0x47058b[_0x12fa('0x4e')]);_0x5855c4[_0x12fa('0x4f')]=_[_0x12fa('0x51')](_0x5855c4[_0x12fa('0x4d')],_0x5855c4[_0x12fa('0x4e')]);_0x533de7[_0x12fa('0x50')]=_[_0x12fa('0x51')](_0x5855c4['model'],qs[_0x12fa('0x52')](_0x47058b['query']['fields']));_0x533de7[_0x12fa('0x50')]=_0x533de7[_0x12fa('0x50')][_0x12fa('0x53')]?_0x533de7['attributes']:_0x5855c4['model'];_0x533de7[_0x12fa('0x54')]=qs[_0x12fa('0x55')](_0x47058b[_0x12fa('0x4e')][_0x12fa('0x55')]);_0x533de7[_0x12fa('0x56')]=qs[_0x12fa('0x4f')](_['pick'](_0x47058b[_0x12fa('0x4e')],_0x5855c4['filters']));if(_0x47058b[_0x12fa('0x4e')][_0x12fa('0x58')]){_0x533de7['where']=_[_0x12fa('0x59')](_0x533de7[_0x12fa('0x56')],{'$or':_[_0x12fa('0x48')](_0x533de7[_0x12fa('0x50')],function(_0x2c6b3c){var _0x1b2dd3={};_0x1b2dd3[_0x2c6b3c]={'$like':'%'+_0x47058b[_0x12fa('0x4e')][_0x12fa('0x58')]+'%'};return _0x1b2dd3;})});}_0x533de7=_[_0x12fa('0x59')]({},_0x533de7,_0x47058b[_0x12fa('0x5a')]);return _0x540db3['getApplications'](_0x533de7);}})[_0x12fa('0x13')](function(_0x578667){if(_0x578667){_0x48b86e=_0x578667[_0x12fa('0x53')];if(!_0x47058b['query'][_0x12fa('0x6b')]('nolimit')){_0x533de7[_0x12fa('0x23')]=qs['limit'](_0x47058b[_0x12fa('0x4e')]['limit']);_0x533de7[_0x12fa('0x22')]=qs[_0x12fa('0x22')](_0x47058b[_0x12fa('0x4e')][_0x12fa('0x22')]);}return _0x540db3['getApplications'](_0x533de7);}})[_0x12fa('0x13')](function(_0x5e12f1){if(_0x5e12f1){return _0x5e12f1?{'count':_0x48b86e,'rows':_0x5e12f1}:null;}})[_0x12fa('0x13')](respondWithResult(_0x2387ff,null))[_0x12fa('0x1b')](handleError(_0x2387ff,null));};exports[_0x12fa('0x9c')]=function(_0x3ee2d9,_0x26fed8){var _0x1c61db={'raw':!![],'where':{}};var _0x862366={};var _0x53dd91={'count':0x0,'rows':[]};return db[_0x12fa('0x49')][_0x12fa('0x6a')]({'where':{'id':_0x3ee2d9[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x26fed8,null))['then'](function(_0x2f8387){if(_0x2f8387){_0x862366[_0x12fa('0x4d')]=_[_0x12fa('0x5f')](db[_0x12fa('0x9d')][_0x12fa('0x60')]);_0x862366[_0x12fa('0x4e')]=_['keys'](_0x3ee2d9[_0x12fa('0x4e')]);_0x862366[_0x12fa('0x4f')]=_[_0x12fa('0x51')](_0x862366[_0x12fa('0x4d')],_0x862366['query']);_0x1c61db['attributes']=_['intersection'](_0x862366[_0x12fa('0x4d')],qs[_0x12fa('0x52')](_0x3ee2d9['query']['fields']));_0x1c61db[_0x12fa('0x50')]=_0x1c61db[_0x12fa('0x50')]['length']?_0x1c61db[_0x12fa('0x50')]:_0x862366[_0x12fa('0x4d')];if(!_0x3ee2d9[_0x12fa('0x4e')][_0x12fa('0x6b')](_0x12fa('0x6c'))){_0x1c61db[_0x12fa('0x23')]=qs['limit'](_0x3ee2d9[_0x12fa('0x4e')][_0x12fa('0x23')]);_0x1c61db[_0x12fa('0x22')]=qs[_0x12fa('0x22')](_0x3ee2d9[_0x12fa('0x4e')]['offset']);}_0x1c61db[_0x12fa('0x54')]=qs[_0x12fa('0x55')](_0x3ee2d9[_0x12fa('0x4e')][_0x12fa('0x55')]);_0x1c61db['where']=qs['filters'](_[_0x12fa('0x57')](_0x3ee2d9[_0x12fa('0x4e')],_0x862366[_0x12fa('0x4f')]));_0x1c61db[_0x12fa('0x56')][_0x12fa('0x67')]=_0x2f8387['id'];if(_0x3ee2d9[_0x12fa('0x4e')][_0x12fa('0x58')]){_0x1c61db[_0x12fa('0x56')]=_[_0x12fa('0x59')](_0x1c61db['where'],{'$or':_[_0x12fa('0x48')](_0x1c61db[_0x12fa('0x50')],function(_0x1c185b){var _0x383d16={};_0x383d16[_0x1c185b]={'$like':'%'+_0x3ee2d9[_0x12fa('0x4e')][_0x12fa('0x58')]+'%'};return _0x383d16;})});}if(_0x3ee2d9[_0x12fa('0x4e')][_0x12fa('0x9e')]){var _0x20316e=_0x3ee2d9[_0x12fa('0x4e')]['$gte'][_0x12fa('0x9f')](',');var _0x3a319f={};_0x3a319f[_0x20316e[0x0]]={'$gte':moment(_0x20316e[0x1])[_0x12fa('0xa0')](_0x12fa('0xa1'))};_0x1c61db[_0x12fa('0x56')]=_['merge'](_0x1c61db['where'],_0x3a319f);}_0x1c61db=_['merge']({},_0x1c61db,_0x3ee2d9[_0x12fa('0x5a')]);return db['MailMessage'][_0x12fa('0x21')]({'where':_0x1c61db['where']})[_0x12fa('0x13')](function(_0x43ee61){_0x53dd91[_0x12fa('0x21')]=_0x43ee61;if(_0x3ee2d9[_0x12fa('0x4e')]['includeAll']){_0x1c61db['include']=[{'all':!![]}];}return db['MailMessage'][_0x12fa('0x6d')](_0x1c61db);})[_0x12fa('0x13')](function(_0x1717e9){if(_0x3ee2d9[_0x12fa('0x4e')][_0x12fa('0xa2')]===_0x12fa('0xa3')){for(var _0x1d8755=0x0;_0x1d8755<_0x1717e9['length'];_0x1d8755++){_0x1717e9[_0x1d8755]['body']=juice(_0x1717e9[_0x1d8755][_0x12fa('0x61')]);}}_0x53dd91[_0x12fa('0x5d')]=_0x1717e9;return _0x53dd91;});}})[_0x12fa('0x13')](respondWithFilteredResult(_0x26fed8,_0x1c61db))[_0x12fa('0x1b')](handleError(_0x26fed8,null));};exports[_0x12fa('0x2a')]=function(_0x417239,_0x2d9343){var _0x4383cb,_0x8e9aac={},_0x63d0a9;if(_0x417239['body']['to']){_0x63d0a9=_0x417239[_0x12fa('0x61')]['to'][_0x12fa('0x9f')](',')[0x0];}return db[_0x12fa('0x49')]['find']({'where':{'id':_0x417239[_0x12fa('0x5e')]['id']},'include':[{'model':db[_0x12fa('0xa4')],'as':_0x12fa('0xa5'),'include':[{'model':db[_0x12fa('0x88')],'as':_0x12fa('0xa6'),'where':{'email':_0x63d0a9},'limit':0x1,'order':[[_0x12fa('0xa7'),_0x12fa('0xa8')]]}]},{'model':db[_0x12fa('0x45')],'as':_0x12fa('0x42'),'raw':!![],'include':[{'model':db[_0x12fa('0xa9')],'as':_0x12fa('0xa9'),'raw':!![]}]}]})[_0x12fa('0x13')](handleEntityNotFound(_0x2d9343,null))['then'](function(_0x23d9fb){if(!_0x23d9fb)return;_0x4383cb=_0x23d9fb;if(!_0x23d9fb[_0x12fa('0x42')])throw new Error(_0x12fa('0xaa'));if(_[_0x12fa('0x74')](_0x417239['body'][_0x12fa('0xab')])){_0x417239[_0x12fa('0x61')][_0x12fa('0xab')]=util[_0x12fa('0xa0')](_0x12fa('0xac'),_0x23d9fb[_0x12fa('0x29')],_0x23d9fb[_0x12fa('0xad')]||_0x23d9fb[_0x12fa('0x42')][_0x12fa('0x37')]);}if(_0x417239['body'][_0x12fa('0xae')]&&_0x417239[_0x12fa('0x61')]['attachments']['length']){for(var _0x440461=0x0;_0x440461<_0x417239[_0x12fa('0x61')][_0x12fa('0xae')][_0x12fa('0x53')];_0x440461+=0x1){_0x417239[_0x12fa('0x61')]['attachments'][_0x440461]={'filename':_0x417239[_0x12fa('0x61')][_0x12fa('0xae')][_0x440461][_0x12fa('0x29')],'path':path[_0x12fa('0xaf')](config[_0x12fa('0xb0')],_0x12fa('0xb1'),_0x417239['body'][_0x12fa('0xae')][_0x440461][_0x12fa('0xb2')])};}}var _0x23e776=_0x23d9fb['getSmtpOptions']();return respondWithRpcPromise(_0x12fa('0xb3'),_0x12fa('0xb4'),{'account':_0x23e776,'message':_0x417239[_0x12fa('0x61')]});})[_0x12fa('0x13')](function(_0x1c9b2c){if(!_0x1c9b2c)return;_0x8e9aac=_0x1c9b2c;if(!_0x4383cb[_0x12fa('0xa5')])throw new Error(_0x12fa('0xb5'));if(_0x4383cb['List'][_0x12fa('0xa6')][_0x12fa('0x53')])return _0x4383cb[_0x12fa('0xa5')][_0x12fa('0xa6')][0x0];return db[_0x12fa('0x88')][_0x12fa('0x77')](_[_0x12fa('0xb')](_0x417239['body'],{'firstName':_0x417239[_0x12fa('0x61')]['to'],'email':_0x417239[_0x12fa('0x61')]['to'],'phone':_0x417239[_0x12fa('0x61')]['to'],'ListId':_0x4383cb[_0x12fa('0x73')]}));})['then'](function(_0x9522e7){if(!_0x9522e7)return;var _0x6b9e9={'UserId':_0x417239[_0x12fa('0x37')]['id'],'ContactId':_0x9522e7['id'],'MailAccountId':_0x4383cb['id'],'inReplyTo':_0x8e9aac[_0x12fa('0xb6')],'to':_0x417239[_0x12fa('0x61')]['from'],'cc':_0x417239['body']['cc'],'subject':_0x417239[_0x12fa('0x61')]['subject'],'attach':_0x417239['body']['attach'],'firstMsgDirection':'out','lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x12fa('0xb7'),'Messages':[_[_0x12fa('0x59')](_0x417239[_0x12fa('0x61')],{'messageId':_0x8e9aac['messageId'],'sentAt':moment()[_0x12fa('0xa0')](_0x12fa('0xa1')),'read':!![],'MailAccountId':_0x4383cb['id'],'UserId':_0x417239['user']['id'],'ContactId':_0x9522e7['id']})]};if(_0x417239['body'][_0x12fa('0xb8')]){_0x6b9e9=_['merge'](_0x6b9e9,_0x417239[_0x12fa('0x61')][_0x12fa('0xb8')]);}return db[_0x12fa('0x85')][_0x12fa('0x77')](_0x6b9e9,{'include':[{'model':db[_0x12fa('0x9d')],'as':'Messages'}]});})[_0x12fa('0x13')](respondWithResult(_0x2d9343,null))[_0x12fa('0x1b')](handleError(_0x2d9343,null));};exports[_0x12fa('0xb9')]=function(_0x1a8e65,_0x5a8c2c){return db[_0x12fa('0x49')][_0x12fa('0x63')]({'where':{'id':_0x1a8e65['params']['id']},'include':[{'model':db[_0x12fa('0x45')],'as':_0x12fa('0x42'),'raw':!![],'include':[{'model':db[_0x12fa('0xa9')],'as':_0x12fa('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5a8c2c,null))[_0x12fa('0x13')](function(_0xcc2dee){if(!_0xcc2dee[_0x12fa('0x42')])return;var _0x84da29=_0xcc2dee[_0x12fa('0xba')]();return respondWithRpcPromise(_0x12fa('0xbb'),_0x12fa('0xb9'),{'account':_0x84da29});})[_0x12fa('0x13')](respondWithResult(_0x5a8c2c,null))[_0x12fa('0x1b')](handleError(_0x5a8c2c,null));};exports[_0x12fa('0x27')]=function(_0xf82fa5,_0xdcacac){return db[_0x12fa('0x49')][_0x12fa('0x63')]({'where':{'id':_0xf82fa5[_0x12fa('0x5e')]['id']}})['then'](handleEntityNotFound(_0xdcacac,null))['then'](function(_0x4fdf69){if(_0x4fdf69&&_0x4fdf69['service']){throw new db[(_0x12fa('0xbc'))][(_0x12fa('0xbd'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x4fdf69;})[_0x12fa('0x13')](removeEntity(_0xdcacac,null))['catch'](handleError(_0xdcacac,null));};exports[_0x12fa('0xbe')]=function(_0x768bd9,_0x461259){return db['MailAccount']['find']({'where':{'id':_0x768bd9[_0x12fa('0x5e')]['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x461259,null))['then'](function(_0xb88d7){if(_0xb88d7){return _0xb88d7[_0x12fa('0xbe')](_0x768bd9[_0x12fa('0x61')]['ids'],_['omit'](_0x768bd9[_0x12fa('0x61')],[_0x12fa('0x6f'),'id'])||{})['spread'](function(_0x3d68da){for(var _0x33d9be=0x0;_0x33d9be<_0x768bd9['body'][_0x12fa('0x6f')]['length'];_0x33d9be+=0x1){socket[_0x12fa('0xbf')](_0x12fa('0xc0'),{'UserId':Number(_0x768bd9[_0x12fa('0x61')][_0x12fa('0x6f')][_0x33d9be]),'MailAccountId':Number(_0x768bd9['params']['id'])});}return _0x3d68da;});}})[_0x12fa('0x13')](respondWithResult(_0x461259,null))[_0x12fa('0x1b')](handleError(_0x461259,null));};exports[_0x12fa('0xc1')]=function(_0x28de42,_0xc4f060){return db[_0x12fa('0x49')][_0x12fa('0x63')]({'where':{'id':_0x28de42[_0x12fa('0x5e')]['id']}})['then'](handleEntityNotFound(_0xc4f060,null))['then'](function(_0x10f943){if(_0x10f943){return _0x10f943[_0x12fa('0xc1')](_0x28de42[_0x12fa('0x4e')][_0x12fa('0x6f')])[_0x12fa('0x13')](function(){if(_[_0x12fa('0xc2')](_0x28de42['query']['ids'])){for(var _0x40f690=0x0;_0x40f690<_0x28de42[_0x12fa('0x4e')]['ids']['length'];_0x40f690+=0x1){socket[_0x12fa('0xbf')](_0x12fa('0xc3'),{'UserId':Number(_0x28de42['query'][_0x12fa('0x6f')][_0x40f690]),'MailAccountId':Number(_0x28de42[_0x12fa('0x5e')]['id'])});}}else{socket['emit'](_0x12fa('0xc3'),{'UserId':Number(_0x28de42[_0x12fa('0x4e')]['ids']),'MailAccountId':Number(_0x28de42['params']['id'])});}});}})[_0x12fa('0x13')](respondWithStatusCode(_0xc4f060,null))[_0x12fa('0x1b')](handleError(_0xc4f060,null));};exports[_0x12fa('0xc4')]=function(_0x508089,_0x1066ae){var _0x1bf3c4={};var _0x3115a8={};var _0x72dd3f;var _0x598810;return db[_0x12fa('0x49')][_0x12fa('0x6a')]({'where':{'id':_0x508089['params']['id']}})[_0x12fa('0x13')](handleEntityNotFound(_0x1066ae,null))[_0x12fa('0x13')](function(_0x43fe70){if(_0x43fe70){_0x72dd3f=_0x43fe70;_0x3115a8['model']=_['keys'](db[_0x12fa('0x8a')][_0x12fa('0x60')]);_0x3115a8['query']=_[_0x12fa('0x5f')](_0x508089['query']);_0x3115a8[_0x12fa('0x4f')]=_[_0x12fa('0x51')](_0x3115a8[_0x12fa('0x4d')],_0x3115a8[_0x12fa('0x4e')]);_0x1bf3c4['attributes']=_[_0x12fa('0x51')](_0x3115a8[_0x12fa('0x4d')],qs[_0x12fa('0x52')](_0x508089[_0x12fa('0x4e')][_0x12fa('0x52')]));_0x1bf3c4['attributes']=_0x1bf3c4[_0x12fa('0x50')][_0x12fa('0x53')]?_0x1bf3c4['attributes']:_0x3115a8['model'];_0x1bf3c4[_0x12fa('0x54')]=qs[_0x12fa('0x55')](_0x508089['query'][_0x12fa('0x55')]);_0x1bf3c4[_0x12fa('0x56')]=qs[_0x12fa('0x4f')](_[_0x12fa('0x57')](_0x508089['query'],_0x3115a8[_0x12fa('0x4f')]));if(_0x508089[_0x12fa('0x4e')]['filter']){_0x1bf3c4[_0x12fa('0x56')]=_['merge'](_0x1bf3c4[_0x12fa('0x56')],{'$or':_[_0x12fa('0x48')](_0x1bf3c4[_0x12fa('0x50')],function(_0x4c8672){var _0x1cccfa={};_0x1cccfa[_0x4c8672]={'$like':'%'+_0x508089['query']['filter']+'%'};return _0x1cccfa;})});}_0x1bf3c4=_[_0x12fa('0x59')]({},_0x1bf3c4,_0x508089[_0x12fa('0x5a')]);return _0x72dd3f[_0x12fa('0xc4')](_0x1bf3c4);}})[_0x12fa('0x13')](function(_0x5573d1){if(_0x5573d1){_0x598810=_0x5573d1[_0x12fa('0x53')];if(!_0x508089['query'][_0x12fa('0x6b')]('nolimit')){_0x1bf3c4[_0x12fa('0x23')]=qs[_0x12fa('0x23')](_0x508089[_0x12fa('0x4e')][_0x12fa('0x23')]);_0x1bf3c4['offset']=qs[_0x12fa('0x22')](_0x508089[_0x12fa('0x4e')][_0x12fa('0x22')]);}return _0x72dd3f[_0x12fa('0xc4')](_0x1bf3c4);}})[_0x12fa('0x13')](function(_0x948b3b){if(_0x948b3b){return _0x948b3b?{'count':_0x598810,'rows':_0x948b3b}:null;}})[_0x12fa('0x13')](respondWithResult(_0x1066ae,null))[_0x12fa('0x1b')](handleError(_0x1066ae,null));}; \ No newline at end of file +var _0x3ab8=['keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','MailServerOut','length','find','body','custom','provider','describe','catch','MailAccountId','Disposition','create','findOne','removeDispositions','ids','CannedAnswer','removeAnswers','isNil','active','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','format','%s\x20<%s>','email','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','from','subject','attach','out','Interaction','verifySmtp','ValidationError','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','juice','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailAccount.socket','jayson/promise','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','MailAccounts','sendStatus','stack','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model'];(function(_0x1100aa,_0x307708){var _0x136b85=function(_0x5761cf){while(--_0x5761cf){_0x1100aa['push'](_0x1100aa['shift']());}};_0x136b85(++_0x307708);}(_0x3ab8,0x71));var _0x83ab=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x3ab8[_0x1b2ff7];return _0x31656a;};'use strict';var moment=require(_0x83ab('0x0'));var BPromise=require(_0x83ab('0x1'));var util=require('util');var path=require(_0x83ab('0x2'));var _=require('lodash');var juice=require(_0x83ab('0x3'));var Redis=require(_0x83ab('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x83ab('0x5'))(_0x83ab('0x6'));var config=require(_0x83ab('0x7'));var db=require('../../mysqldb')['db'];config[_0x83ab('0x8')]=_[_0x83ab('0x9')](config['redis'],{'host':_0x83ab('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x83ab('0x8')]));require(_0x83ab('0xb'))['register'](socket);var jayson=require(_0x83ab('0xc'));var client=jayson['client'][_0x83ab('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x2c054d,_0x5b3808,_0x5f1784,_0x334b57){return new BPromise(function(_0x35c935,_0x49c276){var _0x5a3434=_0x334b57||client;return _0x5a3434[_0x83ab('0xe')](_0x2c054d,_0x5f1784)[_0x83ab('0xf')](function(_0x115c55){logger['info'](_0x83ab('0x10'),_0x5b3808,_0x83ab('0x11'));logger[_0x83ab('0x12')](_0x83ab('0x13'),_0x5b3808,'request\x20sent',JSON[_0x83ab('0x14')](_0x115c55));if(_0x115c55[_0x83ab('0x15')]){if(_0x115c55[_0x83ab('0x15')][_0x83ab('0x16')]===0x1f4){logger[_0x83ab('0x15')](_0x83ab('0x10'),_0x5b3808,_0x115c55['error'][_0x83ab('0x17')]);return _0x49c276(_0x115c55[_0x83ab('0x15')][_0x83ab('0x17')]);}logger[_0x83ab('0x15')](_0x83ab('0x10'),_0x5b3808,_0x115c55[_0x83ab('0x15')]['message']);return _0x35c935(_0x115c55['error']['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x5b3808,'request\x20sent');_0x35c935(_0x115c55[_0x83ab('0x18')][_0x83ab('0x17')]);}})['catch'](function(_0x3dc5a1){logger[_0x83ab('0x15')](_0x83ab('0x10'),_0x5b3808,_0x3dc5a1);_0x49c276(_0x3dc5a1);});});}function respondWithStatusCode(_0x227dd3,_0x1e2c73){_0x1e2c73=_0x1e2c73||0xcc;return function(_0x5c6ab1){if(_0x5c6ab1){return _0x227dd3['sendStatus'](_0x1e2c73);}return _0x227dd3[_0x83ab('0x19')](_0x1e2c73)[_0x83ab('0x1a')]();};}function respondWithResult(_0x2a2d0c,_0x2f46fa){_0x2f46fa=_0x2f46fa||0xc8;return function(_0x830027){if(_0x830027){return _0x2a2d0c[_0x83ab('0x19')](_0x2f46fa)[_0x83ab('0x1b')](_0x830027);}};}function respondWithFilteredResult(_0x33f45b,_0x4ed787){return function(_0x2fe90c){if(_0x2fe90c){var _0x162375=typeof _0x4ed787[_0x83ab('0x1c')]==='undefined'&&typeof _0x4ed787['limit']===_0x83ab('0x1d');var _0x47360e=_0x2fe90c['count'];var _0x7bdf95=_0x162375?0x0:_0x4ed787[_0x83ab('0x1c')];var _0x5207d5=_0x162375?_0x2fe90c[_0x83ab('0x1e')]:_0x4ed787[_0x83ab('0x1c')]+_0x4ed787[_0x83ab('0x1f')];var _0x3fcb6e;if(_0x5207d5>=_0x47360e){_0x5207d5=_0x47360e;_0x3fcb6e=0xc8;}else{_0x3fcb6e=0xce;}_0x33f45b[_0x83ab('0x19')](_0x3fcb6e);return _0x33f45b[_0x83ab('0x20')](_0x83ab('0x21'),_0x7bdf95+'-'+_0x5207d5+'/'+_0x47360e)[_0x83ab('0x1b')](_0x2fe90c);}return null;};}function saveUpdates(_0x205743){return function(_0x5caa76){if(_0x5caa76){return _0x5caa76[_0x83ab('0x22')](_0x205743)['then'](function(_0x103a7e){return _0x103a7e;});}return null;};}function removeEntity(_0x4b7f35){return function(_0x33a039){if(_0x33a039){return _0x33a039[_0x83ab('0x23')]()[_0x83ab('0xf')](function(){var _0x2599cc=_0x33a039[_0x83ab('0x24')]({'plain':!![]});var _0x384084=_0x83ab('0x25');return db['UserProfileResource'][_0x83ab('0x23')]({'where':{'type':_0x384084,'resourceId':_0x2599cc['id']}})['then'](function(){return _0x33a039;});})[_0x83ab('0xf')](function(){_0x4b7f35['status'](0xcc)[_0x83ab('0x1a')]();});}};}function handleEntityNotFound(_0x7ada8c){return function(_0x5e00a4){if(!_0x5e00a4){_0x7ada8c[_0x83ab('0x26')](0x194);}return _0x5e00a4;};}function handleError(_0x1bdbd7,_0x1028c2){_0x1028c2=_0x1028c2||0x1f4;return function(_0x385a3d){logger['error'](_0x385a3d[_0x83ab('0x27')]);if(_0x385a3d[_0x83ab('0x28')]){delete _0x385a3d['name'];}_0x1bdbd7[_0x83ab('0x19')](_0x1028c2)[_0x83ab('0x29')](_0x385a3d);};}function getImapHost(_0x290676){switch(_0x290676){case _0x83ab('0x2a'):return _0x83ab('0x2b');case'yahoo':return _0x83ab('0x2c');case _0x83ab('0x2d'):return'imap-mail.outlook.com';case _0x83ab('0x2e'):return'outlook.office365.com';}throw new Error(_0x83ab('0x2f'),_0x290676);}function getSmtpHost(_0x1261c7){switch(_0x1261c7){case _0x83ab('0x2a'):return _0x83ab('0x30');case _0x83ab('0x31'):return _0x83ab('0x32');case'hotmail':return _0x83ab('0x33');case'outlook365':return _0x83ab('0x34');}throw new Error(_0x83ab('0x2f'),_0x1261c7);}function getAuthenticationOptions(_0x367fcc,_0x69f41a){var _0x3ab0b1={};var _0x2e3006={};if(_0x367fcc){_0x3ab0b1['user']=_0x2e3006[_0x83ab('0x35')]=_0x69f41a[_0x83ab('0x36')];_0x3ab0b1[_0x83ab('0x37')]=_0x2e3006[_0x83ab('0x38')]=_0x69f41a['password'];if(_0x69f41a['modernAuthentication']){_0x3ab0b1[_0x83ab('0x39')]=_0x2e3006[_0x83ab('0x39')]=!![];_0x3ab0b1[_0x83ab('0x3a')]=_0x2e3006[_0x83ab('0x3a')]=_0x69f41a[_0x83ab('0x3a')];_0x3ab0b1['password']=_0x2e3006[_0x83ab('0x38')]=null;}else{_0x3ab0b1[_0x83ab('0x3a')]=_0x2e3006['CloudProviderId']=null;}_0x3ab0b1[_0x83ab('0x3b')]=getImapHost(_0x367fcc);_0x3ab0b1[_0x83ab('0x3c')]=0x3e1;_0x2e3006[_0x83ab('0x3b')]=getSmtpHost(_0x367fcc);_0x2e3006[_0x83ab('0x3c')]=0x24b;_0x2e3006[_0x83ab('0x3d')]=![];_0x3ab0b1['service']=_0x2e3006[_0x83ab('0x3e')]=null;}else{if(_0x69f41a[_0x83ab('0x3f')]){_0x3ab0b1[_0x83ab('0x35')]=_0x2e3006[_0x83ab('0x35')]=_0x69f41a[_0x83ab('0x36')];_0x3ab0b1[_0x83ab('0x37')]=_0x2e3006[_0x83ab('0x38')]=_0x69f41a[_0x83ab('0x37')];}else{_0x3ab0b1[_0x83ab('0x3f')]=_0x2e3006['authentication']=![];_0x3ab0b1[_0x83ab('0x35')]=_0x2e3006[_0x83ab('0x35')]=null;_0x3ab0b1[_0x83ab('0x37')]=_0x2e3006['pass']=null;}_0x3ab0b1[_0x83ab('0x3b')]=_0x69f41a[_0x83ab('0x40')][_0x83ab('0x3b')];_0x3ab0b1['port']=_0x69f41a['Imap']['port'];_0x2e3006[_0x83ab('0x3b')]=_0x69f41a[_0x83ab('0x41')][_0x83ab('0x3b')];_0x2e3006['port']=_0x69f41a[_0x83ab('0x41')][_0x83ab('0x3c')];}return{'Imap':_0x3ab0b1,'Smtp':_0x2e3006};}exports[_0x83ab('0x42')]=function(_0x280fd9,_0xf103a4){var _0x20978f={'include':[{'model':db[_0x83ab('0x43')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x83ab('0x44')],'as':_0x83ab('0x45')}]},_0x1c2534={},_0x34b93c={'count':0x0,'rows':[]};var _0x5da8d9=_[_0x83ab('0x46')](db[_0x83ab('0x47')][_0x83ab('0x48')],function(_0x5215c8){return{'name':_0x5215c8[_0x83ab('0x49')],'type':_0x5215c8['type'][_0x83ab('0x4a')]};});_0x1c2534[_0x83ab('0x4b')]=_[_0x83ab('0x46')](_0x5da8d9,_0x83ab('0x28'));_0x1c2534['query']=_[_0x83ab('0x4c')](_0x280fd9['query']);_0x1c2534[_0x83ab('0x4d')]=_[_0x83ab('0x4e')](_0x1c2534[_0x83ab('0x4b')],_0x1c2534[_0x83ab('0x4f')]);_0x20978f[_0x83ab('0x50')]=_[_0x83ab('0x4e')](_0x1c2534[_0x83ab('0x4b')],qs[_0x83ab('0x51')](_0x280fd9[_0x83ab('0x4f')][_0x83ab('0x51')]));_0x20978f['attributes']=_0x20978f[_0x83ab('0x50')]['length']?_0x20978f['attributes']:_0x1c2534[_0x83ab('0x4b')];if(!_0x280fd9[_0x83ab('0x4f')][_0x83ab('0x52')](_0x83ab('0x53'))){_0x20978f['limit']=qs[_0x83ab('0x1f')](_0x280fd9[_0x83ab('0x4f')]['limit']);_0x20978f[_0x83ab('0x1c')]=qs['offset'](_0x280fd9['query'][_0x83ab('0x1c')]);}_0x20978f[_0x83ab('0x54')]=qs[_0x83ab('0x55')](_0x280fd9[_0x83ab('0x4f')]['sort']);_0x20978f[_0x83ab('0x56')]=qs[_0x83ab('0x4d')](_[_0x83ab('0x57')](_0x280fd9['query'],_0x1c2534[_0x83ab('0x4d')]),_0x5da8d9);if(_0x280fd9['query'][_0x83ab('0x58')]){_0x20978f[_0x83ab('0x56')]=_[_0x83ab('0x59')](_0x20978f[_0x83ab('0x56')],{'$or':_[_0x83ab('0x46')](_0x5da8d9,function(_0x58e3de){if(_0x58e3de[_0x83ab('0x5a')]!==_0x83ab('0x5b')){var _0x5b692c={};_0x5b692c[_0x58e3de[_0x83ab('0x28')]]={'$like':'%'+_0x280fd9[_0x83ab('0x4f')]['filter']+'%'};return _0x5b692c;}})});}_0x20978f=_['merge']({},_0x20978f,_0x280fd9[_0x83ab('0x5c')]);var _0x3cc167={'where':_0x20978f[_0x83ab('0x56')]};return db[_0x83ab('0x47')][_0x83ab('0x1e')](_0x3cc167)[_0x83ab('0xf')](function(_0x20bac4){_0x34b93c[_0x83ab('0x1e')]=_0x20bac4;if(_0x280fd9[_0x83ab('0x4f')][_0x83ab('0x5d')]){_0x20978f[_0x83ab('0x5e')]=[{'all':!![]}];}return db[_0x83ab('0x47')][_0x83ab('0x5f')](_0x20978f);})[_0x83ab('0xf')](function(_0x56d054){_0x34b93c[_0x83ab('0x60')]=_0x56d054;return _0x34b93c;})[_0x83ab('0xf')](respondWithFilteredResult(_0xf103a4,_0x20978f))['catch'](handleError(_0xf103a4,null));};exports[_0x83ab('0x61')]=function(_0x2f8de6,_0x3e28a5){var _0x2a572d={'raw':![],'where':{'id':_0x2f8de6[_0x83ab('0x62')]['id']},'include':[{'model':db[_0x83ab('0x43')],'as':_0x83ab('0x40')},{'model':db[_0x83ab('0x63')],'as':_0x83ab('0x41')},{'model':db[_0x83ab('0x44')],'as':_0x83ab('0x45')}]},_0x448a1c={};_0x448a1c[_0x83ab('0x4b')]=_[_0x83ab('0x4c')](db['MailAccount'][_0x83ab('0x48')]);_0x448a1c[_0x83ab('0x4f')]=_['keys'](_0x2f8de6[_0x83ab('0x4f')]);_0x448a1c[_0x83ab('0x4d')]=_[_0x83ab('0x4e')](_0x448a1c['model'],_0x448a1c['query']);_0x2a572d[_0x83ab('0x50')]=_[_0x83ab('0x4e')](_0x448a1c[_0x83ab('0x4b')],qs[_0x83ab('0x51')](_0x2f8de6[_0x83ab('0x4f')]['fields']));_0x2a572d[_0x83ab('0x50')]=_0x2a572d[_0x83ab('0x50')][_0x83ab('0x64')]?_0x2a572d[_0x83ab('0x50')]:_0x448a1c[_0x83ab('0x4b')];if(_0x2f8de6[_0x83ab('0x4f')]['includeAll']){_0x2a572d[_0x83ab('0x5e')]=[{'all':!![]}];}_0x2a572d=_[_0x83ab('0x59')]({},_0x2a572d,_0x2f8de6[_0x83ab('0x5c')]);return db[_0x83ab('0x47')][_0x83ab('0x65')](_0x2a572d)[_0x83ab('0xf')](handleEntityNotFound(_0x3e28a5,null))[_0x83ab('0xf')](respondWithResult(_0x3e28a5,null))['catch'](handleError(_0x3e28a5,null));};exports[_0x83ab('0x22')]=function(_0x396258,_0x4c6609){if(_0x396258[_0x83ab('0x66')]['id']){delete _0x396258[_0x83ab('0x66')]['id'];}var _0x856efb=_0x396258[_0x83ab('0x66')]['provider']===_0x83ab('0x67')?null:_0x396258[_0x83ab('0x66')][_0x83ab('0x68')];var _0x543572=_0x396258[_0x83ab('0x66')][_0x83ab('0x40')]||{};var _0x10b358=_0x396258[_0x83ab('0x66')][_0x83ab('0x41')]||{};if(_0x856efb){_0x543572[_0x83ab('0x3b')]=getImapHost(_0x856efb);_0x543572[_0x83ab('0x3c')]=0x3e1;_0x10b358[_0x83ab('0x3b')]=getSmtpHost(_0x856efb);_0x10b358[_0x83ab('0x3c')]=0x24b;_0x10b358[_0x83ab('0x3d')]=![];}if(_0x10b358[_0x83ab('0x39')]){_0x10b358['secure']=![];}else{_0x10b358['CloudProviderId']=null;}if(!_0x543572[_0x83ab('0x39')])_0x543572[_0x83ab('0x3a')]=null;_0x396258[_0x83ab('0x66')][_0x83ab('0x40')]=_0x543572;_0x396258[_0x83ab('0x66')][_0x83ab('0x41')]=_0x10b358;return db[_0x83ab('0x47')][_0x83ab('0x65')]({'where':{'id':_0x396258['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x83ab('0x40')},{'model':db[_0x83ab('0x63')],'as':'Smtp'},{'model':db['Pause'],'as':_0x83ab('0x45')}]})[_0x83ab('0xf')](handleEntityNotFound(_0x4c6609,null))['then'](function(_0x235898){if(!_0x235898)throw new Error('Mail\x20Account\x20not\x20found');if(_0x235898[_0x83ab('0x3e')])delete _0x396258[_0x83ab('0x66')][_0x83ab('0x40')];return _0x235898;})[_0x83ab('0xf')](saveUpdates(_0x396258[_0x83ab('0x66')],null))['then'](function(_0x1c21b5){if(!_0x396258[_0x83ab('0x66')][_0x83ab('0x40')])return _0x1c21b5;return db[_0x83ab('0x43')][_0x83ab('0x22')](_0x396258[_0x83ab('0x66')]['Imap'],{'where':{'MailAccountId':_0x1c21b5['id']}})[_0x83ab('0xf')](function(){return _0x1c21b5;});})[_0x83ab('0xf')](function(_0x4fac36){if(!_0x396258[_0x83ab('0x66')][_0x83ab('0x41')])return _0x4fac36;return db[_0x83ab('0x63')]['update'](_0x396258[_0x83ab('0x66')][_0x83ab('0x41')],{'where':{'MailAccountId':_0x4fac36['id']}})[_0x83ab('0xf')](function(){return _0x4fac36;});})[_0x83ab('0xf')](respondWithResult(_0x4c6609,null))['catch'](handleError(_0x4c6609,null));};exports['describe']=function(_0x457494,_0x428b05){return db['MailAccount'][_0x83ab('0x69')]()[_0x83ab('0xf')](respondWithResult(_0x428b05,null))[_0x83ab('0x6a')](handleError(_0x428b05,null));};exports['addDisposition']=function(_0x45dbc0,_0x53c2fd){if(_0x45dbc0[_0x83ab('0x66')]['id']){delete _0x45dbc0[_0x83ab('0x66')]['id'];}return db[_0x83ab('0x47')]['find']({'where':{'id':_0x45dbc0[_0x83ab('0x62')]['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x53c2fd,null))['then'](function(_0x463ee3){if(_0x463ee3){_0x45dbc0[_0x83ab('0x66')][_0x83ab('0x6b')]=_0x463ee3['id'];return db[_0x83ab('0x6c')][_0x83ab('0x6d')](_0x45dbc0[_0x83ab('0x66')]);}})[_0x83ab('0xf')](respondWithResult(_0x53c2fd,null))[_0x83ab('0x6a')](handleError(_0x53c2fd,null));};exports['getDispositions']=function(_0x47b795,_0x4f2d76){var _0x32f3d3={'raw':![],'where':{}};var _0x2b4fba={};var _0x239865={'count':0x0,'rows':[]};return db['MailAccount'][_0x83ab('0x6e')]({'where':{'id':_0x47b795['params']['id']}})['then'](handleEntityNotFound(_0x4f2d76,null))[_0x83ab('0xf')](function(_0x31bc7a){if(_0x31bc7a){_0x2b4fba[_0x83ab('0x4b')]=_[_0x83ab('0x4c')](db[_0x83ab('0x6c')][_0x83ab('0x48')]);_0x2b4fba[_0x83ab('0x4f')]=_[_0x83ab('0x4c')](_0x47b795[_0x83ab('0x4f')]);_0x2b4fba[_0x83ab('0x4d')]=_[_0x83ab('0x4e')](_0x2b4fba[_0x83ab('0x4b')],_0x2b4fba[_0x83ab('0x4f')]);_0x32f3d3[_0x83ab('0x50')]=_[_0x83ab('0x4e')](_0x2b4fba[_0x83ab('0x4b')],qs[_0x83ab('0x51')](_0x47b795[_0x83ab('0x4f')]['fields']));_0x32f3d3[_0x83ab('0x50')]=_0x32f3d3[_0x83ab('0x50')][_0x83ab('0x64')]?_0x32f3d3[_0x83ab('0x50')]:_0x2b4fba['model'];if(!_0x47b795[_0x83ab('0x4f')][_0x83ab('0x52')](_0x83ab('0x53'))){_0x32f3d3[_0x83ab('0x1f')]=qs[_0x83ab('0x1f')](_0x47b795[_0x83ab('0x4f')][_0x83ab('0x1f')]);_0x32f3d3[_0x83ab('0x1c')]=qs['offset'](_0x47b795[_0x83ab('0x4f')][_0x83ab('0x1c')]);}_0x32f3d3[_0x83ab('0x54')]=qs['sort'](_0x47b795['query'][_0x83ab('0x55')]);_0x32f3d3[_0x83ab('0x56')]=qs[_0x83ab('0x4d')](_[_0x83ab('0x57')](_0x47b795[_0x83ab('0x4f')],_0x2b4fba[_0x83ab('0x4d')]));_0x32f3d3[_0x83ab('0x56')][_0x83ab('0x6b')]=_0x31bc7a['id'];if(_0x47b795[_0x83ab('0x4f')]['filter']){_0x32f3d3['where']=_[_0x83ab('0x59')](_0x32f3d3[_0x83ab('0x56')],{'$or':_['map'](_0x32f3d3[_0x83ab('0x50')],function(_0x1a7d5b){var _0x5a2103={};_0x5a2103[_0x1a7d5b]={'$like':'%'+_0x47b795[_0x83ab('0x4f')]['filter']+'%'};return _0x5a2103;})});}_0x32f3d3=_['merge']({},_0x32f3d3,_0x47b795[_0x83ab('0x5c')]);return db[_0x83ab('0x6c')][_0x83ab('0x1e')]({'where':_0x32f3d3[_0x83ab('0x56')]})[_0x83ab('0xf')](function(_0x29f157){_0x239865[_0x83ab('0x1e')]=_0x29f157;if(_0x47b795[_0x83ab('0x4f')]['includeAll']){_0x32f3d3[_0x83ab('0x5e')]=[{'all':!![]}];}return db[_0x83ab('0x6c')][_0x83ab('0x5f')](_0x32f3d3);})[_0x83ab('0xf')](function(_0x2bacda){_0x239865[_0x83ab('0x60')]=_0x2bacda;return _0x239865;});}})['then'](respondWithFilteredResult(_0x4f2d76,_0x32f3d3))['catch'](handleError(_0x4f2d76,null));};exports[_0x83ab('0x6f')]=function(_0x5de659,_0x13f906){return db[_0x83ab('0x47')][_0x83ab('0x65')]({'where':{'id':_0x5de659[_0x83ab('0x62')]['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x13f906,null))[_0x83ab('0xf')](function(_0x176e1e){if(_0x176e1e){return _0x176e1e['removeDispositions'](_0x5de659[_0x83ab('0x4f')][_0x83ab('0x70')]);}})[_0x83ab('0xf')](respondWithStatusCode(_0x13f906,null))['catch'](handleError(_0x13f906,null));};exports['addAnswer']=function(_0x5422d6,_0x548f48){if(_0x5422d6[_0x83ab('0x66')]['id']){delete _0x5422d6['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x5422d6['params']['id']}})['then'](handleEntityNotFound(_0x548f48,null))[_0x83ab('0xf')](function(_0x52356b){if(_0x52356b){_0x5422d6[_0x83ab('0x66')]['MailAccountId']=_0x52356b['id'];return db['CannedAnswer'][_0x83ab('0x6d')](_0x5422d6['body']);}})['then'](respondWithResult(_0x548f48,null))[_0x83ab('0x6a')](handleError(_0x548f48,null));};exports['getAnswers']=function(_0x52ff9c,_0x486d8f){var _0x23a04f={'raw':![],'where':{}};var _0x159c82={};var _0x456148={'count':0x0,'rows':[]};return db[_0x83ab('0x47')][_0x83ab('0x6e')]({'where':{'id':_0x52ff9c['params']['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x486d8f,null))[_0x83ab('0xf')](function(_0x3cc873){if(_0x3cc873){_0x159c82[_0x83ab('0x4b')]=_[_0x83ab('0x4c')](db[_0x83ab('0x71')][_0x83ab('0x48')]);_0x159c82[_0x83ab('0x4f')]=_[_0x83ab('0x4c')](_0x52ff9c[_0x83ab('0x4f')]);_0x159c82[_0x83ab('0x4d')]=_[_0x83ab('0x4e')](_0x159c82[_0x83ab('0x4b')],_0x159c82['query']);_0x23a04f['attributes']=_['intersection'](_0x159c82['model'],qs[_0x83ab('0x51')](_0x52ff9c[_0x83ab('0x4f')][_0x83ab('0x51')]));_0x23a04f[_0x83ab('0x50')]=_0x23a04f['attributes']['length']?_0x23a04f[_0x83ab('0x50')]:_0x159c82[_0x83ab('0x4b')];if(!_0x52ff9c[_0x83ab('0x4f')][_0x83ab('0x52')](_0x83ab('0x53'))){_0x23a04f[_0x83ab('0x1f')]=qs[_0x83ab('0x1f')](_0x52ff9c['query'][_0x83ab('0x1f')]);_0x23a04f[_0x83ab('0x1c')]=qs[_0x83ab('0x1c')](_0x52ff9c[_0x83ab('0x4f')][_0x83ab('0x1c')]);}_0x23a04f[_0x83ab('0x54')]=qs['sort'](_0x52ff9c[_0x83ab('0x4f')][_0x83ab('0x55')]);_0x23a04f[_0x83ab('0x56')]=qs[_0x83ab('0x4d')](_['pick'](_0x52ff9c[_0x83ab('0x4f')],_0x159c82[_0x83ab('0x4d')]));_0x23a04f[_0x83ab('0x56')][_0x83ab('0x6b')]=_0x3cc873['id'];if(_0x52ff9c[_0x83ab('0x4f')][_0x83ab('0x58')]){_0x23a04f[_0x83ab('0x56')]=_[_0x83ab('0x59')](_0x23a04f[_0x83ab('0x56')],{'$or':_[_0x83ab('0x46')](_0x23a04f[_0x83ab('0x50')],function(_0x8a6b27){var _0x3c1d51={};_0x3c1d51[_0x8a6b27]={'$like':'%'+_0x52ff9c[_0x83ab('0x4f')][_0x83ab('0x58')]+'%'};return _0x3c1d51;})});}_0x23a04f=_[_0x83ab('0x59')]({},_0x23a04f,_0x52ff9c[_0x83ab('0x5c')]);return db[_0x83ab('0x71')]['count']({'where':_0x23a04f[_0x83ab('0x56')]})['then'](function(_0x108f43){_0x456148[_0x83ab('0x1e')]=_0x108f43;if(_0x52ff9c[_0x83ab('0x4f')][_0x83ab('0x5d')]){_0x23a04f[_0x83ab('0x5e')]=[{'all':!![]}];}return db[_0x83ab('0x71')]['findAll'](_0x23a04f);})[_0x83ab('0xf')](function(_0xbd8bef){_0x456148[_0x83ab('0x60')]=_0xbd8bef;return _0x456148;});}})['then'](respondWithFilteredResult(_0x486d8f,_0x23a04f))[_0x83ab('0x6a')](handleError(_0x486d8f,null));};exports[_0x83ab('0x72')]=function(_0x4e1abb,_0x265267){return db[_0x83ab('0x47')][_0x83ab('0x65')]({'where':{'id':_0x4e1abb[_0x83ab('0x62')]['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x265267,null))[_0x83ab('0xf')](function(_0x25ac10){if(_0x25ac10){return _0x25ac10[_0x83ab('0x72')](_0x4e1abb['query'][_0x83ab('0x70')]);}})[_0x83ab('0xf')](respondWithStatusCode(_0x265267,null))[_0x83ab('0x6a')](handleError(_0x265267,null));};exports[_0x83ab('0x6d')]=function(_0x54b284,_0xd67d78){var _0x48c8c0={'name':_0x54b284['body'][_0x83ab('0x28')],'key':_0x54b284[_0x83ab('0x66')][_0x83ab('0x4a')],'provider':_0x54b284[_0x83ab('0x66')][_0x83ab('0x68')]===_0x83ab('0x67')?null:_0x54b284[_0x83ab('0x66')][_0x83ab('0x68')],'email':_0x54b284[_0x83ab('0x66')]['email'],'ListId':_0x54b284[_0x83ab('0x66')]['ListId'],'active':!_[_0x83ab('0x73')](_0x54b284[_0x83ab('0x66')][_0x83ab('0x74')])?_0x54b284[_0x83ab('0x66')]['active']:!![],'description':_0x54b284['body']['description']||null};var _0x10e1ce=getAuthenticationOptions(_0x48c8c0[_0x83ab('0x68')],_0x54b284['body']);_0x48c8c0[_0x83ab('0x40')]=_0x10e1ce['Imap'];_0x48c8c0[_0x83ab('0x41')]=_0x10e1ce['Smtp'];return db[_0x83ab('0x47')][_0x83ab('0x6d')](_0x48c8c0,{'include':[{'model':db[_0x83ab('0x63')],'as':_0x83ab('0x41')},{'model':db[_0x83ab('0x43')],'as':_0x83ab('0x40')}]})[_0x83ab('0xf')](function(_0x4e0fdf){var _0x808dc7=_0x54b284[_0x83ab('0x35')][_0x83ab('0x24')]({'plain':!![]});if(!_0x808dc7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x808dc7[_0x83ab('0x75')]===_0x83ab('0x35')){var _0x357d35=_0x4e0fdf['get']({'plain':!![]});return db[_0x83ab('0x76')][_0x83ab('0x65')]({'where':{'name':_0x83ab('0x25'),'userProfileId':_0x808dc7['userProfileId']},'raw':!![]})[_0x83ab('0xf')](function(_0x5f4601){if(_0x5f4601&&_0x5f4601[_0x83ab('0x77')]===0x0){return db[_0x83ab('0x78')][_0x83ab('0x6d')]({'name':_0x357d35[_0x83ab('0x28')],'resourceId':_0x357d35['id'],'type':_0x5f4601[_0x83ab('0x28')],'sectionId':_0x5f4601['id']},{})[_0x83ab('0xf')](function(){return _0x4e0fdf;});}else{return _0x4e0fdf;}})['catch'](function(_0x1de816){logger[_0x83ab('0x15')](_0x83ab('0x79'),_0x1de816);throw _0x1de816;});}return _0x4e0fdf;})[_0x83ab('0xf')](respondWithResult(_0xd67d78,0xc9))[_0x83ab('0x6a')](handleError(_0xd67d78,null));};exports[_0x83ab('0x7a')]=function(_0x3ac8c8,_0x41a6c2){return db[_0x83ab('0x47')][_0x83ab('0x6e')]({'where':{'id':_0x3ac8c8[_0x83ab('0x62')]['id']}})['then'](handleEntityNotFound(_0x41a6c2,null))[_0x83ab('0xf')](function(_0xc8db21){if(_0xc8db21){return _0xc8db21[_0x83ab('0x7a')]();}return null;})['then'](respondWithResult(_0x41a6c2,null))['catch'](handleError(_0x41a6c2,null));};exports[_0x83ab('0x7b')]=function(_0x1e7161,_0xc09773){if(_0x1e7161[_0x83ab('0x66')]['id']){delete _0x1e7161[_0x83ab('0x66')]['id'];}return db[_0x83ab('0x47')][_0x83ab('0x65')]({'where':{'id':_0x1e7161[_0x83ab('0x62')]['id']}})['then'](handleEntityNotFound(_0xc09773,null))[_0x83ab('0xf')](function(_0x512065){if(_0x512065){_0x1e7161[_0x83ab('0x66')][_0x83ab('0x6b')]=_0x512065['id'];return db['MailServerIn'][_0x83ab('0x6d')](_0x1e7161[_0x83ab('0x66')]);}})[_0x83ab('0xf')](respondWithResult(_0xc09773,null))[_0x83ab('0x6a')](handleError(_0xc09773,null));};exports[_0x83ab('0x7c')]=function(_0x3a345a,_0x2f21df){return db['MailAccount'][_0x83ab('0x6e')]({'where':{'id':_0x3a345a['params']['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x2f21df,null))[_0x83ab('0xf')](function(_0x1ea33c){if(_0x1ea33c){return _0x1ea33c['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x2f21df,null))[_0x83ab('0x6a')](handleError(_0x2f21df,null));};exports[_0x83ab('0x7d')]=function(_0x311cc6,_0x3ed586){return db[_0x83ab('0x47')]['findOne']({'where':{'id':_0x311cc6['params']['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x3ed586,null))[_0x83ab('0xf')](function(_0x114340){if(_0x114340){return _0x114340[_0x83ab('0x7d')]();}return null;})[_0x83ab('0xf')](respondWithResult(_0x3ed586,null))[_0x83ab('0x6a')](handleError(_0x3ed586,null));};exports[_0x83ab('0x7e')]=function(_0x3a1ffb,_0x5b2e45){if(_0x3a1ffb[_0x83ab('0x66')]['id']){delete _0x3a1ffb[_0x83ab('0x66')]['id'];}return db[_0x83ab('0x47')][_0x83ab('0x65')]({'where':{'id':_0x3a1ffb[_0x83ab('0x62')]['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x5b2e45,null))[_0x83ab('0xf')](function(_0x5ae2dc){if(_0x5ae2dc){_0x3a1ffb[_0x83ab('0x66')][_0x83ab('0x6b')]=_0x5ae2dc['id'];return db[_0x83ab('0x63')][_0x83ab('0x6d')](_0x3a1ffb[_0x83ab('0x66')]);}})[_0x83ab('0xf')](respondWithResult(_0x5b2e45,null))['catch'](handleError(_0x5b2e45,null));};exports[_0x83ab('0x7f')]=function(_0x203e0f,_0x2f9abc){return db[_0x83ab('0x47')][_0x83ab('0x6e')]({'where':{'id':_0x203e0f[_0x83ab('0x62')]['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x2f9abc,null))[_0x83ab('0xf')](function(_0x35bb63){if(_0x35bb63){return _0x35bb63[_0x83ab('0x80')](null);}return null;})[_0x83ab('0xf')](respondWithStatusCode(_0x2f9abc,null))['catch'](handleError(_0x2f9abc,null));};exports[_0x83ab('0x81')]=function(_0x450548,_0x6bd754){return db['MailInteraction'][_0x83ab('0x65')]({'where':{'id':_0x450548[_0x83ab('0x62')]['id']}})['then'](handleEntityNotFound(_0x6bd754,null))['then'](function(_0x778279){if(_0x778279){return _0x778279[_0x83ab('0x81')](_0x450548[_0x83ab('0x66')][_0x83ab('0x70')],_[_0x83ab('0x82')](_0x450548['body'],[_0x83ab('0x70'),'id'])||{});}})['then'](respondWithResult(_0x6bd754,null))['catch'](handleError(_0x6bd754,null));};exports[_0x83ab('0x83')]=function(_0x38aebd,_0x2ae764){var _0x51ce93={'raw':![],'where':{}};var _0x223bb0={};var _0x36e5e8={'count':0x0,'rows':[]};return db[_0x83ab('0x47')][_0x83ab('0x6e')]({'where':{'id':_0x38aebd[_0x83ab('0x62')]['id']}})['then'](handleEntityNotFound(_0x2ae764,null))[_0x83ab('0xf')](function(_0x5ba472){if(_0x5ba472){_0x223bb0['model']=_[_0x83ab('0x4c')](db[_0x83ab('0x84')]['rawAttributes']);_0x223bb0[_0x83ab('0x4f')]=_[_0x83ab('0x4c')](_0x38aebd['query']);_0x223bb0['filters']=_['intersection'](_0x223bb0['model'],_0x223bb0[_0x83ab('0x4f')]);_0x51ce93[_0x83ab('0x50')]=_[_0x83ab('0x4e')](_0x223bb0['model'],qs[_0x83ab('0x51')](_0x38aebd[_0x83ab('0x4f')]['fields']));_0x51ce93['attributes']=_0x51ce93[_0x83ab('0x50')]['length']?_0x51ce93[_0x83ab('0x50')]:_0x223bb0['model'];if(!_0x38aebd[_0x83ab('0x4f')][_0x83ab('0x52')]('nolimit')){_0x51ce93['limit']=qs[_0x83ab('0x1f')](_0x38aebd[_0x83ab('0x4f')]['limit']);_0x51ce93[_0x83ab('0x1c')]=qs[_0x83ab('0x1c')](_0x38aebd[_0x83ab('0x4f')][_0x83ab('0x1c')]);}_0x51ce93[_0x83ab('0x54')]=qs[_0x83ab('0x55')](_0x38aebd['query'][_0x83ab('0x55')]);_0x51ce93[_0x83ab('0x56')]=qs[_0x83ab('0x4d')](_[_0x83ab('0x57')](_0x38aebd['query'],_0x223bb0['filters']));_0x51ce93[_0x83ab('0x56')]['MailAccountId']=_0x5ba472['id'];if(_0x38aebd[_0x83ab('0x4f')]['filter']){_0x51ce93[_0x83ab('0x56')]=_['merge'](_0x51ce93[_0x83ab('0x56')],{'$or':_['map'](_0x51ce93['attributes'],function(_0x434215){var _0x109439={};_0x109439[_0x434215]={'$like':'%'+_0x38aebd[_0x83ab('0x4f')][_0x83ab('0x58')]+'%'};return _0x109439;})});}_0x51ce93=_[_0x83ab('0x59')]({},_0x51ce93,_0x38aebd[_0x83ab('0x5c')]);return db['MailInteraction'][_0x83ab('0x1e')]({'where':_0x51ce93[_0x83ab('0x56')]})[_0x83ab('0xf')](function(_0x2d70d1){_0x36e5e8[_0x83ab('0x1e')]=_0x2d70d1;if(_0x38aebd['query'][_0x83ab('0x5d')]){_0x51ce93['include']=[{'model':db[_0x83ab('0x85')],'as':_0x83ab('0x86'),'required':![]},{'model':db[_0x83ab('0x87')],'as':_0x83ab('0x88'),'attributes':[_0x83ab('0x28'),_0x83ab('0x89'),_0x83ab('0x8a')],'required':![]},{'model':db[_0x83ab('0x8b')],'as':'Tags','attributes':['id',_0x83ab('0x28'),_0x83ab('0x8c')],'where':_0x38aebd[_0x83ab('0x4f')][_0x83ab('0x8d')]?{'id':_0x38aebd[_0x83ab('0x4f')][_0x83ab('0x8d')]}:undefined,'required':_0x38aebd[_0x83ab('0x4f')][_0x83ab('0x8d')]?!![]:![]}];}return db[_0x83ab('0x84')]['findAll'](_0x51ce93);})[_0x83ab('0xf')](function(_0x2de9fc){_0x36e5e8[_0x83ab('0x60')]=_0x2de9fc;return _0x36e5e8;});}})['then'](respondWithFilteredResult(_0x2ae764,_0x51ce93))[_0x83ab('0x6a')](handleError(_0x2ae764,null));};exports[_0x83ab('0x8e')]=function addApplications(_0x3673ea,_0x11842a){var _0x2e2b25=_0x3673ea[_0x83ab('0x62')]['id'];var _0x55d54f=_0x3673ea[_0x83ab('0x66')];var _0x2ecb64=0xc8;var _0x478519=null;return db[_0x83ab('0x8f')][_0x83ab('0x90')]({'isolationLevel':db['sequelize']['Transaction'][_0x83ab('0x91')][_0x83ab('0x92')]},function(_0x8c4ec8){return db[_0x83ab('0x47')][_0x83ab('0x6e')]({'where':{'id':_0x2e2b25},'transaction':_0x8c4ec8})['then'](function(_0x14462c){if(_0x14462c){return db[_0x83ab('0x93')][_0x83ab('0x23')]({'where':{'MailAccountId':_0x2e2b25},'transaction':_0x8c4ec8})['then'](function(){var _0x798dd1=_[_0x83ab('0x46')](_0x55d54f,function(_0x10fae9){_0x10fae9[_0x83ab('0x6b')]=_0x2e2b25;return _0x10fae9;});return db['MailApplication'][_0x83ab('0x94')](_0x798dd1,{'transaction':_0x8c4ec8});});}else{_0x2ecb64=0x194;_0x478519=[];}});})[_0x83ab('0xf')](function(){if(_0x2ecb64!==0x194){return db[_0x83ab('0x93')]['findAndCountAll']({'where':{'MailAccountId':_0x2e2b25},'order':_0x83ab('0x95')})[_0x83ab('0xf')](function(_0x3d232f){_0x478519=_0x3d232f;});}})['catch'](function(_0x2dbc00){_0x2ecb64=0x1f4;logger[_0x83ab('0x15')](_0x2dbc00[_0x83ab('0x27')]);if(_0x2dbc00['name']){delete _0x2dbc00[_0x83ab('0x28')];}_0x478519=_0x2dbc00;})[_0x83ab('0x96')](function(){if(_0x478519===null){_0x11842a[_0x83ab('0x26')](_0x2ecb64);}else{if(_0x2ecb64===0x1f4){_0x11842a[_0x83ab('0x19')](_0x2ecb64)[_0x83ab('0x29')](_0x478519);}else{_0x11842a[_0x83ab('0x19')](_0x2ecb64)[_0x83ab('0x1b')](_0x478519);}}});};exports[_0x83ab('0x97')]=function(_0x1dede7,_0x47442b){var _0x221145={};var _0x25bacd={};var _0x3fd7b3;var _0x58f80b;return db[_0x83ab('0x47')][_0x83ab('0x6e')]({'where':{'id':_0x1dede7[_0x83ab('0x62')]['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x47442b,null))['then'](function(_0x28d868){if(_0x28d868){_0x3fd7b3=_0x28d868;_0x25bacd[_0x83ab('0x4b')]=_['keys'](db[_0x83ab('0x93')][_0x83ab('0x48')]);_0x25bacd[_0x83ab('0x4f')]=_[_0x83ab('0x4c')](_0x1dede7['query']);_0x25bacd[_0x83ab('0x4d')]=_[_0x83ab('0x4e')](_0x25bacd[_0x83ab('0x4b')],_0x25bacd['query']);_0x221145['attributes']=_[_0x83ab('0x4e')](_0x25bacd['model'],qs[_0x83ab('0x51')](_0x1dede7[_0x83ab('0x4f')][_0x83ab('0x51')]));_0x221145[_0x83ab('0x50')]=_0x221145['attributes'][_0x83ab('0x64')]?_0x221145['attributes']:_0x25bacd['model'];_0x221145['order']=qs[_0x83ab('0x55')](_0x1dede7[_0x83ab('0x4f')][_0x83ab('0x55')]);_0x221145['where']=qs['filters'](_[_0x83ab('0x57')](_0x1dede7['query'],_0x25bacd[_0x83ab('0x4d')]));if(_0x1dede7[_0x83ab('0x4f')][_0x83ab('0x58')]){_0x221145[_0x83ab('0x56')]=_['merge'](_0x221145['where'],{'$or':_[_0x83ab('0x46')](_0x221145[_0x83ab('0x50')],function(_0x1f708e){var _0x4db9c7={};_0x4db9c7[_0x1f708e]={'$like':'%'+_0x1dede7[_0x83ab('0x4f')]['filter']+'%'};return _0x4db9c7;})});}_0x221145=_[_0x83ab('0x59')]({},_0x221145,_0x1dede7[_0x83ab('0x5c')]);return _0x3fd7b3['getApplications'](_0x221145);}})[_0x83ab('0xf')](function(_0x3a6b8c){if(_0x3a6b8c){_0x58f80b=_0x3a6b8c[_0x83ab('0x64')];if(!_0x1dede7['query'][_0x83ab('0x52')](_0x83ab('0x53'))){_0x221145[_0x83ab('0x1f')]=qs[_0x83ab('0x1f')](_0x1dede7[_0x83ab('0x4f')][_0x83ab('0x1f')]);_0x221145[_0x83ab('0x1c')]=qs[_0x83ab('0x1c')](_0x1dede7[_0x83ab('0x4f')][_0x83ab('0x1c')]);}return _0x3fd7b3[_0x83ab('0x97')](_0x221145);}})[_0x83ab('0xf')](function(_0x4b9f63){if(_0x4b9f63){return _0x4b9f63?{'count':_0x58f80b,'rows':_0x4b9f63}:null;}})['then'](respondWithResult(_0x47442b,null))[_0x83ab('0x6a')](handleError(_0x47442b,null));};exports['getMessages']=function(_0x210717,_0x55d75b){var _0x50e321={'raw':!![],'where':{}};var _0x1da471={};var _0x412cfe={'count':0x0,'rows':[]};return db[_0x83ab('0x47')][_0x83ab('0x6e')]({'where':{'id':_0x210717[_0x83ab('0x62')]['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x55d75b,null))[_0x83ab('0xf')](function(_0x54d355){if(_0x54d355){_0x1da471[_0x83ab('0x4b')]=_[_0x83ab('0x4c')](db['MailMessage'][_0x83ab('0x48')]);_0x1da471[_0x83ab('0x4f')]=_[_0x83ab('0x4c')](_0x210717['query']);_0x1da471['filters']=_['intersection'](_0x1da471[_0x83ab('0x4b')],_0x1da471[_0x83ab('0x4f')]);_0x50e321[_0x83ab('0x50')]=_[_0x83ab('0x4e')](_0x1da471[_0x83ab('0x4b')],qs['fields'](_0x210717[_0x83ab('0x4f')][_0x83ab('0x51')]));_0x50e321['attributes']=_0x50e321['attributes'][_0x83ab('0x64')]?_0x50e321[_0x83ab('0x50')]:_0x1da471[_0x83ab('0x4b')];if(!_0x210717['query'][_0x83ab('0x52')](_0x83ab('0x53'))){_0x50e321[_0x83ab('0x1f')]=qs[_0x83ab('0x1f')](_0x210717[_0x83ab('0x4f')][_0x83ab('0x1f')]);_0x50e321[_0x83ab('0x1c')]=qs[_0x83ab('0x1c')](_0x210717[_0x83ab('0x4f')]['offset']);}_0x50e321[_0x83ab('0x54')]=qs[_0x83ab('0x55')](_0x210717[_0x83ab('0x4f')]['sort']);_0x50e321[_0x83ab('0x56')]=qs['filters'](_[_0x83ab('0x57')](_0x210717[_0x83ab('0x4f')],_0x1da471[_0x83ab('0x4d')]));_0x50e321[_0x83ab('0x56')][_0x83ab('0x6b')]=_0x54d355['id'];if(_0x210717['query'][_0x83ab('0x58')]){_0x50e321[_0x83ab('0x56')]=_[_0x83ab('0x59')](_0x50e321[_0x83ab('0x56')],{'$or':_[_0x83ab('0x46')](_0x50e321[_0x83ab('0x50')],function(_0x29ab28){var _0x2de9a5={};_0x2de9a5[_0x29ab28]={'$like':'%'+_0x210717[_0x83ab('0x4f')][_0x83ab('0x58')]+'%'};return _0x2de9a5;})});}if(_0x210717['query'][_0x83ab('0x98')]){var _0xdf3eb8=_0x210717[_0x83ab('0x4f')]['$gte'][_0x83ab('0x99')](',');var _0x34c97a={};_0x34c97a[_0xdf3eb8[0x0]]={'$gte':moment(_0xdf3eb8[0x1])['format'](_0x83ab('0x9a'))};_0x50e321[_0x83ab('0x56')]=_['merge'](_0x50e321[_0x83ab('0x56')],_0x34c97a);}_0x50e321=_[_0x83ab('0x59')]({},_0x50e321,_0x210717[_0x83ab('0x5c')]);return db['MailMessage']['count']({'where':_0x50e321[_0x83ab('0x56')]})[_0x83ab('0xf')](function(_0x27127e){_0x412cfe['count']=_0x27127e;if(_0x210717['query'][_0x83ab('0x5d')]){_0x50e321[_0x83ab('0x5e')]=[{'all':!![]}];}return db[_0x83ab('0x9b')][_0x83ab('0x5f')](_0x50e321);})['then'](function(_0x520458){if(_0x210717[_0x83ab('0x4f')][_0x83ab('0x9c')]===_0x83ab('0x9d')){for(var _0x3d30bf=0x0;_0x3d30bf<_0x520458[_0x83ab('0x64')];_0x3d30bf++){_0x520458[_0x3d30bf]['body']=juice(_0x520458[_0x3d30bf][_0x83ab('0x66')]);}}_0x412cfe[_0x83ab('0x60')]=_0x520458;return _0x412cfe;});}})[_0x83ab('0xf')](respondWithFilteredResult(_0x55d75b,_0x50e321))['catch'](handleError(_0x55d75b,null));};exports[_0x83ab('0x29')]=function(_0x193830,_0x11dda9){var _0x29156d,_0x2ca5c8={},_0xdd8408;if(_0x193830['body']['to']){_0xdd8408=_0x193830[_0x83ab('0x66')]['to'][_0x83ab('0x99')](',')[0x0];}return db[_0x83ab('0x47')][_0x83ab('0x65')]({'where':{'id':_0x193830[_0x83ab('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x83ab('0x9e'),'include':[{'model':db[_0x83ab('0x85')],'as':_0x83ab('0x9f'),'where':{'email':_0xdd8408},'limit':0x1,'order':[[_0x83ab('0xa0'),'DESC']]}]},{'model':db[_0x83ab('0x63')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x83ab('0xa1')],'as':_0x83ab('0xa1'),'raw':!![]}]}]})[_0x83ab('0xf')](handleEntityNotFound(_0x11dda9,null))[_0x83ab('0xf')](function(_0x1d00b2){if(!_0x1d00b2)return;_0x29156d=_0x1d00b2;if(!_0x1d00b2[_0x83ab('0x41')])throw new Error(_0x83ab('0xa2'));if(_[_0x83ab('0x73')](_0x193830[_0x83ab('0x66')]['from'])){_0x193830[_0x83ab('0x66')]['from']=util[_0x83ab('0xa3')](_0x83ab('0xa4'),_0x1d00b2[_0x83ab('0x28')],_0x1d00b2[_0x83ab('0xa5')]||_0x1d00b2[_0x83ab('0x41')][_0x83ab('0x35')]);}if(_0x193830[_0x83ab('0x66')][_0x83ab('0xa6')]&&_0x193830['body'][_0x83ab('0xa6')][_0x83ab('0x64')]){for(var _0x392d13=0x0;_0x392d13<_0x193830[_0x83ab('0x66')][_0x83ab('0xa6')][_0x83ab('0x64')];_0x392d13+=0x1){_0x193830[_0x83ab('0x66')][_0x83ab('0xa6')][_0x392d13]={'filename':_0x193830[_0x83ab('0x66')][_0x83ab('0xa6')][_0x392d13]['name'],'path':path[_0x83ab('0xa7')](config[_0x83ab('0xa8')],'server/files/attachments',_0x193830[_0x83ab('0x66')][_0x83ab('0xa6')][_0x392d13][_0x83ab('0xa9')])};}}var _0x59eb03=_0x1d00b2[_0x83ab('0xaa')]();return respondWithRpcPromise(_0x83ab('0xab'),_0x83ab('0xac'),{'account':_0x59eb03,'message':_0x193830[_0x83ab('0x66')]});})[_0x83ab('0xf')](function(_0x3e1f88){if(!_0x3e1f88)return;_0x2ca5c8=_0x3e1f88;if(!_0x29156d[_0x83ab('0x9e')])throw new Error(_0x83ab('0xad'));if(_0x29156d[_0x83ab('0x9e')]['Contacts'][_0x83ab('0x64')])return _0x29156d[_0x83ab('0x9e')][_0x83ab('0x9f')][0x0];return db[_0x83ab('0x85')][_0x83ab('0x6d')](_[_0x83ab('0x9')](_0x193830[_0x83ab('0x66')],{'firstName':_0x193830[_0x83ab('0x66')]['to'],'email':_0x193830['body']['to'],'phone':_0x193830[_0x83ab('0x66')]['to'],'ListId':_0x29156d['ListId']}));})[_0x83ab('0xf')](function(_0x3f594c){if(!_0x3f594c)return;var _0x4b7be8={'UserId':_0x193830[_0x83ab('0x35')]['id'],'ContactId':_0x3f594c['id'],'MailAccountId':_0x29156d['id'],'inReplyTo':_0x2ca5c8[_0x83ab('0xae')],'to':_0x193830[_0x83ab('0x66')][_0x83ab('0xaf')],'cc':_0x193830['body']['cc'],'subject':_0x193830['body'][_0x83ab('0xb0')],'attach':_0x193830['body'][_0x83ab('0xb1')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x83ab('0xa3')](_0x83ab('0x9a')),'lastMsgDirection':_0x83ab('0xb2'),'Messages':[_[_0x83ab('0x59')](_0x193830[_0x83ab('0x66')],{'messageId':_0x2ca5c8[_0x83ab('0xae')],'sentAt':moment()[_0x83ab('0xa3')](_0x83ab('0x9a')),'read':!![],'MailAccountId':_0x29156d['id'],'UserId':_0x193830[_0x83ab('0x35')]['id'],'ContactId':_0x3f594c['id']})]};if(_0x193830[_0x83ab('0x66')][_0x83ab('0xb3')]){_0x4b7be8=_[_0x83ab('0x59')](_0x4b7be8,_0x193830[_0x83ab('0x66')][_0x83ab('0xb3')]);}return db['MailInteraction'][_0x83ab('0x6d')](_0x4b7be8,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0x83ab('0xf')](respondWithResult(_0x11dda9,null))[_0x83ab('0x6a')](handleError(_0x11dda9,null));};exports[_0x83ab('0xb4')]=function(_0x5b5da7,_0x10fba8){return db[_0x83ab('0x47')]['find']({'where':{'id':_0x5b5da7[_0x83ab('0x62')]['id']},'include':[{'model':db[_0x83ab('0x63')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x10fba8,null))[_0x83ab('0xf')](function(_0x32a4a0){if(!_0x32a4a0[_0x83ab('0x41')])return;var _0x16642e=_0x32a4a0[_0x83ab('0xaa')]();return respondWithRpcPromise('VerifySmtp',_0x83ab('0xb4'),{'account':_0x16642e});})[_0x83ab('0xf')](respondWithResult(_0x10fba8,null))[_0x83ab('0x6a')](handleError(_0x10fba8,null));};exports[_0x83ab('0x23')]=function(_0x3917ff,_0x531200){return db[_0x83ab('0x47')][_0x83ab('0x65')]({'where':{'id':_0x3917ff['params']['id']}})['then'](handleEntityNotFound(_0x531200,null))[_0x83ab('0xf')](function(_0x2ce2db){if(_0x2ce2db&&_0x2ce2db[_0x83ab('0x3e')]){throw new db['Sequelize'][(_0x83ab('0xb5'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2ce2db;})[_0x83ab('0xf')](removeEntity(_0x531200,null))['catch'](handleError(_0x531200,null));};exports[_0x83ab('0xb6')]=function(_0x494a4d,_0x528678){return db[_0x83ab('0x47')][_0x83ab('0x65')]({'where':{'id':_0x494a4d['params']['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x528678,null))[_0x83ab('0xf')](function(_0x312895){if(_0x312895){return _0x312895[_0x83ab('0xb6')](_0x494a4d[_0x83ab('0x66')][_0x83ab('0x70')],_[_0x83ab('0x82')](_0x494a4d[_0x83ab('0x66')],[_0x83ab('0x70'),'id'])||{})[_0x83ab('0xb7')](function(_0x3aee31){for(var _0x19d4ff=0x0;_0x19d4ff<_0x494a4d[_0x83ab('0x66')][_0x83ab('0x70')][_0x83ab('0x64')];_0x19d4ff+=0x1){socket[_0x83ab('0xb8')]('userMailAccount:save',{'UserId':Number(_0x494a4d[_0x83ab('0x66')][_0x83ab('0x70')][_0x19d4ff]),'MailAccountId':Number(_0x494a4d[_0x83ab('0x62')]['id'])});}return _0x3aee31;});}})[_0x83ab('0xf')](respondWithResult(_0x528678,null))['catch'](handleError(_0x528678,null));};exports['removeAgents']=function(_0x3d39d8,_0x2a8048){return db[_0x83ab('0x47')][_0x83ab('0x65')]({'where':{'id':_0x3d39d8[_0x83ab('0x62')]['id']}})['then'](handleEntityNotFound(_0x2a8048,null))['then'](function(_0x4be925){if(_0x4be925){return _0x4be925[_0x83ab('0xb9')](_0x3d39d8[_0x83ab('0x4f')][_0x83ab('0x70')])[_0x83ab('0xf')](function(){if(_[_0x83ab('0xba')](_0x3d39d8[_0x83ab('0x4f')][_0x83ab('0x70')])){for(var _0x4b8f91=0x0;_0x4b8f91<_0x3d39d8[_0x83ab('0x4f')][_0x83ab('0x70')]['length'];_0x4b8f91+=0x1){socket[_0x83ab('0xb8')]('userMailAccount:remove',{'UserId':Number(_0x3d39d8[_0x83ab('0x4f')][_0x83ab('0x70')][_0x4b8f91]),'MailAccountId':Number(_0x3d39d8[_0x83ab('0x62')]['id'])});}}else{socket[_0x83ab('0xb8')](_0x83ab('0xbb'),{'UserId':Number(_0x3d39d8[_0x83ab('0x4f')][_0x83ab('0x70')]),'MailAccountId':Number(_0x3d39d8[_0x83ab('0x62')]['id'])});}});}})[_0x83ab('0xf')](respondWithStatusCode(_0x2a8048,null))[_0x83ab('0x6a')](handleError(_0x2a8048,null));};exports[_0x83ab('0xbc')]=function(_0x330030,_0x19a4e1){var _0x4a2002={};var _0xaff32f={};var _0x14d2ba;var _0x287323;return db[_0x83ab('0x47')][_0x83ab('0x6e')]({'where':{'id':_0x330030[_0x83ab('0x62')]['id']}})[_0x83ab('0xf')](handleEntityNotFound(_0x19a4e1,null))[_0x83ab('0xf')](function(_0x5e02d1){if(_0x5e02d1){_0x14d2ba=_0x5e02d1;_0xaff32f[_0x83ab('0x4b')]=_[_0x83ab('0x4c')](db[_0x83ab('0x87')][_0x83ab('0x48')]);_0xaff32f[_0x83ab('0x4f')]=_[_0x83ab('0x4c')](_0x330030[_0x83ab('0x4f')]);_0xaff32f[_0x83ab('0x4d')]=_[_0x83ab('0x4e')](_0xaff32f[_0x83ab('0x4b')],_0xaff32f[_0x83ab('0x4f')]);_0x4a2002[_0x83ab('0x50')]=_[_0x83ab('0x4e')](_0xaff32f[_0x83ab('0x4b')],qs[_0x83ab('0x51')](_0x330030[_0x83ab('0x4f')][_0x83ab('0x51')]));_0x4a2002[_0x83ab('0x50')]=_0x4a2002[_0x83ab('0x50')][_0x83ab('0x64')]?_0x4a2002[_0x83ab('0x50')]:_0xaff32f[_0x83ab('0x4b')];_0x4a2002['order']=qs[_0x83ab('0x55')](_0x330030['query'][_0x83ab('0x55')]);_0x4a2002['where']=qs[_0x83ab('0x4d')](_['pick'](_0x330030[_0x83ab('0x4f')],_0xaff32f[_0x83ab('0x4d')]));if(_0x330030[_0x83ab('0x4f')][_0x83ab('0x58')]){_0x4a2002['where']=_[_0x83ab('0x59')](_0x4a2002[_0x83ab('0x56')],{'$or':_[_0x83ab('0x46')](_0x4a2002[_0x83ab('0x50')],function(_0x117d36){var _0x1caf8f={};_0x1caf8f[_0x117d36]={'$like':'%'+_0x330030[_0x83ab('0x4f')][_0x83ab('0x58')]+'%'};return _0x1caf8f;})});}_0x4a2002=_[_0x83ab('0x59')]({},_0x4a2002,_0x330030['options']);return _0x14d2ba[_0x83ab('0xbc')](_0x4a2002);}})['then'](function(_0x37716d){if(_0x37716d){_0x287323=_0x37716d['length'];if(!_0x330030['query']['hasOwnProperty'](_0x83ab('0x53'))){_0x4a2002[_0x83ab('0x1f')]=qs[_0x83ab('0x1f')](_0x330030[_0x83ab('0x4f')][_0x83ab('0x1f')]);_0x4a2002[_0x83ab('0x1c')]=qs['offset'](_0x330030['query'][_0x83ab('0x1c')]);}return _0x14d2ba[_0x83ab('0xbc')](_0x4a2002);}})[_0x83ab('0xf')](function(_0xaaeb3d){if(_0xaaeb3d){return _0xaaeb3d?{'count':_0x287323,'rows':_0xaaeb3d}:null;}})[_0x83ab('0xf')](respondWithResult(_0x19a4e1,null))[_0x83ab('0x6a')](handleError(_0x19a4e1,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 01c6814..9688bd1 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 _0x77a9=['hasOwnProperty','events','MailAccount','save','update','remove','emit'];(function(_0x5e8c3e,_0x4bf1cc){var _0xdd8e99=function(_0x3b23e7){while(--_0x3b23e7){_0x5e8c3e['push'](_0x5e8c3e['shift']());}};_0xdd8e99(++_0x4bf1cc);}(_0x77a9,0x19e));var _0x977a=function(_0x61376b,_0x9d1123){_0x61376b=_0x61376b-0x0;var _0x9dc6fc=_0x77a9[_0x61376b];return _0x9dc6fc;};'use strict';var EventEmitter=require(_0x977a('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x977a('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x977a('0x2'),'afterUpdate':_0x977a('0x3'),'afterDestroy':_0x977a('0x4')};function emitEvent(_0x368664){return function(_0x520cd7,_0x318fc8,_0xb755){MailAccountEvents[_0x977a('0x5')](_0x368664+':'+_0x520cd7['id'],_0x520cd7);MailAccountEvents[_0x977a('0x5')](_0x368664,_0x520cd7);_0xb755(null);};}for(var e in events){if(events[_0x977a('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xaf97=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0xf1063c,_0x2ea108){var _0x148221=function(_0xf989bd){while(--_0xf989bd){_0xf1063c['push'](_0xf1063c['shift']());}};_0x148221(++_0x2ea108);}(_0xaf97,0x15a));var _0x7af9=function(_0x9f956,_0x58f1aa){_0x9f956=_0x9f956-0x0;var _0x3be7c9=_0xaf97[_0x9f956];return _0x3be7c9;};'use strict';var EventEmitter=require(_0x7af9('0x0'));var MailAccount=require(_0x7af9('0x1'))['db'][_0x7af9('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7af9('0x3')](0x0);var events={'afterCreate':_0x7af9('0x4'),'afterUpdate':'update','afterDestroy':_0x7af9('0x5')};function emitEvent(_0x1d6e9f){return function(_0x3fd76e,_0x1dce1d,_0x540a77){MailAccountEvents[_0x7af9('0x6')](_0x1d6e9f+':'+_0x3fd76e['id'],_0x3fd76e);MailAccountEvents[_0x7af9('0x6')](_0x1d6e9f,_0x3fd76e);_0x540a77(null);};}for(var e in events){if(events[_0x7af9('0x7')](e)){var event=events[e];MailAccount[_0x7af9('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 65a47a2..327b7dd 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 _0xe583=['mail_accounts','provider','custom','service','host','port','Smtp','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','pass','./mailAccount.attributes','MailAccount'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xe583,0xfd));var _0x3e58=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xe583[_0xd09668];return _0x68726;};'use strict';var attributes=require(_0x3e58('0x0'));module['exports']=function(_0x553d26){return _0x553d26['define'](_0x3e58('0x1'),attributes,{'tableName':_0x3e58('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x17b42c=this;var _0x138c81={'id':_0x17b42c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x17b42c[_0x3e58('0x3')]!==_0x3e58('0x4')){_0x138c81[_0x3e58('0x5')]=_0x17b42c[_0x3e58('0x3')];}else{_0x138c81[_0x3e58('0x6')]=_0x17b42c['Smtp'][_0x3e58('0x6')];_0x138c81[_0x3e58('0x7')]=_0x17b42c[_0x3e58('0x8')]['port'];_0x138c81['secure']=_0x17b42c['Smtp'][_0x3e58('0x9')];}if(_0x17b42c['Smtp']['authentication']){if(_0x17b42c['Smtp'][_0x3e58('0xa')]){if(!_0x17b42c[_0x3e58('0x8')][_0x3e58('0xb')])throw new Error(_0x3e58('0xc'));_0x138c81[_0x3e58('0xd')]={'type':_0x3e58('0xe'),'user':_0x17b42c['Smtp'][_0x3e58('0xf')],'accessToken':_0x17b42c[_0x3e58('0x8')]['CloudProvider']['data5']};}else{_0x138c81[_0x3e58('0xd')]={'user':_0x17b42c[_0x3e58('0x8')][_0x3e58('0xf')],'pass':_0x17b42c['Smtp'][_0x3e58('0x10')]};}}return _0x138c81;}}});}; \ No newline at end of file +var _0x8ac6=['authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','CloudProvider','user','pass','exports','define','mail_accounts','provider','custom','service','host','port','Smtp','secure'];(function(_0x471723,_0xb05290){var _0x51270c=function(_0x399530){while(--_0x399530){_0x471723['push'](_0x471723['shift']());}};_0x51270c(++_0xb05290);}(_0x8ac6,0xb1));var _0x68ac=function(_0x1ab664,_0x967368){_0x1ab664=_0x1ab664-0x0;var _0x36dfab=_0x8ac6[_0x1ab664];return _0x36dfab;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x68ac('0x0')]=function(_0x4f0add){return _0x4f0add[_0x68ac('0x1')]('MailAccount',attributes,{'tableName':_0x68ac('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x21d78e=this;var _0x5d7836={'id':_0x21d78e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x21d78e[_0x68ac('0x3')]!==_0x68ac('0x4')){_0x5d7836[_0x68ac('0x5')]=_0x21d78e[_0x68ac('0x3')];}else{_0x5d7836[_0x68ac('0x6')]=_0x21d78e['Smtp'][_0x68ac('0x6')];_0x5d7836[_0x68ac('0x7')]=_0x21d78e[_0x68ac('0x8')]['port'];_0x5d7836[_0x68ac('0x9')]=_0x21d78e[_0x68ac('0x8')][_0x68ac('0x9')];}if(_0x21d78e['Smtp'][_0x68ac('0xa')]){if(_0x21d78e['Smtp'][_0x68ac('0xb')]){if(!_0x21d78e['Smtp']['CloudProvider'])throw new Error(_0x68ac('0xc'));_0x5d7836['auth']={'type':_0x68ac('0xd'),'user':_0x21d78e[_0x68ac('0x8')]['user'],'accessToken':_0x21d78e[_0x68ac('0x8')][_0x68ac('0xe')]['data5']};}else{_0x5d7836['auth']={'user':_0x21d78e[_0x68ac('0x8')][_0x68ac('0xf')],'pass':_0x21d78e[_0x68ac('0x8')][_0x68ac('0x10')]};}}return _0x5d7836;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f8347eb..456187f 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 _0x0295=['setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','priority','asc','autoclose','close','*,*,*,*','length','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','created','create','attachments','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','User','name','agent','Start','startRouting','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','model','map','debug','ShowMailAccount','find','where','smtp'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0x0295,0x1f0));var _0x5029=function(_0x67b075,_0x43557d){_0x67b075=_0x67b075-0x0;var _0x39d030=_0x0295[_0x67b075];return _0x39d030;};'use strict';var _=require(_0x5029('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5029('0x1'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x5029('0x2'))(_0x5029('0x3'));var config=require(_0x5029('0x4'));var jayson=require(_0x5029('0x5'));var client=jayson[_0x5029('0x6')][_0x5029('0x7')]({'port':0x232c});config[_0x5029('0x8')]=_[_0x5029('0x9')](config[_0x5029('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5029('0xa'))['register'](socket);function respondWithRpcPromise(_0x1532e9,_0x5bccfc,_0x14d4ef){return new BPromise(function(_0x520bc3,_0x222ddb){return client[_0x5029('0xb')](_0x1532e9,_0x14d4ef)[_0x5029('0xc')](function(_0x52fa95){logger[_0x5029('0xd')](_0x5029('0xe'),_0x5bccfc,_0x5029('0xf'));logger['debug'](_0x5029('0x10'),_0x5bccfc,_0x5029('0xf'),JSON['stringify'](_0x52fa95));if(_0x52fa95['error']){if(_0x52fa95['error']['code']===0x1f4){logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);return _0x222ddb(_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);}logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);return _0x520bc3(_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);}else{logger[_0x5029('0xd')](_0x5029('0xe'),_0x5bccfc,_0x5029('0xf'));_0x520bc3(_0x52fa95['result'][_0x5029('0x12')]);}})[_0x5029('0x13')](function(_0x35de81){logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x35de81);_0x222ddb(_0x35de81);});});}exports[_0x5029('0x14')]=function(_0xaba461){var _0x4adbb3=this;return new Promise(function(_0x226a5c,_0x5696b1){return db[_0x5029('0x15')][_0x5029('0x16')]({'raw':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xaba461['options']?_0xaba461[_0x5029('0x17')]['where']||null:null,'attributes':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x18')]||null:null,'limit':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x19')]||null:null,'include':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x1a')]?_['map'](_0xaba461['options']['include'],function(_0x588d90){return{'model':db[_0x588d90[_0x5029('0x1b')]],'as':_0x588d90['as'],'attributes':_0x588d90['attributes'],'include':_0x588d90['include']?_[_0x5029('0x1c')](_0x588d90[_0x5029('0x1a')],function(_0x36d810){return{'model':db[_0x36d810['model']],'as':_0x36d810['as'],'attributes':_0x36d810[_0x5029('0x18')],'include':_0x36d810[_0x5029('0x1a')]?_['map'](_0x36d810[_0x5029('0x1a')],function(_0x31f0a0){return{'model':db[_0x31f0a0[_0x5029('0x1b')]],'as':_0x31f0a0['as'],'attributes':_0x31f0a0['attributes']};}):[]};}):[]};}):[]:[]})[_0x5029('0xc')](function(_0x251f99){logger[_0x5029('0xd')]('GetMailAccount',_0xaba461);logger[_0x5029('0x1d')](_0x5029('0x14'),_0xaba461,JSON['stringify'](_0x251f99));_0x226a5c(_0x251f99);})[_0x5029('0x13')](function(_0x25032b){logger[_0x5029('0x11')](_0x5029('0x14'),_0x25032b[_0x5029('0x12')],_0xaba461);_0x5696b1(_0x4adbb3[_0x5029('0x11')](0x1f4,_0x25032b[_0x5029('0x12')]));});});};exports[_0x5029('0x1e')]=function(_0x250156){var _0x22559a=this;return new Promise(function(_0x358a2b,_0x4519c8){return db['MailAccount'][_0x5029('0x1f')]({'raw':_0x250156['options']?_0x250156[_0x5029('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x250156['options']?_0x250156[_0x5029('0x17')][_0x5029('0x20')]||null:null,'attributes':_0x250156[_0x5029('0x17')]?_0x250156['options'][_0x5029('0x18')]||null:null,'include':_0x250156[_0x5029('0x17')]?_0x250156[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x250156[_0x5029('0x17')][_0x5029('0x1a')],function(_0x22205e){return{'model':db[_0x22205e[_0x5029('0x1b')]],'as':_0x22205e['as'],'attributes':_0x22205e['attributes'],'include':_0x22205e[_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x22205e[_0x5029('0x1a')],function(_0x1b3817){return{'model':db[_0x1b3817['model']],'as':_0x1b3817['as'],'attributes':_0x1b3817[_0x5029('0x18')],'include':_0x1b3817[_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x1b3817['include'],function(_0x4904cc){return{'model':db[_0x4904cc[_0x5029('0x1b')]],'as':_0x4904cc['as'],'attributes':_0x4904cc[_0x5029('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57784c){if(_0x250156[_0x5029('0x17')][_0x5029('0x21')]===!![])_0x57784c[_0x5029('0x22')](_0x5029('0x23'),_0x57784c[_0x5029('0x24')]());logger[_0x5029('0xd')](_0x5029('0x1e'),_0x250156);logger[_0x5029('0x1d')](_0x5029('0x1e'),_0x250156,JSON[_0x5029('0x25')](_0x57784c));_0x358a2b(_0x57784c);})[_0x5029('0x13')](function(_0xbdb3fa){logger[_0x5029('0x11')](_0x5029('0x1e'),_0xbdb3fa['message'],_0x250156);_0x4519c8(_0x22559a['error'](0x1f4,_0xbdb3fa[_0x5029('0x12')]));});});};exports[_0x5029('0x26')]=function(_0x423ed1){var _0x48c9eb=this;return new Promise(function(_0x32d8a3,_0x39b216){var _0x52572a={'body':_0x423ed1[_0x5029('0x27')],'channel':'mail'};var _0x506f0d=_['difference'](_[_0x5029('0x28')](db[_0x5029('0x29')][_0x5029('0x2a')]),[_0x5029('0x2b'),_0x5029('0x2c'),_0x5029('0x2d'),_0x5029('0x2e')]);var _0x1021ea=![];if(_0x423ed1[_0x5029('0x27')]['id']){delete _0x423ed1['body']['id'];}if(_[_0x5029('0x2f')](_0x423ed1[_0x5029('0x27')][_0x5029('0x30')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x31')));}if(_[_0x5029('0x2f')](_0x423ed1['body'][_0x5029('0x27')])||_0x423ed1[_0x5029('0x27')][_0x5029('0x27')]===''){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x32')));}if(_['isNil'](_0x423ed1[_0x5029('0x27')][_0x5029('0x33')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x34')+_0x506f0d));}if(!_[_0x5029('0x35')](_0x506f0d,_0x423ed1[_0x5029('0x27')][_0x5029('0x33')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x36')+_0x506f0d));}var _0x51514e={};_0x51514e[_0x423ed1[_0x5029('0x27')][_0x5029('0x33')]]=_0x423ed1[_0x5029('0x27')][_0x5029('0x30')];return db['MailAccount']['find']({'where':{'id':_0x423ed1[_0x5029('0x37')]['id']},'include':[{'model':db[_0x5029('0x38')],'as':_0x5029('0x39'),'include':[{'model':db[_0x5029('0x29')],'as':_0x5029('0x3a'),'where':_0x51514e,'limit':0x1,'order':[[_0x5029('0x2c'),_0x5029('0x3b')]]}]},{'model':db[_0x5029('0x3c')],'as':_0x5029('0x3d')},{'model':db[_0x5029('0x3e')],'as':_0x5029('0x3f'),'include':[{'model':db[_0x5029('0x40')],'as':_0x5029('0x40')}]}]})[_0x5029('0xc')](function(_0x3168bd){if(_0x3168bd&&_0x3168bd[_0x5029('0x39')]){var _0x10fc07=_0x3168bd[_0x5029('0x41')]({'plain':!![]});_0x52572a[_0x5029('0x37')]=_[_0x5029('0x42')](_0x10fc07,[_0x5029('0x3d'),'List']);_0x52572a[_0x5029('0x37')]['smtpOptions']=_0x3168bd[_0x5029('0x24')]();_0x52572a[_0x5029('0x43')]=_0x10fc07['Applications'];_0x52572a['list']=_0x10fc07[_0x5029('0x39')];_0x52572a['applications']=_['orderBy'](_0x52572a[_0x5029('0x43')],[_0x5029('0x44')],[_0x5029('0x45')]);if(_0x52572a['account']&&_0x52572a['account'][_0x5029('0x46')]){_0x52572a[_0x5029('0x43')]['push']({'id':0x0,'priority':_0x52572a[_0x5029('0x43')]['length']+0x1,'app':_0x5029('0x47'),'appdata':'autoclose','interval':_0x5029('0x48')});}if(_0x52572a[_0x5029('0x37')][_0x5029('0x3d')]){delete _0x52572a[_0x5029('0x37')][_0x5029('0x3d')];}if(_0x52572a[_0x5029('0x37')][_0x5029('0x39')]){delete _0x52572a[_0x5029('0x37')]['List'];}if(_0x10fc07[_0x5029('0x39')]['Contacts'][_0x5029('0x49')]){return _0x10fc07[_0x5029('0x39')]['Contacts'][0x0];}var _0x2a2da5=_['defaults'](_0x423ed1['body'],{'firstName':_0x423ed1['body'][_0x5029('0x30')],'ListId':_0x10fc07['ListId']});_0x2a2da5[_0x423ed1[_0x5029('0x27')][_0x5029('0x33')]]=_0x423ed1[_0x5029('0x27')]['from'];return db[_0x5029('0x29')]['create'](_0x2a2da5);}else{throw new Error('List\x20not\x20found');}})[_0x5029('0xc')](function(_0x98abd1){_0x52572a[_0x5029('0x4a')]=_0x98abd1;if(_0x98abd1){if(!_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['messageId']){_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4b')]=rs[_0x5029('0x4c')]()+'\x20'+_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x30')];}var _0x4d4a2d={'ContactId':_0x98abd1['id'],'MailAccountId':_0x423ed1['account']['id'],'inReplyTo':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4b')],'to':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x30')],'cc':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['cc'],'subject':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4d')],'attach':_0x423ed1['body']['message'][_0x5029('0x4e')],'lastMsgAt':moment()[_0x5029('0x4f')](_0x5029('0x50')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x5029('0x1f')]({'where':{'closed':![],'MailAccountId':_0x423ed1[_0x5029('0x37')]['id']},'include':[{'model':db[_0x5029('0x51')],'as':_0x5029('0x52'),'attributes':[_0x5029('0x4b')],'where':{'messageId':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x53')]}}]})[_0x5029('0xc')](function(_0x5bf867){if(_0x5bf867){return[_0x5bf867,![]];}return db[_0x5029('0x54')]['create'](_0x4d4a2d)[_0x5029('0xc')](function(_0x4f2f0c){return[_0x4f2f0c,!![]];});});}else{throw new Error(_0x5029('0x55'));}})[_0x5029('0x56')](function(_0x2ad2e3,_0x2f5301){if(_0x2ad2e3){_0x1021ea=_0x2f5301;if(!_0x2f5301){return _0x2ad2e3[_0x5029('0x57')]({'inReplyTo':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4b')],'to':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x30')],'cc':_0x423ed1[_0x5029('0x27')]['message']['cc'],'subject':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4d')],'attach':_0x2ad2e3['attach']?_0x2ad2e3[_0x5029('0x4e')]:_0x423ed1['body'][_0x5029('0x12')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x5029('0x50')),'lastMsgAt':moment()['format'](_0x5029('0x50')),'lastMsgDirection':'in'});}else{return _0x2ad2e3;}}})[_0x5029('0xc')](function(_0x382994){_0x52572a['interaction']=_0x382994[_0x5029('0x41')]({'plain':!![]});_0x52572a['interaction'][_0x5029('0x58')]=_0x1021ea;return db[_0x5029('0x51')][_0x5029('0x59')]({'body':_0x423ed1[_0x5029('0x27')][_0x5029('0x27')],'MailAccountId':_0x423ed1['account']['id'],'MailInteractionId':_0x382994['id'],'direction':'in','ContactId':_0x52572a[_0x5029('0x4a')]['id'],'messageId':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4b')],'from':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x30')],'to':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['to'],'cc':_0x423ed1['body']['message']['cc'],'subject':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4d')],'attach':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4e')],'Attachments':_0x423ed1['body']['message'][_0x5029('0x5a')],'originTo':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x5b')],'originCc':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x5c')],'bcc':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x5d')],'ChatWebsiteId':_0x423ed1['body']['message']['ChatWebsiteId']||null,'originChannel':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x5e')]||_0x5029('0x5f'),'ChatOfflineMessageId':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x60')]||null},{'include':[{'model':db[_0x5029('0x61')],'as':_0x5029('0x62')}]});})['then'](function(_0x4bf5cf){_0x52572a[_0x5029('0x12')]=_0x4bf5cf;if(_0x52572a[_0x5029('0x63')][_0x5029('0x64')]){return db[_0x5029('0x65')][_0x5029('0x1f')]({'attributes':['id',_0x5029('0x66')],'where':{'id':_0x52572a[_0x5029('0x63')]['UserId']}})[_0x5029('0xc')](function(_0x3a0d6f){if(_0x3a0d6f){_0x52572a[_0x5029('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5029('0x67'),'appdata':_0x3a0d6f[_0x5029('0x66')]+','+(_0x52572a[_0x5029('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x5029('0x48')});}return respondWithRpcPromise(_0x5029('0x68'),_0x5029('0x69'),_0x52572a);});}return respondWithRpcPromise('Start',_0x5029('0x69'),_0x52572a);})[_0x5029('0xc')](function(_0x5a35bc){_0x32d8a3(_0x5a35bc);})[_0x5029('0x13')](function(_0x42d795){_0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x42d795[_0x5029('0x12')]));});});}; \ No newline at end of file +var _0x6d38=['result','catch','findAll','options','raw','attributes','limit','map','include','model','then','GetMailAccount','debug','ShowMailAccount','find','smtp','setDataValue','smtpOptions','body','mail','difference','rawAttributes','CompanyId','ListId','from','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','Smtp','CloudProvider','get','account','omit','getSmtpOptions','list','applications','orderBy','autoclose','push','length','close','create','List\x20not\x20found','messageId','generate','subject','attach','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','contact','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailAccount.socket','register','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x6d38[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var moment=require(_0x86d3('0x0'));var BPromise=require(_0x86d3('0x1'));var rs=require(_0x86d3('0x2'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x86d3('0x3'))('rpc');var config=require(_0x86d3('0x4'));var jayson=require(_0x86d3('0x5'));var client=jayson[_0x86d3('0x6')]['http']({'port':0x232c});config[_0x86d3('0x7')]=_[_0x86d3('0x8')](config[_0x86d3('0x7')],{'host':_0x86d3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x86d3('0xa'))[_0x86d3('0xb')](socket);function respondWithRpcPromise(_0xf273f5,_0x499640,_0x4a277e){return new BPromise(function(_0x3ed317,_0x555e6d){return client['request'](_0xf273f5,_0x4a277e)['then'](function(_0x4300e2){logger[_0x86d3('0xc')]('MailAccount,\x20%s,\x20%s',_0x499640,_0x86d3('0xd'));logger['debug'](_0x86d3('0xe'),_0x499640,_0x86d3('0xd'),JSON[_0x86d3('0xf')](_0x4300e2));if(_0x4300e2[_0x86d3('0x10')]){if(_0x4300e2[_0x86d3('0x10')][_0x86d3('0x11')]===0x1f4){logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x4300e2['error'][_0x86d3('0x13')]);return _0x555e6d(_0x4300e2[_0x86d3('0x10')][_0x86d3('0x13')]);}logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x4300e2[_0x86d3('0x10')][_0x86d3('0x13')]);return _0x3ed317(_0x4300e2[_0x86d3('0x10')]['message']);}else{logger[_0x86d3('0xc')](_0x86d3('0x12'),_0x499640,_0x86d3('0xd'));_0x3ed317(_0x4300e2[_0x86d3('0x14')][_0x86d3('0x13')]);}})[_0x86d3('0x15')](function(_0x33e459){logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x33e459);_0x555e6d(_0x33e459);});});}exports['GetMailAccount']=function(_0x191ba5){var _0x57c340=this;return new Promise(function(_0x6ced9e,_0x5c4d55){return db['MailAccount'][_0x86d3('0x16')]({'raw':_0x191ba5[_0x86d3('0x17')]?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x18')]===undefined?!![]:![]:!![],'where':_0x191ba5['options']?_0x191ba5[_0x86d3('0x17')]['where']||null:null,'attributes':_0x191ba5[_0x86d3('0x17')]?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x19')]||null:null,'limit':_0x191ba5['options']?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x1a')]||null:null,'include':_0x191ba5[_0x86d3('0x17')]?_0x191ba5['options']['include']?_[_0x86d3('0x1b')](_0x191ba5['options'][_0x86d3('0x1c')],function(_0x1bea5e){return{'model':db[_0x1bea5e[_0x86d3('0x1d')]],'as':_0x1bea5e['as'],'attributes':_0x1bea5e[_0x86d3('0x19')],'include':_0x1bea5e['include']?_['map'](_0x1bea5e[_0x86d3('0x1c')],function(_0x611764){return{'model':db[_0x611764['model']],'as':_0x611764['as'],'attributes':_0x611764[_0x86d3('0x19')],'include':_0x611764['include']?_[_0x86d3('0x1b')](_0x611764[_0x86d3('0x1c')],function(_0x287b96){return{'model':db[_0x287b96[_0x86d3('0x1d')]],'as':_0x287b96['as'],'attributes':_0x287b96[_0x86d3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x86d3('0x1e')](function(_0x1f203e){logger[_0x86d3('0xc')](_0x86d3('0x1f'),_0x191ba5);logger[_0x86d3('0x20')](_0x86d3('0x1f'),_0x191ba5,JSON[_0x86d3('0xf')](_0x1f203e));_0x6ced9e(_0x1f203e);})[_0x86d3('0x15')](function(_0x28c25e){logger['error'](_0x86d3('0x1f'),_0x28c25e[_0x86d3('0x13')],_0x191ba5);_0x5c4d55(_0x57c340[_0x86d3('0x10')](0x1f4,_0x28c25e[_0x86d3('0x13')]));});});};exports[_0x86d3('0x21')]=function(_0x245e39){var _0x4a5ff0=this;return new Promise(function(_0xba2f49,_0x5c71df){return db['MailAccount'][_0x86d3('0x22')]({'raw':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')]['where']||null:null,'attributes':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')][_0x86d3('0x19')]||null:null,'include':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')][_0x86d3('0x1c')]?_[_0x86d3('0x1b')](_0x245e39[_0x86d3('0x17')]['include'],function(_0x4cdf45){return{'model':db[_0x4cdf45['model']],'as':_0x4cdf45['as'],'attributes':_0x4cdf45[_0x86d3('0x19')],'include':_0x4cdf45['include']?_[_0x86d3('0x1b')](_0x4cdf45['include'],function(_0x366943){return{'model':db[_0x366943[_0x86d3('0x1d')]],'as':_0x366943['as'],'attributes':_0x366943[_0x86d3('0x19')],'include':_0x366943[_0x86d3('0x1c')]?_[_0x86d3('0x1b')](_0x366943[_0x86d3('0x1c')],function(_0x2d15b9){return{'model':db[_0x2d15b9['model']],'as':_0x2d15b9['as'],'attributes':_0x2d15b9[_0x86d3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x86d3('0x1e')](function(_0x5e2519){if(_0x245e39[_0x86d3('0x17')][_0x86d3('0x23')]===!![])_0x5e2519[_0x86d3('0x24')](_0x86d3('0x25'),_0x5e2519['getSmtpOptions']());logger[_0x86d3('0xc')](_0x86d3('0x21'),_0x245e39);logger[_0x86d3('0x20')]('ShowMailAccount',_0x245e39,JSON[_0x86d3('0xf')](_0x5e2519));_0xba2f49(_0x5e2519);})[_0x86d3('0x15')](function(_0x1a1c06){logger[_0x86d3('0x10')](_0x86d3('0x21'),_0x1a1c06[_0x86d3('0x13')],_0x245e39);_0x5c71df(_0x4a5ff0[_0x86d3('0x10')](0x1f4,_0x1a1c06[_0x86d3('0x13')]));});});};exports['NotifyMailAccount']=function(_0x22bc98){var _0x470978=this;return new Promise(function(_0x2bdc67,_0x461052){var _0x5ebb4d={'body':_0x22bc98[_0x86d3('0x26')],'channel':_0x86d3('0x27')};var _0x6f72be=_[_0x86d3('0x28')](_['keys'](db['CmContact'][_0x86d3('0x29')]),['createdAt','updatedAt',_0x86d3('0x2a'),_0x86d3('0x2b')]);var _0x43490a=![];if(_0x22bc98[_0x86d3('0x26')]['id']){delete _0x22bc98[_0x86d3('0x26')]['id'];}if(_['isNil'](_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x86d3('0x2d')](_0x22bc98[_0x86d3('0x26')]['body'])||_0x22bc98[_0x86d3('0x26')][_0x86d3('0x26')]===''){return _0x461052(_0x470978['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2e')])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x86d3('0x2f')+_0x6f72be));}if(!_[_0x86d3('0x30')](_0x6f72be,_0x22bc98[_0x86d3('0x26')]['mapKey'])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x86d3('0x31')+_0x6f72be));}var _0x5d9dad={};_0x5d9dad[_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2e')]]=_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')];return db[_0x86d3('0x32')][_0x86d3('0x22')]({'where':{'id':_0x22bc98['account']['id']},'include':[{'model':db[_0x86d3('0x33')],'as':_0x86d3('0x34'),'include':[{'model':db['CmContact'],'as':_0x86d3('0x35'),'where':_0x5d9dad,'limit':0x1,'order':[[_0x86d3('0x36'),_0x86d3('0x37')]]}]},{'model':db[_0x86d3('0x38')],'as':_0x86d3('0x39')},{'model':db['MailServerOut'],'as':_0x86d3('0x3a'),'include':[{'model':db[_0x86d3('0x3b')],'as':_0x86d3('0x3b')}]}]})[_0x86d3('0x1e')](function(_0x369b75){if(_0x369b75&&_0x369b75[_0x86d3('0x34')]){var _0x1a4345=_0x369b75[_0x86d3('0x3c')]({'plain':!![]});_0x5ebb4d[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x1a4345,[_0x86d3('0x39'),_0x86d3('0x34')]);_0x5ebb4d['account'][_0x86d3('0x25')]=_0x369b75[_0x86d3('0x3f')]();_0x5ebb4d['applications']=_0x1a4345[_0x86d3('0x39')];_0x5ebb4d[_0x86d3('0x40')]=_0x1a4345[_0x86d3('0x34')];_0x5ebb4d[_0x86d3('0x41')]=_[_0x86d3('0x42')](_0x5ebb4d[_0x86d3('0x41')],['priority'],['asc']);if(_0x5ebb4d['account']&&_0x5ebb4d['account'][_0x86d3('0x43')]){_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x44')]({'id':0x0,'priority':_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x45')]+0x1,'app':_0x86d3('0x46'),'appdata':_0x86d3('0x43'),'interval':'*,*,*,*'});}if(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x39')]){delete _0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x39')];}if(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x34')]){delete _0x5ebb4d[_0x86d3('0x3d')]['List'];}if(_0x1a4345[_0x86d3('0x34')]['Contacts'][_0x86d3('0x45')]){return _0x1a4345[_0x86d3('0x34')][_0x86d3('0x35')][0x0];}var _0x3ffd22=_[_0x86d3('0x8')](_0x22bc98['body'],{'firstName':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')],'ListId':_0x1a4345[_0x86d3('0x2b')]});_0x3ffd22[_0x22bc98['body']['mapKey']]=_0x22bc98['body'][_0x86d3('0x2c')];return db['CmContact'][_0x86d3('0x47')](_0x3ffd22);}else{throw new Error(_0x86d3('0x48'));}})[_0x86d3('0x1e')](function(_0x319ea0){_0x5ebb4d['contact']=_0x319ea0;if(_0x319ea0){if(!_0x22bc98['body']['message'][_0x86d3('0x49')]){_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x49')]=rs[_0x86d3('0x4a')]()+'\x20'+_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')];}var _0x5123fd={'ContactId':_0x319ea0['id'],'MailAccountId':_0x22bc98[_0x86d3('0x3d')]['id'],'inReplyTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x49')],'to':_0x22bc98['body'][_0x86d3('0x13')][_0x86d3('0x2c')],'cc':_0x22bc98['body'][_0x86d3('0x13')]['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4c')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x86d3('0x4d')]['find']({'where':{'closed':![],'MailAccountId':_0x22bc98['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x86d3('0x4e'),'attributes':['messageId'],'where':{'messageId':_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x4f')]}}]})[_0x86d3('0x1e')](function(_0xa48003){if(_0xa48003){return[_0xa48003,![]];}return db['MailInteraction']['create'](_0x5123fd)[_0x86d3('0x1e')](function(_0xf2c179){return[_0xf2c179,!![]];});});}else{throw new Error(_0x86d3('0x50'));}})[_0x86d3('0x51')](function(_0x22d8eb,_0x1952af){if(_0x22d8eb){_0x43490a=_0x1952af;if(!_0x1952af){return _0x22d8eb[_0x86d3('0x52')]({'inReplyTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x49')],'to':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')],'cc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22d8eb['attach']?_0x22d8eb[_0x86d3('0x4c')]:_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attach'],'substatus':null,'substatusAt':moment()[_0x86d3('0x53')](_0x86d3('0x54')),'lastMsgAt':moment()[_0x86d3('0x53')](_0x86d3('0x54')),'lastMsgDirection':'in'});}else{return _0x22d8eb;}}})['then'](function(_0x41d448){_0x5ebb4d['interaction']=_0x41d448[_0x86d3('0x3c')]({'plain':!![]});_0x5ebb4d[_0x86d3('0x55')][_0x86d3('0x56')]=_0x43490a;return db[_0x86d3('0x57')][_0x86d3('0x47')]({'body':_0x22bc98['body'][_0x86d3('0x26')],'MailAccountId':_0x22bc98['account']['id'],'MailInteractionId':_0x41d448['id'],'direction':'in','ContactId':_0x5ebb4d[_0x86d3('0x58')]['id'],'messageId':_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x49')],'from':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')],'to':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['to'],'cc':_0x22bc98[_0x86d3('0x26')]['message']['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attach'],'Attachments':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attachments'],'originTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x59')],'originCc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5a')],'bcc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5b')],'ChatWebsiteId':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5c')]||null,'originChannel':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['originChannel']||_0x86d3('0x5d'),'ChatOfflineMessageId':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x86d3('0x5f')}]});})[_0x86d3('0x1e')](function(_0x1a97f3){_0x5ebb4d[_0x86d3('0x13')]=_0x1a97f3;if(_0x5ebb4d['interaction']['UserId']){return db[_0x86d3('0x60')]['find']({'attributes':['id',_0x86d3('0x61')],'where':{'id':_0x5ebb4d['interaction']['UserId']}})[_0x86d3('0x1e')](function(_0x28bd40){if(_0x28bd40){_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x62')]({'id':0x0,'priority':0x0,'app':_0x86d3('0x63'),'appdata':_0x28bd40['name']+','+(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x86d3('0x65'),_0x86d3('0x66'),_0x5ebb4d);});}return respondWithRpcPromise('Start',_0x86d3('0x66'),_0x5ebb4d);})['then'](function(_0x1867fc){_0x2bdc67(_0x1867fc);})['catch'](function(_0x5bb2e5){_0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x5bb2e5['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index ab528be..52a5633 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 _0xd142=['register','length','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd142,0x11a));var _0x2d14=function(_0xb4e052,_0x1d3cb6){_0xb4e052=_0xb4e052-0x0;var _0x5197e7=_0xd142[_0xb4e052];return _0x5197e7;};'use strict';var MailAccountEvents=require(_0x2d14('0x0'));var events=[_0x2d14('0x1'),_0x2d14('0x2'),_0x2d14('0x3')];function createListener(_0x504e32,_0x50b30a){return function(_0x1d9219){_0x50b30a[_0x2d14('0x4')](_0x504e32,_0x1d9219);};}function removeListener(_0x9f6796,_0x41da29){return function(){MailAccountEvents[_0x2d14('0x5')](_0x9f6796,_0x41da29);};}exports[_0x2d14('0x6')]=function(_0xb3acd1){for(var _0x5dd0e5=0x0,_0x5eb081=events[_0x2d14('0x7')];_0x5dd0e5<_0x5eb081;_0x5dd0e5++){var _0xba6306=events[_0x5dd0e5];var _0x1b2d92=createListener('mailAccount:'+_0xba6306,_0xb3acd1);MailAccountEvents['on'](_0xba6306,_0x1b2d92);}}; \ No newline at end of file +var _0x0598=['save','update','emit','register','length','mailAccount:','./mailAccount.events'];(function(_0x297f2e,_0x313d34){var _0x17c191=function(_0x3fcb8f){while(--_0x3fcb8f){_0x297f2e['push'](_0x297f2e['shift']());}};_0x17c191(++_0x313d34);}(_0x0598,0x92));var _0x8059=function(_0x554071,_0x28b592){_0x554071=_0x554071-0x0;var _0x2b89d4=_0x0598[_0x554071];return _0x2b89d4;};'use strict';var MailAccountEvents=require(_0x8059('0x0'));var events=[_0x8059('0x1'),'remove',_0x8059('0x2')];function createListener(_0x52c9bf,_0x4dad54){return function(_0x14109c){_0x4dad54[_0x8059('0x3')](_0x52c9bf,_0x14109c);};}function removeListener(_0x54b9a2,_0x54f42f){return function(){MailAccountEvents['removeListener'](_0x54b9a2,_0x54f42f);};}exports[_0x8059('0x4')]=function(_0xa7d7c1){for(var _0x512c0f=0x0,_0x5996d7=events[_0x8059('0x5')];_0x512c0f<_0x5996d7;_0x512c0f++){var _0x347f1b=events[_0x512c0f];var _0x4610d2=createListener(_0x8059('0x6')+_0x347f1b,_0xa7d7c1);MailAccountEvents['on'](_0x347f1b,_0x4610d2);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f980c5f..a16f96e 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 _0x02be=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put','delete','destroy'];(function(_0x4003fe,_0x38c382){var _0x5af37c=function(_0x112092){while(--_0x112092){_0x4003fe['push'](_0x4003fe['shift']());}};_0x5af37c(++_0x38c382);}(_0x02be,0x166));var _0xe02b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x02be[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0xe02b('0x0'));var util=require(_0xe02b('0x1'));var path=require(_0xe02b('0x2'));var timeout=require(_0xe02b('0x3'));var express=require(_0xe02b('0x4'));var router=express[_0xe02b('0x5')]();var fs_extra=require(_0xe02b('0x6'));var auth=require(_0xe02b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe02b('0x8'));var controller=require(_0xe02b('0x9'));router['get'](_0xe02b('0xa'),auth[_0xe02b('0xb')](),controller[_0xe02b('0xc')]);router[_0xe02b('0xd')](_0xe02b('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe02b('0xe')](_0xe02b('0xa'),auth[_0xe02b('0xb')](),controller[_0xe02b('0xf')]);module[_0xe02b('0x10')]=router; \ No newline at end of file +var _0x7a18=['../../components/interaction/service','../../config/environment','./mailApplication.controller','get','show','put','/:id','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1b09f5,_0x52d403){var _0x3974bf=function(_0x24bb98){while(--_0x24bb98){_0x1b09f5['push'](_0x1b09f5['shift']());}};_0x3974bf(++_0x52d403);}(_0x7a18,0x14a));var _0x87a1=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x7a18[_0x22e47a];return _0x15a12a;};'use strict';var multer=require(_0x87a1('0x0'));var util=require(_0x87a1('0x1'));var path=require(_0x87a1('0x2'));var timeout=require(_0x87a1('0x3'));var express=require(_0x87a1('0x4'));var router=express[_0x87a1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x87a1('0x6'));var config=require(_0x87a1('0x7'));var controller=require(_0x87a1('0x8'));router[_0x87a1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x87a1('0xa')]);router[_0x87a1('0xb')](_0x87a1('0xc'),auth[_0x87a1('0xd')](),controller['update']);router['delete'](_0x87a1('0xc'),auth[_0x87a1('0xd')](),controller[_0x87a1('0xe')]);module[_0x87a1('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0413b63..b37b76f 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 _0xeb6b=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x357b04,_0x3ceabd){var _0x56a565=function(_0x4e26f1){while(--_0x4e26f1){_0x357b04['push'](_0x357b04['shift']());}};_0x56a565(++_0x3ceabd);}(_0xeb6b,0xe3));var _0xbeb6=function(_0xe6be4e,_0x478957){_0xe6be4e=_0xe6be4e-0x0;var _0x182001=_0xeb6b[_0xe6be4e];return _0x182001;};'use strict';var Sequelize=require(_0xbeb6('0x0'));module[_0xbeb6('0x1')]={'priority':{'type':Sequelize[_0xbeb6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbeb6('0x3')],'allowNull':![],'defaultValue':_0xbeb6('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbeb6('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbeb6('0x5')}}; \ No newline at end of file +var _0x71ed=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x5e858f,_0x458155){var _0xfee05a=function(_0x26fe48){while(--_0x26fe48){_0x5e858f['push'](_0x5e858f['shift']());}};_0xfee05a(++_0x458155);}(_0x71ed,0xf8));var _0xd71e=function(_0x294197,_0x9eba68){_0x294197=_0x294197-0x0;var _0x127fc6=_0x71ed[_0x294197];return _0x127fc6;};'use strict';var Sequelize=require(_0xd71e('0x0'));module[_0xd71e('0x1')]={'priority':{'type':Sequelize[_0xd71e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd71e('0x3')],'allowNull':![],'defaultValue':_0xd71e('0x4')},'appdata':{'type':Sequelize[_0xd71e('0x5')]()},'description':{'type':Sequelize[_0xd71e('0x3')]},'interval':{'type':Sequelize[_0xd71e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e4e1190..0e3080f 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4442cc,_0x4b8f77){_0x4442cc=_0x4442cc-0x0;var _0x5efbbe=_0xbdb7[_0x4442cc];return _0x5efbbe;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,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(_0x44cba1,_0x239c52){var _0x1a9235=function(_0x56bde3){while(--_0x56bde3){_0x44cba1['push'](_0x44cba1['shift']());}};_0x1a9235(++_0x239c52);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3f1dd3,_0x4f05a7){_0x3f1dd3=_0x3f1dd3-0x0;var _0x3917f7=_0xf4eb[_0x3f1dd3];return _0x3917f7;};'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 053775c..4db12ec 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 _0x1fa3=['../../config/logger','api','moment','request-promise','path','rimraf','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x57b6ae,_0x2ca66e){var _0x8d7f4a=function(_0x4e8523){while(--_0x4e8523){_0x57b6ae['push'](_0x57b6ae['shift']());}};_0x8d7f4a(++_0x2ca66e);}(_0x1fa3,0x144));var _0x31fa=function(_0x378977,_0x120516){_0x378977=_0x378977-0x0;var _0x313a76=_0x1fa3[_0x378977];return _0x313a76;};'use strict';var _=require('lodash');var util=require(_0x31fa('0x0'));var logger=require(_0x31fa('0x1'))(_0x31fa('0x2'));var moment=require(_0x31fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x31fa('0x4'));var fs=require('fs');var path=require(_0x31fa('0x5'));var rimraf=require(_0x31fa('0x6'));var config=require('../../config/environment');var attributes=require(_0x31fa('0x7'));module['exports']=function(_0x27845f,_0x1753f3){return _0x27845f[_0x31fa('0x8')](_0x31fa('0x9'),attributes,{'tableName':_0x31fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x31fa('0xb'),'collate':_0x31fa('0xc')});}; \ No newline at end of file +var _0xec48=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes','exports','MailApplication','utf8mb4_unicode_ci','lodash','util'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xec48,0xca));var _0x8ec4=function(_0x23931f,_0x44a59c){_0x23931f=_0x23931f-0x0;var _0x2575ce=_0xec48[_0x23931f];return _0x2575ce;};'use strict';var _=require(_0x8ec4('0x0'));var util=require(_0x8ec4('0x1'));var logger=require(_0x8ec4('0x2'))('api');var moment=require(_0x8ec4('0x3'));var BPromise=require(_0x8ec4('0x4'));var rp=require(_0x8ec4('0x5'));var fs=require('fs');var path=require(_0x8ec4('0x6'));var rimraf=require(_0x8ec4('0x7'));var config=require('../../config/environment');var attributes=require(_0x8ec4('0x8'));module[_0x8ec4('0x9')]=function(_0x1f2698,_0x1f2656){return _0x1f2698['define'](_0x8ec4('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8ec4('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index d3f2e5d..a4aad28 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 _0x8f92=['http','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','MailApplication','body','options','raw','where','attributes','limit','then','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x2afccc,_0x443a1a){var _0x485666=function(_0x3ce6a8){while(--_0x3ce6a8){_0x2afccc['push'](_0x2afccc['shift']());}};_0x485666(++_0x443a1a);}(_0x8f92,0x15d));var _0x28f9=function(_0x3c02d8,_0x42d3e8){_0x3c02d8=_0x3c02d8-0x0;var _0x178444=_0x8f92[_0x3c02d8];return _0x178444;};'use strict';var _=require(_0x28f9('0x0'));var util=require(_0x28f9('0x1'));var moment=require(_0x28f9('0x2'));var BPromise=require(_0x28f9('0x3'));var rs=require(_0x28f9('0x4'));var fs=require('fs');var Redis=require(_0x28f9('0x5'));var db=require(_0x28f9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x28f9('0x7'))(_0x28f9('0x8'));var config=require(_0x28f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x28f9('0xa')][_0x28f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1488a1,_0x84ac35,_0x40ac1f){return new BPromise(function(_0xcf0f57,_0x1f5b5e){return client['request'](_0x1488a1,_0x40ac1f)['then'](function(_0x4cb4f2){logger[_0x28f9('0xc')](_0x28f9('0xd'),_0x84ac35,'request\x20sent');logger['debug'](_0x28f9('0xe'),_0x84ac35,_0x28f9('0xf'),JSON[_0x28f9('0x10')](_0x4cb4f2));if(_0x4cb4f2[_0x28f9('0x11')]){if(_0x4cb4f2[_0x28f9('0x11')][_0x28f9('0x12')]===0x1f4){logger[_0x28f9('0x11')](_0x28f9('0xd'),_0x84ac35,_0x4cb4f2['error'][_0x28f9('0x13')]);return _0x1f5b5e(_0x4cb4f2[_0x28f9('0x11')][_0x28f9('0x13')]);}logger[_0x28f9('0x11')](_0x28f9('0xd'),_0x84ac35,_0x4cb4f2['error']['message']);return _0xcf0f57(_0x4cb4f2[_0x28f9('0x11')][_0x28f9('0x13')]);}else{logger[_0x28f9('0xc')](_0x28f9('0xd'),_0x84ac35,'request\x20sent');_0xcf0f57(_0x4cb4f2[_0x28f9('0x14')]['message']);}})['catch'](function(_0x19f806){logger[_0x28f9('0x11')]('MailApplication,\x20%s,\x20%s',_0x84ac35,_0x19f806);_0x1f5b5e(_0x19f806);});});}exports['UpdateMailApplication']=function(_0x235b02){var _0x39a093=this;return new Promise(function(_0x4ab86f,_0xcf16cf){return db[_0x28f9('0x15')]['update'](_0x235b02[_0x28f9('0x16')],{'raw':_0x235b02[_0x28f9('0x17')]?_0x235b02[_0x28f9('0x17')][_0x28f9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x235b02[_0x28f9('0x17')]?_0x235b02[_0x28f9('0x17')][_0x28f9('0x19')]||null:null,'attributes':_0x235b02[_0x28f9('0x17')]?_0x235b02['options'][_0x28f9('0x1a')]||null:null,'limit':_0x235b02['options']?_0x235b02[_0x28f9('0x17')][_0x28f9('0x1b')]||null:null})[_0x28f9('0x1c')](function(_0x1a1c5a){logger['info'](_0x28f9('0x1d'),_0x235b02);logger['debug'](_0x28f9('0x1d'),_0x235b02,JSON[_0x28f9('0x10')](_0x1a1c5a));_0x4ab86f(_0x1a1c5a);})['catch'](function(_0x363a8f){logger['error'](_0x28f9('0x1d'),_0x363a8f[_0x28f9('0x13')],_0x235b02);_0xcf16cf(_0x39a093[_0x28f9('0x11')](0x1f4,_0x363a8f[_0x28f9('0x13')]));});});}; \ No newline at end of file +var _0x29b1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','info','message','catch','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x29b1,0x16d));var _0x129b=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x29b1[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x129b('0x0'));var util=require(_0x129b('0x1'));var moment=require(_0x129b('0x2'));var BPromise=require(_0x129b('0x3'));var rs=require(_0x129b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x129b('0x5'))['db'];var utils=require(_0x129b('0x6'));var logger=require(_0x129b('0x7'))(_0x129b('0x8'));var config=require(_0x129b('0x9'));var jayson=require(_0x129b('0xa'));var client=jayson[_0x129b('0xb')][_0x129b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ce8f9,_0x3ef769,_0x5ac368){return new BPromise(function(_0x2c99a1,_0x1e29d6){return client['request'](_0x5ce8f9,_0x5ac368)[_0x129b('0xd')](function(_0x1abf45){logger['info'](_0x129b('0xe'),_0x3ef769,'request\x20sent');logger[_0x129b('0xf')](_0x129b('0x10'),_0x3ef769,_0x129b('0x11'),JSON['stringify'](_0x1abf45));if(_0x1abf45[_0x129b('0x12')]){if(_0x1abf45[_0x129b('0x12')][_0x129b('0x13')]===0x1f4){logger[_0x129b('0x12')]('MailApplication,\x20%s,\x20%s',_0x3ef769,_0x1abf45['error']['message']);return _0x1e29d6(_0x1abf45[_0x129b('0x12')]['message']);}logger[_0x129b('0x12')](_0x129b('0xe'),_0x3ef769,_0x1abf45[_0x129b('0x12')]['message']);return _0x2c99a1(_0x1abf45[_0x129b('0x12')]['message']);}else{logger[_0x129b('0x14')](_0x129b('0xe'),_0x3ef769,_0x129b('0x11'));_0x2c99a1(_0x1abf45['result'][_0x129b('0x15')]);}})[_0x129b('0x16')](function(_0x1364f8){logger[_0x129b('0x12')](_0x129b('0xe'),_0x3ef769,_0x1364f8);_0x1e29d6(_0x1364f8);});});}exports[_0x129b('0x17')]=function(_0x135b42){var _0x169d4c=this;return new Promise(function(_0x299bb5,_0xecba14){return db[_0x129b('0x18')][_0x129b('0x19')](_0x135b42['body'],{'raw':_0x135b42[_0x129b('0x1a')]?_0x135b42[_0x129b('0x1a')][_0x129b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x135b42[_0x129b('0x1a')]?_0x135b42[_0x129b('0x1a')][_0x129b('0x1c')]||null:null,'attributes':_0x135b42[_0x129b('0x1a')]?_0x135b42[_0x129b('0x1a')][_0x129b('0x1d')]||null:null,'limit':_0x135b42[_0x129b('0x1a')]?_0x135b42[_0x129b('0x1a')][_0x129b('0x1e')]||null:null})['then'](function(_0x29c2e1){logger[_0x129b('0x14')](_0x129b('0x17'),_0x135b42);logger[_0x129b('0xf')]('UpdateMailApplication',_0x135b42,JSON['stringify'](_0x29c2e1));_0x299bb5(_0x29c2e1);})[_0x129b('0x16')](function(_0x5b345e){logger[_0x129b('0x12')](_0x129b('0x17'),_0x5b345e['message'],_0x135b42);_0xecba14(_0x169d4c['error'](0x1f4,_0x5b345e[_0x129b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 13c8577..ac457b9 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 _0x675e=['describe','/:id','show','/:id/messages','isAuthenticated','/:id/download','post','addMessage','mailinteraction:addtags','put','tracked','mail','mailinteraction:update','update','delete','mailinteraction:destroy','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','index','get','/describe'];(function(_0x1815a5,_0x286537){var _0x31c7ed=function(_0x4c1c52){while(--_0x4c1c52){_0x1815a5['push'](_0x1815a5['shift']());}};_0x31c7ed(++_0x286537);}(_0x675e,0xb5));var _0xe675=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0x675e[_0x1f62c3];return _0x385c1c;};'use strict';var express=require(_0xe675('0x0'));var router=express[_0xe675('0x1')]();var auth=require(_0xe675('0x2'));var interaction=require(_0xe675('0x3'));var controller=require(_0xe675('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xe675('0x5')]);router[_0xe675('0x6')](_0xe675('0x7'),auth['isAuthenticated'](),controller[_0xe675('0x8')]);router['get'](_0xe675('0x9'),auth['isAuthenticated'](),controller[_0xe675('0xa')]);router[_0xe675('0x6')](_0xe675('0xb'),auth[_0xe675('0xc')](),controller['getMessages']);router[_0xe675('0x6')](_0xe675('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xe675('0xe')]('/',auth[_0xe675('0xc')](),controller['create']);router[_0xe675('0xe')](_0xe675('0xb'),auth[_0xe675('0xc')](),controller[_0xe675('0xf')]);router[_0xe675('0xe')]('/:id/tags',auth[_0xe675('0xc')](),interaction['tracked']('mail',_0xe675('0x10')),controller['addTags']);router[_0xe675('0x11')](_0xe675('0x9'),auth[_0xe675('0xc')](),interaction[_0xe675('0x12')](_0xe675('0x13'),_0xe675('0x14')),controller[_0xe675('0x15')]);router[_0xe675('0x16')](_0xe675('0x9'),auth[_0xe675('0xc')](),interaction['tracked'](_0xe675('0x13'),_0xe675('0x17')),controller['destroy']);router[_0xe675('0x16')](_0xe675('0x18'),auth['isAuthenticated'](),controller[_0xe675('0x19')]);module[_0xe675('0x1a')]=router; \ No newline at end of file +var _0x9ad5=['../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','show','getMessages','download','create','post','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','mailinteraction:destroy','destroy','exports','Router'];(function(_0x3a99ea,_0x986362){var _0xd8ab6d=function(_0x2f4f0d){while(--_0x2f4f0d){_0x3a99ea['push'](_0x3a99ea['shift']());}};_0xd8ab6d(++_0x986362);}(_0x9ad5,0xf9));var _0x59ad=function(_0x201c58,_0x18f3a4){_0x201c58=_0x201c58-0x0;var _0xe754a3=_0x9ad5[_0x201c58];return _0xe754a3;};'use strict';var express=require('express');var router=express[_0x59ad('0x0')]();var auth=require(_0x59ad('0x1'));var interaction=require(_0x59ad('0x2'));var controller=require(_0x59ad('0x3'));router[_0x59ad('0x4')]('/',auth['isAuthenticated'](),controller[_0x59ad('0x5')]);router[_0x59ad('0x4')](_0x59ad('0x6'),auth[_0x59ad('0x7')](),controller[_0x59ad('0x8')]);router[_0x59ad('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x59ad('0x9')]);router[_0x59ad('0x4')]('/:id/messages',auth[_0x59ad('0x7')](),controller[_0x59ad('0xa')]);router[_0x59ad('0x4')]('/:id/download',auth[_0x59ad('0x7')](),controller[_0x59ad('0xb')]);router['post']('/',auth[_0x59ad('0x7')](),controller[_0x59ad('0xc')]);router[_0x59ad('0xd')]('/:id/messages',auth[_0x59ad('0x7')](),controller['addMessage']);router['post'](_0x59ad('0xe'),auth[_0x59ad('0x7')](),interaction[_0x59ad('0xf')](_0x59ad('0x10'),_0x59ad('0x11')),controller[_0x59ad('0x12')]);router[_0x59ad('0x13')](_0x59ad('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x59ad('0x10'),_0x59ad('0x15')),controller['update']);router['delete'](_0x59ad('0x14'),auth['isAuthenticated'](),interaction[_0x59ad('0xf')](_0x59ad('0x10'),_0x59ad('0x16')),controller[_0x59ad('0x17')]);router['delete'](_0x59ad('0xe'),auth['isAuthenticated'](),controller['removeTags']);module[_0x59ad('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 045bcfe..6f173d2 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 _0x6dff=['BOOLEAN','DATE','ENUM','out','sequelize','iconv','exports','STRING','TEXT'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x6dff,0x12d));var _0xf6df=function(_0x2c8411,_0x4c8332){_0x2c8411=_0x2c8411-0x0;var _0x4865ee=_0x6dff[_0x2c8411];return _0x4865ee;};'use strict';var Sequelize=require(_0xf6df('0x0'));var iconv=require(_0xf6df('0x1'));module[_0xf6df('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf6df('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf6df('0x3')]},'inReplyTo':{'type':Sequelize[_0xf6df('0x3')](0x1fe)},'to':{'type':Sequelize[_0xf6df('0x3')]},'cc':{'type':Sequelize[_0xf6df('0x4')]('long')},'subject':{'type':Sequelize[_0xf6df('0x4')]()},'attach':{'type':Sequelize[_0xf6df('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf6df('0x6')]},'substatus':{'type':Sequelize[_0xf6df('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xf6df('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xf6df('0x7')]('in',_0xf6df('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf6df('0x7')]('in',_0xf6df('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x999b=['iconv','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize'];(function(_0x128221,_0x1848ea){var _0x195298=function(_0x207b82){while(--_0x207b82){_0x128221['push'](_0x128221['shift']());}};_0x195298(++_0x1848ea);}(_0x999b,0x167));var _0xb999=function(_0x838b0e,_0xb96931){_0x838b0e=_0x838b0e-0x0;var _0x18b475=_0x999b[_0x838b0e];return _0x18b475;};'use strict';var Sequelize=require(_0xb999('0x0'));var iconv=require(_0xb999('0x1'));module['exports']={'closed':{'type':Sequelize[_0xb999('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb999('0x3')]},'disposition':{'type':Sequelize[_0xb999('0x4')]},'secondDisposition':{'type':Sequelize[_0xb999('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb999('0x4')]},'note':{'type':Sequelize[_0xb999('0x4')]},'inReplyTo':{'type':Sequelize[_0xb999('0x4')](0x1fe)},'to':{'type':Sequelize[_0xb999('0x4')]},'cc':{'type':Sequelize[_0xb999('0x5')](_0xb999('0x6'))},'subject':{'type':Sequelize[_0xb999('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb999('0x3')]},'substatus':{'type':Sequelize[_0xb999('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xb999('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb999('0x7')]('in',_0xb999('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb999('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb999('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c725879..9248b3c 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 _0x2b29=['i.MailAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','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)','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','Setting','findOne','enableEmailPreview','all','rows','params','keys','include','create','body','describe','addMessage','MailMessage','omit','ids','getMessages','nolimit','pick','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','true','setTags','color','emit','mailInteractionTags:save','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','subject','Messages','decode','headers','bcc','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','update','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','push','out','plainBody','-id','lastMsgText','trimStart','catch','waiting','answered','total','closed','UserId','talking','index','MailInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','model','hasOwnProperty','limit','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','o.id\x20=\x20i.UserId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','MailAccountId'];(function(_0x323042,_0x3f2395){var _0x3559e7=function(_0x46d18e){while(--_0x46d18e){_0x323042['push'](_0x323042['shift']());}};_0x3559e7(++_0x3f2395);}(_0x2b29,0x163));var _0x92b2=function(_0x31406d,_0x12258e){_0x31406d=_0x31406d-0x0;var _0xf6bd42=_0x2b29[_0x31406d];return _0xf6bd42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92b2('0x0'));var zipdir=require(_0x92b2('0x1'));var moment=require(_0x92b2('0x2'));var BPromise=require(_0x92b2('0x3'));var util=require('util');var path=require(_0x92b2('0x4'));var fs=require('fs');var _=require(_0x92b2('0x5'));var squel=require(_0x92b2('0x6'));var juice=require(_0x92b2('0x7'));var Redis=require(_0x92b2('0x8'));var qs=require(_0x92b2('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x92b2('0xa'))('api');var config=require(_0x92b2('0xb'));var db=require(_0x92b2('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x92b2('0xd')]=_[_0x92b2('0xe')](config[_0x92b2('0xd')],{'host':_0x92b2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x92b2('0xd')]));require(_0x92b2('0x10'))[_0x92b2('0x11')](socket);function respondWithStatusCode(_0x1ef7f3,_0x2949e0){_0x2949e0=_0x2949e0||0xcc;return function(_0x421889){if(_0x421889){return _0x1ef7f3[_0x92b2('0x12')](_0x2949e0);}return _0x1ef7f3['status'](_0x2949e0)[_0x92b2('0x13')]();};}function respondWithResult(_0x2c0d0f,_0x160e75){_0x160e75=_0x160e75||0xc8;return function(_0x58b009){if(_0x58b009){return _0x2c0d0f[_0x92b2('0x14')](_0x160e75)[_0x92b2('0x15')](_0x58b009);}};}function respondWithFilteredResult(_0x3c5db1,_0x4d597b){return function(_0x12c2d1){if(_0x12c2d1){var _0x179834=typeof _0x4d597b['offset']===_0x92b2('0x16')&&typeof _0x4d597b['limit']===_0x92b2('0x16');var _0x2be641=_0x12c2d1[_0x92b2('0x17')];var _0x4899fa=_0x179834?0x0:_0x4d597b['offset'];var _0xbb9cef=_0x179834?_0x12c2d1['count']:_0x4d597b[_0x92b2('0x18')]+_0x4d597b['limit'];var _0x42872b;if(_0xbb9cef>=_0x2be641){_0xbb9cef=_0x2be641;_0x42872b=0xc8;}else{_0x42872b=0xce;}_0x3c5db1[_0x92b2('0x14')](_0x42872b);return _0x3c5db1[_0x92b2('0x19')](_0x92b2('0x1a'),_0x4899fa+'-'+_0xbb9cef+'/'+_0x2be641)[_0x92b2('0x15')](_0x12c2d1);}return null;};}function saveUpdates(_0x3dfd47){return function(_0x1cb43e){if(_0x1cb43e){return _0x1cb43e[_0x92b2('0x1b')](_0x3dfd47)[_0x92b2('0x1c')](function(_0xa08831){return _0xa08831;});}return null;};}function removeEntity(_0xfd81c5){return function(_0x3bdda8){if(_0x3bdda8){return _0x3bdda8[_0x92b2('0x1d')]()[_0x92b2('0x1c')](function(){_0xfd81c5[_0x92b2('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46078b){return function(_0x546c1c){if(!_0x546c1c){_0x46078b[_0x92b2('0x12')](0x194);}return _0x546c1c;};}function handleError(_0xe6f05f,_0x2b372c){_0x2b372c=_0x2b372c||0x1f4;return function(_0x1e09b6){logger[_0x92b2('0x1e')](_0x1e09b6['stack']);if(_0x1e09b6['name']){delete _0x1e09b6[_0x92b2('0x1f')];}_0xe6f05f[_0x92b2('0x14')](_0x2b372c)[_0x92b2('0x20')](_0x1e09b6);};}function getInteractionUsers(_0x386a80,_0x5a6c76){return new BPromise(function(_0x30a205,_0x15faf5){try{if(_0x5a6c76[_0x386a80['id']]){_0x386a80[_0x92b2('0x21')]=_[_0x92b2('0x22')](_0x5a6c76[_0x386a80['id']],function(_0x573df3){return{'id':_0x573df3['id'],'fullname':_0x573df3[_0x92b2('0x23')]};});}}catch(_0x57c1ff){_0x15faf5(_0x57c1ff);}_0x30a205(_0x386a80);});}function getInteractionTags(_0x183f81,_0x4a587f){return new BPromise(function(_0x5e9688,_0x105270){try{if(_0x183f81[_0x92b2('0x24')]){_0x183f81[_0x92b2('0x25')]=[];_0x183f81['TagIds'][_0x92b2('0x26')](',')['forEach'](function(_0x124a0d){_0x183f81[_0x92b2('0x25')][_0x92b2('0x27')](_0x4a587f[_0x124a0d]);});}delete _0x183f81[_0x92b2('0x24')];}catch(_0x368998){_0x105270(_0x368998);}_0x5e9688(_0x183f81);});}function getLastMessageText(_0x7b6e4e){return new BPromise(function(_0x3b676f,_0x515a62){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x7b6e4e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x92b2('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x92b2('0x29')],'order':_0x92b2('0x2a'),'raw':!![]})['then'](function(_0x5d2e5f){if(_0x5d2e5f&&_0x5d2e5f[_0x92b2('0x29')]){_0x7b6e4e[_0x92b2('0x2b')]=_[_0x92b2('0x2c')](_0x5d2e5f[_0x92b2('0x29')]);}_0x3b676f(_0x7b6e4e);})[_0x92b2('0x2d')](function(_0x56802f){_0x515a62(_0x56802f);});});}function updateMailInteraction(_0x5378fb,_0x49cb88,_0x22ea02,_0x16361a){return new BPromise(function(_0x5f4e09,_0xf7083e){return getInteractionUsers(_0x5378fb,_0x22ea02)[_0x92b2('0x1c')](function(_0x10f817){return getInteractionTags(_0x10f817,_0x49cb88);})[_0x92b2('0x1c')](function(_0x1f5d72){return getStateInteraction(_0x1f5d72);})[_0x92b2('0x1c')](function(_0x212590){if(_0x16361a){_0x5f4e09(getLastMessageText(_0x212590));}else{_0x5f4e09(_0x212590);}})[_0x92b2('0x2d')](function(_0x5edf58){_0xf7083e(_0x5edf58);});});}function getStateInteraction(_0x21e052){return new BPromise(function(_0x226875){_0x21e052[_0x92b2('0x2e')]=0x0;_0x21e052['talking']=0x0;_0x21e052[_0x92b2('0x2f')]=0x0;_0x21e052['unmanaged']=0x0;_0x21e052[_0x92b2('0x30')]=0x0;if(!_0x21e052[_0x92b2('0x31')]&&!_0x21e052['UserId']){_0x21e052['waiting']+=0x1;}if(!_0x21e052[_0x92b2('0x31')]&&_0x21e052[_0x92b2('0x32')]){_0x21e052['talking']+=0x1;if(_0x21e052['waiting']){_0x21e052[_0x92b2('0x2e')]-=0x1;}}if(_0x21e052[_0x92b2('0x31')]&&_0x21e052['UserId']){_0x21e052[_0x92b2('0x2f')]+=0x1;if(_0x21e052[_0x92b2('0x33')]){_0x21e052[_0x92b2('0x33')]-=0x1;}}if(_0x21e052['closed']&&!_0x21e052[_0x92b2('0x32')]){_0x21e052['unmanaged']+=0x1;if(_0x21e052[_0x92b2('0x2e')]){_0x21e052[_0x92b2('0x2e')]-=0x1;}}_0x21e052[_0x92b2('0x30')]+=0x1;_0x226875(_0x21e052);});}exports[_0x92b2('0x34')]=function(_0x181b88,_0x333fd1){var _0x49c37f={},_0x9822b3={},_0x35ca4d={'count':0x0,'rows':[]};var _0x5d1d48=_[_0x92b2('0x22')](db[_0x92b2('0x35')][_0x92b2('0x36')],function(_0xf5f958){return{'name':_0xf5f958[_0x92b2('0x37')],'type':_0xf5f958[_0x92b2('0x38')][_0x92b2('0x39')]};});_0x9822b3['model']=_[_0x92b2('0x22')](_0x5d1d48,'name');_0x9822b3[_0x92b2('0x3a')]=_['keys'](_0x181b88[_0x92b2('0x3a')]);_0x9822b3[_0x92b2('0x3b')]=_[_0x92b2('0x3c')](_0x9822b3['model'],_0x9822b3[_0x92b2('0x3a')]);_0x49c37f[_0x92b2('0x3d')]=_[_0x92b2('0x3c')](_0x9822b3['model'],qs[_0x92b2('0x3e')](_0x181b88[_0x92b2('0x3a')][_0x92b2('0x3e')]));_0x49c37f[_0x92b2('0x3d')]=_0x49c37f['attributes']['length']?_0x49c37f['attributes']:_0x9822b3[_0x92b2('0x3f')];if(!_0x181b88[_0x92b2('0x3a')][_0x92b2('0x40')]('nolimit')){_0x49c37f[_0x92b2('0x41')]=qs['limit'](_0x181b88[_0x92b2('0x3a')][_0x92b2('0x41')]);_0x49c37f[_0x92b2('0x18')]=qs[_0x92b2('0x18')](_0x181b88[_0x92b2('0x3a')][_0x92b2('0x18')]);}_0x49c37f[_0x92b2('0x42')]=qs[_0x92b2('0x43')](_0x181b88[_0x92b2('0x3a')][_0x92b2('0x43')]);_0x49c37f[_0x92b2('0x44')]=qs[_0x92b2('0x3b')](_['pick'](_0x181b88[_0x92b2('0x3a')],_0x9822b3['filters']),_0x5d1d48);var _0x191e15=[];var _0x524630=squel[_0x92b2('0x45')]()[_0x92b2('0x46')]('id')[_0x92b2('0x46')]('name')[_0x92b2('0x46')]('color')[_0x92b2('0x47')](_0x92b2('0x48'));var _0x56c02a=squel[_0x92b2('0x45')]()[_0x92b2('0x46')](_0x92b2('0x49'))[_0x92b2('0x46')](_0x92b2('0x4a'))[_0x92b2('0x46')](_0x92b2('0x4b'))[_0x92b2('0x47')](_0x92b2('0x4c'),'ui')[_0x92b2('0x4d')](_0x92b2('0x4e'),'u',_0x92b2('0x4f'));var _0x3b85e2=squel[_0x92b2('0x45')]()['from'](_0x92b2('0x50'),'i')[_0x92b2('0x4d')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x92b2('0x4e'),'o',_0x92b2('0x51'))['left_join']('mail_accounts','a','a.id\x20=\x20i.MailAccountId')[_0x92b2('0x4d')](_0x92b2('0x52'),'me',_0x92b2('0x53'))[_0x92b2('0x4d')](_0x92b2('0x54'),'it',_0x92b2('0x55'))[_0x92b2('0x4d')](_0x92b2('0x48'),'t','t.id\x20=\x20it.TagId');var _0x595b48=squel['expr']();var _0x32fa61=[];var _0x4d3f8f=squel[_0x92b2('0x56')]();var _0x5e5100;if(_0x181b88[_0x92b2('0x3a')][_0x92b2('0x57')]){_0x5e5100=as[_0x92b2('0x58')](_0x181b88[_0x92b2('0x3a')]['search']);var _0xe6ff4f=_0x5e5100[_0x92b2('0x59')];for(var _0x32ce92=0x0;_0x32ce92<_0x5e5100[_0x92b2('0x5a')][_0x92b2('0x5b')];_0x32ce92++){var _0x39a59a=_0x5e5100[_0x92b2('0x5a')][_0x32ce92];var _0x1ca5b3='i';var _0x30ff03=_[_0x92b2('0x5c')](_0x5d1d48,[_0x92b2('0x1f'),_0x39a59a[_0x92b2('0x46')]]);if(!_0x30ff03){switch(_0x39a59a[_0x92b2('0x46')]){case _0x92b2('0x5d'):if(_0x39a59a[_0x92b2('0x5e')]==0x1){_0x3b85e2['having']('`'+_0x39a59a['field']+_0x92b2('0x5f'));}else{_0x3b85e2[_0x92b2('0x60')]('`'+_0x39a59a[_0x92b2('0x46')]+'`\x20>\x200');}break;case _0x92b2('0x61'):if(_0x39a59a[_0x92b2('0x62')]===_0x92b2('0x63')){if(_0x39a59a[_0x92b2('0x5e')][_0x92b2('0x26')]('\x20')[_0x92b2('0x5b')]>0x1){_0x595b48[_0xe6ff4f](_0x92b2('0x64'),qs['getFullTextValue'](_0x39a59a[_0x92b2('0x5e')]),null);}else{var _0x27e273='%'+_0x39a59a[_0x92b2('0x5e')]+'%';_0x595b48[_0xe6ff4f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x27e273,_0x27e273,_0x27e273);}}else{_0x30ff03=_[_0x92b2('0x5c')](_0x5d1d48,[_0x92b2('0x1f'),'ContactId']);_0x39a59a['field']=_0x92b2('0x65');_0x16fd27=as[_0x92b2('0x66')](_0x1ca5b3,_0x30ff03['type'],_0x39a59a);_0x595b48[_0xe6ff4f](_0x16fd27[_0x92b2('0x67')],_0x16fd27[_0x92b2('0x5e')][_0x92b2('0x68')],_0x16fd27[_0x92b2('0x5e')][_0x92b2('0x13')]);}break;case _0x92b2('0x69'):var _0x21d3d0=_0x39a59a[_0x92b2('0x5e')][_0x92b2('0x26')](',')[_0x92b2('0x22')](function(_0x4d4e90){return Number(_0x4d4e90);});_0x21d3d0[_0x92b2('0x6a')](function(_0x169126){_0x4d3f8f['or'](_0x92b2('0x6b'),'%,'+_0x169126+',%');});_0x32fa61=_[_0x92b2('0x6c')](_0x32fa61,_0x21d3d0);break;case _0x92b2('0x6d'):if(_0x39a59a['operator']==='$substring'){_0x595b48[_0xe6ff4f](_0x92b2('0x6e'),'%'+_0x39a59a[_0x92b2('0x5e')]+'%',null);}else{_0x30ff03=_[_0x92b2('0x5c')](_0x5d1d48,[_0x92b2('0x1f'),_0x92b2('0x32')]);_0x39a59a[_0x92b2('0x46')]=_0x92b2('0x32');_0x16fd27=as['buildExpression'](_0x1ca5b3,_0x30ff03[_0x92b2('0x38')],_0x39a59a);_0x595b48[_0xe6ff4f](_0x16fd27[_0x92b2('0x67')],_0x16fd27['value'][_0x92b2('0x68')],_0x16fd27['value'][_0x92b2('0x13')]);}break;case _0x92b2('0x29'):_0x16fd27=as[_0x92b2('0x66')]('me',null,_0x39a59a);_0x595b48[_0xe6ff4f](_0x16fd27['text'],_0x16fd27['value'][_0x92b2('0x68')],_0x16fd27['value']['end']);break;}}else{var _0x16fd27=as[_0x92b2('0x66')](_0x1ca5b3,_0x30ff03[_0x92b2('0x38')],_0x39a59a);_0x595b48[_0xe6ff4f](_0x16fd27[_0x92b2('0x67')],_0x16fd27[_0x92b2('0x5e')][_0x92b2('0x68')],_0x16fd27[_0x92b2('0x5e')]['end']);}}}else{var _0x3ba3ca=_(_0x181b88[_0x92b2('0x3a')])['keys']()[_0x92b2('0x22')](function(_0x43661b){return _[_0x92b2('0x6f')](_0x5d1d48,[_0x92b2('0x1f'),_0x43661b])?_0x43661b:undefined;})[_0x92b2('0x70')]()['value']();if(!_[_0x92b2('0x71')](_0x3ba3ca)){_0x3ba3ca[_0x92b2('0x6a')](function(_0x479a59){if(_0x479a59===_0x92b2('0x72')){_0x3b85e2[_0x92b2('0x44')](_0x92b2('0x73'),[][_0x92b2('0x74')](_0x181b88[_0x92b2('0x3a')][_0x479a59]));}else if(_0x479a59===_0x92b2('0x75')){var _0x1b7f9d=JSON['parse'](_0x181b88[_0x92b2('0x3a')][_0x479a59])[_0x92b2('0x76')];var _0xf14365=JSON[_0x92b2('0x77')](_0x181b88['query'][_0x479a59])[_0x92b2('0x78')];_0x3b85e2[_0x92b2('0x44')](_0x92b2('0x79'),_0x1b7f9d,_0xf14365);}else{if(_0x181b88[_0x92b2('0x3a')][_0x479a59]==='null'){_0x3b85e2[_0x92b2('0x44')]('i.'+_0x479a59+_0x92b2('0x7a'));}else{_0x3b85e2[_0x92b2('0x44')]('i.'+_0x479a59+_0x92b2('0x7b'),_0x181b88[_0x92b2('0x3a')][_0x479a59]);}}});}if(_0x181b88[_0x92b2('0x3a')][_0x92b2('0x7c')]){if(_0x181b88[_0x92b2('0x3a')][_0x92b2('0x7c')]==0x1){_0x3b85e2[_0x92b2('0x60')](_0x92b2('0x7d'));}else{_0x3b85e2[_0x92b2('0x60')](_0x92b2('0x7e'));}}if(_0x181b88[_0x92b2('0x3a')][_0x92b2('0x7f')]){_0x32fa61=_[_0x92b2('0x80')](_0x181b88[_0x92b2('0x3a')][_0x92b2('0x7f')])?_0x181b88[_0x92b2('0x3a')][_0x92b2('0x7f')]:new Array(_0x181b88[_0x92b2('0x3a')][_0x92b2('0x7f')]);_0x32fa61['forEach'](function(_0x4c49af){_0x4d3f8f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4c49af+',%');});}if(_0x181b88['query'][_0x92b2('0x81')]){var _0x12a079=_0x181b88[_0x92b2('0x3a')]['filter'][_0x92b2('0x82')]('\x5c','\x5c\x5c')[_0x92b2('0x82')](/'/g,'\x27\x27');if(qs[_0x92b2('0x83')](_0x12a079)){_0x595b48['or'](_0x92b2('0x84'),_0x12a079+'%');}else if(qs['isEmail'](_0x12a079)){_0x595b48['or'](_0x92b2('0x85'),_0x12a079+'%');}else{_0x595b48['or'](_0x92b2('0x86'),qs[_0x92b2('0x87')](_0x12a079))['or'](_0x92b2('0x88'),qs[_0x92b2('0x87')](_0x12a079));}}}_0x3b85e2[_0x92b2('0x44')](_0x595b48);_0x3b85e2[_0x92b2('0x89')](_0x92b2('0x8a'));var _0x8fcd9a={'type':db[_0x92b2('0x8b')]['QueryTypes'][_0x92b2('0x8c')],'raw':!![]};var _0x20f6d0=_0x3b85e2['clone']();_0x20f6d0[_0x92b2('0x46')](_0x92b2('0x8a'));_0x20f6d0[_0x92b2('0x46')](_0x92b2('0x8d'),_0x92b2('0x5d'));if(_0x49c37f[_0x92b2('0x42')]){_0x49c37f[_0x92b2('0x42')][_0x92b2('0x6a')](function(_0x131788){var _0x248f80=_0x131788[0x0]===_0x92b2('0x8e')?_0x131788[0x0]:'i.'+_0x131788[0x0];_0x3b85e2[_0x92b2('0x42')](_0x248f80,_0x131788[0x1]===_0x92b2('0x8f')?![]:!![]);});}if(!_[_0x92b2('0x71')](_0x32fa61)){_0x3b85e2[_0x92b2('0x60')](_0x4d3f8f);_0x20f6d0[_0x92b2('0x44')](_0x92b2('0x90'),_0x32fa61);}BPromise['resolve']()[_0x92b2('0x1c')](function(){if(!_0x5e5100){if(_0x181b88[_0x92b2('0x3a')][_0x92b2('0x72')])return;_0x20f6d0[_0x92b2('0x44')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x3b85e2['where'](_0x92b2('0x91'));return;}if(_0x181b88['user'][_0x92b2('0x92')]!==_0x92b2('0x93'))return;return _0x181b88[_0x92b2('0x94')][_0x92b2('0x95')]({'attributes':['id'],'raw':!![]})[_0x92b2('0x1c')](function(_0x225580){if(_[_0x92b2('0x71')](_0x225580)){_0x20f6d0[_0x92b2('0x44')]('i.MailAccountId\x20IS\x20NULL');_0x3b85e2[_0x92b2('0x44')](_0x92b2('0x96'));}else{_0x20f6d0['where'](_0x92b2('0x73'),_['map'](_0x225580,'id'));_0x3b85e2[_0x92b2('0x44')]('i.MailAccountId\x20IN\x20?',_[_0x92b2('0x22')](_0x225580,'id'));}});})[_0x92b2('0x1c')](function(){if(_0x181b88[_0x92b2('0x94')][_0x92b2('0x92')]===_0x92b2('0x93')&&!_0x5e5100&&!_0x181b88[_0x92b2('0x3a')][_0x92b2('0x72')])return[];return db[_0x92b2('0x97')]['query'](_0x20f6d0[_0x92b2('0x98')](),_0x8fcd9a);})['then'](function(_0x42dae7){_0x35ca4d[_0x92b2('0x17')]=_0x42dae7[_0x92b2('0x5b')];if(_0x35ca4d[_0x92b2('0x17')]===0x0)return[];return db[_0x92b2('0x97')][_0x92b2('0x3a')](_0x524630[_0x92b2('0x98')](),_0x8fcd9a)['then'](function(_0xed7f70){_0x191e15=_[_0x92b2('0x99')](_0xed7f70,'id');_0x8fcd9a=_[_0x92b2('0x9a')](_0x8fcd9a,{'model':db[_0x92b2('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x181b88['query'][_0x92b2('0x3e')]){_0x49c37f['attributes'][_0x92b2('0x6a')](function(_0x11315a){_0x3b85e2[_0x92b2('0x46')]('i.'+_0x11315a);});}else{_0x3b85e2[_0x92b2('0x46')](_0x92b2('0x8d'),_0x92b2('0x5d'));_0x3b85e2[_0x92b2('0x46')](_0x92b2('0x9b'),_0x92b2('0x9c'));_0x3b85e2['field'](_0x92b2('0x9d'),_0x92b2('0x9e'));_0x3b85e2['field'](_0x92b2('0x9f'),'contactName');_0x3b85e2[_0x92b2('0x46')](_0x92b2('0x8a'));_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xa0'));_0x3b85e2[_0x92b2('0x46')]('i.updatedAt');_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xa1'));_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xa2'));_0x3b85e2[_0x92b2('0x46')]('i.attach');_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xa3'));_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xa4'));_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xa5'));_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xa6'));_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xa7'));_0x3b85e2['field'](_0x92b2('0xa8'));_0x3b85e2['field'](_0x92b2('0xa9'));_0x3b85e2[_0x92b2('0x46')]('i.to');_0x3b85e2[_0x92b2('0x46')]('i.ContactId');_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xaa'));_0x3b85e2[_0x92b2('0x46')]('i.UserId');_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xab'),_0x92b2('0xac'));_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xad'),_0x92b2('0xae'));_0x3b85e2['field'](_0x92b2('0xaf'),_0x92b2('0xb0'));_0x3b85e2['field']('c.phone',_0x92b2('0xb1'));_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xb2'),_0x92b2('0xb3'));_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xb4'),'Contact.fax');_0x3b85e2[_0x92b2('0x46')](_0x92b2('0xb5'),_0x92b2('0xb6'));_0x3b85e2[_0x92b2('0x46')]('o.internal','Owner.internal');_0x3b85e2['field'](_0x92b2('0xb7'),_0x92b2('0x24'));}if(_0x49c37f[_0x92b2('0x41')])_0x3b85e2[_0x92b2('0x41')](_0x49c37f['limit']);if(_0x49c37f['offset'])_0x3b85e2[_0x92b2('0x18')](_0x49c37f[_0x92b2('0x18')]);return db['sequelize'][_0x92b2('0x3a')](_0x3b85e2[_0x92b2('0x98')](),_0x8fcd9a);})['then'](function(_0x20a362){if(_0x20a362[_0x92b2('0x5b')]>0x0)_0x56c02a[_0x92b2('0x44')](_0x92b2('0xb8'),_[_0x92b2('0x22')](_0x20a362,'id'));return db[_0x92b2('0x97')][_0x92b2('0x3a')](_0x56c02a[_0x92b2('0x98')](),_0x8fcd9a)[_0x92b2('0x1c')](function(_0x4d32dc){var _0x1d61ea=_['groupBy'](_0x4d32dc,'MailInteractionId');var _0x1f7493=[];return db[_0x92b2('0xb9')][_0x92b2('0xba')]({'attributes':[_0x92b2('0xbb')],'raw':!![]})['then'](function(_0x56e25d){var _0x4dba37=_0x56e25d[_0x92b2('0xbb')];_0x20a362[_0x92b2('0x6a')](function(_0xd82833){_0x1f7493[_0x92b2('0x27')](updateMailInteraction(_0xd82833,_0x191e15,_0x1d61ea,_0x4dba37));});return BPromise[_0x92b2('0xbc')](_0x1f7493);});});});})[_0x92b2('0x1c')](function(_0x1e0d61){_0x35ca4d[_0x92b2('0xbd')]=_0x1e0d61;return _0x35ca4d;})['then'](respondWithFilteredResult(_0x333fd1,_0x49c37f))['catch'](handleError(_0x333fd1,null));};exports['show']=function(_0x40ec20,_0x24dc07){var _0x300f25={'raw':![],'where':{'id':_0x40ec20[_0x92b2('0xbe')]['id']}},_0x40002d={};_0x40002d[_0x92b2('0x3f')]=_[_0x92b2('0xbf')](db[_0x92b2('0x35')][_0x92b2('0x36')]);_0x40002d[_0x92b2('0x3a')]=_[_0x92b2('0xbf')](_0x40ec20[_0x92b2('0x3a')]);_0x40002d['filters']=_[_0x92b2('0x3c')](_0x40002d['model'],_0x40002d[_0x92b2('0x3a')]);_0x300f25['attributes']=_[_0x92b2('0x3c')](_0x40002d[_0x92b2('0x3f')],qs['fields'](_0x40ec20[_0x92b2('0x3a')][_0x92b2('0x3e')]));_0x300f25[_0x92b2('0x3d')]=_0x300f25[_0x92b2('0x3d')]['length']?_0x300f25[_0x92b2('0x3d')]:_0x40002d[_0x92b2('0x3f')];if(_0x40ec20[_0x92b2('0x3a')]['includeAll']){_0x300f25[_0x92b2('0xc0')]=[{'all':!![]}];}_0x300f25=_[_0x92b2('0x9a')]({},_0x300f25,_0x40ec20['options']);return db[_0x92b2('0x35')][_0x92b2('0x5c')](_0x300f25)['then'](handleEntityNotFound(_0x24dc07,null))[_0x92b2('0x1c')](respondWithResult(_0x24dc07,null))[_0x92b2('0x2d')](handleError(_0x24dc07,null));};exports[_0x92b2('0xc1')]=function(_0x47fb98,_0x55c58f){return db['MailInteraction'][_0x92b2('0xc1')](_0x47fb98[_0x92b2('0xc2')],{})[_0x92b2('0x1c')](respondWithResult(_0x55c58f,0xc9))['catch'](handleError(_0x55c58f,null));};exports[_0x92b2('0x1b')]=function(_0x2dc8f4,_0xd1db27){if(_0x2dc8f4[_0x92b2('0xc2')]['id']){delete _0x2dc8f4[_0x92b2('0xc2')]['id'];}return db[_0x92b2('0x35')][_0x92b2('0x5c')]({'where':{'id':_0x2dc8f4['params']['id']}})[_0x92b2('0x1c')](handleEntityNotFound(_0xd1db27,null))[_0x92b2('0x1c')](saveUpdates(_0x2dc8f4[_0x92b2('0xc2')],null))[_0x92b2('0x1c')](respondWithResult(_0xd1db27,null))[_0x92b2('0x2d')](handleError(_0xd1db27,null));};exports['destroy']=function(_0x3568b7,_0x139a86){return db[_0x92b2('0x35')]['find']({'where':{'id':_0x3568b7[_0x92b2('0xbe')]['id']}})[_0x92b2('0x1c')](handleEntityNotFound(_0x139a86,null))[_0x92b2('0x1c')](removeEntity(_0x139a86,null))['catch'](handleError(_0x139a86,null));};exports[_0x92b2('0xc3')]=function(_0x194fff,_0x42c47f){return db[_0x92b2('0x35')][_0x92b2('0xc3')]()[_0x92b2('0x1c')](respondWithResult(_0x42c47f,null))[_0x92b2('0x2d')](handleError(_0x42c47f,null));};exports[_0x92b2('0xc4')]=function(_0x1c2571,_0x520d2c){return db[_0x92b2('0xc5')][_0x92b2('0x5c')]({'where':{'id':_0x1c2571[_0x92b2('0xbe')]['id']}})[_0x92b2('0x1c')](handleEntityNotFound(_0x520d2c,null))[_0x92b2('0x1c')](function(_0x1308d8){if(_0x1308d8){return _0x1308d8[_0x92b2('0xc4')](_0x1c2571[_0x92b2('0xc2')]['ids'],_[_0x92b2('0xc6')](_0x1c2571[_0x92b2('0xc2')],[_0x92b2('0xc7'),'id'])||{});}})[_0x92b2('0x1c')](respondWithResult(_0x520d2c,null))[_0x92b2('0x2d')](handleError(_0x520d2c,null));};exports[_0x92b2('0xc8')]=function(_0x286553,_0x353535){var _0x346a38={'raw':![],'where':{}};var _0x10cec6={};var _0x4f97cd={'count':0x0,'rows':[]};return db[_0x92b2('0x35')][_0x92b2('0xba')]({'where':{'id':_0x286553[_0x92b2('0xbe')]['id']}})[_0x92b2('0x1c')](handleEntityNotFound(_0x353535,null))[_0x92b2('0x1c')](function(_0x26d5ae){if(_0x26d5ae){_0x10cec6[_0x92b2('0x3f')]=_[_0x92b2('0xbf')](db[_0x92b2('0xc5')][_0x92b2('0x36')]);_0x10cec6[_0x92b2('0x3a')]=_['keys'](_0x286553[_0x92b2('0x3a')]);_0x10cec6['filters']=_[_0x92b2('0x3c')](_0x10cec6[_0x92b2('0x3f')],_0x10cec6[_0x92b2('0x3a')]);_0x346a38[_0x92b2('0x3d')]=_[_0x92b2('0x3c')](_0x10cec6[_0x92b2('0x3f')],qs[_0x92b2('0x3e')](_0x286553[_0x92b2('0x3a')][_0x92b2('0x3e')]));_0x346a38['attributes']=_0x346a38['attributes'][_0x92b2('0x5b')]?_0x346a38['attributes']:_0x10cec6[_0x92b2('0x3f')];if(!_0x286553['query'][_0x92b2('0x40')](_0x92b2('0xc9'))){_0x346a38[_0x92b2('0x41')]=qs[_0x92b2('0x41')](_0x286553['query']['limit']);_0x346a38[_0x92b2('0x18')]=qs['offset'](_0x286553[_0x92b2('0x3a')]['offset']);}_0x346a38[_0x92b2('0x42')]=qs['sort'](_0x286553[_0x92b2('0x3a')]['sort']);_0x346a38['where']=qs[_0x92b2('0x3b')](_[_0x92b2('0xca')](_0x286553[_0x92b2('0x3a')],_0x10cec6[_0x92b2('0x3b')]));_0x346a38[_0x92b2('0x44')][_0x92b2('0xcb')]=_0x26d5ae['id'];if(_0x286553['query'][_0x92b2('0x81')]){_0x346a38['where']=_[_0x92b2('0x9a')](_0x346a38['where'],{'$or':_[_0x92b2('0x22')](_0x346a38[_0x92b2('0x3d')],function(_0x2b639e){var _0x1ad83f={};_0x1ad83f[_0x2b639e]={'$like':'%'+_0x286553[_0x92b2('0x3a')][_0x92b2('0x81')]+'%'};return _0x1ad83f;})});}if(_0x286553[_0x92b2('0x3a')]['$gte']){var _0x3d9ac2=_0x286553[_0x92b2('0x3a')][_0x92b2('0x76')][_0x92b2('0x26')](',');var _0x350761={};_0x350761[_0x3d9ac2[0x0]]={'$gte':moment(_0x3d9ac2[0x1])[_0x92b2('0xcc')](_0x92b2('0xcd'))};_0x346a38[_0x92b2('0x44')]=_[_0x92b2('0x9a')](_0x346a38[_0x92b2('0x44')],_0x350761);}_0x346a38=_[_0x92b2('0x9a')]({},_0x346a38,_0x286553['options']);return db[_0x92b2('0xc5')][_0x92b2('0x17')]({'where':_0x346a38[_0x92b2('0x44')]})[_0x92b2('0x1c')](function(_0x163c4e){_0x4f97cd[_0x92b2('0x17')]=_0x163c4e;if(_0x286553['query'][_0x92b2('0xce')]){_0x346a38[_0x92b2('0xc0')]=[{'all':!![]}];}return db['MailMessage'][_0x92b2('0xcf')](_0x346a38);})[_0x92b2('0x1c')](function(_0xf49624){if(_0x286553[_0x92b2('0x3a')][_0x92b2('0xd0')]===_0x92b2('0xd1')){for(var _0x587d41=0x0;_0x587d41<_0xf49624[_0x92b2('0x5b')];_0x587d41++){_0xf49624[_0x587d41][_0x92b2('0xc2')]=juice(_0xf49624[_0x587d41][_0x92b2('0xc2')]);}}_0x4f97cd['rows']=_0xf49624;return _0x4f97cd;});}})[_0x92b2('0x1c')](respondWithFilteredResult(_0x353535,_0x346a38))[_0x92b2('0x2d')](handleError(_0x353535,null));};exports['addTags']=function(_0xb62792,_0x3743c0){return db[_0x92b2('0x35')][_0x92b2('0x5c')]({'where':{'id':_0xb62792['params']['id']}})[_0x92b2('0x1c')](handleEntityNotFound(_0x3743c0,null))[_0x92b2('0x1c')](function(_0x4d0935){if(_0x4d0935){return _0x4d0935[_0x92b2('0xd2')](_0xb62792[_0x92b2('0xc2')][_0x92b2('0xc7')],_[_0x92b2('0xc6')](_0xb62792['body'],[_0x92b2('0xc7'),'id'])||{})['spread'](function(){return db[_0x92b2('0x69')][_0x92b2('0xcf')]({'attributes':['id',_0x92b2('0x1f'),_0x92b2('0xd3')],'where':{'id':_0xb62792[_0x92b2('0xc2')][_0x92b2('0xc7')]}});})[_0x92b2('0x1c')](function(_0x2ba04d){socket[_0x92b2('0xd4')](_0x92b2('0xd5'),{'id':Number(_0xb62792[_0x92b2('0xbe')]['id']),'tags':_0x2ba04d||[]});return{'id':Number(_0xb62792[_0x92b2('0xbe')]['id']),'tags':_0x2ba04d||[]};});}})[_0x92b2('0x1c')](respondWithResult(_0x3743c0,null))[_0x92b2('0x2d')](handleError(_0x3743c0,null));};exports['removeTags']=function(_0x92fe34,_0x4d7d7f){return db['MailInteraction'][_0x92b2('0x5c')]({'where':{'id':_0x92fe34[_0x92b2('0xbe')]['id']}})[_0x92b2('0x1c')](handleEntityNotFound(_0x4d7d7f,null))[_0x92b2('0x1c')](function(_0x5a3871){if(_0x5a3871){return _0x5a3871['removeTags'](_0x92fe34[_0x92b2('0x3a')][_0x92b2('0xc7')]);}})[_0x92b2('0x1c')](respondWithStatusCode(_0x4d7d7f,null))['catch'](handleError(_0x4d7d7f,null));};exports[_0x92b2('0xd6')]=function(_0x6442ab,_0x595c31){var _0x1d267e=moment()[_0x92b2('0xd7')]()['toString']();var _0x59d2fb=path[_0x92b2('0xd8')](config[_0x92b2('0xd9')],_0x92b2('0xda'),_0x92b2('0xdb'),'tmp');var _0x4608a3=path[_0x92b2('0xd8')](config[_0x92b2('0xd9')],_0x92b2('0xda'),_0x92b2('0xdb'),_0x92b2('0xdc'));var _0x353b20=path[_0x92b2('0xd8')](_0x59d2fb,_0x1d267e);var _0x39631d=util[_0x92b2('0xcc')](_0x92b2('0xdd'),_0x6442ab[_0x92b2('0xbe')]['id'],_0x1d267e);var _0x23154f=path[_0x92b2('0xd8')](_0x59d2fb,_0x39631d);var _0x3e2690=[];if(_0x6442ab[_0x92b2('0x3a')][_0x92b2('0xdc')]){_0x3e2690[_0x92b2('0x27')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x27264c=[{'model':db[_0x92b2('0xc5')],'as':'Messages','attributes':['id','body',_0x92b2('0x47'),'to','cc','bcc',_0x92b2('0xde'),_0x92b2('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x3e2690}];return db[_0x92b2('0x35')]['find']({'where':{'id':_0x6442ab[_0x92b2('0xbe')]['id']},'include':_0x27264c})[_0x92b2('0x1c')](handleEntityNotFound(_0x595c31,null))[_0x92b2('0x1c')](function(_0x23769f){if(_0x23769f&&_0x23769f[_0x92b2('0xdf')]){var _0x3d29e7=_0x23769f['get']({'plain':!![]});fs['mkdirSync'](_0x353b20);return BPromise['each'](_0x3d29e7['Messages'],function(_0x289ff9,_0x4f0a1c){var _0x1f0587={'from':_0x289ff9['from'],'to':_0x289ff9['to'],'subject':_0x289ff9[_0x92b2('0xde')],'html':htmlEntities[_0x92b2('0xe0')](_0x289ff9[_0x92b2('0xc2')]),'headers':{'Date':moment(_0x289ff9[_0x92b2('0x75')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x289ff9['cc']){_0x1f0587[_0x92b2('0xe1')]['Cc']=_0x289ff9['cc'];}if(_0x289ff9[_0x92b2('0xe2')]){_0x1f0587[_0x92b2('0xe1')][_0x92b2('0xe3')]=_0x289ff9[_0x92b2('0xe2')];}return new BPromise(function(_0x14b22f,_0x3fab75){if(_0x289ff9['Attachments']){for(var _0xcc380b=0x0;_0xcc380b<_0x289ff9[_0x92b2('0xe4')][_0x92b2('0x5b')];_0xcc380b++){var _0x4ad0ed=_0x289ff9[_0x92b2('0xe4')][_0xcc380b];var _0x3e28c2=path[_0x92b2('0xd8')](_0x4608a3,_0x4ad0ed[_0x92b2('0xe5')]);if(fs[_0x92b2('0xe6')](_0x3e28c2)){_0x1f0587[_0x92b2('0xdc')][_0x92b2('0x27')]({'name':_0x4ad0ed[_0x92b2('0x1f')],'contentType':_0x4ad0ed[_0x92b2('0x38')],'data':fs[_0x92b2('0xe7')](_0x3e28c2)});}}}emlformat[_0x92b2('0xe8')](_0x1f0587,function(_0x305068,_0x5b41d6){if(_0x305068)return _0x3fab75(_0x305068);fs[_0x92b2('0xe9')](path[_0x92b2('0xd8')](_0x353b20,util[_0x92b2('0xcc')]('message%d.eml',_0x4f0a1c)),_0x5b41d6);return _0x14b22f(_0x5b41d6);});});})[_0x92b2('0x1c')](function(){return new BPromise(function(_0x2f3714,_0x27d6f3){zipdir(_0x353b20,{'saveTo':_0x23154f},function(_0x3460ea,_0xf0b185){if(_0x3460ea)return _0x27d6f3(_0x3460ea);return _0x2f3714(_0xf0b185);});})[_0x92b2('0x1c')](function(){return new BPromise(function(_0x291be6,_0xdf415a){rimraf(_0x353b20,function(_0x3bc7e0){if(_0x3bc7e0)_0xdf415a(_0x3bc7e0);return _0x291be6();});});})[_0x92b2('0x1c')](function(){return _0x595c31['download'](_0x23154f,_0x39631d,function(_0x13b75d){if(!_0x13b75d)fs[_0x92b2('0xea')](_0x23154f);});});});}else{return _0x595c31['sendStatus'](0xc8);}})[_0x92b2('0x2d')](handleError(_0x595c31,null));}; \ No newline at end of file +var _0x1dcc=['setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','Attachment','Attachments','bcc','subject','Messages','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','build','unlinkSync','eml-format','rimraf','zip-dir','moment','util','lodash','squel','juice','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','html-entities','defaults','localhost','redis','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','plainBody','-id','lastMsgText','trimStart','catch','waiting','answered','unmanaged','total','closed','UserId','talking','MailInteraction','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.MailInteractionId','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','QueryTypes','clone','i.id','order','isEmpty','t.id\x20IN\x20?','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','all','rows','params','includeAll','include','options','create','body','describe','addMessage','omit','ids','getMessages','MailInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss'];(function(_0x1c811c,_0xd79f6a){var _0x2d2438=function(_0x361f8d){while(--_0x361f8d){_0x1c811c['push'](_0x1c811c['shift']());}};_0x2d2438(++_0xd79f6a);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x1a31e3,_0x27b280){_0x1a31e3=_0x1a31e3-0x0;var _0x23f42c=_0x1dcc[_0x1a31e3];return _0x23f42c;};'use strict';var emlformat=require(_0xc1dc('0x0'));var rimraf=require(_0xc1dc('0x1'));var zipdir=require(_0xc1dc('0x2'));var moment=require(_0xc1dc('0x3'));var BPromise=require('bluebird');var util=require(_0xc1dc('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xc1dc('0x5'));var squel=require(_0xc1dc('0x6'));var juice=require(_0xc1dc('0x7'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0xc1dc('0x8'));var logger=require(_0xc1dc('0x9'))(_0xc1dc('0xa'));var config=require('../../config/environment');var db=require(_0xc1dc('0xb'))['db'];var htmlEntities=require(_0xc1dc('0xc'));config['redis']=_[_0xc1dc('0xd')](config['redis'],{'host':_0xc1dc('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1dc('0xf')]));require(_0xc1dc('0x10'))[_0xc1dc('0x11')](socket);function respondWithStatusCode(_0x3eb1f3,_0x466f31){_0x466f31=_0x466f31||0xcc;return function(_0x616175){if(_0x616175){return _0x3eb1f3[_0xc1dc('0x12')](_0x466f31);}return _0x3eb1f3[_0xc1dc('0x13')](_0x466f31)[_0xc1dc('0x14')]();};}function respondWithResult(_0x4a2c0c,_0x226ba3){_0x226ba3=_0x226ba3||0xc8;return function(_0x2c5f41){if(_0x2c5f41){return _0x4a2c0c[_0xc1dc('0x13')](_0x226ba3)['json'](_0x2c5f41);}};}function respondWithFilteredResult(_0x73b54c,_0x7d7257){return function(_0x299520){if(_0x299520){var _0xd51b1e=typeof _0x7d7257[_0xc1dc('0x15')]===_0xc1dc('0x16')&&typeof _0x7d7257[_0xc1dc('0x17')]===_0xc1dc('0x16');var _0x265929=_0x299520[_0xc1dc('0x18')];var _0x1cbbfe=_0xd51b1e?0x0:_0x7d7257['offset'];var _0x16ec8b=_0xd51b1e?_0x299520[_0xc1dc('0x18')]:_0x7d7257[_0xc1dc('0x15')]+_0x7d7257[_0xc1dc('0x17')];var _0x47c72e;if(_0x16ec8b>=_0x265929){_0x16ec8b=_0x265929;_0x47c72e=0xc8;}else{_0x47c72e=0xce;}_0x73b54c[_0xc1dc('0x13')](_0x47c72e);return _0x73b54c[_0xc1dc('0x19')]('Content-Range',_0x1cbbfe+'-'+_0x16ec8b+'/'+_0x265929)['json'](_0x299520);}return null;};}function saveUpdates(_0x3f96d3){return function(_0x250e5c){if(_0x250e5c){return _0x250e5c[_0xc1dc('0x1a')](_0x3f96d3)[_0xc1dc('0x1b')](function(_0x1707dc){return _0x1707dc;});}return null;};}function removeEntity(_0x3570f0){return function(_0xedc38f){if(_0xedc38f){return _0xedc38f[_0xc1dc('0x1c')]()['then'](function(){_0x3570f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x477998){return function(_0x2b7927){if(!_0x2b7927){_0x477998['sendStatus'](0x194);}return _0x2b7927;};}function handleError(_0x367965,_0x19325f){_0x19325f=_0x19325f||0x1f4;return function(_0x3f6552){logger[_0xc1dc('0x1d')](_0x3f6552[_0xc1dc('0x1e')]);if(_0x3f6552[_0xc1dc('0x1f')]){delete _0x3f6552[_0xc1dc('0x1f')];}_0x367965[_0xc1dc('0x13')](_0x19325f)[_0xc1dc('0x20')](_0x3f6552);};}function getInteractionUsers(_0x1a6d65,_0x49aab6){return new BPromise(function(_0x18ef1e,_0xfeb0b1){try{if(_0x49aab6[_0x1a6d65['id']]){_0x1a6d65[_0xc1dc('0x21')]=_[_0xc1dc('0x22')](_0x49aab6[_0x1a6d65['id']],function(_0x4e3ab2){return{'id':_0x4e3ab2['id'],'fullname':_0x4e3ab2[_0xc1dc('0x23')]};});}}catch(_0x109e88){_0xfeb0b1(_0x109e88);}_0x18ef1e(_0x1a6d65);});}function getInteractionTags(_0xfd3f88,_0x7c0254){return new BPromise(function(_0x354e71,_0x152a50){try{if(_0xfd3f88[_0xc1dc('0x24')]){_0xfd3f88[_0xc1dc('0x25')]=[];_0xfd3f88[_0xc1dc('0x24')]['split'](',')[_0xc1dc('0x26')](function(_0x25b7bf){_0xfd3f88[_0xc1dc('0x25')][_0xc1dc('0x27')](_0x7c0254[_0x25b7bf]);});}delete _0xfd3f88[_0xc1dc('0x24')];}catch(_0x4750a9){_0x152a50(_0x4750a9);}_0x354e71(_0xfd3f88);});}function getLastMessageText(_0x14dec0){return new BPromise(function(_0xc248f7,_0x336add){return db[_0xc1dc('0x28')][_0xc1dc('0x29')]({'where':{'$and':[{'MailInteractionId':_0x14dec0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xc1dc('0x2a')],'order':_0xc1dc('0x2b'),'raw':!![]})[_0xc1dc('0x1b')](function(_0x18305e){if(_0x18305e&&_0x18305e[_0xc1dc('0x2a')]){_0x14dec0[_0xc1dc('0x2c')]=_[_0xc1dc('0x2d')](_0x18305e[_0xc1dc('0x2a')]);}_0xc248f7(_0x14dec0);})[_0xc1dc('0x2e')](function(_0x57c75f){_0x336add(_0x57c75f);});});}function updateMailInteraction(_0x5cf727,_0x3ae791,_0x120e73,_0x1d02ec){return new BPromise(function(_0xcb8634,_0x3e6a68){return getInteractionUsers(_0x5cf727,_0x120e73)[_0xc1dc('0x1b')](function(_0x5c5490){return getInteractionTags(_0x5c5490,_0x3ae791);})[_0xc1dc('0x1b')](function(_0x40f76e){return getStateInteraction(_0x40f76e);})['then'](function(_0x280050){if(_0x1d02ec){_0xcb8634(getLastMessageText(_0x280050));}else{_0xcb8634(_0x280050);}})[_0xc1dc('0x2e')](function(_0x55376e){_0x3e6a68(_0x55376e);});});}function getStateInteraction(_0x1e279d){return new BPromise(function(_0x8bf56c){_0x1e279d[_0xc1dc('0x2f')]=0x0;_0x1e279d['talking']=0x0;_0x1e279d[_0xc1dc('0x30')]=0x0;_0x1e279d[_0xc1dc('0x31')]=0x0;_0x1e279d[_0xc1dc('0x32')]=0x0;if(!_0x1e279d[_0xc1dc('0x33')]&&!_0x1e279d[_0xc1dc('0x34')]){_0x1e279d[_0xc1dc('0x2f')]+=0x1;}if(!_0x1e279d[_0xc1dc('0x33')]&&_0x1e279d[_0xc1dc('0x34')]){_0x1e279d[_0xc1dc('0x35')]+=0x1;if(_0x1e279d['waiting']){_0x1e279d[_0xc1dc('0x2f')]-=0x1;}}if(_0x1e279d[_0xc1dc('0x33')]&&_0x1e279d[_0xc1dc('0x34')]){_0x1e279d['answered']+=0x1;if(_0x1e279d[_0xc1dc('0x35')]){_0x1e279d[_0xc1dc('0x35')]-=0x1;}}if(_0x1e279d[_0xc1dc('0x33')]&&!_0x1e279d[_0xc1dc('0x34')]){_0x1e279d[_0xc1dc('0x31')]+=0x1;if(_0x1e279d[_0xc1dc('0x2f')]){_0x1e279d[_0xc1dc('0x2f')]-=0x1;}}_0x1e279d[_0xc1dc('0x32')]+=0x1;_0x8bf56c(_0x1e279d);});}exports['index']=function(_0x16356d,_0x1557b4){var _0x425faf={},_0x1b1b38={},_0x1d8107={'count':0x0,'rows':[]};var _0x1fbdb8=_['map'](db[_0xc1dc('0x36')][_0xc1dc('0x37')],function(_0x2ec4a0){return{'name':_0x2ec4a0[_0xc1dc('0x38')],'type':_0x2ec4a0[_0xc1dc('0x39')]['key']};});_0x1b1b38['model']=_[_0xc1dc('0x22')](_0x1fbdb8,_0xc1dc('0x1f'));_0x1b1b38[_0xc1dc('0x3a')]=_[_0xc1dc('0x3b')](_0x16356d[_0xc1dc('0x3a')]);_0x1b1b38[_0xc1dc('0x3c')]=_[_0xc1dc('0x3d')](_0x1b1b38['model'],_0x1b1b38[_0xc1dc('0x3a')]);_0x425faf[_0xc1dc('0x3e')]=_[_0xc1dc('0x3d')](_0x1b1b38['model'],qs[_0xc1dc('0x3f')](_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x3f')]));_0x425faf[_0xc1dc('0x3e')]=_0x425faf['attributes']['length']?_0x425faf[_0xc1dc('0x3e')]:_0x1b1b38[_0xc1dc('0x40')];if(!_0x16356d['query'][_0xc1dc('0x41')](_0xc1dc('0x42'))){_0x425faf[_0xc1dc('0x17')]=qs[_0xc1dc('0x17')](_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x17')]);_0x425faf[_0xc1dc('0x15')]=qs['offset'](_0x16356d['query'][_0xc1dc('0x15')]);}_0x425faf['order']=qs[_0xc1dc('0x43')](_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x43')]);_0x425faf[_0xc1dc('0x44')]=qs[_0xc1dc('0x3c')](_[_0xc1dc('0x45')](_0x16356d[_0xc1dc('0x3a')],_0x1b1b38[_0xc1dc('0x3c')]),_0x1fbdb8);var _0x48bbf3=[];var _0x71779d=squel[_0xc1dc('0x46')]()[_0xc1dc('0x47')]('id')[_0xc1dc('0x47')](_0xc1dc('0x1f'))[_0xc1dc('0x47')](_0xc1dc('0x48'))[_0xc1dc('0x49')](_0xc1dc('0x4a'));var _0x29417d=squel['select']()['field']('u.id')[_0xc1dc('0x47')](_0xc1dc('0x4b'))['field'](_0xc1dc('0x4c'))[_0xc1dc('0x49')]('user_has_mail_interactions','ui')[_0xc1dc('0x4d')]('users','u',_0xc1dc('0x4e'));var _0x1d1706=squel[_0xc1dc('0x46')]()[_0xc1dc('0x49')](_0xc1dc('0x4f'),'i')[_0xc1dc('0x4d')](_0xc1dc('0x50'),'c',_0xc1dc('0x51'))['left_join'](_0xc1dc('0x52'),'o',_0xc1dc('0x53'))[_0xc1dc('0x4d')](_0xc1dc('0x54'),'a','a.id\x20=\x20i.MailAccountId')[_0xc1dc('0x4d')](_0xc1dc('0x55'),'me',_0xc1dc('0x56'))[_0xc1dc('0x4d')](_0xc1dc('0x57'),'it',_0xc1dc('0x58'))[_0xc1dc('0x4d')](_0xc1dc('0x4a'),'t','t.id\x20=\x20it.TagId');var _0x1dd081=squel[_0xc1dc('0x59')]();var _0x3bb51c=[];var _0x437e9c=squel[_0xc1dc('0x59')]();var _0x44921f;if(_0x16356d[_0xc1dc('0x3a')]['search']){_0x44921f=as[_0xc1dc('0x5a')](_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x5b')]);var _0x35ec6b=_0x44921f[_0xc1dc('0x5c')];for(var _0x3883c1=0x0;_0x3883c1<_0x44921f[_0xc1dc('0x5d')][_0xc1dc('0x5e')];_0x3883c1++){var _0x9bce20=_0x44921f['conditions'][_0x3883c1];var _0xc7fd75='i';var _0x5ba08c=_[_0xc1dc('0x5f')](_0x1fbdb8,[_0xc1dc('0x1f'),_0x9bce20[_0xc1dc('0x47')]]);if(!_0x5ba08c){switch(_0x9bce20[_0xc1dc('0x47')]){case _0xc1dc('0x60'):if(_0x9bce20[_0xc1dc('0x61')]==0x1){_0x1d1706[_0xc1dc('0x62')]('`'+_0x9bce20['field']+_0xc1dc('0x63'));}else{_0x1d1706[_0xc1dc('0x62')]('`'+_0x9bce20['field']+'`\x20>\x200');}break;case _0xc1dc('0x64'):if(_0x9bce20[_0xc1dc('0x65')]===_0xc1dc('0x66')){if(_0x9bce20[_0xc1dc('0x61')]['split']('\x20')['length']>0x1){_0x1dd081[_0x35ec6b](_0xc1dc('0x67'),qs[_0xc1dc('0x68')](_0x9bce20[_0xc1dc('0x61')]),null);}else{var _0x509607='%'+_0x9bce20[_0xc1dc('0x61')]+'%';_0x1dd081[_0x35ec6b](_0xc1dc('0x69'),_0x509607,_0x509607,_0x509607);}}else{_0x5ba08c=_[_0xc1dc('0x5f')](_0x1fbdb8,[_0xc1dc('0x1f'),_0xc1dc('0x6a')]);_0x9bce20['field']=_0xc1dc('0x6a');_0x4f5c32=as[_0xc1dc('0x6b')](_0xc7fd75,_0x5ba08c[_0xc1dc('0x39')],_0x9bce20);_0x1dd081[_0x35ec6b](_0x4f5c32[_0xc1dc('0x6c')],_0x4f5c32[_0xc1dc('0x61')][_0xc1dc('0x6d')],_0x4f5c32[_0xc1dc('0x61')][_0xc1dc('0x14')]);}break;case _0xc1dc('0x6e'):var _0x5a314c=_0x9bce20['value'][_0xc1dc('0x6f')](',')[_0xc1dc('0x22')](function(_0x470411){return Number(_0x470411);});_0x5a314c[_0xc1dc('0x26')](function(_0x2f089d){_0x437e9c['or'](_0xc1dc('0x70'),'%,'+_0x2f089d+',%');});_0x3bb51c=_[_0xc1dc('0x71')](_0x3bb51c,_0x5a314c);break;case _0xc1dc('0x72'):if(_0x9bce20[_0xc1dc('0x65')]===_0xc1dc('0x66')){_0x1dd081[_0x35ec6b](_0xc1dc('0x73'),'%'+_0x9bce20[_0xc1dc('0x61')]+'%',null);}else{_0x5ba08c=_[_0xc1dc('0x5f')](_0x1fbdb8,[_0xc1dc('0x1f'),_0xc1dc('0x34')]);_0x9bce20[_0xc1dc('0x47')]=_0xc1dc('0x34');_0x4f5c32=as[_0xc1dc('0x6b')](_0xc7fd75,_0x5ba08c[_0xc1dc('0x39')],_0x9bce20);_0x1dd081[_0x35ec6b](_0x4f5c32['text'],_0x4f5c32[_0xc1dc('0x61')][_0xc1dc('0x6d')],_0x4f5c32[_0xc1dc('0x61')]['end']);}break;case'plainBody':_0x4f5c32=as[_0xc1dc('0x6b')]('me',null,_0x9bce20);_0x1dd081[_0x35ec6b](_0x4f5c32['text'],_0x4f5c32[_0xc1dc('0x61')][_0xc1dc('0x6d')],_0x4f5c32[_0xc1dc('0x61')][_0xc1dc('0x14')]);break;}}else{var _0x4f5c32=as['buildExpression'](_0xc7fd75,_0x5ba08c[_0xc1dc('0x39')],_0x9bce20);_0x1dd081[_0x35ec6b](_0x4f5c32[_0xc1dc('0x6c')],_0x4f5c32[_0xc1dc('0x61')][_0xc1dc('0x6d')],_0x4f5c32[_0xc1dc('0x61')][_0xc1dc('0x14')]);}}}else{var _0x439daa=_(_0x16356d['query'])[_0xc1dc('0x3b')]()['map'](function(_0x1108e0){return _[_0xc1dc('0x74')](_0x1fbdb8,['name',_0x1108e0])?_0x1108e0:undefined;})[_0xc1dc('0x75')]()[_0xc1dc('0x61')]();if(!_['isEmpty'](_0x439daa)){_0x439daa[_0xc1dc('0x26')](function(_0xd86488){if(_0xd86488==='MailAccountId'){_0x1d1706[_0xc1dc('0x44')](_0xc1dc('0x76'),[][_0xc1dc('0x77')](_0x16356d[_0xc1dc('0x3a')][_0xd86488]));}else if(_0xd86488===_0xc1dc('0x78')){var _0x188e1c=JSON[_0xc1dc('0x79')](_0x16356d[_0xc1dc('0x3a')][_0xd86488])['$gte'];var _0x28b7e1=JSON['parse'](_0x16356d[_0xc1dc('0x3a')][_0xd86488])['$lte'];_0x1d1706[_0xc1dc('0x44')](_0xc1dc('0x7a'),_0x188e1c,_0x28b7e1);}else{if(_0x16356d[_0xc1dc('0x3a')][_0xd86488]===_0xc1dc('0x7b')){_0x1d1706[_0xc1dc('0x44')]('i.'+_0xd86488+'\x20IS\x20NULL');}else{_0x1d1706['where']('i.'+_0xd86488+_0xc1dc('0x7c'),_0x16356d['query'][_0xd86488]);}}});}if(_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x7d')]){if(_0x16356d[_0xc1dc('0x3a')]['read']==0x1){_0x1d1706[_0xc1dc('0x62')]('`unreadMessages`\x20=\x200');}else{_0x1d1706[_0xc1dc('0x62')](_0xc1dc('0x7e'));}}if(_0x16356d[_0xc1dc('0x3a')]['tag']){_0x3bb51c=_[_0xc1dc('0x7f')](_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x80')])?_0x16356d['query']['tag']:new Array(_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x80')]);_0x3bb51c[_0xc1dc('0x26')](function(_0x3a3e3e){_0x437e9c['or'](_0xc1dc('0x70'),'%,'+_0x3a3e3e+',%');});}if(_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x81')]){var _0x5a1d73=_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x81')][_0xc1dc('0x82')]('\x5c','\x5c\x5c')[_0xc1dc('0x82')](/'/g,'\x27\x27');if(qs[_0xc1dc('0x83')](_0x5a1d73)){_0x1dd081['or'](_0xc1dc('0x84'),_0x5a1d73+'%');}else if(qs[_0xc1dc('0x85')](_0x5a1d73)){_0x1dd081['or'](_0xc1dc('0x86'),_0x5a1d73+'%');}else{_0x1dd081['or'](_0xc1dc('0x87'),qs[_0xc1dc('0x68')](_0x5a1d73))['or'](_0xc1dc('0x88'),qs[_0xc1dc('0x68')](_0x5a1d73));}}}_0x1d1706['where'](_0x1dd081);_0x1d1706['group']('i.id');var _0x5a3211={'type':db['Sequelize'][_0xc1dc('0x89')]['SELECT'],'raw':!![]};var _0x3074b4=_0x1d1706[_0xc1dc('0x8a')]();_0x3074b4[_0xc1dc('0x47')](_0xc1dc('0x8b'));_0x3074b4[_0xc1dc('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x425faf[_0xc1dc('0x8c')]){_0x425faf[_0xc1dc('0x8c')]['forEach'](function(_0xf224f3){var _0x48a9c4=_0xf224f3[0x0]==='contactName'?_0xf224f3[0x0]:'i.'+_0xf224f3[0x0];_0x1d1706['order'](_0x48a9c4,_0xf224f3[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc1dc('0x8d')](_0x3bb51c)){_0x1d1706['having'](_0x437e9c);_0x3074b4[_0xc1dc('0x44')](_0xc1dc('0x8e'),_0x3bb51c);}BPromise['resolve']()[_0xc1dc('0x1b')](function(){if(!_0x44921f){if(_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x8f')])return;_0x3074b4[_0xc1dc('0x44')](_0xc1dc('0x90'));_0x1d1706['where'](_0xc1dc('0x90'));return;}if(_0x16356d['user']['role']!=='agent')return;return _0x16356d[_0xc1dc('0x91')][_0xc1dc('0x92')]({'attributes':['id'],'raw':!![]})[_0xc1dc('0x1b')](function(_0x225253){if(_[_0xc1dc('0x8d')](_0x225253)){_0x3074b4[_0xc1dc('0x44')](_0xc1dc('0x93'));_0x1d1706['where'](_0xc1dc('0x93'));}else{_0x3074b4[_0xc1dc('0x44')](_0xc1dc('0x76'),_[_0xc1dc('0x22')](_0x225253,'id'));_0x1d1706[_0xc1dc('0x44')](_0xc1dc('0x76'),_['map'](_0x225253,'id'));}});})[_0xc1dc('0x1b')](function(){if(_0x16356d[_0xc1dc('0x91')]['role']==='agent'&&!_0x44921f&&!_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x8f')])return[];return db[_0xc1dc('0x94')][_0xc1dc('0x3a')](_0x3074b4[_0xc1dc('0x95')](),_0x5a3211);})[_0xc1dc('0x1b')](function(_0x88dcd8){_0x1d8107['count']=_0x88dcd8['length'];if(_0x1d8107[_0xc1dc('0x18')]===0x0)return[];return db['sequelize'][_0xc1dc('0x3a')](_0x71779d[_0xc1dc('0x95')](),_0x5a3211)[_0xc1dc('0x1b')](function(_0x585383){_0x48bbf3=_[_0xc1dc('0x96')](_0x585383,'id');_0x5a3211=_[_0xc1dc('0x97')](_0x5a3211,{'model':db[_0xc1dc('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16356d[_0xc1dc('0x3a')][_0xc1dc('0x3f')]){_0x425faf['attributes'][_0xc1dc('0x26')](function(_0x14dc01){_0x1d1706['field']('i.'+_0x14dc01);});}else{_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0x98'),_0xc1dc('0x60'));_0x1d1706['field']('a.key','Account.key');_0x1d1706['field'](_0xc1dc('0x99'),_0xc1dc('0x9a'));_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0x9b'),_0xc1dc('0x9c'));_0x1d1706[_0xc1dc('0x47')]('i.id');_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0x9d'));_0x1d1706[_0xc1dc('0x47')]('i.updatedAt');_0x1d1706['field'](_0xc1dc('0x9e'));_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0x9f'));_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0xa0'));_0x1d1706['field'](_0xc1dc('0xa1'));_0x1d1706[_0xc1dc('0x47')]('i.lastMsgDirection');_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0xa2'));_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0xa3'));_0x1d1706['field']('i.secondDisposition');_0x1d1706['field'](_0xc1dc('0xa4'));_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0xa5'));_0x1d1706['field'](_0xc1dc('0xa6'));_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0xa7'));_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0xa8'));_0x1d1706[_0xc1dc('0x47')]('i.UserId');_0x1d1706['field'](_0xc1dc('0xa9'),_0xc1dc('0xaa'));_0x1d1706[_0xc1dc('0x47')]('c.lastName',_0xc1dc('0xab'));_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0xac'),'Contact.email');_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0xad'),_0xc1dc('0xae'));_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0xaf'),'Contact.mobile');_0x1d1706['field'](_0xc1dc('0xb0'),_0xc1dc('0xb1'));_0x1d1706['field'](_0xc1dc('0xb2'),_0xc1dc('0xb3'));_0x1d1706[_0xc1dc('0x47')](_0xc1dc('0xb4'),_0xc1dc('0xb5'));_0x1d1706['field'](_0xc1dc('0xb6'),_0xc1dc('0x24'));}if(_0x425faf['limit'])_0x1d1706[_0xc1dc('0x17')](_0x425faf[_0xc1dc('0x17')]);if(_0x425faf[_0xc1dc('0x15')])_0x1d1706[_0xc1dc('0x15')](_0x425faf[_0xc1dc('0x15')]);return db[_0xc1dc('0x94')]['query'](_0x1d1706[_0xc1dc('0x95')](),_0x5a3211);})['then'](function(_0x25b15d){if(_0x25b15d[_0xc1dc('0x5e')]>0x0)_0x29417d[_0xc1dc('0x44')](_0xc1dc('0xb7'),_[_0xc1dc('0x22')](_0x25b15d,'id'));return db[_0xc1dc('0x94')][_0xc1dc('0x3a')](_0x29417d[_0xc1dc('0x95')](),_0x5a3211)[_0xc1dc('0x1b')](function(_0x46f9e0){var _0x279f16=_[_0xc1dc('0xb8')](_0x46f9e0,'MailInteractionId');var _0x15c4d3=[];return db[_0xc1dc('0xb9')]['findOne']({'attributes':[_0xc1dc('0xba')],'raw':!![]})[_0xc1dc('0x1b')](function(_0x2dd65b){var _0x568593=_0x2dd65b[_0xc1dc('0xba')];_0x25b15d['forEach'](function(_0x10f48b){_0x15c4d3[_0xc1dc('0x27')](updateMailInteraction(_0x10f48b,_0x48bbf3,_0x279f16,_0x568593));});return BPromise[_0xc1dc('0xbb')](_0x15c4d3);});});});})[_0xc1dc('0x1b')](function(_0x209685){_0x1d8107[_0xc1dc('0xbc')]=_0x209685;return _0x1d8107;})[_0xc1dc('0x1b')](respondWithFilteredResult(_0x1557b4,_0x425faf))['catch'](handleError(_0x1557b4,null));};exports['show']=function(_0x89e47f,_0x1a3e92){var _0x4ca6d6={'raw':![],'where':{'id':_0x89e47f[_0xc1dc('0xbd')]['id']}},_0x18d147={};_0x18d147['model']=_[_0xc1dc('0x3b')](db[_0xc1dc('0x36')]['rawAttributes']);_0x18d147[_0xc1dc('0x3a')]=_[_0xc1dc('0x3b')](_0x89e47f[_0xc1dc('0x3a')]);_0x18d147[_0xc1dc('0x3c')]=_[_0xc1dc('0x3d')](_0x18d147[_0xc1dc('0x40')],_0x18d147[_0xc1dc('0x3a')]);_0x4ca6d6['attributes']=_['intersection'](_0x18d147[_0xc1dc('0x40')],qs['fields'](_0x89e47f[_0xc1dc('0x3a')][_0xc1dc('0x3f')]));_0x4ca6d6[_0xc1dc('0x3e')]=_0x4ca6d6[_0xc1dc('0x3e')][_0xc1dc('0x5e')]?_0x4ca6d6[_0xc1dc('0x3e')]:_0x18d147[_0xc1dc('0x40')];if(_0x89e47f[_0xc1dc('0x3a')][_0xc1dc('0xbe')]){_0x4ca6d6[_0xc1dc('0xbf')]=[{'all':!![]}];}_0x4ca6d6=_[_0xc1dc('0x97')]({},_0x4ca6d6,_0x89e47f[_0xc1dc('0xc0')]);return db[_0xc1dc('0x36')][_0xc1dc('0x5f')](_0x4ca6d6)[_0xc1dc('0x1b')](handleEntityNotFound(_0x1a3e92,null))['then'](respondWithResult(_0x1a3e92,null))['catch'](handleError(_0x1a3e92,null));};exports[_0xc1dc('0xc1')]=function(_0x32455b,_0x5cad99){return db[_0xc1dc('0x36')][_0xc1dc('0xc1')](_0x32455b[_0xc1dc('0xc2')],{})[_0xc1dc('0x1b')](respondWithResult(_0x5cad99,0xc9))[_0xc1dc('0x2e')](handleError(_0x5cad99,null));};exports[_0xc1dc('0x1a')]=function(_0x374444,_0x17c87f){if(_0x374444[_0xc1dc('0xc2')]['id']){delete _0x374444[_0xc1dc('0xc2')]['id'];}return db[_0xc1dc('0x36')][_0xc1dc('0x5f')]({'where':{'id':_0x374444[_0xc1dc('0xbd')]['id']}})[_0xc1dc('0x1b')](handleEntityNotFound(_0x17c87f,null))['then'](saveUpdates(_0x374444[_0xc1dc('0xc2')],null))[_0xc1dc('0x1b')](respondWithResult(_0x17c87f,null))[_0xc1dc('0x2e')](handleError(_0x17c87f,null));};exports[_0xc1dc('0x1c')]=function(_0x39bd70,_0x3bf6d5){return db['MailInteraction'][_0xc1dc('0x5f')]({'where':{'id':_0x39bd70['params']['id']}})['then'](handleEntityNotFound(_0x3bf6d5,null))[_0xc1dc('0x1b')](removeEntity(_0x3bf6d5,null))['catch'](handleError(_0x3bf6d5,null));};exports[_0xc1dc('0xc3')]=function(_0x3b51ea,_0x3cd1f8){return db[_0xc1dc('0x36')][_0xc1dc('0xc3')]()[_0xc1dc('0x1b')](respondWithResult(_0x3cd1f8,null))[_0xc1dc('0x2e')](handleError(_0x3cd1f8,null));};exports['addMessage']=function(_0x6f57f,_0x30ae97){return db['MailMessage']['find']({'where':{'id':_0x6f57f[_0xc1dc('0xbd')]['id']}})[_0xc1dc('0x1b')](handleEntityNotFound(_0x30ae97,null))[_0xc1dc('0x1b')](function(_0x529b2b){if(_0x529b2b){return _0x529b2b[_0xc1dc('0xc4')](_0x6f57f[_0xc1dc('0xc2')]['ids'],_[_0xc1dc('0xc5')](_0x6f57f[_0xc1dc('0xc2')],[_0xc1dc('0xc6'),'id'])||{});}})[_0xc1dc('0x1b')](respondWithResult(_0x30ae97,null))[_0xc1dc('0x2e')](handleError(_0x30ae97,null));};exports[_0xc1dc('0xc7')]=function(_0x573b53,_0x3f242d){var _0x5b8eb8={'raw':![],'where':{}};var _0xbda126={};var _0x5e0255={'count':0x0,'rows':[]};return db['MailInteraction'][_0xc1dc('0x29')]({'where':{'id':_0x573b53[_0xc1dc('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3f242d,null))[_0xc1dc('0x1b')](function(_0x5aead5){if(_0x5aead5){_0xbda126['model']=_[_0xc1dc('0x3b')](db['MailMessage']['rawAttributes']);_0xbda126['query']=_['keys'](_0x573b53[_0xc1dc('0x3a')]);_0xbda126[_0xc1dc('0x3c')]=_[_0xc1dc('0x3d')](_0xbda126[_0xc1dc('0x40')],_0xbda126[_0xc1dc('0x3a')]);_0x5b8eb8[_0xc1dc('0x3e')]=_[_0xc1dc('0x3d')](_0xbda126[_0xc1dc('0x40')],qs[_0xc1dc('0x3f')](_0x573b53[_0xc1dc('0x3a')][_0xc1dc('0x3f')]));_0x5b8eb8['attributes']=_0x5b8eb8[_0xc1dc('0x3e')][_0xc1dc('0x5e')]?_0x5b8eb8[_0xc1dc('0x3e')]:_0xbda126['model'];if(!_0x573b53[_0xc1dc('0x3a')][_0xc1dc('0x41')](_0xc1dc('0x42'))){_0x5b8eb8[_0xc1dc('0x17')]=qs[_0xc1dc('0x17')](_0x573b53[_0xc1dc('0x3a')][_0xc1dc('0x17')]);_0x5b8eb8[_0xc1dc('0x15')]=qs['offset'](_0x573b53[_0xc1dc('0x3a')][_0xc1dc('0x15')]);}_0x5b8eb8['order']=qs['sort'](_0x573b53[_0xc1dc('0x3a')]['sort']);_0x5b8eb8[_0xc1dc('0x44')]=qs[_0xc1dc('0x3c')](_[_0xc1dc('0x45')](_0x573b53[_0xc1dc('0x3a')],_0xbda126[_0xc1dc('0x3c')]));_0x5b8eb8[_0xc1dc('0x44')][_0xc1dc('0xc8')]=_0x5aead5['id'];if(_0x573b53[_0xc1dc('0x3a')]['filter']){_0x5b8eb8[_0xc1dc('0x44')]=_[_0xc1dc('0x97')](_0x5b8eb8[_0xc1dc('0x44')],{'$or':_[_0xc1dc('0x22')](_0x5b8eb8[_0xc1dc('0x3e')],function(_0x1a427a){var _0xd6339b={};_0xd6339b[_0x1a427a]={'$like':'%'+_0x573b53['query']['filter']+'%'};return _0xd6339b;})});}if(_0x573b53[_0xc1dc('0x3a')][_0xc1dc('0xc9')]){var _0x152545=_0x573b53[_0xc1dc('0x3a')][_0xc1dc('0xc9')][_0xc1dc('0x6f')](',');var _0x83428b={};_0x83428b[_0x152545[0x0]]={'$gte':moment(_0x152545[0x1])[_0xc1dc('0xca')](_0xc1dc('0xcb'))};_0x5b8eb8[_0xc1dc('0x44')]=_[_0xc1dc('0x97')](_0x5b8eb8['where'],_0x83428b);}_0x5b8eb8=_[_0xc1dc('0x97')]({},_0x5b8eb8,_0x573b53[_0xc1dc('0xc0')]);return db[_0xc1dc('0x28')][_0xc1dc('0x18')]({'where':_0x5b8eb8['where']})[_0xc1dc('0x1b')](function(_0x58306a){_0x5e0255[_0xc1dc('0x18')]=_0x58306a;if(_0x573b53['query'][_0xc1dc('0xbe')]){_0x5b8eb8[_0xc1dc('0xbf')]=[{'all':!![]}];}return db[_0xc1dc('0x28')][_0xc1dc('0xcc')](_0x5b8eb8);})[_0xc1dc('0x1b')](function(_0x35663b){if(_0x573b53[_0xc1dc('0x3a')][_0xc1dc('0xcd')]==='true'){for(var _0x5c2f6c=0x0;_0x5c2f6c<_0x35663b[_0xc1dc('0x5e')];_0x5c2f6c++){_0x35663b[_0x5c2f6c][_0xc1dc('0xc2')]=juice(_0x35663b[_0x5c2f6c][_0xc1dc('0xc2')]);}}_0x5e0255[_0xc1dc('0xbc')]=_0x35663b;return _0x5e0255;});}})['then'](respondWithFilteredResult(_0x3f242d,_0x5b8eb8))[_0xc1dc('0x2e')](handleError(_0x3f242d,null));};exports['addTags']=function(_0x4a7c66,_0x50918b){return db[_0xc1dc('0x36')]['find']({'where':{'id':_0x4a7c66['params']['id']}})[_0xc1dc('0x1b')](handleEntityNotFound(_0x50918b,null))[_0xc1dc('0x1b')](function(_0x2a31e4){if(_0x2a31e4){return _0x2a31e4[_0xc1dc('0xce')](_0x4a7c66[_0xc1dc('0xc2')][_0xc1dc('0xc6')],_[_0xc1dc('0xc5')](_0x4a7c66[_0xc1dc('0xc2')],[_0xc1dc('0xc6'),'id'])||{})[_0xc1dc('0xcf')](function(){return db[_0xc1dc('0x6e')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4a7c66[_0xc1dc('0xc2')][_0xc1dc('0xc6')]}});})[_0xc1dc('0x1b')](function(_0xb12e5c){socket[_0xc1dc('0xd0')](_0xc1dc('0xd1'),{'id':Number(_0x4a7c66[_0xc1dc('0xbd')]['id']),'tags':_0xb12e5c||[]});return{'id':Number(_0x4a7c66[_0xc1dc('0xbd')]['id']),'tags':_0xb12e5c||[]};});}})['then'](respondWithResult(_0x50918b,null))[_0xc1dc('0x2e')](handleError(_0x50918b,null));};exports[_0xc1dc('0xd2')]=function(_0x56d47e,_0x551c6c){return db[_0xc1dc('0x36')][_0xc1dc('0x5f')]({'where':{'id':_0x56d47e[_0xc1dc('0xbd')]['id']}})['then'](handleEntityNotFound(_0x551c6c,null))['then'](function(_0x33edb9){if(_0x33edb9){return _0x33edb9[_0xc1dc('0xd2')](_0x56d47e[_0xc1dc('0x3a')]['ids']);}})[_0xc1dc('0x1b')](respondWithStatusCode(_0x551c6c,null))[_0xc1dc('0x2e')](handleError(_0x551c6c,null));};exports[_0xc1dc('0xd3')]=function(_0x534e9a,_0x158c49){var _0x5b7b8e=moment()[_0xc1dc('0xd4')]()[_0xc1dc('0x95')]();var _0x5df5e3=path[_0xc1dc('0xd5')](config['root'],'server',_0xc1dc('0xd6'),_0xc1dc('0xd7'));var _0xca946d=path['join'](config[_0xc1dc('0xd8')],_0xc1dc('0xd9'),_0xc1dc('0xd6'),_0xc1dc('0xda'));var _0x57689c=path[_0xc1dc('0xd5')](_0x5df5e3,_0x5b7b8e);var _0x87a961=util[_0xc1dc('0xca')](_0xc1dc('0xdb'),_0x534e9a[_0xc1dc('0xbd')]['id'],_0x5b7b8e);var _0x3623b9=path['join'](_0x5df5e3,_0x87a961);var _0x259f63=[];if(_0x534e9a[_0xc1dc('0x3a')][_0xc1dc('0xda')]){_0x259f63['push']({'model':db[_0xc1dc('0xdc')],'as':_0xc1dc('0xdd'),'raw':!![]});}var _0x11198d=[{'model':db[_0xc1dc('0x28')],'as':'Messages','attributes':['id','body',_0xc1dc('0x49'),'to','cc',_0xc1dc('0xde'),_0xc1dc('0xdf'),'createdAt'],'where':{'secret':![]},'order':qs[_0xc1dc('0x43')]('id'),'include':_0x259f63}];return db[_0xc1dc('0x36')][_0xc1dc('0x5f')]({'where':{'id':_0x534e9a[_0xc1dc('0xbd')]['id']},'include':_0x11198d})[_0xc1dc('0x1b')](handleEntityNotFound(_0x158c49,null))['then'](function(_0x3d3f78){if(_0x3d3f78&&_0x3d3f78[_0xc1dc('0xe0')]){var _0x257b11=_0x3d3f78['get']({'plain':!![]});fs[_0xc1dc('0xe1')](_0x57689c);return BPromise[_0xc1dc('0xe2')](_0x257b11[_0xc1dc('0xe0')],function(_0x33142b,_0x2673ba){var _0x5f23e7={'from':_0x33142b[_0xc1dc('0x49')],'to':_0x33142b['to'],'subject':_0x33142b[_0xc1dc('0xdf')],'html':htmlEntities['decode'](_0x33142b[_0xc1dc('0xc2')]),'headers':{'Date':moment(_0x33142b[_0xc1dc('0x78')])['format'](_0xc1dc('0xe3'))},'attachments':[]};if(_0x33142b['cc']){_0x5f23e7[_0xc1dc('0xe4')]['Cc']=_0x33142b['cc'];}if(_0x33142b[_0xc1dc('0xde')]){_0x5f23e7[_0xc1dc('0xe4')]['Bcc']=_0x33142b['bcc'];}return new BPromise(function(_0x3f4a49,_0x245b91){if(_0x33142b[_0xc1dc('0xdd')]){for(var _0x5a681f=0x0;_0x5a681f<_0x33142b[_0xc1dc('0xdd')][_0xc1dc('0x5e')];_0x5a681f++){var _0x5bf56d=_0x33142b[_0xc1dc('0xdd')][_0x5a681f];var _0x237ce3=path[_0xc1dc('0xd5')](_0xca946d,_0x5bf56d['basename']);if(fs[_0xc1dc('0xe5')](_0x237ce3)){_0x5f23e7[_0xc1dc('0xda')][_0xc1dc('0x27')]({'name':_0x5bf56d['name'],'contentType':_0x5bf56d[_0xc1dc('0x39')],'data':fs['readFileSync'](_0x237ce3)});}}}emlformat[_0xc1dc('0xe6')](_0x5f23e7,function(_0x10f197,_0x445314){if(_0x10f197)return _0x245b91(_0x10f197);fs['writeFileSync'](path[_0xc1dc('0xd5')](_0x57689c,util[_0xc1dc('0xca')]('message%d.eml',_0x2673ba)),_0x445314);return _0x3f4a49(_0x445314);});});})[_0xc1dc('0x1b')](function(){return new BPromise(function(_0x5968cf,_0x1e4b91){zipdir(_0x57689c,{'saveTo':_0x3623b9},function(_0x2498f4,_0x416c29){if(_0x2498f4)return _0x1e4b91(_0x2498f4);return _0x5968cf(_0x416c29);});})[_0xc1dc('0x1b')](function(){return new BPromise(function(_0x576c4e,_0x53bd91){rimraf(_0x57689c,function(_0x4f8947){if(_0x4f8947)_0x53bd91(_0x4f8947);return _0x576c4e();});});})[_0xc1dc('0x1b')](function(){return _0x158c49[_0xc1dc('0xd3')](_0x3623b9,_0x87a961,function(_0x3fb24c){if(!_0x3fb24c)fs[_0xc1dc('0xe7')](_0x3623b9);});});});}else{return _0x158c49['sendStatus'](0xc8);}})['catch'](handleError(_0x158c49,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 1f1a2ed..1e42220 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 _0x303f=['catch','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x59a570,_0x5f4965){var _0x28cffe=function(_0x3abdf6){while(--_0x3abdf6){_0x59a570['push'](_0x59a570['shift']());}};_0x28cffe(++_0x5f4965);}(_0x303f,0xbe));var _0xf303=function(_0x3ec87b,_0x367df7){_0x3ec87b=_0x3ec87b-0x0;var _0x1389dd=_0x303f[_0x3ec87b];return _0x1389dd;};'use strict';var EventEmitter=require(_0xf303('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xf303('0x1'))['db'][_0xf303('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf303('0x3')](0x0);var events={'afterCreate':_0xf303('0x4'),'afterUpdate':_0xf303('0x5'),'afterDestroy':'remove'};function emitEvent(_0x567ba1){return function(_0x38b08d,_0x2fb8ed,_0x8e3b27){_0x38b08d[_0xf303('0x6')]({'attributes':['id'],'raw':!![]})[_0xf303('0x7')](function(_0x1b29d2){_0x38b08d['setDataValue'](_0xf303('0x8'),_0x1b29d2['map'](function(_0x4df6da){return{'id':_0x4df6da['id']};}));return MailMessage[_0xf303('0x9')]({'where':{'MailInteractionId':_0x38b08d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf303('0x7')](function(_0x531cb3){_0x38b08d[_0xf303('0xa')](_0xf303('0xb'),_0x531cb3[_0xf303('0xc')]);MailInteractionEvents['emit'](_0x567ba1+':'+_0x38b08d['id'],_0x38b08d);MailInteractionEvents[_0xf303('0xd')](_0x567ba1,_0x38b08d);_0x8e3b27(null);})[_0xf303('0xe')](_0x8e3b27(null));};}for(var e in events){if(events[_0xf303('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xf303('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x47ba=['events','../../mysqldb','MailMessage','setMaxListeners','save','update','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x5c971c,_0x54bfc7){var _0x12e0b9=function(_0xaf99ac){while(--_0xaf99ac){_0x5c971c['push'](_0x5c971c['shift']());}};_0x12e0b9(++_0x54bfc7);}(_0x47ba,0x1b0));var _0xa47b=function(_0x5815af,_0x361f0b){_0x5815af=_0x5815af-0x0;var _0x3f14cb=_0x47ba[_0x5815af];return _0x3f14cb;};'use strict';var EventEmitter=require(_0xa47b('0x0'));var MailInteraction=require(_0xa47b('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0xa47b('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa47b('0x3')](0x0);var events={'afterCreate':_0xa47b('0x4'),'afterUpdate':_0xa47b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1cf021){return function(_0x40200e,_0x2bc85a,_0x342b27){_0x40200e[_0xa47b('0x6')]({'attributes':['id'],'raw':!![]})[_0xa47b('0x7')](function(_0x1f0114){_0x40200e['setDataValue'](_0xa47b('0x8'),_0x1f0114[_0xa47b('0x9')](function(_0x219aa6){return{'id':_0x219aa6['id']};}));return MailMessage[_0xa47b('0xa')]({'where':{'MailInteractionId':_0x40200e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa47b('0x7')](function(_0x33c4f7){_0x40200e[_0xa47b('0xb')](_0xa47b('0xc'),_0x33c4f7[_0xa47b('0xd')]);MailInteractionEvents[_0xa47b('0xe')](_0x1cf021+':'+_0x40200e['id'],_0x40200e);MailInteractionEvents[_0xa47b('0xe')](_0x1cf021,_0x40200e);_0x342b27(null);})[_0xa47b('0xf')](_0x342b27(null));};}for(var e in events){if(events[_0xa47b('0x10')](e)){var event=events[e];MailInteraction[_0xa47b('0x11')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index c37e454..f59aeae 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 _0x86e8=['bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x464120,_0x51ce4d){var _0x3927bb=function(_0xb23ff2){while(--_0xb23ff2){_0x464120['push'](_0x464120['shift']());}};_0x3927bb(++_0x51ce4d);}(_0x86e8,0xdc));var _0x886e=function(_0x4af9bb,_0x387e44){_0x4af9bb=_0x4af9bb-0x0;var _0x326ccc=_0x86e8[_0x4af9bb];return _0x326ccc;};'use strict';var _=require(_0x886e('0x0'));var util=require(_0x886e('0x1'));var logger=require('../../config/logger')(_0x886e('0x2'));var moment=require(_0x886e('0x3'));var BPromise=require(_0x886e('0x4'));var rp=require(_0x886e('0x5'));var fs=require('fs');var path=require(_0x886e('0x6'));var rimraf=require(_0x886e('0x7'));var config=require(_0x886e('0x8'));var attributes=require(_0x886e('0x9'));module[_0x886e('0xa')]=function(_0xb1862d,_0x263bce){return _0xb1862d[_0x886e('0xb')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x886e('0xc'),'fields':[_0x886e('0xd'),'to'],'type':_0x886e('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45efaf,_0x77a17a,_0x88227b){if(_0x45efaf[_0x886e('0xf')]){_0x45efaf[_0x886e('0x10')]=moment()[_0x886e('0x11')](_0x886e('0x12'));}if(_0x45efaf[_0x886e('0x13')]){_0x45efaf[_0x886e('0x14')]=moment()[_0x886e('0x11')](_0x886e('0x12'));}_0x88227b(null,_0x77a17a);},'beforeUpdate':function(_0x6f52e9,_0x57ce7a,_0x3f5060){if(_0x6f52e9['changed'](_0x886e('0xf'))){_0x6f52e9['substatusAt']=_0x6f52e9[_0x886e('0xf')]?moment()['format'](_0x886e('0x12')):null;}if(_0x6f52e9[_0x886e('0x15')](_0x886e('0x13'))){_0x6f52e9[_0x886e('0x14')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x6f52e9[_0x886e('0xf')]=null;_0x6f52e9[_0x886e('0x10')]=null;}_0x3f5060(null,_0x6f52e9);},'afterUpdate':function(_0x36cd39,_0x968142,_0x523d54){var _0x53679f=_0xb1862d[_0x886e('0x16')];var _0x51e87f=_0x36cd39[_0x886e('0x17')]({'plain':!![]});if(_0x51e87f['closed']){return _0x53679f[_0x886e('0x18')][_0x886e('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x51e87f['id']}})['then'](function(){_0x523d54();})['catch'](function(_0x5d2982){_0x523d54(_0x5d2982);});}else{_0x523d54();}}},'charset':_0x886e('0x1a'),'collate':_0x886e('0x1b')});}; \ No newline at end of file +var _0x5a11=['define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','then','utf8mb4','utf8mb4_unicode_ci','util','api','moment','path','../../config/environment','./mailInteraction.attributes'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0x5a11,0xd2));var _0x15a1=function(_0x3171f3,_0x13c384){_0x3171f3=_0x3171f3-0x0;var _0x717d89=_0x5a11[_0x3171f3];return _0x717d89;};'use strict';var _=require('lodash');var util=require(_0x15a1('0x0'));var logger=require('../../config/logger')(_0x15a1('0x1'));var moment=require(_0x15a1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15a1('0x3'));var rimraf=require('rimraf');var config=require(_0x15a1('0x4'));var attributes=require(_0x15a1('0x5'));module['exports']=function(_0x3908e8,_0x4f0527){return _0x3908e8[_0x15a1('0x6')](_0x15a1('0x7'),attributes,{'tableName':_0x15a1('0x8'),'paranoid':![],'indexes':[{'name':_0x15a1('0x9'),'fields':['subject','to'],'type':_0x15a1('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24dbcd,_0x12d75b,_0xe74d18){if(_0x24dbcd[_0x15a1('0xb')]){_0x24dbcd[_0x15a1('0xc')]=moment()[_0x15a1('0xd')](_0x15a1('0xe'));}if(_0x24dbcd[_0x15a1('0xf')]){_0x24dbcd[_0x15a1('0x10')]=moment()[_0x15a1('0xd')](_0x15a1('0xe'));}_0xe74d18(null,_0x12d75b);},'beforeUpdate':function(_0x39b75c,_0x4099f3,_0x51d55c){if(_0x39b75c[_0x15a1('0x11')](_0x15a1('0xb'))){_0x39b75c[_0x15a1('0xc')]=_0x39b75c['substatus']?moment()['format'](_0x15a1('0xe')):null;}if(_0x39b75c['changed'](_0x15a1('0xf'))){_0x39b75c[_0x15a1('0x10')]=moment()['format'](_0x15a1('0xe'));_0x39b75c[_0x15a1('0xb')]=null;_0x39b75c[_0x15a1('0xc')]=null;}_0x51d55c(null,_0x39b75c);},'afterUpdate':function(_0x5cab4e,_0x52d40a,_0x3e0baa){var _0xe5f8c1=_0x3908e8[_0x15a1('0x12')];var _0x3d17a5=_0x5cab4e[_0x15a1('0x13')]({'plain':!![]});if(_0x3d17a5[_0x15a1('0xf')]){return _0xe5f8c1['MailMessage'][_0x15a1('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x3d17a5['id']}})[_0x15a1('0x15')](function(){_0x3e0baa();})['catch'](function(_0x19b500){_0x3e0baa(_0x19b500);});}else{_0x3e0baa();}}},'charset':_0x15a1('0x16'),'collate':_0x15a1('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d1e1087..ea7d308 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 _0xe90c=['MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailInteraction','update','body','options','where','attributes','UpdateMailInteraction','AddTagsToMailInteraction','find','omit','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x24eaf6,_0x1535ee){var _0x534bb9=function(_0x41dbbb){while(--_0x41dbbb){_0x24eaf6['push'](_0x24eaf6['shift']());}};_0x534bb9(++_0x1535ee);}(_0xe90c,0x153));var _0xce90=function(_0x518b25,_0x32d489){_0x518b25=_0x518b25-0x0;var _0x4faabe=_0xe90c[_0x518b25];return _0x4faabe;};'use strict';var _=require(_0xce90('0x0'));var util=require(_0xce90('0x1'));var moment=require(_0xce90('0x2'));var BPromise=require('bluebird');var rs=require(_0xce90('0x3'));var fs=require('fs');var Redis=require(_0xce90('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce90('0x5'))(_0xce90('0x6'));var config=require(_0xce90('0x7'));var jayson=require(_0xce90('0x8'));var client=jayson[_0xce90('0x9')][_0xce90('0xa')]({'port':0x232a});config['redis']=_[_0xce90('0xb')](config[_0xce90('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xce90('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0xce90('0xe')](socket);function respondWithRpcPromise(_0x3f04df,_0x213131,_0x458d26){return new BPromise(function(_0x218e97,_0xf90b1){return client[_0xce90('0xf')](_0x3f04df,_0x458d26)[_0xce90('0x10')](function(_0x3ee3c6){logger[_0xce90('0x11')](_0xce90('0x12'),_0x213131,_0xce90('0x13'));logger[_0xce90('0x14')](_0xce90('0x15'),_0x213131,_0xce90('0x13'),JSON[_0xce90('0x16')](_0x3ee3c6));if(_0x3ee3c6[_0xce90('0x17')]){if(_0x3ee3c6['error'][_0xce90('0x18')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x213131,_0x3ee3c6['error']['message']);return _0xf90b1(_0x3ee3c6[_0xce90('0x17')][_0xce90('0x19')]);}logger['error'](_0xce90('0x12'),_0x213131,_0x3ee3c6[_0xce90('0x17')][_0xce90('0x19')]);return _0x218e97(_0x3ee3c6[_0xce90('0x17')][_0xce90('0x19')]);}else{logger[_0xce90('0x11')](_0xce90('0x12'),_0x213131,'request\x20sent');_0x218e97(_0x3ee3c6[_0xce90('0x1a')][_0xce90('0x19')]);}})[_0xce90('0x1b')](function(_0x595ee6){logger[_0xce90('0x17')](_0xce90('0x12'),_0x213131,_0x595ee6);_0xf90b1(_0x595ee6);});});}exports['UpdateMailInteraction']=function(_0x1a53fd){var _0x1e8ba3=this;return new Promise(function(_0x426c36,_0x4e0890){return db[_0xce90('0x1c')][_0xce90('0x1d')](_0x1a53fd[_0xce90('0x1e')],{'raw':_0x1a53fd['options']?_0x1a53fd[_0xce90('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a53fd[_0xce90('0x1f')]?_0x1a53fd[_0xce90('0x1f')][_0xce90('0x20')]||null:null,'attributes':_0x1a53fd['options']?_0x1a53fd['options'][_0xce90('0x21')]||null:null,'limit':_0x1a53fd['options']?_0x1a53fd['options']['limit']||null:null})[_0xce90('0x10')](function(_0x5242ea){logger[_0xce90('0x11')](_0xce90('0x22'),_0x1a53fd);logger[_0xce90('0x14')]('UpdateMailInteraction',_0x1a53fd,JSON[_0xce90('0x16')](_0x5242ea));_0x426c36(_0x5242ea);})[_0xce90('0x1b')](function(_0x40a77e){logger[_0xce90('0x17')]('UpdateMailInteraction',_0x40a77e[_0xce90('0x19')],_0x1a53fd);_0x4e0890(_0x1e8ba3[_0xce90('0x17')](0x1f4,_0x40a77e['message']));});});};exports[_0xce90('0x23')]=function(_0x56a239){return new Promise(function(_0x107e28,_0x54edf3){return db[_0xce90('0x1c')][_0xce90('0x24')]({'where':_0x56a239[_0xce90('0x1f')]?_0x56a239[_0xce90('0x1f')][_0xce90('0x20')]||null:null})[_0xce90('0x10')](function(_0x38cf8c){if(_0x38cf8c){return _0x38cf8c['addTags'](_0x56a239['body']['ids'],_[_0xce90('0x25')](_0x56a239[_0xce90('0x1e')],[_0xce90('0x26'),'id'])||{});}})['spread'](function(_0x665d5c){logger[_0xce90('0x11')](_0xce90('0x27'),_0x56a239);logger[_0xce90('0x14')]('AddTags',_0x56a239,JSON[_0xce90('0x16')](_0x665d5c));_0x107e28(_0x665d5c);})[_0xce90('0x1b')](function(_0x2a570f){logger[_0xce90('0x17')](_0xce90('0x27'),_0x2a570f[_0xce90('0x19')],_0x56a239);_0x54edf3(_this[_0xce90('0x17')](0x1f4,_0x2a570f[_0xce90('0x19')]));});});}; \ No newline at end of file +var _0x8200=['UpdateMailInteraction','MailInteraction','update','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','body','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailInteraction,\x20%s,\x20%s','message','catch'];(function(_0x4e029f,_0x177074){var _0x135b7e=function(_0x37caff){while(--_0x37caff){_0x4e029f['push'](_0x4e029f['shift']());}};_0x135b7e(++_0x177074);}(_0x8200,0x11f));var _0x0820=function(_0x3995a7,_0x8113eb){_0x3995a7=_0x3995a7-0x0;var _0x1e47df=_0x8200[_0x3995a7];return _0x1e47df;};'use strict';var _=require(_0x0820('0x0'));var util=require(_0x0820('0x1'));var moment=require(_0x0820('0x2'));var BPromise=require('bluebird');var rs=require(_0x0820('0x3'));var fs=require('fs');var Redis=require(_0x0820('0x4'));var db=require(_0x0820('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0820('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0820('0x7'));var client=jayson['client'][_0x0820('0x8')]({'port':0x232a});config[_0x0820('0x9')]=_[_0x0820('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0820('0xb'))(new Redis(config['redis']));require(_0x0820('0xc'))[_0x0820('0xd')](socket);function respondWithRpcPromise(_0x28e0ac,_0x1bc04b,_0x18f6b2){return new BPromise(function(_0x5eeba4,_0x5c7eb0){return client[_0x0820('0xe')](_0x28e0ac,_0x18f6b2)[_0x0820('0xf')](function(_0x42b8e0){logger[_0x0820('0x10')]('MailInteraction,\x20%s,\x20%s',_0x1bc04b,'request\x20sent');logger[_0x0820('0x11')](_0x0820('0x12'),_0x1bc04b,_0x0820('0x13'),JSON[_0x0820('0x14')](_0x42b8e0));if(_0x42b8e0['error']){if(_0x42b8e0[_0x0820('0x15')]['code']===0x1f4){logger[_0x0820('0x15')](_0x0820('0x16'),_0x1bc04b,_0x42b8e0['error'][_0x0820('0x17')]);return _0x5c7eb0(_0x42b8e0[_0x0820('0x15')][_0x0820('0x17')]);}logger[_0x0820('0x15')]('MailInteraction,\x20%s,\x20%s',_0x1bc04b,_0x42b8e0['error'][_0x0820('0x17')]);return _0x5eeba4(_0x42b8e0['error']['message']);}else{logger[_0x0820('0x10')](_0x0820('0x16'),_0x1bc04b,_0x0820('0x13'));_0x5eeba4(_0x42b8e0['result'][_0x0820('0x17')]);}})[_0x0820('0x18')](function(_0xe2c573){logger[_0x0820('0x15')](_0x0820('0x16'),_0x1bc04b,_0xe2c573);_0x5c7eb0(_0xe2c573);});});}exports[_0x0820('0x19')]=function(_0x47c125){var _0x38609c=this;return new Promise(function(_0x288016,_0x1054ff){return db[_0x0820('0x1a')][_0x0820('0x1b')](_0x47c125['body'],{'raw':_0x47c125[_0x0820('0x1c')]?_0x47c125['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47c125[_0x0820('0x1c')]?_0x47c125[_0x0820('0x1c')][_0x0820('0x1d')]||null:null,'attributes':_0x47c125[_0x0820('0x1c')]?_0x47c125[_0x0820('0x1c')][_0x0820('0x1e')]||null:null,'limit':_0x47c125['options']?_0x47c125[_0x0820('0x1c')][_0x0820('0x1f')]||null:null})[_0x0820('0xf')](function(_0x1be830){logger[_0x0820('0x10')](_0x0820('0x19'),_0x47c125);logger[_0x0820('0x11')]('UpdateMailInteraction',_0x47c125,JSON[_0x0820('0x14')](_0x1be830));_0x288016(_0x1be830);})[_0x0820('0x18')](function(_0xc7d350){logger[_0x0820('0x15')](_0x0820('0x19'),_0xc7d350['message'],_0x47c125);_0x1054ff(_0x38609c[_0x0820('0x15')](0x1f4,_0xc7d350['message']));});});};exports[_0x0820('0x20')]=function(_0x2485ea){return new Promise(function(_0x1c6810,_0x3b0de2){return db[_0x0820('0x1a')][_0x0820('0x21')]({'where':_0x2485ea[_0x0820('0x1c')]?_0x2485ea['options'][_0x0820('0x1d')]||null:null})['then'](function(_0x4eefa6){if(_0x4eefa6){return _0x4eefa6[_0x0820('0x22')](_0x2485ea[_0x0820('0x23')]['ids'],_[_0x0820('0x24')](_0x2485ea['body'],['ids','id'])||{});}})[_0x0820('0x25')](function(_0x81f349){logger['info'](_0x0820('0x26'),_0x2485ea);logger[_0x0820('0x11')]('AddTags',_0x2485ea,JSON[_0x0820('0x14')](_0x81f349));_0x1c6810(_0x81f349);})[_0x0820('0x18')](function(_0x356db6){logger[_0x0820('0x15')](_0x0820('0x26'),_0x356db6['message'],_0x2485ea);_0x3b0de2(_this[_0x0820('0x15')](0x1f4,_0x356db6['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 8a5e240..9270a5e 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 _0x575f=['register','mailInteraction:','save','remove','emit'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x575f,0x1c9));var _0xf575=function(_0x4f7ed7,_0x46e8ac){_0x4f7ed7=_0x4f7ed7-0x0;var _0x46e8e5=_0x575f[_0x4f7ed7];return _0x46e8e5;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xf575('0x0'),_0xf575('0x1'),'update'];function createListener(_0x1f70d2,_0x190c64){return function(_0x296c12){_0x190c64[_0xf575('0x2')](_0x1f70d2,_0x296c12);};}function removeListener(_0x3a3426,_0x774c06){return function(){MailInteractionEvents['removeListener'](_0x3a3426,_0x774c06);};}exports[_0xf575('0x3')]=function(_0x2050f9){for(var _0x2a7873=0x0,_0x513ab3=events['length'];_0x2a7873<_0x513ab3;_0x2a7873++){var _0x3c13ea=events[_0x2a7873];var _0x3c3e84=createListener(_0xf575('0x4')+_0x3c13ea,_0x2050f9);MailInteractionEvents['on'](_0x3c13ea,_0x3c3e84);}}; \ No newline at end of file +var _0x8d9a=['./mailInteraction.events','save','remove','update','register','length','mailInteraction:'];(function(_0xf3ba04,_0x5a6e6){var _0x21eebf=function(_0x648a4c){while(--_0x648a4c){_0xf3ba04['push'](_0xf3ba04['shift']());}};_0x21eebf(++_0x5a6e6);}(_0x8d9a,0x17a));var _0xa8d9=function(_0x44a869,_0x26e384){_0x44a869=_0x44a869-0x0;var _0x4ec840=_0x8d9a[_0x44a869];return _0x4ec840;};'use strict';var MailInteractionEvents=require(_0xa8d9('0x0'));var events=[_0xa8d9('0x1'),_0xa8d9('0x2'),_0xa8d9('0x3')];function createListener(_0x165cb2,_0x3b8a61){return function(_0x196be0){_0x3b8a61['emit'](_0x165cb2,_0x196be0);};}function removeListener(_0x200514,_0x31a6bf){return function(){MailInteractionEvents['removeListener'](_0x200514,_0x31a6bf);};}exports[_0xa8d9('0x4')]=function(_0x7286fd){for(var _0xb42d38=0x0,_0x31b38e=events[_0xa8d9('0x5')];_0xb42d38<_0x31b38e;_0xb42d38++){var _0x4901d7=events[_0xb42d38];var _0x115317=createListener(_0xa8d9('0x6')+_0x4901d7,_0x7286fd);MailInteractionEvents['on'](_0x4901d7,_0x115317);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 8129ca8..49c564c 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 _0x9be2=['/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x1ea506,_0x218207){var _0x1d03d4=function(_0x1fe842){while(--_0x1fe842){_0x1ea506['push'](_0x1ea506['shift']());}};_0x1d03d4(++_0x218207);}(_0x9be2,0x85));var _0x29be=function(_0x45d198,_0x3066d6){_0x45d198=_0x45d198-0x0;var _0x3f0137=_0x9be2[_0x45d198];return _0x3f0137;};'use strict';var multer=require(_0x29be('0x0'));var util=require(_0x29be('0x1'));var path=require(_0x29be('0x2'));var timeout=require('connect-timeout');var express=require(_0x29be('0x3'));var router=express[_0x29be('0x4')]();var fs_extra=require(_0x29be('0x5'));var auth=require(_0x29be('0x6'));var interaction=require(_0x29be('0x7'));var config=require(_0x29be('0x8'));var controller=require(_0x29be('0x9'));router[_0x29be('0xa')]('/',auth[_0x29be('0xb')](),controller[_0x29be('0xc')]);router[_0x29be('0xa')](_0x29be('0xd'),auth['isAuthenticated'](),controller[_0x29be('0xe')]);router['get'](_0x29be('0xf'),auth[_0x29be('0xb')](),controller[_0x29be('0x10')]);router[_0x29be('0xa')](_0x29be('0x11'),auth[_0x29be('0xb')](),controller[_0x29be('0x12')]);router[_0x29be('0x13')]('/',auth[_0x29be('0xb')](),interaction[_0x29be('0x14')](_0x29be('0x15'),_0x29be('0x16')),controller[_0x29be('0x17')]);router[_0x29be('0x18')](_0x29be('0xf'),auth[_0x29be('0xb')](),controller['update']);router[_0x29be('0x18')](_0x29be('0x19'),auth[_0x29be('0xb')](),controller[_0x29be('0x1a')]);router[_0x29be('0x18')](_0x29be('0x1b'),auth['isAuthenticated'](),controller['reject']);router[_0x29be('0x1c')](_0x29be('0xf'),auth[_0x29be('0xb')](),controller[_0x29be('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xa40b=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa40b,0x15e));var _0xba40=function(_0x9073b,_0x361d75){_0x9073b=_0x9073b-0x0;var _0x2ceb0d=_0xa40b[_0x9073b];return _0x2ceb0d;};'use strict';var multer=require('multer');var util=require(_0xba40('0x0'));var path=require('path');var timeout=require(_0xba40('0x1'));var express=require(_0xba40('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xba40('0x3'));var interaction=require(_0xba40('0x4'));var config=require(_0xba40('0x5'));var controller=require(_0xba40('0x6'));router['get']('/',auth[_0xba40('0x7')](),controller['index']);router[_0xba40('0x8')](_0xba40('0x9'),auth[_0xba40('0x7')](),controller[_0xba40('0xa')]);router[_0xba40('0x8')](_0xba40('0xb'),auth['isAuthenticated'](),controller[_0xba40('0xc')]);router['get'](_0xba40('0xd'),auth[_0xba40('0x7')](),controller[_0xba40('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xba40('0xf')](_0xba40('0x10'),_0xba40('0x11')),controller[_0xba40('0x12')]);router[_0xba40('0x13')](_0xba40('0xb'),auth['isAuthenticated'](),controller[_0xba40('0x14')]);router[_0xba40('0x13')](_0xba40('0x15'),auth[_0xba40('0x7')](),controller[_0xba40('0x16')]);router[_0xba40('0x13')]('/:id/reject',auth[_0xba40('0x7')](),controller[_0xba40('0x17')]);router[_0xba40('0x18')](_0xba40('0xb'),auth['isAuthenticated'](),controller[_0xba40('0x19')]);module[_0xba40('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index aaa65b2..0882a84 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 _0x0c74=['long','TEXT','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM','Email','Chat','lodash','exports'];(function(_0x5131eb,_0x5e8b21){var _0x4cf620=function(_0x197a46){while(--_0x197a46){_0x5131eb['push'](_0x5131eb['shift']());}};_0x4cf620(++_0x5e8b21);}(_0x0c74,0xc1));var _0x40c7=function(_0x3884b7,_0x37682d){_0x3884b7=_0x3884b7-0x0;var _0x598253=_0x0c74[_0x3884b7];return _0x598253;};'use strict';var Sequelize=require('sequelize');var _=require(_0x40c7('0x0'));module[_0x40c7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x40c7('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x40c7('0x3')](_0x40c7('0x4'))},'read':{'type':Sequelize[_0x40c7('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x40c7('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x40c7('0x7')](0x1fe)},'from':{'type':Sequelize[_0x40c7('0x7')]},'to':{'type':Sequelize[_0x40c7('0x3')]('long')},'cc':{'type':Sequelize[_0x40c7('0x3')](_0x40c7('0x2'))},'bcc':{'type':Sequelize['TEXT'](_0x40c7('0x2'))},'subject':{'type':Sequelize[_0x40c7('0x3')]},'sentAt':{'type':Sequelize[_0x40c7('0x8')]},'attach':{'type':Sequelize[_0x40c7('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x40c7('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x40c7('0x8')]},'originTo':{'type':Sequelize[_0x40c7('0x3')](_0x40c7('0x2'))},'originCc':{'type':Sequelize[_0x40c7('0x3')](_0x40c7('0x2'))},'originChannel':{'type':Sequelize[_0x40c7('0xa')](_0x40c7('0xb'),_0x40c7('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x1faa=['BOOLEAN','out','STRING','DATE','Email','Chat','sequelize','lodash','TEXT','long','medium'];(function(_0x5e1fd2,_0x393f3b){var _0x37163f=function(_0xa59cf6){while(--_0xa59cf6){_0x5e1fd2['push'](_0x5e1fd2['shift']());}};_0x37163f(++_0x393f3b);}(_0x1faa,0x145));var _0xa1fa=function(_0x3a8c7a,_0x37ad7e){_0x3a8c7a=_0x3a8c7a-0x0;var _0x173b6e=_0x1faa[_0x3a8c7a];return _0x173b6e;};'use strict';var Sequelize=require(_0xa1fa('0x0'));var _=require(_0xa1fa('0x1'));module['exports']={'body':{'type':Sequelize[_0xa1fa('0x2')](_0xa1fa('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xa1fa('0x4'))},'read':{'type':Sequelize[_0xa1fa('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa1fa('0x6')),'defaultValue':_0xa1fa('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa1fa('0x7')](0x1fe)},'from':{'type':Sequelize[_0xa1fa('0x7')]},'to':{'type':Sequelize[_0xa1fa('0x2')](_0xa1fa('0x3'))},'cc':{'type':Sequelize[_0xa1fa('0x2')](_0xa1fa('0x3'))},'bcc':{'type':Sequelize[_0xa1fa('0x2')]('long')},'subject':{'type':Sequelize[_0xa1fa('0x2')]},'sentAt':{'type':Sequelize[_0xa1fa('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa1fa('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa1fa('0x8')]},'originTo':{'type':Sequelize[_0xa1fa('0x2')](_0xa1fa('0x3'))},'originCc':{'type':Sequelize[_0xa1fa('0x2')](_0xa1fa('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0xa1fa('0x9'),_0xa1fa('0xa')),'defaultValue':_0xa1fa('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 694f213..acf8ff1 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 _0x395a=['MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','json','offset','undefined','limit','count','status','set','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailMessage','includeAll','findAll','rows','catch','show','params','length','include','find','body','describe','create','MailAccount','MailAccountId','CmList','List','Contacts','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','basename','CmContact','ListId','List\x20not\x20found','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','reject','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','./mailMessage.socket','client','http','request','then','info','request\x20sent','debug'];(function(_0x436ee8,_0x65122d){var _0x6e79a9=function(_0x1e3aab){while(--_0x1e3aab){_0x436ee8['push'](_0x436ee8['shift']());}};_0x6e79a9(++_0x65122d);}(_0x395a,0x84));var _0xa395=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x395a[_0x4a0e68];return _0x4fb274;};'use strict';var emlformat=require(_0xa395('0x0'));var moment=require(_0xa395('0x1'));var BPromise=require('bluebird');var util=require(_0xa395('0x2'));var path=require(_0xa395('0x3'));var fs=require('fs');var _=require(_0xa395('0x4'));var Redis=require(_0xa395('0x5'));var htmlToText=require(_0xa395('0x6'));var qs=require(_0xa395('0x7'));var logger=require(_0xa395('0x8'))(_0xa395('0x9'));var interaction_log=require(_0xa395('0x8'))('mail-interactions');var config=require(_0xa395('0xa'));var db=require('../../mysqldb')['db'];config[_0xa395('0xb')]=_[_0xa395('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xa395('0xd'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa395('0xe')][_0xa395('0xf')]({'port':0x232c});var client9003=jayson[_0xa395('0xe')][_0xa395('0xf')]({'port':0x232b});var client9002=jayson[_0xa395('0xe')][_0xa395('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x3ddd38,_0x2e98be,_0x2dffd9,_0x7c954){return new BPromise(function(_0x3350a0,_0x4ae5d0){var _0x3d72b8=_0x7c954||client;return _0x3d72b8[_0xa395('0x10')](_0x3ddd38,_0x2dffd9)[_0xa395('0x11')](function(_0xee4088){logger[_0xa395('0x12')]('MailMessage,\x20%s,\x20%s',_0x2e98be,_0xa395('0x13'));logger[_0xa395('0x14')](_0xa395('0x15'),_0x2e98be,_0xa395('0x13'),JSON[_0xa395('0x16')](_0xee4088));if(_0xee4088[_0xa395('0x17')]){if(_0xee4088['error']['code']===0x1f4){logger['error'](_0xa395('0x18'),_0x2e98be,_0xee4088[_0xa395('0x17')][_0xa395('0x19')]);return _0x4ae5d0(_0xee4088['error'][_0xa395('0x19')]);}logger[_0xa395('0x17')](_0xa395('0x18'),_0x2e98be,_0xee4088[_0xa395('0x17')][_0xa395('0x19')]);return _0x3350a0(_0xee4088['error'][_0xa395('0x19')]);}else{logger[_0xa395('0x12')](_0xa395('0x18'),_0x2e98be,'request\x20sent');_0x3350a0(_0xee4088['result'][_0xa395('0x19')]);}})['catch'](function(_0x445658){logger[_0xa395('0x17')](_0xa395('0x18'),_0x2e98be,_0x445658);_0x4ae5d0(_0x445658);});});}function respondWithResult(_0x521ffe,_0x909600){_0x909600=_0x909600||0xc8;return function(_0x10a903){if(_0x10a903){return _0x521ffe['status'](_0x909600)[_0xa395('0x1a')](_0x10a903);}};}function respondWithFilteredResult(_0x341a0b,_0x58245b){return function(_0x5a65ff){if(_0x5a65ff){var _0x36cc04=typeof _0x58245b[_0xa395('0x1b')]===_0xa395('0x1c')&&typeof _0x58245b[_0xa395('0x1d')]==='undefined';var _0x28f5aa=_0x5a65ff['count'];var _0x5f4ee7=_0x36cc04?0x0:_0x58245b['offset'];var _0x5b9672=_0x36cc04?_0x5a65ff[_0xa395('0x1e')]:_0x58245b[_0xa395('0x1b')]+_0x58245b[_0xa395('0x1d')];var _0x4db8fa;if(_0x5b9672>=_0x28f5aa){_0x5b9672=_0x28f5aa;_0x4db8fa=0xc8;}else{_0x4db8fa=0xce;}_0x341a0b[_0xa395('0x1f')](_0x4db8fa);return _0x341a0b[_0xa395('0x20')]('Content-Range',_0x5f4ee7+'-'+_0x5b9672+'/'+_0x28f5aa)[_0xa395('0x1a')](_0x5a65ff);}return null;};}function saveUpdates(_0x224397){return function(_0x1b1b8c){if(_0x1b1b8c){return _0x1b1b8c[_0xa395('0x21')](_0x224397)[_0xa395('0x11')](function(_0x400295){return _0x400295;});}return null;};}function removeEntity(_0x42cda3){return function(_0x2ea8d0){if(_0x2ea8d0){return _0x2ea8d0[_0xa395('0x22')]()['then'](function(){_0x42cda3[_0xa395('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4131d6){return function(_0x267ea4){if(!_0x267ea4){_0x4131d6['sendStatus'](0x194);}return _0x267ea4;};}function handleError(_0x197382,_0x690964){_0x690964=_0x690964||0x1f4;return function(_0x2383bb){logger[_0xa395('0x17')](_0x2383bb[_0xa395('0x23')]);if(_0x2383bb[_0xa395('0x24')]){delete _0x2383bb[_0xa395('0x24')];}_0x197382[_0xa395('0x1f')](_0x690964)[_0xa395('0x25')](_0x2383bb);};}exports[_0xa395('0x26')]=function(_0x521a39,_0x2b09ef){var _0x4ad3a5={},_0x120155={},_0xaf704={'count':0x0,'rows':[]};var _0x8521ae=_[_0xa395('0x27')](db['MailMessage'][_0xa395('0x28')],function(_0x371e91){return{'name':_0x371e91[_0xa395('0x29')],'type':_0x371e91[_0xa395('0x2a')]['key']};});_0x120155[_0xa395('0x2b')]=_[_0xa395('0x27')](_0x8521ae,_0xa395('0x24'));_0x120155[_0xa395('0x2c')]=_[_0xa395('0x2d')](_0x521a39[_0xa395('0x2c')]);_0x120155[_0xa395('0x2e')]=_[_0xa395('0x2f')](_0x120155[_0xa395('0x2b')],_0x120155[_0xa395('0x2c')]);_0x4ad3a5[_0xa395('0x30')]=_['intersection'](_0x120155[_0xa395('0x2b')],qs[_0xa395('0x31')](_0x521a39['query'][_0xa395('0x31')]));_0x4ad3a5['attributes']=_0x4ad3a5['attributes']['length']?_0x4ad3a5[_0xa395('0x30')]:_0x120155[_0xa395('0x2b')];if(!_0x521a39[_0xa395('0x2c')]['hasOwnProperty'](_0xa395('0x32'))){_0x4ad3a5[_0xa395('0x1d')]=qs[_0xa395('0x1d')](_0x521a39[_0xa395('0x2c')]['limit']);_0x4ad3a5[_0xa395('0x1b')]=qs['offset'](_0x521a39[_0xa395('0x2c')][_0xa395('0x1b')]);}_0x4ad3a5[_0xa395('0x33')]=qs[_0xa395('0x34')](_0x521a39[_0xa395('0x2c')][_0xa395('0x34')]);_0x4ad3a5[_0xa395('0x35')]=qs['filters'](_[_0xa395('0x36')](_0x521a39['query'],_0x120155[_0xa395('0x2e')]),_0x8521ae);if(_0x521a39[_0xa395('0x2c')][_0xa395('0x37')]){_0x4ad3a5[_0xa395('0x35')]=_[_0xa395('0x38')](_0x4ad3a5[_0xa395('0x35')],{'$or':_[_0xa395('0x27')](_0x8521ae,function(_0x140380){if(_0x140380['type']!==_0xa395('0x39')){var _0x48dfb3={};_0x48dfb3[_0x140380[_0xa395('0x24')]]={'$like':'%'+_0x521a39[_0xa395('0x2c')][_0xa395('0x37')]+'%'};return _0x48dfb3;}})});}_0x4ad3a5=_[_0xa395('0x38')]({},_0x4ad3a5,_0x521a39[_0xa395('0x3a')]);var _0x53d25c={'where':_0x4ad3a5['where']};return db[_0xa395('0x3b')][_0xa395('0x1e')](_0x53d25c)[_0xa395('0x11')](function(_0x5dc0f7){_0xaf704[_0xa395('0x1e')]=_0x5dc0f7;if(_0x521a39[_0xa395('0x2c')][_0xa395('0x3c')]){_0x4ad3a5['include']=[{'all':!![]}];}return db[_0xa395('0x3b')][_0xa395('0x3d')](_0x4ad3a5);})[_0xa395('0x11')](function(_0x1d29e1){_0xaf704[_0xa395('0x3e')]=_0x1d29e1;return _0xaf704;})['then'](respondWithFilteredResult(_0x2b09ef,_0x4ad3a5))[_0xa395('0x3f')](handleError(_0x2b09ef,null));};exports[_0xa395('0x40')]=function(_0x4c4089,_0x587cfb){var _0x457c5c={'raw':!![],'where':{'id':_0x4c4089[_0xa395('0x41')]['id']}},_0x5d06ae={};_0x5d06ae[_0xa395('0x2b')]=_['keys'](db[_0xa395('0x3b')][_0xa395('0x28')]);_0x5d06ae[_0xa395('0x2c')]=_['keys'](_0x4c4089['query']);_0x5d06ae['filters']=_['intersection'](_0x5d06ae[_0xa395('0x2b')],_0x5d06ae[_0xa395('0x2c')]);_0x457c5c['attributes']=_[_0xa395('0x2f')](_0x5d06ae['model'],qs[_0xa395('0x31')](_0x4c4089[_0xa395('0x2c')]['fields']));_0x457c5c['attributes']=_0x457c5c['attributes'][_0xa395('0x42')]?_0x457c5c['attributes']:_0x5d06ae[_0xa395('0x2b')];if(_0x4c4089['query'][_0xa395('0x3c')]){_0x457c5c[_0xa395('0x43')]=[{'all':!![]}];}_0x457c5c=_[_0xa395('0x38')]({},_0x457c5c,_0x4c4089[_0xa395('0x3a')]);return db[_0xa395('0x3b')][_0xa395('0x44')](_0x457c5c)['then'](handleEntityNotFound(_0x587cfb,null))[_0xa395('0x11')](respondWithResult(_0x587cfb,null))[_0xa395('0x3f')](handleError(_0x587cfb,null));};exports['update']=function(_0x1de7fe,_0x45908a){if(_0x1de7fe['body']['id']){delete _0x1de7fe['body']['id'];}return db[_0xa395('0x3b')][_0xa395('0x44')]({'where':{'id':_0x1de7fe[_0xa395('0x41')]['id']}})[_0xa395('0x11')](handleEntityNotFound(_0x45908a,null))[_0xa395('0x11')](saveUpdates(_0x1de7fe[_0xa395('0x45')],null))['then'](respondWithResult(_0x45908a,null))[_0xa395('0x3f')](handleError(_0x45908a,null));};exports[_0xa395('0x22')]=function(_0x52c6ff,_0x3dfe62){return db[_0xa395('0x3b')][_0xa395('0x44')]({'where':{'id':_0x52c6ff[_0xa395('0x41')]['id']}})[_0xa395('0x11')](handleEntityNotFound(_0x3dfe62,null))['then'](removeEntity(_0x3dfe62,null))[_0xa395('0x3f')](handleError(_0x3dfe62,null));};exports[_0xa395('0x46')]=function(_0x54f92a,_0x15bf28){return db[_0xa395('0x3b')][_0xa395('0x46')]()['then'](respondWithResult(_0x15bf28,null))['catch'](handleError(_0x15bf28,null));};exports[_0xa395('0x47')]=function(_0x45fe64,_0x422608){return db[_0xa395('0x3b')][_0xa395('0x47')](_0x45fe64[_0xa395('0x45')])[_0xa395('0x11')](function(_0x333330){if(_0x333330){if(_0x333330['direction']==='out'&&!_0x333330['secret']){var _0x1d83e5,_0x37feb8,_0x104cc6;if(_0x45fe64['body']['to']){_0x37feb8=_0x45fe64[_0xa395('0x45')]['to']['split'](',')[0x0];}return db[_0xa395('0x48')]['findOne']({'where':{'id':_0x333330[_0xa395('0x49')]},'include':[{'model':db[_0xa395('0x4a')],'as':_0xa395('0x4b'),'include':[{'model':db['CmContact'],'as':_0xa395('0x4c'),'where':{'email':_0x37feb8},'limit':0x1,'order':[['updatedAt',_0xa395('0x4d')]]}]},{'model':db[_0xa395('0x4e')],'as':_0xa395('0x4f'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa395('0x50'),'raw':!![]}]}]})[_0xa395('0x11')](function(_0x5dbfdd){_0x1d83e5=_0x5dbfdd;if(!_0x1d83e5||!_0x1d83e5[_0xa395('0x4f')])return;var _0x5c68a6=_0x1d83e5['getSmtpOptions']();if(_0x45fe64[_0xa395('0x45')][_0xa395('0x51')]&&_0x45fe64[_0xa395('0x45')][_0xa395('0x51')][_0xa395('0x42')]){for(var _0x18cc20=0x0;_0x18cc20<_0x45fe64['body']['attachments'][_0xa395('0x42')];_0x18cc20+=0x1){_0x45fe64[_0xa395('0x45')][_0xa395('0x51')][_0x18cc20]={'filename':_0x45fe64['body'][_0xa395('0x51')][_0x18cc20][_0xa395('0x24')],'path':path[_0xa395('0x52')](config[_0xa395('0x53')],'server/files/attachments',_0x45fe64[_0xa395('0x45')]['attachments'][_0x18cc20][_0xa395('0x54')])};}}_0x104cc6={'account':_0x5c68a6,'message':_0x45fe64[_0xa395('0x45')]};return;})[_0xa395('0x11')](function(){if(_0x1d83e5[_0xa395('0x4b')]){if(_0x1d83e5[_0xa395('0x4b')][_0xa395('0x4c')][_0xa395('0x42')]){return _0x1d83e5['List'][_0xa395('0x4c')][0x0];}else{return db[_0xa395('0x55')][_0xa395('0x47')](_[_0xa395('0xc')](_0x45fe64[_0xa395('0x45')],{'firstName':_0x45fe64[_0xa395('0x45')]['to'],'email':_0x45fe64['body']['to'],'phone':_0x45fe64['body']['to'],'ListId':_0x1d83e5[_0xa395('0x56')]}));}}else{throw new Error(_0xa395('0x57'));}})[_0xa395('0x11')](function(){if(_0x104cc6){return respondWithRpcPromise('SendMail','sendMail',_0x104cc6,client9003)['then'](function(_0x3b30d1){return _0x333330[_0xa395('0x21')]({'read':!![],'messageId':_0x3b30d1[_0xa395('0x58')],'sentAt':moment()[_0xa395('0x59')](_0xa395('0x5a'))});})['catch'](function(_0x1e141c){logger[_0xa395('0x17')]('%s',JSON[_0xa395('0x16')](_0x1e141c));return _0x333330;});}return _0x333330;});}return _0x333330;}})[_0xa395('0x11')](respondWithResult(_0x422608,0xc9))[_0xa395('0x3f')](handleError(_0x422608,null));};exports[_0xa395('0x5b')]=function(_0x39204d,_0x4adf42){var _0x6b268f={'agent':{},'channel':'mail'};if(_0x39204d[_0xa395('0x45')]['id']){delete _0x39204d[_0xa395('0x45')]['id'];}_0x39204d[_0xa395('0x45')]['read']=!![];_0x39204d[_0xa395('0x45')][_0xa395('0x5c')]=moment()['format'](_0xa395('0x5a'));_0x39204d[_0xa395('0x45')][_0xa395('0x5d')]=_0x39204d[_0xa395('0x45')]['UserId']||_0x39204d['user']['id'];_0x6b268f[_0xa395('0x5e')]['id']=_0x39204d[_0xa395('0x45')][_0xa395('0x5d')];return db[_0xa395('0x3b')][_0xa395('0x44')]({'where':{'id':_0x39204d[_0xa395('0x41')]['id'],'UserId':null}})[_0xa395('0x11')](handleEntityNotFound(_0x4adf42,null))[_0xa395('0x11')](saveUpdates(_0x39204d[_0xa395('0x45')],null))[_0xa395('0x11')](function(_0x4fdbe7){if(_0x4fdbe7){_0x6b268f['message']=_0x4fdbe7[_0xa395('0x5f')]({'plain':!![]});return db[_0xa395('0x60')][_0xa395('0x44')]({'where':{'id':_0x4fdbe7[_0xa395('0x61')]}});}return null;})[_0xa395('0x11')](handleEntityNotFound(_0x4adf42,null))[_0xa395('0x11')](function(_0x1d8769){if(_0x1d8769){return _0x1d8769[_0xa395('0x21')]({'UserId':_0x39204d[_0xa395('0x45')][_0xa395('0x5d')],'read1stAt':_[_0xa395('0x62')](_0x1d8769[_0xa395('0x63')])?moment()['format'](_0xa395('0x5a')):undefined});}return null;})['then'](function(_0x1a98b2){if(_0x1a98b2){_0x6b268f[_0xa395('0x64')]=_0x1a98b2[_0xa395('0x5f')]({'plain':!![]});interaction_log[_0xa395('0x12')](_0xa395('0x65'),_0x39204d[_0xa395('0x66')]['id'],_0x39204d[_0xa395('0x66')][_0xa395('0x24')],_0x39204d['user'][_0xa395('0x67')],_0x6b268f[_0xa395('0x64')]['id'],_0x39204d[_0xa395('0x45')]?JSON[_0xa395('0x16')](_0x39204d[_0xa395('0x45')]):_0xa395('0x68'));return respondWithRpcPromise(_0xa395('0x69'),'acceptMessage',_0x6b268f);}return null;})['then'](function(_0x2b9525){var _0x27ef08=_0xa395('0x6a')+_0x2b9525[_0xa395('0x19')][_0xa395('0x6b')];return db[_0xa395('0x6c')][_0xa395('0x2c')](_0x27ef08,{'type':db[_0xa395('0x6d')][_0xa395('0x6e')][_0xa395('0x6f')],'raw':!![]})[_0xa395('0x11')](function(_0x793bf8){return _0x793bf8;});})[_0xa395('0x11')](function(_0x269ad9){if(_0x269ad9){_0x6b268f[_0xa395('0x19')][_0xa395('0x70')]=_0x269ad9[0x0];if(!_0x39204d['body'][_0xa395('0x5d')])return;return db[_0xa395('0x71')][_0xa395('0x44')]({'where':{'id':_0x39204d[_0xa395('0x45')][_0xa395('0x5d')],'role':'agent'},'attributes':['id',_0xa395('0x24'),_0xa395('0x72'),_0xa395('0x73'),_0xa395('0x74')],'raw':!![]});}return null;})['then'](function(_0x562018){if(!_0x562018)return null;_0x6b268f[_0xa395('0x19')][_0xa395('0x5e')]=_0x562018;return _0x6b268f;})[_0xa395('0x11')](function(_0x5a7296){if(_0x5a7296){if(_0x39204d[_0xa395('0x45')][_0xa395('0x75')]){_0x6b268f[_0xa395('0x19')][_0xa395('0x76')]=util['format'](_0xa395('0x77'),_0x39204d[_0xa395('0x66')]['name']);_0x6b268f[_0xa395('0x19')]['channel']=_0x6b268f[_0xa395('0x78')];_0x6b268f['message'][_0xa395('0x79')]=_0x6b268f[_0xa395('0x78')];_0x6b268f[_0xa395('0x19')][_0xa395('0x7a')]=_0xa395('0x5b');_0x6b268f[_0xa395('0x19')][_0xa395('0x45')]=htmlToText[_0xa395('0x7b')](_0x6b268f['message'][_0xa395('0x45')]);return respondWithRpcPromise(_0xa395('0x7c'),_0xa395('0x7c'),{'event':'acceptmessage','message':_0x6b268f['message']},client9002)[_0xa395('0x11')](function(){return _0x6b268f;});}return _0x6b268f;}return null;})[_0xa395('0x11')](respondWithResult(_0x4adf42,null))[_0xa395('0x3f')](handleError(_0x4adf42,null));};exports['reject']=function(_0x5e5b0e,_0x25183e){var _0x364ed8={'agent':{},'channel':_0xa395('0x7d')};if(_0x5e5b0e[_0xa395('0x45')]['id']){delete _0x5e5b0e[_0xa395('0x45')]['id'];}_0x5e5b0e['body'][_0xa395('0x5d')]=_0x5e5b0e[_0xa395('0x45')][_0xa395('0x5d')]||_0x5e5b0e['user']['id'];_0x364ed8[_0xa395('0x5e')]['id']=_0x5e5b0e[_0xa395('0x45')][_0xa395('0x5d')];return db['MailMessage'][_0xa395('0x44')]({'where':{'id':_0x5e5b0e[_0xa395('0x41')]['id'],'UserId':null}})[_0xa395('0x11')](handleEntityNotFound(_0x25183e,null))[_0xa395('0x11')](function(_0x498ea0){if(_0x498ea0){_0x364ed8['message']=_0x498ea0['get']({'plain':!![]});return db['MailInteraction'][_0xa395('0x44')]({'where':{'id':_0x498ea0['MailInteractionId']}});}return null;})[_0xa395('0x11')](handleEntityNotFound(_0x25183e,null))[_0xa395('0x11')](function(_0x2d0faf){if(_0x2d0faf){_0x364ed8[_0xa395('0x64')]=_0x2d0faf[_0xa395('0x5f')]({'plain':!![]});interaction_log[_0xa395('0x12')](_0xa395('0x7e'),_0x5e5b0e[_0xa395('0x66')]['id'],_0x5e5b0e['user'][_0xa395('0x24')],_0x5e5b0e[_0xa395('0x66')][_0xa395('0x67')],_0x364ed8[_0xa395('0x64')]['id'],_0x5e5b0e['body']?JSON[_0xa395('0x16')](_0x5e5b0e[_0xa395('0x45')]):'null');return respondWithRpcPromise(_0xa395('0x7f'),'rejectMessage',_0x364ed8);}return null;})[_0xa395('0x11')](function(_0xd0b316){var _0x39a32f=_0xa395('0x6a')+_0xd0b316[_0xa395('0x19')][_0xa395('0x6b')];return db[_0xa395('0x6c')][_0xa395('0x2c')](_0x39a32f,{'type':db['Sequelize'][_0xa395('0x6e')]['SELECT'],'raw':!![]})[_0xa395('0x11')](function(_0x3a79e9){return _0x3a79e9;});})['then'](function(_0x3ea544){if(_0x3ea544){_0x364ed8[_0xa395('0x19')][_0xa395('0x70')]=_0x3ea544[0x0];if(!_0x5e5b0e[_0xa395('0x45')][_0xa395('0x5d')])return;return db[_0xa395('0x71')]['find']({'where':{'id':_0x5e5b0e['body'][_0xa395('0x5d')],'role':_0xa395('0x5e')},'attributes':['id',_0xa395('0x24'),_0xa395('0x72'),_0xa395('0x73'),_0xa395('0x74')],'raw':!![]});}return null;})['then'](function(_0x114d7d){if(!_0x114d7d)return null;_0x364ed8['message'][_0xa395('0x5e')]=_0x114d7d;return _0x364ed8;})[_0xa395('0x11')](function(_0x1bd098){if(_0x1bd098){_0x1bd098[_0xa395('0x19')][_0xa395('0x76')]=util[_0xa395('0x59')](_0xa395('0x77'),_0x5e5b0e[_0xa395('0x66')][_0xa395('0x24')]);_0x1bd098[_0xa395('0x19')]['channel']=_0x364ed8[_0xa395('0x78')];_0x1bd098[_0xa395('0x19')][_0xa395('0x79')]=_0x364ed8[_0xa395('0x78')];_0x1bd098[_0xa395('0x19')]['event']=_0xa395('0x80');_0x1bd098[_0xa395('0x19')]['body']=htmlToText['fromString'](_0x364ed8[_0xa395('0x19')][_0xa395('0x45')]);respondWithRpcPromise(_0xa395('0x7c'),_0xa395('0x7c'),{'event':_0xa395('0x81'),'message':_0x1bd098[_0xa395('0x19')]},client9002);return _0x364ed8;}return null;})[_0xa395('0x11')](respondWithResult(_0x25183e,null))['catch'](handleError(_0x25183e,null));};exports[_0xa395('0x82')]=function(_0x1e68c6,_0x498bb2){var _0x3d9fa6=moment()[_0xa395('0x83')]()[_0xa395('0x84')]();var _0x56e0e4=path[_0xa395('0x52')](config[_0xa395('0x53')],_0xa395('0x85'),_0xa395('0x86'),_0xa395('0x87'));var _0x366aef=path[_0xa395('0x52')](config[_0xa395('0x53')],_0xa395('0x85'),'files',_0xa395('0x51'));var _0x351c6f=util['format'](_0xa395('0x88'),_0x3d9fa6);return db['MailMessage']['find']({'where':{'id':_0x1e68c6[_0xa395('0x41')]['id']},'attributes':['id',_0xa395('0x45'),_0xa395('0x89'),'to','cc','bcc',_0xa395('0x8a'),_0xa395('0x8b')],'include':_0x1e68c6['query'][_0xa395('0x51')]?[{'model':db[_0xa395('0x8c')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x498bb2,null))[_0xa395('0x11')](function(_0x39a7df){if(_0x39a7df){var _0x470d9c=_0x39a7df;var _0x223307={'from':_0x470d9c[_0xa395('0x89')],'to':_0x470d9c['to'],'subject':_0x470d9c[_0xa395('0x8a')],'html':htmlEntities[_0xa395('0x8d')](_0x470d9c[_0xa395('0x45')]),'headers':{'Date':moment(_0x470d9c[_0xa395('0x8b')])[_0xa395('0x59')](_0xa395('0x8e'))},'attachments':[]};if(_0x39a7df['cc']){_0x223307[_0xa395('0x8f')]['Cc']=_0x39a7df['cc'];}if(_0x39a7df[_0xa395('0x90')]){_0x223307[_0xa395('0x8f')][_0xa395('0x91')]=_0x39a7df[_0xa395('0x90')];}return new BPromise(function(_0x4aebb5,_0x29f21e){if(_0x39a7df['Attachments']){for(var _0x4538e6=0x0;_0x4538e6<_0x39a7df['Attachments'][_0xa395('0x42')];_0x4538e6++){var _0x34d3d0=_0x39a7df[_0xa395('0x92')][_0x4538e6];var _0x273387=path[_0xa395('0x52')](_0x366aef,_0x34d3d0['basename']);if(fs[_0xa395('0x93')](_0x273387)){_0x223307[_0xa395('0x51')][_0xa395('0x94')]({'name':_0x34d3d0[_0xa395('0x24')],'contentType':_0x34d3d0['type'],'data':fs[_0xa395('0x95')](_0x273387)});}}}emlformat[_0xa395('0x96')](_0x223307,function(_0x4b9697,_0x29a143){if(_0x4b9697)return _0x29f21e(_0x4b9697);fs[_0xa395('0x97')](path[_0xa395('0x52')](_0x56e0e4,_0x351c6f),_0x29a143);return _0x4aebb5(_0x29a143);});});}})['then'](function(_0x389f46){if(_0x389f46){return _0x498bb2[_0xa395('0x82')](path['join'](_0x56e0e4,_0x351c6f),_0x351c6f,function(_0x1e125e){if(!_0x1e125e)fs[_0xa395('0x98')](path[_0xa395('0x52')](_0x56e0e4,_0x351c6f));});}})[_0xa395('0x3f')](handleError(_0x498bb2,null));}; \ No newline at end of file +var _0x37eb=['sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','user','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','internal','agent','interface','SIP/%s','channel','motionChannel','accept','fromString','EventManager','acceptmessage','reject','get','MailInteraction','RejectMessage','rejectMessage','event','download','unix','toString','server','files','tmp','bcc','subject','Attachment','Attachments','from','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','writeFileSync','unlinkSync','eml-format','bluebird','util','lodash','ioredis','html-to-text','../../config/logger','mail-interactions','../../mysqldb','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','json','offset','undefined','limit','set','Content-Range','update','destroy','end','name','index','MailMessage','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','keys','includeAll','find','body','describe','create','direction','out','secret','split','MailAccount','CmList','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','List','ListId','SendMail'];(function(_0x38a080,_0x4e0be8){var _0x39e487=function(_0x42c6c0){while(--_0x42c6c0){_0x38a080['push'](_0x38a080['shift']());}};_0x39e487(++_0x4e0be8);}(_0x37eb,0xdb));var _0xb37e=function(_0x578a1c,_0x53a54a){_0x578a1c=_0x578a1c-0x0;var _0x23ba6e=_0x37eb[_0x578a1c];return _0x23ba6e;};'use strict';var emlformat=require(_0xb37e('0x0'));var moment=require('moment');var BPromise=require(_0xb37e('0x1'));var util=require(_0xb37e('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xb37e('0x3'));var Redis=require(_0xb37e('0x4'));var htmlToText=require(_0xb37e('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var interaction_log=require(_0xb37e('0x6'))(_0xb37e('0x7'));var config=require('../../config/environment');var db=require(_0xb37e('0x8'))['db'];config['redis']=_[_0xb37e('0x9')](config[_0xb37e('0xa')],{'host':_0xb37e('0xb'),'port':0x18eb});var socket=require(_0xb37e('0xc'))(new Redis(config['redis']));var htmlEntities=require(_0xb37e('0xd'));require(_0xb37e('0xe'))[_0xb37e('0xf')](socket);var jayson=require(_0xb37e('0x10'));var client=jayson[_0xb37e('0x11')][_0xb37e('0x12')]({'port':0x232c});var client9003=jayson[_0xb37e('0x11')][_0xb37e('0x12')]({'port':0x232b});var client9002=jayson[_0xb37e('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1623cd,_0x36439,_0x42fade,_0x7b9f5d){return new BPromise(function(_0x4561ba,_0x495039){var _0x3e7996=_0x7b9f5d||client;return _0x3e7996[_0xb37e('0x13')](_0x1623cd,_0x42fade)[_0xb37e('0x14')](function(_0x33eace){logger[_0xb37e('0x15')](_0xb37e('0x16'),_0x36439,_0xb37e('0x17'));logger[_0xb37e('0x18')](_0xb37e('0x19'),_0x36439,_0xb37e('0x17'),JSON[_0xb37e('0x1a')](_0x33eace));if(_0x33eace[_0xb37e('0x1b')]){if(_0x33eace['error'][_0xb37e('0x1c')]===0x1f4){logger[_0xb37e('0x1b')](_0xb37e('0x16'),_0x36439,_0x33eace[_0xb37e('0x1b')][_0xb37e('0x1d')]);return _0x495039(_0x33eace[_0xb37e('0x1b')][_0xb37e('0x1d')]);}logger[_0xb37e('0x1b')](_0xb37e('0x16'),_0x36439,_0x33eace[_0xb37e('0x1b')][_0xb37e('0x1d')]);return _0x4561ba(_0x33eace[_0xb37e('0x1b')][_0xb37e('0x1d')]);}else{logger[_0xb37e('0x15')]('MailMessage,\x20%s,\x20%s',_0x36439,_0xb37e('0x17'));_0x4561ba(_0x33eace['result'][_0xb37e('0x1d')]);}})['catch'](function(_0x18ae5f){logger[_0xb37e('0x1b')](_0xb37e('0x16'),_0x36439,_0x18ae5f);_0x495039(_0x18ae5f);});});}function respondWithResult(_0x58cb8c,_0x3a3588){_0x3a3588=_0x3a3588||0xc8;return function(_0x2e3c33){if(_0x2e3c33){return _0x58cb8c[_0xb37e('0x1e')](_0x3a3588)[_0xb37e('0x1f')](_0x2e3c33);}};}function respondWithFilteredResult(_0x2d7884,_0x407213){return function(_0x50696b){if(_0x50696b){var _0x139975=typeof _0x407213[_0xb37e('0x20')]===_0xb37e('0x21')&&typeof _0x407213[_0xb37e('0x22')]==='undefined';var _0x1ac80b=_0x50696b['count'];var _0x37ca79=_0x139975?0x0:_0x407213[_0xb37e('0x20')];var _0x2fb29a=_0x139975?_0x50696b['count']:_0x407213[_0xb37e('0x20')]+_0x407213[_0xb37e('0x22')];var _0x269315;if(_0x2fb29a>=_0x1ac80b){_0x2fb29a=_0x1ac80b;_0x269315=0xc8;}else{_0x269315=0xce;}_0x2d7884[_0xb37e('0x1e')](_0x269315);return _0x2d7884[_0xb37e('0x23')](_0xb37e('0x24'),_0x37ca79+'-'+_0x2fb29a+'/'+_0x1ac80b)[_0xb37e('0x1f')](_0x50696b);}return null;};}function saveUpdates(_0x33abcf){return function(_0x47e81a){if(_0x47e81a){return _0x47e81a[_0xb37e('0x25')](_0x33abcf)[_0xb37e('0x14')](function(_0x3bd25f){return _0x3bd25f;});}return null;};}function removeEntity(_0x57f6e7){return function(_0x2b84ea){if(_0x2b84ea){return _0x2b84ea[_0xb37e('0x26')]()[_0xb37e('0x14')](function(){_0x57f6e7[_0xb37e('0x1e')](0xcc)[_0xb37e('0x27')]();});}};}function handleEntityNotFound(_0x4db9e4){return function(_0x20406c){if(!_0x20406c){_0x4db9e4['sendStatus'](0x194);}return _0x20406c;};}function handleError(_0x484802,_0x18bed6){_0x18bed6=_0x18bed6||0x1f4;return function(_0x2a46d3){logger[_0xb37e('0x1b')](_0x2a46d3['stack']);if(_0x2a46d3[_0xb37e('0x28')]){delete _0x2a46d3[_0xb37e('0x28')];}_0x484802['status'](_0x18bed6)['send'](_0x2a46d3);};}exports[_0xb37e('0x29')]=function(_0x324836,_0x29da15){var _0x50087c={},_0x297f83={},_0x3e59ac={'count':0x0,'rows':[]};var _0x9f77ae=_['map'](db[_0xb37e('0x2a')][_0xb37e('0x2b')],function(_0x5d5743){return{'name':_0x5d5743[_0xb37e('0x2c')],'type':_0x5d5743[_0xb37e('0x2d')][_0xb37e('0x2e')]};});_0x297f83[_0xb37e('0x2f')]=_[_0xb37e('0x30')](_0x9f77ae,_0xb37e('0x28'));_0x297f83['query']=_['keys'](_0x324836['query']);_0x297f83[_0xb37e('0x31')]=_[_0xb37e('0x32')](_0x297f83[_0xb37e('0x2f')],_0x297f83[_0xb37e('0x33')]);_0x50087c[_0xb37e('0x34')]=_[_0xb37e('0x32')](_0x297f83[_0xb37e('0x2f')],qs[_0xb37e('0x35')](_0x324836[_0xb37e('0x33')][_0xb37e('0x35')]));_0x50087c[_0xb37e('0x34')]=_0x50087c[_0xb37e('0x34')][_0xb37e('0x36')]?_0x50087c[_0xb37e('0x34')]:_0x297f83['model'];if(!_0x324836['query'][_0xb37e('0x37')](_0xb37e('0x38'))){_0x50087c[_0xb37e('0x22')]=qs[_0xb37e('0x22')](_0x324836[_0xb37e('0x33')]['limit']);_0x50087c[_0xb37e('0x20')]=qs[_0xb37e('0x20')](_0x324836[_0xb37e('0x33')][_0xb37e('0x20')]);}_0x50087c[_0xb37e('0x39')]=qs['sort'](_0x324836[_0xb37e('0x33')][_0xb37e('0x3a')]);_0x50087c[_0xb37e('0x3b')]=qs[_0xb37e('0x31')](_[_0xb37e('0x3c')](_0x324836[_0xb37e('0x33')],_0x297f83[_0xb37e('0x31')]),_0x9f77ae);if(_0x324836['query'][_0xb37e('0x3d')]){_0x50087c['where']=_['merge'](_0x50087c[_0xb37e('0x3b')],{'$or':_[_0xb37e('0x30')](_0x9f77ae,function(_0x106b42){if(_0x106b42['type']!==_0xb37e('0x3e')){var _0x212d1a={};_0x212d1a[_0x106b42[_0xb37e('0x28')]]={'$like':'%'+_0x324836[_0xb37e('0x33')]['filter']+'%'};return _0x212d1a;}})});}_0x50087c=_[_0xb37e('0x3f')]({},_0x50087c,_0x324836[_0xb37e('0x40')]);var _0x2f7f20={'where':_0x50087c[_0xb37e('0x3b')]};return db['MailMessage'][_0xb37e('0x41')](_0x2f7f20)[_0xb37e('0x14')](function(_0x25e55f){_0x3e59ac[_0xb37e('0x41')]=_0x25e55f;if(_0x324836[_0xb37e('0x33')]['includeAll']){_0x50087c[_0xb37e('0x42')]=[{'all':!![]}];}return db[_0xb37e('0x2a')][_0xb37e('0x43')](_0x50087c);})[_0xb37e('0x14')](function(_0xc2fe36){_0x3e59ac[_0xb37e('0x44')]=_0xc2fe36;return _0x3e59ac;})[_0xb37e('0x14')](respondWithFilteredResult(_0x29da15,_0x50087c))[_0xb37e('0x45')](handleError(_0x29da15,null));};exports[_0xb37e('0x46')]=function(_0x351851,_0x316cdd){var _0x3597cd={'raw':!![],'where':{'id':_0x351851[_0xb37e('0x47')]['id']}},_0x5dcdb2={};_0x5dcdb2[_0xb37e('0x2f')]=_[_0xb37e('0x48')](db[_0xb37e('0x2a')][_0xb37e('0x2b')]);_0x5dcdb2[_0xb37e('0x33')]=_[_0xb37e('0x48')](_0x351851[_0xb37e('0x33')]);_0x5dcdb2[_0xb37e('0x31')]=_[_0xb37e('0x32')](_0x5dcdb2[_0xb37e('0x2f')],_0x5dcdb2[_0xb37e('0x33')]);_0x3597cd[_0xb37e('0x34')]=_[_0xb37e('0x32')](_0x5dcdb2[_0xb37e('0x2f')],qs[_0xb37e('0x35')](_0x351851[_0xb37e('0x33')][_0xb37e('0x35')]));_0x3597cd['attributes']=_0x3597cd[_0xb37e('0x34')]['length']?_0x3597cd[_0xb37e('0x34')]:_0x5dcdb2[_0xb37e('0x2f')];if(_0x351851[_0xb37e('0x33')][_0xb37e('0x49')]){_0x3597cd[_0xb37e('0x42')]=[{'all':!![]}];}_0x3597cd=_[_0xb37e('0x3f')]({},_0x3597cd,_0x351851[_0xb37e('0x40')]);return db[_0xb37e('0x2a')][_0xb37e('0x4a')](_0x3597cd)[_0xb37e('0x14')](handleEntityNotFound(_0x316cdd,null))[_0xb37e('0x14')](respondWithResult(_0x316cdd,null))[_0xb37e('0x45')](handleError(_0x316cdd,null));};exports[_0xb37e('0x25')]=function(_0x1f37d2,_0x2b2a8b){if(_0x1f37d2[_0xb37e('0x4b')]['id']){delete _0x1f37d2[_0xb37e('0x4b')]['id'];}return db[_0xb37e('0x2a')][_0xb37e('0x4a')]({'where':{'id':_0x1f37d2[_0xb37e('0x47')]['id']}})[_0xb37e('0x14')](handleEntityNotFound(_0x2b2a8b,null))[_0xb37e('0x14')](saveUpdates(_0x1f37d2[_0xb37e('0x4b')],null))['then'](respondWithResult(_0x2b2a8b,null))[_0xb37e('0x45')](handleError(_0x2b2a8b,null));};exports[_0xb37e('0x26')]=function(_0xc7afb,_0x532606){return db[_0xb37e('0x2a')][_0xb37e('0x4a')]({'where':{'id':_0xc7afb[_0xb37e('0x47')]['id']}})[_0xb37e('0x14')](handleEntityNotFound(_0x532606,null))[_0xb37e('0x14')](removeEntity(_0x532606,null))[_0xb37e('0x45')](handleError(_0x532606,null));};exports['describe']=function(_0x7a8740,_0x14879a){return db[_0xb37e('0x2a')][_0xb37e('0x4c')]()[_0xb37e('0x14')](respondWithResult(_0x14879a,null))[_0xb37e('0x45')](handleError(_0x14879a,null));};exports['create']=function(_0x35063c,_0x409bbd){return db[_0xb37e('0x2a')][_0xb37e('0x4d')](_0x35063c[_0xb37e('0x4b')])[_0xb37e('0x14')](function(_0x1fc6f7){if(_0x1fc6f7){if(_0x1fc6f7[_0xb37e('0x4e')]===_0xb37e('0x4f')&&!_0x1fc6f7[_0xb37e('0x50')]){var _0x286633,_0x55642e,_0x2f9975;if(_0x35063c[_0xb37e('0x4b')]['to']){_0x55642e=_0x35063c['body']['to'][_0xb37e('0x51')](',')[0x0];}return db[_0xb37e('0x52')]['findOne']({'where':{'id':_0x1fc6f7['MailAccountId']},'include':[{'model':db[_0xb37e('0x53')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb37e('0x54'),'where':{'email':_0x55642e},'limit':0x1,'order':[[_0xb37e('0x55'),'DESC']]}]},{'model':db[_0xb37e('0x56')],'as':_0xb37e('0x57'),'raw':!![],'include':[{'model':db[_0xb37e('0x58')],'as':_0xb37e('0x58'),'raw':!![]}]}]})[_0xb37e('0x14')](function(_0x5e0752){_0x286633=_0x5e0752;if(!_0x286633||!_0x286633['Smtp'])return;var _0x5c6200=_0x286633['getSmtpOptions']();if(_0x35063c[_0xb37e('0x4b')][_0xb37e('0x59')]&&_0x35063c[_0xb37e('0x4b')][_0xb37e('0x59')][_0xb37e('0x36')]){for(var _0x332405=0x0;_0x332405<_0x35063c[_0xb37e('0x4b')][_0xb37e('0x59')][_0xb37e('0x36')];_0x332405+=0x1){_0x35063c[_0xb37e('0x4b')]['attachments'][_0x332405]={'filename':_0x35063c['body']['attachments'][_0x332405][_0xb37e('0x28')],'path':path[_0xb37e('0x5a')](config[_0xb37e('0x5b')],_0xb37e('0x5c'),_0x35063c[_0xb37e('0x4b')]['attachments'][_0x332405][_0xb37e('0x5d')])};}}_0x2f9975={'account':_0x5c6200,'message':_0x35063c[_0xb37e('0x4b')]};return;})['then'](function(){if(_0x286633[_0xb37e('0x5e')]){if(_0x286633[_0xb37e('0x5e')][_0xb37e('0x54')][_0xb37e('0x36')]){return _0x286633[_0xb37e('0x5e')][_0xb37e('0x54')][0x0];}else{return db['CmContact']['create'](_[_0xb37e('0x9')](_0x35063c[_0xb37e('0x4b')],{'firstName':_0x35063c[_0xb37e('0x4b')]['to'],'email':_0x35063c[_0xb37e('0x4b')]['to'],'phone':_0x35063c['body']['to'],'ListId':_0x286633[_0xb37e('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xb37e('0x14')](function(){if(_0x2f9975){return respondWithRpcPromise(_0xb37e('0x60'),_0xb37e('0x61'),_0x2f9975,client9003)[_0xb37e('0x14')](function(_0x1edd1b){return _0x1fc6f7[_0xb37e('0x25')]({'read':!![],'messageId':_0x1edd1b[_0xb37e('0x62')],'sentAt':moment()[_0xb37e('0x63')](_0xb37e('0x64'))});})[_0xb37e('0x45')](function(_0x50d393){logger[_0xb37e('0x1b')]('%s',JSON[_0xb37e('0x1a')](_0x50d393));return _0x1fc6f7;});}return _0x1fc6f7;});}return _0x1fc6f7;}})[_0xb37e('0x14')](respondWithResult(_0x409bbd,0xc9))[_0xb37e('0x45')](handleError(_0x409bbd,null));};exports['accept']=function(_0x41ac44,_0x2d50e8){var _0x2a5cc8={'agent':{},'channel':_0xb37e('0x65')};if(_0x41ac44[_0xb37e('0x4b')]['id']){delete _0x41ac44[_0xb37e('0x4b')]['id'];}_0x41ac44[_0xb37e('0x4b')][_0xb37e('0x66')]=!![];_0x41ac44[_0xb37e('0x4b')][_0xb37e('0x67')]=moment()[_0xb37e('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x41ac44[_0xb37e('0x4b')][_0xb37e('0x68')]=_0x41ac44[_0xb37e('0x4b')]['UserId']||_0x41ac44[_0xb37e('0x69')]['id'];_0x2a5cc8['agent']['id']=_0x41ac44[_0xb37e('0x4b')]['UserId'];return db['MailMessage'][_0xb37e('0x4a')]({'where':{'id':_0x41ac44['params']['id'],'UserId':null}})[_0xb37e('0x14')](handleEntityNotFound(_0x2d50e8,null))[_0xb37e('0x14')](saveUpdates(_0x41ac44['body'],null))[_0xb37e('0x14')](function(_0x2ddffa){if(_0x2ddffa){_0x2a5cc8['message']=_0x2ddffa['get']({'plain':!![]});return db['MailInteraction'][_0xb37e('0x4a')]({'where':{'id':_0x2ddffa[_0xb37e('0x6a')]}});}return null;})[_0xb37e('0x14')](handleEntityNotFound(_0x2d50e8,null))[_0xb37e('0x14')](function(_0x1ddca8){if(_0x1ddca8){return _0x1ddca8[_0xb37e('0x25')]({'UserId':_0x41ac44[_0xb37e('0x4b')][_0xb37e('0x68')],'read1stAt':_[_0xb37e('0x6b')](_0x1ddca8[_0xb37e('0x6c')])?moment()[_0xb37e('0x63')](_0xb37e('0x64')):undefined});}return null;})[_0xb37e('0x14')](function(_0x2d9a72){if(_0x2d9a72){_0x2a5cc8[_0xb37e('0x6d')]=_0x2d9a72['get']({'plain':!![]});interaction_log['info'](_0xb37e('0x6e'),_0x41ac44[_0xb37e('0x69')]['id'],_0x41ac44[_0xb37e('0x69')][_0xb37e('0x28')],_0x41ac44[_0xb37e('0x69')][_0xb37e('0x6f')],_0x2a5cc8['interaction']['id'],_0x41ac44[_0xb37e('0x4b')]?JSON['stringify'](_0x41ac44['body']):_0xb37e('0x70'));return respondWithRpcPromise(_0xb37e('0x71'),_0xb37e('0x72'),_0x2a5cc8);}return null;})['then'](function(_0x3dc50f){var _0x1aea36=_0xb37e('0x73')+_0x3dc50f[_0xb37e('0x1d')][_0xb37e('0x74')];return db[_0xb37e('0x75')]['query'](_0x1aea36,{'type':db[_0xb37e('0x76')][_0xb37e('0x77')][_0xb37e('0x78')],'raw':!![]})[_0xb37e('0x14')](function(_0x4ba48d){return _0x4ba48d;});})[_0xb37e('0x14')](function(_0x530a38){if(_0x530a38){_0x2a5cc8[_0xb37e('0x1d')]['contact']=_0x530a38[0x0];if(!_0x41ac44[_0xb37e('0x4b')][_0xb37e('0x68')])return;return db['User'][_0xb37e('0x4a')]({'where':{'id':_0x41ac44[_0xb37e('0x4b')][_0xb37e('0x68')],'role':'agent'},'attributes':['id',_0xb37e('0x28'),_0xb37e('0x79'),'email',_0xb37e('0x7a')],'raw':!![]});}return null;})['then'](function(_0x2c0b9d){if(!_0x2c0b9d)return null;_0x2a5cc8[_0xb37e('0x1d')][_0xb37e('0x7b')]=_0x2c0b9d;return _0x2a5cc8;})[_0xb37e('0x14')](function(_0x84a33d){if(_0x84a33d){if(_0x41ac44[_0xb37e('0x4b')]['manual']){_0x2a5cc8[_0xb37e('0x1d')][_0xb37e('0x7c')]=util[_0xb37e('0x63')](_0xb37e('0x7d'),_0x41ac44[_0xb37e('0x69')][_0xb37e('0x28')]);_0x2a5cc8[_0xb37e('0x1d')][_0xb37e('0x7e')]=_0x2a5cc8[_0xb37e('0x7e')];_0x2a5cc8[_0xb37e('0x1d')][_0xb37e('0x7f')]=_0x2a5cc8[_0xb37e('0x7e')];_0x2a5cc8[_0xb37e('0x1d')]['event']=_0xb37e('0x80');_0x2a5cc8[_0xb37e('0x1d')][_0xb37e('0x4b')]=htmlToText[_0xb37e('0x81')](_0x2a5cc8[_0xb37e('0x1d')][_0xb37e('0x4b')]);return respondWithRpcPromise(_0xb37e('0x82'),_0xb37e('0x82'),{'event':_0xb37e('0x83'),'message':_0x2a5cc8['message']},client9002)['then'](function(){return _0x2a5cc8;});}return _0x2a5cc8;}return null;})[_0xb37e('0x14')](respondWithResult(_0x2d50e8,null))[_0xb37e('0x45')](handleError(_0x2d50e8,null));};exports[_0xb37e('0x84')]=function(_0x210211,_0x1977ce){var _0x4e9312={'agent':{},'channel':'mail'};if(_0x210211[_0xb37e('0x4b')]['id']){delete _0x210211[_0xb37e('0x4b')]['id'];}_0x210211['body'][_0xb37e('0x68')]=_0x210211['body']['UserId']||_0x210211[_0xb37e('0x69')]['id'];_0x4e9312[_0xb37e('0x7b')]['id']=_0x210211[_0xb37e('0x4b')]['UserId'];return db[_0xb37e('0x2a')][_0xb37e('0x4a')]({'where':{'id':_0x210211[_0xb37e('0x47')]['id'],'UserId':null}})[_0xb37e('0x14')](handleEntityNotFound(_0x1977ce,null))[_0xb37e('0x14')](function(_0x3bf2c3){if(_0x3bf2c3){_0x4e9312[_0xb37e('0x1d')]=_0x3bf2c3[_0xb37e('0x85')]({'plain':!![]});return db[_0xb37e('0x86')][_0xb37e('0x4a')]({'where':{'id':_0x3bf2c3[_0xb37e('0x6a')]}});}return null;})[_0xb37e('0x14')](handleEntityNotFound(_0x1977ce,null))['then'](function(_0x2a6ff4){if(_0x2a6ff4){_0x4e9312[_0xb37e('0x6d')]=_0x2a6ff4['get']({'plain':!![]});interaction_log[_0xb37e('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x210211[_0xb37e('0x69')]['id'],_0x210211[_0xb37e('0x69')][_0xb37e('0x28')],_0x210211[_0xb37e('0x69')][_0xb37e('0x6f')],_0x4e9312[_0xb37e('0x6d')]['id'],_0x210211[_0xb37e('0x4b')]?JSON[_0xb37e('0x1a')](_0x210211[_0xb37e('0x4b')]):'null');return respondWithRpcPromise(_0xb37e('0x87'),_0xb37e('0x88'),_0x4e9312);}return null;})[_0xb37e('0x14')](function(_0x196133){var _0x10fef8=_0xb37e('0x73')+_0x196133[_0xb37e('0x1d')]['ContactId'];return db[_0xb37e('0x75')][_0xb37e('0x33')](_0x10fef8,{'type':db[_0xb37e('0x76')][_0xb37e('0x77')][_0xb37e('0x78')],'raw':!![]})[_0xb37e('0x14')](function(_0x4cc6d6){return _0x4cc6d6;});})[_0xb37e('0x14')](function(_0x5c78e3){if(_0x5c78e3){_0x4e9312[_0xb37e('0x1d')]['contact']=_0x5c78e3[0x0];if(!_0x210211['body'][_0xb37e('0x68')])return;return db['User'][_0xb37e('0x4a')]({'where':{'id':_0x210211[_0xb37e('0x4b')][_0xb37e('0x68')],'role':_0xb37e('0x7b')},'attributes':['id',_0xb37e('0x28'),_0xb37e('0x79'),'email',_0xb37e('0x7a')],'raw':!![]});}return null;})[_0xb37e('0x14')](function(_0x16863c){if(!_0x16863c)return null;_0x4e9312[_0xb37e('0x1d')]['agent']=_0x16863c;return _0x4e9312;})['then'](function(_0xcc5a64){if(_0xcc5a64){_0xcc5a64[_0xb37e('0x1d')]['interface']=util[_0xb37e('0x63')]('SIP/%s',_0x210211[_0xb37e('0x69')][_0xb37e('0x28')]);_0xcc5a64[_0xb37e('0x1d')]['channel']=_0x4e9312['channel'];_0xcc5a64['message']['motionChannel']=_0x4e9312[_0xb37e('0x7e')];_0xcc5a64[_0xb37e('0x1d')][_0xb37e('0x89')]=_0xb37e('0x84');_0xcc5a64[_0xb37e('0x1d')][_0xb37e('0x4b')]=htmlToText['fromString'](_0x4e9312['message'][_0xb37e('0x4b')]);respondWithRpcPromise(_0xb37e('0x82'),_0xb37e('0x82'),{'event':'rejectmessage','message':_0xcc5a64[_0xb37e('0x1d')]},client9002);return _0x4e9312;}return null;})[_0xb37e('0x14')](respondWithResult(_0x1977ce,null))[_0xb37e('0x45')](handleError(_0x1977ce,null));};exports[_0xb37e('0x8a')]=function(_0x49af92,_0x5e64ea){var _0x106517=moment()[_0xb37e('0x8b')]()[_0xb37e('0x8c')]();var _0x4a6e52=path[_0xb37e('0x5a')](config[_0xb37e('0x5b')],_0xb37e('0x8d'),_0xb37e('0x8e'),_0xb37e('0x8f'));var _0x380ce2=path[_0xb37e('0x5a')](config[_0xb37e('0x5b')],'server',_0xb37e('0x8e'),_0xb37e('0x59'));var _0x374e8d=util['format']('message-%s.eml',_0x106517);return db[_0xb37e('0x2a')]['find']({'where':{'id':_0x49af92[_0xb37e('0x47')]['id']},'attributes':['id',_0xb37e('0x4b'),'from','to','cc',_0xb37e('0x90'),_0xb37e('0x91'),'createdAt'],'include':_0x49af92['query'][_0xb37e('0x59')]?[{'model':db[_0xb37e('0x92')],'as':_0xb37e('0x93')}]:undefined})['then'](handleEntityNotFound(_0x5e64ea,null))[_0xb37e('0x14')](function(_0x269cc1){if(_0x269cc1){var _0x2a044d=_0x269cc1;var _0x2ef407={'from':_0x2a044d[_0xb37e('0x94')],'to':_0x2a044d['to'],'subject':_0x2a044d[_0xb37e('0x91')],'html':htmlEntities[_0xb37e('0x95')](_0x2a044d[_0xb37e('0x4b')]),'headers':{'Date':moment(_0x2a044d[_0xb37e('0x96')])[_0xb37e('0x63')](_0xb37e('0x97'))},'attachments':[]};if(_0x269cc1['cc']){_0x2ef407[_0xb37e('0x98')]['Cc']=_0x269cc1['cc'];}if(_0x269cc1[_0xb37e('0x90')]){_0x2ef407[_0xb37e('0x98')][_0xb37e('0x99')]=_0x269cc1['bcc'];}return new BPromise(function(_0x5baec1,_0x5b7091){if(_0x269cc1[_0xb37e('0x93')]){for(var _0x5f326c=0x0;_0x5f326c<_0x269cc1['Attachments'][_0xb37e('0x36')];_0x5f326c++){var _0x1fa422=_0x269cc1[_0xb37e('0x93')][_0x5f326c];var _0x3892fc=path[_0xb37e('0x5a')](_0x380ce2,_0x1fa422[_0xb37e('0x5d')]);if(fs['existsSync'](_0x3892fc)){_0x2ef407[_0xb37e('0x59')][_0xb37e('0x9a')]({'name':_0x1fa422[_0xb37e('0x28')],'contentType':_0x1fa422[_0xb37e('0x2d')],'data':fs[_0xb37e('0x9b')](_0x3892fc)});}}}emlformat['build'](_0x2ef407,function(_0x103147,_0x3ac78a){if(_0x103147)return _0x5b7091(_0x103147);fs[_0xb37e('0x9c')](path[_0xb37e('0x5a')](_0x4a6e52,_0x374e8d),_0x3ac78a);return _0x5baec1(_0x3ac78a);});});}})[_0xb37e('0x14')](function(_0x4a4cc7){if(_0x4a4cc7){return _0x5e64ea['download'](path['join'](_0x4a6e52,_0x374e8d),_0x374e8d,function(_0x51cb25){if(!_0x51cb25)fs[_0xb37e('0x9d')](path['join'](_0x4a6e52,_0x374e8d));});}})[_0xb37e('0x45')](handleError(_0x5e64ea,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index ced21a8..b14d3e7 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 _0xe8d0=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe8d0,0x1e1));var _0x0e8d=function(_0x2fd0cd,_0x785b12){_0x2fd0cd=_0x2fd0cd-0x0;var _0x34aed7=_0xe8d0[_0x2fd0cd];return _0x34aed7;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x0e8d('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0e8d('0x1')](0x0);var events={'afterCreate':_0x0e8d('0x2'),'afterUpdate':_0x0e8d('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd308a7){return function(_0x3a2a85,_0x2f7ce0,_0x3401cf){MailMessageEvents['emit'](_0xd308a7+':'+_0x3a2a85['id'],_0x3a2a85);MailMessageEvents[_0x0e8d('0x4')](_0xd308a7,_0x3a2a85);_0x3401cf(null);};}for(var e in events){if(events[_0x0e8d('0x5')](e)){var event=events[e];MailMessage[_0x0e8d('0x6')](e,emitEvent(event));}}module[_0x0e8d('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xbd64=['hasOwnProperty','events','MailMessage','save','update','remove','emit'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xbd64,0xf6));var _0x4bd6=function(_0x36c68a,_0xb78765){_0x36c68a=_0x36c68a-0x0;var _0x2ba753=_0xbd64[_0x36c68a];return _0x2ba753;};'use strict';var EventEmitter=require(_0x4bd6('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x4bd6('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4bd6('0x2'),'afterUpdate':_0x4bd6('0x3'),'afterDestroy':_0x4bd6('0x4')};function emitEvent(_0x1a2180){return function(_0xc88b7b,_0x4140df,_0x3a8cb7){MailMessageEvents[_0x4bd6('0x5')](_0x1a2180+':'+_0xc88b7b['id'],_0xc88b7b);MailMessageEvents['emit'](_0x1a2180,_0xc88b7b);_0x3a8cb7(null);};}for(var e in events){if(events[_0x4bd6('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f542080..a875380 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 _0xa233=['bluebird','request-promise','html-to-text','path','../../config/environment','exports','define','mail_messages','messageId','plainBody','subject','body','models','get','direction','toLowerCase','UserId','MailInteraction','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3656fa,_0x3d5b57){var _0x346e3a=function(_0x359e37){while(--_0x359e37){_0x3656fa['push'](_0x3656fa['shift']());}};_0x346e3a(++_0x3d5b57);}(_0xa233,0x126));var _0x3a23=function(_0x80cbf8,_0x1e006f){_0x80cbf8=_0x80cbf8-0x0;var _0x5ce7bd=_0xa233[_0x80cbf8];return _0x5ce7bd;};'use strict';var _=require(_0x3a23('0x0'));var util=require(_0x3a23('0x1'));var logger=require(_0x3a23('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3a23('0x3'));var rp=require(_0x3a23('0x4'));var htmlToText=require(_0x3a23('0x5'));var fs=require('fs');var path=require(_0x3a23('0x6'));var rimraf=require('rimraf');var config=require(_0x3a23('0x7'));var attributes=require('./mailMessage.attributes');module[_0x3a23('0x8')]=function(_0x1ebe99,_0x59fb04){return _0x1ebe99[_0x3a23('0x9')]('MailMessage',attributes,{'tableName':_0x3a23('0xa'),'paranoid':![],'indexes':[{'name':_0x3a23('0xb'),'fields':[_0x3a23('0xb')]},{'name':'fti_mail_messages','fields':[_0x3a23('0xc'),_0x3a23('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d3b83,_0xba1a3,_0x3a9ee7){if(_0x1d3b83[_0x3a23('0xe')]){_0x1d3b83[_0x3a23('0xc')]=htmlToText['fromString'](_0x1d3b83[_0x3a23('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3a9ee7(null,_0xba1a3);},'afterCreate':function(_0x42fb4b,_0x5deb57,_0x36794b){var _0x13312c=_0x1ebe99[_0x3a23('0xf')];var _0x29e48f=_0x42fb4b[_0x3a23('0x10')]({'plain':!![]});if(_0x29e48f[_0x3a23('0x11')][_0x3a23('0x12')]()==='in'||_0x29e48f[_0x3a23('0x11')]['toLowerCase']()==='out'&&!_0x29e48f['secret']&&!_['isNil'](_0x29e48f[_0x3a23('0x13')])){_0x13312c[_0x3a23('0x14')]['findOne']({'where':{'id':_0x29e48f['MailInteractionId']}})[_0x3a23('0x15')](function(_0x58290b){if(_0x58290b){_0x58290b[_0x3a23('0x16')]({'lastMsgAt':_0x29e48f['createdAt'],'lastMsgDirection':_0x29e48f[_0x3a23('0x11')]['toLowerCase']()});}})[_0x3a23('0x17')](function(_0x4e0f31){console[_0x3a23('0x18')](_0x4e0f31);});}_0x36794b();}},'charset':_0x3a23('0x19'),'collate':_0x3a23('0x1a')});}; \ No newline at end of file +var _0xf5cf=['utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','body','plainBody','fromString','get','direction','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','toLowerCase','error','utf8mb4'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xf5cf,0x1ae));var _0xff5c=function(_0x59c15f,_0x1a4efe){_0x59c15f=_0x59c15f-0x0;var _0x3e368d=_0xf5cf[_0x59c15f];return _0x3e368d;};'use strict';var _=require(_0xff5c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xff5c('0x1'));var BPromise=require(_0xff5c('0x2'));var rp=require(_0xff5c('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xff5c('0x4'));var rimraf=require(_0xff5c('0x5'));var config=require(_0xff5c('0x6'));var attributes=require(_0xff5c('0x7'));module[_0xff5c('0x8')]=function(_0x59a363,_0x1d4a2c){return _0x59a363[_0xff5c('0x9')](_0xff5c('0xa'),attributes,{'tableName':_0xff5c('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xff5c('0xc')]},{'name':_0xff5c('0xd'),'fields':['plainBody',_0xff5c('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5116e6,_0x3fa1a4,_0x25c46b){if(_0x5116e6[_0xff5c('0xf')]){_0x5116e6[_0xff5c('0x10')]=htmlToText[_0xff5c('0x11')](_0x5116e6[_0xff5c('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x25c46b(null,_0x3fa1a4);},'afterCreate':function(_0x4a898e,_0x3d9bb1,_0x3419e5){var _0x2d45a2=_0x59a363['models'];var _0x4a6354=_0x4a898e[_0xff5c('0x12')]({'plain':!![]});if(_0x4a6354[_0xff5c('0x13')]['toLowerCase']()==='in'||_0x4a6354[_0xff5c('0x13')]['toLowerCase']()===_0xff5c('0x14')&&!_0x4a6354[_0xff5c('0x15')]&&!_['isNil'](_0x4a6354[_0xff5c('0x16')])){_0x2d45a2[_0xff5c('0x17')][_0xff5c('0x18')]({'where':{'id':_0x4a6354[_0xff5c('0x19')]}})[_0xff5c('0x1a')](function(_0x1cf0c0){if(_0x1cf0c0){_0x1cf0c0[_0xff5c('0x1b')]({'lastMsgAt':_0x4a6354[_0xff5c('0x1c')],'lastMsgDirection':_0x4a6354[_0xff5c('0x13')][_0xff5c('0x1d')]()});}})['catch'](function(_0x547ab7){console[_0xff5c('0x1e')](_0x547ab7);});}_0x3419e5();}},'charset':_0xff5c('0x1f'),'collate':_0xff5c('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 7e9c09a..172818f 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 _0x1775=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','MailMessage','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3747ae,_0x408e61){var _0x339035=function(_0x83be87){while(--_0x83be87){_0x3747ae['push'](_0x3747ae['shift']());}};_0x339035(++_0x408e61);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});config[_0x5177('0xd')]=_[_0x5177('0xe')](config[_0x5177('0xd')],{'host':_0x5177('0xf'),'port':0x18eb});var socket=require(_0x5177('0x10'))(new Redis(config[_0x5177('0xd')]));require(_0x5177('0x11'))[_0x5177('0x12')](socket);function respondWithRpcPromise(_0x206035,_0x5bdca9,_0x4ae3d2){return new BPromise(function(_0x13c7f6,_0x1d7116){return client[_0x5177('0x13')](_0x206035,_0x4ae3d2)[_0x5177('0x14')](function(_0x301db2){logger['info'](_0x5177('0x15'),_0x5bdca9,_0x5177('0x16'));logger[_0x5177('0x17')](_0x5177('0x18'),_0x5bdca9,_0x5177('0x16'),JSON[_0x5177('0x19')](_0x301db2));if(_0x301db2[_0x5177('0x1a')]){if(_0x301db2[_0x5177('0x1a')][_0x5177('0x1b')]===0x1f4){logger[_0x5177('0x1a')](_0x5177('0x15'),_0x5bdca9,_0x301db2[_0x5177('0x1a')][_0x5177('0x1c')]);return _0x1d7116(_0x301db2[_0x5177('0x1a')][_0x5177('0x1c')]);}logger[_0x5177('0x1a')](_0x5177('0x15'),_0x5bdca9,_0x301db2[_0x5177('0x1a')][_0x5177('0x1c')]);return _0x13c7f6(_0x301db2['error'][_0x5177('0x1c')]);}else{logger[_0x5177('0x1d')](_0x5177('0x15'),_0x5bdca9,_0x5177('0x16'));_0x13c7f6(_0x301db2['result'][_0x5177('0x1c')]);}})[_0x5177('0x1e')](function(_0x13d5d4){logger['error'](_0x5177('0x15'),_0x5bdca9,_0x13d5d4);_0x1d7116(_0x13d5d4);});});}exports['CreateMailMessage']=function(_0xc2b2b5){var _0xe221b3=this;return new Promise(function(_0x219744,_0x27b732){return db[_0x5177('0x1f')][_0x5177('0x20')](_0xc2b2b5[_0x5177('0x21')],{'raw':_0xc2b2b5[_0x5177('0x22')]?_0xc2b2b5[_0x5177('0x22')][_0x5177('0x23')]===undefined?!![]:![]:!![]})[_0x5177('0x14')](function(_0x3b0c37){logger['info'](_0x5177('0x24'),_0xc2b2b5);logger['debug'](_0x5177('0x24'),_0xc2b2b5,JSON[_0x5177('0x19')](_0x3b0c37));_0x219744(_0x3b0c37);})[_0x5177('0x1e')](function(_0x2d51d0){logger['error'](_0x5177('0x24'),_0x2d51d0['message'],_0xc2b2b5);_0x27b732(_0xe221b3['error'](0x1f4,_0x2d51d0[_0x5177('0x1c')]));});});}; \ No newline at end of file +var _0x160f=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf160('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf160('0xd'))[_0xf160('0xe')](socket);function respondWithRpcPromise(_0x393f70,_0x2736b8,_0x5e09c6){return new BPromise(function(_0x4a0639,_0xf8ec3d){return client[_0xf160('0xf')](_0x393f70,_0x5e09c6)[_0xf160('0x10')](function(_0x56072f){logger[_0xf160('0x11')](_0xf160('0x12'),_0x2736b8,_0xf160('0x13'));logger[_0xf160('0x14')](_0xf160('0x15'),_0x2736b8,'request\x20sent',JSON[_0xf160('0x16')](_0x56072f));if(_0x56072f['error']){if(_0x56072f[_0xf160('0x17')][_0xf160('0x18')]===0x1f4){logger[_0xf160('0x17')](_0xf160('0x12'),_0x2736b8,_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);return _0xf8ec3d(_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);}logger[_0xf160('0x17')]('MailMessage,\x20%s,\x20%s',_0x2736b8,_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);return _0x4a0639(_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);}else{logger['info'](_0xf160('0x12'),_0x2736b8,'request\x20sent');_0x4a0639(_0x56072f[_0xf160('0x1a')][_0xf160('0x19')]);}})[_0xf160('0x1b')](function(_0x1e09f3){logger[_0xf160('0x17')](_0xf160('0x12'),_0x2736b8,_0x1e09f3);_0xf8ec3d(_0x1e09f3);});});}exports[_0xf160('0x1c')]=function(_0x2a8cb4){var _0x1fdb38=this;return new Promise(function(_0x4a58d9,_0x40ccf0){return db[_0xf160('0x1d')][_0xf160('0x1e')](_0x2a8cb4['body'],{'raw':_0x2a8cb4[_0xf160('0x1f')]?_0x2a8cb4[_0xf160('0x1f')][_0xf160('0x20')]===undefined?!![]:![]:!![]})[_0xf160('0x10')](function(_0x2e03c8){logger[_0xf160('0x11')](_0xf160('0x1c'),_0x2a8cb4);logger['debug'](_0xf160('0x1c'),_0x2a8cb4,JSON[_0xf160('0x16')](_0x2e03c8));_0x4a58d9(_0x2e03c8);})[_0xf160('0x1b')](function(_0x49bb5c){logger['error'](_0xf160('0x1c'),_0x49bb5c[_0xf160('0x19')],_0x2a8cb4);_0x40ccf0(_0x1fdb38['error'](0x1f4,_0x49bb5c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index e66f67c..3e11666 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 _0x2137=['./mailMessage.events','save','remove','emit'];(function(_0x3cf24a,_0xec10a9){var _0x389355=function(_0x8f4d96){while(--_0x8f4d96){_0x3cf24a['push'](_0x3cf24a['shift']());}};_0x389355(++_0xec10a9);}(_0x2137,0x134));var _0x7213=function(_0xca2c30,_0x2e91b5){_0xca2c30=_0xca2c30-0x0;var _0x13efb=_0x2137[_0xca2c30];return _0x13efb;};'use strict';var MailMessageEvents=require(_0x7213('0x0'));var events=[_0x7213('0x1'),_0x7213('0x2'),'update'];function createListener(_0x4aaabf,_0x200474){return function(_0x55023e){_0x200474[_0x7213('0x3')](_0x4aaabf,_0x55023e);};}function removeListener(_0x421016,_0x15c165){return function(){MailMessageEvents['removeListener'](_0x421016,_0x15c165);};}exports['register']=function(_0x4f36f0){for(var _0x2cf2d6=0x0,_0x3aa8a3=events['length'];_0x2cf2d6<_0x3aa8a3;_0x2cf2d6++){var _0x2cd831=events[_0x2cf2d6];var _0x2ad93f=createListener('mailMessage:'+_0x2cd831,_0x4f36f0);MailMessageEvents['on'](_0x2cd831,_0x2ad93f);}}; \ No newline at end of file +var _0x6255=['length','mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x5b5948,_0x59fdf9){var _0x5cd5d3=function(_0x2b8963){while(--_0x2b8963){_0x5b5948['push'](_0x5b5948['shift']());}};_0x5cd5d3(++_0x59fdf9);}(_0x6255,0x1da));var _0x5625=function(_0x3818c0,_0x542521){_0x3818c0=_0x3818c0-0x0;var _0x55ec33=_0x6255[_0x3818c0];return _0x55ec33;};'use strict';var MailMessageEvents=require(_0x5625('0x0'));var events=[_0x5625('0x1'),_0x5625('0x2'),_0x5625('0x3')];function createListener(_0x460ef5,_0x4eff3e){return function(_0x106248){_0x4eff3e[_0x5625('0x4')](_0x460ef5,_0x106248);};}function removeListener(_0x1cf402,_0x3b39ee){return function(){MailMessageEvents[_0x5625('0x5')](_0x1cf402,_0x3b39ee);};}exports['register']=function(_0x579361){for(var _0x11d5ba=0x0,_0xda1635=events[_0x5625('0x6')];_0x11d5ba<_0xda1635;_0x11d5ba++){var _0x2d7227=events[_0x11d5ba];var _0x2c4f0e=createListener(_0x5625('0x7')+_0x2d7227,_0x579361);MailMessageEvents['on'](_0x2d7227,_0x2c4f0e);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 5088fc4..1f509c0 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 _0x6871=['show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6871,0xe1));var _0x1687=function(_0x9dbbe,_0x1e6779){_0x9dbbe=_0x9dbbe-0x0;var _0x997d51=_0x6871[_0x9dbbe];return _0x997d51;};'use strict';var multer=require(_0x1687('0x0'));var util=require(_0x1687('0x1'));var path=require('path');var timeout=require(_0x1687('0x2'));var express=require(_0x1687('0x3'));var router=express[_0x1687('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1687('0x5'));var interaction=require(_0x1687('0x6'));var config=require(_0x1687('0x7'));var controller=require(_0x1687('0x8'));router[_0x1687('0x9')]('/',auth[_0x1687('0xa')](),controller[_0x1687('0xb')]);router[_0x1687('0x9')](_0x1687('0xc'),auth[_0x1687('0xa')](),controller[_0x1687('0xd')]);router['get'](_0x1687('0xe'),auth[_0x1687('0xa')](),controller[_0x1687('0xf')]);router[_0x1687('0x9')](_0x1687('0x10'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x1687('0x11'),auth[_0x1687('0xa')](),controller[_0x1687('0x12')]);router[_0x1687('0x9')](_0x1687('0x13'),auth[_0x1687('0xa')](),controller[_0x1687('0x14')]);router[_0x1687('0x15')]('/',auth[_0x1687('0xa')](),controller[_0x1687('0x16')]);router['post'](_0x1687('0x11'),auth[_0x1687('0xa')](),controller[_0x1687('0x17')]);router[_0x1687('0x15')](_0x1687('0x13'),auth[_0x1687('0xa')](),controller[_0x1687('0x18')]);router[_0x1687('0x19')](_0x1687('0xe'),auth[_0x1687('0xa')](),controller[_0x1687('0x1a')]);router[_0x1687('0x1b')](_0x1687('0xe'),auth[_0x1687('0xa')](),controller[_0x1687('0x1c')]);router[_0x1687('0x1b')](_0x1687('0x11'),auth[_0x1687('0xa')](),controller['removeTeams']);router[_0x1687('0x1b')](_0x1687('0x13'),auth[_0x1687('0xa')](),controller['removeAgents']);module[_0x1687('0x1d')]=router; \ No newline at end of file +var _0x8b59=['../../config/environment','./mailQueue.controller','get','isAuthenticated','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','put','delete','destroy','removeTeams','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x494cfc,_0x2e7fb3){var _0xb43f76=function(_0x12991d){while(--_0x12991d){_0x494cfc['push'](_0x494cfc['shift']());}};_0xb43f76(++_0x2e7fb3);}(_0x8b59,0x125));var _0x98b5=function(_0x4485c,_0x2e5821){_0x4485c=_0x4485c-0x0;var _0x16a307=_0x8b59[_0x4485c];return _0x16a307;};'use strict';var multer=require(_0x98b5('0x0'));var util=require(_0x98b5('0x1'));var path=require(_0x98b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x98b5('0x3'));var router=express[_0x98b5('0x4')]();var fs_extra=require(_0x98b5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x98b5('0x6'));var config=require(_0x98b5('0x7'));var controller=require(_0x98b5('0x8'));router[_0x98b5('0x9')]('/',auth[_0x98b5('0xa')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x98b5('0x9')](_0x98b5('0xb'),auth[_0x98b5('0xa')](),controller[_0x98b5('0xc')]);router['get']('/:id/members',auth[_0x98b5('0xa')](),controller[_0x98b5('0xd')]);router[_0x98b5('0x9')](_0x98b5('0xe'),auth[_0x98b5('0xa')](),controller['getTeams']);router[_0x98b5('0x9')](_0x98b5('0xf'),auth[_0x98b5('0xa')](),controller[_0x98b5('0x10')]);router['post']('/',auth[_0x98b5('0xa')](),controller[_0x98b5('0x11')]);router[_0x98b5('0x12')](_0x98b5('0xe'),auth['isAuthenticated'](),controller[_0x98b5('0x13')]);router[_0x98b5('0x12')]('/:id/users',auth[_0x98b5('0xa')](),controller['addAgents']);router[_0x98b5('0x14')](_0x98b5('0xb'),auth[_0x98b5('0xa')](),controller['update']);router[_0x98b5('0x15')](_0x98b5('0xb'),auth[_0x98b5('0xa')](),controller[_0x98b5('0x16')]);router[_0x98b5('0x15')](_0x98b5('0xe'),auth[_0x98b5('0xa')](),controller[_0x98b5('0x17')]);router['delete'](_0x98b5('0xf'),auth[_0x98b5('0xa')](),controller['removeAgents']);module[_0x98b5('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 17640ed..8f8ecf3 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 _0x2391=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x1d5382,_0x1546f1){var _0x1dee83=function(_0x31e27a){while(--_0x31e27a){_0x1d5382['push'](_0x1d5382['shift']());}};_0x1dee83(++_0x1546f1);}(_0x2391,0x1a5));var _0x1239=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x2391[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x1239('0x0'));module[_0x1239('0x1')]={'name':{'type':Sequelize[_0x1239('0x2')],'unique':_0x1239('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1239('0x2')]},'timeout':{'type':Sequelize[_0x1239('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1239('0x5')](_0x1239('0x6'),_0x1239('0x7'),_0x1239('0x8'))}}; \ No newline at end of file +var _0x1119=['beepall','roundrobin','sequelize','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0x1119,0x12a));var _0x9111=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x1119[_0x4d21ff];return _0x22b554;};'use strict';var Sequelize=require(_0x9111('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9111('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9111('0x2')]},'timeout':{'type':Sequelize[_0x9111('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9111('0x4')](_0x9111('0x5'),_0x9111('0x6'),_0x9111('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index b866967..d681b64 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 _0xfa47=['compact','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','end','status','json','offset','limit','count','set','Content-Range','apply','reject','then','get','MailQueues','UserProfileResource','destroy','error','stack','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserMailQueue','nolimit','MailQueueId','User','mailPause','createdAt','format','updatedAt','getTeams','Team','ids','online','voicePause','interface','Agents','sequelize','transaction','addTeams','each','forEach','emit','userMailQueue:save','removeTeams','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','all','union'];(function(_0x48e51c,_0x4accf5){var _0x4b880f=function(_0x4ef20f){while(--_0x4ef20f){_0x48e51c['push'](_0x48e51c['shift']());}};_0x4b880f(++_0x4accf5);}(_0xfa47,0x91));var _0x7fa4=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0xfa47[_0x4232d8];return _0x324de2;};'use strict';var emlformat=require(_0x7fa4('0x0'));var rimraf=require(_0x7fa4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7fa4('0x2'));var rp=require(_0x7fa4('0x3'));var moment=require(_0x7fa4('0x4'));var BPromise=require(_0x7fa4('0x5'));var Mustache=require('mustache');var util=require(_0x7fa4('0x6'));var path=require(_0x7fa4('0x7'));var sox=require(_0x7fa4('0x8'));var csv=require(_0x7fa4('0x9'));var ejs=require(_0x7fa4('0xa'));var fs=require('fs');var fs_extra=require(_0x7fa4('0xb'));var _=require(_0x7fa4('0xc'));var squel=require(_0x7fa4('0xd'));var crypto=require('crypto');var jsforce=require(_0x7fa4('0xe'));var deskjs=require(_0x7fa4('0xf'));var toCsv=require(_0x7fa4('0x9'));var querystring=require(_0x7fa4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7fa4('0x11'));var qs=require(_0x7fa4('0x12'));var as=require(_0x7fa4('0x13'));var hardwareService=require(_0x7fa4('0x14'));var logger=require(_0x7fa4('0x15'))(_0x7fa4('0x16'));var utils=require(_0x7fa4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7fa4('0x18'));var db=require(_0x7fa4('0x19'))['db'];config['redis']=_[_0x7fa4('0x1a')](config[_0x7fa4('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x7fa4('0x1c'))(new Redis(config[_0x7fa4('0x1b')]));require('./mailQueue.socket')[_0x7fa4('0x1d')](socket);function respondWithStatusCode(_0x42fe53,_0x25af16){_0x25af16=_0x25af16||0xcc;return function(_0x432b7d){if(_0x432b7d){return _0x42fe53['sendStatus'](_0x25af16);}return _0x42fe53['status'](_0x25af16)[_0x7fa4('0x1e')]();};}function respondWithResult(_0x420bfa,_0x42c2d7){_0x42c2d7=_0x42c2d7||0xc8;return function(_0x549ee3){if(_0x549ee3){return _0x420bfa[_0x7fa4('0x1f')](_0x42c2d7)[_0x7fa4('0x20')](_0x549ee3);}};}function respondWithFilteredResult(_0x27fab3,_0x3b2d51){return function(_0x2126e6){if(_0x2126e6){var _0x138411=typeof _0x3b2d51[_0x7fa4('0x21')]==='undefined'&&typeof _0x3b2d51[_0x7fa4('0x22')]==='undefined';var _0x35e7d3=_0x2126e6[_0x7fa4('0x23')];var _0x28bf44=_0x138411?0x0:_0x3b2d51[_0x7fa4('0x21')];var _0xdc7f65=_0x138411?_0x2126e6[_0x7fa4('0x23')]:_0x3b2d51[_0x7fa4('0x21')]+_0x3b2d51[_0x7fa4('0x22')];var _0x44916b;if(_0xdc7f65>=_0x35e7d3){_0xdc7f65=_0x35e7d3;_0x44916b=0xc8;}else{_0x44916b=0xce;}_0x27fab3['status'](_0x44916b);return _0x27fab3[_0x7fa4('0x24')](_0x7fa4('0x25'),_0x28bf44+'-'+_0xdc7f65+'/'+_0x35e7d3)[_0x7fa4('0x20')](_0x2126e6);}return null;};}function patchUpdates(_0x8badb6){return function(_0x130b80){try{jsonpatch[_0x7fa4('0x26')](_0x130b80,_0x8badb6,!![]);}catch(_0x708637){return BPromise[_0x7fa4('0x27')](_0x708637);}return _0x130b80['save']();};}function saveUpdates(_0x5cb106,_0x3578ab){return function(_0x37145e){if(_0x37145e){return _0x37145e['update'](_0x5cb106)[_0x7fa4('0x28')](function(_0x1c2f00){return _0x1c2f00;});}return null;};}function removeEntity(_0x26f4d8,_0x399ef2){return function(_0x337509){if(_0x337509){return _0x337509['destroy']()[_0x7fa4('0x28')](function(){var _0x5af76a=_0x337509[_0x7fa4('0x29')]({'plain':!![]});var _0x797f18=_0x7fa4('0x2a');return db[_0x7fa4('0x2b')][_0x7fa4('0x2c')]({'where':{'type':_0x797f18,'resourceId':_0x5af76a['id']}})[_0x7fa4('0x28')](function(){return _0x337509;});})[_0x7fa4('0x28')](function(){_0x26f4d8[_0x7fa4('0x1f')](0xcc)[_0x7fa4('0x1e')]();});}};}function handleEntityNotFound(_0x41e839,_0x11fc0b){return function(_0x19b1ef){if(!_0x19b1ef){_0x41e839['sendStatus'](0x194);}return _0x19b1ef;};}function handleError(_0x5689d1,_0x1d8c12){_0x1d8c12=_0x1d8c12||0x1f4;return function(_0x1d1958){logger[_0x7fa4('0x2d')](_0x1d1958[_0x7fa4('0x2e')]);if(_0x1d1958['name']){delete _0x1d1958['name'];}_0x5689d1[_0x7fa4('0x1f')](_0x1d8c12)[_0x7fa4('0x2f')](_0x1d1958);};}exports[_0x7fa4('0x30')]=function(_0x2c56b4,_0x59e36d){var _0x11ad4d={},_0x1847c0={},_0x1b2828={'count':0x0,'rows':[]};var _0x211d26=_[_0x7fa4('0x31')](db[_0x7fa4('0x32')][_0x7fa4('0x33')],function(_0x30faac){return{'name':_0x30faac[_0x7fa4('0x34')],'type':_0x30faac[_0x7fa4('0x35')][_0x7fa4('0x36')]};});_0x1847c0[_0x7fa4('0x37')]=_['map'](_0x211d26,_0x7fa4('0x38'));_0x1847c0[_0x7fa4('0x39')]=_[_0x7fa4('0x3a')](_0x2c56b4['query']);_0x1847c0['filters']=_[_0x7fa4('0x3b')](_0x1847c0[_0x7fa4('0x37')],_0x1847c0[_0x7fa4('0x39')]);_0x11ad4d[_0x7fa4('0x3c')]=_[_0x7fa4('0x3b')](_0x1847c0[_0x7fa4('0x37')],qs[_0x7fa4('0x3d')](_0x2c56b4[_0x7fa4('0x39')][_0x7fa4('0x3d')]));_0x11ad4d[_0x7fa4('0x3c')]=_0x11ad4d['attributes']['length']?_0x11ad4d[_0x7fa4('0x3c')]:_0x1847c0[_0x7fa4('0x37')];if(!_0x2c56b4['query'][_0x7fa4('0x3e')]('nolimit')){_0x11ad4d[_0x7fa4('0x22')]=qs[_0x7fa4('0x22')](_0x2c56b4['query'][_0x7fa4('0x22')]);_0x11ad4d['offset']=qs[_0x7fa4('0x21')](_0x2c56b4[_0x7fa4('0x39')][_0x7fa4('0x21')]);}_0x11ad4d[_0x7fa4('0x3f')]=qs['sort'](_0x2c56b4[_0x7fa4('0x39')][_0x7fa4('0x40')]);_0x11ad4d[_0x7fa4('0x41')]=qs[_0x7fa4('0x42')](_[_0x7fa4('0x43')](_0x2c56b4['query'],_0x1847c0[_0x7fa4('0x42')]),_0x211d26);if(_0x2c56b4[_0x7fa4('0x39')][_0x7fa4('0x44')]){_0x11ad4d[_0x7fa4('0x41')]=_[_0x7fa4('0x45')](_0x11ad4d[_0x7fa4('0x41')],{'$or':_['map'](_0x211d26,function(_0x1ed5f2){if(_0x1ed5f2[_0x7fa4('0x35')]!==_0x7fa4('0x46')){var _0xc4cb39={};_0xc4cb39[_0x1ed5f2[_0x7fa4('0x38')]]={'$like':'%'+_0x2c56b4['query'][_0x7fa4('0x44')]+'%'};return _0xc4cb39;}})});}_0x11ad4d=_[_0x7fa4('0x45')]({},_0x11ad4d,_0x2c56b4[_0x7fa4('0x47')]);var _0x2cdd4d={'where':_0x11ad4d[_0x7fa4('0x41')]};return db[_0x7fa4('0x32')]['count'](_0x2cdd4d)[_0x7fa4('0x28')](function(_0xbe539c){_0x1b2828['count']=_0xbe539c;if(_0x2c56b4[_0x7fa4('0x39')]['includeAll']){_0x11ad4d['include']=[{'all':!![]}];}return db['MailQueue'][_0x7fa4('0x48')](_0x11ad4d);})[_0x7fa4('0x28')](function(_0x463de7){_0x1b2828[_0x7fa4('0x49')]=_0x463de7;return _0x1b2828;})[_0x7fa4('0x28')](respondWithFilteredResult(_0x59e36d,_0x11ad4d))[_0x7fa4('0x4a')](handleError(_0x59e36d,null));};exports[_0x7fa4('0x4b')]=function(_0x14460b,_0x1db4bc){var _0x3ccc73={'raw':!![],'where':{'id':_0x14460b[_0x7fa4('0x4c')]['id']}},_0x17460e={};_0x17460e['model']=_[_0x7fa4('0x3a')](db[_0x7fa4('0x32')][_0x7fa4('0x33')]);_0x17460e['query']=_[_0x7fa4('0x3a')](_0x14460b[_0x7fa4('0x39')]);_0x17460e[_0x7fa4('0x42')]=_[_0x7fa4('0x3b')](_0x17460e[_0x7fa4('0x37')],_0x17460e['query']);_0x3ccc73['attributes']=_['intersection'](_0x17460e[_0x7fa4('0x37')],qs[_0x7fa4('0x3d')](_0x14460b[_0x7fa4('0x39')][_0x7fa4('0x3d')]));_0x3ccc73['attributes']=_0x3ccc73[_0x7fa4('0x3c')][_0x7fa4('0x4d')]?_0x3ccc73[_0x7fa4('0x3c')]:_0x17460e[_0x7fa4('0x37')];if(_0x14460b['query'][_0x7fa4('0x4e')]){_0x3ccc73[_0x7fa4('0x4f')]=[{'all':!![]}];}_0x3ccc73=_[_0x7fa4('0x45')]({},_0x3ccc73,_0x14460b[_0x7fa4('0x47')]);return db[_0x7fa4('0x32')]['find'](_0x3ccc73)[_0x7fa4('0x28')](handleEntityNotFound(_0x1db4bc,null))[_0x7fa4('0x28')](respondWithResult(_0x1db4bc,null))['catch'](handleError(_0x1db4bc,null));};exports[_0x7fa4('0x50')]=function(_0x3cbef8,_0x3fc3ac){return db['MailQueue'][_0x7fa4('0x50')](_0x3cbef8[_0x7fa4('0x51')],{})['then'](function(_0x5512f9){var _0x189cca=_0x3cbef8[_0x7fa4('0x52')]['get']({'plain':!![]});if(!_0x189cca)throw new Error(_0x7fa4('0x53'));if(_0x189cca['role']===_0x7fa4('0x52')){var _0x5d0e28=_0x5512f9[_0x7fa4('0x29')]({'plain':!![]});var _0x349350=_0x7fa4('0x2a');return db[_0x7fa4('0x54')][_0x7fa4('0x55')]({'where':{'name':_0x349350,'userProfileId':_0x189cca[_0x7fa4('0x56')]},'raw':!![]})[_0x7fa4('0x28')](function(_0x381f6b){if(_0x381f6b&&_0x381f6b[_0x7fa4('0x57')]===0x0){return db[_0x7fa4('0x2b')][_0x7fa4('0x50')]({'name':_0x5d0e28[_0x7fa4('0x38')],'resourceId':_0x5d0e28['id'],'type':_0x381f6b[_0x7fa4('0x38')],'sectionId':_0x381f6b['id']},{})[_0x7fa4('0x28')](function(){return _0x5512f9;});}else{return _0x5512f9;}})[_0x7fa4('0x4a')](function(_0xc7afc3){logger[_0x7fa4('0x2d')](_0x7fa4('0x58'),_0xc7afc3);throw _0xc7afc3;});}return _0x5512f9;})[_0x7fa4('0x28')](respondWithResult(_0x3fc3ac,0xc9))[_0x7fa4('0x4a')](handleError(_0x3fc3ac,null));};exports[_0x7fa4('0x59')]=function(_0x5b5447,_0x168942){if(_0x5b5447['body']['id']){delete _0x5b5447['body']['id'];}return db[_0x7fa4('0x32')][_0x7fa4('0x55')]({'where':{'id':_0x5b5447[_0x7fa4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x168942,null))['then'](saveUpdates(_0x5b5447[_0x7fa4('0x51')],null))[_0x7fa4('0x28')](respondWithResult(_0x168942,null))['catch'](handleError(_0x168942,null));};exports[_0x7fa4('0x2c')]=function(_0x288cb1,_0x3e7ebb){return db['MailQueue']['find']({'where':{'id':_0x288cb1['params']['id']}})[_0x7fa4('0x28')](handleEntityNotFound(_0x3e7ebb,null))[_0x7fa4('0x28')](removeEntity(_0x3e7ebb,null))['catch'](handleError(_0x3e7ebb,null));};exports[_0x7fa4('0x5a')]=function(_0x5a2a2c,_0x194831){return db['MailQueue'][_0x7fa4('0x5a')]()[_0x7fa4('0x28')](respondWithResult(_0x194831,null))[_0x7fa4('0x4a')](handleError(_0x194831,null));};exports['getMembers']=function(_0xa6009d,_0xb30df7,_0x2f18ca){var _0x3aaf21={'raw':!![],'where':{}},_0x18b325={},_0x3580b4;return db[_0x7fa4('0x32')][_0x7fa4('0x5b')]({'where':{'id':_0xa6009d['params']['id']}})[_0x7fa4('0x28')](handleEntityNotFound(_0xb30df7,null))[_0x7fa4('0x28')](function(_0x4154f6){if(_0x4154f6){_0x3580b4=_0x4154f6[_0x7fa4('0x29')]({'plain':!![]});_0x18b325['model']=_[_0x7fa4('0x3a')](db[_0x7fa4('0x5c')]['rawAttributes']);_0x18b325[_0x7fa4('0x39')]=_[_0x7fa4('0x3a')](_0xa6009d[_0x7fa4('0x39')]);_0x18b325['filters']=_[_0x7fa4('0x3b')](_0x18b325[_0x7fa4('0x37')],_0x18b325['query']);_0x3aaf21['attributes']=_[_0x7fa4('0x3b')](_0x18b325[_0x7fa4('0x37')],qs[_0x7fa4('0x3d')](_0xa6009d['query']['fields']));_0x3aaf21['attributes']=_0x3aaf21[_0x7fa4('0x3c')][_0x7fa4('0x4d')]?_0x3aaf21['attributes']:_0x18b325[_0x7fa4('0x37')];if(!_0xa6009d['query'][_0x7fa4('0x3e')](_0x7fa4('0x5d'))){_0x3aaf21[_0x7fa4('0x22')]=qs['limit'](_0xa6009d[_0x7fa4('0x39')][_0x7fa4('0x22')]);_0x3aaf21[_0x7fa4('0x21')]=qs[_0x7fa4('0x21')](_0xa6009d[_0x7fa4('0x39')][_0x7fa4('0x21')]);}_0x3aaf21['order']=qs['sort'](_0xa6009d[_0x7fa4('0x39')][_0x7fa4('0x40')]);_0x3aaf21[_0x7fa4('0x41')]=qs['filters'](_['pick'](_0xa6009d[_0x7fa4('0x39')],_0x18b325[_0x7fa4('0x42')]));_0x3aaf21['where'][_0x7fa4('0x5e')]=_0x4154f6['id'];if(_0xa6009d[_0x7fa4('0x39')][_0x7fa4('0x44')]){_0x3aaf21['where']=_[_0x7fa4('0x45')](_0x3aaf21[_0x7fa4('0x41')],{'$or':_[_0x7fa4('0x31')](_0x3aaf21[_0x7fa4('0x3c')],function(_0x36644d){var _0x1079c7={};_0x1079c7[_0x36644d]={'$like':'%'+_0xa6009d[_0x7fa4('0x39')]['filter']+'%'};return _0x1079c7;})});}_0x3aaf21=_[_0x7fa4('0x45')]({},_0x3aaf21,_0xa6009d[_0x7fa4('0x47')]);return db['UserMailQueue'][_0x7fa4('0x48')](_0x3aaf21);}})[_0x7fa4('0x28')](function(_0x5a0a7d){if(_0x5a0a7d){return db[_0x7fa4('0x5f')]['findAndCountAll']({'where':{'id':_[_0x7fa4('0x31')](_0x5a0a7d,'UserId'),'role':'agent'},'attributes':['id',_0x7fa4('0x38'),_0x7fa4('0x60'),'updatedAt',_0x7fa4('0x61')]});}})[_0x7fa4('0x28')](function(_0x6a0f1){if(_0x6a0f1){return{'count':_0x6a0f1[_0x7fa4('0x23')],'rows':_[_0x7fa4('0x31')](_0x6a0f1['rows'],function(_0x5ae2c3){return{'membername':_0x5ae2c3[_0x7fa4('0x38')],'UserId':_0x5ae2c3['id'],'queue_name':_0x3580b4[_0x7fa4('0x38')],'MailQueueId':_0x3580b4['id'],'interface':util[_0x7fa4('0x62')]('%s/%s','SIP',_0x5ae2c3[_0x7fa4('0x38')]),'penalty':0x0,'paused':_0x5ae2c3[_0x7fa4('0x60')],'createdAt':_0x5ae2c3[_0x7fa4('0x61')],'updatedAt':_0x5ae2c3[_0x7fa4('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7fa4('0x28')](respondWithFilteredResult(_0xb30df7,_0x3aaf21))[_0x7fa4('0x4a')](handleError(_0xb30df7,null));};exports[_0x7fa4('0x64')]=function(_0x443a03,_0x406df3,_0xc753a7){var _0x4f1142={};var _0x3f9922={};var _0x38aed7;var _0x20cb0c;return db['MailQueue']['findOne']({'where':{'id':_0x443a03[_0x7fa4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x406df3,null))[_0x7fa4('0x28')](function(_0x3c79f2){if(_0x3c79f2){_0x38aed7=_0x3c79f2;_0x3f9922['model']=_['keys'](db[_0x7fa4('0x65')]['rawAttributes']);_0x3f9922[_0x7fa4('0x39')]=_['keys'](_0x443a03[_0x7fa4('0x39')]);_0x3f9922[_0x7fa4('0x42')]=_[_0x7fa4('0x3b')](_0x3f9922[_0x7fa4('0x37')],_0x3f9922['query']);_0x4f1142[_0x7fa4('0x3c')]=_[_0x7fa4('0x3b')](_0x3f9922['model'],qs[_0x7fa4('0x3d')](_0x443a03['query']['fields']));_0x4f1142[_0x7fa4('0x3c')]=_0x4f1142[_0x7fa4('0x3c')][_0x7fa4('0x4d')]?_0x4f1142['attributes']:_0x3f9922[_0x7fa4('0x37')];_0x4f1142[_0x7fa4('0x3f')]=qs['sort'](_0x443a03[_0x7fa4('0x39')][_0x7fa4('0x40')]);_0x4f1142['where']=qs[_0x7fa4('0x42')](_['pick'](_0x443a03[_0x7fa4('0x39')],_0x3f9922[_0x7fa4('0x42')]));if(_0x443a03[_0x7fa4('0x39')][_0x7fa4('0x44')]){_0x4f1142[_0x7fa4('0x41')]=_[_0x7fa4('0x45')](_0x4f1142[_0x7fa4('0x41')],{'$or':_[_0x7fa4('0x31')](_0x4f1142[_0x7fa4('0x3c')],function(_0x5c2dad){var _0x18fea6={};_0x18fea6[_0x5c2dad]={'$like':'%'+_0x443a03[_0x7fa4('0x39')]['filter']+'%'};return _0x18fea6;})});}_0x4f1142=_['merge']({},_0x4f1142,_0x443a03['options']);return _0x38aed7['getTeams'](_0x4f1142);}})['then'](function(_0x5227d0){if(_0x5227d0){_0x20cb0c=_0x5227d0[_0x7fa4('0x4d')];if(!_0x443a03['query'][_0x7fa4('0x3e')]('nolimit')){_0x4f1142[_0x7fa4('0x22')]=qs['limit'](_0x443a03[_0x7fa4('0x39')][_0x7fa4('0x22')]);_0x4f1142[_0x7fa4('0x21')]=qs[_0x7fa4('0x21')](_0x443a03[_0x7fa4('0x39')][_0x7fa4('0x21')]);}return _0x38aed7[_0x7fa4('0x64')](_0x4f1142);}})[_0x7fa4('0x28')](function(_0x1163be){if(_0x1163be){return _0x1163be?{'count':_0x20cb0c,'rows':_0x1163be}:null;}})[_0x7fa4('0x28')](respondWithResult(_0x406df3,null))['catch'](handleError(_0x406df3,null));};exports['addTeams']=function(_0x59af7a,_0x91281c,_0x21413f){var _0x52ff7b=_0x59af7a[_0x7fa4('0x51')][_0x7fa4('0x66')];return db[_0x7fa4('0x65')][_0x7fa4('0x48')]({'where':{'id':_0x52ff7b},'attributes':['id'],'include':[{'model':db[_0x7fa4('0x5f')],'as':'Agents','attributes':['id','name',_0x7fa4('0x67'),_0x7fa4('0x68'),_0x7fa4('0x69')],'raw':!![]}]})['then'](function(_0x3310ab){if(_0x3310ab){var _0x47f6b5=_['flatMap'](_0x3310ab,function(_0x551ab3){var _0x4f1c2d=_0x551ab3[_0x7fa4('0x29')]({'plain':!![]});return _0x4f1c2d[_0x7fa4('0x6a')];});return db[_0x7fa4('0x32')][_0x7fa4('0x55')]({'where':{'id':_0x59af7a[_0x7fa4('0x4c')]['id']}})['then'](function(_0x1d4f14){return db[_0x7fa4('0x6b')][_0x7fa4('0x6c')](function(_0x185554){return _0x1d4f14[_0x7fa4('0x6d')](_0x52ff7b,{'transaction':_0x185554})[_0x7fa4('0x28')](function(){return BPromise[_0x7fa4('0x6e')](_0x47f6b5,function(_0x286eff){return db[_0x7fa4('0x5c')]['findOrCreate']({'where':{'UserId':_0x286eff['id'],'MailQueueId':_0x59af7a['params']['id']},'transaction':_0x185554});});})[_0x7fa4('0x28')](function(){_0x47f6b5[_0x7fa4('0x6f')](function(_0x1fff31){socket[_0x7fa4('0x70')](_0x7fa4('0x71'),{'UserId':_0x1fff31['id'],'MailQueueId':_0x1d4f14['id']});});});});});}})[_0x7fa4('0x28')](respondWithStatusCode(_0x91281c,null))[_0x7fa4('0x4a')](handleError(_0x91281c,null));};exports[_0x7fa4('0x72')]=function(_0x179e50,_0x40291c,_0x49e78e){return db['Team'][_0x7fa4('0x48')]({'where':{'id':_0x179e50['query'][_0x7fa4('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7fa4('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x40291c,null))[_0x7fa4('0x28')](function(_0x313725){var _0x2b320a=_[_0x7fa4('0x31')](_0x313725,'id');var _0x1819d2=[];var _0x26e0d9=[];var _0x2964f5=squel['select']();_0x2964f5[_0x7fa4('0x73')](_0x7fa4('0x74'))[_0x7fa4('0x75')](_0x7fa4('0x76'),'tq')[_0x7fa4('0x77')](_0x7fa4('0x78'),'ut',_0x7fa4('0x79'))[_0x7fa4('0x41')](_0x7fa4('0x7a'),_0x179e50[_0x7fa4('0x4c')]['id']);for(var _0x2a4866=0x0;_0x2a4866<_0x313725[_0x7fa4('0x4d')];_0x2a4866+=0x1){let _0x5d26a6=_0x313725[_0x2a4866];for(var _0xe11c42=0x0;_0xe11c42<_0x5d26a6['Agents'][_0x7fa4('0x4d')];_0xe11c42+=0x1){let _0x4b2e17=_0x5d26a6[_0x7fa4('0x6a')][_0xe11c42];var _0xf80837=_0x2964f5[_0x7fa4('0x7b')]();_0xf80837[_0x7fa4('0x41')]('ut.UserId\x20=\x20?',_0x4b2e17['id']);_0x26e0d9[_0x7fa4('0x7c')](db[_0x7fa4('0x6b')]['query'](_0xf80837['toString'](),{'type':db[_0x7fa4('0x6b')][_0x7fa4('0x7d')][_0x7fa4('0x7e')]})[_0x7fa4('0x28')](function(_0x67921a){if(_0x67921a[_0x7fa4('0x4d')]===0x1){return _0x4b2e17['id'];}else{var _0xed57ea=_[_0x7fa4('0x7f')](_[_0x7fa4('0x31')](_0x67921a,_0x7fa4('0x80')),function(_0x59087c){return _['includes'](_0x2b320a,_0x59087c);});if(_0xed57ea){return _0x4b2e17['id'];}}}));}}return BPromise[_0x7fa4('0x81')](_0x26e0d9)[_0x7fa4('0x28')](function(_0x1cc1f8){_0x1819d2=_(_0x1819d2)[_0x7fa4('0x82')](_0x1cc1f8)[_0x7fa4('0x83')]()['value']();return db[_0x7fa4('0x32')]['find']({'where':{'id':_0x179e50[_0x7fa4('0x4c')]['id']}})[_0x7fa4('0x28')](function(_0x28bfee){return db[_0x7fa4('0x6b')][_0x7fa4('0x6c')](function(_0x5593eb){return _0x28bfee['removeTeams'](_0x179e50['query'][_0x7fa4('0x66')],{'transaction':_0x5593eb})[_0x7fa4('0x28')](function(){if(!_['isEmpty'](_0x1819d2)){return _0x28bfee[_0x7fa4('0x84')](_0x1819d2,{'transaction':_0x5593eb});}})[_0x7fa4('0x28')](function(){_0x1819d2[_0x7fa4('0x6f')](function(_0x53e386){socket['emit'](_0x7fa4('0x85'),{'UserId':_0x53e386,'MailQueueId':_0x28bfee['id']});});});});});});})[_0x7fa4('0x28')](respondWithStatusCode(_0x40291c,null))[_0x7fa4('0x4a')](handleError(_0x40291c,null));};exports[_0x7fa4('0x86')]=function(_0x25652c,_0x506e45,_0x5f2eb0){return db[_0x7fa4('0x32')]['find']({'where':{'id':_0x25652c[_0x7fa4('0x4c')]['id']}})[_0x7fa4('0x28')](handleEntityNotFound(_0x506e45,null))[_0x7fa4('0x28')](function(_0x320c41){if(_0x320c41){return _0x320c41[_0x7fa4('0x86')](_0x25652c[_0x7fa4('0x51')]['ids'],_['omit'](_0x25652c[_0x7fa4('0x51')],['ids','id'])||{})[_0x7fa4('0x87')](function(_0x230a75){for(var _0x20fea8=0x0;_0x20fea8<_0x25652c[_0x7fa4('0x51')][_0x7fa4('0x66')][_0x7fa4('0x4d')];_0x20fea8+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x25652c[_0x7fa4('0x51')]['ids'][_0x20fea8]),'MailQueueId':Number(_0x25652c[_0x7fa4('0x4c')]['id'])});}return _0x230a75;});}})['then'](respondWithResult(_0x506e45,null))[_0x7fa4('0x4a')](handleError(_0x506e45,null));};exports[_0x7fa4('0x84')]=function(_0x5cf3ad,_0x20b3e5,_0x3b2fcb){return db[_0x7fa4('0x32')][_0x7fa4('0x55')]({'where':{'id':_0x5cf3ad[_0x7fa4('0x4c')]['id']}})[_0x7fa4('0x28')](handleEntityNotFound(_0x20b3e5,null))[_0x7fa4('0x28')](function(_0x39b0e6){if(_0x39b0e6){return _0x39b0e6[_0x7fa4('0x84')](_0x5cf3ad[_0x7fa4('0x39')]['ids'])[_0x7fa4('0x28')](function(){if(_[_0x7fa4('0x88')](_0x5cf3ad['query'][_0x7fa4('0x66')])){for(var _0x3f49ae=0x0;_0x3f49ae<_0x5cf3ad[_0x7fa4('0x39')][_0x7fa4('0x66')]['length'];_0x3f49ae+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x5cf3ad['query']['ids'][_0x3f49ae]),'MailQueueId':Number(_0x5cf3ad[_0x7fa4('0x4c')]['id'])});}}else{socket['emit'](_0x7fa4('0x85'),{'UserId':Number(_0x5cf3ad['query'][_0x7fa4('0x66')]),'MailQueueId':Number(_0x5cf3ad['params']['id'])});}});}})[_0x7fa4('0x28')](respondWithStatusCode(_0x20b3e5,null))[_0x7fa4('0x4a')](handleError(_0x20b3e5,null));};exports[_0x7fa4('0x89')]=function(_0x76fe63,_0x3e5e35,_0x3b41){var _0x59365d={};var _0x3ef910={};var _0x4ef0fb;var _0x55193a;return db['MailQueue'][_0x7fa4('0x5b')]({'where':{'id':_0x76fe63[_0x7fa4('0x4c')]['id']}})[_0x7fa4('0x28')](handleEntityNotFound(_0x3e5e35,null))[_0x7fa4('0x28')](function(_0x31df9e){if(_0x31df9e){_0x4ef0fb=_0x31df9e;_0x3ef910['model']=_[_0x7fa4('0x3a')](db[_0x7fa4('0x5f')][_0x7fa4('0x33')]);_0x3ef910[_0x7fa4('0x39')]=_[_0x7fa4('0x3a')](_0x76fe63[_0x7fa4('0x39')]);_0x3ef910['filters']=_[_0x7fa4('0x3b')](_0x3ef910[_0x7fa4('0x37')],_0x3ef910[_0x7fa4('0x39')]);_0x59365d['attributes']=_[_0x7fa4('0x3b')](_0x3ef910['model'],qs[_0x7fa4('0x3d')](_0x76fe63[_0x7fa4('0x39')]['fields']));_0x59365d[_0x7fa4('0x3c')]=_0x59365d['attributes']['length']?_0x59365d['attributes']:_0x3ef910[_0x7fa4('0x37')];_0x59365d[_0x7fa4('0x3f')]=qs[_0x7fa4('0x40')](_0x76fe63[_0x7fa4('0x39')][_0x7fa4('0x40')]);_0x59365d[_0x7fa4('0x41')]=qs[_0x7fa4('0x42')](_[_0x7fa4('0x43')](_0x76fe63[_0x7fa4('0x39')],_0x3ef910['filters']));if(_0x76fe63[_0x7fa4('0x39')]['filter']){_0x59365d[_0x7fa4('0x41')]=_[_0x7fa4('0x45')](_0x59365d['where'],{'$or':_[_0x7fa4('0x31')](_0x59365d['attributes'],function(_0x4d3f94){var _0x47cc60={};_0x47cc60[_0x4d3f94]={'$like':'%'+_0x76fe63['query']['filter']+'%'};return _0x47cc60;})});}_0x59365d=_[_0x7fa4('0x45')]({},_0x59365d,_0x76fe63[_0x7fa4('0x47')]);return _0x4ef0fb[_0x7fa4('0x89')](_0x59365d);}})[_0x7fa4('0x28')](function(_0x1d7646){if(_0x1d7646){_0x55193a=_0x1d7646[_0x7fa4('0x4d')];if(!_0x76fe63[_0x7fa4('0x39')][_0x7fa4('0x3e')](_0x7fa4('0x5d'))){_0x59365d[_0x7fa4('0x22')]=qs[_0x7fa4('0x22')](_0x76fe63[_0x7fa4('0x39')][_0x7fa4('0x22')]);_0x59365d[_0x7fa4('0x21')]=qs[_0x7fa4('0x21')](_0x76fe63[_0x7fa4('0x39')]['offset']);}return _0x4ef0fb[_0x7fa4('0x89')](_0x59365d);}})['then'](function(_0x3c7b99){if(_0x3c7b99){return _0x3c7b99?{'count':_0x55193a,'rows':_0x3c7b99}:null;}})[_0x7fa4('0x28')](respondWithResult(_0x3e5e35,null))[_0x7fa4('0x4a')](handleError(_0x3e5e35,null));}; \ No newline at end of file +var _0xcd1f=['type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','UserId','agent','mailPause','format','%s/%s','SIP','createdAt','updatedAt','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','emit','userMailQueue:save','removeTeams','ids','select','field','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes'];(function(_0x54abae,_0x154d8f){var _0x297e50=function(_0x1acbd6){while(--_0x1acbd6){_0x54abae['push'](_0x54abae['shift']());}};_0x297e50(++_0x154d8f);}(_0xcd1f,0x162));var _0xfcd1=function(_0x51f495,_0x458a0b){_0x51f495=_0x51f495-0x0;var _0x3613d2=_0xcd1f[_0x51f495];return _0x3613d2;};'use strict';var emlformat=require(_0xfcd1('0x0'));var rimraf=require(_0xfcd1('0x1'));var zipdir=require(_0xfcd1('0x2'));var jsonpatch=require(_0xfcd1('0x3'));var rp=require(_0xfcd1('0x4'));var moment=require('moment');var BPromise=require(_0xfcd1('0x5'));var Mustache=require(_0xfcd1('0x6'));var util=require(_0xfcd1('0x7'));var path=require(_0xfcd1('0x8'));var sox=require('sox');var csv=require(_0xfcd1('0x9'));var ejs=require(_0xfcd1('0xa'));var fs=require('fs');var fs_extra=require(_0xfcd1('0xb'));var _=require(_0xfcd1('0xc'));var squel=require(_0xfcd1('0xd'));var crypto=require(_0xfcd1('0xe'));var jsforce=require(_0xfcd1('0xf'));var deskjs=require(_0xfcd1('0x10'));var toCsv=require(_0xfcd1('0x9'));var querystring=require(_0xfcd1('0x11'));var Papa=require(_0xfcd1('0x12'));var Redis=require('ioredis');var authService=require(_0xfcd1('0x13'));var qs=require(_0xfcd1('0x14'));var as=require(_0xfcd1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcd1('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xfcd1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcd1('0x18'))['db'];config[_0xfcd1('0x19')]=_[_0xfcd1('0x1a')](config[_0xfcd1('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcd1('0x1b'))(new Redis(config[_0xfcd1('0x19')]));require(_0xfcd1('0x1c'))[_0xfcd1('0x1d')](socket);function respondWithStatusCode(_0x487f08,_0xb88e92){_0xb88e92=_0xb88e92||0xcc;return function(_0x471bde){if(_0x471bde){return _0x487f08[_0xfcd1('0x1e')](_0xb88e92);}return _0x487f08[_0xfcd1('0x1f')](_0xb88e92)[_0xfcd1('0x20')]();};}function respondWithResult(_0x27c5c6,_0x5bcda5){_0x5bcda5=_0x5bcda5||0xc8;return function(_0x1aecf4){if(_0x1aecf4){return _0x27c5c6[_0xfcd1('0x1f')](_0x5bcda5)[_0xfcd1('0x21')](_0x1aecf4);}};}function respondWithFilteredResult(_0x58156c,_0x56b868){return function(_0x4cb169){if(_0x4cb169){var _0x704116=typeof _0x56b868[_0xfcd1('0x22')]==='undefined'&&typeof _0x56b868[_0xfcd1('0x23')]===_0xfcd1('0x24');var _0x3c79fb=_0x4cb169[_0xfcd1('0x25')];var _0x3a09f6=_0x704116?0x0:_0x56b868[_0xfcd1('0x22')];var _0x329b6b=_0x704116?_0x4cb169['count']:_0x56b868['offset']+_0x56b868['limit'];var _0x2efe3a;if(_0x329b6b>=_0x3c79fb){_0x329b6b=_0x3c79fb;_0x2efe3a=0xc8;}else{_0x2efe3a=0xce;}_0x58156c[_0xfcd1('0x1f')](_0x2efe3a);return _0x58156c[_0xfcd1('0x26')]('Content-Range',_0x3a09f6+'-'+_0x329b6b+'/'+_0x3c79fb)['json'](_0x4cb169);}return null;};}function patchUpdates(_0x2d48b6){return function(_0x433cee){try{jsonpatch[_0xfcd1('0x27')](_0x433cee,_0x2d48b6,!![]);}catch(_0x1e6300){return BPromise[_0xfcd1('0x28')](_0x1e6300);}return _0x433cee[_0xfcd1('0x29')]();};}function saveUpdates(_0x1004f4,_0x50e7f5){return function(_0x2cf03f){if(_0x2cf03f){return _0x2cf03f[_0xfcd1('0x2a')](_0x1004f4)[_0xfcd1('0x2b')](function(_0x5cd7fb){return _0x5cd7fb;});}return null;};}function removeEntity(_0x5955ff,_0x3be10d){return function(_0x1121e9){if(_0x1121e9){return _0x1121e9[_0xfcd1('0x2c')]()[_0xfcd1('0x2b')](function(){var _0x223db3=_0x1121e9[_0xfcd1('0x2d')]({'plain':!![]});var _0x125a62='MailQueues';return db[_0xfcd1('0x2e')][_0xfcd1('0x2c')]({'where':{'type':_0x125a62,'resourceId':_0x223db3['id']}})[_0xfcd1('0x2b')](function(){return _0x1121e9;});})[_0xfcd1('0x2b')](function(){_0x5955ff[_0xfcd1('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x143386,_0x3537dd){return function(_0x279e74){if(!_0x279e74){_0x143386['sendStatus'](0x194);}return _0x279e74;};}function handleError(_0x3e427e,_0x29915c){_0x29915c=_0x29915c||0x1f4;return function(_0x4c17a6){logger[_0xfcd1('0x2f')](_0x4c17a6[_0xfcd1('0x30')]);if(_0x4c17a6[_0xfcd1('0x31')]){delete _0x4c17a6['name'];}_0x3e427e[_0xfcd1('0x1f')](_0x29915c)['send'](_0x4c17a6);};}exports[_0xfcd1('0x32')]=function(_0xc6f651,_0x2cbbcd){var _0x597713={},_0x3ffed3={},_0x2dc0c7={'count':0x0,'rows':[]};var _0x35e507=_[_0xfcd1('0x33')](db[_0xfcd1('0x34')][_0xfcd1('0x35')],function(_0x471483){return{'name':_0x471483['fieldName'],'type':_0x471483[_0xfcd1('0x36')][_0xfcd1('0x37')]};});_0x3ffed3[_0xfcd1('0x38')]=_[_0xfcd1('0x33')](_0x35e507,_0xfcd1('0x31'));_0x3ffed3['query']=_[_0xfcd1('0x39')](_0xc6f651[_0xfcd1('0x3a')]);_0x3ffed3[_0xfcd1('0x3b')]=_['intersection'](_0x3ffed3[_0xfcd1('0x38')],_0x3ffed3['query']);_0x597713[_0xfcd1('0x3c')]=_[_0xfcd1('0x3d')](_0x3ffed3[_0xfcd1('0x38')],qs['fields'](_0xc6f651[_0xfcd1('0x3a')][_0xfcd1('0x3e')]));_0x597713[_0xfcd1('0x3c')]=_0x597713[_0xfcd1('0x3c')][_0xfcd1('0x3f')]?_0x597713[_0xfcd1('0x3c')]:_0x3ffed3[_0xfcd1('0x38')];if(!_0xc6f651['query'][_0xfcd1('0x40')](_0xfcd1('0x41'))){_0x597713[_0xfcd1('0x23')]=qs[_0xfcd1('0x23')](_0xc6f651[_0xfcd1('0x3a')][_0xfcd1('0x23')]);_0x597713[_0xfcd1('0x22')]=qs[_0xfcd1('0x22')](_0xc6f651[_0xfcd1('0x3a')][_0xfcd1('0x22')]);}_0x597713[_0xfcd1('0x42')]=qs[_0xfcd1('0x43')](_0xc6f651[_0xfcd1('0x3a')][_0xfcd1('0x43')]);_0x597713[_0xfcd1('0x44')]=qs[_0xfcd1('0x3b')](_[_0xfcd1('0x45')](_0xc6f651[_0xfcd1('0x3a')],_0x3ffed3[_0xfcd1('0x3b')]),_0x35e507);if(_0xc6f651[_0xfcd1('0x3a')][_0xfcd1('0x46')]){_0x597713[_0xfcd1('0x44')]=_['merge'](_0x597713[_0xfcd1('0x44')],{'$or':_[_0xfcd1('0x33')](_0x35e507,function(_0x57c337){if(_0x57c337['type']!==_0xfcd1('0x47')){var _0x13c7f6={};_0x13c7f6[_0x57c337['name']]={'$like':'%'+_0xc6f651[_0xfcd1('0x3a')][_0xfcd1('0x46')]+'%'};return _0x13c7f6;}})});}_0x597713=_[_0xfcd1('0x48')]({},_0x597713,_0xc6f651[_0xfcd1('0x49')]);var _0x3cfad2={'where':_0x597713[_0xfcd1('0x44')]};return db['MailQueue']['count'](_0x3cfad2)[_0xfcd1('0x2b')](function(_0x4f58e){_0x2dc0c7['count']=_0x4f58e;if(_0xc6f651['query'][_0xfcd1('0x4a')]){_0x597713['include']=[{'all':!![]}];}return db[_0xfcd1('0x34')][_0xfcd1('0x4b')](_0x597713);})['then'](function(_0x273010){_0x2dc0c7[_0xfcd1('0x4c')]=_0x273010;return _0x2dc0c7;})[_0xfcd1('0x2b')](respondWithFilteredResult(_0x2cbbcd,_0x597713))[_0xfcd1('0x4d')](handleError(_0x2cbbcd,null));};exports['show']=function(_0x5ea63d,_0x46bc12){var _0x9d4118={'raw':!![],'where':{'id':_0x5ea63d[_0xfcd1('0x4e')]['id']}},_0xf3dfdf={};_0xf3dfdf[_0xfcd1('0x38')]=_[_0xfcd1('0x39')](db[_0xfcd1('0x34')][_0xfcd1('0x35')]);_0xf3dfdf['query']=_[_0xfcd1('0x39')](_0x5ea63d[_0xfcd1('0x3a')]);_0xf3dfdf[_0xfcd1('0x3b')]=_[_0xfcd1('0x3d')](_0xf3dfdf[_0xfcd1('0x38')],_0xf3dfdf['query']);_0x9d4118[_0xfcd1('0x3c')]=_[_0xfcd1('0x3d')](_0xf3dfdf[_0xfcd1('0x38')],qs[_0xfcd1('0x3e')](_0x5ea63d[_0xfcd1('0x3a')]['fields']));_0x9d4118[_0xfcd1('0x3c')]=_0x9d4118[_0xfcd1('0x3c')][_0xfcd1('0x3f')]?_0x9d4118[_0xfcd1('0x3c')]:_0xf3dfdf[_0xfcd1('0x38')];if(_0x5ea63d[_0xfcd1('0x3a')][_0xfcd1('0x4a')]){_0x9d4118['include']=[{'all':!![]}];}_0x9d4118=_[_0xfcd1('0x48')]({},_0x9d4118,_0x5ea63d['options']);return db['MailQueue'][_0xfcd1('0x4f')](_0x9d4118)['then'](handleEntityNotFound(_0x46bc12,null))['then'](respondWithResult(_0x46bc12,null))['catch'](handleError(_0x46bc12,null));};exports[_0xfcd1('0x50')]=function(_0x202259,_0x1d89cd){return db['MailQueue'][_0xfcd1('0x50')](_0x202259[_0xfcd1('0x51')],{})[_0xfcd1('0x2b')](function(_0x5666e8){var _0x36b1ef=_0x202259['user'][_0xfcd1('0x2d')]({'plain':!![]});if(!_0x36b1ef)throw new Error(_0xfcd1('0x52'));if(_0x36b1ef['role']==='user'){var _0x43e557=_0x5666e8[_0xfcd1('0x2d')]({'plain':!![]});var _0x47276a='MailQueues';return db[_0xfcd1('0x53')][_0xfcd1('0x4f')]({'where':{'name':_0x47276a,'userProfileId':_0x36b1ef['userProfileId']},'raw':!![]})[_0xfcd1('0x2b')](function(_0x71b182){if(_0x71b182&&_0x71b182[_0xfcd1('0x54')]===0x0){return db[_0xfcd1('0x2e')][_0xfcd1('0x50')]({'name':_0x43e557['name'],'resourceId':_0x43e557['id'],'type':_0x71b182[_0xfcd1('0x31')],'sectionId':_0x71b182['id']},{})[_0xfcd1('0x2b')](function(){return _0x5666e8;});}else{return _0x5666e8;}})[_0xfcd1('0x4d')](function(_0x429792){logger[_0xfcd1('0x2f')](_0xfcd1('0x55'),_0x429792);throw _0x429792;});}return _0x5666e8;})[_0xfcd1('0x2b')](respondWithResult(_0x1d89cd,0xc9))[_0xfcd1('0x4d')](handleError(_0x1d89cd,null));};exports[_0xfcd1('0x2a')]=function(_0x377a0c,_0x357990){if(_0x377a0c['body']['id']){delete _0x377a0c[_0xfcd1('0x51')]['id'];}return db[_0xfcd1('0x34')][_0xfcd1('0x4f')]({'where':{'id':_0x377a0c['params']['id']}})[_0xfcd1('0x2b')](handleEntityNotFound(_0x357990,null))['then'](saveUpdates(_0x377a0c['body'],null))['then'](respondWithResult(_0x357990,null))['catch'](handleError(_0x357990,null));};exports[_0xfcd1('0x2c')]=function(_0x5f0313,_0x27c028){return db[_0xfcd1('0x34')][_0xfcd1('0x4f')]({'where':{'id':_0x5f0313['params']['id']}})['then'](handleEntityNotFound(_0x27c028,null))[_0xfcd1('0x2b')](removeEntity(_0x27c028,null))[_0xfcd1('0x4d')](handleError(_0x27c028,null));};exports[_0xfcd1('0x56')]=function(_0x171354,_0x3d9b70){return db[_0xfcd1('0x34')][_0xfcd1('0x56')]()[_0xfcd1('0x2b')](respondWithResult(_0x3d9b70,null))[_0xfcd1('0x4d')](handleError(_0x3d9b70,null));};exports[_0xfcd1('0x57')]=function(_0x475cad,_0x5a22e6,_0x23b4c5){var _0x2d8052={'raw':!![],'where':{}},_0x1b8abc={},_0xcd5726;return db[_0xfcd1('0x34')][_0xfcd1('0x58')]({'where':{'id':_0x475cad[_0xfcd1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5a22e6,null))[_0xfcd1('0x2b')](function(_0x49d40b){if(_0x49d40b){_0xcd5726=_0x49d40b[_0xfcd1('0x2d')]({'plain':!![]});_0x1b8abc[_0xfcd1('0x38')]=_['keys'](db[_0xfcd1('0x59')]['rawAttributes']);_0x1b8abc[_0xfcd1('0x3a')]=_[_0xfcd1('0x39')](_0x475cad[_0xfcd1('0x3a')]);_0x1b8abc[_0xfcd1('0x3b')]=_[_0xfcd1('0x3d')](_0x1b8abc[_0xfcd1('0x38')],_0x1b8abc[_0xfcd1('0x3a')]);_0x2d8052[_0xfcd1('0x3c')]=_['intersection'](_0x1b8abc[_0xfcd1('0x38')],qs['fields'](_0x475cad[_0xfcd1('0x3a')][_0xfcd1('0x3e')]));_0x2d8052[_0xfcd1('0x3c')]=_0x2d8052[_0xfcd1('0x3c')][_0xfcd1('0x3f')]?_0x2d8052[_0xfcd1('0x3c')]:_0x1b8abc['model'];if(!_0x475cad[_0xfcd1('0x3a')][_0xfcd1('0x40')](_0xfcd1('0x41'))){_0x2d8052[_0xfcd1('0x23')]=qs['limit'](_0x475cad[_0xfcd1('0x3a')][_0xfcd1('0x23')]);_0x2d8052[_0xfcd1('0x22')]=qs['offset'](_0x475cad['query']['offset']);}_0x2d8052[_0xfcd1('0x42')]=qs[_0xfcd1('0x43')](_0x475cad['query'][_0xfcd1('0x43')]);_0x2d8052[_0xfcd1('0x44')]=qs[_0xfcd1('0x3b')](_[_0xfcd1('0x45')](_0x475cad[_0xfcd1('0x3a')],_0x1b8abc[_0xfcd1('0x3b')]));_0x2d8052[_0xfcd1('0x44')][_0xfcd1('0x5a')]=_0x49d40b['id'];if(_0x475cad[_0xfcd1('0x3a')][_0xfcd1('0x46')]){_0x2d8052[_0xfcd1('0x44')]=_[_0xfcd1('0x48')](_0x2d8052[_0xfcd1('0x44')],{'$or':_[_0xfcd1('0x33')](_0x2d8052[_0xfcd1('0x3c')],function(_0xd3eafc){var _0x2ac6ff={};_0x2ac6ff[_0xd3eafc]={'$like':'%'+_0x475cad[_0xfcd1('0x3a')][_0xfcd1('0x46')]+'%'};return _0x2ac6ff;})});}_0x2d8052=_['merge']({},_0x2d8052,_0x475cad[_0xfcd1('0x49')]);return db[_0xfcd1('0x59')]['findAll'](_0x2d8052);}})[_0xfcd1('0x2b')](function(_0x3fdc5c){if(_0x3fdc5c){return db[_0xfcd1('0x5b')]['findAndCountAll']({'where':{'id':_[_0xfcd1('0x33')](_0x3fdc5c,_0xfcd1('0x5c')),'role':_0xfcd1('0x5d')},'attributes':['id',_0xfcd1('0x31'),_0xfcd1('0x5e'),'updatedAt','createdAt']});}})[_0xfcd1('0x2b')](function(_0x51b326){if(_0x51b326){return{'count':_0x51b326[_0xfcd1('0x25')],'rows':_['map'](_0x51b326[_0xfcd1('0x4c')],function(_0x395ae8){return{'membername':_0x395ae8[_0xfcd1('0x31')],'UserId':_0x395ae8['id'],'queue_name':_0xcd5726[_0xfcd1('0x31')],'MailQueueId':_0xcd5726['id'],'interface':util[_0xfcd1('0x5f')](_0xfcd1('0x60'),_0xfcd1('0x61'),_0x395ae8[_0xfcd1('0x31')]),'penalty':0x0,'paused':_0x395ae8[_0xfcd1('0x5e')],'createdAt':_0x395ae8[_0xfcd1('0x62')],'updatedAt':_0x395ae8[_0xfcd1('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfcd1('0x2b')](respondWithFilteredResult(_0x5a22e6,_0x2d8052))[_0xfcd1('0x4d')](handleError(_0x5a22e6,null));};exports['getTeams']=function(_0x38c22b,_0xc0d2bb,_0x563f5b){var _0x194e1d={};var _0x58b32a={};var _0x276fc1;var _0x5f23ce;return db[_0xfcd1('0x34')][_0xfcd1('0x58')]({'where':{'id':_0x38c22b['params']['id']}})[_0xfcd1('0x2b')](handleEntityNotFound(_0xc0d2bb,null))['then'](function(_0x2da7f0){if(_0x2da7f0){_0x276fc1=_0x2da7f0;_0x58b32a[_0xfcd1('0x38')]=_[_0xfcd1('0x39')](db[_0xfcd1('0x64')][_0xfcd1('0x35')]);_0x58b32a[_0xfcd1('0x3a')]=_[_0xfcd1('0x39')](_0x38c22b['query']);_0x58b32a[_0xfcd1('0x3b')]=_[_0xfcd1('0x3d')](_0x58b32a[_0xfcd1('0x38')],_0x58b32a[_0xfcd1('0x3a')]);_0x194e1d['attributes']=_[_0xfcd1('0x3d')](_0x58b32a['model'],qs[_0xfcd1('0x3e')](_0x38c22b[_0xfcd1('0x3a')]['fields']));_0x194e1d['attributes']=_0x194e1d[_0xfcd1('0x3c')]['length']?_0x194e1d['attributes']:_0x58b32a[_0xfcd1('0x38')];_0x194e1d[_0xfcd1('0x42')]=qs['sort'](_0x38c22b[_0xfcd1('0x3a')][_0xfcd1('0x43')]);_0x194e1d[_0xfcd1('0x44')]=qs[_0xfcd1('0x3b')](_['pick'](_0x38c22b[_0xfcd1('0x3a')],_0x58b32a[_0xfcd1('0x3b')]));if(_0x38c22b['query'][_0xfcd1('0x46')]){_0x194e1d[_0xfcd1('0x44')]=_[_0xfcd1('0x48')](_0x194e1d[_0xfcd1('0x44')],{'$or':_[_0xfcd1('0x33')](_0x194e1d[_0xfcd1('0x3c')],function(_0x3320d5){var _0x3d85ad={};_0x3d85ad[_0x3320d5]={'$like':'%'+_0x38c22b[_0xfcd1('0x3a')][_0xfcd1('0x46')]+'%'};return _0x3d85ad;})});}_0x194e1d=_[_0xfcd1('0x48')]({},_0x194e1d,_0x38c22b['options']);return _0x276fc1[_0xfcd1('0x65')](_0x194e1d);}})[_0xfcd1('0x2b')](function(_0x5a34f6){if(_0x5a34f6){_0x5f23ce=_0x5a34f6[_0xfcd1('0x3f')];if(!_0x38c22b[_0xfcd1('0x3a')][_0xfcd1('0x40')]('nolimit')){_0x194e1d['limit']=qs['limit'](_0x38c22b[_0xfcd1('0x3a')][_0xfcd1('0x23')]);_0x194e1d[_0xfcd1('0x22')]=qs[_0xfcd1('0x22')](_0x38c22b[_0xfcd1('0x3a')]['offset']);}return _0x276fc1[_0xfcd1('0x65')](_0x194e1d);}})['then'](function(_0x40725a){if(_0x40725a){return _0x40725a?{'count':_0x5f23ce,'rows':_0x40725a}:null;}})[_0xfcd1('0x2b')](respondWithResult(_0xc0d2bb,null))['catch'](handleError(_0xc0d2bb,null));};exports[_0xfcd1('0x66')]=function(_0x9be97e,_0x46d731,_0x51d5be){var _0x5dcebc=_0x9be97e[_0xfcd1('0x51')]['ids'];return db[_0xfcd1('0x64')][_0xfcd1('0x4b')]({'where':{'id':_0x5dcebc},'attributes':['id'],'include':[{'model':db[_0xfcd1('0x5b')],'as':_0xfcd1('0x67'),'attributes':['id',_0xfcd1('0x31'),_0xfcd1('0x68'),_0xfcd1('0x69'),_0xfcd1('0x6a')],'raw':!![]}]})[_0xfcd1('0x2b')](function(_0x34ad15){if(_0x34ad15){var _0xde7b93=_[_0xfcd1('0x6b')](_0x34ad15,function(_0x513d52){var _0x107951=_0x513d52[_0xfcd1('0x2d')]({'plain':!![]});return _0x107951['Agents'];});return db['MailQueue']['find']({'where':{'id':_0x9be97e['params']['id']}})[_0xfcd1('0x2b')](function(_0x237dd7){return db['sequelize']['transaction'](function(_0x4824b6){return _0x237dd7[_0xfcd1('0x66')](_0x5dcebc,{'transaction':_0x4824b6})['then'](function(){return BPromise[_0xfcd1('0x6c')](_0xde7b93,function(_0x1f149d){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x1f149d['id'],'MailQueueId':_0x9be97e[_0xfcd1('0x4e')]['id']},'transaction':_0x4824b6});});})[_0xfcd1('0x2b')](function(){_0xde7b93['forEach'](function(_0x331209){socket[_0xfcd1('0x6d')](_0xfcd1('0x6e'),{'UserId':_0x331209['id'],'MailQueueId':_0x237dd7['id']});});});});});}})[_0xfcd1('0x2b')](respondWithStatusCode(_0x46d731,null))[_0xfcd1('0x4d')](handleError(_0x46d731,null));};exports[_0xfcd1('0x6f')]=function(_0x8ecf8e,_0x4de848,_0x2921de){return db[_0xfcd1('0x64')][_0xfcd1('0x4b')]({'where':{'id':_0x8ecf8e[_0xfcd1('0x3a')][_0xfcd1('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfcd1('0x2b')](handleEntityNotFound(_0x4de848,null))[_0xfcd1('0x2b')](function(_0x5ac877){var _0x2bf31b=_[_0xfcd1('0x33')](_0x5ac877,'id');var _0x247c1c=[];var _0x3a7e6d=[];var _0x2f9961=squel[_0xfcd1('0x71')]();_0x2f9961[_0xfcd1('0x72')]('tq.TeamId')['from']('team_has_mail_queues','tq')[_0xfcd1('0x73')](_0xfcd1('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfcd1('0x44')](_0xfcd1('0x75'),_0x8ecf8e[_0xfcd1('0x4e')]['id']);for(var _0x17b131=0x0;_0x17b131<_0x5ac877[_0xfcd1('0x3f')];_0x17b131+=0x1){let _0x390abb=_0x5ac877[_0x17b131];for(var _0x5f3f4f=0x0;_0x5f3f4f<_0x390abb[_0xfcd1('0x67')][_0xfcd1('0x3f')];_0x5f3f4f+=0x1){let _0x2a0238=_0x390abb[_0xfcd1('0x67')][_0x5f3f4f];var _0x18b5fc=_0x2f9961[_0xfcd1('0x76')]();_0x18b5fc['where'](_0xfcd1('0x77'),_0x2a0238['id']);_0x3a7e6d[_0xfcd1('0x78')](db[_0xfcd1('0x79')][_0xfcd1('0x3a')](_0x18b5fc['toString'](),{'type':db[_0xfcd1('0x79')][_0xfcd1('0x7a')]['SELECT']})[_0xfcd1('0x2b')](function(_0x4474c4){if(_0x4474c4[_0xfcd1('0x3f')]===0x1){return _0x2a0238['id'];}else{var _0x54eab3=_['every'](_[_0xfcd1('0x33')](_0x4474c4,_0xfcd1('0x7b')),function(_0x4aab53){return _['includes'](_0x2bf31b,_0x4aab53);});if(_0x54eab3){return _0x2a0238['id'];}}}));}}return BPromise[_0xfcd1('0x7c')](_0x3a7e6d)[_0xfcd1('0x2b')](function(_0x4b7f43){_0x247c1c=_(_0x247c1c)[_0xfcd1('0x7d')](_0x4b7f43)[_0xfcd1('0x7e')]()[_0xfcd1('0x7f')]();return db[_0xfcd1('0x34')][_0xfcd1('0x4f')]({'where':{'id':_0x8ecf8e['params']['id']}})[_0xfcd1('0x2b')](function(_0x5d9a31){return db[_0xfcd1('0x79')][_0xfcd1('0x80')](function(_0x46f119){return _0x5d9a31[_0xfcd1('0x6f')](_0x8ecf8e['query'][_0xfcd1('0x70')],{'transaction':_0x46f119})[_0xfcd1('0x2b')](function(){if(!_[_0xfcd1('0x81')](_0x247c1c)){return _0x5d9a31[_0xfcd1('0x82')](_0x247c1c,{'transaction':_0x46f119});}})['then'](function(){_0x247c1c['forEach'](function(_0x36393a){socket[_0xfcd1('0x6d')](_0xfcd1('0x83'),{'UserId':_0x36393a,'MailQueueId':_0x5d9a31['id']});});});});});});})['then'](respondWithStatusCode(_0x4de848,null))[_0xfcd1('0x4d')](handleError(_0x4de848,null));};exports[_0xfcd1('0x84')]=function(_0x11a255,_0x418e10,_0x47e61b){return db[_0xfcd1('0x34')][_0xfcd1('0x4f')]({'where':{'id':_0x11a255[_0xfcd1('0x4e')]['id']}})[_0xfcd1('0x2b')](handleEntityNotFound(_0x418e10,null))[_0xfcd1('0x2b')](function(_0x4dfb81){if(_0x4dfb81){return _0x4dfb81[_0xfcd1('0x84')](_0x11a255[_0xfcd1('0x51')][_0xfcd1('0x70')],_[_0xfcd1('0x85')](_0x11a255[_0xfcd1('0x51')],['ids','id'])||{})['spread'](function(_0x3b32ef){for(var _0x299ea4=0x0;_0x299ea4<_0x11a255[_0xfcd1('0x51')]['ids'][_0xfcd1('0x3f')];_0x299ea4+=0x1){socket[_0xfcd1('0x6d')]('userMailQueue:save',{'UserId':Number(_0x11a255[_0xfcd1('0x51')][_0xfcd1('0x70')][_0x299ea4]),'MailQueueId':Number(_0x11a255[_0xfcd1('0x4e')]['id'])});}return _0x3b32ef;});}})['then'](respondWithResult(_0x418e10,null))[_0xfcd1('0x4d')](handleError(_0x418e10,null));};exports[_0xfcd1('0x82')]=function(_0x48698f,_0x4e58f8,_0x24b5ea){return db['MailQueue'][_0xfcd1('0x4f')]({'where':{'id':_0x48698f[_0xfcd1('0x4e')]['id']}})[_0xfcd1('0x2b')](handleEntityNotFound(_0x4e58f8,null))['then'](function(_0x3d65f8){if(_0x3d65f8){return _0x3d65f8[_0xfcd1('0x82')](_0x48698f[_0xfcd1('0x3a')]['ids'])[_0xfcd1('0x2b')](function(){if(_[_0xfcd1('0x86')](_0x48698f['query'][_0xfcd1('0x70')])){for(var _0x591f51=0x0;_0x591f51<_0x48698f[_0xfcd1('0x3a')][_0xfcd1('0x70')]['length'];_0x591f51+=0x1){socket[_0xfcd1('0x6d')](_0xfcd1('0x83'),{'UserId':Number(_0x48698f['query']['ids'][_0x591f51]),'MailQueueId':Number(_0x48698f[_0xfcd1('0x4e')]['id'])});}}else{socket['emit'](_0xfcd1('0x83'),{'UserId':Number(_0x48698f['query']['ids']),'MailQueueId':Number(_0x48698f[_0xfcd1('0x4e')]['id'])});}});}})[_0xfcd1('0x2b')](respondWithStatusCode(_0x4e58f8,null))[_0xfcd1('0x4d')](handleError(_0x4e58f8,null));};exports[_0xfcd1('0x87')]=function(_0xa8d017,_0x394729,_0x2fddc4){var _0x237250={};var _0x33ed0b={};var _0x4974e6;var _0x5cc67f;return db['MailQueue'][_0xfcd1('0x58')]({'where':{'id':_0xa8d017['params']['id']}})[_0xfcd1('0x2b')](handleEntityNotFound(_0x394729,null))[_0xfcd1('0x2b')](function(_0xbe6cb8){if(_0xbe6cb8){_0x4974e6=_0xbe6cb8;_0x33ed0b[_0xfcd1('0x38')]=_['keys'](db[_0xfcd1('0x5b')][_0xfcd1('0x35')]);_0x33ed0b['query']=_[_0xfcd1('0x39')](_0xa8d017[_0xfcd1('0x3a')]);_0x33ed0b['filters']=_[_0xfcd1('0x3d')](_0x33ed0b[_0xfcd1('0x38')],_0x33ed0b[_0xfcd1('0x3a')]);_0x237250[_0xfcd1('0x3c')]=_[_0xfcd1('0x3d')](_0x33ed0b[_0xfcd1('0x38')],qs[_0xfcd1('0x3e')](_0xa8d017[_0xfcd1('0x3a')][_0xfcd1('0x3e')]));_0x237250[_0xfcd1('0x3c')]=_0x237250[_0xfcd1('0x3c')][_0xfcd1('0x3f')]?_0x237250[_0xfcd1('0x3c')]:_0x33ed0b['model'];_0x237250[_0xfcd1('0x42')]=qs[_0xfcd1('0x43')](_0xa8d017[_0xfcd1('0x3a')]['sort']);_0x237250[_0xfcd1('0x44')]=qs[_0xfcd1('0x3b')](_[_0xfcd1('0x45')](_0xa8d017[_0xfcd1('0x3a')],_0x33ed0b['filters']));if(_0xa8d017[_0xfcd1('0x3a')][_0xfcd1('0x46')]){_0x237250[_0xfcd1('0x44')]=_[_0xfcd1('0x48')](_0x237250[_0xfcd1('0x44')],{'$or':_['map'](_0x237250[_0xfcd1('0x3c')],function(_0x1e618f){var _0x1d7639={};_0x1d7639[_0x1e618f]={'$like':'%'+_0xa8d017['query'][_0xfcd1('0x46')]+'%'};return _0x1d7639;})});}_0x237250=_[_0xfcd1('0x48')]({},_0x237250,_0xa8d017[_0xfcd1('0x49')]);return _0x4974e6[_0xfcd1('0x87')](_0x237250);}})['then'](function(_0x76ebf0){if(_0x76ebf0){_0x5cc67f=_0x76ebf0[_0xfcd1('0x3f')];if(!_0xa8d017['query'][_0xfcd1('0x40')](_0xfcd1('0x41'))){_0x237250[_0xfcd1('0x23')]=qs[_0xfcd1('0x23')](_0xa8d017[_0xfcd1('0x3a')][_0xfcd1('0x23')]);_0x237250[_0xfcd1('0x22')]=qs['offset'](_0xa8d017[_0xfcd1('0x3a')][_0xfcd1('0x22')]);}return _0x4974e6[_0xfcd1('0x87')](_0x237250);}})['then'](function(_0x203222){if(_0x203222){return _0x203222?{'count':_0x5cc67f,'rows':_0x203222}:null;}})[_0xfcd1('0x2b')](respondWithResult(_0x394729,null))[_0xfcd1('0x4d')](handleError(_0x394729,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index aeed911..ae795dd 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 _0x78df=['../../mysqldb','MailQueue','save','update','emit'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x78df,0x186));var _0xf78d=function(_0x3a4d33,_0x1f00ec){_0x3a4d33=_0x3a4d33-0x0;var _0x278ebe=_0x78df[_0x3a4d33];return _0x278ebe;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xf78d('0x0'))['db'][_0xf78d('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf78d('0x2'),'afterUpdate':_0xf78d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5b4036){return function(_0x3f0de5,_0x4dd70b,_0x1bbb3b){MailQueueEvents[_0xf78d('0x4')](_0x5b4036+':'+_0x3f0de5['id'],_0x3f0de5);MailQueueEvents[_0xf78d('0x4')](_0x5b4036,_0x3f0de5);_0x1bbb3b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x4135=['../../mysqldb','MailQueue','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x1c84b9,_0x2cadaa){var _0x5c1fb6=function(_0x425803){while(--_0x425803){_0x1c84b9['push'](_0x1c84b9['shift']());}};_0x5c1fb6(++_0x2cadaa);}(_0x4135,0x1ca));var _0x5413=function(_0xc9910b,_0xec2921){_0xc9910b=_0xc9910b-0x0;var _0x22d019=_0x4135[_0xc9910b];return _0x22d019;};'use strict';var EventEmitter=require(_0x5413('0x0'));var MailQueue=require(_0x5413('0x1'))['db'][_0x5413('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5413('0x3'),'afterUpdate':_0x5413('0x4'),'afterDestroy':_0x5413('0x5')};function emitEvent(_0x3a6561){return function(_0x449c15,_0x474874,_0xd147ee){MailQueueEvents['emit'](_0x3a6561+':'+_0x449c15['id'],_0x449c15);MailQueueEvents['emit'](_0x3a6561,_0x449c15);_0xd147ee(null);};}for(var e in events){if(events[_0x5413('0x6')](e)){var event=events[e];MailQueue[_0x5413('0x7')](e,emitEvent(event));}}module[_0x5413('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 000a058..fb3c518 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 _0x2b7c=['moment','request-promise','rimraf','exports','MailQueue','util','../../config/logger','api'];(function(_0xda5128,_0x5c54e0){var _0x16fb58=function(_0x44ad44){while(--_0x44ad44){_0xda5128['push'](_0xda5128['shift']());}};_0x16fb58(++_0x5c54e0);}(_0x2b7c,0xa5));var _0xc2b7=function(_0xebc4e2,_0x140809){_0xebc4e2=_0xebc4e2-0x0;var _0x30ccfd=_0x2b7c[_0xebc4e2];return _0x30ccfd;};'use strict';var _=require('lodash');var util=require(_0xc2b7('0x0'));var logger=require(_0xc2b7('0x1'))(_0xc2b7('0x2'));var moment=require(_0xc2b7('0x3'));var BPromise=require('bluebird');var rp=require(_0xc2b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc2b7('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0xc2b7('0x6')]=function(_0x565a63,_0x44b602){return _0x565a63['define'](_0xc2b7('0x7'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7698=['../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x7698,0x1cd));var _0x8769=function(_0x1ec2de,_0x269394){_0x1ec2de=_0x1ec2de-0x0;var _0x494c86=_0x7698[_0x1ec2de];return _0x494c86;};'use strict';var _=require(_0x8769('0x0'));var util=require(_0x8769('0x1'));var logger=require(_0x8769('0x2'))(_0x8769('0x3'));var moment=require(_0x8769('0x4'));var BPromise=require(_0x8769('0x5'));var rp=require(_0x8769('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8769('0x7'));var attributes=require(_0x8769('0x8'));module[_0x8769('0x9')]=function(_0x1d8c8c,_0x170ead){return _0x1d8c8c['define'](_0x8769('0xa'),attributes,{'tableName':_0x8769('0xb'),'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 1861d72..ccc6d2a 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 _0xec2c=['model','map','catch','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetMailQueue','MailQueue','findAll','raw','options','where','attributes','limit','include'];(function(_0x5d331,_0x5ae1a6){var _0x5ead4d=function(_0x2f35e9){while(--_0x2f35e9){_0x5d331['push'](_0x5d331['shift']());}};_0x5ead4d(++_0x5ae1a6);}(_0xec2c,0x191));var _0xcec2=function(_0x15a93a,_0x4822e4){_0x15a93a=_0x15a93a-0x0;var _0x592780=_0xec2c[_0x15a93a];return _0x592780;};'use strict';var _=require(_0xcec2('0x0'));var util=require(_0xcec2('0x1'));var moment=require(_0xcec2('0x2'));var BPromise=require(_0xcec2('0x3'));var rs=require(_0xcec2('0x4'));var fs=require('fs');var Redis=require(_0xcec2('0x5'));var db=require(_0xcec2('0x6'))['db'];var utils=require(_0xcec2('0x7'));var logger=require(_0xcec2('0x8'))(_0xcec2('0x9'));var config=require(_0xcec2('0xa'));var jayson=require(_0xcec2('0xb'));var client=jayson['client'][_0xcec2('0xc')]({'port':0x232a});config[_0xcec2('0xd')]=_['defaults'](config[_0xcec2('0xd')],{'host':_0xcec2('0xe'),'port':0x18eb});var socket=require(_0xcec2('0xf'))(new Redis(config['redis']));require(_0xcec2('0x10'))[_0xcec2('0x11')](socket);function respondWithRpcPromise(_0x17b926,_0xa4aa82,_0x54e657){return new BPromise(function(_0xc47236,_0x5eaa4e){return client[_0xcec2('0x12')](_0x17b926,_0x54e657)[_0xcec2('0x13')](function(_0x3d2310){logger['info'](_0xcec2('0x14'),_0xa4aa82,_0xcec2('0x15'));logger[_0xcec2('0x16')](_0xcec2('0x17'),_0xa4aa82,_0xcec2('0x15'),JSON[_0xcec2('0x18')](_0x3d2310));if(_0x3d2310[_0xcec2('0x19')]){if(_0x3d2310[_0xcec2('0x19')][_0xcec2('0x1a')]===0x1f4){logger[_0xcec2('0x19')](_0xcec2('0x14'),_0xa4aa82,_0x3d2310[_0xcec2('0x19')]['message']);return _0x5eaa4e(_0x3d2310['error'][_0xcec2('0x1b')]);}logger[_0xcec2('0x19')](_0xcec2('0x14'),_0xa4aa82,_0x3d2310[_0xcec2('0x19')]['message']);return _0xc47236(_0x3d2310[_0xcec2('0x19')][_0xcec2('0x1b')]);}else{logger[_0xcec2('0x1c')](_0xcec2('0x14'),_0xa4aa82,_0xcec2('0x15'));_0xc47236(_0x3d2310[_0xcec2('0x1d')][_0xcec2('0x1b')]);}})['catch'](function(_0x210d75){logger[_0xcec2('0x19')]('MailQueue,\x20%s,\x20%s',_0xa4aa82,_0x210d75);_0x5eaa4e(_0x210d75);});});}exports[_0xcec2('0x1e')]=function(_0x4b4be6){var _0x556c88=this;return new Promise(function(_0x249007,_0x579733){return db[_0xcec2('0x1f')][_0xcec2('0x20')]({'raw':_0x4b4be6['options']?_0x4b4be6['options'][_0xcec2('0x21')]===undefined?!![]:![]:!![],'where':_0x4b4be6[_0xcec2('0x22')]?_0x4b4be6[_0xcec2('0x22')][_0xcec2('0x23')]||null:null,'attributes':_0x4b4be6[_0xcec2('0x22')]?_0x4b4be6[_0xcec2('0x22')][_0xcec2('0x24')]||null:null,'limit':_0x4b4be6[_0xcec2('0x22')]?_0x4b4be6['options'][_0xcec2('0x25')]||null:null,'include':_0x4b4be6['options']?_0x4b4be6[_0xcec2('0x22')]['include']?_['map'](_0x4b4be6[_0xcec2('0x22')][_0xcec2('0x26')],function(_0x4c5d3a){return{'model':db[_0x4c5d3a[_0xcec2('0x27')]],'as':_0x4c5d3a['as'],'attributes':_0x4c5d3a['attributes'],'include':_0x4c5d3a['include']?_['map'](_0x4c5d3a[_0xcec2('0x26')],function(_0x4a5401){return{'model':db[_0x4a5401[_0xcec2('0x27')]],'as':_0x4a5401['as'],'attributes':_0x4a5401[_0xcec2('0x24')],'include':_0x4a5401[_0xcec2('0x26')]?_[_0xcec2('0x28')](_0x4a5401[_0xcec2('0x26')],function(_0x3cec64){return{'model':db[_0x3cec64[_0xcec2('0x27')]],'as':_0x3cec64['as'],'attributes':_0x3cec64['attributes']};}):[]};}):[]};}):[]:[]})[_0xcec2('0x13')](function(_0x427be3){logger['info'](_0xcec2('0x1e'),_0x4b4be6);logger[_0xcec2('0x16')](_0xcec2('0x1e'),_0x4b4be6,JSON[_0xcec2('0x18')](_0x427be3));_0x249007(_0x427be3);})[_0xcec2('0x29')](function(_0x5f333c){logger[_0xcec2('0x19')]('GetMailQueue',_0x5f333c['message'],_0x4b4be6);_0x579733(_0x556c88[_0xcec2('0x19')](0x1f4,_0x5f333c[_0xcec2('0x1b')]));});});};exports[_0xcec2('0x2a')]=function(_0x255b12){var _0x430b3a=this;return new Promise(function(_0x49552c,_0x534f57){return db[_0xcec2('0x1f')][_0xcec2('0x2b')]({'raw':_0x255b12['options']?_0x255b12[_0xcec2('0x22')][_0xcec2('0x21')]===undefined?!![]:![]:!![],'where':_0x255b12[_0xcec2('0x22')]?_0x255b12[_0xcec2('0x22')][_0xcec2('0x23')]||null:null,'attributes':_0x255b12[_0xcec2('0x22')]?_0x255b12[_0xcec2('0x22')]['attributes']||null:null,'include':_0x255b12[_0xcec2('0x22')]?_0x255b12['options'][_0xcec2('0x26')]?_[_0xcec2('0x28')](_0x255b12[_0xcec2('0x22')][_0xcec2('0x26')],function(_0x559025){return{'model':db[_0x559025[_0xcec2('0x27')]],'as':_0x559025['as'],'attributes':_0x559025[_0xcec2('0x24')],'include':_0x559025[_0xcec2('0x26')]?_[_0xcec2('0x28')](_0x559025[_0xcec2('0x26')],function(_0x5f1149){return{'model':db[_0x5f1149['model']],'as':_0x5f1149['as'],'attributes':_0x5f1149[_0xcec2('0x24')],'include':_0x5f1149[_0xcec2('0x26')]?_[_0xcec2('0x28')](_0x5f1149[_0xcec2('0x26')],function(_0x31878c){return{'model':db[_0x31878c['model']],'as':_0x31878c['as'],'attributes':_0x31878c[_0xcec2('0x24')]};}):[]};}):[]};}):[]:[]})[_0xcec2('0x13')](function(_0x10c554){logger[_0xcec2('0x1c')](_0xcec2('0x2a'),_0x255b12);logger['debug']('ShowMailQueue',_0x255b12,JSON[_0xcec2('0x18')](_0x10c554));_0x49552c(_0x10c554);})['catch'](function(_0x34175a){logger[_0xcec2('0x19')](_0xcec2('0x2a'),_0x34175a[_0xcec2('0x1b')],_0x255b12);_0x534f57(_0x430b3a['error'](0x1f4,_0x34175a[_0xcec2('0x1b')]));});});}; \ No newline at end of file +var _0xb7ee=['socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetMailQueue','findAll','options','raw','attributes','include','map','model','then','find','where','ShowMailQueue','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x505375,_0x173ede){var _0x30c9f3=function(_0x316496){while(--_0x316496){_0x505375['push'](_0x505375['shift']());}};_0x30c9f3(++_0x173ede);}(_0xb7ee,0xba));var _0xeb7e=function(_0x46415a,_0x15013b){_0x46415a=_0x46415a-0x0;var _0x22a3cd=_0xb7ee[_0x46415a];return _0x22a3cd;};'use strict';var _=require(_0xeb7e('0x0'));var util=require(_0xeb7e('0x1'));var moment=require(_0xeb7e('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb7e('0x3'));var fs=require('fs');var Redis=require(_0xeb7e('0x4'));var db=require(_0xeb7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb7e('0x6'))(_0xeb7e('0x7'));var config=require(_0xeb7e('0x8'));var jayson=require(_0xeb7e('0x9'));var client=jayson[_0xeb7e('0xa')][_0xeb7e('0xb')]({'port':0x232a});config[_0xeb7e('0xc')]=_[_0xeb7e('0xd')](config[_0xeb7e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb7e('0xe'))(new Redis(config['redis']));require(_0xeb7e('0xf'))[_0xeb7e('0x10')](socket);function respondWithRpcPromise(_0x1b9444,_0x566e34,_0x5825fe){return new BPromise(function(_0x5449d4,_0x2d9e89){return client[_0xeb7e('0x11')](_0x1b9444,_0x5825fe)['then'](function(_0x484362){logger[_0xeb7e('0x12')](_0xeb7e('0x13'),_0x566e34,_0xeb7e('0x14'));logger[_0xeb7e('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x566e34,'request\x20sent',JSON[_0xeb7e('0x16')](_0x484362));if(_0x484362[_0xeb7e('0x17')]){if(_0x484362[_0xeb7e('0x17')][_0xeb7e('0x18')]===0x1f4){logger[_0xeb7e('0x17')]('MailQueue,\x20%s,\x20%s',_0x566e34,_0x484362[_0xeb7e('0x17')][_0xeb7e('0x19')]);return _0x2d9e89(_0x484362[_0xeb7e('0x17')][_0xeb7e('0x19')]);}logger[_0xeb7e('0x17')](_0xeb7e('0x13'),_0x566e34,_0x484362['error']['message']);return _0x5449d4(_0x484362[_0xeb7e('0x17')][_0xeb7e('0x19')]);}else{logger[_0xeb7e('0x12')](_0xeb7e('0x13'),_0x566e34,'request\x20sent');_0x5449d4(_0x484362[_0xeb7e('0x1a')][_0xeb7e('0x19')]);}})['catch'](function(_0x4df811){logger[_0xeb7e('0x17')](_0xeb7e('0x13'),_0x566e34,_0x4df811);_0x2d9e89(_0x4df811);});});}exports[_0xeb7e('0x1b')]=function(_0x1b607c){var _0x38199f=this;return new Promise(function(_0x21b7df,_0xb44a70){return db['MailQueue'][_0xeb7e('0x1c')]({'raw':_0x1b607c[_0xeb7e('0x1d')]?_0x1b607c[_0xeb7e('0x1d')][_0xeb7e('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b607c[_0xeb7e('0x1d')]?_0x1b607c[_0xeb7e('0x1d')]['where']||null:null,'attributes':_0x1b607c[_0xeb7e('0x1d')]?_0x1b607c[_0xeb7e('0x1d')][_0xeb7e('0x1f')]||null:null,'limit':_0x1b607c['options']?_0x1b607c[_0xeb7e('0x1d')]['limit']||null:null,'include':_0x1b607c[_0xeb7e('0x1d')]?_0x1b607c[_0xeb7e('0x1d')][_0xeb7e('0x20')]?_[_0xeb7e('0x21')](_0x1b607c['options'][_0xeb7e('0x20')],function(_0x36b26d){return{'model':db[_0x36b26d['model']],'as':_0x36b26d['as'],'attributes':_0x36b26d[_0xeb7e('0x1f')],'include':_0x36b26d[_0xeb7e('0x20')]?_[_0xeb7e('0x21')](_0x36b26d[_0xeb7e('0x20')],function(_0x5dd2a5){return{'model':db[_0x5dd2a5[_0xeb7e('0x22')]],'as':_0x5dd2a5['as'],'attributes':_0x5dd2a5[_0xeb7e('0x1f')],'include':_0x5dd2a5[_0xeb7e('0x20')]?_['map'](_0x5dd2a5[_0xeb7e('0x20')],function(_0x1334bd){return{'model':db[_0x1334bd[_0xeb7e('0x22')]],'as':_0x1334bd['as'],'attributes':_0x1334bd[_0xeb7e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xeb7e('0x23')](function(_0x1b3496){logger[_0xeb7e('0x12')](_0xeb7e('0x1b'),_0x1b607c);logger[_0xeb7e('0x15')](_0xeb7e('0x1b'),_0x1b607c,JSON[_0xeb7e('0x16')](_0x1b3496));_0x21b7df(_0x1b3496);})['catch'](function(_0x5992b3){logger['error'](_0xeb7e('0x1b'),_0x5992b3[_0xeb7e('0x19')],_0x1b607c);_0xb44a70(_0x38199f['error'](0x1f4,_0x5992b3[_0xeb7e('0x19')]));});});};exports['ShowMailQueue']=function(_0x564fbb){var _0x4d2c20=this;return new Promise(function(_0xed2270,_0x1b1cb9){return db['MailQueue'][_0xeb7e('0x24')]({'raw':_0x564fbb[_0xeb7e('0x1d')]?_0x564fbb[_0xeb7e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x564fbb[_0xeb7e('0x1d')]?_0x564fbb[_0xeb7e('0x1d')][_0xeb7e('0x25')]||null:null,'attributes':_0x564fbb[_0xeb7e('0x1d')]?_0x564fbb['options'][_0xeb7e('0x1f')]||null:null,'include':_0x564fbb['options']?_0x564fbb[_0xeb7e('0x1d')][_0xeb7e('0x20')]?_[_0xeb7e('0x21')](_0x564fbb[_0xeb7e('0x1d')][_0xeb7e('0x20')],function(_0x318ba0){return{'model':db[_0x318ba0[_0xeb7e('0x22')]],'as':_0x318ba0['as'],'attributes':_0x318ba0[_0xeb7e('0x1f')],'include':_0x318ba0[_0xeb7e('0x20')]?_[_0xeb7e('0x21')](_0x318ba0[_0xeb7e('0x20')],function(_0x292ba9){return{'model':db[_0x292ba9[_0xeb7e('0x22')]],'as':_0x292ba9['as'],'attributes':_0x292ba9[_0xeb7e('0x1f')],'include':_0x292ba9[_0xeb7e('0x20')]?_[_0xeb7e('0x21')](_0x292ba9[_0xeb7e('0x20')],function(_0x23cb47){return{'model':db[_0x23cb47[_0xeb7e('0x22')]],'as':_0x23cb47['as'],'attributes':_0x23cb47[_0xeb7e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xeb7e('0x23')](function(_0x260c9a){logger[_0xeb7e('0x12')](_0xeb7e('0x26'),_0x564fbb);logger['debug']('ShowMailQueue',_0x564fbb,JSON[_0xeb7e('0x16')](_0x260c9a));_0xed2270(_0x260c9a);})[_0xeb7e('0x27')](function(_0x3de2ab){logger['error'](_0xeb7e('0x26'),_0x3de2ab[_0xeb7e('0x19')],_0x564fbb);_0x1b1cb9(_0x4d2c20['error'](0x1f4,_0x3de2ab[_0xeb7e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 10df772..aa708c4 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 _0x98e7=['length','mailQueue:','save','remove','update','emit','register'];(function(_0x2d09df,_0x105345){var _0x1237a0=function(_0x352736){while(--_0x352736){_0x2d09df['push'](_0x2d09df['shift']());}};_0x1237a0(++_0x105345);}(_0x98e7,0x1c2));var _0x798e=function(_0xddfbdc,_0x561a0b){_0xddfbdc=_0xddfbdc-0x0;var _0x395d72=_0x98e7[_0xddfbdc];return _0x395d72;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x798e('0x0'),_0x798e('0x1'),_0x798e('0x2')];function createListener(_0x4478b2,_0x320e4d){return function(_0x1571c4){_0x320e4d[_0x798e('0x3')](_0x4478b2,_0x1571c4);};}function removeListener(_0x5e750c,_0x808ffe){return function(){MailQueueEvents['removeListener'](_0x5e750c,_0x808ffe);};}exports[_0x798e('0x4')]=function(_0x1b5f85){for(var _0x2119a8=0x0,_0x155f0c=events[_0x798e('0x5')];_0x2119a8<_0x155f0c;_0x2119a8++){var _0x1a60d5=events[_0x2119a8];var _0x4c48db=createListener(_0x798e('0x6')+_0x1a60d5,_0x1b5f85);MailQueueEvents['on'](_0x1a60d5,_0x4c48db);}}; \ No newline at end of file +var _0x799f=['mailQueue:','remove','update','emit','removeListener','register','length'];(function(_0xcc9588,_0x2d09d3){var _0x5d7dba=function(_0x54494a){while(--_0x54494a){_0xcc9588['push'](_0xcc9588['shift']());}};_0x5d7dba(++_0x2d09d3);}(_0x799f,0x1cf));var _0xf799=function(_0x566029,_0x5e152a){_0x566029=_0x566029-0x0;var _0x4d29f0=_0x799f[_0x566029];return _0x4d29f0;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0xf799('0x0'),_0xf799('0x1')];function createListener(_0x58f8a9,_0x49f6ce){return function(_0x20f3f3){_0x49f6ce[_0xf799('0x2')](_0x58f8a9,_0x20f3f3);};}function removeListener(_0x30497d,_0x27e157){return function(){MailQueueEvents[_0xf799('0x3')](_0x30497d,_0x27e157);};}exports[_0xf799('0x4')]=function(_0x301f5c){for(var _0x3c8cb6=0x0,_0x229916=events[_0xf799('0x5')];_0x3c8cb6<_0x229916;_0x3c8cb6++){var _0x4a389f=events[_0x3c8cb6];var _0x47b5c9=createListener(_0xf799('0x6')+_0x4a389f,_0x301f5c);MailQueueEvents['on'](_0x4a389f,_0x47b5c9);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ff34bae..37e387c 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 _0xf346=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xf346,0x178));var _0x6f34=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xf346[_0xa148b7];return _0x51efd3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f34('0x0'));var timeout=require(_0x6f34('0x1'));var express=require('express');var router=express[_0x6f34('0x2')]();var fs_extra=require(_0x6f34('0x3'));var auth=require(_0x6f34('0x4'));var interaction=require(_0x6f34('0x5'));var config=require(_0x6f34('0x6'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x6f34('0x7')](),controller[_0x6f34('0x8')]);router[_0x6f34('0x9')]('/describe',auth[_0x6f34('0x7')](),controller[_0x6f34('0xa')]);router[_0x6f34('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6f34('0xb')]);router[_0x6f34('0xc')]('/',auth[_0x6f34('0x7')](),controller[_0x6f34('0xd')]);router[_0x6f34('0xe')](_0x6f34('0xf'),auth[_0x6f34('0x7')](),controller[_0x6f34('0x10')]);router[_0x6f34('0x11')](_0x6f34('0xf'),auth['isAuthenticated'](),controller[_0x6f34('0x12')]);module[_0x6f34('0x13')]=router; \ No newline at end of file +var _0x1d32=['index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated'];(function(_0x17b39c,_0x4d030b){var _0x171c0e=function(_0x599145){while(--_0x599145){_0x17b39c['push'](_0x17b39c['shift']());}};_0x171c0e(++_0x4d030b);}(_0x1d32,0xc8));var _0x21d3=function(_0x2fa58f,_0x3c3ad5){_0x2fa58f=_0x2fa58f-0x0;var _0x3c05f5=_0x1d32[_0x2fa58f];return _0x3c05f5;};'use strict';var multer=require(_0x21d3('0x0'));var util=require('util');var path=require(_0x21d3('0x1'));var timeout=require(_0x21d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x21d3('0x3'));var auth=require(_0x21d3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x21d3('0x5'));var controller=require(_0x21d3('0x6'));router[_0x21d3('0x7')]('/',auth[_0x21d3('0x8')](),controller[_0x21d3('0x9')]);router[_0x21d3('0x7')](_0x21d3('0xa'),auth[_0x21d3('0x8')](),controller[_0x21d3('0xb')]);router[_0x21d3('0x7')](_0x21d3('0xc'),auth[_0x21d3('0x8')](),controller[_0x21d3('0xd')]);router[_0x21d3('0xe')]('/',auth[_0x21d3('0x8')](),controller['create']);router[_0x21d3('0xf')](_0x21d3('0xc'),auth[_0x21d3('0x8')](),controller[_0x21d3('0x10')]);router['delete'](_0x21d3('0xc'),auth[_0x21d3('0x8')](),controller[_0x21d3('0x11')]);module[_0x21d3('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 456e042..ad84716 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 _0x9789=['sequelize','exports','STRING','DATE','moment'];(function(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_0x9789,0x1bc));var _0x9978=function(_0x9842c1,_0x1edf79){_0x9842c1=_0x9842c1-0x0;var _0x5ba376=_0x9789[_0x9842c1];return _0x5ba376;};'use strict';var moment=require(_0x9978('0x0'));var Sequelize=require(_0x9978('0x1'));module[_0x9978('0x2')]={'uniqueid':{'type':Sequelize[_0x9978('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9978('0x3')]},'joinAt':{'type':Sequelize[_0x9978('0x4')]},'leaveAt':{'type':Sequelize[_0x9978('0x4')]},'acceptAt':{'type':Sequelize[_0x9978('0x4')]},'exitAt':{'type':Sequelize[_0x9978('0x4')]},'reason':{'type':Sequelize[_0x9978('0x3')]}}; \ No newline at end of file +var _0x980f=['sequelize','exports','STRING','DATE','moment'];(function(_0x4cd226,_0x489a22){var _0x19c008=function(_0x14a9e2){while(--_0x14a9e2){_0x4cd226['push'](_0x4cd226['shift']());}};_0x19c008(++_0x489a22);}(_0x980f,0x194));var _0xf980=function(_0x57fbc8,_0x5f1746){_0x57fbc8=_0x57fbc8-0x0;var _0xfcf1de=_0x980f[_0x57fbc8];return _0xfcf1de;};'use strict';var moment=require(_0xf980('0x0'));var Sequelize=require(_0xf980('0x1'));module[_0xf980('0x2')]={'uniqueid':{'type':Sequelize[_0xf980('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf980('0x4')]},'leaveAt':{'type':Sequelize[_0xf980('0x4')]},'acceptAt':{'type':Sequelize[_0xf980('0x4')]},'exitAt':{'type':Sequelize[_0xf980('0x4')]},'reason':{'type':Sequelize[_0xf980('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index a693269..c3a5a67 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(_0x77853f,_0xf6ee23){var _0x49270f=function(_0x4fc18b){while(--_0x4fc18b){_0x77853f['push'](_0x77853f['shift']());}};_0x49270f(++_0xf6ee23);}(_0x0295,0x1f0));var _0x5029=function(_0x2831cf,_0x24babf){_0x2831cf=_0x2831cf-0x0;var _0x5ec206=_0x0295[_0x2831cf];return _0x5ec206;};'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 _0x5430=['update','then','destroy','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save'];(function(_0x145f2f,_0x34415e){var _0xc6e067=function(_0x7df9dc){while(--_0x7df9dc){_0x145f2f['push'](_0x145f2f['shift']());}};_0xc6e067(++_0x34415e);}(_0x5430,0x10c));var _0x0543=function(_0x4619ca,_0x53797d){_0x4619ca=_0x4619ca-0x0;var _0x434678=_0x5430[_0x4619ca];return _0x434678;};'use strict';var emlformat=require(_0x0543('0x0'));var rimraf=require(_0x0543('0x1'));var zipdir=require(_0x0543('0x2'));var jsonpatch=require(_0x0543('0x3'));var rp=require(_0x0543('0x4'));var moment=require(_0x0543('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0543('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0543('0x7'));var ejs=require(_0x0543('0x8'));var fs=require('fs');var fs_extra=require(_0x0543('0x9'));var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x7'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var licenseUtil=require(_0x0543('0x17'));var db=require(_0x0543('0x18'))['db'];function respondWithStatusCode(_0x30c54e,_0x27290d){_0x27290d=_0x27290d||0xcc;return function(_0x46d176){if(_0x46d176){return _0x30c54e[_0x0543('0x19')](_0x27290d);}return _0x30c54e[_0x0543('0x1a')](_0x27290d)[_0x0543('0x1b')]();};}function respondWithResult(_0x552980,_0x4f1f2a){_0x4f1f2a=_0x4f1f2a||0xc8;return function(_0x21e9ac){if(_0x21e9ac){return _0x552980['status'](_0x4f1f2a)['json'](_0x21e9ac);}};}function respondWithFilteredResult(_0xcb09df,_0x40fb03){return function(_0x1dff7d){if(_0x1dff7d){var _0x1cfadf=typeof _0x40fb03[_0x0543('0x1c')]==='undefined'&&typeof _0x40fb03[_0x0543('0x1d')]===_0x0543('0x1e');var _0x2dd5cb=_0x1dff7d[_0x0543('0x1f')];var _0x20b396=_0x1cfadf?0x0:_0x40fb03[_0x0543('0x1c')];var _0x577cf0=_0x1cfadf?_0x1dff7d['count']:_0x40fb03[_0x0543('0x1c')]+_0x40fb03['limit'];var _0x50ea84;if(_0x577cf0>=_0x2dd5cb){_0x577cf0=_0x2dd5cb;_0x50ea84=0xc8;}else{_0x50ea84=0xce;}_0xcb09df[_0x0543('0x1a')](_0x50ea84);return _0xcb09df[_0x0543('0x20')](_0x0543('0x21'),_0x20b396+'-'+_0x577cf0+'/'+_0x2dd5cb)['json'](_0x1dff7d);}return null;};}function patchUpdates(_0x3f0452){return function(_0x51c271){try{jsonpatch[_0x0543('0x22')](_0x51c271,_0x3f0452,!![]);}catch(_0x411ec2){return BPromise['reject'](_0x411ec2);}return _0x51c271[_0x0543('0x23')]();};}function saveUpdates(_0x333c72,_0x427919){return function(_0x110060){if(_0x110060){return _0x110060[_0x0543('0x24')](_0x333c72)[_0x0543('0x25')](function(_0x4adba7){return _0x4adba7;});}return null;};}function removeEntity(_0x5979d2,_0x59f1b2){return function(_0xbfe5dc){if(_0xbfe5dc){return _0xbfe5dc[_0x0543('0x26')]()[_0x0543('0x25')](function(){_0x5979d2[_0x0543('0x1a')](0xcc)[_0x0543('0x1b')]();});}};}function handleEntityNotFound(_0x26e500,_0x36d824){return function(_0x17a3de){if(!_0x17a3de){_0x26e500[_0x0543('0x19')](0x194);}return _0x17a3de;};}function handleError(_0xf1eccf,_0x40a261){_0x40a261=_0x40a261||0x1f4;return function(_0x21fc63){logger['error'](_0x21fc63[_0x0543('0x27')]);if(_0x21fc63[_0x0543('0x28')]){delete _0x21fc63[_0x0543('0x28')];}_0xf1eccf['status'](_0x40a261)[_0x0543('0x29')](_0x21fc63);};}exports[_0x0543('0x2a')]=function(_0x41c4a7,_0x10b881){var _0x5dd789={},_0x1732be={},_0x10b9f3={'count':0x0,'rows':[]};var _0x492f60=_['map'](db[_0x0543('0x2b')][_0x0543('0x2c')],function(_0x51d49d){return{'name':_0x51d49d[_0x0543('0x2d')],'type':_0x51d49d[_0x0543('0x2e')][_0x0543('0x2f')]};});_0x1732be[_0x0543('0x30')]=_[_0x0543('0x31')](_0x492f60,_0x0543('0x28'));_0x1732be[_0x0543('0x32')]=_['keys'](_0x41c4a7[_0x0543('0x32')]);_0x1732be['filters']=_[_0x0543('0x33')](_0x1732be[_0x0543('0x30')],_0x1732be[_0x0543('0x32')]);_0x5dd789[_0x0543('0x34')]=_[_0x0543('0x33')](_0x1732be['model'],qs[_0x0543('0x35')](_0x41c4a7['query'][_0x0543('0x35')]));_0x5dd789[_0x0543('0x34')]=_0x5dd789[_0x0543('0x34')][_0x0543('0x36')]?_0x5dd789['attributes']:_0x1732be[_0x0543('0x30')];if(!_0x41c4a7['query'][_0x0543('0x37')](_0x0543('0x38'))){_0x5dd789[_0x0543('0x1d')]=qs[_0x0543('0x1d')](_0x41c4a7[_0x0543('0x32')][_0x0543('0x1d')]);_0x5dd789[_0x0543('0x1c')]=qs[_0x0543('0x1c')](_0x41c4a7[_0x0543('0x32')][_0x0543('0x1c')]);}_0x5dd789['order']=qs[_0x0543('0x39')](_0x41c4a7[_0x0543('0x32')]['sort']);_0x5dd789[_0x0543('0x3a')]=qs['filters'](_[_0x0543('0x3b')](_0x41c4a7[_0x0543('0x32')],_0x1732be['filters']),_0x492f60);if(_0x41c4a7['query'][_0x0543('0x3c')]){_0x5dd789[_0x0543('0x3a')]=_['merge'](_0x5dd789[_0x0543('0x3a')],{'$or':_[_0x0543('0x31')](_0x492f60,function(_0x54543f){if(_0x54543f[_0x0543('0x2e')]!==_0x0543('0x3d')){var _0x3ecd70={};_0x3ecd70[_0x54543f[_0x0543('0x28')]]={'$like':'%'+_0x41c4a7[_0x0543('0x32')]['filter']+'%'};return _0x3ecd70;}})});}_0x5dd789=_['merge']({},_0x5dd789,_0x41c4a7['options']);var _0x486d9c={'where':_0x5dd789[_0x0543('0x3a')]};return db[_0x0543('0x2b')][_0x0543('0x1f')](_0x486d9c)['then'](function(_0xc66396){_0x10b9f3[_0x0543('0x1f')]=_0xc66396;if(_0x41c4a7[_0x0543('0x32')][_0x0543('0x3e')]){_0x5dd789[_0x0543('0x3f')]=[{'all':!![]}];}return db[_0x0543('0x2b')][_0x0543('0x40')](_0x5dd789);})['then'](function(_0x24a891){_0x10b9f3[_0x0543('0x41')]=_0x24a891;return _0x10b9f3;})[_0x0543('0x25')](respondWithFilteredResult(_0x10b881,_0x5dd789))[_0x0543('0x42')](handleError(_0x10b881,null));};exports[_0x0543('0x43')]=function(_0x43b7e8,_0x5bf53d){var _0x53dfb8={'raw':!![],'where':{'id':_0x43b7e8[_0x0543('0x44')]['id']}},_0x44116a={};_0x44116a[_0x0543('0x30')]=_[_0x0543('0x45')](db[_0x0543('0x2b')][_0x0543('0x2c')]);_0x44116a[_0x0543('0x32')]=_[_0x0543('0x45')](_0x43b7e8[_0x0543('0x32')]);_0x44116a['filters']=_['intersection'](_0x44116a[_0x0543('0x30')],_0x44116a[_0x0543('0x32')]);_0x53dfb8['attributes']=_['intersection'](_0x44116a[_0x0543('0x30')],qs[_0x0543('0x35')](_0x43b7e8['query'][_0x0543('0x35')]));_0x53dfb8['attributes']=_0x53dfb8[_0x0543('0x34')][_0x0543('0x36')]?_0x53dfb8['attributes']:_0x44116a['model'];if(_0x43b7e8[_0x0543('0x32')]['includeAll']){_0x53dfb8[_0x0543('0x3f')]=[{'all':!![]}];}_0x53dfb8=_[_0x0543('0x46')]({},_0x53dfb8,_0x43b7e8[_0x0543('0x47')]);return db[_0x0543('0x2b')][_0x0543('0x48')](_0x53dfb8)[_0x0543('0x25')](handleEntityNotFound(_0x5bf53d,null))['then'](respondWithResult(_0x5bf53d,null))[_0x0543('0x42')](handleError(_0x5bf53d,null));};exports[_0x0543('0x49')]=function(_0xb8076c,_0xf0a28f){return db[_0x0543('0x2b')]['create'](_0xb8076c[_0x0543('0x4a')],{})['then'](respondWithResult(_0xf0a28f,0xc9))[_0x0543('0x42')](handleError(_0xf0a28f,null));};exports[_0x0543('0x24')]=function(_0x3f4c40,_0x46d398){if(_0x3f4c40[_0x0543('0x4a')]['id']){delete _0x3f4c40[_0x0543('0x4a')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x3f4c40['params']['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x46d398,null))[_0x0543('0x25')](saveUpdates(_0x3f4c40['body'],null))[_0x0543('0x25')](respondWithResult(_0x46d398,null))[_0x0543('0x42')](handleError(_0x46d398,null));};exports[_0x0543('0x26')]=function(_0x3d3bfc,_0x90dd22){return db[_0x0543('0x2b')]['find']({'where':{'id':_0x3d3bfc[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x90dd22,null))[_0x0543('0x25')](removeEntity(_0x90dd22,null))[_0x0543('0x42')](handleError(_0x90dd22,null));};exports[_0x0543('0x4b')]=function(_0x449150,_0x265bc1){return db[_0x0543('0x2b')][_0x0543('0x4b')]()[_0x0543('0x25')](respondWithResult(_0x265bc1,null))[_0x0543('0x42')](handleError(_0x265bc1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0064e2a..3b672d8 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 _0x2b55=['request-promise','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34f184,_0x342406){var _0x28afd8=function(_0x41810f){while(--_0x41810f){_0x34f184['push'](_0x34f184['shift']());}};_0x28afd8(++_0x342406);}(_0x2b55,0x180));var _0x52b5=function(_0x1674e0,_0xd107e7){_0x1674e0=_0x1674e0-0x0;var _0x36fc3f=_0x2b55[_0x1674e0];return _0x36fc3f;};'use strict';var _=require(_0x52b5('0x0'));var util=require(_0x52b5('0x1'));var logger=require(_0x52b5('0x2'))(_0x52b5('0x3'));var moment=require(_0x52b5('0x4'));var BPromise=require(_0x52b5('0x5'));var rp=require(_0x52b5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x52b5('0x7'));var attributes=require(_0x52b5('0x8'));module[_0x52b5('0x9')]=function(_0x3ac793,_0x3582ad){return _0x3ac793[_0x52b5('0xa')](_0x52b5('0xb'),attributes,{'tableName':_0x52b5('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ddb=['../../config/environment','define','MailQueueReport','report_mail_queue','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x31c2fe,_0x37b843){var _0x17565e=function(_0xb272e2){while(--_0xb272e2){_0x31c2fe['push'](_0x31c2fe['shift']());}};_0x17565e(++_0x37b843);}(_0x6ddb,0x1a6));var _0xb6dd=function(_0x274de6,_0x2d656c){_0x274de6=_0x274de6-0x0;var _0x5001b8=_0x6ddb[_0x274de6];return _0x5001b8;};'use strict';var _=require(_0xb6dd('0x0'));var util=require('util');var logger=require(_0xb6dd('0x1'))(_0xb6dd('0x2'));var moment=require('moment');var BPromise=require(_0xb6dd('0x3'));var rp=require(_0xb6dd('0x4'));var fs=require('fs');var path=require(_0xb6dd('0x5'));var rimraf=require(_0xb6dd('0x6'));var config=require(_0xb6dd('0x7'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x41a47a,_0x91e20f){return _0x41a47a[_0xb6dd('0x8')](_0xb6dd('0x9'),attributes,{'tableName':_0xb6dd('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index e01b2e3..d0de195 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3f4853,_0x135ca9){var _0xc09554=function(_0x4ce2a4){while(--_0x4ce2a4){_0x3f4853['push'](_0x3f4853['shift']());}};_0xc09554(++_0x135ca9);}(_0x1261,0x144));var _0x1126=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x1261[_0x59ae8f];return _0x3900b5;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x4f6eee,_0x57f65c){var _0x36e271=function(_0x11c983){while(--_0x11c983){_0x4f6eee['push'](_0x4f6eee['shift']());}};_0x36e271(++_0x57f65c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d78fe66..567f1ad 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x50a613,_0x1c77c6){var _0x27b2f3=function(_0x5ba3f7){while(--_0x5ba3f7){_0x50a613['push'](_0x50a613['shift']());}};_0x27b2f3(++_0x1c77c6);}(_0x70e0,0x17b));var _0x070e=function(_0x2426ad,_0x1dd294){_0x2426ad=_0x2426ad-0x0;var _0x46e8db=_0x70e0[_0x2426ad];return _0x46e8db;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 1254c7f..0c2e2e5 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 _0x7847=['STRING','INTEGER','INBOX','BOOLEAN','sequelize','exports'];(function(_0x509857,_0x3933e7){var _0xc6da17=function(_0x5111bd){while(--_0x5111bd){_0x509857['push'](_0x509857['shift']());}};_0xc6da17(++_0x3933e7);}(_0x7847,0xca));var _0x7784=function(_0x133296,_0xe8ff9a){_0x133296=_0x133296-0x0;var _0x193517=_0x7847[_0x133296];return _0x193517;};'use strict';var Sequelize=require(_0x7784('0x0'));module[_0x7784('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7784('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7784('0x2')]},'port':{'type':Sequelize[_0x7784('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7784('0x2')],'defaultValue':_0x7784('0x4')},'connTimeout':{'type':Sequelize[_0x7784('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7784('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x7784('0x2')]},'modernAuthentication':{'type':Sequelize[_0x7784('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x255b=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x2b2094,_0x59e69d){var _0x3d56ff=function(_0x138bdf){while(--_0x138bdf){_0x2b2094['push'](_0x2b2094['shift']());}};_0x3d56ff(++_0x59e69d);}(_0x255b,0xc4));var _0xb255=function(_0x3bf831,_0x4f71d8){_0x3bf831=_0x3bf831-0x0;var _0x17ced7=_0x255b[_0x3bf831];return _0x17ced7;};'use strict';var Sequelize=require(_0xb255('0x0'));module[_0xb255('0x1')]={'description':{'type':Sequelize[_0xb255('0x2')]},'host':{'type':Sequelize[_0xb255('0x2')]},'authentication':{'type':Sequelize[_0xb255('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb255('0x2')]},'password':{'type':Sequelize[_0xb255('0x2')]},'port':{'type':Sequelize[_0xb255('0x4')]},'tls':{'type':Sequelize[_0xb255('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb255('0x2')],'defaultValue':_0xb255('0x5')},'connTimeout':{'type':Sequelize[_0xb255('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb255('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb255('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb255('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 4708ccc..ea6d42a 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 _0xa537=['../../config/environment','MailServerIn','api','moment','request-promise','rimraf'];(function(_0x3cd1d9,_0x1a9dce){var _0x1beba6=function(_0x4be48f){while(--_0x4be48f){_0x3cd1d9['push'](_0x3cd1d9['shift']());}};_0x1beba6(++_0x1a9dce);}(_0xa537,0x19a));var _0x7a53=function(_0x8ef5e4,_0x391cc8){_0x8ef5e4=_0x8ef5e4-0x0;var _0x5d59a3=_0xa537[_0x8ef5e4];return _0x5d59a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7a53('0x0'));var moment=require(_0x7a53('0x1'));var BPromise=require('bluebird');var rp=require(_0x7a53('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a53('0x3'));var config=require(_0x7a53('0x4'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x2c90a8,_0x1cb85b){return _0x2c90a8['define'](_0x7a53('0x5'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab99=['../../config/environment','./mailServerIn.attributes','exports','util','api','moment','bluebird','request-promise','path'];(function(_0x8b9162,_0x45c2fc){var _0x12d79b=function(_0x172c63){while(--_0x172c63){_0x8b9162['push'](_0x8b9162['shift']());}};_0x12d79b(++_0x45c2fc);}(_0xab99,0x162));var _0x9ab9=function(_0x13616b,_0x1d0db0){_0x13616b=_0x13616b-0x0;var _0x48f08d=_0xab99[_0x13616b];return _0x48f08d;};'use strict';var _=require('lodash');var util=require(_0x9ab9('0x0'));var logger=require('../../config/logger')(_0x9ab9('0x1'));var moment=require(_0x9ab9('0x2'));var BPromise=require(_0x9ab9('0x3'));var rp=require(_0x9ab9('0x4'));var fs=require('fs');var path=require(_0x9ab9('0x5'));var rimraf=require('rimraf');var config=require(_0x9ab9('0x6'));var attributes=require(_0x9ab9('0x7'));module[_0x9ab9('0x8')]=function(_0x4e0c5a,_0xe4b7c){return _0x4e0c5a['define']('MailServerIn',attributes,{'tableName':'mail_servers_in','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 2b44d4b..31555be 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 _0x9d11=['MailServerIn,\x20%s,\x20%s,\x20%s','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','include','map','model','then','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug'];(function(_0x168473,_0x2fda9a){var _0xf69eb4=function(_0x30ca7f){while(--_0x30ca7f){_0x168473['push'](_0x168473['shift']());}};_0xf69eb4(++_0x2fda9a);}(_0x9d11,0xb7));var _0x19d1=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x9d11[_0x3c6dce];return _0x1450e9;};'use strict';var _=require(_0x19d1('0x0'));var util=require(_0x19d1('0x1'));var moment=require(_0x19d1('0x2'));var BPromise=require(_0x19d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19d1('0x4'));var db=require(_0x19d1('0x5'))['db'];var utils=require(_0x19d1('0x6'));var logger=require(_0x19d1('0x7'))(_0x19d1('0x8'));var config=require(_0x19d1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x19d1('0xa')][_0x19d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b624c,_0x16eaf9,_0x3dbe9f){return new BPromise(function(_0x2d9f9e,_0x3e2181){return client['request'](_0x4b624c,_0x3dbe9f)['then'](function(_0xc947ce){logger[_0x19d1('0xc')]('MailServerIn,\x20%s,\x20%s',_0x16eaf9,_0x19d1('0xd'));logger[_0x19d1('0xe')](_0x19d1('0xf'),_0x16eaf9,'request\x20sent',JSON['stringify'](_0xc947ce));if(_0xc947ce['error']){if(_0xc947ce[_0x19d1('0x10')][_0x19d1('0x11')]===0x1f4){logger[_0x19d1('0x10')](_0x19d1('0x12'),_0x16eaf9,_0xc947ce['error']['message']);return _0x3e2181(_0xc947ce[_0x19d1('0x10')]['message']);}logger['error'](_0x19d1('0x12'),_0x16eaf9,_0xc947ce[_0x19d1('0x10')][_0x19d1('0x13')]);return _0x2d9f9e(_0xc947ce[_0x19d1('0x10')][_0x19d1('0x13')]);}else{logger[_0x19d1('0xc')](_0x19d1('0x12'),_0x16eaf9,'request\x20sent');_0x2d9f9e(_0xc947ce[_0x19d1('0x14')][_0x19d1('0x13')]);}})[_0x19d1('0x15')](function(_0x5b5c4c){logger[_0x19d1('0x10')](_0x19d1('0x12'),_0x16eaf9,_0x5b5c4c);_0x3e2181(_0x5b5c4c);});});}exports[_0x19d1('0x16')]=function(_0x3df779){var _0x3144eb=this;return new Promise(function(_0xae72c5,_0x5c92bc){return db[_0x19d1('0x17')]['findAll']({'raw':_0x3df779['options']?_0x3df779[_0x19d1('0x18')][_0x19d1('0x19')]===undefined?!![]:![]:!![],'where':_0x3df779[_0x19d1('0x18')]?_0x3df779[_0x19d1('0x18')][_0x19d1('0x1a')]||null:null,'attributes':_0x3df779['options']?_0x3df779['options'][_0x19d1('0x1b')]||null:null,'limit':_0x3df779[_0x19d1('0x18')]?_0x3df779['options']['limit']||null:null,'include':_0x3df779[_0x19d1('0x18')]?_0x3df779[_0x19d1('0x18')][_0x19d1('0x1c')]?_[_0x19d1('0x1d')](_0x3df779[_0x19d1('0x18')][_0x19d1('0x1c')],function(_0x57ad20){return{'model':db[_0x57ad20[_0x19d1('0x1e')]],'as':_0x57ad20['as'],'attributes':_0x57ad20[_0x19d1('0x1b')],'include':_0x57ad20[_0x19d1('0x1c')]?_['map'](_0x57ad20[_0x19d1('0x1c')],function(_0x1bb261){return{'model':db[_0x1bb261[_0x19d1('0x1e')]],'as':_0x1bb261['as'],'attributes':_0x1bb261[_0x19d1('0x1b')],'include':_0x1bb261[_0x19d1('0x1c')]?_[_0x19d1('0x1d')](_0x1bb261[_0x19d1('0x1c')],function(_0x2d83a6){return{'model':db[_0x2d83a6[_0x19d1('0x1e')]],'as':_0x2d83a6['as'],'attributes':_0x2d83a6[_0x19d1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x19d1('0x1f')](function(_0x3ceda9){logger[_0x19d1('0xc')](_0x19d1('0x16'),_0x3df779);logger[_0x19d1('0xe')](_0x19d1('0x16'),_0x3df779,JSON[_0x19d1('0x20')](_0x3ceda9));_0xae72c5(_0x3ceda9);})['catch'](function(_0x2b186e){logger[_0x19d1('0x10')](_0x19d1('0x16'),_0x2b186e[_0x19d1('0x13')],_0x3df779);_0x5c92bc(_0x3144eb[_0x19d1('0x10')](0x1f4,_0x2b186e[_0x19d1('0x13')]));});});}; \ No newline at end of file +var _0x7f84=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','MailServerIn,\x20%s,\x20%s','message','result','MailServerIn','findAll','options','attributes','limit','include','map','model','GetMailServerIn','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x72e08e,_0x5bc441){var _0x477837=function(_0x58c62b){while(--_0x58c62b){_0x72e08e['push'](_0x72e08e['shift']());}};_0x477837(++_0x5bc441);}(_0x7f84,0xf1));var _0x47f8=function(_0x17e9b0,_0x3dc934){_0x17e9b0=_0x17e9b0-0x0;var _0x2bc59f=_0x7f84[_0x17e9b0];return _0x2bc59f;};'use strict';var _=require(_0x47f8('0x0'));var util=require(_0x47f8('0x1'));var moment=require(_0x47f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x47f8('0x3'));var fs=require('fs');var Redis=require(_0x47f8('0x4'));var db=require(_0x47f8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47f8('0x6'))(_0x47f8('0x7'));var config=require(_0x47f8('0x8'));var jayson=require(_0x47f8('0x9'));var client=jayson[_0x47f8('0xa')][_0x47f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fb047,_0x59b9a8,_0x47e7d6){return new BPromise(function(_0x39cc7e,_0x3025ee){return client['request'](_0x4fb047,_0x47e7d6)[_0x47f8('0xc')](function(_0xac4395){logger[_0x47f8('0xd')]('MailServerIn,\x20%s,\x20%s',_0x59b9a8,_0x47f8('0xe'));logger[_0x47f8('0xf')](_0x47f8('0x10'),_0x59b9a8,'request\x20sent',JSON['stringify'](_0xac4395));if(_0xac4395[_0x47f8('0x11')]){if(_0xac4395['error']['code']===0x1f4){logger['error'](_0x47f8('0x12'),_0x59b9a8,_0xac4395[_0x47f8('0x11')]['message']);return _0x3025ee(_0xac4395[_0x47f8('0x11')][_0x47f8('0x13')]);}logger[_0x47f8('0x11')](_0x47f8('0x12'),_0x59b9a8,_0xac4395[_0x47f8('0x11')][_0x47f8('0x13')]);return _0x39cc7e(_0xac4395[_0x47f8('0x11')][_0x47f8('0x13')]);}else{logger[_0x47f8('0xd')](_0x47f8('0x12'),_0x59b9a8,_0x47f8('0xe'));_0x39cc7e(_0xac4395[_0x47f8('0x14')]['message']);}})['catch'](function(_0x5b5a2a){logger[_0x47f8('0x11')]('MailServerIn,\x20%s,\x20%s',_0x59b9a8,_0x5b5a2a);_0x3025ee(_0x5b5a2a);});});}exports['GetMailServerIn']=function(_0xb8a648){var _0x57107e=this;return new Promise(function(_0x1d65b1,_0x29b833){return db[_0x47f8('0x15')][_0x47f8('0x16')]({'raw':_0xb8a648[_0x47f8('0x17')]?_0xb8a648[_0x47f8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xb8a648[_0x47f8('0x17')]?_0xb8a648[_0x47f8('0x17')]['where']||null:null,'attributes':_0xb8a648[_0x47f8('0x17')]?_0xb8a648[_0x47f8('0x17')][_0x47f8('0x18')]||null:null,'limit':_0xb8a648[_0x47f8('0x17')]?_0xb8a648[_0x47f8('0x17')][_0x47f8('0x19')]||null:null,'include':_0xb8a648[_0x47f8('0x17')]?_0xb8a648[_0x47f8('0x17')][_0x47f8('0x1a')]?_[_0x47f8('0x1b')](_0xb8a648[_0x47f8('0x17')]['include'],function(_0x38e1d5){return{'model':db[_0x38e1d5[_0x47f8('0x1c')]],'as':_0x38e1d5['as'],'attributes':_0x38e1d5['attributes'],'include':_0x38e1d5[_0x47f8('0x1a')]?_[_0x47f8('0x1b')](_0x38e1d5[_0x47f8('0x1a')],function(_0x45f563){return{'model':db[_0x45f563['model']],'as':_0x45f563['as'],'attributes':_0x45f563[_0x47f8('0x18')],'include':_0x45f563['include']?_[_0x47f8('0x1b')](_0x45f563[_0x47f8('0x1a')],function(_0x17154d){return{'model':db[_0x17154d[_0x47f8('0x1c')]],'as':_0x17154d['as'],'attributes':_0x17154d[_0x47f8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x47f8('0xc')](function(_0x329760){logger[_0x47f8('0xd')](_0x47f8('0x1d'),_0xb8a648);logger[_0x47f8('0xf')](_0x47f8('0x1d'),_0xb8a648,JSON[_0x47f8('0x1e')](_0x329760));_0x1d65b1(_0x329760);})['catch'](function(_0x998a3a){logger[_0x47f8('0x11')]('GetMailServerIn',_0x998a3a[_0x47f8('0x13')],_0xb8a648);_0x29b833(_0x57107e[_0x47f8('0x11')](0x1f4,_0x998a3a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index bb48724..d8640f6 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7a54,0x106));var _0x47a5=function(_0x418750,_0x167faf){_0x418750=_0x418750-0x0;var _0x292eac=_0x7a54[_0x418750];return _0x292eac;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _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(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 a929cda..a9cabf1 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 _0x4fc2=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x13cc39,_0x4e8ab2){var _0x2cfbc5=function(_0x1e61ea){while(--_0x1e61ea){_0x13cc39['push'](_0x13cc39['shift']());}};_0x2cfbc5(++_0x4e8ab2);}(_0x4fc2,0x111));var _0x24fc=function(_0x50bc98,_0x1e99b8){_0x50bc98=_0x50bc98-0x0;var _0x34163b=_0x4fc2[_0x50bc98];return _0x34163b;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'description':{'type':Sequelize[_0x24fc('0x2')]},'host':{'type':Sequelize[_0x24fc('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x24fc('0x2')]},'port':{'type':Sequelize[_0x24fc('0x3')]},'secure':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xb62e=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0xb62e,0x1de));var _0xeb62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb62e[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'description':{'type':Sequelize[_0xeb62('0x2')]},'host':{'type':Sequelize[_0xeb62('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xeb62('0x2')]},'port':{'type':Sequelize[_0xeb62('0x3')]},'secure':{'type':Sequelize[_0xeb62('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb62('0x2')]},'authentication':{'type':Sequelize[_0xeb62('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xeb62('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 5fd34a8..1eba007 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 _0xc43a=['include','MailServerOut','find','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','status','sendStatus','error','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes'];(function(_0x447508,_0x5bb274){var _0x18bcc1=function(_0x3565b1){while(--_0x3565b1){_0x447508['push'](_0x447508['shift']());}};_0x18bcc1(++_0x5bb274);}(_0xc43a,0xe5));var _0xac43=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc43a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xac43('0x0'));var rimraf=require(_0xac43('0x1'));var zipdir=require(_0xac43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xac43('0x3'));var BPromise=require(_0xac43('0x4'));var Mustache=require(_0xac43('0x5'));var util=require(_0xac43('0x6'));var path=require(_0xac43('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xac43('0x8'));var fs=require('fs');var fs_extra=require(_0xac43('0x9'));var _=require(_0xac43('0xa'));var squel=require(_0xac43('0xb'));var crypto=require(_0xac43('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac43('0xd'));var querystring=require(_0xac43('0xe'));var Papa=require(_0xac43('0xf'));var Redis=require(_0xac43('0x10'));var authService=require(_0xac43('0x11'));var qs=require(_0xac43('0x12'));var as=require(_0xac43('0x13'));var hardwareService=require(_0xac43('0x14'));var logger=require(_0xac43('0x15'))(_0xac43('0x16'));var utils=require(_0xac43('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac43('0x18'))['db'];function respondWithStatusCode(_0x20209b,_0x55b12d){_0x55b12d=_0x55b12d||0xcc;return function(_0x2b48d6){if(_0x2b48d6){return _0x20209b['sendStatus'](_0x55b12d);}return _0x20209b['status'](_0x55b12d)[_0xac43('0x19')]();};}function respondWithResult(_0x316cfd,_0x553c40){_0x553c40=_0x553c40||0xc8;return function(_0xd362b8){if(_0xd362b8){return _0x316cfd['status'](_0x553c40)[_0xac43('0x1a')](_0xd362b8);}};}function respondWithFilteredResult(_0xf1db14,_0x564bdd){return function(_0x2f4eb7){if(_0x2f4eb7){var _0x1f3a82=typeof _0x564bdd['offset']===_0xac43('0x1b')&&typeof _0x564bdd[_0xac43('0x1c')]==='undefined';var _0x590a49=_0x2f4eb7[_0xac43('0x1d')];var _0x4f6052=_0x1f3a82?0x0:_0x564bdd['offset'];var _0x4126af=_0x1f3a82?_0x2f4eb7['count']:_0x564bdd[_0xac43('0x1e')]+_0x564bdd[_0xac43('0x1c')];var _0x2e35c1;if(_0x4126af>=_0x590a49){_0x4126af=_0x590a49;_0x2e35c1=0xc8;}else{_0x2e35c1=0xce;}_0xf1db14['status'](_0x2e35c1);return _0xf1db14[_0xac43('0x1f')](_0xac43('0x20'),_0x4f6052+'-'+_0x4126af+'/'+_0x590a49)[_0xac43('0x1a')](_0x2f4eb7);}return null;};}function patchUpdates(_0x267642){return function(_0x26280c){try{jsonpatch[_0xac43('0x21')](_0x26280c,_0x267642,!![]);}catch(_0x1a887d){return BPromise[_0xac43('0x22')](_0x1a887d);}return _0x26280c[_0xac43('0x23')]();};}function saveUpdates(_0x287ffd,_0x43d07c){return function(_0x28ec11){if(_0x28ec11){return _0x28ec11[_0xac43('0x24')](_0x287ffd)[_0xac43('0x25')](function(_0x5ae802){return _0x5ae802;});}return null;};}function removeEntity(_0x119808,_0x46d57b){return function(_0x3405a8){if(_0x3405a8){return _0x3405a8['destroy']()[_0xac43('0x25')](function(){_0x119808[_0xac43('0x26')](0xcc)[_0xac43('0x19')]();});}};}function handleEntityNotFound(_0x1c7473,_0x58aa35){return function(_0x539778){if(!_0x539778){_0x1c7473[_0xac43('0x27')](0x194);}return _0x539778;};}function handleError(_0x1ee73a,_0x5b099c){_0x5b099c=_0x5b099c||0x1f4;return function(_0x30082e){logger[_0xac43('0x28')](_0x30082e['stack']);if(_0x30082e[_0xac43('0x29')]){delete _0x30082e['name'];}_0x1ee73a[_0xac43('0x26')](_0x5b099c)[_0xac43('0x2a')](_0x30082e);};}exports['index']=function(_0x28855e,_0x562471){var _0xd998bd={},_0x24a1c7={},_0x3f0b08={'count':0x0,'rows':[]};var _0x50452b=_[_0xac43('0x2b')](db['MailServerOut']['rawAttributes'],function(_0x800765){return{'name':_0x800765[_0xac43('0x2c')],'type':_0x800765[_0xac43('0x2d')][_0xac43('0x2e')]};});_0x24a1c7[_0xac43('0x2f')]=_[_0xac43('0x2b')](_0x50452b,_0xac43('0x29'));_0x24a1c7[_0xac43('0x30')]=_[_0xac43('0x31')](_0x28855e[_0xac43('0x30')]);_0x24a1c7['filters']=_[_0xac43('0x32')](_0x24a1c7['model'],_0x24a1c7[_0xac43('0x30')]);_0xd998bd[_0xac43('0x33')]=_[_0xac43('0x32')](_0x24a1c7['model'],qs[_0xac43('0x34')](_0x28855e['query'][_0xac43('0x34')]));_0xd998bd[_0xac43('0x33')]=_0xd998bd[_0xac43('0x33')][_0xac43('0x35')]?_0xd998bd[_0xac43('0x33')]:_0x24a1c7[_0xac43('0x2f')];if(!_0x28855e[_0xac43('0x30')][_0xac43('0x36')](_0xac43('0x37'))){_0xd998bd['limit']=qs[_0xac43('0x1c')](_0x28855e[_0xac43('0x30')][_0xac43('0x1c')]);_0xd998bd[_0xac43('0x1e')]=qs[_0xac43('0x1e')](_0x28855e['query'][_0xac43('0x1e')]);}_0xd998bd['order']=qs[_0xac43('0x38')](_0x28855e[_0xac43('0x30')][_0xac43('0x38')]);_0xd998bd['where']=qs[_0xac43('0x39')](_[_0xac43('0x3a')](_0x28855e[_0xac43('0x30')],_0x24a1c7[_0xac43('0x39')]),_0x50452b);if(_0x28855e[_0xac43('0x30')]['filter']){_0xd998bd[_0xac43('0x3b')]=_['merge'](_0xd998bd['where'],{'$or':_['map'](_0x50452b,function(_0x3c44d8){if(_0x3c44d8['type']!==_0xac43('0x3c')){var _0x3f660c={};_0x3f660c[_0x3c44d8['name']]={'$like':'%'+_0x28855e[_0xac43('0x30')][_0xac43('0x3d')]+'%'};return _0x3f660c;}})});}_0xd998bd=_[_0xac43('0x3e')]({},_0xd998bd,_0x28855e[_0xac43('0x3f')]);var _0x50fb02={'where':_0xd998bd['where']};return db['MailServerOut']['count'](_0x50fb02)[_0xac43('0x25')](function(_0x2b5911){_0x3f0b08[_0xac43('0x1d')]=_0x2b5911;if(_0x28855e[_0xac43('0x30')][_0xac43('0x40')]){_0xd998bd['include']=[{'all':!![]}];}return db['MailServerOut'][_0xac43('0x41')](_0xd998bd);})[_0xac43('0x25')](function(_0x231dc9){_0x3f0b08[_0xac43('0x42')]=_0x231dc9;return _0x3f0b08;})['then'](respondWithFilteredResult(_0x562471,_0xd998bd))[_0xac43('0x43')](handleError(_0x562471,null));};exports[_0xac43('0x44')]=function(_0x50a061,_0x118981){var _0x40c4b7={'raw':!![],'where':{'id':_0x50a061[_0xac43('0x45')]['id']}},_0x31c0c0={};_0x31c0c0[_0xac43('0x2f')]=_[_0xac43('0x31')](db['MailServerOut'][_0xac43('0x46')]);_0x31c0c0['query']=_['keys'](_0x50a061[_0xac43('0x30')]);_0x31c0c0[_0xac43('0x39')]=_[_0xac43('0x32')](_0x31c0c0[_0xac43('0x2f')],_0x31c0c0[_0xac43('0x30')]);_0x40c4b7[_0xac43('0x33')]=_[_0xac43('0x32')](_0x31c0c0['model'],qs['fields'](_0x50a061[_0xac43('0x30')][_0xac43('0x34')]));_0x40c4b7['attributes']=_0x40c4b7[_0xac43('0x33')][_0xac43('0x35')]?_0x40c4b7[_0xac43('0x33')]:_0x31c0c0[_0xac43('0x2f')];if(_0x50a061[_0xac43('0x30')]['includeAll']){_0x40c4b7[_0xac43('0x47')]=[{'all':!![]}];}_0x40c4b7=_['merge']({},_0x40c4b7,_0x50a061['options']);return db[_0xac43('0x48')][_0xac43('0x49')](_0x40c4b7)[_0xac43('0x25')](handleEntityNotFound(_0x118981,null))[_0xac43('0x25')](respondWithResult(_0x118981,null))[_0xac43('0x43')](handleError(_0x118981,null));};exports['create']=function(_0x4e15db,_0x5129b0){return db[_0xac43('0x48')]['create'](_0x4e15db[_0xac43('0x4a')],{})['then'](respondWithResult(_0x5129b0,0xc9))[_0xac43('0x43')](handleError(_0x5129b0,null));};exports[_0xac43('0x24')]=function(_0x585bb9,_0x46f05d){if(_0x585bb9['body']['id']){delete _0x585bb9['body']['id'];}return db[_0xac43('0x48')]['find']({'where':{'id':_0x585bb9[_0xac43('0x45')]['id']}})[_0xac43('0x25')](handleEntityNotFound(_0x46f05d,null))[_0xac43('0x25')](saveUpdates(_0x585bb9[_0xac43('0x4a')],null))['then'](respondWithResult(_0x46f05d,null))[_0xac43('0x43')](handleError(_0x46f05d,null));};exports['destroy']=function(_0xc14576,_0x2b6708){return db[_0xac43('0x48')][_0xac43('0x49')]({'where':{'id':_0xc14576[_0xac43('0x45')]['id']}})[_0xac43('0x25')](handleEntityNotFound(_0x2b6708,null))[_0xac43('0x25')](removeEntity(_0x2b6708,null))[_0xac43('0x43')](handleError(_0x2b6708,null));}; \ No newline at end of file +var _0xd0c7=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','MailServerOut','rawAttributes','fieldName','key','model','query'];(function(_0x58cba4,_0x56639b){var _0x3676fa=function(_0x34bf27){while(--_0x34bf27){_0x58cba4['push'](_0x58cba4['shift']());}};_0x3676fa(++_0x56639b);}(_0xd0c7,0xf7));var _0x7d0c=function(_0x12e1b1,_0x38f800){_0x12e1b1=_0x12e1b1-0x0;var _0x3ccfba=_0xd0c7[_0x12e1b1];return _0x3ccfba;};'use strict';var emlformat=require(_0x7d0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d0c('0x1'));var jsonpatch=require(_0x7d0c('0x2'));var rp=require(_0x7d0c('0x3'));var moment=require(_0x7d0c('0x4'));var BPromise=require(_0x7d0c('0x5'));var Mustache=require(_0x7d0c('0x6'));var util=require(_0x7d0c('0x7'));var path=require(_0x7d0c('0x8'));var sox=require('sox');var csv=require(_0x7d0c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d0c('0xa'));var squel=require(_0x7d0c('0xb'));var crypto=require(_0x7d0c('0xc'));var jsforce=require(_0x7d0c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7d0c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7d0c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7d0c('0xf'));var as=require(_0x7d0c('0x10'));var hardwareService=require(_0x7d0c('0x11'));var logger=require(_0x7d0c('0x12'))(_0x7d0c('0x13'));var utils=require(_0x7d0c('0x14'));var config=require(_0x7d0c('0x15'));var licenseUtil=require(_0x7d0c('0x16'));var db=require(_0x7d0c('0x17'))['db'];function respondWithStatusCode(_0x2c25c7,_0x804c34){_0x804c34=_0x804c34||0xcc;return function(_0x286689){if(_0x286689){return _0x2c25c7[_0x7d0c('0x18')](_0x804c34);}return _0x2c25c7[_0x7d0c('0x19')](_0x804c34)[_0x7d0c('0x1a')]();};}function respondWithResult(_0x39745d,_0x1206b9){_0x1206b9=_0x1206b9||0xc8;return function(_0x398860){if(_0x398860){return _0x39745d[_0x7d0c('0x19')](_0x1206b9)[_0x7d0c('0x1b')](_0x398860);}};}function respondWithFilteredResult(_0x5caaec,_0xad465){return function(_0x1d7e4d){if(_0x1d7e4d){var _0x12945a=typeof _0xad465[_0x7d0c('0x1c')]===_0x7d0c('0x1d')&&typeof _0xad465[_0x7d0c('0x1e')]==='undefined';var _0x4ec7fc=_0x1d7e4d[_0x7d0c('0x1f')];var _0x2c433a=_0x12945a?0x0:_0xad465[_0x7d0c('0x1c')];var _0x295707=_0x12945a?_0x1d7e4d['count']:_0xad465[_0x7d0c('0x1c')]+_0xad465[_0x7d0c('0x1e')];var _0x55e871;if(_0x295707>=_0x4ec7fc){_0x295707=_0x4ec7fc;_0x55e871=0xc8;}else{_0x55e871=0xce;}_0x5caaec[_0x7d0c('0x19')](_0x55e871);return _0x5caaec[_0x7d0c('0x20')](_0x7d0c('0x21'),_0x2c433a+'-'+_0x295707+'/'+_0x4ec7fc)[_0x7d0c('0x1b')](_0x1d7e4d);}return null;};}function patchUpdates(_0x598f7f){return function(_0x44be22){try{jsonpatch['apply'](_0x44be22,_0x598f7f,!![]);}catch(_0x5a7cd3){return BPromise[_0x7d0c('0x22')](_0x5a7cd3);}return _0x44be22[_0x7d0c('0x23')]();};}function saveUpdates(_0x1fbd83,_0x4b30d2){return function(_0x3a0f2d){if(_0x3a0f2d){return _0x3a0f2d[_0x7d0c('0x24')](_0x1fbd83)[_0x7d0c('0x25')](function(_0x4ece00){return _0x4ece00;});}return null;};}function removeEntity(_0x16d9fe,_0x248386){return function(_0x377841){if(_0x377841){return _0x377841[_0x7d0c('0x26')]()['then'](function(){_0x16d9fe[_0x7d0c('0x19')](0xcc)[_0x7d0c('0x1a')]();});}};}function handleEntityNotFound(_0x3502e8,_0xbbefb4){return function(_0x4ad1e9){if(!_0x4ad1e9){_0x3502e8[_0x7d0c('0x18')](0x194);}return _0x4ad1e9;};}function handleError(_0x29c0f7,_0x382666){_0x382666=_0x382666||0x1f4;return function(_0x417a74){logger[_0x7d0c('0x27')](_0x417a74['stack']);if(_0x417a74['name']){delete _0x417a74[_0x7d0c('0x28')];}_0x29c0f7[_0x7d0c('0x19')](_0x382666)['send'](_0x417a74);};}exports[_0x7d0c('0x29')]=function(_0x390055,_0xb24f9d){var _0x130ef2={},_0x46fe42={},_0x55ff60={'count':0x0,'rows':[]};var _0x38d95e=_[_0x7d0c('0x2a')](db[_0x7d0c('0x2b')][_0x7d0c('0x2c')],function(_0x5d7217){return{'name':_0x5d7217[_0x7d0c('0x2d')],'type':_0x5d7217['type'][_0x7d0c('0x2e')]};});_0x46fe42[_0x7d0c('0x2f')]=_['map'](_0x38d95e,'name');_0x46fe42[_0x7d0c('0x30')]=_[_0x7d0c('0x31')](_0x390055[_0x7d0c('0x30')]);_0x46fe42[_0x7d0c('0x32')]=_[_0x7d0c('0x33')](_0x46fe42[_0x7d0c('0x2f')],_0x46fe42[_0x7d0c('0x30')]);_0x130ef2[_0x7d0c('0x34')]=_[_0x7d0c('0x33')](_0x46fe42[_0x7d0c('0x2f')],qs[_0x7d0c('0x35')](_0x390055[_0x7d0c('0x30')]['fields']));_0x130ef2[_0x7d0c('0x34')]=_0x130ef2[_0x7d0c('0x34')]['length']?_0x130ef2[_0x7d0c('0x34')]:_0x46fe42['model'];if(!_0x390055[_0x7d0c('0x30')][_0x7d0c('0x36')](_0x7d0c('0x37'))){_0x130ef2[_0x7d0c('0x1e')]=qs[_0x7d0c('0x1e')](_0x390055[_0x7d0c('0x30')][_0x7d0c('0x1e')]);_0x130ef2['offset']=qs[_0x7d0c('0x1c')](_0x390055[_0x7d0c('0x30')][_0x7d0c('0x1c')]);}_0x130ef2[_0x7d0c('0x38')]=qs['sort'](_0x390055[_0x7d0c('0x30')][_0x7d0c('0x39')]);_0x130ef2[_0x7d0c('0x3a')]=qs[_0x7d0c('0x32')](_[_0x7d0c('0x3b')](_0x390055['query'],_0x46fe42[_0x7d0c('0x32')]),_0x38d95e);if(_0x390055[_0x7d0c('0x30')][_0x7d0c('0x3c')]){_0x130ef2[_0x7d0c('0x3a')]=_['merge'](_0x130ef2[_0x7d0c('0x3a')],{'$or':_[_0x7d0c('0x2a')](_0x38d95e,function(_0x2bcb32){if(_0x2bcb32['type']!=='VIRTUAL'){var _0x25650b={};_0x25650b[_0x2bcb32[_0x7d0c('0x28')]]={'$like':'%'+_0x390055[_0x7d0c('0x30')][_0x7d0c('0x3c')]+'%'};return _0x25650b;}})});}_0x130ef2=_['merge']({},_0x130ef2,_0x390055[_0x7d0c('0x3d')]);var _0x1b68a8={'where':_0x130ef2[_0x7d0c('0x3a')]};return db[_0x7d0c('0x2b')][_0x7d0c('0x1f')](_0x1b68a8)[_0x7d0c('0x25')](function(_0x315036){_0x55ff60[_0x7d0c('0x1f')]=_0x315036;if(_0x390055[_0x7d0c('0x30')][_0x7d0c('0x3e')]){_0x130ef2[_0x7d0c('0x3f')]=[{'all':!![]}];}return db['MailServerOut'][_0x7d0c('0x40')](_0x130ef2);})[_0x7d0c('0x25')](function(_0x3ade9f){_0x55ff60[_0x7d0c('0x41')]=_0x3ade9f;return _0x55ff60;})['then'](respondWithFilteredResult(_0xb24f9d,_0x130ef2))[_0x7d0c('0x42')](handleError(_0xb24f9d,null));};exports[_0x7d0c('0x43')]=function(_0x2475f1,_0x36b435){var _0x15b4ec={'raw':!![],'where':{'id':_0x2475f1[_0x7d0c('0x44')]['id']}},_0x41c07d={};_0x41c07d['model']=_[_0x7d0c('0x31')](db[_0x7d0c('0x2b')]['rawAttributes']);_0x41c07d['query']=_[_0x7d0c('0x31')](_0x2475f1[_0x7d0c('0x30')]);_0x41c07d[_0x7d0c('0x32')]=_[_0x7d0c('0x33')](_0x41c07d[_0x7d0c('0x2f')],_0x41c07d[_0x7d0c('0x30')]);_0x15b4ec['attributes']=_[_0x7d0c('0x33')](_0x41c07d[_0x7d0c('0x2f')],qs[_0x7d0c('0x35')](_0x2475f1[_0x7d0c('0x30')]['fields']));_0x15b4ec[_0x7d0c('0x34')]=_0x15b4ec[_0x7d0c('0x34')][_0x7d0c('0x45')]?_0x15b4ec[_0x7d0c('0x34')]:_0x41c07d[_0x7d0c('0x2f')];if(_0x2475f1['query']['includeAll']){_0x15b4ec[_0x7d0c('0x3f')]=[{'all':!![]}];}_0x15b4ec=_[_0x7d0c('0x46')]({},_0x15b4ec,_0x2475f1[_0x7d0c('0x3d')]);return db['MailServerOut'][_0x7d0c('0x47')](_0x15b4ec)[_0x7d0c('0x25')](handleEntityNotFound(_0x36b435,null))[_0x7d0c('0x25')](respondWithResult(_0x36b435,null))[_0x7d0c('0x42')](handleError(_0x36b435,null));};exports[_0x7d0c('0x48')]=function(_0xe17cae,_0x1b8d5f){return db[_0x7d0c('0x2b')][_0x7d0c('0x48')](_0xe17cae[_0x7d0c('0x49')],{})['then'](respondWithResult(_0x1b8d5f,0xc9))['catch'](handleError(_0x1b8d5f,null));};exports[_0x7d0c('0x24')]=function(_0x5c7c4d,_0x434bb0){if(_0x5c7c4d[_0x7d0c('0x49')]['id']){delete _0x5c7c4d[_0x7d0c('0x49')]['id'];}return db[_0x7d0c('0x2b')][_0x7d0c('0x47')]({'where':{'id':_0x5c7c4d[_0x7d0c('0x44')]['id']}})[_0x7d0c('0x25')](handleEntityNotFound(_0x434bb0,null))[_0x7d0c('0x25')](saveUpdates(_0x5c7c4d[_0x7d0c('0x49')],null))[_0x7d0c('0x25')](respondWithResult(_0x434bb0,null))[_0x7d0c('0x42')](handleError(_0x434bb0,null));};exports[_0x7d0c('0x26')]=function(_0x1d79d8,_0x4eaeaf){return db[_0x7d0c('0x2b')]['find']({'where':{'id':_0x1d79d8[_0x7d0c('0x44')]['id']}})[_0x7d0c('0x25')](handleEntityNotFound(_0x4eaeaf,null))['then'](removeEntity(_0x4eaeaf,null))[_0x7d0c('0x42')](handleError(_0x4eaeaf,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e633f74..b059731 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 _0x74f6=['moment','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger'];(function(_0x24a478,_0x512c3c){var _0x35120e=function(_0x4b739f){while(--_0x4b739f){_0x24a478['push'](_0x24a478['shift']());}};_0x35120e(++_0x512c3c);}(_0x74f6,0x11d));var _0x674f=function(_0x35c77a,_0x3fc993){_0x35c77a=_0x35c77a-0x0;var _0x571eaf=_0x74f6[_0x35c77a];return _0x571eaf;};'use strict';var _=require(_0x674f('0x0'));var util=require(_0x674f('0x1'));var logger=require(_0x674f('0x2'))('api');var moment=require(_0x674f('0x3'));var BPromise=require(_0x674f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x674f('0x5'));var config=require(_0x674f('0x6'));var attributes=require(_0x674f('0x7'));module[_0x674f('0x8')]=function(_0x4a5954,_0xe1b3a3){return _0x4a5954[_0x674f('0x9')](_0x674f('0xa'),attributes,{'tableName':_0x674f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd68f=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util'];(function(_0x30bc3e,_0x4fa7df){var _0x522b27=function(_0x886b91){while(--_0x886b91){_0x30bc3e['push'](_0x30bc3e['shift']());}};_0x522b27(++_0x4fa7df);}(_0xd68f,0xde));var _0xfd68=function(_0x48f17c,_0x360e24){_0x48f17c=_0x48f17c-0x0;var _0x53a1ec=_0xd68f[_0x48f17c];return _0x53a1ec;};'use strict';var _=require(_0xfd68('0x0'));var util=require(_0xfd68('0x1'));var logger=require(_0xfd68('0x2'))(_0xfd68('0x3'));var moment=require(_0xfd68('0x4'));var BPromise=require(_0xfd68('0x5'));var rp=require(_0xfd68('0x6'));var fs=require('fs');var path=require(_0xfd68('0x7'));var rimraf=require('rimraf');var config=require(_0xfd68('0x8'));var attributes=require(_0xfd68('0x9'));module[_0xfd68('0xa')]=function(_0x1cf483,_0x53ff1a){return _0x1cf483[_0xfd68('0xb')](_0xfd68('0xc'),attributes,{'tableName':_0xfd68('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 697677f..0037b16 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0xcb85f2,_0x1291a0){var _0x8a89de=function(_0x11a48e){while(--_0x11a48e){_0xcb85f2['push'](_0xcb85f2['shift']());}};_0x8a89de(++_0x1291a0);}(_0xdb28,0x106));var _0x8db2=function(_0x475597,_0x58645c){_0x475597=_0x475597-0x0;var _0x38bff7=_0xdb28[_0x475597];return _0x38bff7;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5c4669,_0x7f9bcd){var _0xf18b6a=function(_0x5ba22d){while(--_0x5ba22d){_0x5c4669['push'](_0x5c4669['shift']());}};_0xf18b6a(++_0x7f9bcd);}(_0xadb5,0xad));var _0x5adb=function(_0x584abc,_0x1ed024){_0x584abc=_0x584abc-0x0;var _0x345d3d=_0xadb5[_0x584abc];return _0x345d3d;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fd76e92..ab2c2cd 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 _0x943e=['../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x21c28b,_0x158a0e){var _0x1ffc57=function(_0x381b56){while(--_0x381b56){_0x21c28b['push'](_0x21c28b['shift']());}};_0x1ffc57(++_0x158a0e);}(_0x943e,0xc2));var _0xe943=function(_0x1ec0b1,_0x1b2c4c){_0x1ec0b1=_0x1ec0b1-0x0;var _0xb892fb=_0x943e[_0x1ec0b1];return _0xb892fb;};'use strict';var multer=require(_0xe943('0x0'));var util=require('util');var path=require(_0xe943('0x1'));var timeout=require(_0xe943('0x2'));var express=require(_0xe943('0x3'));var router=express[_0xe943('0x4')]();var fs_extra=require(_0xe943('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe943('0x6'));var config=require(_0xe943('0x7'));var controller=require(_0xe943('0x8'));router[_0xe943('0x9')]('/',auth['isAuthenticated'](),controller[_0xe943('0xa')]);router[_0xe943('0x9')](_0xe943('0xb'),auth[_0xe943('0xc')](),controller[_0xe943('0xd')]);router[_0xe943('0x9')](_0xe943('0xe'),auth[_0xe943('0xc')](),controller[_0xe943('0xf')]);router[_0xe943('0x10')]('/',auth[_0xe943('0xc')](),controller[_0xe943('0x11')]);router['put'](_0xe943('0xe'),auth[_0xe943('0xc')](),controller['update']);router[_0xe943('0x12')](_0xe943('0xe'),auth[_0xe943('0xc')](),controller[_0xe943('0x13')]);module['exports']=router; \ No newline at end of file +var _0x063b=['express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x5011b7,_0x1b3ff7){var _0x4dc161=function(_0x31f867){while(--_0x31f867){_0x5011b7['push'](_0x5011b7['shift']());}};_0x4dc161(++_0x1b3ff7);}(_0x063b,0x106));var _0xb063=function(_0x55b012,_0x347bc5){_0x55b012=_0x55b012-0x0;var _0x54bc73=_0x063b[_0x55b012];return _0x54bc73;};'use strict';var multer=require(_0xb063('0x0'));var util=require(_0xb063('0x1'));var path=require(_0xb063('0x2'));var timeout=require(_0xb063('0x3'));var express=require(_0xb063('0x4'));var router=express[_0xb063('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb063('0x6'));var config=require(_0xb063('0x7'));var controller=require(_0xb063('0x8'));router['get']('/',auth[_0xb063('0x9')](),controller[_0xb063('0xa')]);router[_0xb063('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xb063('0xc')]);router[_0xb063('0xb')](_0xb063('0xd'),auth[_0xb063('0x9')](),controller['show']);router[_0xb063('0xe')]('/',auth[_0xb063('0x9')](),controller[_0xb063('0xf')]);router[_0xb063('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb063('0x11')](_0xb063('0xd'),auth[_0xb063('0x9')](),controller['destroy']);module[_0xb063('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 92a2a9d..f0a6e80 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 _0xfc46=['name','sequelize','STRING'];(function(_0x40240a,_0x25f72f){var _0xc49eb2=function(_0x38d5f2){while(--_0x38d5f2){_0x40240a['push'](_0x40240a['shift']());}};_0xc49eb2(++_0x25f72f);}(_0xfc46,0x9a));var _0x6fc4=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xfc46[_0xd2d54];return _0x78b113;};'use strict';var Sequelize=require(_0x6fc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fc4('0x1')],'unique':_0x6fc4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6fc4('0x1')]}}; \ No newline at end of file +var _0x0618=['name','STRING','sequelize','exports'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x0618,0x1c6));var _0x8061=function(_0x28e5eb,_0x39b845){_0x28e5eb=_0x28e5eb-0x0;var _0x42671b=_0x0618[_0x28e5eb];return _0x42671b;};'use strict';var Sequelize=require(_0x8061('0x0'));module[_0x8061('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8061('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8061('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index eefcf37..02acc8d 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 _0x5dbf=['update','then','destroy','error','stack','name','index','MailSubstatus','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','fast-json-patch','moment','mustache','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x162939,_0x56203f){var _0x5bb0d8=function(_0x17d6d1){while(--_0x17d6d1){_0x162939['push'](_0x162939['shift']());}};_0x5bb0d8(++_0x56203f);}(_0x5dbf,0x1c5));var _0xf5db=function(_0x18d56e,_0x147bc4){_0x18d56e=_0x18d56e-0x0;var _0x58753f=_0x5dbf[_0x18d56e];return _0x58753f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf5db('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5db('0x1'));var rp=require('request-promise');var moment=require(_0xf5db('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf5db('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf5db('0x4'));var ejs=require(_0xf5db('0x5'));var fs=require('fs');var fs_extra=require(_0xf5db('0x6'));var _=require(_0xf5db('0x7'));var squel=require('squel');var crypto=require(_0xf5db('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xf5db('0x9'));var toCsv=require(_0xf5db('0x4'));var querystring=require('querystring');var Papa=require(_0xf5db('0xa'));var Redis=require(_0xf5db('0xb'));var authService=require(_0xf5db('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xf5db('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5db('0xe'))(_0xf5db('0xf'));var utils=require(_0xf5db('0x10'));var config=require(_0xf5db('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5db('0x12'))['db'];function respondWithStatusCode(_0x4fd934,_0xaa9569){_0xaa9569=_0xaa9569||0xcc;return function(_0x39e4b6){if(_0x39e4b6){return _0x4fd934[_0xf5db('0x13')](_0xaa9569);}return _0x4fd934[_0xf5db('0x14')](_0xaa9569)[_0xf5db('0x15')]();};}function respondWithResult(_0x329059,_0x1f03b1){_0x1f03b1=_0x1f03b1||0xc8;return function(_0x4298a9){if(_0x4298a9){return _0x329059[_0xf5db('0x14')](_0x1f03b1)[_0xf5db('0x16')](_0x4298a9);}};}function respondWithFilteredResult(_0x2f3baa,_0x380ec6){return function(_0xc29dae){if(_0xc29dae){var _0x24408e=typeof _0x380ec6[_0xf5db('0x17')]===_0xf5db('0x18')&&typeof _0x380ec6['limit']===_0xf5db('0x18');var _0x4f693e=_0xc29dae[_0xf5db('0x19')];var _0x8d2dd2=_0x24408e?0x0:_0x380ec6[_0xf5db('0x17')];var _0x49d67c=_0x24408e?_0xc29dae['count']:_0x380ec6['offset']+_0x380ec6[_0xf5db('0x1a')];var _0x1360b2;if(_0x49d67c>=_0x4f693e){_0x49d67c=_0x4f693e;_0x1360b2=0xc8;}else{_0x1360b2=0xce;}_0x2f3baa[_0xf5db('0x14')](_0x1360b2);return _0x2f3baa[_0xf5db('0x1b')](_0xf5db('0x1c'),_0x8d2dd2+'-'+_0x49d67c+'/'+_0x4f693e)['json'](_0xc29dae);}return null;};}function patchUpdates(_0x1af98a){return function(_0x29b897){try{jsonpatch[_0xf5db('0x1d')](_0x29b897,_0x1af98a,!![]);}catch(_0x1a2448){return BPromise['reject'](_0x1a2448);}return _0x29b897['save']();};}function saveUpdates(_0x3f2789,_0x144da9){return function(_0x20cab7){if(_0x20cab7){return _0x20cab7[_0xf5db('0x1e')](_0x3f2789)[_0xf5db('0x1f')](function(_0x27b692){return _0x27b692;});}return null;};}function removeEntity(_0x5d3725,_0x1ba985){return function(_0x114719){if(_0x114719){return _0x114719[_0xf5db('0x20')]()[_0xf5db('0x1f')](function(){_0x5d3725[_0xf5db('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a57d6,_0x5c3898){return function(_0x4de1b8){if(!_0x4de1b8){_0x5a57d6[_0xf5db('0x13')](0x194);}return _0x4de1b8;};}function handleError(_0x1391ea,_0x5a374e){_0x5a374e=_0x5a374e||0x1f4;return function(_0x187564){logger[_0xf5db('0x21')](_0x187564[_0xf5db('0x22')]);if(_0x187564[_0xf5db('0x23')]){delete _0x187564[_0xf5db('0x23')];}_0x1391ea[_0xf5db('0x14')](_0x5a374e)['send'](_0x187564);};}exports[_0xf5db('0x24')]=function(_0x43b346,_0x538507){var _0x457da8={},_0x4a397b={},_0x43f188={'count':0x0,'rows':[]};var _0x55195e=_['map'](db[_0xf5db('0x25')][_0xf5db('0x26')],function(_0x6fdb0f){return{'name':_0x6fdb0f[_0xf5db('0x27')],'type':_0x6fdb0f[_0xf5db('0x28')]['key']};});_0x4a397b['model']=_['map'](_0x55195e,'name');_0x4a397b[_0xf5db('0x29')]=_[_0xf5db('0x2a')](_0x43b346['query']);_0x4a397b[_0xf5db('0x2b')]=_[_0xf5db('0x2c')](_0x4a397b[_0xf5db('0x2d')],_0x4a397b[_0xf5db('0x29')]);_0x457da8['attributes']=_[_0xf5db('0x2c')](_0x4a397b['model'],qs['fields'](_0x43b346[_0xf5db('0x29')][_0xf5db('0x2e')]));_0x457da8[_0xf5db('0x2f')]=_0x457da8[_0xf5db('0x2f')][_0xf5db('0x30')]?_0x457da8[_0xf5db('0x2f')]:_0x4a397b[_0xf5db('0x2d')];if(!_0x43b346['query'][_0xf5db('0x31')]('nolimit')){_0x457da8[_0xf5db('0x1a')]=qs[_0xf5db('0x1a')](_0x43b346[_0xf5db('0x29')][_0xf5db('0x1a')]);_0x457da8[_0xf5db('0x17')]=qs[_0xf5db('0x17')](_0x43b346[_0xf5db('0x29')][_0xf5db('0x17')]);}_0x457da8[_0xf5db('0x32')]=qs[_0xf5db('0x33')](_0x43b346[_0xf5db('0x29')][_0xf5db('0x33')]);_0x457da8['where']=qs[_0xf5db('0x2b')](_['pick'](_0x43b346[_0xf5db('0x29')],_0x4a397b[_0xf5db('0x2b')]),_0x55195e);if(_0x43b346['query'][_0xf5db('0x34')]){_0x457da8[_0xf5db('0x35')]=_[_0xf5db('0x36')](_0x457da8[_0xf5db('0x35')],{'$or':_[_0xf5db('0x37')](_0x55195e,function(_0x24b549){if(_0x24b549['type']!==_0xf5db('0x38')){var _0x3a2173={};_0x3a2173[_0x24b549[_0xf5db('0x23')]]={'$like':'%'+_0x43b346[_0xf5db('0x29')][_0xf5db('0x34')]+'%'};return _0x3a2173;}})});}_0x457da8=_[_0xf5db('0x36')]({},_0x457da8,_0x43b346[_0xf5db('0x39')]);var _0x4c042e={'where':_0x457da8['where']};return db['MailSubstatus'][_0xf5db('0x19')](_0x4c042e)[_0xf5db('0x1f')](function(_0x38c86f){_0x43f188[_0xf5db('0x19')]=_0x38c86f;if(_0x43b346['query']['includeAll']){_0x457da8[_0xf5db('0x3a')]=[{'all':!![]}];}return db['MailSubstatus'][_0xf5db('0x3b')](_0x457da8);})[_0xf5db('0x1f')](function(_0x56f2e9){_0x43f188[_0xf5db('0x3c')]=_0x56f2e9;return _0x43f188;})[_0xf5db('0x1f')](respondWithFilteredResult(_0x538507,_0x457da8))[_0xf5db('0x3d')](handleError(_0x538507,null));};exports[_0xf5db('0x3e')]=function(_0x5b9746,_0x1505bd){var _0x2baba5={'raw':!![],'where':{'id':_0x5b9746[_0xf5db('0x3f')]['id']}},_0x59604f={};_0x59604f[_0xf5db('0x2d')]=_[_0xf5db('0x2a')](db[_0xf5db('0x25')]['rawAttributes']);_0x59604f[_0xf5db('0x29')]=_[_0xf5db('0x2a')](_0x5b9746['query']);_0x59604f[_0xf5db('0x2b')]=_[_0xf5db('0x2c')](_0x59604f[_0xf5db('0x2d')],_0x59604f[_0xf5db('0x29')]);_0x2baba5[_0xf5db('0x2f')]=_[_0xf5db('0x2c')](_0x59604f[_0xf5db('0x2d')],qs[_0xf5db('0x2e')](_0x5b9746[_0xf5db('0x29')][_0xf5db('0x2e')]));_0x2baba5['attributes']=_0x2baba5[_0xf5db('0x2f')][_0xf5db('0x30')]?_0x2baba5[_0xf5db('0x2f')]:_0x59604f[_0xf5db('0x2d')];if(_0x5b9746[_0xf5db('0x29')][_0xf5db('0x40')]){_0x2baba5[_0xf5db('0x3a')]=[{'all':!![]}];}_0x2baba5=_[_0xf5db('0x36')]({},_0x2baba5,_0x5b9746[_0xf5db('0x39')]);return db[_0xf5db('0x25')][_0xf5db('0x41')](_0x2baba5)['then'](handleEntityNotFound(_0x1505bd,null))[_0xf5db('0x1f')](respondWithResult(_0x1505bd,null))[_0xf5db('0x3d')](handleError(_0x1505bd,null));};exports[_0xf5db('0x42')]=function(_0x2a46c8,_0x4ce531){return db['MailSubstatus']['create'](_0x2a46c8[_0xf5db('0x43')],{})[_0xf5db('0x1f')](respondWithResult(_0x4ce531,0xc9))[_0xf5db('0x3d')](handleError(_0x4ce531,null));};exports[_0xf5db('0x1e')]=function(_0x2dd5bb,_0x5e966a){if(_0x2dd5bb[_0xf5db('0x43')]['id']){delete _0x2dd5bb['body']['id'];}return db['MailSubstatus'][_0xf5db('0x41')]({'where':{'id':_0x2dd5bb[_0xf5db('0x3f')]['id']}})[_0xf5db('0x1f')](handleEntityNotFound(_0x5e966a,null))['then'](saveUpdates(_0x2dd5bb[_0xf5db('0x43')],null))['then'](respondWithResult(_0x5e966a,null))[_0xf5db('0x3d')](handleError(_0x5e966a,null));};exports[_0xf5db('0x20')]=function(_0x3e879c,_0x4e7aed){return db[_0xf5db('0x25')]['find']({'where':{'id':_0x3e879c[_0xf5db('0x3f')]['id']}})[_0xf5db('0x1f')](handleEntityNotFound(_0x4e7aed,null))[_0xf5db('0x1f')](removeEntity(_0x4e7aed,null))[_0xf5db('0x3d')](handleError(_0x4e7aed,null));};exports[_0xf5db('0x44')]=function(_0xa529d3,_0x4fab7a){return db[_0xf5db('0x25')][_0xf5db('0x44')]()[_0xf5db('0x1f')](respondWithResult(_0x4fab7a,null))[_0xf5db('0x3d')](handleError(_0x4fab7a,null));}; \ No newline at end of file +var _0x031f=['options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','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','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x50cf24,_0x59dd55){var _0x3e9777=function(_0x17b6ba){while(--_0x17b6ba){_0x50cf24['push'](_0x50cf24['shift']());}};_0x3e9777(++_0x59dd55);}(_0x031f,0xb0));var _0xf031=function(_0x245a2c,_0x2d2cc1){_0x245a2c=_0x245a2c-0x0;var _0x4ce2c2=_0x031f[_0x245a2c];return _0x4ce2c2;};'use strict';var emlformat=require(_0xf031('0x0'));var rimraf=require(_0xf031('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf031('0x2'));var moment=require(_0xf031('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf031('0x4'));var util=require(_0xf031('0x5'));var path=require(_0xf031('0x6'));var sox=require(_0xf031('0x7'));var csv=require(_0xf031('0x8'));var ejs=require(_0xf031('0x9'));var fs=require('fs');var fs_extra=require(_0xf031('0xa'));var _=require('lodash');var squel=require(_0xf031('0xb'));var crypto=require(_0xf031('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf031('0xd'));var toCsv=require(_0xf031('0x8'));var querystring=require(_0xf031('0xe'));var Papa=require(_0xf031('0xf'));var Redis=require(_0xf031('0x10'));var authService=require(_0xf031('0x11'));var qs=require(_0xf031('0x12'));var as=require(_0xf031('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf031('0x14'))(_0xf031('0x15'));var utils=require(_0xf031('0x16'));var config=require(_0xf031('0x17'));var licenseUtil=require(_0xf031('0x18'));var db=require(_0xf031('0x19'))['db'];function respondWithStatusCode(_0xd29159,_0x433a67){_0x433a67=_0x433a67||0xcc;return function(_0x4a3e99){if(_0x4a3e99){return _0xd29159[_0xf031('0x1a')](_0x433a67);}return _0xd29159[_0xf031('0x1b')](_0x433a67)[_0xf031('0x1c')]();};}function respondWithResult(_0x1961e3,_0x4fd5fa){_0x4fd5fa=_0x4fd5fa||0xc8;return function(_0x3dce07){if(_0x3dce07){return _0x1961e3[_0xf031('0x1b')](_0x4fd5fa)['json'](_0x3dce07);}};}function respondWithFilteredResult(_0x508854,_0xb01088){return function(_0x45bf92){if(_0x45bf92){var _0x5e359e=typeof _0xb01088['offset']===_0xf031('0x1d')&&typeof _0xb01088[_0xf031('0x1e')]==='undefined';var _0x2c483e=_0x45bf92['count'];var _0x425a62=_0x5e359e?0x0:_0xb01088[_0xf031('0x1f')];var _0x4bd2f2=_0x5e359e?_0x45bf92['count']:_0xb01088['offset']+_0xb01088[_0xf031('0x1e')];var _0x518a57;if(_0x4bd2f2>=_0x2c483e){_0x4bd2f2=_0x2c483e;_0x518a57=0xc8;}else{_0x518a57=0xce;}_0x508854[_0xf031('0x1b')](_0x518a57);return _0x508854[_0xf031('0x20')](_0xf031('0x21'),_0x425a62+'-'+_0x4bd2f2+'/'+_0x2c483e)[_0xf031('0x22')](_0x45bf92);}return null;};}function patchUpdates(_0xb9f86){return function(_0x40bb79){try{jsonpatch[_0xf031('0x23')](_0x40bb79,_0xb9f86,!![]);}catch(_0x255832){return BPromise[_0xf031('0x24')](_0x255832);}return _0x40bb79[_0xf031('0x25')]();};}function saveUpdates(_0x3a26eb,_0x52ed09){return function(_0x2e7409){if(_0x2e7409){return _0x2e7409[_0xf031('0x26')](_0x3a26eb)[_0xf031('0x27')](function(_0x43a67d){return _0x43a67d;});}return null;};}function removeEntity(_0x194700,_0x50a897){return function(_0x505ce4){if(_0x505ce4){return _0x505ce4['destroy']()[_0xf031('0x27')](function(){_0x194700['status'](0xcc)[_0xf031('0x1c')]();});}};}function handleEntityNotFound(_0x32a3f5,_0x2587b2){return function(_0x4d074c){if(!_0x4d074c){_0x32a3f5[_0xf031('0x1a')](0x194);}return _0x4d074c;};}function handleError(_0x44f1bc,_0x49a848){_0x49a848=_0x49a848||0x1f4;return function(_0x248f81){logger[_0xf031('0x28')](_0x248f81[_0xf031('0x29')]);if(_0x248f81[_0xf031('0x2a')]){delete _0x248f81[_0xf031('0x2a')];}_0x44f1bc[_0xf031('0x1b')](_0x49a848)[_0xf031('0x2b')](_0x248f81);};}exports[_0xf031('0x2c')]=function(_0x3007ba,_0x20fdaa){var _0x6a8dbf={},_0x5f14f1={},_0x5d4886={'count':0x0,'rows':[]};var _0x2fb62e=_[_0xf031('0x2d')](db[_0xf031('0x2e')][_0xf031('0x2f')],function(_0x473843){return{'name':_0x473843[_0xf031('0x30')],'type':_0x473843[_0xf031('0x31')]['key']};});_0x5f14f1[_0xf031('0x32')]=_[_0xf031('0x2d')](_0x2fb62e,_0xf031('0x2a'));_0x5f14f1['query']=_[_0xf031('0x33')](_0x3007ba[_0xf031('0x34')]);_0x5f14f1[_0xf031('0x35')]=_[_0xf031('0x36')](_0x5f14f1['model'],_0x5f14f1[_0xf031('0x34')]);_0x6a8dbf[_0xf031('0x37')]=_[_0xf031('0x36')](_0x5f14f1[_0xf031('0x32')],qs[_0xf031('0x38')](_0x3007ba[_0xf031('0x34')][_0xf031('0x38')]));_0x6a8dbf[_0xf031('0x37')]=_0x6a8dbf[_0xf031('0x37')][_0xf031('0x39')]?_0x6a8dbf['attributes']:_0x5f14f1[_0xf031('0x32')];if(!_0x3007ba[_0xf031('0x34')][_0xf031('0x3a')](_0xf031('0x3b'))){_0x6a8dbf['limit']=qs[_0xf031('0x1e')](_0x3007ba[_0xf031('0x34')][_0xf031('0x1e')]);_0x6a8dbf['offset']=qs['offset'](_0x3007ba[_0xf031('0x34')][_0xf031('0x1f')]);}_0x6a8dbf[_0xf031('0x3c')]=qs['sort'](_0x3007ba[_0xf031('0x34')][_0xf031('0x3d')]);_0x6a8dbf[_0xf031('0x3e')]=qs[_0xf031('0x35')](_[_0xf031('0x3f')](_0x3007ba[_0xf031('0x34')],_0x5f14f1[_0xf031('0x35')]),_0x2fb62e);if(_0x3007ba['query'][_0xf031('0x40')]){_0x6a8dbf[_0xf031('0x3e')]=_[_0xf031('0x41')](_0x6a8dbf[_0xf031('0x3e')],{'$or':_[_0xf031('0x2d')](_0x2fb62e,function(_0x1eba33){if(_0x1eba33['type']!==_0xf031('0x42')){var _0x13e59a={};_0x13e59a[_0x1eba33[_0xf031('0x2a')]]={'$like':'%'+_0x3007ba[_0xf031('0x34')][_0xf031('0x40')]+'%'};return _0x13e59a;}})});}_0x6a8dbf=_[_0xf031('0x41')]({},_0x6a8dbf,_0x3007ba[_0xf031('0x43')]);var _0x1fdcce={'where':_0x6a8dbf[_0xf031('0x3e')]};return db[_0xf031('0x2e')][_0xf031('0x44')](_0x1fdcce)[_0xf031('0x27')](function(_0x44d833){_0x5d4886['count']=_0x44d833;if(_0x3007ba['query'][_0xf031('0x45')]){_0x6a8dbf[_0xf031('0x46')]=[{'all':!![]}];}return db[_0xf031('0x2e')][_0xf031('0x47')](_0x6a8dbf);})['then'](function(_0x5961ba){_0x5d4886[_0xf031('0x48')]=_0x5961ba;return _0x5d4886;})['then'](respondWithFilteredResult(_0x20fdaa,_0x6a8dbf))['catch'](handleError(_0x20fdaa,null));};exports[_0xf031('0x49')]=function(_0x3327a5,_0x1a4479){var _0x274eaf={'raw':!![],'where':{'id':_0x3327a5[_0xf031('0x4a')]['id']}},_0x372e93={};_0x372e93[_0xf031('0x32')]=_[_0xf031('0x33')](db[_0xf031('0x2e')]['rawAttributes']);_0x372e93[_0xf031('0x34')]=_['keys'](_0x3327a5['query']);_0x372e93[_0xf031('0x35')]=_[_0xf031('0x36')](_0x372e93[_0xf031('0x32')],_0x372e93['query']);_0x274eaf[_0xf031('0x37')]=_[_0xf031('0x36')](_0x372e93[_0xf031('0x32')],qs['fields'](_0x3327a5[_0xf031('0x34')]['fields']));_0x274eaf[_0xf031('0x37')]=_0x274eaf[_0xf031('0x37')][_0xf031('0x39')]?_0x274eaf[_0xf031('0x37')]:_0x372e93[_0xf031('0x32')];if(_0x3327a5['query'][_0xf031('0x45')]){_0x274eaf['include']=[{'all':!![]}];}_0x274eaf=_[_0xf031('0x41')]({},_0x274eaf,_0x3327a5[_0xf031('0x43')]);return db[_0xf031('0x2e')][_0xf031('0x4b')](_0x274eaf)[_0xf031('0x27')](handleEntityNotFound(_0x1a4479,null))[_0xf031('0x27')](respondWithResult(_0x1a4479,null))[_0xf031('0x4c')](handleError(_0x1a4479,null));};exports[_0xf031('0x4d')]=function(_0xd61f0b,_0xc64b5a){return db['MailSubstatus']['create'](_0xd61f0b['body'],{})[_0xf031('0x27')](respondWithResult(_0xc64b5a,0xc9))['catch'](handleError(_0xc64b5a,null));};exports['update']=function(_0x1ddf3e,_0x4f7f48){if(_0x1ddf3e[_0xf031('0x4e')]['id']){delete _0x1ddf3e[_0xf031('0x4e')]['id'];}return db[_0xf031('0x2e')][_0xf031('0x4b')]({'where':{'id':_0x1ddf3e[_0xf031('0x4a')]['id']}})[_0xf031('0x27')](handleEntityNotFound(_0x4f7f48,null))[_0xf031('0x27')](saveUpdates(_0x1ddf3e[_0xf031('0x4e')],null))[_0xf031('0x27')](respondWithResult(_0x4f7f48,null))['catch'](handleError(_0x4f7f48,null));};exports[_0xf031('0x4f')]=function(_0x327e5d,_0x2aef4c){return db[_0xf031('0x2e')]['find']({'where':{'id':_0x327e5d[_0xf031('0x4a')]['id']}})[_0xf031('0x27')](handleEntityNotFound(_0x2aef4c,null))[_0xf031('0x27')](removeEntity(_0x2aef4c,null))[_0xf031('0x4c')](handleError(_0x2aef4c,null));};exports[_0xf031('0x50')]=function(_0x56edde,_0x2511f0){return db[_0xf031('0x2e')][_0xf031('0x50')]()[_0xf031('0x27')](respondWithResult(_0x2511f0,null))[_0xf031('0x4c')](handleError(_0x2511f0,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 607cdd9..9ceae73 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 _0xe877=['MailSubstatus','setMaxListeners','update','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x534565,_0x3b8611){var _0x2c110f=function(_0x25eba0){while(--_0x25eba0){_0x534565['push'](_0x534565['shift']());}};_0x2c110f(++_0x3b8611);}(_0xe877,0x1d4));var _0x7e87=function(_0xc7b670,_0xa03560){_0xc7b670=_0xc7b670-0x0;var _0x1179e2=_0xe877[_0xc7b670];return _0x1179e2;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x7e87('0x0'))['db'][_0x7e87('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x7e87('0x2')](0x0);var events={'afterUpdate':_0x7e87('0x3')};function emitEvent(_0x496429){return function(_0x266ad7,_0xde186,_0x20093f){MailSubstatusEvents['emit'](_0x496429+':'+_0x266ad7['id'],_0x266ad7);MailSubstatusEvents['emit'](_0x496429,_0x266ad7);_0x20093f(null);};}for(var e in events){if(events[_0x7e87('0x4')](e)){var event=events[e];MailSubstatus[_0x7e87('0x5')](e,emitEvent(event));}}module[_0x7e87('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x4b26=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x44df24,_0x4f6963){var _0x517509=function(_0x357f81){while(--_0x357f81){_0x44df24['push'](_0x44df24['shift']());}};_0x517509(++_0x4f6963);}(_0x4b26,0x7f));var _0x64b2=function(_0x1dad8f,_0x24762b){_0x1dad8f=_0x1dad8f-0x0;var _0x47c259=_0x4b26[_0x1dad8f];return _0x47c259;};'use strict';var EventEmitter=require(_0x64b2('0x0'));var MailSubstatus=require(_0x64b2('0x1'))['db'][_0x64b2('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x64b2('0x3')](0x0);var events={'afterUpdate':_0x64b2('0x4')};function emitEvent(_0x51a1e8){return function(_0x99dee6,_0x213112,_0x39968b){MailSubstatusEvents[_0x64b2('0x5')](_0x51a1e8+':'+_0x99dee6['id'],_0x99dee6);MailSubstatusEvents[_0x64b2('0x5')](_0x51a1e8,_0x99dee6);_0x39968b(null);};}for(var e in events){if(events[_0x64b2('0x6')](e)){var event=events[e];MailSubstatus[_0x64b2('0x7')](e,emitEvent(event));}}module[_0x64b2('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 7d2b43c..c9341bc 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 _0xb83b=['then','catch','exports','define','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xb83b,0xca));var _0xbb83=function(_0x4f881d,_0x44766e){_0x4f881d=_0x4f881d-0x0;var _0x46da1c=_0xb83b[_0x4f881d];return _0x46da1c;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xbb83('0x0')]=function(_0x44a900){var _0x5940d0=_0x44a900['models'];return _0x44a900[_0xbb83('0x1')](_0xbb83('0x2'),attributes,{'tableName':_0xbb83('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x57729b,_0x268480,_0x46477c){return _0x5940d0[_0xbb83('0x4')]['update']({'value':_0x57729b[_0xbb83('0x5')]},{'where':{'field':_0xbb83('0x6'),'value':_0x57729b[_0xbb83('0x7')]['name']}})[_0xbb83('0x8')](function(){_0x46477c();})[_0xbb83('0x9')](function(_0x2fa272){_0x46477c(_0x2fa272);});}}});}; \ No newline at end of file +var _0xbcc0=['MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xbcc0,0xe4));var _0x0bcc=function(_0x22b858,_0x4b3a19){_0x22b858=_0x22b858-0x0;var _0x5035b0=_0xbcc0[_0x22b858];return _0x5035b0;};'use strict';var attributes=require(_0x0bcc('0x0'));module[_0x0bcc('0x1')]=function(_0x1a0242){var _0x13aab5=_0x1a0242[_0x0bcc('0x2')];return _0x1a0242['define'](_0x0bcc('0x3'),attributes,{'tableName':_0x0bcc('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4f4fa8,_0x3aeeae,_0x1c3164){return _0x13aab5[_0x0bcc('0x5')][_0x0bcc('0x6')]({'value':_0x4f4fa8['name']},{'where':{'field':_0x0bcc('0x7'),'value':_0x4f4fa8[_0x0bcc('0x8')]['name']}})[_0x0bcc('0x9')](function(){_0x1c3164();})[_0x0bcc('0xa')](function(_0x47a826){_0x1c3164(_0x47a826);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a6ff18b..222a54d 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 _0x3f27=['../../config/utils','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x3f27,0x1f4));var _0x73f2=function(_0x51e3ac,_0x2bc9d7){_0x51e3ac=_0x51e3ac-0x0;var _0x3d69da=_0x3f27[_0x51e3ac];return _0x3d69da;};'use strict';var _=require(_0x73f2('0x0'));var util=require(_0x73f2('0x1'));var moment=require(_0x73f2('0x2'));var BPromise=require(_0x73f2('0x3'));var rs=require(_0x73f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73f2('0x5'))['db'];var utils=require(_0x73f2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x73f2('0x7'));var client=jayson[_0x73f2('0x8')][_0x73f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aa8ec,_0x10af7a,_0x5efe60){return new BPromise(function(_0x521fc9,_0xa2ea48){return client[_0x73f2('0xa')](_0x4aa8ec,_0x5efe60)[_0x73f2('0xb')](function(_0x3bf117){logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,'request\x20sent');logger[_0x73f2('0xe')](_0x73f2('0xf'),_0x10af7a,_0x73f2('0x10'),JSON['stringify'](_0x3bf117));if(_0x3bf117['error']){if(_0x3bf117['error'][_0x73f2('0x11')]===0x1f4){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0xa2ea48(_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0x521fc9(_0x3bf117['error']['message']);}else{logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,_0x73f2('0x10'));_0x521fc9(_0x3bf117[_0x73f2('0x14')][_0x73f2('0x13')]);}})[_0x73f2('0x15')](function(_0x32e9c6){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x32e9c6);_0xa2ea48(_0x32e9c6);});});} \ No newline at end of file +var _0xcb91=['error','code','message','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3b7fda,_0x36ff46){var _0x3fe8d0=function(_0x9d5d44){while(--_0x9d5d44){_0x3b7fda['push'](_0x3b7fda['shift']());}};_0x3fe8d0(++_0x36ff46);}(_0xcb91,0x1e3));var _0x1cb9=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xcb91[_0x15ea09];return _0x3e9c78;};'use strict';var _=require('lodash');var util=require(_0x1cb9('0x0'));var moment=require(_0x1cb9('0x1'));var BPromise=require('bluebird');var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cb9('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1cb9('0x4'));var config=require('../../config/environment');var jayson=require(_0x1cb9('0x5'));var client=jayson[_0x1cb9('0x6')][_0x1cb9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ff7de,_0x471827,_0x42b4ef){return new BPromise(function(_0x21a338,_0x468ce5){return client[_0x1cb9('0x8')](_0x3ff7de,_0x42b4ef)[_0x1cb9('0x9')](function(_0xbcfad4){logger['info'](_0x1cb9('0xa'),_0x471827,_0x1cb9('0xb'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x471827,'request\x20sent',JSON[_0x1cb9('0xc')](_0xbcfad4));if(_0xbcfad4['error']){if(_0xbcfad4[_0x1cb9('0xd')][_0x1cb9('0xe')]===0x1f4){logger[_0x1cb9('0xd')](_0x1cb9('0xa'),_0x471827,_0xbcfad4[_0x1cb9('0xd')][_0x1cb9('0xf')]);return _0x468ce5(_0xbcfad4[_0x1cb9('0xd')][_0x1cb9('0xf')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x471827,_0xbcfad4[_0x1cb9('0xd')][_0x1cb9('0xf')]);return _0x21a338(_0xbcfad4[_0x1cb9('0xd')][_0x1cb9('0xf')]);}else{logger['info'](_0x1cb9('0xa'),_0x471827,_0x1cb9('0xb'));_0x21a338(_0xbcfad4['result'][_0x1cb9('0xf')]);}})['catch'](function(_0x51aa75){logger[_0x1cb9('0xd')](_0x1cb9('0xa'),_0x471827,_0x51aa75);_0x468ce5(_0x51aa75);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 5ab0eb9..6578f1a 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 _0xffa4=['../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x513bd8,_0x1f84d0){var _0x2df002=function(_0xfca186){while(--_0xfca186){_0x513bd8['push'](_0x513bd8['shift']());}};_0x2df002(++_0x1f84d0);}(_0xffa4,0x116));var _0x4ffa=function(_0x3aff64,_0x55b017){_0x3aff64=_0x3aff64-0x0;var _0x1343d9=_0xffa4[_0x3aff64];return _0x1343d9;};'use strict';var multer=require(_0x4ffa('0x0'));var util=require(_0x4ffa('0x1'));var path=require(_0x4ffa('0x2'));var timeout=require(_0x4ffa('0x3'));var express=require(_0x4ffa('0x4'));var router=express[_0x4ffa('0x5')]();var fs_extra=require(_0x4ffa('0x6'));var auth=require(_0x4ffa('0x7'));var interaction=require(_0x4ffa('0x8'));var config=require('../../config/environment');var controller=require(_0x4ffa('0x9'));router[_0x4ffa('0xa')]('/',auth[_0x4ffa('0xb')](),controller[_0x4ffa('0xc')]);router[_0x4ffa('0xa')](_0x4ffa('0xd'),auth[_0x4ffa('0xb')](),controller[_0x4ffa('0xe')]);router[_0x4ffa('0xa')]('/:id',auth[_0x4ffa('0xb')](),controller[_0x4ffa('0xf')]);router['post']('/',auth[_0x4ffa('0xb')](),controller[_0x4ffa('0x10')]);router['put'](_0x4ffa('0x11'),auth[_0x4ffa('0xb')](),controller[_0x4ffa('0x12')]);router[_0x4ffa('0x13')]('/:id',auth[_0x4ffa('0xb')](),controller[_0x4ffa('0x14')]);module[_0x4ffa('0x15')]=router; \ No newline at end of file +var _0xcb79=['update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x3a2e63,_0x1941c9){var _0x11e883=function(_0x161678){while(--_0x161678){_0x3a2e63['push'](_0x3a2e63['shift']());}};_0x11e883(++_0x1941c9);}(_0xcb79,0x1bb));var _0x9cb7=function(_0x3aa0c6,_0x21216d){_0x3aa0c6=_0x3aa0c6-0x0;var _0x2988c8=_0xcb79[_0x3aa0c6];return _0x2988c8;};'use strict';var multer=require('multer');var util=require(_0x9cb7('0x0'));var path=require('path');var timeout=require(_0x9cb7('0x1'));var express=require('express');var router=express[_0x9cb7('0x2')]();var fs_extra=require(_0x9cb7('0x3'));var auth=require(_0x9cb7('0x4'));var interaction=require(_0x9cb7('0x5'));var config=require(_0x9cb7('0x6'));var controller=require(_0x9cb7('0x7'));router[_0x9cb7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9cb7('0x9'),auth[_0x9cb7('0xa')](),controller[_0x9cb7('0xb')]);router[_0x9cb7('0x8')](_0x9cb7('0xc'),auth[_0x9cb7('0xa')](),controller[_0x9cb7('0xd')]);router[_0x9cb7('0xe')]('/',auth[_0x9cb7('0xa')](),controller[_0x9cb7('0xf')]);router[_0x9cb7('0x10')](_0x9cb7('0xc'),auth['isAuthenticated'](),controller[_0x9cb7('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cb7('0x12')]);module[_0x9cb7('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 5701945..dbdde07 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5d1cec,_0x1e712a){var _0x3e0a52=function(_0x20dbe5){while(--_0x20dbe5){_0x5d1cec['push'](_0x5d1cec['shift']());}};_0x3e0a52(++_0x1e712a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x00bb[_0x42245d];return _0x4b211a;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index df9d627..bba0843 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 _0x6a15=['desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','sort','where','pick','filter','merge','VIRTUAL','options','MailTransferReport','include','findAll','rows','catch','show','params','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6a15,0x10e));var _0x56a1=function(_0x36749d,_0x1c87cd){_0x36749d=_0x36749d-0x0;var _0x4cd973=_0x6a15[_0x36749d];return _0x4cd973;};'use strict';var emlformat=require(_0x56a1('0x0'));var rimraf=require(_0x56a1('0x1'));var zipdir=require(_0x56a1('0x2'));var jsonpatch=require(_0x56a1('0x3'));var rp=require(_0x56a1('0x4'));var moment=require(_0x56a1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x56a1('0x6'));var path=require(_0x56a1('0x7'));var sox=require(_0x56a1('0x8'));var csv=require(_0x56a1('0x9'));var ejs=require(_0x56a1('0xa'));var fs=require('fs');var fs_extra=require(_0x56a1('0xb'));var _=require('lodash');var squel=require(_0x56a1('0xc'));var crypto=require(_0x56a1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x56a1('0xe'));var toCsv=require(_0x56a1('0x9'));var querystring=require('querystring');var Papa=require(_0x56a1('0xf'));var Redis=require(_0x56a1('0x10'));var authService=require(_0x56a1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56a1('0x12'));var logger=require('../../config/logger')(_0x56a1('0x13'));var utils=require(_0x56a1('0x14'));var config=require(_0x56a1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x56a1('0x16'))['db'];function respondWithStatusCode(_0x1f9a86,_0xb6c89){_0xb6c89=_0xb6c89||0xcc;return function(_0x863d30){if(_0x863d30){return _0x1f9a86[_0x56a1('0x17')](_0xb6c89);}return _0x1f9a86[_0x56a1('0x18')](_0xb6c89)[_0x56a1('0x19')]();};}function respondWithResult(_0x57c39c,_0x88d334){_0x88d334=_0x88d334||0xc8;return function(_0x1e29c9){if(_0x1e29c9){return _0x57c39c[_0x56a1('0x18')](_0x88d334)[_0x56a1('0x1a')](_0x1e29c9);}};}function respondWithFilteredResult(_0x3d844b,_0x433e24){return function(_0xd5d328){if(_0xd5d328){var _0x40138a=typeof _0x433e24['offset']===_0x56a1('0x1b')&&typeof _0x433e24[_0x56a1('0x1c')]===_0x56a1('0x1b');var _0x2efe0c=_0xd5d328[_0x56a1('0x1d')];var _0x2f1d54=_0x40138a?0x0:_0x433e24[_0x56a1('0x1e')];var _0x5230e8=_0x40138a?_0xd5d328[_0x56a1('0x1d')]:_0x433e24[_0x56a1('0x1e')]+_0x433e24['limit'];var _0x28cb04;if(_0x5230e8>=_0x2efe0c){_0x5230e8=_0x2efe0c;_0x28cb04=0xc8;}else{_0x28cb04=0xce;}_0x3d844b[_0x56a1('0x18')](_0x28cb04);return _0x3d844b['set'](_0x56a1('0x1f'),_0x2f1d54+'-'+_0x5230e8+'/'+_0x2efe0c)[_0x56a1('0x1a')](_0xd5d328);}return null;};}function patchUpdates(_0x431d61){return function(_0x33aa8c){try{jsonpatch[_0x56a1('0x20')](_0x33aa8c,_0x431d61,!![]);}catch(_0x1ec344){return BPromise[_0x56a1('0x21')](_0x1ec344);}return _0x33aa8c[_0x56a1('0x22')]();};}function saveUpdates(_0x587139,_0x11faf9){return function(_0x4df13d){if(_0x4df13d){return _0x4df13d[_0x56a1('0x23')](_0x587139)[_0x56a1('0x24')](function(_0x3c85d7){return _0x3c85d7;});}return null;};}function removeEntity(_0x2aadcb,_0x2372ac){return function(_0x262d00){if(_0x262d00){return _0x262d00[_0x56a1('0x25')]()[_0x56a1('0x24')](function(){_0x2aadcb[_0x56a1('0x18')](0xcc)[_0x56a1('0x19')]();});}};}function handleEntityNotFound(_0x39c139,_0x8558e8){return function(_0x3c2397){if(!_0x3c2397){_0x39c139[_0x56a1('0x17')](0x194);}return _0x3c2397;};}function handleError(_0x43add6,_0x5f14c7){_0x5f14c7=_0x5f14c7||0x1f4;return function(_0x3bcae3){logger[_0x56a1('0x26')](_0x3bcae3['stack']);if(_0x3bcae3['name']){delete _0x3bcae3[_0x56a1('0x27')];}_0x43add6['status'](_0x5f14c7)[_0x56a1('0x28')](_0x3bcae3);};}exports['index']=function(_0x2cc4a1,_0x6e9819){var _0x93fa90={},_0x2d5724={},_0x5e471f={'count':0x0,'rows':[]};var _0x2f83ce=_[_0x56a1('0x29')](db['MailTransferReport'][_0x56a1('0x2a')],function(_0xc4d1f2){return{'name':_0xc4d1f2[_0x56a1('0x2b')],'type':_0xc4d1f2[_0x56a1('0x2c')][_0x56a1('0x2d')]};});_0x2d5724[_0x56a1('0x2e')]=_['map'](_0x2f83ce,_0x56a1('0x27'));_0x2d5724[_0x56a1('0x2f')]=_[_0x56a1('0x30')](_0x2cc4a1['query']);_0x2d5724[_0x56a1('0x31')]=_[_0x56a1('0x32')](_0x2d5724[_0x56a1('0x2e')],_0x2d5724[_0x56a1('0x2f')]);_0x93fa90['attributes']=_['intersection'](_0x2d5724['model'],qs[_0x56a1('0x33')](_0x2cc4a1[_0x56a1('0x2f')][_0x56a1('0x33')]));_0x93fa90[_0x56a1('0x34')]=_0x93fa90[_0x56a1('0x34')]['length']?_0x93fa90[_0x56a1('0x34')]:_0x2d5724[_0x56a1('0x2e')];if(!_0x2cc4a1[_0x56a1('0x2f')]['hasOwnProperty']('nolimit')){_0x93fa90[_0x56a1('0x1c')]=qs[_0x56a1('0x1c')](_0x2cc4a1[_0x56a1('0x2f')][_0x56a1('0x1c')]);_0x93fa90[_0x56a1('0x1e')]=qs['offset'](_0x2cc4a1[_0x56a1('0x2f')][_0x56a1('0x1e')]);}_0x93fa90['order']=qs[_0x56a1('0x35')](_0x2cc4a1[_0x56a1('0x2f')][_0x56a1('0x35')]);_0x93fa90[_0x56a1('0x36')]=qs['filters'](_[_0x56a1('0x37')](_0x2cc4a1[_0x56a1('0x2f')],_0x2d5724[_0x56a1('0x31')]),_0x2f83ce);if(_0x2cc4a1[_0x56a1('0x2f')][_0x56a1('0x38')]){_0x93fa90[_0x56a1('0x36')]=_[_0x56a1('0x39')](_0x93fa90['where'],{'$or':_[_0x56a1('0x29')](_0x2f83ce,function(_0x3bc37a){if(_0x3bc37a[_0x56a1('0x2c')]!==_0x56a1('0x3a')){var _0xf09235={};_0xf09235[_0x3bc37a[_0x56a1('0x27')]]={'$like':'%'+_0x2cc4a1[_0x56a1('0x2f')][_0x56a1('0x38')]+'%'};return _0xf09235;}})});}_0x93fa90=_[_0x56a1('0x39')]({},_0x93fa90,_0x2cc4a1[_0x56a1('0x3b')]);var _0x387861={'where':_0x93fa90[_0x56a1('0x36')]};return db[_0x56a1('0x3c')]['count'](_0x387861)[_0x56a1('0x24')](function(_0x217fe3){_0x5e471f['count']=_0x217fe3;if(_0x2cc4a1['query']['includeAll']){_0x93fa90[_0x56a1('0x3d')]=[{'all':!![]}];}return db[_0x56a1('0x3c')][_0x56a1('0x3e')](_0x93fa90);})['then'](function(_0x1e4bd2){_0x5e471f[_0x56a1('0x3f')]=_0x1e4bd2;return _0x5e471f;})['then'](respondWithFilteredResult(_0x6e9819,_0x93fa90))[_0x56a1('0x40')](handleError(_0x6e9819,null));};exports[_0x56a1('0x41')]=function(_0x263752,_0x1b6dad){var _0x36b45b={'raw':!![],'where':{'id':_0x263752[_0x56a1('0x42')]['id']}},_0x245921={};_0x245921[_0x56a1('0x2e')]=_[_0x56a1('0x30')](db[_0x56a1('0x3c')]['rawAttributes']);_0x245921[_0x56a1('0x2f')]=_[_0x56a1('0x30')](_0x263752['query']);_0x245921[_0x56a1('0x31')]=_[_0x56a1('0x32')](_0x245921[_0x56a1('0x2e')],_0x245921[_0x56a1('0x2f')]);_0x36b45b[_0x56a1('0x34')]=_[_0x56a1('0x32')](_0x245921[_0x56a1('0x2e')],qs[_0x56a1('0x33')](_0x263752[_0x56a1('0x2f')]['fields']));_0x36b45b[_0x56a1('0x34')]=_0x36b45b[_0x56a1('0x34')]['length']?_0x36b45b['attributes']:_0x245921[_0x56a1('0x2e')];if(_0x263752['query'][_0x56a1('0x43')]){_0x36b45b[_0x56a1('0x3d')]=[{'all':!![]}];}_0x36b45b=_[_0x56a1('0x39')]({},_0x36b45b,_0x263752['options']);return db['MailTransferReport'][_0x56a1('0x44')](_0x36b45b)[_0x56a1('0x24')](handleEntityNotFound(_0x1b6dad,null))['then'](respondWithResult(_0x1b6dad,null))[_0x56a1('0x40')](handleError(_0x1b6dad,null));};exports['create']=function(_0x1f41a7,_0x4c2690){return db['MailTransferReport']['create'](_0x1f41a7[_0x56a1('0x45')],{})[_0x56a1('0x24')](respondWithResult(_0x4c2690,0xc9))[_0x56a1('0x40')](handleError(_0x4c2690,null));};exports[_0x56a1('0x23')]=function(_0x537489,_0x262e00){if(_0x537489[_0x56a1('0x45')]['id']){delete _0x537489[_0x56a1('0x45')]['id'];}return db[_0x56a1('0x3c')][_0x56a1('0x44')]({'where':{'id':_0x537489[_0x56a1('0x42')]['id']}})[_0x56a1('0x24')](handleEntityNotFound(_0x262e00,null))[_0x56a1('0x24')](saveUpdates(_0x537489[_0x56a1('0x45')],null))['then'](respondWithResult(_0x262e00,null))['catch'](handleError(_0x262e00,null));};exports[_0x56a1('0x25')]=function(_0x287272,_0x13a98e){return db[_0x56a1('0x3c')][_0x56a1('0x44')]({'where':{'id':_0x287272['params']['id']}})[_0x56a1('0x24')](handleEntityNotFound(_0x13a98e,null))[_0x56a1('0x24')](removeEntity(_0x13a98e,null))[_0x56a1('0x40')](handleError(_0x13a98e,null));};exports[_0x56a1('0x46')]=function(_0x1d5a79,_0x490539){return db[_0x56a1('0x3c')]['describe']()[_0x56a1('0x24')](respondWithResult(_0x490539,null))[_0x56a1('0x40')](handleError(_0x490539,null));}; \ No newline at end of file +var _0x3196=['includeAll','options','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','stack','send','index','map','MailTransferReport','fieldName','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','include','rows','catch','show','keys','rawAttributes'];(function(_0x2b19f7,_0x176134){var _0x22ba14=function(_0x3e9f2d){while(--_0x3e9f2d){_0x2b19f7['push'](_0x2b19f7['shift']());}};_0x22ba14(++_0x176134);}(_0x3196,0xf5));var _0x6319=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3196[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x6319('0x0'));var rimraf=require(_0x6319('0x1'));var zipdir=require(_0x6319('0x2'));var jsonpatch=require(_0x6319('0x3'));var rp=require('request-promise');var moment=require(_0x6319('0x4'));var BPromise=require(_0x6319('0x5'));var Mustache=require(_0x6319('0x6'));var util=require(_0x6319('0x7'));var path=require(_0x6319('0x8'));var sox=require(_0x6319('0x9'));var csv=require(_0x6319('0xa'));var ejs=require(_0x6319('0xb'));var fs=require('fs');var fs_extra=require(_0x6319('0xc'));var _=require(_0x6319('0xd'));var squel=require(_0x6319('0xe'));var crypto=require(_0x6319('0xf'));var jsforce=require(_0x6319('0x10'));var deskjs=require(_0x6319('0x11'));var toCsv=require('to-csv');var querystring=require(_0x6319('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6319('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6319('0x14'));var hardwareService=require(_0x6319('0x15'));var logger=require('../../config/logger')(_0x6319('0x16'));var utils=require(_0x6319('0x17'));var config=require(_0x6319('0x18'));var licenseUtil=require(_0x6319('0x19'));var db=require(_0x6319('0x1a'))['db'];function respondWithStatusCode(_0x572e6a,_0x3e3c28){_0x3e3c28=_0x3e3c28||0xcc;return function(_0x2a20b6){if(_0x2a20b6){return _0x572e6a[_0x6319('0x1b')](_0x3e3c28);}return _0x572e6a['status'](_0x3e3c28)[_0x6319('0x1c')]();};}function respondWithResult(_0x1dbc34,_0x263d23){_0x263d23=_0x263d23||0xc8;return function(_0x42190f){if(_0x42190f){return _0x1dbc34[_0x6319('0x1d')](_0x263d23)[_0x6319('0x1e')](_0x42190f);}};}function respondWithFilteredResult(_0x42e86f,_0xe56332){return function(_0x76bd94){if(_0x76bd94){var _0x5be011=typeof _0xe56332['offset']===_0x6319('0x1f')&&typeof _0xe56332[_0x6319('0x20')]===_0x6319('0x1f');var _0x3ca88a=_0x76bd94[_0x6319('0x21')];var _0x5b9acc=_0x5be011?0x0:_0xe56332['offset'];var _0x15bcd8=_0x5be011?_0x76bd94[_0x6319('0x21')]:_0xe56332[_0x6319('0x22')]+_0xe56332[_0x6319('0x20')];var _0x4ca726;if(_0x15bcd8>=_0x3ca88a){_0x15bcd8=_0x3ca88a;_0x4ca726=0xc8;}else{_0x4ca726=0xce;}_0x42e86f[_0x6319('0x1d')](_0x4ca726);return _0x42e86f[_0x6319('0x23')](_0x6319('0x24'),_0x5b9acc+'-'+_0x15bcd8+'/'+_0x3ca88a)[_0x6319('0x1e')](_0x76bd94);}return null;};}function patchUpdates(_0xdf2e4f){return function(_0x5f56b6){try{jsonpatch['apply'](_0x5f56b6,_0xdf2e4f,!![]);}catch(_0x4c9902){return BPromise[_0x6319('0x25')](_0x4c9902);}return _0x5f56b6[_0x6319('0x26')]();};}function saveUpdates(_0x52df53,_0x1dae47){return function(_0x4f02d2){if(_0x4f02d2){return _0x4f02d2[_0x6319('0x27')](_0x52df53)[_0x6319('0x28')](function(_0x4b53f5){return _0x4b53f5;});}return null;};}function removeEntity(_0x2d47c2,_0x451abf){return function(_0x243a94){if(_0x243a94){return _0x243a94['destroy']()[_0x6319('0x28')](function(){_0x2d47c2[_0x6319('0x1d')](0xcc)[_0x6319('0x1c')]();});}};}function handleEntityNotFound(_0x13221a,_0x9944a6){return function(_0x4aa667){if(!_0x4aa667){_0x13221a[_0x6319('0x1b')](0x194);}return _0x4aa667;};}function handleError(_0x21cbbd,_0x56d900){_0x56d900=_0x56d900||0x1f4;return function(_0x49e8f7){logger['error'](_0x49e8f7[_0x6319('0x29')]);if(_0x49e8f7['name']){delete _0x49e8f7['name'];}_0x21cbbd['status'](_0x56d900)[_0x6319('0x2a')](_0x49e8f7);};}exports[_0x6319('0x2b')]=function(_0x48235f,_0xd94ea1){var _0x4d01a2={},_0x2ed5fb={},_0x5c56f8={'count':0x0,'rows':[]};var _0x35dc95=_[_0x6319('0x2c')](db[_0x6319('0x2d')]['rawAttributes'],function(_0x21f78b){return{'name':_0x21f78b[_0x6319('0x2e')],'type':_0x21f78b['type'][_0x6319('0x2f')]};});_0x2ed5fb[_0x6319('0x30')]=_[_0x6319('0x2c')](_0x35dc95,'name');_0x2ed5fb['query']=_['keys'](_0x48235f['query']);_0x2ed5fb[_0x6319('0x31')]=_[_0x6319('0x32')](_0x2ed5fb[_0x6319('0x30')],_0x2ed5fb[_0x6319('0x33')]);_0x4d01a2[_0x6319('0x34')]=_[_0x6319('0x32')](_0x2ed5fb['model'],qs[_0x6319('0x35')](_0x48235f[_0x6319('0x33')][_0x6319('0x35')]));_0x4d01a2[_0x6319('0x34')]=_0x4d01a2[_0x6319('0x34')][_0x6319('0x36')]?_0x4d01a2[_0x6319('0x34')]:_0x2ed5fb[_0x6319('0x30')];if(!_0x48235f[_0x6319('0x33')][_0x6319('0x37')](_0x6319('0x38'))){_0x4d01a2[_0x6319('0x20')]=qs[_0x6319('0x20')](_0x48235f[_0x6319('0x33')][_0x6319('0x20')]);_0x4d01a2['offset']=qs['offset'](_0x48235f[_0x6319('0x33')][_0x6319('0x22')]);}_0x4d01a2[_0x6319('0x39')]=qs[_0x6319('0x3a')](_0x48235f[_0x6319('0x33')][_0x6319('0x3a')]);_0x4d01a2[_0x6319('0x3b')]=qs[_0x6319('0x31')](_[_0x6319('0x3c')](_0x48235f[_0x6319('0x33')],_0x2ed5fb[_0x6319('0x31')]),_0x35dc95);if(_0x48235f[_0x6319('0x33')][_0x6319('0x3d')]){_0x4d01a2[_0x6319('0x3b')]=_['merge'](_0x4d01a2['where'],{'$or':_[_0x6319('0x2c')](_0x35dc95,function(_0x58eb2e){if(_0x58eb2e['type']!==_0x6319('0x3e')){var _0x207ba9={};_0x207ba9[_0x58eb2e[_0x6319('0x3f')]]={'$like':'%'+_0x48235f[_0x6319('0x33')][_0x6319('0x3d')]+'%'};return _0x207ba9;}})});}_0x4d01a2=_[_0x6319('0x40')]({},_0x4d01a2,_0x48235f['options']);var _0x37d332={'where':_0x4d01a2[_0x6319('0x3b')]};return db[_0x6319('0x2d')][_0x6319('0x21')](_0x37d332)[_0x6319('0x28')](function(_0xa3816d){_0x5c56f8[_0x6319('0x21')]=_0xa3816d;if(_0x48235f[_0x6319('0x33')]['includeAll']){_0x4d01a2[_0x6319('0x41')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x4d01a2);})['then'](function(_0x5cecf5){_0x5c56f8[_0x6319('0x42')]=_0x5cecf5;return _0x5c56f8;})[_0x6319('0x28')](respondWithFilteredResult(_0xd94ea1,_0x4d01a2))[_0x6319('0x43')](handleError(_0xd94ea1,null));};exports[_0x6319('0x44')]=function(_0x4a6706,_0x1f0f2c){var _0x52f12d={'raw':!![],'where':{'id':_0x4a6706['params']['id']}},_0x372dec={};_0x372dec['model']=_[_0x6319('0x45')](db[_0x6319('0x2d')][_0x6319('0x46')]);_0x372dec['query']=_['keys'](_0x4a6706[_0x6319('0x33')]);_0x372dec[_0x6319('0x31')]=_[_0x6319('0x32')](_0x372dec[_0x6319('0x30')],_0x372dec['query']);_0x52f12d['attributes']=_[_0x6319('0x32')](_0x372dec[_0x6319('0x30')],qs['fields'](_0x4a6706[_0x6319('0x33')][_0x6319('0x35')]));_0x52f12d[_0x6319('0x34')]=_0x52f12d[_0x6319('0x34')][_0x6319('0x36')]?_0x52f12d[_0x6319('0x34')]:_0x372dec[_0x6319('0x30')];if(_0x4a6706[_0x6319('0x33')][_0x6319('0x47')]){_0x52f12d[_0x6319('0x41')]=[{'all':!![]}];}_0x52f12d=_[_0x6319('0x40')]({},_0x52f12d,_0x4a6706[_0x6319('0x48')]);return db['MailTransferReport'][_0x6319('0x49')](_0x52f12d)[_0x6319('0x28')](handleEntityNotFound(_0x1f0f2c,null))[_0x6319('0x28')](respondWithResult(_0x1f0f2c,null))[_0x6319('0x43')](handleError(_0x1f0f2c,null));};exports[_0x6319('0x4a')]=function(_0x239599,_0x390be1){return db[_0x6319('0x2d')][_0x6319('0x4a')](_0x239599[_0x6319('0x4b')],{})[_0x6319('0x28')](respondWithResult(_0x390be1,0xc9))[_0x6319('0x43')](handleError(_0x390be1,null));};exports[_0x6319('0x27')]=function(_0x54f617,_0x45e27e){if(_0x54f617[_0x6319('0x4b')]['id']){delete _0x54f617[_0x6319('0x4b')]['id'];}return db[_0x6319('0x2d')][_0x6319('0x49')]({'where':{'id':_0x54f617['params']['id']}})['then'](handleEntityNotFound(_0x45e27e,null))['then'](saveUpdates(_0x54f617['body'],null))[_0x6319('0x28')](respondWithResult(_0x45e27e,null))[_0x6319('0x43')](handleError(_0x45e27e,null));};exports[_0x6319('0x4c')]=function(_0x5c0eaf,_0xc60c93){return db[_0x6319('0x2d')]['find']({'where':{'id':_0x5c0eaf[_0x6319('0x4d')]['id']}})[_0x6319('0x28')](handleEntityNotFound(_0xc60c93,null))[_0x6319('0x28')](removeEntity(_0xc60c93,null))[_0x6319('0x43')](handleError(_0xc60c93,null));};exports[_0x6319('0x4e')]=function(_0xfb964d,_0x430290){return db[_0x6319('0x2d')][_0x6319('0x4e')]()['then'](respondWithResult(_0x430290,null))[_0x6319('0x43')](handleError(_0x430290,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 69f9532..1f39b66 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 _0xf6c1=['api','moment','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','../../config/logger'];(function(_0x2078df,_0xc00387){var _0x577018=function(_0x5479b6){while(--_0x5479b6){_0x2078df['push'](_0x2078df['shift']());}};_0x577018(++_0xc00387);}(_0xf6c1,0x99));var _0x1f6c=function(_0x3dc41e,_0x11b6c5){_0x3dc41e=_0x3dc41e-0x0;var _0x2b98de=_0xf6c1[_0x3dc41e];return _0x2b98de;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f6c('0x0'))(_0x1f6c('0x1'));var moment=require(_0x1f6c('0x2'));var BPromise=require('bluebird');var rp=require(_0x1f6c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f6c('0x4'));var config=require(_0x1f6c('0x5'));var attributes=require(_0x1f6c('0x6'));module[_0x1f6c('0x7')]=function(_0x25e99a,_0x3ab17e){return _0x25e99a['define'](_0x1f6c('0x8'),attributes,{'tableName':_0x1f6c('0x9'),'paranoid':![],'indexes':[{'name':_0x1f6c('0xa'),'fields':[_0x1f6c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a3f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','uniqueid'];(function(_0x707e3,_0x598154){var _0x2b76b1=function(_0x1ce3e8){while(--_0x1ce3e8){_0x707e3['push'](_0x707e3['shift']());}};_0x2b76b1(++_0x598154);}(_0x4a3f,0x1b0));var _0xf4a3=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x4a3f[_0x263a74];return _0x2aa86c;};'use strict';var _=require('lodash');var util=require(_0xf4a3('0x0'));var logger=require(_0xf4a3('0x1'))(_0xf4a3('0x2'));var moment=require(_0xf4a3('0x3'));var BPromise=require(_0xf4a3('0x4'));var rp=require(_0xf4a3('0x5'));var fs=require('fs');var path=require(_0xf4a3('0x6'));var rimraf=require(_0xf4a3('0x7'));var config=require(_0xf4a3('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0xf4a3('0x9')]=function(_0x4c8568,_0x5685e4){return _0x4c8568[_0xf4a3('0xa')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xf4a3('0xb'),'fields':[_0xf4a3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index b2ceb84..a9db4c5 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 _0x022f=['MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2d3381,_0x5b6dd0){var _0x134051=function(_0x2780c3){while(--_0x2780c3){_0x2d3381['push'](_0x2d3381['shift']());}};_0x134051(++_0x5b6dd0);}(_0x022f,0x155));var _0xf022=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x022f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf022('0x0'));var util=require(_0xf022('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf022('0x2'));var fs=require('fs');var Redis=require(_0xf022('0x3'));var db=require(_0xf022('0x4'))['db'];var utils=require(_0xf022('0x5'));var logger=require(_0xf022('0x6'))(_0xf022('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf022('0x8')][_0xf022('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e65ff,_0x36d122,_0xcdc815){return new BPromise(function(_0x15a5d0,_0x4ab2a2){return client[_0xf022('0xa')](_0x4e65ff,_0xcdc815)[_0xf022('0xb')](function(_0x1675b3){logger[_0xf022('0xc')](_0xf022('0xd'),_0x36d122,_0xf022('0xe'));logger[_0xf022('0xf')](_0xf022('0x10'),_0x36d122,_0xf022('0xe'),JSON[_0xf022('0x11')](_0x1675b3));if(_0x1675b3[_0xf022('0x12')]){if(_0x1675b3[_0xf022('0x12')][_0xf022('0x13')]===0x1f4){logger[_0xf022('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x36d122,_0x1675b3[_0xf022('0x12')][_0xf022('0x14')]);return _0x4ab2a2(_0x1675b3['error'][_0xf022('0x14')]);}logger['error'](_0xf022('0xd'),_0x36d122,_0x1675b3[_0xf022('0x12')][_0xf022('0x14')]);return _0x15a5d0(_0x1675b3[_0xf022('0x12')][_0xf022('0x14')]);}else{logger['info'](_0xf022('0xd'),_0x36d122,_0xf022('0xe'));_0x15a5d0(_0x1675b3['result']['message']);}})['catch'](function(_0x3829de){logger[_0xf022('0x12')](_0xf022('0xd'),_0x36d122,_0x3829de);_0x4ab2a2(_0x3829de);});});} \ No newline at end of file +var _0xed53=['jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xed53,0x1f1));var _0x3ed5=function(_0x59b810,_0x2d5f20){_0x59b810=_0x59b810-0x0;var _0x268485=_0xed53[_0x59b810];return _0x268485;};'use strict';var _=require(_0x3ed5('0x0'));var util=require(_0x3ed5('0x1'));var moment=require(_0x3ed5('0x2'));var BPromise=require(_0x3ed5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ed5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ed5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3ed5('0x6'));var jayson=require(_0x3ed5('0x7'));var client=jayson[_0x3ed5('0x8')][_0x3ed5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11b0ed,_0x3d2d08,_0x43ac1e){return new BPromise(function(_0x49151c,_0x5a38b6){return client[_0x3ed5('0xa')](_0x11b0ed,_0x43ac1e)['then'](function(_0x2a29cc){logger[_0x3ed5('0xb')](_0x3ed5('0xc'),_0x3d2d08,_0x3ed5('0xd'));logger[_0x3ed5('0xe')](_0x3ed5('0xf'),_0x3d2d08,_0x3ed5('0xd'),JSON[_0x3ed5('0x10')](_0x2a29cc));if(_0x2a29cc[_0x3ed5('0x11')]){if(_0x2a29cc[_0x3ed5('0x11')]['code']===0x1f4){logger['error'](_0x3ed5('0xc'),_0x3d2d08,_0x2a29cc['error']['message']);return _0x5a38b6(_0x2a29cc['error'][_0x3ed5('0x12')]);}logger[_0x3ed5('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x3d2d08,_0x2a29cc['error'][_0x3ed5('0x12')]);return _0x49151c(_0x2a29cc[_0x3ed5('0x11')][_0x3ed5('0x12')]);}else{logger[_0x3ed5('0xb')](_0x3ed5('0xc'),_0x3d2d08,_0x3ed5('0xd'));_0x49151c(_0x2a29cc[_0x3ed5('0x13')][_0x3ed5('0x12')]);}})[_0x3ed5('0x14')](function(_0x38756f){logger[_0x3ed5('0x11')](_0x3ed5('0xc'),_0x3d2d08,_0x38756f);_0x5a38b6(_0x38756f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 33f1adb..ae12318 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 _0xaf92=['index','/describe','/:id','show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0xaf92,0x1c2));var _0x2af9=function(_0x40ba3b,_0x5deccd){_0x40ba3b=_0x40ba3b-0x0;var _0xdf5e7e=_0xaf92[_0x40ba3b];return _0xdf5e7e;};'use strict';var multer=require(_0x2af9('0x0'));var util=require(_0x2af9('0x1'));var path=require(_0x2af9('0x2'));var timeout=require(_0x2af9('0x3'));var express=require('express');var router=express[_0x2af9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2af9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2af9('0x6'));var controller=require('./memberReport.controller');router[_0x2af9('0x7')]('/',auth[_0x2af9('0x8')](),controller[_0x2af9('0x9')]);router[_0x2af9('0x7')](_0x2af9('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2af9('0x7')](_0x2af9('0xb'),auth['isAuthenticated'](),controller[_0x2af9('0xc')]);router[_0x2af9('0xd')]('/',auth[_0x2af9('0x8')](),controller['create']);router['put'](_0x2af9('0xb'),auth[_0x2af9('0x8')](),controller[_0x2af9('0xe')]);router[_0x2af9('0xf')](_0x2af9('0xb'),auth['isAuthenticated'](),controller[_0x2af9('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3e5c=['../../config/environment','./memberReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x108b78,_0x28a619){var _0x3f81ed=function(_0x117143){while(--_0x117143){_0x108b78['push'](_0x108b78['shift']());}};_0x3f81ed(++_0x28a619);}(_0x3e5c,0x148));var _0xc3e5=function(_0x35c100,_0x4f7fdf){_0x35c100=_0x35c100-0x0;var _0x394bf9=_0x3e5c[_0x35c100];return _0x394bf9;};'use strict';var multer=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var path=require(_0xc3e5('0x2'));var timeout=require(_0xc3e5('0x3'));var express=require(_0xc3e5('0x4'));var router=express['Router']();var fs_extra=require(_0xc3e5('0x5'));var auth=require(_0xc3e5('0x6'));var interaction=require(_0xc3e5('0x7'));var config=require(_0xc3e5('0x8'));var controller=require(_0xc3e5('0x9'));router[_0xc3e5('0xa')]('/',auth['isAuthenticated'](),controller[_0xc3e5('0xb')]);router[_0xc3e5('0xa')](_0xc3e5('0xc'),auth['isAuthenticated'](),controller[_0xc3e5('0xd')]);router[_0xc3e5('0xa')](_0xc3e5('0xe'),auth[_0xc3e5('0xf')](),controller[_0xc3e5('0x10')]);router[_0xc3e5('0x11')]('/',auth[_0xc3e5('0xf')](),controller[_0xc3e5('0x12')]);router[_0xc3e5('0x13')](_0xc3e5('0xe'),auth[_0xc3e5('0xf')](),controller[_0xc3e5('0x14')]);router[_0xc3e5('0x15')](_0xc3e5('0xe'),auth[_0xc3e5('0xf')](),controller[_0xc3e5('0x16')]);module[_0xc3e5('0x17')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 47e5ea4..85605c9 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 _0x6a60=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','setDataValue','duration'];(function(_0x5ab5ea,_0x304980){var _0x27bc3d=function(_0x2d3dc7){while(--_0x2d3dc7){_0x5ab5ea['push'](_0x5ab5ea['shift']());}};_0x27bc3d(++_0x304980);}(_0x6a60,0x103));var _0x06a6=function(_0x23cbbe,_0x240b33){_0x23cbbe=_0x23cbbe-0x0;var _0x292a79=_0x6a60[_0x23cbbe];return _0x292a79;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x06a6('0x0'));module[_0x06a6('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x06a6('0x2')]},'interface':{'type':Sequelize[_0x06a6('0x2')]},'type':{'type':Sequelize[_0x06a6('0x2')],'defaultValue':_0x06a6('0x3'),'comment':_0x06a6('0x4')},'duration':{'type':Sequelize[_0x06a6('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x06a6('0x6')],'set':function(_0x39f1c5){var _0x5d426a=moment(_0x39f1c5);var _0x10f577=moment(this[_0x06a6('0x7')](_0x06a6('0x8')));var _0x58cbad=_0x5d426a['diff'](_0x10f577,'seconds');this[_0x06a6('0x9')]('exitAt',_0x39f1c5);this[_0x06a6('0x9')](_0x06a6('0xa'),_0x58cbad>=0x0?_0x58cbad:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x06a6('0xb')},'data2':{'type':Sequelize[_0x06a6('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x06a6('0xc')},'data4':{'type':Sequelize[_0x06a6('0x2')],'comment':_0x06a6('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x06a6('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x06a6('0x5')]},'uniqueid':{'type':Sequelize[_0x06a6('0x2')]}}; \ No newline at end of file +var _0x93a7=['moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','sequelize'];(function(_0x3a3c3d,_0x3b8542){var _0xf3142f=function(_0x479bb0){while(--_0x479bb0){_0x3a3c3d['push'](_0x3a3c3d['shift']());}};_0xf3142f(++_0x3b8542);}(_0x93a7,0x1db));var _0x793a=function(_0x22ade4,_0x3ee137){_0x22ade4=_0x22ade4-0x0;var _0x1bd105=_0x93a7[_0x22ade4];return _0x1bd105;};'use strict';var Sequelize=require(_0x793a('0x0'));var moment=require(_0x793a('0x1'));module['exports']={'channel':{'type':Sequelize[_0x793a('0x2')]},'membername':{'type':Sequelize[_0x793a('0x2')]},'interface':{'type':Sequelize[_0x793a('0x2')]},'type':{'type':Sequelize[_0x793a('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x793a('0x3')},'duration':{'type':Sequelize[_0x793a('0x4')]},'enterAt':{'type':Sequelize[_0x793a('0x5')]},'exitAt':{'type':Sequelize[_0x793a('0x5')],'set':function(_0x5605e9){var _0x2d851a=moment(_0x5605e9);var _0x2af5f0=moment(this['getDataValue'](_0x793a('0x6')));var _0x3c14c6=_0x2d851a['diff'](_0x2af5f0,_0x793a('0x7'));this[_0x793a('0x8')](_0x793a('0x9'),_0x5605e9);this['setDataValue'](_0x793a('0xa'),_0x3c14c6>=0x0?_0x3c14c6:null);}},'data1':{'type':Sequelize[_0x793a('0x2')],'comment':_0x793a('0xb')},'data2':{'type':Sequelize[_0x793a('0x2')],'comment':_0x793a('0xc')},'data3':{'type':Sequelize[_0x793a('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x793a('0x2')],'comment':_0x793a('0xd')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x793a('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index b5bad36..c5085c0 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','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','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x55ca,0x126));var _0xa55c=function(_0x47f395,_0x18a997){_0x47f395=_0x47f395-0x0;var _0x577a61=_0x55ca[_0x47f395];return _0x577a61;};'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('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x9957=['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','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x167a99,_0x1bbb59){var _0x442d62=function(_0x12c3f8){while(--_0x12c3f8){_0x167a99['push'](_0x167a99['shift']());}};_0x442d62(++_0x1bbb59);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 497b122..1ab1349 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 _0xe495=['rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3664e0,_0x1cfec0){var _0x11b14e=function(_0x34b439){while(--_0x34b439){_0x3664e0['push'](_0x3664e0['shift']());}};_0x11b14e(++_0x1cfec0);}(_0xe495,0x12f));var _0x5e49=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xe495[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x5e49('0x0'));var util=require('util');var logger=require(_0x5e49('0x1'))(_0x5e49('0x2'));var moment=require(_0x5e49('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e49('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e49('0x5'));var config=require(_0x5e49('0x6'));var attributes=require(_0x5e49('0x7'));module[_0x5e49('0x8')]=function(_0x1e0e9d,_0x304a4b){return _0x1e0e9d['define'](_0x5e49('0x9'),attributes,{'tableName':_0x5e49('0xa'),'paranoid':![],'indexes':[{'name':_0x5e49('0xb'),'fields':[_0x5e49('0xc'),_0x5e49('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x444a=['lodash','../../config/logger','path','../../config/environment','exports','report_member','membername_interface','membername','interface'];(function(_0x530bea,_0x2d9ad1){var _0x362054=function(_0x35e900){while(--_0x35e900){_0x530bea['push'](_0x530bea['shift']());}};_0x362054(++_0x2d9ad1);}(_0x444a,0xa2));var _0xa444=function(_0xca1091,_0x539dbf){_0xca1091=_0xca1091-0x0;var _0xd3019c=_0x444a[_0xca1091];return _0xd3019c;};'use strict';var _=require(_0xa444('0x0'));var util=require('util');var logger=require(_0xa444('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa444('0x2'));var rimraf=require('rimraf');var config=require(_0xa444('0x3'));var attributes=require('./memberReport.attributes');module[_0xa444('0x4')]=function(_0x537457,_0x20f015){return _0x537457['define']('MemberReport',attributes,{'tableName':_0xa444('0x5'),'paranoid':![],'indexes':[{'name':_0xa444('0x6'),'fields':[_0xa444('0x7'),_0xa444('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 636828b..f1fd5c9 100644 --- a/server/api/memberReport/memberReport.rpc.js +++ b/server/api/memberReport/memberReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37cc=['http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','include','map','model','GetMemberReport','CreateMemberReport','MemberReport','body','UpdateMemberReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x500e23,_0x51b03a){var _0x342ee8=function(_0x5287d5){while(--_0x5287d5){_0x500e23['push'](_0x500e23['shift']());}};_0x342ee8(++_0x51b03a);}(_0x37cc,0x185));var _0xc37c=function(_0x24513e,_0x43ea88){_0x24513e=_0x24513e-0x0;var _0x43fbe4=_0x37cc[_0x24513e];return _0x43fbe4;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var moment=require(_0xc37c('0x2'));var BPromise=require(_0xc37c('0x3'));var rs=require(_0xc37c('0x4'));var fs=require('fs');var Redis=require(_0xc37c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc37c('0x6'))(_0xc37c('0x7'));var config=require(_0xc37c('0x8'));var jayson=require(_0xc37c('0x9'));var client=jayson[_0xc37c('0xa')][_0xc37c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd8f098,_0x1eaa97,_0x3c5c63){return new BPromise(function(_0x483c8d,_0x15a756){return client[_0xc37c('0xc')](_0xd8f098,_0x3c5c63)[_0xc37c('0xd')](function(_0x3526b5){logger[_0xc37c('0xe')]('MemberReport,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));logger[_0xc37c('0x10')](_0xc37c('0x11'),_0x1eaa97,_0xc37c('0xf'),JSON[_0xc37c('0x12')](_0x3526b5));if(_0x3526b5[_0xc37c('0x13')]){if(_0x3526b5[_0xc37c('0x13')][_0xc37c('0x14')]===0x1f4){logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')]['message']);return _0x15a756(_0x3526b5['error'][_0xc37c('0x16')]);}logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')][_0xc37c('0x16')]);return _0x483c8d(_0x3526b5[_0xc37c('0x13')]['message']);}else{logger[_0xc37c('0xe')]('MemberReport,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));_0x483c8d(_0x3526b5[_0xc37c('0x17')][_0xc37c('0x16')]);}})[_0xc37c('0x18')](function(_0x674ccf){logger['error']('MemberReport,\x20%s,\x20%s',_0x1eaa97,_0x674ccf);_0x15a756(_0x674ccf);});});}exports['GetMemberReport']=function(_0x2d6129){var _0x5c7bd2=this;return new Promise(function(_0x370c2f,_0x1f8679){return db['MemberReport'][_0xc37c('0x19')]({'raw':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d6129['options']?_0x2d6129[_0xc37c('0x1a')]['where']||null:null,'attributes':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1c')]||null:null,'limit':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')]['limit']||null:null,'include':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1d')]?_[_0xc37c('0x1e')](_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1d')],function(_0x15a392){return{'model':db[_0x15a392[_0xc37c('0x1f')]],'as':_0x15a392['as'],'attributes':_0x15a392[_0xc37c('0x1c')],'include':_0x15a392[_0xc37c('0x1d')]?_[_0xc37c('0x1e')](_0x15a392[_0xc37c('0x1d')],function(_0x3076fc){return{'model':db[_0x3076fc['model']],'as':_0x3076fc['as'],'attributes':_0x3076fc[_0xc37c('0x1c')],'include':_0x3076fc[_0xc37c('0x1d')]?_[_0xc37c('0x1e')](_0x3076fc[_0xc37c('0x1d')],function(_0x53f062){return{'model':db[_0x53f062[_0xc37c('0x1f')]],'as':_0x53f062['as'],'attributes':_0x53f062[_0xc37c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc37c('0xd')](function(_0xbd5d3a){logger[_0xc37c('0xe')](_0xc37c('0x20'),_0x2d6129);logger[_0xc37c('0x10')](_0xc37c('0x20'),_0x2d6129,JSON['stringify'](_0xbd5d3a));_0x370c2f(_0xbd5d3a);})[_0xc37c('0x18')](function(_0x466094){logger[_0xc37c('0x13')](_0xc37c('0x20'),_0x466094[_0xc37c('0x16')],_0x2d6129);_0x1f8679(_0x5c7bd2[_0xc37c('0x13')](0x1f4,_0x466094[_0xc37c('0x16')]));});});};exports[_0xc37c('0x21')]=function(_0x2c59df){var _0x472d58=this;return new Promise(function(_0x224641,_0x169b27){return db[_0xc37c('0x22')]['create'](_0x2c59df[_0xc37c('0x23')],{'raw':_0x2c59df[_0xc37c('0x1a')]?_0x2c59df['options']['raw']===undefined?!![]:![]:!![]})[_0xc37c('0xd')](function(_0x3b9ac4){logger[_0xc37c('0xe')]('CreateMemberReport',_0x2c59df);logger[_0xc37c('0x10')]('CreateMemberReport',_0x2c59df,JSON[_0xc37c('0x12')](_0x3b9ac4));_0x224641(_0x3b9ac4);})[_0xc37c('0x18')](function(_0x58429b){logger[_0xc37c('0x13')](_0xc37c('0x21'),_0x58429b[_0xc37c('0x16')],_0x2c59df);_0x169b27(_0x472d58[_0xc37c('0x13')](0x1f4,_0x58429b[_0xc37c('0x16')]));});});};exports[_0xc37c('0x24')]=function(_0x445f07){var _0x5432fe=this;return new Promise(function(_0x5142bd,_0xef4b6c){return db[_0xc37c('0x22')][_0xc37c('0x25')](_0x445f07[_0xc37c('0x23')],{'raw':_0x445f07['options']?_0x445f07[_0xc37c('0x1a')][_0xc37c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x445f07[_0xc37c('0x1a')]?_0x445f07['options'][_0xc37c('0x26')]||null:null,'attributes':_0x445f07[_0xc37c('0x1a')]?_0x445f07['options'][_0xc37c('0x1c')]||null:null,'limit':_0x445f07[_0xc37c('0x1a')]?_0x445f07['options'][_0xc37c('0x27')]||null:null})[_0xc37c('0xd')](function(_0x17dd56){logger[_0xc37c('0xe')](_0xc37c('0x24'),_0x445f07);logger[_0xc37c('0x10')](_0xc37c('0x24'),_0x445f07,JSON[_0xc37c('0x12')](_0x17dd56));_0x5142bd(_0x17dd56);})[_0xc37c('0x18')](function(_0x188f2c){logger[_0xc37c('0x13')](_0xc37c('0x24'),_0x188f2c[_0xc37c('0x16')],_0x445f07);_0xef4b6c(_0x5432fe[_0xc37c('0x13')](0x1f4,_0x188f2c[_0xc37c('0x16')]));});});}; \ No newline at end of file +var _0x5a5a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','map','include','model','catch','CreateMemberReport','create','body','raw','UpdateMemberReport','update','then','util','moment','bluebird'];(function(_0x22bef2,_0x54f207){var _0xe33934=function(_0x20fd53){while(--_0x20fd53){_0x22bef2['push'](_0x22bef2['shift']());}};_0xe33934(++_0x54f207);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x3af955,_0x21431c){_0x3af955=_0x3af955-0x0;var _0x167de5=_0x5a5a[_0x3af955];return _0x167de5;};'use strict';var _=require('lodash');var util=require(_0xa5a5('0x0'));var moment=require(_0xa5a5('0x1'));var BPromise=require(_0xa5a5('0x2'));var rs=require(_0xa5a5('0x3'));var fs=require('fs');var Redis=require(_0xa5a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5a5('0x5'));var logger=require(_0xa5a5('0x6'))(_0xa5a5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa5a5('0x8')][_0xa5a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5691f1,_0x3ea00f,_0xf2ea20){return new BPromise(function(_0x1234c2,_0x3a23f4){return client[_0xa5a5('0xa')](_0x5691f1,_0xf2ea20)['then'](function(_0x158a80){logger[_0xa5a5('0xb')](_0xa5a5('0xc'),_0x3ea00f,_0xa5a5('0xd'));logger[_0xa5a5('0xe')](_0xa5a5('0xf'),_0x3ea00f,_0xa5a5('0xd'),JSON[_0xa5a5('0x10')](_0x158a80));if(_0x158a80[_0xa5a5('0x11')]){if(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x12')]===0x1f4){logger[_0xa5a5('0x11')]('MemberReport,\x20%s,\x20%s',_0x3ea00f,_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);return _0x3a23f4(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);}logger[_0xa5a5('0x11')](_0xa5a5('0xc'),_0x3ea00f,_0x158a80['error'][_0xa5a5('0x13')]);return _0x1234c2(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);}else{logger[_0xa5a5('0xb')](_0xa5a5('0xc'),_0x3ea00f,_0xa5a5('0xd'));_0x1234c2(_0x158a80[_0xa5a5('0x14')][_0xa5a5('0x13')]);}})['catch'](function(_0x3ef56e){logger[_0xa5a5('0x11')](_0xa5a5('0xc'),_0x3ea00f,_0x3ef56e);_0x3a23f4(_0x3ef56e);});});}exports[_0xa5a5('0x15')]=function(_0x3c4cae){var _0x12e2f2=this;return new Promise(function(_0x28c89f,_0x519924){return db[_0xa5a5('0x16')][_0xa5a5('0x17')]({'raw':_0x3c4cae[_0xa5a5('0x18')]?_0x3c4cae[_0xa5a5('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3c4cae[_0xa5a5('0x18')]?_0x3c4cae['options'][_0xa5a5('0x19')]||null:null,'attributes':_0x3c4cae[_0xa5a5('0x18')]?_0x3c4cae[_0xa5a5('0x18')][_0xa5a5('0x1a')]||null:null,'limit':_0x3c4cae['options']?_0x3c4cae['options'][_0xa5a5('0x1b')]||null:null,'include':_0x3c4cae[_0xa5a5('0x18')]?_0x3c4cae[_0xa5a5('0x18')]['include']?_[_0xa5a5('0x1c')](_0x3c4cae['options'][_0xa5a5('0x1d')],function(_0x4996b3){return{'model':db[_0x4996b3['model']],'as':_0x4996b3['as'],'attributes':_0x4996b3[_0xa5a5('0x1a')],'include':_0x4996b3[_0xa5a5('0x1d')]?_[_0xa5a5('0x1c')](_0x4996b3[_0xa5a5('0x1d')],function(_0x55ed28){return{'model':db[_0x55ed28[_0xa5a5('0x1e')]],'as':_0x55ed28['as'],'attributes':_0x55ed28['attributes'],'include':_0x55ed28[_0xa5a5('0x1d')]?_[_0xa5a5('0x1c')](_0x55ed28['include'],function(_0x5ccc1e){return{'model':db[_0x5ccc1e[_0xa5a5('0x1e')]],'as':_0x5ccc1e['as'],'attributes':_0x5ccc1e[_0xa5a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e50ae){logger[_0xa5a5('0xb')](_0xa5a5('0x15'),_0x3c4cae);logger[_0xa5a5('0xe')](_0xa5a5('0x15'),_0x3c4cae,JSON[_0xa5a5('0x10')](_0x5e50ae));_0x28c89f(_0x5e50ae);})[_0xa5a5('0x1f')](function(_0x58dc9e){logger[_0xa5a5('0x11')]('GetMemberReport',_0x58dc9e[_0xa5a5('0x13')],_0x3c4cae);_0x519924(_0x12e2f2['error'](0x1f4,_0x58dc9e[_0xa5a5('0x13')]));});});};exports[_0xa5a5('0x20')]=function(_0x593279){var _0x47ed1d=this;return new Promise(function(_0x495913,_0x8d1e4d){return db['MemberReport'][_0xa5a5('0x21')](_0x593279[_0xa5a5('0x22')],{'raw':_0x593279['options']?_0x593279[_0xa5a5('0x18')][_0xa5a5('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x2db22d){logger[_0xa5a5('0xb')](_0xa5a5('0x20'),_0x593279);logger[_0xa5a5('0xe')](_0xa5a5('0x20'),_0x593279,JSON[_0xa5a5('0x10')](_0x2db22d));_0x495913(_0x2db22d);})[_0xa5a5('0x1f')](function(_0x54782f){logger[_0xa5a5('0x11')](_0xa5a5('0x20'),_0x54782f[_0xa5a5('0x13')],_0x593279);_0x8d1e4d(_0x47ed1d[_0xa5a5('0x11')](0x1f4,_0x54782f[_0xa5a5('0x13')]));});});};exports[_0xa5a5('0x24')]=function(_0x2f7907){var _0x173bdb=this;return new Promise(function(_0x631c7d,_0x10266b){return db[_0xa5a5('0x16')][_0xa5a5('0x25')](_0x2f7907[_0xa5a5('0x22')],{'raw':_0x2f7907[_0xa5a5('0x18')]?_0x2f7907[_0xa5a5('0x18')][_0xa5a5('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f7907[_0xa5a5('0x18')]?_0x2f7907['options'][_0xa5a5('0x19')]||null:null,'attributes':_0x2f7907['options']?_0x2f7907['options']['attributes']||null:null,'limit':_0x2f7907[_0xa5a5('0x18')]?_0x2f7907['options'][_0xa5a5('0x1b')]||null:null})[_0xa5a5('0x26')](function(_0x1526ff){logger['info'](_0xa5a5('0x24'),_0x2f7907);logger['debug']('UpdateMemberReport',_0x2f7907,JSON[_0xa5a5('0x10')](_0x1526ff));_0x631c7d(_0x1526ff);})[_0xa5a5('0x1f')](function(_0x50b94f){logger[_0xa5a5('0x11')]('UpdateMemberReport',_0x50b94f['message'],_0x2f7907);_0x10266b(_0x173bdb[_0xa5a5('0x11')](0x1f4,_0x50b94f['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 10171c7..3c7aa1b 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 _0xef7c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports','multer','util','path','connect-timeout'];(function(_0x5bf152,_0x2884b3){var _0x5d1230=function(_0x40a921){while(--_0x40a921){_0x5bf152['push'](_0x5bf152['shift']());}};_0x5d1230(++_0x2884b3);}(_0xef7c,0xa5));var _0xcef7=function(_0x3fff8f,_0x5e2f51){_0x3fff8f=_0x3fff8f-0x0;var _0x18988c=_0xef7c[_0x3fff8f];return _0x18988c;};'use strict';var multer=require(_0xcef7('0x0'));var util=require(_0xcef7('0x1'));var path=require(_0xcef7('0x2'));var timeout=require(_0xcef7('0x3'));var express=require(_0xcef7('0x4'));var router=express[_0xcef7('0x5')]();var fs_extra=require(_0xcef7('0x6'));var auth=require(_0xcef7('0x7'));var interaction=require(_0xcef7('0x8'));var config=require(_0xcef7('0x9'));var controller=require(_0xcef7('0xa'));router[_0xcef7('0xb')]('/',controller['index']);module[_0xcef7('0xc')]=router; \ No newline at end of file +var _0x7922=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports','util'];(function(_0x2b493d,_0x36d6c7){var _0x4ba39a=function(_0x23462b){while(--_0x23462b){_0x2b493d['push'](_0x2b493d['shift']());}};_0x4ba39a(++_0x36d6c7);}(_0x7922,0x13e));var _0x2792=function(_0x1fc38b,_0x36b32d){_0x1fc38b=_0x1fc38b-0x0;var _0x54a34f=_0x7922[_0x1fc38b];return _0x54a34f;};'use strict';var multer=require('multer');var util=require(_0x2792('0x0'));var path=require('path');var timeout=require(_0x2792('0x1'));var express=require(_0x2792('0x2'));var router=express[_0x2792('0x3')]();var fs_extra=require(_0x2792('0x4'));var auth=require(_0x2792('0x5'));var interaction=require(_0x2792('0x6'));var config=require(_0x2792('0x7'));var controller=require(_0x2792('0x8'));router[_0x2792('0x9')]('/',controller['index']);module[_0x2792('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 1314049..e8a67c8 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 _0x23e1=['exports','STRING'];(function(_0x26528a,_0x29ddd0){var _0x53716b=function(_0x53722d){while(--_0x53722d){_0x26528a['push'](_0x26528a['shift']());}};_0x53716b(++_0x29ddd0);}(_0x23e1,0x18a));var _0x123e=function(_0x594185,_0xa7bda0){_0x594185=_0x594185-0x0;var _0x2a7052=_0x23e1[_0x594185];return _0x2a7052;};'use strict';var Sequelize=require('sequelize');module[_0x123e('0x0')]={'version':{'type':Sequelize[_0x123e('0x1')],'unique':'version'}}; \ No newline at end of file +var _0xdeed=['STRING','version','sequelize','exports'];(function(_0x129d38,_0x33eb62){var _0x1e7227=function(_0x44f024){while(--_0x44f024){_0x129d38['push'](_0x129d38['shift']());}};_0x1e7227(++_0x33eb62);}(_0xdeed,0x186));var _0xddee=function(_0xc25fe8,_0x1083da){_0xc25fe8=_0xc25fe8-0x0;var _0x5307ab=_0xdeed[_0xc25fe8];return _0x5307ab;};'use strict';var Sequelize=require(_0xddee('0x0'));module[_0xddee('0x1')]={'version':{'type':Sequelize[_0xddee('0x2')],'unique':_0xddee('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 2be83ad..68d128c 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 _0x04a5=['destroy','then','error','stack','name','send','map','Migration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save'];(function(_0x5239fc,_0x51f919){var _0x2c2aa5=function(_0x2f12ef){while(--_0x2f12ef){_0x5239fc['push'](_0x5239fc['shift']());}};_0x2c2aa5(++_0x51f919);}(_0x04a5,0x9a));var _0x504a=function(_0x5a5c11,_0x358f6b){_0x5a5c11=_0x5a5c11-0x0;var _0x5d6ba7=_0x04a5[_0x5a5c11];return _0x5d6ba7;};'use strict';var emlformat=require(_0x504a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x504a('0x1'));var jsonpatch=require(_0x504a('0x2'));var rp=require(_0x504a('0x3'));var moment=require('moment');var BPromise=require(_0x504a('0x4'));var Mustache=require(_0x504a('0x5'));var util=require('util');var path=require('path');var sox=require(_0x504a('0x6'));var csv=require(_0x504a('0x7'));var ejs=require(_0x504a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x504a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x504a('0xa'));var deskjs=require(_0x504a('0xb'));var toCsv=require(_0x504a('0x7'));var querystring=require(_0x504a('0xc'));var Papa=require('papaparse');var Redis=require(_0x504a('0xd'));var authService=require(_0x504a('0xe'));var qs=require(_0x504a('0xf'));var as=require(_0x504a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x504a('0x11'))(_0x504a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x504a('0x13'));var db=require(_0x504a('0x14'))['db'];function respondWithStatusCode(_0x47f18f,_0x4f81ad){_0x4f81ad=_0x4f81ad||0xcc;return function(_0x5e9d82){if(_0x5e9d82){return _0x47f18f['sendStatus'](_0x4f81ad);}return _0x47f18f[_0x504a('0x15')](_0x4f81ad)[_0x504a('0x16')]();};}function respondWithResult(_0x402630,_0x35d5a6){_0x35d5a6=_0x35d5a6||0xc8;return function(_0xb304a2){if(_0xb304a2){return _0x402630['status'](_0x35d5a6)['json'](_0xb304a2);}};}function respondWithFilteredResult(_0x104659,_0x450ec4){return function(_0x399227){if(_0x399227){var _0xe4a226=typeof _0x450ec4['offset']===_0x504a('0x17')&&typeof _0x450ec4[_0x504a('0x18')]===_0x504a('0x17');var _0x161381=_0x399227[_0x504a('0x19')];var _0x1f3b58=_0xe4a226?0x0:_0x450ec4['offset'];var _0x1c35f9=_0xe4a226?_0x399227['count']:_0x450ec4[_0x504a('0x1a')]+_0x450ec4['limit'];var _0xc8f1c9;if(_0x1c35f9>=_0x161381){_0x1c35f9=_0x161381;_0xc8f1c9=0xc8;}else{_0xc8f1c9=0xce;}_0x104659['status'](_0xc8f1c9);return _0x104659['set'](_0x504a('0x1b'),_0x1f3b58+'-'+_0x1c35f9+'/'+_0x161381)[_0x504a('0x1c')](_0x399227);}return null;};}function patchUpdates(_0x19ba63){return function(_0x5c3b82){try{jsonpatch[_0x504a('0x1d')](_0x5c3b82,_0x19ba63,!![]);}catch(_0x25d44a){return BPromise[_0x504a('0x1e')](_0x25d44a);}return _0x5c3b82[_0x504a('0x1f')]();};}function saveUpdates(_0xf17a6e,_0x45a12f){return function(_0x268ae6){if(_0x268ae6){return _0x268ae6['update'](_0xf17a6e)['then'](function(_0x1129b7){return _0x1129b7;});}return null;};}function removeEntity(_0x3f090c,_0x5d76f8){return function(_0x586c3d){if(_0x586c3d){return _0x586c3d[_0x504a('0x20')]()[_0x504a('0x21')](function(){_0x3f090c['status'](0xcc)[_0x504a('0x16')]();});}};}function handleEntityNotFound(_0x59e1a2,_0x37e193){return function(_0x5630b1){if(!_0x5630b1){_0x59e1a2['sendStatus'](0x194);}return _0x5630b1;};}function handleError(_0x2881d0,_0x345bb2){_0x345bb2=_0x345bb2||0x1f4;return function(_0x3e5c0c){logger[_0x504a('0x22')](_0x3e5c0c[_0x504a('0x23')]);if(_0x3e5c0c[_0x504a('0x24')]){delete _0x3e5c0c['name'];}_0x2881d0['status'](_0x345bb2)[_0x504a('0x25')](_0x3e5c0c);};}exports['index']=function(_0x20f907,_0x35248f){var _0x182e74={},_0x49960d={},_0x4627d7={'count':0x0,'rows':[]};var _0x32053f=_[_0x504a('0x26')](db[_0x504a('0x27')][_0x504a('0x28')],function(_0x2e972f){return{'name':_0x2e972f[_0x504a('0x29')],'type':_0x2e972f['type'][_0x504a('0x2a')]};});_0x49960d[_0x504a('0x2b')]=_[_0x504a('0x26')](_0x32053f,_0x504a('0x24'));_0x49960d[_0x504a('0x2c')]=_[_0x504a('0x2d')](_0x20f907[_0x504a('0x2c')]);_0x49960d[_0x504a('0x2e')]=_[_0x504a('0x2f')](_0x49960d[_0x504a('0x2b')],_0x49960d[_0x504a('0x2c')]);_0x182e74[_0x504a('0x30')]=_[_0x504a('0x2f')](_0x49960d[_0x504a('0x2b')],qs[_0x504a('0x31')](_0x20f907['query'][_0x504a('0x31')]));_0x182e74[_0x504a('0x30')]=_0x182e74[_0x504a('0x30')]['length']?_0x182e74[_0x504a('0x30')]:_0x49960d[_0x504a('0x2b')];if(!_0x20f907[_0x504a('0x2c')][_0x504a('0x32')]('nolimit')){_0x182e74[_0x504a('0x18')]=qs[_0x504a('0x18')](_0x20f907['query'][_0x504a('0x18')]);_0x182e74['offset']=qs['offset'](_0x20f907['query'][_0x504a('0x1a')]);}_0x182e74[_0x504a('0x33')]=qs[_0x504a('0x34')](_0x20f907[_0x504a('0x2c')][_0x504a('0x34')]);_0x182e74[_0x504a('0x35')]=qs[_0x504a('0x2e')](_[_0x504a('0x36')](_0x20f907[_0x504a('0x2c')],_0x49960d[_0x504a('0x2e')]),_0x32053f);if(_0x20f907['query'][_0x504a('0x37')]){_0x182e74[_0x504a('0x35')]=_[_0x504a('0x38')](_0x182e74[_0x504a('0x35')],{'$or':_[_0x504a('0x26')](_0x32053f,function(_0x1caf5a){if(_0x1caf5a[_0x504a('0x39')]!==_0x504a('0x3a')){var _0x55571c={};_0x55571c[_0x1caf5a[_0x504a('0x24')]]={'$like':'%'+_0x20f907[_0x504a('0x2c')][_0x504a('0x37')]+'%'};return _0x55571c;}})});}_0x182e74=_[_0x504a('0x38')]({},_0x182e74,_0x20f907['options']);var _0x13c6aa={'where':_0x182e74[_0x504a('0x35')]};return db['Migration'][_0x504a('0x19')](_0x13c6aa)[_0x504a('0x21')](function(_0x57289d){_0x4627d7[_0x504a('0x19')]=_0x57289d;if(_0x20f907[_0x504a('0x2c')][_0x504a('0x3b')]){_0x182e74[_0x504a('0x3c')]=[{'all':!![]}];}return db[_0x504a('0x27')]['findAll'](_0x182e74);})[_0x504a('0x21')](function(_0x38b4e5){_0x4627d7[_0x504a('0x3d')]=_0x38b4e5;return _0x4627d7;})[_0x504a('0x21')](respondWithFilteredResult(_0x35248f,_0x182e74))['catch'](handleError(_0x35248f,null));}; \ No newline at end of file +var _0xafab=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','Migration','rawAttributes','fieldName','type','map','query','keys','filters','attributes','intersection','fields','length','model','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x12d7b7,_0x12b621){var _0x2a675b=function(_0x6c047e){while(--_0x6c047e){_0x12d7b7['push'](_0x12d7b7['shift']());}};_0x2a675b(++_0x12b621);}(_0xafab,0xbc));var _0xbafa=function(_0x1b1c60,_0x12dc93){_0x1b1c60=_0x1b1c60-0x0;var _0x123cfe=_0xafab[_0x1b1c60];return _0x123cfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbafa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbafa('0x1'));var rp=require('request-promise');var moment=require(_0xbafa('0x2'));var BPromise=require(_0xbafa('0x3'));var Mustache=require(_0xbafa('0x4'));var util=require(_0xbafa('0x5'));var path=require(_0xbafa('0x6'));var sox=require(_0xbafa('0x7'));var csv=require('to-csv');var ejs=require(_0xbafa('0x8'));var fs=require('fs');var fs_extra=require(_0xbafa('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbafa('0xa'));var jsforce=require(_0xbafa('0xb'));var deskjs=require(_0xbafa('0xc'));var toCsv=require(_0xbafa('0xd'));var querystring=require(_0xbafa('0xe'));var Papa=require(_0xbafa('0xf'));var Redis=require('ioredis');var authService=require(_0xbafa('0x10'));var qs=require(_0xbafa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbafa('0x12'))('api');var utils=require(_0xbafa('0x13'));var config=require(_0xbafa('0x14'));var licenseUtil=require(_0xbafa('0x15'));var db=require(_0xbafa('0x16'))['db'];function respondWithStatusCode(_0x3eaaa3,_0x21b210){_0x21b210=_0x21b210||0xcc;return function(_0x33c01b){if(_0x33c01b){return _0x3eaaa3['sendStatus'](_0x21b210);}return _0x3eaaa3['status'](_0x21b210)[_0xbafa('0x17')]();};}function respondWithResult(_0x13026c,_0x1c5842){_0x1c5842=_0x1c5842||0xc8;return function(_0x4ddf4a){if(_0x4ddf4a){return _0x13026c['status'](_0x1c5842)[_0xbafa('0x18')](_0x4ddf4a);}};}function respondWithFilteredResult(_0x3228b1,_0x86472e){return function(_0x2f8451){if(_0x2f8451){var _0x1946b7=typeof _0x86472e['offset']===_0xbafa('0x19')&&typeof _0x86472e[_0xbafa('0x1a')]===_0xbafa('0x19');var _0x2f5450=_0x2f8451[_0xbafa('0x1b')];var _0x5e90de=_0x1946b7?0x0:_0x86472e['offset'];var _0x3ffc0d=_0x1946b7?_0x2f8451['count']:_0x86472e[_0xbafa('0x1c')]+_0x86472e['limit'];var _0x28beb5;if(_0x3ffc0d>=_0x2f5450){_0x3ffc0d=_0x2f5450;_0x28beb5=0xc8;}else{_0x28beb5=0xce;}_0x3228b1[_0xbafa('0x1d')](_0x28beb5);return _0x3228b1[_0xbafa('0x1e')](_0xbafa('0x1f'),_0x5e90de+'-'+_0x3ffc0d+'/'+_0x2f5450)[_0xbafa('0x18')](_0x2f8451);}return null;};}function patchUpdates(_0xf64923){return function(_0x40a066){try{jsonpatch[_0xbafa('0x20')](_0x40a066,_0xf64923,!![]);}catch(_0x1a4a80){return BPromise[_0xbafa('0x21')](_0x1a4a80);}return _0x40a066[_0xbafa('0x22')]();};}function saveUpdates(_0x194041,_0x6b73be){return function(_0xb05e3){if(_0xb05e3){return _0xb05e3[_0xbafa('0x23')](_0x194041)[_0xbafa('0x24')](function(_0x51839b){return _0x51839b;});}return null;};}function removeEntity(_0x3aaeda,_0x38d6e4){return function(_0x4217f7){if(_0x4217f7){return _0x4217f7[_0xbafa('0x25')]()[_0xbafa('0x24')](function(){_0x3aaeda[_0xbafa('0x1d')](0xcc)[_0xbafa('0x17')]();});}};}function handleEntityNotFound(_0x2a69a0,_0x77f542){return function(_0x20b4cf){if(!_0x20b4cf){_0x2a69a0['sendStatus'](0x194);}return _0x20b4cf;};}function handleError(_0x16389f,_0x2403f9){_0x2403f9=_0x2403f9||0x1f4;return function(_0x52c4b5){logger['error'](_0x52c4b5[_0xbafa('0x26')]);if(_0x52c4b5['name']){delete _0x52c4b5[_0xbafa('0x27')];}_0x16389f[_0xbafa('0x1d')](_0x2403f9)['send'](_0x52c4b5);};}exports[_0xbafa('0x28')]=function(_0x39426a,_0x4f8c9c){var _0x2767c1={},_0x514699={},_0x462496={'count':0x0,'rows':[]};var _0x5bb6c0=_['map'](db[_0xbafa('0x29')][_0xbafa('0x2a')],function(_0x2ac83f){return{'name':_0x2ac83f[_0xbafa('0x2b')],'type':_0x2ac83f[_0xbafa('0x2c')]['key']};});_0x514699['model']=_[_0xbafa('0x2d')](_0x5bb6c0,_0xbafa('0x27'));_0x514699[_0xbafa('0x2e')]=_[_0xbafa('0x2f')](_0x39426a[_0xbafa('0x2e')]);_0x514699[_0xbafa('0x30')]=_['intersection'](_0x514699['model'],_0x514699['query']);_0x2767c1[_0xbafa('0x31')]=_[_0xbafa('0x32')](_0x514699['model'],qs[_0xbafa('0x33')](_0x39426a[_0xbafa('0x2e')][_0xbafa('0x33')]));_0x2767c1[_0xbafa('0x31')]=_0x2767c1[_0xbafa('0x31')][_0xbafa('0x34')]?_0x2767c1[_0xbafa('0x31')]:_0x514699[_0xbafa('0x35')];if(!_0x39426a['query']['hasOwnProperty'](_0xbafa('0x36'))){_0x2767c1[_0xbafa('0x1a')]=qs[_0xbafa('0x1a')](_0x39426a[_0xbafa('0x2e')][_0xbafa('0x1a')]);_0x2767c1[_0xbafa('0x1c')]=qs[_0xbafa('0x1c')](_0x39426a[_0xbafa('0x2e')][_0xbafa('0x1c')]);}_0x2767c1[_0xbafa('0x37')]=qs[_0xbafa('0x38')](_0x39426a[_0xbafa('0x2e')][_0xbafa('0x38')]);_0x2767c1[_0xbafa('0x39')]=qs['filters'](_[_0xbafa('0x3a')](_0x39426a['query'],_0x514699[_0xbafa('0x30')]),_0x5bb6c0);if(_0x39426a['query'][_0xbafa('0x3b')]){_0x2767c1['where']=_[_0xbafa('0x3c')](_0x2767c1[_0xbafa('0x39')],{'$or':_[_0xbafa('0x2d')](_0x5bb6c0,function(_0x35fe37){if(_0x35fe37['type']!==_0xbafa('0x3d')){var _0x3cd3f7={};_0x3cd3f7[_0x35fe37[_0xbafa('0x27')]]={'$like':'%'+_0x39426a[_0xbafa('0x2e')]['filter']+'%'};return _0x3cd3f7;}})});}_0x2767c1=_[_0xbafa('0x3c')]({},_0x2767c1,_0x39426a[_0xbafa('0x3e')]);var _0xab9b84={'where':_0x2767c1[_0xbafa('0x39')]};return db[_0xbafa('0x29')][_0xbafa('0x1b')](_0xab9b84)[_0xbafa('0x24')](function(_0x460a4b){_0x462496['count']=_0x460a4b;if(_0x39426a[_0xbafa('0x2e')][_0xbafa('0x3f')]){_0x2767c1[_0xbafa('0x40')]=[{'all':!![]}];}return db[_0xbafa('0x29')]['findAll'](_0x2767c1);})[_0xbafa('0x24')](function(_0x3c4f10){_0x462496['rows']=_0x3c4f10;return _0x462496;})[_0xbafa('0x24')](respondWithFilteredResult(_0x4f8c9c,_0x2767c1))[_0xbafa('0x41')](handleError(_0x4f8c9c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a44d299..791a441 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 _0x3830=['migrations','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','Migration'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x3830,0x12a));var _0x0383=function(_0x2e409e,_0x2d227e){_0x2e409e=_0x2e409e-0x0;var _0xe6e039=_0x3830[_0x2e409e];return _0xe6e039;};'use strict';var _=require('lodash');var util=require(_0x0383('0x0'));var logger=require(_0x0383('0x1'))(_0x0383('0x2'));var moment=require(_0x0383('0x3'));var BPromise=require(_0x0383('0x4'));var rp=require(_0x0383('0x5'));var fs=require('fs');var path=require(_0x0383('0x6'));var rimraf=require('rimraf');var config=require(_0x0383('0x7'));var attributes=require('./migration.attributes');module[_0x0383('0x8')]=function(_0x57cb3d,_0x49b507){return _0x57cb3d['define'](_0x0383('0x9'),attributes,{'tableName':_0x0383('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e94=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Migration','migrations','lodash','../../config/logger','api','moment'];(function(_0xb2371a,_0x5f19ec){var _0x5cd178=function(_0x476c6c){while(--_0x476c6c){_0xb2371a['push'](_0xb2371a['shift']());}};_0x5cd178(++_0x5f19ec);}(_0x8e94,0x7e));var _0x48e9=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x8e94[_0x382a62];return _0x490a25;};'use strict';var _=require(_0x48e9('0x0'));var util=require('util');var logger=require(_0x48e9('0x1'))(_0x48e9('0x2'));var moment=require(_0x48e9('0x3'));var BPromise=require(_0x48e9('0x4'));var rp=require(_0x48e9('0x5'));var fs=require('fs');var path=require(_0x48e9('0x6'));var rimraf=require(_0x48e9('0x7'));var config=require(_0x48e9('0x8'));var attributes=require('./migration.attributes');module[_0x48e9('0x9')]=function(_0x2406a4,_0x342f47){return _0x2406a4[_0x48e9('0xa')](_0x48e9('0xb'),attributes,{'tableName':_0x48e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 775ffaa..8c2ddda 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 _0xc94f=['../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Migration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis'];(function(_0x5c0f9d,_0x3750a1){var _0x4fe4af=function(_0x4c73be){while(--_0x4c73be){_0x5c0f9d['push'](_0x5c0f9d['shift']());}};_0x4fe4af(++_0x3750a1);}(_0xc94f,0xcd));var _0xfc94=function(_0x367253,_0x15d9fb){_0x367253=_0x367253-0x0;var _0x150e8e=_0xc94f[_0x367253];return _0x150e8e;};'use strict';var _=require(_0xfc94('0x0'));var util=require('util');var moment=require(_0xfc94('0x1'));var BPromise=require(_0xfc94('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc94('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc94('0x4'));var logger=require(_0xfc94('0x5'))(_0xfc94('0x6'));var config=require(_0xfc94('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x402ee9,_0xff28ad,_0x4dc395){return new BPromise(function(_0xe044e8,_0x47afb8){return client[_0xfc94('0x8')](_0x402ee9,_0x4dc395)[_0xfc94('0x9')](function(_0x4212af){logger[_0xfc94('0xa')]('Migration,\x20%s,\x20%s',_0xff28ad,'request\x20sent');logger[_0xfc94('0xb')](_0xfc94('0xc'),_0xff28ad,_0xfc94('0xd'),JSON[_0xfc94('0xe')](_0x4212af));if(_0x4212af[_0xfc94('0xf')]){if(_0x4212af[_0xfc94('0xf')]['code']===0x1f4){logger['error'](_0xfc94('0x10'),_0xff28ad,_0x4212af[_0xfc94('0xf')][_0xfc94('0x11')]);return _0x47afb8(_0x4212af[_0xfc94('0xf')]['message']);}logger[_0xfc94('0xf')](_0xfc94('0x10'),_0xff28ad,_0x4212af[_0xfc94('0xf')][_0xfc94('0x11')]);return _0xe044e8(_0x4212af[_0xfc94('0xf')]['message']);}else{logger[_0xfc94('0xa')]('Migration,\x20%s,\x20%s',_0xff28ad,_0xfc94('0xd'));_0xe044e8(_0x4212af['result'][_0xfc94('0x11')]);}})[_0xfc94('0x12')](function(_0x2f7bd6){logger['error'](_0xfc94('0x10'),_0xff28ad,_0x2f7bd6);_0x47afb8(_0x2f7bd6);});});} \ No newline at end of file +var _0xb48d=['Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s'];(function(_0x55454f,_0x221c1d){var _0xbb1441=function(_0x121371){while(--_0x121371){_0x55454f['push'](_0x55454f['shift']());}};_0xbb1441(++_0x221c1d);}(_0xb48d,0x194));var _0xdb48=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb48d[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xdb48('0x0'));var util=require('util');var moment=require(_0xdb48('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb48('0x2'));var fs=require('fs');var Redis=require(_0xdb48('0x3'));var db=require(_0xdb48('0x4'))['db'];var utils=require(_0xdb48('0x5'));var logger=require('../../config/logger')(_0xdb48('0x6'));var config=require('../../config/environment');var jayson=require(_0xdb48('0x7'));var client=jayson[_0xdb48('0x8')][_0xdb48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5db721,_0x4e834c,_0x251ce5){return new BPromise(function(_0x173933,_0x5f2b47){return client[_0xdb48('0xa')](_0x5db721,_0x251ce5)[_0xdb48('0xb')](function(_0x4ddac8){logger[_0xdb48('0xc')](_0xdb48('0xd'),_0x4e834c,'request\x20sent');logger['debug'](_0xdb48('0xe'),_0x4e834c,_0xdb48('0xf'),JSON[_0xdb48('0x10')](_0x4ddac8));if(_0x4ddac8['error']){if(_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x12')]===0x1f4){logger['error'](_0xdb48('0xd'),_0x4e834c,_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x13')]);return _0x5f2b47(_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x13')]);}logger[_0xdb48('0x11')]('Migration,\x20%s,\x20%s',_0x4e834c,_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x13')]);return _0x173933(_0x4ddac8[_0xdb48('0x11')]['message']);}else{logger[_0xdb48('0xc')]('Migration,\x20%s,\x20%s',_0x4e834c,_0xdb48('0xf'));_0x173933(_0x4ddac8[_0xdb48('0x14')][_0xdb48('0x13')]);}})[_0xdb48('0x15')](function(_0x43c3ad){logger['error']('Migration,\x20%s,\x20%s',_0x4e834c,_0x43c3ad);_0x5f2b47(_0x43c3ad);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 006fd49..a88b388 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 _0x87e5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x5c2320,_0x543863){var _0x50d333=function(_0x474731){while(--_0x474731){_0x5c2320['push'](_0x5c2320['shift']());}};_0x50d333(++_0x543863);}(_0x87e5,0xc1));var _0x587e=function(_0x4f1ee6,_0x3a0ac1){_0x4f1ee6=_0x4f1ee6-0x0;var _0x331ef3=_0x87e5[_0x4f1ee6];return _0x331ef3;};'use strict';var multer=require(_0x587e('0x0'));var util=require(_0x587e('0x1'));var path=require('path');var timeout=require(_0x587e('0x2'));var express=require(_0x587e('0x3'));var router=express['Router']();var fs_extra=require(_0x587e('0x4'));var auth=require(_0x587e('0x5'));var interaction=require(_0x587e('0x6'));var config=require(_0x587e('0x7'));var controller=require(_0x587e('0x8'));router[_0x587e('0x9')]('/',auth['isAuthenticated'](),controller[_0x587e('0xa')]);router[_0x587e('0x9')](_0x587e('0xb'),auth[_0x587e('0xc')](),controller[_0x587e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x587e('0xc')](),controller[_0x587e('0xe')]);router[_0x587e('0xf')](_0x587e('0xb'),auth[_0x587e('0xc')](),controller[_0x587e('0x10')]);module[_0x587e('0x11')]=router; \ No newline at end of file +var _0x5957=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x3367e4,_0x3aea61){var _0x1401c6=function(_0xec2e1c){while(--_0xec2e1c){_0x3367e4['push'](_0x3367e4['shift']());}};_0x1401c6(++_0x3aea61);}(_0x5957,0x158));var _0x7595=function(_0x2a2a0e,_0x251c7e){_0x2a2a0e=_0x2a2a0e-0x0;var _0xc0c168=_0x5957[_0x2a2a0e];return _0xc0c168;};'use strict';var multer=require(_0x7595('0x0'));var util=require(_0x7595('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7595('0x2'));var router=express['Router']();var fs_extra=require(_0x7595('0x3'));var auth=require(_0x7595('0x4'));var interaction=require(_0x7595('0x5'));var config=require(_0x7595('0x6'));var controller=require(_0x7595('0x7'));router[_0x7595('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7595('0x8')](_0x7595('0x9'),auth['isAuthenticated'](),controller[_0x7595('0xa')]);router[_0x7595('0xb')]('/',auth[_0x7595('0xc')](),controller[_0x7595('0xd')]);router[_0x7595('0xe')](_0x7595('0x9'),auth['isAuthenticated'](),controller[_0x7595('0xf')]);router[_0x7595('0x10')](_0x7595('0x9'),auth[_0x7595('0xc')](),controller[_0x7595('0x11')]);module[_0x7595('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index dcfd9b8..2f4347c 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 _0x9e21=['stun','turn','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0x5af71b,_0x49f005){var _0x2bc83e=function(_0x14e999){while(--_0x14e999){_0x5af71b['push'](_0x5af71b['shift']());}};_0x2bc83e(++_0x49f005);}(_0x9e21,0x113));var _0x19e2=function(_0x75dc87,_0x6be1f2){_0x75dc87=_0x75dc87-0x0;var _0x24b41d=_0x9e21[_0x75dc87];return _0x24b41d;};'use strict';var Sequelize=require(_0x19e2('0x0'));module[_0x19e2('0x1')]={'type':{'type':Sequelize[_0x19e2('0x2')](_0x19e2('0x3'),_0x19e2('0x4'),_0x19e2('0x5'),_0x19e2('0x6'))},'value':{'type':Sequelize[_0x19e2('0x7')]},'username':{'type':Sequelize[_0x19e2('0x7')]},'password':{'type':Sequelize[_0x19e2('0x7')]}}; \ No newline at end of file +var _0xdd1a=['ENUM','localnet','externip','stun','STRING','sequelize','exports'];(function(_0x1f4639,_0x67d565){var _0x41efa4=function(_0x305f37){while(--_0x305f37){_0x1f4639['push'](_0x1f4639['shift']());}};_0x41efa4(++_0x67d565);}(_0xdd1a,0x155));var _0xadd1=function(_0x110e82,_0x577d3e){_0x110e82=_0x110e82-0x0;var _0xcced2a=_0xdd1a[_0x110e82];return _0xcced2a;};'use strict';var Sequelize=require(_0xadd1('0x0'));module[_0xadd1('0x1')]={'type':{'type':Sequelize[_0xadd1('0x2')](_0xadd1('0x3'),_0xadd1('0x4'),_0xadd1('0x5'),'turn')},'value':{'type':Sequelize[_0xadd1('0x6')]},'username':{'type':Sequelize[_0xadd1('0x6')]},'password':{'type':Sequelize[_0xadd1('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 5f04a1b..5d00144 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 _0x1155=['map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Network','includeAll','include','findAll','show','params','rawAttributes','fields','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','TURN','format','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','http','then','info','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','stack','name','index','fieldName','type','key','model'];(function(_0x167e93,_0x4c12c6){var _0x4390fe=function(_0x30fe05){while(--_0x30fe05){_0x167e93['push'](_0x167e93['shift']());}};_0x4390fe(++_0x4c12c6);}(_0x1155,0x1dd));var _0x5115=function(_0x33f68b,_0x4ae870){_0x33f68b=_0x33f68b-0x0;var _0x557c04=_0x1155[_0x33f68b];return _0x557c04;};'use strict';var emlformat=require(_0x5115('0x0'));var rimraf=require(_0x5115('0x1'));var zipdir=require(_0x5115('0x2'));var jsonpatch=require(_0x5115('0x3'));var rp=require(_0x5115('0x4'));var moment=require(_0x5115('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5115('0x6'));var util=require(_0x5115('0x7'));var path=require(_0x5115('0x8'));var sox=require(_0x5115('0x9'));var csv=require(_0x5115('0xa'));var ejs=require(_0x5115('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5115('0xc'));var jsforce=require(_0x5115('0xd'));var deskjs=require(_0x5115('0xe'));var toCsv=require(_0x5115('0xa'));var querystring=require(_0x5115('0xf'));var Papa=require(_0x5115('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5115('0x11'));var as=require(_0x5115('0x12'));var hardwareService=require(_0x5115('0x13'));var logger=require(_0x5115('0x14'))(_0x5115('0x15'));var utils=require(_0x5115('0x16'));var config=require(_0x5115('0x17'));var licenseUtil=require(_0x5115('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x5115('0x19')][_0x5115('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5092ee,_0x41a6e0,_0x4df1c8,_0x2be779){return new BPromise(function(_0x5a1fa6,_0x72bc56){var _0x4666e2=_0x2be779||client;return _0x4666e2['request'](_0x5092ee,_0x4df1c8)[_0x5115('0x1b')](function(_0x3bc897){logger[_0x5115('0x1c')]('Network,\x20%s,\x20%s',_0x41a6e0,'request\x20sent');logger[_0x5115('0x1d')](_0x5115('0x1e'),_0x41a6e0,_0x5115('0x1f'),JSON['stringify'](_0x3bc897));if(_0x3bc897[_0x5115('0x20')]){if(_0x3bc897[_0x5115('0x20')]['code']===0x1f4){logger[_0x5115('0x20')](_0x5115('0x21'),_0x41a6e0,_0x3bc897[_0x5115('0x20')][_0x5115('0x22')]);return _0x72bc56(_0x3bc897['error'][_0x5115('0x22')]);}logger['error']('Network,\x20%s,\x20%s',_0x41a6e0,_0x3bc897[_0x5115('0x20')]['message']);return _0x5a1fa6(_0x3bc897[_0x5115('0x20')][_0x5115('0x22')]);}else{logger['info'](_0x5115('0x21'),_0x41a6e0,_0x5115('0x1f'));_0x5a1fa6(_0x3bc897[_0x5115('0x23')]['message']);}})[_0x5115('0x24')](function(_0x5926b8){logger['error']('Network,\x20%s,\x20%s',_0x41a6e0,_0x5926b8);_0x72bc56(_0x5926b8);});});}function respondWithStatusCode(_0x5ca073,_0x48188a){_0x48188a=_0x48188a||0xcc;return function(_0x1ed148){if(_0x1ed148){return _0x5ca073[_0x5115('0x25')](_0x48188a);}return _0x5ca073[_0x5115('0x26')](_0x48188a)[_0x5115('0x27')]();};}function respondWithResult(_0x1deb75,_0x1dfa71){_0x1dfa71=_0x1dfa71||0xc8;return function(_0x4bd892){if(_0x4bd892){return _0x1deb75[_0x5115('0x26')](_0x1dfa71)[_0x5115('0x28')](_0x4bd892);}};}function respondWithFilteredResult(_0x1976fb,_0x542959){return function(_0x550d59){if(_0x550d59){var _0x200da8=typeof _0x542959[_0x5115('0x29')]===_0x5115('0x2a')&&typeof _0x542959['limit']===_0x5115('0x2a');var _0x2746c2=_0x550d59[_0x5115('0x2b')];var _0x39927f=_0x200da8?0x0:_0x542959[_0x5115('0x29')];var _0x37704e=_0x200da8?_0x550d59[_0x5115('0x2b')]:_0x542959[_0x5115('0x29')]+_0x542959[_0x5115('0x2c')];var _0x54a503;if(_0x37704e>=_0x2746c2){_0x37704e=_0x2746c2;_0x54a503=0xc8;}else{_0x54a503=0xce;}_0x1976fb[_0x5115('0x26')](_0x54a503);return _0x1976fb[_0x5115('0x2d')](_0x5115('0x2e'),_0x39927f+'-'+_0x37704e+'/'+_0x2746c2)[_0x5115('0x28')](_0x550d59);}return null;};}function patchUpdates(_0xe068f6){return function(_0x40d718){try{jsonpatch[_0x5115('0x2f')](_0x40d718,_0xe068f6,!![]);}catch(_0x115567){return BPromise[_0x5115('0x30')](_0x115567);}return _0x40d718['save']();};}function saveUpdates(_0x216bb5,_0x256826){return function(_0x28b6a2){if(_0x28b6a2){return _0x28b6a2[_0x5115('0x31')](_0x216bb5)['then'](function(_0x13ebda){return _0x13ebda;});}return null;};}function removeEntity(_0x46f20e,_0x1d0a2d){return function(_0x2474f6){if(_0x2474f6){return _0x2474f6[_0x5115('0x32')]()[_0x5115('0x1b')](function(){_0x46f20e['status'](0xcc)[_0x5115('0x27')]();});}};}function handleEntityNotFound(_0x1cba8e,_0x4f19c5){return function(_0x497b6){if(!_0x497b6){_0x1cba8e['sendStatus'](0x194);}return _0x497b6;};}function handleError(_0x39ca60,_0x5b0c58){_0x5b0c58=_0x5b0c58||0x1f4;return function(_0x1fdef6){logger[_0x5115('0x20')](_0x1fdef6[_0x5115('0x33')]);if(_0x1fdef6['name']){delete _0x1fdef6[_0x5115('0x34')];}_0x39ca60[_0x5115('0x26')](_0x5b0c58)['send'](_0x1fdef6);};}exports[_0x5115('0x35')]=function(_0x49473d,_0x1b411e){var _0x48fc15={},_0x3b6503={},_0x3a5f6b={'count':0x0,'rows':[]};var _0x36e8e2=_['map'](db['Network']['rawAttributes'],function(_0xc354d5){return{'name':_0xc354d5[_0x5115('0x36')],'type':_0xc354d5[_0x5115('0x37')][_0x5115('0x38')]};});_0x3b6503[_0x5115('0x39')]=_[_0x5115('0x3a')](_0x36e8e2,_0x5115('0x34'));_0x3b6503[_0x5115('0x3b')]=_[_0x5115('0x3c')](_0x49473d['query']);_0x3b6503[_0x5115('0x3d')]=_['intersection'](_0x3b6503[_0x5115('0x39')],_0x3b6503['query']);_0x48fc15[_0x5115('0x3e')]=_[_0x5115('0x3f')](_0x3b6503['model'],qs['fields'](_0x49473d[_0x5115('0x3b')]['fields']));_0x48fc15[_0x5115('0x3e')]=_0x48fc15['attributes'][_0x5115('0x40')]?_0x48fc15[_0x5115('0x3e')]:_0x3b6503['model'];if(!_0x49473d[_0x5115('0x3b')][_0x5115('0x41')](_0x5115('0x42'))){_0x48fc15[_0x5115('0x2c')]=qs[_0x5115('0x2c')](_0x49473d[_0x5115('0x3b')][_0x5115('0x2c')]);_0x48fc15['offset']=qs[_0x5115('0x29')](_0x49473d[_0x5115('0x3b')][_0x5115('0x29')]);}_0x48fc15['order']=qs[_0x5115('0x43')](_0x49473d[_0x5115('0x3b')]['sort']);_0x48fc15[_0x5115('0x44')]=qs[_0x5115('0x3d')](_[_0x5115('0x45')](_0x49473d[_0x5115('0x3b')],_0x3b6503[_0x5115('0x3d')]),_0x36e8e2);if(_0x49473d['query'][_0x5115('0x46')]){_0x48fc15[_0x5115('0x44')]=_['merge'](_0x48fc15['where'],{'$or':_[_0x5115('0x3a')](_0x36e8e2,function(_0xd611ef){if(_0xd611ef[_0x5115('0x37')]!==_0x5115('0x47')){var _0x410a41={};_0x410a41[_0xd611ef[_0x5115('0x34')]]={'$like':'%'+_0x49473d['query']['filter']+'%'};return _0x410a41;}})});}_0x48fc15=_[_0x5115('0x48')]({},_0x48fc15,_0x49473d[_0x5115('0x49')]);var _0x24fa48={'where':_0x48fc15[_0x5115('0x44')]};return db[_0x5115('0x4a')]['count'](_0x24fa48)[_0x5115('0x1b')](function(_0x989417){_0x3a5f6b[_0x5115('0x2b')]=_0x989417;if(_0x49473d[_0x5115('0x3b')][_0x5115('0x4b')]){_0x48fc15[_0x5115('0x4c')]=[{'all':!![]}];}return db[_0x5115('0x4a')][_0x5115('0x4d')](_0x48fc15);})[_0x5115('0x1b')](function(_0x4c5024){_0x3a5f6b['rows']=_0x4c5024;return _0x3a5f6b;})[_0x5115('0x1b')](respondWithFilteredResult(_0x1b411e,_0x48fc15))['catch'](handleError(_0x1b411e,null));};exports[_0x5115('0x4e')]=function(_0x5a68ba,_0x10589b){var _0x2e0f80={'raw':!![],'where':{'id':_0x5a68ba[_0x5115('0x4f')]['id']}},_0x11a7cb={};_0x11a7cb[_0x5115('0x39')]=_[_0x5115('0x3c')](db[_0x5115('0x4a')][_0x5115('0x50')]);_0x11a7cb[_0x5115('0x3b')]=_[_0x5115('0x3c')](_0x5a68ba[_0x5115('0x3b')]);_0x11a7cb[_0x5115('0x3d')]=_[_0x5115('0x3f')](_0x11a7cb[_0x5115('0x39')],_0x11a7cb[_0x5115('0x3b')]);_0x2e0f80[_0x5115('0x3e')]=_['intersection'](_0x11a7cb['model'],qs[_0x5115('0x51')](_0x5a68ba[_0x5115('0x3b')]['fields']));_0x2e0f80[_0x5115('0x3e')]=_0x2e0f80[_0x5115('0x3e')][_0x5115('0x40')]?_0x2e0f80['attributes']:_0x11a7cb['model'];if(_0x5a68ba[_0x5115('0x3b')]['includeAll']){_0x2e0f80[_0x5115('0x4c')]=[{'all':!![]}];}_0x2e0f80=_[_0x5115('0x48')]({},_0x2e0f80,_0x5a68ba[_0x5115('0x49')]);return db[_0x5115('0x4a')][_0x5115('0x52')](_0x2e0f80)[_0x5115('0x1b')](handleEntityNotFound(_0x10589b,null))[_0x5115('0x1b')](respondWithResult(_0x10589b,null))[_0x5115('0x24')](handleError(_0x10589b,null));};exports[_0x5115('0x53')]=function(_0x1b622c,_0x1446a5,_0x1f3441){var _0x571dac;return db[_0x5115('0x54')][_0x5115('0x55')](function(_0x90a52d){return db[_0x5115('0x4a')][_0x5115('0x53')](_0x1b622c['body'],{'raw':!![]})['then'](function(_0x808751){_0x571dac=_0x808751;return db[_0x5115('0x4a')][_0x5115('0x4d')]({'where':{'type':_0x1b622c[_0x5115('0x56')][_0x5115('0x37')]},'raw':!![]});})[_0x5115('0x1b')](function(_0x46de59){if(_0x571dac[_0x5115('0x37')][_0x5115('0x57')]()==_0x5115('0x58')){var _0xc74495=fs[_0x5115('0x59')](path[_0x5115('0x5a')](config[_0x5115('0x5b')],_0x5115('0x5c')),_0x5115('0x5d'));var _0x2d8371=ejs[_0x5115('0x5e')](_0xc74495,{'networks':_0x46de59||[]});fs['writeFileSync'](_0x5115('0x5f'),_0x2d8371);return respondWithRpcPromise(_0x5115('0x60'),_0x5115('0x53'),{'module':_0x5115('0x61')});}else if(_0x571dac[_0x5115('0x37')][_0x5115('0x57')]()=='TURN'){var _0x20c1fe=fs[_0x5115('0x59')](path[_0x5115('0x5a')](config[_0x5115('0x5b')],_0x5115('0x62')),_0x5115('0x5d'));var _0x366db9=ejs[_0x5115('0x5e')](_0x20c1fe,{'networks':_0x46de59||[]});fs[_0x5115('0x63')]('/etc/asterisk/turn_xcally.conf',_0x366db9);return respondWithRpcPromise('Reload','create',{'module':_0x5115('0x61')});}else{var _0x1ad185=fs[_0x5115('0x59')](path['join'](config[_0x5115('0x5b')],'server/files/templates/network.ejs'),'utf8');var _0x3e9aa9=ejs[_0x5115('0x5e')](_0x1ad185,{'networks':_0x46de59||[]});fs[_0x5115('0x63')](util['format'](_0x5115('0x64'),_0x1b622c[_0x5115('0x56')][_0x5115('0x37')][_0x5115('0x65')]()),_0x3e9aa9);return respondWithRpcPromise('Reload',_0x5115('0x53'),{'module':_0x5115('0x66')});}return null;})[_0x5115('0x1b')](function(){return _0x571dac;});})[_0x5115('0x1b')](respondWithResult(_0x1446a5,0xc9))[_0x5115('0x24')](handleError(_0x1446a5,null));};exports[_0x5115('0x31')]=function(_0x5945f6,_0x5e2abd,_0x2c5bbe){var _0x58708e;return db[_0x5115('0x54')]['transaction'](function(_0x38cb3e){return db[_0x5115('0x4a')][_0x5115('0x52')]({'where':{'id':_0x5945f6['params']['id']}})['then'](handleEntityNotFound(_0x5e2abd,null))[_0x5115('0x1b')](saveUpdates(_0x5945f6[_0x5115('0x56')],null))[_0x5115('0x1b')](function(_0x51b594){if(_0x51b594){_0x58708e=_0x51b594;return db[_0x5115('0x4a')][_0x5115('0x4d')]({'where':{'type':_0x58708e[_0x5115('0x37')]},'raw':!![]});}return null;})[_0x5115('0x1b')](function(_0x460d1f){if(_0x58708e[_0x5115('0x37')][_0x5115('0x57')]()==_0x5115('0x58')){var _0x2b918d=fs[_0x5115('0x59')](path[_0x5115('0x5a')](config[_0x5115('0x5b')],_0x5115('0x5c')),_0x5115('0x5d'));var _0xd4a992=ejs[_0x5115('0x5e')](_0x2b918d,{'networks':_0x460d1f||[]});fs['writeFileSync'](_0x5115('0x5f'),_0xd4a992);return respondWithRpcPromise('Reload','update',{'module':_0x5115('0x61')});}else if(_0x58708e[_0x5115('0x37')]['toUpperCase']()==_0x5115('0x67')){var _0x5f0373=fs[_0x5115('0x59')](path['join'](config[_0x5115('0x5b')],_0x5115('0x62')),_0x5115('0x5d'));var _0x398165=ejs[_0x5115('0x5e')](_0x5f0373,{'networks':_0x460d1f||[]});fs[_0x5115('0x63')]('/etc/asterisk/turn_xcally.conf',_0x398165);return respondWithRpcPromise(_0x5115('0x60'),'update',{'module':_0x5115('0x61')});}else{var _0x2b7caf=fs['readFileSync'](path[_0x5115('0x5a')](config[_0x5115('0x5b')],'server/files/templates/network.ejs'),_0x5115('0x5d'));var _0x234742=ejs[_0x5115('0x5e')](_0x2b7caf,{'networks':_0x460d1f||[]});fs[_0x5115('0x63')](util[_0x5115('0x68')](_0x5115('0x64'),_0x5945f6[_0x5115('0x56')]['type'][_0x5115('0x65')]()),_0x234742);return respondWithRpcPromise(_0x5115('0x60'),_0x5115('0x31'),{'module':_0x5115('0x66')});}return null;})['then'](function(_0x2da470){if(_0x2da470){return _0x58708e;}return null;});})['then'](respondWithResult(_0x5e2abd,null))[_0x5115('0x24')](handleError(_0x5e2abd,null));};exports[_0x5115('0x32')]=function(_0x579508,_0x524f92,_0x267418){var _0x5366ea;return db[_0x5115('0x4a')][_0x5115('0x52')]({'where':{'id':_0x579508[_0x5115('0x4f')]['id']}})[_0x5115('0x1b')](function(_0x6aed2d){_0x5366ea=_0x6aed2d;return _0x6aed2d;})['then'](handleEntityNotFound(_0x524f92,null))[_0x5115('0x1b')](removeEntity(_0x524f92,null))[_0x5115('0x1b')](function(){if(_0x5366ea){return db[_0x5115('0x4a')][_0x5115('0x4d')]({'where':{'type':_0x5366ea[_0x5115('0x37')]},'raw':!![]});}})['then'](function(_0x873a07){if(_0x5366ea[_0x5115('0x37')][_0x5115('0x57')]()==_0x5115('0x58')){var _0x3d773d=fs['readFileSync'](path[_0x5115('0x5a')](config['root'],_0x5115('0x5c')),_0x5115('0x5d'));var _0x9ce926=ejs[_0x5115('0x5e')](_0x3d773d,{'networks':_0x873a07||[]});fs[_0x5115('0x63')]('/etc/asterisk/stun_xcally.conf',_0x9ce926);return respondWithRpcPromise(_0x5115('0x60'),'destroy',{'module':_0x5115('0x61')});}else if(_0x5366ea[_0x5115('0x37')]['toUpperCase']()=='TURN'){var _0xd80dc1=fs[_0x5115('0x59')](path[_0x5115('0x5a')](config[_0x5115('0x5b')],'server/files/templates/turn_multiple.ejs'),_0x5115('0x5d'));var _0x152aa4=ejs['render'](_0xd80dc1,{'networks':_0x873a07||[]});fs[_0x5115('0x63')](_0x5115('0x69'),_0x152aa4);return respondWithRpcPromise(_0x5115('0x60'),_0x5115('0x32'),{'module':_0x5115('0x61')});}else{var _0x2ddb23=fs[_0x5115('0x59')](path[_0x5115('0x5a')](config[_0x5115('0x5b')],_0x5115('0x6a')),'utf8');var _0xdfd918=ejs[_0x5115('0x5e')](_0x2ddb23,{'networks':_0x873a07||[]});fs[_0x5115('0x63')](util[_0x5115('0x68')](_0x5115('0x64'),_0x579508[_0x5115('0x56')][_0x5115('0x37')][_0x5115('0x65')]()),_0xdfd918);return respondWithRpcPromise('Reload',_0x5115('0x32'),{'module':_0x5115('0x66')});}return null;})['catch'](handleError(_0x524f92,null));}; \ No newline at end of file +var _0x40df=['limit','count','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','Network','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','create','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','Reload','server/files/templates/network.ejs','format','body','toLowerCase','chan_sip.so','sequelize','transaction','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined'];(function(_0x34d9d5,_0x876e5c){var _0x2ba11b=function(_0x1eecfe){while(--_0x1eecfe){_0x34d9d5['push'](_0x34d9d5['shift']());}};_0x2ba11b(++_0x876e5c);}(_0x40df,0xaf));var _0xf40d=function(_0x490a33,_0x11d3da){_0x490a33=_0x490a33-0x0;var _0x377c69=_0x40df[_0x490a33];return _0x377c69;};'use strict';var emlformat=require(_0xf40d('0x0'));var rimraf=require(_0xf40d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf40d('0x2'));var rp=require(_0xf40d('0x3'));var moment=require(_0xf40d('0x4'));var BPromise=require(_0xf40d('0x5'));var Mustache=require('mustache');var util=require(_0xf40d('0x6'));var path=require(_0xf40d('0x7'));var sox=require('sox');var csv=require(_0xf40d('0x8'));var ejs=require(_0xf40d('0x9'));var fs=require('fs');var fs_extra=require(_0xf40d('0xa'));var _=require(_0xf40d('0xb'));var squel=require('squel');var crypto=require(_0xf40d('0xc'));var jsforce=require(_0xf40d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf40d('0x8'));var querystring=require('querystring');var Papa=require(_0xf40d('0xe'));var Redis=require(_0xf40d('0xf'));var authService=require(_0xf40d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf40d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf40d('0x12'))(_0xf40d('0x13'));var utils=require('../../config/utils');var config=require(_0xf40d('0x14'));var licenseUtil=require(_0xf40d('0x15'));var db=require(_0xf40d('0x16'))['db'];var jayson=require(_0xf40d('0x17'));var client=jayson['client'][_0xf40d('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x355f29,_0x3f42b9,_0xe9b5ed,_0x53e5da){return new BPromise(function(_0x1a3cd4,_0x19f30a){var _0x51f5f7=_0x53e5da||client;return _0x51f5f7[_0xf40d('0x19')](_0x355f29,_0xe9b5ed)[_0xf40d('0x1a')](function(_0x41cb6c){logger[_0xf40d('0x1b')](_0xf40d('0x1c'),_0x3f42b9,_0xf40d('0x1d'));logger[_0xf40d('0x1e')](_0xf40d('0x1f'),_0x3f42b9,_0xf40d('0x1d'),JSON[_0xf40d('0x20')](_0x41cb6c));if(_0x41cb6c[_0xf40d('0x21')]){if(_0x41cb6c['error'][_0xf40d('0x22')]===0x1f4){logger[_0xf40d('0x21')](_0xf40d('0x1c'),_0x3f42b9,_0x41cb6c['error'][_0xf40d('0x23')]);return _0x19f30a(_0x41cb6c[_0xf40d('0x21')]['message']);}logger[_0xf40d('0x21')](_0xf40d('0x1c'),_0x3f42b9,_0x41cb6c[_0xf40d('0x21')][_0xf40d('0x23')]);return _0x1a3cd4(_0x41cb6c[_0xf40d('0x21')]['message']);}else{logger['info'](_0xf40d('0x1c'),_0x3f42b9,_0xf40d('0x1d'));_0x1a3cd4(_0x41cb6c[_0xf40d('0x24')][_0xf40d('0x23')]);}})[_0xf40d('0x25')](function(_0x10749f){logger[_0xf40d('0x21')]('Network,\x20%s,\x20%s',_0x3f42b9,_0x10749f);_0x19f30a(_0x10749f);});});}function respondWithStatusCode(_0xfc212e,_0x524ac3){_0x524ac3=_0x524ac3||0xcc;return function(_0x164931){if(_0x164931){return _0xfc212e['sendStatus'](_0x524ac3);}return _0xfc212e['status'](_0x524ac3)['end']();};}function respondWithResult(_0x7baa82,_0x355cce){_0x355cce=_0x355cce||0xc8;return function(_0x4f2a60){if(_0x4f2a60){return _0x7baa82[_0xf40d('0x26')](_0x355cce)[_0xf40d('0x27')](_0x4f2a60);}};}function respondWithFilteredResult(_0xafc0b3,_0x5b4bf0){return function(_0x4b7c6a){if(_0x4b7c6a){var _0x34f1f8=typeof _0x5b4bf0['offset']===_0xf40d('0x28')&&typeof _0x5b4bf0[_0xf40d('0x29')]==='undefined';var _0x1c12c6=_0x4b7c6a[_0xf40d('0x2a')];var _0xc5da30=_0x34f1f8?0x0:_0x5b4bf0[_0xf40d('0x2b')];var _0x33fb01=_0x34f1f8?_0x4b7c6a['count']:_0x5b4bf0[_0xf40d('0x2b')]+_0x5b4bf0[_0xf40d('0x29')];var _0x22efa9;if(_0x33fb01>=_0x1c12c6){_0x33fb01=_0x1c12c6;_0x22efa9=0xc8;}else{_0x22efa9=0xce;}_0xafc0b3['status'](_0x22efa9);return _0xafc0b3[_0xf40d('0x2c')](_0xf40d('0x2d'),_0xc5da30+'-'+_0x33fb01+'/'+_0x1c12c6)[_0xf40d('0x27')](_0x4b7c6a);}return null;};}function patchUpdates(_0x245646){return function(_0x2e5ea3){try{jsonpatch[_0xf40d('0x2e')](_0x2e5ea3,_0x245646,!![]);}catch(_0xdb8f22){return BPromise[_0xf40d('0x2f')](_0xdb8f22);}return _0x2e5ea3['save']();};}function saveUpdates(_0x21f520,_0x4ac327){return function(_0x50de94){if(_0x50de94){return _0x50de94[_0xf40d('0x30')](_0x21f520)['then'](function(_0x3380c5){return _0x3380c5;});}return null;};}function removeEntity(_0x91d08e,_0x55a15c){return function(_0xf8dbcb){if(_0xf8dbcb){return _0xf8dbcb[_0xf40d('0x31')]()['then'](function(){_0x91d08e[_0xf40d('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cda6,_0x1321df){return function(_0x5eb43f){if(!_0x5eb43f){_0x39cda6[_0xf40d('0x32')](0x194);}return _0x5eb43f;};}function handleError(_0x5aaa8f,_0x172744){_0x172744=_0x172744||0x1f4;return function(_0x153741){logger['error'](_0x153741[_0xf40d('0x33')]);if(_0x153741[_0xf40d('0x34')]){delete _0x153741['name'];}_0x5aaa8f[_0xf40d('0x26')](_0x172744)[_0xf40d('0x35')](_0x153741);};}exports[_0xf40d('0x36')]=function(_0x54af53,_0x474119){var _0x5d44d7={},_0x4a5f3a={},_0x52fd6a={'count':0x0,'rows':[]};var _0x151cb9=_[_0xf40d('0x37')](db[_0xf40d('0x38')]['rawAttributes'],function(_0x54acd5){return{'name':_0x54acd5[_0xf40d('0x39')],'type':_0x54acd5[_0xf40d('0x3a')][_0xf40d('0x3b')]};});_0x4a5f3a[_0xf40d('0x3c')]=_[_0xf40d('0x37')](_0x151cb9,_0xf40d('0x34'));_0x4a5f3a[_0xf40d('0x3d')]=_[_0xf40d('0x3e')](_0x54af53[_0xf40d('0x3d')]);_0x4a5f3a[_0xf40d('0x3f')]=_['intersection'](_0x4a5f3a[_0xf40d('0x3c')],_0x4a5f3a[_0xf40d('0x3d')]);_0x5d44d7[_0xf40d('0x40')]=_[_0xf40d('0x41')](_0x4a5f3a[_0xf40d('0x3c')],qs[_0xf40d('0x42')](_0x54af53[_0xf40d('0x3d')][_0xf40d('0x42')]));_0x5d44d7['attributes']=_0x5d44d7['attributes'][_0xf40d('0x43')]?_0x5d44d7[_0xf40d('0x40')]:_0x4a5f3a['model'];if(!_0x54af53[_0xf40d('0x3d')][_0xf40d('0x44')](_0xf40d('0x45'))){_0x5d44d7[_0xf40d('0x29')]=qs[_0xf40d('0x29')](_0x54af53[_0xf40d('0x3d')]['limit']);_0x5d44d7[_0xf40d('0x2b')]=qs['offset'](_0x54af53['query'][_0xf40d('0x2b')]);}_0x5d44d7['order']=qs[_0xf40d('0x46')](_0x54af53['query'][_0xf40d('0x46')]);_0x5d44d7[_0xf40d('0x47')]=qs[_0xf40d('0x3f')](_[_0xf40d('0x48')](_0x54af53[_0xf40d('0x3d')],_0x4a5f3a[_0xf40d('0x3f')]),_0x151cb9);if(_0x54af53[_0xf40d('0x3d')][_0xf40d('0x49')]){_0x5d44d7[_0xf40d('0x47')]=_[_0xf40d('0x4a')](_0x5d44d7[_0xf40d('0x47')],{'$or':_[_0xf40d('0x37')](_0x151cb9,function(_0x3fb110){if(_0x3fb110[_0xf40d('0x3a')]!=='VIRTUAL'){var _0x542f6f={};_0x542f6f[_0x3fb110['name']]={'$like':'%'+_0x54af53[_0xf40d('0x3d')][_0xf40d('0x49')]+'%'};return _0x542f6f;}})});}_0x5d44d7=_[_0xf40d('0x4a')]({},_0x5d44d7,_0x54af53[_0xf40d('0x4b')]);var _0x146250={'where':_0x5d44d7[_0xf40d('0x47')]};return db[_0xf40d('0x38')][_0xf40d('0x2a')](_0x146250)[_0xf40d('0x1a')](function(_0x45451c){_0x52fd6a[_0xf40d('0x2a')]=_0x45451c;if(_0x54af53[_0xf40d('0x3d')][_0xf40d('0x4c')]){_0x5d44d7[_0xf40d('0x4d')]=[{'all':!![]}];}return db[_0xf40d('0x38')][_0xf40d('0x4e')](_0x5d44d7);})[_0xf40d('0x1a')](function(_0x2de37f){_0x52fd6a[_0xf40d('0x4f')]=_0x2de37f;return _0x52fd6a;})[_0xf40d('0x1a')](respondWithFilteredResult(_0x474119,_0x5d44d7))['catch'](handleError(_0x474119,null));};exports[_0xf40d('0x50')]=function(_0x5dd3a2,_0x1ef7b0){var _0x416934={'raw':!![],'where':{'id':_0x5dd3a2[_0xf40d('0x51')]['id']}},_0x2ffd59={};_0x2ffd59[_0xf40d('0x3c')]=_[_0xf40d('0x3e')](db[_0xf40d('0x38')][_0xf40d('0x52')]);_0x2ffd59[_0xf40d('0x3d')]=_[_0xf40d('0x3e')](_0x5dd3a2[_0xf40d('0x3d')]);_0x2ffd59[_0xf40d('0x3f')]=_[_0xf40d('0x41')](_0x2ffd59[_0xf40d('0x3c')],_0x2ffd59['query']);_0x416934[_0xf40d('0x40')]=_['intersection'](_0x2ffd59[_0xf40d('0x3c')],qs[_0xf40d('0x42')](_0x5dd3a2['query']['fields']));_0x416934[_0xf40d('0x40')]=_0x416934[_0xf40d('0x40')]['length']?_0x416934[_0xf40d('0x40')]:_0x2ffd59['model'];if(_0x5dd3a2['query'][_0xf40d('0x4c')]){_0x416934[_0xf40d('0x4d')]=[{'all':!![]}];}_0x416934=_['merge']({},_0x416934,_0x5dd3a2[_0xf40d('0x4b')]);return db[_0xf40d('0x38')][_0xf40d('0x53')](_0x416934)[_0xf40d('0x1a')](handleEntityNotFound(_0x1ef7b0,null))[_0xf40d('0x1a')](respondWithResult(_0x1ef7b0,null))['catch'](handleError(_0x1ef7b0,null));};exports['create']=function(_0x2ea3d3,_0x59935e,_0x2479ef){var _0x53dc65;return db['sequelize']['transaction'](function(_0x4503c8){return db[_0xf40d('0x38')]['create'](_0x2ea3d3['body'],{'raw':!![]})[_0xf40d('0x1a')](function(_0x3d57c9){_0x53dc65=_0x3d57c9;return db[_0xf40d('0x38')][_0xf40d('0x4e')]({'where':{'type':_0x2ea3d3['body'][_0xf40d('0x3a')]},'raw':!![]});})[_0xf40d('0x1a')](function(_0x373353){if(_0x53dc65[_0xf40d('0x3a')]['toUpperCase']()==_0xf40d('0x54')){var _0x106800=fs[_0xf40d('0x55')](path[_0xf40d('0x56')](config[_0xf40d('0x57')],_0xf40d('0x58')),_0xf40d('0x59'));var _0x52636a=ejs[_0xf40d('0x5a')](_0x106800,{'networks':_0x373353||[]});fs['writeFileSync'](_0xf40d('0x5b'),_0x52636a);return respondWithRpcPromise('Reload',_0xf40d('0x5c'),{'module':'res_stun_monitor.so'});}else if(_0x53dc65['type'][_0xf40d('0x5d')]()==_0xf40d('0x5e')){var _0x5c9dcc=fs['readFileSync'](path['join'](config[_0xf40d('0x57')],_0xf40d('0x5f')),_0xf40d('0x59'));var _0x56b2a2=ejs[_0xf40d('0x5a')](_0x5c9dcc,{'networks':_0x373353||[]});fs[_0xf40d('0x60')]('/etc/asterisk/turn_xcally.conf',_0x56b2a2);return respondWithRpcPromise(_0xf40d('0x61'),_0xf40d('0x5c'),{'module':'res_stun_monitor.so'});}else{var _0x5383c9=fs['readFileSync'](path[_0xf40d('0x56')](config[_0xf40d('0x57')],_0xf40d('0x62')),_0xf40d('0x59'));var _0x41e0d8=ejs[_0xf40d('0x5a')](_0x5383c9,{'networks':_0x373353||[]});fs['writeFileSync'](util[_0xf40d('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x2ea3d3[_0xf40d('0x64')][_0xf40d('0x3a')][_0xf40d('0x65')]()),_0x41e0d8);return respondWithRpcPromise('Reload','create',{'module':_0xf40d('0x66')});}return null;})[_0xf40d('0x1a')](function(){return _0x53dc65;});})[_0xf40d('0x1a')](respondWithResult(_0x59935e,0xc9))[_0xf40d('0x25')](handleError(_0x59935e,null));};exports['update']=function(_0x2d19db,_0x3c7cef,_0x401751){var _0x47754a;return db[_0xf40d('0x67')][_0xf40d('0x68')](function(_0x143e36){return db['Network'][_0xf40d('0x53')]({'where':{'id':_0x2d19db['params']['id']}})[_0xf40d('0x1a')](handleEntityNotFound(_0x3c7cef,null))[_0xf40d('0x1a')](saveUpdates(_0x2d19db[_0xf40d('0x64')],null))['then'](function(_0x582882){if(_0x582882){_0x47754a=_0x582882;return db['Network']['findAll']({'where':{'type':_0x47754a[_0xf40d('0x3a')]},'raw':!![]});}return null;})['then'](function(_0x27787d){if(_0x47754a[_0xf40d('0x3a')]['toUpperCase']()==_0xf40d('0x54')){var _0x1d3dda=fs['readFileSync'](path[_0xf40d('0x56')](config[_0xf40d('0x57')],_0xf40d('0x58')),_0xf40d('0x59'));var _0x581adf=ejs[_0xf40d('0x5a')](_0x1d3dda,{'networks':_0x27787d||[]});fs[_0xf40d('0x60')]('/etc/asterisk/stun_xcally.conf',_0x581adf);return respondWithRpcPromise(_0xf40d('0x61'),'update',{'module':'res_stun_monitor.so'});}else if(_0x47754a[_0xf40d('0x3a')][_0xf40d('0x5d')]()==_0xf40d('0x5e')){var _0x135543=fs[_0xf40d('0x55')](path[_0xf40d('0x56')](config[_0xf40d('0x57')],_0xf40d('0x5f')),_0xf40d('0x59'));var _0x129135=ejs[_0xf40d('0x5a')](_0x135543,{'networks':_0x27787d||[]});fs[_0xf40d('0x60')](_0xf40d('0x69'),_0x129135);return respondWithRpcPromise(_0xf40d('0x61'),_0xf40d('0x30'),{'module':_0xf40d('0x6a')});}else{var _0x315bf5=fs[_0xf40d('0x55')](path['join'](config[_0xf40d('0x57')],_0xf40d('0x62')),_0xf40d('0x59'));var _0x23a46d=ejs['render'](_0x315bf5,{'networks':_0x27787d||[]});fs[_0xf40d('0x60')](util['format'](_0xf40d('0x6b'),_0x2d19db['body'][_0xf40d('0x3a')][_0xf40d('0x65')]()),_0x23a46d);return respondWithRpcPromise(_0xf40d('0x61'),_0xf40d('0x30'),{'module':_0xf40d('0x66')});}return null;})[_0xf40d('0x1a')](function(_0x534e11){if(_0x534e11){return _0x47754a;}return null;});})['then'](respondWithResult(_0x3c7cef,null))[_0xf40d('0x25')](handleError(_0x3c7cef,null));};exports[_0xf40d('0x31')]=function(_0x5f06c9,_0x3f263d,_0x44b6b5){var _0x11ec92;return db[_0xf40d('0x38')]['find']({'where':{'id':_0x5f06c9['params']['id']}})['then'](function(_0x104ab4){_0x11ec92=_0x104ab4;return _0x104ab4;})[_0xf40d('0x1a')](handleEntityNotFound(_0x3f263d,null))[_0xf40d('0x1a')](removeEntity(_0x3f263d,null))[_0xf40d('0x1a')](function(){if(_0x11ec92){return db[_0xf40d('0x38')][_0xf40d('0x4e')]({'where':{'type':_0x11ec92[_0xf40d('0x3a')]},'raw':!![]});}})[_0xf40d('0x1a')](function(_0x570f8e){if(_0x11ec92['type'][_0xf40d('0x5d')]()==_0xf40d('0x54')){var _0x1e0d20=fs['readFileSync'](path[_0xf40d('0x56')](config[_0xf40d('0x57')],'server/files/templates/stun_multiple.ejs'),_0xf40d('0x59'));var _0x2d3f6a=ejs[_0xf40d('0x5a')](_0x1e0d20,{'networks':_0x570f8e||[]});fs[_0xf40d('0x60')](_0xf40d('0x5b'),_0x2d3f6a);return respondWithRpcPromise(_0xf40d('0x61'),_0xf40d('0x31'),{'module':_0xf40d('0x6a')});}else if(_0x11ec92['type'][_0xf40d('0x5d')]()==_0xf40d('0x5e')){var _0x255b8a=fs[_0xf40d('0x55')](path[_0xf40d('0x56')](config['root'],_0xf40d('0x5f')),_0xf40d('0x59'));var _0x435e2b=ejs[_0xf40d('0x5a')](_0x255b8a,{'networks':_0x570f8e||[]});fs[_0xf40d('0x60')](_0xf40d('0x69'),_0x435e2b);return respondWithRpcPromise(_0xf40d('0x61'),_0xf40d('0x31'),{'module':_0xf40d('0x6a')});}else{var _0x1ff867=fs[_0xf40d('0x55')](path[_0xf40d('0x56')](config['root'],_0xf40d('0x62')),_0xf40d('0x59'));var _0x7b4213=ejs[_0xf40d('0x5a')](_0x1ff867,{'networks':_0x570f8e||[]});fs[_0xf40d('0x60')](util[_0xf40d('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x5f06c9[_0xf40d('0x64')]['type'][_0xf40d('0x65')]()),_0x7b4213);return respondWithRpcPromise(_0xf40d('0x61'),_0xf40d('0x31'),{'module':'chan_sip.so'});}return null;})[_0xf40d('0x25')](handleError(_0x3f263d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 7e12945..2c7b7bc 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','moment','bluebird'];(function(_0x9bc81a,_0x27e610){var _0x486940=function(_0x21b44f){while(--_0x21b44f){_0x9bc81a['push'](_0x9bc81a['shift']());}};_0x486940(++_0x27e610);}(_0xe706,0xa3));var _0x6e70=function(_0x4b48af,_0x4ad5b9){_0x4b48af=_0x4b48af-0x0;var _0x64ac44=_0xe706[_0x4b48af];return _0x64ac44;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf72b=['./network.attributes','exports','define','Network','network','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x32213a,_0x83f8f9){var _0x5d60fa=function(_0x4d76e2){while(--_0x4d76e2){_0x32213a['push'](_0x32213a['shift']());}};_0x5d60fa(++_0x83f8f9);}(_0xf72b,0x1d9));var _0xbf72=function(_0x14311a,_0x2b30ae){_0x14311a=_0x14311a-0x0;var _0x550ffe=_0xf72b[_0x14311a];return _0x550ffe;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var logger=require(_0xbf72('0x1'))('api');var moment=require(_0xbf72('0x2'));var BPromise=require(_0xbf72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf72('0x4'));var rimraf=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var attributes=require(_0xbf72('0x7'));module[_0xbf72('0x8')]=function(_0x2b8440,_0x5ee060){return _0x2b8440[_0xbf72('0x9')](_0xbf72('0xa'),attributes,{'tableName':_0xbf72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index e0ff325..36afa00 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4ad4d6,_0x4471f6){var _0x33ff91=function(_0xed2719){while(--_0xed2719){_0x4ad4d6['push'](_0x4ad4d6['shift']());}};_0x33ff91(++_0x4471f6);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x1e59db,_0x56dd88){_0x1e59db=_0x1e59db-0x0;var _0x2226cb=_0x7a54[_0x1e59db];return _0x2226cb;};'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 287beec..95ecbff 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 _0xe790=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','create','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','multer'];(function(_0x1dc6d4,_0x1d8ffa){var _0xa5ee8b=function(_0x177311){while(--_0x177311){_0x1dc6d4['push'](_0x1dc6d4['shift']());}};_0xa5ee8b(++_0x1d8ffa);}(_0xe790,0x1db));var _0x0e79=function(_0x354098,_0x1f6485){_0x354098=_0x354098-0x0;var _0x162432=_0xe790[_0x354098];return _0x162432;};'use strict';var multer=require(_0x0e79('0x0'));var util=require(_0x0e79('0x1'));var path=require(_0x0e79('0x2'));var timeout=require(_0x0e79('0x3'));var express=require('express');var router=express[_0x0e79('0x4')]();var fs_extra=require(_0x0e79('0x5'));var auth=require(_0x0e79('0x6'));var interaction=require(_0x0e79('0x7'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x0e79('0x8')]('/',auth[_0x0e79('0x9')](),controller[_0x0e79('0xa')]);router[_0x0e79('0x8')]('/describe',auth[_0x0e79('0x9')](),controller[_0x0e79('0xb')]);router['get']('/:id',auth[_0x0e79('0x9')](),controller[_0x0e79('0xc')]);router[_0x0e79('0x8')](_0x0e79('0xd'),auth[_0x0e79('0x9')](),controller[_0x0e79('0xe')]);router[_0x0e79('0x8')](_0x0e79('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x0e79('0x8')](_0x0e79('0x10'),auth['isAuthenticated'](),controller[_0x0e79('0x11')]);router[_0x0e79('0x8')]('/:id/interactions',auth[_0x0e79('0x9')](),controller['getInteractions']);router['get']('/:id/users',auth[_0x0e79('0x9')](),controller['getAgents']);router['post']('/',auth[_0x0e79('0x9')](),controller[_0x0e79('0x12')]);router[_0x0e79('0x13')](_0x0e79('0xd'),auth[_0x0e79('0x9')](),controller[_0x0e79('0x14')]);router[_0x0e79('0x13')](_0x0e79('0xf'),auth[_0x0e79('0x9')](),controller[_0x0e79('0x15')]);router[_0x0e79('0x13')](_0x0e79('0x16'),controller[_0x0e79('0x17')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x0e79('0x18')]);router[_0x0e79('0x13')]('/:id/users',auth[_0x0e79('0x9')](),controller[_0x0e79('0x19')]);router[_0x0e79('0x13')](_0x0e79('0x1a'),auth[_0x0e79('0x9')](),controller[_0x0e79('0x1b')]);router['put'](_0x0e79('0x1c'),auth[_0x0e79('0x9')](),controller[_0x0e79('0x1d')]);router[_0x0e79('0x1e')](_0x0e79('0x1c'),auth['isAuthenticated'](),controller['destroy']);router[_0x0e79('0x1e')](_0x0e79('0xd'),auth[_0x0e79('0x9')](),controller[_0x0e79('0x1f')]);router[_0x0e79('0x1e')](_0x0e79('0xf'),auth[_0x0e79('0x9')](),controller[_0x0e79('0x20')]);router[_0x0e79('0x1e')]('/:id/users',auth[_0x0e79('0x9')](),controller[_0x0e79('0x21')]);module['exports']=router; \ No newline at end of file +var _0xe244=['removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send','send','update','delete','removeDispositions','removeAnswers'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0xe244,0xf0));var _0x4e24=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe244[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0x4e24('0x0'));var util=require(_0x4e24('0x1'));var path=require('path');var timeout=require(_0x4e24('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4e24('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4e24('0x4'));var config=require('../../config/environment');var controller=require(_0x4e24('0x5'));router[_0x4e24('0x6')]('/',auth[_0x4e24('0x7')](),controller[_0x4e24('0x8')]);router[_0x4e24('0x6')](_0x4e24('0x9'),auth[_0x4e24('0x7')](),controller[_0x4e24('0xa')]);router[_0x4e24('0x6')](_0x4e24('0xb'),auth[_0x4e24('0x7')](),controller['show']);router[_0x4e24('0x6')](_0x4e24('0xc'),auth[_0x4e24('0x7')](),controller['getDispositions']);router[_0x4e24('0x6')]('/:id/canned_answers',auth[_0x4e24('0x7')](),controller[_0x4e24('0xd')]);router['get'](_0x4e24('0xe'),auth['isAuthenticated'](),controller[_0x4e24('0xf')]);router[_0x4e24('0x6')](_0x4e24('0x10'),auth[_0x4e24('0x7')](),controller[_0x4e24('0x11')]);router['get'](_0x4e24('0x12'),auth[_0x4e24('0x7')](),controller[_0x4e24('0x13')]);router['post']('/',auth[_0x4e24('0x7')](),controller[_0x4e24('0x14')]);router[_0x4e24('0x15')](_0x4e24('0xc'),auth['isAuthenticated'](),controller[_0x4e24('0x16')]);router['post'](_0x4e24('0x17'),auth[_0x4e24('0x7')](),controller[_0x4e24('0x18')]);router[_0x4e24('0x15')]('/:id/notify',controller['notify']);router[_0x4e24('0x15')]('/:id/applications',auth['isAuthenticated'](),controller[_0x4e24('0x19')]);router[_0x4e24('0x15')](_0x4e24('0x12'),auth[_0x4e24('0x7')](),controller['addAgents']);router[_0x4e24('0x15')](_0x4e24('0x1a'),auth[_0x4e24('0x7')](),controller[_0x4e24('0x1b')]);router['put']('/:id',auth[_0x4e24('0x7')](),controller[_0x4e24('0x1c')]);router[_0x4e24('0x1d')]('/:id',auth[_0x4e24('0x7')](),controller['destroy']);router[_0x4e24('0x1d')](_0x4e24('0xc'),auth[_0x4e24('0x7')](),controller[_0x4e24('0x1e')]);router[_0x4e24('0x1d')](_0x4e24('0x17'),auth[_0x4e24('0x7')](),controller[_0x4e24('0x1f')]);router[_0x4e24('0x1d')](_0x4e24('0x12'),auth[_0x4e24('0x7')](),controller[_0x4e24('0x20')]);module[_0x4e24('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index c9abf8a..10502cb 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 _0x9009=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0xb88a95,_0xa788ef){var _0x41ede4=function(_0x107311){while(--_0x107311){_0xb88a95['push'](_0xb88a95['shift']());}};_0x41ede4(++_0xa788ef);}(_0x9009,0x1c9));var _0x9900=function(_0x4450c3,_0x38bf4e){_0x4450c3=_0x4450c3-0x0;var _0x49d621=_0x9009[_0x4450c3];return _0x49d621;};'use strict';var Sequelize=require(_0x9900('0x0'));var rs=require(_0x9900('0x1'));module[_0x9900('0x2')]={'name':{'type':Sequelize[_0x9900('0x3')],'unique':_0x9900('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x9900('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x9900('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9900('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9900('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9900('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9900('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9900('0x3')]},'queueTransfer':{'type':Sequelize[_0x9900('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9900('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9900('0x6')],'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['BOOLEAN'],'defaultValue':![],'comment':_0x9900('0x7'),'set':function(_0x4ab758){if(!_0x4ab758)this[_0x9900('0x8')](_0x9900('0x9'),null);this[_0x9900('0x8')](_0x9900('0xa'),_0x4ab758);}}}; \ No newline at end of file +var _0x4d8b=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x2fc4ac,_0x9d882d){var _0x3b77af=function(_0x121990){while(--_0x121990){_0x2fc4ac['push'](_0x2fc4ac['shift']());}};_0x3b77af(++_0x9d882d);}(_0x4d8b,0xc9));var _0xb4d8=function(_0x1c7f48,_0x255687){_0x1c7f48=_0x1c7f48-0x0;var _0x274c31=_0x4d8b[_0x1c7f48];return _0x274c31;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb4d8('0x0'));module[_0xb4d8('0x1')]={'name':{'type':Sequelize[_0xb4d8('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb4d8('0x2')]},'token':{'type':Sequelize[_0xb4d8('0x2')],'defaultValue':function(){return rs[_0xb4d8('0x3')]();}},'replyUri':{'type':Sequelize[_0xb4d8('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb4d8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb4d8('0x4')],'defaultValue':function(){return _0xb4d8('0x5');}},'notificationSound':{'type':Sequelize[_0xb4d8('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb4d8('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb4d8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb4d8('0x2')]},'queueTransfer':{'type':Sequelize[_0xb4d8('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb4d8('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb4d8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb4d8('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb4d8('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x580c2e){if(!_0x580c2e)this[_0xb4d8('0x8')](_0xb4d8('0x9'),null);this[_0xb4d8('0x8')](_0xb4d8('0xa'),_0x580c2e);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 38a09d3..5c424c8 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 _0x7279=['then','destroy','get','UserProfileResource','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','Messages','push','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save'];(function(_0x4a9d1e,_0x20784c){var _0x5bca6a=function(_0x1d6c24){while(--_0x1d6c24){_0x4a9d1e['push'](_0x4a9d1e['shift']());}};_0x5bca6a(++_0x20784c);}(_0x7279,0x8a));var _0x9727=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7279[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9727('0x0'));var rimraf=require(_0x9727('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9727('0x2'));var rp=require(_0x9727('0x3'));var moment=require(_0x9727('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9727('0x5'));var util=require(_0x9727('0x6'));var path=require(_0x9727('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9727('0x8'));var fs=require('fs');var fs_extra=require(_0x9727('0x9'));var _=require(_0x9727('0xa'));var squel=require(_0x9727('0xb'));var crypto=require(_0x9727('0xc'));var jsforce=require(_0x9727('0xd'));var deskjs=require(_0x9727('0xe'));var toCsv=require(_0x9727('0xf'));var querystring=require(_0x9727('0x10'));var Papa=require(_0x9727('0x11'));var Redis=require(_0x9727('0x12'));var authService=require(_0x9727('0x13'));var qs=require(_0x9727('0x14'));var as=require(_0x9727('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9727('0x16'))(_0x9727('0x17'));var utils=require('../../config/utils');var config=require(_0x9727('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9727('0x19'))['db'];config[_0x9727('0x1a')]=_[_0x9727('0x1b')](config[_0x9727('0x1a')],{'host':_0x9727('0x1c'),'port':0x18eb});var socket=require(_0x9727('0x1d'))(new Redis(config['redis']));require(_0x9727('0x1e'))['register'](socket);var jayson=require(_0x9727('0x1f'));var client=jayson[_0x9727('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x9727('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x178487,_0x352fa6,_0x3fd179,_0x6cce6f){return new BPromise(function(_0x5bd642,_0x28d289){var _0x296aa1=_0x6cce6f||client;return _0x296aa1[_0x9727('0x21')](_0x178487,_0x3fd179)['then'](function(_0x266b2d){logger[_0x9727('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x352fa6,_0x9727('0x23'));logger[_0x9727('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x352fa6,_0x9727('0x23'),JSON[_0x9727('0x25')](_0x266b2d));if(_0x266b2d[_0x9727('0x26')]){if(_0x266b2d[_0x9727('0x26')][_0x9727('0x27')]===0x1f4){logger[_0x9727('0x26')](_0x9727('0x28'),_0x352fa6,_0x266b2d[_0x9727('0x26')]['message']);return _0x28d289(_0x266b2d[_0x9727('0x26')][_0x9727('0x29')]);}logger[_0x9727('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x352fa6,_0x266b2d['error'][_0x9727('0x29')]);return _0x5bd642(_0x266b2d[_0x9727('0x26')]['message']);}else{logger[_0x9727('0x22')](_0x9727('0x28'),_0x352fa6,_0x9727('0x23'));_0x5bd642(_0x266b2d[_0x9727('0x2a')][_0x9727('0x29')]);}})[_0x9727('0x2b')](function(_0x502a87){logger[_0x9727('0x26')](_0x9727('0x28'),_0x352fa6,_0x502a87);_0x28d289(_0x502a87);});});}function respondWithStatusCode(_0x3d5be9,_0x17ae6c){_0x17ae6c=_0x17ae6c||0xcc;return function(_0x249982){if(_0x249982){return _0x3d5be9[_0x9727('0x2c')](_0x17ae6c);}return _0x3d5be9[_0x9727('0x2d')](_0x17ae6c)[_0x9727('0x2e')]();};}function respondWithResult(_0x27f8d9,_0x1a2e3f){_0x1a2e3f=_0x1a2e3f||0xc8;return function(_0x333be4){if(_0x333be4){return _0x27f8d9['status'](_0x1a2e3f)[_0x9727('0x2f')](_0x333be4);}};}function respondWithFilteredResult(_0x2f18e5,_0x3d13d2){return function(_0x11c3b8){if(_0x11c3b8){var _0x1fb0ab=typeof _0x3d13d2['offset']===_0x9727('0x30')&&typeof _0x3d13d2[_0x9727('0x31')]===_0x9727('0x30');var _0x44320f=_0x11c3b8[_0x9727('0x32')];var _0x5c9552=_0x1fb0ab?0x0:_0x3d13d2[_0x9727('0x33')];var _0x65efcf=_0x1fb0ab?_0x11c3b8[_0x9727('0x32')]:_0x3d13d2[_0x9727('0x33')]+_0x3d13d2[_0x9727('0x31')];var _0x570887;if(_0x65efcf>=_0x44320f){_0x65efcf=_0x44320f;_0x570887=0xc8;}else{_0x570887=0xce;}_0x2f18e5[_0x9727('0x2d')](_0x570887);return _0x2f18e5[_0x9727('0x34')]('Content-Range',_0x5c9552+'-'+_0x65efcf+'/'+_0x44320f)['json'](_0x11c3b8);}return null;};}function patchUpdates(_0x53df62){return function(_0x321660){try{jsonpatch[_0x9727('0x35')](_0x321660,_0x53df62,!![]);}catch(_0x483484){return BPromise[_0x9727('0x36')](_0x483484);}return _0x321660[_0x9727('0x37')]();};}function saveUpdates(_0xf4f18,_0x215b12){return function(_0x3e1fde){if(_0x3e1fde){return _0x3e1fde['update'](_0xf4f18)[_0x9727('0x38')](function(_0x30609b){return _0x30609b;});}return null;};}function removeEntity(_0x5cce68,_0x260c46){return function(_0x389f74){if(_0x389f74){return _0x389f74[_0x9727('0x39')]()[_0x9727('0x38')](function(){var _0x929e86=_0x389f74[_0x9727('0x3a')]({'plain':!![]});var _0x99e844='OpenchannelAccounts';return db[_0x9727('0x3b')]['destroy']({'where':{'type':_0x99e844,'resourceId':_0x929e86['id']}})['then'](function(){return _0x389f74;});})[_0x9727('0x38')](function(){_0x5cce68['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x259137,_0x1c053f){return function(_0x161f19){if(!_0x161f19){_0x259137[_0x9727('0x2c')](0x194);}return _0x161f19;};}function handleError(_0xe9ba01,_0x8fc202){_0x8fc202=_0x8fc202||0x1f4;return function(_0x48d3c0){logger[_0x9727('0x26')](_0x48d3c0['stack']);if(_0x48d3c0[_0x9727('0x3c')]){delete _0x48d3c0[_0x9727('0x3c')];}_0xe9ba01[_0x9727('0x2d')](_0x8fc202)[_0x9727('0x3d')](_0x48d3c0);};}exports[_0x9727('0x3e')]=function(_0x16329d,_0xde616){var _0x429d58={'include':[{'model':db[_0x9727('0x3f')],'as':'mandatoryDispositionPause'}]},_0x3ad4aa={},_0x552620={'count':0x0,'rows':[]};var _0x3ce58b=_[_0x9727('0x40')](db[_0x9727('0x41')][_0x9727('0x42')],function(_0x43eaf7){return{'name':_0x43eaf7[_0x9727('0x43')],'type':_0x43eaf7[_0x9727('0x44')]['key']};});_0x3ad4aa[_0x9727('0x45')]=_['map'](_0x3ce58b,_0x9727('0x3c'));_0x3ad4aa['query']=_['keys'](_0x16329d[_0x9727('0x46')]);_0x3ad4aa[_0x9727('0x47')]=_[_0x9727('0x48')](_0x3ad4aa['model'],_0x3ad4aa[_0x9727('0x46')]);_0x429d58[_0x9727('0x49')]=_[_0x9727('0x48')](_0x3ad4aa[_0x9727('0x45')],qs[_0x9727('0x4a')](_0x16329d['query'][_0x9727('0x4a')]));_0x429d58[_0x9727('0x49')]=_0x429d58['attributes'][_0x9727('0x4b')]?_0x429d58['attributes']:_0x3ad4aa['model'];if(!_0x16329d[_0x9727('0x46')][_0x9727('0x4c')](_0x9727('0x4d'))){_0x429d58[_0x9727('0x31')]=qs[_0x9727('0x31')](_0x16329d[_0x9727('0x46')][_0x9727('0x31')]);_0x429d58[_0x9727('0x33')]=qs[_0x9727('0x33')](_0x16329d[_0x9727('0x46')]['offset']);}_0x429d58[_0x9727('0x4e')]=qs[_0x9727('0x4f')](_0x16329d[_0x9727('0x46')]['sort']);_0x429d58[_0x9727('0x50')]=qs[_0x9727('0x47')](_[_0x9727('0x51')](_0x16329d['query'],_0x3ad4aa[_0x9727('0x47')]),_0x3ce58b);if(_0x16329d[_0x9727('0x46')][_0x9727('0x52')]){_0x429d58[_0x9727('0x50')]=_['merge'](_0x429d58[_0x9727('0x50')],{'$or':_['map'](_0x3ce58b,function(_0x526959){if(_0x526959[_0x9727('0x44')]!=='VIRTUAL'){var _0x8652f8={};_0x8652f8[_0x526959['name']]={'$like':'%'+_0x16329d[_0x9727('0x46')][_0x9727('0x52')]+'%'};return _0x8652f8;}})});}_0x429d58=_['merge']({},_0x429d58,_0x16329d[_0x9727('0x53')]);var _0x2d39f7={'where':_0x429d58['where']};return db[_0x9727('0x41')][_0x9727('0x32')](_0x2d39f7)[_0x9727('0x38')](function(_0x144990){_0x552620[_0x9727('0x32')]=_0x144990;if(_0x16329d['query'][_0x9727('0x54')]){_0x429d58[_0x9727('0x55')]=[{'all':!![]}];}return db[_0x9727('0x41')][_0x9727('0x56')](_0x429d58);})[_0x9727('0x38')](function(_0x53ca02){_0x552620[_0x9727('0x57')]=_0x53ca02;return _0x552620;})['then'](respondWithFilteredResult(_0xde616,_0x429d58))[_0x9727('0x2b')](handleError(_0xde616,null));};exports[_0x9727('0x58')]=function(_0x43e4d1,_0x38aa54){var _0xfc310b={'raw':![],'where':{'id':_0x43e4d1[_0x9727('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x9727('0x5a')}]},_0x32a76e={};_0x32a76e[_0x9727('0x45')]=_[_0x9727('0x5b')](db[_0x9727('0x41')]['rawAttributes']);_0x32a76e[_0x9727('0x46')]=_[_0x9727('0x5b')](_0x43e4d1[_0x9727('0x46')]);_0x32a76e['filters']=_['intersection'](_0x32a76e[_0x9727('0x45')],_0x32a76e[_0x9727('0x46')]);_0xfc310b['attributes']=_[_0x9727('0x48')](_0x32a76e[_0x9727('0x45')],qs['fields'](_0x43e4d1['query'][_0x9727('0x4a')]));_0xfc310b[_0x9727('0x49')]=_0xfc310b[_0x9727('0x49')][_0x9727('0x4b')]?_0xfc310b[_0x9727('0x49')]:_0x32a76e[_0x9727('0x45')];if(_0x43e4d1[_0x9727('0x46')][_0x9727('0x54')]){_0xfc310b[_0x9727('0x55')]=[{'all':!![]}];}_0xfc310b=_[_0x9727('0x5c')]({},_0xfc310b,_0x43e4d1[_0x9727('0x53')]);return db[_0x9727('0x41')][_0x9727('0x5d')](_0xfc310b)[_0x9727('0x38')](handleEntityNotFound(_0x38aa54,null))[_0x9727('0x38')](respondWithResult(_0x38aa54,null))[_0x9727('0x2b')](handleError(_0x38aa54,null));};exports[_0x9727('0x5e')]=function(_0x543581,_0x56d2a5){return db['OpenchannelAccount']['create'](_0x543581[_0x9727('0x5f')],{})[_0x9727('0x38')](function(_0x3b295a){var _0x3e4f31=_0x543581['user'][_0x9727('0x3a')]({'plain':!![]});if(!_0x3e4f31)throw new Error(_0x9727('0x60'));if(_0x3e4f31[_0x9727('0x61')]===_0x9727('0x62')){var _0x32977a=_0x3b295a['get']({'plain':!![]});var _0x47bf41=_0x9727('0x63');return db[_0x9727('0x64')][_0x9727('0x5d')]({'where':{'name':_0x47bf41,'userProfileId':_0x3e4f31[_0x9727('0x65')]},'raw':!![]})[_0x9727('0x38')](function(_0x41bf81){if(_0x41bf81&&_0x41bf81[_0x9727('0x66')]===0x0){return db['UserProfileResource']['create']({'name':_0x32977a[_0x9727('0x3c')],'resourceId':_0x32977a['id'],'type':_0x41bf81['name'],'sectionId':_0x41bf81['id']},{})[_0x9727('0x38')](function(){return _0x3b295a;});}else{return _0x3b295a;}})[_0x9727('0x2b')](function(_0x1f555a){logger[_0x9727('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f555a);throw _0x1f555a;});}return _0x3b295a;})[_0x9727('0x38')](respondWithResult(_0x56d2a5,0xc9))['catch'](handleError(_0x56d2a5,null));};exports[_0x9727('0x67')]=function(_0x39cad7,_0x1b606e){if(_0x39cad7[_0x9727('0x5f')]['id']){delete _0x39cad7[_0x9727('0x5f')]['id'];}return db['OpenchannelAccount'][_0x9727('0x5d')]({'where':{'id':_0x39cad7[_0x9727('0x59')]['id']},'include':[{'model':db[_0x9727('0x3f')],'as':_0x9727('0x5a')}]})[_0x9727('0x38')](handleEntityNotFound(_0x1b606e,null))[_0x9727('0x38')](saveUpdates(_0x39cad7[_0x9727('0x5f')],null))[_0x9727('0x38')](respondWithResult(_0x1b606e,null))['catch'](handleError(_0x1b606e,null));};exports[_0x9727('0x39')]=function(_0x370afd,_0x15f948){return db[_0x9727('0x41')][_0x9727('0x5d')]({'where':{'id':_0x370afd['params']['id']}})[_0x9727('0x38')](handleEntityNotFound(_0x15f948,null))[_0x9727('0x38')](removeEntity(_0x15f948,null))[_0x9727('0x2b')](handleError(_0x15f948,null));};exports[_0x9727('0x68')]=function(_0xb512ef,_0x5e1d40){return db['OpenchannelAccount']['describe']()[_0x9727('0x38')](respondWithResult(_0x5e1d40,null))[_0x9727('0x2b')](handleError(_0x5e1d40,null));};exports[_0x9727('0x69')]=function(_0x3aabd3,_0x3c3eb5,_0x27eb69){if(_0x3aabd3['body']['id']){delete _0x3aabd3[_0x9727('0x5f')]['id'];}return db[_0x9727('0x41')][_0x9727('0x5d')]({'where':{'id':_0x3aabd3[_0x9727('0x59')]['id']}})['then'](handleEntityNotFound(_0x3c3eb5,null))[_0x9727('0x38')](function(_0x40cce5){if(_0x40cce5){_0x3aabd3[_0x9727('0x5f')][_0x9727('0x6a')]=_0x40cce5['id'];return db[_0x9727('0x6b')][_0x9727('0x5e')](_0x3aabd3[_0x9727('0x5f')]);}})[_0x9727('0x38')](respondWithResult(_0x3c3eb5,null))[_0x9727('0x2b')](handleError(_0x3c3eb5,null));};exports[_0x9727('0x6c')]=function(_0x61c742,_0x321b61,_0x367779){var _0x290a1f={'raw':![],'where':{}};var _0x6e8ced={};var _0x16f3cc={'count':0x0,'rows':[]};return db[_0x9727('0x41')][_0x9727('0x6d')]({'where':{'id':_0x61c742['params']['id']}})[_0x9727('0x38')](handleEntityNotFound(_0x321b61,null))[_0x9727('0x38')](function(_0x595c5a){if(_0x595c5a){_0x6e8ced[_0x9727('0x45')]=_['keys'](db[_0x9727('0x6b')][_0x9727('0x42')]);_0x6e8ced[_0x9727('0x46')]=_[_0x9727('0x5b')](_0x61c742[_0x9727('0x46')]);_0x6e8ced[_0x9727('0x47')]=_['intersection'](_0x6e8ced[_0x9727('0x45')],_0x6e8ced[_0x9727('0x46')]);_0x290a1f[_0x9727('0x49')]=_[_0x9727('0x48')](_0x6e8ced[_0x9727('0x45')],qs['fields'](_0x61c742[_0x9727('0x46')][_0x9727('0x4a')]));_0x290a1f['attributes']=_0x290a1f['attributes']['length']?_0x290a1f[_0x9727('0x49')]:_0x6e8ced[_0x9727('0x45')];if(!_0x61c742['query'][_0x9727('0x4c')](_0x9727('0x4d'))){_0x290a1f[_0x9727('0x31')]=qs[_0x9727('0x31')](_0x61c742['query']['limit']);_0x290a1f[_0x9727('0x33')]=qs[_0x9727('0x33')](_0x61c742['query'][_0x9727('0x33')]);}_0x290a1f['order']=qs[_0x9727('0x4f')](_0x61c742['query']['sort']);_0x290a1f[_0x9727('0x50')]=qs[_0x9727('0x47')](_[_0x9727('0x51')](_0x61c742['query'],_0x6e8ced[_0x9727('0x47')]));_0x290a1f[_0x9727('0x50')][_0x9727('0x6a')]=_0x595c5a['id'];if(_0x61c742[_0x9727('0x46')][_0x9727('0x52')]){_0x290a1f[_0x9727('0x50')]=_[_0x9727('0x5c')](_0x290a1f[_0x9727('0x50')],{'$or':_['map'](_0x290a1f['attributes'],function(_0x413661){var _0x46d8fd={};_0x46d8fd[_0x413661]={'$like':'%'+_0x61c742['query'][_0x9727('0x52')]+'%'};return _0x46d8fd;})});}_0x290a1f=_[_0x9727('0x5c')]({},_0x290a1f,_0x61c742[_0x9727('0x53')]);return db[_0x9727('0x6b')][_0x9727('0x32')]({'where':_0x290a1f[_0x9727('0x50')]})[_0x9727('0x38')](function(_0x2ebbc9){_0x16f3cc[_0x9727('0x32')]=_0x2ebbc9;if(_0x61c742[_0x9727('0x46')]['includeAll']){_0x290a1f[_0x9727('0x55')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x290a1f);})[_0x9727('0x38')](function(_0x4d06e0){_0x16f3cc[_0x9727('0x57')]=_0x4d06e0;return _0x16f3cc;});}})[_0x9727('0x38')](respondWithFilteredResult(_0x321b61,_0x290a1f))[_0x9727('0x2b')](handleError(_0x321b61,null));};exports[_0x9727('0x6e')]=function(_0x55a5e6,_0x5d81f0,_0x401a9f){return db[_0x9727('0x41')][_0x9727('0x5d')]({'where':{'id':_0x55a5e6[_0x9727('0x59')]['id']}})[_0x9727('0x38')](handleEntityNotFound(_0x5d81f0,null))['then'](function(_0x451905){if(_0x451905){return _0x451905[_0x9727('0x6e')](_0x55a5e6[_0x9727('0x46')][_0x9727('0x6f')]);}})[_0x9727('0x38')](respondWithStatusCode(_0x5d81f0,null))[_0x9727('0x2b')](handleError(_0x5d81f0,null));};exports[_0x9727('0x70')]=function(_0x146574,_0x4703f3,_0x11c074){if(_0x146574['body']['id']){delete _0x146574[_0x9727('0x5f')]['id'];}return db[_0x9727('0x41')][_0x9727('0x5d')]({'where':{'id':_0x146574[_0x9727('0x59')]['id']}})[_0x9727('0x38')](handleEntityNotFound(_0x4703f3,null))[_0x9727('0x38')](function(_0x51fc45){if(_0x51fc45){_0x146574[_0x9727('0x5f')][_0x9727('0x6a')]=_0x51fc45['id'];return db[_0x9727('0x71')][_0x9727('0x5e')](_0x146574[_0x9727('0x5f')]);}})[_0x9727('0x38')](respondWithResult(_0x4703f3,null))[_0x9727('0x2b')](handleError(_0x4703f3,null));};exports[_0x9727('0x72')]=function(_0x4179ad,_0x301276,_0x1c9c8d){var _0x8e692e={'raw':![],'where':{}};var _0x16f6e9={};var _0x4671fa={'count':0x0,'rows':[]};return db[_0x9727('0x41')][_0x9727('0x6d')]({'where':{'id':_0x4179ad[_0x9727('0x59')]['id']}})[_0x9727('0x38')](handleEntityNotFound(_0x301276,null))[_0x9727('0x38')](function(_0xba0e1b){if(_0xba0e1b){_0x16f6e9[_0x9727('0x45')]=_[_0x9727('0x5b')](db[_0x9727('0x71')][_0x9727('0x42')]);_0x16f6e9[_0x9727('0x46')]=_[_0x9727('0x5b')](_0x4179ad[_0x9727('0x46')]);_0x16f6e9['filters']=_[_0x9727('0x48')](_0x16f6e9[_0x9727('0x45')],_0x16f6e9[_0x9727('0x46')]);_0x8e692e[_0x9727('0x49')]=_[_0x9727('0x48')](_0x16f6e9[_0x9727('0x45')],qs[_0x9727('0x4a')](_0x4179ad[_0x9727('0x46')][_0x9727('0x4a')]));_0x8e692e[_0x9727('0x49')]=_0x8e692e['attributes']['length']?_0x8e692e[_0x9727('0x49')]:_0x16f6e9[_0x9727('0x45')];if(!_0x4179ad[_0x9727('0x46')]['hasOwnProperty']('nolimit')){_0x8e692e[_0x9727('0x31')]=qs[_0x9727('0x31')](_0x4179ad[_0x9727('0x46')][_0x9727('0x31')]);_0x8e692e[_0x9727('0x33')]=qs[_0x9727('0x33')](_0x4179ad[_0x9727('0x46')][_0x9727('0x33')]);}_0x8e692e['order']=qs[_0x9727('0x4f')](_0x4179ad[_0x9727('0x46')][_0x9727('0x4f')]);_0x8e692e['where']=qs['filters'](_['pick'](_0x4179ad[_0x9727('0x46')],_0x16f6e9[_0x9727('0x47')]));_0x8e692e[_0x9727('0x50')][_0x9727('0x6a')]=_0xba0e1b['id'];if(_0x4179ad['query']['filter']){_0x8e692e[_0x9727('0x50')]=_[_0x9727('0x5c')](_0x8e692e[_0x9727('0x50')],{'$or':_['map'](_0x8e692e[_0x9727('0x49')],function(_0x2432c2){var _0xdedfde={};_0xdedfde[_0x2432c2]={'$like':'%'+_0x4179ad[_0x9727('0x46')][_0x9727('0x52')]+'%'};return _0xdedfde;})});}_0x8e692e=_[_0x9727('0x5c')]({},_0x8e692e,_0x4179ad['options']);return db[_0x9727('0x71')][_0x9727('0x32')]({'where':_0x8e692e[_0x9727('0x50')]})[_0x9727('0x38')](function(_0x383e33){_0x4671fa['count']=_0x383e33;if(_0x4179ad[_0x9727('0x46')][_0x9727('0x54')]){_0x8e692e[_0x9727('0x55')]=[{'all':!![]}];}return db[_0x9727('0x71')][_0x9727('0x56')](_0x8e692e);})['then'](function(_0x3dee1c){_0x4671fa[_0x9727('0x57')]=_0x3dee1c;return _0x4671fa;});}})['then'](respondWithFilteredResult(_0x301276,_0x8e692e))['catch'](handleError(_0x301276,null));};exports[_0x9727('0x73')]=function(_0x3be966,_0x817438,_0x1a50af){return db['OpenchannelAccount'][_0x9727('0x5d')]({'where':{'id':_0x3be966[_0x9727('0x59')]['id']}})[_0x9727('0x38')](handleEntityNotFound(_0x817438,null))[_0x9727('0x38')](function(_0x489c3f){if(_0x489c3f){return _0x489c3f[_0x9727('0x73')](_0x3be966[_0x9727('0x46')][_0x9727('0x6f')]);}})[_0x9727('0x38')](respondWithStatusCode(_0x817438,null))[_0x9727('0x2b')](handleError(_0x817438,null));};exports[_0x9727('0x74')]=function(_0x3cf58c,_0xf1455,_0x10a2bc){var _0x38629c={'body':_0x3cf58c[_0x9727('0x5f')],'channel':_0x9727('0x75')};var _0x929929=[];var _0x446036=[];var _0x414a35={};var _0x47ccda=![];return db[_0x9727('0x76')]['describe']()[_0x9727('0x38')](function(_0x3c9138){if(!_0x3c9138){throw new db[(_0x9727('0x77'))][(_0x9727('0x78'))](_0x9727('0x79'));}_0x929929=_[_0x9727('0x7a')](_[_0x9727('0x5b')](_0x3c9138),[_0x9727('0x7b'),_0x9727('0x7c')]);_0x446036=_[_0x9727('0x7a')](_[_0x9727('0x5b')](_0x3c9138),[_0x9727('0x7b'),_0x9727('0x7c'),'CompanyId',_0x9727('0x7d')]);if(_0x3cf58c[_0x9727('0x5f')]['id']){delete _0x3cf58c[_0x9727('0x5f')]['id'];}if(_[_0x9727('0x7e')](_0x3cf58c['body'][_0x9727('0x7f')])){throw new db['Sequelize']['ValidationError'](_0x9727('0x80'));}if(_[_0x9727('0x7e')](_0x3cf58c[_0x9727('0x5f')][_0x9727('0x5f')])||_0x3cf58c[_0x9727('0x5f')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9727('0x7e')](_0x3cf58c[_0x9727('0x5f')][_0x9727('0x81')])){throw new db[(_0x9727('0x77'))][(_0x9727('0x78'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x446036);}if(!_[_0x9727('0x82')](_0x446036,_0x3cf58c[_0x9727('0x5f')]['mapKey'])){throw new db[(_0x9727('0x77'))][(_0x9727('0x78'))](_0x9727('0x83')+_0x446036);}_0x414a35[_0x3cf58c[_0x9727('0x5f')]['mapKey']]=_0x3cf58c['body'][_0x9727('0x7f')];})['then'](function(){return db[_0x9727('0x41')][_0x9727('0x5d')]({'where':{'id':_0x3cf58c['params']['id']},'include':[{'model':db['CmList'],'as':_0x9727('0x84'),'include':[{'model':db[_0x9727('0x76')],'as':_0x9727('0x85'),'where':_0x414a35,'limit':0x1,'order':[[_0x9727('0x7c'),_0x9727('0x86')]]}]},{'model':db[_0x9727('0x87')],'as':_0x9727('0x88')}]});})[_0x9727('0x38')](handleEntityNotFound(_0xf1455,null))[_0x9727('0x38')](function(_0x235ff9){if(_0x235ff9&&_0x235ff9[_0x9727('0x84')]){_0x38629c['account']=_0x235ff9;_0x38629c[_0x9727('0x89')]=_0x235ff9['Applications'];_0x38629c[_0x9727('0x8a')]=_0x235ff9[_0x9727('0x84')];_0x38629c['applications']=_[_0x9727('0x8b')](_0x38629c[_0x9727('0x89')],[_0x9727('0x8c')],[_0x9727('0x8d')]);if(_0x38629c[_0x9727('0x8e')][_0x9727('0x88')]){delete _0x38629c[_0x9727('0x8e')]['Applications'];}if(_0x38629c[_0x9727('0x8e')][_0x9727('0x84')]&&_0x38629c['account'][_0x9727('0x84')]['Contacts']['length']){return _0x38629c[_0x9727('0x8e')]['List'][_0x9727('0x85')][0x0];}var _0x1baaf1=_[_0x9727('0x1b')](_0x3cf58c[_0x9727('0x5f')],{'firstName':_0x3cf58c['body'][_0x9727('0x7f')],'ListId':_0x235ff9[_0x9727('0x7d')]});_0x1baaf1[_0x3cf58c[_0x9727('0x5f')][_0x9727('0x81')]]=_0x3cf58c['body'][_0x9727('0x7f')];return db[_0x9727('0x76')][_0x9727('0x5e')](_0x1baaf1,{'fields':_0x929929,'raw':!![]});}})[_0x9727('0x38')](handleEntityNotFound(_0xf1455,null))[_0x9727('0x38')](function(_0x3c0162){_0x38629c[_0x9727('0x8f')]=_0x3c0162;if(_0x3c0162){var _0x4e4154={'ContactId':_0x3c0162['id'],'OpenchannelAccountId':_0x3cf58c[_0x9727('0x59')]['id'],'from':(_0x3c0162['firstName']||'')+'\x20'+(_0x3c0162[_0x9727('0x90')]||'')};var _0xe3f546={'OpenchannelAccountId':_0x3cf58c['params']['id'],'closed':![]};if(_0x3cf58c[_0x9727('0x5f')][_0x9727('0x91')]){_0xe3f546[_0x9727('0x91')]=_0x3cf58c[_0x9727('0x5f')]['threadId'];return db[_0x9727('0x92')]['find']({'where':_0xe3f546})[_0x9727('0x38')](function(_0x15ff15){if(_0x15ff15){return[_0x15ff15,![]];}_0x4e4154['threadId']=_0x3cf58c[_0x9727('0x5f')][_0x9727('0x91')];_0x4e4154[_0x9727('0x93')]=_0x3cf58c[_0x9727('0x5f')]['externalUrl'];return db['OpenchannelInteraction'][_0x9727('0x5e')](_0x4e4154)[_0x9727('0x38')](function(_0x435d17){return[_0x435d17,!![]];});});}else{_0xe3f546['threadId']=null;}_0xe3f546[_0x9727('0x94')]=_0x3c0162['id'];return db[_0x9727('0x92')]['find']({'where':_0xe3f546})['then'](function(_0x3a5471){if(_0x3a5471){return[_0x3a5471,![]];}return db[_0x9727('0x92')][_0x9727('0x5e')](_0x4e4154)[_0x9727('0x38')](function(_0x44349c){return[_0x44349c,!![]];});});}})[_0x9727('0x95')](function(_0x1431cf,_0x25f9b3){if(_0x1431cf){_0x47ccda=_0x25f9b3;if(!_0x25f9b3){var _0xa1acd1={'from':(_0x38629c['contact']['firstName']||'')+'\x20'+(_0x38629c['contact'][_0x9727('0x90')]||'')};if(_0x3cf58c[_0x9727('0x5f')][_0x9727('0x91')]&&_0x3cf58c['body'][_0x9727('0x96')]&&_0x3cf58c[_0x9727('0x5f')]['threadId']!=_0x3cf58c['body']['messageId']){_0xa1acd1[_0x9727('0x91')]=_0x3cf58c['body'][_0x9727('0x96')];}return _0x1431cf['update'](_0xa1acd1);}else{return _0x1431cf;}}})['then'](function(_0x21705c){_0x38629c['interaction']=_0x21705c['get']({'plain':!![]});_0x38629c[_0x9727('0x97')][_0x9727('0x98')]=_0x47ccda;if(_0x38629c['interaction'][_0x9727('0x98')]){if(_0x38629c[_0x9727('0x8e')]['autoclose']){_0x38629c['applications']['push']({'id':0x0,'priority':_0x38629c[_0x9727('0x89')][_0x9727('0x4b')]+0x1,'app':_0x9727('0x99'),'appdata':'unmanaged','interval':_0x9727('0x9a')});}}return db[_0x9727('0x9b')][_0x9727('0x5e')]({'body':_0x3cf58c['body'][_0x9727('0x5f')],'OpenchannelAccountId':_0x3cf58c[_0x9727('0x59')]['id'],'OpenchannelInteractionId':_0x21705c['id'],'direction':'in','ContactId':_0x38629c[_0x9727('0x8f')]['id'],'AttachmentId':_0x3cf58c[_0x9727('0x5f')][_0x9727('0x9c')]});})[_0x9727('0x38')](function(_0x5cd4e7){_0x38629c['message']=_0x5cd4e7;if(_0x38629c[_0x9727('0x97')][_0x9727('0x9d')]){return db[_0x9727('0x9e')][_0x9727('0x5d')]({'attributes':['id',_0x9727('0x3c')],'where':{'id':_0x38629c[_0x9727('0x97')][_0x9727('0x9d')]}})['then'](function(_0x1d149a){if(_0x1d149a){_0x38629c[_0x9727('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9727('0x9f'),'appdata':_0x1d149a[_0x9727('0x3c')]+','+(_0x38629c[_0x9727('0x8e')][_0x9727('0xa0')]||0xa),'interval':_0x9727('0x9a')});_0x38629c[_0x9727('0xa1')]=![];}return respondWithRpcPromise('Start',_0x9727('0xa2'),_0x38629c);});}return respondWithRpcPromise('Start','startRouting',_0x38629c);})[_0x9727('0x38')](function(_0x73e07f){respondWithRpcPromise('EventManager',_0x9727('0xa3'),{'event':_0x9727('0x74'),'message':_0x73e07f},client9002);return _0x73e07f;})['then'](respondWithResult(_0xf1455,null))['catch'](handleError(_0xf1455,null));};exports[_0x9727('0xa4')]=function(_0x4d23c1,_0x1a77dc){var _0x5cc92f=_0x4d23c1[_0x9727('0x59')]['id'];var _0x26fd55=_0x4d23c1[_0x9727('0x5f')];var _0x293590=0xc8;var _0x1a10c4=null;return db['sequelize'][_0x9727('0xa5')]({'isolationLevel':db[_0x9727('0xa6')][_0x9727('0xa7')]['ISOLATION_LEVELS'][_0x9727('0xa8')]},function(_0x598614){return db[_0x9727('0x41')][_0x9727('0x6d')]({'where':{'id':_0x5cc92f},'transaction':_0x598614})[_0x9727('0x38')](function(_0x1b127c){if(_0x1b127c){return db[_0x9727('0x87')][_0x9727('0x39')]({'where':{'OpenchannelAccountId':_0x5cc92f},'transaction':_0x598614})[_0x9727('0x38')](function(){var _0x3c4b9e=_[_0x9727('0x40')](_0x26fd55,function(_0x33b8cf){_0x33b8cf['OpenchannelAccountId']=_0x5cc92f;return _0x33b8cf;});return db[_0x9727('0x87')][_0x9727('0xa9')](_0x3c4b9e,{'transaction':_0x598614});});}else{_0x293590=0x194;_0x1a10c4=[];}});})['then'](function(){if(_0x293590!==0x194){return db[_0x9727('0x87')][_0x9727('0xaa')]({'where':{'OpenchannelAccountId':_0x5cc92f},'order':_0x9727('0x8c')})[_0x9727('0x38')](function(_0x2c8b50){_0x1a10c4=_0x2c8b50;});}})['catch'](function(_0xf1d97b){_0x293590=0x1f4;logger[_0x9727('0x26')](_0xf1d97b['stack']);if(_0xf1d97b[_0x9727('0x3c')]){delete _0xf1d97b[_0x9727('0x3c')];}_0x1a10c4=_0xf1d97b;})[_0x9727('0xab')](function(){if(_0x1a10c4===null){_0x1a77dc['sendStatus'](_0x293590);}else{if(_0x293590===0x1f4){_0x1a77dc[_0x9727('0x2d')](_0x293590)[_0x9727('0x3d')](_0x1a10c4);}else{_0x1a77dc[_0x9727('0x2d')](_0x293590)[_0x9727('0x2f')](_0x1a10c4);}}});};exports[_0x9727('0xac')]=function(_0x1f8709,_0x3766a3,_0x277209){var _0x897f2a={};var _0x4fafac={};var _0x177371;var _0x1642b4;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1f8709[_0x9727('0x59')]['id']}})['then'](handleEntityNotFound(_0x3766a3,null))[_0x9727('0x38')](function(_0x25ac8b){if(_0x25ac8b){_0x177371=_0x25ac8b;_0x4fafac[_0x9727('0x45')]=_['keys'](db[_0x9727('0x87')][_0x9727('0x42')]);_0x4fafac[_0x9727('0x46')]=_[_0x9727('0x5b')](_0x1f8709[_0x9727('0x46')]);_0x4fafac[_0x9727('0x47')]=_[_0x9727('0x48')](_0x4fafac[_0x9727('0x45')],_0x4fafac['query']);_0x897f2a[_0x9727('0x49')]=_[_0x9727('0x48')](_0x4fafac['model'],qs[_0x9727('0x4a')](_0x1f8709[_0x9727('0x46')][_0x9727('0x4a')]));_0x897f2a['attributes']=_0x897f2a[_0x9727('0x49')][_0x9727('0x4b')]?_0x897f2a[_0x9727('0x49')]:_0x4fafac['model'];_0x897f2a[_0x9727('0x4e')]=qs['sort'](_0x1f8709[_0x9727('0x46')][_0x9727('0x4f')]);_0x897f2a[_0x9727('0x50')]=qs[_0x9727('0x47')](_[_0x9727('0x51')](_0x1f8709[_0x9727('0x46')],_0x4fafac[_0x9727('0x47')]));if(_0x1f8709[_0x9727('0x46')]['filter']){_0x897f2a[_0x9727('0x50')]=_[_0x9727('0x5c')](_0x897f2a[_0x9727('0x50')],{'$or':_[_0x9727('0x40')](_0x897f2a[_0x9727('0x49')],function(_0x24d8a3){var _0x194e67={};_0x194e67[_0x24d8a3]={'$like':'%'+_0x1f8709[_0x9727('0x46')][_0x9727('0x52')]+'%'};return _0x194e67;})});}_0x897f2a=_[_0x9727('0x5c')]({},_0x897f2a,_0x1f8709[_0x9727('0x53')]);return _0x177371[_0x9727('0xac')](_0x897f2a);}})[_0x9727('0x38')](function(_0x43cff8){if(_0x43cff8){_0x1642b4=_0x43cff8[_0x9727('0x4b')];if(!_0x1f8709[_0x9727('0x46')]['hasOwnProperty']('nolimit')){_0x897f2a[_0x9727('0x31')]=qs[_0x9727('0x31')](_0x1f8709[_0x9727('0x46')][_0x9727('0x31')]);_0x897f2a['offset']=qs[_0x9727('0x33')](_0x1f8709[_0x9727('0x46')][_0x9727('0x33')]);}return _0x177371[_0x9727('0xac')](_0x897f2a);}})[_0x9727('0x38')](function(_0x2071cd){if(_0x2071cd){return _0x2071cd?{'count':_0x1642b4,'rows':_0x2071cd}:null;}})[_0x9727('0x38')](respondWithResult(_0x3766a3,null))[_0x9727('0x2b')](handleError(_0x3766a3,null));};exports[_0x9727('0xad')]=function(_0x483b93,_0x2baabd,_0x11ebcc){var _0x4463fe={'raw':![],'where':{}};var _0x1d8428={};var _0x1abb14={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9727('0x6d')]({'where':{'id':_0x483b93[_0x9727('0x59')]['id']}})[_0x9727('0x38')](handleEntityNotFound(_0x2baabd,null))[_0x9727('0x38')](function(_0x557f73){if(_0x557f73){_0x1d8428[_0x9727('0x45')]=_[_0x9727('0x5b')](db[_0x9727('0x92')]['rawAttributes']);_0x1d8428[_0x9727('0x46')]=_[_0x9727('0x5b')](_0x483b93[_0x9727('0x46')]);_0x1d8428[_0x9727('0x47')]=_['intersection'](_0x1d8428[_0x9727('0x45')],_0x1d8428['query']);_0x4463fe[_0x9727('0x49')]=_[_0x9727('0x48')](_0x1d8428[_0x9727('0x45')],qs[_0x9727('0x4a')](_0x483b93[_0x9727('0x46')][_0x9727('0x4a')]));_0x4463fe['attributes']=_0x4463fe['attributes']['length']?_0x4463fe[_0x9727('0x49')]:_0x1d8428['model'];if(!_0x483b93[_0x9727('0x46')][_0x9727('0x4c')](_0x9727('0x4d'))){_0x4463fe['limit']=qs[_0x9727('0x31')](_0x483b93[_0x9727('0x46')][_0x9727('0x31')]);_0x4463fe['offset']=qs[_0x9727('0x33')](_0x483b93[_0x9727('0x46')][_0x9727('0x33')]);}_0x4463fe[_0x9727('0x4e')]=qs[_0x9727('0x4f')](_0x483b93['query']['sort']);_0x4463fe[_0x9727('0x50')]=qs[_0x9727('0x47')](_[_0x9727('0x51')](_0x483b93[_0x9727('0x46')],_0x1d8428[_0x9727('0x47')]));_0x4463fe[_0x9727('0x50')][_0x9727('0x6a')]=_0x557f73['id'];if(_0x483b93['query'][_0x9727('0x52')]){_0x4463fe[_0x9727('0x50')]=_[_0x9727('0x5c')](_0x4463fe[_0x9727('0x50')],{'$or':_[_0x9727('0x40')](_0x4463fe['attributes'],function(_0x3e99f5){var _0x165e70={};_0x165e70[_0x3e99f5]={'$like':'%'+_0x483b93[_0x9727('0x46')][_0x9727('0x52')]+'%'};return _0x165e70;})});}_0x4463fe=_[_0x9727('0x5c')]({},_0x4463fe,_0x483b93[_0x9727('0x53')]);return db[_0x9727('0x92')][_0x9727('0x32')]({'where':_0x4463fe['where']})['then'](function(_0xb743fd){_0x1abb14[_0x9727('0x32')]=_0xb743fd;if(_0x483b93[_0x9727('0x46')][_0x9727('0x54')]){_0x4463fe[_0x9727('0x55')]=[{'model':db[_0x9727('0x76')],'as':_0x9727('0xae'),'required':![]},{'model':db[_0x9727('0x9e')],'as':_0x9727('0xaf'),'attributes':[_0x9727('0x3c'),'fullname',_0x9727('0xb0')],'required':![]},{'model':db[_0x9727('0xb1')],'as':_0x9727('0xb2'),'attributes':['id',_0x9727('0x3c'),_0x9727('0xb3')],'where':_0x483b93[_0x9727('0x46')]['tag']?{'id':_0x483b93['query'][_0x9727('0xb4')]}:undefined,'required':_0x483b93[_0x9727('0x46')]['tag']?!![]:![]}];}return db[_0x9727('0x92')]['findAll'](_0x4463fe);})[_0x9727('0x38')](function(_0x36d45a){_0x1abb14[_0x9727('0x57')]=_0x36d45a;return _0x1abb14;});}})[_0x9727('0x38')](respondWithFilteredResult(_0x2baabd,_0x4463fe))[_0x9727('0x2b')](handleError(_0x2baabd,null));};exports[_0x9727('0xb5')]=function(_0x1e3476,_0x32f763,_0xee9a29){return db['OpenchannelAccount']['find']({'where':{'id':_0x1e3476[_0x9727('0x59')]['id']}})[_0x9727('0x38')](handleEntityNotFound(_0x32f763,null))['then'](function(_0x37ab4d){if(_0x37ab4d){return _0x37ab4d[_0x9727('0xb5')](_0x1e3476[_0x9727('0x5f')][_0x9727('0x6f')],_[_0x9727('0xb6')](_0x1e3476[_0x9727('0x5f')],[_0x9727('0x6f'),'id'])||{})['spread'](function(_0x477c5b){for(var _0x35297f=0x0;_0x35297f<_0x1e3476[_0x9727('0x5f')][_0x9727('0x6f')][_0x9727('0x4b')];_0x35297f+=0x1){socket[_0x9727('0xb7')](_0x9727('0xb8'),{'UserId':Number(_0x1e3476[_0x9727('0x5f')][_0x9727('0x6f')][_0x35297f]),'OpenchannelAccountId':Number(_0x1e3476[_0x9727('0x59')]['id'])});}return _0x477c5b;});}})[_0x9727('0x38')](respondWithResult(_0x32f763,null))['catch'](handleError(_0x32f763,null));};exports[_0x9727('0xb9')]=function(_0x15a494,_0x2f41e7,_0x4055f5){return db['OpenchannelAccount'][_0x9727('0x5d')]({'where':{'id':_0x15a494[_0x9727('0x59')]['id']}})[_0x9727('0x38')](handleEntityNotFound(_0x2f41e7,null))[_0x9727('0x38')](function(_0x171133){if(_0x171133){return _0x171133[_0x9727('0xb9')](_0x15a494[_0x9727('0x46')][_0x9727('0x6f')])[_0x9727('0x38')](function(){if(_[_0x9727('0xba')](_0x15a494['query']['ids'])){for(var _0x56db18=0x0;_0x56db18<_0x15a494['query'][_0x9727('0x6f')][_0x9727('0x4b')];_0x56db18+=0x1){socket[_0x9727('0xb7')](_0x9727('0xbb'),{'UserId':Number(_0x15a494[_0x9727('0x46')][_0x9727('0x6f')][_0x56db18]),'OpenchannelAccountId':Number(_0x15a494[_0x9727('0x59')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x15a494[_0x9727('0x46')][_0x9727('0x6f')]),'OpenchannelAccountId':Number(_0x15a494[_0x9727('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x2f41e7,null))['catch'](handleError(_0x2f41e7,null));};exports[_0x9727('0xbc')]=function(_0x59e052,_0x19abce,_0x22bb65){var _0x9813b7={};var _0x4268a={};var _0x5e7af7;var _0x5392b5;return db[_0x9727('0x41')][_0x9727('0x6d')]({'where':{'id':_0x59e052[_0x9727('0x59')]['id']}})['then'](handleEntityNotFound(_0x19abce,null))['then'](function(_0xc73c73){if(_0xc73c73){_0x5e7af7=_0xc73c73;_0x4268a[_0x9727('0x45')]=_[_0x9727('0x5b')](db[_0x9727('0x9e')][_0x9727('0x42')]);_0x4268a[_0x9727('0x46')]=_[_0x9727('0x5b')](_0x59e052[_0x9727('0x46')]);_0x4268a[_0x9727('0x47')]=_[_0x9727('0x48')](_0x4268a['model'],_0x4268a[_0x9727('0x46')]);_0x9813b7[_0x9727('0x49')]=_[_0x9727('0x48')](_0x4268a[_0x9727('0x45')],qs[_0x9727('0x4a')](_0x59e052[_0x9727('0x46')][_0x9727('0x4a')]));_0x9813b7[_0x9727('0x49')]=_0x9813b7['attributes']['length']?_0x9813b7['attributes']:_0x4268a[_0x9727('0x45')];_0x9813b7['order']=qs['sort'](_0x59e052['query'][_0x9727('0x4f')]);_0x9813b7[_0x9727('0x50')]=qs[_0x9727('0x47')](_['pick'](_0x59e052[_0x9727('0x46')],_0x4268a['filters']));if(_0x59e052[_0x9727('0x46')]['filter']){_0x9813b7[_0x9727('0x50')]=_[_0x9727('0x5c')](_0x9813b7[_0x9727('0x50')],{'$or':_[_0x9727('0x40')](_0x9813b7[_0x9727('0x49')],function(_0xaa3928){var _0x2a35eb={};_0x2a35eb[_0xaa3928]={'$like':'%'+_0x59e052[_0x9727('0x46')]['filter']+'%'};return _0x2a35eb;})});}_0x9813b7=_[_0x9727('0x5c')]({},_0x9813b7,_0x59e052[_0x9727('0x53')]);return _0x5e7af7[_0x9727('0xbc')](_0x9813b7);}})[_0x9727('0x38')](function(_0x466dd7){if(_0x466dd7){_0x5392b5=_0x466dd7[_0x9727('0x4b')];if(!_0x59e052[_0x9727('0x46')][_0x9727('0x4c')](_0x9727('0x4d'))){_0x9813b7[_0x9727('0x31')]=qs['limit'](_0x59e052[_0x9727('0x46')]['limit']);_0x9813b7[_0x9727('0x33')]=qs[_0x9727('0x33')](_0x59e052[_0x9727('0x46')]['offset']);}return _0x5e7af7[_0x9727('0xbc')](_0x9813b7);}})['then'](function(_0x396f58){if(_0x396f58){return _0x396f58?{'count':_0x5392b5,'rows':_0x396f58}:null;}})[_0x9727('0x38')](respondWithResult(_0x19abce,null))[_0x9727('0x2b')](handleError(_0x19abce,null));};exports[_0x9727('0x3d')]=function(_0xe223c6,_0x5f1ad3,_0x92dac){var _0x1418db,_0x4c8ded,_0x50fbbe;if(_[_0x9727('0x7e')](_0xe223c6[_0x9727('0x5f')]['body'])||_0xe223c6[_0x9727('0x5f')][_0x9727('0x5f')]===''){throw new db[(_0x9727('0x77'))]['ValidationError'](_0x9727('0xbd'));}if(_[_0x9727('0x7e')](_0xe223c6[_0x9727('0x5f')]['to'])){}_0x1418db=_0xe223c6[_0x9727('0x5f')]['to'];return db[_0x9727('0x41')][_0x9727('0x6d')]({'where':{'id':_0xe223c6['params']['id']}})[_0x9727('0x38')](handleEntityNotFound(_0x5f1ad3,null))['then'](function(_0x2c49c1){if(_0x2c49c1){return db[_0x9727('0x41')][_0x9727('0x5d')]({'where':{'id':_0x2c49c1['id']},'include':[{'model':db[_0x9727('0xbe')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x2c49c1[_0x9727('0x81')]]:_0x1418db},'limit':0x1,'order':[[_0x9727('0x7c'),_0x9727('0x86')]]}]}]})[_0x9727('0x38')](handleEntityNotFound(_0x5f1ad3,null))[_0x9727('0x38')](function(_0x41ee7a){if(_0x41ee7a&&_0x41ee7a[_0x9727('0x84')]){_0x4c8ded=_0x41ee7a['get']({'plain':!![]});if(_0x4c8ded[_0x9727('0x84')]&&_0x4c8ded['List'][_0x9727('0x85')]['length']){return _0x4c8ded[_0x9727('0x84')][_0x9727('0x85')][0x0];}return db[_0x9727('0x76')][_0x9727('0x5e')](_[_0x9727('0x1b')](_0xe223c6['body'],{'firstName':_0x1418db,[_0x41ee7a[_0x9727('0x81')]]:_0x1418db,'phone':_0x1418db,'ListId':_0x4c8ded[_0x9727('0x7d')]}));}})[_0x9727('0x38')](handleEntityNotFound(_0x5f1ad3,null))[_0x9727('0x38')](function(_0x2d684d){if(_0x2d684d){_0x50fbbe=_0x2d684d;return db[_0x9727('0x92')][_0x9727('0x5d')]({'where':{'ContactId':_0x50fbbe['id'],'closed':![],'OpenchannelAccountId':_0x4c8ded['id']}})['then'](function(_0x48d277){if(_0x48d277){return[_0x48d277,![]];}return db['OpenchannelInteraction'][_0x9727('0x5e')]({'UserId':_0xe223c6[_0x9727('0x62')]['id'],'ContactId':_0x50fbbe['id'],'OpenchannelAccountId':_0x4c8ded['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0xe223c6[_0x9727('0x5f')],{'read':![],'body':_0xe223c6['body'][_0x9727('0x5f')],'OpenchannelAccountId':_0x4c8ded['id'],'UserId':_0xe223c6[_0x9727('0x62')]['id'],'ContactId':_0x50fbbe['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})['then'](function(_0x4d1ff8){return[_0x4d1ff8,!![]];});});}})[_0x9727('0x95')](function(_0x25dc16,_0x4f56ba){if(_0x4f56ba){return _0x25dc16;}return db[_0x9727('0x9b')][_0x9727('0x5e')](_[_0x9727('0x5c')](_0xe223c6[_0x9727('0x5f')],{'read':![],'body':_0xe223c6[_0x9727('0x5f')][_0x9727('0x5f')],'OpenchannelAccountId':_0x4c8ded['id'],'OpenchannelInteractionId':_0x25dc16['id'],'UserId':_0xe223c6[_0x9727('0x62')]['id'],'ContactId':_0x50fbbe['id']}))[_0x9727('0x38')](function(_0x37b34a){_0x25dc16['dataValues'][_0x9727('0xbf')]=[];_0x25dc16['dataValues'][_0x9727('0xbf')][_0x9727('0xc0')](_0x37b34a[_0x9727('0xc1')]);return _0x25dc16;});});}})[_0x9727('0x38')](respondWithResult(_0x5f1ad3,null))[_0x9727('0x2b')](handleError(_0x5f1ad3,null));}; \ No newline at end of file +var _0x3d90=['client','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','name','send','index','Pause','OpenchannelAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','DESC','Applications','account','applications','list','orderBy','asc','Contacts','contact','threadId','OpenchannelInteraction','ContactId','spread','firstName','lastName','messageId','interaction','created','autoclose','push','close','AttachmentId','UserId','User','unshift','*,*,*,*','forcedOwnership','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','OpenchannelMessage','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelAccount.socket','register','jayson/promise','http'];(function(_0x3dd0b9,_0x1d6c92){var _0x4c0351=function(_0x2cf6a8){while(--_0x2cf6a8){_0x3dd0b9['push'](_0x3dd0b9['shift']());}};_0x4c0351(++_0x1d6c92);}(_0x3d90,0xa3));var _0x03d9=function(_0x2f1e20,_0x5c6e61){_0x2f1e20=_0x2f1e20-0x0;var _0x3ea28b=_0x3d90[_0x2f1e20];return _0x3ea28b;};'use strict';var emlformat=require(_0x03d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03d9('0x1'));var jsonpatch=require(_0x03d9('0x2'));var rp=require(_0x03d9('0x3'));var moment=require(_0x03d9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x03d9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x03d9('0x6'));var ejs=require(_0x03d9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x03d9('0x8'));var squel=require('squel');var crypto=require(_0x03d9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x03d9('0xa'));var toCsv=require(_0x03d9('0x6'));var querystring=require(_0x03d9('0xb'));var Papa=require(_0x03d9('0xc'));var Redis=require(_0x03d9('0xd'));var authService=require(_0x03d9('0xe'));var qs=require(_0x03d9('0xf'));var as=require(_0x03d9('0x10'));var hardwareService=require(_0x03d9('0x11'));var logger=require(_0x03d9('0x12'))(_0x03d9('0x13'));var utils=require(_0x03d9('0x14'));var config=require(_0x03d9('0x15'));var licenseUtil=require(_0x03d9('0x16'));var db=require(_0x03d9('0x17'))['db'];config[_0x03d9('0x18')]=_[_0x03d9('0x19')](config[_0x03d9('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x03d9('0x1a'))[_0x03d9('0x1b')](socket);var jayson=require(_0x03d9('0x1c'));var client=jayson['client'][_0x03d9('0x1d')]({'port':0x232c});var client9002=jayson[_0x03d9('0x1e')][_0x03d9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x20d72e,_0x540bd1,_0x40d2e3,_0x2e5341){return new BPromise(function(_0x242fd2,_0x1a91b2){var _0x1027f9=_0x2e5341||client;return _0x1027f9[_0x03d9('0x1f')](_0x20d72e,_0x40d2e3)[_0x03d9('0x20')](function(_0x28482e){logger['info'](_0x03d9('0x21'),_0x540bd1,_0x03d9('0x22'));logger[_0x03d9('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x540bd1,_0x03d9('0x22'),JSON[_0x03d9('0x24')](_0x28482e));if(_0x28482e[_0x03d9('0x25')]){if(_0x28482e[_0x03d9('0x25')][_0x03d9('0x26')]===0x1f4){logger[_0x03d9('0x25')](_0x03d9('0x21'),_0x540bd1,_0x28482e[_0x03d9('0x25')][_0x03d9('0x27')]);return _0x1a91b2(_0x28482e['error'][_0x03d9('0x27')]);}logger[_0x03d9('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x540bd1,_0x28482e[_0x03d9('0x25')][_0x03d9('0x27')]);return _0x242fd2(_0x28482e[_0x03d9('0x25')]['message']);}else{logger[_0x03d9('0x28')](_0x03d9('0x21'),_0x540bd1,'request\x20sent');_0x242fd2(_0x28482e[_0x03d9('0x29')]['message']);}})['catch'](function(_0x4147dd){logger['error'](_0x03d9('0x21'),_0x540bd1,_0x4147dd);_0x1a91b2(_0x4147dd);});});}function respondWithStatusCode(_0x382500,_0x10df07){_0x10df07=_0x10df07||0xcc;return function(_0x20d149){if(_0x20d149){return _0x382500['sendStatus'](_0x10df07);}return _0x382500[_0x03d9('0x2a')](_0x10df07)[_0x03d9('0x2b')]();};}function respondWithResult(_0x4acb2a,_0x379025){_0x379025=_0x379025||0xc8;return function(_0x2cb110){if(_0x2cb110){return _0x4acb2a['status'](_0x379025)[_0x03d9('0x2c')](_0x2cb110);}};}function respondWithFilteredResult(_0x33dc17,_0x5c4c29){return function(_0x18856d){if(_0x18856d){var _0x4815c1=typeof _0x5c4c29[_0x03d9('0x2d')]===_0x03d9('0x2e')&&typeof _0x5c4c29[_0x03d9('0x2f')]===_0x03d9('0x2e');var _0x101ba9=_0x18856d[_0x03d9('0x30')];var _0xc5213c=_0x4815c1?0x0:_0x5c4c29[_0x03d9('0x2d')];var _0x1d98f2=_0x4815c1?_0x18856d[_0x03d9('0x30')]:_0x5c4c29[_0x03d9('0x2d')]+_0x5c4c29['limit'];var _0x69aa90;if(_0x1d98f2>=_0x101ba9){_0x1d98f2=_0x101ba9;_0x69aa90=0xc8;}else{_0x69aa90=0xce;}_0x33dc17[_0x03d9('0x2a')](_0x69aa90);return _0x33dc17[_0x03d9('0x31')](_0x03d9('0x32'),_0xc5213c+'-'+_0x1d98f2+'/'+_0x101ba9)[_0x03d9('0x2c')](_0x18856d);}return null;};}function patchUpdates(_0x1a462a){return function(_0x1ee591){try{jsonpatch[_0x03d9('0x33')](_0x1ee591,_0x1a462a,!![]);}catch(_0x4542a7){return BPromise['reject'](_0x4542a7);}return _0x1ee591[_0x03d9('0x34')]();};}function saveUpdates(_0x2592da,_0x490ea2){return function(_0x2f3c51){if(_0x2f3c51){return _0x2f3c51[_0x03d9('0x35')](_0x2592da)[_0x03d9('0x20')](function(_0x59d079){return _0x59d079;});}return null;};}function removeEntity(_0x41a548,_0x21c96f){return function(_0x4d9e06){if(_0x4d9e06){return _0x4d9e06[_0x03d9('0x36')]()[_0x03d9('0x20')](function(){var _0x48a74e=_0x4d9e06[_0x03d9('0x37')]({'plain':!![]});var _0x40bc66=_0x03d9('0x38');return db[_0x03d9('0x39')][_0x03d9('0x36')]({'where':{'type':_0x40bc66,'resourceId':_0x48a74e['id']}})['then'](function(){return _0x4d9e06;});})['then'](function(){_0x41a548[_0x03d9('0x2a')](0xcc)[_0x03d9('0x2b')]();});}};}function handleEntityNotFound(_0x2b0e59,_0x37c028){return function(_0x4116ef){if(!_0x4116ef){_0x2b0e59[_0x03d9('0x3a')](0x194);}return _0x4116ef;};}function handleError(_0x462d44,_0x1278b4){_0x1278b4=_0x1278b4||0x1f4;return function(_0x570a94){logger[_0x03d9('0x25')](_0x570a94['stack']);if(_0x570a94['name']){delete _0x570a94[_0x03d9('0x3b')];}_0x462d44[_0x03d9('0x2a')](_0x1278b4)[_0x03d9('0x3c')](_0x570a94);};}exports[_0x03d9('0x3d')]=function(_0x11b8ba,_0x229996){var _0x5a5229={'include':[{'model':db[_0x03d9('0x3e')],'as':'mandatoryDispositionPause'}]},_0x581af8={},_0x5f48f1={'count':0x0,'rows':[]};var _0x3f4400=_['map'](db[_0x03d9('0x3f')][_0x03d9('0x40')],function(_0x7b45b9){return{'name':_0x7b45b9[_0x03d9('0x41')],'type':_0x7b45b9['type'][_0x03d9('0x42')]};});_0x581af8[_0x03d9('0x43')]=_[_0x03d9('0x44')](_0x3f4400,'name');_0x581af8[_0x03d9('0x45')]=_[_0x03d9('0x46')](_0x11b8ba[_0x03d9('0x45')]);_0x581af8['filters']=_[_0x03d9('0x47')](_0x581af8[_0x03d9('0x43')],_0x581af8[_0x03d9('0x45')]);_0x5a5229[_0x03d9('0x48')]=_[_0x03d9('0x47')](_0x581af8[_0x03d9('0x43')],qs[_0x03d9('0x49')](_0x11b8ba['query'][_0x03d9('0x49')]));_0x5a5229[_0x03d9('0x48')]=_0x5a5229[_0x03d9('0x48')][_0x03d9('0x4a')]?_0x5a5229[_0x03d9('0x48')]:_0x581af8[_0x03d9('0x43')];if(!_0x11b8ba[_0x03d9('0x45')][_0x03d9('0x4b')](_0x03d9('0x4c'))){_0x5a5229['limit']=qs[_0x03d9('0x2f')](_0x11b8ba[_0x03d9('0x45')][_0x03d9('0x2f')]);_0x5a5229[_0x03d9('0x2d')]=qs[_0x03d9('0x2d')](_0x11b8ba[_0x03d9('0x45')][_0x03d9('0x2d')]);}_0x5a5229[_0x03d9('0x4d')]=qs['sort'](_0x11b8ba[_0x03d9('0x45')][_0x03d9('0x4e')]);_0x5a5229[_0x03d9('0x4f')]=qs[_0x03d9('0x50')](_[_0x03d9('0x51')](_0x11b8ba[_0x03d9('0x45')],_0x581af8['filters']),_0x3f4400);if(_0x11b8ba[_0x03d9('0x45')]['filter']){_0x5a5229['where']=_[_0x03d9('0x52')](_0x5a5229[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x44')](_0x3f4400,function(_0x4ac6db){if(_0x4ac6db[_0x03d9('0x53')]!==_0x03d9('0x54')){var _0x189645={};_0x189645[_0x4ac6db[_0x03d9('0x3b')]]={'$like':'%'+_0x11b8ba[_0x03d9('0x45')][_0x03d9('0x55')]+'%'};return _0x189645;}})});}_0x5a5229=_[_0x03d9('0x52')]({},_0x5a5229,_0x11b8ba[_0x03d9('0x56')]);var _0x5562ea={'where':_0x5a5229['where']};return db['OpenchannelAccount'][_0x03d9('0x30')](_0x5562ea)[_0x03d9('0x20')](function(_0x56f43b){_0x5f48f1[_0x03d9('0x30')]=_0x56f43b;if(_0x11b8ba[_0x03d9('0x45')]['includeAll']){_0x5a5229[_0x03d9('0x57')]=[{'all':!![]}];}return db[_0x03d9('0x3f')][_0x03d9('0x58')](_0x5a5229);})[_0x03d9('0x20')](function(_0x3db0a7){_0x5f48f1['rows']=_0x3db0a7;return _0x5f48f1;})[_0x03d9('0x20')](respondWithFilteredResult(_0x229996,_0x5a5229))[_0x03d9('0x59')](handleError(_0x229996,null));};exports[_0x03d9('0x5a')]=function(_0x3b3637,_0x3a017a){var _0x5c0d7b={'raw':![],'where':{'id':_0x3b3637[_0x03d9('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2fe17f={};_0x2fe17f['model']=_[_0x03d9('0x46')](db[_0x03d9('0x3f')]['rawAttributes']);_0x2fe17f[_0x03d9('0x45')]=_[_0x03d9('0x46')](_0x3b3637[_0x03d9('0x45')]);_0x2fe17f['filters']=_['intersection'](_0x2fe17f['model'],_0x2fe17f[_0x03d9('0x45')]);_0x5c0d7b['attributes']=_['intersection'](_0x2fe17f[_0x03d9('0x43')],qs[_0x03d9('0x49')](_0x3b3637['query']['fields']));_0x5c0d7b[_0x03d9('0x48')]=_0x5c0d7b[_0x03d9('0x48')][_0x03d9('0x4a')]?_0x5c0d7b[_0x03d9('0x48')]:_0x2fe17f[_0x03d9('0x43')];if(_0x3b3637['query'][_0x03d9('0x5c')]){_0x5c0d7b[_0x03d9('0x57')]=[{'all':!![]}];}_0x5c0d7b=_[_0x03d9('0x52')]({},_0x5c0d7b,_0x3b3637[_0x03d9('0x56')]);return db[_0x03d9('0x3f')][_0x03d9('0x5d')](_0x5c0d7b)[_0x03d9('0x20')](handleEntityNotFound(_0x3a017a,null))[_0x03d9('0x20')](respondWithResult(_0x3a017a,null))[_0x03d9('0x59')](handleError(_0x3a017a,null));};exports[_0x03d9('0x5e')]=function(_0xfee96e,_0x846eb6){return db[_0x03d9('0x3f')][_0x03d9('0x5e')](_0xfee96e['body'],{})['then'](function(_0x208162){var _0x4da344=_0xfee96e[_0x03d9('0x5f')][_0x03d9('0x37')]({'plain':!![]});if(!_0x4da344)throw new Error(_0x03d9('0x60'));if(_0x4da344[_0x03d9('0x61')]===_0x03d9('0x5f')){var _0x586854=_0x208162['get']({'plain':!![]});var _0xd8e316=_0x03d9('0x38');return db[_0x03d9('0x62')][_0x03d9('0x5d')]({'where':{'name':_0xd8e316,'userProfileId':_0x4da344[_0x03d9('0x63')]},'raw':!![]})[_0x03d9('0x20')](function(_0x25726c){if(_0x25726c&&_0x25726c[_0x03d9('0x64')]===0x0){return db['UserProfileResource'][_0x03d9('0x5e')]({'name':_0x586854[_0x03d9('0x3b')],'resourceId':_0x586854['id'],'type':_0x25726c[_0x03d9('0x3b')],'sectionId':_0x25726c['id']},{})[_0x03d9('0x20')](function(){return _0x208162;});}else{return _0x208162;}})[_0x03d9('0x59')](function(_0x23c4d5){logger[_0x03d9('0x25')](_0x03d9('0x65'),_0x23c4d5);throw _0x23c4d5;});}return _0x208162;})['then'](respondWithResult(_0x846eb6,0xc9))['catch'](handleError(_0x846eb6,null));};exports[_0x03d9('0x35')]=function(_0x4314c2,_0x185c0a){if(_0x4314c2[_0x03d9('0x66')]['id']){delete _0x4314c2[_0x03d9('0x66')]['id'];}return db[_0x03d9('0x3f')][_0x03d9('0x5d')]({'where':{'id':_0x4314c2[_0x03d9('0x5b')]['id']},'include':[{'model':db[_0x03d9('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x03d9('0x20')](handleEntityNotFound(_0x185c0a,null))[_0x03d9('0x20')](saveUpdates(_0x4314c2['body'],null))[_0x03d9('0x20')](respondWithResult(_0x185c0a,null))[_0x03d9('0x59')](handleError(_0x185c0a,null));};exports[_0x03d9('0x36')]=function(_0x4c870a,_0x27237c){return db[_0x03d9('0x3f')][_0x03d9('0x5d')]({'where':{'id':_0x4c870a[_0x03d9('0x5b')]['id']}})[_0x03d9('0x20')](handleEntityNotFound(_0x27237c,null))['then'](removeEntity(_0x27237c,null))[_0x03d9('0x59')](handleError(_0x27237c,null));};exports[_0x03d9('0x67')]=function(_0x20ebf3,_0x3ed26f){return db[_0x03d9('0x3f')][_0x03d9('0x67')]()[_0x03d9('0x20')](respondWithResult(_0x3ed26f,null))[_0x03d9('0x59')](handleError(_0x3ed26f,null));};exports['addDisposition']=function(_0x1d9cdc,_0x5b88ee,_0x22044d){if(_0x1d9cdc[_0x03d9('0x66')]['id']){delete _0x1d9cdc[_0x03d9('0x66')]['id'];}return db[_0x03d9('0x3f')][_0x03d9('0x5d')]({'where':{'id':_0x1d9cdc[_0x03d9('0x5b')]['id']}})[_0x03d9('0x20')](handleEntityNotFound(_0x5b88ee,null))['then'](function(_0x42bcaf){if(_0x42bcaf){_0x1d9cdc[_0x03d9('0x66')][_0x03d9('0x68')]=_0x42bcaf['id'];return db[_0x03d9('0x69')][_0x03d9('0x5e')](_0x1d9cdc[_0x03d9('0x66')]);}})[_0x03d9('0x20')](respondWithResult(_0x5b88ee,null))[_0x03d9('0x59')](handleError(_0x5b88ee,null));};exports['getDispositions']=function(_0x7af69e,_0x1c8e08,_0x4809b2){var _0x12191e={'raw':![],'where':{}};var _0x2a1f21={};var _0x167229={'count':0x0,'rows':[]};return db[_0x03d9('0x3f')][_0x03d9('0x6a')]({'where':{'id':_0x7af69e[_0x03d9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1c8e08,null))[_0x03d9('0x20')](function(_0x2c2774){if(_0x2c2774){_0x2a1f21[_0x03d9('0x43')]=_[_0x03d9('0x46')](db['Disposition'][_0x03d9('0x40')]);_0x2a1f21[_0x03d9('0x45')]=_[_0x03d9('0x46')](_0x7af69e[_0x03d9('0x45')]);_0x2a1f21[_0x03d9('0x50')]=_[_0x03d9('0x47')](_0x2a1f21['model'],_0x2a1f21[_0x03d9('0x45')]);_0x12191e[_0x03d9('0x48')]=_[_0x03d9('0x47')](_0x2a1f21['model'],qs[_0x03d9('0x49')](_0x7af69e[_0x03d9('0x45')]['fields']));_0x12191e[_0x03d9('0x48')]=_0x12191e['attributes']['length']?_0x12191e['attributes']:_0x2a1f21[_0x03d9('0x43')];if(!_0x7af69e[_0x03d9('0x45')][_0x03d9('0x4b')]('nolimit')){_0x12191e['limit']=qs[_0x03d9('0x2f')](_0x7af69e[_0x03d9('0x45')][_0x03d9('0x2f')]);_0x12191e['offset']=qs[_0x03d9('0x2d')](_0x7af69e[_0x03d9('0x45')][_0x03d9('0x2d')]);}_0x12191e[_0x03d9('0x4d')]=qs['sort'](_0x7af69e['query'][_0x03d9('0x4e')]);_0x12191e['where']=qs['filters'](_[_0x03d9('0x51')](_0x7af69e[_0x03d9('0x45')],_0x2a1f21[_0x03d9('0x50')]));_0x12191e[_0x03d9('0x4f')][_0x03d9('0x68')]=_0x2c2774['id'];if(_0x7af69e['query'][_0x03d9('0x55')]){_0x12191e[_0x03d9('0x4f')]=_[_0x03d9('0x52')](_0x12191e[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x44')](_0x12191e[_0x03d9('0x48')],function(_0x277c90){var _0x256127={};_0x256127[_0x277c90]={'$like':'%'+_0x7af69e[_0x03d9('0x45')][_0x03d9('0x55')]+'%'};return _0x256127;})});}_0x12191e=_[_0x03d9('0x52')]({},_0x12191e,_0x7af69e[_0x03d9('0x56')]);return db[_0x03d9('0x69')][_0x03d9('0x30')]({'where':_0x12191e[_0x03d9('0x4f')]})[_0x03d9('0x20')](function(_0x5a35a5){_0x167229[_0x03d9('0x30')]=_0x5a35a5;if(_0x7af69e[_0x03d9('0x45')][_0x03d9('0x5c')]){_0x12191e[_0x03d9('0x57')]=[{'all':!![]}];}return db[_0x03d9('0x69')][_0x03d9('0x58')](_0x12191e);})[_0x03d9('0x20')](function(_0x46899c){_0x167229[_0x03d9('0x6b')]=_0x46899c;return _0x167229;});}})['then'](respondWithFilteredResult(_0x1c8e08,_0x12191e))[_0x03d9('0x59')](handleError(_0x1c8e08,null));};exports[_0x03d9('0x6c')]=function(_0x1c295f,_0x562e3b,_0x5bc291){return db['OpenchannelAccount'][_0x03d9('0x5d')]({'where':{'id':_0x1c295f['params']['id']}})[_0x03d9('0x20')](handleEntityNotFound(_0x562e3b,null))['then'](function(_0x50ba77){if(_0x50ba77){return _0x50ba77['removeDispositions'](_0x1c295f[_0x03d9('0x45')][_0x03d9('0x6d')]);}})[_0x03d9('0x20')](respondWithStatusCode(_0x562e3b,null))[_0x03d9('0x59')](handleError(_0x562e3b,null));};exports[_0x03d9('0x6e')]=function(_0xe3f204,_0x186ae5,_0x2ef241){if(_0xe3f204[_0x03d9('0x66')]['id']){delete _0xe3f204[_0x03d9('0x66')]['id'];}return db[_0x03d9('0x3f')]['find']({'where':{'id':_0xe3f204['params']['id']}})[_0x03d9('0x20')](handleEntityNotFound(_0x186ae5,null))[_0x03d9('0x20')](function(_0x58e454){if(_0x58e454){_0xe3f204[_0x03d9('0x66')][_0x03d9('0x68')]=_0x58e454['id'];return db[_0x03d9('0x6f')][_0x03d9('0x5e')](_0xe3f204['body']);}})[_0x03d9('0x20')](respondWithResult(_0x186ae5,null))[_0x03d9('0x59')](handleError(_0x186ae5,null));};exports['getAnswers']=function(_0x587981,_0x12de6e,_0x1f7f8a){var _0x3d3866={'raw':![],'where':{}};var _0xc8959b={};var _0x4ef0a1={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x587981['params']['id']}})[_0x03d9('0x20')](handleEntityNotFound(_0x12de6e,null))[_0x03d9('0x20')](function(_0x1b06a1){if(_0x1b06a1){_0xc8959b[_0x03d9('0x43')]=_[_0x03d9('0x46')](db[_0x03d9('0x6f')][_0x03d9('0x40')]);_0xc8959b[_0x03d9('0x45')]=_[_0x03d9('0x46')](_0x587981[_0x03d9('0x45')]);_0xc8959b[_0x03d9('0x50')]=_[_0x03d9('0x47')](_0xc8959b[_0x03d9('0x43')],_0xc8959b[_0x03d9('0x45')]);_0x3d3866[_0x03d9('0x48')]=_[_0x03d9('0x47')](_0xc8959b[_0x03d9('0x43')],qs[_0x03d9('0x49')](_0x587981[_0x03d9('0x45')][_0x03d9('0x49')]));_0x3d3866[_0x03d9('0x48')]=_0x3d3866[_0x03d9('0x48')][_0x03d9('0x4a')]?_0x3d3866[_0x03d9('0x48')]:_0xc8959b[_0x03d9('0x43')];if(!_0x587981[_0x03d9('0x45')]['hasOwnProperty'](_0x03d9('0x4c'))){_0x3d3866['limit']=qs[_0x03d9('0x2f')](_0x587981['query'][_0x03d9('0x2f')]);_0x3d3866[_0x03d9('0x2d')]=qs[_0x03d9('0x2d')](_0x587981[_0x03d9('0x45')][_0x03d9('0x2d')]);}_0x3d3866['order']=qs['sort'](_0x587981[_0x03d9('0x45')][_0x03d9('0x4e')]);_0x3d3866[_0x03d9('0x4f')]=qs['filters'](_[_0x03d9('0x51')](_0x587981[_0x03d9('0x45')],_0xc8959b[_0x03d9('0x50')]));_0x3d3866[_0x03d9('0x4f')][_0x03d9('0x68')]=_0x1b06a1['id'];if(_0x587981[_0x03d9('0x45')][_0x03d9('0x55')]){_0x3d3866['where']=_[_0x03d9('0x52')](_0x3d3866[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x44')](_0x3d3866['attributes'],function(_0x405191){var _0x5f123a={};_0x5f123a[_0x405191]={'$like':'%'+_0x587981[_0x03d9('0x45')][_0x03d9('0x55')]+'%'};return _0x5f123a;})});}_0x3d3866=_[_0x03d9('0x52')]({},_0x3d3866,_0x587981[_0x03d9('0x56')]);return db[_0x03d9('0x6f')][_0x03d9('0x30')]({'where':_0x3d3866[_0x03d9('0x4f')]})[_0x03d9('0x20')](function(_0x3193b0){_0x4ef0a1[_0x03d9('0x30')]=_0x3193b0;if(_0x587981[_0x03d9('0x45')][_0x03d9('0x5c')]){_0x3d3866[_0x03d9('0x57')]=[{'all':!![]}];}return db[_0x03d9('0x6f')][_0x03d9('0x58')](_0x3d3866);})[_0x03d9('0x20')](function(_0x43454b){_0x4ef0a1[_0x03d9('0x6b')]=_0x43454b;return _0x4ef0a1;});}})[_0x03d9('0x20')](respondWithFilteredResult(_0x12de6e,_0x3d3866))[_0x03d9('0x59')](handleError(_0x12de6e,null));};exports[_0x03d9('0x70')]=function(_0x378a5f,_0x342e3d,_0x3cc305){return db[_0x03d9('0x3f')][_0x03d9('0x5d')]({'where':{'id':_0x378a5f[_0x03d9('0x5b')]['id']}})[_0x03d9('0x20')](handleEntityNotFound(_0x342e3d,null))['then'](function(_0x38b4b8){if(_0x38b4b8){return _0x38b4b8['removeAnswers'](_0x378a5f[_0x03d9('0x45')][_0x03d9('0x6d')]);}})[_0x03d9('0x20')](respondWithStatusCode(_0x342e3d,null))[_0x03d9('0x59')](handleError(_0x342e3d,null));};exports[_0x03d9('0x71')]=function(_0xd972c1,_0x2c1edc,_0x5edf0c){var _0x2ee3cc={'body':_0xd972c1[_0x03d9('0x66')],'channel':_0x03d9('0x72')};var _0x208f2b=[];var _0x4f5d66=[];var _0x3b6055={};var _0xd212c6=![];return db['CmContact'][_0x03d9('0x67')]()[_0x03d9('0x20')](function(_0x4a670f){if(!_0x4a670f){throw new db['Sequelize'][(_0x03d9('0x73'))](_0x03d9('0x74'));}_0x208f2b=_[_0x03d9('0x75')](_['keys'](_0x4a670f),[_0x03d9('0x76'),_0x03d9('0x77')]);_0x4f5d66=_[_0x03d9('0x75')](_[_0x03d9('0x46')](_0x4a670f),[_0x03d9('0x76'),_0x03d9('0x77'),_0x03d9('0x78'),_0x03d9('0x79')]);if(_0xd972c1['body']['id']){delete _0xd972c1[_0x03d9('0x66')]['id'];}if(_['isNil'](_0xd972c1[_0x03d9('0x66')][_0x03d9('0x7a')])){throw new db[(_0x03d9('0x7b'))]['ValidationError'](_0x03d9('0x7c'));}if(_['isNil'](_0xd972c1[_0x03d9('0x66')][_0x03d9('0x66')])||_0xd972c1[_0x03d9('0x66')][_0x03d9('0x66')]===''){throw new db['Sequelize']['ValidationError'](_0x03d9('0x7d'));}if(_[_0x03d9('0x7e')](_0xd972c1[_0x03d9('0x66')][_0x03d9('0x7f')])){throw new db['Sequelize'][(_0x03d9('0x73'))](_0x03d9('0x80')+_0x4f5d66);}if(!_[_0x03d9('0x81')](_0x4f5d66,_0xd972c1[_0x03d9('0x66')][_0x03d9('0x7f')])){throw new db[(_0x03d9('0x7b'))][(_0x03d9('0x73'))](_0x03d9('0x82')+_0x4f5d66);}_0x3b6055[_0xd972c1[_0x03d9('0x66')][_0x03d9('0x7f')]]=_0xd972c1[_0x03d9('0x66')][_0x03d9('0x7a')];})['then'](function(){return db[_0x03d9('0x3f')][_0x03d9('0x5d')]({'where':{'id':_0xd972c1[_0x03d9('0x5b')]['id']},'include':[{'model':db[_0x03d9('0x83')],'as':_0x03d9('0x84'),'include':[{'model':db[_0x03d9('0x85')],'as':'Contacts','where':_0x3b6055,'limit':0x1,'order':[[_0x03d9('0x77'),_0x03d9('0x86')]]}]},{'model':db['OpenchannelApplication'],'as':_0x03d9('0x87')}]});})[_0x03d9('0x20')](handleEntityNotFound(_0x2c1edc,null))[_0x03d9('0x20')](function(_0x16b2f5){if(_0x16b2f5&&_0x16b2f5[_0x03d9('0x84')]){_0x2ee3cc[_0x03d9('0x88')]=_0x16b2f5;_0x2ee3cc[_0x03d9('0x89')]=_0x16b2f5[_0x03d9('0x87')];_0x2ee3cc[_0x03d9('0x8a')]=_0x16b2f5[_0x03d9('0x84')];_0x2ee3cc[_0x03d9('0x89')]=_[_0x03d9('0x8b')](_0x2ee3cc[_0x03d9('0x89')],['priority'],[_0x03d9('0x8c')]);if(_0x2ee3cc[_0x03d9('0x88')][_0x03d9('0x87')]){delete _0x2ee3cc[_0x03d9('0x88')]['Applications'];}if(_0x2ee3cc['account']['List']&&_0x2ee3cc['account'][_0x03d9('0x84')][_0x03d9('0x8d')][_0x03d9('0x4a')]){return _0x2ee3cc[_0x03d9('0x88')][_0x03d9('0x84')][_0x03d9('0x8d')][0x0];}var _0x1a5648=_[_0x03d9('0x19')](_0xd972c1[_0x03d9('0x66')],{'firstName':_0xd972c1[_0x03d9('0x66')][_0x03d9('0x7a')],'ListId':_0x16b2f5[_0x03d9('0x79')]});_0x1a5648[_0xd972c1[_0x03d9('0x66')][_0x03d9('0x7f')]]=_0xd972c1[_0x03d9('0x66')]['from'];return db['CmContact']['create'](_0x1a5648,{'fields':_0x208f2b,'raw':!![]});}})['then'](handleEntityNotFound(_0x2c1edc,null))[_0x03d9('0x20')](function(_0x2608c7){_0x2ee3cc[_0x03d9('0x8e')]=_0x2608c7;if(_0x2608c7){var _0x1519d2={'ContactId':_0x2608c7['id'],'OpenchannelAccountId':_0xd972c1[_0x03d9('0x5b')]['id'],'from':(_0x2608c7['firstName']||'')+'\x20'+(_0x2608c7['lastName']||'')};var _0x30f0e6={'OpenchannelAccountId':_0xd972c1['params']['id'],'closed':![]};if(_0xd972c1[_0x03d9('0x66')]['threadId']){_0x30f0e6[_0x03d9('0x8f')]=_0xd972c1['body'][_0x03d9('0x8f')];return db[_0x03d9('0x90')][_0x03d9('0x5d')]({'where':_0x30f0e6})['then'](function(_0x69a3a9){if(_0x69a3a9){return[_0x69a3a9,![]];}_0x1519d2[_0x03d9('0x8f')]=_0xd972c1[_0x03d9('0x66')][_0x03d9('0x8f')];_0x1519d2['externalUrl']=_0xd972c1[_0x03d9('0x66')]['externalUrl'];return db[_0x03d9('0x90')][_0x03d9('0x5e')](_0x1519d2)[_0x03d9('0x20')](function(_0x5777ad){return[_0x5777ad,!![]];});});}else{_0x30f0e6[_0x03d9('0x8f')]=null;}_0x30f0e6[_0x03d9('0x91')]=_0x2608c7['id'];return db[_0x03d9('0x90')][_0x03d9('0x5d')]({'where':_0x30f0e6})[_0x03d9('0x20')](function(_0x255c4d){if(_0x255c4d){return[_0x255c4d,![]];}return db[_0x03d9('0x90')][_0x03d9('0x5e')](_0x1519d2)[_0x03d9('0x20')](function(_0x4c01e6){return[_0x4c01e6,!![]];});});}})[_0x03d9('0x92')](function(_0x3778d1,_0x4c698a){if(_0x3778d1){_0xd212c6=_0x4c698a;if(!_0x4c698a){var _0x584d9f={'from':(_0x2ee3cc[_0x03d9('0x8e')][_0x03d9('0x93')]||'')+'\x20'+(_0x2ee3cc[_0x03d9('0x8e')][_0x03d9('0x94')]||'')};if(_0xd972c1[_0x03d9('0x66')]['threadId']&&_0xd972c1[_0x03d9('0x66')][_0x03d9('0x95')]&&_0xd972c1[_0x03d9('0x66')][_0x03d9('0x8f')]!=_0xd972c1['body'][_0x03d9('0x95')]){_0x584d9f[_0x03d9('0x8f')]=_0xd972c1[_0x03d9('0x66')][_0x03d9('0x95')];}return _0x3778d1[_0x03d9('0x35')](_0x584d9f);}else{return _0x3778d1;}}})[_0x03d9('0x20')](function(_0x2ede95){_0x2ee3cc['interaction']=_0x2ede95[_0x03d9('0x37')]({'plain':!![]});_0x2ee3cc[_0x03d9('0x96')][_0x03d9('0x97')]=_0xd212c6;if(_0x2ee3cc[_0x03d9('0x96')][_0x03d9('0x97')]){if(_0x2ee3cc[_0x03d9('0x88')][_0x03d9('0x98')]){_0x2ee3cc[_0x03d9('0x89')][_0x03d9('0x99')]({'id':0x0,'priority':_0x2ee3cc[_0x03d9('0x89')][_0x03d9('0x4a')]+0x1,'app':_0x03d9('0x9a'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x03d9('0x5e')]({'body':_0xd972c1[_0x03d9('0x66')]['body'],'OpenchannelAccountId':_0xd972c1[_0x03d9('0x5b')]['id'],'OpenchannelInteractionId':_0x2ede95['id'],'direction':'in','ContactId':_0x2ee3cc[_0x03d9('0x8e')]['id'],'AttachmentId':_0xd972c1[_0x03d9('0x66')][_0x03d9('0x9b')]});})[_0x03d9('0x20')](function(_0x382596){_0x2ee3cc[_0x03d9('0x27')]=_0x382596;if(_0x2ee3cc[_0x03d9('0x96')][_0x03d9('0x9c')]){return db[_0x03d9('0x9d')][_0x03d9('0x5d')]({'attributes':['id',_0x03d9('0x3b')],'where':{'id':_0x2ee3cc[_0x03d9('0x96')][_0x03d9('0x9c')]}})[_0x03d9('0x20')](function(_0x36cf29){if(_0x36cf29){_0x2ee3cc[_0x03d9('0x89')][_0x03d9('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x36cf29[_0x03d9('0x3b')]+','+(_0x2ee3cc[_0x03d9('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0x03d9('0x9f')});_0x2ee3cc[_0x03d9('0xa0')]=![];}return respondWithRpcPromise(_0x03d9('0xa1'),'startRouting',_0x2ee3cc);});}return respondWithRpcPromise(_0x03d9('0xa1'),'startRouting',_0x2ee3cc);})[_0x03d9('0x20')](function(_0x21a749){respondWithRpcPromise(_0x03d9('0xa2'),_0x03d9('0xa2'),{'event':_0x03d9('0x71'),'message':_0x21a749},client9002);return _0x21a749;})[_0x03d9('0x20')](respondWithResult(_0x2c1edc,null))[_0x03d9('0x59')](handleError(_0x2c1edc,null));};exports[_0x03d9('0xa3')]=function(_0x1e60a5,_0x2800c5){var _0x4604e8=_0x1e60a5[_0x03d9('0x5b')]['id'];var _0xff02c0=_0x1e60a5[_0x03d9('0x66')];var _0xccf095=0xc8;var _0x4b89e9=null;return db[_0x03d9('0xa4')][_0x03d9('0xa5')]({'isolationLevel':db[_0x03d9('0xa4')][_0x03d9('0xa6')][_0x03d9('0xa7')]['READ_COMMITTED']},function(_0x46411e){return db[_0x03d9('0x3f')][_0x03d9('0x6a')]({'where':{'id':_0x4604e8},'transaction':_0x46411e})[_0x03d9('0x20')](function(_0x4e6b53){if(_0x4e6b53){return db[_0x03d9('0xa8')]['destroy']({'where':{'OpenchannelAccountId':_0x4604e8},'transaction':_0x46411e})[_0x03d9('0x20')](function(){var _0x12b562=_['map'](_0xff02c0,function(_0x239155){_0x239155[_0x03d9('0x68')]=_0x4604e8;return _0x239155;});return db[_0x03d9('0xa8')][_0x03d9('0xa9')](_0x12b562,{'transaction':_0x46411e});});}else{_0xccf095=0x194;_0x4b89e9=[];}});})[_0x03d9('0x20')](function(){if(_0xccf095!==0x194){return db[_0x03d9('0xa8')][_0x03d9('0xaa')]({'where':{'OpenchannelAccountId':_0x4604e8},'order':'priority'})[_0x03d9('0x20')](function(_0xa4f542){_0x4b89e9=_0xa4f542;});}})['catch'](function(_0x448611){_0xccf095=0x1f4;logger[_0x03d9('0x25')](_0x448611[_0x03d9('0xab')]);if(_0x448611[_0x03d9('0x3b')]){delete _0x448611[_0x03d9('0x3b')];}_0x4b89e9=_0x448611;})['finally'](function(){if(_0x4b89e9===null){_0x2800c5[_0x03d9('0x3a')](_0xccf095);}else{if(_0xccf095===0x1f4){_0x2800c5[_0x03d9('0x2a')](_0xccf095)[_0x03d9('0x3c')](_0x4b89e9);}else{_0x2800c5['status'](_0xccf095)[_0x03d9('0x2c')](_0x4b89e9);}}});};exports[_0x03d9('0xac')]=function(_0xd2022b,_0x160fad,_0x139119){var _0x880744={};var _0x523590={};var _0xcdeed1;var _0x3f3894;return db[_0x03d9('0x3f')][_0x03d9('0x6a')]({'where':{'id':_0xd2022b[_0x03d9('0x5b')]['id']}})[_0x03d9('0x20')](handleEntityNotFound(_0x160fad,null))[_0x03d9('0x20')](function(_0x76e9a){if(_0x76e9a){_0xcdeed1=_0x76e9a;_0x523590[_0x03d9('0x43')]=_[_0x03d9('0x46')](db[_0x03d9('0xa8')]['rawAttributes']);_0x523590['query']=_[_0x03d9('0x46')](_0xd2022b[_0x03d9('0x45')]);_0x523590['filters']=_['intersection'](_0x523590[_0x03d9('0x43')],_0x523590['query']);_0x880744[_0x03d9('0x48')]=_['intersection'](_0x523590[_0x03d9('0x43')],qs[_0x03d9('0x49')](_0xd2022b['query'][_0x03d9('0x49')]));_0x880744['attributes']=_0x880744[_0x03d9('0x48')][_0x03d9('0x4a')]?_0x880744[_0x03d9('0x48')]:_0x523590[_0x03d9('0x43')];_0x880744[_0x03d9('0x4d')]=qs[_0x03d9('0x4e')](_0xd2022b[_0x03d9('0x45')][_0x03d9('0x4e')]);_0x880744[_0x03d9('0x4f')]=qs[_0x03d9('0x50')](_[_0x03d9('0x51')](_0xd2022b['query'],_0x523590[_0x03d9('0x50')]));if(_0xd2022b[_0x03d9('0x45')][_0x03d9('0x55')]){_0x880744['where']=_['merge'](_0x880744[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x44')](_0x880744[_0x03d9('0x48')],function(_0x23794c){var _0x332edf={};_0x332edf[_0x23794c]={'$like':'%'+_0xd2022b[_0x03d9('0x45')][_0x03d9('0x55')]+'%'};return _0x332edf;})});}_0x880744=_[_0x03d9('0x52')]({},_0x880744,_0xd2022b[_0x03d9('0x56')]);return _0xcdeed1[_0x03d9('0xac')](_0x880744);}})[_0x03d9('0x20')](function(_0x23a11d){if(_0x23a11d){_0x3f3894=_0x23a11d['length'];if(!_0xd2022b[_0x03d9('0x45')]['hasOwnProperty'](_0x03d9('0x4c'))){_0x880744[_0x03d9('0x2f')]=qs[_0x03d9('0x2f')](_0xd2022b[_0x03d9('0x45')][_0x03d9('0x2f')]);_0x880744[_0x03d9('0x2d')]=qs['offset'](_0xd2022b['query']['offset']);}return _0xcdeed1['getApplications'](_0x880744);}})[_0x03d9('0x20')](function(_0x4aecb3){if(_0x4aecb3){return _0x4aecb3?{'count':_0x3f3894,'rows':_0x4aecb3}:null;}})['then'](respondWithResult(_0x160fad,null))[_0x03d9('0x59')](handleError(_0x160fad,null));};exports[_0x03d9('0xad')]=function(_0x34da2e,_0x924837,_0x49decc){var _0x5b4bb0={'raw':![],'where':{}};var _0xaf392b={};var _0x33fbe1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x03d9('0x6a')]({'where':{'id':_0x34da2e[_0x03d9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x924837,null))['then'](function(_0x272b3d){if(_0x272b3d){_0xaf392b[_0x03d9('0x43')]=_['keys'](db[_0x03d9('0x90')]['rawAttributes']);_0xaf392b[_0x03d9('0x45')]=_['keys'](_0x34da2e['query']);_0xaf392b['filters']=_[_0x03d9('0x47')](_0xaf392b[_0x03d9('0x43')],_0xaf392b[_0x03d9('0x45')]);_0x5b4bb0['attributes']=_['intersection'](_0xaf392b['model'],qs[_0x03d9('0x49')](_0x34da2e[_0x03d9('0x45')][_0x03d9('0x49')]));_0x5b4bb0[_0x03d9('0x48')]=_0x5b4bb0[_0x03d9('0x48')][_0x03d9('0x4a')]?_0x5b4bb0[_0x03d9('0x48')]:_0xaf392b[_0x03d9('0x43')];if(!_0x34da2e[_0x03d9('0x45')][_0x03d9('0x4b')](_0x03d9('0x4c'))){_0x5b4bb0[_0x03d9('0x2f')]=qs[_0x03d9('0x2f')](_0x34da2e[_0x03d9('0x45')][_0x03d9('0x2f')]);_0x5b4bb0['offset']=qs[_0x03d9('0x2d')](_0x34da2e[_0x03d9('0x45')][_0x03d9('0x2d')]);}_0x5b4bb0[_0x03d9('0x4d')]=qs['sort'](_0x34da2e[_0x03d9('0x45')]['sort']);_0x5b4bb0[_0x03d9('0x4f')]=qs['filters'](_[_0x03d9('0x51')](_0x34da2e[_0x03d9('0x45')],_0xaf392b[_0x03d9('0x50')]));_0x5b4bb0[_0x03d9('0x4f')][_0x03d9('0x68')]=_0x272b3d['id'];if(_0x34da2e[_0x03d9('0x45')][_0x03d9('0x55')]){_0x5b4bb0[_0x03d9('0x4f')]=_[_0x03d9('0x52')](_0x5b4bb0['where'],{'$or':_[_0x03d9('0x44')](_0x5b4bb0[_0x03d9('0x48')],function(_0x22e52a){var _0x6de8d5={};_0x6de8d5[_0x22e52a]={'$like':'%'+_0x34da2e[_0x03d9('0x45')]['filter']+'%'};return _0x6de8d5;})});}_0x5b4bb0=_['merge']({},_0x5b4bb0,_0x34da2e[_0x03d9('0x56')]);return db['OpenchannelInteraction'][_0x03d9('0x30')]({'where':_0x5b4bb0[_0x03d9('0x4f')]})[_0x03d9('0x20')](function(_0x35496e){_0x33fbe1[_0x03d9('0x30')]=_0x35496e;if(_0x34da2e[_0x03d9('0x45')]['includeAll']){_0x5b4bb0['include']=[{'model':db[_0x03d9('0x85')],'as':_0x03d9('0xae'),'required':![]},{'model':db[_0x03d9('0x9d')],'as':_0x03d9('0xaf'),'attributes':['name',_0x03d9('0xb0'),_0x03d9('0xb1')],'required':![]},{'model':db['Tag'],'as':_0x03d9('0xb2'),'attributes':['id',_0x03d9('0x3b'),_0x03d9('0xb3')],'where':_0x34da2e[_0x03d9('0x45')]['tag']?{'id':_0x34da2e[_0x03d9('0x45')]['tag']}:undefined,'required':_0x34da2e['query'][_0x03d9('0xb4')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x03d9('0x58')](_0x5b4bb0);})[_0x03d9('0x20')](function(_0x410fef){_0x33fbe1[_0x03d9('0x6b')]=_0x410fef;return _0x33fbe1;});}})['then'](respondWithFilteredResult(_0x924837,_0x5b4bb0))[_0x03d9('0x59')](handleError(_0x924837,null));};exports['addAgents']=function(_0x309116,_0x3fa6cf,_0x5c83b1){return db[_0x03d9('0x3f')]['find']({'where':{'id':_0x309116[_0x03d9('0x5b')]['id']}})[_0x03d9('0x20')](handleEntityNotFound(_0x3fa6cf,null))[_0x03d9('0x20')](function(_0x21a8a1){if(_0x21a8a1){return _0x21a8a1[_0x03d9('0xb5')](_0x309116[_0x03d9('0x66')]['ids'],_[_0x03d9('0xb6')](_0x309116[_0x03d9('0x66')],[_0x03d9('0x6d'),'id'])||{})['spread'](function(_0x3356cf){for(var _0xe66bc4=0x0;_0xe66bc4<_0x309116[_0x03d9('0x66')][_0x03d9('0x6d')]['length'];_0xe66bc4+=0x1){socket[_0x03d9('0xb7')](_0x03d9('0xb8'),{'UserId':Number(_0x309116[_0x03d9('0x66')][_0x03d9('0x6d')][_0xe66bc4]),'OpenchannelAccountId':Number(_0x309116[_0x03d9('0x5b')]['id'])});}return _0x3356cf;});}})['then'](respondWithResult(_0x3fa6cf,null))['catch'](handleError(_0x3fa6cf,null));};exports[_0x03d9('0xb9')]=function(_0x56cd2f,_0x32809d,_0x239e4a){return db[_0x03d9('0x3f')]['find']({'where':{'id':_0x56cd2f['params']['id']}})[_0x03d9('0x20')](handleEntityNotFound(_0x32809d,null))[_0x03d9('0x20')](function(_0x1d6402){if(_0x1d6402){return _0x1d6402[_0x03d9('0xb9')](_0x56cd2f[_0x03d9('0x45')]['ids'])[_0x03d9('0x20')](function(){if(_[_0x03d9('0xba')](_0x56cd2f[_0x03d9('0x45')][_0x03d9('0x6d')])){for(var _0x357dfc=0x0;_0x357dfc<_0x56cd2f['query'][_0x03d9('0x6d')][_0x03d9('0x4a')];_0x357dfc+=0x1){socket[_0x03d9('0xb7')](_0x03d9('0xbb'),{'UserId':Number(_0x56cd2f[_0x03d9('0x45')][_0x03d9('0x6d')][_0x357dfc]),'OpenchannelAccountId':Number(_0x56cd2f[_0x03d9('0x5b')]['id'])});}}else{socket[_0x03d9('0xb7')]('userOpenchannelAccount:remove',{'UserId':Number(_0x56cd2f[_0x03d9('0x45')][_0x03d9('0x6d')]),'OpenchannelAccountId':Number(_0x56cd2f[_0x03d9('0x5b')]['id'])});}});}})[_0x03d9('0x20')](respondWithStatusCode(_0x32809d,null))[_0x03d9('0x59')](handleError(_0x32809d,null));};exports[_0x03d9('0xbc')]=function(_0x14294b,_0x41b49c,_0x176e5a){var _0x2b3bfd={};var _0x3bb44f={};var _0x1f7194;var _0x3d104b;return db['OpenchannelAccount'][_0x03d9('0x6a')]({'where':{'id':_0x14294b[_0x03d9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x41b49c,null))[_0x03d9('0x20')](function(_0x3a1e9d){if(_0x3a1e9d){_0x1f7194=_0x3a1e9d;_0x3bb44f[_0x03d9('0x43')]=_[_0x03d9('0x46')](db[_0x03d9('0x9d')]['rawAttributes']);_0x3bb44f[_0x03d9('0x45')]=_['keys'](_0x14294b[_0x03d9('0x45')]);_0x3bb44f[_0x03d9('0x50')]=_[_0x03d9('0x47')](_0x3bb44f['model'],_0x3bb44f['query']);_0x2b3bfd[_0x03d9('0x48')]=_[_0x03d9('0x47')](_0x3bb44f['model'],qs[_0x03d9('0x49')](_0x14294b['query']['fields']));_0x2b3bfd['attributes']=_0x2b3bfd[_0x03d9('0x48')][_0x03d9('0x4a')]?_0x2b3bfd[_0x03d9('0x48')]:_0x3bb44f[_0x03d9('0x43')];_0x2b3bfd[_0x03d9('0x4d')]=qs[_0x03d9('0x4e')](_0x14294b[_0x03d9('0x45')][_0x03d9('0x4e')]);_0x2b3bfd[_0x03d9('0x4f')]=qs[_0x03d9('0x50')](_['pick'](_0x14294b['query'],_0x3bb44f[_0x03d9('0x50')]));if(_0x14294b[_0x03d9('0x45')]['filter']){_0x2b3bfd[_0x03d9('0x4f')]=_[_0x03d9('0x52')](_0x2b3bfd['where'],{'$or':_[_0x03d9('0x44')](_0x2b3bfd['attributes'],function(_0x1345dc){var _0x3d89cb={};_0x3d89cb[_0x1345dc]={'$like':'%'+_0x14294b['query'][_0x03d9('0x55')]+'%'};return _0x3d89cb;})});}_0x2b3bfd=_[_0x03d9('0x52')]({},_0x2b3bfd,_0x14294b[_0x03d9('0x56')]);return _0x1f7194[_0x03d9('0xbc')](_0x2b3bfd);}})[_0x03d9('0x20')](function(_0x58c251){if(_0x58c251){_0x3d104b=_0x58c251[_0x03d9('0x4a')];if(!_0x14294b[_0x03d9('0x45')]['hasOwnProperty'](_0x03d9('0x4c'))){_0x2b3bfd['limit']=qs[_0x03d9('0x2f')](_0x14294b[_0x03d9('0x45')][_0x03d9('0x2f')]);_0x2b3bfd[_0x03d9('0x2d')]=qs[_0x03d9('0x2d')](_0x14294b['query'][_0x03d9('0x2d')]);}return _0x1f7194[_0x03d9('0xbc')](_0x2b3bfd);}})['then'](function(_0x109f84){if(_0x109f84){return _0x109f84?{'count':_0x3d104b,'rows':_0x109f84}:null;}})['then'](respondWithResult(_0x41b49c,null))[_0x03d9('0x59')](handleError(_0x41b49c,null));};exports['send']=function(_0x4c9ff5,_0x1a727c,_0x23f02c){var _0x5454f,_0xa5dc93,_0x246f18;if(_[_0x03d9('0x7e')](_0x4c9ff5[_0x03d9('0x66')]['body'])||_0x4c9ff5[_0x03d9('0x66')][_0x03d9('0x66')]===''){throw new db['Sequelize']['ValidationError'](_0x03d9('0x7d'));}if(_[_0x03d9('0x7e')](_0x4c9ff5['body']['to'])){}_0x5454f=_0x4c9ff5[_0x03d9('0x66')]['to'];return db[_0x03d9('0x3f')][_0x03d9('0x6a')]({'where':{'id':_0x4c9ff5['params']['id']}})[_0x03d9('0x20')](handleEntityNotFound(_0x1a727c,null))[_0x03d9('0x20')](function(_0x493f81){if(_0x493f81){return db[_0x03d9('0x3f')]['find']({'where':{'id':_0x493f81['id']},'include':[{'model':db[_0x03d9('0x83')],'as':'List','include':[{'model':db[_0x03d9('0x85')],'as':_0x03d9('0x8d'),'where':{[_0x493f81[_0x03d9('0x7f')]]:_0x5454f},'limit':0x1,'order':[['updatedAt',_0x03d9('0x86')]]}]}]})[_0x03d9('0x20')](handleEntityNotFound(_0x1a727c,null))[_0x03d9('0x20')](function(_0x34f4d2){if(_0x34f4d2&&_0x34f4d2['List']){_0xa5dc93=_0x34f4d2[_0x03d9('0x37')]({'plain':!![]});if(_0xa5dc93[_0x03d9('0x84')]&&_0xa5dc93[_0x03d9('0x84')][_0x03d9('0x8d')][_0x03d9('0x4a')]){return _0xa5dc93[_0x03d9('0x84')][_0x03d9('0x8d')][0x0];}return db[_0x03d9('0x85')][_0x03d9('0x5e')](_[_0x03d9('0x19')](_0x4c9ff5[_0x03d9('0x66')],{'firstName':_0x5454f,[_0x34f4d2[_0x03d9('0x7f')]]:_0x5454f,'phone':_0x5454f,'ListId':_0xa5dc93[_0x03d9('0x79')]}));}})['then'](handleEntityNotFound(_0x1a727c,null))[_0x03d9('0x20')](function(_0x127000){if(_0x127000){_0x246f18=_0x127000;return db[_0x03d9('0x90')]['find']({'where':{'ContactId':_0x246f18['id'],'closed':![],'OpenchannelAccountId':_0xa5dc93['id']}})[_0x03d9('0x20')](function(_0x31bf69){if(_0x31bf69){return[_0x31bf69,![]];}return db[_0x03d9('0x90')]['create']({'UserId':_0x4c9ff5[_0x03d9('0x5f')]['id'],'ContactId':_0x246f18['id'],'OpenchannelAccountId':_0xa5dc93['id'],'lastMsgDirection':_0x03d9('0xbd'),'Messages':[_[_0x03d9('0x52')](_0x4c9ff5[_0x03d9('0x66')],{'read':![],'body':_0x4c9ff5['body'][_0x03d9('0x66')],'OpenchannelAccountId':_0xa5dc93['id'],'UserId':_0x4c9ff5[_0x03d9('0x5f')]['id'],'ContactId':_0x246f18['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x03d9('0xbe')}]})[_0x03d9('0x20')](function(_0x30e098){return[_0x30e098,!![]];});});}})[_0x03d9('0x92')](function(_0x1c8e8c,_0xfca13d){if(_0xfca13d){return _0x1c8e8c;}return db[_0x03d9('0xbf')][_0x03d9('0x5e')](_['merge'](_0x4c9ff5['body'],{'read':![],'body':_0x4c9ff5[_0x03d9('0x66')][_0x03d9('0x66')],'OpenchannelAccountId':_0xa5dc93['id'],'OpenchannelInteractionId':_0x1c8e8c['id'],'UserId':_0x4c9ff5[_0x03d9('0x5f')]['id'],'ContactId':_0x246f18['id']}))[_0x03d9('0x20')](function(_0x420f29){_0x1c8e8c['dataValues'][_0x03d9('0xbe')]=[];_0x1c8e8c[_0x03d9('0xc0')][_0x03d9('0xbe')]['push'](_0x420f29[_0x03d9('0xc0')]);return _0x1c8e8c;});});}})[_0x03d9('0x20')](respondWithResult(_0x1a727c,null))[_0x03d9('0x59')](handleError(_0x1a727c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 12b59e1..7d3a489 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 _0x3c81=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0x3c81,0x102));var _0x13c8=function(_0x13daef,_0x293062){_0x13daef=_0x13daef-0x0;var _0x2b55ad=_0x3c81[_0x13daef];return _0x2b55ad;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var OpenchannelAccount=require(_0x13c8('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c3ba4){return function(_0x548599,_0x101d4f,_0x3ec886){OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4+':'+_0x548599['id'],_0x548599);OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4,_0x548599);_0x3ec886(null);};}for(var e in events){if(events[_0x13c8('0x5')](e)){var event=events[e];OpenchannelAccount[_0x13c8('0x6')](e,emitEvent(event));}}module[_0x13c8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xac4a=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x1c1482,_0x3b361f){var _0x466cbe=function(_0x4eaba5){while(--_0x4eaba5){_0x1c1482['push'](_0x1c1482['shift']());}};_0x466cbe(++_0x3b361f);}(_0xac4a,0x13f));var _0xaac4=function(_0x2e9a54,_0x561ea5){_0x2e9a54=_0x2e9a54-0x0;var _0x26d32a=_0xac4a[_0x2e9a54];return _0x26d32a;};'use strict';var EventEmitter=require(_0xaac4('0x0'));var OpenchannelAccount=require(_0xaac4('0x1'))['db'][_0xaac4('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xaac4('0x3')](0x0);var events={'afterCreate':_0xaac4('0x4'),'afterUpdate':_0xaac4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58626e){return function(_0x2af0f6,_0x2a5762,_0x32d34c){OpenchannelAccountEvents['emit'](_0x58626e+':'+_0x2af0f6['id'],_0x2af0f6);OpenchannelAccountEvents[_0xaac4('0x6')](_0x58626e,_0x2af0f6);_0x32d34c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xaac4('0x7')](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 d898522..bb84d45 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(_0x1e0604,_0x1f06ea){var _0x26bd68=function(_0x256806){while(--_0x256806){_0x1e0604['push'](_0x1e0604['shift']());}};_0x26bd68(++_0x1f06ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x22a90f,_0x9b5ea5){var _0x4b392d=function(_0x34f41a){while(--_0x34f41a){_0x22a90f['push'](_0x22a90f['shift']());}};_0x4b392d(++_0x9b5ea5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 a172ac1..d82e398 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 _0x5c00=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5d4044,_0x48360d){var _0x5da77f=function(_0x4c75e6){while(--_0x4c75e6){_0x5d4044['push'](_0x5d4044['shift']());}};_0x5da77f(++_0x48360d);}(_0x5c00,0x17e));var _0x05c0=function(_0x1b925b,_0x1ab3c9){_0x1b925b=_0x1b925b-0x0;var _0x275f07=_0x5c00[_0x1b925b];return _0x275f07;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});config[_0x05c0('0xb')]=_['defaults'](config[_0x05c0('0xb')],{'host':_0x05c0('0xc'),'port':0x18eb});var socket=require(_0x05c0('0xd'))(new Redis(config['redis']));require(_0x05c0('0xe'))[_0x05c0('0xf')](socket);function respondWithRpcPromise(_0x996d6b,_0x321c09,_0x273b2d){return new BPromise(function(_0x1edbb,_0x5226c5){return client['request'](_0x996d6b,_0x273b2d)[_0x05c0('0x10')](function(_0x516a66){logger[_0x05c0('0x11')](_0x05c0('0x12'),_0x321c09,_0x05c0('0x13'));logger['debug'](_0x05c0('0x14'),_0x321c09,'request\x20sent',JSON[_0x05c0('0x15')](_0x516a66));if(_0x516a66[_0x05c0('0x16')]){if(_0x516a66[_0x05c0('0x16')][_0x05c0('0x17')]===0x1f4){logger[_0x05c0('0x16')](_0x05c0('0x12'),_0x321c09,_0x516a66[_0x05c0('0x16')][_0x05c0('0x18')]);return _0x5226c5(_0x516a66['error'][_0x05c0('0x18')]);}logger[_0x05c0('0x16')](_0x05c0('0x12'),_0x321c09,_0x516a66[_0x05c0('0x16')][_0x05c0('0x18')]);return _0x1edbb(_0x516a66[_0x05c0('0x16')][_0x05c0('0x18')]);}else{logger[_0x05c0('0x11')](_0x05c0('0x12'),_0x321c09,'request\x20sent');_0x1edbb(_0x516a66[_0x05c0('0x19')][_0x05c0('0x18')]);}})[_0x05c0('0x1a')](function(_0x54fef0){logger[_0x05c0('0x16')](_0x05c0('0x12'),_0x321c09,_0x54fef0);_0x5226c5(_0x54fef0);});});} \ No newline at end of file +var _0xee4f=['ioredis','../../config/utils','rpc','client','defaults','redis','localhost','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring'];(function(_0x5b8566,_0x552979){var _0x1da4cf=function(_0x5a125e){while(--_0x5a125e){_0x5b8566['push'](_0x5b8566['shift']());}};_0x1da4cf(++_0x552979);}(_0xee4f,0xad));var _0xfee4=function(_0x155e25,_0x153cab){_0x155e25=_0x155e25-0x0;var _0x4c33e0=_0xee4f[_0x155e25];return _0x4c33e0;};'use strict';var _=require(_0xfee4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfee4('0x1'));var rs=require(_0xfee4('0x2'));var fs=require('fs');var Redis=require(_0xfee4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfee4('0x4'));var logger=require('../../config/logger')(_0xfee4('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfee4('0x6')]['http']({'port':0x232a});config['redis']=_[_0xfee4('0x7')](config[_0xfee4('0x8')],{'host':_0xfee4('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfee4('0xa'))[_0xfee4('0xb')](socket);function respondWithRpcPromise(_0xa77876,_0x4dc812,_0x53f260){return new BPromise(function(_0x2ca5f9,_0x1d6855){return client[_0xfee4('0xc')](_0xa77876,_0x53f260)['then'](function(_0x2ef3c3){logger[_0xfee4('0xd')](_0xfee4('0xe'),_0x4dc812,_0xfee4('0xf'));logger[_0xfee4('0x10')](_0xfee4('0x11'),_0x4dc812,_0xfee4('0xf'),JSON['stringify'](_0x2ef3c3));if(_0x2ef3c3[_0xfee4('0x12')]){if(_0x2ef3c3[_0xfee4('0x12')]['code']===0x1f4){logger[_0xfee4('0x12')](_0xfee4('0xe'),_0x4dc812,_0x2ef3c3[_0xfee4('0x12')][_0xfee4('0x13')]);return _0x1d6855(_0x2ef3c3[_0xfee4('0x12')][_0xfee4('0x13')]);}logger[_0xfee4('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x4dc812,_0x2ef3c3[_0xfee4('0x12')][_0xfee4('0x13')]);return _0x2ca5f9(_0x2ef3c3[_0xfee4('0x12')]['message']);}else{logger[_0xfee4('0xd')]('OpenchannelAccount,\x20%s,\x20%s',_0x4dc812,'request\x20sent');_0x2ca5f9(_0x2ef3c3[_0xfee4('0x14')][_0xfee4('0x13')]);}})[_0xfee4('0x15')](function(_0x44a1ec){logger[_0xfee4('0x12')](_0xfee4('0xe'),_0x4dc812,_0x44a1ec);_0x1d6855(_0x44a1ec);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 4e37f22..4ef9d46 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 _0x894f=['./openchannelAccount.events','save','remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x50e7e0,_0x5affce){var _0x1a0307=function(_0x32d343){while(--_0x32d343){_0x50e7e0['push'](_0x50e7e0['shift']());}};_0x1a0307(++_0x5affce);}(_0x894f,0x14d));var _0xf894=function(_0x3a918b,_0x2ce2c2){_0x3a918b=_0x3a918b-0x0;var _0x43fb65=_0x894f[_0x3a918b];return _0x43fb65;};'use strict';var OpenchannelAccountEvents=require(_0xf894('0x0'));var events=[_0xf894('0x1'),_0xf894('0x2'),_0xf894('0x3')];function createListener(_0x4d2b83,_0x4e1a16){return function(_0x26f3da){_0x4e1a16[_0xf894('0x4')](_0x4d2b83,_0x26f3da);};}function removeListener(_0x4b6a61,_0x5e768a){return function(){OpenchannelAccountEvents[_0xf894('0x5')](_0x4b6a61,_0x5e768a);};}exports[_0xf894('0x6')]=function(_0x4e2af3){for(var _0x5814d3=0x0,_0x23a9fc=events[_0xf894('0x7')];_0x5814d3<_0x23a9fc;_0x5814d3++){var _0x56d9d6=events[_0x5814d3];var _0x190cb1=createListener(_0xf894('0x8')+_0x56d9d6,_0x4e2af3);OpenchannelAccountEvents['on'](_0x56d9d6,_0x190cb1);}}; \ No newline at end of file +var _0x261b=['openchannelAccount:','./openchannelAccount.events','save','removeListener','length'];(function(_0x1fc009,_0x35d49a){var _0x1f09f5=function(_0x137828){while(--_0x137828){_0x1fc009['push'](_0x1fc009['shift']());}};_0x1f09f5(++_0x35d49a);}(_0x261b,0x15a));var _0xb261=function(_0x196bd4,_0x226b55){_0x196bd4=_0x196bd4-0x0;var _0x2b0b33=_0x261b[_0x196bd4];return _0x2b0b33;};'use strict';var OpenchannelAccountEvents=require(_0xb261('0x0'));var events=[_0xb261('0x1'),'remove','update'];function createListener(_0x5d9cfe,_0x48c7f0){return function(_0x392d5c){_0x48c7f0['emit'](_0x5d9cfe,_0x392d5c);};}function removeListener(_0x30540c,_0x589255){return function(){OpenchannelAccountEvents[_0xb261('0x2')](_0x30540c,_0x589255);};}exports['register']=function(_0x10f7ba){for(var _0xaf0725=0x0,_0x1264c8=events[_0xb261('0x3')];_0xaf0725<_0x1264c8;_0xaf0725++){var _0x5740e1=events[_0xaf0725];var _0x756381=createListener(_0xb261('0x4')+_0x5740e1,_0x10f7ba);OpenchannelAccountEvents['on'](_0x5740e1,_0x756381);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8a7578a..e5f9f85 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 _0xdb8a=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','create','put'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xdb8a,0xe0));var _0xadb8=function(_0x3cf070,_0x4c430e){_0x3cf070=_0x3cf070-0x0;var _0x3d835c=_0xdb8a[_0x3cf070];return _0x3d835c;};'use strict';var multer=require(_0xadb8('0x0'));var util=require(_0xadb8('0x1'));var path=require(_0xadb8('0x2'));var timeout=require('connect-timeout');var express=require(_0xadb8('0x3'));var router=express['Router']();var fs_extra=require(_0xadb8('0x4'));var auth=require(_0xadb8('0x5'));var interaction=require(_0xadb8('0x6'));var config=require(_0xadb8('0x7'));var controller=require(_0xadb8('0x8'));router[_0xadb8('0x9')]('/',auth['isAuthenticated'](),controller[_0xadb8('0xa')]);router[_0xadb8('0x9')](_0xadb8('0xb'),auth[_0xadb8('0xc')](),controller[_0xadb8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xadb8('0xe')]);router[_0xadb8('0xf')](_0xadb8('0xb'),auth[_0xadb8('0xc')](),controller[_0xadb8('0x10')]);router[_0xadb8('0x11')]('/:id',auth[_0xadb8('0xc')](),controller[_0xadb8('0x12')]);module[_0xadb8('0x13')]=router; \ No newline at end of file +var _0xf3f5=['create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','show','post'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0xf3f5,0xba));var _0x5f3f=function(_0x150168,_0x33708d){_0x150168=_0x150168-0x0;var _0xcbb2e5=_0xf3f5[_0x150168];return _0xcbb2e5;};'use strict';var multer=require(_0x5f3f('0x0'));var util=require(_0x5f3f('0x1'));var path=require('path');var timeout=require(_0x5f3f('0x2'));var express=require(_0x5f3f('0x3'));var router=express[_0x5f3f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5f3f('0x5'));var interaction=require(_0x5f3f('0x6'));var config=require('../../config/environment');var controller=require(_0x5f3f('0x7'));router[_0x5f3f('0x8')]('/',auth[_0x5f3f('0x9')](),controller['index']);router[_0x5f3f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5f3f('0xa')]);router[_0x5f3f('0xb')]('/',auth[_0x5f3f('0x9')](),controller[_0x5f3f('0xc')]);router[_0x5f3f('0xd')](_0x5f3f('0xe'),auth[_0x5f3f('0x9')](),controller[_0x5f3f('0xf')]);router[_0x5f3f('0x10')](_0x5f3f('0xe'),auth[_0x5f3f('0x9')](),controller['destroy']);module[_0x5f3f('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index aa2d02c..741b596 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 _0xd48f=['STRING','noop','TEXT','exports','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd48f,0x8a));var _0xfd48=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd48f[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0xfd48('0x0')]={'priority':{'type':Sequelize[_0xfd48('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfd48('0x2')],'allowNull':![],'defaultValue':_0xfd48('0x3')},'appdata':{'type':Sequelize[_0xfd48('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfd48('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe621=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x20f93b,_0x3d5abd){var _0x296ff8=function(_0xdc44bd){while(--_0xdc44bd){_0x20f93b['push'](_0x20f93b['shift']());}};_0x296ff8(++_0x3d5abd);}(_0xe621,0x18d));var _0x1e62=function(_0x51de21,_0x2143bb){_0x51de21=_0x51de21-0x0;var _0x11e461=_0xe621[_0x51de21];return _0x11e461;};'use strict';var Sequelize=require(_0x1e62('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1e62('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1e62('0x2')],'allowNull':![],'defaultValue':_0x1e62('0x3')},'appdata':{'type':Sequelize[_0x1e62('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1e62('0x2')],'defaultValue':_0x1e62('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e9020fa..ba985e9 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 _0x12e5=['create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','find','catch'];(function(_0x2bc369,_0x452b0a){var _0x3bfbf9=function(_0x503a73){while(--_0x503a73){_0x2bc369['push'](_0x2bc369['shift']());}};_0x3bfbf9(++_0x452b0a);}(_0x12e5,0x1cb));var _0x512e=function(_0x4004bd,_0x5bb9ce){_0x4004bd=_0x4004bd-0x0;var _0x23291c=_0x12e5[_0x4004bd];return _0x23291c;};'use strict';var emlformat=require(_0x512e('0x0'));var rimraf=require(_0x512e('0x1'));var zipdir=require(_0x512e('0x2'));var jsonpatch=require(_0x512e('0x3'));var rp=require(_0x512e('0x4'));var moment=require(_0x512e('0x5'));var BPromise=require(_0x512e('0x6'));var Mustache=require(_0x512e('0x7'));var util=require('util');var path=require(_0x512e('0x8'));var sox=require(_0x512e('0x9'));var csv=require(_0x512e('0xa'));var ejs=require(_0x512e('0xb'));var fs=require('fs');var fs_extra=require(_0x512e('0xc'));var _=require(_0x512e('0xd'));var squel=require(_0x512e('0xe'));var crypto=require('crypto');var jsforce=require(_0x512e('0xf'));var deskjs=require(_0x512e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x512e('0x11'));var Papa=require(_0x512e('0x12'));var Redis=require(_0x512e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x512e('0x14'));var as=require(_0x512e('0x15'));var hardwareService=require(_0x512e('0x16'));var logger=require(_0x512e('0x17'))(_0x512e('0x18'));var utils=require(_0x512e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x512e('0x1a'))['db'];function respondWithStatusCode(_0x5d9f38,_0x2f215a){_0x2f215a=_0x2f215a||0xcc;return function(_0x401d63){if(_0x401d63){return _0x5d9f38[_0x512e('0x1b')](_0x2f215a);}return _0x5d9f38['status'](_0x2f215a)['end']();};}function respondWithResult(_0x170d2c,_0x5be9de){_0x5be9de=_0x5be9de||0xc8;return function(_0x35971a){if(_0x35971a){return _0x170d2c[_0x512e('0x1c')](_0x5be9de)[_0x512e('0x1d')](_0x35971a);}};}function respondWithFilteredResult(_0x238685,_0x4007e9){return function(_0x565b5a){if(_0x565b5a){var _0x2af39b=typeof _0x4007e9[_0x512e('0x1e')]===_0x512e('0x1f')&&typeof _0x4007e9[_0x512e('0x20')]===_0x512e('0x1f');var _0x490924=_0x565b5a[_0x512e('0x21')];var _0x3c99a7=_0x2af39b?0x0:_0x4007e9[_0x512e('0x1e')];var _0x34bd9f=_0x2af39b?_0x565b5a[_0x512e('0x21')]:_0x4007e9[_0x512e('0x1e')]+_0x4007e9[_0x512e('0x20')];var _0x4dddd0;if(_0x34bd9f>=_0x490924){_0x34bd9f=_0x490924;_0x4dddd0=0xc8;}else{_0x4dddd0=0xce;}_0x238685[_0x512e('0x1c')](_0x4dddd0);return _0x238685[_0x512e('0x22')](_0x512e('0x23'),_0x3c99a7+'-'+_0x34bd9f+'/'+_0x490924)[_0x512e('0x1d')](_0x565b5a);}return null;};}function patchUpdates(_0x38df0e){return function(_0x318079){try{jsonpatch['apply'](_0x318079,_0x38df0e,!![]);}catch(_0x442808){return BPromise[_0x512e('0x24')](_0x442808);}return _0x318079[_0x512e('0x25')]();};}function saveUpdates(_0x3e21ff,_0x5dacea){return function(_0x33a47e){if(_0x33a47e){return _0x33a47e[_0x512e('0x26')](_0x3e21ff)[_0x512e('0x27')](function(_0x3f9bac){return _0x3f9bac;});}return null;};}function removeEntity(_0x3249c4,_0x47174f){return function(_0x34d56a){if(_0x34d56a){return _0x34d56a[_0x512e('0x28')]()[_0x512e('0x27')](function(){_0x3249c4[_0x512e('0x1c')](0xcc)[_0x512e('0x29')]();});}};}function handleEntityNotFound(_0xbedd71,_0x4aa511){return function(_0x12bf30){if(!_0x12bf30){_0xbedd71['sendStatus'](0x194);}return _0x12bf30;};}function handleError(_0x3997fe,_0x26ae85){_0x26ae85=_0x26ae85||0x1f4;return function(_0x7a63e9){logger[_0x512e('0x2a')](_0x7a63e9[_0x512e('0x2b')]);if(_0x7a63e9['name']){delete _0x7a63e9[_0x512e('0x2c')];}_0x3997fe[_0x512e('0x1c')](_0x26ae85)['send'](_0x7a63e9);};}exports[_0x512e('0x2d')]=function(_0x5a3ae6,_0x68bbf9){var _0x145a03={},_0x2f3752={},_0x1af970={'count':0x0,'rows':[]};var _0x1a421e=_[_0x512e('0x2e')](db[_0x512e('0x2f')][_0x512e('0x30')],function(_0x1671d1){return{'name':_0x1671d1[_0x512e('0x31')],'type':_0x1671d1[_0x512e('0x32')][_0x512e('0x33')]};});_0x2f3752[_0x512e('0x34')]=_[_0x512e('0x2e')](_0x1a421e,'name');_0x2f3752['query']=_[_0x512e('0x35')](_0x5a3ae6[_0x512e('0x36')]);_0x2f3752[_0x512e('0x37')]=_[_0x512e('0x38')](_0x2f3752['model'],_0x2f3752[_0x512e('0x36')]);_0x145a03['attributes']=_[_0x512e('0x38')](_0x2f3752['model'],qs['fields'](_0x5a3ae6[_0x512e('0x36')][_0x512e('0x39')]));_0x145a03[_0x512e('0x3a')]=_0x145a03[_0x512e('0x3a')][_0x512e('0x3b')]?_0x145a03['attributes']:_0x2f3752['model'];if(!_0x5a3ae6['query']['hasOwnProperty']('nolimit')){_0x145a03[_0x512e('0x20')]=qs['limit'](_0x5a3ae6[_0x512e('0x36')][_0x512e('0x20')]);_0x145a03[_0x512e('0x1e')]=qs[_0x512e('0x1e')](_0x5a3ae6[_0x512e('0x36')][_0x512e('0x1e')]);}_0x145a03[_0x512e('0x3c')]=qs[_0x512e('0x3d')](_0x5a3ae6[_0x512e('0x36')][_0x512e('0x3d')]);_0x145a03['where']=qs[_0x512e('0x37')](_['pick'](_0x5a3ae6['query'],_0x2f3752['filters']),_0x1a421e);if(_0x5a3ae6[_0x512e('0x36')][_0x512e('0x3e')]){_0x145a03['where']=_['merge'](_0x145a03[_0x512e('0x3f')],{'$or':_[_0x512e('0x2e')](_0x1a421e,function(_0x2f1ac6){if(_0x2f1ac6['type']!==_0x512e('0x40')){var _0x6d07cb={};_0x6d07cb[_0x2f1ac6['name']]={'$like':'%'+_0x5a3ae6['query'][_0x512e('0x3e')]+'%'};return _0x6d07cb;}})});}_0x145a03=_[_0x512e('0x41')]({},_0x145a03,_0x5a3ae6[_0x512e('0x42')]);var _0x578b12={'where':_0x145a03[_0x512e('0x3f')]};return db['OpenchannelApplication'][_0x512e('0x21')](_0x578b12)[_0x512e('0x27')](function(_0x5e3eed){_0x1af970['count']=_0x5e3eed;if(_0x5a3ae6['query'][_0x512e('0x43')]){_0x145a03[_0x512e('0x44')]=[{'all':!![]}];}return db[_0x512e('0x2f')]['findAll'](_0x145a03);})[_0x512e('0x27')](function(_0x235380){_0x1af970[_0x512e('0x45')]=_0x235380;return _0x1af970;})['then'](respondWithFilteredResult(_0x68bbf9,_0x145a03))['catch'](handleError(_0x68bbf9,null));};exports[_0x512e('0x46')]=function(_0x5ade8e,_0x2c8f07){var _0x3d7d1e={'raw':!![],'where':{'id':_0x5ade8e['params']['id']}},_0x29d16b={};_0x29d16b[_0x512e('0x34')]=_[_0x512e('0x35')](db['OpenchannelApplication'][_0x512e('0x30')]);_0x29d16b[_0x512e('0x36')]=_[_0x512e('0x35')](_0x5ade8e['query']);_0x29d16b['filters']=_[_0x512e('0x38')](_0x29d16b[_0x512e('0x34')],_0x29d16b['query']);_0x3d7d1e[_0x512e('0x3a')]=_[_0x512e('0x38')](_0x29d16b[_0x512e('0x34')],qs['fields'](_0x5ade8e[_0x512e('0x36')][_0x512e('0x39')]));_0x3d7d1e[_0x512e('0x3a')]=_0x3d7d1e[_0x512e('0x3a')][_0x512e('0x3b')]?_0x3d7d1e[_0x512e('0x3a')]:_0x29d16b['model'];if(_0x5ade8e[_0x512e('0x36')][_0x512e('0x43')]){_0x3d7d1e[_0x512e('0x44')]=[{'all':!![]}];}_0x3d7d1e=_['merge']({},_0x3d7d1e,_0x5ade8e[_0x512e('0x42')]);return db[_0x512e('0x2f')][_0x512e('0x47')](_0x3d7d1e)['then'](handleEntityNotFound(_0x2c8f07,null))[_0x512e('0x27')](respondWithResult(_0x2c8f07,null))[_0x512e('0x48')](handleError(_0x2c8f07,null));};exports['create']=function(_0x16e48f,_0x5093c6){return db[_0x512e('0x2f')][_0x512e('0x49')](_0x16e48f[_0x512e('0x4a')],{})['then'](respondWithResult(_0x5093c6,0xc9))['catch'](handleError(_0x5093c6,null));};exports[_0x512e('0x26')]=function(_0x2c249c,_0x1f8549){if(_0x2c249c[_0x512e('0x4a')]['id']){delete _0x2c249c[_0x512e('0x4a')]['id'];}return db[_0x512e('0x2f')][_0x512e('0x47')]({'where':{'id':_0x2c249c[_0x512e('0x4b')]['id']}})[_0x512e('0x27')](handleEntityNotFound(_0x1f8549,null))[_0x512e('0x27')](saveUpdates(_0x2c249c[_0x512e('0x4a')],null))[_0x512e('0x27')](respondWithResult(_0x1f8549,null))[_0x512e('0x48')](handleError(_0x1f8549,null));};exports[_0x512e('0x28')]=function(_0x343d47,_0x246d53){return db[_0x512e('0x2f')][_0x512e('0x47')]({'where':{'id':_0x343d47['params']['id']}})[_0x512e('0x27')](handleEntityNotFound(_0x246d53,null))[_0x512e('0x27')](removeEntity(_0x246d53,null))[_0x512e('0x48')](handleError(_0x246d53,null));}; \ No newline at end of file +var _0x6316=['rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','OpenchannelApplication','includeAll','include','findAll','rows','catch','show','params','keys','length','options','create','body','find','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map'];(function(_0x2b37aa,_0x1d40dc){var _0x52b73d=function(_0x5eb623){while(--_0x5eb623){_0x2b37aa['push'](_0x2b37aa['shift']());}};_0x52b73d(++_0x1d40dc);}(_0x6316,0x66));var _0x6631=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6316[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x6631('0x0'));var rimraf=require(_0x6631('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6631('0x2'));var moment=require(_0x6631('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6631('0x4'));var util=require(_0x6631('0x5'));var path=require(_0x6631('0x6'));var sox=require(_0x6631('0x7'));var csv=require(_0x6631('0x8'));var ejs=require(_0x6631('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6631('0xa'));var crypto=require(_0x6631('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6631('0xc'));var toCsv=require(_0x6631('0x8'));var querystring=require('querystring');var Papa=require(_0x6631('0xd'));var Redis=require(_0x6631('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6631('0xf'));var as=require(_0x6631('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6631('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x6631('0x12'))['db'];function respondWithStatusCode(_0x25a738,_0xbfd2bd){_0xbfd2bd=_0xbfd2bd||0xcc;return function(_0x51fb7b){if(_0x51fb7b){return _0x25a738['sendStatus'](_0xbfd2bd);}return _0x25a738[_0x6631('0x13')](_0xbfd2bd)['end']();};}function respondWithResult(_0x5232a3,_0x52b502){_0x52b502=_0x52b502||0xc8;return function(_0x252088){if(_0x252088){return _0x5232a3['status'](_0x52b502)[_0x6631('0x14')](_0x252088);}};}function respondWithFilteredResult(_0x497bb5,_0xdeca64){return function(_0x2418cb){if(_0x2418cb){var _0x59528f=typeof _0xdeca64['offset']===_0x6631('0x15')&&typeof _0xdeca64[_0x6631('0x16')]===_0x6631('0x15');var _0x4861b7=_0x2418cb[_0x6631('0x17')];var _0x36224c=_0x59528f?0x0:_0xdeca64[_0x6631('0x18')];var _0x2f2ad7=_0x59528f?_0x2418cb[_0x6631('0x17')]:_0xdeca64['offset']+_0xdeca64[_0x6631('0x16')];var _0x37e939;if(_0x2f2ad7>=_0x4861b7){_0x2f2ad7=_0x4861b7;_0x37e939=0xc8;}else{_0x37e939=0xce;}_0x497bb5[_0x6631('0x13')](_0x37e939);return _0x497bb5[_0x6631('0x19')](_0x6631('0x1a'),_0x36224c+'-'+_0x2f2ad7+'/'+_0x4861b7)[_0x6631('0x14')](_0x2418cb);}return null;};}function patchUpdates(_0xf69ccd){return function(_0x54752c){try{jsonpatch['apply'](_0x54752c,_0xf69ccd,!![]);}catch(_0x4ca41a){return BPromise[_0x6631('0x1b')](_0x4ca41a);}return _0x54752c[_0x6631('0x1c')]();};}function saveUpdates(_0x4602fd,_0x564e40){return function(_0x3a786b){if(_0x3a786b){return _0x3a786b[_0x6631('0x1d')](_0x4602fd)['then'](function(_0x5520ab){return _0x5520ab;});}return null;};}function removeEntity(_0xaaae6d,_0x317b60){return function(_0x2c8e66){if(_0x2c8e66){return _0x2c8e66[_0x6631('0x1e')]()[_0x6631('0x1f')](function(){_0xaaae6d['status'](0xcc)[_0x6631('0x20')]();});}};}function handleEntityNotFound(_0x82f645,_0x2126d2){return function(_0x540e67){if(!_0x540e67){_0x82f645[_0x6631('0x21')](0x194);}return _0x540e67;};}function handleError(_0x239f9c,_0xac7235){_0xac7235=_0xac7235||0x1f4;return function(_0x192358){logger[_0x6631('0x22')](_0x192358[_0x6631('0x23')]);if(_0x192358[_0x6631('0x24')]){delete _0x192358[_0x6631('0x24')];}_0x239f9c[_0x6631('0x13')](_0xac7235)[_0x6631('0x25')](_0x192358);};}exports[_0x6631('0x26')]=function(_0x5e91c6,_0x171e68){var _0x35388e={},_0x5d8be9={},_0x1255ab={'count':0x0,'rows':[]};var _0x2d1884=_[_0x6631('0x27')](db['OpenchannelApplication'][_0x6631('0x28')],function(_0x206996){return{'name':_0x206996[_0x6631('0x29')],'type':_0x206996[_0x6631('0x2a')][_0x6631('0x2b')]};});_0x5d8be9['model']=_[_0x6631('0x27')](_0x2d1884,_0x6631('0x24'));_0x5d8be9[_0x6631('0x2c')]=_['keys'](_0x5e91c6['query']);_0x5d8be9[_0x6631('0x2d')]=_['intersection'](_0x5d8be9[_0x6631('0x2e')],_0x5d8be9['query']);_0x35388e[_0x6631('0x2f')]=_[_0x6631('0x30')](_0x5d8be9['model'],qs[_0x6631('0x31')](_0x5e91c6[_0x6631('0x2c')][_0x6631('0x31')]));_0x35388e[_0x6631('0x2f')]=_0x35388e[_0x6631('0x2f')]['length']?_0x35388e[_0x6631('0x2f')]:_0x5d8be9[_0x6631('0x2e')];if(!_0x5e91c6[_0x6631('0x2c')][_0x6631('0x32')](_0x6631('0x33'))){_0x35388e['limit']=qs['limit'](_0x5e91c6[_0x6631('0x2c')][_0x6631('0x16')]);_0x35388e['offset']=qs[_0x6631('0x18')](_0x5e91c6[_0x6631('0x2c')]['offset']);}_0x35388e[_0x6631('0x34')]=qs[_0x6631('0x35')](_0x5e91c6[_0x6631('0x2c')][_0x6631('0x35')]);_0x35388e['where']=qs[_0x6631('0x2d')](_['pick'](_0x5e91c6[_0x6631('0x2c')],_0x5d8be9[_0x6631('0x2d')]),_0x2d1884);if(_0x5e91c6[_0x6631('0x2c')][_0x6631('0x36')]){_0x35388e['where']=_[_0x6631('0x37')](_0x35388e[_0x6631('0x38')],{'$or':_['map'](_0x2d1884,function(_0x3a55a1){if(_0x3a55a1[_0x6631('0x2a')]!=='VIRTUAL'){var _0x255d09={};_0x255d09[_0x3a55a1[_0x6631('0x24')]]={'$like':'%'+_0x5e91c6['query']['filter']+'%'};return _0x255d09;}})});}_0x35388e=_[_0x6631('0x37')]({},_0x35388e,_0x5e91c6['options']);var _0x339a52={'where':_0x35388e[_0x6631('0x38')]};return db[_0x6631('0x39')]['count'](_0x339a52)['then'](function(_0x1531c8){_0x1255ab['count']=_0x1531c8;if(_0x5e91c6['query'][_0x6631('0x3a')]){_0x35388e[_0x6631('0x3b')]=[{'all':!![]}];}return db[_0x6631('0x39')][_0x6631('0x3c')](_0x35388e);})[_0x6631('0x1f')](function(_0x181426){_0x1255ab[_0x6631('0x3d')]=_0x181426;return _0x1255ab;})['then'](respondWithFilteredResult(_0x171e68,_0x35388e))[_0x6631('0x3e')](handleError(_0x171e68,null));};exports[_0x6631('0x3f')]=function(_0x25ff48,_0xd4fd99){var _0xa21e25={'raw':!![],'where':{'id':_0x25ff48[_0x6631('0x40')]['id']}},_0x2045b8={};_0x2045b8[_0x6631('0x2e')]=_[_0x6631('0x41')](db[_0x6631('0x39')][_0x6631('0x28')]);_0x2045b8[_0x6631('0x2c')]=_['keys'](_0x25ff48[_0x6631('0x2c')]);_0x2045b8[_0x6631('0x2d')]=_[_0x6631('0x30')](_0x2045b8[_0x6631('0x2e')],_0x2045b8[_0x6631('0x2c')]);_0xa21e25[_0x6631('0x2f')]=_[_0x6631('0x30')](_0x2045b8[_0x6631('0x2e')],qs[_0x6631('0x31')](_0x25ff48[_0x6631('0x2c')][_0x6631('0x31')]));_0xa21e25[_0x6631('0x2f')]=_0xa21e25[_0x6631('0x2f')][_0x6631('0x42')]?_0xa21e25['attributes']:_0x2045b8[_0x6631('0x2e')];if(_0x25ff48['query'][_0x6631('0x3a')]){_0xa21e25[_0x6631('0x3b')]=[{'all':!![]}];}_0xa21e25=_[_0x6631('0x37')]({},_0xa21e25,_0x25ff48[_0x6631('0x43')]);return db[_0x6631('0x39')]['find'](_0xa21e25)[_0x6631('0x1f')](handleEntityNotFound(_0xd4fd99,null))[_0x6631('0x1f')](respondWithResult(_0xd4fd99,null))[_0x6631('0x3e')](handleError(_0xd4fd99,null));};exports[_0x6631('0x44')]=function(_0x49a445,_0x3bb9ce){return db[_0x6631('0x39')][_0x6631('0x44')](_0x49a445[_0x6631('0x45')],{})[_0x6631('0x1f')](respondWithResult(_0x3bb9ce,0xc9))[_0x6631('0x3e')](handleError(_0x3bb9ce,null));};exports['update']=function(_0x25fc3f,_0x3eb092){if(_0x25fc3f[_0x6631('0x45')]['id']){delete _0x25fc3f[_0x6631('0x45')]['id'];}return db[_0x6631('0x39')][_0x6631('0x46')]({'where':{'id':_0x25fc3f[_0x6631('0x40')]['id']}})[_0x6631('0x1f')](handleEntityNotFound(_0x3eb092,null))['then'](saveUpdates(_0x25fc3f[_0x6631('0x45')],null))[_0x6631('0x1f')](respondWithResult(_0x3eb092,null))['catch'](handleError(_0x3eb092,null));};exports[_0x6631('0x1e')]=function(_0x32adc1,_0x3bd191){return db[_0x6631('0x39')][_0x6631('0x46')]({'where':{'id':_0x32adc1['params']['id']}})[_0x6631('0x1f')](handleEntityNotFound(_0x3bd191,null))['then'](removeEntity(_0x3bd191,null))[_0x6631('0x3e')](handleError(_0x3bd191,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e9812a9..2c5efae 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 _0xf364=['util','../../config/logger','api','bluebird','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci'];(function(_0x126fd5,_0x4026a8){var _0x309889=function(_0x3a6186){while(--_0x3a6186){_0x126fd5['push'](_0x126fd5['shift']());}};_0x309889(++_0x4026a8);}(_0xf364,0xe6));var _0x4f36=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf364[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x4f36('0x0'));var logger=require(_0x4f36('0x1'))(_0x4f36('0x2'));var moment=require('moment');var BPromise=require(_0x4f36('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4f36('0x4'));var attributes=require(_0x4f36('0x5'));module['exports']=function(_0x367c5a,_0x53f4ba){return _0x367c5a[_0x4f36('0x6')](_0x4f36('0x7'),attributes,{'tableName':_0x4f36('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4f36('0x9')});}; \ No newline at end of file +var _0x5247=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5247,0x127));var _0x7524=function(_0x325fa2,_0x310bd5){_0x325fa2=_0x325fa2-0x0;var _0x5ab8e5=_0x5247[_0x325fa2];return _0x5ab8e5;};'use strict';var _=require(_0x7524('0x0'));var util=require(_0x7524('0x1'));var logger=require(_0x7524('0x2'))(_0x7524('0x3'));var moment=require(_0x7524('0x4'));var BPromise=require(_0x7524('0x5'));var rp=require(_0x7524('0x6'));var fs=require('fs');var path=require(_0x7524('0x7'));var rimraf=require(_0x7524('0x8'));var config=require(_0x7524('0x9'));var attributes=require(_0x7524('0xa'));module[_0x7524('0xb')]=function(_0x2f1a4e,_0x307509){return _0x2f1a4e['define']('OpenchannelApplication',attributes,{'tableName':_0x7524('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7524('0xd'),'collate':_0x7524('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d9c2e61..28921f3 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 _0x3c4e=['OpenchannelApplication','update','body','options','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication'];(function(_0x23c879,_0x573f13){var _0x2dcfb4=function(_0x64947f){while(--_0x64947f){_0x23c879['push'](_0x23c879['shift']());}};_0x2dcfb4(++_0x573f13);}(_0x3c4e,0x7b));var _0xe3c4=function(_0x38c3f3,_0x544c71){_0x38c3f3=_0x38c3f3-0x0;var _0x285b99=_0x3c4e[_0x38c3f3];return _0x285b99;};'use strict';var _=require(_0xe3c4('0x0'));var util=require(_0xe3c4('0x1'));var moment=require(_0xe3c4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3c4('0x3'));var db=require(_0xe3c4('0x4'))['db'];var utils=require(_0xe3c4('0x5'));var logger=require(_0xe3c4('0x6'))('rpc');var config=require(_0xe3c4('0x7'));var jayson=require(_0xe3c4('0x8'));var client=jayson[_0xe3c4('0x9')][_0xe3c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe6a97b,_0x38c6ad,_0x3a71e7){return new BPromise(function(_0x2e004c,_0x26447c){return client['request'](_0xe6a97b,_0x3a71e7)['then'](function(_0x1ec883){logger[_0xe3c4('0xb')](_0xe3c4('0xc'),_0x38c6ad,_0xe3c4('0xd'));logger[_0xe3c4('0xe')](_0xe3c4('0xf'),_0x38c6ad,_0xe3c4('0xd'),JSON[_0xe3c4('0x10')](_0x1ec883));if(_0x1ec883[_0xe3c4('0x11')]){if(_0x1ec883[_0xe3c4('0x11')][_0xe3c4('0x12')]===0x1f4){logger[_0xe3c4('0x11')](_0xe3c4('0xc'),_0x38c6ad,_0x1ec883[_0xe3c4('0x11')][_0xe3c4('0x13')]);return _0x26447c(_0x1ec883[_0xe3c4('0x11')][_0xe3c4('0x13')]);}logger[_0xe3c4('0x11')](_0xe3c4('0xc'),_0x38c6ad,_0x1ec883[_0xe3c4('0x11')]['message']);return _0x2e004c(_0x1ec883[_0xe3c4('0x11')][_0xe3c4('0x13')]);}else{logger[_0xe3c4('0xb')](_0xe3c4('0xc'),_0x38c6ad,_0xe3c4('0xd'));_0x2e004c(_0x1ec883['result'][_0xe3c4('0x13')]);}})[_0xe3c4('0x14')](function(_0x2389a4){logger['error'](_0xe3c4('0xc'),_0x38c6ad,_0x2389a4);_0x26447c(_0x2389a4);});});}exports[_0xe3c4('0x15')]=function(_0x2688c6){var _0x456e3d=this;return new Promise(function(_0x91538d,_0x22442f){return db[_0xe3c4('0x16')][_0xe3c4('0x17')](_0x2688c6[_0xe3c4('0x18')],{'raw':_0x2688c6[_0xe3c4('0x19')]?_0x2688c6[_0xe3c4('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2688c6[_0xe3c4('0x19')]?_0x2688c6['options'][_0xe3c4('0x1a')]||null:null,'attributes':_0x2688c6['options']?_0x2688c6[_0xe3c4('0x19')][_0xe3c4('0x1b')]||null:null,'limit':_0x2688c6[_0xe3c4('0x19')]?_0x2688c6[_0xe3c4('0x19')][_0xe3c4('0x1c')]||null:null})['then'](function(_0x424f16){logger['info'](_0xe3c4('0x15'),_0x2688c6);logger[_0xe3c4('0xe')](_0xe3c4('0x15'),_0x2688c6,JSON['stringify'](_0x424f16));_0x91538d(_0x424f16);})['catch'](function(_0x1fcd51){logger['error'](_0xe3c4('0x15'),_0x1fcd51['message'],_0x2688c6);_0x22442f(_0x456e3d[_0xe3c4('0x11')](0x1f4,_0x1fcd51[_0xe3c4('0x13')]));});});}; \ No newline at end of file +var _0x193b=['info','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5a7cbc,_0x573d85){var _0x44d2cc=function(_0x154862){while(--_0x154862){_0x5a7cbc['push'](_0x5a7cbc['shift']());}};_0x44d2cc(++_0x573d85);}(_0x193b,0xb0));var _0xb193=function(_0x1e028c,_0x2bd5b0){_0x1e028c=_0x1e028c-0x0;var _0x336831=_0x193b[_0x1e028c];return _0x336831;};'use strict';var _=require('lodash');var util=require(_0xb193('0x0'));var moment=require(_0xb193('0x1'));var BPromise=require(_0xb193('0x2'));var rs=require(_0xb193('0x3'));var fs=require('fs');var Redis=require(_0xb193('0x4'));var db=require(_0xb193('0x5'))['db'];var utils=require(_0xb193('0x6'));var logger=require(_0xb193('0x7'))(_0xb193('0x8'));var config=require(_0xb193('0x9'));var jayson=require(_0xb193('0xa'));var client=jayson[_0xb193('0xb')][_0xb193('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a7a66,_0x805417,_0x572e02){return new BPromise(function(_0x5d1066,_0x51528a){return client[_0xb193('0xd')](_0x3a7a66,_0x572e02)['then'](function(_0x190212){logger['info'](_0xb193('0xe'),_0x805417,'request\x20sent');logger[_0xb193('0xf')](_0xb193('0x10'),_0x805417,_0xb193('0x11'),JSON[_0xb193('0x12')](_0x190212));if(_0x190212['error']){if(_0x190212[_0xb193('0x13')][_0xb193('0x14')]===0x1f4){logger[_0xb193('0x13')](_0xb193('0xe'),_0x805417,_0x190212[_0xb193('0x13')][_0xb193('0x15')]);return _0x51528a(_0x190212[_0xb193('0x13')][_0xb193('0x15')]);}logger[_0xb193('0x13')](_0xb193('0xe'),_0x805417,_0x190212[_0xb193('0x13')][_0xb193('0x15')]);return _0x5d1066(_0x190212[_0xb193('0x13')]['message']);}else{logger[_0xb193('0x16')](_0xb193('0xe'),_0x805417,_0xb193('0x11'));_0x5d1066(_0x190212[_0xb193('0x17')][_0xb193('0x15')]);}})[_0xb193('0x18')](function(_0x445dfa){logger[_0xb193('0x13')](_0xb193('0xe'),_0x805417,_0x445dfa);_0x51528a(_0x445dfa);});});}exports[_0xb193('0x19')]=function(_0x56e55d){var _0x3cbeaa=this;return new Promise(function(_0x20e5e8,_0x45e565){return db[_0xb193('0x1a')][_0xb193('0x1b')](_0x56e55d[_0xb193('0x1c')],{'raw':_0x56e55d['options']?_0x56e55d[_0xb193('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56e55d[_0xb193('0x1d')]?_0x56e55d[_0xb193('0x1d')][_0xb193('0x1e')]||null:null,'attributes':_0x56e55d[_0xb193('0x1d')]?_0x56e55d[_0xb193('0x1d')][_0xb193('0x1f')]||null:null,'limit':_0x56e55d['options']?_0x56e55d[_0xb193('0x1d')][_0xb193('0x20')]||null:null})['then'](function(_0x23a61e){logger[_0xb193('0x16')](_0xb193('0x19'),_0x56e55d);logger['debug']('UpdateOpenchannelApplication',_0x56e55d,JSON[_0xb193('0x12')](_0x23a61e));_0x20e5e8(_0x23a61e);})['catch'](function(_0x350b62){logger['error'](_0xb193('0x19'),_0x350b62[_0xb193('0x15')],_0x56e55d);_0x45e565(_0x3cbeaa[_0xb193('0x13')](0x1f4,_0x350b62[_0xb193('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4f8c344..a9fabd9 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 _0xa059=['get','index','/describe','describe','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','/:id','openchannel','update','delete','openchannelinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller'];(function(_0xf4add4,_0x5b9cc1){var _0x1c42fb=function(_0x2674c1){while(--_0x2674c1){_0xf4add4['push'](_0xf4add4['shift']());}};_0x1c42fb(++_0x5b9cc1);}(_0xa059,0x14d));var _0x9a05=function(_0x5d0b1f,_0x280300){_0x5d0b1f=_0x5d0b1f-0x0;var _0x3f1eb2=_0xa059[_0x5d0b1f];return _0x3f1eb2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a05('0x0'));var timeout=require(_0x9a05('0x1'));var express=require(_0x9a05('0x2'));var router=express[_0x9a05('0x3')]();var fs_extra=require(_0x9a05('0x4'));var auth=require(_0x9a05('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9a05('0x6'));var controller=require(_0x9a05('0x7'));router[_0x9a05('0x8')]('/',auth['isAuthenticated'](),controller[_0x9a05('0x9')]);router[_0x9a05('0x8')](_0x9a05('0xa'),auth['isAuthenticated'](),controller[_0x9a05('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9a05('0xc')]);router[_0x9a05('0x8')](_0x9a05('0xd'),auth[_0x9a05('0xe')](),controller[_0x9a05('0xf')]);router[_0x9a05('0x8')](_0x9a05('0x10'),auth[_0x9a05('0xe')](),controller[_0x9a05('0x11')]);router['post']('/',auth[_0x9a05('0xe')](),controller[_0x9a05('0x12')]);router[_0x9a05('0x13')](_0x9a05('0xd'),auth[_0x9a05('0xe')](),controller[_0x9a05('0x14')]);router[_0x9a05('0x13')](_0x9a05('0x15'),auth['isAuthenticated'](),interaction[_0x9a05('0x16')]('openchannel',_0x9a05('0x17')),controller['addTags']);router['put'](_0x9a05('0x18'),auth[_0x9a05('0xe')](),interaction[_0x9a05('0x16')](_0x9a05('0x19'),'openchannelinteraction:update'),controller[_0x9a05('0x1a')]);router[_0x9a05('0x1b')](_0x9a05('0x18'),auth[_0x9a05('0xe')](),interaction['tracked'](_0x9a05('0x19'),_0x9a05('0x1c')),controller[_0x9a05('0x1d')]);router[_0x9a05('0x1b')](_0x9a05('0x15'),auth[_0x9a05('0xe')](),controller['removeTags']);module[_0x9a05('0x1e')]=router; \ No newline at end of file +var _0x5efa=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','addTags','put','tracked','openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','destroy','removeTags','exports'];(function(_0xf7d8ac,_0x5ad4cf){var _0x1ef259=function(_0x52b805){while(--_0x52b805){_0xf7d8ac['push'](_0xf7d8ac['shift']());}};_0x1ef259(++_0x5ad4cf);}(_0x5efa,0x1e0));var _0xa5ef=function(_0x5dc896,_0x3a201b){_0x5dc896=_0x5dc896-0x0;var _0x44d580=_0x5efa[_0x5dc896];return _0x44d580;};'use strict';var multer=require('multer');var util=require(_0xa5ef('0x0'));var path=require(_0xa5ef('0x1'));var timeout=require(_0xa5ef('0x2'));var express=require('express');var router=express[_0xa5ef('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa5ef('0x4'));var config=require(_0xa5ef('0x5'));var controller=require(_0xa5ef('0x6'));router['get']('/',auth[_0xa5ef('0x7')](),controller[_0xa5ef('0x8')]);router[_0xa5ef('0x9')](_0xa5ef('0xa'),auth[_0xa5ef('0x7')](),controller['describe']);router['get'](_0xa5ef('0xb'),auth[_0xa5ef('0x7')](),controller[_0xa5ef('0xc')]);router[_0xa5ef('0x9')]('/:id/messages',auth[_0xa5ef('0x7')](),controller[_0xa5ef('0xd')]);router[_0xa5ef('0x9')](_0xa5ef('0xe'),auth[_0xa5ef('0x7')](),controller[_0xa5ef('0xf')]);router[_0xa5ef('0x10')]('/',auth[_0xa5ef('0x7')](),controller[_0xa5ef('0x11')]);router[_0xa5ef('0x10')](_0xa5ef('0x12'),auth[_0xa5ef('0x7')](),controller[_0xa5ef('0x13')]);router['post'](_0xa5ef('0x14'),auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelinteraction:addtags'),controller[_0xa5ef('0x15')]);router[_0xa5ef('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0xa5ef('0x17')]('openchannel',_0xa5ef('0x18')),controller[_0xa5ef('0x19')]);router[_0xa5ef('0x1a')](_0xa5ef('0xb'),auth['isAuthenticated'](),interaction[_0xa5ef('0x17')](_0xa5ef('0x1b'),_0xa5ef('0x1c')),controller[_0xa5ef('0x1d')]);router['delete'](_0xa5ef('0x14'),auth[_0xa5ef('0x7')](),controller[_0xa5ef('0x1e')]);module[_0xa5ef('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 8d3ff60..90dc038 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 _0xdfea=['exports','DATE','STRING','out','BOOLEAN','sequelize'];(function(_0x537f11,_0x8bb9c4){var _0x52a997=function(_0x658551){while(--_0x658551){_0x537f11['push'](_0x537f11['shift']());}};_0x52a997(++_0x8bb9c4);}(_0xdfea,0x1cd));var _0xadfe=function(_0x1451a0,_0x5a61d0){_0x1451a0=_0x1451a0-0x0;var _0x4ca2fc=_0xdfea[_0x1451a0];return _0x4ca2fc;};'use strict';var Sequelize=require(_0xadfe('0x0'));module[_0xadfe('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xadfe('0x2')]},'disposition':{'type':Sequelize[_0xadfe('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xadfe('0x3')]},'note':{'type':Sequelize[_0xadfe('0x3')]},'read1stAt':{'type':Sequelize[_0xadfe('0x2')]},'threadId':{'type':Sequelize[_0xadfe('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xadfe('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xadfe('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xadfe('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xadfe('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xb9bb=['DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x595963,_0x3bf0fa){var _0x4df5fa=function(_0x1f0472){while(--_0x1f0472){_0x595963['push'](_0x595963['shift']());}};_0x4df5fa(++_0x3bf0fa);}(_0xb9bb,0xa4));var _0xbb9b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb9bb[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xbb9b('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb9b('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbb9b('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xbb9b('0x2')]},'lastMsgAt':{'type':Sequelize[_0xbb9b('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xbb9b('0x3')]('in',_0xbb9b('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xbb9b('0x0')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d13d012..faf4749 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 _0xfc9b=['localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','end','sendStatus','name','Users','map','fullname','TagIds','Tags','split','push','then','catch','unmanaged','total','closed','UserId','waiting','talking','answered','index','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','union','User','$substring','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','contactName','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','OpenchannelInteraction','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','c.fax','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','intersection','includeAll','include','options','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','pick','findAll','setTags','emit','openchannelInteractionTags:save','removeTags','join','root','files','tmp','server','attachments','format','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','direction','Owner','get','mkdirSync','Openchannel','Account','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','renderFile','views','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis'];(function(_0x1e3d0f,_0x5a231f){var _0x14853a=function(_0x1d42d1){while(--_0x1d42d1){_0x1e3d0f['push'](_0x1e3d0f['shift']());}};_0x14853a(++_0x5a231f);}(_0xfc9b,0xd1));var _0xbfc9=function(_0x486ebf,_0x52042a){_0x486ebf=_0x486ebf-0x0;var _0x2a10aa=_0xfc9b[_0x486ebf];return _0x2a10aa;};'use strict';var emlformat=require(_0xbfc9('0x0'));var rimraf=require(_0xbfc9('0x1'));var zipdir=require(_0xbfc9('0x2'));var jsonpatch=require(_0xbfc9('0x3'));var rp=require('request-promise');var moment=require(_0xbfc9('0x4'));var BPromise=require(_0xbfc9('0x5'));var Mustache=require(_0xbfc9('0x6'));var util=require(_0xbfc9('0x7'));var path=require(_0xbfc9('0x8'));var sox=require(_0xbfc9('0x9'));var csv=require('to-csv');var ejs=require(_0xbfc9('0xa'));var fs=require('fs');var fs_extra=require(_0xbfc9('0xb'));var _=require(_0xbfc9('0xc'));var squel=require(_0xbfc9('0xd'));var crypto=require(_0xbfc9('0xe'));var jsforce=require(_0xbfc9('0xf'));var deskjs=require(_0xbfc9('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbfc9('0x11'));var Redis=require(_0xbfc9('0x12'));var authService=require(_0xbfc9('0x13'));var qs=require(_0xbfc9('0x14'));var as=require(_0xbfc9('0x15'));var pdf=require(_0xbfc9('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbfc9('0x17'));var utils=require(_0xbfc9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbfc9('0x19'));var db=require(_0xbfc9('0x1a'))['db'];config['redis']=_[_0xbfc9('0x1b')](config[_0xbfc9('0x1c')],{'host':_0xbfc9('0x1d'),'port':0x18eb});var socket=require(_0xbfc9('0x1e'))(new Redis(config[_0xbfc9('0x1c')]));require(_0xbfc9('0x1f'))[_0xbfc9('0x20')](socket);function respondWithStatusCode(_0x6baba5,_0x2d2dfc){_0x2d2dfc=_0x2d2dfc||0xcc;return function(_0xc2e397){if(_0xc2e397){return _0x6baba5['sendStatus'](_0x2d2dfc);}return _0x6baba5[_0xbfc9('0x21')](_0x2d2dfc)['end']();};}function respondWithResult(_0x4f285c,_0x125a27){_0x125a27=_0x125a27||0xc8;return function(_0x8e7fb0){if(_0x8e7fb0){return _0x4f285c[_0xbfc9('0x21')](_0x125a27)[_0xbfc9('0x22')](_0x8e7fb0);}};}function respondWithFilteredResult(_0x5d1274,_0x45b006){return function(_0x29b190){if(_0x29b190){var _0x2ff6f3=typeof _0x45b006[_0xbfc9('0x23')]==='undefined'&&typeof _0x45b006[_0xbfc9('0x24')]===_0xbfc9('0x25');var _0x2c9871=_0x29b190[_0xbfc9('0x26')];var _0x5a266c=_0x2ff6f3?0x0:_0x45b006[_0xbfc9('0x23')];var _0x370b58=_0x2ff6f3?_0x29b190[_0xbfc9('0x26')]:_0x45b006[_0xbfc9('0x23')]+_0x45b006[_0xbfc9('0x24')];var _0x15d2d3;if(_0x370b58>=_0x2c9871){_0x370b58=_0x2c9871;_0x15d2d3=0xc8;}else{_0x15d2d3=0xce;}_0x5d1274['status'](_0x15d2d3);return _0x5d1274[_0xbfc9('0x27')](_0xbfc9('0x28'),_0x5a266c+'-'+_0x370b58+'/'+_0x2c9871)[_0xbfc9('0x22')](_0x29b190);}return null;};}function patchUpdates(_0x12f3f1){return function(_0x24de44){try{jsonpatch['apply'](_0x24de44,_0x12f3f1,!![]);}catch(_0x5063c6){return BPromise[_0xbfc9('0x29')](_0x5063c6);}return _0x24de44[_0xbfc9('0x2a')]();};}function saveUpdates(_0x493d68,_0x19e76a){return function(_0x5cb890){if(_0x5cb890){return _0x5cb890[_0xbfc9('0x2b')](_0x493d68)['then'](function(_0x1d88a9){return _0x1d88a9;});}return null;};}function removeEntity(_0x464070,_0x5790b6){return function(_0x452dff){if(_0x452dff){return _0x452dff[_0xbfc9('0x2c')]()['then'](function(){_0x464070['status'](0xcc)[_0xbfc9('0x2d')]();});}};}function handleEntityNotFound(_0x5eafda,_0x278f99){return function(_0x5abe79){if(!_0x5abe79){_0x5eafda[_0xbfc9('0x2e')](0x194);}return _0x5abe79;};}function handleError(_0x2fd467,_0x675f42){_0x675f42=_0x675f42||0x1f4;return function(_0xe88a3f){logger['error'](_0xe88a3f['stack']);if(_0xe88a3f[_0xbfc9('0x2f')]){delete _0xe88a3f[_0xbfc9('0x2f')];}_0x2fd467[_0xbfc9('0x21')](_0x675f42)['send'](_0xe88a3f);};}function getInteractionUsers(_0x7084c4,_0x556d7e){return new BPromise(function(_0x492e19,_0x19d3da){try{if(_0x556d7e[_0x7084c4['id']]){_0x7084c4[_0xbfc9('0x30')]=_[_0xbfc9('0x31')](_0x556d7e[_0x7084c4['id']],function(_0x49e608){return{'id':_0x49e608['id'],'fullname':_0x49e608[_0xbfc9('0x32')]};});}}catch(_0x254dbc){_0x19d3da(_0x254dbc);}_0x492e19(_0x7084c4);});}function getInteractionTags(_0x3a3714,_0x35847e){return new BPromise(function(_0x20b6a6,_0x42a448){try{if(_0x3a3714[_0xbfc9('0x33')]){_0x3a3714[_0xbfc9('0x34')]=[];_0x3a3714[_0xbfc9('0x33')][_0xbfc9('0x35')](',')['forEach'](function(_0xfc191d){_0x3a3714[_0xbfc9('0x34')][_0xbfc9('0x36')](_0x35847e[_0xfc191d]);});}delete _0x3a3714[_0xbfc9('0x33')];}catch(_0x1070aa){_0x42a448(_0x1070aa);}_0x20b6a6(_0x3a3714);});}function updateOpenchannelInteraction(_0x238f50,_0x1236f4,_0x3c8d60){return new BPromise(function(_0x16233e,_0x10e006){return getInteractionUsers(_0x238f50,_0x3c8d60)[_0xbfc9('0x37')](function(_0x216d9b){return getInteractionTags(_0x216d9b,_0x1236f4);})[_0xbfc9('0x37')](function(_0x3f1882){return getStateInteraction(_0x3f1882);})[_0xbfc9('0x37')](function(_0x17a5c9){_0x16233e(_0x17a5c9);})[_0xbfc9('0x38')](function(_0x53aeaf){_0x10e006(_0x53aeaf);});});}function getStateInteraction(_0x349510){return new BPromise(function(_0x469b2e){_0x349510['waiting']=0x0;_0x349510['talking']=0x0;_0x349510['answered']=0x0;_0x349510[_0xbfc9('0x39')]=0x0;_0x349510[_0xbfc9('0x3a')]=0x0;if(!_0x349510[_0xbfc9('0x3b')]&&!_0x349510[_0xbfc9('0x3c')]){_0x349510[_0xbfc9('0x3d')]+=0x1;}if(!_0x349510[_0xbfc9('0x3b')]&&_0x349510[_0xbfc9('0x3c')]){_0x349510[_0xbfc9('0x3e')]+=0x1;if(_0x349510[_0xbfc9('0x3d')]){_0x349510['waiting']-=0x1;}}if(_0x349510[_0xbfc9('0x3b')]&&_0x349510[_0xbfc9('0x3c')]){_0x349510[_0xbfc9('0x3f')]+=0x1;if(_0x349510['talking']){_0x349510[_0xbfc9('0x3e')]-=0x1;}}if(_0x349510[_0xbfc9('0x3b')]&&!_0x349510[_0xbfc9('0x3c')]){_0x349510[_0xbfc9('0x39')]+=0x1;if(_0x349510[_0xbfc9('0x3d')]){_0x349510[_0xbfc9('0x3d')]-=0x1;}}_0x349510[_0xbfc9('0x3a')]+=0x1;_0x469b2e(_0x349510);});}exports[_0xbfc9('0x40')]=function(_0x32c397,_0x52d8db){var _0x6cdd57={},_0x280f5f={},_0x2773ba={'count':0x0,'rows':[]};var _0xe57fb=_[_0xbfc9('0x31')](db['OpenchannelInteraction'][_0xbfc9('0x41')],function(_0x46c0f7){return{'name':_0x46c0f7['fieldName'],'type':_0x46c0f7[_0xbfc9('0x42')]['key']};});_0x280f5f[_0xbfc9('0x43')]=_[_0xbfc9('0x31')](_0xe57fb,'name');_0x280f5f[_0xbfc9('0x44')]=_[_0xbfc9('0x45')](_0x32c397[_0xbfc9('0x44')]);_0x280f5f[_0xbfc9('0x46')]=_['intersection'](_0x280f5f[_0xbfc9('0x43')],_0x280f5f[_0xbfc9('0x44')]);_0x6cdd57[_0xbfc9('0x47')]=_['intersection'](_0x280f5f[_0xbfc9('0x43')],qs[_0xbfc9('0x48')](_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x48')]));_0x6cdd57['attributes']=_0x6cdd57[_0xbfc9('0x47')][_0xbfc9('0x49')]?_0x6cdd57['attributes']:_0x280f5f[_0xbfc9('0x43')];if(!_0x32c397['query'][_0xbfc9('0x4a')](_0xbfc9('0x4b'))){_0x6cdd57[_0xbfc9('0x24')]=qs[_0xbfc9('0x24')](_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x24')]);_0x6cdd57[_0xbfc9('0x23')]=qs['offset'](_0x32c397['query']['offset']);}_0x6cdd57[_0xbfc9('0x4c')]=qs[_0xbfc9('0x4d')](_0x32c397[_0xbfc9('0x44')]['sort']);_0x6cdd57[_0xbfc9('0x4e')]=qs[_0xbfc9('0x46')](_['pick'](_0x32c397['query'],_0x280f5f[_0xbfc9('0x46')]),_0xe57fb);var _0x5f1771=[];var _0x2e0835=squel[_0xbfc9('0x4f')]()['field']('id')[_0xbfc9('0x50')](_0xbfc9('0x2f'))[_0xbfc9('0x50')](_0xbfc9('0x51'))[_0xbfc9('0x52')](_0xbfc9('0x53'));var _0x58238d=squel[_0xbfc9('0x4f')]()[_0xbfc9('0x50')]('u.id')[_0xbfc9('0x50')](_0xbfc9('0x54'))['field'](_0xbfc9('0x55'))['from'](_0xbfc9('0x56'),'ui')[_0xbfc9('0x57')](_0xbfc9('0x58'),'u',_0xbfc9('0x59'));var _0x28eabb=squel[_0xbfc9('0x4f')]()['from'](_0xbfc9('0x5a'),'i')['left_join'](_0xbfc9('0x5b'),'c',_0xbfc9('0x5c'))['left_join'](_0xbfc9('0x58'),'o',_0xbfc9('0x5d'))[_0xbfc9('0x57')](_0xbfc9('0x5e'),'a',_0xbfc9('0x5f'))[_0xbfc9('0x57')](_0xbfc9('0x60'),'me',_0xbfc9('0x61'))[_0xbfc9('0x57')](_0xbfc9('0x62'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xbfc9('0x53'),'t',_0xbfc9('0x63'));var _0x563bde=squel[_0xbfc9('0x64')]();var _0x1ea311=[];var _0x70c0e8=squel[_0xbfc9('0x64')]();var _0x4ce147;if(_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x65')]){_0x4ce147=as[_0xbfc9('0x66')](_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x65')]);var _0x13fceb=_0x4ce147[_0xbfc9('0x67')];for(var _0x55ce33=0x0;_0x55ce33<_0x4ce147[_0xbfc9('0x68')]['length'];_0x55ce33++){var _0x67a84f=_0x4ce147[_0xbfc9('0x68')][_0x55ce33];var _0x52c2e1='i';var _0x5c8c9a=_['find'](_0xe57fb,[_0xbfc9('0x2f'),_0x67a84f[_0xbfc9('0x50')]]);if(!_0x5c8c9a){switch(_0x67a84f[_0xbfc9('0x50')]){case _0xbfc9('0x69'):if(_0x67a84f['value']==0x1){_0x28eabb['having']('`'+_0x67a84f[_0xbfc9('0x50')]+'`\x20=\x200');}else{_0x28eabb[_0xbfc9('0x6a')]('`'+_0x67a84f['field']+'`\x20>\x200');}break;case'Contact':if(_0x67a84f[_0xbfc9('0x6b')]==='$substring'){if(_0x67a84f[_0xbfc9('0x6c')][_0xbfc9('0x35')]('\x20')['length']>0x1){_0x563bde[_0x13fceb](_0xbfc9('0x6d'),qs['getFullTextValue'](_0x67a84f[_0xbfc9('0x6c')]),null);}else{var _0xf8247d='%'+_0x67a84f['value']+'%';_0x563bde[_0x13fceb](_0xbfc9('0x6e'),_0xf8247d,_0xf8247d,_0xf8247d);}}else{_0x5c8c9a=_[_0xbfc9('0x6f')](_0xe57fb,[_0xbfc9('0x2f'),_0xbfc9('0x70')]);_0x67a84f[_0xbfc9('0x50')]=_0xbfc9('0x70');_0x2288f8=as[_0xbfc9('0x71')](_0x52c2e1,_0x5c8c9a[_0xbfc9('0x42')],_0x67a84f);_0x563bde[_0x13fceb](_0x2288f8[_0xbfc9('0x72')],_0x2288f8['value'][_0xbfc9('0x73')],_0x2288f8[_0xbfc9('0x6c')][_0xbfc9('0x2d')]);}break;case _0xbfc9('0x74'):var _0x466d21=_0x67a84f[_0xbfc9('0x6c')][_0xbfc9('0x35')](',')['map'](function(_0x16377f){return Number(_0x16377f);});_0x466d21['forEach'](function(_0x2bbd5c){_0x70c0e8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2bbd5c+',%');});_0x1ea311=_[_0xbfc9('0x75')](_0x1ea311,_0x466d21);break;case _0xbfc9('0x76'):if(_0x67a84f[_0xbfc9('0x6b')]===_0xbfc9('0x77')){_0x563bde[_0x13fceb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x67a84f[_0xbfc9('0x6c')]+'%',null);}else{_0x5c8c9a=_[_0xbfc9('0x6f')](_0xe57fb,[_0xbfc9('0x2f'),'UserId']);_0x67a84f['field']='UserId';_0x2288f8=as['buildExpression'](_0x52c2e1,_0x5c8c9a['type'],_0x67a84f);_0x563bde[_0x13fceb](_0x2288f8[_0xbfc9('0x72')],_0x2288f8[_0xbfc9('0x6c')][_0xbfc9('0x73')],_0x2288f8[_0xbfc9('0x6c')][_0xbfc9('0x2d')]);}break;case'body':_0x2288f8=as[_0xbfc9('0x71')]('me',null,_0x67a84f);_0x563bde[_0x13fceb](_0x2288f8[_0xbfc9('0x72')],_0x2288f8[_0xbfc9('0x6c')]['start'],_0x2288f8[_0xbfc9('0x6c')]['end']);break;}}else{var _0x2288f8=as[_0xbfc9('0x71')](_0x52c2e1,_0x5c8c9a[_0xbfc9('0x42')],_0x67a84f);_0x563bde[_0x13fceb](_0x2288f8[_0xbfc9('0x72')],_0x2288f8[_0xbfc9('0x6c')][_0xbfc9('0x73')],_0x2288f8[_0xbfc9('0x6c')][_0xbfc9('0x2d')]);}}}else{var _0x29eae8=_(_0x32c397[_0xbfc9('0x44')])[_0xbfc9('0x45')]()[_0xbfc9('0x31')](function(_0x58990c){return _['some'](_0xe57fb,['name',_0x58990c])?_0x58990c:undefined;})['compact']()[_0xbfc9('0x6c')]();if(!_[_0xbfc9('0x78')](_0x29eae8)){_0x29eae8['forEach'](function(_0x32f894){if(_0x32f894===_0xbfc9('0x79')){_0x28eabb[_0xbfc9('0x4e')](_0xbfc9('0x7a'),[][_0xbfc9('0x7b')](_0x32c397[_0xbfc9('0x44')][_0x32f894]));}else if(_0x32f894===_0xbfc9('0x7c')){var _0x5c754a=JSON[_0xbfc9('0x7d')](_0x32c397['query'][_0x32f894])[_0xbfc9('0x7e')];var _0x27ac11=JSON[_0xbfc9('0x7d')](_0x32c397[_0xbfc9('0x44')][_0x32f894])['$lte'];_0x28eabb[_0xbfc9('0x4e')](_0xbfc9('0x7f'),_0x5c754a,_0x27ac11);}else{if(_0x32c397[_0xbfc9('0x44')][_0x32f894]===_0xbfc9('0x80')){_0x28eabb[_0xbfc9('0x4e')]('i.'+_0x32f894+'\x20IS\x20NULL');}else{_0x28eabb[_0xbfc9('0x4e')]('i.'+_0x32f894+'\x20=\x20?',_0x32c397[_0xbfc9('0x44')][_0x32f894]);}}});}if(_0x32c397['query']['read']){if(_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x81')]==0x1){_0x28eabb[_0xbfc9('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x28eabb[_0xbfc9('0x6a')](_0xbfc9('0x82'));}}if(_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x83')]){_0x1ea311=_[_0xbfc9('0x84')](_0x32c397[_0xbfc9('0x44')]['tag'])?_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x83')]:new Array(_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x83')]);_0x1ea311['forEach'](function(_0x31edf2){_0x70c0e8['or'](_0xbfc9('0x85'),'%,'+_0x31edf2+',%');});}if(_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x86')]){var _0x15c59d=_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x86')][_0xbfc9('0x87')]('\x5c','\x5c\x5c')[_0xbfc9('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x15c59d)){_0x563bde['or']('i.id\x20LIKE\x20?',_0x15c59d+'%');}else{_0x563bde['or'](_0xbfc9('0x88'),qs[_0xbfc9('0x89')](_0x15c59d))['or'](_0xbfc9('0x8a'),_0x15c59d+'%')['or'](_0xbfc9('0x8b'),_0x15c59d+'%');}}}_0x28eabb['where'](_0x563bde);_0x28eabb[_0xbfc9('0x8c')]('i.id');var _0x5b8659={'type':db[_0xbfc9('0x8d')][_0xbfc9('0x8e')]['SELECT'],'raw':!![]};var _0x207abc=_0x28eabb['clone']();_0x207abc['field']('i.id');_0x207abc[_0xbfc9('0x50')](_0xbfc9('0x8f'),_0xbfc9('0x69'));if(_0x6cdd57[_0xbfc9('0x4c')]){_0x6cdd57[_0xbfc9('0x4c')][_0xbfc9('0x90')](function(_0x4cf80c){var _0xae928a=_0x4cf80c[0x0]===_0xbfc9('0x91')?_0x4cf80c[0x0]:'i.'+_0x4cf80c[0x0];_0x28eabb[_0xbfc9('0x4c')](_0xae928a,_0x4cf80c[0x1]===_0xbfc9('0x92')?![]:!![]);});}if(!_[_0xbfc9('0x78')](_0x1ea311)){_0x28eabb['having'](_0x70c0e8);_0x207abc['where'](_0xbfc9('0x93'),_0x1ea311);}BPromise['resolve']()['then'](function(){if(!_0x4ce147){if(_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x79')])return;_0x207abc[_0xbfc9('0x4e')](_0xbfc9('0x94'));_0x28eabb[_0xbfc9('0x4e')](_0xbfc9('0x94'));return;}if(_0x32c397['user'][_0xbfc9('0x95')]!=='agent')return;return _0x32c397[_0xbfc9('0x96')][_0xbfc9('0x97')]({'attributes':['id'],'raw':!![]})[_0xbfc9('0x37')](function(_0x119223){if(_[_0xbfc9('0x78')](_0x119223)){_0x207abc['where'](_0xbfc9('0x98'));_0x28eabb[_0xbfc9('0x4e')](_0xbfc9('0x98'));}else{_0x207abc['where'](_0xbfc9('0x7a'),_[_0xbfc9('0x31')](_0x119223,'id'));_0x28eabb[_0xbfc9('0x4e')](_0xbfc9('0x7a'),_[_0xbfc9('0x31')](_0x119223,'id'));}});})[_0xbfc9('0x37')](function(){if(_0x32c397[_0xbfc9('0x96')][_0xbfc9('0x95')]===_0xbfc9('0x99')&&!_0x4ce147&&!_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x79')])return[];return db[_0xbfc9('0x9a')][_0xbfc9('0x44')](_0x207abc[_0xbfc9('0x9b')](),_0x5b8659);})[_0xbfc9('0x37')](function(_0x54da6e){_0x2773ba[_0xbfc9('0x26')]=_0x54da6e[_0xbfc9('0x49')];if(_0x2773ba[_0xbfc9('0x26')]===0x0)return[];return db[_0xbfc9('0x9a')][_0xbfc9('0x44')](_0x2e0835['toString'](),_0x5b8659)[_0xbfc9('0x37')](function(_0x23286d){_0x5f1771=_['keyBy'](_0x23286d,'id');_0x5b8659=_[_0xbfc9('0x9c')](_0x5b8659,{'model':db[_0xbfc9('0x9d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x32c397[_0xbfc9('0x44')][_0xbfc9('0x48')]){_0x6cdd57[_0xbfc9('0x47')][_0xbfc9('0x90')](function(_0xd5fe5b){_0x28eabb[_0xbfc9('0x50')]('i.'+_0xd5fe5b);});}else{_0x28eabb[_0xbfc9('0x50')](_0xbfc9('0x8f'),_0xbfc9('0x69'));_0x28eabb[_0xbfc9('0x50')]('a.key',_0xbfc9('0x9e'));_0x28eabb[_0xbfc9('0x50')](_0xbfc9('0x9f'),'Account.mandatoryDisposition');_0x28eabb[_0xbfc9('0x50')](_0xbfc9('0xa0'),'contactName');_0x28eabb[_0xbfc9('0x50')]('i.*');_0x28eabb[_0xbfc9('0x50')](_0xbfc9('0xa1'),'Contact.firstName');_0x28eabb[_0xbfc9('0x50')](_0xbfc9('0xa2'),_0xbfc9('0xa3'));_0x28eabb['field'](_0xbfc9('0xa4'),'Contact.email');_0x28eabb[_0xbfc9('0x50')](_0xbfc9('0xa5'),'Contact.phone');_0x28eabb[_0xbfc9('0x50')](_0xbfc9('0xa6'),'Contact.mobile');_0x28eabb[_0xbfc9('0x50')](_0xbfc9('0xa7'),_0xbfc9('0xa8'));_0x28eabb[_0xbfc9('0x50')]('o.fullname','Owner.fullname');_0x28eabb[_0xbfc9('0x50')](_0xbfc9('0xa9'),'Owner.internal');_0x28eabb['field'](_0xbfc9('0xaa'),'TagIds');}if(_0x6cdd57[_0xbfc9('0x24')])_0x28eabb[_0xbfc9('0x24')](_0x6cdd57[_0xbfc9('0x24')]);if(_0x6cdd57[_0xbfc9('0x23')])_0x28eabb[_0xbfc9('0x23')](_0x6cdd57[_0xbfc9('0x23')]);return db[_0xbfc9('0x9a')][_0xbfc9('0x44')](_0x28eabb['toString'](),_0x5b8659);})[_0xbfc9('0x37')](function(_0x1da842){if(_0x1da842['length']>0x0)_0x58238d[_0xbfc9('0x4e')](_0xbfc9('0xab'),_[_0xbfc9('0x31')](_0x1da842,'id'));return db['sequelize'][_0xbfc9('0x44')](_0x58238d['toString'](),_0x5b8659)[_0xbfc9('0x37')](function(_0x3b8d5f){var _0x52449d=_[_0xbfc9('0xac')](_0x3b8d5f,_0xbfc9('0xad'));var _0x5da0af=[];_0x1da842[_0xbfc9('0x90')](function(_0x16f605){_0x5da0af['push'](updateOpenchannelInteraction(_0x16f605,_0x5f1771,_0x52449d));});return BPromise[_0xbfc9('0xae')](_0x5da0af);});});})[_0xbfc9('0x37')](function(_0x485795){_0x2773ba[_0xbfc9('0xaf')]=_0x485795;return _0x2773ba;})[_0xbfc9('0x37')](respondWithFilteredResult(_0x52d8db,_0x6cdd57))[_0xbfc9('0x38')](handleError(_0x52d8db,null));};exports[_0xbfc9('0xb0')]=function(_0x2124df,_0x290968){var _0x2e99f8={};if(_0x2124df[_0xbfc9('0x44')][_0xbfc9('0x42')]&&_0x2124df[_0xbfc9('0x44')][_0xbfc9('0x42')]==='from'){_0x2e99f8[_0xbfc9('0x52')]=_0x2124df[_0xbfc9('0xb1')]['id'];}else{_0x2e99f8['id']=_0x2124df[_0xbfc9('0xb1')]['id'];}var _0x32bc3b={'raw':![],'where':_0x2e99f8},_0x122088={};_0x122088[_0xbfc9('0x43')]=_['keys'](db['OpenchannelInteraction'][_0xbfc9('0x41')]);_0x122088[_0xbfc9('0x44')]=_['keys'](_0x2124df['query']);_0x122088[_0xbfc9('0x46')]=_[_0xbfc9('0xb2')](_0x122088[_0xbfc9('0x43')],_0x122088[_0xbfc9('0x44')]);_0x32bc3b[_0xbfc9('0x47')]=_['intersection'](_0x122088[_0xbfc9('0x43')],qs['fields'](_0x2124df[_0xbfc9('0x44')][_0xbfc9('0x48')]));_0x32bc3b[_0xbfc9('0x47')]=_0x32bc3b['attributes'][_0xbfc9('0x49')]?_0x32bc3b['attributes']:_0x122088[_0xbfc9('0x43')];if(_0x2124df[_0xbfc9('0x44')][_0xbfc9('0xb3')]){_0x32bc3b[_0xbfc9('0xb4')]=[{'all':!![]}];}_0x32bc3b=_[_0xbfc9('0x9c')]({},_0x32bc3b,_0x2124df[_0xbfc9('0xb5')]);return db[_0xbfc9('0x9d')][_0xbfc9('0x6f')](_0x32bc3b)['then'](handleEntityNotFound(_0x290968,null))['then'](respondWithResult(_0x290968,null))[_0xbfc9('0x38')](handleError(_0x290968,null));};exports[_0xbfc9('0xb6')]=function(_0xb1f160,_0x4fc611){return db[_0xbfc9('0x9d')][_0xbfc9('0xb6')](_0xb1f160[_0xbfc9('0xb7')],{})[_0xbfc9('0x37')](respondWithResult(_0x4fc611,0xc9))[_0xbfc9('0x38')](handleError(_0x4fc611,null));};exports[_0xbfc9('0x2b')]=function(_0x4b8c58,_0x494679){if(_0x4b8c58[_0xbfc9('0xb7')]['id']){delete _0x4b8c58[_0xbfc9('0xb7')]['id'];}return db[_0xbfc9('0x9d')][_0xbfc9('0x6f')]({'where':{'id':_0x4b8c58[_0xbfc9('0xb1')]['id']}})['then'](handleEntityNotFound(_0x494679,null))[_0xbfc9('0x37')](saveUpdates(_0x4b8c58['body'],null))['then'](respondWithResult(_0x494679,null))['catch'](handleError(_0x494679,null));};exports['destroy']=function(_0x4fefaf,_0x2ef4ac){return db[_0xbfc9('0x9d')]['find']({'where':{'id':_0x4fefaf[_0xbfc9('0xb1')]['id']}})[_0xbfc9('0x37')](handleEntityNotFound(_0x2ef4ac,null))[_0xbfc9('0x37')](removeEntity(_0x2ef4ac,null))['catch'](handleError(_0x2ef4ac,null));};exports['describe']=function(_0x3b155b,_0x3390d6){return db[_0xbfc9('0x9d')][_0xbfc9('0xb8')]()[_0xbfc9('0x37')](respondWithResult(_0x3390d6,null))[_0xbfc9('0x38')](handleError(_0x3390d6,null));};exports[_0xbfc9('0xb9')]=function(_0x15af3b,_0x1bc741,_0x1a4913){return db[_0xbfc9('0xba')]['find']({'where':{'id':_0x15af3b[_0xbfc9('0xb1')]['id']}})[_0xbfc9('0x37')](handleEntityNotFound(_0x1bc741,null))[_0xbfc9('0x37')](function(_0x52b314){if(_0x52b314){return _0x52b314[_0xbfc9('0xb9')](_0x15af3b[_0xbfc9('0xb7')][_0xbfc9('0xbb')],_[_0xbfc9('0xbc')](_0x15af3b[_0xbfc9('0xb7')],['ids','id'])||{});}})['then'](respondWithResult(_0x1bc741,null))[_0xbfc9('0x38')](handleError(_0x1bc741,null));};exports[_0xbfc9('0xbd')]=function(_0x3d7be5,_0x2061c3,_0x37e7a5){var _0x4d96cb={'raw':![],'where':{}};var _0x26c671={};var _0x4ab4a3={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xbfc9('0xbe')]({'where':{'id':_0x3d7be5['params']['id']}})['then'](handleEntityNotFound(_0x2061c3,null))['then'](function(_0x1a983a){if(_0x1a983a){_0x26c671[_0xbfc9('0x43')]=_[_0xbfc9('0x45')](db[_0xbfc9('0xba')][_0xbfc9('0x41')]);_0x26c671[_0xbfc9('0x44')]=_[_0xbfc9('0x45')](_0x3d7be5[_0xbfc9('0x44')]);_0x26c671['filters']=_[_0xbfc9('0xb2')](_0x26c671[_0xbfc9('0x43')],_0x26c671[_0xbfc9('0x44')]);_0x4d96cb[_0xbfc9('0x47')]=_[_0xbfc9('0xb2')](_0x26c671[_0xbfc9('0x43')],qs[_0xbfc9('0x48')](_0x3d7be5['query'][_0xbfc9('0x48')]));_0x4d96cb['attributes']=_0x4d96cb[_0xbfc9('0x47')]['length']?_0x4d96cb[_0xbfc9('0x47')]:_0x26c671[_0xbfc9('0x43')];if(!_0x3d7be5[_0xbfc9('0x44')]['hasOwnProperty'](_0xbfc9('0x4b'))){_0x4d96cb[_0xbfc9('0x24')]=qs[_0xbfc9('0x24')](_0x3d7be5[_0xbfc9('0x44')][_0xbfc9('0x24')]);_0x4d96cb[_0xbfc9('0x23')]=qs['offset'](_0x3d7be5[_0xbfc9('0x44')]['offset']);}_0x4d96cb['order']=qs[_0xbfc9('0x4d')](_0x3d7be5[_0xbfc9('0x44')][_0xbfc9('0x4d')]);_0x4d96cb[_0xbfc9('0x4e')]=qs[_0xbfc9('0x46')](_[_0xbfc9('0xbf')](_0x3d7be5['query'],_0x26c671[_0xbfc9('0x46')]));_0x4d96cb[_0xbfc9('0x4e')][_0xbfc9('0xad')]=_0x1a983a['id'];if(_0x3d7be5[_0xbfc9('0x44')][_0xbfc9('0x86')]){_0x4d96cb[_0xbfc9('0x4e')]=_[_0xbfc9('0x9c')](_0x4d96cb[_0xbfc9('0x4e')],{'$or':_['map'](_0x4d96cb[_0xbfc9('0x47')],function(_0x556382){var _0x10621d={};_0x10621d[_0x556382]={'$like':'%'+_0x3d7be5[_0xbfc9('0x44')][_0xbfc9('0x86')]+'%'};return _0x10621d;})});}if(_0x3d7be5[_0xbfc9('0x44')][_0xbfc9('0x7e')]){var _0x3267a6=_0x3d7be5[_0xbfc9('0x44')][_0xbfc9('0x7e')]['split'](',');var _0x56cb58={};_0x56cb58[_0x3267a6[0x0]]={'$gte':moment(_0x3267a6[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4d96cb[_0xbfc9('0x4e')]=_[_0xbfc9('0x9c')](_0x4d96cb['where'],_0x56cb58);}_0x4d96cb=_[_0xbfc9('0x9c')]({},_0x4d96cb,_0x3d7be5['options']);return db[_0xbfc9('0xba')][_0xbfc9('0x26')]({'where':_0x4d96cb[_0xbfc9('0x4e')]})[_0xbfc9('0x37')](function(_0x16992d){_0x4ab4a3['count']=_0x16992d;if(_0x3d7be5['query']['includeAll']){_0x4d96cb[_0xbfc9('0xb4')]=[{'all':!![]}];}return db[_0xbfc9('0xba')][_0xbfc9('0xc0')](_0x4d96cb);})[_0xbfc9('0x37')](function(_0x16ce0b){_0x4ab4a3[_0xbfc9('0xaf')]=_0x16ce0b;return _0x4ab4a3;});}})[_0xbfc9('0x37')](respondWithFilteredResult(_0x2061c3,_0x4d96cb))['catch'](handleError(_0x2061c3,null));};exports['addTags']=function(_0x41f775,_0x193baf,_0x22c333){return db['OpenchannelInteraction'][_0xbfc9('0x6f')]({'where':{'id':_0x41f775[_0xbfc9('0xb1')]['id']}})[_0xbfc9('0x37')](handleEntityNotFound(_0x193baf,null))[_0xbfc9('0x37')](function(_0x185c28){if(_0x185c28){return _0x185c28[_0xbfc9('0xc1')](_0x41f775[_0xbfc9('0xb7')][_0xbfc9('0xbb')],_[_0xbfc9('0xbc')](_0x41f775['body'],['ids','id'])||{})['spread'](function(){return db[_0xbfc9('0x74')][_0xbfc9('0xc0')]({'attributes':['id','name',_0xbfc9('0x51')],'where':{'id':_0x41f775[_0xbfc9('0xb7')][_0xbfc9('0xbb')]}});})['then'](function(_0x3b497e){socket[_0xbfc9('0xc2')](_0xbfc9('0xc3'),{'id':Number(_0x41f775['params']['id']),'tags':_0x3b497e||[]});return{'id':Number(_0x41f775[_0xbfc9('0xb1')]['id']),'tags':_0x3b497e||[]};});}})[_0xbfc9('0x37')](respondWithResult(_0x193baf,null))['catch'](handleError(_0x193baf,null));};exports[_0xbfc9('0xc4')]=function(_0x3303e5,_0x445841,_0x573a92){return db[_0xbfc9('0x9d')][_0xbfc9('0x6f')]({'where':{'id':_0x3303e5[_0xbfc9('0xb1')]['id']}})[_0xbfc9('0x37')](handleEntityNotFound(_0x445841,null))[_0xbfc9('0x37')](function(_0x12379f){if(_0x12379f){return _0x12379f[_0xbfc9('0xc4')](_0x3303e5['query'][_0xbfc9('0xbb')]);}})['then'](respondWithStatusCode(_0x445841,null))[_0xbfc9('0x38')](handleError(_0x445841,null));};exports['download']=function(_0x53db4f,_0x1ea78d){var _0x5222da=moment()['unix']()[_0xbfc9('0x9b')]();var _0x1d9a03=path[_0xbfc9('0xc5')](config[_0xbfc9('0xc6')],'server',_0xbfc9('0xc7'),_0xbfc9('0xc8'));var _0x1f1ebe=path[_0xbfc9('0xc5')](config[_0xbfc9('0xc6')],_0xbfc9('0xc9'),_0xbfc9('0xc7'),_0xbfc9('0xca'));var _0x2f50f5=path[_0xbfc9('0xc5')](_0x1d9a03,_0x5222da);var _0x32ce9a=util[_0xbfc9('0xcb')](_0xbfc9('0xcc'),_0x53db4f[_0xbfc9('0xb1')]['id'],_0x5222da);var _0xcd3a61=path[_0xbfc9('0xc5')](_0x1d9a03,_0x32ce9a);var _0x28e508=[];_0x28e508[_0xbfc9('0x36')]({'model':db[_0xbfc9('0x76')],'as':_0xbfc9('0x76'),'attributes':['id','fullname'],'raw':!![]});_0x28e508[_0xbfc9('0x36')]({'model':db[_0xbfc9('0xcd')],'as':_0xbfc9('0xce'),'attributes':['id',_0xbfc9('0xcf'),_0xbfc9('0xd0')],'raw':!![]});if(_0x53db4f['query'][_0xbfc9('0xca')]){_0x28e508['push']({'model':db[_0xbfc9('0xd1')],'as':_0xbfc9('0xd1'),'raw':!![]});}var _0x3bafa8=[{'model':db[_0xbfc9('0xba')],'as':'Messages','attributes':['id',_0xbfc9('0xb7'),_0xbfc9('0x7c'),_0xbfc9('0xd2'),'secret',_0xbfc9('0x81')],'include':_0x28e508}];_0x3bafa8[_0xbfc9('0x36')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id','name']});_0x3bafa8[_0xbfc9('0x36')]({'model':db['User'],'as':_0xbfc9('0xd3'),'attributes':['id','fullname']});return db[_0xbfc9('0x9d')]['find']({'where':{'id':_0x53db4f['params']['id']},'include':_0x3bafa8})['then'](handleEntityNotFound(_0x1ea78d,null))[_0xbfc9('0x37')](function(_0x5198aa){if(_0x5198aa){var _0x2767e8=_0x5198aa[_0xbfc9('0xd4')]({'plain':!![]});fs[_0xbfc9('0xd5')](_0x2f50f5);var _0x1b3494={'channel':_0xbfc9('0xd6'),'account':_0x2767e8[_0xbfc9('0xd7')][_0xbfc9('0x2f')],'agent':_0x2767e8[_0xbfc9('0xd3')]?_0x2767e8[_0xbfc9('0xd3')][_0xbfc9('0x32')]:'N.A.','createdAt':moment(_0x2767e8['createdAt'])['format'](_0xbfc9('0xd8'))['toString'](),'closedAt':_0x2767e8[_0xbfc9('0x3b')]?moment(_0x2767e8[_0xbfc9('0xd9')])[_0xbfc9('0xcb')](_0xbfc9('0xd8'))[_0xbfc9('0x9b')]():'','disposition':_0x2767e8[_0xbfc9('0xda')],'visibility':_0x2767e8[_0xbfc9('0xdb')]?_0xbfc9('0xdc'):_0xbfc9('0xdd'),'messages':_(_0x2767e8[_0xbfc9('0xde')])[_0xbfc9('0x86')]({'secret':![]})['map'](function(_0x57fb2e){if(_0x57fb2e[_0xbfc9('0xd1')]){var _0x2ccb75=path['join'](_0x1f1ebe,_0x57fb2e[_0xbfc9('0xd1')][_0xbfc9('0xdf')]);if(fs[_0xbfc9('0xe0')](_0x2ccb75)){fs[_0xbfc9('0xe1')](_0x2ccb75)[_0xbfc9('0xe2')](fs[_0xbfc9('0xe3')](path[_0xbfc9('0xc5')](_0x2f50f5,_0x57fb2e['Attachment'][_0xbfc9('0xdf')])));}}return{'date':moment(_0x57fb2e[_0xbfc9('0x7c')])[_0xbfc9('0xcb')](_0xbfc9('0xd8'))['toString'](),'sender':_0x57fb2e[_0xbfc9('0xd2')]===_0xbfc9('0xe4')?_0x57fb2e[_0xbfc9('0x76')]?_0x57fb2e[_0xbfc9('0x76')][_0xbfc9('0x32')]:_0xbfc9('0xe5'):_0x57fb2e[_0xbfc9('0xce')][_0xbfc9('0xcf')]+(_0x57fb2e[_0xbfc9('0xce')][_0xbfc9('0xd0')]?'\x20'+_0x57fb2e['Contact']['lastName']:''),'body':_0x57fb2e['Attachment']?_0x57fb2e['Attachment'][_0xbfc9('0xdf')]:_0x57fb2e['body'],'direction':_0x57fb2e['direction']===_0xbfc9('0xe4')?'A':'C','secret':_0x57fb2e[_0xbfc9('0xe6')],'read':_0x57fb2e[_0xbfc9('0x81')],'attachment':_0x57fb2e[_0xbfc9('0xd1')]};})['value']()};return ejs[_0xbfc9('0xe7')](path['join'](config[_0xbfc9('0xc6')],'server',_0xbfc9('0xe8'),'downloadInteraction.ejs'),{'interaction':_0x1b3494})[_0xbfc9('0x37')](function(_0x4dffef){var _0x2a5a87=path[_0xbfc9('0xc5')](_0x2f50f5,_0xbfc9('0xe9')+_0x2767e8['id']+'-'+_0x5222da+_0xbfc9('0xea'));var _0x5b773d={'path':_0x2a5a87,'channel':_0xbfc9('0xd6'),'interactionId':_0x2767e8['id']};return pdf['createPdfFromHTML'](_0x4dffef,_0x5b773d);})[_0xbfc9('0x37')](function(){return new BPromise(function(_0x176d93,_0x1eea4f){zipdir(_0x2f50f5,{'saveTo':_0xcd3a61},function(_0x32580e,_0x5a79de){if(_0x32580e)return _0x1eea4f(_0x32580e);return _0x176d93(_0x5a79de);});})[_0xbfc9('0x37')](function(){return new BPromise(function(_0x2772d5,_0x4c8207){rimraf(_0x2f50f5,function(_0xf5f493){if(_0xf5f493)_0x4c8207(_0xf5f493);return _0x2772d5();});});})[_0xbfc9('0x37')](function(){return _0x1ea78d['download'](_0xcd3a61,_0x32ce9a,function(_0x269e55){if(_0x269e55){console[_0xbfc9('0xeb')](_0xbfc9('0xec'),_0x269e55);}else{fs[_0xbfc9('0xed')](_0xcd3a61);}});});});}else{return _0x1ea78d[_0xbfc9('0x2e')](0xc8);}})[_0xbfc9('0x38')](handleError(_0x1ea78d,null));}; \ No newline at end of file +var _0x6fbc=['Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','params','includeAll','include','options','create','update','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','read','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','waiting','talking','answered','unmanaged','closed','UserId','total','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','from','user_has_openchannel_interactions','left_join','users','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200'];(function(_0x2ba5c7,_0x405926){var _0x4b8dab=function(_0x5c1286){while(--_0x5c1286){_0x2ba5c7['push'](_0x2ba5c7['shift']());}};_0x4b8dab(++_0x405926);}(_0x6fbc,0x8b));var _0xc6fb=function(_0x418a69,_0x75e7fc){_0x418a69=_0x418a69-0x0;var _0x201897=_0x6fbc[_0x418a69];return _0x201897;};'use strict';var emlformat=require(_0xc6fb('0x0'));var rimraf=require(_0xc6fb('0x1'));var zipdir=require(_0xc6fb('0x2'));var jsonpatch=require(_0xc6fb('0x3'));var rp=require('request-promise');var moment=require(_0xc6fb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc6fb('0x5'));var util=require(_0xc6fb('0x6'));var path=require(_0xc6fb('0x7'));var sox=require(_0xc6fb('0x8'));var csv=require('to-csv');var ejs=require(_0xc6fb('0x9'));var fs=require('fs');var fs_extra=require(_0xc6fb('0xa'));var _=require(_0xc6fb('0xb'));var squel=require(_0xc6fb('0xc'));var crypto=require(_0xc6fb('0xd'));var jsforce=require(_0xc6fb('0xe'));var deskjs=require(_0xc6fb('0xf'));var toCsv=require(_0xc6fb('0x10'));var querystring=require(_0xc6fb('0x11'));var Papa=require(_0xc6fb('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc6fb('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xc6fb('0x14'));var hardwareService=require(_0xc6fb('0x15'));var logger=require(_0xc6fb('0x16'))('api');var utils=require(_0xc6fb('0x17'));var config=require(_0xc6fb('0x18'));var licenseUtil=require(_0xc6fb('0x19'));var db=require(_0xc6fb('0x1a'))['db'];config[_0xc6fb('0x1b')]=_[_0xc6fb('0x1c')](config[_0xc6fb('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6fb('0x1d'))(new Redis(config[_0xc6fb('0x1b')]));require(_0xc6fb('0x1e'))[_0xc6fb('0x1f')](socket);function respondWithStatusCode(_0x3d757c,_0x52bc7e){_0x52bc7e=_0x52bc7e||0xcc;return function(_0x4d5f01){if(_0x4d5f01){return _0x3d757c[_0xc6fb('0x20')](_0x52bc7e);}return _0x3d757c[_0xc6fb('0x21')](_0x52bc7e)[_0xc6fb('0x22')]();};}function respondWithResult(_0x181018,_0x295fa7){_0x295fa7=_0x295fa7||0xc8;return function(_0x2c2035){if(_0x2c2035){return _0x181018['status'](_0x295fa7)[_0xc6fb('0x23')](_0x2c2035);}};}function respondWithFilteredResult(_0x55ab04,_0x33fec5){return function(_0xf099ad){if(_0xf099ad){var _0x179f74=typeof _0x33fec5[_0xc6fb('0x24')]===_0xc6fb('0x25')&&typeof _0x33fec5[_0xc6fb('0x26')]==='undefined';var _0x4c2193=_0xf099ad[_0xc6fb('0x27')];var _0x22ab73=_0x179f74?0x0:_0x33fec5[_0xc6fb('0x24')];var _0x32d3c3=_0x179f74?_0xf099ad['count']:_0x33fec5[_0xc6fb('0x24')]+_0x33fec5[_0xc6fb('0x26')];var _0x37582d;if(_0x32d3c3>=_0x4c2193){_0x32d3c3=_0x4c2193;_0x37582d=0xc8;}else{_0x37582d=0xce;}_0x55ab04[_0xc6fb('0x21')](_0x37582d);return _0x55ab04['set'](_0xc6fb('0x28'),_0x22ab73+'-'+_0x32d3c3+'/'+_0x4c2193)['json'](_0xf099ad);}return null;};}function patchUpdates(_0x56ec74){return function(_0x4b6197){try{jsonpatch[_0xc6fb('0x29')](_0x4b6197,_0x56ec74,!![]);}catch(_0x1d7d22){return BPromise[_0xc6fb('0x2a')](_0x1d7d22);}return _0x4b6197['save']();};}function saveUpdates(_0x590830,_0x483a71){return function(_0x54de15){if(_0x54de15){return _0x54de15['update'](_0x590830)['then'](function(_0x767876){return _0x767876;});}return null;};}function removeEntity(_0x2fc2a5,_0x2398d7){return function(_0x17a437){if(_0x17a437){return _0x17a437['destroy']()[_0xc6fb('0x2b')](function(){_0x2fc2a5[_0xc6fb('0x21')](0xcc)[_0xc6fb('0x22')]();});}};}function handleEntityNotFound(_0x36c9d9,_0x59a836){return function(_0x458102){if(!_0x458102){_0x36c9d9[_0xc6fb('0x20')](0x194);}return _0x458102;};}function handleError(_0x4ef7e6,_0x44f884){_0x44f884=_0x44f884||0x1f4;return function(_0x1b7b3c){logger[_0xc6fb('0x2c')](_0x1b7b3c[_0xc6fb('0x2d')]);if(_0x1b7b3c[_0xc6fb('0x2e')]){delete _0x1b7b3c[_0xc6fb('0x2e')];}_0x4ef7e6[_0xc6fb('0x21')](_0x44f884)[_0xc6fb('0x2f')](_0x1b7b3c);};}function getInteractionUsers(_0x3fd1f6,_0x4fdc12){return new BPromise(function(_0x133b0f,_0x356930){try{if(_0x4fdc12[_0x3fd1f6['id']]){_0x3fd1f6[_0xc6fb('0x30')]=_[_0xc6fb('0x31')](_0x4fdc12[_0x3fd1f6['id']],function(_0x4cc552){return{'id':_0x4cc552['id'],'fullname':_0x4cc552[_0xc6fb('0x32')]};});}}catch(_0x1e405d){_0x356930(_0x1e405d);}_0x133b0f(_0x3fd1f6);});}function getInteractionTags(_0x10c7d4,_0x43c127){return new BPromise(function(_0x3d9935,_0x5c6209){try{if(_0x10c7d4[_0xc6fb('0x33')]){_0x10c7d4[_0xc6fb('0x34')]=[];_0x10c7d4[_0xc6fb('0x33')][_0xc6fb('0x35')](',')['forEach'](function(_0x5cbe54){_0x10c7d4[_0xc6fb('0x34')][_0xc6fb('0x36')](_0x43c127[_0x5cbe54]);});}delete _0x10c7d4[_0xc6fb('0x33')];}catch(_0x545763){_0x5c6209(_0x545763);}_0x3d9935(_0x10c7d4);});}function updateOpenchannelInteraction(_0x511878,_0x364827,_0x9976ad){return new BPromise(function(_0x45bb0d,_0x50b2e3){return getInteractionUsers(_0x511878,_0x9976ad)[_0xc6fb('0x2b')](function(_0x1817f8){return getInteractionTags(_0x1817f8,_0x364827);})[_0xc6fb('0x2b')](function(_0x8fe7f0){return getStateInteraction(_0x8fe7f0);})['then'](function(_0x5b43a5){_0x45bb0d(_0x5b43a5);})[_0xc6fb('0x37')](function(_0x44ce50){_0x50b2e3(_0x44ce50);});});}function getStateInteraction(_0x37a1fa){return new BPromise(function(_0xda0d78){_0x37a1fa[_0xc6fb('0x38')]=0x0;_0x37a1fa[_0xc6fb('0x39')]=0x0;_0x37a1fa[_0xc6fb('0x3a')]=0x0;_0x37a1fa[_0xc6fb('0x3b')]=0x0;_0x37a1fa['total']=0x0;if(!_0x37a1fa[_0xc6fb('0x3c')]&&!_0x37a1fa['UserId']){_0x37a1fa[_0xc6fb('0x38')]+=0x1;}if(!_0x37a1fa[_0xc6fb('0x3c')]&&_0x37a1fa['UserId']){_0x37a1fa[_0xc6fb('0x39')]+=0x1;if(_0x37a1fa[_0xc6fb('0x38')]){_0x37a1fa[_0xc6fb('0x38')]-=0x1;}}if(_0x37a1fa[_0xc6fb('0x3c')]&&_0x37a1fa[_0xc6fb('0x3d')]){_0x37a1fa[_0xc6fb('0x3a')]+=0x1;if(_0x37a1fa[_0xc6fb('0x39')]){_0x37a1fa[_0xc6fb('0x39')]-=0x1;}}if(_0x37a1fa['closed']&&!_0x37a1fa[_0xc6fb('0x3d')]){_0x37a1fa[_0xc6fb('0x3b')]+=0x1;if(_0x37a1fa[_0xc6fb('0x38')]){_0x37a1fa[_0xc6fb('0x38')]-=0x1;}}_0x37a1fa[_0xc6fb('0x3e')]+=0x1;_0xda0d78(_0x37a1fa);});}exports[_0xc6fb('0x3f')]=function(_0x5a6a1e,_0x10d2fa){var _0x368bf4={},_0x188475={},_0xaa1909={'count':0x0,'rows':[]};var _0x5e74df=_[_0xc6fb('0x31')](db[_0xc6fb('0x40')][_0xc6fb('0x41')],function(_0x10cae9){return{'name':_0x10cae9[_0xc6fb('0x42')],'type':_0x10cae9[_0xc6fb('0x43')][_0xc6fb('0x44')]};});_0x188475[_0xc6fb('0x45')]=_[_0xc6fb('0x31')](_0x5e74df,_0xc6fb('0x2e'));_0x188475[_0xc6fb('0x46')]=_[_0xc6fb('0x47')](_0x5a6a1e[_0xc6fb('0x46')]);_0x188475[_0xc6fb('0x48')]=_['intersection'](_0x188475[_0xc6fb('0x45')],_0x188475[_0xc6fb('0x46')]);_0x368bf4[_0xc6fb('0x49')]=_[_0xc6fb('0x4a')](_0x188475[_0xc6fb('0x45')],qs['fields'](_0x5a6a1e[_0xc6fb('0x46')][_0xc6fb('0x4b')]));_0x368bf4['attributes']=_0x368bf4['attributes'][_0xc6fb('0x4c')]?_0x368bf4[_0xc6fb('0x49')]:_0x188475[_0xc6fb('0x45')];if(!_0x5a6a1e[_0xc6fb('0x46')][_0xc6fb('0x4d')]('nolimit')){_0x368bf4[_0xc6fb('0x26')]=qs['limit'](_0x5a6a1e[_0xc6fb('0x46')]['limit']);_0x368bf4[_0xc6fb('0x24')]=qs[_0xc6fb('0x24')](_0x5a6a1e['query']['offset']);}_0x368bf4[_0xc6fb('0x4e')]=qs[_0xc6fb('0x4f')](_0x5a6a1e[_0xc6fb('0x46')]['sort']);_0x368bf4[_0xc6fb('0x50')]=qs[_0xc6fb('0x48')](_[_0xc6fb('0x51')](_0x5a6a1e[_0xc6fb('0x46')],_0x188475[_0xc6fb('0x48')]),_0x5e74df);var _0x5d4334=[];var _0x1a9195=squel[_0xc6fb('0x52')]()[_0xc6fb('0x53')]('id')[_0xc6fb('0x53')](_0xc6fb('0x2e'))[_0xc6fb('0x53')](_0xc6fb('0x54'))['from'](_0xc6fb('0x55'));var _0x1a98fa=squel['select']()[_0xc6fb('0x53')](_0xc6fb('0x56'))['field'](_0xc6fb('0x57'))[_0xc6fb('0x53')]('ui.OpenchannelInteractionId')[_0xc6fb('0x58')](_0xc6fb('0x59'),'ui')[_0xc6fb('0x5a')](_0xc6fb('0x5b'),'u','u.id\x20=\x20ui.UserId');var _0x460a2e=squel[_0xc6fb('0x52')]()[_0xc6fb('0x58')]('openchannel_interactions','i')['left_join'](_0xc6fb('0x5c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xc6fb('0x5b'),'o',_0xc6fb('0x5d'))[_0xc6fb('0x5a')]('openchannel_accounts','a',_0xc6fb('0x5e'))[_0xc6fb('0x5a')]('openchannel_messages','me',_0xc6fb('0x5f'))['left_join'](_0xc6fb('0x60'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0xc6fb('0x61'));var _0x2a7db7=squel[_0xc6fb('0x62')]();var _0x42c177=[];var _0x532cca=squel[_0xc6fb('0x62')]();var _0x119e2c;if(_0x5a6a1e['query'][_0xc6fb('0x63')]){_0x119e2c=as[_0xc6fb('0x64')](_0x5a6a1e[_0xc6fb('0x46')][_0xc6fb('0x63')]);var _0x4655d7=_0x119e2c[_0xc6fb('0x65')];for(var _0x20a501=0x0;_0x20a501<_0x119e2c['conditions'][_0xc6fb('0x4c')];_0x20a501++){var _0x3c6237=_0x119e2c[_0xc6fb('0x66')][_0x20a501];var _0x3fd2f9='i';var _0xa7c810=_[_0xc6fb('0x67')](_0x5e74df,[_0xc6fb('0x2e'),_0x3c6237[_0xc6fb('0x53')]]);if(!_0xa7c810){switch(_0x3c6237[_0xc6fb('0x53')]){case _0xc6fb('0x68'):if(_0x3c6237[_0xc6fb('0x69')]==0x1){_0x460a2e[_0xc6fb('0x6a')]('`'+_0x3c6237[_0xc6fb('0x53')]+_0xc6fb('0x6b'));}else{_0x460a2e[_0xc6fb('0x6a')]('`'+_0x3c6237[_0xc6fb('0x53')]+_0xc6fb('0x6c'));}break;case _0xc6fb('0x6d'):if(_0x3c6237['operator']===_0xc6fb('0x6e')){if(_0x3c6237[_0xc6fb('0x69')][_0xc6fb('0x35')]('\x20')[_0xc6fb('0x4c')]>0x1){_0x2a7db7[_0x4655d7](_0xc6fb('0x6f'),qs['getFullTextValue'](_0x3c6237[_0xc6fb('0x69')]),null);}else{var _0x303d31='%'+_0x3c6237[_0xc6fb('0x69')]+'%';_0x2a7db7[_0x4655d7](_0xc6fb('0x70'),_0x303d31,_0x303d31,_0x303d31);}}else{_0xa7c810=_[_0xc6fb('0x67')](_0x5e74df,['name',_0xc6fb('0x71')]);_0x3c6237[_0xc6fb('0x53')]='ContactId';_0x168f0a=as[_0xc6fb('0x72')](_0x3fd2f9,_0xa7c810['type'],_0x3c6237);_0x2a7db7[_0x4655d7](_0x168f0a[_0xc6fb('0x73')],_0x168f0a[_0xc6fb('0x69')][_0xc6fb('0x74')],_0x168f0a['value'][_0xc6fb('0x22')]);}break;case _0xc6fb('0x75'):var _0x462017=_0x3c6237[_0xc6fb('0x69')][_0xc6fb('0x35')](',')[_0xc6fb('0x31')](function(_0x1aa215){return Number(_0x1aa215);});_0x462017[_0xc6fb('0x76')](function(_0xfe9ed6){_0x532cca['or'](_0xc6fb('0x77'),'%,'+_0xfe9ed6+',%');});_0x42c177=_[_0xc6fb('0x78')](_0x42c177,_0x462017);break;case _0xc6fb('0x79'):if(_0x3c6237[_0xc6fb('0x7a')]===_0xc6fb('0x6e')){_0x2a7db7[_0x4655d7]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3c6237[_0xc6fb('0x69')]+'%',null);}else{_0xa7c810=_['find'](_0x5e74df,[_0xc6fb('0x2e'),_0xc6fb('0x3d')]);_0x3c6237[_0xc6fb('0x53')]=_0xc6fb('0x3d');_0x168f0a=as[_0xc6fb('0x72')](_0x3fd2f9,_0xa7c810[_0xc6fb('0x43')],_0x3c6237);_0x2a7db7[_0x4655d7](_0x168f0a[_0xc6fb('0x73')],_0x168f0a['value'][_0xc6fb('0x74')],_0x168f0a[_0xc6fb('0x69')][_0xc6fb('0x22')]);}break;case _0xc6fb('0x7b'):_0x168f0a=as[_0xc6fb('0x72')]('me',null,_0x3c6237);_0x2a7db7[_0x4655d7](_0x168f0a[_0xc6fb('0x73')],_0x168f0a[_0xc6fb('0x69')]['start'],_0x168f0a[_0xc6fb('0x69')]['end']);break;}}else{var _0x168f0a=as[_0xc6fb('0x72')](_0x3fd2f9,_0xa7c810[_0xc6fb('0x43')],_0x3c6237);_0x2a7db7[_0x4655d7](_0x168f0a[_0xc6fb('0x73')],_0x168f0a[_0xc6fb('0x69')][_0xc6fb('0x74')],_0x168f0a['value'][_0xc6fb('0x22')]);}}}else{var _0x5be5ac=_(_0x5a6a1e[_0xc6fb('0x46')])[_0xc6fb('0x47')]()[_0xc6fb('0x31')](function(_0x297232){return _[_0xc6fb('0x7c')](_0x5e74df,[_0xc6fb('0x2e'),_0x297232])?_0x297232:undefined;})[_0xc6fb('0x7d')]()[_0xc6fb('0x69')]();if(!_['isEmpty'](_0x5be5ac)){_0x5be5ac['forEach'](function(_0x44573b){if(_0x44573b===_0xc6fb('0x7e')){_0x460a2e[_0xc6fb('0x50')](_0xc6fb('0x7f'),[][_0xc6fb('0x80')](_0x5a6a1e[_0xc6fb('0x46')][_0x44573b]));}else if(_0x44573b===_0xc6fb('0x81')){var _0x590fd3=JSON[_0xc6fb('0x82')](_0x5a6a1e[_0xc6fb('0x46')][_0x44573b])[_0xc6fb('0x83')];var _0x337874=JSON[_0xc6fb('0x82')](_0x5a6a1e[_0xc6fb('0x46')][_0x44573b])[_0xc6fb('0x84')];_0x460a2e[_0xc6fb('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x590fd3,_0x337874);}else{if(_0x5a6a1e[_0xc6fb('0x46')][_0x44573b]==='null'){_0x460a2e[_0xc6fb('0x50')]('i.'+_0x44573b+_0xc6fb('0x85'));}else{_0x460a2e['where']('i.'+_0x44573b+'\x20=\x20?',_0x5a6a1e[_0xc6fb('0x46')][_0x44573b]);}}});}if(_0x5a6a1e['query']['read']){if(_0x5a6a1e['query']['read']==0x1){_0x460a2e[_0xc6fb('0x6a')](_0xc6fb('0x86'));}else{_0x460a2e[_0xc6fb('0x6a')](_0xc6fb('0x87'));}}if(_0x5a6a1e['query'][_0xc6fb('0x88')]){_0x42c177=_[_0xc6fb('0x89')](_0x5a6a1e[_0xc6fb('0x46')][_0xc6fb('0x88')])?_0x5a6a1e[_0xc6fb('0x46')][_0xc6fb('0x88')]:new Array(_0x5a6a1e[_0xc6fb('0x46')]['tag']);_0x42c177['forEach'](function(_0x340dcf){_0x532cca['or'](_0xc6fb('0x77'),'%,'+_0x340dcf+',%');});}if(_0x5a6a1e[_0xc6fb('0x46')]['filter']){var _0x66f1d7=_0x5a6a1e[_0xc6fb('0x46')][_0xc6fb('0x8a')][_0xc6fb('0x8b')]('\x5c','\x5c\x5c')[_0xc6fb('0x8b')](/'/g,'\x27\x27');if(qs[_0xc6fb('0x8c')](_0x66f1d7)){_0x2a7db7['or'](_0xc6fb('0x8d'),_0x66f1d7+'%');}else{_0x2a7db7['or'](_0xc6fb('0x8e'),qs[_0xc6fb('0x8f')](_0x66f1d7))['or'](_0xc6fb('0x90'),_0x66f1d7+'%')['or'](_0xc6fb('0x91'),_0x66f1d7+'%');}}}_0x460a2e[_0xc6fb('0x50')](_0x2a7db7);_0x460a2e[_0xc6fb('0x92')](_0xc6fb('0x93'));var _0x4c0da0={'type':db[_0xc6fb('0x94')]['QueryTypes']['SELECT'],'raw':!![]};var _0x529534=_0x460a2e[_0xc6fb('0x95')]();_0x529534['field'](_0xc6fb('0x93'));_0x529534[_0xc6fb('0x53')](_0xc6fb('0x96'),_0xc6fb('0x68'));if(_0x368bf4['order']){_0x368bf4[_0xc6fb('0x4e')][_0xc6fb('0x76')](function(_0x58e6eb){var _0x48d7e1=_0x58e6eb[0x0]===_0xc6fb('0x97')?_0x58e6eb[0x0]:'i.'+_0x58e6eb[0x0];_0x460a2e[_0xc6fb('0x4e')](_0x48d7e1,_0x58e6eb[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc6fb('0x98')](_0x42c177)){_0x460a2e[_0xc6fb('0x6a')](_0x532cca);_0x529534[_0xc6fb('0x50')](_0xc6fb('0x99'),_0x42c177);}BPromise[_0xc6fb('0x9a')]()[_0xc6fb('0x2b')](function(){if(!_0x119e2c){if(_0x5a6a1e['query']['OpenchannelAccountId'])return;_0x529534[_0xc6fb('0x50')](_0xc6fb('0x9b'));_0x460a2e[_0xc6fb('0x50')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5a6a1e[_0xc6fb('0x9c')][_0xc6fb('0x9d')]!==_0xc6fb('0x9e'))return;return _0x5a6a1e[_0xc6fb('0x9c')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xc6fb('0x2b')](function(_0x44b744){if(_[_0xc6fb('0x98')](_0x44b744)){_0x529534[_0xc6fb('0x50')](_0xc6fb('0x9f'));_0x460a2e[_0xc6fb('0x50')](_0xc6fb('0x9f'));}else{_0x529534[_0xc6fb('0x50')](_0xc6fb('0x7f'),_[_0xc6fb('0x31')](_0x44b744,'id'));_0x460a2e[_0xc6fb('0x50')](_0xc6fb('0x7f'),_[_0xc6fb('0x31')](_0x44b744,'id'));}});})[_0xc6fb('0x2b')](function(){if(_0x5a6a1e[_0xc6fb('0x9c')][_0xc6fb('0x9d')]==='agent'&&!_0x119e2c&&!_0x5a6a1e[_0xc6fb('0x46')][_0xc6fb('0x7e')])return[];return db[_0xc6fb('0xa0')][_0xc6fb('0x46')](_0x529534[_0xc6fb('0xa1')](),_0x4c0da0);})[_0xc6fb('0x2b')](function(_0x378d69){_0xaa1909[_0xc6fb('0x27')]=_0x378d69['length'];if(_0xaa1909[_0xc6fb('0x27')]===0x0)return[];return db[_0xc6fb('0xa0')][_0xc6fb('0x46')](_0x1a9195[_0xc6fb('0xa1')](),_0x4c0da0)[_0xc6fb('0x2b')](function(_0x5938e3){_0x5d4334=_[_0xc6fb('0xa2')](_0x5938e3,'id');_0x4c0da0=_[_0xc6fb('0xa3')](_0x4c0da0,{'model':db[_0xc6fb('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a6a1e[_0xc6fb('0x46')][_0xc6fb('0x4b')]){_0x368bf4[_0xc6fb('0x49')][_0xc6fb('0x76')](function(_0x4338ee){_0x460a2e['field']('i.'+_0x4338ee);});}else{_0x460a2e[_0xc6fb('0x53')](_0xc6fb('0x96'),_0xc6fb('0x68'));_0x460a2e[_0xc6fb('0x53')](_0xc6fb('0xa4'),_0xc6fb('0xa5'));_0x460a2e['field'](_0xc6fb('0xa6'),'Account.mandatoryDisposition');_0x460a2e['field'](_0xc6fb('0xa7'),_0xc6fb('0x97'));_0x460a2e[_0xc6fb('0x53')](_0xc6fb('0xa8'));_0x460a2e[_0xc6fb('0x53')]('c.firstName',_0xc6fb('0xa9'));_0x460a2e[_0xc6fb('0x53')](_0xc6fb('0xaa'),_0xc6fb('0xab'));_0x460a2e[_0xc6fb('0x53')]('c.email',_0xc6fb('0xac'));_0x460a2e[_0xc6fb('0x53')]('c.phone',_0xc6fb('0xad'));_0x460a2e[_0xc6fb('0x53')](_0xc6fb('0xae'),_0xc6fb('0xaf'));_0x460a2e[_0xc6fb('0x53')]('c.fax',_0xc6fb('0xb0'));_0x460a2e['field'](_0xc6fb('0xb1'),_0xc6fb('0xb2'));_0x460a2e[_0xc6fb('0x53')](_0xc6fb('0xb3'),_0xc6fb('0xb4'));_0x460a2e[_0xc6fb('0x53')](_0xc6fb('0xb5'),_0xc6fb('0x33'));}if(_0x368bf4[_0xc6fb('0x26')])_0x460a2e[_0xc6fb('0x26')](_0x368bf4[_0xc6fb('0x26')]);if(_0x368bf4[_0xc6fb('0x24')])_0x460a2e[_0xc6fb('0x24')](_0x368bf4[_0xc6fb('0x24')]);return db[_0xc6fb('0xa0')][_0xc6fb('0x46')](_0x460a2e[_0xc6fb('0xa1')](),_0x4c0da0);})[_0xc6fb('0x2b')](function(_0x332718){if(_0x332718[_0xc6fb('0x4c')]>0x0)_0x1a98fa[_0xc6fb('0x50')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xc6fb('0x31')](_0x332718,'id'));return db[_0xc6fb('0xa0')][_0xc6fb('0x46')](_0x1a98fa[_0xc6fb('0xa1')](),_0x4c0da0)[_0xc6fb('0x2b')](function(_0x2d2e55){var _0x34e884=_[_0xc6fb('0xb6')](_0x2d2e55,_0xc6fb('0xb7'));var _0x385dbf=[];_0x332718[_0xc6fb('0x76')](function(_0x175d22){_0x385dbf[_0xc6fb('0x36')](updateOpenchannelInteraction(_0x175d22,_0x5d4334,_0x34e884));});return BPromise[_0xc6fb('0xb8')](_0x385dbf);});});})[_0xc6fb('0x2b')](function(_0x2a7d6d){_0xaa1909['rows']=_0x2a7d6d;return _0xaa1909;})[_0xc6fb('0x2b')](respondWithFilteredResult(_0x10d2fa,_0x368bf4))[_0xc6fb('0x37')](handleError(_0x10d2fa,null));};exports['show']=function(_0x50e4af,_0x30fe41){var _0x4e9332={};if(_0x50e4af[_0xc6fb('0x46')][_0xc6fb('0x43')]&&_0x50e4af[_0xc6fb('0x46')]['type']===_0xc6fb('0x58')){_0x4e9332[_0xc6fb('0x58')]=_0x50e4af[_0xc6fb('0xb9')]['id'];}else{_0x4e9332['id']=_0x50e4af[_0xc6fb('0xb9')]['id'];}var _0x41e00f={'raw':![],'where':_0x4e9332},_0x521e64={};_0x521e64[_0xc6fb('0x45')]=_[_0xc6fb('0x47')](db[_0xc6fb('0x40')]['rawAttributes']);_0x521e64[_0xc6fb('0x46')]=_[_0xc6fb('0x47')](_0x50e4af[_0xc6fb('0x46')]);_0x521e64[_0xc6fb('0x48')]=_[_0xc6fb('0x4a')](_0x521e64[_0xc6fb('0x45')],_0x521e64[_0xc6fb('0x46')]);_0x41e00f[_0xc6fb('0x49')]=_[_0xc6fb('0x4a')](_0x521e64[_0xc6fb('0x45')],qs['fields'](_0x50e4af[_0xc6fb('0x46')][_0xc6fb('0x4b')]));_0x41e00f['attributes']=_0x41e00f[_0xc6fb('0x49')][_0xc6fb('0x4c')]?_0x41e00f['attributes']:_0x521e64[_0xc6fb('0x45')];if(_0x50e4af[_0xc6fb('0x46')][_0xc6fb('0xba')]){_0x41e00f[_0xc6fb('0xbb')]=[{'all':!![]}];}_0x41e00f=_[_0xc6fb('0xa3')]({},_0x41e00f,_0x50e4af[_0xc6fb('0xbc')]);return db[_0xc6fb('0x40')][_0xc6fb('0x67')](_0x41e00f)[_0xc6fb('0x2b')](handleEntityNotFound(_0x30fe41,null))[_0xc6fb('0x2b')](respondWithResult(_0x30fe41,null))[_0xc6fb('0x37')](handleError(_0x30fe41,null));};exports[_0xc6fb('0xbd')]=function(_0x4f7262,_0x49164b){return db['OpenchannelInteraction'][_0xc6fb('0xbd')](_0x4f7262[_0xc6fb('0x7b')],{})[_0xc6fb('0x2b')](respondWithResult(_0x49164b,0xc9))[_0xc6fb('0x37')](handleError(_0x49164b,null));};exports[_0xc6fb('0xbe')]=function(_0x4e9fb7,_0x1a7d3a){if(_0x4e9fb7[_0xc6fb('0x7b')]['id']){delete _0x4e9fb7[_0xc6fb('0x7b')]['id'];}return db[_0xc6fb('0x40')]['find']({'where':{'id':_0x4e9fb7['params']['id']}})['then'](handleEntityNotFound(_0x1a7d3a,null))[_0xc6fb('0x2b')](saveUpdates(_0x4e9fb7[_0xc6fb('0x7b')],null))[_0xc6fb('0x2b')](respondWithResult(_0x1a7d3a,null))[_0xc6fb('0x37')](handleError(_0x1a7d3a,null));};exports[_0xc6fb('0xbf')]=function(_0x2ecfa8,_0x5e474a){return db[_0xc6fb('0x40')][_0xc6fb('0x67')]({'where':{'id':_0x2ecfa8[_0xc6fb('0xb9')]['id']}})[_0xc6fb('0x2b')](handleEntityNotFound(_0x5e474a,null))[_0xc6fb('0x2b')](removeEntity(_0x5e474a,null))[_0xc6fb('0x37')](handleError(_0x5e474a,null));};exports[_0xc6fb('0xc0')]=function(_0x1daf0e,_0xe4b0cd){return db[_0xc6fb('0x40')][_0xc6fb('0xc0')]()[_0xc6fb('0x2b')](respondWithResult(_0xe4b0cd,null))[_0xc6fb('0x37')](handleError(_0xe4b0cd,null));};exports[_0xc6fb('0xc1')]=function(_0x41284e,_0x2b58c8,_0x4510da){return db[_0xc6fb('0xc2')][_0xc6fb('0x67')]({'where':{'id':_0x41284e[_0xc6fb('0xb9')]['id']}})['then'](handleEntityNotFound(_0x2b58c8,null))[_0xc6fb('0x2b')](function(_0x34ad65){if(_0x34ad65){return _0x34ad65['addMessage'](_0x41284e[_0xc6fb('0x7b')][_0xc6fb('0xc3')],_[_0xc6fb('0xc4')](_0x41284e[_0xc6fb('0x7b')],[_0xc6fb('0xc3'),'id'])||{});}})[_0xc6fb('0x2b')](respondWithResult(_0x2b58c8,null))['catch'](handleError(_0x2b58c8,null));};exports[_0xc6fb('0xc5')]=function(_0x2f1afc,_0x23c00e,_0x39ec88){var _0x37cd3f={'raw':![],'where':{}};var _0x446d80={};var _0x5e1fa5={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc6fb('0xc6')]({'where':{'id':_0x2f1afc[_0xc6fb('0xb9')]['id']}})['then'](handleEntityNotFound(_0x23c00e,null))[_0xc6fb('0x2b')](function(_0x30fdd9){if(_0x30fdd9){_0x446d80['model']=_[_0xc6fb('0x47')](db[_0xc6fb('0xc2')][_0xc6fb('0x41')]);_0x446d80['query']=_[_0xc6fb('0x47')](_0x2f1afc[_0xc6fb('0x46')]);_0x446d80[_0xc6fb('0x48')]=_[_0xc6fb('0x4a')](_0x446d80[_0xc6fb('0x45')],_0x446d80[_0xc6fb('0x46')]);_0x37cd3f['attributes']=_['intersection'](_0x446d80[_0xc6fb('0x45')],qs[_0xc6fb('0x4b')](_0x2f1afc['query'][_0xc6fb('0x4b')]));_0x37cd3f[_0xc6fb('0x49')]=_0x37cd3f['attributes'][_0xc6fb('0x4c')]?_0x37cd3f[_0xc6fb('0x49')]:_0x446d80[_0xc6fb('0x45')];if(!_0x2f1afc['query'][_0xc6fb('0x4d')](_0xc6fb('0xc7'))){_0x37cd3f[_0xc6fb('0x26')]=qs[_0xc6fb('0x26')](_0x2f1afc[_0xc6fb('0x46')][_0xc6fb('0x26')]);_0x37cd3f['offset']=qs[_0xc6fb('0x24')](_0x2f1afc[_0xc6fb('0x46')][_0xc6fb('0x24')]);}_0x37cd3f[_0xc6fb('0x4e')]=qs[_0xc6fb('0x4f')](_0x2f1afc[_0xc6fb('0x46')][_0xc6fb('0x4f')]);_0x37cd3f['where']=qs[_0xc6fb('0x48')](_[_0xc6fb('0x51')](_0x2f1afc['query'],_0x446d80[_0xc6fb('0x48')]));_0x37cd3f[_0xc6fb('0x50')][_0xc6fb('0xb7')]=_0x30fdd9['id'];if(_0x2f1afc[_0xc6fb('0x46')][_0xc6fb('0x8a')]){_0x37cd3f[_0xc6fb('0x50')]=_[_0xc6fb('0xa3')](_0x37cd3f[_0xc6fb('0x50')],{'$or':_[_0xc6fb('0x31')](_0x37cd3f[_0xc6fb('0x49')],function(_0x48cada){var _0x404a64={};_0x404a64[_0x48cada]={'$like':'%'+_0x2f1afc[_0xc6fb('0x46')][_0xc6fb('0x8a')]+'%'};return _0x404a64;})});}if(_0x2f1afc[_0xc6fb('0x46')][_0xc6fb('0x83')]){var _0x45cedf=_0x2f1afc[_0xc6fb('0x46')][_0xc6fb('0x83')][_0xc6fb('0x35')](',');var _0x2352dc={};_0x2352dc[_0x45cedf[0x0]]={'$gte':moment(_0x45cedf[0x1])[_0xc6fb('0xc8')](_0xc6fb('0xc9'))};_0x37cd3f[_0xc6fb('0x50')]=_[_0xc6fb('0xa3')](_0x37cd3f[_0xc6fb('0x50')],_0x2352dc);}_0x37cd3f=_[_0xc6fb('0xa3')]({},_0x37cd3f,_0x2f1afc[_0xc6fb('0xbc')]);return db[_0xc6fb('0xc2')][_0xc6fb('0x27')]({'where':_0x37cd3f[_0xc6fb('0x50')]})[_0xc6fb('0x2b')](function(_0x30036d){_0x5e1fa5[_0xc6fb('0x27')]=_0x30036d;if(_0x2f1afc[_0xc6fb('0x46')]['includeAll']){_0x37cd3f[_0xc6fb('0xbb')]=[{'all':!![]}];}return db[_0xc6fb('0xc2')][_0xc6fb('0xca')](_0x37cd3f);})['then'](function(_0x38e9aa){_0x5e1fa5['rows']=_0x38e9aa;return _0x5e1fa5;});}})['then'](respondWithFilteredResult(_0x23c00e,_0x37cd3f))[_0xc6fb('0x37')](handleError(_0x23c00e,null));};exports[_0xc6fb('0xcb')]=function(_0x2127aa,_0x56404c,_0x36da4d){return db[_0xc6fb('0x40')][_0xc6fb('0x67')]({'where':{'id':_0x2127aa['params']['id']}})['then'](handleEntityNotFound(_0x56404c,null))[_0xc6fb('0x2b')](function(_0x47f847){if(_0x47f847){return _0x47f847['setTags'](_0x2127aa[_0xc6fb('0x7b')][_0xc6fb('0xc3')],_[_0xc6fb('0xc4')](_0x2127aa[_0xc6fb('0x7b')],[_0xc6fb('0xc3'),'id'])||{})[_0xc6fb('0xcc')](function(){return db[_0xc6fb('0x75')]['findAll']({'attributes':['id',_0xc6fb('0x2e'),_0xc6fb('0x54')],'where':{'id':_0x2127aa[_0xc6fb('0x7b')][_0xc6fb('0xc3')]}});})[_0xc6fb('0x2b')](function(_0x3c07be){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x2127aa[_0xc6fb('0xb9')]['id']),'tags':_0x3c07be||[]});return{'id':Number(_0x2127aa['params']['id']),'tags':_0x3c07be||[]};});}})['then'](respondWithResult(_0x56404c,null))[_0xc6fb('0x37')](handleError(_0x56404c,null));};exports[_0xc6fb('0xcd')]=function(_0x9f0182,_0x446448,_0x53bad3){return db['OpenchannelInteraction']['find']({'where':{'id':_0x9f0182['params']['id']}})[_0xc6fb('0x2b')](handleEntityNotFound(_0x446448,null))[_0xc6fb('0x2b')](function(_0x1369ad){if(_0x1369ad){return _0x1369ad[_0xc6fb('0xcd')](_0x9f0182[_0xc6fb('0x46')][_0xc6fb('0xc3')]);}})[_0xc6fb('0x2b')](respondWithStatusCode(_0x446448,null))['catch'](handleError(_0x446448,null));};exports['download']=function(_0x22323c,_0xb7e352){var _0x317c77=moment()[_0xc6fb('0xce')]()[_0xc6fb('0xa1')]();var _0x5e4c7f=path[_0xc6fb('0xcf')](config[_0xc6fb('0xd0')],_0xc6fb('0xd1'),_0xc6fb('0xd2'),_0xc6fb('0xd3'));var _0x5ad1e0=path[_0xc6fb('0xcf')](config[_0xc6fb('0xd0')],'server',_0xc6fb('0xd2'),_0xc6fb('0xd4'));var _0x305c5f=path['join'](_0x5e4c7f,_0x317c77);var _0x1c7de3=util['format'](_0xc6fb('0xd5'),_0x22323c[_0xc6fb('0xb9')]['id'],_0x317c77);var _0x27906a=path[_0xc6fb('0xcf')](_0x5e4c7f,_0x1c7de3);var _0x18fe9c=[];_0x18fe9c[_0xc6fb('0x36')]({'model':db[_0xc6fb('0x79')],'as':_0xc6fb('0x79'),'attributes':['id','fullname'],'raw':!![]});_0x18fe9c[_0xc6fb('0x36')]({'model':db[_0xc6fb('0xd6')],'as':_0xc6fb('0x6d'),'attributes':['id',_0xc6fb('0xd7'),_0xc6fb('0xd8')],'raw':!![]});if(_0x22323c['query'][_0xc6fb('0xd4')]){_0x18fe9c[_0xc6fb('0x36')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x1c62a1=[{'model':db[_0xc6fb('0xc2')],'as':_0xc6fb('0xd9'),'attributes':['id',_0xc6fb('0x7b'),_0xc6fb('0x81'),_0xc6fb('0xda'),_0xc6fb('0xdb'),'read'],'include':_0x18fe9c}];_0x1c62a1['push']({'model':db[_0xc6fb('0xdc')],'as':_0xc6fb('0xdd'),'attributes':['id',_0xc6fb('0x2e')]});_0x1c62a1['push']({'model':db['User'],'as':_0xc6fb('0xde'),'attributes':['id',_0xc6fb('0x32')]});return db['OpenchannelInteraction'][_0xc6fb('0x67')]({'where':{'id':_0x22323c[_0xc6fb('0xb9')]['id']},'include':_0x1c62a1})['then'](handleEntityNotFound(_0xb7e352,null))[_0xc6fb('0x2b')](function(_0x4dd733){if(_0x4dd733){var _0x4ed250=_0x4dd733[_0xc6fb('0xdf')]({'plain':!![]});fs[_0xc6fb('0xe0')](_0x305c5f);var _0x2eeee8={'channel':_0xc6fb('0xe1'),'account':_0x4ed250[_0xc6fb('0xdd')][_0xc6fb('0x2e')],'agent':_0x4ed250[_0xc6fb('0xde')]?_0x4ed250[_0xc6fb('0xde')]['fullname']:_0xc6fb('0xe2'),'createdAt':moment(_0x4ed250['createdAt'])[_0xc6fb('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x4ed250[_0xc6fb('0x3c')]?moment(_0x4ed250[_0xc6fb('0xe3')])[_0xc6fb('0xc8')](_0xc6fb('0xc9'))[_0xc6fb('0xa1')]():'','disposition':_0x4ed250[_0xc6fb('0xe4')],'visibility':_0x4ed250[_0xc6fb('0xe5')]?_0xc6fb('0xe6'):_0xc6fb('0xe7'),'messages':_(_0x4ed250[_0xc6fb('0xd9')])[_0xc6fb('0x8a')]({'secret':![]})[_0xc6fb('0x31')](function(_0xade91){if(_0xade91[_0xc6fb('0xe8')]){var _0x4d1a62=path[_0xc6fb('0xcf')](_0x5ad1e0,_0xade91[_0xc6fb('0xe8')][_0xc6fb('0xe9')]);if(fs[_0xc6fb('0xea')](_0x4d1a62)){fs[_0xc6fb('0xeb')](_0x4d1a62)[_0xc6fb('0xec')](fs[_0xc6fb('0xed')](path[_0xc6fb('0xcf')](_0x305c5f,_0xade91[_0xc6fb('0xe8')][_0xc6fb('0xe9')])));}}return{'date':moment(_0xade91[_0xc6fb('0x81')])[_0xc6fb('0xc8')](_0xc6fb('0xc9'))[_0xc6fb('0xa1')](),'sender':_0xade91[_0xc6fb('0xda')]===_0xc6fb('0xee')?_0xade91['User']?_0xade91[_0xc6fb('0x79')][_0xc6fb('0x32')]:'System':_0xade91[_0xc6fb('0x6d')][_0xc6fb('0xd7')]+(_0xade91[_0xc6fb('0x6d')][_0xc6fb('0xd8')]?'\x20'+_0xade91[_0xc6fb('0x6d')]['lastName']:''),'body':_0xade91[_0xc6fb('0xe8')]?_0xade91['Attachment']['basename']:_0xade91['body'],'direction':_0xade91['direction']==='out'?'A':'C','secret':_0xade91['secret'],'read':_0xade91[_0xc6fb('0xef')],'attachment':_0xade91[_0xc6fb('0xe8')]};})[_0xc6fb('0x69')]()};return ejs[_0xc6fb('0xf0')](path[_0xc6fb('0xcf')](config['root'],_0xc6fb('0xd1'),'views',_0xc6fb('0xf1')),{'interaction':_0x2eeee8})['then'](function(_0x35f815){var _0x5c5559=path[_0xc6fb('0xcf')](_0x305c5f,_0xc6fb('0xf2')+_0x4ed250['id']+'-'+_0x317c77+_0xc6fb('0xf3'));var _0xe1357e={'path':_0x5c5559,'channel':'Openchannel','interactionId':_0x4ed250['id']};return pdf[_0xc6fb('0xf4')](_0x35f815,_0xe1357e);})[_0xc6fb('0x2b')](function(){return new BPromise(function(_0x558c78,_0x1b17c5){zipdir(_0x305c5f,{'saveTo':_0x27906a},function(_0x45adfc,_0x2778e3){if(_0x45adfc)return _0x1b17c5(_0x45adfc);return _0x558c78(_0x2778e3);});})[_0xc6fb('0x2b')](function(){return new BPromise(function(_0x2bf205,_0x5dd017){rimraf(_0x305c5f,function(_0x378fb3){if(_0x378fb3)_0x5dd017(_0x378fb3);return _0x2bf205();});});})[_0xc6fb('0x2b')](function(){return _0xb7e352[_0xc6fb('0xf5')](_0x27906a,_0x1c7de3,function(_0x221bc2){if(_0x221bc2){console['log'](_0xc6fb('0xf6'),_0x221bc2);}else{fs[_0xc6fb('0xf7')](_0x27906a);}});});});}else{return _0xb7e352[_0xc6fb('0x20')](0xc8);}})[_0xc6fb('0x37')](handleError(_0xb7e352,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e55b8ad..97fa623 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 _0x82f9=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x43bd3c,_0x3bd12d){var _0x1cbb21=function(_0x30d12e){while(--_0x30d12e){_0x43bd3c['push'](_0x43bd3c['shift']());}};_0x1cbb21(++_0x3bd12d);}(_0x82f9,0x7d));var _0x982f=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x82f9[_0x3b5250];return _0xc844a1;};'use strict';var EventEmitter=require(_0x982f('0x0'));var OpenchannelInteraction=require(_0x982f('0x1'))['db'][_0x982f('0x2')];var OpenchannelMessage=require(_0x982f('0x1'))['db'][_0x982f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x982f('0x4')](0x0);var events={'afterCreate':_0x982f('0x5'),'afterUpdate':_0x982f('0x6'),'afterDestroy':_0x982f('0x7')};function emitEvent(_0x314345){return function(_0x2cd5bb,_0x277127,_0x2181af){_0x2cd5bb['getUsers']({'attributes':['id'],'raw':!![]})[_0x982f('0x8')](function(_0x137b38){_0x2cd5bb[_0x982f('0x9')](_0x982f('0xa'),_0x137b38[_0x982f('0xb')](function(_0x880c4c){return{'id':_0x880c4c['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2cd5bb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x982f('0x8')](function(_0x248ac9){_0x2cd5bb[_0x982f('0x9')](_0x982f('0xc'),_0x248ac9[_0x982f('0xd')]);OpenchannelInteractionEvents[_0x982f('0xe')](_0x314345+':'+_0x2cd5bb['id'],_0x2cd5bb);OpenchannelInteractionEvents['emit'](_0x314345,_0x2cd5bb);_0x2181af(null);})[_0x982f('0xf')](_0x2181af(null));};}for(var e in events){if(events[_0x982f('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x982f('0x11')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xa785=['save','remove','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x89f772,_0x45088a){var _0x4857a3=function(_0x19690f){while(--_0x19690f){_0x89f772['push'](_0x89f772['shift']());}};_0x4857a3(++_0x45088a);}(_0xa785,0xaf));var _0x5a78=function(_0x2f32c4,_0x2597ba){_0x2f32c4=_0x2f32c4-0x0;var _0x95b5dc=_0xa785[_0x2f32c4];return _0x95b5dc;};'use strict';var EventEmitter=require(_0x5a78('0x0'));var OpenchannelInteraction=require(_0x5a78('0x1'))['db'][_0x5a78('0x2')];var OpenchannelMessage=require(_0x5a78('0x1'))['db'][_0x5a78('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5a78('0x4')](0x0);var events={'afterCreate':_0x5a78('0x5'),'afterUpdate':'update','afterDestroy':_0x5a78('0x6')};function emitEvent(_0x1aab4b){return function(_0x5307a7,_0x1f11c0,_0x576c16){_0x5307a7[_0x5a78('0x7')]({'attributes':['id'],'raw':!![]})[_0x5a78('0x8')](function(_0x3ec0e2){_0x5307a7[_0x5a78('0x9')](_0x5a78('0xa'),_0x3ec0e2[_0x5a78('0xb')](function(_0x19aa43){return{'id':_0x19aa43['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x5307a7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5a78('0x8')](function(_0x53e92e){_0x5307a7[_0x5a78('0x9')]('unreadMessages',_0x53e92e[_0x5a78('0xc')]);OpenchannelInteractionEvents[_0x5a78('0xd')](_0x1aab4b+':'+_0x5307a7['id'],_0x5307a7);OpenchannelInteractionEvents[_0x5a78('0xd')](_0x1aab4b,_0x5307a7);_0x576c16(null);})[_0x5a78('0xe')](_0x576c16(null));};}for(var e in events){if(events[_0x5a78('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x5a78('0x10')](e,emitEvent(event));}}module[_0x5a78('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 4f95ae4..8d14d55 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 _0x9979=['openchannel_interactions','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','define','OpenchannelInteraction'];(function(_0x311185,_0x2f990b){var _0x27cad3=function(_0xe0119e){while(--_0xe0119e){_0x311185['push'](_0x311185['shift']());}};_0x27cad3(++_0x2f990b);}(_0x9979,0x166));var _0x9997=function(_0x1b24e4,_0x51977b){_0x1b24e4=_0x1b24e4-0x0;var _0x1573fe=_0x9979[_0x1b24e4];return _0x1573fe;};'use strict';var _=require(_0x9997('0x0'));var util=require(_0x9997('0x1'));var logger=require(_0x9997('0x2'))(_0x9997('0x3'));var moment=require(_0x9997('0x4'));var BPromise=require(_0x9997('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9997('0x6'));var rimraf=require('rimraf');var config=require(_0x9997('0x7'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x58765c,_0x573fa9){return _0x58765c[_0x9997('0x8')](_0x9997('0x9'),attributes,{'tableName':_0x9997('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9997('0xb'),'hooks':{'beforeUpdate':function(_0x5a32a2,_0x201228,_0x4a4283){if(_0x5a32a2[_0x9997('0xc')]('closed')){_0x5a32a2[_0x9997('0xd')]=moment()[_0x9997('0xe')](_0x9997('0xf'));}_0x4a4283(null,_0x5a32a2);}}});}; \ No newline at end of file +var _0x0a94=['utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelInteraction.attributes','define'];(function(_0x4684af,_0x34880f){var _0x3bb413=function(_0x600b5a){while(--_0x600b5a){_0x4684af['push'](_0x4684af['shift']());}};_0x3bb413(++_0x34880f);}(_0x0a94,0xf5));var _0x40a9=function(_0x27aa21,_0x4a6a32){_0x27aa21=_0x27aa21-0x0;var _0x431d7b=_0x0a94[_0x27aa21];return _0x431d7b;};'use strict';var _=require(_0x40a9('0x0'));var util=require(_0x40a9('0x1'));var logger=require(_0x40a9('0x2'))(_0x40a9('0x3'));var moment=require(_0x40a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x40a9('0x5'));var fs=require('fs');var path=require(_0x40a9('0x6'));var rimraf=require('rimraf');var config=require(_0x40a9('0x7'));var attributes=require(_0x40a9('0x8'));module['exports']=function(_0x16ec0e,_0x3bd2a1){return _0x16ec0e[_0x40a9('0x9')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x40a9('0xa'),'collate':_0x40a9('0xb'),'hooks':{'beforeUpdate':function(_0x5289f2,_0x7de152,_0x21a452){if(_0x5289f2[_0x40a9('0xc')](_0x40a9('0xd'))){_0x5289f2[_0x40a9('0xe')]=moment()[_0x40a9('0xf')](_0x40a9('0x10'));}_0x21a452(null,_0x5289f2);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3c84fc8..fd40399 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 _0x72b4=['redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','body','options','raw','where','attributes','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5d3379,_0x33e21b){var _0xacfdb4=function(_0x18b910){while(--_0x18b910){_0x5d3379['push'](_0x5d3379['shift']());}};_0xacfdb4(++_0x33e21b);}(_0x72b4,0x19a));var _0x472b=function(_0x4e752e,_0x479543){_0x4e752e=_0x4e752e-0x0;var _0x2392b0=_0x72b4[_0x4e752e];return _0x2392b0;};'use strict';var _=require('lodash');var util=require(_0x472b('0x0'));var moment=require(_0x472b('0x1'));var BPromise=require(_0x472b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x472b('0x3'));var db=require(_0x472b('0x4'))['db'];var utils=require(_0x472b('0x5'));var logger=require(_0x472b('0x6'))('rpc');var config=require(_0x472b('0x7'));var jayson=require(_0x472b('0x8'));var client=jayson[_0x472b('0x9')]['http']({'port':0x232a});config[_0x472b('0xa')]=_[_0x472b('0xb')](config[_0x472b('0xa')],{'host':_0x472b('0xc'),'port':0x18eb});var socket=require(_0x472b('0xd'))(new Redis(config[_0x472b('0xa')]));require(_0x472b('0xe'))[_0x472b('0xf')](socket);function respondWithRpcPromise(_0x725580,_0x4ae6f5,_0x18b8cf){return new BPromise(function(_0x335893,_0x484c6f){return client[_0x472b('0x10')](_0x725580,_0x18b8cf)[_0x472b('0x11')](function(_0x18caba){logger[_0x472b('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4ae6f5,'request\x20sent');logger[_0x472b('0x13')](_0x472b('0x14'),_0x4ae6f5,_0x472b('0x15'),JSON[_0x472b('0x16')](_0x18caba));if(_0x18caba[_0x472b('0x17')]){if(_0x18caba[_0x472b('0x17')][_0x472b('0x18')]===0x1f4){logger[_0x472b('0x17')](_0x472b('0x19'),_0x4ae6f5,_0x18caba['error'][_0x472b('0x1a')]);return _0x484c6f(_0x18caba[_0x472b('0x17')][_0x472b('0x1a')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4ae6f5,_0x18caba['error'][_0x472b('0x1a')]);return _0x335893(_0x18caba[_0x472b('0x17')]['message']);}else{logger[_0x472b('0x12')](_0x472b('0x19'),_0x4ae6f5,'request\x20sent');_0x335893(_0x18caba[_0x472b('0x1b')][_0x472b('0x1a')]);}})[_0x472b('0x1c')](function(_0xe21264){logger[_0x472b('0x17')](_0x472b('0x19'),_0x4ae6f5,_0xe21264);_0x484c6f(_0xe21264);});});}exports['UpdateOpenchannelInteraction']=function(_0x318fdb){var _0x497105=this;return new Promise(function(_0x512911,_0x33e8e0){return db['OpenchannelInteraction']['update'](_0x318fdb[_0x472b('0x1d')],{'raw':_0x318fdb[_0x472b('0x1e')]?_0x318fdb[_0x472b('0x1e')][_0x472b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x318fdb[_0x472b('0x1e')]?_0x318fdb[_0x472b('0x1e')][_0x472b('0x20')]||null:null,'attributes':_0x318fdb['options']?_0x318fdb[_0x472b('0x1e')][_0x472b('0x21')]||null:null,'limit':_0x318fdb['options']?_0x318fdb[_0x472b('0x1e')]['limit']||null:null})[_0x472b('0x11')](function(_0x31b2cb){logger[_0x472b('0x12')](_0x472b('0x22'),_0x318fdb);logger['debug']('UpdateOpenchannelInteraction',_0x318fdb,JSON[_0x472b('0x16')](_0x31b2cb));_0x512911(_0x31b2cb);})['catch'](function(_0x1c91e0){logger[_0x472b('0x17')](_0x472b('0x22'),_0x1c91e0[_0x472b('0x1a')],_0x318fdb);_0x33e8e0(_0x497105[_0x472b('0x17')](0x1f4,_0x1c91e0[_0x472b('0x1a')]));});});};exports[_0x472b('0x23')]=function(_0x29feb7){return new Promise(function(_0x1f8fbf,_0x312b1d){return db['OpenchannelInteraction'][_0x472b('0x24')]({'where':_0x29feb7['options']?_0x29feb7['options'][_0x472b('0x20')]||null:null})[_0x472b('0x11')](function(_0x45caa9){if(_0x45caa9){return _0x45caa9[_0x472b('0x25')](_0x29feb7['body'][_0x472b('0x26')],_[_0x472b('0x27')](_0x29feb7['body'],[_0x472b('0x26'),'id'])||{});}})[_0x472b('0x28')](function(_0x181c7c){logger[_0x472b('0x12')](_0x472b('0x29'),_0x29feb7);logger[_0x472b('0x13')](_0x472b('0x29'),_0x29feb7,JSON[_0x472b('0x16')](_0x181c7c));_0x1f8fbf(_0x181c7c);})['catch'](function(_0x5a76da){logger['error'](_0x472b('0x29'),_0x5a76da['message'],_0x29feb7);_0x312b1d(_this['error'](0x1f4,_0x5a76da[_0x472b('0x1a')]));});});}; \ No newline at end of file +var _0xb2d6=['raw','where','attributes','limit','OpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelInteraction,\x20%s,\x20%s','message','info','catch','UpdateOpenchannelInteraction','update','body','options'];(function(_0x1c1cbb,_0x39136a){var _0x38813d=function(_0x4cbe4d){while(--_0x4cbe4d){_0x1c1cbb['push'](_0x1c1cbb['shift']());}};_0x38813d(++_0x39136a);}(_0xb2d6,0x190));var _0x6b2d=function(_0x3c802a,_0x4f163b){_0x3c802a=_0x3c802a-0x0;var _0x51abc5=_0xb2d6[_0x3c802a];return _0x51abc5;};'use strict';var _=require(_0x6b2d('0x0'));var util=require('util');var moment=require(_0x6b2d('0x1'));var BPromise=require(_0x6b2d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b2d('0x3'));var db=require(_0x6b2d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6b2d('0x5'));var config=require(_0x6b2d('0x6'));var jayson=require(_0x6b2d('0x7'));var client=jayson[_0x6b2d('0x8')][_0x6b2d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6b2d('0xa')],{'host':_0x6b2d('0xb'),'port':0x18eb});var socket=require(_0x6b2d('0xc'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x6b2d('0xd')](socket);function respondWithRpcPromise(_0x1082ba,_0xd608c9,_0x5128b8){return new BPromise(function(_0x29efca,_0x463492){return client[_0x6b2d('0xe')](_0x1082ba,_0x5128b8)[_0x6b2d('0xf')](function(_0x18237a){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xd608c9,'request\x20sent');logger[_0x6b2d('0x10')](_0x6b2d('0x11'),_0xd608c9,_0x6b2d('0x12'),JSON[_0x6b2d('0x13')](_0x18237a));if(_0x18237a[_0x6b2d('0x14')]){if(_0x18237a[_0x6b2d('0x14')]['code']===0x1f4){logger[_0x6b2d('0x14')](_0x6b2d('0x15'),_0xd608c9,_0x18237a[_0x6b2d('0x14')][_0x6b2d('0x16')]);return _0x463492(_0x18237a[_0x6b2d('0x14')][_0x6b2d('0x16')]);}logger[_0x6b2d('0x14')](_0x6b2d('0x15'),_0xd608c9,_0x18237a[_0x6b2d('0x14')][_0x6b2d('0x16')]);return _0x29efca(_0x18237a[_0x6b2d('0x14')][_0x6b2d('0x16')]);}else{logger[_0x6b2d('0x17')](_0x6b2d('0x15'),_0xd608c9,_0x6b2d('0x12'));_0x29efca(_0x18237a['result'][_0x6b2d('0x16')]);}})[_0x6b2d('0x18')](function(_0x59a0e1){logger['error'](_0x6b2d('0x15'),_0xd608c9,_0x59a0e1);_0x463492(_0x59a0e1);});});}exports[_0x6b2d('0x19')]=function(_0x576139){var _0x270257=this;return new Promise(function(_0x281791,_0x343190){return db['OpenchannelInteraction'][_0x6b2d('0x1a')](_0x576139[_0x6b2d('0x1b')],{'raw':_0x576139[_0x6b2d('0x1c')]?_0x576139['options'][_0x6b2d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x576139[_0x6b2d('0x1c')]?_0x576139[_0x6b2d('0x1c')][_0x6b2d('0x1e')]||null:null,'attributes':_0x576139[_0x6b2d('0x1c')]?_0x576139[_0x6b2d('0x1c')][_0x6b2d('0x1f')]||null:null,'limit':_0x576139[_0x6b2d('0x1c')]?_0x576139[_0x6b2d('0x1c')][_0x6b2d('0x20')]||null:null})[_0x6b2d('0xf')](function(_0x3abfae){logger[_0x6b2d('0x17')]('UpdateOpenchannelInteraction',_0x576139);logger[_0x6b2d('0x10')](_0x6b2d('0x19'),_0x576139,JSON[_0x6b2d('0x13')](_0x3abfae));_0x281791(_0x3abfae);})[_0x6b2d('0x18')](function(_0x3e561e){logger['error'](_0x6b2d('0x19'),_0x3e561e[_0x6b2d('0x16')],_0x576139);_0x343190(_0x270257['error'](0x1f4,_0x3e561e['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x2cf82f){return new Promise(function(_0x4912a6,_0x2e58df){return db[_0x6b2d('0x21')][_0x6b2d('0x22')]({'where':_0x2cf82f[_0x6b2d('0x1c')]?_0x2cf82f[_0x6b2d('0x1c')][_0x6b2d('0x1e')]||null:null})['then'](function(_0x13120d){if(_0x13120d){return _0x13120d[_0x6b2d('0x23')](_0x2cf82f[_0x6b2d('0x1b')][_0x6b2d('0x24')],_['omit'](_0x2cf82f[_0x6b2d('0x1b')],['ids','id'])||{});}})[_0x6b2d('0x25')](function(_0x10ff89){logger[_0x6b2d('0x17')](_0x6b2d('0x26'),_0x2cf82f);logger[_0x6b2d('0x10')](_0x6b2d('0x26'),_0x2cf82f,JSON['stringify'](_0x10ff89));_0x4912a6(_0x10ff89);})[_0x6b2d('0x18')](function(_0x21ea11){logger[_0x6b2d('0x14')](_0x6b2d('0x26'),_0x21ea11[_0x6b2d('0x16')],_0x2cf82f);_0x2e58df(_this[_0x6b2d('0x14')](0x1f4,_0x21ea11[_0x6b2d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 71b8b9f..6313b71 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 _0x3a4d=['update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','remove'];(function(_0x3f338e,_0x16e8dc){var _0x4857bb=function(_0xf63eb0){while(--_0xf63eb0){_0x3f338e['push'](_0x3f338e['shift']());}};_0x4857bb(++_0x16e8dc);}(_0x3a4d,0x166));var _0xd3a4=function(_0x2c2a8e,_0x1dfe39){_0x2c2a8e=_0x2c2a8e-0x0;var _0x3b9e38=_0x3a4d[_0x2c2a8e];return _0x3b9e38;};'use strict';var OpenchannelInteractionEvents=require(_0xd3a4('0x0'));var events=['save',_0xd3a4('0x1'),_0xd3a4('0x2')];function createListener(_0x5a6a9f,_0x3986e3){return function(_0x4c34ce){_0x3986e3[_0xd3a4('0x3')](_0x5a6a9f,_0x4c34ce);};}function removeListener(_0x53511b,_0x40efed){return function(){OpenchannelInteractionEvents[_0xd3a4('0x4')](_0x53511b,_0x40efed);};}exports[_0xd3a4('0x5')]=function(_0x18a3f2){for(var _0x29e268=0x0,_0x24a746=events[_0xd3a4('0x6')];_0x29e268<_0x24a746;_0x29e268++){var _0x593228=events[_0x29e268];var _0x42fca7=createListener(_0xd3a4('0x7')+_0x593228,_0x18a3f2);OpenchannelInteractionEvents['on'](_0x593228,_0x42fca7);}}; \ No newline at end of file +var _0x42c0=['length','save','remove','update','emit'];(function(_0x1d8b43,_0x313da8){var _0x1d9278=function(_0x268fff){while(--_0x268fff){_0x1d8b43['push'](_0x1d8b43['shift']());}};_0x1d9278(++_0x313da8);}(_0x42c0,0xc9));var _0x042c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x42c0[_0x2c91e9];return _0x13f0ff;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x042c('0x0'),_0x042c('0x1'),_0x042c('0x2')];function createListener(_0x1e3f73,_0x57e864){return function(_0x405f98){_0x57e864[_0x042c('0x3')](_0x1e3f73,_0x405f98);};}function removeListener(_0x28bbaf,_0x1cadfc){return function(){OpenchannelInteractionEvents['removeListener'](_0x28bbaf,_0x1cadfc);};}exports['register']=function(_0x20a2df){for(var _0x3dc83e=0x0,_0x483093=events[_0x042c('0x4')];_0x3dc83e<_0x483093;_0x3dc83e++){var _0x6ab05e=events[_0x3dc83e];var _0x4c827f=createListener('openchannelInteraction:'+_0x6ab05e,_0x20a2df);OpenchannelInteractionEvents['on'](_0x6ab05e,_0x4c827f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 7a5fd64..5fdd785 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x201643,_0x214e15){var _0x47a3d8=function(_0x4e1852){while(--_0x4e1852){_0x201643['push'](_0x201643['shift']());}};_0x47a3d8(++_0x214e15);}(_0xedd9,0xfc));var _0x9edd=function(_0x304aa9,_0x12823b){_0x304aa9=_0x304aa9-0x0;var _0x43b9dd=_0xedd9[_0x304aa9];return _0x43b9dd;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x4eeeb3,_0x31df20){var _0x2119a8=function(_0x4ba671){while(--_0x4ba671){_0x4eeeb3['push'](_0x4eeeb3['shift']());}};_0x2119a8(++_0x31df20);}(_0xe706,0xa3));var _0x6e70=function(_0xb4411,_0x5d04ac){_0xb4411=_0xb4411-0x0;var _0x481db4=_0xe706[_0xb4411];return _0x481db4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ae31e47..73b0d6b 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 _0x453b=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x4b33e7,_0x37151a){var _0x37dfd9=function(_0x1be923){while(--_0x1be923){_0x4b33e7['push'](_0x4b33e7['shift']());}};_0x37dfd9(++_0x37151a);}(_0x453b,0x164));var _0xb453=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0x453b[_0x5ad220];return _0xdec77d;};'use strict';var Sequelize=require(_0xb453('0x0'));module[_0xb453('0x1')]={'body':{'type':Sequelize[_0xb453('0x2')](_0xb453('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb453('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb453('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb453('0x5')]('in',_0xb453('0x6')),'defaultValue':_0xb453('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb453('0x7')]},'providerName':{'type':Sequelize[_0xb453('0x8')]},'providerResponse':{'type':Sequelize[_0xb453('0x2')]}}; \ No newline at end of file +var _0xaebd=['STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0xea81a1,_0xb28e9e){var _0x2cd030=function(_0x3f8ea5){while(--_0x3f8ea5){_0xea81a1['push'](_0xea81a1['shift']());}};_0x2cd030(++_0xb28e9e);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x267751,_0x20d23d){_0x267751=_0x267751-0x0;var _0x157cf8=_0xaebd[_0x267751];return _0x157cf8;};'use strict';var Sequelize=require(_0xdaeb('0x0'));module['exports']={'body':{'type':Sequelize[_0xdaeb('0x1')](_0xdaeb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdaeb('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xdaeb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdaeb('0x4')]('in','out'),'defaultValue':_0xdaeb('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xdaeb('0x6')]},'providerName':{'type':Sequelize[_0xdaeb('0x7')]},'providerResponse':{'type':Sequelize[_0xdaeb('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index ac82cee..9145c46 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 _0x8178=['EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','fullname','SIP/%s','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','destroy','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','OpenchannelMessage','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','openchannel-interactions','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','user','channel','motionChannel','event'];(function(_0x55291a,_0x814018){var _0x3c870c=function(_0x1fd787){while(--_0x1fd787){_0x55291a['push'](_0x55291a['shift']());}};_0x3c870c(++_0x814018);}(_0x8178,0x8f));var _0x8817=function(_0x420781,_0x99f6db){_0x420781=_0x420781-0x0;var _0xa1e054=_0x8178[_0x420781];return _0xa1e054;};'use strict';var emlformat=require(_0x8817('0x0'));var rimraf=require(_0x8817('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8817('0x2'));var rp=require(_0x8817('0x3'));var moment=require('moment');var BPromise=require(_0x8817('0x4'));var Mustache=require(_0x8817('0x5'));var util=require(_0x8817('0x6'));var path=require(_0x8817('0x7'));var sox=require('sox');var csv=require(_0x8817('0x8'));var ejs=require(_0x8817('0x9'));var fs=require('fs');var fs_extra=require(_0x8817('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8817('0xb'));var deskjs=require(_0x8817('0xc'));var toCsv=require(_0x8817('0x8'));var querystring=require(_0x8817('0xd'));var Papa=require(_0x8817('0xe'));var Redis=require(_0x8817('0xf'));var authService=require(_0x8817('0x10'));var qs=require(_0x8817('0x11'));var as=require(_0x8817('0x12'));var hardwareService=require(_0x8817('0x13'));var logger=require(_0x8817('0x14'))(_0x8817('0x15'));var utils=require(_0x8817('0x16'));var config=require(_0x8817('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8817('0x18'))['db'];config[_0x8817('0x19')]=_[_0x8817('0x1a')](config[_0x8817('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8817('0x1b'))(new Redis(config['redis']));require(_0x8817('0x1c'))['register'](socket);var jayson=require(_0x8817('0x1d'));var client=jayson[_0x8817('0x1e')][_0x8817('0x1f')]({'port':0x232c});var client9002=jayson[_0x8817('0x1e')][_0x8817('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x35c775,_0x421f79,_0x28c19e,_0x54eed1){return new BPromise(function(_0x339aba,_0x10b73a){var _0x415e99=_0x54eed1||client;return _0x415e99[_0x8817('0x20')](_0x35c775,_0x28c19e)[_0x8817('0x21')](function(_0x34931f){logger[_0x8817('0x22')](_0x8817('0x23'),_0x421f79,_0x8817('0x24'));logger[_0x8817('0x25')](_0x8817('0x26'),_0x421f79,_0x8817('0x24'),JSON[_0x8817('0x27')](_0x34931f));if(_0x34931f[_0x8817('0x28')]){if(_0x34931f['error'][_0x8817('0x29')]===0x1f4){logger[_0x8817('0x28')](_0x8817('0x23'),_0x421f79,_0x34931f['error'][_0x8817('0x2a')]);return _0x10b73a(_0x34931f[_0x8817('0x28')][_0x8817('0x2a')]);}logger[_0x8817('0x28')](_0x8817('0x23'),_0x421f79,_0x34931f[_0x8817('0x28')]['message']);return _0x339aba(_0x34931f[_0x8817('0x28')][_0x8817('0x2a')]);}else{logger['info'](_0x8817('0x23'),_0x421f79,_0x8817('0x24'));_0x339aba(_0x34931f[_0x8817('0x2b')][_0x8817('0x2a')]);}})['catch'](function(_0x128202){logger[_0x8817('0x28')](_0x8817('0x23'),_0x421f79,_0x128202);_0x10b73a(_0x128202);});});}function respondWithStatusCode(_0x4f98dd,_0x3fdf38){_0x3fdf38=_0x3fdf38||0xcc;return function(_0x4fa00c){if(_0x4fa00c){return _0x4f98dd[_0x8817('0x2c')](_0x3fdf38);}return _0x4f98dd[_0x8817('0x2d')](_0x3fdf38)[_0x8817('0x2e')]();};}function respondWithResult(_0x22fc13,_0x4046f0){_0x4046f0=_0x4046f0||0xc8;return function(_0x33d56c){if(_0x33d56c){return _0x22fc13['status'](_0x4046f0)[_0x8817('0x2f')](_0x33d56c);}};}function respondWithFilteredResult(_0x3bb0b5,_0x27fa91){return function(_0xcc4da8){if(_0xcc4da8){var _0x323b63=typeof _0x27fa91['offset']===_0x8817('0x30')&&typeof _0x27fa91[_0x8817('0x31')]==='undefined';var _0x4ab6f3=_0xcc4da8[_0x8817('0x32')];var _0x258978=_0x323b63?0x0:_0x27fa91[_0x8817('0x33')];var _0x11387f=_0x323b63?_0xcc4da8[_0x8817('0x32')]:_0x27fa91[_0x8817('0x33')]+_0x27fa91[_0x8817('0x31')];var _0x55693f;if(_0x11387f>=_0x4ab6f3){_0x11387f=_0x4ab6f3;_0x55693f=0xc8;}else{_0x55693f=0xce;}_0x3bb0b5[_0x8817('0x2d')](_0x55693f);return _0x3bb0b5[_0x8817('0x34')](_0x8817('0x35'),_0x258978+'-'+_0x11387f+'/'+_0x4ab6f3)['json'](_0xcc4da8);}return null;};}function patchUpdates(_0x5ed06e){return function(_0x32af42){try{jsonpatch['apply'](_0x32af42,_0x5ed06e,!![]);}catch(_0x30180e){return BPromise[_0x8817('0x36')](_0x30180e);}return _0x32af42['save']();};}function saveUpdates(_0x1c8f25,_0x2959e1){return function(_0x299000){if(_0x299000){return _0x299000[_0x8817('0x37')](_0x1c8f25)[_0x8817('0x21')](function(_0x53b7bf){return _0x53b7bf;});}return null;};}function removeEntity(_0x365c13,_0xf2ff73){return function(_0x53b2d9){if(_0x53b2d9){return _0x53b2d9[_0x8817('0x38')]()[_0x8817('0x21')](function(){_0x365c13['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1218d4,_0x224c07){return function(_0x19ded2){if(!_0x19ded2){_0x1218d4['sendStatus'](0x194);}return _0x19ded2;};}function handleError(_0x60199d,_0x5bc03b){_0x5bc03b=_0x5bc03b||0x1f4;return function(_0x4e3170){logger[_0x8817('0x28')](_0x4e3170[_0x8817('0x39')]);if(_0x4e3170[_0x8817('0x3a')]){delete _0x4e3170[_0x8817('0x3a')];}_0x60199d[_0x8817('0x2d')](_0x5bc03b)['send'](_0x4e3170);};}exports[_0x8817('0x3b')]=function(_0x5f05e0,_0x3ac66f){var _0xc446ab={},_0x497aa8={},_0x9acef7={'count':0x0,'rows':[]};var _0x52bfcb=_[_0x8817('0x3c')](db['OpenchannelMessage'][_0x8817('0x3d')],function(_0x11f52d){return{'name':_0x11f52d['fieldName'],'type':_0x11f52d['type'][_0x8817('0x3e')]};});_0x497aa8[_0x8817('0x3f')]=_[_0x8817('0x3c')](_0x52bfcb,'name');_0x497aa8[_0x8817('0x40')]=_[_0x8817('0x41')](_0x5f05e0[_0x8817('0x40')]);_0x497aa8[_0x8817('0x42')]=_[_0x8817('0x43')](_0x497aa8[_0x8817('0x3f')],_0x497aa8[_0x8817('0x40')]);_0xc446ab[_0x8817('0x44')]=_[_0x8817('0x43')](_0x497aa8['model'],qs[_0x8817('0x45')](_0x5f05e0[_0x8817('0x40')]['fields']));_0xc446ab[_0x8817('0x44')]=_0xc446ab[_0x8817('0x44')][_0x8817('0x46')]?_0xc446ab[_0x8817('0x44')]:_0x497aa8['model'];if(!_0x5f05e0[_0x8817('0x40')][_0x8817('0x47')](_0x8817('0x48'))){_0xc446ab['limit']=qs[_0x8817('0x31')](_0x5f05e0[_0x8817('0x40')][_0x8817('0x31')]);_0xc446ab['offset']=qs[_0x8817('0x33')](_0x5f05e0[_0x8817('0x40')][_0x8817('0x33')]);}_0xc446ab[_0x8817('0x49')]=qs[_0x8817('0x4a')](_0x5f05e0[_0x8817('0x40')]['sort']);_0xc446ab['where']=qs[_0x8817('0x42')](_[_0x8817('0x4b')](_0x5f05e0[_0x8817('0x40')],_0x497aa8[_0x8817('0x42')]),_0x52bfcb);if(_0x5f05e0[_0x8817('0x40')][_0x8817('0x4c')]){_0xc446ab['where']=_[_0x8817('0x4d')](_0xc446ab[_0x8817('0x4e')],{'$or':_[_0x8817('0x3c')](_0x52bfcb,function(_0x3d194e){if(_0x3d194e[_0x8817('0x4f')]!==_0x8817('0x50')){var _0x20caec={};_0x20caec[_0x3d194e[_0x8817('0x3a')]]={'$like':'%'+_0x5f05e0['query']['filter']+'%'};return _0x20caec;}})});}_0xc446ab=_['merge']({},_0xc446ab,_0x5f05e0['options']);var _0x4bfd51={'where':_0xc446ab[_0x8817('0x4e')]};return db[_0x8817('0x51')][_0x8817('0x32')](_0x4bfd51)[_0x8817('0x21')](function(_0x294438){_0x9acef7[_0x8817('0x32')]=_0x294438;if(_0x5f05e0['query'][_0x8817('0x52')]){_0xc446ab[_0x8817('0x53')]=[{'all':!![]}];}return db[_0x8817('0x51')][_0x8817('0x54')](_0xc446ab);})[_0x8817('0x21')](function(_0x2f9eb5){_0x9acef7[_0x8817('0x55')]=_0x2f9eb5;return _0x9acef7;})[_0x8817('0x21')](respondWithFilteredResult(_0x3ac66f,_0xc446ab))['catch'](handleError(_0x3ac66f,null));};exports[_0x8817('0x56')]=function(_0x390d47,_0x513bf3){var _0x3b0f36={'raw':!![],'where':{'id':_0x390d47[_0x8817('0x57')]['id']}},_0x209458={};_0x209458[_0x8817('0x3f')]=_[_0x8817('0x41')](db[_0x8817('0x51')][_0x8817('0x3d')]);_0x209458['query']=_[_0x8817('0x41')](_0x390d47[_0x8817('0x40')]);_0x209458[_0x8817('0x42')]=_['intersection'](_0x209458[_0x8817('0x3f')],_0x209458[_0x8817('0x40')]);_0x3b0f36[_0x8817('0x44')]=_[_0x8817('0x43')](_0x209458[_0x8817('0x3f')],qs['fields'](_0x390d47[_0x8817('0x40')][_0x8817('0x45')]));_0x3b0f36['attributes']=_0x3b0f36[_0x8817('0x44')][_0x8817('0x46')]?_0x3b0f36['attributes']:_0x209458[_0x8817('0x3f')];if(_0x390d47['query'][_0x8817('0x52')]){_0x3b0f36[_0x8817('0x53')]=[{'all':!![]}];}_0x3b0f36=_[_0x8817('0x4d')]({},_0x3b0f36,_0x390d47['options']);return db[_0x8817('0x51')][_0x8817('0x58')](_0x3b0f36)[_0x8817('0x21')](handleEntityNotFound(_0x513bf3,null))[_0x8817('0x21')](respondWithResult(_0x513bf3,null))['catch'](handleError(_0x513bf3,null));};exports[_0x8817('0x59')]=function(_0x5b5cbd,_0x824c1a){return db[_0x8817('0x51')][_0x8817('0x59')](_0x5b5cbd[_0x8817('0x5a')],{})['then'](respondWithResult(_0x824c1a,0xc9))[_0x8817('0x5b')](handleError(_0x824c1a,null));};exports[_0x8817('0x37')]=function(_0x770ee2,_0x5afd8b){if(_0x770ee2['body']['id']){delete _0x770ee2[_0x8817('0x5a')]['id'];}return db['OpenchannelMessage'][_0x8817('0x58')]({'where':{'id':_0x770ee2[_0x8817('0x57')]['id']}})['then'](handleEntityNotFound(_0x5afd8b,null))[_0x8817('0x21')](saveUpdates(_0x770ee2[_0x8817('0x5a')],null))['then'](respondWithResult(_0x5afd8b,null))[_0x8817('0x5b')](handleError(_0x5afd8b,null));};exports[_0x8817('0x38')]=function(_0x299c14,_0x53b570){return db['OpenchannelMessage']['find']({'where':{'id':_0x299c14[_0x8817('0x57')]['id']}})[_0x8817('0x21')](handleEntityNotFound(_0x53b570,null))[_0x8817('0x21')](removeEntity(_0x53b570,null))[_0x8817('0x5b')](handleError(_0x53b570,null));};exports[_0x8817('0x5c')]=function(_0x5d9635,_0x17c2da){return db[_0x8817('0x51')][_0x8817('0x5c')]()[_0x8817('0x21')](respondWithResult(_0x17c2da,null))['catch'](handleError(_0x17c2da,null));};var interaction_log=require(_0x8817('0x14'))(_0x8817('0x5d'));exports[_0x8817('0x5e')]=function(_0xd2837c,_0x5e4fad,_0x1e47dd){var _0x56ecd5={'agent':{},'channel':_0x8817('0x5f')};if(_0xd2837c['body']['id']){delete _0xd2837c[_0x8817('0x5a')]['id'];}_0xd2837c[_0x8817('0x5a')]['read']=!![];_0xd2837c[_0x8817('0x5a')]['readAt']=moment()[_0x8817('0x60')](_0x8817('0x61'));_0xd2837c[_0x8817('0x5a')][_0x8817('0x62')]=_0xd2837c[_0x8817('0x5a')][_0x8817('0x62')]||_0xd2837c['user']['id'];_0x56ecd5[_0x8817('0x63')]['id']=_0xd2837c[_0x8817('0x5a')][_0x8817('0x62')];return db['OpenchannelMessage'][_0x8817('0x58')]({'where':{'id':_0xd2837c['params']['id'],'UserId':null}})[_0x8817('0x21')](handleEntityNotFound(_0x5e4fad,null))['then'](saveUpdates(_0xd2837c[_0x8817('0x5a')],null))[_0x8817('0x21')](function(_0x395e84){if(_0x395e84){_0x56ecd5[_0x8817('0x2a')]=_0x395e84[_0x8817('0x64')]({'plain':!![]});return db[_0x8817('0x65')]['find']({'where':{'id':_0x395e84[_0x8817('0x66')]}});}return null;})[_0x8817('0x21')](handleEntityNotFound(_0x5e4fad,null))[_0x8817('0x21')](function(_0x44246b){if(_0x44246b){return _0x44246b['update']({'UserId':_0xd2837c[_0x8817('0x5a')][_0x8817('0x62')],'read1stAt':_[_0x8817('0x67')](_0x44246b['read1stAt'])?moment()[_0x8817('0x60')](_0x8817('0x61')):undefined});}return null;})[_0x8817('0x21')](function(_0xdb0e9d){if(_0xdb0e9d){_0x56ecd5[_0x8817('0x68')]=_0xdb0e9d[_0x8817('0x64')]({'plain':!![]});interaction_log[_0x8817('0x22')](_0x8817('0x69'),_0xd2837c['user']['id'],_0xd2837c['user'][_0x8817('0x3a')],_0xd2837c['user'][_0x8817('0x6a')],_0x56ecd5[_0x8817('0x68')]['id'],_0xd2837c[_0x8817('0x5a')]?JSON[_0x8817('0x27')](_0xd2837c[_0x8817('0x5a')]):_0x8817('0x6b'));return respondWithRpcPromise(_0x8817('0x6c'),_0x8817('0x6d'),_0x56ecd5);}return null;})['then'](function(_0x4083bf){var _0xe22bea=_0x8817('0x6e')+_0x4083bf[_0x8817('0x2a')][_0x8817('0x6f')];return db['sequelize'][_0x8817('0x40')](_0xe22bea,{'type':db[_0x8817('0x70')][_0x8817('0x71')][_0x8817('0x72')],'raw':!![]})[_0x8817('0x21')](function(_0x5e9122){return _0x5e9122;});})[_0x8817('0x21')](function(_0x114346){if(_0x114346){_0x56ecd5[_0x8817('0x2a')][_0x8817('0x73')]=_0x114346[0x0];if(!_0xd2837c[_0x8817('0x5a')][_0x8817('0x62')])return;return db[_0x8817('0x74')][_0x8817('0x58')]({'where':{'id':_0xd2837c['body'][_0x8817('0x62')],'role':'agent'},'attributes':['id',_0x8817('0x3a'),'fullname',_0x8817('0x75'),_0x8817('0x76')],'raw':!![]});}return null;})['then'](function(_0x225587){if(!_0x225587)return null;_0x56ecd5[_0x8817('0x2a')]['agent']=_0x225587;return _0x56ecd5;})[_0x8817('0x21')](function(_0x28c77d){if(_0x28c77d){if(_0xd2837c['body'][_0x8817('0x77')]){_0x56ecd5[_0x8817('0x2a')][_0x8817('0x78')]=util[_0x8817('0x60')]('SIP/%s',_0xd2837c[_0x8817('0x79')][_0x8817('0x3a')]);_0x56ecd5[_0x8817('0x2a')][_0x8817('0x7a')]=_0x56ecd5[_0x8817('0x7a')];_0x56ecd5[_0x8817('0x2a')][_0x8817('0x7b')]=_0x56ecd5[_0x8817('0x7a')];_0x56ecd5[_0x8817('0x2a')][_0x8817('0x7c')]='accept';return respondWithRpcPromise(_0x8817('0x7d'),_0x8817('0x7d'),{'event':_0x8817('0x7e'),'message':_0x56ecd5['message']},client9002)['then'](function(){return _0x56ecd5;});}return _0x56ecd5;}return null;})['then'](respondWithResult(_0x5e4fad,null))[_0x8817('0x5b')](handleError(_0x5e4fad,null));};var interaction_log=require(_0x8817('0x14'))(_0x8817('0x5d'));exports['reject']=function(_0x4951b9,_0x5ee935,_0x40c333){var _0x3efd2a={'agent':{},'channel':'openchannel'};if(_0x4951b9[_0x8817('0x5a')]['id']){delete _0x4951b9[_0x8817('0x5a')]['id'];}_0x4951b9[_0x8817('0x5a')][_0x8817('0x62')]=_0x4951b9[_0x8817('0x5a')][_0x8817('0x62')]||_0x4951b9['user']['id'];_0x3efd2a[_0x8817('0x63')]['id']=_0x4951b9[_0x8817('0x5a')][_0x8817('0x62')];return db[_0x8817('0x51')]['find']({'where':{'id':_0x4951b9[_0x8817('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5ee935,null))[_0x8817('0x21')](function(_0x4753d5){if(_0x4753d5){_0x3efd2a['message']=_0x4753d5[_0x8817('0x64')]({'plain':!![]});return db[_0x8817('0x65')][_0x8817('0x58')]({'where':{'id':_0x4753d5[_0x8817('0x66')]}});}return null;})[_0x8817('0x21')](handleEntityNotFound(_0x5ee935,null))[_0x8817('0x21')](function(_0x44418){if(_0x44418){_0x3efd2a['interaction']=_0x44418[_0x8817('0x64')]({'plain':!![]});interaction_log[_0x8817('0x22')](_0x8817('0x7f'),_0x4951b9[_0x8817('0x79')]['id'],_0x4951b9[_0x8817('0x79')][_0x8817('0x3a')],_0x4951b9[_0x8817('0x79')][_0x8817('0x6a')],_0x3efd2a['interaction']['id'],_0x4951b9[_0x8817('0x5a')]?JSON[_0x8817('0x27')](_0x4951b9[_0x8817('0x5a')]):_0x8817('0x6b'));return respondWithRpcPromise(_0x8817('0x80'),_0x8817('0x81'),_0x3efd2a);}return null;})[_0x8817('0x21')](function(_0x3ea57d){var _0x4b2e74=_0x8817('0x6e')+_0x3ea57d[_0x8817('0x2a')]['ContactId'];return db[_0x8817('0x82')][_0x8817('0x40')](_0x4b2e74,{'type':db[_0x8817('0x70')][_0x8817('0x71')]['SELECT'],'raw':!![]})[_0x8817('0x21')](function(_0x344c54){return _0x344c54;});})[_0x8817('0x21')](function(_0x11a8c3){if(_0x11a8c3){_0x3efd2a[_0x8817('0x2a')][_0x8817('0x73')]=_0x11a8c3[0x0];if(!_0x4951b9[_0x8817('0x5a')][_0x8817('0x62')])return;return db['User']['find']({'where':{'id':_0x4951b9['body'][_0x8817('0x62')],'role':'agent'},'attributes':['id',_0x8817('0x3a'),_0x8817('0x83'),_0x8817('0x75'),'internal'],'raw':!![]});}return null;})[_0x8817('0x21')](function(_0x468a5f){if(!_0x468a5f)return null;_0x3efd2a[_0x8817('0x2a')][_0x8817('0x63')]=_0x468a5f;return _0x3efd2a;})['then'](function(_0x555477){if(_0x555477){_0x555477['message'][_0x8817('0x78')]=util[_0x8817('0x60')](_0x8817('0x84'),_0x4951b9[_0x8817('0x79')][_0x8817('0x3a')]);_0x555477[_0x8817('0x2a')][_0x8817('0x7a')]=_0x3efd2a[_0x8817('0x7a')];_0x555477[_0x8817('0x2a')][_0x8817('0x7b')]=_0x3efd2a[_0x8817('0x7a')];_0x555477['message'][_0x8817('0x7c')]=_0x8817('0x36');respondWithRpcPromise('EventManager',_0x8817('0x7d'),{'event':_0x8817('0x85'),'message':_0x555477['message']},client9002);return _0x3efd2a;}return null;})['then'](respondWithResult(_0x5ee935,null))['catch'](handleError(_0x5ee935,null));}; \ No newline at end of file +var _0x6b5f=['keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','includeAll','include','show','params','rawAttributes','find','create','body','destroy','describe','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','interaction','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','null','rejectMessage','ContactId','User','fullname','rejectmessage','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','end','stack','name','send','index','map','OpenchannelMessage','key','model','query'];(function(_0x3ae794,_0x3a520f){var _0x4a13df=function(_0x4f8a01){while(--_0x4f8a01){_0x3ae794['push'](_0x3ae794['shift']());}};_0x4a13df(++_0x3a520f);}(_0x6b5f,0x13e));var _0xf6b5=function(_0x467609,_0x637de2){_0x467609=_0x467609-0x0;var _0x4a9e11=_0x6b5f[_0x467609];return _0x4a9e11;};'use strict';var emlformat=require(_0xf6b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6b5('0x1'));var jsonpatch=require(_0xf6b5('0x2'));var rp=require(_0xf6b5('0x3'));var moment=require(_0xf6b5('0x4'));var BPromise=require(_0xf6b5('0x5'));var Mustache=require(_0xf6b5('0x6'));var util=require(_0xf6b5('0x7'));var path=require(_0xf6b5('0x8'));var sox=require(_0xf6b5('0x9'));var csv=require(_0xf6b5('0xa'));var ejs=require(_0xf6b5('0xb'));var fs=require('fs');var fs_extra=require(_0xf6b5('0xc'));var _=require(_0xf6b5('0xd'));var squel=require(_0xf6b5('0xe'));var crypto=require(_0xf6b5('0xf'));var jsforce=require(_0xf6b5('0x10'));var deskjs=require(_0xf6b5('0x11'));var toCsv=require(_0xf6b5('0xa'));var querystring=require(_0xf6b5('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf6b5('0x13'));var qs=require(_0xf6b5('0x14'));var as=require(_0xf6b5('0x15'));var hardwareService=require(_0xf6b5('0x16'));var logger=require(_0xf6b5('0x17'))(_0xf6b5('0x18'));var utils=require(_0xf6b5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xf6b5('0x1a'));var db=require(_0xf6b5('0x1b'))['db'];config[_0xf6b5('0x1c')]=_[_0xf6b5('0x1d')](config[_0xf6b5('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6b5('0x1c')]));require('./openchannelMessage.socket')[_0xf6b5('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf6b5('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xf6b5('0x1f')][_0xf6b5('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x228281,_0xc75d1c,_0x1335d6,_0x47b964){return new BPromise(function(_0x44fc4f,_0x78d1eb){var _0x51aeb6=_0x47b964||client;return _0x51aeb6[_0xf6b5('0x21')](_0x228281,_0x1335d6)[_0xf6b5('0x22')](function(_0x280f4a){logger[_0xf6b5('0x23')](_0xf6b5('0x24'),_0xc75d1c,_0xf6b5('0x25'));logger[_0xf6b5('0x26')](_0xf6b5('0x27'),_0xc75d1c,_0xf6b5('0x25'),JSON['stringify'](_0x280f4a));if(_0x280f4a[_0xf6b5('0x28')]){if(_0x280f4a[_0xf6b5('0x28')][_0xf6b5('0x29')]===0x1f4){logger[_0xf6b5('0x28')](_0xf6b5('0x24'),_0xc75d1c,_0x280f4a[_0xf6b5('0x28')]['message']);return _0x78d1eb(_0x280f4a[_0xf6b5('0x28')][_0xf6b5('0x2a')]);}logger['error'](_0xf6b5('0x24'),_0xc75d1c,_0x280f4a[_0xf6b5('0x28')]['message']);return _0x44fc4f(_0x280f4a[_0xf6b5('0x28')]['message']);}else{logger[_0xf6b5('0x23')](_0xf6b5('0x24'),_0xc75d1c,'request\x20sent');_0x44fc4f(_0x280f4a[_0xf6b5('0x2b')][_0xf6b5('0x2a')]);}})[_0xf6b5('0x2c')](function(_0x7fd11c){logger[_0xf6b5('0x28')](_0xf6b5('0x24'),_0xc75d1c,_0x7fd11c);_0x78d1eb(_0x7fd11c);});});}function respondWithStatusCode(_0x56e46f,_0x2f1ac9){_0x2f1ac9=_0x2f1ac9||0xcc;return function(_0x47d066){if(_0x47d066){return _0x56e46f[_0xf6b5('0x2d')](_0x2f1ac9);}return _0x56e46f[_0xf6b5('0x2e')](_0x2f1ac9)['end']();};}function respondWithResult(_0x218d09,_0x5098de){_0x5098de=_0x5098de||0xc8;return function(_0x15e832){if(_0x15e832){return _0x218d09[_0xf6b5('0x2e')](_0x5098de)[_0xf6b5('0x2f')](_0x15e832);}};}function respondWithFilteredResult(_0x5102bb,_0x55c094){return function(_0x5e56c7){if(_0x5e56c7){var _0x4cb675=typeof _0x55c094['offset']===_0xf6b5('0x30')&&typeof _0x55c094[_0xf6b5('0x31')]===_0xf6b5('0x30');var _0x226c18=_0x5e56c7[_0xf6b5('0x32')];var _0x5d39ca=_0x4cb675?0x0:_0x55c094[_0xf6b5('0x33')];var _0x548a2f=_0x4cb675?_0x5e56c7[_0xf6b5('0x32')]:_0x55c094[_0xf6b5('0x33')]+_0x55c094[_0xf6b5('0x31')];var _0x5c5b4e;if(_0x548a2f>=_0x226c18){_0x548a2f=_0x226c18;_0x5c5b4e=0xc8;}else{_0x5c5b4e=0xce;}_0x5102bb[_0xf6b5('0x2e')](_0x5c5b4e);return _0x5102bb[_0xf6b5('0x34')](_0xf6b5('0x35'),_0x5d39ca+'-'+_0x548a2f+'/'+_0x226c18)[_0xf6b5('0x2f')](_0x5e56c7);}return null;};}function patchUpdates(_0x587bff){return function(_0x47bfb5){try{jsonpatch['apply'](_0x47bfb5,_0x587bff,!![]);}catch(_0x2e3260){return BPromise[_0xf6b5('0x36')](_0x2e3260);}return _0x47bfb5['save']();};}function saveUpdates(_0x1a17e1,_0xcea96e){return function(_0x31f0a1){if(_0x31f0a1){return _0x31f0a1[_0xf6b5('0x37')](_0x1a17e1)['then'](function(_0x45418a){return _0x45418a;});}return null;};}function removeEntity(_0x36ae8a,_0x154906){return function(_0x29560f){if(_0x29560f){return _0x29560f['destroy']()['then'](function(){_0x36ae8a[_0xf6b5('0x2e')](0xcc)[_0xf6b5('0x38')]();});}};}function handleEntityNotFound(_0x259836,_0x2abe34){return function(_0x172e9d){if(!_0x172e9d){_0x259836[_0xf6b5('0x2d')](0x194);}return _0x172e9d;};}function handleError(_0xbe1f83,_0xe0b284){_0xe0b284=_0xe0b284||0x1f4;return function(_0xee4e5b){logger[_0xf6b5('0x28')](_0xee4e5b[_0xf6b5('0x39')]);if(_0xee4e5b[_0xf6b5('0x3a')]){delete _0xee4e5b['name'];}_0xbe1f83['status'](_0xe0b284)[_0xf6b5('0x3b')](_0xee4e5b);};}exports[_0xf6b5('0x3c')]=function(_0x3e6737,_0x1e8e21){var _0x5cc4f1={},_0x36aee3={},_0x1db897={'count':0x0,'rows':[]};var _0x231efb=_[_0xf6b5('0x3d')](db[_0xf6b5('0x3e')]['rawAttributes'],function(_0x302690){return{'name':_0x302690['fieldName'],'type':_0x302690['type'][_0xf6b5('0x3f')]};});_0x36aee3[_0xf6b5('0x40')]=_[_0xf6b5('0x3d')](_0x231efb,_0xf6b5('0x3a'));_0x36aee3[_0xf6b5('0x41')]=_[_0xf6b5('0x42')](_0x3e6737['query']);_0x36aee3[_0xf6b5('0x43')]=_[_0xf6b5('0x44')](_0x36aee3[_0xf6b5('0x40')],_0x36aee3[_0xf6b5('0x41')]);_0x5cc4f1[_0xf6b5('0x45')]=_[_0xf6b5('0x44')](_0x36aee3[_0xf6b5('0x40')],qs[_0xf6b5('0x46')](_0x3e6737[_0xf6b5('0x41')]['fields']));_0x5cc4f1['attributes']=_0x5cc4f1[_0xf6b5('0x45')][_0xf6b5('0x47')]?_0x5cc4f1[_0xf6b5('0x45')]:_0x36aee3['model'];if(!_0x3e6737['query']['hasOwnProperty']('nolimit')){_0x5cc4f1[_0xf6b5('0x31')]=qs['limit'](_0x3e6737['query'][_0xf6b5('0x31')]);_0x5cc4f1[_0xf6b5('0x33')]=qs[_0xf6b5('0x33')](_0x3e6737[_0xf6b5('0x41')][_0xf6b5('0x33')]);}_0x5cc4f1[_0xf6b5('0x48')]=qs[_0xf6b5('0x49')](_0x3e6737[_0xf6b5('0x41')][_0xf6b5('0x49')]);_0x5cc4f1['where']=qs[_0xf6b5('0x43')](_[_0xf6b5('0x4a')](_0x3e6737[_0xf6b5('0x41')],_0x36aee3[_0xf6b5('0x43')]),_0x231efb);if(_0x3e6737['query'][_0xf6b5('0x4b')]){_0x5cc4f1[_0xf6b5('0x4c')]=_[_0xf6b5('0x4d')](_0x5cc4f1['where'],{'$or':_['map'](_0x231efb,function(_0x193785){if(_0x193785['type']!=='VIRTUAL'){var _0x1fe0b9={};_0x1fe0b9[_0x193785['name']]={'$like':'%'+_0x3e6737[_0xf6b5('0x41')][_0xf6b5('0x4b')]+'%'};return _0x1fe0b9;}})});}_0x5cc4f1=_[_0xf6b5('0x4d')]({},_0x5cc4f1,_0x3e6737[_0xf6b5('0x4e')]);var _0x30c581={'where':_0x5cc4f1['where']};return db[_0xf6b5('0x3e')][_0xf6b5('0x32')](_0x30c581)[_0xf6b5('0x22')](function(_0x583646){_0x1db897[_0xf6b5('0x32')]=_0x583646;if(_0x3e6737[_0xf6b5('0x41')][_0xf6b5('0x4f')]){_0x5cc4f1[_0xf6b5('0x50')]=[{'all':!![]}];}return db[_0xf6b5('0x3e')]['findAll'](_0x5cc4f1);})[_0xf6b5('0x22')](function(_0x333eaf){_0x1db897['rows']=_0x333eaf;return _0x1db897;})[_0xf6b5('0x22')](respondWithFilteredResult(_0x1e8e21,_0x5cc4f1))[_0xf6b5('0x2c')](handleError(_0x1e8e21,null));};exports[_0xf6b5('0x51')]=function(_0x37781d,_0x1ef91d){var _0x591190={'raw':!![],'where':{'id':_0x37781d[_0xf6b5('0x52')]['id']}},_0x239899={};_0x239899[_0xf6b5('0x40')]=_[_0xf6b5('0x42')](db[_0xf6b5('0x3e')][_0xf6b5('0x53')]);_0x239899[_0xf6b5('0x41')]=_[_0xf6b5('0x42')](_0x37781d[_0xf6b5('0x41')]);_0x239899['filters']=_[_0xf6b5('0x44')](_0x239899[_0xf6b5('0x40')],_0x239899['query']);_0x591190[_0xf6b5('0x45')]=_[_0xf6b5('0x44')](_0x239899['model'],qs[_0xf6b5('0x46')](_0x37781d[_0xf6b5('0x41')][_0xf6b5('0x46')]));_0x591190[_0xf6b5('0x45')]=_0x591190[_0xf6b5('0x45')]['length']?_0x591190[_0xf6b5('0x45')]:_0x239899[_0xf6b5('0x40')];if(_0x37781d[_0xf6b5('0x41')][_0xf6b5('0x4f')]){_0x591190['include']=[{'all':!![]}];}_0x591190=_[_0xf6b5('0x4d')]({},_0x591190,_0x37781d['options']);return db['OpenchannelMessage'][_0xf6b5('0x54')](_0x591190)[_0xf6b5('0x22')](handleEntityNotFound(_0x1ef91d,null))[_0xf6b5('0x22')](respondWithResult(_0x1ef91d,null))[_0xf6b5('0x2c')](handleError(_0x1ef91d,null));};exports['create']=function(_0x4c1445,_0x370a46){return db[_0xf6b5('0x3e')][_0xf6b5('0x55')](_0x4c1445[_0xf6b5('0x56')],{})['then'](respondWithResult(_0x370a46,0xc9))[_0xf6b5('0x2c')](handleError(_0x370a46,null));};exports[_0xf6b5('0x37')]=function(_0x3c68aa,_0x1b826c){if(_0x3c68aa['body']['id']){delete _0x3c68aa['body']['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x3c68aa[_0xf6b5('0x52')]['id']}})[_0xf6b5('0x22')](handleEntityNotFound(_0x1b826c,null))['then'](saveUpdates(_0x3c68aa[_0xf6b5('0x56')],null))[_0xf6b5('0x22')](respondWithResult(_0x1b826c,null))[_0xf6b5('0x2c')](handleError(_0x1b826c,null));};exports[_0xf6b5('0x57')]=function(_0x455f6d,_0x3300ba){return db['OpenchannelMessage'][_0xf6b5('0x54')]({'where':{'id':_0x455f6d[_0xf6b5('0x52')]['id']}})['then'](handleEntityNotFound(_0x3300ba,null))['then'](removeEntity(_0x3300ba,null))[_0xf6b5('0x2c')](handleError(_0x3300ba,null));};exports['describe']=function(_0x3ee731,_0x383dfb){return db['OpenchannelMessage'][_0xf6b5('0x58')]()[_0xf6b5('0x22')](respondWithResult(_0x383dfb,null))['catch'](handleError(_0x383dfb,null));};var interaction_log=require(_0xf6b5('0x17'))('openchannel-interactions');exports[_0xf6b5('0x59')]=function(_0x12c66d,_0x4e36a6,_0x528d52){var _0x35fabd={'agent':{},'channel':_0xf6b5('0x5a')};if(_0x12c66d[_0xf6b5('0x56')]['id']){delete _0x12c66d[_0xf6b5('0x56')]['id'];}_0x12c66d[_0xf6b5('0x56')][_0xf6b5('0x5b')]=!![];_0x12c66d[_0xf6b5('0x56')][_0xf6b5('0x5c')]=moment()['format'](_0xf6b5('0x5d'));_0x12c66d['body']['UserId']=_0x12c66d[_0xf6b5('0x56')][_0xf6b5('0x5e')]||_0x12c66d[_0xf6b5('0x5f')]['id'];_0x35fabd[_0xf6b5('0x60')]['id']=_0x12c66d[_0xf6b5('0x56')][_0xf6b5('0x5e')];return db[_0xf6b5('0x3e')][_0xf6b5('0x54')]({'where':{'id':_0x12c66d['params']['id'],'UserId':null}})[_0xf6b5('0x22')](handleEntityNotFound(_0x4e36a6,null))['then'](saveUpdates(_0x12c66d[_0xf6b5('0x56')],null))[_0xf6b5('0x22')](function(_0x4f76e5){if(_0x4f76e5){_0x35fabd[_0xf6b5('0x2a')]=_0x4f76e5[_0xf6b5('0x61')]({'plain':!![]});return db[_0xf6b5('0x62')][_0xf6b5('0x54')]({'where':{'id':_0x4f76e5['OpenchannelInteractionId']}});}return null;})[_0xf6b5('0x22')](handleEntityNotFound(_0x4e36a6,null))[_0xf6b5('0x22')](function(_0x1c877b){if(_0x1c877b){return _0x1c877b[_0xf6b5('0x37')]({'UserId':_0x12c66d[_0xf6b5('0x56')][_0xf6b5('0x5e')],'read1stAt':_[_0xf6b5('0x63')](_0x1c877b[_0xf6b5('0x64')])?moment()['format'](_0xf6b5('0x5d')):undefined});}return null;})[_0xf6b5('0x22')](function(_0x575bcb){if(_0x575bcb){_0x35fabd[_0xf6b5('0x65')]=_0x575bcb[_0xf6b5('0x61')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x12c66d['user']['id'],_0x12c66d['user'][_0xf6b5('0x3a')],_0x12c66d[_0xf6b5('0x5f')][_0xf6b5('0x66')],_0x35fabd[_0xf6b5('0x65')]['id'],_0x12c66d[_0xf6b5('0x56')]?JSON[_0xf6b5('0x67')](_0x12c66d[_0xf6b5('0x56')]):'null');return respondWithRpcPromise(_0xf6b5('0x68'),_0xf6b5('0x69'),_0x35fabd);}return null;})[_0xf6b5('0x22')](function(_0xc67739){var _0x25997d=_0xf6b5('0x6a')+_0xc67739[_0xf6b5('0x2a')]['ContactId'];return db[_0xf6b5('0x6b')][_0xf6b5('0x41')](_0x25997d,{'type':db['Sequelize'][_0xf6b5('0x6c')][_0xf6b5('0x6d')],'raw':!![]})[_0xf6b5('0x22')](function(_0x184474){return _0x184474;});})[_0xf6b5('0x22')](function(_0x19a875){if(_0x19a875){_0x35fabd[_0xf6b5('0x2a')]['contact']=_0x19a875[0x0];if(!_0x12c66d[_0xf6b5('0x56')][_0xf6b5('0x5e')])return;return db['User']['find']({'where':{'id':_0x12c66d[_0xf6b5('0x56')][_0xf6b5('0x5e')],'role':_0xf6b5('0x60')},'attributes':['id',_0xf6b5('0x3a'),'fullname',_0xf6b5('0x6e'),_0xf6b5('0x6f')],'raw':!![]});}return null;})['then'](function(_0xb89cb7){if(!_0xb89cb7)return null;_0x35fabd[_0xf6b5('0x2a')]['agent']=_0xb89cb7;return _0x35fabd;})['then'](function(_0x21e4ff){if(_0x21e4ff){if(_0x12c66d['body']['manual']){_0x35fabd[_0xf6b5('0x2a')][_0xf6b5('0x70')]=util[_0xf6b5('0x71')](_0xf6b5('0x72'),_0x12c66d['user']['name']);_0x35fabd['message'][_0xf6b5('0x73')]=_0x35fabd[_0xf6b5('0x73')];_0x35fabd['message'][_0xf6b5('0x74')]=_0x35fabd[_0xf6b5('0x73')];_0x35fabd[_0xf6b5('0x2a')][_0xf6b5('0x75')]=_0xf6b5('0x59');return respondWithRpcPromise(_0xf6b5('0x76'),_0xf6b5('0x76'),{'event':_0xf6b5('0x77'),'message':_0x35fabd[_0xf6b5('0x2a')]},client9002)[_0xf6b5('0x22')](function(){return _0x35fabd;});}return _0x35fabd;}return null;})[_0xf6b5('0x22')](respondWithResult(_0x4e36a6,null))[_0xf6b5('0x2c')](handleError(_0x4e36a6,null));};var interaction_log=require('../../config/logger')(_0xf6b5('0x78'));exports[_0xf6b5('0x36')]=function(_0x525647,_0x180f4d,_0x113d1d){var _0x2d9ef4={'agent':{},'channel':'openchannel'};if(_0x525647[_0xf6b5('0x56')]['id']){delete _0x525647[_0xf6b5('0x56')]['id'];}_0x525647[_0xf6b5('0x56')][_0xf6b5('0x5e')]=_0x525647[_0xf6b5('0x56')]['UserId']||_0x525647[_0xf6b5('0x5f')]['id'];_0x2d9ef4[_0xf6b5('0x60')]['id']=_0x525647[_0xf6b5('0x56')][_0xf6b5('0x5e')];return db[_0xf6b5('0x3e')][_0xf6b5('0x54')]({'where':{'id':_0x525647[_0xf6b5('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x180f4d,null))['then'](function(_0xf5a064){if(_0xf5a064){_0x2d9ef4[_0xf6b5('0x2a')]=_0xf5a064['get']({'plain':!![]});return db[_0xf6b5('0x62')]['find']({'where':{'id':_0xf5a064[_0xf6b5('0x79')]}});}return null;})[_0xf6b5('0x22')](handleEntityNotFound(_0x180f4d,null))[_0xf6b5('0x22')](function(_0x4333df){if(_0x4333df){_0x2d9ef4[_0xf6b5('0x65')]=_0x4333df[_0xf6b5('0x61')]({'plain':!![]});interaction_log[_0xf6b5('0x23')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x525647[_0xf6b5('0x5f')]['id'],_0x525647['user'][_0xf6b5('0x3a')],_0x525647[_0xf6b5('0x5f')][_0xf6b5('0x66')],_0x2d9ef4['interaction']['id'],_0x525647[_0xf6b5('0x56')]?JSON['stringify'](_0x525647['body']):_0xf6b5('0x7a'));return respondWithRpcPromise('RejectMessage',_0xf6b5('0x7b'),_0x2d9ef4);}return null;})[_0xf6b5('0x22')](function(_0x1ccccc){var _0x549ad0=_0xf6b5('0x6a')+_0x1ccccc[_0xf6b5('0x2a')][_0xf6b5('0x7c')];return db[_0xf6b5('0x6b')][_0xf6b5('0x41')](_0x549ad0,{'type':db['Sequelize'][_0xf6b5('0x6c')][_0xf6b5('0x6d')],'raw':!![]})[_0xf6b5('0x22')](function(_0x25ab48){return _0x25ab48;});})[_0xf6b5('0x22')](function(_0x2512e0){if(_0x2512e0){_0x2d9ef4[_0xf6b5('0x2a')]['contact']=_0x2512e0[0x0];if(!_0x525647[_0xf6b5('0x56')]['UserId'])return;return db[_0xf6b5('0x7d')][_0xf6b5('0x54')]({'where':{'id':_0x525647['body'][_0xf6b5('0x5e')],'role':_0xf6b5('0x60')},'attributes':['id',_0xf6b5('0x3a'),_0xf6b5('0x7e'),'email',_0xf6b5('0x6f')],'raw':!![]});}return null;})['then'](function(_0x5a2baf){if(!_0x5a2baf)return null;_0x2d9ef4[_0xf6b5('0x2a')][_0xf6b5('0x60')]=_0x5a2baf;return _0x2d9ef4;})[_0xf6b5('0x22')](function(_0x4d2391){if(_0x4d2391){_0x4d2391['message'][_0xf6b5('0x70')]=util['format'](_0xf6b5('0x72'),_0x525647[_0xf6b5('0x5f')][_0xf6b5('0x3a')]);_0x4d2391['message'][_0xf6b5('0x73')]=_0x2d9ef4['channel'];_0x4d2391[_0xf6b5('0x2a')]['motionChannel']=_0x2d9ef4[_0xf6b5('0x73')];_0x4d2391[_0xf6b5('0x2a')][_0xf6b5('0x75')]='reject';respondWithRpcPromise(_0xf6b5('0x76'),_0xf6b5('0x76'),{'event':_0xf6b5('0x7f'),'message':_0x4d2391[_0xf6b5('0x2a')]},client9002);return _0x2d9ef4;}return null;})['then'](respondWithResult(_0x180f4d,null))['catch'](handleError(_0x180f4d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a8b002f..171d245 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 _0x9143=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1dc068,_0x659b68){var _0x3c6e14=function(_0x2392df){while(--_0x2392df){_0x1dc068['push'](_0x1dc068['shift']());}};_0x3c6e14(++_0x659b68);}(_0x9143,0x7e));var _0x3914=function(_0x130304,_0x424608){_0x130304=_0x130304-0x0;var _0xb85c4c=_0x9143[_0x130304];return _0xb85c4c;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x3914('0x0'))['db'][_0x3914('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3914('0x2')](0x0);var events={'afterCreate':_0x3914('0x3'),'afterUpdate':_0x3914('0x4'),'afterDestroy':_0x3914('0x5')};function emitEvent(_0x48c75e){return function(_0x581937,_0x1c3739,_0x489535){OpenchannelMessageEvents[_0x3914('0x6')](_0x48c75e+':'+_0x581937['id'],_0x581937);OpenchannelMessageEvents[_0x3914('0x6')](_0x48c75e,_0x581937);_0x489535(null);};}for(var e in events){if(events[_0x3914('0x7')](e)){var event=events[e];OpenchannelMessage[_0x3914('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x20e7=['update','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x269d92,_0x1acc3c){var _0x15c5ba=function(_0x532a36){while(--_0x532a36){_0x269d92['push'](_0x269d92['shift']());}};_0x15c5ba(++_0x1acc3c);}(_0x20e7,0x94));var _0x720e=function(_0xead248,_0x5b5fb4){_0xead248=_0xead248-0x0;var _0x21ed2d=_0x20e7[_0xead248];return _0x21ed2d;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x720e('0x0'))['db'][_0x720e('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x720e('0x2')](0x0);var events={'afterCreate':_0x720e('0x3'),'afterUpdate':_0x720e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x225d63){return function(_0xdf7d92,_0x5a0dcb,_0x2e5547){OpenchannelMessageEvents[_0x720e('0x5')](_0x225d63+':'+_0xdf7d92['id'],_0xdf7d92);OpenchannelMessageEvents[_0x720e('0x5')](_0x225d63,_0xdf7d92);_0x2e5547(null);};}for(var e in events){if(events[_0x720e('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x720e('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 2e614c4..ffb3b52 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 _0x5c00=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','OpenchannelInteraction','catch','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_messages','fti_openchannel_messages','body','models','toLowerCase','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','direction','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get'];(function(_0x16d9a7,_0x290bec){var _0x17532e=function(_0x3e8cc2){while(--_0x3e8cc2){_0x16d9a7['push'](_0x16d9a7['shift']());}};_0x17532e(++_0x290bec);}(_0x5c00,0x17e));var _0x05c0=function(_0x44c7a2,_0x449be7){_0x44c7a2=_0x44c7a2-0x0;var _0x3efc90=_0x5c00[_0x44c7a2];return _0x3efc90;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[{'name':_0x05c0('0xb'),'fields':[_0x05c0('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32a795,_0x32cdfa,_0x996d6b){var _0x321c09=_0x3521fe[_0x05c0('0xd')];var _0x1edbb=_0x32a795['get']({'plain':!![]});if(_0x1edbb['direction'][_0x05c0('0xe')]()==='in'||_0x1edbb['direction'][_0x05c0('0xe')]()===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]&&!_['isNil'](_0x1edbb[_0x05c0('0x11')])){_0x321c09['OpenchannelInteraction'][_0x05c0('0x12')]({'where':{'id':_0x1edbb[_0x05c0('0x13')]}})[_0x05c0('0x14')](function(_0x12deeb){if(_0x12deeb){_0x12deeb[_0x05c0('0x15')]({'lastMsgAt':_0x1edbb[_0x05c0('0x16')],'lastMsgDirection':_0x1edbb[_0x05c0('0x17')][_0x05c0('0xe')]()});}})['catch'](function(_0x238e25){console[_0x05c0('0x18')](_0x238e25);});}if(_0x1edbb[_0x05c0('0x17')]===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]){var _0x40153e;_0x321c09[_0x05c0('0x19')][_0x05c0('0x1a')]()[_0x05c0('0x14')](function(_0x521cbd){return _0x321c09[_0x05c0('0x1b')][_0x05c0('0x1c')]({'where':{'id':_0x1edbb[_0x05c0('0x1d')]},'include':[{'model':_0x321c09['OpenchannelInteraction'],'as':_0x05c0('0x1e'),'where':{'id':_0x1edbb[_0x05c0('0x13')]},'limit':0x1,'include':[{'model':_0x321c09[_0x05c0('0x19')],'as':_0x05c0('0x1f'),'attributes':_[_0x05c0('0x20')](_0x521cbd)}]}]});})['then'](function(_0x407c1f){_0x40153e=_0x407c1f[_0x05c0('0x21')]({'plain':!![]});if(_0x40153e&&_0x40153e['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x24'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x40153e[_0x05c0('0x1e')]&&_0x40153e[_0x05c0('0x1e')][_0x05c0('0x26')]){_0x1edbb['Interaction']=_[_0x05c0('0x27')](_0x40153e[_0x05c0('0x1e')][0x0],'Contact');_0x1edbb['Contact']=_0x40153e['Interactions'][0x0]['Contact'];}var _0x32cdfa={'method':_0x05c0('0x28'),'uri':encodeURI(_0x40153e[_0x05c0('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x32cdfa['method']){case _0x05c0('0x29'):_0x32cdfa['qs']=_0x1edbb;break;case _0x05c0('0x28'):_0x32cdfa[_0x05c0('0xc')]=_0x1edbb;break;}return rp(_0x32cdfa)[_0x05c0('0x14')](function(_0x58769a){logger[_0x05c0('0x2a')](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x2c'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x58769a['body']['threadId']&&_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]!=_0x1edbb[_0x05c0('0x2e')][_0x05c0('0x2d')]){return _0x321c09[_0x05c0('0x2f')][_0x05c0('0x15')]({'threadId':_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]},{'logging':!![],'where':{'id':_0x1edbb[_0x05c0('0x2e')]['id']}});}else{return;}})[_0x05c0('0x14')](function(){return _0x32a795[_0x05c0('0x15')]({'read':!![]});})[_0x05c0('0x30')](function(_0x50f03d){logger['error'](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x31')](_0x50f03d,{'showHidden':![],'depth':null}));_0x996d6b();});}else{_0x996d6b();}})['finally'](function(){_0x996d6b();});}else{_0x996d6b();}}},'charset':_0x05c0('0x32'),'collate':_0x05c0('0x33')});}; \ No newline at end of file +var _0x1a85=['openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','OpenchannelMessage'];(function(_0x4148ce,_0x440f73){var _0xd8bb16=function(_0x1e4da7){while(--_0x1e4da7){_0x4148ce['push'](_0x4148ce['shift']());}};_0xd8bb16(++_0x440f73);}(_0x1a85,0x178));var _0x51a8=function(_0x5870c1,_0x173ba3){_0x5870c1=_0x5870c1-0x0;var _0x344685=_0x1a85[_0x5870c1];return _0x344685;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x51a8('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e1b4,_0x39e06a,_0x2f276b){var _0x1a476d=_0x4b76a8[_0x51a8('0xa')];var _0x418f06=_0x56e1b4[_0x51a8('0xb')]({'plain':!![]});if(_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()==='in'||_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]&&!_[_0x51a8('0x10')](_0x418f06[_0x51a8('0x11')])){_0x1a476d[_0x51a8('0x12')][_0x51a8('0x13')]({'where':{'id':_0x418f06[_0x51a8('0x14')]}})['then'](function(_0x461f5c){if(_0x461f5c){_0x461f5c[_0x51a8('0x15')]({'lastMsgAt':_0x418f06[_0x51a8('0x16')],'lastMsgDirection':_0x418f06['direction'][_0x51a8('0xd')]()});}})['catch'](function(_0x10584b){console[_0x51a8('0x17')](_0x10584b);});}if(_0x418f06[_0x51a8('0xc')]===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]){var _0x3e0603;_0x1a476d[_0x51a8('0x18')]['describe']()[_0x51a8('0x19')](function(_0x45a433){return _0x1a476d[_0x51a8('0x1a')][_0x51a8('0x1b')]({'where':{'id':_0x418f06[_0x51a8('0x1c')]},'include':[{'model':_0x1a476d[_0x51a8('0x12')],'as':'Interactions','where':{'id':_0x418f06[_0x51a8('0x14')]},'limit':0x1,'include':[{'model':_0x1a476d[_0x51a8('0x18')],'as':_0x51a8('0x1d'),'attributes':_[_0x51a8('0x1e')](_0x45a433)}]}]});})[_0x51a8('0x19')](function(_0x3bc044){_0x3e0603=_0x3bc044[_0x51a8('0xb')]({'plain':!![]});if(_0x3e0603&&_0x3e0603[_0x51a8('0x1f')]){logger['info'](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x21')](_0x51a8('0x22'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0x3e0603[_0x51a8('0x23')]&&_0x3e0603['Interactions'][_0x51a8('0x24')]){_0x418f06['Interaction']=_['omit'](_0x3e0603[_0x51a8('0x23')][0x0],'Contact');_0x418f06[_0x51a8('0x1d')]=_0x3e0603[_0x51a8('0x23')][0x0][_0x51a8('0x1d')];}var _0x39e06a={'method':_0x51a8('0x25'),'uri':encodeURI(_0x3e0603[_0x51a8('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39e06a[_0x51a8('0x26')]){case _0x51a8('0x27'):_0x39e06a['qs']=_0x418f06;break;case'POST':_0x39e06a[_0x51a8('0x9')]=_0x418f06;break;}return rp(_0x39e06a)[_0x51a8('0x19')](function(_0xca5746){logger[_0x51a8('0x28')](_0x51a8('0x20'),_0x51a8('0x29'),util[_0x51a8('0x21')](_0x51a8('0x2a'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]&&_0xca5746[_0x51a8('0x9')]['threadId']!=_0x418f06[_0x51a8('0x2c')]['threadId']){return _0x1a476d[_0x51a8('0x12')][_0x51a8('0x15')]({'threadId':_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]},{'logging':!![],'where':{'id':_0x418f06[_0x51a8('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x56e1b4[_0x51a8('0x15')]({'read':!![]});})['catch'](function(_0x41c4de){logger[_0x51a8('0x17')](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x2d')](_0x41c4de,{'showHidden':![],'depth':null}));_0x2f276b();});}else{_0x2f276b();}})['finally'](function(){_0x2f276b();});}else{_0x2f276b();}}},'charset':_0x51a8('0x2e'),'collate':_0x51a8('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1f4edd8..89b9853 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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47230d,_0x3bb8b5){var _0x3099aa=function(_0x365f63){while(--_0x365f63){_0x47230d['push'](_0x47230d['shift']());}};_0x3099aa(++_0x3bb8b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1dbf67,_0x353051){_0x1dbf67=_0x1dbf67-0x0;var _0x13a4e9=_0x5f2f[_0x1dbf67];return _0x13a4e9;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x355948,_0x598cd7){var _0x91a21=function(_0x626bec){while(--_0x626bec){_0x355948['push'](_0x355948['shift']());}};_0x91a21(++_0x598cd7);}(_0xadb5,0xad));var _0x5adb=function(_0x326e57,_0x1a3acc){_0x326e57=_0x326e57-0x0;var _0x3e496b=_0xadb5[_0x326e57];return _0x3e496b;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index d7f8a3b..751199a 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 _0x004c=['./openchannelMessage.events','save','remove','update','emit','removeListener','openchannelMessage:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x004c,0x85));var _0xc004=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x004c[_0x176329];return _0x31997c;};'use strict';var OpenchannelMessageEvents=require(_0xc004('0x0'));var events=[_0xc004('0x1'),_0xc004('0x2'),_0xc004('0x3')];function createListener(_0x4c7289,_0x3b45e9){return function(_0x4016c5){_0x3b45e9[_0xc004('0x4')](_0x4c7289,_0x4016c5);};}function removeListener(_0x38a8b9,_0x571646){return function(){OpenchannelMessageEvents[_0xc004('0x5')](_0x38a8b9,_0x571646);};}exports['register']=function(_0x2c7142){for(var _0x25a58b=0x0,_0x5ef023=events['length'];_0x25a58b<_0x5ef023;_0x25a58b++){var _0x1b5007=events[_0x25a58b];var _0x46dcf9=createListener(_0xc004('0x6')+_0x1b5007,_0x2c7142);OpenchannelMessageEvents['on'](_0x1b5007,_0x46dcf9);}}; \ No newline at end of file +var _0x35b5=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x4b14ae,_0x132f89){var _0x2d136e=function(_0x1b792f){while(--_0x1b792f){_0x4b14ae['push'](_0x4b14ae['shift']());}};_0x2d136e(++_0x132f89);}(_0x35b5,0xd4));var _0x535b=function(_0x58b926,_0x13520e){_0x58b926=_0x58b926-0x0;var _0x2c77ce=_0x35b5[_0x58b926];return _0x2c77ce;};'use strict';var OpenchannelMessageEvents=require(_0x535b('0x0'));var events=[_0x535b('0x1'),_0x535b('0x2'),_0x535b('0x3')];function createListener(_0x2db915,_0x442409){return function(_0x338e04){_0x442409[_0x535b('0x4')](_0x2db915,_0x338e04);};}function removeListener(_0x343abe,_0x4610f1){return function(){OpenchannelMessageEvents[_0x535b('0x5')](_0x343abe,_0x4610f1);};}exports[_0x535b('0x6')]=function(_0x19ab8f){for(var _0x32c373=0x0,_0x52fb6f=events[_0x535b('0x7')];_0x32c373<_0x52fb6f;_0x32c373++){var _0x3ab3d4=events[_0x32c373];var _0x450564=createListener(_0x535b('0x8')+_0x3ab3d4,_0x19ab8f);OpenchannelMessageEvents['on'](_0x3ab3d4,_0x450564);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f31f438..1170f2e 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 _0x426b=['getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeTeams','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x3a0598,_0x5871fe){var _0x3c9326=function(_0x140ee7){while(--_0x140ee7){_0x3a0598['push'](_0x3a0598['shift']());}};_0x3c9326(++_0x5871fe);}(_0x426b,0x193));var _0xb426=function(_0x240eee,_0x249118){_0x240eee=_0x240eee-0x0;var _0x411632=_0x426b[_0x240eee];return _0x411632;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb426('0x0'));var timeout=require(_0xb426('0x1'));var express=require(_0xb426('0x2'));var router=express[_0xb426('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb426('0x4'));var interaction=require(_0xb426('0x5'));var config=require(_0xb426('0x6'));var controller=require(_0xb426('0x7'));router[_0xb426('0x8')]('/',auth[_0xb426('0x9')](),controller[_0xb426('0xa')]);router['get']('/describe',auth[_0xb426('0x9')](),controller[_0xb426('0xb')]);router['get'](_0xb426('0xc'),auth[_0xb426('0x9')](),controller[_0xb426('0xd')]);router['get'](_0xb426('0xe'),auth[_0xb426('0x9')](),controller[_0xb426('0xf')]);router[_0xb426('0x8')](_0xb426('0x10'),auth[_0xb426('0x9')](),controller[_0xb426('0x11')]);router[_0xb426('0x8')](_0xb426('0x12'),auth[_0xb426('0x9')](),controller[_0xb426('0x13')]);router[_0xb426('0x14')]('/',auth[_0xb426('0x9')](),controller[_0xb426('0x15')]);router[_0xb426('0x14')](_0xb426('0x10'),auth[_0xb426('0x9')](),controller[_0xb426('0x16')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xb426('0x17')](_0xb426('0xc'),auth[_0xb426('0x9')](),controller[_0xb426('0x18')]);router[_0xb426('0x19')]('/:id',auth[_0xb426('0x9')](),controller['destroy']);router[_0xb426('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb426('0x1a')]);router[_0xb426('0x19')](_0xb426('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb426('0x1b')]=router; \ No newline at end of file +var _0x8d92=['get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/users','getAgents','post','create','update','delete','destroy','/:id/teams','removeTeams','removeAgents','multer','util','path','express','Router','fs-extra','../../config/environment','./openchannelQueue.controller'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0x8d92,0x124));var _0x28d9=function(_0x5b95d9,_0x24d08e){_0x5b95d9=_0x5b95d9-0x0;var _0x20523c=_0x8d92[_0x5b95d9];return _0x20523c;};'use strict';var multer=require(_0x28d9('0x0'));var util=require(_0x28d9('0x1'));var path=require(_0x28d9('0x2'));var timeout=require('connect-timeout');var express=require(_0x28d9('0x3'));var router=express[_0x28d9('0x4')]();var fs_extra=require(_0x28d9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x28d9('0x6'));var controller=require(_0x28d9('0x7'));router[_0x28d9('0x8')]('/',auth[_0x28d9('0x9')](),controller[_0x28d9('0xa')]);router['get']('/describe',auth[_0x28d9('0x9')](),controller[_0x28d9('0xb')]);router['get'](_0x28d9('0xc'),auth[_0x28d9('0x9')](),controller['show']);router[_0x28d9('0x8')](_0x28d9('0xd'),auth[_0x28d9('0x9')](),controller[_0x28d9('0xe')]);router[_0x28d9('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x28d9('0x8')](_0x28d9('0xf'),auth[_0x28d9('0x9')](),controller[_0x28d9('0x10')]);router[_0x28d9('0x11')]('/',auth[_0x28d9('0x9')](),controller[_0x28d9('0x12')]);router[_0x28d9('0x11')]('/:id/teams',auth[_0x28d9('0x9')](),controller['addTeams']);router['post']('/:id/users',auth[_0x28d9('0x9')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x28d9('0x13')]);router[_0x28d9('0x14')](_0x28d9('0xc'),auth[_0x28d9('0x9')](),controller[_0x28d9('0x15')]);router[_0x28d9('0x14')](_0x28d9('0x16'),auth[_0x28d9('0x9')](),controller[_0x28d9('0x17')]);router['delete']('/:id/users',auth[_0x28d9('0x9')](),controller[_0x28d9('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 6450c35..e13ea9f 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 _0xaac8=['rrmemory','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xaac8,0x1a6));var _0x8aac=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xaac8[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x8aac('0x0'));module['exports']={'name':{'type':Sequelize[_0x8aac('0x1')],'unique':_0x8aac('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8aac('0x1')]},'timeout':{'type':Sequelize[_0x8aac('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8aac('0x4'),'beepall',_0x8aac('0x5'))}}; \ No newline at end of file +var _0x6829=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x50e757,_0x2c2a81){var _0x456f7a=function(_0x3ac690){while(--_0x3ac690){_0x50e757['push'](_0x50e757['shift']());}};_0x456f7a(++_0x2c2a81);}(_0x6829,0x68));var _0x9682=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x6829[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require(_0x9682('0x0'));module['exports']={'name':{'type':Sequelize[_0x9682('0x1')],'unique':_0x9682('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9682('0x1')]},'timeout':{'type':Sequelize[_0x9682('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9682('0x4')]('rrmemory',_0x9682('0x5'),_0x9682('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index bb4e056..25401ac 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 _0x10b3=['sort','pick','filter','merge','type','VIRTUAL','where','includeAll','findAll','rows','catch','show','params','include','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserOpenchannelQueue','nolimit','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','updatedAt','findOne','Team','getTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','addAgents','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','get','OpenchannelQueues','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x22ccc0,_0x914457){var _0xe2af6a=function(_0x55aa01){while(--_0x55aa01){_0x22ccc0['push'](_0x22ccc0['shift']());}};_0xe2af6a(++_0x914457);}(_0x10b3,0x1ee));var _0x310b=function(_0xa28154,_0x259c85){_0xa28154=_0xa28154-0x0;var _0x2bc7a2=_0x10b3[_0xa28154];return _0x2bc7a2;};'use strict';var emlformat=require(_0x310b('0x0'));var rimraf=require(_0x310b('0x1'));var zipdir=require(_0x310b('0x2'));var jsonpatch=require(_0x310b('0x3'));var rp=require('request-promise');var moment=require(_0x310b('0x4'));var BPromise=require(_0x310b('0x5'));var Mustache=require('mustache');var util=require(_0x310b('0x6'));var path=require(_0x310b('0x7'));var sox=require(_0x310b('0x8'));var csv=require(_0x310b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x310b('0xa'));var _=require(_0x310b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x310b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x310b('0x9'));var querystring=require(_0x310b('0xd'));var Papa=require(_0x310b('0xe'));var Redis=require(_0x310b('0xf'));var authService=require(_0x310b('0x10'));var qs=require(_0x310b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x310b('0x12'))(_0x310b('0x13'));var utils=require(_0x310b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x310b('0x15'));var db=require(_0x310b('0x16'))['db'];config[_0x310b('0x17')]=_[_0x310b('0x18')](config['redis'],{'host':_0x310b('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x310b('0x17')]));require(_0x310b('0x1a'))[_0x310b('0x1b')](socket);function respondWithStatusCode(_0x59fb01,_0x3c331b){_0x3c331b=_0x3c331b||0xcc;return function(_0x433359){if(_0x433359){return _0x59fb01[_0x310b('0x1c')](_0x3c331b);}return _0x59fb01[_0x310b('0x1d')](_0x3c331b)[_0x310b('0x1e')]();};}function respondWithResult(_0x569c6c,_0x1d7fb6){_0x1d7fb6=_0x1d7fb6||0xc8;return function(_0xc856e5){if(_0xc856e5){return _0x569c6c['status'](_0x1d7fb6)[_0x310b('0x1f')](_0xc856e5);}};}function respondWithFilteredResult(_0x43d2ba,_0x43c824){return function(_0x21c84a){if(_0x21c84a){var _0x2847e1=typeof _0x43c824[_0x310b('0x20')]===_0x310b('0x21')&&typeof _0x43c824[_0x310b('0x22')]===_0x310b('0x21');var _0x334622=_0x21c84a[_0x310b('0x23')];var _0x2a980e=_0x2847e1?0x0:_0x43c824[_0x310b('0x20')];var _0x7b959b=_0x2847e1?_0x21c84a[_0x310b('0x23')]:_0x43c824[_0x310b('0x20')]+_0x43c824[_0x310b('0x22')];var _0x564eee;if(_0x7b959b>=_0x334622){_0x7b959b=_0x334622;_0x564eee=0xc8;}else{_0x564eee=0xce;}_0x43d2ba[_0x310b('0x1d')](_0x564eee);return _0x43d2ba[_0x310b('0x24')]('Content-Range',_0x2a980e+'-'+_0x7b959b+'/'+_0x334622)[_0x310b('0x1f')](_0x21c84a);}return null;};}function patchUpdates(_0x28ff60){return function(_0x21310a){try{jsonpatch['apply'](_0x21310a,_0x28ff60,!![]);}catch(_0x43a479){return BPromise['reject'](_0x43a479);}return _0x21310a[_0x310b('0x25')]();};}function saveUpdates(_0x448048,_0x32451c){return function(_0x40af92){if(_0x40af92){return _0x40af92[_0x310b('0x26')](_0x448048)[_0x310b('0x27')](function(_0x37b1bd){return _0x37b1bd;});}return null;};}function removeEntity(_0x54e716,_0xd939c2){return function(_0x5d9a6e){if(_0x5d9a6e){return _0x5d9a6e[_0x310b('0x28')]()['then'](function(){var _0x54486e=_0x5d9a6e[_0x310b('0x29')]({'plain':!![]});var _0x589fbc=_0x310b('0x2a');return db['UserProfileResource'][_0x310b('0x28')]({'where':{'type':_0x589fbc,'resourceId':_0x54486e['id']}})[_0x310b('0x27')](function(){return _0x5d9a6e;});})['then'](function(){_0x54e716[_0x310b('0x1d')](0xcc)[_0x310b('0x1e')]();});}};}function handleEntityNotFound(_0x5b4c0f,_0x2177e8){return function(_0x28b623){if(!_0x28b623){_0x5b4c0f[_0x310b('0x1c')](0x194);}return _0x28b623;};}function handleError(_0xfaae40,_0x2bcebb){_0x2bcebb=_0x2bcebb||0x1f4;return function(_0x53fe6a){logger[_0x310b('0x2b')](_0x53fe6a[_0x310b('0x2c')]);if(_0x53fe6a[_0x310b('0x2d')]){delete _0x53fe6a[_0x310b('0x2d')];}_0xfaae40[_0x310b('0x1d')](_0x2bcebb)[_0x310b('0x2e')](_0x53fe6a);};}exports[_0x310b('0x2f')]=function(_0x3e62c8,_0x2be7ab){var _0x347667={},_0x507a43={},_0x267d9c={'count':0x0,'rows':[]};var _0x55e01e=_[_0x310b('0x30')](db[_0x310b('0x31')][_0x310b('0x32')],function(_0x22e934){return{'name':_0x22e934[_0x310b('0x33')],'type':_0x22e934['type']['key']};});_0x507a43[_0x310b('0x34')]=_[_0x310b('0x30')](_0x55e01e,_0x310b('0x2d'));_0x507a43[_0x310b('0x35')]=_[_0x310b('0x36')](_0x3e62c8['query']);_0x507a43[_0x310b('0x37')]=_[_0x310b('0x38')](_0x507a43[_0x310b('0x34')],_0x507a43[_0x310b('0x35')]);_0x347667[_0x310b('0x39')]=_[_0x310b('0x38')](_0x507a43[_0x310b('0x34')],qs[_0x310b('0x3a')](_0x3e62c8[_0x310b('0x35')]['fields']));_0x347667[_0x310b('0x39')]=_0x347667['attributes'][_0x310b('0x3b')]?_0x347667[_0x310b('0x39')]:_0x507a43[_0x310b('0x34')];if(!_0x3e62c8[_0x310b('0x35')][_0x310b('0x3c')]('nolimit')){_0x347667['limit']=qs[_0x310b('0x22')](_0x3e62c8['query']['limit']);_0x347667['offset']=qs[_0x310b('0x20')](_0x3e62c8[_0x310b('0x35')][_0x310b('0x20')]);}_0x347667[_0x310b('0x3d')]=qs[_0x310b('0x3e')](_0x3e62c8[_0x310b('0x35')][_0x310b('0x3e')]);_0x347667['where']=qs[_0x310b('0x37')](_[_0x310b('0x3f')](_0x3e62c8[_0x310b('0x35')],_0x507a43['filters']),_0x55e01e);if(_0x3e62c8[_0x310b('0x35')][_0x310b('0x40')]){_0x347667['where']=_[_0x310b('0x41')](_0x347667['where'],{'$or':_[_0x310b('0x30')](_0x55e01e,function(_0x29d3cc){if(_0x29d3cc[_0x310b('0x42')]!==_0x310b('0x43')){var _0x5699e4={};_0x5699e4[_0x29d3cc[_0x310b('0x2d')]]={'$like':'%'+_0x3e62c8[_0x310b('0x35')][_0x310b('0x40')]+'%'};return _0x5699e4;}})});}_0x347667=_['merge']({},_0x347667,_0x3e62c8['options']);var _0x2c058e={'where':_0x347667[_0x310b('0x44')]};return db['OpenchannelQueue'][_0x310b('0x23')](_0x2c058e)[_0x310b('0x27')](function(_0x1731d1){_0x267d9c['count']=_0x1731d1;if(_0x3e62c8[_0x310b('0x35')][_0x310b('0x45')]){_0x347667['include']=[{'all':!![]}];}return db[_0x310b('0x31')][_0x310b('0x46')](_0x347667);})[_0x310b('0x27')](function(_0x208b3b){_0x267d9c[_0x310b('0x47')]=_0x208b3b;return _0x267d9c;})[_0x310b('0x27')](respondWithFilteredResult(_0x2be7ab,_0x347667))[_0x310b('0x48')](handleError(_0x2be7ab,null));};exports[_0x310b('0x49')]=function(_0x283834,_0x3829dd){var _0x48f738={'raw':!![],'where':{'id':_0x283834[_0x310b('0x4a')]['id']}},_0x290019={};_0x290019[_0x310b('0x34')]=_[_0x310b('0x36')](db[_0x310b('0x31')]['rawAttributes']);_0x290019[_0x310b('0x35')]=_['keys'](_0x283834[_0x310b('0x35')]);_0x290019[_0x310b('0x37')]=_[_0x310b('0x38')](_0x290019[_0x310b('0x34')],_0x290019['query']);_0x48f738['attributes']=_[_0x310b('0x38')](_0x290019[_0x310b('0x34')],qs['fields'](_0x283834['query'][_0x310b('0x3a')]));_0x48f738[_0x310b('0x39')]=_0x48f738['attributes']['length']?_0x48f738[_0x310b('0x39')]:_0x290019['model'];if(_0x283834['query'][_0x310b('0x45')]){_0x48f738[_0x310b('0x4b')]=[{'all':!![]}];}_0x48f738=_[_0x310b('0x41')]({},_0x48f738,_0x283834[_0x310b('0x4c')]);return db[_0x310b('0x31')]['find'](_0x48f738)[_0x310b('0x27')](handleEntityNotFound(_0x3829dd,null))[_0x310b('0x27')](respondWithResult(_0x3829dd,null))[_0x310b('0x48')](handleError(_0x3829dd,null));};exports[_0x310b('0x4d')]=function(_0x3a2123,_0x2114b7){return db[_0x310b('0x31')][_0x310b('0x4d')](_0x3a2123[_0x310b('0x4e')],{})['then'](function(_0x417049){var _0x3d3c21=_0x3a2123['user']['get']({'plain':!![]});if(!_0x3d3c21)throw new Error(_0x310b('0x4f'));if(_0x3d3c21[_0x310b('0x50')]==='user'){var _0x2761c7=_0x417049[_0x310b('0x29')]({'plain':!![]});var _0x17f1bb='OpenchannelQueues';return db[_0x310b('0x51')]['find']({'where':{'name':_0x17f1bb,'userProfileId':_0x3d3c21[_0x310b('0x52')]},'raw':!![]})[_0x310b('0x27')](function(_0x21e63e){if(_0x21e63e&&_0x21e63e['autoAssociation']===0x0){return db[_0x310b('0x53')][_0x310b('0x4d')]({'name':_0x2761c7[_0x310b('0x2d')],'resourceId':_0x2761c7['id'],'type':_0x21e63e[_0x310b('0x2d')],'sectionId':_0x21e63e['id']},{})[_0x310b('0x27')](function(){return _0x417049;});}else{return _0x417049;}})[_0x310b('0x48')](function(_0x5b2566){logger['error'](_0x310b('0x54'),_0x5b2566);throw _0x5b2566;});}return _0x417049;})[_0x310b('0x27')](respondWithResult(_0x2114b7,0xc9))[_0x310b('0x48')](handleError(_0x2114b7,null));};exports[_0x310b('0x26')]=function(_0x14eba6,_0x3b4083){if(_0x14eba6[_0x310b('0x4e')]['id']){delete _0x14eba6[_0x310b('0x4e')]['id'];}return db[_0x310b('0x31')][_0x310b('0x55')]({'where':{'id':_0x14eba6[_0x310b('0x4a')]['id']}})[_0x310b('0x27')](handleEntityNotFound(_0x3b4083,null))[_0x310b('0x27')](saveUpdates(_0x14eba6[_0x310b('0x4e')],null))[_0x310b('0x27')](respondWithResult(_0x3b4083,null))[_0x310b('0x48')](handleError(_0x3b4083,null));};exports['destroy']=function(_0xef6960,_0x580a83){return db['OpenchannelQueue'][_0x310b('0x55')]({'where':{'id':_0xef6960['params']['id']}})[_0x310b('0x27')](handleEntityNotFound(_0x580a83,null))[_0x310b('0x27')](removeEntity(_0x580a83,null))['catch'](handleError(_0x580a83,null));};exports[_0x310b('0x56')]=function(_0x589561,_0x3f7e0a){return db[_0x310b('0x31')][_0x310b('0x56')]()[_0x310b('0x27')](respondWithResult(_0x3f7e0a,null))['catch'](handleError(_0x3f7e0a,null));};exports[_0x310b('0x57')]=function(_0xd2c1d6,_0x5d8cc8,_0x13ed42){var _0xe4d30c={'raw':!![],'where':{}},_0x39ed10={},_0x55d5ea;return db['OpenchannelQueue']['findOne']({'where':{'id':_0xd2c1d6['params']['id']}})[_0x310b('0x27')](handleEntityNotFound(_0x5d8cc8,null))[_0x310b('0x27')](function(_0xd52fb1){if(_0xd52fb1){_0x55d5ea=_0xd52fb1[_0x310b('0x29')]({'plain':!![]});_0x39ed10[_0x310b('0x34')]=_[_0x310b('0x36')](db[_0x310b('0x58')]['rawAttributes']);_0x39ed10[_0x310b('0x35')]=_[_0x310b('0x36')](_0xd2c1d6[_0x310b('0x35')]);_0x39ed10[_0x310b('0x37')]=_[_0x310b('0x38')](_0x39ed10[_0x310b('0x34')],_0x39ed10[_0x310b('0x35')]);_0xe4d30c[_0x310b('0x39')]=_[_0x310b('0x38')](_0x39ed10[_0x310b('0x34')],qs['fields'](_0xd2c1d6[_0x310b('0x35')][_0x310b('0x3a')]));_0xe4d30c[_0x310b('0x39')]=_0xe4d30c[_0x310b('0x39')]['length']?_0xe4d30c[_0x310b('0x39')]:_0x39ed10[_0x310b('0x34')];if(!_0xd2c1d6[_0x310b('0x35')]['hasOwnProperty'](_0x310b('0x59'))){_0xe4d30c['limit']=qs['limit'](_0xd2c1d6[_0x310b('0x35')][_0x310b('0x22')]);_0xe4d30c[_0x310b('0x20')]=qs[_0x310b('0x20')](_0xd2c1d6[_0x310b('0x35')][_0x310b('0x20')]);}_0xe4d30c['order']=qs['sort'](_0xd2c1d6['query']['sort']);_0xe4d30c['where']=qs[_0x310b('0x37')](_[_0x310b('0x3f')](_0xd2c1d6[_0x310b('0x35')],_0x39ed10[_0x310b('0x37')]));_0xe4d30c[_0x310b('0x44')][_0x310b('0x5a')]=_0xd52fb1['id'];if(_0xd2c1d6[_0x310b('0x35')][_0x310b('0x40')]){_0xe4d30c[_0x310b('0x44')]=_['merge'](_0xe4d30c[_0x310b('0x44')],{'$or':_[_0x310b('0x30')](_0xe4d30c[_0x310b('0x39')],function(_0x2bd82e){var _0x2b62f1={};_0x2b62f1[_0x2bd82e]={'$like':'%'+_0xd2c1d6['query'][_0x310b('0x40')]+'%'};return _0x2b62f1;})});}_0xe4d30c=_[_0x310b('0x41')]({},_0xe4d30c,_0xd2c1d6[_0x310b('0x4c')]);return db[_0x310b('0x58')][_0x310b('0x46')](_0xe4d30c);}})[_0x310b('0x27')](function(_0x327ae3){if(_0x327ae3){return db[_0x310b('0x5b')][_0x310b('0x5c')]({'where':{'id':_[_0x310b('0x30')](_0x327ae3,_0x310b('0x5d')),'role':_0x310b('0x5e')},'attributes':['id',_0x310b('0x2d'),_0x310b('0x5f'),'updatedAt',_0x310b('0x60')]});}})[_0x310b('0x27')](function(_0x18bd0b){if(_0x18bd0b){return{'count':_0x18bd0b['count'],'rows':_[_0x310b('0x30')](_0x18bd0b[_0x310b('0x47')],function(_0x2217f7){return{'membername':_0x2217f7[_0x310b('0x2d')],'UserId':_0x2217f7['id'],'queue_name':_0x55d5ea[_0x310b('0x2d')],'OpenchannelQueueId':_0x55d5ea['id'],'interface':util[_0x310b('0x61')]('%s/%s','SIP',_0x2217f7[_0x310b('0x2d')]),'penalty':0x0,'paused':_0x2217f7[_0x310b('0x5f')],'createdAt':_0x2217f7['createdAt'],'updatedAt':_0x2217f7[_0x310b('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x310b('0x27')](respondWithFilteredResult(_0x5d8cc8,_0xe4d30c))[_0x310b('0x48')](handleError(_0x5d8cc8,null));};exports['getTeams']=function(_0x341dac,_0x58090b,_0x51163b){var _0x4169b9={};var _0xd14a2c={};var _0x42ff60;var _0x2910e4;return db['OpenchannelQueue'][_0x310b('0x63')]({'where':{'id':_0x341dac[_0x310b('0x4a')]['id']}})[_0x310b('0x27')](handleEntityNotFound(_0x58090b,null))[_0x310b('0x27')](function(_0x5eab74){if(_0x5eab74){_0x42ff60=_0x5eab74;_0xd14a2c[_0x310b('0x34')]=_['keys'](db[_0x310b('0x64')][_0x310b('0x32')]);_0xd14a2c[_0x310b('0x35')]=_[_0x310b('0x36')](_0x341dac['query']);_0xd14a2c[_0x310b('0x37')]=_[_0x310b('0x38')](_0xd14a2c[_0x310b('0x34')],_0xd14a2c[_0x310b('0x35')]);_0x4169b9[_0x310b('0x39')]=_['intersection'](_0xd14a2c['model'],qs[_0x310b('0x3a')](_0x341dac[_0x310b('0x35')]['fields']));_0x4169b9['attributes']=_0x4169b9[_0x310b('0x39')][_0x310b('0x3b')]?_0x4169b9[_0x310b('0x39')]:_0xd14a2c['model'];_0x4169b9[_0x310b('0x3d')]=qs[_0x310b('0x3e')](_0x341dac[_0x310b('0x35')][_0x310b('0x3e')]);_0x4169b9[_0x310b('0x44')]=qs[_0x310b('0x37')](_['pick'](_0x341dac[_0x310b('0x35')],_0xd14a2c[_0x310b('0x37')]));if(_0x341dac[_0x310b('0x35')][_0x310b('0x40')]){_0x4169b9[_0x310b('0x44')]=_[_0x310b('0x41')](_0x4169b9[_0x310b('0x44')],{'$or':_['map'](_0x4169b9[_0x310b('0x39')],function(_0x2acfad){var _0x2501b3={};_0x2501b3[_0x2acfad]={'$like':'%'+_0x341dac['query']['filter']+'%'};return _0x2501b3;})});}_0x4169b9=_[_0x310b('0x41')]({},_0x4169b9,_0x341dac[_0x310b('0x4c')]);return _0x42ff60['getTeams'](_0x4169b9);}})[_0x310b('0x27')](function(_0x5e64cb){if(_0x5e64cb){_0x2910e4=_0x5e64cb[_0x310b('0x3b')];if(!_0x341dac[_0x310b('0x35')][_0x310b('0x3c')]('nolimit')){_0x4169b9[_0x310b('0x22')]=qs[_0x310b('0x22')](_0x341dac[_0x310b('0x35')]['limit']);_0x4169b9['offset']=qs[_0x310b('0x20')](_0x341dac[_0x310b('0x35')][_0x310b('0x20')]);}return _0x42ff60[_0x310b('0x65')](_0x4169b9);}})['then'](function(_0x12a14c){if(_0x12a14c){return _0x12a14c?{'count':_0x2910e4,'rows':_0x12a14c}:null;}})[_0x310b('0x27')](respondWithResult(_0x58090b,null))[_0x310b('0x48')](handleError(_0x58090b,null));};exports['addTeams']=function(_0x5b80f7,_0x2dbd58,_0x33d769){var _0x20ed2e=_0x5b80f7['body'][_0x310b('0x66')];return db[_0x310b('0x64')][_0x310b('0x46')]({'where':{'id':_0x20ed2e},'attributes':['id'],'include':[{'model':db[_0x310b('0x5b')],'as':_0x310b('0x67'),'attributes':['id','name',_0x310b('0x68'),'voicePause',_0x310b('0x69')],'raw':!![]}]})[_0x310b('0x27')](function(_0x2e4808){if(_0x2e4808){var _0x1da338=_[_0x310b('0x6a')](_0x2e4808,function(_0x1e7a37){var _0x3af333=_0x1e7a37[_0x310b('0x29')]({'plain':!![]});return _0x3af333[_0x310b('0x67')];});return db[_0x310b('0x31')][_0x310b('0x55')]({'where':{'id':_0x5b80f7[_0x310b('0x4a')]['id']}})[_0x310b('0x27')](function(_0x5a84ed){return db[_0x310b('0x6b')][_0x310b('0x6c')](function(_0x33db31){return _0x5a84ed[_0x310b('0x6d')](_0x20ed2e,{'transaction':_0x33db31})[_0x310b('0x27')](function(){return BPromise[_0x310b('0x6e')](_0x1da338,function(_0x5e8b64){return db[_0x310b('0x58')][_0x310b('0x6f')]({'where':{'UserId':_0x5e8b64['id'],'OpenchannelQueueId':_0x5b80f7['params']['id']},'transaction':_0x33db31});});})[_0x310b('0x27')](function(){_0x1da338[_0x310b('0x70')](function(_0x2e099c){socket[_0x310b('0x71')](_0x310b('0x72'),{'UserId':_0x2e099c['id'],'OpenchannelQueueId':_0x5a84ed['id']});});});});});}})[_0x310b('0x27')](respondWithStatusCode(_0x2dbd58,null))[_0x310b('0x48')](handleError(_0x2dbd58,null));};exports[_0x310b('0x73')]=function(_0x439484,_0x55937a,_0x237156){return db[_0x310b('0x64')]['findAll']({'where':{'id':_0x439484[_0x310b('0x35')][_0x310b('0x66')]},'attributes':['id'],'include':[{'model':db[_0x310b('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x310b('0x27')](handleEntityNotFound(_0x55937a,null))['then'](function(_0x41945b){var _0x247113=_[_0x310b('0x30')](_0x41945b,'id');var _0x2c59e0=[];var _0x2a71cc=[];var _0x332b4a=squel[_0x310b('0x74')]();_0x332b4a[_0x310b('0x75')]('tq.TeamId')[_0x310b('0x76')](_0x310b('0x77'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x310b('0x44')](_0x310b('0x78'),_0x439484[_0x310b('0x4a')]['id']);for(var _0x2c4670=0x0;_0x2c4670<_0x41945b[_0x310b('0x3b')];_0x2c4670+=0x1){let _0x48bfe8=_0x41945b[_0x2c4670];for(var _0x372d1c=0x0;_0x372d1c<_0x48bfe8[_0x310b('0x67')][_0x310b('0x3b')];_0x372d1c+=0x1){let _0x5af13e=_0x48bfe8['Agents'][_0x372d1c];var _0x475852=_0x332b4a[_0x310b('0x79')]();_0x475852['where'](_0x310b('0x7a'),_0x5af13e['id']);_0x2a71cc[_0x310b('0x7b')](db[_0x310b('0x6b')][_0x310b('0x35')](_0x475852[_0x310b('0x7c')](),{'type':db[_0x310b('0x6b')]['QueryTypes'][_0x310b('0x7d')]})['then'](function(_0x584e51){if(_0x584e51[_0x310b('0x3b')]===0x1){return _0x5af13e['id'];}else{var _0x22fb90=_[_0x310b('0x7e')](_['map'](_0x584e51,_0x310b('0x7f')),function(_0x1e6467){return _['includes'](_0x247113,_0x1e6467);});if(_0x22fb90){return _0x5af13e['id'];}}}));}}return BPromise[_0x310b('0x80')](_0x2a71cc)[_0x310b('0x27')](function(_0x1aff02){_0x2c59e0=_(_0x2c59e0)[_0x310b('0x81')](_0x1aff02)[_0x310b('0x82')]()[_0x310b('0x83')]();return db[_0x310b('0x31')][_0x310b('0x55')]({'where':{'id':_0x439484[_0x310b('0x4a')]['id']}})[_0x310b('0x27')](function(_0x46b810){return db[_0x310b('0x6b')][_0x310b('0x6c')](function(_0x588f9c){return _0x46b810['removeTeams'](_0x439484[_0x310b('0x35')][_0x310b('0x66')],{'transaction':_0x588f9c})['then'](function(){if(!_[_0x310b('0x84')](_0x2c59e0)){return _0x46b810['removeAgents'](_0x2c59e0,{'transaction':_0x588f9c});}})[_0x310b('0x27')](function(){_0x2c59e0['forEach'](function(_0x465d2e){socket[_0x310b('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x465d2e,'OpenchannelQueueId':_0x46b810['id']});});});});});});})[_0x310b('0x27')](respondWithStatusCode(_0x55937a,null))[_0x310b('0x48')](handleError(_0x55937a,null));};exports[_0x310b('0x85')]=function(_0x10b9f1,_0x1d5242,_0x3d247a){return db['OpenchannelQueue'][_0x310b('0x55')]({'where':{'id':_0x10b9f1[_0x310b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d5242,null))[_0x310b('0x27')](function(_0x25982f){if(_0x25982f){return _0x25982f[_0x310b('0x85')](_0x10b9f1[_0x310b('0x4e')][_0x310b('0x66')],_['omit'](_0x10b9f1[_0x310b('0x4e')],[_0x310b('0x66'),'id'])||{})[_0x310b('0x86')](function(_0x336e43){for(var _0x1d0b5f=0x0;_0x1d0b5f<_0x10b9f1[_0x310b('0x4e')][_0x310b('0x66')][_0x310b('0x3b')];_0x1d0b5f+=0x1){socket['emit'](_0x310b('0x72'),{'UserId':Number(_0x10b9f1[_0x310b('0x4e')][_0x310b('0x66')][_0x1d0b5f]),'OpenchannelQueueId':Number(_0x10b9f1[_0x310b('0x4a')]['id'])});}return _0x336e43;});}})[_0x310b('0x27')](respondWithResult(_0x1d5242,null))[_0x310b('0x48')](handleError(_0x1d5242,null));};exports[_0x310b('0x87')]=function(_0x11bcfd,_0x41da67,_0x1b7f65){return db[_0x310b('0x31')]['find']({'where':{'id':_0x11bcfd[_0x310b('0x4a')]['id']}})[_0x310b('0x27')](handleEntityNotFound(_0x41da67,null))[_0x310b('0x27')](function(_0x2bb331){if(_0x2bb331){return _0x2bb331['removeAgents'](_0x11bcfd[_0x310b('0x35')][_0x310b('0x66')])[_0x310b('0x27')](function(){if(_[_0x310b('0x88')](_0x11bcfd[_0x310b('0x35')][_0x310b('0x66')])){for(var _0x1e197c=0x0;_0x1e197c<_0x11bcfd[_0x310b('0x35')][_0x310b('0x66')][_0x310b('0x3b')];_0x1e197c+=0x1){socket[_0x310b('0x71')](_0x310b('0x89'),{'UserId':Number(_0x11bcfd[_0x310b('0x35')][_0x310b('0x66')][_0x1e197c]),'OpenchannelQueueId':Number(_0x11bcfd['params']['id'])});}}else{socket[_0x310b('0x71')](_0x310b('0x89'),{'UserId':Number(_0x11bcfd[_0x310b('0x35')][_0x310b('0x66')]),'OpenchannelQueueId':Number(_0x11bcfd[_0x310b('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x41da67,null))[_0x310b('0x48')](handleError(_0x41da67,null));};exports[_0x310b('0x8a')]=function(_0x480b05,_0x40eae1,_0x32219d){var _0x2f0d0f={};var _0x1fe0a3={};var _0x113060;var _0x247e4c;return db['OpenchannelQueue'][_0x310b('0x63')]({'where':{'id':_0x480b05[_0x310b('0x4a')]['id']}})[_0x310b('0x27')](handleEntityNotFound(_0x40eae1,null))['then'](function(_0x2565fc){if(_0x2565fc){_0x113060=_0x2565fc;_0x1fe0a3[_0x310b('0x34')]=_[_0x310b('0x36')](db[_0x310b('0x5b')]['rawAttributes']);_0x1fe0a3[_0x310b('0x35')]=_[_0x310b('0x36')](_0x480b05[_0x310b('0x35')]);_0x1fe0a3[_0x310b('0x37')]=_[_0x310b('0x38')](_0x1fe0a3['model'],_0x1fe0a3['query']);_0x2f0d0f[_0x310b('0x39')]=_[_0x310b('0x38')](_0x1fe0a3[_0x310b('0x34')],qs[_0x310b('0x3a')](_0x480b05[_0x310b('0x35')][_0x310b('0x3a')]));_0x2f0d0f[_0x310b('0x39')]=_0x2f0d0f['attributes'][_0x310b('0x3b')]?_0x2f0d0f[_0x310b('0x39')]:_0x1fe0a3[_0x310b('0x34')];_0x2f0d0f[_0x310b('0x3d')]=qs[_0x310b('0x3e')](_0x480b05[_0x310b('0x35')][_0x310b('0x3e')]);_0x2f0d0f[_0x310b('0x44')]=qs['filters'](_[_0x310b('0x3f')](_0x480b05[_0x310b('0x35')],_0x1fe0a3['filters']));if(_0x480b05[_0x310b('0x35')][_0x310b('0x40')]){_0x2f0d0f[_0x310b('0x44')]=_[_0x310b('0x41')](_0x2f0d0f[_0x310b('0x44')],{'$or':_[_0x310b('0x30')](_0x2f0d0f[_0x310b('0x39')],function(_0x5786a5){var _0x3165be={};_0x3165be[_0x5786a5]={'$like':'%'+_0x480b05['query'][_0x310b('0x40')]+'%'};return _0x3165be;})});}_0x2f0d0f=_[_0x310b('0x41')]({},_0x2f0d0f,_0x480b05[_0x310b('0x4c')]);return _0x113060[_0x310b('0x8a')](_0x2f0d0f);}})[_0x310b('0x27')](function(_0x521713){if(_0x521713){_0x247e4c=_0x521713[_0x310b('0x3b')];if(!_0x480b05[_0x310b('0x35')][_0x310b('0x3c')](_0x310b('0x59'))){_0x2f0d0f[_0x310b('0x22')]=qs[_0x310b('0x22')](_0x480b05['query']['limit']);_0x2f0d0f[_0x310b('0x20')]=qs[_0x310b('0x20')](_0x480b05[_0x310b('0x35')][_0x310b('0x20')]);}return _0x113060[_0x310b('0x8a')](_0x2f0d0f);}})[_0x310b('0x27')](function(_0x16ad0b){if(_0x16ad0b){return _0x16ad0b?{'count':_0x247e4c,'rows':_0x16ad0b}:null;}})[_0x310b('0x27')](respondWithResult(_0x40eae1,null))[_0x310b('0x48')](handleError(_0x40eae1,null));}; \ No newline at end of file +var _0x55e6=['omit','removeAgents','userOpenchannelQueue:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelQueues','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','OpenchannelQueue','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','update','describe','getMembers','UserOpenchannelQueue','pick','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','ids','Team','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','addAgents'];(function(_0x70f07d,_0x5b8267){var _0x145f8b=function(_0x41d3b2){while(--_0x41d3b2){_0x70f07d['push'](_0x70f07d['shift']());}};_0x145f8b(++_0x5b8267);}(_0x55e6,0x119));var _0x655e=function(_0xd2f6aa,_0x240c00){_0xd2f6aa=_0xd2f6aa-0x0;var _0x2d06e8=_0x55e6[_0xd2f6aa];return _0x2d06e8;};'use strict';var emlformat=require(_0x655e('0x0'));var rimraf=require(_0x655e('0x1'));var zipdir=require(_0x655e('0x2'));var jsonpatch=require(_0x655e('0x3'));var rp=require(_0x655e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x655e('0x5'));var util=require('util');var path=require(_0x655e('0x6'));var sox=require(_0x655e('0x7'));var csv=require(_0x655e('0x8'));var ejs=require(_0x655e('0x9'));var fs=require('fs');var fs_extra=require(_0x655e('0xa'));var _=require(_0x655e('0xb'));var squel=require('squel');var crypto=require(_0x655e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x655e('0xd'));var toCsv=require(_0x655e('0x8'));var querystring=require('querystring');var Papa=require(_0x655e('0xe'));var Redis=require(_0x655e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x655e('0x10'))(_0x655e('0x11'));var utils=require(_0x655e('0x12'));var config=require(_0x655e('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x655e('0x14'))['db'];config['redis']=_[_0x655e('0x15')](config[_0x655e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x655e('0x17'))(new Redis(config[_0x655e('0x16')]));require(_0x655e('0x18'))[_0x655e('0x19')](socket);function respondWithStatusCode(_0x5a5099,_0x474b11){_0x474b11=_0x474b11||0xcc;return function(_0x4e597c){if(_0x4e597c){return _0x5a5099['sendStatus'](_0x474b11);}return _0x5a5099[_0x655e('0x1a')](_0x474b11)[_0x655e('0x1b')]();};}function respondWithResult(_0x2bb93c,_0x3d3e60){_0x3d3e60=_0x3d3e60||0xc8;return function(_0x53cd82){if(_0x53cd82){return _0x2bb93c[_0x655e('0x1a')](_0x3d3e60)[_0x655e('0x1c')](_0x53cd82);}};}function respondWithFilteredResult(_0x3a8810,_0x52a822){return function(_0x4fb103){if(_0x4fb103){var _0x4d48aa=typeof _0x52a822[_0x655e('0x1d')]===_0x655e('0x1e')&&typeof _0x52a822[_0x655e('0x1f')]===_0x655e('0x1e');var _0x22a0e9=_0x4fb103[_0x655e('0x20')];var _0x2ca7ef=_0x4d48aa?0x0:_0x52a822[_0x655e('0x1d')];var _0x20c2e0=_0x4d48aa?_0x4fb103[_0x655e('0x20')]:_0x52a822[_0x655e('0x1d')]+_0x52a822[_0x655e('0x1f')];var _0x39d438;if(_0x20c2e0>=_0x22a0e9){_0x20c2e0=_0x22a0e9;_0x39d438=0xc8;}else{_0x39d438=0xce;}_0x3a8810[_0x655e('0x1a')](_0x39d438);return _0x3a8810[_0x655e('0x21')](_0x655e('0x22'),_0x2ca7ef+'-'+_0x20c2e0+'/'+_0x22a0e9)['json'](_0x4fb103);}return null;};}function patchUpdates(_0x26c8ad){return function(_0x50ad52){try{jsonpatch[_0x655e('0x23')](_0x50ad52,_0x26c8ad,!![]);}catch(_0x17bc4d){return BPromise[_0x655e('0x24')](_0x17bc4d);}return _0x50ad52[_0x655e('0x25')]();};}function saveUpdates(_0x4a70db,_0x3ab84f){return function(_0x27dc3e){if(_0x27dc3e){return _0x27dc3e['update'](_0x4a70db)[_0x655e('0x26')](function(_0x982774){return _0x982774;});}return null;};}function removeEntity(_0x210f62,_0x305f17){return function(_0x2e47dc){if(_0x2e47dc){return _0x2e47dc[_0x655e('0x27')]()[_0x655e('0x26')](function(){var _0x4be8cc=_0x2e47dc[_0x655e('0x28')]({'plain':!![]});var _0x48e04c=_0x655e('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x48e04c,'resourceId':_0x4be8cc['id']}})[_0x655e('0x26')](function(){return _0x2e47dc;});})[_0x655e('0x26')](function(){_0x210f62[_0x655e('0x1a')](0xcc)[_0x655e('0x1b')]();});}};}function handleEntityNotFound(_0x2a93bd,_0x261e4f){return function(_0x37ff69){if(!_0x37ff69){_0x2a93bd['sendStatus'](0x194);}return _0x37ff69;};}function handleError(_0x238bd1,_0x51882a){_0x51882a=_0x51882a||0x1f4;return function(_0x39c8c8){logger[_0x655e('0x2a')](_0x39c8c8[_0x655e('0x2b')]);if(_0x39c8c8[_0x655e('0x2c')]){delete _0x39c8c8[_0x655e('0x2c')];}_0x238bd1[_0x655e('0x1a')](_0x51882a)[_0x655e('0x2d')](_0x39c8c8);};}exports[_0x655e('0x2e')]=function(_0x371fd0,_0x470b0c){var _0x25bac6={},_0x208622={},_0x2b5576={'count':0x0,'rows':[]};var _0x78fab6=_[_0x655e('0x2f')](db['OpenchannelQueue'][_0x655e('0x30')],function(_0x5d82df){return{'name':_0x5d82df['fieldName'],'type':_0x5d82df['type'][_0x655e('0x31')]};});_0x208622[_0x655e('0x32')]=_['map'](_0x78fab6,_0x655e('0x2c'));_0x208622[_0x655e('0x33')]=_[_0x655e('0x34')](_0x371fd0[_0x655e('0x33')]);_0x208622[_0x655e('0x35')]=_['intersection'](_0x208622[_0x655e('0x32')],_0x208622[_0x655e('0x33')]);_0x25bac6[_0x655e('0x36')]=_[_0x655e('0x37')](_0x208622[_0x655e('0x32')],qs['fields'](_0x371fd0[_0x655e('0x33')][_0x655e('0x38')]));_0x25bac6[_0x655e('0x36')]=_0x25bac6[_0x655e('0x36')][_0x655e('0x39')]?_0x25bac6[_0x655e('0x36')]:_0x208622[_0x655e('0x32')];if(!_0x371fd0[_0x655e('0x33')][_0x655e('0x3a')](_0x655e('0x3b'))){_0x25bac6[_0x655e('0x1f')]=qs[_0x655e('0x1f')](_0x371fd0[_0x655e('0x33')][_0x655e('0x1f')]);_0x25bac6[_0x655e('0x1d')]=qs[_0x655e('0x1d')](_0x371fd0[_0x655e('0x33')][_0x655e('0x1d')]);}_0x25bac6[_0x655e('0x3c')]=qs['sort'](_0x371fd0['query'][_0x655e('0x3d')]);_0x25bac6[_0x655e('0x3e')]=qs[_0x655e('0x35')](_['pick'](_0x371fd0[_0x655e('0x33')],_0x208622[_0x655e('0x35')]),_0x78fab6);if(_0x371fd0['query'][_0x655e('0x3f')]){_0x25bac6[_0x655e('0x3e')]=_[_0x655e('0x40')](_0x25bac6[_0x655e('0x3e')],{'$or':_[_0x655e('0x2f')](_0x78fab6,function(_0x37c2a1){if(_0x37c2a1['type']!==_0x655e('0x41')){var _0x111a34={};_0x111a34[_0x37c2a1['name']]={'$like':'%'+_0x371fd0[_0x655e('0x33')]['filter']+'%'};return _0x111a34;}})});}_0x25bac6=_[_0x655e('0x40')]({},_0x25bac6,_0x371fd0[_0x655e('0x42')]);var _0x462ccd={'where':_0x25bac6[_0x655e('0x3e')]};return db['OpenchannelQueue']['count'](_0x462ccd)[_0x655e('0x26')](function(_0x235ec1){_0x2b5576[_0x655e('0x20')]=_0x235ec1;if(_0x371fd0[_0x655e('0x33')]['includeAll']){_0x25bac6[_0x655e('0x43')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x655e('0x44')](_0x25bac6);})[_0x655e('0x26')](function(_0x4a2c1f){_0x2b5576[_0x655e('0x45')]=_0x4a2c1f;return _0x2b5576;})[_0x655e('0x26')](respondWithFilteredResult(_0x470b0c,_0x25bac6))['catch'](handleError(_0x470b0c,null));};exports['show']=function(_0x1fb7fb,_0x55506c){var _0x5c0235={'raw':!![],'where':{'id':_0x1fb7fb[_0x655e('0x46')]['id']}},_0x1e72f1={};_0x1e72f1['model']=_['keys'](db['OpenchannelQueue']['rawAttributes']);_0x1e72f1[_0x655e('0x33')]=_['keys'](_0x1fb7fb['query']);_0x1e72f1['filters']=_['intersection'](_0x1e72f1[_0x655e('0x32')],_0x1e72f1['query']);_0x5c0235[_0x655e('0x36')]=_[_0x655e('0x37')](_0x1e72f1[_0x655e('0x32')],qs[_0x655e('0x38')](_0x1fb7fb['query']['fields']));_0x5c0235['attributes']=_0x5c0235[_0x655e('0x36')][_0x655e('0x39')]?_0x5c0235[_0x655e('0x36')]:_0x1e72f1['model'];if(_0x1fb7fb[_0x655e('0x33')][_0x655e('0x47')]){_0x5c0235['include']=[{'all':!![]}];}_0x5c0235=_['merge']({},_0x5c0235,_0x1fb7fb['options']);return db[_0x655e('0x48')][_0x655e('0x49')](_0x5c0235)[_0x655e('0x26')](handleEntityNotFound(_0x55506c,null))[_0x655e('0x26')](respondWithResult(_0x55506c,null))[_0x655e('0x4a')](handleError(_0x55506c,null));};exports['create']=function(_0x37e48b,_0x382164){return db[_0x655e('0x48')]['create'](_0x37e48b[_0x655e('0x4b')],{})[_0x655e('0x26')](function(_0x2cdc6d){var _0x2671ef=_0x37e48b[_0x655e('0x4c')][_0x655e('0x28')]({'plain':!![]});if(!_0x2671ef)throw new Error(_0x655e('0x4d'));if(_0x2671ef[_0x655e('0x4e')]===_0x655e('0x4c')){var _0x419a10=_0x2cdc6d[_0x655e('0x28')]({'plain':!![]});var _0x2bb481=_0x655e('0x29');return db[_0x655e('0x4f')][_0x655e('0x49')]({'where':{'name':_0x2bb481,'userProfileId':_0x2671ef[_0x655e('0x50')]},'raw':!![]})['then'](function(_0xb107a3){if(_0xb107a3&&_0xb107a3[_0x655e('0x51')]===0x0){return db[_0x655e('0x52')][_0x655e('0x53')]({'name':_0x419a10[_0x655e('0x2c')],'resourceId':_0x419a10['id'],'type':_0xb107a3['name'],'sectionId':_0xb107a3['id']},{})['then'](function(){return _0x2cdc6d;});}else{return _0x2cdc6d;}})['catch'](function(_0x1ef4bc){logger[_0x655e('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ef4bc);throw _0x1ef4bc;});}return _0x2cdc6d;})[_0x655e('0x26')](respondWithResult(_0x382164,0xc9))[_0x655e('0x4a')](handleError(_0x382164,null));};exports[_0x655e('0x54')]=function(_0x2ff012,_0x25b09a){if(_0x2ff012[_0x655e('0x4b')]['id']){delete _0x2ff012['body']['id'];}return db[_0x655e('0x48')][_0x655e('0x49')]({'where':{'id':_0x2ff012[_0x655e('0x46')]['id']}})[_0x655e('0x26')](handleEntityNotFound(_0x25b09a,null))[_0x655e('0x26')](saveUpdates(_0x2ff012[_0x655e('0x4b')],null))[_0x655e('0x26')](respondWithResult(_0x25b09a,null))['catch'](handleError(_0x25b09a,null));};exports[_0x655e('0x27')]=function(_0x33954c,_0x15abb1){return db['OpenchannelQueue'][_0x655e('0x49')]({'where':{'id':_0x33954c[_0x655e('0x46')]['id']}})[_0x655e('0x26')](handleEntityNotFound(_0x15abb1,null))[_0x655e('0x26')](removeEntity(_0x15abb1,null))[_0x655e('0x4a')](handleError(_0x15abb1,null));};exports[_0x655e('0x55')]=function(_0x6f08fa,_0x169cfa){return db[_0x655e('0x48')][_0x655e('0x55')]()['then'](respondWithResult(_0x169cfa,null))[_0x655e('0x4a')](handleError(_0x169cfa,null));};exports[_0x655e('0x56')]=function(_0x49da70,_0x1c38cf,_0x119bb3){var _0x1da11c={'raw':!![],'where':{}},_0x43996d={},_0x2c7da3;return db[_0x655e('0x48')]['findOne']({'where':{'id':_0x49da70[_0x655e('0x46')]['id']}})[_0x655e('0x26')](handleEntityNotFound(_0x1c38cf,null))[_0x655e('0x26')](function(_0x2bda77){if(_0x2bda77){_0x2c7da3=_0x2bda77[_0x655e('0x28')]({'plain':!![]});_0x43996d[_0x655e('0x32')]=_['keys'](db[_0x655e('0x57')][_0x655e('0x30')]);_0x43996d[_0x655e('0x33')]=_['keys'](_0x49da70['query']);_0x43996d[_0x655e('0x35')]=_['intersection'](_0x43996d[_0x655e('0x32')],_0x43996d[_0x655e('0x33')]);_0x1da11c[_0x655e('0x36')]=_['intersection'](_0x43996d[_0x655e('0x32')],qs['fields'](_0x49da70[_0x655e('0x33')][_0x655e('0x38')]));_0x1da11c['attributes']=_0x1da11c['attributes'][_0x655e('0x39')]?_0x1da11c[_0x655e('0x36')]:_0x43996d[_0x655e('0x32')];if(!_0x49da70[_0x655e('0x33')][_0x655e('0x3a')](_0x655e('0x3b'))){_0x1da11c[_0x655e('0x1f')]=qs[_0x655e('0x1f')](_0x49da70['query'][_0x655e('0x1f')]);_0x1da11c[_0x655e('0x1d')]=qs[_0x655e('0x1d')](_0x49da70[_0x655e('0x33')][_0x655e('0x1d')]);}_0x1da11c[_0x655e('0x3c')]=qs['sort'](_0x49da70[_0x655e('0x33')][_0x655e('0x3d')]);_0x1da11c['where']=qs[_0x655e('0x35')](_[_0x655e('0x58')](_0x49da70[_0x655e('0x33')],_0x43996d[_0x655e('0x35')]));_0x1da11c[_0x655e('0x3e')][_0x655e('0x59')]=_0x2bda77['id'];if(_0x49da70[_0x655e('0x33')][_0x655e('0x3f')]){_0x1da11c[_0x655e('0x3e')]=_[_0x655e('0x40')](_0x1da11c[_0x655e('0x3e')],{'$or':_[_0x655e('0x2f')](_0x1da11c[_0x655e('0x36')],function(_0x1cb90b){var _0x5f3973={};_0x5f3973[_0x1cb90b]={'$like':'%'+_0x49da70[_0x655e('0x33')][_0x655e('0x3f')]+'%'};return _0x5f3973;})});}_0x1da11c=_[_0x655e('0x40')]({},_0x1da11c,_0x49da70[_0x655e('0x42')]);return db[_0x655e('0x57')][_0x655e('0x44')](_0x1da11c);}})[_0x655e('0x26')](function(_0x1a49ae){if(_0x1a49ae){return db[_0x655e('0x5a')]['findAndCountAll']({'where':{'id':_['map'](_0x1a49ae,_0x655e('0x5b')),'role':_0x655e('0x5c')},'attributes':['id',_0x655e('0x2c'),_0x655e('0x5d'),_0x655e('0x5e'),_0x655e('0x5f')]});}})[_0x655e('0x26')](function(_0x23eff4){if(_0x23eff4){return{'count':_0x23eff4[_0x655e('0x20')],'rows':_['map'](_0x23eff4[_0x655e('0x45')],function(_0x1d1426){return{'membername':_0x1d1426[_0x655e('0x2c')],'UserId':_0x1d1426['id'],'queue_name':_0x2c7da3[_0x655e('0x2c')],'OpenchannelQueueId':_0x2c7da3['id'],'interface':util[_0x655e('0x60')](_0x655e('0x61'),_0x655e('0x62'),_0x1d1426[_0x655e('0x2c')]),'penalty':0x0,'paused':_0x1d1426[_0x655e('0x5d')],'createdAt':_0x1d1426[_0x655e('0x5f')],'updatedAt':_0x1d1426[_0x655e('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1c38cf,_0x1da11c))['catch'](handleError(_0x1c38cf,null));};exports[_0x655e('0x63')]=function(_0x25f722,_0x475a7d,_0x3e50c8){var _0x150dea={};var _0x5367c6={};var _0x3b4cea;var _0x182bc1;return db[_0x655e('0x48')][_0x655e('0x64')]({'where':{'id':_0x25f722[_0x655e('0x46')]['id']}})[_0x655e('0x26')](handleEntityNotFound(_0x475a7d,null))[_0x655e('0x26')](function(_0xd54614){if(_0xd54614){_0x3b4cea=_0xd54614;_0x5367c6[_0x655e('0x32')]=_[_0x655e('0x34')](db['Team']['rawAttributes']);_0x5367c6[_0x655e('0x33')]=_[_0x655e('0x34')](_0x25f722[_0x655e('0x33')]);_0x5367c6[_0x655e('0x35')]=_['intersection'](_0x5367c6[_0x655e('0x32')],_0x5367c6[_0x655e('0x33')]);_0x150dea[_0x655e('0x36')]=_['intersection'](_0x5367c6[_0x655e('0x32')],qs[_0x655e('0x38')](_0x25f722[_0x655e('0x33')][_0x655e('0x38')]));_0x150dea[_0x655e('0x36')]=_0x150dea[_0x655e('0x36')]['length']?_0x150dea[_0x655e('0x36')]:_0x5367c6[_0x655e('0x32')];_0x150dea['order']=qs['sort'](_0x25f722[_0x655e('0x33')]['sort']);_0x150dea[_0x655e('0x3e')]=qs[_0x655e('0x35')](_['pick'](_0x25f722[_0x655e('0x33')],_0x5367c6[_0x655e('0x35')]));if(_0x25f722['query'][_0x655e('0x3f')]){_0x150dea[_0x655e('0x3e')]=_[_0x655e('0x40')](_0x150dea[_0x655e('0x3e')],{'$or':_['map'](_0x150dea[_0x655e('0x36')],function(_0x1a340c){var _0x25e81c={};_0x25e81c[_0x1a340c]={'$like':'%'+_0x25f722[_0x655e('0x33')][_0x655e('0x3f')]+'%'};return _0x25e81c;})});}_0x150dea=_[_0x655e('0x40')]({},_0x150dea,_0x25f722[_0x655e('0x42')]);return _0x3b4cea[_0x655e('0x63')](_0x150dea);}})[_0x655e('0x26')](function(_0x3ae6fc){if(_0x3ae6fc){_0x182bc1=_0x3ae6fc[_0x655e('0x39')];if(!_0x25f722[_0x655e('0x33')][_0x655e('0x3a')](_0x655e('0x3b'))){_0x150dea[_0x655e('0x1f')]=qs[_0x655e('0x1f')](_0x25f722[_0x655e('0x33')][_0x655e('0x1f')]);_0x150dea[_0x655e('0x1d')]=qs['offset'](_0x25f722[_0x655e('0x33')]['offset']);}return _0x3b4cea[_0x655e('0x63')](_0x150dea);}})[_0x655e('0x26')](function(_0x42ae8f){if(_0x42ae8f){return _0x42ae8f?{'count':_0x182bc1,'rows':_0x42ae8f}:null;}})['then'](respondWithResult(_0x475a7d,null))['catch'](handleError(_0x475a7d,null));};exports['addTeams']=function(_0x24fe1c,_0x1fcdb7,_0x4d06bd){var _0x501c71=_0x24fe1c[_0x655e('0x4b')][_0x655e('0x65')];return db[_0x655e('0x66')][_0x655e('0x44')]({'where':{'id':_0x501c71},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0x655e('0x67'),_0x655e('0x68')],'raw':!![]}]})['then'](function(_0x543960){if(_0x543960){var _0x4069db=_[_0x655e('0x69')](_0x543960,function(_0x1fa2f6){var _0x112b14=_0x1fa2f6[_0x655e('0x28')]({'plain':!![]});return _0x112b14[_0x655e('0x6a')];});return db[_0x655e('0x48')][_0x655e('0x49')]({'where':{'id':_0x24fe1c[_0x655e('0x46')]['id']}})[_0x655e('0x26')](function(_0x475eb0){return db[_0x655e('0x6b')][_0x655e('0x6c')](function(_0x49ed3b){return _0x475eb0[_0x655e('0x6d')](_0x501c71,{'transaction':_0x49ed3b})[_0x655e('0x26')](function(){return BPromise[_0x655e('0x6e')](_0x4069db,function(_0x234fbf){return db[_0x655e('0x57')][_0x655e('0x6f')]({'where':{'UserId':_0x234fbf['id'],'OpenchannelQueueId':_0x24fe1c[_0x655e('0x46')]['id']},'transaction':_0x49ed3b});});})[_0x655e('0x26')](function(){_0x4069db[_0x655e('0x70')](function(_0xfce923){socket[_0x655e('0x71')](_0x655e('0x72'),{'UserId':_0xfce923['id'],'OpenchannelQueueId':_0x475eb0['id']});});});});});}})[_0x655e('0x26')](respondWithStatusCode(_0x1fcdb7,null))[_0x655e('0x4a')](handleError(_0x1fcdb7,null));};exports[_0x655e('0x73')]=function(_0x23f37f,_0x1a7cde,_0x548a40){return db[_0x655e('0x66')]['findAll']({'where':{'id':_0x23f37f[_0x655e('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x655e('0x5a')],'as':_0x655e('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1a7cde,null))[_0x655e('0x26')](function(_0x437261){var _0x29d791=_[_0x655e('0x2f')](_0x437261,'id');var _0x6878ee=[];var _0x183bfb=[];var _0x41c5e8=squel['select']();_0x41c5e8[_0x655e('0x74')]('tq.TeamId')[_0x655e('0x75')](_0x655e('0x76'),'tq')[_0x655e('0x77')](_0x655e('0x78'),'ut',_0x655e('0x79'))[_0x655e('0x3e')](_0x655e('0x7a'),_0x23f37f[_0x655e('0x46')]['id']);for(var _0x46767f=0x0;_0x46767f<_0x437261['length'];_0x46767f+=0x1){let _0x5584d5=_0x437261[_0x46767f];for(var _0x611e8b=0x0;_0x611e8b<_0x5584d5['Agents']['length'];_0x611e8b+=0x1){let _0x3d2823=_0x5584d5[_0x655e('0x6a')][_0x611e8b];var _0x2ac855=_0x41c5e8[_0x655e('0x7b')]();_0x2ac855['where'](_0x655e('0x7c'),_0x3d2823['id']);_0x183bfb[_0x655e('0x7d')](db[_0x655e('0x6b')][_0x655e('0x33')](_0x2ac855['toString'](),{'type':db['sequelize'][_0x655e('0x7e')][_0x655e('0x7f')]})['then'](function(_0x5f1a37){if(_0x5f1a37[_0x655e('0x39')]===0x1){return _0x3d2823['id'];}else{var _0x480bf7=_[_0x655e('0x80')](_[_0x655e('0x2f')](_0x5f1a37,_0x655e('0x81')),function(_0x8767a2){return _[_0x655e('0x82')](_0x29d791,_0x8767a2);});if(_0x480bf7){return _0x3d2823['id'];}}}));}}return BPromise[_0x655e('0x83')](_0x183bfb)[_0x655e('0x26')](function(_0x1884ba){_0x6878ee=_(_0x6878ee)[_0x655e('0x84')](_0x1884ba)[_0x655e('0x85')]()['value']();return db[_0x655e('0x48')][_0x655e('0x49')]({'where':{'id':_0x23f37f[_0x655e('0x46')]['id']}})[_0x655e('0x26')](function(_0xe0677e){return db[_0x655e('0x6b')][_0x655e('0x6c')](function(_0x2f843f){return _0xe0677e[_0x655e('0x73')](_0x23f37f[_0x655e('0x33')][_0x655e('0x65')],{'transaction':_0x2f843f})[_0x655e('0x26')](function(){if(!_[_0x655e('0x86')](_0x6878ee)){return _0xe0677e['removeAgents'](_0x6878ee,{'transaction':_0x2f843f});}})[_0x655e('0x26')](function(){_0x6878ee['forEach'](function(_0x1ef355){socket[_0x655e('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x1ef355,'OpenchannelQueueId':_0xe0677e['id']});});});});});});})[_0x655e('0x26')](respondWithStatusCode(_0x1a7cde,null))['catch'](handleError(_0x1a7cde,null));};exports['addAgents']=function(_0xb38d08,_0x5b412a,_0x1d5964){return db['OpenchannelQueue']['find']({'where':{'id':_0xb38d08[_0x655e('0x46')]['id']}})[_0x655e('0x26')](handleEntityNotFound(_0x5b412a,null))[_0x655e('0x26')](function(_0x336631){if(_0x336631){return _0x336631[_0x655e('0x87')](_0xb38d08[_0x655e('0x4b')][_0x655e('0x65')],_[_0x655e('0x88')](_0xb38d08[_0x655e('0x4b')],['ids','id'])||{})['spread'](function(_0x360e2e){for(var _0x57229f=0x0;_0x57229f<_0xb38d08[_0x655e('0x4b')][_0x655e('0x65')][_0x655e('0x39')];_0x57229f+=0x1){socket['emit'](_0x655e('0x72'),{'UserId':Number(_0xb38d08[_0x655e('0x4b')][_0x655e('0x65')][_0x57229f]),'OpenchannelQueueId':Number(_0xb38d08['params']['id'])});}return _0x360e2e;});}})[_0x655e('0x26')](respondWithResult(_0x5b412a,null))['catch'](handleError(_0x5b412a,null));};exports[_0x655e('0x89')]=function(_0x1e1848,_0x1a0c0c,_0x61eea0){return db[_0x655e('0x48')][_0x655e('0x49')]({'where':{'id':_0x1e1848[_0x655e('0x46')]['id']}})[_0x655e('0x26')](handleEntityNotFound(_0x1a0c0c,null))[_0x655e('0x26')](function(_0x20791b){if(_0x20791b){return _0x20791b[_0x655e('0x89')](_0x1e1848['query'][_0x655e('0x65')])[_0x655e('0x26')](function(){if(_['isArray'](_0x1e1848['query'][_0x655e('0x65')])){for(var _0x1515b8=0x0;_0x1515b8<_0x1e1848['query'][_0x655e('0x65')][_0x655e('0x39')];_0x1515b8+=0x1){socket[_0x655e('0x71')](_0x655e('0x8a'),{'UserId':Number(_0x1e1848[_0x655e('0x33')][_0x655e('0x65')][_0x1515b8]),'OpenchannelQueueId':Number(_0x1e1848[_0x655e('0x46')]['id'])});}}else{socket[_0x655e('0x71')](_0x655e('0x8a'),{'UserId':Number(_0x1e1848[_0x655e('0x33')][_0x655e('0x65')]),'OpenchannelQueueId':Number(_0x1e1848[_0x655e('0x46')]['id'])});}});}})[_0x655e('0x26')](respondWithStatusCode(_0x1a0c0c,null))['catch'](handleError(_0x1a0c0c,null));};exports['getAgents']=function(_0x5cfded,_0x1737bd,_0x3da2b9){var _0x3fb0c2={};var _0x3aba04={};var _0x5c778f;var _0x1ba6a5;return db[_0x655e('0x48')][_0x655e('0x64')]({'where':{'id':_0x5cfded[_0x655e('0x46')]['id']}})[_0x655e('0x26')](handleEntityNotFound(_0x1737bd,null))[_0x655e('0x26')](function(_0x1da408){if(_0x1da408){_0x5c778f=_0x1da408;_0x3aba04[_0x655e('0x32')]=_[_0x655e('0x34')](db['User'][_0x655e('0x30')]);_0x3aba04['query']=_[_0x655e('0x34')](_0x5cfded[_0x655e('0x33')]);_0x3aba04[_0x655e('0x35')]=_[_0x655e('0x37')](_0x3aba04['model'],_0x3aba04['query']);_0x3fb0c2[_0x655e('0x36')]=_['intersection'](_0x3aba04[_0x655e('0x32')],qs[_0x655e('0x38')](_0x5cfded[_0x655e('0x33')][_0x655e('0x38')]));_0x3fb0c2[_0x655e('0x36')]=_0x3fb0c2[_0x655e('0x36')][_0x655e('0x39')]?_0x3fb0c2[_0x655e('0x36')]:_0x3aba04[_0x655e('0x32')];_0x3fb0c2[_0x655e('0x3c')]=qs['sort'](_0x5cfded['query'][_0x655e('0x3d')]);_0x3fb0c2[_0x655e('0x3e')]=qs[_0x655e('0x35')](_[_0x655e('0x58')](_0x5cfded[_0x655e('0x33')],_0x3aba04[_0x655e('0x35')]));if(_0x5cfded[_0x655e('0x33')][_0x655e('0x3f')]){_0x3fb0c2[_0x655e('0x3e')]=_[_0x655e('0x40')](_0x3fb0c2[_0x655e('0x3e')],{'$or':_[_0x655e('0x2f')](_0x3fb0c2['attributes'],function(_0x554899){var _0xbda90f={};_0xbda90f[_0x554899]={'$like':'%'+_0x5cfded[_0x655e('0x33')]['filter']+'%'};return _0xbda90f;})});}_0x3fb0c2=_['merge']({},_0x3fb0c2,_0x5cfded[_0x655e('0x42')]);return _0x5c778f['getAgents'](_0x3fb0c2);}})[_0x655e('0x26')](function(_0x547ede){if(_0x547ede){_0x1ba6a5=_0x547ede['length'];if(!_0x5cfded['query'][_0x655e('0x3a')]('nolimit')){_0x3fb0c2['limit']=qs[_0x655e('0x1f')](_0x5cfded[_0x655e('0x33')]['limit']);_0x3fb0c2['offset']=qs['offset'](_0x5cfded[_0x655e('0x33')][_0x655e('0x1d')]);}return _0x5c778f['getAgents'](_0x3fb0c2);}})[_0x655e('0x26')](function(_0x542788){if(_0x542788){return _0x542788?{'count':_0x1ba6a5,'rows':_0x542788}:null;}})['then'](respondWithResult(_0x1737bd,null))[_0x655e('0x4a')](handleError(_0x1737bd,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6f5b5bf..6ac9fe0 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 _0x9297=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3a7f7b,_0x22f0f8){var _0x48b64b=function(_0x57ac88){while(--_0x57ac88){_0x3a7f7b['push'](_0x3a7f7b['shift']());}};_0x48b64b(++_0x22f0f8);}(_0x9297,0x172));var _0x7929=function(_0xe60131,_0x1316fb){_0xe60131=_0xe60131-0x0;var _0x4c6124=_0x9297[_0xe60131];return _0x4c6124;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x7929('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x7929('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5bc6a6){return function(_0x23fe9c,_0x2bee00,_0x4f1543){OpenchannelQueueEvents[_0x7929('0x2')](_0x5bc6a6+':'+_0x23fe9c['id'],_0x23fe9c);OpenchannelQueueEvents[_0x7929('0x2')](_0x5bc6a6,_0x23fe9c);_0x4f1543(null);};}for(var e in events){if(events[_0x7929('0x3')](e)){var event=events[e];OpenchannelQueue[_0x7929('0x4')](e,emitEvent(event));}}module[_0x7929('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xd222=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','OpenchannelQueue'];(function(_0x3ff040,_0x4c9fd0){var _0x54161b=function(_0x4648d8){while(--_0x4648d8){_0x3ff040['push'](_0x3ff040['shift']());}};_0x54161b(++_0x4c9fd0);}(_0xd222,0x9e));var _0x2d22=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xd222[_0x352e09];return _0x1b7094;};'use strict';var EventEmitter=require(_0x2d22('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x2d22('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2d22('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d22('0x3'),'afterDestroy':_0x2d22('0x4')};function emitEvent(_0x179283){return function(_0x1906be,_0xc82883,_0x476496){OpenchannelQueueEvents[_0x2d22('0x5')](_0x179283+':'+_0x1906be['id'],_0x1906be);OpenchannelQueueEvents[_0x2d22('0x5')](_0x179283,_0x1906be);_0x476496(null);};}for(var e in events){if(events[_0x2d22('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x2d22('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 0523ae9..e78fa13 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 _0xd139=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x5665b6,_0x5678d0){var _0x2196ce=function(_0x2166e4){while(--_0x2166e4){_0x5665b6['push'](_0x5665b6['shift']());}};_0x2196ce(++_0x5678d0);}(_0xd139,0x76));var _0x9d13=function(_0x555374,_0x4a7e37){_0x555374=_0x555374-0x0;var _0x3a5e0e=_0xd139[_0x555374];return _0x3a5e0e;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var logger=require(_0x9d13('0x2'))(_0x9d13('0x3'));var moment=require(_0x9d13('0x4'));var BPromise=require(_0x9d13('0x5'));var rp=require(_0x9d13('0x6'));var fs=require('fs');var path=require(_0x9d13('0x7'));var rimraf=require(_0x9d13('0x8'));var config=require(_0x9d13('0x9'));var attributes=require(_0x9d13('0xa'));module[_0x9d13('0xb')]=function(_0x5063a2,_0x36d362){return _0x5063a2[_0x9d13('0xc')](_0x9d13('0xd'),attributes,{'tableName':_0x9d13('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03da=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','lodash','util'];(function(_0x31ffe9,_0x3db803){var _0x59cc8c=function(_0x28c0e7){while(--_0x28c0e7){_0x31ffe9['push'](_0x31ffe9['shift']());}};_0x59cc8c(++_0x3db803);}(_0x03da,0x1a0));var _0xa03d=function(_0x54b892,_0x2a3009){_0x54b892=_0x54b892-0x0;var _0x1256e1=_0x03da[_0x54b892];return _0x1256e1;};'use strict';var _=require(_0xa03d('0x0'));var util=require(_0xa03d('0x1'));var logger=require(_0xa03d('0x2'))('api');var moment=require(_0xa03d('0x3'));var BPromise=require(_0xa03d('0x4'));var rp=require(_0xa03d('0x5'));var fs=require('fs');var path=require(_0xa03d('0x6'));var rimraf=require(_0xa03d('0x7'));var config=require('../../config/environment');var attributes=require(_0xa03d('0x8'));module[_0xa03d('0x9')]=function(_0xf8ee79,_0x387ae4){return _0xf8ee79[_0xa03d('0xa')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 809bd4a..98cfd3e 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 _0xea3a=['raw','where','attributes','include','map','model','find','ShowOpenchannelQueue','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','options'];(function(_0x9861ff,_0x41fb17){var _0x48852b=function(_0x557001){while(--_0x557001){_0x9861ff['push'](_0x9861ff['shift']());}};_0x48852b(++_0x41fb17);}(_0xea3a,0xec));var _0xaea3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xea3a[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xaea3('0x0'));var util=require('util');var moment=require(_0xaea3('0x1'));var BPromise=require(_0xaea3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaea3('0x3'));var db=require(_0xaea3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaea3('0x5'));var config=require(_0xaea3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaea3('0x7')][_0xaea3('0x8')]({'port':0x232a});config[_0xaea3('0x9')]=_[_0xaea3('0xa')](config[_0xaea3('0x9')],{'host':_0xaea3('0xb'),'port':0x18eb});var socket=require(_0xaea3('0xc'))(new Redis(config[_0xaea3('0x9')]));require(_0xaea3('0xd'))[_0xaea3('0xe')](socket);function respondWithRpcPromise(_0x5a6728,_0x3d37ca,_0x3f02ef){return new BPromise(function(_0x5e9e79,_0x2db10f){return client[_0xaea3('0xf')](_0x5a6728,_0x3f02ef)[_0xaea3('0x10')](function(_0x2c3e4e){logger[_0xaea3('0x11')](_0xaea3('0x12'),_0x3d37ca,_0xaea3('0x13'));logger[_0xaea3('0x14')](_0xaea3('0x15'),_0x3d37ca,_0xaea3('0x13'),JSON[_0xaea3('0x16')](_0x2c3e4e));if(_0x2c3e4e[_0xaea3('0x17')]){if(_0x2c3e4e[_0xaea3('0x17')][_0xaea3('0x18')]===0x1f4){logger[_0xaea3('0x17')](_0xaea3('0x12'),_0x3d37ca,_0x2c3e4e['error'][_0xaea3('0x19')]);return _0x2db10f(_0x2c3e4e[_0xaea3('0x17')][_0xaea3('0x19')]);}logger[_0xaea3('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x3d37ca,_0x2c3e4e['error'][_0xaea3('0x19')]);return _0x5e9e79(_0x2c3e4e[_0xaea3('0x17')]['message']);}else{logger[_0xaea3('0x11')](_0xaea3('0x12'),_0x3d37ca,_0xaea3('0x13'));_0x5e9e79(_0x2c3e4e['result'][_0xaea3('0x19')]);}})[_0xaea3('0x1a')](function(_0xbaa9d3){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3d37ca,_0xbaa9d3);_0x2db10f(_0xbaa9d3);});});}exports[_0xaea3('0x1b')]=function(_0x591042){var _0x230bf1=this;return new Promise(function(_0x155250,_0x218492){return db[_0xaea3('0x1c')]['findAll']({'raw':_0x591042['options']?_0x591042[_0xaea3('0x1d')][_0xaea3('0x1e')]===undefined?!![]:![]:!![],'where':_0x591042[_0xaea3('0x1d')]?_0x591042['options'][_0xaea3('0x1f')]||null:null,'attributes':_0x591042[_0xaea3('0x1d')]?_0x591042[_0xaea3('0x1d')][_0xaea3('0x20')]||null:null,'limit':_0x591042[_0xaea3('0x1d')]?_0x591042[_0xaea3('0x1d')]['limit']||null:null,'include':_0x591042[_0xaea3('0x1d')]?_0x591042[_0xaea3('0x1d')][_0xaea3('0x21')]?_[_0xaea3('0x22')](_0x591042[_0xaea3('0x1d')][_0xaea3('0x21')],function(_0x3ea9f1){return{'model':db[_0x3ea9f1[_0xaea3('0x23')]],'as':_0x3ea9f1['as'],'attributes':_0x3ea9f1[_0xaea3('0x20')],'include':_0x3ea9f1[_0xaea3('0x21')]?_['map'](_0x3ea9f1['include'],function(_0x5ced76){return{'model':db[_0x5ced76[_0xaea3('0x23')]],'as':_0x5ced76['as'],'attributes':_0x5ced76[_0xaea3('0x20')],'include':_0x5ced76['include']?_[_0xaea3('0x22')](_0x5ced76[_0xaea3('0x21')],function(_0x396bec){return{'model':db[_0x396bec[_0xaea3('0x23')]],'as':_0x396bec['as'],'attributes':_0x396bec['attributes']};}):[]};}):[]};}):[]:[]})[_0xaea3('0x10')](function(_0x2efd91){logger[_0xaea3('0x11')](_0xaea3('0x1b'),_0x591042);logger['debug'](_0xaea3('0x1b'),_0x591042,JSON[_0xaea3('0x16')](_0x2efd91));_0x155250(_0x2efd91);})[_0xaea3('0x1a')](function(_0x56ad60){logger['error'](_0xaea3('0x1b'),_0x56ad60[_0xaea3('0x19')],_0x591042);_0x218492(_0x230bf1['error'](0x1f4,_0x56ad60[_0xaea3('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x521b9b){var _0x35e0c0=this;return new Promise(function(_0x3fb476,_0x25047a){return db[_0xaea3('0x1c')][_0xaea3('0x24')]({'raw':_0x521b9b[_0xaea3('0x1d')]?_0x521b9b['options'][_0xaea3('0x1e')]===undefined?!![]:![]:!![],'where':_0x521b9b[_0xaea3('0x1d')]?_0x521b9b[_0xaea3('0x1d')][_0xaea3('0x1f')]||null:null,'attributes':_0x521b9b[_0xaea3('0x1d')]?_0x521b9b[_0xaea3('0x1d')][_0xaea3('0x20')]||null:null,'include':_0x521b9b[_0xaea3('0x1d')]?_0x521b9b[_0xaea3('0x1d')][_0xaea3('0x21')]?_[_0xaea3('0x22')](_0x521b9b[_0xaea3('0x1d')][_0xaea3('0x21')],function(_0x2433d6){return{'model':db[_0x2433d6[_0xaea3('0x23')]],'as':_0x2433d6['as'],'attributes':_0x2433d6[_0xaea3('0x20')],'include':_0x2433d6[_0xaea3('0x21')]?_['map'](_0x2433d6[_0xaea3('0x21')],function(_0x4b04a3){return{'model':db[_0x4b04a3[_0xaea3('0x23')]],'as':_0x4b04a3['as'],'attributes':_0x4b04a3[_0xaea3('0x20')],'include':_0x4b04a3[_0xaea3('0x21')]?_[_0xaea3('0x22')](_0x4b04a3[_0xaea3('0x21')],function(_0x55aa34){return{'model':db[_0x55aa34[_0xaea3('0x23')]],'as':_0x55aa34['as'],'attributes':_0x55aa34['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x20baad){logger[_0xaea3('0x11')](_0xaea3('0x25'),_0x521b9b);logger[_0xaea3('0x14')](_0xaea3('0x25'),_0x521b9b,JSON[_0xaea3('0x16')](_0x20baad));_0x3fb476(_0x20baad);})[_0xaea3('0x1a')](function(_0x2a5140){logger[_0xaea3('0x17')](_0xaea3('0x25'),_0x2a5140[_0xaea3('0x19')],_0x521b9b);_0x25047a(_0x35e0c0['error'](0x1f4,_0x2a5140['message']));});});}; \ No newline at end of file +var _0xa818=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','map','attributes','include','model','then','stringify','find','where','ShowOpenchannelQueue','lodash','util','moment'];(function(_0x5b174b,_0x404869){var _0x47ee37=function(_0x467947){while(--_0x467947){_0x5b174b['push'](_0x5b174b['shift']());}};_0x47ee37(++_0x404869);}(_0xa818,0x1aa));var _0x8a81=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0xa818[_0x43a1b8];return _0x324ecc;};'use strict';var _=require(_0x8a81('0x0'));var util=require(_0x8a81('0x1'));var moment=require(_0x8a81('0x2'));var BPromise=require(_0x8a81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a81('0x4'));var db=require(_0x8a81('0x5'))['db'];var utils=require(_0x8a81('0x6'));var logger=require(_0x8a81('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8a81('0x8'));var client=jayson[_0x8a81('0x9')][_0x8a81('0xa')]({'port':0x232a});config[_0x8a81('0xb')]=_[_0x8a81('0xc')](config[_0x8a81('0xb')],{'host':_0x8a81('0xd'),'port':0x18eb});var socket=require(_0x8a81('0xe'))(new Redis(config[_0x8a81('0xb')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x522829,_0x2261d4,_0x5a0de2){return new BPromise(function(_0x5ca9ca,_0x335f5d){return client['request'](_0x522829,_0x5a0de2)['then'](function(_0x2ccee3){logger[_0x8a81('0xf')](_0x8a81('0x10'),_0x2261d4,_0x8a81('0x11'));logger[_0x8a81('0x12')](_0x8a81('0x13'),_0x2261d4,_0x8a81('0x11'),JSON['stringify'](_0x2ccee3));if(_0x2ccee3[_0x8a81('0x14')]){if(_0x2ccee3['error']['code']===0x1f4){logger['error'](_0x8a81('0x10'),_0x2261d4,_0x2ccee3['error'][_0x8a81('0x15')]);return _0x335f5d(_0x2ccee3[_0x8a81('0x14')]['message']);}logger['error'](_0x8a81('0x10'),_0x2261d4,_0x2ccee3[_0x8a81('0x14')]['message']);return _0x5ca9ca(_0x2ccee3[_0x8a81('0x14')][_0x8a81('0x15')]);}else{logger[_0x8a81('0xf')](_0x8a81('0x10'),_0x2261d4,_0x8a81('0x11'));_0x5ca9ca(_0x2ccee3[_0x8a81('0x16')]['message']);}})[_0x8a81('0x17')](function(_0xafe67a){logger[_0x8a81('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x2261d4,_0xafe67a);_0x335f5d(_0xafe67a);});});}exports[_0x8a81('0x18')]=function(_0x515656){var _0xb8e45a=this;return new Promise(function(_0xd4b406,_0xca34e7){return db[_0x8a81('0x19')][_0x8a81('0x1a')]({'raw':_0x515656[_0x8a81('0x1b')]?_0x515656['options'][_0x8a81('0x1c')]===undefined?!![]:![]:!![],'where':_0x515656[_0x8a81('0x1b')]?_0x515656[_0x8a81('0x1b')]['where']||null:null,'attributes':_0x515656[_0x8a81('0x1b')]?_0x515656[_0x8a81('0x1b')]['attributes']||null:null,'limit':_0x515656[_0x8a81('0x1b')]?_0x515656[_0x8a81('0x1b')][_0x8a81('0x1d')]||null:null,'include':_0x515656[_0x8a81('0x1b')]?_0x515656[_0x8a81('0x1b')]['include']?_[_0x8a81('0x1e')](_0x515656['options']['include'],function(_0x45d87a){return{'model':db[_0x45d87a['model']],'as':_0x45d87a['as'],'attributes':_0x45d87a[_0x8a81('0x1f')],'include':_0x45d87a[_0x8a81('0x20')]?_['map'](_0x45d87a[_0x8a81('0x20')],function(_0x55f9c4){return{'model':db[_0x55f9c4['model']],'as':_0x55f9c4['as'],'attributes':_0x55f9c4[_0x8a81('0x1f')],'include':_0x55f9c4[_0x8a81('0x20')]?_[_0x8a81('0x1e')](_0x55f9c4['include'],function(_0x4c92f8){return{'model':db[_0x4c92f8[_0x8a81('0x21')]],'as':_0x4c92f8['as'],'attributes':_0x4c92f8[_0x8a81('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8a81('0x22')](function(_0x59f6cf){logger[_0x8a81('0xf')]('GetOpenchannelQueue',_0x515656);logger[_0x8a81('0x12')](_0x8a81('0x18'),_0x515656,JSON[_0x8a81('0x23')](_0x59f6cf));_0xd4b406(_0x59f6cf);})[_0x8a81('0x17')](function(_0x562944){logger[_0x8a81('0x14')](_0x8a81('0x18'),_0x562944[_0x8a81('0x15')],_0x515656);_0xca34e7(_0xb8e45a[_0x8a81('0x14')](0x1f4,_0x562944[_0x8a81('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x444101){var _0x2f0052=this;return new Promise(function(_0x2f60bc,_0x1eea9f){return db['OpenchannelQueue'][_0x8a81('0x24')]({'raw':_0x444101[_0x8a81('0x1b')]?_0x444101[_0x8a81('0x1b')][_0x8a81('0x1c')]===undefined?!![]:![]:!![],'where':_0x444101['options']?_0x444101[_0x8a81('0x1b')][_0x8a81('0x25')]||null:null,'attributes':_0x444101['options']?_0x444101[_0x8a81('0x1b')][_0x8a81('0x1f')]||null:null,'include':_0x444101[_0x8a81('0x1b')]?_0x444101[_0x8a81('0x1b')][_0x8a81('0x20')]?_[_0x8a81('0x1e')](_0x444101[_0x8a81('0x1b')]['include'],function(_0x4fb1c7){return{'model':db[_0x4fb1c7[_0x8a81('0x21')]],'as':_0x4fb1c7['as'],'attributes':_0x4fb1c7[_0x8a81('0x1f')],'include':_0x4fb1c7['include']?_[_0x8a81('0x1e')](_0x4fb1c7[_0x8a81('0x20')],function(_0x3c1e87){return{'model':db[_0x3c1e87[_0x8a81('0x21')]],'as':_0x3c1e87['as'],'attributes':_0x3c1e87[_0x8a81('0x1f')],'include':_0x3c1e87[_0x8a81('0x20')]?_[_0x8a81('0x1e')](_0x3c1e87['include'],function(_0x2f0ebd){return{'model':db[_0x2f0ebd[_0x8a81('0x21')]],'as':_0x2f0ebd['as'],'attributes':_0x2f0ebd['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a81('0x22')](function(_0x4dd2ba){logger['info'](_0x8a81('0x26'),_0x444101);logger[_0x8a81('0x12')](_0x8a81('0x26'),_0x444101,JSON[_0x8a81('0x23')](_0x4dd2ba));_0x2f60bc(_0x4dd2ba);})[_0x8a81('0x17')](function(_0x25ca50){logger[_0x8a81('0x14')](_0x8a81('0x26'),_0x25ca50[_0x8a81('0x15')],_0x444101);_0x1eea9f(_0x2f0052['error'](0x1f4,_0x25ca50[_0x8a81('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 4a7ceef..b8947b1 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 _0x8c77=['openchannelQueue:','./openchannelQueue.events','removeListener','register'];(function(_0x5e92a8,_0x35f3ba){var _0x17aa8=function(_0x22d568){while(--_0x22d568){_0x5e92a8['push'](_0x5e92a8['shift']());}};_0x17aa8(++_0x35f3ba);}(_0x8c77,0xf9));var _0x78c7=function(_0x4c3a4d,_0x96a6bb){_0x4c3a4d=_0x4c3a4d-0x0;var _0x2f29aa=_0x8c77[_0x4c3a4d];return _0x2f29aa;};'use strict';var OpenchannelQueueEvents=require(_0x78c7('0x0'));var events=['save','remove','update'];function createListener(_0x1d4a95,_0x995809){return function(_0x34f887){_0x995809['emit'](_0x1d4a95,_0x34f887);};}function removeListener(_0xed4b18,_0x2359d9){return function(){OpenchannelQueueEvents[_0x78c7('0x1')](_0xed4b18,_0x2359d9);};}exports[_0x78c7('0x2')]=function(_0x39cbf1){for(var _0x39f227=0x0,_0x53580c=events['length'];_0x39f227<_0x53580c;_0x39f227++){var _0x214bb0=events[_0x39f227];var _0x4d5529=createListener(_0x78c7('0x3')+_0x214bb0,_0x39cbf1);OpenchannelQueueEvents['on'](_0x214bb0,_0x4d5529);}}; \ No newline at end of file +var _0x2766=['save','update','removeListener','length'];(function(_0x425e47,_0x137fc0){var _0x3bbc31=function(_0x461f8a){while(--_0x461f8a){_0x425e47['push'](_0x425e47['shift']());}};_0x3bbc31(++_0x137fc0);}(_0x2766,0x140));var _0x6276=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0x2766[_0x263a2f];return _0x8020e8;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x6276('0x0'),'remove',_0x6276('0x1')];function createListener(_0x4e2d75,_0x50f146){return function(_0x412ac4){_0x50f146['emit'](_0x4e2d75,_0x412ac4);};}function removeListener(_0x296333,_0x223b4a){return function(){OpenchannelQueueEvents[_0x6276('0x2')](_0x296333,_0x223b4a);};}exports['register']=function(_0x56d184){for(var _0x48c072=0x0,_0x54eff2=events[_0x6276('0x3')];_0x48c072<_0x54eff2;_0x48c072++){var _0x2a196d=events[_0x48c072];var _0xa74f63=createListener('openchannelQueue:'+_0x2a196d,_0x56d184);OpenchannelQueueEvents['on'](_0x2a196d,_0xa74f63);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 005a656..311018c 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 _0x547a=['/: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','./openchannelQueueReport.controller','isAuthenticated','get','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x547a,0x1d5));var _0xa547=function(_0x1f12ad,_0x2529c7){_0x1f12ad=_0x1f12ad-0x0;var _0x154727=_0x547a[_0x1f12ad];return _0x154727;};'use strict';var multer=require(_0xa547('0x0'));var util=require(_0xa547('0x1'));var path=require(_0xa547('0x2'));var timeout=require(_0xa547('0x3'));var express=require(_0xa547('0x4'));var router=express['Router']();var fs_extra=require(_0xa547('0x5'));var auth=require(_0xa547('0x6'));var interaction=require(_0xa547('0x7'));var config=require(_0xa547('0x8'));var controller=require(_0xa547('0x9'));router['get']('/',auth[_0xa547('0xa')](),controller['index']);router[_0xa547('0xb')](_0xa547('0xc'),auth[_0xa547('0xa')](),controller[_0xa547('0xd')]);router[_0xa547('0xb')](_0xa547('0xe'),auth['isAuthenticated'](),controller[_0xa547('0xf')]);router[_0xa547('0x10')]('/',auth[_0xa547('0xa')](),controller[_0xa547('0x11')]);router[_0xa547('0x12')](_0xa547('0xe'),auth[_0xa547('0xa')](),controller[_0xa547('0x13')]);router[_0xa547('0x14')](_0xa547('0xe'),auth[_0xa547('0xa')](),controller[_0xa547('0x15')]);module[_0xa547('0x16')]=router; \ No newline at end of file +var _0xc916=['index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated'];(function(_0xab88ac,_0x10c41b){var _0x6aa214=function(_0x290145){while(--_0x290145){_0xab88ac['push'](_0xab88ac['shift']());}};_0x6aa214(++_0x10c41b);}(_0xc916,0x173));var _0x6c91=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0xc916[_0x1b8b95];return _0x3657ae;};'use strict';var multer=require(_0x6c91('0x0'));var util=require(_0x6c91('0x1'));var path=require(_0x6c91('0x2'));var timeout=require(_0x6c91('0x3'));var express=require('express');var router=express[_0x6c91('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6c91('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6c91('0x6'));var controller=require(_0x6c91('0x7'));router['get']('/',auth[_0x6c91('0x8')](),controller[_0x6c91('0x9')]);router[_0x6c91('0xa')](_0x6c91('0xb'),auth[_0x6c91('0x8')](),controller[_0x6c91('0xc')]);router['get'](_0x6c91('0xd'),auth[_0x6c91('0x8')](),controller[_0x6c91('0xe')]);router[_0x6c91('0xf')]('/',auth[_0x6c91('0x8')](),controller[_0x6c91('0x10')]);router['put']('/:id',auth[_0x6c91('0x8')](),controller[_0x6c91('0x11')]);router[_0x6c91('0x12')](_0x6c91('0xd'),auth['isAuthenticated'](),controller[_0x6c91('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 2cf84aa..75f2d1c 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 _0x1353=['sequelize','exports','STRING','DATE','moment'];(function(_0x14705b,_0x32b5ef){var _0x59d4a8=function(_0x598a83){while(--_0x598a83){_0x14705b['push'](_0x14705b['shift']());}};_0x59d4a8(++_0x32b5ef);}(_0x1353,0xb3));var _0x3135=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x1353[_0x5f3f88];return _0xd08119;};'use strict';var moment=require(_0x3135('0x0'));var Sequelize=require(_0x3135('0x1'));module[_0x3135('0x2')]={'uniqueid':{'type':Sequelize[_0x3135('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3135('0x3')]},'joinAt':{'type':Sequelize[_0x3135('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3135('0x4')]},'exitAt':{'type':Sequelize[_0x3135('0x4')]},'reason':{'type':Sequelize[_0x3135('0x3')]}}; \ No newline at end of file +var _0x7f3a=['moment','sequelize','exports','STRING','DATE'];(function(_0x1e2964,_0x31a050){var _0x3514e9=function(_0x16a835){while(--_0x16a835){_0x1e2964['push'](_0x1e2964['shift']());}};_0x3514e9(++_0x31a050);}(_0x7f3a,0x19f));var _0xa7f3=function(_0x4de017,_0x1c3aa4){_0x4de017=_0x4de017-0x0;var _0x3d0e39=_0x7f3a[_0x4de017];return _0x3d0e39;};'use strict';var moment=require(_0xa7f3('0x0'));var Sequelize=require(_0xa7f3('0x1'));module[_0xa7f3('0x2')]={'uniqueid':{'type':Sequelize[_0xa7f3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa7f3('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa7f3('0x4')]},'acceptAt':{'type':Sequelize[_0xa7f3('0x4')]},'exitAt':{'type':Sequelize[_0xa7f3('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index d3377e3..6ff514f 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 _0xfd9d=['hasOwnProperty','sort','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','OpenchannelQueueReport','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3b307c,_0x240cd1){var _0x4a33ad=function(_0x1441ba){while(--_0x1441ba){_0x3b307c['push'](_0x3b307c['shift']());}};_0x4a33ad(++_0x240cd1);}(_0xfd9d,0x1c3));var _0xdfd9=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xfd9d[_0x45f951];return _0x24756c;};'use strict';var emlformat=require(_0xdfd9('0x0'));var rimraf=require(_0xdfd9('0x1'));var zipdir=require(_0xdfd9('0x2'));var jsonpatch=require(_0xdfd9('0x3'));var rp=require(_0xdfd9('0x4'));var moment=require('moment');var BPromise=require(_0xdfd9('0x5'));var Mustache=require(_0xdfd9('0x6'));var util=require(_0xdfd9('0x7'));var path=require(_0xdfd9('0x8'));var sox=require(_0xdfd9('0x9'));var csv=require(_0xdfd9('0xa'));var ejs=require(_0xdfd9('0xb'));var fs=require('fs');var fs_extra=require(_0xdfd9('0xc'));var _=require(_0xdfd9('0xd'));var squel=require(_0xdfd9('0xe'));var crypto=require(_0xdfd9('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdfd9('0x10'));var Papa=require(_0xdfd9('0x11'));var Redis=require(_0xdfd9('0x12'));var authService=require(_0xdfd9('0x13'));var qs=require(_0xdfd9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfd9('0x15'));var logger=require('../../config/logger')(_0xdfd9('0x16'));var utils=require(_0xdfd9('0x17'));var config=require(_0xdfd9('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ba16a,_0x5843f4){_0x5843f4=_0x5843f4||0xcc;return function(_0x5e5f14){if(_0x5e5f14){return _0x5ba16a[_0xdfd9('0x19')](_0x5843f4);}return _0x5ba16a[_0xdfd9('0x1a')](_0x5843f4)['end']();};}function respondWithResult(_0x18f51e,_0x16fb48){_0x16fb48=_0x16fb48||0xc8;return function(_0x41330f){if(_0x41330f){return _0x18f51e['status'](_0x16fb48)['json'](_0x41330f);}};}function respondWithFilteredResult(_0x4cc9b0,_0x2538c5){return function(_0x29b2e4){if(_0x29b2e4){var _0x530bf6=typeof _0x2538c5[_0xdfd9('0x1b')]===_0xdfd9('0x1c')&&typeof _0x2538c5[_0xdfd9('0x1d')]===_0xdfd9('0x1c');var _0x36211d=_0x29b2e4[_0xdfd9('0x1e')];var _0x980174=_0x530bf6?0x0:_0x2538c5[_0xdfd9('0x1b')];var _0x12fe5f=_0x530bf6?_0x29b2e4[_0xdfd9('0x1e')]:_0x2538c5[_0xdfd9('0x1b')]+_0x2538c5['limit'];var _0x4e7724;if(_0x12fe5f>=_0x36211d){_0x12fe5f=_0x36211d;_0x4e7724=0xc8;}else{_0x4e7724=0xce;}_0x4cc9b0[_0xdfd9('0x1a')](_0x4e7724);return _0x4cc9b0['set'](_0xdfd9('0x1f'),_0x980174+'-'+_0x12fe5f+'/'+_0x36211d)[_0xdfd9('0x20')](_0x29b2e4);}return null;};}function patchUpdates(_0x1a0bd3){return function(_0x5b0e6e){try{jsonpatch[_0xdfd9('0x21')](_0x5b0e6e,_0x1a0bd3,!![]);}catch(_0x1b144f){return BPromise[_0xdfd9('0x22')](_0x1b144f);}return _0x5b0e6e[_0xdfd9('0x23')]();};}function saveUpdates(_0x7dca60,_0x4d3eaa){return function(_0x319dd2){if(_0x319dd2){return _0x319dd2[_0xdfd9('0x24')](_0x7dca60)[_0xdfd9('0x25')](function(_0x4d8d03){return _0x4d8d03;});}return null;};}function removeEntity(_0x2570ba,_0x5a0008){return function(_0x242484){if(_0x242484){return _0x242484[_0xdfd9('0x26')]()[_0xdfd9('0x25')](function(){_0x2570ba[_0xdfd9('0x1a')](0xcc)[_0xdfd9('0x27')]();});}};}function handleEntityNotFound(_0x26fa98,_0x9879e9){return function(_0x3a0504){if(!_0x3a0504){_0x26fa98[_0xdfd9('0x19')](0x194);}return _0x3a0504;};}function handleError(_0x460535,_0x2c1ea1){_0x2c1ea1=_0x2c1ea1||0x1f4;return function(_0x5e0b54){logger[_0xdfd9('0x28')](_0x5e0b54[_0xdfd9('0x29')]);if(_0x5e0b54[_0xdfd9('0x2a')]){delete _0x5e0b54[_0xdfd9('0x2a')];}_0x460535[_0xdfd9('0x1a')](_0x2c1ea1)['send'](_0x5e0b54);};}exports['index']=function(_0x138710,_0x1a1326){var _0x53d4fe={},_0x5d8e86={},_0x18264a={'count':0x0,'rows':[]};var _0x4a18ea=_['map'](db[_0xdfd9('0x2b')]['rawAttributes'],function(_0x1fb422){return{'name':_0x1fb422['fieldName'],'type':_0x1fb422[_0xdfd9('0x2c')]['key']};});_0x5d8e86[_0xdfd9('0x2d')]=_['map'](_0x4a18ea,_0xdfd9('0x2a'));_0x5d8e86[_0xdfd9('0x2e')]=_[_0xdfd9('0x2f')](_0x138710[_0xdfd9('0x2e')]);_0x5d8e86[_0xdfd9('0x30')]=_[_0xdfd9('0x31')](_0x5d8e86[_0xdfd9('0x2d')],_0x5d8e86['query']);_0x53d4fe[_0xdfd9('0x32')]=_[_0xdfd9('0x31')](_0x5d8e86[_0xdfd9('0x2d')],qs[_0xdfd9('0x33')](_0x138710[_0xdfd9('0x2e')][_0xdfd9('0x33')]));_0x53d4fe[_0xdfd9('0x32')]=_0x53d4fe[_0xdfd9('0x32')][_0xdfd9('0x34')]?_0x53d4fe[_0xdfd9('0x32')]:_0x5d8e86[_0xdfd9('0x2d')];if(!_0x138710['query'][_0xdfd9('0x35')]('nolimit')){_0x53d4fe[_0xdfd9('0x1d')]=qs[_0xdfd9('0x1d')](_0x138710['query'][_0xdfd9('0x1d')]);_0x53d4fe[_0xdfd9('0x1b')]=qs['offset'](_0x138710[_0xdfd9('0x2e')]['offset']);}_0x53d4fe['order']=qs[_0xdfd9('0x36')](_0x138710[_0xdfd9('0x2e')][_0xdfd9('0x36')]);_0x53d4fe['where']=qs[_0xdfd9('0x30')](_[_0xdfd9('0x37')](_0x138710['query'],_0x5d8e86['filters']),_0x4a18ea);if(_0x138710['query'][_0xdfd9('0x38')]){_0x53d4fe['where']=_[_0xdfd9('0x39')](_0x53d4fe['where'],{'$or':_[_0xdfd9('0x3a')](_0x4a18ea,function(_0x221258){if(_0x221258[_0xdfd9('0x2c')]!=='VIRTUAL'){var _0x455f9a={};_0x455f9a[_0x221258[_0xdfd9('0x2a')]]={'$like':'%'+_0x138710['query'][_0xdfd9('0x38')]+'%'};return _0x455f9a;}})});}_0x53d4fe=_[_0xdfd9('0x39')]({},_0x53d4fe,_0x138710[_0xdfd9('0x3b')]);var _0x4f3dee={'where':_0x53d4fe['where']};return db[_0xdfd9('0x2b')][_0xdfd9('0x1e')](_0x4f3dee)[_0xdfd9('0x25')](function(_0x4cd292){_0x18264a[_0xdfd9('0x1e')]=_0x4cd292;if(_0x138710[_0xdfd9('0x2e')][_0xdfd9('0x3c')]){_0x53d4fe[_0xdfd9('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xdfd9('0x3e')](_0x53d4fe);})[_0xdfd9('0x25')](function(_0x137212){_0x18264a[_0xdfd9('0x3f')]=_0x137212;return _0x18264a;})['then'](respondWithFilteredResult(_0x1a1326,_0x53d4fe))[_0xdfd9('0x40')](handleError(_0x1a1326,null));};exports[_0xdfd9('0x41')]=function(_0x4b72dc,_0x324417){var _0x478f51={'raw':!![],'where':{'id':_0x4b72dc[_0xdfd9('0x42')]['id']}},_0x5c7dfc={};_0x5c7dfc[_0xdfd9('0x2d')]=_[_0xdfd9('0x2f')](db[_0xdfd9('0x2b')][_0xdfd9('0x43')]);_0x5c7dfc[_0xdfd9('0x2e')]=_[_0xdfd9('0x2f')](_0x4b72dc[_0xdfd9('0x2e')]);_0x5c7dfc[_0xdfd9('0x30')]=_['intersection'](_0x5c7dfc[_0xdfd9('0x2d')],_0x5c7dfc['query']);_0x478f51[_0xdfd9('0x32')]=_['intersection'](_0x5c7dfc[_0xdfd9('0x2d')],qs[_0xdfd9('0x33')](_0x4b72dc['query']['fields']));_0x478f51['attributes']=_0x478f51[_0xdfd9('0x32')][_0xdfd9('0x34')]?_0x478f51[_0xdfd9('0x32')]:_0x5c7dfc[_0xdfd9('0x2d')];if(_0x4b72dc[_0xdfd9('0x2e')]['includeAll']){_0x478f51[_0xdfd9('0x3d')]=[{'all':!![]}];}_0x478f51=_[_0xdfd9('0x39')]({},_0x478f51,_0x4b72dc[_0xdfd9('0x3b')]);return db[_0xdfd9('0x2b')][_0xdfd9('0x44')](_0x478f51)[_0xdfd9('0x25')](handleEntityNotFound(_0x324417,null))[_0xdfd9('0x25')](respondWithResult(_0x324417,null))[_0xdfd9('0x40')](handleError(_0x324417,null));};exports['create']=function(_0x18b847,_0x7cd677){return db[_0xdfd9('0x2b')][_0xdfd9('0x45')](_0x18b847[_0xdfd9('0x46')],{})[_0xdfd9('0x25')](respondWithResult(_0x7cd677,0xc9))['catch'](handleError(_0x7cd677,null));};exports[_0xdfd9('0x24')]=function(_0x472940,_0x4267ee){if(_0x472940['body']['id']){delete _0x472940['body']['id'];}return db[_0xdfd9('0x2b')][_0xdfd9('0x44')]({'where':{'id':_0x472940[_0xdfd9('0x42')]['id']}})[_0xdfd9('0x25')](handleEntityNotFound(_0x4267ee,null))[_0xdfd9('0x25')](saveUpdates(_0x472940[_0xdfd9('0x46')],null))[_0xdfd9('0x25')](respondWithResult(_0x4267ee,null))[_0xdfd9('0x40')](handleError(_0x4267ee,null));};exports[_0xdfd9('0x26')]=function(_0x38584f,_0x18593c){return db['OpenchannelQueueReport'][_0xdfd9('0x44')]({'where':{'id':_0x38584f['params']['id']}})[_0xdfd9('0x25')](handleEntityNotFound(_0x18593c,null))[_0xdfd9('0x25')](removeEntity(_0x18593c,null))[_0xdfd9('0x40')](handleError(_0x18593c,null));};exports[_0xdfd9('0x47')]=function(_0x4ef39a,_0x16b53d){return db[_0xdfd9('0x2b')][_0xdfd9('0x47')]()[_0xdfd9('0x25')](respondWithResult(_0x16b53d,null))[_0xdfd9('0x40')](handleError(_0x16b53d,null));}; \ No newline at end of file +var _0x25c1=['path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','send','map','OpenchannelQueueReport','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','filter','options','findAll','catch','params','rawAttributes','includeAll','include','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4e6890,_0x5ed8d4){var _0xba9f9d=function(_0x464660){while(--_0x464660){_0x4e6890['push'](_0x4e6890['shift']());}};_0xba9f9d(++_0x5ed8d4);}(_0x25c1,0x175));var _0x125c=function(_0x546d39,_0x436507){_0x546d39=_0x546d39-0x0;var _0x24b39c=_0x25c1[_0x546d39];return _0x24b39c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x125c('0x0'));var jsonpatch=require(_0x125c('0x1'));var rp=require(_0x125c('0x2'));var moment=require(_0x125c('0x3'));var BPromise=require(_0x125c('0x4'));var Mustache=require(_0x125c('0x5'));var util=require(_0x125c('0x6'));var path=require(_0x125c('0x7'));var sox=require(_0x125c('0x8'));var csv=require(_0x125c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x125c('0xa'));var _=require(_0x125c('0xb'));var squel=require('squel');var crypto=require(_0x125c('0xc'));var jsforce=require(_0x125c('0xd'));var deskjs=require(_0x125c('0xe'));var toCsv=require(_0x125c('0x9'));var querystring=require(_0x125c('0xf'));var Papa=require(_0x125c('0x10'));var Redis=require(_0x125c('0x11'));var authService=require(_0x125c('0x12'));var qs=require(_0x125c('0x13'));var as=require(_0x125c('0x14'));var hardwareService=require(_0x125c('0x15'));var logger=require(_0x125c('0x16'))(_0x125c('0x17'));var utils=require(_0x125c('0x18'));var config=require(_0x125c('0x19'));var licenseUtil=require(_0x125c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2973cf,_0x3e7411){_0x3e7411=_0x3e7411||0xcc;return function(_0x466af3){if(_0x466af3){return _0x2973cf['sendStatus'](_0x3e7411);}return _0x2973cf[_0x125c('0x1b')](_0x3e7411)[_0x125c('0x1c')]();};}function respondWithResult(_0x3a9ab5,_0x492647){_0x492647=_0x492647||0xc8;return function(_0x7543ef){if(_0x7543ef){return _0x3a9ab5[_0x125c('0x1b')](_0x492647)[_0x125c('0x1d')](_0x7543ef);}};}function respondWithFilteredResult(_0x42e838,_0x26ac45){return function(_0x96ef74){if(_0x96ef74){var _0x4d85aa=typeof _0x26ac45[_0x125c('0x1e')]===_0x125c('0x1f')&&typeof _0x26ac45[_0x125c('0x20')]===_0x125c('0x1f');var _0x42add3=_0x96ef74['count'];var _0x4ff8ca=_0x4d85aa?0x0:_0x26ac45[_0x125c('0x1e')];var _0x498824=_0x4d85aa?_0x96ef74[_0x125c('0x21')]:_0x26ac45[_0x125c('0x1e')]+_0x26ac45[_0x125c('0x20')];var _0x583b9f;if(_0x498824>=_0x42add3){_0x498824=_0x42add3;_0x583b9f=0xc8;}else{_0x583b9f=0xce;}_0x42e838[_0x125c('0x1b')](_0x583b9f);return _0x42e838[_0x125c('0x22')](_0x125c('0x23'),_0x4ff8ca+'-'+_0x498824+'/'+_0x42add3)[_0x125c('0x1d')](_0x96ef74);}return null;};}function patchUpdates(_0x3aa13c){return function(_0x241bfc){try{jsonpatch[_0x125c('0x24')](_0x241bfc,_0x3aa13c,!![]);}catch(_0x5f1d27){return BPromise[_0x125c('0x25')](_0x5f1d27);}return _0x241bfc[_0x125c('0x26')]();};}function saveUpdates(_0x59bfea,_0x3b9bae){return function(_0x1f9278){if(_0x1f9278){return _0x1f9278[_0x125c('0x27')](_0x59bfea)[_0x125c('0x28')](function(_0x42c96f){return _0x42c96f;});}return null;};}function removeEntity(_0x548868,_0x691220){return function(_0x55f527){if(_0x55f527){return _0x55f527['destroy']()[_0x125c('0x28')](function(){_0x548868['status'](0xcc)[_0x125c('0x1c')]();});}};}function handleEntityNotFound(_0x1be8dd,_0x52c6aa){return function(_0x3277e6){if(!_0x3277e6){_0x1be8dd[_0x125c('0x29')](0x194);}return _0x3277e6;};}function handleError(_0x514952,_0x46078d){_0x46078d=_0x46078d||0x1f4;return function(_0x1fc791){logger['error'](_0x1fc791[_0x125c('0x2a')]);if(_0x1fc791['name']){delete _0x1fc791['name'];}_0x514952[_0x125c('0x1b')](_0x46078d)[_0x125c('0x2b')](_0x1fc791);};}exports['index']=function(_0x3a84cb,_0x1bc92a){var _0x5a7016={},_0x47acbc={},_0x2818cb={'count':0x0,'rows':[]};var _0x14df17=_[_0x125c('0x2c')](db[_0x125c('0x2d')]['rawAttributes'],function(_0x510aba){return{'name':_0x510aba[_0x125c('0x2e')],'type':_0x510aba[_0x125c('0x2f')][_0x125c('0x30')]};});_0x47acbc[_0x125c('0x31')]=_[_0x125c('0x2c')](_0x14df17,_0x125c('0x32'));_0x47acbc[_0x125c('0x33')]=_[_0x125c('0x34')](_0x3a84cb[_0x125c('0x33')]);_0x47acbc[_0x125c('0x35')]=_[_0x125c('0x36')](_0x47acbc[_0x125c('0x31')],_0x47acbc[_0x125c('0x33')]);_0x5a7016[_0x125c('0x37')]=_[_0x125c('0x36')](_0x47acbc[_0x125c('0x31')],qs[_0x125c('0x38')](_0x3a84cb[_0x125c('0x33')][_0x125c('0x38')]));_0x5a7016[_0x125c('0x37')]=_0x5a7016[_0x125c('0x37')][_0x125c('0x39')]?_0x5a7016['attributes']:_0x47acbc[_0x125c('0x31')];if(!_0x3a84cb['query']['hasOwnProperty'](_0x125c('0x3a'))){_0x5a7016[_0x125c('0x20')]=qs[_0x125c('0x20')](_0x3a84cb[_0x125c('0x33')]['limit']);_0x5a7016['offset']=qs[_0x125c('0x1e')](_0x3a84cb[_0x125c('0x33')]['offset']);}_0x5a7016['order']=qs[_0x125c('0x3b')](_0x3a84cb['query']['sort']);_0x5a7016[_0x125c('0x3c')]=qs[_0x125c('0x35')](_[_0x125c('0x3d')](_0x3a84cb['query'],_0x47acbc[_0x125c('0x35')]),_0x14df17);if(_0x3a84cb['query']['filter']){_0x5a7016[_0x125c('0x3c')]=_[_0x125c('0x3e')](_0x5a7016[_0x125c('0x3c')],{'$or':_[_0x125c('0x2c')](_0x14df17,function(_0x5caa17){if(_0x5caa17[_0x125c('0x2f')]!=='VIRTUAL'){var _0x5c550b={};_0x5c550b[_0x5caa17['name']]={'$like':'%'+_0x3a84cb['query'][_0x125c('0x3f')]+'%'};return _0x5c550b;}})});}_0x5a7016=_[_0x125c('0x3e')]({},_0x5a7016,_0x3a84cb[_0x125c('0x40')]);var _0x5e08d4={'where':_0x5a7016[_0x125c('0x3c')]};return db['OpenchannelQueueReport'][_0x125c('0x21')](_0x5e08d4)[_0x125c('0x28')](function(_0x51dd0b){_0x2818cb[_0x125c('0x21')]=_0x51dd0b;if(_0x3a84cb[_0x125c('0x33')]['includeAll']){_0x5a7016['include']=[{'all':!![]}];}return db[_0x125c('0x2d')][_0x125c('0x41')](_0x5a7016);})[_0x125c('0x28')](function(_0x5f11a6){_0x2818cb['rows']=_0x5f11a6;return _0x2818cb;})[_0x125c('0x28')](respondWithFilteredResult(_0x1bc92a,_0x5a7016))[_0x125c('0x42')](handleError(_0x1bc92a,null));};exports['show']=function(_0x338f41,_0x47dc43){var _0x35ba6e={'raw':!![],'where':{'id':_0x338f41[_0x125c('0x43')]['id']}},_0x55c601={};_0x55c601[_0x125c('0x31')]=_['keys'](db[_0x125c('0x2d')][_0x125c('0x44')]);_0x55c601[_0x125c('0x33')]=_[_0x125c('0x34')](_0x338f41[_0x125c('0x33')]);_0x55c601[_0x125c('0x35')]=_[_0x125c('0x36')](_0x55c601[_0x125c('0x31')],_0x55c601[_0x125c('0x33')]);_0x35ba6e['attributes']=_['intersection'](_0x55c601[_0x125c('0x31')],qs['fields'](_0x338f41[_0x125c('0x33')][_0x125c('0x38')]));_0x35ba6e[_0x125c('0x37')]=_0x35ba6e['attributes'][_0x125c('0x39')]?_0x35ba6e[_0x125c('0x37')]:_0x55c601[_0x125c('0x31')];if(_0x338f41[_0x125c('0x33')][_0x125c('0x45')]){_0x35ba6e[_0x125c('0x46')]=[{'all':!![]}];}_0x35ba6e=_['merge']({},_0x35ba6e,_0x338f41['options']);return db[_0x125c('0x2d')][_0x125c('0x47')](_0x35ba6e)['then'](handleEntityNotFound(_0x47dc43,null))[_0x125c('0x28')](respondWithResult(_0x47dc43,null))['catch'](handleError(_0x47dc43,null));};exports[_0x125c('0x48')]=function(_0x3d7c1a,_0x23ecb8){return db[_0x125c('0x2d')][_0x125c('0x48')](_0x3d7c1a[_0x125c('0x49')],{})[_0x125c('0x28')](respondWithResult(_0x23ecb8,0xc9))[_0x125c('0x42')](handleError(_0x23ecb8,null));};exports[_0x125c('0x27')]=function(_0x5a98b9,_0x4d7c21){if(_0x5a98b9[_0x125c('0x49')]['id']){delete _0x5a98b9[_0x125c('0x49')]['id'];}return db[_0x125c('0x2d')]['find']({'where':{'id':_0x5a98b9['params']['id']}})[_0x125c('0x28')](handleEntityNotFound(_0x4d7c21,null))['then'](saveUpdates(_0x5a98b9[_0x125c('0x49')],null))['then'](respondWithResult(_0x4d7c21,null))['catch'](handleError(_0x4d7c21,null));};exports[_0x125c('0x4a')]=function(_0x3de436,_0x59ba3f){return db[_0x125c('0x2d')][_0x125c('0x47')]({'where':{'id':_0x3de436[_0x125c('0x43')]['id']}})['then'](handleEntityNotFound(_0x59ba3f,null))['then'](removeEntity(_0x59ba3f,null))[_0x125c('0x42')](handleError(_0x59ba3f,null));};exports[_0x125c('0x4b')]=function(_0x362b10,_0x4d178e){return db['OpenchannelQueueReport'][_0x125c('0x4b')]()['then'](respondWithResult(_0x4d178e,null))[_0x125c('0x42')](handleError(_0x4d178e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3909ebf..5e24552 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x2e0565,_0x26be83){var _0x24624a=function(_0x5a53d2){while(--_0x5a53d2){_0x2e0565['push'](_0x2e0565['shift']());}};_0x24624a(++_0x26be83);}(_0x1261,0x144));var _0x1126=function(_0x1a8469,_0x2ffccf){_0x1a8469=_0x1a8469-0x0;var _0x19c2dd=_0x1261[_0x1a8469];return _0x19c2dd;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x814b,0x1a2));var _0xb814=function(_0x15876c,_0x510dd4){_0x15876c=_0x15876c-0x0;var _0x39d91b=_0x814b[_0x15876c];return _0x39d91b;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 449978c..ad5b03e 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 _0x32b6=['stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent'];(function(_0x33bc9e,_0x295da1){var _0xef97c9=function(_0x1fc3ca){while(--_0x1fc3ca){_0x33bc9e['push'](_0x33bc9e['shift']());}};_0xef97c9(++_0x295da1);}(_0x32b6,0x1d1));var _0x632b=function(_0x3bc010,_0x2f61e1){_0x3bc010=_0x3bc010-0x0;var _0x137d79=_0x32b6[_0x3bc010];return _0x137d79;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')](_0x3bb27f[_0x632b('0x18')],{'raw':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x116f62){logger['info']('CreateOpenchannelQueueReport',_0x3bb27f);logger[_0x632b('0xd')]('CreateOpenchannelQueueReport',_0x3bb27f,JSON[_0x632b('0xf')](_0x116f62));_0x51c894(_0x116f62);})[_0x632b('0x1b')](function(_0x2a6833){logger['error'](_0x632b('0x15'),_0x2a6833[_0x632b('0x13')],_0x3bb27f);_0x2f3e88(_0x28c472['error'](0x1f4,_0x2a6833[_0x632b('0x13')]));});});};exports[_0x632b('0x1c')]=function(_0x30ffb9){var _0x1e448c=this;return new Promise(function(_0x45d017,_0x183c5c){return db['OpenchannelQueueReport']['update'](_0x30ffb9[_0x632b('0x18')],{'raw':_0x30ffb9['options']?_0x30ffb9[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30ffb9['options']?_0x30ffb9[_0x632b('0x19')][_0x632b('0x1d')]||null:null,'attributes':_0x30ffb9[_0x632b('0x19')]?_0x30ffb9[_0x632b('0x19')][_0x632b('0x1e')]||null:null,'limit':_0x30ffb9[_0x632b('0x19')]?_0x30ffb9[_0x632b('0x19')][_0x632b('0x1f')]||null:null})[_0x632b('0xc')](function(_0x4f8410){logger[_0x632b('0x14')](_0x632b('0x1c'),_0x30ffb9);logger[_0x632b('0xd')](_0x632b('0x1c'),_0x30ffb9,JSON[_0x632b('0xf')](_0x4f8410));_0x45d017(_0x4f8410);})[_0x632b('0x1b')](function(_0x3c5dc9){logger[_0x632b('0x10')](_0x632b('0x1c'),_0x3c5dc9[_0x632b('0x13')],_0x30ffb9);_0x183c5c(_0x1e448c[_0x632b('0x10')](0x1f4,_0x3c5dc9[_0x632b('0x13')]));});});}; \ No newline at end of file +var _0xac35=['client','http','request','then','info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','debug','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xfadccd,_0x290136){var _0x482ac4=function(_0x315460){while(--_0x315460){_0xfadccd['push'](_0xfadccd['shift']());}};_0x482ac4(++_0x290136);}(_0xac35,0x141));var _0x5ac3=function(_0x52b77c,_0x54d31e){_0x52b77c=_0x52b77c-0x0;var _0x8d2c19=_0xac35[_0x52b77c];return _0x8d2c19;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var moment=require(_0x5ac3('0x2'));var BPromise=require(_0x5ac3('0x3'));var rs=require(_0x5ac3('0x4'));var fs=require('fs');var Redis=require(_0x5ac3('0x5'));var db=require(_0x5ac3('0x6'))['db'];var utils=require(_0x5ac3('0x7'));var logger=require(_0x5ac3('0x8'))(_0x5ac3('0x9'));var config=require(_0x5ac3('0xa'));var jayson=require(_0x5ac3('0xb'));var client=jayson[_0x5ac3('0xc')][_0x5ac3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c9a16,_0x77dc9f,_0x5e96cb){return new BPromise(function(_0x2a19b9,_0x1754d2){return client[_0x5ac3('0xe')](_0x4c9a16,_0x5e96cb)[_0x5ac3('0xf')](function(_0x378900){logger[_0x5ac3('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x77dc9f,_0x5ac3('0x11'));logger['debug'](_0x5ac3('0x12'),_0x77dc9f,_0x5ac3('0x11'),JSON[_0x5ac3('0x13')](_0x378900));if(_0x378900[_0x5ac3('0x14')]){if(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x15')]===0x1f4){logger[_0x5ac3('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x1754d2(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);}logger[_0x5ac3('0x14')](_0x5ac3('0x17'),_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x2a19b9(_0x378900['error']['message']);}else{logger[_0x5ac3('0x10')](_0x5ac3('0x17'),_0x77dc9f,'request\x20sent');_0x2a19b9(_0x378900[_0x5ac3('0x18')]['message']);}})[_0x5ac3('0x19')](function(_0x18cad4){logger[_0x5ac3('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x77dc9f,_0x18cad4);_0x1754d2(_0x18cad4);});});}exports[_0x5ac3('0x1a')]=function(_0x1c2566){var _0x200eca=this;return new Promise(function(_0x141128,_0x5aab00){return db[_0x5ac3('0x1b')][_0x5ac3('0x1c')](_0x1c2566[_0x5ac3('0x1d')],{'raw':_0x1c2566[_0x5ac3('0x1e')]?_0x1c2566[_0x5ac3('0x1e')][_0x5ac3('0x1f')]===undefined?!![]:![]:!![]})[_0x5ac3('0xf')](function(_0x2fcc26){logger[_0x5ac3('0x10')](_0x5ac3('0x1a'),_0x1c2566);logger[_0x5ac3('0x20')](_0x5ac3('0x1a'),_0x1c2566,JSON['stringify'](_0x2fcc26));_0x141128(_0x2fcc26);})[_0x5ac3('0x19')](function(_0x3cbb52){logger[_0x5ac3('0x14')](_0x5ac3('0x1a'),_0x3cbb52['message'],_0x1c2566);_0x5aab00(_0x200eca[_0x5ac3('0x14')](0x1f4,_0x3cbb52[_0x5ac3('0x16')]));});});};exports[_0x5ac3('0x21')]=function(_0x3cce67){var _0x5ec3fc=this;return new Promise(function(_0x1eb39c,_0x567807){return db[_0x5ac3('0x1b')]['update'](_0x3cce67['body'],{'raw':_0x3cce67[_0x5ac3('0x1e')]?_0x3cce67[_0x5ac3('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cce67[_0x5ac3('0x1e')]?_0x3cce67[_0x5ac3('0x1e')][_0x5ac3('0x22')]||null:null,'attributes':_0x3cce67[_0x5ac3('0x1e')]?_0x3cce67['options'][_0x5ac3('0x23')]||null:null,'limit':_0x3cce67[_0x5ac3('0x1e')]?_0x3cce67[_0x5ac3('0x1e')][_0x5ac3('0x24')]||null:null})[_0x5ac3('0xf')](function(_0xf37646){logger[_0x5ac3('0x10')]('UpdateOpenchannelQueueReport',_0x3cce67);logger[_0x5ac3('0x20')](_0x5ac3('0x21'),_0x3cce67,JSON[_0x5ac3('0x13')](_0xf37646));_0x1eb39c(_0xf37646);})['catch'](function(_0x8d4a36){logger[_0x5ac3('0x14')](_0x5ac3('0x21'),_0x8d4a36['message'],_0x3cce67);_0x567807(_0x5ec3fc[_0x5ac3('0x14')](0x1f4,_0x8d4a36['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 611d2af..e849117 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 _0xcdc3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','show','/:id','update','delete','destroy','multer','util'];(function(_0x280fdd,_0x258d03){var _0x1af49a=function(_0x35617e){while(--_0x35617e){_0x280fdd['push'](_0x280fdd['shift']());}};_0x1af49a(++_0x258d03);}(_0xcdc3,0x1b8));var _0x3cdc=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xcdc3[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0x3cdc('0x0'));var util=require(_0x3cdc('0x1'));var path=require('path');var timeout=require(_0x3cdc('0x2'));var express=require(_0x3cdc('0x3'));var router=express[_0x3cdc('0x4')]();var fs_extra=require(_0x3cdc('0x5'));var auth=require(_0x3cdc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3cdc('0x7'));router[_0x3cdc('0x8')]('/',auth[_0x3cdc('0x9')](),controller[_0x3cdc('0xa')]);router[_0x3cdc('0x8')]('/describe',auth[_0x3cdc('0x9')](),controller[_0x3cdc('0xb')]);router[_0x3cdc('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3cdc('0xc')]);router['post']('/',auth[_0x3cdc('0x9')](),controller['create']);router['put'](_0x3cdc('0xd'),auth[_0x3cdc('0x9')](),controller[_0x3cdc('0xe')]);router[_0x3cdc('0xf')](_0x3cdc('0xd'),auth[_0x3cdc('0x9')](),controller[_0x3cdc('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0a28=['show','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x0a28,0xcb));var _0x80a2=function(_0x7d98aa,_0x37a304){_0x7d98aa=_0x7d98aa-0x0;var _0x504b9b=_0x0a28[_0x7d98aa];return _0x504b9b;};'use strict';var multer=require(_0x80a2('0x0'));var util=require(_0x80a2('0x1'));var path=require(_0x80a2('0x2'));var timeout=require('connect-timeout');var express=require(_0x80a2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x80a2('0x4'));var interaction=require(_0x80a2('0x5'));var config=require(_0x80a2('0x6'));var controller=require(_0x80a2('0x7'));router[_0x80a2('0x8')]('/',auth[_0x80a2('0x9')](),controller[_0x80a2('0xa')]);router[_0x80a2('0x8')](_0x80a2('0xb'),auth[_0x80a2('0x9')](),controller['describe']);router[_0x80a2('0x8')](_0x80a2('0xc'),auth[_0x80a2('0x9')](),controller[_0x80a2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x80a2('0xc'),auth[_0x80a2('0x9')](),controller[_0x80a2('0xe')]);router[_0x80a2('0xf')](_0x80a2('0xc'),auth[_0x80a2('0x9')](),controller[_0x80a2('0x10')]);module[_0x80a2('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index ed04007..a88cb18 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0x9bde,0xe1));var _0xe9bd=function(_0xfbba39,_0x21094e){_0xfbba39=_0xfbba39-0x0;var _0x1c51bb=_0x9bde[_0xfbba39];return _0x1c51bb;};'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 +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2360f2,_0x1e23e7){_0x2360f2=_0x2360f2-0x0;var _0x576f6a=_0x9bde[_0x2360f2];return _0x576f6a;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 83bb9f8..9e24a55 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 _0x6b24=['describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','OpenchannelTransferReport','includeAll','include','findAll','params','length','find','catch','create','body'];(function(_0x4657b4,_0x170028){var _0x547baf=function(_0x34b771){while(--_0x34b771){_0x4657b4['push'](_0x4657b4['shift']());}};_0x547baf(++_0x170028);}(_0x6b24,0x95));var _0x46b2=function(_0x2c2390,_0x37ef1c){_0x2c2390=_0x2c2390-0x0;var _0x478b7e=_0x6b24[_0x2c2390];return _0x478b7e;};'use strict';var emlformat=require(_0x46b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x46b2('0x1'));var jsonpatch=require(_0x46b2('0x2'));var rp=require(_0x46b2('0x3'));var moment=require(_0x46b2('0x4'));var BPromise=require(_0x46b2('0x5'));var Mustache=require(_0x46b2('0x6'));var util=require(_0x46b2('0x7'));var path=require(_0x46b2('0x8'));var sox=require('sox');var csv=require(_0x46b2('0x9'));var ejs=require(_0x46b2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46b2('0xb'));var squel=require(_0x46b2('0xc'));var crypto=require(_0x46b2('0xd'));var jsforce=require(_0x46b2('0xe'));var deskjs=require(_0x46b2('0xf'));var toCsv=require(_0x46b2('0x9'));var querystring=require('querystring');var Papa=require(_0x46b2('0x10'));var Redis=require(_0x46b2('0x11'));var authService=require(_0x46b2('0x12'));var qs=require(_0x46b2('0x13'));var as=require(_0x46b2('0x14'));var hardwareService=require(_0x46b2('0x15'));var logger=require(_0x46b2('0x16'))(_0x46b2('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x46b2('0x18'));var db=require(_0x46b2('0x19'))['db'];function respondWithStatusCode(_0x212ee5,_0x503226){_0x503226=_0x503226||0xcc;return function(_0x177173){if(_0x177173){return _0x212ee5[_0x46b2('0x1a')](_0x503226);}return _0x212ee5[_0x46b2('0x1b')](_0x503226)[_0x46b2('0x1c')]();};}function respondWithResult(_0x1c4c71,_0x287708){_0x287708=_0x287708||0xc8;return function(_0x38ef29){if(_0x38ef29){return _0x1c4c71[_0x46b2('0x1b')](_0x287708)[_0x46b2('0x1d')](_0x38ef29);}};}function respondWithFilteredResult(_0x227284,_0xd98172){return function(_0x5a055b){if(_0x5a055b){var _0x2c4b07=typeof _0xd98172[_0x46b2('0x1e')]===_0x46b2('0x1f')&&typeof _0xd98172[_0x46b2('0x20')]===_0x46b2('0x1f');var _0x4bbf05=_0x5a055b[_0x46b2('0x21')];var _0xa14dcb=_0x2c4b07?0x0:_0xd98172[_0x46b2('0x1e')];var _0x259c02=_0x2c4b07?_0x5a055b[_0x46b2('0x21')]:_0xd98172[_0x46b2('0x1e')]+_0xd98172[_0x46b2('0x20')];var _0x4b1219;if(_0x259c02>=_0x4bbf05){_0x259c02=_0x4bbf05;_0x4b1219=0xc8;}else{_0x4b1219=0xce;}_0x227284[_0x46b2('0x1b')](_0x4b1219);return _0x227284[_0x46b2('0x22')]('Content-Range',_0xa14dcb+'-'+_0x259c02+'/'+_0x4bbf05)[_0x46b2('0x1d')](_0x5a055b);}return null;};}function patchUpdates(_0xfd9019){return function(_0x56e436){try{jsonpatch[_0x46b2('0x23')](_0x56e436,_0xfd9019,!![]);}catch(_0x2e7f2c){return BPromise[_0x46b2('0x24')](_0x2e7f2c);}return _0x56e436['save']();};}function saveUpdates(_0x445740,_0x48e26c){return function(_0x35bd96){if(_0x35bd96){return _0x35bd96[_0x46b2('0x25')](_0x445740)[_0x46b2('0x26')](function(_0xf0a6e1){return _0xf0a6e1;});}return null;};}function removeEntity(_0x16392d,_0x135f7b){return function(_0x3aa369){if(_0x3aa369){return _0x3aa369[_0x46b2('0x27')]()[_0x46b2('0x26')](function(){_0x16392d['status'](0xcc)[_0x46b2('0x1c')]();});}};}function handleEntityNotFound(_0xb05201,_0x5709f8){return function(_0x177c52){if(!_0x177c52){_0xb05201['sendStatus'](0x194);}return _0x177c52;};}function handleError(_0x2c7c63,_0x2b7788){_0x2b7788=_0x2b7788||0x1f4;return function(_0x25e036){logger['error'](_0x25e036[_0x46b2('0x28')]);if(_0x25e036['name']){delete _0x25e036[_0x46b2('0x29')];}_0x2c7c63[_0x46b2('0x1b')](_0x2b7788)['send'](_0x25e036);};}exports['index']=function(_0x2290b0,_0x118570){var _0x3efa9c={},_0x5c9703={},_0x3db815={'count':0x0,'rows':[]};var _0x363a35=_[_0x46b2('0x2a')](db['OpenchannelTransferReport'][_0x46b2('0x2b')],function(_0x9aaa58){return{'name':_0x9aaa58[_0x46b2('0x2c')],'type':_0x9aaa58[_0x46b2('0x2d')][_0x46b2('0x2e')]};});_0x5c9703['model']=_[_0x46b2('0x2a')](_0x363a35,'name');_0x5c9703[_0x46b2('0x2f')]=_[_0x46b2('0x30')](_0x2290b0[_0x46b2('0x2f')]);_0x5c9703[_0x46b2('0x31')]=_[_0x46b2('0x32')](_0x5c9703[_0x46b2('0x33')],_0x5c9703['query']);_0x3efa9c[_0x46b2('0x34')]=_['intersection'](_0x5c9703[_0x46b2('0x33')],qs[_0x46b2('0x35')](_0x2290b0['query']['fields']));_0x3efa9c['attributes']=_0x3efa9c[_0x46b2('0x34')]['length']?_0x3efa9c['attributes']:_0x5c9703[_0x46b2('0x33')];if(!_0x2290b0[_0x46b2('0x2f')][_0x46b2('0x36')](_0x46b2('0x37'))){_0x3efa9c[_0x46b2('0x20')]=qs['limit'](_0x2290b0['query'][_0x46b2('0x20')]);_0x3efa9c[_0x46b2('0x1e')]=qs[_0x46b2('0x1e')](_0x2290b0[_0x46b2('0x2f')]['offset']);}_0x3efa9c[_0x46b2('0x38')]=qs[_0x46b2('0x39')](_0x2290b0['query']['sort']);_0x3efa9c[_0x46b2('0x3a')]=qs[_0x46b2('0x31')](_[_0x46b2('0x3b')](_0x2290b0[_0x46b2('0x2f')],_0x5c9703['filters']),_0x363a35);if(_0x2290b0[_0x46b2('0x2f')]['filter']){_0x3efa9c[_0x46b2('0x3a')]=_[_0x46b2('0x3c')](_0x3efa9c[_0x46b2('0x3a')],{'$or':_[_0x46b2('0x2a')](_0x363a35,function(_0x4f3ae4){if(_0x4f3ae4[_0x46b2('0x2d')]!=='VIRTUAL'){var _0x13405d={};_0x13405d[_0x4f3ae4[_0x46b2('0x29')]]={'$like':'%'+_0x2290b0[_0x46b2('0x2f')][_0x46b2('0x3d')]+'%'};return _0x13405d;}})});}_0x3efa9c=_[_0x46b2('0x3c')]({},_0x3efa9c,_0x2290b0[_0x46b2('0x3e')]);var _0x46277f={'where':_0x3efa9c[_0x46b2('0x3a')]};return db[_0x46b2('0x3f')][_0x46b2('0x21')](_0x46277f)[_0x46b2('0x26')](function(_0x3ddbc3){_0x3db815[_0x46b2('0x21')]=_0x3ddbc3;if(_0x2290b0[_0x46b2('0x2f')][_0x46b2('0x40')]){_0x3efa9c[_0x46b2('0x41')]=[{'all':!![]}];}return db[_0x46b2('0x3f')][_0x46b2('0x42')](_0x3efa9c);})[_0x46b2('0x26')](function(_0x26feb6){_0x3db815['rows']=_0x26feb6;return _0x3db815;})[_0x46b2('0x26')](respondWithFilteredResult(_0x118570,_0x3efa9c))['catch'](handleError(_0x118570,null));};exports['show']=function(_0x132e8b,_0x3fc22a){var _0x2f4899={'raw':!![],'where':{'id':_0x132e8b[_0x46b2('0x43')]['id']}},_0x138a1e={};_0x138a1e[_0x46b2('0x33')]=_['keys'](db[_0x46b2('0x3f')][_0x46b2('0x2b')]);_0x138a1e[_0x46b2('0x2f')]=_['keys'](_0x132e8b[_0x46b2('0x2f')]);_0x138a1e[_0x46b2('0x31')]=_['intersection'](_0x138a1e['model'],_0x138a1e[_0x46b2('0x2f')]);_0x2f4899[_0x46b2('0x34')]=_[_0x46b2('0x32')](_0x138a1e[_0x46b2('0x33')],qs[_0x46b2('0x35')](_0x132e8b[_0x46b2('0x2f')][_0x46b2('0x35')]));_0x2f4899['attributes']=_0x2f4899[_0x46b2('0x34')][_0x46b2('0x44')]?_0x2f4899[_0x46b2('0x34')]:_0x138a1e['model'];if(_0x132e8b[_0x46b2('0x2f')]['includeAll']){_0x2f4899[_0x46b2('0x41')]=[{'all':!![]}];}_0x2f4899=_[_0x46b2('0x3c')]({},_0x2f4899,_0x132e8b[_0x46b2('0x3e')]);return db[_0x46b2('0x3f')][_0x46b2('0x45')](_0x2f4899)['then'](handleEntityNotFound(_0x3fc22a,null))[_0x46b2('0x26')](respondWithResult(_0x3fc22a,null))[_0x46b2('0x46')](handleError(_0x3fc22a,null));};exports[_0x46b2('0x47')]=function(_0x33bce9,_0x366932){return db[_0x46b2('0x3f')][_0x46b2('0x47')](_0x33bce9[_0x46b2('0x48')],{})[_0x46b2('0x26')](respondWithResult(_0x366932,0xc9))[_0x46b2('0x46')](handleError(_0x366932,null));};exports[_0x46b2('0x25')]=function(_0xc64c41,_0xa13213){if(_0xc64c41[_0x46b2('0x48')]['id']){delete _0xc64c41[_0x46b2('0x48')]['id'];}return db[_0x46b2('0x3f')][_0x46b2('0x45')]({'where':{'id':_0xc64c41[_0x46b2('0x43')]['id']}})[_0x46b2('0x26')](handleEntityNotFound(_0xa13213,null))[_0x46b2('0x26')](saveUpdates(_0xc64c41[_0x46b2('0x48')],null))[_0x46b2('0x26')](respondWithResult(_0xa13213,null))[_0x46b2('0x46')](handleError(_0xa13213,null));};exports[_0x46b2('0x27')]=function(_0x368ae7,_0x14edfb){return db['OpenchannelTransferReport'][_0x46b2('0x45')]({'where':{'id':_0x368ae7[_0x46b2('0x43')]['id']}})[_0x46b2('0x26')](handleEntityNotFound(_0x14edfb,null))[_0x46b2('0x26')](removeEntity(_0x14edfb,null))[_0x46b2('0x46')](handleError(_0x14edfb,null));};exports[_0x46b2('0x49')]=function(_0x2d353f,_0x1dad45){return db[_0x46b2('0x3f')][_0x46b2('0x49')]()['then'](respondWithResult(_0x1dad45,null))[_0x46b2('0x46')](handleError(_0x1dad45,null));}; \ No newline at end of file +var _0x2cb5=['offset','limit','undefined','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','json'];(function(_0x1fbac7,_0x4282b6){var _0x562537=function(_0x2490db){while(--_0x2490db){_0x1fbac7['push'](_0x1fbac7['shift']());}};_0x562537(++_0x4282b6);}(_0x2cb5,0x155));var _0x52cb=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x2cb5[_0x359bbe];return _0x1b3353;};'use strict';var emlformat=require(_0x52cb('0x0'));var rimraf=require(_0x52cb('0x1'));var zipdir=require(_0x52cb('0x2'));var jsonpatch=require(_0x52cb('0x3'));var rp=require('request-promise');var moment=require(_0x52cb('0x4'));var BPromise=require(_0x52cb('0x5'));var Mustache=require(_0x52cb('0x6'));var util=require('util');var path=require(_0x52cb('0x7'));var sox=require('sox');var csv=require(_0x52cb('0x8'));var ejs=require(_0x52cb('0x9'));var fs=require('fs');var fs_extra=require(_0x52cb('0xa'));var _=require(_0x52cb('0xb'));var squel=require('squel');var crypto=require(_0x52cb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x52cb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x52cb('0xe'));var Papa=require('papaparse');var Redis=require(_0x52cb('0xf'));var authService=require(_0x52cb('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52cb('0x11'));var logger=require('../../config/logger')(_0x52cb('0x12'));var utils=require(_0x52cb('0x13'));var config=require(_0x52cb('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b8885,_0x5719dd){_0x5719dd=_0x5719dd||0xcc;return function(_0x4671a2){if(_0x4671a2){return _0x3b8885[_0x52cb('0x15')](_0x5719dd);}return _0x3b8885['status'](_0x5719dd)[_0x52cb('0x16')]();};}function respondWithResult(_0x4f943f,_0x4c2ba4){_0x4c2ba4=_0x4c2ba4||0xc8;return function(_0x548f1e){if(_0x548f1e){return _0x4f943f['status'](_0x4c2ba4)[_0x52cb('0x17')](_0x548f1e);}};}function respondWithFilteredResult(_0x308514,_0x208d8c){return function(_0x2a8143){if(_0x2a8143){var _0x2930f0=typeof _0x208d8c[_0x52cb('0x18')]==='undefined'&&typeof _0x208d8c[_0x52cb('0x19')]===_0x52cb('0x1a');var _0x11d331=_0x2a8143['count'];var _0x1604a0=_0x2930f0?0x0:_0x208d8c[_0x52cb('0x18')];var _0x4c31d5=_0x2930f0?_0x2a8143[_0x52cb('0x1b')]:_0x208d8c['offset']+_0x208d8c[_0x52cb('0x19')];var _0x4bebc9;if(_0x4c31d5>=_0x11d331){_0x4c31d5=_0x11d331;_0x4bebc9=0xc8;}else{_0x4bebc9=0xce;}_0x308514[_0x52cb('0x1c')](_0x4bebc9);return _0x308514[_0x52cb('0x1d')](_0x52cb('0x1e'),_0x1604a0+'-'+_0x4c31d5+'/'+_0x11d331)[_0x52cb('0x17')](_0x2a8143);}return null;};}function patchUpdates(_0x1ee205){return function(_0x2a3ae7){try{jsonpatch['apply'](_0x2a3ae7,_0x1ee205,!![]);}catch(_0x5970d9){return BPromise[_0x52cb('0x1f')](_0x5970d9);}return _0x2a3ae7[_0x52cb('0x20')]();};}function saveUpdates(_0x34b9c6,_0x1ca778){return function(_0x25c523){if(_0x25c523){return _0x25c523[_0x52cb('0x21')](_0x34b9c6)[_0x52cb('0x22')](function(_0x54733c){return _0x54733c;});}return null;};}function removeEntity(_0x3c5762,_0x46b4d9){return function(_0xabff2f){if(_0xabff2f){return _0xabff2f[_0x52cb('0x23')]()['then'](function(){_0x3c5762[_0x52cb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x987a06,_0x2444ad){return function(_0x3195f1){if(!_0x3195f1){_0x987a06[_0x52cb('0x15')](0x194);}return _0x3195f1;};}function handleError(_0x272a53,_0x4d660d){_0x4d660d=_0x4d660d||0x1f4;return function(_0x5c842e){logger[_0x52cb('0x24')](_0x5c842e[_0x52cb('0x25')]);if(_0x5c842e[_0x52cb('0x26')]){delete _0x5c842e[_0x52cb('0x26')];}_0x272a53[_0x52cb('0x1c')](_0x4d660d)[_0x52cb('0x27')](_0x5c842e);};}exports[_0x52cb('0x28')]=function(_0x599cfb,_0x4f5097){var _0x228230={},_0x20b7b3={},_0x10dcd6={'count':0x0,'rows':[]};var _0x5015c8=_['map'](db[_0x52cb('0x29')][_0x52cb('0x2a')],function(_0x252841){return{'name':_0x252841[_0x52cb('0x2b')],'type':_0x252841['type'][_0x52cb('0x2c')]};});_0x20b7b3[_0x52cb('0x2d')]=_[_0x52cb('0x2e')](_0x5015c8,_0x52cb('0x26'));_0x20b7b3['query']=_[_0x52cb('0x2f')](_0x599cfb[_0x52cb('0x30')]);_0x20b7b3[_0x52cb('0x31')]=_[_0x52cb('0x32')](_0x20b7b3[_0x52cb('0x2d')],_0x20b7b3[_0x52cb('0x30')]);_0x228230['attributes']=_[_0x52cb('0x32')](_0x20b7b3[_0x52cb('0x2d')],qs[_0x52cb('0x33')](_0x599cfb[_0x52cb('0x30')][_0x52cb('0x33')]));_0x228230[_0x52cb('0x34')]=_0x228230[_0x52cb('0x34')]['length']?_0x228230[_0x52cb('0x34')]:_0x20b7b3['model'];if(!_0x599cfb[_0x52cb('0x30')][_0x52cb('0x35')](_0x52cb('0x36'))){_0x228230['limit']=qs['limit'](_0x599cfb[_0x52cb('0x30')][_0x52cb('0x19')]);_0x228230['offset']=qs[_0x52cb('0x18')](_0x599cfb[_0x52cb('0x30')]['offset']);}_0x228230[_0x52cb('0x37')]=qs[_0x52cb('0x38')](_0x599cfb[_0x52cb('0x30')][_0x52cb('0x38')]);_0x228230[_0x52cb('0x39')]=qs[_0x52cb('0x31')](_[_0x52cb('0x3a')](_0x599cfb[_0x52cb('0x30')],_0x20b7b3[_0x52cb('0x31')]),_0x5015c8);if(_0x599cfb[_0x52cb('0x30')]['filter']){_0x228230[_0x52cb('0x39')]=_['merge'](_0x228230[_0x52cb('0x39')],{'$or':_[_0x52cb('0x2e')](_0x5015c8,function(_0x326782){if(_0x326782['type']!=='VIRTUAL'){var _0x4da505={};_0x4da505[_0x326782[_0x52cb('0x26')]]={'$like':'%'+_0x599cfb['query'][_0x52cb('0x3b')]+'%'};return _0x4da505;}})});}_0x228230=_['merge']({},_0x228230,_0x599cfb['options']);var _0x47e9df={'where':_0x228230[_0x52cb('0x39')]};return db[_0x52cb('0x29')][_0x52cb('0x1b')](_0x47e9df)[_0x52cb('0x22')](function(_0x18b91a){_0x10dcd6[_0x52cb('0x1b')]=_0x18b91a;if(_0x599cfb[_0x52cb('0x30')][_0x52cb('0x3c')]){_0x228230[_0x52cb('0x3d')]=[{'all':!![]}];}return db[_0x52cb('0x29')][_0x52cb('0x3e')](_0x228230);})['then'](function(_0xb4089d){_0x10dcd6[_0x52cb('0x3f')]=_0xb4089d;return _0x10dcd6;})['then'](respondWithFilteredResult(_0x4f5097,_0x228230))[_0x52cb('0x40')](handleError(_0x4f5097,null));};exports[_0x52cb('0x41')]=function(_0xd31aef,_0xcf38a2){var _0x52fb39={'raw':!![],'where':{'id':_0xd31aef[_0x52cb('0x42')]['id']}},_0x2e8296={};_0x2e8296[_0x52cb('0x2d')]=_[_0x52cb('0x2f')](db[_0x52cb('0x29')][_0x52cb('0x2a')]);_0x2e8296[_0x52cb('0x30')]=_[_0x52cb('0x2f')](_0xd31aef['query']);_0x2e8296['filters']=_[_0x52cb('0x32')](_0x2e8296[_0x52cb('0x2d')],_0x2e8296[_0x52cb('0x30')]);_0x52fb39[_0x52cb('0x34')]=_[_0x52cb('0x32')](_0x2e8296[_0x52cb('0x2d')],qs[_0x52cb('0x33')](_0xd31aef['query']['fields']));_0x52fb39['attributes']=_0x52fb39['attributes'][_0x52cb('0x43')]?_0x52fb39[_0x52cb('0x34')]:_0x2e8296['model'];if(_0xd31aef[_0x52cb('0x30')][_0x52cb('0x3c')]){_0x52fb39[_0x52cb('0x3d')]=[{'all':!![]}];}_0x52fb39=_['merge']({},_0x52fb39,_0xd31aef[_0x52cb('0x44')]);return db[_0x52cb('0x29')][_0x52cb('0x45')](_0x52fb39)['then'](handleEntityNotFound(_0xcf38a2,null))['then'](respondWithResult(_0xcf38a2,null))['catch'](handleError(_0xcf38a2,null));};exports['create']=function(_0x4beee6,_0x3e40a5){return db['OpenchannelTransferReport'][_0x52cb('0x46')](_0x4beee6[_0x52cb('0x47')],{})[_0x52cb('0x22')](respondWithResult(_0x3e40a5,0xc9))['catch'](handleError(_0x3e40a5,null));};exports[_0x52cb('0x21')]=function(_0x1b5a34,_0x17a03c){if(_0x1b5a34[_0x52cb('0x47')]['id']){delete _0x1b5a34[_0x52cb('0x47')]['id'];}return db[_0x52cb('0x29')]['find']({'where':{'id':_0x1b5a34[_0x52cb('0x42')]['id']}})[_0x52cb('0x22')](handleEntityNotFound(_0x17a03c,null))[_0x52cb('0x22')](saveUpdates(_0x1b5a34['body'],null))[_0x52cb('0x22')](respondWithResult(_0x17a03c,null))[_0x52cb('0x40')](handleError(_0x17a03c,null));};exports[_0x52cb('0x23')]=function(_0x49bfbd,_0x2198a2){return db[_0x52cb('0x29')][_0x52cb('0x45')]({'where':{'id':_0x49bfbd['params']['id']}})[_0x52cb('0x22')](handleEntityNotFound(_0x2198a2,null))['then'](removeEntity(_0x2198a2,null))[_0x52cb('0x40')](handleError(_0x2198a2,null));};exports[_0x52cb('0x48')]=function(_0x4de22f,_0x3d5341){return db[_0x52cb('0x29')][_0x52cb('0x48')]()[_0x52cb('0x22')](respondWithResult(_0x3d5341,null))['catch'](handleError(_0x3d5341,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index bb63051..f55ed1c 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 _0xe9b0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x2306f7,_0xef6e9d){var _0x2a22f6=function(_0x46a124){while(--_0x46a124){_0x2306f7['push'](_0x2306f7['shift']());}};_0x2a22f6(++_0xef6e9d);}(_0xe9b0,0xee));var _0x0e9b=function(_0x4a83f4,_0x50f589){_0x4a83f4=_0x4a83f4-0x0;var _0x1fc810=_0xe9b0[_0x4a83f4];return _0x1fc810;};'use strict';var _=require(_0x0e9b('0x0'));var util=require(_0x0e9b('0x1'));var logger=require(_0x0e9b('0x2'))(_0x0e9b('0x3'));var moment=require(_0x0e9b('0x4'));var BPromise=require(_0x0e9b('0x5'));var rp=require(_0x0e9b('0x6'));var fs=require('fs');var path=require(_0x0e9b('0x7'));var rimraf=require(_0x0e9b('0x8'));var config=require(_0x0e9b('0x9'));var attributes=require(_0x0e9b('0xa'));module[_0x0e9b('0xb')]=function(_0xddbf13,_0xa43546){return _0xddbf13[_0x0e9b('0xc')]('OpenchannelTransferReport',attributes,{'tableName':_0x0e9b('0xd'),'paranoid':![],'indexes':[{'name':_0x0e9b('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x74cc=['api','moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x74cc,0x1d3));var _0xc74c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x74cc[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc74c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc74c('0x1'));var moment=require(_0xc74c('0x2'));var BPromise=require(_0xc74c('0x3'));var rp=require(_0xc74c('0x4'));var fs=require('fs');var path=require(_0xc74c('0x5'));var rimraf=require('rimraf');var config=require(_0xc74c('0x6'));var attributes=require(_0xc74c('0x7'));module['exports']=function(_0x1cf1b1,_0x3667d8){return _0x1cf1b1[_0xc74c('0x8')](_0xc74c('0x9'),attributes,{'tableName':_0xc74c('0xa'),'paranoid':![],'indexes':[{'name':_0xc74c('0xb'),'fields':[_0xc74c('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 963facb..66ec8fc 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 _0x90b5=['http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0x90b5,0x139));var _0x590b=function(_0x56471c,_0x17ea5e){_0x56471c=_0x56471c-0x0;var _0x265a1d=_0x90b5[_0x56471c];return _0x265a1d;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var moment=require(_0x590b('0x1'));var BPromise=require(_0x590b('0x2'));var rs=require(_0x590b('0x3'));var fs=require('fs');var Redis=require(_0x590b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x590b('0x5'))(_0x590b('0x6'));var config=require('../../config/environment');var jayson=require(_0x590b('0x7'));var client=jayson[_0x590b('0x8')][_0x590b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e54fe,_0x30bc6e,_0x3663a0){return new BPromise(function(_0x3ec156,_0x9c408b){return client[_0x590b('0xa')](_0x5e54fe,_0x3663a0)[_0x590b('0xb')](function(_0x2103c0){logger[_0x590b('0xc')](_0x590b('0xd'),_0x30bc6e,'request\x20sent');logger[_0x590b('0xe')](_0x590b('0xf'),_0x30bc6e,'request\x20sent',JSON[_0x590b('0x10')](_0x2103c0));if(_0x2103c0['error']){if(_0x2103c0[_0x590b('0x11')][_0x590b('0x12')]===0x1f4){logger[_0x590b('0x11')](_0x590b('0xd'),_0x30bc6e,_0x2103c0['error'][_0x590b('0x13')]);return _0x9c408b(_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);}logger[_0x590b('0x11')](_0x590b('0xd'),_0x30bc6e,_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);return _0x3ec156(_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);}else{logger[_0x590b('0xc')](_0x590b('0xd'),_0x30bc6e,_0x590b('0x14'));_0x3ec156(_0x2103c0[_0x590b('0x15')][_0x590b('0x13')]);}})[_0x590b('0x16')](function(_0x4f2512){logger[_0x590b('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x30bc6e,_0x4f2512);_0x9c408b(_0x4f2512);});});} \ No newline at end of file +var _0xea1c=['client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x52c3a9,_0x16aa88){var _0x3ab5dd=function(_0xdb2ef2){while(--_0xdb2ef2){_0x52c3a9['push'](_0x52c3a9['shift']());}};_0x3ab5dd(++_0x16aa88);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcea1('0x0'));var BPromise=require(_0xcea1('0x1'));var rs=require(_0xcea1('0x2'));var fs=require('fs');var Redis=require(_0xcea1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcea1('0x4'));var logger=require(_0xcea1('0x5'))(_0xcea1('0x6'));var config=require(_0xcea1('0x7'));var jayson=require(_0xcea1('0x8'));var client=jayson[_0xcea1('0x9')][_0xcea1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xec7a9f,_0x93dfa5,_0x1441c6){return new BPromise(function(_0x295e4c,_0x49554b){return client[_0xcea1('0xb')](_0xec7a9f,_0x1441c6)[_0xcea1('0xc')](function(_0xbc67f9){logger['info'](_0xcea1('0xd'),_0x93dfa5,_0xcea1('0xe'));logger[_0xcea1('0xf')](_0xcea1('0x10'),_0x93dfa5,_0xcea1('0xe'),JSON[_0xcea1('0x11')](_0xbc67f9));if(_0xbc67f9[_0xcea1('0x12')]){if(_0xbc67f9[_0xcea1('0x12')][_0xcea1('0x13')]===0x1f4){logger[_0xcea1('0x12')](_0xcea1('0xd'),_0x93dfa5,_0xbc67f9['error'][_0xcea1('0x14')]);return _0x49554b(_0xbc67f9['error'][_0xcea1('0x14')]);}logger[_0xcea1('0x12')](_0xcea1('0xd'),_0x93dfa5,_0xbc67f9['error']['message']);return _0x295e4c(_0xbc67f9[_0xcea1('0x12')][_0xcea1('0x14')]);}else{logger[_0xcea1('0x15')](_0xcea1('0xd'),_0x93dfa5,_0xcea1('0xe'));_0x295e4c(_0xbc67f9[_0xcea1('0x16')][_0xcea1('0x14')]);}})[_0xcea1('0x17')](function(_0x29accd){logger[_0xcea1('0x12')](_0xcea1('0xd'),_0x93dfa5,_0x29accd);_0x49554b(_0x29accd);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1b51322..65d8ac8 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 _0x4e94=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','index','get','/:id','show','post','create','put','isAuthenticated','update','destroy'];(function(_0x55d380,_0x58437e){var _0x1dbeb3=function(_0x3edc66){while(--_0x3edc66){_0x55d380['push'](_0x55d380['shift']());}};_0x1dbeb3(++_0x58437e);}(_0x4e94,0x155));var _0x44e9=function(_0x5e8c7c,_0x3429c6){_0x5e8c7c=_0x5e8c7c-0x0;var _0x48f7bd=_0x4e94[_0x5e8c7c];return _0x48f7bd;};'use strict';var multer=require(_0x44e9('0x0'));var util=require(_0x44e9('0x1'));var path=require('path');var timeout=require(_0x44e9('0x2'));var express=require(_0x44e9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44e9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x44e9('0x5'));var controller=require('./pause.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44e9('0x6')]);router[_0x44e9('0x7')](_0x44e9('0x8'),auth['isAuthenticated'](),controller[_0x44e9('0x9')]);router[_0x44e9('0xa')]('/',auth['isAuthenticated'](),controller[_0x44e9('0xb')]);router[_0x44e9('0xc')](_0x44e9('0x8'),auth[_0x44e9('0xd')](),controller[_0x44e9('0xe')]);router['delete'](_0x44e9('0x8'),auth[_0x44e9('0xd')](),controller[_0x44e9('0xf')]);module[_0x44e9('0x10')]=router; \ No newline at end of file +var _0x3dde=['get','/:id','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index'];(function(_0x46edf4,_0xc01970){var _0x40ac86=function(_0x273569){while(--_0x273569){_0x46edf4['push'](_0x46edf4['shift']());}};_0x40ac86(++_0xc01970);}(_0x3dde,0x14b));var _0xe3dd=function(_0x2807ab,_0x5dcd85){_0x2807ab=_0x2807ab-0x0;var _0x5507b6=_0x3dde[_0x2807ab];return _0x5507b6;};'use strict';var multer=require('multer');var util=require(_0xe3dd('0x0'));var path=require(_0xe3dd('0x1'));var timeout=require(_0xe3dd('0x2'));var express=require(_0xe3dd('0x3'));var router=express[_0xe3dd('0x4')]();var fs_extra=require(_0xe3dd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe3dd('0x6'));var config=require(_0xe3dd('0x7'));var controller=require(_0xe3dd('0x8'));router['get']('/',auth[_0xe3dd('0x9')](),controller[_0xe3dd('0xa')]);router[_0xe3dd('0xb')](_0xe3dd('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe3dd('0xd')]('/',auth[_0xe3dd('0x9')](),controller['create']);router[_0xe3dd('0xe')](_0xe3dd('0xc'),auth[_0xe3dd('0x9')](),controller[_0xe3dd('0xf')]);router[_0xe3dd('0x10')](_0xe3dd('0xc'),auth['isAuthenticated'](),controller[_0xe3dd('0x11')]);module[_0xe3dd('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 f73ae70..6c0097d 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 _0xd33f=['name','sequelize','STRING'];(function(_0x3a0d83,_0x2d3bb5){var _0x7330ba=function(_0x41508a){while(--_0x41508a){_0x3a0d83['push'](_0x3a0d83['shift']());}};_0x7330ba(++_0x2d3bb5);}(_0xd33f,0x151));var _0xfd33=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0xd33f[_0x5959c9];return _0x4ffcbc;};'use strict';var Sequelize=require(_0xfd33('0x0'));module['exports']={'name':{'type':Sequelize[_0xfd33('0x1')],'unique':_0xfd33('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xfd33('0x1')]}}; \ No newline at end of file +var _0x93a8=['STRING','sequelize'];(function(_0x29ffb9,_0x1c4d09){var _0x2c7e80=function(_0x4c55f8){while(--_0x4c55f8){_0x29ffb9['push'](_0x29ffb9['shift']());}};_0x2c7e80(++_0x1c4d09);}(_0x93a8,0xf7));var _0x893a=function(_0x34e19c,_0x3ff40c){_0x34e19c=_0x34e19c-0x0;var _0x4409b6=_0x93a8[_0x34e19c];return _0x4409b6;};'use strict';var Sequelize=require(_0x893a('0x0'));module['exports']={'name':{'type':Sequelize[_0x893a('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f52a678..b1f92d3 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 _0x8fb2=['intersection','model','query','attributes','fields','nolimit','order','sort','filters','filter','where','merge','map','Pause','include','findAll','rows','catch','show','params','length','includeAll','options','create','body','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','Pauses','error','stack','name','send','rawAttributes','fieldName','type','key','keys'];(function(_0x2a61c5,_0x18f617){var _0x3fd8ac=function(_0xf9e440){while(--_0xf9e440){_0x2a61c5['push'](_0x2a61c5['shift']());}};_0x3fd8ac(++_0x18f617);}(_0x8fb2,0x116));var _0x28fb=function(_0x496319,_0xfa089){_0x496319=_0x496319-0x0;var _0xf58e5e=_0x8fb2[_0x496319];return _0xf58e5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28fb('0x0'));var zipdir=require(_0x28fb('0x1'));var jsonpatch=require(_0x28fb('0x2'));var rp=require(_0x28fb('0x3'));var moment=require(_0x28fb('0x4'));var BPromise=require(_0x28fb('0x5'));var Mustache=require(_0x28fb('0x6'));var util=require(_0x28fb('0x7'));var path=require(_0x28fb('0x8'));var sox=require(_0x28fb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28fb('0xa'));var squel=require(_0x28fb('0xb'));var crypto=require(_0x28fb('0xc'));var jsforce=require(_0x28fb('0xd'));var deskjs=require(_0x28fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x28fb('0xf'));var Papa=require(_0x28fb('0x10'));var Redis=require(_0x28fb('0x11'));var authService=require(_0x28fb('0x12'));var qs=require(_0x28fb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28fb('0x14'));var logger=require(_0x28fb('0x15'))('api');var utils=require(_0x28fb('0x16'));var config=require(_0x28fb('0x17'));var licenseUtil=require(_0x28fb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x515ce9,_0x6ccac4){_0x6ccac4=_0x6ccac4||0xcc;return function(_0x1b6ec9){if(_0x1b6ec9){return _0x515ce9[_0x28fb('0x19')](_0x6ccac4);}return _0x515ce9[_0x28fb('0x1a')](_0x6ccac4)[_0x28fb('0x1b')]();};}function respondWithResult(_0x37177e,_0x5d41c7){_0x5d41c7=_0x5d41c7||0xc8;return function(_0x1764b8){if(_0x1764b8){return _0x37177e['status'](_0x5d41c7)[_0x28fb('0x1c')](_0x1764b8);}};}function respondWithFilteredResult(_0x34b271,_0x1d793c){return function(_0x22788a){if(_0x22788a){var _0x4272b3=typeof _0x1d793c[_0x28fb('0x1d')]===_0x28fb('0x1e')&&typeof _0x1d793c[_0x28fb('0x1f')]===_0x28fb('0x1e');var _0x336f99=_0x22788a[_0x28fb('0x20')];var _0xb150fe=_0x4272b3?0x0:_0x1d793c[_0x28fb('0x1d')];var _0x1b7b7e=_0x4272b3?_0x22788a[_0x28fb('0x20')]:_0x1d793c[_0x28fb('0x1d')]+_0x1d793c[_0x28fb('0x1f')];var _0xcbbf03;if(_0x1b7b7e>=_0x336f99){_0x1b7b7e=_0x336f99;_0xcbbf03=0xc8;}else{_0xcbbf03=0xce;}_0x34b271[_0x28fb('0x1a')](_0xcbbf03);return _0x34b271[_0x28fb('0x21')]('Content-Range',_0xb150fe+'-'+_0x1b7b7e+'/'+_0x336f99)[_0x28fb('0x1c')](_0x22788a);}return null;};}function patchUpdates(_0xfa4ff3){return function(_0x1c4bdc){try{jsonpatch[_0x28fb('0x22')](_0x1c4bdc,_0xfa4ff3,!![]);}catch(_0x3c3e78){return BPromise[_0x28fb('0x23')](_0x3c3e78);}return _0x1c4bdc[_0x28fb('0x24')]();};}function saveUpdates(_0x5a41dd,_0x2ab0ba){return function(_0x46b247){if(_0x46b247){return _0x46b247['update'](_0x5a41dd)['then'](function(_0x25f346){return _0x25f346;});}return null;};}function removeEntity(_0x175b4d,_0x2110d7){return function(_0x346be9){if(_0x346be9){return _0x346be9[_0x28fb('0x25')]()[_0x28fb('0x26')](function(){var _0x1234c0=_0x346be9[_0x28fb('0x27')]({'plain':!![]});var _0x280eda=_0x28fb('0x28');return db['UserProfileResource'][_0x28fb('0x25')]({'where':{'type':_0x280eda,'resourceId':_0x1234c0['id']}})[_0x28fb('0x26')](function(){return _0x346be9;});})['then'](function(){_0x175b4d[_0x28fb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ca8ec,_0x24b451){return function(_0x1ca95a){if(!_0x1ca95a){_0x2ca8ec[_0x28fb('0x19')](0x194);}return _0x1ca95a;};}function handleError(_0x45e78a,_0x24ed96){_0x24ed96=_0x24ed96||0x1f4;return function(_0x323522){logger[_0x28fb('0x29')](_0x323522[_0x28fb('0x2a')]);if(_0x323522[_0x28fb('0x2b')]){delete _0x323522[_0x28fb('0x2b')];}_0x45e78a[_0x28fb('0x1a')](_0x24ed96)[_0x28fb('0x2c')](_0x323522);};}exports['index']=function(_0x49ddfc,_0x1bb95c){var _0x4ec29f={},_0x22e0b9={},_0x18322e={'count':0x0,'rows':[]};var _0x56ad66=_['map'](db['Pause'][_0x28fb('0x2d')],function(_0x4de3c2){return{'name':_0x4de3c2[_0x28fb('0x2e')],'type':_0x4de3c2[_0x28fb('0x2f')][_0x28fb('0x30')]};});_0x22e0b9['model']=_['map'](_0x56ad66,'name');_0x22e0b9['query']=_[_0x28fb('0x31')](_0x49ddfc['query']);_0x22e0b9['filters']=_[_0x28fb('0x32')](_0x22e0b9[_0x28fb('0x33')],_0x22e0b9[_0x28fb('0x34')]);_0x4ec29f[_0x28fb('0x35')]=_['intersection'](_0x22e0b9['model'],qs['fields'](_0x49ddfc[_0x28fb('0x34')][_0x28fb('0x36')]));_0x4ec29f[_0x28fb('0x35')]=_0x4ec29f['attributes']['length']?_0x4ec29f[_0x28fb('0x35')]:_0x22e0b9[_0x28fb('0x33')];if(!_0x49ddfc[_0x28fb('0x34')]['hasOwnProperty'](_0x28fb('0x37'))){_0x4ec29f[_0x28fb('0x1f')]=qs[_0x28fb('0x1f')](_0x49ddfc['query']['limit']);_0x4ec29f[_0x28fb('0x1d')]=qs[_0x28fb('0x1d')](_0x49ddfc[_0x28fb('0x34')]['offset']);}_0x4ec29f[_0x28fb('0x38')]=qs[_0x28fb('0x39')](_0x49ddfc[_0x28fb('0x34')][_0x28fb('0x39')]);_0x4ec29f['where']=qs[_0x28fb('0x3a')](_['pick'](_0x49ddfc['query'],_0x22e0b9[_0x28fb('0x3a')]),_0x56ad66);if(_0x49ddfc[_0x28fb('0x34')][_0x28fb('0x3b')]){_0x4ec29f[_0x28fb('0x3c')]=_[_0x28fb('0x3d')](_0x4ec29f[_0x28fb('0x3c')],{'$or':_[_0x28fb('0x3e')](_0x56ad66,function(_0x1550fa){if(_0x1550fa[_0x28fb('0x2f')]!=='VIRTUAL'){var _0x497baf={};_0x497baf[_0x1550fa[_0x28fb('0x2b')]]={'$like':'%'+_0x49ddfc[_0x28fb('0x34')][_0x28fb('0x3b')]+'%'};return _0x497baf;}})});}_0x4ec29f=_[_0x28fb('0x3d')]({},_0x4ec29f,_0x49ddfc['options']);var _0x166654={'where':_0x4ec29f['where']};return db[_0x28fb('0x3f')][_0x28fb('0x20')](_0x166654)[_0x28fb('0x26')](function(_0x41d8db){_0x18322e[_0x28fb('0x20')]=_0x41d8db;if(_0x49ddfc['query']['includeAll']){_0x4ec29f[_0x28fb('0x40')]=[{'all':!![]}];}return db[_0x28fb('0x3f')][_0x28fb('0x41')](_0x4ec29f);})['then'](function(_0x107f2b){_0x18322e[_0x28fb('0x42')]=_0x107f2b;return _0x18322e;})['then'](respondWithFilteredResult(_0x1bb95c,_0x4ec29f))[_0x28fb('0x43')](handleError(_0x1bb95c,null));};exports[_0x28fb('0x44')]=function(_0xa0febc,_0x5ad293){var _0x2a0158={'raw':!![],'where':{'id':_0xa0febc[_0x28fb('0x45')]['id']}},_0x1ec453={};_0x1ec453[_0x28fb('0x33')]=_[_0x28fb('0x31')](db[_0x28fb('0x3f')]['rawAttributes']);_0x1ec453[_0x28fb('0x34')]=_[_0x28fb('0x31')](_0xa0febc[_0x28fb('0x34')]);_0x1ec453[_0x28fb('0x3a')]=_[_0x28fb('0x32')](_0x1ec453[_0x28fb('0x33')],_0x1ec453[_0x28fb('0x34')]);_0x2a0158[_0x28fb('0x35')]=_[_0x28fb('0x32')](_0x1ec453['model'],qs[_0x28fb('0x36')](_0xa0febc['query'][_0x28fb('0x36')]));_0x2a0158[_0x28fb('0x35')]=_0x2a0158['attributes'][_0x28fb('0x46')]?_0x2a0158[_0x28fb('0x35')]:_0x1ec453[_0x28fb('0x33')];if(_0xa0febc[_0x28fb('0x34')][_0x28fb('0x47')]){_0x2a0158[_0x28fb('0x40')]=[{'all':!![]}];}_0x2a0158=_['merge']({},_0x2a0158,_0xa0febc[_0x28fb('0x48')]);return db[_0x28fb('0x3f')]['find'](_0x2a0158)[_0x28fb('0x26')](handleEntityNotFound(_0x5ad293,null))[_0x28fb('0x26')](respondWithResult(_0x5ad293,null))[_0x28fb('0x43')](handleError(_0x5ad293,null));};exports[_0x28fb('0x49')]=function(_0x50863e,_0x4d4c94){return db[_0x28fb('0x3f')][_0x28fb('0x49')](_0x50863e[_0x28fb('0x4a')],{})['then'](function(_0x13aad0){var _0x1129fe=_0x50863e[_0x28fb('0x4b')][_0x28fb('0x27')]({'plain':!![]});if(!_0x1129fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1129fe['role']===_0x28fb('0x4b')){var _0x19668c=_0x13aad0['get']({'plain':!![]});var _0x1c20d1='Pauses';return db[_0x28fb('0x4c')][_0x28fb('0x4d')]({'where':{'name':_0x1c20d1,'userProfileId':_0x1129fe['userProfileId']},'raw':!![]})['then'](function(_0x1435c7){if(_0x1435c7&&_0x1435c7[_0x28fb('0x4e')]===0x0){return db[_0x28fb('0x4f')][_0x28fb('0x49')]({'name':_0x19668c['name'],'resourceId':_0x19668c['id'],'type':_0x1435c7[_0x28fb('0x2b')],'sectionId':_0x1435c7['id']},{})[_0x28fb('0x26')](function(){return _0x13aad0;});}else{return _0x13aad0;}})['catch'](function(_0x3c79ff){logger[_0x28fb('0x29')](_0x28fb('0x50'),_0x3c79ff);throw _0x3c79ff;});}return _0x13aad0;})[_0x28fb('0x26')](respondWithResult(_0x4d4c94,0xc9))['catch'](handleError(_0x4d4c94,null));};exports[_0x28fb('0x51')]=function(_0x2ca003,_0x46d736){if(_0x2ca003['body']['id']){delete _0x2ca003['body']['id'];}return db[_0x28fb('0x3f')]['find']({'where':{'id':_0x2ca003[_0x28fb('0x45')]['id']}})['then'](handleEntityNotFound(_0x46d736,null))[_0x28fb('0x26')](saveUpdates(_0x2ca003[_0x28fb('0x4a')],null))[_0x28fb('0x26')](respondWithResult(_0x46d736,null))[_0x28fb('0x43')](handleError(_0x46d736,null));};exports[_0x28fb('0x25')]=function(_0x7e088e,_0x60cbb6){return db['Pause'][_0x28fb('0x4d')]({'where':{'id':_0x7e088e['params']['id']}})[_0x28fb('0x26')](handleEntityNotFound(_0x60cbb6,null))[_0x28fb('0x26')](removeEntity(_0x60cbb6,null))[_0x28fb('0x43')](handleError(_0x60cbb6,null));}; \ No newline at end of file +var _0x5646=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','Content-Range','reject','update','then','destroy','get','Pauses','UserProfileResource','error','name','send','index','Pause','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','count','findAll','catch','show','params','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2dbcef,_0x1cfecb){var _0x5a90ea=function(_0x189054){while(--_0x189054){_0x2dbcef['push'](_0x2dbcef['shift']());}};_0x5a90ea(++_0x1cfecb);}(_0x5646,0x1cc));var _0x6564=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0x5646[_0x4b4277];return _0x1ff405;};'use strict';var emlformat=require(_0x6564('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6564('0x1'));var moment=require(_0x6564('0x2'));var BPromise=require(_0x6564('0x3'));var Mustache=require(_0x6564('0x4'));var util=require(_0x6564('0x5'));var path=require(_0x6564('0x6'));var sox=require(_0x6564('0x7'));var csv=require(_0x6564('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6564('0x9'));var jsforce=require(_0x6564('0xa'));var deskjs=require(_0x6564('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6564('0xc'));var Papa=require(_0x6564('0xd'));var Redis=require(_0x6564('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6564('0xf'));var as=require(_0x6564('0x10'));var hardwareService=require(_0x6564('0x11'));var logger=require(_0x6564('0x12'))(_0x6564('0x13'));var utils=require(_0x6564('0x14'));var config=require(_0x6564('0x15'));var licenseUtil=require(_0x6564('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cfe06,_0x3172d1){_0x3172d1=_0x3172d1||0xcc;return function(_0xf2a924){if(_0xf2a924){return _0x3cfe06[_0x6564('0x17')](_0x3172d1);}return _0x3cfe06['status'](_0x3172d1)[_0x6564('0x18')]();};}function respondWithResult(_0x1b5920,_0xfff343){_0xfff343=_0xfff343||0xc8;return function(_0x30544d){if(_0x30544d){return _0x1b5920[_0x6564('0x19')](_0xfff343)[_0x6564('0x1a')](_0x30544d);}};}function respondWithFilteredResult(_0x19fd39,_0x21cdf5){return function(_0x525114){if(_0x525114){var _0x29bd81=typeof _0x21cdf5[_0x6564('0x1b')]===_0x6564('0x1c')&&typeof _0x21cdf5['limit']===_0x6564('0x1c');var _0xbb7fa8=_0x525114['count'];var _0x54ac34=_0x29bd81?0x0:_0x21cdf5[_0x6564('0x1b')];var _0x61ac5f=_0x29bd81?_0x525114['count']:_0x21cdf5[_0x6564('0x1b')]+_0x21cdf5['limit'];var _0xc32ad9;if(_0x61ac5f>=_0xbb7fa8){_0x61ac5f=_0xbb7fa8;_0xc32ad9=0xc8;}else{_0xc32ad9=0xce;}_0x19fd39[_0x6564('0x19')](_0xc32ad9);return _0x19fd39['set'](_0x6564('0x1d'),_0x54ac34+'-'+_0x61ac5f+'/'+_0xbb7fa8)[_0x6564('0x1a')](_0x525114);}return null;};}function patchUpdates(_0x381f70){return function(_0x3f7074){try{jsonpatch['apply'](_0x3f7074,_0x381f70,!![]);}catch(_0xaaf1c){return BPromise[_0x6564('0x1e')](_0xaaf1c);}return _0x3f7074['save']();};}function saveUpdates(_0x45c1dc,_0x5d9623){return function(_0x1da479){if(_0x1da479){return _0x1da479[_0x6564('0x1f')](_0x45c1dc)[_0x6564('0x20')](function(_0x4b382c){return _0x4b382c;});}return null;};}function removeEntity(_0x1ab8e1,_0x49dd17){return function(_0x1734fd){if(_0x1734fd){return _0x1734fd[_0x6564('0x21')]()[_0x6564('0x20')](function(){var _0x4e40b3=_0x1734fd[_0x6564('0x22')]({'plain':!![]});var _0x2dbcc6=_0x6564('0x23');return db[_0x6564('0x24')][_0x6564('0x21')]({'where':{'type':_0x2dbcc6,'resourceId':_0x4e40b3['id']}})[_0x6564('0x20')](function(){return _0x1734fd;});})[_0x6564('0x20')](function(){_0x1ab8e1['status'](0xcc)[_0x6564('0x18')]();});}};}function handleEntityNotFound(_0x9d719d,_0x1ac7b4){return function(_0x52372d){if(!_0x52372d){_0x9d719d[_0x6564('0x17')](0x194);}return _0x52372d;};}function handleError(_0xea4568,_0x4472f9){_0x4472f9=_0x4472f9||0x1f4;return function(_0x16ee1f){logger[_0x6564('0x25')](_0x16ee1f['stack']);if(_0x16ee1f[_0x6564('0x26')]){delete _0x16ee1f[_0x6564('0x26')];}_0xea4568[_0x6564('0x19')](_0x4472f9)[_0x6564('0x27')](_0x16ee1f);};}exports[_0x6564('0x28')]=function(_0x457166,_0x4b0f93){var _0x2c7ef5={},_0x10dd42={},_0x5e73c1={'count':0x0,'rows':[]};var _0x68923f=_['map'](db[_0x6564('0x29')]['rawAttributes'],function(_0x28b942){return{'name':_0x28b942[_0x6564('0x2a')],'type':_0x28b942[_0x6564('0x2b')][_0x6564('0x2c')]};});_0x10dd42[_0x6564('0x2d')]=_[_0x6564('0x2e')](_0x68923f,_0x6564('0x26'));_0x10dd42['query']=_[_0x6564('0x2f')](_0x457166[_0x6564('0x30')]);_0x10dd42[_0x6564('0x31')]=_[_0x6564('0x32')](_0x10dd42[_0x6564('0x2d')],_0x10dd42[_0x6564('0x30')]);_0x2c7ef5[_0x6564('0x33')]=_[_0x6564('0x32')](_0x10dd42[_0x6564('0x2d')],qs[_0x6564('0x34')](_0x457166[_0x6564('0x30')][_0x6564('0x34')]));_0x2c7ef5[_0x6564('0x33')]=_0x2c7ef5[_0x6564('0x33')][_0x6564('0x35')]?_0x2c7ef5[_0x6564('0x33')]:_0x10dd42[_0x6564('0x2d')];if(!_0x457166[_0x6564('0x30')]['hasOwnProperty'](_0x6564('0x36'))){_0x2c7ef5[_0x6564('0x37')]=qs[_0x6564('0x37')](_0x457166[_0x6564('0x30')][_0x6564('0x37')]);_0x2c7ef5[_0x6564('0x1b')]=qs[_0x6564('0x1b')](_0x457166[_0x6564('0x30')][_0x6564('0x1b')]);}_0x2c7ef5[_0x6564('0x38')]=qs['sort'](_0x457166[_0x6564('0x30')][_0x6564('0x39')]);_0x2c7ef5[_0x6564('0x3a')]=qs['filters'](_['pick'](_0x457166['query'],_0x10dd42[_0x6564('0x31')]),_0x68923f);if(_0x457166['query'][_0x6564('0x3b')]){_0x2c7ef5[_0x6564('0x3a')]=_[_0x6564('0x3c')](_0x2c7ef5['where'],{'$or':_['map'](_0x68923f,function(_0x404ed7){if(_0x404ed7['type']!==_0x6564('0x3d')){var _0xc05e75={};_0xc05e75[_0x404ed7[_0x6564('0x26')]]={'$like':'%'+_0x457166[_0x6564('0x30')][_0x6564('0x3b')]+'%'};return _0xc05e75;}})});}_0x2c7ef5=_['merge']({},_0x2c7ef5,_0x457166['options']);var _0x53025d={'where':_0x2c7ef5[_0x6564('0x3a')]};return db[_0x6564('0x29')][_0x6564('0x3e')](_0x53025d)[_0x6564('0x20')](function(_0x2759ad){_0x5e73c1['count']=_0x2759ad;if(_0x457166[_0x6564('0x30')]['includeAll']){_0x2c7ef5['include']=[{'all':!![]}];}return db[_0x6564('0x29')][_0x6564('0x3f')](_0x2c7ef5);})[_0x6564('0x20')](function(_0x98512a){_0x5e73c1['rows']=_0x98512a;return _0x5e73c1;})[_0x6564('0x20')](respondWithFilteredResult(_0x4b0f93,_0x2c7ef5))[_0x6564('0x40')](handleError(_0x4b0f93,null));};exports[_0x6564('0x41')]=function(_0x4cfe5c,_0x2270a9){var _0x544899={'raw':!![],'where':{'id':_0x4cfe5c[_0x6564('0x42')]['id']}},_0xe9f2a8={};_0xe9f2a8[_0x6564('0x2d')]=_[_0x6564('0x2f')](db[_0x6564('0x29')]['rawAttributes']);_0xe9f2a8['query']=_[_0x6564('0x2f')](_0x4cfe5c[_0x6564('0x30')]);_0xe9f2a8[_0x6564('0x31')]=_[_0x6564('0x32')](_0xe9f2a8[_0x6564('0x2d')],_0xe9f2a8[_0x6564('0x30')]);_0x544899['attributes']=_[_0x6564('0x32')](_0xe9f2a8['model'],qs['fields'](_0x4cfe5c['query']['fields']));_0x544899[_0x6564('0x33')]=_0x544899[_0x6564('0x33')][_0x6564('0x35')]?_0x544899[_0x6564('0x33')]:_0xe9f2a8[_0x6564('0x2d')];if(_0x4cfe5c['query'][_0x6564('0x43')]){_0x544899[_0x6564('0x44')]=[{'all':!![]}];}_0x544899=_['merge']({},_0x544899,_0x4cfe5c[_0x6564('0x45')]);return db[_0x6564('0x29')][_0x6564('0x46')](_0x544899)[_0x6564('0x20')](handleEntityNotFound(_0x2270a9,null))[_0x6564('0x20')](respondWithResult(_0x2270a9,null))[_0x6564('0x40')](handleError(_0x2270a9,null));};exports[_0x6564('0x47')]=function(_0x26f4f2,_0x423aea){return db[_0x6564('0x29')][_0x6564('0x47')](_0x26f4f2[_0x6564('0x48')],{})[_0x6564('0x20')](function(_0x3de417){var _0x33f903=_0x26f4f2[_0x6564('0x49')][_0x6564('0x22')]({'plain':!![]});if(!_0x33f903)throw new Error(_0x6564('0x4a'));if(_0x33f903['role']===_0x6564('0x49')){var _0x55c364=_0x3de417[_0x6564('0x22')]({'plain':!![]});var _0x1a87b9=_0x6564('0x23');return db[_0x6564('0x4b')][_0x6564('0x46')]({'where':{'name':_0x1a87b9,'userProfileId':_0x33f903[_0x6564('0x4c')]},'raw':!![]})[_0x6564('0x20')](function(_0x1e1345){if(_0x1e1345&&_0x1e1345[_0x6564('0x4d')]===0x0){return db['UserProfileResource'][_0x6564('0x47')]({'name':_0x55c364['name'],'resourceId':_0x55c364['id'],'type':_0x1e1345[_0x6564('0x26')],'sectionId':_0x1e1345['id']},{})[_0x6564('0x20')](function(){return _0x3de417;});}else{return _0x3de417;}})[_0x6564('0x40')](function(_0x255b19){logger[_0x6564('0x25')](_0x6564('0x4e'),_0x255b19);throw _0x255b19;});}return _0x3de417;})[_0x6564('0x20')](respondWithResult(_0x423aea,0xc9))[_0x6564('0x40')](handleError(_0x423aea,null));};exports[_0x6564('0x1f')]=function(_0x7c642f,_0x35e6a5){if(_0x7c642f[_0x6564('0x48')]['id']){delete _0x7c642f['body']['id'];}return db['Pause'][_0x6564('0x46')]({'where':{'id':_0x7c642f[_0x6564('0x42')]['id']}})[_0x6564('0x20')](handleEntityNotFound(_0x35e6a5,null))[_0x6564('0x20')](saveUpdates(_0x7c642f[_0x6564('0x48')],null))[_0x6564('0x20')](respondWithResult(_0x35e6a5,null))['catch'](handleError(_0x35e6a5,null));};exports[_0x6564('0x21')]=function(_0x2adfa7,_0x8e8947){return db[_0x6564('0x29')][_0x6564('0x46')]({'where':{'id':_0x2adfa7[_0x6564('0x42')]['id']}})['then'](handleEntityNotFound(_0x8e8947,null))[_0x6564('0x20')](removeEntity(_0x8e8947,null))['catch'](handleError(_0x8e8947,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index cf4fa1c..4162589 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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6aa7,0x178));var _0x76aa=function(_0x4a5e99,_0x142ebb){_0x4a5e99=_0x4a5e99-0x0;var _0x1d4f4c=_0x6aa7[_0x4a5e99];return _0x1d4f4c;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x300dd4,_0x5b52af){var _0x50fbb8=function(_0x4e0938){while(--_0x4e0938){_0x300dd4['push'](_0x300dd4['shift']());}};_0x50fbb8(++_0x5b52af);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3f0015,_0x5c4628){_0x3f0015=_0x3f0015-0x0;var _0x10c4ea=_0x1cb9[_0x3f0015];return _0x10c4ea;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),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 f217ee8..1d53ff0 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0xeecb19,_0x5d5ee1){var _0x252c6f=function(_0xeb774d){while(--_0xeb774d){_0xeecb19['push'](_0xeecb19['shift']());}};_0x252c6f(++_0x5d5ee1);}(_0xb10b,0x12a));var _0xbb10=function(_0x306646,_0xdc2e1b){_0x306646=_0x306646-0x0;var _0x40bd8d=_0xb10b[_0x306646];return _0x40bd8d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3823b6,_0x57606f){var _0x1f09e8=function(_0x2bb58f){while(--_0x2bb58f){_0x3823b6['push'](_0x3823b6['shift']());}};_0x1f09e8(++_0x57606f);}(_0xb10b,0x12a));var _0xbb10=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0xb10b[_0xd58823];return _0x249c0a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 3c94201..676ebc8 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 _0xac9d=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','post','single','file','upload'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0xac9d,0x14d));var _0xdac9=function(_0x5ce4e3,_0x42cb9a){_0x5ce4e3=_0x5ce4e3-0x0;var _0x42248f=_0xac9d[_0x5ce4e3];return _0x42248f;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./plugin.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),controller[_0xdac9('0xd')]);router['get'](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0xf')]);router[_0xdac9('0x9')](_0xdac9('0x10'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x11')]);var upload=multer({'storage':multer[_0xdac9('0x12')]({'destination':function(_0x255627,_0x1b604a,_0xbb5615){_0xbb5615(null,path['join'](config[_0xdac9('0x13')],_0xdac9('0x14')));},'filename':function(_0x5a9bde,_0x3d8e97,_0xeddbc1){_0x3d8e97[_0xdac9('0x15')]=_0x3d8e97['originalname'][_0xdac9('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xeddbc1(null,util[_0xdac9('0x17')](_0xdac9('0x18'),path['basename'](_0x3d8e97['originalname'],path[_0xdac9('0x19')](_0x3d8e97[_0xdac9('0x15')])),Date['now'](),path[_0xdac9('0x19')](_0x3d8e97[_0xdac9('0x15')])));}})});router[_0xdac9('0x1a')]('/',upload[_0xdac9('0x1b')](_0xdac9('0x1c')),controller[_0xdac9('0x1d')]);router[_0xdac9('0x1a')](_0xdac9('0xc'),controller['webhookPost']);router[_0xdac9('0x1e')](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0x1f')]);router[_0xdac9('0x20')](_0xdac9('0xe'),auth[_0xdac9('0xa')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x68fc=['webhookPost','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','upload','/webhook'];(function(_0x9d23d2,_0x323a63){var _0x4e5203=function(_0x54f6e9){while(--_0x54f6e9){_0x9d23d2['push'](_0x9d23d2['shift']());}};_0x4e5203(++_0x323a63);}(_0x68fc,0xa5));var _0xc68f=function(_0x13ef75,_0x39b7b6){_0x13ef75=_0x13ef75-0x0;var _0xc4bd8f=_0x68fc[_0x13ef75];return _0xc4bd8f;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require(_0xc68f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc68f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc68f('0x5'));router[_0xc68f('0x6')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0x8')]);router['get']('/webhook',controller[_0xc68f('0x9')]);router[_0xc68f('0x6')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xb')]);router[_0xc68f('0x6')](_0xc68f('0xc'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xd')]);var upload=multer({'storage':multer[_0xc68f('0xe')]({'destination':function(_0x5777f9,_0x3b1a43,_0x29f1fe){_0x29f1fe(null,path[_0xc68f('0xf')](config[_0xc68f('0x10')],_0xc68f('0x11')));},'filename':function(_0x2a0a52,_0x3ccebe,_0x41aeb8){_0x3ccebe[_0xc68f('0x12')]=_0x3ccebe[_0xc68f('0x12')][_0xc68f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41aeb8(null,util['format'](_0xc68f('0x14'),path[_0xc68f('0x15')](_0x3ccebe[_0xc68f('0x12')],path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])),Date[_0xc68f('0x17')](),path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])));}})});router[_0xc68f('0x18')]('/',upload['single']('file'),controller[_0xc68f('0x19')]);router[_0xc68f('0x18')](_0xc68f('0x1a'),controller[_0xc68f('0x1b')]);router[_0xc68f('0x1c')](_0xc68f('0xa'),auth['isAuthenticated'](),controller[_0xc68f('0x1d')]);router[_0xc68f('0x1e')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0x1e')]);module[_0xc68f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 03cd274..edce9b9 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 _0x9772=['BOOLEAN','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','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x37af10,_0x4827a7){var _0x76baed=function(_0x194428){while(--_0x194428){_0x37af10['push'](_0x37af10['shift']());}};_0x76baed(++_0x4827a7);}(_0x9772,0xe7));var _0x2977=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x9772[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x2977('0x0'));module['exports']={'name':{'type':Sequelize[_0x2977('0x1')]},'type':{'type':Sequelize[_0x2977('0x2')](_0x2977('0x3'),_0x2977('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x2977('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x2977('0x6')},'active':{'type':Sequelize[_0x2977('0x7')],'defaultValue':0x0,'comment':_0x2977('0x8')},'sidebar':{'type':Sequelize[_0x2977('0x2')](_0x2977('0x9'),_0x2977('0xa'),_0x2977('0xb'),_0x2977('0xc')),'defaultValue':_0x2977('0xb'),'comment':_0x2977('0xd')},'icon':{'type':Sequelize[_0x2977('0x1')]},'adminUrl':{'type':Sequelize[_0x2977('0x1')]},'agentUrl':{'type':Sequelize[_0x2977('0x1')]},'scriptName':{'type':Sequelize[_0x2977('0x1')]},'scriptPath':{'type':Sequelize[_0x2977('0x1')]}}; \ No newline at end of file +var _0x3b15=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0x29313f,_0x234b48){var _0x35b18b=function(_0xf4cc3c){while(--_0xf4cc3c){_0x29313f['push'](_0x29313f['shift']());}};_0x35b18b(++_0x234b48);}(_0x3b15,0x1e1));var _0x53b1=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x3b15[_0x175a55];return _0x167adf;};'use strict';var Sequelize=require(_0x53b1('0x0'));module[_0x53b1('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x53b1('0x2')](_0x53b1('0x3'),_0x53b1('0x4'))},'description':{'type':Sequelize[_0x53b1('0x5')]},'version':{'type':Sequelize[_0x53b1('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x53b1('0x6')},'active':{'type':Sequelize[_0x53b1('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x53b1('0x2')](_0x53b1('0x8'),_0x53b1('0x9'),_0x53b1('0xa'),_0x53b1('0xb')),'defaultValue':_0x53b1('0xa'),'comment':_0x53b1('0xc')},'icon':{'type':Sequelize[_0x53b1('0xd')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x53b1('0xd')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 7c9d745..83692fe 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 _0x257a=['find','params','path','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','join','root','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','unlinkSync','info','Download\x20completed','upload','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','admin','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','http://localhost:','method','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','Plugin','includeAll','include','findAll','rows','catch','keys'];(function(_0x44feb5,_0x3f7964){var _0x45e3b8=function(_0x2848be){while(--_0x2848be){_0x44feb5['push'](_0x44feb5['shift']());}};_0x45e3b8(++_0x3f7964);}(_0x257a,0x111));var _0xa257=function(_0x11cc41,_0x3c30ab){_0x11cc41=_0x11cc41-0x0;var _0x474e9e=_0x257a[_0x11cc41];return _0x474e9e;};'use strict';var emlformat=require(_0xa257('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa257('0x1'));var jsonpatch=require(_0xa257('0x2'));var rp=require(_0xa257('0x3'));var moment=require(_0xa257('0x4'));var BPromise=require(_0xa257('0x5'));var Mustache=require(_0xa257('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa257('0x7'));var csv=require(_0xa257('0x8'));var ejs=require(_0xa257('0x9'));var fs=require('fs');var fs_extra=require(_0xa257('0xa'));var _=require(_0xa257('0xb'));var squel=require(_0xa257('0xc'));var crypto=require(_0xa257('0xd'));var jsforce=require(_0xa257('0xe'));var deskjs=require(_0xa257('0xf'));var toCsv=require(_0xa257('0x8'));var querystring=require(_0xa257('0x10'));var Papa=require(_0xa257('0x11'));var extract=require(_0xa257('0x12'));var rimraf=require('rimraf');var archiver=require(_0xa257('0x13'));var Redis=require(_0xa257('0x14'));var authService=require(_0xa257('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xa257('0x16'));var hardwareService=require(_0xa257('0x17'));var logger=require(_0xa257('0x18'))(_0xa257('0x19'));var utils=require(_0xa257('0x1a'));var config=require(_0xa257('0x1b'));var licenseUtil=require(_0xa257('0x1c'));var db=require(_0xa257('0x1d'))['db'];config[_0xa257('0x1e')]=_[_0xa257('0x1f')](config[_0xa257('0x1e')],{'host':_0xa257('0x20'),'port':0x18eb});var socket=require(_0xa257('0x21'))(new Redis(config[_0xa257('0x1e')]));require(_0xa257('0x22'))['register'](socket);function respondWithStatusCode(_0x2e3ca6,_0x22960b){_0x22960b=_0x22960b||0xcc;return function(_0x303c89){if(_0x303c89){return _0x2e3ca6[_0xa257('0x23')](_0x22960b);}return _0x2e3ca6[_0xa257('0x24')](_0x22960b)[_0xa257('0x25')]();};}function respondWithResult(_0x4537e8,_0x40bbd7){_0x40bbd7=_0x40bbd7||0xc8;return function(_0xde8f09){if(_0xde8f09){return _0x4537e8['status'](_0x40bbd7)[_0xa257('0x26')](_0xde8f09);}};}function respondWithFilteredResult(_0xf9d7f0,_0xb4832a){return function(_0x246d7d){if(_0x246d7d){var _0x3cca04=typeof _0xb4832a[_0xa257('0x27')]==='undefined'&&typeof _0xb4832a[_0xa257('0x28')]===_0xa257('0x29');var _0x5740c0=_0x246d7d['count'];var _0x493f8c=_0x3cca04?0x0:_0xb4832a[_0xa257('0x27')];var _0x1aa681=_0x3cca04?_0x246d7d[_0xa257('0x2a')]:_0xb4832a[_0xa257('0x27')]+_0xb4832a['limit'];var _0x59d983;if(_0x1aa681>=_0x5740c0){_0x1aa681=_0x5740c0;_0x59d983=0xc8;}else{_0x59d983=0xce;}_0xf9d7f0[_0xa257('0x24')](_0x59d983);return _0xf9d7f0[_0xa257('0x2b')](_0xa257('0x2c'),_0x493f8c+'-'+_0x1aa681+'/'+_0x5740c0)['json'](_0x246d7d);}return null;};}function patchUpdates(_0x239e27){return function(_0x3c0257){try{jsonpatch[_0xa257('0x2d')](_0x3c0257,_0x239e27,!![]);}catch(_0x39eb43){return BPromise[_0xa257('0x2e')](_0x39eb43);}return _0x3c0257[_0xa257('0x2f')]();};}function saveUpdates(_0x17c513,_0x466cc0){return function(_0xbbaad4){if(_0xbbaad4){return _0xbbaad4[_0xa257('0x30')](_0x17c513)['then'](function(_0x3c28df){return _0x3c28df;});}return null;};}function removeEntity(_0x1d4f9a,_0x5dbb74){return function(_0x45e6c5){if(_0x45e6c5){return _0x45e6c5[_0xa257('0x31')]()[_0xa257('0x32')](function(){var _0x3671bc=_0x45e6c5[_0xa257('0x33')]({'plain':!![]});var _0x35cd28=_0xa257('0x34');return db[_0xa257('0x35')][_0xa257('0x31')]({'where':{'type':_0x35cd28,'resourceId':_0x3671bc['id']}})['then'](function(){return _0x45e6c5;});})['then'](function(){_0x1d4f9a['status'](0xcc)[_0xa257('0x25')]();});}};}function handleEntityNotFound(_0x3b7390,_0x361097){return function(_0x1f0a08){if(!_0x1f0a08){_0x3b7390[_0xa257('0x23')](0x194);}return _0x1f0a08;};}function handleError(_0xda0e3c,_0xc3ad4b){_0xc3ad4b=_0xc3ad4b||0x1f4;return function(_0x4aa471){logger[_0xa257('0x36')](_0x4aa471[_0xa257('0x37')]);if(_0x4aa471[_0xa257('0x38')]){delete _0x4aa471['name'];}_0xda0e3c['status'](_0xc3ad4b)['send'](_0x4aa471);};}exports[_0xa257('0x39')]=function(_0xff5fd1,_0x2e338d){var _0x512275={},_0x569a75={},_0x243709={'count':0x0,'rows':[]};var _0x3001e9=_[_0xa257('0x3a')](db['Plugin'][_0xa257('0x3b')],function(_0x54aaf1){return{'name':_0x54aaf1[_0xa257('0x3c')],'type':_0x54aaf1[_0xa257('0x3d')][_0xa257('0x3e')]};});_0x569a75['model']=_[_0xa257('0x3a')](_0x3001e9,_0xa257('0x38'));_0x569a75[_0xa257('0x3f')]=_['keys'](_0xff5fd1['query']);_0x569a75[_0xa257('0x40')]=_[_0xa257('0x41')](_0x569a75['model'],_0x569a75['query']);_0x512275[_0xa257('0x42')]=_[_0xa257('0x41')](_0x569a75[_0xa257('0x43')],qs[_0xa257('0x44')](_0xff5fd1[_0xa257('0x3f')][_0xa257('0x44')]));_0x512275[_0xa257('0x42')]=_0x512275[_0xa257('0x42')][_0xa257('0x45')]?_0x512275[_0xa257('0x42')]:_0x569a75['model'];if(!_0xff5fd1[_0xa257('0x3f')]['hasOwnProperty'](_0xa257('0x46'))){_0x512275['limit']=qs[_0xa257('0x28')](_0xff5fd1[_0xa257('0x3f')]['limit']);_0x512275[_0xa257('0x27')]=qs['offset'](_0xff5fd1[_0xa257('0x3f')]['offset']);}_0x512275[_0xa257('0x47')]=qs[_0xa257('0x48')](_0xff5fd1[_0xa257('0x3f')][_0xa257('0x48')]);_0x512275['where']=qs[_0xa257('0x40')](_['pick'](_0xff5fd1[_0xa257('0x3f')],_0x569a75['filters']),_0x3001e9);if(_0xff5fd1[_0xa257('0x3f')][_0xa257('0x49')]){_0x512275[_0xa257('0x4a')]=_[_0xa257('0x4b')](_0x512275[_0xa257('0x4a')],{'$or':_['map'](_0x3001e9,function(_0x265e7f){if(_0x265e7f['type']!==_0xa257('0x4c')){var _0x24e1c7={};_0x24e1c7[_0x265e7f['name']]={'$like':'%'+_0xff5fd1[_0xa257('0x3f')][_0xa257('0x49')]+'%'};return _0x24e1c7;}})});}_0x512275=_['merge']({},_0x512275,_0xff5fd1[_0xa257('0x4d')]);var _0x35e560={'where':_0x512275['where']};return db[_0xa257('0x4e')]['count'](_0x35e560)[_0xa257('0x32')](function(_0x29383b){_0x243709[_0xa257('0x2a')]=_0x29383b;if(_0xff5fd1['query'][_0xa257('0x4f')]){_0x512275[_0xa257('0x50')]=[{'all':!![]}];}return db[_0xa257('0x4e')][_0xa257('0x51')](_0x512275);})[_0xa257('0x32')](function(_0x295334){_0x243709[_0xa257('0x52')]=_0x295334;return _0x243709;})[_0xa257('0x32')](respondWithFilteredResult(_0x2e338d,_0x512275))[_0xa257('0x53')](handleError(_0x2e338d,null));};exports['show']=function(_0x170dcc,_0x511294){var _0x441ac5={'raw':!![],'where':{'id':_0x170dcc['params']['id']}},_0x2a4dd5={};_0x2a4dd5[_0xa257('0x43')]=_['keys'](db['Plugin']['rawAttributes']);_0x2a4dd5['query']=_[_0xa257('0x54')](_0x170dcc[_0xa257('0x3f')]);_0x2a4dd5[_0xa257('0x40')]=_['intersection'](_0x2a4dd5['model'],_0x2a4dd5['query']);_0x441ac5[_0xa257('0x42')]=_[_0xa257('0x41')](_0x2a4dd5[_0xa257('0x43')],qs[_0xa257('0x44')](_0x170dcc['query'][_0xa257('0x44')]));_0x441ac5[_0xa257('0x42')]=_0x441ac5[_0xa257('0x42')][_0xa257('0x45')]?_0x441ac5[_0xa257('0x42')]:_0x2a4dd5[_0xa257('0x43')];if(_0x170dcc['query'][_0xa257('0x4f')]){_0x441ac5[_0xa257('0x50')]=[{'all':!![]}];}_0x441ac5=_[_0xa257('0x4b')]({},_0x441ac5,_0x170dcc[_0xa257('0x4d')]);return db[_0xa257('0x4e')][_0xa257('0x55')](_0x441ac5)[_0xa257('0x32')](handleEntityNotFound(_0x511294,null))[_0xa257('0x32')](respondWithResult(_0x511294,null))[_0xa257('0x53')](handleError(_0x511294,null));};exports['download']=function(_0x2554be,_0x56f9ae,_0x134a00){return db[_0xa257('0x4e')][_0xa257('0x55')]({'where':{'id':_0x2554be[_0xa257('0x56')]['id']},'attributes':[_0xa257('0x38'),_0xa257('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x56f9ae,null))['then'](function(_0x300423){if(_0x300423){var _0x1e63af=path['join'](config['root'],_0xa257('0x58'),util[_0xa257('0x59')](_0xa257('0x5a'),path[_0xa257('0x5b')](_0x300423[_0xa257('0x57')])));var _0x408c19=fs[_0xa257('0x5c')](_0x1e63af);var _0x2eefd0=archiver(_0xa257('0x5d'),{'zlib':{'level':0x9}});_0x2eefd0['on'](_0xa257('0x5e'),function(_0xf62213){if(_0xf62213['code']===_0xa257('0x5f')){logger[_0xa257('0x36')](_0xf62213);}else{throw new db['Sequelize']['Error'](_0xa257('0x60'));}});_0x2eefd0['on'](_0xa257('0x36'),function(_0x4ca7cc){throw new db[(_0xa257('0x61'))][(_0xa257('0x62'))](_0xa257('0x60'));});_0x2eefd0[_0xa257('0x63')](_0x408c19);_0x2eefd0[_0xa257('0x64')](_0xa257('0x65'),{'cwd':path[_0xa257('0x66')](config[_0xa257('0x67')],_0xa257('0x58'),path['dirname'](_0x300423['path'])),'ignore':[path['join'](path['basename'](_0x300423[_0xa257('0x57')]),_0xa257('0x68')),path[_0xa257('0x66')](path[_0xa257('0x5b')](_0x300423[_0xa257('0x57')]),_0xa257('0x69'))],'nodir':!![]})[_0xa257('0x6a')]();_0x408c19['on'](_0xa257('0x6b'),function(){if(!fs[_0xa257('0x6c')](_0x1e63af)){throw new db['Sequelize'][(_0xa257('0x62'))](_0xa257('0x6d'));}return _0x56f9ae[_0xa257('0x6e')](_0x1e63af,util[_0xa257('0x59')](_0xa257('0x5a'),path[_0xa257('0x5b')](_0x300423['path'])),function(_0x4f86c6){if(_0x4f86c6){throw new db['Sequelize'][(_0xa257('0x62'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xa257('0x6f')](_0x1e63af);logger[_0xa257('0x70')](_0xa257('0x71'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0xa257('0x53')](handleError(_0x56f9ae,null));};exports[_0xa257('0x72')]=function(_0x3c8ec9,_0x5e36c3,_0x368c2e){var _0x5eb9ab=path[_0xa257('0x5b')](_0x3c8ec9[_0xa257('0x73')]['filename'],path['extname'](_0x3c8ec9[_0xa257('0x73')]['filename']));var _0x3e82e4=path[_0xa257('0x66')](config['root'],_0xa257('0x58'),_0x3c8ec9[_0xa257('0x73')]['filename']);var _0x3513fe=path[_0xa257('0x66')](config['root'],'server/files/plugins',_0x5eb9ab);logger[_0xa257('0x70')](_0xa257('0x74'),_0x3e82e4);logger[_0xa257('0x70')](_0xa257('0x75'),_0x3513fe);try{fs[_0xa257('0x76')](_0x3e82e4,parseInt(_0xa257('0x77'),0x8));extract(_0x3e82e4,{'dir':_0x3513fe},function(_0xea933e){if(_0xea933e){logger[_0xa257('0x36')](_0xea933e);handleError(_0xea933e,!![]);};var _0x309a2d=fs[_0xa257('0x78')](_0x3513fe);if(_0x309a2d[_0xa257('0x45')]>0x1){removeReferences(_0x3e82e4,_0x3513fe);logger['error'](_0xa257('0x79'));return _0x368c2e(new Error(_0xa257('0x79')));}var _0x5602f7=fs['lstatSync'](path['join'](_0x3513fe,_0x309a2d[0x0]));if(_0x5602f7['isFile']()){removeReferences(_0x3e82e4,_0x3513fe);logger['error']('Invalid\x20plugin\x20structure');return _0x368c2e(new Error(_0xa257('0x79')));}if(_0x5602f7[_0xa257('0x7a')]()){var _0x3ad7f2=fs[_0xa257('0x78')](path['join'](_0x3513fe,_0x309a2d[0x0]));if(_0x3ad7f2[_0xa257('0x45')]===0x0){removeReferences(_0x3e82e4,_0x3513fe);logger[_0xa257('0x36')]('Invalid\x20plugin\x20structure');return _0x368c2e(new Error(_0xa257('0x79')));}var _0x534010=_0x3ad7f2[_0xa257('0x7b')](function(_0x580885){return _0x580885===_0xa257('0x7c');});if(!_0x534010){return _0x368c2e(new Error(_0xa257('0x7d')));}var _0xf4b00d=fs['readFileSync'](path['join'](_0x3513fe,_0x309a2d[0x0],_0xa257('0x7c')));var _0x394bac=JSON[_0xa257('0x7e')](_0xf4b00d);if('undefined'==typeof _0x394bac['name']){return _0x368c2e(new Error(_0xa257('0x7f')));}if(_0xa257('0x29')==typeof _0x394bac[_0xa257('0x3d')]){return _0x368c2e(new Error(_0xa257('0x80')));}if('undefined'==typeof _0x394bac[_0xa257('0x81')]){return _0x368c2e(new Error(_0xa257('0x82')));}if('undefined'==typeof _0x394bac[_0xa257('0x83')]){return _0x368c2e(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x394bac[_0xa257('0x3d')]==='html'){if(_0xa257('0x29')==typeof _0x394bac[_0xa257('0x83')][_0xa257('0x84')]){return _0x368c2e(new Error(_0xa257('0x85')));}if(_0xa257('0x29')==typeof _0x394bac[_0xa257('0x83')][_0xa257('0x84')]['admin']&&_0xa257('0x29')==typeof _0x394bac['parameters']['views'][_0xa257('0x86')]){return _0x368c2e(new Error(_0xa257('0x87')));}}else if(_0x394bac[_0xa257('0x3d')]===_0xa257('0x88')){if(_0xa257('0x29')==typeof _0x394bac['parameters'][_0xa257('0x89')]){return _0x368c2e(new Error(_0xa257('0x8a')));}if('undefined'==typeof _0x394bac[_0xa257('0x83')][_0xa257('0x8b')]){return _0x368c2e(new Error(_0xa257('0x8c')));}}else{return _0x368c2e(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2161c2=_0x394bac[_0xa257('0x38')];var _0x131252=_0x394bac[_0xa257('0x8d')];var _0x3fbb1a=_0x394bac[_0xa257('0x3d')];var _0x26a0a1=_0x394bac[_0xa257('0x8e')]?_0x394bac[_0xa257('0x8e')]:_0xa257('0x8f');var _0xd556b1=_0x394bac['icon']?_0x394bac[_0xa257('0x90')]:'icon-apps';var _0x52430f='';var _0x520e05='';var _0x13250c='';var _0x5c1b56='';var _0x165923=_0x394bac[_0xa257('0x81')];if(_0x3fbb1a===_0xa257('0x91')){if('undefined'!=typeof _0x394bac[_0xa257('0x83')][_0xa257('0x84')]['admin']){var _0x4265ab=_0x394bac[_0xa257('0x83')][_0xa257('0x84')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4265ab)){_0x52430f=path[_0xa257('0x66')](_0xa257('0x92'),_0x5eb9ab,_0x309a2d[0x0],_0x4265ab);}else{_0x52430f=_0x4265ab;}}else{logger[_0xa257('0x70')](_0xa257('0x93'));}if('undefined'!=typeof _0x394bac[_0xa257('0x83')][_0xa257('0x84')]['agent']){var _0x27f636=_0x394bac[_0xa257('0x83')][_0xa257('0x84')][_0xa257('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xa257('0x94')](_0x27f636)){_0x520e05=path[_0xa257('0x66')](_0xa257('0x92'),_0x5eb9ab,_0x309a2d[0x0],_0x27f636);}else{_0x520e05=_0x27f636;}}else{logger[_0xa257('0x70')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x3fbb1a===_0xa257('0x88')){_0x13250c=_0x394bac[_0xa257('0x83')][_0xa257('0x89')];_0x5c1b56=_0x394bac[_0xa257('0x83')][_0xa257('0x8b')];if(_0xa257('0x29')!=typeof _0x394bac[_0xa257('0x83')][_0xa257('0x84')]){if(_0xa257('0x29')!=typeof _0x394bac[_0xa257('0x83')][_0xa257('0x84')][_0xa257('0x95')]){var _0x4265ab=_0x394bac['parameters'][_0xa257('0x84')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa257('0x94')](_0x4265ab)){_0x52430f=path[_0xa257('0x66')](_0xa257('0x92'),_0x5eb9ab,_0x309a2d[0x0],_0x4265ab);}else{_0x52430f=_0x4265ab;}}if(_0xa257('0x29')!=typeof _0x394bac[_0xa257('0x83')][_0xa257('0x84')][_0xa257('0x86')]){var _0x27f636=_0x394bac[_0xa257('0x83')]['views'][_0xa257('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xa257('0x94')](_0x27f636)){_0x520e05=path['join']('plugins',_0x5eb9ab,_0x309a2d[0x0],_0x27f636);}else{_0x520e05=_0x27f636;}}}}var _0x1d4303={'name':_0x2161c2,'description':_0x131252,'path':path[_0xa257('0x66')](_0x5eb9ab,_0x309a2d[0x0]),'type':_0x3fbb1a,'sidebar':_0x26a0a1,'icon':_0xd556b1,'adminUrl':_0x52430f,'agentUrl':_0x520e05,'scriptName':_0x13250c,'scriptPath':_0x5c1b56,'version':_0x165923};removeReferences(_0x3e82e4,null);return db[_0xa257('0x4e')][_0xa257('0x96')](_0x1d4303)['then'](function(_0x289201){var _0x11f09b={'role':_0x3c8ec9[_0xa257('0x97')]['role'],'userProfileId':_0x3c8ec9[_0xa257('0x97')][_0xa257('0x98')]};if(!_0x11f09b)throw new Error(_0xa257('0x99'));if(_0x11f09b[_0xa257('0x9a')]===_0xa257('0x9b')){var _0xd51b75=_0x289201[_0xa257('0x33')]({'plain':!![]});return db[_0xa257('0x9c')][_0xa257('0x55')]({'where':{'name':_0xa257('0x34'),'userProfileId':_0x11f09b[_0xa257('0x98')]},'raw':!![]})[_0xa257('0x32')](function(_0x26494a){if(_0x26494a&&_0x26494a['autoAssociation']===0x0){return db['UserProfileResource'][_0xa257('0x96')]({'name':_0xd51b75['name'],'resourceId':_0xd51b75['id'],'type':_0x26494a['name'],'sectionId':_0x26494a['id']},{})[_0xa257('0x32')](function(){return _0x289201;});}else{return _0x289201;}})[_0xa257('0x53')](function(_0x19903b){logger[_0xa257('0x36')](_0xa257('0x9d'),_0x19903b);throw _0x19903b;});}return _0x289201;})[_0xa257('0x32')](respondWithResult(_0x5e36c3,null))[_0xa257('0x53')](handleError(_0x5e36c3,null));}});}catch(_0x439bbc){_0x5e36c3[_0xa257('0x24')](0x1f4)[_0xa257('0x9e')](_0x439bbc);}};function removeReferences(_0x42fa54,_0x3e09f5){try{if(_0x42fa54){fs['unlinkSync'](_0x42fa54);logger['info'](_0xa257('0x9f'));}if(_0x3e09f5){rimraf(_0x3e09f5,function(){});logger[_0xa257('0x70')](_0xa257('0xa0'));}}catch(_0x55566f){logger[_0xa257('0x36')](_0x55566f);}}exports['update']=function(_0x2cc3bf,_0x962381,_0x5db64c){return db[_0xa257('0x4e')][_0xa257('0x55')]({'where':{'id':_0x2cc3bf[_0xa257('0x56')]['id']}})['then'](handleEntityNotFound(_0x962381,null))[_0xa257('0x32')](saveUpdates(_0x2cc3bf[_0xa257('0x97')],null))[_0xa257('0x32')](respondWithResult(_0x962381,null))[_0xa257('0x53')](handleError(_0x962381,null));};exports[_0xa257('0xa1')]=function(_0x5f5b71,_0x2740d6,_0xfd039b){return db['Plugin']['find']({'where':{'id':_0x5f5b71[_0xa257('0x56')]['id']}})[_0xa257('0x32')](function(_0x25e603){if(_0x25e603){return _0x25e603[_0xa257('0x31')]();}})[_0xa257('0x32')](function(_0x3d0691){rimraf(path[_0xa257('0x66')](config[_0xa257('0x67')],_0xa257('0x58'),path[_0xa257('0xa2')](_0x3d0691[_0xa257('0x57')])),function(){});return _0x3d0691;})[_0xa257('0x32')](handleEntityNotFound(_0x2740d6,null))[_0xa257('0x32')](respondWithStatusCode(_0x2740d6,null))[_0xa257('0x53')](handleError(_0x2740d6,null));};exports[_0xa257('0xa3')]=function(_0x548881,_0x422a88,_0x19eb75){return BPromise[_0xa257('0xa4')]()[_0xa257('0x32')](function(){if(!_0x548881['query'][_0xa257('0x57')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x548881[_0xa257('0x3f')][_0xa257('0xa5')]){throw new Error(_0xa257('0xa6'));}var _0x19a2fd=_0x548881[_0xa257('0x3f')][_0xa257('0xa7')]?_0x548881[_0xa257('0x3f')][_0xa257('0xa7')]+':'+_0x548881[_0xa257('0x3f')]['port']:'http://localhost:'+_0x548881['query'][_0xa257('0xa5')];var _0x1e0193=_0x548881[_0xa257('0x3f')]['json']?_0x548881[_0xa257('0x3f')][_0xa257('0x26')]:!![];var _0x21141=_0x548881[_0xa257('0x3f')][_0xa257('0xa8')]?_0x548881[_0xa257('0x3f')][_0xa257('0xa8')]:null;var _0xaeaa50={'method':_0x548881['method'],'uri':util[_0xa257('0x59')](_0xa257('0xa9'),_0x19a2fd,_0x548881[_0xa257('0x3f')][_0xa257('0x57')]),'json':_0x1e0193,'resolveWithFullResponse':!![],'encoding':_0x21141,'qs':_0x548881[_0xa257('0x3f')]};if(_0x548881['headers']){_0xaeaa50[_0xa257('0xaa')]=_0x548881[_0xa257('0xaa')];if(_0xaeaa50['headers'][_0xa257('0xab')]){delete _0xaeaa50[_0xa257('0xaa')][_0xa257('0xab')];}}if(_0xaeaa50[_0xa257('0xaa')]['content-type']){delete _0xaeaa50[_0xa257('0xaa')][_0xa257('0xac')];}return rp(_0xaeaa50);})[_0xa257('0x32')](function(_0x237e92){if(_0x237e92){_0x422a88[_0xa257('0x2b')](_0x237e92['headers']);logger[_0xa257('0x70')](_0x237e92[_0xa257('0x97')]);if(_[_0xa257('0xad')](_0x548881[_0xa257('0x3f')][_0xa257('0x57')],_0xa257('0x6e'))&&_0x237e92['statusCode']==0x1f4){return _0x422a88[_0xa257('0x23')](_0x237e92[_0xa257('0xae')]);}else{return _0x422a88[_0xa257('0x24')](_0x237e92[_0xa257('0xae')])['send'](_0x237e92[_0xa257('0x97')]);}}else{return _0x422a88[_0xa257('0x23')](0xc8);}})[_0xa257('0x53')](handleError(_0x422a88,null));};exports[_0xa257('0xaf')]=function(_0x34fbac,_0x2d4fe4,_0x9023b5){return BPromise[_0xa257('0xa4')]()['then'](function(){if(!_0x34fbac[_0xa257('0x3f')][_0xa257('0x57')]){throw new Error(_0xa257('0xb0'));}if(!_0x34fbac[_0xa257('0x3f')][_0xa257('0xa5')]){throw new Error(_0xa257('0xa6'));}var _0x511c17=_0x34fbac[_0xa257('0x3f')][_0xa257('0xa7')]?_0x34fbac['query']['hostname']+':'+_0x34fbac[_0xa257('0x3f')]['port']:_0xa257('0xb1')+_0x34fbac[_0xa257('0x3f')]['port'];var _0x1f7631=_0x34fbac['query'][_0xa257('0x26')]?_0x34fbac[_0xa257('0x3f')][_0xa257('0x26')]:!![];var _0x4f99d0=_0x34fbac[_0xa257('0x3f')]['encoding']?_0x34fbac[_0xa257('0x3f')][_0xa257('0xa8')]:null;var _0x38203c={'method':_0x34fbac[_0xa257('0xb2')],'uri':util[_0xa257('0x59')](_0xa257('0xa9'),_0x511c17,_0x34fbac[_0xa257('0x3f')]['path']),'json':_0x1f7631,'resolveWithFullResponse':!![],'encoding':_0x4f99d0,'body':_0x34fbac[_0xa257('0x97')]};if(_0x34fbac['headers']){_0x38203c[_0xa257('0xaa')]=_0x34fbac[_0xa257('0xaa')];if(_0x38203c[_0xa257('0xaa')]['content-length']){delete _0x38203c[_0xa257('0xaa')][_0xa257('0xab')];}}if(_0x38203c[_0xa257('0xaa')][_0xa257('0xac')]){delete _0x38203c['headers']['content-type'];}return rp(_0x38203c);})[_0xa257('0x32')](function(_0x4aca07){if(_0x4aca07){_0x2d4fe4[_0xa257('0x2b')](_0x4aca07[_0xa257('0xaa')]);logger[_0xa257('0x70')](_0x4aca07['body']);return _0x2d4fe4[_0xa257('0x24')](_0x4aca07[_0xa257('0xae')])[_0xa257('0x9e')](_0x4aca07[_0xa257('0x97')]);}else{return _0x2d4fe4['sendStatus'](0xc8);}})['catch'](handleError(_0x2d4fe4,null));}; \ No newline at end of file +var _0x1865=['find','download','root','server/files/plugins','format','%s.zip','createWriteStream','zip','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','join','dirname','basename','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20destination:\x20%s','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','body','role','user','userProfileId','UserProfileResource','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','json','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','encoding','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Plugins','error','stack','name','send','map','Plugin','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params'];(function(_0x2a80d9,_0x3d0052){var _0x33efde=function(_0x5a1dc5){while(--_0x5a1dc5){_0x2a80d9['push'](_0x2a80d9['shift']());}};_0x33efde(++_0x3d0052);}(_0x1865,0x18a));var _0x5186=function(_0x4c5b1e,_0x535dc6){_0x4c5b1e=_0x4c5b1e-0x0;var _0x44f446=_0x1865[_0x4c5b1e];return _0x44f446;};'use strict';var emlformat=require(_0x5186('0x0'));var rimraf=require(_0x5186('0x1'));var zipdir=require(_0x5186('0x2'));var jsonpatch=require(_0x5186('0x3'));var rp=require(_0x5186('0x4'));var moment=require('moment');var BPromise=require(_0x5186('0x5'));var Mustache=require(_0x5186('0x6'));var util=require(_0x5186('0x7'));var path=require(_0x5186('0x8'));var sox=require(_0x5186('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5186('0xa'));var _=require('lodash');var squel=require(_0x5186('0xb'));var crypto=require(_0x5186('0xc'));var jsforce=require(_0x5186('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5186('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x5186('0xf'));var rimraf=require(_0x5186('0x1'));var archiver=require(_0x5186('0x10'));var Redis=require(_0x5186('0x11'));var authService=require(_0x5186('0x12'));var qs=require(_0x5186('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5186('0x14'));var logger=require(_0x5186('0x15'))(_0x5186('0x16'));var utils=require(_0x5186('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5186('0x18'));var db=require('../../mysqldb')['db'];config[_0x5186('0x19')]=_[_0x5186('0x1a')](config[_0x5186('0x19')],{'host':_0x5186('0x1b'),'port':0x18eb});var socket=require(_0x5186('0x1c'))(new Redis(config[_0x5186('0x19')]));require(_0x5186('0x1d'))[_0x5186('0x1e')](socket);function respondWithStatusCode(_0x490850,_0x48230e){_0x48230e=_0x48230e||0xcc;return function(_0x3a3e06){if(_0x3a3e06){return _0x490850[_0x5186('0x1f')](_0x48230e);}return _0x490850[_0x5186('0x20')](_0x48230e)[_0x5186('0x21')]();};}function respondWithResult(_0x1e191e,_0x4d38c2){_0x4d38c2=_0x4d38c2||0xc8;return function(_0x5e98c4){if(_0x5e98c4){return _0x1e191e[_0x5186('0x20')](_0x4d38c2)['json'](_0x5e98c4);}};}function respondWithFilteredResult(_0x57c105,_0x94ce25){return function(_0x47759a){if(_0x47759a){var _0x43faf0=typeof _0x94ce25[_0x5186('0x22')]===_0x5186('0x23')&&typeof _0x94ce25[_0x5186('0x24')]===_0x5186('0x23');var _0x1cd5d1=_0x47759a[_0x5186('0x25')];var _0x5c161e=_0x43faf0?0x0:_0x94ce25[_0x5186('0x22')];var _0x3a9533=_0x43faf0?_0x47759a[_0x5186('0x25')]:_0x94ce25[_0x5186('0x22')]+_0x94ce25['limit'];var _0x310dc0;if(_0x3a9533>=_0x1cd5d1){_0x3a9533=_0x1cd5d1;_0x310dc0=0xc8;}else{_0x310dc0=0xce;}_0x57c105[_0x5186('0x20')](_0x310dc0);return _0x57c105[_0x5186('0x26')](_0x5186('0x27'),_0x5c161e+'-'+_0x3a9533+'/'+_0x1cd5d1)['json'](_0x47759a);}return null;};}function patchUpdates(_0x476d7b){return function(_0x41c3bc){try{jsonpatch['apply'](_0x41c3bc,_0x476d7b,!![]);}catch(_0x1af2db){return BPromise[_0x5186('0x28')](_0x1af2db);}return _0x41c3bc[_0x5186('0x29')]();};}function saveUpdates(_0x5de276,_0x191dfd){return function(_0x1dedfa){if(_0x1dedfa){return _0x1dedfa[_0x5186('0x2a')](_0x5de276)[_0x5186('0x2b')](function(_0x1e08fc){return _0x1e08fc;});}return null;};}function removeEntity(_0x357eda,_0x3e501d){return function(_0x3e68bb){if(_0x3e68bb){return _0x3e68bb[_0x5186('0x2c')]()['then'](function(){var _0x5953ac=_0x3e68bb[_0x5186('0x2d')]({'plain':!![]});var _0x413e01=_0x5186('0x2e');return db['UserProfileResource'][_0x5186('0x2c')]({'where':{'type':_0x413e01,'resourceId':_0x5953ac['id']}})[_0x5186('0x2b')](function(){return _0x3e68bb;});})[_0x5186('0x2b')](function(){_0x357eda[_0x5186('0x20')](0xcc)[_0x5186('0x21')]();});}};}function handleEntityNotFound(_0x227fee,_0x2e5841){return function(_0x3911de){if(!_0x3911de){_0x227fee[_0x5186('0x1f')](0x194);}return _0x3911de;};}function handleError(_0x5eef49,_0x4d3494){_0x4d3494=_0x4d3494||0x1f4;return function(_0x560a39){logger[_0x5186('0x2f')](_0x560a39[_0x5186('0x30')]);if(_0x560a39[_0x5186('0x31')]){delete _0x560a39[_0x5186('0x31')];}_0x5eef49[_0x5186('0x20')](_0x4d3494)[_0x5186('0x32')](_0x560a39);};}exports['index']=function(_0xbe4d9d,_0x53ad17){var _0x570a38={},_0x1fefe5={},_0x548670={'count':0x0,'rows':[]};var _0x48f8cc=_[_0x5186('0x33')](db[_0x5186('0x34')]['rawAttributes'],function(_0x400cfa){return{'name':_0x400cfa['fieldName'],'type':_0x400cfa[_0x5186('0x35')][_0x5186('0x36')]};});_0x1fefe5[_0x5186('0x37')]=_[_0x5186('0x33')](_0x48f8cc,_0x5186('0x31'));_0x1fefe5[_0x5186('0x38')]=_[_0x5186('0x39')](_0xbe4d9d['query']);_0x1fefe5[_0x5186('0x3a')]=_[_0x5186('0x3b')](_0x1fefe5[_0x5186('0x37')],_0x1fefe5['query']);_0x570a38[_0x5186('0x3c')]=_[_0x5186('0x3b')](_0x1fefe5[_0x5186('0x37')],qs[_0x5186('0x3d')](_0xbe4d9d[_0x5186('0x38')][_0x5186('0x3d')]));_0x570a38[_0x5186('0x3c')]=_0x570a38['attributes']['length']?_0x570a38[_0x5186('0x3c')]:_0x1fefe5[_0x5186('0x37')];if(!_0xbe4d9d[_0x5186('0x38')][_0x5186('0x3e')](_0x5186('0x3f'))){_0x570a38[_0x5186('0x24')]=qs[_0x5186('0x24')](_0xbe4d9d[_0x5186('0x38')]['limit']);_0x570a38['offset']=qs[_0x5186('0x22')](_0xbe4d9d[_0x5186('0x38')][_0x5186('0x22')]);}_0x570a38[_0x5186('0x40')]=qs[_0x5186('0x41')](_0xbe4d9d[_0x5186('0x38')][_0x5186('0x41')]);_0x570a38[_0x5186('0x42')]=qs[_0x5186('0x3a')](_[_0x5186('0x43')](_0xbe4d9d[_0x5186('0x38')],_0x1fefe5['filters']),_0x48f8cc);if(_0xbe4d9d['query'][_0x5186('0x44')]){_0x570a38[_0x5186('0x42')]=_[_0x5186('0x45')](_0x570a38[_0x5186('0x42')],{'$or':_[_0x5186('0x33')](_0x48f8cc,function(_0x440dd4){if(_0x440dd4[_0x5186('0x35')]!==_0x5186('0x46')){var _0x356644={};_0x356644[_0x440dd4[_0x5186('0x31')]]={'$like':'%'+_0xbe4d9d['query'][_0x5186('0x44')]+'%'};return _0x356644;}})});}_0x570a38=_[_0x5186('0x45')]({},_0x570a38,_0xbe4d9d[_0x5186('0x47')]);var _0x4a70b7={'where':_0x570a38['where']};return db[_0x5186('0x34')][_0x5186('0x25')](_0x4a70b7)[_0x5186('0x2b')](function(_0x17873d){_0x548670['count']=_0x17873d;if(_0xbe4d9d[_0x5186('0x38')][_0x5186('0x48')]){_0x570a38[_0x5186('0x49')]=[{'all':!![]}];}return db[_0x5186('0x34')]['findAll'](_0x570a38);})[_0x5186('0x2b')](function(_0x24989b){_0x548670[_0x5186('0x4a')]=_0x24989b;return _0x548670;})[_0x5186('0x2b')](respondWithFilteredResult(_0x53ad17,_0x570a38))[_0x5186('0x4b')](handleError(_0x53ad17,null));};exports['show']=function(_0x8c67c5,_0x4bbca2){var _0x29b7b7={'raw':!![],'where':{'id':_0x8c67c5[_0x5186('0x4c')]['id']}},_0x336e54={};_0x336e54[_0x5186('0x37')]=_['keys'](db['Plugin']['rawAttributes']);_0x336e54[_0x5186('0x38')]=_['keys'](_0x8c67c5[_0x5186('0x38')]);_0x336e54['filters']=_[_0x5186('0x3b')](_0x336e54[_0x5186('0x37')],_0x336e54[_0x5186('0x38')]);_0x29b7b7['attributes']=_[_0x5186('0x3b')](_0x336e54[_0x5186('0x37')],qs[_0x5186('0x3d')](_0x8c67c5[_0x5186('0x38')][_0x5186('0x3d')]));_0x29b7b7[_0x5186('0x3c')]=_0x29b7b7[_0x5186('0x3c')]['length']?_0x29b7b7[_0x5186('0x3c')]:_0x336e54[_0x5186('0x37')];if(_0x8c67c5[_0x5186('0x38')][_0x5186('0x48')]){_0x29b7b7[_0x5186('0x49')]=[{'all':!![]}];}_0x29b7b7=_[_0x5186('0x45')]({},_0x29b7b7,_0x8c67c5[_0x5186('0x47')]);return db[_0x5186('0x34')][_0x5186('0x4d')](_0x29b7b7)[_0x5186('0x2b')](handleEntityNotFound(_0x4bbca2,null))[_0x5186('0x2b')](respondWithResult(_0x4bbca2,null))[_0x5186('0x4b')](handleError(_0x4bbca2,null));};exports[_0x5186('0x4e')]=function(_0x4b3afb,_0x111a4b,_0x3ae0be){return db[_0x5186('0x34')][_0x5186('0x4d')]({'where':{'id':_0x4b3afb[_0x5186('0x4c')]['id']},'attributes':[_0x5186('0x31'),_0x5186('0x8')],'raw':!![]})[_0x5186('0x2b')](handleEntityNotFound(_0x111a4b,null))[_0x5186('0x2b')](function(_0x40aace){if(_0x40aace){var _0x485c1c=path['join'](config[_0x5186('0x4f')],_0x5186('0x50'),util[_0x5186('0x51')](_0x5186('0x52'),path['basename'](_0x40aace['path'])));var _0x476c69=fs[_0x5186('0x53')](_0x485c1c);var _0x10bd73=archiver(_0x5186('0x54'),{'zlib':{'level':0x9}});_0x10bd73['on']('warning',function(_0x57ee0f){if(_0x57ee0f['code']==='ENOENT'){logger['error'](_0x57ee0f);}else{throw new db[(_0x5186('0x55'))][(_0x5186('0x56'))](_0x5186('0x57'));}});_0x10bd73['on'](_0x5186('0x2f'),function(_0x50a194){throw new db[(_0x5186('0x55'))][(_0x5186('0x56'))](_0x5186('0x57'));});_0x10bd73[_0x5186('0x58')](_0x476c69);_0x10bd73[_0x5186('0x59')]('**/*',{'cwd':path[_0x5186('0x5a')](config[_0x5186('0x4f')],_0x5186('0x50'),path[_0x5186('0x5b')](_0x40aace['path'])),'ignore':[path['join'](path[_0x5186('0x5c')](_0x40aace[_0x5186('0x8')]),_0x5186('0x5d')),path[_0x5186('0x5a')](path[_0x5186('0x5c')](_0x40aace[_0x5186('0x8')]),_0x5186('0x5e'))],'nodir':!![]})[_0x5186('0x5f')]();_0x476c69['on']('close',function(){if(!fs[_0x5186('0x60')](_0x485c1c)){throw new db['Sequelize'][(_0x5186('0x56'))](_0x5186('0x61'));}return _0x111a4b['download'](_0x485c1c,util['format'](_0x5186('0x52'),path[_0x5186('0x5c')](_0x40aace[_0x5186('0x8')])),function(_0x23831){if(_0x23831){throw new db[(_0x5186('0x55'))][(_0x5186('0x56'))](_0x5186('0x62'));}fs[_0x5186('0x63')](_0x485c1c);logger[_0x5186('0x64')](_0x5186('0x65'));logger[_0x5186('0x64')](_0x5186('0x66'));});});}return null;})[_0x5186('0x4b')](handleError(_0x111a4b,null));};exports[_0x5186('0x67')]=function(_0x153442,_0x5694b0,_0x409455){var _0x221920=path[_0x5186('0x5c')](_0x153442['file']['filename'],path[_0x5186('0x68')](_0x153442[_0x5186('0x69')][_0x5186('0x6a')]));var _0x2905f5=path[_0x5186('0x5a')](config[_0x5186('0x4f')],_0x5186('0x50'),_0x153442[_0x5186('0x69')][_0x5186('0x6a')]);var _0x594bc9=path[_0x5186('0x5a')](config[_0x5186('0x4f')],_0x5186('0x50'),_0x221920);logger[_0x5186('0x64')]('Plugin\x20upload\x20filepath:\x20%s',_0x2905f5);logger['info'](_0x5186('0x6b'),_0x594bc9);try{fs['chmodSync'](_0x2905f5,parseInt('0777',0x8));extract(_0x2905f5,{'dir':_0x594bc9},function(_0xe28b6d){if(_0xe28b6d){logger[_0x5186('0x2f')](_0xe28b6d);handleError(_0xe28b6d,!![]);};var _0x237a5d=fs[_0x5186('0x6c')](_0x594bc9);if(_0x237a5d[_0x5186('0x6d')]>0x1){removeReferences(_0x2905f5,_0x594bc9);logger[_0x5186('0x2f')](_0x5186('0x6e'));return _0x409455(new Error(_0x5186('0x6e')));}var _0x5ed0b5=fs[_0x5186('0x6f')](path[_0x5186('0x5a')](_0x594bc9,_0x237a5d[0x0]));if(_0x5ed0b5['isFile']()){removeReferences(_0x2905f5,_0x594bc9);logger[_0x5186('0x2f')](_0x5186('0x6e'));return _0x409455(new Error(_0x5186('0x6e')));}if(_0x5ed0b5['isDirectory']()){var _0x2be9be=fs['readdirSync'](path[_0x5186('0x5a')](_0x594bc9,_0x237a5d[0x0]));if(_0x2be9be[_0x5186('0x6d')]===0x0){removeReferences(_0x2905f5,_0x594bc9);logger[_0x5186('0x2f')]('Invalid\x20plugin\x20structure');return _0x409455(new Error(_0x5186('0x6e')));}var _0x297efb=_0x2be9be['some'](function(_0x25e941){return _0x25e941===_0x5186('0x70');});if(!_0x297efb){return _0x409455(new Error('Plugin\x20manifest\x20missing'));}var _0x29b98c=fs[_0x5186('0x71')](path[_0x5186('0x5a')](_0x594bc9,_0x237a5d[0x0],_0x5186('0x70')));var _0x1a68c2=JSON[_0x5186('0x72')](_0x29b98c);if(_0x5186('0x23')==typeof _0x1a68c2['name']){return _0x409455(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x1a68c2['type']){return _0x409455(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x5186('0x23')==typeof _0x1a68c2['version']){return _0x409455(new Error(_0x5186('0x73')));}if(_0x5186('0x23')==typeof _0x1a68c2[_0x5186('0x74')]){return _0x409455(new Error(_0x5186('0x75')));}if(_0x1a68c2[_0x5186('0x35')]===_0x5186('0x76')){if(_0x5186('0x23')==typeof _0x1a68c2[_0x5186('0x74')][_0x5186('0x77')]){return _0x409455(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x5186('0x23')==typeof _0x1a68c2[_0x5186('0x74')][_0x5186('0x77')][_0x5186('0x78')]&&_0x5186('0x23')==typeof _0x1a68c2[_0x5186('0x74')][_0x5186('0x77')]['agent']){return _0x409455(new Error(_0x5186('0x79')));}}else if(_0x1a68c2[_0x5186('0x35')]===_0x5186('0x7a')){if(_0x5186('0x23')==typeof _0x1a68c2[_0x5186('0x74')][_0x5186('0x7b')]){return _0x409455(new Error(_0x5186('0x7c')));}if(_0x5186('0x23')==typeof _0x1a68c2[_0x5186('0x74')][_0x5186('0x7d')]){return _0x409455(new Error(_0x5186('0x7e')));}}else{return _0x409455(new Error(_0x5186('0x7f')));}var _0x5229f3=_0x1a68c2[_0x5186('0x31')];var _0x94d04a=_0x1a68c2[_0x5186('0x80')];var _0x168309=_0x1a68c2[_0x5186('0x35')];var _0x55a972=_0x1a68c2[_0x5186('0x81')]?_0x1a68c2['sidebar']:'always';var _0x1723cc=_0x1a68c2['icon']?_0x1a68c2[_0x5186('0x82')]:'icon-apps';var _0x3d7760='';var _0x2fc07f='';var _0x5f3d50='';var _0x242f18='';var _0x1498f7=_0x1a68c2['version'];if(_0x168309===_0x5186('0x76')){if(_0x5186('0x23')!=typeof _0x1a68c2['parameters'][_0x5186('0x77')][_0x5186('0x78')]){var _0x4d59e7=_0x1a68c2[_0x5186('0x74')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x5186('0x83')](_0x4d59e7)){_0x3d7760=path['join'](_0x5186('0x84'),_0x221920,_0x237a5d[0x0],_0x4d59e7);}else{_0x3d7760=_0x4d59e7;}}else{logger[_0x5186('0x64')](_0x5186('0x85'));}if(_0x5186('0x23')!=typeof _0x1a68c2[_0x5186('0x74')][_0x5186('0x77')][_0x5186('0x86')]){var _0x4439da=_0x1a68c2['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x5186('0x83')](_0x4439da)){_0x2fc07f=path[_0x5186('0x5a')]('plugins',_0x221920,_0x237a5d[0x0],_0x4439da);}else{_0x2fc07f=_0x4439da;}}else{logger['info'](_0x5186('0x87'));}}else if(_0x168309==='script'){_0x5f3d50=_0x1a68c2[_0x5186('0x74')][_0x5186('0x7b')];_0x242f18=_0x1a68c2[_0x5186('0x74')]['scriptPath'];if(_0x5186('0x23')!=typeof _0x1a68c2['parameters'][_0x5186('0x77')]){if('undefined'!=typeof _0x1a68c2[_0x5186('0x74')]['views'][_0x5186('0x78')]){var _0x4d59e7=_0x1a68c2[_0x5186('0x74')][_0x5186('0x77')][_0x5186('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x5186('0x83')](_0x4d59e7)){_0x3d7760=path['join']('plugins',_0x221920,_0x237a5d[0x0],_0x4d59e7);}else{_0x3d7760=_0x4d59e7;}}if(_0x5186('0x23')!=typeof _0x1a68c2[_0x5186('0x74')]['views'][_0x5186('0x86')]){var _0x4439da=_0x1a68c2[_0x5186('0x74')]['views'][_0x5186('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x5186('0x83')](_0x4439da)){_0x2fc07f=path['join']('plugins',_0x221920,_0x237a5d[0x0],_0x4439da);}else{_0x2fc07f=_0x4439da;}}}}var _0x4c8f18={'name':_0x5229f3,'description':_0x94d04a,'path':path[_0x5186('0x5a')](_0x221920,_0x237a5d[0x0]),'type':_0x168309,'sidebar':_0x55a972,'icon':_0x1723cc,'adminUrl':_0x3d7760,'agentUrl':_0x2fc07f,'scriptName':_0x5f3d50,'scriptPath':_0x242f18,'version':_0x1498f7};removeReferences(_0x2905f5,null);return db[_0x5186('0x34')]['create'](_0x4c8f18)['then'](function(_0x5b44b4){var _0x42702f={'role':_0x153442[_0x5186('0x88')][_0x5186('0x89')],'userProfileId':_0x153442['body']['userProfileId']};if(!_0x42702f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42702f[_0x5186('0x89')]===_0x5186('0x8a')){var _0x2cc45f=_0x5b44b4[_0x5186('0x2d')]({'plain':!![]});return db['UserProfileSection'][_0x5186('0x4d')]({'where':{'name':_0x5186('0x2e'),'userProfileId':_0x42702f[_0x5186('0x8b')]},'raw':!![]})[_0x5186('0x2b')](function(_0x3c2e87){if(_0x3c2e87&&_0x3c2e87['autoAssociation']===0x0){return db[_0x5186('0x8c')]['create']({'name':_0x2cc45f[_0x5186('0x31')],'resourceId':_0x2cc45f['id'],'type':_0x3c2e87[_0x5186('0x31')],'sectionId':_0x3c2e87['id']},{})[_0x5186('0x2b')](function(){return _0x5b44b4;});}else{return _0x5b44b4;}})[_0x5186('0x4b')](function(_0x55ca9c){logger[_0x5186('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55ca9c);throw _0x55ca9c;});}return _0x5b44b4;})[_0x5186('0x2b')](respondWithResult(_0x5694b0,null))[_0x5186('0x4b')](handleError(_0x5694b0,null));}});}catch(_0x104aa5){_0x5694b0[_0x5186('0x20')](0x1f4)[_0x5186('0x32')](_0x104aa5);}};function removeReferences(_0x4d6136,_0x467adc){try{if(_0x4d6136){fs['unlinkSync'](_0x4d6136);logger[_0x5186('0x64')](_0x5186('0x8d'));}if(_0x467adc){rimraf(_0x467adc,function(){});logger[_0x5186('0x64')](_0x5186('0x8e'));}}catch(_0xc2671b){logger[_0x5186('0x2f')](_0xc2671b);}}exports[_0x5186('0x2a')]=function(_0x2abfcd,_0x3e5d03,_0x5b95d0){return db[_0x5186('0x34')]['find']({'where':{'id':_0x2abfcd[_0x5186('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3e5d03,null))['then'](saveUpdates(_0x2abfcd[_0x5186('0x88')],null))[_0x5186('0x2b')](respondWithResult(_0x3e5d03,null))[_0x5186('0x4b')](handleError(_0x3e5d03,null));};exports['delete']=function(_0x55dd62,_0x111ba7,_0x182c54){return db[_0x5186('0x34')][_0x5186('0x4d')]({'where':{'id':_0x55dd62[_0x5186('0x4c')]['id']}})[_0x5186('0x2b')](function(_0x3fb6bc){if(_0x3fb6bc){return _0x3fb6bc[_0x5186('0x2c')]();}})[_0x5186('0x2b')](function(_0xe0060){rimraf(path[_0x5186('0x5a')](config[_0x5186('0x4f')],_0x5186('0x50'),path[_0x5186('0x5b')](_0xe0060['path'])),function(){});return _0xe0060;})[_0x5186('0x2b')](handleEntityNotFound(_0x111ba7,null))[_0x5186('0x2b')](respondWithStatusCode(_0x111ba7,null))[_0x5186('0x4b')](handleError(_0x111ba7,null));};exports[_0x5186('0x8f')]=function(_0x44e0eb,_0x13a289,_0x598dbe){return BPromise[_0x5186('0x90')]()[_0x5186('0x2b')](function(){if(!_0x44e0eb[_0x5186('0x38')][_0x5186('0x8')]){throw new Error(_0x5186('0x91'));}if(!_0x44e0eb['query'][_0x5186('0x92')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2cae1d=_0x44e0eb[_0x5186('0x38')][_0x5186('0x93')]?_0x44e0eb[_0x5186('0x38')][_0x5186('0x93')]+':'+_0x44e0eb[_0x5186('0x38')]['port']:'http://localhost:'+_0x44e0eb[_0x5186('0x38')]['port'];var _0x91e380=_0x44e0eb['query'][_0x5186('0x94')]?_0x44e0eb[_0x5186('0x38')][_0x5186('0x94')]:!![];var _0x17bc6b=_0x44e0eb[_0x5186('0x38')]['encoding']?_0x44e0eb[_0x5186('0x38')]['encoding']:null;var _0x4e864a={'method':_0x44e0eb['method'],'uri':util[_0x5186('0x51')]('%s%s',_0x2cae1d,_0x44e0eb[_0x5186('0x38')][_0x5186('0x8')]),'json':_0x91e380,'resolveWithFullResponse':!![],'encoding':_0x17bc6b,'qs':_0x44e0eb[_0x5186('0x38')]};if(_0x44e0eb['headers']){_0x4e864a[_0x5186('0x95')]=_0x44e0eb['headers'];if(_0x4e864a[_0x5186('0x95')]['content-length']){delete _0x4e864a[_0x5186('0x95')][_0x5186('0x96')];}}if(_0x4e864a[_0x5186('0x95')][_0x5186('0x97')]){delete _0x4e864a[_0x5186('0x95')][_0x5186('0x97')];}return rp(_0x4e864a);})[_0x5186('0x2b')](function(_0x4c8428){if(_0x4c8428){_0x13a289[_0x5186('0x26')](_0x4c8428[_0x5186('0x95')]);logger[_0x5186('0x64')](_0x4c8428[_0x5186('0x88')]);if(_[_0x5186('0x98')](_0x44e0eb[_0x5186('0x38')]['path'],'download')&&_0x4c8428['statusCode']==0x1f4){return _0x13a289[_0x5186('0x1f')](_0x4c8428[_0x5186('0x99')]);}else{return _0x13a289['status'](_0x4c8428[_0x5186('0x99')])[_0x5186('0x32')](_0x4c8428[_0x5186('0x88')]);}}else{return _0x13a289[_0x5186('0x1f')](0xc8);}})[_0x5186('0x4b')](handleError(_0x13a289,null));};exports[_0x5186('0x9a')]=function(_0x566b57,_0x4427d3,_0x3a9d7d){return BPromise[_0x5186('0x90')]()[_0x5186('0x2b')](function(){if(!_0x566b57[_0x5186('0x38')][_0x5186('0x8')]){throw new Error(_0x5186('0x91'));}if(!_0x566b57[_0x5186('0x38')][_0x5186('0x92')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3f3509=_0x566b57[_0x5186('0x38')][_0x5186('0x93')]?_0x566b57[_0x5186('0x38')]['hostname']+':'+_0x566b57[_0x5186('0x38')][_0x5186('0x92')]:_0x5186('0x9b')+_0x566b57['query'][_0x5186('0x92')];var _0xc23e5e=_0x566b57['query'][_0x5186('0x94')]?_0x566b57[_0x5186('0x38')][_0x5186('0x94')]:!![];var _0x4080f5=_0x566b57[_0x5186('0x38')][_0x5186('0x9c')]?_0x566b57['query'][_0x5186('0x9c')]:null;var _0x40ef53={'method':_0x566b57['method'],'uri':util['format']('%s%s',_0x3f3509,_0x566b57['query'][_0x5186('0x8')]),'json':_0xc23e5e,'resolveWithFullResponse':!![],'encoding':_0x4080f5,'body':_0x566b57['body']};if(_0x566b57[_0x5186('0x95')]){_0x40ef53[_0x5186('0x95')]=_0x566b57[_0x5186('0x95')];if(_0x40ef53[_0x5186('0x95')][_0x5186('0x96')]){delete _0x40ef53['headers'][_0x5186('0x96')];}}if(_0x40ef53[_0x5186('0x95')][_0x5186('0x97')]){delete _0x40ef53['headers']['content-type'];}return rp(_0x40ef53);})[_0x5186('0x2b')](function(_0x4c8ca8){if(_0x4c8ca8){_0x4427d3['set'](_0x4c8ca8[_0x5186('0x95')]);logger[_0x5186('0x64')](_0x4c8ca8[_0x5186('0x88')]);return _0x4427d3[_0x5186('0x20')](_0x4c8ca8[_0x5186('0x99')])[_0x5186('0x32')](_0x4c8ca8['body']);}else{return _0x4427d3[_0x5186('0x1f')](0xc8);}})['catch'](handleError(_0x4427d3,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ce11068..af9014d 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 _0x9c63=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x9c63,0x1a7));var _0x39c6=function(_0x3f2cf8,_0x1a4511){_0x3f2cf8=_0x3f2cf8-0x0;var _0x48205a=_0x9c63[_0x3f2cf8];return _0x48205a;};'use strict';var EventEmitter=require(_0x39c6('0x0'));var Plugin=require(_0x39c6('0x1'))['db'][_0x39c6('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x39c6('0x3')](0x0);var events={'afterCreate':_0x39c6('0x4'),'afterUpdate':'update','afterDestroy':_0x39c6('0x5')};function emitEvent(_0x3061bc){return function(_0x521670,_0x59c413,_0x562c8f){PluginEvents[_0x39c6('0x6')](_0x3061bc+':'+_0x521670['id'],_0x521670);PluginEvents[_0x39c6('0x6')](_0x3061bc,_0x521670);_0x562c8f(null);};}for(var e in events){if(events[_0x39c6('0x7')](e)){var event=events[e];Plugin[_0x39c6('0x8')](e,emitEvent(event));}}module[_0x39c6('0x9')]=PluginEvents; \ No newline at end of file +var _0x47a1=['events','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x429536,_0x3d6d0a){var _0xb20867=function(_0xdcf80f){while(--_0xdcf80f){_0x429536['push'](_0x429536['shift']());}};_0xb20867(++_0x3d6d0a);}(_0x47a1,0xbd));var _0x147a=function(_0x77670,_0x1902dc){_0x77670=_0x77670-0x0;var _0x50685c=_0x47a1[_0x77670];return _0x50685c;};'use strict';var EventEmitter=require(_0x147a('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x147a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x147a('0x2'),'afterDestroy':_0x147a('0x3')};function emitEvent(_0x5e69bc){return function(_0xd80e93,_0x66a8e2,_0xc2071d){PluginEvents[_0x147a('0x4')](_0x5e69bc+':'+_0xd80e93['id'],_0xd80e93);PluginEvents[_0x147a('0x4')](_0x5e69bc,_0xd80e93);_0xc2071d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x147a('0x5')](e,emitEvent(event));}}module[_0x147a('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index cf843ac..2ea6476 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 _0xc4aa=['plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0xc4aa,0x1a1));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require(_0xac4a('0x6'));var fs=require('fs');var path=require(_0xac4a('0x7'));var rimraf=require(_0xac4a('0x8'));var config=require(_0xac4a('0x9'));var attributes=require(_0xac4a('0xa'));module['exports']=function(_0x404681,_0x5c543a){return _0x404681[_0xac4a('0xb')]('Plugin',attributes,{'tableName':_0xac4a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07b1=['bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger','api','moment'];(function(_0x41ddf3,_0x4c5db7){var _0x2adac3=function(_0x15cf40){while(--_0x15cf40){_0x41ddf3['push'](_0x41ddf3['shift']());}};_0x2adac3(++_0x4c5db7);}(_0x07b1,0x1a9));var _0x107b=function(_0x103994,_0x341732){_0x103994=_0x103994-0x0;var _0x4c4988=_0x07b1[_0x103994];return _0x4c4988;};'use strict';var _=require(_0x107b('0x0'));var util=require('util');var logger=require(_0x107b('0x1'))(_0x107b('0x2'));var moment=require(_0x107b('0x3'));var BPromise=require(_0x107b('0x4'));var rp=require(_0x107b('0x5'));var fs=require('fs');var path=require(_0x107b('0x6'));var rimraf=require(_0x107b('0x7'));var config=require('../../config/environment');var attributes=require(_0x107b('0x8'));module[_0x107b('0x9')]=function(_0x506ef3,_0x57f44f){return _0x506ef3[_0x107b('0xa')](_0x107b('0xb'),attributes,{'tableName':_0x107b('0xc'),'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 901d303..c97000a 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 _0x1a9e=['defaults','redis','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','code','message','CreatePlugin','create','body','options','raw','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3dd410,_0x5a29c6){var _0x37eaef=function(_0x445719){while(--_0x445719){_0x3dd410['push'](_0x3dd410['shift']());}};_0x37eaef(++_0x5a29c6);}(_0x1a9e,0x188));var _0xe1a9=function(_0x3179b2,_0x311eb2){_0x3179b2=_0x3179b2-0x0;var _0x5ce88f=_0x1a9e[_0x3179b2];return _0x5ce88f;};'use strict';var _=require(_0xe1a9('0x0'));var util=require(_0xe1a9('0x1'));var moment=require('moment');var BPromise=require(_0xe1a9('0x2'));var rs=require(_0xe1a9('0x3'));var fs=require('fs');var Redis=require(_0xe1a9('0x4'));var db=require(_0xe1a9('0x5'))['db'];var utils=require(_0xe1a9('0x6'));var logger=require(_0xe1a9('0x7'))(_0xe1a9('0x8'));var config=require('../../config/environment');var jayson=require(_0xe1a9('0x9'));var client=jayson[_0xe1a9('0xa')]['http']({'port':0x232a});config['redis']=_[_0xe1a9('0xb')](config[_0xe1a9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe1a9('0xd'))(new Redis(config[_0xe1a9('0xc')]));require(_0xe1a9('0xe'))[_0xe1a9('0xf')](socket);function respondWithRpcPromise(_0x20565c,_0x5abb84,_0x1d95c6){return new BPromise(function(_0x566560,_0x2cc896){return client['request'](_0x20565c,_0x1d95c6)[_0xe1a9('0x10')](function(_0x177909){logger[_0xe1a9('0x11')](_0xe1a9('0x12'),_0x5abb84,_0xe1a9('0x13'));logger[_0xe1a9('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x5abb84,_0xe1a9('0x13'),JSON['stringify'](_0x177909));if(_0x177909['error']){if(_0x177909[_0xe1a9('0x15')][_0xe1a9('0x16')]===0x1f4){logger['error'](_0xe1a9('0x12'),_0x5abb84,_0x177909[_0xe1a9('0x15')][_0xe1a9('0x17')]);return _0x2cc896(_0x177909[_0xe1a9('0x15')]['message']);}logger[_0xe1a9('0x15')]('Plugin,\x20%s,\x20%s',_0x5abb84,_0x177909[_0xe1a9('0x15')][_0xe1a9('0x17')]);return _0x566560(_0x177909[_0xe1a9('0x15')][_0xe1a9('0x17')]);}else{logger[_0xe1a9('0x11')](_0xe1a9('0x12'),_0x5abb84,_0xe1a9('0x13'));_0x566560(_0x177909['result'][_0xe1a9('0x17')]);}})['catch'](function(_0x5235ee){logger[_0xe1a9('0x15')](_0xe1a9('0x12'),_0x5abb84,_0x5235ee);_0x2cc896(_0x5235ee);});});}exports[_0xe1a9('0x18')]=function(_0x48a3de){var _0x4e217e=this;return new Promise(function(_0x3dc1ee,_0x3cb20f){return db['Plugin'][_0xe1a9('0x19')](_0x48a3de[_0xe1a9('0x1a')],{'raw':_0x48a3de[_0xe1a9('0x1b')]?_0x48a3de[_0xe1a9('0x1b')][_0xe1a9('0x1c')]===undefined?!![]:![]:!![]})[_0xe1a9('0x10')](function(_0x44218d){logger[_0xe1a9('0x11')](_0xe1a9('0x18'),_0x48a3de);logger[_0xe1a9('0x14')](_0xe1a9('0x18'),_0x48a3de,JSON[_0xe1a9('0x1d')](_0x44218d));_0x3dc1ee(_0x44218d);})[_0xe1a9('0x1e')](function(_0x3c5504){logger[_0xe1a9('0x15')](_0xe1a9('0x18'),_0x3c5504[_0xe1a9('0x17')],_0x48a3de);_0x3cb20f(_0x4e217e['error'](0x1f4,_0x3c5504[_0xe1a9('0x17')]));});});}; \ No newline at end of file +var _0x584a=['bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','defaults','redis','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','CreatePlugin','Plugin','create','body','options','raw','debug','catch','lodash','util'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x584a,0x1c0));var _0xa584=function(_0x4d6bfd,_0x8d79ff){_0x4d6bfd=_0x4d6bfd-0x0;var _0x243a46=_0x584a[_0x4d6bfd];return _0x243a46;};'use strict';var _=require(_0xa584('0x0'));var util=require(_0xa584('0x1'));var moment=require('moment');var BPromise=require(_0xa584('0x2'));var rs=require(_0xa584('0x3'));var fs=require('fs');var Redis=require(_0xa584('0x4'));var db=require(_0xa584('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa584('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa584('0x7')][_0xa584('0x8')]({'port':0x232a});config['redis']=_[_0xa584('0x9')](config[_0xa584('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa584('0xb'))[_0xa584('0xc')](socket);function respondWithRpcPromise(_0x2b0bd2,_0x13910c,_0x42bf8c){return new BPromise(function(_0x37c285,_0x1f9081){return client[_0xa584('0xd')](_0x2b0bd2,_0x42bf8c)[_0xa584('0xe')](function(_0x15bf3c){logger[_0xa584('0xf')](_0xa584('0x10'),_0x13910c,_0xa584('0x11'));logger['debug'](_0xa584('0x12'),_0x13910c,_0xa584('0x11'),JSON[_0xa584('0x13')](_0x15bf3c));if(_0x15bf3c[_0xa584('0x14')]){if(_0x15bf3c[_0xa584('0x14')]['code']===0x1f4){logger[_0xa584('0x14')](_0xa584('0x10'),_0x13910c,_0x15bf3c[_0xa584('0x14')][_0xa584('0x15')]);return _0x1f9081(_0x15bf3c[_0xa584('0x14')]['message']);}logger[_0xa584('0x14')]('Plugin,\x20%s,\x20%s',_0x13910c,_0x15bf3c[_0xa584('0x14')][_0xa584('0x15')]);return _0x37c285(_0x15bf3c[_0xa584('0x14')]['message']);}else{logger[_0xa584('0xf')](_0xa584('0x10'),_0x13910c,_0xa584('0x11'));_0x37c285(_0x15bf3c['result'][_0xa584('0x15')]);}})['catch'](function(_0x278868){logger[_0xa584('0x14')]('Plugin,\x20%s,\x20%s',_0x13910c,_0x278868);_0x1f9081(_0x278868);});});}exports[_0xa584('0x16')]=function(_0x203ec4){var _0x2fb7da=this;return new Promise(function(_0xf9097e,_0xd6f63c){return db[_0xa584('0x17')][_0xa584('0x18')](_0x203ec4[_0xa584('0x19')],{'raw':_0x203ec4[_0xa584('0x1a')]?_0x203ec4[_0xa584('0x1a')][_0xa584('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5c3e32){logger[_0xa584('0xf')](_0xa584('0x16'),_0x203ec4);logger[_0xa584('0x1c')](_0xa584('0x16'),_0x203ec4,JSON[_0xa584('0x13')](_0x5c3e32));_0xf9097e(_0x5c3e32);})[_0xa584('0x1d')](function(_0x33bf24){logger[_0xa584('0x14')](_0xa584('0x16'),_0x33bf24['message'],_0x203ec4);_0xd6f63c(_0x2fb7da[_0xa584('0x14')](0x1f4,_0x33bf24['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4800040..764662f 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 _0xaec3=['plugin:','./plugin.events','save','remove','update','emit','register'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xaec3,0xb0));var _0x3aec=function(_0x32d307,_0x2edaf2){_0x32d307=_0x32d307-0x0;var _0x5bd95a=_0xaec3[_0x32d307];return _0x5bd95a;};'use strict';var PluginEvents=require(_0x3aec('0x0'));var events=[_0x3aec('0x1'),_0x3aec('0x2'),_0x3aec('0x3')];function createListener(_0xac741e,_0x120c5f){return function(_0x199833){_0x120c5f[_0x3aec('0x4')](_0xac741e,_0x199833);};}function removeListener(_0x3c39e0,_0x385674){return function(){PluginEvents['removeListener'](_0x3c39e0,_0x385674);};}exports[_0x3aec('0x5')]=function(_0x391abb){for(var _0x325609=0x0,_0x1c45dc=events['length'];_0x325609<_0x1c45dc;_0x325609++){var _0x429d4f=events[_0x325609];var _0x485169=createListener(_0x3aec('0x6')+_0x429d4f,_0x391abb);PluginEvents['on'](_0x429d4f,_0x485169);}}; \ No newline at end of file +var _0xc260=['./plugin.events','save','remove','update','emit','register','length'];(function(_0x2aa7e4,_0x467538){var _0x42b54e=function(_0x56c22f){while(--_0x56c22f){_0x2aa7e4['push'](_0x2aa7e4['shift']());}};_0x42b54e(++_0x467538);}(_0xc260,0xe7));var _0x0c26=function(_0x495e7f,_0x3a034f){_0x495e7f=_0x495e7f-0x0;var _0x1c3283=_0xc260[_0x495e7f];return _0x1c3283;};'use strict';var PluginEvents=require(_0x0c26('0x0'));var events=[_0x0c26('0x1'),_0x0c26('0x2'),_0x0c26('0x3')];function createListener(_0xdfaf5a,_0x521510){return function(_0x2910b3){_0x521510[_0x0c26('0x4')](_0xdfaf5a,_0x2910b3);};}function removeListener(_0x27e986,_0x2f038d){return function(){PluginEvents['removeListener'](_0x27e986,_0x2f038d);};}exports[_0x0c26('0x5')]=function(_0x596682){for(var _0x52764c=0x0,_0x51aa07=events[_0x0c26('0x6')];_0x52764c<_0x51aa07;_0x52764c++){var _0x555422=events[_0x52764c];var _0x284e09=createListener('plugin:'+_0x555422,_0x596682);PluginEvents['on'](_0x555422,_0x284e09);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a518827..40342af 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(_0x822d13,_0xf4287f){var _0x500c63=function(_0x5a28a1){while(--_0x5a28a1){_0x822d13['push'](_0x822d13['shift']());}};_0x500c63(++_0xf4287f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x4ac97e,_0x4eed19){var _0x81bc3d=function(_0x503a6d){while(--_0x503a6d){_0x4ac97e['push'](_0x4ac97e['shift']());}};_0x81bc3d(++_0x4eed19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 fb81dba..2f8bd78 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 _0xdace=['path','exec','bluebird','sendStatus','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','express','length','catch','show','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/logger','api'];(function(_0x1e65db,_0x44a530){var _0x3d9d4d=function(_0x4b7e9a){while(--_0x4b7e9a){_0x1e65db['push'](_0x1e65db['shift']());}};_0x3d9d4d(++_0x44a530);}(_0xdace,0xc5));var _0xedac=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xdace[_0x365e54];return _0x13317a;};'use strict';var _=require(_0xedac('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var path=require(_0xedac('0x3'));var exec=require('child_process')[_0xedac('0x4')];var BPromise=require(_0xedac('0x5'));function handleEntityNotFound(_0x15d3bd,_0xefb142){return function(_0x5a97c0){if(!_0x5a97c0){_0x15d3bd[_0xedac('0x6')](0x194);;}return _0x5a97c0;};}function respondWithResult(_0x1cba89,_0x39328a){_0x39328a=_0x39328a||0xc8;return function(_0x5ecbd3){if(_0x5ecbd3){return _0x1cba89[_0xedac('0x7')](_0x39328a)[_0xedac('0x8')](_0x5ecbd3);}return null;};}function handleError(_0x162eea,_0x53fa43){_0x53fa43=_0x53fa43||0x1f4;return function(_0x27243f){logger[_0xedac('0x9')](_0x27243f[_0xedac('0xa')]);if(_0x27243f['name']){delete _0x27243f['name'];}_0x162eea[_0xedac('0x7')](_0x53fa43)[_0xedac('0xb')](_0x27243f);};}function execChildProcess(){return new BPromise(function(_0x57e1bf,_0x4d6a29){exec(_0xedac('0xc'),function(_0x25395d,_0x57f637,_0x261401){logger['info'](_0x57f637);logger[_0xedac('0xd')](_0x261401);if(_0x25395d){logger[_0xedac('0x9')](_0x25395d);return _0x4d6a29(_0x25395d);}return _0x57e1bf(_0x57f637);});});}exports[_0xedac('0xe')]=function(_0x342186,_0x9a79a0){return pm2[_0xedac('0xf')]()[_0xedac('0x10')](function(_0x11f0b0){if(_0x11f0b0){var _0x593030=_[_0xedac('0x11')](_0x11f0b0,function(_0x4651d4){return _0x4651d4[_0xedac('0x12')]===_0xedac('0x13')||_0x4651d4[_0xedac('0x12')]==='motion2';});return{'rows':_0x593030,'count':_0x593030[_0xedac('0x14')]};}return null;})['then'](respondWithResult(_0x9a79a0,null))[_0xedac('0x15')](handleError(_0x9a79a0,null));};exports[_0xedac('0x16')]=function(_0xdad128,_0xba0c93){return pm2['describe'](_0xdad128['params']['id'])[_0xedac('0x10')](respondWithResult(_0xba0c93,null))[_0xedac('0x10')](handleEntityNotFound(_0xba0c93,null))[_0xedac('0x15')](handleError(_0xba0c93,null));};exports[_0xedac('0x17')]=function(_0x5a5438,_0x4a699b){if(_0x5a5438[_0xedac('0x18')][_0xedac('0x12')]&&_0x5a5438[_0xedac('0x18')][_0xedac('0x19')]){var _0x2f5eee=path[_0xedac('0x1a')](__dirname,_0xedac('0x1b'),_0x5a5438[_0xedac('0x18')]['script']);var _0x4593e8=process['cwd']();process[_0xedac('0x1c')](path[_0xedac('0x1d')](_0x2f5eee));return execChildProcess()['then'](function(_0x46e09d){process[_0xedac('0x1c')](_0x4593e8);return pm2[_0xedac('0x1e')]({'name':_0x5a5438[_0xedac('0x18')][_0xedac('0x12')],'script':_0x2f5eee});})[_0xedac('0x10')](function(_0x5d7c31){pm2[_0xedac('0x1f')]();return _0x5d7c31[0x0];})[_0xedac('0x10')](respondWithResult(_0x4a699b,0xc9))[_0xedac('0x15')](handleError(_0x4a699b,null));}else{return _0x4a699b[_0xedac('0x7')](0x1f4)[_0xedac('0xb')]({'message':_0xedac('0x20')});}};exports[_0xedac('0x21')]=function(_0x26c6f7,_0x409825){if(_0x26c6f7[_0xedac('0x18')]['id']){delete _0x26c6f7['body']['id'];}var _0x25d7f5={'online':_0xedac('0x22'),'stopped':_0xedac('0x23')};if(_0x25d7f5['hasOwnProperty'](_0x26c6f7[_0xedac('0x18')]['status'])){return pm2[_0x25d7f5[_0x26c6f7['body'][_0xedac('0x7')]]](_0x26c6f7[_0xedac('0x24')]['id'])[_0xedac('0x10')](respondWithResult(_0x409825,0xc8))[_0xedac('0x15')](handleError(_0x409825,null));}else{return _0x409825['status'](0x1f4)['send']({'message':_0xedac('0x25')});}};exports[_0xedac('0x26')]=function(_0x24b182,_0x2ee8d7){if(_0x24b182[_0xedac('0x18')]['id']){delete _0x24b182[_0xedac('0x18')]['id'];}if(_0x24b182[_0xedac('0x24')]['id']){return pm2['delete'](_0x24b182[_0xedac('0x24')]['id'])[_0xedac('0x10')](function(_0x2cbe33){pm2['dump']();return _0x2cbe33[0x0];})[_0xedac('0x10')](respondWithResult(_0x2ee8d7,null))[_0xedac('0x15')](handleError(_0x2ee8d7,null));}else{return _0x2ee8d7['status'](0x1f4)[_0xedac('0xb')]({'message':_0xedac('0x27')});}}; \ No newline at end of file +var _0xf72b=['hasOwnProperty','Unknown\x20status','destroy','params','delete','lodash','../../config/logger','path','child_process','bluebird','sendStatus','status','json','stack','name','npm\x20install','info','index','then','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xf72b,0x1d9));var _0xbf72=function(_0x36b5da,_0x4a31d6){_0x36b5da=_0x36b5da-0x0;var _0x51b1c9=_0xf72b[_0x36b5da];return _0x51b1c9;};'use strict';var _=require(_0xbf72('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xbf72('0x1'))('api');var path=require(_0xbf72('0x2'));var exec=require(_0xbf72('0x3'))['exec'];var BPromise=require(_0xbf72('0x4'));function handleEntityNotFound(_0x550a9e,_0x37afc8){return function(_0x3d3a6f){if(!_0x3d3a6f){_0x550a9e[_0xbf72('0x5')](0x194);;}return _0x3d3a6f;};}function respondWithResult(_0x2b8440,_0x5ee060){_0x5ee060=_0x5ee060||0xc8;return function(_0x41c11d){if(_0x41c11d){return _0x2b8440[_0xbf72('0x6')](_0x5ee060)[_0xbf72('0x7')](_0x41c11d);}return null;};}function handleError(_0xd0402c,_0xdd6177){_0xdd6177=_0xdd6177||0x1f4;return function(_0x1b6d38){logger['error'](_0x1b6d38[_0xbf72('0x8')]);if(_0x1b6d38['name']){delete _0x1b6d38[_0xbf72('0x9')];}_0xd0402c[_0xbf72('0x6')](_0xdd6177)['send'](_0x1b6d38);};}function execChildProcess(){return new BPromise(function(_0xaec095,_0x1c3453){exec(_0xbf72('0xa'),function(_0x145acb,_0x2957c5,_0x44ce73){logger[_0xbf72('0xb')](_0x2957c5);logger[_0xbf72('0xb')](_0x44ce73);if(_0x145acb){logger['error'](_0x145acb);return _0x1c3453(_0x145acb);}return _0xaec095(_0x2957c5);});});}exports[_0xbf72('0xc')]=function(_0x227a35,_0x57cccf){return pm2['list']()[_0xbf72('0xd')](function(_0x4f4fa5){if(_0x4f4fa5){var _0x5625b3=_['reject'](_0x4f4fa5,function(_0x32a0a5){return _0x32a0a5[_0xbf72('0x9')]===_0xbf72('0xe')||_0x32a0a5[_0xbf72('0x9')]===_0xbf72('0xf');});return{'rows':_0x5625b3,'count':_0x5625b3[_0xbf72('0x10')]};}return null;})['then'](respondWithResult(_0x57cccf,null))[_0xbf72('0x11')](handleError(_0x57cccf,null));};exports[_0xbf72('0x12')]=function(_0x2a8609,_0x3d4dea){return pm2[_0xbf72('0x13')](_0x2a8609['params']['id'])['then'](respondWithResult(_0x3d4dea,null))[_0xbf72('0xd')](handleEntityNotFound(_0x3d4dea,null))[_0xbf72('0x11')](handleError(_0x3d4dea,null));};exports[_0xbf72('0x14')]=function(_0x2584d9,_0x27e58e){if(_0x2584d9[_0xbf72('0x15')][_0xbf72('0x9')]&&_0x2584d9['body'][_0xbf72('0x16')]){var _0x42a193=path[_0xbf72('0x17')](__dirname,_0xbf72('0x18'),_0x2584d9[_0xbf72('0x15')]['script']);var _0x3cd181=process[_0xbf72('0x19')]();process['chdir'](path[_0xbf72('0x1a')](_0x42a193));return execChildProcess()[_0xbf72('0xd')](function(_0x267c41){process['chdir'](_0x3cd181);return pm2[_0xbf72('0x1b')]({'name':_0x2584d9[_0xbf72('0x15')][_0xbf72('0x9')],'script':_0x42a193});})[_0xbf72('0xd')](function(_0x4f4dc0){pm2[_0xbf72('0x1c')]();return _0x4f4dc0[0x0];})[_0xbf72('0xd')](respondWithResult(_0x27e58e,0xc9))[_0xbf72('0x11')](handleError(_0x27e58e,null));}else{return _0x27e58e['status'](0x1f4)[_0xbf72('0x1d')]({'message':_0xbf72('0x1e')});}};exports[_0xbf72('0x1f')]=function(_0x1a2f55,_0x15d60d){if(_0x1a2f55[_0xbf72('0x15')]['id']){delete _0x1a2f55[_0xbf72('0x15')]['id'];}var _0x25ecdf={'online':_0xbf72('0x20'),'stopped':_0xbf72('0x21')};if(_0x25ecdf[_0xbf72('0x22')](_0x1a2f55[_0xbf72('0x15')][_0xbf72('0x6')])){return pm2[_0x25ecdf[_0x1a2f55[_0xbf72('0x15')][_0xbf72('0x6')]]](_0x1a2f55['params']['id'])[_0xbf72('0xd')](respondWithResult(_0x15d60d,0xc8))[_0xbf72('0x11')](handleError(_0x15d60d,null));}else{return _0x15d60d[_0xbf72('0x6')](0x1f4)[_0xbf72('0x1d')]({'message':_0xbf72('0x23')});}};exports[_0xbf72('0x24')]=function(_0x35ecdc,_0x209b2b){if(_0x35ecdc[_0xbf72('0x15')]['id']){delete _0x35ecdc[_0xbf72('0x15')]['id'];}if(_0x35ecdc[_0xbf72('0x25')]['id']){return pm2[_0xbf72('0x26')](_0x35ecdc[_0xbf72('0x25')]['id'])[_0xbf72('0xd')](function(_0x4e2472){pm2[_0xbf72('0x1c')]();return _0x4e2472[0x0];})[_0xbf72('0xd')](respondWithResult(_0x209b2b,null))[_0xbf72('0x11')](handleError(_0x209b2b,null));}else{return _0x209b2b['status'](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 4f025c2..a1ca365 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 _0xc96f=['./realtime.controller','get','/agents','isAuthenticated','/queues','getQueues','exports','express','Router','../../components/auth/service'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0xc96f,0x133));var _0xfc96=function(_0x3a2287,_0x1dba3c){_0x3a2287=_0x3a2287-0x0;var _0x413405=_0xc96f[_0x3a2287];return _0x413405;};'use strict';var express=require(_0xfc96('0x0'));var router=express[_0xfc96('0x1')]();var auth=require(_0xfc96('0x2'));var controller=require(_0xfc96('0x3'));router[_0xfc96('0x4')](_0xfc96('0x5'),auth[_0xfc96('0x6')](),controller['getAgents']);router[_0xfc96('0x4')](_0xfc96('0x7'),auth['isAuthenticated'](),controller[_0xfc96('0x8')]);module[_0xfc96('0x9')]=router; \ No newline at end of file +var _0xfa67=['exports','express','../../components/auth/service','/agents','isAuthenticated','getAgents','get','getQueues'];(function(_0x59fccc,_0x1b0c97){var _0x5b5fcd=function(_0x3b0e7a){while(--_0x3b0e7a){_0x59fccc['push'](_0x59fccc['shift']());}};_0x5b5fcd(++_0x1b0c97);}(_0xfa67,0x1d1));var _0x7fa6=function(_0x14211f,_0x173029){_0x14211f=_0x14211f-0x0;var _0x16e5de=_0xfa67[_0x14211f];return _0x16e5de;};'use strict';var express=require(_0x7fa6('0x0'));var router=express['Router']();var auth=require(_0x7fa6('0x1'));var controller=require('./realtime.controller');router['get'](_0x7fa6('0x2'),auth[_0x7fa6('0x3')](),controller[_0x7fa6('0x4')]);router[_0x7fa6('0x5')]('/queues',auth[_0x7fa6('0x3')](),controller[_0x7fa6('0x6')]);module[_0x7fa6('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 ee70b63..c44ec2d 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 _0x8e61=['getOptions','raw','isEmpty','where','user','role','userProfileId','nolimit','getResources','findAndCountAll','rows','pick','omit','globalStatusFilter','pauseTypeFilter','Queue','rawAttributes','Queues','UserProfile','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','client','http','offset','undefined','limit','count','status','Content-Range','json','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','voice','startCase','format','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','catch','loggedIn','waiting','talking','paused','outbound','push','pTalking','originated','message','Trunk','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','busy','find','merge','filter','queue','length','some','internal','getMembers','UserId','accountcode','voiceStatus','online','User','Pause','findAll','QueueId','idle','unknown','unavailable','ringing','isNil','chatPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','chat','sms','openchannel','fax','whatsapp','includes','toLowerCase','Invalid\x20channel','findOne','all','flatten','uniq','value','split','fields','order','startsWith','DESC','ASC','sort','globalStatus','pauseType','getAgents','userpic','lastPauseAt','address','mailPause','faxPause','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','channel','join','globalQueueFilter','fieldName','type','key','agent'];(function(_0x7e2a57,_0x736dc4){var _0x38bcef=function(_0x35a4e1){while(--_0x35a4e1){_0x7e2a57['push'](_0x7e2a57['shift']());}};_0x38bcef(++_0x736dc4);}(_0x8e61,0x163));var _0x18e6=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x8e61[_0x55e08b];return _0xd1a7ff;};'use strict';var util=require(_0x18e6('0x0'));var _=require(_0x18e6('0x1'));var jayson=require(_0x18e6('0x2'));var qs=require(_0x18e6('0x3'));var logger=require(_0x18e6('0x4'))('api');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x18e6('0x5')][_0x18e6('0x6')]({'port':0x232a});var routingClient=jayson[_0x18e6('0x5')][_0x18e6('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x30b72d,_0x11ae26){return function(_0x62fd3){if(_0x62fd3){var _0x1c313e=typeof _0x11ae26[_0x18e6('0x7')]===_0x18e6('0x8')&&typeof _0x11ae26[_0x18e6('0x9')]===_0x18e6('0x8');var _0x1f8263=_0x62fd3['count'];var _0x5d4021=_0x1c313e?0x0:_0x11ae26[_0x18e6('0x7')];var _0x2a66bc=_0x1c313e?_0x62fd3[_0x18e6('0xa')]:_0x11ae26[_0x18e6('0x7')]+_0x11ae26[_0x18e6('0x9')];var _0x47c1be;if(_0x2a66bc>=_0x1f8263){_0x2a66bc=_0x1f8263;_0x47c1be=0xc8;}else{_0x47c1be=0xce;}_0x30b72d[_0x18e6('0xb')](_0x47c1be);return _0x30b72d['set'](_0x18e6('0xc'),_0x5d4021+'-'+_0x2a66bc+'/'+_0x1f8263)[_0x18e6('0xd')](_0x62fd3);}return null;};}function handleError(_0x8dd62,_0x29ac6b){_0x29ac6b=_0x29ac6b||0x1f4;return function(_0x5a75f1){logger[_0x18e6('0xe')](_0x5a75f1[_0x18e6('0xf')]);if(_0x5a75f1[_0x18e6('0x10')]){delete _0x5a75f1[_0x18e6('0x10')];}_0x8dd62[_0x18e6('0xb')](_0x29ac6b)[_0x18e6('0x11')](_0x5a75f1);};}function getRealtimeAgents(){return new Promise(function(_0x3a69e4,_0x1dbcc6){return amiClient[_0x18e6('0x12')](_0x18e6('0x13'),{})[_0x18e6('0x14')](function(_0x730dc9){if(_0x730dc9[_0x18e6('0xe')])throw new Error(_0x18e6('0x15'));var _0x253ac7=_0x730dc9[_0x18e6('0x16')];return routingClient['request'](_0x18e6('0x13'),{})[_0x18e6('0x14')](function(_0x2a4d3b){if(_0x2a4d3b[_0x18e6('0xe')])throw new Error(_0x18e6('0x17'));var _0x36ad6f=_0x2a4d3b[_0x18e6('0x16')];return _0x3a69e4(_['merge']({},_0x253ac7,_0x36ad6f));});})['catch'](function(_0x298d06){_0x1dbcc6(_0x298d06);});});}function getRealtimeQueues(_0x5827c5,_0x4ad6fe){return new Promise(function(_0x468506,_0x4c756a){var _0x3a88ec=_0x4ad6fe===_0x18e6('0x18')?amiClient:routingClient;return _0x3a88ec[_0x18e6('0x12')](_[_0x18e6('0x19')](_0x4ad6fe)+'Queues',_0x5827c5)['then'](function(_0x12ea33){if(_0x12ea33[_0x18e6('0xe')])throw new Error(util[_0x18e6('0x1a')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x4ad6fe));return _0x468506(_0x12ea33[_0x18e6('0x16')]);})['catch'](function(_0x30b225){_0x4c756a(_0x30b225);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x55691c,_0x443d3d){return amiClient['request'](_0x18e6('0x1b'),{})[_0x18e6('0x14')](function(_0x35d3de){if(_0x35d3de['error'])throw new Error(_0x18e6('0x1c'));return _0x55691c(_0x35d3de[_0x18e6('0x16')]);})[_0x18e6('0x1d')](function(_0x1571e0){_0x443d3d(_0x1571e0);});});}function initializeQueues(_0x58a24c,_0x5b609d,_0x1088ec,_0x12ca10){var _0x139779=[_0x18e6('0x1e'),'available',_0x18e6('0x1f'),_0x18e6('0x20'),_0x18e6('0x21')];if(_0x1088ec===_0x18e6('0x18')&&_0x12ca10===_0x18e6('0x22')){_0x139779[_0x18e6('0x23')](_0x18e6('0x24'),_0x18e6('0x25'),_0x18e6('0x26'),'dialActive','dialMethod',_0x18e6('0x27'),'startPredictive',_0x18e6('0x28'),_0x18e6('0x29'),'erlangCallToSecond',_0x18e6('0x2a'),_0x18e6('0x2b'),_0x18e6('0x2c'),'dialPredictiveIntervalMaxThreshold',_0x18e6('0x2d'),_0x18e6('0x2e'),_0x18e6('0x2f'),_0x18e6('0x30'),_0x18e6('0x31'),_0x18e6('0x32'),'predictiveIntervalAvgHoldtime',_0x18e6('0x33'));}return _0x58a24c[_0x18e6('0x34')](function(_0x5b6af3){var _0x4c2aa6=_0x5b6af3[_0x18e6('0x35')]({'plain':!![]});_0x4c2aa6[_0x18e6('0x36')]=[];_0x4c2aa6[_0x18e6('0x21')]=0x0;_0x4c2aa6[_0x18e6('0x37')]=0x0;_0x4c2aa6[_0x18e6('0x1e')]=0x0;_0x4c2aa6['available']=0x0;_0x4c2aa6['waiting']=0x0;if(_0x1088ec==='voice'){_0x4c2aa6[_0x18e6('0x20')]=0x0;_0x4c2aa6[_0x18e6('0x38')]=0x0;if(_0x12ca10===_0x18e6('0x22')){_0x4c2aa6[_0x18e6('0x24')]=0x0;_0x4c2aa6['originated']=0x0;}}var _0x1b4e58=_[_0x18e6('0x39')](_0x5b609d,['id',_0x4c2aa6['id']]);if(_0x1b4e58)_[_0x18e6('0x3a')](_0x4c2aa6,_['pick'](_0x1b4e58,_0x139779));return _0x4c2aa6;});}function updateAgentVoiceStatus(_0x38f130,_0x452ada,_0x28b451){var _0x50db10=_[_0x18e6('0x3b')](_0x28b451,[_0x18e6('0x3c'),_0x452ada[_0x18e6('0x10')]]);if(_0x50db10[_0x18e6('0x3d')]===0x0)return _0x38f130['busy']=!![];if(_[_0x18e6('0x3e')](_0x50db10,['connectedlinenum',_0x38f130[_0x18e6('0x3f')]['toString']()]))return _0x38f130[_0x18e6('0x20')]=!![];if(!_0x38f130[_0x18e6('0x20')])return _0x38f130[_0x18e6('0x38')]=!![];}function getVoiceQueueAgents(_0x4e75da,_0x598119,_0x4416e1,_0x7f381a){var _0x55c728=_['find'](_0x598119,['id',_0x4e75da['id']]);if(!_0x55c728)return _0x4e75da;return _0x55c728[_0x18e6('0x40')]({'raw':!![]})['then'](function(_0x3ef0e0){for(var _0x33a526=0x0;_0x33a526<_0x3ef0e0[_0x18e6('0x3d')];_0x33a526++){var _0x2ae697=_[_0x18e6('0x39')](_0x4416e1,['id',_0x3ef0e0[_0x33a526][_0x18e6('0x41')]]);if(!_0x2ae697){_0x2ae697={'id':_0x3ef0e0[_0x33a526][_0x18e6('0x41')],'name':_0x3ef0e0[_0x33a526][_0x18e6('0x41')],'accountcode':'','online':![]};}var _0x185ff8={'id':_0x2ae697['id'],'name':_0x2ae697[_0x18e6('0x10')],'internal':_0x2ae697[_0x18e6('0x42')],'online':Boolean(_0x2ae697['online']),'paused':Boolean(_0x3ef0e0[_0x33a526][_0x18e6('0x21')])};if(_0x2ae697[_0x18e6('0x43')]===_0x18e6('0x20'))updateAgentVoiceStatus(_0x185ff8,_0x4e75da,_0x7f381a);if(_0x185ff8[_0x18e6('0x44')])_0x4e75da[_0x18e6('0x37')]++;if(_0x185ff8[_0x18e6('0x38')])_0x4e75da[_0x18e6('0x38')]++;if(_0x185ff8[_0x18e6('0x21')]&&!_0x185ff8[_0x18e6('0x38')]&&!_0x185ff8[_0x18e6('0x20')])_0x4e75da[_0x18e6('0x21')]++;_0x4e75da[_0x18e6('0x36')][_0x18e6('0x23')](_0x185ff8);}return _0x4e75da;});}function getQueueAgents(_0x341ae4,_0x386a45,_0x259057){var _0x30257f=_0x18e6('0x45')+_[_0x18e6('0x19')](_0x259057)+'Queue';var _0xa48fbf=_0x259057+_0x18e6('0x46');return db[_0x30257f][_0x18e6('0x47')]({'where':{[_['startCase'](_0x259057)+_0x18e6('0x48')]:_0x341ae4['id']},'raw':!![]})[_0x18e6('0x14')](function(_0x5d9b22){for(var _0x13e5cf=0x0;_0x13e5cf<_0x5d9b22[_0x18e6('0x3d')];_0x13e5cf++){var _0x12c6c6=_[_0x18e6('0x39')](_0x386a45,['id',_0x5d9b22[_0x13e5cf][_0x18e6('0x41')]]);if(!_0x12c6c6){_0x12c6c6={'id':_0x5d9b22[_0x13e5cf][_0x18e6('0x41')],'name':_0x5d9b22[_0x13e5cf][_0x18e6('0x41')],'online':![],['pauseField']:![]};}var _0x34e910={'id':_0x12c6c6['id'],'name':_0x12c6c6['name'],'online':Boolean(_0x12c6c6[_0x18e6('0x44')]),'paused':Boolean(_0x12c6c6[_0xa48fbf])};if(_0x34e910['online'])_0x341ae4[_0x18e6('0x37')]++;_0x341ae4[_0x18e6('0x36')][_0x18e6('0x23')](_0x34e910);}return _0x341ae4;});}function isIdle(_0x493310){return _0x493310===_0x18e6('0x49')||_0x493310===_0x18e6('0x4a')||_0x493310===_0x18e6('0x4b')||_0x493310===_0x18e6('0x4c')||_[_0x18e6('0x4d')](_0x493310);}function isAgentPaused(_0x48f0cf,_0x55a74c){var _0x3dd299=[_0x48f0cf[_0x18e6('0x4e')],_0x48f0cf['faxPause'],_0x48f0cf['mailPause'],_0x48f0cf[_0x18e6('0x4f')],_0x48f0cf[_0x18e6('0x50')],_0x48f0cf[_0x18e6('0x51')],_0x48f0cf[_0x18e6('0x52')]];if(!_0x55a74c)return _[_0x18e6('0x53')](_0x3dd299);var _0x38e6a7=_[_0x18e6('0x3b')](_0x3dd299);return _0x38e6a7['length']>0x0&&_0x38e6a7[_0x18e6('0x3d')]<_0x3dd299[_0x18e6('0x3d')]?!![]:![];}function isAgentIdle(_0x343d88){if(_0x343d88[_0x18e6('0x43')]!==_0x18e6('0x49')&&_0x343d88[_0x18e6('0x51')]){_0x343d88[_0x18e6('0x43')]=_0x18e6('0x54');return![];}return _[_0x18e6('0x53')]([_0x343d88['chatStatus'],_0x343d88[_0x18e6('0x55')],_0x343d88[_0x18e6('0x56')],_0x343d88[_0x18e6('0x57')],_0x343d88[_0x18e6('0x58')],_0x343d88[_0x18e6('0x43')],_0x343d88[_0x18e6('0x59')]],isIdle);}function getAgentStatus(_0x2a369d){var _0x54eaa3=_0x18e6('0x4a');if(isAgentPaused(_0x2a369d))_0x54eaa3=_0x18e6('0x54');else if(isAgentPaused(_0x2a369d,!![]))_0x54eaa3=_0x18e6('0x5a');else if(isAgentIdle(_0x2a369d))_0x54eaa3=_0x18e6('0x49');else _0x54eaa3=_0x18e6('0x38');return _0x54eaa3;}function validateChannel(_0x141a83){var _0x2ebc18=['mail',_0x18e6('0x5b'),_0x18e6('0x5c'),_0x18e6('0x5d'),_0x18e6('0x5e'),_0x18e6('0x5f'),_0x18e6('0x18')];if(!_[_0x18e6('0x60')](_0x2ebc18,_0x141a83[_0x18e6('0x61')]()))throw new Error(_0x18e6('0x62'));return _0x141a83[_0x18e6('0x61')]();}function getFilteredAgentIds(_0x587811,_0x49c348){var _0x53d6a0=_['isArray'](_0x587811)?_0x587811:[_0x587811];var _0x32b77a=_[_0x18e6('0x34')](_0x53d6a0,function(_0x554277){return db[_0x49c348][_0x18e6('0x63')]({'where':{'name':_0x554277}})[_0x18e6('0x14')](function(_0x3d9150){if(!_0x3d9150)return[];return _0x3d9150['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x18e6('0x64')](_0x32b77a)['then'](function(_0x31abf9){var _0x594d91=_(_0x31abf9)[_0x18e6('0x65')]()[_0x18e6('0x34')]('id')[_0x18e6('0x66')]()[_0x18e6('0x67')]();return _0x594d91;});}function getUpdatedSortOptions(_0x27e225){var _0x361575={'fields':[],'order':null};var _0x294fa1=_0x27e225[_0x18e6('0x68')](',');_0x361575[_0x18e6('0x69')]=_[_0x18e6('0x3b')](_0x294fa1,function(_0x587246){if(!_0x587246[_0x18e6('0x60')]('globalStatus'))return!![];_0x361575[_0x18e6('0x6a')]=_[_0x18e6('0x6b')](_0x587246,'-')?_0x18e6('0x6c'):_0x18e6('0x6d');return![];});return _0x361575;}function orderAgentsByStatus(_0x3c0d5c,_0x1fd977){return _0x3c0d5c[_0x18e6('0x6e')](function(_0x26c6e7,_0x3e6050){if(_0x26c6e7[_0x18e6('0x6f')]===_0x3e6050[_0x18e6('0x6f')]&&_0x26c6e7['globalStatus']==='pause'){if(_0x1fd977==='DESC')return(_0x26c6e7[_0x18e6('0x70')]||'')<(_0x3e6050[_0x18e6('0x70')]||'')?0x1:-0x1;return _0x26c6e7[_0x18e6('0x70')]<_0x3e6050['pauseType']?-0x1:0x1;}else{if(_0x1fd977===_0x18e6('0x6c'))return _0x26c6e7['globalStatus']<_0x3e6050[_0x18e6('0x6f')]?0x1:-0x1;return _0x26c6e7[_0x18e6('0x6f')]<_0x3e6050[_0x18e6('0x6f')]?-0x1:0x1;}});}exports[_0x18e6('0x71')]=function(_0x2d9feb,_0x120a7f){var _0x2c6534={'count':0x0,'rows':[]},_0x2cb922={},_0x1526b0,_0x1c1f35,_0x3f97f6,_0x436264,_0x48114a=[_0x18e6('0x72'),_0x18e6('0x44'),'lastLoginAt','lastPauseAt',_0x18e6('0x70'),_0x18e6('0x73'),_0x18e6('0x3f'),_0x18e6('0x74'),_0x18e6('0x4e'),'openchannelPause',_0x18e6('0x75'),'smsPause',_0x18e6('0x52'),_0x18e6('0x76'),_0x18e6('0x51'),_0x18e6('0x77'),_0x18e6('0x78'),'mailCapacity',_0x18e6('0x79'),_0x18e6('0x7a'),'faxCapacity',_0x18e6('0x7b'),_0x18e6('0x7c'),_0x18e6('0x7d'),_0x18e6('0x7e'),'whatsappCurrentCapacity',_0x18e6('0x7f'),_0x18e6('0x80'),'openchannelStatus',_0x18e6('0x56'),_0x18e6('0x58'),_0x18e6('0x59'),_0x18e6('0x55'),_0x18e6('0x43'),_0x18e6('0x81'),_0x18e6('0x82'),'mailStatusTime',_0x18e6('0x83'),_0x18e6('0x84'),_0x18e6('0x85'),_0x18e6('0x86'),_0x18e6('0x3c'),_0x18e6('0x87'),_0x18e6('0x88'),_0x18e6('0x89'),_0x18e6('0x8a'),_0x18e6('0x8b')],_0x365da6=[_0x18e6('0x4e'),_0x18e6('0x4f'),_0x18e6('0x75'),'smsPause',_0x18e6('0x52'),_0x18e6('0x76'),_0x18e6('0x51'),_0x18e6('0x44')];Promise[_0x18e6('0x8c')]()[_0x18e6('0x14')](function(){if(_0x2d9feb[_0x18e6('0x8d')][_0x18e6('0x8e')])_0x1526b0=validateChannel(_0x2d9feb['query'][_0x18e6('0x8e')]);if(!_0x2d9feb['query'][_0x18e6('0x6e')]||!_0x2d9feb[_0x18e6('0x8d')]['sort'][_0x18e6('0x60')](_0x18e6('0x6f')))return;var _0x33a674=getUpdatedSortOptions(_0x2d9feb[_0x18e6('0x8d')][_0x18e6('0x6e')]);_0x2d9feb['query'][_0x18e6('0x6e')]=_0x33a674[_0x18e6('0x69')][_0x18e6('0x8f')](',');_0x1c1f35=_0x33a674[_0x18e6('0x6a')];})[_0x18e6('0x14')](function(){if(!_0x2d9feb[_0x18e6('0x8d')][_0x18e6('0x90')])return[];var _0xc624b9=_[_0x18e6('0x19')](_0x1526b0)+'Queue';return getFilteredAgentIds(_0x2d9feb[_0x18e6('0x8d')][_0x18e6('0x90')],_0xc624b9);})[_0x18e6('0x14')](function(_0x1f6100){var _0x2ffd3d=_[_0x18e6('0x34')](db[_0x18e6('0x45')]['rawAttributes'],function(_0x15ba34){return{'name':_0x15ba34[_0x18e6('0x91')],'type':_0x15ba34[_0x18e6('0x92')][_0x18e6('0x93')]};});_0x2d9feb[_0x18e6('0x8d')]['role']=_0x18e6('0x94');_0x2d9feb[_0x18e6('0x8d')][_0x18e6('0x44')]=!![];_0x2cb922=qs[_0x18e6('0x95')](_0x2ffd3d,_0x2d9feb);_0x2cb922[_0x18e6('0x96')]=!![];if(!_[_0x18e6('0x97')](_0x1f6100)){_0x2cb922[_0x18e6('0x98')]=_[_0x18e6('0x3a')](_0x2cb922[_0x18e6('0x98')],{'$and':[{'id':{'$in':_0x1f6100}}]});}else if(!_['isEmpty'](_0x2d9feb[_0x18e6('0x8d')][_0x18e6('0x90')])){return _0x2c6534;}if(_0x2d9feb[_0x18e6('0x99')][_0x18e6('0x9a')]===_0x18e6('0x99')){var _0x1b6840={'params':{'id':_0x2d9feb['user'][_0x18e6('0x9b')]},'query':{'section':_0x18e6('0x13'),'role':_0x18e6('0x94'),'online':!![],'nolimit':_0x2d9feb[_0x18e6('0x8d')][_0x18e6('0x9c')],'sort':_0x2d9feb[_0x18e6('0x8d')][_0x18e6('0x6e')],'filter':_0x2d9feb[_0x18e6('0x8d')][_0x18e6('0x3b')],'raw':!![],'ids':_0x1f6100}};return db['UserProfile'][_0x18e6('0x9d')](_0x1b6840);}return db[_0x18e6('0x45')][_0x18e6('0x9e')](_0x2cb922);})[_0x18e6('0x14')](function(_0x4b7b58){_0x2c6534[_0x18e6('0xa')]=_0x4b7b58[_0x18e6('0xa')];_0x3f97f6=_0x4b7b58[_0x18e6('0x9f')];return getRealtimeAgents();})[_0x18e6('0x14')](function(_0x828689){_0x436264=_0x828689[_0x18e6('0x9f')];return _0x3f97f6[_0x18e6('0x34')](function(_0x5a3bbb){var _0x1571cc=_['find'](_0x436264,['id',_0x5a3bbb['id']]);if(_0x1571cc)_[_0x18e6('0x3a')](_0x5a3bbb,_[_0x18e6('0xa0')](_[_0x18e6('0xa1')](_0x1571cc,_0x365da6),_0x48114a));_0x5a3bbb['globalStatus']=getAgentStatus(_0x5a3bbb);return _0x5a3bbb;});})[_0x18e6('0x14')](function(_0x2a430b){var _0x1da7e2;if(_0x2d9feb['query'][_0x18e6('0xa2')]){_0x1da7e2=_[_0x18e6('0x3b')](_0x2a430b,['globalStatus',_0x2d9feb['query'][_0x18e6('0xa2')]]);if(_0x2d9feb[_0x18e6('0x8d')][_0x18e6('0xa3')]){_0x1da7e2=_[_0x18e6('0x3b')](_0x1da7e2,[_0x18e6('0x70'),_0x2d9feb['query'][_0x18e6('0xa3')]]);}}if(_0x1da7e2)_0x2a430b=_0x1da7e2;if(!_0x1c1f35)return _0x2a430b;return orderAgentsByStatus(_0x2a430b,_0x1c1f35);})['then'](function(_0x4c1e30){_0x2c6534[_0x18e6('0x9f')]=_0x4c1e30;return _0x2c6534;})[_0x18e6('0x14')](respondWithFilteredResult(_0x120a7f,_0x2cb922))[_0x18e6('0x1d')](handleError(_0x120a7f,null));};exports['getQueues']=function(_0x3de6a3,_0x4e8bb8){var _0x93efa5={'count':0x0,'rows':[]},_0x63cb6b={},_0x4416f9,_0x52e171,_0x4c438d,_0xe4f8b5,_0x23b100;Promise[_0x18e6('0x8c')]()['then'](function(){if(_0x3de6a3[_0x18e6('0x8d')]['channel'])_0x4416f9=validateChannel(_0x3de6a3[_0x18e6('0x8d')][_0x18e6('0x8e')]);var _0x45e1bb=_[_0x18e6('0x19')](_0x4416f9)+_0x18e6('0xa4');var _0x3d337e=_['map'](db[_0x45e1bb][_0x18e6('0xa5')],function(_0x48c621){return{'name':_0x48c621[_0x18e6('0x91')],'type':_0x48c621[_0x18e6('0x92')][_0x18e6('0x93')]};});_0x63cb6b=qs[_0x18e6('0x95')](_0x3d337e,_0x3de6a3);if(_0x3de6a3['user']['role']===_0x18e6('0x99')){var _0x158ecf={'params':{'id':_0x3de6a3[_0x18e6('0x99')][_0x18e6('0x9b')]},'query':{'section':_0x4416f9===_0x18e6('0x18')&&_0x3de6a3[_0x18e6('0x8d')][_0x18e6('0x92')]===_0x18e6('0x22')?'QueueCampaigns':_[_0x18e6('0x19')](_0x4416f9)+_0x18e6('0xa6'),'type':_0x3de6a3[_0x18e6('0x8d')][_0x18e6('0x92')],'nolimit':!![],'sort':'name','filter':_0x3de6a3[_0x18e6('0x8d')]['filter']}};return db[_0x18e6('0xa7')]['getResources'](_0x158ecf);}return db[_0x45e1bb][_0x18e6('0x9e')](_0x63cb6b);})[_0x18e6('0x14')](function(_0x11c699){_0x93efa5['count']=_0x11c699[_0x18e6('0xa')];_0x52e171=_0x11c699['rows'];return getRealtimeQueues(_0x3de6a3,_0x4416f9);})[_0x18e6('0x14')](function(_0x4acd2f){_0xe4f8b5=_0x4acd2f[_0x18e6('0x9f')];return getRealtimeAgents();})['then'](function(_0x1f73e0){_0x4c438d=_0x1f73e0[_0x18e6('0x9f')];if(_0x4416f9!='voice')return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x5697f2){_0x23b100=_0x5697f2?_0x5697f2['rows']:[];return initializeQueues(_0x52e171,_0xe4f8b5,_0x4416f9,_0x3de6a3['query'][_0x18e6('0x92')]);})[_0x18e6('0x14')](function(_0x3ab6a5){var _0x22aff4=_0x3ab6a5['map'](function(_0x1a26ce){if(_0x4416f9===_0x18e6('0x18'))return getVoiceQueueAgents(_0x1a26ce,_0x52e171,_0x4c438d,_0x23b100);else return getQueueAgents(_0x1a26ce,_0x4c438d,_0x4416f9);});return Promise['all'](_0x22aff4);})[_0x18e6('0x14')](function(_0x250470){_0x93efa5[_0x18e6('0x9f')]=_0x250470;return _0x93efa5;})[_0x18e6('0x14')](respondWithFilteredResult(_0x4e8bb8,_0x63cb6b))[_0x18e6('0x1d')](handleError(_0x4e8bb8,null));}; \ No newline at end of file +var _0xf717=['omit','globalStatusFilter','pauseTypeFilter','getQueues','fieldName','util','jayson/promise','../../components/parsers/qs','../../config/logger','api','client','http','offset','undefined','count','limit','status','set','Content-Range','json','error','stack','name','send','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','loggedIn','available','waiting','talking','paused','voice','outbound','push','pTalking','message','dialActive','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','get','loggedInDb','originated','pick','filter','busy','some','connectedlinenum','toString','find','getMembers','length','UserId','accountcode','online','voiceStatus','agents','User','Queue','Pause','findAll','startCase','QueueId','idle','unknown','ringing','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','chat','sms','openchannel','whatsapp','includes','toLowerCase','Invalid\x20channel','isArray','findOne','all','flatten','map','uniq','split','fields','globalStatus','order','DESC','ASC','sort','pauseType','getAgents','internal','address','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatus','faxStatus','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','resolve','channel','query','join','globalQueueFilter','rawAttributes','type','key','role','getOptions','raw','where','isEmpty','user','userProfileId','agent','nolimit','UserProfile','getResources','findAndCountAll','rows'];(function(_0x28f922,_0x1302f8){var _0x4eceac=function(_0x2ce5a0){while(--_0x2ce5a0){_0x28f922['push'](_0x28f922['shift']());}};_0x4eceac(++_0x1302f8);}(_0xf717,0x1f1));var _0x7f71=function(_0x30bda,_0x423a72){_0x30bda=_0x30bda-0x0;var _0x595f63=_0xf717[_0x30bda];return _0x595f63;};'use strict';var util=require(_0x7f71('0x0'));var _=require('lodash');var jayson=require(_0x7f71('0x1'));var qs=require(_0x7f71('0x2'));var logger=require(_0x7f71('0x3'))(_0x7f71('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x7f71('0x5')][_0x7f71('0x6')]({'port':0x232a});var routingClient=jayson[_0x7f71('0x5')][_0x7f71('0x6')]({'port':0x232c});function respondWithFilteredResult(_0xf25ff6,_0x5a586d){return function(_0x24b63c){if(_0x24b63c){var _0x5ae720=typeof _0x5a586d[_0x7f71('0x7')]===_0x7f71('0x8')&&typeof _0x5a586d['limit']==='undefined';var _0x3b9e18=_0x24b63c[_0x7f71('0x9')];var _0xba5ec7=_0x5ae720?0x0:_0x5a586d[_0x7f71('0x7')];var _0x414e90=_0x5ae720?_0x24b63c['count']:_0x5a586d[_0x7f71('0x7')]+_0x5a586d[_0x7f71('0xa')];var _0x5cf9eb;if(_0x414e90>=_0x3b9e18){_0x414e90=_0x3b9e18;_0x5cf9eb=0xc8;}else{_0x5cf9eb=0xce;}_0xf25ff6[_0x7f71('0xb')](_0x5cf9eb);return _0xf25ff6[_0x7f71('0xc')](_0x7f71('0xd'),_0xba5ec7+'-'+_0x414e90+'/'+_0x3b9e18)[_0x7f71('0xe')](_0x24b63c);}return null;};}function handleError(_0x49fac2,_0x3fde87){_0x3fde87=_0x3fde87||0x1f4;return function(_0x3dfb58){logger[_0x7f71('0xf')](_0x3dfb58[_0x7f71('0x10')]);if(_0x3dfb58[_0x7f71('0x11')]){delete _0x3dfb58[_0x7f71('0x11')];}_0x49fac2[_0x7f71('0xb')](_0x3fde87)[_0x7f71('0x12')](_0x3dfb58);};}function getRealtimeAgents(){return new Promise(function(_0x50c660,_0x43d43f){return amiClient['request'](_0x7f71('0x13'),{})[_0x7f71('0x14')](function(_0x26cdc0){if(_0x26cdc0['error'])throw new Error(_0x7f71('0x15'));var _0x3cd9e5=_0x26cdc0[_0x7f71('0x16')];return routingClient[_0x7f71('0x17')](_0x7f71('0x13'),{})['then'](function(_0x7d0d14){if(_0x7d0d14['error'])throw new Error(_0x7f71('0x18'));var _0x60d6a7=_0x7d0d14[_0x7f71('0x16')];return _0x50c660(_[_0x7f71('0x19')]({},_0x3cd9e5,_0x60d6a7));});})[_0x7f71('0x1a')](function(_0x28579a){_0x43d43f(_0x28579a);});});}function getRealtimeQueues(_0x1f79dc,_0x4e511d){return new Promise(function(_0x59b3c9,_0x3218cd){var _0x4aacef=_0x4e511d==='voice'?amiClient:routingClient;return _0x4aacef['request'](_['startCase'](_0x4e511d)+_0x7f71('0x1b'),_0x1f79dc)[_0x7f71('0x14')](function(_0x1d5a06){if(_0x1d5a06[_0x7f71('0xf')])throw new Error(util['format'](_0x7f71('0x1c'),_0x4e511d));return _0x59b3c9(_0x1d5a06[_0x7f71('0x16')]);})[_0x7f71('0x1a')](function(_0x4d6fcf){_0x3218cd(_0x4d6fcf);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x240e77,_0x37fc8b){return amiClient['request'](_0x7f71('0x1d'),{})[_0x7f71('0x14')](function(_0x225abb){if(_0x225abb[_0x7f71('0xf')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x240e77(_0x225abb['result']);})[_0x7f71('0x1a')](function(_0x10b2a2){_0x37fc8b(_0x10b2a2);});});}function initializeQueues(_0x41d253,_0x59ed80,_0x1a6b39,_0x293a88){var _0x27b38a=[_0x7f71('0x1e'),_0x7f71('0x1f'),_0x7f71('0x20'),_0x7f71('0x21'),_0x7f71('0x22')];if(_0x1a6b39===_0x7f71('0x23')&&_0x293a88===_0x7f71('0x24')){_0x27b38a[_0x7f71('0x25')](_0x7f71('0x26'),'originated',_0x7f71('0x27'),_0x7f71('0x28'),_0x7f71('0x29'),'Trunk','startPredictive',_0x7f71('0x2a'),_0x7f71('0x2b'),_0x7f71('0x2c'),_0x7f71('0x2d'),_0x7f71('0x2e'),'dialPredictiveInterval',_0x7f71('0x2f'),_0x7f71('0x30'),_0x7f71('0x31'),_0x7f71('0x32'),_0x7f71('0x33'),_0x7f71('0x34'),'predictiveIntervalDroppedCallsCallersExit',_0x7f71('0x35'),'predictiveIntervalAvgTalktime');}return _0x41d253['map'](function(_0x396436){var _0x71350d=_0x396436[_0x7f71('0x36')]({'plain':!![]});_0x71350d['agents']=[];_0x71350d['paused']=0x0;_0x71350d[_0x7f71('0x37')]=0x0;_0x71350d[_0x7f71('0x1e')]=0x0;_0x71350d[_0x7f71('0x1f')]=0x0;_0x71350d['waiting']=0x0;if(_0x1a6b39==='voice'){_0x71350d[_0x7f71('0x21')]=0x0;_0x71350d['busy']=0x0;if(_0x293a88==='outbound'){_0x71350d[_0x7f71('0x26')]=0x0;_0x71350d[_0x7f71('0x38')]=0x0;}}var _0x3444a0=_['find'](_0x59ed80,['id',_0x71350d['id']]);if(_0x3444a0)_[_0x7f71('0x19')](_0x71350d,_[_0x7f71('0x39')](_0x3444a0,_0x27b38a));return _0x71350d;});}function updateAgentVoiceStatus(_0x3147ea,_0x2a2933,_0x3b89dc){var _0x5272e4=_[_0x7f71('0x3a')](_0x3b89dc,['queue',_0x2a2933[_0x7f71('0x11')]]);if(_0x5272e4['length']===0x0)return _0x3147ea[_0x7f71('0x3b')]=!![];if(_[_0x7f71('0x3c')](_0x5272e4,[_0x7f71('0x3d'),_0x3147ea['internal'][_0x7f71('0x3e')]()]))return _0x3147ea['talking']=!![];if(!_0x3147ea['talking'])return _0x3147ea['busy']=!![];}function getVoiceQueueAgents(_0x3e2c40,_0x2b4143,_0x1c0c13,_0x54da22){var _0x1c3e24=_[_0x7f71('0x3f')](_0x2b4143,['id',_0x3e2c40['id']]);if(!_0x1c3e24)return _0x3e2c40;return _0x1c3e24[_0x7f71('0x40')]({'raw':!![]})[_0x7f71('0x14')](function(_0x15c723){for(var _0x6723f3=0x0;_0x6723f3<_0x15c723[_0x7f71('0x41')];_0x6723f3++){var _0x3242c7=_[_0x7f71('0x3f')](_0x1c0c13,['id',_0x15c723[_0x6723f3][_0x7f71('0x42')]]);if(!_0x3242c7){_0x3242c7={'id':_0x15c723[_0x6723f3]['UserId'],'name':_0x15c723[_0x6723f3][_0x7f71('0x42')],'accountcode':'','online':![]};}var _0x5e7c0d={'id':_0x3242c7['id'],'name':_0x3242c7[_0x7f71('0x11')],'internal':_0x3242c7[_0x7f71('0x43')],'online':Boolean(_0x3242c7[_0x7f71('0x44')]),'paused':Boolean(_0x15c723[_0x6723f3]['paused'])};if(_0x3242c7[_0x7f71('0x45')]===_0x7f71('0x21'))updateAgentVoiceStatus(_0x5e7c0d,_0x3e2c40,_0x54da22);if(_0x5e7c0d[_0x7f71('0x44')])_0x3e2c40[_0x7f71('0x37')]++;if(_0x5e7c0d['busy'])_0x3e2c40[_0x7f71('0x3b')]++;if(_0x5e7c0d[_0x7f71('0x22')]&&!_0x5e7c0d['busy']&&!_0x5e7c0d[_0x7f71('0x21')])_0x3e2c40[_0x7f71('0x22')]++;_0x3e2c40[_0x7f71('0x46')]['push'](_0x5e7c0d);}return _0x3e2c40;});}function getQueueAgents(_0x4ca926,_0x518a92,_0x31002a){var _0x173dc8=_0x7f71('0x47')+_['startCase'](_0x31002a)+_0x7f71('0x48');var _0x394c2c=_0x31002a+_0x7f71('0x49');return db[_0x173dc8][_0x7f71('0x4a')]({'where':{[_[_0x7f71('0x4b')](_0x31002a)+_0x7f71('0x4c')]:_0x4ca926['id']},'raw':!![]})[_0x7f71('0x14')](function(_0x5f00d9){for(var _0x12d0a0=0x0;_0x12d0a0<_0x5f00d9[_0x7f71('0x41')];_0x12d0a0++){var _0x427d0e=_[_0x7f71('0x3f')](_0x518a92,['id',_0x5f00d9[_0x12d0a0][_0x7f71('0x42')]]);if(!_0x427d0e){_0x427d0e={'id':_0x5f00d9[_0x12d0a0][_0x7f71('0x42')],'name':_0x5f00d9[_0x12d0a0][_0x7f71('0x42')],'online':![],['pauseField']:![]};}var _0x1a645f={'id':_0x427d0e['id'],'name':_0x427d0e[_0x7f71('0x11')],'online':Boolean(_0x427d0e[_0x7f71('0x44')]),'paused':Boolean(_0x427d0e[_0x394c2c])};if(_0x1a645f['online'])_0x4ca926[_0x7f71('0x37')]++;_0x4ca926[_0x7f71('0x46')][_0x7f71('0x25')](_0x1a645f);}return _0x4ca926;});}function isIdle(_0x1b83ce){return _0x1b83ce===_0x7f71('0x4d')||_0x1b83ce===_0x7f71('0x4e')||_0x1b83ce==='unavailable'||_0x1b83ce===_0x7f71('0x4f')||_[_0x7f71('0x50')](_0x1b83ce);}function isAgentPaused(_0x596d95,_0x550a0a){var _0x444489=[_0x596d95[_0x7f71('0x51')],_0x596d95[_0x7f71('0x52')],_0x596d95[_0x7f71('0x53')],_0x596d95[_0x7f71('0x54')],_0x596d95[_0x7f71('0x55')],_0x596d95[_0x7f71('0x56')],_0x596d95[_0x7f71('0x57')]];if(!_0x550a0a)return _[_0x7f71('0x58')](_0x444489);var _0x19b337=_[_0x7f71('0x3a')](_0x444489);return _0x19b337[_0x7f71('0x41')]>0x0&&_0x19b337[_0x7f71('0x41')]<_0x444489['length']?!![]:![];}function isAgentIdle(_0x2a9ea8){if(_0x2a9ea8[_0x7f71('0x45')]!==_0x7f71('0x4d')&&_0x2a9ea8[_0x7f71('0x56')]){_0x2a9ea8[_0x7f71('0x45')]=_0x7f71('0x59');return![];}return _[_0x7f71('0x58')]([_0x2a9ea8['chatStatus'],_0x2a9ea8['faxStatus'],_0x2a9ea8[_0x7f71('0x5a')],_0x2a9ea8[_0x7f71('0x5b')],_0x2a9ea8[_0x7f71('0x5c')],_0x2a9ea8[_0x7f71('0x45')],_0x2a9ea8[_0x7f71('0x5d')]],isIdle);}function getAgentStatus(_0x2e348e){var _0x584e41=_0x7f71('0x4e');if(isAgentPaused(_0x2e348e))_0x584e41=_0x7f71('0x59');else if(isAgentPaused(_0x2e348e,!![]))_0x584e41=_0x7f71('0x5e');else if(isAgentIdle(_0x2e348e))_0x584e41=_0x7f71('0x4d');else _0x584e41=_0x7f71('0x3b');return _0x584e41;}function validateChannel(_0x855f73){var _0x37e61c=['mail',_0x7f71('0x5f'),_0x7f71('0x60'),_0x7f71('0x61'),'fax',_0x7f71('0x62'),_0x7f71('0x23')];if(!_[_0x7f71('0x63')](_0x37e61c,_0x855f73[_0x7f71('0x64')]()))throw new Error(_0x7f71('0x65'));return _0x855f73[_0x7f71('0x64')]();}function getFilteredAgentIds(_0x1b9820,_0x14c7f5){var _0x581efe=_[_0x7f71('0x66')](_0x1b9820)?_0x1b9820:[_0x1b9820];var _0xdd2efc=_['map'](_0x581efe,function(_0x15930b){return db[_0x14c7f5][_0x7f71('0x67')]({'where':{'name':_0x15930b}})['then'](function(_0x269df6){if(!_0x269df6)return[];return _0x269df6['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x7f71('0x68')](_0xdd2efc)['then'](function(_0x1e9833){var _0x49b3f1=_(_0x1e9833)[_0x7f71('0x69')]()[_0x7f71('0x6a')]('id')[_0x7f71('0x6b')]()['value']();return _0x49b3f1;});}function getUpdatedSortOptions(_0x3fc9f1){var _0x573202={'fields':[],'order':null};var _0x77649d=_0x3fc9f1[_0x7f71('0x6c')](',');_0x573202[_0x7f71('0x6d')]=_[_0x7f71('0x3a')](_0x77649d,function(_0x41c865){if(!_0x41c865['includes'](_0x7f71('0x6e')))return!![];_0x573202[_0x7f71('0x6f')]=_['startsWith'](_0x41c865,'-')?_0x7f71('0x70'):_0x7f71('0x71');return![];});return _0x573202;}function orderAgentsByStatus(_0x3e6ddb,_0x37a67f){return _0x3e6ddb[_0x7f71('0x72')](function(_0x233568,_0xce3fa2){if(_0x233568[_0x7f71('0x6e')]===_0xce3fa2[_0x7f71('0x6e')]&&_0x233568[_0x7f71('0x6e')]===_0x7f71('0x59')){if(_0x37a67f==='DESC')return(_0x233568[_0x7f71('0x73')]||'')<(_0xce3fa2[_0x7f71('0x73')]||'')?0x1:-0x1;return _0x233568['pauseType']<_0xce3fa2[_0x7f71('0x73')]?-0x1:0x1;}else{if(_0x37a67f===_0x7f71('0x70'))return _0x233568[_0x7f71('0x6e')]<_0xce3fa2[_0x7f71('0x6e')]?0x1:-0x1;return _0x233568['globalStatus']<_0xce3fa2[_0x7f71('0x6e')]?-0x1:0x1;}});}exports[_0x7f71('0x74')]=function(_0x43bd3d,_0x9f682a){var _0x13c52f={'count':0x0,'rows':[]},_0xc6f93d={},_0x590a82,_0x267f16,_0x2e7a8a,_0x2881fa,_0x8c436e=['userpic',_0x7f71('0x44'),'lastLoginAt','lastPauseAt','pauseType','lastPauseAt',_0x7f71('0x75'),_0x7f71('0x76'),'chatPause',_0x7f71('0x54'),_0x7f71('0x53'),_0x7f71('0x55'),_0x7f71('0x57'),'faxPause',_0x7f71('0x56'),'chatCapacity',_0x7f71('0x77'),'mailCapacity',_0x7f71('0x78'),_0x7f71('0x79'),_0x7f71('0x7a'),_0x7f71('0x7b'),_0x7f71('0x7c'),'mailCurrentCapacity',_0x7f71('0x7d'),'whatsappCurrentCapacity',_0x7f71('0x7e'),_0x7f71('0x7f'),_0x7f71('0x5b'),_0x7f71('0x5a'),'smsStatus',_0x7f71('0x5d'),_0x7f71('0x80'),_0x7f71('0x45'),'chatStatusTime',_0x7f71('0x81'),_0x7f71('0x82'),'smsStatusTime',_0x7f71('0x83'),_0x7f71('0x84'),_0x7f71('0x85'),_0x7f71('0x86'),'destconnectedlinenum',_0x7f71('0x87'),_0x7f71('0x88'),'phoneBarEnableAutomaticScreenRecording',_0x7f71('0x89')],_0x480514=[_0x7f71('0x51'),_0x7f71('0x54'),_0x7f71('0x53'),_0x7f71('0x55'),_0x7f71('0x57'),_0x7f71('0x52'),_0x7f71('0x56'),_0x7f71('0x44')];Promise[_0x7f71('0x8a')]()['then'](function(){if(_0x43bd3d['query'][_0x7f71('0x8b')])_0x590a82=validateChannel(_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0x8b')]);if(!_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0x72')]||!_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0x72')][_0x7f71('0x63')](_0x7f71('0x6e')))return;var _0x59a5c8=getUpdatedSortOptions(_0x43bd3d['query']['sort']);_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0x72')]=_0x59a5c8[_0x7f71('0x6d')][_0x7f71('0x8d')](',');_0x267f16=_0x59a5c8[_0x7f71('0x6f')];})[_0x7f71('0x14')](function(){if(!_0x43bd3d[_0x7f71('0x8c')]['globalQueueFilter'])return[];var _0x4cd756=_[_0x7f71('0x4b')](_0x590a82)+_0x7f71('0x48');return getFilteredAgentIds(_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0x8e')],_0x4cd756);})['then'](function(_0x5cf694){var _0x1fbdfb=_[_0x7f71('0x6a')](db[_0x7f71('0x47')][_0x7f71('0x8f')],function(_0xc73af){return{'name':_0xc73af['fieldName'],'type':_0xc73af[_0x7f71('0x90')][_0x7f71('0x91')]};});_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0x92')]='agent';_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0x44')]=!![];_0xc6f93d=qs[_0x7f71('0x93')](_0x1fbdfb,_0x43bd3d);_0xc6f93d[_0x7f71('0x94')]=!![];if(!_['isEmpty'](_0x5cf694)){_0xc6f93d[_0x7f71('0x95')]=_[_0x7f71('0x19')](_0xc6f93d[_0x7f71('0x95')],{'$and':[{'id':{'$in':_0x5cf694}}]});}else if(!_[_0x7f71('0x96')](_0x43bd3d[_0x7f71('0x8c')]['globalQueueFilter'])){return _0x13c52f;}if(_0x43bd3d[_0x7f71('0x97')][_0x7f71('0x92')]===_0x7f71('0x97')){var _0x10f827={'params':{'id':_0x43bd3d['user'][_0x7f71('0x98')]},'query':{'section':'Agents','role':_0x7f71('0x99'),'online':!![],'nolimit':_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0x9a')],'sort':_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0x72')],'filter':_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0x3a')],'raw':!![],'ids':_0x5cf694}};return db[_0x7f71('0x9b')][_0x7f71('0x9c')](_0x10f827);}return db[_0x7f71('0x47')][_0x7f71('0x9d')](_0xc6f93d);})[_0x7f71('0x14')](function(_0x481733){_0x13c52f[_0x7f71('0x9')]=_0x481733['count'];_0x2e7a8a=_0x481733[_0x7f71('0x9e')];return getRealtimeAgents();})[_0x7f71('0x14')](function(_0x30cca4){_0x2881fa=_0x30cca4[_0x7f71('0x9e')];return _0x2e7a8a['map'](function(_0x1079a7){var _0x2dc755=_[_0x7f71('0x3f')](_0x2881fa,['id',_0x1079a7['id']]);if(_0x2dc755)_[_0x7f71('0x19')](_0x1079a7,_[_0x7f71('0x39')](_[_0x7f71('0x9f')](_0x2dc755,_0x480514),_0x8c436e));_0x1079a7[_0x7f71('0x6e')]=getAgentStatus(_0x1079a7);return _0x1079a7;});})[_0x7f71('0x14')](function(_0x1a950f){var _0x54d4e7;if(_0x43bd3d[_0x7f71('0x8c')]['globalStatusFilter']){_0x54d4e7=_['filter'](_0x1a950f,[_0x7f71('0x6e'),_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0xa0')]]);if(_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0xa1')]){_0x54d4e7=_[_0x7f71('0x3a')](_0x54d4e7,[_0x7f71('0x73'),_0x43bd3d[_0x7f71('0x8c')][_0x7f71('0xa1')]]);}}if(_0x54d4e7)_0x1a950f=_0x54d4e7;if(!_0x267f16)return _0x1a950f;return orderAgentsByStatus(_0x1a950f,_0x267f16);})[_0x7f71('0x14')](function(_0x21a10f){_0x13c52f[_0x7f71('0x9e')]=_0x21a10f;return _0x13c52f;})[_0x7f71('0x14')](respondWithFilteredResult(_0x9f682a,_0xc6f93d))[_0x7f71('0x1a')](handleError(_0x9f682a,null));};exports[_0x7f71('0xa2')]=function(_0x30e82b,_0x25279a){var _0x1fc989={'count':0x0,'rows':[]},_0xfe7af7={},_0x6f0ae6,_0x318f69,_0x1d99e7,_0x1b9fe5,_0x5a8525;Promise[_0x7f71('0x8a')]()['then'](function(){if(_0x30e82b[_0x7f71('0x8c')][_0x7f71('0x8b')])_0x6f0ae6=validateChannel(_0x30e82b[_0x7f71('0x8c')][_0x7f71('0x8b')]);var _0x6eb16d=_[_0x7f71('0x4b')](_0x6f0ae6)+_0x7f71('0x48');var _0x95ed51=_[_0x7f71('0x6a')](db[_0x6eb16d][_0x7f71('0x8f')],function(_0x44f90f){return{'name':_0x44f90f[_0x7f71('0xa3')],'type':_0x44f90f[_0x7f71('0x90')][_0x7f71('0x91')]};});_0xfe7af7=qs[_0x7f71('0x93')](_0x95ed51,_0x30e82b);if(_0x30e82b[_0x7f71('0x97')][_0x7f71('0x92')]===_0x7f71('0x97')){var _0x359a9d={'params':{'id':_0x30e82b[_0x7f71('0x97')][_0x7f71('0x98')]},'query':{'section':_0x6f0ae6===_0x7f71('0x23')&&_0x30e82b[_0x7f71('0x8c')]['type']===_0x7f71('0x24')?'QueueCampaigns':_[_0x7f71('0x4b')](_0x6f0ae6)+'Queues','type':_0x30e82b[_0x7f71('0x8c')]['type'],'nolimit':!![],'sort':_0x7f71('0x11'),'filter':_0x30e82b['query'][_0x7f71('0x3a')]}};return db['UserProfile'][_0x7f71('0x9c')](_0x359a9d);}return db[_0x6eb16d][_0x7f71('0x9d')](_0xfe7af7);})[_0x7f71('0x14')](function(_0x2d3589){_0x1fc989[_0x7f71('0x9')]=_0x2d3589[_0x7f71('0x9')];_0x318f69=_0x2d3589[_0x7f71('0x9e')];return getRealtimeQueues(_0x30e82b,_0x6f0ae6);})[_0x7f71('0x14')](function(_0x11e591){_0x1b9fe5=_0x11e591['rows'];return getRealtimeAgents();})[_0x7f71('0x14')](function(_0x4c8ad3){_0x1d99e7=_0x4c8ad3[_0x7f71('0x9e')];if(_0x6f0ae6!=_0x7f71('0x23'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x2c8a87){_0x5a8525=_0x2c8a87?_0x2c8a87[_0x7f71('0x9e')]:[];return initializeQueues(_0x318f69,_0x1b9fe5,_0x6f0ae6,_0x30e82b[_0x7f71('0x8c')][_0x7f71('0x90')]);})[_0x7f71('0x14')](function(_0x4c01c0){var _0x4d18d7=_0x4c01c0[_0x7f71('0x6a')](function(_0x220b15){if(_0x6f0ae6===_0x7f71('0x23'))return getVoiceQueueAgents(_0x220b15,_0x318f69,_0x1d99e7,_0x5a8525);else return getQueueAgents(_0x220b15,_0x1d99e7,_0x6f0ae6);});return Promise[_0x7f71('0x68')](_0x4d18d7);})[_0x7f71('0x14')](function(_0x15f35d){_0x1fc989[_0x7f71('0x9e')]=_0x15f35d;return _0x1fc989;})[_0x7f71('0x14')](respondWithFilteredResult(_0x25279a,_0xfe7af7))[_0x7f71('0x1a')](handleError(_0x25279a,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 6a5c0d5..d5254b2 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3108ca,_0xb853be){var _0x493305=function(_0x472101){while(--_0x472101){_0x3108ca['push'](_0x3108ca['shift']());}};_0x493305(++_0xb853be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x32c9b9,_0x1f69cf){var _0x2ff56c=function(_0x5d2d4d){while(--_0x5d2d4d){_0x32c9b9['push'](_0x32c9b9['shift']());}};_0x2ff56c(++_0x1f69cf);}(_0xe706,0xa3));var _0x6e70=function(_0x37bf65,_0x220141){_0x37bf65=_0x37bf65-0x0;var _0x45a736=_0xe706[_0x37bf65];return _0x45a736;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ec2d3e5..9b81d05 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 _0x423b=['STRING','exports'];(function(_0x1f7e2a,_0x4c7d0c){var _0xb8bf77=function(_0x30b9cb){while(--_0x30b9cb){_0x1f7e2a['push'](_0x1f7e2a['shift']());}};_0xb8bf77(++_0x4c7d0c);}(_0x423b,0x12b));var _0xb423=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x423b[_0x1762b4];return _0x29beda;};'use strict';var Sequelize=require('sequelize');module[_0xb423('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb423('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xb423('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb423('0x1')]},'campaigntype':{'type':Sequelize[_0xb423('0x1')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4745=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4745,0x1e7));var _0x5474=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x4745[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x5474('0x0'));module[_0x5474('0x1')]={'state':{'type':Sequelize[_0x5474('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5474('0x3')]},'scheduledat':{'type':Sequelize[_0x5474('0x4')]},'uniqueid':{'type':Sequelize[_0x5474('0x3')]},'starttime':{'type':Sequelize[_0x5474('0x4')]},'responsetime':{'type':Sequelize[_0x5474('0x4')]},'ringtime':{'type':Sequelize[_0x5474('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5474('0x3')]},'campaigntype':{'type':Sequelize[_0x5474('0x3')]},'membername':{'type':Sequelize[_0x5474('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index bc4d983..602020e 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 _0x7d92=['moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','../../config/logger','api'];(function(_0x3757c1,_0x37c2c0){var _0x5e13a7=function(_0x3dfb3f){while(--_0x3dfb3f){_0x3757c1['push'](_0x3757c1['shift']());}};_0x5e13a7(++_0x37c2c0);}(_0x7d92,0x1d7));var _0x27d9=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x7d92[_0x288f5e];return _0x476cc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x27d9('0x0'))(_0x27d9('0x1'));var moment=require(_0x27d9('0x2'));var BPromise=require(_0x27d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27d9('0x4'));var rimraf=require(_0x27d9('0x5'));var config=require(_0x27d9('0x6'));var attributes=require(_0x27d9('0x7'));module['exports']=function(_0x2f1e17,_0xd969be){return _0x2f1e17[_0x27d9('0x8')](_0x27d9('0x9'),attributes,{'tableName':_0x27d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb40=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview'];(function(_0x5a77fb,_0x2d2d59){var _0x6ca4fb=function(_0x428777){while(--_0x428777){_0x5a77fb['push'](_0x5a77fb['shift']());}};_0x6ca4fb(++_0x2d2d59);}(_0xfb40,0xf2));var _0x0fb4=function(_0x55ce75,_0x120a6d){_0x55ce75=_0x55ce75-0x0;var _0x128663=_0xfb40[_0x55ce75];return _0x128663;};'use strict';var _=require('lodash');var util=require(_0x0fb4('0x0'));var logger=require(_0x0fb4('0x1'))(_0x0fb4('0x2'));var moment=require('moment');var BPromise=require(_0x0fb4('0x3'));var rp=require(_0x0fb4('0x4'));var fs=require('fs');var path=require(_0x0fb4('0x5'));var rimraf=require(_0x0fb4('0x6'));var config=require('../../config/environment');var attributes=require(_0x0fb4('0x7'));module['exports']=function(_0x887c42,_0x5f3c03){return _0x887c42[_0x0fb4('0x8')](_0x0fb4('0x9'),attributes,{'tableName':_0x0fb4('0xa'),'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 3de82e2..cb80fd6 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 _0x7622=['then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateReportAgentPreview','create','body','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x105d5b,_0xc1441){var _0x5d36a4=function(_0x20f018){while(--_0x20f018){_0x105d5b['push'](_0x105d5b['shift']());}};_0x5d36a4(++_0xc1441);}(_0x7622,0x132));var _0x2762=function(_0x49894c,_0x4f01f5){_0x49894c=_0x49894c-0x0;var _0x2aa221=_0x7622[_0x49894c];return _0x2aa221;};'use strict';var _=require(_0x2762('0x0'));var util=require(_0x2762('0x1'));var moment=require(_0x2762('0x2'));var BPromise=require('bluebird');var rs=require(_0x2762('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2762('0x4'))['db'];var utils=require(_0x2762('0x5'));var logger=require(_0x2762('0x6'))(_0x2762('0x7'));var config=require(_0x2762('0x8'));var jayson=require(_0x2762('0x9'));var client=jayson[_0x2762('0xa')][_0x2762('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40509a,_0x132c88,_0x46ba5b){return new BPromise(function(_0x83508e,_0x4369e3){return client[_0x2762('0xc')](_0x40509a,_0x46ba5b)[_0x2762('0xd')](function(_0x158274){logger[_0x2762('0xe')](_0x2762('0xf'),_0x132c88,'request\x20sent');logger[_0x2762('0x10')](_0x2762('0x11'),_0x132c88,_0x2762('0x12'),JSON[_0x2762('0x13')](_0x158274));if(_0x158274[_0x2762('0x14')]){if(_0x158274[_0x2762('0x14')]['code']===0x1f4){logger['error'](_0x2762('0xf'),_0x132c88,_0x158274['error'][_0x2762('0x15')]);return _0x4369e3(_0x158274[_0x2762('0x14')][_0x2762('0x15')]);}logger[_0x2762('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x132c88,_0x158274[_0x2762('0x14')]['message']);return _0x83508e(_0x158274[_0x2762('0x14')][_0x2762('0x15')]);}else{logger['info'](_0x2762('0xf'),_0x132c88,_0x2762('0x12'));_0x83508e(_0x158274[_0x2762('0x16')][_0x2762('0x15')]);}})[_0x2762('0x17')](function(_0x4de5f8){logger[_0x2762('0x14')](_0x2762('0xf'),_0x132c88,_0x4de5f8);_0x4369e3(_0x4de5f8);});});}exports[_0x2762('0x18')]=function(_0x5ada02){var _0xa5e55f=this;return new Promise(function(_0x282628,_0x55c317){return db['ReportAgentPreview'][_0x2762('0x19')](_0x5ada02[_0x2762('0x1a')],{'raw':_0x5ada02[_0x2762('0x1b')]?_0x5ada02[_0x2762('0x1b')][_0x2762('0x1c')]===undefined?!![]:![]:!![]})[_0x2762('0xd')](function(_0x2439ab){logger[_0x2762('0xe')](_0x2762('0x18'),_0x5ada02);logger[_0x2762('0x10')](_0x2762('0x18'),_0x5ada02,JSON['stringify'](_0x2439ab));_0x282628(_0x2439ab);})[_0x2762('0x17')](function(_0x3fa59c){logger[_0x2762('0x14')](_0x2762('0x18'),_0x3fa59c['message'],_0x5ada02);_0x55c317(_0xa5e55f['error'](0x1f4,_0x3fa59c[_0x2762('0x15')]));});});}; \ No newline at end of file +var _0xf15e=['info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','catch','ReportAgentPreview','create','body','options','raw','then','CreateReportAgentPreview','stringify','util','moment','bluebird','randomstring','rpc','../../config/environment','client','http','request'];(function(_0x32b7a8,_0xf45ef7){var _0x1cf13d=function(_0x14c7eb){while(--_0x14c7eb){_0x32b7a8['push'](_0x32b7a8['shift']());}};_0x1cf13d(++_0xf45ef7);}(_0xf15e,0x1e5));var _0xef15=function(_0x1e35d3,_0x39be18){_0x1e35d3=_0x1e35d3-0x0;var _0x32bfb1=_0xf15e[_0x1e35d3];return _0x32bfb1;};'use strict';var _=require('lodash');var util=require(_0xef15('0x0'));var moment=require(_0xef15('0x1'));var BPromise=require(_0xef15('0x2'));var rs=require(_0xef15('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xef15('0x4'));var config=require(_0xef15('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xef15('0x6')][_0xef15('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x368d8b,_0x40d7b3,_0x55ceee){return new BPromise(function(_0x4370fd,_0x11e8ab){return client[_0xef15('0x8')](_0x368d8b,_0x55ceee)['then'](function(_0x216167){logger[_0xef15('0x9')](_0xef15('0xa'),_0x40d7b3,_0xef15('0xb'));logger[_0xef15('0xc')](_0xef15('0xd'),_0x40d7b3,'request\x20sent',JSON['stringify'](_0x216167));if(_0x216167[_0xef15('0xe')]){if(_0x216167[_0xef15('0xe')][_0xef15('0xf')]===0x1f4){logger[_0xef15('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x40d7b3,_0x216167['error'][_0xef15('0x10')]);return _0x11e8ab(_0x216167[_0xef15('0xe')][_0xef15('0x10')]);}logger[_0xef15('0xe')](_0xef15('0xa'),_0x40d7b3,_0x216167['error'][_0xef15('0x10')]);return _0x4370fd(_0x216167['error']['message']);}else{logger[_0xef15('0x9')](_0xef15('0xa'),_0x40d7b3,_0xef15('0xb'));_0x4370fd(_0x216167['result'][_0xef15('0x10')]);}})[_0xef15('0x11')](function(_0x3541f2){logger[_0xef15('0xe')](_0xef15('0xa'),_0x40d7b3,_0x3541f2);_0x11e8ab(_0x3541f2);});});}exports['CreateReportAgentPreview']=function(_0x241059){var _0xc105a4=this;return new Promise(function(_0x4a76f3,_0x3e8c15){return db[_0xef15('0x12')][_0xef15('0x13')](_0x241059[_0xef15('0x14')],{'raw':_0x241059[_0xef15('0x15')]?_0x241059['options'][_0xef15('0x16')]===undefined?!![]:![]:!![]})[_0xef15('0x17')](function(_0xa40884){logger[_0xef15('0x9')](_0xef15('0x18'),_0x241059);logger[_0xef15('0xc')](_0xef15('0x18'),_0x241059,JSON[_0xef15('0x19')](_0xa40884));_0x4a76f3(_0xa40884);})['catch'](function(_0x39d9cb){logger[_0xef15('0xe')](_0xef15('0x18'),_0x39d9cb[_0xef15('0x10')],_0x241059);_0x3e8c15(_0xc105a4[_0xef15('0xe')](0x1f4,_0x39d9cb[_0xef15('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b471b7b..973b117 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 _0xe695=['openchannelQueuesWaitingInteractions','/fax/queues/waitinginteractions','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions'];(function(_0x4b3442,_0x18576b){var _0x347e03=function(_0x21e76b){while(--_0x21e76b){_0x4b3442['push'](_0x4b3442['shift']());}};_0x347e03(++_0x18576b);}(_0xe695,0x19d));var _0x5e69=function(_0x281d91,_0x6a5c03){_0x281d91=_0x281d91-0x0;var _0x36ba6c=_0xe695[_0x281d91];return _0x36ba6c;};'use strict';var multer=require(_0x5e69('0x0'));var util=require(_0x5e69('0x1'));var path=require(_0x5e69('0x2'));var express=require(_0x5e69('0x3'));var router=express[_0x5e69('0x4')]();var auth=require(_0x5e69('0x5'));var controller=require(_0x5e69('0x6'));router['get'](_0x5e69('0x7'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x9')]);router[_0x5e69('0xa')](_0x5e69('0xb'),auth['isAuthenticated'](),controller[_0x5e69('0xc')]);router['get'](_0x5e69('0xd'),auth[_0x5e69('0x8')](),controller[_0x5e69('0xe')]);router[_0x5e69('0xa')](_0x5e69('0xf'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x10')]);router['get'](_0x5e69('0x11'),auth[_0x5e69('0x8')](),controller['chatQueues']);router['get'](_0x5e69('0x12'),auth['isAuthenticated'](),controller['mailQueues']);router[_0x5e69('0xa')](_0x5e69('0x13'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x14')]);router[_0x5e69('0xa')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x5e69('0x15')]);router[_0x5e69('0xa')](_0x5e69('0x16'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x5e69('0xa')](_0x5e69('0x17'),auth['isAuthenticated'](),controller[_0x5e69('0x18')]);router[_0x5e69('0xa')](_0x5e69('0x19'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x1a')]);router[_0x5e69('0xa')](_0x5e69('0x1b'),auth['isAuthenticated'](),controller[_0x5e69('0x1c')]);router[_0x5e69('0xa')](_0x5e69('0x1d'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x1e')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x5e69('0x8')](),controller[_0x5e69('0x1f')]);router['get'](_0x5e69('0x20'),auth[_0x5e69('0x8')](),controller['voiceQueuesChannelHangup']);router['get'](_0x5e69('0x21'),auth[_0x5e69('0x8')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x5e69('0x22'),auth[_0x5e69('0x8')](),controller['showVoiceQueues']);router['put']('/voice/queues/:id',auth[_0x5e69('0x8')](),controller[_0x5e69('0x23')]);router[_0x5e69('0xa')](_0x5e69('0x24'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x25')]);router['get'](_0x5e69('0x26'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x27')]);router[_0x5e69('0xa')](_0x5e69('0x28'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x29')]);router[_0x5e69('0x2a')]('/agents/:id/capacity',auth[_0x5e69('0x8')](),controller[_0x5e69('0x2b')]);router[_0x5e69('0xa')](_0x5e69('0x2c'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x2d')]);router[_0x5e69('0xa')](_0x5e69('0x2e'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x2f')]);router[_0x5e69('0xa')](_0x5e69('0x30'),auth['isAuthenticated'](),controller[_0x5e69('0x31')]);router[_0x5e69('0xa')](_0x5e69('0x32'),auth[_0x5e69('0x8')](),controller['faxAccounts']);router[_0x5e69('0xa')](_0x5e69('0x33'),auth['isAuthenticated'](),controller[_0x5e69('0x34')]);router[_0x5e69('0xa')](_0x5e69('0x35'),auth['isAuthenticated'](),controller[_0x5e69('0x36')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x5e69('0x8')](),controller[_0x5e69('0x37')]);router[_0x5e69('0xa')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x5e69('0xa')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x5e69('0xa')]('/whatsapp/queues/waitinginteractions',auth[_0x5e69('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0x5e69('0xa')](_0x5e69('0x38'),auth[_0x5e69('0x8')](),controller['faxQueuesWaitingInteractions']);router['post']('/mail/queues/:id/notify',auth[_0x5e69('0x8')](),controller[_0x5e69('0x39')](_0x5e69('0x3a')));router[_0x5e69('0xa')](_0x5e69('0x3b'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x3c')]);router[_0x5e69('0x3d')](_0x5e69('0x3e'),auth['isAuthenticated'](),controller[_0x5e69('0x39')](_0x5e69('0x3f')));router[_0x5e69('0xa')]('/chat/queues/:id',auth[_0x5e69('0x8')](),controller[_0x5e69('0x40')]);router[_0x5e69('0x3d')](_0x5e69('0x41'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x39')]('fax'));router['get'](_0x5e69('0x42'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x43')]);router[_0x5e69('0x3d')](_0x5e69('0x44'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x39')](_0x5e69('0x45')));router[_0x5e69('0xa')]('/openchannel/queues/:id',auth[_0x5e69('0x8')](),controller['showOpenchannelQueues']);router[_0x5e69('0x3d')]('/sms/queues/:id/notify',auth[_0x5e69('0x8')](),controller[_0x5e69('0x39')]('sms'));router[_0x5e69('0x3d')](_0x5e69('0x46'),auth[_0x5e69('0x8')](),controller[_0x5e69('0x39')](_0x5e69('0x47')));router['get'](_0x5e69('0x48'),auth['isAuthenticated'](),controller[_0x5e69('0x49')]);router['get'](_0x5e69('0x4a'),auth['isAuthenticated'](),controller[_0x5e69('0x4b')]);router[_0x5e69('0x3d')](_0x5e69('0x4c'),auth[_0x5e69('0x8')](),controller['agentNotify']);module[_0x5e69('0x4d')]=router; \ No newline at end of file +var _0xd0be=['/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat'];(function(_0x274d52,_0x1651c1){var _0x43c729=function(_0x3cc8d4){while(--_0x3cc8d4){_0x274d52['push'](_0x274d52['shift']());}};_0x43c729(++_0x1651c1);}(_0xd0be,0xf5));var _0xed0b=function(_0x19c67c,_0x253239){_0x19c67c=_0x19c67c-0x0;var _0x4b304b=_0xd0be[_0x19c67c];return _0x4b304b;};'use strict';var multer=require(_0xed0b('0x0'));var util=require(_0xed0b('0x1'));var path=require('path');var express=require(_0xed0b('0x2'));var router=express[_0xed0b('0x3')]();var auth=require(_0xed0b('0x4'));var controller=require(_0xed0b('0x5'));router['get']('/voice/channels',auth[_0xed0b('0x6')](),controller[_0xed0b('0x7')]);router[_0xed0b('0x8')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xed0b('0x6')](),controller['voiceChannelMixMonitor']);router['get'](_0xed0b('0x9'),auth['isAuthenticated'](),controller[_0xed0b('0xa')]);router['get'](_0xed0b('0xb'),auth[_0xed0b('0x6')](),controller['voiceQueues']);router[_0xed0b('0x8')](_0xed0b('0xc'),auth['isAuthenticated'](),controller['chatQueues']);router[_0xed0b('0x8')](_0xed0b('0xd'),auth[_0xed0b('0x6')](),controller[_0xed0b('0xe')]);router[_0xed0b('0x8')](_0xed0b('0xf'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x10')]);router[_0xed0b('0x8')](_0xed0b('0x11'),auth['isAuthenticated'](),controller[_0xed0b('0x12')]);router[_0xed0b('0x8')](_0xed0b('0x13'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x14')]);router['get'](_0xed0b('0x15'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x16')]);router['get'](_0xed0b('0x17'),auth['isAuthenticated'](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0xed0b('0x8')](_0xed0b('0x18'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0xed0b('0x8')](_0xed0b('0x19'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x1a')]);router[_0xed0b('0x8')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xed0b('0x1b')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xed0b('0x6')](),controller[_0xed0b('0x1c')]);router['get']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xed0b('0x1d')]);router[_0xed0b('0x1e')](_0xed0b('0x1f'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x20')]);router[_0xed0b('0x8')]('/outbound',auth['isAuthenticated'](),controller[_0xed0b('0x21')]);router[_0xed0b('0x8')](_0xed0b('0x22'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x23')]);router[_0xed0b('0x8')]('/agents',auth[_0xed0b('0x6')](),controller[_0xed0b('0x24')]);router[_0xed0b('0x1e')](_0xed0b('0x25'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x26')]);router[_0xed0b('0x8')](_0xed0b('0x27'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x28')]);router[_0xed0b('0x8')](_0xed0b('0x29'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x2a')]);router['get'](_0xed0b('0x2b'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x2c')]);router[_0xed0b('0x8')](_0xed0b('0x2d'),auth[_0xed0b('0x6')](),controller['faxAccounts']);router[_0xed0b('0x8')](_0xed0b('0x2e'),auth['isAuthenticated'](),controller[_0xed0b('0x2f')]);router[_0xed0b('0x8')](_0xed0b('0x30'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x31')]);router[_0xed0b('0x8')](_0xed0b('0x32'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xed0b('0x8')]('/openchannel/queues/:id/waitinginteractions',auth[_0xed0b('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0xed0b('0x33'),auth[_0xed0b('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0xed0b('0x8')](_0xed0b('0x34'),auth['isAuthenticated'](),controller[_0xed0b('0x35')]);router['get'](_0xed0b('0x36'),auth['isAuthenticated'](),controller[_0xed0b('0x37')]);router[_0xed0b('0x38')](_0xed0b('0x39'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x3a')]('mail'));router[_0xed0b('0x8')](_0xed0b('0x3b'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x3c')]);router['post'](_0xed0b('0x3d'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x3a')](_0xed0b('0x3e')));router[_0xed0b('0x8')](_0xed0b('0x3f'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x40')]);router[_0xed0b('0x38')]('/fax/queues/:id/notify',auth[_0xed0b('0x6')](),controller[_0xed0b('0x3a')](_0xed0b('0x41')));router['get'](_0xed0b('0x42'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x43')]);router['post'](_0xed0b('0x44'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x3a')](_0xed0b('0x45')));router[_0xed0b('0x8')]('/openchannel/queues/:id',auth[_0xed0b('0x6')](),controller['showOpenchannelQueues']);router['post'](_0xed0b('0x46'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x3a')](_0xed0b('0x47')));router[_0xed0b('0x38')](_0xed0b('0x48'),auth[_0xed0b('0x6')](),controller['queueNotify'](_0xed0b('0x49')));router[_0xed0b('0x8')]('/sms/queues/:id',auth['isAuthenticated'](),controller['showSmsQueues']);router[_0xed0b('0x8')]('/whatsapp/queues/:id',auth[_0xed0b('0x6')](),controller[_0xed0b('0x4a')]);router[_0xed0b('0x38')](_0xed0b('0x4b'),auth[_0xed0b('0x6')](),controller[_0xed0b('0x4c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d528d52..2d8ea72 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 _0x2675=['request','error','result','catch','status','json','sendStatus','name','send','isNil','rows','find','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','then','voiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','updateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','merge','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','MemberReport','findOrCreate','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','map','queue_id','indexOf','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Agent\x20not\x20found','Message','findOne','agentTransferTimeout','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x379c3e,_0x5c9d34){var _0x20fa30=function(_0x5cd11f){while(--_0x5cd11f){_0x379c3e['push'](_0x379c3e['shift']());}};_0x20fa30(++_0x5c9d34);}(_0x2675,0x75));var _0x5267=function(_0x14fc6d,_0x8dbe60){_0x14fc6d=_0x14fc6d-0x0;var _0x2fdf68=_0x2675[_0x14fc6d];return _0x2fdf68;};'use strict';var BPromise=require(_0x5267('0x0'));var moment=require('moment');var _=require('lodash');var util=require('util');var db=require(_0x5267('0x1'))['db'];var logger=require(_0x5267('0x2'))('api');var jayson=require(_0x5267('0x3'));var amiClient=jayson[_0x5267('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0x5267('0x4')][_0x5267('0x5')]({'port':0x232b});var routingClient=jayson[_0x5267('0x4')][_0x5267('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){var _0x506fd7=_0x527c16?_0x527c16:amiClient;return _0x506fd7[_0x5267('0x6')](_0x20f065,_0xc56cd5)['then'](function(_0x3ff4e9){if(_0x3ff4e9[_0x5267('0x7')]){if(_0x3ff4e9[_0x5267('0x7')]['code']===0x1f4){return _0x46bfdf(_0x3ff4e9[_0x5267('0x7')]['message']);}return _0x9e0a27(_0x3ff4e9[_0x5267('0x7')]['message']);}else{_0x9e0a27(_0x3ff4e9[_0x5267('0x8')]);}})[_0x5267('0x9')](function(_0x268a8a){_0x46bfdf(_0x268a8a);});});}function respondWithResult(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xc8;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0xa')](_0x1d7090)[_0x5267('0xb')](_0x1171b9);}return _0x1f9be3[_0x5267('0xc')](0x194);};}function handleError(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0x1f4;return function(_0x29349a){logger[_0x5267('0x7')](_0x29349a['stack']);if(_0x29349a['name']){delete _0x29349a[_0x5267('0xd')];}_0x1e2d3b[_0x5267('0xa')](_0x16e5a7)[_0x5267('0xe')](_0x29349a);};}function findById(_0x3f5344){return function(_0x46b2c2){if(!_[_0x5267('0xf')](_0x3f5344)&&!_[_0x5267('0xf')](_0x46b2c2)&&!_[_0x5267('0xf')](_0x46b2c2[_0x5267('0x10')])){return _[_0x5267('0x11')](_0x46b2c2[_0x5267('0x10')],function(_0x1ab03){return _0x1ab03['id']==_0x3f5344;});}return null;};}exports['voiceChannels']=function(_0x18f32e,_0x2afd38){return respondWithRpcPromise('VoiceChannels',_0x18f32e[_0x5267('0x12')])['then'](respondWithResult(_0x2afd38,null))[_0x5267('0x9')](handleError(_0x2afd38,null));};exports[_0x5267('0x13')]=function(_0x39c0c3,_0x2a9f99){return respondWithRpcPromise(_0x5267('0x14'),_['merge'](_0x39c0c3[_0x5267('0x12')],_0x39c0c3['params']))[_0x5267('0x15')](respondWithResult(_0x2a9f99,null))[_0x5267('0x9')](handleError(_0x2a9f99,null));};exports[_0x5267('0x16')]=function(_0x56dd95,_0x499f19){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x56dd95['query'],_0x56dd95[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x499f19,null))[_0x5267('0x9')](handleError(_0x499f19,null));};exports[_0x5267('0x18')]=function(_0x11c8ea,_0x40d1be){return respondWithRpcPromise(_0x5267('0x19'),_0x11c8ea[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x40d1be,null))['catch'](handleError(_0x40d1be,null));};exports['showVoiceQueues']=function(_0x354111,_0x472938){return respondWithRpcPromise('VoiceQueues',_0x354111[_0x5267('0x12')])['then'](findById(_0x354111['params']['id']))[_0x5267('0x15')](respondWithResult(_0x472938,null))[_0x5267('0x9')](handleError(_0x472938,null));};exports[_0x5267('0x1a')]=function(_0x2d2ace,_0x33c431){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x2d2ace[_0x5267('0x1b')],_0x2d2ace[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x33c431,null))['catch'](handleError(_0x33c431,null));};exports['voiceQueuesPreview']=function(_0xbe7922,_0x3ef2a8){return respondWithRpcPromise(_0x5267('0x1c'),_['merge'](_0xbe7922['query'],_0xbe7922[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x3ef2a8,null))[_0x5267('0x9')](handleError(_0x3ef2a8,null));};exports[_0x5267('0x1d')]=function(_0x5bbb83,_0x33e456){return respondWithRpcPromise(_0x5267('0x1e'),_0x5bbb83[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x33e456,null))[_0x5267('0x9')](handleError(_0x33e456,null));};exports[_0x5267('0x1f')]=function(_0x341bae,_0x1dda95){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x341bae[_0x5267('0x12')],_0x341bae['params']))[_0x5267('0x15')](respondWithResult(_0x1dda95,null))[_0x5267('0x9')](handleError(_0x1dda95,null));};exports[_0x5267('0x20')]=function(_0x3a729c,_0x4ac4a0){return respondWithRpcPromise(_0x5267('0x21'),_[_0x5267('0x22')](_0x3a729c[_0x5267('0x12')],_0x3a729c[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x4ac4a0,null))[_0x5267('0x9')](handleError(_0x4ac4a0,null));};exports[_0x5267('0x23')]=function(_0xa0ea89,_0x484b77){return respondWithRpcPromise(_0x5267('0x24'),_['merge'](_0xa0ea89[_0x5267('0x12')],_0xa0ea89[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x484b77,null))[_0x5267('0x9')](handleError(_0x484b77,null));};exports[_0x5267('0x25')]=function(_0x33ecd7,_0x465ad9){return respondWithRpcPromise('Outbound',_0x33ecd7[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x465ad9,null))[_0x5267('0x9')](handleError(_0x465ad9,null));};exports[_0x5267('0x26')]=function(_0x82cea7,_0x21eabf){return respondWithRpcPromise(_0x5267('0x27'),_0x82cea7['query'])[_0x5267('0x15')](respondWithResult(_0x21eabf,null))['catch'](handleError(_0x21eabf,null));};exports[_0x5267('0x28')]=function(_0x5c0cdf,_0x4dee66){var _0x51bddd;return respondWithRpcPromise(_0x5267('0x29'),_0x5c0cdf['query'])[_0x5267('0x15')](function(_0x146476){_0x51bddd=_0x146476;return respondWithRpcPromise(_0x5267('0x29'),_0x5c0cdf[_0x5267('0x12')],routingClient);})['then'](function(_0x456b33){return _[_0x5267('0x22')]({},_0x456b33,_0x51bddd);})['then'](respondWithResult(_0x4dee66,null))['catch'](handleError(_0x4dee66,null));};exports[_0x5267('0x2a')]=function(_0x560cdf,_0x12df83){if(_0x560cdf[_0x5267('0x1b')]&&_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')]&&_0x560cdf[_0x5267('0x2c')]&&_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')]){for(var _0x5697b3 in _0x560cdf['body'][_0x5267('0x2b')]){if(_0x560cdf['body'][_0x5267('0x2b')][_0x5267('0x2d')](_0x5697b3)){db['MemberReport'][_0x5267('0x2e')]({'where':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')],'type':_0x5267('0x2f'),'exitAt':null,'uniqueid':_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')][_0x5697b3]&&_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')][_0x5697b3][_0x5267('0x30')]?{'$notIn':_0x560cdf['body'][_0x5267('0x2b')][_0x5697b3]}:{'$ne':null}}})[_0x5267('0x15')](function(_0x19b015){var _0x45241a=moment()[_0x5267('0x31')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3d15ac=0x0,_0x4e0132=_0x19b015[_0x5267('0x30')];_0x3d15ac<_0x4e0132;_0x3d15ac+=0x1){_0x19b015[_0x3d15ac]['updateAttributes']({'exitAt':_0x45241a});}});for(var _0x4ae9f9=0x0;_0x4ae9f9<_0x560cdf[_0x5267('0x1b')]['interaction'][_0x5697b3][_0x5267('0x30')];_0x4ae9f9+=0x1){db[_0x5267('0x32')][_0x5267('0x33')]({'where':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')]['name'],'type':_0x5267('0x2f'),'uniqueid':_0x560cdf['body']['interaction'][_0x5697b3][_0x4ae9f9],'exitAt':null},'defaults':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')],'interface':_['isNil'](_0x560cdf['user'][_0x5267('0x34')])?util[_0x5267('0x31')](_0x5267('0x35'),_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')]):_0x560cdf[_0x5267('0x2c')][_0x5267('0x34')],'type':_0x5267('0x2f'),'enterAt':moment()[_0x5267('0x31')](_0x5267('0x36')),'role':_0x5267('0x37'),'internal':_0x560cdf[_0x5267('0x2c')][_0x5267('0x38')],'uniqueid':_0x560cdf[_0x5267('0x1b')]['interaction'][_0x5697b3][_0x4ae9f9]}});}}}}return respondWithRpcPromise(_0x5267('0x39'),{'id':_0x560cdf[_0x5267('0x17')]['id'],'capacity':_0x560cdf[_0x5267('0x1b')]['capacity']},routingClient)[_0x5267('0x15')](respondWithResult(_0x12df83,null))[_0x5267('0x9')](handleError(_0x12df83,null));};exports[_0x5267('0x3a')]=function(_0x2a97f1,_0x119546){return respondWithRpcPromise(_0x5267('0x3b'),_0x2a97f1['query'])[_0x5267('0x15')](respondWithResult(_0x119546,null))['catch'](handleError(_0x119546,null));};exports[_0x5267('0x3c')]=function(_0x30fcd2,_0xa49fd7){return respondWithRpcPromise(_0x5267('0x3d'),_0x30fcd2[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0xa49fd7,null))[_0x5267('0x9')](handleError(_0xa49fd7,null));};exports['campaigns']=function(_0x57ca8f,_0x200855){return respondWithRpcPromise(_0x5267('0x3e'),_0x57ca8f['query'])[_0x5267('0x15')](respondWithResult(_0x200855,null))['catch'](handleError(_0x200855,null));};exports['chatQueues']=function(_0x1eeb21,_0x79cee1){return respondWithRpcPromise(_0x5267('0x3f'),_0x1eeb21[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x79cee1,null))[_0x5267('0x9')](handleError(_0x79cee1,null));};exports[_0x5267('0x40')]=function(_0x3fd8f9,_0xf0b5a9){return respondWithRpcPromise(_0x5267('0x3f'),_0x3fd8f9['query'],routingClient)[_0x5267('0x15')](findById(_0x3fd8f9[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0xf0b5a9,null))[_0x5267('0x9')](handleError(_0xf0b5a9,null));};exports[_0x5267('0x41')]=function(_0x34c205,_0x552211){return respondWithRpcPromise(_0x5267('0x42'),_0x34c205['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x552211,null))[_0x5267('0x9')](handleError(_0x552211,null));};exports[_0x5267('0x43')]=function(_0x4a72c3,_0x1593ce){return respondWithRpcPromise(_0x5267('0x42'),_0x4a72c3[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0x4a72c3[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x1593ce,null))['catch'](handleError(_0x1593ce,null));};exports[_0x5267('0x44')]=function(_0x190d02,_0x186667){return respondWithRpcPromise(_0x5267('0x45'),_0x190d02['query'],mailClient)['then'](respondWithResult(_0x186667,null))[_0x5267('0x9')](handleError(_0x186667,null));};exports['openchannelQueues']=function(_0x3f5cda,_0x47059c){return respondWithRpcPromise('OpenchannelQueues',_0x3f5cda['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x47059c,null))[_0x5267('0x9')](handleError(_0x47059c,null));};exports[_0x5267('0x46')]=function(_0x537f75,_0x457dca){return respondWithRpcPromise(_0x5267('0x47'),_0x537f75[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0x537f75['params']['id']))['then'](respondWithResult(_0x457dca,null))['catch'](handleError(_0x457dca,null));};exports[_0x5267('0x48')]=function(_0x2457a3,_0x45ee25){return respondWithRpcPromise(_0x5267('0x49'),_0x2457a3[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x45ee25,null))[_0x5267('0x9')](handleError(_0x45ee25,null));};exports[_0x5267('0x4a')]=function(_0x486b02,_0x1ddfad){return respondWithRpcPromise(_0x5267('0x49'),_0x486b02['query'],routingClient)[_0x5267('0x15')](findById(_0x486b02[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x1ddfad,null))[_0x5267('0x9')](handleError(_0x1ddfad,null));};exports[_0x5267('0x4b')]=function(_0xde1ecd,_0x4915f4){return respondWithRpcPromise(_0x5267('0x4c'),_0xde1ecd[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x4915f4,null))[_0x5267('0x9')](handleError(_0x4915f4,null));};exports[_0x5267('0x4d')]=function(_0xd9bcf9,_0x4aac32){return respondWithRpcPromise(_0x5267('0x4c'),_0xd9bcf9[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0xd9bcf9[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x4aac32,null))[_0x5267('0x9')](handleError(_0x4aac32,null));};exports['faxQueues']=function(_0x283423,_0x41299c){return respondWithRpcPromise(_0x5267('0x4e'),_0x283423[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x41299c,null))['catch'](handleError(_0x41299c,null));};exports['showFaxQueues']=function(_0x910f97,_0x5cca85){return respondWithRpcPromise(_0x5267('0x4e'),_0x910f97['query'],routingClient)[_0x5267('0x15')](findById(_0x910f97[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x5cca85,null))[_0x5267('0x9')](handleError(_0x5cca85,null));};exports[_0x5267('0x4f')]=function(_0xa92aa5,_0x21338f){return respondWithRpcPromise(_0x5267('0x50'),_0xa92aa5['query'])['then'](respondWithResult(_0x21338f,null))['catch'](handleError(_0x21338f,null));};exports[_0x5267('0x51')]=function(_0x28a101,_0x2ab2be){return respondWithRpcPromise(_0x5267('0x52'),_0x28a101['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x2ab2be,null))[_0x5267('0x9')](handleError(_0x2ab2be,null));};exports[_0x5267('0x53')]=function(_0xc3ac3f,_0x5a0e73){return respondWithRpcPromise(_0x5267('0x54'),_0xc3ac3f[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x5a0e73,null))[_0x5267('0x9')](handleError(_0x5a0e73,null));};exports[_0x5267('0x55')]=function(_0x4a9995,_0x47e235){return respondWithRpcPromise(_0x5267('0x56'),_0x4a9995[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x47e235,null))['catch'](handleError(_0x47e235,null));};exports[_0x5267('0x57')]=function(_0x2e7f8a,_0x35b302){return respondWithRpcPromise(_0x5267('0x56'),_0x2e7f8a[_0x5267('0x12')],routingClient)['then'](function(_0x4643ae){if(_0x2e7f8a[_0x5267('0x12')]['type']!==undefined){var _0x26c628=_(_0x4643ae[_0x5267('0x10')])[_0x5267('0x58')]([_0x2e7f8a[_0x5267('0x12')][_0x5267('0x59')],_0x2e7f8a[_0x5267('0x17')]['id']])[_0x5267('0x5a')](_0x5267('0x5b'))['uniq']()['value']();return _0x4643ae[_0x5267('0x10')][_0x5267('0x58')](function(_0x3f729f){return _0x26c628[_0x5267('0x5c')](_0x3f729f['queue_id'])>-0x1;});}else{return _0x4643ae[_0x5267('0x10')]['filter'](function(_0x2988a1){return _0x2988a1[_0x5267('0x5b')]===parseInt(_0x2e7f8a[_0x5267('0x17')]['id']);});}})[_0x5267('0x15')](respondWithResult(_0x35b302,null))['catch'](handleError(_0x35b302,null));};exports['smsQueuesWaitingInteractions']=function(_0x3a67a0,_0x3e2cf5){return respondWithRpcPromise(_0x5267('0x5d'),_0x3a67a0[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x3e2cf5,null))[_0x5267('0x9')](handleError(_0x3e2cf5,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x1b8d72,_0x4a05c9){return respondWithRpcPromise(_0x5267('0x5e'),_0x1b8d72['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x4a05c9,null))[_0x5267('0x9')](handleError(_0x4a05c9,null));};exports[_0x5267('0x5f')]=function(_0x87aa90,_0x164cc1){return respondWithRpcPromise(_0x5267('0x60'),_0x87aa90[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x164cc1,null))[_0x5267('0x9')](handleError(_0x164cc1,null));};exports[_0x5267('0x61')]=function(_0x555c8){return function(_0x531bb9,_0x40c7b5){var _0x14baf4,_0x4d9ec9;var _0xde179f=_[_0x5267('0x62')](_0x555c8);var _0x3ebda6=_0x555c8===_0x5267('0x63')?_0x5267('0x64'):_0x5267('0x65');return db[_0xde179f+_0x5267('0x66')]['findOne']({'raw':!![],'where':{'id':_0x531bb9[_0x5267('0x17')]['id']}})[_0x5267('0x15')](function(_0x2543a4){if(_[_0x5267('0xf')](_0x2543a4)){throw new Error(_0xde179f+_0x5267('0x67'));}_0x14baf4=_0x2543a4;return db[_0xde179f+'Message']['findOne']({'where':{'id':_0x531bb9[_0x5267('0x1b')][_0x5267('0x68')]},'include':[{'model':db[_0xde179f+_0x5267('0x69')],'as':_0x5267('0x69')},{'model':db[_0xde179f+_0x3ebda6],'as':'Account'}]});})[_0x5267('0x15')](function(_0x3cc775){if(_[_0x5267('0xf')](_0x3cc775)){throw new Error(_0xde179f+_0x5267('0x6a'));}_0x4d9ec9=_0x3cc775;return _0x3cc775[_0x5267('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5267('0x15')](function(){var _0x2b38f2={'uniqueid':_0x555c8+'.'+_0x4d9ec9['id']+'.'+_0x4d9ec9[_0x5267('0x69')]['id'],'FromUserId':_0x531bb9[_0x5267('0x2c')]['id'],'type':_0x5267('0x6c')};_0x2b38f2[_0xde179f+_0x5267('0x6d')]=_0x4d9ec9['id'];_0x2b38f2[_0xde179f+_0x5267('0x6e')]=_0x4d9ec9[_0x5267('0x69')]['id'];_0x2b38f2['From'+_0xde179f+_0x3ebda6+'Id']=_0x4d9ec9[_0x5267('0x65')]['id'];_0x2b38f2['To'+_0xde179f+_0x5267('0x6f')]=_0x14baf4['id'];return db[_0xde179f+_0x5267('0x70')][_0x5267('0x71')](_0x2b38f2);})[_0x5267('0x15')](function(){return respondWithRpcPromise(_0x5267('0x72'),{'channel':_0x555c8,'interaction':_0x4d9ec9[_0x5267('0x69')],'message':_0x4d9ec9,'account':_0x4d9ec9[_0x5267('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5267('0x6c'),'appdata':_0x14baf4[_0x5267('0xd')]+','+(_0x4d9ec9[_0x5267('0x65')][_0x5267('0x73')]||0x12c),'interval':_0x5267('0x74')}]},routingClient);})[_0x5267('0x15')](respondWithResult(_0x40c7b5,null))[_0x5267('0x9')](handleError(_0x40c7b5,null));};};exports[_0x5267('0x75')]=function(_0x28884b,_0x35a4a3){var _0x7ecf0e,_0x676556;if(_[_0x5267('0xf')](_0x28884b[_0x5267('0x1b')][_0x5267('0x76')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x339f3f=_0x28884b[_0x5267('0x1b')][_0x5267('0x76')];var _0x405eb4=_[_0x5267('0x62')](_0x339f3f);var _0x557749=_0x339f3f===_0x5267('0x63')?_0x5267('0x64'):'Account';return db['User']['findOne']({'raw':!![],'where':{'id':_0x28884b[_0x5267('0x17')]['id'],'role':'agent'}})[_0x5267('0x15')](function(_0x54422c){if(_['isNil'](_0x54422c)){throw new Error(_0x5267('0x77'));}_0x7ecf0e=_0x54422c;return db[_0x405eb4+_0x5267('0x78')][_0x5267('0x79')]({'where':{'id':_0x28884b[_0x5267('0x1b')][_0x5267('0x68')]},'include':[{'model':db[_0x405eb4+'Interaction'],'as':'Interaction'},{'model':db[_0x405eb4+_0x557749],'as':_0x5267('0x65')}]});})[_0x5267('0x15')](function(_0x1a6245){if(_[_0x5267('0xf')](_0x1a6245)){throw new Error(_0x405eb4+_0x5267('0x6a'));}_0x676556=_0x1a6245;return _0x1a6245['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5267('0x15')](function(){var _0x5bece1={'uniqueid':_0x339f3f+'.'+_0x676556['id']+'.'+_0x676556['Interaction']['id'],'FromUserId':_0x28884b[_0x5267('0x2c')]['id'],'type':'queue','ToUserId':_0x7ecf0e['id']};_0x5bece1[_0x405eb4+'MessageId']=_0x676556['id'];_0x5bece1[_0x405eb4+_0x5267('0x6e')]=_0x676556[_0x5267('0x69')]['id'];_0x5bece1['From'+_0x405eb4+_0x557749+'Id']=_0x676556['Account']['id'];return db[_0x405eb4+'TransferReport'][_0x5267('0x71')](_0x5bece1);})['then'](function(){return respondWithRpcPromise(_0x5267('0x72'),{'channel':_0x339f3f,'interaction':_0x676556['Interaction'],'message':_0x676556,'account':_0x676556[_0x5267('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5267('0x37'),'appdata':_0x7ecf0e['name']+','+(_0x676556[_0x5267('0x65')][_0x5267('0x7a')]||0x12c),'interval':_0x5267('0x74')}]},routingClient);})[_0x5267('0x15')](respondWithResult(_0x35a4a3,null))[_0x5267('0x9')](handleError(_0x35a4a3,null));}; \ No newline at end of file +var _0x24ca=['telephones','Telephones','trunks','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','update','queue','MessageId','InteractionId','From','QueueId','Start','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','TransferReport','create','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','error','code','message','result','json','sendStatus','stack','status','send','isNil','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','catch','VoiceQueues','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity'];(function(_0x188eb3,_0x3a0dfc){var _0x219682=function(_0x1f7c4c){while(--_0x1f7c4c){_0x188eb3['push'](_0x188eb3['shift']());}};_0x219682(++_0x3a0dfc);}(_0x24ca,0x1bc));var _0xa24c=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x24ca[_0x469a3c];return _0x968f4;};'use strict';var BPromise=require(_0xa24c('0x0'));var moment=require('moment');var _=require(_0xa24c('0x1'));var util=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var logger=require('../../config/logger')(_0xa24c('0x4'));var jayson=require(_0xa24c('0x5'));var amiClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232a});var mailClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232b});var routingClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){var _0x3a5727=_0x9a5013?_0x9a5013:amiClient;return _0x3a5727[_0xa24c('0x8')](_0x2dd348,_0x257264)['then'](function(_0x399f32){if(_0x399f32[_0xa24c('0x9')]){if(_0x399f32[_0xa24c('0x9')][_0xa24c('0xa')]===0x1f4){return _0x42d89c(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}return _0x481196(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}else{_0x481196(_0x399f32[_0xa24c('0xc')]);}})['catch'](function(_0x43bcd3){_0x42d89c(_0x43bcd3);});});}function respondWithResult(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xc8;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['status'](_0xcee4fe)[_0xa24c('0xd')](_0x2c2af8);}return _0x11090c[_0xa24c('0xe')](0x194);};}function handleError(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0x1f4;return function(_0x1cb08e){logger[_0xa24c('0x9')](_0x1cb08e[_0xa24c('0xf')]);if(_0x1cb08e['name']){delete _0x1cb08e['name'];}_0x26ff28[_0xa24c('0x10')](_0x2fcd8b)[_0xa24c('0x11')](_0x1cb08e);};}function findById(_0x49ce53){return function(_0x5babb5){if(!_[_0xa24c('0x12')](_0x49ce53)&&!_[_0xa24c('0x12')](_0x5babb5)&&!_['isNil'](_0x5babb5[_0xa24c('0x13')])){return _['find'](_0x5babb5[_0xa24c('0x13')],function(_0x2a610a){return _0x2a610a['id']==_0x49ce53;});}return null;};}exports[_0xa24c('0x14')]=function(_0xefdbd9,_0x4ff97c){return respondWithRpcPromise(_0xa24c('0x15'),_0xefdbd9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x4ff97c,null))['catch'](handleError(_0x4ff97c,null));};exports['voiceChannelMixMonitor']=function(_0x506424,_0x4cd77e){return respondWithRpcPromise(_0xa24c('0x18'),_[_0xa24c('0x19')](_0x506424[_0xa24c('0x16')],_0x506424[_0xa24c('0x1a')]))['then'](respondWithResult(_0x4cd77e,null))[_0xa24c('0x1b')](handleError(_0x4cd77e,null));};exports['voiceChannelStopMixMonitor']=function(_0x224bca,_0xb81d97){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa24c('0x19')](_0x224bca[_0xa24c('0x16')],_0x224bca[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0xb81d97,null))[_0xa24c('0x1b')](handleError(_0xb81d97,null));};exports['voiceQueues']=function(_0xec9167,_0x5cc9cb){return respondWithRpcPromise(_0xa24c('0x1c'),_0xec9167[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x5cc9cb,null))['catch'](handleError(_0x5cc9cb,null));};exports[_0xa24c('0x1d')]=function(_0x31c4d9,_0x14fd5a){return respondWithRpcPromise(_0xa24c('0x1c'),_0x31c4d9[_0xa24c('0x16')])[_0xa24c('0x17')](findById(_0x31c4d9[_0xa24c('0x1a')]['id']))['then'](respondWithResult(_0x14fd5a,null))[_0xa24c('0x1b')](handleError(_0x14fd5a,null));};exports[_0xa24c('0x1e')]=function(_0x152120,_0x12dbdc){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xa24c('0x19')](_0x152120[_0xa24c('0x1f')],_0x152120[_0xa24c('0x1a')]))['then'](respondWithResult(_0x12dbdc,null))[_0xa24c('0x1b')](handleError(_0x12dbdc,null));};exports[_0xa24c('0x20')]=function(_0x253d83,_0x4ae35c){return respondWithRpcPromise(_0xa24c('0x21'),_['merge'](_0x253d83[_0xa24c('0x16')],_0x253d83[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x4ae35c,null))['catch'](handleError(_0x4ae35c,null));};exports[_0xa24c('0x22')]=function(_0x53f90,_0x1d0379){return respondWithRpcPromise('VoiceQueuesChannels',_0x53f90[_0xa24c('0x16')])['then'](respondWithResult(_0x1d0379,null))[_0xa24c('0x1b')](handleError(_0x1d0379,null));};exports[_0xa24c('0x23')]=function(_0x592198,_0x5680f5){return respondWithRpcPromise(_0xa24c('0x24'),_[_0xa24c('0x19')](_0x592198[_0xa24c('0x16')],_0x592198[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x5680f5,null))[_0xa24c('0x1b')](handleError(_0x5680f5,null));};exports[_0xa24c('0x25')]=function(_0x4b4dc2,_0x39f146){return respondWithRpcPromise(_0xa24c('0x26'),_[_0xa24c('0x19')](_0x4b4dc2[_0xa24c('0x16')],_0x4b4dc2[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x39f146,null))[_0xa24c('0x1b')](handleError(_0x39f146,null));};exports[_0xa24c('0x27')]=function(_0x1ea166,_0x129bb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa24c('0x19')](_0x1ea166[_0xa24c('0x16')],_0x1ea166[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x129bb9,null))['catch'](handleError(_0x129bb9,null));};exports['outbound']=function(_0x19a65f,_0x56ef4d){return respondWithRpcPromise(_0xa24c('0x28'),_0x19a65f[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x56ef4d,null))[_0xa24c('0x1b')](handleError(_0x56ef4d,null));};exports[_0xa24c('0x29')]=function(_0x4c0fb9,_0x532875){return respondWithRpcPromise(_0xa24c('0x2a'),_0x4c0fb9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x532875,null))[_0xa24c('0x1b')](handleError(_0x532875,null));};exports[_0xa24c('0x2b')]=function(_0x472912,_0x5080d0){var _0x56f392;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912[_0xa24c('0x16')])[_0xa24c('0x17')](function(_0x2101f8){_0x56f392=_0x2101f8;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912['query'],routingClient);})[_0xa24c('0x17')](function(_0x7895e){return _['merge']({},_0x7895e,_0x56f392);})['then'](respondWithResult(_0x5080d0,null))[_0xa24c('0x1b')](handleError(_0x5080d0,null));};exports[_0xa24c('0x2d')]=function(_0x231eea,_0x537849){if(_0x231eea['body']&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]&&_0x231eea[_0xa24c('0x2f')]&&_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')]){for(var _0x1b7faf in _0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]){if(_0x231eea['body']['interaction'][_0xa24c('0x31')](_0x1b7faf)){db[_0xa24c('0x32')][_0xa24c('0x33')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea['user'][_0xa24c('0x30')],'type':_0xa24c('0x34'),'exitAt':null,'uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')]?{'$notIn':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]}:{'$ne':null}}})[_0xa24c('0x17')](function(_0x4bbf93){var _0xb8c7a5=moment()[_0xa24c('0x36')](_0xa24c('0x37'));for(var _0x5aa2b2=0x0,_0x3a85cb=_0x4bbf93[_0xa24c('0x35')];_0x5aa2b2<_0x3a85cb;_0x5aa2b2+=0x1){_0x4bbf93[_0x5aa2b2][_0xa24c('0x38')]({'exitAt':_0xb8c7a5});}});for(var _0x31f05b=0x0;_0x31f05b<_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')];_0x31f05b+=0x1){db[_0xa24c('0x32')][_0xa24c('0x39')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'type':'INTERACTION','uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0x31f05b],'exitAt':null},'defaults':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'interface':_[_0xa24c('0x12')](_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3a')])?util[_0xa24c('0x36')](_0xa24c('0x3b'),_0x231eea['user']['name']):_0x231eea[_0xa24c('0x2f')]['interface'],'type':_0xa24c('0x34'),'enterAt':moment()[_0xa24c('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa24c('0x3c'),'internal':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3d')],'uniqueid':_0x231eea['body']['interaction'][_0x1b7faf][_0x31f05b]}});}}}}return respondWithRpcPromise(_0xa24c('0x3e'),{'id':_0x231eea['params']['id'],'capacity':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x3f')]},routingClient)[_0xa24c('0x17')](respondWithResult(_0x537849,null))[_0xa24c('0x1b')](handleError(_0x537849,null));};exports[_0xa24c('0x40')]=function(_0x1fa739,_0x3f3ce6){return respondWithRpcPromise(_0xa24c('0x41'),_0x1fa739[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x3f3ce6,null))['catch'](handleError(_0x3f3ce6,null));};exports[_0xa24c('0x42')]=function(_0x2759c1,_0x233f8e){return respondWithRpcPromise('Trunks',_0x2759c1['query'])['then'](respondWithResult(_0x233f8e,null))[_0xa24c('0x1b')](handleError(_0x233f8e,null));};exports['campaigns']=function(_0x4757ff,_0x21d0fc){return respondWithRpcPromise('Campaigns',_0x4757ff[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x21d0fc,null))[_0xa24c('0x1b')](handleError(_0x21d0fc,null));};exports[_0xa24c('0x43')]=function(_0x162a11,_0x3a72e3){return respondWithRpcPromise(_0xa24c('0x44'),_0x162a11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x3a72e3,null))[_0xa24c('0x1b')](handleError(_0x3a72e3,null));};exports['showChatQueues']=function(_0x5abd45,_0x565f0a){return respondWithRpcPromise('ChatQueues',_0x5abd45['query'],routingClient)[_0xa24c('0x17')](findById(_0x5abd45['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x565f0a,null))[_0xa24c('0x1b')](handleError(_0x565f0a,null));};exports[_0xa24c('0x45')]=function(_0x1a5f17,_0xa371d2){return respondWithRpcPromise(_0xa24c('0x46'),_0x1a5f17[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0xa371d2,null))[_0xa24c('0x1b')](handleError(_0xa371d2,null));};exports[_0xa24c('0x47')]=function(_0x303b7d,_0x37dbbd){return respondWithRpcPromise(_0xa24c('0x46'),_0x303b7d[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0x303b7d['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x37dbbd,null))[_0xa24c('0x1b')](handleError(_0x37dbbd,null));};exports['mailAccounts']=function(_0x1e08bb,_0x179ae1){return respondWithRpcPromise(_0xa24c('0x48'),_0x1e08bb[_0xa24c('0x16')],mailClient)['then'](respondWithResult(_0x179ae1,null))['catch'](handleError(_0x179ae1,null));};exports[_0xa24c('0x49')]=function(_0x5e9631,_0x486040){return respondWithRpcPromise(_0xa24c('0x4a'),_0x5e9631[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x486040,null))[_0xa24c('0x1b')](handleError(_0x486040,null));};exports['showOpenchannelQueues']=function(_0x48a7b2,_0x29b836){return respondWithRpcPromise('OpenchannelQueues',_0x48a7b2['query'],routingClient)[_0xa24c('0x17')](findById(_0x48a7b2[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x29b836,null))['catch'](handleError(_0x29b836,null));};exports[_0xa24c('0x4b')]=function(_0x128e5b,_0x5c3285){return respondWithRpcPromise(_0xa24c('0x4c'),_0x128e5b[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x5c3285,null))['catch'](handleError(_0x5c3285,null));};exports[_0xa24c('0x4d')]=function(_0x34e261,_0x21439a){return respondWithRpcPromise(_0xa24c('0x4c'),_0x34e261[_0xa24c('0x16')],routingClient)['then'](findById(_0x34e261[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x21439a,null))[_0xa24c('0x1b')](handleError(_0x21439a,null));};exports[_0xa24c('0x4e')]=function(_0xab5260,_0x2ca3fa){return respondWithRpcPromise(_0xa24c('0x4f'),_0xab5260['query'],routingClient)[_0xa24c('0x17')](respondWithResult(_0x2ca3fa,null))[_0xa24c('0x1b')](handleError(_0x2ca3fa,null));};exports['showWhatsappQueues']=function(_0xb1048a,_0x3e455b){return respondWithRpcPromise(_0xa24c('0x4f'),_0xb1048a[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xb1048a[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x3e455b,null))[_0xa24c('0x1b')](handleError(_0x3e455b,null));};exports[_0xa24c('0x50')]=function(_0x32ddc3,_0x50141e){return respondWithRpcPromise(_0xa24c('0x51'),_0x32ddc3[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x50141e,null))['catch'](handleError(_0x50141e,null));};exports[_0xa24c('0x52')]=function(_0xfd57fb,_0x2cc592){return respondWithRpcPromise('FaxQueues',_0xfd57fb[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xfd57fb[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x2cc592,null))[_0xa24c('0x1b')](handleError(_0x2cc592,null));};exports[_0xa24c('0x53')]=function(_0x4f9b56,_0x4c374d){return respondWithRpcPromise(_0xa24c('0x54'),_0x4f9b56['query'])[_0xa24c('0x17')](respondWithResult(_0x4c374d,null))[_0xa24c('0x1b')](handleError(_0x4c374d,null));};exports[_0xa24c('0x55')]=function(_0x4073c5,_0x12d715){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4073c5[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x12d715,null))[_0xa24c('0x1b')](handleError(_0x12d715,null));};exports[_0xa24c('0x56')]=function(_0x987aca,_0x389c08){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x987aca[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x389c08,null))[_0xa24c('0x1b')](handleError(_0x389c08,null));};exports[_0xa24c('0x57')]=function(_0x5ebdd1,_0x403bf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5ebdd1[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x403bf1,null))[_0xa24c('0x1b')](handleError(_0x403bf1,null));};exports[_0xa24c('0x58')]=function(_0x5726e1,_0x2e612d){return respondWithRpcPromise(_0xa24c('0x59'),_0x5726e1['query'],routingClient)[_0xa24c('0x17')](function(_0x168a8b){if(_0x5726e1[_0xa24c('0x16')][_0xa24c('0x5a')]!==undefined){var _0x8bd3fb=_(_0x168a8b[_0xa24c('0x13')])[_0xa24c('0x5b')]([_0x5726e1[_0xa24c('0x16')]['type'],_0x5726e1[_0xa24c('0x1a')]['id']])[_0xa24c('0x5c')](_0xa24c('0x5d'))[_0xa24c('0x5e')]()[_0xa24c('0x5f')]();return _0x168a8b[_0xa24c('0x13')][_0xa24c('0x5b')](function(_0x13dbef){return _0x8bd3fb[_0xa24c('0x60')](_0x13dbef[_0xa24c('0x5d')])>-0x1;});}else{return _0x168a8b[_0xa24c('0x13')]['filter'](function(_0x283c5b){return _0x283c5b[_0xa24c('0x5d')]===parseInt(_0x5726e1['params']['id']);});}})[_0xa24c('0x17')](respondWithResult(_0x2e612d,null))[_0xa24c('0x1b')](handleError(_0x2e612d,null));};exports[_0xa24c('0x61')]=function(_0x4f0f11,_0x5b4468){return respondWithRpcPromise(_0xa24c('0x62'),_0x4f0f11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x5b4468,null))[_0xa24c('0x1b')](handleError(_0x5b4468,null));};exports[_0xa24c('0x63')]=function(_0x106178,_0x27a666){return respondWithRpcPromise(_0xa24c('0x64'),_0x106178[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x27a666,null))['catch'](handleError(_0x27a666,null));};exports['faxQueuesWaitingInteractions']=function(_0x263dab,_0x521894){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x263dab[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x521894,null))[_0xa24c('0x1b')](handleError(_0x521894,null));};exports[_0xa24c('0x65')]=function(_0x84ddcc){return function(_0x45b2fe,_0x16f93a){var _0x170b65,_0x2544fc;var _0x4ee10d=_[_0xa24c('0x66')](_0x84ddcc);var _0xa077c8=_0x84ddcc===_0xa24c('0x67')?_0xa24c('0x68'):_0xa24c('0x69');return db[_0x4ee10d+_0xa24c('0x6a')][_0xa24c('0x6b')]({'raw':!![],'where':{'id':_0x45b2fe[_0xa24c('0x1a')]['id']}})[_0xa24c('0x17')](function(_0x3c5495){if(_[_0xa24c('0x12')](_0x3c5495)){throw new Error(_0x4ee10d+_0xa24c('0x6c'));}_0x170b65=_0x3c5495;return db[_0x4ee10d+'Message'][_0xa24c('0x6b')]({'where':{'id':_0x45b2fe[_0xa24c('0x1f')]['messageId']},'include':[{'model':db[_0x4ee10d+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x4ee10d+_0xa077c8],'as':_0xa24c('0x69')}]});})['then'](function(_0x549e07){if(_[_0xa24c('0x12')](_0x549e07)){throw new Error(_0x4ee10d+'\x20Message\x20not\x20found');}_0x2544fc=_0x549e07;return _0x549e07[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4c108f={'uniqueid':_0x84ddcc+'.'+_0x2544fc['id']+'.'+_0x2544fc['Interaction']['id'],'FromUserId':_0x45b2fe[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f')};_0x4c108f[_0x4ee10d+_0xa24c('0x70')]=_0x2544fc['id'];_0x4c108f[_0x4ee10d+_0xa24c('0x71')]=_0x2544fc['Interaction']['id'];_0x4c108f[_0xa24c('0x72')+_0x4ee10d+_0xa077c8+'Id']=_0x2544fc[_0xa24c('0x69')]['id'];_0x4c108f['To'+_0x4ee10d+_0xa24c('0x73')]=_0x170b65['id'];return db[_0x4ee10d+'TransferReport']['create'](_0x4c108f);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x84ddcc,'interaction':_0x2544fc[_0xa24c('0x6d')],'message':_0x2544fc,'account':_0x2544fc['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x170b65[_0xa24c('0x30')]+','+(_0x2544fc['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x16f93a,null))[_0xa24c('0x1b')](handleError(_0x16f93a,null));};};exports[_0xa24c('0x75')]=function(_0xd23eb3,_0x890e15){var _0x12836d,_0x280fa2;if(_[_0xa24c('0x12')](_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x76')])){throw new Error(_0xa24c('0x77'));}var _0x24b28c=_0xd23eb3['body'][_0xa24c('0x76')];var _0x292c22=_['capitalize'](_0x24b28c);var _0x2fd4a2=_0x24b28c==='chat'?'Website':'Account';return db[_0xa24c('0x78')]['findOne']({'raw':!![],'where':{'id':_0xd23eb3[_0xa24c('0x1a')]['id'],'role':'agent'}})[_0xa24c('0x17')](function(_0x144c3b){if(_['isNil'](_0x144c3b)){throw new Error(_0xa24c('0x79'));}_0x12836d=_0x144c3b;return db[_0x292c22+'Message'][_0xa24c('0x6b')]({'where':{'id':_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x7a')]},'include':[{'model':db[_0x292c22+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x292c22+_0x2fd4a2],'as':'Account'}]});})[_0xa24c('0x17')](function(_0x5774d2){if(_[_0xa24c('0x12')](_0x5774d2)){throw new Error(_0x292c22+_0xa24c('0x7b'));}_0x280fa2=_0x5774d2;return _0x5774d2[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4b848d={'uniqueid':_0x24b28c+'.'+_0x280fa2['id']+'.'+_0x280fa2[_0xa24c('0x6d')]['id'],'FromUserId':_0xd23eb3[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f'),'ToUserId':_0x12836d['id']};_0x4b848d[_0x292c22+_0xa24c('0x70')]=_0x280fa2['id'];_0x4b848d[_0x292c22+'InteractionId']=_0x280fa2[_0xa24c('0x6d')]['id'];_0x4b848d[_0xa24c('0x72')+_0x292c22+_0x2fd4a2+'Id']=_0x280fa2[_0xa24c('0x69')]['id'];return db[_0x292c22+_0xa24c('0x7c')][_0xa24c('0x7d')](_0x4b848d);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x24b28c,'interaction':_0x280fa2[_0xa24c('0x6d')],'message':_0x280fa2,'account':_0x280fa2[_0xa24c('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa24c('0x3c'),'appdata':_0x12836d[_0xa24c('0x30')]+','+(_0x280fa2[_0xa24c('0x69')][_0xa24c('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x890e15,null))[_0xa24c('0x1b')](handleError(_0x890e15,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 257ef29..7764481 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 _0x3182=['../../components/auth/service','./schedule.controller','index','get','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x3182,0x11c));var _0x2318=function(_0x5ef66a,_0x46e98e){_0x5ef66a=_0x5ef66a-0x0;var _0x73f45c=_0x3182[_0x5ef66a];return _0x73f45c;};'use strict';var multer=require(_0x2318('0x0'));var util=require(_0x2318('0x1'));var path=require(_0x2318('0x2'));var timeout=require(_0x2318('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2318('0x4'));var auth=require(_0x2318('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2318('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2318('0x7')]);router[_0x2318('0x8')]('/:id',auth[_0x2318('0x9')](),controller[_0x2318('0xa')]);router[_0x2318('0x8')]('/:id/run',auth[_0x2318('0x9')](),controller['run']);router[_0x2318('0xb')]('/',auth[_0x2318('0x9')](),controller[_0x2318('0xc')]);router['put']('/:id',auth[_0x2318('0x9')](),controller[_0x2318('0xd')]);router[_0x2318('0xe')]('/:id',auth[_0x2318('0x9')](),controller[_0x2318('0xf')]);module[_0x2318('0x10')]=router; \ No newline at end of file +var _0x8f7b=['get','/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f7b,0x197));var _0xb8f7=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x8f7b[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xb8f7('0x0'));var util=require('util');var path=require(_0xb8f7('0x1'));var timeout=require(_0xb8f7('0x2'));var express=require(_0xb8f7('0x3'));var router=express['Router']();var fs_extra=require(_0xb8f7('0x4'));var auth=require(_0xb8f7('0x5'));var interaction=require(_0xb8f7('0x6'));var config=require(_0xb8f7('0x7'));var controller=require(_0xb8f7('0x8'));router['get']('/',auth[_0xb8f7('0x9')](),controller[_0xb8f7('0xa')]);router[_0xb8f7('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb8f7('0xb')](_0xb8f7('0xc'),auth[_0xb8f7('0x9')](),controller[_0xb8f7('0xd')]);router[_0xb8f7('0xe')]('/',auth[_0xb8f7('0x9')](),controller[_0xb8f7('0xf')]);router[_0xb8f7('0x10')](_0xb8f7('0x11'),auth[_0xb8f7('0x9')](),controller[_0xb8f7('0x12')]);router[_0xb8f7('0x13')](_0xb8f7('0x11'),auth[_0xb8f7('0x9')](),controller[_0xb8f7('0x14')]);module[_0xb8f7('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 1b38d77..6a529b7 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 _0x1685=['weeks','days','hours','minutes','csv','pdf','xlsx','default','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months'];(function(_0x19e377,_0x4dbe7d){var _0x1bd5ea=function(_0x46a527){while(--_0x46a527){_0x19e377['push'](_0x19e377['shift']());}};_0x1bd5ea(++_0x4dbe7d);}(_0x1685,0x97));var _0x5168=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x1685[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x5168('0x0'));module[_0x5168('0x1')]={'name':{'type':Sequelize[_0x5168('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5168('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5168('0x2')],'allowNull':![],'defaultValue':_0x5168('0x3')},'startAt':{'type':Sequelize[_0x5168('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5168('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5168('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5168('0x6')]('years',_0x5168('0x7'),_0x5168('0x8'),_0x5168('0x9'),_0x5168('0xa'),_0x5168('0xb'),_0x5168('0xc')),'allowNull':![],'defaultValue':_0x5168('0xa')},'output':{'type':Sequelize[_0x5168('0x6')](_0x5168('0xd'),_0x5168('0xe'),_0x5168('0xf')),'allowNull':![],'defaultValue':_0x5168('0xd')},'type':{'type':Sequelize[_0x5168('0x6')]('custom',_0x5168('0x10')),'allowNull':![],'defaultValue':_0x5168('0x11')},'sendMail':{'type':Sequelize[_0x5168('0x12')],'defaultValue':![]},'email':{'type':Sequelize[_0x5168('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x5168('0x13')]},'sendIfEmpty':{'type':Sequelize[_0x5168('0x12')],'defaultValue':!![]}}; \ No newline at end of file +var _0x726b=['exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','hours','minutes','days','ENUM','pdf','xlsx','csv','custom','default','TEXT','sequelize'];(function(_0x17730a,_0x362127){var _0x485db1=function(_0x144233){while(--_0x144233){_0x17730a['push'](_0x17730a['shift']());}};_0x485db1(++_0x362127);}(_0x726b,0x1c7));var _0xb726=function(_0x43558a,_0x194e84){_0x43558a=_0x43558a-0x0;var _0x74e48e=_0x726b[_0x43558a];return _0x74e48e;};'use strict';var Sequelize=require(_0xb726('0x0'));module[_0xb726('0x1')]={'name':{'type':Sequelize[_0xb726('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb726('0x2')]},'active':{'type':Sequelize[_0xb726('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb726('0x2')],'allowNull':![],'defaultValue':_0xb726('0x4')},'startAt':{'type':Sequelize[_0xb726('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb726('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xb726('0x6'),_0xb726('0x7'),_0xb726('0x8'),'weeks','days',_0xb726('0x9'),_0xb726('0xa')),'allowNull':![],'defaultValue':_0xb726('0xb')},'output':{'type':Sequelize[_0xb726('0xc')]('csv',_0xb726('0xd'),_0xb726('0xe')),'allowNull':![],'defaultValue':_0xb726('0xf')},'type':{'type':Sequelize[_0xb726('0xc')](_0xb726('0x10'),_0xb726('0x11')),'allowNull':![],'defaultValue':_0xb726('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xb726('0x2')]},'cc':{'type':Sequelize[_0xb726('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xb726('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 6a55b5b..2a92135 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 _0x47b8=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','get','Scheduler','destroy','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis'];(function(_0x4e5b9a,_0x27cecc){var _0x44adb3=function(_0x548618){while(--_0x548618){_0x4e5b9a['push'](_0x4e5b9a['shift']());}};_0x44adb3(++_0x27cecc);}(_0x47b8,0xf1));var _0x847b=function(_0x56ef45,_0x40f56b){_0x56ef45=_0x56ef45-0x0;var _0x3dabd4=_0x47b8[_0x56ef45];return _0x3dabd4;};'use strict';var emlformat=require(_0x847b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x847b('0x1'));var jsonpatch=require(_0x847b('0x2'));var rp=require('request-promise');var moment=require(_0x847b('0x3'));var BPromise=require(_0x847b('0x4'));var Mustache=require(_0x847b('0x5'));var util=require(_0x847b('0x6'));var path=require(_0x847b('0x7'));var sox=require(_0x847b('0x8'));var csv=require(_0x847b('0x9'));var ejs=require(_0x847b('0xa'));var fs=require('fs');var fs_extra=require(_0x847b('0xb'));var _=require('lodash');var squel=require(_0x847b('0xc'));var crypto=require(_0x847b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x847b('0xe'));var Papa=require(_0x847b('0xf'));var Redis=require(_0x847b('0x10'));var authService=require(_0x847b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x847b('0x12'));var hardwareService=require(_0x847b('0x13'));var logger=require(_0x847b('0x14'))('api');var utils=require(_0x847b('0x15'));var config=require(_0x847b('0x16'));var licenseUtil=require(_0x847b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x263481,_0x56d6fe){_0x56d6fe=_0x56d6fe||0xcc;return function(_0x9050af){if(_0x9050af){return _0x263481[_0x847b('0x18')](_0x56d6fe);}return _0x263481[_0x847b('0x19')](_0x56d6fe)[_0x847b('0x1a')]();};}function respondWithResult(_0x1b7777,_0x89e880){_0x89e880=_0x89e880||0xc8;return function(_0x6a9034){if(_0x6a9034){return _0x1b7777[_0x847b('0x19')](_0x89e880)[_0x847b('0x1b')](_0x6a9034);}};}function respondWithFilteredResult(_0x433446,_0x1e5251){return function(_0x1544fe){if(_0x1544fe){var _0x4b87c3=typeof _0x1e5251['offset']==='undefined'&&typeof _0x1e5251[_0x847b('0x1c')]===_0x847b('0x1d');var _0x480964=_0x1544fe[_0x847b('0x1e')];var _0x2a903c=_0x4b87c3?0x0:_0x1e5251[_0x847b('0x1f')];var _0x518ae7=_0x4b87c3?_0x1544fe[_0x847b('0x1e')]:_0x1e5251[_0x847b('0x1f')]+_0x1e5251[_0x847b('0x1c')];var _0x355d4;if(_0x518ae7>=_0x480964){_0x518ae7=_0x480964;_0x355d4=0xc8;}else{_0x355d4=0xce;}_0x433446['status'](_0x355d4);return _0x433446[_0x847b('0x20')](_0x847b('0x21'),_0x2a903c+'-'+_0x518ae7+'/'+_0x480964)[_0x847b('0x1b')](_0x1544fe);}return null;};}function patchUpdates(_0x1819d8){return function(_0x2e9d65){try{jsonpatch[_0x847b('0x22')](_0x2e9d65,_0x1819d8,!![]);}catch(_0xdeb27f){return BPromise[_0x847b('0x23')](_0xdeb27f);}return _0x2e9d65[_0x847b('0x24')]();};}function saveUpdates(_0x44d37c,_0x4e33b0){return function(_0x4ea7a6){if(_0x4ea7a6){return _0x4ea7a6[_0x847b('0x25')](_0x44d37c)['then'](function(_0x526402){return _0x526402;});}return null;};}function removeEntity(_0x4197ef,_0xdeac3f){return function(_0x223d51){if(_0x223d51){return _0x223d51['destroy']()[_0x847b('0x26')](function(){var _0x408b54=_0x223d51[_0x847b('0x27')]({'plain':!![]});var _0x54bfda=_0x847b('0x28');return db['UserProfileResource'][_0x847b('0x29')]({'where':{'type':_0x54bfda,'resourceId':_0x408b54['id']}})['then'](function(){return _0x223d51;});})[_0x847b('0x26')](function(){_0x4197ef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x372efc,_0x408a49){return function(_0x521ff9){if(!_0x521ff9){_0x372efc[_0x847b('0x18')](0x194);}return _0x521ff9;};}function handleError(_0x9486c5,_0x46caee){_0x46caee=_0x46caee||0x1f4;return function(_0x2edc98){logger['error'](_0x2edc98['stack']);if(_0x2edc98['name']){delete _0x2edc98[_0x847b('0x2a')];}_0x9486c5[_0x847b('0x19')](_0x46caee)[_0x847b('0x2b')](_0x2edc98);};}exports[_0x847b('0x2c')]=function(_0x10976c,_0x4be801){var _0x2780c0={},_0x281112={},_0x27b5fc={'count':0x0,'rows':[]};var _0x1fe598=_[_0x847b('0x2d')](db[_0x847b('0x2e')][_0x847b('0x2f')],function(_0x5119b6){return{'name':_0x5119b6[_0x847b('0x30')],'type':_0x5119b6['type'][_0x847b('0x31')]};});_0x281112[_0x847b('0x32')]=_[_0x847b('0x2d')](_0x1fe598,_0x847b('0x2a'));_0x281112[_0x847b('0x33')]=_['keys'](_0x10976c[_0x847b('0x33')]);_0x281112[_0x847b('0x34')]=_['intersection'](_0x281112[_0x847b('0x32')],_0x281112['query']);_0x2780c0[_0x847b('0x35')]=_[_0x847b('0x36')](_0x281112[_0x847b('0x32')],qs[_0x847b('0x37')](_0x10976c[_0x847b('0x33')][_0x847b('0x37')]));_0x2780c0[_0x847b('0x35')]=_0x2780c0[_0x847b('0x35')][_0x847b('0x38')]?_0x2780c0[_0x847b('0x35')]:_0x281112['model'];if(!_0x10976c['query'][_0x847b('0x39')](_0x847b('0x3a'))){_0x2780c0['limit']=qs['limit'](_0x10976c[_0x847b('0x33')][_0x847b('0x1c')]);_0x2780c0[_0x847b('0x1f')]=qs[_0x847b('0x1f')](_0x10976c[_0x847b('0x33')][_0x847b('0x1f')]);}_0x2780c0[_0x847b('0x3b')]=qs['sort'](_0x10976c[_0x847b('0x33')]['sort']);_0x2780c0[_0x847b('0x3c')]=qs['filters'](_[_0x847b('0x3d')](_0x10976c['query'],_0x281112[_0x847b('0x34')]),_0x1fe598);if(_0x10976c[_0x847b('0x33')]['filter']){_0x2780c0[_0x847b('0x3c')]=_[_0x847b('0x3e')](_0x2780c0[_0x847b('0x3c')],{'$or':_[_0x847b('0x2d')](_0x1fe598,function(_0x833590){if(_0x833590[_0x847b('0x3f')]!=='VIRTUAL'){var _0x4053e2={};_0x4053e2[_0x833590[_0x847b('0x2a')]]={'$like':'%'+_0x10976c[_0x847b('0x33')][_0x847b('0x40')]+'%'};return _0x4053e2;}})});}_0x2780c0=_[_0x847b('0x3e')]({},_0x2780c0,_0x10976c[_0x847b('0x41')]);var _0x5b96e7={'where':_0x2780c0[_0x847b('0x3c')]};return db['Schedule'][_0x847b('0x1e')](_0x5b96e7)[_0x847b('0x26')](function(_0x39834c){_0x27b5fc[_0x847b('0x1e')]=_0x39834c;if(_0x10976c['query'][_0x847b('0x42')]){_0x2780c0[_0x847b('0x43')]=[{'all':!![]}];}return db[_0x847b('0x2e')][_0x847b('0x44')](_0x2780c0);})[_0x847b('0x26')](function(_0x4372f7){_0x27b5fc[_0x847b('0x45')]=_0x4372f7;return _0x27b5fc;})[_0x847b('0x26')](respondWithFilteredResult(_0x4be801,_0x2780c0))[_0x847b('0x46')](handleError(_0x4be801,null));};exports['show']=function(_0x1ad935,_0x1accdb){var _0x5c4645={'raw':![],'where':{'id':_0x1ad935[_0x847b('0x47')]['id']}},_0x442f34={};_0x442f34['model']=_[_0x847b('0x48')](db[_0x847b('0x2e')][_0x847b('0x2f')]);_0x442f34[_0x847b('0x33')]=_[_0x847b('0x48')](_0x1ad935[_0x847b('0x33')]);_0x442f34[_0x847b('0x34')]=_['intersection'](_0x442f34[_0x847b('0x32')],_0x442f34['query']);_0x5c4645[_0x847b('0x35')]=_[_0x847b('0x36')](_0x442f34[_0x847b('0x32')],qs[_0x847b('0x37')](_0x1ad935[_0x847b('0x33')]['fields']));_0x5c4645[_0x847b('0x35')]=_0x5c4645[_0x847b('0x35')][_0x847b('0x38')]?_0x5c4645[_0x847b('0x35')]:_0x442f34['model'];if(_0x1ad935[_0x847b('0x33')]['includeAll']){_0x5c4645['include']=[{'all':!![]}];}_0x5c4645=_[_0x847b('0x3e')]({},_0x5c4645,_0x1ad935[_0x847b('0x41')]);return db[_0x847b('0x2e')][_0x847b('0x49')](_0x5c4645)['then'](handleEntityNotFound(_0x1accdb,null))[_0x847b('0x26')](respondWithResult(_0x1accdb,null))[_0x847b('0x46')](handleError(_0x1accdb,null));};exports[_0x847b('0x4a')]=function(_0x77da3c,_0x22cd1c){return db[_0x847b('0x2e')][_0x847b('0x4a')](_0x77da3c[_0x847b('0x4b')],{})[_0x847b('0x26')](function(_0x2ecd08){var _0x87c065=_0x77da3c['user']['get']({'plain':!![]});if(!_0x87c065)throw new Error(_0x847b('0x4c'));if(_0x87c065[_0x847b('0x4d')]==='user'){var _0x318efd=_0x2ecd08[_0x847b('0x27')]({'plain':!![]});var _0xeedf42=_0x847b('0x28');return db[_0x847b('0x4e')][_0x847b('0x49')]({'where':{'name':_0xeedf42,'userProfileId':_0x87c065[_0x847b('0x4f')]},'raw':!![]})[_0x847b('0x26')](function(_0x559f92){if(_0x559f92&&_0x559f92[_0x847b('0x50')]===0x0){return db[_0x847b('0x51')][_0x847b('0x4a')]({'name':_0x318efd[_0x847b('0x2a')],'resourceId':_0x318efd['id'],'type':_0x559f92[_0x847b('0x2a')],'sectionId':_0x559f92['id']},{})[_0x847b('0x26')](function(){return _0x2ecd08;});}else{return _0x2ecd08;}})['catch'](function(_0x115c74){logger[_0x847b('0x52')](_0x847b('0x53'),_0x115c74);throw _0x115c74;});}return _0x2ecd08;})['then'](respondWithResult(_0x22cd1c,0xc9))[_0x847b('0x46')](handleError(_0x22cd1c,null));};exports[_0x847b('0x25')]=function(_0x3b19cc,_0x5529d2){if(_0x3b19cc['body']['id']){delete _0x3b19cc[_0x847b('0x4b')]['id'];}return db[_0x847b('0x2e')][_0x847b('0x49')]({'where':{'id':_0x3b19cc[_0x847b('0x47')]['id']}})[_0x847b('0x26')](handleEntityNotFound(_0x5529d2,null))[_0x847b('0x26')](saveUpdates(_0x3b19cc[_0x847b('0x4b')],null))['then'](respondWithResult(_0x5529d2,null))[_0x847b('0x46')](handleError(_0x5529d2,null));};exports[_0x847b('0x29')]=function(_0x53b5e1,_0x5a3519){return db[_0x847b('0x2e')][_0x847b('0x49')]({'where':{'id':_0x53b5e1[_0x847b('0x47')]['id']}})[_0x847b('0x26')](handleEntityNotFound(_0x5a3519,null))[_0x847b('0x26')](removeEntity(_0x5a3519,null))[_0x847b('0x46')](handleError(_0x5a3519,null));};exports['run']=function(_0x1c0cec,_0x3356ef,_0x596a70){var _0x347f1e=require(_0x847b('0x54'));return db[_0x847b('0x2e')]['find']({'where':{'id':_0x1c0cec[_0x847b('0x47')]['id']},'raw':!![]})[_0x847b('0x26')](handleEntityNotFound(_0x3356ef,null))[_0x847b('0x26')](function(){_0x347f1e[_0x847b('0x55')](_0x1c0cec[_0x847b('0x47')]['id']);})['then'](respondWithStatusCode(_0x3356ef,null))['catch'](handleError(_0x3356ef,null));}; \ No newline at end of file +var _0xea55=['undefined','limit','count','set','Content-Range','apply','save','destroy','then','UserProfileResource','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','create','user','get','role','Scheduler','UserProfileSection','find','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset'];(function(_0x53a34c,_0x25cffd){var _0x3dda74=function(_0x559ccd){while(--_0x559ccd){_0x53a34c['push'](_0x53a34c['shift']());}};_0x3dda74(++_0x25cffd);}(_0xea55,0x8d));var _0x5ea5=function(_0x5a214d,_0x344cb6){_0x5a214d=_0x5a214d-0x0;var _0x344314=_0xea55[_0x5a214d];return _0x344314;};'use strict';var emlformat=require(_0x5ea5('0x0'));var rimraf=require(_0x5ea5('0x1'));var zipdir=require(_0x5ea5('0x2'));var jsonpatch=require(_0x5ea5('0x3'));var rp=require('request-promise');var moment=require(_0x5ea5('0x4'));var BPromise=require(_0x5ea5('0x5'));var Mustache=require(_0x5ea5('0x6'));var util=require(_0x5ea5('0x7'));var path=require(_0x5ea5('0x8'));var sox=require(_0x5ea5('0x9'));var csv=require(_0x5ea5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ea5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ea5('0xc'));var deskjs=require(_0x5ea5('0xd'));var toCsv=require(_0x5ea5('0xa'));var querystring=require(_0x5ea5('0xe'));var Papa=require(_0x5ea5('0xf'));var Redis=require(_0x5ea5('0x10'));var authService=require(_0x5ea5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5ea5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5ea5('0x13'));var utils=require(_0x5ea5('0x14'));var config=require(_0x5ea5('0x15'));var licenseUtil=require(_0x5ea5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xff7ceb,_0x39737e){_0x39737e=_0x39737e||0xcc;return function(_0x3326a0){if(_0x3326a0){return _0xff7ceb['sendStatus'](_0x39737e);}return _0xff7ceb[_0x5ea5('0x17')](_0x39737e)[_0x5ea5('0x18')]();};}function respondWithResult(_0x72d152,_0x351089){_0x351089=_0x351089||0xc8;return function(_0x585755){if(_0x585755){return _0x72d152[_0x5ea5('0x17')](_0x351089)[_0x5ea5('0x19')](_0x585755);}};}function respondWithFilteredResult(_0xbc45d8,_0x4f2239){return function(_0x2a757d){if(_0x2a757d){var _0x4aded9=typeof _0x4f2239[_0x5ea5('0x1a')]===_0x5ea5('0x1b')&&typeof _0x4f2239[_0x5ea5('0x1c')]==='undefined';var _0x363183=_0x2a757d[_0x5ea5('0x1d')];var _0x226c30=_0x4aded9?0x0:_0x4f2239['offset'];var _0x19d900=_0x4aded9?_0x2a757d[_0x5ea5('0x1d')]:_0x4f2239['offset']+_0x4f2239[_0x5ea5('0x1c')];var _0x57a860;if(_0x19d900>=_0x363183){_0x19d900=_0x363183;_0x57a860=0xc8;}else{_0x57a860=0xce;}_0xbc45d8['status'](_0x57a860);return _0xbc45d8[_0x5ea5('0x1e')](_0x5ea5('0x1f'),_0x226c30+'-'+_0x19d900+'/'+_0x363183)['json'](_0x2a757d);}return null;};}function patchUpdates(_0x4e5274){return function(_0x3c6c8f){try{jsonpatch[_0x5ea5('0x20')](_0x3c6c8f,_0x4e5274,!![]);}catch(_0x595e7d){return BPromise['reject'](_0x595e7d);}return _0x3c6c8f[_0x5ea5('0x21')]();};}function saveUpdates(_0x1d9d84,_0x483e39){return function(_0x169ba5){if(_0x169ba5){return _0x169ba5['update'](_0x1d9d84)['then'](function(_0x442de3){return _0x442de3;});}return null;};}function removeEntity(_0x237ecd,_0x479dcf){return function(_0x312439){if(_0x312439){return _0x312439[_0x5ea5('0x22')]()[_0x5ea5('0x23')](function(){var _0x34232e=_0x312439['get']({'plain':!![]});var _0x9ad8c8='Scheduler';return db[_0x5ea5('0x24')][_0x5ea5('0x22')]({'where':{'type':_0x9ad8c8,'resourceId':_0x34232e['id']}})[_0x5ea5('0x23')](function(){return _0x312439;});})[_0x5ea5('0x23')](function(){_0x237ecd[_0x5ea5('0x17')](0xcc)[_0x5ea5('0x18')]();});}};}function handleEntityNotFound(_0x44b774,_0x1717a3){return function(_0x28ea8a){if(!_0x28ea8a){_0x44b774['sendStatus'](0x194);}return _0x28ea8a;};}function handleError(_0x34311e,_0x11f610){_0x11f610=_0x11f610||0x1f4;return function(_0x3171ee){logger['error'](_0x3171ee['stack']);if(_0x3171ee[_0x5ea5('0x25')]){delete _0x3171ee['name'];}_0x34311e[_0x5ea5('0x17')](_0x11f610)[_0x5ea5('0x26')](_0x3171ee);};}exports[_0x5ea5('0x27')]=function(_0x12fa50,_0x39d146){var _0x4684ca={},_0x2f85a0={},_0x5047e4={'count':0x0,'rows':[]};var _0x920fa2=_[_0x5ea5('0x28')](db[_0x5ea5('0x29')][_0x5ea5('0x2a')],function(_0x595f2b){return{'name':_0x595f2b[_0x5ea5('0x2b')],'type':_0x595f2b[_0x5ea5('0x2c')][_0x5ea5('0x2d')]};});_0x2f85a0[_0x5ea5('0x2e')]=_[_0x5ea5('0x28')](_0x920fa2,_0x5ea5('0x25'));_0x2f85a0[_0x5ea5('0x2f')]=_['keys'](_0x12fa50[_0x5ea5('0x2f')]);_0x2f85a0[_0x5ea5('0x30')]=_[_0x5ea5('0x31')](_0x2f85a0['model'],_0x2f85a0[_0x5ea5('0x2f')]);_0x4684ca[_0x5ea5('0x32')]=_[_0x5ea5('0x31')](_0x2f85a0[_0x5ea5('0x2e')],qs[_0x5ea5('0x33')](_0x12fa50[_0x5ea5('0x2f')][_0x5ea5('0x33')]));_0x4684ca['attributes']=_0x4684ca[_0x5ea5('0x32')][_0x5ea5('0x34')]?_0x4684ca[_0x5ea5('0x32')]:_0x2f85a0[_0x5ea5('0x2e')];if(!_0x12fa50['query'][_0x5ea5('0x35')](_0x5ea5('0x36'))){_0x4684ca[_0x5ea5('0x1c')]=qs[_0x5ea5('0x1c')](_0x12fa50[_0x5ea5('0x2f')][_0x5ea5('0x1c')]);_0x4684ca[_0x5ea5('0x1a')]=qs[_0x5ea5('0x1a')](_0x12fa50[_0x5ea5('0x2f')][_0x5ea5('0x1a')]);}_0x4684ca[_0x5ea5('0x37')]=qs[_0x5ea5('0x38')](_0x12fa50[_0x5ea5('0x2f')][_0x5ea5('0x38')]);_0x4684ca[_0x5ea5('0x39')]=qs['filters'](_[_0x5ea5('0x3a')](_0x12fa50[_0x5ea5('0x2f')],_0x2f85a0['filters']),_0x920fa2);if(_0x12fa50['query'][_0x5ea5('0x3b')]){_0x4684ca[_0x5ea5('0x39')]=_['merge'](_0x4684ca[_0x5ea5('0x39')],{'$or':_[_0x5ea5('0x28')](_0x920fa2,function(_0xd2fc4f){if(_0xd2fc4f['type']!==_0x5ea5('0x3c')){var _0x5121a3={};_0x5121a3[_0xd2fc4f['name']]={'$like':'%'+_0x12fa50['query'][_0x5ea5('0x3b')]+'%'};return _0x5121a3;}})});}_0x4684ca=_[_0x5ea5('0x3d')]({},_0x4684ca,_0x12fa50[_0x5ea5('0x3e')]);var _0x176078={'where':_0x4684ca[_0x5ea5('0x39')]};return db['Schedule']['count'](_0x176078)[_0x5ea5('0x23')](function(_0x2654c1){_0x5047e4[_0x5ea5('0x1d')]=_0x2654c1;if(_0x12fa50[_0x5ea5('0x2f')][_0x5ea5('0x3f')]){_0x4684ca[_0x5ea5('0x40')]=[{'all':!![]}];}return db['Schedule'][_0x5ea5('0x41')](_0x4684ca);})[_0x5ea5('0x23')](function(_0x3700f3){_0x5047e4[_0x5ea5('0x42')]=_0x3700f3;return _0x5047e4;})[_0x5ea5('0x23')](respondWithFilteredResult(_0x39d146,_0x4684ca))['catch'](handleError(_0x39d146,null));};exports[_0x5ea5('0x43')]=function(_0x414440,_0x22154c){var _0x1000ad={'raw':![],'where':{'id':_0x414440['params']['id']}},_0x41727f={};_0x41727f[_0x5ea5('0x2e')]=_[_0x5ea5('0x44')](db[_0x5ea5('0x29')][_0x5ea5('0x2a')]);_0x41727f['query']=_[_0x5ea5('0x44')](_0x414440['query']);_0x41727f[_0x5ea5('0x30')]=_[_0x5ea5('0x31')](_0x41727f['model'],_0x41727f[_0x5ea5('0x2f')]);_0x1000ad['attributes']=_['intersection'](_0x41727f['model'],qs[_0x5ea5('0x33')](_0x414440[_0x5ea5('0x2f')][_0x5ea5('0x33')]));_0x1000ad[_0x5ea5('0x32')]=_0x1000ad['attributes'][_0x5ea5('0x34')]?_0x1000ad['attributes']:_0x41727f['model'];if(_0x414440[_0x5ea5('0x2f')][_0x5ea5('0x3f')]){_0x1000ad['include']=[{'all':!![]}];}_0x1000ad=_[_0x5ea5('0x3d')]({},_0x1000ad,_0x414440[_0x5ea5('0x3e')]);return db[_0x5ea5('0x29')]['find'](_0x1000ad)[_0x5ea5('0x23')](handleEntityNotFound(_0x22154c,null))[_0x5ea5('0x23')](respondWithResult(_0x22154c,null))['catch'](handleError(_0x22154c,null));};exports[_0x5ea5('0x45')]=function(_0x2301ab,_0x2441f7){return db[_0x5ea5('0x29')][_0x5ea5('0x45')](_0x2301ab['body'],{})[_0x5ea5('0x23')](function(_0x30add){var _0x4f81c8=_0x2301ab[_0x5ea5('0x46')][_0x5ea5('0x47')]({'plain':!![]});if(!_0x4f81c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f81c8[_0x5ea5('0x48')]===_0x5ea5('0x46')){var _0x4ea0e9=_0x30add[_0x5ea5('0x47')]({'plain':!![]});var _0x5c1f2f=_0x5ea5('0x49');return db[_0x5ea5('0x4a')][_0x5ea5('0x4b')]({'where':{'name':_0x5c1f2f,'userProfileId':_0x4f81c8[_0x5ea5('0x4c')]},'raw':!![]})[_0x5ea5('0x23')](function(_0x18d596){if(_0x18d596&&_0x18d596['autoAssociation']===0x0){return db[_0x5ea5('0x24')][_0x5ea5('0x45')]({'name':_0x4ea0e9[_0x5ea5('0x25')],'resourceId':_0x4ea0e9['id'],'type':_0x18d596[_0x5ea5('0x25')],'sectionId':_0x18d596['id']},{})['then'](function(){return _0x30add;});}else{return _0x30add;}})[_0x5ea5('0x4d')](function(_0x584e46){logger[_0x5ea5('0x4e')](_0x5ea5('0x4f'),_0x584e46);throw _0x584e46;});}return _0x30add;})[_0x5ea5('0x23')](respondWithResult(_0x2441f7,0xc9))['catch'](handleError(_0x2441f7,null));};exports['update']=function(_0x16615e,_0x794b8a){if(_0x16615e[_0x5ea5('0x50')]['id']){delete _0x16615e[_0x5ea5('0x50')]['id'];}return db['Schedule'][_0x5ea5('0x4b')]({'where':{'id':_0x16615e[_0x5ea5('0x51')]['id']}})[_0x5ea5('0x23')](handleEntityNotFound(_0x794b8a,null))[_0x5ea5('0x23')](saveUpdates(_0x16615e['body'],null))[_0x5ea5('0x23')](respondWithResult(_0x794b8a,null))[_0x5ea5('0x4d')](handleError(_0x794b8a,null));};exports['destroy']=function(_0x4fcddc,_0x26e979){return db[_0x5ea5('0x29')][_0x5ea5('0x4b')]({'where':{'id':_0x4fcddc['params']['id']}})[_0x5ea5('0x23')](handleEntityNotFound(_0x26e979,null))['then'](removeEntity(_0x26e979,null))['catch'](handleError(_0x26e979,null));};exports['run']=function(_0x1e74af,_0x2fd973,_0x25e5b8){var _0x309a88=require(_0x5ea5('0x52'));return db[_0x5ea5('0x29')][_0x5ea5('0x4b')]({'where':{'id':_0x1e74af['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2fd973,null))[_0x5ea5('0x23')](function(){_0x309a88[_0x5ea5('0x53')](_0x1e74af['params']['id']);})[_0x5ea5('0x23')](respondWithStatusCode(_0x2fd973,null))[_0x5ea5('0x4d')](handleError(_0x2fd973,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 238bd9f..e369b8f 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 _0xb8d9=['rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','util','moment','bluebird','request-promise','path'];(function(_0x306760,_0x1a5492){var _0x48e68d=function(_0x5464d8){while(--_0x5464d8){_0x306760['push'](_0x306760['shift']());}};_0x48e68d(++_0x1a5492);}(_0xb8d9,0xd7));var _0x9b8d=function(_0x52e1f8,_0x8bb901){_0x52e1f8=_0x52e1f8-0x0;var _0x5c699b=_0xb8d9[_0x52e1f8];return _0x5c699b;};'use strict';var _=require('lodash');var util=require(_0x9b8d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9b8d('0x1'));var BPromise=require(_0x9b8d('0x2'));var rp=require(_0x9b8d('0x3'));var fs=require('fs');var path=require(_0x9b8d('0x4'));var rimraf=require(_0x9b8d('0x5'));var config=require(_0x9b8d('0x6'));var attributes=require(_0x9b8d('0x7'));module['exports']=function(_0x4c0e7c,_0x20648a){return _0x4c0e7c[_0x9b8d('0x8')](_0x9b8d('0x9'),attributes,{'tableName':_0x9b8d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc263=['request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x349809,_0x55ffdd){var _0x32e2f8=function(_0x23ee5e){while(--_0x23ee5e){_0x349809['push'](_0x349809['shift']());}};_0x32e2f8(++_0x55ffdd);}(_0xc263,0x15c));var _0x3c26=function(_0x1123e4,_0x174cb5){_0x1123e4=_0x1123e4-0x0;var _0x896d76=_0xc263[_0x1123e4];return _0x896d76;};'use strict';var _=require(_0x3c26('0x0'));var util=require(_0x3c26('0x1'));var logger=require(_0x3c26('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3c26('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c26('0x4'));var config=require(_0x3c26('0x5'));var attributes=require(_0x3c26('0x6'));module[_0x3c26('0x7')]=function(_0x5313e1,_0xc3e73b){return _0x5313e1[_0x3c26('0x8')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 20efd3c..d53ac10 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 _0x1eb5=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1eb5,0x1ea));var _0x51eb=function(_0x6a4600,_0xd66588){_0x6a4600=_0x6a4600-0x0;var _0x354544=_0x1eb5[_0x6a4600];return _0x354544;};'use strict';var _=require('lodash');var util=require(_0x51eb('0x0'));var moment=require(_0x51eb('0x1'));var BPromise=require('bluebird');var rs=require(_0x51eb('0x2'));var fs=require('fs');var Redis=require(_0x51eb('0x3'));var db=require(_0x51eb('0x4'))['db'];var utils=require(_0x51eb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x51eb('0x6'));var jayson=require(_0x51eb('0x7'));var client=jayson['client'][_0x51eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9ae382,_0x129b1b,_0x5b7caf){return new BPromise(function(_0x2040eb,_0xb6b1a2){return client['request'](_0x9ae382,_0x5b7caf)[_0x51eb('0x9')](function(_0x2be185){logger[_0x51eb('0xa')](_0x51eb('0xb'),_0x129b1b,_0x51eb('0xc'));logger[_0x51eb('0xd')](_0x51eb('0xe'),_0x129b1b,_0x51eb('0xc'),JSON[_0x51eb('0xf')](_0x2be185));if(_0x2be185[_0x51eb('0x10')]){if(_0x2be185[_0x51eb('0x10')][_0x51eb('0x11')]===0x1f4){logger[_0x51eb('0x10')]('Schedule,\x20%s,\x20%s',_0x129b1b,_0x2be185['error'][_0x51eb('0x12')]);return _0xb6b1a2(_0x2be185[_0x51eb('0x10')]['message']);}logger[_0x51eb('0x10')](_0x51eb('0xb'),_0x129b1b,_0x2be185[_0x51eb('0x10')][_0x51eb('0x12')]);return _0x2040eb(_0x2be185[_0x51eb('0x10')]['message']);}else{logger[_0x51eb('0xa')](_0x51eb('0xb'),_0x129b1b,'request\x20sent');_0x2040eb(_0x2be185[_0x51eb('0x13')][_0x51eb('0x12')]);}})[_0x51eb('0x14')](function(_0x2a3c74){logger[_0x51eb('0x10')](_0x51eb('0xb'),_0x129b1b,_0x2a3c74);_0xb6b1a2(_0x2a3c74);});});} \ No newline at end of file +var _0x7d3f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x35643e,_0x145ea3){var _0x1a44f8=function(_0x467637){while(--_0x467637){_0x35643e['push'](_0x35643e['shift']());}};_0x1a44f8(++_0x145ea3);}(_0x7d3f,0x124));var _0xf7d3=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x7d3f[_0x34bd34];return _0x4e36d6;};'use strict';var _=require(_0xf7d3('0x0'));var util=require(_0xf7d3('0x1'));var moment=require(_0xf7d3('0x2'));var BPromise=require(_0xf7d3('0x3'));var rs=require(_0xf7d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7d3('0x5'))['db'];var utils=require(_0xf7d3('0x6'));var logger=require(_0xf7d3('0x7'))(_0xf7d3('0x8'));var config=require(_0xf7d3('0x9'));var jayson=require(_0xf7d3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x391ce3,_0x4c6f6e,_0x5a3418){return new BPromise(function(_0x2d9ef9,_0x17255f){return client[_0xf7d3('0xb')](_0x391ce3,_0x5a3418)['then'](function(_0x3545e3){logger[_0xf7d3('0xc')](_0xf7d3('0xd'),_0x4c6f6e,_0xf7d3('0xe'));logger[_0xf7d3('0xf')](_0xf7d3('0x10'),_0x4c6f6e,'request\x20sent',JSON[_0xf7d3('0x11')](_0x3545e3));if(_0x3545e3['error']){if(_0x3545e3['error'][_0xf7d3('0x12')]===0x1f4){logger[_0xf7d3('0x13')](_0xf7d3('0xd'),_0x4c6f6e,_0x3545e3[_0xf7d3('0x13')]['message']);return _0x17255f(_0x3545e3['error'][_0xf7d3('0x14')]);}logger[_0xf7d3('0x13')](_0xf7d3('0xd'),_0x4c6f6e,_0x3545e3[_0xf7d3('0x13')][_0xf7d3('0x14')]);return _0x2d9ef9(_0x3545e3['error']['message']);}else{logger['info'](_0xf7d3('0xd'),_0x4c6f6e,_0xf7d3('0xe'));_0x2d9ef9(_0x3545e3[_0xf7d3('0x15')]['message']);}})[_0xf7d3('0x16')](function(_0x53bba5){logger[_0xf7d3('0x13')](_0xf7d3('0xd'),_0x4c6f6e,_0x53bba5);_0x17255f(_0x53bba5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 5fba6fc..ef60f41 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 _0xe7f6=['../../components/auth/service','get','index','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','delete','destroy','util','connect-timeout','express','fs-extra'];(function(_0x49d1a,_0x20c151){var _0x4c4b1c=function(_0x402833){while(--_0x402833){_0x49d1a['push'](_0x49d1a['shift']());}};_0x4c4b1c(++_0x20c151);}(_0xe7f6,0x1c7));var _0x6e7f=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xe7f6[_0x1b2422];return _0x376573;};'use strict';var multer=require('multer');var util=require(_0x6e7f('0x0'));var path=require('path');var timeout=require(_0x6e7f('0x1'));var express=require(_0x6e7f('0x2'));var router=express['Router']();var fs_extra=require(_0x6e7f('0x3'));var auth=require(_0x6e7f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x6e7f('0x5')]('/',auth['isAuthenticated'](),controller[_0x6e7f('0x6')]);router[_0x6e7f('0x5')]('/describe',auth[_0x6e7f('0x7')](),controller[_0x6e7f('0x8')]);router[_0x6e7f('0x5')](_0x6e7f('0x9'),auth['isAuthenticated'](),controller[_0x6e7f('0xa')]);router['get'](_0x6e7f('0xb'),auth['isAuthenticated'](),controller[_0x6e7f('0xc')]);router[_0x6e7f('0xd')]('/',auth['isAuthenticated'](),controller[_0x6e7f('0xe')]);router['put']('/:id',auth[_0x6e7f('0x7')](),controller['update']);router[_0x6e7f('0xf')](_0x6e7f('0x9'),auth[_0x6e7f('0x7')](),controller[_0x6e7f('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5a25=['express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','delete','destroy','util','connect-timeout'];(function(_0x18c1b7,_0x4b7ec1){var _0x1fe258=function(_0xcdabb7){while(--_0xcdabb7){_0x18c1b7['push'](_0x18c1b7['shift']());}};_0x1fe258(++_0x4b7ec1);}(_0x5a25,0x11f));var _0x55a2=function(_0x432b47,_0x24d3b7){_0x432b47=_0x432b47-0x0;var _0xb74e85=_0x5a25[_0x432b47];return _0xb74e85;};'use strict';var multer=require('multer');var util=require(_0x55a2('0x0'));var path=require('path');var timeout=require(_0x55a2('0x1'));var express=require(_0x55a2('0x2'));var router=express['Router']();var fs_extra=require(_0x55a2('0x3'));var auth=require(_0x55a2('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x55a2('0x5')]('/',auth[_0x55a2('0x6')](),controller[_0x55a2('0x7')]);router[_0x55a2('0x5')]('/describe',auth[_0x55a2('0x6')](),controller['describe']);router[_0x55a2('0x5')](_0x55a2('0x8'),auth[_0x55a2('0x6')](),controller[_0x55a2('0x9')]);router[_0x55a2('0x5')](_0x55a2('0xa'),auth[_0x55a2('0x6')](),controller[_0x55a2('0xb')]);router[_0x55a2('0xc')]('/',auth[_0x55a2('0x6')](),controller[_0x55a2('0xd')]);router[_0x55a2('0xe')](_0x55a2('0x8'),auth[_0x55a2('0x6')](),controller['update']);router[_0x55a2('0xf')](_0x55a2('0x8'),auth['isAuthenticated'](),controller[_0x55a2('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 48f9dd1..c2fa042 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 _0x5464=['startedAt','closedAt','DATE','format','toString','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','exports','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER'];(function(_0x403237,_0x4c9b77){var _0x5df195=function(_0xa97c44){while(--_0xa97c44){_0x403237['push'](_0x403237['shift']());}};_0x5df195(++_0x4c9b77);}(_0x5464,0x15d));var _0x4546=function(_0x132b06,_0x38c964){_0x132b06=_0x132b06-0x0;var _0x1ed430=_0x5464[_0x132b06];return _0x1ed430;};'use strict';var Sequelize=require(_0x4546('0x0'));var moment=require(_0x4546('0x1'));var path=require(_0x4546('0x2'));var config=require('../../config/environment');module[_0x4546('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4546('0x4')]('value')?path[_0x4546('0x5')](this[_0x4546('0x4')](_0x4546('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x4546('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x5c5e09){var _0x224c7c=_0x5c5e09[_0x4546('0x8')](/\\/g,'/');this[_0x4546('0x9')](_0x4546('0x6'),_0x224c7c);}},'rating':{'type':Sequelize[_0x4546('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4546('0xa')],'set':function(_0x11d63e){this[_0x4546('0x9')](_0x4546('0xb'),moment()['subtract'](_0x11d63e,'ms'));this[_0x4546('0x9')](_0x4546('0xc'),moment());this[_0x4546('0x9')]('duration',_0x11d63e);}},'startedAt':{'type':Sequelize[_0x4546('0xd')],'get':function(){return moment(this[_0x4546('0x4')](_0x4546('0xb')))[_0x4546('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0x4546('0xd')],'get':function(){return moment(this['getDataValue']('closedAt'))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4546('0x4')]('createdAt'))[_0x4546('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x4546('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4546('0x4')](_0x4546('0x10')))[_0x4546('0xe')](_0x4546('0x11'))[_0x4546('0xf')]();}}}; \ No newline at end of file +var _0x556a=['getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','DATE','toString','createdAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL'];(function(_0x42aabd,_0x217ade){var _0x2e83fb=function(_0x1508d8){while(--_0x1508d8){_0x42aabd['push'](_0x42aabd['shift']());}};_0x2e83fb(++_0x217ade);}(_0x556a,0x1dd));var _0xa556=function(_0x581a90,_0x4bad2a){_0x581a90=_0x581a90-0x0;var _0x4b709d=_0x556a[_0x581a90];return _0x4b709d;};'use strict';var Sequelize=require(_0xa556('0x0'));var moment=require(_0xa556('0x1'));var path=require(_0xa556('0x2'));var config=require(_0xa556('0x3'));module[_0xa556('0x4')]={'format':{'type':Sequelize[_0xa556('0x5')],'get':function(){return this[_0xa556('0x6')](_0xa556('0x7'))?path[_0xa556('0x8')](this['getDataValue'](_0xa556('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xa556('0x9')]},'channel':{'type':Sequelize[_0xa556('0x9')]},'value':{'type':Sequelize[_0xa556('0x9')],'set':function(_0x358b8c){var _0x5a745c=_0x358b8c[_0xa556('0xa')](/\\/g,'/');this[_0xa556('0xb')](_0xa556('0x7'),_0x5a745c);}},'rating':{'type':Sequelize[_0xa556('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x44ea8e){this[_0xa556('0xb')](_0xa556('0xd'),moment()[_0xa556('0xe')](_0x44ea8e,'ms'));this[_0xa556('0xb')](_0xa556('0xf'),moment());this[_0xa556('0xb')](_0xa556('0x10'),_0x44ea8e);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa556('0x6')]('startedAt'))[_0xa556('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xa556('0x12')],'get':function(){return moment(this[_0xa556('0x6')](_0xa556('0xf')))[_0xa556('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xa556('0x13')]();}},'createdAt':{'type':Sequelize[_0xa556('0x12')],'get':function(){return moment(this[_0xa556('0x6')](_0xa556('0x14')))[_0xa556('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0xa556('0x12')],'get':function(){return moment(this[_0xa556('0x6')]('updatedAt'))[_0xa556('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 955b35b..5536f2a 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 _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x4c4e,0x152));var _0xe4c4=function(_0x389bfd,_0x5e3767){_0x389bfd=_0x389bfd-0x0;var _0x53464f=_0x4c4e[_0x389bfd];return _0x53464f;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file +var _0x9a19=['limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','type','key','model','differenceBy','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','duration','value','find','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','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'];(function(_0x3c6125,_0x3b2a9c){var _0x2f47b8=function(_0x214650){while(--_0x214650){_0x3c6125['push'](_0x3c6125['shift']());}};_0x2f47b8(++_0x3b2a9c);}(_0x9a19,0x114));var _0x99a1=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x9a19[_0x4ff09b];return _0x3f5c2e;};'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(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0x3c813,_0x491341){return function(_0x4fe7f7){if(!_0x4fe7f7){_0x3c813[_0x99a1('0x19')](0x194);}return _0x4fe7f7;};}function handleError(_0x5dabd9,_0x5dc733){_0x5dc733=_0x5dc733||0x1f4;return function(_0xafea84){logger[_0x99a1('0x25')](_0xafea84[_0x99a1('0x26')]);if(_0xafea84[_0x99a1('0x27')]){delete _0xafea84[_0x99a1('0x27')];}_0x5dabd9[_0x99a1('0x1a')](_0x5dc733)[_0x99a1('0x28')](_0xafea84);};}exports['index']=function(_0xf41b0d,_0x499eef){var _0x255197={},_0x1137f2={},_0x26fbae={'count':0x0,'rows':[]};var _0x523668=_[_0x99a1('0x29')](db[_0x99a1('0x2a')]['rawAttributes'],function(_0x37514e){return{'name':_0x37514e[_0x99a1('0x2b')],'type':_0x37514e[_0x99a1('0x2c')][_0x99a1('0x2d')]};});_0x1137f2[_0x99a1('0x2e')]=_[_0x99a1('0x2f')](_[_0x99a1('0x29')](_0x523668,_0x99a1('0x27')),['format']);_0x1137f2['query']=_[_0x99a1('0x30')](_0xf41b0d['query']);_0x1137f2[_0x99a1('0x31')]=_[_0x99a1('0x32')](_0x1137f2['model'],_0x1137f2[_0x99a1('0x33')]);_0x255197[_0x99a1('0x34')]=_[_0x99a1('0x32')](_0x1137f2[_0x99a1('0x2e')],qs[_0x99a1('0x35')](_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x35')]));_0x255197[_0x99a1('0x34')]=_0x255197[_0x99a1('0x34')][_0x99a1('0x36')]?_0x255197[_0x99a1('0x34')]:_0x1137f2[_0x99a1('0x2e')];if(!_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x37')]('nolimit')){_0x255197['limit']=qs[_0x99a1('0x1e')](_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x1e')]);_0x255197[_0x99a1('0x1c')]=qs[_0x99a1('0x1c')](_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x1c')]);}_0x255197['order']=qs[_0x99a1('0x38')](_0xf41b0d[_0x99a1('0x33')]['sort']);_0x255197[_0x99a1('0x39')]=qs[_0x99a1('0x31')](_[_0x99a1('0x3a')](_0xf41b0d[_0x99a1('0x33')],_0x1137f2[_0x99a1('0x31')]),_0x523668);if(_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x3b')]){_0x255197[_0x99a1('0x39')]=_[_0x99a1('0x3c')](_0x255197[_0x99a1('0x39')],{'$or':_[_0x99a1('0x29')](_0x523668,function(_0x152969){if(_0x152969[_0x99a1('0x2c')]!=='VIRTUAL'){var _0x5553e4={};_0x5553e4[_0x152969['name']]={'$like':'%'+_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x3b')]+'%'};return _0x5553e4;}})});}_0x255197=_[_0x99a1('0x3c')]({},_0x255197,_0xf41b0d[_0x99a1('0x3d')]);var _0x40613a={'where':_0x255197['where']};return db[_0x99a1('0x2a')][_0x99a1('0x1f')](_0x40613a)[_0x99a1('0x23')](function(_0x51efe5){_0x26fbae['count']=_0x51efe5;if(_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x3e')]){_0x255197[_0x99a1('0x3f')]=[{'all':!![]}];}return db['ScreenRecording'][_0x99a1('0x40')](_0x255197);})[_0x99a1('0x23')](function(_0x1b5d2d){_0x26fbae[_0x99a1('0x41')]=_0x1b5d2d;return _0x26fbae;})[_0x99a1('0x23')](respondWithFilteredResult(_0x499eef,_0x255197))[_0x99a1('0x42')](handleError(_0x499eef,null));};exports[_0x99a1('0x43')]=function(_0x29d0a0,_0x1c4ce4){var _0x2be9e3={'raw':![],'where':{'id':_0x29d0a0[_0x99a1('0x44')]['id']}},_0x4b40e1={};_0x4b40e1[_0x99a1('0x2e')]=_[_0x99a1('0x30')](db['ScreenRecording'][_0x99a1('0x45')]);_0x4b40e1['query']=_[_0x99a1('0x30')](_0x29d0a0[_0x99a1('0x33')]);_0x4b40e1[_0x99a1('0x31')]=_[_0x99a1('0x32')](_0x4b40e1[_0x99a1('0x2e')],_0x4b40e1[_0x99a1('0x33')]);_0x2be9e3['attributes']=_[_0x99a1('0x32')](_0x4b40e1['model'],qs[_0x99a1('0x35')](_0x29d0a0[_0x99a1('0x33')][_0x99a1('0x35')]));_0x2be9e3[_0x99a1('0x34')]=_0x2be9e3[_0x99a1('0x34')][_0x99a1('0x36')]?_0x2be9e3[_0x99a1('0x34')]:_0x4b40e1[_0x99a1('0x2e')];if(_0x29d0a0[_0x99a1('0x33')][_0x99a1('0x3e')]){_0x2be9e3[_0x99a1('0x3f')]=[{'all':!![]}];}_0x2be9e3=_['merge']({},_0x2be9e3,_0x29d0a0[_0x99a1('0x3d')]);return db[_0x99a1('0x2a')]['find'](_0x2be9e3)[_0x99a1('0x23')](handleEntityNotFound(_0x1c4ce4,null))[_0x99a1('0x23')](respondWithResult(_0x1c4ce4,null))[_0x99a1('0x42')](handleError(_0x1c4ce4,null));};exports[_0x99a1('0x46')]=function(_0x113dd9,_0x254c41){return db[_0x99a1('0x2a')]['create'](_0x113dd9[_0x99a1('0x47')],{})['then'](respondWithResult(_0x254c41,0xc9))[_0x99a1('0x42')](handleError(_0x254c41,null));};exports[_0x99a1('0x48')]=function(_0x566442,_0x5433f2){if(_0x566442[_0x99a1('0x47')]['id']){delete _0x566442[_0x99a1('0x47')]['id'];}delete _0x566442[_0x99a1('0x47')][_0x99a1('0x49')];delete _0x566442[_0x99a1('0x47')]['createdAt'];delete _0x566442['body']['closedAt'];delete _0x566442[_0x99a1('0x47')][_0x99a1('0x4a')];return db[_0x99a1('0x2a')][_0x99a1('0x4b')]({'where':{'id':_0x566442[_0x99a1('0x44')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x5433f2,null))[_0x99a1('0x23')](saveUpdates(_0x566442['body'],null))[_0x99a1('0x23')](respondWithResult(_0x5433f2,null))[_0x99a1('0x42')](handleError(_0x5433f2,null));};exports[_0x99a1('0x4c')]=function(_0x5e877f,_0x81e218){return db['ScreenRecording']['describe']()[_0x99a1('0x23')](respondWithResult(_0x81e218,null))[_0x99a1('0x42')](handleError(_0x81e218,null));};exports[_0x99a1('0x4d')]=function(_0x175f6d,_0x11632d,_0xf8208a){var _0x240d2e=require(_0x99a1('0x4e'));var _0x16641e=![];var _0x53e9eb={};if(_0x175f6d[_0x99a1('0x33')]['type']&&_0x175f6d[_0x99a1('0x33')][_0x99a1('0x2c')]==='uniqueid'){_0x53e9eb[_0x99a1('0x4f')]=_0x175f6d[_0x99a1('0x44')]['id'];}else{_0x53e9eb['id']=_0x175f6d[_0x99a1('0x44')]['id'];}return db[_0x99a1('0x2a')][_0x99a1('0x4b')]({'where':_0x53e9eb,'attributes':['id',_0x99a1('0x4a')],'raw':!![]})[_0x99a1('0x23')](handleEntityNotFound(_0x11632d,null))[_0x99a1('0x23')](function(_0x28ba8f){if(_0x28ba8f){var _0x1c2926=path[_0x99a1('0x50')](config[_0x99a1('0x51')],'server/files/screen_recordings',_0x28ba8f['value']);var _0x2e3e08=util[_0x99a1('0x52')](_0x99a1('0x53'),_0x1c2926);if(fs[_0x99a1('0x54')](_0x2e3e08)){_0x16641e=!![];return _0x240d2e[_0x99a1('0x55')](_0x2e3e08,_0x1c2926,config['secrets'][_0x99a1('0x56')])[_0x99a1('0x23')](function(){return _0x28ba8f;});}return _0x28ba8f;}})['then'](function(_0x6107cd){if(_0x6107cd){var _0x95f20a=path[_0x99a1('0x50')](config[_0x99a1('0x51')],_0x99a1('0x57'),_0x6107cd['value']);if(!fs[_0x99a1('0x54')](_0x95f20a)){throw new db[(_0x99a1('0x58'))][(_0x99a1('0x59'))](_0x99a1('0x5a'));}if(_0x6107cd[_0x99a1('0x5b')]){return _0x11632d[_0x99a1('0x4d')](_0x95f20a,_0x6107cd['filename']+path[_0x99a1('0x5c')](_0x95f20a),function(){if(_0x16641e){fs[_0x99a1('0x5d')](_0x95f20a);}});}else{return _0x11632d['download'](_0x95f20a,function(_0x33feb9){if(_0x16641e){fs[_0x99a1('0x5d')](_0x95f20a);}});}}})[_0x99a1('0x42')](function(_0xb126dd){if(_0xb126dd[_0x99a1('0x5e')]==='ScreenRecording\x20not\x20found'){_0x11632d[_0x99a1('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x11632d,null);}});};exports['destroy']=function(_0x38ce3c,_0x3f7c16){return db['ScreenRecording']['find']({'where':{'id':_0x38ce3c[_0x99a1('0x44')]['id']}})['then'](function(_0x21a5f6){if(_[_0x99a1('0x5f')](_0x21a5f6)){throw new ReferenceError(_0x99a1('0x60'));}return _0x21a5f6;})[_0x99a1('0x23')](function(_0x56d6cf){var _0x18f74b=path[_0x99a1('0x50')](config[_0x99a1('0x51')],'server/files/screen_recordings',_0x56d6cf[_0x99a1('0x4a')]);logger['info'](_0x99a1('0x61'),_0x18f74b);if(!_[_0x99a1('0x5f')](_0x56d6cf[_0x99a1('0x4a')])&&fs[_0x99a1('0x54')](_0x18f74b)){logger[_0x99a1('0x62')]('File:\x20\x22'+_0x18f74b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x18f74b);}_0x18f74b=_0x18f74b+_0x99a1('0x63');if(!_[_0x99a1('0x5f')](_0x56d6cf['value'])&&fs['existsSync'](_0x18f74b)){logger[_0x99a1('0x62')](_0x99a1('0x64')+_0x18f74b+_0x99a1('0x65'));fs['unlinkSync'](_0x18f74b);}return _0x56d6cf;})['then'](function(_0x2b8df8){if(!_0x2b8df8)throw new InternalError();return _0x2b8df8['destroy']();})[_0x99a1('0x23')](function(){_0x3f7c16[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();})['catch'](handleError(_0x3f7c16,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index fe3d6da..2b36c56 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 _0x09e8=['./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x09e8,0x13d));var _0x809e=function(_0x1e9e5c,_0x13fb10){_0x1e9e5c=_0x1e9e5c-0x0;var _0x191cb9=_0x09e8[_0x1e9e5c];return _0x191cb9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x809e('0x0'))('api');var moment=require(_0x809e('0x1'));var BPromise=require(_0x809e('0x2'));var rp=require(_0x809e('0x3'));var fs=require('fs');var path=require(_0x809e('0x4'));var rimraf=require(_0x809e('0x5'));var config=require(_0x809e('0x6'));var attributes=require(_0x809e('0x7'));module[_0x809e('0x8')]=function(_0xb15b4b,_0x266042){return _0xb15b4b['define'](_0x809e('0x9'),attributes,{'tableName':_0x809e('0xa'),'paranoid':![],'indexes':[{'name':_0x809e('0xb'),'fields':[_0x809e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad0e=['lodash','util','../../config/logger','api','bluebird','request-promise','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x33a316,_0x4c8206){var _0x35880c=function(_0x2e524a){while(--_0x2e524a){_0x33a316['push'](_0x33a316['shift']());}};_0x35880c(++_0x4c8206);}(_0xad0e,0x6e));var _0xead0=function(_0x4bf9f1,_0xddb06c){_0x4bf9f1=_0x4bf9f1-0x0;var _0x2801c8=_0xad0e[_0x4bf9f1];return _0x2801c8;};'use strict';var _=require(_0xead0('0x0'));var util=require(_0xead0('0x1'));var logger=require(_0xead0('0x2'))(_0xead0('0x3'));var moment=require('moment');var BPromise=require(_0xead0('0x4'));var rp=require(_0xead0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0xead0('0x6')]=function(_0xe2dbf8,_0x35336f){return _0xe2dbf8[_0xead0('0x7')](_0xead0('0x8'),attributes,{'tableName':_0xead0('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xead0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 317ed9a..3b0f47e 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 _0xfd18=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x550d07,_0x2d456e){var _0x125d2b=function(_0x19f0bb){while(--_0x19f0bb){_0x550d07['push'](_0x550d07['shift']());}};_0x125d2b(++_0x2d456e);}(_0xfd18,0xac));var _0x8fd1=function(_0x24502f,_0x134350){_0x24502f=_0x24502f-0x0;var _0x402fd9=_0xfd18[_0x24502f];return _0x402fd9;};'use strict';var _=require(_0x8fd1('0x0'));var util=require('util');var moment=require(_0x8fd1('0x1'));var BPromise=require(_0x8fd1('0x2'));var rs=require(_0x8fd1('0x3'));var fs=require('fs');var Redis=require(_0x8fd1('0x4'));var db=require(_0x8fd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fd1('0x6'))(_0x8fd1('0x7'));var config=require(_0x8fd1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8fd1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x179ba9,_0x10c34a,_0x98b6e2){return new BPromise(function(_0x26e85b,_0x29c16e){return client[_0x8fd1('0xa')](_0x179ba9,_0x98b6e2)[_0x8fd1('0xb')](function(_0x36eae8){logger['info'](_0x8fd1('0xc'),_0x10c34a,_0x8fd1('0xd'));logger['debug'](_0x8fd1('0xe'),_0x10c34a,_0x8fd1('0xd'),JSON[_0x8fd1('0xf')](_0x36eae8));if(_0x36eae8['error']){if(_0x36eae8['error'][_0x8fd1('0x10')]===0x1f4){logger[_0x8fd1('0x11')](_0x8fd1('0xc'),_0x10c34a,_0x36eae8['error'][_0x8fd1('0x12')]);return _0x29c16e(_0x36eae8[_0x8fd1('0x11')][_0x8fd1('0x12')]);}logger['error'](_0x8fd1('0xc'),_0x10c34a,_0x36eae8['error'][_0x8fd1('0x12')]);return _0x26e85b(_0x36eae8['error'][_0x8fd1('0x12')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x10c34a,'request\x20sent');_0x26e85b(_0x36eae8[_0x8fd1('0x13')][_0x8fd1('0x12')]);}})[_0x8fd1('0x14')](function(_0x1b06a8){logger[_0x8fd1('0x11')](_0x8fd1('0xc'),_0x10c34a,_0x1b06a8);_0x29c16e(_0x1b06a8);});});} \ No newline at end of file +var _0xbd7f=['error','code','message','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xed1b49,_0x4d59c7){var _0x15bf47=function(_0x2363ae){while(--_0x2363ae){_0xed1b49['push'](_0xed1b49['shift']());}};_0x15bf47(++_0x4d59c7);}(_0xbd7f,0x130));var _0xfbd7=function(_0x30fb0d,_0x2b5adb){_0x30fb0d=_0x30fb0d-0x0;var _0x28d7b9=_0xbd7f[_0x30fb0d];return _0x28d7b9;};'use strict';var _=require(_0xfbd7('0x0'));var util=require(_0xfbd7('0x1'));var moment=require(_0xfbd7('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbd7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfbd7('0x4'))(_0xfbd7('0x5'));var config=require(_0xfbd7('0x6'));var jayson=require(_0xfbd7('0x7'));var client=jayson['client'][_0xfbd7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3731e6,_0x6be366,_0x53d5a7){return new BPromise(function(_0x1d83a9,_0x36e8d9){return client[_0xfbd7('0x9')](_0x3731e6,_0x53d5a7)[_0xfbd7('0xa')](function(_0x2924a0){logger[_0xfbd7('0xb')](_0xfbd7('0xc'),_0x6be366,_0xfbd7('0xd'));logger[_0xfbd7('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x6be366,_0xfbd7('0xd'),JSON[_0xfbd7('0xf')](_0x2924a0));if(_0x2924a0[_0xfbd7('0x10')]){if(_0x2924a0[_0xfbd7('0x10')][_0xfbd7('0x11')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x6be366,_0x2924a0[_0xfbd7('0x10')][_0xfbd7('0x12')]);return _0x36e8d9(_0x2924a0[_0xfbd7('0x10')][_0xfbd7('0x12')]);}logger['error'](_0xfbd7('0xc'),_0x6be366,_0x2924a0[_0xfbd7('0x10')][_0xfbd7('0x12')]);return _0x1d83a9(_0x2924a0[_0xfbd7('0x10')]['message']);}else{logger[_0xfbd7('0xb')](_0xfbd7('0xc'),_0x6be366,_0xfbd7('0xd'));_0x1d83a9(_0x2924a0['result'][_0xfbd7('0x12')]);}})[_0xfbd7('0x13')](function(_0x23a0be){logger[_0xfbd7('0x10')](_0xfbd7('0xc'),_0x6be366,_0x23a0be);_0x36e8d9(_0x23a0be);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index fafd6d7..688e66a 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 _0xf1ed=['logologin','/:id/logo_login','single','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','index','get','/now','getDate','/:id','/:id/logo','getLogoLogin','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','root','format','%s%s','logo','extname','originalname','post','file','addLogo','join','server/files/images/logos/'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0xf1ed,0x1f0));var _0xdf1e=function(_0x5e07c1,_0x2b8af5){_0x5e07c1=_0x5e07c1-0x0;var _0xfdb978=_0xf1ed[_0x5e07c1];return _0xfdb978;};'use strict';var multer=require(_0xdf1e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdf1e('0x1'));var express=require(_0xdf1e('0x2'));var router=express[_0xdf1e('0x3')]();var fs_extra=require(_0xdf1e('0x4'));var auth=require(_0xdf1e('0x5'));var interaction=require(_0xdf1e('0x6'));var config=require(_0xdf1e('0x7'));var controller=require(_0xdf1e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xdf1e('0x9')]);router[_0xdf1e('0xa')](_0xdf1e('0xb'),controller[_0xdf1e('0xc')]);router[_0xdf1e('0xa')](_0xdf1e('0xd'),controller['show']);router[_0xdf1e('0xa')](_0xdf1e('0xe'),controller['getLogo']);router[_0xdf1e('0xa')]('/:id/logo_login',controller[_0xdf1e('0xf')]);router[_0xdf1e('0xa')]('/:id/gdpr',controller[_0xdf1e('0x10')]);router['get'](_0xdf1e('0x11'),controller[_0xdf1e('0x12')]);router[_0xdf1e('0xa')]('/:id/favicon',controller[_0xdf1e('0x13')]);var upload=multer({'storage':multer[_0xdf1e('0x14')]({'destination':function(_0x2ca615,_0x4646bf,_0xbc0f5d){_0xbc0f5d(null,path['join'](config[_0xdf1e('0x15')],'server/files/images/logos/'));},'filename':function(_0x36d696,_0x40ec68,_0x5bc221){_0x5bc221(null,util[_0xdf1e('0x16')](_0xdf1e('0x17'),_0xdf1e('0x18'),path[_0xdf1e('0x19')](_0x40ec68[_0xdf1e('0x1a')])));}})});router[_0xdf1e('0x1b')](_0xdf1e('0xe'),upload['single'](_0xdf1e('0x1c')),controller[_0xdf1e('0x1d')]);var upload=multer({'storage':multer[_0xdf1e('0x14')]({'destination':function(_0x53fc4c,_0x4df5a1,_0x3bc87a){_0x3bc87a(null,path[_0xdf1e('0x1e')](config['root'],_0xdf1e('0x1f')));},'filename':function(_0x5be6c8,_0x6292c9,_0x1a4a53){_0x1a4a53(null,util[_0xdf1e('0x16')]('%s%s',_0xdf1e('0x20'),path[_0xdf1e('0x19')](_0x6292c9[_0xdf1e('0x1a')])));}})});router[_0xdf1e('0x1b')](_0xdf1e('0x21'),upload[_0xdf1e('0x22')](_0xdf1e('0x1c')),controller[_0xdf1e('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x35d5c5,_0x5c661e,_0x46fa38){_0x46fa38(null,path['join'](config[_0xdf1e('0x15')],_0xdf1e('0x1f')));},'filename':function(_0x5a3931,_0x395c5f,_0x49a700){_0x49a700(null,util['format'](_0xdf1e('0x17'),_0xdf1e('0x24'),path['extname'](_0x395c5f['originalname'])));}})});router[_0xdf1e('0x1b')]('/:id/preferred',upload[_0xdf1e('0x22')](_0xdf1e('0x1c')),controller[_0xdf1e('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x149b10,_0x38db04,_0x165970){_0x165970(null,path['join'](config[_0xdf1e('0x15')],_0xdf1e('0x1f')));},'filename':function(_0x67fb5b,_0x4236c6,_0x10623f){_0x10623f(null,util['format'](_0xdf1e('0x17'),_0xdf1e('0x26'),path[_0xdf1e('0x19')](_0x4236c6[_0xdf1e('0x1a')])));}})});router[_0xdf1e('0x1b')]('/:id/favicon',upload[_0xdf1e('0x22')]('file'),controller[_0xdf1e('0x27')]);router[_0xdf1e('0x28')]('/:id',auth[_0xdf1e('0x29')](),controller[_0xdf1e('0x2a')]);module[_0xdf1e('0x2b')]=router; \ No newline at end of file +var _0x5a6d=['getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','%s%s','extname','originalname','/:id/logo','single','addLogo','format','logologin','post','file','addLogoLogin','preferred','addPreferred','addFavicon','put','isAuthenticated','update','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','show','getLogo','/:id/logo_login','getLogoLogin','gdpr'];(function(_0x583aa4,_0x42ba7e){var _0x4f8b7e=function(_0x602aa8){while(--_0x602aa8){_0x583aa4['push'](_0x583aa4['shift']());}};_0x4f8b7e(++_0x42ba7e);}(_0x5a6d,0x137));var _0xd5a6=function(_0x1dad89,_0x59714b){_0x1dad89=_0x1dad89-0x0;var _0x1c2292=_0x5a6d[_0x1dad89];return _0x1c2292;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd5a6('0x0'));var timeout=require('connect-timeout');var express=require(_0xd5a6('0x1'));var router=express[_0xd5a6('0x2')]();var fs_extra=require(_0xd5a6('0x3'));var auth=require(_0xd5a6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd5a6('0x5'));var controller=require('./setting.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd5a6('0x6')]);router[_0xd5a6('0x7')]('/now',controller['getDate']);router[_0xd5a6('0x7')]('/:id',controller[_0xd5a6('0x8')]);router[_0xd5a6('0x7')]('/:id/logo',controller[_0xd5a6('0x9')]);router[_0xd5a6('0x7')](_0xd5a6('0xa'),controller[_0xd5a6('0xb')]);router[_0xd5a6('0x7')]('/:id/gdpr',controller[_0xd5a6('0xc')]);router[_0xd5a6('0x7')]('/:id/preferred',controller[_0xd5a6('0xd')]);router[_0xd5a6('0x7')](_0xd5a6('0xe'),controller['getFavicon']);var upload=multer({'storage':multer[_0xd5a6('0xf')]({'destination':function(_0x5d6425,_0x244136,_0x4f8c89){_0x4f8c89(null,path[_0xd5a6('0x10')](config[_0xd5a6('0x11')],_0xd5a6('0x12')));},'filename':function(_0x576bb0,_0x28a2ec,_0x166e27){_0x166e27(null,util['format'](_0xd5a6('0x13'),'logo',path[_0xd5a6('0x14')](_0x28a2ec[_0xd5a6('0x15')])));}})});router['post'](_0xd5a6('0x16'),upload[_0xd5a6('0x17')]('file'),controller[_0xd5a6('0x18')]);var upload=multer({'storage':multer[_0xd5a6('0xf')]({'destination':function(_0x5b28e8,_0x97a613,_0x2eb728){_0x2eb728(null,path[_0xd5a6('0x10')](config[_0xd5a6('0x11')],_0xd5a6('0x12')));},'filename':function(_0x55001c,_0x4406f5,_0xc83011){_0xc83011(null,util[_0xd5a6('0x19')]('%s%s',_0xd5a6('0x1a'),path[_0xd5a6('0x14')](_0x4406f5[_0xd5a6('0x15')])));}})});router[_0xd5a6('0x1b')](_0xd5a6('0xa'),upload['single'](_0xd5a6('0x1c')),controller[_0xd5a6('0x1d')]);var upload=multer({'storage':multer[_0xd5a6('0xf')]({'destination':function(_0x2e9be7,_0x240afc,_0x2fbb8c){_0x2fbb8c(null,path[_0xd5a6('0x10')](config['root'],_0xd5a6('0x12')));},'filename':function(_0x39064e,_0x2569d5,_0x5e0a4d){_0x5e0a4d(null,util['format']('%s%s',_0xd5a6('0x1e'),path[_0xd5a6('0x14')](_0x2569d5[_0xd5a6('0x15')])));}})});router[_0xd5a6('0x1b')]('/:id/preferred',upload[_0xd5a6('0x17')]('file'),controller[_0xd5a6('0x1f')]);var upload=multer({'storage':multer[_0xd5a6('0xf')]({'destination':function(_0x3529a0,_0x242755,_0x4c519e){_0x4c519e(null,path[_0xd5a6('0x10')](config[_0xd5a6('0x11')],_0xd5a6('0x12')));},'filename':function(_0x590789,_0x204b6f,_0x21c58f){_0x21c58f(null,util[_0xd5a6('0x19')](_0xd5a6('0x13'),'favicon',path['extname'](_0x204b6f[_0xd5a6('0x15')])));}})});router[_0xd5a6('0x1b')]('/:id/favicon',upload[_0xd5a6('0x17')]('file'),controller[_0xd5a6('0x20')]);router[_0xd5a6('0x21')]('/:id',auth[_0xd5a6('0x22')](),controller[_0xd5a6('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 44421b4..6554908 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 _0x2b4a=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x4745ba,_0x1091a0){var _0x517710=function(_0x11aebd){while(--_0x11aebd){_0x4745ba['push'](_0x4745ba['shift']());}};_0x517710(++_0x1091a0);}(_0x2b4a,0x13e));var _0xa2b4=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x2b4a[_0x40b3f2];return _0x4ce90c;};'use strict';var Sequelize=require(_0xa2b4('0x0'));module[_0xa2b4('0x1')]={'min_internal':{'type':Sequelize[_0xa2b4('0x2')](0xb),'unique':_0xa2b4('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa2b4('0x2')](0xb),'unique':_0xa2b4('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa2b4('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa2b4('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xa2b4('0x5')]},'defaultLogo':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xa2b4('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xa2b4('0x5')]},'turnaddr':{'type':Sequelize[_0xa2b4('0x5')]},'turnusername':{'type':Sequelize[_0xa2b4('0x5')]},'turnpassword':{'type':Sequelize[_0xa2b4('0x5')]},'pageTitle':{'type':Sequelize[_0xa2b4('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xa2b4('0x7')},'enableEmailPreview':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa2b4('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa2b4('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa2b4('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa2b4('0x5')],'defaultValue':_0xa2b4('0x8')},'chatTimeout':{'type':Sequelize[_0xa2b4('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa2b4('0x5')]},'defaultPreferred':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa2b4('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xa2b4('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa2b4('0x5')]},'defaultFavicon':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa2b4('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xa2b4('0x5')]},'sentiment':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xa2b4('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa2b4('0x5')]},'bucket':{'type':Sequelize[_0xa2b4('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xa2b4('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xa2b4('0x2')](0x2)[_0xa2b4('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xa2b4('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa2b4('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xa2b4('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xa2b4('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xa2b4('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xa2b4('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14}}; \ No newline at end of file +var _0x3f2e=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER','min_internal'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x2873d2,_0x3178b6){_0x2873d2=_0x2873d2-0x0;var _0x31b7c1=_0x3f2e[_0x2873d2];return _0x31b7c1;};'use strict';var Sequelize=require(_0xe3f2('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xe3f2('0x1')](0xb),'unique':_0xe3f2('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe3f2('0x1')](0xb),'unique':_0xe3f2('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe3f2('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe3f2('0x4')],'defaultValue':_0xe3f2('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe3f2('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe3f2('0x4')]},'turnaddr':{'type':Sequelize[_0xe3f2('0x4')]},'turnusername':{'type':Sequelize[_0xe3f2('0x4')]},'turnpassword':{'type':Sequelize[_0xe3f2('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xe3f2('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe3f2('0x4')],'defaultValue':_0xe3f2('0x7')},'enableEmailPreview':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe3f2('0x4')],'defaultValue':_0xe3f2('0x8')},'chatTimeout':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xe3f2('0x4')]},'defaultPreferred':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xe3f2('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xe3f2('0x4')]},'sentiment':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe3f2('0x1')]},'sentimentRegion':{'type':Sequelize[_0xe3f2('0x4')]},'language':{'type':Sequelize[_0xe3f2('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xe3f2('0x1')](0x2)[_0xe3f2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xe3f2('0x1')](0x2)[_0xe3f2('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xe3f2('0x1')](0x2)[_0xe3f2('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xe3f2('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 69c2390..2214368 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 _0xe20e=['getLogo','getLicense','logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','server/files/images/logos','default_loginLogo.svg','custom','securePassword','addPreferred','default_preferred.png','default','addFavicon','default_favicon.ico','getDate','utcOffset','send','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','end','stack','name','index','map','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','find','body','addLogo','file','filename','addLogoLogin'];(function(_0x450ed3,_0x30596a){var _0x31a133=function(_0x4e0e8f){while(--_0x4e0e8f){_0x450ed3['push'](_0x450ed3['shift']());}};_0x31a133(++_0x30596a);}(_0xe20e,0x195));var _0xee20=function(_0x198add,_0x239d3c){_0x198add=_0x198add-0x0;var _0x35bfaa=_0xe20e[_0x198add];return _0x35bfaa;};'use strict';var emlformat=require(_0xee20('0x0'));var rimraf=require(_0xee20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee20('0x2'));var rp=require(_0xee20('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xee20('0x4'));var util=require('util');var path=require(_0xee20('0x5'));var sox=require(_0xee20('0x6'));var csv=require(_0xee20('0x7'));var ejs=require(_0xee20('0x8'));var fs=require('fs');var fs_extra=require(_0xee20('0x9'));var _=require(_0xee20('0xa'));var squel=require(_0xee20('0xb'));var crypto=require(_0xee20('0xc'));var jsforce=require(_0xee20('0xd'));var deskjs=require(_0xee20('0xe'));var toCsv=require(_0xee20('0x7'));var querystring=require(_0xee20('0xf'));var Papa=require('papaparse');var Redis=require(_0xee20('0x10'));var authService=require(_0xee20('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee20('0x12'));var logger=require(_0xee20('0x13'))(_0xee20('0x14'));var utils=require(_0xee20('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xee20('0x16'));var db=require(_0xee20('0x17'))['db'];var jayson=require(_0xee20('0x18'));var client=jayson[_0xee20('0x19')][_0xee20('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3d61e8,_0x190e86,_0x5eb7b7,_0x3da816){return new BPromise(function(_0x4e1e75,_0x3f6df3){var _0x18e765=_0x3da816||client;return _0x18e765[_0xee20('0x1b')](_0x3d61e8,_0x5eb7b7)['then'](function(_0x6a910e){logger[_0xee20('0x1c')](_0xee20('0x1d'),_0x190e86,_0xee20('0x1e'));logger[_0xee20('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x190e86,_0xee20('0x1e'),JSON[_0xee20('0x20')](_0x6a910e));if(_0x6a910e['error']){if(_0x6a910e['error'][_0xee20('0x21')]===0x1f4){logger['error'](_0xee20('0x1d'),_0x190e86,_0x6a910e[_0xee20('0x22')][_0xee20('0x23')]);return _0x3f6df3(_0x6a910e[_0xee20('0x22')][_0xee20('0x23')]);}logger['error']('Setting,\x20%s,\x20%s',_0x190e86,_0x6a910e[_0xee20('0x22')][_0xee20('0x23')]);return _0x4e1e75(_0x6a910e[_0xee20('0x22')]['message']);}else{logger[_0xee20('0x1c')](_0xee20('0x1d'),_0x190e86,_0xee20('0x1e'));_0x4e1e75(_0x6a910e[_0xee20('0x24')][_0xee20('0x23')]);}})['catch'](function(_0x337826){logger['error'](_0xee20('0x1d'),_0x190e86,_0x337826);_0x3f6df3(_0x337826);});});}function respondWithStatusCode(_0x4b4134,_0x53a158){_0x53a158=_0x53a158||0xcc;return function(_0xc9af6c){if(_0xc9af6c){return _0x4b4134[_0xee20('0x25')](_0x53a158);}return _0x4b4134[_0xee20('0x26')](_0x53a158)['end']();};}function respondWithResult(_0x47b507,_0x5d0db3){_0x5d0db3=_0x5d0db3||0xc8;return function(_0x1030de){if(_0x1030de){return _0x47b507[_0xee20('0x26')](_0x5d0db3)['json'](_0x1030de);}};}function respondWithFilteredResult(_0x989704,_0x256250){return function(_0xc0e06b){if(_0xc0e06b){var _0x789af8=typeof _0x256250['offset']==='undefined'&&typeof _0x256250[_0xee20('0x27')]===_0xee20('0x28');var _0x378f40=_0xc0e06b[_0xee20('0x29')];var _0x1c3ccf=_0x789af8?0x0:_0x256250[_0xee20('0x2a')];var _0x5c2079=_0x789af8?_0xc0e06b[_0xee20('0x29')]:_0x256250[_0xee20('0x2a')]+_0x256250[_0xee20('0x27')];var _0x5d994a;if(_0x5c2079>=_0x378f40){_0x5c2079=_0x378f40;_0x5d994a=0xc8;}else{_0x5d994a=0xce;}_0x989704[_0xee20('0x26')](_0x5d994a);return _0x989704[_0xee20('0x2b')](_0xee20('0x2c'),_0x1c3ccf+'-'+_0x5c2079+'/'+_0x378f40)[_0xee20('0x2d')](_0xc0e06b);}return null;};}function patchUpdates(_0x458cd9){return function(_0x18cb44){try{jsonpatch[_0xee20('0x2e')](_0x18cb44,_0x458cd9,!![]);}catch(_0x47ac08){return BPromise['reject'](_0x47ac08);}return _0x18cb44[_0xee20('0x2f')]();};}function saveUpdates(_0x151425,_0x5c0078){return function(_0x31cf1a){if(_0x31cf1a){return _0x31cf1a[_0xee20('0x30')](_0x151425)[_0xee20('0x31')](function(_0x3f01d2){return _0x3f01d2;});}return null;};}function removeEntity(_0xd41556,_0x516633){return function(_0x5e49d6){if(_0x5e49d6){return _0x5e49d6[_0xee20('0x32')]()['then'](function(){_0xd41556[_0xee20('0x26')](0xcc)[_0xee20('0x33')]();});}};}function handleEntityNotFound(_0x1f0b8b,_0x1ec302){return function(_0x358e39){if(!_0x358e39){_0x1f0b8b[_0xee20('0x25')](0x194);}return _0x358e39;};}function handleError(_0xe9f98,_0x3bd190){_0x3bd190=_0x3bd190||0x1f4;return function(_0x33a779){logger['error'](_0x33a779[_0xee20('0x34')]);if(_0x33a779[_0xee20('0x35')]){delete _0x33a779[_0xee20('0x35')];}_0xe9f98[_0xee20('0x26')](_0x3bd190)['send'](_0x33a779);};}exports[_0xee20('0x36')]=function(_0x2b52b1,_0x657da7){var _0x4fc165={},_0x348c4f={},_0x806f13={'count':0x0,'rows':[]};var _0x3a212c=_[_0xee20('0x37')](db['Setting']['rawAttributes'],function(_0x3c4628){return{'name':_0x3c4628['fieldName'],'type':_0x3c4628[_0xee20('0x38')][_0xee20('0x39')]};});_0x348c4f[_0xee20('0x3a')]=_[_0xee20('0x37')](_0x3a212c,_0xee20('0x35'));_0x348c4f[_0xee20('0x3b')]=_['keys'](_0x2b52b1[_0xee20('0x3b')]);_0x348c4f[_0xee20('0x3c')]=_['intersection'](_0x348c4f[_0xee20('0x3a')],_0x348c4f[_0xee20('0x3b')]);_0x4fc165['attributes']=_[_0xee20('0x3d')](_0x348c4f[_0xee20('0x3a')],qs[_0xee20('0x3e')](_0x2b52b1['query']['fields']));_0x4fc165['attributes']=_0x4fc165[_0xee20('0x3f')]['length']?_0x4fc165[_0xee20('0x3f')]:_0x348c4f[_0xee20('0x3a')];if(!_0x2b52b1[_0xee20('0x3b')][_0xee20('0x40')](_0xee20('0x41'))){_0x4fc165[_0xee20('0x27')]=qs[_0xee20('0x27')](_0x2b52b1[_0xee20('0x3b')]['limit']);_0x4fc165['offset']=qs[_0xee20('0x2a')](_0x2b52b1[_0xee20('0x3b')][_0xee20('0x2a')]);}_0x4fc165[_0xee20('0x42')]=qs[_0xee20('0x43')](_0x2b52b1['query'][_0xee20('0x43')]);_0x4fc165[_0xee20('0x44')]=qs['filters'](_[_0xee20('0x45')](_0x2b52b1[_0xee20('0x3b')],_0x348c4f[_0xee20('0x3c')]),_0x3a212c);if(_0x2b52b1[_0xee20('0x3b')][_0xee20('0x46')]){_0x4fc165[_0xee20('0x44')]=_[_0xee20('0x47')](_0x4fc165[_0xee20('0x44')],{'$or':_[_0xee20('0x37')](_0x3a212c,function(_0x546de4){if(_0x546de4[_0xee20('0x38')]!==_0xee20('0x48')){var _0x9f556f={};_0x9f556f[_0x546de4['name']]={'$like':'%'+_0x2b52b1[_0xee20('0x3b')][_0xee20('0x46')]+'%'};return _0x9f556f;}})});}_0x4fc165=_[_0xee20('0x47')]({},_0x4fc165,_0x2b52b1[_0xee20('0x49')]);var _0x494b9b={'where':_0x4fc165['where']};return db[_0xee20('0x4a')][_0xee20('0x29')](_0x494b9b)['then'](function(_0x4e20c8){_0x806f13[_0xee20('0x29')]=_0x4e20c8;if(_0x2b52b1['query'][_0xee20('0x4b')]){_0x4fc165['include']=[{'all':!![]}];}return db['Setting'][_0xee20('0x4c')](_0x4fc165);})[_0xee20('0x31')](function(_0x597d10){_0x806f13[_0xee20('0x4d')]=_0x597d10;return _0x806f13;})[_0xee20('0x31')](respondWithFilteredResult(_0x657da7,_0x4fc165))[_0xee20('0x4e')](handleError(_0x657da7,null));};exports[_0xee20('0x4f')]=function(_0x3cac09,_0x10a5c4){var _0x4842aa={'raw':![],'where':{'id':_0x3cac09[_0xee20('0x50')]['id']}},_0x177240={};_0x177240['model']=_[_0xee20('0x51')](db[_0xee20('0x4a')][_0xee20('0x52')]);_0x177240[_0xee20('0x3b')]=_['keys'](_0x3cac09['query']);_0x177240[_0xee20('0x3c')]=_[_0xee20('0x3d')](_0x177240[_0xee20('0x3a')],_0x177240[_0xee20('0x3b')]);_0x4842aa[_0xee20('0x3f')]=_[_0xee20('0x3d')](_0x177240[_0xee20('0x3a')],qs[_0xee20('0x3e')](_0x3cac09[_0xee20('0x3b')][_0xee20('0x3e')]));_0x4842aa[_0xee20('0x3f')]=_0x4842aa[_0xee20('0x3f')][_0xee20('0x53')]?_0x4842aa[_0xee20('0x3f')]:_0x177240['model'];if(_0x3cac09[_0xee20('0x3b')][_0xee20('0x4b')]){_0x4842aa[_0xee20('0x54')]=[{'all':!![]}];}_0x4842aa=_[_0xee20('0x47')]({},_0x4842aa,_0x3cac09[_0xee20('0x49')]);return db['Setting'][_0xee20('0x55')](_0x4842aa)[_0xee20('0x31')](handleEntityNotFound(_0x10a5c4,null))[_0xee20('0x31')](respondWithResult(_0x10a5c4,null))[_0xee20('0x4e')](handleError(_0x10a5c4,null));};exports[_0xee20('0x30')]=function(_0x2fde89,_0x2e3ccc){if(_0x2fde89[_0xee20('0x56')]['id']){delete _0x2fde89['body']['id'];}return db[_0xee20('0x4a')][_0xee20('0x55')]({'where':{'id':_0x2fde89[_0xee20('0x50')]['id']}})[_0xee20('0x31')](handleEntityNotFound(_0x2e3ccc,null))[_0xee20('0x31')](saveUpdates(_0x2fde89[_0xee20('0x56')],null))['then'](respondWithResult(_0x2e3ccc,null))['catch'](handleError(_0x2e3ccc,null));};exports[_0xee20('0x57')]=function(_0x318a1d,_0x5c6288,_0x4c0501){if(_0x318a1d[_0xee20('0x58')]&&_0x318a1d['file'][_0xee20('0x59')]){_0x318a1d['body']['logo']=_0x318a1d[_0xee20('0x58')][_0xee20('0x59')];}return db[_0xee20('0x4a')]['find']({'where':{'id':_0x318a1d[_0xee20('0x50')]['id']}})[_0xee20('0x31')](handleEntityNotFound(_0x5c6288,null))['then'](saveUpdates(_0x318a1d[_0xee20('0x56')],null))[_0xee20('0x31')](respondWithResult(_0x5c6288,null))['catch'](handleError(_0x5c6288,null));};exports[_0xee20('0x5a')]=function(_0x34c846,_0x2f2012,_0x2884b8){if(_0x34c846['file']&&_0x34c846[_0xee20('0x58')][_0xee20('0x59')]){_0x34c846[_0xee20('0x56')]['loginLogo']=_0x34c846[_0xee20('0x58')][_0xee20('0x59')];}return db[_0xee20('0x4a')]['find']({'where':{'id':_0x34c846[_0xee20('0x50')]['id']}})[_0xee20('0x31')](handleEntityNotFound(_0x2f2012,null))[_0xee20('0x31')](saveUpdates(_0x34c846['body'],null))[_0xee20('0x31')](respondWithResult(_0x2f2012,null))['catch'](handleError(_0x2f2012,null));};var utilLicense=require(_0xee20('0x16'));exports[_0xee20('0x5b')]=function(_0x4ad4cf,_0x232002,_0x362084){var _0x39aa5e='server/files/images/logos';var _0x5a3759={'custom':![]};return utilLicense[_0xee20('0x5c')]()[_0xee20('0x31')](function(_0x42e8f5){if(_0x42e8f5){_0x5a3759=_0x42e8f5;}return db[_0xee20('0x4a')][_0xee20('0x55')]({'where':{'id':_0x4ad4cf['params']['id']},'attributes':[_0xee20('0x5d'),_0xee20('0x5e'),_0xee20('0x5f'),_0xee20('0x60'),_0xee20('0x61'),_0xee20('0x62'),_0xee20('0x63'),_0xee20('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x232002,null))[_0xee20('0x31')](function(_0x38f94a){if(_0x38f94a){var _0x34c3e1=_0x38f94a['logo']&&fs[_0xee20('0x65')](path[_0xee20('0x66')](config['root'],_0x39aa5e,_[_0xee20('0x67')](_0x38f94a[_0xee20('0x5d')])))?path[_0xee20('0x66')](config[_0xee20('0x68')],_0x39aa5e,_[_0xee20('0x67')](_0x38f94a[_0xee20('0x5d')])):path[_0xee20('0x66')](config['root'],_0x39aa5e,_[_0xee20('0x67')]('default_logo.svg'));var _0x5bac94='default'+_['upperFirst'](_0xee20('0x5d'));if(_0x38f94a[_0x5bac94]||!_0x5a3759['custom']){_0x34c3e1=path[_0xee20('0x66')](config[_0xee20('0x68')],_0x39aa5e,_[_0xee20('0x67')](_0xee20('0x69')));}if(!fs['existsSync'](_0x34c3e1)){throw new db[(_0xee20('0x6a'))][(_0xee20('0x6b'))](_[_0xee20('0x6c')](_0xee20('0x5d'))+_0xee20('0x6d'));}return _0x232002[_0xee20('0x6e')](_0x34c3e1);}})[_0xee20('0x4e')](handleError(_0x232002,null));};var utilLicense=require(_0xee20('0x16'));exports[_0xee20('0x6f')]=function(_0x44c842,_0x250908,_0x58d1d2){var _0x418ba4=_0xee20('0x70');var _0x3881dc={'custom':![]};return utilLicense[_0xee20('0x5c')]()[_0xee20('0x31')](function(_0x22b507){if(_0x22b507){_0x3881dc=_0x22b507;}return db[_0xee20('0x4a')][_0xee20('0x55')]({'where':{'id':_0x44c842[_0xee20('0x50')]['id']},'attributes':[_0xee20('0x5d'),'loginLogo','preferred','favicon',_0xee20('0x61'),_0xee20('0x62'),_0xee20('0x63'),_0xee20('0x64')],'raw':!![]});})[_0xee20('0x31')](handleEntityNotFound(_0x250908,null))[_0xee20('0x31')](function(_0x15b51a){if(_0x15b51a){var _0x4b1d45=_0x15b51a[_0xee20('0x5e')]&&fs[_0xee20('0x65')](path['join'](config['root'],_0x418ba4,_['toLower'](_0x15b51a[_0xee20('0x5e')])))?path[_0xee20('0x66')](config[_0xee20('0x68')],_0x418ba4,_['toLower'](_0x15b51a['loginLogo'])):path['join'](config[_0xee20('0x68')],_0x418ba4,_[_0xee20('0x67')](_0xee20('0x71')));var _0x5b67db='default'+_[_0xee20('0x6c')]('loginLogo');if(_0x15b51a[_0x5b67db]||!_0x3881dc[_0xee20('0x72')]){_0x4b1d45=path['join'](config[_0xee20('0x68')],_0x418ba4,_[_0xee20('0x67')](_0xee20('0x71')));}if(!fs['existsSync'](_0x4b1d45)){throw new db[(_0xee20('0x6a'))][(_0xee20('0x6b'))](_[_0xee20('0x6c')](_0xee20('0x5e'))+'\x20not\x20found');}return _0x250908[_0xee20('0x6e')](_0x4b1d45);}})[_0xee20('0x4e')](handleError(_0x250908,null));};exports['gdpr']=function(_0x5c74d7,_0x28e804){return db[_0xee20('0x4a')]['find']({'where':{'id':_0x5c74d7['params']['id']},'attributes':[_0xee20('0x73')]})[_0xee20('0x31')](respondWithResult(_0x28e804,null))[_0xee20('0x4e')](handleError(_0x28e804,null));};exports[_0xee20('0x74')]=function(_0x16ac4b,_0x2b61c6,_0x50142a){if(_0x16ac4b[_0xee20('0x58')]&&_0x16ac4b[_0xee20('0x58')]['filename']){_0x16ac4b[_0xee20('0x56')][_0xee20('0x5f')]=_0x16ac4b[_0xee20('0x58')][_0xee20('0x59')];}return db[_0xee20('0x4a')][_0xee20('0x55')]({'where':{'id':_0x16ac4b[_0xee20('0x50')]['id']}})[_0xee20('0x31')](handleEntityNotFound(_0x2b61c6,null))[_0xee20('0x31')](saveUpdates(_0x16ac4b['body'],null))[_0xee20('0x31')](respondWithResult(_0x2b61c6,null))[_0xee20('0x4e')](handleError(_0x2b61c6,null));};var utilLicense=require(_0xee20('0x16'));exports['getPreferred']=function(_0x2d8866,_0x176382,_0x25ad10){var _0x63ea68=_0xee20('0x70');var _0x4ecaa4={'custom':![]};return utilLicense[_0xee20('0x5c')]()['then'](function(_0x5257b5){if(_0x5257b5){_0x4ecaa4=_0x5257b5;}return db[_0xee20('0x4a')][_0xee20('0x55')]({'where':{'id':_0x2d8866[_0xee20('0x50')]['id']},'attributes':[_0xee20('0x5d'),_0xee20('0x5e'),_0xee20('0x5f'),_0xee20('0x60'),_0xee20('0x61'),_0xee20('0x62'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x176382,null))[_0xee20('0x31')](function(_0x235edd){if(_0x235edd){var _0x5d6302=_0x235edd[_0xee20('0x5f')]&&fs['existsSync'](path[_0xee20('0x66')](config[_0xee20('0x68')],_0x63ea68,_[_0xee20('0x67')](_0x235edd[_0xee20('0x5f')])))?path[_0xee20('0x66')](config[_0xee20('0x68')],_0x63ea68,_[_0xee20('0x67')](_0x235edd[_0xee20('0x5f')])):path[_0xee20('0x66')](config[_0xee20('0x68')],_0x63ea68,_[_0xee20('0x67')](_0xee20('0x75')));var _0x5e54ba=_0xee20('0x76')+_[_0xee20('0x6c')](_0xee20('0x5f'));if(_0x235edd[_0x5e54ba]||!_0x4ecaa4[_0xee20('0x72')]||!_0x4ecaa4[_0xee20('0x5f')]){_0x5d6302=path[_0xee20('0x66')](config['root'],_0x63ea68,_['toLower'](_0xee20('0x75')));}if(!fs[_0xee20('0x65')](_0x5d6302)){throw new db[(_0xee20('0x6a'))]['ValidationError'](_[_0xee20('0x6c')](_0xee20('0x5f'))+_0xee20('0x6d'));}return _0x176382[_0xee20('0x6e')](_0x5d6302);}})[_0xee20('0x4e')](handleError(_0x176382,null));};exports[_0xee20('0x77')]=function(_0xf14001,_0x30dc05,_0x1190c0){if(_0xf14001[_0xee20('0x58')]&&_0xf14001[_0xee20('0x58')][_0xee20('0x59')]){_0xf14001[_0xee20('0x56')][_0xee20('0x60')]=_0xf14001[_0xee20('0x58')]['filename'];}return db[_0xee20('0x4a')][_0xee20('0x55')]({'where':{'id':_0xf14001['params']['id']}})[_0xee20('0x31')](handleEntityNotFound(_0x30dc05,null))[_0xee20('0x31')](saveUpdates(_0xf14001['body'],null))['then'](respondWithResult(_0x30dc05,null))[_0xee20('0x4e')](handleError(_0x30dc05,null));};var utilLicense=require(_0xee20('0x16'));exports['getFavicon']=function(_0x200477,_0x21bf71,_0x414c39){var _0x1dadc7=_0xee20('0x70');var _0x53cff0={'custom':![]};return utilLicense[_0xee20('0x5c')]()[_0xee20('0x31')](function(_0x4e4cee){if(_0x4e4cee){_0x53cff0=_0x4e4cee;}return db[_0xee20('0x4a')]['find']({'where':{'id':_0x200477[_0xee20('0x50')]['id']},'attributes':[_0xee20('0x5d'),_0xee20('0x5e'),_0xee20('0x5f'),_0xee20('0x60'),_0xee20('0x61'),_0xee20('0x62'),_0xee20('0x63'),_0xee20('0x64')],'raw':!![]});})[_0xee20('0x31')](handleEntityNotFound(_0x21bf71,null))[_0xee20('0x31')](function(_0x123804){if(_0x123804){var _0x3cd103=_0x123804[_0xee20('0x60')]&&fs[_0xee20('0x65')](path[_0xee20('0x66')](config[_0xee20('0x68')],_0x1dadc7,_[_0xee20('0x67')](_0x123804[_0xee20('0x60')])))?path[_0xee20('0x66')](config[_0xee20('0x68')],_0x1dadc7,_[_0xee20('0x67')](_0x123804[_0xee20('0x60')])):path[_0xee20('0x66')](config[_0xee20('0x68')],_0x1dadc7,_[_0xee20('0x67')](_0xee20('0x78')));var _0x2055da=_0xee20('0x76')+_[_0xee20('0x6c')](_0xee20('0x60'));if(_0x123804[_0x2055da]||!_0x53cff0[_0xee20('0x72')]){_0x3cd103=path[_0xee20('0x66')](config[_0xee20('0x68')],_0x1dadc7,_[_0xee20('0x67')](_0xee20('0x78')));}if(!fs[_0xee20('0x65')](_0x3cd103)){throw new db[(_0xee20('0x6a'))][(_0xee20('0x6b'))](_[_0xee20('0x6c')]('favicon')+_0xee20('0x6d'));}return _0x21bf71[_0xee20('0x6e')](_0x3cd103);}})['catch'](handleError(_0x21bf71,null));};exports[_0xee20('0x79')]=function(_0xb47286,_0x4c8b5c){var _0x29f341={'offset':moment()[_0xee20('0x7a')]()};_0x29f341['now']=moment()[_0xee20('0x7a')](_0x29f341['offset'])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x4c8b5c[_0xee20('0x26')](0xc8)[_0xee20('0x7b')](_0x29f341);}; \ No newline at end of file +var _0xb223=['options','includeAll','rows','catch','find','body','params','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','root','toLower','join','default_logo.svg','default','existsSync','Sequelize','upperFirst','\x20not\x20found','download','getLogoLogin','server/files/images/logos','default_loginLogo.svg','custom','ValidationError','securePassword','addPreferred','getPreferred','defaultLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','VIRTUAL','merge'];(function(_0x29c7a5,_0x5e29f8){var _0x2b231c=function(_0x422925){while(--_0x422925){_0x29c7a5['push'](_0x29c7a5['shift']());}};_0x2b231c(++_0x5e29f8);}(_0xb223,0x194));var _0x3b22=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0xb223[_0x26a906];return _0x495575;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b22('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b22('0x1'));var moment=require(_0x3b22('0x2'));var BPromise=require(_0x3b22('0x3'));var Mustache=require(_0x3b22('0x4'));var util=require(_0x3b22('0x5'));var path=require('path');var sox=require(_0x3b22('0x6'));var csv=require(_0x3b22('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b22('0x8'));var _=require(_0x3b22('0x9'));var squel=require(_0x3b22('0xa'));var crypto=require(_0x3b22('0xb'));var jsforce=require(_0x3b22('0xc'));var deskjs=require(_0x3b22('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3b22('0xe'));var Papa=require(_0x3b22('0xf'));var Redis=require(_0x3b22('0x10'));var authService=require(_0x3b22('0x11'));var qs=require(_0x3b22('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3b22('0x13'));var utils=require(_0x3b22('0x14'));var config=require(_0x3b22('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b22('0x16'))['db'];var jayson=require(_0x3b22('0x17'));var client=jayson[_0x3b22('0x18')][_0x3b22('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x58e2c0,_0x4ea4a1,_0x273c50,_0x7a4f85){return new BPromise(function(_0x185aba,_0x3495b9){var _0x4501be=_0x7a4f85||client;return _0x4501be['request'](_0x58e2c0,_0x273c50)['then'](function(_0x35ae87){logger[_0x3b22('0x1a')](_0x3b22('0x1b'),_0x4ea4a1,_0x3b22('0x1c'));logger[_0x3b22('0x1d')](_0x3b22('0x1e'),_0x4ea4a1,_0x3b22('0x1c'),JSON['stringify'](_0x35ae87));if(_0x35ae87[_0x3b22('0x1f')]){if(_0x35ae87[_0x3b22('0x1f')]['code']===0x1f4){logger[_0x3b22('0x1f')](_0x3b22('0x1b'),_0x4ea4a1,_0x35ae87[_0x3b22('0x1f')]['message']);return _0x3495b9(_0x35ae87[_0x3b22('0x1f')][_0x3b22('0x20')]);}logger['error'](_0x3b22('0x1b'),_0x4ea4a1,_0x35ae87[_0x3b22('0x1f')][_0x3b22('0x20')]);return _0x185aba(_0x35ae87[_0x3b22('0x1f')]['message']);}else{logger['info'](_0x3b22('0x1b'),_0x4ea4a1,_0x3b22('0x1c'));_0x185aba(_0x35ae87[_0x3b22('0x21')][_0x3b22('0x20')]);}})['catch'](function(_0x32e767){logger[_0x3b22('0x1f')](_0x3b22('0x1b'),_0x4ea4a1,_0x32e767);_0x3495b9(_0x32e767);});});}function respondWithStatusCode(_0x2a3bff,_0x4e0c86){_0x4e0c86=_0x4e0c86||0xcc;return function(_0x28a284){if(_0x28a284){return _0x2a3bff[_0x3b22('0x22')](_0x4e0c86);}return _0x2a3bff[_0x3b22('0x23')](_0x4e0c86)[_0x3b22('0x24')]();};}function respondWithResult(_0x53d9c6,_0x30a949){_0x30a949=_0x30a949||0xc8;return function(_0x1ac4e8){if(_0x1ac4e8){return _0x53d9c6[_0x3b22('0x23')](_0x30a949)[_0x3b22('0x25')](_0x1ac4e8);}};}function respondWithFilteredResult(_0x4bd052,_0x2705f0){return function(_0x3b87de){if(_0x3b87de){var _0x151410=typeof _0x2705f0[_0x3b22('0x26')]===_0x3b22('0x27')&&typeof _0x2705f0[_0x3b22('0x28')]===_0x3b22('0x27');var _0x377d74=_0x3b87de[_0x3b22('0x29')];var _0x17260d=_0x151410?0x0:_0x2705f0[_0x3b22('0x26')];var _0x21aaaf=_0x151410?_0x3b87de[_0x3b22('0x29')]:_0x2705f0['offset']+_0x2705f0[_0x3b22('0x28')];var _0x40a6d3;if(_0x21aaaf>=_0x377d74){_0x21aaaf=_0x377d74;_0x40a6d3=0xc8;}else{_0x40a6d3=0xce;}_0x4bd052[_0x3b22('0x23')](_0x40a6d3);return _0x4bd052['set'](_0x3b22('0x2a'),_0x17260d+'-'+_0x21aaaf+'/'+_0x377d74)['json'](_0x3b87de);}return null;};}function patchUpdates(_0x3775ea){return function(_0x72a0c1){try{jsonpatch[_0x3b22('0x2b')](_0x72a0c1,_0x3775ea,!![]);}catch(_0x4e509b){return BPromise[_0x3b22('0x2c')](_0x4e509b);}return _0x72a0c1['save']();};}function saveUpdates(_0x4d370f,_0x43d051){return function(_0x129dca){if(_0x129dca){return _0x129dca[_0x3b22('0x2d')](_0x4d370f)[_0x3b22('0x2e')](function(_0x33ae05){return _0x33ae05;});}return null;};}function removeEntity(_0x3101cb,_0x353554){return function(_0x23cef4){if(_0x23cef4){return _0x23cef4[_0x3b22('0x2f')]()[_0x3b22('0x2e')](function(){_0x3101cb['status'](0xcc)[_0x3b22('0x24')]();});}};}function handleEntityNotFound(_0x342e3f,_0xac56ee){return function(_0x4a919f){if(!_0x4a919f){_0x342e3f[_0x3b22('0x22')](0x194);}return _0x4a919f;};}function handleError(_0x14600f,_0x26d70a){_0x26d70a=_0x26d70a||0x1f4;return function(_0x2a129f){logger['error'](_0x2a129f[_0x3b22('0x30')]);if(_0x2a129f[_0x3b22('0x31')]){delete _0x2a129f[_0x3b22('0x31')];}_0x14600f[_0x3b22('0x23')](_0x26d70a)[_0x3b22('0x32')](_0x2a129f);};}exports[_0x3b22('0x33')]=function(_0x5a7fc4,_0x218147){var _0x281c5c={},_0x2d6a61={},_0x56dde3={'count':0x0,'rows':[]};var _0x382f3a=_[_0x3b22('0x34')](db[_0x3b22('0x35')][_0x3b22('0x36')],function(_0x429864){return{'name':_0x429864[_0x3b22('0x37')],'type':_0x429864[_0x3b22('0x38')][_0x3b22('0x39')]};});_0x2d6a61[_0x3b22('0x3a')]=_[_0x3b22('0x34')](_0x382f3a,_0x3b22('0x31'));_0x2d6a61[_0x3b22('0x3b')]=_[_0x3b22('0x3c')](_0x5a7fc4[_0x3b22('0x3b')]);_0x2d6a61[_0x3b22('0x3d')]=_[_0x3b22('0x3e')](_0x2d6a61[_0x3b22('0x3a')],_0x2d6a61[_0x3b22('0x3b')]);_0x281c5c[_0x3b22('0x3f')]=_[_0x3b22('0x3e')](_0x2d6a61[_0x3b22('0x3a')],qs[_0x3b22('0x40')](_0x5a7fc4[_0x3b22('0x3b')][_0x3b22('0x40')]));_0x281c5c[_0x3b22('0x3f')]=_0x281c5c[_0x3b22('0x3f')][_0x3b22('0x41')]?_0x281c5c['attributes']:_0x2d6a61['model'];if(!_0x5a7fc4[_0x3b22('0x3b')]['hasOwnProperty']('nolimit')){_0x281c5c[_0x3b22('0x28')]=qs[_0x3b22('0x28')](_0x5a7fc4[_0x3b22('0x3b')][_0x3b22('0x28')]);_0x281c5c[_0x3b22('0x26')]=qs[_0x3b22('0x26')](_0x5a7fc4['query'][_0x3b22('0x26')]);}_0x281c5c[_0x3b22('0x42')]=qs['sort'](_0x5a7fc4[_0x3b22('0x3b')]['sort']);_0x281c5c[_0x3b22('0x43')]=qs['filters'](_[_0x3b22('0x44')](_0x5a7fc4[_0x3b22('0x3b')],_0x2d6a61['filters']),_0x382f3a);if(_0x5a7fc4[_0x3b22('0x3b')][_0x3b22('0x45')]){_0x281c5c[_0x3b22('0x43')]=_['merge'](_0x281c5c[_0x3b22('0x43')],{'$or':_['map'](_0x382f3a,function(_0x410d6d){if(_0x410d6d['type']!==_0x3b22('0x46')){var _0x21549f={};_0x21549f[_0x410d6d['name']]={'$like':'%'+_0x5a7fc4[_0x3b22('0x3b')][_0x3b22('0x45')]+'%'};return _0x21549f;}})});}_0x281c5c=_[_0x3b22('0x47')]({},_0x281c5c,_0x5a7fc4[_0x3b22('0x48')]);var _0xffff1={'where':_0x281c5c[_0x3b22('0x43')]};return db[_0x3b22('0x35')][_0x3b22('0x29')](_0xffff1)[_0x3b22('0x2e')](function(_0x1aeb00){_0x56dde3[_0x3b22('0x29')]=_0x1aeb00;if(_0x5a7fc4[_0x3b22('0x3b')][_0x3b22('0x49')]){_0x281c5c['include']=[{'all':!![]}];}return db[_0x3b22('0x35')]['findAll'](_0x281c5c);})['then'](function(_0xcf11b8){_0x56dde3[_0x3b22('0x4a')]=_0xcf11b8;return _0x56dde3;})['then'](respondWithFilteredResult(_0x218147,_0x281c5c))[_0x3b22('0x4b')](handleError(_0x218147,null));};exports['show']=function(_0x51a618,_0x503df6){var _0x45c4fb={'raw':![],'where':{'id':_0x51a618['params']['id']}},_0x55e02a={};_0x55e02a[_0x3b22('0x3a')]=_[_0x3b22('0x3c')](db[_0x3b22('0x35')][_0x3b22('0x36')]);_0x55e02a['query']=_[_0x3b22('0x3c')](_0x51a618[_0x3b22('0x3b')]);_0x55e02a['filters']=_[_0x3b22('0x3e')](_0x55e02a['model'],_0x55e02a[_0x3b22('0x3b')]);_0x45c4fb[_0x3b22('0x3f')]=_['intersection'](_0x55e02a[_0x3b22('0x3a')],qs[_0x3b22('0x40')](_0x51a618[_0x3b22('0x3b')][_0x3b22('0x40')]));_0x45c4fb['attributes']=_0x45c4fb[_0x3b22('0x3f')][_0x3b22('0x41')]?_0x45c4fb[_0x3b22('0x3f')]:_0x55e02a[_0x3b22('0x3a')];if(_0x51a618['query'][_0x3b22('0x49')]){_0x45c4fb['include']=[{'all':!![]}];}_0x45c4fb=_[_0x3b22('0x47')]({},_0x45c4fb,_0x51a618[_0x3b22('0x48')]);return db[_0x3b22('0x35')][_0x3b22('0x4c')](_0x45c4fb)['then'](handleEntityNotFound(_0x503df6,null))[_0x3b22('0x2e')](respondWithResult(_0x503df6,null))[_0x3b22('0x4b')](handleError(_0x503df6,null));};exports[_0x3b22('0x2d')]=function(_0x20a5c3,_0xbb15f2){if(_0x20a5c3[_0x3b22('0x4d')]['id']){delete _0x20a5c3[_0x3b22('0x4d')]['id'];}return db['Setting']['find']({'where':{'id':_0x20a5c3[_0x3b22('0x4e')]['id']}})['then'](handleEntityNotFound(_0xbb15f2,null))[_0x3b22('0x2e')](saveUpdates(_0x20a5c3['body'],null))[_0x3b22('0x2e')](respondWithResult(_0xbb15f2,null))[_0x3b22('0x4b')](handleError(_0xbb15f2,null));};exports['addLogo']=function(_0x3f5e9e,_0x30615e,_0x15c788){if(_0x3f5e9e[_0x3b22('0x4f')]&&_0x3f5e9e['file'][_0x3b22('0x50')]){_0x3f5e9e[_0x3b22('0x4d')]['logo']=_0x3f5e9e[_0x3b22('0x4f')][_0x3b22('0x50')];}return db[_0x3b22('0x35')][_0x3b22('0x4c')]({'where':{'id':_0x3f5e9e[_0x3b22('0x4e')]['id']}})[_0x3b22('0x2e')](handleEntityNotFound(_0x30615e,null))['then'](saveUpdates(_0x3f5e9e[_0x3b22('0x4d')],null))[_0x3b22('0x2e')](respondWithResult(_0x30615e,null))[_0x3b22('0x4b')](handleError(_0x30615e,null));};exports[_0x3b22('0x51')]=function(_0x1d381c,_0x3cbc3a,_0x3b0fd3){if(_0x1d381c[_0x3b22('0x4f')]&&_0x1d381c['file']['filename']){_0x1d381c[_0x3b22('0x4d')][_0x3b22('0x52')]=_0x1d381c[_0x3b22('0x4f')][_0x3b22('0x50')];}return db['Setting'][_0x3b22('0x4c')]({'where':{'id':_0x1d381c[_0x3b22('0x4e')]['id']}})[_0x3b22('0x2e')](handleEntityNotFound(_0x3cbc3a,null))['then'](saveUpdates(_0x1d381c[_0x3b22('0x4d')],null))[_0x3b22('0x2e')](respondWithResult(_0x3cbc3a,null))['catch'](handleError(_0x3cbc3a,null));};var utilLicense=require(_0x3b22('0x53'));exports[_0x3b22('0x54')]=function(_0x4ae2bf,_0x11ce75,_0x2de5d6){var _0x2cc01c='server/files/images/logos';var _0x490392={'custom':![]};return utilLicense[_0x3b22('0x55')]()[_0x3b22('0x2e')](function(_0x20cf72){if(_0x20cf72){_0x490392=_0x20cf72;}return db['Setting'][_0x3b22('0x4c')]({'where':{'id':_0x4ae2bf[_0x3b22('0x4e')]['id']},'attributes':[_0x3b22('0x56'),'loginLogo',_0x3b22('0x57'),_0x3b22('0x58'),'defaultLogo',_0x3b22('0x59'),_0x3b22('0x5a'),_0x3b22('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x11ce75,null))[_0x3b22('0x2e')](function(_0x417958){if(_0x417958){var _0xe331f9=_0x417958[_0x3b22('0x56')]&&fs['existsSync'](path['join'](config[_0x3b22('0x5c')],_0x2cc01c,_[_0x3b22('0x5d')](_0x417958[_0x3b22('0x56')])))?path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x2cc01c,_['toLower'](_0x417958[_0x3b22('0x56')])):path['join'](config[_0x3b22('0x5c')],_0x2cc01c,_[_0x3b22('0x5d')](_0x3b22('0x5f')));var _0x4c8414=_0x3b22('0x60')+_['upperFirst'](_0x3b22('0x56'));if(_0x417958[_0x4c8414]||!_0x490392['custom']){_0xe331f9=path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x2cc01c,_[_0x3b22('0x5d')]('default_logo.svg'));}if(!fs[_0x3b22('0x61')](_0xe331f9)){throw new db[(_0x3b22('0x62'))]['ValidationError'](_[_0x3b22('0x63')](_0x3b22('0x56'))+_0x3b22('0x64'));}return _0x11ce75[_0x3b22('0x65')](_0xe331f9);}})[_0x3b22('0x4b')](handleError(_0x11ce75,null));};var utilLicense=require('../../config/license/util');exports[_0x3b22('0x66')]=function(_0x236964,_0x4476df,_0x65f98f){var _0x53ee5=_0x3b22('0x67');var _0x7f06d8={'custom':![]};return utilLicense[_0x3b22('0x55')]()[_0x3b22('0x2e')](function(_0x221c52){if(_0x221c52){_0x7f06d8=_0x221c52;}return db['Setting'][_0x3b22('0x4c')]({'where':{'id':_0x236964['params']['id']},'attributes':['logo',_0x3b22('0x52'),'preferred','favicon','defaultLogo','defaultLoginLogo',_0x3b22('0x5a'),_0x3b22('0x5b')],'raw':!![]});})[_0x3b22('0x2e')](handleEntityNotFound(_0x4476df,null))[_0x3b22('0x2e')](function(_0x28fbff){if(_0x28fbff){var _0x317164=_0x28fbff[_0x3b22('0x52')]&&fs['existsSync'](path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x53ee5,_[_0x3b22('0x5d')](_0x28fbff[_0x3b22('0x52')])))?path['join'](config[_0x3b22('0x5c')],_0x53ee5,_[_0x3b22('0x5d')](_0x28fbff['loginLogo'])):path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x53ee5,_[_0x3b22('0x5d')](_0x3b22('0x68')));var _0x4ffb90=_0x3b22('0x60')+_[_0x3b22('0x63')](_0x3b22('0x52'));if(_0x28fbff[_0x4ffb90]||!_0x7f06d8[_0x3b22('0x69')]){_0x317164=path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x53ee5,_[_0x3b22('0x5d')](_0x3b22('0x68')));}if(!fs['existsSync'](_0x317164)){throw new db[(_0x3b22('0x62'))][(_0x3b22('0x6a'))](_['upperFirst']('loginLogo')+_0x3b22('0x64'));}return _0x4476df[_0x3b22('0x65')](_0x317164);}})[_0x3b22('0x4b')](handleError(_0x4476df,null));};exports['gdpr']=function(_0x32d6dd,_0x53475a){return db[_0x3b22('0x35')][_0x3b22('0x4c')]({'where':{'id':_0x32d6dd[_0x3b22('0x4e')]['id']},'attributes':[_0x3b22('0x6b')]})[_0x3b22('0x2e')](respondWithResult(_0x53475a,null))['catch'](handleError(_0x53475a,null));};exports[_0x3b22('0x6c')]=function(_0xb660f7,_0x1025fd,_0x2f1355){if(_0xb660f7[_0x3b22('0x4f')]&&_0xb660f7[_0x3b22('0x4f')]['filename']){_0xb660f7['body'][_0x3b22('0x57')]=_0xb660f7['file'][_0x3b22('0x50')];}return db[_0x3b22('0x35')][_0x3b22('0x4c')]({'where':{'id':_0xb660f7[_0x3b22('0x4e')]['id']}})[_0x3b22('0x2e')](handleEntityNotFound(_0x1025fd,null))[_0x3b22('0x2e')](saveUpdates(_0xb660f7[_0x3b22('0x4d')],null))['then'](respondWithResult(_0x1025fd,null))[_0x3b22('0x4b')](handleError(_0x1025fd,null));};var utilLicense=require(_0x3b22('0x53'));exports[_0x3b22('0x6d')]=function(_0xb534e9,_0x539192,_0x403938){var _0x5462b3=_0x3b22('0x67');var _0x1f22e6={'custom':![]};return utilLicense['getLicense']()[_0x3b22('0x2e')](function(_0x4ecaca){if(_0x4ecaca){_0x1f22e6=_0x4ecaca;}return db[_0x3b22('0x35')]['find']({'where':{'id':_0xb534e9[_0x3b22('0x4e')]['id']},'attributes':['logo','loginLogo',_0x3b22('0x57'),_0x3b22('0x58'),_0x3b22('0x6e'),'defaultLoginLogo',_0x3b22('0x5a'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x539192,null))[_0x3b22('0x2e')](function(_0x19eb92){if(_0x19eb92){var _0x56796b=_0x19eb92[_0x3b22('0x57')]&&fs[_0x3b22('0x61')](path['join'](config['root'],_0x5462b3,_[_0x3b22('0x5d')](_0x19eb92[_0x3b22('0x57')])))?path['join'](config[_0x3b22('0x5c')],_0x5462b3,_[_0x3b22('0x5d')](_0x19eb92['preferred'])):path['join'](config[_0x3b22('0x5c')],_0x5462b3,_[_0x3b22('0x5d')](_0x3b22('0x6f')));var _0x2d4313=_0x3b22('0x60')+_[_0x3b22('0x63')](_0x3b22('0x57'));if(_0x19eb92[_0x2d4313]||!_0x1f22e6[_0x3b22('0x69')]||!_0x1f22e6['preferred']){_0x56796b=path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x5462b3,_[_0x3b22('0x5d')](_0x3b22('0x6f')));}if(!fs['existsSync'](_0x56796b)){throw new db['Sequelize'][(_0x3b22('0x6a'))](_[_0x3b22('0x63')]('preferred')+_0x3b22('0x64'));}return _0x539192[_0x3b22('0x65')](_0x56796b);}})[_0x3b22('0x4b')](handleError(_0x539192,null));};exports[_0x3b22('0x70')]=function(_0x33d4dd,_0x386b89,_0x2c5231){if(_0x33d4dd[_0x3b22('0x4f')]&&_0x33d4dd[_0x3b22('0x4f')]['filename']){_0x33d4dd[_0x3b22('0x4d')][_0x3b22('0x58')]=_0x33d4dd[_0x3b22('0x4f')]['filename'];}return db[_0x3b22('0x35')][_0x3b22('0x4c')]({'where':{'id':_0x33d4dd[_0x3b22('0x4e')]['id']}})[_0x3b22('0x2e')](handleEntityNotFound(_0x386b89,null))[_0x3b22('0x2e')](saveUpdates(_0x33d4dd['body'],null))[_0x3b22('0x2e')](respondWithResult(_0x386b89,null))[_0x3b22('0x4b')](handleError(_0x386b89,null));};var utilLicense=require(_0x3b22('0x53'));exports[_0x3b22('0x71')]=function(_0x351ee4,_0x3812e7,_0x4ccf59){var _0x1f5241=_0x3b22('0x67');var _0x5bc3d8={'custom':![]};return utilLicense['getLicense']()[_0x3b22('0x2e')](function(_0x3c35a8){if(_0x3c35a8){_0x5bc3d8=_0x3c35a8;}return db[_0x3b22('0x35')]['find']({'where':{'id':_0x351ee4[_0x3b22('0x4e')]['id']},'attributes':[_0x3b22('0x56'),_0x3b22('0x52'),_0x3b22('0x57'),_0x3b22('0x58'),_0x3b22('0x6e'),_0x3b22('0x59'),_0x3b22('0x5a'),_0x3b22('0x5b')],'raw':!![]});})[_0x3b22('0x2e')](handleEntityNotFound(_0x3812e7,null))[_0x3b22('0x2e')](function(_0x57879a){if(_0x57879a){var _0x4122eb=_0x57879a[_0x3b22('0x58')]&&fs[_0x3b22('0x61')](path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x1f5241,_[_0x3b22('0x5d')](_0x57879a['favicon'])))?path['join'](config['root'],_0x1f5241,_['toLower'](_0x57879a[_0x3b22('0x58')])):path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x1f5241,_['toLower'](_0x3b22('0x72')));var _0x405c70=_0x3b22('0x60')+_[_0x3b22('0x63')](_0x3b22('0x58'));if(_0x57879a[_0x405c70]||!_0x5bc3d8[_0x3b22('0x69')]){_0x4122eb=path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x1f5241,_[_0x3b22('0x5d')](_0x3b22('0x72')));}if(!fs[_0x3b22('0x61')](_0x4122eb)){throw new db[(_0x3b22('0x62'))][(_0x3b22('0x6a'))](_[_0x3b22('0x63')](_0x3b22('0x58'))+'\x20not\x20found');}return _0x3812e7[_0x3b22('0x65')](_0x4122eb);}})['catch'](handleError(_0x3812e7,null));};exports['getDate']=function(_0x185562,_0x37b9bc){var _0x3a98db={'offset':moment()[_0x3b22('0x73')]()};_0x3a98db[_0x3b22('0x74')]=moment()[_0x3b22('0x73')](_0x3a98db[_0x3b22('0x26')])[_0x3b22('0x75')](_0x3b22('0x76'));return _0x37b9bc[_0x3b22('0x23')](0xc8)[_0x3b22('0x32')](_0x3a98db);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 63b9bc7..874fba8 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x414243,_0x44b27c){var _0x4710e0=function(_0x1d52a5){while(--_0x1d52a5){_0x414243['push'](_0x414243['shift']());}};_0x4710e0(++_0x44b27c);}(_0x34e8,0x12c));var _0x834e=function(_0x59e2b0,_0x1fc0f8){_0x59e2b0=_0x59e2b0-0x0;var _0x5df164=_0x34e8[_0x59e2b0];return _0x5df164;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x5cdc79,_0x24beb1){var _0x22ddcf=function(_0x1f92bf){while(--_0x1f92bf){_0x5cdc79['push'](_0x5cdc79['shift']());}};_0x22ddcf(++_0x24beb1);}(_0x008c,0x188));var _0xc008=function(_0x52e64,_0x6ba4e8){_0x52e64=_0x52e64-0x0;var _0x282b80=_0x008c[_0x52e64];return _0x282b80;};'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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index fe1842a..df5dc11 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 _0xc45e=['rpc','../../config/environment','jayson/promise','client','http','request','info','debug','error','code','Setting,\x20%s,\x20%s','message','request\x20sent','result','catch','Setting','find','options','attributes','include','map','model','ShowSetting','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x4aa517,_0x13ae45){var _0x70934=function(_0x442951){while(--_0x442951){_0x4aa517['push'](_0x4aa517['shift']());}};_0x70934(++_0x13ae45);}(_0xc45e,0x1d7));var _0xec45=function(_0x26defd,_0x1f54bd){_0x26defd=_0x26defd-0x0;var _0x42d085=_0xc45e[_0x26defd];return _0x42d085;};'use strict';var _=require('lodash');var util=require(_0xec45('0x0'));var moment=require(_0xec45('0x1'));var BPromise=require(_0xec45('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xec45('0x3'));var logger=require(_0xec45('0x4'))(_0xec45('0x5'));var config=require(_0xec45('0x6'));var jayson=require(_0xec45('0x7'));var client=jayson[_0xec45('0x8')][_0xec45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x158e95,_0x52bb18,_0x2ca060){return new BPromise(function(_0x386ed9,_0x5313bc){return client[_0xec45('0xa')](_0x158e95,_0x2ca060)['then'](function(_0x2661da){logger[_0xec45('0xb')]('Setting,\x20%s,\x20%s',_0x52bb18,'request\x20sent');logger[_0xec45('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x52bb18,'request\x20sent',JSON['stringify'](_0x2661da));if(_0x2661da[_0xec45('0xd')]){if(_0x2661da['error'][_0xec45('0xe')]===0x1f4){logger[_0xec45('0xd')](_0xec45('0xf'),_0x52bb18,_0x2661da[_0xec45('0xd')][_0xec45('0x10')]);return _0x5313bc(_0x2661da[_0xec45('0xd')][_0xec45('0x10')]);}logger['error']('Setting,\x20%s,\x20%s',_0x52bb18,_0x2661da['error'][_0xec45('0x10')]);return _0x386ed9(_0x2661da[_0xec45('0xd')]['message']);}else{logger[_0xec45('0xb')](_0xec45('0xf'),_0x52bb18,_0xec45('0x11'));_0x386ed9(_0x2661da[_0xec45('0x12')][_0xec45('0x10')]);}})[_0xec45('0x13')](function(_0x39f920){logger[_0xec45('0xd')](_0xec45('0xf'),_0x52bb18,_0x39f920);_0x5313bc(_0x39f920);});});}exports['ShowSetting']=function(_0x5d7dc4){var _0x3a64bb=this;return new Promise(function(_0x1b9fcc,_0x183173){return db[_0xec45('0x14')][_0xec45('0x15')]({'raw':_0x5d7dc4[_0xec45('0x16')]?_0x5d7dc4[_0xec45('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5d7dc4['options']?_0x5d7dc4[_0xec45('0x16')]['where']||null:null,'attributes':_0x5d7dc4[_0xec45('0x16')]?_0x5d7dc4[_0xec45('0x16')][_0xec45('0x17')]||null:null,'include':_0x5d7dc4[_0xec45('0x16')]?_0x5d7dc4[_0xec45('0x16')][_0xec45('0x18')]?_[_0xec45('0x19')](_0x5d7dc4[_0xec45('0x16')][_0xec45('0x18')],function(_0x2dd9f8){return{'model':db[_0x2dd9f8['model']],'as':_0x2dd9f8['as'],'attributes':_0x2dd9f8[_0xec45('0x17')],'include':_0x2dd9f8[_0xec45('0x18')]?_[_0xec45('0x19')](_0x2dd9f8[_0xec45('0x18')],function(_0x518a50){return{'model':db[_0x518a50[_0xec45('0x1a')]],'as':_0x518a50['as'],'attributes':_0x518a50['attributes'],'include':_0x518a50[_0xec45('0x18')]?_[_0xec45('0x19')](_0x518a50['include'],function(_0x5361e1){return{'model':db[_0x5361e1['model']],'as':_0x5361e1['as'],'attributes':_0x5361e1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1be4cc){logger[_0xec45('0xb')](_0xec45('0x1b'),_0x5d7dc4);logger[_0xec45('0xc')]('ShowSetting',_0x5d7dc4,JSON['stringify'](_0x1be4cc));_0x1b9fcc(_0x1be4cc);})[_0xec45('0x13')](function(_0x47a8a5){logger['error']('ShowSetting',_0x47a8a5[_0xec45('0x10')],_0x5d7dc4);_0x183173(_0x3a64bb[_0xec45('0xd')](0x1f4,_0x47a8a5['message']));});});}; \ No newline at end of file +var _0x25ec=['result','catch','ShowSetting','Setting','find','options','raw','where','include','map','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x368c85,_0x586b0a){var _0x3477c2=function(_0x3ef6d9){while(--_0x3ef6d9){_0x368c85['push'](_0x368c85['shift']());}};_0x3477c2(++_0x586b0a);}(_0x25ec,0x177));var _0xc25e=function(_0x5e825e,_0x9d22d0){_0x5e825e=_0x5e825e-0x0;var _0x3c5d02=_0x25ec[_0x5e825e];return _0x3c5d02;};'use strict';var _=require(_0xc25e('0x0'));var util=require(_0xc25e('0x1'));var moment=require('moment');var BPromise=require(_0xc25e('0x2'));var rs=require(_0xc25e('0x3'));var fs=require('fs');var Redis=require(_0xc25e('0x4'));var db=require(_0xc25e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc25e('0x6'))(_0xc25e('0x7'));var config=require(_0xc25e('0x8'));var jayson=require(_0xc25e('0x9'));var client=jayson[_0xc25e('0xa')][_0xc25e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58ed5c,_0xd2b01c,_0x4e234e){return new BPromise(function(_0x35a7f2,_0x50c9c0){return client['request'](_0x58ed5c,_0x4e234e)[_0xc25e('0xc')](function(_0xab5b47){logger[_0xc25e('0xd')](_0xc25e('0xe'),_0xd2b01c,'request\x20sent');logger[_0xc25e('0xf')](_0xc25e('0x10'),_0xd2b01c,_0xc25e('0x11'),JSON[_0xc25e('0x12')](_0xab5b47));if(_0xab5b47[_0xc25e('0x13')]){if(_0xab5b47[_0xc25e('0x13')]['code']===0x1f4){logger['error'](_0xc25e('0xe'),_0xd2b01c,_0xab5b47[_0xc25e('0x13')][_0xc25e('0x14')]);return _0x50c9c0(_0xab5b47[_0xc25e('0x13')]['message']);}logger['error']('Setting,\x20%s,\x20%s',_0xd2b01c,_0xab5b47[_0xc25e('0x13')]['message']);return _0x35a7f2(_0xab5b47[_0xc25e('0x13')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0xd2b01c,_0xc25e('0x11'));_0x35a7f2(_0xab5b47[_0xc25e('0x15')][_0xc25e('0x14')]);}})[_0xc25e('0x16')](function(_0x5d59d2){logger[_0xc25e('0x13')]('Setting,\x20%s,\x20%s',_0xd2b01c,_0x5d59d2);_0x50c9c0(_0x5d59d2);});});}exports[_0xc25e('0x17')]=function(_0x1c7593){var _0x43db37=this;return new Promise(function(_0x18d593,_0x2bd60f){return db[_0xc25e('0x18')][_0xc25e('0x19')]({'raw':_0x1c7593[_0xc25e('0x1a')]?_0x1c7593['options'][_0xc25e('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c7593[_0xc25e('0x1a')]?_0x1c7593[_0xc25e('0x1a')][_0xc25e('0x1c')]||null:null,'attributes':_0x1c7593[_0xc25e('0x1a')]?_0x1c7593[_0xc25e('0x1a')]['attributes']||null:null,'include':_0x1c7593[_0xc25e('0x1a')]?_0x1c7593[_0xc25e('0x1a')][_0xc25e('0x1d')]?_[_0xc25e('0x1e')](_0x1c7593[_0xc25e('0x1a')]['include'],function(_0x14e5e1){return{'model':db[_0x14e5e1[_0xc25e('0x1f')]],'as':_0x14e5e1['as'],'attributes':_0x14e5e1[_0xc25e('0x20')],'include':_0x14e5e1[_0xc25e('0x1d')]?_[_0xc25e('0x1e')](_0x14e5e1[_0xc25e('0x1d')],function(_0xbf1e3){return{'model':db[_0xbf1e3['model']],'as':_0xbf1e3['as'],'attributes':_0xbf1e3[_0xc25e('0x20')],'include':_0xbf1e3['include']?_['map'](_0xbf1e3[_0xc25e('0x1d')],function(_0x57b10e){return{'model':db[_0x57b10e[_0xc25e('0x1f')]],'as':_0x57b10e['as'],'attributes':_0x57b10e[_0xc25e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cfca4){logger[_0xc25e('0xd')](_0xc25e('0x17'),_0x1c7593);logger['debug'](_0xc25e('0x17'),_0x1c7593,JSON[_0xc25e('0x12')](_0x3cfca4));_0x18d593(_0x3cfca4);})[_0xc25e('0x16')](function(_0x3a4b75){logger[_0xc25e('0x13')]('ShowSetting',_0x3a4b75['message'],_0x1c7593);_0x2bd60f(_0x43db37[_0xc25e('0x13')](0x1f4,_0x3a4b75[_0xc25e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 33d3c76..8e170ad 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(_0x34190e,_0x50ecc7){var _0x41a4e6=function(_0x4a9ad9){while(--_0x4a9ad9){_0x34190e['push'](_0x34190e['shift']());}};_0x41a4e6(++_0x50ecc7);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/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 _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x275f4a,_0x2077d4){var _0x4b4a21=function(_0x391bab){while(--_0x391bab){_0x275f4a['push'](_0x275f4a['shift']());}};_0x4b4a21(++_0x2077d4);}(_0x814b,0x1a2));var _0xb814=function(_0x49c6cc,_0x308bdb){_0x49c6cc=_0x49c6cc-0x0;var _0x22e239=_0x814b[_0x49c6cc];return _0x22e239;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0cc9747..a426db0 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 _0x03c5=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT'];(function(_0x2be82a,_0x16f028){var _0x4dcfb3=function(_0x205d67){while(--_0x205d67){_0x2be82a['push'](_0x2be82a['shift']());}};_0x4dcfb3(++_0x16f028);}(_0x03c5,0x149));var _0x503c=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0x03c5[_0x1a37e3];return _0x4db78a;};'use strict';var Sequelize=require(_0x503c('0x0'));var rs=require(_0x503c('0x1'));module[_0x503c('0x2')]={'name':{'type':Sequelize[_0x503c('0x3')],'unique':_0x503c('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x503c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x503c('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x503c('0x3')]},'type':{'type':Sequelize[_0x503c('0x5')]('twilio',_0x503c('0x6'),_0x503c('0x7'),_0x503c('0x8'),_0x503c('0x9'),_0x503c('0xa'),_0x503c('0xb'),_0x503c('0xc'),_0x503c('0xd'),'intelepeer')},'accountSid':{'type':Sequelize[_0x503c('0x3')]},'authId':{'type':Sequelize[_0x503c('0x3')]},'authToken':{'type':Sequelize[_0x503c('0x3')]},'smsMethod':{'type':Sequelize[_0x503c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x503c('0x3')]},'password':{'type':Sequelize[_0x503c('0x3')]},'apiKey':{'type':Sequelize[_0x503c('0x3')]},'applicationId':{'type':Sequelize[_0x503c('0x3')]},'accountId':{'type':Sequelize[_0x503c('0x3')]},'senderString':{'type':Sequelize[_0x503c('0x3')]},'deliveryReport':{'type':Sequelize[_0x503c('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x503c('0xf')],'defaultValue':function(){return _0x503c('0x10');}},'notificationSound':{'type':Sequelize[_0x503c('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x503c('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x503c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x503c('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x503c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x503c('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x503c('0x11')],'comment':_0x503c('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x503c('0x13'),'set':function(_0x5ecd28){if(!_0x5ecd28)this[_0x503c('0x14')](_0x503c('0x15'),null);this[_0x503c('0x14')](_0x503c('0x16'),_0x5ecd28);}}}; \ No newline at end of file +var _0x6a9e=['setDataValue','mandatoryDisposition','sequelize','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x5b59e2,_0xdc1ffc){var _0x547f36=function(_0x59140d){while(--_0x59140d){_0x5b59e2['push'](_0x5b59e2['shift']());}};_0x547f36(++_0xdc1ffc);}(_0x6a9e,0x6b));var _0xe6a9=function(_0x2797d8,_0x1356b8){_0x2797d8=_0x2797d8-0x0;var _0x422572=_0x6a9e[_0x2797d8];return _0x422572;};'use strict';var Sequelize=require(_0xe6a9('0x0'));var rs=require('randomstring');module[_0xe6a9('0x1')]={'name':{'type':Sequelize[_0xe6a9('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xe6a9('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xe6a9('0x2')],'defaultValue':function(){return rs[_0xe6a9('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe6a9('0x4')](_0xe6a9('0x5'),_0xe6a9('0x6'),_0xe6a9('0x7'),_0xe6a9('0x8'),'plivo',_0xe6a9('0x9'),_0xe6a9('0xa'),_0xe6a9('0xb'),_0xe6a9('0xc'),_0xe6a9('0xd'))},'accountSid':{'type':Sequelize[_0xe6a9('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xe6a9('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe6a9('0x2')]},'password':{'type':Sequelize[_0xe6a9('0x2')]},'apiKey':{'type':Sequelize[_0xe6a9('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xe6a9('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xe6a9('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xe6a9('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe6a9('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe6a9('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe6a9('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe6a9('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe6a9('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe6a9('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe6a9('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe6a9('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe6a9('0xf')],'comment':_0xe6a9('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xe6a9('0xe')],'defaultValue':![],'comment':_0xe6a9('0x11'),'set':function(_0x4414bf){if(!_0x4414bf)this['setDataValue'](_0xe6a9('0x12'),null);this[_0xe6a9('0x13')](_0xe6a9('0x14'),_0x4414bf);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index fbfb8cd..30fcb25 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 _0x3ec5=['close','unmanaged','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','*,*,*,*','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send','\x0a','addApplications','transaction','sequelize','Transaction','bulkCreate','priority','finally','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','CmList','List','user','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','infobip','DELIVERED','groupName','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','jayson/promise','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','SmsAccounts','UserProfileResource','destroy','stack','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','type','includeAll','include','findAll','rows','show','params','keys','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','rawAttributes','length','sort','merge','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','From','messageId','MessageSid','skebby','from','sender','text','clicksend','Text','results','csc','originatingAddress','clickatell','replyMessageId','bandwidth','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','push'];(function(_0x491fbe,_0x549481){var _0xf95c87=function(_0xfd8ba4){while(--_0xfd8ba4){_0x491fbe['push'](_0x491fbe['shift']());}};_0xf95c87(++_0x549481);}(_0x3ec5,0x123));var _0x53ec=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3ec5[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x53ec('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x53ec('0x1'));var rp=require(_0x53ec('0x2'));var moment=require(_0x53ec('0x3'));var BPromise=require(_0x53ec('0x4'));var Mustache=require('mustache');var util=require(_0x53ec('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x53ec('0x6'));var ejs=require(_0x53ec('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53ec('0x8'));var squel=require(_0x53ec('0x9'));var crypto=require(_0x53ec('0xa'));var jsforce=require(_0x53ec('0xb'));var deskjs=require(_0x53ec('0xc'));var toCsv=require(_0x53ec('0x6'));var querystring=require(_0x53ec('0xd'));var Papa=require(_0x53ec('0xe'));var Redis=require(_0x53ec('0xf'));var authService=require(_0x53ec('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x53ec('0x11'));var hardwareService=require(_0x53ec('0x12'));var logger=require('../../config/logger')(_0x53ec('0x13'));var utils=require(_0x53ec('0x14'));var config=require(_0x53ec('0x15'));var licenseUtil=require(_0x53ec('0x16'));var db=require(_0x53ec('0x17'))['db'];config[_0x53ec('0x18')]=_[_0x53ec('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x53ec('0x18')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x53ec('0x1a'));var client=jayson['client'][_0x53ec('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x2c7185,_0x4cdd9e,_0x2c0234,_0x321a32){return new BPromise(function(_0x25183c,_0x33bfab){var _0x462db9=_0x321a32||client;return _0x462db9[_0x53ec('0x1c')](_0x2c7185,_0x2c0234)['then'](function(_0x1fe65e){logger[_0x53ec('0x1d')](_0x53ec('0x1e'),_0x4cdd9e,_0x53ec('0x1f'));logger[_0x53ec('0x20')](_0x53ec('0x21'),_0x4cdd9e,'request\x20sent',JSON[_0x53ec('0x22')](_0x1fe65e));if(_0x1fe65e['error']){if(_0x1fe65e['error'][_0x53ec('0x23')]===0x1f4){logger[_0x53ec('0x24')](_0x53ec('0x1e'),_0x4cdd9e,_0x1fe65e[_0x53ec('0x24')][_0x53ec('0x25')]);return _0x33bfab(_0x1fe65e['error'][_0x53ec('0x25')]);}logger[_0x53ec('0x24')](_0x53ec('0x1e'),_0x4cdd9e,_0x1fe65e[_0x53ec('0x24')]['message']);return _0x25183c(_0x1fe65e[_0x53ec('0x24')][_0x53ec('0x25')]);}else{logger[_0x53ec('0x1d')](_0x53ec('0x1e'),_0x4cdd9e,'request\x20sent');_0x25183c(_0x1fe65e[_0x53ec('0x26')]['message']);}})[_0x53ec('0x27')](function(_0x4a306b){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4cdd9e,_0x4a306b);_0x33bfab(_0x4a306b);});});}function respondWithStatusCode(_0x300754,_0x3f3d73){_0x3f3d73=_0x3f3d73||0xcc;return function(_0x50357b){if(_0x50357b){return _0x300754[_0x53ec('0x28')](_0x3f3d73);}return _0x300754[_0x53ec('0x29')](_0x3f3d73)[_0x53ec('0x2a')]();};}function respondWithResult(_0x5460c7,_0xf061c9){_0xf061c9=_0xf061c9||0xc8;return function(_0x3f689c){if(_0x3f689c){return _0x5460c7[_0x53ec('0x29')](_0xf061c9)['json'](_0x3f689c);}};}function respondWithFilteredResult(_0x1ef8ac,_0x4062b2){return function(_0x3a899a){if(_0x3a899a){var _0x454b21=typeof _0x4062b2[_0x53ec('0x2b')]===_0x53ec('0x2c')&&typeof _0x4062b2['limit']===_0x53ec('0x2c');var _0x2487e1=_0x3a899a['count'];var _0xd72d42=_0x454b21?0x0:_0x4062b2[_0x53ec('0x2b')];var _0x5e5441=_0x454b21?_0x3a899a[_0x53ec('0x2d')]:_0x4062b2[_0x53ec('0x2b')]+_0x4062b2[_0x53ec('0x2e')];var _0x3efb05;if(_0x5e5441>=_0x2487e1){_0x5e5441=_0x2487e1;_0x3efb05=0xc8;}else{_0x3efb05=0xce;}_0x1ef8ac['status'](_0x3efb05);return _0x1ef8ac[_0x53ec('0x2f')](_0x53ec('0x30'),_0xd72d42+'-'+_0x5e5441+'/'+_0x2487e1)[_0x53ec('0x31')](_0x3a899a);}return null;};}function patchUpdates(_0x14a627){return function(_0x1cb93b){try{jsonpatch[_0x53ec('0x32')](_0x1cb93b,_0x14a627,!![]);}catch(_0x12cb74){return BPromise[_0x53ec('0x33')](_0x12cb74);}return _0x1cb93b[_0x53ec('0x34')]();};}function saveUpdates(_0x3b3930,_0x57d35e){return function(_0x4e8c15){if(_0x4e8c15){return _0x4e8c15[_0x53ec('0x35')](_0x3b3930)[_0x53ec('0x36')](function(_0x43f915){return _0x43f915;});}return null;};}function removeEntity(_0x36aea4,_0x55448b){return function(_0x5be86c){if(_0x5be86c){return _0x5be86c['destroy']()[_0x53ec('0x36')](function(){var _0x288694=_0x5be86c[_0x53ec('0x37')]({'plain':!![]});var _0x3f0e16=_0x53ec('0x38');return db[_0x53ec('0x39')][_0x53ec('0x3a')]({'where':{'type':_0x3f0e16,'resourceId':_0x288694['id']}})['then'](function(){return _0x5be86c;});})[_0x53ec('0x36')](function(){_0x36aea4[_0x53ec('0x29')](0xcc)[_0x53ec('0x2a')]();});}};}function handleEntityNotFound(_0x536354,_0x1f2c0b){return function(_0x15a5fb){if(!_0x15a5fb){_0x536354[_0x53ec('0x28')](0x194);}return _0x15a5fb;};}function handleError(_0x504d2c,_0x47cf76){_0x47cf76=_0x47cf76||0x1f4;return function(_0x31ffe7){logger[_0x53ec('0x24')](_0x31ffe7[_0x53ec('0x3b')]);if(_0x31ffe7['name']){delete _0x31ffe7['name'];}_0x504d2c[_0x53ec('0x29')](_0x47cf76)['send'](_0x31ffe7);};}exports['index']=function(_0x1987fb,_0x1ba72e){var _0x468e0e={'include':[{'model':db[_0x53ec('0x3c')],'as':_0x53ec('0x3d')}]},_0x5f138c={},_0x5d2205={'count':0x0,'rows':[]};var _0x3e35db=_[_0x53ec('0x3e')](db[_0x53ec('0x3f')]['rawAttributes'],function(_0x2aee60){return{'name':_0x2aee60[_0x53ec('0x40')],'type':_0x2aee60['type'][_0x53ec('0x41')]};});_0x5f138c[_0x53ec('0x42')]=_[_0x53ec('0x3e')](_0x3e35db,_0x53ec('0x43'));_0x5f138c[_0x53ec('0x44')]=_['keys'](_0x1987fb[_0x53ec('0x44')]);_0x5f138c[_0x53ec('0x45')]=_[_0x53ec('0x46')](_0x5f138c[_0x53ec('0x42')],_0x5f138c['query']);_0x468e0e[_0x53ec('0x47')]=_[_0x53ec('0x46')](_0x5f138c[_0x53ec('0x42')],qs[_0x53ec('0x48')](_0x1987fb[_0x53ec('0x44')][_0x53ec('0x48')]));_0x468e0e[_0x53ec('0x47')]=_0x468e0e[_0x53ec('0x47')]['length']?_0x468e0e[_0x53ec('0x47')]:_0x5f138c[_0x53ec('0x42')];if(!_0x1987fb[_0x53ec('0x44')][_0x53ec('0x49')](_0x53ec('0x4a'))){_0x468e0e[_0x53ec('0x2e')]=qs[_0x53ec('0x2e')](_0x1987fb[_0x53ec('0x44')][_0x53ec('0x2e')]);_0x468e0e[_0x53ec('0x2b')]=qs[_0x53ec('0x2b')](_0x1987fb[_0x53ec('0x44')]['offset']);}_0x468e0e[_0x53ec('0x4b')]=qs['sort'](_0x1987fb[_0x53ec('0x44')]['sort']);_0x468e0e['where']=qs[_0x53ec('0x45')](_[_0x53ec('0x4c')](_0x1987fb['query'],_0x5f138c[_0x53ec('0x45')]),_0x3e35db);if(_0x1987fb[_0x53ec('0x44')][_0x53ec('0x4d')]){_0x468e0e[_0x53ec('0x4e')]=_['merge'](_0x468e0e[_0x53ec('0x4e')],{'$or':_[_0x53ec('0x3e')](_0x3e35db,function(_0x363139){if(_0x363139[_0x53ec('0x4f')]!=='VIRTUAL'){var _0x2e78b8={};_0x2e78b8[_0x363139[_0x53ec('0x43')]]={'$like':'%'+_0x1987fb[_0x53ec('0x44')]['filter']+'%'};return _0x2e78b8;}})});}_0x468e0e=_['merge']({},_0x468e0e,_0x1987fb['options']);var _0x4aebdd={'where':_0x468e0e[_0x53ec('0x4e')]};return db[_0x53ec('0x3f')][_0x53ec('0x2d')](_0x4aebdd)['then'](function(_0x1f9db9){_0x5d2205[_0x53ec('0x2d')]=_0x1f9db9;if(_0x1987fb[_0x53ec('0x44')][_0x53ec('0x50')]){_0x468e0e[_0x53ec('0x51')]=[{'all':!![]}];}return db[_0x53ec('0x3f')][_0x53ec('0x52')](_0x468e0e);})[_0x53ec('0x36')](function(_0x4f623f){_0x5d2205[_0x53ec('0x53')]=_0x4f623f;return _0x5d2205;})['then'](respondWithFilteredResult(_0x1ba72e,_0x468e0e))['catch'](handleError(_0x1ba72e,null));};exports[_0x53ec('0x54')]=function(_0x32974a,_0x4bbb01){var _0xced58a={'raw':![],'where':{'id':_0x32974a[_0x53ec('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x53ec('0x3d')}]},_0x5f2a6f={};_0x5f2a6f['model']=_[_0x53ec('0x56')](db[_0x53ec('0x3f')]['rawAttributes']);_0x5f2a6f[_0x53ec('0x44')]=_[_0x53ec('0x56')](_0x32974a[_0x53ec('0x44')]);_0x5f2a6f['filters']=_[_0x53ec('0x46')](_0x5f2a6f['model'],_0x5f2a6f[_0x53ec('0x44')]);_0xced58a[_0x53ec('0x47')]=_[_0x53ec('0x46')](_0x5f2a6f[_0x53ec('0x42')],qs['fields'](_0x32974a['query'][_0x53ec('0x48')]));_0xced58a['attributes']=_0xced58a[_0x53ec('0x47')]['length']?_0xced58a['attributes']:_0x5f2a6f['model'];if(_0x32974a[_0x53ec('0x44')][_0x53ec('0x50')]){_0xced58a[_0x53ec('0x51')]=[{'all':!![]}];}_0xced58a=_['merge']({},_0xced58a,_0x32974a[_0x53ec('0x57')]);return db[_0x53ec('0x3f')]['find'](_0xced58a)[_0x53ec('0x36')](handleEntityNotFound(_0x4bbb01,null))[_0x53ec('0x36')](respondWithResult(_0x4bbb01,null))[_0x53ec('0x27')](handleError(_0x4bbb01,null));};exports[_0x53ec('0x58')]=function(_0x5011c5,_0x1b6bbf){return db[_0x53ec('0x3f')][_0x53ec('0x58')](_0x5011c5[_0x53ec('0x59')],{})[_0x53ec('0x36')](function(_0x4c9021){var _0x3fcf71=_0x5011c5['user']['get']({'plain':!![]});if(!_0x3fcf71)throw new Error(_0x53ec('0x5a'));if(_0x3fcf71[_0x53ec('0x5b')]==='user'){var _0x48378c=_0x4c9021[_0x53ec('0x37')]({'plain':!![]});var _0x34329d=_0x53ec('0x38');return db[_0x53ec('0x5c')]['find']({'where':{'name':_0x34329d,'userProfileId':_0x3fcf71[_0x53ec('0x5d')]},'raw':!![]})[_0x53ec('0x36')](function(_0x5788e1){if(_0x5788e1&&_0x5788e1[_0x53ec('0x5e')]===0x0){return db[_0x53ec('0x39')]['create']({'name':_0x48378c[_0x53ec('0x43')],'resourceId':_0x48378c['id'],'type':_0x5788e1['name'],'sectionId':_0x5788e1['id']},{})[_0x53ec('0x36')](function(){return _0x4c9021;});}else{return _0x4c9021;}})[_0x53ec('0x27')](function(_0xc96231){logger[_0x53ec('0x24')](_0x53ec('0x5f'),_0xc96231);throw _0xc96231;});}return _0x4c9021;})[_0x53ec('0x36')](respondWithResult(_0x1b6bbf,0xc9))[_0x53ec('0x27')](handleError(_0x1b6bbf,null));};exports[_0x53ec('0x35')]=function(_0x610be6,_0x1fd8c0){if(_0x610be6['body']['id']){delete _0x610be6[_0x53ec('0x59')]['id'];}return db['SmsAccount'][_0x53ec('0x60')]({'where':{'id':_0x610be6['params']['id']},'include':[{'model':db[_0x53ec('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x53ec('0x36')](handleEntityNotFound(_0x1fd8c0,null))[_0x53ec('0x36')](saveUpdates(_0x610be6[_0x53ec('0x59')],null))[_0x53ec('0x36')](respondWithResult(_0x1fd8c0,null))[_0x53ec('0x27')](handleError(_0x1fd8c0,null));};exports[_0x53ec('0x3a')]=function(_0x5e0a08,_0x1cf8ad){return db[_0x53ec('0x3f')][_0x53ec('0x60')]({'where':{'id':_0x5e0a08[_0x53ec('0x55')]['id']}})['then'](handleEntityNotFound(_0x1cf8ad,null))[_0x53ec('0x36')](removeEntity(_0x1cf8ad,null))[_0x53ec('0x27')](handleError(_0x1cf8ad,null));};exports['describe']=function(_0x5d0ee0,_0x182f7b){return db['SmsAccount'][_0x53ec('0x61')]()[_0x53ec('0x36')](respondWithResult(_0x182f7b,null))[_0x53ec('0x27')](handleError(_0x182f7b,null));};exports[_0x53ec('0x62')]=function(_0x40d8b1,_0x479565,_0x111019){if(_0x40d8b1[_0x53ec('0x59')]['id']){delete _0x40d8b1['body']['id'];}return db[_0x53ec('0x3f')][_0x53ec('0x60')]({'where':{'id':_0x40d8b1[_0x53ec('0x55')]['id']}})[_0x53ec('0x36')](handleEntityNotFound(_0x479565,null))[_0x53ec('0x36')](function(_0x38ab61){if(_0x38ab61){_0x40d8b1[_0x53ec('0x59')][_0x53ec('0x63')]=_0x38ab61['id'];return db[_0x53ec('0x64')]['create'](_0x40d8b1['body']);}})['then'](respondWithResult(_0x479565,null))[_0x53ec('0x27')](handleError(_0x479565,null));};exports[_0x53ec('0x65')]=function(_0x206f60,_0x2ba288,_0x3feae5){var _0x3660aa={'raw':![],'where':{}};var _0x4b44e2={};var _0x6c005b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x53ec('0x66')]({'where':{'id':_0x206f60[_0x53ec('0x55')]['id']}})[_0x53ec('0x36')](handleEntityNotFound(_0x2ba288,null))['then'](function(_0x25dd96){if(_0x25dd96){_0x4b44e2[_0x53ec('0x42')]=_[_0x53ec('0x56')](db['Disposition'][_0x53ec('0x67')]);_0x4b44e2[_0x53ec('0x44')]=_['keys'](_0x206f60[_0x53ec('0x44')]);_0x4b44e2[_0x53ec('0x45')]=_[_0x53ec('0x46')](_0x4b44e2[_0x53ec('0x42')],_0x4b44e2[_0x53ec('0x44')]);_0x3660aa[_0x53ec('0x47')]=_['intersection'](_0x4b44e2[_0x53ec('0x42')],qs[_0x53ec('0x48')](_0x206f60[_0x53ec('0x44')][_0x53ec('0x48')]));_0x3660aa[_0x53ec('0x47')]=_0x3660aa[_0x53ec('0x47')][_0x53ec('0x68')]?_0x3660aa[_0x53ec('0x47')]:_0x4b44e2[_0x53ec('0x42')];if(!_0x206f60[_0x53ec('0x44')][_0x53ec('0x49')](_0x53ec('0x4a'))){_0x3660aa['limit']=qs['limit'](_0x206f60[_0x53ec('0x44')][_0x53ec('0x2e')]);_0x3660aa['offset']=qs[_0x53ec('0x2b')](_0x206f60['query'][_0x53ec('0x2b')]);}_0x3660aa['order']=qs[_0x53ec('0x69')](_0x206f60[_0x53ec('0x44')]['sort']);_0x3660aa[_0x53ec('0x4e')]=qs[_0x53ec('0x45')](_['pick'](_0x206f60['query'],_0x4b44e2[_0x53ec('0x45')]));_0x3660aa[_0x53ec('0x4e')]['SmsAccountId']=_0x25dd96['id'];if(_0x206f60[_0x53ec('0x44')][_0x53ec('0x4d')]){_0x3660aa['where']=_[_0x53ec('0x6a')](_0x3660aa[_0x53ec('0x4e')],{'$or':_[_0x53ec('0x3e')](_0x3660aa[_0x53ec('0x47')],function(_0x42049e){var _0x17e16b={};_0x17e16b[_0x42049e]={'$like':'%'+_0x206f60[_0x53ec('0x44')][_0x53ec('0x4d')]+'%'};return _0x17e16b;})});}_0x3660aa=_[_0x53ec('0x6a')]({},_0x3660aa,_0x206f60[_0x53ec('0x57')]);return db[_0x53ec('0x64')][_0x53ec('0x2d')]({'where':_0x3660aa[_0x53ec('0x4e')]})[_0x53ec('0x36')](function(_0x4f591e){_0x6c005b['count']=_0x4f591e;if(_0x206f60[_0x53ec('0x44')][_0x53ec('0x50')]){_0x3660aa[_0x53ec('0x51')]=[{'all':!![]}];}return db[_0x53ec('0x64')][_0x53ec('0x52')](_0x3660aa);})[_0x53ec('0x36')](function(_0x14c303){_0x6c005b['rows']=_0x14c303;return _0x6c005b;});}})['then'](respondWithFilteredResult(_0x2ba288,_0x3660aa))[_0x53ec('0x27')](handleError(_0x2ba288,null));};exports[_0x53ec('0x6b')]=function(_0x2e944a,_0x5e384e,_0x3a3835){return db[_0x53ec('0x3f')][_0x53ec('0x60')]({'where':{'id':_0x2e944a[_0x53ec('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e384e,null))[_0x53ec('0x36')](function(_0x388008){if(_0x388008){return _0x388008['removeDispositions'](_0x2e944a[_0x53ec('0x44')][_0x53ec('0x6c')]);}})[_0x53ec('0x36')](respondWithStatusCode(_0x5e384e,null))[_0x53ec('0x27')](handleError(_0x5e384e,null));};exports[_0x53ec('0x6d')]=function(_0x52f8b2,_0x26c0c8,_0x2853fa){if(_0x52f8b2['body']['id']){delete _0x52f8b2[_0x53ec('0x59')]['id'];}return db[_0x53ec('0x3f')]['find']({'where':{'id':_0x52f8b2[_0x53ec('0x55')]['id']}})[_0x53ec('0x36')](handleEntityNotFound(_0x26c0c8,null))[_0x53ec('0x36')](function(_0xeb0ce8){if(_0xeb0ce8){_0x52f8b2[_0x53ec('0x59')][_0x53ec('0x63')]=_0xeb0ce8['id'];return db[_0x53ec('0x6e')][_0x53ec('0x58')](_0x52f8b2['body']);}})[_0x53ec('0x36')](respondWithResult(_0x26c0c8,null))['catch'](handleError(_0x26c0c8,null));};exports[_0x53ec('0x6f')]=function(_0x6de380,_0x545252,_0x409942){var _0x2af6ce={'raw':![],'where':{}};var _0x5e2348={};var _0x47944c={'count':0x0,'rows':[]};return db[_0x53ec('0x3f')]['findOne']({'where':{'id':_0x6de380['params']['id']}})['then'](handleEntityNotFound(_0x545252,null))[_0x53ec('0x36')](function(_0x12a910){if(_0x12a910){_0x5e2348[_0x53ec('0x42')]=_[_0x53ec('0x56')](db[_0x53ec('0x6e')][_0x53ec('0x67')]);_0x5e2348[_0x53ec('0x44')]=_['keys'](_0x6de380[_0x53ec('0x44')]);_0x5e2348['filters']=_[_0x53ec('0x46')](_0x5e2348[_0x53ec('0x42')],_0x5e2348[_0x53ec('0x44')]);_0x2af6ce['attributes']=_['intersection'](_0x5e2348['model'],qs['fields'](_0x6de380[_0x53ec('0x44')][_0x53ec('0x48')]));_0x2af6ce[_0x53ec('0x47')]=_0x2af6ce[_0x53ec('0x47')]['length']?_0x2af6ce[_0x53ec('0x47')]:_0x5e2348['model'];if(!_0x6de380[_0x53ec('0x44')][_0x53ec('0x49')]('nolimit')){_0x2af6ce[_0x53ec('0x2e')]=qs[_0x53ec('0x2e')](_0x6de380[_0x53ec('0x44')][_0x53ec('0x2e')]);_0x2af6ce[_0x53ec('0x2b')]=qs[_0x53ec('0x2b')](_0x6de380['query']['offset']);}_0x2af6ce[_0x53ec('0x4b')]=qs[_0x53ec('0x69')](_0x6de380[_0x53ec('0x44')][_0x53ec('0x69')]);_0x2af6ce[_0x53ec('0x4e')]=qs[_0x53ec('0x45')](_[_0x53ec('0x4c')](_0x6de380['query'],_0x5e2348[_0x53ec('0x45')]));_0x2af6ce[_0x53ec('0x4e')][_0x53ec('0x63')]=_0x12a910['id'];if(_0x6de380[_0x53ec('0x44')][_0x53ec('0x4d')]){_0x2af6ce['where']=_['merge'](_0x2af6ce[_0x53ec('0x4e')],{'$or':_[_0x53ec('0x3e')](_0x2af6ce['attributes'],function(_0x44b02e){var _0x377460={};_0x377460[_0x44b02e]={'$like':'%'+_0x6de380[_0x53ec('0x44')][_0x53ec('0x4d')]+'%'};return _0x377460;})});}_0x2af6ce=_['merge']({},_0x2af6ce,_0x6de380[_0x53ec('0x57')]);return db[_0x53ec('0x6e')][_0x53ec('0x2d')]({'where':_0x2af6ce['where']})[_0x53ec('0x36')](function(_0x40e1c0){_0x47944c['count']=_0x40e1c0;if(_0x6de380[_0x53ec('0x44')][_0x53ec('0x50')]){_0x2af6ce['include']=[{'all':!![]}];}return db[_0x53ec('0x6e')]['findAll'](_0x2af6ce);})[_0x53ec('0x36')](function(_0x1dce22){_0x47944c[_0x53ec('0x53')]=_0x1dce22;return _0x47944c;});}})['then'](respondWithFilteredResult(_0x545252,_0x2af6ce))['catch'](handleError(_0x545252,null));};exports[_0x53ec('0x70')]=function(_0x5aec6e,_0x333f7d,_0x4d5296){return db[_0x53ec('0x3f')][_0x53ec('0x60')]({'where':{'id':_0x5aec6e[_0x53ec('0x55')]['id']}})[_0x53ec('0x36')](handleEntityNotFound(_0x333f7d,null))[_0x53ec('0x36')](function(_0x283f59){if(_0x283f59){return _0x283f59[_0x53ec('0x70')](_0x5aec6e['query'][_0x53ec('0x6c')]);}})[_0x53ec('0x36')](respondWithStatusCode(_0x333f7d,null))[_0x53ec('0x27')](handleError(_0x333f7d,null));};exports[_0x53ec('0x71')]=function(_0x548314,_0xfcbf10,_0x4e14fd){var _0x566a9d={'channel':_0x53ec('0x72')};var _0x3453f5=[];var _0x51e8e5=[];var _0x237e24={};return db[_0x53ec('0x3f')][_0x53ec('0x60')]({'where':{'id':_0x548314['params']['id']},'include':[{'model':db[_0x53ec('0x73')],'as':_0x53ec('0x74')}]})[_0x53ec('0x36')](handleEntityNotFound(_0xfcbf10,null))['then'](function(_0x57b1cc){_0x566a9d[_0x53ec('0x75')]=_0x57b1cc;_0x566a9d[_0x53ec('0x76')]=_[_0x53ec('0x77')](_0x57b1cc[_0x53ec('0x74')],['priority'],[_0x53ec('0x78')]);if(_0x566a9d[_0x53ec('0x75')][_0x53ec('0x74')]){delete _0x566a9d[_0x53ec('0x75')]['Applications'];}return db[_0x53ec('0x79')][_0x53ec('0x61')]();})[_0x53ec('0x36')](function(_0x507547){if(!_0x507547){throw new db[(_0x53ec('0x7a'))]['ValidationError'](_0x53ec('0x7b'));}_0x3453f5=_[_0x53ec('0x7c')](_[_0x53ec('0x56')](_0x507547),['createdAt',_0x53ec('0x7d')]);_0x51e8e5=_['difference'](_[_0x53ec('0x56')](_0x507547),[_0x53ec('0x7e'),_0x53ec('0x7d'),_0x53ec('0x7f'),_0x53ec('0x80')]);_0x566a9d['body']={'mapKey':_0x53ec('0x81')};if(_0x566a9d[_0x53ec('0x75')][_0x53ec('0x4f')]){switch(_0x566a9d['account']['type']){case _0x53ec('0x82'):_0x566a9d['body']['from']=_0x548314['body'][_0x53ec('0x83')];_0x566a9d['body']['body']=_0x548314['body']['Body'];_0x566a9d['body'][_0x53ec('0x84')]=_0x548314[_0x53ec('0x59')][_0x53ec('0x85')];break;case _0x53ec('0x86'):_0x566a9d[_0x53ec('0x59')][_0x53ec('0x87')]='+'+_0x548314['body'][_0x53ec('0x88')];_0x566a9d[_0x53ec('0x59')][_0x53ec('0x59')]=_0x548314['body'][_0x53ec('0x89')];break;case'connectel':_0x566a9d['body']['from']=_0x548314[_0x53ec('0x59')][_0x53ec('0x87')];_0x566a9d['body']['body']=_0x548314[_0x53ec('0x59')][_0x53ec('0x25')];break;case _0x53ec('0x8a'):_0x566a9d[_0x53ec('0x59')][_0x53ec('0x87')]=_0x548314[_0x53ec('0x59')]['from'];_0x566a9d[_0x53ec('0x59')][_0x53ec('0x59')]=_0x548314['body'][_0x53ec('0x59')];_0x566a9d[_0x53ec('0x59')][_0x53ec('0x84')]=_0x548314[_0x53ec('0x59')]['message_id'];break;case'plivo':_0x566a9d[_0x53ec('0x59')][_0x53ec('0x87')]=_0x548314[_0x53ec('0x59')][_0x53ec('0x83')];_0x566a9d[_0x53ec('0x59')]['body']=_0x548314[_0x53ec('0x59')][_0x53ec('0x8b')];_0x566a9d[_0x53ec('0x59')][_0x53ec('0x84')]=_0x548314[_0x53ec('0x59')]['MessageUUID'];break;case'infobip':_0x566a9d[_0x53ec('0x59')][_0x53ec('0x87')]='+'+_0x548314[_0x53ec('0x59')][_0x53ec('0x8c')][0x0][_0x53ec('0x87')];_0x566a9d[_0x53ec('0x59')][_0x53ec('0x59')]=_0x548314[_0x53ec('0x59')]['results'][0x0]['text'];_0x566a9d['body'][_0x53ec('0x84')]=_0x548314[_0x53ec('0x59')][_0x53ec('0x8c')][0x0]['messageId'];break;case _0x53ec('0x8d'):_0x566a9d[_0x53ec('0x59')][_0x53ec('0x87')]=_0x548314['body'][_0x53ec('0x8e')];_0x566a9d[_0x53ec('0x59')]['body']=_0x548314[_0x53ec('0x59')]['segmentedMessage'][_0x53ec('0x25')];break;case _0x53ec('0x8f'):_0x566a9d[_0x53ec('0x59')]['from']=_0x548314[_0x53ec('0x59')]['fromNumber'];_0x566a9d[_0x53ec('0x59')]['body']=_0x548314[_0x53ec('0x59')][_0x53ec('0x89')];_0x566a9d[_0x53ec('0x59')][_0x53ec('0x84')]=_0x548314[_0x53ec('0x59')][_0x53ec('0x90')];break;case _0x53ec('0x91'):_0x566a9d[_0x53ec('0x59')][_0x53ec('0x84')]=_0x548314[_0x53ec('0x59')][0x0][_0x53ec('0x25')]['id'];_0x566a9d['body'][_0x53ec('0x87')]=_0x548314['body'][0x0]['message'][_0x53ec('0x87')];_0x566a9d[_0x53ec('0x59')][_0x53ec('0x59')]=_0x548314['body'][0x0]['message'][_0x53ec('0x89')];break;case'intelepeer':_0x566a9d[_0x53ec('0x59')][_0x53ec('0x87')]=_0x548314[_0x53ec('0x59')][_0x53ec('0x87')];_0x566a9d['body'][_0x53ec('0x59')]=_0x548314[_0x53ec('0x59')][_0x53ec('0x25')];_0x566a9d['body'][_0x53ec('0x84')]=_0x548314['body']['refid'];break;}}if(_0x566a9d['body']['id']){delete _0x566a9d[_0x53ec('0x59')]['id'];}if(_[_0x53ec('0x92')](_0x566a9d[_0x53ec('0x59')][_0x53ec('0x87')])){throw new db[(_0x53ec('0x7a'))][(_0x53ec('0x93'))](_0x53ec('0x94'));}if(_[_0x53ec('0x92')](_0x566a9d['body'][_0x53ec('0x59')])||_0x566a9d[_0x53ec('0x59')][_0x53ec('0x59')]===''){throw new db[(_0x53ec('0x7a'))][(_0x53ec('0x93'))](_0x53ec('0x95'));}if(_['isNil'](_0x566a9d[_0x53ec('0x59')]['mapKey'])){throw new db[(_0x53ec('0x7a'))][(_0x53ec('0x93'))](_0x53ec('0x96')+_0x51e8e5);}if(!_['includes'](_0x51e8e5,_0x566a9d[_0x53ec('0x59')][_0x53ec('0x97')])){throw new db['Sequelize'][(_0x53ec('0x93'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x51e8e5);}_0x237e24[_0x566a9d['body'][_0x53ec('0x97')]]=_0x566a9d[_0x53ec('0x59')][_0x53ec('0x87')];return db['CmList'][_0x53ec('0x60')]({'where':{'id':_0x566a9d[_0x53ec('0x75')]['ListId']},'include':[{'model':db[_0x53ec('0x79')],'as':_0x53ec('0x98'),'where':_0x237e24,'limit':0x1,'order':[['updatedAt',_0x53ec('0x99')]]}]});})[_0x53ec('0x36')](handleEntityNotFound(_0xfcbf10,null))['then'](function(_0x2f6622){if(_0x2f6622){_0x566a9d[_0x53ec('0x9a')]=_[_0x53ec('0x9b')](_0x2f6622,['Contacts']);if(_0x2f6622[_0x53ec('0x98')]['length']){return _0x2f6622[_0x53ec('0x98')][0x0];}var _0x60e5df=_['defaults'](_0x566a9d[_0x53ec('0x59')],{'firstName':_0x566a9d[_0x53ec('0x59')][_0x53ec('0x87')],'ListId':_0x2f6622['id']});_0x60e5df[_0x566a9d[_0x53ec('0x59')][_0x53ec('0x97')]]=_0x566a9d[_0x53ec('0x59')]['from'];return db[_0x53ec('0x79')]['create'](_0x60e5df,{'fields':_0x3453f5,'raw':!![]});}})[_0x53ec('0x36')](handleEntityNotFound(_0xfcbf10,null))[_0x53ec('0x36')](function(_0x46c47a){if(_0x46c47a){_0x566a9d[_0x53ec('0x9c')]=_0x46c47a;var _0x5309e9={'ContactId':_0x46c47a['id'],'phone':_0x566a9d[_0x53ec('0x59')][_0x53ec('0x87')],'SmsAccountId':_0x548314['params']['id']};var _0x15b470={'ContactId':_0x46c47a['id'],'SmsAccountId':_0x548314[_0x53ec('0x55')]['id'],'closed':![]};return db[_0x53ec('0x9d')][_0x53ec('0x60')]({'where':_0x15b470})[_0x53ec('0x36')](function(_0x5769ec){if(_0x5769ec){return[_0x5769ec,![]];}return db['SmsInteraction'][_0x53ec('0x58')](_0x5309e9)[_0x53ec('0x36')](function(_0x5110fb){return[_0x5110fb,!![]];});});}})[_0x53ec('0x9e')](function(_0x348655,_0x54f091){_0x566a9d[_0x53ec('0x9f')]=_0x348655[_0x53ec('0x37')]({'plain':!![]});_0x566a9d[_0x53ec('0x9f')]['created']=![];if(_0x54f091){if(_0x566a9d[_0x53ec('0x75')]['autoclose']){_0x566a9d[_0x53ec('0x76')][_0x53ec('0xa0')]({'id':0x0,'priority':_0x566a9d[_0x53ec('0x76')]['length']+0x1,'app':_0x53ec('0xa1'),'appdata':_0x53ec('0xa2'),'interval':'*,*,*,*'});}_0x566a9d[_0x53ec('0x9f')][_0x53ec('0xa3')]=!![];}return db[_0x53ec('0xa4')][_0x53ec('0x58')]({'phone':_0x566a9d['body'][_0x53ec('0x87')],'messageId':_0x566a9d[_0x53ec('0x59')][_0x53ec('0x84')],'body':_0x566a9d[_0x53ec('0x59')][_0x53ec('0x59')],'SmsAccountId':_0x548314[_0x53ec('0x55')]['id'],'SmsInteractionId':_0x348655['id'],'direction':'in','ContactId':_0x348655[_0x53ec('0xa5')],'AttachmentId':_0x566a9d[_0x53ec('0x59')][_0x53ec('0xa6')]});})[_0x53ec('0x36')](function(_0x1aa3f0){_0x566a9d['message']=_0x1aa3f0;if(_0x566a9d[_0x53ec('0x9f')][_0x53ec('0xa7')]){return db[_0x53ec('0xa8')][_0x53ec('0x60')]({'attributes':['id',_0x53ec('0x43')],'where':{'id':_0x566a9d[_0x53ec('0x9f')][_0x53ec('0xa7')]}})[_0x53ec('0x36')](function(_0x2325bf){if(_0x2325bf){_0x566a9d['applications'][_0x53ec('0xa9')]({'id':0x0,'priority':0x0,'app':_0x53ec('0xaa'),'appdata':_0x2325bf[_0x53ec('0x43')]+','+(_0x566a9d['account']['waitForTheAssignedAgent']||0xa),'interval':_0x53ec('0xab')});}return respondWithRpcPromise('Start','startRouting',_0x566a9d);});}return respondWithRpcPromise(_0x53ec('0xac'),'startRouting',_0x566a9d);})[_0x53ec('0x36')](function(_0x596cb9){if(_0x596cb9){var _0x1d5152=0xc8;var _0x4b2005=_0x53ec('0xad');logger['info'](_0x53ec('0x21'),_0x4b2005,_0x1d5152,_0x53ec('0xae'));logger[_0x53ec('0x20')](_0x53ec('0xaf'),_0x4b2005,_0x1d5152,'entity\x20found',JSON[_0x53ec('0x22')](_0x596cb9));if(_0x566a9d['account']['type']===_0x53ec('0x82')){return _0xfcbf10[_0x53ec('0x29')](_0x1d5152)[_0x53ec('0x2f')](_0x53ec('0xb0'),'text/xml')[_0x53ec('0xb1')](_0x53ec('0xb2'));}else{return _0xfcbf10[_0x53ec('0x29')](_0x1d5152)[_0x53ec('0x31')](_0x596cb9);}}})[_0x53ec('0x27')](handleError(_0xfcbf10,null));};exports[_0x53ec('0xb3')]=function(_0x2b6756,_0x1fc91b){var _0x3ad15d=_0x2b6756[_0x53ec('0x55')]['id'];var _0x1311d6=_0x2b6756[_0x53ec('0x59')];var _0x1cc11d=0xc8;var _0x1c8acf=null;return db['sequelize'][_0x53ec('0xb4')]({'isolationLevel':db[_0x53ec('0xb5')][_0x53ec('0xb6')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0xd4f97){return db[_0x53ec('0x3f')][_0x53ec('0x66')]({'where':{'id':_0x3ad15d},'transaction':_0xd4f97})['then'](function(_0x49e06e){if(_0x49e06e){return db[_0x53ec('0x73')][_0x53ec('0x3a')]({'where':{'SmsAccountId':_0x3ad15d},'transaction':_0xd4f97})['then'](function(){var _0x267eb8=_[_0x53ec('0x3e')](_0x1311d6,function(_0x23e0db){_0x23e0db[_0x53ec('0x63')]=_0x3ad15d;return _0x23e0db;});return db['SmsApplication'][_0x53ec('0xb7')](_0x267eb8,{'transaction':_0xd4f97});});}else{_0x1cc11d=0x194;_0x1c8acf=[];}});})['then'](function(){if(_0x1cc11d!==0x194){return db[_0x53ec('0x73')]['findAndCountAll']({'where':{'SmsAccountId':_0x3ad15d},'order':_0x53ec('0xb8')})[_0x53ec('0x36')](function(_0x574356){_0x1c8acf=_0x574356;});}})[_0x53ec('0x27')](function(_0x52d1c4){_0x1cc11d=0x1f4;logger[_0x53ec('0x24')](_0x52d1c4[_0x53ec('0x3b')]);if(_0x52d1c4[_0x53ec('0x43')]){delete _0x52d1c4[_0x53ec('0x43')];}_0x1c8acf=_0x52d1c4;})[_0x53ec('0xb9')](function(){if(_0x1c8acf===null){_0x1fc91b[_0x53ec('0x28')](_0x1cc11d);}else{if(_0x1cc11d===0x1f4){_0x1fc91b['status'](_0x1cc11d)['send'](_0x1c8acf);}else{_0x1fc91b[_0x53ec('0x29')](_0x1cc11d)[_0x53ec('0x31')](_0x1c8acf);}}});};exports[_0x53ec('0xba')]=function(_0x1fb2ec,_0x5029d6,_0x447b90){var _0x45e433={};var _0x3c468f={};var _0x18494c;var _0xe139ff;return db['SmsAccount'][_0x53ec('0x66')]({'where':{'id':_0x1fb2ec['params']['id']}})[_0x53ec('0x36')](handleEntityNotFound(_0x5029d6,null))['then'](function(_0x1502de){if(_0x1502de){_0x18494c=_0x1502de;_0x3c468f[_0x53ec('0x42')]=_[_0x53ec('0x56')](db['SmsApplication']['rawAttributes']);_0x3c468f['query']=_[_0x53ec('0x56')](_0x1fb2ec[_0x53ec('0x44')]);_0x3c468f[_0x53ec('0x45')]=_[_0x53ec('0x46')](_0x3c468f['model'],_0x3c468f[_0x53ec('0x44')]);_0x45e433[_0x53ec('0x47')]=_[_0x53ec('0x46')](_0x3c468f[_0x53ec('0x42')],qs['fields'](_0x1fb2ec[_0x53ec('0x44')][_0x53ec('0x48')]));_0x45e433[_0x53ec('0x47')]=_0x45e433[_0x53ec('0x47')][_0x53ec('0x68')]?_0x45e433[_0x53ec('0x47')]:_0x3c468f[_0x53ec('0x42')];_0x45e433[_0x53ec('0x4b')]=qs[_0x53ec('0x69')](_0x1fb2ec[_0x53ec('0x44')]['sort']);_0x45e433['where']=qs['filters'](_[_0x53ec('0x4c')](_0x1fb2ec[_0x53ec('0x44')],_0x3c468f[_0x53ec('0x45')]));if(_0x1fb2ec[_0x53ec('0x44')][_0x53ec('0x4d')]){_0x45e433[_0x53ec('0x4e')]=_[_0x53ec('0x6a')](_0x45e433[_0x53ec('0x4e')],{'$or':_['map'](_0x45e433[_0x53ec('0x47')],function(_0x1c154a){var _0x4219ef={};_0x4219ef[_0x1c154a]={'$like':'%'+_0x1fb2ec[_0x53ec('0x44')]['filter']+'%'};return _0x4219ef;})});}_0x45e433=_[_0x53ec('0x6a')]({},_0x45e433,_0x1fb2ec[_0x53ec('0x57')]);return _0x18494c[_0x53ec('0xba')](_0x45e433);}})[_0x53ec('0x36')](function(_0x10acb5){if(_0x10acb5){_0xe139ff=_0x10acb5[_0x53ec('0x68')];if(!_0x1fb2ec[_0x53ec('0x44')][_0x53ec('0x49')](_0x53ec('0x4a'))){_0x45e433[_0x53ec('0x2e')]=qs[_0x53ec('0x2e')](_0x1fb2ec[_0x53ec('0x44')][_0x53ec('0x2e')]);_0x45e433['offset']=qs[_0x53ec('0x2b')](_0x1fb2ec['query'][_0x53ec('0x2b')]);}return _0x18494c['getApplications'](_0x45e433);}})[_0x53ec('0x36')](function(_0x468f5b){if(_0x468f5b){return _0x468f5b?{'count':_0xe139ff,'rows':_0x468f5b}:null;}})[_0x53ec('0x36')](respondWithResult(_0x5029d6,null))[_0x53ec('0x27')](handleError(_0x5029d6,null));};exports[_0x53ec('0xbb')]=function(_0x37a116,_0x49049a,_0x1a4f01){var _0x2cc4a2={'raw':![],'where':{}};var _0x4f49b9={};var _0x52cb50={'count':0x0,'rows':[]};return db[_0x53ec('0x3f')][_0x53ec('0x66')]({'where':{'id':_0x37a116[_0x53ec('0x55')]['id']}})[_0x53ec('0x36')](handleEntityNotFound(_0x49049a,null))['then'](function(_0x1c5bd8){if(_0x1c5bd8){_0x4f49b9[_0x53ec('0x42')]=_[_0x53ec('0x56')](db['SmsInteraction'][_0x53ec('0x67')]);_0x4f49b9['query']=_[_0x53ec('0x56')](_0x37a116['query']);_0x4f49b9['filters']=_[_0x53ec('0x46')](_0x4f49b9[_0x53ec('0x42')],_0x4f49b9[_0x53ec('0x44')]);_0x2cc4a2[_0x53ec('0x47')]=_[_0x53ec('0x46')](_0x4f49b9[_0x53ec('0x42')],qs[_0x53ec('0x48')](_0x37a116['query']['fields']));_0x2cc4a2['attributes']=_0x2cc4a2[_0x53ec('0x47')][_0x53ec('0x68')]?_0x2cc4a2['attributes']:_0x4f49b9['model'];if(!_0x37a116[_0x53ec('0x44')]['hasOwnProperty'](_0x53ec('0x4a'))){_0x2cc4a2[_0x53ec('0x2e')]=qs['limit'](_0x37a116[_0x53ec('0x44')][_0x53ec('0x2e')]);_0x2cc4a2[_0x53ec('0x2b')]=qs[_0x53ec('0x2b')](_0x37a116[_0x53ec('0x44')]['offset']);}_0x2cc4a2['order']=qs['sort'](_0x37a116[_0x53ec('0x44')][_0x53ec('0x69')]);_0x2cc4a2[_0x53ec('0x4e')]=qs[_0x53ec('0x45')](_[_0x53ec('0x4c')](_0x37a116[_0x53ec('0x44')],_0x4f49b9[_0x53ec('0x45')]));_0x2cc4a2['where'][_0x53ec('0x63')]=_0x1c5bd8['id'];if(_0x37a116[_0x53ec('0x44')]['filter']){_0x2cc4a2[_0x53ec('0x4e')]=_['merge'](_0x2cc4a2[_0x53ec('0x4e')],{'$or':_[_0x53ec('0x3e')](_0x2cc4a2[_0x53ec('0x47')],function(_0x3e6118){var _0x52c0b8={};_0x52c0b8[_0x3e6118]={'$like':'%'+_0x37a116[_0x53ec('0x44')]['filter']+'%'};return _0x52c0b8;})});}_0x2cc4a2=_['merge']({},_0x2cc4a2,_0x37a116[_0x53ec('0x57')]);return db[_0x53ec('0x9d')][_0x53ec('0x2d')]({'where':_0x2cc4a2[_0x53ec('0x4e')]})[_0x53ec('0x36')](function(_0x15b574){_0x52cb50['count']=_0x15b574;if(_0x37a116[_0x53ec('0x44')][_0x53ec('0x50')]){_0x2cc4a2[_0x53ec('0x51')]=[{'model':db[_0x53ec('0x79')],'as':'Contact','required':![]},{'model':db[_0x53ec('0xa8')],'as':'Owner','attributes':['name',_0x53ec('0xbc'),_0x53ec('0xbd')],'required':![]},{'model':db[_0x53ec('0xbe')],'as':_0x53ec('0xbf'),'attributes':['id','name',_0x53ec('0xc0')],'where':_0x37a116[_0x53ec('0x44')][_0x53ec('0xc1')]?{'id':_0x37a116[_0x53ec('0x44')][_0x53ec('0xc1')]}:undefined,'required':_0x37a116[_0x53ec('0x44')][_0x53ec('0xc1')]?!![]:![]}];}return db[_0x53ec('0x9d')][_0x53ec('0x52')](_0x2cc4a2);})[_0x53ec('0x36')](function(_0x312a33){_0x52cb50['rows']=_0x312a33;return _0x52cb50;});}})[_0x53ec('0x36')](respondWithFilteredResult(_0x49049a,_0x2cc4a2))[_0x53ec('0x27')](handleError(_0x49049a,null));};exports['send']=function(_0x4d3204,_0x2e3322,_0x21aef2){var _0x33296b,_0x472751,_0x4cc884;if(_[_0x53ec('0x92')](_0x4d3204[_0x53ec('0x59')]['body'])||_0x4d3204[_0x53ec('0x59')]['body']===''){throw new db[(_0x53ec('0x7a'))][(_0x53ec('0x93'))](_0x53ec('0x95'));}if(_['isNil'](_0x4d3204[_0x53ec('0x59')]['to'])){throw new db['Sequelize'][(_0x53ec('0x93'))]('to\x20is\x20mandatory');}_0x33296b=_0x4d3204[_0x53ec('0x59')]['to'];return db[_0x53ec('0x3f')][_0x53ec('0x60')]({'where':{'id':_0x4d3204['params']['id']},'include':[{'model':db[_0x53ec('0xc2')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x33296b},'limit':0x1,'order':[[_0x53ec('0x7d'),_0x53ec('0x99')]]}]}]})[_0x53ec('0x36')](handleEntityNotFound(_0x2e3322,null))[_0x53ec('0x36')](function(_0x3e550f){if(_0x3e550f&&_0x3e550f['List']){_0x472751=_0x3e550f[_0x53ec('0x37')]({'plain':!![]});if(_0x472751[_0x53ec('0xc3')]&&_0x472751['List'][_0x53ec('0x98')][_0x53ec('0x68')]){return _0x472751[_0x53ec('0xc3')][_0x53ec('0x98')][0x0];}return db[_0x53ec('0x79')][_0x53ec('0x58')](_[_0x53ec('0x19')](_0x4d3204[_0x53ec('0x59')],{'firstName':_0x33296b,'mobile':_0x33296b,'phone':_0x33296b,'ListId':_0x472751['ListId']}));}})[_0x53ec('0x36')](handleEntityNotFound(_0x2e3322,null))[_0x53ec('0x36')](function(_0x4b67f5){if(_0x4b67f5){_0x4cc884=_0x4b67f5;return db['SmsInteraction'][_0x53ec('0x60')]({'where':{'ContactId':_0x4cc884['id'],'closed':![],'SmsAccountId':_0x472751['id']}})[_0x53ec('0x36')](function(_0x5106fb){if(_0x5106fb){return[_0x5106fb,![]];}return db[_0x53ec('0x9d')][_0x53ec('0x58')]({'UserId':_0x4d3204[_0x53ec('0xc4')]['id'],'ContactId':_0x4cc884['id'],'SmsAccountId':_0x472751['id'],'phone':_0x33296b,'firstMsgDirection':'out','Messages':[_['merge'](_0x4d3204['body'],{'read':![],'body':_0x4d3204[_0x53ec('0x59')][_0x53ec('0x59')],'phone':_0x33296b,'SmsAccountId':_0x472751['id'],'UserId':_0x4d3204['user']['id'],'ContactId':_0x4cc884['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x53ec('0x36')](function(_0x2c1d07){return[_0x2c1d07,!![]];});});}})['spread'](function(_0x1352a8,_0x585dac){if(_0x585dac){return _0x1352a8;}return db[_0x53ec('0xa4')][_0x53ec('0x58')](_[_0x53ec('0x6a')](_0x4d3204[_0x53ec('0x59')],{'read':![],'body':_0x4d3204[_0x53ec('0x59')][_0x53ec('0x59')],'phone':_0x33296b,'SmsAccountId':_0x472751['id'],'SmsInteractionId':_0x1352a8['id'],'UserId':_0x4d3204[_0x53ec('0xc4')]['id'],'ContactId':_0x4cc884['id']}))[_0x53ec('0x36')](function(_0x2a7cbe){_0x1352a8[_0x53ec('0xc5')][_0x53ec('0xc6')]=[];_0x1352a8[_0x53ec('0xc5')][_0x53ec('0xc6')][_0x53ec('0xa0')](_0x2a7cbe['dataValues']);return _0x1352a8;});})[_0x53ec('0x36')](respondWithResult(_0x2e3322,null))[_0x53ec('0x27')](handleError(_0x2e3322,null));};exports[_0x53ec('0x29')]=function(_0x12ed40,_0x398ec1,_0x44c280){if(_0x12ed40[_0x53ec('0x59')]['id']){delete _0x12ed40[_0x53ec('0x59')]['id'];}var _0x2fa6d6,_0x2e0ad0,_0x5f1c09;return db[_0x53ec('0x3f')][_0x53ec('0x60')]({'where':{'id':_0x12ed40[_0x53ec('0x55')]['id']}})['then'](handleEntityNotFound(_0x398ec1,null))['then'](function(_0x536550){if(_0x536550){_0x5f1c09=_0x536550;logger[_0x53ec('0x20')](_0x53ec('0x21'),_0x53ec('0x29'),_0x53ec('0xc7'),_0x536550[_0x53ec('0x4f')],util[_0x53ec('0xc8')](_0x12ed40[_0x53ec('0x59')],{'showHidden':![],'depth':null}));switch(_0x536550[_0x53ec('0x4f')]){case'skebby':if(_0x12ed40[_0x53ec('0x59')][_0x53ec('0xc9')]&&_0x12ed40['body'][_0x53ec('0x29')]){_0x2e0ad0=_0x12ed40[_0x53ec('0x59')][_0x53ec('0x29')];return db[_0x53ec('0xa4')][_0x53ec('0x60')]({'where':{'messageId':_0x12ed40['body'][_0x53ec('0xc9')]}});}break;case _0x53ec('0xca'):if(_0x12ed40[_0x53ec('0x59')][_0x53ec('0xcb')]&&_0x12ed40[_0x53ec('0x59')][_0x53ec('0xcc')]){_0x2e0ad0=_0x12ed40['body'][_0x53ec('0xcc')];return db[_0x53ec('0xa4')]['find']({'where':{'messageId':_0x12ed40[_0x53ec('0x59')][_0x53ec('0xcb')]}});}break;case _0x53ec('0x8a'):if(_0x12ed40[_0x53ec('0x59')][_0x53ec('0xcd')]&&_0x12ed40[_0x53ec('0x59')][_0x53ec('0xce')]){_0x2e0ad0=_0x12ed40['body'][_0x53ec('0xce')];return db[_0x53ec('0xa4')][_0x53ec('0x60')]({'where':{'messageId':_0x12ed40[_0x53ec('0x59')][_0x53ec('0xcd')]}});}break;case _0x53ec('0xcf'):var _0x55d984=_0x12ed40[_0x53ec('0x59')][_0x53ec('0x8c')][0x0];if(_0x55d984[_0x53ec('0x84')]&&_0x55d984[_0x53ec('0x29')]['groupName']===_0x53ec('0xd0')){_0x2e0ad0=_0x55d984[_0x53ec('0x29')][_0x53ec('0xd1')];return db['SmsMessage']['find']({'where':{'messageId':_0x55d984['messageId']}});}break;case'clickatell':if(_0x12ed40[_0x53ec('0x59')][_0x53ec('0x84')]&&_0x12ed40[_0x53ec('0x59')][_0x53ec('0x29')]){_0x2e0ad0=_0x12ed40['body'][_0x53ec('0x29')];return db[_0x53ec('0xa4')]['find']({'where':{'messageId':_0x12ed40['body']['messageId']}});}break;case _0x53ec('0x91'):if(_0x12ed40[_0x53ec('0x59')][0x0][_0x53ec('0x25')]['id']){_0x2e0ad0=_0x12ed40[_0x53ec('0x59')][0x0][_0x53ec('0x4f')];return db[_0x53ec('0xa4')][_0x53ec('0x60')]({'where':{'messageId':_0x12ed40[_0x53ec('0x59')][0x0][_0x53ec('0x25')]['id']}});}break;case _0x53ec('0xd2'):if(_0x12ed40[_0x53ec('0x59')][_0x53ec('0xd3')]&&_0x12ed40[_0x53ec('0x59')][_0x53ec('0x29')]){_0x2e0ad0=_0x12ed40[_0x53ec('0x59')][_0x53ec('0x29')];return db['SmsMessage']['find']({'where':{'messageId':_0x12ed40[_0x53ec('0x59')][_0x53ec('0xd3')]}});}break;}}})['then'](handleEntityNotFound(_0x398ec1,null))[_0x53ec('0x36')](function(_0x59aa28){if(_0x59aa28){_0x2fa6d6=_0x59aa28;switch(_0x5f1c09['type']){case _0x53ec('0x86'):if(_0x2e0ad0===_0x53ec('0xd0')){return _0x2fa6d6['update']({'read':!![]});}else{logger[_0x53ec('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53ec('0x29'),'skebby',util[_0x53ec('0xc8')](_0x12ed40[_0x53ec('0x59')],{'showHidden':![],'depth':null}));}break;case _0x53ec('0xca'):if(_0x2e0ad0==='1'){return _0x2fa6d6[_0x53ec('0x35')]({'read':!![]});}else{logger[_0x53ec('0x24')](_0x53ec('0x21'),_0x53ec('0x29'),_0x53ec('0x86'),util[_0x53ec('0xc8')](_0x12ed40[_0x53ec('0x59')],{'showHidden':![],'depth':null}));}break;case _0x53ec('0x8a'):if(!_0x12ed40[_0x53ec('0x59')][_0x53ec('0xd4')]&&_0x2e0ad0>=0xc8&&_0x2e0ad0<=0xce){return _0x2fa6d6[_0x53ec('0x35')]({'read':!![]});}else{logger[_0x53ec('0x24')](_0x53ec('0x21'),'status',_0x53ec('0x8a'),util[_0x53ec('0xc8')](_0x12ed40[_0x53ec('0x59')],{'showHidden':![],'depth':null}));}break;case _0x53ec('0xcf'):var _0x4f4f77=_0x12ed40[_0x53ec('0x59')][_0x53ec('0x8c')][0x0];if(_0x4f4f77[_0x53ec('0x29')]['groupName']===_0x53ec('0xd0')){return _0x2fa6d6[_0x53ec('0x35')]({'read':!![]});}else{logger[_0x53ec('0x24')](_0x53ec('0x21'),'status',_0x53ec('0xcf'),util['inspect'](_0x12ed40['body'],{'showHidden':![],'depth':null}));}break;case _0x53ec('0x8f'):if(_0x2e0ad0==_0x53ec('0xd5')||_0x2e0ad0=='RECEIVED_BY_RECIPIENT'){return _0x2fa6d6[_0x53ec('0x35')]({'read':!![]});}else{logger[_0x53ec('0x24')](_0x53ec('0x21'),'status','clickatell',util[_0x53ec('0xc8')](_0x12ed40[_0x53ec('0x59')],{'showHidden':![],'depth':null}));}break;case _0x53ec('0x91'):if(_0x2e0ad0==_0x53ec('0xd6')){return _0x2fa6d6['update']({'read':!![]});}else{logger[_0x53ec('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53ec('0x29'),_0x53ec('0x91'),util['inspect'](_0x12ed40['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x2e0ad0===_0x53ec('0xd7')||_0x2e0ad0===_0x53ec('0xd8')){return _0x2fa6d6[_0x53ec('0x35')]({'read':!![]});}else{logger[_0x53ec('0x24')](_0x53ec('0x21'),_0x53ec('0x29'),'intelepeer',util[_0x53ec('0xc8')](_0x12ed40[_0x53ec('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2fa6d6;}})[_0x53ec('0x36')](respondWithResult(_0x398ec1,null))[_0x53ec('0x27')](handleError(_0x398ec1,null));};exports[_0x53ec('0xd9')]=function(_0x4f62c4,_0x573f2b,_0x303f69){var _0x31848a,_0x401c94,_0x347238;return db[_0x53ec('0x3f')]['find']({'where':{'id':_0x4f62c4['params']['id']}})[_0x53ec('0x36')](handleEntityNotFound(_0x573f2b,null))[_0x53ec('0x36')](function(_0x35baed){if(_0x35baed){_0x347238=_0x35baed;logger[_0x53ec('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53ec('0x29'),_0x53ec('0xc7'),_0x35baed[_0x53ec('0x4f')],util[_0x53ec('0xc8')](_0x4f62c4[_0x53ec('0x44')],{'showHidden':![],'depth':null}));switch(_0x35baed[_0x53ec('0x4f')]){case'csc':if(_0x4f62c4[_0x53ec('0x44')]['message-id']&&_0x4f62c4[_0x53ec('0x44')]['state']){_0x401c94=_0x4f62c4[_0x53ec('0x44')][_0x53ec('0xda')];return db[_0x53ec('0xa4')][_0x53ec('0x60')]({'where':{'messageId':_0x4f62c4['query'][_0x53ec('0xdb')]}});}break;}}})[_0x53ec('0x36')](handleEntityNotFound(_0x573f2b,null))[_0x53ec('0x36')](function(_0x2d6e9c){if(_0x2d6e9c){_0x31848a=_0x2d6e9c;switch(_0x347238[_0x53ec('0x4f')]){case'csc':if(_0x401c94==='2'||_0x401c94==='6'){return _0x31848a[_0x53ec('0x35')]({'read':!![]});}else{logger[_0x53ec('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53ec('0x29'),_0x53ec('0x8d'),util[_0x53ec('0xc8')](_0x4f62c4['query'],{'showHidden':![],'depth':null}));};break;}return _0x31848a;}})[_0x53ec('0x36')](respondWithResult(_0x573f2b,null))[_0x53ec('0x27')](handleError(_0x573f2b,null));};exports['addAgents']=function(_0x94f403,_0x36df7b,_0x5c4dd4){return db[_0x53ec('0x3f')][_0x53ec('0x60')]({'where':{'id':_0x94f403[_0x53ec('0x55')]['id']}})[_0x53ec('0x36')](handleEntityNotFound(_0x36df7b,null))['then'](function(_0x342665){if(_0x342665){return _0x342665[_0x53ec('0xdc')](_0x94f403[_0x53ec('0x59')][_0x53ec('0x6c')],_[_0x53ec('0x9b')](_0x94f403[_0x53ec('0x59')],['ids','id'])||{})[_0x53ec('0x9e')](function(_0x230fa5){for(var _0x179ae8=0x0;_0x179ae8<_0x94f403[_0x53ec('0x59')][_0x53ec('0x6c')][_0x53ec('0x68')];_0x179ae8+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x94f403['body'][_0x53ec('0x6c')][_0x179ae8]),'SmsAccountId':Number(_0x94f403[_0x53ec('0x55')]['id'])});}return _0x230fa5;});}})[_0x53ec('0x36')](respondWithResult(_0x36df7b,null))[_0x53ec('0x27')](handleError(_0x36df7b,null));};exports['removeAgents']=function(_0x4e403d,_0x5ace6a,_0x5367b7){return db[_0x53ec('0x3f')]['find']({'where':{'id':_0x4e403d[_0x53ec('0x55')]['id']}})[_0x53ec('0x36')](handleEntityNotFound(_0x5ace6a,null))[_0x53ec('0x36')](function(_0x2392f9){if(_0x2392f9){return _0x2392f9[_0x53ec('0xdd')](_0x4e403d['query']['ids'])[_0x53ec('0x36')](function(){if(_[_0x53ec('0xde')](_0x4e403d[_0x53ec('0x44')]['ids'])){for(var _0x53c823=0x0;_0x53c823<_0x4e403d[_0x53ec('0x44')][_0x53ec('0x6c')][_0x53ec('0x68')];_0x53c823+=0x1){socket['emit'](_0x53ec('0xdf'),{'UserId':Number(_0x4e403d[_0x53ec('0x44')][_0x53ec('0x6c')][_0x53c823]),'SmsAccountId':Number(_0x4e403d[_0x53ec('0x55')]['id'])});}}else{socket[_0x53ec('0xe0')](_0x53ec('0xdf'),{'UserId':Number(_0x4e403d[_0x53ec('0x44')]['ids']),'SmsAccountId':Number(_0x4e403d[_0x53ec('0x55')]['id'])});}});}})[_0x53ec('0x36')](respondWithStatusCode(_0x5ace6a,null))[_0x53ec('0x27')](handleError(_0x5ace6a,null));};exports[_0x53ec('0xe1')]=function(_0x779083,_0x3834eb,_0xc2e031){var _0x5e3572={};var _0x3d611b={};var _0x2cb5cd;var _0x21c4c3;return db['SmsAccount'][_0x53ec('0x66')]({'where':{'id':_0x779083[_0x53ec('0x55')]['id']}})[_0x53ec('0x36')](handleEntityNotFound(_0x3834eb,null))['then'](function(_0x588735){if(_0x588735){_0x2cb5cd=_0x588735;_0x3d611b['model']=_[_0x53ec('0x56')](db[_0x53ec('0xa8')][_0x53ec('0x67')]);_0x3d611b[_0x53ec('0x44')]=_[_0x53ec('0x56')](_0x779083['query']);_0x3d611b[_0x53ec('0x45')]=_[_0x53ec('0x46')](_0x3d611b[_0x53ec('0x42')],_0x3d611b[_0x53ec('0x44')]);_0x5e3572['attributes']=_['intersection'](_0x3d611b[_0x53ec('0x42')],qs[_0x53ec('0x48')](_0x779083['query'][_0x53ec('0x48')]));_0x5e3572[_0x53ec('0x47')]=_0x5e3572['attributes']['length']?_0x5e3572[_0x53ec('0x47')]:_0x3d611b[_0x53ec('0x42')];_0x5e3572['order']=qs[_0x53ec('0x69')](_0x779083[_0x53ec('0x44')][_0x53ec('0x69')]);_0x5e3572['where']=qs['filters'](_[_0x53ec('0x4c')](_0x779083[_0x53ec('0x44')],_0x3d611b[_0x53ec('0x45')]));if(_0x779083[_0x53ec('0x44')][_0x53ec('0x4d')]){_0x5e3572[_0x53ec('0x4e')]=_[_0x53ec('0x6a')](_0x5e3572[_0x53ec('0x4e')],{'$or':_[_0x53ec('0x3e')](_0x5e3572[_0x53ec('0x47')],function(_0x39c432){var _0x202d8d={};_0x202d8d[_0x39c432]={'$like':'%'+_0x779083['query'][_0x53ec('0x4d')]+'%'};return _0x202d8d;})});}_0x5e3572=_['merge']({},_0x5e3572,_0x779083[_0x53ec('0x57')]);return _0x2cb5cd[_0x53ec('0xe1')](_0x5e3572);}})[_0x53ec('0x36')](function(_0x11f0c5){if(_0x11f0c5){_0x21c4c3=_0x11f0c5['length'];if(!_0x779083[_0x53ec('0x44')][_0x53ec('0x49')](_0x53ec('0x4a'))){_0x5e3572[_0x53ec('0x2e')]=qs[_0x53ec('0x2e')](_0x779083[_0x53ec('0x44')]['limit']);_0x5e3572['offset']=qs[_0x53ec('0x2b')](_0x779083[_0x53ec('0x44')][_0x53ec('0x2b')]);}return _0x2cb5cd[_0x53ec('0xe1')](_0x5e3572);}})[_0x53ec('0x36')](function(_0x415e63){if(_0x415e63){return _0x415e63?{'count':_0x21c4c3,'rows':_0x415e63}:null;}})['then'](respondWithResult(_0x3834eb,null))['catch'](handleError(_0x3834eb,null));}; \ No newline at end of file +var _0x2978=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','update','destroy','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','show','create','user','get','UserProfileSection','find','userProfileId','autoAssociation','body','params','describe','SmsAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','CannedAnswer','hasOwnProperty','removeAnswers','sms','SmsApplication','Applications','account','applications','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','Body','text','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','infobip','results','csc','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','ContactId','AttachmentId','UserId','User','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','SmsMessage','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','bandwidth','redif','DELIVERED','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s'];(function(_0x5008d0,_0x2e826a){var _0x4f0cd6=function(_0x511c3e){while(--_0x511c3e){_0x5008d0['push'](_0x5008d0['shift']());}};_0x4f0cd6(++_0x2e826a);}(_0x2978,0x19d));var _0x8297=function(_0x1aaa52,_0x442418){_0x1aaa52=_0x1aaa52-0x0;var _0x1a3b6a=_0x2978[_0x1aaa52];return _0x1a3b6a;};'use strict';var emlformat=require(_0x8297('0x0'));var rimraf=require(_0x8297('0x1'));var zipdir=require(_0x8297('0x2'));var jsonpatch=require(_0x8297('0x3'));var rp=require(_0x8297('0x4'));var moment=require(_0x8297('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8297('0x6'));var util=require(_0x8297('0x7'));var path=require(_0x8297('0x8'));var sox=require(_0x8297('0x9'));var csv=require(_0x8297('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8297('0xb'));var squel=require('squel');var crypto=require(_0x8297('0xc'));var jsforce=require(_0x8297('0xd'));var deskjs=require(_0x8297('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8297('0xf'));var Papa=require('papaparse');var Redis=require(_0x8297('0x10'));var authService=require(_0x8297('0x11'));var qs=require(_0x8297('0x12'));var as=require(_0x8297('0x13'));var hardwareService=require(_0x8297('0x14'));var logger=require('../../config/logger')(_0x8297('0x15'));var utils=require(_0x8297('0x16'));var config=require(_0x8297('0x17'));var licenseUtil=require(_0x8297('0x18'));var db=require(_0x8297('0x19'))['db'];config[_0x8297('0x1a')]=_[_0x8297('0x1b')](config[_0x8297('0x1a')],{'host':_0x8297('0x1c'),'port':0x18eb});var socket=require(_0x8297('0x1d'))(new Redis(config['redis']));require(_0x8297('0x1e'))[_0x8297('0x1f')](socket);var jayson=require(_0x8297('0x20'));var client=jayson[_0x8297('0x21')][_0x8297('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x33354b,_0x29171b,_0x47b4d8,_0x4fd7c4){return new BPromise(function(_0x5dab4d,_0x553771){var _0x4fadbd=_0x4fd7c4||client;return _0x4fadbd[_0x8297('0x23')](_0x33354b,_0x47b4d8)[_0x8297('0x24')](function(_0x1dcb8b){logger[_0x8297('0x25')](_0x8297('0x26'),_0x29171b,'request\x20sent');logger[_0x8297('0x27')](_0x8297('0x28'),_0x29171b,'request\x20sent',JSON[_0x8297('0x29')](_0x1dcb8b));if(_0x1dcb8b[_0x8297('0x2a')]){if(_0x1dcb8b['error'][_0x8297('0x2b')]===0x1f4){logger[_0x8297('0x2a')](_0x8297('0x26'),_0x29171b,_0x1dcb8b[_0x8297('0x2a')][_0x8297('0x2c')]);return _0x553771(_0x1dcb8b[_0x8297('0x2a')][_0x8297('0x2c')]);}logger[_0x8297('0x2a')](_0x8297('0x26'),_0x29171b,_0x1dcb8b[_0x8297('0x2a')][_0x8297('0x2c')]);return _0x5dab4d(_0x1dcb8b['error'][_0x8297('0x2c')]);}else{logger[_0x8297('0x25')]('SmsAccount,\x20%s,\x20%s',_0x29171b,_0x8297('0x2d'));_0x5dab4d(_0x1dcb8b[_0x8297('0x2e')][_0x8297('0x2c')]);}})[_0x8297('0x2f')](function(_0x2e1fd8){logger[_0x8297('0x2a')](_0x8297('0x26'),_0x29171b,_0x2e1fd8);_0x553771(_0x2e1fd8);});});}function respondWithStatusCode(_0x1be4f7,_0xf86f96){_0xf86f96=_0xf86f96||0xcc;return function(_0xef7921){if(_0xef7921){return _0x1be4f7[_0x8297('0x30')](_0xf86f96);}return _0x1be4f7[_0x8297('0x31')](_0xf86f96)[_0x8297('0x32')]();};}function respondWithResult(_0x546b56,_0x5e9bb9){_0x5e9bb9=_0x5e9bb9||0xc8;return function(_0x42b015){if(_0x42b015){return _0x546b56['status'](_0x5e9bb9)['json'](_0x42b015);}};}function respondWithFilteredResult(_0x227edd,_0x4393ef){return function(_0x22d101){if(_0x22d101){var _0x41e861=typeof _0x4393ef[_0x8297('0x33')]==='undefined'&&typeof _0x4393ef[_0x8297('0x34')]==='undefined';var _0x43eea7=_0x22d101[_0x8297('0x35')];var _0x3d1b13=_0x41e861?0x0:_0x4393ef['offset'];var _0x330cfc=_0x41e861?_0x22d101['count']:_0x4393ef[_0x8297('0x33')]+_0x4393ef[_0x8297('0x34')];var _0x55593b;if(_0x330cfc>=_0x43eea7){_0x330cfc=_0x43eea7;_0x55593b=0xc8;}else{_0x55593b=0xce;}_0x227edd[_0x8297('0x31')](_0x55593b);return _0x227edd[_0x8297('0x36')](_0x8297('0x37'),_0x3d1b13+'-'+_0x330cfc+'/'+_0x43eea7)[_0x8297('0x38')](_0x22d101);}return null;};}function patchUpdates(_0x3ec50c){return function(_0x3bcc0){try{jsonpatch[_0x8297('0x39')](_0x3bcc0,_0x3ec50c,!![]);}catch(_0xa511f){return BPromise[_0x8297('0x3a')](_0xa511f);}return _0x3bcc0['save']();};}function saveUpdates(_0xf386f8,_0x389417){return function(_0x7624cf){if(_0x7624cf){return _0x7624cf[_0x8297('0x3b')](_0xf386f8)[_0x8297('0x24')](function(_0x199789){return _0x199789;});}return null;};}function removeEntity(_0x25e44e,_0x27a38a){return function(_0x111543){if(_0x111543){return _0x111543[_0x8297('0x3c')]()[_0x8297('0x24')](function(){var _0x2a2c11=_0x111543['get']({'plain':!![]});var _0x462c1b=_0x8297('0x3d');return db[_0x8297('0x3e')][_0x8297('0x3c')]({'where':{'type':_0x462c1b,'resourceId':_0x2a2c11['id']}})[_0x8297('0x24')](function(){return _0x111543;});})[_0x8297('0x24')](function(){_0x25e44e[_0x8297('0x31')](0xcc)[_0x8297('0x32')]();});}};}function handleEntityNotFound(_0x3efe4f,_0x3ebc40){return function(_0x5ed60d){if(!_0x5ed60d){_0x3efe4f[_0x8297('0x30')](0x194);}return _0x5ed60d;};}function handleError(_0x368397,_0x1e1af0){_0x1e1af0=_0x1e1af0||0x1f4;return function(_0x13fcfc){logger[_0x8297('0x2a')](_0x13fcfc[_0x8297('0x3f')]);if(_0x13fcfc[_0x8297('0x40')]){delete _0x13fcfc[_0x8297('0x40')];}_0x368397['status'](_0x1e1af0)[_0x8297('0x41')](_0x13fcfc);};}exports['index']=function(_0x149160,_0x580655){var _0xfdd06={'include':[{'model':db[_0x8297('0x42')],'as':_0x8297('0x43')}]},_0x4a742d={},_0x3f4e15={'count':0x0,'rows':[]};var _0x2a5ba9=_['map'](db['SmsAccount'][_0x8297('0x44')],function(_0x3b20d2){return{'name':_0x3b20d2['fieldName'],'type':_0x3b20d2[_0x8297('0x45')][_0x8297('0x46')]};});_0x4a742d[_0x8297('0x47')]=_[_0x8297('0x48')](_0x2a5ba9,'name');_0x4a742d[_0x8297('0x49')]=_[_0x8297('0x4a')](_0x149160[_0x8297('0x49')]);_0x4a742d['filters']=_[_0x8297('0x4b')](_0x4a742d[_0x8297('0x47')],_0x4a742d[_0x8297('0x49')]);_0xfdd06[_0x8297('0x4c')]=_[_0x8297('0x4b')](_0x4a742d[_0x8297('0x47')],qs[_0x8297('0x4d')](_0x149160['query'][_0x8297('0x4d')]));_0xfdd06[_0x8297('0x4c')]=_0xfdd06[_0x8297('0x4c')][_0x8297('0x4e')]?_0xfdd06[_0x8297('0x4c')]:_0x4a742d[_0x8297('0x47')];if(!_0x149160['query']['hasOwnProperty']('nolimit')){_0xfdd06['limit']=qs[_0x8297('0x34')](_0x149160['query'][_0x8297('0x34')]);_0xfdd06['offset']=qs[_0x8297('0x33')](_0x149160[_0x8297('0x49')][_0x8297('0x33')]);}_0xfdd06[_0x8297('0x4f')]=qs[_0x8297('0x50')](_0x149160[_0x8297('0x49')]['sort']);_0xfdd06['where']=qs[_0x8297('0x51')](_[_0x8297('0x52')](_0x149160['query'],_0x4a742d[_0x8297('0x51')]),_0x2a5ba9);if(_0x149160[_0x8297('0x49')][_0x8297('0x53')]){_0xfdd06['where']=_[_0x8297('0x54')](_0xfdd06[_0x8297('0x55')],{'$or':_[_0x8297('0x48')](_0x2a5ba9,function(_0x406605){if(_0x406605['type']!==_0x8297('0x56')){var _0x438588={};_0x438588[_0x406605[_0x8297('0x40')]]={'$like':'%'+_0x149160[_0x8297('0x49')][_0x8297('0x53')]+'%'};return _0x438588;}})});}_0xfdd06=_['merge']({},_0xfdd06,_0x149160[_0x8297('0x57')]);var _0x2670dd={'where':_0xfdd06[_0x8297('0x55')]};return db[_0x8297('0x58')][_0x8297('0x35')](_0x2670dd)['then'](function(_0x407bf4){_0x3f4e15[_0x8297('0x35')]=_0x407bf4;if(_0x149160[_0x8297('0x49')][_0x8297('0x59')]){_0xfdd06[_0x8297('0x5a')]=[{'all':!![]}];}return db[_0x8297('0x58')][_0x8297('0x5b')](_0xfdd06);})[_0x8297('0x24')](function(_0x44050d){_0x3f4e15[_0x8297('0x5c')]=_0x44050d;return _0x3f4e15;})['then'](respondWithFilteredResult(_0x580655,_0xfdd06))[_0x8297('0x2f')](handleError(_0x580655,null));};exports[_0x8297('0x5d')]=function(_0x2cfa2f,_0x4596b4){var _0x33b644={'raw':![],'where':{'id':_0x2cfa2f['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x43c3d2={};_0x43c3d2[_0x8297('0x47')]=_[_0x8297('0x4a')](db['SmsAccount'][_0x8297('0x44')]);_0x43c3d2[_0x8297('0x49')]=_[_0x8297('0x4a')](_0x2cfa2f[_0x8297('0x49')]);_0x43c3d2[_0x8297('0x51')]=_['intersection'](_0x43c3d2['model'],_0x43c3d2[_0x8297('0x49')]);_0x33b644[_0x8297('0x4c')]=_[_0x8297('0x4b')](_0x43c3d2[_0x8297('0x47')],qs[_0x8297('0x4d')](_0x2cfa2f[_0x8297('0x49')]['fields']));_0x33b644[_0x8297('0x4c')]=_0x33b644[_0x8297('0x4c')][_0x8297('0x4e')]?_0x33b644[_0x8297('0x4c')]:_0x43c3d2[_0x8297('0x47')];if(_0x2cfa2f[_0x8297('0x49')][_0x8297('0x59')]){_0x33b644['include']=[{'all':!![]}];}_0x33b644=_[_0x8297('0x54')]({},_0x33b644,_0x2cfa2f[_0x8297('0x57')]);return db['SmsAccount']['find'](_0x33b644)[_0x8297('0x24')](handleEntityNotFound(_0x4596b4,null))[_0x8297('0x24')](respondWithResult(_0x4596b4,null))[_0x8297('0x2f')](handleError(_0x4596b4,null));};exports['create']=function(_0x2b2085,_0x33beb6){return db[_0x8297('0x58')][_0x8297('0x5e')](_0x2b2085['body'],{})[_0x8297('0x24')](function(_0x4f3582){var _0x43696f=_0x2b2085[_0x8297('0x5f')][_0x8297('0x60')]({'plain':!![]});if(!_0x43696f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43696f['role']===_0x8297('0x5f')){var _0x508211=_0x4f3582[_0x8297('0x60')]({'plain':!![]});var _0x5ee3d7=_0x8297('0x3d');return db[_0x8297('0x61')][_0x8297('0x62')]({'where':{'name':_0x5ee3d7,'userProfileId':_0x43696f[_0x8297('0x63')]},'raw':!![]})[_0x8297('0x24')](function(_0x201677){if(_0x201677&&_0x201677[_0x8297('0x64')]===0x0){return db[_0x8297('0x3e')][_0x8297('0x5e')]({'name':_0x508211[_0x8297('0x40')],'resourceId':_0x508211['id'],'type':_0x201677[_0x8297('0x40')],'sectionId':_0x201677['id']},{})[_0x8297('0x24')](function(){return _0x4f3582;});}else{return _0x4f3582;}})[_0x8297('0x2f')](function(_0x1fdee9){logger[_0x8297('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fdee9);throw _0x1fdee9;});}return _0x4f3582;})[_0x8297('0x24')](respondWithResult(_0x33beb6,0xc9))[_0x8297('0x2f')](handleError(_0x33beb6,null));};exports[_0x8297('0x3b')]=function(_0x38cb6e,_0x468556){if(_0x38cb6e[_0x8297('0x65')]['id']){delete _0x38cb6e[_0x8297('0x65')]['id'];}return db[_0x8297('0x58')][_0x8297('0x62')]({'where':{'id':_0x38cb6e[_0x8297('0x66')]['id']},'include':[{'model':db[_0x8297('0x42')],'as':_0x8297('0x43')}]})[_0x8297('0x24')](handleEntityNotFound(_0x468556,null))['then'](saveUpdates(_0x38cb6e[_0x8297('0x65')],null))[_0x8297('0x24')](respondWithResult(_0x468556,null))['catch'](handleError(_0x468556,null));};exports['destroy']=function(_0xbbf2e,_0x503b8b){return db[_0x8297('0x58')][_0x8297('0x62')]({'where':{'id':_0xbbf2e[_0x8297('0x66')]['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x503b8b,null))[_0x8297('0x24')](removeEntity(_0x503b8b,null))['catch'](handleError(_0x503b8b,null));};exports[_0x8297('0x67')]=function(_0xf49cca,_0x4c26be){return db[_0x8297('0x58')][_0x8297('0x67')]()[_0x8297('0x24')](respondWithResult(_0x4c26be,null))[_0x8297('0x2f')](handleError(_0x4c26be,null));};exports['addDisposition']=function(_0x37e861,_0x4a9b12,_0x33f63d){if(_0x37e861['body']['id']){delete _0x37e861['body']['id'];}return db[_0x8297('0x58')]['find']({'where':{'id':_0x37e861[_0x8297('0x66')]['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x4a9b12,null))[_0x8297('0x24')](function(_0x36f7dc){if(_0x36f7dc){_0x37e861[_0x8297('0x65')][_0x8297('0x68')]=_0x36f7dc['id'];return db[_0x8297('0x69')][_0x8297('0x5e')](_0x37e861[_0x8297('0x65')]);}})[_0x8297('0x24')](respondWithResult(_0x4a9b12,null))[_0x8297('0x2f')](handleError(_0x4a9b12,null));};exports[_0x8297('0x6a')]=function(_0x37f518,_0x141d67,_0x2f4872){var _0x2831fb={'raw':![],'where':{}};var _0x311bea={};var _0x5e6efe={'count':0x0,'rows':[]};return db[_0x8297('0x58')][_0x8297('0x6b')]({'where':{'id':_0x37f518['params']['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x141d67,null))[_0x8297('0x24')](function(_0x134263){if(_0x134263){_0x311bea[_0x8297('0x47')]=_[_0x8297('0x4a')](db['Disposition'][_0x8297('0x44')]);_0x311bea[_0x8297('0x49')]=_[_0x8297('0x4a')](_0x37f518[_0x8297('0x49')]);_0x311bea[_0x8297('0x51')]=_[_0x8297('0x4b')](_0x311bea[_0x8297('0x47')],_0x311bea[_0x8297('0x49')]);_0x2831fb[_0x8297('0x4c')]=_['intersection'](_0x311bea['model'],qs['fields'](_0x37f518[_0x8297('0x49')][_0x8297('0x4d')]));_0x2831fb[_0x8297('0x4c')]=_0x2831fb['attributes'][_0x8297('0x4e')]?_0x2831fb[_0x8297('0x4c')]:_0x311bea['model'];if(!_0x37f518[_0x8297('0x49')]['hasOwnProperty'](_0x8297('0x6c'))){_0x2831fb['limit']=qs[_0x8297('0x34')](_0x37f518[_0x8297('0x49')][_0x8297('0x34')]);_0x2831fb[_0x8297('0x33')]=qs[_0x8297('0x33')](_0x37f518[_0x8297('0x49')]['offset']);}_0x2831fb[_0x8297('0x4f')]=qs[_0x8297('0x50')](_0x37f518[_0x8297('0x49')][_0x8297('0x50')]);_0x2831fb['where']=qs[_0x8297('0x51')](_['pick'](_0x37f518[_0x8297('0x49')],_0x311bea[_0x8297('0x51')]));_0x2831fb[_0x8297('0x55')]['SmsAccountId']=_0x134263['id'];if(_0x37f518[_0x8297('0x49')][_0x8297('0x53')]){_0x2831fb['where']=_[_0x8297('0x54')](_0x2831fb[_0x8297('0x55')],{'$or':_[_0x8297('0x48')](_0x2831fb[_0x8297('0x4c')],function(_0x52d529){var _0x21ff50={};_0x21ff50[_0x52d529]={'$like':'%'+_0x37f518[_0x8297('0x49')][_0x8297('0x53')]+'%'};return _0x21ff50;})});}_0x2831fb=_[_0x8297('0x54')]({},_0x2831fb,_0x37f518['options']);return db[_0x8297('0x69')][_0x8297('0x35')]({'where':_0x2831fb[_0x8297('0x55')]})[_0x8297('0x24')](function(_0x4bb2b9){_0x5e6efe['count']=_0x4bb2b9;if(_0x37f518[_0x8297('0x49')][_0x8297('0x59')]){_0x2831fb[_0x8297('0x5a')]=[{'all':!![]}];}return db[_0x8297('0x69')]['findAll'](_0x2831fb);})[_0x8297('0x24')](function(_0x163421){_0x5e6efe['rows']=_0x163421;return _0x5e6efe;});}})[_0x8297('0x24')](respondWithFilteredResult(_0x141d67,_0x2831fb))[_0x8297('0x2f')](handleError(_0x141d67,null));};exports[_0x8297('0x6d')]=function(_0x581462,_0x414b9e,_0x4bac3e){return db[_0x8297('0x58')][_0x8297('0x62')]({'where':{'id':_0x581462[_0x8297('0x66')]['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x414b9e,null))[_0x8297('0x24')](function(_0x784719){if(_0x784719){return _0x784719[_0x8297('0x6d')](_0x581462[_0x8297('0x49')][_0x8297('0x6e')]);}})[_0x8297('0x24')](respondWithStatusCode(_0x414b9e,null))[_0x8297('0x2f')](handleError(_0x414b9e,null));};exports['addAnswer']=function(_0x41811f,_0x5a72c8,_0x318a39){if(_0x41811f[_0x8297('0x65')]['id']){delete _0x41811f[_0x8297('0x65')]['id'];}return db[_0x8297('0x58')][_0x8297('0x62')]({'where':{'id':_0x41811f[_0x8297('0x66')]['id']}})['then'](handleEntityNotFound(_0x5a72c8,null))[_0x8297('0x24')](function(_0x1b9511){if(_0x1b9511){_0x41811f['body'][_0x8297('0x68')]=_0x1b9511['id'];return db['CannedAnswer'][_0x8297('0x5e')](_0x41811f[_0x8297('0x65')]);}})[_0x8297('0x24')](respondWithResult(_0x5a72c8,null))[_0x8297('0x2f')](handleError(_0x5a72c8,null));};exports['getAnswers']=function(_0x1c6a6b,_0x4b5553,_0x50c1ab){var _0x39d1b9={'raw':![],'where':{}};var _0xfe2ef6={};var _0x5f5040={'count':0x0,'rows':[]};return db[_0x8297('0x58')][_0x8297('0x6b')]({'where':{'id':_0x1c6a6b[_0x8297('0x66')]['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x4b5553,null))[_0x8297('0x24')](function(_0x2f6855){if(_0x2f6855){_0xfe2ef6['model']=_[_0x8297('0x4a')](db[_0x8297('0x6f')]['rawAttributes']);_0xfe2ef6[_0x8297('0x49')]=_[_0x8297('0x4a')](_0x1c6a6b[_0x8297('0x49')]);_0xfe2ef6[_0x8297('0x51')]=_['intersection'](_0xfe2ef6[_0x8297('0x47')],_0xfe2ef6[_0x8297('0x49')]);_0x39d1b9[_0x8297('0x4c')]=_[_0x8297('0x4b')](_0xfe2ef6[_0x8297('0x47')],qs[_0x8297('0x4d')](_0x1c6a6b[_0x8297('0x49')][_0x8297('0x4d')]));_0x39d1b9[_0x8297('0x4c')]=_0x39d1b9[_0x8297('0x4c')][_0x8297('0x4e')]?_0x39d1b9[_0x8297('0x4c')]:_0xfe2ef6[_0x8297('0x47')];if(!_0x1c6a6b[_0x8297('0x49')][_0x8297('0x70')](_0x8297('0x6c'))){_0x39d1b9[_0x8297('0x34')]=qs[_0x8297('0x34')](_0x1c6a6b['query'][_0x8297('0x34')]);_0x39d1b9[_0x8297('0x33')]=qs[_0x8297('0x33')](_0x1c6a6b[_0x8297('0x49')]['offset']);}_0x39d1b9[_0x8297('0x4f')]=qs[_0x8297('0x50')](_0x1c6a6b[_0x8297('0x49')][_0x8297('0x50')]);_0x39d1b9[_0x8297('0x55')]=qs[_0x8297('0x51')](_[_0x8297('0x52')](_0x1c6a6b['query'],_0xfe2ef6[_0x8297('0x51')]));_0x39d1b9[_0x8297('0x55')]['SmsAccountId']=_0x2f6855['id'];if(_0x1c6a6b[_0x8297('0x49')][_0x8297('0x53')]){_0x39d1b9['where']=_[_0x8297('0x54')](_0x39d1b9[_0x8297('0x55')],{'$or':_[_0x8297('0x48')](_0x39d1b9['attributes'],function(_0x620021){var _0x5aea55={};_0x5aea55[_0x620021]={'$like':'%'+_0x1c6a6b[_0x8297('0x49')][_0x8297('0x53')]+'%'};return _0x5aea55;})});}_0x39d1b9=_['merge']({},_0x39d1b9,_0x1c6a6b[_0x8297('0x57')]);return db[_0x8297('0x6f')]['count']({'where':_0x39d1b9['where']})[_0x8297('0x24')](function(_0x45c135){_0x5f5040[_0x8297('0x35')]=_0x45c135;if(_0x1c6a6b[_0x8297('0x49')][_0x8297('0x59')]){_0x39d1b9[_0x8297('0x5a')]=[{'all':!![]}];}return db[_0x8297('0x6f')][_0x8297('0x5b')](_0x39d1b9);})[_0x8297('0x24')](function(_0x1f67f0){_0x5f5040[_0x8297('0x5c')]=_0x1f67f0;return _0x5f5040;});}})['then'](respondWithFilteredResult(_0x4b5553,_0x39d1b9))['catch'](handleError(_0x4b5553,null));};exports[_0x8297('0x71')]=function(_0xf02aae,_0xb5fd23,_0x4148b8){return db[_0x8297('0x58')][_0x8297('0x62')]({'where':{'id':_0xf02aae[_0x8297('0x66')]['id']}})['then'](handleEntityNotFound(_0xb5fd23,null))[_0x8297('0x24')](function(_0x4dd20c){if(_0x4dd20c){return _0x4dd20c[_0x8297('0x71')](_0xf02aae[_0x8297('0x49')][_0x8297('0x6e')]);}})['then'](respondWithStatusCode(_0xb5fd23,null))['catch'](handleError(_0xb5fd23,null));};exports['notify']=function(_0x4411d8,_0x317ba3,_0x40b8e6){var _0x146a2b={'channel':_0x8297('0x72')};var _0x2db687=[];var _0x58b900=[];var _0x2294ea={};return db[_0x8297('0x58')][_0x8297('0x62')]({'where':{'id':_0x4411d8[_0x8297('0x66')]['id']},'include':[{'model':db[_0x8297('0x73')],'as':_0x8297('0x74')}]})[_0x8297('0x24')](handleEntityNotFound(_0x317ba3,null))[_0x8297('0x24')](function(_0x1ad910){_0x146a2b[_0x8297('0x75')]=_0x1ad910;_0x146a2b[_0x8297('0x76')]=_['orderBy'](_0x1ad910[_0x8297('0x74')],[_0x8297('0x77')],[_0x8297('0x78')]);if(_0x146a2b[_0x8297('0x75')][_0x8297('0x74')]){delete _0x146a2b[_0x8297('0x75')][_0x8297('0x74')];}return db[_0x8297('0x79')][_0x8297('0x67')]();})[_0x8297('0x24')](function(_0x380eae){if(!_0x380eae){throw new db[(_0x8297('0x7a'))]['ValidationError'](_0x8297('0x7b'));}_0x2db687=_['difference'](_['keys'](_0x380eae),[_0x8297('0x7c'),_0x8297('0x7d')]);_0x58b900=_[_0x8297('0x7e')](_[_0x8297('0x4a')](_0x380eae),['createdAt','updatedAt',_0x8297('0x7f'),_0x8297('0x80')]);_0x146a2b[_0x8297('0x65')]={'mapKey':_0x8297('0x81')};if(_0x146a2b[_0x8297('0x75')][_0x8297('0x45')]){switch(_0x146a2b['account'][_0x8297('0x45')]){case _0x8297('0x82'):_0x146a2b[_0x8297('0x65')][_0x8297('0x83')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x84')];_0x146a2b['body'][_0x8297('0x65')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x85')];_0x146a2b[_0x8297('0x65')]['messageId']=_0x4411d8['body']['MessageSid'];break;case'skebby':_0x146a2b[_0x8297('0x65')][_0x8297('0x83')]='+'+_0x4411d8['body']['sender'];_0x146a2b[_0x8297('0x65')]['body']=_0x4411d8[_0x8297('0x65')][_0x8297('0x86')];break;case _0x8297('0x87'):_0x146a2b[_0x8297('0x65')]['from']=_0x4411d8['body']['from'];_0x146a2b['body'][_0x8297('0x65')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x2c')];break;case _0x8297('0x88'):_0x146a2b[_0x8297('0x65')][_0x8297('0x83')]=_0x4411d8[_0x8297('0x65')]['from'];_0x146a2b['body'][_0x8297('0x65')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x65')];_0x146a2b[_0x8297('0x65')][_0x8297('0x89')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x8a')];break;case _0x8297('0x8b'):_0x146a2b[_0x8297('0x65')][_0x8297('0x83')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x84')];_0x146a2b[_0x8297('0x65')][_0x8297('0x65')]=_0x4411d8['body'][_0x8297('0x8c')];_0x146a2b['body'][_0x8297('0x89')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x8d')];break;case _0x8297('0x8e'):_0x146a2b['body'][_0x8297('0x83')]='+'+_0x4411d8[_0x8297('0x65')][_0x8297('0x8f')][0x0][_0x8297('0x83')];_0x146a2b[_0x8297('0x65')][_0x8297('0x65')]=_0x4411d8[_0x8297('0x65')]['results'][0x0]['text'];_0x146a2b[_0x8297('0x65')][_0x8297('0x89')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x8f')][0x0][_0x8297('0x89')];break;case _0x8297('0x90'):_0x146a2b[_0x8297('0x65')]['from']=_0x4411d8[_0x8297('0x65')]['originatingAddress'];_0x146a2b[_0x8297('0x65')][_0x8297('0x65')]=_0x4411d8[_0x8297('0x65')]['segmentedMessage'][_0x8297('0x2c')];break;case _0x8297('0x91'):_0x146a2b[_0x8297('0x65')][_0x8297('0x83')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x92')];_0x146a2b[_0x8297('0x65')][_0x8297('0x65')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x86')];_0x146a2b[_0x8297('0x65')][_0x8297('0x89')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x93')];break;case'bandwidth':_0x146a2b[_0x8297('0x65')]['messageId']=_0x4411d8['body'][0x0]['message']['id'];_0x146a2b[_0x8297('0x65')]['from']=_0x4411d8[_0x8297('0x65')][0x0][_0x8297('0x2c')][_0x8297('0x83')];_0x146a2b[_0x8297('0x65')][_0x8297('0x65')]=_0x4411d8[_0x8297('0x65')][0x0]['message'][_0x8297('0x86')];break;case _0x8297('0x94'):_0x146a2b[_0x8297('0x65')]['from']=_0x4411d8[_0x8297('0x65')][_0x8297('0x83')];_0x146a2b['body'][_0x8297('0x65')]=_0x4411d8[_0x8297('0x65')][_0x8297('0x2c')];_0x146a2b[_0x8297('0x65')][_0x8297('0x89')]=_0x4411d8['body'][_0x8297('0x95')];break;}}if(_0x146a2b[_0x8297('0x65')]['id']){delete _0x146a2b[_0x8297('0x65')]['id'];}if(_[_0x8297('0x96')](_0x146a2b[_0x8297('0x65')][_0x8297('0x83')])){throw new db[(_0x8297('0x7a'))][(_0x8297('0x97'))]('from\x20is\x20mandatory');}if(_[_0x8297('0x96')](_0x146a2b[_0x8297('0x65')][_0x8297('0x65')])||_0x146a2b[_0x8297('0x65')]['body']===''){throw new db[(_0x8297('0x7a'))][(_0x8297('0x97'))](_0x8297('0x98'));}if(_['isNil'](_0x146a2b[_0x8297('0x65')][_0x8297('0x99')])){throw new db[(_0x8297('0x7a'))][(_0x8297('0x97'))](_0x8297('0x9a')+_0x58b900);}if(!_[_0x8297('0x9b')](_0x58b900,_0x146a2b[_0x8297('0x65')][_0x8297('0x99')])){throw new db[(_0x8297('0x7a'))][(_0x8297('0x97'))](_0x8297('0x9c')+_0x58b900);}_0x2294ea[_0x146a2b[_0x8297('0x65')][_0x8297('0x99')]]=_0x146a2b['body'][_0x8297('0x83')];return db['CmList'][_0x8297('0x62')]({'where':{'id':_0x146a2b[_0x8297('0x75')][_0x8297('0x80')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2294ea,'limit':0x1,'order':[[_0x8297('0x7d'),_0x8297('0x9d')]]}]});})[_0x8297('0x24')](handleEntityNotFound(_0x317ba3,null))[_0x8297('0x24')](function(_0x589b82){if(_0x589b82){_0x146a2b['list']=_['omit'](_0x589b82,['Contacts']);if(_0x589b82[_0x8297('0x9e')]['length']){return _0x589b82[_0x8297('0x9e')][0x0];}var _0x337f4a=_['defaults'](_0x146a2b['body'],{'firstName':_0x146a2b['body']['from'],'ListId':_0x589b82['id']});_0x337f4a[_0x146a2b[_0x8297('0x65')][_0x8297('0x99')]]=_0x146a2b['body'][_0x8297('0x83')];return db[_0x8297('0x79')][_0x8297('0x5e')](_0x337f4a,{'fields':_0x2db687,'raw':!![]});}})['then'](handleEntityNotFound(_0x317ba3,null))['then'](function(_0x40ffa9){if(_0x40ffa9){_0x146a2b[_0x8297('0x9f')]=_0x40ffa9;var _0x3364d6={'ContactId':_0x40ffa9['id'],'phone':_0x146a2b[_0x8297('0x65')][_0x8297('0x83')],'SmsAccountId':_0x4411d8[_0x8297('0x66')]['id']};var _0x4f0891={'ContactId':_0x40ffa9['id'],'SmsAccountId':_0x4411d8[_0x8297('0x66')]['id'],'closed':![]};return db[_0x8297('0xa0')][_0x8297('0x62')]({'where':_0x4f0891})[_0x8297('0x24')](function(_0xc9f9c6){if(_0xc9f9c6){return[_0xc9f9c6,![]];}return db[_0x8297('0xa0')][_0x8297('0x5e')](_0x3364d6)[_0x8297('0x24')](function(_0x4d3eeb){return[_0x4d3eeb,!![]];});});}})[_0x8297('0xa1')](function(_0x58c58f,_0x3d4d7e){_0x146a2b[_0x8297('0xa2')]=_0x58c58f['get']({'plain':!![]});_0x146a2b[_0x8297('0xa2')][_0x8297('0xa3')]=![];if(_0x3d4d7e){if(_0x146a2b['account'][_0x8297('0xa4')]){_0x146a2b['applications'][_0x8297('0xa5')]({'id':0x0,'priority':_0x146a2b[_0x8297('0x76')][_0x8297('0x4e')]+0x1,'app':'close','appdata':_0x8297('0xa6'),'interval':'*,*,*,*'});}_0x146a2b[_0x8297('0xa2')][_0x8297('0xa3')]=!![];}return db['SmsMessage'][_0x8297('0x5e')]({'phone':_0x146a2b[_0x8297('0x65')][_0x8297('0x83')],'messageId':_0x146a2b[_0x8297('0x65')][_0x8297('0x89')],'body':_0x146a2b[_0x8297('0x65')][_0x8297('0x65')],'SmsAccountId':_0x4411d8['params']['id'],'SmsInteractionId':_0x58c58f['id'],'direction':'in','ContactId':_0x58c58f[_0x8297('0xa7')],'AttachmentId':_0x146a2b[_0x8297('0x65')][_0x8297('0xa8')]});})[_0x8297('0x24')](function(_0x498816){_0x146a2b[_0x8297('0x2c')]=_0x498816;if(_0x146a2b[_0x8297('0xa2')][_0x8297('0xa9')]){return db[_0x8297('0xaa')][_0x8297('0x62')]({'attributes':['id',_0x8297('0x40')],'where':{'id':_0x146a2b[_0x8297('0xa2')][_0x8297('0xa9')]}})[_0x8297('0x24')](function(_0x4b9267){if(_0x4b9267){_0x146a2b[_0x8297('0x76')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4b9267[_0x8297('0x40')]+','+(_0x146a2b[_0x8297('0x75')][_0x8297('0xab')]||0xa),'interval':_0x8297('0xac')});}return respondWithRpcPromise(_0x8297('0xad'),_0x8297('0xae'),_0x146a2b);});}return respondWithRpcPromise(_0x8297('0xad'),_0x8297('0xae'),_0x146a2b);})['then'](function(_0x3bd182){if(_0x3bd182){var _0x41da0e=0xc8;var _0x226a04='receiveMessage';logger[_0x8297('0x25')](_0x8297('0x28'),_0x226a04,_0x41da0e,_0x8297('0xaf'));logger[_0x8297('0x27')](_0x8297('0xb0'),_0x226a04,_0x41da0e,_0x8297('0xaf'),JSON[_0x8297('0x29')](_0x3bd182));if(_0x146a2b[_0x8297('0x75')][_0x8297('0x45')]===_0x8297('0x82')){return _0x317ba3[_0x8297('0x31')](_0x41da0e)[_0x8297('0x36')](_0x8297('0xb1'),_0x8297('0xb2'))[_0x8297('0x41')](_0x8297('0xb3'));}else{return _0x317ba3[_0x8297('0x31')](_0x41da0e)[_0x8297('0x38')](_0x3bd182);}}})[_0x8297('0x2f')](handleError(_0x317ba3,null));};exports[_0x8297('0xb4')]=function(_0x3431a8,_0x151f26){var _0x38d484=_0x3431a8[_0x8297('0x66')]['id'];var _0x4eb68f=_0x3431a8['body'];var _0x2548da=0xc8;var _0x5729c9=null;return db['sequelize'][_0x8297('0xb5')]({'isolationLevel':db[_0x8297('0xb6')][_0x8297('0xb7')][_0x8297('0xb8')]['READ_COMMITTED']},function(_0x42cd1a){return db[_0x8297('0x58')]['findOne']({'where':{'id':_0x38d484},'transaction':_0x42cd1a})[_0x8297('0x24')](function(_0x38f820){if(_0x38f820){return db[_0x8297('0x73')][_0x8297('0x3c')]({'where':{'SmsAccountId':_0x38d484},'transaction':_0x42cd1a})['then'](function(){var _0x3b57a2=_['map'](_0x4eb68f,function(_0x142264){_0x142264[_0x8297('0x68')]=_0x38d484;return _0x142264;});return db['SmsApplication'][_0x8297('0xb9')](_0x3b57a2,{'transaction':_0x42cd1a});});}else{_0x2548da=0x194;_0x5729c9=[];}});})['then'](function(){if(_0x2548da!==0x194){return db[_0x8297('0x73')][_0x8297('0xba')]({'where':{'SmsAccountId':_0x38d484},'order':'priority'})[_0x8297('0x24')](function(_0x1c06b5){_0x5729c9=_0x1c06b5;});}})[_0x8297('0x2f')](function(_0x1ca0bf){_0x2548da=0x1f4;logger['error'](_0x1ca0bf['stack']);if(_0x1ca0bf[_0x8297('0x40')]){delete _0x1ca0bf['name'];}_0x5729c9=_0x1ca0bf;})[_0x8297('0xbb')](function(){if(_0x5729c9===null){_0x151f26[_0x8297('0x30')](_0x2548da);}else{if(_0x2548da===0x1f4){_0x151f26['status'](_0x2548da)[_0x8297('0x41')](_0x5729c9);}else{_0x151f26[_0x8297('0x31')](_0x2548da)[_0x8297('0x38')](_0x5729c9);}}});};exports['getApplications']=function(_0x188617,_0x4da435,_0x3b8672){var _0x5c275b={};var _0x12a683={};var _0x1b56b9;var _0x17ef3c;return db[_0x8297('0x58')][_0x8297('0x6b')]({'where':{'id':_0x188617[_0x8297('0x66')]['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x4da435,null))[_0x8297('0x24')](function(_0x49ecd0){if(_0x49ecd0){_0x1b56b9=_0x49ecd0;_0x12a683[_0x8297('0x47')]=_['keys'](db['SmsApplication'][_0x8297('0x44')]);_0x12a683[_0x8297('0x49')]=_[_0x8297('0x4a')](_0x188617[_0x8297('0x49')]);_0x12a683[_0x8297('0x51')]=_['intersection'](_0x12a683['model'],_0x12a683[_0x8297('0x49')]);_0x5c275b[_0x8297('0x4c')]=_[_0x8297('0x4b')](_0x12a683[_0x8297('0x47')],qs['fields'](_0x188617[_0x8297('0x49')][_0x8297('0x4d')]));_0x5c275b[_0x8297('0x4c')]=_0x5c275b['attributes'][_0x8297('0x4e')]?_0x5c275b[_0x8297('0x4c')]:_0x12a683[_0x8297('0x47')];_0x5c275b[_0x8297('0x4f')]=qs['sort'](_0x188617[_0x8297('0x49')][_0x8297('0x50')]);_0x5c275b[_0x8297('0x55')]=qs['filters'](_['pick'](_0x188617[_0x8297('0x49')],_0x12a683[_0x8297('0x51')]));if(_0x188617['query'][_0x8297('0x53')]){_0x5c275b[_0x8297('0x55')]=_[_0x8297('0x54')](_0x5c275b[_0x8297('0x55')],{'$or':_['map'](_0x5c275b['attributes'],function(_0x24fe12){var _0x249796={};_0x249796[_0x24fe12]={'$like':'%'+_0x188617[_0x8297('0x49')][_0x8297('0x53')]+'%'};return _0x249796;})});}_0x5c275b=_['merge']({},_0x5c275b,_0x188617[_0x8297('0x57')]);return _0x1b56b9[_0x8297('0xbc')](_0x5c275b);}})[_0x8297('0x24')](function(_0x19b06b){if(_0x19b06b){_0x17ef3c=_0x19b06b['length'];if(!_0x188617[_0x8297('0x49')][_0x8297('0x70')](_0x8297('0x6c'))){_0x5c275b[_0x8297('0x34')]=qs['limit'](_0x188617[_0x8297('0x49')][_0x8297('0x34')]);_0x5c275b[_0x8297('0x33')]=qs[_0x8297('0x33')](_0x188617['query'][_0x8297('0x33')]);}return _0x1b56b9['getApplications'](_0x5c275b);}})['then'](function(_0x4f51ca){if(_0x4f51ca){return _0x4f51ca?{'count':_0x17ef3c,'rows':_0x4f51ca}:null;}})[_0x8297('0x24')](respondWithResult(_0x4da435,null))[_0x8297('0x2f')](handleError(_0x4da435,null));};exports[_0x8297('0xbd')]=function(_0x43c48f,_0x552ff7,_0x2a06af){var _0x5a9b78={'raw':![],'where':{}};var _0x24c8d9={};var _0xc17e2f={'count':0x0,'rows':[]};return db[_0x8297('0x58')]['findOne']({'where':{'id':_0x43c48f[_0x8297('0x66')]['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x552ff7,null))[_0x8297('0x24')](function(_0x177492){if(_0x177492){_0x24c8d9[_0x8297('0x47')]=_['keys'](db[_0x8297('0xa0')]['rawAttributes']);_0x24c8d9[_0x8297('0x49')]=_[_0x8297('0x4a')](_0x43c48f[_0x8297('0x49')]);_0x24c8d9[_0x8297('0x51')]=_[_0x8297('0x4b')](_0x24c8d9['model'],_0x24c8d9[_0x8297('0x49')]);_0x5a9b78['attributes']=_['intersection'](_0x24c8d9['model'],qs[_0x8297('0x4d')](_0x43c48f[_0x8297('0x49')][_0x8297('0x4d')]));_0x5a9b78[_0x8297('0x4c')]=_0x5a9b78[_0x8297('0x4c')]['length']?_0x5a9b78[_0x8297('0x4c')]:_0x24c8d9['model'];if(!_0x43c48f[_0x8297('0x49')]['hasOwnProperty'](_0x8297('0x6c'))){_0x5a9b78[_0x8297('0x34')]=qs[_0x8297('0x34')](_0x43c48f[_0x8297('0x49')][_0x8297('0x34')]);_0x5a9b78[_0x8297('0x33')]=qs[_0x8297('0x33')](_0x43c48f[_0x8297('0x49')][_0x8297('0x33')]);}_0x5a9b78[_0x8297('0x4f')]=qs['sort'](_0x43c48f['query'][_0x8297('0x50')]);_0x5a9b78[_0x8297('0x55')]=qs['filters'](_[_0x8297('0x52')](_0x43c48f[_0x8297('0x49')],_0x24c8d9[_0x8297('0x51')]));_0x5a9b78[_0x8297('0x55')][_0x8297('0x68')]=_0x177492['id'];if(_0x43c48f[_0x8297('0x49')][_0x8297('0x53')]){_0x5a9b78[_0x8297('0x55')]=_['merge'](_0x5a9b78['where'],{'$or':_[_0x8297('0x48')](_0x5a9b78[_0x8297('0x4c')],function(_0x42c99b){var _0x52e5ab={};_0x52e5ab[_0x42c99b]={'$like':'%'+_0x43c48f[_0x8297('0x49')][_0x8297('0x53')]+'%'};return _0x52e5ab;})});}_0x5a9b78=_[_0x8297('0x54')]({},_0x5a9b78,_0x43c48f[_0x8297('0x57')]);return db['SmsInteraction']['count']({'where':_0x5a9b78[_0x8297('0x55')]})['then'](function(_0xbfbc80){_0xc17e2f[_0x8297('0x35')]=_0xbfbc80;if(_0x43c48f[_0x8297('0x49')][_0x8297('0x59')]){_0x5a9b78[_0x8297('0x5a')]=[{'model':db[_0x8297('0x79')],'as':_0x8297('0xbe'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x8297('0xbf'),'internal'],'required':![]},{'model':db[_0x8297('0xc0')],'as':'Tags','attributes':['id',_0x8297('0x40'),_0x8297('0xc1')],'where':_0x43c48f['query']['tag']?{'id':_0x43c48f[_0x8297('0x49')][_0x8297('0xc2')]}:undefined,'required':_0x43c48f[_0x8297('0x49')][_0x8297('0xc2')]?!![]:![]}];}return db[_0x8297('0xa0')][_0x8297('0x5b')](_0x5a9b78);})['then'](function(_0xa98832){_0xc17e2f[_0x8297('0x5c')]=_0xa98832;return _0xc17e2f;});}})[_0x8297('0x24')](respondWithFilteredResult(_0x552ff7,_0x5a9b78))[_0x8297('0x2f')](handleError(_0x552ff7,null));};exports[_0x8297('0x41')]=function(_0xb8fa87,_0x52e3b3,_0x98b839){var _0x351552,_0x5e132b,_0x5d1231;if(_[_0x8297('0x96')](_0xb8fa87[_0x8297('0x65')]['body'])||_0xb8fa87[_0x8297('0x65')][_0x8297('0x65')]===''){throw new db['Sequelize'][(_0x8297('0x97'))](_0x8297('0x98'));}if(_[_0x8297('0x96')](_0xb8fa87[_0x8297('0x65')]['to'])){throw new db[(_0x8297('0x7a'))][(_0x8297('0x97'))](_0x8297('0xc3'));}_0x351552=_0xb8fa87[_0x8297('0x65')]['to'];return db[_0x8297('0x58')][_0x8297('0x62')]({'where':{'id':_0xb8fa87['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8297('0x79')],'as':_0x8297('0x9e'),'where':{'mobile':_0x351552},'limit':0x1,'order':[[_0x8297('0x7d'),_0x8297('0x9d')]]}]}]})['then'](handleEntityNotFound(_0x52e3b3,null))[_0x8297('0x24')](function(_0x52b67e){if(_0x52b67e&&_0x52b67e['List']){_0x5e132b=_0x52b67e[_0x8297('0x60')]({'plain':!![]});if(_0x5e132b[_0x8297('0xc4')]&&_0x5e132b[_0x8297('0xc4')][_0x8297('0x9e')][_0x8297('0x4e')]){return _0x5e132b['List'][_0x8297('0x9e')][0x0];}return db['CmContact'][_0x8297('0x5e')](_['defaults'](_0xb8fa87[_0x8297('0x65')],{'firstName':_0x351552,'mobile':_0x351552,'phone':_0x351552,'ListId':_0x5e132b[_0x8297('0x80')]}));}})['then'](handleEntityNotFound(_0x52e3b3,null))[_0x8297('0x24')](function(_0x38151c){if(_0x38151c){_0x5d1231=_0x38151c;return db[_0x8297('0xa0')][_0x8297('0x62')]({'where':{'ContactId':_0x5d1231['id'],'closed':![],'SmsAccountId':_0x5e132b['id']}})[_0x8297('0x24')](function(_0x99f932){if(_0x99f932){return[_0x99f932,![]];}return db['SmsInteraction'][_0x8297('0x5e')]({'UserId':_0xb8fa87[_0x8297('0x5f')]['id'],'ContactId':_0x5d1231['id'],'SmsAccountId':_0x5e132b['id'],'phone':_0x351552,'firstMsgDirection':_0x8297('0xc5'),'Messages':[_[_0x8297('0x54')](_0xb8fa87['body'],{'read':![],'body':_0xb8fa87['body'][_0x8297('0x65')],'phone':_0x351552,'SmsAccountId':_0x5e132b['id'],'UserId':_0xb8fa87[_0x8297('0x5f')]['id'],'ContactId':_0x5d1231['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x8297('0xc6')}]})[_0x8297('0x24')](function(_0x9a0a0e){return[_0x9a0a0e,!![]];});});}})[_0x8297('0xa1')](function(_0x371fb4,_0x4c6acd){if(_0x4c6acd){return _0x371fb4;}return db[_0x8297('0xc7')][_0x8297('0x5e')](_['merge'](_0xb8fa87['body'],{'read':![],'body':_0xb8fa87[_0x8297('0x65')][_0x8297('0x65')],'phone':_0x351552,'SmsAccountId':_0x5e132b['id'],'SmsInteractionId':_0x371fb4['id'],'UserId':_0xb8fa87['user']['id'],'ContactId':_0x5d1231['id']}))[_0x8297('0x24')](function(_0x5bcc4c){_0x371fb4['dataValues'][_0x8297('0xc6')]=[];_0x371fb4[_0x8297('0xc8')][_0x8297('0xc6')][_0x8297('0xa5')](_0x5bcc4c['dataValues']);return _0x371fb4;});})[_0x8297('0x24')](respondWithResult(_0x52e3b3,null))[_0x8297('0x2f')](handleError(_0x52e3b3,null));};exports[_0x8297('0x31')]=function(_0x31532d,_0x509e70,_0x393a05){if(_0x31532d[_0x8297('0x65')]['id']){delete _0x31532d[_0x8297('0x65')]['id'];}var _0x56cee0,_0x34a912,_0x215e95;return db['SmsAccount'][_0x8297('0x62')]({'where':{'id':_0x31532d[_0x8297('0x66')]['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x509e70,null))[_0x8297('0x24')](function(_0x19ad8a){if(_0x19ad8a){_0x215e95=_0x19ad8a;logger[_0x8297('0x27')](_0x8297('0x28'),_0x8297('0x31'),_0x8297('0xc9'),_0x19ad8a[_0x8297('0x45')],util[_0x8297('0xca')](_0x31532d[_0x8297('0x65')],{'showHidden':![],'depth':null}));switch(_0x19ad8a['type']){case _0x8297('0xcb'):if(_0x31532d[_0x8297('0x65')][_0x8297('0xcc')]&&_0x31532d[_0x8297('0x65')][_0x8297('0x31')]){_0x34a912=_0x31532d['body'][_0x8297('0x31')];return db[_0x8297('0xc7')][_0x8297('0x62')]({'where':{'messageId':_0x31532d[_0x8297('0x65')][_0x8297('0xcc')]}});}break;case'connectel':if(_0x31532d[_0x8297('0x65')][_0x8297('0xcd')]&&_0x31532d['body'][_0x8297('0xce')]){_0x34a912=_0x31532d[_0x8297('0x65')][_0x8297('0xce')];return db[_0x8297('0xc7')]['find']({'where':{'messageId':_0x31532d['body'][_0x8297('0xcd')]}});}break;case _0x8297('0x88'):if(_0x31532d[_0x8297('0x65')][_0x8297('0x8a')]&&_0x31532d[_0x8297('0x65')][_0x8297('0xcf')]){_0x34a912=_0x31532d[_0x8297('0x65')]['status_code'];return db[_0x8297('0xc7')][_0x8297('0x62')]({'where':{'messageId':_0x31532d['body'][_0x8297('0x8a')]}});}break;case _0x8297('0x8e'):var _0x45b1d5=_0x31532d[_0x8297('0x65')]['results'][0x0];if(_0x45b1d5[_0x8297('0x89')]&&_0x45b1d5['status'][_0x8297('0xd0')]==='DELIVERED'){_0x34a912=_0x45b1d5['status'][_0x8297('0xd0')];return db[_0x8297('0xc7')]['find']({'where':{'messageId':_0x45b1d5['messageId']}});}break;case'clickatell':if(_0x31532d['body'][_0x8297('0x89')]&&_0x31532d[_0x8297('0x65')][_0x8297('0x31')]){_0x34a912=_0x31532d[_0x8297('0x65')][_0x8297('0x31')];return db['SmsMessage'][_0x8297('0x62')]({'where':{'messageId':_0x31532d[_0x8297('0x65')][_0x8297('0x89')]}});}break;case _0x8297('0xd1'):if(_0x31532d[_0x8297('0x65')][0x0]['message']['id']){_0x34a912=_0x31532d['body'][0x0][_0x8297('0x45')];return db[_0x8297('0xc7')][_0x8297('0x62')]({'where':{'messageId':_0x31532d['body'][0x0][_0x8297('0x2c')]['id']}});}break;case _0x8297('0x94'):if(_0x31532d[_0x8297('0x65')][_0x8297('0xd2')]&&_0x31532d[_0x8297('0x65')]['status']){_0x34a912=_0x31532d[_0x8297('0x65')][_0x8297('0x31')];return db[_0x8297('0xc7')][_0x8297('0x62')]({'where':{'messageId':_0x31532d['body'][_0x8297('0xd2')]}});}break;}}})[_0x8297('0x24')](handleEntityNotFound(_0x509e70,null))['then'](function(_0x1fb5b5){if(_0x1fb5b5){_0x56cee0=_0x1fb5b5;switch(_0x215e95['type']){case _0x8297('0xcb'):if(_0x34a912===_0x8297('0xd3')){return _0x56cee0[_0x8297('0x3b')]({'read':!![]});}else{logger[_0x8297('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8297('0x31'),_0x8297('0xcb'),util[_0x8297('0xca')](_0x31532d[_0x8297('0x65')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x34a912==='1'){return _0x56cee0[_0x8297('0x3b')]({'read':!![]});}else{logger[_0x8297('0x2a')](_0x8297('0x28'),_0x8297('0x31'),_0x8297('0xcb'),util[_0x8297('0xca')](_0x31532d['body'],{'showHidden':![],'depth':null}));}break;case _0x8297('0x88'):if(!_0x31532d[_0x8297('0x65')]['error_code']&&_0x34a912>=0xc8&&_0x34a912<=0xce){return _0x56cee0[_0x8297('0x3b')]({'read':!![]});}else{logger['error'](_0x8297('0x28'),'status','clicksend',util[_0x8297('0xca')](_0x31532d[_0x8297('0x65')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4720e4=_0x31532d[_0x8297('0x65')]['results'][0x0];if(_0x4720e4[_0x8297('0x31')][_0x8297('0xd0')]===_0x8297('0xd3')){return _0x56cee0[_0x8297('0x3b')]({'read':!![]});}else{logger[_0x8297('0x2a')](_0x8297('0x28'),_0x8297('0x31'),_0x8297('0x8e'),util[_0x8297('0xca')](_0x31532d[_0x8297('0x65')],{'showHidden':![],'depth':null}));}break;case _0x8297('0x91'):if(_0x34a912==_0x8297('0xd4')||_0x34a912=='RECEIVED_BY_RECIPIENT'){return _0x56cee0[_0x8297('0x3b')]({'read':!![]});}else{logger[_0x8297('0x2a')](_0x8297('0x28'),_0x8297('0x31'),_0x8297('0x91'),util['inspect'](_0x31532d[_0x8297('0x65')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x34a912==_0x8297('0xd5')){return _0x56cee0['update']({'read':!![]});}else{logger['error'](_0x8297('0x28'),_0x8297('0x31'),_0x8297('0xd1'),util[_0x8297('0xca')](_0x31532d[_0x8297('0x65')],{'showHidden':![],'depth':null}));}break;case _0x8297('0x94'):if(_0x34a912===_0x8297('0xd6')||_0x34a912===_0x8297('0xd7')){return _0x56cee0[_0x8297('0x3b')]({'read':!![]});}else{logger['error'](_0x8297('0x28'),_0x8297('0x31'),_0x8297('0x94'),util[_0x8297('0xca')](_0x31532d['body'],{'showHidden':![],'depth':null}));}break;}return _0x56cee0;}})[_0x8297('0x24')](respondWithResult(_0x509e70,null))['catch'](handleError(_0x509e70,null));};exports['statusGet']=function(_0x7c85e2,_0x219c49,_0x57e53){var _0xce47a6,_0xd6199d,_0x1fb9bf;return db[_0x8297('0x58')]['find']({'where':{'id':_0x7c85e2['params']['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x219c49,null))[_0x8297('0x24')](function(_0x5acbd9){if(_0x5acbd9){_0x1fb9bf=_0x5acbd9;logger[_0x8297('0x27')](_0x8297('0x28'),'status',_0x8297('0xc9'),_0x5acbd9[_0x8297('0x45')],util[_0x8297('0xca')](_0x7c85e2['query'],{'showHidden':![],'depth':null}));switch(_0x5acbd9['type']){case _0x8297('0x90'):if(_0x7c85e2[_0x8297('0x49')][_0x8297('0xd8')]&&_0x7c85e2[_0x8297('0x49')]['state']){_0xd6199d=_0x7c85e2[_0x8297('0x49')][_0x8297('0xd9')];return db[_0x8297('0xc7')][_0x8297('0x62')]({'where':{'messageId':_0x7c85e2[_0x8297('0x49')][_0x8297('0xd8')]}});}break;}}})[_0x8297('0x24')](handleEntityNotFound(_0x219c49,null))[_0x8297('0x24')](function(_0x55467f){if(_0x55467f){_0xce47a6=_0x55467f;switch(_0x1fb9bf[_0x8297('0x45')]){case _0x8297('0x90'):if(_0xd6199d==='2'||_0xd6199d==='6'){return _0xce47a6[_0x8297('0x3b')]({'read':!![]});}else{logger[_0x8297('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','csc',util[_0x8297('0xca')](_0x7c85e2[_0x8297('0x49')],{'showHidden':![],'depth':null}));};break;}return _0xce47a6;}})[_0x8297('0x24')](respondWithResult(_0x219c49,null))[_0x8297('0x2f')](handleError(_0x219c49,null));};exports[_0x8297('0xda')]=function(_0x493aac,_0x6f769,_0x51da9a){return db[_0x8297('0x58')][_0x8297('0x62')]({'where':{'id':_0x493aac[_0x8297('0x66')]['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x6f769,null))['then'](function(_0xf0db49){if(_0xf0db49){return _0xf0db49['addAgents'](_0x493aac[_0x8297('0x65')][_0x8297('0x6e')],_[_0x8297('0xdb')](_0x493aac[_0x8297('0x65')],[_0x8297('0x6e'),'id'])||{})[_0x8297('0xa1')](function(_0x30f72d){for(var _0x5573ec=0x0;_0x5573ec<_0x493aac[_0x8297('0x65')][_0x8297('0x6e')][_0x8297('0x4e')];_0x5573ec+=0x1){socket[_0x8297('0xdc')](_0x8297('0xdd'),{'UserId':Number(_0x493aac[_0x8297('0x65')][_0x8297('0x6e')][_0x5573ec]),'SmsAccountId':Number(_0x493aac['params']['id'])});}return _0x30f72d;});}})['then'](respondWithResult(_0x6f769,null))[_0x8297('0x2f')](handleError(_0x6f769,null));};exports[_0x8297('0xde')]=function(_0x113f70,_0x1a1432,_0xfc83e6){return db[_0x8297('0x58')][_0x8297('0x62')]({'where':{'id':_0x113f70[_0x8297('0x66')]['id']}})[_0x8297('0x24')](handleEntityNotFound(_0x1a1432,null))[_0x8297('0x24')](function(_0x259b21){if(_0x259b21){return _0x259b21['removeAgents'](_0x113f70[_0x8297('0x49')][_0x8297('0x6e')])[_0x8297('0x24')](function(){if(_[_0x8297('0xdf')](_0x113f70[_0x8297('0x49')][_0x8297('0x6e')])){for(var _0x13f2c4=0x0;_0x13f2c4<_0x113f70[_0x8297('0x49')][_0x8297('0x6e')][_0x8297('0x4e')];_0x13f2c4+=0x1){socket[_0x8297('0xdc')](_0x8297('0xe0'),{'UserId':Number(_0x113f70['query']['ids'][_0x13f2c4]),'SmsAccountId':Number(_0x113f70[_0x8297('0x66')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x113f70[_0x8297('0x49')][_0x8297('0x6e')]),'SmsAccountId':Number(_0x113f70[_0x8297('0x66')]['id'])});}});}})['then'](respondWithStatusCode(_0x1a1432,null))['catch'](handleError(_0x1a1432,null));};exports[_0x8297('0xe1')]=function(_0x272461,_0x2374f8,_0x2717f4){var _0x2a52c5={};var _0x37c4f8={};var _0x355ed6;var _0x2327f5;return db[_0x8297('0x58')][_0x8297('0x6b')]({'where':{'id':_0x272461[_0x8297('0x66')]['id']}})['then'](handleEntityNotFound(_0x2374f8,null))['then'](function(_0x577909){if(_0x577909){_0x355ed6=_0x577909;_0x37c4f8['model']=_['keys'](db['User'][_0x8297('0x44')]);_0x37c4f8[_0x8297('0x49')]=_[_0x8297('0x4a')](_0x272461[_0x8297('0x49')]);_0x37c4f8[_0x8297('0x51')]=_[_0x8297('0x4b')](_0x37c4f8[_0x8297('0x47')],_0x37c4f8[_0x8297('0x49')]);_0x2a52c5['attributes']=_[_0x8297('0x4b')](_0x37c4f8[_0x8297('0x47')],qs[_0x8297('0x4d')](_0x272461[_0x8297('0x49')][_0x8297('0x4d')]));_0x2a52c5[_0x8297('0x4c')]=_0x2a52c5[_0x8297('0x4c')][_0x8297('0x4e')]?_0x2a52c5[_0x8297('0x4c')]:_0x37c4f8[_0x8297('0x47')];_0x2a52c5[_0x8297('0x4f')]=qs['sort'](_0x272461[_0x8297('0x49')]['sort']);_0x2a52c5[_0x8297('0x55')]=qs['filters'](_[_0x8297('0x52')](_0x272461[_0x8297('0x49')],_0x37c4f8[_0x8297('0x51')]));if(_0x272461[_0x8297('0x49')][_0x8297('0x53')]){_0x2a52c5[_0x8297('0x55')]=_[_0x8297('0x54')](_0x2a52c5['where'],{'$or':_[_0x8297('0x48')](_0x2a52c5[_0x8297('0x4c')],function(_0x497783){var _0x2ff763={};_0x2ff763[_0x497783]={'$like':'%'+_0x272461[_0x8297('0x49')]['filter']+'%'};return _0x2ff763;})});}_0x2a52c5=_['merge']({},_0x2a52c5,_0x272461[_0x8297('0x57')]);return _0x355ed6[_0x8297('0xe1')](_0x2a52c5);}})[_0x8297('0x24')](function(_0x5debbc){if(_0x5debbc){_0x2327f5=_0x5debbc[_0x8297('0x4e')];if(!_0x272461[_0x8297('0x49')][_0x8297('0x70')](_0x8297('0x6c'))){_0x2a52c5['limit']=qs['limit'](_0x272461['query'][_0x8297('0x34')]);_0x2a52c5[_0x8297('0x33')]=qs[_0x8297('0x33')](_0x272461['query'][_0x8297('0x33')]);}return _0x355ed6[_0x8297('0xe1')](_0x2a52c5);}})['then'](function(_0x274b90){if(_0x274b90){return _0x274b90?{'count':_0x2327f5,'rows':_0x274b90}:null;}})['then'](respondWithResult(_0x2374f8,null))[_0x8297('0x2f')](handleError(_0x2374f8,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index f7d8b93..982c2a7 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 _0x725e=['emit','hasOwnProperty','hook','exports','SmsAccount','setMaxListeners','update'];(function(_0x4a96ef,_0x5c1383){var _0x330714=function(_0x1bc221){while(--_0x1bc221){_0x4a96ef['push'](_0x4a96ef['shift']());}};_0x330714(++_0x5c1383);}(_0x725e,0x1ee));var _0xe725=function(_0x2f21ad,_0x5a2d09){_0x2f21ad=_0x2f21ad-0x0;var _0x3f56d3=_0x725e[_0x2f21ad];return _0x3f56d3;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0xe725('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe725('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe725('0x2'),'afterDestroy':'remove'};function emitEvent(_0x46f8f0){return function(_0x2cd64b,_0x30a1d6,_0x5b74e7){SmsAccountEvents['emit'](_0x46f8f0+':'+_0x2cd64b['id'],_0x2cd64b);SmsAccountEvents[_0xe725('0x3')](_0x46f8f0,_0x2cd64b);_0x5b74e7(null);};}for(var e in events){if(events[_0xe725('0x4')](e)){var event=events[e];SmsAccount[_0xe725('0x5')](e,emitEvent(event));}}module[_0xe725('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x6993=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x1974a1,_0x347db8){var _0x415789=function(_0x325524){while(--_0x325524){_0x1974a1['push'](_0x1974a1['shift']());}};_0x415789(++_0x347db8);}(_0x6993,0x8c));var _0x3699=function(_0x4ddfe9,_0x11daa8){_0x4ddfe9=_0x4ddfe9-0x0;var _0xb09fb7=_0x6993[_0x4ddfe9];return _0xb09fb7;};'use strict';var EventEmitter=require(_0x3699('0x0'));var SmsAccount=require(_0x3699('0x1'))['db'][_0x3699('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3699('0x3')](0x0);var events={'afterCreate':_0x3699('0x4'),'afterUpdate':_0x3699('0x5'),'afterDestroy':_0x3699('0x6')};function emitEvent(_0x47ee99){return function(_0x32e8ad,_0x1218a9,_0x556e08){SmsAccountEvents[_0x3699('0x7')](_0x47ee99+':'+_0x32e8ad['id'],_0x32e8ad);SmsAccountEvents[_0x3699('0x7')](_0x47ee99,_0x32e8ad);_0x556e08(null);};}for(var e in events){if(events[_0x3699('0x8')](e)){var event=events[e];SmsAccount[_0x3699('0x9')](e,emitEvent(event));}}module[_0x3699('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 83edbad..f6f8885 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 _0xa55c=['api','request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger'];(function(_0x388da2,_0x571cad){var _0x2b1a45=function(_0x10f0e2){while(--_0x10f0e2){_0x388da2['push'](_0x388da2['shift']());}};_0x2b1a45(++_0x571cad);}(_0xa55c,0x69));var _0xca55=function(_0x2d5d40,_0x4e4f9c){_0x2d5d40=_0x2d5d40-0x0;var _0x489833=_0xa55c[_0x2d5d40];return _0x489833;};'use strict';var _=require(_0xca55('0x0'));var util=require(_0xca55('0x1'));var logger=require(_0xca55('0x2'))(_0xca55('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca55('0x4'));var fs=require('fs');var path=require(_0xca55('0x5'));var rimraf=require(_0xca55('0x6'));var config=require('../../config/environment');var attributes=require(_0xca55('0x7'));module[_0xca55('0x8')]=function(_0x20701f,_0x1ff8e9){return _0x20701f[_0xca55('0x9')](_0xca55('0xa'),attributes,{'tableName':_0xca55('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac1=['moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','sms_accounts','lodash','util','../../config/logger'];(function(_0x125597,_0x1d5ddd){var _0x5a6818=function(_0x4943f5){while(--_0x4943f5){_0x125597['push'](_0x125597['shift']());}};_0x5a6818(++_0x1d5ddd);}(_0x0ac1,0x1b5));var _0x10ac=function(_0x4ed0d5,_0x46b064){_0x4ed0d5=_0x4ed0d5-0x0;var _0x2dded9=_0x0ac1[_0x4ed0d5];return _0x2dded9;};'use strict';var _=require(_0x10ac('0x0'));var util=require(_0x10ac('0x1'));var logger=require(_0x10ac('0x2'))('api');var moment=require(_0x10ac('0x3'));var BPromise=require('bluebird');var rp=require(_0x10ac('0x4'));var fs=require('fs');var path=require(_0x10ac('0x5'));var rimraf=require(_0x10ac('0x6'));var config=require(_0x10ac('0x7'));var attributes=require(_0x10ac('0x8'));module[_0x10ac('0x9')]=function(_0x5e0bd7,_0x4d5972){return _0x5e0bd7['define']('SmsAccount',attributes,{'tableName':_0x10ac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 783af49..944ec2c 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 _0xc036=['catch','SmsAccount','find','options','where','attributes','map','include','model','ShowSmsAccount','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5b4801,_0x5a2209){var _0x512826=function(_0xfd44eb){while(--_0xfd44eb){_0x5b4801['push'](_0x5b4801['shift']());}};_0x512826(++_0x5a2209);}(_0xc036,0x15e));var _0x6c03=function(_0xa4a9b3,_0x3b271c){_0xa4a9b3=_0xa4a9b3-0x0;var _0xb7a49e=_0xc036[_0xa4a9b3];return _0xb7a49e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6c03('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c03('0x1'));var db=require(_0x6c03('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c03('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c03('0x4'));var client=jayson[_0x6c03('0x5')][_0x6c03('0x6')]({'port':0x232a});config[_0x6c03('0x7')]=_[_0x6c03('0x8')](config[_0x6c03('0x7')],{'host':_0x6c03('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c03('0x7')]));require(_0x6c03('0xa'))[_0x6c03('0xb')](socket);function respondWithRpcPromise(_0x5ae37f,_0x5b30fa,_0x29384b){return new BPromise(function(_0xa834f1,_0xef46c9){return client[_0x6c03('0xc')](_0x5ae37f,_0x29384b)[_0x6c03('0xd')](function(_0x13783e){logger[_0x6c03('0xe')](_0x6c03('0xf'),_0x5b30fa,_0x6c03('0x10'));logger[_0x6c03('0x11')](_0x6c03('0x12'),_0x5b30fa,_0x6c03('0x10'),JSON[_0x6c03('0x13')](_0x13783e));if(_0x13783e[_0x6c03('0x14')]){if(_0x13783e[_0x6c03('0x14')][_0x6c03('0x15')]===0x1f4){logger['error'](_0x6c03('0xf'),_0x5b30fa,_0x13783e[_0x6c03('0x14')][_0x6c03('0x16')]);return _0xef46c9(_0x13783e[_0x6c03('0x14')][_0x6c03('0x16')]);}logger['error'](_0x6c03('0xf'),_0x5b30fa,_0x13783e[_0x6c03('0x14')][_0x6c03('0x16')]);return _0xa834f1(_0x13783e[_0x6c03('0x14')][_0x6c03('0x16')]);}else{logger['info'](_0x6c03('0xf'),_0x5b30fa,_0x6c03('0x10'));_0xa834f1(_0x13783e[_0x6c03('0x17')][_0x6c03('0x16')]);}})[_0x6c03('0x18')](function(_0x4cf608){logger[_0x6c03('0x14')]('SmsAccount,\x20%s,\x20%s',_0x5b30fa,_0x4cf608);_0xef46c9(_0x4cf608);});});}exports['ShowSmsAccount']=function(_0x24f4b3){var _0x49e8cd=this;return new Promise(function(_0x337d70,_0x2b3bb0){return db[_0x6c03('0x19')][_0x6c03('0x1a')]({'raw':_0x24f4b3['options']?_0x24f4b3[_0x6c03('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x24f4b3[_0x6c03('0x1b')]?_0x24f4b3[_0x6c03('0x1b')][_0x6c03('0x1c')]||null:null,'attributes':_0x24f4b3['options']?_0x24f4b3['options'][_0x6c03('0x1d')]||null:null,'include':_0x24f4b3[_0x6c03('0x1b')]?_0x24f4b3[_0x6c03('0x1b')]['include']?_[_0x6c03('0x1e')](_0x24f4b3[_0x6c03('0x1b')][_0x6c03('0x1f')],function(_0x3de394){return{'model':db[_0x3de394[_0x6c03('0x20')]],'as':_0x3de394['as'],'attributes':_0x3de394[_0x6c03('0x1d')],'include':_0x3de394['include']?_['map'](_0x3de394[_0x6c03('0x1f')],function(_0x3c9010){return{'model':db[_0x3c9010[_0x6c03('0x20')]],'as':_0x3c9010['as'],'attributes':_0x3c9010[_0x6c03('0x1d')],'include':_0x3c9010[_0x6c03('0x1f')]?_['map'](_0x3c9010[_0x6c03('0x1f')],function(_0x53d084){return{'model':db[_0x53d084['model']],'as':_0x53d084['as'],'attributes':_0x53d084['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23aa10){logger['info'](_0x6c03('0x21'),_0x24f4b3);logger[_0x6c03('0x11')](_0x6c03('0x21'),_0x24f4b3,JSON[_0x6c03('0x13')](_0x23aa10));_0x337d70(_0x23aa10);})[_0x6c03('0x18')](function(_0x2a864b){logger[_0x6c03('0x14')](_0x6c03('0x21'),_0x2a864b[_0x6c03('0x16')],_0x24f4b3);_0x2b3bb0(_0x49e8cd['error'](0x1f4,_0x2a864b[_0x6c03('0x16')]));});});}; \ No newline at end of file +var _0x1f3d=['http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','SmsAccount','find','options','raw','where','include','map','attributes','model','info','ShowSmsAccount','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x200369,_0xb474c8){var _0x27c28b=function(_0x3d52af){while(--_0x3d52af){_0x200369['push'](_0x200369['shift']());}};_0x27c28b(++_0xb474c8);}(_0x1f3d,0x9f));var _0xd1f3=function(_0xc9f771,_0x30c926){_0xc9f771=_0xc9f771-0x0;var _0x2cb728=_0x1f3d[_0xc9f771];return _0x2cb728;};'use strict';var _=require(_0xd1f3('0x0'));var util=require(_0xd1f3('0x1'));var moment=require(_0xd1f3('0x2'));var BPromise=require(_0xd1f3('0x3'));var rs=require(_0xd1f3('0x4'));var fs=require('fs');var Redis=require(_0xd1f3('0x5'));var db=require(_0xd1f3('0x6'))['db'];var utils=require(_0xd1f3('0x7'));var logger=require(_0xd1f3('0x8'))(_0xd1f3('0x9'));var config=require(_0xd1f3('0xa'));var jayson=require(_0xd1f3('0xb'));var client=jayson[_0xd1f3('0xc')][_0xd1f3('0xd')]({'port':0x232a});config[_0xd1f3('0xe')]=_[_0xd1f3('0xf')](config['redis'],{'host':_0xd1f3('0x10'),'port':0x18eb});var socket=require(_0xd1f3('0x11'))(new Redis(config['redis']));require(_0xd1f3('0x12'))[_0xd1f3('0x13')](socket);function respondWithRpcPromise(_0x370634,_0x442141,_0x59e19c){return new BPromise(function(_0x4766fc,_0x25220a){return client[_0xd1f3('0x14')](_0x370634,_0x59e19c)[_0xd1f3('0x15')](function(_0x4c313b){logger['info'](_0xd1f3('0x16'),_0x442141,_0xd1f3('0x17'));logger[_0xd1f3('0x18')](_0xd1f3('0x19'),_0x442141,_0xd1f3('0x17'),JSON['stringify'](_0x4c313b));if(_0x4c313b['error']){if(_0x4c313b[_0xd1f3('0x1a')][_0xd1f3('0x1b')]===0x1f4){logger[_0xd1f3('0x1a')](_0xd1f3('0x16'),_0x442141,_0x4c313b[_0xd1f3('0x1a')][_0xd1f3('0x1c')]);return _0x25220a(_0x4c313b['error'][_0xd1f3('0x1c')]);}logger[_0xd1f3('0x1a')](_0xd1f3('0x16'),_0x442141,_0x4c313b[_0xd1f3('0x1a')][_0xd1f3('0x1c')]);return _0x4766fc(_0x4c313b['error'][_0xd1f3('0x1c')]);}else{logger['info'](_0xd1f3('0x16'),_0x442141,_0xd1f3('0x17'));_0x4766fc(_0x4c313b[_0xd1f3('0x1d')][_0xd1f3('0x1c')]);}})['catch'](function(_0x1e812a){logger[_0xd1f3('0x1a')]('SmsAccount,\x20%s,\x20%s',_0x442141,_0x1e812a);_0x25220a(_0x1e812a);});});}exports['ShowSmsAccount']=function(_0x4c549a){var _0x42e35c=this;return new Promise(function(_0x3f69c7,_0x3acaa1){return db[_0xd1f3('0x1e')][_0xd1f3('0x1f')]({'raw':_0x4c549a['options']?_0x4c549a[_0xd1f3('0x20')][_0xd1f3('0x21')]===undefined?!![]:![]:!![],'where':_0x4c549a[_0xd1f3('0x20')]?_0x4c549a[_0xd1f3('0x20')][_0xd1f3('0x22')]||null:null,'attributes':_0x4c549a[_0xd1f3('0x20')]?_0x4c549a[_0xd1f3('0x20')]['attributes']||null:null,'include':_0x4c549a[_0xd1f3('0x20')]?_0x4c549a[_0xd1f3('0x20')][_0xd1f3('0x23')]?_[_0xd1f3('0x24')](_0x4c549a['options'][_0xd1f3('0x23')],function(_0x8a0473){return{'model':db[_0x8a0473['model']],'as':_0x8a0473['as'],'attributes':_0x8a0473[_0xd1f3('0x25')],'include':_0x8a0473[_0xd1f3('0x23')]?_[_0xd1f3('0x24')](_0x8a0473[_0xd1f3('0x23')],function(_0x408f59){return{'model':db[_0x408f59[_0xd1f3('0x26')]],'as':_0x408f59['as'],'attributes':_0x408f59[_0xd1f3('0x25')],'include':_0x408f59[_0xd1f3('0x23')]?_[_0xd1f3('0x24')](_0x408f59[_0xd1f3('0x23')],function(_0x236617){return{'model':db[_0x236617[_0xd1f3('0x26')]],'as':_0x236617['as'],'attributes':_0x236617[_0xd1f3('0x25')]};}):[]};}):[]};}):[]:[]})[_0xd1f3('0x15')](function(_0x6a40e6){logger[_0xd1f3('0x27')]('ShowSmsAccount',_0x4c549a);logger[_0xd1f3('0x18')](_0xd1f3('0x28'),_0x4c549a,JSON[_0xd1f3('0x29')](_0x6a40e6));_0x3f69c7(_0x6a40e6);})[_0xd1f3('0x2a')](function(_0x4fca09){logger[_0xd1f3('0x1a')](_0xd1f3('0x28'),_0x4fca09[_0xd1f3('0x1c')],_0x4c549a);_0x3acaa1(_0x42e35c[_0xd1f3('0x1a')](0x1f4,_0x4fca09[_0xd1f3('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index e4e806e..b8b152b 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 f3c5301..2ceca54 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x468bc4,_0x24e709){var _0x5c0ce8=function(_0x33f7ad){while(--_0x33f7ad){_0x468bc4['push'](_0x468bc4['shift']());}};_0x5c0ce8(++_0x24e709);}(_0x008c,0x188));var _0xc008=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0x008c[_0x5e77db];return _0x34b675;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x2fa142,_0x3482d4){var _0x59e5aa=function(_0xeca5a1){while(--_0xeca5a1){_0x2fa142['push'](_0x2fa142['shift']());}};_0x59e5aa(++_0x3482d4);}(_0x55ca,0x126));var _0xa55c=function(_0x141749,_0x477b04){_0x141749=_0x141749-0x0;var _0x3e6932=_0x55ca[_0x141749];return _0x3e6932;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index cbcba06..c0f9b47 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 _0x98e0=['*,*,*,*','sequelize','STRING','noop'];(function(_0x47edc4,_0x550a5d){var _0x159758=function(_0x993c8a){while(--_0x993c8a){_0x47edc4['push'](_0x47edc4['shift']());}};_0x159758(++_0x550a5d);}(_0x98e0,0xa5));var _0x098e=function(_0x1ac3f8,_0x1bc731){_0x1ac3f8=_0x1ac3f8-0x0;var _0x327937=_0x98e0[_0x1ac3f8];return _0x327937;};'use strict';var Sequelize=require(_0x098e('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x098e('0x1')],'allowNull':![],'defaultValue':_0x098e('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x098e('0x1')]},'interval':{'type':Sequelize[_0x098e('0x1')],'defaultValue':_0x098e('0x3')}}; \ No newline at end of file +var _0x19bb=['exports','STRING','sequelize'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x19bb,0xc8));var _0xb19b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x19bb[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb19b('0x0'));module[_0xb19b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb19b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb19b('0x2')]},'interval':{'type':Sequelize[_0xb19b('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 fe02aee..6a971cf 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 _0x7aae=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','findAll','rows','catch','show','params','includeAll','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','SmsApplication','rawAttributes','type','key'];(function(_0x5be52f,_0x24a872){var _0x529c08=function(_0x3d2370){while(--_0x3d2370){_0x5be52f['push'](_0x5be52f['shift']());}};_0x529c08(++_0x24a872);}(_0x7aae,0x14c));var _0xe7aa=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7aae[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xe7aa('0x0'));var rimraf=require(_0xe7aa('0x1'));var zipdir=require(_0xe7aa('0x2'));var jsonpatch=require(_0xe7aa('0x3'));var rp=require('request-promise');var moment=require(_0xe7aa('0x4'));var BPromise=require(_0xe7aa('0x5'));var Mustache=require('mustache');var util=require(_0xe7aa('0x6'));var path=require(_0xe7aa('0x7'));var sox=require(_0xe7aa('0x8'));var csv=require(_0xe7aa('0x9'));var ejs=require(_0xe7aa('0xa'));var fs=require('fs');var fs_extra=require(_0xe7aa('0xb'));var _=require(_0xe7aa('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe7aa('0xd'));var toCsv=require(_0xe7aa('0x9'));var querystring=require(_0xe7aa('0xe'));var Papa=require(_0xe7aa('0xf'));var Redis=require('ioredis');var authService=require(_0xe7aa('0x10'));var qs=require(_0xe7aa('0x11'));var as=require(_0xe7aa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe7aa('0x13'))(_0xe7aa('0x14'));var utils=require(_0xe7aa('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe7aa('0x16'));var db=require(_0xe7aa('0x17'))['db'];function respondWithStatusCode(_0x46b4bb,_0x259002){_0x259002=_0x259002||0xcc;return function(_0x62a688){if(_0x62a688){return _0x46b4bb['sendStatus'](_0x259002);}return _0x46b4bb['status'](_0x259002)[_0xe7aa('0x18')]();};}function respondWithResult(_0x3bc746,_0x49b578){_0x49b578=_0x49b578||0xc8;return function(_0x45ecd1){if(_0x45ecd1){return _0x3bc746['status'](_0x49b578)['json'](_0x45ecd1);}};}function respondWithFilteredResult(_0x353300,_0x355f4b){return function(_0x1c5c9b){if(_0x1c5c9b){var _0x4529cf=typeof _0x355f4b[_0xe7aa('0x19')]===_0xe7aa('0x1a')&&typeof _0x355f4b[_0xe7aa('0x1b')]==='undefined';var _0x312e64=_0x1c5c9b[_0xe7aa('0x1c')];var _0x5c5242=_0x4529cf?0x0:_0x355f4b[_0xe7aa('0x19')];var _0x46610c=_0x4529cf?_0x1c5c9b['count']:_0x355f4b[_0xe7aa('0x19')]+_0x355f4b['limit'];var _0x638431;if(_0x46610c>=_0x312e64){_0x46610c=_0x312e64;_0x638431=0xc8;}else{_0x638431=0xce;}_0x353300[_0xe7aa('0x1d')](_0x638431);return _0x353300['set'](_0xe7aa('0x1e'),_0x5c5242+'-'+_0x46610c+'/'+_0x312e64)[_0xe7aa('0x1f')](_0x1c5c9b);}return null;};}function patchUpdates(_0x3bd64c){return function(_0x374206){try{jsonpatch[_0xe7aa('0x20')](_0x374206,_0x3bd64c,!![]);}catch(_0x30e8ab){return BPromise[_0xe7aa('0x21')](_0x30e8ab);}return _0x374206[_0xe7aa('0x22')]();};}function saveUpdates(_0x35e314,_0xc0c1cd){return function(_0xccd9cb){if(_0xccd9cb){return _0xccd9cb[_0xe7aa('0x23')](_0x35e314)['then'](function(_0x111beb){return _0x111beb;});}return null;};}function removeEntity(_0x114731,_0x1cc349){return function(_0x4320ba){if(_0x4320ba){return _0x4320ba[_0xe7aa('0x24')]()[_0xe7aa('0x25')](function(){_0x114731[_0xe7aa('0x1d')](0xcc)[_0xe7aa('0x18')]();});}};}function handleEntityNotFound(_0xd51e9,_0x2470cf){return function(_0x553da3){if(!_0x553da3){_0xd51e9[_0xe7aa('0x26')](0x194);}return _0x553da3;};}function handleError(_0xe55a79,_0x25b2cb){_0x25b2cb=_0x25b2cb||0x1f4;return function(_0x2ab1d2){logger[_0xe7aa('0x27')](_0x2ab1d2[_0xe7aa('0x28')]);if(_0x2ab1d2[_0xe7aa('0x29')]){delete _0x2ab1d2[_0xe7aa('0x29')];}_0xe55a79[_0xe7aa('0x1d')](_0x25b2cb)[_0xe7aa('0x2a')](_0x2ab1d2);};}exports[_0xe7aa('0x2b')]=function(_0x4c8221,_0x374b6f){var _0x5f1a07={},_0x26a55f={},_0x416ca3={'count':0x0,'rows':[]};var _0x5b6687=_['map'](db[_0xe7aa('0x2c')][_0xe7aa('0x2d')],function(_0x4a5ed4){return{'name':_0x4a5ed4['fieldName'],'type':_0x4a5ed4[_0xe7aa('0x2e')][_0xe7aa('0x2f')]};});_0x26a55f[_0xe7aa('0x30')]=_['map'](_0x5b6687,_0xe7aa('0x29'));_0x26a55f[_0xe7aa('0x31')]=_[_0xe7aa('0x32')](_0x4c8221[_0xe7aa('0x31')]);_0x26a55f[_0xe7aa('0x33')]=_[_0xe7aa('0x34')](_0x26a55f['model'],_0x26a55f['query']);_0x5f1a07['attributes']=_[_0xe7aa('0x34')](_0x26a55f['model'],qs[_0xe7aa('0x35')](_0x4c8221[_0xe7aa('0x31')][_0xe7aa('0x35')]));_0x5f1a07[_0xe7aa('0x36')]=_0x5f1a07['attributes'][_0xe7aa('0x37')]?_0x5f1a07[_0xe7aa('0x36')]:_0x26a55f[_0xe7aa('0x30')];if(!_0x4c8221['query'][_0xe7aa('0x38')](_0xe7aa('0x39'))){_0x5f1a07[_0xe7aa('0x1b')]=qs[_0xe7aa('0x1b')](_0x4c8221[_0xe7aa('0x31')][_0xe7aa('0x1b')]);_0x5f1a07[_0xe7aa('0x19')]=qs[_0xe7aa('0x19')](_0x4c8221[_0xe7aa('0x31')]['offset']);}_0x5f1a07[_0xe7aa('0x3a')]=qs['sort'](_0x4c8221[_0xe7aa('0x31')][_0xe7aa('0x3b')]);_0x5f1a07[_0xe7aa('0x3c')]=qs[_0xe7aa('0x33')](_[_0xe7aa('0x3d')](_0x4c8221[_0xe7aa('0x31')],_0x26a55f[_0xe7aa('0x33')]),_0x5b6687);if(_0x4c8221['query'][_0xe7aa('0x3e')]){_0x5f1a07[_0xe7aa('0x3c')]=_[_0xe7aa('0x3f')](_0x5f1a07['where'],{'$or':_[_0xe7aa('0x40')](_0x5b6687,function(_0x5b3405){if(_0x5b3405[_0xe7aa('0x2e')]!=='VIRTUAL'){var _0x1b9755={};_0x1b9755[_0x5b3405[_0xe7aa('0x29')]]={'$like':'%'+_0x4c8221['query']['filter']+'%'};return _0x1b9755;}})});}_0x5f1a07=_[_0xe7aa('0x3f')]({},_0x5f1a07,_0x4c8221[_0xe7aa('0x41')]);var _0x195889={'where':_0x5f1a07['where']};return db[_0xe7aa('0x2c')][_0xe7aa('0x1c')](_0x195889)[_0xe7aa('0x25')](function(_0x4d0076){_0x416ca3[_0xe7aa('0x1c')]=_0x4d0076;if(_0x4c8221[_0xe7aa('0x31')]['includeAll']){_0x5f1a07['include']=[{'all':!![]}];}return db[_0xe7aa('0x2c')][_0xe7aa('0x42')](_0x5f1a07);})['then'](function(_0x41c006){_0x416ca3[_0xe7aa('0x43')]=_0x41c006;return _0x416ca3;})['then'](respondWithFilteredResult(_0x374b6f,_0x5f1a07))[_0xe7aa('0x44')](handleError(_0x374b6f,null));};exports[_0xe7aa('0x45')]=function(_0x173090,_0x12f84f){var _0x103b18={'raw':!![],'where':{'id':_0x173090[_0xe7aa('0x46')]['id']}},_0x3b83e5={};_0x3b83e5[_0xe7aa('0x30')]=_['keys'](db['SmsApplication'][_0xe7aa('0x2d')]);_0x3b83e5[_0xe7aa('0x31')]=_[_0xe7aa('0x32')](_0x173090['query']);_0x3b83e5[_0xe7aa('0x33')]=_['intersection'](_0x3b83e5[_0xe7aa('0x30')],_0x3b83e5[_0xe7aa('0x31')]);_0x103b18['attributes']=_[_0xe7aa('0x34')](_0x3b83e5[_0xe7aa('0x30')],qs[_0xe7aa('0x35')](_0x173090['query'][_0xe7aa('0x35')]));_0x103b18[_0xe7aa('0x36')]=_0x103b18[_0xe7aa('0x36')]['length']?_0x103b18['attributes']:_0x3b83e5['model'];if(_0x173090['query'][_0xe7aa('0x47')]){_0x103b18[_0xe7aa('0x48')]=[{'all':!![]}];}_0x103b18=_[_0xe7aa('0x3f')]({},_0x103b18,_0x173090['options']);return db[_0xe7aa('0x2c')]['find'](_0x103b18)[_0xe7aa('0x25')](handleEntityNotFound(_0x12f84f,null))[_0xe7aa('0x25')](respondWithResult(_0x12f84f,null))['catch'](handleError(_0x12f84f,null));};exports[_0xe7aa('0x49')]=function(_0x3334d9,_0x507a01){return db[_0xe7aa('0x2c')][_0xe7aa('0x49')](_0x3334d9[_0xe7aa('0x4a')],{})[_0xe7aa('0x25')](respondWithResult(_0x507a01,0xc9))[_0xe7aa('0x44')](handleError(_0x507a01,null));};exports['update']=function(_0x48e02b,_0x291a87){if(_0x48e02b[_0xe7aa('0x4a')]['id']){delete _0x48e02b[_0xe7aa('0x4a')]['id'];}return db[_0xe7aa('0x2c')][_0xe7aa('0x4b')]({'where':{'id':_0x48e02b[_0xe7aa('0x46')]['id']}})[_0xe7aa('0x25')](handleEntityNotFound(_0x291a87,null))[_0xe7aa('0x25')](saveUpdates(_0x48e02b[_0xe7aa('0x4a')],null))[_0xe7aa('0x25')](respondWithResult(_0x291a87,null))[_0xe7aa('0x44')](handleError(_0x291a87,null));};exports[_0xe7aa('0x24')]=function(_0x1f952f,_0x2671f0){return db[_0xe7aa('0x2c')][_0xe7aa('0x4b')]({'where':{'id':_0x1f952f[_0xe7aa('0x46')]['id']}})[_0xe7aa('0x25')](handleEntityNotFound(_0x2671f0,null))[_0xe7aa('0x25')](removeEntity(_0x2671f0,null))['catch'](handleError(_0x2671f0,null));}; \ No newline at end of file +var _0x0768=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','then','include','rows','show','params','includeAll','find','catch','create','body','rimraf','zip-dir'];(function(_0x1486ce,_0x233c7f){var _0x10a7b2=function(_0xd96f47){while(--_0xd96f47){_0x1486ce['push'](_0x1486ce['shift']());}};_0x10a7b2(++_0x233c7f);}(_0x0768,0x8c));var _0x8076=function(_0xf02002,_0x324f90){_0xf02002=_0xf02002-0x0;var _0x499a8e=_0x0768[_0xf02002];return _0x499a8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8076('0x0'));var zipdir=require(_0x8076('0x1'));var jsonpatch=require(_0x8076('0x2'));var rp=require(_0x8076('0x3'));var moment=require(_0x8076('0x4'));var BPromise=require(_0x8076('0x5'));var Mustache=require(_0x8076('0x6'));var util=require(_0x8076('0x7'));var path=require(_0x8076('0x8'));var sox=require(_0x8076('0x9'));var csv=require(_0x8076('0xa'));var ejs=require(_0x8076('0xb'));var fs=require('fs');var fs_extra=require(_0x8076('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8076('0xd'));var jsforce=require(_0x8076('0xe'));var deskjs=require(_0x8076('0xf'));var toCsv=require(_0x8076('0xa'));var querystring=require('querystring');var Papa=require(_0x8076('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8076('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8076('0x12'));var logger=require('../../config/logger')(_0x8076('0x13'));var utils=require(_0x8076('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8076('0x15'));var db=require(_0x8076('0x16'))['db'];function respondWithStatusCode(_0x1ef256,_0x45031f){_0x45031f=_0x45031f||0xcc;return function(_0x2504fc){if(_0x2504fc){return _0x1ef256[_0x8076('0x17')](_0x45031f);}return _0x1ef256[_0x8076('0x18')](_0x45031f)['end']();};}function respondWithResult(_0x30a9d9,_0xa3690c){_0xa3690c=_0xa3690c||0xc8;return function(_0x26c4f6){if(_0x26c4f6){return _0x30a9d9['status'](_0xa3690c)['json'](_0x26c4f6);}};}function respondWithFilteredResult(_0xea9d21,_0x401c9f){return function(_0x15692d){if(_0x15692d){var _0x584c10=typeof _0x401c9f[_0x8076('0x19')]===_0x8076('0x1a')&&typeof _0x401c9f[_0x8076('0x1b')]===_0x8076('0x1a');var _0x5e05b9=_0x15692d[_0x8076('0x1c')];var _0x542983=_0x584c10?0x0:_0x401c9f[_0x8076('0x19')];var _0x313ce1=_0x584c10?_0x15692d[_0x8076('0x1c')]:_0x401c9f[_0x8076('0x19')]+_0x401c9f['limit'];var _0x1e3b02;if(_0x313ce1>=_0x5e05b9){_0x313ce1=_0x5e05b9;_0x1e3b02=0xc8;}else{_0x1e3b02=0xce;}_0xea9d21[_0x8076('0x18')](_0x1e3b02);return _0xea9d21[_0x8076('0x1d')](_0x8076('0x1e'),_0x542983+'-'+_0x313ce1+'/'+_0x5e05b9)[_0x8076('0x1f')](_0x15692d);}return null;};}function patchUpdates(_0x5918b5){return function(_0x4533fa){try{jsonpatch[_0x8076('0x20')](_0x4533fa,_0x5918b5,!![]);}catch(_0x6f5388){return BPromise['reject'](_0x6f5388);}return _0x4533fa[_0x8076('0x21')]();};}function saveUpdates(_0x38ba3c,_0x266b07){return function(_0x2bf691){if(_0x2bf691){return _0x2bf691[_0x8076('0x22')](_0x38ba3c)['then'](function(_0x2aa8a9){return _0x2aa8a9;});}return null;};}function removeEntity(_0x25c4e4,_0x52b691){return function(_0x479fb2){if(_0x479fb2){return _0x479fb2['destroy']()['then'](function(){_0x25c4e4[_0x8076('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x570d30,_0x4fa164){return function(_0x5ad6f3){if(!_0x5ad6f3){_0x570d30[_0x8076('0x17')](0x194);}return _0x5ad6f3;};}function handleError(_0x371829,_0x418676){_0x418676=_0x418676||0x1f4;return function(_0x32fab2){logger[_0x8076('0x23')](_0x32fab2[_0x8076('0x24')]);if(_0x32fab2[_0x8076('0x25')]){delete _0x32fab2[_0x8076('0x25')];}_0x371829[_0x8076('0x18')](_0x418676)[_0x8076('0x26')](_0x32fab2);};}exports['index']=function(_0xfcd94b,_0x26daa2){var _0x956654={},_0x5022de={},_0x1091c3={'count':0x0,'rows':[]};var _0x1e9e4c=_[_0x8076('0x27')](db[_0x8076('0x28')][_0x8076('0x29')],function(_0x4a91d4){return{'name':_0x4a91d4[_0x8076('0x2a')],'type':_0x4a91d4['type'][_0x8076('0x2b')]};});_0x5022de[_0x8076('0x2c')]=_[_0x8076('0x27')](_0x1e9e4c,_0x8076('0x25'));_0x5022de[_0x8076('0x2d')]=_[_0x8076('0x2e')](_0xfcd94b[_0x8076('0x2d')]);_0x5022de['filters']=_[_0x8076('0x2f')](_0x5022de[_0x8076('0x2c')],_0x5022de['query']);_0x956654[_0x8076('0x30')]=_[_0x8076('0x2f')](_0x5022de[_0x8076('0x2c')],qs[_0x8076('0x31')](_0xfcd94b[_0x8076('0x2d')]['fields']));_0x956654[_0x8076('0x30')]=_0x956654[_0x8076('0x30')][_0x8076('0x32')]?_0x956654[_0x8076('0x30')]:_0x5022de['model'];if(!_0xfcd94b['query'][_0x8076('0x33')](_0x8076('0x34'))){_0x956654[_0x8076('0x1b')]=qs[_0x8076('0x1b')](_0xfcd94b[_0x8076('0x2d')][_0x8076('0x1b')]);_0x956654['offset']=qs['offset'](_0xfcd94b['query']['offset']);}_0x956654[_0x8076('0x35')]=qs['sort'](_0xfcd94b[_0x8076('0x2d')][_0x8076('0x36')]);_0x956654['where']=qs[_0x8076('0x37')](_[_0x8076('0x38')](_0xfcd94b[_0x8076('0x2d')],_0x5022de[_0x8076('0x37')]),_0x1e9e4c);if(_0xfcd94b[_0x8076('0x2d')][_0x8076('0x39')]){_0x956654[_0x8076('0x3a')]=_[_0x8076('0x3b')](_0x956654[_0x8076('0x3a')],{'$or':_[_0x8076('0x27')](_0x1e9e4c,function(_0x44c1b6){if(_0x44c1b6['type']!=='VIRTUAL'){var _0x228c18={};_0x228c18[_0x44c1b6[_0x8076('0x25')]]={'$like':'%'+_0xfcd94b[_0x8076('0x2d')]['filter']+'%'};return _0x228c18;}})});}_0x956654=_[_0x8076('0x3b')]({},_0x956654,_0xfcd94b[_0x8076('0x3c')]);var _0x5fa425={'where':_0x956654[_0x8076('0x3a')]};return db[_0x8076('0x28')][_0x8076('0x1c')](_0x5fa425)[_0x8076('0x3d')](function(_0x4c7842){_0x1091c3[_0x8076('0x1c')]=_0x4c7842;if(_0xfcd94b[_0x8076('0x2d')]['includeAll']){_0x956654[_0x8076('0x3e')]=[{'all':!![]}];}return db[_0x8076('0x28')]['findAll'](_0x956654);})[_0x8076('0x3d')](function(_0x1173f0){_0x1091c3[_0x8076('0x3f')]=_0x1173f0;return _0x1091c3;})[_0x8076('0x3d')](respondWithFilteredResult(_0x26daa2,_0x956654))['catch'](handleError(_0x26daa2,null));};exports[_0x8076('0x40')]=function(_0x30f5ac,_0xf50aa5){var _0xecfc0e={'raw':!![],'where':{'id':_0x30f5ac[_0x8076('0x41')]['id']}},_0x2e39f0={};_0x2e39f0[_0x8076('0x2c')]=_['keys'](db[_0x8076('0x28')][_0x8076('0x29')]);_0x2e39f0[_0x8076('0x2d')]=_[_0x8076('0x2e')](_0x30f5ac[_0x8076('0x2d')]);_0x2e39f0[_0x8076('0x37')]=_[_0x8076('0x2f')](_0x2e39f0[_0x8076('0x2c')],_0x2e39f0['query']);_0xecfc0e['attributes']=_[_0x8076('0x2f')](_0x2e39f0[_0x8076('0x2c')],qs['fields'](_0x30f5ac['query'][_0x8076('0x31')]));_0xecfc0e[_0x8076('0x30')]=_0xecfc0e[_0x8076('0x30')][_0x8076('0x32')]?_0xecfc0e[_0x8076('0x30')]:_0x2e39f0[_0x8076('0x2c')];if(_0x30f5ac[_0x8076('0x2d')][_0x8076('0x42')]){_0xecfc0e[_0x8076('0x3e')]=[{'all':!![]}];}_0xecfc0e=_[_0x8076('0x3b')]({},_0xecfc0e,_0x30f5ac[_0x8076('0x3c')]);return db[_0x8076('0x28')][_0x8076('0x43')](_0xecfc0e)['then'](handleEntityNotFound(_0xf50aa5,null))['then'](respondWithResult(_0xf50aa5,null))[_0x8076('0x44')](handleError(_0xf50aa5,null));};exports[_0x8076('0x45')]=function(_0x88297c,_0x2fc1cc){return db[_0x8076('0x28')][_0x8076('0x45')](_0x88297c['body'],{})[_0x8076('0x3d')](respondWithResult(_0x2fc1cc,0xc9))[_0x8076('0x44')](handleError(_0x2fc1cc,null));};exports[_0x8076('0x22')]=function(_0x1da859,_0x420b7a){if(_0x1da859[_0x8076('0x46')]['id']){delete _0x1da859[_0x8076('0x46')]['id'];}return db['SmsApplication'][_0x8076('0x43')]({'where':{'id':_0x1da859[_0x8076('0x41')]['id']}})[_0x8076('0x3d')](handleEntityNotFound(_0x420b7a,null))[_0x8076('0x3d')](saveUpdates(_0x1da859[_0x8076('0x46')],null))[_0x8076('0x3d')](respondWithResult(_0x420b7a,null))[_0x8076('0x44')](handleError(_0x420b7a,null));};exports['destroy']=function(_0x2e0ce6,_0x2941e8){return db['SmsApplication']['find']({'where':{'id':_0x2e0ce6[_0x8076('0x41')]['id']}})['then'](handleEntityNotFound(_0x2941e8,null))[_0x8076('0x3d')](removeEntity(_0x2941e8,null))[_0x8076('0x44')](handleError(_0x2941e8,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c664c0d..f8cb957 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 _0x99ce=['bluebird','request-promise','path','rimraf','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x99ce,0x168));var _0xe99c=function(_0x563107,_0x29cd4a){_0x563107=_0x563107-0x0;var _0x4a47ef=_0x99ce[_0x563107];return _0x4a47ef;};'use strict';var _=require(_0xe99c('0x0'));var util=require('util');var logger=require(_0xe99c('0x1'))(_0xe99c('0x2'));var moment=require(_0xe99c('0x3'));var BPromise=require(_0xe99c('0x4'));var rp=require(_0xe99c('0x5'));var fs=require('fs');var path=require(_0xe99c('0x6'));var rimraf=require(_0xe99c('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0xe99c('0x8')]=function(_0x37d978,_0x2f7d1b){return _0x37d978[_0xe99c('0x9')](_0xe99c('0xa'),attributes,{'tableName':_0xe99c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe99c('0xc'),'collate':_0xe99c('0xd')});}; \ No newline at end of file +var _0xc8b5=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x2420a5,_0x1adb51){var _0x1d3923=function(_0x1717e5){while(--_0x1717e5){_0x2420a5['push'](_0x2420a5['shift']());}};_0x1d3923(++_0x1adb51);}(_0xc8b5,0x1bf));var _0x5c8b=function(_0x597393,_0x7e64e8){_0x597393=_0x597393-0x0;var _0x705d44=_0xc8b5[_0x597393];return _0x705d44;};'use strict';var _=require('lodash');var util=require(_0x5c8b('0x0'));var logger=require(_0x5c8b('0x1'))(_0x5c8b('0x2'));var moment=require(_0x5c8b('0x3'));var BPromise=require(_0x5c8b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5c8b('0x5'));var config=require(_0x5c8b('0x6'));var attributes=require(_0x5c8b('0x7'));module[_0x5c8b('0x8')]=function(_0xa61840,_0xc1d723){return _0xa61840[_0x5c8b('0x9')](_0x5c8b('0xa'),attributes,{'tableName':_0x5c8b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5c8b('0xc'),'collate':_0x5c8b('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4f51d4f..bae58a8 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 _0x1399=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','SmsApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3e0ba7,_0x354fcb){var _0x4ceb9d=function(_0xebbdac){while(--_0xebbdac){_0x3e0ba7['push'](_0x3e0ba7['shift']());}};_0x4ceb9d(++_0x354fcb);}(_0x1399,0x16c));var _0x9139=function(_0x533db2,_0x5613ba){_0x533db2=_0x533db2-0x0;var _0x9e98f9=_0x1399[_0x533db2];return _0x9e98f9;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11d2ed,_0x4d5d1e,_0x51832d){return new BPromise(function(_0x11a03f,_0x59aec5){return client['request'](_0x11d2ed,_0x51832d)[_0x9139('0xa')](function(_0x385e2c){logger['info'](_0x9139('0xb'),_0x4d5d1e,_0x9139('0xc'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x4d5d1e,_0x9139('0xc'),JSON[_0x9139('0xd')](_0x385e2c));if(_0x385e2c[_0x9139('0xe')]){if(_0x385e2c[_0x9139('0xe')][_0x9139('0xf')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4d5d1e,_0x385e2c['error'][_0x9139('0x10')]);return _0x59aec5(_0x385e2c['error'][_0x9139('0x10')]);}logger[_0x9139('0xe')](_0x9139('0xb'),_0x4d5d1e,_0x385e2c[_0x9139('0xe')]['message']);return _0x11a03f(_0x385e2c[_0x9139('0xe')]['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x4d5d1e,_0x9139('0xc'));_0x11a03f(_0x385e2c[_0x9139('0x11')][_0x9139('0x10')]);}})[_0x9139('0x12')](function(_0x18801b){logger[_0x9139('0xe')]('SmsApplication,\x20%s,\x20%s',_0x4d5d1e,_0x18801b);_0x59aec5(_0x18801b);});});} \ No newline at end of file +var _0x6dc0=['rpc','../../config/environment','client','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2193ec,_0x4070dd){var _0x589be1=function(_0x5b9bd7){while(--_0x5b9bd7){_0x2193ec['push'](_0x2193ec['shift']());}};_0x589be1(++_0x4070dd);}(_0x6dc0,0xb6));var _0x06dc=function(_0x4f5a01,_0x590de4){_0x4f5a01=_0x4f5a01-0x0;var _0x3c882a=_0x6dc0[_0x4f5a01];return _0x3c882a;};'use strict';var _=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var moment=require(_0x06dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x06dc('0x3'));var fs=require('fs');var Redis=require(_0x06dc('0x4'));var db=require(_0x06dc('0x5'))['db'];var utils=require(_0x06dc('0x6'));var logger=require('../../config/logger')(_0x06dc('0x7'));var config=require(_0x06dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x419534,_0x3212ca,_0x14c15b){return new BPromise(function(_0x10e23b,_0x140eef){return client['request'](_0x419534,_0x14c15b)['then'](function(_0x480f30){logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,'request\x20sent');logger[_0x06dc('0xc')](_0x06dc('0xd'),_0x3212ca,_0x06dc('0xe'),JSON[_0x06dc('0xf')](_0x480f30));if(_0x480f30['error']){if(_0x480f30[_0x06dc('0x10')][_0x06dc('0x11')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x3212ca,_0x480f30['error']['message']);return _0x140eef(_0x480f30[_0x06dc('0x10')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x3212ca,_0x480f30[_0x06dc('0x10')][_0x06dc('0x12')]);return _0x10e23b(_0x480f30[_0x06dc('0x10')]['message']);}else{logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,_0x06dc('0xe'));_0x10e23b(_0x480f30[_0x06dc('0x13')]['message']);}})[_0x06dc('0x14')](function(_0x30c1c5){logger[_0x06dc('0x10')](_0x06dc('0xb'),_0x3212ca,_0x30c1c5);_0x140eef(_0x30c1c5);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 04677d0..7b34410 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 _0x36ee=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','sms','smsinteraction:update','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x52e28d,_0x4f0959){var _0x3946d7=function(_0x24d525){while(--_0x24d525){_0x52e28d['push'](_0x52e28d['shift']());}};_0x3946d7(++_0x4f0959);}(_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('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x13')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router['post'](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x13')]('/:id/tags',auth[_0xe36e('0x9')](),interaction['tracked']('sms',_0xe36e('0x16')),controller[_0xe36e('0x17')]);router[_0xe36e('0x18')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')](_0xe36e('0x1a'),_0xe36e('0x1b')),controller[_0xe36e('0x1c')]);router[_0xe36e('0x1d')]('/:id',auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')]('sms',_0xe36e('0x1e')),controller['destroy']);router[_0xe36e('0x1d')](_0xe36e('0x1f'),auth['isAuthenticated'](),controller[_0xe36e('0x20')]);module[_0xe36e('0x21')]=router; \ No newline at end of file +var _0xb7e7=['download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb7e7[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x12')]('/:id/messages',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x17')),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x1a')),controller[_0x7b7e('0x1b')]);router[_0x7b7e('0x1c')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x1d')](_0x7b7e('0x16'),_0x7b7e('0x1e')),controller[_0x7b7e('0x1f')]);router[_0x7b7e('0x1c')](_0x7b7e('0x15'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x20')]);module[_0x7b7e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 0b603b2..d001211 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 _0x8c32=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x2a7210,_0x2f3d23){var _0x460766=function(_0xd575dd){while(--_0xd575dd){_0x2a7210['push'](_0x2a7210['shift']());}};_0x460766(++_0x2f3d23);}(_0x8c32,0x130));var _0x28c3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c32[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x28c3('0x0'));var moment=require(_0x28c3('0x1'));module[_0x28c3('0x2')]={'closed':{'type':Sequelize[_0x28c3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x28c3('0x4')]},'disposition':{'type':Sequelize[_0x28c3('0x5')]},'secondDisposition':{'type':Sequelize[_0x28c3('0x5')]},'thirdDisposition':{'type':Sequelize[_0x28c3('0x5')]},'note':{'type':Sequelize[_0x28c3('0x5')]},'phone':{'type':Sequelize[_0x28c3('0x5')]},'read1stAt':{'type':Sequelize[_0x28c3('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x28c3('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x28c3('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x28c3('0x6')]('in',_0x28c3('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x28c3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe0ae=['BOOLEAN','STRING','DATE','ENUM','out','exports'];(function(_0x3ab503,_0x182a2e){var _0xc71c1c=function(_0x299e96){while(--_0x299e96){_0x3ab503['push'](_0x3ab503['shift']());}};_0xc71c1c(++_0x182a2e);}(_0xe0ae,0xa1));var _0xee0a=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0xe0ae[_0x31991b];return _0x307304;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xee0a('0x0')]={'closed':{'type':Sequelize[_0xee0a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xee0a('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xee0a('0x2')]},'note':{'type':Sequelize[_0xee0a('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xee0a('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xee0a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xee0a('0x4')]('in',_0xee0a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xee0a('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index b0792e0..042e6e9 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 _0x556d=['type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','catch','show','params','include','create','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','Messages','direction','secret','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','closedAt','disposition','out','System','firstName','lastName','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','then','waiting','talking','answered','unmanaged','total','UserId','closed','index','SmsInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','select','field','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression'];(function(_0x235d52,_0x481f71){var _0x56a0fd=function(_0x19ce4b){while(--_0x19ce4b){_0x235d52['push'](_0x235d52['shift']());}};_0x56a0fd(++_0x481f71);}(_0x556d,0x83));var _0xd556=function(_0x454ff3,_0x5e1dec){_0x454ff3=_0x454ff3-0x0;var _0xe48eaa=_0x556d[_0x454ff3];return _0xe48eaa;};'use strict';var emlformat=require(_0xd556('0x0'));var rimraf=require(_0xd556('0x1'));var zipdir=require(_0xd556('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd556('0x3'));var moment=require(_0xd556('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd556('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd556('0x6'));var csv=require(_0xd556('0x7'));var ejs=require(_0xd556('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd556('0x9'));var squel=require('squel');var crypto=require(_0xd556('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd556('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd556('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xd556('0xd'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd556('0xe'))(_0xd556('0xf'));var utils=require('../../config/utils');var config=require(_0xd556('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd556('0x11')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd556('0x11')]));require(_0xd556('0x12'))[_0xd556('0x13')](socket);function respondWithStatusCode(_0x2b2a46,_0x18282f){_0x18282f=_0x18282f||0xcc;return function(_0x3553fc){if(_0x3553fc){return _0x2b2a46[_0xd556('0x14')](_0x18282f);}return _0x2b2a46[_0xd556('0x15')](_0x18282f)[_0xd556('0x16')]();};}function respondWithResult(_0x560a3e,_0x5a3a79){_0x5a3a79=_0x5a3a79||0xc8;return function(_0x1e1514){if(_0x1e1514){return _0x560a3e[_0xd556('0x15')](_0x5a3a79)[_0xd556('0x17')](_0x1e1514);}};}function respondWithFilteredResult(_0x4b586d,_0x5c5371){return function(_0x3b4d26){if(_0x3b4d26){var _0x2a7eaa=typeof _0x5c5371[_0xd556('0x18')]===_0xd556('0x19')&&typeof _0x5c5371[_0xd556('0x1a')]==='undefined';var _0x9fb511=_0x3b4d26['count'];var _0x4a8903=_0x2a7eaa?0x0:_0x5c5371[_0xd556('0x18')];var _0x5b0e8b=_0x2a7eaa?_0x3b4d26[_0xd556('0x1b')]:_0x5c5371[_0xd556('0x18')]+_0x5c5371['limit'];var _0x25c6f0;if(_0x5b0e8b>=_0x9fb511){_0x5b0e8b=_0x9fb511;_0x25c6f0=0xc8;}else{_0x25c6f0=0xce;}_0x4b586d[_0xd556('0x15')](_0x25c6f0);return _0x4b586d[_0xd556('0x1c')](_0xd556('0x1d'),_0x4a8903+'-'+_0x5b0e8b+'/'+_0x9fb511)['json'](_0x3b4d26);}return null;};}function patchUpdates(_0x4c25f7){return function(_0x3a7c45){try{jsonpatch[_0xd556('0x1e')](_0x3a7c45,_0x4c25f7,!![]);}catch(_0x38a9ae){return BPromise[_0xd556('0x1f')](_0x38a9ae);}return _0x3a7c45[_0xd556('0x20')]();};}function saveUpdates(_0x48d64b,_0x5c1b96){return function(_0x50fa5d){if(_0x50fa5d){return _0x50fa5d[_0xd556('0x21')](_0x48d64b)['then'](function(_0x518f2b){return _0x518f2b;});}return null;};}function removeEntity(_0x54152,_0x51b64e){return function(_0x174a38){if(_0x174a38){return _0x174a38[_0xd556('0x22')]()['then'](function(){_0x54152[_0xd556('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x389066,_0x1c40d2){return function(_0x89db01){if(!_0x89db01){_0x389066['sendStatus'](0x194);}return _0x89db01;};}function handleError(_0x2fd9ea,_0x28a0c8){_0x28a0c8=_0x28a0c8||0x1f4;return function(_0x49635f){logger[_0xd556('0x23')](_0x49635f[_0xd556('0x24')]);if(_0x49635f[_0xd556('0x25')]){delete _0x49635f[_0xd556('0x25')];}_0x2fd9ea[_0xd556('0x15')](_0x28a0c8)[_0xd556('0x26')](_0x49635f);};}function getInteractionUsers(_0x163e5d,_0x2f08cb){return new BPromise(function(_0x539e93,_0x510486){try{if(_0x2f08cb[_0x163e5d['id']]){_0x163e5d[_0xd556('0x27')]=_[_0xd556('0x28')](_0x2f08cb[_0x163e5d['id']],function(_0x13fbec){return{'id':_0x13fbec['id'],'fullname':_0x13fbec[_0xd556('0x29')]};});}}catch(_0x8dcd01){_0x510486(_0x8dcd01);}_0x539e93(_0x163e5d);});}function getInteractionTags(_0x3ae8ca,_0x210385){return new BPromise(function(_0x236381,_0x377871){try{if(_0x3ae8ca[_0xd556('0x2a')]){_0x3ae8ca[_0xd556('0x2b')]=[];_0x3ae8ca[_0xd556('0x2a')][_0xd556('0x2c')](',')[_0xd556('0x2d')](function(_0x2efeeb){_0x3ae8ca['Tags'][_0xd556('0x2e')](_0x210385[_0x2efeeb]);});}delete _0x3ae8ca[_0xd556('0x2a')];}catch(_0x2cfc96){_0x377871(_0x2cfc96);}_0x236381(_0x3ae8ca);});}function updateSmsInteraction(_0xdb97f4,_0x575388,_0x570e92){return new BPromise(function(_0x46874a,_0x577693){return getInteractionUsers(_0xdb97f4,_0x570e92)[_0xd556('0x2f')](function(_0x4852d6){return getInteractionTags(_0x4852d6,_0x575388);})[_0xd556('0x2f')](function(_0x5687fc){return getStateInteraction(_0x5687fc);})[_0xd556('0x2f')](function(_0x3e7faf){_0x46874a(_0x3e7faf);})['catch'](function(_0x180308){_0x577693(_0x180308);});});}function getStateInteraction(_0x3b4722){return new BPromise(function(_0x5c6517){_0x3b4722[_0xd556('0x30')]=0x0;_0x3b4722[_0xd556('0x31')]=0x0;_0x3b4722[_0xd556('0x32')]=0x0;_0x3b4722[_0xd556('0x33')]=0x0;_0x3b4722[_0xd556('0x34')]=0x0;if(!_0x3b4722['closed']&&!_0x3b4722[_0xd556('0x35')]){_0x3b4722[_0xd556('0x30')]+=0x1;}if(!_0x3b4722[_0xd556('0x36')]&&_0x3b4722[_0xd556('0x35')]){_0x3b4722[_0xd556('0x31')]+=0x1;if(_0x3b4722[_0xd556('0x30')]){_0x3b4722[_0xd556('0x30')]-=0x1;}}if(_0x3b4722['closed']&&_0x3b4722['UserId']){_0x3b4722[_0xd556('0x32')]+=0x1;if(_0x3b4722['talking']){_0x3b4722['talking']-=0x1;}}if(_0x3b4722[_0xd556('0x36')]&&!_0x3b4722[_0xd556('0x35')]){_0x3b4722[_0xd556('0x33')]+=0x1;if(_0x3b4722[_0xd556('0x30')]){_0x3b4722['waiting']-=0x1;}}_0x3b4722[_0xd556('0x34')]+=0x1;_0x5c6517(_0x3b4722);});}exports[_0xd556('0x37')]=function(_0x54ada0,_0x3d72d0){var _0x4a7472={},_0x50a547={},_0x4cd680={'count':0x0,'rows':[]};var _0x1eccab=_[_0xd556('0x28')](db[_0xd556('0x38')][_0xd556('0x39')],function(_0x6b077c){return{'name':_0x6b077c[_0xd556('0x3a')],'type':_0x6b077c['type']['key']};});_0x50a547[_0xd556('0x3b')]=_[_0xd556('0x28')](_0x1eccab,'name');_0x50a547[_0xd556('0x3c')]=_[_0xd556('0x3d')](_0x54ada0[_0xd556('0x3c')]);_0x50a547[_0xd556('0x3e')]=_[_0xd556('0x3f')](_0x50a547[_0xd556('0x3b')],_0x50a547[_0xd556('0x3c')]);_0x4a7472[_0xd556('0x40')]=_['intersection'](_0x50a547[_0xd556('0x3b')],qs[_0xd556('0x41')](_0x54ada0[_0xd556('0x3c')]['fields']));_0x4a7472[_0xd556('0x40')]=_0x4a7472[_0xd556('0x40')][_0xd556('0x42')]?_0x4a7472['attributes']:_0x50a547['model'];if(!_0x54ada0[_0xd556('0x3c')]['hasOwnProperty'](_0xd556('0x43'))){_0x4a7472[_0xd556('0x1a')]=qs['limit'](_0x54ada0[_0xd556('0x3c')]['limit']);_0x4a7472[_0xd556('0x18')]=qs['offset'](_0x54ada0[_0xd556('0x3c')][_0xd556('0x18')]);}_0x4a7472[_0xd556('0x44')]=qs[_0xd556('0x45')](_0x54ada0[_0xd556('0x3c')]['sort']);_0x4a7472['where']=qs[_0xd556('0x3e')](_[_0xd556('0x46')](_0x54ada0[_0xd556('0x3c')],_0x50a547['filters']),_0x1eccab);var _0x3da533=[];var _0x5b7d75=squel[_0xd556('0x47')]()[_0xd556('0x48')]('id')[_0xd556('0x48')]('name')[_0xd556('0x48')]('color')[_0xd556('0x49')](_0xd556('0x4a'));var _0xc09ec6=squel[_0xd556('0x47')]()[_0xd556('0x48')](_0xd556('0x4b'))[_0xd556('0x48')]('u.fullname')['field'](_0xd556('0x4c'))[_0xd556('0x49')](_0xd556('0x4d'),'ui')[_0xd556('0x4e')](_0xd556('0x4f'),'u',_0xd556('0x50'));var _0x459f39=squel[_0xd556('0x47')]()[_0xd556('0x49')](_0xd556('0x51'),'i')[_0xd556('0x4e')](_0xd556('0x52'),'c',_0xd556('0x53'))[_0xd556('0x4e')](_0xd556('0x4f'),'o',_0xd556('0x54'))['left_join'](_0xd556('0x55'),'a','a.id\x20=\x20i.SmsAccountId')[_0xd556('0x4e')](_0xd556('0x56'),'me',_0xd556('0x57'))[_0xd556('0x4e')](_0xd556('0x58'),'it',_0xd556('0x59'))[_0xd556('0x4e')](_0xd556('0x4a'),'t',_0xd556('0x5a'));var _0x13b3c1=squel['expr']();var _0x4c2853=[];var _0x2faab0=squel[_0xd556('0x5b')]();var _0x37cbdc;if(_0x54ada0[_0xd556('0x3c')][_0xd556('0x5c')]){_0x37cbdc=as['parseSearch'](_0x54ada0[_0xd556('0x3c')][_0xd556('0x5c')]);var _0x50e723=_0x37cbdc[_0xd556('0x5d')];for(var _0x19ce54=0x0;_0x19ce54<_0x37cbdc[_0xd556('0x5e')][_0xd556('0x42')];_0x19ce54++){var _0x345188=_0x37cbdc[_0xd556('0x5e')][_0x19ce54];var _0x10fde5='i';var _0x5129a2=_['find'](_0x1eccab,[_0xd556('0x25'),_0x345188[_0xd556('0x48')]]);if(!_0x5129a2){switch(_0x345188[_0xd556('0x48')]){case _0xd556('0x5f'):if(_0x345188['value']==0x1){_0x459f39[_0xd556('0x60')]('`'+_0x345188[_0xd556('0x48')]+'`\x20=\x200');}else{_0x459f39[_0xd556('0x60')]('`'+_0x345188[_0xd556('0x48')]+_0xd556('0x61'));}break;case _0xd556('0x62'):if(_0x345188[_0xd556('0x63')]==='$substring'){if(_0x345188[_0xd556('0x64')][_0xd556('0x2c')]('\x20')[_0xd556('0x42')]>0x1){_0x13b3c1[_0x50e723](_0xd556('0x65'),qs['getFullTextValue'](_0x345188[_0xd556('0x64')]),null);}else{var _0x296b29='%'+_0x345188[_0xd556('0x64')]+'%';_0x13b3c1[_0x50e723](_0xd556('0x66'),_0x296b29,_0x296b29,_0x296b29);}}else{_0x5129a2=_[_0xd556('0x67')](_0x1eccab,[_0xd556('0x25'),_0xd556('0x68')]);_0x345188[_0xd556('0x48')]=_0xd556('0x68');_0x22b037=as[_0xd556('0x69')](_0x10fde5,_0x5129a2[_0xd556('0x6a')],_0x345188);_0x13b3c1[_0x50e723](_0x22b037[_0xd556('0x6b')],_0x22b037[_0xd556('0x64')][_0xd556('0x6c')],_0x22b037[_0xd556('0x64')][_0xd556('0x16')]);}break;case'Tag':var _0x570db0=_0x345188[_0xd556('0x64')][_0xd556('0x2c')](',')[_0xd556('0x28')](function(_0x3181aa){return Number(_0x3181aa);});_0x570db0['forEach'](function(_0x481928){_0x2faab0['or'](_0xd556('0x6d'),'%,'+_0x481928+',%');});_0x4c2853=_['union'](_0x4c2853,_0x570db0);break;case _0xd556('0x6e'):if(_0x345188[_0xd556('0x63')]==='$substring'){_0x13b3c1[_0x50e723](_0xd556('0x6f'),'%'+_0x345188[_0xd556('0x64')]+'%',null);}else{_0x5129a2=_['find'](_0x1eccab,[_0xd556('0x25'),_0xd556('0x35')]);_0x345188[_0xd556('0x48')]='UserId';_0x22b037=as[_0xd556('0x69')](_0x10fde5,_0x5129a2[_0xd556('0x6a')],_0x345188);_0x13b3c1[_0x50e723](_0x22b037[_0xd556('0x6b')],_0x22b037[_0xd556('0x64')][_0xd556('0x6c')],_0x22b037['value']['end']);}break;case _0xd556('0x70'):_0x22b037=as[_0xd556('0x69')]('me',null,_0x345188);_0x13b3c1[_0x50e723](_0x22b037[_0xd556('0x6b')],_0x22b037['value'][_0xd556('0x6c')],_0x22b037[_0xd556('0x64')][_0xd556('0x16')]);break;}}else{var _0x22b037=as[_0xd556('0x69')](_0x10fde5,_0x5129a2['type'],_0x345188);_0x13b3c1[_0x50e723](_0x22b037['text'],_0x22b037['value'][_0xd556('0x6c')],_0x22b037[_0xd556('0x64')]['end']);}}}else{var _0x4c68e2=_(_0x54ada0['query'])[_0xd556('0x3d')]()['map'](function(_0x2fa6ad){return _[_0xd556('0x71')](_0x1eccab,[_0xd556('0x25'),_0x2fa6ad])?_0x2fa6ad:undefined;})['compact']()[_0xd556('0x64')]();if(!_[_0xd556('0x72')](_0x4c68e2)){_0x4c68e2['forEach'](function(_0x502fb1){if(_0x502fb1===_0xd556('0x73')){_0x459f39[_0xd556('0x74')](_0xd556('0x75'),[][_0xd556('0x76')](_0x54ada0[_0xd556('0x3c')][_0x502fb1]));}else if(_0x502fb1===_0xd556('0x77')){var _0xa3ce5c=JSON[_0xd556('0x78')](_0x54ada0[_0xd556('0x3c')][_0x502fb1])[_0xd556('0x79')];var _0x15b946=JSON['parse'](_0x54ada0['query'][_0x502fb1])[_0xd556('0x7a')];_0x459f39[_0xd556('0x74')](_0xd556('0x7b'),_0xa3ce5c,_0x15b946);}else{if(_0x54ada0['query'][_0x502fb1]===_0xd556('0x7c')){_0x459f39['where']('i.'+_0x502fb1+_0xd556('0x7d'));}else{_0x459f39[_0xd556('0x74')]('i.'+_0x502fb1+'\x20=\x20?',_0x54ada0['query'][_0x502fb1]);}}});}if(_0x54ada0[_0xd556('0x3c')]['read']){if(_0x54ada0[_0xd556('0x3c')][_0xd556('0x7e')]==0x1){_0x459f39['having'](_0xd556('0x7f'));}else{_0x459f39[_0xd556('0x60')](_0xd556('0x80'));}}if(_0x54ada0['query'][_0xd556('0x81')]){_0x4c2853=_['isArray'](_0x54ada0[_0xd556('0x3c')][_0xd556('0x81')])?_0x54ada0[_0xd556('0x3c')][_0xd556('0x81')]:new Array(_0x54ada0[_0xd556('0x3c')][_0xd556('0x81')]);_0x4c2853[_0xd556('0x2d')](function(_0xf27e2b){_0x2faab0['or'](_0xd556('0x6d'),'%,'+_0xf27e2b+',%');});}if(_0x54ada0[_0xd556('0x3c')][_0xd556('0x82')]){var _0x5e8378=_0x54ada0[_0xd556('0x3c')]['filter'][_0xd556('0x83')]('\x5c','\x5c\x5c')[_0xd556('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5e8378)){_0x13b3c1['or'](_0xd556('0x84'),_0x5e8378+'%')['or']('i.phone\x20LIKE\x20?',_0x5e8378+'%');}else{_0x13b3c1['or'](_0xd556('0x85'),qs[_0xd556('0x86')](_0x5e8378))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5e8378+'%');}}}_0x459f39[_0xd556('0x74')](_0x13b3c1);_0x459f39[_0xd556('0x87')]('i.id');var _0x27370f={'type':db[_0xd556('0x88')][_0xd556('0x89')][_0xd556('0x8a')],'raw':!![]};var _0x4983fa=_0x459f39[_0xd556('0x8b')]();_0x4983fa['field'](_0xd556('0x8c'));_0x4983fa[_0xd556('0x48')](_0xd556('0x8d'),_0xd556('0x5f'));if(_0x4a7472[_0xd556('0x44')]){_0x4a7472[_0xd556('0x44')]['forEach'](function(_0x2038f2){var _0x3b43b4=_0x2038f2[0x0]===_0xd556('0x8e')?_0x2038f2[0x0]:'i.'+_0x2038f2[0x0];_0x459f39['order'](_0x3b43b4,_0x2038f2[0x1]===_0xd556('0x8f')?![]:!![]);});}if(!_[_0xd556('0x72')](_0x4c2853)){_0x459f39[_0xd556('0x60')](_0x2faab0);_0x4983fa[_0xd556('0x74')](_0xd556('0x90'),_0x4c2853);}BPromise['resolve']()['then'](function(){if(!_0x37cbdc){if(_0x54ada0[_0xd556('0x3c')]['SmsAccountId'])return;_0x4983fa[_0xd556('0x74')](_0xd556('0x91'));_0x459f39[_0xd556('0x74')](_0xd556('0x91'));return;}if(_0x54ada0[_0xd556('0x92')][_0xd556('0x93')]!==_0xd556('0x94'))return;return _0x54ada0[_0xd556('0x92')][_0xd556('0x95')]({'attributes':['id'],'raw':!![]})[_0xd556('0x2f')](function(_0x5f5c25){if(_[_0xd556('0x72')](_0x5f5c25)){_0x4983fa[_0xd556('0x74')](_0xd556('0x96'));_0x459f39[_0xd556('0x74')](_0xd556('0x96'));}else{_0x4983fa[_0xd556('0x74')](_0xd556('0x75'),_[_0xd556('0x28')](_0x5f5c25,'id'));_0x459f39['where'](_0xd556('0x75'),_['map'](_0x5f5c25,'id'));}});})[_0xd556('0x2f')](function(){if(_0x54ada0['user'][_0xd556('0x93')]==='agent'&&!_0x37cbdc&&!_0x54ada0[_0xd556('0x3c')][_0xd556('0x73')])return[];return db[_0xd556('0x97')][_0xd556('0x3c')](_0x4983fa[_0xd556('0x98')](),_0x27370f);})[_0xd556('0x2f')](function(_0x314f9e){_0x4cd680[_0xd556('0x1b')]=_0x314f9e[_0xd556('0x42')];if(_0x4cd680[_0xd556('0x1b')]===0x0)return[];return db[_0xd556('0x97')][_0xd556('0x3c')](_0x5b7d75[_0xd556('0x98')](),_0x27370f)[_0xd556('0x2f')](function(_0x595394){_0x3da533=_[_0xd556('0x99')](_0x595394,'id');_0x27370f=_[_0xd556('0x9a')](_0x27370f,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54ada0[_0xd556('0x3c')][_0xd556('0x41')]){_0x4a7472['attributes'][_0xd556('0x2d')](function(_0x50cd3d){_0x459f39['field']('i.'+_0x50cd3d);});}else{_0x459f39[_0xd556('0x48')](_0xd556('0x8d'),_0xd556('0x5f'));_0x459f39[_0xd556('0x48')](_0xd556('0x9b'),'Account.key');_0x459f39[_0xd556('0x48')](_0xd556('0x9c'),_0xd556('0x9d'));_0x459f39['field'](_0xd556('0x9e'),_0xd556('0x8e'));_0x459f39[_0xd556('0x48')](_0xd556('0x9f'));_0x459f39[_0xd556('0x48')](_0xd556('0xa0'),_0xd556('0xa1'));_0x459f39['field'](_0xd556('0xa2'),_0xd556('0xa3'));_0x459f39[_0xd556('0x48')](_0xd556('0xa4'),_0xd556('0xa5'));_0x459f39['field'](_0xd556('0xa6'),_0xd556('0xa7'));_0x459f39[_0xd556('0x48')](_0xd556('0xa8'),'Contact.mobile');_0x459f39[_0xd556('0x48')](_0xd556('0xa9'),_0xd556('0xaa'));_0x459f39[_0xd556('0x48')]('o.fullname',_0xd556('0xab'));_0x459f39[_0xd556('0x48')]('o.internal',_0xd556('0xac'));_0x459f39['field'](_0xd556('0xad'),_0xd556('0x2a'));}if(_0x4a7472[_0xd556('0x1a')])_0x459f39[_0xd556('0x1a')](_0x4a7472['limit']);if(_0x4a7472['offset'])_0x459f39['offset'](_0x4a7472[_0xd556('0x18')]);return db['sequelize']['query'](_0x459f39[_0xd556('0x98')](),_0x27370f);})[_0xd556('0x2f')](function(_0x4253ab){if(_0x4253ab['length']>0x0)_0xc09ec6[_0xd556('0x74')](_0xd556('0xae'),_[_0xd556('0x28')](_0x4253ab,'id'));return db[_0xd556('0x97')][_0xd556('0x3c')](_0xc09ec6[_0xd556('0x98')](),_0x27370f)[_0xd556('0x2f')](function(_0x45ab1e){var _0x50d885=_[_0xd556('0xaf')](_0x45ab1e,_0xd556('0xb0'));var _0x16f313=[];_0x4253ab[_0xd556('0x2d')](function(_0x3c2557){_0x16f313['push'](updateSmsInteraction(_0x3c2557,_0x3da533,_0x50d885));});return BPromise[_0xd556('0xb1')](_0x16f313);});});})[_0xd556('0x2f')](function(_0x1568ca){_0x4cd680[_0xd556('0xb2')]=_0x1568ca;return _0x4cd680;})['then'](respondWithFilteredResult(_0x3d72d0,_0x4a7472))[_0xd556('0xb3')](handleError(_0x3d72d0,null));};exports[_0xd556('0xb4')]=function(_0x3b5ca0,_0x9667ce){var _0x341638={'raw':![],'where':{'id':_0x3b5ca0[_0xd556('0xb5')]['id']}},_0x421f14={};_0x421f14[_0xd556('0x3b')]=_[_0xd556('0x3d')](db[_0xd556('0x38')][_0xd556('0x39')]);_0x421f14[_0xd556('0x3c')]=_[_0xd556('0x3d')](_0x3b5ca0[_0xd556('0x3c')]);_0x421f14[_0xd556('0x3e')]=_[_0xd556('0x3f')](_0x421f14[_0xd556('0x3b')],_0x421f14[_0xd556('0x3c')]);_0x341638['attributes']=_[_0xd556('0x3f')](_0x421f14[_0xd556('0x3b')],qs[_0xd556('0x41')](_0x3b5ca0[_0xd556('0x3c')]['fields']));_0x341638[_0xd556('0x40')]=_0x341638['attributes']['length']?_0x341638['attributes']:_0x421f14[_0xd556('0x3b')];if(_0x3b5ca0['query']['includeAll']){_0x341638[_0xd556('0xb6')]=[{'all':!![]}];}_0x341638=_[_0xd556('0x9a')]({},_0x341638,_0x3b5ca0['options']);return db[_0xd556('0x38')][_0xd556('0x67')](_0x341638)[_0xd556('0x2f')](handleEntityNotFound(_0x9667ce,null))[_0xd556('0x2f')](respondWithResult(_0x9667ce,null))['catch'](handleError(_0x9667ce,null));};exports[_0xd556('0xb7')]=function(_0x82de28,_0x4d4768){return db[_0xd556('0x38')][_0xd556('0xb7')](_0x82de28[_0xd556('0x70')],{})[_0xd556('0x2f')](respondWithResult(_0x4d4768,0xc9))[_0xd556('0xb3')](handleError(_0x4d4768,null));};exports[_0xd556('0x21')]=function(_0x3488c5,_0x4e35c9){if(_0x3488c5[_0xd556('0x70')]['id']){delete _0x3488c5[_0xd556('0x70')]['id'];}return db[_0xd556('0x38')]['find']({'where':{'id':_0x3488c5['params']['id']}})[_0xd556('0x2f')](handleEntityNotFound(_0x4e35c9,null))[_0xd556('0x2f')](saveUpdates(_0x3488c5['body'],null))[_0xd556('0x2f')](respondWithResult(_0x4e35c9,null))[_0xd556('0xb3')](handleError(_0x4e35c9,null));};exports['destroy']=function(_0x45372f,_0x314d0e){return db[_0xd556('0x38')][_0xd556('0x67')]({'where':{'id':_0x45372f[_0xd556('0xb5')]['id']}})['then'](handleEntityNotFound(_0x314d0e,null))['then'](removeEntity(_0x314d0e,null))[_0xd556('0xb3')](handleError(_0x314d0e,null));};exports[_0xd556('0xb8')]=function(_0x4ade3e,_0x4d40ee){return db[_0xd556('0x38')]['describe']()['then'](respondWithResult(_0x4d40ee,null))['catch'](handleError(_0x4d40ee,null));};exports['addMessage']=function(_0x3b40b7,_0x5aa62e,_0x3d3a24){return db[_0xd556('0xb9')][_0xd556('0x67')]({'where':{'id':_0x3b40b7[_0xd556('0xb5')]['id']}})[_0xd556('0x2f')](handleEntityNotFound(_0x5aa62e,null))[_0xd556('0x2f')](function(_0x531426){if(_0x531426){return _0x531426[_0xd556('0xba')](_0x3b40b7[_0xd556('0x70')][_0xd556('0xbb')],_[_0xd556('0xbc')](_0x3b40b7[_0xd556('0x70')],['ids','id'])||{});}})[_0xd556('0x2f')](respondWithResult(_0x5aa62e,null))['catch'](handleError(_0x5aa62e,null));};exports[_0xd556('0xbd')]=function(_0x26c2bc,_0x42c37b,_0xc128a2){var _0x8c42e8={'raw':![],'where':{}};var _0x518a7c={};var _0x380a4f={'count':0x0,'rows':[]};return db[_0xd556('0x38')][_0xd556('0xbe')]({'where':{'id':_0x26c2bc['params']['id']}})[_0xd556('0x2f')](handleEntityNotFound(_0x42c37b,null))['then'](function(_0xf3c3ae){if(_0xf3c3ae){_0x518a7c[_0xd556('0x3b')]=_[_0xd556('0x3d')](db[_0xd556('0xb9')][_0xd556('0x39')]);_0x518a7c[_0xd556('0x3c')]=_[_0xd556('0x3d')](_0x26c2bc[_0xd556('0x3c')]);_0x518a7c[_0xd556('0x3e')]=_[_0xd556('0x3f')](_0x518a7c[_0xd556('0x3b')],_0x518a7c['query']);_0x8c42e8[_0xd556('0x40')]=_[_0xd556('0x3f')](_0x518a7c['model'],qs['fields'](_0x26c2bc[_0xd556('0x3c')][_0xd556('0x41')]));_0x8c42e8[_0xd556('0x40')]=_0x8c42e8[_0xd556('0x40')]['length']?_0x8c42e8['attributes']:_0x518a7c['model'];if(!_0x26c2bc['query'][_0xd556('0xbf')](_0xd556('0x43'))){_0x8c42e8[_0xd556('0x1a')]=qs[_0xd556('0x1a')](_0x26c2bc[_0xd556('0x3c')][_0xd556('0x1a')]);_0x8c42e8[_0xd556('0x18')]=qs['offset'](_0x26c2bc[_0xd556('0x3c')][_0xd556('0x18')]);}_0x8c42e8['order']=qs[_0xd556('0x45')](_0x26c2bc[_0xd556('0x3c')][_0xd556('0x45')]);_0x8c42e8[_0xd556('0x74')]=qs[_0xd556('0x3e')](_[_0xd556('0x46')](_0x26c2bc[_0xd556('0x3c')],_0x518a7c[_0xd556('0x3e')]));_0x8c42e8['where'][_0xd556('0xb0')]=_0xf3c3ae['id'];if(_0x26c2bc[_0xd556('0x3c')]['filter']){_0x8c42e8[_0xd556('0x74')]=_[_0xd556('0x9a')](_0x8c42e8[_0xd556('0x74')],{'$or':_[_0xd556('0x28')](_0x8c42e8[_0xd556('0x40')],function(_0x210086){var _0x236358={};_0x236358[_0x210086]={'$like':'%'+_0x26c2bc[_0xd556('0x3c')][_0xd556('0x82')]+'%'};return _0x236358;})});}if(_0x26c2bc[_0xd556('0x3c')][_0xd556('0x79')]){var _0x5478b6=_0x26c2bc['query'][_0xd556('0x79')][_0xd556('0x2c')](',');var _0x38fef6={};_0x38fef6[_0x5478b6[0x0]]={'$gte':moment(_0x5478b6[0x1])[_0xd556('0xc0')](_0xd556('0xc1'))};_0x8c42e8[_0xd556('0x74')]=_['merge'](_0x8c42e8[_0xd556('0x74')],_0x38fef6);}_0x8c42e8=_['merge']({},_0x8c42e8,_0x26c2bc[_0xd556('0xc2')]);return db[_0xd556('0xb9')][_0xd556('0x1b')]({'where':_0x8c42e8[_0xd556('0x74')]})['then'](function(_0x13a59e){_0x380a4f['count']=_0x13a59e;if(_0x26c2bc[_0xd556('0x3c')]['includeAll']){_0x8c42e8[_0xd556('0xb6')]=[{'all':!![]}];}return db[_0xd556('0xb9')][_0xd556('0xc3')](_0x8c42e8);})['then'](function(_0x5ca5cd){_0x380a4f[_0xd556('0xb2')]=_0x5ca5cd;return _0x380a4f;});}})['then'](respondWithFilteredResult(_0x42c37b,_0x8c42e8))[_0xd556('0xb3')](handleError(_0x42c37b,null));};exports[_0xd556('0xc4')]=function(_0x101e90,_0x2402ae,_0x2506dc){return db[_0xd556('0x38')][_0xd556('0x67')]({'where':{'id':_0x101e90[_0xd556('0xb5')]['id']}})[_0xd556('0x2f')](handleEntityNotFound(_0x2402ae,null))['then'](function(_0xed7da4){if(_0xed7da4){return _0xed7da4[_0xd556('0xc5')](_0x101e90[_0xd556('0x70')][_0xd556('0xbb')],_['omit'](_0x101e90[_0xd556('0x70')],[_0xd556('0xbb'),'id'])||{})[_0xd556('0xc6')](function(){return db[_0xd556('0xc7')][_0xd556('0xc3')]({'attributes':['id','name',_0xd556('0xc8')],'where':{'id':_0x101e90[_0xd556('0x70')]['ids']}});})['then'](function(_0x2f81f2){socket[_0xd556('0xc9')](_0xd556('0xca'),{'id':Number(_0x101e90[_0xd556('0xb5')]['id']),'tags':_0x2f81f2||[]});return{'id':Number(_0x101e90[_0xd556('0xb5')]['id']),'tags':_0x2f81f2||[]};});}})[_0xd556('0x2f')](respondWithResult(_0x2402ae,null))[_0xd556('0xb3')](handleError(_0x2402ae,null));};exports[_0xd556('0xcb')]=function(_0x186f44,_0x123aa4,_0x5008b6){return db[_0xd556('0x38')][_0xd556('0x67')]({'where':{'id':_0x186f44[_0xd556('0xb5')]['id']}})['then'](handleEntityNotFound(_0x123aa4,null))[_0xd556('0x2f')](function(_0x1ac034){if(_0x1ac034){return _0x1ac034[_0xd556('0xcb')](_0x186f44[_0xd556('0x3c')][_0xd556('0xbb')]);}})[_0xd556('0x2f')](respondWithStatusCode(_0x123aa4,null))['catch'](handleError(_0x123aa4,null));};exports[_0xd556('0xcc')]=function(_0x2fcc67,_0x430cc7){var _0x4754e0=moment()[_0xd556('0xcd')]()[_0xd556('0x98')]();var _0x586f17=path[_0xd556('0xce')](config['root'],_0xd556('0xcf'),_0xd556('0xd0'),_0xd556('0xd1'));var _0x4e5f8e=path[_0xd556('0xce')](config[_0xd556('0xd2')],_0xd556('0xcf'),_0xd556('0xd0'),_0xd556('0xd3'));var _0x191818=path[_0xd556('0xce')](_0x586f17,_0x4754e0);var _0xcb4013=util[_0xd556('0xc0')](_0xd556('0xd4'),_0x2fcc67[_0xd556('0xb5')]['id'],_0x4754e0);var _0x477a79=path[_0xd556('0xce')](_0x586f17,_0xcb4013);var _0x1b3932=[];_0x1b3932[_0xd556('0x2e')]({'model':db[_0xd556('0x6e')],'as':_0xd556('0x6e'),'attributes':['id',_0xd556('0x29')],'raw':!![]});_0x1b3932[_0xd556('0x2e')]({'model':db[_0xd556('0xd5')],'as':_0xd556('0x62'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x464369=[{'model':db[_0xd556('0xb9')],'as':_0xd556('0xd6'),'attributes':['id',_0xd556('0x70'),_0xd556('0x77'),_0xd556('0xd7'),_0xd556('0xd8'),_0xd556('0x7e')],'include':_0x1b3932}];_0x464369[_0xd556('0x2e')]({'model':db[_0xd556('0xd9')],'as':_0xd556('0xda'),'attributes':['id','name']});_0x464369[_0xd556('0x2e')]({'model':db[_0xd556('0x6e')],'as':_0xd556('0xdb'),'attributes':['id',_0xd556('0x29')]});return db[_0xd556('0x38')][_0xd556('0x67')]({'where':{'id':_0x2fcc67[_0xd556('0xb5')]['id']},'include':_0x464369})[_0xd556('0x2f')](handleEntityNotFound(_0x430cc7,null))[_0xd556('0x2f')](function(_0x324c89){if(_0x324c89){var _0x49614e=_0x324c89['get']({'plain':!![]});fs[_0xd556('0xdc')](_0x191818);var _0x1c4983={'channel':_0xd556('0xdd'),'account':_0x49614e[_0xd556('0xda')][_0xd556('0x25')],'agent':_0x49614e[_0xd556('0xdb')]?_0x49614e['Owner'][_0xd556('0x29')]:_0xd556('0xde'),'createdAt':moment(_0x49614e[_0xd556('0x77')])['format'](_0xd556('0xc1'))[_0xd556('0x98')](),'closedAt':_0x49614e[_0xd556('0x36')]?moment(_0x49614e[_0xd556('0xdf')])[_0xd556('0xc0')](_0xd556('0xc1'))['toString']():'','disposition':_0x49614e[_0xd556('0xe0')],'messages':_(_0x49614e[_0xd556('0xd6')])[_0xd556('0x82')]({'secret':![]})[_0xd556('0x28')](function(_0x3e04a7){return{'date':moment(_0x3e04a7[_0xd556('0x77')])[_0xd556('0xc0')](_0xd556('0xc1'))[_0xd556('0x98')](),'sender':_0x3e04a7[_0xd556('0xd7')]===_0xd556('0xe1')?_0x3e04a7[_0xd556('0x6e')]?_0x3e04a7[_0xd556('0x6e')]['fullname']:_0xd556('0xe2'):_0x3e04a7[_0xd556('0x62')][_0xd556('0xe3')]+(_0x3e04a7[_0xd556('0x62')][_0xd556('0xe4')]?'\x20'+_0x3e04a7[_0xd556('0x62')]['lastName']:''),'body':_0x3e04a7['body'],'direction':_0x3e04a7[_0xd556('0xd7')]===_0xd556('0xe1')?'A':'C','secret':_0x3e04a7[_0xd556('0xd8')],'read':_0x3e04a7[_0xd556('0x7e')]};})[_0xd556('0x64')]()};return ejs[_0xd556('0xe5')](path[_0xd556('0xce')](config[_0xd556('0xd2')],'server',_0xd556('0xe6'),'downloadInteraction.ejs'),{'interaction':_0x1c4983})[_0xd556('0x2f')](function(_0x53188e){var _0x1d065a=path[_0xd556('0xce')](_0x191818,_0xd556('0xe7')+_0x49614e['id']+'-'+_0x4754e0+_0xd556('0xe8'));var _0x3a14db={'path':_0x1d065a,'channel':_0xd556('0xdd'),'interactionId':_0x49614e['id']};return pdf[_0xd556('0xe9')](_0x53188e,_0x3a14db);})[_0xd556('0x2f')](function(){return new BPromise(function(_0x554696,_0x380cca){zipdir(_0x191818,{'saveTo':_0x477a79},function(_0x55c5d3,_0xa0058f){if(_0x55c5d3)return _0x380cca(_0x55c5d3);return _0x554696(_0xa0058f);});})['then'](function(){return new BPromise(function(_0x4c98ff,_0x27145f){rimraf(_0x191818,function(_0x55970e){if(_0x55970e)_0x27145f(_0x55970e);return _0x4c98ff();});});})[_0xd556('0x2f')](function(){return _0x430cc7['download'](_0x477a79,_0xcb4013,function(_0x22b7b7){if(_0x22b7b7){console[_0xd556('0xea')](_0xd556('0xeb'),_0x22b7b7);}else{fs[_0xd556('0xec')](_0x477a79);}});});});}else{return _0x430cc7[_0xd556('0x14')](0xc8);}})[_0xd556('0xb3')](handleError(_0x430cc7,null));}; \ No newline at end of file +var _0xf5ee=['map','fullname','TagIds','Tags','split','forEach','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filters','select','field','color','from','tools_tags','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show','params','rawAttributes','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','findAll','smsInteractionTags:save','download','unix','root','server','tmp','files','attachments','join','transcript-%d-%s.zip','User','CmContact','lastName','Messages','direction','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','disposition','out','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./smsInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','sendStatus','name','send','Users'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xf5ee,0xbe));var _0xef5e=function(_0x160425,_0x2983aa){_0x160425=_0x160425-0x0;var _0x455b67=_0xf5ee[_0x160425];return _0x455b67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef5e('0x0'));var zipdir=require(_0xef5e('0x1'));var jsonpatch=require(_0xef5e('0x2'));var rp=require('request-promise');var moment=require(_0xef5e('0x3'));var BPromise=require(_0xef5e('0x4'));var Mustache=require(_0xef5e('0x5'));var util=require('util');var path=require(_0xef5e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xef5e('0x7'));var fs=require('fs');var fs_extra=require(_0xef5e('0x8'));var _=require(_0xef5e('0x9'));var squel=require(_0xef5e('0xa'));var crypto=require(_0xef5e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xef5e('0xc'));var toCsv=require(_0xef5e('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xef5e('0xe'));var authService=require(_0xef5e('0xf'));var qs=require(_0xef5e('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xef5e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xef5e('0x12'));var utils=require(_0xef5e('0x13'));var config=require(_0xef5e('0x14'));var licenseUtil=require(_0xef5e('0x15'));var db=require('../../mysqldb')['db'];config[_0xef5e('0x16')]=_[_0xef5e('0x17')](config[_0xef5e('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef5e('0x16')]));require(_0xef5e('0x18'))[_0xef5e('0x19')](socket);function respondWithStatusCode(_0xd9ed21,_0x1f04e1){_0x1f04e1=_0x1f04e1||0xcc;return function(_0x1f35e1){if(_0x1f35e1){return _0xd9ed21['sendStatus'](_0x1f04e1);}return _0xd9ed21[_0xef5e('0x1a')](_0x1f04e1)[_0xef5e('0x1b')]();};}function respondWithResult(_0x16b5f9,_0x44aa2c){_0x44aa2c=_0x44aa2c||0xc8;return function(_0x126059){if(_0x126059){return _0x16b5f9[_0xef5e('0x1a')](_0x44aa2c)[_0xef5e('0x1c')](_0x126059);}};}function respondWithFilteredResult(_0x39945b,_0x3d341e){return function(_0x3357aa){if(_0x3357aa){var _0x4187ae=typeof _0x3d341e[_0xef5e('0x1d')]===_0xef5e('0x1e')&&typeof _0x3d341e['limit']===_0xef5e('0x1e');var _0x728c8e=_0x3357aa['count'];var _0x7599d5=_0x4187ae?0x0:_0x3d341e[_0xef5e('0x1d')];var _0x2d847a=_0x4187ae?_0x3357aa[_0xef5e('0x1f')]:_0x3d341e[_0xef5e('0x1d')]+_0x3d341e[_0xef5e('0x20')];var _0x6c02b0;if(_0x2d847a>=_0x728c8e){_0x2d847a=_0x728c8e;_0x6c02b0=0xc8;}else{_0x6c02b0=0xce;}_0x39945b[_0xef5e('0x1a')](_0x6c02b0);return _0x39945b[_0xef5e('0x21')](_0xef5e('0x22'),_0x7599d5+'-'+_0x2d847a+'/'+_0x728c8e)[_0xef5e('0x1c')](_0x3357aa);}return null;};}function patchUpdates(_0x3c2769){return function(_0x2d8590){try{jsonpatch[_0xef5e('0x23')](_0x2d8590,_0x3c2769,!![]);}catch(_0x4306b3){return BPromise['reject'](_0x4306b3);}return _0x2d8590['save']();};}function saveUpdates(_0x280f2a,_0x1a77f2){return function(_0x9d7a0){if(_0x9d7a0){return _0x9d7a0[_0xef5e('0x24')](_0x280f2a)[_0xef5e('0x25')](function(_0x346159){return _0x346159;});}return null;};}function removeEntity(_0x4ec22e,_0x528b28){return function(_0x30e55a){if(_0x30e55a){return _0x30e55a[_0xef5e('0x26')]()[_0xef5e('0x25')](function(){_0x4ec22e[_0xef5e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2edaff,_0x2cb413){return function(_0x494080){if(!_0x494080){_0x2edaff[_0xef5e('0x27')](0x194);}return _0x494080;};}function handleError(_0x37c543,_0x295a00){_0x295a00=_0x295a00||0x1f4;return function(_0x56fcf6){logger['error'](_0x56fcf6['stack']);if(_0x56fcf6[_0xef5e('0x28')]){delete _0x56fcf6[_0xef5e('0x28')];}_0x37c543[_0xef5e('0x1a')](_0x295a00)[_0xef5e('0x29')](_0x56fcf6);};}function getInteractionUsers(_0x142596,_0x584741){return new BPromise(function(_0x9a0bd,_0x587374){try{if(_0x584741[_0x142596['id']]){_0x142596[_0xef5e('0x2a')]=_[_0xef5e('0x2b')](_0x584741[_0x142596['id']],function(_0x20719e){return{'id':_0x20719e['id'],'fullname':_0x20719e[_0xef5e('0x2c')]};});}}catch(_0x29c5e9){_0x587374(_0x29c5e9);}_0x9a0bd(_0x142596);});}function getInteractionTags(_0xf21909,_0x4ca3f3){return new BPromise(function(_0x5483a9,_0x5bfb10){try{if(_0xf21909[_0xef5e('0x2d')]){_0xf21909[_0xef5e('0x2e')]=[];_0xf21909[_0xef5e('0x2d')][_0xef5e('0x2f')](',')[_0xef5e('0x30')](function(_0x2911a0){_0xf21909[_0xef5e('0x2e')]['push'](_0x4ca3f3[_0x2911a0]);});}delete _0xf21909[_0xef5e('0x2d')];}catch(_0x321ab2){_0x5bfb10(_0x321ab2);}_0x5483a9(_0xf21909);});}function updateSmsInteraction(_0x25f60d,_0x569c43,_0x114feb){return new BPromise(function(_0x5c546b,_0x1d834d){return getInteractionUsers(_0x25f60d,_0x114feb)[_0xef5e('0x25')](function(_0x155b1f){return getInteractionTags(_0x155b1f,_0x569c43);})[_0xef5e('0x25')](function(_0x2f12ee){return getStateInteraction(_0x2f12ee);})[_0xef5e('0x25')](function(_0x45e3b8){_0x5c546b(_0x45e3b8);})[_0xef5e('0x31')](function(_0xa298fd){_0x1d834d(_0xa298fd);});});}function getStateInteraction(_0x8f3219){return new BPromise(function(_0x1638e6){_0x8f3219[_0xef5e('0x32')]=0x0;_0x8f3219[_0xef5e('0x33')]=0x0;_0x8f3219[_0xef5e('0x34')]=0x0;_0x8f3219[_0xef5e('0x35')]=0x0;_0x8f3219[_0xef5e('0x36')]=0x0;if(!_0x8f3219[_0xef5e('0x37')]&&!_0x8f3219['UserId']){_0x8f3219[_0xef5e('0x32')]+=0x1;}if(!_0x8f3219['closed']&&_0x8f3219[_0xef5e('0x38')]){_0x8f3219[_0xef5e('0x33')]+=0x1;if(_0x8f3219[_0xef5e('0x32')]){_0x8f3219[_0xef5e('0x32')]-=0x1;}}if(_0x8f3219[_0xef5e('0x37')]&&_0x8f3219['UserId']){_0x8f3219[_0xef5e('0x34')]+=0x1;if(_0x8f3219['talking']){_0x8f3219['talking']-=0x1;}}if(_0x8f3219['closed']&&!_0x8f3219['UserId']){_0x8f3219[_0xef5e('0x35')]+=0x1;if(_0x8f3219[_0xef5e('0x32')]){_0x8f3219[_0xef5e('0x32')]-=0x1;}}_0x8f3219[_0xef5e('0x36')]+=0x1;_0x1638e6(_0x8f3219);});}exports[_0xef5e('0x39')]=function(_0x801958,_0xd87918){var _0x302790={},_0x122dcb={},_0x1f71dd={'count':0x0,'rows':[]};var _0x54d4c9=_['map'](db['SmsInteraction']['rawAttributes'],function(_0x3780c7){return{'name':_0x3780c7[_0xef5e('0x3a')],'type':_0x3780c7[_0xef5e('0x3b')][_0xef5e('0x3c')]};});_0x122dcb[_0xef5e('0x3d')]=_[_0xef5e('0x2b')](_0x54d4c9,_0xef5e('0x28'));_0x122dcb['query']=_[_0xef5e('0x3e')](_0x801958[_0xef5e('0x3f')]);_0x122dcb['filters']=_[_0xef5e('0x40')](_0x122dcb[_0xef5e('0x3d')],_0x122dcb['query']);_0x302790['attributes']=_[_0xef5e('0x40')](_0x122dcb['model'],qs['fields'](_0x801958[_0xef5e('0x3f')][_0xef5e('0x41')]));_0x302790[_0xef5e('0x42')]=_0x302790[_0xef5e('0x42')][_0xef5e('0x43')]?_0x302790[_0xef5e('0x42')]:_0x122dcb['model'];if(!_0x801958['query'][_0xef5e('0x44')]('nolimit')){_0x302790[_0xef5e('0x20')]=qs[_0xef5e('0x20')](_0x801958['query'][_0xef5e('0x20')]);_0x302790[_0xef5e('0x1d')]=qs['offset'](_0x801958[_0xef5e('0x3f')][_0xef5e('0x1d')]);}_0x302790[_0xef5e('0x45')]=qs[_0xef5e('0x46')](_0x801958['query'][_0xef5e('0x46')]);_0x302790['where']=qs['filters'](_[_0xef5e('0x47')](_0x801958[_0xef5e('0x3f')],_0x122dcb[_0xef5e('0x48')]),_0x54d4c9);var _0x23ee6b=[];var _0x4703ee=squel[_0xef5e('0x49')]()[_0xef5e('0x4a')]('id')[_0xef5e('0x4a')](_0xef5e('0x28'))[_0xef5e('0x4a')](_0xef5e('0x4b'))[_0xef5e('0x4c')](_0xef5e('0x4d'));var _0x56c98b=squel['select']()[_0xef5e('0x4a')]('u.id')[_0xef5e('0x4a')](_0xef5e('0x4e'))[_0xef5e('0x4a')]('ui.SmsInteractionId')[_0xef5e('0x4c')](_0xef5e('0x4f'),'ui')[_0xef5e('0x50')](_0xef5e('0x51'),'u',_0xef5e('0x52'));var _0x23aa8b=squel['select']()[_0xef5e('0x4c')](_0xef5e('0x53'),'i')['left_join'](_0xef5e('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xef5e('0x50')](_0xef5e('0x51'),'o',_0xef5e('0x55'))[_0xef5e('0x50')](_0xef5e('0x56'),'a','a.id\x20=\x20i.SmsAccountId')[_0xef5e('0x50')](_0xef5e('0x57'),'me',_0xef5e('0x58'))[_0xef5e('0x50')](_0xef5e('0x59'),'it',_0xef5e('0x5a'))[_0xef5e('0x50')]('tools_tags','t',_0xef5e('0x5b'));var _0x3f4354=squel['expr']();var _0x1f5a27=[];var _0x4c8137=squel[_0xef5e('0x5c')]();var _0x4b191c;if(_0x801958['query'][_0xef5e('0x5d')]){_0x4b191c=as[_0xef5e('0x5e')](_0x801958[_0xef5e('0x3f')]['search']);var _0xe7eecf=_0x4b191c[_0xef5e('0x5f')];for(var _0x145227=0x0;_0x145227<_0x4b191c[_0xef5e('0x60')]['length'];_0x145227++){var _0x3c8a34=_0x4b191c[_0xef5e('0x60')][_0x145227];var _0x93ee40='i';var _0xe66df4=_['find'](_0x54d4c9,[_0xef5e('0x28'),_0x3c8a34[_0xef5e('0x4a')]]);if(!_0xe66df4){switch(_0x3c8a34[_0xef5e('0x4a')]){case _0xef5e('0x61'):if(_0x3c8a34[_0xef5e('0x62')]==0x1){_0x23aa8b[_0xef5e('0x63')]('`'+_0x3c8a34['field']+_0xef5e('0x64'));}else{_0x23aa8b['having']('`'+_0x3c8a34['field']+'`\x20>\x200');}break;case _0xef5e('0x65'):if(_0x3c8a34['operator']==='$substring'){if(_0x3c8a34[_0xef5e('0x62')]['split']('\x20')[_0xef5e('0x43')]>0x1){_0x3f4354[_0xe7eecf](_0xef5e('0x66'),qs[_0xef5e('0x67')](_0x3c8a34[_0xef5e('0x62')]),null);}else{var _0x346616='%'+_0x3c8a34[_0xef5e('0x62')]+'%';_0x3f4354[_0xe7eecf](_0xef5e('0x68'),_0x346616,_0x346616,_0x346616);}}else{_0xe66df4=_[_0xef5e('0x69')](_0x54d4c9,['name','ContactId']);_0x3c8a34[_0xef5e('0x4a')]='ContactId';_0x3ac01a=as[_0xef5e('0x6a')](_0x93ee40,_0xe66df4[_0xef5e('0x3b')],_0x3c8a34);_0x3f4354[_0xe7eecf](_0x3ac01a[_0xef5e('0x6b')],_0x3ac01a[_0xef5e('0x62')][_0xef5e('0x6c')],_0x3ac01a['value'][_0xef5e('0x1b')]);}break;case'Tag':var _0x56ea0f=_0x3c8a34[_0xef5e('0x62')][_0xef5e('0x2f')](',')[_0xef5e('0x2b')](function(_0x29c63e){return Number(_0x29c63e);});_0x56ea0f['forEach'](function(_0xb880a8){_0x4c8137['or'](_0xef5e('0x6d'),'%,'+_0xb880a8+',%');});_0x1f5a27=_[_0xef5e('0x6e')](_0x1f5a27,_0x56ea0f);break;case'User':if(_0x3c8a34[_0xef5e('0x6f')]===_0xef5e('0x70')){_0x3f4354[_0xe7eecf](_0xef5e('0x71'),'%'+_0x3c8a34[_0xef5e('0x62')]+'%',null);}else{_0xe66df4=_[_0xef5e('0x69')](_0x54d4c9,[_0xef5e('0x28'),_0xef5e('0x38')]);_0x3c8a34[_0xef5e('0x4a')]=_0xef5e('0x38');_0x3ac01a=as['buildExpression'](_0x93ee40,_0xe66df4[_0xef5e('0x3b')],_0x3c8a34);_0x3f4354[_0xe7eecf](_0x3ac01a[_0xef5e('0x6b')],_0x3ac01a['value'][_0xef5e('0x6c')],_0x3ac01a[_0xef5e('0x62')][_0xef5e('0x1b')]);}break;case _0xef5e('0x72'):_0x3ac01a=as[_0xef5e('0x6a')]('me',null,_0x3c8a34);_0x3f4354[_0xe7eecf](_0x3ac01a[_0xef5e('0x6b')],_0x3ac01a[_0xef5e('0x62')][_0xef5e('0x6c')],_0x3ac01a[_0xef5e('0x62')][_0xef5e('0x1b')]);break;}}else{var _0x3ac01a=as['buildExpression'](_0x93ee40,_0xe66df4[_0xef5e('0x3b')],_0x3c8a34);_0x3f4354[_0xe7eecf](_0x3ac01a[_0xef5e('0x6b')],_0x3ac01a[_0xef5e('0x62')][_0xef5e('0x6c')],_0x3ac01a[_0xef5e('0x62')][_0xef5e('0x1b')]);}}}else{var _0x57d2c7=_(_0x801958[_0xef5e('0x3f')])['keys']()['map'](function(_0x499aff){return _['some'](_0x54d4c9,[_0xef5e('0x28'),_0x499aff])?_0x499aff:undefined;})['compact']()[_0xef5e('0x62')]();if(!_[_0xef5e('0x73')](_0x57d2c7)){_0x57d2c7[_0xef5e('0x30')](function(_0x4d30c7){if(_0x4d30c7===_0xef5e('0x74')){_0x23aa8b[_0xef5e('0x75')](_0xef5e('0x76'),[]['concat'](_0x801958[_0xef5e('0x3f')][_0x4d30c7]));}else if(_0x4d30c7===_0xef5e('0x77')){var _0x249cc6=JSON['parse'](_0x801958[_0xef5e('0x3f')][_0x4d30c7])[_0xef5e('0x78')];var _0x3eda8b=JSON[_0xef5e('0x79')](_0x801958['query'][_0x4d30c7])[_0xef5e('0x7a')];_0x23aa8b[_0xef5e('0x75')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x249cc6,_0x3eda8b);}else{if(_0x801958['query'][_0x4d30c7]===_0xef5e('0x7b')){_0x23aa8b[_0xef5e('0x75')]('i.'+_0x4d30c7+_0xef5e('0x7c'));}else{_0x23aa8b['where']('i.'+_0x4d30c7+_0xef5e('0x7d'),_0x801958['query'][_0x4d30c7]);}}});}if(_0x801958[_0xef5e('0x3f')][_0xef5e('0x7e')]){if(_0x801958[_0xef5e('0x3f')]['read']==0x1){_0x23aa8b[_0xef5e('0x63')]('`unreadMessages`\x20=\x200');}else{_0x23aa8b[_0xef5e('0x63')](_0xef5e('0x7f'));}}if(_0x801958[_0xef5e('0x3f')][_0xef5e('0x80')]){_0x1f5a27=_[_0xef5e('0x81')](_0x801958[_0xef5e('0x3f')][_0xef5e('0x80')])?_0x801958['query'][_0xef5e('0x80')]:new Array(_0x801958[_0xef5e('0x3f')][_0xef5e('0x80')]);_0x1f5a27['forEach'](function(_0x25c8ec){_0x4c8137['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x25c8ec+',%');});}if(_0x801958[_0xef5e('0x3f')][_0xef5e('0x82')]){var _0x48ca23=_0x801958[_0xef5e('0x3f')][_0xef5e('0x82')]['replace']('\x5c','\x5c\x5c')[_0xef5e('0x83')](/'/g,'\x27\x27');if(qs[_0xef5e('0x84')](_0x48ca23)){_0x3f4354['or'](_0xef5e('0x85'),_0x48ca23+'%')['or'](_0xef5e('0x86'),_0x48ca23+'%');}else{_0x3f4354['or'](_0xef5e('0x87'),qs[_0xef5e('0x67')](_0x48ca23))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x48ca23+'%');}}}_0x23aa8b[_0xef5e('0x75')](_0x3f4354);_0x23aa8b[_0xef5e('0x88')](_0xef5e('0x89'));var _0x76f6fe={'type':db[_0xef5e('0x8a')][_0xef5e('0x8b')][_0xef5e('0x8c')],'raw':!![]};var _0x292008=_0x23aa8b[_0xef5e('0x8d')]();_0x292008['field']('i.id');_0x292008[_0xef5e('0x4a')](_0xef5e('0x8e'),_0xef5e('0x61'));if(_0x302790[_0xef5e('0x45')]){_0x302790['order']['forEach'](function(_0x4d5c0a){var _0x15e01c=_0x4d5c0a[0x0]===_0xef5e('0x8f')?_0x4d5c0a[0x0]:'i.'+_0x4d5c0a[0x0];_0x23aa8b[_0xef5e('0x45')](_0x15e01c,_0x4d5c0a[0x1]==='DESC'?![]:!![]);});}if(!_[_0xef5e('0x73')](_0x1f5a27)){_0x23aa8b[_0xef5e('0x63')](_0x4c8137);_0x292008['where'](_0xef5e('0x90'),_0x1f5a27);}BPromise[_0xef5e('0x91')]()[_0xef5e('0x25')](function(){if(!_0x4b191c){if(_0x801958[_0xef5e('0x3f')][_0xef5e('0x74')])return;_0x292008[_0xef5e('0x75')](_0xef5e('0x92'));_0x23aa8b[_0xef5e('0x75')](_0xef5e('0x92'));return;}if(_0x801958[_0xef5e('0x93')][_0xef5e('0x94')]!=='agent')return;return _0x801958['user'][_0xef5e('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x12570a){if(_[_0xef5e('0x73')](_0x12570a)){_0x292008[_0xef5e('0x75')](_0xef5e('0x96'));_0x23aa8b['where'](_0xef5e('0x96'));}else{_0x292008[_0xef5e('0x75')](_0xef5e('0x76'),_[_0xef5e('0x2b')](_0x12570a,'id'));_0x23aa8b[_0xef5e('0x75')]('i.SmsAccountId\x20IN\x20?',_[_0xef5e('0x2b')](_0x12570a,'id'));}});})['then'](function(){if(_0x801958[_0xef5e('0x93')]['role']===_0xef5e('0x97')&&!_0x4b191c&&!_0x801958[_0xef5e('0x3f')][_0xef5e('0x74')])return[];return db[_0xef5e('0x98')][_0xef5e('0x3f')](_0x292008[_0xef5e('0x99')](),_0x76f6fe);})[_0xef5e('0x25')](function(_0x39777a){_0x1f71dd[_0xef5e('0x1f')]=_0x39777a[_0xef5e('0x43')];if(_0x1f71dd[_0xef5e('0x1f')]===0x0)return[];return db[_0xef5e('0x98')]['query'](_0x4703ee['toString'](),_0x76f6fe)[_0xef5e('0x25')](function(_0x2706ab){_0x23ee6b=_[_0xef5e('0x9a')](_0x2706ab,'id');_0x76f6fe=_[_0xef5e('0x9b')](_0x76f6fe,{'model':db[_0xef5e('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x801958[_0xef5e('0x3f')]['fields']){_0x302790[_0xef5e('0x42')]['forEach'](function(_0x11271a){_0x23aa8b[_0xef5e('0x4a')]('i.'+_0x11271a);});}else{_0x23aa8b['field'](_0xef5e('0x8e'),'unreadMessages');_0x23aa8b[_0xef5e('0x4a')](_0xef5e('0x9d'),_0xef5e('0x9e'));_0x23aa8b[_0xef5e('0x4a')](_0xef5e('0x9f'),_0xef5e('0xa0'));_0x23aa8b['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xef5e('0x8f'));_0x23aa8b[_0xef5e('0x4a')](_0xef5e('0xa1'));_0x23aa8b[_0xef5e('0x4a')](_0xef5e('0xa2'),_0xef5e('0xa3'));_0x23aa8b[_0xef5e('0x4a')]('c.lastName','Contact.lastName');_0x23aa8b['field'](_0xef5e('0xa4'),_0xef5e('0xa5'));_0x23aa8b[_0xef5e('0x4a')](_0xef5e('0xa6'),_0xef5e('0xa7'));_0x23aa8b[_0xef5e('0x4a')](_0xef5e('0xa8'),_0xef5e('0xa9'));_0x23aa8b['field']('c.fax',_0xef5e('0xaa'));_0x23aa8b[_0xef5e('0x4a')](_0xef5e('0xab'),_0xef5e('0xac'));_0x23aa8b[_0xef5e('0x4a')](_0xef5e('0xad'),'Owner.internal');_0x23aa8b[_0xef5e('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xef5e('0x2d'));}if(_0x302790[_0xef5e('0x20')])_0x23aa8b[_0xef5e('0x20')](_0x302790[_0xef5e('0x20')]);if(_0x302790[_0xef5e('0x1d')])_0x23aa8b[_0xef5e('0x1d')](_0x302790['offset']);return db['sequelize']['query'](_0x23aa8b[_0xef5e('0x99')](),_0x76f6fe);})[_0xef5e('0x25')](function(_0x19a571){if(_0x19a571[_0xef5e('0x43')]>0x0)_0x56c98b[_0xef5e('0x75')](_0xef5e('0xae'),_[_0xef5e('0x2b')](_0x19a571,'id'));return db[_0xef5e('0x98')][_0xef5e('0x3f')](_0x56c98b['toString'](),_0x76f6fe)['then'](function(_0x5a8caa){var _0x3d55e1=_[_0xef5e('0xaf')](_0x5a8caa,_0xef5e('0xb0'));var _0x30909e=[];_0x19a571[_0xef5e('0x30')](function(_0x4ccc60){_0x30909e[_0xef5e('0xb1')](updateSmsInteraction(_0x4ccc60,_0x23ee6b,_0x3d55e1));});return BPromise[_0xef5e('0xb2')](_0x30909e);});});})[_0xef5e('0x25')](function(_0x1343ba){_0x1f71dd['rows']=_0x1343ba;return _0x1f71dd;})[_0xef5e('0x25')](respondWithFilteredResult(_0xd87918,_0x302790))[_0xef5e('0x31')](handleError(_0xd87918,null));};exports[_0xef5e('0xb3')]=function(_0x1b6388,_0x34015b){var _0x6cab83={'raw':![],'where':{'id':_0x1b6388[_0xef5e('0xb4')]['id']}},_0x54c04a={};_0x54c04a[_0xef5e('0x3d')]=_[_0xef5e('0x3e')](db['SmsInteraction'][_0xef5e('0xb5')]);_0x54c04a[_0xef5e('0x3f')]=_[_0xef5e('0x3e')](_0x1b6388[_0xef5e('0x3f')]);_0x54c04a[_0xef5e('0x48')]=_['intersection'](_0x54c04a[_0xef5e('0x3d')],_0x54c04a['query']);_0x6cab83[_0xef5e('0x42')]=_[_0xef5e('0x40')](_0x54c04a['model'],qs['fields'](_0x1b6388[_0xef5e('0x3f')][_0xef5e('0x41')]));_0x6cab83['attributes']=_0x6cab83['attributes']['length']?_0x6cab83[_0xef5e('0x42')]:_0x54c04a[_0xef5e('0x3d')];if(_0x1b6388[_0xef5e('0x3f')][_0xef5e('0xb6')]){_0x6cab83[_0xef5e('0xb7')]=[{'all':!![]}];}_0x6cab83=_['merge']({},_0x6cab83,_0x1b6388[_0xef5e('0xb8')]);return db[_0xef5e('0x9c')][_0xef5e('0x69')](_0x6cab83)['then'](handleEntityNotFound(_0x34015b,null))[_0xef5e('0x25')](respondWithResult(_0x34015b,null))[_0xef5e('0x31')](handleError(_0x34015b,null));};exports[_0xef5e('0xb9')]=function(_0x31c924,_0x442b37){return db[_0xef5e('0x9c')][_0xef5e('0xb9')](_0x31c924[_0xef5e('0x72')],{})['then'](respondWithResult(_0x442b37,0xc9))[_0xef5e('0x31')](handleError(_0x442b37,null));};exports[_0xef5e('0x24')]=function(_0x5a8d5f,_0x242493){if(_0x5a8d5f['body']['id']){delete _0x5a8d5f[_0xef5e('0x72')]['id'];}return db[_0xef5e('0x9c')][_0xef5e('0x69')]({'where':{'id':_0x5a8d5f['params']['id']}})[_0xef5e('0x25')](handleEntityNotFound(_0x242493,null))[_0xef5e('0x25')](saveUpdates(_0x5a8d5f[_0xef5e('0x72')],null))[_0xef5e('0x25')](respondWithResult(_0x242493,null))[_0xef5e('0x31')](handleError(_0x242493,null));};exports[_0xef5e('0x26')]=function(_0x2fc347,_0x2b2718){return db[_0xef5e('0x9c')][_0xef5e('0x69')]({'where':{'id':_0x2fc347[_0xef5e('0xb4')]['id']}})[_0xef5e('0x25')](handleEntityNotFound(_0x2b2718,null))[_0xef5e('0x25')](removeEntity(_0x2b2718,null))['catch'](handleError(_0x2b2718,null));};exports[_0xef5e('0xba')]=function(_0x2c843c,_0x4a0079){return db[_0xef5e('0x9c')]['describe']()[_0xef5e('0x25')](respondWithResult(_0x4a0079,null))[_0xef5e('0x31')](handleError(_0x4a0079,null));};exports[_0xef5e('0xbb')]=function(_0x551012,_0xc73bc8,_0xe4a084){return db[_0xef5e('0xbc')][_0xef5e('0x69')]({'where':{'id':_0x551012[_0xef5e('0xb4')]['id']}})['then'](handleEntityNotFound(_0xc73bc8,null))[_0xef5e('0x25')](function(_0x347f93){if(_0x347f93){return _0x347f93[_0xef5e('0xbb')](_0x551012['body'][_0xef5e('0xbd')],_[_0xef5e('0xbe')](_0x551012['body'],['ids','id'])||{});}})[_0xef5e('0x25')](respondWithResult(_0xc73bc8,null))['catch'](handleError(_0xc73bc8,null));};exports[_0xef5e('0xbf')]=function(_0x13ba45,_0x563f21,_0x298bb5){var _0x431bed={'raw':![],'where':{}};var _0x266537={};var _0x301e61={'count':0x0,'rows':[]};return db[_0xef5e('0x9c')][_0xef5e('0xc0')]({'where':{'id':_0x13ba45[_0xef5e('0xb4')]['id']}})[_0xef5e('0x25')](handleEntityNotFound(_0x563f21,null))[_0xef5e('0x25')](function(_0x39d385){if(_0x39d385){_0x266537[_0xef5e('0x3d')]=_[_0xef5e('0x3e')](db[_0xef5e('0xbc')][_0xef5e('0xb5')]);_0x266537[_0xef5e('0x3f')]=_[_0xef5e('0x3e')](_0x13ba45['query']);_0x266537[_0xef5e('0x48')]=_[_0xef5e('0x40')](_0x266537[_0xef5e('0x3d')],_0x266537['query']);_0x431bed[_0xef5e('0x42')]=_['intersection'](_0x266537['model'],qs[_0xef5e('0x41')](_0x13ba45[_0xef5e('0x3f')]['fields']));_0x431bed[_0xef5e('0x42')]=_0x431bed['attributes'][_0xef5e('0x43')]?_0x431bed[_0xef5e('0x42')]:_0x266537['model'];if(!_0x13ba45[_0xef5e('0x3f')][_0xef5e('0x44')](_0xef5e('0xc1'))){_0x431bed[_0xef5e('0x20')]=qs['limit'](_0x13ba45[_0xef5e('0x3f')][_0xef5e('0x20')]);_0x431bed[_0xef5e('0x1d')]=qs[_0xef5e('0x1d')](_0x13ba45[_0xef5e('0x3f')][_0xef5e('0x1d')]);}_0x431bed[_0xef5e('0x45')]=qs[_0xef5e('0x46')](_0x13ba45[_0xef5e('0x3f')][_0xef5e('0x46')]);_0x431bed[_0xef5e('0x75')]=qs['filters'](_[_0xef5e('0x47')](_0x13ba45[_0xef5e('0x3f')],_0x266537[_0xef5e('0x48')]));_0x431bed[_0xef5e('0x75')][_0xef5e('0xb0')]=_0x39d385['id'];if(_0x13ba45[_0xef5e('0x3f')]['filter']){_0x431bed[_0xef5e('0x75')]=_[_0xef5e('0x9b')](_0x431bed['where'],{'$or':_[_0xef5e('0x2b')](_0x431bed[_0xef5e('0x42')],function(_0x2cb988){var _0x2aff95={};_0x2aff95[_0x2cb988]={'$like':'%'+_0x13ba45['query'][_0xef5e('0x82')]+'%'};return _0x2aff95;})});}if(_0x13ba45['query'][_0xef5e('0x78')]){var _0x52cdf0=_0x13ba45['query']['$gte'][_0xef5e('0x2f')](',');var _0x138945={};_0x138945[_0x52cdf0[0x0]]={'$gte':moment(_0x52cdf0[0x1])[_0xef5e('0xc2')](_0xef5e('0xc3'))};_0x431bed[_0xef5e('0x75')]=_[_0xef5e('0x9b')](_0x431bed[_0xef5e('0x75')],_0x138945);}_0x431bed=_[_0xef5e('0x9b')]({},_0x431bed,_0x13ba45[_0xef5e('0xb8')]);return db[_0xef5e('0xbc')]['count']({'where':_0x431bed[_0xef5e('0x75')]})[_0xef5e('0x25')](function(_0x3e0035){_0x301e61[_0xef5e('0x1f')]=_0x3e0035;if(_0x13ba45[_0xef5e('0x3f')][_0xef5e('0xb6')]){_0x431bed[_0xef5e('0xb7')]=[{'all':!![]}];}return db[_0xef5e('0xbc')]['findAll'](_0x431bed);})[_0xef5e('0x25')](function(_0x147e10){_0x301e61[_0xef5e('0xc4')]=_0x147e10;return _0x301e61;});}})['then'](respondWithFilteredResult(_0x563f21,_0x431bed))['catch'](handleError(_0x563f21,null));};exports['addTags']=function(_0x30f76c,_0x270a17,_0x20bea0){return db['SmsInteraction'][_0xef5e('0x69')]({'where':{'id':_0x30f76c[_0xef5e('0xb4')]['id']}})[_0xef5e('0x25')](handleEntityNotFound(_0x270a17,null))[_0xef5e('0x25')](function(_0x56acb9){if(_0x56acb9){return _0x56acb9[_0xef5e('0xc5')](_0x30f76c[_0xef5e('0x72')]['ids'],_['omit'](_0x30f76c[_0xef5e('0x72')],[_0xef5e('0xbd'),'id'])||{})[_0xef5e('0xc6')](function(){return db[_0xef5e('0xc7')][_0xef5e('0xc8')]({'attributes':['id',_0xef5e('0x28'),_0xef5e('0x4b')],'where':{'id':_0x30f76c[_0xef5e('0x72')][_0xef5e('0xbd')]}});})[_0xef5e('0x25')](function(_0x51541f){socket['emit'](_0xef5e('0xc9'),{'id':Number(_0x30f76c[_0xef5e('0xb4')]['id']),'tags':_0x51541f||[]});return{'id':Number(_0x30f76c[_0xef5e('0xb4')]['id']),'tags':_0x51541f||[]};});}})[_0xef5e('0x25')](respondWithResult(_0x270a17,null))[_0xef5e('0x31')](handleError(_0x270a17,null));};exports['removeTags']=function(_0x4d2ba1,_0x465bfe,_0x5cc7b9){return db[_0xef5e('0x9c')]['find']({'where':{'id':_0x4d2ba1[_0xef5e('0xb4')]['id']}})[_0xef5e('0x25')](handleEntityNotFound(_0x465bfe,null))[_0xef5e('0x25')](function(_0x5a6233){if(_0x5a6233){return _0x5a6233['removeTags'](_0x4d2ba1[_0xef5e('0x3f')][_0xef5e('0xbd')]);}})[_0xef5e('0x25')](respondWithStatusCode(_0x465bfe,null))[_0xef5e('0x31')](handleError(_0x465bfe,null));};exports[_0xef5e('0xca')]=function(_0x4b6452,_0x4ff6cb){var _0x1b0f8d=moment()[_0xef5e('0xcb')]()[_0xef5e('0x99')]();var _0x47d70e=path['join'](config[_0xef5e('0xcc')],_0xef5e('0xcd'),'files',_0xef5e('0xce'));var _0x100bb4=path['join'](config[_0xef5e('0xcc')],_0xef5e('0xcd'),_0xef5e('0xcf'),_0xef5e('0xd0'));var _0x139a36=path[_0xef5e('0xd1')](_0x47d70e,_0x1b0f8d);var _0x4d0bf3=util['format'](_0xef5e('0xd2'),_0x4b6452['params']['id'],_0x1b0f8d);var _0x2b3b14=path[_0xef5e('0xd1')](_0x47d70e,_0x4d0bf3);var _0x4b03a2=[];_0x4b03a2['push']({'model':db[_0xef5e('0xd3')],'as':_0xef5e('0xd3'),'attributes':['id','fullname'],'raw':!![]});_0x4b03a2[_0xef5e('0xb1')]({'model':db[_0xef5e('0xd4')],'as':_0xef5e('0x65'),'attributes':['id','firstName',_0xef5e('0xd5')],'raw':!![]});var _0x145d24=[{'model':db['SmsMessage'],'as':_0xef5e('0xd6'),'attributes':['id','body','createdAt',_0xef5e('0xd7'),'secret',_0xef5e('0x7e')],'include':_0x4b03a2}];_0x145d24[_0xef5e('0xb1')]({'model':db['SmsAccount'],'as':_0xef5e('0xd8'),'attributes':['id',_0xef5e('0x28')]});_0x145d24['push']({'model':db[_0xef5e('0xd3')],'as':_0xef5e('0xd9'),'attributes':['id',_0xef5e('0x2c')]});return db[_0xef5e('0x9c')][_0xef5e('0x69')]({'where':{'id':_0x4b6452[_0xef5e('0xb4')]['id']},'include':_0x145d24})[_0xef5e('0x25')](handleEntityNotFound(_0x4ff6cb,null))['then'](function(_0x15c295){if(_0x15c295){var _0x41d658=_0x15c295[_0xef5e('0xda')]({'plain':!![]});fs[_0xef5e('0xdb')](_0x139a36);var _0x399343={'channel':_0xef5e('0xdc'),'account':_0x41d658[_0xef5e('0xd8')][_0xef5e('0x28')],'agent':_0x41d658['Owner']?_0x41d658['Owner']['fullname']:_0xef5e('0xdd'),'createdAt':moment(_0x41d658[_0xef5e('0x77')])[_0xef5e('0xc2')](_0xef5e('0xc3'))[_0xef5e('0x99')](),'closedAt':_0x41d658[_0xef5e('0x37')]?moment(_0x41d658[_0xef5e('0xde')])['format'](_0xef5e('0xc3'))[_0xef5e('0x99')]():'','disposition':_0x41d658[_0xef5e('0xdf')],'messages':_(_0x41d658[_0xef5e('0xd6')])['filter']({'secret':![]})[_0xef5e('0x2b')](function(_0x54960c){return{'date':moment(_0x54960c[_0xef5e('0x77')])[_0xef5e('0xc2')](_0xef5e('0xc3'))[_0xef5e('0x99')](),'sender':_0x54960c[_0xef5e('0xd7')]==='out'?_0x54960c[_0xef5e('0xd3')]?_0x54960c['User'][_0xef5e('0x2c')]:'System':_0x54960c[_0xef5e('0x65')]['firstName']+(_0x54960c[_0xef5e('0x65')][_0xef5e('0xd5')]?'\x20'+_0x54960c[_0xef5e('0x65')]['lastName']:''),'body':_0x54960c[_0xef5e('0x72')],'direction':_0x54960c[_0xef5e('0xd7')]===_0xef5e('0xe0')?'A':'C','secret':_0x54960c[_0xef5e('0xe1')],'read':_0x54960c['read']};})[_0xef5e('0x62')]()};return ejs[_0xef5e('0xe2')](path['join'](config[_0xef5e('0xcc')],_0xef5e('0xcd'),_0xef5e('0xe3'),_0xef5e('0xe4')),{'interaction':_0x399343})[_0xef5e('0x25')](function(_0x215329){var _0x512c23=path[_0xef5e('0xd1')](_0x139a36,_0xef5e('0xe5')+_0x41d658['id']+'-'+_0x1b0f8d+_0xef5e('0xe6'));var _0x43ce1a={'path':_0x512c23,'channel':_0xef5e('0xdc'),'interactionId':_0x41d658['id']};return pdf[_0xef5e('0xe7')](_0x215329,_0x43ce1a);})[_0xef5e('0x25')](function(){return new BPromise(function(_0x3fd870,_0x355afe){zipdir(_0x139a36,{'saveTo':_0x2b3b14},function(_0x1f4b75,_0x8c4e4b){if(_0x1f4b75)return _0x355afe(_0x1f4b75);return _0x3fd870(_0x8c4e4b);});})['then'](function(){return new BPromise(function(_0x2ce255,_0x40c2d3){rimraf(_0x139a36,function(_0x437c74){if(_0x437c74)_0x40c2d3(_0x437c74);return _0x2ce255();});});})[_0xef5e('0x25')](function(){return _0x4ff6cb[_0xef5e('0xca')](_0x2b3b14,_0x4d0bf3,function(_0xec28a2){if(_0xec28a2){console[_0xef5e('0xe8')]('err',_0xec28a2);}else{fs['unlinkSync'](_0x2b3b14);}});});});}else{return _0x4ff6cb['sendStatus'](0xc8);}})[_0xef5e('0x31')](handleError(_0x4ff6cb,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5e216b1..e66ab8c 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 _0x1775=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x5c4aa8,_0x55b4dc){var _0x8ab9e4=function(_0x7b0ce2){while(--_0x7b0ce2){_0x5c4aa8['push'](_0x5c4aa8['shift']());}};_0x8ab9e4(++_0x55b4dc);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5177('0x0'))['db'][_0x5177('0x1')];var SmsMessage=require(_0x5177('0x0'))['db'][_0x5177('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5177('0x3')](0x0);var events={'afterCreate':_0x5177('0x4'),'afterUpdate':_0x5177('0x5'),'afterDestroy':_0x5177('0x6')};function emitEvent(_0x359401){return function(_0x51275f,_0x159a20,_0x2c5c42){_0x51275f[_0x5177('0x7')]({'attributes':['id'],'raw':!![]})[_0x5177('0x8')](function(_0x300b43){_0x51275f[_0x5177('0x9')](_0x5177('0xa'),_0x300b43[_0x5177('0xb')](function(_0x16e7a7){return{'id':_0x16e7a7['id']};}));return SmsMessage[_0x5177('0xc')]({'where':{'SmsInteractionId':_0x51275f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5177('0x8')](function(_0x206035){_0x51275f['setDataValue']('unreadMessages',_0x206035[_0x5177('0xd')]);SmsInteractionEvents[_0x5177('0xe')](_0x359401+':'+_0x51275f['id'],_0x51275f);SmsInteractionEvents[_0x5177('0xe')](_0x359401,_0x51275f);_0x2c5c42(null);})[_0x5177('0xf')](_0x2c5c42(null));};}for(var e in events){if(events[_0x5177('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5177('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x6d11=['../../mysqldb','SmsInteraction','SmsMessage','save','update','getUsers','then','setDataValue','findAll','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x21afc6,_0x503054){var _0x5f2bae=function(_0x379bfb){while(--_0x379bfb){_0x21afc6['push'](_0x21afc6['shift']());}};_0x5f2bae(++_0x503054);}(_0x6d11,0xbf));var _0x16d1=function(_0x2d2e77,_0x5b3030){_0x2d2e77=_0x2d2e77-0x0;var _0x473583=_0x6d11[_0x2d2e77];return _0x473583;};'use strict';var EventEmitter=require(_0x16d1('0x0'));var SmsInteraction=require(_0x16d1('0x1'))['db'][_0x16d1('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x16d1('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16d1('0x4'),'afterUpdate':_0x16d1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x48754e){return function(_0x3e0e86,_0x46f7d7,_0x3eb9e2){_0x3e0e86[_0x16d1('0x6')]({'attributes':['id'],'raw':!![]})[_0x16d1('0x7')](function(_0x150217){_0x3e0e86[_0x16d1('0x8')]('Users',_0x150217['map'](function(_0x4fca47){return{'id':_0x4fca47['id']};}));return SmsMessage[_0x16d1('0x9')]({'where':{'SmsInteractionId':_0x3e0e86['id'],'direction':'in','read':![]},'raw':!![]});})[_0x16d1('0x7')](function(_0xe67758){_0x3e0e86[_0x16d1('0x8')]('unreadMessages',_0xe67758[_0x16d1('0xa')]);SmsInteractionEvents[_0x16d1('0xb')](_0x48754e+':'+_0x3e0e86['id'],_0x3e0e86);SmsInteractionEvents[_0x16d1('0xb')](_0x48754e,_0x3e0e86);_0x3eb9e2(null);})[_0x16d1('0xc')](_0x3eb9e2(null));};}for(var e in events){if(events[_0x16d1('0xd')](e)){var event=events[e];SmsInteraction[_0x16d1('0xe')](e,emitEvent(event));}}module[_0x16d1('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c0c92fa..07a79da 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 _0x4d2b=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed'];(function(_0x4e39e0,_0x5317d2){var _0x48bfb0=function(_0x2d2f3f){while(--_0x2d2f3f){_0x4e39e0['push'](_0x4e39e0['shift']());}};_0x48bfb0(++_0x5317d2);}(_0x4d2b,0x1cb));var _0xb4d2=function(_0x3823d1,_0x9e2a08){_0x3823d1=_0x3823d1-0x0;var _0x35c3a0=_0x4d2b[_0x3823d1];return _0x35c3a0;};'use strict';var _=require(_0xb4d2('0x0'));var util=require(_0xb4d2('0x1'));var logger=require(_0xb4d2('0x2'))(_0xb4d2('0x3'));var moment=require(_0xb4d2('0x4'));var BPromise=require(_0xb4d2('0x5'));var rp=require(_0xb4d2('0x6'));var fs=require('fs');var path=require(_0xb4d2('0x7'));var rimraf=require(_0xb4d2('0x8'));var config=require(_0xb4d2('0x9'));var attributes=require(_0xb4d2('0xa'));module[_0xb4d2('0xb')]=function(_0x526451,_0x2b0a00){return _0x526451[_0xb4d2('0xc')](_0xb4d2('0xd'),attributes,{'tableName':_0xb4d2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48c62d,_0x1a1d42,_0x203ca2){if(_0x48c62d[_0xb4d2('0xf')](_0xb4d2('0x10'))){_0x48c62d['closedAt']=moment()[_0xb4d2('0x11')](_0xb4d2('0x12'));}_0x203ca2(null,_0x48c62d);}}});}; \ No newline at end of file +var _0x6907=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','SmsInteraction','sms_interactions','changed','closed'];(function(_0xcdf809,_0x2881f0){var _0x4d4d70=function(_0x277c61){while(--_0x277c61){_0xcdf809['push'](_0xcdf809['shift']());}};_0x4d4d70(++_0x2881f0);}(_0x6907,0xd5));var _0x7690=function(_0x29b830,_0x419a6b){_0x29b830=_0x29b830-0x0;var _0xfc6657=_0x6907[_0x29b830];return _0xfc6657;};'use strict';var _=require('lodash');var util=require(_0x7690('0x0'));var logger=require(_0x7690('0x1'))(_0x7690('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7690('0x3'));var fs=require('fs');var path=require(_0x7690('0x4'));var rimraf=require(_0x7690('0x5'));var config=require(_0x7690('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x5709ff,_0xb9c88){return _0x5709ff['define'](_0x7690('0x7'),attributes,{'tableName':_0x7690('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x481dec,_0x135e1d,_0x451c9e){if(_0x481dec[_0x7690('0x9')](_0x7690('0xa'))){_0x481dec[_0x7690('0xb')]=moment()[_0x7690('0xc')](_0x7690('0xd'));}_0x451c9e(null,_0x481dec);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index faaa5d1..58e5fc5 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 _0x0f4c=['code','message','result','UpdateSmsInteraction','update','body','options','raw','attributes','debug','stringify','catch','AddTagsToSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','error'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x0f4c,0xe1));var _0xc0f4=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0x0f4c[_0x5ad771];return _0x5b5dce;};'use strict';var _=require(_0xc0f4('0x0'));var util=require(_0xc0f4('0x1'));var moment=require(_0xc0f4('0x2'));var BPromise=require(_0xc0f4('0x3'));var rs=require(_0xc0f4('0x4'));var fs=require('fs');var Redis=require(_0xc0f4('0x5'));var db=require(_0xc0f4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0f4('0x7'))('rpc');var config=require(_0xc0f4('0x8'));var jayson=require(_0xc0f4('0x9'));var client=jayson['client'][_0xc0f4('0xa')]({'port':0x232a});config[_0xc0f4('0xb')]=_[_0xc0f4('0xc')](config[_0xc0f4('0xb')],{'host':_0xc0f4('0xd'),'port':0x18eb});var socket=require(_0xc0f4('0xe'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1ad533,_0x2b96d8,_0x280830){return new BPromise(function(_0x44609a,_0x105cf5){return client[_0xc0f4('0xf')](_0x1ad533,_0x280830)[_0xc0f4('0x10')](function(_0x2fce06){logger[_0xc0f4('0x11')](_0xc0f4('0x12'),_0x2b96d8,_0xc0f4('0x13'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2b96d8,_0xc0f4('0x13'),JSON['stringify'](_0x2fce06));if(_0x2fce06['error']){if(_0x2fce06[_0xc0f4('0x14')][_0xc0f4('0x15')]===0x1f4){logger[_0xc0f4('0x14')](_0xc0f4('0x12'),_0x2b96d8,_0x2fce06[_0xc0f4('0x14')][_0xc0f4('0x16')]);return _0x105cf5(_0x2fce06[_0xc0f4('0x14')][_0xc0f4('0x16')]);}logger[_0xc0f4('0x14')](_0xc0f4('0x12'),_0x2b96d8,_0x2fce06[_0xc0f4('0x14')][_0xc0f4('0x16')]);return _0x44609a(_0x2fce06[_0xc0f4('0x14')]['message']);}else{logger[_0xc0f4('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x2b96d8,_0xc0f4('0x13'));_0x44609a(_0x2fce06[_0xc0f4('0x17')][_0xc0f4('0x16')]);}})['catch'](function(_0x1be93e){logger[_0xc0f4('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x2b96d8,_0x1be93e);_0x105cf5(_0x1be93e);});});}exports[_0xc0f4('0x18')]=function(_0x4761d6){var _0x50d4b2=this;return new Promise(function(_0x265c4c,_0x9b83c9){return db['SmsInteraction'][_0xc0f4('0x19')](_0x4761d6[_0xc0f4('0x1a')],{'raw':_0x4761d6['options']?_0x4761d6[_0xc0f4('0x1b')][_0xc0f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4761d6['options']?_0x4761d6[_0xc0f4('0x1b')]['where']||null:null,'attributes':_0x4761d6[_0xc0f4('0x1b')]?_0x4761d6['options'][_0xc0f4('0x1d')]||null:null,'limit':_0x4761d6[_0xc0f4('0x1b')]?_0x4761d6[_0xc0f4('0x1b')]['limit']||null:null})[_0xc0f4('0x10')](function(_0x3187cc){logger['info'](_0xc0f4('0x18'),_0x4761d6);logger[_0xc0f4('0x1e')](_0xc0f4('0x18'),_0x4761d6,JSON[_0xc0f4('0x1f')](_0x3187cc));_0x265c4c(_0x3187cc);})[_0xc0f4('0x20')](function(_0x4d29fd){logger[_0xc0f4('0x14')](_0xc0f4('0x18'),_0x4d29fd['message'],_0x4761d6);_0x9b83c9(_0x50d4b2[_0xc0f4('0x14')](0x1f4,_0x4d29fd[_0xc0f4('0x16')]));});});};exports[_0xc0f4('0x21')]=function(_0x4018ee){return new Promise(function(_0x7ab64b,_0x49373a){return db['SmsInteraction'][_0xc0f4('0x22')]({'where':_0x4018ee[_0xc0f4('0x1b')]?_0x4018ee[_0xc0f4('0x1b')][_0xc0f4('0x23')]||null:null})['then'](function(_0x22dcc4){if(_0x22dcc4){return _0x22dcc4[_0xc0f4('0x24')](_0x4018ee[_0xc0f4('0x1a')][_0xc0f4('0x25')],_[_0xc0f4('0x26')](_0x4018ee[_0xc0f4('0x1a')],[_0xc0f4('0x25'),'id'])||{});}})[_0xc0f4('0x27')](function(_0x2ce1b6){logger[_0xc0f4('0x11')](_0xc0f4('0x28'),_0x4018ee);logger[_0xc0f4('0x1e')](_0xc0f4('0x28'),_0x4018ee,JSON[_0xc0f4('0x1f')](_0x2ce1b6));_0x7ab64b(_0x2ce1b6);})[_0xc0f4('0x20')](function(_0x7593b){logger[_0xc0f4('0x14')](_0xc0f4('0x28'),_0x7593b['message'],_0x4018ee);_0x49373a(_this[_0xc0f4('0x14')](0x1f4,_0x7593b['message']));});});}; \ No newline at end of file +var _0xe63b=['addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','then','catch','AddTagsToSmsInteraction','find'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0xe63b,0x14d));var _0xbe63=function(_0x42d2af,_0x3961b5){_0x42d2af=_0x42d2af-0x0;var _0x1d6d63=_0xe63b[_0x42d2af];return _0x1d6d63;};'use strict';var _=require(_0xbe63('0x0'));var util=require(_0xbe63('0x1'));var moment=require(_0xbe63('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe63('0x3'));var db=require(_0xbe63('0x4'))['db'];var utils=require(_0xbe63('0x5'));var logger=require(_0xbe63('0x6'))('rpc');var config=require(_0xbe63('0x7'));var jayson=require(_0xbe63('0x8'));var client=jayson[_0xbe63('0x9')]['http']({'port':0x232a});config[_0xbe63('0xa')]=_[_0xbe63('0xb')](config[_0xbe63('0xa')],{'host':_0xbe63('0xc'),'port':0x18eb});var socket=require(_0xbe63('0xd'))(new Redis(config['redis']));require(_0xbe63('0xe'))[_0xbe63('0xf')](socket);function respondWithRpcPromise(_0x2af19c,_0x213e4a,_0xbedfd9){return new BPromise(function(_0x12667a,_0xf1798a){return client['request'](_0x2af19c,_0xbedfd9)['then'](function(_0x1173c0){logger[_0xbe63('0x10')](_0xbe63('0x11'),_0x213e4a,_0xbe63('0x12'));logger[_0xbe63('0x13')](_0xbe63('0x14'),_0x213e4a,_0xbe63('0x12'),JSON[_0xbe63('0x15')](_0x1173c0));if(_0x1173c0[_0xbe63('0x16')]){if(_0x1173c0[_0xbe63('0x16')]['code']===0x1f4){logger[_0xbe63('0x16')](_0xbe63('0x11'),_0x213e4a,_0x1173c0[_0xbe63('0x16')][_0xbe63('0x17')]);return _0xf1798a(_0x1173c0[_0xbe63('0x16')][_0xbe63('0x17')]);}logger['error'](_0xbe63('0x11'),_0x213e4a,_0x1173c0[_0xbe63('0x16')]['message']);return _0x12667a(_0x1173c0[_0xbe63('0x16')][_0xbe63('0x17')]);}else{logger['info'](_0xbe63('0x11'),_0x213e4a,_0xbe63('0x12'));_0x12667a(_0x1173c0['result'][_0xbe63('0x17')]);}})['catch'](function(_0x56bb2f){logger[_0xbe63('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x213e4a,_0x56bb2f);_0xf1798a(_0x56bb2f);});});}exports[_0xbe63('0x18')]=function(_0x53a65e){var _0x1e71fe=this;return new Promise(function(_0x201b29,_0x28bc0c){return db[_0xbe63('0x19')][_0xbe63('0x1a')](_0x53a65e[_0xbe63('0x1b')],{'raw':_0x53a65e[_0xbe63('0x1c')]?_0x53a65e[_0xbe63('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53a65e['options']?_0x53a65e[_0xbe63('0x1c')][_0xbe63('0x1d')]||null:null,'attributes':_0x53a65e[_0xbe63('0x1c')]?_0x53a65e['options'][_0xbe63('0x1e')]||null:null,'limit':_0x53a65e[_0xbe63('0x1c')]?_0x53a65e[_0xbe63('0x1c')][_0xbe63('0x1f')]||null:null})[_0xbe63('0x20')](function(_0x47f81a){logger[_0xbe63('0x10')](_0xbe63('0x18'),_0x53a65e);logger['debug'](_0xbe63('0x18'),_0x53a65e,JSON[_0xbe63('0x15')](_0x47f81a));_0x201b29(_0x47f81a);})[_0xbe63('0x21')](function(_0x4e8187){logger[_0xbe63('0x16')](_0xbe63('0x18'),_0x4e8187[_0xbe63('0x17')],_0x53a65e);_0x28bc0c(_0x1e71fe[_0xbe63('0x16')](0x1f4,_0x4e8187[_0xbe63('0x17')]));});});};exports[_0xbe63('0x22')]=function(_0x21a75f){return new Promise(function(_0x471bba,_0x2d5831){return db[_0xbe63('0x19')][_0xbe63('0x23')]({'where':_0x21a75f['options']?_0x21a75f[_0xbe63('0x1c')]['where']||null:null})['then'](function(_0x2d0b3b){if(_0x2d0b3b){return _0x2d0b3b[_0xbe63('0x24')](_0x21a75f[_0xbe63('0x1b')][_0xbe63('0x25')],_[_0xbe63('0x26')](_0x21a75f[_0xbe63('0x1b')],[_0xbe63('0x25'),'id'])||{});}})[_0xbe63('0x27')](function(_0x3d9ef7){logger[_0xbe63('0x10')](_0xbe63('0x28'),_0x21a75f);logger[_0xbe63('0x13')](_0xbe63('0x28'),_0x21a75f,JSON['stringify'](_0x3d9ef7));_0x471bba(_0x3d9ef7);})[_0xbe63('0x21')](function(_0x2b0491){logger[_0xbe63('0x16')](_0xbe63('0x28'),_0x2b0491[_0xbe63('0x17')],_0x21a75f);_0x2d5831(_this[_0xbe63('0x16')](0x1f4,_0x2b0491[_0xbe63('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 158f191..bf3f7af 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 _0xbe08=['./smsInteraction.events','save','remove','update','length','smsInteraction:'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xbe08,0x102));var _0x8be0=function(_0x5e2d91,_0x54ae3e){_0x5e2d91=_0x5e2d91-0x0;var _0x54438f=_0xbe08[_0x5e2d91];return _0x54438f;};'use strict';var SmsInteractionEvents=require(_0x8be0('0x0'));var events=[_0x8be0('0x1'),_0x8be0('0x2'),_0x8be0('0x3')];function createListener(_0x41e233,_0x2ff8e6){return function(_0x5b2824){_0x2ff8e6['emit'](_0x41e233,_0x5b2824);};}function removeListener(_0x32b0b0,_0xcee118){return function(){SmsInteractionEvents['removeListener'](_0x32b0b0,_0xcee118);};}exports['register']=function(_0x5ae2bc){for(var _0x14652c=0x0,_0xc20ba6=events[_0x8be0('0x4')];_0x14652c<_0xc20ba6;_0x14652c++){var _0x287634=events[_0x14652c];var _0x294a34=createListener(_0x8be0('0x5')+_0x287634,_0x5ae2bc);SmsInteractionEvents['on'](_0x287634,_0x294a34);}}; \ No newline at end of file +var _0x647f=['remove','update','emit','removeListener','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x647f,0xf6));var _0xf647=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x647f[_0x3dd15e];return _0x231fd0;};'use strict';var SmsInteractionEvents=require(_0xf647('0x0'));var events=[_0xf647('0x1'),_0xf647('0x2'),_0xf647('0x3')];function createListener(_0x2d7d61,_0x2ddbc4){return function(_0x552509){_0x2ddbc4[_0xf647('0x4')](_0x2d7d61,_0x552509);};}function removeListener(_0x5d3932,_0x202a61){return function(){SmsInteractionEvents[_0xf647('0x5')](_0x5d3932,_0x202a61);};}exports['register']=function(_0x73e4b7){for(var _0x5e6c3b=0x0,_0x10933f=events[_0xf647('0x6')];_0x5e6c3b<_0x10933f;_0x5e6c3b++){var _0x4bac33=events[_0x5e6c3b];var _0x2d5afc=createListener(_0xf647('0x7')+_0x4bac33,_0x73e4b7);SmsInteractionEvents['on'](_0x4bac33,_0x2d5afc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 9c88321..b3cfe19 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 _0x69a4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','sms','smsmessage:create','create','/:id/status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x26a393,_0x1d9e55){var _0x2040a4=function(_0x2edf66){while(--_0x2edf66){_0x26a393['push'](_0x26a393['shift']());}};_0x2040a4(++_0x1d9e55);}(_0x69a4,0x1cb));var _0x469a=function(_0x2e787c,_0x5d253a){_0x2e787c=_0x2e787c-0x0;var _0x568a7a=_0x69a4[_0x2e787c];return _0x568a7a;};'use strict';var multer=require(_0x469a('0x0'));var util=require('util');var path=require(_0x469a('0x1'));var timeout=require(_0x469a('0x2'));var express=require(_0x469a('0x3'));var router=express[_0x469a('0x4')]();var fs_extra=require(_0x469a('0x5'));var auth=require(_0x469a('0x6'));var interaction=require(_0x469a('0x7'));var config=require(_0x469a('0x8'));var controller=require(_0x469a('0x9'));router[_0x469a('0xa')]('/',auth['isAuthenticated'](),controller[_0x469a('0xb')]);router['get']('/describe',auth[_0x469a('0xc')](),controller[_0x469a('0xd')]);router[_0x469a('0xa')](_0x469a('0xe'),auth[_0x469a('0xc')](),controller['show']);router[_0x469a('0xf')]('/',auth[_0x469a('0xc')](),interaction[_0x469a('0x10')](_0x469a('0x11'),_0x469a('0x12')),controller[_0x469a('0x13')]);router[_0x469a('0xf')](_0x469a('0x14'),controller['status']);router[_0x469a('0x15')](_0x469a('0xe'),auth['isAuthenticated'](),controller[_0x469a('0x16')]);router[_0x469a('0x15')]('/:id/accept',auth[_0x469a('0xc')](),controller[_0x469a('0x17')]);router[_0x469a('0x15')](_0x469a('0x18'),auth[_0x469a('0xc')](),controller[_0x469a('0x19')]);router[_0x469a('0x1a')](_0x469a('0xe'),auth['isAuthenticated'](),controller[_0x469a('0x1b')]);module[_0x469a('0x1c')]=router; \ No newline at end of file +var _0xc4b0=['post','tracked','create','update','put','/:id/accept','/:id/reject','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','show'];(function(_0x488315,_0x571c63){var _0x117a44=function(_0x5d4381){while(--_0x5d4381){_0x488315['push'](_0x488315['shift']());}};_0x117a44(++_0x571c63);}(_0xc4b0,0xfb));var _0x0c4b=function(_0x2faf63,_0x43ea11){_0x2faf63=_0x2faf63-0x0;var _0x56d9ce=_0xc4b0[_0x2faf63];return _0x56d9ce;};'use strict';var multer=require(_0x0c4b('0x0'));var util=require('util');var path=require(_0x0c4b('0x1'));var timeout=require(_0x0c4b('0x2'));var express=require(_0x0c4b('0x3'));var router=express[_0x0c4b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0c4b('0x5'));var interaction=require(_0x0c4b('0x6'));var config=require(_0x0c4b('0x7'));var controller=require(_0x0c4b('0x8'));router[_0x0c4b('0x9')]('/',auth[_0x0c4b('0xa')](),controller[_0x0c4b('0xb')]);router['get']('/describe',auth[_0x0c4b('0xa')](),controller['describe']);router[_0x0c4b('0x9')]('/:id',auth[_0x0c4b('0xa')](),controller[_0x0c4b('0xc')]);router[_0x0c4b('0xd')]('/',auth['isAuthenticated'](),interaction[_0x0c4b('0xe')]('sms','smsmessage:create'),controller[_0x0c4b('0xf')]);router[_0x0c4b('0xd')]('/:id/status',controller['status']);router['put']('/:id',auth[_0x0c4b('0xa')](),controller[_0x0c4b('0x10')]);router[_0x0c4b('0x11')](_0x0c4b('0x12'),auth[_0x0c4b('0xa')](),controller['accept']);router[_0x0c4b('0x11')](_0x0c4b('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x0c4b('0x14')](_0x0c4b('0x15'),auth[_0x0c4b('0xa')](),controller[_0x0c4b('0x16')]);module[_0x0c4b('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index be795ad..b5467f4 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 _0xe52b=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x1572de,_0x256ee0){var _0x145ec6=function(_0x2bb7a7){while(--_0x2bb7a7){_0x1572de['push'](_0x1572de['shift']());}};_0x145ec6(++_0x256ee0);}(_0xe52b,0x132));var _0xbe52=function(_0x5a6874,_0x32fd97){_0x5a6874=_0x5a6874-0x0;var _0x2888b4=_0xe52b[_0x5a6874];return _0x2888b4;};'use strict';var Sequelize=require(_0xbe52('0x0'));module[_0xbe52('0x1')]={'body':{'type':Sequelize[_0xbe52('0x2')](_0xbe52('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbe52('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbe52('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xbe52('0x6')]},'readAt':{'type':Sequelize[_0xbe52('0x7')]},'secret':{'type':Sequelize[_0xbe52('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbe52('0x2')]}}; \ No newline at end of file +var _0xb854=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x23edcf,_0x1e22c1){var _0x87a81d=function(_0x1a78f2){while(--_0x1a78f2){_0x23edcf['push'](_0x23edcf['shift']());}};_0x87a81d(++_0x1e22c1);}(_0xb854,0x151));var _0x4b85=function(_0x1c4c1e,_0x37ae2c){_0x1c4c1e=_0x1c4c1e-0x0;var _0x308b62=_0xb854[_0x1c4c1e];return _0x308b62;};'use strict';var Sequelize=require(_0x4b85('0x0'));module[_0x4b85('0x1')]={'body':{'type':Sequelize[_0x4b85('0x2')](_0x4b85('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4b85('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4b85('0x5')]('in',_0x4b85('0x6')),'defaultValue':_0x4b85('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4b85('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x4b85('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4b85('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index cc93c90..1fb8def 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 _0xe643=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','request','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','SmsMessage','findAll','rows','catch','show','fields','find','create','body','params','destroy','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','agent','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','sequelize','SELECT','contact','User','interface','event','rejectmessage','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','delivered','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x40f521,_0xf2a143){var _0x1c5f53=function(_0x332878){while(--_0x332878){_0x40f521['push'](_0x40f521['shift']());}};_0x1c5f53(++_0xf2a143);}(_0xe643,0x84));var _0x3e64=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe643[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x3e64('0x0'));var rimraf=require(_0x3e64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e64('0x2'));var rp=require('request-promise');var moment=require(_0x3e64('0x3'));var BPromise=require(_0x3e64('0x4'));var Mustache=require(_0x3e64('0x5'));var util=require(_0x3e64('0x6'));var path=require(_0x3e64('0x7'));var sox=require('sox');var csv=require(_0x3e64('0x8'));var ejs=require(_0x3e64('0x9'));var fs=require('fs');var fs_extra=require(_0x3e64('0xa'));var _=require(_0x3e64('0xb'));var squel=require(_0x3e64('0xc'));var crypto=require(_0x3e64('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3e64('0xe'));var toCsv=require(_0x3e64('0x8'));var querystring=require(_0x3e64('0xf'));var Papa=require(_0x3e64('0x10'));var Redis=require(_0x3e64('0x11'));var authService=require(_0x3e64('0x12'));var qs=require(_0x3e64('0x13'));var as=require(_0x3e64('0x14'));var hardwareService=require(_0x3e64('0x15'));var logger=require(_0x3e64('0x16'))('api');var utils=require(_0x3e64('0x17'));var config=require(_0x3e64('0x18'));var licenseUtil=require(_0x3e64('0x19'));var db=require(_0x3e64('0x1a'))['db'];config[_0x3e64('0x1b')]=_[_0x3e64('0x1c')](config[_0x3e64('0x1b')],{'host':_0x3e64('0x1d'),'port':0x18eb});var socket=require(_0x3e64('0x1e'))(new Redis(config['redis']));require(_0x3e64('0x1f'))[_0x3e64('0x20')](socket);var jayson=require(_0x3e64('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a8488,_0x4d58da,_0x3764fb,_0x2a4a2b){return new BPromise(function(_0x3992db,_0x1770a7){var _0x395fd6=_0x2a4a2b||client;return _0x395fd6[_0x3e64('0x22')](_0x4a8488,_0x3764fb)[_0x3e64('0x23')](function(_0x4659e8){logger[_0x3e64('0x24')]('SmsMessage,\x20%s,\x20%s',_0x4d58da,_0x3e64('0x25'));logger['debug'](_0x3e64('0x26'),_0x4d58da,_0x3e64('0x25'),JSON[_0x3e64('0x27')](_0x4659e8));if(_0x4659e8['error']){if(_0x4659e8[_0x3e64('0x28')][_0x3e64('0x29')]===0x1f4){logger[_0x3e64('0x28')](_0x3e64('0x2a'),_0x4d58da,_0x4659e8[_0x3e64('0x28')][_0x3e64('0x2b')]);return _0x1770a7(_0x4659e8[_0x3e64('0x28')]['message']);}logger['error'](_0x3e64('0x2a'),_0x4d58da,_0x4659e8[_0x3e64('0x28')][_0x3e64('0x2b')]);return _0x3992db(_0x4659e8[_0x3e64('0x28')][_0x3e64('0x2b')]);}else{logger[_0x3e64('0x24')](_0x3e64('0x2a'),_0x4d58da,_0x3e64('0x25'));_0x3992db(_0x4659e8[_0x3e64('0x2c')][_0x3e64('0x2b')]);}})['catch'](function(_0x308448){logger[_0x3e64('0x28')](_0x3e64('0x2a'),_0x4d58da,_0x308448);_0x1770a7(_0x308448);});});}function respondWithStatusCode(_0x37eb70,_0x284179){_0x284179=_0x284179||0xcc;return function(_0x13db72){if(_0x13db72){return _0x37eb70['sendStatus'](_0x284179);}return _0x37eb70[_0x3e64('0x2d')](_0x284179)[_0x3e64('0x2e')]();};}function respondWithResult(_0x5e7614,_0x32e35b){_0x32e35b=_0x32e35b||0xc8;return function(_0x30b402){if(_0x30b402){return _0x5e7614['status'](_0x32e35b)[_0x3e64('0x2f')](_0x30b402);}};}function respondWithFilteredResult(_0x1355e0,_0x35597f){return function(_0x30f7a2){if(_0x30f7a2){var _0x3933a9=typeof _0x35597f[_0x3e64('0x30')]===_0x3e64('0x31')&&typeof _0x35597f[_0x3e64('0x32')]===_0x3e64('0x31');var _0x5e7dd7=_0x30f7a2[_0x3e64('0x33')];var _0x2c4362=_0x3933a9?0x0:_0x35597f[_0x3e64('0x30')];var _0xcc78bf=_0x3933a9?_0x30f7a2[_0x3e64('0x33')]:_0x35597f[_0x3e64('0x30')]+_0x35597f[_0x3e64('0x32')];var _0x17eff9;if(_0xcc78bf>=_0x5e7dd7){_0xcc78bf=_0x5e7dd7;_0x17eff9=0xc8;}else{_0x17eff9=0xce;}_0x1355e0[_0x3e64('0x2d')](_0x17eff9);return _0x1355e0[_0x3e64('0x34')](_0x3e64('0x35'),_0x2c4362+'-'+_0xcc78bf+'/'+_0x5e7dd7)['json'](_0x30f7a2);}return null;};}function patchUpdates(_0x24d3fa){return function(_0x15feff){try{jsonpatch[_0x3e64('0x36')](_0x15feff,_0x24d3fa,!![]);}catch(_0x48fecd){return BPromise[_0x3e64('0x37')](_0x48fecd);}return _0x15feff[_0x3e64('0x38')]();};}function saveUpdates(_0x268cd9,_0x237860){return function(_0x1926ac){if(_0x1926ac){return _0x1926ac[_0x3e64('0x39')](_0x268cd9)[_0x3e64('0x23')](function(_0x5972bf){return _0x5972bf;});}return null;};}function removeEntity(_0x205518,_0x31bf5d){return function(_0x163e4e){if(_0x163e4e){return _0x163e4e['destroy']()['then'](function(){_0x205518[_0x3e64('0x2d')](0xcc)[_0x3e64('0x2e')]();});}};}function handleEntityNotFound(_0x426a8d,_0x13033c){return function(_0x17bfda){if(!_0x17bfda){_0x426a8d[_0x3e64('0x3a')](0x194);}return _0x17bfda;};}function handleError(_0x28c336,_0x7fa1a4){_0x7fa1a4=_0x7fa1a4||0x1f4;return function(_0x586ae6){logger[_0x3e64('0x28')](_0x586ae6[_0x3e64('0x3b')]);if(_0x586ae6[_0x3e64('0x3c')]){delete _0x586ae6[_0x3e64('0x3c')];}_0x28c336[_0x3e64('0x2d')](_0x7fa1a4)[_0x3e64('0x3d')](_0x586ae6);};}exports[_0x3e64('0x3e')]=function(_0x592a6c,_0x1d096f){var _0x3aa01f={},_0xc5a8c7={},_0x5bceba={'count':0x0,'rows':[]};var _0x46383d=_[_0x3e64('0x3f')](db['SmsMessage'][_0x3e64('0x40')],function(_0x3b88f0){return{'name':_0x3b88f0[_0x3e64('0x41')],'type':_0x3b88f0[_0x3e64('0x42')]['key']};});_0xc5a8c7['model']=_[_0x3e64('0x3f')](_0x46383d,_0x3e64('0x3c'));_0xc5a8c7[_0x3e64('0x43')]=_[_0x3e64('0x44')](_0x592a6c['query']);_0xc5a8c7[_0x3e64('0x45')]=_[_0x3e64('0x46')](_0xc5a8c7['model'],_0xc5a8c7['query']);_0x3aa01f[_0x3e64('0x47')]=_[_0x3e64('0x46')](_0xc5a8c7[_0x3e64('0x48')],qs['fields'](_0x592a6c[_0x3e64('0x43')]['fields']));_0x3aa01f['attributes']=_0x3aa01f[_0x3e64('0x47')][_0x3e64('0x49')]?_0x3aa01f[_0x3e64('0x47')]:_0xc5a8c7[_0x3e64('0x48')];if(!_0x592a6c['query']['hasOwnProperty'](_0x3e64('0x4a'))){_0x3aa01f[_0x3e64('0x32')]=qs['limit'](_0x592a6c[_0x3e64('0x43')][_0x3e64('0x32')]);_0x3aa01f[_0x3e64('0x30')]=qs[_0x3e64('0x30')](_0x592a6c[_0x3e64('0x43')][_0x3e64('0x30')]);}_0x3aa01f[_0x3e64('0x4b')]=qs[_0x3e64('0x4c')](_0x592a6c[_0x3e64('0x43')][_0x3e64('0x4c')]);_0x3aa01f['where']=qs['filters'](_[_0x3e64('0x4d')](_0x592a6c[_0x3e64('0x43')],_0xc5a8c7['filters']),_0x46383d);if(_0x592a6c['query'][_0x3e64('0x4e')]){_0x3aa01f[_0x3e64('0x4f')]=_[_0x3e64('0x50')](_0x3aa01f[_0x3e64('0x4f')],{'$or':_[_0x3e64('0x3f')](_0x46383d,function(_0x4912d7){if(_0x4912d7[_0x3e64('0x42')]!==_0x3e64('0x51')){var _0x32a1c9={};_0x32a1c9[_0x4912d7[_0x3e64('0x3c')]]={'$like':'%'+_0x592a6c['query']['filter']+'%'};return _0x32a1c9;}})});}_0x3aa01f=_['merge']({},_0x3aa01f,_0x592a6c[_0x3e64('0x52')]);var _0x1b9bc0={'where':_0x3aa01f[_0x3e64('0x4f')]};return db['SmsMessage'][_0x3e64('0x33')](_0x1b9bc0)[_0x3e64('0x23')](function(_0x21914f){_0x5bceba[_0x3e64('0x33')]=_0x21914f;if(_0x592a6c[_0x3e64('0x43')][_0x3e64('0x53')]){_0x3aa01f[_0x3e64('0x54')]=[{'all':!![]}];}return db[_0x3e64('0x55')][_0x3e64('0x56')](_0x3aa01f);})['then'](function(_0x386bed){_0x5bceba[_0x3e64('0x57')]=_0x386bed;return _0x5bceba;})[_0x3e64('0x23')](respondWithFilteredResult(_0x1d096f,_0x3aa01f))[_0x3e64('0x58')](handleError(_0x1d096f,null));};exports[_0x3e64('0x59')]=function(_0x1b4488,_0x5a5ae3){var _0x482509={'raw':!![],'where':{'id':_0x1b4488['params']['id']}},_0x519dcd={};_0x519dcd[_0x3e64('0x48')]=_[_0x3e64('0x44')](db['SmsMessage'][_0x3e64('0x40')]);_0x519dcd[_0x3e64('0x43')]=_['keys'](_0x1b4488['query']);_0x519dcd[_0x3e64('0x45')]=_['intersection'](_0x519dcd[_0x3e64('0x48')],_0x519dcd['query']);_0x482509[_0x3e64('0x47')]=_[_0x3e64('0x46')](_0x519dcd[_0x3e64('0x48')],qs[_0x3e64('0x5a')](_0x1b4488[_0x3e64('0x43')][_0x3e64('0x5a')]));_0x482509[_0x3e64('0x47')]=_0x482509[_0x3e64('0x47')][_0x3e64('0x49')]?_0x482509[_0x3e64('0x47')]:_0x519dcd[_0x3e64('0x48')];if(_0x1b4488['query']['includeAll']){_0x482509['include']=[{'all':!![]}];}_0x482509=_[_0x3e64('0x50')]({},_0x482509,_0x1b4488[_0x3e64('0x52')]);return db[_0x3e64('0x55')][_0x3e64('0x5b')](_0x482509)[_0x3e64('0x23')](handleEntityNotFound(_0x5a5ae3,null))[_0x3e64('0x23')](respondWithResult(_0x5a5ae3,null))['catch'](handleError(_0x5a5ae3,null));};exports[_0x3e64('0x5c')]=function(_0x245091,_0x670dfd){return db[_0x3e64('0x55')]['create'](_0x245091[_0x3e64('0x5d')],{})[_0x3e64('0x23')](respondWithResult(_0x670dfd,0xc9))[_0x3e64('0x58')](handleError(_0x670dfd,null));};exports[_0x3e64('0x39')]=function(_0x128279,_0x1db8ef){if(_0x128279[_0x3e64('0x5d')]['id']){delete _0x128279[_0x3e64('0x5d')]['id'];}return db[_0x3e64('0x55')][_0x3e64('0x5b')]({'where':{'id':_0x128279[_0x3e64('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1db8ef,null))[_0x3e64('0x23')](saveUpdates(_0x128279[_0x3e64('0x5d')],null))[_0x3e64('0x23')](respondWithResult(_0x1db8ef,null))[_0x3e64('0x58')](handleError(_0x1db8ef,null));};exports[_0x3e64('0x5f')]=function(_0x1fc719,_0x114845){return db[_0x3e64('0x55')][_0x3e64('0x5b')]({'where':{'id':_0x1fc719['params']['id']}})[_0x3e64('0x23')](handleEntityNotFound(_0x114845,null))[_0x3e64('0x23')](removeEntity(_0x114845,null))[_0x3e64('0x58')](handleError(_0x114845,null));};exports[_0x3e64('0x60')]=function(_0x15cf0c,_0x517443){return db['SmsMessage']['describe']()[_0x3e64('0x23')](respondWithResult(_0x517443,null))['catch'](handleError(_0x517443,null));};var interaction_log=require(_0x3e64('0x16'))(_0x3e64('0x61'));exports['accept']=function(_0x5e9bb2,_0x2c1092,_0x3af98b){var _0x5f65c5={'agent':{},'channel':_0x3e64('0x62')};if(_0x5e9bb2[_0x3e64('0x5d')]['id']){delete _0x5e9bb2[_0x3e64('0x5d')]['id'];}_0x5e9bb2[_0x3e64('0x5d')][_0x3e64('0x63')]=!![];_0x5e9bb2[_0x3e64('0x5d')]['readAt']=moment()[_0x3e64('0x64')](_0x3e64('0x65'));_0x5e9bb2[_0x3e64('0x5d')][_0x3e64('0x66')]=_0x5e9bb2['body'][_0x3e64('0x66')]||_0x5e9bb2['user']['id'];_0x5f65c5['agent']['id']=_0x5e9bb2[_0x3e64('0x5d')][_0x3e64('0x66')];return db['SmsMessage'][_0x3e64('0x5b')]({'where':{'id':_0x5e9bb2[_0x3e64('0x5e')]['id'],'UserId':null}})[_0x3e64('0x23')](handleEntityNotFound(_0x2c1092,null))[_0x3e64('0x23')](saveUpdates(_0x5e9bb2[_0x3e64('0x5d')],null))[_0x3e64('0x23')](function(_0x2280fe){if(_0x2280fe){_0x5f65c5[_0x3e64('0x2b')]=_0x2280fe[_0x3e64('0x67')]({'plain':!![]});return db[_0x3e64('0x68')][_0x3e64('0x5b')]({'where':{'id':_0x2280fe[_0x3e64('0x69')]}});}return null;})[_0x3e64('0x23')](handleEntityNotFound(_0x2c1092,null))[_0x3e64('0x23')](function(_0x2fd355){if(_0x2fd355){return _0x2fd355[_0x3e64('0x39')]({'UserId':_0x5e9bb2[_0x3e64('0x5d')][_0x3e64('0x66')],'read1stAt':_[_0x3e64('0x6a')](_0x2fd355[_0x3e64('0x6b')])?moment()['format'](_0x3e64('0x65')):undefined});}return null;})[_0x3e64('0x23')](function(_0x43e427){if(_0x43e427){_0x5f65c5['interaction']=_0x43e427[_0x3e64('0x67')]({'plain':!![]});interaction_log[_0x3e64('0x24')](_0x3e64('0x6c'),_0x5e9bb2[_0x3e64('0x6d')]['id'],_0x5e9bb2[_0x3e64('0x6d')]['name'],_0x5e9bb2[_0x3e64('0x6d')][_0x3e64('0x6e')],_0x5f65c5[_0x3e64('0x6f')]['id'],_0x5e9bb2['body']?JSON[_0x3e64('0x27')](_0x5e9bb2[_0x3e64('0x5d')]):_0x3e64('0x70'));return respondWithRpcPromise(_0x3e64('0x71'),'acceptMessage',_0x5f65c5);}return null;})[_0x3e64('0x23')](function(_0x5116f5){var _0x295717=_0x3e64('0x72')+_0x5116f5[_0x3e64('0x2b')]['ContactId'];return db['sequelize'][_0x3e64('0x43')](_0x295717,{'type':db[_0x3e64('0x73')][_0x3e64('0x74')]['SELECT'],'raw':!![]})['then'](function(_0x5bd453){return _0x5bd453;});})[_0x3e64('0x23')](function(_0x1a2593){if(_0x1a2593){_0x5f65c5[_0x3e64('0x2b')]['contact']=_0x1a2593[0x0];if(!_0x5e9bb2[_0x3e64('0x5d')][_0x3e64('0x66')])return;return db['User'][_0x3e64('0x5b')]({'where':{'id':_0x5e9bb2['body'][_0x3e64('0x66')],'role':_0x3e64('0x75')},'attributes':['id','name','fullname',_0x3e64('0x76'),_0x3e64('0x77')],'raw':!![]});}return null;})[_0x3e64('0x23')](function(_0x1bee64){if(!_0x1bee64)return null;_0x5f65c5[_0x3e64('0x2b')][_0x3e64('0x75')]=_0x1bee64;return _0x5f65c5;})['then'](function(_0x55e27d){if(_0x55e27d){if(_0x5e9bb2[_0x3e64('0x5d')][_0x3e64('0x78')]){_0x5f65c5[_0x3e64('0x2b')]['interface']=util[_0x3e64('0x64')](_0x3e64('0x79'),_0x5e9bb2[_0x3e64('0x6d')][_0x3e64('0x3c')]);_0x5f65c5[_0x3e64('0x2b')][_0x3e64('0x7a')]=_0x5f65c5[_0x3e64('0x7a')];_0x5f65c5[_0x3e64('0x2b')][_0x3e64('0x7b')]=_0x5f65c5[_0x3e64('0x7a')];_0x5f65c5[_0x3e64('0x2b')]['event']='accept';return respondWithRpcPromise(_0x3e64('0x7c'),'EventManager',{'event':_0x3e64('0x7d'),'message':_0x5f65c5[_0x3e64('0x2b')]},client9002)[_0x3e64('0x23')](function(){return _0x5f65c5;});}return _0x5f65c5;}return null;})[_0x3e64('0x23')](respondWithResult(_0x2c1092,null))[_0x3e64('0x58')](handleError(_0x2c1092,null));};var interaction_log=require(_0x3e64('0x16'))('sms-interactions');exports['reject']=function(_0x166493,_0x3be9f3,_0x4ad7ff){var _0xeeb231={'agent':{},'channel':_0x3e64('0x62')};if(_0x166493[_0x3e64('0x5d')]['id']){delete _0x166493[_0x3e64('0x5d')]['id'];}_0x166493[_0x3e64('0x5d')][_0x3e64('0x66')]=_0x166493['body']['UserId']||_0x166493[_0x3e64('0x6d')]['id'];_0xeeb231[_0x3e64('0x75')]['id']=_0x166493['body'][_0x3e64('0x66')];return db[_0x3e64('0x55')][_0x3e64('0x5b')]({'where':{'id':_0x166493[_0x3e64('0x5e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3be9f3,null))[_0x3e64('0x23')](function(_0x3346a9){if(_0x3346a9){_0xeeb231[_0x3e64('0x2b')]=_0x3346a9[_0x3e64('0x67')]({'plain':!![]});return db[_0x3e64('0x68')][_0x3e64('0x5b')]({'where':{'id':_0x3346a9['SmsInteractionId']}});}return null;})[_0x3e64('0x23')](handleEntityNotFound(_0x3be9f3,null))['then'](function(_0x4bf60c){if(_0x4bf60c){_0xeeb231[_0x3e64('0x6f')]=_0x4bf60c['get']({'plain':!![]});interaction_log[_0x3e64('0x24')](_0x3e64('0x7e'),_0x166493[_0x3e64('0x6d')]['id'],_0x166493[_0x3e64('0x6d')]['name'],_0x166493[_0x3e64('0x6d')][_0x3e64('0x6e')],_0xeeb231[_0x3e64('0x6f')]['id'],_0x166493[_0x3e64('0x5d')]?JSON[_0x3e64('0x27')](_0x166493[_0x3e64('0x5d')]):_0x3e64('0x70'));return respondWithRpcPromise('RejectMessage',_0x3e64('0x7f'),_0xeeb231);}return null;})[_0x3e64('0x23')](function(_0x36795b){var _0x4f8685=_0x3e64('0x72')+_0x36795b[_0x3e64('0x2b')][_0x3e64('0x80')];return db[_0x3e64('0x81')]['query'](_0x4f8685,{'type':db[_0x3e64('0x73')][_0x3e64('0x74')][_0x3e64('0x82')],'raw':!![]})[_0x3e64('0x23')](function(_0xede73a){return _0xede73a;});})['then'](function(_0x3cd566){if(_0x3cd566){_0xeeb231[_0x3e64('0x2b')][_0x3e64('0x83')]=_0x3cd566[0x0];if(!_0x166493[_0x3e64('0x5d')][_0x3e64('0x66')])return;return db[_0x3e64('0x84')][_0x3e64('0x5b')]({'where':{'id':_0x166493['body']['UserId'],'role':_0x3e64('0x75')},'attributes':['id','name','fullname',_0x3e64('0x76'),_0x3e64('0x77')],'raw':!![]});}return null;})[_0x3e64('0x23')](function(_0x1265ae){if(!_0x1265ae)return null;_0xeeb231[_0x3e64('0x2b')]['agent']=_0x1265ae;return _0xeeb231;})[_0x3e64('0x23')](function(_0x51d03b){if(_0x51d03b){_0x51d03b[_0x3e64('0x2b')][_0x3e64('0x85')]=util[_0x3e64('0x64')](_0x3e64('0x79'),_0x166493[_0x3e64('0x6d')][_0x3e64('0x3c')]);_0x51d03b[_0x3e64('0x2b')][_0x3e64('0x7a')]=_0xeeb231[_0x3e64('0x7a')];_0x51d03b[_0x3e64('0x2b')][_0x3e64('0x7b')]=_0xeeb231['channel'];_0x51d03b[_0x3e64('0x2b')][_0x3e64('0x86')]=_0x3e64('0x37');respondWithRpcPromise(_0x3e64('0x7c'),_0x3e64('0x7c'),{'event':_0x3e64('0x87'),'message':_0x51d03b['message']},client9002);return _0xeeb231;}return null;})[_0x3e64('0x23')](respondWithResult(_0x3be9f3,null))[_0x3e64('0x58')](handleError(_0x3be9f3,null));};exports[_0x3e64('0x2d')]=function(_0x1008f6,_0x495f96,_0x2b3e71){if(_0x1008f6[_0x3e64('0x5d')]['id']){delete _0x1008f6['body']['id'];}var _0xebd0c3;return db[_0x3e64('0x55')][_0x3e64('0x5b')]({'where':{'id':_0x1008f6[_0x3e64('0x5e')]['id']}})[_0x3e64('0x23')](handleEntityNotFound(_0x495f96,null))[_0x3e64('0x23')](function(_0x4c6185){if(_0x4c6185){_0xebd0c3=_0x4c6185;return db['SmsAccount'][_0x3e64('0x5b')]({'where':{'id':_0x4c6185[_0x3e64('0x88')]}});}})[_0x3e64('0x23')](handleEntityNotFound(_0x495f96,null))[_0x3e64('0x23')](function(_0x3faf07){if(_0x3faf07){logger[_0x3e64('0x89')](_0x3e64('0x26'),_0x3e64('0x2d'),_0x3e64('0x8a'),_0x3faf07['type'],util[_0x3e64('0x8b')](_0x1008f6[_0x3e64('0x5d')],{'showHidden':![],'depth':null}));switch(_0x3faf07[_0x3e64('0x42')]){case _0x3e64('0x8c'):if(_0x1008f6[_0x3e64('0x5d')]['MessageSid']&&_0x1008f6['body']['MessageSid']===_0xebd0c3[_0x3e64('0x8d')]){return _0xebd0c3[_0x3e64('0x39')]({'read':!![]});}else{logger[_0x3e64('0x28')](_0x3e64('0x8e'),_0x3e64('0x2d'),_0x3e64('0x8c'),util[_0x3e64('0x8b')](_0x1008f6[_0x3e64('0x5d')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x1008f6[_0x3e64('0x5d')][_0x3e64('0x8f')]&&_0x1008f6[_0x3e64('0x5d')][_0x3e64('0x8f')]===_0xebd0c3[_0x3e64('0x8d')]&&_['indexOf'](['sent',_0x3e64('0x90')],_0x1008f6[_0x3e64('0x5d')]['Status'])>=0x0){return _0xebd0c3[_0x3e64('0x39')]({'read':!![]});}else{logger[_0x3e64('0x28')](_0x3e64('0x8e'),_0x3e64('0x2d'),_0x3e64('0x91'),util[_0x3e64('0x8b')](_0x1008f6['body'],{'showHidden':![],'depth':null}));}break;case _0x3e64('0x92'):var _0x1304a4=_0x1008f6[_0x3e64('0x5d')]['results'][0x0];if(_0x1304a4[_0x3e64('0x2d')][_0x3e64('0x93')]===_0x3e64('0x94')){return _0xebd0c3['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3e64('0x2d'),_0x3e64('0x92'),util[_0x3e64('0x8b')](_0x1008f6['body'],{'showHidden':![],'depth':null}));}break;}return _0xebd0c3;}})[_0x3e64('0x23')](respondWithResult(_0x495f96,null))[_0x3e64('0x58')](handleError(_0x495f96,null));}; \ No newline at end of file +var _0x349e=['include','create','body','find','params','describe','sms-interactions','sms','read','readAt','format','UserId','user','SmsInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','reject','SmsInteractionId','RejectMessage','rejectMessage','EventManager','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','inspect','plivo','indexOf','sent','Status','infobip','groupName','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','destroy','name','send','index','SmsMessage','fieldName','type','key','map','query','model','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','show'];(function(_0x4b3089,_0x50f11b){var _0x127212=function(_0x344358){while(--_0x344358){_0x4b3089['push'](_0x4b3089['shift']());}};_0x127212(++_0x50f11b);}(_0x349e,0xcb));var _0xe349=function(_0x2b5726,_0x319f16){_0x2b5726=_0x2b5726-0x0;var _0x575ec3=_0x349e[_0x2b5726];return _0x575ec3;};'use strict';var emlformat=require(_0xe349('0x0'));var rimraf=require(_0xe349('0x1'));var zipdir=require(_0xe349('0x2'));var jsonpatch=require(_0xe349('0x3'));var rp=require(_0xe349('0x4'));var moment=require(_0xe349('0x5'));var BPromise=require(_0xe349('0x6'));var Mustache=require(_0xe349('0x7'));var util=require(_0xe349('0x8'));var path=require('path');var sox=require(_0xe349('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe349('0xa'));var _=require('lodash');var squel=require(_0xe349('0xb'));var crypto=require(_0xe349('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe349('0xd'));var toCsv=require(_0xe349('0xe'));var querystring=require(_0xe349('0xf'));var Papa=require(_0xe349('0x10'));var Redis=require(_0xe349('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe349('0x12'));var as=require(_0xe349('0x13'));var hardwareService=require(_0xe349('0x14'));var logger=require(_0xe349('0x15'))(_0xe349('0x16'));var utils=require(_0xe349('0x17'));var config=require(_0xe349('0x18'));var licenseUtil=require(_0xe349('0x19'));var db=require(_0xe349('0x1a'))['db'];config[_0xe349('0x1b')]=_[_0xe349('0x1c')](config[_0xe349('0x1b')],{'host':_0xe349('0x1d'),'port':0x18eb});var socket=require(_0xe349('0x1e'))(new Redis(config[_0xe349('0x1b')]));require(_0xe349('0x1f'))[_0xe349('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe349('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xe349('0x21')][_0xe349('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x33a492,_0x4b3c5a,_0x545493,_0x301cb8){return new BPromise(function(_0x3ff17c,_0x1e7547){var _0x3a4e99=_0x301cb8||client;return _0x3a4e99[_0xe349('0x23')](_0x33a492,_0x545493)[_0xe349('0x24')](function(_0x1264ee){logger[_0xe349('0x25')](_0xe349('0x26'),_0x4b3c5a,_0xe349('0x27'));logger[_0xe349('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4b3c5a,'request\x20sent',JSON[_0xe349('0x29')](_0x1264ee));if(_0x1264ee[_0xe349('0x2a')]){if(_0x1264ee['error'][_0xe349('0x2b')]===0x1f4){logger[_0xe349('0x2a')](_0xe349('0x26'),_0x4b3c5a,_0x1264ee['error']['message']);return _0x1e7547(_0x1264ee[_0xe349('0x2a')][_0xe349('0x2c')]);}logger[_0xe349('0x2a')](_0xe349('0x26'),_0x4b3c5a,_0x1264ee[_0xe349('0x2a')][_0xe349('0x2c')]);return _0x3ff17c(_0x1264ee['error'][_0xe349('0x2c')]);}else{logger[_0xe349('0x25')](_0xe349('0x26'),_0x4b3c5a,_0xe349('0x27'));_0x3ff17c(_0x1264ee[_0xe349('0x2d')][_0xe349('0x2c')]);}})[_0xe349('0x2e')](function(_0x569c44){logger[_0xe349('0x2a')](_0xe349('0x26'),_0x4b3c5a,_0x569c44);_0x1e7547(_0x569c44);});});}function respondWithStatusCode(_0x4e529a,_0x14b289){_0x14b289=_0x14b289||0xcc;return function(_0x51a6f1){if(_0x51a6f1){return _0x4e529a[_0xe349('0x2f')](_0x14b289);}return _0x4e529a[_0xe349('0x30')](_0x14b289)[_0xe349('0x31')]();};}function respondWithResult(_0x4ad8e,_0x42cccd){_0x42cccd=_0x42cccd||0xc8;return function(_0x1421fd){if(_0x1421fd){return _0x4ad8e['status'](_0x42cccd)[_0xe349('0x32')](_0x1421fd);}};}function respondWithFilteredResult(_0x2ad65c,_0x3c556d){return function(_0x1fdba7){if(_0x1fdba7){var _0x274dc5=typeof _0x3c556d[_0xe349('0x33')]===_0xe349('0x34')&&typeof _0x3c556d['limit']==='undefined';var _0x315e60=_0x1fdba7[_0xe349('0x35')];var _0x3ddf5f=_0x274dc5?0x0:_0x3c556d[_0xe349('0x33')];var _0x2ae7c3=_0x274dc5?_0x1fdba7[_0xe349('0x35')]:_0x3c556d['offset']+_0x3c556d['limit'];var _0xe24e6b;if(_0x2ae7c3>=_0x315e60){_0x2ae7c3=_0x315e60;_0xe24e6b=0xc8;}else{_0xe24e6b=0xce;}_0x2ad65c[_0xe349('0x30')](_0xe24e6b);return _0x2ad65c['set'](_0xe349('0x36'),_0x3ddf5f+'-'+_0x2ae7c3+'/'+_0x315e60)[_0xe349('0x32')](_0x1fdba7);}return null;};}function patchUpdates(_0x250342){return function(_0x51919e){try{jsonpatch[_0xe349('0x37')](_0x51919e,_0x250342,!![]);}catch(_0x413547){return BPromise['reject'](_0x413547);}return _0x51919e[_0xe349('0x38')]();};}function saveUpdates(_0x232845,_0x2833f8){return function(_0x132da8){if(_0x132da8){return _0x132da8[_0xe349('0x39')](_0x232845)[_0xe349('0x24')](function(_0x1ac094){return _0x1ac094;});}return null;};}function removeEntity(_0x3bbb59,_0x32f6d9){return function(_0x1d0f3d){if(_0x1d0f3d){return _0x1d0f3d[_0xe349('0x3a')]()[_0xe349('0x24')](function(){_0x3bbb59['status'](0xcc)[_0xe349('0x31')]();});}};}function handleEntityNotFound(_0x524b92,_0x1a5448){return function(_0x3c0d4b){if(!_0x3c0d4b){_0x524b92[_0xe349('0x2f')](0x194);}return _0x3c0d4b;};}function handleError(_0x29d058,_0x9cdad){_0x9cdad=_0x9cdad||0x1f4;return function(_0x50af90){logger[_0xe349('0x2a')](_0x50af90['stack']);if(_0x50af90[_0xe349('0x3b')]){delete _0x50af90[_0xe349('0x3b')];}_0x29d058[_0xe349('0x30')](_0x9cdad)[_0xe349('0x3c')](_0x50af90);};}exports[_0xe349('0x3d')]=function(_0x3b5254,_0x3ea9fc){var _0x48edb1={},_0x2b15ba={},_0x21c9de={'count':0x0,'rows':[]};var _0x5efd5d=_['map'](db[_0xe349('0x3e')]['rawAttributes'],function(_0x4304e1){return{'name':_0x4304e1[_0xe349('0x3f')],'type':_0x4304e1[_0xe349('0x40')][_0xe349('0x41')]};});_0x2b15ba['model']=_[_0xe349('0x42')](_0x5efd5d,'name');_0x2b15ba[_0xe349('0x43')]=_['keys'](_0x3b5254['query']);_0x2b15ba['filters']=_['intersection'](_0x2b15ba[_0xe349('0x44')],_0x2b15ba['query']);_0x48edb1['attributes']=_[_0xe349('0x45')](_0x2b15ba['model'],qs['fields'](_0x3b5254[_0xe349('0x43')][_0xe349('0x46')]));_0x48edb1[_0xe349('0x47')]=_0x48edb1['attributes'][_0xe349('0x48')]?_0x48edb1['attributes']:_0x2b15ba[_0xe349('0x44')];if(!_0x3b5254[_0xe349('0x43')]['hasOwnProperty'](_0xe349('0x49'))){_0x48edb1[_0xe349('0x4a')]=qs['limit'](_0x3b5254[_0xe349('0x43')][_0xe349('0x4a')]);_0x48edb1['offset']=qs[_0xe349('0x33')](_0x3b5254['query'][_0xe349('0x33')]);}_0x48edb1[_0xe349('0x4b')]=qs['sort'](_0x3b5254[_0xe349('0x43')][_0xe349('0x4c')]);_0x48edb1[_0xe349('0x4d')]=qs[_0xe349('0x4e')](_[_0xe349('0x4f')](_0x3b5254[_0xe349('0x43')],_0x2b15ba[_0xe349('0x4e')]),_0x5efd5d);if(_0x3b5254['query'][_0xe349('0x50')]){_0x48edb1[_0xe349('0x4d')]=_['merge'](_0x48edb1['where'],{'$or':_[_0xe349('0x42')](_0x5efd5d,function(_0x4db1d9){if(_0x4db1d9[_0xe349('0x40')]!==_0xe349('0x51')){var _0x5c7857={};_0x5c7857[_0x4db1d9[_0xe349('0x3b')]]={'$like':'%'+_0x3b5254[_0xe349('0x43')][_0xe349('0x50')]+'%'};return _0x5c7857;}})});}_0x48edb1=_[_0xe349('0x52')]({},_0x48edb1,_0x3b5254[_0xe349('0x53')]);var _0xf83f8b={'where':_0x48edb1['where']};return db['SmsMessage'][_0xe349('0x35')](_0xf83f8b)['then'](function(_0x138018){_0x21c9de[_0xe349('0x35')]=_0x138018;if(_0x3b5254[_0xe349('0x43')][_0xe349('0x54')]){_0x48edb1['include']=[{'all':!![]}];}return db[_0xe349('0x3e')][_0xe349('0x55')](_0x48edb1);})[_0xe349('0x24')](function(_0x56b943){_0x21c9de['rows']=_0x56b943;return _0x21c9de;})[_0xe349('0x24')](respondWithFilteredResult(_0x3ea9fc,_0x48edb1))['catch'](handleError(_0x3ea9fc,null));};exports[_0xe349('0x56')]=function(_0x5c8fe3,_0x47c5fa){var _0x4d3848={'raw':!![],'where':{'id':_0x5c8fe3['params']['id']}},_0x3b8dd1={};_0x3b8dd1[_0xe349('0x44')]=_['keys'](db[_0xe349('0x3e')]['rawAttributes']);_0x3b8dd1[_0xe349('0x43')]=_['keys'](_0x5c8fe3[_0xe349('0x43')]);_0x3b8dd1[_0xe349('0x4e')]=_[_0xe349('0x45')](_0x3b8dd1[_0xe349('0x44')],_0x3b8dd1[_0xe349('0x43')]);_0x4d3848[_0xe349('0x47')]=_[_0xe349('0x45')](_0x3b8dd1['model'],qs[_0xe349('0x46')](_0x5c8fe3[_0xe349('0x43')][_0xe349('0x46')]));_0x4d3848[_0xe349('0x47')]=_0x4d3848[_0xe349('0x47')][_0xe349('0x48')]?_0x4d3848['attributes']:_0x3b8dd1[_0xe349('0x44')];if(_0x5c8fe3[_0xe349('0x43')][_0xe349('0x54')]){_0x4d3848[_0xe349('0x57')]=[{'all':!![]}];}_0x4d3848=_[_0xe349('0x52')]({},_0x4d3848,_0x5c8fe3[_0xe349('0x53')]);return db['SmsMessage']['find'](_0x4d3848)[_0xe349('0x24')](handleEntityNotFound(_0x47c5fa,null))[_0xe349('0x24')](respondWithResult(_0x47c5fa,null))[_0xe349('0x2e')](handleError(_0x47c5fa,null));};exports[_0xe349('0x58')]=function(_0x5ca1c5,_0x1372c9){return db[_0xe349('0x3e')]['create'](_0x5ca1c5[_0xe349('0x59')],{})[_0xe349('0x24')](respondWithResult(_0x1372c9,0xc9))[_0xe349('0x2e')](handleError(_0x1372c9,null));};exports[_0xe349('0x39')]=function(_0x1906cf,_0x577325){if(_0x1906cf[_0xe349('0x59')]['id']){delete _0x1906cf['body']['id'];}return db[_0xe349('0x3e')][_0xe349('0x5a')]({'where':{'id':_0x1906cf['params']['id']}})[_0xe349('0x24')](handleEntityNotFound(_0x577325,null))[_0xe349('0x24')](saveUpdates(_0x1906cf['body'],null))[_0xe349('0x24')](respondWithResult(_0x577325,null))[_0xe349('0x2e')](handleError(_0x577325,null));};exports['destroy']=function(_0x18cc40,_0x5c1ba6){return db[_0xe349('0x3e')][_0xe349('0x5a')]({'where':{'id':_0x18cc40[_0xe349('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5c1ba6,null))['then'](removeEntity(_0x5c1ba6,null))[_0xe349('0x2e')](handleError(_0x5c1ba6,null));};exports[_0xe349('0x5c')]=function(_0x3db868,_0x15dc79){return db[_0xe349('0x3e')][_0xe349('0x5c')]()[_0xe349('0x24')](respondWithResult(_0x15dc79,null))['catch'](handleError(_0x15dc79,null));};var interaction_log=require(_0xe349('0x15'))(_0xe349('0x5d'));exports['accept']=function(_0x215029,_0x36d3be,_0x45a2d2){var _0xac8986={'agent':{},'channel':_0xe349('0x5e')};if(_0x215029['body']['id']){delete _0x215029['body']['id'];}_0x215029[_0xe349('0x59')][_0xe349('0x5f')]=!![];_0x215029[_0xe349('0x59')][_0xe349('0x60')]=moment()[_0xe349('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x215029[_0xe349('0x59')][_0xe349('0x62')]=_0x215029[_0xe349('0x59')][_0xe349('0x62')]||_0x215029[_0xe349('0x63')]['id'];_0xac8986['agent']['id']=_0x215029[_0xe349('0x59')]['UserId'];return db[_0xe349('0x3e')][_0xe349('0x5a')]({'where':{'id':_0x215029[_0xe349('0x5b')]['id'],'UserId':null}})[_0xe349('0x24')](handleEntityNotFound(_0x36d3be,null))['then'](saveUpdates(_0x215029[_0xe349('0x59')],null))[_0xe349('0x24')](function(_0x3802b3){if(_0x3802b3){_0xac8986['message']=_0x3802b3['get']({'plain':!![]});return db[_0xe349('0x64')]['find']({'where':{'id':_0x3802b3['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x36d3be,null))['then'](function(_0x472b45){if(_0x472b45){return _0x472b45['update']({'UserId':_0x215029[_0xe349('0x59')][_0xe349('0x62')],'read1stAt':_['isNil'](_0x472b45[_0xe349('0x65')])?moment()[_0xe349('0x61')](_0xe349('0x66')):undefined});}return null;})[_0xe349('0x24')](function(_0x1d940a){if(_0x1d940a){_0xac8986[_0xe349('0x67')]=_0x1d940a[_0xe349('0x68')]({'plain':!![]});interaction_log[_0xe349('0x25')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x215029[_0xe349('0x63')]['id'],_0x215029['user'][_0xe349('0x3b')],_0x215029[_0xe349('0x63')][_0xe349('0x69')],_0xac8986[_0xe349('0x67')]['id'],_0x215029[_0xe349('0x59')]?JSON[_0xe349('0x29')](_0x215029['body']):_0xe349('0x6a'));return respondWithRpcPromise(_0xe349('0x6b'),_0xe349('0x6c'),_0xac8986);}return null;})[_0xe349('0x24')](function(_0x1ba1d6){var _0x51fdd0=_0xe349('0x6d')+_0x1ba1d6[_0xe349('0x2c')][_0xe349('0x6e')];return db[_0xe349('0x6f')][_0xe349('0x43')](_0x51fdd0,{'type':db[_0xe349('0x70')]['QueryTypes'][_0xe349('0x71')],'raw':!![]})[_0xe349('0x24')](function(_0x27d0f6){return _0x27d0f6;});})[_0xe349('0x24')](function(_0x5d54c9){if(_0x5d54c9){_0xac8986[_0xe349('0x2c')]['contact']=_0x5d54c9[0x0];if(!_0x215029[_0xe349('0x59')][_0xe349('0x62')])return;return db[_0xe349('0x72')][_0xe349('0x5a')]({'where':{'id':_0x215029[_0xe349('0x59')][_0xe349('0x62')],'role':_0xe349('0x73')},'attributes':['id',_0xe349('0x3b'),_0xe349('0x74'),_0xe349('0x75'),_0xe349('0x76')],'raw':!![]});}return null;})[_0xe349('0x24')](function(_0x1cc070){if(!_0x1cc070)return null;_0xac8986[_0xe349('0x2c')][_0xe349('0x73')]=_0x1cc070;return _0xac8986;})['then'](function(_0x1a753e){if(_0x1a753e){if(_0x215029['body'][_0xe349('0x77')]){_0xac8986[_0xe349('0x2c')][_0xe349('0x78')]=util[_0xe349('0x61')](_0xe349('0x79'),_0x215029[_0xe349('0x63')]['name']);_0xac8986[_0xe349('0x2c')][_0xe349('0x7a')]=_0xac8986[_0xe349('0x7a')];_0xac8986['message'][_0xe349('0x7b')]=_0xac8986[_0xe349('0x7a')];_0xac8986[_0xe349('0x2c')][_0xe349('0x7c')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xe349('0x7d'),'message':_0xac8986[_0xe349('0x2c')]},client9002)[_0xe349('0x24')](function(){return _0xac8986;});}return _0xac8986;}return null;})[_0xe349('0x24')](respondWithResult(_0x36d3be,null))['catch'](handleError(_0x36d3be,null));};var interaction_log=require('../../config/logger')(_0xe349('0x5d'));exports[_0xe349('0x7e')]=function(_0x4e10fc,_0x223fed,_0x17ad54){var _0x53d0b0={'agent':{},'channel':_0xe349('0x5e')};if(_0x4e10fc[_0xe349('0x59')]['id']){delete _0x4e10fc[_0xe349('0x59')]['id'];}_0x4e10fc['body'][_0xe349('0x62')]=_0x4e10fc[_0xe349('0x59')][_0xe349('0x62')]||_0x4e10fc[_0xe349('0x63')]['id'];_0x53d0b0[_0xe349('0x73')]['id']=_0x4e10fc[_0xe349('0x59')][_0xe349('0x62')];return db['SmsMessage']['find']({'where':{'id':_0x4e10fc['params']['id'],'UserId':null}})[_0xe349('0x24')](handleEntityNotFound(_0x223fed,null))['then'](function(_0xbe7239){if(_0xbe7239){_0x53d0b0[_0xe349('0x2c')]=_0xbe7239['get']({'plain':!![]});return db[_0xe349('0x64')]['find']({'where':{'id':_0xbe7239[_0xe349('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x223fed,null))[_0xe349('0x24')](function(_0x3622ee){if(_0x3622ee){_0x53d0b0[_0xe349('0x67')]=_0x3622ee['get']({'plain':!![]});interaction_log[_0xe349('0x25')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e10fc[_0xe349('0x63')]['id'],_0x4e10fc[_0xe349('0x63')][_0xe349('0x3b')],_0x4e10fc['user'][_0xe349('0x69')],_0x53d0b0['interaction']['id'],_0x4e10fc['body']?JSON[_0xe349('0x29')](_0x4e10fc[_0xe349('0x59')]):_0xe349('0x6a'));return respondWithRpcPromise(_0xe349('0x80'),_0xe349('0x81'),_0x53d0b0);}return null;})[_0xe349('0x24')](function(_0x327d28){var _0x68f1b8=_0xe349('0x6d')+_0x327d28[_0xe349('0x2c')][_0xe349('0x6e')];return db[_0xe349('0x6f')]['query'](_0x68f1b8,{'type':db[_0xe349('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0xe349('0x24')](function(_0x1ea09f){return _0x1ea09f;});})[_0xe349('0x24')](function(_0x33232a){if(_0x33232a){_0x53d0b0[_0xe349('0x2c')]['contact']=_0x33232a[0x0];if(!_0x4e10fc[_0xe349('0x59')][_0xe349('0x62')])return;return db[_0xe349('0x72')][_0xe349('0x5a')]({'where':{'id':_0x4e10fc['body']['UserId'],'role':_0xe349('0x73')},'attributes':['id',_0xe349('0x3b'),_0xe349('0x74'),_0xe349('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5485b6){if(!_0x5485b6)return null;_0x53d0b0[_0xe349('0x2c')][_0xe349('0x73')]=_0x5485b6;return _0x53d0b0;})[_0xe349('0x24')](function(_0x5d741e){if(_0x5d741e){_0x5d741e[_0xe349('0x2c')][_0xe349('0x78')]=util[_0xe349('0x61')](_0xe349('0x79'),_0x4e10fc[_0xe349('0x63')][_0xe349('0x3b')]);_0x5d741e['message']['channel']=_0x53d0b0['channel'];_0x5d741e[_0xe349('0x2c')][_0xe349('0x7b')]=_0x53d0b0['channel'];_0x5d741e[_0xe349('0x2c')][_0xe349('0x7c')]=_0xe349('0x7e');respondWithRpcPromise(_0xe349('0x82'),_0xe349('0x82'),{'event':'rejectmessage','message':_0x5d741e[_0xe349('0x2c')]},client9002);return _0x53d0b0;}return null;})[_0xe349('0x24')](respondWithResult(_0x223fed,null))[_0xe349('0x2e')](handleError(_0x223fed,null));};exports[_0xe349('0x30')]=function(_0x3ff0df,_0x5c73d7,_0xe6412){if(_0x3ff0df['body']['id']){delete _0x3ff0df['body']['id'];}var _0x3808cb;return db[_0xe349('0x3e')][_0xe349('0x5a')]({'where':{'id':_0x3ff0df['params']['id']}})[_0xe349('0x24')](handleEntityNotFound(_0x5c73d7,null))[_0xe349('0x24')](function(_0x5eae60){if(_0x5eae60){_0x3808cb=_0x5eae60;return db[_0xe349('0x83')][_0xe349('0x5a')]({'where':{'id':_0x5eae60[_0xe349('0x84')]}});}})[_0xe349('0x24')](handleEntityNotFound(_0x5c73d7,null))['then'](function(_0x26661e){if(_0x26661e){logger[_0xe349('0x28')](_0xe349('0x85'),'status',_0xe349('0x86'),_0x26661e[_0xe349('0x40')],util['inspect'](_0x3ff0df[_0xe349('0x59')],{'showHidden':![],'depth':null}));switch(_0x26661e[_0xe349('0x40')]){case _0xe349('0x87'):if(_0x3ff0df[_0xe349('0x59')][_0xe349('0x88')]&&_0x3ff0df[_0xe349('0x59')][_0xe349('0x88')]===_0x3808cb['messageId']){return _0x3808cb[_0xe349('0x39')]({'read':!![]});}else{logger[_0xe349('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe349('0x30'),_0xe349('0x87'),util[_0xe349('0x89')](_0x3ff0df[_0xe349('0x59')],{'showHidden':![],'depth':null}));}break;case _0xe349('0x8a'):if(_0x3ff0df[_0xe349('0x59')]['MessageUUID']&&_0x3ff0df['body']['MessageUUID']===_0x3808cb['messageId']&&_[_0xe349('0x8b')]([_0xe349('0x8c'),'delivered'],_0x3ff0df[_0xe349('0x59')][_0xe349('0x8d')])>=0x0){return _0x3808cb['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe349('0x30'),'plivio',util[_0xe349('0x89')](_0x3ff0df['body'],{'showHidden':![],'depth':null}));}break;case _0xe349('0x8e'):var _0x4834d6=_0x3ff0df['body']['results'][0x0];if(_0x4834d6['status'][_0xe349('0x8f')]==='DELIVERED'){return _0x3808cb[_0xe349('0x39')]({'read':!![]});}else{logger['error'](_0xe349('0x90'),_0xe349('0x30'),'infobip',util[_0xe349('0x89')](_0x3ff0df[_0xe349('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x3808cb;}})[_0xe349('0x24')](respondWithResult(_0x5c73d7,null))['catch'](handleError(_0x5c73d7,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 5b190ba..278a18f 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 _0x2cd4=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x480393,_0x5a7a1c){var _0x1e856a=function(_0x5df0c6){while(--_0x5df0c6){_0x480393['push'](_0x480393['shift']());}};_0x1e856a(++_0x5a7a1c);}(_0x2cd4,0x124));var _0x42cd=function(_0x2351c4,_0x1dca54){_0x2351c4=_0x2351c4-0x0;var _0x1dd3f8=_0x2cd4[_0x2351c4];return _0x1dd3f8;};'use strict';var EventEmitter=require(_0x42cd('0x0'));var SmsMessage=require(_0x42cd('0x1'))['db'][_0x42cd('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x42cd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x42cd('0x4'),'afterDestroy':_0x42cd('0x5')};function emitEvent(_0x531b56){return function(_0x3038e5,_0x1f4cac,_0x27076d){SmsMessageEvents[_0x42cd('0x6')](_0x531b56+':'+_0x3038e5['id'],_0x3038e5);SmsMessageEvents[_0x42cd('0x6')](_0x531b56,_0x3038e5);_0x27076d(null);};}for(var e in events){if(events[_0x42cd('0x7')](e)){var event=events[e];SmsMessage[_0x42cd('0x8')](e,emitEvent(event));}}module[_0x42cd('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xe148=['SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe148,0x1d3));var _0x8e14=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xe148[_0x1e3671];return _0x48d5f5;};'use strict';var EventEmitter=require(_0x8e14('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x8e14('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8e14('0x2')](0x0);var events={'afterCreate':_0x8e14('0x3'),'afterUpdate':_0x8e14('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ce846){return function(_0xb4f770,_0x287ed7,_0x359a24){SmsMessageEvents[_0x8e14('0x5')](_0x1ce846+':'+_0xb4f770['id'],_0xb4f770);SmsMessageEvents[_0x8e14('0x5')](_0x1ce846,_0xb4f770);_0x359a24(null);};}for(var e in events){if(events[_0x8e14('0x6')](e)){var event=events[e];SmsMessage[_0x8e14('0x7')](e,emitEvent(event));}}module[_0x8e14('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a9ffe11..a1d81e7 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 _0x4fd1=['findOne','createdAt','catch','error','out','find','SmsAccountId','type','twilio','authToken','phone','create','body','remote','/api/sms/messages/','token','then','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','session_key','total_sent','internal_order_id','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','baseUrl','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','apiKey','text','timestamp','keys','sort','length','hex','signature=','clickatell','https://platform.clickatell.com/messages','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','isNil','SmsInteractionId','SmsInteraction'];(function(_0x3bc983,_0xfc52db){var _0x41d8c0=function(_0x4e32f2){while(--_0x4e32f2){_0x3bc983['push'](_0x3bc983['shift']());}};_0x41d8c0(++_0xfc52db);}(_0x4fd1,0x1ce));var _0x14fd=function(_0x4d328e,_0x8a1f7a){_0x4d328e=_0x4d328e-0x0;var _0x309cb1=_0x4fd1[_0x4d328e];return _0x309cb1;};'use strict';var _=require(_0x14fd('0x0'));var util=require(_0x14fd('0x1'));var logger=require('../../config/logger')(_0x14fd('0x2'));var moment=require('moment');var BPromise=require(_0x14fd('0x3'));var rp=require(_0x14fd('0x4'));var fs=require('fs');var path=require(_0x14fd('0x5'));var rimraf=require(_0x14fd('0x6'));var config=require(_0x14fd('0x7'));var attributes=require(_0x14fd('0x8'));module[_0x14fd('0x9')]=function(_0x4ab78f,_0x241592){return _0x4ab78f['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x14fd('0xa'),'fields':[_0x14fd('0xa')]},{'name':_0x14fd('0xb'),'fields':['body'],'type':_0x14fd('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49a610,_0x1d176c,_0x48b580){var _0x17d889=_0x4ab78f[_0x14fd('0xd')];var _0x205baf=_0x49a610[_0x14fd('0xe')]({'plain':!![]});if(_0x205baf[_0x14fd('0xf')][_0x14fd('0x10')]()==='in'||_0x205baf[_0x14fd('0xf')][_0x14fd('0x10')]()==='out'&&!_0x205baf[_0x14fd('0x11')]&&!_['isNil'](_0x205baf[_0x14fd('0x12')])&&!_[_0x14fd('0x13')](_0x205baf[_0x14fd('0x14')])){_0x17d889[_0x14fd('0x15')][_0x14fd('0x16')]({'where':{'id':_0x205baf[_0x14fd('0x14')]}})['then'](function(_0x35d86a){if(_0x35d86a){_0x35d86a['update']({'lastMsgAt':_0x205baf[_0x14fd('0x17')],'lastMsgDirection':_0x205baf[_0x14fd('0xf')][_0x14fd('0x10')]()});}})[_0x14fd('0x18')](function(_0x4f799a){console[_0x14fd('0x19')](_0x4f799a);});}if(_0x205baf[_0x14fd('0xf')]===_0x14fd('0x1a')&&!_0x205baf[_0x14fd('0x11')]){var _0x2bf5c4;_0x17d889['SmsAccount'][_0x14fd('0x1b')]({'where':{'id':_0x205baf[_0x14fd('0x1c')]},'raw':!![]})['then'](function(_0x276f4b){_0x2bf5c4=_0x276f4b;if(_0x2bf5c4&&_0x2bf5c4[_0x14fd('0x1d')]){switch(_0x2bf5c4['type']){case _0x14fd('0x1e'):var _0x4e9b69=require(_0x14fd('0x1e'));if(_0x2bf5c4['accountSid']&&_0x2bf5c4[_0x14fd('0x1f')]&&_0x2bf5c4[_0x14fd('0x20')]){var _0x2d1440=new _0x4e9b69(_0x2bf5c4['accountSid'],_0x2bf5c4['authToken']);_0x2d1440['messages'][_0x14fd('0x21')]({'body':_0x205baf[_0x14fd('0x22')],'to':_0x205baf[_0x14fd('0x20')],'from':_0x2bf5c4[_0x14fd('0x20')],'statusCallback':_0x2bf5c4[_0x14fd('0x23')]+_0x14fd('0x24')+_0x205baf['id']+'/status?token='+_0x2bf5c4[_0x14fd('0x25')]})[_0x14fd('0x26')](function(_0x149815){if(_0x149815[_0x14fd('0x27')]){return _0x49a610['update']({'messageId':_0x149815[_0x14fd('0x27')]});}})[_0x14fd('0x18')](function(_0x4e6813){logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),'twilio',util[_0x14fd('0x2a')](_0x4e6813,{'showHidden':![],'depth':null}));});}else{logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x1e'),_0x14fd('0x2b'));}break;case _0x14fd('0x2c'):var _0x4094b5=_0x14fd('0x2d');if(_0x2bf5c4[_0x14fd('0x2e')]&&_0x2bf5c4[_0x14fd('0x2f')]){var _0xd6c536={'recipient':[_0x205baf[_0x14fd('0x20')]],'message':_0x205baf['body'],'message_type':_0x2bf5c4[_0x14fd('0x30')]};if(_0x2bf5c4['smsMethod']&&_0x2bf5c4[_0x14fd('0x30')]!=='SI'){_0xd6c536[_0x14fd('0x31')]=_0x2bf5c4[_0x14fd('0x20')];}var _0x16777b={'url':_0x4094b5+_0x14fd('0x32')+_0x2bf5c4['username']+_0x14fd('0x33')+_0x2bf5c4['password'],'method':_0x14fd('0x34')};rp(_0x16777b)[_0x14fd('0x26')](function(_0x1a786b){var _0x1f6290=_0x1a786b[_0x14fd('0x35')](';');var _0x1c25ed={'user_key':_0x1f6290[0x0],'session_key':_0x1f6290[0x1]};_0x16777b={'url':_0x4094b5+'sms','method':'POST','headers':{'user_key':_0x1c25ed['user_key'],'Session_key':_0x1c25ed[_0x14fd('0x36')]},'json':!![],'body':_0xd6c536};return rp(_0x16777b);})[_0x14fd('0x26')](function(_0x504c79){if(_0x504c79[_0x14fd('0x37')]>=0x1){var _0x4677f6={'messageId':_0x504c79[_0x14fd('0x38')]};if(_0x2bf5c4[_0x14fd('0x30')]!=='GP'||!_0x2bf5c4[_0x14fd('0x39')]){_0x4677f6[_0x14fd('0x3a')]=!![];}return _0x49a610[_0x14fd('0x3b')](_0x4677f6);}else{return logger['error'](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x2c'),util[_0x14fd('0x2a')](_0x504c79,{'showHidden':![],'depth':null}));}})[_0x14fd('0x18')](function(_0x346b9e){return logger['error'](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x2c'),util[_0x14fd('0x2a')](_0x346b9e,{'showHidden':![],'depth':null}));});}else{logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),'skebby',_0x14fd('0x3c'));}break;case _0x14fd('0x3d'):if(_0x2bf5c4[_0x14fd('0x1f')]){var _0x4b23d2={'recipient':_0x205baf[_0x14fd('0x20')],'message':_0x205baf[_0x14fd('0x22')],'sender':_0x2bf5c4[_0x14fd('0x3e')]||_0x2bf5c4['phone'],'authorization':_0x2bf5c4[_0x14fd('0x1f')]};var _0x1d176c={'method':_0x14fd('0x3f'),'uri':_0x14fd('0x40'),'body':_0x4b23d2,'json':!![]};rp(_0x1d176c)[_0x14fd('0x26')](function(_0x1bc45c){var _0x2158d5={'messageId':_0x1bc45c[_0x14fd('0x41')]};if(!_0x2bf5c4[_0x14fd('0x39')]){_0x2158d5[_0x14fd('0x3a')]=!![];}return _0x49a610[_0x14fd('0x3b')](_0x2158d5);})[_0x14fd('0x18')](function(_0x2ba9c1){logger['error'](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x3d'),util[_0x14fd('0x2a')](_0x2ba9c1,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x14fd('0x3d'),_0x14fd('0x42'));}break;case _0x14fd('0x43'):if(_0x2bf5c4[_0x14fd('0x2e')]&&_0x2bf5c4[_0x14fd('0x2f')]){var _0x4b23d2={'messages':[{'source':_0x14fd('0x44'),'to':_0x205baf[_0x14fd('0x20')],'body':_0x205baf[_0x14fd('0x22')],'from':_0x2bf5c4[_0x14fd('0x3e')]||_0x2bf5c4['phone']}]};var _0x5b18d6=util[_0x14fd('0x45')](_0x14fd('0x46'),_0x2bf5c4[_0x14fd('0x2e')],_0x2bf5c4[_0x14fd('0x2f')]);var _0x1d176c={'method':_0x14fd('0x3f'),'uri':_0x14fd('0x47'),'body':_0x4b23d2,'headers':{'Authorization':util[_0x14fd('0x45')]('Basic\x20%s',new Buffer(_0x5b18d6)[_0x14fd('0x48')](_0x14fd('0x49')))},'json':!![]};rp(_0x1d176c)[_0x14fd('0x26')](function(_0x1d8772){if(_0x1d8772['http_code']>=0xc8&&_0x1d8772[_0x14fd('0x4a')]<=0xce){if(_0x1d8772[_0x14fd('0x4b')]&&_0x1d8772[_0x14fd('0x4b')][_0x14fd('0x4c')]>0x0){var _0x20b81b=_[_0x14fd('0x4d')](_0x1d8772[_0x14fd('0x4b')][_0x14fd('0x4e')]);var _0x5db50a={'messageId':_0x20b81b[_0x14fd('0x4f')]};if(!_0x2bf5c4[_0x14fd('0x39')]){_0x5db50a[_0x14fd('0x3a')]=!![];}return _0x49a610['update'](_0x5db50a);}else{logger[_0x14fd('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x14fd('0x50'),util['inspect'](_0x1d8772,{'showHidden':![],'depth':null}));}}else{logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x50'),util[_0x14fd('0x2a')](_0x1d8772,{'showHidden':![],'depth':null}));}})[_0x14fd('0x18')](function(_0x317d9a){logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x50'),util[_0x14fd('0x2a')](_0x317d9a,{'showHidden':![],'depth':null}));});}else{logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x50'),_0x14fd('0x3c'));}break;case _0x14fd('0x51'):if(_0x2bf5c4[_0x14fd('0x52')]&&_0x2bf5c4['authToken']){var _0x4b23d2={'dst':_0x205baf[_0x14fd('0x20')],'text':_0x205baf['body'],'src':_0x2bf5c4[_0x14fd('0x3e')]||_0x2bf5c4[_0x14fd('0x20')],'url':_0x2bf5c4[_0x14fd('0x23')]+_0x14fd('0x24')+_0x205baf['id']+_0x14fd('0x53')+_0x2bf5c4[_0x14fd('0x25')]};var _0x5b18d6=util[_0x14fd('0x45')]('%s:%s',_0x2bf5c4[_0x14fd('0x52')],_0x2bf5c4[_0x14fd('0x1f')]);var _0x1d176c={'method':_0x14fd('0x3f'),'uri':util[_0x14fd('0x45')](_0x14fd('0x54'),_0x2bf5c4[_0x14fd('0x52')]),'body':_0x4b23d2,'headers':{'Authorization':util[_0x14fd('0x45')](_0x14fd('0x55'),new Buffer(_0x5b18d6)[_0x14fd('0x48')](_0x14fd('0x49')))},'json':!![]};rp(_0x1d176c)[_0x14fd('0x26')](function(_0x5ef3c0){var _0x3b8c63={'messageId':_0x5ef3c0['message_uuid'][0x0]};return _0x49a610[_0x14fd('0x3b')](_0x3b8c63);})['catch'](function(_0x1f008f){logger[_0x14fd('0x19')](_0x14fd('0x28'),'afterCreate',_0x14fd('0x51'),util['inspect'](_0x1f008f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14fd('0x29'),_0x14fd('0x51'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x2bf5c4[_0x14fd('0x2e')]&&_0x2bf5c4[_0x14fd('0x2f')]){if(_0x2bf5c4[_0x14fd('0x56')]){var _0x36df90={'method':_0x14fd('0x3f'),'uri':_0x2bf5c4[_0x14fd('0x56')]+'/auth/1/session','body':{'username':_0x2bf5c4[_0x14fd('0x2e')],'password':_0x2bf5c4[_0x14fd('0x2f')]},'json':!![]};return rp(_0x36df90)[_0x14fd('0x26')](function(_0x423aa9){var _0x154418={'method':_0x14fd('0x3f'),'uri':_0x2bf5c4[_0x14fd('0x56')]+_0x14fd('0x57'),'body':{'messages':[{'from':_0x2bf5c4[_0x14fd('0x20')],'destinations':[{'to':_0x205baf[_0x14fd('0x20')]}],'text':_0x205baf[_0x14fd('0x22')],'notifyUrl':_0x2bf5c4[_0x14fd('0x23')]+'/api/sms/messages/'+_0x205baf['id']+_0x14fd('0x53')+_0x2bf5c4[_0x14fd('0x25')],'notifyContentType':'application/json','callbackData':_0x2bf5c4['phone']+';'+_0x205baf[_0x14fd('0x22')]}]},'headers':{'Authorization':_0x14fd('0x58')+_0x423aa9[_0x14fd('0x25')]},'json':!![]};return rp(_0x154418)['then'](function(_0x3f1de6){if(_0x3f1de6[_0x14fd('0x4e')]){var _0xa9a2b3={'messageId':_0x3f1de6[_0x14fd('0x4e')][0x0][_0x14fd('0xa')]};if(!_0x2bf5c4[_0x14fd('0x39')]){_0xa9a2b3[_0x14fd('0x3a')]=!![];}return _0x49a610[_0x14fd('0x3b')](_0xa9a2b3);}else{return logger[_0x14fd('0x19')](_0x14fd('0x28'),'afterCreate',_0x14fd('0x59'),util['inspect'](_0x3f1de6,{'showHidden':![],'depth':null}));}});})[_0x14fd('0x18')](function(_0x360e54){return logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x59'),util[_0x14fd('0x2a')](_0x360e54,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x14fd('0x28'),'afterCreate','infobip',_0x14fd('0x5a'));}}else{logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x59'),_0x14fd('0x3c'));}break;case _0x14fd('0x5b'):var _0x4721db=require('crypto');if(_0x2bf5c4[_0x14fd('0x5c')]){var _0x5df274={};_0x5df274['login']=_0x2bf5c4[_0x14fd('0x2e')];_0x5df274[_0x14fd('0x20')]=_0x205baf[_0x14fd('0x20')];_0x5df274['sender']=_0x2bf5c4[_0x14fd('0x20')];_0x5df274[_0x14fd('0x5d')]=_0x205baf[_0x14fd('0x22')];_0x5df274[_0x14fd('0x5e')]=+new Date();var _0x4b5a1c='';var _0x4a5944='';var _0x28af2f=Object[_0x14fd('0x5f')](_0x5df274);_0x28af2f[_0x14fd('0x60')]();for(var _0x1666d6=0x0;_0x1666d6<_0x28af2f[_0x14fd('0x61')];_0x1666d6++){if(_0x4b5a1c!=''){_0x4b5a1c+='&';}_0x4b5a1c+=_0x28af2f[_0x1666d6]+'='+encodeURIComponent(_0x5df274[_0x28af2f[_0x1666d6]]);_0x4a5944+=_0x5df274[_0x28af2f[_0x1666d6]];}_0x4a5944+=_0x2bf5c4[_0x14fd('0x5c')];_0x4a5944=_0x4721db['createHash']('md5')['update'](_0x4a5944)['digest'](_0x14fd('0x62'));if(_0x4b5a1c!==''){_0x4b5a1c+='&';}_0x4b5a1c+=_0x14fd('0x63')+_0x4a5944;var _0x16777b={'method':_0x14fd('0x34'),'uri':_0x2bf5c4[_0x14fd('0x56')]+'/external/get/send.php?'+_0x4b5a1c,'json':!![]};return rp(_0x16777b)['then'](function(_0x114929){var _0x411f91=Object['keys'](_0x114929);if(_0x114929[_0x411f91[0x0]]['error']&&parseInt(_0x114929[_0x411f91[0x0]][_0x14fd('0x19')])===0x0){var _0x927795={'messageId':_0x114929[_0x411f91[0x0]]['id_sms']};if(!_0x2bf5c4['deliveryReport']){_0x927795['read']=!![];}return _0x49a610[_0x14fd('0x3b')](_0x927795);}else{return logger[_0x14fd('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14fd('0x29'),_0x14fd('0x5b'),util[_0x14fd('0x2a')](_0x114929[_0x14fd('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a54f8){return logger[_0x14fd('0x19')](_0x14fd('0x28'),'afterCreate',_0x14fd('0x5b'),util[_0x14fd('0x2a')](_0x2a54f8,{'showHidden':![],'depth':null}));});}else{logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case _0x14fd('0x64'):if(_0x2bf5c4[_0x14fd('0x5c')]){var _0x52467e={'method':_0x14fd('0x3f'),'uri':_0x14fd('0x65'),'headers':{'Authorization':_0x2bf5c4[_0x14fd('0x5c')]},'body':{'content':_0x205baf['body'],'to':[_0x205baf[_0x14fd('0x20')]],'from':_0x2bf5c4[_0x14fd('0x20')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x52467e)[_0x14fd('0x26')](function(_0x36244e){if(!_0x36244e[_0x14fd('0x19')]){var _0x1b960e={'messageId':_0x36244e[_0x14fd('0x4e')][0x0][_0x14fd('0x66')]};if(!_0x2bf5c4[_0x14fd('0x39')]){_0x1b960e[_0x14fd('0x3a')]=!![];}return _0x49a610[_0x14fd('0x3b')](_0x1b960e);}else{return logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x64'),util[_0x14fd('0x2a')](_0x36244e[_0x14fd('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x8ce680){return logger[_0x14fd('0x19')](_0x14fd('0x28'),'afterCreate','clickatell',util[_0x14fd('0x2a')](_0x8ce680,{'showHidden':![],'depth':null}));});}else{logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x64'),_0x14fd('0x67'));}break;case _0x14fd('0x68'):if(_0x2bf5c4[_0x14fd('0x2e')]&&_0x2bf5c4[_0x14fd('0x2f')]){var _0x5b18d6=util[_0x14fd('0x45')](_0x14fd('0x46'),_0x2bf5c4[_0x14fd('0x2e')],_0x2bf5c4[_0x14fd('0x2f')]);var _0x1d176c={'method':_0x14fd('0x3f'),'uri':_0x14fd('0x69')+_0x2bf5c4[_0x14fd('0x6a')]+'/messages','body':{'to':[_0x205baf[_0x14fd('0x20')]],'text':_0x205baf['body'],'from':_0x2bf5c4[_0x14fd('0x20')],'applicationId':_0x2bf5c4[_0x14fd('0x6b')]},'headers':{'Authorization':util['format'](_0x14fd('0x55'),new Buffer(_0x5b18d6)[_0x14fd('0x48')](_0x14fd('0x49')))},'json':!![]};rp(_0x1d176c)[_0x14fd('0x26')](function(_0x5830c1){if(_0x5830c1['id']){var _0xa1ceda={'messageId':_0x5830c1['id']};return _0x49a610[_0x14fd('0x3b')](_0xa1ceda);}else{logger[_0x14fd('0x19')](_0x14fd('0x28'),'afterCreate',_0x14fd('0x68'),util['inspect'](_0x5830c1,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3bee7e){logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x68'),util[_0x14fd('0x2a')](_0x3bee7e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x14fd('0x28'),_0x14fd('0x29'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x14fd('0x6c'):if(_0x2bf5c4[_0x14fd('0x5c')]){var _0x480af8={};var _0x16777b={'method':_0x14fd('0x3f'),'uri':_0x14fd('0x6d'),'headers':{'Authorization':_0x14fd('0x6e')+_0x2bf5c4[_0x14fd('0x5c')],'Content-Type':_0x14fd('0x6f')},'body':{'from':_0x2bf5c4[_0x14fd('0x20')],'to':_0x205baf[_0x14fd('0x20')],'text':_0x205baf[_0x14fd('0x22')]},'json':!![]};return rp(_0x16777b)['then'](function(_0x117e45){if(_0x117e45[_0x14fd('0x70')]==0xca){_0x480af8[_0x14fd('0x71')]=_0x117e45;var _0x21b422={'method':_0x14fd('0x3f'),'uri':_0x14fd('0x72'),'headers':{'Authorization':_0x14fd('0x6e')+_0x2bf5c4[_0x14fd('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x480af8['message'][_0x14fd('0x73')]},'json':!![]};return rp(_0x21b422)[_0x14fd('0x26')](function(_0x309d77){_0x480af8[_0x14fd('0x74')]=_0x309d77;var _0x2563a4={'messageId':_0x480af8[_0x14fd('0x71')][_0x14fd('0x73')],'read':!![]};return _0x49a610[_0x14fd('0x3b')](_0x2563a4);});}else{return logger[_0x14fd('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14fd('0x29'),_0x14fd('0x6c'),util[_0x14fd('0x2a')](_0x117e45,{'showHidden':![],'depth':null}));}})[_0x14fd('0x18')](function(_0x4f1484){return logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x6c'),util[_0x14fd('0x2a')](_0x4f1484,{'showHidden':![],'depth':null}));});}else{return logger[_0x14fd('0x19')](_0x14fd('0x28'),_0x14fd('0x29'),_0x14fd('0x6c'),_0x14fd('0x75'));}break;}}})[_0x14fd('0x76')](function(){_0x48b580();});}else{_0x48b580();}}},'charset':_0x14fd('0x77'),'collate':_0x14fd('0x78')});}; \ No newline at end of file +var _0x4d9c=['sort','length','createHash','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','SmsAccount','type','twilio','accountSid','authToken','messages','phone','/api/sms/messages/','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','message_id','clickSend','authId','remote','%s:%s','Basic\x20%s','toString','message_uuid','plivo','infobip','/auth/1/session','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','text','timestamp','keys'];(function(_0x5569c5,_0x295b2e){var _0x23af4d=function(_0x32f61c){while(--_0x32f61c){_0x5569c5['push'](_0x5569c5['shift']());}};_0x23af4d(++_0x295b2e);}(_0x4d9c,0x117));var _0xc4d9=function(_0x4fcce8,_0x58011b){_0x4fcce8=_0x4fcce8-0x0;var _0x2759d6=_0x4d9c[_0x4fcce8];return _0x2759d6;};'use strict';var _=require(_0xc4d9('0x0'));var util=require('util');var logger=require(_0xc4d9('0x1'))(_0xc4d9('0x2'));var moment=require(_0xc4d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc4d9('0x4'));var fs=require('fs');var path=require(_0xc4d9('0x5'));var rimraf=require(_0xc4d9('0x6'));var config=require(_0xc4d9('0x7'));var attributes=require(_0xc4d9('0x8'));module[_0xc4d9('0x9')]=function(_0x3041d9,_0x342d0a){return _0x3041d9[_0xc4d9('0xa')](_0xc4d9('0xb'),attributes,{'tableName':_0xc4d9('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xc4d9('0xd')]},{'name':_0xc4d9('0xe'),'fields':[_0xc4d9('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x293fc8,_0x558296,_0x3a4488){var _0x84145b=_0x3041d9['models'];var _0x7f605a=_0x293fc8[_0xc4d9('0x10')]({'plain':!![]});if(_0x7f605a[_0xc4d9('0x11')][_0xc4d9('0x12')]()==='in'||_0x7f605a[_0xc4d9('0x11')][_0xc4d9('0x12')]()===_0xc4d9('0x13')&&!_0x7f605a[_0xc4d9('0x14')]&&!_[_0xc4d9('0x15')](_0x7f605a[_0xc4d9('0x16')])&&!_[_0xc4d9('0x15')](_0x7f605a[_0xc4d9('0x17')])){_0x84145b[_0xc4d9('0x18')]['findOne']({'where':{'id':_0x7f605a[_0xc4d9('0x17')]}})[_0xc4d9('0x19')](function(_0x3c7e3a){if(_0x3c7e3a){_0x3c7e3a[_0xc4d9('0x1a')]({'lastMsgAt':_0x7f605a[_0xc4d9('0x1b')],'lastMsgDirection':_0x7f605a[_0xc4d9('0x11')][_0xc4d9('0x12')]()});}})[_0xc4d9('0x1c')](function(_0xc0ea50){console[_0xc4d9('0x1d')](_0xc0ea50);});}if(_0x7f605a[_0xc4d9('0x11')]==='out'&&!_0x7f605a['secret']){var _0x53c30a;_0x84145b[_0xc4d9('0x1e')]['find']({'where':{'id':_0x7f605a['SmsAccountId']},'raw':!![]})[_0xc4d9('0x19')](function(_0x24b4bc){_0x53c30a=_0x24b4bc;if(_0x53c30a&&_0x53c30a[_0xc4d9('0x1f')]){switch(_0x53c30a[_0xc4d9('0x1f')]){case _0xc4d9('0x20'):var _0x51c053=require('twilio');if(_0x53c30a[_0xc4d9('0x21')]&&_0x53c30a[_0xc4d9('0x22')]&&_0x53c30a['phone']){var _0x1c0b16=new _0x51c053(_0x53c30a[_0xc4d9('0x21')],_0x53c30a[_0xc4d9('0x22')]);_0x1c0b16[_0xc4d9('0x23')]['create']({'body':_0x7f605a[_0xc4d9('0xf')],'to':_0x7f605a[_0xc4d9('0x24')],'from':_0x53c30a[_0xc4d9('0x24')],'statusCallback':_0x53c30a['remote']+_0xc4d9('0x25')+_0x7f605a['id']+_0xc4d9('0x26')+_0x53c30a[_0xc4d9('0x27')]})['then'](function(_0x40a1a7){if(_0x40a1a7[_0xc4d9('0x28')]){return _0x293fc8[_0xc4d9('0x1a')]({'messageId':_0x40a1a7[_0xc4d9('0x28')]});}})['catch'](function(_0x3d12d8){logger[_0xc4d9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc4d9('0x29'),_0xc4d9('0x20'),util[_0xc4d9('0x2a')](_0x3d12d8,{'showHidden':![],'depth':null}));});}else{logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),'twilio',_0xc4d9('0x2c'));}break;case'skebby':var _0x1e2125=_0xc4d9('0x2d');if(_0x53c30a['username']&&_0x53c30a['password']){var _0x4578ed={'recipient':[_0x7f605a['phone']],'message':_0x7f605a[_0xc4d9('0xf')],'message_type':_0x53c30a[_0xc4d9('0x2e')]};if(_0x53c30a[_0xc4d9('0x2e')]&&_0x53c30a[_0xc4d9('0x2e')]!=='SI'){_0x4578ed[_0xc4d9('0x2f')]=_0x53c30a[_0xc4d9('0x24')];}var _0x414106={'url':_0x1e2125+_0xc4d9('0x30')+_0x53c30a[_0xc4d9('0x31')]+_0xc4d9('0x32')+_0x53c30a['password'],'method':_0xc4d9('0x33')};rp(_0x414106)[_0xc4d9('0x19')](function(_0x14c096){var _0x556670=_0x14c096[_0xc4d9('0x34')](';');var _0x150ec5={'user_key':_0x556670[0x0],'session_key':_0x556670[0x1]};_0x414106={'url':_0x1e2125+_0xc4d9('0x35'),'method':_0xc4d9('0x36'),'headers':{'user_key':_0x150ec5[_0xc4d9('0x37')],'Session_key':_0x150ec5['session_key']},'json':!![],'body':_0x4578ed};return rp(_0x414106);})['then'](function(_0x3827b1){if(_0x3827b1[_0xc4d9('0x38')]>=0x1){var _0x56561d={'messageId':_0x3827b1[_0xc4d9('0x39')]};if(_0x53c30a[_0xc4d9('0x2e')]!=='GP'||!_0x53c30a[_0xc4d9('0x3a')]){_0x56561d['read']=!![];}return _0x293fc8[_0xc4d9('0x1a')](_0x56561d);}else{return logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),_0xc4d9('0x3b'),util[_0xc4d9('0x2a')](_0x3827b1,{'showHidden':![],'depth':null}));}})[_0xc4d9('0x1c')](function(_0x302c61){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc4d9('0x29'),'skebby',util[_0xc4d9('0x2a')](_0x302c61,{'showHidden':![],'depth':null}));});}else{logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),_0xc4d9('0x3b'),_0xc4d9('0x3c'));}break;case _0xc4d9('0x3d'):if(_0x53c30a[_0xc4d9('0x22')]){var _0x53038e={'recipient':_0x7f605a[_0xc4d9('0x24')],'message':_0x7f605a[_0xc4d9('0xf')],'sender':_0x53c30a[_0xc4d9('0x3e')]||_0x53c30a[_0xc4d9('0x24')],'authorization':_0x53c30a[_0xc4d9('0x22')]};var _0x558296={'method':_0xc4d9('0x36'),'uri':_0xc4d9('0x3f'),'body':_0x53038e,'json':!![]};rp(_0x558296)[_0xc4d9('0x19')](function(_0x2dd1f7){var _0x1b9c3f={'messageId':_0x2dd1f7['requestid']};if(!_0x53c30a[_0xc4d9('0x3a')]){_0x1b9c3f[_0xc4d9('0x40')]=!![];}return _0x293fc8[_0xc4d9('0x1a')](_0x1b9c3f);})[_0xc4d9('0x1c')](function(_0x2dc3a4){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc4d9('0x29'),_0xc4d9('0x3d'),util[_0xc4d9('0x2a')](_0x2dc3a4,{'showHidden':![],'depth':null}));});}else{logger[_0xc4d9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc4d9('0x29'),_0xc4d9('0x3d'),_0xc4d9('0x41'));}break;case _0xc4d9('0x42'):if(_0x53c30a[_0xc4d9('0x31')]&&_0x53c30a[_0xc4d9('0x43')]){var _0x53038e={'messages':[{'source':_0xc4d9('0x44'),'to':_0x7f605a[_0xc4d9('0x24')],'body':_0x7f605a[_0xc4d9('0xf')],'from':_0x53c30a[_0xc4d9('0x3e')]||_0x53c30a[_0xc4d9('0x24')]}]};var _0x10b177=util[_0xc4d9('0x45')]('%s:%s',_0x53c30a['username'],_0x53c30a['password']);var _0x558296={'method':_0xc4d9('0x36'),'uri':_0xc4d9('0x46'),'body':_0x53038e,'headers':{'Authorization':util[_0xc4d9('0x45')]('Basic\x20%s',new Buffer(_0x10b177)['toString'](_0xc4d9('0x47')))},'json':!![]};rp(_0x558296)[_0xc4d9('0x19')](function(_0x190cc4){if(_0x190cc4[_0xc4d9('0x48')]>=0xc8&&_0x190cc4[_0xc4d9('0x48')]<=0xce){if(_0x190cc4[_0xc4d9('0x49')]&&_0x190cc4[_0xc4d9('0x49')][_0xc4d9('0x4a')]>0x0){var _0x2bcef6=_[_0xc4d9('0x4b')](_0x190cc4[_0xc4d9('0x49')][_0xc4d9('0x23')]);var _0x20d3e4={'messageId':_0x2bcef6[_0xc4d9('0x4c')]};if(!_0x53c30a[_0xc4d9('0x3a')]){_0x20d3e4[_0xc4d9('0x40')]=!![];}return _0x293fc8[_0xc4d9('0x1a')](_0x20d3e4);}else{logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),_0xc4d9('0x4d'),util['inspect'](_0x190cc4,{'showHidden':![],'depth':null}));}}else{logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),'clickSend',util[_0xc4d9('0x2a')](_0x190cc4,{'showHidden':![],'depth':null}));}})[_0xc4d9('0x1c')](function(_0xba5256){logger['error'](_0xc4d9('0x2b'),'afterCreate','clickSend',util[_0xc4d9('0x2a')](_0xba5256,{'showHidden':![],'depth':null}));});}else{logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),'afterCreate',_0xc4d9('0x4d'),_0xc4d9('0x3c'));}break;case'plivo':if(_0x53c30a[_0xc4d9('0x4e')]&&_0x53c30a[_0xc4d9('0x22')]){var _0x53038e={'dst':_0x7f605a[_0xc4d9('0x24')],'text':_0x7f605a[_0xc4d9('0xf')],'src':_0x53c30a[_0xc4d9('0x3e')]||_0x53c30a[_0xc4d9('0x24')],'url':_0x53c30a[_0xc4d9('0x4f')]+_0xc4d9('0x25')+_0x7f605a['id']+_0xc4d9('0x26')+_0x53c30a[_0xc4d9('0x27')]};var _0x10b177=util['format'](_0xc4d9('0x50'),_0x53c30a[_0xc4d9('0x4e')],_0x53c30a[_0xc4d9('0x22')]);var _0x558296={'method':_0xc4d9('0x36'),'uri':util[_0xc4d9('0x45')]('https://api.plivo.com/v1/Account/%s/Message/',_0x53c30a[_0xc4d9('0x4e')]),'body':_0x53038e,'headers':{'Authorization':util[_0xc4d9('0x45')](_0xc4d9('0x51'),new Buffer(_0x10b177)[_0xc4d9('0x52')]('base64'))},'json':!![]};rp(_0x558296)[_0xc4d9('0x19')](function(_0x181173){var _0x479a68={'messageId':_0x181173[_0xc4d9('0x53')][0x0]};return _0x293fc8['update'](_0x479a68);})['catch'](function(_0x1c9536){logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),'plivo',util[_0xc4d9('0x2a')](_0x1c9536,{'showHidden':![],'depth':null}));});}else{logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),_0xc4d9('0x54'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xc4d9('0x55'):if(_0x53c30a[_0xc4d9('0x31')]&&_0x53c30a['password']){if(_0x53c30a['baseUrl']){var _0x1a6733={'method':_0xc4d9('0x36'),'uri':_0x53c30a['baseUrl']+_0xc4d9('0x56'),'body':{'username':_0x53c30a['username'],'password':_0x53c30a[_0xc4d9('0x43')]},'json':!![]};return rp(_0x1a6733)['then'](function(_0x53c6f1){var _0xa0c3bd={'method':_0xc4d9('0x36'),'uri':_0x53c30a[_0xc4d9('0x57')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x53c30a[_0xc4d9('0x24')],'destinations':[{'to':_0x7f605a['phone']}],'text':_0x7f605a[_0xc4d9('0xf')],'notifyUrl':_0x53c30a[_0xc4d9('0x4f')]+'/api/sms/messages/'+_0x7f605a['id']+'/status?token='+_0x53c30a[_0xc4d9('0x27')],'notifyContentType':_0xc4d9('0x58'),'callbackData':_0x53c30a[_0xc4d9('0x24')]+';'+_0x7f605a[_0xc4d9('0xf')]}]},'headers':{'Authorization':_0xc4d9('0x59')+_0x53c6f1[_0xc4d9('0x27')]},'json':!![]};return rp(_0xa0c3bd)[_0xc4d9('0x19')](function(_0x38b142){if(_0x38b142['messages']){var _0x593567={'messageId':_0x38b142[_0xc4d9('0x23')][0x0][_0xc4d9('0xd')]};if(!_0x53c30a[_0xc4d9('0x3a')]){_0x593567[_0xc4d9('0x40')]=!![];}return _0x293fc8[_0xc4d9('0x1a')](_0x593567);}else{return logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),'afterCreate','infobip',util[_0xc4d9('0x2a')](_0x38b142,{'showHidden':![],'depth':null}));}});})[_0xc4d9('0x1c')](function(_0x2ddb7a){return logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),_0xc4d9('0x55'),util['inspect'](_0x2ddb7a,{'showHidden':![],'depth':null}));});}else{logger[_0xc4d9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc4d9('0x55'),_0xc4d9('0x5a'));}}else{logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),'afterCreate','infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xc4d9('0x5b'):var _0x20d785=require('crypto');if(_0x53c30a[_0xc4d9('0x5c')]){var _0x6cc46b={};_0x6cc46b['login']=_0x53c30a[_0xc4d9('0x31')];_0x6cc46b[_0xc4d9('0x24')]=_0x7f605a['phone'];_0x6cc46b[_0xc4d9('0x2f')]=_0x53c30a[_0xc4d9('0x24')];_0x6cc46b[_0xc4d9('0x5d')]=_0x7f605a[_0xc4d9('0xf')];_0x6cc46b[_0xc4d9('0x5e')]=+new Date();var _0xdaa1e0='';var _0x30407f='';var _0x1caf33=Object[_0xc4d9('0x5f')](_0x6cc46b);_0x1caf33[_0xc4d9('0x60')]();for(var _0x416100=0x0;_0x416100<_0x1caf33[_0xc4d9('0x61')];_0x416100++){if(_0xdaa1e0!=''){_0xdaa1e0+='&';}_0xdaa1e0+=_0x1caf33[_0x416100]+'='+encodeURIComponent(_0x6cc46b[_0x1caf33[_0x416100]]);_0x30407f+=_0x6cc46b[_0x1caf33[_0x416100]];}_0x30407f+=_0x53c30a[_0xc4d9('0x5c')];_0x30407f=_0x20d785[_0xc4d9('0x62')]('md5')[_0xc4d9('0x1a')](_0x30407f)[_0xc4d9('0x63')](_0xc4d9('0x64'));if(_0xdaa1e0!==''){_0xdaa1e0+='&';}_0xdaa1e0+=_0xc4d9('0x65')+_0x30407f;var _0x414106={'method':_0xc4d9('0x33'),'uri':_0x53c30a[_0xc4d9('0x57')]+_0xc4d9('0x66')+_0xdaa1e0,'json':!![]};return rp(_0x414106)[_0xc4d9('0x19')](function(_0x1f03c2){var _0x5265bc=Object['keys'](_0x1f03c2);if(_0x1f03c2[_0x5265bc[0x0]][_0xc4d9('0x1d')]&&parseInt(_0x1f03c2[_0x5265bc[0x0]][_0xc4d9('0x1d')])===0x0){var _0x1d7de0={'messageId':_0x1f03c2[_0x5265bc[0x0]][_0xc4d9('0x67')]};if(!_0x53c30a[_0xc4d9('0x3a')]){_0x1d7de0['read']=!![];}return _0x293fc8[_0xc4d9('0x1a')](_0x1d7de0);}else{return logger[_0xc4d9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc4d9('0x29'),_0xc4d9('0x5b'),util['inspect'](_0x1f03c2[_0xc4d9('0x1d')],{'showHidden':![],'depth':null}));}})[_0xc4d9('0x1c')](function(_0x3bcac8){return logger[_0xc4d9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc4d9('0x29'),_0xc4d9('0x5b'),util['inspect'](_0x3bcac8,{'showHidden':![],'depth':null}));});}else{logger[_0xc4d9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc4d9('0x5b'),_0xc4d9('0x68'));}break;case _0xc4d9('0x69'):if(_0x53c30a[_0xc4d9('0x5c')]){var _0x54de17={'method':_0xc4d9('0x36'),'uri':_0xc4d9('0x6a'),'headers':{'Authorization':_0x53c30a['apiKey']},'body':{'content':_0x7f605a[_0xc4d9('0xf')],'to':[_0x7f605a[_0xc4d9('0x24')]],'from':_0x53c30a[_0xc4d9('0x24')],'binary':![],'clientMessageId':_0xc4d9('0x6b'),'charset':_0xc4d9('0x6c')},'json':!![]};rp(_0x54de17)[_0xc4d9('0x19')](function(_0x167372){if(!_0x167372[_0xc4d9('0x1d')]){var _0x17a482={'messageId':_0x167372[_0xc4d9('0x23')][0x0][_0xc4d9('0x6d')]};if(!_0x53c30a[_0xc4d9('0x3a')]){_0x17a482[_0xc4d9('0x40')]=!![];}return _0x293fc8[_0xc4d9('0x1a')](_0x17a482);}else{return logger['error'](_0xc4d9('0x2b'),'afterCreate',_0xc4d9('0x69'),util[_0xc4d9('0x2a')](_0x167372['error'],{'showHidden':![],'depth':null}));}})[_0xc4d9('0x1c')](function(_0x57a87e){return logger['error'](_0xc4d9('0x2b'),_0xc4d9('0x29'),_0xc4d9('0x69'),util[_0xc4d9('0x2a')](_0x57a87e,{'showHidden':![],'depth':null}));});}else{logger[_0xc4d9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc4d9('0x29'),_0xc4d9('0x69'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x53c30a[_0xc4d9('0x31')]&&_0x53c30a[_0xc4d9('0x43')]){var _0x10b177=util[_0xc4d9('0x45')](_0xc4d9('0x50'),_0x53c30a[_0xc4d9('0x31')],_0x53c30a[_0xc4d9('0x43')]);var _0x558296={'method':_0xc4d9('0x36'),'uri':_0xc4d9('0x6e')+_0x53c30a['accountId']+_0xc4d9('0x6f'),'body':{'to':[_0x7f605a[_0xc4d9('0x24')]],'text':_0x7f605a['body'],'from':_0x53c30a[_0xc4d9('0x24')],'applicationId':_0x53c30a[_0xc4d9('0x70')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x10b177)[_0xc4d9('0x52')](_0xc4d9('0x47')))},'json':!![]};rp(_0x558296)['then'](function(_0x3fbcbc){if(_0x3fbcbc['id']){var _0x17af6b={'messageId':_0x3fbcbc['id']};return _0x293fc8[_0xc4d9('0x1a')](_0x17af6b);}else{logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),'bandwidth',util[_0xc4d9('0x2a')](_0x3fbcbc,{'showHidden':![],'depth':null}));}})[_0xc4d9('0x1c')](function(_0x509f0e){logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),'bandwidth',util[_0xc4d9('0x2a')](_0x509f0e,{'showHidden':![],'depth':null}));});}else{logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),_0xc4d9('0x71'),_0xc4d9('0x3c'));}break;case'intelepeer':if(_0x53c30a[_0xc4d9('0x5c')]){var _0x2e4d29={};var _0x414106={'method':_0xc4d9('0x36'),'uri':_0xc4d9('0x72'),'headers':{'Authorization':_0xc4d9('0x73')+_0x53c30a[_0xc4d9('0x5c')],'Content-Type':_0xc4d9('0x58')},'body':{'from':_0x53c30a[_0xc4d9('0x24')],'to':_0x7f605a[_0xc4d9('0x24')],'text':_0x7f605a[_0xc4d9('0xf')]},'json':!![]};return rp(_0x414106)[_0xc4d9('0x19')](function(_0x2ea2cc){if(_0x2ea2cc['code']==0xca){_0x2e4d29[_0xc4d9('0x74')]=_0x2ea2cc;var _0x2ce646={'method':_0xc4d9('0x36'),'uri':_0xc4d9('0x75'),'headers':{'Authorization':_0xc4d9('0x73')+_0x53c30a[_0xc4d9('0x5c')],'Content-Type':_0xc4d9('0x58')},'body':{'refid':_0x2e4d29['message'][_0xc4d9('0x76')]},'json':!![]};return rp(_0x2ce646)['then'](function(_0x5bc316){_0x2e4d29[_0xc4d9('0x77')]=_0x5bc316;var _0x421839={'messageId':_0x2e4d29[_0xc4d9('0x74')][_0xc4d9('0x76')],'read':!![]};return _0x293fc8['update'](_0x421839);});}else{return logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),_0xc4d9('0x78'),util[_0xc4d9('0x2a')](_0x2ea2cc,{'showHidden':![],'depth':null}));}})[_0xc4d9('0x1c')](function(_0x47ad0c){return logger[_0xc4d9('0x1d')](_0xc4d9('0x2b'),_0xc4d9('0x29'),_0xc4d9('0x78'),util[_0xc4d9('0x2a')](_0x47ad0c,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xc4d9('0x2b'),'afterCreate','intelepeer',_0xc4d9('0x79'));}break;}}})[_0xc4d9('0x7a')](function(){_0x3a4488();});}else{_0x3a4488();}}},'charset':_0xc4d9('0x7b'),'collate':_0xc4d9('0x7c')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index a9204a9..8cc3a89 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 _0x731b=['debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','then','stringify','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./smsMessage.socket','register','info'];(function(_0x1f644d,_0x348a35){var _0x1a6315=function(_0x1e4a14){while(--_0x1e4a14){_0x1f644d['push'](_0x1f644d['shift']());}};_0x1a6315(++_0x348a35);}(_0x731b,0xb7));var _0xb731=function(_0x430d51,_0x39d7f6){_0x430d51=_0x430d51-0x0;var _0x193d79=_0x731b[_0x430d51];return _0x193d79;};'use strict';var _=require('lodash');var util=require(_0xb731('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb731('0x1'));var fs=require('fs');var Redis=require(_0xb731('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb731('0x3'));var logger=require(_0xb731('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb731('0x5'));var client=jayson[_0xb731('0x6')][_0xb731('0x7')]({'port':0x232a});config[_0xb731('0x8')]=_['defaults'](config[_0xb731('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb731('0x9'))(new Redis(config[_0xb731('0x8')]));require(_0xb731('0xa'))[_0xb731('0xb')](socket);function respondWithRpcPromise(_0xe7f691,_0x286064,_0x3cc756){return new BPromise(function(_0x1e9bec,_0x4cb541){return client['request'](_0xe7f691,_0x3cc756)['then'](function(_0x3d4f7a){logger[_0xb731('0xc')]('SmsMessage,\x20%s,\x20%s',_0x286064,'request\x20sent');logger[_0xb731('0xd')](_0xb731('0xe'),_0x286064,_0xb731('0xf'),JSON['stringify'](_0x3d4f7a));if(_0x3d4f7a[_0xb731('0x10')]){if(_0x3d4f7a[_0xb731('0x10')]['code']===0x1f4){logger['error'](_0xb731('0x11'),_0x286064,_0x3d4f7a[_0xb731('0x10')][_0xb731('0x12')]);return _0x4cb541(_0x3d4f7a[_0xb731('0x10')][_0xb731('0x12')]);}logger[_0xb731('0x10')](_0xb731('0x11'),_0x286064,_0x3d4f7a[_0xb731('0x10')][_0xb731('0x12')]);return _0x1e9bec(_0x3d4f7a[_0xb731('0x10')][_0xb731('0x12')]);}else{logger['info'](_0xb731('0x11'),_0x286064,_0xb731('0xf'));_0x1e9bec(_0x3d4f7a[_0xb731('0x13')][_0xb731('0x12')]);}})[_0xb731('0x14')](function(_0x1f0887){logger['error'](_0xb731('0x11'),_0x286064,_0x1f0887);_0x4cb541(_0x1f0887);});});}exports[_0xb731('0x15')]=function(_0x300e48){var _0x3e3d21=this;return new Promise(function(_0xce3487,_0x13abd2){return db[_0xb731('0x16')][_0xb731('0x17')](_0x300e48[_0xb731('0x18')],{'raw':_0x300e48[_0xb731('0x19')]?_0x300e48[_0xb731('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xb731('0x1a')](function(_0x217cc5){logger[_0xb731('0xc')]('CreateSmsMessage',_0x300e48);logger[_0xb731('0xd')]('CreateSmsMessage',_0x300e48,JSON[_0xb731('0x1b')](_0x217cc5));_0xce3487(_0x217cc5);})['catch'](function(_0xad7231){logger[_0xb731('0x10')](_0xb731('0x15'),_0xad7231['message'],_0x300e48);_0x13abd2(_0x3e3d21[_0xb731('0x10')](0x1f4,_0xad7231[_0xb731('0x12')]));});});}; \ No newline at end of file +var _0x8035=['message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2131bd,_0x38d8de){var _0x378839=function(_0x397320){while(--_0x397320){_0x2131bd['push'](_0x2131bd['shift']());}};_0x378839(++_0x38d8de);}(_0x8035,0x1e8));var _0x5803=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x8035[_0x4450b1];return _0x399b0b;};'use strict';var _=require(_0x5803('0x0'));var util=require(_0x5803('0x1'));var moment=require('moment');var BPromise=require(_0x5803('0x2'));var rs=require(_0x5803('0x3'));var fs=require('fs');var Redis=require(_0x5803('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5803('0x5'));var logger=require(_0x5803('0x6'))(_0x5803('0x7'));var config=require(_0x5803('0x8'));var jayson=require(_0x5803('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x5803('0xa')]=_[_0x5803('0xb')](config[_0x5803('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5803('0xa')]));require(_0x5803('0xc'))['register'](socket);function respondWithRpcPromise(_0x216916,_0x3b3f10,_0x1cdb02){return new BPromise(function(_0x1d752d,_0x357bb){return client[_0x5803('0xd')](_0x216916,_0x1cdb02)[_0x5803('0xe')](function(_0x341082){logger['info'](_0x5803('0xf'),_0x3b3f10,'request\x20sent');logger[_0x5803('0x10')](_0x5803('0x11'),_0x3b3f10,_0x5803('0x12'),JSON[_0x5803('0x13')](_0x341082));if(_0x341082[_0x5803('0x14')]){if(_0x341082[_0x5803('0x14')][_0x5803('0x15')]===0x1f4){logger['error'](_0x5803('0xf'),_0x3b3f10,_0x341082[_0x5803('0x14')][_0x5803('0x16')]);return _0x357bb(_0x341082[_0x5803('0x14')][_0x5803('0x16')]);}logger[_0x5803('0x14')]('SmsMessage,\x20%s,\x20%s',_0x3b3f10,_0x341082[_0x5803('0x14')]['message']);return _0x1d752d(_0x341082['error'][_0x5803('0x16')]);}else{logger[_0x5803('0x17')](_0x5803('0xf'),_0x3b3f10,_0x5803('0x12'));_0x1d752d(_0x341082[_0x5803('0x18')][_0x5803('0x16')]);}})[_0x5803('0x19')](function(_0x41aebf){logger[_0x5803('0x14')](_0x5803('0xf'),_0x3b3f10,_0x41aebf);_0x357bb(_0x41aebf);});});}exports[_0x5803('0x1a')]=function(_0x1749de){var _0xcb41e1=this;return new Promise(function(_0x1e282e,_0x3f2cdb){return db[_0x5803('0x1b')][_0x5803('0x1c')](_0x1749de[_0x5803('0x1d')],{'raw':_0x1749de['options']?_0x1749de['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x69779e){logger['info'](_0x5803('0x1a'),_0x1749de);logger[_0x5803('0x10')](_0x5803('0x1a'),_0x1749de,JSON['stringify'](_0x69779e));_0x1e282e(_0x69779e);})[_0x5803('0x19')](function(_0x8eb143){logger[_0x5803('0x14')](_0x5803('0x1a'),_0x8eb143[_0x5803('0x16')],_0x1749de);_0x3f2cdb(_0xcb41e1['error'](0x1f4,_0x8eb143['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7f990d2..9c8f7e6 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 _0xd49f=['./smsMessage.events','remove','update','emit','register','length','smsMessage:'];(function(_0xdeccbe,_0x44f608){var _0x43fafd=function(_0x58b227){while(--_0x58b227){_0xdeccbe['push'](_0xdeccbe['shift']());}};_0x43fafd(++_0x44f608);}(_0xd49f,0x8c));var _0xfd49=function(_0x30c48d,_0x25e828){_0x30c48d=_0x30c48d-0x0;var _0x2c64aa=_0xd49f[_0x30c48d];return _0x2c64aa;};'use strict';var SmsMessageEvents=require(_0xfd49('0x0'));var events=['save',_0xfd49('0x1'),_0xfd49('0x2')];function createListener(_0x1a2253,_0x5d9d97){return function(_0x41c31d){_0x5d9d97[_0xfd49('0x3')](_0x1a2253,_0x41c31d);};}function removeListener(_0x1004d0,_0x695171){return function(){SmsMessageEvents['removeListener'](_0x1004d0,_0x695171);};}exports[_0xfd49('0x4')]=function(_0x237df1){for(var _0x26b0eb=0x0,_0xf6a01c=events[_0xfd49('0x5')];_0x26b0eb<_0xf6a01c;_0x26b0eb++){var _0x578103=events[_0x26b0eb];var _0x5cf2b4=createListener(_0xfd49('0x6')+_0x578103,_0x237df1);SmsMessageEvents['on'](_0x578103,_0x5cf2b4);}}; \ No newline at end of file +var _0xf007=['register','length','smsMessage:','save','remove','update','emit'];(function(_0x12c2c2,_0x2d06b2){var _0x14be5e=function(_0x42a03e){while(--_0x42a03e){_0x12c2c2['push'](_0x12c2c2['shift']());}};_0x14be5e(++_0x2d06b2);}(_0xf007,0xa4));var _0x7f00=function(_0x2a66df,_0x4e9b7b){_0x2a66df=_0x2a66df-0x0;var _0x3186b2=_0xf007[_0x2a66df];return _0x3186b2;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x7f00('0x0'),_0x7f00('0x1'),_0x7f00('0x2')];function createListener(_0x13775f,_0x410b5a){return function(_0x31fbf6){_0x410b5a[_0x7f00('0x3')](_0x13775f,_0x31fbf6);};}function removeListener(_0x2e8298,_0x2f0425){return function(){SmsMessageEvents['removeListener'](_0x2e8298,_0x2f0425);};}exports[_0x7f00('0x4')]=function(_0x4bb7dd){for(var _0x3a3eb9=0x0,_0x5cfb3d=events[_0x7f00('0x5')];_0x3a3eb9<_0x5cfb3d;_0x3a3eb9++){var _0x3f617d=events[_0x3a3eb9];var _0x4103cf=createListener(_0x7f00('0x6')+_0x3f617d,_0x4bb7dd);SmsMessageEvents['on'](_0x3f617d,_0x4103cf);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7c2c3da..1d65014 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 _0x669e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','connect-timeout','Router'];(function(_0x214621,_0x2dfad1){var _0x2a9d70=function(_0x1c46cf){while(--_0x1c46cf){_0x214621['push'](_0x214621['shift']());}};_0x2a9d70(++_0x2dfad1);}(_0x669e,0x13c));var _0xe669=function(_0x4016f5,_0x2c286a){_0x4016f5=_0x4016f5-0x0;var _0x357185=_0x669e[_0x4016f5];return _0x357185;};'use strict';var multer=require(_0xe669('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe669('0x1'));var express=require('express');var router=express[_0xe669('0x2')]();var fs_extra=require(_0xe669('0x3'));var auth=require(_0xe669('0x4'));var interaction=require(_0xe669('0x5'));var config=require(_0xe669('0x6'));var controller=require(_0xe669('0x7'));router[_0xe669('0x8')]('/',auth[_0xe669('0x9')](),controller[_0xe669('0xa')]);router[_0xe669('0x8')](_0xe669('0xb'),auth[_0xe669('0x9')](),controller[_0xe669('0xc')]);router[_0xe669('0x8')]('/:id',auth[_0xe669('0x9')](),controller['show']);router[_0xe669('0x8')](_0xe669('0xd'),auth[_0xe669('0x9')](),controller[_0xe669('0xe')]);router[_0xe669('0x8')](_0xe669('0xf'),auth['isAuthenticated'](),controller[_0xe669('0x10')]);router['get']('/:id/users',auth[_0xe669('0x9')](),controller['getAgents']);router[_0xe669('0x11')]('/',auth[_0xe669('0x9')](),controller[_0xe669('0x12')]);router[_0xe669('0x11')](_0xe669('0xf'),auth[_0xe669('0x9')](),controller[_0xe669('0x13')]);router['post'](_0xe669('0x14'),auth['isAuthenticated'](),controller[_0xe669('0x15')]);router[_0xe669('0x16')]('/:id',auth[_0xe669('0x9')](),controller[_0xe669('0x17')]);router['delete']('/:id',auth[_0xe669('0x9')](),controller[_0xe669('0x18')]);router[_0xe669('0x19')](_0xe669('0xf'),auth['isAuthenticated'](),controller[_0xe669('0x1a')]);router[_0xe669('0x19')](_0xe669('0x14'),auth[_0xe669('0x9')](),controller[_0xe669('0x1b')]);module[_0xe669('0x1c')]=router; \ No newline at end of file +var _0xe012=['destroy','removeTeams','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete'];(function(_0x4fc602,_0x29dc2){var _0x13ea37=function(_0x51f8c2){while(--_0x51f8c2){_0x4fc602['push'](_0x4fc602['shift']());}};_0x13ea37(++_0x29dc2);}(_0xe012,0x98));var _0x2e01=function(_0x25c760,_0x450723){_0x25c760=_0x25c760-0x0;var _0x333345=_0xe012[_0x25c760];return _0x333345;};'use strict';var multer=require(_0x2e01('0x0'));var util=require(_0x2e01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2e01('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2e01('0x3'));var interaction=require(_0x2e01('0x4'));var config=require(_0x2e01('0x5'));var controller=require(_0x2e01('0x6'));router[_0x2e01('0x7')]('/',auth['isAuthenticated'](),controller[_0x2e01('0x8')]);router[_0x2e01('0x7')](_0x2e01('0x9'),auth[_0x2e01('0xa')](),controller[_0x2e01('0xb')]);router['get'](_0x2e01('0xc'),auth['isAuthenticated'](),controller[_0x2e01('0xd')]);router[_0x2e01('0x7')](_0x2e01('0xe'),auth[_0x2e01('0xa')](),controller[_0x2e01('0xf')]);router['get'](_0x2e01('0x10'),auth['isAuthenticated'](),controller[_0x2e01('0x11')]);router[_0x2e01('0x7')](_0x2e01('0x12'),auth[_0x2e01('0xa')](),controller['getAgents']);router[_0x2e01('0x13')]('/',auth[_0x2e01('0xa')](),controller['create']);router[_0x2e01('0x13')](_0x2e01('0x10'),auth['isAuthenticated'](),controller[_0x2e01('0x14')]);router[_0x2e01('0x13')]('/:id/users',auth[_0x2e01('0xa')](),controller['addAgents']);router['put'](_0x2e01('0xc'),auth[_0x2e01('0xa')](),controller[_0x2e01('0x15')]);router[_0x2e01('0x16')](_0x2e01('0xc'),auth[_0x2e01('0xa')](),controller[_0x2e01('0x17')]);router[_0x2e01('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2e01('0x18')]);router['delete'](_0x2e01('0x12'),auth[_0x2e01('0xa')](),controller['removeAgents']);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 14d2545..32317a8 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 _0xf0dd=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0xf0dd,0x184));var _0xdf0d=function(_0x5d1305,_0x316ad2){_0x5d1305=_0x5d1305-0x0;var _0x3368aa=_0xf0dd[_0x5d1305];return _0x3368aa;};'use strict';var Sequelize=require(_0xdf0d('0x0'));module[_0xdf0d('0x1')]={'name':{'type':Sequelize[_0xdf0d('0x2')],'unique':_0xdf0d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdf0d('0x2')]},'timeout':{'type':Sequelize[_0xdf0d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdf0d('0x5')](_0xdf0d('0x6'),'beepall',_0xdf0d('0x7'))}}; \ No newline at end of file +var _0x303a=['rrmemory','beepall','sequelize','exports','STRING','ENUM'];(function(_0x42b154,_0x2c83aa){var _0x376efc=function(_0x23e7c9){while(--_0x23e7c9){_0x42b154['push'](_0x42b154['shift']());}};_0x376efc(++_0x2c83aa);}(_0x303a,0x16a));var _0xa303=function(_0x1c16a4,_0xbba97c){_0x1c16a4=_0x1c16a4-0x0;var _0xa47eb7=_0x303a[_0x1c16a4];return _0xa47eb7;};'use strict';var Sequelize=require(_0xa303('0x0'));module[_0xa303('0x1')]={'name':{'type':Sequelize[_0xa303('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa303('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa303('0x3')](_0xa303('0x4'),_0xa303('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 4a61171..0969a7a 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 _0xb442=['crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','save','update','then','get','SmsQueues','UserProfileResource','destroy','stack','name','send','index','map','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SmsQueue','includeAll','findAll','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','User','findAndCountAll','agent','createdAt','rows','format','%s/%s','SIP','smsPause','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','flatMap','sequelize','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','union','compact','transaction','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs'];(function(_0x11d8cb,_0x47b580){var _0x326c6d=function(_0x172670){while(--_0x172670){_0x11d8cb['push'](_0x11d8cb['shift']());}};_0x326c6d(++_0x47b580);}(_0xb442,0x7d));var _0x2b44=function(_0x1a3e33,_0xe419f4){_0x1a3e33=_0x1a3e33-0x0;var _0x545085=_0xb442[_0x1a3e33];return _0x545085;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b44('0x0'));var zipdir=require(_0x2b44('0x1'));var jsonpatch=require(_0x2b44('0x2'));var rp=require(_0x2b44('0x3'));var moment=require(_0x2b44('0x4'));var BPromise=require(_0x2b44('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2b44('0x6'));var csv=require('to-csv');var ejs=require(_0x2b44('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b44('0x8'));var jsforce=require(_0x2b44('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x2b44('0xa'));var querystring=require(_0x2b44('0xb'));var Papa=require(_0x2b44('0xc'));var Redis=require('ioredis');var authService=require(_0x2b44('0xd'));var qs=require(_0x2b44('0xe'));var as=require(_0x2b44('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2b44('0x10'));var config=require(_0x2b44('0x11'));var licenseUtil=require(_0x2b44('0x12'));var db=require(_0x2b44('0x13'))['db'];config[_0x2b44('0x14')]=_[_0x2b44('0x15')](config[_0x2b44('0x14')],{'host':_0x2b44('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b44('0x14')]));require(_0x2b44('0x17'))['register'](socket);function respondWithStatusCode(_0x581104,_0x1632ac){_0x1632ac=_0x1632ac||0xcc;return function(_0x5a945e){if(_0x5a945e){return _0x581104[_0x2b44('0x18')](_0x1632ac);}return _0x581104[_0x2b44('0x19')](_0x1632ac)[_0x2b44('0x1a')]();};}function respondWithResult(_0x5c929e,_0x56bbb1){_0x56bbb1=_0x56bbb1||0xc8;return function(_0x4e09f8){if(_0x4e09f8){return _0x5c929e[_0x2b44('0x19')](_0x56bbb1)[_0x2b44('0x1b')](_0x4e09f8);}};}function respondWithFilteredResult(_0x2de760,_0x1a7d34){return function(_0x27a948){if(_0x27a948){var _0x5170ba=typeof _0x1a7d34[_0x2b44('0x1c')]==='undefined'&&typeof _0x1a7d34[_0x2b44('0x1d')]===_0x2b44('0x1e');var _0x59d52b=_0x27a948[_0x2b44('0x1f')];var _0xaf8cc3=_0x5170ba?0x0:_0x1a7d34[_0x2b44('0x1c')];var _0xf488f6=_0x5170ba?_0x27a948[_0x2b44('0x1f')]:_0x1a7d34[_0x2b44('0x1c')]+_0x1a7d34['limit'];var _0x1a8cc8;if(_0xf488f6>=_0x59d52b){_0xf488f6=_0x59d52b;_0x1a8cc8=0xc8;}else{_0x1a8cc8=0xce;}_0x2de760[_0x2b44('0x19')](_0x1a8cc8);return _0x2de760['set'](_0x2b44('0x20'),_0xaf8cc3+'-'+_0xf488f6+'/'+_0x59d52b)[_0x2b44('0x1b')](_0x27a948);}return null;};}function patchUpdates(_0x160e50){return function(_0x12040d){try{jsonpatch['apply'](_0x12040d,_0x160e50,!![]);}catch(_0x3865de){return BPromise['reject'](_0x3865de);}return _0x12040d[_0x2b44('0x21')]();};}function saveUpdates(_0x17dff1,_0x4a0718){return function(_0x3db329){if(_0x3db329){return _0x3db329[_0x2b44('0x22')](_0x17dff1)[_0x2b44('0x23')](function(_0x4e59f1){return _0x4e59f1;});}return null;};}function removeEntity(_0x42f955,_0x354aad){return function(_0x4438f6){if(_0x4438f6){return _0x4438f6['destroy']()['then'](function(){var _0x28454a=_0x4438f6[_0x2b44('0x24')]({'plain':!![]});var _0x59fc38=_0x2b44('0x25');return db[_0x2b44('0x26')][_0x2b44('0x27')]({'where':{'type':_0x59fc38,'resourceId':_0x28454a['id']}})['then'](function(){return _0x4438f6;});})['then'](function(){_0x42f955[_0x2b44('0x19')](0xcc)[_0x2b44('0x1a')]();});}};}function handleEntityNotFound(_0x2fc253,_0x13e618){return function(_0x59cb09){if(!_0x59cb09){_0x2fc253[_0x2b44('0x18')](0x194);}return _0x59cb09;};}function handleError(_0x4e6a6e,_0x23becf){_0x23becf=_0x23becf||0x1f4;return function(_0x2fa8a2){logger['error'](_0x2fa8a2[_0x2b44('0x28')]);if(_0x2fa8a2[_0x2b44('0x29')]){delete _0x2fa8a2['name'];}_0x4e6a6e[_0x2b44('0x19')](_0x23becf)[_0x2b44('0x2a')](_0x2fa8a2);};}exports[_0x2b44('0x2b')]=function(_0x102326,_0x2c88d1){var _0x2b358d={},_0x156551={},_0xc9a384={'count':0x0,'rows':[]};var _0x57f781=_[_0x2b44('0x2c')](db['SmsQueue']['rawAttributes'],function(_0x4bf280){return{'name':_0x4bf280['fieldName'],'type':_0x4bf280[_0x2b44('0x2d')][_0x2b44('0x2e')]};});_0x156551['model']=_[_0x2b44('0x2c')](_0x57f781,_0x2b44('0x29'));_0x156551['query']=_[_0x2b44('0x2f')](_0x102326[_0x2b44('0x30')]);_0x156551[_0x2b44('0x31')]=_[_0x2b44('0x32')](_0x156551[_0x2b44('0x33')],_0x156551[_0x2b44('0x30')]);_0x2b358d[_0x2b44('0x34')]=_[_0x2b44('0x32')](_0x156551[_0x2b44('0x33')],qs[_0x2b44('0x35')](_0x102326['query']['fields']));_0x2b358d[_0x2b44('0x34')]=_0x2b358d[_0x2b44('0x34')][_0x2b44('0x36')]?_0x2b358d[_0x2b44('0x34')]:_0x156551[_0x2b44('0x33')];if(!_0x102326[_0x2b44('0x30')][_0x2b44('0x37')](_0x2b44('0x38'))){_0x2b358d[_0x2b44('0x1d')]=qs[_0x2b44('0x1d')](_0x102326[_0x2b44('0x30')][_0x2b44('0x1d')]);_0x2b358d[_0x2b44('0x1c')]=qs[_0x2b44('0x1c')](_0x102326[_0x2b44('0x30')]['offset']);}_0x2b358d[_0x2b44('0x39')]=qs[_0x2b44('0x3a')](_0x102326[_0x2b44('0x30')][_0x2b44('0x3a')]);_0x2b358d[_0x2b44('0x3b')]=qs[_0x2b44('0x31')](_['pick'](_0x102326[_0x2b44('0x30')],_0x156551['filters']),_0x57f781);if(_0x102326[_0x2b44('0x30')][_0x2b44('0x3c')]){_0x2b358d[_0x2b44('0x3b')]=_[_0x2b44('0x3d')](_0x2b358d['where'],{'$or':_['map'](_0x57f781,function(_0x231ebd){if(_0x231ebd[_0x2b44('0x2d')]!==_0x2b44('0x3e')){var _0xf434e6={};_0xf434e6[_0x231ebd['name']]={'$like':'%'+_0x102326[_0x2b44('0x30')][_0x2b44('0x3c')]+'%'};return _0xf434e6;}})});}_0x2b358d=_[_0x2b44('0x3d')]({},_0x2b358d,_0x102326[_0x2b44('0x3f')]);var _0x49bb01={'where':_0x2b358d[_0x2b44('0x3b')]};return db[_0x2b44('0x40')][_0x2b44('0x1f')](_0x49bb01)['then'](function(_0x701ca3){_0xc9a384[_0x2b44('0x1f')]=_0x701ca3;if(_0x102326[_0x2b44('0x30')][_0x2b44('0x41')]){_0x2b358d['include']=[{'all':!![]}];}return db[_0x2b44('0x40')][_0x2b44('0x42')](_0x2b358d);})[_0x2b44('0x23')](function(_0x582f39){_0xc9a384['rows']=_0x582f39;return _0xc9a384;})['then'](respondWithFilteredResult(_0x2c88d1,_0x2b358d))[_0x2b44('0x43')](handleError(_0x2c88d1,null));};exports[_0x2b44('0x44')]=function(_0x106669,_0x460828){var _0x20ba8c={'raw':!![],'where':{'id':_0x106669[_0x2b44('0x45')]['id']}},_0x50ede0={};_0x50ede0['model']=_[_0x2b44('0x2f')](db[_0x2b44('0x40')][_0x2b44('0x46')]);_0x50ede0[_0x2b44('0x30')]=_['keys'](_0x106669[_0x2b44('0x30')]);_0x50ede0[_0x2b44('0x31')]=_[_0x2b44('0x32')](_0x50ede0[_0x2b44('0x33')],_0x50ede0[_0x2b44('0x30')]);_0x20ba8c[_0x2b44('0x34')]=_[_0x2b44('0x32')](_0x50ede0[_0x2b44('0x33')],qs[_0x2b44('0x35')](_0x106669[_0x2b44('0x30')]['fields']));_0x20ba8c[_0x2b44('0x34')]=_0x20ba8c[_0x2b44('0x34')][_0x2b44('0x36')]?_0x20ba8c[_0x2b44('0x34')]:_0x50ede0[_0x2b44('0x33')];if(_0x106669[_0x2b44('0x30')][_0x2b44('0x41')]){_0x20ba8c['include']=[{'all':!![]}];}_0x20ba8c=_['merge']({},_0x20ba8c,_0x106669[_0x2b44('0x3f')]);return db['SmsQueue'][_0x2b44('0x47')](_0x20ba8c)[_0x2b44('0x23')](handleEntityNotFound(_0x460828,null))['then'](respondWithResult(_0x460828,null))['catch'](handleError(_0x460828,null));};exports[_0x2b44('0x48')]=function(_0x20a0a3,_0x1b05c){return db[_0x2b44('0x40')][_0x2b44('0x48')](_0x20a0a3[_0x2b44('0x49')],{})[_0x2b44('0x23')](function(_0x2e2633){var _0x14acbc=_0x20a0a3[_0x2b44('0x4a')][_0x2b44('0x24')]({'plain':!![]});if(!_0x14acbc)throw new Error(_0x2b44('0x4b'));if(_0x14acbc[_0x2b44('0x4c')]===_0x2b44('0x4a')){var _0x5a8562=_0x2e2633[_0x2b44('0x24')]({'plain':!![]});var _0x325881='SmsQueues';return db['UserProfileSection'][_0x2b44('0x47')]({'where':{'name':_0x325881,'userProfileId':_0x14acbc[_0x2b44('0x4d')]},'raw':!![]})[_0x2b44('0x23')](function(_0xdd3623){if(_0xdd3623&&_0xdd3623[_0x2b44('0x4e')]===0x0){return db[_0x2b44('0x26')][_0x2b44('0x48')]({'name':_0x5a8562[_0x2b44('0x29')],'resourceId':_0x5a8562['id'],'type':_0xdd3623[_0x2b44('0x29')],'sectionId':_0xdd3623['id']},{})[_0x2b44('0x23')](function(){return _0x2e2633;});}else{return _0x2e2633;}})['catch'](function(_0x30e48f){logger[_0x2b44('0x4f')](_0x2b44('0x50'),_0x30e48f);throw _0x30e48f;});}return _0x2e2633;})[_0x2b44('0x23')](respondWithResult(_0x1b05c,0xc9))['catch'](handleError(_0x1b05c,null));};exports[_0x2b44('0x22')]=function(_0x6a068c,_0x130430){if(_0x6a068c['body']['id']){delete _0x6a068c[_0x2b44('0x49')]['id'];}return db['SmsQueue'][_0x2b44('0x47')]({'where':{'id':_0x6a068c[_0x2b44('0x45')]['id']}})['then'](handleEntityNotFound(_0x130430,null))['then'](saveUpdates(_0x6a068c[_0x2b44('0x49')],null))[_0x2b44('0x23')](respondWithResult(_0x130430,null))[_0x2b44('0x43')](handleError(_0x130430,null));};exports[_0x2b44('0x27')]=function(_0x4c7042,_0x4bb8f9){return db[_0x2b44('0x40')][_0x2b44('0x47')]({'where':{'id':_0x4c7042['params']['id']}})[_0x2b44('0x23')](handleEntityNotFound(_0x4bb8f9,null))[_0x2b44('0x23')](removeEntity(_0x4bb8f9,null))['catch'](handleError(_0x4bb8f9,null));};exports[_0x2b44('0x51')]=function(_0x2c1837,_0x101d0b){return db[_0x2b44('0x40')][_0x2b44('0x51')]()[_0x2b44('0x23')](respondWithResult(_0x101d0b,null))[_0x2b44('0x43')](handleError(_0x101d0b,null));};exports[_0x2b44('0x52')]=function(_0x526dfe,_0x8ae48,_0x20d703){var _0x5ea40e={'raw':!![],'where':{}},_0x46e9ee={},_0x171500;return db['SmsQueue'][_0x2b44('0x53')]({'where':{'id':_0x526dfe[_0x2b44('0x45')]['id']}})[_0x2b44('0x23')](handleEntityNotFound(_0x8ae48,null))['then'](function(_0x196885){if(_0x196885){_0x171500=_0x196885[_0x2b44('0x24')]({'plain':!![]});_0x46e9ee[_0x2b44('0x33')]=_[_0x2b44('0x2f')](db[_0x2b44('0x54')][_0x2b44('0x46')]);_0x46e9ee[_0x2b44('0x30')]=_[_0x2b44('0x2f')](_0x526dfe['query']);_0x46e9ee['filters']=_[_0x2b44('0x32')](_0x46e9ee[_0x2b44('0x33')],_0x46e9ee[_0x2b44('0x30')]);_0x5ea40e[_0x2b44('0x34')]=_[_0x2b44('0x32')](_0x46e9ee[_0x2b44('0x33')],qs[_0x2b44('0x35')](_0x526dfe[_0x2b44('0x30')]['fields']));_0x5ea40e[_0x2b44('0x34')]=_0x5ea40e['attributes']['length']?_0x5ea40e[_0x2b44('0x34')]:_0x46e9ee[_0x2b44('0x33')];if(!_0x526dfe['query'][_0x2b44('0x37')](_0x2b44('0x38'))){_0x5ea40e[_0x2b44('0x1d')]=qs['limit'](_0x526dfe['query'][_0x2b44('0x1d')]);_0x5ea40e[_0x2b44('0x1c')]=qs[_0x2b44('0x1c')](_0x526dfe[_0x2b44('0x30')][_0x2b44('0x1c')]);}_0x5ea40e[_0x2b44('0x39')]=qs['sort'](_0x526dfe[_0x2b44('0x30')][_0x2b44('0x3a')]);_0x5ea40e[_0x2b44('0x3b')]=qs[_0x2b44('0x31')](_[_0x2b44('0x55')](_0x526dfe[_0x2b44('0x30')],_0x46e9ee[_0x2b44('0x31')]));_0x5ea40e[_0x2b44('0x3b')][_0x2b44('0x56')]=_0x196885['id'];if(_0x526dfe[_0x2b44('0x30')][_0x2b44('0x3c')]){_0x5ea40e[_0x2b44('0x3b')]=_['merge'](_0x5ea40e['where'],{'$or':_['map'](_0x5ea40e['attributes'],function(_0x42ba77){var _0xcc0739={};_0xcc0739[_0x42ba77]={'$like':'%'+_0x526dfe['query'][_0x2b44('0x3c')]+'%'};return _0xcc0739;})});}_0x5ea40e=_[_0x2b44('0x3d')]({},_0x5ea40e,_0x526dfe[_0x2b44('0x3f')]);return db['UserSmsQueue'][_0x2b44('0x42')](_0x5ea40e);}})[_0x2b44('0x23')](function(_0x2a9603){if(_0x2a9603){return db[_0x2b44('0x57')][_0x2b44('0x58')]({'where':{'id':_['map'](_0x2a9603,'UserId'),'role':_0x2b44('0x59')},'attributes':['id','name','smsPause','updatedAt',_0x2b44('0x5a')]});}})[_0x2b44('0x23')](function(_0x12f005){if(_0x12f005){return{'count':_0x12f005[_0x2b44('0x1f')],'rows':_[_0x2b44('0x2c')](_0x12f005[_0x2b44('0x5b')],function(_0x19ee9f){return{'membername':_0x19ee9f[_0x2b44('0x29')],'UserId':_0x19ee9f['id'],'queue_name':_0x171500[_0x2b44('0x29')],'SmsQueueId':_0x171500['id'],'interface':util[_0x2b44('0x5c')](_0x2b44('0x5d'),_0x2b44('0x5e'),_0x19ee9f[_0x2b44('0x29')]),'penalty':0x0,'paused':_0x19ee9f[_0x2b44('0x5f')],'createdAt':_0x19ee9f['createdAt'],'updatedAt':_0x19ee9f[_0x2b44('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2b44('0x23')](respondWithFilteredResult(_0x8ae48,_0x5ea40e))['catch'](handleError(_0x8ae48,null));};exports[_0x2b44('0x61')]=function(_0x215818,_0xe11163,_0x2b259e){var _0x2c5464={};var _0x36f1c0={};var _0x3783fa;var _0x42cbfa;return db[_0x2b44('0x40')][_0x2b44('0x53')]({'where':{'id':_0x215818[_0x2b44('0x45')]['id']}})[_0x2b44('0x23')](handleEntityNotFound(_0xe11163,null))['then'](function(_0x1349a8){if(_0x1349a8){_0x3783fa=_0x1349a8;_0x36f1c0[_0x2b44('0x33')]=_[_0x2b44('0x2f')](db[_0x2b44('0x62')]['rawAttributes']);_0x36f1c0[_0x2b44('0x30')]=_[_0x2b44('0x2f')](_0x215818[_0x2b44('0x30')]);_0x36f1c0['filters']=_[_0x2b44('0x32')](_0x36f1c0[_0x2b44('0x33')],_0x36f1c0[_0x2b44('0x30')]);_0x2c5464[_0x2b44('0x34')]=_[_0x2b44('0x32')](_0x36f1c0[_0x2b44('0x33')],qs[_0x2b44('0x35')](_0x215818[_0x2b44('0x30')][_0x2b44('0x35')]));_0x2c5464['attributes']=_0x2c5464[_0x2b44('0x34')][_0x2b44('0x36')]?_0x2c5464[_0x2b44('0x34')]:_0x36f1c0['model'];_0x2c5464[_0x2b44('0x39')]=qs[_0x2b44('0x3a')](_0x215818[_0x2b44('0x30')]['sort']);_0x2c5464[_0x2b44('0x3b')]=qs[_0x2b44('0x31')](_['pick'](_0x215818[_0x2b44('0x30')],_0x36f1c0[_0x2b44('0x31')]));if(_0x215818['query'][_0x2b44('0x3c')]){_0x2c5464[_0x2b44('0x3b')]=_[_0x2b44('0x3d')](_0x2c5464[_0x2b44('0x3b')],{'$or':_[_0x2b44('0x2c')](_0x2c5464[_0x2b44('0x34')],function(_0x1b7f5f){var _0x4b73c4={};_0x4b73c4[_0x1b7f5f]={'$like':'%'+_0x215818[_0x2b44('0x30')][_0x2b44('0x3c')]+'%'};return _0x4b73c4;})});}_0x2c5464=_['merge']({},_0x2c5464,_0x215818[_0x2b44('0x3f')]);return _0x3783fa['getTeams'](_0x2c5464);}})[_0x2b44('0x23')](function(_0x4000bd){if(_0x4000bd){_0x42cbfa=_0x4000bd['length'];if(!_0x215818[_0x2b44('0x30')][_0x2b44('0x37')](_0x2b44('0x38'))){_0x2c5464[_0x2b44('0x1d')]=qs[_0x2b44('0x1d')](_0x215818[_0x2b44('0x30')]['limit']);_0x2c5464['offset']=qs[_0x2b44('0x1c')](_0x215818['query'][_0x2b44('0x1c')]);}return _0x3783fa[_0x2b44('0x61')](_0x2c5464);}})[_0x2b44('0x23')](function(_0x49be45){if(_0x49be45){return _0x49be45?{'count':_0x42cbfa,'rows':_0x49be45}:null;}})[_0x2b44('0x23')](respondWithResult(_0xe11163,null))['catch'](handleError(_0xe11163,null));};exports[_0x2b44('0x63')]=function(_0x296aa7,_0x3265b1,_0x3347b9){var _0x4a6ac1=_0x296aa7[_0x2b44('0x49')][_0x2b44('0x64')];return db[_0x2b44('0x62')][_0x2b44('0x42')]({'where':{'id':_0x4a6ac1},'attributes':['id'],'include':[{'model':db[_0x2b44('0x57')],'as':_0x2b44('0x65'),'attributes':['id',_0x2b44('0x29'),'online',_0x2b44('0x66'),'interface'],'raw':!![]}]})[_0x2b44('0x23')](function(_0xb6ecf7){if(_0xb6ecf7){var _0x436666=_[_0x2b44('0x67')](_0xb6ecf7,function(_0x425a50){var _0x3d3f0e=_0x425a50[_0x2b44('0x24')]({'plain':!![]});return _0x3d3f0e[_0x2b44('0x65')];});return db[_0x2b44('0x40')][_0x2b44('0x47')]({'where':{'id':_0x296aa7[_0x2b44('0x45')]['id']}})[_0x2b44('0x23')](function(_0xf44a91){return db[_0x2b44('0x68')]['transaction'](function(_0x1f5ae4){return _0xf44a91[_0x2b44('0x63')](_0x4a6ac1,{'transaction':_0x1f5ae4})[_0x2b44('0x23')](function(){return BPromise['each'](_0x436666,function(_0x1a4798){return db[_0x2b44('0x54')][_0x2b44('0x69')]({'where':{'UserId':_0x1a4798['id'],'SmsQueueId':_0x296aa7[_0x2b44('0x45')]['id']},'transaction':_0x1f5ae4});});})[_0x2b44('0x23')](function(){_0x436666['forEach'](function(_0x4b651c){socket[_0x2b44('0x6a')](_0x2b44('0x6b'),{'UserId':_0x4b651c['id'],'SmsQueueId':_0xf44a91['id']});});});});});}})['then'](respondWithStatusCode(_0x3265b1,null))[_0x2b44('0x43')](handleError(_0x3265b1,null));};exports[_0x2b44('0x6c')]=function(_0x5c8f76,_0x496231,_0xec756){return db[_0x2b44('0x62')]['findAll']({'where':{'id':_0x5c8f76[_0x2b44('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2b44('0x57')],'as':_0x2b44('0x65'),'attributes':['id'],'raw':!![]}]})[_0x2b44('0x23')](handleEntityNotFound(_0x496231,null))['then'](function(_0x5cddf4){var _0x1e1729=_[_0x2b44('0x2c')](_0x5cddf4,'id');var _0xd39e03=[];var _0x4c5ddf=[];var _0x310fa3=squel[_0x2b44('0x6d')]();_0x310fa3[_0x2b44('0x6e')](_0x2b44('0x6f'))[_0x2b44('0x70')](_0x2b44('0x71'),'tq')[_0x2b44('0x72')](_0x2b44('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2b44('0x3b')]('SmsQueueId\x20=\x20?',_0x5c8f76[_0x2b44('0x45')]['id']);for(var _0x4f4ddb=0x0;_0x4f4ddb<_0x5cddf4[_0x2b44('0x36')];_0x4f4ddb+=0x1){let _0x11a890=_0x5cddf4[_0x4f4ddb];for(var _0x464171=0x0;_0x464171<_0x11a890[_0x2b44('0x65')]['length'];_0x464171+=0x1){let _0x206122=_0x11a890[_0x2b44('0x65')][_0x464171];var _0x123dc5=_0x310fa3['clone']();_0x123dc5[_0x2b44('0x3b')](_0x2b44('0x74'),_0x206122['id']);_0x4c5ddf[_0x2b44('0x75')](db[_0x2b44('0x68')][_0x2b44('0x30')](_0x123dc5['toString'](),{'type':db[_0x2b44('0x68')][_0x2b44('0x76')][_0x2b44('0x77')]})['then'](function(_0x245150){if(_0x245150[_0x2b44('0x36')]===0x1){return _0x206122['id'];}else{var _0x1a0862=_[_0x2b44('0x78')](_['map'](_0x245150,'TeamId'),function(_0x415e39){return _['includes'](_0x1e1729,_0x415e39);});if(_0x1a0862){return _0x206122['id'];}}}));}}return BPromise['all'](_0x4c5ddf)[_0x2b44('0x23')](function(_0x4f536f){_0xd39e03=_(_0xd39e03)[_0x2b44('0x79')](_0x4f536f)[_0x2b44('0x7a')]()['value']();return db[_0x2b44('0x40')][_0x2b44('0x47')]({'where':{'id':_0x5c8f76[_0x2b44('0x45')]['id']}})[_0x2b44('0x23')](function(_0x105d4f){return db[_0x2b44('0x68')][_0x2b44('0x7b')](function(_0x188d4e){return _0x105d4f[_0x2b44('0x6c')](_0x5c8f76[_0x2b44('0x30')][_0x2b44('0x64')],{'transaction':_0x188d4e})[_0x2b44('0x23')](function(){if(!_[_0x2b44('0x7c')](_0xd39e03)){return _0x105d4f[_0x2b44('0x7d')](_0xd39e03,{'transaction':_0x188d4e});}})[_0x2b44('0x23')](function(){_0xd39e03[_0x2b44('0x7e')](function(_0x16cabc){socket[_0x2b44('0x6a')](_0x2b44('0x7f'),{'UserId':_0x16cabc,'SmsQueueId':_0x105d4f['id']});});});});});});})[_0x2b44('0x23')](respondWithStatusCode(_0x496231,null))[_0x2b44('0x43')](handleError(_0x496231,null));};exports[_0x2b44('0x80')]=function(_0x471063,_0x2ee32d,_0x32affd){return db[_0x2b44('0x40')][_0x2b44('0x47')]({'where':{'id':_0x471063[_0x2b44('0x45')]['id']}})[_0x2b44('0x23')](handleEntityNotFound(_0x2ee32d,null))[_0x2b44('0x23')](function(_0x540a8a){if(_0x540a8a){return _0x540a8a[_0x2b44('0x80')](_0x471063[_0x2b44('0x49')][_0x2b44('0x64')],_[_0x2b44('0x81')](_0x471063[_0x2b44('0x49')],[_0x2b44('0x64'),'id'])||{})[_0x2b44('0x82')](function(_0xfbed98){for(var _0x217b9b=0x0;_0x217b9b<_0x471063[_0x2b44('0x49')][_0x2b44('0x64')]['length'];_0x217b9b+=0x1){socket[_0x2b44('0x6a')]('userSmsQueue:save',{'UserId':Number(_0x471063[_0x2b44('0x49')][_0x2b44('0x64')][_0x217b9b]),'SmsQueueId':Number(_0x471063[_0x2b44('0x45')]['id'])});}return _0xfbed98;});}})['then'](respondWithResult(_0x2ee32d,null))[_0x2b44('0x43')](handleError(_0x2ee32d,null));};exports[_0x2b44('0x7d')]=function(_0x1d9a65,_0x354525,_0x5c8cb5){return db[_0x2b44('0x40')][_0x2b44('0x47')]({'where':{'id':_0x1d9a65[_0x2b44('0x45')]['id']}})[_0x2b44('0x23')](handleEntityNotFound(_0x354525,null))[_0x2b44('0x23')](function(_0x51e345){if(_0x51e345){return _0x51e345[_0x2b44('0x7d')](_0x1d9a65[_0x2b44('0x30')]['ids'])['then'](function(){if(_[_0x2b44('0x83')](_0x1d9a65[_0x2b44('0x30')][_0x2b44('0x64')])){for(var _0x167926=0x0;_0x167926<_0x1d9a65[_0x2b44('0x30')]['ids']['length'];_0x167926+=0x1){socket[_0x2b44('0x6a')](_0x2b44('0x7f'),{'UserId':Number(_0x1d9a65['query'][_0x2b44('0x64')][_0x167926]),'SmsQueueId':Number(_0x1d9a65['params']['id'])});}}else{socket[_0x2b44('0x6a')]('userSmsQueue:remove',{'UserId':Number(_0x1d9a65[_0x2b44('0x30')]['ids']),'SmsQueueId':Number(_0x1d9a65['params']['id'])});}});}})[_0x2b44('0x23')](respondWithStatusCode(_0x354525,null))['catch'](handleError(_0x354525,null));};exports['getAgents']=function(_0x27bf80,_0x2d233d,_0x1b2340){var _0x44024b={};var _0x3b5a90={};var _0x54eed0;var _0x770e58;return db[_0x2b44('0x40')][_0x2b44('0x53')]({'where':{'id':_0x27bf80['params']['id']}})[_0x2b44('0x23')](handleEntityNotFound(_0x2d233d,null))[_0x2b44('0x23')](function(_0x51818a){if(_0x51818a){_0x54eed0=_0x51818a;_0x3b5a90['model']=_[_0x2b44('0x2f')](db[_0x2b44('0x57')][_0x2b44('0x46')]);_0x3b5a90[_0x2b44('0x30')]=_['keys'](_0x27bf80[_0x2b44('0x30')]);_0x3b5a90[_0x2b44('0x31')]=_[_0x2b44('0x32')](_0x3b5a90[_0x2b44('0x33')],_0x3b5a90[_0x2b44('0x30')]);_0x44024b[_0x2b44('0x34')]=_[_0x2b44('0x32')](_0x3b5a90[_0x2b44('0x33')],qs[_0x2b44('0x35')](_0x27bf80['query'][_0x2b44('0x35')]));_0x44024b[_0x2b44('0x34')]=_0x44024b[_0x2b44('0x34')][_0x2b44('0x36')]?_0x44024b[_0x2b44('0x34')]:_0x3b5a90[_0x2b44('0x33')];_0x44024b[_0x2b44('0x39')]=qs[_0x2b44('0x3a')](_0x27bf80[_0x2b44('0x30')][_0x2b44('0x3a')]);_0x44024b['where']=qs[_0x2b44('0x31')](_[_0x2b44('0x55')](_0x27bf80[_0x2b44('0x30')],_0x3b5a90[_0x2b44('0x31')]));if(_0x27bf80[_0x2b44('0x30')][_0x2b44('0x3c')]){_0x44024b[_0x2b44('0x3b')]=_[_0x2b44('0x3d')](_0x44024b[_0x2b44('0x3b')],{'$or':_[_0x2b44('0x2c')](_0x44024b['attributes'],function(_0x28a8d4){var _0x3ec114={};_0x3ec114[_0x28a8d4]={'$like':'%'+_0x27bf80[_0x2b44('0x30')][_0x2b44('0x3c')]+'%'};return _0x3ec114;})});}_0x44024b=_['merge']({},_0x44024b,_0x27bf80[_0x2b44('0x3f')]);return _0x54eed0['getAgents'](_0x44024b);}})[_0x2b44('0x23')](function(_0x2ebbbe){if(_0x2ebbbe){_0x770e58=_0x2ebbbe[_0x2b44('0x36')];if(!_0x27bf80[_0x2b44('0x30')][_0x2b44('0x37')](_0x2b44('0x38'))){_0x44024b['limit']=qs[_0x2b44('0x1d')](_0x27bf80['query']['limit']);_0x44024b[_0x2b44('0x1c')]=qs[_0x2b44('0x1c')](_0x27bf80[_0x2b44('0x30')][_0x2b44('0x1c')]);}return _0x54eed0[_0x2b44('0x84')](_0x44024b);}})[_0x2b44('0x23')](function(_0x5efc84){if(_0x5efc84){return _0x5efc84?{'count':_0x770e58,'rows':_0x5efc84}:null;}})[_0x2b44('0x23')](respondWithResult(_0x2d233d,null))[_0x2b44('0x43')](handleError(_0x2d233d,null));}; \ No newline at end of file +var _0x8afd=['destroy','end','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','addTeams','Team','online','voicePause','interface','Agents','sequelize','transaction','each','UserSmsQueue','findOrCreate','forEach','emit','userSmsQueue:save','ids','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','union','compact','value','removeTeams','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','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','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','SmsQueues','UserProfileResource'];(function(_0x3f9d7c,_0x472d9a){var _0x1211a0=function(_0x320473){while(--_0x320473){_0x3f9d7c['push'](_0x3f9d7c['shift']());}};_0x1211a0(++_0x472d9a);}(_0x8afd,0xf1));var _0xd8af=function(_0x45dc68,_0x4e662c){_0x45dc68=_0x45dc68-0x0;var _0x1c44e9=_0x8afd[_0x45dc68];return _0x1c44e9;};'use strict';var emlformat=require(_0xd8af('0x0'));var rimraf=require(_0xd8af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8af('0x2'));var rp=require(_0xd8af('0x3'));var moment=require(_0xd8af('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd8af('0x5'));var util=require('util');var path=require(_0xd8af('0x6'));var sox=require(_0xd8af('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8af('0x8'));var _=require(_0xd8af('0x9'));var squel=require(_0xd8af('0xa'));var crypto=require(_0xd8af('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd8af('0xc'));var toCsv=require(_0xd8af('0xd'));var querystring=require('querystring');var Papa=require(_0xd8af('0xe'));var Redis=require('ioredis');var authService=require(_0xd8af('0xf'));var qs=require(_0xd8af('0x10'));var as=require(_0xd8af('0x11'));var hardwareService=require(_0xd8af('0x12'));var logger=require(_0xd8af('0x13'))(_0xd8af('0x14'));var utils=require(_0xd8af('0x15'));var config=require(_0xd8af('0x16'));var licenseUtil=require(_0xd8af('0x17'));var db=require(_0xd8af('0x18'))['db'];config[_0xd8af('0x19')]=_[_0xd8af('0x1a')](config[_0xd8af('0x19')],{'host':_0xd8af('0x1b'),'port':0x18eb});var socket=require(_0xd8af('0x1c'))(new Redis(config[_0xd8af('0x19')]));require(_0xd8af('0x1d'))[_0xd8af('0x1e')](socket);function respondWithStatusCode(_0x2a0e80,_0x4d8771){_0x4d8771=_0x4d8771||0xcc;return function(_0x421e9e){if(_0x421e9e){return _0x2a0e80['sendStatus'](_0x4d8771);}return _0x2a0e80[_0xd8af('0x1f')](_0x4d8771)['end']();};}function respondWithResult(_0x578ccf,_0x1d71cf){_0x1d71cf=_0x1d71cf||0xc8;return function(_0x1a2c18){if(_0x1a2c18){return _0x578ccf['status'](_0x1d71cf)[_0xd8af('0x20')](_0x1a2c18);}};}function respondWithFilteredResult(_0x150b48,_0x4dd4d2){return function(_0x348ad5){if(_0x348ad5){var _0x167747=typeof _0x4dd4d2[_0xd8af('0x21')]===_0xd8af('0x22')&&typeof _0x4dd4d2[_0xd8af('0x23')]===_0xd8af('0x22');var _0x5490d4=_0x348ad5[_0xd8af('0x24')];var _0xf4bc82=_0x167747?0x0:_0x4dd4d2['offset'];var _0x79dd00=_0x167747?_0x348ad5[_0xd8af('0x24')]:_0x4dd4d2[_0xd8af('0x21')]+_0x4dd4d2[_0xd8af('0x23')];var _0x2f5741;if(_0x79dd00>=_0x5490d4){_0x79dd00=_0x5490d4;_0x2f5741=0xc8;}else{_0x2f5741=0xce;}_0x150b48[_0xd8af('0x1f')](_0x2f5741);return _0x150b48['set'](_0xd8af('0x25'),_0xf4bc82+'-'+_0x79dd00+'/'+_0x5490d4)['json'](_0x348ad5);}return null;};}function patchUpdates(_0x49a2db){return function(_0x45b25d){try{jsonpatch[_0xd8af('0x26')](_0x45b25d,_0x49a2db,!![]);}catch(_0x2ee617){return BPromise[_0xd8af('0x27')](_0x2ee617);}return _0x45b25d[_0xd8af('0x28')]();};}function saveUpdates(_0x401765,_0x44218d){return function(_0x49c614){if(_0x49c614){return _0x49c614['update'](_0x401765)[_0xd8af('0x29')](function(_0x3aa997){return _0x3aa997;});}return null;};}function removeEntity(_0x4aaa73,_0x4dd1ad){return function(_0x19b40a){if(_0x19b40a){return _0x19b40a['destroy']()['then'](function(){var _0x21afda=_0x19b40a[_0xd8af('0x2a')]({'plain':!![]});var _0x59e6e7=_0xd8af('0x2b');return db[_0xd8af('0x2c')][_0xd8af('0x2d')]({'where':{'type':_0x59e6e7,'resourceId':_0x21afda['id']}})[_0xd8af('0x29')](function(){return _0x19b40a;});})['then'](function(){_0x4aaa73['status'](0xcc)[_0xd8af('0x2e')]();});}};}function handleEntityNotFound(_0x1c4ae8,_0x31908c){return function(_0x1619fe){if(!_0x1619fe){_0x1c4ae8['sendStatus'](0x194);}return _0x1619fe;};}function handleError(_0x2ec476,_0x527afe){_0x527afe=_0x527afe||0x1f4;return function(_0x1ee636){logger[_0xd8af('0x2f')](_0x1ee636['stack']);if(_0x1ee636[_0xd8af('0x30')]){delete _0x1ee636[_0xd8af('0x30')];}_0x2ec476[_0xd8af('0x1f')](_0x527afe)[_0xd8af('0x31')](_0x1ee636);};}exports[_0xd8af('0x32')]=function(_0x1a535e,_0x21226a){var _0x41ccae={},_0x4beec8={},_0x5e7fcf={'count':0x0,'rows':[]};var _0xa8172d=_[_0xd8af('0x33')](db[_0xd8af('0x34')][_0xd8af('0x35')],function(_0x5f5a02){return{'name':_0x5f5a02[_0xd8af('0x36')],'type':_0x5f5a02[_0xd8af('0x37')][_0xd8af('0x38')]};});_0x4beec8['model']=_[_0xd8af('0x33')](_0xa8172d,_0xd8af('0x30'));_0x4beec8[_0xd8af('0x39')]=_[_0xd8af('0x3a')](_0x1a535e['query']);_0x4beec8[_0xd8af('0x3b')]=_[_0xd8af('0x3c')](_0x4beec8[_0xd8af('0x3d')],_0x4beec8[_0xd8af('0x39')]);_0x41ccae[_0xd8af('0x3e')]=_[_0xd8af('0x3c')](_0x4beec8[_0xd8af('0x3d')],qs[_0xd8af('0x3f')](_0x1a535e[_0xd8af('0x39')]['fields']));_0x41ccae[_0xd8af('0x3e')]=_0x41ccae[_0xd8af('0x3e')]['length']?_0x41ccae[_0xd8af('0x3e')]:_0x4beec8[_0xd8af('0x3d')];if(!_0x1a535e[_0xd8af('0x39')][_0xd8af('0x40')](_0xd8af('0x41'))){_0x41ccae[_0xd8af('0x23')]=qs[_0xd8af('0x23')](_0x1a535e[_0xd8af('0x39')][_0xd8af('0x23')]);_0x41ccae[_0xd8af('0x21')]=qs[_0xd8af('0x21')](_0x1a535e[_0xd8af('0x39')][_0xd8af('0x21')]);}_0x41ccae[_0xd8af('0x42')]=qs[_0xd8af('0x43')](_0x1a535e[_0xd8af('0x39')][_0xd8af('0x43')]);_0x41ccae[_0xd8af('0x44')]=qs[_0xd8af('0x3b')](_[_0xd8af('0x45')](_0x1a535e['query'],_0x4beec8[_0xd8af('0x3b')]),_0xa8172d);if(_0x1a535e['query'][_0xd8af('0x46')]){_0x41ccae['where']=_['merge'](_0x41ccae[_0xd8af('0x44')],{'$or':_[_0xd8af('0x33')](_0xa8172d,function(_0x54d9c0){if(_0x54d9c0[_0xd8af('0x37')]!=='VIRTUAL'){var _0x2ef285={};_0x2ef285[_0x54d9c0[_0xd8af('0x30')]]={'$like':'%'+_0x1a535e[_0xd8af('0x39')][_0xd8af('0x46')]+'%'};return _0x2ef285;}})});}_0x41ccae=_[_0xd8af('0x47')]({},_0x41ccae,_0x1a535e[_0xd8af('0x48')]);var _0x292237={'where':_0x41ccae[_0xd8af('0x44')]};return db[_0xd8af('0x34')][_0xd8af('0x24')](_0x292237)[_0xd8af('0x29')](function(_0x3747e4){_0x5e7fcf[_0xd8af('0x24')]=_0x3747e4;if(_0x1a535e[_0xd8af('0x39')][_0xd8af('0x49')]){_0x41ccae[_0xd8af('0x4a')]=[{'all':!![]}];}return db[_0xd8af('0x34')][_0xd8af('0x4b')](_0x41ccae);})[_0xd8af('0x29')](function(_0x1e65a4){_0x5e7fcf[_0xd8af('0x4c')]=_0x1e65a4;return _0x5e7fcf;})[_0xd8af('0x29')](respondWithFilteredResult(_0x21226a,_0x41ccae))[_0xd8af('0x4d')](handleError(_0x21226a,null));};exports[_0xd8af('0x4e')]=function(_0x10bc1e,_0xf0e343){var _0x4e00cc={'raw':!![],'where':{'id':_0x10bc1e[_0xd8af('0x4f')]['id']}},_0x5c2911={};_0x5c2911[_0xd8af('0x3d')]=_[_0xd8af('0x3a')](db[_0xd8af('0x34')][_0xd8af('0x35')]);_0x5c2911['query']=_[_0xd8af('0x3a')](_0x10bc1e[_0xd8af('0x39')]);_0x5c2911[_0xd8af('0x3b')]=_[_0xd8af('0x3c')](_0x5c2911[_0xd8af('0x3d')],_0x5c2911[_0xd8af('0x39')]);_0x4e00cc[_0xd8af('0x3e')]=_[_0xd8af('0x3c')](_0x5c2911[_0xd8af('0x3d')],qs['fields'](_0x10bc1e[_0xd8af('0x39')][_0xd8af('0x3f')]));_0x4e00cc[_0xd8af('0x3e')]=_0x4e00cc[_0xd8af('0x3e')][_0xd8af('0x50')]?_0x4e00cc[_0xd8af('0x3e')]:_0x5c2911[_0xd8af('0x3d')];if(_0x10bc1e[_0xd8af('0x39')]['includeAll']){_0x4e00cc['include']=[{'all':!![]}];}_0x4e00cc=_['merge']({},_0x4e00cc,_0x10bc1e[_0xd8af('0x48')]);return db['SmsQueue'][_0xd8af('0x51')](_0x4e00cc)[_0xd8af('0x29')](handleEntityNotFound(_0xf0e343,null))[_0xd8af('0x29')](respondWithResult(_0xf0e343,null))['catch'](handleError(_0xf0e343,null));};exports[_0xd8af('0x52')]=function(_0x42f846,_0x1920f9){return db[_0xd8af('0x34')][_0xd8af('0x52')](_0x42f846['body'],{})[_0xd8af('0x29')](function(_0x5ef6b){var _0x49d778=_0x42f846[_0xd8af('0x53')][_0xd8af('0x2a')]({'plain':!![]});if(!_0x49d778)throw new Error(_0xd8af('0x54'));if(_0x49d778[_0xd8af('0x55')]===_0xd8af('0x53')){var _0x11ddad=_0x5ef6b[_0xd8af('0x2a')]({'plain':!![]});var _0x1bc8f9=_0xd8af('0x2b');return db['UserProfileSection'][_0xd8af('0x51')]({'where':{'name':_0x1bc8f9,'userProfileId':_0x49d778[_0xd8af('0x56')]},'raw':!![]})[_0xd8af('0x29')](function(_0x43b7df){if(_0x43b7df&&_0x43b7df['autoAssociation']===0x0){return db['UserProfileResource'][_0xd8af('0x52')]({'name':_0x11ddad['name'],'resourceId':_0x11ddad['id'],'type':_0x43b7df[_0xd8af('0x30')],'sectionId':_0x43b7df['id']},{})[_0xd8af('0x29')](function(){return _0x5ef6b;});}else{return _0x5ef6b;}})[_0xd8af('0x4d')](function(_0x51dc95){logger[_0xd8af('0x2f')](_0xd8af('0x57'),_0x51dc95);throw _0x51dc95;});}return _0x5ef6b;})[_0xd8af('0x29')](respondWithResult(_0x1920f9,0xc9))[_0xd8af('0x4d')](handleError(_0x1920f9,null));};exports['update']=function(_0x746805,_0x4a6640){if(_0x746805[_0xd8af('0x58')]['id']){delete _0x746805[_0xd8af('0x58')]['id'];}return db[_0xd8af('0x34')][_0xd8af('0x51')]({'where':{'id':_0x746805[_0xd8af('0x4f')]['id']}})[_0xd8af('0x29')](handleEntityNotFound(_0x4a6640,null))[_0xd8af('0x29')](saveUpdates(_0x746805[_0xd8af('0x58')],null))[_0xd8af('0x29')](respondWithResult(_0x4a6640,null))[_0xd8af('0x4d')](handleError(_0x4a6640,null));};exports[_0xd8af('0x2d')]=function(_0x4a59f7,_0xafad95){return db[_0xd8af('0x34')][_0xd8af('0x51')]({'where':{'id':_0x4a59f7['params']['id']}})[_0xd8af('0x29')](handleEntityNotFound(_0xafad95,null))['then'](removeEntity(_0xafad95,null))[_0xd8af('0x4d')](handleError(_0xafad95,null));};exports[_0xd8af('0x59')]=function(_0x16840e,_0x110a72){return db[_0xd8af('0x34')][_0xd8af('0x59')]()[_0xd8af('0x29')](respondWithResult(_0x110a72,null))['catch'](handleError(_0x110a72,null));};exports[_0xd8af('0x5a')]=function(_0x4763a2,_0x354540,_0x4af49c){var _0x36b0b7={'raw':!![],'where':{}},_0x4bb1ed={},_0x339d46;return db[_0xd8af('0x34')][_0xd8af('0x5b')]({'where':{'id':_0x4763a2['params']['id']}})[_0xd8af('0x29')](handleEntityNotFound(_0x354540,null))['then'](function(_0x4b94e5){if(_0x4b94e5){_0x339d46=_0x4b94e5[_0xd8af('0x2a')]({'plain':!![]});_0x4bb1ed[_0xd8af('0x3d')]=_[_0xd8af('0x3a')](db['UserSmsQueue']['rawAttributes']);_0x4bb1ed[_0xd8af('0x39')]=_[_0xd8af('0x3a')](_0x4763a2[_0xd8af('0x39')]);_0x4bb1ed[_0xd8af('0x3b')]=_[_0xd8af('0x3c')](_0x4bb1ed['model'],_0x4bb1ed[_0xd8af('0x39')]);_0x36b0b7[_0xd8af('0x3e')]=_[_0xd8af('0x3c')](_0x4bb1ed[_0xd8af('0x3d')],qs[_0xd8af('0x3f')](_0x4763a2[_0xd8af('0x39')][_0xd8af('0x3f')]));_0x36b0b7[_0xd8af('0x3e')]=_0x36b0b7['attributes'][_0xd8af('0x50')]?_0x36b0b7['attributes']:_0x4bb1ed[_0xd8af('0x3d')];if(!_0x4763a2['query'][_0xd8af('0x40')]('nolimit')){_0x36b0b7['limit']=qs[_0xd8af('0x23')](_0x4763a2[_0xd8af('0x39')][_0xd8af('0x23')]);_0x36b0b7[_0xd8af('0x21')]=qs[_0xd8af('0x21')](_0x4763a2[_0xd8af('0x39')][_0xd8af('0x21')]);}_0x36b0b7['order']=qs[_0xd8af('0x43')](_0x4763a2[_0xd8af('0x39')][_0xd8af('0x43')]);_0x36b0b7[_0xd8af('0x44')]=qs['filters'](_[_0xd8af('0x45')](_0x4763a2[_0xd8af('0x39')],_0x4bb1ed[_0xd8af('0x3b')]));_0x36b0b7[_0xd8af('0x44')][_0xd8af('0x5c')]=_0x4b94e5['id'];if(_0x4763a2[_0xd8af('0x39')][_0xd8af('0x46')]){_0x36b0b7[_0xd8af('0x44')]=_['merge'](_0x36b0b7[_0xd8af('0x44')],{'$or':_[_0xd8af('0x33')](_0x36b0b7[_0xd8af('0x3e')],function(_0x1403bb){var _0x5b22e1={};_0x5b22e1[_0x1403bb]={'$like':'%'+_0x4763a2[_0xd8af('0x39')][_0xd8af('0x46')]+'%'};return _0x5b22e1;})});}_0x36b0b7=_[_0xd8af('0x47')]({},_0x36b0b7,_0x4763a2[_0xd8af('0x48')]);return db['UserSmsQueue'][_0xd8af('0x4b')](_0x36b0b7);}})[_0xd8af('0x29')](function(_0x51672e){if(_0x51672e){return db[_0xd8af('0x5d')][_0xd8af('0x5e')]({'where':{'id':_[_0xd8af('0x33')](_0x51672e,_0xd8af('0x5f')),'role':_0xd8af('0x60')},'attributes':['id',_0xd8af('0x30'),_0xd8af('0x61'),'updatedAt',_0xd8af('0x62')]});}})['then'](function(_0x24f256){if(_0x24f256){return{'count':_0x24f256['count'],'rows':_[_0xd8af('0x33')](_0x24f256[_0xd8af('0x4c')],function(_0x1889df){return{'membername':_0x1889df[_0xd8af('0x30')],'UserId':_0x1889df['id'],'queue_name':_0x339d46[_0xd8af('0x30')],'SmsQueueId':_0x339d46['id'],'interface':util[_0xd8af('0x63')](_0xd8af('0x64'),_0xd8af('0x65'),_0x1889df[_0xd8af('0x30')]),'penalty':0x0,'paused':_0x1889df[_0xd8af('0x61')],'createdAt':_0x1889df['createdAt'],'updatedAt':_0x1889df[_0xd8af('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd8af('0x29')](respondWithFilteredResult(_0x354540,_0x36b0b7))[_0xd8af('0x4d')](handleError(_0x354540,null));};exports[_0xd8af('0x67')]=function(_0x98b123,_0x4da088,_0x4959f6){var _0x2a206b={};var _0x86555e={};var _0x5864fc;var _0x28cfee;return db['SmsQueue'][_0xd8af('0x5b')]({'where':{'id':_0x98b123[_0xd8af('0x4f')]['id']}})[_0xd8af('0x29')](handleEntityNotFound(_0x4da088,null))[_0xd8af('0x29')](function(_0x4c097d){if(_0x4c097d){_0x5864fc=_0x4c097d;_0x86555e['model']=_[_0xd8af('0x3a')](db['Team'][_0xd8af('0x35')]);_0x86555e[_0xd8af('0x39')]=_[_0xd8af('0x3a')](_0x98b123['query']);_0x86555e[_0xd8af('0x3b')]=_[_0xd8af('0x3c')](_0x86555e[_0xd8af('0x3d')],_0x86555e['query']);_0x2a206b['attributes']=_['intersection'](_0x86555e[_0xd8af('0x3d')],qs[_0xd8af('0x3f')](_0x98b123[_0xd8af('0x39')]['fields']));_0x2a206b['attributes']=_0x2a206b[_0xd8af('0x3e')][_0xd8af('0x50')]?_0x2a206b[_0xd8af('0x3e')]:_0x86555e['model'];_0x2a206b[_0xd8af('0x42')]=qs['sort'](_0x98b123[_0xd8af('0x39')]['sort']);_0x2a206b[_0xd8af('0x44')]=qs[_0xd8af('0x3b')](_[_0xd8af('0x45')](_0x98b123[_0xd8af('0x39')],_0x86555e['filters']));if(_0x98b123['query'][_0xd8af('0x46')]){_0x2a206b['where']=_[_0xd8af('0x47')](_0x2a206b[_0xd8af('0x44')],{'$or':_[_0xd8af('0x33')](_0x2a206b[_0xd8af('0x3e')],function(_0x3606cb){var _0x27934e={};_0x27934e[_0x3606cb]={'$like':'%'+_0x98b123[_0xd8af('0x39')]['filter']+'%'};return _0x27934e;})});}_0x2a206b=_[_0xd8af('0x47')]({},_0x2a206b,_0x98b123[_0xd8af('0x48')]);return _0x5864fc[_0xd8af('0x67')](_0x2a206b);}})[_0xd8af('0x29')](function(_0x5c02b4){if(_0x5c02b4){_0x28cfee=_0x5c02b4['length'];if(!_0x98b123[_0xd8af('0x39')][_0xd8af('0x40')]('nolimit')){_0x2a206b[_0xd8af('0x23')]=qs['limit'](_0x98b123[_0xd8af('0x39')][_0xd8af('0x23')]);_0x2a206b[_0xd8af('0x21')]=qs[_0xd8af('0x21')](_0x98b123[_0xd8af('0x39')]['offset']);}return _0x5864fc[_0xd8af('0x67')](_0x2a206b);}})[_0xd8af('0x29')](function(_0x244313){if(_0x244313){return _0x244313?{'count':_0x28cfee,'rows':_0x244313}:null;}})[_0xd8af('0x29')](respondWithResult(_0x4da088,null))[_0xd8af('0x4d')](handleError(_0x4da088,null));};exports[_0xd8af('0x68')]=function(_0x579129,_0xcb84e1,_0x8163f2){var _0x5a7370=_0x579129['body']['ids'];return db[_0xd8af('0x69')][_0xd8af('0x4b')]({'where':{'id':_0x5a7370},'attributes':['id'],'include':[{'model':db[_0xd8af('0x5d')],'as':'Agents','attributes':['id','name',_0xd8af('0x6a'),_0xd8af('0x6b'),_0xd8af('0x6c')],'raw':!![]}]})[_0xd8af('0x29')](function(_0x2c5359){if(_0x2c5359){var _0xe6b0e9=_['flatMap'](_0x2c5359,function(_0x4b8e45){var _0x4f6871=_0x4b8e45[_0xd8af('0x2a')]({'plain':!![]});return _0x4f6871[_0xd8af('0x6d')];});return db[_0xd8af('0x34')][_0xd8af('0x51')]({'where':{'id':_0x579129['params']['id']}})['then'](function(_0x510004){return db[_0xd8af('0x6e')][_0xd8af('0x6f')](function(_0x2a0e13){return _0x510004[_0xd8af('0x68')](_0x5a7370,{'transaction':_0x2a0e13})[_0xd8af('0x29')](function(){return BPromise[_0xd8af('0x70')](_0xe6b0e9,function(_0x3d9f2d){return db[_0xd8af('0x71')][_0xd8af('0x72')]({'where':{'UserId':_0x3d9f2d['id'],'SmsQueueId':_0x579129['params']['id']},'transaction':_0x2a0e13});});})['then'](function(){_0xe6b0e9[_0xd8af('0x73')](function(_0x54424e){socket[_0xd8af('0x74')](_0xd8af('0x75'),{'UserId':_0x54424e['id'],'SmsQueueId':_0x510004['id']});});});});});}})[_0xd8af('0x29')](respondWithStatusCode(_0xcb84e1,null))[_0xd8af('0x4d')](handleError(_0xcb84e1,null));};exports['removeTeams']=function(_0x11d89d,_0x28029a,_0x460af2){return db[_0xd8af('0x69')][_0xd8af('0x4b')]({'where':{'id':_0x11d89d[_0xd8af('0x39')][_0xd8af('0x76')]},'attributes':['id'],'include':[{'model':db[_0xd8af('0x5d')],'as':_0xd8af('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x28029a,null))[_0xd8af('0x29')](function(_0x27e17c){var _0x191325=_[_0xd8af('0x33')](_0x27e17c,'id');var _0x458fd6=[];var _0x21ffa1=[];var _0x17538b=squel[_0xd8af('0x77')]();_0x17538b[_0xd8af('0x78')]('tq.TeamId')[_0xd8af('0x79')](_0xd8af('0x7a'),'tq')[_0xd8af('0x7b')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd8af('0x44')](_0xd8af('0x7c'),_0x11d89d[_0xd8af('0x4f')]['id']);for(var _0x230b9b=0x0;_0x230b9b<_0x27e17c[_0xd8af('0x50')];_0x230b9b+=0x1){let _0x9de920=_0x27e17c[_0x230b9b];for(var _0x51669b=0x0;_0x51669b<_0x9de920[_0xd8af('0x6d')][_0xd8af('0x50')];_0x51669b+=0x1){let _0x4f14b5=_0x9de920[_0xd8af('0x6d')][_0x51669b];var _0x50823b=_0x17538b[_0xd8af('0x7d')]();_0x50823b[_0xd8af('0x44')](_0xd8af('0x7e'),_0x4f14b5['id']);_0x21ffa1[_0xd8af('0x7f')](db[_0xd8af('0x6e')][_0xd8af('0x39')](_0x50823b['toString'](),{'type':db['sequelize'][_0xd8af('0x80')][_0xd8af('0x81')]})['then'](function(_0x38f8fe){if(_0x38f8fe['length']===0x1){return _0x4f14b5['id'];}else{var _0x1a002a=_['every'](_[_0xd8af('0x33')](_0x38f8fe,'TeamId'),function(_0x5e1263){return _[_0xd8af('0x82')](_0x191325,_0x5e1263);});if(_0x1a002a){return _0x4f14b5['id'];}}}));}}return BPromise[_0xd8af('0x83')](_0x21ffa1)[_0xd8af('0x29')](function(_0x5d8b4d){_0x458fd6=_(_0x458fd6)[_0xd8af('0x84')](_0x5d8b4d)[_0xd8af('0x85')]()[_0xd8af('0x86')]();return db[_0xd8af('0x34')][_0xd8af('0x51')]({'where':{'id':_0x11d89d[_0xd8af('0x4f')]['id']}})[_0xd8af('0x29')](function(_0x53eebc){return db[_0xd8af('0x6e')][_0xd8af('0x6f')](function(_0x5f1c49){return _0x53eebc[_0xd8af('0x87')](_0x11d89d[_0xd8af('0x39')][_0xd8af('0x76')],{'transaction':_0x5f1c49})['then'](function(){if(!_['isEmpty'](_0x458fd6)){return _0x53eebc[_0xd8af('0x88')](_0x458fd6,{'transaction':_0x5f1c49});}})[_0xd8af('0x29')](function(){_0x458fd6[_0xd8af('0x73')](function(_0x47e827){socket[_0xd8af('0x74')](_0xd8af('0x89'),{'UserId':_0x47e827,'SmsQueueId':_0x53eebc['id']});});});});});});})[_0xd8af('0x29')](respondWithStatusCode(_0x28029a,null))[_0xd8af('0x4d')](handleError(_0x28029a,null));};exports[_0xd8af('0x8a')]=function(_0x1d891b,_0x36f38f,_0x4f5915){return db['SmsQueue'][_0xd8af('0x51')]({'where':{'id':_0x1d891b[_0xd8af('0x4f')]['id']}})[_0xd8af('0x29')](handleEntityNotFound(_0x36f38f,null))['then'](function(_0x4a6915){if(_0x4a6915){return _0x4a6915['addAgents'](_0x1d891b[_0xd8af('0x58')]['ids'],_[_0xd8af('0x8b')](_0x1d891b[_0xd8af('0x58')],[_0xd8af('0x76'),'id'])||{})[_0xd8af('0x8c')](function(_0x328c48){for(var _0x394657=0x0;_0x394657<_0x1d891b['body'][_0xd8af('0x76')][_0xd8af('0x50')];_0x394657+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x1d891b['body'][_0xd8af('0x76')][_0x394657]),'SmsQueueId':Number(_0x1d891b['params']['id'])});}return _0x328c48;});}})[_0xd8af('0x29')](respondWithResult(_0x36f38f,null))['catch'](handleError(_0x36f38f,null));};exports[_0xd8af('0x88')]=function(_0x577fbc,_0x38507b,_0x1c1843){return db['SmsQueue']['find']({'where':{'id':_0x577fbc[_0xd8af('0x4f')]['id']}})[_0xd8af('0x29')](handleEntityNotFound(_0x38507b,null))['then'](function(_0x53ba99){if(_0x53ba99){return _0x53ba99[_0xd8af('0x88')](_0x577fbc[_0xd8af('0x39')][_0xd8af('0x76')])[_0xd8af('0x29')](function(){if(_[_0xd8af('0x8d')](_0x577fbc[_0xd8af('0x39')]['ids'])){for(var _0x5067db=0x0;_0x5067db<_0x577fbc[_0xd8af('0x39')][_0xd8af('0x76')][_0xd8af('0x50')];_0x5067db+=0x1){socket[_0xd8af('0x74')]('userSmsQueue:remove',{'UserId':Number(_0x577fbc['query'][_0xd8af('0x76')][_0x5067db]),'SmsQueueId':Number(_0x577fbc[_0xd8af('0x4f')]['id'])});}}else{socket[_0xd8af('0x74')](_0xd8af('0x89'),{'UserId':Number(_0x577fbc['query'][_0xd8af('0x76')]),'SmsQueueId':Number(_0x577fbc[_0xd8af('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x38507b,null))['catch'](handleError(_0x38507b,null));};exports[_0xd8af('0x8e')]=function(_0x3419fa,_0x351e7f,_0x42c4f3){var _0x1a5b77={};var _0x5ebeae={};var _0x4ffdbc;var _0x3ba523;return db['SmsQueue'][_0xd8af('0x5b')]({'where':{'id':_0x3419fa[_0xd8af('0x4f')]['id']}})['then'](handleEntityNotFound(_0x351e7f,null))[_0xd8af('0x29')](function(_0x2bd799){if(_0x2bd799){_0x4ffdbc=_0x2bd799;_0x5ebeae['model']=_['keys'](db[_0xd8af('0x5d')][_0xd8af('0x35')]);_0x5ebeae['query']=_[_0xd8af('0x3a')](_0x3419fa['query']);_0x5ebeae[_0xd8af('0x3b')]=_['intersection'](_0x5ebeae[_0xd8af('0x3d')],_0x5ebeae['query']);_0x1a5b77[_0xd8af('0x3e')]=_['intersection'](_0x5ebeae[_0xd8af('0x3d')],qs['fields'](_0x3419fa['query'][_0xd8af('0x3f')]));_0x1a5b77[_0xd8af('0x3e')]=_0x1a5b77[_0xd8af('0x3e')][_0xd8af('0x50')]?_0x1a5b77[_0xd8af('0x3e')]:_0x5ebeae[_0xd8af('0x3d')];_0x1a5b77[_0xd8af('0x42')]=qs['sort'](_0x3419fa[_0xd8af('0x39')][_0xd8af('0x43')]);_0x1a5b77[_0xd8af('0x44')]=qs[_0xd8af('0x3b')](_[_0xd8af('0x45')](_0x3419fa[_0xd8af('0x39')],_0x5ebeae[_0xd8af('0x3b')]));if(_0x3419fa[_0xd8af('0x39')][_0xd8af('0x46')]){_0x1a5b77['where']=_[_0xd8af('0x47')](_0x1a5b77[_0xd8af('0x44')],{'$or':_[_0xd8af('0x33')](_0x1a5b77[_0xd8af('0x3e')],function(_0x424e66){var _0x2306d1={};_0x2306d1[_0x424e66]={'$like':'%'+_0x3419fa[_0xd8af('0x39')][_0xd8af('0x46')]+'%'};return _0x2306d1;})});}_0x1a5b77=_['merge']({},_0x1a5b77,_0x3419fa[_0xd8af('0x48')]);return _0x4ffdbc[_0xd8af('0x8e')](_0x1a5b77);}})[_0xd8af('0x29')](function(_0x5c8550){if(_0x5c8550){_0x3ba523=_0x5c8550[_0xd8af('0x50')];if(!_0x3419fa['query'][_0xd8af('0x40')](_0xd8af('0x41'))){_0x1a5b77[_0xd8af('0x23')]=qs[_0xd8af('0x23')](_0x3419fa[_0xd8af('0x39')]['limit']);_0x1a5b77[_0xd8af('0x21')]=qs[_0xd8af('0x21')](_0x3419fa[_0xd8af('0x39')][_0xd8af('0x21')]);}return _0x4ffdbc[_0xd8af('0x8e')](_0x1a5b77);}})[_0xd8af('0x29')](function(_0x297663){if(_0x297663){return _0x297663?{'count':_0x3ba523,'rows':_0x297663}:null;}})[_0xd8af('0x29')](respondWithResult(_0x351e7f,null))[_0xd8af('0x4d')](handleError(_0x351e7f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5345277..fce2bea 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 _0x5f8a=['setMaxListeners','save','update','remove','emit','events','../../mysqldb','SmsQueue'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5f8a,0x185));var _0xa5f8=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x5f8a[_0x2a7b8e];return _0x29b5c8;};'use strict';var EventEmitter=require(_0xa5f8('0x0'));var SmsQueue=require(_0xa5f8('0x1'))['db'][_0xa5f8('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa5f8('0x3')](0x0);var events={'afterCreate':_0xa5f8('0x4'),'afterUpdate':_0xa5f8('0x5'),'afterDestroy':_0xa5f8('0x6')};function emitEvent(_0x7c63b3){return function(_0x28dd79,_0x2cddf2,_0x5cfbc4){SmsQueueEvents[_0xa5f8('0x7')](_0x7c63b3+':'+_0x28dd79['id'],_0x28dd79);SmsQueueEvents['emit'](_0x7c63b3,_0x28dd79);_0x5cfbc4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xa1f7=['emit','hook','exports','events','../../mysqldb','SmsQueue','save','remove'];(function(_0x18f78e,_0x50b798){var _0xa771e=function(_0xe924a0){while(--_0xe924a0){_0x18f78e['push'](_0x18f78e['shift']());}};_0xa771e(++_0x50b798);}(_0xa1f7,0xbb));var _0x7a1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1f7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7a1f('0x0'));var SmsQueue=require(_0x7a1f('0x1'))['db'][_0x7a1f('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a1f('0x3'),'afterUpdate':'update','afterDestroy':_0x7a1f('0x4')};function emitEvent(_0x1159db){return function(_0x252c00,_0x21b9ab,_0x1a05eb){SmsQueueEvents[_0x7a1f('0x5')](_0x1159db+':'+_0x252c00['id'],_0x252c00);SmsQueueEvents[_0x7a1f('0x5')](_0x1159db,_0x252c00);_0x1a05eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x7a1f('0x6')](e,emitEvent(event));}}module[_0x7a1f('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index dd9b16a..9152d21 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 _0x9d4a=['rimraf','../../config/environment','exports','util','api','moment','request-promise','path'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x9d4a,0x8b));var _0xa9d4=function(_0x17e0df,_0x532a4f){_0x17e0df=_0x17e0df-0x0;var _0x335714=_0x9d4a[_0x17e0df];return _0x335714;};'use strict';var _=require('lodash');var util=require(_0xa9d4('0x0'));var logger=require('../../config/logger')(_0xa9d4('0x1'));var moment=require(_0xa9d4('0x2'));var BPromise=require('bluebird');var rp=require(_0xa9d4('0x3'));var fs=require('fs');var path=require(_0xa9d4('0x4'));var rimraf=require(_0xa9d4('0x5'));var config=require(_0xa9d4('0x6'));var attributes=require('./smsQueue.attributes');module[_0xa9d4('0x7')]=function(_0x7a049b,_0x47b601){return _0x7a049b['define']('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x735c=['sms_queues','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','SmsQueue'];(function(_0x24e2a3,_0x534875){var _0x3e82f4=function(_0x48a8ee){while(--_0x48a8ee){_0x24e2a3['push'](_0x24e2a3['shift']());}};_0x3e82f4(++_0x534875);}(_0x735c,0x1d5));var _0xc735=function(_0x3f4791,_0x49a572){_0x3f4791=_0x3f4791-0x0;var _0x2e0a15=_0x735c[_0x3f4791];return _0x2e0a15;};'use strict';var _=require(_0xc735('0x0'));var util=require(_0xc735('0x1'));var logger=require(_0xc735('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc735('0x3'));var rp=require(_0xc735('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc735('0x5'));var config=require(_0xc735('0x6'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x1252ae,_0x548cb6){return _0x1252ae['define'](_0xc735('0x7'),attributes,{'tableName':_0xc735('0x8'),'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 0e9f08c..7db899a 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 _0x11ee=['model','attributes','GetSmsQueue','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','options','raw','where','include','map'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x11ee,0xf5));var _0xe11e=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0x11ee[_0x427217];return _0x5b28fb;};'use strict';var _=require(_0xe11e('0x0'));var util=require(_0xe11e('0x1'));var moment=require(_0xe11e('0x2'));var BPromise=require(_0xe11e('0x3'));var rs=require(_0xe11e('0x4'));var fs=require('fs');var Redis=require(_0xe11e('0x5'));var db=require(_0xe11e('0x6'))['db'];var utils=require(_0xe11e('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe11e('0x8'));var jayson=require(_0xe11e('0x9'));var client=jayson[_0xe11e('0xa')]['http']({'port':0x232a});config[_0xe11e('0xb')]=_['defaults'](config[_0xe11e('0xb')],{'host':_0xe11e('0xc'),'port':0x18eb});var socket=require(_0xe11e('0xd'))(new Redis(config[_0xe11e('0xb')]));require(_0xe11e('0xe'))[_0xe11e('0xf')](socket);function respondWithRpcPromise(_0x7b2177,_0x38d87a,_0x668573){return new BPromise(function(_0x653545,_0x2e7e87){return client[_0xe11e('0x10')](_0x7b2177,_0x668573)[_0xe11e('0x11')](function(_0x2b20e0){logger[_0xe11e('0x12')](_0xe11e('0x13'),_0x38d87a,_0xe11e('0x14'));logger[_0xe11e('0x15')](_0xe11e('0x16'),_0x38d87a,_0xe11e('0x14'),JSON[_0xe11e('0x17')](_0x2b20e0));if(_0x2b20e0[_0xe11e('0x18')]){if(_0x2b20e0[_0xe11e('0x18')][_0xe11e('0x19')]===0x1f4){logger[_0xe11e('0x18')](_0xe11e('0x13'),_0x38d87a,_0x2b20e0[_0xe11e('0x18')]['message']);return _0x2e7e87(_0x2b20e0[_0xe11e('0x18')][_0xe11e('0x1a')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x38d87a,_0x2b20e0['error'][_0xe11e('0x1a')]);return _0x653545(_0x2b20e0[_0xe11e('0x18')][_0xe11e('0x1a')]);}else{logger[_0xe11e('0x12')]('SmsQueue,\x20%s,\x20%s',_0x38d87a,_0xe11e('0x14'));_0x653545(_0x2b20e0[_0xe11e('0x1b')][_0xe11e('0x1a')]);}})[_0xe11e('0x1c')](function(_0x4098cf){logger[_0xe11e('0x18')]('SmsQueue,\x20%s,\x20%s',_0x38d87a,_0x4098cf);_0x2e7e87(_0x4098cf);});});}exports['GetSmsQueue']=function(_0x56c990){var _0x306a6e=this;return new Promise(function(_0x362600,_0xb7395a){return db[_0xe11e('0x1d')]['findAll']({'raw':_0x56c990[_0xe11e('0x1e')]?_0x56c990['options'][_0xe11e('0x1f')]===undefined?!![]:![]:!![],'where':_0x56c990[_0xe11e('0x1e')]?_0x56c990[_0xe11e('0x1e')][_0xe11e('0x20')]||null:null,'attributes':_0x56c990[_0xe11e('0x1e')]?_0x56c990[_0xe11e('0x1e')]['attributes']||null:null,'limit':_0x56c990['options']?_0x56c990['options']['limit']||null:null,'include':_0x56c990[_0xe11e('0x1e')]?_0x56c990[_0xe11e('0x1e')][_0xe11e('0x21')]?_[_0xe11e('0x22')](_0x56c990[_0xe11e('0x1e')][_0xe11e('0x21')],function(_0x531ae0){return{'model':db[_0x531ae0['model']],'as':_0x531ae0['as'],'attributes':_0x531ae0['attributes'],'include':_0x531ae0['include']?_[_0xe11e('0x22')](_0x531ae0[_0xe11e('0x21')],function(_0x2a815f){return{'model':db[_0x2a815f[_0xe11e('0x23')]],'as':_0x2a815f['as'],'attributes':_0x2a815f[_0xe11e('0x24')],'include':_0x2a815f['include']?_['map'](_0x2a815f[_0xe11e('0x21')],function(_0x92338a){return{'model':db[_0x92338a[_0xe11e('0x23')]],'as':_0x92338a['as'],'attributes':_0x92338a['attributes']};}):[]};}):[]};}):[]:[]})[_0xe11e('0x11')](function(_0xae7ecd){logger['info'](_0xe11e('0x25'),_0x56c990);logger[_0xe11e('0x15')]('GetSmsQueue',_0x56c990,JSON[_0xe11e('0x17')](_0xae7ecd));_0x362600(_0xae7ecd);})[_0xe11e('0x1c')](function(_0x28456a){logger['error'](_0xe11e('0x25'),_0x28456a[_0xe11e('0x1a')],_0x56c990);_0xb7395a(_0x306a6e[_0xe11e('0x18')](0x1f4,_0x28456a[_0xe11e('0x1a')]));});});};exports[_0xe11e('0x26')]=function(_0x3298d2){var _0x236b3e=this;return new Promise(function(_0x193649,_0x495f8c){return db[_0xe11e('0x1d')][_0xe11e('0x27')]({'raw':_0x3298d2[_0xe11e('0x1e')]?_0x3298d2[_0xe11e('0x1e')][_0xe11e('0x1f')]===undefined?!![]:![]:!![],'where':_0x3298d2[_0xe11e('0x1e')]?_0x3298d2[_0xe11e('0x1e')][_0xe11e('0x20')]||null:null,'attributes':_0x3298d2['options']?_0x3298d2['options'][_0xe11e('0x24')]||null:null,'include':_0x3298d2['options']?_0x3298d2[_0xe11e('0x1e')]['include']?_[_0xe11e('0x22')](_0x3298d2[_0xe11e('0x1e')]['include'],function(_0x3f5f4f){return{'model':db[_0x3f5f4f[_0xe11e('0x23')]],'as':_0x3f5f4f['as'],'attributes':_0x3f5f4f['attributes'],'include':_0x3f5f4f[_0xe11e('0x21')]?_['map'](_0x3f5f4f['include'],function(_0x9627f3){return{'model':db[_0x9627f3[_0xe11e('0x23')]],'as':_0x9627f3['as'],'attributes':_0x9627f3['attributes'],'include':_0x9627f3[_0xe11e('0x21')]?_[_0xe11e('0x22')](_0x9627f3[_0xe11e('0x21')],function(_0xc2d5f8){return{'model':db[_0xc2d5f8['model']],'as':_0xc2d5f8['as'],'attributes':_0xc2d5f8[_0xe11e('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe11e('0x11')](function(_0x3a6cca){logger[_0xe11e('0x12')](_0xe11e('0x26'),_0x3298d2);logger['debug']('ShowSmsQueue',_0x3298d2,JSON[_0xe11e('0x17')](_0x3a6cca));_0x193649(_0x3a6cca);})[_0xe11e('0x1c')](function(_0x5cd9d0){logger[_0xe11e('0x18')](_0xe11e('0x26'),_0x5cd9d0[_0xe11e('0x1a')],_0x3298d2);_0x495f8c(_0x236b3e['error'](0x1f4,_0x5cd9d0[_0xe11e('0x1a')]));});});}; \ No newline at end of file +var _0xb7d3=['jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','request','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetSmsQueue','SmsQueue','options','attributes','include','map','model','then','info','debug','raw','where','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x421c56,_0x4efd00){var _0x49b244=function(_0x5cd079){while(--_0x5cd079){_0x421c56['push'](_0x421c56['shift']());}};_0x49b244(++_0x4efd00);}(_0xb7d3,0x88));var _0x3b7d=function(_0x163807,_0x558cfa){_0x163807=_0x163807-0x0;var _0x535b97=_0xb7d3[_0x163807];return _0x535b97;};'use strict';var _=require(_0x3b7d('0x0'));var util=require(_0x3b7d('0x1'));var moment=require(_0x3b7d('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b7d('0x3'));var fs=require('fs');var Redis=require(_0x3b7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3b7d('0x5'))(_0x3b7d('0x6'));var config=require(_0x3b7d('0x7'));var jayson=require(_0x3b7d('0x8'));var client=jayson[_0x3b7d('0x9')][_0x3b7d('0xa')]({'port':0x232a});config['redis']=_[_0x3b7d('0xb')](config['redis'],{'host':_0x3b7d('0xc'),'port':0x18eb});var socket=require(_0x3b7d('0xd'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x3b7d('0xe')](socket);function respondWithRpcPromise(_0x4c388f,_0x120650,_0x586b50){return new BPromise(function(_0x4a3ac6,_0x1ed44a){return client[_0x3b7d('0xf')](_0x4c388f,_0x586b50)['then'](function(_0x4ed1e2){logger['info'](_0x3b7d('0x10'),_0x120650,'request\x20sent');logger['debug'](_0x3b7d('0x11'),_0x120650,_0x3b7d('0x12'),JSON[_0x3b7d('0x13')](_0x4ed1e2));if(_0x4ed1e2['error']){if(_0x4ed1e2[_0x3b7d('0x14')]['code']===0x1f4){logger['error'](_0x3b7d('0x10'),_0x120650,_0x4ed1e2[_0x3b7d('0x14')][_0x3b7d('0x15')]);return _0x1ed44a(_0x4ed1e2[_0x3b7d('0x14')][_0x3b7d('0x15')]);}logger[_0x3b7d('0x14')](_0x3b7d('0x10'),_0x120650,_0x4ed1e2['error'][_0x3b7d('0x15')]);return _0x4a3ac6(_0x4ed1e2['error'][_0x3b7d('0x15')]);}else{logger['info'](_0x3b7d('0x10'),_0x120650,_0x3b7d('0x12'));_0x4a3ac6(_0x4ed1e2[_0x3b7d('0x16')]['message']);}})['catch'](function(_0x4a83c8){logger[_0x3b7d('0x14')](_0x3b7d('0x10'),_0x120650,_0x4a83c8);_0x1ed44a(_0x4a83c8);});});}exports[_0x3b7d('0x17')]=function(_0x2390f9){var _0x4960e0=this;return new Promise(function(_0x4f503c,_0x429c6c){return db[_0x3b7d('0x18')]['findAll']({'raw':_0x2390f9['options']?_0x2390f9[_0x3b7d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2390f9[_0x3b7d('0x19')]?_0x2390f9['options']['where']||null:null,'attributes':_0x2390f9[_0x3b7d('0x19')]?_0x2390f9[_0x3b7d('0x19')][_0x3b7d('0x1a')]||null:null,'limit':_0x2390f9[_0x3b7d('0x19')]?_0x2390f9[_0x3b7d('0x19')]['limit']||null:null,'include':_0x2390f9['options']?_0x2390f9[_0x3b7d('0x19')][_0x3b7d('0x1b')]?_[_0x3b7d('0x1c')](_0x2390f9['options']['include'],function(_0x1cea3a){return{'model':db[_0x1cea3a['model']],'as':_0x1cea3a['as'],'attributes':_0x1cea3a[_0x3b7d('0x1a')],'include':_0x1cea3a[_0x3b7d('0x1b')]?_[_0x3b7d('0x1c')](_0x1cea3a[_0x3b7d('0x1b')],function(_0x3af9d7){return{'model':db[_0x3af9d7[_0x3b7d('0x1d')]],'as':_0x3af9d7['as'],'attributes':_0x3af9d7[_0x3b7d('0x1a')],'include':_0x3af9d7[_0x3b7d('0x1b')]?_[_0x3b7d('0x1c')](_0x3af9d7[_0x3b7d('0x1b')],function(_0x4ac7b5){return{'model':db[_0x4ac7b5['model']],'as':_0x4ac7b5['as'],'attributes':_0x4ac7b5[_0x3b7d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3b7d('0x1e')](function(_0x12adbc){logger[_0x3b7d('0x1f')](_0x3b7d('0x17'),_0x2390f9);logger[_0x3b7d('0x20')](_0x3b7d('0x17'),_0x2390f9,JSON[_0x3b7d('0x13')](_0x12adbc));_0x4f503c(_0x12adbc);})['catch'](function(_0x78d09e){logger[_0x3b7d('0x14')]('GetSmsQueue',_0x78d09e[_0x3b7d('0x15')],_0x2390f9);_0x429c6c(_0x4960e0[_0x3b7d('0x14')](0x1f4,_0x78d09e['message']));});});};exports['ShowSmsQueue']=function(_0x12650e){var _0x2051ae=this;return new Promise(function(_0x4b6c50,_0x562dd2){return db[_0x3b7d('0x18')]['find']({'raw':_0x12650e['options']?_0x12650e[_0x3b7d('0x19')][_0x3b7d('0x21')]===undefined?!![]:![]:!![],'where':_0x12650e['options']?_0x12650e[_0x3b7d('0x19')][_0x3b7d('0x22')]||null:null,'attributes':_0x12650e['options']?_0x12650e[_0x3b7d('0x19')]['attributes']||null:null,'include':_0x12650e[_0x3b7d('0x19')]?_0x12650e[_0x3b7d('0x19')][_0x3b7d('0x1b')]?_['map'](_0x12650e['options'][_0x3b7d('0x1b')],function(_0x4bb440){return{'model':db[_0x4bb440[_0x3b7d('0x1d')]],'as':_0x4bb440['as'],'attributes':_0x4bb440['attributes'],'include':_0x4bb440[_0x3b7d('0x1b')]?_[_0x3b7d('0x1c')](_0x4bb440[_0x3b7d('0x1b')],function(_0x338f7d){return{'model':db[_0x338f7d[_0x3b7d('0x1d')]],'as':_0x338f7d['as'],'attributes':_0x338f7d['attributes'],'include':_0x338f7d['include']?_[_0x3b7d('0x1c')](_0x338f7d[_0x3b7d('0x1b')],function(_0x4ea24e){return{'model':db[_0x4ea24e[_0x3b7d('0x1d')]],'as':_0x4ea24e['as'],'attributes':_0x4ea24e[_0x3b7d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3b7d('0x1e')](function(_0x55a8a2){logger[_0x3b7d('0x1f')]('ShowSmsQueue',_0x12650e);logger[_0x3b7d('0x20')](_0x3b7d('0x23'),_0x12650e,JSON[_0x3b7d('0x13')](_0x55a8a2));_0x4b6c50(_0x55a8a2);})['catch'](function(_0x22d45d){logger[_0x3b7d('0x14')](_0x3b7d('0x23'),_0x22d45d[_0x3b7d('0x15')],_0x12650e);_0x562dd2(_0x2051ae[_0x3b7d('0x14')](0x1f4,_0x22d45d[_0x3b7d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index d300d1e..bf1f6c5 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 _0xd826=['length','remove','update','emit'];(function(_0xd649da,_0x550951){var _0x59510c=function(_0xa5cb42){while(--_0xa5cb42){_0xd649da['push'](_0xd649da['shift']());}};_0x59510c(++_0x550951);}(_0xd826,0x89));var _0x6d82=function(_0x4c5e80,_0x4cc743){_0x4c5e80=_0x4c5e80-0x0;var _0x445cda=_0xd826[_0x4c5e80];return _0x445cda;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0x6d82('0x0'),_0x6d82('0x1')];function createListener(_0x2a1832,_0x5c713f){return function(_0x38629b){_0x5c713f[_0x6d82('0x2')](_0x2a1832,_0x38629b);};}function removeListener(_0x20a096,_0x4f8067){return function(){SmsQueueEvents['removeListener'](_0x20a096,_0x4f8067);};}exports['register']=function(_0x14349f){for(var _0x29d8fe=0x0,_0xd1febb=events[_0x6d82('0x3')];_0x29d8fe<_0xd1febb;_0x29d8fe++){var _0x80f8be=events[_0x29d8fe];var _0xe99613=createListener('smsQueue:'+_0x80f8be,_0x14349f);SmsQueueEvents['on'](_0x80f8be,_0xe99613);}}; \ No newline at end of file +var _0xd4c8=['update','removeListener','length','smsQueue:','save','remove'];(function(_0x304009,_0x5c1324){var _0x33b9d5=function(_0x72884){while(--_0x72884){_0x304009['push'](_0x304009['shift']());}};_0x33b9d5(++_0x5c1324);}(_0xd4c8,0x130));var _0x8d4c=function(_0x567816,_0x1f0a75){_0x567816=_0x567816-0x0;var _0x465823=_0xd4c8[_0x567816];return _0x465823;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x8d4c('0x0'),_0x8d4c('0x1'),_0x8d4c('0x2')];function createListener(_0x4ee8e0,_0x1110d6){return function(_0x4fce52){_0x1110d6['emit'](_0x4ee8e0,_0x4fce52);};}function removeListener(_0x42b9ba,_0x1fc776){return function(){SmsQueueEvents[_0x8d4c('0x3')](_0x42b9ba,_0x1fc776);};}exports['register']=function(_0x33d086){for(var _0x404f9d=0x0,_0x3f52f9=events[_0x8d4c('0x4')];_0x404f9d<_0x3f52f9;_0x404f9d++){var _0x3438fa=events[_0x404f9d];var _0x5efff1=createListener(_0x8d4c('0x5')+_0x3438fa,_0x33d086);SmsQueueEvents['on'](_0x3438fa,_0x5efff1);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 2fe04d4..f24f30e 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 _0x0f42=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0x0f42,0xc9));var _0x20f4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0f42[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x20f4('0x0'));var util=require(_0x20f4('0x1'));var path=require(_0x20f4('0x2'));var timeout=require(_0x20f4('0x3'));var express=require('express');var router=express[_0x20f4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x20f4('0x5'));var interaction=require(_0x20f4('0x6'));var config=require(_0x20f4('0x7'));var controller=require(_0x20f4('0x8'));router[_0x20f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x20f4('0x9')]('/describe',auth[_0x20f4('0xa')](),controller[_0x20f4('0xb')]);router[_0x20f4('0x9')](_0x20f4('0xc'),auth[_0x20f4('0xa')](),controller[_0x20f4('0xd')]);router[_0x20f4('0xe')]('/',auth[_0x20f4('0xa')](),controller[_0x20f4('0xf')]);router[_0x20f4('0x10')]('/:id',auth[_0x20f4('0xa')](),controller['update']);router[_0x20f4('0x11')]('/:id',auth[_0x20f4('0xa')](),controller[_0x20f4('0x12')]);module[_0x20f4('0x13')]=router; \ No newline at end of file +var _0x68de=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','put','delete','exports','multer'];(function(_0x5b660b,_0x4172c8){var _0x30e1d3=function(_0x1e1e2b){while(--_0x1e1e2b){_0x5b660b['push'](_0x5b660b['shift']());}};_0x30e1d3(++_0x4172c8);}(_0x68de,0x17b));var _0xe68d=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x68de[_0x56ba92];return _0x8fe94d;};'use strict';var multer=require(_0xe68d('0x0'));var util=require('util');var path=require(_0xe68d('0x1'));var timeout=require(_0xe68d('0x2'));var express=require(_0xe68d('0x3'));var router=express[_0xe68d('0x4')]();var fs_extra=require(_0xe68d('0x5'));var auth=require(_0xe68d('0x6'));var interaction=require(_0xe68d('0x7'));var config=require(_0xe68d('0x8'));var controller=require('./smsQueueReport.controller');router[_0xe68d('0x9')]('/',auth[_0xe68d('0xa')](),controller[_0xe68d('0xb')]);router[_0xe68d('0x9')]('/describe',auth[_0xe68d('0xa')](),controller[_0xe68d('0xc')]);router['get'](_0xe68d('0xd'),auth[_0xe68d('0xa')](),controller['show']);router[_0xe68d('0xe')]('/',auth[_0xe68d('0xa')](),controller[_0xe68d('0xf')]);router[_0xe68d('0x10')](_0xe68d('0xd'),auth[_0xe68d('0xa')](),controller['update']);router[_0xe68d('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe68d('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 955da52..20cd768 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 _0x5388=['sequelize','STRING','DATE'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x5388,0x159));var _0x8538=function(_0x18ce11,_0x135cc0){_0x18ce11=_0x18ce11-0x0;var _0x3bea1d=_0x5388[_0x18ce11];return _0x3bea1d;};'use strict';var moment=require('moment');var Sequelize=require(_0x8538('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8538('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x8538('0x1')]},'joinAt':{'type':Sequelize[_0x8538('0x2')]},'leaveAt':{'type':Sequelize[_0x8538('0x2')]},'acceptAt':{'type':Sequelize[_0x8538('0x2')]},'exitAt':{'type':Sequelize[_0x8538('0x2')]},'reason':{'type':Sequelize[_0x8538('0x1')]}}; \ No newline at end of file +var _0x30c6=['moment','sequelize','exports','STRING','DATE'];(function(_0x1254ce,_0xba380e){var _0x3eca31=function(_0xfbcede){while(--_0xfbcede){_0x1254ce['push'](_0x1254ce['shift']());}};_0x3eca31(++_0xba380e);}(_0x30c6,0x15e));var _0x630c=function(_0x342959,_0x2344d0){_0x342959=_0x342959-0x0;var _0x67dbf5=_0x30c6[_0x342959];return _0x67dbf5;};'use strict';var moment=require(_0x630c('0x0'));var Sequelize=require(_0x630c('0x1'));module[_0x630c('0x2')]={'uniqueid':{'type':Sequelize[_0x630c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x630c('0x3')]},'joinAt':{'type':Sequelize[_0x630c('0x4')]},'leaveAt':{'type':Sequelize[_0x630c('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x630c('0x4')]},'reason':{'type':Sequelize[_0x630c('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 7f241fa..0c3c3a3 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 _0xb45f=['attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','error','stack','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xb45f,0x147));var _0xfb45=function(_0x3e6b6a,_0x139e5a){_0x3e6b6a=_0x3e6b6a-0x0;var _0x571b54=_0xb45f[_0x3e6b6a];return _0x571b54;};'use strict';var emlformat=require(_0xfb45('0x0'));var rimraf=require(_0xfb45('0x1'));var zipdir=require(_0xfb45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfb45('0x3'));var BPromise=require(_0xfb45('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfb45('0x5'));var sox=require(_0xfb45('0x6'));var csv=require(_0xfb45('0x7'));var ejs=require(_0xfb45('0x8'));var fs=require('fs');var fs_extra=require(_0xfb45('0x9'));var _=require(_0xfb45('0xa'));var squel=require('squel');var crypto=require(_0xfb45('0xb'));var jsforce=require(_0xfb45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfb45('0x7'));var querystring=require(_0xfb45('0xd'));var Papa=require(_0xfb45('0xe'));var Redis=require(_0xfb45('0xf'));var authService=require(_0xfb45('0x10'));var qs=require(_0xfb45('0x11'));var as=require(_0xfb45('0x12'));var hardwareService=require(_0xfb45('0x13'));var logger=require('../../config/logger')(_0xfb45('0x14'));var utils=require(_0xfb45('0x15'));var config=require(_0xfb45('0x16'));var licenseUtil=require(_0xfb45('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a357b,_0x18713b){_0x18713b=_0x18713b||0xcc;return function(_0x1ff57a){if(_0x1ff57a){return _0x2a357b[_0xfb45('0x18')](_0x18713b);}return _0x2a357b[_0xfb45('0x19')](_0x18713b)[_0xfb45('0x1a')]();};}function respondWithResult(_0xcb87bf,_0x50e589){_0x50e589=_0x50e589||0xc8;return function(_0x10f854){if(_0x10f854){return _0xcb87bf[_0xfb45('0x19')](_0x50e589)['json'](_0x10f854);}};}function respondWithFilteredResult(_0x2877c4,_0x3e2c60){return function(_0x283c59){if(_0x283c59){var _0x4d8710=typeof _0x3e2c60[_0xfb45('0x1b')]===_0xfb45('0x1c')&&typeof _0x3e2c60[_0xfb45('0x1d')]==='undefined';var _0x33530d=_0x283c59[_0xfb45('0x1e')];var _0xdece6f=_0x4d8710?0x0:_0x3e2c60[_0xfb45('0x1b')];var _0x36581b=_0x4d8710?_0x283c59['count']:_0x3e2c60[_0xfb45('0x1b')]+_0x3e2c60[_0xfb45('0x1d')];var _0x267953;if(_0x36581b>=_0x33530d){_0x36581b=_0x33530d;_0x267953=0xc8;}else{_0x267953=0xce;}_0x2877c4[_0xfb45('0x19')](_0x267953);return _0x2877c4[_0xfb45('0x1f')](_0xfb45('0x20'),_0xdece6f+'-'+_0x36581b+'/'+_0x33530d)[_0xfb45('0x21')](_0x283c59);}return null;};}function patchUpdates(_0x4e190c){return function(_0x546aef){try{jsonpatch[_0xfb45('0x22')](_0x546aef,_0x4e190c,!![]);}catch(_0x288ab8){return BPromise[_0xfb45('0x23')](_0x288ab8);}return _0x546aef[_0xfb45('0x24')]();};}function saveUpdates(_0x41b2fb,_0x5cac2e){return function(_0xb8cd33){if(_0xb8cd33){return _0xb8cd33['update'](_0x41b2fb)['then'](function(_0x589731){return _0x589731;});}return null;};}function removeEntity(_0x225ab0,_0x2cf106){return function(_0x2da695){if(_0x2da695){return _0x2da695['destroy']()[_0xfb45('0x25')](function(){_0x225ab0[_0xfb45('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c7953,_0x40d09a){return function(_0x341c26){if(!_0x341c26){_0x3c7953['sendStatus'](0x194);}return _0x341c26;};}function handleError(_0x784e56,_0x46f6e4){_0x46f6e4=_0x46f6e4||0x1f4;return function(_0x3e38aa){logger[_0xfb45('0x26')](_0x3e38aa[_0xfb45('0x27')]);if(_0x3e38aa['name']){delete _0x3e38aa['name'];}_0x784e56['status'](_0x46f6e4)['send'](_0x3e38aa);};}exports['index']=function(_0x786e4a,_0x2ddfcb){var _0x2a1d54={},_0x33a67f={},_0x5e0d53={'count':0x0,'rows':[]};var _0x5ebdb5=_['map'](db[_0xfb45('0x28')][_0xfb45('0x29')],function(_0x2b323f){return{'name':_0x2b323f[_0xfb45('0x2a')],'type':_0x2b323f[_0xfb45('0x2b')][_0xfb45('0x2c')]};});_0x33a67f[_0xfb45('0x2d')]=_[_0xfb45('0x2e')](_0x5ebdb5,_0xfb45('0x2f'));_0x33a67f[_0xfb45('0x30')]=_[_0xfb45('0x31')](_0x786e4a[_0xfb45('0x30')]);_0x33a67f[_0xfb45('0x32')]=_[_0xfb45('0x33')](_0x33a67f[_0xfb45('0x2d')],_0x33a67f[_0xfb45('0x30')]);_0x2a1d54['attributes']=_[_0xfb45('0x33')](_0x33a67f[_0xfb45('0x2d')],qs[_0xfb45('0x34')](_0x786e4a[_0xfb45('0x30')]['fields']));_0x2a1d54[_0xfb45('0x35')]=_0x2a1d54['attributes'][_0xfb45('0x36')]?_0x2a1d54[_0xfb45('0x35')]:_0x33a67f[_0xfb45('0x2d')];if(!_0x786e4a['query'][_0xfb45('0x37')]('nolimit')){_0x2a1d54[_0xfb45('0x1d')]=qs['limit'](_0x786e4a['query'][_0xfb45('0x1d')]);_0x2a1d54[_0xfb45('0x1b')]=qs['offset'](_0x786e4a[_0xfb45('0x30')][_0xfb45('0x1b')]);}_0x2a1d54['order']=qs[_0xfb45('0x38')](_0x786e4a[_0xfb45('0x30')][_0xfb45('0x38')]);_0x2a1d54[_0xfb45('0x39')]=qs[_0xfb45('0x32')](_[_0xfb45('0x3a')](_0x786e4a[_0xfb45('0x30')],_0x33a67f[_0xfb45('0x32')]),_0x5ebdb5);if(_0x786e4a[_0xfb45('0x30')][_0xfb45('0x3b')]){_0x2a1d54[_0xfb45('0x39')]=_[_0xfb45('0x3c')](_0x2a1d54['where'],{'$or':_['map'](_0x5ebdb5,function(_0x5f0850){if(_0x5f0850[_0xfb45('0x2b')]!==_0xfb45('0x3d')){var _0x13f3a1={};_0x13f3a1[_0x5f0850[_0xfb45('0x2f')]]={'$like':'%'+_0x786e4a['query'][_0xfb45('0x3b')]+'%'};return _0x13f3a1;}})});}_0x2a1d54=_['merge']({},_0x2a1d54,_0x786e4a[_0xfb45('0x3e')]);var _0x40ffb3={'where':_0x2a1d54['where']};return db[_0xfb45('0x28')]['count'](_0x40ffb3)[_0xfb45('0x25')](function(_0x4bb39e){_0x5e0d53[_0xfb45('0x1e')]=_0x4bb39e;if(_0x786e4a[_0xfb45('0x30')][_0xfb45('0x3f')]){_0x2a1d54[_0xfb45('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xfb45('0x41')](_0x2a1d54);})[_0xfb45('0x25')](function(_0x210694){_0x5e0d53[_0xfb45('0x42')]=_0x210694;return _0x5e0d53;})['then'](respondWithFilteredResult(_0x2ddfcb,_0x2a1d54))[_0xfb45('0x43')](handleError(_0x2ddfcb,null));};exports[_0xfb45('0x44')]=function(_0x515398,_0x9a3490){var _0x59dbe8={'raw':!![],'where':{'id':_0x515398[_0xfb45('0x45')]['id']}},_0x3aca5e={};_0x3aca5e[_0xfb45('0x2d')]=_[_0xfb45('0x31')](db[_0xfb45('0x28')][_0xfb45('0x29')]);_0x3aca5e[_0xfb45('0x30')]=_[_0xfb45('0x31')](_0x515398[_0xfb45('0x30')]);_0x3aca5e[_0xfb45('0x32')]=_[_0xfb45('0x33')](_0x3aca5e[_0xfb45('0x2d')],_0x3aca5e[_0xfb45('0x30')]);_0x59dbe8[_0xfb45('0x35')]=_['intersection'](_0x3aca5e['model'],qs[_0xfb45('0x34')](_0x515398['query'][_0xfb45('0x34')]));_0x59dbe8[_0xfb45('0x35')]=_0x59dbe8[_0xfb45('0x35')]['length']?_0x59dbe8[_0xfb45('0x35')]:_0x3aca5e[_0xfb45('0x2d')];if(_0x515398[_0xfb45('0x30')]['includeAll']){_0x59dbe8[_0xfb45('0x40')]=[{'all':!![]}];}_0x59dbe8=_[_0xfb45('0x3c')]({},_0x59dbe8,_0x515398['options']);return db[_0xfb45('0x28')][_0xfb45('0x46')](_0x59dbe8)[_0xfb45('0x25')](handleEntityNotFound(_0x9a3490,null))[_0xfb45('0x25')](respondWithResult(_0x9a3490,null))[_0xfb45('0x43')](handleError(_0x9a3490,null));};exports[_0xfb45('0x47')]=function(_0x39938d,_0x542228){return db[_0xfb45('0x28')][_0xfb45('0x47')](_0x39938d[_0xfb45('0x48')],{})[_0xfb45('0x25')](respondWithResult(_0x542228,0xc9))[_0xfb45('0x43')](handleError(_0x542228,null));};exports[_0xfb45('0x49')]=function(_0x5c39f9,_0x5cbe9b){if(_0x5c39f9[_0xfb45('0x48')]['id']){delete _0x5c39f9['body']['id'];}return db[_0xfb45('0x28')]['find']({'where':{'id':_0x5c39f9[_0xfb45('0x45')]['id']}})[_0xfb45('0x25')](handleEntityNotFound(_0x5cbe9b,null))[_0xfb45('0x25')](saveUpdates(_0x5c39f9['body'],null))[_0xfb45('0x25')](respondWithResult(_0x5cbe9b,null))[_0xfb45('0x43')](handleError(_0x5cbe9b,null));};exports[_0xfb45('0x4a')]=function(_0x3db2f1,_0x43b32c){return db['SmsQueueReport'][_0xfb45('0x46')]({'where':{'id':_0x3db2f1[_0xfb45('0x45')]['id']}})[_0xfb45('0x25')](handleEntityNotFound(_0x43b32c,null))[_0xfb45('0x25')](removeEntity(_0x43b32c,null))[_0xfb45('0x43')](handleError(_0x43b32c,null));};exports[_0xfb45('0x4b')]=function(_0x4bf2c0,_0x4f3ebd){return db[_0xfb45('0x28')]['describe']()['then'](respondWithResult(_0x4f3ebd,null))['catch'](handleError(_0x4f3ebd,null));}; \ No newline at end of file +var _0x3032=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','findAll','catch','params','includeAll','options','find','create','update','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x32d996,_0x52ad62){var _0x56415b=function(_0x542ecc){while(--_0x542ecc){_0x32d996['push'](_0x32d996['shift']());}};_0x56415b(++_0x52ad62);}(_0x3032,0x77));var _0x2303=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3032[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2303('0x0'));var rimraf=require(_0x2303('0x1'));var zipdir=require(_0x2303('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2303('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2303('0x4'));var util=require(_0x2303('0x5'));var path=require('path');var sox=require(_0x2303('0x6'));var csv=require('to-csv');var ejs=require(_0x2303('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2303('0x8'));var squel=require(_0x2303('0x9'));var crypto=require(_0x2303('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2303('0xb'));var toCsv=require(_0x2303('0xc'));var querystring=require(_0x2303('0xd'));var Papa=require(_0x2303('0xe'));var Redis=require(_0x2303('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2303('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2303('0x11'))(_0x2303('0x12'));var utils=require(_0x2303('0x13'));var config=require(_0x2303('0x14'));var licenseUtil=require(_0x2303('0x15'));var db=require(_0x2303('0x16'))['db'];function respondWithStatusCode(_0x4b44fc,_0x1626ef){_0x1626ef=_0x1626ef||0xcc;return function(_0x5f3f4a){if(_0x5f3f4a){return _0x4b44fc[_0x2303('0x17')](_0x1626ef);}return _0x4b44fc[_0x2303('0x18')](_0x1626ef)[_0x2303('0x19')]();};}function respondWithResult(_0x3321c6,_0xb509ed){_0xb509ed=_0xb509ed||0xc8;return function(_0xfe7675){if(_0xfe7675){return _0x3321c6['status'](_0xb509ed)[_0x2303('0x1a')](_0xfe7675);}};}function respondWithFilteredResult(_0x561acd,_0x1fb812){return function(_0x3bceab){if(_0x3bceab){var _0x5f0a17=typeof _0x1fb812[_0x2303('0x1b')]===_0x2303('0x1c')&&typeof _0x1fb812[_0x2303('0x1d')]==='undefined';var _0x318488=_0x3bceab[_0x2303('0x1e')];var _0x45e48f=_0x5f0a17?0x0:_0x1fb812[_0x2303('0x1b')];var _0x1e79d1=_0x5f0a17?_0x3bceab[_0x2303('0x1e')]:_0x1fb812[_0x2303('0x1b')]+_0x1fb812[_0x2303('0x1d')];var _0x4a672d;if(_0x1e79d1>=_0x318488){_0x1e79d1=_0x318488;_0x4a672d=0xc8;}else{_0x4a672d=0xce;}_0x561acd[_0x2303('0x18')](_0x4a672d);return _0x561acd[_0x2303('0x1f')](_0x2303('0x20'),_0x45e48f+'-'+_0x1e79d1+'/'+_0x318488)[_0x2303('0x1a')](_0x3bceab);}return null;};}function patchUpdates(_0x36f777){return function(_0x1e69d4){try{jsonpatch[_0x2303('0x21')](_0x1e69d4,_0x36f777,!![]);}catch(_0x1eba2b){return BPromise[_0x2303('0x22')](_0x1eba2b);}return _0x1e69d4[_0x2303('0x23')]();};}function saveUpdates(_0x45d0d7,_0x51a9fc){return function(_0x50780a){if(_0x50780a){return _0x50780a['update'](_0x45d0d7)[_0x2303('0x24')](function(_0x466f80){return _0x466f80;});}return null;};}function removeEntity(_0x5a5f7b,_0x1c33db){return function(_0x558a4a){if(_0x558a4a){return _0x558a4a[_0x2303('0x25')]()[_0x2303('0x24')](function(){_0x5a5f7b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe67f,_0x535edd){return function(_0x2764ba){if(!_0x2764ba){_0x1fe67f[_0x2303('0x17')](0x194);}return _0x2764ba;};}function handleError(_0x537337,_0x46e0f2){_0x46e0f2=_0x46e0f2||0x1f4;return function(_0x11d341){logger['error'](_0x11d341[_0x2303('0x26')]);if(_0x11d341[_0x2303('0x27')]){delete _0x11d341[_0x2303('0x27')];}_0x537337['status'](_0x46e0f2)['send'](_0x11d341);};}exports[_0x2303('0x28')]=function(_0x18080b,_0x566b86){var _0x1406cb={},_0x2350a5={},_0x164bad={'count':0x0,'rows':[]};var _0x41486c=_[_0x2303('0x29')](db[_0x2303('0x2a')][_0x2303('0x2b')],function(_0x4cef64){return{'name':_0x4cef64[_0x2303('0x2c')],'type':_0x4cef64[_0x2303('0x2d')][_0x2303('0x2e')]};});_0x2350a5[_0x2303('0x2f')]=_[_0x2303('0x29')](_0x41486c,_0x2303('0x27'));_0x2350a5[_0x2303('0x30')]=_[_0x2303('0x31')](_0x18080b[_0x2303('0x30')]);_0x2350a5[_0x2303('0x32')]=_[_0x2303('0x33')](_0x2350a5[_0x2303('0x2f')],_0x2350a5[_0x2303('0x30')]);_0x1406cb[_0x2303('0x34')]=_[_0x2303('0x33')](_0x2350a5['model'],qs[_0x2303('0x35')](_0x18080b[_0x2303('0x30')][_0x2303('0x35')]));_0x1406cb[_0x2303('0x34')]=_0x1406cb[_0x2303('0x34')][_0x2303('0x36')]?_0x1406cb[_0x2303('0x34')]:_0x2350a5['model'];if(!_0x18080b[_0x2303('0x30')]['hasOwnProperty'](_0x2303('0x37'))){_0x1406cb[_0x2303('0x1d')]=qs[_0x2303('0x1d')](_0x18080b['query'][_0x2303('0x1d')]);_0x1406cb[_0x2303('0x1b')]=qs['offset'](_0x18080b[_0x2303('0x30')][_0x2303('0x1b')]);}_0x1406cb[_0x2303('0x38')]=qs[_0x2303('0x39')](_0x18080b[_0x2303('0x30')][_0x2303('0x39')]);_0x1406cb[_0x2303('0x3a')]=qs['filters'](_[_0x2303('0x3b')](_0x18080b[_0x2303('0x30')],_0x2350a5[_0x2303('0x32')]),_0x41486c);if(_0x18080b[_0x2303('0x30')][_0x2303('0x3c')]){_0x1406cb['where']=_['merge'](_0x1406cb[_0x2303('0x3a')],{'$or':_[_0x2303('0x29')](_0x41486c,function(_0x46af5a){if(_0x46af5a[_0x2303('0x2d')]!==_0x2303('0x3d')){var _0xd7f5b1={};_0xd7f5b1[_0x46af5a[_0x2303('0x27')]]={'$like':'%'+_0x18080b[_0x2303('0x30')][_0x2303('0x3c')]+'%'};return _0xd7f5b1;}})});}_0x1406cb=_[_0x2303('0x3e')]({},_0x1406cb,_0x18080b['options']);var _0x5dcfee={'where':_0x1406cb['where']};return db[_0x2303('0x2a')][_0x2303('0x1e')](_0x5dcfee)['then'](function(_0xe769fb){_0x164bad[_0x2303('0x1e')]=_0xe769fb;if(_0x18080b[_0x2303('0x30')]['includeAll']){_0x1406cb['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0x2303('0x3f')](_0x1406cb);})[_0x2303('0x24')](function(_0x1df006){_0x164bad['rows']=_0x1df006;return _0x164bad;})[_0x2303('0x24')](respondWithFilteredResult(_0x566b86,_0x1406cb))[_0x2303('0x40')](handleError(_0x566b86,null));};exports['show']=function(_0x5bb45c,_0x19fc8c){var _0x5c7079={'raw':!![],'where':{'id':_0x5bb45c[_0x2303('0x41')]['id']}},_0x4317c5={};_0x4317c5[_0x2303('0x2f')]=_[_0x2303('0x31')](db[_0x2303('0x2a')][_0x2303('0x2b')]);_0x4317c5[_0x2303('0x30')]=_[_0x2303('0x31')](_0x5bb45c[_0x2303('0x30')]);_0x4317c5['filters']=_['intersection'](_0x4317c5[_0x2303('0x2f')],_0x4317c5['query']);_0x5c7079[_0x2303('0x34')]=_[_0x2303('0x33')](_0x4317c5[_0x2303('0x2f')],qs[_0x2303('0x35')](_0x5bb45c['query'][_0x2303('0x35')]));_0x5c7079[_0x2303('0x34')]=_0x5c7079[_0x2303('0x34')][_0x2303('0x36')]?_0x5c7079[_0x2303('0x34')]:_0x4317c5[_0x2303('0x2f')];if(_0x5bb45c[_0x2303('0x30')][_0x2303('0x42')]){_0x5c7079['include']=[{'all':!![]}];}_0x5c7079=_['merge']({},_0x5c7079,_0x5bb45c[_0x2303('0x43')]);return db['SmsQueueReport'][_0x2303('0x44')](_0x5c7079)[_0x2303('0x24')](handleEntityNotFound(_0x19fc8c,null))[_0x2303('0x24')](respondWithResult(_0x19fc8c,null))['catch'](handleError(_0x19fc8c,null));};exports[_0x2303('0x45')]=function(_0x4a4578,_0x2d7b5d){return db[_0x2303('0x2a')][_0x2303('0x45')](_0x4a4578['body'],{})[_0x2303('0x24')](respondWithResult(_0x2d7b5d,0xc9))['catch'](handleError(_0x2d7b5d,null));};exports[_0x2303('0x46')]=function(_0x3af026,_0xee38cf){if(_0x3af026[_0x2303('0x47')]['id']){delete _0x3af026[_0x2303('0x47')]['id'];}return db['SmsQueueReport'][_0x2303('0x44')]({'where':{'id':_0x3af026[_0x2303('0x41')]['id']}})[_0x2303('0x24')](handleEntityNotFound(_0xee38cf,null))[_0x2303('0x24')](saveUpdates(_0x3af026[_0x2303('0x47')],null))[_0x2303('0x24')](respondWithResult(_0xee38cf,null))[_0x2303('0x40')](handleError(_0xee38cf,null));};exports['destroy']=function(_0x5217a2,_0x431c1f){return db['SmsQueueReport'][_0x2303('0x44')]({'where':{'id':_0x5217a2[_0x2303('0x41')]['id']}})[_0x2303('0x24')](handleEntityNotFound(_0x431c1f,null))[_0x2303('0x24')](removeEntity(_0x431c1f,null))[_0x2303('0x40')](handleError(_0x431c1f,null));};exports[_0x2303('0x48')]=function(_0x5b9f83,_0x9a2097){return db['SmsQueueReport'][_0x2303('0x48')]()[_0x2303('0x24')](respondWithResult(_0x9a2097,null))[_0x2303('0x40')](handleError(_0x9a2097,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 6905728..39817a3 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(_0x19311e,_0x4face1){var _0x363155=function(_0x55d6c7){while(--_0x55d6c7){_0x19311e['push'](_0x19311e['shift']());}};_0x363155(++_0x4face1);}(_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('./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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0xec7386,_0x4b4982){var _0x14f7cb=function(_0x578b65){while(--_0x578b65){_0xec7386['push'](_0xec7386['shift']());}};_0x14f7cb(++_0x4b4982);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0xcb91[_0x5d8631];return _0x34c15e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 3440330..b400c45 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 _0x7f32=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','catch','UpdateSmsQueueReport','update','where','attributes','limit','stringify','lodash','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7f32,0x174));var _0x27f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x27f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x27f3('0x1'));var rs=require(_0x27f3('0x2'));var fs=require('fs');var Redis=require(_0x27f3('0x3'));var db=require(_0x27f3('0x4'))['db'];var utils=require(_0x27f3('0x5'));var logger=require('../../config/logger')(_0x27f3('0x6'));var config=require(_0x27f3('0x7'));var jayson=require(_0x27f3('0x8'));var client=jayson[_0x27f3('0x9')][_0x27f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ba3d4,_0x250fd5,_0x400387){return new BPromise(function(_0x381f7a,_0x10d9c2){return client[_0x27f3('0xb')](_0x3ba3d4,_0x400387)[_0x27f3('0xc')](function(_0x1cec35){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x250fd5,_0x27f3('0xd'));logger[_0x27f3('0xe')](_0x27f3('0xf'),_0x250fd5,_0x27f3('0xd'),JSON['stringify'](_0x1cec35));if(_0x1cec35[_0x27f3('0x10')]){if(_0x1cec35['error'][_0x27f3('0x11')]===0x1f4){logger[_0x27f3('0x10')](_0x27f3('0x12'),_0x250fd5,_0x1cec35['error'][_0x27f3('0x13')]);return _0x10d9c2(_0x1cec35[_0x27f3('0x10')]['message']);}logger[_0x27f3('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x250fd5,_0x1cec35[_0x27f3('0x10')][_0x27f3('0x13')]);return _0x381f7a(_0x1cec35[_0x27f3('0x10')]['message']);}else{logger[_0x27f3('0x14')](_0x27f3('0x12'),_0x250fd5,_0x27f3('0xd'));_0x381f7a(_0x1cec35[_0x27f3('0x15')][_0x27f3('0x13')]);}})['catch'](function(_0x53e837){logger[_0x27f3('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x250fd5,_0x53e837);_0x10d9c2(_0x53e837);});});}exports[_0x27f3('0x16')]=function(_0x2aab48){var _0x214fcf=this;return new Promise(function(_0x2d54e6,_0x37290d){return db[_0x27f3('0x17')][_0x27f3('0x18')](_0x2aab48[_0x27f3('0x19')],{'raw':_0x2aab48[_0x27f3('0x1a')]?_0x2aab48[_0x27f3('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x27f3('0xc')](function(_0x53ec17){logger[_0x27f3('0x14')]('CreateSmsQueueReport',_0x2aab48);logger[_0x27f3('0xe')]('CreateSmsQueueReport',_0x2aab48,JSON['stringify'](_0x53ec17));_0x2d54e6(_0x53ec17);})[_0x27f3('0x1b')](function(_0x30eac4){logger['error'](_0x27f3('0x16'),_0x30eac4[_0x27f3('0x13')],_0x2aab48);_0x37290d(_0x214fcf[_0x27f3('0x10')](0x1f4,_0x30eac4[_0x27f3('0x13')]));});});};exports[_0x27f3('0x1c')]=function(_0x4c7a61){var _0xa9e943=this;return new Promise(function(_0x4dad46,_0x20a39e){return db['SmsQueueReport'][_0x27f3('0x1d')](_0x4c7a61[_0x27f3('0x19')],{'raw':_0x4c7a61[_0x27f3('0x1a')]?_0x4c7a61['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c7a61[_0x27f3('0x1a')]?_0x4c7a61[_0x27f3('0x1a')][_0x27f3('0x1e')]||null:null,'attributes':_0x4c7a61[_0x27f3('0x1a')]?_0x4c7a61['options'][_0x27f3('0x1f')]||null:null,'limit':_0x4c7a61[_0x27f3('0x1a')]?_0x4c7a61[_0x27f3('0x1a')][_0x27f3('0x20')]||null:null})[_0x27f3('0xc')](function(_0x2b2c38){logger[_0x27f3('0x14')]('UpdateSmsQueueReport',_0x4c7a61);logger['debug'](_0x27f3('0x1c'),_0x4c7a61,JSON[_0x27f3('0x21')](_0x2b2c38));_0x4dad46(_0x2b2c38);})[_0x27f3('0x1b')](function(_0x5359ab){logger[_0x27f3('0x10')](_0x27f3('0x1c'),_0x5359ab[_0x27f3('0x13')],_0x4c7a61);_0x20a39e(_0xa9e943[_0x27f3('0x10')](0x1f4,_0x5359ab[_0x27f3('0x13')]));});});}; \ No newline at end of file +var _0xdeb3=['http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','options','raw','catch','UpdateSmsQueueReport','update','where','attributes','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2487ce,_0x472f40){var _0x3d81c0=function(_0x3923ce){while(--_0x3923ce){_0x2487ce['push'](_0x2487ce['shift']());}};_0x3d81c0(++_0x472f40);}(_0xdeb3,0x1e4));var _0x3deb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdeb3[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var moment=require(_0x3deb('0x2'));var BPromise=require('bluebird');var rs=require(_0x3deb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3deb('0x4'))['db'];var utils=require(_0x3deb('0x5'));var logger=require(_0x3deb('0x6'))(_0x3deb('0x7'));var config=require(_0x3deb('0x8'));var jayson=require(_0x3deb('0x9'));var client=jayson[_0x3deb('0xa')][_0x3deb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48710f,_0x30e03c,_0x446e0e){return new BPromise(function(_0x1bd916,_0x476998){return client[_0x3deb('0xc')](_0x48710f,_0x446e0e)[_0x3deb('0xd')](function(_0x35a7a7){logger[_0x3deb('0xe')](_0x3deb('0xf'),_0x30e03c,_0x3deb('0x10'));logger[_0x3deb('0x11')](_0x3deb('0x12'),_0x30e03c,_0x3deb('0x10'),JSON[_0x3deb('0x13')](_0x35a7a7));if(_0x35a7a7[_0x3deb('0x14')]){if(_0x35a7a7[_0x3deb('0x14')][_0x3deb('0x15')]===0x1f4){logger[_0x3deb('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x30e03c,_0x35a7a7['error'][_0x3deb('0x16')]);return _0x476998(_0x35a7a7[_0x3deb('0x14')]['message']);}logger[_0x3deb('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x30e03c,_0x35a7a7[_0x3deb('0x14')]['message']);return _0x1bd916(_0x35a7a7[_0x3deb('0x14')]['message']);}else{logger['info'](_0x3deb('0xf'),_0x30e03c,_0x3deb('0x10'));_0x1bd916(_0x35a7a7['result'][_0x3deb('0x16')]);}})['catch'](function(_0x8640cd){logger[_0x3deb('0x14')](_0x3deb('0xf'),_0x30e03c,_0x8640cd);_0x476998(_0x8640cd);});});}exports[_0x3deb('0x17')]=function(_0x3126d3){var _0x495faf=this;return new Promise(function(_0x17d57f,_0x5de5dc){return db[_0x3deb('0x18')][_0x3deb('0x19')](_0x3126d3['body'],{'raw':_0x3126d3['options']?_0x3126d3[_0x3deb('0x1a')][_0x3deb('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x44442e){logger[_0x3deb('0xe')](_0x3deb('0x17'),_0x3126d3);logger[_0x3deb('0x11')](_0x3deb('0x17'),_0x3126d3,JSON[_0x3deb('0x13')](_0x44442e));_0x17d57f(_0x44442e);})[_0x3deb('0x1c')](function(_0x296459){logger[_0x3deb('0x14')](_0x3deb('0x17'),_0x296459[_0x3deb('0x16')],_0x3126d3);_0x5de5dc(_0x495faf[_0x3deb('0x14')](0x1f4,_0x296459[_0x3deb('0x16')]));});});};exports[_0x3deb('0x1d')]=function(_0x191fc2){var _0x5dda3c=this;return new Promise(function(_0x271d8,_0x1135b0){return db['SmsQueueReport'][_0x3deb('0x1e')](_0x191fc2['body'],{'raw':_0x191fc2[_0x3deb('0x1a')]?_0x191fc2[_0x3deb('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x191fc2[_0x3deb('0x1a')]?_0x191fc2['options'][_0x3deb('0x1f')]||null:null,'attributes':_0x191fc2[_0x3deb('0x1a')]?_0x191fc2[_0x3deb('0x1a')][_0x3deb('0x20')]||null:null,'limit':_0x191fc2[_0x3deb('0x1a')]?_0x191fc2[_0x3deb('0x1a')]['limit']||null:null})['then'](function(_0x53c6f6){logger[_0x3deb('0xe')]('UpdateSmsQueueReport',_0x191fc2);logger['debug'](_0x3deb('0x1d'),_0x191fc2,JSON[_0x3deb('0x13')](_0x53c6f6));_0x271d8(_0x53c6f6);})['catch'](function(_0x2aa177){logger[_0x3deb('0x14')](_0x3deb('0x1d'),_0x2aa177[_0x3deb('0x16')],_0x191fc2);_0x1135b0(_0x5dda3c['error'](0x1f4,_0x2aa177['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 4701d79..103ea97 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 _0x7d9f=['isAuthenticated','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index','get'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x7d9f,0x15c));var _0xf7d9=function(_0xcb56d2,_0x18c194){_0xcb56d2=_0xcb56d2-0x0;var _0x57bed4=_0x7d9f[_0xcb56d2];return _0x57bed4;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/describe',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['get'](_0xf7d9('0xe'),auth['isAuthenticated'](),controller[_0xf7d9('0xf')]);router[_0xf7d9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf7d9('0x11')](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),controller['update']);router['delete'](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x12')]);module[_0xf7d9('0x13')]=router; \ No newline at end of file +var _0x2fed=['path','connect-timeout','express','fs-extra','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x31d118,_0xcd9f59){var _0x997903=function(_0x5cb43c){while(--_0x5cb43c){_0x31d118['push'](_0x31d118['shift']());}};_0x997903(++_0xcd9f59);}(_0x2fed,0x7c));var _0xd2fe=function(_0xcf676a,_0x16330a){_0xcf676a=_0xcf676a-0x0;var _0x58f7ba=_0x2fed[_0xcf676a];return _0x58f7ba;};'use strict';var multer=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var path=require(_0xd2fe('0x2'));var timeout=require(_0xd2fe('0x3'));var express=require(_0xd2fe('0x4'));var router=express['Router']();var fs_extra=require(_0xd2fe('0x5'));var auth=require(_0xd2fe('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd2fe('0x7'));router[_0xd2fe('0x8')]('/',auth[_0xd2fe('0x9')](),controller['index']);router[_0xd2fe('0x8')](_0xd2fe('0xa'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0xb')]);router['get'](_0xd2fe('0xc'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0xd')]);router[_0xd2fe('0xe')]('/',auth[_0xd2fe('0x9')](),controller[_0xd2fe('0xf')]);router[_0xd2fe('0x10')](_0xd2fe('0xc'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0x11')]);router[_0xd2fe('0x12')](_0xd2fe('0xc'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0x13')]);module[_0xd2fe('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 93a15e8..e09b8e2 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5562ee,_0x34876b){var _0x19d24e=function(_0x1aa944){while(--_0x1aa944){_0x5562ee['push'](_0x5562ee['shift']());}};_0x19d24e(++_0x34876b);}(_0x70e0,0x17b));var _0x070e=function(_0x4ea3e7,_0x2c59d4){_0x4ea3e7=_0x4ea3e7-0x0;var _0x2269eb=_0x70e0[_0x4ea3e7];return _0x2269eb;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x24e5f1,_0x25fa20){var _0x487d92=function(_0x3409af){while(--_0x3409af){_0x24e5f1['push'](_0x24e5f1['shift']());}};_0x487d92(++_0x25fa20);}(_0x70e0,0x17b));var _0x070e=function(_0x194e52,_0x2abe33){_0x194e52=_0x194e52-0x0;var _0x120c7c=_0x70e0[_0x194e52];return _0x120c7c;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 8a9746f..0a597e3 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 _0xeaf3=['fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','create','update','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','then','end','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes'];(function(_0x345b41,_0x56502f){var _0x20ca7e=function(_0x336530){while(--_0x336530){_0x345b41['push'](_0x345b41['shift']());}};_0x20ca7e(++_0x56502f);}(_0xeaf3,0x1cd));var _0x3eaf=function(_0xb2faaa,_0x4c913a){_0xb2faaa=_0xb2faaa-0x0;var _0x3b3602=_0xeaf3[_0xb2faaa];return _0x3b3602;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3eaf('0x0'));var jsonpatch=require(_0x3eaf('0x1'));var rp=require(_0x3eaf('0x2'));var moment=require(_0x3eaf('0x3'));var BPromise=require(_0x3eaf('0x4'));var Mustache=require('mustache');var util=require(_0x3eaf('0x5'));var path=require(_0x3eaf('0x6'));var sox=require(_0x3eaf('0x7'));var csv=require(_0x3eaf('0x8'));var ejs=require(_0x3eaf('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(_0x3eaf('0xa'));var deskjs=require(_0x3eaf('0xb'));var toCsv=require(_0x3eaf('0x8'));var querystring=require(_0x3eaf('0xc'));var Papa=require(_0x3eaf('0xd'));var Redis=require(_0x3eaf('0xe'));var authService=require(_0x3eaf('0xf'));var qs=require(_0x3eaf('0x10'));var as=require(_0x3eaf('0x11'));var hardwareService=require(_0x3eaf('0x12'));var logger=require(_0x3eaf('0x13'))(_0x3eaf('0x14'));var utils=require('../../config/utils');var config=require(_0x3eaf('0x15'));var licenseUtil=require(_0x3eaf('0x16'));var db=require(_0x3eaf('0x17'))['db'];function respondWithStatusCode(_0x384799,_0x8e9f10){_0x8e9f10=_0x8e9f10||0xcc;return function(_0x564e23){if(_0x564e23){return _0x384799[_0x3eaf('0x18')](_0x8e9f10);}return _0x384799['status'](_0x8e9f10)['end']();};}function respondWithResult(_0x96fd49,_0x4183a9){_0x4183a9=_0x4183a9||0xc8;return function(_0x55daa8){if(_0x55daa8){return _0x96fd49[_0x3eaf('0x19')](_0x4183a9)['json'](_0x55daa8);}};}function respondWithFilteredResult(_0x471329,_0x4cdb46){return function(_0x40aed4){if(_0x40aed4){var _0x4e6ccf=typeof _0x4cdb46[_0x3eaf('0x1a')]===_0x3eaf('0x1b')&&typeof _0x4cdb46[_0x3eaf('0x1c')]===_0x3eaf('0x1b');var _0x24f1e4=_0x40aed4[_0x3eaf('0x1d')];var _0x74297f=_0x4e6ccf?0x0:_0x4cdb46['offset'];var _0x1f5116=_0x4e6ccf?_0x40aed4[_0x3eaf('0x1d')]:_0x4cdb46[_0x3eaf('0x1a')]+_0x4cdb46[_0x3eaf('0x1c')];var _0xc630e6;if(_0x1f5116>=_0x24f1e4){_0x1f5116=_0x24f1e4;_0xc630e6=0xc8;}else{_0xc630e6=0xce;}_0x471329[_0x3eaf('0x19')](_0xc630e6);return _0x471329[_0x3eaf('0x1e')](_0x3eaf('0x1f'),_0x74297f+'-'+_0x1f5116+'/'+_0x24f1e4)[_0x3eaf('0x20')](_0x40aed4);}return null;};}function patchUpdates(_0x3aba68){return function(_0x1963e2){try{jsonpatch[_0x3eaf('0x21')](_0x1963e2,_0x3aba68,!![]);}catch(_0x5c17d7){return BPromise[_0x3eaf('0x22')](_0x5c17d7);}return _0x1963e2['save']();};}function saveUpdates(_0x52e943,_0x55d263){return function(_0x51986a){if(_0x51986a){return _0x51986a['update'](_0x52e943)['then'](function(_0x3d74d7){return _0x3d74d7;});}return null;};}function removeEntity(_0x83eb7a,_0x6e6fbd){return function(_0x3e8f98){if(_0x3e8f98){return _0x3e8f98[_0x3eaf('0x23')]()[_0x3eaf('0x24')](function(){_0x83eb7a['status'](0xcc)[_0x3eaf('0x25')]();});}};}function handleEntityNotFound(_0x37d59f,_0x533318){return function(_0x4af317){if(!_0x4af317){_0x37d59f[_0x3eaf('0x18')](0x194);}return _0x4af317;};}function handleError(_0x21a1b9,_0xea0baf){_0xea0baf=_0xea0baf||0x1f4;return function(_0x2cc0e2){logger['error'](_0x2cc0e2['stack']);if(_0x2cc0e2[_0x3eaf('0x26')]){delete _0x2cc0e2['name'];}_0x21a1b9[_0x3eaf('0x19')](_0xea0baf)['send'](_0x2cc0e2);};}exports[_0x3eaf('0x27')]=function(_0x160c36,_0x35a3c9){var _0x3202ae={},_0x1fe50b={},_0x5ed880={'count':0x0,'rows':[]};var _0x36f158=_[_0x3eaf('0x28')](db[_0x3eaf('0x29')][_0x3eaf('0x2a')],function(_0x13dfa8){return{'name':_0x13dfa8[_0x3eaf('0x2b')],'type':_0x13dfa8[_0x3eaf('0x2c')]['key']};});_0x1fe50b[_0x3eaf('0x2d')]=_[_0x3eaf('0x28')](_0x36f158,_0x3eaf('0x26'));_0x1fe50b[_0x3eaf('0x2e')]=_['keys'](_0x160c36[_0x3eaf('0x2e')]);_0x1fe50b[_0x3eaf('0x2f')]=_[_0x3eaf('0x30')](_0x1fe50b[_0x3eaf('0x2d')],_0x1fe50b[_0x3eaf('0x2e')]);_0x3202ae[_0x3eaf('0x31')]=_[_0x3eaf('0x30')](_0x1fe50b[_0x3eaf('0x2d')],qs[_0x3eaf('0x32')](_0x160c36['query'][_0x3eaf('0x32')]));_0x3202ae[_0x3eaf('0x31')]=_0x3202ae[_0x3eaf('0x31')][_0x3eaf('0x33')]?_0x3202ae[_0x3eaf('0x31')]:_0x1fe50b[_0x3eaf('0x2d')];if(!_0x160c36[_0x3eaf('0x2e')]['hasOwnProperty'](_0x3eaf('0x34'))){_0x3202ae[_0x3eaf('0x1c')]=qs[_0x3eaf('0x1c')](_0x160c36['query']['limit']);_0x3202ae[_0x3eaf('0x1a')]=qs[_0x3eaf('0x1a')](_0x160c36[_0x3eaf('0x2e')][_0x3eaf('0x1a')]);}_0x3202ae[_0x3eaf('0x35')]=qs[_0x3eaf('0x36')](_0x160c36[_0x3eaf('0x2e')]['sort']);_0x3202ae[_0x3eaf('0x37')]=qs[_0x3eaf('0x2f')](_[_0x3eaf('0x38')](_0x160c36[_0x3eaf('0x2e')],_0x1fe50b['filters']),_0x36f158);if(_0x160c36[_0x3eaf('0x2e')][_0x3eaf('0x39')]){_0x3202ae[_0x3eaf('0x37')]=_['merge'](_0x3202ae[_0x3eaf('0x37')],{'$or':_['map'](_0x36f158,function(_0x5d3a56){if(_0x5d3a56[_0x3eaf('0x2c')]!==_0x3eaf('0x3a')){var _0x1e4561={};_0x1e4561[_0x5d3a56[_0x3eaf('0x26')]]={'$like':'%'+_0x160c36['query'][_0x3eaf('0x39')]+'%'};return _0x1e4561;}})});}_0x3202ae=_[_0x3eaf('0x3b')]({},_0x3202ae,_0x160c36['options']);var _0x14ff2d={'where':_0x3202ae['where']};return db[_0x3eaf('0x29')][_0x3eaf('0x1d')](_0x14ff2d)[_0x3eaf('0x24')](function(_0x19e4f6){_0x5ed880[_0x3eaf('0x1d')]=_0x19e4f6;if(_0x160c36[_0x3eaf('0x2e')][_0x3eaf('0x3c')]){_0x3202ae[_0x3eaf('0x3d')]=[{'all':!![]}];}return db[_0x3eaf('0x29')][_0x3eaf('0x3e')](_0x3202ae);})['then'](function(_0x3e14fc){_0x5ed880[_0x3eaf('0x3f')]=_0x3e14fc;return _0x5ed880;})['then'](respondWithFilteredResult(_0x35a3c9,_0x3202ae))[_0x3eaf('0x40')](handleError(_0x35a3c9,null));};exports[_0x3eaf('0x41')]=function(_0x5b9a61,_0x3360c0){var _0x1f4b46={'raw':!![],'where':{'id':_0x5b9a61[_0x3eaf('0x42')]['id']}},_0x274d3b={};_0x274d3b['model']=_[_0x3eaf('0x43')](db[_0x3eaf('0x29')][_0x3eaf('0x2a')]);_0x274d3b['query']=_[_0x3eaf('0x43')](_0x5b9a61[_0x3eaf('0x2e')]);_0x274d3b[_0x3eaf('0x2f')]=_[_0x3eaf('0x30')](_0x274d3b[_0x3eaf('0x2d')],_0x274d3b['query']);_0x1f4b46[_0x3eaf('0x31')]=_[_0x3eaf('0x30')](_0x274d3b[_0x3eaf('0x2d')],qs[_0x3eaf('0x32')](_0x5b9a61[_0x3eaf('0x2e')][_0x3eaf('0x32')]));_0x1f4b46[_0x3eaf('0x31')]=_0x1f4b46[_0x3eaf('0x31')][_0x3eaf('0x33')]?_0x1f4b46[_0x3eaf('0x31')]:_0x274d3b[_0x3eaf('0x2d')];if(_0x5b9a61['query'][_0x3eaf('0x3c')]){_0x1f4b46[_0x3eaf('0x3d')]=[{'all':!![]}];}_0x1f4b46=_[_0x3eaf('0x3b')]({},_0x1f4b46,_0x5b9a61['options']);return db[_0x3eaf('0x29')][_0x3eaf('0x44')](_0x1f4b46)[_0x3eaf('0x24')](handleEntityNotFound(_0x3360c0,null))[_0x3eaf('0x24')](respondWithResult(_0x3360c0,null))['catch'](handleError(_0x3360c0,null));};exports[_0x3eaf('0x45')]=function(_0x46152c,_0x4e30de){return db[_0x3eaf('0x29')]['create'](_0x46152c['body'],{})[_0x3eaf('0x24')](respondWithResult(_0x4e30de,0xc9))[_0x3eaf('0x40')](handleError(_0x4e30de,null));};exports[_0x3eaf('0x46')]=function(_0x535d10,_0x156e0d){if(_0x535d10[_0x3eaf('0x47')]['id']){delete _0x535d10[_0x3eaf('0x47')]['id'];}return db[_0x3eaf('0x29')][_0x3eaf('0x44')]({'where':{'id':_0x535d10[_0x3eaf('0x42')]['id']}})[_0x3eaf('0x24')](handleEntityNotFound(_0x156e0d,null))[_0x3eaf('0x24')](saveUpdates(_0x535d10['body'],null))[_0x3eaf('0x24')](respondWithResult(_0x156e0d,null))['catch'](handleError(_0x156e0d,null));};exports[_0x3eaf('0x23')]=function(_0x21f6a7,_0x4fdf38){return db[_0x3eaf('0x29')][_0x3eaf('0x44')]({'where':{'id':_0x21f6a7[_0x3eaf('0x42')]['id']}})[_0x3eaf('0x24')](handleEntityNotFound(_0x4fdf38,null))[_0x3eaf('0x24')](removeEntity(_0x4fdf38,null))['catch'](handleError(_0x4fdf38,null));};exports[_0x3eaf('0x48')]=function(_0x52e944,_0x5b1bae){return db[_0x3eaf('0x29')][_0x3eaf('0x48')]()[_0x3eaf('0x24')](respondWithResult(_0x5b1bae,null))[_0x3eaf('0x40')](handleError(_0x5b1bae,null));}; \ No newline at end of file +var _0x48ed=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','rows','catch','params','rawAttributes','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','SmsTransferReport','fieldName','model','query','keys','filters'];(function(_0x5411cb,_0x1cd69d){var _0x32727a=function(_0x22a762){while(--_0x22a762){_0x5411cb['push'](_0x5411cb['shift']());}};_0x32727a(++_0x1cd69d);}(_0x48ed,0xec));var _0xd48e=function(_0x5d4db8,_0x4ad01b){_0x5d4db8=_0x5d4db8-0x0;var _0x415548=_0x48ed[_0x5d4db8];return _0x415548;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd48e('0x0'));var jsonpatch=require(_0xd48e('0x1'));var rp=require(_0xd48e('0x2'));var moment=require(_0xd48e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd48e('0x4'));var util=require(_0xd48e('0x5'));var path=require(_0xd48e('0x6'));var sox=require('sox');var csv=require(_0xd48e('0x7'));var ejs=require(_0xd48e('0x8'));var fs=require('fs');var fs_extra=require(_0xd48e('0x9'));var _=require(_0xd48e('0xa'));var squel=require('squel');var crypto=require(_0xd48e('0xb'));var jsforce=require(_0xd48e('0xc'));var deskjs=require(_0xd48e('0xd'));var toCsv=require(_0xd48e('0x7'));var querystring=require(_0xd48e('0xe'));var Papa=require(_0xd48e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd48e('0x10'));var hardwareService=require(_0xd48e('0x11'));var logger=require(_0xd48e('0x12'))('api');var utils=require(_0xd48e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd48e('0x14'));var db=require(_0xd48e('0x15'))['db'];function respondWithStatusCode(_0x287c09,_0x445486){_0x445486=_0x445486||0xcc;return function(_0x2d13ea){if(_0x2d13ea){return _0x287c09[_0xd48e('0x16')](_0x445486);}return _0x287c09['status'](_0x445486)[_0xd48e('0x17')]();};}function respondWithResult(_0x1388bd,_0x219935){_0x219935=_0x219935||0xc8;return function(_0x59e68a){if(_0x59e68a){return _0x1388bd[_0xd48e('0x18')](_0x219935)[_0xd48e('0x19')](_0x59e68a);}};}function respondWithFilteredResult(_0x1c108a,_0x3a3e23){return function(_0x43df1a){if(_0x43df1a){var _0x543c33=typeof _0x3a3e23['offset']===_0xd48e('0x1a')&&typeof _0x3a3e23[_0xd48e('0x1b')]===_0xd48e('0x1a');var _0x47cf25=_0x43df1a['count'];var _0x1b8774=_0x543c33?0x0:_0x3a3e23[_0xd48e('0x1c')];var _0x165af4=_0x543c33?_0x43df1a[_0xd48e('0x1d')]:_0x3a3e23[_0xd48e('0x1c')]+_0x3a3e23[_0xd48e('0x1b')];var _0x3b3fac;if(_0x165af4>=_0x47cf25){_0x165af4=_0x47cf25;_0x3b3fac=0xc8;}else{_0x3b3fac=0xce;}_0x1c108a[_0xd48e('0x18')](_0x3b3fac);return _0x1c108a[_0xd48e('0x1e')]('Content-Range',_0x1b8774+'-'+_0x165af4+'/'+_0x47cf25)[_0xd48e('0x19')](_0x43df1a);}return null;};}function patchUpdates(_0x469fb0){return function(_0x57c0d6){try{jsonpatch[_0xd48e('0x1f')](_0x57c0d6,_0x469fb0,!![]);}catch(_0x2b7332){return BPromise[_0xd48e('0x20')](_0x2b7332);}return _0x57c0d6['save']();};}function saveUpdates(_0x116949,_0x52be28){return function(_0x36f59e){if(_0x36f59e){return _0x36f59e[_0xd48e('0x21')](_0x116949)['then'](function(_0x4409a8){return _0x4409a8;});}return null;};}function removeEntity(_0x256cfb,_0x237f60){return function(_0x21a342){if(_0x21a342){return _0x21a342[_0xd48e('0x22')]()[_0xd48e('0x23')](function(){_0x256cfb[_0xd48e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3919ff,_0x54e34c){return function(_0x24d413){if(!_0x24d413){_0x3919ff[_0xd48e('0x16')](0x194);}return _0x24d413;};}function handleError(_0x9de663,_0x9c87d6){_0x9c87d6=_0x9c87d6||0x1f4;return function(_0xa69c27){logger[_0xd48e('0x24')](_0xa69c27[_0xd48e('0x25')]);if(_0xa69c27[_0xd48e('0x26')]){delete _0xa69c27[_0xd48e('0x26')];}_0x9de663[_0xd48e('0x18')](_0x9c87d6)[_0xd48e('0x27')](_0xa69c27);};}exports[_0xd48e('0x28')]=function(_0x1661af,_0x298b1c){var _0x2de33e={},_0x52446e={},_0x1c2a1d={'count':0x0,'rows':[]};var _0x3eee96=_[_0xd48e('0x29')](db[_0xd48e('0x2a')]['rawAttributes'],function(_0x20671f){return{'name':_0x20671f[_0xd48e('0x2b')],'type':_0x20671f['type']['key']};});_0x52446e[_0xd48e('0x2c')]=_[_0xd48e('0x29')](_0x3eee96,'name');_0x52446e[_0xd48e('0x2d')]=_[_0xd48e('0x2e')](_0x1661af[_0xd48e('0x2d')]);_0x52446e[_0xd48e('0x2f')]=_[_0xd48e('0x30')](_0x52446e['model'],_0x52446e[_0xd48e('0x2d')]);_0x2de33e[_0xd48e('0x31')]=_[_0xd48e('0x30')](_0x52446e[_0xd48e('0x2c')],qs[_0xd48e('0x32')](_0x1661af['query']['fields']));_0x2de33e[_0xd48e('0x31')]=_0x2de33e[_0xd48e('0x31')][_0xd48e('0x33')]?_0x2de33e[_0xd48e('0x31')]:_0x52446e[_0xd48e('0x2c')];if(!_0x1661af[_0xd48e('0x2d')][_0xd48e('0x34')](_0xd48e('0x35'))){_0x2de33e[_0xd48e('0x1b')]=qs[_0xd48e('0x1b')](_0x1661af[_0xd48e('0x2d')][_0xd48e('0x1b')]);_0x2de33e[_0xd48e('0x1c')]=qs[_0xd48e('0x1c')](_0x1661af[_0xd48e('0x2d')][_0xd48e('0x1c')]);}_0x2de33e[_0xd48e('0x36')]=qs[_0xd48e('0x37')](_0x1661af[_0xd48e('0x2d')][_0xd48e('0x37')]);_0x2de33e[_0xd48e('0x38')]=qs[_0xd48e('0x2f')](_[_0xd48e('0x39')](_0x1661af[_0xd48e('0x2d')],_0x52446e[_0xd48e('0x2f')]),_0x3eee96);if(_0x1661af[_0xd48e('0x2d')][_0xd48e('0x3a')]){_0x2de33e['where']=_[_0xd48e('0x3b')](_0x2de33e[_0xd48e('0x38')],{'$or':_[_0xd48e('0x29')](_0x3eee96,function(_0x1d1cfc){if(_0x1d1cfc[_0xd48e('0x3c')]!==_0xd48e('0x3d')){var _0x1db7c5={};_0x1db7c5[_0x1d1cfc[_0xd48e('0x26')]]={'$like':'%'+_0x1661af[_0xd48e('0x2d')][_0xd48e('0x3a')]+'%'};return _0x1db7c5;}})});}_0x2de33e=_[_0xd48e('0x3b')]({},_0x2de33e,_0x1661af['options']);var _0x192ab5={'where':_0x2de33e[_0xd48e('0x38')]};return db[_0xd48e('0x2a')][_0xd48e('0x1d')](_0x192ab5)[_0xd48e('0x23')](function(_0x44a12c){_0x1c2a1d[_0xd48e('0x1d')]=_0x44a12c;if(_0x1661af[_0xd48e('0x2d')]['includeAll']){_0x2de33e[_0xd48e('0x3e')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x2de33e);})[_0xd48e('0x23')](function(_0xf50d29){_0x1c2a1d[_0xd48e('0x3f')]=_0xf50d29;return _0x1c2a1d;})[_0xd48e('0x23')](respondWithFilteredResult(_0x298b1c,_0x2de33e))[_0xd48e('0x40')](handleError(_0x298b1c,null));};exports['show']=function(_0x24318e,_0x309b42){var _0x4ad395={'raw':!![],'where':{'id':_0x24318e[_0xd48e('0x41')]['id']}},_0x5c520f={};_0x5c520f['model']=_['keys'](db['SmsTransferReport'][_0xd48e('0x42')]);_0x5c520f['query']=_[_0xd48e('0x2e')](_0x24318e[_0xd48e('0x2d')]);_0x5c520f[_0xd48e('0x2f')]=_[_0xd48e('0x30')](_0x5c520f[_0xd48e('0x2c')],_0x5c520f[_0xd48e('0x2d')]);_0x4ad395[_0xd48e('0x31')]=_[_0xd48e('0x30')](_0x5c520f['model'],qs[_0xd48e('0x32')](_0x24318e[_0xd48e('0x2d')][_0xd48e('0x32')]));_0x4ad395['attributes']=_0x4ad395[_0xd48e('0x31')]['length']?_0x4ad395[_0xd48e('0x31')]:_0x5c520f[_0xd48e('0x2c')];if(_0x24318e[_0xd48e('0x2d')]['includeAll']){_0x4ad395[_0xd48e('0x3e')]=[{'all':!![]}];}_0x4ad395=_['merge']({},_0x4ad395,_0x24318e['options']);return db['SmsTransferReport']['find'](_0x4ad395)[_0xd48e('0x23')](handleEntityNotFound(_0x309b42,null))[_0xd48e('0x23')](respondWithResult(_0x309b42,null))[_0xd48e('0x40')](handleError(_0x309b42,null));};exports[_0xd48e('0x43')]=function(_0x1b9b76,_0x564e9d){return db['SmsTransferReport'][_0xd48e('0x43')](_0x1b9b76[_0xd48e('0x44')],{})[_0xd48e('0x23')](respondWithResult(_0x564e9d,0xc9))[_0xd48e('0x40')](handleError(_0x564e9d,null));};exports[_0xd48e('0x21')]=function(_0x304677,_0x5de907){if(_0x304677[_0xd48e('0x44')]['id']){delete _0x304677[_0xd48e('0x44')]['id'];}return db[_0xd48e('0x2a')][_0xd48e('0x45')]({'where':{'id':_0x304677[_0xd48e('0x41')]['id']}})[_0xd48e('0x23')](handleEntityNotFound(_0x5de907,null))[_0xd48e('0x23')](saveUpdates(_0x304677[_0xd48e('0x44')],null))[_0xd48e('0x23')](respondWithResult(_0x5de907,null))['catch'](handleError(_0x5de907,null));};exports[_0xd48e('0x22')]=function(_0x363649,_0x2f013d){return db['SmsTransferReport'][_0xd48e('0x45')]({'where':{'id':_0x363649[_0xd48e('0x41')]['id']}})[_0xd48e('0x23')](handleEntityNotFound(_0x2f013d,null))[_0xd48e('0x23')](removeEntity(_0x2f013d,null))[_0xd48e('0x40')](handleError(_0x2f013d,null));};exports[_0xd48e('0x46')]=function(_0x6b1849,_0xfadcf7){return db[_0xd48e('0x2a')][_0xd48e('0x46')]()[_0xd48e('0x23')](respondWithResult(_0xfadcf7,null))[_0xd48e('0x40')](handleError(_0xfadcf7,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 85cbbe6..37bccdf 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 _0x9ff4=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','api'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0x9ff4,0x196));var _0x49ff=function(_0x13e657,_0x5a0279){_0x13e657=_0x13e657-0x0;var _0x1a08a0=_0x9ff4[_0x13e657];return _0x1a08a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x49ff('0x0'));var moment=require(_0x49ff('0x1'));var BPromise=require(_0x49ff('0x2'));var rp=require(_0x49ff('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49ff('0x4'));var config=require(_0x49ff('0x5'));var attributes=require(_0x49ff('0x6'));module[_0x49ff('0x7')]=function(_0x153755,_0x22febd){return _0x153755[_0x49ff('0x8')](_0x49ff('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x49ff('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda9d=['uniqueid','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','SmsTransferReport','report_sms_transfer'];(function(_0x3c3b0d,_0x4bdcd4){var _0x40108f=function(_0x172578){while(--_0x172578){_0x3c3b0d['push'](_0x3c3b0d['shift']());}};_0x40108f(++_0x4bdcd4);}(_0xda9d,0x85));var _0xdda9=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xda9d[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0xdda9('0x0'));var logger=require(_0xdda9('0x1'))(_0xdda9('0x2'));var moment=require(_0xdda9('0x3'));var BPromise=require(_0xdda9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdda9('0x5'));var rimraf=require('rimraf');var config=require(_0xdda9('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0xdda9('0x7')]=function(_0x5f5095,_0x4d5166){return _0x5f5095['define'](_0xdda9('0x8'),attributes,{'tableName':_0xdda9('0x9'),'paranoid':![],'indexes':[{'name':_0xdda9('0xa'),'fields':[_0xdda9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3626eb4..9b0971f 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 _0x9d92=['info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsTransferReport,\x20%s,\x20%s','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9d92,0xdf));var _0x29d9=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x9d92[_0x2850c0];return _0x21e830;};'use strict';var _=require(_0x29d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x29d9('0x1'));var rs=require(_0x29d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29d9('0x3'))['db'];var utils=require(_0x29d9('0x4'));var logger=require(_0x29d9('0x5'))(_0x29d9('0x6'));var config=require(_0x29d9('0x7'));var jayson=require(_0x29d9('0x8'));var client=jayson[_0x29d9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x209595,_0x2f6ac2,_0x392265){return new BPromise(function(_0x5aeb53,_0x26cd90){return client[_0x29d9('0xa')](_0x209595,_0x392265)[_0x29d9('0xb')](function(_0x55b0a5){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x2f6ac2,'request\x20sent');logger[_0x29d9('0xc')](_0x29d9('0xd'),_0x2f6ac2,_0x29d9('0xe'),JSON['stringify'](_0x55b0a5));if(_0x55b0a5[_0x29d9('0xf')]){if(_0x55b0a5[_0x29d9('0xf')][_0x29d9('0x10')]===0x1f4){logger[_0x29d9('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x2f6ac2,_0x55b0a5[_0x29d9('0xf')]['message']);return _0x26cd90(_0x55b0a5['error']['message']);}logger[_0x29d9('0xf')](_0x29d9('0x11'),_0x2f6ac2,_0x55b0a5[_0x29d9('0xf')][_0x29d9('0x12')]);return _0x5aeb53(_0x55b0a5['error'][_0x29d9('0x12')]);}else{logger[_0x29d9('0x13')](_0x29d9('0x11'),_0x2f6ac2,_0x29d9('0xe'));_0x5aeb53(_0x55b0a5[_0x29d9('0x14')][_0x29d9('0x12')]);}})[_0x29d9('0x15')](function(_0x327c5f){logger[_0x29d9('0xf')](_0x29d9('0x11'),_0x2f6ac2,_0x327c5f);_0x26cd90(_0x327c5f);});});} \ No newline at end of file +var _0x29d4=['request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s'];(function(_0x4ca144,_0x3c1c5a){var _0x4be9a7=function(_0x17a4a2){while(--_0x17a4a2){_0x4ca144['push'](_0x4ca144['shift']());}};_0x4be9a7(++_0x3c1c5a);}(_0x29d4,0x1a1));var _0x429d=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x29d4[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var moment=require(_0x429d('0x1'));var BPromise=require(_0x429d('0x2'));var rs=require(_0x429d('0x3'));var fs=require('fs');var Redis=require(_0x429d('0x4'));var db=require(_0x429d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x429d('0x6'))(_0x429d('0x7'));var config=require(_0x429d('0x8'));var jayson=require(_0x429d('0x9'));var client=jayson[_0x429d('0xa')][_0x429d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56aa2f,_0x1ede3f,_0x4befb9){return new BPromise(function(_0x9fc337,_0x47cb29){return client[_0x429d('0xc')](_0x56aa2f,_0x4befb9)[_0x429d('0xd')](function(_0xe6f5b4){logger['info'](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));logger['debug'](_0x429d('0x10'),_0x1ede3f,_0x429d('0xf'),JSON[_0x429d('0x11')](_0xe6f5b4));if(_0xe6f5b4['error']){if(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x13')]===0x1f4){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4['error'][_0x429d('0x14')]);return _0x47cb29(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}logger['error'](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4[_0x429d('0x12')]['message']);return _0x9fc337(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}else{logger[_0x429d('0x15')](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));_0x9fc337(_0xe6f5b4[_0x429d('0x16')]['message']);}})[_0x429d('0x17')](function(_0x53d19d){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0x53d19d);_0x47cb29(_0x53d19d);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 15e34a8..75b04aa 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 _0xe5cf=['now','extname','file','create','put','/:id','update','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','show','/:id/download','isAuthenticated','download','diskStorage','join','root','originalname','replace','format','%s-%s%s'];(function(_0xc8a266,_0x1d5932){var _0x289b0f=function(_0x4eba24){while(--_0x4eba24){_0xc8a266['push'](_0xc8a266['shift']());}};_0x289b0f(++_0x1d5932);}(_0xe5cf,0x164));var _0xfe5c=function(_0x1d9c05,_0x54e8b){_0x1d9c05=_0x1d9c05-0x0;var _0x48f471=_0xe5cf[_0x1d9c05];return _0x48f471;};'use strict';var multer=require('multer');var util=require(_0xfe5c('0x0'));var path=require('path');var timeout=require(_0xfe5c('0x1'));var express=require(_0xfe5c('0x2'));var router=express[_0xfe5c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfe5c('0x4'));var interaction=require(_0xfe5c('0x5'));var config=require(_0xfe5c('0x6'));var controller=require(_0xfe5c('0x7'));router[_0xfe5c('0x8')]('/',auth['isAuthenticated'](),controller[_0xfe5c('0x9')]);router[_0xfe5c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xfe5c('0xa')]);router[_0xfe5c('0x8')](_0xfe5c('0xb'),auth[_0xfe5c('0xc')](),controller[_0xfe5c('0xd')]);var upload=multer({'storage':multer[_0xfe5c('0xe')]({'destination':function(_0x3ed7ca,_0x1c36a5,_0x28fcad){_0x28fcad(null,path[_0xfe5c('0xf')](config[_0xfe5c('0x10')],'server/files/sounds/original/'));},'filename':function(_0x19b4ba,_0x4c6777,_0x53b2ea){_0x4c6777[_0xfe5c('0x11')]=_0x4c6777[_0xfe5c('0x11')][_0xfe5c('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53b2ea(null,util[_0xfe5c('0x13')](_0xfe5c('0x14'),path['basename'](_0x4c6777['originalname'],path['extname'](_0x4c6777[_0xfe5c('0x11')])),Date[_0xfe5c('0x15')](),path[_0xfe5c('0x16')](_0x4c6777[_0xfe5c('0x11')])));}})});router['post']('/',upload['single'](_0xfe5c('0x17')),controller[_0xfe5c('0x18')]);router[_0xfe5c('0x19')](_0xfe5c('0x1a'),auth[_0xfe5c('0xc')](),controller[_0xfe5c('0x1b')]);router['delete'](_0xfe5c('0x1a'),auth[_0xfe5c('0xc')](),controller['delete']);module[_0xfe5c('0x1c')]=router; \ No newline at end of file +var _0xb6ec=['/:id','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','single','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x8c510d,_0x42f46f){var _0x120eb8=function(_0x108b59){while(--_0x108b59){_0x8c510d['push'](_0x8c510d['shift']());}};_0x120eb8(++_0x42f46f);}(_0xb6ec,0xe8));var _0xcb6e=function(_0x5979ba,_0x4c55aa){_0x5979ba=_0x5979ba-0x0;var _0x164ba6=_0xb6ec[_0x5979ba];return _0x164ba6;};'use strict';var multer=require('multer');var util=require(_0xcb6e('0x0'));var path=require(_0xcb6e('0x1'));var timeout=require(_0xcb6e('0x2'));var express=require(_0xcb6e('0x3'));var router=express['Router']();var fs_extra=require(_0xcb6e('0x4'));var auth=require(_0xcb6e('0x5'));var interaction=require(_0xcb6e('0x6'));var config=require(_0xcb6e('0x7'));var controller=require('./sound.controller');router[_0xcb6e('0x8')]('/',auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xa')]);router[_0xcb6e('0x8')](_0xcb6e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xcb6e('0x8')](_0xcb6e('0xc'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1414d6,_0x150189,_0x35b359){_0x35b359(null,path[_0xcb6e('0xe')](config[_0xcb6e('0xf')],_0xcb6e('0x10')));},'filename':function(_0x527045,_0x4b9c2a,_0x2f4933){_0x4b9c2a['originalname']=_0x4b9c2a[_0xcb6e('0x11')][_0xcb6e('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f4933(null,util['format'](_0xcb6e('0x13'),path[_0xcb6e('0x14')](_0x4b9c2a[_0xcb6e('0x11')],path[_0xcb6e('0x15')](_0x4b9c2a['originalname'])),Date[_0xcb6e('0x16')](),path['extname'](_0x4b9c2a['originalname'])));}})});router[_0xcb6e('0x17')]('/',upload[_0xcb6e('0x18')]('file'),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcb6e('0x19')](_0xcb6e('0xb'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0x19')]);module[_0xcb6e('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 ab8feb4..f85fefc 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 _0x4633=['INTEGER','BIGINT','sequelize','exports','STRING','FLOAT'];(function(_0x3bf2d5,_0x36116c){var _0x29e958=function(_0x18ba76){while(--_0x18ba76){_0x3bf2d5['push'](_0x3bf2d5['shift']());}};_0x29e958(++_0x36116c);}(_0x4633,0x68));var _0x3463=function(_0x29c917,_0x296875){_0x29c917=_0x29c917-0x0;var _0x24301e=_0x4633[_0x29c917];return _0x24301e;};'use strict';var Sequelize=require(_0x3463('0x0'));module[_0x3463('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x3463('0x2')]},'display_name':{'type':Sequelize[_0x3463('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x3463('0x2')]},'original_format':{'type':Sequelize[_0x3463('0x2')]},'original_duration':{'type':Sequelize[_0x3463('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x3463('0x4')]},'original_bitRate':{'type':Sequelize[_0x3463('0x5')]},'original_sampleRate':{'type':Sequelize[_0x3463('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x3463('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x3463('0x5')]},'converted_channelCount':{'type':Sequelize[_0x3463('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x3463('0x4')]}}; \ No newline at end of file +var _0x95ac=['INTEGER','sequelize','STRING','name','FLOAT','BIGINT'];(function(_0x210ccc,_0x18a85a){var _0x334164=function(_0x2fd28a){while(--_0x2fd28a){_0x210ccc['push'](_0x210ccc['shift']());}};_0x334164(++_0x18a85a);}(_0x95ac,0xd3));var _0xc95a=function(_0x47c3c1,_0x487e8c){_0x47c3c1=_0x47c3c1-0x0;var _0x359316=_0x95ac[_0x47c3c1];return _0x359316;};'use strict';var Sequelize=require(_0xc95a('0x0'));module['exports']={'name':{'type':Sequelize[_0xc95a('0x1')],'unique':_0xc95a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc95a('0x1')]},'display_name':{'type':Sequelize[_0xc95a('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xc95a('0x1')]},'original_format':{'type':Sequelize[_0xc95a('0x1')]},'original_duration':{'type':Sequelize[_0xc95a('0x3')]},'original_sampleCount':{'type':Sequelize[_0xc95a('0x4')]},'original_channelCount':{'type':Sequelize[_0xc95a('0x5')]},'original_bitRate':{'type':Sequelize[_0xc95a('0x4')]},'original_sampleRate':{'type':Sequelize[_0xc95a('0x5')]},'converted_format':{'type':Sequelize[_0xc95a('0x1')]},'converted_duration':{'type':Sequelize[_0xc95a('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xc95a('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xc95a('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 5d75e4a..34a6165 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 _0x3115=['offset','undefined','limit','count','set','reject','save','update','then','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','include','findAll','catch','show','params','intersection','options','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','download','join','%s.%s','basename','file','originalname','extname','filename','substring','server/files/sounds/original','format','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','destroy','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x5ec251,_0x4b6f6f){var _0x5c1561=function(_0x2bb102){while(--_0x2bb102){_0x5ec251['push'](_0x5ec251['shift']());}};_0x5c1561(++_0x4b6f6f);}(_0x3115,0x64));var _0x5311=function(_0x554611,_0x11ced4){_0x554611=_0x554611-0x0;var _0x4fbc11=_0x3115[_0x554611];return _0x4fbc11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5311('0x0'));var zipdir=require(_0x5311('0x1'));var jsonpatch=require(_0x5311('0x2'));var rp=require(_0x5311('0x3'));var moment=require(_0x5311('0x4'));var BPromise=require(_0x5311('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5311('0x6'));var sox=require(_0x5311('0x7'));var csv=require(_0x5311('0x8'));var ejs=require(_0x5311('0x9'));var fs=require('fs');var fs_extra=require(_0x5311('0xa'));var _=require(_0x5311('0xb'));var squel=require(_0x5311('0xc'));var crypto=require(_0x5311('0xd'));var jsforce=require(_0x5311('0xe'));var deskjs=require(_0x5311('0xf'));var toCsv=require(_0x5311('0x8'));var querystring=require(_0x5311('0x10'));var Papa=require('papaparse');var Redis=require(_0x5311('0x11'));var authService=require(_0x5311('0x12'));var qs=require(_0x5311('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5311('0x14'));var logger=require('../../config/logger')(_0x5311('0x15'));var utils=require('../../config/utils');var config=require(_0x5311('0x16'));var licenseUtil=require(_0x5311('0x17'));var db=require(_0x5311('0x18'))['db'];function respondWithStatusCode(_0x59113b,_0x51f0d3){_0x51f0d3=_0x51f0d3||0xcc;return function(_0x11a7b){if(_0x11a7b){return _0x59113b[_0x5311('0x19')](_0x51f0d3);}return _0x59113b['status'](_0x51f0d3)[_0x5311('0x1a')]();};}function respondWithResult(_0x560267,_0x4afd00){_0x4afd00=_0x4afd00||0xc8;return function(_0x2c0c3a){if(_0x2c0c3a){return _0x560267[_0x5311('0x1b')](_0x4afd00)[_0x5311('0x1c')](_0x2c0c3a);}};}function respondWithFilteredResult(_0x49bec6,_0x64c863){return function(_0x15bfa9){if(_0x15bfa9){var _0x4b29a1=typeof _0x64c863[_0x5311('0x1d')]===_0x5311('0x1e')&&typeof _0x64c863[_0x5311('0x1f')]===_0x5311('0x1e');var _0x29f119=_0x15bfa9[_0x5311('0x20')];var _0x272b1d=_0x4b29a1?0x0:_0x64c863[_0x5311('0x1d')];var _0x10b749=_0x4b29a1?_0x15bfa9['count']:_0x64c863[_0x5311('0x1d')]+_0x64c863[_0x5311('0x1f')];var _0x247b88;if(_0x10b749>=_0x29f119){_0x10b749=_0x29f119;_0x247b88=0xc8;}else{_0x247b88=0xce;}_0x49bec6[_0x5311('0x1b')](_0x247b88);return _0x49bec6[_0x5311('0x21')]('Content-Range',_0x272b1d+'-'+_0x10b749+'/'+_0x29f119)['json'](_0x15bfa9);}return null;};}function patchUpdates(_0x3bd988){return function(_0x190e0d){try{jsonpatch['apply'](_0x190e0d,_0x3bd988,!![]);}catch(_0x1fe290){return BPromise[_0x5311('0x22')](_0x1fe290);}return _0x190e0d[_0x5311('0x23')]();};}function saveUpdates(_0x1149f6,_0x17e93b){return function(_0x4df02b){if(_0x4df02b){return _0x4df02b[_0x5311('0x24')](_0x1149f6)[_0x5311('0x25')](function(_0x52ab8f){return _0x52ab8f;});}return null;};}function removeEntity(_0x1839d1,_0x21aeab){return function(_0x55e033){if(_0x55e033){return _0x55e033['destroy']()[_0x5311('0x25')](function(){var _0x937461=_0x55e033['get']({'plain':!![]});var _0x276b0f=_0x5311('0x26');return db[_0x5311('0x27')]['destroy']({'where':{'type':_0x276b0f,'resourceId':_0x937461['id']}})[_0x5311('0x25')](function(){return _0x55e033;});})['then'](function(){_0x1839d1['status'](0xcc)[_0x5311('0x1a')]();});}};}function handleEntityNotFound(_0xb45c20,_0x2951fd){return function(_0xbdfc22){if(!_0xbdfc22){_0xb45c20[_0x5311('0x19')](0x194);}return _0xbdfc22;};}function handleError(_0x294432,_0x36cfbf){_0x36cfbf=_0x36cfbf||0x1f4;return function(_0x3dd772){logger[_0x5311('0x28')](_0x3dd772[_0x5311('0x29')]);if(_0x3dd772[_0x5311('0x2a')]){delete _0x3dd772[_0x5311('0x2a')];}_0x294432['status'](_0x36cfbf)[_0x5311('0x2b')](_0x3dd772);};}exports[_0x5311('0x2c')]=function(_0x258630,_0x205eea){var _0x597813={},_0x3eb0f9={},_0x53c8d0={'count':0x0,'rows':[]};var _0x4aef27=_[_0x5311('0x2d')](db[_0x5311('0x2e')]['rawAttributes'],function(_0x151185){return{'name':_0x151185[_0x5311('0x2f')],'type':_0x151185[_0x5311('0x30')][_0x5311('0x31')]};});_0x3eb0f9[_0x5311('0x32')]=_[_0x5311('0x2d')](_0x4aef27,_0x5311('0x2a'));_0x3eb0f9[_0x5311('0x33')]=_[_0x5311('0x34')](_0x258630[_0x5311('0x33')]);_0x3eb0f9[_0x5311('0x35')]=_['intersection'](_0x3eb0f9[_0x5311('0x32')],_0x3eb0f9['query']);_0x597813[_0x5311('0x36')]=_['intersection'](_0x3eb0f9[_0x5311('0x32')],qs[_0x5311('0x37')](_0x258630[_0x5311('0x33')][_0x5311('0x37')]));_0x597813[_0x5311('0x36')]=_0x597813[_0x5311('0x36')][_0x5311('0x38')]?_0x597813[_0x5311('0x36')]:_0x3eb0f9[_0x5311('0x32')];if(!_0x258630[_0x5311('0x33')][_0x5311('0x39')](_0x5311('0x3a'))){_0x597813['limit']=qs[_0x5311('0x1f')](_0x258630['query'][_0x5311('0x1f')]);_0x597813[_0x5311('0x1d')]=qs[_0x5311('0x1d')](_0x258630['query'][_0x5311('0x1d')]);}_0x597813[_0x5311('0x3b')]=qs[_0x5311('0x3c')](_0x258630['query'][_0x5311('0x3c')]);_0x597813[_0x5311('0x3d')]=qs[_0x5311('0x35')](_['pick'](_0x258630[_0x5311('0x33')],_0x3eb0f9[_0x5311('0x35')]),_0x4aef27);if(_0x258630[_0x5311('0x33')]['filter']){_0x597813['where']=_[_0x5311('0x3e')](_0x597813[_0x5311('0x3d')],{'$or':_[_0x5311('0x2d')](_0x4aef27,function(_0x17cf4d){if(_0x17cf4d[_0x5311('0x30')]!=='VIRTUAL'){var _0xdb1b13={};_0xdb1b13[_0x17cf4d[_0x5311('0x2a')]]={'$like':'%'+_0x258630[_0x5311('0x33')][_0x5311('0x3f')]+'%'};return _0xdb1b13;}})});}_0x597813=_[_0x5311('0x3e')]({},_0x597813,_0x258630['options']);var _0x3cd228={'where':_0x597813[_0x5311('0x3d')]};return db[_0x5311('0x2e')][_0x5311('0x20')](_0x3cd228)[_0x5311('0x25')](function(_0x3859e9){_0x53c8d0[_0x5311('0x20')]=_0x3859e9;if(_0x258630[_0x5311('0x33')][_0x5311('0x40')]){_0x597813[_0x5311('0x41')]=[{'all':!![]}];}return db[_0x5311('0x2e')][_0x5311('0x42')](_0x597813);})[_0x5311('0x25')](function(_0x5bd726){_0x53c8d0['rows']=_0x5bd726;return _0x53c8d0;})[_0x5311('0x25')](respondWithFilteredResult(_0x205eea,_0x597813))[_0x5311('0x43')](handleError(_0x205eea,null));};exports[_0x5311('0x44')]=function(_0x12cb55,_0x20f190){var _0x316aa2={'raw':!![],'where':{'id':_0x12cb55[_0x5311('0x45')]['id']}},_0x9d8a85={};_0x9d8a85[_0x5311('0x32')]=_[_0x5311('0x34')](db[_0x5311('0x2e')]['rawAttributes']);_0x9d8a85[_0x5311('0x33')]=_[_0x5311('0x34')](_0x12cb55[_0x5311('0x33')]);_0x9d8a85[_0x5311('0x35')]=_[_0x5311('0x46')](_0x9d8a85[_0x5311('0x32')],_0x9d8a85['query']);_0x316aa2[_0x5311('0x36')]=_[_0x5311('0x46')](_0x9d8a85[_0x5311('0x32')],qs[_0x5311('0x37')](_0x12cb55['query'][_0x5311('0x37')]));_0x316aa2[_0x5311('0x36')]=_0x316aa2[_0x5311('0x36')][_0x5311('0x38')]?_0x316aa2[_0x5311('0x36')]:_0x9d8a85[_0x5311('0x32')];if(_0x12cb55['query'][_0x5311('0x40')]){_0x316aa2[_0x5311('0x41')]=[{'all':!![]}];}_0x316aa2=_[_0x5311('0x3e')]({},_0x316aa2,_0x12cb55[_0x5311('0x47')]);return db[_0x5311('0x2e')][_0x5311('0x48')](_0x316aa2)['then'](handleEntityNotFound(_0x20f190,null))[_0x5311('0x25')](respondWithResult(_0x20f190,null))['catch'](handleError(_0x20f190,null));};exports['download']=function(_0x58e4ec,_0x35ea1d,_0x4b8751){return db[_0x5311('0x2e')][_0x5311('0x48')]({'where':{'id':_0x58e4ec[_0x5311('0x45')]['id']},'attributes':[_0x5311('0x2a'),_0x5311('0x49'),_0x5311('0x4a')],'raw':!![]})[_0x5311('0x25')](handleEntityNotFound(_0x35ea1d,null))[_0x5311('0x25')](function(_0x53febe){if(_0x53febe){if(!fs[_0x5311('0x4b')](path['join'](config[_0x5311('0x4c')],_0x5311('0x4d'),_0x53febe[_0x5311('0x49')]+'.'+_0x53febe[_0x5311('0x4a')]))){throw new db['Sequelize'][(_0x5311('0x4e'))](_0x5311('0x4f'));}return _0x35ea1d[_0x5311('0x50')](path[_0x5311('0x51')](config['root'],'server/files/sounds/converted',util['format']('%s.%s',_0x53febe[_0x5311('0x49')],_0x53febe[_0x5311('0x4a')])),util['format'](_0x5311('0x52'),_0x53febe[_0x5311('0x2a')],_0x53febe[_0x5311('0x4a')]));}return null;})[_0x5311('0x43')](handleError(_0x35ea1d,null));};exports['create']=function(_0x50efa4,_0x5c5441,_0x1aa6cf){var _0x3b0425={'name':path[_0x5311('0x53')](_0x50efa4[_0x5311('0x54')][_0x5311('0x55')],path[_0x5311('0x56')](_0x50efa4[_0x5311('0x54')][_0x5311('0x55')])),'save_name':path['basename'](_0x50efa4[_0x5311('0x54')][_0x5311('0x57')],path[_0x5311('0x56')](_0x50efa4[_0x5311('0x54')][_0x5311('0x57')])),'original_format':path[_0x5311('0x56')](_0x50efa4[_0x5311('0x54')][_0x5311('0x55')])[_0x5311('0x58')](0x1),'converted_format':'wav'};var _0x133362=path['join'](config[_0x5311('0x4c')],_0x5311('0x59'),_0x50efa4[_0x5311('0x54')]['filename']);var _0x56ed4e=path[_0x5311('0x51')](config['root'],_0x5311('0x4d'),util[_0x5311('0x5a')](_0x5311('0x52'),path[_0x5311('0x53')](_0x50efa4[_0x5311('0x54')][_0x5311('0x57')],path[_0x5311('0x56')](_0x50efa4['file']['filename'])),_0x3b0425[_0x5311('0x4a')]));logger['info'](_0x5311('0x5b'),_0x133362);logger[_0x5311('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0x56ed4e);try{fs[_0x5311('0x5d')](_0x133362,parseInt(_0x5311('0x5e'),0x8));var _0x306f79=sox[_0x5311('0x5f')](_0x133362,_0x56ed4e,{'sampleRate':0x1f40,'format':_0x5311('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x306f79['on'](_0x5311('0x28'),function(_0x2ce156){fs[_0x5311('0x61')](_0x133362);_0x5c5441[_0x5311('0x1b')](0x1f4)[_0x5311('0x2b')](_0x2ce156);});_0x306f79['on'](_0x5311('0x62'),function(_0x44ebb5){_0x3b0425[_0x5311('0x63')]=isNaN(_0x44ebb5[_0x5311('0x64')])?null:_0x44ebb5[_0x5311('0x64')]*0x3e8;_0x3b0425[_0x5311('0x65')]=isNaN(_0x44ebb5['sampleCount'])?null:_0x44ebb5[_0x5311('0x66')];_0x3b0425[_0x5311('0x67')]=isNaN(_0x44ebb5[_0x5311('0x68')])?null:_0x44ebb5['channelCount'];_0x3b0425['original_bitRate']=isNaN(_0x44ebb5[_0x5311('0x69')])?null:_0x44ebb5[_0x5311('0x69')];_0x3b0425[_0x5311('0x6a')]=isNaN(_0x44ebb5[_0x5311('0x6b')])?null:_0x44ebb5['sampleRate'];});_0x306f79['on'](_0x5311('0x6c'),function(_0x56e810){_0x3b0425[_0x5311('0x6d')]=isNaN(_0x56e810[_0x5311('0x64')])?null:_0x56e810[_0x5311('0x64')]*0x3e8;_0x3b0425[_0x5311('0x6e')]=isNaN(_0x56e810[_0x5311('0x66')])?null:_0x56e810[_0x5311('0x66')];_0x3b0425[_0x5311('0x6f')]=isNaN(_0x56e810['channelCount'])?null:_0x56e810[_0x5311('0x68')];_0x3b0425[_0x5311('0x70')]=isNaN(_0x56e810[_0x5311('0x69')])?null:_0x56e810['bitRate'];_0x3b0425[_0x5311('0x71')]=isNaN(_0x56e810['sampleRate'])?null:_0x56e810[_0x5311('0x6b')];});_0x306f79['on'](_0x5311('0x1a'),function(){fs['chmodSync'](_0x56ed4e,parseInt(_0x5311('0x5e'),0x8));return db[_0x5311('0x2e')][_0x5311('0x72')](_0x3b0425)['then'](function(_0x2eb5f4){var _0x309632={'role':_0x50efa4[_0x5311('0x73')][_0x5311('0x74')],'userProfileId':_0x50efa4[_0x5311('0x73')]['userProfileId']};if(!_0x309632)throw new Error(_0x5311('0x75'));if(_0x309632[_0x5311('0x74')]===_0x5311('0x76')){var _0x4f495c=_0x2eb5f4['get']({'plain':!![]});return db[_0x5311('0x77')]['find']({'where':{'name':_0x5311('0x26'),'userProfileId':_0x309632[_0x5311('0x78')]},'raw':!![]})[_0x5311('0x25')](function(_0x450183){if(_0x450183&&_0x450183[_0x5311('0x79')]===0x0){return db['UserProfileResource'][_0x5311('0x72')]({'name':_0x4f495c[_0x5311('0x2a')],'resourceId':_0x4f495c['id'],'type':_0x450183['name'],'sectionId':_0x450183['id']},{})['then'](function(){return _0x2eb5f4;});}else{return _0x2eb5f4;}})[_0x5311('0x43')](function(_0x645b0d){logger['error'](_0x5311('0x7a'),_0x645b0d);throw _0x645b0d;});}return _0x2eb5f4;})[_0x5311('0x25')](respondWithResult(_0x5c5441,null))['catch'](handleError(_0x5c5441,null));});_0x306f79[_0x5311('0x7b')]();}catch(_0x21d47c){_0x5c5441['status'](0x1f4)[_0x5311('0x2b')](_0x21d47c);}};exports[_0x5311('0x24')]=function(_0x1b8991,_0x22eb2a,_0x54748b){return db[_0x5311('0x2e')]['find']({'where':{'id':_0x1b8991[_0x5311('0x45')]['id']}})[_0x5311('0x25')](handleEntityNotFound(_0x22eb2a,null))[_0x5311('0x25')](saveUpdates(_[_0x5311('0x7c')](_0x1b8991[_0x5311('0x73')],[_0x5311('0x2a'),_0x5311('0x7d')]),null))[_0x5311('0x25')](respondWithResult(_0x22eb2a,null))[_0x5311('0x43')](handleError(_0x22eb2a,null));};exports[_0x5311('0x7e')]=function(_0x8cd00c,_0x1c3f89,_0x404d14){return db[_0x5311('0x2e')][_0x5311('0x48')]({'where':{'id':_0x8cd00c[_0x5311('0x45')]['id']}})[_0x5311('0x25')](function(_0x490b80){if(_0x490b80){return _0x490b80[_0x5311('0x7f')]();}})[_0x5311('0x25')](function(_0x2651e5){var _0x1a3b36=path[_0x5311('0x51')](config[_0x5311('0x4c')],_0x5311('0x59'),util[_0x5311('0x5a')](_0x5311('0x52'),_0x2651e5['save_name'],_0x2651e5[_0x5311('0x80')]));var _0x1ac0d7=path[_0x5311('0x51')](config[_0x5311('0x4c')],'server/files/sounds/converted',util[_0x5311('0x5a')](_0x5311('0x52'),_0x2651e5[_0x5311('0x49')],_0x2651e5['converted_format']));fs[_0x5311('0x61')](_0x1a3b36);fs[_0x5311('0x61')](_0x1ac0d7);return _0x2651e5;})[_0x5311('0x25')](function(_0x4bdb0a){if(_0x4bdb0a){return _0x1c3f89[_0x5311('0x1b')](0xcc)[_0x5311('0x1a')]();}})[_0x5311('0x25')](handleEntityNotFound(_0x1c3f89,null))[_0x5311('0x43')](handleError(_0x1c3f89,null));}; \ No newline at end of file +var _0x1d6d=['intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','Sound','includeAll','include','findAll','catch','show','download','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','extname','file','originalname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_sampleCount','converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','Sounds','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1d6d,0x143));var _0xd1d6=function(_0x57e1fd,_0x5c5f84){_0x57e1fd=_0x57e1fd-0x0;var _0x2275d9=_0x1d6d[_0x57e1fd];return _0x2275d9;};'use strict';var emlformat=require(_0xd1d6('0x0'));var rimraf=require(_0xd1d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1d6('0x2'));var rp=require(_0xd1d6('0x3'));var moment=require(_0xd1d6('0x4'));var BPromise=require(_0xd1d6('0x5'));var Mustache=require(_0xd1d6('0x6'));var util=require(_0xd1d6('0x7'));var path=require(_0xd1d6('0x8'));var sox=require(_0xd1d6('0x9'));var csv=require(_0xd1d6('0xa'));var ejs=require(_0xd1d6('0xb'));var fs=require('fs');var fs_extra=require(_0xd1d6('0xc'));var _=require(_0xd1d6('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd1d6('0xe'));var deskjs=require(_0xd1d6('0xf'));var toCsv=require(_0xd1d6('0xa'));var querystring=require(_0xd1d6('0x10'));var Papa=require(_0xd1d6('0x11'));var Redis=require(_0xd1d6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd1d6('0x13'));var as=require(_0xd1d6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd1d6('0x15'));var utils=require(_0xd1d6('0x16'));var config=require(_0xd1d6('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x420b6b,_0x1cb833){_0x1cb833=_0x1cb833||0xcc;return function(_0x4392cb){if(_0x4392cb){return _0x420b6b[_0xd1d6('0x18')](_0x1cb833);}return _0x420b6b[_0xd1d6('0x19')](_0x1cb833)['end']();};}function respondWithResult(_0x4056b7,_0x3d63d2){_0x3d63d2=_0x3d63d2||0xc8;return function(_0x4ca210){if(_0x4ca210){return _0x4056b7[_0xd1d6('0x19')](_0x3d63d2)[_0xd1d6('0x1a')](_0x4ca210);}};}function respondWithFilteredResult(_0x36771e,_0x5aef6f){return function(_0x42791b){if(_0x42791b){var _0x3a2a52=typeof _0x5aef6f['offset']===_0xd1d6('0x1b')&&typeof _0x5aef6f['limit']===_0xd1d6('0x1b');var _0x12df54=_0x42791b['count'];var _0x3422b8=_0x3a2a52?0x0:_0x5aef6f['offset'];var _0x3baa21=_0x3a2a52?_0x42791b[_0xd1d6('0x1c')]:_0x5aef6f[_0xd1d6('0x1d')]+_0x5aef6f[_0xd1d6('0x1e')];var _0x3eae2d;if(_0x3baa21>=_0x12df54){_0x3baa21=_0x12df54;_0x3eae2d=0xc8;}else{_0x3eae2d=0xce;}_0x36771e[_0xd1d6('0x19')](_0x3eae2d);return _0x36771e[_0xd1d6('0x1f')](_0xd1d6('0x20'),_0x3422b8+'-'+_0x3baa21+'/'+_0x12df54)[_0xd1d6('0x1a')](_0x42791b);}return null;};}function patchUpdates(_0xce9c39){return function(_0x16387d){try{jsonpatch[_0xd1d6('0x21')](_0x16387d,_0xce9c39,!![]);}catch(_0xbda165){return BPromise[_0xd1d6('0x22')](_0xbda165);}return _0x16387d[_0xd1d6('0x23')]();};}function saveUpdates(_0x2de3f6,_0x3ee745){return function(_0x573477){if(_0x573477){return _0x573477['update'](_0x2de3f6)['then'](function(_0xd4f2d4){return _0xd4f2d4;});}return null;};}function removeEntity(_0x506249,_0xf9cb8){return function(_0x39d4b7){if(_0x39d4b7){return _0x39d4b7[_0xd1d6('0x24')]()[_0xd1d6('0x25')](function(){var _0x3f81fa=_0x39d4b7[_0xd1d6('0x26')]({'plain':!![]});var _0x550cda=_0xd1d6('0x27');return db['UserProfileResource'][_0xd1d6('0x24')]({'where':{'type':_0x550cda,'resourceId':_0x3f81fa['id']}})[_0xd1d6('0x25')](function(){return _0x39d4b7;});})['then'](function(){_0x506249[_0xd1d6('0x19')](0xcc)[_0xd1d6('0x28')]();});}};}function handleEntityNotFound(_0x513788,_0x2559ea){return function(_0x27929c){if(!_0x27929c){_0x513788[_0xd1d6('0x18')](0x194);}return _0x27929c;};}function handleError(_0x29a332,_0x5ded21){_0x5ded21=_0x5ded21||0x1f4;return function(_0x265e22){logger['error'](_0x265e22[_0xd1d6('0x29')]);if(_0x265e22['name']){delete _0x265e22[_0xd1d6('0x2a')];}_0x29a332['status'](_0x5ded21)[_0xd1d6('0x2b')](_0x265e22);};}exports[_0xd1d6('0x2c')]=function(_0x5cb965,_0x320978){var _0x520cf0={},_0x11613c={},_0x5f277b={'count':0x0,'rows':[]};var _0x22d1cd=_['map'](db['Sound'][_0xd1d6('0x2d')],function(_0x1889f8){return{'name':_0x1889f8[_0xd1d6('0x2e')],'type':_0x1889f8[_0xd1d6('0x2f')][_0xd1d6('0x30')]};});_0x11613c[_0xd1d6('0x31')]=_['map'](_0x22d1cd,_0xd1d6('0x2a'));_0x11613c[_0xd1d6('0x32')]=_[_0xd1d6('0x33')](_0x5cb965['query']);_0x11613c['filters']=_[_0xd1d6('0x34')](_0x11613c[_0xd1d6('0x31')],_0x11613c[_0xd1d6('0x32')]);_0x520cf0[_0xd1d6('0x35')]=_[_0xd1d6('0x34')](_0x11613c[_0xd1d6('0x31')],qs[_0xd1d6('0x36')](_0x5cb965[_0xd1d6('0x32')][_0xd1d6('0x36')]));_0x520cf0['attributes']=_0x520cf0[_0xd1d6('0x35')][_0xd1d6('0x37')]?_0x520cf0[_0xd1d6('0x35')]:_0x11613c['model'];if(!_0x5cb965[_0xd1d6('0x32')]['hasOwnProperty'](_0xd1d6('0x38'))){_0x520cf0[_0xd1d6('0x1e')]=qs[_0xd1d6('0x1e')](_0x5cb965['query'][_0xd1d6('0x1e')]);_0x520cf0[_0xd1d6('0x1d')]=qs['offset'](_0x5cb965[_0xd1d6('0x32')][_0xd1d6('0x1d')]);}_0x520cf0['order']=qs[_0xd1d6('0x39')](_0x5cb965['query']['sort']);_0x520cf0[_0xd1d6('0x3a')]=qs[_0xd1d6('0x3b')](_[_0xd1d6('0x3c')](_0x5cb965[_0xd1d6('0x32')],_0x11613c['filters']),_0x22d1cd);if(_0x5cb965[_0xd1d6('0x32')][_0xd1d6('0x3d')]){_0x520cf0[_0xd1d6('0x3a')]=_['merge'](_0x520cf0[_0xd1d6('0x3a')],{'$or':_[_0xd1d6('0x3e')](_0x22d1cd,function(_0x402038){if(_0x402038['type']!==_0xd1d6('0x3f')){var _0x13db4e={};_0x13db4e[_0x402038[_0xd1d6('0x2a')]]={'$like':'%'+_0x5cb965[_0xd1d6('0x32')][_0xd1d6('0x3d')]+'%'};return _0x13db4e;}})});}_0x520cf0=_[_0xd1d6('0x40')]({},_0x520cf0,_0x5cb965[_0xd1d6('0x41')]);var _0x3719c8={'where':_0x520cf0['where']};return db[_0xd1d6('0x42')]['count'](_0x3719c8)[_0xd1d6('0x25')](function(_0x540776){_0x5f277b['count']=_0x540776;if(_0x5cb965[_0xd1d6('0x32')][_0xd1d6('0x43')]){_0x520cf0[_0xd1d6('0x44')]=[{'all':!![]}];}return db[_0xd1d6('0x42')][_0xd1d6('0x45')](_0x520cf0);})[_0xd1d6('0x25')](function(_0x34de9d){_0x5f277b['rows']=_0x34de9d;return _0x5f277b;})['then'](respondWithFilteredResult(_0x320978,_0x520cf0))[_0xd1d6('0x46')](handleError(_0x320978,null));};exports[_0xd1d6('0x47')]=function(_0x3ee01a,_0x3044c7){var _0x4fe2db={'raw':!![],'where':{'id':_0x3ee01a['params']['id']}},_0x47e615={};_0x47e615['model']=_[_0xd1d6('0x33')](db['Sound']['rawAttributes']);_0x47e615[_0xd1d6('0x32')]=_[_0xd1d6('0x33')](_0x3ee01a[_0xd1d6('0x32')]);_0x47e615[_0xd1d6('0x3b')]=_['intersection'](_0x47e615[_0xd1d6('0x31')],_0x47e615[_0xd1d6('0x32')]);_0x4fe2db['attributes']=_[_0xd1d6('0x34')](_0x47e615[_0xd1d6('0x31')],qs['fields'](_0x3ee01a[_0xd1d6('0x32')][_0xd1d6('0x36')]));_0x4fe2db['attributes']=_0x4fe2db['attributes']['length']?_0x4fe2db[_0xd1d6('0x35')]:_0x47e615[_0xd1d6('0x31')];if(_0x3ee01a[_0xd1d6('0x32')][_0xd1d6('0x43')]){_0x4fe2db['include']=[{'all':!![]}];}_0x4fe2db=_[_0xd1d6('0x40')]({},_0x4fe2db,_0x3ee01a[_0xd1d6('0x41')]);return db[_0xd1d6('0x42')]['find'](_0x4fe2db)[_0xd1d6('0x25')](handleEntityNotFound(_0x3044c7,null))[_0xd1d6('0x25')](respondWithResult(_0x3044c7,null))['catch'](handleError(_0x3044c7,null));};exports[_0xd1d6('0x48')]=function(_0x3e6f9c,_0x40d62c,_0x3ca53d){return db[_0xd1d6('0x42')][_0xd1d6('0x49')]({'where':{'id':_0x3e6f9c['params']['id']},'attributes':[_0xd1d6('0x2a'),_0xd1d6('0x4a'),_0xd1d6('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x40d62c,null))[_0xd1d6('0x25')](function(_0x5ae0fc){if(_0x5ae0fc){if(!fs[_0xd1d6('0x4c')](path[_0xd1d6('0x4d')](config[_0xd1d6('0x4e')],_0xd1d6('0x4f'),_0x5ae0fc[_0xd1d6('0x4a')]+'.'+_0x5ae0fc[_0xd1d6('0x4b')]))){throw new db['Sequelize'][(_0xd1d6('0x50'))](_0xd1d6('0x51'));}return _0x40d62c['download'](path[_0xd1d6('0x4d')](config[_0xd1d6('0x4e')],_0xd1d6('0x4f'),util[_0xd1d6('0x52')](_0xd1d6('0x53'),_0x5ae0fc[_0xd1d6('0x4a')],_0x5ae0fc['converted_format'])),util['format'](_0xd1d6('0x53'),_0x5ae0fc[_0xd1d6('0x2a')],_0x5ae0fc[_0xd1d6('0x4b')]));}return null;})[_0xd1d6('0x46')](handleError(_0x40d62c,null));};exports[_0xd1d6('0x54')]=function(_0x828d34,_0x37c761,_0xa95409){var _0x4a3de3={'name':path[_0xd1d6('0x55')](_0x828d34['file']['originalname'],path[_0xd1d6('0x56')](_0x828d34[_0xd1d6('0x57')][_0xd1d6('0x58')])),'save_name':path['basename'](_0x828d34[_0xd1d6('0x57')]['filename'],path[_0xd1d6('0x56')](_0x828d34[_0xd1d6('0x57')][_0xd1d6('0x59')])),'original_format':path[_0xd1d6('0x56')](_0x828d34[_0xd1d6('0x57')]['originalname'])[_0xd1d6('0x5a')](0x1),'converted_format':_0xd1d6('0x5b')};var _0x42de8b=path[_0xd1d6('0x4d')](config[_0xd1d6('0x4e')],_0xd1d6('0x5c'),_0x828d34['file']['filename']);var _0xba383a=path['join'](config['root'],_0xd1d6('0x4f'),util[_0xd1d6('0x52')](_0xd1d6('0x53'),path['basename'](_0x828d34[_0xd1d6('0x57')][_0xd1d6('0x59')],path[_0xd1d6('0x56')](_0x828d34['file'][_0xd1d6('0x59')])),_0x4a3de3[_0xd1d6('0x4b')]));logger['info'](_0xd1d6('0x5d'),_0x42de8b);logger[_0xd1d6('0x5e')](_0xd1d6('0x5f'),_0xba383a);try{fs[_0xd1d6('0x60')](_0x42de8b,parseInt(_0xd1d6('0x61'),0x8));var _0x207d91=sox[_0xd1d6('0x62')](_0x42de8b,_0xba383a,{'sampleRate':0x1f40,'format':_0xd1d6('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x207d91['on']('error',function(_0x24c324){fs['unlinkSync'](_0x42de8b);_0x37c761[_0xd1d6('0x19')](0x1f4)[_0xd1d6('0x2b')](_0x24c324);});_0x207d91['on'](_0xd1d6('0x63'),function(_0x35470a){_0x4a3de3[_0xd1d6('0x64')]=isNaN(_0x35470a[_0xd1d6('0x65')])?null:_0x35470a['duration']*0x3e8;_0x4a3de3[_0xd1d6('0x66')]=isNaN(_0x35470a[_0xd1d6('0x67')])?null:_0x35470a['sampleCount'];_0x4a3de3[_0xd1d6('0x68')]=isNaN(_0x35470a['channelCount'])?null:_0x35470a[_0xd1d6('0x69')];_0x4a3de3[_0xd1d6('0x6a')]=isNaN(_0x35470a[_0xd1d6('0x6b')])?null:_0x35470a[_0xd1d6('0x6b')];_0x4a3de3['original_sampleRate']=isNaN(_0x35470a[_0xd1d6('0x6c')])?null:_0x35470a['sampleRate'];});_0x207d91['on']('dest',function(_0x214132){_0x4a3de3['converted_duration']=isNaN(_0x214132['duration'])?null:_0x214132[_0xd1d6('0x65')]*0x3e8;_0x4a3de3[_0xd1d6('0x6d')]=isNaN(_0x214132[_0xd1d6('0x67')])?null:_0x214132[_0xd1d6('0x67')];_0x4a3de3['converted_channelCount']=isNaN(_0x214132[_0xd1d6('0x69')])?null:_0x214132[_0xd1d6('0x69')];_0x4a3de3[_0xd1d6('0x6e')]=isNaN(_0x214132[_0xd1d6('0x6b')])?null:_0x214132['bitRate'];_0x4a3de3[_0xd1d6('0x6f')]=isNaN(_0x214132[_0xd1d6('0x6c')])?null:_0x214132['sampleRate'];});_0x207d91['on'](_0xd1d6('0x28'),function(){fs[_0xd1d6('0x60')](_0xba383a,parseInt(_0xd1d6('0x61'),0x8));return db[_0xd1d6('0x42')][_0xd1d6('0x54')](_0x4a3de3)[_0xd1d6('0x25')](function(_0x458c2c){var _0x29f5ea={'role':_0x828d34['body'][_0xd1d6('0x70')],'userProfileId':_0x828d34[_0xd1d6('0x71')][_0xd1d6('0x72')]};if(!_0x29f5ea)throw new Error(_0xd1d6('0x73'));if(_0x29f5ea[_0xd1d6('0x70')]==='user'){var _0x18436c=_0x458c2c[_0xd1d6('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xd1d6('0x49')]({'where':{'name':_0xd1d6('0x27'),'userProfileId':_0x29f5ea[_0xd1d6('0x72')]},'raw':!![]})[_0xd1d6('0x25')](function(_0x1065e4){if(_0x1065e4&&_0x1065e4[_0xd1d6('0x74')]===0x0){return db[_0xd1d6('0x75')][_0xd1d6('0x54')]({'name':_0x18436c[_0xd1d6('0x2a')],'resourceId':_0x18436c['id'],'type':_0x1065e4[_0xd1d6('0x2a')],'sectionId':_0x1065e4['id']},{})[_0xd1d6('0x25')](function(){return _0x458c2c;});}else{return _0x458c2c;}})[_0xd1d6('0x46')](function(_0x100473){logger[_0xd1d6('0x76')](_0xd1d6('0x77'),_0x100473);throw _0x100473;});}return _0x458c2c;})[_0xd1d6('0x25')](respondWithResult(_0x37c761,null))[_0xd1d6('0x46')](handleError(_0x37c761,null));});_0x207d91[_0xd1d6('0x78')]();}catch(_0x250f7f){_0x37c761[_0xd1d6('0x19')](0x1f4)[_0xd1d6('0x2b')](_0x250f7f);}};exports['update']=function(_0x5cfafd,_0x3b7820,_0x4a018e){return db[_0xd1d6('0x42')][_0xd1d6('0x49')]({'where':{'id':_0x5cfafd['params']['id']}})[_0xd1d6('0x25')](handleEntityNotFound(_0x3b7820,null))[_0xd1d6('0x25')](saveUpdates(_[_0xd1d6('0x3c')](_0x5cfafd[_0xd1d6('0x71')],['name',_0xd1d6('0x79')]),null))[_0xd1d6('0x25')](respondWithResult(_0x3b7820,null))[_0xd1d6('0x46')](handleError(_0x3b7820,null));};exports[_0xd1d6('0x7a')]=function(_0x108724,_0x8a30bd,_0x3a9090){return db[_0xd1d6('0x42')][_0xd1d6('0x49')]({'where':{'id':_0x108724['params']['id']}})[_0xd1d6('0x25')](function(_0x53d202){if(_0x53d202){return _0x53d202[_0xd1d6('0x24')]();}})['then'](function(_0x51b148){var _0x3d99ff=path['join'](config['root'],_0xd1d6('0x5c'),util['format'](_0xd1d6('0x53'),_0x51b148[_0xd1d6('0x4a')],_0x51b148[_0xd1d6('0x7b')]));var _0x29e542=path[_0xd1d6('0x4d')](config['root'],_0xd1d6('0x4f'),util[_0xd1d6('0x52')](_0xd1d6('0x53'),_0x51b148['save_name'],_0x51b148[_0xd1d6('0x4b')]));fs['unlinkSync'](_0x3d99ff);fs[_0xd1d6('0x7c')](_0x29e542);return _0x51b148;})['then'](function(_0x41e8db){if(_0x41e8db){return _0x8a30bd[_0xd1d6('0x19')](0xcc)[_0xd1d6('0x28')]();}})[_0xd1d6('0x25')](handleEntityNotFound(_0x8a30bd,null))[_0xd1d6('0x46')](handleError(_0x8a30bd,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 8e45157..711c835 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 _0xe765=['define','Sound','tools_sounds','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5e9396,_0x161fdd){var _0x4172e3=function(_0x4acd42){while(--_0x4acd42){_0x5e9396['push'](_0x5e9396['shift']());}};_0x4172e3(++_0x161fdd);}(_0xe765,0x6f));var _0x5e76=function(_0x5def54,_0xc0ed23){_0x5def54=_0x5def54-0x0;var _0x1385fb=_0xe765[_0x5def54];return _0x1385fb;};'use strict';var _=require(_0x5e76('0x0'));var util=require(_0x5e76('0x1'));var logger=require(_0x5e76('0x2'))(_0x5e76('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5e76('0x4'));var fs=require('fs');var path=require(_0x5e76('0x5'));var rimraf=require(_0x5e76('0x6'));var config=require(_0x5e76('0x7'));var attributes=require('./sound.attributes');module[_0x5e76('0x8')]=function(_0x23a1dd,_0x3835ad){return _0x23a1dd[_0x5e76('0x9')](_0x5e76('0xa'),attributes,{'tableName':_0x5e76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x833e=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define'];(function(_0x27fc97,_0x22b909){var _0x228678=function(_0x5b9d32){while(--_0x5b9d32){_0x27fc97['push'](_0x27fc97['shift']());}};_0x228678(++_0x22b909);}(_0x833e,0xe4));var _0xe833=function(_0x2fe5c8,_0x472db2){_0x2fe5c8=_0x2fe5c8-0x0;var _0x515a20=_0x833e[_0x2fe5c8];return _0x515a20;};'use strict';var _=require(_0xe833('0x0'));var util=require(_0xe833('0x1'));var logger=require(_0xe833('0x2'))('api');var moment=require(_0xe833('0x3'));var BPromise=require(_0xe833('0x4'));var rp=require(_0xe833('0x5'));var fs=require('fs');var path=require(_0xe833('0x6'));var rimraf=require(_0xe833('0x7'));var config=require(_0xe833('0x8'));var attributes=require(_0xe833('0x9'));module[_0xe833('0xa')]=function(_0x403673,_0x5e035a){return _0x403673[_0xe833('0xb')]('Sound',attributes,{'tableName':'tools_sounds','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 a18613b..78c6239 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 _0xed19=['request','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSound','options','where','attributes','model','map','include','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xed19,0xe6));var _0x9ed1=function(_0x4b9c83,_0x3e6e05){_0x4b9c83=_0x4b9c83-0x0;var _0x2ee121=_0xed19[_0x4b9c83];return _0x2ee121;};'use strict';var _=require(_0x9ed1('0x0'));var util=require(_0x9ed1('0x1'));var moment=require(_0x9ed1('0x2'));var BPromise=require(_0x9ed1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ed1('0x4'));var db=require(_0x9ed1('0x5'))['db'];var utils=require(_0x9ed1('0x6'));var logger=require(_0x9ed1('0x7'))('rpc');var config=require(_0x9ed1('0x8'));var jayson=require(_0x9ed1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d063e,_0x53617b,_0x179c8a){return new BPromise(function(_0x5cd6a0,_0x2b2111){return client[_0x9ed1('0xa')](_0x4d063e,_0x179c8a)['then'](function(_0x1d790a){logger[_0x9ed1('0xb')](_0x9ed1('0xc'),_0x53617b,'request\x20sent');logger[_0x9ed1('0xd')](_0x9ed1('0xe'),_0x53617b,_0x9ed1('0xf'),JSON[_0x9ed1('0x10')](_0x1d790a));if(_0x1d790a[_0x9ed1('0x11')]){if(_0x1d790a[_0x9ed1('0x11')][_0x9ed1('0x12')]===0x1f4){logger[_0x9ed1('0x11')](_0x9ed1('0xc'),_0x53617b,_0x1d790a[_0x9ed1('0x11')][_0x9ed1('0x13')]);return _0x2b2111(_0x1d790a[_0x9ed1('0x11')][_0x9ed1('0x13')]);}logger[_0x9ed1('0x11')]('Sound,\x20%s,\x20%s',_0x53617b,_0x1d790a['error'][_0x9ed1('0x13')]);return _0x5cd6a0(_0x1d790a[_0x9ed1('0x11')][_0x9ed1('0x13')]);}else{logger[_0x9ed1('0xb')](_0x9ed1('0xc'),_0x53617b,_0x9ed1('0xf'));_0x5cd6a0(_0x1d790a[_0x9ed1('0x14')]['message']);}})[_0x9ed1('0x15')](function(_0x1f2974){logger['error'](_0x9ed1('0xc'),_0x53617b,_0x1f2974);_0x2b2111(_0x1f2974);});});}exports[_0x9ed1('0x16')]=function(_0x4d1d58){var _0x4e6119=this;return new Promise(function(_0x2052b6,_0x262049){return db['Sound']['find']({'raw':_0x4d1d58[_0x9ed1('0x17')]?_0x4d1d58[_0x9ed1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4d1d58[_0x9ed1('0x17')]?_0x4d1d58['options'][_0x9ed1('0x18')]||null:null,'attributes':_0x4d1d58['options']?_0x4d1d58[_0x9ed1('0x17')][_0x9ed1('0x19')]||null:null,'include':_0x4d1d58[_0x9ed1('0x17')]?_0x4d1d58[_0x9ed1('0x17')]['include']?_['map'](_0x4d1d58[_0x9ed1('0x17')]['include'],function(_0x19dc61){return{'model':db[_0x19dc61[_0x9ed1('0x1a')]],'as':_0x19dc61['as'],'attributes':_0x19dc61['attributes'],'include':_0x19dc61['include']?_[_0x9ed1('0x1b')](_0x19dc61[_0x9ed1('0x1c')],function(_0x4e75ca){return{'model':db[_0x4e75ca[_0x9ed1('0x1a')]],'as':_0x4e75ca['as'],'attributes':_0x4e75ca[_0x9ed1('0x19')],'include':_0x4e75ca[_0x9ed1('0x1c')]?_[_0x9ed1('0x1b')](_0x4e75ca[_0x9ed1('0x1c')],function(_0x305cc4){return{'model':db[_0x305cc4['model']],'as':_0x305cc4['as'],'attributes':_0x305cc4[_0x9ed1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9ed1('0x1d')](function(_0x244de6){logger['info'](_0x9ed1('0x16'),_0x4d1d58);logger[_0x9ed1('0xd')](_0x9ed1('0x16'),_0x4d1d58,JSON[_0x9ed1('0x10')](_0x244de6));_0x2052b6(_0x244de6);})[_0x9ed1('0x15')](function(_0x4de7bc){logger[_0x9ed1('0x11')](_0x9ed1('0x16'),_0x4de7bc['message'],_0x4d1d58);_0x262049(_0x4e6119[_0x9ed1('0x11')](0x1f4,_0x4de7bc[_0x9ed1('0x13')]));});});}; \ No newline at end of file +var _0x636b=['request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','result','ShowSound','find','options','raw','attributes','include','map','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x2cc27a,_0x2ddc11){var _0x241fbc=function(_0x1df30a){while(--_0x1df30a){_0x2cc27a['push'](_0x2cc27a['shift']());}};_0x241fbc(++_0x2ddc11);}(_0x636b,0xc2));var _0xb636=function(_0x45863f,_0x105ee6){_0x45863f=_0x45863f-0x0;var _0x59b503=_0x636b[_0x45863f];return _0x59b503;};'use strict';var _=require(_0xb636('0x0'));var util=require('util');var moment=require(_0xb636('0x1'));var BPromise=require(_0xb636('0x2'));var rs=require(_0xb636('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb636('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb636('0x5'))(_0xb636('0x6'));var config=require(_0xb636('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb636('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x283779,_0x48cc8d,_0x5413b9){return new BPromise(function(_0x54be86,_0x22b7af){return client[_0xb636('0x9')](_0x283779,_0x5413b9)[_0xb636('0xa')](function(_0x37abb0){logger[_0xb636('0xb')]('Sound,\x20%s,\x20%s',_0x48cc8d,'request\x20sent');logger[_0xb636('0xc')](_0xb636('0xd'),_0x48cc8d,_0xb636('0xe'),JSON[_0xb636('0xf')](_0x37abb0));if(_0x37abb0[_0xb636('0x10')]){if(_0x37abb0[_0xb636('0x10')][_0xb636('0x11')]===0x1f4){logger[_0xb636('0x10')](_0xb636('0x12'),_0x48cc8d,_0x37abb0['error']['message']);return _0x22b7af(_0x37abb0[_0xb636('0x10')]['message']);}logger[_0xb636('0x10')](_0xb636('0x12'),_0x48cc8d,_0x37abb0['error']['message']);return _0x54be86(_0x37abb0['error'][_0xb636('0x13')]);}else{logger[_0xb636('0xb')]('Sound,\x20%s,\x20%s',_0x48cc8d,_0xb636('0xe'));_0x54be86(_0x37abb0[_0xb636('0x14')][_0xb636('0x13')]);}})['catch'](function(_0x5e8135){logger['error'](_0xb636('0x12'),_0x48cc8d,_0x5e8135);_0x22b7af(_0x5e8135);});});}exports[_0xb636('0x15')]=function(_0x48a0e0){var _0x2e2ef4=this;return new Promise(function(_0x20217b,_0x43ce8b){return db['Sound'][_0xb636('0x16')]({'raw':_0x48a0e0['options']?_0x48a0e0[_0xb636('0x17')][_0xb636('0x18')]===undefined?!![]:![]:!![],'where':_0x48a0e0[_0xb636('0x17')]?_0x48a0e0['options']['where']||null:null,'attributes':_0x48a0e0[_0xb636('0x17')]?_0x48a0e0[_0xb636('0x17')][_0xb636('0x19')]||null:null,'include':_0x48a0e0[_0xb636('0x17')]?_0x48a0e0['options'][_0xb636('0x1a')]?_[_0xb636('0x1b')](_0x48a0e0[_0xb636('0x17')][_0xb636('0x1a')],function(_0x303e0c){return{'model':db[_0x303e0c['model']],'as':_0x303e0c['as'],'attributes':_0x303e0c['attributes'],'include':_0x303e0c[_0xb636('0x1a')]?_['map'](_0x303e0c['include'],function(_0x1e80ee){return{'model':db[_0x1e80ee[_0xb636('0x1c')]],'as':_0x1e80ee['as'],'attributes':_0x1e80ee[_0xb636('0x19')],'include':_0x1e80ee[_0xb636('0x1a')]?_[_0xb636('0x1b')](_0x1e80ee[_0xb636('0x1a')],function(_0x3bc1ed){return{'model':db[_0x3bc1ed[_0xb636('0x1c')]],'as':_0x3bc1ed['as'],'attributes':_0x3bc1ed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c5fbe){logger['info']('ShowSound',_0x48a0e0);logger[_0xb636('0xc')]('ShowSound',_0x48a0e0,JSON[_0xb636('0xf')](_0x2c5fbe));_0x20217b(_0x2c5fbe);})['catch'](function(_0x37cd2d){logger[_0xb636('0x10')](_0xb636('0x15'),_0x37cd2d['message'],_0x48a0e0);_0x43ce8b(_0x2e2ef4[_0xb636('0x10')](0x1f4,_0x37cd2d[_0xb636('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 18ee469..7c18ffa 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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x39686b,_0x6117a1){var _0x5db8fe=function(_0x243ea8){while(--_0x243ea8){_0x39686b['push'](_0x39686b['shift']());}};_0x5db8fe(++_0x6117a1);}(_0x757a,0xde));var _0xa757=function(_0x5aa925,_0x3df970){_0x5aa925=_0x5aa925-0x0;var _0x3a3b35=_0x757a[_0x5aa925];return _0x3a3b35;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x59f914,_0x17dc71){var _0x1f21dc=function(_0x1c70ef){while(--_0x1c70ef){_0x59f914['push'](_0x59f914['shift']());}};_0x1f21dc(++_0x17dc71);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b7b6fd8..956c2cd 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 _0x5109=['medium','ENUM','out','exports','STRING','TEXT'];(function(_0x3a294e,_0x5770d2){var _0x40832f=function(_0x12c18d){while(--_0x12c18d){_0x3a294e['push'](_0x3a294e['shift']());}};_0x40832f(++_0x5770d2);}(_0x5109,0x135));var _0x9510=function(_0x59d019,_0x3d42b2){_0x59d019=_0x59d019-0x0;var _0x192cbb=_0x5109[_0x59d019];return _0x192cbb;};'use strict';var Sequelize=require('sequelize');module[_0x9510('0x0')]={'uniqueid':{'type':Sequelize[_0x9510('0x1')]},'body':{'type':Sequelize[_0x9510('0x2')](_0x9510('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x9510('0x4')]('in',_0x9510('0x5')),'defaultValue':_0x9510('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x9510('0x1')]},'providerResponse':{'type':Sequelize[_0x9510('0x2')]}}; \ No newline at end of file +var _0xb8cc=['TEXT','medium','exports','STRING'];(function(_0x503c88,_0x2a8eb7){var _0x157d19=function(_0x4096a2){while(--_0x4096a2){_0x503c88['push'](_0x503c88['shift']());}};_0x157d19(++_0x2a8eb7);}(_0xb8cc,0x18e));var _0xcb8c=function(_0x2f8851,_0x218653){_0x2f8851=_0x2f8851-0x0;var _0x4f4231=_0xb8cc[_0x2f8851];return _0x4f4231;};'use strict';var Sequelize=require('sequelize');module[_0xcb8c('0x0')]={'uniqueid':{'type':Sequelize[_0xcb8c('0x1')]},'body':{'type':Sequelize[_0xcb8c('0x2')](_0xcb8c('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xcb8c('0x1')]},'providerResponse':{'type':Sequelize[_0xcb8c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 33bd681..f7dbe69 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 _0x5ea2=['find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','SquareMessage','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x5ea2,0x99));var _0x25ea=function(_0x22f447,_0x1fd994){_0x22f447=_0x22f447-0x0;var _0x5edd6a=_0x5ea2[_0x22f447];return _0x5edd6a;};'use strict';var emlformat=require(_0x25ea('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x25ea('0x1'));var rp=require(_0x25ea('0x2'));var moment=require(_0x25ea('0x3'));var BPromise=require(_0x25ea('0x4'));var Mustache=require(_0x25ea('0x5'));var util=require('util');var path=require(_0x25ea('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25ea('0x7'));var fs=require('fs');var fs_extra=require(_0x25ea('0x8'));var _=require(_0x25ea('0x9'));var squel=require(_0x25ea('0xa'));var crypto=require(_0x25ea('0xb'));var jsforce=require(_0x25ea('0xc'));var deskjs=require(_0x25ea('0xd'));var toCsv=require(_0x25ea('0xe'));var querystring=require(_0x25ea('0xf'));var Papa=require('papaparse');var Redis=require(_0x25ea('0x10'));var authService=require(_0x25ea('0x11'));var qs=require(_0x25ea('0x12'));var as=require(_0x25ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25ea('0x14'))(_0x25ea('0x15'));var utils=require(_0x25ea('0x16'));var config=require(_0x25ea('0x17'));var licenseUtil=require(_0x25ea('0x18'));var db=require(_0x25ea('0x19'))['db'];function respondWithStatusCode(_0x5b3906,_0x5e1059){_0x5e1059=_0x5e1059||0xcc;return function(_0x138c9a){if(_0x138c9a){return _0x5b3906[_0x25ea('0x1a')](_0x5e1059);}return _0x5b3906['status'](_0x5e1059)[_0x25ea('0x1b')]();};}function respondWithResult(_0x20e171,_0x1e247c){_0x1e247c=_0x1e247c||0xc8;return function(_0x190d5a){if(_0x190d5a){return _0x20e171[_0x25ea('0x1c')](_0x1e247c)[_0x25ea('0x1d')](_0x190d5a);}};}function respondWithFilteredResult(_0x488600,_0x16c2e8){return function(_0x81c080){if(_0x81c080){var _0x4c60a0=typeof _0x16c2e8[_0x25ea('0x1e')]===_0x25ea('0x1f')&&typeof _0x16c2e8[_0x25ea('0x20')]===_0x25ea('0x1f');var _0x2e69c8=_0x81c080[_0x25ea('0x21')];var _0x586d4d=_0x4c60a0?0x0:_0x16c2e8[_0x25ea('0x1e')];var _0x454b8e=_0x4c60a0?_0x81c080[_0x25ea('0x21')]:_0x16c2e8[_0x25ea('0x1e')]+_0x16c2e8[_0x25ea('0x20')];var _0x1cc187;if(_0x454b8e>=_0x2e69c8){_0x454b8e=_0x2e69c8;_0x1cc187=0xc8;}else{_0x1cc187=0xce;}_0x488600[_0x25ea('0x1c')](_0x1cc187);return _0x488600['set'](_0x25ea('0x22'),_0x586d4d+'-'+_0x454b8e+'/'+_0x2e69c8)[_0x25ea('0x1d')](_0x81c080);}return null;};}function patchUpdates(_0x5578fe){return function(_0x13884d){try{jsonpatch['apply'](_0x13884d,_0x5578fe,!![]);}catch(_0x5c7b0a){return BPromise[_0x25ea('0x23')](_0x5c7b0a);}return _0x13884d['save']();};}function saveUpdates(_0x3f89a9,_0x3fdde6){return function(_0x445100){if(_0x445100){return _0x445100[_0x25ea('0x24')](_0x3f89a9)['then'](function(_0x56d5ee){return _0x56d5ee;});}return null;};}function removeEntity(_0x35fee2,_0xf34d84){return function(_0x4ee5e6){if(_0x4ee5e6){return _0x4ee5e6[_0x25ea('0x25')]()[_0x25ea('0x26')](function(){_0x35fee2['status'](0xcc)[_0x25ea('0x1b')]();});}};}function handleEntityNotFound(_0x2b5351,_0x5b9780){return function(_0x260e8a){if(!_0x260e8a){_0x2b5351[_0x25ea('0x1a')](0x194);}return _0x260e8a;};}function handleError(_0x2fe961,_0x39de65){_0x39de65=_0x39de65||0x1f4;return function(_0x20c65b){logger[_0x25ea('0x27')](_0x20c65b[_0x25ea('0x28')]);if(_0x20c65b[_0x25ea('0x29')]){delete _0x20c65b[_0x25ea('0x29')];}_0x2fe961[_0x25ea('0x1c')](_0x39de65)[_0x25ea('0x2a')](_0x20c65b);};}exports[_0x25ea('0x2b')]=function(_0x46520a,_0x55020d){var _0x4cb7a5={},_0x3599c3={},_0x21c4fc={'count':0x0,'rows':[]};var _0x576f56=_[_0x25ea('0x2c')](db[_0x25ea('0x2d')][_0x25ea('0x2e')],function(_0x5e47a8){return{'name':_0x5e47a8['fieldName'],'type':_0x5e47a8[_0x25ea('0x2f')][_0x25ea('0x30')]};});_0x3599c3['model']=_[_0x25ea('0x2c')](_0x576f56,_0x25ea('0x29'));_0x3599c3['query']=_[_0x25ea('0x31')](_0x46520a[_0x25ea('0x32')]);_0x3599c3[_0x25ea('0x33')]=_[_0x25ea('0x34')](_0x3599c3['model'],_0x3599c3[_0x25ea('0x32')]);_0x4cb7a5['attributes']=_[_0x25ea('0x34')](_0x3599c3[_0x25ea('0x35')],qs[_0x25ea('0x36')](_0x46520a[_0x25ea('0x32')]['fields']));_0x4cb7a5['attributes']=_0x4cb7a5[_0x25ea('0x37')]['length']?_0x4cb7a5[_0x25ea('0x37')]:_0x3599c3[_0x25ea('0x35')];if(!_0x46520a['query'][_0x25ea('0x38')]('nolimit')){_0x4cb7a5['limit']=qs[_0x25ea('0x20')](_0x46520a[_0x25ea('0x32')][_0x25ea('0x20')]);_0x4cb7a5[_0x25ea('0x1e')]=qs[_0x25ea('0x1e')](_0x46520a[_0x25ea('0x32')]['offset']);}_0x4cb7a5['order']=qs['sort'](_0x46520a[_0x25ea('0x32')][_0x25ea('0x39')]);_0x4cb7a5[_0x25ea('0x3a')]=qs[_0x25ea('0x33')](_[_0x25ea('0x3b')](_0x46520a['query'],_0x3599c3[_0x25ea('0x33')]),_0x576f56);if(_0x46520a[_0x25ea('0x32')][_0x25ea('0x3c')]){_0x4cb7a5[_0x25ea('0x3a')]=_[_0x25ea('0x3d')](_0x4cb7a5['where'],{'$or':_[_0x25ea('0x2c')](_0x576f56,function(_0x29d456){if(_0x29d456[_0x25ea('0x2f')]!==_0x25ea('0x3e')){var _0x27e7e1={};_0x27e7e1[_0x29d456[_0x25ea('0x29')]]={'$like':'%'+_0x46520a[_0x25ea('0x32')][_0x25ea('0x3c')]+'%'};return _0x27e7e1;}})});}_0x4cb7a5=_[_0x25ea('0x3d')]({},_0x4cb7a5,_0x46520a[_0x25ea('0x3f')]);var _0x521905={'where':_0x4cb7a5[_0x25ea('0x3a')]};return db[_0x25ea('0x2d')][_0x25ea('0x21')](_0x521905)[_0x25ea('0x26')](function(_0x152179){_0x21c4fc[_0x25ea('0x21')]=_0x152179;if(_0x46520a[_0x25ea('0x32')][_0x25ea('0x40')]){_0x4cb7a5[_0x25ea('0x41')]=[{'all':!![]}];}return db[_0x25ea('0x2d')][_0x25ea('0x42')](_0x4cb7a5);})['then'](function(_0x12e85a){_0x21c4fc[_0x25ea('0x43')]=_0x12e85a;return _0x21c4fc;})['then'](respondWithFilteredResult(_0x55020d,_0x4cb7a5))[_0x25ea('0x44')](handleError(_0x55020d,null));};exports[_0x25ea('0x45')]=function(_0x77f88f,_0xf5cb77){var _0x62acdb={'raw':!![],'where':{'id':_0x77f88f[_0x25ea('0x46')]['id']}},_0x307cc8={};_0x307cc8[_0x25ea('0x35')]=_[_0x25ea('0x31')](db[_0x25ea('0x2d')][_0x25ea('0x2e')]);_0x307cc8[_0x25ea('0x32')]=_[_0x25ea('0x31')](_0x77f88f[_0x25ea('0x32')]);_0x307cc8[_0x25ea('0x33')]=_['intersection'](_0x307cc8[_0x25ea('0x35')],_0x307cc8[_0x25ea('0x32')]);_0x62acdb[_0x25ea('0x37')]=_[_0x25ea('0x34')](_0x307cc8[_0x25ea('0x35')],qs[_0x25ea('0x36')](_0x77f88f[_0x25ea('0x32')][_0x25ea('0x36')]));_0x62acdb[_0x25ea('0x37')]=_0x62acdb['attributes'][_0x25ea('0x47')]?_0x62acdb['attributes']:_0x307cc8[_0x25ea('0x35')];if(_0x77f88f[_0x25ea('0x32')][_0x25ea('0x40')]){_0x62acdb[_0x25ea('0x41')]=[{'all':!![]}];}_0x62acdb=_[_0x25ea('0x3d')]({},_0x62acdb,_0x77f88f[_0x25ea('0x3f')]);return db[_0x25ea('0x2d')][_0x25ea('0x48')](_0x62acdb)['then'](handleEntityNotFound(_0xf5cb77,null))[_0x25ea('0x26')](respondWithResult(_0xf5cb77,null))['catch'](handleError(_0xf5cb77,null));};exports[_0x25ea('0x49')]=function(_0x2c7b1d,_0x2e2ec6){return db[_0x25ea('0x2d')][_0x25ea('0x49')](_0x2c7b1d[_0x25ea('0x4a')],{})[_0x25ea('0x26')](respondWithResult(_0x2e2ec6,0xc9))['catch'](handleError(_0x2e2ec6,null));};exports[_0x25ea('0x24')]=function(_0x3d1590,_0x517fb0){if(_0x3d1590[_0x25ea('0x4a')]['id']){delete _0x3d1590['body']['id'];}return db[_0x25ea('0x2d')][_0x25ea('0x48')]({'where':{'id':_0x3d1590[_0x25ea('0x46')]['id']}})[_0x25ea('0x26')](handleEntityNotFound(_0x517fb0,null))[_0x25ea('0x26')](saveUpdates(_0x3d1590['body'],null))['then'](respondWithResult(_0x517fb0,null))[_0x25ea('0x44')](handleError(_0x517fb0,null));};exports[_0x25ea('0x25')]=function(_0x3e5ff4,_0x2e8d3c){return db[_0x25ea('0x2d')][_0x25ea('0x48')]({'where':{'id':_0x3e5ff4[_0x25ea('0x46')]['id']}})[_0x25ea('0x26')](handleEntityNotFound(_0x2e8d3c,null))[_0x25ea('0x26')](removeEntity(_0x2e8d3c,null))[_0x25ea('0x44')](handleError(_0x2e8d3c,null));}; \ No newline at end of file +var _0x8761=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','SquareMessage','count','includeAll','include','findAll','rows','params','catch','body','find','rimraf','fast-json-patch','moment','mustache','path'];(function(_0xee741b,_0x10cf16){var _0x9ce0a2=function(_0x196418){while(--_0x196418){_0xee741b['push'](_0xee741b['shift']());}};_0x9ce0a2(++_0x10cf16);}(_0x8761,0x168));var _0x1876=function(_0x3bf23a,_0x221e0a){_0x3bf23a=_0x3bf23a-0x0;var _0x392405=_0x8761[_0x3bf23a];return _0x392405;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1876('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1876('0x1'));var rp=require('request-promise');var moment=require(_0x1876('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1876('0x3'));var util=require('util');var path=require(_0x1876('0x4'));var sox=require(_0x1876('0x5'));var csv=require(_0x1876('0x6'));var ejs=require(_0x1876('0x7'));var fs=require('fs');var fs_extra=require(_0x1876('0x8'));var _=require(_0x1876('0x9'));var squel=require(_0x1876('0xa'));var crypto=require('crypto');var jsforce=require(_0x1876('0xb'));var deskjs=require(_0x1876('0xc'));var toCsv=require(_0x1876('0x6'));var querystring=require(_0x1876('0xd'));var Papa=require(_0x1876('0xe'));var Redis=require(_0x1876('0xf'));var authService=require(_0x1876('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1876('0x11'));var hardwareService=require(_0x1876('0x12'));var logger=require('../../config/logger')(_0x1876('0x13'));var utils=require(_0x1876('0x14'));var config=require(_0x1876('0x15'));var licenseUtil=require(_0x1876('0x16'));var db=require(_0x1876('0x17'))['db'];function respondWithStatusCode(_0x201c72,_0x56c2c1){_0x56c2c1=_0x56c2c1||0xcc;return function(_0x350b78){if(_0x350b78){return _0x201c72[_0x1876('0x18')](_0x56c2c1);}return _0x201c72['status'](_0x56c2c1)[_0x1876('0x19')]();};}function respondWithResult(_0x42bc3b,_0x115378){_0x115378=_0x115378||0xc8;return function(_0x1c5b88){if(_0x1c5b88){return _0x42bc3b[_0x1876('0x1a')](_0x115378)[_0x1876('0x1b')](_0x1c5b88);}};}function respondWithFilteredResult(_0x46db73,_0x5ca615){return function(_0x3d486d){if(_0x3d486d){var _0x332275=typeof _0x5ca615[_0x1876('0x1c')]===_0x1876('0x1d')&&typeof _0x5ca615[_0x1876('0x1e')]==='undefined';var _0x13555e=_0x3d486d['count'];var _0x3925cc=_0x332275?0x0:_0x5ca615['offset'];var _0x335ca9=_0x332275?_0x3d486d['count']:_0x5ca615[_0x1876('0x1c')]+_0x5ca615[_0x1876('0x1e')];var _0x248480;if(_0x335ca9>=_0x13555e){_0x335ca9=_0x13555e;_0x248480=0xc8;}else{_0x248480=0xce;}_0x46db73['status'](_0x248480);return _0x46db73[_0x1876('0x1f')](_0x1876('0x20'),_0x3925cc+'-'+_0x335ca9+'/'+_0x13555e)[_0x1876('0x1b')](_0x3d486d);}return null;};}function patchUpdates(_0x403264){return function(_0x2b2e42){try{jsonpatch[_0x1876('0x21')](_0x2b2e42,_0x403264,!![]);}catch(_0x33ffae){return BPromise[_0x1876('0x22')](_0x33ffae);}return _0x2b2e42[_0x1876('0x23')]();};}function saveUpdates(_0xdd2601,_0x3bd8a0){return function(_0x29fe7c){if(_0x29fe7c){return _0x29fe7c[_0x1876('0x24')](_0xdd2601)[_0x1876('0x25')](function(_0x49cdfe){return _0x49cdfe;});}return null;};}function removeEntity(_0x2a99f7,_0x193178){return function(_0x2a1379){if(_0x2a1379){return _0x2a1379[_0x1876('0x26')]()[_0x1876('0x25')](function(){_0x2a99f7[_0x1876('0x1a')](0xcc)[_0x1876('0x19')]();});}};}function handleEntityNotFound(_0x4bbf26,_0x44ac39){return function(_0x198965){if(!_0x198965){_0x4bbf26[_0x1876('0x18')](0x194);}return _0x198965;};}function handleError(_0x981cac,_0x203d29){_0x203d29=_0x203d29||0x1f4;return function(_0x101040){logger[_0x1876('0x27')](_0x101040[_0x1876('0x28')]);if(_0x101040[_0x1876('0x29')]){delete _0x101040[_0x1876('0x29')];}_0x981cac['status'](_0x203d29)['send'](_0x101040);};}exports[_0x1876('0x2a')]=function(_0x25d8d8,_0x44ce25){var _0x538e55={},_0x5345d0={},_0x11bc03={'count':0x0,'rows':[]};var _0x3edde7=_[_0x1876('0x2b')](db['SquareMessage']['rawAttributes'],function(_0x3325f1){return{'name':_0x3325f1[_0x1876('0x2c')],'type':_0x3325f1[_0x1876('0x2d')][_0x1876('0x2e')]};});_0x5345d0[_0x1876('0x2f')]=_[_0x1876('0x2b')](_0x3edde7,'name');_0x5345d0[_0x1876('0x30')]=_[_0x1876('0x31')](_0x25d8d8['query']);_0x5345d0[_0x1876('0x32')]=_[_0x1876('0x33')](_0x5345d0['model'],_0x5345d0[_0x1876('0x30')]);_0x538e55['attributes']=_[_0x1876('0x33')](_0x5345d0[_0x1876('0x2f')],qs[_0x1876('0x34')](_0x25d8d8['query'][_0x1876('0x34')]));_0x538e55['attributes']=_0x538e55[_0x1876('0x35')][_0x1876('0x36')]?_0x538e55['attributes']:_0x5345d0['model'];if(!_0x25d8d8[_0x1876('0x30')][_0x1876('0x37')](_0x1876('0x38'))){_0x538e55[_0x1876('0x1e')]=qs[_0x1876('0x1e')](_0x25d8d8[_0x1876('0x30')]['limit']);_0x538e55[_0x1876('0x1c')]=qs[_0x1876('0x1c')](_0x25d8d8[_0x1876('0x30')]['offset']);}_0x538e55['order']=qs['sort'](_0x25d8d8[_0x1876('0x30')][_0x1876('0x39')]);_0x538e55[_0x1876('0x3a')]=qs[_0x1876('0x32')](_[_0x1876('0x3b')](_0x25d8d8[_0x1876('0x30')],_0x5345d0['filters']),_0x3edde7);if(_0x25d8d8[_0x1876('0x30')][_0x1876('0x3c')]){_0x538e55[_0x1876('0x3a')]=_[_0x1876('0x3d')](_0x538e55[_0x1876('0x3a')],{'$or':_['map'](_0x3edde7,function(_0x518b3b){if(_0x518b3b['type']!==_0x1876('0x3e')){var _0x828b07={};_0x828b07[_0x518b3b[_0x1876('0x29')]]={'$like':'%'+_0x25d8d8['query'][_0x1876('0x3c')]+'%'};return _0x828b07;}})});}_0x538e55=_[_0x1876('0x3d')]({},_0x538e55,_0x25d8d8['options']);var _0x54e6fe={'where':_0x538e55['where']};return db[_0x1876('0x3f')][_0x1876('0x40')](_0x54e6fe)[_0x1876('0x25')](function(_0x2ee187){_0x11bc03[_0x1876('0x40')]=_0x2ee187;if(_0x25d8d8[_0x1876('0x30')][_0x1876('0x41')]){_0x538e55[_0x1876('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0x1876('0x43')](_0x538e55);})[_0x1876('0x25')](function(_0x14315f){_0x11bc03[_0x1876('0x44')]=_0x14315f;return _0x11bc03;})[_0x1876('0x25')](respondWithFilteredResult(_0x44ce25,_0x538e55))['catch'](handleError(_0x44ce25,null));};exports['show']=function(_0xefe5f5,_0x2adbe3){var _0x2f4b3a={'raw':!![],'where':{'id':_0xefe5f5[_0x1876('0x45')]['id']}},_0x408eea={};_0x408eea[_0x1876('0x2f')]=_[_0x1876('0x31')](db['SquareMessage']['rawAttributes']);_0x408eea['query']=_[_0x1876('0x31')](_0xefe5f5[_0x1876('0x30')]);_0x408eea['filters']=_[_0x1876('0x33')](_0x408eea[_0x1876('0x2f')],_0x408eea[_0x1876('0x30')]);_0x2f4b3a[_0x1876('0x35')]=_[_0x1876('0x33')](_0x408eea[_0x1876('0x2f')],qs[_0x1876('0x34')](_0xefe5f5[_0x1876('0x30')][_0x1876('0x34')]));_0x2f4b3a[_0x1876('0x35')]=_0x2f4b3a[_0x1876('0x35')][_0x1876('0x36')]?_0x2f4b3a[_0x1876('0x35')]:_0x408eea['model'];if(_0xefe5f5[_0x1876('0x30')][_0x1876('0x41')]){_0x2f4b3a[_0x1876('0x42')]=[{'all':!![]}];}_0x2f4b3a=_[_0x1876('0x3d')]({},_0x2f4b3a,_0xefe5f5['options']);return db[_0x1876('0x3f')]['find'](_0x2f4b3a)['then'](handleEntityNotFound(_0x2adbe3,null))[_0x1876('0x25')](respondWithResult(_0x2adbe3,null))[_0x1876('0x46')](handleError(_0x2adbe3,null));};exports['create']=function(_0x280ca3,_0x690f39){return db['SquareMessage']['create'](_0x280ca3[_0x1876('0x47')],{})[_0x1876('0x25')](respondWithResult(_0x690f39,0xc9))[_0x1876('0x46')](handleError(_0x690f39,null));};exports[_0x1876('0x24')]=function(_0x1bca06,_0x572ce1){if(_0x1bca06[_0x1876('0x47')]['id']){delete _0x1bca06[_0x1876('0x47')]['id'];}return db[_0x1876('0x3f')][_0x1876('0x48')]({'where':{'id':_0x1bca06[_0x1876('0x45')]['id']}})['then'](handleEntityNotFound(_0x572ce1,null))[_0x1876('0x25')](saveUpdates(_0x1bca06[_0x1876('0x47')],null))[_0x1876('0x25')](respondWithResult(_0x572ce1,null))['catch'](handleError(_0x572ce1,null));};exports[_0x1876('0x26')]=function(_0x570ce0,_0x5553c7){return db['SquareMessage'][_0x1876('0x48')]({'where':{'id':_0x570ce0[_0x1876('0x45')]['id']}})['then'](handleEntityNotFound(_0x5553c7,null))[_0x1876('0x25')](removeEntity(_0x5553c7,null))[_0x1876('0x46')](handleError(_0x5553c7,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f52d055..bd9c1c8 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 _0xf17d=['request-promise','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','../../config/logger','api','bluebird'];(function(_0x51e1ac,_0x3004af){var _0x42b479=function(_0x2f3c16){while(--_0x2f3c16){_0x51e1ac['push'](_0x51e1ac['shift']());}};_0x42b479(++_0x3004af);}(_0xf17d,0xa2));var _0xdf17=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf17d[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf17('0x0'))(_0xdf17('0x1'));var moment=require('moment');var BPromise=require(_0xdf17('0x2'));var rp=require(_0xdf17('0x3'));var fs=require('fs');var path=require(_0xdf17('0x4'));var rimraf=require(_0xdf17('0x5'));var config=require('../../config/environment');var attributes=require(_0xdf17('0x6'));module[_0xdf17('0x7')]=function(_0x49dd50,_0x2dee05){return _0x49dd50[_0xdf17('0x8')](_0xdf17('0x9'),attributes,{'tableName':_0xdf17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6360=['request-promise','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','util','../../config/logger','bluebird'];(function(_0x2c09b0,_0x4c457a){var _0x560005=function(_0x366c79){while(--_0x366c79){_0x2c09b0['push'](_0x2c09b0['shift']());}};_0x560005(++_0x4c457a);}(_0x6360,0x147));var _0x0636=function(_0x200812,_0x116358){_0x200812=_0x200812-0x0;var _0x3c8799=_0x6360[_0x200812];return _0x3c8799;};'use strict';var _=require('lodash');var util=require(_0x0636('0x0'));var logger=require(_0x0636('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0636('0x2'));var rp=require(_0x0636('0x3'));var fs=require('fs');var path=require(_0x0636('0x4'));var rimraf=require(_0x0636('0x5'));var config=require('../../config/environment');var attributes=require(_0x0636('0x6'));module[_0x0636('0x7')]=function(_0x4b2f98,_0x51a1be){return _0x4b2f98[_0x0636('0x8')](_0x0636('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index b46b94a..6e86b7a 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 _0x7341=['request\x20sent','stringify','error','code','message','result','SquareMessage','create','CreateSquareMessage','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4e7fd0,_0x29cccd){var _0x1de972=function(_0x430190){while(--_0x430190){_0x4e7fd0['push'](_0x4e7fd0['shift']());}};_0x1de972(++_0x29cccd);}(_0x7341,0xe2));var _0x1734=function(_0x563e60,_0x3c3e32){_0x563e60=_0x563e60-0x0;var _0x5855d1=_0x7341[_0x563e60];return _0x5855d1;};'use strict';var _=require(_0x1734('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1734('0x1'));var rs=require(_0x1734('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1734('0x3'))['db'];var utils=require(_0x1734('0x4'));var logger=require(_0x1734('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1734('0x6'));var client=jayson[_0x1734('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc88a1,_0x42e4ec,_0x124cd2){return new BPromise(function(_0x3177bf,_0x3974c2){return client[_0x1734('0x8')](_0xbc88a1,_0x124cd2)[_0x1734('0x9')](function(_0x36c038){logger[_0x1734('0xa')](_0x1734('0xb'),_0x42e4ec,'request\x20sent');logger[_0x1734('0xc')](_0x1734('0xd'),_0x42e4ec,_0x1734('0xe'),JSON[_0x1734('0xf')](_0x36c038));if(_0x36c038['error']){if(_0x36c038[_0x1734('0x10')][_0x1734('0x11')]===0x1f4){logger[_0x1734('0x10')](_0x1734('0xb'),_0x42e4ec,_0x36c038[_0x1734('0x10')][_0x1734('0x12')]);return _0x3974c2(_0x36c038[_0x1734('0x10')][_0x1734('0x12')]);}logger[_0x1734('0x10')](_0x1734('0xb'),_0x42e4ec,_0x36c038[_0x1734('0x10')][_0x1734('0x12')]);return _0x3177bf(_0x36c038[_0x1734('0x10')][_0x1734('0x12')]);}else{logger[_0x1734('0xa')](_0x1734('0xb'),_0x42e4ec,_0x1734('0xe'));_0x3177bf(_0x36c038[_0x1734('0x13')][_0x1734('0x12')]);}})['catch'](function(_0x25340){logger[_0x1734('0x10')]('SquareMessage,\x20%s,\x20%s',_0x42e4ec,_0x25340);_0x3974c2(_0x25340);});});}exports['CreateSquareMessage']=function(_0x4350ab){var _0x18d4ca=this;return new Promise(function(_0x36ce14,_0x1c9b51){return db[_0x1734('0x14')][_0x1734('0x15')](_0x4350ab['body'],{'raw':_0x4350ab['options']?_0x4350ab['options']['raw']===undefined?!![]:![]:!![]})[_0x1734('0x9')](function(_0x46609e){logger[_0x1734('0xa')](_0x1734('0x16'),_0x4350ab);logger[_0x1734('0xc')](_0x1734('0x16'),_0x4350ab,JSON[_0x1734('0xf')](_0x46609e));_0x36ce14(_0x46609e);})[_0x1734('0x17')](function(_0x265795){logger[_0x1734('0x10')](_0x1734('0x16'),_0x265795[_0x1734('0x12')],_0x4350ab);_0x1c9b51(_0x18d4ca[_0x1734('0x10')](0x1f4,_0x265795[_0x1734('0x12')]));});});}; \ No newline at end of file +var _0x3b1c=['options','raw','CreateSquareMessage','catch','lodash','util','moment','bluebird','../../config/utils','rpc','client','http','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','result','create'];(function(_0x58395f,_0x2541ea){var _0x3d6f20=function(_0x4f5c2c){while(--_0x4f5c2c){_0x58395f['push'](_0x58395f['shift']());}};_0x3d6f20(++_0x2541ea);}(_0x3b1c,0x1e7));var _0xc3b1=function(_0x64af2e,_0x5a794d){_0x64af2e=_0x64af2e-0x0;var _0x5bec32=_0x3b1c[_0x64af2e];return _0x5bec32;};'use strict';var _=require(_0xc3b1('0x0'));var util=require(_0xc3b1('0x1'));var moment=require(_0xc3b1('0x2'));var BPromise=require(_0xc3b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc3b1('0x4'));var logger=require('../../config/logger')(_0xc3b1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc3b1('0x6')][_0xc3b1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4368d7,_0x10b95c,_0x27452e){return new BPromise(function(_0x2dd9aa,_0x2a9c1e){return client['request'](_0x4368d7,_0x27452e)['then'](function(_0x3b2e30){logger[_0xc3b1('0x8')]('SquareMessage,\x20%s,\x20%s',_0x10b95c,_0xc3b1('0x9'));logger[_0xc3b1('0xa')](_0xc3b1('0xb'),_0x10b95c,_0xc3b1('0x9'),JSON[_0xc3b1('0xc')](_0x3b2e30));if(_0x3b2e30['error']){if(_0x3b2e30[_0xc3b1('0xd')][_0xc3b1('0xe')]===0x1f4){logger[_0xc3b1('0xd')]('SquareMessage,\x20%s,\x20%s',_0x10b95c,_0x3b2e30[_0xc3b1('0xd')][_0xc3b1('0xf')]);return _0x2a9c1e(_0x3b2e30[_0xc3b1('0xd')][_0xc3b1('0xf')]);}logger[_0xc3b1('0xd')](_0xc3b1('0x10'),_0x10b95c,_0x3b2e30['error']['message']);return _0x2dd9aa(_0x3b2e30[_0xc3b1('0xd')][_0xc3b1('0xf')]);}else{logger[_0xc3b1('0x8')](_0xc3b1('0x10'),_0x10b95c,_0xc3b1('0x9'));_0x2dd9aa(_0x3b2e30[_0xc3b1('0x11')][_0xc3b1('0xf')]);}})['catch'](function(_0x131a9c){logger[_0xc3b1('0xd')]('SquareMessage,\x20%s,\x20%s',_0x10b95c,_0x131a9c);_0x2a9c1e(_0x131a9c);});});}exports['CreateSquareMessage']=function(_0x3280f5){var _0x4dd17d=this;return new Promise(function(_0x479fb7,_0x1af068){return db['SquareMessage'][_0xc3b1('0x12')](_0x3280f5['body'],{'raw':_0x3280f5[_0xc3b1('0x13')]?_0x3280f5[_0xc3b1('0x13')][_0xc3b1('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x1c74c6){logger[_0xc3b1('0x8')](_0xc3b1('0x15'),_0x3280f5);logger['debug'](_0xc3b1('0x15'),_0x3280f5,JSON[_0xc3b1('0xc')](_0x1c74c6));_0x479fb7(_0x1c74c6);})[_0xc3b1('0x16')](function(_0x18daaf){logger['error'](_0xc3b1('0x15'),_0x18daaf['message'],_0x3280f5);_0x1af068(_0x4dd17d[_0xc3b1('0xd')](0x1f4,_0x18daaf['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 2d5a5d5..5ff268a 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 _0xbcb9=['./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s','test','post','create','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xad50b,_0x37a971){var _0x1c643d=function(_0x15712e){while(--_0x15712e){_0xad50b['push'](_0xad50b['shift']());}};_0x1c643d(++_0x37a971);}(_0xbcb9,0x1dc));var _0x9bcb=function(_0x402ec9,_0xd2b9f9){_0x402ec9=_0x402ec9-0x0;var _0x507158=_0xbcb9[_0x402ec9];return _0x507158;};'use strict';var multer=require(_0x9bcb('0x0'));var util=require('util');var path=require(_0x9bcb('0x1'));var timeout=require(_0x9bcb('0x2'));var express=require(_0x9bcb('0x3'));var router=express[_0x9bcb('0x4')]();var fs_extra=require(_0x9bcb('0x5'));var auth=require(_0x9bcb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9bcb('0x7'));router[_0x9bcb('0x8')]('/',auth[_0x9bcb('0x9')](),controller[_0x9bcb('0xa')]);router['get']('/:id',auth[_0x9bcb('0x9')](),controller[_0x9bcb('0xb')]);router[_0x9bcb('0x8')](_0x9bcb('0xc'),auth[_0x9bcb('0x9')](),timeout(_0x9bcb('0xd')),controller[_0x9bcb('0xe')]);router[_0x9bcb('0xf')]('/',auth[_0x9bcb('0x9')](),controller[_0x9bcb('0x10')]);router['put'](_0x9bcb('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x9bcb('0x12')](_0x9bcb('0x11'),auth['isAuthenticated'](),controller[_0x9bcb('0x13')]);module[_0x9bcb('0x14')]=router; \ No newline at end of file +var _0x36d4=['put','/:id','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','show','/:id/test','15s','test','post','create'];(function(_0x486f1d,_0x90c2b5){var _0x5a2c2d=function(_0x1a5f79){while(--_0x1a5f79){_0x486f1d['push'](_0x486f1d['shift']());}};_0x5a2c2d(++_0x90c2b5);}(_0x36d4,0x15a));var _0x436d=function(_0x4940d0,_0x1142ad){_0x4940d0=_0x4940d0-0x0;var _0x53354b=_0x36d4[_0x4940d0];return _0x53354b;};'use strict';var multer=require(_0x436d('0x0'));var util=require('util');var path=require(_0x436d('0x1'));var timeout=require(_0x436d('0x2'));var express=require('express');var router=express[_0x436d('0x3')]();var fs_extra=require(_0x436d('0x4'));var auth=require(_0x436d('0x5'));var interaction=require(_0x436d('0x6'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router['get']('/',auth[_0x436d('0x7')](),controller['index']);router[_0x436d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x436d('0x9')]);router['get'](_0x436d('0xa'),auth[_0x436d('0x7')](),timeout(_0x436d('0xb')),controller[_0x436d('0xc')]);router[_0x436d('0xd')]('/',auth[_0x436d('0x7')](),controller[_0x436d('0xe')]);router[_0x436d('0xf')](_0x436d('0x10'),auth[_0x436d('0x7')](),controller[_0x436d('0x11')]);router[_0x436d('0x12')]('/:id',auth[_0x436d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index da9f723..1d3d8aa 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 _0x411d=['exports','STRING','name','sequelize'];(function(_0x47e70e,_0x4b6911){var _0x2468ef=function(_0xedd248){while(--_0xedd248){_0x47e70e['push'](_0x47e70e['shift']());}};_0x2468ef(++_0x4b6911);}(_0x411d,0xb7));var _0xd411=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x411d[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xd411('0x0'));module[_0xd411('0x1')]={'name':{'type':Sequelize[_0xd411('0x2')],'unique':_0xd411('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd411('0x2')]},'description':{'type':Sequelize[_0xd411('0x2')]}}; \ No newline at end of file +var _0xd488=['sequelize','name','STRING'];(function(_0x3b1068,_0xb4da47){var _0x1e305e=function(_0x3d2b10){while(--_0x3d2b10){_0x3b1068['push'](_0x3b1068['shift']());}};_0x1e305e(++_0xb4da47);}(_0xd488,0x12c));var _0x8d48=function(_0x8b69e9,_0x1407f9){_0x8b69e9=_0x8b69e9-0x0;var _0x485d2d=_0xd488[_0x8b69e9];return _0x485d2d;};'use strict';var Sequelize=require(_0x8d48('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8d48('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8d48('0x2')]},'description':{'type':Sequelize[_0x8d48('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b6dead4..195e0d8 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 _0x58f6=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring'];(function(_0x45bb22,_0x10db4d){var _0x439f64=function(_0x206988){while(--_0x206988){_0x45bb22['push'](_0x45bb22['shift']());}};_0x439f64(++_0x10db4d);}(_0x58f6,0x1e5));var _0x658f=function(_0x2ac104,_0xbe9850){_0x2ac104=_0x2ac104-0x0;var _0x19d241=_0x58f6[_0x2ac104];return _0x19d241;};'use strict';var emlformat=require(_0x658f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x658f('0x1'));var BPromise=require(_0x658f('0x2'));var Mustache=require(_0x658f('0x3'));var util=require('util');var path=require(_0x658f('0x4'));var sox=require(_0x658f('0x5'));var csv=require(_0x658f('0x6'));var ejs=require(_0x658f('0x7'));var fs=require('fs');var fs_extra=require(_0x658f('0x8'));var _=require(_0x658f('0x9'));var squel=require('squel');var crypto=require(_0x658f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x658f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x658f('0xc'));var Papa=require(_0x658f('0xd'));var Redis=require(_0x658f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x658f('0xf'));var as=require(_0x658f('0x10'));var hardwareService=require(_0x658f('0x11'));var logger=require(_0x658f('0x12'))(_0x658f('0x13'));var utils=require(_0x658f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x658f('0x15'));var db=require(_0x658f('0x16'))['db'];function respondWithStatusCode(_0x3fd221,_0x2220f2){_0x2220f2=_0x2220f2||0xcc;return function(_0x4242a6){if(_0x4242a6){return _0x3fd221[_0x658f('0x17')](_0x2220f2);}return _0x3fd221[_0x658f('0x18')](_0x2220f2)[_0x658f('0x19')]();};}function respondWithResult(_0x18c4b9,_0x2f9f69){_0x2f9f69=_0x2f9f69||0xc8;return function(_0x136a3d){if(_0x136a3d){return _0x18c4b9[_0x658f('0x18')](_0x2f9f69)['json'](_0x136a3d);}};}function respondWithFilteredResult(_0x3b6c56,_0x44603a){return function(_0xa870dc){if(_0xa870dc){var _0x263978=typeof _0x44603a['offset']==='undefined'&&typeof _0x44603a[_0x658f('0x1a')]==='undefined';var _0x3f486e=_0xa870dc[_0x658f('0x1b')];var _0x483fcd=_0x263978?0x0:_0x44603a[_0x658f('0x1c')];var _0x5bac8b=_0x263978?_0xa870dc[_0x658f('0x1b')]:_0x44603a[_0x658f('0x1c')]+_0x44603a[_0x658f('0x1a')];var _0x4cf70a;if(_0x5bac8b>=_0x3f486e){_0x5bac8b=_0x3f486e;_0x4cf70a=0xc8;}else{_0x4cf70a=0xce;}_0x3b6c56[_0x658f('0x18')](_0x4cf70a);return _0x3b6c56['set'](_0x658f('0x1d'),_0x483fcd+'-'+_0x5bac8b+'/'+_0x3f486e)[_0x658f('0x1e')](_0xa870dc);}return null;};}function patchUpdates(_0x319948){return function(_0x53b8c2){try{jsonpatch[_0x658f('0x1f')](_0x53b8c2,_0x319948,!![]);}catch(_0xd68577){return BPromise[_0x658f('0x20')](_0xd68577);}return _0x53b8c2[_0x658f('0x21')]();};}function saveUpdates(_0x3682b3,_0x70987){return function(_0x2a1918){if(_0x2a1918){return _0x2a1918[_0x658f('0x22')](_0x3682b3)['then'](function(_0x48bab3){return _0x48bab3;});}return null;};}function removeEntity(_0x110194,_0x4517a3){return function(_0x5d9fe4){if(_0x5d9fe4){return _0x5d9fe4[_0x658f('0x23')]()[_0x658f('0x24')](function(){var _0x31b37f=_0x5d9fe4[_0x658f('0x25')]({'plain':!![]});var _0xd72910='ODBC';return db[_0x658f('0x26')]['destroy']({'where':{'type':_0xd72910,'resourceId':_0x31b37f['id']}})['then'](function(){return _0x5d9fe4;});})[_0x658f('0x24')](function(){_0x110194[_0x658f('0x18')](0xcc)[_0x658f('0x19')]();});}};}function handleEntityNotFound(_0x3e6d0d,_0x25f215){return function(_0x2b4325){if(!_0x2b4325){_0x3e6d0d[_0x658f('0x17')](0x194);}return _0x2b4325;};}function handleError(_0x4fb1f9,_0x4e35f2){_0x4e35f2=_0x4e35f2||0x1f4;return function(_0x3abadf){logger[_0x658f('0x27')](_0x3abadf[_0x658f('0x28')]);if(_0x3abadf[_0x658f('0x29')]){delete _0x3abadf[_0x658f('0x29')];}_0x4fb1f9[_0x658f('0x18')](_0x4e35f2)[_0x658f('0x2a')](_0x3abadf);};}exports[_0x658f('0x2b')]=function(_0x238e43,_0x17ee3c){var _0x59ba89={},_0x9d16c3={},_0x486418={'count':0x0,'rows':[]};var _0x3ed88e=_['map'](db[_0x658f('0x2c')][_0x658f('0x2d')],function(_0x18a010){return{'name':_0x18a010[_0x658f('0x2e')],'type':_0x18a010[_0x658f('0x2f')]['key']};});_0x9d16c3[_0x658f('0x30')]=_['map'](_0x3ed88e,_0x658f('0x29'));_0x9d16c3[_0x658f('0x31')]=_[_0x658f('0x32')](_0x238e43['query']);_0x9d16c3[_0x658f('0x33')]=_[_0x658f('0x34')](_0x9d16c3[_0x658f('0x30')],_0x9d16c3['query']);_0x59ba89[_0x658f('0x35')]=_[_0x658f('0x34')](_0x9d16c3['model'],qs[_0x658f('0x36')](_0x238e43['query'][_0x658f('0x36')]));_0x59ba89[_0x658f('0x35')]=_0x59ba89[_0x658f('0x35')]['length']?_0x59ba89['attributes']:_0x9d16c3['model'];if(!_0x238e43[_0x658f('0x31')][_0x658f('0x37')](_0x658f('0x38'))){_0x59ba89[_0x658f('0x1a')]=qs['limit'](_0x238e43[_0x658f('0x31')][_0x658f('0x1a')]);_0x59ba89[_0x658f('0x1c')]=qs[_0x658f('0x1c')](_0x238e43[_0x658f('0x31')][_0x658f('0x1c')]);}_0x59ba89[_0x658f('0x39')]=qs[_0x658f('0x3a')](_0x238e43[_0x658f('0x31')][_0x658f('0x3a')]);_0x59ba89[_0x658f('0x3b')]=qs[_0x658f('0x33')](_[_0x658f('0x3c')](_0x238e43[_0x658f('0x31')],_0x9d16c3[_0x658f('0x33')]),_0x3ed88e);if(_0x238e43[_0x658f('0x31')][_0x658f('0x3d')]){_0x59ba89['where']=_[_0x658f('0x3e')](_0x59ba89[_0x658f('0x3b')],{'$or':_['map'](_0x3ed88e,function(_0x407370){if(_0x407370[_0x658f('0x2f')]!=='VIRTUAL'){var _0x5b7575={};_0x5b7575[_0x407370[_0x658f('0x29')]]={'$like':'%'+_0x238e43['query'][_0x658f('0x3d')]+'%'};return _0x5b7575;}})});}_0x59ba89=_[_0x658f('0x3e')]({},_0x59ba89,_0x238e43['options']);var _0x203b4a={'where':_0x59ba89[_0x658f('0x3b')]};return db[_0x658f('0x2c')][_0x658f('0x1b')](_0x203b4a)[_0x658f('0x24')](function(_0x36758d){_0x486418[_0x658f('0x1b')]=_0x36758d;if(_0x238e43[_0x658f('0x31')][_0x658f('0x3f')]){_0x59ba89[_0x658f('0x40')]=[{'all':!![]}];}return db[_0x658f('0x2c')][_0x658f('0x41')](_0x59ba89);})[_0x658f('0x24')](function(_0x59989a){_0x486418[_0x658f('0x42')]=_0x59989a;return _0x486418;})['then'](respondWithFilteredResult(_0x17ee3c,_0x59ba89))['catch'](handleError(_0x17ee3c,null));};exports['show']=function(_0x439676,_0x30bc46){var _0x3af6fa={'raw':!![],'where':{'id':_0x439676[_0x658f('0x43')]['id']}},_0x458c61={};_0x458c61['model']=_[_0x658f('0x32')](db['SquareOdbc'][_0x658f('0x2d')]);_0x458c61[_0x658f('0x31')]=_['keys'](_0x439676[_0x658f('0x31')]);_0x458c61['filters']=_['intersection'](_0x458c61[_0x658f('0x30')],_0x458c61[_0x658f('0x31')]);_0x3af6fa[_0x658f('0x35')]=_[_0x658f('0x34')](_0x458c61[_0x658f('0x30')],qs['fields'](_0x439676[_0x658f('0x31')][_0x658f('0x36')]));_0x3af6fa[_0x658f('0x35')]=_0x3af6fa[_0x658f('0x35')]['length']?_0x3af6fa['attributes']:_0x458c61[_0x658f('0x30')];if(_0x439676['query'][_0x658f('0x3f')]){_0x3af6fa[_0x658f('0x40')]=[{'all':!![]}];}_0x3af6fa=_[_0x658f('0x3e')]({},_0x3af6fa,_0x439676[_0x658f('0x44')]);return db['SquareOdbc'][_0x658f('0x45')](_0x3af6fa)[_0x658f('0x24')](handleEntityNotFound(_0x30bc46,null))[_0x658f('0x24')](respondWithResult(_0x30bc46,null))[_0x658f('0x46')](handleError(_0x30bc46,null));};exports[_0x658f('0x47')]=function(_0x5a4043,_0x69990e){return db[_0x658f('0x2c')][_0x658f('0x47')](_0x5a4043[_0x658f('0x48')],{})[_0x658f('0x24')](function(_0x5fff8){var _0x682ccf=_0x5a4043['user'][_0x658f('0x25')]({'plain':!![]});if(!_0x682ccf)throw new Error(_0x658f('0x49'));if(_0x682ccf['role']===_0x658f('0x4a')){var _0x1b041d=_0x5fff8['get']({'plain':!![]});var _0x38a9c6='ODBC';return db[_0x658f('0x4b')]['find']({'where':{'name':_0x38a9c6,'userProfileId':_0x682ccf[_0x658f('0x4c')]},'raw':!![]})[_0x658f('0x24')](function(_0x43bba8){if(_0x43bba8&&_0x43bba8['autoAssociation']===0x0){return db[_0x658f('0x26')][_0x658f('0x47')]({'name':_0x1b041d['name'],'resourceId':_0x1b041d['id'],'type':_0x43bba8[_0x658f('0x29')],'sectionId':_0x43bba8['id']},{})['then'](function(){return _0x5fff8;});}else{return _0x5fff8;}})[_0x658f('0x46')](function(_0x1a236c){logger[_0x658f('0x27')](_0x658f('0x4d'),_0x1a236c);throw _0x1a236c;});}return _0x5fff8;})[_0x658f('0x24')](respondWithResult(_0x69990e,0xc9))[_0x658f('0x46')](handleError(_0x69990e,null));};exports[_0x658f('0x22')]=function(_0x2d5eee,_0x1962c2){if(_0x2d5eee[_0x658f('0x48')]['id']){delete _0x2d5eee['body']['id'];}return db[_0x658f('0x2c')][_0x658f('0x45')]({'where':{'id':_0x2d5eee[_0x658f('0x43')]['id']}})['then'](handleEntityNotFound(_0x1962c2,null))[_0x658f('0x24')](saveUpdates(_0x2d5eee[_0x658f('0x48')],null))[_0x658f('0x24')](respondWithResult(_0x1962c2,null))[_0x658f('0x46')](handleError(_0x1962c2,null));};exports[_0x658f('0x23')]=function(_0x5b343b,_0x303cf4){return db['SquareOdbc'][_0x658f('0x45')]({'where':{'id':_0x5b343b[_0x658f('0x43')]['id']}})['then'](handleEntityNotFound(_0x303cf4,null))[_0x658f('0x24')](removeEntity(_0x303cf4,null))[_0x658f('0x46')](handleError(_0x303cf4,null));};exports[_0x658f('0x4e')]=function(_0x533e79,_0x4d43e9,_0x4052e3){var _0x487d73;return db[_0x658f('0x2c')][_0x658f('0x45')]({'where':{'id':_0x533e79[_0x658f('0x43')]['id']},'attributes':['id',_0x658f('0x4f')]})['then'](handleEntityNotFound(_0x4d43e9,null))[_0x658f('0x24')](function(_0x1d590f){if(_0x1d590f){var _0x17eb09=require(_0x658f('0x50'))();_0x17eb09[_0x658f('0x51')](_0x1d590f['dsn']);_0x17eb09[_0x658f('0x52')]();return _0x1d590f;}})['then'](respondWithResult(_0x4d43e9,null))[_0x658f('0x46')](handleError(_0x4d43e9,null));}; \ No newline at end of file +var _0x498a=['../../components/parsers/qs','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','rows','catch','show','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2b245d,_0x236a3f){var _0x3d69a1=function(_0x2169b9){while(--_0x2169b9){_0x2b245d['push'](_0x2b245d['shift']());}};_0x3d69a1(++_0x236a3f);}(_0x498a,0x18d));var _0xa498=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x498a[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xa498('0x0'));var rimraf=require(_0xa498('0x1'));var zipdir=require(_0xa498('0x2'));var jsonpatch=require(_0xa498('0x3'));var rp=require(_0xa498('0x4'));var moment=require('moment');var BPromise=require(_0xa498('0x5'));var Mustache=require(_0xa498('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa498('0x7'));var csv=require(_0xa498('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa498('0x9'));var _=require(_0xa498('0xa'));var squel=require('squel');var crypto=require(_0xa498('0xb'));var jsforce=require(_0xa498('0xc'));var deskjs=require(_0xa498('0xd'));var toCsv=require(_0xa498('0x8'));var querystring=require(_0xa498('0xe'));var Papa=require(_0xa498('0xf'));var Redis=require(_0xa498('0x10'));var authService=require(_0xa498('0x11'));var qs=require(_0xa498('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa498('0x13'));var db=require(_0xa498('0x14'))['db'];function respondWithStatusCode(_0x56bc15,_0x477770){_0x477770=_0x477770||0xcc;return function(_0x304b58){if(_0x304b58){return _0x56bc15['sendStatus'](_0x477770);}return _0x56bc15['status'](_0x477770)[_0xa498('0x15')]();};}function respondWithResult(_0x4daef2,_0x49cdb5){_0x49cdb5=_0x49cdb5||0xc8;return function(_0x5be674){if(_0x5be674){return _0x4daef2['status'](_0x49cdb5)[_0xa498('0x16')](_0x5be674);}};}function respondWithFilteredResult(_0x361bfe,_0x1f3890){return function(_0x4a18a9){if(_0x4a18a9){var _0x544acb=typeof _0x1f3890[_0xa498('0x17')]===_0xa498('0x18')&&typeof _0x1f3890[_0xa498('0x19')]==='undefined';var _0x3f3109=_0x4a18a9[_0xa498('0x1a')];var _0x386ac3=_0x544acb?0x0:_0x1f3890['offset'];var _0x7770bc=_0x544acb?_0x4a18a9[_0xa498('0x1a')]:_0x1f3890['offset']+_0x1f3890[_0xa498('0x19')];var _0x394cd9;if(_0x7770bc>=_0x3f3109){_0x7770bc=_0x3f3109;_0x394cd9=0xc8;}else{_0x394cd9=0xce;}_0x361bfe[_0xa498('0x1b')](_0x394cd9);return _0x361bfe[_0xa498('0x1c')](_0xa498('0x1d'),_0x386ac3+'-'+_0x7770bc+'/'+_0x3f3109)[_0xa498('0x16')](_0x4a18a9);}return null;};}function patchUpdates(_0x1537f9){return function(_0x4eb9b2){try{jsonpatch[_0xa498('0x1e')](_0x4eb9b2,_0x1537f9,!![]);}catch(_0x4e3b0d){return BPromise[_0xa498('0x1f')](_0x4e3b0d);}return _0x4eb9b2['save']();};}function saveUpdates(_0x5f3aa3,_0x2ac783){return function(_0x3ad207){if(_0x3ad207){return _0x3ad207[_0xa498('0x20')](_0x5f3aa3)[_0xa498('0x21')](function(_0x6ce1dc){return _0x6ce1dc;});}return null;};}function removeEntity(_0x3ea276,_0x4c75ef){return function(_0x5aa216){if(_0x5aa216){return _0x5aa216['destroy']()['then'](function(){var _0x25a25e=_0x5aa216['get']({'plain':!![]});var _0x43fe95='ODBC';return db['UserProfileResource'][_0xa498('0x22')]({'where':{'type':_0x43fe95,'resourceId':_0x25a25e['id']}})['then'](function(){return _0x5aa216;});})[_0xa498('0x21')](function(){_0x3ea276[_0xa498('0x1b')](0xcc)[_0xa498('0x15')]();});}};}function handleEntityNotFound(_0x4e1992,_0x17ec3e){return function(_0x375b44){if(!_0x375b44){_0x4e1992[_0xa498('0x23')](0x194);}return _0x375b44;};}function handleError(_0x4c599c,_0x597fc2){_0x597fc2=_0x597fc2||0x1f4;return function(_0x26701a){logger[_0xa498('0x24')](_0x26701a['stack']);if(_0x26701a[_0xa498('0x25')]){delete _0x26701a[_0xa498('0x25')];}_0x4c599c['status'](_0x597fc2)[_0xa498('0x26')](_0x26701a);};}exports['index']=function(_0x3ef443,_0x288e1b){var _0x3d6a0d={},_0x44dacb={},_0x483f0e={'count':0x0,'rows':[]};var _0x54f7cd=_['map'](db[_0xa498('0x27')][_0xa498('0x28')],function(_0x3f48c4){return{'name':_0x3f48c4[_0xa498('0x29')],'type':_0x3f48c4[_0xa498('0x2a')][_0xa498('0x2b')]};});_0x44dacb[_0xa498('0x2c')]=_[_0xa498('0x2d')](_0x54f7cd,_0xa498('0x25'));_0x44dacb[_0xa498('0x2e')]=_[_0xa498('0x2f')](_0x3ef443[_0xa498('0x2e')]);_0x44dacb[_0xa498('0x30')]=_[_0xa498('0x31')](_0x44dacb[_0xa498('0x2c')],_0x44dacb['query']);_0x3d6a0d[_0xa498('0x32')]=_['intersection'](_0x44dacb[_0xa498('0x2c')],qs[_0xa498('0x33')](_0x3ef443['query']['fields']));_0x3d6a0d[_0xa498('0x32')]=_0x3d6a0d[_0xa498('0x32')][_0xa498('0x34')]?_0x3d6a0d[_0xa498('0x32')]:_0x44dacb[_0xa498('0x2c')];if(!_0x3ef443[_0xa498('0x2e')]['hasOwnProperty'](_0xa498('0x35'))){_0x3d6a0d['limit']=qs['limit'](_0x3ef443[_0xa498('0x2e')]['limit']);_0x3d6a0d[_0xa498('0x17')]=qs[_0xa498('0x17')](_0x3ef443[_0xa498('0x2e')]['offset']);}_0x3d6a0d[_0xa498('0x36')]=qs['sort'](_0x3ef443[_0xa498('0x2e')][_0xa498('0x37')]);_0x3d6a0d[_0xa498('0x38')]=qs[_0xa498('0x30')](_['pick'](_0x3ef443[_0xa498('0x2e')],_0x44dacb['filters']),_0x54f7cd);if(_0x3ef443[_0xa498('0x2e')][_0xa498('0x39')]){_0x3d6a0d[_0xa498('0x38')]=_[_0xa498('0x3a')](_0x3d6a0d['where'],{'$or':_['map'](_0x54f7cd,function(_0x5532ba){if(_0x5532ba[_0xa498('0x2a')]!=='VIRTUAL'){var _0x395de9={};_0x395de9[_0x5532ba[_0xa498('0x25')]]={'$like':'%'+_0x3ef443[_0xa498('0x2e')]['filter']+'%'};return _0x395de9;}})});}_0x3d6a0d=_[_0xa498('0x3a')]({},_0x3d6a0d,_0x3ef443['options']);var _0x4e6d6a={'where':_0x3d6a0d[_0xa498('0x38')]};return db[_0xa498('0x27')]['count'](_0x4e6d6a)[_0xa498('0x21')](function(_0x2e1fca){_0x483f0e[_0xa498('0x1a')]=_0x2e1fca;if(_0x3ef443[_0xa498('0x2e')][_0xa498('0x3b')]){_0x3d6a0d[_0xa498('0x3c')]=[{'all':!![]}];}return db[_0xa498('0x27')]['findAll'](_0x3d6a0d);})[_0xa498('0x21')](function(_0xf44d9b){_0x483f0e[_0xa498('0x3d')]=_0xf44d9b;return _0x483f0e;})['then'](respondWithFilteredResult(_0x288e1b,_0x3d6a0d))[_0xa498('0x3e')](handleError(_0x288e1b,null));};exports[_0xa498('0x3f')]=function(_0x59997d,_0x4755b1){var _0x50185a={'raw':!![],'where':{'id':_0x59997d['params']['id']}},_0x2c8926={};_0x2c8926[_0xa498('0x2c')]=_[_0xa498('0x2f')](db[_0xa498('0x27')][_0xa498('0x28')]);_0x2c8926[_0xa498('0x2e')]=_[_0xa498('0x2f')](_0x59997d[_0xa498('0x2e')]);_0x2c8926['filters']=_[_0xa498('0x31')](_0x2c8926['model'],_0x2c8926[_0xa498('0x2e')]);_0x50185a[_0xa498('0x32')]=_[_0xa498('0x31')](_0x2c8926[_0xa498('0x2c')],qs[_0xa498('0x33')](_0x59997d[_0xa498('0x2e')]['fields']));_0x50185a[_0xa498('0x32')]=_0x50185a[_0xa498('0x32')][_0xa498('0x34')]?_0x50185a[_0xa498('0x32')]:_0x2c8926[_0xa498('0x2c')];if(_0x59997d['query'][_0xa498('0x3b')]){_0x50185a[_0xa498('0x3c')]=[{'all':!![]}];}_0x50185a=_[_0xa498('0x3a')]({},_0x50185a,_0x59997d[_0xa498('0x40')]);return db[_0xa498('0x27')][_0xa498('0x41')](_0x50185a)[_0xa498('0x21')](handleEntityNotFound(_0x4755b1,null))[_0xa498('0x21')](respondWithResult(_0x4755b1,null))['catch'](handleError(_0x4755b1,null));};exports[_0xa498('0x42')]=function(_0x1295f5,_0x34d99){return db[_0xa498('0x27')][_0xa498('0x42')](_0x1295f5[_0xa498('0x43')],{})[_0xa498('0x21')](function(_0x1b732d){var _0x2236c9=_0x1295f5[_0xa498('0x44')][_0xa498('0x45')]({'plain':!![]});if(!_0x2236c9)throw new Error(_0xa498('0x46'));if(_0x2236c9[_0xa498('0x47')]===_0xa498('0x44')){var _0x49b073=_0x1b732d[_0xa498('0x45')]({'plain':!![]});var _0x1f77b6=_0xa498('0x48');return db[_0xa498('0x49')][_0xa498('0x41')]({'where':{'name':_0x1f77b6,'userProfileId':_0x2236c9[_0xa498('0x4a')]},'raw':!![]})[_0xa498('0x21')](function(_0x29697f){if(_0x29697f&&_0x29697f[_0xa498('0x4b')]===0x0){return db[_0xa498('0x4c')][_0xa498('0x42')]({'name':_0x49b073[_0xa498('0x25')],'resourceId':_0x49b073['id'],'type':_0x29697f['name'],'sectionId':_0x29697f['id']},{})['then'](function(){return _0x1b732d;});}else{return _0x1b732d;}})[_0xa498('0x3e')](function(_0x8daf53){logger['error'](_0xa498('0x4d'),_0x8daf53);throw _0x8daf53;});}return _0x1b732d;})['then'](respondWithResult(_0x34d99,0xc9))[_0xa498('0x3e')](handleError(_0x34d99,null));};exports[_0xa498('0x20')]=function(_0x1ce1a3,_0xd23a2b){if(_0x1ce1a3['body']['id']){delete _0x1ce1a3[_0xa498('0x43')]['id'];}return db[_0xa498('0x27')][_0xa498('0x41')]({'where':{'id':_0x1ce1a3[_0xa498('0x4e')]['id']}})['then'](handleEntityNotFound(_0xd23a2b,null))[_0xa498('0x21')](saveUpdates(_0x1ce1a3['body'],null))[_0xa498('0x21')](respondWithResult(_0xd23a2b,null))[_0xa498('0x3e')](handleError(_0xd23a2b,null));};exports[_0xa498('0x22')]=function(_0x2cc6f2,_0x4c4bd2){return db[_0xa498('0x27')][_0xa498('0x41')]({'where':{'id':_0x2cc6f2[_0xa498('0x4e')]['id']}})[_0xa498('0x21')](handleEntityNotFound(_0x4c4bd2,null))[_0xa498('0x21')](removeEntity(_0x4c4bd2,null))[_0xa498('0x3e')](handleError(_0x4c4bd2,null));};exports[_0xa498('0x4f')]=function(_0x2491e8,_0x26af38,_0x403ed3){var _0x202081;return db['SquareOdbc'][_0xa498('0x41')]({'where':{'id':_0x2491e8[_0xa498('0x4e')]['id']},'attributes':['id',_0xa498('0x50')]})[_0xa498('0x21')](handleEntityNotFound(_0x26af38,null))[_0xa498('0x21')](function(_0x3261b8){if(_0x3261b8){var _0x2f8f2a=require(_0xa498('0x51'))();_0x2f8f2a[_0xa498('0x52')](_0x3261b8[_0xa498('0x50')]);_0x2f8f2a['closeSync']();return _0x3261b8;}})['then'](respondWithResult(_0x26af38,null))[_0xa498('0x3e')](handleError(_0x26af38,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index ce6b4e3..66d51ec 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 _0x4a1c=['path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','util','../../config/logger','api','moment','bluebird'];(function(_0x2572f9,_0x282be2){var _0x50e1e1=function(_0x381e33){while(--_0x381e33){_0x2572f9['push'](_0x2572f9['shift']());}};_0x50e1e1(++_0x282be2);}(_0x4a1c,0x1ab));var _0xc4a1=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x4a1c[_0x2431d6];return _0x4d0f9b;};'use strict';var _=require('lodash');var util=require(_0xc4a1('0x0'));var logger=require(_0xc4a1('0x1'))(_0xc4a1('0x2'));var moment=require(_0xc4a1('0x3'));var BPromise=require(_0xc4a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4a1('0x5'));var rimraf=require(_0xc4a1('0x6'));var config=require(_0xc4a1('0x7'));var attributes=require(_0xc4a1('0x8'));module[_0xc4a1('0x9')]=function(_0x3c60e3,_0x219579){return _0x3c60e3[_0xc4a1('0xa')](_0xc4a1('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75dd=['define','SquareOdbc','square_odbc','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x28314a,_0x31d7d0){var _0x4fe183=function(_0x280f13){while(--_0x280f13){_0x28314a['push'](_0x28314a['shift']());}};_0x4fe183(++_0x31d7d0);}(_0x75dd,0x114));var _0xd75d=function(_0x248d34,_0x34fa13){_0x248d34=_0x248d34-0x0;var _0x27087a=_0x75dd[_0x248d34];return _0x27087a;};'use strict';var _=require(_0xd75d('0x0'));var util=require(_0xd75d('0x1'));var logger=require(_0xd75d('0x2'))('api');var moment=require(_0xd75d('0x3'));var BPromise=require(_0xd75d('0x4'));var rp=require(_0xd75d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd75d('0x6'));var config=require(_0xd75d('0x7'));var attributes=require(_0xd75d('0x8'));module[_0xd75d('0x9')]=function(_0x197ee2,_0x4f287a){return _0x197ee2[_0xd75d('0xa')](_0xd75d('0xb'),attributes,{'tableName':_0xd75d('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 5f5e990..7d7f74e 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 _0x6b5f=['attributes','then','ShowSquareOdbc','lodash','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find','options','raw','where','include','map','model'];(function(_0x129479,_0x256c7e){var _0x3fa0ce=function(_0x35401f){while(--_0x35401f){_0x129479['push'](_0x129479['shift']());}};_0x3fa0ce(++_0x256c7e);}(_0x6b5f,0x15f));var _0xf6b5=function(_0x327973,_0x22f5bc){_0x327973=_0x327973-0x0;var _0x1b6281=_0x6b5f[_0x327973];return _0x1b6281;};'use strict';var _=require(_0xf6b5('0x0'));var util=require('util');var moment=require(_0xf6b5('0x1'));var BPromise=require(_0xf6b5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6b5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf6b5('0x4'));var jayson=require(_0xf6b5('0x5'));var client=jayson[_0xf6b5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f17ca,_0x1df17f,_0x4c6d9e){return new BPromise(function(_0x46527d,_0x4ad4f3){return client[_0xf6b5('0x7')](_0x1f17ca,_0x4c6d9e)['then'](function(_0x33fd41){logger[_0xf6b5('0x8')](_0xf6b5('0x9'),_0x1df17f,_0xf6b5('0xa'));logger[_0xf6b5('0xb')](_0xf6b5('0xc'),_0x1df17f,_0xf6b5('0xa'),JSON[_0xf6b5('0xd')](_0x33fd41));if(_0x33fd41['error']){if(_0x33fd41[_0xf6b5('0xe')][_0xf6b5('0xf')]===0x1f4){logger[_0xf6b5('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x1df17f,_0x33fd41[_0xf6b5('0xe')][_0xf6b5('0x10')]);return _0x4ad4f3(_0x33fd41[_0xf6b5('0xe')][_0xf6b5('0x10')]);}logger[_0xf6b5('0xe')](_0xf6b5('0x9'),_0x1df17f,_0x33fd41['error'][_0xf6b5('0x10')]);return _0x46527d(_0x33fd41[_0xf6b5('0xe')][_0xf6b5('0x10')]);}else{logger[_0xf6b5('0x8')](_0xf6b5('0x9'),_0x1df17f,'request\x20sent');_0x46527d(_0x33fd41[_0xf6b5('0x11')][_0xf6b5('0x10')]);}})[_0xf6b5('0x12')](function(_0x44d8bb){logger[_0xf6b5('0xe')](_0xf6b5('0x9'),_0x1df17f,_0x44d8bb);_0x4ad4f3(_0x44d8bb);});});}exports['ShowSquareOdbc']=function(_0x3f95d1){var _0x23f751=this;return new Promise(function(_0x1bb113,_0x2bb06e){return db['SquareOdbc'][_0xf6b5('0x13')]({'raw':_0x3f95d1[_0xf6b5('0x14')]?_0x3f95d1[_0xf6b5('0x14')][_0xf6b5('0x15')]===undefined?!![]:![]:!![],'where':_0x3f95d1['options']?_0x3f95d1[_0xf6b5('0x14')][_0xf6b5('0x16')]||null:null,'attributes':_0x3f95d1[_0xf6b5('0x14')]?_0x3f95d1[_0xf6b5('0x14')]['attributes']||null:null,'include':_0x3f95d1['options']?_0x3f95d1[_0xf6b5('0x14')][_0xf6b5('0x17')]?_[_0xf6b5('0x18')](_0x3f95d1[_0xf6b5('0x14')][_0xf6b5('0x17')],function(_0x4f4f2a){return{'model':db[_0x4f4f2a[_0xf6b5('0x19')]],'as':_0x4f4f2a['as'],'attributes':_0x4f4f2a['attributes'],'include':_0x4f4f2a[_0xf6b5('0x17')]?_[_0xf6b5('0x18')](_0x4f4f2a[_0xf6b5('0x17')],function(_0x313238){return{'model':db[_0x313238[_0xf6b5('0x19')]],'as':_0x313238['as'],'attributes':_0x313238[_0xf6b5('0x1a')],'include':_0x313238[_0xf6b5('0x17')]?_[_0xf6b5('0x18')](_0x313238['include'],function(_0x51bd7b){return{'model':db[_0x51bd7b[_0xf6b5('0x19')]],'as':_0x51bd7b['as'],'attributes':_0x51bd7b['attributes']};}):[]};}):[]};}):[]:[]})[_0xf6b5('0x1b')](function(_0x159ce7){logger[_0xf6b5('0x8')](_0xf6b5('0x1c'),_0x3f95d1);logger[_0xf6b5('0xb')](_0xf6b5('0x1c'),_0x3f95d1,JSON[_0xf6b5('0xd')](_0x159ce7));_0x1bb113(_0x159ce7);})[_0xf6b5('0x12')](function(_0x33c4a5){logger['error'](_0xf6b5('0x1c'),_0x33c4a5[_0xf6b5('0x10')],_0x3f95d1);_0x2bb06e(_0x23f751['error'](0x1f4,_0x33c4a5['message']));});});}; \ No newline at end of file +var _0x86be=['catch','ShowSquareOdbc','find','options','raw','attributes','include','map','model','then','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xe6e1ec,_0x144b09){var _0x374c02=function(_0x59d0ae){while(--_0x59d0ae){_0xe6e1ec['push'](_0xe6e1ec['shift']());}};_0x374c02(++_0x144b09);}(_0x86be,0x19d));var _0xe86b=function(_0x3ff854,_0x52949d){_0x3ff854=_0x3ff854-0x0;var _0x147943=_0x86be[_0x3ff854];return _0x147943;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe86b('0x0'));var BPromise=require('bluebird');var rs=require(_0xe86b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe86b('0x2'))['db'];var utils=require(_0xe86b('0x3'));var logger=require(_0xe86b('0x4'))(_0xe86b('0x5'));var config=require(_0xe86b('0x6'));var jayson=require(_0xe86b('0x7'));var client=jayson[_0xe86b('0x8')][_0xe86b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ea5f0,_0x2c3435,_0x15821d){return new BPromise(function(_0x2f187f,_0x49aba9){return client[_0xe86b('0xa')](_0x5ea5f0,_0x15821d)['then'](function(_0x14767e){logger[_0xe86b('0xb')](_0xe86b('0xc'),_0x2c3435,_0xe86b('0xd'));logger[_0xe86b('0xe')](_0xe86b('0xf'),_0x2c3435,'request\x20sent',JSON[_0xe86b('0x10')](_0x14767e));if(_0x14767e[_0xe86b('0x11')]){if(_0x14767e[_0xe86b('0x11')][_0xe86b('0x12')]===0x1f4){logger[_0xe86b('0x11')](_0xe86b('0xc'),_0x2c3435,_0x14767e['error'][_0xe86b('0x13')]);return _0x49aba9(_0x14767e['error'][_0xe86b('0x13')]);}logger[_0xe86b('0x11')](_0xe86b('0xc'),_0x2c3435,_0x14767e['error']['message']);return _0x2f187f(_0x14767e[_0xe86b('0x11')][_0xe86b('0x13')]);}else{logger[_0xe86b('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x2c3435,_0xe86b('0xd'));_0x2f187f(_0x14767e[_0xe86b('0x14')]['message']);}})[_0xe86b('0x15')](function(_0xb2e11d){logger[_0xe86b('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x2c3435,_0xb2e11d);_0x49aba9(_0xb2e11d);});});}exports[_0xe86b('0x16')]=function(_0x1ef7d4){var _0xac2f08=this;return new Promise(function(_0x227ae4,_0x137084){return db['SquareOdbc'][_0xe86b('0x17')]({'raw':_0x1ef7d4['options']?_0x1ef7d4[_0xe86b('0x18')][_0xe86b('0x19')]===undefined?!![]:![]:!![],'where':_0x1ef7d4[_0xe86b('0x18')]?_0x1ef7d4[_0xe86b('0x18')]['where']||null:null,'attributes':_0x1ef7d4[_0xe86b('0x18')]?_0x1ef7d4['options'][_0xe86b('0x1a')]||null:null,'include':_0x1ef7d4[_0xe86b('0x18')]?_0x1ef7d4['options'][_0xe86b('0x1b')]?_[_0xe86b('0x1c')](_0x1ef7d4[_0xe86b('0x18')][_0xe86b('0x1b')],function(_0x252dc5){return{'model':db[_0x252dc5['model']],'as':_0x252dc5['as'],'attributes':_0x252dc5[_0xe86b('0x1a')],'include':_0x252dc5[_0xe86b('0x1b')]?_['map'](_0x252dc5[_0xe86b('0x1b')],function(_0x438384){return{'model':db[_0x438384[_0xe86b('0x1d')]],'as':_0x438384['as'],'attributes':_0x438384['attributes'],'include':_0x438384[_0xe86b('0x1b')]?_[_0xe86b('0x1c')](_0x438384['include'],function(_0x1a45d2){return{'model':db[_0x1a45d2[_0xe86b('0x1d')]],'as':_0x1a45d2['as'],'attributes':_0x1a45d2[_0xe86b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe86b('0x1e')](function(_0x1916c4){logger[_0xe86b('0xb')](_0xe86b('0x16'),_0x1ef7d4);logger[_0xe86b('0xe')](_0xe86b('0x16'),_0x1ef7d4,JSON[_0xe86b('0x10')](_0x1916c4));_0x227ae4(_0x1916c4);})['catch'](function(_0x5c1c89){logger['error'](_0xe86b('0x16'),_0x5c1c89[_0xe86b('0x13')],_0x1ef7d4);_0x137084(_0xac2f08[_0xe86b('0x11')](0x1f4,_0x5c1c89['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 2225547..9983b4e 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 _0x757c=['removeUsers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/users','post','put','update','delete','destroy'];(function(_0xa63ea3,_0x4367ff){var _0x2aa5ff=function(_0x30dc84){while(--_0x30dc84){_0xa63ea3['push'](_0xa63ea3['shift']());}};_0x2aa5ff(++_0x4367ff);}(_0x757c,0x191));var _0xc757=function(_0x4fa441,_0x46c8b7){_0x4fa441=_0x4fa441-0x0;var _0x37c1cf=_0x757c[_0x4fa441];return _0x37c1cf;};'use strict';var multer=require(_0xc757('0x0'));var util=require(_0xc757('0x1'));var path=require('path');var timeout=require(_0xc757('0x2'));var express=require(_0xc757('0x3'));var router=express[_0xc757('0x4')]();var fs_extra=require(_0xc757('0x5'));var auth=require(_0xc757('0x6'));var interaction=require(_0xc757('0x7'));var config=require(_0xc757('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xc757('0x9')](),controller['index']);router[_0xc757('0xa')](_0xc757('0xb'),auth[_0xc757('0x9')](),controller[_0xc757('0xc')]);router[_0xc757('0xa')](_0xc757('0xd'),auth[_0xc757('0x9')](),controller['getUsers']);router['post']('/',auth[_0xc757('0x9')](),controller['create']);router[_0xc757('0xe')]('/:id/users',auth[_0xc757('0x9')](),controller['addUsers']);router[_0xc757('0xf')](_0xc757('0xb'),auth[_0xc757('0x9')](),controller[_0xc757('0x10')]);router[_0xc757('0x11')]('/:id',auth[_0xc757('0x9')](),controller[_0xc757('0x12')]);router[_0xc757('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0xc757('0x13')]);module[_0xc757('0x14')]=router; \ No newline at end of file +var _0xf482=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','getUsers','create','post','put','update','delete','destroy','/:id/users','removeUsers','exports'];(function(_0x1d8170,_0x459855){var _0x3ca267=function(_0xeeb2a1){while(--_0xeeb2a1){_0x1d8170['push'](_0x1d8170['shift']());}};_0x3ca267(++_0x459855);}(_0xf482,0xf0));var _0x2f48=function(_0x228a69,_0x348e9a){_0x228a69=_0x228a69-0x0;var _0x3e1e72=_0xf482[_0x228a69];return _0x3e1e72;};'use strict';var multer=require(_0x2f48('0x0'));var util=require(_0x2f48('0x1'));var path=require(_0x2f48('0x2'));var timeout=require(_0x2f48('0x3'));var express=require(_0x2f48('0x4'));var router=express[_0x2f48('0x5')]();var fs_extra=require(_0x2f48('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2f48('0x7'));var config=require(_0x2f48('0x8'));var controller=require(_0x2f48('0x9'));router[_0x2f48('0xa')]('/',auth[_0x2f48('0xb')](),controller['index']);router[_0x2f48('0xa')](_0x2f48('0xc'),auth[_0x2f48('0xb')](),controller[_0x2f48('0xd')]);router[_0x2f48('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x2f48('0xe')]);router['post']('/',auth[_0x2f48('0xb')](),controller[_0x2f48('0xf')]);router[_0x2f48('0x10')]('/:id/users',auth[_0x2f48('0xb')](),controller['addUsers']);router[_0x2f48('0x11')](_0x2f48('0xc'),auth['isAuthenticated'](),controller[_0x2f48('0x12')]);router[_0x2f48('0x13')](_0x2f48('0xc'),auth[_0x2f48('0xb')](),controller[_0x2f48('0x14')]);router[_0x2f48('0x13')](_0x2f48('0x15'),auth[_0x2f48('0xb')](),controller[_0x2f48('0x16')]);module[_0x2f48('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 808bfeb..7335c39 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 _0x4489=['TEXT','BLOB','toString','getDataValue','production','DATE','sequelize','exports','name','STRING'];(function(_0x36b518,_0xb0b62d){var _0x34693e=function(_0x1626cb){while(--_0x1626cb){_0x36b518['push'](_0x36b518['shift']());}};_0x34693e(++_0xb0b62d);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9448('0x0'));module[_0x9448('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9448('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9448('0x3')]},'notes':{'type':Sequelize[_0x9448('0x4')]},'preproduction':{'type':Sequelize[_0x9448('0x5')]('long'),'get':function(){if(this['getDataValue']('preproduction')){return this['getDataValue']('preproduction')[_0x9448('0x6')]('utf8');}}},'production':{'type':Sequelize[_0x9448('0x5')]('long'),'get':function(){if(this[_0x9448('0x7')](_0x9448('0x8'))){return this[_0x9448('0x7')]('production')['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x9448('0x9')]},'publishedAt':{'type':Sequelize[_0x9448('0x9')]}}; \ No newline at end of file +var _0x9a33=['name','TEXT','BLOB','long','preproduction','toString','utf8','production','getDataValue','exports','STRING'];(function(_0x23a05f,_0x232ea5){var _0x1a3002=function(_0x38e19b){while(--_0x38e19b){_0x23a05f['push'](_0x23a05f['shift']());}};_0x1a3002(++_0x232ea5);}(_0x9a33,0x6c));var _0x39a3=function(_0x2a9250,_0x263508){_0x2a9250=_0x2a9250-0x0;var _0x1839fe=_0x9a33[_0x2a9250];return _0x1839fe;};'use strict';var Sequelize=require('sequelize');module[_0x39a3('0x0')]={'name':{'type':Sequelize[_0x39a3('0x1')],'unique':_0x39a3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x39a3('0x1')]},'notes':{'type':Sequelize[_0x39a3('0x3')]},'preproduction':{'type':Sequelize[_0x39a3('0x4')](_0x39a3('0x5')),'get':function(){if(this['getDataValue'](_0x39a3('0x6'))){return this['getDataValue'](_0x39a3('0x6'))[_0x39a3('0x7')](_0x39a3('0x8'));}}},'production':{'type':Sequelize[_0x39a3('0x4')](_0x39a3('0x5')),'get':function(){if(this['getDataValue'](_0x39a3('0x9'))){return this[_0x39a3('0xa')](_0x39a3('0x9'))[_0x39a3('0x7')](_0x39a3('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index c7c57f8..7b25e7e 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 _0x227c=['autoAssociation','find','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','SquareProject','findAll','rows','catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x35863f,_0x4f3a04){var _0x35a567=function(_0x192d22){while(--_0x192d22){_0x35863f['push'](_0x35863f['shift']());}};_0x35a567(++_0x4f3a04);}(_0x227c,0x66));var _0xc227=function(_0x42e75c,_0x136223){_0x42e75c=_0x42e75c-0x0;var _0x42b0b8=_0x227c[_0x42e75c];return _0x42b0b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc227('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc227('0x1'));var rp=require(_0xc227('0x2'));var moment=require('moment');var BPromise=require(_0xc227('0x3'));var Mustache=require(_0xc227('0x4'));var util=require(_0xc227('0x5'));var path=require(_0xc227('0x6'));var sox=require(_0xc227('0x7'));var csv=require('to-csv');var ejs=require(_0xc227('0x8'));var fs=require('fs');var fs_extra=require(_0xc227('0x9'));var _=require(_0xc227('0xa'));var squel=require(_0xc227('0xb'));var crypto=require(_0xc227('0xc'));var jsforce=require(_0xc227('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc227('0xe'));var Papa=require(_0xc227('0xf'));var Redis=require('ioredis');var authService=require(_0xc227('0x10'));var qs=require(_0xc227('0x11'));var as=require(_0xc227('0x12'));var hardwareService=require(_0xc227('0x13'));var logger=require(_0xc227('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc227('0x15'));var db=require('../../mysqldb')['db'];config[_0xc227('0x16')]=_['defaults'](config[_0xc227('0x16')],{'host':_0xc227('0x17'),'port':0x18eb});var socket=require(_0xc227('0x18'))(new Redis(config[_0xc227('0x16')]));require(_0xc227('0x19'))[_0xc227('0x1a')](socket);function respondWithStatusCode(_0x37df5f,_0x1af752){_0x1af752=_0x1af752||0xcc;return function(_0x6fd7e0){if(_0x6fd7e0){return _0x37df5f[_0xc227('0x1b')](_0x1af752);}return _0x37df5f[_0xc227('0x1c')](_0x1af752)['end']();};}function respondWithResult(_0x4e3fcf,_0x52b1a9){_0x52b1a9=_0x52b1a9||0xc8;return function(_0x3e2fff){if(_0x3e2fff){return _0x4e3fcf[_0xc227('0x1c')](_0x52b1a9)[_0xc227('0x1d')](_0x3e2fff);}};}function respondWithFilteredResult(_0x20df28,_0x4e6883){return function(_0x2d204e){if(_0x2d204e){var _0x27c583=typeof _0x4e6883['offset']===_0xc227('0x1e')&&typeof _0x4e6883['limit']===_0xc227('0x1e');var _0x4fc74f=_0x2d204e['count'];var _0x5392b7=_0x27c583?0x0:_0x4e6883[_0xc227('0x1f')];var _0x266374=_0x27c583?_0x2d204e[_0xc227('0x20')]:_0x4e6883[_0xc227('0x1f')]+_0x4e6883[_0xc227('0x21')];var _0x10e20;if(_0x266374>=_0x4fc74f){_0x266374=_0x4fc74f;_0x10e20=0xc8;}else{_0x10e20=0xce;}_0x20df28[_0xc227('0x1c')](_0x10e20);return _0x20df28['set'](_0xc227('0x22'),_0x5392b7+'-'+_0x266374+'/'+_0x4fc74f)[_0xc227('0x1d')](_0x2d204e);}return null;};}function patchUpdates(_0x16c9ad){return function(_0x398f97){try{jsonpatch[_0xc227('0x23')](_0x398f97,_0x16c9ad,!![]);}catch(_0x389a4a){return BPromise[_0xc227('0x24')](_0x389a4a);}return _0x398f97[_0xc227('0x25')]();};}function saveUpdates(_0x61475a,_0x10705b){return function(_0x1e71fa){if(_0x1e71fa){return _0x1e71fa[_0xc227('0x26')](_0x61475a)[_0xc227('0x27')](function(_0x20eaff){return _0x20eaff;});}return null;};}function removeEntity(_0x77acdf,_0x2b5744){return function(_0x516ffb){if(_0x516ffb){return _0x516ffb[_0xc227('0x28')]()[_0xc227('0x27')](function(){var _0x37dfb5=_0x516ffb[_0xc227('0x29')]({'plain':!![]});var _0x55a94a=_0xc227('0x2a');return db[_0xc227('0x2b')]['destroy']({'where':{'type':_0x55a94a,'resourceId':_0x37dfb5['id']}})[_0xc227('0x27')](function(){return _0x516ffb;});})['then'](function(){_0x77acdf[_0xc227('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc5355d,_0x52f8a8){return function(_0x53896b){if(!_0x53896b){_0xc5355d[_0xc227('0x1b')](0x194);}return _0x53896b;};}function handleError(_0x1ba10c,_0x2ae78a){_0x2ae78a=_0x2ae78a||0x1f4;return function(_0xc90d27){logger[_0xc227('0x2c')](_0xc90d27[_0xc227('0x2d')]);if(_0xc90d27['name']){delete _0xc90d27[_0xc227('0x2e')];}_0x1ba10c['status'](_0x2ae78a)[_0xc227('0x2f')](_0xc90d27);};}exports[_0xc227('0x30')]=function(_0xed1b06,_0x2fc23f){var _0x228dcc={},_0x606e00={},_0x5a6175={'count':0x0,'rows':[]};var _0x24dd7d=_[_0xc227('0x31')](db['SquareProject'][_0xc227('0x32')],function(_0x51d970){return{'name':_0x51d970[_0xc227('0x33')],'type':_0x51d970['type'][_0xc227('0x34')]};});_0x606e00[_0xc227('0x35')]=_['map'](_0x24dd7d,_0xc227('0x2e'));_0x606e00[_0xc227('0x36')]=_['keys'](_0xed1b06[_0xc227('0x36')]);_0x606e00['filters']=_[_0xc227('0x37')](_0x606e00[_0xc227('0x35')],_0x606e00[_0xc227('0x36')]);_0x228dcc[_0xc227('0x38')]=_[_0xc227('0x37')](_0x606e00[_0xc227('0x35')],qs[_0xc227('0x39')](_0xed1b06[_0xc227('0x36')][_0xc227('0x39')]));_0x228dcc[_0xc227('0x38')]=_0x228dcc[_0xc227('0x38')][_0xc227('0x3a')]?_0x228dcc['attributes']:_0x606e00[_0xc227('0x35')];if(!_0xed1b06[_0xc227('0x36')][_0xc227('0x3b')](_0xc227('0x3c'))){_0x228dcc[_0xc227('0x21')]=qs[_0xc227('0x21')](_0xed1b06[_0xc227('0x36')][_0xc227('0x21')]);_0x228dcc['offset']=qs[_0xc227('0x1f')](_0xed1b06['query'][_0xc227('0x1f')]);}_0x228dcc[_0xc227('0x3d')]=qs[_0xc227('0x3e')](_0xed1b06[_0xc227('0x36')]['sort']);_0x228dcc['where']=qs['filters'](_[_0xc227('0x3f')](_0xed1b06[_0xc227('0x36')],_0x606e00[_0xc227('0x40')]),_0x24dd7d);if(_0xed1b06[_0xc227('0x36')][_0xc227('0x41')]){_0x228dcc[_0xc227('0x42')]=_[_0xc227('0x43')](_0x228dcc['where'],{'$or':_[_0xc227('0x31')](_0x24dd7d,function(_0x153fbd){if(_0x153fbd[_0xc227('0x44')]!==_0xc227('0x45')){var _0x54e530={};_0x54e530[_0x153fbd[_0xc227('0x2e')]]={'$like':'%'+_0xed1b06[_0xc227('0x36')]['filter']+'%'};return _0x54e530;}})});}_0x228dcc=_[_0xc227('0x43')]({},_0x228dcc,_0xed1b06[_0xc227('0x46')]);var _0x33d473={'where':_0x228dcc['where']};return db[_0xc227('0x47')][_0xc227('0x20')](_0x33d473)[_0xc227('0x27')](function(_0x17436d){_0x5a6175[_0xc227('0x20')]=_0x17436d;if(_0xed1b06['query']['includeAll']){_0x228dcc['include']=[{'all':!![]}];}return db[_0xc227('0x47')][_0xc227('0x48')](_0x228dcc);})[_0xc227('0x27')](function(_0x48b18c){_0x5a6175[_0xc227('0x49')]=_0x48b18c;return _0x5a6175;})['then'](respondWithFilteredResult(_0x2fc23f,_0x228dcc))[_0xc227('0x4a')](handleError(_0x2fc23f,null));};exports[_0xc227('0x4b')]=function(_0x1212e1,_0x15fe54){var _0x32d213={'raw':![],'where':{'id':_0x1212e1[_0xc227('0x4c')]['id']}},_0x2d21c5={};_0x2d21c5[_0xc227('0x35')]=_[_0xc227('0x4d')](db[_0xc227('0x47')][_0xc227('0x32')]);_0x2d21c5[_0xc227('0x36')]=_[_0xc227('0x4d')](_0x1212e1[_0xc227('0x36')]);_0x2d21c5[_0xc227('0x40')]=_['intersection'](_0x2d21c5[_0xc227('0x35')],_0x2d21c5[_0xc227('0x36')]);_0x32d213['attributes']=_[_0xc227('0x37')](_0x2d21c5['model'],qs[_0xc227('0x39')](_0x1212e1[_0xc227('0x36')][_0xc227('0x39')]));_0x32d213[_0xc227('0x38')]=_0x32d213[_0xc227('0x38')][_0xc227('0x3a')]?_0x32d213[_0xc227('0x38')]:_0x2d21c5['model'];if(_0x1212e1[_0xc227('0x36')][_0xc227('0x4e')]){_0x32d213['include']=[{'all':!![]}];}_0x32d213=_[_0xc227('0x43')]({},_0x32d213,_0x1212e1[_0xc227('0x46')]);return db[_0xc227('0x47')]['find'](_0x32d213)['then'](handleEntityNotFound(_0x15fe54,null))[_0xc227('0x27')](respondWithResult(_0x15fe54,null))['catch'](handleError(_0x15fe54,null));};exports[_0xc227('0x4f')]=function(_0x36b474,_0x449327){return db[_0xc227('0x47')][_0xc227('0x4f')](_0x36b474[_0xc227('0x50')],{})['then'](function(_0x26b4a0){var _0x177666=_0x36b474[_0xc227('0x51')][_0xc227('0x29')]({'plain':!![]});if(!_0x177666)throw new Error(_0xc227('0x52'));if(_0x177666['role']===_0xc227('0x51')){var _0x439792=_0x26b4a0['get']({'plain':!![]});var _0x28691c=_0xc227('0x2a');return db[_0xc227('0x53')]['find']({'where':{'name':_0x28691c,'userProfileId':_0x177666['userProfileId']},'raw':!![]})[_0xc227('0x27')](function(_0x56ca2a){if(_0x56ca2a&&_0x56ca2a[_0xc227('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x439792[_0xc227('0x2e')],'resourceId':_0x439792['id'],'type':_0x56ca2a['name'],'sectionId':_0x56ca2a['id']},{})[_0xc227('0x27')](function(){return _0x26b4a0;});}else{return _0x26b4a0;}})[_0xc227('0x4a')](function(_0x40037e){logger[_0xc227('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40037e);throw _0x40037e;});}return _0x26b4a0;})['then'](respondWithResult(_0x449327,0xc9))['catch'](handleError(_0x449327,null));};exports['update']=function(_0x53fb31,_0x357d4d){if(_0x53fb31[_0xc227('0x50')]['id']){delete _0x53fb31[_0xc227('0x50')]['id'];}return db[_0xc227('0x47')][_0xc227('0x55')]({'where':{'id':_0x53fb31[_0xc227('0x4c')]['id']}})[_0xc227('0x27')](handleEntityNotFound(_0x357d4d,null))[_0xc227('0x27')](saveUpdates(_0x53fb31[_0xc227('0x50')],null))[_0xc227('0x27')](respondWithResult(_0x357d4d,null))[_0xc227('0x4a')](handleError(_0x357d4d,null));};exports['destroy']=function(_0x217524,_0x12b2c5){return db['SquareProject'][_0xc227('0x55')]({'where':{'id':_0x217524[_0xc227('0x4c')]['id']}})[_0xc227('0x27')](handleEntityNotFound(_0x12b2c5,null))['then'](removeEntity(_0x12b2c5,null))['catch'](handleError(_0x12b2c5,null));};exports['addUsers']=function(_0x3c82f7,_0x4c43a4,_0x123570){return db[_0xc227('0x47')]['find']({'where':{'id':_0x3c82f7[_0xc227('0x4c')]['id']}})[_0xc227('0x27')](handleEntityNotFound(_0x4c43a4,null))[_0xc227('0x27')](function(_0xe20819){if(_0xe20819){return _0xe20819[_0xc227('0x56')](_0x3c82f7[_0xc227('0x50')][_0xc227('0x57')],_['omit'](_0x3c82f7['body'],[_0xc227('0x57'),'id'])||{});}})[_0xc227('0x27')](respondWithResult(_0x4c43a4,null))[_0xc227('0x4a')](handleError(_0x4c43a4,null));};exports['removeUsers']=function(_0x1f6529,_0x170558,_0x50eb73){return db[_0xc227('0x47')]['find']({'where':{'id':_0x1f6529[_0xc227('0x4c')]['id']}})[_0xc227('0x27')](handleEntityNotFound(_0x170558,null))['then'](function(_0x475afe){if(_0x475afe){return _0x475afe[_0xc227('0x58')](_0x1f6529[_0xc227('0x36')][_0xc227('0x57')])['then'](function(){if(_['isArray'](_0x1f6529[_0xc227('0x36')][_0xc227('0x57')])){for(var _0x3191b4=0x0;_0x3191b4<_0x1f6529[_0xc227('0x36')][_0xc227('0x57')][_0xc227('0x3a')];_0x3191b4+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x1f6529[_0xc227('0x36')][_0xc227('0x57')][_0x3191b4]),'SquareProjectId':Number(_0x1f6529[_0xc227('0x4c')]['id'])});}}else{socket[_0xc227('0x59')](_0xc227('0x5a'),{'UserId':Number(_0x1f6529[_0xc227('0x36')][_0xc227('0x57')]),'SquareProjectId':Number(_0x1f6529[_0xc227('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x170558,null))['catch'](handleError(_0x170558,null));};exports[_0xc227('0x5b')]=function(_0x3452a1,_0x5332a2,_0x5dfe41){var _0x5e3f10={};var _0x4d4bb0={};var _0x15c5c1;var _0x3df8f1;return db[_0xc227('0x47')][_0xc227('0x5c')]({'where':{'id':_0x3452a1[_0xc227('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5332a2,null))[_0xc227('0x27')](function(_0x293ef2){if(_0x293ef2){_0x15c5c1=_0x293ef2;_0x4d4bb0[_0xc227('0x35')]=_[_0xc227('0x4d')](db['User'][_0xc227('0x32')]);_0x4d4bb0['query']=_[_0xc227('0x4d')](_0x3452a1[_0xc227('0x36')]);_0x4d4bb0[_0xc227('0x40')]=_[_0xc227('0x37')](_0x4d4bb0['model'],_0x4d4bb0[_0xc227('0x36')]);_0x5e3f10[_0xc227('0x38')]=_[_0xc227('0x37')](_0x4d4bb0[_0xc227('0x35')],qs['fields'](_0x3452a1['query'][_0xc227('0x39')]));_0x5e3f10[_0xc227('0x38')]=_0x5e3f10[_0xc227('0x38')][_0xc227('0x3a')]?_0x5e3f10['attributes']:_0x4d4bb0[_0xc227('0x35')];_0x5e3f10[_0xc227('0x3d')]=qs[_0xc227('0x3e')](_0x3452a1[_0xc227('0x36')]['sort']);_0x5e3f10[_0xc227('0x42')]=qs['filters'](_[_0xc227('0x3f')](_0x3452a1['query'],_0x4d4bb0['filters']));if(_0x3452a1[_0xc227('0x36')][_0xc227('0x41')]){_0x5e3f10[_0xc227('0x42')]=_[_0xc227('0x43')](_0x5e3f10['where'],{'$or':_[_0xc227('0x31')](_0x5e3f10[_0xc227('0x38')],function(_0x487b6e){var _0x2775aa={};_0x2775aa[_0x487b6e]={'$like':'%'+_0x3452a1[_0xc227('0x36')][_0xc227('0x41')]+'%'};return _0x2775aa;})});}_0x5e3f10=_[_0xc227('0x43')]({},_0x5e3f10,_0x3452a1['options']);return _0x15c5c1['getUsers'](_0x5e3f10);}})[_0xc227('0x27')](function(_0x4cefc0){if(_0x4cefc0){_0x3df8f1=_0x4cefc0['length'];if(!_0x3452a1[_0xc227('0x36')][_0xc227('0x3b')](_0xc227('0x3c'))){_0x5e3f10[_0xc227('0x21')]=qs[_0xc227('0x21')](_0x3452a1[_0xc227('0x36')][_0xc227('0x21')]);_0x5e3f10['offset']=qs[_0xc227('0x1f')](_0x3452a1[_0xc227('0x36')]['offset']);}return _0x15c5c1[_0xc227('0x5b')](_0x5e3f10);}})['then'](function(_0x557683){if(_0x557683){return _0x557683?{'count':_0x3df8f1,'rows':_0x557683}:null;}})[_0xc227('0x27')](respondWithResult(_0x5332a2,null))['catch'](handleError(_0x5332a2,null));}; \ No newline at end of file +var _0x0d2e=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','merge','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','status','end','offset','undefined','count','limit','set','reject','update','then','destroy','get','SquareProjects','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','options','includeAll','include','findAll','catch','show','params','find','create','body','user','role','userProfileId'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x0d2e,0x1d8));var _0xe0d2=function(_0x2cde74,_0x55cf68){_0x2cde74=_0x2cde74-0x0;var _0x39ee49=_0x0d2e[_0x2cde74];return _0x39ee49;};'use strict';var emlformat=require(_0xe0d2('0x0'));var rimraf=require(_0xe0d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0d2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe0d2('0x3'));var Mustache=require(_0xe0d2('0x4'));var util=require('util');var path=require(_0xe0d2('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0d2('0x6'));var _=require(_0xe0d2('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0d2('0x8'));var deskjs=require(_0xe0d2('0x9'));var toCsv=require(_0xe0d2('0xa'));var querystring=require('querystring');var Papa=require(_0xe0d2('0xb'));var Redis=require(_0xe0d2('0xc'));var authService=require(_0xe0d2('0xd'));var qs=require(_0xe0d2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0d2('0xf'));var logger=require(_0xe0d2('0x10'))(_0xe0d2('0x11'));var utils=require(_0xe0d2('0x12'));var config=require(_0xe0d2('0x13'));var licenseUtil=require(_0xe0d2('0x14'));var db=require(_0xe0d2('0x15'))['db'];config['redis']=_[_0xe0d2('0x16')](config['redis'],{'host':_0xe0d2('0x17'),'port':0x18eb});var socket=require(_0xe0d2('0x18'))(new Redis(config[_0xe0d2('0x19')]));require(_0xe0d2('0x1a'))[_0xe0d2('0x1b')](socket);function respondWithStatusCode(_0x115c64,_0x3d4719){_0x3d4719=_0x3d4719||0xcc;return function(_0x47309f){if(_0x47309f){return _0x115c64['sendStatus'](_0x3d4719);}return _0x115c64[_0xe0d2('0x1c')](_0x3d4719)[_0xe0d2('0x1d')]();};}function respondWithResult(_0x4850d5,_0x4c86e7){_0x4c86e7=_0x4c86e7||0xc8;return function(_0xcd3974){if(_0xcd3974){return _0x4850d5[_0xe0d2('0x1c')](_0x4c86e7)['json'](_0xcd3974);}};}function respondWithFilteredResult(_0x38fcde,_0x32785c){return function(_0x25a8dc){if(_0x25a8dc){var _0x28c102=typeof _0x32785c[_0xe0d2('0x1e')]===_0xe0d2('0x1f')&&typeof _0x32785c['limit']===_0xe0d2('0x1f');var _0x56e945=_0x25a8dc[_0xe0d2('0x20')];var _0x45832d=_0x28c102?0x0:_0x32785c[_0xe0d2('0x1e')];var _0x3f2b86=_0x28c102?_0x25a8dc['count']:_0x32785c[_0xe0d2('0x1e')]+_0x32785c[_0xe0d2('0x21')];var _0x220be3;if(_0x3f2b86>=_0x56e945){_0x3f2b86=_0x56e945;_0x220be3=0xc8;}else{_0x220be3=0xce;}_0x38fcde[_0xe0d2('0x1c')](_0x220be3);return _0x38fcde[_0xe0d2('0x22')]('Content-Range',_0x45832d+'-'+_0x3f2b86+'/'+_0x56e945)['json'](_0x25a8dc);}return null;};}function patchUpdates(_0x183a2b){return function(_0x9f4c6a){try{jsonpatch['apply'](_0x9f4c6a,_0x183a2b,!![]);}catch(_0x5dc104){return BPromise[_0xe0d2('0x23')](_0x5dc104);}return _0x9f4c6a['save']();};}function saveUpdates(_0x20f0e7,_0x19f44c){return function(_0x1ca904){if(_0x1ca904){return _0x1ca904[_0xe0d2('0x24')](_0x20f0e7)[_0xe0d2('0x25')](function(_0x36439f){return _0x36439f;});}return null;};}function removeEntity(_0x328439,_0x22ac27){return function(_0x3caf2f){if(_0x3caf2f){return _0x3caf2f[_0xe0d2('0x26')]()['then'](function(){var _0x4596d7=_0x3caf2f[_0xe0d2('0x27')]({'plain':!![]});var _0x584047=_0xe0d2('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x584047,'resourceId':_0x4596d7['id']}})[_0xe0d2('0x25')](function(){return _0x3caf2f;});})[_0xe0d2('0x25')](function(){_0x328439[_0xe0d2('0x1c')](0xcc)[_0xe0d2('0x1d')]();});}};}function handleEntityNotFound(_0x352729,_0x203e06){return function(_0x58a45a){if(!_0x58a45a){_0x352729[_0xe0d2('0x29')](0x194);}return _0x58a45a;};}function handleError(_0xc18d35,_0x58063b){_0x58063b=_0x58063b||0x1f4;return function(_0x5a7d2d){logger[_0xe0d2('0x2a')](_0x5a7d2d[_0xe0d2('0x2b')]);if(_0x5a7d2d[_0xe0d2('0x2c')]){delete _0x5a7d2d['name'];}_0xc18d35['status'](_0x58063b)[_0xe0d2('0x2d')](_0x5a7d2d);};}exports[_0xe0d2('0x2e')]=function(_0xd026f9,_0x40f454){var _0x62c3cc={},_0x5dc40d={},_0x913d83={'count':0x0,'rows':[]};var _0xe4cc9f=_[_0xe0d2('0x2f')](db[_0xe0d2('0x30')][_0xe0d2('0x31')],function(_0x4b744f){return{'name':_0x4b744f[_0xe0d2('0x32')],'type':_0x4b744f['type'][_0xe0d2('0x33')]};});_0x5dc40d[_0xe0d2('0x34')]=_[_0xe0d2('0x2f')](_0xe4cc9f,_0xe0d2('0x2c'));_0x5dc40d[_0xe0d2('0x35')]=_[_0xe0d2('0x36')](_0xd026f9[_0xe0d2('0x35')]);_0x5dc40d[_0xe0d2('0x37')]=_[_0xe0d2('0x38')](_0x5dc40d[_0xe0d2('0x34')],_0x5dc40d[_0xe0d2('0x35')]);_0x62c3cc[_0xe0d2('0x39')]=_[_0xe0d2('0x38')](_0x5dc40d[_0xe0d2('0x34')],qs[_0xe0d2('0x3a')](_0xd026f9[_0xe0d2('0x35')][_0xe0d2('0x3a')]));_0x62c3cc[_0xe0d2('0x39')]=_0x62c3cc[_0xe0d2('0x39')][_0xe0d2('0x3b')]?_0x62c3cc[_0xe0d2('0x39')]:_0x5dc40d[_0xe0d2('0x34')];if(!_0xd026f9[_0xe0d2('0x35')][_0xe0d2('0x3c')](_0xe0d2('0x3d'))){_0x62c3cc[_0xe0d2('0x21')]=qs['limit'](_0xd026f9['query'][_0xe0d2('0x21')]);_0x62c3cc['offset']=qs[_0xe0d2('0x1e')](_0xd026f9[_0xe0d2('0x35')][_0xe0d2('0x1e')]);}_0x62c3cc[_0xe0d2('0x3e')]=qs[_0xe0d2('0x3f')](_0xd026f9[_0xe0d2('0x35')][_0xe0d2('0x3f')]);_0x62c3cc[_0xe0d2('0x40')]=qs[_0xe0d2('0x37')](_[_0xe0d2('0x41')](_0xd026f9[_0xe0d2('0x35')],_0x5dc40d['filters']),_0xe4cc9f);if(_0xd026f9[_0xe0d2('0x35')]['filter']){_0x62c3cc[_0xe0d2('0x40')]=_['merge'](_0x62c3cc[_0xe0d2('0x40')],{'$or':_[_0xe0d2('0x2f')](_0xe4cc9f,function(_0x2241cf){if(_0x2241cf[_0xe0d2('0x42')]!=='VIRTUAL'){var _0x73a9e0={};_0x73a9e0[_0x2241cf[_0xe0d2('0x2c')]]={'$like':'%'+_0xd026f9[_0xe0d2('0x35')]['filter']+'%'};return _0x73a9e0;}})});}_0x62c3cc=_['merge']({},_0x62c3cc,_0xd026f9[_0xe0d2('0x43')]);var _0x3c520e={'where':_0x62c3cc[_0xe0d2('0x40')]};return db[_0xe0d2('0x30')]['count'](_0x3c520e)['then'](function(_0x2a4c39){_0x913d83[_0xe0d2('0x20')]=_0x2a4c39;if(_0xd026f9['query'][_0xe0d2('0x44')]){_0x62c3cc[_0xe0d2('0x45')]=[{'all':!![]}];}return db[_0xe0d2('0x30')][_0xe0d2('0x46')](_0x62c3cc);})[_0xe0d2('0x25')](function(_0x3912de){_0x913d83['rows']=_0x3912de;return _0x913d83;})[_0xe0d2('0x25')](respondWithFilteredResult(_0x40f454,_0x62c3cc))[_0xe0d2('0x47')](handleError(_0x40f454,null));};exports[_0xe0d2('0x48')]=function(_0x19beb6,_0x2b74cc){var _0x57bc46={'raw':![],'where':{'id':_0x19beb6[_0xe0d2('0x49')]['id']}},_0x4d2a1b={};_0x4d2a1b[_0xe0d2('0x34')]=_[_0xe0d2('0x36')](db[_0xe0d2('0x30')][_0xe0d2('0x31')]);_0x4d2a1b[_0xe0d2('0x35')]=_[_0xe0d2('0x36')](_0x19beb6[_0xe0d2('0x35')]);_0x4d2a1b[_0xe0d2('0x37')]=_['intersection'](_0x4d2a1b['model'],_0x4d2a1b[_0xe0d2('0x35')]);_0x57bc46[_0xe0d2('0x39')]=_[_0xe0d2('0x38')](_0x4d2a1b[_0xe0d2('0x34')],qs[_0xe0d2('0x3a')](_0x19beb6['query'][_0xe0d2('0x3a')]));_0x57bc46[_0xe0d2('0x39')]=_0x57bc46[_0xe0d2('0x39')][_0xe0d2('0x3b')]?_0x57bc46['attributes']:_0x4d2a1b['model'];if(_0x19beb6[_0xe0d2('0x35')][_0xe0d2('0x44')]){_0x57bc46[_0xe0d2('0x45')]=[{'all':!![]}];}_0x57bc46=_['merge']({},_0x57bc46,_0x19beb6[_0xe0d2('0x43')]);return db[_0xe0d2('0x30')][_0xe0d2('0x4a')](_0x57bc46)[_0xe0d2('0x25')](handleEntityNotFound(_0x2b74cc,null))[_0xe0d2('0x25')](respondWithResult(_0x2b74cc,null))['catch'](handleError(_0x2b74cc,null));};exports[_0xe0d2('0x4b')]=function(_0xba7612,_0x5400f3){return db[_0xe0d2('0x30')][_0xe0d2('0x4b')](_0xba7612[_0xe0d2('0x4c')],{})[_0xe0d2('0x25')](function(_0x5570d6){var _0x310785=_0xba7612[_0xe0d2('0x4d')][_0xe0d2('0x27')]({'plain':!![]});if(!_0x310785)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x310785[_0xe0d2('0x4e')]==='user'){var _0x147422=_0x5570d6[_0xe0d2('0x27')]({'plain':!![]});var _0x5b2668=_0xe0d2('0x28');return db['UserProfileSection'][_0xe0d2('0x4a')]({'where':{'name':_0x5b2668,'userProfileId':_0x310785[_0xe0d2('0x4f')]},'raw':!![]})['then'](function(_0x2cf03c){if(_0x2cf03c&&_0x2cf03c['autoAssociation']===0x0){return db[_0xe0d2('0x50')]['create']({'name':_0x147422[_0xe0d2('0x2c')],'resourceId':_0x147422['id'],'type':_0x2cf03c[_0xe0d2('0x2c')],'sectionId':_0x2cf03c['id']},{})[_0xe0d2('0x25')](function(){return _0x5570d6;});}else{return _0x5570d6;}})['catch'](function(_0x19391a){logger[_0xe0d2('0x2a')](_0xe0d2('0x51'),_0x19391a);throw _0x19391a;});}return _0x5570d6;})['then'](respondWithResult(_0x5400f3,0xc9))[_0xe0d2('0x47')](handleError(_0x5400f3,null));};exports['update']=function(_0x2b6960,_0x2ed544){if(_0x2b6960[_0xe0d2('0x4c')]['id']){delete _0x2b6960[_0xe0d2('0x4c')]['id'];}return db[_0xe0d2('0x30')][_0xe0d2('0x4a')]({'where':{'id':_0x2b6960['params']['id']}})['then'](handleEntityNotFound(_0x2ed544,null))[_0xe0d2('0x25')](saveUpdates(_0x2b6960[_0xe0d2('0x4c')],null))[_0xe0d2('0x25')](respondWithResult(_0x2ed544,null))[_0xe0d2('0x47')](handleError(_0x2ed544,null));};exports['destroy']=function(_0x27a0ff,_0x3a9c1c){return db[_0xe0d2('0x30')]['find']({'where':{'id':_0x27a0ff[_0xe0d2('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a9c1c,null))[_0xe0d2('0x25')](removeEntity(_0x3a9c1c,null))[_0xe0d2('0x47')](handleError(_0x3a9c1c,null));};exports[_0xe0d2('0x52')]=function(_0x7d02cc,_0x46c904,_0xc37746){return db['SquareProject'][_0xe0d2('0x4a')]({'where':{'id':_0x7d02cc[_0xe0d2('0x49')]['id']}})[_0xe0d2('0x25')](handleEntityNotFound(_0x46c904,null))[_0xe0d2('0x25')](function(_0x48289d){if(_0x48289d){return _0x48289d[_0xe0d2('0x52')](_0x7d02cc[_0xe0d2('0x4c')][_0xe0d2('0x53')],_[_0xe0d2('0x54')](_0x7d02cc['body'],[_0xe0d2('0x53'),'id'])||{});}})[_0xe0d2('0x25')](respondWithResult(_0x46c904,null))['catch'](handleError(_0x46c904,null));};exports[_0xe0d2('0x55')]=function(_0x130758,_0xc10738,_0x570224){return db[_0xe0d2('0x30')][_0xe0d2('0x4a')]({'where':{'id':_0x130758[_0xe0d2('0x49')]['id']}})[_0xe0d2('0x25')](handleEntityNotFound(_0xc10738,null))[_0xe0d2('0x25')](function(_0x2477be){if(_0x2477be){return _0x2477be['removeUsers'](_0x130758[_0xe0d2('0x35')]['ids'])[_0xe0d2('0x25')](function(){if(_['isArray'](_0x130758[_0xe0d2('0x35')][_0xe0d2('0x53')])){for(var _0x500441=0x0;_0x500441<_0x130758['query'][_0xe0d2('0x53')]['length'];_0x500441+=0x1){socket[_0xe0d2('0x56')]('userSquareProject:remove',{'UserId':Number(_0x130758[_0xe0d2('0x35')][_0xe0d2('0x53')][_0x500441]),'SquareProjectId':Number(_0x130758[_0xe0d2('0x49')]['id'])});}}else{socket[_0xe0d2('0x56')](_0xe0d2('0x57'),{'UserId':Number(_0x130758[_0xe0d2('0x35')]['ids']),'SquareProjectId':Number(_0x130758[_0xe0d2('0x49')]['id'])});}});}})[_0xe0d2('0x25')](respondWithStatusCode(_0xc10738,null))['catch'](handleError(_0xc10738,null));};exports[_0xe0d2('0x58')]=function(_0x113330,_0x57907a,_0x3b0a8a){var _0x445ec1={};var _0x2cbadf={};var _0x1a0e26;var _0x192409;return db[_0xe0d2('0x30')][_0xe0d2('0x59')]({'where':{'id':_0x113330['params']['id']}})[_0xe0d2('0x25')](handleEntityNotFound(_0x57907a,null))['then'](function(_0x47d6a9){if(_0x47d6a9){_0x1a0e26=_0x47d6a9;_0x2cbadf[_0xe0d2('0x34')]=_[_0xe0d2('0x36')](db[_0xe0d2('0x5a')]['rawAttributes']);_0x2cbadf[_0xe0d2('0x35')]=_[_0xe0d2('0x36')](_0x113330[_0xe0d2('0x35')]);_0x2cbadf[_0xe0d2('0x37')]=_['intersection'](_0x2cbadf[_0xe0d2('0x34')],_0x2cbadf[_0xe0d2('0x35')]);_0x445ec1[_0xe0d2('0x39')]=_[_0xe0d2('0x38')](_0x2cbadf['model'],qs['fields'](_0x113330[_0xe0d2('0x35')][_0xe0d2('0x3a')]));_0x445ec1['attributes']=_0x445ec1[_0xe0d2('0x39')][_0xe0d2('0x3b')]?_0x445ec1[_0xe0d2('0x39')]:_0x2cbadf['model'];_0x445ec1[_0xe0d2('0x3e')]=qs[_0xe0d2('0x3f')](_0x113330[_0xe0d2('0x35')][_0xe0d2('0x3f')]);_0x445ec1['where']=qs[_0xe0d2('0x37')](_['pick'](_0x113330['query'],_0x2cbadf[_0xe0d2('0x37')]));if(_0x113330[_0xe0d2('0x35')]['filter']){_0x445ec1['where']=_[_0xe0d2('0x5b')](_0x445ec1[_0xe0d2('0x40')],{'$or':_[_0xe0d2('0x2f')](_0x445ec1[_0xe0d2('0x39')],function(_0x40882a){var _0x85a828={};_0x85a828[_0x40882a]={'$like':'%'+_0x113330[_0xe0d2('0x35')]['filter']+'%'};return _0x85a828;})});}_0x445ec1=_[_0xe0d2('0x5b')]({},_0x445ec1,_0x113330[_0xe0d2('0x43')]);return _0x1a0e26[_0xe0d2('0x58')](_0x445ec1);}})[_0xe0d2('0x25')](function(_0x5e97ef){if(_0x5e97ef){_0x192409=_0x5e97ef['length'];if(!_0x113330[_0xe0d2('0x35')][_0xe0d2('0x3c')](_0xe0d2('0x3d'))){_0x445ec1['limit']=qs['limit'](_0x113330[_0xe0d2('0x35')]['limit']);_0x445ec1[_0xe0d2('0x1e')]=qs['offset'](_0x113330[_0xe0d2('0x35')][_0xe0d2('0x1e')]);}return _0x1a0e26[_0xe0d2('0x58')](_0x445ec1);}})[_0xe0d2('0x25')](function(_0x1aa6bf){if(_0x1aa6bf){return _0x1aa6bf?{'count':_0x192409,'rows':_0x1aa6bf}:null;}})[_0xe0d2('0x25')](respondWithResult(_0x57907a,null))[_0xe0d2('0x47')](handleError(_0x57907a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b08badc..5052689 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 _0x91b5=['save','remove','emit','hasOwnProperty','hook','events','setMaxListeners'];(function(_0xf38d2f,_0x14a6ce){var _0x57d86a=function(_0x55952d){while(--_0x55952d){_0xf38d2f['push'](_0xf38d2f['shift']());}};_0x57d86a(++_0x14a6ce);}(_0x91b5,0xd0));var _0x591b=function(_0x5ae8ac,_0x5872f2){_0x5ae8ac=_0x5ae8ac-0x0;var _0x34f0bf=_0x91b5[_0x5ae8ac];return _0x34f0bf;};'use strict';var EventEmitter=require(_0x591b('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x591b('0x1')](0x0);var events={'afterCreate':_0x591b('0x2'),'afterUpdate':'update','afterDestroy':_0x591b('0x3')};function emitEvent(_0x1ac916){return function(_0x484244,_0x5cf8b2,_0x12188c){SquareProjectEvents[_0x591b('0x4')](_0x1ac916+':'+_0x484244['id'],_0x484244);SquareProjectEvents['emit'](_0x1ac916,_0x484244);_0x12188c(null);};}for(var e in events){if(events[_0x591b('0x5')](e)){var event=events[e];SquareProject[_0x591b('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x1ba7=['events','../../mysqldb','setMaxListeners','update','remove','emit','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ba7,0xaf));var _0x71ba=function(_0x3b5685,_0x5d5060){_0x3b5685=_0x3b5685-0x0;var _0x192312=_0x1ba7[_0x3b5685];return _0x192312;};'use strict';var EventEmitter=require(_0x71ba('0x0'));var SquareProject=require(_0x71ba('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x71ba('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x71ba('0x3'),'afterDestroy':_0x71ba('0x4')};function emitEvent(_0x2d148a){return function(_0x342175,_0x4e4313,_0x1553aa){SquareProjectEvents[_0x71ba('0x5')](_0x2d148a+':'+_0x342175['id'],_0x342175);SquareProjectEvents[_0x71ba('0x5')](_0x2d148a,_0x342175);_0x1553aa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x71ba('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 8639bd1..088bae8 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 _0x6d28=['../../config/environment','define','SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x6d28,0x14e));var _0x86d2=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x6d28[_0x5a79e2];return _0x266c45;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x86d2('0x0'))(_0x86d2('0x1'));var moment=require(_0x86d2('0x2'));var BPromise=require(_0x86d2('0x3'));var rp=require(_0x86d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d2('0x5'));var config=require(_0x86d2('0x6'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x4fb6db,_0x1a14cc){return _0x4fb6db[_0x86d2('0x7')](_0x86d2('0x8'),attributes,{'tableName':_0x86d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4cf168,_0x4c4cf5,_0x2b73ff){if(_0x4cf168['changed'](_0x86d2('0xa'))){_0x4cf168[_0x86d2('0xb')]=moment()[_0x86d2('0xc')](_0x86d2('0xd'));}if(_0x4cf168[_0x86d2('0xe')](_0x86d2('0xf'))){_0x4cf168[_0x86d2('0x10')]=moment()[_0x86d2('0xc')](_0x86d2('0xd'));}_0x2b73ff(null,_0x4cf168);}}});}; \ No newline at end of file +var _0x64cb=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util'];(function(_0x3d12b5,_0x3c47b1){var _0x4724a3=function(_0x54465b){while(--_0x54465b){_0x3d12b5['push'](_0x3d12b5['shift']());}};_0x4724a3(++_0x3c47b1);}(_0x64cb,0x1b3));var _0xb64c=function(_0x417182,_0x353daf){_0x417182=_0x417182-0x0;var _0x2045f9=_0x64cb[_0x417182];return _0x2045f9;};'use strict';var _=require(_0xb64c('0x0'));var util=require(_0xb64c('0x1'));var logger=require(_0xb64c('0x2'))('api');var moment=require(_0xb64c('0x3'));var BPromise=require(_0xb64c('0x4'));var rp=require(_0xb64c('0x5'));var fs=require('fs');var path=require(_0xb64c('0x6'));var rimraf=require(_0xb64c('0x7'));var config=require(_0xb64c('0x8'));var attributes=require(_0xb64c('0x9'));module['exports']=function(_0xe4eb62,_0x36165b){return _0xe4eb62[_0xb64c('0xa')](_0xb64c('0xb'),attributes,{'tableName':_0xb64c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d9e7c,_0x4afe05,_0x235ae0){if(_0x2d9e7c[_0xb64c('0xd')](_0xb64c('0xe'))){_0x2d9e7c[_0xb64c('0xf')]=moment()[_0xb64c('0x10')](_0xb64c('0x11'));}if(_0x2d9e7c[_0xb64c('0xd')](_0xb64c('0x12'))){_0x2d9e7c['publishedAt']=moment()[_0xb64c('0x10')](_0xb64c('0x11'));}_0x235ae0(null,_0x2d9e7c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index ca0d583..f196673 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 _0x1dbc=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','then','request\x20sent','debug','stringify','error','SquareProject,\x20%s,\x20%s','message','info','result','ShowSquareProject','SquareProject','find','options','attributes','include','model','map','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x2ec30d,_0x4dd1a4){var _0x5090e4=function(_0x4faf27){while(--_0x4faf27){_0x2ec30d['push'](_0x2ec30d['shift']());}};_0x5090e4(++_0x4dd1a4);}(_0x1dbc,0x17b));var _0xc1db=function(_0x1cb931,_0x41493d){_0x1cb931=_0x1cb931-0x0;var _0x1ef86b=_0x1dbc[_0x1cb931];return _0x1ef86b;};'use strict';var _=require(_0xc1db('0x0'));var util=require(_0xc1db('0x1'));var moment=require(_0xc1db('0x2'));var BPromise=require('bluebird');var rs=require(_0xc1db('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1db('0x4'))['db'];var utils=require(_0xc1db('0x5'));var logger=require(_0xc1db('0x6'))(_0xc1db('0x7'));var config=require(_0xc1db('0x8'));var jayson=require(_0xc1db('0x9'));var client=jayson[_0xc1db('0xa')][_0xc1db('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc1db('0xc'),'port':0x18eb});var socket=require(_0xc1db('0xd'))(new Redis(config[_0xc1db('0xe')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x55a796,_0x39741f,_0x50a90b){return new BPromise(function(_0x2920b1,_0x406cf2){return client['request'](_0x55a796,_0x50a90b)[_0xc1db('0xf')](function(_0xe4edf9){logger['info']('SquareProject,\x20%s,\x20%s',_0x39741f,_0xc1db('0x10'));logger[_0xc1db('0x11')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x39741f,'request\x20sent',JSON[_0xc1db('0x12')](_0xe4edf9));if(_0xe4edf9[_0xc1db('0x13')]){if(_0xe4edf9['error']['code']===0x1f4){logger[_0xc1db('0x13')](_0xc1db('0x14'),_0x39741f,_0xe4edf9[_0xc1db('0x13')][_0xc1db('0x15')]);return _0x406cf2(_0xe4edf9[_0xc1db('0x13')][_0xc1db('0x15')]);}logger[_0xc1db('0x13')](_0xc1db('0x14'),_0x39741f,_0xe4edf9[_0xc1db('0x13')][_0xc1db('0x15')]);return _0x2920b1(_0xe4edf9[_0xc1db('0x13')][_0xc1db('0x15')]);}else{logger[_0xc1db('0x16')]('SquareProject,\x20%s,\x20%s',_0x39741f,_0xc1db('0x10'));_0x2920b1(_0xe4edf9[_0xc1db('0x17')][_0xc1db('0x15')]);}})['catch'](function(_0x4dcd94){logger[_0xc1db('0x13')](_0xc1db('0x14'),_0x39741f,_0x4dcd94);_0x406cf2(_0x4dcd94);});});}exports[_0xc1db('0x18')]=function(_0x2a74f1){var _0x319f25=this;return new Promise(function(_0x3f4b38,_0xfa0af0){return db[_0xc1db('0x19')][_0xc1db('0x1a')]({'raw':_0x2a74f1[_0xc1db('0x1b')]?_0x2a74f1['options']['raw']===undefined?!![]:![]:!![],'where':_0x2a74f1[_0xc1db('0x1b')]?_0x2a74f1[_0xc1db('0x1b')]['where']||null:null,'attributes':_0x2a74f1[_0xc1db('0x1b')]?_0x2a74f1[_0xc1db('0x1b')][_0xc1db('0x1c')]||null:null,'include':_0x2a74f1[_0xc1db('0x1b')]?_0x2a74f1[_0xc1db('0x1b')][_0xc1db('0x1d')]?_['map'](_0x2a74f1[_0xc1db('0x1b')][_0xc1db('0x1d')],function(_0x42256c){return{'model':db[_0x42256c[_0xc1db('0x1e')]],'as':_0x42256c['as'],'attributes':_0x42256c[_0xc1db('0x1c')],'include':_0x42256c[_0xc1db('0x1d')]?_[_0xc1db('0x1f')](_0x42256c[_0xc1db('0x1d')],function(_0x503eca){return{'model':db[_0x503eca[_0xc1db('0x1e')]],'as':_0x503eca['as'],'attributes':_0x503eca[_0xc1db('0x1c')],'include':_0x503eca[_0xc1db('0x1d')]?_[_0xc1db('0x1f')](_0x503eca[_0xc1db('0x1d')],function(_0x1dea17){return{'model':db[_0x1dea17[_0xc1db('0x1e')]],'as':_0x1dea17['as'],'attributes':_0x1dea17['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1db('0xf')](function(_0x3bcabe){logger[_0xc1db('0x16')](_0xc1db('0x18'),_0x2a74f1);logger[_0xc1db('0x11')](_0xc1db('0x18'),_0x2a74f1,JSON['stringify'](_0x3bcabe));_0x3f4b38(_0x3bcabe);})['catch'](function(_0x2b5687){logger[_0xc1db('0x13')](_0xc1db('0x18'),_0x2b5687['message'],_0x2a74f1);_0xfa0af0(_0x319f25[_0xc1db('0x13')](0x1f4,_0x2b5687[_0xc1db('0x15')]));});});}; \ No newline at end of file +var _0x975c=['./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareProject','options','where','attributes','include','map','model','info','ShowSquareProject','debug','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x42a8cb,_0x164afc){var _0x3cf2aa=function(_0x4e3a6d){while(--_0x4e3a6d){_0x42a8cb['push'](_0x42a8cb['shift']());}};_0x3cf2aa(++_0x164afc);}(_0x975c,0x198));var _0xc975=function(_0x52176c,_0x1c146e){_0x52176c=_0x52176c-0x0;var _0x3d6f50=_0x975c[_0x52176c];return _0x3d6f50;};'use strict';var _=require('lodash');var util=require(_0xc975('0x0'));var moment=require(_0xc975('0x1'));var BPromise=require(_0xc975('0x2'));var rs=require(_0xc975('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc975('0x4'));var logger=require(_0xc975('0x5'))('rpc');var config=require(_0xc975('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc975('0x7')]['http']({'port':0x232a});config[_0xc975('0x8')]=_[_0xc975('0x9')](config['redis'],{'host':_0xc975('0xa'),'port':0x18eb});var socket=require(_0xc975('0xb'))(new Redis(config['redis']));require(_0xc975('0xc'))[_0xc975('0xd')](socket);function respondWithRpcPromise(_0x4cedb6,_0x1f081c,_0x201f80){return new BPromise(function(_0x314121,_0x1bdd2c){return client[_0xc975('0xe')](_0x4cedb6,_0x201f80)[_0xc975('0xf')](function(_0x40c1bb){logger['info'](_0xc975('0x10'),_0x1f081c,_0xc975('0x11'));logger['debug'](_0xc975('0x12'),_0x1f081c,_0xc975('0x11'),JSON[_0xc975('0x13')](_0x40c1bb));if(_0x40c1bb[_0xc975('0x14')]){if(_0x40c1bb[_0xc975('0x14')][_0xc975('0x15')]===0x1f4){logger[_0xc975('0x14')]('SquareProject,\x20%s,\x20%s',_0x1f081c,_0x40c1bb['error'][_0xc975('0x16')]);return _0x1bdd2c(_0x40c1bb[_0xc975('0x14')]['message']);}logger['error']('SquareProject,\x20%s,\x20%s',_0x1f081c,_0x40c1bb[_0xc975('0x14')]['message']);return _0x314121(_0x40c1bb['error'][_0xc975('0x16')]);}else{logger['info'](_0xc975('0x10'),_0x1f081c,_0xc975('0x11'));_0x314121(_0x40c1bb[_0xc975('0x17')][_0xc975('0x16')]);}})[_0xc975('0x18')](function(_0x2ebbfd){logger[_0xc975('0x14')](_0xc975('0x10'),_0x1f081c,_0x2ebbfd);_0x1bdd2c(_0x2ebbfd);});});}exports['ShowSquareProject']=function(_0x6cfa2d){var _0x20e639=this;return new Promise(function(_0x5b7168,_0xd36894){return db[_0xc975('0x19')]['find']({'raw':_0x6cfa2d[_0xc975('0x1a')]?_0x6cfa2d[_0xc975('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x6cfa2d[_0xc975('0x1a')]?_0x6cfa2d['options'][_0xc975('0x1b')]||null:null,'attributes':_0x6cfa2d[_0xc975('0x1a')]?_0x6cfa2d['options'][_0xc975('0x1c')]||null:null,'include':_0x6cfa2d['options']?_0x6cfa2d['options'][_0xc975('0x1d')]?_[_0xc975('0x1e')](_0x6cfa2d['options'][_0xc975('0x1d')],function(_0x2c6d49){return{'model':db[_0x2c6d49[_0xc975('0x1f')]],'as':_0x2c6d49['as'],'attributes':_0x2c6d49[_0xc975('0x1c')],'include':_0x2c6d49[_0xc975('0x1d')]?_[_0xc975('0x1e')](_0x2c6d49[_0xc975('0x1d')],function(_0x69051a){return{'model':db[_0x69051a[_0xc975('0x1f')]],'as':_0x69051a['as'],'attributes':_0x69051a[_0xc975('0x1c')],'include':_0x69051a[_0xc975('0x1d')]?_[_0xc975('0x1e')](_0x69051a[_0xc975('0x1d')],function(_0x54073b){return{'model':db[_0x54073b['model']],'as':_0x54073b['as'],'attributes':_0x54073b['attributes']};}):[]};}):[]};}):[]:[]})[_0xc975('0xf')](function(_0x42f097){logger[_0xc975('0x20')](_0xc975('0x21'),_0x6cfa2d);logger[_0xc975('0x22')](_0xc975('0x21'),_0x6cfa2d,JSON['stringify'](_0x42f097));_0x5b7168(_0x42f097);})[_0xc975('0x18')](function(_0x2f2285){logger[_0xc975('0x14')]('ShowSquareProject',_0x2f2285['message'],_0x6cfa2d);_0xd36894(_0x20e639['error'](0x1f4,_0x2f2285[_0xc975('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index df66dc3..62a7ed9 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 _0x17a2=['update','emit','length','squareProject:','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x17a2,0xe2));var _0x217a=function(_0x448add,_0x14e685){_0x448add=_0x448add-0x0;var _0x12d3f1=_0x17a2[_0x448add];return _0x12d3f1;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x217a('0x0'),_0x217a('0x1'),_0x217a('0x2')];function createListener(_0x40f9bc,_0x2feab1){return function(_0x4a2ce0){_0x2feab1[_0x217a('0x3')](_0x40f9bc,_0x4a2ce0);};}function removeListener(_0x10f958,_0x2c907a){return function(){SquareProjectEvents['removeListener'](_0x10f958,_0x2c907a);};}exports['register']=function(_0x3b9009){for(var _0x586ce6=0x0,_0x3f9ffa=events[_0x217a('0x4')];_0x586ce6<_0x3f9ffa;_0x586ce6++){var _0x3ed129=events[_0x586ce6];var _0x263dc5=createListener(_0x217a('0x5')+_0x3ed129,_0x3b9009);SquareProjectEvents['on'](_0x3ed129,_0x263dc5);}}; \ No newline at end of file +var _0xc1e9=['remove','update','removeListener','length','squareProject:','./squareProject.events'];(function(_0x109371,_0x441c8e){var _0x4fd858=function(_0x13504f){while(--_0x13504f){_0x109371['push'](_0x109371['shift']());}};_0x4fd858(++_0x441c8e);}(_0xc1e9,0x1b5));var _0x9c1e=function(_0x422ca6,_0x3a1dab){_0x422ca6=_0x422ca6-0x0;var _0x186702=_0xc1e9[_0x422ca6];return _0x186702;};'use strict';var SquareProjectEvents=require(_0x9c1e('0x0'));var events=['save',_0x9c1e('0x1'),_0x9c1e('0x2')];function createListener(_0x361c95,_0x491720){return function(_0x32264e){_0x491720['emit'](_0x361c95,_0x32264e);};}function removeListener(_0x11e770,_0x24c589){return function(){SquareProjectEvents[_0x9c1e('0x3')](_0x11e770,_0x24c589);};}exports['register']=function(_0x5e7bc3){for(var _0x59e3c4=0x0,_0x174183=events[_0x9c1e('0x4')];_0x59e3c4<_0x174183;_0x59e3c4++){var _0x37a153=events[_0x59e3c4];var _0x3dddb0=createListener(_0x9c1e('0x5')+_0x37a153,_0x5e7bc3);SquareProjectEvents['on'](_0x37a153,_0x3dddb0);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8127685..0c4e141 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x16e4c5,_0x2dd81f){var _0x11bfc0=function(_0x5002e9){while(--_0x5002e9){_0x16e4c5['push'](_0x16e4c5['shift']());}};_0x11bfc0(++_0x2dd81f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x521e7e,_0x3dc81d){_0x521e7e=_0x521e7e-0x0;var _0x182db8=_0x1cb9[_0x521e7e];return _0x182db8;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x231ba2,_0x478c94){var _0x2e0bb7=function(_0x3dffea){while(--_0x3dffea){_0x231ba2['push'](_0x231ba2['shift']());}};_0x2e0bb7(++_0x478c94);}(_0x814b,0x1a2));var _0xb814=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x814b[_0x4b7e4d];return _0x38d6af;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 8accd5e..bd9a8b1 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 _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x451bc6,_0x3a50a3){var _0x2d0faa=function(_0x24afd0){while(--_0x24afd0){_0x451bc6['push'](_0x451bc6['shift']());}};_0x2d0faa(++_0x3a50a3);}(_0x7c09,0x102));var _0x97c0=function(_0x41189a,_0x36b745){_0x41189a=_0x41189a-0x0;var _0x5ab985=_0x7c09[_0x41189a];return _0x5ab985;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file +var _0x7fbe=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x1d2401,_0x36c2d8){var _0x31450f=function(_0x347f31){while(--_0x347f31){_0x1d2401['push'](_0x1d2401['shift']());}};_0x31450f(++_0x36c2d8);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x54c72c,_0x4a6360){_0x54c72c=_0x54c72c-0x0;var _0x5e961a=_0x7fbe[_0x54c72c];return _0x5e961a;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7fb('0x0')]},'callerid':{'type':Sequelize[_0xe7fb('0x0')]},'calleridname':{'type':Sequelize[_0xe7fb('0x0')]},'context':{'type':Sequelize[_0xe7fb('0x0')]},'extension':{'type':Sequelize[_0xe7fb('0x0')]},'priority':{'type':Sequelize[_0xe7fb('0x0')]},'accountcode':{'type':Sequelize[_0xe7fb('0x0')]},'dnid':{'type':Sequelize[_0xe7fb('0x0')]},'projectName':{'type':Sequelize[_0xe7fb('0x0')]},'saveName':{'type':Sequelize[_0xe7fb('0x0')]},'filename':{'type':Sequelize[_0xe7fb('0x0')]},'savePath':{'type':Sequelize[_0xe7fb('0x0')]},'format':{'type':Sequelize[_0xe7fb('0x1')],'get':function(){var _0x1f943f='';var _0x5ad75b=this[_0xe7fb('0x2')](_0xe7fb('0x3'));if(_0x5ad75b){_0x1f943f=_0x5ad75b[_0xe7fb('0x4')](_0x5ad75b[_0xe7fb('0x5')]('.'));}return _0x1f943f;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 2d8462d..1738e42 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 _0x648e=['Sequelize','SquareRecording\x20not\x20found','extname','unlink','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','then','end','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','catch','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording'];(function(_0x493aaa,_0x1bf361){var _0x4f37ee=function(_0x366a3e){while(--_0x366a3e){_0x493aaa['push'](_0x493aaa['shift']());}};_0x4f37ee(++_0x1bf361);}(_0x648e,0x119));var _0xe648=function(_0x49810c,_0xea46fd){_0x49810c=_0x49810c-0x0;var _0x23f6f3=_0x648e[_0x49810c];return _0x23f6f3;};'use strict';var emlformat=require(_0xe648('0x0'));var rimraf=require(_0xe648('0x1'));var zipdir=require(_0xe648('0x2'));var jsonpatch=require(_0xe648('0x3'));var rp=require(_0xe648('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe648('0x5'));var util=require('util');var path=require(_0xe648('0x6'));var sox=require('sox');var csv=require(_0xe648('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe648('0x8'));var _=require(_0xe648('0x9'));var squel=require(_0xe648('0xa'));var crypto=require(_0xe648('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe648('0x7'));var querystring=require(_0xe648('0xc'));var Papa=require(_0xe648('0xd'));var Redis=require(_0xe648('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe648('0xf'));var as=require(_0xe648('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe648('0x11'));var utils=require(_0xe648('0x12'));var config=require(_0xe648('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe648('0x14'))['db'];function respondWithStatusCode(_0x11723,_0x1929b3){_0x1929b3=_0x1929b3||0xcc;return function(_0xeb5f03){if(_0xeb5f03){return _0x11723[_0xe648('0x15')](_0x1929b3);}return _0x11723[_0xe648('0x16')](_0x1929b3)['end']();};}function respondWithResult(_0x15b0ea,_0x13ce07){_0x13ce07=_0x13ce07||0xc8;return function(_0x1ece80){if(_0x1ece80){return _0x15b0ea[_0xe648('0x16')](_0x13ce07)['json'](_0x1ece80);}};}function respondWithFilteredResult(_0x2c2b47,_0x48acca){return function(_0x5766a7){if(_0x5766a7){var _0x3cd84d=typeof _0x48acca[_0xe648('0x17')]===_0xe648('0x18')&&typeof _0x48acca['limit']==='undefined';var _0x24f397=_0x5766a7[_0xe648('0x19')];var _0x153414=_0x3cd84d?0x0:_0x48acca[_0xe648('0x17')];var _0x1fb04b=_0x3cd84d?_0x5766a7['count']:_0x48acca[_0xe648('0x17')]+_0x48acca[_0xe648('0x1a')];var _0x507ef7;if(_0x1fb04b>=_0x24f397){_0x1fb04b=_0x24f397;_0x507ef7=0xc8;}else{_0x507ef7=0xce;}_0x2c2b47[_0xe648('0x16')](_0x507ef7);return _0x2c2b47[_0xe648('0x1b')](_0xe648('0x1c'),_0x153414+'-'+_0x1fb04b+'/'+_0x24f397)[_0xe648('0x1d')](_0x5766a7);}return null;};}function patchUpdates(_0x52a542){return function(_0x35f6c7){try{jsonpatch['apply'](_0x35f6c7,_0x52a542,!![]);}catch(_0x4b3f38){return BPromise['reject'](_0x4b3f38);}return _0x35f6c7['save']();};}function saveUpdates(_0x4bd096,_0x1493db){return function(_0x3d572e){if(_0x3d572e){return _0x3d572e[_0xe648('0x1e')](_0x4bd096)['then'](function(_0x29f12d){return _0x29f12d;});}return null;};}function removeEntity(_0x455646,_0x144e9e){return function(_0x2e0249){if(_0x2e0249){return _0x2e0249[_0xe648('0x1f')]()[_0xe648('0x20')](function(){_0x455646[_0xe648('0x16')](0xcc)[_0xe648('0x21')]();});}};}function handleEntityNotFound(_0x4b46fa,_0x16a730){return function(_0x573d8f){if(!_0x573d8f){_0x4b46fa[_0xe648('0x15')](0x194);}return _0x573d8f;};}function handleError(_0x4f509c,_0x1ed0da){_0x1ed0da=_0x1ed0da||0x1f4;return function(_0x125ed2){logger['error'](_0x125ed2[_0xe648('0x22')]);if(_0x125ed2[_0xe648('0x23')]){delete _0x125ed2[_0xe648('0x23')];}_0x4f509c[_0xe648('0x16')](_0x1ed0da)[_0xe648('0x24')](_0x125ed2);};}exports['index']=function(_0x411a2d,_0x1462fa){var _0x4fad83={},_0x2dfa88={},_0x2f133e={'count':0x0,'rows':[]};var _0x3d0bd0=_[_0xe648('0x25')](db[_0xe648('0x26')][_0xe648('0x27')],function(_0x576711){return{'name':_0x576711[_0xe648('0x28')],'type':_0x576711[_0xe648('0x29')][_0xe648('0x2a')]};});_0x2dfa88[_0xe648('0x2b')]=_[_0xe648('0x25')](_0x3d0bd0,_0xe648('0x23'));_0x2dfa88[_0xe648('0x2c')]=_[_0xe648('0x2d')](_0x411a2d['query']);_0x2dfa88[_0xe648('0x2e')]=_['intersection'](_0x2dfa88[_0xe648('0x2b')],_0x2dfa88[_0xe648('0x2c')]);_0x4fad83[_0xe648('0x2f')]=_[_0xe648('0x30')](_0x2dfa88[_0xe648('0x2b')],qs[_0xe648('0x31')](_0x411a2d['query']['fields']));_0x4fad83[_0xe648('0x2f')]=_0x4fad83[_0xe648('0x2f')][_0xe648('0x32')]?_0x4fad83[_0xe648('0x2f')]:_0x2dfa88[_0xe648('0x2b')];if(!_0x411a2d[_0xe648('0x2c')][_0xe648('0x33')](_0xe648('0x34'))){_0x4fad83[_0xe648('0x1a')]=qs['limit'](_0x411a2d[_0xe648('0x2c')][_0xe648('0x1a')]);_0x4fad83[_0xe648('0x17')]=qs[_0xe648('0x17')](_0x411a2d[_0xe648('0x2c')][_0xe648('0x17')]);}_0x4fad83['order']=qs[_0xe648('0x35')](_0x411a2d['query'][_0xe648('0x35')]);_0x4fad83[_0xe648('0x36')]=qs[_0xe648('0x2e')](_[_0xe648('0x37')](_0x411a2d['query'],_0x2dfa88['filters']),_0x3d0bd0);if(_0x411a2d[_0xe648('0x2c')][_0xe648('0x38')]){_0x4fad83[_0xe648('0x36')]=_[_0xe648('0x39')](_0x4fad83[_0xe648('0x36')],{'$or':_[_0xe648('0x25')](_0x3d0bd0,function(_0xd89e53){if(_0xd89e53[_0xe648('0x29')]!==_0xe648('0x3a')){var _0x1f8de9={};_0x1f8de9[_0xd89e53[_0xe648('0x23')]]={'$like':'%'+_0x411a2d[_0xe648('0x2c')]['filter']+'%'};return _0x1f8de9;}})});}_0x4fad83=_[_0xe648('0x39')]({},_0x4fad83,_0x411a2d['options']);var _0x1436b9={'where':_0x4fad83['where']};return db[_0xe648('0x26')][_0xe648('0x19')](_0x1436b9)[_0xe648('0x20')](function(_0x38f08b){_0x2f133e[_0xe648('0x19')]=_0x38f08b;if(_0x411a2d['query'][_0xe648('0x3b')]){_0x4fad83[_0xe648('0x3c')]=[{'all':!![]}];}return db[_0xe648('0x26')][_0xe648('0x3d')](_0x4fad83);})['then'](function(_0x175bcf){_0x2f133e['rows']=_0x175bcf;return _0x2f133e;})[_0xe648('0x20')](respondWithFilteredResult(_0x1462fa,_0x4fad83))['catch'](handleError(_0x1462fa,null));};exports[_0xe648('0x3e')]=function(_0x592343,_0x4b88dc){var _0x4255e4={'raw':!![],'where':{'id':_0x592343[_0xe648('0x3f')]['id']}},_0x570ba8={};_0x570ba8['model']=_[_0xe648('0x2d')](db[_0xe648('0x26')]['rawAttributes']);_0x570ba8[_0xe648('0x2c')]=_[_0xe648('0x2d')](_0x592343[_0xe648('0x2c')]);_0x570ba8[_0xe648('0x2e')]=_[_0xe648('0x30')](_0x570ba8[_0xe648('0x2b')],_0x570ba8[_0xe648('0x2c')]);_0x4255e4[_0xe648('0x2f')]=_[_0xe648('0x30')](_0x570ba8[_0xe648('0x2b')],qs[_0xe648('0x31')](_0x592343[_0xe648('0x2c')][_0xe648('0x31')]));_0x4255e4[_0xe648('0x2f')]=_0x4255e4[_0xe648('0x2f')]['length']?_0x4255e4[_0xe648('0x2f')]:_0x570ba8[_0xe648('0x2b')];if(_0x592343[_0xe648('0x2c')][_0xe648('0x3b')]){_0x4255e4[_0xe648('0x3c')]=[{'all':!![]}];}_0x4255e4=_[_0xe648('0x39')]({},_0x4255e4,_0x592343[_0xe648('0x40')]);return db[_0xe648('0x26')]['find'](_0x4255e4)['then'](handleEntityNotFound(_0x4b88dc,null))[_0xe648('0x20')](respondWithResult(_0x4b88dc,null))[_0xe648('0x41')](handleError(_0x4b88dc,null));};exports['create']=function(_0x3e63bd,_0x265d1f){return db[_0xe648('0x26')][_0xe648('0x42')](_0x3e63bd['body'],{})[_0xe648('0x20')](respondWithResult(_0x265d1f,0xc9))[_0xe648('0x41')](handleError(_0x265d1f,null));};exports[_0xe648('0x1e')]=function(_0x39c816,_0x38d925){if(_0x39c816['body']['id']){delete _0x39c816[_0xe648('0x43')]['id'];}return db[_0xe648('0x26')][_0xe648('0x44')]({'where':{'id':_0x39c816['params']['id']}})[_0xe648('0x20')](handleEntityNotFound(_0x38d925,null))[_0xe648('0x20')](saveUpdates(_0x39c816['body'],null))[_0xe648('0x20')](respondWithResult(_0x38d925,null))[_0xe648('0x41')](handleError(_0x38d925,null));};exports[_0xe648('0x45')]=function(_0x15c6f4,_0x5ccd53,_0xcb0ae8){var _0x3bc24e=require(_0xe648('0x46'));var _0x374881=![];var _0x4d6a87={};if(_0x15c6f4[_0xe648('0x2c')][_0xe648('0x29')]&&_0x15c6f4[_0xe648('0x2c')]['type']===_0xe648('0x47')){_0x4d6a87[_0xe648('0x47')]=_0x15c6f4[_0xe648('0x3f')]['id'];}else{_0x4d6a87['id']=_0x15c6f4['params']['id'];}return db[_0xe648('0x26')][_0xe648('0x44')]({'where':_0x4d6a87,'attributes':['id',_0xe648('0x48'),_0xe648('0x49')],'raw':!![]})[_0xe648('0x20')](handleEntityNotFound(_0x5ccd53,null))[_0xe648('0x20')](function(_0x461e66){if(_0x461e66){var _0x5d2b1c=_0x461e66[_0xe648('0x48')];var _0x33f9de=util[_0xe648('0x4a')]('%s.cypher',_0x5d2b1c);if(fs[_0xe648('0x4b')](_0x33f9de)){_0x374881=!![];return _0x3bc24e[_0xe648('0x4c')](_0x33f9de,_0x5d2b1c,config[_0xe648('0x4d')][_0xe648('0x4e')])[_0xe648('0x20')](function(){return _0x461e66;});}return _0x461e66;}})[_0xe648('0x20')](function(_0x450d1f){if(_0x450d1f){var _0x4ebd9e=_0x450d1f[_0xe648('0x48')];if(!fs[_0xe648('0x4b')](_0x4ebd9e)){throw new db[(_0xe648('0x4f'))]['ValidationError'](_0xe648('0x50'));}if(_0x450d1f[_0xe648('0x49')]){return _0x5ccd53[_0xe648('0x45')](_0x4ebd9e,_0x450d1f['filename']+path[_0xe648('0x51')](_0x4ebd9e),function(){if(_0x374881){fs[_0xe648('0x52')](_0x4ebd9e);}});}else{return _0x5ccd53['download'](_0x4ebd9e,function(_0x26ba88){if(_0x374881){fs[_0xe648('0x52')](_0x4ebd9e);}});}}})[_0xe648('0x41')](function(_0x1961bd){if(_0x1961bd['message']===_0xe648('0x50')){_0x5ccd53['status'](0x194)[_0xe648('0x24')]('Not\x20found');}else{return handleError(_0x5ccd53,null);}});};exports['destroy']=function(_0x30ed2d,_0x25f46f){return db[_0xe648('0x26')][_0xe648('0x44')]({'where':{'id':_0x30ed2d[_0xe648('0x3f')]['id']}})['then'](function(_0x50943e){if(_['isNil'](_0x50943e)){throw new ReferenceError(_0xe648('0x53'));}return _0x50943e;})[_0xe648('0x20')](function(_0x11f877){var _0x3b60fb=_0x11f877[_0xe648('0x48')];logger[_0xe648('0x54')]('cancellazione\x20fisica\x20documento\x20%s',_0x3b60fb);if(!_['isNil'](_0x11f877['savePath'])&&fs[_0xe648('0x4b')](_0x3b60fb)){logger['info'](_0xe648('0x55')+_0x3b60fb+_0xe648('0x56'));fs[_0xe648('0x57')](_0x3b60fb);}_0x3b60fb=_0x3b60fb+_0xe648('0x58');if(!_[_0xe648('0x59')](_0x11f877[_0xe648('0x48')])&&fs[_0xe648('0x4b')](_0x3b60fb)){logger[_0xe648('0x54')](_0xe648('0x55')+_0x3b60fb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe648('0x57')](_0x3b60fb);}return _0x11f877;})[_0xe648('0x20')](function(_0x2f528a){if(!_0x2f528a)throw new InternalError();return _0x2f528a[_0xe648('0x1f')]();})[_0xe648('0x20')](function(){_0x25f46f['status'](0xcc)[_0xe648('0x21')]();})[_0xe648('0x41')](handleError(_0x25f46f,null));}; \ No newline at end of file +var _0xf291=['type','query','filters','model','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','SquareRecording','includeAll','include','rows','catch','show','params','keys','create','body','find','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','decryptFile','secrets','Sequelize','SquareRecording\x20not\x20found','filename','unlink','download','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','rawAttributes','fieldName'];(function(_0x23458c,_0x36e8c4){var _0x1411b5=function(_0x10a9c0){while(--_0x10a9c0){_0x23458c['push'](_0x23458c['shift']());}};_0x1411b5(++_0x36e8c4);}(_0xf291,0x1b6));var _0x1f29=function(_0xf47eed,_0x3fff51){_0xf47eed=_0xf47eed-0x0;var _0x55f202=_0xf291[_0xf47eed];return _0x55f202;};'use strict';var emlformat=require(_0x1f29('0x0'));var rimraf=require(_0x1f29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f29('0x2'));var rp=require('request-promise');var moment=require(_0x1f29('0x3'));var BPromise=require(_0x1f29('0x4'));var Mustache=require(_0x1f29('0x5'));var util=require('util');var path=require(_0x1f29('0x6'));var sox=require(_0x1f29('0x7'));var csv=require(_0x1f29('0x8'));var ejs=require(_0x1f29('0x9'));var fs=require('fs');var fs_extra=require(_0x1f29('0xa'));var _=require(_0x1f29('0xb'));var squel=require(_0x1f29('0xc'));var crypto=require(_0x1f29('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f29('0xe'));var toCsv=require(_0x1f29('0x8'));var querystring=require(_0x1f29('0xf'));var Papa=require(_0x1f29('0x10'));var Redis=require('ioredis');var authService=require(_0x1f29('0x11'));var qs=require(_0x1f29('0x12'));var as=require(_0x1f29('0x13'));var hardwareService=require(_0x1f29('0x14'));var logger=require(_0x1f29('0x15'))(_0x1f29('0x16'));var utils=require('../../config/utils');var config=require(_0x1f29('0x17'));var licenseUtil=require(_0x1f29('0x18'));var db=require(_0x1f29('0x19'))['db'];function respondWithStatusCode(_0x290a22,_0x4ea0bf){_0x4ea0bf=_0x4ea0bf||0xcc;return function(_0x15ccdb){if(_0x15ccdb){return _0x290a22[_0x1f29('0x1a')](_0x4ea0bf);}return _0x290a22[_0x1f29('0x1b')](_0x4ea0bf)[_0x1f29('0x1c')]();};}function respondWithResult(_0x2ed435,_0x5b0686){_0x5b0686=_0x5b0686||0xc8;return function(_0xf5e7c8){if(_0xf5e7c8){return _0x2ed435['status'](_0x5b0686)[_0x1f29('0x1d')](_0xf5e7c8);}};}function respondWithFilteredResult(_0x4bde44,_0x22f56a){return function(_0x1a2d81){if(_0x1a2d81){var _0x3a3cdc=typeof _0x22f56a['offset']===_0x1f29('0x1e')&&typeof _0x22f56a['limit']===_0x1f29('0x1e');var _0x4bdde1=_0x1a2d81[_0x1f29('0x1f')];var _0x26912e=_0x3a3cdc?0x0:_0x22f56a['offset'];var _0x3e0957=_0x3a3cdc?_0x1a2d81[_0x1f29('0x1f')]:_0x22f56a[_0x1f29('0x20')]+_0x22f56a[_0x1f29('0x21')];var _0x153051;if(_0x3e0957>=_0x4bdde1){_0x3e0957=_0x4bdde1;_0x153051=0xc8;}else{_0x153051=0xce;}_0x4bde44[_0x1f29('0x1b')](_0x153051);return _0x4bde44[_0x1f29('0x22')](_0x1f29('0x23'),_0x26912e+'-'+_0x3e0957+'/'+_0x4bdde1)[_0x1f29('0x1d')](_0x1a2d81);}return null;};}function patchUpdates(_0x105668){return function(_0x5a0121){try{jsonpatch[_0x1f29('0x24')](_0x5a0121,_0x105668,!![]);}catch(_0x18abfe){return BPromise[_0x1f29('0x25')](_0x18abfe);}return _0x5a0121['save']();};}function saveUpdates(_0x391367,_0x19cb5e){return function(_0x1b9be8){if(_0x1b9be8){return _0x1b9be8[_0x1f29('0x26')](_0x391367)['then'](function(_0xe83ed){return _0xe83ed;});}return null;};}function removeEntity(_0x1ff444,_0x3fe4d9){return function(_0x85a05d){if(_0x85a05d){return _0x85a05d['destroy']()[_0x1f29('0x27')](function(){_0x1ff444[_0x1f29('0x1b')](0xcc)[_0x1f29('0x1c')]();});}};}function handleEntityNotFound(_0x1a4fca,_0x49042a){return function(_0x283696){if(!_0x283696){_0x1a4fca[_0x1f29('0x1a')](0x194);}return _0x283696;};}function handleError(_0x740cb0,_0x321ff9){_0x321ff9=_0x321ff9||0x1f4;return function(_0x525303){logger[_0x1f29('0x28')](_0x525303[_0x1f29('0x29')]);if(_0x525303[_0x1f29('0x2a')]){delete _0x525303['name'];}_0x740cb0['status'](_0x321ff9)[_0x1f29('0x2b')](_0x525303);};}exports['index']=function(_0x1c856c,_0x4b6f83){var _0x36d565={},_0x250ecd={},_0x270068={'count':0x0,'rows':[]};var _0x253b39=_[_0x1f29('0x2c')](db['SquareRecording'][_0x1f29('0x2d')],function(_0x5a0652){return{'name':_0x5a0652[_0x1f29('0x2e')],'type':_0x5a0652[_0x1f29('0x2f')]['key']};});_0x250ecd['model']=_[_0x1f29('0x2c')](_0x253b39,_0x1f29('0x2a'));_0x250ecd[_0x1f29('0x30')]=_['keys'](_0x1c856c['query']);_0x250ecd[_0x1f29('0x31')]=_['intersection'](_0x250ecd[_0x1f29('0x32')],_0x250ecd[_0x1f29('0x30')]);_0x36d565['attributes']=_[_0x1f29('0x33')](_0x250ecd[_0x1f29('0x32')],qs[_0x1f29('0x34')](_0x1c856c[_0x1f29('0x30')][_0x1f29('0x34')]));_0x36d565[_0x1f29('0x35')]=_0x36d565['attributes'][_0x1f29('0x36')]?_0x36d565[_0x1f29('0x35')]:_0x250ecd[_0x1f29('0x32')];if(!_0x1c856c['query']['hasOwnProperty'](_0x1f29('0x37'))){_0x36d565[_0x1f29('0x21')]=qs[_0x1f29('0x21')](_0x1c856c[_0x1f29('0x30')]['limit']);_0x36d565[_0x1f29('0x20')]=qs['offset'](_0x1c856c[_0x1f29('0x30')][_0x1f29('0x20')]);}_0x36d565['order']=qs[_0x1f29('0x38')](_0x1c856c['query']['sort']);_0x36d565['where']=qs[_0x1f29('0x31')](_[_0x1f29('0x39')](_0x1c856c[_0x1f29('0x30')],_0x250ecd[_0x1f29('0x31')]),_0x253b39);if(_0x1c856c[_0x1f29('0x30')][_0x1f29('0x3a')]){_0x36d565[_0x1f29('0x3b')]=_[_0x1f29('0x3c')](_0x36d565[_0x1f29('0x3b')],{'$or':_[_0x1f29('0x2c')](_0x253b39,function(_0xade264){if(_0xade264[_0x1f29('0x2f')]!==_0x1f29('0x3d')){var _0x25f2ba={};_0x25f2ba[_0xade264['name']]={'$like':'%'+_0x1c856c[_0x1f29('0x30')][_0x1f29('0x3a')]+'%'};return _0x25f2ba;}})});}_0x36d565=_[_0x1f29('0x3c')]({},_0x36d565,_0x1c856c[_0x1f29('0x3e')]);var _0x18e84c={'where':_0x36d565['where']};return db[_0x1f29('0x3f')][_0x1f29('0x1f')](_0x18e84c)[_0x1f29('0x27')](function(_0xaa07e){_0x270068[_0x1f29('0x1f')]=_0xaa07e;if(_0x1c856c[_0x1f29('0x30')][_0x1f29('0x40')]){_0x36d565[_0x1f29('0x41')]=[{'all':!![]}];}return db[_0x1f29('0x3f')]['findAll'](_0x36d565);})[_0x1f29('0x27')](function(_0x46c707){_0x270068[_0x1f29('0x42')]=_0x46c707;return _0x270068;})[_0x1f29('0x27')](respondWithFilteredResult(_0x4b6f83,_0x36d565))[_0x1f29('0x43')](handleError(_0x4b6f83,null));};exports[_0x1f29('0x44')]=function(_0x3f1847,_0x105ac3){var _0x2d899b={'raw':!![],'where':{'id':_0x3f1847[_0x1f29('0x45')]['id']}},_0x493e3a={};_0x493e3a[_0x1f29('0x32')]=_[_0x1f29('0x46')](db[_0x1f29('0x3f')][_0x1f29('0x2d')]);_0x493e3a[_0x1f29('0x30')]=_[_0x1f29('0x46')](_0x3f1847[_0x1f29('0x30')]);_0x493e3a['filters']=_['intersection'](_0x493e3a['model'],_0x493e3a[_0x1f29('0x30')]);_0x2d899b['attributes']=_[_0x1f29('0x33')](_0x493e3a[_0x1f29('0x32')],qs[_0x1f29('0x34')](_0x3f1847[_0x1f29('0x30')][_0x1f29('0x34')]));_0x2d899b[_0x1f29('0x35')]=_0x2d899b[_0x1f29('0x35')]['length']?_0x2d899b[_0x1f29('0x35')]:_0x493e3a['model'];if(_0x3f1847[_0x1f29('0x30')][_0x1f29('0x40')]){_0x2d899b[_0x1f29('0x41')]=[{'all':!![]}];}_0x2d899b=_['merge']({},_0x2d899b,_0x3f1847['options']);return db[_0x1f29('0x3f')]['find'](_0x2d899b)['then'](handleEntityNotFound(_0x105ac3,null))[_0x1f29('0x27')](respondWithResult(_0x105ac3,null))['catch'](handleError(_0x105ac3,null));};exports[_0x1f29('0x47')]=function(_0xd60d81,_0x144227){return db[_0x1f29('0x3f')][_0x1f29('0x47')](_0xd60d81[_0x1f29('0x48')],{})[_0x1f29('0x27')](respondWithResult(_0x144227,0xc9))['catch'](handleError(_0x144227,null));};exports[_0x1f29('0x26')]=function(_0x45077b,_0xe8e827){if(_0x45077b[_0x1f29('0x48')]['id']){delete _0x45077b[_0x1f29('0x48')]['id'];}return db[_0x1f29('0x3f')][_0x1f29('0x49')]({'where':{'id':_0x45077b[_0x1f29('0x45')]['id']}})['then'](handleEntityNotFound(_0xe8e827,null))['then'](saveUpdates(_0x45077b[_0x1f29('0x48')],null))['then'](respondWithResult(_0xe8e827,null))['catch'](handleError(_0xe8e827,null));};exports['download']=function(_0x54ecff,_0x295675,_0x2d6c8a){var _0x5cc027=require(_0x1f29('0x4a'));var _0x41f771=![];var _0x505a22={};if(_0x54ecff[_0x1f29('0x30')][_0x1f29('0x2f')]&&_0x54ecff['query']['type']===_0x1f29('0x4b')){_0x505a22['uniqueid']=_0x54ecff['params']['id'];}else{_0x505a22['id']=_0x54ecff[_0x1f29('0x45')]['id'];}return db[_0x1f29('0x3f')][_0x1f29('0x49')]({'where':_0x505a22,'attributes':['id','savePath','filename'],'raw':!![]})[_0x1f29('0x27')](handleEntityNotFound(_0x295675,null))['then'](function(_0x4f96e8){if(_0x4f96e8){var _0x2b600c=_0x4f96e8[_0x1f29('0x4c')];var _0x3e74ff=util['format'](_0x1f29('0x4d'),_0x2b600c);if(fs[_0x1f29('0x4e')](_0x3e74ff)){_0x41f771=!![];return _0x5cc027[_0x1f29('0x4f')](_0x3e74ff,_0x2b600c,config[_0x1f29('0x50')]['recording'])['then'](function(){return _0x4f96e8;});}return _0x4f96e8;}})[_0x1f29('0x27')](function(_0x32653f){if(_0x32653f){var _0xc80b96=_0x32653f[_0x1f29('0x4c')];if(!fs[_0x1f29('0x4e')](_0xc80b96)){throw new db[(_0x1f29('0x51'))]['ValidationError'](_0x1f29('0x52'));}if(_0x32653f[_0x1f29('0x53')]){return _0x295675['download'](_0xc80b96,_0x32653f[_0x1f29('0x53')]+path['extname'](_0xc80b96),function(){if(_0x41f771){fs[_0x1f29('0x54')](_0xc80b96);}});}else{return _0x295675[_0x1f29('0x55')](_0xc80b96,function(_0x396249){if(_0x41f771){fs[_0x1f29('0x54')](_0xc80b96);}});}}})[_0x1f29('0x43')](function(_0x23b929){if(_0x23b929[_0x1f29('0x56')]==='SquareRecording\x20not\x20found'){_0x295675[_0x1f29('0x1b')](0x194)[_0x1f29('0x2b')](_0x1f29('0x57'));}else{return handleError(_0x295675,null);}});};exports['destroy']=function(_0x3194e4,_0x555652){return db['SquareRecording'][_0x1f29('0x49')]({'where':{'id':_0x3194e4[_0x1f29('0x45')]['id']}})[_0x1f29('0x27')](function(_0x4f88f6){if(_[_0x1f29('0x58')](_0x4f88f6)){throw new ReferenceError(_0x1f29('0x59'));}return _0x4f88f6;})[_0x1f29('0x27')](function(_0x339219){var _0x22a105=_0x339219[_0x1f29('0x4c')];logger[_0x1f29('0x5a')](_0x1f29('0x5b'),_0x22a105);if(!_[_0x1f29('0x58')](_0x339219[_0x1f29('0x4c')])&&fs[_0x1f29('0x4e')](_0x22a105)){logger[_0x1f29('0x5a')](_0x1f29('0x5c')+_0x22a105+_0x1f29('0x5d'));fs['unlinkSync'](_0x22a105);}_0x22a105=_0x22a105+_0x1f29('0x5e');if(!_[_0x1f29('0x58')](_0x339219[_0x1f29('0x4c')])&&fs[_0x1f29('0x4e')](_0x22a105)){logger[_0x1f29('0x5a')]('File:\x20\x22'+_0x22a105+_0x1f29('0x5d'));fs[_0x1f29('0x5f')](_0x22a105);}return _0x339219;})[_0x1f29('0x27')](function(_0x49f4ea){if(!_0x49f4ea)throw new InternalError();return _0x49f4ea[_0x1f29('0x60')]();})['then'](function(){_0x555652['status'](0xcc)[_0x1f29('0x1c')]();})['catch'](handleError(_0x555652,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6adaefd..8f18a85 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 _0x7c71=['define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','./squareRecording.attributes','exports'];(function(_0x1d2097,_0x245566){var _0x54cc47=function(_0x378a97){while(--_0x378a97){_0x1d2097['push'](_0x1d2097['shift']());}};_0x54cc47(++_0x245566);}(_0x7c71,0x177));var _0x17c7=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x7c71[_0x59eefb];return _0x1a49e8;};'use strict';var _=require(_0x17c7('0x0'));var util=require(_0x17c7('0x1'));var logger=require(_0x17c7('0x2'))(_0x17c7('0x3'));var moment=require('moment');var BPromise=require(_0x17c7('0x4'));var rp=require(_0x17c7('0x5'));var fs=require('fs');var path=require(_0x17c7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x17c7('0x7'));module[_0x17c7('0x8')]=function(_0x26b276,_0x3e98d9){return _0x26b276[_0x17c7('0x9')](_0x17c7('0xa'),attributes,{'tableName':_0x17c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09d2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareRecording','lodash','util'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x09d2,0x1d2));var _0x209d=function(_0x340975,_0x1edb59){_0x340975=_0x340975-0x0;var _0x5c496d=_0x09d2[_0x340975];return _0x5c496d;};'use strict';var _=require(_0x209d('0x0'));var util=require(_0x209d('0x1'));var logger=require(_0x209d('0x2'))(_0x209d('0x3'));var moment=require(_0x209d('0x4'));var BPromise=require(_0x209d('0x5'));var rp=require(_0x209d('0x6'));var fs=require('fs');var path=require(_0x209d('0x7'));var rimraf=require(_0x209d('0x8'));var config=require(_0x209d('0x9'));var attributes=require('./squareRecording.attributes');module[_0x209d('0xa')]=function(_0x315ec7,_0x3f2896){return _0x315ec7[_0x209d('0xb')](_0x209d('0xc'),attributes,{'tableName':'square_recordings','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 58131ae..de862ea 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 _0x380e=['SquareRecording','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateSquareRecording'];(function(_0x104ffb,_0x4452fd){var _0x3563e0=function(_0x1fb090){while(--_0x1fb090){_0x104ffb['push'](_0x104ffb['shift']());}};_0x3563e0(++_0x4452fd);}(_0x380e,0xc2));var _0xe380=function(_0x262972,_0xc36bc7){_0x262972=_0x262972-0x0;var _0x518c1c=_0x380e[_0x262972];return _0x518c1c;};'use strict';var _=require(_0xe380('0x0'));var util=require(_0xe380('0x1'));var moment=require(_0xe380('0x2'));var BPromise=require(_0xe380('0x3'));var rs=require(_0xe380('0x4'));var fs=require('fs');var Redis=require(_0xe380('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe380('0x6'))(_0xe380('0x7'));var config=require('../../config/environment');var jayson=require(_0xe380('0x8'));var client=jayson[_0xe380('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cfbf5,_0x435ace,_0x4c33be){return new BPromise(function(_0x1f2789,_0x48f5a6){return client[_0xe380('0xa')](_0x4cfbf5,_0x4c33be)[_0xe380('0xb')](function(_0x235961){logger['info'](_0xe380('0xc'),_0x435ace,_0xe380('0xd'));logger[_0xe380('0xe')](_0xe380('0xf'),_0x435ace,_0xe380('0xd'),JSON['stringify'](_0x235961));if(_0x235961['error']){if(_0x235961[_0xe380('0x10')][_0xe380('0x11')]===0x1f4){logger['error'](_0xe380('0xc'),_0x435ace,_0x235961[_0xe380('0x10')][_0xe380('0x12')]);return _0x48f5a6(_0x235961[_0xe380('0x10')][_0xe380('0x12')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x435ace,_0x235961['error'][_0xe380('0x12')]);return _0x1f2789(_0x235961['error'][_0xe380('0x12')]);}else{logger[_0xe380('0x13')](_0xe380('0xc'),_0x435ace,_0xe380('0xd'));_0x1f2789(_0x235961['result'][_0xe380('0x12')]);}})[_0xe380('0x14')](function(_0x353273){logger[_0xe380('0x10')](_0xe380('0xc'),_0x435ace,_0x353273);_0x48f5a6(_0x353273);});});}exports[_0xe380('0x15')]=function(_0x19de8c){var _0x3f376e=this;return new Promise(function(_0x51c65e,_0x153261){return db[_0xe380('0x16')]['create'](_0x19de8c[_0xe380('0x17')],{'raw':_0x19de8c[_0xe380('0x18')]?_0x19de8c[_0xe380('0x18')][_0xe380('0x19')]===undefined?!![]:![]:!![]})[_0xe380('0xb')](function(_0x3e4da9){logger[_0xe380('0x13')](_0xe380('0x15'),_0x19de8c);logger[_0xe380('0xe')](_0xe380('0x15'),_0x19de8c,JSON[_0xe380('0x1a')](_0x3e4da9));_0x51c65e(_0x3e4da9);})[_0xe380('0x14')](function(_0xa7999a){logger[_0xe380('0x10')]('CreateSquareRecording',_0xa7999a[_0xe380('0x12')],_0x19de8c);_0x153261(_0x3f376e[_0xe380('0x10')](0x1f4,_0xa7999a[_0xe380('0x12')]));});});}; \ No newline at end of file +var _0x342f=['error','code','message','catch','CreateSquareRecording','SquareRecording','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xe775be,_0x4822af){var _0x49e73c=function(_0x225efd){while(--_0x225efd){_0xe775be['push'](_0xe775be['shift']());}};_0x49e73c(++_0x4822af);}(_0x342f,0x1d4));var _0xf342=function(_0x2043e4,_0x5bb36f){_0x2043e4=_0x2043e4-0x0;var _0x309ffb=_0x342f[_0x2043e4];return _0x309ffb;};'use strict';var _=require(_0xf342('0x0'));var util=require(_0xf342('0x1'));var moment=require(_0xf342('0x2'));var BPromise=require(_0xf342('0x3'));var rs=require(_0xf342('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf342('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf342('0x6'))('rpc');var config=require(_0xf342('0x7'));var jayson=require(_0xf342('0x8'));var client=jayson['client'][_0xf342('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a798c,_0x42cd7f,_0x34a3e4){return new BPromise(function(_0xe47c2,_0x289019){return client[_0xf342('0xa')](_0x4a798c,_0x34a3e4)['then'](function(_0x4dcbac){logger[_0xf342('0xb')](_0xf342('0xc'),_0x42cd7f,_0xf342('0xd'));logger[_0xf342('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x42cd7f,_0xf342('0xd'),JSON['stringify'](_0x4dcbac));if(_0x4dcbac[_0xf342('0xf')]){if(_0x4dcbac[_0xf342('0xf')][_0xf342('0x10')]===0x1f4){logger[_0xf342('0xf')]('SquareRecording,\x20%s,\x20%s',_0x42cd7f,_0x4dcbac['error'][_0xf342('0x11')]);return _0x289019(_0x4dcbac[_0xf342('0xf')]['message']);}logger[_0xf342('0xf')](_0xf342('0xc'),_0x42cd7f,_0x4dcbac[_0xf342('0xf')][_0xf342('0x11')]);return _0xe47c2(_0x4dcbac[_0xf342('0xf')][_0xf342('0x11')]);}else{logger['info'](_0xf342('0xc'),_0x42cd7f,'request\x20sent');_0xe47c2(_0x4dcbac['result'][_0xf342('0x11')]);}})[_0xf342('0x12')](function(_0x3d0b6a){logger[_0xf342('0xf')](_0xf342('0xc'),_0x42cd7f,_0x3d0b6a);_0x289019(_0x3d0b6a);});});}exports[_0xf342('0x13')]=function(_0x47aec4){var _0x2ad981=this;return new Promise(function(_0x314e0f,_0x5dae64){return db[_0xf342('0x14')]['create'](_0x47aec4['body'],{'raw':_0x47aec4[_0xf342('0x15')]?_0x47aec4[_0xf342('0x15')][_0xf342('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3aec89){logger[_0xf342('0xb')](_0xf342('0x13'),_0x47aec4);logger[_0xf342('0xe')]('CreateSquareRecording',_0x47aec4,JSON['stringify'](_0x3aec89));_0x314e0f(_0x3aec89);})[_0xf342('0x12')](function(_0x15ddec){logger['error']('CreateSquareRecording',_0x15ddec[_0xf342('0x11')],_0x47aec4);_0x5dae64(_0x2ad981[_0xf342('0xf')](0x1f4,_0x15ddec['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b85d0ac..95130fa 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4b9b78,_0x1dc74a){var _0x330388=function(_0x49bcdc){while(--_0x49bcdc){_0x4b9b78['push'](_0x4b9b78['shift']());}};_0x330388(++_0x1dc74a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x255cca,_0x121536){var _0x16d8de=function(_0x7e50f7){while(--_0x7e50f7){_0x255cca['push'](_0x255cca['shift']());}};_0x16d8de(++_0x121536);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 02bfc74..a18314b 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 _0x034b=['exports','STRING','DATE','sequelize'];(function(_0x1390c5,_0x5d4312){var _0x2b99a5=function(_0x5cc06f){while(--_0x5cc06f){_0x1390c5['push'](_0x1390c5['shift']());}};_0x2b99a5(++_0x5d4312);}(_0x034b,0xc7));var _0xb034=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x034b[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xb034('0x0'));module[_0xb034('0x1')]={'network':{'type':Sequelize[_0xb034('0x2')]},'network_script':{'type':Sequelize[_0xb034('0x2')]},'request':{'type':Sequelize[_0xb034('0x2')]},'channel':{'type':Sequelize[_0xb034('0x2')]},'language':{'type':Sequelize[_0xb034('0x2')]},'type':{'type':Sequelize[_0xb034('0x2')]},'uniqueid':{'type':Sequelize[_0xb034('0x2')]},'version':{'type':Sequelize[_0xb034('0x2')]},'callerid':{'type':Sequelize[_0xb034('0x2')]},'calleridname':{'type':Sequelize[_0xb034('0x2')]},'callingpres':{'type':Sequelize[_0xb034('0x2')]},'callingani2':{'type':Sequelize[_0xb034('0x2')]},'callington':{'type':Sequelize[_0xb034('0x2')]},'callingtns':{'type':Sequelize[_0xb034('0x2')]},'dnid':{'type':Sequelize[_0xb034('0x2')]},'rdnis':{'type':Sequelize[_0xb034('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xb034('0x2')]},'priority':{'type':Sequelize[_0xb034('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb034('0x2')]},'threadid':{'type':Sequelize[_0xb034('0x2')]},'project_name':{'type':Sequelize[_0xb034('0x2')]},'joinAt':{'type':Sequelize[_0xb034('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3bc4=['BOOLEAN','exports','STRING','DATE'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3bc4,0xc9));var _0x43bc=function(_0x99682f,_0x471920){_0x99682f=_0x99682f-0x0;var _0x58bebd=_0x3bc4[_0x99682f];return _0x58bebd;};'use strict';var Sequelize=require('sequelize');module[_0x43bc('0x0')]={'network':{'type':Sequelize[_0x43bc('0x1')]},'network_script':{'type':Sequelize[_0x43bc('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x43bc('0x1')]},'language':{'type':Sequelize[_0x43bc('0x1')]},'type':{'type':Sequelize[_0x43bc('0x1')]},'uniqueid':{'type':Sequelize[_0x43bc('0x1')]},'version':{'type':Sequelize[_0x43bc('0x1')]},'callerid':{'type':Sequelize[_0x43bc('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x43bc('0x1')]},'callingani2':{'type':Sequelize[_0x43bc('0x1')]},'callington':{'type':Sequelize[_0x43bc('0x1')]},'callingtns':{'type':Sequelize[_0x43bc('0x1')]},'dnid':{'type':Sequelize[_0x43bc('0x1')]},'rdnis':{'type':Sequelize[_0x43bc('0x1')]},'context':{'type':Sequelize[_0x43bc('0x1')]},'extension':{'type':Sequelize[_0x43bc('0x1')]},'priority':{'type':Sequelize[_0x43bc('0x1')]},'enhanced':{'type':Sequelize[_0x43bc('0x1')]},'accountcode':{'type':Sequelize[_0x43bc('0x1')]},'threadid':{'type':Sequelize[_0x43bc('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x43bc('0x2')]},'bot':{'type':Sequelize[_0x43bc('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 b51eecd..9943b54 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 _0x44f1=['model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','type'];(function(_0x2c6bad,_0x29ffed){var _0x5f5435=function(_0x23f89b){while(--_0x23f89b){_0x2c6bad['push'](_0x2c6bad['shift']());}};_0x5f5435(++_0x29ffed);}(_0x44f1,0xad));var _0x144f=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x44f1[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0x144f('0x0'));var rimraf=require(_0x144f('0x1'));var zipdir=require(_0x144f('0x2'));var jsonpatch=require(_0x144f('0x3'));var rp=require('request-promise');var moment=require(_0x144f('0x4'));var BPromise=require(_0x144f('0x5'));var Mustache=require(_0x144f('0x6'));var util=require(_0x144f('0x7'));var path=require(_0x144f('0x8'));var sox=require(_0x144f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x144f('0xa'));var _=require(_0x144f('0xb'));var squel=require('squel');var crypto=require(_0x144f('0xc'));var jsforce=require(_0x144f('0xd'));var deskjs=require(_0x144f('0xe'));var toCsv=require(_0x144f('0xf'));var querystring=require(_0x144f('0x10'));var Papa=require(_0x144f('0x11'));var Redis=require(_0x144f('0x12'));var authService=require(_0x144f('0x13'));var qs=require(_0x144f('0x14'));var as=require(_0x144f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x144f('0x16'))(_0x144f('0x17'));var utils=require(_0x144f('0x18'));var config=require(_0x144f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x144f('0x1a'))['db'];function respondWithStatusCode(_0x2c3e84,_0x460df0){_0x460df0=_0x460df0||0xcc;return function(_0x2e520e){if(_0x2e520e){return _0x2c3e84['sendStatus'](_0x460df0);}return _0x2c3e84[_0x144f('0x1b')](_0x460df0)[_0x144f('0x1c')]();};}function respondWithResult(_0x414610,_0x28f93e){_0x28f93e=_0x28f93e||0xc8;return function(_0x374e65){if(_0x374e65){return _0x414610[_0x144f('0x1b')](_0x28f93e)[_0x144f('0x1d')](_0x374e65);}};}function respondWithFilteredResult(_0x4e2bb9,_0x30ac24){return function(_0x21b7d1){if(_0x21b7d1){var _0x4a3a2e=typeof _0x30ac24[_0x144f('0x1e')]===_0x144f('0x1f')&&typeof _0x30ac24[_0x144f('0x20')]==='undefined';var _0x1a96fc=_0x21b7d1[_0x144f('0x21')];var _0x31778e=_0x4a3a2e?0x0:_0x30ac24[_0x144f('0x1e')];var _0x535bdc=_0x4a3a2e?_0x21b7d1[_0x144f('0x21')]:_0x30ac24[_0x144f('0x1e')]+_0x30ac24[_0x144f('0x20')];var _0x1bc898;if(_0x535bdc>=_0x1a96fc){_0x535bdc=_0x1a96fc;_0x1bc898=0xc8;}else{_0x1bc898=0xce;}_0x4e2bb9[_0x144f('0x1b')](_0x1bc898);return _0x4e2bb9['set']('Content-Range',_0x31778e+'-'+_0x535bdc+'/'+_0x1a96fc)['json'](_0x21b7d1);}return null;};}function patchUpdates(_0x5215de){return function(_0x26537b){try{jsonpatch[_0x144f('0x22')](_0x26537b,_0x5215de,!![]);}catch(_0x2c17f1){return BPromise[_0x144f('0x23')](_0x2c17f1);}return _0x26537b['save']();};}function saveUpdates(_0x3f66d2,_0x242457){return function(_0x4a7d92){if(_0x4a7d92){return _0x4a7d92[_0x144f('0x24')](_0x3f66d2)[_0x144f('0x25')](function(_0x158834){return _0x158834;});}return null;};}function removeEntity(_0x5253bb,_0x4b8d47){return function(_0x43b041){if(_0x43b041){return _0x43b041[_0x144f('0x26')]()['then'](function(){_0x5253bb['status'](0xcc)[_0x144f('0x1c')]();});}};}function handleEntityNotFound(_0x5ad539,_0x1db110){return function(_0x23a09d){if(!_0x23a09d){_0x5ad539[_0x144f('0x27')](0x194);}return _0x23a09d;};}function handleError(_0x13c653,_0x4c3a7d){_0x4c3a7d=_0x4c3a7d||0x1f4;return function(_0x3c5d07){logger[_0x144f('0x28')](_0x3c5d07[_0x144f('0x29')]);if(_0x3c5d07[_0x144f('0x2a')]){delete _0x3c5d07['name'];}_0x13c653['status'](_0x4c3a7d)['send'](_0x3c5d07);};}exports[_0x144f('0x2b')]=function(_0x1e7e4e,_0x171f1a){var _0x2149b7={},_0x420232={},_0x51d4f9={'count':0x0,'rows':[]};var _0x3239e3=_[_0x144f('0x2c')](db[_0x144f('0x2d')][_0x144f('0x2e')],function(_0x326677){return{'name':_0x326677[_0x144f('0x2f')],'type':_0x326677[_0x144f('0x30')]['key']};});_0x420232[_0x144f('0x31')]=_[_0x144f('0x2c')](_0x3239e3,_0x144f('0x2a'));_0x420232[_0x144f('0x32')]=_[_0x144f('0x33')](_0x1e7e4e['query']);_0x420232['filters']=_[_0x144f('0x34')](_0x420232['model'],_0x420232[_0x144f('0x32')]);_0x2149b7[_0x144f('0x35')]=_[_0x144f('0x34')](_0x420232[_0x144f('0x31')],qs[_0x144f('0x36')](_0x1e7e4e[_0x144f('0x32')][_0x144f('0x36')]));_0x2149b7[_0x144f('0x35')]=_0x2149b7[_0x144f('0x35')]['length']?_0x2149b7[_0x144f('0x35')]:_0x420232[_0x144f('0x31')];if(!_0x1e7e4e['query']['hasOwnProperty'](_0x144f('0x37'))){_0x2149b7['limit']=qs[_0x144f('0x20')](_0x1e7e4e[_0x144f('0x32')]['limit']);_0x2149b7['offset']=qs['offset'](_0x1e7e4e['query']['offset']);}_0x2149b7[_0x144f('0x38')]=qs[_0x144f('0x39')](_0x1e7e4e[_0x144f('0x32')][_0x144f('0x39')]);_0x2149b7[_0x144f('0x3a')]=qs[_0x144f('0x3b')](_['pick'](_0x1e7e4e[_0x144f('0x32')],_0x420232[_0x144f('0x3b')]),_0x3239e3);if(_0x1e7e4e[_0x144f('0x32')][_0x144f('0x3c')]){_0x2149b7[_0x144f('0x3a')]=_[_0x144f('0x3d')](_0x2149b7[_0x144f('0x3a')],{'$or':_['map'](_0x3239e3,function(_0x3e41dd){if(_0x3e41dd[_0x144f('0x30')]!=='VIRTUAL'){var _0x1a20c1={};_0x1a20c1[_0x3e41dd[_0x144f('0x2a')]]={'$like':'%'+_0x1e7e4e[_0x144f('0x32')]['filter']+'%'};return _0x1a20c1;}})});}_0x2149b7=_[_0x144f('0x3d')]({},_0x2149b7,_0x1e7e4e['options']);var _0x5e3076={'where':_0x2149b7[_0x144f('0x3a')]};return db['SquareReport'][_0x144f('0x21')](_0x5e3076)[_0x144f('0x25')](function(_0x33bb4e){_0x51d4f9[_0x144f('0x21')]=_0x33bb4e;if(_0x1e7e4e['query'][_0x144f('0x3e')]){_0x2149b7[_0x144f('0x3f')]=[{'all':!![]}];}return db[_0x144f('0x2d')][_0x144f('0x40')](_0x2149b7);})[_0x144f('0x25')](function(_0x378c0e){_0x51d4f9[_0x144f('0x41')]=_0x378c0e;return _0x51d4f9;})[_0x144f('0x25')](respondWithFilteredResult(_0x171f1a,_0x2149b7))[_0x144f('0x42')](handleError(_0x171f1a,null));};exports[_0x144f('0x43')]=function(_0x3e2440,_0x3e64be){var _0x5c127a={'raw':!![],'where':{'id':_0x3e2440[_0x144f('0x44')]['id']}},_0x46bd50={};_0x46bd50[_0x144f('0x31')]=_['keys'](db[_0x144f('0x2d')][_0x144f('0x2e')]);_0x46bd50[_0x144f('0x32')]=_[_0x144f('0x33')](_0x3e2440[_0x144f('0x32')]);_0x46bd50[_0x144f('0x3b')]=_[_0x144f('0x34')](_0x46bd50[_0x144f('0x31')],_0x46bd50['query']);_0x5c127a[_0x144f('0x35')]=_[_0x144f('0x34')](_0x46bd50[_0x144f('0x31')],qs[_0x144f('0x36')](_0x3e2440[_0x144f('0x32')][_0x144f('0x36')]));_0x5c127a[_0x144f('0x35')]=_0x5c127a[_0x144f('0x35')]['length']?_0x5c127a['attributes']:_0x46bd50[_0x144f('0x31')];if(_0x3e2440[_0x144f('0x32')][_0x144f('0x3e')]){_0x5c127a['include']=[{'all':!![]}];}_0x5c127a=_[_0x144f('0x3d')]({},_0x5c127a,_0x3e2440[_0x144f('0x45')]);return db[_0x144f('0x2d')][_0x144f('0x46')](_0x5c127a)['then'](handleEntityNotFound(_0x3e64be,null))['then'](respondWithResult(_0x3e64be,null))[_0x144f('0x42')](handleError(_0x3e64be,null));};exports[_0x144f('0x47')]=function(_0x1f0258,_0x1e23b5){return db['SquareReport'][_0x144f('0x47')](_0x1f0258[_0x144f('0x48')],{})[_0x144f('0x25')](respondWithResult(_0x1e23b5,0xc9))['catch'](handleError(_0x1e23b5,null));};exports[_0x144f('0x24')]=function(_0x4a09e9,_0x15480a){if(_0x4a09e9[_0x144f('0x48')]['id']){delete _0x4a09e9[_0x144f('0x48')]['id'];}return db['SquareReport'][_0x144f('0x46')]({'where':{'id':_0x4a09e9[_0x144f('0x44')]['id']}})[_0x144f('0x25')](handleEntityNotFound(_0x15480a,null))[_0x144f('0x25')](saveUpdates(_0x4a09e9[_0x144f('0x48')],null))[_0x144f('0x25')](respondWithResult(_0x15480a,null))[_0x144f('0x42')](handleError(_0x15480a,null));};exports[_0x144f('0x26')]=function(_0x42c2a5,_0x3878fb){return db[_0x144f('0x2d')][_0x144f('0x46')]({'where':{'id':_0x42c2a5[_0x144f('0x44')]['id']}})[_0x144f('0x25')](handleEntityNotFound(_0x3878fb,null))[_0x144f('0x25')](removeEntity(_0x3878fb,null))[_0x144f('0x42')](handleError(_0x3878fb,null));};exports[_0x144f('0x49')]=function(_0x5884dc,_0x1cf4a9){return db[_0x144f('0x2d')][_0x144f('0x49')]()[_0x144f('0x25')](respondWithResult(_0x1cf4a9,null))[_0x144f('0x42')](handleError(_0x1cf4a9,null));}; \ No newline at end of file +var _0x1764=['then','destroy','end','error','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','name','filter','options','SquareReport','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x1764,0x10e));var _0x4176=function(_0x40ebc2,_0x4a742a){_0x40ebc2=_0x40ebc2-0x0;var _0x52493e=_0x1764[_0x40ebc2];return _0x52493e;};'use strict';var emlformat=require(_0x4176('0x0'));var rimraf=require(_0x4176('0x1'));var zipdir=require(_0x4176('0x2'));var jsonpatch=require(_0x4176('0x3'));var rp=require(_0x4176('0x4'));var moment=require(_0x4176('0x5'));var BPromise=require(_0x4176('0x6'));var Mustache=require('mustache');var util=require(_0x4176('0x7'));var path=require(_0x4176('0x8'));var sox=require(_0x4176('0x9'));var csv=require(_0x4176('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4176('0xb'));var _=require(_0x4176('0xc'));var squel=require(_0x4176('0xd'));var crypto=require(_0x4176('0xe'));var jsforce=require(_0x4176('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4176('0x10'));var Papa=require(_0x4176('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4176('0x12'));var as=require(_0x4176('0x13'));var hardwareService=require(_0x4176('0x14'));var logger=require(_0x4176('0x15'))(_0x4176('0x16'));var utils=require(_0x4176('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4176('0x18'));var db=require(_0x4176('0x19'))['db'];function respondWithStatusCode(_0x165a8b,_0x3890e0){_0x3890e0=_0x3890e0||0xcc;return function(_0x50ad56){if(_0x50ad56){return _0x165a8b[_0x4176('0x1a')](_0x3890e0);}return _0x165a8b[_0x4176('0x1b')](_0x3890e0)['end']();};}function respondWithResult(_0x312fad,_0x1d72c3){_0x1d72c3=_0x1d72c3||0xc8;return function(_0x299e25){if(_0x299e25){return _0x312fad[_0x4176('0x1b')](_0x1d72c3)[_0x4176('0x1c')](_0x299e25);}};}function respondWithFilteredResult(_0x160b31,_0x19cda0){return function(_0x3f06b7){if(_0x3f06b7){var _0x4a6fad=typeof _0x19cda0[_0x4176('0x1d')]===_0x4176('0x1e')&&typeof _0x19cda0[_0x4176('0x1f')]==='undefined';var _0x1d1895=_0x3f06b7[_0x4176('0x20')];var _0x411113=_0x4a6fad?0x0:_0x19cda0[_0x4176('0x1d')];var _0x41289a=_0x4a6fad?_0x3f06b7[_0x4176('0x20')]:_0x19cda0[_0x4176('0x1d')]+_0x19cda0['limit'];var _0x4bbc29;if(_0x41289a>=_0x1d1895){_0x41289a=_0x1d1895;_0x4bbc29=0xc8;}else{_0x4bbc29=0xce;}_0x160b31[_0x4176('0x1b')](_0x4bbc29);return _0x160b31[_0x4176('0x21')](_0x4176('0x22'),_0x411113+'-'+_0x41289a+'/'+_0x1d1895)[_0x4176('0x1c')](_0x3f06b7);}return null;};}function patchUpdates(_0x121385){return function(_0x41a453){try{jsonpatch[_0x4176('0x23')](_0x41a453,_0x121385,!![]);}catch(_0x47bdc4){return BPromise['reject'](_0x47bdc4);}return _0x41a453[_0x4176('0x24')]();};}function saveUpdates(_0x3b804e,_0x225425){return function(_0x3f68eb){if(_0x3f68eb){return _0x3f68eb[_0x4176('0x25')](_0x3b804e)[_0x4176('0x26')](function(_0x2512eb){return _0x2512eb;});}return null;};}function removeEntity(_0x21d6d2,_0x1d5cab){return function(_0x248203){if(_0x248203){return _0x248203[_0x4176('0x27')]()[_0x4176('0x26')](function(){_0x21d6d2[_0x4176('0x1b')](0xcc)[_0x4176('0x28')]();});}};}function handleEntityNotFound(_0x2b4df8,_0x639917){return function(_0x22890d){if(!_0x22890d){_0x2b4df8[_0x4176('0x1a')](0x194);}return _0x22890d;};}function handleError(_0x5d40da,_0x4f4676){_0x4f4676=_0x4f4676||0x1f4;return function(_0x3c9326){logger[_0x4176('0x29')](_0x3c9326['stack']);if(_0x3c9326['name']){delete _0x3c9326['name'];}_0x5d40da[_0x4176('0x1b')](_0x4f4676)[_0x4176('0x2a')](_0x3c9326);};}exports[_0x4176('0x2b')]=function(_0x1197fd,_0x1ccbf7){var _0x44f44a={},_0x335089={},_0x7ac390={'count':0x0,'rows':[]};var _0x281baa=_[_0x4176('0x2c')](db['SquareReport'][_0x4176('0x2d')],function(_0x29d5e1){return{'name':_0x29d5e1['fieldName'],'type':_0x29d5e1[_0x4176('0x2e')][_0x4176('0x2f')]};});_0x335089['model']=_[_0x4176('0x2c')](_0x281baa,'name');_0x335089[_0x4176('0x30')]=_[_0x4176('0x31')](_0x1197fd[_0x4176('0x30')]);_0x335089[_0x4176('0x32')]=_[_0x4176('0x33')](_0x335089[_0x4176('0x34')],_0x335089[_0x4176('0x30')]);_0x44f44a['attributes']=_[_0x4176('0x33')](_0x335089[_0x4176('0x34')],qs[_0x4176('0x35')](_0x1197fd['query'][_0x4176('0x35')]));_0x44f44a[_0x4176('0x36')]=_0x44f44a[_0x4176('0x36')][_0x4176('0x37')]?_0x44f44a[_0x4176('0x36')]:_0x335089[_0x4176('0x34')];if(!_0x1197fd['query'][_0x4176('0x38')](_0x4176('0x39'))){_0x44f44a['limit']=qs['limit'](_0x1197fd[_0x4176('0x30')][_0x4176('0x1f')]);_0x44f44a['offset']=qs[_0x4176('0x1d')](_0x1197fd[_0x4176('0x30')][_0x4176('0x1d')]);}_0x44f44a[_0x4176('0x3a')]=qs['sort'](_0x1197fd[_0x4176('0x30')][_0x4176('0x3b')]);_0x44f44a['where']=qs[_0x4176('0x32')](_[_0x4176('0x3c')](_0x1197fd[_0x4176('0x30')],_0x335089['filters']),_0x281baa);if(_0x1197fd[_0x4176('0x30')]['filter']){_0x44f44a['where']=_[_0x4176('0x3d')](_0x44f44a[_0x4176('0x3e')],{'$or':_[_0x4176('0x2c')](_0x281baa,function(_0x18ccb2){if(_0x18ccb2[_0x4176('0x2e')]!==_0x4176('0x3f')){var _0x456849={};_0x456849[_0x18ccb2[_0x4176('0x40')]]={'$like':'%'+_0x1197fd[_0x4176('0x30')][_0x4176('0x41')]+'%'};return _0x456849;}})});}_0x44f44a=_['merge']({},_0x44f44a,_0x1197fd[_0x4176('0x42')]);var _0x4e7433={'where':_0x44f44a[_0x4176('0x3e')]};return db[_0x4176('0x43')][_0x4176('0x20')](_0x4e7433)[_0x4176('0x26')](function(_0x38b3c8){_0x7ac390[_0x4176('0x20')]=_0x38b3c8;if(_0x1197fd[_0x4176('0x30')]['includeAll']){_0x44f44a[_0x4176('0x44')]=[{'all':!![]}];}return db[_0x4176('0x43')][_0x4176('0x45')](_0x44f44a);})['then'](function(_0x468801){_0x7ac390[_0x4176('0x46')]=_0x468801;return _0x7ac390;})[_0x4176('0x26')](respondWithFilteredResult(_0x1ccbf7,_0x44f44a))[_0x4176('0x47')](handleError(_0x1ccbf7,null));};exports['show']=function(_0x473366,_0x548cd0){var _0x55ea43={'raw':!![],'where':{'id':_0x473366[_0x4176('0x48')]['id']}},_0x5c817f={};_0x5c817f['model']=_[_0x4176('0x31')](db['SquareReport'][_0x4176('0x2d')]);_0x5c817f['query']=_['keys'](_0x473366[_0x4176('0x30')]);_0x5c817f[_0x4176('0x32')]=_[_0x4176('0x33')](_0x5c817f[_0x4176('0x34')],_0x5c817f[_0x4176('0x30')]);_0x55ea43['attributes']=_[_0x4176('0x33')](_0x5c817f[_0x4176('0x34')],qs[_0x4176('0x35')](_0x473366[_0x4176('0x30')][_0x4176('0x35')]));_0x55ea43[_0x4176('0x36')]=_0x55ea43[_0x4176('0x36')][_0x4176('0x37')]?_0x55ea43[_0x4176('0x36')]:_0x5c817f[_0x4176('0x34')];if(_0x473366[_0x4176('0x30')][_0x4176('0x49')]){_0x55ea43[_0x4176('0x44')]=[{'all':!![]}];}_0x55ea43=_[_0x4176('0x3d')]({},_0x55ea43,_0x473366[_0x4176('0x42')]);return db[_0x4176('0x43')][_0x4176('0x4a')](_0x55ea43)['then'](handleEntityNotFound(_0x548cd0,null))[_0x4176('0x26')](respondWithResult(_0x548cd0,null))[_0x4176('0x47')](handleError(_0x548cd0,null));};exports[_0x4176('0x4b')]=function(_0x3ce81c,_0x349a9e){return db[_0x4176('0x43')]['create'](_0x3ce81c[_0x4176('0x4c')],{})[_0x4176('0x26')](respondWithResult(_0x349a9e,0xc9))[_0x4176('0x47')](handleError(_0x349a9e,null));};exports[_0x4176('0x25')]=function(_0x35ad99,_0x4db3b0){if(_0x35ad99[_0x4176('0x4c')]['id']){delete _0x35ad99[_0x4176('0x4c')]['id'];}return db[_0x4176('0x43')][_0x4176('0x4a')]({'where':{'id':_0x35ad99[_0x4176('0x48')]['id']}})[_0x4176('0x26')](handleEntityNotFound(_0x4db3b0,null))[_0x4176('0x26')](saveUpdates(_0x35ad99[_0x4176('0x4c')],null))[_0x4176('0x26')](respondWithResult(_0x4db3b0,null))[_0x4176('0x47')](handleError(_0x4db3b0,null));};exports[_0x4176('0x27')]=function(_0x2a00c4,_0x3f8742){return db['SquareReport'][_0x4176('0x4a')]({'where':{'id':_0x2a00c4[_0x4176('0x48')]['id']}})[_0x4176('0x26')](handleEntityNotFound(_0x3f8742,null))[_0x4176('0x26')](removeEntity(_0x3f8742,null))['catch'](handleError(_0x3f8742,null));};exports['describe']=function(_0x85bbc,_0x1f2ff3){return db[_0x4176('0x43')]['describe']()[_0x4176('0x26')](respondWithResult(_0x1f2ff3,null))[_0x4176('0x47')](handleError(_0x1f2ff3,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 9a3f1e0..c7a0353 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 _0xa0d0=['bluebird','request-promise','path','rimraf','exports','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0xa0d0,0x101));var _0x0a0d=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xa0d0[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x0a0d('0x0'));var util=require(_0x0a0d('0x1'));var logger=require(_0x0a0d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a0d('0x3'));var rp=require(_0x0a0d('0x4'));var fs=require('fs');var path=require(_0x0a0d('0x5'));var rimraf=require(_0x0a0d('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x0a0d('0x7')]=function(_0xfce88e,_0x2037cb){return _0xfce88e['define']('SquareReport',attributes,{'tableName':_0x0a0d('0x8'),'paranoid':![],'indexes':[{'name':_0x0a0d('0x9'),'fields':[_0x0a0d('0xa'),_0x0a0d('0xb')]},{'name':_0x0a0d('0xc'),'fields':[_0x0a0d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3c7=['define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xd3c7,0x68));var _0x7d3c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd3c7[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7d3c('0x0'));var util=require(_0x7d3c('0x1'));var logger=require(_0x7d3c('0x2'))(_0x7d3c('0x3'));var moment=require(_0x7d3c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d3c('0x5'));var rimraf=require(_0x7d3c('0x6'));var config=require(_0x7d3c('0x7'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x4b7c19,_0x1d351c){return _0x4b7c19[_0x7d3c('0x8')](_0x7d3c('0x9'),attributes,{'tableName':_0x7d3c('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x7d3c('0xb'),_0x7d3c('0xc')]},{'name':'leaveAt','fields':[_0x7d3c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 71ad9c4..29f9ab6 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 _0x5b8b=['update','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareReport','SquareReport','body','options','stringify','UpdateSquareReport'];(function(_0x5cc10c,_0x224f4b){var _0x40435a=function(_0x59f555){while(--_0x59f555){_0x5cc10c['push'](_0x5cc10c['shift']());}};_0x40435a(++_0x224f4b);}(_0x5b8b,0x68));var _0xb5b8=function(_0x10273d,_0x198ac3){_0x10273d=_0x10273d-0x0;var _0x55a02e=_0x5b8b[_0x10273d];return _0x55a02e;};'use strict';var _=require('lodash');var util=require(_0xb5b8('0x0'));var moment=require(_0xb5b8('0x1'));var BPromise=require(_0xb5b8('0x2'));var rs=require(_0xb5b8('0x3'));var fs=require('fs');var Redis=require(_0xb5b8('0x4'));var db=require(_0xb5b8('0x5'))['db'];var utils=require(_0xb5b8('0x6'));var logger=require(_0xb5b8('0x7'))('rpc');var config=require(_0xb5b8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb5b8('0x9')][_0xb5b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19b59b,_0x361072,_0xca7e33){return new BPromise(function(_0x15d8b8,_0x3b5478){return client[_0xb5b8('0xb')](_0x19b59b,_0xca7e33)[_0xb5b8('0xc')](function(_0x2f12e9){logger[_0xb5b8('0xd')](_0xb5b8('0xe'),_0x361072,_0xb5b8('0xf'));logger[_0xb5b8('0x10')](_0xb5b8('0x11'),_0x361072,_0xb5b8('0xf'),JSON['stringify'](_0x2f12e9));if(_0x2f12e9[_0xb5b8('0x12')]){if(_0x2f12e9[_0xb5b8('0x12')][_0xb5b8('0x13')]===0x1f4){logger[_0xb5b8('0x12')](_0xb5b8('0xe'),_0x361072,_0x2f12e9[_0xb5b8('0x12')][_0xb5b8('0x14')]);return _0x3b5478(_0x2f12e9[_0xb5b8('0x12')][_0xb5b8('0x14')]);}logger[_0xb5b8('0x12')](_0xb5b8('0xe'),_0x361072,_0x2f12e9[_0xb5b8('0x12')][_0xb5b8('0x14')]);return _0x15d8b8(_0x2f12e9[_0xb5b8('0x12')][_0xb5b8('0x14')]);}else{logger[_0xb5b8('0xd')](_0xb5b8('0xe'),_0x361072,_0xb5b8('0xf'));_0x15d8b8(_0x2f12e9['result'][_0xb5b8('0x14')]);}})[_0xb5b8('0x15')](function(_0x445991){logger[_0xb5b8('0x12')]('SquareReport,\x20%s,\x20%s',_0x361072,_0x445991);_0x3b5478(_0x445991);});});}exports[_0xb5b8('0x16')]=function(_0x444157){var _0x4a6c6a=this;return new Promise(function(_0x22ce4b,_0x44941b){return db[_0xb5b8('0x17')]['create'](_0x444157[_0xb5b8('0x18')],{'raw':_0x444157[_0xb5b8('0x19')]?_0x444157['options']['raw']===undefined?!![]:![]:!![]})[_0xb5b8('0xc')](function(_0x372af2){logger[_0xb5b8('0xd')](_0xb5b8('0x16'),_0x444157);logger['debug'](_0xb5b8('0x16'),_0x444157,JSON[_0xb5b8('0x1a')](_0x372af2));_0x22ce4b(_0x372af2);})[_0xb5b8('0x15')](function(_0x466130){logger[_0xb5b8('0x12')](_0xb5b8('0x16'),_0x466130['message'],_0x444157);_0x44941b(_0x4a6c6a['error'](0x1f4,_0x466130['message']));});});};exports[_0xb5b8('0x1b')]=function(_0x36e747){var _0x49d153=this;return new Promise(function(_0x201417,_0x28abd8){return db[_0xb5b8('0x17')][_0xb5b8('0x1c')](_0x36e747[_0xb5b8('0x18')],{'raw':_0x36e747[_0xb5b8('0x19')]?_0x36e747[_0xb5b8('0x19')][_0xb5b8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36e747['options']?_0x36e747[_0xb5b8('0x19')][_0xb5b8('0x1e')]||null:null,'attributes':_0x36e747[_0xb5b8('0x19')]?_0x36e747[_0xb5b8('0x19')][_0xb5b8('0x1f')]||null:null,'limit':_0x36e747[_0xb5b8('0x19')]?_0x36e747['options'][_0xb5b8('0x20')]||null:null})['then'](function(_0x18462e){logger[_0xb5b8('0xd')]('UpdateSquareReport',_0x36e747);logger[_0xb5b8('0x10')](_0xb5b8('0x1b'),_0x36e747,JSON[_0xb5b8('0x1a')](_0x18462e));_0x201417(_0x18462e);})[_0xb5b8('0x15')](function(_0x5cd4a2){logger[_0xb5b8('0x12')](_0xb5b8('0x1b'),_0x5cd4a2[_0xb5b8('0x14')],_0x36e747);_0x28abd8(_0x49d153[_0xb5b8('0x12')](0x1f4,_0x5cd4a2[_0xb5b8('0x14')]));});});}; \ No newline at end of file +var _0x874b=['CreateSquareReport','body','options','raw','UpdateSquareReport','SquareReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x18e555,_0x324c00){var _0xee6095=function(_0xa0fc1f){while(--_0xa0fc1f){_0x18e555['push'](_0x18e555['shift']());}};_0xee6095(++_0x324c00);}(_0x874b,0x12a));var _0xb874=function(_0x385092,_0x36b759){_0x385092=_0x385092-0x0;var _0x1dbf76=_0x874b[_0x385092];return _0x1dbf76;};'use strict';var _=require(_0xb874('0x0'));var util=require('util');var moment=require(_0xb874('0x1'));var BPromise=require(_0xb874('0x2'));var rs=require(_0xb874('0x3'));var fs=require('fs');var Redis=require(_0xb874('0x4'));var db=require(_0xb874('0x5'))['db'];var utils=require(_0xb874('0x6'));var logger=require(_0xb874('0x7'))(_0xb874('0x8'));var config=require(_0xb874('0x9'));var jayson=require(_0xb874('0xa'));var client=jayson[_0xb874('0xb')][_0xb874('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f0b04,_0x2f223f,_0x46eb81){return new BPromise(function(_0x4fc0ec,_0x5bf1dc){return client[_0xb874('0xd')](_0x4f0b04,_0x46eb81)[_0xb874('0xe')](function(_0x4a6921){logger[_0xb874('0xf')](_0xb874('0x10'),_0x2f223f,'request\x20sent');logger[_0xb874('0x11')](_0xb874('0x12'),_0x2f223f,_0xb874('0x13'),JSON[_0xb874('0x14')](_0x4a6921));if(_0x4a6921[_0xb874('0x15')]){if(_0x4a6921[_0xb874('0x15')][_0xb874('0x16')]===0x1f4){logger[_0xb874('0x15')](_0xb874('0x10'),_0x2f223f,_0x4a6921[_0xb874('0x15')][_0xb874('0x17')]);return _0x5bf1dc(_0x4a6921[_0xb874('0x15')][_0xb874('0x17')]);}logger['error'](_0xb874('0x10'),_0x2f223f,_0x4a6921[_0xb874('0x15')]['message']);return _0x4fc0ec(_0x4a6921['error'][_0xb874('0x17')]);}else{logger['info'](_0xb874('0x10'),_0x2f223f,_0xb874('0x13'));_0x4fc0ec(_0x4a6921[_0xb874('0x18')]['message']);}})[_0xb874('0x19')](function(_0xf8e75a){logger[_0xb874('0x15')](_0xb874('0x10'),_0x2f223f,_0xf8e75a);_0x5bf1dc(_0xf8e75a);});});}exports[_0xb874('0x1a')]=function(_0x3c440e){var _0x3aa50d=this;return new Promise(function(_0x1758c5,_0x417055){return db['SquareReport']['create'](_0x3c440e[_0xb874('0x1b')],{'raw':_0x3c440e[_0xb874('0x1c')]?_0x3c440e[_0xb874('0x1c')][_0xb874('0x1d')]===undefined?!![]:![]:!![]})[_0xb874('0xe')](function(_0x69808f){logger[_0xb874('0xf')](_0xb874('0x1a'),_0x3c440e);logger[_0xb874('0x11')](_0xb874('0x1a'),_0x3c440e,JSON[_0xb874('0x14')](_0x69808f));_0x1758c5(_0x69808f);})[_0xb874('0x19')](function(_0x5bf9a9){logger['error']('CreateSquareReport',_0x5bf9a9[_0xb874('0x17')],_0x3c440e);_0x417055(_0x3aa50d[_0xb874('0x15')](0x1f4,_0x5bf9a9[_0xb874('0x17')]));});});};exports[_0xb874('0x1e')]=function(_0x3d7b5a){var _0x5ce1f6=this;return new Promise(function(_0x36b2fb,_0x217d05){return db[_0xb874('0x1f')][_0xb874('0x20')](_0x3d7b5a[_0xb874('0x1b')],{'raw':_0x3d7b5a['options']?_0x3d7b5a[_0xb874('0x1c')][_0xb874('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d7b5a[_0xb874('0x1c')]?_0x3d7b5a[_0xb874('0x1c')][_0xb874('0x21')]||null:null,'attributes':_0x3d7b5a['options']?_0x3d7b5a[_0xb874('0x1c')][_0xb874('0x22')]||null:null,'limit':_0x3d7b5a['options']?_0x3d7b5a['options'][_0xb874('0x23')]||null:null})[_0xb874('0xe')](function(_0x21247c){logger['info'](_0xb874('0x1e'),_0x3d7b5a);logger[_0xb874('0x11')](_0xb874('0x1e'),_0x3d7b5a,JSON[_0xb874('0x14')](_0x21247c));_0x36b2fb(_0x21247c);})['catch'](function(_0x5f2646){logger[_0xb874('0x15')]('UpdateSquareReport',_0x5f2646['message'],_0x3d7b5a);_0x217d05(_0x5ce1f6['error'](0x1f4,_0x5f2646[_0xb874('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 3b7e037..50980d0 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 _0x3998=['../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x56cc32,_0x157b90){var _0x4195ac=function(_0x264f9b){while(--_0x264f9b){_0x56cc32['push'](_0x56cc32['shift']());}};_0x4195ac(++_0x157b90);}(_0x3998,0x1c8));var _0x8399=function(_0x15c3d8,_0x26be09){_0x15c3d8=_0x15c3d8-0x0;var _0x46a944=_0x3998[_0x15c3d8];return _0x46a944;};'use strict';var multer=require(_0x8399('0x0'));var util=require('util');var path=require(_0x8399('0x1'));var timeout=require(_0x8399('0x2'));var express=require(_0x8399('0x3'));var router=express[_0x8399('0x4')]();var fs_extra=require(_0x8399('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8399('0x6'));var config=require(_0x8399('0x7'));var controller=require(_0x8399('0x8'));router[_0x8399('0x9')]('/',auth[_0x8399('0xa')](),controller['index']);router['get'](_0x8399('0xb'),auth[_0x8399('0xa')](),controller[_0x8399('0xc')]);router[_0x8399('0x9')](_0x8399('0xd'),auth[_0x8399('0xa')](),controller['show']);router[_0x8399('0xe')]('/',auth['isAuthenticated'](),controller[_0x8399('0xf')]);router[_0x8399('0x10')]('/:id',auth[_0x8399('0xa')](),controller[_0x8399('0x11')]);router[_0x8399('0x12')](_0x8399('0xd'),auth[_0x8399('0xa')](),controller[_0x8399('0x13')]);module[_0x8399('0x14')]=router; \ No newline at end of file +var _0xd57e=['path','express','Router','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3c68d8,_0x2f23fb){var _0x3b504c=function(_0x2d4661){while(--_0x2d4661){_0x3c68d8['push'](_0x3c68d8['shift']());}};_0x3b504c(++_0x2f23fb);}(_0xd57e,0xc5));var _0xed57=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0xd57e[_0x3181cc];return _0x547a4a;};'use strict';var multer=require(_0xed57('0x0'));var util=require('util');var path=require(_0xed57('0x1'));var timeout=require('connect-timeout');var express=require(_0xed57('0x2'));var router=express[_0xed57('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xed57('0x4'));var config=require('../../config/environment');var controller=require(_0xed57('0x5'));router[_0xed57('0x6')]('/',auth[_0xed57('0x7')](),controller['index']);router[_0xed57('0x6')](_0xed57('0x8'),auth[_0xed57('0x7')](),controller[_0xed57('0x9')]);router['get'](_0xed57('0xa'),auth[_0xed57('0x7')](),controller['show']);router[_0xed57('0xb')]('/',auth[_0xed57('0x7')](),controller[_0xed57('0xc')]);router[_0xed57('0xd')]('/:id',auth[_0xed57('0x7')](),controller[_0xed57('0xe')]);router[_0xed57('0xf')](_0xed57('0xa'),auth[_0xed57('0x7')](),controller[_0xed57('0x10')]);module[_0xed57('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index b1f5f32..fe7ecee 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 _0x25a9=['TEXT','sequelize','exports','STRING'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x25a9,0x1ed));var _0x925a=function(_0x272e18,_0x75e43c){_0x272e18=_0x272e18-0x0;var _0x572ca9=_0x25a9[_0x272e18];return _0x572ca9;};'use strict';var Sequelize=require(_0x925a('0x0'));module[_0x925a('0x1')]={'uniqueid':{'type':Sequelize[_0x925a('0x2')]},'node':{'type':Sequelize[_0x925a('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x925a('0x3')]},'project_name':{'type':Sequelize[_0x925a('0x2')]},'callerid':{'type':Sequelize[_0x925a('0x2')]}}; \ No newline at end of file +var _0x3b44=['sequelize','STRING','TEXT'];(function(_0xdbc9e5,_0x3dab1d){var _0x45a558=function(_0x3e4cad){while(--_0x3e4cad){_0xdbc9e5['push'](_0xdbc9e5['shift']());}};_0x45a558(++_0x3dab1d);}(_0x3b44,0x1e0));var _0x43b4=function(_0x1cae38,_0x4e71f2){_0x1cae38=_0x1cae38-0x0;var _0x5a5171=_0x3b44[_0x1cae38];return _0x5a5171;};'use strict';var Sequelize=require(_0x43b4('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43b4('0x1')]},'node':{'type':Sequelize[_0x43b4('0x1')]},'application':{'type':Sequelize[_0x43b4('0x1')]},'data':{'type':Sequelize[_0x43b4('0x2')]},'project_name':{'type':Sequelize[_0x43b4('0x1')]},'callerid':{'type':Sequelize[_0x43b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index b496e70..beacca4 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 _0xcf7c=['offset','undefined','count','limit','set','apply','reject','update','destroy','then','end','sendStatus','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','query','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json'];(function(_0x2ebbeb,_0x549d7a){var _0x1bced8=function(_0x33a8e3){while(--_0x33a8e3){_0x2ebbeb['push'](_0x2ebbeb['shift']());}};_0x1bced8(++_0x549d7a);}(_0xcf7c,0x151));var _0xccf7=function(_0x4fbde2,_0x364951){_0x4fbde2=_0x4fbde2-0x0;var _0x2bce29=_0xcf7c[_0x4fbde2];return _0x2bce29;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xccf7('0x0'));var jsonpatch=require(_0xccf7('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xccf7('0x2'));var Mustache=require(_0xccf7('0x3'));var util=require(_0xccf7('0x4'));var path=require('path');var sox=require(_0xccf7('0x5'));var csv=require(_0xccf7('0x6'));var ejs=require(_0xccf7('0x7'));var fs=require('fs');var fs_extra=require(_0xccf7('0x8'));var _=require(_0xccf7('0x9'));var squel=require(_0xccf7('0xa'));var crypto=require(_0xccf7('0xb'));var jsforce=require(_0xccf7('0xc'));var deskjs=require(_0xccf7('0xd'));var toCsv=require(_0xccf7('0x6'));var querystring=require(_0xccf7('0xe'));var Papa=require(_0xccf7('0xf'));var Redis=require(_0xccf7('0x10'));var authService=require(_0xccf7('0x11'));var qs=require(_0xccf7('0x12'));var as=require(_0xccf7('0x13'));var hardwareService=require(_0xccf7('0x14'));var logger=require(_0xccf7('0x15'))(_0xccf7('0x16'));var utils=require(_0xccf7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xccf7('0x18'));var db=require(_0xccf7('0x19'))['db'];function respondWithStatusCode(_0x5ca8f5,_0xb29db8){_0xb29db8=_0xb29db8||0xcc;return function(_0x4f1577){if(_0x4f1577){return _0x5ca8f5['sendStatus'](_0xb29db8);}return _0x5ca8f5[_0xccf7('0x1a')](_0xb29db8)['end']();};}function respondWithResult(_0x40b19d,_0x2bbce2){_0x2bbce2=_0x2bbce2||0xc8;return function(_0x2359d6){if(_0x2359d6){return _0x40b19d[_0xccf7('0x1a')](_0x2bbce2)[_0xccf7('0x1b')](_0x2359d6);}};}function respondWithFilteredResult(_0x46c16b,_0x1bd826){return function(_0x683064){if(_0x683064){var _0x53792b=typeof _0x1bd826[_0xccf7('0x1c')]===_0xccf7('0x1d')&&typeof _0x1bd826['limit']==='undefined';var _0x4f159c=_0x683064[_0xccf7('0x1e')];var _0x174a7e=_0x53792b?0x0:_0x1bd826[_0xccf7('0x1c')];var _0x17c0e0=_0x53792b?_0x683064[_0xccf7('0x1e')]:_0x1bd826[_0xccf7('0x1c')]+_0x1bd826[_0xccf7('0x1f')];var _0x5abe7e;if(_0x17c0e0>=_0x4f159c){_0x17c0e0=_0x4f159c;_0x5abe7e=0xc8;}else{_0x5abe7e=0xce;}_0x46c16b['status'](_0x5abe7e);return _0x46c16b[_0xccf7('0x20')]('Content-Range',_0x174a7e+'-'+_0x17c0e0+'/'+_0x4f159c)[_0xccf7('0x1b')](_0x683064);}return null;};}function patchUpdates(_0x41b622){return function(_0x4dfc9a){try{jsonpatch[_0xccf7('0x21')](_0x4dfc9a,_0x41b622,!![]);}catch(_0x49b07){return BPromise[_0xccf7('0x22')](_0x49b07);}return _0x4dfc9a['save']();};}function saveUpdates(_0x5933a2,_0x46f17a){return function(_0x2d0d0e){if(_0x2d0d0e){return _0x2d0d0e[_0xccf7('0x23')](_0x5933a2)['then'](function(_0x485d5f){return _0x485d5f;});}return null;};}function removeEntity(_0x3fb313,_0x3a12e2){return function(_0x30e15d){if(_0x30e15d){return _0x30e15d[_0xccf7('0x24')]()[_0xccf7('0x25')](function(){_0x3fb313['status'](0xcc)[_0xccf7('0x26')]();});}};}function handleEntityNotFound(_0x20d9b3,_0x3e390e){return function(_0x4d19fc){if(!_0x4d19fc){_0x20d9b3[_0xccf7('0x27')](0x194);}return _0x4d19fc;};}function handleError(_0x109319,_0x1399d3){_0x1399d3=_0x1399d3||0x1f4;return function(_0x1ad738){logger[_0xccf7('0x28')](_0x1ad738['stack']);if(_0x1ad738[_0xccf7('0x29')]){delete _0x1ad738[_0xccf7('0x29')];}_0x109319[_0xccf7('0x1a')](_0x1399d3)[_0xccf7('0x2a')](_0x1ad738);};}exports[_0xccf7('0x2b')]=function(_0x312e73,_0x10df32){var _0x19e196={},_0x46cd1c={},_0x41e69c={'count':0x0,'rows':[]};var _0x15885d=_[_0xccf7('0x2c')](db[_0xccf7('0x2d')][_0xccf7('0x2e')],function(_0x5dcd53){return{'name':_0x5dcd53[_0xccf7('0x2f')],'type':_0x5dcd53['type'][_0xccf7('0x30')]};});_0x46cd1c[_0xccf7('0x31')]=_[_0xccf7('0x2c')](_0x15885d,'name');_0x46cd1c['query']=_[_0xccf7('0x32')](_0x312e73['query']);_0x46cd1c[_0xccf7('0x33')]=_[_0xccf7('0x34')](_0x46cd1c['model'],_0x46cd1c['query']);_0x19e196[_0xccf7('0x35')]=_[_0xccf7('0x34')](_0x46cd1c[_0xccf7('0x31')],qs[_0xccf7('0x36')](_0x312e73[_0xccf7('0x37')][_0xccf7('0x36')]));_0x19e196[_0xccf7('0x35')]=_0x19e196[_0xccf7('0x35')]['length']?_0x19e196[_0xccf7('0x35')]:_0x46cd1c[_0xccf7('0x31')];if(!_0x312e73[_0xccf7('0x37')]['hasOwnProperty']('nolimit')){_0x19e196['limit']=qs[_0xccf7('0x1f')](_0x312e73[_0xccf7('0x37')]['limit']);_0x19e196[_0xccf7('0x1c')]=qs['offset'](_0x312e73[_0xccf7('0x37')][_0xccf7('0x1c')]);}_0x19e196[_0xccf7('0x38')]=qs['sort'](_0x312e73[_0xccf7('0x37')]['sort']);_0x19e196[_0xccf7('0x39')]=qs[_0xccf7('0x33')](_[_0xccf7('0x3a')](_0x312e73['query'],_0x46cd1c['filters']),_0x15885d);if(_0x312e73[_0xccf7('0x37')][_0xccf7('0x3b')]){_0x19e196[_0xccf7('0x39')]=_[_0xccf7('0x3c')](_0x19e196[_0xccf7('0x39')],{'$or':_['map'](_0x15885d,function(_0x3c45f4){if(_0x3c45f4['type']!==_0xccf7('0x3d')){var _0x296720={};_0x296720[_0x3c45f4['name']]={'$like':'%'+_0x312e73['query'][_0xccf7('0x3b')]+'%'};return _0x296720;}})});}_0x19e196=_[_0xccf7('0x3c')]({},_0x19e196,_0x312e73[_0xccf7('0x3e')]);var _0x4805d2={'where':_0x19e196[_0xccf7('0x39')]};return db[_0xccf7('0x2d')][_0xccf7('0x1e')](_0x4805d2)[_0xccf7('0x25')](function(_0x1b1915){_0x41e69c[_0xccf7('0x1e')]=_0x1b1915;if(_0x312e73[_0xccf7('0x37')][_0xccf7('0x3f')]){_0x19e196[_0xccf7('0x40')]=[{'all':!![]}];}return db[_0xccf7('0x2d')][_0xccf7('0x41')](_0x19e196);})['then'](function(_0x29f33d){_0x41e69c[_0xccf7('0x42')]=_0x29f33d;return _0x41e69c;})['then'](respondWithFilteredResult(_0x10df32,_0x19e196))[_0xccf7('0x43')](handleError(_0x10df32,null));};exports[_0xccf7('0x44')]=function(_0x2b3c5e,_0x1fc814){var _0x6a2618={'raw':!![],'where':{'id':_0x2b3c5e[_0xccf7('0x45')]['id']}},_0x4a18f3={};_0x4a18f3[_0xccf7('0x31')]=_['keys'](db[_0xccf7('0x2d')][_0xccf7('0x2e')]);_0x4a18f3['query']=_[_0xccf7('0x32')](_0x2b3c5e[_0xccf7('0x37')]);_0x4a18f3[_0xccf7('0x33')]=_[_0xccf7('0x34')](_0x4a18f3[_0xccf7('0x31')],_0x4a18f3[_0xccf7('0x37')]);_0x6a2618['attributes']=_['intersection'](_0x4a18f3['model'],qs[_0xccf7('0x36')](_0x2b3c5e[_0xccf7('0x37')][_0xccf7('0x36')]));_0x6a2618[_0xccf7('0x35')]=_0x6a2618[_0xccf7('0x35')]['length']?_0x6a2618[_0xccf7('0x35')]:_0x4a18f3[_0xccf7('0x31')];if(_0x2b3c5e[_0xccf7('0x37')][_0xccf7('0x3f')]){_0x6a2618[_0xccf7('0x40')]=[{'all':!![]}];}_0x6a2618=_['merge']({},_0x6a2618,_0x2b3c5e['options']);return db[_0xccf7('0x2d')][_0xccf7('0x46')](_0x6a2618)[_0xccf7('0x25')](handleEntityNotFound(_0x1fc814,null))[_0xccf7('0x25')](respondWithResult(_0x1fc814,null))['catch'](handleError(_0x1fc814,null));};exports['create']=function(_0x5034b8,_0x3c868c){return db[_0xccf7('0x2d')]['create'](_0x5034b8[_0xccf7('0x47')],{})[_0xccf7('0x25')](respondWithResult(_0x3c868c,0xc9))[_0xccf7('0x43')](handleError(_0x3c868c,null));};exports[_0xccf7('0x23')]=function(_0x236e8c,_0x458fe8){if(_0x236e8c[_0xccf7('0x47')]['id']){delete _0x236e8c[_0xccf7('0x47')]['id'];}return db['SquareDetailsReport'][_0xccf7('0x46')]({'where':{'id':_0x236e8c[_0xccf7('0x45')]['id']}})['then'](handleEntityNotFound(_0x458fe8,null))['then'](saveUpdates(_0x236e8c['body'],null))[_0xccf7('0x25')](respondWithResult(_0x458fe8,null))[_0xccf7('0x43')](handleError(_0x458fe8,null));};exports[_0xccf7('0x24')]=function(_0x1b6fd9,_0x51d000){return db[_0xccf7('0x2d')][_0xccf7('0x46')]({'where':{'id':_0x1b6fd9[_0xccf7('0x45')]['id']}})[_0xccf7('0x25')](handleEntityNotFound(_0x51d000,null))[_0xccf7('0x25')](removeEntity(_0x51d000,null))[_0xccf7('0x43')](handleError(_0x51d000,null));};exports[_0xccf7('0x48')]=function(_0x12e439,_0x44de32){return db[_0xccf7('0x2d')][_0xccf7('0x48')]()[_0xccf7('0x25')](respondWithResult(_0x44de32,null))[_0xccf7('0x43')](handleError(_0x44de32,null));}; \ No newline at end of file +var _0x8497=['mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','includeAll','include','catch','create','body','find','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x34a6c5,_0x30b63f){var _0x2b199f=function(_0x129910){while(--_0x129910){_0x34a6c5['push'](_0x34a6c5['shift']());}};_0x2b199f(++_0x30b63f);}(_0x8497,0x12b));var _0x7849=function(_0xb41d5,_0x4202e2){_0xb41d5=_0xb41d5-0x0;var _0x4a3786=_0x8497[_0xb41d5];return _0x4a3786;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7849('0x0'));var zipdir=require(_0x7849('0x1'));var jsonpatch=require(_0x7849('0x2'));var rp=require(_0x7849('0x3'));var moment=require(_0x7849('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7849('0x5'));var util=require(_0x7849('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7849('0x7'));var ejs=require(_0x7849('0x8'));var fs=require('fs');var fs_extra=require(_0x7849('0x9'));var _=require(_0x7849('0xa'));var squel=require(_0x7849('0xb'));var crypto=require(_0x7849('0xc'));var jsforce=require(_0x7849('0xd'));var deskjs=require(_0x7849('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7849('0xf'));var Papa=require(_0x7849('0x10'));var Redis=require(_0x7849('0x11'));var authService=require(_0x7849('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7849('0x13'));var logger=require(_0x7849('0x14'))(_0x7849('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7849('0x16'));var db=require(_0x7849('0x17'))['db'];function respondWithStatusCode(_0x1e8ae1,_0xb66e75){_0xb66e75=_0xb66e75||0xcc;return function(_0x192205){if(_0x192205){return _0x1e8ae1[_0x7849('0x18')](_0xb66e75);}return _0x1e8ae1[_0x7849('0x19')](_0xb66e75)[_0x7849('0x1a')]();};}function respondWithResult(_0x4c4618,_0x4e2714){_0x4e2714=_0x4e2714||0xc8;return function(_0x33ddcc){if(_0x33ddcc){return _0x4c4618[_0x7849('0x19')](_0x4e2714)['json'](_0x33ddcc);}};}function respondWithFilteredResult(_0x2065f7,_0x153b96){return function(_0x2f0408){if(_0x2f0408){var _0x1e969f=typeof _0x153b96[_0x7849('0x1b')]===_0x7849('0x1c')&&typeof _0x153b96[_0x7849('0x1d')]==='undefined';var _0x592817=_0x2f0408[_0x7849('0x1e')];var _0x38cbf8=_0x1e969f?0x0:_0x153b96[_0x7849('0x1b')];var _0x30f7b3=_0x1e969f?_0x2f0408[_0x7849('0x1e')]:_0x153b96[_0x7849('0x1b')]+_0x153b96[_0x7849('0x1d')];var _0x4dec02;if(_0x30f7b3>=_0x592817){_0x30f7b3=_0x592817;_0x4dec02=0xc8;}else{_0x4dec02=0xce;}_0x2065f7[_0x7849('0x19')](_0x4dec02);return _0x2065f7[_0x7849('0x1f')](_0x7849('0x20'),_0x38cbf8+'-'+_0x30f7b3+'/'+_0x592817)[_0x7849('0x21')](_0x2f0408);}return null;};}function patchUpdates(_0x577d15){return function(_0x1906ba){try{jsonpatch[_0x7849('0x22')](_0x1906ba,_0x577d15,!![]);}catch(_0x537076){return BPromise[_0x7849('0x23')](_0x537076);}return _0x1906ba[_0x7849('0x24')]();};}function saveUpdates(_0x5df753,_0x5dbcb5){return function(_0x2f0adb){if(_0x2f0adb){return _0x2f0adb[_0x7849('0x25')](_0x5df753)[_0x7849('0x26')](function(_0x14b89a){return _0x14b89a;});}return null;};}function removeEntity(_0x3cffda,_0x8119a3){return function(_0x4d4d99){if(_0x4d4d99){return _0x4d4d99['destroy']()[_0x7849('0x26')](function(){_0x3cffda[_0x7849('0x19')](0xcc)[_0x7849('0x1a')]();});}};}function handleEntityNotFound(_0x46397b,_0x2218f6){return function(_0x4f6ae2){if(!_0x4f6ae2){_0x46397b[_0x7849('0x18')](0x194);}return _0x4f6ae2;};}function handleError(_0x243dc4,_0x4b7d86){_0x4b7d86=_0x4b7d86||0x1f4;return function(_0x577c12){logger[_0x7849('0x27')](_0x577c12['stack']);if(_0x577c12[_0x7849('0x28')]){delete _0x577c12[_0x7849('0x28')];}_0x243dc4['status'](_0x4b7d86)[_0x7849('0x29')](_0x577c12);};}exports[_0x7849('0x2a')]=function(_0x4cb3ec,_0x2e2d17){var _0x33366b={},_0xcfb1a={},_0x27194c={'count':0x0,'rows':[]};var _0x40ac1c=_['map'](db[_0x7849('0x2b')][_0x7849('0x2c')],function(_0x2f79d3){return{'name':_0x2f79d3[_0x7849('0x2d')],'type':_0x2f79d3[_0x7849('0x2e')][_0x7849('0x2f')]};});_0xcfb1a['model']=_[_0x7849('0x30')](_0x40ac1c,_0x7849('0x28'));_0xcfb1a['query']=_[_0x7849('0x31')](_0x4cb3ec[_0x7849('0x32')]);_0xcfb1a[_0x7849('0x33')]=_[_0x7849('0x34')](_0xcfb1a[_0x7849('0x35')],_0xcfb1a['query']);_0x33366b[_0x7849('0x36')]=_[_0x7849('0x34')](_0xcfb1a[_0x7849('0x35')],qs['fields'](_0x4cb3ec['query'][_0x7849('0x37')]));_0x33366b[_0x7849('0x36')]=_0x33366b[_0x7849('0x36')]['length']?_0x33366b[_0x7849('0x36')]:_0xcfb1a[_0x7849('0x35')];if(!_0x4cb3ec[_0x7849('0x32')]['hasOwnProperty']('nolimit')){_0x33366b['limit']=qs[_0x7849('0x1d')](_0x4cb3ec[_0x7849('0x32')][_0x7849('0x1d')]);_0x33366b[_0x7849('0x1b')]=qs[_0x7849('0x1b')](_0x4cb3ec['query'][_0x7849('0x1b')]);}_0x33366b[_0x7849('0x38')]=qs[_0x7849('0x39')](_0x4cb3ec[_0x7849('0x32')][_0x7849('0x39')]);_0x33366b['where']=qs[_0x7849('0x33')](_[_0x7849('0x3a')](_0x4cb3ec[_0x7849('0x32')],_0xcfb1a[_0x7849('0x33')]),_0x40ac1c);if(_0x4cb3ec[_0x7849('0x32')][_0x7849('0x3b')]){_0x33366b[_0x7849('0x3c')]=_[_0x7849('0x3d')](_0x33366b[_0x7849('0x3c')],{'$or':_[_0x7849('0x30')](_0x40ac1c,function(_0x443324){if(_0x443324['type']!==_0x7849('0x3e')){var _0x611513={};_0x611513[_0x443324[_0x7849('0x28')]]={'$like':'%'+_0x4cb3ec[_0x7849('0x32')][_0x7849('0x3b')]+'%'};return _0x611513;}})});}_0x33366b=_[_0x7849('0x3d')]({},_0x33366b,_0x4cb3ec[_0x7849('0x3f')]);var _0x2d1034={'where':_0x33366b['where']};return db[_0x7849('0x2b')][_0x7849('0x1e')](_0x2d1034)['then'](function(_0x3544ba){_0x27194c[_0x7849('0x1e')]=_0x3544ba;if(_0x4cb3ec[_0x7849('0x32')]['includeAll']){_0x33366b['include']=[{'all':!![]}];}return db[_0x7849('0x2b')][_0x7849('0x40')](_0x33366b);})[_0x7849('0x26')](function(_0x42915f){_0x27194c[_0x7849('0x41')]=_0x42915f;return _0x27194c;})[_0x7849('0x26')](respondWithFilteredResult(_0x2e2d17,_0x33366b))['catch'](handleError(_0x2e2d17,null));};exports[_0x7849('0x42')]=function(_0x32a924,_0x10bd41){var _0x5c8bbc={'raw':!![],'where':{'id':_0x32a924['params']['id']}},_0x3338a3={};_0x3338a3[_0x7849('0x35')]=_[_0x7849('0x31')](db[_0x7849('0x2b')]['rawAttributes']);_0x3338a3[_0x7849('0x32')]=_[_0x7849('0x31')](_0x32a924[_0x7849('0x32')]);_0x3338a3[_0x7849('0x33')]=_['intersection'](_0x3338a3[_0x7849('0x35')],_0x3338a3['query']);_0x5c8bbc[_0x7849('0x36')]=_[_0x7849('0x34')](_0x3338a3[_0x7849('0x35')],qs['fields'](_0x32a924[_0x7849('0x32')][_0x7849('0x37')]));_0x5c8bbc[_0x7849('0x36')]=_0x5c8bbc[_0x7849('0x36')]['length']?_0x5c8bbc[_0x7849('0x36')]:_0x3338a3[_0x7849('0x35')];if(_0x32a924[_0x7849('0x32')][_0x7849('0x43')]){_0x5c8bbc[_0x7849('0x44')]=[{'all':!![]}];}_0x5c8bbc=_['merge']({},_0x5c8bbc,_0x32a924[_0x7849('0x3f')]);return db[_0x7849('0x2b')]['find'](_0x5c8bbc)['then'](handleEntityNotFound(_0x10bd41,null))['then'](respondWithResult(_0x10bd41,null))[_0x7849('0x45')](handleError(_0x10bd41,null));};exports[_0x7849('0x46')]=function(_0x2bc2da,_0x478a6b){return db[_0x7849('0x2b')][_0x7849('0x46')](_0x2bc2da['body'],{})[_0x7849('0x26')](respondWithResult(_0x478a6b,0xc9))[_0x7849('0x45')](handleError(_0x478a6b,null));};exports[_0x7849('0x25')]=function(_0x546c95,_0x3484b0){if(_0x546c95[_0x7849('0x47')]['id']){delete _0x546c95[_0x7849('0x47')]['id'];}return db[_0x7849('0x2b')][_0x7849('0x48')]({'where':{'id':_0x546c95[_0x7849('0x49')]['id']}})[_0x7849('0x26')](handleEntityNotFound(_0x3484b0,null))[_0x7849('0x26')](saveUpdates(_0x546c95['body'],null))['then'](respondWithResult(_0x3484b0,null))[_0x7849('0x45')](handleError(_0x3484b0,null));};exports[_0x7849('0x4a')]=function(_0xbc6a8e,_0x488964){return db[_0x7849('0x2b')][_0x7849('0x48')]({'where':{'id':_0xbc6a8e[_0x7849('0x49')]['id']}})[_0x7849('0x26')](handleEntityNotFound(_0x488964,null))['then'](removeEntity(_0x488964,null))['catch'](handleError(_0x488964,null));};exports[_0x7849('0x4b')]=function(_0xaec541,_0x4b729b){return db[_0x7849('0x2b')][_0x7849('0x4b')]()[_0x7849('0x26')](respondWithResult(_0x4b729b,null))[_0x7849('0x45')](handleError(_0x4b729b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index cc1aeba..65973dc 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 _0xea67=['path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5a6e2d,_0x5a3579){var _0x4fab7a=function(_0xb1a793){while(--_0xb1a793){_0x5a6e2d['push'](_0x5a6e2d['shift']());}};_0x4fab7a(++_0x5a3579);}(_0xea67,0x162));var _0x7ea6=function(_0x3875b1,_0x47cf1a){_0x3875b1=_0x3875b1-0x0;var _0x1e9c55=_0xea67[_0x3875b1];return _0x1e9c55;};'use strict';var _=require(_0x7ea6('0x0'));var util=require(_0x7ea6('0x1'));var logger=require(_0x7ea6('0x2'))(_0x7ea6('0x3'));var moment=require(_0x7ea6('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ea6('0x5'));var fs=require('fs');var path=require(_0x7ea6('0x6'));var rimraf=require(_0x7ea6('0x7'));var config=require('../../config/environment');var attributes=require(_0x7ea6('0x8'));module[_0x7ea6('0x9')]=function(_0x15f424,_0x36a403){return _0x15f424[_0x7ea6('0xa')](_0x7ea6('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8e3=['bluebird','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','../../config/logger'];(function(_0x339a6e,_0x31a49a){var _0xabee40=function(_0x395c09){while(--_0x395c09){_0x339a6e['push'](_0x339a6e['shift']());}};_0xabee40(++_0x31a49a);}(_0xd8e3,0x8f));var _0x3d8e=function(_0x52f38f,_0xa9bdba){_0x52f38f=_0x52f38f-0x0;var _0x16246f=_0xd8e3[_0x52f38f];return _0x16246f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d8e('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3d8e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d8e('0x2'));var rimraf=require(_0x3d8e('0x3'));var config=require('../../config/environment');var attributes=require(_0x3d8e('0x4'));module[_0x3d8e('0x5')]=function(_0x1450a4,_0x1149d1){return _0x1450a4[_0x3d8e('0x6')](_0x3d8e('0x7'),attributes,{'tableName':_0x3d8e('0x8'),'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 a8fbb65..a22cf93 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 _0xfff0=['CreateSquareDetailsReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareDetailsReport','create','body','options','raw'];(function(_0x5876ad,_0x2150c0){var _0x4d46f7=function(_0x23e6af){while(--_0x23e6af){_0x5876ad['push'](_0x5876ad['shift']());}};_0x4d46f7(++_0x2150c0);}(_0xfff0,0x139));var _0x0fff=function(_0x1731ef,_0x563f12){_0x1731ef=_0x1731ef-0x0;var _0x3ba2b1=_0xfff0[_0x1731ef];return _0x3ba2b1;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1d2b,_0x586dc5,_0x24cfb0){return new BPromise(function(_0x5e9672,_0x1f2658){return client['request'](_0x2f1d2b,_0x24cfb0)[_0x0fff('0xa')](function(_0x3db6f6){logger['info'](_0x0fff('0xb'),_0x586dc5,_0x0fff('0xc'));logger[_0x0fff('0xd')](_0x0fff('0xe'),_0x586dc5,_0x0fff('0xc'),JSON[_0x0fff('0xf')](_0x3db6f6));if(_0x3db6f6[_0x0fff('0x10')]){if(_0x3db6f6[_0x0fff('0x10')][_0x0fff('0x11')]===0x1f4){logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6['error'][_0x0fff('0x12')]);return _0x1f2658(_0x3db6f6['error'][_0x0fff('0x12')]);}logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6[_0x0fff('0x10')]['message']);return _0x5e9672(_0x3db6f6['error'][_0x0fff('0x12')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x586dc5,'request\x20sent');_0x5e9672(_0x3db6f6[_0x0fff('0x13')][_0x0fff('0x12')]);}})['catch'](function(_0x431b33){logger[_0x0fff('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x586dc5,_0x431b33);_0x1f2658(_0x431b33);});});}exports['CreateSquareDetailsReport']=function(_0x48f36d){var _0x2337f=this;return new Promise(function(_0x606792,_0x46a02d){return db[_0x0fff('0x14')][_0x0fff('0x15')](_0x48f36d[_0x0fff('0x16')],{'raw':_0x48f36d['options']?_0x48f36d[_0x0fff('0x17')][_0x0fff('0x18')]===undefined?!![]:![]:!![]})[_0x0fff('0xa')](function(_0x49d211){logger['info'](_0x0fff('0x19'),_0x48f36d);logger[_0x0fff('0xd')](_0x0fff('0x19'),_0x48f36d,JSON[_0x0fff('0xf')](_0x49d211));_0x606792(_0x49d211);})['catch'](function(_0x155132){logger[_0x0fff('0x10')](_0x0fff('0x19'),_0x155132[_0x0fff('0x12')],_0x48f36d);_0x46a02d(_0x2337f[_0x0fff('0x10')](0x1f4,_0x155132[_0x0fff('0x12')]));});});}; \ No newline at end of file +var _0x4024=['catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x4024,0x89));var _0x4402=function(_0x33c09d,_0x49fbfe){_0x33c09d=_0x33c09d-0x0;var _0x1c846f=_0x4024[_0x33c09d];return _0x1c846f;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168acd,_0x4ed77d,_0x3045ae){return new BPromise(function(_0x5d7ca4,_0x5c0b70){return client[_0x4402('0x9')](_0x168acd,_0x3045ae)['then'](function(_0x4d2882){logger[_0x4402('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x4ed77d,_0x4402('0xb'));logger['debug'](_0x4402('0xc'),_0x4ed77d,'request\x20sent',JSON[_0x4402('0xd')](_0x4d2882));if(_0x4d2882[_0x4402('0xe')]){if(_0x4d2882['error'][_0x4402('0xf')]===0x1f4){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882['error'][_0x4402('0x11')]);return _0x5c0b70(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);return _0x5d7ca4(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}else{logger[_0x4402('0xa')](_0x4402('0x10'),_0x4ed77d,_0x4402('0xb'));_0x5d7ca4(_0x4d2882[_0x4402('0x12')][_0x4402('0x11')]);}})[_0x4402('0x13')](function(_0x30c390){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x30c390);_0x5c0b70(_0x30c390);});});}exports[_0x4402('0x14')]=function(_0x231382){var _0x5b127f=this;return new Promise(function(_0x494389,_0x663ab7){return db[_0x4402('0x15')]['create'](_0x231382[_0x4402('0x16')],{'raw':_0x231382[_0x4402('0x17')]?_0x231382['options'][_0x4402('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55cc8c){logger[_0x4402('0xa')](_0x4402('0x14'),_0x231382);logger[_0x4402('0x19')]('CreateSquareDetailsReport',_0x231382,JSON[_0x4402('0xd')](_0x55cc8c));_0x494389(_0x55cc8c);})['catch'](function(_0x47ab54){logger[_0x4402('0xe')](_0x4402('0x14'),_0x47ab54[_0x4402('0x11')],_0x231382);_0x663ab7(_0x5b127f[_0x4402('0xe')](0x1f4,_0x47ab54[_0x4402('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 9715ff9..18e8f7b 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 _0x445b=['./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','../../components/auth/service'];(function(_0x8d6c7a,_0x2d4c3c){var _0x2c305a=function(_0x388014){while(--_0x388014){_0x8d6c7a['push'](_0x8d6c7a['shift']());}};_0x2c305a(++_0x2d4c3c);}(_0x445b,0x185));var _0xb445=function(_0x3d8603,_0x43b724){_0x3d8603=_0x3d8603-0x0;var _0x3181f2=_0x445b[_0x3d8603];return _0x3181f2;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xb445('0x0'));var controller=require(_0xb445('0x1'));router[_0xb445('0x2')]('/',auth[_0xb445('0x3')](),controller['index']);router[_0xb445('0x2')](_0xb445('0x4'),auth['isAuthenticated'](),controller[_0xb445('0x5')]);module['exports']=router; \ No newline at end of file +var _0xe4db=['index','killProcess','exports','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0xe4db,0x130));var _0xbe4d=function(_0x12901d,_0x279212){_0x12901d=_0x12901d-0x0;var _0x66ada7=_0xe4db[_0x12901d];return _0x66ada7;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xbe4d('0x0'));var controller=require(_0xbe4d('0x1'));router[_0xbe4d('0x2')]('/',auth[_0xbe4d('0x3')](),controller[_0xbe4d('0x4')]);router['get']('/process/:pid/kill',auth[_0xbe4d('0x3')](),controller[_0xbe4d('0x5')]);module[_0xbe4d('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 82f2264..601c7a6 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 _0x1792=['Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','format','pid','kill'];(function(_0x30c2af,_0x5b7d42){var _0x3888cb=function(_0x32a465){while(--_0x32a465){_0x30c2af['push'](_0x30c2af['shift']());}};_0x3888cb(++_0x5b7d42);}(_0x1792,0x16b));var _0x2179=function(_0x37bf43,_0x5b2339){_0x37bf43=_0x37bf43-0x0;var _0x4101c5=_0x1792[_0x37bf43];return _0x4101c5;};'use strict';var info=require(_0x2179('0x0'));var exec=require(_0x2179('0x1'))['exec'];var logger=require('../../config/logger')(_0x2179('0x2'));var util=require(_0x2179('0x3'));var BPromise=require(_0x2179('0x4'));var _=require(_0x2179('0x5'));function handleError(_0x343f4f,_0x209d1f,_0x1e3bf2){_0x209d1f=_0x209d1f||0x1f4;return function(_0x1efd3c){logger[_0x2179('0x6')](_0x2179('0x7'),_0x1e3bf2,_0x209d1f,util[_0x2179('0x8')](_0x1efd3c,{'showHidden':![],'depth':null}));delete _0x1efd3c[_0x2179('0x9')];_0x343f4f[_0x2179('0xa')](_0x209d1f)[_0x2179('0xb')](_0x1efd3c);};}exports[_0x2179('0xc')]=function(_0x9bb23e,_0x1b8465){return info[_0x2179('0xd')]()[_0x2179('0xe')](function(_0x3d19b0){return _0x1b8465['status'](0xc8)[_0x2179('0xf')](_0x3d19b0);})['catch'](function(_0x1fb28f){return _0x1b8465[_0x2179('0xa')](0x1f4)['json'](_0x1fb28f);});};exports['killProcess']=function(_0x36dfb9,_0x437b18){var _0x58498b=['components/import/cm'];return new BPromise(function(_0x5ebc9d,_0x1484e3){return exec(util['format'](_0x2179('0x10'),_0x36dfb9[_0x2179('0x11')]['pid']),function(_0x59663a,_0x4897a4,_0x51d054){if(_0x59663a){return _0x1484e3(_0x59663a);}return _0x5ebc9d(_0x4897a4);});})[_0x2179('0xe')](function(_0x232082){var _0x3c3452=![];var _0x469af4=_0x232082['split'](/\n/);for(var _0x32d528=0x0,_0x4d4533=_0x58498b['length'];_0x32d528<_0x4d4533,_0x3c3452===![];_0x32d528+=0x1){if(_0x232082['indexOf'](_0x58498b[_0x32d528])>=0x0){_0x3c3452=!![];}}if(!_0x3c3452){throw new Error(util[_0x2179('0x12')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x36dfb9[_0x2179('0x11')][_0x2179('0x13')]));}process[_0x2179('0x14')](_0x36dfb9[_0x2179('0x11')][_0x2179('0x13')],'SIGINT');return _0x437b18[_0x2179('0xa')](0xc8)[_0x2179('0xf')]({'message':util[_0x2179('0x12')](_0x2179('0x15'),_0x36dfb9[_0x2179('0x11')]['pid'])});})[_0x2179('0x16')](handleError(_0x437b18,null,_0x2179('0x17')));}; \ No newline at end of file +var _0x22b1=['killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','catch','child_process','exec','../../config/logger','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','then','json'];(function(_0xd604b3,_0x5ce06c){var _0x4d44d4=function(_0x413518){while(--_0x413518){_0xd604b3['push'](_0xd604b3['shift']());}};_0x4d44d4(++_0x5ce06c);}(_0x22b1,0x137));var _0x122b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x22b1[_0x19e35c];return _0x3e1fe8;};'use strict';var info=require('systeminformation');var exec=require(_0x122b('0x0'))[_0x122b('0x1')];var logger=require(_0x122b('0x2'))('api');var util=require('util');var BPromise=require('bluebird');var _=require(_0x122b('0x3'));function handleError(_0x2124bd,_0x3a8ddc,_0x1e6816){_0x3a8ddc=_0x3a8ddc||0x1f4;return function(_0x353b42){logger['error'](_0x122b('0x4'),_0x1e6816,_0x3a8ddc,util[_0x122b('0x5')](_0x353b42,{'showHidden':![],'depth':null}));delete _0x353b42['name'];_0x2124bd[_0x122b('0x6')](_0x3a8ddc)[_0x122b('0x7')](_0x353b42);};}exports[_0x122b('0x8')]=function(_0x5da395,_0x112523){return info['getAllData']()[_0x122b('0x9')](function(_0x578688){return _0x112523[_0x122b('0x6')](0xc8)[_0x122b('0xa')](_0x578688);})['catch'](function(_0xce1de1){return _0x112523['status'](0x1f4)[_0x122b('0xa')](_0xce1de1);});};exports[_0x122b('0xb')]=function(_0x1623ef,_0x477978){var _0xd87d58=[_0x122b('0xc')];return new BPromise(function(_0x593526,_0x39623d){return exec(util[_0x122b('0xd')](_0x122b('0xe'),_0x1623ef[_0x122b('0xf')][_0x122b('0x10')]),function(_0x3a6fcc,_0x424b5b,_0x2c4d02){if(_0x3a6fcc){return _0x39623d(_0x3a6fcc);}return _0x593526(_0x424b5b);});})[_0x122b('0x9')](function(_0x5bc24e){var _0x54e2bb=![];var _0x5d33cd=_0x5bc24e[_0x122b('0x11')](/\n/);for(var _0x17720e=0x0,_0x4257b0=_0xd87d58[_0x122b('0x12')];_0x17720e<_0x4257b0,_0x54e2bb===![];_0x17720e+=0x1){if(_0x5bc24e[_0x122b('0x13')](_0xd87d58[_0x17720e])>=0x0){_0x54e2bb=!![];}}if(!_0x54e2bb){throw new Error(util[_0x122b('0xd')](_0x122b('0x14'),_0x1623ef[_0x122b('0xf')][_0x122b('0x10')]));}process['kill'](_0x1623ef['params'][_0x122b('0x10')],_0x122b('0x15'));return _0x477978[_0x122b('0x6')](0xc8)[_0x122b('0xa')]({'message':util[_0x122b('0xd')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1623ef[_0x122b('0xf')]['pid'])});})[_0x122b('0x16')](handleError(_0x477978,null,_0x122b('0xb')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4d77271..9f81bd4 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 _0xbba8=['path','express','../../components/auth/service','../../components/interaction/service','./tag.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util'];(function(_0x23bcd4,_0xd3deb0){var _0x4cb792=function(_0x48d4c8){while(--_0x48d4c8){_0x23bcd4['push'](_0x23bcd4['shift']());}};_0x4cb792(++_0xd3deb0);}(_0xbba8,0x197));var _0x8bba=function(_0x494e66,_0xf6d9cd){_0x494e66=_0x494e66-0x0;var _0x5df5ca=_0xbba8[_0x494e66];return _0x5df5ca;};'use strict';var multer=require('multer');var util=require(_0x8bba('0x0'));var path=require(_0x8bba('0x1'));var timeout=require('connect-timeout');var express=require(_0x8bba('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8bba('0x3'));var interaction=require(_0x8bba('0x4'));var config=require('../../config/environment');var controller=require(_0x8bba('0x5'));router[_0x8bba('0x6')]('/',auth['isAuthenticated'](),controller[_0x8bba('0x7')]);router[_0x8bba('0x6')](_0x8bba('0x8'),auth[_0x8bba('0x9')](),controller[_0x8bba('0xa')]);router[_0x8bba('0xb')]('/',auth[_0x8bba('0x9')](),controller[_0x8bba('0xc')]);router[_0x8bba('0xd')]('/:id',auth[_0x8bba('0x9')](),controller[_0x8bba('0xe')]);router[_0x8bba('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8bba('0x10')]=router; \ No newline at end of file +var _0x9568=['../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x4886f4,_0x5f4cb6){var _0x163a58=function(_0x52ac71){while(--_0x52ac71){_0x4886f4['push'](_0x4886f4['shift']());}};_0x163a58(++_0x5f4cb6);}(_0x9568,0xc7));var _0x8956=function(_0x1d6dea,_0x1f8978){_0x1d6dea=_0x1d6dea-0x0;var _0x1b5967=_0x9568[_0x1d6dea];return _0x1b5967;};'use strict';var multer=require(_0x8956('0x0'));var util=require(_0x8956('0x1'));var path=require(_0x8956('0x2'));var timeout=require(_0x8956('0x3'));var express=require(_0x8956('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8956('0x5'));var interaction=require(_0x8956('0x6'));var config=require('../../config/environment');var controller=require(_0x8956('0x7'));router['get']('/',auth[_0x8956('0x8')](),controller[_0x8956('0x9')]);router[_0x8956('0xa')]('/:id',auth[_0x8956('0x8')](),controller['show']);router[_0x8956('0xb')]('/',auth[_0x8956('0x8')](),controller[_0x8956('0xc')]);router[_0x8956('0xd')]('/:id',auth[_0x8956('0x8')](),controller[_0x8956('0xe')]);router[_0x8956('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8956('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 44f2b22..ec113d2 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 _0x4483=['exports','STRING','#0091EA','sequelize'];(function(_0x18f623,_0x1f2a74){var _0x299b78=function(_0x3914e8){while(--_0x3914e8){_0x18f623['push'](_0x18f623['shift']());}};_0x299b78(++_0x1f2a74);}(_0x4483,0x1a3));var _0x3448=function(_0xf93b47,_0x458cf7){_0xf93b47=_0xf93b47-0x0;var _0x1102c5=_0x4483[_0xf93b47];return _0x1102c5;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'name':{'type':Sequelize[_0x3448('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3448('0x2')],'defaultValue':_0x3448('0x3')},'description':{'type':Sequelize[_0x3448('0x2')]}}; \ No newline at end of file +var _0x3c81=['name','STRING','sequelize','exports'];(function(_0x30f27c,_0x57ed26){var _0x114c65=function(_0x81fe7c){while(--_0x81fe7c){_0x30f27c['push'](_0x30f27c['shift']());}};_0x114c65(++_0x57ed26);}(_0x3c81,0x102));var _0x13c8=function(_0x59b402,_0x4d8750){_0x59b402=_0x59b402-0x0;var _0x6f9728=_0x3c81[_0x59b402];return _0x6f9728;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x13c8('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3ff6f8b..5530777 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 _0x5ff3=['params','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','Tag','include','findAll','catch','show','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x5ff3,0x17d));var _0x35ff=function(_0x5357cd,_0x4622b3){_0x5357cd=_0x5357cd-0x0;var _0x369a7f=_0x5ff3[_0x5357cd];return _0x369a7f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35ff('0x1'));var rp=require('request-promise');var moment=require(_0x35ff('0x2'));var BPromise=require(_0x35ff('0x3'));var Mustache=require(_0x35ff('0x4'));var util=require(_0x35ff('0x5'));var path=require('path');var sox=require(_0x35ff('0x6'));var csv=require(_0x35ff('0x7'));var ejs=require(_0x35ff('0x8'));var fs=require('fs');var fs_extra=require(_0x35ff('0x9'));var _=require(_0x35ff('0xa'));var squel=require('squel');var crypto=require(_0x35ff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x35ff('0xc'));var toCsv=require(_0x35ff('0x7'));var querystring=require(_0x35ff('0xd'));var Papa=require('papaparse');var Redis=require(_0x35ff('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x35ff('0xf'));var as=require(_0x35ff('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x35ff('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x35ff('0x12'))['db'];function respondWithStatusCode(_0x3c5f4b,_0x5bda40){_0x5bda40=_0x5bda40||0xcc;return function(_0x842930){if(_0x842930){return _0x3c5f4b['sendStatus'](_0x5bda40);}return _0x3c5f4b[_0x35ff('0x13')](_0x5bda40)[_0x35ff('0x14')]();};}function respondWithResult(_0x3db454,_0x4d1d41){_0x4d1d41=_0x4d1d41||0xc8;return function(_0xff8ac){if(_0xff8ac){return _0x3db454[_0x35ff('0x13')](_0x4d1d41)[_0x35ff('0x15')](_0xff8ac);}};}function respondWithFilteredResult(_0x3e24dd,_0x438199){return function(_0x3dff65){if(_0x3dff65){var _0x2d4a88=typeof _0x438199[_0x35ff('0x16')]===_0x35ff('0x17')&&typeof _0x438199[_0x35ff('0x18')]===_0x35ff('0x17');var _0x3430e2=_0x3dff65[_0x35ff('0x19')];var _0x16c803=_0x2d4a88?0x0:_0x438199[_0x35ff('0x16')];var _0x5f470e=_0x2d4a88?_0x3dff65[_0x35ff('0x19')]:_0x438199[_0x35ff('0x16')]+_0x438199[_0x35ff('0x18')];var _0x1c0d8c;if(_0x5f470e>=_0x3430e2){_0x5f470e=_0x3430e2;_0x1c0d8c=0xc8;}else{_0x1c0d8c=0xce;}_0x3e24dd['status'](_0x1c0d8c);return _0x3e24dd['set'](_0x35ff('0x1a'),_0x16c803+'-'+_0x5f470e+'/'+_0x3430e2)[_0x35ff('0x15')](_0x3dff65);}return null;};}function patchUpdates(_0x4c8dd4){return function(_0x238f65){try{jsonpatch[_0x35ff('0x1b')](_0x238f65,_0x4c8dd4,!![]);}catch(_0x3a87bc){return BPromise[_0x35ff('0x1c')](_0x3a87bc);}return _0x238f65['save']();};}function saveUpdates(_0x3d60b4,_0x55274b){return function(_0x7cc20a){if(_0x7cc20a){return _0x7cc20a[_0x35ff('0x1d')](_0x3d60b4)[_0x35ff('0x1e')](function(_0x16a5a0){return _0x16a5a0;});}return null;};}function removeEntity(_0x396cc2,_0x2b3782){return function(_0x347cec){if(_0x347cec){return _0x347cec['destroy']()[_0x35ff('0x1e')](function(){var _0x2ffcb=_0x347cec['get']({'plain':!![]});var _0x426e4e='Tags';return db['UserProfileResource'][_0x35ff('0x1f')]({'where':{'type':_0x426e4e,'resourceId':_0x2ffcb['id']}})[_0x35ff('0x1e')](function(){return _0x347cec;});})[_0x35ff('0x1e')](function(){_0x396cc2[_0x35ff('0x13')](0xcc)[_0x35ff('0x14')]();});}};}function handleEntityNotFound(_0x546ec0,_0x2bdba4){return function(_0x412873){if(!_0x412873){_0x546ec0[_0x35ff('0x20')](0x194);}return _0x412873;};}function handleError(_0x5e191b,_0x3357a){_0x3357a=_0x3357a||0x1f4;return function(_0x1f51c5){logger[_0x35ff('0x21')](_0x1f51c5[_0x35ff('0x22')]);if(_0x1f51c5[_0x35ff('0x23')]){delete _0x1f51c5[_0x35ff('0x23')];}_0x5e191b[_0x35ff('0x13')](_0x3357a)[_0x35ff('0x24')](_0x1f51c5);};}exports[_0x35ff('0x25')]=function(_0x47d8fa,_0x3f9440){var _0x57339d={},_0x1cb370={},_0x257501={'count':0x0,'rows':[]};var _0x2bc118=_[_0x35ff('0x26')](db['Tag'][_0x35ff('0x27')],function(_0x5de349){return{'name':_0x5de349[_0x35ff('0x28')],'type':_0x5de349[_0x35ff('0x29')]['key']};});_0x1cb370['model']=_[_0x35ff('0x26')](_0x2bc118,_0x35ff('0x23'));_0x1cb370['query']=_[_0x35ff('0x2a')](_0x47d8fa[_0x35ff('0x2b')]);_0x1cb370['filters']=_[_0x35ff('0x2c')](_0x1cb370[_0x35ff('0x2d')],_0x1cb370[_0x35ff('0x2b')]);_0x57339d[_0x35ff('0x2e')]=_[_0x35ff('0x2c')](_0x1cb370[_0x35ff('0x2d')],qs[_0x35ff('0x2f')](_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x2f')]));_0x57339d[_0x35ff('0x2e')]=_0x57339d[_0x35ff('0x2e')][_0x35ff('0x30')]?_0x57339d[_0x35ff('0x2e')]:_0x1cb370['model'];if(!_0x47d8fa[_0x35ff('0x2b')]['hasOwnProperty'](_0x35ff('0x31'))){_0x57339d[_0x35ff('0x18')]=qs[_0x35ff('0x18')](_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x18')]);_0x57339d['offset']=qs[_0x35ff('0x16')](_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x16')]);}_0x57339d[_0x35ff('0x32')]=qs[_0x35ff('0x33')](_0x47d8fa['query'][_0x35ff('0x33')]);_0x57339d[_0x35ff('0x34')]=qs[_0x35ff('0x35')](_['pick'](_0x47d8fa['query'],_0x1cb370[_0x35ff('0x35')]),_0x2bc118);if(_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x36')]){_0x57339d[_0x35ff('0x34')]=_[_0x35ff('0x37')](_0x57339d[_0x35ff('0x34')],{'$or':_[_0x35ff('0x26')](_0x2bc118,function(_0x368f7c){if(_0x368f7c['type']!=='VIRTUAL'){var _0x550c09={};_0x550c09[_0x368f7c[_0x35ff('0x23')]]={'$like':'%'+_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x36')]+'%'};return _0x550c09;}})});}_0x57339d=_[_0x35ff('0x37')]({},_0x57339d,_0x47d8fa[_0x35ff('0x38')]);var _0x59c398={'where':_0x57339d[_0x35ff('0x34')]};return db[_0x35ff('0x39')][_0x35ff('0x19')](_0x59c398)[_0x35ff('0x1e')](function(_0x117ee6){_0x257501[_0x35ff('0x19')]=_0x117ee6;if(_0x47d8fa['query']['includeAll']){_0x57339d[_0x35ff('0x3a')]=[{'all':!![]}];}return db[_0x35ff('0x39')][_0x35ff('0x3b')](_0x57339d);})[_0x35ff('0x1e')](function(_0x4b1e3e){_0x257501['rows']=_0x4b1e3e;return _0x257501;})[_0x35ff('0x1e')](respondWithFilteredResult(_0x3f9440,_0x57339d))[_0x35ff('0x3c')](handleError(_0x3f9440,null));};exports[_0x35ff('0x3d')]=function(_0x1cd2c8,_0xb1f6ca){var _0x2ff794={'raw':!![],'where':{'id':_0x1cd2c8['params']['id']}},_0x346758={};_0x346758['model']=_[_0x35ff('0x2a')](db[_0x35ff('0x39')][_0x35ff('0x27')]);_0x346758['query']=_[_0x35ff('0x2a')](_0x1cd2c8[_0x35ff('0x2b')]);_0x346758['filters']=_['intersection'](_0x346758[_0x35ff('0x2d')],_0x346758['query']);_0x2ff794[_0x35ff('0x2e')]=_[_0x35ff('0x2c')](_0x346758['model'],qs[_0x35ff('0x2f')](_0x1cd2c8['query']['fields']));_0x2ff794[_0x35ff('0x2e')]=_0x2ff794[_0x35ff('0x2e')][_0x35ff('0x30')]?_0x2ff794[_0x35ff('0x2e')]:_0x346758[_0x35ff('0x2d')];if(_0x1cd2c8[_0x35ff('0x2b')][_0x35ff('0x3e')]){_0x2ff794[_0x35ff('0x3a')]=[{'all':!![]}];}_0x2ff794=_[_0x35ff('0x37')]({},_0x2ff794,_0x1cd2c8[_0x35ff('0x38')]);return db[_0x35ff('0x39')][_0x35ff('0x3f')](_0x2ff794)['then'](handleEntityNotFound(_0xb1f6ca,null))[_0x35ff('0x1e')](respondWithResult(_0xb1f6ca,null))[_0x35ff('0x3c')](handleError(_0xb1f6ca,null));};exports[_0x35ff('0x40')]=function(_0x2d26e2,_0x506def){return db['Tag'][_0x35ff('0x40')](_0x2d26e2['body'],{})[_0x35ff('0x1e')](function(_0x2caefe){var _0x14aa90=_0x2d26e2[_0x35ff('0x41')][_0x35ff('0x42')]({'plain':!![]});if(!_0x14aa90)throw new Error(_0x35ff('0x43'));if(_0x14aa90[_0x35ff('0x44')]===_0x35ff('0x41')){var _0x3be5fc=_0x2caefe['get']({'plain':!![]});var _0x48e22b=_0x35ff('0x45');return db['UserProfileSection'][_0x35ff('0x3f')]({'where':{'name':_0x48e22b,'userProfileId':_0x14aa90[_0x35ff('0x46')]},'raw':!![]})[_0x35ff('0x1e')](function(_0x255bdc){if(_0x255bdc&&_0x255bdc[_0x35ff('0x47')]===0x0){return db[_0x35ff('0x48')][_0x35ff('0x40')]({'name':_0x3be5fc[_0x35ff('0x23')],'resourceId':_0x3be5fc['id'],'type':_0x255bdc[_0x35ff('0x23')],'sectionId':_0x255bdc['id']},{})['then'](function(){return _0x2caefe;});}else{return _0x2caefe;}})[_0x35ff('0x3c')](function(_0x39b65f){logger[_0x35ff('0x21')](_0x35ff('0x49'),_0x39b65f);throw _0x39b65f;});}return _0x2caefe;})['then'](respondWithResult(_0x506def,0xc9))['catch'](handleError(_0x506def,null));};exports['update']=function(_0x211bb2,_0x5b410d){if(_0x211bb2[_0x35ff('0x4a')]['id']){delete _0x211bb2['body']['id'];}return db[_0x35ff('0x39')]['find']({'where':{'id':_0x211bb2[_0x35ff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b410d,null))[_0x35ff('0x1e')](saveUpdates(_0x211bb2[_0x35ff('0x4a')],null))[_0x35ff('0x1e')](respondWithResult(_0x5b410d,null))[_0x35ff('0x3c')](handleError(_0x5b410d,null));};exports['destroy']=function(_0x497b38,_0x2be86b){return db['Tag'][_0x35ff('0x3f')]({'where':{'id':_0x497b38[_0x35ff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2be86b,null))[_0x35ff('0x1e')](removeEntity(_0x2be86b,null))['catch'](handleError(_0x2be86b,null));}; \ No newline at end of file +var _0x5636=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','params','options','find','create','body','user','get','role','UserProfileSection','autoAssociation','catch','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','map','Tag','rawAttributes','type','key','model'];(function(_0x573999,_0x1bba15){var _0x36e03e=function(_0xd3b46a){while(--_0xd3b46a){_0x573999['push'](_0x573999['shift']());}};_0x36e03e(++_0x1bba15);}(_0x5636,0x102));var _0x6563=function(_0x48bf5e,_0xc1dfe1){_0x48bf5e=_0x48bf5e-0x0;var _0x548d90=_0x5636[_0x48bf5e];return _0x548d90;};'use strict';var emlformat=require(_0x6563('0x0'));var rimraf=require(_0x6563('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6563('0x2'));var BPromise=require(_0x6563('0x3'));var Mustache=require(_0x6563('0x4'));var util=require('util');var path=require(_0x6563('0x5'));var sox=require(_0x6563('0x6'));var csv=require(_0x6563('0x7'));var ejs=require(_0x6563('0x8'));var fs=require('fs');var fs_extra=require(_0x6563('0x9'));var _=require(_0x6563('0xa'));var squel=require(_0x6563('0xb'));var crypto=require(_0x6563('0xc'));var jsforce=require(_0x6563('0xd'));var deskjs=require(_0x6563('0xe'));var toCsv=require(_0x6563('0x7'));var querystring=require(_0x6563('0xf'));var Papa=require(_0x6563('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6563('0x11'));var as=require(_0x6563('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6563('0x13'));var config=require(_0x6563('0x14'));var licenseUtil=require(_0x6563('0x15'));var db=require(_0x6563('0x16'))['db'];function respondWithStatusCode(_0x33816e,_0x2ed676){_0x2ed676=_0x2ed676||0xcc;return function(_0x31d3fa){if(_0x31d3fa){return _0x33816e[_0x6563('0x17')](_0x2ed676);}return _0x33816e[_0x6563('0x18')](_0x2ed676)['end']();};}function respondWithResult(_0xa0a0b6,_0x5e9329){_0x5e9329=_0x5e9329||0xc8;return function(_0x37131e){if(_0x37131e){return _0xa0a0b6[_0x6563('0x18')](_0x5e9329)[_0x6563('0x19')](_0x37131e);}};}function respondWithFilteredResult(_0x10d08c,_0x5af5d0){return function(_0x26f26e){if(_0x26f26e){var _0x11baa2=typeof _0x5af5d0[_0x6563('0x1a')]===_0x6563('0x1b')&&typeof _0x5af5d0['limit']===_0x6563('0x1b');var _0x589632=_0x26f26e['count'];var _0x47972a=_0x11baa2?0x0:_0x5af5d0[_0x6563('0x1a')];var _0x4f5609=_0x11baa2?_0x26f26e['count']:_0x5af5d0[_0x6563('0x1a')]+_0x5af5d0[_0x6563('0x1c')];var _0x17a29f;if(_0x4f5609>=_0x589632){_0x4f5609=_0x589632;_0x17a29f=0xc8;}else{_0x17a29f=0xce;}_0x10d08c[_0x6563('0x18')](_0x17a29f);return _0x10d08c[_0x6563('0x1d')](_0x6563('0x1e'),_0x47972a+'-'+_0x4f5609+'/'+_0x589632)[_0x6563('0x19')](_0x26f26e);}return null;};}function patchUpdates(_0x93a45){return function(_0x2a70f0){try{jsonpatch['apply'](_0x2a70f0,_0x93a45,!![]);}catch(_0x2f2905){return BPromise[_0x6563('0x1f')](_0x2f2905);}return _0x2a70f0[_0x6563('0x20')]();};}function saveUpdates(_0x5a335c,_0x293db2){return function(_0x5c37bb){if(_0x5c37bb){return _0x5c37bb[_0x6563('0x21')](_0x5a335c)[_0x6563('0x22')](function(_0x5610b0){return _0x5610b0;});}return null;};}function removeEntity(_0x5773e2,_0x3ab7f6){return function(_0x492f45){if(_0x492f45){return _0x492f45[_0x6563('0x23')]()[_0x6563('0x22')](function(){var _0x20d152=_0x492f45['get']({'plain':!![]});var _0xd860d5='Tags';return db[_0x6563('0x24')][_0x6563('0x23')]({'where':{'type':_0xd860d5,'resourceId':_0x20d152['id']}})['then'](function(){return _0x492f45;});})[_0x6563('0x22')](function(){_0x5773e2[_0x6563('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ddb2b,_0x5b03a7){return function(_0x1fe1cb){if(!_0x1fe1cb){_0x2ddb2b['sendStatus'](0x194);}return _0x1fe1cb;};}function handleError(_0x480408,_0x30f05a){_0x30f05a=_0x30f05a||0x1f4;return function(_0x118d31){logger[_0x6563('0x25')](_0x118d31[_0x6563('0x26')]);if(_0x118d31[_0x6563('0x27')]){delete _0x118d31['name'];}_0x480408[_0x6563('0x18')](_0x30f05a)['send'](_0x118d31);};}exports['index']=function(_0x3582c9,_0x35af37){var _0x1e2ecb={},_0xdbbdda={},_0x116605={'count':0x0,'rows':[]};var _0x305861=_[_0x6563('0x28')](db[_0x6563('0x29')][_0x6563('0x2a')],function(_0x246d53){return{'name':_0x246d53['fieldName'],'type':_0x246d53[_0x6563('0x2b')][_0x6563('0x2c')]};});_0xdbbdda[_0x6563('0x2d')]=_[_0x6563('0x28')](_0x305861,_0x6563('0x27'));_0xdbbdda[_0x6563('0x2e')]=_[_0x6563('0x2f')](_0x3582c9['query']);_0xdbbdda[_0x6563('0x30')]=_[_0x6563('0x31')](_0xdbbdda[_0x6563('0x2d')],_0xdbbdda[_0x6563('0x2e')]);_0x1e2ecb[_0x6563('0x32')]=_[_0x6563('0x31')](_0xdbbdda['model'],qs[_0x6563('0x33')](_0x3582c9[_0x6563('0x2e')][_0x6563('0x33')]));_0x1e2ecb[_0x6563('0x32')]=_0x1e2ecb[_0x6563('0x32')][_0x6563('0x34')]?_0x1e2ecb[_0x6563('0x32')]:_0xdbbdda['model'];if(!_0x3582c9[_0x6563('0x2e')][_0x6563('0x35')]('nolimit')){_0x1e2ecb[_0x6563('0x1c')]=qs[_0x6563('0x1c')](_0x3582c9['query']['limit']);_0x1e2ecb[_0x6563('0x1a')]=qs[_0x6563('0x1a')](_0x3582c9[_0x6563('0x2e')][_0x6563('0x1a')]);}_0x1e2ecb['order']=qs[_0x6563('0x36')](_0x3582c9[_0x6563('0x2e')]['sort']);_0x1e2ecb[_0x6563('0x37')]=qs[_0x6563('0x30')](_[_0x6563('0x38')](_0x3582c9[_0x6563('0x2e')],_0xdbbdda[_0x6563('0x30')]),_0x305861);if(_0x3582c9[_0x6563('0x2e')][_0x6563('0x39')]){_0x1e2ecb[_0x6563('0x37')]=_[_0x6563('0x3a')](_0x1e2ecb['where'],{'$or':_[_0x6563('0x28')](_0x305861,function(_0x772286){if(_0x772286[_0x6563('0x2b')]!==_0x6563('0x3b')){var _0x5ebe88={};_0x5ebe88[_0x772286['name']]={'$like':'%'+_0x3582c9[_0x6563('0x2e')][_0x6563('0x39')]+'%'};return _0x5ebe88;}})});}_0x1e2ecb=_[_0x6563('0x3a')]({},_0x1e2ecb,_0x3582c9['options']);var _0x3eadab={'where':_0x1e2ecb['where']};return db[_0x6563('0x29')][_0x6563('0x3c')](_0x3eadab)['then'](function(_0x13d9d9){_0x116605[_0x6563('0x3c')]=_0x13d9d9;if(_0x3582c9[_0x6563('0x2e')][_0x6563('0x3d')]){_0x1e2ecb[_0x6563('0x3e')]=[{'all':!![]}];}return db[_0x6563('0x29')][_0x6563('0x3f')](_0x1e2ecb);})[_0x6563('0x22')](function(_0xd30789){_0x116605[_0x6563('0x40')]=_0xd30789;return _0x116605;})[_0x6563('0x22')](respondWithFilteredResult(_0x35af37,_0x1e2ecb))['catch'](handleError(_0x35af37,null));};exports['show']=function(_0x38eab4,_0x3835f6){var _0x43a33e={'raw':!![],'where':{'id':_0x38eab4[_0x6563('0x41')]['id']}},_0x2f2aa6={};_0x2f2aa6[_0x6563('0x2d')]=_[_0x6563('0x2f')](db['Tag'][_0x6563('0x2a')]);_0x2f2aa6[_0x6563('0x2e')]=_[_0x6563('0x2f')](_0x38eab4[_0x6563('0x2e')]);_0x2f2aa6['filters']=_[_0x6563('0x31')](_0x2f2aa6[_0x6563('0x2d')],_0x2f2aa6[_0x6563('0x2e')]);_0x43a33e[_0x6563('0x32')]=_[_0x6563('0x31')](_0x2f2aa6['model'],qs['fields'](_0x38eab4[_0x6563('0x2e')][_0x6563('0x33')]));_0x43a33e[_0x6563('0x32')]=_0x43a33e['attributes'][_0x6563('0x34')]?_0x43a33e[_0x6563('0x32')]:_0x2f2aa6[_0x6563('0x2d')];if(_0x38eab4[_0x6563('0x2e')]['includeAll']){_0x43a33e[_0x6563('0x3e')]=[{'all':!![]}];}_0x43a33e=_[_0x6563('0x3a')]({},_0x43a33e,_0x38eab4[_0x6563('0x42')]);return db['Tag'][_0x6563('0x43')](_0x43a33e)['then'](handleEntityNotFound(_0x3835f6,null))[_0x6563('0x22')](respondWithResult(_0x3835f6,null))['catch'](handleError(_0x3835f6,null));};exports['create']=function(_0x1ef2da,_0x11617b){return db[_0x6563('0x29')][_0x6563('0x44')](_0x1ef2da[_0x6563('0x45')],{})[_0x6563('0x22')](function(_0x2eb8ee){var _0x16da30=_0x1ef2da[_0x6563('0x46')][_0x6563('0x47')]({'plain':!![]});if(!_0x16da30)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16da30[_0x6563('0x48')]==='user'){var _0x22306a=_0x2eb8ee[_0x6563('0x47')]({'plain':!![]});var _0x19062a='Tags';return db[_0x6563('0x49')][_0x6563('0x43')]({'where':{'name':_0x19062a,'userProfileId':_0x16da30['userProfileId']},'raw':!![]})[_0x6563('0x22')](function(_0x391d23){if(_0x391d23&&_0x391d23[_0x6563('0x4a')]===0x0){return db[_0x6563('0x24')][_0x6563('0x44')]({'name':_0x22306a['name'],'resourceId':_0x22306a['id'],'type':_0x391d23[_0x6563('0x27')],'sectionId':_0x391d23['id']},{})['then'](function(){return _0x2eb8ee;});}else{return _0x2eb8ee;}})[_0x6563('0x4b')](function(_0x5dc3a5){logger[_0x6563('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc3a5);throw _0x5dc3a5;});}return _0x2eb8ee;})['then'](respondWithResult(_0x11617b,0xc9))['catch'](handleError(_0x11617b,null));};exports['update']=function(_0x270667,_0x5ade56){if(_0x270667[_0x6563('0x45')]['id']){delete _0x270667['body']['id'];}return db[_0x6563('0x29')][_0x6563('0x43')]({'where':{'id':_0x270667[_0x6563('0x41')]['id']}})[_0x6563('0x22')](handleEntityNotFound(_0x5ade56,null))[_0x6563('0x22')](saveUpdates(_0x270667[_0x6563('0x45')],null))[_0x6563('0x22')](respondWithResult(_0x5ade56,null))[_0x6563('0x4b')](handleError(_0x5ade56,null));};exports[_0x6563('0x23')]=function(_0x5827da,_0x386ae9){return db[_0x6563('0x29')][_0x6563('0x43')]({'where':{'id':_0x5827da[_0x6563('0x41')]['id']}})[_0x6563('0x22')](handleEntityNotFound(_0x386ae9,null))[_0x6563('0x22')](removeEntity(_0x386ae9,null))[_0x6563('0x4b')](handleError(_0x386ae9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 262d72d..e3c5b91 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 _0x8dcd=['api','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x2baa70,_0x6cec74){var _0x455a00=function(_0x4f9f40){while(--_0x4f9f40){_0x2baa70['push'](_0x2baa70['shift']());}};_0x455a00(++_0x6cec74);}(_0x8dcd,0xce));var _0xd8dc=function(_0x19ed91,_0x561c98){_0x19ed91=_0x19ed91-0x0;var _0x2f50b7=_0x8dcd[_0x19ed91];return _0x2f50b7;};'use strict';var _=require(_0xd8dc('0x0'));var util=require(_0xd8dc('0x1'));var logger=require(_0xd8dc('0x2'))(_0xd8dc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd8dc('0x4'));var config=require(_0xd8dc('0x5'));var attributes=require(_0xd8dc('0x6'));module[_0xd8dc('0x7')]=function(_0x5330f2,_0x581a5c){return _0x5330f2[_0xd8dc('0x8')](_0xd8dc('0x9'),attributes,{'tableName':_0xd8dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4756=['../../config/logger','api','request-promise','define','tools_tags','lodash','util'];(function(_0x1abe65,_0xda94a2){var _0x565802=function(_0x4f265c){while(--_0x4f265c){_0x1abe65['push'](_0x1abe65['shift']());}};_0x565802(++_0xda94a2);}(_0x4756,0xa6));var _0x6475=function(_0x11ec5d,_0x144772){_0x11ec5d=_0x11ec5d-0x0;var _0x45d165=_0x4756[_0x11ec5d];return _0x45d165;};'use strict';var _=require(_0x6475('0x0'));var util=require(_0x6475('0x1'));var logger=require(_0x6475('0x2'))(_0x6475('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6475('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./tag.attributes');module['exports']=function(_0x8d7939,_0x1265a9){return _0x8d7939[_0x6475('0x5')]('Tag',attributes,{'tableName':_0x6475('0x6'),'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 0c6ea83..7b9ed1e 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 _0x9221=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x2d7333,_0x52e151){var _0x2e4005=function(_0x26bbad){while(--_0x26bbad){_0x2d7333['push'](_0x2d7333['shift']());}};_0x2e4005(++_0x52e151);}(_0x9221,0x64));var _0x1922=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0x9221[_0x347471];return _0x422b6a;};'use strict';var _=require('lodash');var util=require(_0x1922('0x0'));var moment=require(_0x1922('0x1'));var BPromise=require('bluebird');var rs=require(_0x1922('0x2'));var fs=require('fs');var Redis=require(_0x1922('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1922('0x4'));var logger=require(_0x1922('0x5'))(_0x1922('0x6'));var config=require(_0x1922('0x7'));var jayson=require(_0x1922('0x8'));var client=jayson[_0x1922('0x9')][_0x1922('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aa05c,_0x116227,_0x3cfd98){return new BPromise(function(_0x195fa4,_0x47c225){return client[_0x1922('0xb')](_0x5aa05c,_0x3cfd98)['then'](function(_0x2b6c51){logger[_0x1922('0xc')](_0x1922('0xd'),_0x116227,'request\x20sent');logger[_0x1922('0xe')](_0x1922('0xf'),_0x116227,'request\x20sent',JSON[_0x1922('0x10')](_0x2b6c51));if(_0x2b6c51['error']){if(_0x2b6c51[_0x1922('0x11')]['code']===0x1f4){logger[_0x1922('0x11')](_0x1922('0xd'),_0x116227,_0x2b6c51[_0x1922('0x11')]['message']);return _0x47c225(_0x2b6c51['error'][_0x1922('0x12')]);}logger[_0x1922('0x11')](_0x1922('0xd'),_0x116227,_0x2b6c51[_0x1922('0x11')][_0x1922('0x12')]);return _0x195fa4(_0x2b6c51['error'][_0x1922('0x12')]);}else{logger['info'](_0x1922('0xd'),_0x116227,_0x1922('0x13'));_0x195fa4(_0x2b6c51[_0x1922('0x14')][_0x1922('0x12')]);}})['catch'](function(_0x459511){logger[_0x1922('0x11')](_0x1922('0xd'),_0x116227,_0x459511);_0x47c225(_0x459511);});});} \ No newline at end of file +var _0x5712=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x5712,0x140));var _0x2571=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5712[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var moment=require(_0x2571('0x2'));var BPromise=require(_0x2571('0x3'));var rs=require(_0x2571('0x4'));var fs=require('fs');var Redis=require(_0x2571('0x5'));var db=require(_0x2571('0x6'))['db'];var utils=require(_0x2571('0x7'));var logger=require(_0x2571('0x8'))(_0x2571('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2571('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e19b2,_0x251ee6,_0x3ca885){return new BPromise(function(_0x204ecc,_0xda659a){return client[_0x2571('0xb')](_0x3e19b2,_0x3ca885)['then'](function(_0x1f0c98){logger['info'](_0x2571('0xc'),_0x251ee6,_0x2571('0xd'));logger[_0x2571('0xe')](_0x2571('0xf'),_0x251ee6,_0x2571('0xd'),JSON[_0x2571('0x10')](_0x1f0c98));if(_0x1f0c98[_0x2571('0x11')]){if(_0x1f0c98[_0x2571('0x11')]['code']===0x1f4){logger['error'](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0xda659a(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0x204ecc(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}else{logger[_0x2571('0x13')]('Tag,\x20%s,\x20%s',_0x251ee6,_0x2571('0xd'));_0x204ecc(_0x1f0c98['result']['message']);}})['catch'](function(_0x4c3e11){logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x4c3e11);_0xda659a(_0x4c3e11);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index aadd2d3..358e558 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_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'));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 d4beedf..4bfb136 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 _0x757a=['exports','STRING'];(function(_0x410124,_0x8d7d47){var _0x5650b7=function(_0x148d69){while(--_0x148d69){_0x410124['push'](_0x410124['shift']());}};_0x5650b7(++_0x8d7d47);}(_0x757a,0xde));var _0xa757=function(_0x18161b,_0x5b8ef1){_0x18161b=_0x18161b-0x0;var _0x5351f3=_0x757a[_0x18161b];return _0x5351f3;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe706,0xa3));var _0x6e70=function(_0x3db0ba,_0x2be65c){_0x3db0ba=_0x3db0ba-0x0;var _0x2d8e9a=_0xe706[_0x3db0ba];return _0x2d8e9a;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 6c2d031..981d999 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 _0x7b62=['SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','Teams','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','length','Queues','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','through','penalty','TeamVoiceQueue','User','emit','QueueId','findAll','online','voicePause','UserVoiceQueueRt','isNil','interface','SIP/%s','all','TeamVoicePrefix','upsert','spread','removeAgents','isArray','Fax','Queue:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','Team','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','rows','catch','show','include','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId'];(function(_0x571421,_0x51d35c){var _0x3727ec=function(_0x1c23ed){while(--_0x1c23ed){_0x571421['push'](_0x571421['shift']());}};_0x3727ec(++_0x51d35c);}(_0x7b62,0x177));var _0x27b6=function(_0x8506df,_0x23a65f){_0x8506df=_0x8506df-0x0;var _0x42f5d7=_0x7b62[_0x8506df];return _0x42f5d7;};'use strict';var emlformat=require(_0x27b6('0x0'));var rimraf=require(_0x27b6('0x1'));var zipdir=require(_0x27b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x27b6('0x3'));var BPromise=require(_0x27b6('0x4'));var Mustache=require(_0x27b6('0x5'));var util=require('util');var path=require(_0x27b6('0x6'));var sox=require(_0x27b6('0x7'));var csv=require(_0x27b6('0x8'));var ejs=require(_0x27b6('0x9'));var fs=require('fs');var fs_extra=require(_0x27b6('0xa'));var _=require('lodash');var squel=require(_0x27b6('0xb'));var crypto=require(_0x27b6('0xc'));var jsforce=require(_0x27b6('0xd'));var deskjs=require(_0x27b6('0xe'));var toCsv=require(_0x27b6('0x8'));var querystring=require(_0x27b6('0xf'));var Papa=require(_0x27b6('0x10'));var Redis=require(_0x27b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x27b6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27b6('0x13'))(_0x27b6('0x14'));var utils=require(_0x27b6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x27b6('0x16'));var db=require('../../mysqldb')['db'];config[_0x27b6('0x17')]=_[_0x27b6('0x18')](config[_0x27b6('0x17')],{'host':_0x27b6('0x19'),'port':0x18eb});var socket=require(_0x27b6('0x1a'))(new Redis(config[_0x27b6('0x17')]));require(_0x27b6('0x1b'))['register'](socket);function respondWithStatusCode(_0xbcb14c,_0x491e47){_0x491e47=_0x491e47||0xcc;return function(_0x56243c){if(_0x56243c){return _0xbcb14c[_0x27b6('0x1c')](_0x491e47);}return _0xbcb14c[_0x27b6('0x1d')](_0x491e47)[_0x27b6('0x1e')]();};}function respondWithResult(_0x4433c7,_0x5d161b){_0x5d161b=_0x5d161b||0xc8;return function(_0x495115){if(_0x495115){return _0x4433c7[_0x27b6('0x1d')](_0x5d161b)[_0x27b6('0x1f')](_0x495115);}};}function respondWithFilteredResult(_0x592e30,_0x62ad18){return function(_0x20d6de){if(_0x20d6de){var _0x148318=typeof _0x62ad18[_0x27b6('0x20')]==='undefined'&&typeof _0x62ad18[_0x27b6('0x21')]===_0x27b6('0x22');var _0x1f3732=_0x20d6de['count'];var _0x14785b=_0x148318?0x0:_0x62ad18[_0x27b6('0x20')];var _0x2faaf9=_0x148318?_0x20d6de[_0x27b6('0x23')]:_0x62ad18[_0x27b6('0x20')]+_0x62ad18[_0x27b6('0x21')];var _0x2133d4;if(_0x2faaf9>=_0x1f3732){_0x2faaf9=_0x1f3732;_0x2133d4=0xc8;}else{_0x2133d4=0xce;}_0x592e30[_0x27b6('0x1d')](_0x2133d4);return _0x592e30[_0x27b6('0x24')](_0x27b6('0x25'),_0x14785b+'-'+_0x2faaf9+'/'+_0x1f3732)[_0x27b6('0x1f')](_0x20d6de);}return null;};}function patchUpdates(_0x10d921){return function(_0x28431e){try{jsonpatch[_0x27b6('0x26')](_0x28431e,_0x10d921,!![]);}catch(_0x40e705){return BPromise[_0x27b6('0x27')](_0x40e705);}return _0x28431e[_0x27b6('0x28')]();};}function saveUpdates(_0x19f319,_0x2c1edb){return function(_0x2dd3f1){if(_0x2dd3f1){return _0x2dd3f1['update'](_0x19f319)[_0x27b6('0x29')](function(_0x271a02){return _0x271a02;});}return null;};}function handleEntityNotFound(_0x4f0ec2,_0x3750b8){return function(_0x1e78a9){if(!_0x1e78a9){_0x4f0ec2[_0x27b6('0x1c')](0x194);}return _0x1e78a9;};}function handleError(_0x57fbc4,_0x4c2044){_0x4c2044=_0x4c2044||0x1f4;return function(_0x41f45f){logger[_0x27b6('0x2a')](_0x41f45f[_0x27b6('0x2b')]);if(_0x41f45f[_0x27b6('0x2c')]){delete _0x41f45f[_0x27b6('0x2c')];}_0x57fbc4[_0x27b6('0x1d')](_0x4c2044)[_0x27b6('0x2d')](_0x41f45f);};}exports['index']=function(_0x541d88,_0x11dc60){var _0x320998={},_0x1fdc74={},_0x87071b={'count':0x0,'rows':[]};var _0x4b5f31=_[_0x27b6('0x2e')](db[_0x27b6('0x2f')][_0x27b6('0x30')],function(_0x4786f8){return{'name':_0x4786f8['fieldName'],'type':_0x4786f8['type'][_0x27b6('0x31')]};});_0x1fdc74[_0x27b6('0x32')]=_['map'](_0x4b5f31,_0x27b6('0x2c'));_0x1fdc74[_0x27b6('0x33')]=_[_0x27b6('0x34')](_0x541d88[_0x27b6('0x33')]);_0x1fdc74['filters']=_[_0x27b6('0x35')](_0x1fdc74[_0x27b6('0x32')],_0x1fdc74[_0x27b6('0x33')]);_0x320998[_0x27b6('0x36')]=_[_0x27b6('0x35')](_0x1fdc74['model'],qs[_0x27b6('0x37')](_0x541d88['query'][_0x27b6('0x37')]));_0x320998[_0x27b6('0x36')]=_0x320998['attributes']['length']?_0x320998['attributes']:_0x1fdc74['model'];if(!_0x541d88[_0x27b6('0x33')][_0x27b6('0x38')](_0x27b6('0x39'))){_0x320998['limit']=qs[_0x27b6('0x21')](_0x541d88[_0x27b6('0x33')][_0x27b6('0x21')]);_0x320998[_0x27b6('0x20')]=qs[_0x27b6('0x20')](_0x541d88[_0x27b6('0x33')]['offset']);}_0x320998[_0x27b6('0x3a')]=qs['sort'](_0x541d88[_0x27b6('0x33')][_0x27b6('0x3b')]);_0x320998[_0x27b6('0x3c')]=qs[_0x27b6('0x3d')](_[_0x27b6('0x3e')](_0x541d88[_0x27b6('0x33')],_0x1fdc74['filters']),_0x4b5f31);if(_0x541d88[_0x27b6('0x33')][_0x27b6('0x3f')]){_0x320998['where']=_['merge'](_0x320998['where'],{'$or':_[_0x27b6('0x2e')](_0x4b5f31,function(_0x50b8a6){if(_0x50b8a6[_0x27b6('0x40')]!==_0x27b6('0x41')){var _0x5bfd4f={};_0x5bfd4f[_0x50b8a6[_0x27b6('0x2c')]]={'$like':'%'+_0x541d88['query']['filter']+'%'};return _0x5bfd4f;}})});}_0x320998=_[_0x27b6('0x42')]({},_0x320998,_0x541d88['options']);var _0xa51380={'where':_0x320998[_0x27b6('0x3c')]};return db[_0x27b6('0x2f')][_0x27b6('0x23')](_0xa51380)[_0x27b6('0x29')](function(_0x1347a1){_0x87071b['count']=_0x1347a1;if(_0x541d88[_0x27b6('0x33')][_0x27b6('0x43')]){_0x320998['include']=[{'all':!![]}];}return db['Team']['findAll'](_0x320998);})[_0x27b6('0x29')](function(_0x2778b2){_0x87071b[_0x27b6('0x44')]=_0x2778b2;return _0x87071b;})[_0x27b6('0x29')](respondWithFilteredResult(_0x11dc60,_0x320998))[_0x27b6('0x45')](handleError(_0x11dc60,null));};exports[_0x27b6('0x46')]=function(_0x42bd95,_0x33a30e){var _0x1511bd={'raw':![],'where':{'id':_0x42bd95['params']['id']}},_0x19af78={};_0x19af78[_0x27b6('0x32')]=_['keys'](db['Team'][_0x27b6('0x30')]);_0x19af78[_0x27b6('0x33')]=_[_0x27b6('0x34')](_0x42bd95[_0x27b6('0x33')]);_0x19af78[_0x27b6('0x3d')]=_['intersection'](_0x19af78[_0x27b6('0x32')],_0x19af78['query']);_0x1511bd[_0x27b6('0x36')]=_[_0x27b6('0x35')](_0x19af78[_0x27b6('0x32')],qs[_0x27b6('0x37')](_0x42bd95['query'][_0x27b6('0x37')]));_0x1511bd[_0x27b6('0x36')]=_0x1511bd['attributes']['length']?_0x1511bd[_0x27b6('0x36')]:_0x19af78[_0x27b6('0x32')];if(_0x42bd95['query']['includeAll']){_0x1511bd[_0x27b6('0x47')]=[{'all':!![]}];}_0x1511bd=_[_0x27b6('0x42')]({},_0x1511bd,_0x42bd95[_0x27b6('0x48')]);return db['Team']['find'](_0x1511bd)[_0x27b6('0x29')](handleEntityNotFound(_0x33a30e,null))[_0x27b6('0x29')](respondWithResult(_0x33a30e,null))[_0x27b6('0x45')](handleError(_0x33a30e,null));};exports[_0x27b6('0x49')]=function(_0x43d929,_0x58f552){return db[_0x27b6('0x2f')][_0x27b6('0x49')](_0x43d929[_0x27b6('0x4a')],{})[_0x27b6('0x29')](function(_0xe4f8ad){var _0x22b392=_0x43d929['user'][_0x27b6('0x4b')]({'plain':!![]});if(!_0x22b392)throw new Error(_0x27b6('0x4c'));if(_0x22b392['role']===_0x27b6('0x4d')){var _0x51c866=_0xe4f8ad[_0x27b6('0x4b')]({'plain':!![]});var _0x13f832='Teams';return db['UserProfileSection'][_0x27b6('0x4e')]({'where':{'name':_0x13f832,'userProfileId':_0x22b392[_0x27b6('0x4f')]},'raw':!![]})[_0x27b6('0x29')](function(_0x5b655d){if(_0x5b655d&&_0x5b655d[_0x27b6('0x50')]===0x0){return db[_0x27b6('0x51')][_0x27b6('0x49')]({'name':_0x51c866[_0x27b6('0x2c')],'resourceId':_0x51c866['id'],'type':_0x5b655d['name'],'sectionId':_0x5b655d['id']},{})['then'](function(){return _0xe4f8ad;});}else{return _0xe4f8ad;}})[_0x27b6('0x45')](function(_0x1aa6b2){logger[_0x27b6('0x2a')](_0x27b6('0x52'),_0x1aa6b2);throw _0x1aa6b2;});}return _0xe4f8ad;})['then'](respondWithResult(_0x58f552,0xc9))['catch'](handleError(_0x58f552,null));};exports['update']=function(_0x52c5fa,_0x4126c4){if(_0x52c5fa['body']['id']){delete _0x52c5fa[_0x27b6('0x4a')]['id'];}return db[_0x27b6('0x2f')][_0x27b6('0x4e')]({'where':{'id':_0x52c5fa[_0x27b6('0x53')]['id']}})[_0x27b6('0x29')](handleEntityNotFound(_0x4126c4,null))[_0x27b6('0x29')](saveUpdates(_0x52c5fa[_0x27b6('0x4a')],null))['then'](respondWithResult(_0x4126c4,null))['catch'](handleError(_0x4126c4,null));};exports['destroy']=function(_0x3c364e,_0x24b9ff){var _0x9d0c44=_0x3c364e[_0x27b6('0x53')]['id'];var _0x52ca54=[];return db[_0x27b6('0x54')][_0x27b6('0x55')](function(_0x1eecf6){var _0x44c6f6=_0x27b6('0x56')+_0x9d0c44;return db[_0x27b6('0x54')][_0x27b6('0x33')](_0x44c6f6,{'type':db['Sequelize'][_0x27b6('0x57')][_0x27b6('0x58')],'raw':!![],'transaction':_0x1eecf6})[_0x27b6('0x29')](function(_0x1928e0){_0x52ca54=_['map'](_0x1928e0,function(_0x3f94fb){return Number(_0x3f94fb[_0x27b6('0x59')]);});})[_0x27b6('0x29')](function(){var _0x1e24d5=_0x27b6('0x5a')+_0x9d0c44;return db[_0x27b6('0x54')][_0x27b6('0x33')](_0x1e24d5,{'type':db[_0x27b6('0x5b')][_0x27b6('0x57')][_0x27b6('0x58')],'raw':!![],'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(_0x5114b8){var _0x9a9cc1=_[_0x27b6('0x2e')](_0x5114b8,function(_0x223d3d){return Number(_0x223d3d['VoiceQueueId']);});return db[_0x27b6('0x5c')][_0x27b6('0x5d')]({'where':{'UserId':{'$in':_0x52ca54},'VoiceQueueId':{'$in':_0x9a9cc1}},'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(){var _0x2f39d0=_0x27b6('0x5e')+_0x9d0c44;return db['sequelize']['query'](_0x2f39d0,{'type':db[_0x27b6('0x5b')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(_0x5434f6){var _0x576f7c=_[_0x27b6('0x2e')](_0x5434f6,function(_0x4517f5){return Number(_0x4517f5[_0x27b6('0x5f')]);});return db[_0x27b6('0x60')]['destroy']({'where':{'UserId':{'$in':_0x52ca54},'MailQueueId':{'$in':_0x576f7c}},'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(){var _0x4556f3=_0x27b6('0x61')+_0x9d0c44;return db[_0x27b6('0x54')][_0x27b6('0x33')](_0x4556f3,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(_0x4442a0){var _0x580790=_[_0x27b6('0x2e')](_0x4442a0,function(_0x2e6b1b){return Number(_0x2e6b1b[_0x27b6('0x62')]);});return db['UserSmsQueue'][_0x27b6('0x5d')]({'where':{'UserId':{'$in':_0x52ca54},'SmsQueueId':{'$in':_0x580790}},'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(){var _0x2b9e6d=_0x27b6('0x63')+_0x9d0c44;return db[_0x27b6('0x54')]['query'](_0x2b9e6d,{'type':db[_0x27b6('0x5b')]['QueryTypes'][_0x27b6('0x58')],'raw':!![],'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(_0x2842ec){var _0x3cd0aa=_[_0x27b6('0x2e')](_0x2842ec,function(_0x387675){return Number(_0x387675['ChatQueueId']);});return db[_0x27b6('0x64')][_0x27b6('0x5d')]({'where':{'UserId':{'$in':_0x52ca54},'ChatQueueId':{'$in':_0x3cd0aa}},'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(){var _0x3c47e6=_0x27b6('0x65')+_0x9d0c44;return db['sequelize'][_0x27b6('0x33')](_0x3c47e6,{'type':db[_0x27b6('0x5b')]['QueryTypes'][_0x27b6('0x58')],'raw':!![],'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(_0x40e4b0){var _0x29a963=_[_0x27b6('0x2e')](_0x40e4b0,function(_0x47ada7){return Number(_0x47ada7['FaxQueueId']);});return db[_0x27b6('0x66')][_0x27b6('0x5d')]({'where':{'UserId':{'$in':_0x52ca54},'FaxQueueId':{'$in':_0x29a963}},'transaction':_0x1eecf6});})['then'](function(){var _0x46989f=_0x27b6('0x67')+_0x9d0c44;return db['sequelize'][_0x27b6('0x33')](_0x46989f,{'type':db[_0x27b6('0x5b')][_0x27b6('0x57')][_0x27b6('0x58')],'raw':!![],'transaction':_0x1eecf6});})['then'](function(_0x4c6129){var _0x3c361c=_[_0x27b6('0x2e')](_0x4c6129,function(_0x59c471){return Number(_0x59c471['OpenchannelQueueId']);});return db[_0x27b6('0x68')][_0x27b6('0x5d')]({'where':{'UserId':{'$in':_0x52ca54},'OpenchannelQueueId':{'$in':_0x3c361c}},'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(){var _0x4b1809=_0x27b6('0x69')+_0x9d0c44;return db[_0x27b6('0x54')][_0x27b6('0x33')](_0x4b1809,{'type':db[_0x27b6('0x5b')][_0x27b6('0x57')]['SELECT'],'raw':!![],'transaction':_0x1eecf6});})['then'](function(_0x876425){var _0x171cfa=_[_0x27b6('0x2e')](_0x876425,function(_0x58fc4a){return Number(_0x58fc4a[_0x27b6('0x6a')]);});return db[_0x27b6('0x6b')][_0x27b6('0x5d')]({'where':{'UserId':{'$in':_0x52ca54},'WhatsappQueueId':{'$in':_0x171cfa}},'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(){return db['TeamVoicePrefix'][_0x27b6('0x4e')]({'where':{'TeamId':_0x9d0c44}});})['then'](function(_0x255fa4){if(_0x255fa4===null){return;}return db[_0x27b6('0x6c')][_0x27b6('0x5d')]({'where':{'UserId':{'$in':_0x52ca54},'VoicePrefixId':_0x255fa4[_0x27b6('0x6d')]},'transaction':_0x1eecf6});})['then'](function(){return db[_0x27b6('0x2f')][_0x27b6('0x5d')]({'where':{'id':_0x9d0c44},'cascade':!![],'transaction':_0x1eecf6});})[_0x27b6('0x29')](function(_0x1fd36e){if(_0x1fd36e===0x0){_0x24b9ff[_0x27b6('0x1c')](0x194);}else{return db[_0x27b6('0x51')][_0x27b6('0x5d')]({'where':{'type':_0x27b6('0x6e'),'resourceId':_0x9d0c44},'cascade':!![],'transaction':_0x1eecf6})[_0x27b6('0x29')](function(){_0x24b9ff[_0x27b6('0x1d')](0xcc)[_0x27b6('0x1e')]();});}})[_0x27b6('0x45')](function(_0xefc230){_0x24b9ff['status'](0x1f4)[_0x27b6('0x2d')](_0xefc230);});});};exports[_0x27b6('0x6f')]=function(_0x4c78d2,_0x5a95ca,_0x307896){return db[_0x27b6('0x2f')][_0x27b6('0x70')]({'where':{'id':_0x4c78d2[_0x27b6('0x53')]['id']}})[_0x27b6('0x29')](handleEntityNotFound(_0x5a95ca,null))[_0x27b6('0x29')](function(_0x4437cb){if(!_0x4c78d2[_0x27b6('0x33')]['channel']||!utils[_0x27b6('0x71')](_0x4c78d2[_0x27b6('0x33')][_0x27b6('0x72')])){throw new db[(_0x27b6('0x5b'))][(_0x27b6('0x73'))](_0x27b6('0x74'));}var _0x5123e1={};var _0x106fef={};_0x106fef[_0x27b6('0x32')]=_['keys'](db[_[_0x27b6('0x75')](_0x4c78d2['query'][_0x27b6('0x72')][_0x27b6('0x76')]())+_0x27b6('0x77')][_0x27b6('0x30')]);_0x106fef[_0x27b6('0x33')]=_[_0x27b6('0x34')](_0x4c78d2[_0x27b6('0x33')]);_0x106fef['filters']=_[_0x27b6('0x35')](_0x106fef['model'],_0x106fef['query']);_0x5123e1['attributes']=_[_0x27b6('0x35')](_0x106fef['model'],qs[_0x27b6('0x37')](_0x4c78d2['query'][_0x27b6('0x37')]));_0x5123e1[_0x27b6('0x36')]=_0x5123e1[_0x27b6('0x36')][_0x27b6('0x78')]?_0x5123e1[_0x27b6('0x36')]:_0x106fef[_0x27b6('0x32')];_0x5123e1['limit']=qs[_0x27b6('0x21')](_0x4c78d2['query'][_0x27b6('0x21')]);_0x5123e1[_0x27b6('0x20')]=qs['offset'](_0x4c78d2[_0x27b6('0x33')][_0x27b6('0x20')]);_0x5123e1[_0x27b6('0x3a')]=qs[_0x27b6('0x3b')](_0x4c78d2[_0x27b6('0x33')][_0x27b6('0x3b')]);_0x5123e1[_0x27b6('0x3c')]=qs[_0x27b6('0x3d')](_[_0x27b6('0x3e')](_0x4c78d2[_0x27b6('0x33')],_0x106fef[_0x27b6('0x3d')]));_0x5123e1=_['merge']({},_0x5123e1,_0x4c78d2[_0x27b6('0x48')]);return _0x4437cb[_0x27b6('0x4b')+_[_0x27b6('0x75')](_0x4c78d2[_0x27b6('0x33')]['channel']['toLowerCase']())+_0x27b6('0x79')](_0x5123e1);})[_0x27b6('0x29')](respondWithResult(_0x5a95ca,null))[_0x27b6('0x45')](handleError(_0x5a95ca,null));};exports['addQueues']=function(_0x2bc47c,_0x2fd793,_0x3505d7){return db[_0x27b6('0x2f')][_0x27b6('0x70')]({'where':{'id':_0x2bc47c[_0x27b6('0x53')]['id']}})['then'](function(_0x334ebb){if(_0x334ebb){if(!_0x2bc47c[_0x27b6('0x4a')][_0x27b6('0x72')]||!utils[_0x27b6('0x71')](_0x2bc47c[_0x27b6('0x4a')][_0x27b6('0x72')])){throw new db['Sequelize'][(_0x27b6('0x73'))]('Unknown\x20channel');}return _0x334ebb[_0x27b6('0x7a')+_['capitalize'](_0x2bc47c['body'][_0x27b6('0x72')][_0x27b6('0x76')]())+_0x27b6('0x79')](_0x2bc47c[_0x27b6('0x4a')][_0x27b6('0x7b')]);}return null;})[_0x27b6('0x29')](handleEntityNotFound(_0x2fd793,null))[_0x27b6('0x29')](respondWithStatusCode(_0x2fd793,null))['catch'](handleError(_0x2fd793,null));};exports[_0x27b6('0x7c')]=function(_0x4830ea,_0x216034,_0x36849b){return db[_0x27b6('0x2f')][_0x27b6('0x70')]({'where':{'id':_0x4830ea[_0x27b6('0x53')]['id']}})[_0x27b6('0x29')](function(_0x4722a8){if(_0x4722a8){if(!_0x4830ea[_0x27b6('0x33')]['channel']||!utils[_0x27b6('0x71')](_0x4830ea[_0x27b6('0x33')][_0x27b6('0x72')])){throw new db['Sequelize'][(_0x27b6('0x73'))](_0x27b6('0x74'));}return _0x4722a8[_0x27b6('0x7d')+_[_0x27b6('0x75')](_0x4830ea[_0x27b6('0x33')][_0x27b6('0x72')]['toLowerCase']())+'Queues'](_0x4830ea['query']['ids']);}return null;})['then'](handleEntityNotFound(_0x216034,null))[_0x27b6('0x29')](respondWithStatusCode(_0x216034,null))[_0x27b6('0x45')](handleError(_0x216034,null));};exports[_0x27b6('0x7e')]=function(_0x56a9d2,_0x54d84a){var _0x2c93fa=_['isArray'](_0x56a9d2[_0x27b6('0x4a')][_0x27b6('0x7b')])?_0x56a9d2['body'][_0x27b6('0x7b')]:[_0x56a9d2[_0x27b6('0x4a')][_0x27b6('0x7b')]];var _0x4450f7=_0x56a9d2[_0x27b6('0x53')]['id'];return db[_0x27b6('0x2f')][_0x27b6('0x4e')]({'where':{'id':_0x4450f7}})['then'](handleEntityNotFound(_0x54d84a,null))[_0x27b6('0x29')](function(_0x42ee84){if(_0x42ee84){var _0x30a9f4=[_0x27b6('0x7f'),_0x27b6('0x80'),_0x27b6('0x81'),_0x27b6('0x82'),'Fax',_0x27b6('0x83'),_0x27b6('0x84')];return db['sequelize'][_0x27b6('0x55')](function(_0x5bebba){var _0x169e0a=_[_0x27b6('0x2e')](_0x30a9f4,function(_0x36ddf2){var _0xd9dd77={'attributes':['id',_0x27b6('0x2c')]};if(_0x36ddf2==='Voice'){_0xd9dd77[_0x27b6('0x85')]={'attributes':[_0x27b6('0x86')]};}return _0x42ee84[_0x27b6('0x4b')+_0x36ddf2+_0x27b6('0x79')](_0xd9dd77)[_0x27b6('0x29')](function(_0x2654d4){var _0x249fc1=_[_0x27b6('0x2e')](_0x2654d4,function(_0x341647){var _0x1738d7=_[_0x27b6('0x2e')](_0x2c93fa,function(_0x235df5){var _0x4277f9={'where':{'UserId':_0x235df5,[_0x36ddf2+'QueueId']:_0x341647['id']},'transaction':_0x5bebba};if(_0x36ddf2===_0x27b6('0x7f')){_0x4277f9[_0x27b6('0x18')]={'penalty':_0x341647[_0x27b6('0x87')][_0x27b6('0x86')]};}return db[_0x27b6('0x88')+_0x36ddf2+_0x27b6('0x77')]['findOrCreate'](_0x4277f9)[_0x27b6('0x29')](function(){socket[_0x27b6('0x89')](_0x27b6('0x4d')+_0x36ddf2+'Queue:save',{'UserId':_0x235df5,[_0x36ddf2+_0x27b6('0x8a')]:_0x341647['id']});if(_0x36ddf2!==_0x27b6('0x7f')){return;}return db[_0x27b6('0x88')][_0x27b6('0x8b')]({'where':{'id':_0x2c93fa,'online':0x1},'attributes':['id',_0x27b6('0x2c'),_0x27b6('0x8c'),_0x27b6('0x8d'),'interface'],'raw':!![]})[_0x27b6('0x29')](function(_0x593d16){var _0x5c251e=_[_0x27b6('0x2e')](_0x593d16,function(_0x5ebd6f){return db[_0x27b6('0x8e')]['upsert']({'membername':_0x5ebd6f[_0x27b6('0x2c')],'UserId':_0x5ebd6f['id'],'queue_name':_0x341647['name'],'VoiceQueueId':_0x341647['id'],'interface':_[_0x27b6('0x8f')](_0x5ebd6f[_0x27b6('0x90')])?util['format'](_0x27b6('0x91'),_0x5ebd6f[_0x27b6('0x2c')]):_0x5ebd6f[_0x27b6('0x90')],'paused':_0x5ebd6f[_0x27b6('0x8d')]||![],'penalty':_0x341647['TeamVoiceQueue'][_0x27b6('0x86')]},{'transaction':_0x5bebba});});return Promise[_0x27b6('0x92')](_0x5c251e);});});});return Promise[_0x27b6('0x92')](_0x1738d7);});return Promise[_0x27b6('0x92')](_0x249fc1);})[_0x27b6('0x29')](function(){return db[_0x27b6('0x93')][_0x27b6('0x70')]({'where':{'teamId':_0x4450f7}})[_0x27b6('0x29')](function(_0x3e329a){if(_0x3e329a){var _0x4b07e7=_[_0x27b6('0x2e')](_0x2c93fa,function(_0xf028e8){db[_0x27b6('0x6c')][_0x27b6('0x94')]({'UserId':_0xf028e8,'VoicePrefixId':_0x3e329a['VoicePrefixId']});});return Promise[_0x27b6('0x92')](_0x4b07e7);}});});});return Promise['all'](_0x169e0a)[_0x27b6('0x29')](function(){return _0x42ee84[_0x27b6('0x7e')](_0x2c93fa,{'transaction':_0x5bebba})[_0x27b6('0x95')](function(_0x444011){return _0x444011;});});});}})[_0x27b6('0x29')](respondWithResult(_0x54d84a,null))[_0x27b6('0x45')](handleError(_0x54d84a,null));};exports[_0x27b6('0x96')]=function(_0x1704a5,_0x3089b7){var _0x53ea27=_[_0x27b6('0x97')](_0x1704a5[_0x27b6('0x33')]['ids'])?_0x1704a5[_0x27b6('0x33')][_0x27b6('0x7b')]:[_0x1704a5[_0x27b6('0x33')][_0x27b6('0x7b')]];var _0x1862c0=_0x1704a5[_0x27b6('0x53')]['id'];return db['Team'][_0x27b6('0x4e')]({'where':{'id':_0x1862c0}})[_0x27b6('0x29')](handleEntityNotFound(_0x3089b7,null))[_0x27b6('0x29')](function(_0x3595f4){if(_0x3595f4){var _0x148c92=[_0x27b6('0x7f'),_0x27b6('0x80'),_0x27b6('0x81'),_0x27b6('0x82'),_0x27b6('0x98'),_0x27b6('0x83'),_0x27b6('0x84')];return db[_0x27b6('0x54')][_0x27b6('0x55')](function(_0xf1e718){var _0x4d5d26=_[_0x27b6('0x2e')](_0x148c92,function(_0x11f1e3){var _0x26c69d={'attributes':['id','name']};return _0x3595f4['get'+_0x11f1e3+'Queues'](_0x26c69d)[_0x27b6('0x29')](function(_0x434239){var _0x11add3=_[_0x27b6('0x2e')](_0x434239,function(_0x2e1d89){return _0x2e1d89[_0x27b6('0x96')](_0x53ea27,{'transaction':_0xf1e718})[_0x27b6('0x29')](function(){var _0x839c0a=_['map'](_0x53ea27,function(_0x4e66fa){socket[_0x27b6('0x89')](_0x27b6('0x4d')+_0x11f1e3+_0x27b6('0x99'),{'UserId':Number(_0x4e66fa),[_0x11f1e3+'QueueId']:_0x2e1d89['id']});if(_0x11f1e3!==_0x27b6('0x7f')){return;}return db[_0x27b6('0x8e')][_0x27b6('0x5d')]({'where':{'VoiceQueueId':_0x2e1d89['id'],'UserId':_0x4e66fa},'transaction':_0xf1e718});});return Promise[_0x27b6('0x92')](_0x839c0a);});});return Promise['all'](_0x11add3);});});return Promise[_0x27b6('0x92')](_0x4d5d26)[_0x27b6('0x29')](function(){return _0x3595f4['removeAgents'](_0x53ea27,{'transaction':_0xf1e718});})[_0x27b6('0x29')](function(){return db[_0x27b6('0x93')]['findOne']({'where':{'teamId':_0x1862c0}})['then'](function(_0x5001e7){if(_0x5001e7){var _0x4610de=_[_0x27b6('0x2e')](_0x53ea27,function(_0x824454){db['UserVoicePrefix'][_0x27b6('0x5d')]({'where':{'UserId':_0x824454,'VoicePrefixId':_0x5001e7[_0x27b6('0x6d')]}});});return Promise[_0x27b6('0x92')](_0x4610de);}});});});}})[_0x27b6('0x29')](respondWithStatusCode(_0x3089b7,null))[_0x27b6('0x45')](handleError(_0x3089b7,null));};exports[_0x27b6('0x9a')]=function(_0x590a2f,_0x335923,_0x990645){var _0x13de0c={};var _0x34e867={};var _0x5c4af7;var _0x3c1043;return db['Team'][_0x27b6('0x70')]({'where':{'id':_0x590a2f[_0x27b6('0x53')]['id']}})[_0x27b6('0x29')](handleEntityNotFound(_0x335923,null))[_0x27b6('0x29')](function(_0x544bb5){if(_0x544bb5){_0x5c4af7=_0x544bb5;_0x34e867[_0x27b6('0x32')]=_[_0x27b6('0x34')](db[_0x27b6('0x88')]['rawAttributes']);_0x34e867[_0x27b6('0x33')]=_[_0x27b6('0x34')](_0x590a2f[_0x27b6('0x33')]);_0x34e867[_0x27b6('0x3d')]=_[_0x27b6('0x35')](_0x34e867['model'],_0x34e867[_0x27b6('0x33')]);_0x13de0c[_0x27b6('0x36')]=_[_0x27b6('0x35')](_0x34e867[_0x27b6('0x32')],qs[_0x27b6('0x37')](_0x590a2f[_0x27b6('0x33')][_0x27b6('0x37')]));_0x13de0c[_0x27b6('0x36')]=_0x13de0c[_0x27b6('0x36')][_0x27b6('0x78')]?_0x13de0c[_0x27b6('0x36')]:_0x34e867[_0x27b6('0x32')];_0x13de0c[_0x27b6('0x3a')]=qs[_0x27b6('0x3b')](_0x590a2f['query'][_0x27b6('0x3b')]);_0x13de0c[_0x27b6('0x3c')]=qs[_0x27b6('0x3d')](_['pick'](_0x590a2f['query'],_0x34e867[_0x27b6('0x3d')]));if(_0x590a2f[_0x27b6('0x33')][_0x27b6('0x3f')]){_0x13de0c[_0x27b6('0x3c')]=_[_0x27b6('0x42')](_0x13de0c[_0x27b6('0x3c')],{'$or':_[_0x27b6('0x2e')](_0x13de0c[_0x27b6('0x36')],function(_0xb43a62){var _0x48923c={};_0x48923c[_0xb43a62]={'$like':'%'+_0x590a2f[_0x27b6('0x33')][_0x27b6('0x3f')]+'%'};return _0x48923c;})});}_0x13de0c=_[_0x27b6('0x42')]({},_0x13de0c,_0x590a2f[_0x27b6('0x48')]);return _0x5c4af7[_0x27b6('0x9a')](_0x13de0c);}})[_0x27b6('0x29')](function(_0x58f18a){if(_0x58f18a){_0x3c1043=_0x58f18a[_0x27b6('0x78')];if(!_0x590a2f[_0x27b6('0x33')][_0x27b6('0x38')]('nolimit')){_0x13de0c[_0x27b6('0x21')]=qs[_0x27b6('0x21')](_0x590a2f['query']['limit']);_0x13de0c[_0x27b6('0x20')]=qs[_0x27b6('0x20')](_0x590a2f[_0x27b6('0x33')]['offset']);}return _0x5c4af7[_0x27b6('0x9a')](_0x13de0c);}})[_0x27b6('0x29')](function(_0x203fa7){if(_0x203fa7){return _0x203fa7?{'count':_0x3c1043,'rows':_0x203fa7}:null;}})['then'](respondWithResult(_0x335923,null))[_0x27b6('0x45')](handleError(_0x335923,null));}; \ No newline at end of file +var _0x91af=['defaults','TeamVoiceQueue','penalty','User','Queue','Queue:save','online','voicePause','interface','upsert','format','all','removeAgents','Mail','Whatsapp','emit','Queue:remove','QueueId','UserVoiceQueueRt','getAgents','nolimit','eml-format','rimraf','zip-dir','moment','bluebird','mustache','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','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','name','index','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL','options','Team','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','QueryTypes','map','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','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','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','UserProfileResource','Teams','end','send','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','sort','Queues','addQueues','ValidationError','add','ids','removeQueues','remove','addAgents','isArray','Chat','Sms','Fax','Openchannel','Voice','through'];(function(_0x24708d,_0x51b797){var _0x2d625e=function(_0x16883f){while(--_0x16883f){_0x24708d['push'](_0x24708d['shift']());}};_0x2d625e(++_0x51b797);}(_0x91af,0xb4));var _0xf91a=function(_0x29946c,_0x1c3766){_0x29946c=_0x29946c-0x0;var _0x3e6b33=_0x91af[_0x29946c];return _0x3e6b33;};'use strict';var emlformat=require(_0xf91a('0x0'));var rimraf=require(_0xf91a('0x1'));var zipdir=require(_0xf91a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf91a('0x3'));var BPromise=require(_0xf91a('0x4'));var Mustache=require(_0xf91a('0x5'));var util=require('util');var path=require(_0xf91a('0x6'));var sox=require(_0xf91a('0x7'));var csv=require(_0xf91a('0x8'));var ejs=require(_0xf91a('0x9'));var fs=require('fs');var fs_extra=require(_0xf91a('0xa'));var _=require(_0xf91a('0xb'));var squel=require(_0xf91a('0xc'));var crypto=require(_0xf91a('0xd'));var jsforce=require(_0xf91a('0xe'));var deskjs=require(_0xf91a('0xf'));var toCsv=require(_0xf91a('0x8'));var querystring=require(_0xf91a('0x10'));var Papa=require(_0xf91a('0x11'));var Redis=require(_0xf91a('0x12'));var authService=require(_0xf91a('0x13'));var qs=require(_0xf91a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf91a('0x15'));var logger=require('../../config/logger')(_0xf91a('0x16'));var utils=require('../../config/utils');var config=require(_0xf91a('0x17'));var licenseUtil=require(_0xf91a('0x18'));var db=require(_0xf91a('0x19'))['db'];config[_0xf91a('0x1a')]=_['defaults'](config[_0xf91a('0x1a')],{'host':_0xf91a('0x1b'),'port':0x18eb});var socket=require(_0xf91a('0x1c'))(new Redis(config['redis']));require(_0xf91a('0x1d'))[_0xf91a('0x1e')](socket);function respondWithStatusCode(_0x419512,_0x2a516e){_0x2a516e=_0x2a516e||0xcc;return function(_0x56cb15){if(_0x56cb15){return _0x419512[_0xf91a('0x1f')](_0x2a516e);}return _0x419512[_0xf91a('0x20')](_0x2a516e)['end']();};}function respondWithResult(_0x5d2f54,_0x4fa736){_0x4fa736=_0x4fa736||0xc8;return function(_0x4e7731){if(_0x4e7731){return _0x5d2f54[_0xf91a('0x20')](_0x4fa736)[_0xf91a('0x21')](_0x4e7731);}};}function respondWithFilteredResult(_0xd6fd15,_0x145bd7){return function(_0x46481b){if(_0x46481b){var _0x42280a=typeof _0x145bd7[_0xf91a('0x22')]===_0xf91a('0x23')&&typeof _0x145bd7[_0xf91a('0x24')]==='undefined';var _0x416f13=_0x46481b[_0xf91a('0x25')];var _0x14b1c5=_0x42280a?0x0:_0x145bd7[_0xf91a('0x22')];var _0x4d69eb=_0x42280a?_0x46481b[_0xf91a('0x25')]:_0x145bd7[_0xf91a('0x22')]+_0x145bd7['limit'];var _0x3b989f;if(_0x4d69eb>=_0x416f13){_0x4d69eb=_0x416f13;_0x3b989f=0xc8;}else{_0x3b989f=0xce;}_0xd6fd15['status'](_0x3b989f);return _0xd6fd15[_0xf91a('0x26')](_0xf91a('0x27'),_0x14b1c5+'-'+_0x4d69eb+'/'+_0x416f13)[_0xf91a('0x21')](_0x46481b);}return null;};}function patchUpdates(_0x1e5865){return function(_0x4abdd2){try{jsonpatch[_0xf91a('0x28')](_0x4abdd2,_0x1e5865,!![]);}catch(_0xa765b7){return BPromise['reject'](_0xa765b7);}return _0x4abdd2['save']();};}function saveUpdates(_0x19d673,_0x5d28d0){return function(_0x126267){if(_0x126267){return _0x126267[_0xf91a('0x29')](_0x19d673)[_0xf91a('0x2a')](function(_0x28f93f){return _0x28f93f;});}return null;};}function handleEntityNotFound(_0x2a3cbd,_0x37207a){return function(_0x57df4b){if(!_0x57df4b){_0x2a3cbd['sendStatus'](0x194);}return _0x57df4b;};}function handleError(_0x103917,_0x2649b7){_0x2649b7=_0x2649b7||0x1f4;return function(_0x3e45cd){logger[_0xf91a('0x2b')](_0x3e45cd['stack']);if(_0x3e45cd['name']){delete _0x3e45cd[_0xf91a('0x2c')];}_0x103917[_0xf91a('0x20')](_0x2649b7)['send'](_0x3e45cd);};}exports[_0xf91a('0x2d')]=function(_0x3dad4c,_0x45b1ec){var _0x21fa17={},_0xc29b96={},_0x4db8af={'count':0x0,'rows':[]};var _0x2e47eb=_['map'](db['Team'][_0xf91a('0x2e')],function(_0x555c7b){return{'name':_0x555c7b[_0xf91a('0x2f')],'type':_0x555c7b[_0xf91a('0x30')]['key']};});_0xc29b96['model']=_['map'](_0x2e47eb,'name');_0xc29b96[_0xf91a('0x31')]=_[_0xf91a('0x32')](_0x3dad4c['query']);_0xc29b96[_0xf91a('0x33')]=_[_0xf91a('0x34')](_0xc29b96[_0xf91a('0x35')],_0xc29b96['query']);_0x21fa17['attributes']=_[_0xf91a('0x34')](_0xc29b96[_0xf91a('0x35')],qs[_0xf91a('0x36')](_0x3dad4c[_0xf91a('0x31')][_0xf91a('0x36')]));_0x21fa17[_0xf91a('0x37')]=_0x21fa17[_0xf91a('0x37')][_0xf91a('0x38')]?_0x21fa17['attributes']:_0xc29b96[_0xf91a('0x35')];if(!_0x3dad4c['query'][_0xf91a('0x39')]('nolimit')){_0x21fa17[_0xf91a('0x24')]=qs['limit'](_0x3dad4c[_0xf91a('0x31')][_0xf91a('0x24')]);_0x21fa17['offset']=qs[_0xf91a('0x22')](_0x3dad4c[_0xf91a('0x31')][_0xf91a('0x22')]);}_0x21fa17[_0xf91a('0x3a')]=qs['sort'](_0x3dad4c[_0xf91a('0x31')]['sort']);_0x21fa17['where']=qs[_0xf91a('0x33')](_[_0xf91a('0x3b')](_0x3dad4c[_0xf91a('0x31')],_0xc29b96[_0xf91a('0x33')]),_0x2e47eb);if(_0x3dad4c[_0xf91a('0x31')][_0xf91a('0x3c')]){_0x21fa17[_0xf91a('0x3d')]=_[_0xf91a('0x3e')](_0x21fa17['where'],{'$or':_['map'](_0x2e47eb,function(_0x4091d0){if(_0x4091d0[_0xf91a('0x30')]!==_0xf91a('0x3f')){var _0x172b81={};_0x172b81[_0x4091d0[_0xf91a('0x2c')]]={'$like':'%'+_0x3dad4c[_0xf91a('0x31')][_0xf91a('0x3c')]+'%'};return _0x172b81;}})});}_0x21fa17=_['merge']({},_0x21fa17,_0x3dad4c[_0xf91a('0x40')]);var _0xe12307={'where':_0x21fa17[_0xf91a('0x3d')]};return db[_0xf91a('0x41')]['count'](_0xe12307)['then'](function(_0x19edae){_0x4db8af[_0xf91a('0x25')]=_0x19edae;if(_0x3dad4c[_0xf91a('0x31')][_0xf91a('0x42')]){_0x21fa17[_0xf91a('0x43')]=[{'all':!![]}];}return db['Team'][_0xf91a('0x44')](_0x21fa17);})[_0xf91a('0x2a')](function(_0x13005b){_0x4db8af['rows']=_0x13005b;return _0x4db8af;})['then'](respondWithFilteredResult(_0x45b1ec,_0x21fa17))[_0xf91a('0x45')](handleError(_0x45b1ec,null));};exports[_0xf91a('0x46')]=function(_0x556354,_0x1a6558){var _0x21cf3d={'raw':![],'where':{'id':_0x556354[_0xf91a('0x47')]['id']}},_0x392c69={};_0x392c69[_0xf91a('0x35')]=_[_0xf91a('0x32')](db[_0xf91a('0x41')][_0xf91a('0x2e')]);_0x392c69[_0xf91a('0x31')]=_[_0xf91a('0x32')](_0x556354[_0xf91a('0x31')]);_0x392c69[_0xf91a('0x33')]=_[_0xf91a('0x34')](_0x392c69[_0xf91a('0x35')],_0x392c69[_0xf91a('0x31')]);_0x21cf3d[_0xf91a('0x37')]=_['intersection'](_0x392c69[_0xf91a('0x35')],qs[_0xf91a('0x36')](_0x556354[_0xf91a('0x31')][_0xf91a('0x36')]));_0x21cf3d[_0xf91a('0x37')]=_0x21cf3d[_0xf91a('0x37')]['length']?_0x21cf3d[_0xf91a('0x37')]:_0x392c69[_0xf91a('0x35')];if(_0x556354[_0xf91a('0x31')]['includeAll']){_0x21cf3d[_0xf91a('0x43')]=[{'all':!![]}];}_0x21cf3d=_[_0xf91a('0x3e')]({},_0x21cf3d,_0x556354[_0xf91a('0x40')]);return db[_0xf91a('0x41')][_0xf91a('0x48')](_0x21cf3d)[_0xf91a('0x2a')](handleEntityNotFound(_0x1a6558,null))[_0xf91a('0x2a')](respondWithResult(_0x1a6558,null))[_0xf91a('0x45')](handleError(_0x1a6558,null));};exports[_0xf91a('0x49')]=function(_0x49a930,_0x90fc12){return db[_0xf91a('0x41')][_0xf91a('0x49')](_0x49a930[_0xf91a('0x4a')],{})['then'](function(_0x45f069){var _0x3b7b57=_0x49a930[_0xf91a('0x4b')]['get']({'plain':!![]});if(!_0x3b7b57)throw new Error(_0xf91a('0x4c'));if(_0x3b7b57[_0xf91a('0x4d')]==='user'){var _0x105e9f=_0x45f069[_0xf91a('0x4e')]({'plain':!![]});var _0x4dbdfc='Teams';return db[_0xf91a('0x4f')][_0xf91a('0x48')]({'where':{'name':_0x4dbdfc,'userProfileId':_0x3b7b57['userProfileId']},'raw':!![]})[_0xf91a('0x2a')](function(_0x573548){if(_0x573548&&_0x573548[_0xf91a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x105e9f[_0xf91a('0x2c')],'resourceId':_0x105e9f['id'],'type':_0x573548[_0xf91a('0x2c')],'sectionId':_0x573548['id']},{})[_0xf91a('0x2a')](function(){return _0x45f069;});}else{return _0x45f069;}})[_0xf91a('0x45')](function(_0x34f71e){logger['error'](_0xf91a('0x51'),_0x34f71e);throw _0x34f71e;});}return _0x45f069;})[_0xf91a('0x2a')](respondWithResult(_0x90fc12,0xc9))[_0xf91a('0x45')](handleError(_0x90fc12,null));};exports[_0xf91a('0x29')]=function(_0x507ac5,_0x3f1490){if(_0x507ac5[_0xf91a('0x4a')]['id']){delete _0x507ac5[_0xf91a('0x4a')]['id'];}return db[_0xf91a('0x41')][_0xf91a('0x48')]({'where':{'id':_0x507ac5[_0xf91a('0x47')]['id']}})[_0xf91a('0x2a')](handleEntityNotFound(_0x3f1490,null))[_0xf91a('0x2a')](saveUpdates(_0x507ac5[_0xf91a('0x4a')],null))[_0xf91a('0x2a')](respondWithResult(_0x3f1490,null))['catch'](handleError(_0x3f1490,null));};exports[_0xf91a('0x52')]=function(_0x6c7350,_0x3e7ccc){var _0x23957c=_0x6c7350['params']['id'];var _0xdf7b8e=[];return db[_0xf91a('0x53')][_0xf91a('0x54')](function(_0x58f6dc){var _0x49f61e='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x23957c;return db['sequelize']['query'](_0x49f61e,{'type':db['Sequelize'][_0xf91a('0x55')]['SELECT'],'raw':!![],'transaction':_0x58f6dc})[_0xf91a('0x2a')](function(_0x1bbc9a){_0xdf7b8e=_[_0xf91a('0x56')](_0x1bbc9a,function(_0x5b9d06){return Number(_0x5b9d06[_0xf91a('0x57')]);});})['then'](function(){var _0x21b482=_0xf91a('0x58')+_0x23957c;return db[_0xf91a('0x53')][_0xf91a('0x31')](_0x21b482,{'type':db[_0xf91a('0x59')][_0xf91a('0x55')]['SELECT'],'raw':!![],'transaction':_0x58f6dc});})['then'](function(_0x5efc6b){var _0x195810=_['map'](_0x5efc6b,function(_0x3139d0){return Number(_0x3139d0['VoiceQueueId']);});return db[_0xf91a('0x5a')][_0xf91a('0x52')]({'where':{'UserId':{'$in':_0xdf7b8e},'VoiceQueueId':{'$in':_0x195810}},'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(){var _0x4bde20=_0xf91a('0x5b')+_0x23957c;return db[_0xf91a('0x53')]['query'](_0x4bde20,{'type':db[_0xf91a('0x59')]['QueryTypes'][_0xf91a('0x5c')],'raw':!![],'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(_0x1d056d){var _0x2beb3c=_['map'](_0x1d056d,function(_0x511ccf){return Number(_0x511ccf[_0xf91a('0x5d')]);});return db[_0xf91a('0x5e')]['destroy']({'where':{'UserId':{'$in':_0xdf7b8e},'MailQueueId':{'$in':_0x2beb3c}},'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(){var _0x4f42c0=_0xf91a('0x5f')+_0x23957c;return db[_0xf91a('0x53')][_0xf91a('0x31')](_0x4f42c0,{'type':db['Sequelize'][_0xf91a('0x55')][_0xf91a('0x5c')],'raw':!![],'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(_0x300852){var _0x27c48b=_['map'](_0x300852,function(_0x4450ef){return Number(_0x4450ef[_0xf91a('0x60')]);});return db[_0xf91a('0x61')][_0xf91a('0x52')]({'where':{'UserId':{'$in':_0xdf7b8e},'SmsQueueId':{'$in':_0x27c48b}},'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(){var _0x3a67f4=_0xf91a('0x62')+_0x23957c;return db[_0xf91a('0x53')]['query'](_0x3a67f4,{'type':db[_0xf91a('0x59')][_0xf91a('0x55')][_0xf91a('0x5c')],'raw':!![],'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(_0x514981){var _0x361c69=_['map'](_0x514981,function(_0x2a78d5){return Number(_0x2a78d5[_0xf91a('0x63')]);});return db[_0xf91a('0x64')]['destroy']({'where':{'UserId':{'$in':_0xdf7b8e},'ChatQueueId':{'$in':_0x361c69}},'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(){var _0x2b305b=_0xf91a('0x65')+_0x23957c;return db[_0xf91a('0x53')][_0xf91a('0x31')](_0x2b305b,{'type':db[_0xf91a('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(_0x258106){var _0x293188=_[_0xf91a('0x56')](_0x258106,function(_0x57f0cb){return Number(_0x57f0cb[_0xf91a('0x66')]);});return db[_0xf91a('0x67')][_0xf91a('0x52')]({'where':{'UserId':{'$in':_0xdf7b8e},'FaxQueueId':{'$in':_0x293188}},'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(){var _0x28ce6a=_0xf91a('0x68')+_0x23957c;return db[_0xf91a('0x53')][_0xf91a('0x31')](_0x28ce6a,{'type':db[_0xf91a('0x59')][_0xf91a('0x55')][_0xf91a('0x5c')],'raw':!![],'transaction':_0x58f6dc});})['then'](function(_0xcf3941){var _0x486857=_['map'](_0xcf3941,function(_0x24dda5){return Number(_0x24dda5[_0xf91a('0x69')]);});return db['UserOpenchannelQueue'][_0xf91a('0x52')]({'where':{'UserId':{'$in':_0xdf7b8e},'OpenchannelQueueId':{'$in':_0x486857}},'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(){var _0x1bef5e=_0xf91a('0x6a')+_0x23957c;return db[_0xf91a('0x53')][_0xf91a('0x31')](_0x1bef5e,{'type':db[_0xf91a('0x59')][_0xf91a('0x55')][_0xf91a('0x5c')],'raw':!![],'transaction':_0x58f6dc});})['then'](function(_0x1976c9){var _0x57f7bf=_[_0xf91a('0x56')](_0x1976c9,function(_0x30f28b){return Number(_0x30f28b[_0xf91a('0x6b')]);});return db[_0xf91a('0x6c')]['destroy']({'where':{'UserId':{'$in':_0xdf7b8e},'WhatsappQueueId':{'$in':_0x57f7bf}},'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(){return db[_0xf91a('0x6d')][_0xf91a('0x48')]({'where':{'TeamId':_0x23957c}});})[_0xf91a('0x2a')](function(_0xc1f4e7){if(_0xc1f4e7===null){return;}return db[_0xf91a('0x6e')][_0xf91a('0x52')]({'where':{'UserId':{'$in':_0xdf7b8e},'VoicePrefixId':_0xc1f4e7['VoicePrefixId']},'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(){return db['Team'][_0xf91a('0x52')]({'where':{'id':_0x23957c},'cascade':!![],'transaction':_0x58f6dc});})[_0xf91a('0x2a')](function(_0x5a8347){if(_0x5a8347===0x0){_0x3e7ccc[_0xf91a('0x1f')](0x194);}else{return db[_0xf91a('0x6f')]['destroy']({'where':{'type':_0xf91a('0x70'),'resourceId':_0x23957c},'cascade':!![],'transaction':_0x58f6dc})[_0xf91a('0x2a')](function(){_0x3e7ccc[_0xf91a('0x20')](0xcc)[_0xf91a('0x71')]();});}})['catch'](function(_0x2f98b5){_0x3e7ccc[_0xf91a('0x20')](0x1f4)[_0xf91a('0x72')](_0x2f98b5);});});};exports[_0xf91a('0x73')]=function(_0x362ebe,_0x5a9a16,_0x261fe9){return db[_0xf91a('0x41')][_0xf91a('0x74')]({'where':{'id':_0x362ebe[_0xf91a('0x47')]['id']}})[_0xf91a('0x2a')](handleEntityNotFound(_0x5a9a16,null))['then'](function(_0x5aedff){if(!_0x362ebe[_0xf91a('0x31')][_0xf91a('0x75')]||!utils[_0xf91a('0x76')](_0x362ebe[_0xf91a('0x31')][_0xf91a('0x75')])){throw new db['Sequelize']['ValidationError'](_0xf91a('0x77'));}var _0x5f0338={};var _0x220b31={};_0x220b31[_0xf91a('0x35')]=_[_0xf91a('0x32')](db[_[_0xf91a('0x78')](_0x362ebe['query'][_0xf91a('0x75')][_0xf91a('0x79')]())+'Queue'][_0xf91a('0x2e')]);_0x220b31[_0xf91a('0x31')]=_[_0xf91a('0x32')](_0x362ebe[_0xf91a('0x31')]);_0x220b31[_0xf91a('0x33')]=_[_0xf91a('0x34')](_0x220b31[_0xf91a('0x35')],_0x220b31[_0xf91a('0x31')]);_0x5f0338['attributes']=_[_0xf91a('0x34')](_0x220b31['model'],qs[_0xf91a('0x36')](_0x362ebe[_0xf91a('0x31')][_0xf91a('0x36')]));_0x5f0338[_0xf91a('0x37')]=_0x5f0338['attributes'][_0xf91a('0x38')]?_0x5f0338['attributes']:_0x220b31['model'];_0x5f0338[_0xf91a('0x24')]=qs[_0xf91a('0x24')](_0x362ebe[_0xf91a('0x31')][_0xf91a('0x24')]);_0x5f0338['offset']=qs[_0xf91a('0x22')](_0x362ebe[_0xf91a('0x31')][_0xf91a('0x22')]);_0x5f0338[_0xf91a('0x3a')]=qs[_0xf91a('0x7a')](_0x362ebe[_0xf91a('0x31')]['sort']);_0x5f0338[_0xf91a('0x3d')]=qs['filters'](_['pick'](_0x362ebe[_0xf91a('0x31')],_0x220b31['filters']));_0x5f0338=_[_0xf91a('0x3e')]({},_0x5f0338,_0x362ebe[_0xf91a('0x40')]);return _0x5aedff['get'+_[_0xf91a('0x78')](_0x362ebe['query'][_0xf91a('0x75')][_0xf91a('0x79')]())+_0xf91a('0x7b')](_0x5f0338);})[_0xf91a('0x2a')](respondWithResult(_0x5a9a16,null))[_0xf91a('0x45')](handleError(_0x5a9a16,null));};exports[_0xf91a('0x7c')]=function(_0x312606,_0x2304f7,_0x5f2096){return db[_0xf91a('0x41')][_0xf91a('0x74')]({'where':{'id':_0x312606[_0xf91a('0x47')]['id']}})['then'](function(_0xecf688){if(_0xecf688){if(!_0x312606[_0xf91a('0x4a')][_0xf91a('0x75')]||!utils[_0xf91a('0x76')](_0x312606[_0xf91a('0x4a')]['channel'])){throw new db[(_0xf91a('0x59'))][(_0xf91a('0x7d'))](_0xf91a('0x77'));}return _0xecf688[_0xf91a('0x7e')+_['capitalize'](_0x312606[_0xf91a('0x4a')]['channel']['toLowerCase']())+_0xf91a('0x7b')](_0x312606[_0xf91a('0x4a')][_0xf91a('0x7f')]);}return null;})['then'](handleEntityNotFound(_0x2304f7,null))[_0xf91a('0x2a')](respondWithStatusCode(_0x2304f7,null))[_0xf91a('0x45')](handleError(_0x2304f7,null));};exports[_0xf91a('0x80')]=function(_0x48fcd3,_0x2122b6,_0x149436){return db['Team']['findOne']({'where':{'id':_0x48fcd3[_0xf91a('0x47')]['id']}})['then'](function(_0x209f8c){if(_0x209f8c){if(!_0x48fcd3['query'][_0xf91a('0x75')]||!utils[_0xf91a('0x76')](_0x48fcd3['query'][_0xf91a('0x75')])){throw new db['Sequelize'][(_0xf91a('0x7d'))](_0xf91a('0x77'));}return _0x209f8c[_0xf91a('0x81')+_[_0xf91a('0x78')](_0x48fcd3[_0xf91a('0x31')][_0xf91a('0x75')][_0xf91a('0x79')]())+_0xf91a('0x7b')](_0x48fcd3[_0xf91a('0x31')][_0xf91a('0x7f')]);}return null;})['then'](handleEntityNotFound(_0x2122b6,null))['then'](respondWithStatusCode(_0x2122b6,null))['catch'](handleError(_0x2122b6,null));};exports[_0xf91a('0x82')]=function(_0x1a6bd2,_0x4c50e7){var _0x16f76b=_[_0xf91a('0x83')](_0x1a6bd2['body'][_0xf91a('0x7f')])?_0x1a6bd2[_0xf91a('0x4a')][_0xf91a('0x7f')]:[_0x1a6bd2['body']['ids']];var _0x1a02bf=_0x1a6bd2[_0xf91a('0x47')]['id'];return db[_0xf91a('0x41')][_0xf91a('0x48')]({'where':{'id':_0x1a02bf}})[_0xf91a('0x2a')](handleEntityNotFound(_0x4c50e7,null))[_0xf91a('0x2a')](function(_0x116b10){if(_0x116b10){var _0x2bcb36=['Voice',_0xf91a('0x84'),'Mail',_0xf91a('0x85'),_0xf91a('0x86'),_0xf91a('0x87'),'Whatsapp'];return db['sequelize'][_0xf91a('0x54')](function(_0x227514){var _0x166882=_['map'](_0x2bcb36,function(_0xc07cad){var _0x364395={'attributes':['id','name']};if(_0xc07cad===_0xf91a('0x88')){_0x364395[_0xf91a('0x89')]={'attributes':['penalty']};}return _0x116b10['get'+_0xc07cad+'Queues'](_0x364395)[_0xf91a('0x2a')](function(_0x574b30){var _0x561d94=_[_0xf91a('0x56')](_0x574b30,function(_0xa043a4){var _0x5be84a=_[_0xf91a('0x56')](_0x16f76b,function(_0x18d58c){var _0x4c314c={'where':{'UserId':_0x18d58c,[_0xc07cad+'QueueId']:_0xa043a4['id']},'transaction':_0x227514};if(_0xc07cad===_0xf91a('0x88')){_0x4c314c[_0xf91a('0x8a')]={'penalty':_0xa043a4[_0xf91a('0x8b')][_0xf91a('0x8c')]};}return db[_0xf91a('0x8d')+_0xc07cad+_0xf91a('0x8e')]['findOrCreate'](_0x4c314c)[_0xf91a('0x2a')](function(){socket['emit'](_0xf91a('0x4b')+_0xc07cad+_0xf91a('0x8f'),{'UserId':_0x18d58c,[_0xc07cad+'QueueId']:_0xa043a4['id']});if(_0xc07cad!==_0xf91a('0x88')){return;}return db['User'][_0xf91a('0x44')]({'where':{'id':_0x16f76b,'online':0x1},'attributes':['id','name',_0xf91a('0x90'),_0xf91a('0x91'),_0xf91a('0x92')],'raw':!![]})[_0xf91a('0x2a')](function(_0x42b235){var _0x1e493b=_['map'](_0x42b235,function(_0x544aff){return db['UserVoiceQueueRt'][_0xf91a('0x93')]({'membername':_0x544aff[_0xf91a('0x2c')],'UserId':_0x544aff['id'],'queue_name':_0xa043a4[_0xf91a('0x2c')],'VoiceQueueId':_0xa043a4['id'],'interface':_['isNil'](_0x544aff[_0xf91a('0x92')])?util[_0xf91a('0x94')]('SIP/%s',_0x544aff['name']):_0x544aff[_0xf91a('0x92')],'paused':_0x544aff['voicePause']||![],'penalty':_0xa043a4[_0xf91a('0x8b')]['penalty']},{'transaction':_0x227514});});return Promise['all'](_0x1e493b);});});});return Promise[_0xf91a('0x95')](_0x5be84a);});return Promise[_0xf91a('0x95')](_0x561d94);})[_0xf91a('0x2a')](function(){return db[_0xf91a('0x6d')]['findOne']({'where':{'teamId':_0x1a02bf}})['then'](function(_0x1a991e){if(_0x1a991e){var _0x27bc7a=_[_0xf91a('0x56')](_0x16f76b,function(_0x3bf4fb){db['UserVoicePrefix'][_0xf91a('0x93')]({'UserId':_0x3bf4fb,'VoicePrefixId':_0x1a991e['VoicePrefixId']});});return Promise[_0xf91a('0x95')](_0x27bc7a);}});});});return Promise[_0xf91a('0x95')](_0x166882)[_0xf91a('0x2a')](function(){return _0x116b10[_0xf91a('0x82')](_0x16f76b,{'transaction':_0x227514})['spread'](function(_0x4eb054){return _0x4eb054;});});});}})[_0xf91a('0x2a')](respondWithResult(_0x4c50e7,null))[_0xf91a('0x45')](handleError(_0x4c50e7,null));};exports[_0xf91a('0x96')]=function(_0x1d8cf4,_0x1801aa){var _0x2d4205=_[_0xf91a('0x83')](_0x1d8cf4[_0xf91a('0x31')][_0xf91a('0x7f')])?_0x1d8cf4[_0xf91a('0x31')][_0xf91a('0x7f')]:[_0x1d8cf4['query'][_0xf91a('0x7f')]];var _0x559b27=_0x1d8cf4['params']['id'];return db[_0xf91a('0x41')]['find']({'where':{'id':_0x559b27}})['then'](handleEntityNotFound(_0x1801aa,null))[_0xf91a('0x2a')](function(_0x2cd4c4){if(_0x2cd4c4){var _0x150205=[_0xf91a('0x88'),'Chat',_0xf91a('0x97'),_0xf91a('0x85'),'Fax','Openchannel',_0xf91a('0x98')];return db[_0xf91a('0x53')][_0xf91a('0x54')](function(_0x2633da){var _0x1e7607=_[_0xf91a('0x56')](_0x150205,function(_0x49b19a){var _0x308a44={'attributes':['id',_0xf91a('0x2c')]};return _0x2cd4c4[_0xf91a('0x4e')+_0x49b19a+'Queues'](_0x308a44)[_0xf91a('0x2a')](function(_0x437cf7){var _0x39a6c9=_[_0xf91a('0x56')](_0x437cf7,function(_0x3426d7){return _0x3426d7['removeAgents'](_0x2d4205,{'transaction':_0x2633da})['then'](function(){var _0x7e48fe=_[_0xf91a('0x56')](_0x2d4205,function(_0x36e165){socket[_0xf91a('0x99')](_0xf91a('0x4b')+_0x49b19a+_0xf91a('0x9a'),{'UserId':Number(_0x36e165),[_0x49b19a+_0xf91a('0x9b')]:_0x3426d7['id']});if(_0x49b19a!=='Voice'){return;}return db[_0xf91a('0x9c')][_0xf91a('0x52')]({'where':{'VoiceQueueId':_0x3426d7['id'],'UserId':_0x36e165},'transaction':_0x2633da});});return Promise[_0xf91a('0x95')](_0x7e48fe);});});return Promise['all'](_0x39a6c9);});});return Promise[_0xf91a('0x95')](_0x1e7607)[_0xf91a('0x2a')](function(){return _0x2cd4c4[_0xf91a('0x96')](_0x2d4205,{'transaction':_0x2633da});})[_0xf91a('0x2a')](function(){return db[_0xf91a('0x6d')]['findOne']({'where':{'teamId':_0x559b27}})[_0xf91a('0x2a')](function(_0x588b57){if(_0x588b57){var _0x554fe0=_[_0xf91a('0x56')](_0x2d4205,function(_0x3455b4){db[_0xf91a('0x6e')][_0xf91a('0x52')]({'where':{'UserId':_0x3455b4,'VoicePrefixId':_0x588b57['VoicePrefixId']}});});return Promise[_0xf91a('0x95')](_0x554fe0);}});});});}})[_0xf91a('0x2a')](respondWithStatusCode(_0x1801aa,null))['catch'](handleError(_0x1801aa,null));};exports['getAgents']=function(_0x5195dc,_0x5667d6,_0x359403){var _0x18410e={};var _0x5d0e2b={};var _0x5bb123;var _0x1402c4;return db[_0xf91a('0x41')][_0xf91a('0x74')]({'where':{'id':_0x5195dc['params']['id']}})[_0xf91a('0x2a')](handleEntityNotFound(_0x5667d6,null))[_0xf91a('0x2a')](function(_0x3b9af5){if(_0x3b9af5){_0x5bb123=_0x3b9af5;_0x5d0e2b[_0xf91a('0x35')]=_[_0xf91a('0x32')](db['User'][_0xf91a('0x2e')]);_0x5d0e2b[_0xf91a('0x31')]=_[_0xf91a('0x32')](_0x5195dc[_0xf91a('0x31')]);_0x5d0e2b['filters']=_[_0xf91a('0x34')](_0x5d0e2b['model'],_0x5d0e2b[_0xf91a('0x31')]);_0x18410e[_0xf91a('0x37')]=_['intersection'](_0x5d0e2b['model'],qs['fields'](_0x5195dc['query'][_0xf91a('0x36')]));_0x18410e[_0xf91a('0x37')]=_0x18410e['attributes']['length']?_0x18410e[_0xf91a('0x37')]:_0x5d0e2b[_0xf91a('0x35')];_0x18410e[_0xf91a('0x3a')]=qs[_0xf91a('0x7a')](_0x5195dc['query'][_0xf91a('0x7a')]);_0x18410e[_0xf91a('0x3d')]=qs[_0xf91a('0x33')](_[_0xf91a('0x3b')](_0x5195dc[_0xf91a('0x31')],_0x5d0e2b[_0xf91a('0x33')]));if(_0x5195dc[_0xf91a('0x31')][_0xf91a('0x3c')]){_0x18410e['where']=_[_0xf91a('0x3e')](_0x18410e[_0xf91a('0x3d')],{'$or':_[_0xf91a('0x56')](_0x18410e[_0xf91a('0x37')],function(_0x3df4e0){var _0x5ab99c={};_0x5ab99c[_0x3df4e0]={'$like':'%'+_0x5195dc[_0xf91a('0x31')]['filter']+'%'};return _0x5ab99c;})});}_0x18410e=_[_0xf91a('0x3e')]({},_0x18410e,_0x5195dc[_0xf91a('0x40')]);return _0x5bb123[_0xf91a('0x9d')](_0x18410e);}})[_0xf91a('0x2a')](function(_0x293e9c){if(_0x293e9c){_0x1402c4=_0x293e9c[_0xf91a('0x38')];if(!_0x5195dc['query'][_0xf91a('0x39')](_0xf91a('0x9e'))){_0x18410e['limit']=qs['limit'](_0x5195dc['query'][_0xf91a('0x24')]);_0x18410e[_0xf91a('0x22')]=qs[_0xf91a('0x22')](_0x5195dc[_0xf91a('0x31')]['offset']);}return _0x5bb123['getAgents'](_0x18410e);}})[_0xf91a('0x2a')](function(_0x95c031){if(_0x95c031){return _0x95c031?{'count':_0x1402c4,'rows':_0x95c031}:null;}})[_0xf91a('0x2a')](respondWithResult(_0x5667d6,null))[_0xf91a('0x45')](handleError(_0x5667d6,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 0ef79f4..2f4c463 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 _0x3ff9=['hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','update','remove','emit'];(function(_0x57fe7f,_0x2fae5f){var _0xce8eae=function(_0x363d50){while(--_0x363d50){_0x57fe7f['push'](_0x57fe7f['shift']());}};_0xce8eae(++_0x2fae5f);}(_0x3ff9,0x14d));var _0x93ff=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3ff9[_0x4ff09b];return _0x3f5c2e;};'use strict';var EventEmitter=require(_0x93ff('0x0'));var Team=require(_0x93ff('0x1'))['db'][_0x93ff('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x93ff('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x93ff('0x4'),'afterDestroy':_0x93ff('0x5')};function emitEvent(_0x57480c){return function(_0x1d7225,_0x1225b3,_0x4bf372){TeamEvents[_0x93ff('0x6')](_0x57480c+':'+_0x1d7225['id'],_0x1d7225);TeamEvents[_0x93ff('0x6')](_0x57480c,_0x1d7225);_0x4bf372(null);};}for(var e in events){if(events[_0x93ff('0x7')](e)){var event=events[e];Team[_0x93ff('0x8')](e,emitEvent(event));}}module[_0x93ff('0x9')]=TeamEvents; \ No newline at end of file +var _0xfd98=['emit','hasOwnProperty','hook','exports','events','Team','save','update','remove'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0xfd98,0x190));var _0x8fd9=function(_0x2370f1,_0x5859d6){_0x2370f1=_0x2370f1-0x0;var _0x4edbef=_0xfd98[_0x2370f1];return _0x4edbef;};'use strict';var EventEmitter=require(_0x8fd9('0x0'));var Team=require('../../mysqldb')['db'][_0x8fd9('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8fd9('0x2'),'afterUpdate':_0x8fd9('0x3'),'afterDestroy':_0x8fd9('0x4')};function emitEvent(_0x2a1321){return function(_0x2c13f5,_0x3fc8bb,_0x4879e){TeamEvents[_0x8fd9('0x5')](_0x2a1321+':'+_0x2c13f5['id'],_0x2c13f5);TeamEvents[_0x8fd9('0x5')](_0x2a1321,_0x2c13f5);_0x4879e(null);};}for(var e in events){if(events[_0x8fd9('0x6')](e)){var event=events[e];Team[_0x8fd9('0x7')](e,emitEvent(event));}}module[_0x8fd9('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 641f8fd..f4abce0 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 _0x4bd0=['./team.attributes','exports','define','Team','teams','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4799d6,_0x48ba3e){var _0x3ca3ec=function(_0x444c19){while(--_0x444c19){_0x4799d6['push'](_0x4799d6['shift']());}};_0x3ca3ec(++_0x48ba3e);}(_0x4bd0,0x89));var _0x04bd=function(_0x21cda3,_0x17b90a){_0x21cda3=_0x21cda3-0x0;var _0x558dc3=_0x4bd0[_0x21cda3];return _0x558dc3;};'use strict';var _=require('lodash');var util=require(_0x04bd('0x0'));var logger=require(_0x04bd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x04bd('0x2'));var rp=require(_0x04bd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04bd('0x4'));var config=require(_0x04bd('0x5'));var attributes=require(_0x04bd('0x6'));module[_0x04bd('0x7')]=function(_0x5262ca,_0x301536){return _0x5262ca[_0x04bd('0x8')](_0x04bd('0x9'),attributes,{'tableName':_0x04bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2af6=['rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','../../config/logger','api','bluebird','path'];(function(_0x3b92c1,_0x180bbb){var _0x1c726=function(_0x513dad){while(--_0x513dad){_0x3b92c1['push'](_0x3b92c1['shift']());}};_0x1c726(++_0x180bbb);}(_0x2af6,0xac));var _0x62af=function(_0x3d3837,_0x350aa7){_0x3d3837=_0x3d3837-0x0;var _0x257ccd=_0x2af6[_0x3d3837];return _0x257ccd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x62af('0x0'))(_0x62af('0x1'));var moment=require('moment');var BPromise=require(_0x62af('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62af('0x3'));var rimraf=require(_0x62af('0x4'));var config=require(_0x62af('0x5'));var attributes=require(_0x62af('0x6'));module[_0x62af('0x7')]=function(_0x4503e6,_0x19610f){return _0x4503e6[_0x62af('0x8')](_0x62af('0x9'),attributes,{'tableName':_0x62af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 8e93d9b..d91a55f 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 _0x4531=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x39ca55,_0x2e0621){var _0x533cb2=function(_0x13aa63){while(--_0x13aa63){_0x39ca55['push'](_0x39ca55['shift']());}};_0x533cb2(++_0x2e0621);}(_0x4531,0x6a));var _0x1453=function(_0x47fc97,_0x3cd87d){_0x47fc97=_0x47fc97-0x0;var _0x52b93c=_0x4531[_0x47fc97];return _0x52b93c;};'use strict';var _=require('lodash');var util=require(_0x1453('0x0'));var moment=require(_0x1453('0x1'));var BPromise=require(_0x1453('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1453('0x3'));var db=require(_0x1453('0x4'))['db'];var utils=require(_0x1453('0x5'));var logger=require('../../config/logger')(_0x1453('0x6'));var config=require(_0x1453('0x7'));var jayson=require(_0x1453('0x8'));var client=jayson[_0x1453('0x9')][_0x1453('0xa')]({'port':0x232a});config[_0x1453('0xb')]=_[_0x1453('0xc')](config[_0x1453('0xb')],{'host':_0x1453('0xd'),'port':0x18eb});var socket=require(_0x1453('0xe'))(new Redis(config['redis']));require('./team.socket')[_0x1453('0xf')](socket);function respondWithRpcPromise(_0x1c7e80,_0x3e46e3,_0x1a2db3){return new BPromise(function(_0x43b8e9,_0xb048b2){return client[_0x1453('0x10')](_0x1c7e80,_0x1a2db3)[_0x1453('0x11')](function(_0x2e40bf){logger[_0x1453('0x12')](_0x1453('0x13'),_0x3e46e3,_0x1453('0x14'));logger[_0x1453('0x15')](_0x1453('0x16'),_0x3e46e3,_0x1453('0x14'),JSON[_0x1453('0x17')](_0x2e40bf));if(_0x2e40bf[_0x1453('0x18')]){if(_0x2e40bf[_0x1453('0x18')][_0x1453('0x19')]===0x1f4){logger[_0x1453('0x18')](_0x1453('0x13'),_0x3e46e3,_0x2e40bf[_0x1453('0x18')][_0x1453('0x1a')]);return _0xb048b2(_0x2e40bf[_0x1453('0x18')]['message']);}logger[_0x1453('0x18')]('Team,\x20%s,\x20%s',_0x3e46e3,_0x2e40bf['error'][_0x1453('0x1a')]);return _0x43b8e9(_0x2e40bf['error'][_0x1453('0x1a')]);}else{logger[_0x1453('0x12')](_0x1453('0x13'),_0x3e46e3,_0x1453('0x14'));_0x43b8e9(_0x2e40bf[_0x1453('0x1b')]['message']);}})[_0x1453('0x1c')](function(_0x3b61e5){logger[_0x1453('0x18')](_0x1453('0x13'),_0x3e46e3,_0x3b61e5);_0xb048b2(_0x3b61e5);});});} \ No newline at end of file +var _0x0bb9=['info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','then'];(function(_0x2d147b,_0xb5caad){var _0x2c908e=function(_0x95f276){while(--_0x95f276){_0x2d147b['push'](_0x2d147b['shift']());}};_0x2c908e(++_0xb5caad);}(_0x0bb9,0x1f0));var _0x90bb=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x0bb9[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x90bb('0x0'));var util=require(_0x90bb('0x1'));var moment=require(_0x90bb('0x2'));var BPromise=require(_0x90bb('0x3'));var rs=require(_0x90bb('0x4'));var fs=require('fs');var Redis=require(_0x90bb('0x5'));var db=require(_0x90bb('0x6'))['db'];var utils=require(_0x90bb('0x7'));var logger=require(_0x90bb('0x8'))('rpc');var config=require(_0x90bb('0x9'));var jayson=require(_0x90bb('0xa'));var client=jayson[_0x90bb('0xb')][_0x90bb('0xc')]({'port':0x232a});config[_0x90bb('0xd')]=_[_0x90bb('0xe')](config['redis'],{'host':_0x90bb('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90bb('0xd')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x40e6b7,_0x3dc4d9,_0x24fbe3){return new BPromise(function(_0x17553c,_0x18532f){return client['request'](_0x40e6b7,_0x24fbe3)[_0x90bb('0x10')](function(_0x2bbbdd){logger[_0x90bb('0x11')](_0x90bb('0x12'),_0x3dc4d9,_0x90bb('0x13'));logger[_0x90bb('0x14')](_0x90bb('0x15'),_0x3dc4d9,_0x90bb('0x13'),JSON[_0x90bb('0x16')](_0x2bbbdd));if(_0x2bbbdd[_0x90bb('0x17')]){if(_0x2bbbdd['error'][_0x90bb('0x18')]===0x1f4){logger[_0x90bb('0x17')]('Team,\x20%s,\x20%s',_0x3dc4d9,_0x2bbbdd['error']['message']);return _0x18532f(_0x2bbbdd[_0x90bb('0x17')]['message']);}logger[_0x90bb('0x17')]('Team,\x20%s,\x20%s',_0x3dc4d9,_0x2bbbdd['error'][_0x90bb('0x19')]);return _0x17553c(_0x2bbbdd[_0x90bb('0x17')][_0x90bb('0x19')]);}else{logger[_0x90bb('0x11')](_0x90bb('0x12'),_0x3dc4d9,_0x90bb('0x13'));_0x17553c(_0x2bbbdd['result'][_0x90bb('0x19')]);}})[_0x90bb('0x1a')](function(_0x57146f){logger['error'](_0x90bb('0x12'),_0x3dc4d9,_0x57146f);_0x18532f(_0x57146f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 310495a..2491033 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 _0x56fc=['update','emit','removeListener','register','length','team:','./team.events','remove'];(function(_0x274797,_0x56be87){var _0x5671b3=function(_0x5638fe){while(--_0x5638fe){_0x274797['push'](_0x274797['shift']());}};_0x5671b3(++_0x56be87);}(_0x56fc,0x13e));var _0xc56f=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x56fc[_0x565c49];return _0x20ca34;};'use strict';var TeamEvents=require(_0xc56f('0x0'));var events=['save',_0xc56f('0x1'),_0xc56f('0x2')];function createListener(_0x2fe616,_0x2eaef7){return function(_0x2c2077){_0x2eaef7[_0xc56f('0x3')](_0x2fe616,_0x2c2077);};}function removeListener(_0x4e3a6b,_0x2284f9){return function(){TeamEvents[_0xc56f('0x4')](_0x4e3a6b,_0x2284f9);};}exports[_0xc56f('0x5')]=function(_0x2d65c6){for(var _0x2bccdd=0x0,_0x4e2ffa=events[_0xc56f('0x6')];_0x2bccdd<_0x4e2ffa;_0x2bccdd++){var _0x12e9ba=events[_0x2bccdd];var _0x53ed7d=createListener(_0xc56f('0x7')+_0x12e9ba,_0x2d65c6);TeamEvents['on'](_0x12e9ba,_0x53ed7d);}}; \ No newline at end of file +var _0x8481=['remove','update','emit','register','team:','./team.events'];(function(_0x106771,_0x5b3a9e){var _0x22405c=function(_0x198310){while(--_0x198310){_0x106771['push'](_0x106771['shift']());}};_0x22405c(++_0x5b3a9e);}(_0x8481,0x1c7));var _0x1848=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x8481[_0x576e2b];return _0x46461a;};'use strict';var TeamEvents=require(_0x1848('0x0'));var events=['save',_0x1848('0x1'),_0x1848('0x2')];function createListener(_0x15c868,_0x5e906c){return function(_0x15ea3b){_0x5e906c[_0x1848('0x3')](_0x15c868,_0x15ea3b);};}function removeListener(_0x3d07fd,_0x391e1e){return function(){TeamEvents['removeListener'](_0x3d07fd,_0x391e1e);};}exports[_0x1848('0x4')]=function(_0x5cb737){for(var _0x5ad7d9=0x0,_0x56fb3b=events['length'];_0x5ad7d9<_0x56fb3b;_0x5ad7d9++){var _0x393578=events[_0x5ad7d9];var _0x43fb94=createListener(_0x1848('0x5')+_0x393578,_0x5cb737);TeamEvents['on'](_0x393578,_0x43fb94);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index e0ef493..f264eef 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 _0x8581=['INTEGER','exports'];(function(_0xc20f22,_0x49698f){var _0x1535d5=function(_0x5ce3f3){while(--_0x5ce3f3){_0xc20f22['push'](_0xc20f22['shift']());}};_0x1535d5(++_0x49698f);}(_0x8581,0x163));var _0x1858=function(_0x342515,_0x6db444){_0x342515=_0x342515-0x0;var _0x5bdef4=_0x8581[_0x342515];return _0x5bdef4;};'use strict';var Sequelize=require('sequelize');module[_0x1858('0x0')]={'TeamId':{'type':Sequelize[_0x1858('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x834d=['exports','INTEGER','sequelize'];(function(_0xbabb6,_0xa79fd9){var _0x3b9def=function(_0x45e19d){while(--_0x45e19d){_0xbabb6['push'](_0xbabb6['shift']());}};_0x3b9def(++_0xa79fd9);}(_0x834d,0x140));var _0xd834=function(_0xc61ff,_0x37d7dd){_0xc61ff=_0xc61ff-0x0;var _0x4dadba=_0x834d[_0xc61ff];return _0x4dadba;};'use strict';var Sequelize=require(_0xd834('0x0'));module[_0xd834('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xd834('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 38dbd29..c69c039 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 _0xf6ed=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','api','moment','path','./teamVoicePrefix.attributes'];(function(_0x20b594,_0x2829da){var _0x2e3a45=function(_0xde25b8){while(--_0xde25b8){_0x20b594['push'](_0x20b594['shift']());}};_0x2e3a45(++_0x2829da);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x29677f,_0x1c34b3){_0x29677f=_0x29677f-0x0;var _0x5ac7cc=_0xf6ed[_0x29677f];return _0x5ac7cc;};'use strict';var _=require(_0xdf6e('0x0'));var util=require('util');var logger=require(_0xdf6e('0x1'))(_0xdf6e('0x2'));var moment=require(_0xdf6e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf6e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdf6e('0x5'));module['exports']=function(_0x2a844a,_0x5eb5d1){return _0x2a844a[_0xdf6e('0x6')](_0xdf6e('0x7'),attributes,{'tableName':_0xdf6e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x081e=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','lodash','util','api'];(function(_0x7b5075,_0x3317db){var _0x4a324e=function(_0x4226ad){while(--_0x4226ad){_0x7b5075['push'](_0x7b5075['shift']());}};_0x4a324e(++_0x3317db);}(_0x081e,0xc5));var _0xe081=function(_0x59f7b8,_0xb2ac21){_0x59f7b8=_0x59f7b8-0x0;var _0x7b28c5=_0x081e[_0x59f7b8];return _0x7b28c5;};'use strict';var _=require(_0xe081('0x0'));var util=require(_0xe081('0x1'));var logger=require('../../config/logger')(_0xe081('0x2'));var moment=require('moment');var BPromise=require(_0xe081('0x3'));var rp=require(_0xe081('0x4'));var fs=require('fs');var path=require(_0xe081('0x5'));var rimraf=require(_0xe081('0x6'));var config=require(_0xe081('0x7'));var attributes=require(_0xe081('0x8'));module[_0xe081('0x9')]=function(_0x50d6cb,_0x2271b4){return _0x50d6cb['define']('TeamVoicePrefix',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 619fd50..a5f958b 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x276204,_0x4ad6f3){var _0x137d07=function(_0x3d6add){while(--_0x3d6add){_0x276204['push'](_0x276204['shift']());}};_0x137d07(++_0x4ad6f3);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1e9fdb,_0x3bba51){var _0x50930a=function(_0x235583){while(--_0x235583){_0x1e9fdb['push'](_0x1e9fdb['shift']());}};_0x50930a(++_0x3bba51);}(_0x70e0,0x17b));var _0x070e=function(_0x4ca90a,_0x34b42c){_0x4ca90a=_0x4ca90a-0x0;var _0x547b48=_0x70e0[_0x4ca90a];return _0x547b48;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 20a7357..b95f39b 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 _0xcfa1=['sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfa1,0xbe));var _0x1cfa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcfa1[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x1cfa('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1cfa('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0caf=['sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0caf,0x8a));var _0xf0ca=function(_0x2e3bc2,_0x38684e){_0x2e3bc2=_0x2e3bc2-0x0;var _0x55109b=_0x0caf[_0x2e3bc2];return _0x55109b;};'use strict';var Sequelize=require(_0xf0ca('0x0'));module[_0xf0ca('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 4178cec..aadd1a0 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 _0x2821=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x1fcf8d,_0x575872){var _0x5f5d85=function(_0x40d04e){while(--_0x40d04e){_0x1fcf8d['push'](_0x1fcf8d['shift']());}};_0x5f5d85(++_0x575872);}(_0x2821,0xc3));var _0x1282=function(_0x11f3c3,_0x43a130){_0x11f3c3=_0x11f3c3-0x0;var _0x1461cc=_0x2821[_0x11f3c3];return _0x1461cc;};'use strict';var _=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var logger=require(_0x1282('0x2'))(_0x1282('0x3'));var moment=require(_0x1282('0x4'));var BPromise=require(_0x1282('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1282('0x6'));var rimraf=require(_0x1282('0x7'));var config=require('../../config/environment');var attributes=require(_0x1282('0x8'));module[_0x1282('0x9')]=function(_0x384b8b,_0xe7525f){return _0x384b8b[_0x1282('0xa')](_0x1282('0xb'),attributes,{'tableName':_0x1282('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1df5=['TeamVoiceQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x2b9138,_0x535219){var _0x42a215=function(_0x21f090){while(--_0x21f090){_0x2b9138['push'](_0x2b9138['shift']());}};_0x42a215(++_0x535219);}(_0x1df5,0xfd));var _0x51df=function(_0x5fa796,_0x4a8476){_0x5fa796=_0x5fa796-0x0;var _0x14d03a=_0x1df5[_0x5fa796];return _0x14d03a;};'use strict';var _=require(_0x51df('0x0'));var util=require(_0x51df('0x1'));var logger=require(_0x51df('0x2'))(_0x51df('0x3'));var moment=require(_0x51df('0x4'));var BPromise=require('bluebird');var rp=require(_0x51df('0x5'));var fs=require('fs');var path=require(_0x51df('0x6'));var rimraf=require(_0x51df('0x7'));var config=require(_0x51df('0x8'));var attributes=require(_0x51df('0x9'));module[_0x51df('0xa')]=function(_0x15de76,_0x239dbb){return _0x15de76['define'](_0x51df('0xb'),attributes,{'tableName':'team_has_voice_queues','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 5b41f32..cd757b7 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 _0x6263=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3fdb59,_0x15af6e){var _0x43108d=function(_0x3474c7){while(--_0x3474c7){_0x3fdb59['push'](_0x3fdb59['shift']());}};_0x43108d(++_0x15af6e);}(_0x6263,0x19d));var _0x3626=function(_0x524e23,_0x1e2aa7){_0x524e23=_0x524e23-0x0;var _0x231413=_0x6263[_0x524e23];return _0x231413;};'use strict';var _=require(_0x3626('0x0'));var util=require(_0x3626('0x1'));var moment=require(_0x3626('0x2'));var BPromise=require(_0x3626('0x3'));var rs=require(_0x3626('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3626('0x5'))['db'];var utils=require(_0x3626('0x6'));var logger=require(_0x3626('0x7'))(_0x3626('0x8'));var config=require('../../config/environment');var jayson=require(_0x3626('0x9'));var client=jayson['client'][_0x3626('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x292c3a,_0x4a6fd3,_0x313603){return new BPromise(function(_0x15d8b6,_0x48dede){return client[_0x3626('0xb')](_0x292c3a,_0x313603)[_0x3626('0xc')](function(_0x51cbc8){logger['info'](_0x3626('0xd'),_0x4a6fd3,_0x3626('0xe'));logger['debug'](_0x3626('0xf'),_0x4a6fd3,_0x3626('0xe'),JSON[_0x3626('0x10')](_0x51cbc8));if(_0x51cbc8[_0x3626('0x11')]){if(_0x51cbc8[_0x3626('0x11')]['code']===0x1f4){logger[_0x3626('0x11')](_0x3626('0xd'),_0x4a6fd3,_0x51cbc8['error'][_0x3626('0x12')]);return _0x48dede(_0x51cbc8[_0x3626('0x11')][_0x3626('0x12')]);}logger[_0x3626('0x11')](_0x3626('0xd'),_0x4a6fd3,_0x51cbc8[_0x3626('0x11')][_0x3626('0x12')]);return _0x15d8b6(_0x51cbc8[_0x3626('0x11')][_0x3626('0x12')]);}else{logger[_0x3626('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4a6fd3,_0x3626('0xe'));_0x15d8b6(_0x51cbc8[_0x3626('0x14')][_0x3626('0x12')]);}})[_0x3626('0x15')](function(_0x502abe){logger[_0x3626('0x11')](_0x3626('0xd'),_0x4a6fd3,_0x502abe);_0x48dede(_0x502abe);});});} \ No newline at end of file +var _0x2632=['../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x59955a,_0x57e8e4){var _0x55f6e9=function(_0x3fceaf){while(--_0x3fceaf){_0x59955a['push'](_0x59955a['shift']());}};_0x55f6e9(++_0x57e8e4);}(_0x2632,0xae));var _0x2263=function(_0x2bd89e,_0x36c777){_0x2bd89e=_0x2bd89e-0x0;var _0x14822b=_0x2632[_0x2bd89e];return _0x14822b;};'use strict';var _=require('lodash');var util=require(_0x2263('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2263('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2263('0x2'))['db'];var utils=require(_0x2263('0x3'));var logger=require(_0x2263('0x4'))(_0x2263('0x5'));var config=require(_0x2263('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2263('0x7')][_0x2263('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ebe5e,_0x2173b1,_0x5a5b48){return new BPromise(function(_0x4a6c43,_0x51a169){return client[_0x2263('0x9')](_0x5ebe5e,_0x5a5b48)[_0x2263('0xa')](function(_0x24c04c){logger[_0x2263('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2173b1,_0x2263('0xc'));logger[_0x2263('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2173b1,'request\x20sent',JSON[_0x2263('0xe')](_0x24c04c));if(_0x24c04c[_0x2263('0xf')]){if(_0x24c04c[_0x2263('0xf')][_0x2263('0x10')]===0x1f4){logger[_0x2263('0xf')](_0x2263('0x11'),_0x2173b1,_0x24c04c[_0x2263('0xf')][_0x2263('0x12')]);return _0x51a169(_0x24c04c['error']['message']);}logger[_0x2263('0xf')](_0x2263('0x11'),_0x2173b1,_0x24c04c['error'][_0x2263('0x12')]);return _0x4a6c43(_0x24c04c['error'][_0x2263('0x12')]);}else{logger[_0x2263('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2173b1,_0x2263('0xc'));_0x4a6c43(_0x24c04c[_0x2263('0x13')][_0x2263('0x12')]);}})['catch'](function(_0x8dc656){logger['error'](_0x2263('0x11'),_0x2173b1,_0x8dc656);_0x51a169(_0x8dc656);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index eaf9de7..57c4d3a 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 _0x160c=['create','put','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../config/environment','./template.controller','get','index','/:id','show','post'];(function(_0x2851f7,_0x2a01de){var _0x5888cd=function(_0x38d3f0){while(--_0x38d3f0){_0x2851f7['push'](_0x2851f7['shift']());}};_0x5888cd(++_0x2a01de);}(_0x160c,0x181));var _0xc160=function(_0x395937,_0x46a558){_0x395937=_0x395937-0x0;var _0x5710c7=_0x160c[_0x395937];return _0x5710c7;};'use strict';var multer=require('multer');var util=require(_0xc160('0x0'));var path=require(_0xc160('0x1'));var timeout=require(_0xc160('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc160('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc160('0x4'));var controller=require(_0xc160('0x5'));router[_0xc160('0x6')]('/',auth['isAuthenticated'](),controller[_0xc160('0x7')]);router['get'](_0xc160('0x8'),auth['isAuthenticated'](),controller[_0xc160('0x9')]);router[_0xc160('0xa')]('/',auth['isAuthenticated'](),controller[_0xc160('0xb')]);router[_0xc160('0xc')]('/:id',auth[_0xc160('0xd')](),controller[_0xc160('0xe')]);router[_0xc160('0xf')](_0xc160('0x8'),auth[_0xc160('0xd')](),controller[_0xc160('0x10')]);module[_0xc160('0x11')]=router; \ No newline at end of file +var _0x7804=['update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./template.controller','index','get','/:id','isAuthenticated','post','put'];(function(_0x4b87a3,_0x3a698c){var _0x334112=function(_0x3e8fb0){while(--_0x3e8fb0){_0x4b87a3['push'](_0x4b87a3['shift']());}};_0x334112(++_0x3a698c);}(_0x7804,0xc3));var _0x4780=function(_0x73a7e0,_0x27b0a2){_0x73a7e0=_0x73a7e0-0x0;var _0x3db899=_0x7804[_0x73a7e0];return _0x3db899;};'use strict';var multer=require(_0x4780('0x0'));var util=require('util');var path=require(_0x4780('0x1'));var timeout=require(_0x4780('0x2'));var express=require(_0x4780('0x3'));var router=express['Router']();var fs_extra=require(_0x4780('0x4'));var auth=require(_0x4780('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4780('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4780('0x7')]);router[_0x4780('0x8')](_0x4780('0x9'),auth[_0x4780('0xa')](),controller['show']);router[_0x4780('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4780('0xc')](_0x4780('0x9'),auth[_0x4780('0xa')](),controller[_0x4780('0xd')]);router['delete']('/:id',auth[_0x4780('0xa')](),controller[_0x4780('0xe')]);module[_0x4780('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 1555704..5ee04de 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 _0xd0ed=['TEXT','exports','STRING'];(function(_0x1818d,_0x5f94e){var _0x37de5d=function(_0x1846df){while(--_0x1846df){_0x1818d['push'](_0x1818d['shift']());}};_0x37de5d(++_0x5f94e);}(_0xd0ed,0x112));var _0xdd0e=function(_0x3b10de,_0x3bb7e4){_0x3b10de=_0x3b10de-0x0;var _0x461407=_0xd0ed[_0x3b10de];return _0x461407;};'use strict';var Sequelize=require('sequelize');module[_0xdd0e('0x0')]={'name':{'type':Sequelize[_0xdd0e('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xdd0e('0x2')]}}; \ No newline at end of file +var _0xfc7f=['exports','STRING','TEXT','sequelize'];(function(_0x4664c2,_0x46b71a){var _0x3bac30=function(_0x156ed5){while(--_0x156ed5){_0x4664c2['push'](_0x4664c2['shift']());}};_0x3bac30(++_0x46b71a);}(_0xfc7f,0x87));var _0xffc7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfc7f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xffc7('0x0'));module[_0xffc7('0x1')]={'name':{'type':Sequelize[_0xffc7('0x2')]},'description':{'type':Sequelize[_0xffc7('0x2')]},'html':{'type':Sequelize[_0xffc7('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 9594cff..fea9a93 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 _0x353f=['rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','params','fields','include','find','create','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','end','error','name','send','index','map','Template'];(function(_0x64fa5d,_0x4ba48d){var _0x39618c=function(_0x4e0672){while(--_0x4e0672){_0x64fa5d['push'](_0x64fa5d['shift']());}};_0x39618c(++_0x4ba48d);}(_0x353f,0x71));var _0xf353=function(_0x349120,_0x219139){_0x349120=_0x349120-0x0;var _0x494325=_0x353f[_0x349120];return _0x494325;};'use strict';var emlformat=require(_0xf353('0x0'));var rimraf=require(_0xf353('0x1'));var zipdir=require(_0xf353('0x2'));var jsonpatch=require(_0xf353('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf353('0x4'));var Mustache=require(_0xf353('0x5'));var util=require(_0xf353('0x6'));var path=require(_0xf353('0x7'));var sox=require('sox');var csv=require(_0xf353('0x8'));var ejs=require(_0xf353('0x9'));var fs=require('fs');var fs_extra=require(_0xf353('0xa'));var _=require('lodash');var squel=require(_0xf353('0xb'));var crypto=require(_0xf353('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf353('0xd'));var toCsv=require(_0xf353('0x8'));var querystring=require(_0xf353('0xe'));var Papa=require(_0xf353('0xf'));var Redis=require(_0xf353('0x10'));var authService=require(_0xf353('0x11'));var qs=require(_0xf353('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf353('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf353('0x14'));var config=require(_0xf353('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf353('0x16'))['db'];function respondWithStatusCode(_0x5afcba,_0x692378){_0x692378=_0x692378||0xcc;return function(_0x5736e1){if(_0x5736e1){return _0x5afcba[_0xf353('0x17')](_0x692378);}return _0x5afcba['status'](_0x692378)['end']();};}function respondWithResult(_0x67d5c9,_0xa24e38){_0xa24e38=_0xa24e38||0xc8;return function(_0x31bc5a){if(_0x31bc5a){return _0x67d5c9[_0xf353('0x18')](_0xa24e38)[_0xf353('0x19')](_0x31bc5a);}};}function respondWithFilteredResult(_0x1158b7,_0x4936b1){return function(_0x2ddb94){if(_0x2ddb94){var _0x506ffe=typeof _0x4936b1[_0xf353('0x1a')]===_0xf353('0x1b')&&typeof _0x4936b1['limit']===_0xf353('0x1b');var _0x79f08d=_0x2ddb94['count'];var _0x4dd8bf=_0x506ffe?0x0:_0x4936b1[_0xf353('0x1a')];var _0x2245ae=_0x506ffe?_0x2ddb94[_0xf353('0x1c')]:_0x4936b1['offset']+_0x4936b1[_0xf353('0x1d')];var _0x3bd3e6;if(_0x2245ae>=_0x79f08d){_0x2245ae=_0x79f08d;_0x3bd3e6=0xc8;}else{_0x3bd3e6=0xce;}_0x1158b7['status'](_0x3bd3e6);return _0x1158b7[_0xf353('0x1e')](_0xf353('0x1f'),_0x4dd8bf+'-'+_0x2245ae+'/'+_0x79f08d)[_0xf353('0x19')](_0x2ddb94);}return null;};}function patchUpdates(_0x230e1d){return function(_0x1db255){try{jsonpatch[_0xf353('0x20')](_0x1db255,_0x230e1d,!![]);}catch(_0x17c2a7){return BPromise[_0xf353('0x21')](_0x17c2a7);}return _0x1db255[_0xf353('0x22')]();};}function saveUpdates(_0x51f5fd,_0x2f86e1){return function(_0x4aa667){if(_0x4aa667){return _0x4aa667[_0xf353('0x23')](_0x51f5fd)[_0xf353('0x24')](function(_0x159b3b){return _0x159b3b;});}return null;};}function removeEntity(_0x564772,_0x1a442d){return function(_0x3e73fa){if(_0x3e73fa){return _0x3e73fa[_0xf353('0x25')]()[_0xf353('0x24')](function(){var _0x3242b9=_0x3e73fa[_0xf353('0x26')]({'plain':!![]});var _0x20bd3b=_0xf353('0x27');return db['UserProfileResource'][_0xf353('0x25')]({'where':{'type':_0x20bd3b,'resourceId':_0x3242b9['id']}})[_0xf353('0x24')](function(){return _0x3e73fa;});})[_0xf353('0x24')](function(){_0x564772[_0xf353('0x18')](0xcc)[_0xf353('0x28')]();});}};}function handleEntityNotFound(_0x261831,_0x5ec893){return function(_0x10a197){if(!_0x10a197){_0x261831[_0xf353('0x17')](0x194);}return _0x10a197;};}function handleError(_0x133d5c,_0x25528a){_0x25528a=_0x25528a||0x1f4;return function(_0x504959){logger[_0xf353('0x29')](_0x504959['stack']);if(_0x504959[_0xf353('0x2a')]){delete _0x504959[_0xf353('0x2a')];}_0x133d5c[_0xf353('0x18')](_0x25528a)[_0xf353('0x2b')](_0x504959);};}exports[_0xf353('0x2c')]=function(_0x4e83da,_0x1434a7){var _0x180d8e={},_0x52cbf6={},_0x1e9cb4={'count':0x0,'rows':[]};var _0x36f4c3=_[_0xf353('0x2d')](db[_0xf353('0x2e')][_0xf353('0x2f')],function(_0x410293){return{'name':_0x410293[_0xf353('0x30')],'type':_0x410293['type']['key']};});_0x52cbf6[_0xf353('0x31')]=_[_0xf353('0x2d')](_0x36f4c3,_0xf353('0x2a'));_0x52cbf6[_0xf353('0x32')]=_[_0xf353('0x33')](_0x4e83da[_0xf353('0x32')]);_0x52cbf6[_0xf353('0x34')]=_[_0xf353('0x35')](_0x52cbf6[_0xf353('0x31')],_0x52cbf6['query']);_0x180d8e[_0xf353('0x36')]=_['intersection'](_0x52cbf6[_0xf353('0x31')],qs['fields'](_0x4e83da['query']['fields']));_0x180d8e[_0xf353('0x36')]=_0x180d8e[_0xf353('0x36')][_0xf353('0x37')]?_0x180d8e[_0xf353('0x36')]:_0x52cbf6[_0xf353('0x31')];if(!_0x4e83da[_0xf353('0x32')][_0xf353('0x38')]('nolimit')){_0x180d8e[_0xf353('0x1d')]=qs[_0xf353('0x1d')](_0x4e83da[_0xf353('0x32')][_0xf353('0x1d')]);_0x180d8e[_0xf353('0x1a')]=qs['offset'](_0x4e83da['query'][_0xf353('0x1a')]);}_0x180d8e[_0xf353('0x39')]=qs[_0xf353('0x3a')](_0x4e83da['query']['sort']);_0x180d8e[_0xf353('0x3b')]=qs[_0xf353('0x34')](_[_0xf353('0x3c')](_0x4e83da[_0xf353('0x32')],_0x52cbf6[_0xf353('0x34')]),_0x36f4c3);if(_0x4e83da[_0xf353('0x32')][_0xf353('0x3d')]){_0x180d8e[_0xf353('0x3b')]=_[_0xf353('0x3e')](_0x180d8e[_0xf353('0x3b')],{'$or':_[_0xf353('0x2d')](_0x36f4c3,function(_0x183f95){if(_0x183f95[_0xf353('0x3f')]!==_0xf353('0x40')){var _0x229ca5={};_0x229ca5[_0x183f95[_0xf353('0x2a')]]={'$like':'%'+_0x4e83da['query'][_0xf353('0x3d')]+'%'};return _0x229ca5;}})});}_0x180d8e=_[_0xf353('0x3e')]({},_0x180d8e,_0x4e83da[_0xf353('0x41')]);var _0x428db1={'where':_0x180d8e[_0xf353('0x3b')]};return db['Template'][_0xf353('0x1c')](_0x428db1)[_0xf353('0x24')](function(_0x5dd2ea){_0x1e9cb4[_0xf353('0x1c')]=_0x5dd2ea;if(_0x4e83da[_0xf353('0x32')]['includeAll']){_0x180d8e['include']=[{'all':!![]}];}return db['Template'][_0xf353('0x42')](_0x180d8e);})[_0xf353('0x24')](function(_0x31758f){_0x1e9cb4[_0xf353('0x43')]=_0x31758f;return _0x1e9cb4;})['then'](respondWithFilteredResult(_0x1434a7,_0x180d8e))[_0xf353('0x44')](handleError(_0x1434a7,null));};exports['show']=function(_0x33e76f,_0xadd4c2){var _0x540a9e={'raw':!![],'where':{'id':_0x33e76f[_0xf353('0x45')]['id']}},_0x23f1d4={};_0x23f1d4['model']=_[_0xf353('0x33')](db['Template'][_0xf353('0x2f')]);_0x23f1d4['query']=_['keys'](_0x33e76f['query']);_0x23f1d4['filters']=_['intersection'](_0x23f1d4[_0xf353('0x31')],_0x23f1d4[_0xf353('0x32')]);_0x540a9e[_0xf353('0x36')]=_[_0xf353('0x35')](_0x23f1d4[_0xf353('0x31')],qs[_0xf353('0x46')](_0x33e76f[_0xf353('0x32')]['fields']));_0x540a9e['attributes']=_0x540a9e[_0xf353('0x36')][_0xf353('0x37')]?_0x540a9e[_0xf353('0x36')]:_0x23f1d4['model'];if(_0x33e76f[_0xf353('0x32')]['includeAll']){_0x540a9e[_0xf353('0x47')]=[{'all':!![]}];}_0x540a9e=_[_0xf353('0x3e')]({},_0x540a9e,_0x33e76f[_0xf353('0x41')]);return db[_0xf353('0x2e')][_0xf353('0x48')](_0x540a9e)[_0xf353('0x24')](handleEntityNotFound(_0xadd4c2,null))[_0xf353('0x24')](respondWithResult(_0xadd4c2,null))[_0xf353('0x44')](handleError(_0xadd4c2,null));};exports[_0xf353('0x49')]=function(_0x5622ec,_0x46b5cc){return db[_0xf353('0x2e')][_0xf353('0x49')](_0x5622ec['body'],{})[_0xf353('0x24')](function(_0x15c0ae){var _0x31746d=_0x5622ec['user'][_0xf353('0x26')]({'plain':!![]});if(!_0x31746d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31746d[_0xf353('0x4a')]===_0xf353('0x4b')){var _0xa3de03=_0x15c0ae[_0xf353('0x26')]({'plain':!![]});var _0x2fc261='Templates';return db[_0xf353('0x4c')]['find']({'where':{'name':_0x2fc261,'userProfileId':_0x31746d['userProfileId']},'raw':!![]})[_0xf353('0x24')](function(_0x4540c1){if(_0x4540c1&&_0x4540c1['autoAssociation']===0x0){return db[_0xf353('0x4d')]['create']({'name':_0xa3de03['name'],'resourceId':_0xa3de03['id'],'type':_0x4540c1[_0xf353('0x2a')],'sectionId':_0x4540c1['id']},{})[_0xf353('0x24')](function(){return _0x15c0ae;});}else{return _0x15c0ae;}})[_0xf353('0x44')](function(_0x4cc19e){logger[_0xf353('0x29')](_0xf353('0x4e'),_0x4cc19e);throw _0x4cc19e;});}return _0x15c0ae;})['then'](respondWithResult(_0x46b5cc,0xc9))['catch'](handleError(_0x46b5cc,null));};exports[_0xf353('0x23')]=function(_0x5cfdfa,_0x303854){if(_0x5cfdfa[_0xf353('0x4f')]['id']){delete _0x5cfdfa[_0xf353('0x4f')]['id'];}return db[_0xf353('0x2e')][_0xf353('0x48')]({'where':{'id':_0x5cfdfa[_0xf353('0x45')]['id']}})['then'](handleEntityNotFound(_0x303854,null))['then'](saveUpdates(_0x5cfdfa[_0xf353('0x4f')],null))[_0xf353('0x24')](respondWithResult(_0x303854,null))[_0xf353('0x44')](handleError(_0x303854,null));};exports[_0xf353('0x25')]=function(_0x46c0eb,_0x5e1fd9){return db[_0xf353('0x2e')][_0xf353('0x48')]({'where':{'id':_0x46c0eb[_0xf353('0x45')]['id']}})[_0xf353('0x24')](handleEntityNotFound(_0x5e1fd9,null))['then'](removeEntity(_0x5e1fd9,null))[_0xf353('0x44')](handleError(_0x5e1fd9,null));}; \ No newline at end of file +var _0x080c=['limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x475fe2,_0x36f0af){var _0x1defe1=function(_0x314aee){while(--_0x314aee){_0x475fe2['push'](_0x475fe2['shift']());}};_0x1defe1(++_0x36f0af);}(_0x080c,0xd1));var _0xc080=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x080c[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0xc080('0x0'));var rimraf=require(_0xc080('0x1'));var zipdir=require(_0xc080('0x2'));var jsonpatch=require(_0xc080('0x3'));var rp=require(_0xc080('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc080('0x5'));var path=require(_0xc080('0x6'));var sox=require(_0xc080('0x7'));var csv=require(_0xc080('0x8'));var ejs=require(_0xc080('0x9'));var fs=require('fs');var fs_extra=require(_0xc080('0xa'));var _=require(_0xc080('0xb'));var squel=require('squel');var crypto=require(_0xc080('0xc'));var jsforce=require(_0xc080('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc080('0xe'));var Papa=require(_0xc080('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc080('0x10'));var as=require(_0xc080('0x11'));var hardwareService=require(_0xc080('0x12'));var logger=require('../../config/logger')(_0xc080('0x13'));var utils=require(_0xc080('0x14'));var config=require(_0xc080('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc080('0x16'))['db'];function respondWithStatusCode(_0x334840,_0x4af720){_0x4af720=_0x4af720||0xcc;return function(_0x1c1561){if(_0x1c1561){return _0x334840[_0xc080('0x17')](_0x4af720);}return _0x334840[_0xc080('0x18')](_0x4af720)[_0xc080('0x19')]();};}function respondWithResult(_0x361d6e,_0x3e04a6){_0x3e04a6=_0x3e04a6||0xc8;return function(_0x58dbe4){if(_0x58dbe4){return _0x361d6e[_0xc080('0x18')](_0x3e04a6)[_0xc080('0x1a')](_0x58dbe4);}};}function respondWithFilteredResult(_0x33d918,_0x4b256e){return function(_0xcbac02){if(_0xcbac02){var _0x411723=typeof _0x4b256e['offset']===_0xc080('0x1b')&&typeof _0x4b256e[_0xc080('0x1c')]===_0xc080('0x1b');var _0xf371b4=_0xcbac02[_0xc080('0x1d')];var _0x50671a=_0x411723?0x0:_0x4b256e[_0xc080('0x1e')];var _0x44f3d3=_0x411723?_0xcbac02[_0xc080('0x1d')]:_0x4b256e[_0xc080('0x1e')]+_0x4b256e[_0xc080('0x1c')];var _0x4bb55d;if(_0x44f3d3>=_0xf371b4){_0x44f3d3=_0xf371b4;_0x4bb55d=0xc8;}else{_0x4bb55d=0xce;}_0x33d918['status'](_0x4bb55d);return _0x33d918['set'](_0xc080('0x1f'),_0x50671a+'-'+_0x44f3d3+'/'+_0xf371b4)[_0xc080('0x1a')](_0xcbac02);}return null;};}function patchUpdates(_0x2725ae){return function(_0x44eeb8){try{jsonpatch[_0xc080('0x20')](_0x44eeb8,_0x2725ae,!![]);}catch(_0xb0d802){return BPromise[_0xc080('0x21')](_0xb0d802);}return _0x44eeb8[_0xc080('0x22')]();};}function saveUpdates(_0x1315e2,_0x437147){return function(_0x34bb32){if(_0x34bb32){return _0x34bb32[_0xc080('0x23')](_0x1315e2)[_0xc080('0x24')](function(_0x3e8cac){return _0x3e8cac;});}return null;};}function removeEntity(_0xab9307,_0xa50817){return function(_0x1ced71){if(_0x1ced71){return _0x1ced71[_0xc080('0x25')]()[_0xc080('0x24')](function(){var _0x59c0e8=_0x1ced71[_0xc080('0x26')]({'plain':!![]});var _0x54be78=_0xc080('0x27');return db[_0xc080('0x28')][_0xc080('0x25')]({'where':{'type':_0x54be78,'resourceId':_0x59c0e8['id']}})[_0xc080('0x24')](function(){return _0x1ced71;});})['then'](function(){_0xab9307[_0xc080('0x18')](0xcc)[_0xc080('0x19')]();});}};}function handleEntityNotFound(_0x54cfb9,_0x832953){return function(_0x5d3d2b){if(!_0x5d3d2b){_0x54cfb9[_0xc080('0x17')](0x194);}return _0x5d3d2b;};}function handleError(_0x25facf,_0x22f832){_0x22f832=_0x22f832||0x1f4;return function(_0x323b7d){logger['error'](_0x323b7d[_0xc080('0x29')]);if(_0x323b7d[_0xc080('0x2a')]){delete _0x323b7d[_0xc080('0x2a')];}_0x25facf[_0xc080('0x18')](_0x22f832)[_0xc080('0x2b')](_0x323b7d);};}exports[_0xc080('0x2c')]=function(_0x2ad16c,_0x50b745){var _0xfb8187={},_0x2e3b54={},_0x4b6f7f={'count':0x0,'rows':[]};var _0x50d1f2=_[_0xc080('0x2d')](db[_0xc080('0x2e')][_0xc080('0x2f')],function(_0x463451){return{'name':_0x463451[_0xc080('0x30')],'type':_0x463451[_0xc080('0x31')][_0xc080('0x32')]};});_0x2e3b54[_0xc080('0x33')]=_[_0xc080('0x2d')](_0x50d1f2,'name');_0x2e3b54['query']=_[_0xc080('0x34')](_0x2ad16c[_0xc080('0x35')]);_0x2e3b54['filters']=_[_0xc080('0x36')](_0x2e3b54['model'],_0x2e3b54[_0xc080('0x35')]);_0xfb8187[_0xc080('0x37')]=_[_0xc080('0x36')](_0x2e3b54[_0xc080('0x33')],qs[_0xc080('0x38')](_0x2ad16c[_0xc080('0x35')][_0xc080('0x38')]));_0xfb8187[_0xc080('0x37')]=_0xfb8187['attributes'][_0xc080('0x39')]?_0xfb8187[_0xc080('0x37')]:_0x2e3b54['model'];if(!_0x2ad16c['query']['hasOwnProperty'](_0xc080('0x3a'))){_0xfb8187[_0xc080('0x1c')]=qs[_0xc080('0x1c')](_0x2ad16c[_0xc080('0x35')][_0xc080('0x1c')]);_0xfb8187[_0xc080('0x1e')]=qs[_0xc080('0x1e')](_0x2ad16c[_0xc080('0x35')]['offset']);}_0xfb8187['order']=qs['sort'](_0x2ad16c[_0xc080('0x35')]['sort']);_0xfb8187['where']=qs[_0xc080('0x3b')](_[_0xc080('0x3c')](_0x2ad16c['query'],_0x2e3b54['filters']),_0x50d1f2);if(_0x2ad16c['query'][_0xc080('0x3d')]){_0xfb8187[_0xc080('0x3e')]=_[_0xc080('0x3f')](_0xfb8187[_0xc080('0x3e')],{'$or':_[_0xc080('0x2d')](_0x50d1f2,function(_0x3a4fac){if(_0x3a4fac[_0xc080('0x31')]!==_0xc080('0x40')){var _0x32d8b2={};_0x32d8b2[_0x3a4fac[_0xc080('0x2a')]]={'$like':'%'+_0x2ad16c[_0xc080('0x35')]['filter']+'%'};return _0x32d8b2;}})});}_0xfb8187=_[_0xc080('0x3f')]({},_0xfb8187,_0x2ad16c[_0xc080('0x41')]);var _0x1f0b7e={'where':_0xfb8187[_0xc080('0x3e')]};return db['Template']['count'](_0x1f0b7e)[_0xc080('0x24')](function(_0x24489a){_0x4b6f7f['count']=_0x24489a;if(_0x2ad16c[_0xc080('0x35')][_0xc080('0x42')]){_0xfb8187[_0xc080('0x43')]=[{'all':!![]}];}return db[_0xc080('0x2e')][_0xc080('0x44')](_0xfb8187);})[_0xc080('0x24')](function(_0x1c9521){_0x4b6f7f[_0xc080('0x45')]=_0x1c9521;return _0x4b6f7f;})[_0xc080('0x24')](respondWithFilteredResult(_0x50b745,_0xfb8187))[_0xc080('0x46')](handleError(_0x50b745,null));};exports[_0xc080('0x47')]=function(_0x497c44,_0x27593f){var _0x1d86bd={'raw':!![],'where':{'id':_0x497c44[_0xc080('0x48')]['id']}},_0x59b7c5={};_0x59b7c5['model']=_['keys'](db[_0xc080('0x2e')][_0xc080('0x2f')]);_0x59b7c5[_0xc080('0x35')]=_['keys'](_0x497c44['query']);_0x59b7c5['filters']=_[_0xc080('0x36')](_0x59b7c5[_0xc080('0x33')],_0x59b7c5[_0xc080('0x35')]);_0x1d86bd[_0xc080('0x37')]=_[_0xc080('0x36')](_0x59b7c5[_0xc080('0x33')],qs[_0xc080('0x38')](_0x497c44[_0xc080('0x35')][_0xc080('0x38')]));_0x1d86bd[_0xc080('0x37')]=_0x1d86bd[_0xc080('0x37')][_0xc080('0x39')]?_0x1d86bd[_0xc080('0x37')]:_0x59b7c5[_0xc080('0x33')];if(_0x497c44[_0xc080('0x35')][_0xc080('0x42')]){_0x1d86bd[_0xc080('0x43')]=[{'all':!![]}];}_0x1d86bd=_['merge']({},_0x1d86bd,_0x497c44[_0xc080('0x41')]);return db[_0xc080('0x2e')][_0xc080('0x49')](_0x1d86bd)['then'](handleEntityNotFound(_0x27593f,null))[_0xc080('0x24')](respondWithResult(_0x27593f,null))[_0xc080('0x46')](handleError(_0x27593f,null));};exports[_0xc080('0x4a')]=function(_0xfd897e,_0xacee4f){return db[_0xc080('0x2e')][_0xc080('0x4a')](_0xfd897e[_0xc080('0x4b')],{})[_0xc080('0x24')](function(_0x28604f){var _0xd55ba0=_0xfd897e[_0xc080('0x4c')][_0xc080('0x26')]({'plain':!![]});if(!_0xd55ba0)throw new Error(_0xc080('0x4d'));if(_0xd55ba0['role']===_0xc080('0x4c')){var _0x58b2b6=_0x28604f[_0xc080('0x26')]({'plain':!![]});var _0x2eb14a=_0xc080('0x27');return db['UserProfileSection'][_0xc080('0x49')]({'where':{'name':_0x2eb14a,'userProfileId':_0xd55ba0['userProfileId']},'raw':!![]})[_0xc080('0x24')](function(_0x39978a){if(_0x39978a&&_0x39978a['autoAssociation']===0x0){return db['UserProfileResource'][_0xc080('0x4a')]({'name':_0x58b2b6['name'],'resourceId':_0x58b2b6['id'],'type':_0x39978a[_0xc080('0x2a')],'sectionId':_0x39978a['id']},{})[_0xc080('0x24')](function(){return _0x28604f;});}else{return _0x28604f;}})['catch'](function(_0x34af9c){logger[_0xc080('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34af9c);throw _0x34af9c;});}return _0x28604f;})[_0xc080('0x24')](respondWithResult(_0xacee4f,0xc9))[_0xc080('0x46')](handleError(_0xacee4f,null));};exports[_0xc080('0x23')]=function(_0x38f2ab,_0x2c624b){if(_0x38f2ab['body']['id']){delete _0x38f2ab['body']['id'];}return db[_0xc080('0x2e')][_0xc080('0x49')]({'where':{'id':_0x38f2ab['params']['id']}})['then'](handleEntityNotFound(_0x2c624b,null))[_0xc080('0x24')](saveUpdates(_0x38f2ab[_0xc080('0x4b')],null))[_0xc080('0x24')](respondWithResult(_0x2c624b,null))['catch'](handleError(_0x2c624b,null));};exports[_0xc080('0x25')]=function(_0x3ef6d6,_0x561b3b){return db[_0xc080('0x2e')]['find']({'where':{'id':_0x3ef6d6[_0xc080('0x48')]['id']}})['then'](handleEntityNotFound(_0x561b3b,null))[_0xc080('0x24')](removeEntity(_0x561b3b,null))[_0xc080('0x46')](handleError(_0x561b3b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 68bd448..25fc3af 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 _0x7711=['exports','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./template.attributes'];(function(_0x575b72,_0x1a7eb1){var _0x561c57=function(_0x10e401){while(--_0x10e401){_0x575b72['push'](_0x575b72['shift']());}};_0x561c57(++_0x1a7eb1);}(_0x7711,0x1ca));var _0x1771=function(_0x521d3b,_0x25bbc0){_0x521d3b=_0x521d3b-0x0;var _0x502a8e=_0x7711[_0x521d3b];return _0x502a8e;};'use strict';var _=require(_0x1771('0x0'));var util=require(_0x1771('0x1'));var logger=require(_0x1771('0x2'))(_0x1771('0x3'));var moment=require(_0x1771('0x4'));var BPromise=require(_0x1771('0x5'));var rp=require(_0x1771('0x6'));var fs=require('fs');var path=require(_0x1771('0x7'));var rimraf=require('rimraf');var config=require(_0x1771('0x8'));var attributes=require(_0x1771('0x9'));module[_0x1771('0xa')]=function(_0x2cd55f,_0x3cc5e4){return _0x2cd55f['define'](_0x1771('0xb'),attributes,{'tableName':_0x1771('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd78a=['exports','define','tools_templates','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./template.attributes'];(function(_0x1b27a9,_0x305e10){var _0x28b4d1=function(_0x2508b4){while(--_0x2508b4){_0x1b27a9['push'](_0x1b27a9['shift']());}};_0x28b4d1(++_0x305e10);}(_0xd78a,0x7b));var _0xad78=function(_0x3c7e26,_0x3cc265){_0x3c7e26=_0x3c7e26-0x0;var _0x530070=_0xd78a[_0x3c7e26];return _0x530070;};'use strict';var _=require('lodash');var util=require(_0xad78('0x0'));var logger=require(_0xad78('0x1'))(_0xad78('0x2'));var moment=require(_0xad78('0x3'));var BPromise=require(_0xad78('0x4'));var rp=require(_0xad78('0x5'));var fs=require('fs');var path=require(_0xad78('0x6'));var rimraf=require(_0xad78('0x7'));var config=require('../../config/environment');var attributes=require(_0xad78('0x8'));module[_0xad78('0x9')]=function(_0x502ff2,_0x435ef1){return _0x502ff2[_0xad78('0xa')]('Template',attributes,{'tableName':_0xad78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index e9e9042..df52969 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 _0x1a67=['stringify','error','code','Template,\x20%s,\x20%s','message','info','result','catch','GetTemplate','Template','findAll','options','where','limit','include','model','attributes','map','debug','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','request\x20sent','Template,\x20%s,\x20%s,\x20%s'];(function(_0x4c112d,_0x20c0cc){var _0xd3ba42=function(_0x2b2233){while(--_0x2b2233){_0x4c112d['push'](_0x4c112d['shift']());}};_0xd3ba42(++_0x20c0cc);}(_0x1a67,0x1c5));var _0x71a6=function(_0x4c5a01,_0x425581){_0x4c5a01=_0x4c5a01-0x0;var _0x460655=_0x1a67[_0x4c5a01];return _0x460655;};'use strict';var _=require(_0x71a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x71a6('0x1'));var rs=require(_0x71a6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71a6('0x3'))['db'];var utils=require(_0x71a6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x71a6('0x5'));var jayson=require(_0x71a6('0x6'));var client=jayson[_0x71a6('0x7')][_0x71a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b0639,_0x19a03d,_0x236196){return new BPromise(function(_0x2da358,_0x477db7){return client['request'](_0x1b0639,_0x236196)[_0x71a6('0x9')](function(_0x310f92){logger['info']('Template,\x20%s,\x20%s',_0x19a03d,_0x71a6('0xa'));logger['debug'](_0x71a6('0xb'),_0x19a03d,_0x71a6('0xa'),JSON[_0x71a6('0xc')](_0x310f92));if(_0x310f92[_0x71a6('0xd')]){if(_0x310f92[_0x71a6('0xd')][_0x71a6('0xe')]===0x1f4){logger[_0x71a6('0xd')](_0x71a6('0xf'),_0x19a03d,_0x310f92[_0x71a6('0xd')][_0x71a6('0x10')]);return _0x477db7(_0x310f92[_0x71a6('0xd')][_0x71a6('0x10')]);}logger[_0x71a6('0xd')]('Template,\x20%s,\x20%s',_0x19a03d,_0x310f92[_0x71a6('0xd')]['message']);return _0x2da358(_0x310f92[_0x71a6('0xd')][_0x71a6('0x10')]);}else{logger[_0x71a6('0x11')](_0x71a6('0xf'),_0x19a03d,_0x71a6('0xa'));_0x2da358(_0x310f92[_0x71a6('0x12')][_0x71a6('0x10')]);}})[_0x71a6('0x13')](function(_0xc8ed30){logger['error'](_0x71a6('0xf'),_0x19a03d,_0xc8ed30);_0x477db7(_0xc8ed30);});});}exports[_0x71a6('0x14')]=function(_0x323767){var _0x3d1d7e=this;return new Promise(function(_0x52142f,_0x3889ba){return db[_0x71a6('0x15')][_0x71a6('0x16')]({'raw':_0x323767[_0x71a6('0x17')]?_0x323767[_0x71a6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x323767[_0x71a6('0x17')]?_0x323767[_0x71a6('0x17')][_0x71a6('0x18')]||null:null,'attributes':_0x323767[_0x71a6('0x17')]?_0x323767[_0x71a6('0x17')]['attributes']||null:null,'limit':_0x323767[_0x71a6('0x17')]?_0x323767[_0x71a6('0x17')][_0x71a6('0x19')]||null:null,'include':_0x323767[_0x71a6('0x17')]?_0x323767[_0x71a6('0x17')][_0x71a6('0x1a')]?_['map'](_0x323767['options'][_0x71a6('0x1a')],function(_0x507d0d){return{'model':db[_0x507d0d[_0x71a6('0x1b')]],'as':_0x507d0d['as'],'attributes':_0x507d0d[_0x71a6('0x1c')],'include':_0x507d0d[_0x71a6('0x1a')]?_[_0x71a6('0x1d')](_0x507d0d['include'],function(_0x481daa){return{'model':db[_0x481daa[_0x71a6('0x1b')]],'as':_0x481daa['as'],'attributes':_0x481daa[_0x71a6('0x1c')],'include':_0x481daa[_0x71a6('0x1a')]?_['map'](_0x481daa[_0x71a6('0x1a')],function(_0xa0d0d7){return{'model':db[_0xa0d0d7['model']],'as':_0xa0d0d7['as'],'attributes':_0xa0d0d7[_0x71a6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x71a6('0x9')](function(_0x112b2a){logger[_0x71a6('0x11')](_0x71a6('0x14'),_0x323767);logger[_0x71a6('0x1e')](_0x71a6('0x14'),_0x323767,JSON[_0x71a6('0xc')](_0x112b2a));_0x52142f(_0x112b2a);})[_0x71a6('0x13')](function(_0x4e0f74){logger['error'](_0x71a6('0x14'),_0x4e0f74[_0x71a6('0x10')],_0x323767);_0x3889ba(_0x3d1d7e['error'](0x1f4,_0x4e0f74[_0x71a6('0x10')]));});});}; \ No newline at end of file +var _0x3e2d=['jayson/promise','client','request','then','request\x20sent','debug','stringify','error','Template,\x20%s,\x20%s','message','info','result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x105aa6,_0x911682){var _0x29f653=function(_0x4b8990){while(--_0x4b8990){_0x105aa6['push'](_0x105aa6['shift']());}};_0x29f653(++_0x911682);}(_0x3e2d,0x142));var _0xd3e2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3e2d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd3e2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3e2('0x1'));var fs=require('fs');var Redis=require(_0xd3e2('0x2'));var db=require(_0xd3e2('0x3'))['db'];var utils=require(_0xd3e2('0x4'));var logger=require(_0xd3e2('0x5'))(_0xd3e2('0x6'));var config=require(_0xd3e2('0x7'));var jayson=require(_0xd3e2('0x8'));var client=jayson[_0xd3e2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d2b2,_0x52ab59,_0xc7d9b0){return new BPromise(function(_0x4ba980,_0x4ec205){return client[_0xd3e2('0xa')](_0x40d2b2,_0xc7d9b0)[_0xd3e2('0xb')](function(_0x4162e4){logger['info']('Template,\x20%s,\x20%s',_0x52ab59,_0xd3e2('0xc'));logger[_0xd3e2('0xd')]('Template,\x20%s,\x20%s,\x20%s',_0x52ab59,_0xd3e2('0xc'),JSON[_0xd3e2('0xe')](_0x4162e4));if(_0x4162e4[_0xd3e2('0xf')]){if(_0x4162e4[_0xd3e2('0xf')]['code']===0x1f4){logger[_0xd3e2('0xf')](_0xd3e2('0x10'),_0x52ab59,_0x4162e4[_0xd3e2('0xf')][_0xd3e2('0x11')]);return _0x4ec205(_0x4162e4[_0xd3e2('0xf')]['message']);}logger[_0xd3e2('0xf')](_0xd3e2('0x10'),_0x52ab59,_0x4162e4[_0xd3e2('0xf')]['message']);return _0x4ba980(_0x4162e4['error'][_0xd3e2('0x11')]);}else{logger[_0xd3e2('0x12')](_0xd3e2('0x10'),_0x52ab59,_0xd3e2('0xc'));_0x4ba980(_0x4162e4[_0xd3e2('0x13')][_0xd3e2('0x11')]);}})[_0xd3e2('0x14')](function(_0x3d1ad2){logger['error']('Template,\x20%s,\x20%s',_0x52ab59,_0x3d1ad2);_0x4ec205(_0x3d1ad2);});});}exports[_0xd3e2('0x15')]=function(_0x4951e8){var _0x5b3b21=this;return new Promise(function(_0x1996c4,_0x14d8b5){return db[_0xd3e2('0x16')][_0xd3e2('0x17')]({'raw':_0x4951e8[_0xd3e2('0x18')]?_0x4951e8[_0xd3e2('0x18')][_0xd3e2('0x19')]===undefined?!![]:![]:!![],'where':_0x4951e8['options']?_0x4951e8['options']['where']||null:null,'attributes':_0x4951e8[_0xd3e2('0x18')]?_0x4951e8['options'][_0xd3e2('0x1a')]||null:null,'limit':_0x4951e8[_0xd3e2('0x18')]?_0x4951e8[_0xd3e2('0x18')][_0xd3e2('0x1b')]||null:null,'include':_0x4951e8['options']?_0x4951e8[_0xd3e2('0x18')][_0xd3e2('0x1c')]?_[_0xd3e2('0x1d')](_0x4951e8['options'][_0xd3e2('0x1c')],function(_0x1e3cef){return{'model':db[_0x1e3cef['model']],'as':_0x1e3cef['as'],'attributes':_0x1e3cef[_0xd3e2('0x1a')],'include':_0x1e3cef['include']?_[_0xd3e2('0x1d')](_0x1e3cef[_0xd3e2('0x1c')],function(_0x45484d){return{'model':db[_0x45484d['model']],'as':_0x45484d['as'],'attributes':_0x45484d[_0xd3e2('0x1a')],'include':_0x45484d['include']?_[_0xd3e2('0x1d')](_0x45484d[_0xd3e2('0x1c')],function(_0x419d93){return{'model':db[_0x419d93['model']],'as':_0x419d93['as'],'attributes':_0x419d93[_0xd3e2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd3e2('0xb')](function(_0xcf4592){logger['info'](_0xd3e2('0x15'),_0x4951e8);logger['debug'](_0xd3e2('0x15'),_0x4951e8,JSON['stringify'](_0xcf4592));_0x1996c4(_0xcf4592);})['catch'](function(_0x133969){logger[_0xd3e2('0xf')](_0xd3e2('0x15'),_0x133969[_0xd3e2('0x11')],_0x4951e8);_0x14d8b5(_0x5b3b21[_0xd3e2('0xf')](0x1f4,_0x133969[_0xd3e2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index faee33c..978cf7a 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 _0x12d0=['/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x12d0,0x1be));var _0x012d=function(_0x30b33d,_0x115074){_0x30b33d=_0x30b33d-0x0;var _0x30a83f=_0x12d0[_0x30b33d];return _0x30a83f;};'use strict';var multer=require(_0x012d('0x0'));var util=require(_0x012d('0x1'));var path=require(_0x012d('0x2'));var timeout=require(_0x012d('0x3'));var express=require(_0x012d('0x4'));var router=express[_0x012d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x012d('0x6'));var interaction=require(_0x012d('0x7'));var config=require(_0x012d('0x8'));var controller=require(_0x012d('0x9'));router[_0x012d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x012d('0xa')]('/:id',auth[_0x012d('0xb')](),controller['show']);router[_0x012d('0xa')](_0x012d('0xc'),auth[_0x012d('0xb')](),controller['getAllConditions']);router[_0x012d('0xa')](_0x012d('0xd'),auth[_0x012d('0xb')](),controller['getAnyConditions']);router[_0x012d('0xa')](_0x012d('0xe'),auth[_0x012d('0xb')](),controller[_0x012d('0xf')]);router[_0x012d('0x10')]('/',auth['isAuthenticated'](),controller[_0x012d('0x11')]);router[_0x012d('0x10')](_0x012d('0xc'),auth[_0x012d('0xb')](),controller[_0x012d('0x12')]);router[_0x012d('0x10')](_0x012d('0xd'),auth['isAuthenticated'](),controller[_0x012d('0x13')]);router[_0x012d('0x10')]('/:id/actions',auth[_0x012d('0xb')](),controller[_0x012d('0x14')]);router[_0x012d('0x15')](_0x012d('0x16'),auth[_0x012d('0xb')](),controller[_0x012d('0x17')]);router[_0x012d('0x18')](_0x012d('0x16'),auth[_0x012d('0xb')](),controller['destroy']);module[_0x012d('0x19')]=router; \ No newline at end of file +var _0xcba4=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./trigger.controller','isAuthenticated','index','/:id','show','get','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAnyCondition','delete'];(function(_0x1125ea,_0x3799c9){var _0x516ac1=function(_0x2b7d73){while(--_0x2b7d73){_0x1125ea['push'](_0x1125ea['shift']());}};_0x516ac1(++_0x3799c9);}(_0xcba4,0x109));var _0x4cba=function(_0x2fc392,_0x4c14c1){_0x2fc392=_0x2fc392-0x0;var _0x382775=_0xcba4[_0x2fc392];return _0x382775;};'use strict';var multer=require(_0x4cba('0x0'));var util=require(_0x4cba('0x1'));var path=require(_0x4cba('0x2'));var timeout=require(_0x4cba('0x3'));var express=require('express');var router=express[_0x4cba('0x4')]();var fs_extra=require(_0x4cba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4cba('0x6'));var config=require('../../config/environment');var controller=require(_0x4cba('0x7'));router['get']('/',auth[_0x4cba('0x8')](),controller[_0x4cba('0x9')]);router['get'](_0x4cba('0xa'),auth[_0x4cba('0x8')](),controller[_0x4cba('0xb')]);router[_0x4cba('0xc')](_0x4cba('0xd'),auth[_0x4cba('0x8')](),controller['getAllConditions']);router['get'](_0x4cba('0xe'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x4cba('0xc')](_0x4cba('0xf'),auth[_0x4cba('0x8')](),controller[_0x4cba('0x10')]);router[_0x4cba('0x11')]('/',auth[_0x4cba('0x8')](),controller[_0x4cba('0x12')]);router[_0x4cba('0x11')](_0x4cba('0xd'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0x4cba('0x11')](_0x4cba('0xe'),auth[_0x4cba('0x8')](),controller[_0x4cba('0x13')]);router[_0x4cba('0x11')](_0x4cba('0xf'),auth[_0x4cba('0x8')](),controller['addAction']);router['put'](_0x4cba('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4cba('0x14')](_0x4cba('0xa'),auth[_0x4cba('0x8')](),controller['destroy']);module[_0x4cba('0x15')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index c725bda..c6ab524 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 _0xbc00=['exports','STRING','BOOLEAN','sequelize'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0xbc00,0x107));var _0x0bc0=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0xbc00[_0x44b3bd];return _0x1efc4a;};'use strict';var Sequelize=require(_0x0bc0('0x0'));module[_0x0bc0('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0bc0('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x0bc0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd15c=['BOOLEAN','exports','STRING'];(function(_0x23e64b,_0x10c5de){var _0x36e55a=function(_0x3689aa){while(--_0x3689aa){_0x23e64b['push'](_0x23e64b['shift']());}};_0x36e55a(++_0x10c5de);}(_0xd15c,0x79));var _0xcd15=function(_0x3c15b2,_0x6f238a){_0x3c15b2=_0x3c15b2-0x0;var _0x505c56=_0xd15c[_0x3c15b2];return _0x505c56;};'use strict';var Sequelize=require('sequelize');module[_0xcd15('0x0')]={'name':{'type':Sequelize[_0xcd15('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xcd15('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 67c9a6f..b8ab284 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 _0x9d3c=['zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','Trigger','include','findAll','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf'];(function(_0x1718b5,_0x1cd76b){var _0x486aa4=function(_0x4777be){while(--_0x4777be){_0x1718b5['push'](_0x1718b5['shift']());}};_0x486aa4(++_0x1cd76b);}(_0x9d3c,0xc8));var _0xc9d3=function(_0x1f91e7,_0x3291c2){_0x1f91e7=_0x1f91e7-0x0;var _0x79817a=_0x9d3c[_0x1f91e7];return _0x79817a;};'use strict';var emlformat=require(_0xc9d3('0x0'));var rimraf=require(_0xc9d3('0x1'));var zipdir=require(_0xc9d3('0x2'));var jsonpatch=require(_0xc9d3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc9d3('0x4'));var Mustache=require('mustache');var util=require(_0xc9d3('0x5'));var path=require(_0xc9d3('0x6'));var sox=require('sox');var csv=require(_0xc9d3('0x7'));var ejs=require(_0xc9d3('0x8'));var fs=require('fs');var fs_extra=require(_0xc9d3('0x9'));var _=require(_0xc9d3('0xa'));var squel=require(_0xc9d3('0xb'));var crypto=require(_0xc9d3('0xc'));var jsforce=require(_0xc9d3('0xd'));var deskjs=require(_0xc9d3('0xe'));var toCsv=require(_0xc9d3('0x7'));var querystring=require('querystring');var Papa=require(_0xc9d3('0xf'));var Redis=require(_0xc9d3('0x10'));var authService=require(_0xc9d3('0x11'));var qs=require(_0xc9d3('0x12'));var as=require(_0xc9d3('0x13'));var hardwareService=require(_0xc9d3('0x14'));var logger=require(_0xc9d3('0x15'))(_0xc9d3('0x16'));var utils=require(_0xc9d3('0x17'));var config=require(_0xc9d3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9d3('0x19'))['db'];function respondWithStatusCode(_0x322bbb,_0x7fae4b){_0x7fae4b=_0x7fae4b||0xcc;return function(_0x3f428a){if(_0x3f428a){return _0x322bbb[_0xc9d3('0x1a')](_0x7fae4b);}return _0x322bbb[_0xc9d3('0x1b')](_0x7fae4b)['end']();};}function respondWithResult(_0x114df7,_0x27998c){_0x27998c=_0x27998c||0xc8;return function(_0xd4283){if(_0xd4283){return _0x114df7[_0xc9d3('0x1b')](_0x27998c)[_0xc9d3('0x1c')](_0xd4283);}};}function respondWithFilteredResult(_0x52c1f7,_0x4529e8){return function(_0x2ebe38){if(_0x2ebe38){var _0x44222c=typeof _0x4529e8[_0xc9d3('0x1d')]===_0xc9d3('0x1e')&&typeof _0x4529e8[_0xc9d3('0x1f')]===_0xc9d3('0x1e');var _0x804e7c=_0x2ebe38['count'];var _0x36c8da=_0x44222c?0x0:_0x4529e8[_0xc9d3('0x1d')];var _0x221a99=_0x44222c?_0x2ebe38[_0xc9d3('0x20')]:_0x4529e8[_0xc9d3('0x1d')]+_0x4529e8[_0xc9d3('0x1f')];var _0x24a48b;if(_0x221a99>=_0x804e7c){_0x221a99=_0x804e7c;_0x24a48b=0xc8;}else{_0x24a48b=0xce;}_0x52c1f7[_0xc9d3('0x1b')](_0x24a48b);return _0x52c1f7[_0xc9d3('0x21')](_0xc9d3('0x22'),_0x36c8da+'-'+_0x221a99+'/'+_0x804e7c)[_0xc9d3('0x1c')](_0x2ebe38);}return null;};}function patchUpdates(_0x179f28){return function(_0xde3c9){try{jsonpatch['apply'](_0xde3c9,_0x179f28,!![]);}catch(_0x37824a){return BPromise[_0xc9d3('0x23')](_0x37824a);}return _0xde3c9[_0xc9d3('0x24')]();};}function saveUpdates(_0x1c3c69,_0x3fb0d8){return function(_0x96c9e6){if(_0x96c9e6){return _0x96c9e6[_0xc9d3('0x25')](_0x1c3c69)[_0xc9d3('0x26')](function(_0x28d6dd){return _0x28d6dd;});}return null;};}function removeEntity(_0x4ec956,_0x5572c8){return function(_0x3ff2f0){if(_0x3ff2f0){return _0x3ff2f0[_0xc9d3('0x27')]()[_0xc9d3('0x26')](function(){var _0x1512a6=_0x3ff2f0[_0xc9d3('0x28')]({'plain':!![]});var _0x57ac6c='Triggers';return db[_0xc9d3('0x29')]['destroy']({'where':{'type':_0x57ac6c,'resourceId':_0x1512a6['id']}})['then'](function(){return _0x3ff2f0;});})[_0xc9d3('0x26')](function(){_0x4ec956[_0xc9d3('0x1b')](0xcc)[_0xc9d3('0x2a')]();});}};}function handleEntityNotFound(_0x2eb07d,_0x4af227){return function(_0x232d3d){if(!_0x232d3d){_0x2eb07d[_0xc9d3('0x1a')](0x194);}return _0x232d3d;};}function handleError(_0xf172eb,_0x3654a5){_0x3654a5=_0x3654a5||0x1f4;return function(_0x3d6ce2){logger['error'](_0x3d6ce2[_0xc9d3('0x2b')]);if(_0x3d6ce2[_0xc9d3('0x2c')]){delete _0x3d6ce2[_0xc9d3('0x2c')];}_0xf172eb['status'](_0x3654a5)[_0xc9d3('0x2d')](_0x3d6ce2);};}exports[_0xc9d3('0x2e')]=function(_0x2719d0,_0x8a7f29){var _0x3c1369={},_0x24fb91={},_0x237cbe={'count':0x0,'rows':[]};var _0x22aa11=_[_0xc9d3('0x2f')](db['Trigger'][_0xc9d3('0x30')],function(_0x23bc3a){return{'name':_0x23bc3a[_0xc9d3('0x31')],'type':_0x23bc3a[_0xc9d3('0x32')][_0xc9d3('0x33')]};});_0x24fb91[_0xc9d3('0x34')]=_[_0xc9d3('0x2f')](_0x22aa11,'name');_0x24fb91[_0xc9d3('0x35')]=_[_0xc9d3('0x36')](_0x2719d0[_0xc9d3('0x35')]);_0x24fb91[_0xc9d3('0x37')]=_[_0xc9d3('0x38')](_0x24fb91['model'],_0x24fb91[_0xc9d3('0x35')]);_0x3c1369['attributes']=_[_0xc9d3('0x38')](_0x24fb91[_0xc9d3('0x34')],qs[_0xc9d3('0x39')](_0x2719d0['query'][_0xc9d3('0x39')]));_0x3c1369[_0xc9d3('0x3a')]=_0x3c1369[_0xc9d3('0x3a')][_0xc9d3('0x3b')]?_0x3c1369[_0xc9d3('0x3a')]:_0x24fb91['model'];if(!_0x2719d0[_0xc9d3('0x35')]['hasOwnProperty'](_0xc9d3('0x3c'))){_0x3c1369[_0xc9d3('0x1f')]=qs['limit'](_0x2719d0[_0xc9d3('0x35')][_0xc9d3('0x1f')]);_0x3c1369[_0xc9d3('0x1d')]=qs['offset'](_0x2719d0[_0xc9d3('0x35')][_0xc9d3('0x1d')]);}_0x3c1369[_0xc9d3('0x3d')]=qs[_0xc9d3('0x3e')](_0x2719d0[_0xc9d3('0x35')][_0xc9d3('0x3e')]);_0x3c1369['where']=qs['filters'](_[_0xc9d3('0x3f')](_0x2719d0['query'],_0x24fb91[_0xc9d3('0x37')]),_0x22aa11);if(_0x2719d0[_0xc9d3('0x35')]['filter']){_0x3c1369[_0xc9d3('0x40')]=_['merge'](_0x3c1369[_0xc9d3('0x40')],{'$or':_[_0xc9d3('0x2f')](_0x22aa11,function(_0x1cc6d4){if(_0x1cc6d4[_0xc9d3('0x32')]!==_0xc9d3('0x41')){var _0x1f4e07={};_0x1f4e07[_0x1cc6d4[_0xc9d3('0x2c')]]={'$like':'%'+_0x2719d0[_0xc9d3('0x35')][_0xc9d3('0x42')]+'%'};return _0x1f4e07;}})});}_0x3c1369=_[_0xc9d3('0x43')]({},_0x3c1369,_0x2719d0[_0xc9d3('0x44')]);var _0x14db3d={'where':_0x3c1369[_0xc9d3('0x40')]};return db[_0xc9d3('0x45')]['count'](_0x14db3d)[_0xc9d3('0x26')](function(_0x3e696f){_0x237cbe[_0xc9d3('0x20')]=_0x3e696f;if(_0x2719d0[_0xc9d3('0x35')]['includeAll']){_0x3c1369[_0xc9d3('0x46')]=[{'all':!![]}];}return db[_0xc9d3('0x45')][_0xc9d3('0x47')](_0x3c1369);})['then'](function(_0x1c96e9){_0x237cbe['rows']=_0x1c96e9;return _0x237cbe;})[_0xc9d3('0x26')](respondWithFilteredResult(_0x8a7f29,_0x3c1369))['catch'](handleError(_0x8a7f29,null));};exports[_0xc9d3('0x48')]=function(_0x2ddd58,_0x5f5de4){var _0x943a45={'raw':![],'where':{'id':_0x2ddd58['params']['id']}},_0x208546={};_0x208546[_0xc9d3('0x34')]=_[_0xc9d3('0x36')](db[_0xc9d3('0x45')][_0xc9d3('0x30')]);_0x208546[_0xc9d3('0x35')]=_[_0xc9d3('0x36')](_0x2ddd58['query']);_0x208546[_0xc9d3('0x37')]=_[_0xc9d3('0x38')](_0x208546['model'],_0x208546['query']);_0x943a45['attributes']=_['intersection'](_0x208546[_0xc9d3('0x34')],qs['fields'](_0x2ddd58['query']['fields']));_0x943a45['attributes']=_0x943a45[_0xc9d3('0x3a')][_0xc9d3('0x3b')]?_0x943a45[_0xc9d3('0x3a')]:_0x208546[_0xc9d3('0x34')];if(_0x2ddd58[_0xc9d3('0x35')][_0xc9d3('0x49')]){_0x943a45[_0xc9d3('0x46')]=[{'all':!![]}];}_0x943a45=_['merge']({},_0x943a45,_0x2ddd58[_0xc9d3('0x44')]);return db[_0xc9d3('0x45')][_0xc9d3('0x4a')](_0x943a45)[_0xc9d3('0x26')](handleEntityNotFound(_0x5f5de4,null))[_0xc9d3('0x26')](respondWithResult(_0x5f5de4,null))['catch'](handleError(_0x5f5de4,null));};exports[_0xc9d3('0x4b')]=function(_0x3b4ba4,_0x1b8aed){return db[_0xc9d3('0x45')][_0xc9d3('0x4b')](_0x3b4ba4[_0xc9d3('0x4c')],{})[_0xc9d3('0x26')](function(_0x31f76c){var _0x36591c=_0x3b4ba4[_0xc9d3('0x4d')][_0xc9d3('0x28')]({'plain':!![]});if(!_0x36591c)throw new Error(_0xc9d3('0x4e'));if(_0x36591c[_0xc9d3('0x4f')]==='user'){var _0x3dc29d=_0x31f76c[_0xc9d3('0x28')]({'plain':!![]});var _0x1a9c9a=_0xc9d3('0x50');return db[_0xc9d3('0x51')]['find']({'where':{'name':_0x1a9c9a,'userProfileId':_0x36591c[_0xc9d3('0x52')]},'raw':!![]})[_0xc9d3('0x26')](function(_0x51ec67){if(_0x51ec67&&_0x51ec67[_0xc9d3('0x53')]===0x0){return db[_0xc9d3('0x29')][_0xc9d3('0x4b')]({'name':_0x3dc29d['name'],'resourceId':_0x3dc29d['id'],'type':_0x51ec67[_0xc9d3('0x2c')],'sectionId':_0x51ec67['id']},{})['then'](function(){return _0x31f76c;});}else{return _0x31f76c;}})[_0xc9d3('0x54')](function(_0x1f299e){logger[_0xc9d3('0x55')](_0xc9d3('0x56'),_0x1f299e);throw _0x1f299e;});}return _0x31f76c;})[_0xc9d3('0x26')](respondWithResult(_0x1b8aed,0xc9))[_0xc9d3('0x54')](handleError(_0x1b8aed,null));};exports[_0xc9d3('0x25')]=function(_0x4bc85a,_0x2e3d4f){if(_0x4bc85a[_0xc9d3('0x4c')]['id']){delete _0x4bc85a[_0xc9d3('0x4c')]['id'];}return db[_0xc9d3('0x45')]['find']({'where':{'id':_0x4bc85a[_0xc9d3('0x57')]['id']}})[_0xc9d3('0x26')](handleEntityNotFound(_0x2e3d4f,null))[_0xc9d3('0x26')](saveUpdates(_0x4bc85a[_0xc9d3('0x4c')],null))[_0xc9d3('0x26')](respondWithResult(_0x2e3d4f,null))[_0xc9d3('0x54')](handleError(_0x2e3d4f,null));};exports[_0xc9d3('0x27')]=function(_0x4374b0,_0x267da7){return db['Trigger'][_0xc9d3('0x4a')]({'where':{'id':_0x4374b0[_0xc9d3('0x57')]['id']}})[_0xc9d3('0x26')](handleEntityNotFound(_0x267da7,null))['then'](removeEntity(_0x267da7,null))[_0xc9d3('0x54')](handleError(_0x267da7,null));};exports[_0xc9d3('0x58')]=function(_0xdff9b1,_0x4add55,_0x2ce7cb){if(_0xdff9b1['body']['id']){delete _0xdff9b1[_0xc9d3('0x4c')]['id'];}return db[_0xc9d3('0x45')]['find']({'where':{'id':_0xdff9b1[_0xc9d3('0x57')]['id']}})[_0xc9d3('0x26')](handleEntityNotFound(_0x4add55,null))[_0xc9d3('0x26')](function(_0x1b48bd){if(_0x1b48bd){_0xdff9b1['body'][_0xc9d3('0x59')]=_0x1b48bd['id'];return db[_0xc9d3('0x5a')][_0xc9d3('0x4b')](_0xdff9b1['body']);}})[_0xc9d3('0x26')](respondWithResult(_0x4add55,null))[_0xc9d3('0x54')](handleError(_0x4add55,null));};exports[_0xc9d3('0x5b')]=function(_0x59266e,_0x43f8f7,_0x5f0478){if(_0x59266e[_0xc9d3('0x4c')]['id']){delete _0x59266e[_0xc9d3('0x4c')]['id'];}return db['Trigger'][_0xc9d3('0x4a')]({'where':{'id':_0x59266e[_0xc9d3('0x57')]['id']}})[_0xc9d3('0x26')](handleEntityNotFound(_0x43f8f7,null))['then'](function(_0x305f7b){if(_0x305f7b){_0x59266e[_0xc9d3('0x4c')][_0xc9d3('0x5c')]=_0x305f7b['id'];return db[_0xc9d3('0x5a')][_0xc9d3('0x4b')](_0x59266e[_0xc9d3('0x4c')]);}})['then'](respondWithResult(_0x43f8f7,null))['catch'](handleError(_0x43f8f7,null));};exports[_0xc9d3('0x5d')]=function(_0x270c22,_0x1251e6,_0x1cfad4){var _0x47b6b2={};var _0x1930e5={};var _0x622ca8;var _0xebc94f;return db[_0xc9d3('0x45')][_0xc9d3('0x5e')]({'where':{'id':_0x270c22[_0xc9d3('0x57')]['id']}})['then'](handleEntityNotFound(_0x1251e6,null))[_0xc9d3('0x26')](function(_0x5cd7bc){if(_0x5cd7bc){_0x622ca8=_0x5cd7bc;_0x1930e5[_0xc9d3('0x34')]=_['keys'](db[_0xc9d3('0x5a')][_0xc9d3('0x30')]);_0x1930e5['query']=_[_0xc9d3('0x36')](_0x270c22[_0xc9d3('0x35')]);_0x1930e5['filters']=_[_0xc9d3('0x38')](_0x1930e5[_0xc9d3('0x34')],_0x1930e5[_0xc9d3('0x35')]);_0x47b6b2[_0xc9d3('0x3a')]=_['intersection'](_0x1930e5[_0xc9d3('0x34')],qs[_0xc9d3('0x39')](_0x270c22[_0xc9d3('0x35')]['fields']));_0x47b6b2['attributes']=_0x47b6b2['attributes']['length']?_0x47b6b2[_0xc9d3('0x3a')]:_0x1930e5[_0xc9d3('0x34')];_0x47b6b2['order']=qs['sort'](_0x270c22[_0xc9d3('0x35')][_0xc9d3('0x3e')]);_0x47b6b2[_0xc9d3('0x40')]=qs[_0xc9d3('0x37')](_[_0xc9d3('0x3f')](_0x270c22[_0xc9d3('0x35')],_0x1930e5['filters']));if(_0x270c22['query'][_0xc9d3('0x42')]){_0x47b6b2[_0xc9d3('0x40')]=_['merge'](_0x47b6b2[_0xc9d3('0x40')],{'$or':_[_0xc9d3('0x2f')](_0x47b6b2[_0xc9d3('0x3a')],function(_0x4f79b8){var _0x5040ea={};_0x5040ea[_0x4f79b8]={'$like':'%'+_0x270c22['query']['filter']+'%'};return _0x5040ea;})});}_0x47b6b2=_[_0xc9d3('0x43')]({},_0x47b6b2,_0x270c22[_0xc9d3('0x44')]);return _0x622ca8[_0xc9d3('0x5d')](_0x47b6b2);}})[_0xc9d3('0x26')](function(_0x50fd93){if(_0x50fd93){_0xebc94f=_0x50fd93[_0xc9d3('0x3b')];if(!_0x270c22[_0xc9d3('0x35')][_0xc9d3('0x5f')]('nolimit')){_0x47b6b2[_0xc9d3('0x1f')]=qs['limit'](_0x270c22[_0xc9d3('0x35')][_0xc9d3('0x1f')]);_0x47b6b2[_0xc9d3('0x1d')]=qs[_0xc9d3('0x1d')](_0x270c22[_0xc9d3('0x35')][_0xc9d3('0x1d')]);}return _0x622ca8['getAllConditions'](_0x47b6b2);}})['then'](function(_0x27de2b){if(_0x27de2b){return _0x27de2b?{'count':_0xebc94f,'rows':_0x27de2b}:null;}})[_0xc9d3('0x26')](respondWithResult(_0x1251e6,null))['catch'](handleError(_0x1251e6,null));};exports[_0xc9d3('0x60')]=function(_0x50c397,_0x31afb0,_0x167ace){var _0x4a353d={};var _0x20c651={};var _0x200101;var _0x6d2e99;return db['Trigger']['findOne']({'where':{'id':_0x50c397[_0xc9d3('0x57')]['id']}})[_0xc9d3('0x26')](handleEntityNotFound(_0x31afb0,null))[_0xc9d3('0x26')](function(_0x81f25f){if(_0x81f25f){_0x200101=_0x81f25f;_0x20c651[_0xc9d3('0x34')]=_[_0xc9d3('0x36')](db[_0xc9d3('0x5a')]['rawAttributes']);_0x20c651[_0xc9d3('0x35')]=_[_0xc9d3('0x36')](_0x50c397[_0xc9d3('0x35')]);_0x20c651['filters']=_[_0xc9d3('0x38')](_0x20c651[_0xc9d3('0x34')],_0x20c651[_0xc9d3('0x35')]);_0x4a353d[_0xc9d3('0x3a')]=_[_0xc9d3('0x38')](_0x20c651['model'],qs[_0xc9d3('0x39')](_0x50c397[_0xc9d3('0x35')][_0xc9d3('0x39')]));_0x4a353d[_0xc9d3('0x3a')]=_0x4a353d[_0xc9d3('0x3a')][_0xc9d3('0x3b')]?_0x4a353d[_0xc9d3('0x3a')]:_0x20c651['model'];_0x4a353d[_0xc9d3('0x3d')]=qs[_0xc9d3('0x3e')](_0x50c397[_0xc9d3('0x35')][_0xc9d3('0x3e')]);_0x4a353d['where']=qs[_0xc9d3('0x37')](_[_0xc9d3('0x3f')](_0x50c397['query'],_0x20c651[_0xc9d3('0x37')]));if(_0x50c397[_0xc9d3('0x35')]['filter']){_0x4a353d[_0xc9d3('0x40')]=_['merge'](_0x4a353d[_0xc9d3('0x40')],{'$or':_[_0xc9d3('0x2f')](_0x4a353d[_0xc9d3('0x3a')],function(_0x1218c4){var _0x2d4c40={};_0x2d4c40[_0x1218c4]={'$like':'%'+_0x50c397[_0xc9d3('0x35')][_0xc9d3('0x42')]+'%'};return _0x2d4c40;})});}_0x4a353d=_[_0xc9d3('0x43')]({},_0x4a353d,_0x50c397[_0xc9d3('0x44')]);return _0x200101['getAnyConditions'](_0x4a353d);}})[_0xc9d3('0x26')](function(_0x39b3fb){if(_0x39b3fb){_0x6d2e99=_0x39b3fb[_0xc9d3('0x3b')];if(!_0x50c397[_0xc9d3('0x35')][_0xc9d3('0x5f')]('nolimit')){_0x4a353d[_0xc9d3('0x1f')]=qs[_0xc9d3('0x1f')](_0x50c397['query'][_0xc9d3('0x1f')]);_0x4a353d[_0xc9d3('0x1d')]=qs[_0xc9d3('0x1d')](_0x50c397[_0xc9d3('0x35')][_0xc9d3('0x1d')]);}return _0x200101[_0xc9d3('0x60')](_0x4a353d);}})['then'](function(_0x499dbb){if(_0x499dbb){return _0x499dbb?{'count':_0x6d2e99,'rows':_0x499dbb}:null;}})['then'](respondWithResult(_0x31afb0,null))[_0xc9d3('0x54')](handleError(_0x31afb0,null));};exports[_0xc9d3('0x61')]=function(_0x23491b,_0x4ec93c,_0x5a8d6a){if(_0x23491b[_0xc9d3('0x4c')]['id']){delete _0x23491b['body']['id'];}return db[_0xc9d3('0x45')]['find']({'where':{'id':_0x23491b[_0xc9d3('0x57')]['id']}})[_0xc9d3('0x26')](handleEntityNotFound(_0x4ec93c,null))[_0xc9d3('0x26')](function(_0xf3da06){if(_0xf3da06){_0x23491b[_0xc9d3('0x4c')][_0xc9d3('0x62')]=_0xf3da06['id'];return db[_0xc9d3('0x63')][_0xc9d3('0x4b')](_0x23491b[_0xc9d3('0x4c')]);}})[_0xc9d3('0x26')](respondWithResult(_0x4ec93c,null))['catch'](handleError(_0x4ec93c,null));};exports[_0xc9d3('0x64')]=function(_0x1a76b3,_0x4b3820,_0x71349c){var _0x4bbd5b={};var _0x3c8f5b={};var _0x4090a0;var _0x4510ca;return db[_0xc9d3('0x45')][_0xc9d3('0x5e')]({'where':{'id':_0x1a76b3[_0xc9d3('0x57')]['id']}})['then'](handleEntityNotFound(_0x4b3820,null))[_0xc9d3('0x26')](function(_0x4e0a8e){if(_0x4e0a8e){_0x4090a0=_0x4e0a8e;_0x3c8f5b['model']=_[_0xc9d3('0x36')](db['Action'][_0xc9d3('0x30')]);_0x3c8f5b[_0xc9d3('0x35')]=_['keys'](_0x1a76b3[_0xc9d3('0x35')]);_0x3c8f5b['filters']=_[_0xc9d3('0x38')](_0x3c8f5b[_0xc9d3('0x34')],_0x3c8f5b[_0xc9d3('0x35')]);_0x4bbd5b[_0xc9d3('0x3a')]=_[_0xc9d3('0x38')](_0x3c8f5b[_0xc9d3('0x34')],qs['fields'](_0x1a76b3[_0xc9d3('0x35')][_0xc9d3('0x39')]));_0x4bbd5b[_0xc9d3('0x3a')]=_0x4bbd5b[_0xc9d3('0x3a')][_0xc9d3('0x3b')]?_0x4bbd5b[_0xc9d3('0x3a')]:_0x3c8f5b['model'];_0x4bbd5b[_0xc9d3('0x3d')]=qs[_0xc9d3('0x3e')](_0x1a76b3[_0xc9d3('0x35')][_0xc9d3('0x3e')]);_0x4bbd5b[_0xc9d3('0x40')]=qs[_0xc9d3('0x37')](_['pick'](_0x1a76b3['query'],_0x3c8f5b['filters']));if(_0x1a76b3[_0xc9d3('0x35')]['filter']){_0x4bbd5b[_0xc9d3('0x40')]=_[_0xc9d3('0x43')](_0x4bbd5b[_0xc9d3('0x40')],{'$or':_[_0xc9d3('0x2f')](_0x4bbd5b[_0xc9d3('0x3a')],function(_0x19bd54){var _0x5d453a={};_0x5d453a[_0x19bd54]={'$like':'%'+_0x1a76b3['query']['filter']+'%'};return _0x5d453a;})});}_0x4bbd5b=_['merge']({},_0x4bbd5b,_0x1a76b3['options']);return _0x4090a0['getActions'](_0x4bbd5b);}})['then'](function(_0x459674){if(_0x459674){_0x4510ca=_0x459674[_0xc9d3('0x3b')];if(!_0x1a76b3['query'][_0xc9d3('0x5f')](_0xc9d3('0x3c'))){_0x4bbd5b[_0xc9d3('0x1f')]=qs[_0xc9d3('0x1f')](_0x1a76b3[_0xc9d3('0x35')][_0xc9d3('0x1f')]);_0x4bbd5b[_0xc9d3('0x1d')]=qs['offset'](_0x1a76b3[_0xc9d3('0x35')]['offset']);}return _0x4090a0[_0xc9d3('0x64')](_0x4bbd5b);}})[_0xc9d3('0x26')](function(_0x1f26b6){if(_0x1f26b6){return _0x1f26b6?{'count':_0x4510ca,'rows':_0x1f26b6}:null;}})[_0xc9d3('0x26')](respondWithResult(_0x4b3820,null))[_0xc9d3('0x54')](handleError(_0x4b3820,null));}; \ No newline at end of file +var _0xb3b3=['Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','get','Triggers','sendStatus','error','stack','name','send','map','Trigger','rawAttributes','type','query','keys','model','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','intersection','create','body','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','findOne','order','getAllConditions','nolimit','getAnyConditions','pick','addAction','TriggerId'];(function(_0x79c5ca,_0x5f00a3){var _0x3643b5=function(_0x31d36d){while(--_0x31d36d){_0x79c5ca['push'](_0x79c5ca['shift']());}};_0x3643b5(++_0x5f00a3);}(_0xb3b3,0xba));var _0x3b3b=function(_0xe33a0e,_0xf3f311){_0xe33a0e=_0xe33a0e-0x0;var _0x4a06a6=_0xb3b3[_0xe33a0e];return _0x4a06a6;};'use strict';var emlformat=require(_0x3b3b('0x0'));var rimraf=require(_0x3b3b('0x1'));var zipdir=require(_0x3b3b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b3b('0x3'));var moment=require(_0x3b3b('0x4'));var BPromise=require(_0x3b3b('0x5'));var Mustache=require(_0x3b3b('0x6'));var util=require(_0x3b3b('0x7'));var path=require(_0x3b3b('0x8'));var sox=require(_0x3b3b('0x9'));var csv=require(_0x3b3b('0xa'));var ejs=require(_0x3b3b('0xb'));var fs=require('fs');var fs_extra=require(_0x3b3b('0xc'));var _=require(_0x3b3b('0xd'));var squel=require(_0x3b3b('0xe'));var crypto=require(_0x3b3b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3b3b('0x10'));var toCsv=require(_0x3b3b('0xa'));var querystring=require(_0x3b3b('0x11'));var Papa=require(_0x3b3b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b3b('0x13'));var hardwareService=require(_0x3b3b('0x14'));var logger=require(_0x3b3b('0x15'))('api');var utils=require(_0x3b3b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3b3b('0x17'));var db=require(_0x3b3b('0x18'))['db'];function respondWithStatusCode(_0x6837a5,_0x111758){_0x111758=_0x111758||0xcc;return function(_0x397808){if(_0x397808){return _0x6837a5['sendStatus'](_0x111758);}return _0x6837a5[_0x3b3b('0x19')](_0x111758)[_0x3b3b('0x1a')]();};}function respondWithResult(_0x711b82,_0x16a32b){_0x16a32b=_0x16a32b||0xc8;return function(_0x143582){if(_0x143582){return _0x711b82[_0x3b3b('0x19')](_0x16a32b)[_0x3b3b('0x1b')](_0x143582);}};}function respondWithFilteredResult(_0x11d0e1,_0x58ba06){return function(_0x3ea541){if(_0x3ea541){var _0x5ccced=typeof _0x58ba06[_0x3b3b('0x1c')]===_0x3b3b('0x1d')&&typeof _0x58ba06['limit']===_0x3b3b('0x1d');var _0x10f2fb=_0x3ea541[_0x3b3b('0x1e')];var _0x4912bc=_0x5ccced?0x0:_0x58ba06[_0x3b3b('0x1c')];var _0x54ba49=_0x5ccced?_0x3ea541[_0x3b3b('0x1e')]:_0x58ba06[_0x3b3b('0x1c')]+_0x58ba06[_0x3b3b('0x1f')];var _0x5432ab;if(_0x54ba49>=_0x10f2fb){_0x54ba49=_0x10f2fb;_0x5432ab=0xc8;}else{_0x5432ab=0xce;}_0x11d0e1[_0x3b3b('0x19')](_0x5432ab);return _0x11d0e1[_0x3b3b('0x20')]('Content-Range',_0x4912bc+'-'+_0x54ba49+'/'+_0x10f2fb)[_0x3b3b('0x1b')](_0x3ea541);}return null;};}function patchUpdates(_0x3df76d){return function(_0xd9d409){try{jsonpatch[_0x3b3b('0x21')](_0xd9d409,_0x3df76d,!![]);}catch(_0x956c59){return BPromise[_0x3b3b('0x22')](_0x956c59);}return _0xd9d409[_0x3b3b('0x23')]();};}function saveUpdates(_0x2ebea4,_0x3ee046){return function(_0x301bbf){if(_0x301bbf){return _0x301bbf['update'](_0x2ebea4)[_0x3b3b('0x24')](function(_0x41c554){return _0x41c554;});}return null;};}function removeEntity(_0x166591,_0x200b2b){return function(_0x5139bc){if(_0x5139bc){return _0x5139bc[_0x3b3b('0x25')]()['then'](function(){var _0xfff790=_0x5139bc[_0x3b3b('0x26')]({'plain':!![]});var _0x50de12=_0x3b3b('0x27');return db['UserProfileResource'][_0x3b3b('0x25')]({'where':{'type':_0x50de12,'resourceId':_0xfff790['id']}})[_0x3b3b('0x24')](function(){return _0x5139bc;});})[_0x3b3b('0x24')](function(){_0x166591[_0x3b3b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x546242,_0x1a3c4b){return function(_0x582f24){if(!_0x582f24){_0x546242[_0x3b3b('0x28')](0x194);}return _0x582f24;};}function handleError(_0x270051,_0x5af9e1){_0x5af9e1=_0x5af9e1||0x1f4;return function(_0x274289){logger[_0x3b3b('0x29')](_0x274289[_0x3b3b('0x2a')]);if(_0x274289[_0x3b3b('0x2b')]){delete _0x274289[_0x3b3b('0x2b')];}_0x270051[_0x3b3b('0x19')](_0x5af9e1)[_0x3b3b('0x2c')](_0x274289);};}exports['index']=function(_0x596c27,_0x405865){var _0xef5159={},_0x422c63={},_0x2973ff={'count':0x0,'rows':[]};var _0x253c07=_[_0x3b3b('0x2d')](db[_0x3b3b('0x2e')][_0x3b3b('0x2f')],function(_0x17fae8){return{'name':_0x17fae8['fieldName'],'type':_0x17fae8[_0x3b3b('0x30')]['key']};});_0x422c63['model']=_[_0x3b3b('0x2d')](_0x253c07,_0x3b3b('0x2b'));_0x422c63[_0x3b3b('0x31')]=_[_0x3b3b('0x32')](_0x596c27[_0x3b3b('0x31')]);_0x422c63['filters']=_['intersection'](_0x422c63[_0x3b3b('0x33')],_0x422c63[_0x3b3b('0x31')]);_0xef5159[_0x3b3b('0x34')]=_['intersection'](_0x422c63[_0x3b3b('0x33')],qs[_0x3b3b('0x35')](_0x596c27[_0x3b3b('0x31')]['fields']));_0xef5159[_0x3b3b('0x34')]=_0xef5159[_0x3b3b('0x34')][_0x3b3b('0x36')]?_0xef5159[_0x3b3b('0x34')]:_0x422c63['model'];if(!_0x596c27['query'][_0x3b3b('0x37')]('nolimit')){_0xef5159['limit']=qs[_0x3b3b('0x1f')](_0x596c27['query']['limit']);_0xef5159['offset']=qs[_0x3b3b('0x1c')](_0x596c27['query']['offset']);}_0xef5159['order']=qs['sort'](_0x596c27[_0x3b3b('0x31')][_0x3b3b('0x38')]);_0xef5159[_0x3b3b('0x39')]=qs['filters'](_['pick'](_0x596c27[_0x3b3b('0x31')],_0x422c63[_0x3b3b('0x3a')]),_0x253c07);if(_0x596c27[_0x3b3b('0x31')][_0x3b3b('0x3b')]){_0xef5159[_0x3b3b('0x39')]=_['merge'](_0xef5159[_0x3b3b('0x39')],{'$or':_[_0x3b3b('0x2d')](_0x253c07,function(_0x48814d){if(_0x48814d[_0x3b3b('0x30')]!=='VIRTUAL'){var _0x2ea997={};_0x2ea997[_0x48814d['name']]={'$like':'%'+_0x596c27[_0x3b3b('0x31')][_0x3b3b('0x3b')]+'%'};return _0x2ea997;}})});}_0xef5159=_[_0x3b3b('0x3c')]({},_0xef5159,_0x596c27[_0x3b3b('0x3d')]);var _0x499fd5={'where':_0xef5159[_0x3b3b('0x39')]};return db[_0x3b3b('0x2e')]['count'](_0x499fd5)['then'](function(_0x5d03a6){_0x2973ff['count']=_0x5d03a6;if(_0x596c27[_0x3b3b('0x31')][_0x3b3b('0x3e')]){_0xef5159[_0x3b3b('0x3f')]=[{'all':!![]}];}return db[_0x3b3b('0x2e')]['findAll'](_0xef5159);})[_0x3b3b('0x24')](function(_0x3f7583){_0x2973ff[_0x3b3b('0x40')]=_0x3f7583;return _0x2973ff;})['then'](respondWithFilteredResult(_0x405865,_0xef5159))[_0x3b3b('0x41')](handleError(_0x405865,null));};exports[_0x3b3b('0x42')]=function(_0x298c66,_0x3812dc){var _0x3454b7={'raw':![],'where':{'id':_0x298c66['params']['id']}},_0x21b6f3={};_0x21b6f3['model']=_[_0x3b3b('0x32')](db[_0x3b3b('0x2e')][_0x3b3b('0x2f')]);_0x21b6f3[_0x3b3b('0x31')]=_['keys'](_0x298c66[_0x3b3b('0x31')]);_0x21b6f3[_0x3b3b('0x3a')]=_[_0x3b3b('0x43')](_0x21b6f3[_0x3b3b('0x33')],_0x21b6f3[_0x3b3b('0x31')]);_0x3454b7[_0x3b3b('0x34')]=_[_0x3b3b('0x43')](_0x21b6f3['model'],qs[_0x3b3b('0x35')](_0x298c66['query']['fields']));_0x3454b7[_0x3b3b('0x34')]=_0x3454b7[_0x3b3b('0x34')][_0x3b3b('0x36')]?_0x3454b7['attributes']:_0x21b6f3['model'];if(_0x298c66[_0x3b3b('0x31')][_0x3b3b('0x3e')]){_0x3454b7[_0x3b3b('0x3f')]=[{'all':!![]}];}_0x3454b7=_['merge']({},_0x3454b7,_0x298c66[_0x3b3b('0x3d')]);return db[_0x3b3b('0x2e')]['find'](_0x3454b7)[_0x3b3b('0x24')](handleEntityNotFound(_0x3812dc,null))[_0x3b3b('0x24')](respondWithResult(_0x3812dc,null))[_0x3b3b('0x41')](handleError(_0x3812dc,null));};exports[_0x3b3b('0x44')]=function(_0x15d4fc,_0x1595c5){return db[_0x3b3b('0x2e')][_0x3b3b('0x44')](_0x15d4fc[_0x3b3b('0x45')],{})[_0x3b3b('0x24')](function(_0x2a513e){var _0x10e2bc=_0x15d4fc[_0x3b3b('0x46')][_0x3b3b('0x26')]({'plain':!![]});if(!_0x10e2bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10e2bc['role']===_0x3b3b('0x46')){var _0x3b6176=_0x2a513e[_0x3b3b('0x26')]({'plain':!![]});var _0xe12ca6=_0x3b3b('0x27');return db['UserProfileSection'][_0x3b3b('0x47')]({'where':{'name':_0xe12ca6,'userProfileId':_0x10e2bc[_0x3b3b('0x48')]},'raw':!![]})[_0x3b3b('0x24')](function(_0x3fb782){if(_0x3fb782&&_0x3fb782[_0x3b3b('0x49')]===0x0){return db[_0x3b3b('0x4a')][_0x3b3b('0x44')]({'name':_0x3b6176['name'],'resourceId':_0x3b6176['id'],'type':_0x3fb782['name'],'sectionId':_0x3fb782['id']},{})[_0x3b3b('0x24')](function(){return _0x2a513e;});}else{return _0x2a513e;}})[_0x3b3b('0x41')](function(_0x2673bb){logger[_0x3b3b('0x29')](_0x3b3b('0x4b'),_0x2673bb);throw _0x2673bb;});}return _0x2a513e;})['then'](respondWithResult(_0x1595c5,0xc9))[_0x3b3b('0x41')](handleError(_0x1595c5,null));};exports[_0x3b3b('0x4c')]=function(_0x39dd61,_0x392fbc){if(_0x39dd61['body']['id']){delete _0x39dd61['body']['id'];}return db[_0x3b3b('0x2e')][_0x3b3b('0x47')]({'where':{'id':_0x39dd61['params']['id']}})[_0x3b3b('0x24')](handleEntityNotFound(_0x392fbc,null))[_0x3b3b('0x24')](saveUpdates(_0x39dd61[_0x3b3b('0x45')],null))[_0x3b3b('0x24')](respondWithResult(_0x392fbc,null))['catch'](handleError(_0x392fbc,null));};exports[_0x3b3b('0x25')]=function(_0x18e558,_0x4b29f5){return db['Trigger'][_0x3b3b('0x47')]({'where':{'id':_0x18e558[_0x3b3b('0x4d')]['id']}})[_0x3b3b('0x24')](handleEntityNotFound(_0x4b29f5,null))['then'](removeEntity(_0x4b29f5,null))[_0x3b3b('0x41')](handleError(_0x4b29f5,null));};exports[_0x3b3b('0x4e')]=function(_0x53b7a,_0x578c39,_0x116f1d){if(_0x53b7a[_0x3b3b('0x45')]['id']){delete _0x53b7a['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x53b7a[_0x3b3b('0x4d')]['id']}})[_0x3b3b('0x24')](handleEntityNotFound(_0x578c39,null))[_0x3b3b('0x24')](function(_0xc146dc){if(_0xc146dc){_0x53b7a[_0x3b3b('0x45')][_0x3b3b('0x4f')]=_0xc146dc['id'];return db[_0x3b3b('0x50')][_0x3b3b('0x44')](_0x53b7a[_0x3b3b('0x45')]);}})['then'](respondWithResult(_0x578c39,null))['catch'](handleError(_0x578c39,null));};exports[_0x3b3b('0x51')]=function(_0xf1a8d2,_0x98e31,_0x5e9f1b){if(_0xf1a8d2['body']['id']){delete _0xf1a8d2['body']['id'];}return db[_0x3b3b('0x2e')][_0x3b3b('0x47')]({'where':{'id':_0xf1a8d2[_0x3b3b('0x4d')]['id']}})[_0x3b3b('0x24')](handleEntityNotFound(_0x98e31,null))['then'](function(_0x2a3e85){if(_0x2a3e85){_0xf1a8d2[_0x3b3b('0x45')]['TriggerAnyId']=_0x2a3e85['id'];return db[_0x3b3b('0x50')][_0x3b3b('0x44')](_0xf1a8d2[_0x3b3b('0x45')]);}})[_0x3b3b('0x24')](respondWithResult(_0x98e31,null))[_0x3b3b('0x41')](handleError(_0x98e31,null));};exports['getAllConditions']=function(_0x4ea16e,_0x5213d6,_0x3d1bfd){var _0xd15203={};var _0x438445={};var _0x1a1ef7;var _0x4ad1c8;return db[_0x3b3b('0x2e')][_0x3b3b('0x52')]({'where':{'id':_0x4ea16e[_0x3b3b('0x4d')]['id']}})[_0x3b3b('0x24')](handleEntityNotFound(_0x5213d6,null))[_0x3b3b('0x24')](function(_0xd330e9){if(_0xd330e9){_0x1a1ef7=_0xd330e9;_0x438445[_0x3b3b('0x33')]=_[_0x3b3b('0x32')](db['Condition'][_0x3b3b('0x2f')]);_0x438445[_0x3b3b('0x31')]=_[_0x3b3b('0x32')](_0x4ea16e['query']);_0x438445[_0x3b3b('0x3a')]=_[_0x3b3b('0x43')](_0x438445[_0x3b3b('0x33')],_0x438445[_0x3b3b('0x31')]);_0xd15203['attributes']=_['intersection'](_0x438445[_0x3b3b('0x33')],qs['fields'](_0x4ea16e[_0x3b3b('0x31')][_0x3b3b('0x35')]));_0xd15203[_0x3b3b('0x34')]=_0xd15203[_0x3b3b('0x34')][_0x3b3b('0x36')]?_0xd15203[_0x3b3b('0x34')]:_0x438445[_0x3b3b('0x33')];_0xd15203[_0x3b3b('0x53')]=qs[_0x3b3b('0x38')](_0x4ea16e[_0x3b3b('0x31')]['sort']);_0xd15203['where']=qs[_0x3b3b('0x3a')](_['pick'](_0x4ea16e['query'],_0x438445['filters']));if(_0x4ea16e[_0x3b3b('0x31')]['filter']){_0xd15203[_0x3b3b('0x39')]=_[_0x3b3b('0x3c')](_0xd15203[_0x3b3b('0x39')],{'$or':_[_0x3b3b('0x2d')](_0xd15203['attributes'],function(_0x60658e){var _0x1b29b6={};_0x1b29b6[_0x60658e]={'$like':'%'+_0x4ea16e['query'][_0x3b3b('0x3b')]+'%'};return _0x1b29b6;})});}_0xd15203=_[_0x3b3b('0x3c')]({},_0xd15203,_0x4ea16e[_0x3b3b('0x3d')]);return _0x1a1ef7[_0x3b3b('0x54')](_0xd15203);}})[_0x3b3b('0x24')](function(_0x42fee1){if(_0x42fee1){_0x4ad1c8=_0x42fee1[_0x3b3b('0x36')];if(!_0x4ea16e[_0x3b3b('0x31')][_0x3b3b('0x37')](_0x3b3b('0x55'))){_0xd15203[_0x3b3b('0x1f')]=qs[_0x3b3b('0x1f')](_0x4ea16e[_0x3b3b('0x31')]['limit']);_0xd15203['offset']=qs[_0x3b3b('0x1c')](_0x4ea16e[_0x3b3b('0x31')][_0x3b3b('0x1c')]);}return _0x1a1ef7[_0x3b3b('0x54')](_0xd15203);}})[_0x3b3b('0x24')](function(_0x407895){if(_0x407895){return _0x407895?{'count':_0x4ad1c8,'rows':_0x407895}:null;}})['then'](respondWithResult(_0x5213d6,null))[_0x3b3b('0x41')](handleError(_0x5213d6,null));};exports[_0x3b3b('0x56')]=function(_0x357931,_0x58c22a,_0x10533c){var _0x984104={};var _0x5dfc8e={};var _0x51eee3;var _0x3cb3ce;return db['Trigger'][_0x3b3b('0x52')]({'where':{'id':_0x357931[_0x3b3b('0x4d')]['id']}})[_0x3b3b('0x24')](handleEntityNotFound(_0x58c22a,null))[_0x3b3b('0x24')](function(_0x5cf44a){if(_0x5cf44a){_0x51eee3=_0x5cf44a;_0x5dfc8e[_0x3b3b('0x33')]=_['keys'](db[_0x3b3b('0x50')][_0x3b3b('0x2f')]);_0x5dfc8e['query']=_[_0x3b3b('0x32')](_0x357931[_0x3b3b('0x31')]);_0x5dfc8e[_0x3b3b('0x3a')]=_[_0x3b3b('0x43')](_0x5dfc8e[_0x3b3b('0x33')],_0x5dfc8e[_0x3b3b('0x31')]);_0x984104[_0x3b3b('0x34')]=_[_0x3b3b('0x43')](_0x5dfc8e[_0x3b3b('0x33')],qs[_0x3b3b('0x35')](_0x357931[_0x3b3b('0x31')]['fields']));_0x984104[_0x3b3b('0x34')]=_0x984104[_0x3b3b('0x34')][_0x3b3b('0x36')]?_0x984104[_0x3b3b('0x34')]:_0x5dfc8e[_0x3b3b('0x33')];_0x984104['order']=qs['sort'](_0x357931[_0x3b3b('0x31')][_0x3b3b('0x38')]);_0x984104[_0x3b3b('0x39')]=qs[_0x3b3b('0x3a')](_[_0x3b3b('0x57')](_0x357931[_0x3b3b('0x31')],_0x5dfc8e[_0x3b3b('0x3a')]));if(_0x357931[_0x3b3b('0x31')][_0x3b3b('0x3b')]){_0x984104['where']=_[_0x3b3b('0x3c')](_0x984104[_0x3b3b('0x39')],{'$or':_[_0x3b3b('0x2d')](_0x984104['attributes'],function(_0x5a7279){var _0x54fc5c={};_0x54fc5c[_0x5a7279]={'$like':'%'+_0x357931[_0x3b3b('0x31')]['filter']+'%'};return _0x54fc5c;})});}_0x984104=_['merge']({},_0x984104,_0x357931[_0x3b3b('0x3d')]);return _0x51eee3[_0x3b3b('0x56')](_0x984104);}})[_0x3b3b('0x24')](function(_0x351821){if(_0x351821){_0x3cb3ce=_0x351821[_0x3b3b('0x36')];if(!_0x357931['query'][_0x3b3b('0x37')](_0x3b3b('0x55'))){_0x984104[_0x3b3b('0x1f')]=qs[_0x3b3b('0x1f')](_0x357931[_0x3b3b('0x31')]['limit']);_0x984104[_0x3b3b('0x1c')]=qs[_0x3b3b('0x1c')](_0x357931[_0x3b3b('0x31')]['offset']);}return _0x51eee3[_0x3b3b('0x56')](_0x984104);}})[_0x3b3b('0x24')](function(_0xffe465){if(_0xffe465){return _0xffe465?{'count':_0x3cb3ce,'rows':_0xffe465}:null;}})[_0x3b3b('0x24')](respondWithResult(_0x58c22a,null))['catch'](handleError(_0x58c22a,null));};exports[_0x3b3b('0x58')]=function(_0x25f768,_0x1fa6a2,_0x7db49){if(_0x25f768[_0x3b3b('0x45')]['id']){delete _0x25f768[_0x3b3b('0x45')]['id'];}return db[_0x3b3b('0x2e')][_0x3b3b('0x47')]({'where':{'id':_0x25f768[_0x3b3b('0x4d')]['id']}})[_0x3b3b('0x24')](handleEntityNotFound(_0x1fa6a2,null))['then'](function(_0x5759e4){if(_0x5759e4){_0x25f768['body'][_0x3b3b('0x59')]=_0x5759e4['id'];return db[_0x3b3b('0x5a')][_0x3b3b('0x44')](_0x25f768[_0x3b3b('0x45')]);}})[_0x3b3b('0x24')](respondWithResult(_0x1fa6a2,null))[_0x3b3b('0x41')](handleError(_0x1fa6a2,null));};exports[_0x3b3b('0x5b')]=function(_0x223f16,_0x4547bb,_0x2c1767){var _0x35ba9a={};var _0x35facf={};var _0x577c63;var _0x3bd621;return db[_0x3b3b('0x2e')][_0x3b3b('0x52')]({'where':{'id':_0x223f16[_0x3b3b('0x4d')]['id']}})[_0x3b3b('0x24')](handleEntityNotFound(_0x4547bb,null))[_0x3b3b('0x24')](function(_0x58573e){if(_0x58573e){_0x577c63=_0x58573e;_0x35facf[_0x3b3b('0x33')]=_[_0x3b3b('0x32')](db[_0x3b3b('0x5a')][_0x3b3b('0x2f')]);_0x35facf[_0x3b3b('0x31')]=_['keys'](_0x223f16[_0x3b3b('0x31')]);_0x35facf[_0x3b3b('0x3a')]=_[_0x3b3b('0x43')](_0x35facf[_0x3b3b('0x33')],_0x35facf[_0x3b3b('0x31')]);_0x35ba9a['attributes']=_[_0x3b3b('0x43')](_0x35facf[_0x3b3b('0x33')],qs[_0x3b3b('0x35')](_0x223f16[_0x3b3b('0x31')][_0x3b3b('0x35')]));_0x35ba9a[_0x3b3b('0x34')]=_0x35ba9a[_0x3b3b('0x34')][_0x3b3b('0x36')]?_0x35ba9a[_0x3b3b('0x34')]:_0x35facf[_0x3b3b('0x33')];_0x35ba9a[_0x3b3b('0x53')]=qs[_0x3b3b('0x38')](_0x223f16[_0x3b3b('0x31')]['sort']);_0x35ba9a[_0x3b3b('0x39')]=qs[_0x3b3b('0x3a')](_[_0x3b3b('0x57')](_0x223f16[_0x3b3b('0x31')],_0x35facf[_0x3b3b('0x3a')]));if(_0x223f16['query'][_0x3b3b('0x3b')]){_0x35ba9a[_0x3b3b('0x39')]=_[_0x3b3b('0x3c')](_0x35ba9a[_0x3b3b('0x39')],{'$or':_[_0x3b3b('0x2d')](_0x35ba9a['attributes'],function(_0x14af37){var _0x3a2b04={};_0x3a2b04[_0x14af37]={'$like':'%'+_0x223f16[_0x3b3b('0x31')][_0x3b3b('0x3b')]+'%'};return _0x3a2b04;})});}_0x35ba9a=_['merge']({},_0x35ba9a,_0x223f16['options']);return _0x577c63[_0x3b3b('0x5b')](_0x35ba9a);}})[_0x3b3b('0x24')](function(_0x5acce6){if(_0x5acce6){_0x3bd621=_0x5acce6[_0x3b3b('0x36')];if(!_0x223f16[_0x3b3b('0x31')][_0x3b3b('0x37')](_0x3b3b('0x55'))){_0x35ba9a[_0x3b3b('0x1f')]=qs[_0x3b3b('0x1f')](_0x223f16[_0x3b3b('0x31')]['limit']);_0x35ba9a[_0x3b3b('0x1c')]=qs[_0x3b3b('0x1c')](_0x223f16[_0x3b3b('0x31')][_0x3b3b('0x1c')]);}return _0x577c63[_0x3b3b('0x5b')](_0x35ba9a);}})[_0x3b3b('0x24')](function(_0xfcd898){if(_0xfcd898){return _0xfcd898?{'count':_0x3bd621,'rows':_0xfcd898}:null;}})[_0x3b3b('0x24')](respondWithResult(_0x4547bb,null))[_0x3b3b('0x41')](handleError(_0x4547bb,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 7051da6..550d487 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 _0xee24=['Trigger','tools_triggers','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define'];(function(_0x2f80c5,_0x11a768){var _0x32dc66=function(_0x15b38d){while(--_0x15b38d){_0x2f80c5['push'](_0x2f80c5['shift']());}};_0x32dc66(++_0x11a768);}(_0xee24,0x1a6));var _0x4ee2=function(_0x234995,_0x48c007){_0x234995=_0x234995-0x0;var _0x5115f0=_0xee24[_0x234995];return _0x5115f0;};'use strict';var _=require('lodash');var util=require(_0x4ee2('0x0'));var logger=require(_0x4ee2('0x1'))('api');var moment=require(_0x4ee2('0x2'));var BPromise=require(_0x4ee2('0x3'));var rp=require(_0x4ee2('0x4'));var fs=require('fs');var path=require(_0x4ee2('0x5'));var rimraf=require('rimraf');var config=require(_0x4ee2('0x6'));var attributes=require(_0x4ee2('0x7'));module[_0x4ee2('0x8')]=function(_0x1993de,_0x5c778f){return _0x1993de[_0x4ee2('0x9')](_0x4ee2('0xa'),attributes,{'tableName':_0x4ee2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b19=['api','moment','request-promise','path','rimraf','./trigger.attributes','exports','define','tools_triggers','lodash','../../config/logger'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4b19,0x195));var _0x94b1=function(_0xe8f00e,_0x26caa7){_0xe8f00e=_0xe8f00e-0x0;var _0x53eb4c=_0x4b19[_0xe8f00e];return _0x53eb4c;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('Trigger',attributes,{'tableName':_0x94b1('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 4c5b607..400c5e9 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 _0x3b2e=['error','message','Trigger,\x20%s,\x20%s','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','stringify','find','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5c3378,_0x39e5d1){var _0xfede5d=function(_0x4dc057){while(--_0x4dc057){_0x5c3378['push'](_0x5c3378['shift']());}};_0xfede5d(++_0x39e5d1);}(_0x3b2e,0xc6));var _0xe3b2=function(_0x5bad83,_0x5c216d){_0x5bad83=_0x5bad83-0x0;var _0x1bddfd=_0x3b2e[_0x5bad83];return _0x1bddfd;};'use strict';var _=require(_0xe3b2('0x0'));var util=require(_0xe3b2('0x1'));var moment=require(_0xe3b2('0x2'));var BPromise=require(_0xe3b2('0x3'));var rs=require(_0xe3b2('0x4'));var fs=require('fs');var Redis=require(_0xe3b2('0x5'));var db=require(_0xe3b2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3b2('0x7'))(_0xe3b2('0x8'));var config=require(_0xe3b2('0x9'));var jayson=require(_0xe3b2('0xa'));var client=jayson[_0xe3b2('0xb')][_0xe3b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47ac1d,_0x2f3276,_0x443b49){return new BPromise(function(_0x3c26dd,_0x485a42){return client['request'](_0x47ac1d,_0x443b49)[_0xe3b2('0xd')](function(_0x79ddf3){logger[_0xe3b2('0xe')]('Trigger,\x20%s,\x20%s',_0x2f3276,'request\x20sent');logger[_0xe3b2('0xf')](_0xe3b2('0x10'),_0x2f3276,_0xe3b2('0x11'),JSON['stringify'](_0x79ddf3));if(_0x79ddf3[_0xe3b2('0x12')]){if(_0x79ddf3['error']['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x2f3276,_0x79ddf3[_0xe3b2('0x12')]['message']);return _0x485a42(_0x79ddf3[_0xe3b2('0x12')][_0xe3b2('0x13')]);}logger[_0xe3b2('0x12')](_0xe3b2('0x14'),_0x2f3276,_0x79ddf3['error']['message']);return _0x3c26dd(_0x79ddf3[_0xe3b2('0x12')][_0xe3b2('0x13')]);}else{logger['info'](_0xe3b2('0x14'),_0x2f3276,_0xe3b2('0x11'));_0x3c26dd(_0x79ddf3['result'][_0xe3b2('0x13')]);}})[_0xe3b2('0x15')](function(_0x325add){logger['error']('Trigger,\x20%s,\x20%s',_0x2f3276,_0x325add);_0x485a42(_0x325add);});});}exports[_0xe3b2('0x16')]=function(_0x3c66e2){var _0xb12ac0=this;return new Promise(function(_0x105e60,_0x37f90c){return db[_0xe3b2('0x17')][_0xe3b2('0x18')]({'raw':_0x3c66e2[_0xe3b2('0x19')]?_0x3c66e2['options'][_0xe3b2('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c66e2[_0xe3b2('0x19')]?_0x3c66e2[_0xe3b2('0x19')][_0xe3b2('0x1b')]||null:null,'attributes':_0x3c66e2[_0xe3b2('0x19')]?_0x3c66e2[_0xe3b2('0x19')]['attributes']||null:null,'limit':_0x3c66e2[_0xe3b2('0x19')]?_0x3c66e2['options'][_0xe3b2('0x1c')]||null:null,'include':_0x3c66e2[_0xe3b2('0x19')]?_0x3c66e2[_0xe3b2('0x19')][_0xe3b2('0x1d')]?_[_0xe3b2('0x1e')](_0x3c66e2[_0xe3b2('0x19')][_0xe3b2('0x1d')],function(_0x5ca8ba){return{'model':db[_0x5ca8ba[_0xe3b2('0x1f')]],'as':_0x5ca8ba['as'],'attributes':_0x5ca8ba[_0xe3b2('0x20')],'include':_0x5ca8ba[_0xe3b2('0x1d')]?_[_0xe3b2('0x1e')](_0x5ca8ba['include'],function(_0x5b8657){return{'model':db[_0x5b8657[_0xe3b2('0x1f')]],'as':_0x5b8657['as'],'attributes':_0x5b8657['attributes'],'include':_0x5b8657[_0xe3b2('0x1d')]?_[_0xe3b2('0x1e')](_0x5b8657[_0xe3b2('0x1d')],function(_0x40829e){return{'model':db[_0x40829e[_0xe3b2('0x1f')]],'as':_0x40829e['as'],'attributes':_0x40829e[_0xe3b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe3b2('0xd')](function(_0x32dbc8){logger[_0xe3b2('0xe')](_0xe3b2('0x16'),_0x3c66e2);logger[_0xe3b2('0xf')](_0xe3b2('0x16'),_0x3c66e2,JSON[_0xe3b2('0x21')](_0x32dbc8));_0x105e60(_0x32dbc8);})['catch'](function(_0x1df506){logger['error'](_0xe3b2('0x16'),_0x1df506['message'],_0x3c66e2);_0x37f90c(_0xb12ac0[_0xe3b2('0x12')](0x1f4,_0x1df506['message']));});});};exports['ShowTrigger']=function(_0xfbf7f){var _0x25592c=this;return new Promise(function(_0x199d4d,_0x249d53){return db[_0xe3b2('0x17')][_0xe3b2('0x22')]({'raw':_0xfbf7f[_0xe3b2('0x19')]?_0xfbf7f[_0xe3b2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xfbf7f[_0xe3b2('0x19')]?_0xfbf7f[_0xe3b2('0x19')][_0xe3b2('0x1b')]||null:null,'attributes':_0xfbf7f['options']?_0xfbf7f[_0xe3b2('0x19')][_0xe3b2('0x20')]||null:null,'include':_0xfbf7f['options']?_0xfbf7f[_0xe3b2('0x19')][_0xe3b2('0x1d')]?_[_0xe3b2('0x1e')](_0xfbf7f[_0xe3b2('0x19')][_0xe3b2('0x1d')],function(_0xac329f){return{'model':db[_0xac329f[_0xe3b2('0x1f')]],'as':_0xac329f['as'],'attributes':_0xac329f[_0xe3b2('0x20')],'include':_0xac329f['include']?_[_0xe3b2('0x1e')](_0xac329f[_0xe3b2('0x1d')],function(_0x5ecd39){return{'model':db[_0x5ecd39[_0xe3b2('0x1f')]],'as':_0x5ecd39['as'],'attributes':_0x5ecd39[_0xe3b2('0x20')],'include':_0x5ecd39[_0xe3b2('0x1d')]?_[_0xe3b2('0x1e')](_0x5ecd39[_0xe3b2('0x1d')],function(_0x2d5668){return{'model':db[_0x2d5668[_0xe3b2('0x1f')]],'as':_0x2d5668['as'],'attributes':_0x2d5668[_0xe3b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe3b2('0xd')](function(_0x3b21d1){logger['info'](_0xe3b2('0x23'),_0xfbf7f);logger[_0xe3b2('0xf')]('ShowTrigger',_0xfbf7f,JSON[_0xe3b2('0x21')](_0x3b21d1));_0x199d4d(_0x3b21d1);})[_0xe3b2('0x15')](function(_0x587347){logger['error'](_0xe3b2('0x23'),_0x587347[_0xe3b2('0x13')],_0xfbf7f);_0x249d53(_0x25592c[_0xe3b2('0x12')](0x1f4,_0x587347[_0xe3b2('0x13')]));});});}; \ No newline at end of file +var _0x71fc=['then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trigger','findAll','options','where','attributes','limit','include','map','model','GetTrigger','ShowTrigger','find','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x14080c,_0x485b3){var _0x254794=function(_0x1cbd6c){while(--_0x1cbd6c){_0x14080c['push'](_0x14080c['shift']());}};_0x254794(++_0x485b3);}(_0x71fc,0xa9));var _0xc71f=function(_0x156c48,_0x532a99){_0x156c48=_0x156c48-0x0;var _0x3a19ec=_0x71fc[_0x156c48];return _0x3a19ec;};'use strict';var _=require(_0xc71f('0x0'));var util=require(_0xc71f('0x1'));var moment=require(_0xc71f('0x2'));var BPromise=require('bluebird');var rs=require(_0xc71f('0x3'));var fs=require('fs');var Redis=require(_0xc71f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc71f('0x5'));var logger=require(_0xc71f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc71f('0x7'));var client=jayson[_0xc71f('0x8')][_0xc71f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ffea9,_0x28ee14,_0x33a263){return new BPromise(function(_0x1c2c41,_0xe6dd08){return client[_0xc71f('0xa')](_0x3ffea9,_0x33a263)[_0xc71f('0xb')](function(_0x1f002b){logger[_0xc71f('0xc')](_0xc71f('0xd'),_0x28ee14,_0xc71f('0xe'));logger[_0xc71f('0xf')](_0xc71f('0x10'),_0x28ee14,'request\x20sent',JSON[_0xc71f('0x11')](_0x1f002b));if(_0x1f002b['error']){if(_0x1f002b[_0xc71f('0x12')][_0xc71f('0x13')]===0x1f4){logger[_0xc71f('0x12')](_0xc71f('0xd'),_0x28ee14,_0x1f002b['error']['message']);return _0xe6dd08(_0x1f002b[_0xc71f('0x12')][_0xc71f('0x14')]);}logger[_0xc71f('0x12')](_0xc71f('0xd'),_0x28ee14,_0x1f002b['error'][_0xc71f('0x14')]);return _0x1c2c41(_0x1f002b[_0xc71f('0x12')]['message']);}else{logger[_0xc71f('0xc')](_0xc71f('0xd'),_0x28ee14,_0xc71f('0xe'));_0x1c2c41(_0x1f002b[_0xc71f('0x15')][_0xc71f('0x14')]);}})[_0xc71f('0x16')](function(_0x514098){logger[_0xc71f('0x12')]('Trigger,\x20%s,\x20%s',_0x28ee14,_0x514098);_0xe6dd08(_0x514098);});});}exports['GetTrigger']=function(_0x2eeef6){var _0xbca2cd=this;return new Promise(function(_0x27db6c,_0x4cf401){return db[_0xc71f('0x17')][_0xc71f('0x18')]({'raw':_0x2eeef6[_0xc71f('0x19')]?_0x2eeef6[_0xc71f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2eeef6[_0xc71f('0x19')]?_0x2eeef6[_0xc71f('0x19')][_0xc71f('0x1a')]||null:null,'attributes':_0x2eeef6[_0xc71f('0x19')]?_0x2eeef6[_0xc71f('0x19')][_0xc71f('0x1b')]||null:null,'limit':_0x2eeef6[_0xc71f('0x19')]?_0x2eeef6[_0xc71f('0x19')][_0xc71f('0x1c')]||null:null,'include':_0x2eeef6[_0xc71f('0x19')]?_0x2eeef6[_0xc71f('0x19')][_0xc71f('0x1d')]?_[_0xc71f('0x1e')](_0x2eeef6['options']['include'],function(_0x25ff42){return{'model':db[_0x25ff42[_0xc71f('0x1f')]],'as':_0x25ff42['as'],'attributes':_0x25ff42[_0xc71f('0x1b')],'include':_0x25ff42['include']?_[_0xc71f('0x1e')](_0x25ff42['include'],function(_0x17b909){return{'model':db[_0x17b909[_0xc71f('0x1f')]],'as':_0x17b909['as'],'attributes':_0x17b909[_0xc71f('0x1b')],'include':_0x17b909[_0xc71f('0x1d')]?_['map'](_0x17b909[_0xc71f('0x1d')],function(_0x8876c){return{'model':db[_0x8876c[_0xc71f('0x1f')]],'as':_0x8876c['as'],'attributes':_0x8876c[_0xc71f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc71f('0xb')](function(_0x57f47c){logger[_0xc71f('0xc')](_0xc71f('0x20'),_0x2eeef6);logger[_0xc71f('0xf')](_0xc71f('0x20'),_0x2eeef6,JSON[_0xc71f('0x11')](_0x57f47c));_0x27db6c(_0x57f47c);})['catch'](function(_0x17e6ab){logger[_0xc71f('0x12')](_0xc71f('0x20'),_0x17e6ab[_0xc71f('0x14')],_0x2eeef6);_0x4cf401(_0xbca2cd['error'](0x1f4,_0x17e6ab['message']));});});};exports[_0xc71f('0x21')]=function(_0x2b9aab){var _0x3d8399=this;return new Promise(function(_0x5d846e,_0x207223){return db[_0xc71f('0x17')][_0xc71f('0x22')]({'raw':_0x2b9aab[_0xc71f('0x19')]?_0x2b9aab[_0xc71f('0x19')][_0xc71f('0x23')]===undefined?!![]:![]:!![],'where':_0x2b9aab['options']?_0x2b9aab['options'][_0xc71f('0x1a')]||null:null,'attributes':_0x2b9aab['options']?_0x2b9aab[_0xc71f('0x19')][_0xc71f('0x1b')]||null:null,'include':_0x2b9aab[_0xc71f('0x19')]?_0x2b9aab[_0xc71f('0x19')][_0xc71f('0x1d')]?_[_0xc71f('0x1e')](_0x2b9aab[_0xc71f('0x19')][_0xc71f('0x1d')],function(_0x2a35cb){return{'model':db[_0x2a35cb['model']],'as':_0x2a35cb['as'],'attributes':_0x2a35cb[_0xc71f('0x1b')],'include':_0x2a35cb[_0xc71f('0x1d')]?_[_0xc71f('0x1e')](_0x2a35cb[_0xc71f('0x1d')],function(_0x131a2f){return{'model':db[_0x131a2f[_0xc71f('0x1f')]],'as':_0x131a2f['as'],'attributes':_0x131a2f[_0xc71f('0x1b')],'include':_0x131a2f['include']?_[_0xc71f('0x1e')](_0x131a2f[_0xc71f('0x1d')],function(_0x5f5312){return{'model':db[_0x5f5312[_0xc71f('0x1f')]],'as':_0x5f5312['as'],'attributes':_0x5f5312['attributes']};}):[]};}):[]};}):[]:[]})[_0xc71f('0xb')](function(_0x3951d1){logger[_0xc71f('0xc')]('ShowTrigger',_0x2b9aab);logger[_0xc71f('0xf')](_0xc71f('0x21'),_0x2b9aab,JSON['stringify'](_0x3951d1));_0x5d846e(_0x3951d1);})[_0xc71f('0x16')](function(_0x23c4e5){logger['error'](_0xc71f('0x21'),_0x23c4e5[_0xc71f('0x14')],_0x2b9aab);_0x207223(_0x3d8399['error'](0x1f4,_0x23c4e5[_0xc71f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c0cc879..f19f7ed 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 _0xa159=['update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone','clone','create','/:id'];(function(_0x201d98,_0x56fd1f){var _0x1ae057=function(_0xb7eeab){while(--_0xb7eeab){_0x201d98['push'](_0x201d98['shift']());}};_0x1ae057(++_0x56fd1f);}(_0xa159,0x17f));var _0x9a15=function(_0x481717,_0x2932f4){_0x481717=_0x481717-0x0;var _0x3c740b=_0xa159[_0x481717];return _0x3c740b;};'use strict';var multer=require(_0x9a15('0x0'));var util=require('util');var path=require(_0x9a15('0x1'));var timeout=require(_0x9a15('0x2'));var express=require(_0x9a15('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a15('0x4'));var config=require(_0x9a15('0x5'));var controller=require(_0x9a15('0x6'));router[_0x9a15('0x7')]('/',auth[_0x9a15('0x8')](),controller[_0x9a15('0x9')]);router[_0x9a15('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9a15('0xa')]);router[_0x9a15('0xb')](_0x9a15('0xc'),auth[_0x9a15('0x8')](),controller[_0x9a15('0xd')]);router[_0x9a15('0xb')]('/',auth[_0x9a15('0x8')](),controller[_0x9a15('0xe')]);router['put'](_0x9a15('0xf'),auth[_0x9a15('0x8')](),controller[_0x9a15('0x10')]);router['delete'](_0x9a15('0xf'),auth[_0x9a15('0x8')](),controller[_0x9a15('0x11')]);module[_0x9a15('0x12')]=router; \ No newline at end of file +var _0xf02d=['isAuthenticated','get','/:id','show','post','create','put','destroy','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0xf02d,0xe0));var _0xdf02=function(_0xc32283,_0x5276de){_0xc32283=_0xc32283-0x0;var _0x4f6b95=_0xf02d[_0xc32283];return _0x4f6b95;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdf02('0x0'));var express=require('express');var router=express[_0xdf02('0x1')]();var fs_extra=require(_0xdf02('0x2'));var auth=require(_0xdf02('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trunk.controller');router['get']('/',auth[_0xdf02('0x4')](),controller['index']);router[_0xdf02('0x5')](_0xdf02('0x6'),auth[_0xdf02('0x4')](),controller[_0xdf02('0x7')]);router[_0xdf02('0x8')]('/:id/clone',auth[_0xdf02('0x4')](),controller['clone']);router['post']('/',auth['isAuthenticated'](),controller[_0xdf02('0x9')]);router[_0xdf02('0xa')](_0xdf02('0x6'),auth[_0xdf02('0x4')](),controller['update']);router['delete'](_0xdf02('0x6'),auth[_0xdf02('0x4')](),controller[_0xdf02('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index eb7199d..4d89b09 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 _0xc41c=['friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x2522ae,_0x2b2be5){var _0x3d3184=function(_0x405348){while(--_0x405348){_0x2522ae['push'](_0x2522ae['shift']());}};_0x3d3184(++_0x2b2be5);}(_0xc41c,0xcb));var _0xcc41=function(_0x4abd58,_0x523c62){_0x4abd58=_0x4abd58-0x0;var _0x3608a8=_0xc41c[_0x4abd58];return _0x3608a8;};'use strict';var Sequelize=require(_0xcc41('0x0'));module[_0xcc41('0x1')]={'name':{'type':Sequelize[_0xcc41('0x2')],'allowNull':![],'unique':_0xcc41('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x5'),'user',_0xcc41('0x6')),'allowNull':![],'defaultValue':_0xcc41('0x5')},'context':{'type':Sequelize[_0xcc41('0x2')],'allowNull':![],'defaultValue':_0xcc41('0x7')},'callingpres':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x8'),_0xcc41('0x9'),_0xcc41('0xa'),_0xcc41('0xb'),'PROHIB_NOT_SCREENED',_0xcc41('0xc'),_0xcc41('0xd'),_0xcc41('0xe'))},'deny':{'type':Sequelize[_0xcc41('0x2')]},'permit':{'type':Sequelize[_0xcc41('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xcc41('0x2')]},'remotesecret':{'type':Sequelize[_0xcc41('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xcc41('0xf'),'set':function(_0x14668e){this[_0xcc41('0x10')](_0xcc41('0x11'),_0x14668e?_0x14668e['join'](','):null);},'get':function(){return this[_0xcc41('0x12')](_0xcc41('0x11'))?this['getDataValue'](_0xcc41('0x11'))[_0xcc41('0x13')](','):null;},'comment':_0xcc41('0x14')},'dtmfmode':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x15'),'info',_0xcc41('0x16'),'inband',_0xcc41('0x17')),'defaultValue':_0xcc41('0x15')},'directmedia':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no',_0xcc41('0x19'),'update',_0xcc41('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcc41('0x2')]},'directmediadeny':{'type':Sequelize[_0xcc41('0x2')]},'nat':{'type':Sequelize[_0xcc41('0x2')],'defaultValue':_0xcc41('0x1b'),'set':function(_0x58cdef){this[_0xcc41('0x10')](_0xcc41('0x1c'),_0x58cdef?_0x58cdef[_0xcc41('0x1d')](','):null);},'get':function(){return this[_0xcc41('0x12')](_0xcc41('0x1c'))?this[_0xcc41('0x12')](_0xcc41('0x1c'))[_0xcc41('0x13')](','):null;},'comment':_0xcc41('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xcc41('0x2')]},'pickupgroup':{'type':Sequelize[_0xcc41('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xcc41('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcc41('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcc41('0x2')],'defaultValue':_0xcc41('0x1f')},'allow':{'type':Sequelize[_0xcc41('0x2')],'allowNull':![],'defaultValue':_0xcc41('0x20'),'set':function(_0x130de1){this[_0xcc41('0x10')]('allow',_0x130de1?_0x130de1[_0xcc41('0x1d')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xcc41('0x12')]('allow')?this[_0xcc41('0x12')](_0xcc41('0x21'))[_0xcc41('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0xcc41('0x2')],'defaultValue':_0xcc41('0x22'),'set':function(_0x6f55b){this['setDataValue'](_0xcc41('0x23'),_0x6f55b?_0x6f55b[_0xcc41('0x1d')](','):null);},'get':function(){return this['getDataValue'](_0xcc41('0x23'))?this[_0xcc41('0x12')](_0xcc41('0x23'))[_0xcc41('0x13')](','):null;},'comment':_0xcc41('0x24')},'trustrpid':{'type':Sequelize['ENUM'](_0xcc41('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xcc41('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcc41('0x4')]('yes','no',_0xcc41('0x25'))},'promiscredir':{'type':Sequelize[_0xcc41('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no')},'accountcode':{'type':Sequelize[_0xcc41('0x26')](0xb)},'setvar':{'type':Sequelize[_0xcc41('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xcc41('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xcc41('0x4')]('yes','no'),'defaultValue':_0xcc41('0x18')},'busylevel':{'type':Sequelize[_0xcc41('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xcc41('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xcc41('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xcc41('0x4')]('yes','no',_0xcc41('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no')},'mailbox':{'type':Sequelize[_0xcc41('0x2')]},'session_timers':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x29'),_0xcc41('0x2a'),_0xcc41('0x2b'))},'session_expires':{'type':Sequelize[_0xcc41('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xcc41('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xcc41('0x4')]('uac',_0xcc41('0x2c')),'defaultValue':_0xcc41('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0xcc41('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xcc41('0x2')]},'fromuser':{'type':Sequelize[_0xcc41('0x2')]},'port':{'type':Sequelize[_0xcc41('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xcc41('0x18'),'no'),'defaultValue':_0xcc41('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xcc41('0x2')]},'rtptimeout':{'type':Sequelize[_0xcc41('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xcc41('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xcc41('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xcc41('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcc41('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xcc41('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xcc41('0x2')]},'contactdeny':{'type':Sequelize[_0xcc41('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xcc41('0x2')]},'use_q850_reason':{'type':Sequelize[_0xcc41('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no')},'force_avp':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no')},'icesupport':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xcc41('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no','fingerprint',_0xcc41('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xcc41('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xcc41('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xcc41('0x2')]},'dtlscipher':{'type':Sequelize[_0xcc41('0x2')]},'dtlscafile':{'type':Sequelize[_0xcc41('0x2')]},'dtlscapath':{'type':Sequelize[_0xcc41('0x2')]},'dtlssetup':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x2e'),'passive',_0xcc41('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xcc41('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xcc41('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcc41('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xcc41('0x4')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xcc41('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xcc41('0x2')]},'description':{'type':Sequelize[_0xcc41('0x2')]},'host':{'type':Sequelize[_0xcc41('0x2')],'defaultValue':_0xcc41('0x30')},'canreinvite':{'type':Sequelize[_0xcc41('0x4')](_0xcc41('0x18'),'no',_0xcc41('0x19'),_0xcc41('0x31'),_0xcc41('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xcc41('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xcc41('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xcc41('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x1c1e=['never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','passive','actpass','dynamic','nonat','update','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','yes','outgoing','force_rport,comedia','nat','all','allow','insecure'];(function(_0x305511,_0x445ff9){var _0x3ba69e=function(_0x9a62a1){while(--_0x9a62a1){_0x305511['push'](_0x305511['shift']());}};_0x3ba69e(++_0x445ff9);}(_0x1c1e,0xcd));var _0xe1c1=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0x1c1e[_0x4322c6];return _0x4e7537;};'use strict';var Sequelize=require('sequelize');module[_0xe1c1('0x0')]={'name':{'type':Sequelize[_0xe1c1('0x1')],'allowNull':![],'unique':_0xe1c1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x4'),_0xe1c1('0x5'),_0xe1c1('0x6')),'allowNull':![],'defaultValue':_0xe1c1('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe1c1('0x7')},'callingpres':{'type':Sequelize[_0xe1c1('0x3')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xe1c1('0x8'),_0xe1c1('0x9'),_0xe1c1('0xa'),_0xe1c1('0xb'),_0xe1c1('0xc'),_0xe1c1('0xd'))},'deny':{'type':Sequelize[_0xe1c1('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xe1c1('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xe1c1('0x1')]},'transport':{'type':Sequelize[_0xe1c1('0x1')],'defaultValue':_0xe1c1('0xe'),'set':function(_0x15720c){this[_0xe1c1('0xf')](_0xe1c1('0x10'),_0x15720c?_0x15720c[_0xe1c1('0x11')](','):null);},'get':function(){return this[_0xe1c1('0x12')](_0xe1c1('0x10'))?this[_0xe1c1('0x12')](_0xe1c1('0x10'))[_0xe1c1('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x14'),_0xe1c1('0x15'),_0xe1c1('0x16'),'inband','auto'),'defaultValue':_0xe1c1('0x14')},'directmedia':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no','nonat','update',_0xe1c1('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe1c1('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe1c1('0x1')]},'directmediadeny':{'type':Sequelize[_0xe1c1('0x1')]},'nat':{'type':Sequelize[_0xe1c1('0x1')],'defaultValue':_0xe1c1('0x19'),'set':function(_0x4514e4){this[_0xe1c1('0xf')](_0xe1c1('0x1a'),_0x4514e4?_0x4514e4[_0xe1c1('0x11')](','):null);},'get':function(){return this[_0xe1c1('0x12')](_0xe1c1('0x1a'))?this[_0xe1c1('0x12')]('nat')[_0xe1c1('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe1c1('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xe1c1('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xe1c1('0x1')]},'language':{'type':Sequelize[_0xe1c1('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe1c1('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe1c1('0x1')],'defaultValue':_0xe1c1('0x1b')},'allow':{'type':Sequelize[_0xe1c1('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x443f24){this[_0xe1c1('0xf')](_0xe1c1('0x1c'),_0x443f24?_0x443f24['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe1c1('0x12')](_0xe1c1('0x1c'))?this[_0xe1c1('0x12')]('allow')[_0xe1c1('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no')},'insecure':{'type':Sequelize[_0xe1c1('0x1')],'defaultValue':'port,invite','set':function(_0x48f622){this[_0xe1c1('0xf')](_0xe1c1('0x1d'),_0x48f622?_0x48f622[_0xe1c1('0x11')](','):null);},'get':function(){return this[_0xe1c1('0x12')](_0xe1c1('0x1d'))?this[_0xe1c1('0x12')](_0xe1c1('0x1d'))[_0xe1c1('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe1c1('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no',_0xe1c1('0x1e'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0xe1c1('0x17'),'no')},'accountcode':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'setvar':{'type':Sequelize[_0xe1c1('0x1')]},'callerid':{'type':Sequelize[_0xe1c1('0x1')],'defaultValue':_0xe1c1('0x20')},'amaflags':{'type':Sequelize[_0xe1c1('0x1')]},'callcounter':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no'),'defaultValue':_0xe1c1('0x17')},'busylevel':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'allowoverlap':{'type':Sequelize[_0xe1c1('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xe1c1('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xe1c1('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xe1c1('0x1')]},'template':{'type':Sequelize[_0xe1c1('0x1')]},'videosupport':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no',_0xe1c1('0x21')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xe1c1('0x17'),'no')},'mailbox':{'type':Sequelize[_0xe1c1('0x1')]},'session_timers':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x22'),_0xe1c1('0x23'),_0xe1c1('0x24'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xe1c1('0x3')]('uac',_0xe1c1('0x25')),'defaultValue':_0xe1c1('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0xe1c1('0x1')]},'regexten':{'type':Sequelize[_0xe1c1('0x1')]},'fromdomain':{'type':Sequelize[_0xe1c1('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xe1c1('0x3')]('yes','no'),'defaultValue':_0xe1c1('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xe1c1('0x1')]},'defaultuser':{'type':Sequelize[_0xe1c1('0x1')]},'rtptimeout':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xe1c1('0x17'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe1c1('0x1')]},'callbackextension':{'type':Sequelize[_0xe1c1('0x1')]},'timert1':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'timerb':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'qualifyfreq':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'contactpermit':{'type':Sequelize[_0xe1c1('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xe1c1('0x1')]},'maxforwards':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'encryption':{'type':Sequelize[_0xe1c1('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xe1c1('0x17'),'no')},'force_avp':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xe1c1('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no','fingerprint',_0xe1c1('0x26'))},'dtlsrekey':{'type':Sequelize[_0xe1c1('0x1f')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xe1c1('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xe1c1('0x1')]},'dtlscapath':{'type':Sequelize[_0xe1c1('0x1')]},'dtlssetup':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x27'),_0xe1c1('0x28'),_0xe1c1('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe1c1('0x1')]},'usereqphone':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe1c1('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xe1c1('0x1f')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe1c1('0x3')](_0xe1c1('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xe1c1('0x17'),'no')},'vmexten':{'type':Sequelize[_0xe1c1('0x1')]},'mohinterpret':{'type':Sequelize[_0xe1c1('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xe1c1('0x1')]},'description':{'type':Sequelize[_0xe1c1('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xe1c1('0x2a')},'canreinvite':{'type':Sequelize[_0xe1c1('0x3')]('yes','no',_0xe1c1('0x2b'),_0xe1c1('0x2c'),_0xe1c1('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xe1c1('0x1')]},'active':{'type':Sequelize[_0xe1c1('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 4fa2281..c0f2eb1 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 _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x5465b6,_0x189c8d){var _0x5a7f6a=function(_0x1f36b7){while(--_0x1f36b7){_0x5465b6['push'](_0x5465b6['shift']());}};_0x5a7f6a(++_0x189c8d);}(_0xedd9,0xfc));var _0x9edd=function(_0x36e6b7,_0x76c28){_0x36e6b7=_0x36e6b7-0x0;var _0x39bb34=_0xedd9[_0x36e6b7];return _0x39bb34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file +var _0x24ca=['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','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x38a4a5,_0x151bc6){var _0x7daa9f=function(_0x3ccd8e){while(--_0x3ccd8e){_0x38a4a5['push'](_0x38a4a5['shift']());}};_0x7daa9f(++_0x151bc6);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x24ca[_0x5c6299];return _0x23b564;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index d96c949..e6e847d 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 _0xdd1c=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0xdd1c,0x1d4));var _0xcdd1=function(_0x447725,_0x49753b){_0x447725=_0x447725-0x0;var _0x399167=_0xdd1c[_0x447725];return _0x399167;};'use strict';var _=require('lodash');var util=require(_0xcdd1('0x0'));var logger=require('../../config/logger')(_0xcdd1('0x1'));var moment=require(_0xcdd1('0x2'));var BPromise=require(_0xcdd1('0x3'));var rp=require(_0xcdd1('0x4'));var fs=require('fs');var path=require(_0xcdd1('0x5'));var rimraf=require(_0xcdd1('0x6'));var config=require(_0xcdd1('0x7'));var attributes=require(_0xcdd1('0x8'));module[_0xcdd1('0x9')]=function(_0x220c14,_0x270415){return _0x220c14[_0xcdd1('0xa')](_0xcdd1('0xb'),attributes,{'tableName':_0xcdd1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64f9=['./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ade53,_0x3d07ce){var _0x380370=function(_0x16c71b){while(--_0x16c71b){_0x5ade53['push'](_0x5ade53['shift']());}};_0x380370(++_0x3d07ce);}(_0x64f9,0x1cc));var _0x964f=function(_0x230e39,_0x5341){_0x230e39=_0x230e39-0x0;var _0xa804e=_0x64f9[_0x230e39];return _0xa804e;};'use strict';var _=require(_0x964f('0x0'));var util=require(_0x964f('0x1'));var logger=require(_0x964f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x964f('0x3'));var rp=require(_0x964f('0x4'));var fs=require('fs');var path=require(_0x964f('0x5'));var rimraf=require(_0x964f('0x6'));var config=require(_0x964f('0x7'));var attributes=require(_0x964f('0x8'));module[_0x964f('0x9')]=function(_0x1b411a,_0x3939b2){return _0x1b411a['define'](_0x964f('0xa'),attributes,{'tableName':_0x964f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 6dc4e1b..09e53f4 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 _0x9496=['model','find','ShowTrunk','lodash','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','catch','GetTrunk','Trunk','options','raw','where','attributes','include','map'];(function(_0x4c0c77,_0x3c609e){var _0x4b20b6=function(_0x4f3e95){while(--_0x4f3e95){_0x4c0c77['push'](_0x4c0c77['shift']());}};_0x4b20b6(++_0x3c609e);}(_0x9496,0x183));var _0x6949=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x9496[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x6949('0x0'));var util=require('util');var moment=require(_0x6949('0x1'));var BPromise=require(_0x6949('0x2'));var rs=require(_0x6949('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6949('0x4'))(_0x6949('0x5'));var config=require('../../config/environment');var jayson=require(_0x6949('0x6'));var client=jayson[_0x6949('0x7')][_0x6949('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b2128,_0x116163,_0x618701){return new BPromise(function(_0x3a9063,_0x4454f1){return client['request'](_0x4b2128,_0x618701)[_0x6949('0x9')](function(_0x2de2d9){logger[_0x6949('0xa')]('Trunk,\x20%s,\x20%s',_0x116163,_0x6949('0xb'));logger[_0x6949('0xc')](_0x6949('0xd'),_0x116163,_0x6949('0xb'),JSON[_0x6949('0xe')](_0x2de2d9));if(_0x2de2d9['error']){if(_0x2de2d9[_0x6949('0xf')][_0x6949('0x10')]===0x1f4){logger[_0x6949('0xf')]('Trunk,\x20%s,\x20%s',_0x116163,_0x2de2d9[_0x6949('0xf')][_0x6949('0x11')]);return _0x4454f1(_0x2de2d9[_0x6949('0xf')]['message']);}logger[_0x6949('0xf')](_0x6949('0x12'),_0x116163,_0x2de2d9[_0x6949('0xf')][_0x6949('0x11')]);return _0x3a9063(_0x2de2d9['error'][_0x6949('0x11')]);}else{logger[_0x6949('0xa')]('Trunk,\x20%s,\x20%s',_0x116163,_0x6949('0xb'));_0x3a9063(_0x2de2d9[_0x6949('0x13')]['message']);}})[_0x6949('0x14')](function(_0x3eb449){logger['error'](_0x6949('0x12'),_0x116163,_0x3eb449);_0x4454f1(_0x3eb449);});});}exports[_0x6949('0x15')]=function(_0x17e419){var _0x15f561=this;return new Promise(function(_0x29c9e5,_0x51199f){return db[_0x6949('0x16')]['findAll']({'raw':_0x17e419['options']?_0x17e419[_0x6949('0x17')][_0x6949('0x18')]===undefined?!![]:![]:!![],'where':_0x17e419[_0x6949('0x17')]?_0x17e419[_0x6949('0x17')][_0x6949('0x19')]||null:null,'attributes':_0x17e419[_0x6949('0x17')]?_0x17e419[_0x6949('0x17')][_0x6949('0x1a')]||null:null,'limit':_0x17e419[_0x6949('0x17')]?_0x17e419[_0x6949('0x17')]['limit']||null:null,'include':_0x17e419[_0x6949('0x17')]?_0x17e419['options'][_0x6949('0x1b')]?_[_0x6949('0x1c')](_0x17e419[_0x6949('0x17')][_0x6949('0x1b')],function(_0x1e7588){return{'model':db[_0x1e7588[_0x6949('0x1d')]],'as':_0x1e7588['as'],'attributes':_0x1e7588['attributes'],'include':_0x1e7588['include']?_[_0x6949('0x1c')](_0x1e7588[_0x6949('0x1b')],function(_0x5b660e){return{'model':db[_0x5b660e['model']],'as':_0x5b660e['as'],'attributes':_0x5b660e[_0x6949('0x1a')],'include':_0x5b660e[_0x6949('0x1b')]?_['map'](_0x5b660e['include'],function(_0x98349){return{'model':db[_0x98349['model']],'as':_0x98349['as'],'attributes':_0x98349[_0x6949('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1eaaf4){logger['info'](_0x6949('0x15'),_0x17e419);logger[_0x6949('0xc')](_0x6949('0x15'),_0x17e419,JSON[_0x6949('0xe')](_0x1eaaf4));_0x29c9e5(_0x1eaaf4);})['catch'](function(_0x4cc639){logger[_0x6949('0xf')](_0x6949('0x15'),_0x4cc639['message'],_0x17e419);_0x51199f(_0x15f561['error'](0x1f4,_0x4cc639['message']));});});};exports['ShowTrunk']=function(_0x1452f1){var _0x128a54=this;return new Promise(function(_0x272cbe,_0x172ec4){return db['Trunk'][_0x6949('0x1e')]({'raw':_0x1452f1['options']?_0x1452f1[_0x6949('0x17')][_0x6949('0x18')]===undefined?!![]:![]:!![],'where':_0x1452f1['options']?_0x1452f1['options']['where']||null:null,'attributes':_0x1452f1[_0x6949('0x17')]?_0x1452f1[_0x6949('0x17')][_0x6949('0x1a')]||null:null,'include':_0x1452f1[_0x6949('0x17')]?_0x1452f1[_0x6949('0x17')][_0x6949('0x1b')]?_[_0x6949('0x1c')](_0x1452f1[_0x6949('0x17')]['include'],function(_0x1732ce){return{'model':db[_0x1732ce[_0x6949('0x1d')]],'as':_0x1732ce['as'],'attributes':_0x1732ce['attributes'],'include':_0x1732ce['include']?_[_0x6949('0x1c')](_0x1732ce[_0x6949('0x1b')],function(_0x1979d0){return{'model':db[_0x1979d0[_0x6949('0x1d')]],'as':_0x1979d0['as'],'attributes':_0x1979d0[_0x6949('0x1a')],'include':_0x1979d0[_0x6949('0x1b')]?_[_0x6949('0x1c')](_0x1979d0[_0x6949('0x1b')],function(_0x3d0776){return{'model':db[_0x3d0776[_0x6949('0x1d')]],'as':_0x3d0776['as'],'attributes':_0x3d0776[_0x6949('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6949('0x9')](function(_0x1c52e3){logger[_0x6949('0xa')](_0x6949('0x1f'),_0x1452f1);logger[_0x6949('0xc')](_0x6949('0x1f'),_0x1452f1,JSON[_0x6949('0xe')](_0x1c52e3));_0x272cbe(_0x1c52e3);})['catch'](function(_0xf679c6){logger[_0x6949('0xf')](_0x6949('0x1f'),_0xf679c6[_0x6949('0x11')],_0x1452f1);_0x172ec4(_0x128a54['error'](0x1f4,_0xf679c6[_0x6949('0x11')]));});});}; \ No newline at end of file +var _0x79c8=['catch','GetTrunk','Trunk','findAll','options','raw','where','limit','include','map','attributes','model','debug','ShowTrunk','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1b5436,_0x14bc53){var _0x51ad80=function(_0x1a64ca){while(--_0x1a64ca){_0x1b5436['push'](_0x1b5436['shift']());}};_0x51ad80(++_0x14bc53);}(_0x79c8,0x11e));var _0x879c=function(_0x589750,_0x5efe1a){_0x589750=_0x589750-0x0;var _0x49b7ab=_0x79c8[_0x589750];return _0x49b7ab;};'use strict';var _=require('lodash');var util=require(_0x879c('0x0'));var moment=require('moment');var BPromise=require(_0x879c('0x1'));var rs=require(_0x879c('0x2'));var fs=require('fs');var Redis=require(_0x879c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x879c('0x4'));var logger=require(_0x879c('0x5'))(_0x879c('0x6'));var config=require(_0x879c('0x7'));var jayson=require(_0x879c('0x8'));var client=jayson[_0x879c('0x9')][_0x879c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53005a,_0x3824b9,_0x4038d0){return new BPromise(function(_0x3255e6,_0xbf6280){return client['request'](_0x53005a,_0x4038d0)[_0x879c('0xb')](function(_0x4a42f0){logger['info'](_0x879c('0xc'),_0x3824b9,_0x879c('0xd'));logger['debug'](_0x879c('0xe'),_0x3824b9,'request\x20sent',JSON[_0x879c('0xf')](_0x4a42f0));if(_0x4a42f0[_0x879c('0x10')]){if(_0x4a42f0[_0x879c('0x10')][_0x879c('0x11')]===0x1f4){logger[_0x879c('0x10')](_0x879c('0xc'),_0x3824b9,_0x4a42f0[_0x879c('0x10')][_0x879c('0x12')]);return _0xbf6280(_0x4a42f0[_0x879c('0x10')][_0x879c('0x12')]);}logger['error'](_0x879c('0xc'),_0x3824b9,_0x4a42f0[_0x879c('0x10')][_0x879c('0x12')]);return _0x3255e6(_0x4a42f0[_0x879c('0x10')][_0x879c('0x12')]);}else{logger[_0x879c('0x13')](_0x879c('0xc'),_0x3824b9,'request\x20sent');_0x3255e6(_0x4a42f0['result'][_0x879c('0x12')]);}})[_0x879c('0x14')](function(_0x4e0139){logger[_0x879c('0x10')](_0x879c('0xc'),_0x3824b9,_0x4e0139);_0xbf6280(_0x4e0139);});});}exports[_0x879c('0x15')]=function(_0x4092ef){var _0x24166e=this;return new Promise(function(_0x299530,_0x1d93a2){return db[_0x879c('0x16')][_0x879c('0x17')]({'raw':_0x4092ef[_0x879c('0x18')]?_0x4092ef[_0x879c('0x18')][_0x879c('0x19')]===undefined?!![]:![]:!![],'where':_0x4092ef[_0x879c('0x18')]?_0x4092ef[_0x879c('0x18')][_0x879c('0x1a')]||null:null,'attributes':_0x4092ef[_0x879c('0x18')]?_0x4092ef[_0x879c('0x18')]['attributes']||null:null,'limit':_0x4092ef[_0x879c('0x18')]?_0x4092ef[_0x879c('0x18')][_0x879c('0x1b')]||null:null,'include':_0x4092ef[_0x879c('0x18')]?_0x4092ef[_0x879c('0x18')][_0x879c('0x1c')]?_[_0x879c('0x1d')](_0x4092ef[_0x879c('0x18')]['include'],function(_0x26dc16){return{'model':db[_0x26dc16['model']],'as':_0x26dc16['as'],'attributes':_0x26dc16[_0x879c('0x1e')],'include':_0x26dc16['include']?_[_0x879c('0x1d')](_0x26dc16['include'],function(_0x33fa6e){return{'model':db[_0x33fa6e[_0x879c('0x1f')]],'as':_0x33fa6e['as'],'attributes':_0x33fa6e[_0x879c('0x1e')],'include':_0x33fa6e['include']?_['map'](_0x33fa6e[_0x879c('0x1c')],function(_0x5e2eb0){return{'model':db[_0x5e2eb0['model']],'as':_0x5e2eb0['as'],'attributes':_0x5e2eb0[_0x879c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x879c('0xb')](function(_0x8afe8d){logger[_0x879c('0x13')](_0x879c('0x15'),_0x4092ef);logger[_0x879c('0x20')]('GetTrunk',_0x4092ef,JSON[_0x879c('0xf')](_0x8afe8d));_0x299530(_0x8afe8d);})[_0x879c('0x14')](function(_0x336c7c){logger[_0x879c('0x10')](_0x879c('0x15'),_0x336c7c['message'],_0x4092ef);_0x1d93a2(_0x24166e[_0x879c('0x10')](0x1f4,_0x336c7c[_0x879c('0x12')]));});});};exports['ShowTrunk']=function(_0x16b4e3){var _0x25493f=this;return new Promise(function(_0xa9a3e4,_0x24197a){return db[_0x879c('0x16')]['find']({'raw':_0x16b4e3[_0x879c('0x18')]?_0x16b4e3['options'][_0x879c('0x19')]===undefined?!![]:![]:!![],'where':_0x16b4e3[_0x879c('0x18')]?_0x16b4e3['options']['where']||null:null,'attributes':_0x16b4e3[_0x879c('0x18')]?_0x16b4e3[_0x879c('0x18')][_0x879c('0x1e')]||null:null,'include':_0x16b4e3[_0x879c('0x18')]?_0x16b4e3[_0x879c('0x18')]['include']?_['map'](_0x16b4e3[_0x879c('0x18')]['include'],function(_0x403926){return{'model':db[_0x403926['model']],'as':_0x403926['as'],'attributes':_0x403926[_0x879c('0x1e')],'include':_0x403926[_0x879c('0x1c')]?_[_0x879c('0x1d')](_0x403926[_0x879c('0x1c')],function(_0xc748e3){return{'model':db[_0xc748e3['model']],'as':_0xc748e3['as'],'attributes':_0xc748e3[_0x879c('0x1e')],'include':_0xc748e3[_0x879c('0x1c')]?_['map'](_0xc748e3[_0x879c('0x1c')],function(_0x85c6fc){return{'model':db[_0x85c6fc[_0x879c('0x1f')]],'as':_0x85c6fc['as'],'attributes':_0x85c6fc[_0x879c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x879c('0xb')](function(_0x18fc67){logger['info'](_0x879c('0x21'),_0x16b4e3);logger[_0x879c('0x20')](_0x879c('0x21'),_0x16b4e3,JSON[_0x879c('0xf')](_0x18fc67));_0xa9a3e4(_0x18fc67);})[_0x879c('0x14')](function(_0xc25f08){logger[_0x879c('0x10')](_0x879c('0x21'),_0xc25f08[_0x879c('0x12')],_0x16b4e3);_0x24197a(_0x25493f[_0x879c('0x10')](0x1f4,_0xc25f08[_0x879c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index bea194e..716629a 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 _0x1db1=['../../components/auth/service','put','isAuthenticated','update','express'];(function(_0x16c044,_0x30b078){var _0x2c7e50=function(_0x49b6b4){while(--_0x49b6b4){_0x16c044['push'](_0x16c044['shift']());}};_0x2c7e50(++_0x30b078);}(_0x1db1,0x112));var _0x11db=function(_0x2ff8e9,_0x3ce3a8){_0x2ff8e9=_0x2ff8e9-0x0;var _0x1967d1=_0x1db1[_0x2ff8e9];return _0x1967d1;};'use strict';var express=require(_0x11db('0x0'));var router=express['Router']();var auth=require(_0x11db('0x1'));var controller=require('./user-setting.controller');router[_0x11db('0x2')]('/:id',auth[_0x11db('0x3')](),controller[_0x11db('0x4')]);module['exports']=router; \ No newline at end of file +var _0xe8c0=['update','exports','express','Router','../../components/auth/service','put','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe8c0,0x14a));var _0x0e8c=function(_0x1f93e1,_0x4cf00c){_0x1f93e1=_0x1f93e1-0x0;var _0x46f977=_0xe8c0[_0x1f93e1];return _0x46f977;};'use strict';var express=require(_0x0e8c('0x0'));var router=express[_0x0e8c('0x1')]();var auth=require(_0x0e8c('0x2'));var controller=require('./user-setting.controller');router[_0x0e8c('0x3')](_0x0e8c('0x4'),auth[_0x0e8c('0x5')](),controller[_0x0e8c('0x6')]);module[_0x0e8c('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 bc05b1d..6a316af 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 _0xd265=['exports','ENUM','error','BOOLEAN','DATE','INTEGER','UserId','warning','info','debug'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0xd265,0x1ab));var _0x5d26=function(_0x50284d,_0x2b80b0){_0x50284d=_0x50284d-0x0;var _0x5d29ff=_0xd265[_0x50284d];return _0x5d29ff;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x5d26('0x0'),_0x5d26('0x1'),_0x5d26('0x2')];module[_0x5d26('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5d26('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5d26('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5d26('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5d26('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x5d26('0x8')],'unique':_0x5d26('0x9')}}; \ No newline at end of file +var _0xca02=['error','warning','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xca02,0x1a3));var _0x2ca0=function(_0x5e23da,_0x4eda43){_0x5e23da=_0x5e23da-0x0;var _0x522f29=_0xca02[_0x5e23da];return _0x522f29;};'use strict';var Sequelize=require(_0x2ca0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x2ca0('0x1'),_0x2ca0('0x2'),_0x2ca0('0x3'),_0x2ca0('0x4')];module[_0x2ca0('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x2ca0('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2ca0('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2ca0('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2ca0('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2ca0('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2ca0('0xa')],'unique':_0x2ca0('0xb')}}; \ 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 fd69651..2756b62 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 _0xbe22=['ioredis','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','update','then','sendStatus','stack','name','send','user','role','Unauthorized','params','UserSetting','find','body','catch','lodash'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0xbe22,0x1c1));var _0x2be2=function(_0x575123,_0x26556c){_0x575123=_0x575123-0x0;var _0x466ffe=_0xbe22[_0x575123];return _0x466ffe;};'use strict';var _=require(_0x2be2('0x0'));var Redis=require(_0x2be2('0x1'));var logger=require('../../config/logger')('api');var config=require(_0x2be2('0x2'));var db=require(_0x2be2('0x3'))['db'];var socket=require(_0x2be2('0x4'))(new Redis(config[_0x2be2('0x5')]));require(_0x2be2('0x6'))[_0x2be2('0x7')](socket);config[_0x2be2('0x5')]=_[_0x2be2('0x8')](config[_0x2be2('0x5')],{'host':_0x2be2('0x9'),'port':0x18eb});function respondWithResult(_0x59740c,_0x1fd9fc){_0x1fd9fc=_0x1fd9fc||0xc8;return function(_0x27e1a9){if(_0x27e1a9){return _0x59740c[_0x2be2('0xa')](_0x1fd9fc)['json'](_0x27e1a9);}};}function saveUpdates(_0x338f6f){return function(_0x45a927){if(_0x45a927){return _0x45a927[_0x2be2('0xb')](_0x338f6f)[_0x2be2('0xc')](function(_0x40d8b2){return _0x40d8b2;});}return null;};}function handleEntityNotFound(_0x4cefb1){return function(_0x460ec7){if(!_0x460ec7){_0x4cefb1[_0x2be2('0xd')](0x194);}return _0x460ec7;};}function handleError(_0x4f3ec4,_0x39ddb4){_0x39ddb4=_0x39ddb4||0x1f4;return function(_0x3bc3d9){logger['error'](_0x3bc3d9[_0x2be2('0xe')]);if(_0x3bc3d9[_0x2be2('0xf')]){delete _0x3bc3d9[_0x2be2('0xf')];}_0x4f3ec4['status'](_0x39ddb4)[_0x2be2('0x10')](_0x3bc3d9);};}exports[_0x2be2('0xb')]=function(_0x5d2438,_0x10beca){if(_0x5d2438[_0x2be2('0x11')][_0x2be2('0x12')]!=='admin')throw new Error(_0x2be2('0x13'));if(isNaN(Number(_0x5d2438[_0x2be2('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x2be2('0x15')][_0x2be2('0x16')]({'where':{'id':_0x5d2438['params']['id']}})[_0x2be2('0xc')](handleEntityNotFound(_0x10beca,null))['then'](saveUpdates(_0x5d2438[_0x2be2('0x17')],null))[_0x2be2('0xc')](respondWithResult(_0x10beca,null))[_0x2be2('0x18')](handleError(_0x10beca,null));}; \ No newline at end of file +var _0xd4b6=['params','Invalid\x20user\x20setting\x20id','UserSetting','body','lodash','ioredis','api','../../config/environment','socket.io-emitter','redis','defaults','status','update','then','sendStatus','error','name','user','role','admin','Unauthorized'];(function(_0x54fd80,_0x430280){var _0x415018=function(_0xd04d47){while(--_0xd04d47){_0x54fd80['push'](_0x54fd80['shift']());}};_0x415018(++_0x430280);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x18e2d0,_0x2f0cab){_0x18e2d0=_0x18e2d0-0x0;var _0x3e98ee=_0xd4b6[_0x18e2d0];return _0x3e98ee;};'use strict';var _=require(_0x6d4b('0x0'));var Redis=require(_0x6d4b('0x1'));var logger=require('../../config/logger')(_0x6d4b('0x2'));var config=require(_0x6d4b('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x6d4b('0x4'))(new Redis(config['redis']));require('./user-setting.socket')['register'](socket);config[_0x6d4b('0x5')]=_[_0x6d4b('0x6')](config[_0x6d4b('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x20f52a,_0x42a52a){_0x42a52a=_0x42a52a||0xc8;return function(_0x424690){if(_0x424690){return _0x20f52a[_0x6d4b('0x7')](_0x42a52a)['json'](_0x424690);}};}function saveUpdates(_0x4462e4){return function(_0x4694eb){if(_0x4694eb){return _0x4694eb[_0x6d4b('0x8')](_0x4462e4)[_0x6d4b('0x9')](function(_0x559134){return _0x559134;});}return null;};}function handleEntityNotFound(_0x19f8ef){return function(_0x396267){if(!_0x396267){_0x19f8ef[_0x6d4b('0xa')](0x194);}return _0x396267;};}function handleError(_0x2006a4,_0x401e05){_0x401e05=_0x401e05||0x1f4;return function(_0x45126d){logger[_0x6d4b('0xb')](_0x45126d['stack']);if(_0x45126d[_0x6d4b('0xc')]){delete _0x45126d[_0x6d4b('0xc')];}_0x2006a4[_0x6d4b('0x7')](_0x401e05)['send'](_0x45126d);};}exports[_0x6d4b('0x8')]=function(_0x3d2e81,_0x148531){if(_0x3d2e81[_0x6d4b('0xd')][_0x6d4b('0xe')]!==_0x6d4b('0xf'))throw new Error(_0x6d4b('0x10'));if(isNaN(Number(_0x3d2e81[_0x6d4b('0x11')]['id'])))throw new Error(_0x6d4b('0x12'));return db[_0x6d4b('0x13')]['find']({'where':{'id':_0x3d2e81[_0x6d4b('0x11')]['id']}})['then'](handleEntityNotFound(_0x148531,null))[_0x6d4b('0x9')](saveUpdates(_0x3d2e81[_0x6d4b('0x14')],null))['then'](respondWithResult(_0x148531,null))['catch'](handleError(_0x148531,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 0a799f6..90e0a9a 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 _0xdbbf=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserSetting'];(function(_0x5c87ec,_0x61f877){var _0x4bd9bb=function(_0x51c68e){while(--_0x51c68e){_0x5c87ec['push'](_0x5c87ec['shift']());}};_0x4bd9bb(++_0x61f877);}(_0xdbbf,0xbc));var _0xfdbb=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdbbf[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xfdbb('0x0'))['db'][_0xfdbb('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xfdbb('0x2')](0x0);var events={'afterCreate':_0xfdbb('0x3'),'afterUpdate':_0xfdbb('0x4'),'afterDestroy':_0xfdbb('0x5')};function emitEvent(_0x199d5a){return function(_0x222b2f,_0x1b33f3,_0x587368){UserSettingEvents['emit'](_0x199d5a+':'+_0x222b2f['id'],_0x222b2f);UserSettingEvents[_0xfdbb('0x6')](_0x199d5a,_0x222b2f);_0x587368(null);};}for(var e in events){if(events[_0xfdbb('0x7')](e)){var event=events[e];UserSetting[_0xfdbb('0x8')](e,emitEvent(event));}}module[_0xfdbb('0x9')]=UserSettingEvents; \ No newline at end of file +var _0xa971=['emit','exports','events','../../mysqldb','UserSetting','setMaxListeners','remove'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xa971,0xc6));var _0x1a97=function(_0x3f1298,_0x35e2b0){_0x3f1298=_0x3f1298-0x0;var _0xe7dc50=_0xa971[_0x3f1298];return _0xe7dc50;};'use strict';var EventEmitter=require(_0x1a97('0x0'));var UserSetting=require(_0x1a97('0x1'))['db'][_0x1a97('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1a97('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1a97('0x4')};function emitEvent(_0x49eb9e){return function(_0x4af8ba,_0x3164ed,_0x32a8b6){UserSettingEvents[_0x1a97('0x5')](_0x49eb9e+':'+_0x4af8ba['id'],_0x4af8ba);UserSettingEvents['emit'](_0x49eb9e,_0x4af8ba);_0x32a8b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x1a97('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 58e0bab..a30d711 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 _0xf69c=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','user_settings'];(function(_0x39c585,_0x454a3f){var _0x3ddf40=function(_0x196dcb){while(--_0x196dcb){_0x39c585['push'](_0x39c585['shift']());}};_0x3ddf40(++_0x454a3f);}(_0xf69c,0x1e2));var _0xcf69=function(_0x227b64,_0x1c6f72){_0x227b64=_0x227b64-0x0;var _0xc84cb5=_0xf69c[_0x227b64];return _0xc84cb5;};'use strict';var attributes=require(_0xcf69('0x0'));module[_0xcf69('0x1')]=function(_0x478546){return _0x478546[_0xcf69('0x2')]('UserSetting',attributes,{'tableName':_0xcf69('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x465240){if(!_0x465240[_0xcf69('0x4')])_0x465240['clientSideLoggingEnabledSince']=null;else if(_0x465240[_0xcf69('0x5')]===null)_0x465240[_0xcf69('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x720c=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define'];(function(_0xfe292d,_0x45b223){var _0x2c6948=function(_0x26d32b){while(--_0x26d32b){_0xfe292d['push'](_0xfe292d['shift']());}};_0x2c6948(++_0x45b223);}(_0x720c,0x154));var _0xc720=function(_0x3e3064,_0x3dd6f5){_0x3e3064=_0x3e3064-0x0;var _0x4547e1=_0x720c[_0x3e3064];return _0x4547e1;};'use strict';var attributes=require(_0xc720('0x0'));module['exports']=function(_0x389111){return _0x389111[_0xc720('0x1')](_0xc720('0x2'),attributes,{'tableName':_0xc720('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e0261){if(!_0x5e0261[_0xc720('0x4')])_0x5e0261[_0xc720('0x5')]=null;else if(_0x5e0261[_0xc720('0x5')]===null)_0x5e0261[_0xc720('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 f05af87..fea6af1 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 _0x8d58=['length','user-setting:','save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8d58,0x12e));var _0x88d5=function(_0x50b9a1,_0x20bab2){_0x50b9a1=_0x50b9a1-0x0;var _0x52f36f=_0x8d58[_0x50b9a1];return _0x52f36f;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x88d5('0x0'),_0x88d5('0x1'),_0x88d5('0x2')];function createListener(_0xb245b7,_0x48f62a){return function(_0x50c34a){_0x48f62a[_0x88d5('0x3')](_0xb245b7,_0x50c34a);if(_0xb245b7===_0x88d5('0x4')){_0x48f62a['emit'](_0x88d5('0x5')+_0x50c34a[_0x88d5('0x6')],_0x50c34a);}};}exports[_0x88d5('0x7')]=function(_0x5141ca){for(var _0x376651=0x0,_0xd508f9=events[_0x88d5('0x8')];_0x376651<_0xd508f9;_0x376651++){var _0x5eb692=events[_0x376651];var _0x1bc067=createListener(_0x88d5('0x9')+_0x5eb692,_0x5141ca);UserSettingEvents['on'](_0x5eb692,_0x1bc067);}}; \ No newline at end of file +var _0xa3bf=['user-setting:update:user-','UserId','user-setting:','./user-setting.events','save','update','emit','user-setting:update'];(function(_0x2234cf,_0x64bedc){var _0x1028c9=function(_0x1f15be){while(--_0x1f15be){_0x2234cf['push'](_0x2234cf['shift']());}};_0x1028c9(++_0x64bedc);}(_0xa3bf,0x1eb));var _0xfa3b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa3bf[_0x3ab51d];return _0x29a04e;};'use strict';var UserSettingEvents=require(_0xfa3b('0x0'));var events=[_0xfa3b('0x1'),'remove',_0xfa3b('0x2')];function createListener(_0x575b1b,_0x577d27){return function(_0x13329c){_0x577d27[_0xfa3b('0x3')](_0x575b1b,_0x13329c);if(_0x575b1b===_0xfa3b('0x4')){_0x577d27[_0xfa3b('0x3')](_0xfa3b('0x5')+_0x13329c[_0xfa3b('0x6')],_0x13329c);}};}exports['register']=function(_0x4ca21a){for(var _0x123d69=0x0,_0x32b1da=events['length'];_0x123d69<_0x32b1da;_0x123d69++){var _0x5b9a4e=events[_0x123d69];var _0x4a4b3d=createListener(_0xfa3b('0x7')+_0x5b9a4e,_0x4ca21a);UserSettingEvents['on'](_0x5b9a4e,_0x4a4b3d);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 9f7bb6a..bca9ab9 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 _0x7e51=['/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/chat_websites','addWhatsappAccounts','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','/:id/teams','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/whoami','whoami','/presence','getPresence','/:id','getAvatar','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/groups','/:id/recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','/create_many','bulkCreate','addQueues','diskStorage','root','server/files/images/','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar'];(function(_0x598c44,_0x189ab7){var _0x2a2d1d=function(_0x517828){while(--_0x517828){_0x598c44['push'](_0x598c44['shift']());}};_0x2a2d1d(++_0x189ab7);}(_0x7e51,0x117));var _0x17e5=function(_0x2ee694,_0x292724){_0x2ee694=_0x2ee694-0x0;var _0x4cfee7=_0x7e51[_0x2ee694];return _0x4cfee7;};'use strict';var multer=require(_0x17e5('0x0'));var util=require(_0x17e5('0x1'));var path=require(_0x17e5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x17e5('0x3')]();var fs_extra=require(_0x17e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x17e5('0x5'));var config=require(_0x17e5('0x6'));var controller=require('./user.controller');router['get']('/',auth[_0x17e5('0x7')](),controller[_0x17e5('0x8')]);router[_0x17e5('0x9')]('/describe',auth[_0x17e5('0x7')](),controller[_0x17e5('0xa')]);router['get'](_0x17e5('0xb'),auth[_0x17e5('0x7')](),controller[_0x17e5('0xc')]);router[_0x17e5('0x9')](_0x17e5('0xd'),auth[_0x17e5('0x7')](),controller[_0x17e5('0xe')]);router['get'](_0x17e5('0xf'),auth[_0x17e5('0x7')](),controller['show']);router[_0x17e5('0x9')]('/:id/avatar',controller[_0x17e5('0x10')]);router['get']('/:id/open_tabs',auth[_0x17e5('0x7')](),controller[_0x17e5('0x11')]);router[_0x17e5('0x9')]('/:id/contacts',auth[_0x17e5('0x7')](),controller[_0x17e5('0x12')]);router[_0x17e5('0x9')](_0x17e5('0x13'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x14')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x17e5('0x9')](_0x17e5('0x15'),auth[_0x17e5('0x7')](),controller['getGroups']);router[_0x17e5('0x9')](_0x17e5('0x16'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x17e5('0x9')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x17e5('0x17')]);router[_0x17e5('0x9')](_0x17e5('0x18'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x19')]);router[_0x17e5('0x9')](_0x17e5('0x1a'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x1b')]);router[_0x17e5('0x9')](_0x17e5('0x1c'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x1d')]);router['get'](_0x17e5('0x1e'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x1f')]);router['get'](_0x17e5('0x20'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x21')]);router[_0x17e5('0x9')](_0x17e5('0x22'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x23')]);router[_0x17e5('0x9')]('/:id/teams',auth[_0x17e5('0x7')](),controller['getTeams']);router[_0x17e5('0x9')](_0x17e5('0x24'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x25')]);router[_0x17e5('0x9')](_0x17e5('0x26'),auth[_0x17e5('0x7')](),controller['getAgents']);router[_0x17e5('0x9')](_0x17e5('0x27'),auth[_0x17e5('0x7')](),controller['getVoicePrefixes']);router[_0x17e5('0x9')](_0x17e5('0x28'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x29')]);router[_0x17e5('0x9')](_0x17e5('0x2a'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x2b')]);router[_0x17e5('0x9')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x17e5('0x2c')]);router[_0x17e5('0x9')](_0x17e5('0x2d'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x2e')]);router[_0x17e5('0x9')]('/:id/chat_websites',auth[_0x17e5('0x7')](),controller['getChatWebsites']);router['get'](_0x17e5('0x2f'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x30')]);router[_0x17e5('0x9')](_0x17e5('0x31'),auth[_0x17e5('0x7')](),controller['getSquareProjects']);router[_0x17e5('0x9')](_0x17e5('0x32'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x33')]);router[_0x17e5('0x9')](_0x17e5('0x34'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x35')]);router[_0x17e5('0x36')](_0x17e5('0x37'),auth[_0x17e5('0x7')](),controller['addContacts']);router['post']('/',auth[_0x17e5('0x7')](),controller['create']);router[_0x17e5('0x36')](_0x17e5('0x38'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x39')]);router[_0x17e5('0x36')](_0x17e5('0x13'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x3a')]);var upload=multer({'storage':multer[_0x17e5('0x3b')]({'destination':function(_0x109afa,_0x2558cc,_0x45b390){_0x45b390(null,path['join'](config[_0x17e5('0x3c')],_0x17e5('0x3d')));},'filename':function(_0x414803,_0x3304f3,_0x463167){_0x463167(null,util['format'](_0x17e5('0x3e'),Date[_0x17e5('0x3f')](),_0x3304f3[_0x17e5('0x40')]));}})});router[_0x17e5('0x36')](_0x17e5('0x41'),upload[_0x17e5('0x42')](_0x17e5('0x43')),controller[_0x17e5('0x44')]);router[_0x17e5('0x36')](_0x17e5('0x45'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x46')]);router[_0x17e5('0x36')](_0x17e5('0x47'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x48')]);router[_0x17e5('0x36')](_0x17e5('0x49'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x4a')]);router[_0x17e5('0x36')](_0x17e5('0x4b'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x4c')]);router[_0x17e5('0x36')]('/:id/teams',auth[_0x17e5('0x7')](),controller[_0x17e5('0x4d')]);router[_0x17e5('0x36')](_0x17e5('0x4e'),auth['isAuthenticated'](),controller[_0x17e5('0x4f')]);router[_0x17e5('0x36')](_0x17e5('0x50'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x17e5('0x36')]('/:id/fax_interactions',auth[_0x17e5('0x7')](),controller['addFaxInteractions']);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller['addSmsInteractions']);router['post'](_0x17e5('0x51'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x52')]);router[_0x17e5('0x36')](_0x17e5('0x53'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x54')]);router[_0x17e5('0x36')](_0x17e5('0x28'),auth['isAuthenticated'](),controller[_0x17e5('0x55')]);router['post'](_0x17e5('0x2a'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x56')]);router[_0x17e5('0x36')](_0x17e5('0x57'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x58')]);router[_0x17e5('0x36')]('/:id/sms_accounts',auth[_0x17e5('0x7')](),controller['addSmsAccounts']);router['post'](_0x17e5('0x59'),auth[_0x17e5('0x7')](),controller['addChatWebsites']);router[_0x17e5('0x36')](_0x17e5('0x2f'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x5a')]);router[_0x17e5('0x36')](_0x17e5('0x31'),auth[_0x17e5('0x7')](),controller['addSquareProjects']);router[_0x17e5('0x36')](_0x17e5('0x34'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x5b')]);router['put'](_0x17e5('0xf'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x5c')]);router[_0x17e5('0x5d')](_0x17e5('0x5e'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x5f')]);router[_0x17e5('0x60')](_0x17e5('0x13'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x61')]);router[_0x17e5('0x60')](_0x17e5('0x62'),auth['isAuthenticated'](),controller[_0x17e5('0x63')]);router['delete'](_0x17e5('0xf'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x64')]);router[_0x17e5('0x60')](_0x17e5('0x4e'),auth['isAuthenticated'](),controller[_0x17e5('0x65')]);router[_0x17e5('0x60')](_0x17e5('0x50'),auth['isAuthenticated'](),controller[_0x17e5('0x66')]);router[_0x17e5('0x60')](_0x17e5('0x67'),auth[_0x17e5('0x7')](),controller['removeFaxInteractions']);router['delete'](_0x17e5('0x68'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x69')]);router[_0x17e5('0x60')]('/:id/openchannel_interactions',auth[_0x17e5('0x7')](),controller[_0x17e5('0x6a')]);router[_0x17e5('0x60')](_0x17e5('0x53'),auth['isAuthenticated'](),controller[_0x17e5('0x6b')]);router[_0x17e5('0x60')](_0x17e5('0x28'),auth['isAuthenticated'](),controller[_0x17e5('0x6c')]);router[_0x17e5('0x60')](_0x17e5('0x2a'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x6d')]);router[_0x17e5('0x60')](_0x17e5('0x57'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x6e')]);router['delete'](_0x17e5('0x2d'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x6f')]);router[_0x17e5('0x60')](_0x17e5('0x59'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x70')]);router[_0x17e5('0x60')](_0x17e5('0x2f'),auth[_0x17e5('0x7')](),controller[_0x17e5('0x71')]);router[_0x17e5('0x60')]('/:id/square_projects',auth[_0x17e5('0x7')](),controller[_0x17e5('0x72')]);router[_0x17e5('0x60')](_0x17e5('0x34'),auth[_0x17e5('0x7')](),controller['removeApiKey']);module[_0x17e5('0x73')]=router; \ No newline at end of file +var _0xcfc1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','/:id/agents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','addQueues','join','server/files/images/','format','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeSquareProjects','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0xb3b3a0,_0x32567d){var _0x4e3707=function(_0x3f4e84){while(--_0x3f4e84){_0xb3b3a0['push'](_0xb3b3a0['shift']());}};_0x4e3707(++_0x32567d);}(_0xcfc1,0x1cf));var _0x1cfc=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xcfc1[_0x1203f];return _0x365f0a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cfc('0x0'));var timeout=require(_0x1cfc('0x1'));var express=require(_0x1cfc('0x2'));var router=express[_0x1cfc('0x3')]();var fs_extra=require(_0x1cfc('0x4'));var auth=require(_0x1cfc('0x5'));var interaction=require(_0x1cfc('0x6'));var config=require(_0x1cfc('0x7'));var controller=require(_0x1cfc('0x8'));router[_0x1cfc('0x9')]('/',auth[_0x1cfc('0xa')](),controller[_0x1cfc('0xb')]);router[_0x1cfc('0x9')](_0x1cfc('0xc'),auth[_0x1cfc('0xa')](),controller['describe']);router[_0x1cfc('0x9')](_0x1cfc('0xd'),auth['isAuthenticated'](),controller['whoami']);router[_0x1cfc('0x9')](_0x1cfc('0xe'),auth[_0x1cfc('0xa')](),controller['getPresence']);router['get'](_0x1cfc('0xf'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x10')]);router[_0x1cfc('0x9')](_0x1cfc('0x11'),controller[_0x1cfc('0x12')]);router[_0x1cfc('0x9')](_0x1cfc('0x13'),auth[_0x1cfc('0xa')](),controller['getOpenTabs']);router[_0x1cfc('0x9')](_0x1cfc('0x14'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x15')]);router['get'](_0x1cfc('0x16'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x17')]);router['get'](_0x1cfc('0x18'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x19')]);router['get'](_0x1cfc('0x1a'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x1b')]);router[_0x1cfc('0x9')](_0x1cfc('0x1c'),auth[_0x1cfc('0xa')](),controller['getRecordings']);router['get'](_0x1cfc('0x1d'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x1e')]);router[_0x1cfc('0x9')]('/:id/chat/interactions',auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x1f')]);router[_0x1cfc('0x9')](_0x1cfc('0x20'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x21')]);router['get'](_0x1cfc('0x22'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x23')]);router[_0x1cfc('0x9')](_0x1cfc('0x24'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x25')]);router[_0x1cfc('0x9')]('/:id/fax/interactions',auth[_0x1cfc('0xa')](),controller['getFaxInteractions']);router[_0x1cfc('0x9')](_0x1cfc('0x26'),auth[_0x1cfc('0xa')](),controller['getWhatsappInteractions']);router[_0x1cfc('0x9')](_0x1cfc('0x27'),auth[_0x1cfc('0xa')](),controller['getTeams']);router[_0x1cfc('0x9')](_0x1cfc('0x28'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x29')]);router['get'](_0x1cfc('0x2a'),auth['isAuthenticated'](),controller['getAgents']);router[_0x1cfc('0x9')]('/:id/prefixes',auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x2b')]);router['get'](_0x1cfc('0x2c'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x2d')]);router['get']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x1cfc('0x2e')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0x1cfc('0x2f'),auth['isAuthenticated'](),controller[_0x1cfc('0x30')]);router[_0x1cfc('0x9')](_0x1cfc('0x31'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x32')]);router['get']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x1cfc('0x33')]);router[_0x1cfc('0x9')](_0x1cfc('0x34'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x35')]);router[_0x1cfc('0x9')]('/:id/scheduled_calls',auth[_0x1cfc('0xa')](),controller['getScheduledCalls']);router[_0x1cfc('0x9')](_0x1cfc('0x36'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x37')]);router['post'](_0x1cfc('0x14'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x38')]);router[_0x1cfc('0x39')]('/',auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x3a')]);router[_0x1cfc('0x39')](_0x1cfc('0x3b'),auth['isAuthenticated'](),controller[_0x1cfc('0x3c')]);router[_0x1cfc('0x39')](_0x1cfc('0x16'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x339af0,_0x44636f,_0x11a210){_0x11a210(null,path[_0x1cfc('0x3e')](config['root'],_0x1cfc('0x3f')));},'filename':function(_0x24464c,_0x4d5b7d,_0x1d979f){_0x1d979f(null,util[_0x1cfc('0x40')]('%s-%s',Date['now'](),_0x4d5b7d[_0x1cfc('0x41')]));}})});router[_0x1cfc('0x39')](_0x1cfc('0x11'),upload[_0x1cfc('0x42')](_0x1cfc('0x43')),controller[_0x1cfc('0x44')]);router[_0x1cfc('0x39')](_0x1cfc('0x45'),auth['isAuthenticated'](),controller[_0x1cfc('0x46')]);router[_0x1cfc('0x39')](_0x1cfc('0x47'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x48')]);router[_0x1cfc('0x39')](_0x1cfc('0x49'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x4a')]);router[_0x1cfc('0x39')](_0x1cfc('0x4b'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x4c')]);router[_0x1cfc('0x39')](_0x1cfc('0x27'),auth['isAuthenticated'](),controller[_0x1cfc('0x4d')]);router['post'](_0x1cfc('0x4e'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x4f')]);router[_0x1cfc('0x39')](_0x1cfc('0x50'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x51')]);router[_0x1cfc('0x39')]('/:id/fax_interactions',auth[_0x1cfc('0xa')](),controller['addFaxInteractions']);router[_0x1cfc('0x39')](_0x1cfc('0x52'),auth['isAuthenticated'](),controller[_0x1cfc('0x53')]);router[_0x1cfc('0x39')](_0x1cfc('0x54'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x55')]);router['post'](_0x1cfc('0x56'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x57')]);router['post'](_0x1cfc('0x2c'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x58')]);router[_0x1cfc('0x39')](_0x1cfc('0x59'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x5a')]);router[_0x1cfc('0x39')](_0x1cfc('0x5b'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x5c')]);router[_0x1cfc('0x39')]('/:id/sms_accounts',auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x5d')]);router[_0x1cfc('0x39')](_0x1cfc('0x31'),auth[_0x1cfc('0xa')](),controller['addChatWebsites']);router[_0x1cfc('0x39')]('/:id/whatsapp_accounts',auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x5e')]);router[_0x1cfc('0x39')]('/:id/square_projects',auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x5f')]);router[_0x1cfc('0x39')](_0x1cfc('0x36'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x60')]);router[_0x1cfc('0x61')]('/:id',auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x62')]);router[_0x1cfc('0x61')](_0x1cfc('0x63'),auth['isAuthenticated'](),controller[_0x1cfc('0x64')]);router[_0x1cfc('0x65')](_0x1cfc('0x16'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x66')]);router[_0x1cfc('0x65')](_0x1cfc('0x27'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x67')]);router[_0x1cfc('0x65')](_0x1cfc('0xf'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x68')]);router[_0x1cfc('0x65')](_0x1cfc('0x4e'),auth['isAuthenticated'](),controller[_0x1cfc('0x69')]);router[_0x1cfc('0x65')](_0x1cfc('0x50'),auth[_0x1cfc('0xa')](),controller['removeMailInteractions']);router[_0x1cfc('0x65')](_0x1cfc('0x6a'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x6b')]);router[_0x1cfc('0x65')]('/:id/sms_interactions',auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x6c')]);router['delete'](_0x1cfc('0x54'),auth[_0x1cfc('0xa')](),controller['removeOpenchannelInteractions']);router[_0x1cfc('0x65')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x1cfc('0x65')](_0x1cfc('0x2c'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x6d')]);router[_0x1cfc('0x65')](_0x1cfc('0x59'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x6e')]);router[_0x1cfc('0x65')](_0x1cfc('0x5b'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x6f')]);router[_0x1cfc('0x65')](_0x1cfc('0x2f'),auth[_0x1cfc('0xa')](),controller['removeSmsAccounts']);router[_0x1cfc('0x65')](_0x1cfc('0x31'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x70')]);router[_0x1cfc('0x65')](_0x1cfc('0x71'),auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x72')]);router[_0x1cfc('0x65')]('/:id/square_projects',auth[_0x1cfc('0xa')](),controller[_0x1cfc('0x73')]);router[_0x1cfc('0x65')](_0x1cfc('0x36'),auth[_0x1cfc('0xa')](),controller['removeApiKey']);module[_0x1cfc('0x74')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 59f3217..e866064 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 _0xe706=['admin','user','agent','telephone','local','accountcode','BOOLEAN','DATE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept','uac','uas','certificate','active','passive','actpass','update,nonat','showWebBar','get','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','avpf','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','blocked','blockedAt','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM'];(function(_0x230509,_0x5327de){var _0x5b3042=function(_0x1d3b98){while(--_0x1d3b98){_0x230509['push'](_0x230509['shift']());}};_0x5b3042(++_0x5327de);}(_0xe706,0xa3));var _0x6e70=function(_0x5eb4bb,_0xbd4598){_0x5eb4bb=_0x5eb4bb-0x0;var _0x12d25b=_0xe706[_0x5eb4bb];return _0x12d25b;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var _=require('lodash');module[_0x6e70('0x3')]={'name':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7dfbc3){this[_0x6e70('0x6')](_0x6e70('0x5'),_0x7dfbc3);this[_0x6e70('0x6')](_0x6e70('0x7'),_0x7dfbc3);},'comment':_0x6e70('0x8')},'fullname':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'set':function(_0x36357b){this[_0x6e70('0x6')](_0x6e70('0x9'),_0x36357b);this[_0x6e70('0x6')](_0x6e70('0xa'),util[_0x6e70('0xb')](_0x6e70('0xc'),_0x36357b,this[_0x6e70('0xd')](_0x6e70('0xe'))));}},'alias':{'type':Sequelize[_0x6e70('0x4')]},'email':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0xf'),'validate':{'isEmail':!![]},'set':function(_0x37b3e0){if(_0x37b3e0){this[_0x6e70('0x6')]('email',_0x37b3e0['toLowerCase']());}}},'role':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x11'),_0x6e70('0x12'),_0x6e70('0x13'),_0x6e70('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':_0x6e70('0x15')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x48bc72){this[_0x6e70('0x6')]('internal',_0x48bc72);this['setDataValue'](_0x6e70('0x16'),_0x48bc72);this[_0x6e70('0x6')]('callerid',util[_0x6e70('0xb')]('\x22%s\x22\x20<%s>',this[_0x6e70('0xd')](_0x6e70('0x9')),_0x48bc72));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6e70('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x6e70('0x4')]},'userpic':{'type':Sequelize[_0x6e70('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6e70('0x18')]},'voicePause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x6e70('0x18')]},'chatCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x1a')},'ipaddr':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x6e70('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1b'),'user',_0x6e70('0x1c')),'allowNull':!![],'defaultValue':_0x6e70('0x1b')},'context':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x1d')},'callingpres':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1e'),_0x6e70('0x1f'),_0x6e70('0x20'),_0x6e70('0x21'),_0x6e70('0x22'),'PROHIB_PASSED_SCREEN',_0x6e70('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x24'),'set':function(_0x42b094){this['setDataValue'](_0x6e70('0x25'),_0x42b094?_0x42b094[_0x6e70('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x6e70('0x25'))?this[_0x6e70('0xd')](_0x6e70('0x25'))[_0x6e70('0x27')](','):null;},'comment':_0x6e70('0x28')},'dtmfmode':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x29'),_0x6e70('0x2a'),_0x6e70('0x2b'),_0x6e70('0x2c'),'auto'),'allowNull':!![],'defaultValue':_0x6e70('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no',_0x6e70('0x2e'),_0x6e70('0x2f'),_0x6e70('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x31'),'set':function(_0x2a5444){this[_0x6e70('0x6')](_0x6e70('0x32'),_0x2a5444?_0x2a5444['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x6e70('0xd')](_0x6e70('0x32'))[_0x6e70('0x27')](','):null;},'comment':_0x6e70('0x33')},'callgroup':{'type':Sequelize[_0x6e70('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6e70('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x6e70('0x4')]},'language':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6e70('0x4')]},'disallow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x34')},'allow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x35'),'set':function(_0x16fc7d){this['setDataValue'](_0x6e70('0x36'),_0x16fc7d?_0x16fc7d[_0x6e70('0x26')](';'):_0x6e70('0x35'));},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x36'))?this[_0x6e70('0xd')](_0x6e70('0x36'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'set':function(_0x83847b){this[_0x6e70('0x6')](_0x6e70('0x37'),_0x83847b?_0x83847b['join'](','):null);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x37'))?this[_0x6e70('0xd')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x38')},'amaflags':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x6e70('0x2d')},'busylevel':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6e70('0x10')]('yes','no',_0x6e70('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3a'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3b'),_0x6e70('0x3c')),'allowNull':!![],'defaultValue':_0x6e70('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','fingerprint',_0x6e70('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3e'),_0x6e70('0x3f'),_0x6e70('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','nonat',_0x6e70('0x2f'),_0x6e70('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6e70('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x6e70('0x18')]},'passwordResetAt':{'type':Sequelize[_0x6e70('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x2f9be4){this[_0x6e70('0x6')](_0x6e70('0x42'),_0x2f9be4);var _0x41a861=this[_0x6e70('0x43')]({'plain':!![]});switch(_0x2f9be4){case 0x0:case 0x1:var _0x739946=_0x41a861[_0x6e70('0x25')]?_['isArray'](_0x41a861['transport'])?_0x41a861[_0x6e70('0x25')][_0x6e70('0x26')]():_0x41a861[_0x6e70('0x25')]:_0x6e70('0x24');if(_0x739946==='wss'){_0x739946='udp';}this[_0x6e70('0x6')](_0x6e70('0x25'),_0x739946);this['setDataValue']('encryption','no');this[_0x6e70('0x6')]('avpf',null);this[_0x6e70('0x6')](_0x6e70('0x44'),null);this[_0x6e70('0x6')](_0x6e70('0x45'),null);this[_0x6e70('0x6')](_0x6e70('0x46'),null);this[_0x6e70('0x6')](_0x6e70('0x47'),null);this['setDataValue'](_0x6e70('0x48'),null);this[_0x6e70('0x6')](_0x6e70('0x49'),null);this[_0x6e70('0x6')](_0x6e70('0x4a'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x6e70('0x25'),_0x6e70('0x4b'));this[_0x6e70('0x6')]('encryption','yes');this[_0x6e70('0x6')](_0x6e70('0x4c'),_0x6e70('0x2d'));this[_0x6e70('0x6')](_0x6e70('0x44'),_0x6e70('0x2d'));this['setDataValue'](_0x6e70('0x45'),_0x6e70('0x2d'));this[_0x6e70('0x6')](_0x6e70('0x46'),'yes');this[_0x6e70('0x6')]('dtlsverify','no');this['setDataValue'](_0x6e70('0x48'),_0x6e70('0x40'));this[_0x6e70('0x6')](_0x6e70('0x49'),_0x41a861[_0x6e70('0x49')]||_0x6e70('0x4d'));this['setDataValue'](_0x6e70('0x4a'),_0x41a861[_0x6e70('0x4a')]||_0x6e70('0x4e'));this[_0x6e70('0x6')](_0x6e70('0x4f'),_0x6e70('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x6e70('0x50')],'set':function(_0xd9b4a9){this[_0x6e70('0x6')](_0x6e70('0x51'),_0xd9b4a9?_0xd9b4a9['join'](','):[]);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x51'))?_[_0x6e70('0x52')](this['getDataValue']('permissions')[_0x6e70('0x27')](','),function(_0x18ecf0){return parseInt(_0x18ecf0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6e70('0x53')],'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x54'))?this[_0x6e70('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x576069){if(typeof _0x576069===_0x6e70('0x55')){var _0x21e4c2=_0x576069==='1'?!![]:_0x576069==='0'?![]:_0x576069===_0x6e70('0x56')?!![]:_0x576069==='false'?![]:![];this['setDataValue']('screenrecording',_0x21e4c2);}else{this[_0x6e70('0x6')]('screenrecording',_0x576069);}}},'blocked':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![],'set':function(_0x34237d){this[_0x6e70('0x6')](_0x6e70('0x57'),_0x34237d);if(_0x34237d===!![]){this[_0x6e70('0x6')](_0x6e70('0x58'),moment());this[_0x6e70('0x6')]('loginAttempts',0x0);}else{this[_0x6e70('0x6')](_0x6e70('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x6e70('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6e70('0x19')](0x5)[_0x6e70('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x7d310c,_0x13f278){var _0x453089=function(_0x4907f8){while(--_0x4907f8){_0x7d310c['push'](_0x7d310c['shift']());}};_0x453089(++_0x13f278);}(_0x70e0,0x17b));var _0x070e=function(_0x729a57,_0x34e099){_0x729a57=_0x729a57-0x0;var _0x17dc16=_0x70e0[_0x729a57];return _0x17dc16;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 121f57b..8bc4f04 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 _0xf218=['tag','nolimit','getQueues','pick','options','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','unpause','manual','set','getTeams','Team','addTeams','omit','Voice','getChatQueues','setDataValue','Chat','getMailQueues','Mail','getSmsQueues','Sms','Whatsapp','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','getWhatsappQueues','getFaxQueues','removeAgent','getLists','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','isArray','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$gt','$gte','$lt','$lte','$notIn','$notLike','$iLike','$like','$contains','$contained','lastName','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','resolve','getUserSetting','getPresence','queues','isEmpty','teams','inbound','getAgents','lower','col','asc','desc','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','busy','slice','toUpperCase','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','bluebird','util','path','squel','jayson/promise','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','limit','undefined','count','json','update','then','get','role','admin','Users','user','agent','Telephones','telephone','filter','ignore','value','includes','find','UserProfileResource','stack','name','send','index','User','rawAttributes','map','type','key','password','salt','getOptions','where','query','includeAll','include','true','UserSetting','attributes','push','rows','length','chat','dataValues','fax','mail','openchannel','whatsapp','all','show','params','model','differenceBy','keys','filters','intersection','fields','userSetting','merge','openTabs','sms','body','describe','addContacts','ids','internal','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','101','102','110','104','105','106','107','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','findAll','Agents','some','compact','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','toLowerCase','Queues','capitalize','QueueId','emit','Queue:save','voice','VoiceQueue','format','SIP/%s','penalty','UserVoiceQueueRt','upsert','removeQueues','remove','Queue:remove','destroy','addAvatar','getAvatar','join','server/files/images/logos/default_profile.png','userpic','server/files/images/','download','getOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','order','sort','hasOwnProperty','CmList','List','Tag','color'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0xf218,0xc5));var _0x8f21=function(_0x20cea6,_0x3a0611){_0x20cea6=_0x20cea6-0x0;var _0x29f2ae=_0xf218[_0x20cea6];return _0x29f2ae;};'use strict';var moment=require(_0x8f21('0x0'));var BPromise=require(_0x8f21('0x1'));var util=require(_0x8f21('0x2'));var path=require(_0x8f21('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8f21('0x4'));var jayson=require(_0x8f21('0x5'));var Redis=require(_0x8f21('0x6'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var logger=require(_0x8f21('0x7'))(_0x8f21('0x8'));var utils=require('../../config/utils');var config=require(_0x8f21('0x9'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f21('0xa'))['db'];var socket=require(_0x8f21('0xb'))(new Redis(config[_0x8f21('0xc')]));require(_0x8f21('0xd'))[_0x8f21('0xe')](socket);config['redis']=_[_0x8f21('0xf')](config[_0x8f21('0xc')],{'host':_0x8f21('0x10'),'port':0x18eb});var client=jayson[_0x8f21('0x11')][_0x8f21('0x12')]({'port':0x232a});var values;function respondWithRpcPromise(_0x20386c,_0x1d1e4f,_0x41455b,_0x1efa58){return new BPromise(function(_0x3dc5aa,_0x39339d){var _0x144f49=_0x1efa58||client;return _0x144f49['request'](_0x20386c,_0x41455b)['then'](function(_0x1ecdbe){logger['info'](_0x8f21('0x13'),_0x1d1e4f,_0x8f21('0x14'));logger[_0x8f21('0x15')](_0x8f21('0x16'),_0x1d1e4f,_0x8f21('0x14'),JSON[_0x8f21('0x17')](_0x1ecdbe));if(_0x1ecdbe['error']){if(_0x1ecdbe[_0x8f21('0x18')][_0x8f21('0x19')]===0x1f4){logger[_0x8f21('0x18')]('User,\x20%s,\x20%s',_0x1d1e4f,_0x1ecdbe[_0x8f21('0x18')][_0x8f21('0x1a')]);return _0x39339d(_0x1ecdbe[_0x8f21('0x18')][_0x8f21('0x1a')]);}logger[_0x8f21('0x18')](_0x8f21('0x13'),_0x1d1e4f,_0x1ecdbe[_0x8f21('0x18')][_0x8f21('0x1a')]);return _0x3dc5aa(_0x1ecdbe[_0x8f21('0x18')][_0x8f21('0x1a')]);}else{logger[_0x8f21('0x1b')]('User,\x20%s,\x20%s',_0x1d1e4f,'request\x20sent');_0x3dc5aa(_0x1ecdbe[_0x8f21('0x1c')][_0x8f21('0x1a')]);}})[_0x8f21('0x1d')](function(_0x29c9d9){logger[_0x8f21('0x18')](_0x8f21('0x13'),_0x1d1e4f,_0x29c9d9);_0x39339d(_0x29c9d9);});});}function respondWithStatusCode(_0x1111f8,_0x2d2024){_0x2d2024=_0x2d2024||0xcc;return function(_0x553cc5){if(_0x553cc5){return _0x1111f8[_0x8f21('0x1e')](_0x2d2024);}return _0x1111f8[_0x8f21('0x1f')](_0x2d2024)[_0x8f21('0x20')]();};}function respondWithResult(_0x5595ba,_0x4fc920){_0x4fc920=_0x4fc920||0xc8;return function(_0x2a0037){if(_0x2a0037){return _0x5595ba[_0x8f21('0x1f')](_0x4fc920)['json'](_0x2a0037);}};}function respondWithFilteredResult(_0x13fa17,_0x45c15a){return function(_0x4beee3){if(_0x4beee3){var _0x1aa516=typeof _0x45c15a[_0x8f21('0x21')]==='undefined'&&typeof _0x45c15a[_0x8f21('0x22')]===_0x8f21('0x23');var _0x3d8145=_0x4beee3['count'];var _0x4cf088=_0x1aa516?0x0:_0x45c15a[_0x8f21('0x21')];var _0xb1cb22=_0x1aa516?_0x4beee3[_0x8f21('0x24')]:_0x45c15a[_0x8f21('0x21')]+_0x45c15a[_0x8f21('0x22')];var _0x1fd15b;if(_0xb1cb22>=_0x3d8145){_0xb1cb22=_0x3d8145;_0x1fd15b=0xc8;}else{_0x1fd15b=0xce;}_0x13fa17[_0x8f21('0x1f')](_0x1fd15b);return _0x13fa17['set']('Content-Range',_0x4cf088+'-'+_0xb1cb22+'/'+_0x3d8145)[_0x8f21('0x25')](_0x4beee3);}return null;};}function saveUpdates(_0x3a434){return function(_0xa01164){if(_0xa01164){return _0xa01164[_0x8f21('0x26')](_0x3a434)['then'](function(_0xceaa98){return _0xceaa98;});}return null;};}function removeEntity(_0x3c2b6c){return function(_0x28d32c){if(_0x28d32c){return _0x28d32c['destroy']()[_0x8f21('0x27')](function(){var _0x401d60=_0x28d32c[_0x8f21('0x28')]({'plain':!![]});if(_0x401d60[_0x8f21('0x29')]===_0x8f21('0x2a'))return;var _0x32c73c=[{'name':_0x8f21('0x2b'),'value':_0x8f21('0x2c'),'ignore':!![]},{'name':'Agents','value':_0x8f21('0x2d'),'ignore':![]},{'name':_0x8f21('0x2e'),'value':_0x8f21('0x2f'),'ignore':![]}];var _0x4268db=_(_0x32c73c)[_0x8f21('0x30')](_0x8f21('0x31'))['map'](_0x8f21('0x32'))['value']();if(_[_0x8f21('0x33')](_0x4268db,_0x401d60[_0x8f21('0x29')])){return;}var _0x33c84c=_[_0x8f21('0x34')](_0x32c73c,[_0x8f21('0x32'),_0x401d60['role']])['name'];return db[_0x8f21('0x35')]['destroy']({'where':{'type':_0x33c84c,'resourceId':_0x401d60['id']}})[_0x8f21('0x27')](function(){return _0x28d32c;});})[_0x8f21('0x27')](function(){_0x3c2b6c['status'](0xcc)[_0x8f21('0x20')]();});}};}function handleEntityNotFound(_0x671f5e){return function(_0x5d005e){if(!_0x5d005e){_0x671f5e[_0x8f21('0x1e')](0x194);}return _0x5d005e;};}function handleError(_0x986491,_0x320cb0){_0x320cb0=_0x320cb0||0x1f4;return function(_0x39acee){logger[_0x8f21('0x18')](_0x39acee[_0x8f21('0x36')]);if(_0x39acee[_0x8f21('0x37')]){delete _0x39acee['name'];}_0x986491[_0x8f21('0x1f')](_0x320cb0)[_0x8f21('0x38')](_0x39acee);};}exports[_0x8f21('0x39')]=function(_0x13dc7f,_0x254a45){var _0x2f9476={},_0x1dd785={'count':0x0,'rows':[]};var _0x41714b=_(db[_0x8f21('0x3a')][_0x8f21('0x3b')])[_0x8f21('0x3c')](function(_0x49f9bd){return{'name':_0x49f9bd['fieldName'],'type':_0x49f9bd[_0x8f21('0x3d')][_0x8f21('0x3e')]};})[_0x8f21('0x30')](function(_0x1f7b9d){return!_[_0x8f21('0x33')]([_0x8f21('0x3f'),_0x8f21('0x40')],_0x1f7b9d[_0x8f21('0x37')]);})[_0x8f21('0x32')]();_0x2f9476=qs[_0x8f21('0x41')](_0x41714b,_0x13dc7f);var _0x3e443a={'where':_0x2f9476[_0x8f21('0x42')]};return db[_0x8f21('0x3a')][_0x8f21('0x24')](_0x3e443a)[_0x8f21('0x27')](function(_0x55cff6){_0x1dd785[_0x8f21('0x24')]=_0x55cff6;if(_0x13dc7f[_0x8f21('0x43')][_0x8f21('0x44')]){_0x2f9476[_0x8f21('0x45')]=[{'all':!![]}];}if(_0x13dc7f[_0x8f21('0x43')]['userSetting']===_0x8f21('0x46')){_0x2f9476[_0x8f21('0x45')]=[{'model':db[_0x8f21('0x47')],'as':'userSetting'}];}if(!_[_0x8f21('0x33')](_0x2f9476[_0x8f21('0x48')],'id')){_0x2f9476[_0x8f21('0x48')][_0x8f21('0x49')]('id');}return db[_0x8f21('0x3a')]['findAll'](_0x2f9476);})[_0x8f21('0x27')](function(_0x2396a4){_0x1dd785[_0x8f21('0x4a')]=_0x2396a4;if(_0x13dc7f[_0x8f21('0x43')]['openTabs']===_0x8f21('0x46')){var _0x8d8c85=[];for(var _0xde6cde=0x0;_0xde6cde<_0x1dd785['rows'][_0x8f21('0x4b')];_0xde6cde++){_0x8d8c85['push'](get_open_tabs(_0x8f21('0x4c'),_0x1dd785['rows'][_0xde6cde][_0x8f21('0x4d')]));_0x8d8c85['push'](get_open_tabs('sms',_0x1dd785[_0x8f21('0x4a')][_0xde6cde][_0x8f21('0x4d')]));_0x8d8c85['push'](get_open_tabs(_0x8f21('0x4e'),_0x1dd785['rows'][_0xde6cde]['dataValues']));_0x8d8c85[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x4f'),_0x1dd785[_0x8f21('0x4a')][_0xde6cde][_0x8f21('0x4d')]));_0x8d8c85[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x50'),_0x1dd785[_0x8f21('0x4a')][_0xde6cde]['dataValues']));_0x8d8c85[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x51'),_0x1dd785[_0x8f21('0x4a')][_0xde6cde][_0x8f21('0x4d')]));}return BPromise[_0x8f21('0x52')](_0x8d8c85)[_0x8f21('0x27')](function(){return _0x1dd785;});}else{return _0x1dd785;}})[_0x8f21('0x27')](respondWithFilteredResult(_0x254a45,_0x2f9476))[_0x8f21('0x1d')](handleError(_0x254a45,null));};exports[_0x8f21('0x53')]=function(_0x4b61e6,_0x256853){var _0x11e475={'raw':![],'where':{'id':_0x4b61e6[_0x8f21('0x54')]['id']}},_0x1c1bbb={};_0x1c1bbb[_0x8f21('0x55')]=_[_0x8f21('0x56')](_['keys'](db[_0x8f21('0x3a')][_0x8f21('0x3b')]),[_0x8f21('0x3f'),'salt']);_0x1c1bbb[_0x8f21('0x43')]=_[_0x8f21('0x57')](_0x4b61e6[_0x8f21('0x43')]);_0x1c1bbb[_0x8f21('0x58')]=_[_0x8f21('0x59')](_0x1c1bbb[_0x8f21('0x55')],_0x1c1bbb[_0x8f21('0x43')]);_0x11e475['attributes']=_[_0x8f21('0x59')](_0x1c1bbb[_0x8f21('0x55')],qs[_0x8f21('0x5a')](_0x4b61e6[_0x8f21('0x43')]['fields']));_0x11e475[_0x8f21('0x48')]=_0x11e475[_0x8f21('0x48')]['length']?_0x11e475[_0x8f21('0x48')]:_0x1c1bbb[_0x8f21('0x55')];if(_0x4b61e6[_0x8f21('0x43')][_0x8f21('0x44')]){_0x11e475[_0x8f21('0x45')]=[{'all':!![]}];}if(_0x4b61e6['query'][_0x8f21('0x5b')]===_0x8f21('0x46')){_0x11e475['include']=[{'model':db[_0x8f21('0x47')],'as':_0x8f21('0x5b')}];}_0x11e475=_[_0x8f21('0x5c')]({},_0x11e475,_0x4b61e6['options']);if(!_[_0x8f21('0x33')](_0x11e475[_0x8f21('0x48')],'id')){_0x11e475[_0x8f21('0x48')][_0x8f21('0x49')]('id');}return db['User']['find'](_0x11e475)['then'](handleEntityNotFound(_0x256853,null))[_0x8f21('0x27')](function(_0x49ff9e){var _0x5125f9=[];values=_0x49ff9e;if(_0x4b61e6[_0x8f21('0x43')][_0x8f21('0x5d')]==='true'){_0x5125f9['push'](get_open_tabs('chat',_0x49ff9e[_0x8f21('0x4d')]));_0x5125f9[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x5e'),_0x49ff9e[_0x8f21('0x4d')]));_0x5125f9[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x50'),_0x49ff9e['dataValues']));_0x5125f9[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x51'),_0x49ff9e['dataValues']));_0x5125f9[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x4e'),_0x49ff9e[_0x8f21('0x4d')]));_0x5125f9['push'](get_open_tabs(_0x8f21('0x4f'),_0x49ff9e['dataValues']));return BPromise['all'](_0x5125f9);}else{return values;}})[_0x8f21('0x27')](function(){return values;})[_0x8f21('0x27')](respondWithResult(_0x256853,null))[_0x8f21('0x1d')](handleError(_0x256853,null));};exports[_0x8f21('0x26')]=function(_0x3769ed,_0x46e9d7){if(_0x3769ed['body']['id']){delete _0x3769ed[_0x8f21('0x5f')]['id'];}delete _0x3769ed[_0x8f21('0x5f')][_0x8f21('0x29')];return db[_0x8f21('0x3a')][_0x8f21('0x34')]({'where':{'id':_0x3769ed[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x46e9d7,null))['then'](saveUpdates(_0x3769ed['body'],null))[_0x8f21('0x27')](respondWithResult(_0x46e9d7,null))[_0x8f21('0x1d')](handleError(_0x46e9d7,null));};exports[_0x8f21('0x60')]=function(_0x399863,_0x5af204){return db[_0x8f21('0x3a')]['describe']()[_0x8f21('0x27')](respondWithResult(_0x5af204,null))[_0x8f21('0x1d')](handleError(_0x5af204,null));};exports[_0x8f21('0x61')]=function(_0x46ca60,_0x2412cd){return db[_0x8f21('0x3a')]['find']({'where':{'id':_0x46ca60['params']['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x2412cd,null))[_0x8f21('0x27')](function(_0x1dc473){if(_0x1dc473){return _0x1dc473[_0x8f21('0x61')](_0x46ca60[_0x8f21('0x5f')][_0x8f21('0x62')],_['omit'](_0x46ca60[_0x8f21('0x5f')],[_0x8f21('0x62'),'id'])||{});}})[_0x8f21('0x27')](respondWithResult(_0x2412cd,null))[_0x8f21('0x1d')](handleError(_0x2412cd,null));};function validateUser(_0x45fd8e){return new BPromise(function(_0x4283ba,_0x553046){if(_0x45fd8e[_0x8f21('0x63')])return _0x4283ba(_0x45fd8e);return db['Setting'][_0x8f21('0x64')](0x1)[_0x8f21('0x27')](function(_0x27a8e0){if(_0x27a8e0[_0x8f21('0x65')])authService[_0x8f21('0x66')](_0x45fd8e[_0x8f21('0x3f')]);db[_0x8f21('0x3a')][_0x8f21('0x67')]('internal')[_0x8f21('0x27')](function(_0x55c79e){if(_[_0x8f21('0x68')](_0x55c79e)){_0x45fd8e['internal']=_0x27a8e0[_0x8f21('0x69')]||0x1;return;}if(_[_0x8f21('0x68')](_0x27a8e0['min_internal'])||_0x27a8e0[_0x8f21('0x69')]===_0x55c79e){_0x45fd8e[_0x8f21('0x63')]=_0x55c79e+0x1;return;}if(_0x27a8e0[_0x8f21('0x69')]>_0x55c79e){_0x45fd8e[_0x8f21('0x63')]=_0x27a8e0[_0x8f21('0x69')];return;}return db[_0x8f21('0x6a')][_0x8f21('0x43')]('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[_0x8f21('0x6a')][_0x8f21('0x6b')][_0x8f21('0x6c')]})['then'](function(_0x109a23){if(_0x109a23&&_0x109a23['length']){for(var _0x1f4a23=0x0,_0x3d4b6b=_0x109a23['length'];_0x1f4a23<_0x3d4b6b&&_['isNil'](_0x45fd8e[_0x8f21('0x63')]);_0x1f4a23++){if(_0x27a8e0[_0x8f21('0x69')]<=_0x109a23[_0x1f4a23][_0x8f21('0x6d')]){_0x45fd8e[_0x8f21('0x63')]=_0x109a23[_0x1f4a23][_0x8f21('0x6d')];}else if(_0x27a8e0['min_internal']>_0x109a23[_0x1f4a23][_0x8f21('0x6d')]&&_0x27a8e0[_0x8f21('0x69')]<=_0x109a23[_0x1f4a23]['to']){_0x45fd8e[_0x8f21('0x63')]=_0x27a8e0[_0x8f21('0x69')];}}}if(_[_0x8f21('0x68')](_0x45fd8e[_0x8f21('0x63')])){_0x45fd8e[_0x8f21('0x63')]=_0x55c79e+0x1;}return _0x4283ba(_0x45fd8e);});});})[_0x8f21('0x1d')](function(_0xf45d20){_0x553046(_0xf45d20);});});}function updateUser(_0x3d6e48){return new BPromise(function(_0x544f11,_0x560b8e){try{if(_0x3d6e48[_0x8f21('0x6e')]){_0x3d6e48[_0x8f21('0x6f')]=_0x3d6e48[_0x8f21('0x63')];_0x3d6e48[_0x8f21('0x70')]={'mailbox':_0x3d6e48[_0x8f21('0x63')],'password':_0x3d6e48[_0x8f21('0x3f')],'fullname':_0x3d6e48[_0x8f21('0x71')],'email':_0x3d6e48[_0x8f21('0x72')]};}if(_0x3d6e48['role']===_0x8f21('0x2d')){if(!_0x3d6e48['permissions'])_0x3d6e48['permissions']=[_0x8f21('0x73'),_0x8f21('0x74'),'103','113',_0x8f21('0x75'),_0x8f21('0x76'),_0x8f21('0x77'),_0x8f21('0x78'),_0x8f21('0x79'),'108','109',_0x8f21('0x7a'),_0x8f21('0x7b'),_0x8f21('0x7c'),_0x8f21('0x7d')];}_0x544f11(_0x3d6e48);}catch(_0x64048d){_0x560b8e(_0x64048d);}});}exports[_0x8f21('0x7e')]=function(_0x313134,_0x34efeb){if(_0x313134[_0x8f21('0x2c')][_0x8f21('0x29')]===_0x8f21('0x2d'))throw new Error(_0x8f21('0x7f'));if(_0x313134[_0x8f21('0x5f')][_0x8f21('0x29')]===_0x8f21('0x2c')&&_0x313134[_0x8f21('0x2c')][_0x8f21('0x29')]!==_0x8f21('0x2a')){throw new Error(_0x8f21('0x80'));}if(_0x313134['body'][_0x8f21('0x29')]==='admin'&&_0x313134[_0x8f21('0x2c')]['role']!==_0x8f21('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x8f21('0x81')]([_0x313134[_0x8f21('0x5f')]])[_0x8f21('0x27')](function(){return validateUser(_0x313134['body']);})['then'](function(_0xe3069c){return updateUser(_0xe3069c)['then'](function(_0x2d091c){if(_0x2d091c[_0x8f21('0x29')]===_0x8f21('0x2a')){_0x2d091c[_0x8f21('0x82')]=_0x313134[_0x8f21('0x2c')][_0x8f21('0x82')];delete _0x2d091c[_0x8f21('0x83')];}return _0x2d091c;});})['then'](function(_0x1a7b05){return db[_0x8f21('0x3a')]['create'](_0x1a7b05,{'include':[{'model':db[_0x8f21('0x70')],'as':'VoiceMail'}]});})[_0x8f21('0x27')](function(_0x5258fb){if(_0x313134['body']['role']===_0x8f21('0x2c'))return _0x5258fb;if(_0x313134['user'][_0x8f21('0x29')]!==_0x8f21('0x2c'))return _0x5258fb;return db[_0x8f21('0x84')][_0x8f21('0x34')]({'where':{'name':_0x5258fb[_0x8f21('0x29')]===_0x8f21('0x2d')?'Agents':'Telephones','userProfileId':_0x313134['user'][_0x8f21('0x83')]},'raw':!![]})[_0x8f21('0x27')](function(_0x57a901){if(!_0x57a901||_0x57a901[_0x8f21('0x85')]!=0x0)return _0x5258fb;return db[_0x8f21('0x35')]['create']({'name':_0x5258fb[_0x8f21('0x37')],'resourceId':_0x5258fb['id'],'type':_0x57a901['name'],'sectionId':_0x57a901['id']},{})[_0x8f21('0x27')](function(){return _0x5258fb;});})['catch'](function(_0xfaf60d){logger['error'](_0x8f21('0x86'),_0xfaf60d);throw _0xfaf60d;});})[_0x8f21('0x27')](respondWithResult(_0x34efeb,0xc9))[_0x8f21('0x1d')](handleError(_0x34efeb,null));};exports[_0x8f21('0x87')]=function(_0x2d83ae,_0xc37082){var _0x3118da=_0x2d83ae['body'];var _0x6ccf7c=[];if(_0x2d83ae[_0x8f21('0x2c')][_0x8f21('0x29')]===_0x8f21('0x2d'))throw new Error(_0x8f21('0x7f'));if(_['some'](_0x3118da,['role',_0x8f21('0x2c')])&&_0x2d83ae[_0x8f21('0x2c')]['role']!=='admin'){throw new Error(_0x8f21('0x80'));}if(_['some'](_0x3118da,[_0x8f21('0x29'),_0x8f21('0x2a')])&&_0x2d83ae[_0x8f21('0x2c')][_0x8f21('0x29')]!==_0x8f21('0x2a')){throw new Error(_0x8f21('0x88'));}return licenseUtil[_0x8f21('0x81')](_0x3118da)[_0x8f21('0x27')](function(){return validateUser(_0x3118da[0x0]);})[_0x8f21('0x27')](function(){for(var _0x3c534f=0x1;_0x3c534f<_0x3118da['length'];_0x3c534f++){var _0x185fa7=_0x3118da[_0x3c534f-0x1][_0x8f21('0x63')];if(!_0x3118da[_0x3c534f][_0x8f21('0x63')])_0x3118da[_0x3c534f][_0x8f21('0x63')]=_0x185fa7+0x1;_0x6ccf7c[_0x8f21('0x49')](validateUser(_0x3118da[_0x3c534f]));}return BPromise['all'](_0x6ccf7c);})[_0x8f21('0x27')](function(){_0x6ccf7c=[];for(var _0x2e6985=0x0;_0x2e6985<_0x3118da['length'];_0x2e6985++){_0x6ccf7c[_0x8f21('0x49')](updateUser(_0x3118da[_0x2e6985]));}return BPromise[_0x8f21('0x52')](_0x6ccf7c);})[_0x8f21('0x27')](function(){return BPromise[_0x8f21('0x89')](_0x3118da,function(_0x4dd65a){return db[_0x8f21('0x3a')][_0x8f21('0x7e')](_0x4dd65a,{'include':[{'model':db[_0x8f21('0x70')],'as':_0x8f21('0x70')}]})[_0x8f21('0x27')](function(_0x45a09b){_0x4dd65a['id']=_0x45a09b['id'];return _0x4dd65a;});});})[_0x8f21('0x27')](function(_0x57c136){if(_0x2d83ae[_0x8f21('0x5f')][_0x8f21('0x29')]===_0x8f21('0x2c'))return _0x57c136;if(_0x2d83ae[_0x8f21('0x2c')]['role']!==_0x8f21('0x2c'))return _0x57c136;var _0x4b10d9=_['some'](_0x57c136,function(_0x346745){return _0x346745[_0x8f21('0x29')]===_0x8f21('0x2d')||_0x346745['role']===_0x8f21('0x2f');});if(!_0x4b10d9)return _0x57c136;return db[_0x8f21('0x84')][_0x8f21('0x8a')]({'where':{'name':{'$or':[_0x8f21('0x8b'),_0x8f21('0x2e')]},'userProfileId':_0x2d83ae[_0x8f21('0x2c')][_0x8f21('0x83')]},'raw':!![]})[_0x8f21('0x27')](function(_0x1daec1){if(_['isEmpty'](_0x1daec1)||!_[_0x8f21('0x8c')](_0x1daec1,['autoAssociation',0x0]))return _0x57c136;_0x6ccf7c=[];var _0x1c336f=_(_0x1daec1)[_0x8f21('0x3c')](function(_0xc8bc16){if(_0xc8bc16[_0x8f21('0x85')]===0x1)return;return _0xc8bc16[_0x8f21('0x37')]===_0x8f21('0x8b')?_0x8f21('0x2d'):_0x8f21('0x2f');})[_0x8f21('0x8d')]()[_0x8f21('0x32')]();for(var _0x307e48=0x0;_0x307e48<_0x57c136[_0x8f21('0x4b')];_0x307e48++){if(!_[_0x8f21('0x33')](_0x1c336f,_0x57c136[_0x307e48][_0x8f21('0x29')]))return;var _0x187449=_0x57c136[_0x307e48]['role']===_0x8f21('0x2d')?_0x8f21('0x8b'):_0x8f21('0x2e');_0x6ccf7c['push'](db[_0x8f21('0x35')][_0x8f21('0x7e')]({'name':_0x57c136[_0x307e48][_0x8f21('0x37')],'resourceId':_0x57c136[_0x307e48]['id'],'type':_0x187449,'sectionId':_['find'](_0x1daec1,['name',_0x187449])['id']},{}));}return BPromise[_0x8f21('0x52')](_0x6ccf7c);});})[_0x8f21('0x27')](respondWithResult(_0xc37082,0xc9))[_0x8f21('0x1d')](handleError(_0xc37082,null));};exports[_0x8f21('0x8e')]=function(_0x204018,_0x32707e){if(_0x204018[_0x8f21('0x5f')]['id']){delete _0x204018[_0x8f21('0x5f')]['id'];}return db[_0x8f21('0x3a')]['find']({'where':{'id':_0x204018[_0x8f21('0x54')]['id']}})['then'](function(_0xad9303){if(!_0xad9303)return null;if(_0xad9303['id']===_0x204018[_0x8f21('0x2c')]['id']){if(!_0x204018[_0x8f21('0x5f')][_0x8f21('0x8f')]||!_0x204018[_0x8f21('0x5f')][_0x8f21('0x90')]){throw new db[(_0x8f21('0x91'))]['ValidationError'](_0x8f21('0x92'));}if(!_0xad9303[_0x8f21('0x93')](_0x204018[_0x8f21('0x5f')][_0x8f21('0x8f')])){throw new db['Sequelize'][(_0x8f21('0x94'))](_0x8f21('0x95'));}if(_0x204018[_0x8f21('0x5f')]['oldPassword']===_0x204018[_0x8f21('0x5f')][_0x8f21('0x90')]){throw new db['Sequelize'][(_0x8f21('0x94'))](_0x8f21('0x96'));}}else if(_0x204018['user'][_0x8f21('0x29')]===_0x8f21('0x2a')){if(!_0x204018[_0x8f21('0x5f')][_0x8f21('0x90')]){throw new db['Sequelize'][(_0x8f21('0x94'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x204018['user'][_0x8f21('0x29')]==='user'){if(!_0x204018[_0x8f21('0x5f')][_0x8f21('0x90')]){throw new db[(_0x8f21('0x91'))]['ValidationError'](_0x8f21('0x97'));}if(_0xad9303[_0x8f21('0x29')]!==_0x8f21('0x2d')){throw new db['Sequelize'][(_0x8f21('0x94'))](_0x8f21('0x7f'));}}else{throw new db[(_0x8f21('0x91'))][(_0x8f21('0x94'))]('Unauthorized');}return _0xad9303;})[_0x8f21('0x27')](handleEntityNotFound(_0x32707e,null))['then'](function(_0xe8cd32){return db['Setting']['findOne']({'attributes':['id',_0x8f21('0x65'),_0x8f21('0x98'),_0x8f21('0x99')]})[_0x8f21('0x27')](function(_0x3d5370){if(_0x3d5370[_0x8f21('0x65')])authService[_0x8f21('0x66')](_0x204018[_0x8f21('0x5f')][_0x8f21('0x90')]);if(!_0x3d5370['enforcePasswordHistory']||!_0xe8cd32[_0x8f21('0x9a')])return _0xe8cd32;authService['validatePasswordHistory'](_0x204018[_0x8f21('0x5f')][_0x8f21('0x90')],_0xe8cd32[_0x8f21('0x9a')],_0x3d5370['passwordHistoryLimit']);return _0xe8cd32;})[_0x8f21('0x27')](saveUpdates({'password':_0x204018[_0x8f21('0x5f')]['newPassword'],'passwordResetAt':_0x204018[_0x8f21('0x2c')]['id']==_0x204018[_0x8f21('0x54')]['id']?moment():null,'previousPasswords':authService[_0x8f21('0x9b')](_0x204018[_0x8f21('0x5f')]['newPassword'],_0xe8cd32['previousPasswords'])},null));})[_0x8f21('0x27')](respondWithResult(_0x32707e,null))[_0x8f21('0x1d')](handleError(_0x32707e,null));};exports[_0x8f21('0x9c')]=function(_0x905dfc,_0x4df885){var _0x562273=_0x905dfc[_0x8f21('0x5f')][_0x8f21('0x9d')];return db[_0x8f21('0x3a')]['find']({'where':{'id':_0x905dfc[_0x8f21('0x54')]['id']},'attributes':['id',_0x8f21('0x37'),'role',_0x8f21('0x9e'),_0x8f21('0x9f'),_0x8f21('0xa0'),_0x8f21('0xa1')]})[_0x8f21('0x27')](handleEntityNotFound(_0x4df885,null))['then'](function(_0x179ccf){if(_0x179ccf){if(!utils[_0x8f21('0xa2')](_0x562273)){throw new db[(_0x8f21('0x91'))]['ValidationError'](_0x8f21('0xa3'));}return _0x179ccf['add'+_['capitalize'](_0x562273[_0x8f21('0xa4')]())+_0x8f21('0xa5')](_0x905dfc[_0x8f21('0x5f')][_0x8f21('0x62')],{'penalty':_0x905dfc[_0x8f21('0x5f')]['penalty']||0x0})['spread'](function(_0x5d1315){for(var _0x4f86e1=0x0;_0x4f86e1<_0x905dfc[_0x8f21('0x5f')][_0x8f21('0x62')][_0x8f21('0x4b')];_0x4f86e1+=0x1){var _0x28b0cc={'UserId':Number(_0x905dfc['params']['id'])};_0x28b0cc[_[_0x8f21('0xa6')](_0x562273[_0x8f21('0xa4')]())+_0x8f21('0xa7')]=Number(_0x905dfc[_0x8f21('0x5f')][_0x8f21('0x62')][_0x4f86e1]);socket[_0x8f21('0xa8')](_0x8f21('0x2c')+_[_0x8f21('0xa6')](_0x562273[_0x8f21('0xa4')]())+_0x8f21('0xa9'),_0x28b0cc);}return _0x5d1315;})[_0x8f21('0x27')](function(){if(_0x562273===_0x8f21('0xaa')){return db[_0x8f21('0xab')][_0x8f21('0x8a')]({'where':{'id':_0x905dfc[_0x8f21('0x5f')][_0x8f21('0x62')]||[]},'raw':!![],'attributes':['id',_0x8f21('0x37')]});}})['then'](function(_0x16d649){var _0x3901b2=_0x179ccf[_0x8f21('0x28')]({'plain':!![]});var _0x253f72=[];if(_0x562273===_0x8f21('0xaa')&&_0x3901b2[_0x8f21('0x29')]===_0x8f21('0x2d')&&_0x3901b2['online']){for(var _0x112202=0x0;_0x112202<_0x16d649[_0x8f21('0x4b')];_0x112202+=0x1){_0x253f72[_0x8f21('0x49')]({'membername':_0x3901b2['name'],'UserId':_0x3901b2['id'],'queue_name':_0x16d649[_0x112202][_0x8f21('0x37')],'VoiceQueueId':_0x16d649[_0x112202]['id'],'interface':_[_0x8f21('0x68')](_0x3901b2['interface'])?util[_0x8f21('0xac')](_0x8f21('0xad'),_0x3901b2[_0x8f21('0x37')]):_0x3901b2['interface'],'paused':_0x3901b2[_0x8f21('0xa0')]||![],'penalty':_0x905dfc['body'][_0x8f21('0xae')]||0x0});}return BPromise[_0x8f21('0x89')](_0x253f72,function(_0x4cbf81){return db[_0x8f21('0xaf')][_0x8f21('0xb0')](_0x4cbf81);});}return _0x179ccf;});}})[_0x8f21('0x27')](respondWithStatusCode(_0x4df885,null))['catch'](handleError(_0x4df885,null));};exports[_0x8f21('0xb1')]=function(_0x5b1de5,_0x52188e){var _0x900606,_0xe9cd30;return db['User'][_0x8f21('0x34')]({'where':{'id':_0x5b1de5[_0x8f21('0x54')]['id']},'attributes':['id','name',_0x8f21('0x29')]})[_0x8f21('0x27')](handleEntityNotFound(_0x52188e,null))[_0x8f21('0x27')](function(_0x3a6e29){if(_0x3a6e29){_0x900606=_0x3a6e29;if(!_0x5b1de5[_0x8f21('0x43')][_0x8f21('0x9d')]||!utils[_0x8f21('0xa2')](_0x5b1de5['query'][_0x8f21('0x9d')])){throw new db[(_0x8f21('0x91'))][(_0x8f21('0x94'))](_0x8f21('0xa3'));}return _0x3a6e29[_0x8f21('0xb2')+_['capitalize'](_0x5b1de5['query'][_0x8f21('0x9d')][_0x8f21('0xa4')]())+'Queues'](_0x5b1de5[_0x8f21('0x43')][_0x8f21('0x62')]);}})[_0x8f21('0x27')](function(_0x49adf2){if(_['isArray'](_0x5b1de5['query'][_0x8f21('0x62')])){for(var _0x1ebd9e=0x0;_0x1ebd9e<_0x5b1de5[_0x8f21('0x43')][_0x8f21('0x62')]['length'];_0x1ebd9e+=0x1){_0xe9cd30={'UserId':Number(_0x5b1de5[_0x8f21('0x54')]['id'])};_0xe9cd30[_['capitalize'](_0x5b1de5['query'][_0x8f21('0x9d')]['toLowerCase']())+_0x8f21('0xa7')]=Number(_0x5b1de5[_0x8f21('0x43')][_0x8f21('0x62')][_0x1ebd9e]);socket[_0x8f21('0xa8')](_0x8f21('0x2c')+_['capitalize'](_0x5b1de5[_0x8f21('0x43')][_0x8f21('0x9d')]['toLowerCase']())+_0x8f21('0xb3'),_0xe9cd30);}}else{_0xe9cd30={'UserId':Number(_0x5b1de5['params']['id'])};_0xe9cd30[_['capitalize'](_0x5b1de5[_0x8f21('0x43')]['channel']['toLowerCase']())+_0x8f21('0xa7')]=Number(_0x5b1de5[_0x8f21('0x43')][_0x8f21('0x62')]);socket[_0x8f21('0xa8')](_0x8f21('0x2c')+_[_0x8f21('0xa6')](_0x5b1de5['query']['channel']['toLowerCase']())+_0x8f21('0xb3'),_0xe9cd30);}return _0x49adf2;})[_0x8f21('0x27')](function(){if(_0x5b1de5['query'][_0x8f21('0x9d')]===_0x8f21('0xaa')){return db[_0x8f21('0xaf')][_0x8f21('0xb4')]({'where':{'UserId':_0x5b1de5[_0x8f21('0x54')]['id'],'VoiceQueueId':_0x5b1de5[_0x8f21('0x43')][_0x8f21('0x62')]},'individualHooks':!![]})[_0x8f21('0x27')](function(){return _0x900606;});}return _0x900606;})[_0x8f21('0x27')](respondWithStatusCode(_0x52188e,null))[_0x8f21('0x1d')](handleError(_0x52188e,null));};exports[_0x8f21('0xb5')]=function(_0xa0f2f,_0x57477c){_0xa0f2f[_0x8f21('0x5f')]['userpic']=_0xa0f2f['file']['filename'];return db[_0x8f21('0x3a')][_0x8f21('0x34')]({'where':{'id':_0xa0f2f[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x57477c,null))['then'](saveUpdates(_0xa0f2f[_0x8f21('0x5f')],null))[_0x8f21('0x27')](respondWithResult(_0x57477c,null))['catch'](handleError(_0x57477c,null));};exports[_0x8f21('0xb6')]=function(_0x22a7df,_0xe963af){var _0x1e182d=path[_0x8f21('0xb7')](config['root'],_0x8f21('0xb8'));return db['User'][_0x8f21('0x34')]({'where':{'id':_0x22a7df[_0x8f21('0x54')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x8f21('0x27')](handleEntityNotFound(_0xe963af,null))[_0x8f21('0x27')](function(_0x164bcf){if(_0x164bcf){if(_['isNil'](_0x164bcf[_0x8f21('0xb9')])){return _0xe963af['download'](_0x1e182d);}else{if(!fs['existsSync'](path[_0x8f21('0xb7')](config['root'],_0x8f21('0xba'),_0x164bcf[_0x8f21('0xb9')]))){return _0xe963af[_0x8f21('0xbb')](_0x1e182d);}return _0xe963af[_0x8f21('0xbb')](path[_0x8f21('0xb7')](config['root'],_0x8f21('0xba'),_0x164bcf[_0x8f21('0xb9')]));}}})[_0x8f21('0x1d')](handleError(_0xe963af,null));};exports[_0x8f21('0xbc')]=function(_0x4970bc,_0x27066c){return db[_0x8f21('0x3a')][_0x8f21('0x34')]({'where':{'id':_0x4970bc[_0x8f21('0x54')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x27066c,null))[_0x8f21('0x27')](function(_0x48b436){var _0x452d09=[];values=_0x48b436[_0x8f21('0x4d')];_0x452d09[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x4c'),_0x48b436[_0x8f21('0x4d')]));_0x452d09[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x5e'),_0x48b436['dataValues']));_0x452d09[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x50'),_0x48b436['dataValues']));_0x452d09[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x51'),_0x48b436[_0x8f21('0x4d')]));_0x452d09[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x4e'),_0x48b436[_0x8f21('0x4d')]));_0x452d09[_0x8f21('0x49')](get_open_tabs(_0x8f21('0x4f'),_0x48b436['dataValues']));return BPromise[_0x8f21('0x52')](_0x452d09);})[_0x8f21('0x27')](function(_0xb5558){if(_0xb5558){var _0x475a82=_[_0x8f21('0x3c')](values['ChatOpenTabs'],function(_0x19fdb0){return{'channel':_0x8f21('0xbd'),'id':_0x19fdb0['id'],'createdAt':_0x19fdb0[_0x8f21('0xbe')]};});var _0xd62085=_[_0x8f21('0x3c')](values[_0x8f21('0xbf')],function(_0x3c2181){return{'channel':_0x8f21('0xc0'),'id':_0x3c2181['id'],'createdAt':_0x3c2181[_0x8f21('0xbe')]};});var _0xd10ba8=_[_0x8f21('0x3c')](values[_0x8f21('0xc1')],function(_0x25d347){return{'channel':_0x8f21('0xc2'),'id':_0x25d347['id'],'createdAt':_0x25d347[_0x8f21('0xbe')]};});var _0x26b0a8=_[_0x8f21('0x3c')](values['MailOpenTabs'],function(_0x5e9f7b){return{'channel':_0x8f21('0xc3'),'id':_0x5e9f7b['id'],'createdAt':_0x5e9f7b[_0x8f21('0xbe')]};});var _0x230cfd=_[_0x8f21('0x3c')](values[_0x8f21('0xc4')],function(_0x2b6f59){return{'channel':_0x8f21('0xc5'),'id':_0x2b6f59['id'],'createdAt':_0x2b6f59[_0x8f21('0xbe')]};});var _0x5d39bf=_[_0x8f21('0x3c')](values[_0x8f21('0xc6')],function(_0x4cdadd){return{'channel':_0x8f21('0xc7'),'id':_0x4cdadd['id'],'createdAt':_0x4cdadd[_0x8f21('0xbe')]};});var _0x3afe92=_[_0x8f21('0xc8')](_0x475a82,_0xd62085,_0xd10ba8,_0x26b0a8,_0x230cfd,_0x5d39bf);var _0x5d10c9={'count':_0x3afe92[_0x8f21('0x4b')],'rows':_0x3afe92};return _0x5d10c9;}else return null;})[_0x8f21('0x27')](respondWithResult(_0x27066c,null))[_0x8f21('0x1d')](handleError(_0x27066c,null));};exports[_0x8f21('0xc9')]=function(_0xd49759,_0x2d7da5){var _0x580f11={};var _0x4f17c8={};var _0x15de25;var _0x5413d6;return db[_0x8f21('0x3a')][_0x8f21('0xca')]({'where':{'id':_0xd49759[_0x8f21('0x54')]['id']}})['then'](handleEntityNotFound(_0x2d7da5,null))[_0x8f21('0x27')](function(_0x32e7b7){if(_0x32e7b7){_0x15de25=_0x32e7b7;_0x4f17c8[_0x8f21('0x55')]=_['keys'](db['CmContact'][_0x8f21('0x3b')]);_0x4f17c8['query']=_[_0x8f21('0x57')](_0xd49759[_0x8f21('0x43')]);_0x4f17c8['filters']=_[_0x8f21('0x59')](_0x4f17c8[_0x8f21('0x55')],_0x4f17c8[_0x8f21('0x43')]);_0x580f11['attributes']=_[_0x8f21('0x59')](_0x4f17c8[_0x8f21('0x55')],qs[_0x8f21('0x5a')](_0xd49759[_0x8f21('0x43')][_0x8f21('0x5a')]));_0x580f11[_0x8f21('0x48')]=_0x580f11[_0x8f21('0x48')][_0x8f21('0x4b')]?_0x580f11[_0x8f21('0x48')]:_0x4f17c8[_0x8f21('0x55')];_0x580f11[_0x8f21('0xcb')]=qs[_0x8f21('0xcc')](_0xd49759['query']['sort']);_0x580f11[_0x8f21('0x42')]=qs['filters'](_['pick'](_0xd49759[_0x8f21('0x43')],_0x4f17c8[_0x8f21('0x58')]));if(_0xd49759[_0x8f21('0x43')]['filter']){_0x580f11[_0x8f21('0x42')]=_[_0x8f21('0x5c')](_0x580f11['where'],{'$or':_[_0x8f21('0x3c')](_0x580f11[_0x8f21('0x48')],function(_0x43dca8){var _0x3a3a98={};_0x3a3a98[_0x43dca8]={'$like':'%'+_0xd49759[_0x8f21('0x43')][_0x8f21('0x30')]+'%'};return _0x3a3a98;})});}_0x580f11=_['merge']({},_0x580f11,_0xd49759['options']);return _0x15de25[_0x8f21('0xc9')](_0x580f11);}})[_0x8f21('0x27')](function(_0x52c213){if(_0x52c213){_0x5413d6=_0x52c213[_0x8f21('0x4b')];if(_0xd49759[_0x8f21('0x43')][_0x8f21('0xcd')](_0x8f21('0x44'))){_0x580f11[_0x8f21('0x45')]=[{'model':db[_0x8f21('0xce')],'as':_0x8f21('0xcf'),'required':![]},{'model':db[_0x8f21('0xd0')],'as':'Tags','attributes':['id',_0x8f21('0x37'),_0x8f21('0xd1')],'where':_0xd49759[_0x8f21('0x43')][_0x8f21('0xd2')]?{'id':_0xd49759[_0x8f21('0x43')][_0x8f21('0xd2')]}:undefined,'required':_0xd49759[_0x8f21('0x43')][_0x8f21('0xd2')]?!![]:![]}];}if(!_0xd49759[_0x8f21('0x43')][_0x8f21('0xcd')](_0x8f21('0xd3'))){_0x580f11[_0x8f21('0x22')]=qs[_0x8f21('0x22')](_0xd49759[_0x8f21('0x43')][_0x8f21('0x22')]);_0x580f11[_0x8f21('0x21')]=qs[_0x8f21('0x21')](_0xd49759[_0x8f21('0x43')][_0x8f21('0x21')]);}return _0x15de25[_0x8f21('0xc9')](_0x580f11);}})[_0x8f21('0x27')](function(_0x23ed01){if(_0x23ed01){return _0x23ed01?{'count':_0x5413d6,'rows':_0x23ed01}:null;}})[_0x8f21('0x27')](respondWithResult(_0x2d7da5,null))[_0x8f21('0x1d')](handleError(_0x2d7da5,null));};exports[_0x8f21('0xd4')]=function(_0x31c2dd,_0x344a03){var _0x417a28;var _0x4916bd={};var _0x162593;return db[_0x8f21('0x3a')][_0x8f21('0xca')]({'where':{'id':_0x31c2dd[_0x8f21('0x54')]['id']},'attributes':['id',_0x8f21('0x37'),'role']})[_0x8f21('0x27')](handleEntityNotFound(_0x344a03,null))[_0x8f21('0x27')](function(_0xe6a03b){if(!utils[_0x8f21('0xa2')](_0x31c2dd[_0x8f21('0x43')][_0x8f21('0x9d')])){throw new db[(_0x8f21('0x91'))][(_0x8f21('0x94'))](_0x8f21('0xa3'));}_0x417a28=_0xe6a03b;var _0x3e775c={};_0x3e775c[_0x8f21('0x55')]=_[_0x8f21('0x57')](db[_[_0x8f21('0xa6')](_0x31c2dd[_0x8f21('0x43')][_0x8f21('0x9d')])+'Queue']['rawAttributes']);_0x3e775c[_0x8f21('0x43')]=_[_0x8f21('0x57')](_0x31c2dd[_0x8f21('0x43')]);_0x3e775c[_0x8f21('0x58')]=_[_0x8f21('0x59')](_0x3e775c[_0x8f21('0x55')],_0x3e775c['query']);_0x4916bd[_0x8f21('0x48')]=_[_0x8f21('0x59')](_0x3e775c[_0x8f21('0x55')],qs[_0x8f21('0x5a')](_0x31c2dd['query']['fields']));_0x4916bd[_0x8f21('0x48')]=_0x4916bd['attributes']['length']?_0x4916bd[_0x8f21('0x48')]:_0x3e775c[_0x8f21('0x55')];_0x4916bd['order']=qs[_0x8f21('0xcc')](_0x31c2dd[_0x8f21('0x43')][_0x8f21('0xcc')]);_0x4916bd[_0x8f21('0x42')]=qs[_0x8f21('0x58')](_[_0x8f21('0xd5')](_0x31c2dd[_0x8f21('0x43')],_0x3e775c[_0x8f21('0x58')]));if(_0x31c2dd['query'][_0x8f21('0x30')]){_0x4916bd[_0x8f21('0x42')]=_[_0x8f21('0x5c')](_0x4916bd[_0x8f21('0x42')],{'$or':_['map'](_0x4916bd['attributes'],function(_0x5deb85){var _0x35cbfe={};_0x35cbfe[_0x5deb85]={'$like':'%'+_0x31c2dd[_0x8f21('0x43')][_0x8f21('0x30')]+'%'};return _0x35cbfe;})});}_0x4916bd=_['merge']({},_0x4916bd,_0x31c2dd[_0x8f21('0xd6')]);switch(_0x417a28[_0x8f21('0x29')]){case _0x8f21('0x2a'):return db[_['capitalize'](_0x31c2dd[_0x8f21('0x43')][_0x8f21('0x9d')])+_0x8f21('0xd7')][_0x8f21('0x8a')](_0x4916bd);case'user':case _0x8f21('0x2d'):return _0x417a28[_0x8f21('0x28')+_['capitalize'](_0x31c2dd[_0x8f21('0x43')]['channel'])+'Queues'](_0x4916bd);default:throw new db[(_0x8f21('0x91'))][(_0x8f21('0x94'))](_0x8f21('0xd8'));}})[_0x8f21('0x27')](function(_0x31dc18){_0x162593=_0x31dc18['length'];if(!_0x31c2dd[_0x8f21('0x43')]['hasOwnProperty'](_0x8f21('0xd3'))){_0x4916bd[_0x8f21('0x22')]=qs[_0x8f21('0x22')](_0x31c2dd[_0x8f21('0x43')][_0x8f21('0x22')]);_0x4916bd[_0x8f21('0x21')]=qs[_0x8f21('0x21')](_0x31c2dd[_0x8f21('0x43')][_0x8f21('0x21')]);}switch(_0x417a28[_0x8f21('0x29')]){case _0x8f21('0x2a'):return db[_[_0x8f21('0xa6')](_0x31c2dd[_0x8f21('0x43')][_0x8f21('0x9d')])+_0x8f21('0xd7')]['findAll'](_0x4916bd);case'user':case _0x8f21('0x2d'):return _0x417a28['get'+_[_0x8f21('0xa6')](_0x31c2dd[_0x8f21('0x43')][_0x8f21('0x9d')])+'Queues'](_0x4916bd);}})['then'](function(_0x4d7ea7){return{'count':_0x162593,'rows':_0x4d7ea7};})[_0x8f21('0x27')](respondWithResult(_0x344a03,null))[_0x8f21('0x1d')](handleError(_0x344a03,null));};exports['getVoiceQueuesRt']=function(_0x355548,_0x10a0a7){var _0x5b2b54={};var _0x4196a3={};var _0x177e86;var _0x18963c;return db[_0x8f21('0x3a')]['findOne']({'where':{'id':_0x355548['params']['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x10a0a7,null))['then'](function(_0x199f27){if(_0x199f27){_0x177e86=_0x199f27;_0x4196a3[_0x8f21('0x55')]=_['keys'](db[_0x8f21('0xaf')][_0x8f21('0x3b')]);_0x4196a3[_0x8f21('0x43')]=_[_0x8f21('0x57')](_0x355548[_0x8f21('0x43')]);_0x4196a3[_0x8f21('0x58')]=_[_0x8f21('0x59')](_0x4196a3[_0x8f21('0x55')],_0x4196a3[_0x8f21('0x43')]);_0x5b2b54[_0x8f21('0x48')]=_[_0x8f21('0x59')](_0x4196a3[_0x8f21('0x55')],qs[_0x8f21('0x5a')](_0x355548['query'][_0x8f21('0x5a')]));_0x5b2b54[_0x8f21('0x48')]=_0x5b2b54[_0x8f21('0x48')][_0x8f21('0x4b')]?_0x5b2b54[_0x8f21('0x48')]:_0x4196a3['model'];_0x5b2b54[_0x8f21('0xcb')]=qs[_0x8f21('0xcc')](_0x355548['query']['sort']);_0x5b2b54[_0x8f21('0x42')]=qs['filters'](_['pick'](_0x355548[_0x8f21('0x43')],_0x4196a3[_0x8f21('0x58')]));if(_0x355548[_0x8f21('0x43')][_0x8f21('0x30')]){_0x5b2b54[_0x8f21('0x42')]=_[_0x8f21('0x5c')](_0x5b2b54[_0x8f21('0x42')],{'$or':_['map'](_0x5b2b54[_0x8f21('0x48')],function(_0x54506a){var _0x54ea2c={};_0x54ea2c[_0x54506a]={'$like':'%'+_0x355548[_0x8f21('0x43')][_0x8f21('0x30')]+'%'};return _0x54ea2c;})});}_0x5b2b54=_[_0x8f21('0x5c')]({},_0x5b2b54,_0x355548[_0x8f21('0xd6')]);return _0x177e86['getVoiceQueuesRt'](_0x5b2b54);}})[_0x8f21('0x27')](function(_0x27cf76){if(_0x27cf76){_0x18963c=_0x27cf76[_0x8f21('0x4b')];if(!_0x355548[_0x8f21('0x43')][_0x8f21('0xcd')](_0x8f21('0xd3'))){_0x5b2b54['limit']=qs[_0x8f21('0x22')](_0x355548[_0x8f21('0x43')]['limit']);_0x5b2b54[_0x8f21('0x21')]=qs['offset'](_0x355548[_0x8f21('0x43')][_0x8f21('0x21')]);}return _0x177e86[_0x8f21('0xd9')](_0x5b2b54);}})[_0x8f21('0x27')](function(_0x5ac2f1){if(_0x5ac2f1){return _0x5ac2f1?{'count':_0x18963c,'rows':_0x5ac2f1}:null;}})[_0x8f21('0x27')](respondWithResult(_0x10a0a7,null))['catch'](handleError(_0x10a0a7,null));};exports[_0x8f21('0xda')]=function(_0xbb6cbe,_0xcc1059){var _0x2628e8={};var _0x16a263={};var _0x361d1d;var _0x211053;return db[_0x8f21('0x3a')]['findOne']({'where':{'id':_0xbb6cbe[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0xcc1059,null))['then'](function(_0x23c677){if(_0x23c677){_0x361d1d=_0x23c677;_0x16a263['model']=_['keys'](db['ChatGroup'][_0x8f21('0x3b')]);_0x16a263['query']=_[_0x8f21('0x57')](_0xbb6cbe[_0x8f21('0x43')]);_0x16a263['filters']=_[_0x8f21('0x59')](_0x16a263[_0x8f21('0x55')],_0x16a263[_0x8f21('0x43')]);_0x2628e8[_0x8f21('0x48')]=_['intersection'](_0x16a263[_0x8f21('0x55')],qs[_0x8f21('0x5a')](_0xbb6cbe['query']['fields']));_0x2628e8[_0x8f21('0x48')]=_0x2628e8[_0x8f21('0x48')][_0x8f21('0x4b')]?_0x2628e8[_0x8f21('0x48')]:_0x16a263[_0x8f21('0x55')];_0x2628e8[_0x8f21('0xcb')]=qs['sort'](_0xbb6cbe[_0x8f21('0x43')][_0x8f21('0xcc')]);_0x2628e8[_0x8f21('0x42')]=qs[_0x8f21('0x58')](_[_0x8f21('0xd5')](_0xbb6cbe['query'],_0x16a263[_0x8f21('0x58')]));if(_0xbb6cbe[_0x8f21('0x43')]['filter']){_0x2628e8[_0x8f21('0x42')]=_[_0x8f21('0x5c')](_0x2628e8[_0x8f21('0x42')],{'$or':_['map'](_0x2628e8['attributes'],function(_0x59b083){var _0x2e0010={};_0x2e0010[_0x59b083]={'$like':'%'+_0xbb6cbe[_0x8f21('0x43')][_0x8f21('0x30')]+'%'};return _0x2e0010;})});}_0x2628e8=_[_0x8f21('0x5c')]({},_0x2628e8,_0xbb6cbe[_0x8f21('0xd6')]);return _0x361d1d[_0x8f21('0xda')](_0x2628e8);}})[_0x8f21('0x27')](function(_0x56a89d){if(_0x56a89d){_0x211053=_0x56a89d[_0x8f21('0x4b')];if(!_0xbb6cbe['query'][_0x8f21('0xcd')](_0x8f21('0xd3'))){_0x2628e8[_0x8f21('0x22')]=qs['limit'](_0xbb6cbe[_0x8f21('0x43')]['limit']);_0x2628e8[_0x8f21('0x21')]=qs[_0x8f21('0x21')](_0xbb6cbe[_0x8f21('0x43')][_0x8f21('0x21')]);}return _0x361d1d[_0x8f21('0xda')](_0x2628e8);}})[_0x8f21('0x27')](function(_0xe92a8e){if(_0xe92a8e){return _0xe92a8e?{'count':_0x211053,'rows':_0xe92a8e}:null;}})[_0x8f21('0x27')](respondWithResult(_0xcc1059,null))[_0x8f21('0x1d')](handleError(_0xcc1059,null));};exports[_0x8f21('0xdb')]=function(_0xec2881,_0x130eab){var _0x25b039={'raw':!![],'where':{}};var _0x5430e1={};var _0x110d10={'count':0x0,'rows':[]};return db[_0x8f21('0x3a')][_0x8f21('0xca')]({'where':{'id':_0xec2881['params']['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x130eab,null))[_0x8f21('0x27')](function(_0xf374a0){if(_0xf374a0){_0x5430e1[_0x8f21('0x55')]=_[_0x8f21('0x57')](db[_0x8f21('0xdc')][_0x8f21('0x3b')]);_0x5430e1[_0x8f21('0x43')]=_[_0x8f21('0x57')](_0xec2881[_0x8f21('0x43')]);_0x5430e1['filters']=_[_0x8f21('0x59')](_0x5430e1[_0x8f21('0x55')],_0x5430e1[_0x8f21('0x43')]);_0x25b039[_0x8f21('0x48')]=_[_0x8f21('0x59')](_0x5430e1['model'],qs[_0x8f21('0x5a')](_0xec2881['query'][_0x8f21('0x5a')]));_0x25b039[_0x8f21('0x48')]=_0x25b039[_0x8f21('0x48')][_0x8f21('0x4b')]?_0x25b039[_0x8f21('0x48')]:_0x5430e1[_0x8f21('0x55')];if(!_0xec2881[_0x8f21('0x43')]['hasOwnProperty']('nolimit')){_0x25b039[_0x8f21('0x22')]=qs[_0x8f21('0x22')](_0xec2881[_0x8f21('0x43')][_0x8f21('0x22')]);_0x25b039[_0x8f21('0x21')]=qs['offset'](_0xec2881['query']['offset']);}_0x25b039['order']=qs['sort'](_0xec2881[_0x8f21('0x43')][_0x8f21('0xcc')]);_0x25b039[_0x8f21('0x42')]=qs[_0x8f21('0x58')](_[_0x8f21('0xd5')](_0xec2881[_0x8f21('0x43')],_0x5430e1['filters']));_0x25b039[_0x8f21('0x42')][_0x8f21('0xdd')]=_0xf374a0['id'];if(_0xec2881[_0x8f21('0x43')][_0x8f21('0x30')]){_0x25b039[_0x8f21('0x42')]=_[_0x8f21('0x5c')](_0x25b039[_0x8f21('0x42')],{'$or':_[_0x8f21('0x3c')](_0x25b039[_0x8f21('0x48')],function(_0xfbd214){var _0x49b8ba={};_0x49b8ba[_0xfbd214]={'$like':'%'+_0xec2881['query'][_0x8f21('0x30')]+'%'};return _0x49b8ba;})});}_0x25b039=_[_0x8f21('0x5c')]({},_0x25b039,_0xec2881[_0x8f21('0xd6')]);return db[_0x8f21('0xdc')][_0x8f21('0x24')]({'where':_0x25b039[_0x8f21('0x42')]})[_0x8f21('0x27')](function(_0x283eef){_0x110d10[_0x8f21('0x24')]=_0x283eef;if(_0xec2881['query'][_0x8f21('0x44')]){_0x25b039[_0x8f21('0x45')]=[{'all':!![]}];}return db[_0x8f21('0xdc')]['findAll'](_0x25b039);})['then'](function(_0x4be151){_0x110d10[_0x8f21('0x4a')]=_0x4be151;return _0x110d10;});}})['then'](respondWithFilteredResult(_0x130eab,_0x25b039))[_0x8f21('0x1d')](handleError(_0x130eab,null));};exports[_0x8f21('0xde')]=function(_0x188c21,_0x23cf8c){var _0x159f3a={'raw':!![],'where':{}};var _0x1cdcd4={};var _0x520627={'count':0x0,'rows':[]};return db[_0x8f21('0x3a')][_0x8f21('0xca')]({'where':{'id':_0x188c21[_0x8f21('0x54')]['id']}})['then'](handleEntityNotFound(_0x23cf8c,null))[_0x8f21('0x27')](function(_0x50df44){if(_0x50df44){_0x1cdcd4[_0x8f21('0x55')]=_[_0x8f21('0x57')](db[_0x8f21('0xdf')]['rawAttributes']);_0x1cdcd4['query']=_[_0x8f21('0x57')](_0x188c21[_0x8f21('0x43')]);_0x1cdcd4['filters']=_[_0x8f21('0x59')](_0x1cdcd4[_0x8f21('0x55')],_0x1cdcd4['query']);_0x159f3a[_0x8f21('0x48')]=_['intersection'](_0x1cdcd4[_0x8f21('0x55')],qs[_0x8f21('0x5a')](_0x188c21[_0x8f21('0x43')][_0x8f21('0x5a')]));_0x159f3a[_0x8f21('0x48')]=_0x159f3a[_0x8f21('0x48')]['length']?_0x159f3a['attributes']:_0x1cdcd4['model'];if(!_0x188c21['query'][_0x8f21('0xcd')](_0x8f21('0xd3'))){_0x159f3a[_0x8f21('0x22')]=qs['limit'](_0x188c21[_0x8f21('0x43')][_0x8f21('0x22')]);_0x159f3a[_0x8f21('0x21')]=qs['offset'](_0x188c21['query'][_0x8f21('0x21')]);}_0x159f3a[_0x8f21('0xcb')]=qs[_0x8f21('0xcc')](_0x188c21[_0x8f21('0x43')][_0x8f21('0xcc')]);_0x159f3a[_0x8f21('0x42')]=qs[_0x8f21('0x58')](_[_0x8f21('0xd5')](_0x188c21[_0x8f21('0x43')],_0x1cdcd4[_0x8f21('0x58')]));_0x159f3a[_0x8f21('0x42')][_0x8f21('0xdd')]=_0x50df44['id'];if(_0x188c21[_0x8f21('0x43')][_0x8f21('0x30')]){_0x159f3a['where']=_['merge'](_0x159f3a['where'],{'$or':_['map'](_0x159f3a['attributes'],function(_0x529a90){var _0x30e6b3={};_0x30e6b3[_0x529a90]={'$like':'%'+_0x188c21['query'][_0x8f21('0x30')]+'%'};return _0x30e6b3;})});}_0x159f3a=_[_0x8f21('0x5c')]({},_0x159f3a,_0x188c21[_0x8f21('0xd6')]);return db['ScreenRecording']['count']({'where':_0x159f3a[_0x8f21('0x42')]})[_0x8f21('0x27')](function(_0x26d367){_0x520627[_0x8f21('0x24')]=_0x26d367;if(_0x188c21[_0x8f21('0x43')]['includeAll']){_0x159f3a[_0x8f21('0x45')]=[{'all':!![]}];}return db[_0x8f21('0xdf')][_0x8f21('0x8a')](_0x159f3a);})['then'](function(_0x1a1119){_0x520627[_0x8f21('0x4a')]=_0x1a1119;return _0x520627;});}})['then'](respondWithFilteredResult(_0x23cf8c,_0x159f3a))[_0x8f21('0x1d')](handleError(_0x23cf8c,null));};exports[_0x8f21('0xe0')]=function(_0x5e5697,_0x5e9895){var _0x4b362b={};var _0x5f4dad={};var _0x53aef3;var _0x69db60;return db[_0x8f21('0x3a')][_0x8f21('0xca')]({'where':{'id':_0x5e5697[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x5e9895,null))[_0x8f21('0x27')](function(_0x2d23cc){if(_0x2d23cc){_0x53aef3=_0x2d23cc;_0x5f4dad['model']=_[_0x8f21('0x57')](db[_0x8f21('0xe1')][_0x8f21('0x3b')]);_0x5f4dad[_0x8f21('0x43')]=_[_0x8f21('0x57')](_0x5e5697[_0x8f21('0x43')]);_0x5f4dad[_0x8f21('0x58')]=_['intersection'](_0x5f4dad[_0x8f21('0x55')],_0x5f4dad[_0x8f21('0x43')]);_0x4b362b[_0x8f21('0x48')]=_[_0x8f21('0x59')](_0x5f4dad[_0x8f21('0x55')],qs[_0x8f21('0x5a')](_0x5e5697[_0x8f21('0x43')]['fields']));_0x4b362b[_0x8f21('0x48')]=_0x4b362b[_0x8f21('0x48')][_0x8f21('0x4b')]?_0x4b362b[_0x8f21('0x48')]:_0x5f4dad['model'];_0x4b362b[_0x8f21('0xcb')]=qs[_0x8f21('0xcc')](_0x5e5697[_0x8f21('0x43')][_0x8f21('0xcc')]);_0x4b362b[_0x8f21('0x42')]=qs[_0x8f21('0x58')](_['pick'](_0x5e5697['query'],_0x5f4dad[_0x8f21('0x58')]));if(_0x5e5697[_0x8f21('0x43')][_0x8f21('0x30')]){_0x4b362b[_0x8f21('0x42')]=_['merge'](_0x4b362b['where'],{'$or':_[_0x8f21('0x3c')](_0x4b362b['attributes'],function(_0x1504ce){var _0x26576d={};_0x26576d[_0x1504ce]={'$like':'%'+_0x5e5697[_0x8f21('0x43')][_0x8f21('0x30')]+'%'};return _0x26576d;})});}_0x4b362b=_['merge']({},_0x4b362b,_0x5e5697[_0x8f21('0xd6')]);return _0x53aef3['getChatInteractions'](_0x4b362b);}})[_0x8f21('0x27')](function(_0xf60038){if(_0xf60038){_0x69db60=_0xf60038[_0x8f21('0x4b')];if(!_0x5e5697['query'][_0x8f21('0xcd')]('nolimit')){_0x4b362b['limit']=qs['limit'](_0x5e5697[_0x8f21('0x43')][_0x8f21('0x22')]);_0x4b362b[_0x8f21('0x21')]=qs['offset'](_0x5e5697[_0x8f21('0x43')]['offset']);}return _0x53aef3[_0x8f21('0xe0')](_0x4b362b);}})['then'](function(_0x526493){if(_0x526493){return _0x526493?{'count':_0x69db60,'rows':_0x526493}:null;}})[_0x8f21('0x27')](respondWithResult(_0x5e9895,null))[_0x8f21('0x1d')](handleError(_0x5e9895,null));};exports['getOpenchannelInteractions']=function(_0x275023,_0x967fb8){var _0x4a4e2c={};var _0x280a24={};var _0x407683;var _0x4b890f;return db[_0x8f21('0x3a')][_0x8f21('0xca')]({'where':{'id':_0x275023[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x967fb8,null))[_0x8f21('0x27')](function(_0x1fe583){if(_0x1fe583){_0x407683=_0x1fe583;_0x280a24[_0x8f21('0x55')]=_['keys'](db[_0x8f21('0xe2')]['rawAttributes']);_0x280a24[_0x8f21('0x43')]=_['keys'](_0x275023[_0x8f21('0x43')]);_0x280a24[_0x8f21('0x58')]=_[_0x8f21('0x59')](_0x280a24[_0x8f21('0x55')],_0x280a24[_0x8f21('0x43')]);_0x4a4e2c[_0x8f21('0x48')]=_[_0x8f21('0x59')](_0x280a24[_0x8f21('0x55')],qs[_0x8f21('0x5a')](_0x275023[_0x8f21('0x43')]['fields']));_0x4a4e2c[_0x8f21('0x48')]=_0x4a4e2c[_0x8f21('0x48')][_0x8f21('0x4b')]?_0x4a4e2c['attributes']:_0x280a24[_0x8f21('0x55')];_0x4a4e2c[_0x8f21('0xcb')]=qs[_0x8f21('0xcc')](_0x275023[_0x8f21('0x43')][_0x8f21('0xcc')]);_0x4a4e2c[_0x8f21('0x42')]=qs[_0x8f21('0x58')](_[_0x8f21('0xd5')](_0x275023[_0x8f21('0x43')],_0x280a24[_0x8f21('0x58')]));if(_0x275023[_0x8f21('0x43')][_0x8f21('0x30')]){_0x4a4e2c[_0x8f21('0x42')]=_[_0x8f21('0x5c')](_0x4a4e2c['where'],{'$or':_['map'](_0x4a4e2c[_0x8f21('0x48')],function(_0x29c39a){var _0x2f6508={};_0x2f6508[_0x29c39a]={'$like':'%'+_0x275023[_0x8f21('0x43')][_0x8f21('0x30')]+'%'};return _0x2f6508;})});}_0x4a4e2c=_[_0x8f21('0x5c')]({},_0x4a4e2c,_0x275023[_0x8f21('0xd6')]);return _0x407683[_0x8f21('0xe3')](_0x4a4e2c);}})[_0x8f21('0x27')](function(_0x575430){if(_0x575430){_0x4b890f=_0x575430[_0x8f21('0x4b')];if(!_0x275023[_0x8f21('0x43')][_0x8f21('0xcd')](_0x8f21('0xd3'))){_0x4a4e2c['limit']=qs[_0x8f21('0x22')](_0x275023[_0x8f21('0x43')][_0x8f21('0x22')]);_0x4a4e2c[_0x8f21('0x21')]=qs[_0x8f21('0x21')](_0x275023['query'][_0x8f21('0x21')]);}return _0x407683['getOpenchannelInteractions'](_0x4a4e2c);}})[_0x8f21('0x27')](function(_0x298d09){if(_0x298d09){return _0x298d09?{'count':_0x4b890f,'rows':_0x298d09}:null;}})[_0x8f21('0x27')](respondWithResult(_0x967fb8,null))['catch'](handleError(_0x967fb8,null));};exports[_0x8f21('0xe4')]=function(_0x79e5b7,_0x25ba4a){var _0x3c5a93={'raw':!![],'where':{}};var _0x1e0b86={};var _0x34613d={'count':0x0,'rows':[]};return db['User'][_0x8f21('0xca')]({'where':{'id':_0x79e5b7[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x25ba4a,null))[_0x8f21('0x27')](function(_0x4495cf){if(_0x4495cf){_0x1e0b86[_0x8f21('0x55')]=_[_0x8f21('0x57')](db['MailInteraction']['rawAttributes']);_0x1e0b86[_0x8f21('0x43')]=_[_0x8f21('0x57')](_0x79e5b7['query']);_0x1e0b86[_0x8f21('0x58')]=_[_0x8f21('0x59')](_0x1e0b86['model'],_0x1e0b86['query']);_0x3c5a93[_0x8f21('0x48')]=_['intersection'](_0x1e0b86[_0x8f21('0x55')],qs[_0x8f21('0x5a')](_0x79e5b7['query'][_0x8f21('0x5a')]));_0x3c5a93[_0x8f21('0x48')]=_0x3c5a93['attributes'][_0x8f21('0x4b')]?_0x3c5a93['attributes']:_0x1e0b86[_0x8f21('0x55')];if(!_0x79e5b7[_0x8f21('0x43')][_0x8f21('0xcd')]('nolimit')){_0x3c5a93[_0x8f21('0x22')]=qs[_0x8f21('0x22')](_0x79e5b7['query'][_0x8f21('0x22')]);_0x3c5a93[_0x8f21('0x21')]=qs[_0x8f21('0x21')](_0x79e5b7[_0x8f21('0x43')][_0x8f21('0x21')]);}_0x3c5a93[_0x8f21('0xcb')]=qs[_0x8f21('0xcc')](_0x79e5b7[_0x8f21('0x43')]['sort']);_0x3c5a93[_0x8f21('0x42')]=qs[_0x8f21('0x58')](_['pick'](_0x79e5b7[_0x8f21('0x43')],_0x1e0b86[_0x8f21('0x58')]));_0x3c5a93[_0x8f21('0x42')]['UserId']=_0x4495cf['id'];if(_0x79e5b7['query'][_0x8f21('0x30')]){_0x3c5a93[_0x8f21('0x42')]=_[_0x8f21('0x5c')](_0x3c5a93['where'],{'$or':_[_0x8f21('0x3c')](_0x3c5a93[_0x8f21('0x48')],function(_0x29534d){var _0x427fd6={};_0x427fd6[_0x29534d]={'$like':'%'+_0x79e5b7[_0x8f21('0x43')]['filter']+'%'};return _0x427fd6;})});}_0x3c5a93=_[_0x8f21('0x5c')]({},_0x3c5a93,_0x79e5b7[_0x8f21('0xd6')]);return db[_0x8f21('0xe5')][_0x8f21('0x24')]({'where':_0x3c5a93[_0x8f21('0x42')]})['then'](function(_0x11fd58){_0x34613d[_0x8f21('0x24')]=_0x11fd58;if(_0x79e5b7[_0x8f21('0x43')][_0x8f21('0x44')]){_0x3c5a93[_0x8f21('0x45')]=[{'all':!![]}];}return db[_0x8f21('0xe5')][_0x8f21('0x8a')](_0x3c5a93);})[_0x8f21('0x27')](function(_0x49b4ab){_0x34613d[_0x8f21('0x4a')]=_0x49b4ab;return _0x34613d;});}})[_0x8f21('0x27')](respondWithFilteredResult(_0x25ba4a,_0x3c5a93))['catch'](handleError(_0x25ba4a,null));};exports[_0x8f21('0xe6')]=function(_0x2c2ae9,_0x3beff9){var _0x403827={};var _0x4a59f1={};var _0x1fc0e4;var _0x149828;return db[_0x8f21('0x3a')][_0x8f21('0xca')]({'where':{'id':_0x2c2ae9[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x3beff9,null))[_0x8f21('0x27')](function(_0x138003){if(_0x138003){_0x1fc0e4=_0x138003;_0x4a59f1['model']=_[_0x8f21('0x57')](db[_0x8f21('0xe7')][_0x8f21('0x3b')]);_0x4a59f1['query']=_[_0x8f21('0x57')](_0x2c2ae9['query']);_0x4a59f1[_0x8f21('0x58')]=_[_0x8f21('0x59')](_0x4a59f1[_0x8f21('0x55')],_0x4a59f1[_0x8f21('0x43')]);_0x403827[_0x8f21('0x48')]=_['intersection'](_0x4a59f1['model'],qs['fields'](_0x2c2ae9['query'][_0x8f21('0x5a')]));_0x403827[_0x8f21('0x48')]=_0x403827[_0x8f21('0x48')][_0x8f21('0x4b')]?_0x403827[_0x8f21('0x48')]:_0x4a59f1[_0x8f21('0x55')];_0x403827[_0x8f21('0xcb')]=qs[_0x8f21('0xcc')](_0x2c2ae9[_0x8f21('0x43')]['sort']);_0x403827['where']=qs[_0x8f21('0x58')](_[_0x8f21('0xd5')](_0x2c2ae9[_0x8f21('0x43')],_0x4a59f1[_0x8f21('0x58')]));if(_0x2c2ae9[_0x8f21('0x43')][_0x8f21('0x30')]){_0x403827['where']=_[_0x8f21('0x5c')](_0x403827[_0x8f21('0x42')],{'$or':_[_0x8f21('0x3c')](_0x403827[_0x8f21('0x48')],function(_0x4c6abd){var _0x265ef2={};_0x265ef2[_0x4c6abd]={'$like':'%'+_0x2c2ae9['query'][_0x8f21('0x30')]+'%'};return _0x265ef2;})});}_0x403827=_[_0x8f21('0x5c')]({},_0x403827,_0x2c2ae9['options']);return _0x1fc0e4['getSmsInteractions'](_0x403827);}})[_0x8f21('0x27')](function(_0x22a21c){if(_0x22a21c){_0x149828=_0x22a21c[_0x8f21('0x4b')];if(!_0x2c2ae9['query'][_0x8f21('0xcd')](_0x8f21('0xd3'))){_0x403827['limit']=qs['limit'](_0x2c2ae9[_0x8f21('0x43')][_0x8f21('0x22')]);_0x403827['offset']=qs[_0x8f21('0x21')](_0x2c2ae9[_0x8f21('0x43')][_0x8f21('0x21')]);}return _0x1fc0e4[_0x8f21('0xe6')](_0x403827);}})['then'](function(_0x59e917){if(_0x59e917){return _0x59e917?{'count':_0x149828,'rows':_0x59e917}:null;}})[_0x8f21('0x27')](respondWithResult(_0x3beff9,null))['catch'](handleError(_0x3beff9,null));};exports[_0x8f21('0xe8')]=function(_0x5bd6fe,_0x2f2cfd){var _0x5b85b5={};var _0x1df21f={};var _0x3d7c18;var _0x2a7e3c;return db[_0x8f21('0x3a')]['findOne']({'where':{'id':_0x5bd6fe[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x2f2cfd,null))[_0x8f21('0x27')](function(_0x1716af){if(_0x1716af){_0x3d7c18=_0x1716af;_0x1df21f[_0x8f21('0x55')]=_['keys'](db[_0x8f21('0xe9')][_0x8f21('0x3b')]);_0x1df21f['query']=_['keys'](_0x5bd6fe['query']);_0x1df21f['filters']=_['intersection'](_0x1df21f[_0x8f21('0x55')],_0x1df21f[_0x8f21('0x43')]);_0x5b85b5[_0x8f21('0x48')]=_[_0x8f21('0x59')](_0x1df21f[_0x8f21('0x55')],qs['fields'](_0x5bd6fe[_0x8f21('0x43')][_0x8f21('0x5a')]));_0x5b85b5[_0x8f21('0x48')]=_0x5b85b5[_0x8f21('0x48')][_0x8f21('0x4b')]?_0x5b85b5[_0x8f21('0x48')]:_0x1df21f[_0x8f21('0x55')];_0x5b85b5[_0x8f21('0xcb')]=qs['sort'](_0x5bd6fe[_0x8f21('0x43')][_0x8f21('0xcc')]);_0x5b85b5['where']=qs['filters'](_[_0x8f21('0xd5')](_0x5bd6fe[_0x8f21('0x43')],_0x1df21f[_0x8f21('0x58')]));if(_0x5bd6fe[_0x8f21('0x43')][_0x8f21('0x30')]){_0x5b85b5[_0x8f21('0x42')]=_[_0x8f21('0x5c')](_0x5b85b5[_0x8f21('0x42')],{'$or':_['map'](_0x5b85b5[_0x8f21('0x48')],function(_0x4d1e27){var _0x488b0b={};_0x488b0b[_0x4d1e27]={'$like':'%'+_0x5bd6fe['query']['filter']+'%'};return _0x488b0b;})});}_0x5b85b5=_[_0x8f21('0x5c')]({},_0x5b85b5,_0x5bd6fe[_0x8f21('0xd6')]);return _0x3d7c18[_0x8f21('0xe8')](_0x5b85b5);}})[_0x8f21('0x27')](function(_0x1b28a4){if(_0x1b28a4){_0x2a7e3c=_0x1b28a4[_0x8f21('0x4b')];if(!_0x5bd6fe[_0x8f21('0x43')]['hasOwnProperty']('nolimit')){_0x5b85b5['limit']=qs[_0x8f21('0x22')](_0x5bd6fe[_0x8f21('0x43')][_0x8f21('0x22')]);_0x5b85b5[_0x8f21('0x21')]=qs[_0x8f21('0x21')](_0x5bd6fe[_0x8f21('0x43')][_0x8f21('0x21')]);}return _0x3d7c18[_0x8f21('0xe8')](_0x5b85b5);}})[_0x8f21('0x27')](function(_0x3bde29){if(_0x3bde29){return _0x3bde29?{'count':_0x2a7e3c,'rows':_0x3bde29}:null;}})[_0x8f21('0x27')](respondWithResult(_0x2f2cfd,null))[_0x8f21('0x1d')](handleError(_0x2f2cfd,null));};exports[_0x8f21('0xea')]=function(_0x269dad,_0x5a2aaf){var _0x21ed88={};var _0x2ddf69={};var _0x1ee289;var _0x1df311;return db[_0x8f21('0x3a')]['findOne']({'where':{'id':_0x269dad[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x5a2aaf,null))[_0x8f21('0x27')](function(_0xbcd1dc){if(_0xbcd1dc){_0x1ee289=_0xbcd1dc;_0x2ddf69['model']=_['keys'](db[_0x8f21('0xeb')][_0x8f21('0x3b')]);_0x2ddf69[_0x8f21('0x43')]=_[_0x8f21('0x57')](_0x269dad[_0x8f21('0x43')]);_0x2ddf69['filters']=_[_0x8f21('0x59')](_0x2ddf69['model'],_0x2ddf69[_0x8f21('0x43')]);_0x21ed88[_0x8f21('0x48')]=_['intersection'](_0x2ddf69[_0x8f21('0x55')],qs['fields'](_0x269dad[_0x8f21('0x43')][_0x8f21('0x5a')]));_0x21ed88['attributes']=_0x21ed88['attributes'][_0x8f21('0x4b')]?_0x21ed88[_0x8f21('0x48')]:_0x2ddf69['model'];_0x21ed88['order']=qs['sort'](_0x269dad[_0x8f21('0x43')][_0x8f21('0xcc')]);_0x21ed88[_0x8f21('0x42')]=qs[_0x8f21('0x58')](_[_0x8f21('0xd5')](_0x269dad[_0x8f21('0x43')],_0x2ddf69[_0x8f21('0x58')]));if(_0x269dad[_0x8f21('0x43')]['filter']){_0x21ed88['where']=_['merge'](_0x21ed88[_0x8f21('0x42')],{'$or':_[_0x8f21('0x3c')](_0x21ed88[_0x8f21('0x48')],function(_0xcd7c7d){var _0x546010={};_0x546010[_0xcd7c7d]={'$like':'%'+_0x269dad['query'][_0x8f21('0x30')]+'%'};return _0x546010;})});}_0x21ed88=_[_0x8f21('0x5c')]({},_0x21ed88,_0x269dad[_0x8f21('0xd6')]);return _0x1ee289[_0x8f21('0xea')](_0x21ed88);}})[_0x8f21('0x27')](function(_0x41abdf){if(_0x41abdf){_0x1df311=_0x41abdf[_0x8f21('0x4b')];if(!_0x269dad[_0x8f21('0x43')]['hasOwnProperty'](_0x8f21('0xd3'))){_0x21ed88[_0x8f21('0x22')]=qs['limit'](_0x269dad[_0x8f21('0x43')][_0x8f21('0x22')]);_0x21ed88[_0x8f21('0x21')]=qs[_0x8f21('0x21')](_0x269dad[_0x8f21('0x43')][_0x8f21('0x21')]);}return _0x1ee289[_0x8f21('0xea')](_0x21ed88);}})[_0x8f21('0x27')](function(_0x485962){if(_0x485962){return _0x485962?{'count':_0x1df311,'rows':_0x485962}:null;}})[_0x8f21('0x27')](respondWithResult(_0x5a2aaf,null))[_0x8f21('0x1d')](handleError(_0x5a2aaf,null));};exports[_0x8f21('0xec')]=function(_0x357dec,_0x3e20a5,_0x4a9c05){var _0x3b5614;var _0x39fd40;var _0x250f2e;var _0x256272=!_[_0x8f21('0x68')](_0x357dec[_0x8f21('0x54')]['id'])?_0x357dec[_0x8f21('0x54')]['id']:!_[_0x8f21('0x68')](_0x357dec[_0x8f21('0x2c')]['id'])?_0x357dec[_0x8f21('0x2c')]['id']:null;return db[_0x8f21('0x3a')][_0x8f21('0x34')]({'where':{'id':_0x256272,'role':{'$or':[_0x8f21('0x2a'),_0x8f21('0x2c'),'agent']}},'attributes':['id',_0x8f21('0x37'),_0x8f21('0xed'),_0x8f21('0xee'),_0x8f21('0x29'),_0x8f21('0x63'),_0x8f21('0x9f')]})[_0x8f21('0x27')](function(_0x11edde){if(_0x11edde){if(_0x11edde[_0x8f21('0x29')]===_0x8f21('0x2d')){_0x3b5614=_0x11edde;if(_0x357dec['body'][_0x8f21('0xa1')]){_0x250f2e=util[_0x8f21('0xac')](_0x8f21('0xef'),_0x3b5614[_0x357dec[_0x8f21('0x5f')][_0x8f21('0xa1')]]);}else if(_0x357dec['body'][_0x8f21('0xf0')]){_0x250f2e=util['format'](_0x8f21('0xad'),_0x357dec['body'][_0x8f21('0xf0')]);}else{_0x250f2e=util['format']('SIP/%s',_0x3b5614[_0x8f21('0x37')]);}socket['to'](util[_0x8f21('0xac')]('user:%s',_0x3b5614[_0x8f21('0x37')]))[_0x8f21('0xa8')](_0x8f21('0xf1'),{'user':{'id':_0x3b5614['id'],'name':_0x3b5614[_0x8f21('0x37')]},'ip':_0x357dec['headers']['x-forwarded-for']||_0x357dec[_0x8f21('0xf2')]['remoteAddress']||_0x357dec['socket'][_0x8f21('0xf3')]||_0x357dec['connection'][_0x8f21('0xf4')][_0x8f21('0xf3')]});return db[_0x8f21('0xaf')][_0x8f21('0xb4')]({'where':{'membername':_0x3b5614['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x8f21('0x94'))](_0x8f21('0xf5'));}})[_0x8f21('0x27')](function(){if(_0x3b5614){return _0x3b5614[_0x8f21('0xf6')]({'raw':!![]});}})['then'](function(_0x169698){if(_0x3b5614){var _0x3d1d82=[];if(_0x169698){_0x39fd40=_0x169698;if(_0x39fd40[_0x8f21('0x4b')]){for(var _0x5473c2=0x0;_0x5473c2<_0x39fd40[_0x8f21('0x4b')];_0x5473c2++){_0x3d1d82[_0x8f21('0x49')]({'membername':_0x3b5614[_0x8f21('0x37')],'UserId':_0x3b5614['id'],'queue_name':_0x39fd40[_0x5473c2][_0x8f21('0x37')],'VoiceQueueId':_0x39fd40[_0x5473c2]['id'],'interface':_0x250f2e,'paused':_0x3b5614[_0x8f21('0x9f')]||![],'penalty':_0x39fd40[_0x5473c2][_0x8f21('0xf7')]||0x0});}return BPromise[_0x8f21('0x89')](_0x3d1d82,function(_0x229219){return db[_0x8f21('0xaf')][_0x8f21('0xb0')](_0x229219);});}}}})[_0x8f21('0x27')](function(){if(_0x3b5614){return db[_0x8f21('0xf8')]['findAll']({'where':{'membername':_0x3b5614[_0x8f21('0x37')],'exitAt':null}});}})[_0x8f21('0x27')](function(_0x123d35){if(_0x3b5614){var _0x4dd3e7=[];_0x123d35[_0x8f21('0xf9')](function(_0x2cbfc9){_0x4dd3e7['push'](_0x2cbfc9[_0x8f21('0x26')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x4dd3e7);}})['then'](function(){if(_0x3b5614){var _0x5099b4=[];var _0x4fac8f=[];var _0x5b83e7=utils[_0x8f21('0xfa')]();var _0x234f11={'membername':_0x3b5614[_0x8f21('0x37')],'interface':_0x250f2e,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3b5614[_0x8f21('0x29')],'internal':_0x3b5614[_0x8f21('0x63')]};_0x5b83e7[_0x8f21('0xf9')](function(_0x3c9b6d){_0x5099b4[_0x8f21('0x49')](_[_0x8f21('0x5c')]({'channel':_0x3c9b6d,'type':_0x8f21('0xfb'),'data1':_0x357dec[_0x8f21('0x5f')][_0x8f21('0xfc')],'data2':_0x250f2e},_0x234f11));if(_0x3b5614[_0x8f21('0x9f')]){_0x4fac8f[_0x8f21('0x49')](_[_0x8f21('0x5c')]({'channel':_0x3c9b6d,'type':_0x8f21('0xfd'),'data1':_0x8f21('0xfe')},_0x234f11));}});return db[_0x8f21('0xf8')][_0x8f21('0x87')](_0x5099b4['concat'](_0x4fac8f),{'individualHooks':!![]});}})['then'](function(){if(_0x3b5614){return _0x3b5614[_0x8f21('0x26')]({'online':!![],'lastLoginAt':moment()[_0x8f21('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3b5614[_0x8f21('0x9f')]||![],'mailPause':_0x3b5614[_0x8f21('0x9f')]||![],'chatPause':_0x3b5614[_0x8f21('0x9f')]||![],'faxPause':_0x3b5614[_0x8f21('0x9f')]||![],'smsPause':_0x3b5614[_0x8f21('0x9f')]||![],'openchannelPause':_0x3b5614[_0x8f21('0x9f')]||![],'whatsappPause':_0x3b5614[_0x8f21('0x9f')]||![],'pauseType':_0x3b5614[_0x8f21('0x9f')]?_0x8f21('0xfe'):null,'interface':_0x250f2e,'lastPauseAt':moment()[_0x8f21('0xac')](_0x8f21('0xff'))});}})['then'](function(_0x58ce50){if(_0x357dec[_0x8f21('0x100')]){return _0x4a9c05();}else{return BPromise['resolve'](_0x58ce50)[_0x8f21('0x27')](respondWithResult(_0x3e20a5,null));}})[_0x8f21('0x1d')](handleError(_0x3e20a5,null));};exports[_0x8f21('0x101')]=function(_0x378ca9,_0x1ea55b){var _0x5096d1;return db['User'][_0x8f21('0x34')]({'where':{'id':_0x378ca9['params']['id'],'role':_0x8f21('0x2d')},'attributes':['id','name',_0x8f21('0x29')]})['then'](handleEntityNotFound(_0x1ea55b,null))['then'](function(_0xa77f44){if(_0xa77f44){_0x5096d1=_0xa77f44;return db[_0x8f21('0xaf')][_0x8f21('0xb4')]({'where':{'membername':_0x5096d1[_0x8f21('0x37')]},'individualHooks':!![]});}})[_0x8f21('0x27')](function(){return db[_0x8f21('0xf8')]['findAll']({'where':{'membername':_0x5096d1[_0x8f21('0x37')],'exitAt':null}});})['then'](function(_0xa2f6fd){var _0x55cb81=[];_0xa2f6fd[_0x8f21('0xf9')](function(_0x3b3c26){_0x55cb81[_0x8f21('0x49')](_0x3b3c26[_0x8f21('0x26')]({'exitAt':moment()[_0x8f21('0xac')](_0x8f21('0xff'))}));});return BPromise[_0x8f21('0x52')](_0x55cb81);})['then'](function(){return _0x5096d1[_0x8f21('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8f21('0x27')](respondWithResult(_0x1ea55b,null))[_0x8f21('0x1d')](handleError(_0x1ea55b,null));};exports[_0x8f21('0x102')]=function(_0x41ad86,_0x20dbda){var _0x37cf23;return db[_0x8f21('0xaf')][_0x8f21('0x26')]({'paused':0x1},{'where':{'UserId':_0x41ad86[_0x8f21('0x54')]['id']},'individualHooks':!![]})[_0x8f21('0x27')](function(){return db[_0x8f21('0x3a')][_0x8f21('0x34')]({'where':{'id':_0x41ad86[_0x8f21('0x54')]['id'],'role':_0x8f21('0x2d')},'attributes':['id',_0x8f21('0x37'),_0x8f21('0x29'),'internal','interface']});})[_0x8f21('0x27')](handleEntityNotFound(_0x20dbda,null))[_0x8f21('0x27')](function(_0x3b8dcb){if(_0x3b8dcb){_0x37cf23=_0x3b8dcb;return respondWithRpcPromise(_0x8f21('0x103'),_0x8f21('0x102'),{'id':_0x37cf23['id'],'name':_0x37cf23[_0x8f21('0x37')],'pause':!![]});}})[_0x8f21('0x27')](function(){if(_0x37cf23){return db[_0x8f21('0xf8')][_0x8f21('0x8a')]({'where':{'membername':_0x37cf23[_0x8f21('0x37')],'type':'PAUSE','exitAt':null}});}})[_0x8f21('0x27')](function(_0x2d9447){if(_0x2d9447[_0x8f21('0x4b')]){var _0x1f12cc=moment()[_0x8f21('0xac')](_0x8f21('0xff'));for(var _0x1c4962=0x0,_0x39df4=_0x2d9447['length'];_0x1c4962<_0x39df4;_0x1c4962++){_0x2d9447[_0x1c4962][_0x8f21('0x104')]({'exitAt':_0x1f12cc});}}})[_0x8f21('0x27')](function(){var _0x3a5a08=[];var _0x264ec4=utils[_0x8f21('0xfa')]();_0x264ec4[_0x8f21('0xf9')](function(_0xb9f275){_0x3a5a08[_0x8f21('0x49')]({'channel':_0xb9f275,'membername':_0x37cf23[_0x8f21('0x37')],'interface':_[_0x8f21('0x68')](_0x37cf23[_0x8f21('0xa1')])?util[_0x8f21('0xac')](_0x8f21('0xad'),_0x37cf23[_0x8f21('0x37')]):_0x37cf23[_0x8f21('0xa1')],'type':_0x8f21('0xfd'),'enterAt':moment()[_0x8f21('0xac')](_0x8f21('0xff')),'data1':_0x41ad86['body'][_0x8f21('0x3d')]||_0x8f21('0x105'),'role':_0x37cf23['role'],'internal':_0x37cf23['internal']});});return db['MemberReport'][_0x8f21('0x87')](_0x3a5a08,{'individualHooks':!![]});})[_0x8f21('0x27')](function(){return _0x37cf23[_0x8f21('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x41ad86[_0x8f21('0x5f')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x8f21('0xac')](_0x8f21('0xff'))});})[_0x8f21('0x27')](respondWithResult(_0x20dbda,null))[_0x8f21('0x1d')](handleError(_0x20dbda,null));};exports['unpause']=function(_0x3153c4,_0x356a52){var _0xadbd7b;return db[_0x8f21('0x3a')][_0x8f21('0x34')]({'where':{'id':_0x3153c4[_0x8f21('0x54')]['id']},'attributes':['id',_0x8f21('0x37'),'role',_0x8f21('0xa0'),_0x8f21('0x106'),_0x8f21('0x107'),_0x8f21('0x108'),_0x8f21('0x109'),_0x8f21('0x10a'),'whatsapppause',_0x8f21('0x10b'),_0x8f21('0x10c')]})[_0x8f21('0x27')](handleEntityNotFound(_0x356a52,null))[_0x8f21('0x27')](function(_0x110180){if(_0x110180){_0xadbd7b=_0x110180;if(_0x3153c4[_0x8f21('0x5f')]['channel']&&!utils[_0x8f21('0xa2')](_0x3153c4['body'][_0x8f21('0x9d')])){throw new db[(_0x8f21('0x91'))][(_0x8f21('0x94'))](_0x8f21('0xa3'));}switch(_0x3153c4[_0x8f21('0x5f')][_0x8f21('0x9d')]){case _0x8f21('0xaa'):return respondWithRpcPromise(_0x8f21('0x103'),_0x8f21('0x10d'),{'id':_0xadbd7b['id'],'name':_0xadbd7b['name'],'pause':![]})[_0x8f21('0x27')](function(){return db[_0x8f21('0xaf')][_0x8f21('0x26')]({'paused':0x0},{'where':{'UserId':_0xadbd7b['id']},'individualHooks':!![]});})[_0x8f21('0x27')](function(){return db[_0x8f21('0xf8')]['find']({'where':{'channel':_0x3153c4[_0x8f21('0x5f')][_0x8f21('0x9d')],'membername':_0xadbd7b['name'],'type':_0x8f21('0xfd'),'exitAt':null}});})[_0x8f21('0x27')](function(_0x270632){if(_0x270632){return _0x270632[_0x8f21('0x26')]({'exitAt':moment()[_0x8f21('0xac')](_0x8f21('0xff')),'data2':_0x8f21('0x10e')},{'individualHooks':!![]});}return null;})[_0x8f21('0x27')](function(){return _0xadbd7b[_0x8f21('0x26')]({'voicePause':![]});});case _0x8f21('0x4f'):case _0x8f21('0x4c'):case _0x8f21('0x4e'):case'sms':case _0x8f21('0x51'):case _0x8f21('0x50'):return db[_0x8f21('0xf8')][_0x8f21('0x34')]({'where':{'channel':_0x3153c4[_0x8f21('0x5f')][_0x8f21('0x9d')],'membername':_0xadbd7b[_0x8f21('0x37')],'type':_0x8f21('0xfd'),'exitAt':null}})['then'](function(_0x2878e1){if(_0x2878e1){return _0x2878e1['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x8f21('0x10e')},{'individualHooks':!![]});}return null;})[_0x8f21('0x27')](function(){var _0x2e8717={};_[_0x8f21('0x10f')](_0x2e8717,util['format']('%s%s',_0x3153c4[_0x8f21('0x5f')]['channel'],'Pause'),![]);return _0xadbd7b['update'](_0x2e8717);});default:return respondWithRpcPromise(_0x8f21('0x103'),_0x8f21('0x10d'),{'id':_0xadbd7b['id'],'name':_0xadbd7b[_0x8f21('0x37')],'pause':![]})[_0x8f21('0x27')](function(){return db[_0x8f21('0xaf')]['update']({'paused':0x0},{'where':{'UserId':_0xadbd7b['id']}});})['then'](function(){return db['MemberReport'][_0x8f21('0x8a')]({'where':{'membername':_0xadbd7b[_0x8f21('0x37')],'type':_0x8f21('0xfd'),'exitAt':null}});})['then'](function(_0xc55ff1){var _0x434586=[];_0xc55ff1[_0x8f21('0xf9')](function(_0x3e4220){_0x434586[_0x8f21('0x49')](_0x3e4220[_0x8f21('0x26')]({'exitAt':moment()[_0x8f21('0xac')](_0x8f21('0xff')),'data2':_0x8f21('0x10e')}));});return BPromise[_0x8f21('0x52')](_0x434586);})[_0x8f21('0x27')](function(){return _0xadbd7b[_0x8f21('0x26')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x8f21('0x27')](respondWithResult(_0x356a52,null))[_0x8f21('0x1d')](handleError(_0x356a52,null));};exports[_0x8f21('0x110')]=function(_0x46adf9,_0x117305){var _0x928052={};var _0x30fa3d={};var _0x5ad391;var _0x23300b;return db[_0x8f21('0x3a')][_0x8f21('0xca')]({'where':{'id':_0x46adf9[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x117305,null))['then'](function(_0x387be6){if(_0x387be6){_0x5ad391=_0x387be6;_0x30fa3d[_0x8f21('0x55')]=_[_0x8f21('0x57')](db[_0x8f21('0x111')][_0x8f21('0x3b')]);_0x30fa3d[_0x8f21('0x43')]=_[_0x8f21('0x57')](_0x46adf9[_0x8f21('0x43')]);_0x30fa3d['filters']=_[_0x8f21('0x59')](_0x30fa3d[_0x8f21('0x55')],_0x30fa3d['query']);_0x928052['attributes']=_[_0x8f21('0x59')](_0x30fa3d['model'],qs[_0x8f21('0x5a')](_0x46adf9[_0x8f21('0x43')][_0x8f21('0x5a')]));_0x928052[_0x8f21('0x48')]=_0x928052[_0x8f21('0x48')]['length']?_0x928052['attributes']:_0x30fa3d[_0x8f21('0x55')];_0x928052[_0x8f21('0xcb')]=qs['sort'](_0x46adf9['query'][_0x8f21('0xcc')]);_0x928052[_0x8f21('0x42')]=qs[_0x8f21('0x58')](_['pick'](_0x46adf9[_0x8f21('0x43')],_0x30fa3d[_0x8f21('0x58')]));if(_0x46adf9[_0x8f21('0x43')][_0x8f21('0x30')]){_0x928052['where']=_[_0x8f21('0x5c')](_0x928052[_0x8f21('0x42')],{'$or':_[_0x8f21('0x3c')](_0x928052[_0x8f21('0x48')],function(_0x2ea6bb){var _0x3224c2={};_0x3224c2[_0x2ea6bb]={'$like':'%'+_0x46adf9[_0x8f21('0x43')][_0x8f21('0x30')]+'%'};return _0x3224c2;})});}_0x928052=_[_0x8f21('0x5c')]({},_0x928052,_0x46adf9[_0x8f21('0xd6')]);return _0x5ad391['getTeams'](_0x928052);}})['then'](function(_0x4defac){if(_0x4defac){_0x23300b=_0x4defac['length'];if(!_0x46adf9['query']['hasOwnProperty'](_0x8f21('0xd3'))){_0x928052[_0x8f21('0x22')]=qs[_0x8f21('0x22')](_0x46adf9[_0x8f21('0x43')][_0x8f21('0x22')]);_0x928052['offset']=qs['offset'](_0x46adf9[_0x8f21('0x43')][_0x8f21('0x21')]);}return _0x5ad391[_0x8f21('0x110')](_0x928052);}})['then'](function(_0x577775){if(_0x577775){return _0x577775?{'count':_0x23300b,'rows':_0x577775}:null;}})[_0x8f21('0x27')](respondWithResult(_0x117305,null))['catch'](handleError(_0x117305,null));};exports[_0x8f21('0x112')]=function(_0x1d578d,_0x164757){return db[_0x8f21('0x3a')][_0x8f21('0x34')]({'where':{'id':_0x1d578d[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x164757,null))['then'](function(_0x234cb5){if(_0x234cb5){var _0x558b26=_0x234cb5[_0x8f21('0x28')]({'plain':!![]});return _0x234cb5[_0x8f21('0x112')](_0x1d578d['body']['ids'],_[_0x8f21('0x113')](_0x1d578d[_0x8f21('0x5f')],[_0x8f21('0x62'),'id'])||{})[_0x8f21('0x27')](function(){for(var _0x2c5028=0x0;_0x2c5028<_0x1d578d[_0x8f21('0x5f')][_0x8f21('0x62')][_0x8f21('0x4b')];_0x2c5028++){var _0x45b893=[];var _0x575164={};db[_0x8f21('0x111')][_0x8f21('0xca')]({'where':{'id':_0x1d578d[_0x8f21('0x5f')][_0x8f21('0x62')][_0x2c5028]}})[_0x8f21('0x27')](function(_0x355f2d){_0x575164=_0x355f2d['dataValues'];_0x45b893[_0x8f21('0x49')](_0x355f2d[_0x8f21('0xf6')]()[_0x8f21('0x27')](function(_0x352c54){for(var _0x5095d1=0x0;_0x5095d1<_0x352c54[_0x8f21('0x4b')];_0x5095d1++){_0x352c54[_0x5095d1]['setDataValue']('channel',_0x8f21('0x114'));}return _0x352c54;}));_0x45b893[_0x8f21('0x49')](_0x355f2d[_0x8f21('0x115')]()[_0x8f21('0x27')](function(_0x586580){for(var _0x9bcb01=0x0;_0x9bcb01<_0x586580[_0x8f21('0x4b')];_0x9bcb01++){_0x586580[_0x9bcb01][_0x8f21('0x116')]('channel',_0x8f21('0x117'));}return _0x586580;}));_0x45b893['push'](_0x355f2d[_0x8f21('0x118')]()[_0x8f21('0x27')](function(_0x12f582){for(var _0x267d4f=0x0;_0x267d4f<_0x12f582['length'];_0x267d4f++){_0x12f582[_0x267d4f]['setDataValue'](_0x8f21('0x9d'),_0x8f21('0x119'));}return _0x12f582;}));_0x45b893[_0x8f21('0x49')](_0x355f2d[_0x8f21('0x11a')]()[_0x8f21('0x27')](function(_0x3f1e9e){for(var _0x439779=0x0;_0x439779<_0x3f1e9e[_0x8f21('0x4b')];_0x439779++){_0x3f1e9e[_0x439779][_0x8f21('0x116')](_0x8f21('0x9d'),_0x8f21('0x11b'));}return _0x3f1e9e;}));_0x45b893[_0x8f21('0x49')](_0x355f2d['getWhatsappQueues']()[_0x8f21('0x27')](function(_0x327c26){for(var _0x703d4=0x0;_0x703d4<_0x327c26['length'];_0x703d4++){_0x327c26[_0x703d4][_0x8f21('0x116')](_0x8f21('0x9d'),_0x8f21('0x11c'));}return _0x327c26;}));_0x45b893[_0x8f21('0x49')](_0x355f2d['getFaxQueues']()[_0x8f21('0x27')](function(_0x38fe8a){for(var _0x37dc5e=0x0;_0x37dc5e<_0x38fe8a[_0x8f21('0x4b')];_0x37dc5e++){_0x38fe8a[_0x37dc5e][_0x8f21('0x116')]('channel',_0x8f21('0x11d'));}return _0x38fe8a;}));_0x45b893[_0x8f21('0x49')](_0x355f2d[_0x8f21('0x11e')]()[_0x8f21('0x27')](function(_0x3377b2){for(var _0x4f5fd8=0x0;_0x4f5fd8<_0x3377b2[_0x8f21('0x4b')];_0x4f5fd8++){_0x3377b2[_0x4f5fd8]['setDataValue'](_0x8f21('0x9d'),_0x8f21('0x11f'));}return _0x3377b2;}));return BPromise['all'](_0x45b893);})['then'](function(_0x3544da){var _0x26f090=_[_0x8f21('0x120')](_0x3544da);_0x45b893=[];return db[_0x8f21('0x6a')][_0x8f21('0x121')](function(_0x10afab){for(var _0x478768=0x0;_0x478768<_0x26f090[_0x8f21('0x4b')];_0x478768++){_0x45b893[_0x8f21('0x49')](_0x26f090[_0x478768][_0x8f21('0x122')](_0x558b26['id']),{'transaction':_0x10afab});}return BPromise[_0x8f21('0x52')](_0x45b893)['then'](function(){if(_0x558b26[_0x8f21('0x9e')]){return BPromise['each'](_[_0x8f21('0x30')](_0x26f090,function(_0x198038){return _0x198038[_0x8f21('0x123')](_0x8f21('0x9d'))===_0x8f21('0x114');}),function(_0x3a99de){return db[_0x8f21('0xaf')][_0x8f21('0xb0')]({'membername':_0x558b26[_0x8f21('0x37')],'UserId':_0x558b26['id'],'queue_name':_0x3a99de[_0x8f21('0x37')],'VoiceQueueId':_0x3a99de['id'],'interface':_[_0x8f21('0x68')](_0x558b26[_0x8f21('0xa1')])?util['format'](_0x8f21('0xad'),_0x558b26[_0x8f21('0x37')]):_0x558b26[_0x8f21('0xa1')],'paused':_0x558b26['voicePause']||![],'penalty':_0x558b26[_0x8f21('0xae')]},{'transaction':_0x10afab});});}else{return;}})['then'](function(){for(var _0x328697=0x0;_0x328697<_0x26f090[_0x8f21('0x4b')];_0x328697++){var _0x2074fa=_0x26f090[_0x328697]['getDataValue']('channel');var _0x5f08a5=_0x2074fa+_0x8f21('0xa7');socket['emit'](_0x8f21('0x2c')+_0x2074fa+_0x8f21('0xa9'),{'UserId':_0x558b26['id'],['queueField']:_0x26f090[_0x328697]['id']});}});});})[_0x8f21('0x27')](function(){db[_0x8f21('0x124')][_0x8f21('0xca')]({'where':{'teamId':_0x575164['id']}})[_0x8f21('0x27')](function(_0x499d22){if(_0x499d22){db[_0x8f21('0x125')]['create']({'UserId':_0x1d578d[_0x8f21('0x54')]['id'],'VoicePrefixId':_0x499d22[_0x8f21('0x126')]});}});});}});}})[_0x8f21('0x27')](respondWithStatusCode(_0x164757,null))[_0x8f21('0x1d')](handleError(_0x164757,null));};exports[_0x8f21('0x127')]=function(_0x5e55a1,_0x51a80b){return db[_0x8f21('0x3a')][_0x8f21('0xca')]({'where':{'id':_0x5e55a1[_0x8f21('0x54')]['id']}})['then'](handleEntityNotFound(_0x51a80b,null))[_0x8f21('0x27')](function(_0x1daa42){if(_0x1daa42){var _0x383963=_0x1daa42[_0x8f21('0x28')]({'plain':!![]});var _0x2a9175=_0x5e55a1['query'][_0x8f21('0x62')];return _0x1daa42[_0x8f21('0x127')](_0x2a9175)[_0x8f21('0x27')](function(){for(var _0x1dfab8=0x0;_0x1dfab8<_0x2a9175['length'];_0x1dfab8++){var _0xd8d3fd=[];var _0x178b45={};db[_0x8f21('0x111')][_0x8f21('0xca')]({'where':{'id':_0x2a9175[_0x1dfab8]}})['then'](function(_0x3fbf2b){_0x178b45=_0x3fbf2b[_0x8f21('0x4d')];_0xd8d3fd['push'](_0x3fbf2b['getVoiceQueues']()['then'](function(_0x41ff94){for(var _0x2287b8=0x0;_0x2287b8<_0x41ff94[_0x8f21('0x4b')];_0x2287b8++){_0x41ff94[_0x2287b8][_0x8f21('0x116')](_0x8f21('0x9d'),_0x8f21('0x114'));}return _0x41ff94;}));_0xd8d3fd['push'](_0x3fbf2b['getChatQueues']()[_0x8f21('0x27')](function(_0xc75e8){for(var _0x4c0e0d=0x0;_0x4c0e0d<_0xc75e8[_0x8f21('0x4b')];_0x4c0e0d++){_0xc75e8[_0x4c0e0d][_0x8f21('0x116')]('channel',_0x8f21('0x117'));}return _0xc75e8;}));_0xd8d3fd[_0x8f21('0x49')](_0x3fbf2b['getMailQueues']()[_0x8f21('0x27')](function(_0x4ab09f){for(var _0x14c286=0x0;_0x14c286<_0x4ab09f[_0x8f21('0x4b')];_0x14c286++){_0x4ab09f[_0x14c286][_0x8f21('0x116')](_0x8f21('0x9d'),_0x8f21('0x119'));}return _0x4ab09f;}));_0xd8d3fd[_0x8f21('0x49')](_0x3fbf2b[_0x8f21('0x11a')]()[_0x8f21('0x27')](function(_0x3ae75c){for(var _0x5e55e7=0x0;_0x5e55e7<_0x3ae75c[_0x8f21('0x4b')];_0x5e55e7++){_0x3ae75c[_0x5e55e7]['setDataValue']('channel','Sms');}return _0x3ae75c;}));_0xd8d3fd[_0x8f21('0x49')](_0x3fbf2b[_0x8f21('0x128')]()[_0x8f21('0x27')](function(_0xc10db6){for(var _0x102dc4=0x0;_0x102dc4<_0xc10db6[_0x8f21('0x4b')];_0x102dc4++){_0xc10db6[_0x102dc4][_0x8f21('0x116')](_0x8f21('0x9d'),_0x8f21('0x11c'));}return _0xc10db6;}));_0xd8d3fd[_0x8f21('0x49')](_0x3fbf2b[_0x8f21('0x129')]()[_0x8f21('0x27')](function(_0x2db693){for(var _0x2b54a1=0x0;_0x2b54a1<_0x2db693['length'];_0x2b54a1++){_0x2db693[_0x2b54a1]['setDataValue'](_0x8f21('0x9d'),_0x8f21('0x11d'));}return _0x2db693;}));_0xd8d3fd[_0x8f21('0x49')](_0x3fbf2b[_0x8f21('0x11e')]()[_0x8f21('0x27')](function(_0x45a7c0){for(var _0x103c4c=0x0;_0x103c4c<_0x45a7c0[_0x8f21('0x4b')];_0x103c4c++){_0x45a7c0[_0x103c4c][_0x8f21('0x116')]('channel',_0x8f21('0x11f'));}return _0x45a7c0;}));return BPromise['all'](_0xd8d3fd);})[_0x8f21('0x27')](function(_0x232c1a){var _0x3c0774=_[_0x8f21('0x120')](_0x232c1a);_0xd8d3fd=[];return db[_0x8f21('0x6a')][_0x8f21('0x121')](function(_0x2440d4){for(var _0x3926c9=0x0;_0x3926c9<_0x3c0774[_0x8f21('0x4b')];_0x3926c9++){_0xd8d3fd['push'](_0x3c0774[_0x3926c9][_0x8f21('0x12a')](_0x383963['id']),{'transaction':_0x2440d4});}return BPromise[_0x8f21('0x52')](_0xd8d3fd)[_0x8f21('0x27')](function(){if(_0x383963['online']){return BPromise[_0x8f21('0x89')](_[_0x8f21('0x30')](_0x3c0774,function(_0x2abaf0){return _0x2abaf0[_0x8f21('0x123')]('channel')===_0x8f21('0x114');}),function(_0x1b26d9){return db[_0x8f21('0xaf')][_0x8f21('0xb4')]({'where':{'VoiceQueueId':_0x1b26d9['id'],'UserId':_0x383963['id']},'transaction':_0x2440d4});});}else{return;}})['then'](function(){db[_0x8f21('0x124')]['findOne']({'where':{'teamId':_0x178b45['id']}})['then'](function(_0x25b66c){if(_0x25b66c){return db[_0x8f21('0x125')][_0x8f21('0xb4')]({'where':{'UserId':_0x383963['id'],'VoicePrefixId':_0x25b66c[_0x8f21('0x4d')]['VoicePrefixId']}});}});})[_0x8f21('0x27')](function(){for(var _0x388bbd=0x0;_0x388bbd<_0x3c0774[_0x8f21('0x4b')];_0x388bbd++){var _0x2ce572=_0x3c0774[_0x388bbd][_0x8f21('0x123')](_0x8f21('0x9d'));var _0x2c9a64=_0x2ce572+_0x8f21('0xa7');socket[_0x8f21('0xa8')]('user'+_0x2ce572+_0x8f21('0xb3'),{'UserId':_0x383963['id'],['queueField']:_0x3c0774[_0x388bbd]['id']});}});});});}});}})[_0x8f21('0x27')](respondWithStatusCode(_0x51a80b,null))[_0x8f21('0x1d')](handleError(_0x51a80b,null));};exports['getLists']=function(_0x3636ee,_0x3d8949){var _0x2e3096={};var _0x4d4376={};var _0x6e6bb3;var _0x322901;return db[_0x8f21('0x3a')]['findOne']({'where':{'id':_0x3636ee[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x3d8949,null))[_0x8f21('0x27')](function(_0x3870ba){if(_0x3870ba){_0x6e6bb3=_0x3870ba;_0x4d4376[_0x8f21('0x55')]=_[_0x8f21('0x57')](db[_0x8f21('0xce')]['rawAttributes']);_0x4d4376[_0x8f21('0x43')]=_[_0x8f21('0x57')](_0x3636ee[_0x8f21('0x43')]);_0x4d4376[_0x8f21('0x58')]=_[_0x8f21('0x59')](_0x4d4376[_0x8f21('0x55')],_0x4d4376['query']);_0x2e3096['attributes']=_['intersection'](_0x4d4376[_0x8f21('0x55')],qs[_0x8f21('0x5a')](_0x3636ee[_0x8f21('0x43')]['fields']));_0x2e3096[_0x8f21('0x48')]=_0x2e3096[_0x8f21('0x48')][_0x8f21('0x4b')]?_0x2e3096['attributes']:_0x4d4376['model'];_0x2e3096['order']=qs[_0x8f21('0xcc')](_0x3636ee[_0x8f21('0x43')]['sort']);_0x2e3096[_0x8f21('0x42')]=qs[_0x8f21('0x58')](_[_0x8f21('0xd5')](_0x3636ee[_0x8f21('0x43')],_0x4d4376['filters']));if(_0x3636ee[_0x8f21('0x43')][_0x8f21('0x30')]){_0x2e3096[_0x8f21('0x42')]=_[_0x8f21('0x5c')](_0x2e3096[_0x8f21('0x42')],{'$or':_[_0x8f21('0x3c')](_0x2e3096[_0x8f21('0x48')],function(_0x50f7dd){var _0x3843d7={};_0x3843d7[_0x50f7dd]={'$like':'%'+_0x3636ee[_0x8f21('0x43')][_0x8f21('0x30')]+'%'};return _0x3843d7;})});}_0x2e3096=_[_0x8f21('0x5c')]({},_0x2e3096,_0x3636ee['options']);return _0x6e6bb3['getLists'](_0x2e3096);}})[_0x8f21('0x27')](function(_0x26573e){if(_0x26573e){_0x322901=_0x26573e[_0x8f21('0x4b')];if(!_0x3636ee[_0x8f21('0x43')][_0x8f21('0xcd')](_0x8f21('0xd3'))){_0x2e3096[_0x8f21('0x22')]=qs['limit'](_0x3636ee[_0x8f21('0x43')][_0x8f21('0x22')]);_0x2e3096[_0x8f21('0x21')]=qs[_0x8f21('0x21')](_0x3636ee['query']['offset']);}return _0x6e6bb3[_0x8f21('0x12b')](_0x2e3096);}})[_0x8f21('0x27')](function(_0x568876){if(_0x568876){return _0x568876?{'count':_0x322901,'rows':_0x568876}:null;}})[_0x8f21('0x27')](respondWithResult(_0x3d8949,null))['catch'](handleError(_0x3d8949,null));};exports['getAgents']=function(_0x100471,_0x173744){var _0x519682={};var _0x63ae0b={};var _0x386ffe;return db['User'][_0x8f21('0xca')]({'where':{'id':_0x100471[_0x8f21('0x54')]['id']}})[_0x8f21('0x27')](handleEntityNotFound(_0x173744,null))[_0x8f21('0x27')](function(_0x19d4f0){if(_0x19d4f0){_0x386ffe=_0x19d4f0;_0x63ae0b[_0x8f21('0x55')]=_[_0x8f21('0x57')](db[_0x8f21('0x3a')]['rawAttributes']);_0x63ae0b[_0x8f21('0x43')]=_[_0x8f21('0x57')](_0x100471['query']);_0x63ae0b[_0x8f21('0x58')]=_[_0x8f21('0x59')](_0x63ae0b['model'],_0x63ae0b[_0x8f21('0x43')]);_0x519682[_0x8f21('0x48')]=_[_0x8f21('0x59')](_0x63ae0b[_0x8f21('0x55')],qs['fields'](_0x100471[_0x8f21('0x43')][_0x8f21('0x5a')]));_0x519682[_0x8f21('0x48')]=_0x519682['attributes'][_0x8f21('0x4b')]?_0x519682['attributes']:_0x63ae0b[_0x8f21('0x55')];_0x519682[_0x8f21('0xcb')]=qs[_0x8f21('0xcc')](_0x100471[_0x8f21('0x43')][_0x8f21('0xcc')]);_0x519682[_0x8f21('0x42')]=qs['filters'](_[_0x8f21('0xd5')](_0x100471['query'],_0x63ae0b['filters']));if(_0x100471[_0x8f21('0x43')][_0x8f21('0x30')]){_0x519682[_0x8f21('0x42')]=_[_0x8f21('0x5c')](_0x519682['where'],{'$or':_[_0x8f21('0x3c')](_0x519682['attributes'],function(_0x1e5625){var _0x338e96={};_0x338e96[_0x1e5625]={'$like':'%'+_0x100471['query'][_0x8f21('0x30')]+'%'};return _0x338e96;})});}_0x519682['model']=db[_0x8f21('0x3a')];_0x519682['as']=_0x8f21('0x8b');_0x519682=_['merge']({},_0x519682,_0x100471['options']);return _0x386ffe[_0x8f21('0xf6')]({'include':[_0x519682]});}})[_0x8f21('0x27')](function(_0x11a817){if(_0x11a817){var _0x4110b2={},_0x2db74f=[];for(var _0x37428a=0x0;_0x37428a<_0x11a817[_0x8f21('0x4b')];_0x37428a+=0x1){for(var _0x60e51=0x0,_0x100034;_0x60e51<_0x11a817[_0x37428a][_0x8f21('0x8b')][_0x8f21('0x4b')];_0x60e51+=0x1){_0x100034=_0x11a817[_0x37428a][_0x8f21('0x8b')][_0x60e51][_0x8f21('0x28')]({'plain':!![]});_0x4110b2[_0x100034['id']]=_0x100034;}}_0x4110b2=_['values'](_0x4110b2);for(var _0x3bc04d=qs['offset'](_0x100471[_0x8f21('0x43')]['offset']);_0x3bc04d<_0x4110b2[_0x8f21('0x4b')]&&_0x2db74f[_0x8f21('0x4b')]=_0x912d81){_0x80e53a=_0x912d81;_0x13e9f8=0xc8;}else{_0x13e9f8=0xce;}_0x539712[_0x2036('0x1b')](_0x13e9f8);return _0x539712['set'](_0x2036('0x22'),_0x318177+'-'+_0x80e53a+'/'+_0x912d81)['json'](_0x23cbf6);}return null;};}function saveUpdates(_0x451458){return function(_0x146c2c){if(_0x146c2c){return _0x146c2c[_0x2036('0x23')](_0x451458)[_0x2036('0x11')](function(_0x46fac5){return _0x46fac5;});}return null;};}function removeEntity(_0x58f5b4){return function(_0x3e01bf){if(_0x3e01bf){return _0x3e01bf[_0x2036('0x24')]()[_0x2036('0x11')](function(){var _0x2ce64b=_0x3e01bf[_0x2036('0x25')]({'plain':!![]});if(_0x2ce64b[_0x2036('0x26')]===_0x2036('0x27'))return;var _0xf59dea=[{'name':_0x2036('0x28'),'value':_0x2036('0x29'),'ignore':!![]},{'name':'Agents','value':_0x2036('0x2a'),'ignore':![]},{'name':'Telephones','value':_0x2036('0x2b'),'ignore':![]}];var _0x3b384e=_(_0xf59dea)['filter']('ignore')[_0x2036('0x2c')](_0x2036('0x2d'))[_0x2036('0x2d')]();if(_[_0x2036('0x2e')](_0x3b384e,_0x2ce64b[_0x2036('0x26')])){return;}var _0x4b28bc=_[_0x2036('0x2f')](_0xf59dea,[_0x2036('0x2d'),_0x2ce64b[_0x2036('0x26')]])['name'];return db[_0x2036('0x30')][_0x2036('0x24')]({'where':{'type':_0x4b28bc,'resourceId':_0x2ce64b['id']}})[_0x2036('0x11')](function(){return _0x3e01bf;});})[_0x2036('0x11')](function(){_0x58f5b4[_0x2036('0x1b')](0xcc)[_0x2036('0x1c')]();});}};}function handleEntityNotFound(_0x60672b){return function(_0xdeb29){if(!_0xdeb29){_0x60672b['sendStatus'](0x194);}return _0xdeb29;};}function handleError(_0x48472e,_0x2fc926){_0x2fc926=_0x2fc926||0x1f4;return function(_0x540981){logger[_0x2036('0x15')](_0x540981[_0x2036('0x31')]);if(_0x540981[_0x2036('0x32')]){delete _0x540981[_0x2036('0x32')];}_0x48472e['status'](_0x2fc926)[_0x2036('0x33')](_0x540981);};}exports[_0x2036('0x34')]=function(_0xa7b671,_0xdd5db9){var _0x210f8e={},_0x33833c={'count':0x0,'rows':[]};var _0x494214=_(db[_0x2036('0x35')]['rawAttributes'])['map'](function(_0x1e0167){return{'name':_0x1e0167[_0x2036('0x36')],'type':_0x1e0167[_0x2036('0x37')][_0x2036('0x38')]};})[_0x2036('0x39')](function(_0x5ec20a){return!_[_0x2036('0x2e')]([_0x2036('0x3a'),_0x2036('0x3b')],_0x5ec20a['name']);})['value']();_0x210f8e=qs[_0x2036('0x3c')](_0x494214,_0xa7b671);var _0x95b622={'where':_0x210f8e[_0x2036('0x3d')]};return db[_0x2036('0x35')][_0x2036('0x21')](_0x95b622)[_0x2036('0x11')](function(_0x4ed8fb){_0x33833c['count']=_0x4ed8fb;if(_0xa7b671['query'][_0x2036('0x3e')]){_0x210f8e[_0x2036('0x3f')]=[{'all':!![]}];}if(_0xa7b671[_0x2036('0x40')][_0x2036('0x41')]==='true'){_0x210f8e['include']=[{'model':db[_0x2036('0x42')],'as':'userSetting'}];}if(!_[_0x2036('0x2e')](_0x210f8e[_0x2036('0x43')],'id')){_0x210f8e['attributes'][_0x2036('0x44')]('id');}return db[_0x2036('0x35')][_0x2036('0x45')](_0x210f8e);})[_0x2036('0x11')](function(_0x11d9b2){_0x33833c[_0x2036('0x46')]=_0x11d9b2;if(_0xa7b671[_0x2036('0x40')][_0x2036('0x47')]===_0x2036('0x48')){var _0x4ca091=[];for(var _0x3cdd73=0x0;_0x3cdd73<_0x33833c[_0x2036('0x46')]['length'];_0x3cdd73++){_0x4ca091['push'](get_open_tabs(_0x2036('0x49'),_0x33833c[_0x2036('0x46')][_0x3cdd73][_0x2036('0x4a')]));_0x4ca091[_0x2036('0x44')](get_open_tabs('sms',_0x33833c['rows'][_0x3cdd73]['dataValues']));_0x4ca091['push'](get_open_tabs(_0x2036('0x4b'),_0x33833c[_0x2036('0x46')][_0x3cdd73][_0x2036('0x4a')]));_0x4ca091[_0x2036('0x44')](get_open_tabs(_0x2036('0x4c'),_0x33833c['rows'][_0x3cdd73][_0x2036('0x4a')]));_0x4ca091[_0x2036('0x44')](get_open_tabs('openchannel',_0x33833c[_0x2036('0x46')][_0x3cdd73][_0x2036('0x4a')]));_0x4ca091[_0x2036('0x44')](get_open_tabs(_0x2036('0x4d'),_0x33833c['rows'][_0x3cdd73][_0x2036('0x4a')]));}return BPromise[_0x2036('0x4e')](_0x4ca091)['then'](function(){return _0x33833c;});}else{return _0x33833c;}})[_0x2036('0x11')](respondWithFilteredResult(_0xdd5db9,_0x210f8e))[_0x2036('0x19')](handleError(_0xdd5db9,null));};exports['show']=function(_0x2eacc4,_0x1c52a7){var _0x440699={'raw':![],'where':{'id':_0x2eacc4['params']['id']}},_0x4b638e={};_0x4b638e[_0x2036('0x4f')]=_['differenceBy'](_['keys'](db['User'][_0x2036('0x50')]),[_0x2036('0x3a'),_0x2036('0x3b')]);_0x4b638e['query']=_[_0x2036('0x51')](_0x2eacc4['query']);_0x4b638e[_0x2036('0x52')]=_[_0x2036('0x53')](_0x4b638e['model'],_0x4b638e[_0x2036('0x40')]);_0x440699[_0x2036('0x43')]=_['intersection'](_0x4b638e[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x2eacc4[_0x2036('0x40')][_0x2036('0x54')]));_0x440699[_0x2036('0x43')]=_0x440699['attributes'][_0x2036('0x55')]?_0x440699[_0x2036('0x43')]:_0x4b638e[_0x2036('0x4f')];if(_0x2eacc4['query']['includeAll']){_0x440699[_0x2036('0x3f')]=[{'all':!![]}];}if(_0x2eacc4[_0x2036('0x40')][_0x2036('0x41')]===_0x2036('0x48')){_0x440699[_0x2036('0x3f')]=[{'model':db[_0x2036('0x42')],'as':_0x2036('0x41')}];}_0x440699=_[_0x2036('0x56')]({},_0x440699,_0x2eacc4[_0x2036('0x57')]);if(!_[_0x2036('0x2e')](_0x440699[_0x2036('0x43')],'id')){_0x440699[_0x2036('0x43')][_0x2036('0x44')]('id');}return db[_0x2036('0x35')][_0x2036('0x2f')](_0x440699)[_0x2036('0x11')](handleEntityNotFound(_0x1c52a7,null))[_0x2036('0x11')](function(_0x3131bb){var _0x360a28=[];values=_0x3131bb;if(_0x2eacc4[_0x2036('0x40')]['openTabs']===_0x2036('0x48')){_0x360a28[_0x2036('0x44')](get_open_tabs(_0x2036('0x49'),_0x3131bb[_0x2036('0x4a')]));_0x360a28[_0x2036('0x44')](get_open_tabs('sms',_0x3131bb[_0x2036('0x4a')]));_0x360a28[_0x2036('0x44')](get_open_tabs(_0x2036('0x58'),_0x3131bb['dataValues']));_0x360a28[_0x2036('0x44')](get_open_tabs('whatsapp',_0x3131bb[_0x2036('0x4a')]));_0x360a28[_0x2036('0x44')](get_open_tabs('fax',_0x3131bb[_0x2036('0x4a')]));_0x360a28[_0x2036('0x44')](get_open_tabs(_0x2036('0x4c'),_0x3131bb[_0x2036('0x4a')]));return BPromise[_0x2036('0x4e')](_0x360a28);}else{return values;}})['then'](function(){return values;})[_0x2036('0x11')](respondWithResult(_0x1c52a7,null))[_0x2036('0x19')](handleError(_0x1c52a7,null));};exports[_0x2036('0x23')]=function(_0x2b6311,_0x186422){if(_0x2b6311[_0x2036('0x59')]['id']){delete _0x2b6311[_0x2036('0x59')]['id'];}delete _0x2b6311[_0x2036('0x59')]['role'];return db['User'][_0x2036('0x2f')]({'where':{'id':_0x2b6311[_0x2036('0x5a')]['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x186422,null))[_0x2036('0x11')](saveUpdates(_0x2b6311[_0x2036('0x59')],null))[_0x2036('0x11')](respondWithResult(_0x186422,null))['catch'](handleError(_0x186422,null));};exports['describe']=function(_0x5eea70,_0x1137e0){return db['User']['describe']()[_0x2036('0x11')](respondWithResult(_0x1137e0,null))[_0x2036('0x19')](handleError(_0x1137e0,null));};exports[_0x2036('0x5b')]=function(_0x100d5f,_0x220cd7){return db['User']['find']({'where':{'id':_0x100d5f[_0x2036('0x5a')]['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x220cd7,null))['then'](function(_0x2936b4){if(_0x2936b4){return _0x2936b4['addContacts'](_0x100d5f['body']['ids'],_[_0x2036('0x5c')](_0x100d5f[_0x2036('0x59')],['ids','id'])||{});}})['then'](respondWithResult(_0x220cd7,null))[_0x2036('0x19')](handleError(_0x220cd7,null));};function validateUser(_0x9eb051){return new BPromise(function(_0x5356ba,_0x2414b2){if(_0x9eb051[_0x2036('0x5d')])return _0x5356ba(_0x9eb051);return db[_0x2036('0x5e')][_0x2036('0x5f')](0x1)[_0x2036('0x11')](function(_0x4d54c3){if(_0x4d54c3[_0x2036('0x60')])authService['validatePasswordPattern'](_0x9eb051[_0x2036('0x3a')]);db[_0x2036('0x35')][_0x2036('0x61')]('internal')[_0x2036('0x11')](function(_0x1220dd){if(_[_0x2036('0x62')](_0x1220dd)){_0x9eb051[_0x2036('0x5d')]=_0x4d54c3[_0x2036('0x63')]||0x1;return;}if(_[_0x2036('0x62')](_0x4d54c3['min_internal'])||_0x4d54c3[_0x2036('0x63')]===_0x1220dd){_0x9eb051[_0x2036('0x5d')]=_0x1220dd+0x1;return;}if(_0x4d54c3[_0x2036('0x63')]>_0x1220dd){_0x9eb051['internal']=_0x4d54c3[_0x2036('0x63')];return;}return db[_0x2036('0x64')][_0x2036('0x40')](_0x2036('0x65'),{'type':db[_0x2036('0x64')][_0x2036('0x66')][_0x2036('0x67')]})[_0x2036('0x11')](function(_0x2e5057){if(_0x2e5057&&_0x2e5057[_0x2036('0x55')]){for(var _0x287342=0x0,_0x4e3db7=_0x2e5057[_0x2036('0x55')];_0x287342<_0x4e3db7&&_[_0x2036('0x62')](_0x9eb051[_0x2036('0x5d')]);_0x287342++){if(_0x4d54c3[_0x2036('0x63')]<=_0x2e5057[_0x287342][_0x2036('0x68')]){_0x9eb051[_0x2036('0x5d')]=_0x2e5057[_0x287342][_0x2036('0x68')];}else if(_0x4d54c3[_0x2036('0x63')]>_0x2e5057[_0x287342][_0x2036('0x68')]&&_0x4d54c3['min_internal']<=_0x2e5057[_0x287342]['to']){_0x9eb051[_0x2036('0x5d')]=_0x4d54c3['min_internal'];}}}if(_[_0x2036('0x62')](_0x9eb051['internal'])){_0x9eb051['internal']=_0x1220dd+0x1;}return _0x5356ba(_0x9eb051);});});})[_0x2036('0x19')](function(_0xb20b0b){_0x2414b2(_0xb20b0b);});});}function updateUser(_0x2867d0){return new BPromise(function(_0x43dc17,_0x57d291){try{if(_0x2867d0[_0x2036('0x69')]){_0x2867d0[_0x2036('0x6a')]=_0x2867d0['internal'];_0x2867d0[_0x2036('0x6b')]={'mailbox':_0x2867d0[_0x2036('0x5d')],'password':_0x2867d0[_0x2036('0x3a')],'fullname':_0x2867d0[_0x2036('0x6c')],'email':_0x2867d0[_0x2036('0x6d')]};}if(_0x2867d0[_0x2036('0x26')]===_0x2036('0x2a')){if(!_0x2867d0[_0x2036('0x6e')])_0x2867d0['permissions']=['101',_0x2036('0x6f'),_0x2036('0x70'),'113','110',_0x2036('0x71'),_0x2036('0x72'),_0x2036('0x73'),_0x2036('0x74'),_0x2036('0x75'),_0x2036('0x76'),'100',_0x2036('0x77'),_0x2036('0x78'),_0x2036('0x79')];}_0x43dc17(_0x2867d0);}catch(_0x4dfc20){_0x57d291(_0x4dfc20);}});}exports['create']=function(_0x2caeac,_0x4c5ade){if(_0x2caeac['user'][_0x2036('0x26')]==='agent')throw new Error(_0x2036('0x7a'));if(_0x2caeac['body'][_0x2036('0x26')]===_0x2036('0x29')&&_0x2caeac[_0x2036('0x29')][_0x2036('0x26')]!==_0x2036('0x27')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x2caeac['body'][_0x2036('0x26')]==='admin'&&_0x2caeac[_0x2036('0x29')][_0x2036('0x26')]!==_0x2036('0x27')){throw new Error(_0x2036('0x7b'));}return licenseUtil[_0x2036('0x7c')]([_0x2caeac[_0x2036('0x59')]])[_0x2036('0x11')](function(){return validateUser(_0x2caeac['body']);})[_0x2036('0x11')](function(_0x295e87){return updateUser(_0x295e87)[_0x2036('0x11')](function(_0x646a53){if(_0x646a53[_0x2036('0x26')]==='admin'){_0x646a53['settingsEnabled']=_0x2caeac[_0x2036('0x29')][_0x2036('0x7d')];delete _0x646a53[_0x2036('0x7e')];}return _0x646a53;});})[_0x2036('0x11')](function(_0x45a7e1){return db[_0x2036('0x35')]['create'](_0x45a7e1,{'include':[{'model':db[_0x2036('0x6b')],'as':_0x2036('0x6b')}]});})[_0x2036('0x11')](function(_0x19931e){if(_0x2caeac[_0x2036('0x59')]['role']==='user')return _0x19931e;if(_0x2caeac['user']['role']!==_0x2036('0x29'))return _0x19931e;return db[_0x2036('0x7f')]['find']({'where':{'name':_0x19931e[_0x2036('0x26')]===_0x2036('0x2a')?_0x2036('0x80'):'Telephones','userProfileId':_0x2caeac[_0x2036('0x29')][_0x2036('0x7e')]},'raw':!![]})[_0x2036('0x11')](function(_0x5a8cc6){if(!_0x5a8cc6||_0x5a8cc6[_0x2036('0x81')]!=0x0)return _0x19931e;return db['UserProfileResource']['create']({'name':_0x19931e[_0x2036('0x32')],'resourceId':_0x19931e['id'],'type':_0x5a8cc6['name'],'sectionId':_0x5a8cc6['id']},{})[_0x2036('0x11')](function(){return _0x19931e;});})[_0x2036('0x19')](function(_0x2d1ad3){logger[_0x2036('0x15')](_0x2036('0x82'),_0x2d1ad3);throw _0x2d1ad3;});})['then'](respondWithResult(_0x4c5ade,0xc9))[_0x2036('0x19')](handleError(_0x4c5ade,null));};exports['bulkCreate']=function(_0x49c07a,_0xea896b){var _0x48f8a0=_0x49c07a[_0x2036('0x59')];var _0x2b90f0=[];if(_0x49c07a[_0x2036('0x29')][_0x2036('0x26')]===_0x2036('0x2a'))throw new Error('Unauthorized');if(_[_0x2036('0x83')](_0x48f8a0,['role',_0x2036('0x29')])&&_0x49c07a[_0x2036('0x29')][_0x2036('0x26')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x48f8a0,[_0x2036('0x26'),'admin'])&&_0x49c07a['user'][_0x2036('0x26')]!==_0x2036('0x27')){throw new Error(_0x2036('0x84'));}return licenseUtil['checkUserLimits'](_0x48f8a0)[_0x2036('0x11')](function(){return validateUser(_0x48f8a0[0x0]);})[_0x2036('0x11')](function(){for(var _0x1fe978=0x1;_0x1fe978<_0x48f8a0['length'];_0x1fe978++){var _0x234732=_0x48f8a0[_0x1fe978-0x1][_0x2036('0x5d')];if(!_0x48f8a0[_0x1fe978]['internal'])_0x48f8a0[_0x1fe978][_0x2036('0x5d')]=_0x234732+0x1;_0x2b90f0[_0x2036('0x44')](validateUser(_0x48f8a0[_0x1fe978]));}return BPromise[_0x2036('0x4e')](_0x2b90f0);})[_0x2036('0x11')](function(){_0x2b90f0=[];for(var _0xdf5fb9=0x0;_0xdf5fb9<_0x48f8a0[_0x2036('0x55')];_0xdf5fb9++){_0x2b90f0[_0x2036('0x44')](updateUser(_0x48f8a0[_0xdf5fb9]));}return BPromise[_0x2036('0x4e')](_0x2b90f0);})[_0x2036('0x11')](function(){return BPromise[_0x2036('0x85')](_0x48f8a0,function(_0x36b420){return db[_0x2036('0x35')][_0x2036('0x86')](_0x36b420,{'include':[{'model':db[_0x2036('0x6b')],'as':'VoiceMail'}]})[_0x2036('0x11')](function(_0x12afe9){_0x36b420['id']=_0x12afe9['id'];return _0x36b420;});});})[_0x2036('0x11')](function(_0x314907){if(_0x49c07a[_0x2036('0x59')]['role']===_0x2036('0x29'))return _0x314907;if(_0x49c07a[_0x2036('0x29')][_0x2036('0x26')]!==_0x2036('0x29'))return _0x314907;var _0x158e8d=_[_0x2036('0x83')](_0x314907,function(_0x3d0414){return _0x3d0414['role']===_0x2036('0x2a')||_0x3d0414[_0x2036('0x26')]==='telephone';});if(!_0x158e8d)return _0x314907;return db[_0x2036('0x7f')][_0x2036('0x45')]({'where':{'name':{'$or':['Agents',_0x2036('0x87')]},'userProfileId':_0x49c07a[_0x2036('0x29')]['userProfileId']},'raw':!![]})[_0x2036('0x11')](function(_0x3204eb){if(_[_0x2036('0x88')](_0x3204eb)||!_['some'](_0x3204eb,['autoAssociation',0x0]))return _0x314907;_0x2b90f0=[];var _0x1b7e73=_(_0x3204eb)[_0x2036('0x2c')](function(_0x2046c4){if(_0x2046c4[_0x2036('0x81')]===0x1)return;return _0x2046c4['name']===_0x2036('0x80')?_0x2036('0x2a'):'telephone';})['compact']()[_0x2036('0x2d')]();for(var _0x58535d=0x0;_0x58535d<_0x314907[_0x2036('0x55')];_0x58535d++){if(!_['includes'](_0x1b7e73,_0x314907[_0x58535d][_0x2036('0x26')]))return;var _0x2d4a6e=_0x314907[_0x58535d][_0x2036('0x26')]===_0x2036('0x2a')?_0x2036('0x80'):_0x2036('0x87');_0x2b90f0['push'](db['UserProfileResource'][_0x2036('0x86')]({'name':_0x314907[_0x58535d]['name'],'resourceId':_0x314907[_0x58535d]['id'],'type':_0x2d4a6e,'sectionId':_[_0x2036('0x2f')](_0x3204eb,[_0x2036('0x32'),_0x2d4a6e])['id']},{}));}return BPromise[_0x2036('0x4e')](_0x2b90f0);});})[_0x2036('0x11')](respondWithResult(_0xea896b,0xc9))[_0x2036('0x19')](handleError(_0xea896b,null));};exports[_0x2036('0x89')]=function(_0x5d1b67,_0x4d9e5f){if(_0x5d1b67[_0x2036('0x59')]['id']){delete _0x5d1b67[_0x2036('0x59')]['id'];}return db[_0x2036('0x35')][_0x2036('0x2f')]({'where':{'id':_0x5d1b67[_0x2036('0x5a')]['id']}})['then'](function(_0x644d51){if(!_0x644d51)return null;if(_0x644d51['id']===_0x5d1b67[_0x2036('0x29')]['id']){if(!_0x5d1b67[_0x2036('0x59')][_0x2036('0x8a')]||!_0x5d1b67[_0x2036('0x59')][_0x2036('0x8b')]){throw new db['Sequelize'][(_0x2036('0x8c'))](_0x2036('0x8d'));}if(!_0x644d51[_0x2036('0x8e')](_0x5d1b67['body'][_0x2036('0x8a')])){throw new db[(_0x2036('0x8f'))][(_0x2036('0x8c'))]('Wrong\x20credentials');}if(_0x5d1b67[_0x2036('0x59')][_0x2036('0x8a')]===_0x5d1b67[_0x2036('0x59')][_0x2036('0x8b')]){throw new db[(_0x2036('0x8f'))][(_0x2036('0x8c'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5d1b67[_0x2036('0x29')][_0x2036('0x26')]===_0x2036('0x27')){if(!_0x5d1b67['body'][_0x2036('0x8b')]){throw new db[(_0x2036('0x8f'))][(_0x2036('0x8c'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x5d1b67[_0x2036('0x29')][_0x2036('0x26')]===_0x2036('0x29')){if(!_0x5d1b67[_0x2036('0x59')]['newPassword']){throw new db[(_0x2036('0x8f'))]['ValidationError'](_0x2036('0x90'));}if(_0x644d51[_0x2036('0x26')]!==_0x2036('0x2a')){throw new db[(_0x2036('0x8f'))][(_0x2036('0x8c'))](_0x2036('0x7a'));}}else{throw new db[(_0x2036('0x8f'))][(_0x2036('0x8c'))]('Unauthorized');}return _0x644d51;})[_0x2036('0x11')](handleEntityNotFound(_0x4d9e5f,null))[_0x2036('0x11')](function(_0x5c39fe){return db[_0x2036('0x5e')][_0x2036('0x91')]({'attributes':['id',_0x2036('0x60'),_0x2036('0x92'),_0x2036('0x93')]})[_0x2036('0x11')](function(_0x2f11be){if(_0x2f11be[_0x2036('0x60')])authService[_0x2036('0x94')](_0x5d1b67['body']['newPassword']);if(!_0x2f11be[_0x2036('0x92')]||!_0x5c39fe[_0x2036('0x95')])return _0x5c39fe;authService[_0x2036('0x96')](_0x5d1b67[_0x2036('0x59')][_0x2036('0x8b')],_0x5c39fe[_0x2036('0x95')],_0x2f11be[_0x2036('0x93')]);return _0x5c39fe;})['then'](saveUpdates({'password':_0x5d1b67['body'][_0x2036('0x8b')],'passwordResetAt':_0x5d1b67[_0x2036('0x29')]['id']==_0x5d1b67[_0x2036('0x5a')]['id']?moment():null,'previousPasswords':authService[_0x2036('0x97')](_0x5d1b67[_0x2036('0x59')][_0x2036('0x8b')],_0x5c39fe[_0x2036('0x95')])},null));})[_0x2036('0x11')](respondWithResult(_0x4d9e5f,null))[_0x2036('0x19')](handleError(_0x4d9e5f,null));};exports['addQueues']=function(_0x486b6b,_0x767785){var _0x4e2395=_0x486b6b[_0x2036('0x59')][_0x2036('0x98')];return db['User']['find']({'where':{'id':_0x486b6b[_0x2036('0x5a')]['id']},'attributes':['id',_0x2036('0x32'),'role',_0x2036('0x99'),'loginInPause',_0x2036('0x9a'),'interface']})['then'](handleEntityNotFound(_0x767785,null))[_0x2036('0x11')](function(_0x21db5c){if(_0x21db5c){if(!utils[_0x2036('0x9b')](_0x4e2395)){throw new db[(_0x2036('0x8f'))]['ValidationError']('Unknown\x20channel');}return _0x21db5c['add'+_[_0x2036('0x9c')](_0x4e2395['toLowerCase']())+'Queues'](_0x486b6b[_0x2036('0x59')][_0x2036('0x9d')],{'penalty':_0x486b6b['body'][_0x2036('0x9e')]||0x0})[_0x2036('0x9f')](function(_0x245c0f){for(var _0x4853e3=0x0;_0x4853e3<_0x486b6b[_0x2036('0x59')][_0x2036('0x9d')][_0x2036('0x55')];_0x4853e3+=0x1){var _0x36e2d5={'UserId':Number(_0x486b6b[_0x2036('0x5a')]['id'])};_0x36e2d5[_[_0x2036('0x9c')](_0x4e2395[_0x2036('0xa0')]())+_0x2036('0xa1')]=Number(_0x486b6b['body']['ids'][_0x4853e3]);socket[_0x2036('0xa2')](_0x2036('0x29')+_[_0x2036('0x9c')](_0x4e2395[_0x2036('0xa0')]())+_0x2036('0xa3'),_0x36e2d5);}return _0x245c0f;})[_0x2036('0x11')](function(){if(_0x4e2395===_0x2036('0xa4')){return db['VoiceQueue']['findAll']({'where':{'id':_0x486b6b[_0x2036('0x59')]['ids']||[]},'raw':!![],'attributes':['id',_0x2036('0x32')]});}})[_0x2036('0x11')](function(_0x490fb6){var _0x3f3dc2=_0x21db5c[_0x2036('0x25')]({'plain':!![]});var _0x18311a=[];if(_0x4e2395===_0x2036('0xa4')&&_0x3f3dc2[_0x2036('0x26')]===_0x2036('0x2a')&&_0x3f3dc2[_0x2036('0x99')]){for(var _0x344ad4=0x0;_0x344ad4<_0x490fb6[_0x2036('0x55')];_0x344ad4+=0x1){_0x18311a['push']({'membername':_0x3f3dc2[_0x2036('0x32')],'UserId':_0x3f3dc2['id'],'queue_name':_0x490fb6[_0x344ad4][_0x2036('0x32')],'VoiceQueueId':_0x490fb6[_0x344ad4]['id'],'interface':_['isNil'](_0x3f3dc2[_0x2036('0xa5')])?util[_0x2036('0xa6')](_0x2036('0xa7'),_0x3f3dc2['name']):_0x3f3dc2[_0x2036('0xa5')],'paused':_0x3f3dc2['voicePause']||![],'penalty':_0x486b6b[_0x2036('0x59')][_0x2036('0x9e')]||0x0});}return BPromise[_0x2036('0x85')](_0x18311a,function(_0x50de22){return db[_0x2036('0xa8')][_0x2036('0xa9')](_0x50de22);});}return _0x21db5c;});}})['then'](respondWithStatusCode(_0x767785,null))[_0x2036('0x19')](handleError(_0x767785,null));};exports['removeQueues']=function(_0x5ef042,_0x4035bf){var _0x380dde,_0x1f22e7;return db[_0x2036('0x35')][_0x2036('0x2f')]({'where':{'id':_0x5ef042[_0x2036('0x5a')]['id']},'attributes':['id',_0x2036('0x32'),_0x2036('0x26')]})[_0x2036('0x11')](handleEntityNotFound(_0x4035bf,null))[_0x2036('0x11')](function(_0x4d3a){if(_0x4d3a){_0x380dde=_0x4d3a;if(!_0x5ef042[_0x2036('0x40')][_0x2036('0x98')]||!utils[_0x2036('0x9b')](_0x5ef042[_0x2036('0x40')]['channel'])){throw new db[(_0x2036('0x8f'))][(_0x2036('0x8c'))](_0x2036('0xaa'));}return _0x4d3a['remove'+_['capitalize'](_0x5ef042[_0x2036('0x40')][_0x2036('0x98')][_0x2036('0xa0')]())+_0x2036('0xab')](_0x5ef042[_0x2036('0x40')][_0x2036('0x9d')]);}})[_0x2036('0x11')](function(_0x4bde4e){if(_['isArray'](_0x5ef042[_0x2036('0x40')][_0x2036('0x9d')])){for(var _0x491ee4=0x0;_0x491ee4<_0x5ef042[_0x2036('0x40')]['ids'][_0x2036('0x55')];_0x491ee4+=0x1){_0x1f22e7={'UserId':Number(_0x5ef042['params']['id'])};_0x1f22e7[_[_0x2036('0x9c')](_0x5ef042[_0x2036('0x40')][_0x2036('0x98')][_0x2036('0xa0')]())+_0x2036('0xa1')]=Number(_0x5ef042[_0x2036('0x40')][_0x2036('0x9d')][_0x491ee4]);socket[_0x2036('0xa2')](_0x2036('0x29')+_['capitalize'](_0x5ef042['query'][_0x2036('0x98')][_0x2036('0xa0')]())+'Queue:remove',_0x1f22e7);}}else{_0x1f22e7={'UserId':Number(_0x5ef042['params']['id'])};_0x1f22e7[_['capitalize'](_0x5ef042[_0x2036('0x40')][_0x2036('0x98')][_0x2036('0xa0')]())+'QueueId']=Number(_0x5ef042[_0x2036('0x40')][_0x2036('0x9d')]);socket[_0x2036('0xa2')](_0x2036('0x29')+_[_0x2036('0x9c')](_0x5ef042['query'][_0x2036('0x98')][_0x2036('0xa0')]())+_0x2036('0xac'),_0x1f22e7);}return _0x4bde4e;})[_0x2036('0x11')](function(){if(_0x5ef042[_0x2036('0x40')]['channel']===_0x2036('0xa4')){return db[_0x2036('0xa8')][_0x2036('0x24')]({'where':{'UserId':_0x5ef042[_0x2036('0x5a')]['id'],'VoiceQueueId':_0x5ef042['query'][_0x2036('0x9d')]},'individualHooks':!![]})[_0x2036('0x11')](function(){return _0x380dde;});}return _0x380dde;})[_0x2036('0x11')](respondWithStatusCode(_0x4035bf,null))[_0x2036('0x19')](handleError(_0x4035bf,null));};exports['addAvatar']=function(_0x30df88,_0x424124){_0x30df88[_0x2036('0x59')]['userpic']=_0x30df88['file'][_0x2036('0xad')];return db[_0x2036('0x35')][_0x2036('0x2f')]({'where':{'id':_0x30df88[_0x2036('0x5a')]['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x424124,null))[_0x2036('0x11')](saveUpdates(_0x30df88['body'],null))[_0x2036('0x11')](respondWithResult(_0x424124,null))['catch'](handleError(_0x424124,null));};exports[_0x2036('0xae')]=function(_0x3d8cb6,_0x17b33c){var _0x391153=path[_0x2036('0xaf')](config[_0x2036('0xb0')],_0x2036('0xb1'));return db['User']['find']({'where':{'id':_0x3d8cb6[_0x2036('0x5a')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x2036('0x11')](handleEntityNotFound(_0x17b33c,null))['then'](function(_0x4bcf48){if(_0x4bcf48){if(_['isNil'](_0x4bcf48[_0x2036('0xb2')])){return _0x17b33c[_0x2036('0xb3')](_0x391153);}else{if(!fs[_0x2036('0xb4')](path[_0x2036('0xaf')](config[_0x2036('0xb0')],_0x2036('0xb5'),_0x4bcf48[_0x2036('0xb2')]))){return _0x17b33c[_0x2036('0xb3')](_0x391153);}return _0x17b33c['download'](path[_0x2036('0xaf')](config['root'],_0x2036('0xb5'),_0x4bcf48[_0x2036('0xb2')]));}}})[_0x2036('0x19')](handleError(_0x17b33c,null));};exports[_0x2036('0xb6')]=function(_0x54b1bc,_0x155df1){return db[_0x2036('0x35')]['find']({'where':{'id':_0x54b1bc['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x155df1,null))[_0x2036('0x11')](function(_0x7c334c){var _0x46026d=[];values=_0x7c334c['dataValues'];_0x46026d['push'](get_open_tabs(_0x2036('0x49'),_0x7c334c[_0x2036('0x4a')]));_0x46026d[_0x2036('0x44')](get_open_tabs(_0x2036('0xb7'),_0x7c334c[_0x2036('0x4a')]));_0x46026d[_0x2036('0x44')](get_open_tabs(_0x2036('0x58'),_0x7c334c['dataValues']));_0x46026d[_0x2036('0x44')](get_open_tabs(_0x2036('0x4d'),_0x7c334c[_0x2036('0x4a')]));_0x46026d[_0x2036('0x44')](get_open_tabs(_0x2036('0x4b'),_0x7c334c[_0x2036('0x4a')]));_0x46026d[_0x2036('0x44')](get_open_tabs(_0x2036('0x4c'),_0x7c334c[_0x2036('0x4a')]));return BPromise[_0x2036('0x4e')](_0x46026d);})[_0x2036('0x11')](function(_0x181feb){if(_0x181feb){var _0x28c04d=_[_0x2036('0x2c')](values[_0x2036('0xb8')],function(_0x5ec501){return{'channel':'CHAT','id':_0x5ec501['id'],'createdAt':_0x5ec501[_0x2036('0xb9')]};});var _0x349b64=_[_0x2036('0x2c')](values['FaxOpenTabs'],function(_0x4a0822){return{'channel':_0x2036('0xba'),'id':_0x4a0822['id'],'createdAt':_0x4a0822[_0x2036('0xb9')]};});var _0x3fbee7=_['map'](values[_0x2036('0xbb')],function(_0x23b167){return{'channel':'OPENCHANNEL','id':_0x23b167['id'],'createdAt':_0x23b167['createdAt']};});var _0x15d2c1=_[_0x2036('0x2c')](values[_0x2036('0xbc')],function(_0x3452f4){return{'channel':'MAIL','id':_0x3452f4['id'],'createdAt':_0x3452f4[_0x2036('0xb9')]};});var _0x46b73e=_[_0x2036('0x2c')](values[_0x2036('0xbd')],function(_0x1403a8){return{'channel':_0x2036('0xbe'),'id':_0x1403a8['id'],'createdAt':_0x1403a8[_0x2036('0xb9')]};});var _0x1bab3d=_['map'](values[_0x2036('0xbf')],function(_0x1a0ecb){return{'channel':_0x2036('0xc0'),'id':_0x1a0ecb['id'],'createdAt':_0x1a0ecb[_0x2036('0xb9')]};});var _0x32b974=_['concat'](_0x28c04d,_0x349b64,_0x3fbee7,_0x15d2c1,_0x46b73e,_0x1bab3d);var _0x4be6b9={'count':_0x32b974['length'],'rows':_0x32b974};return _0x4be6b9;}else return null;})['then'](respondWithResult(_0x155df1,null))[_0x2036('0x19')](handleError(_0x155df1,null));};exports['getContacts']=function(_0xd542b9,_0x514ef4){var _0x295586={};var _0x16245e={};var _0x3a1f07;var _0x4a2b67;return db['User'][_0x2036('0x91')]({'where':{'id':_0xd542b9[_0x2036('0x5a')]['id']}})['then'](handleEntityNotFound(_0x514ef4,null))[_0x2036('0x11')](function(_0xf4cca){if(_0xf4cca){_0x3a1f07=_0xf4cca;_0x16245e[_0x2036('0x4f')]=_['keys'](db[_0x2036('0xc1')][_0x2036('0x50')]);_0x16245e[_0x2036('0x40')]=_[_0x2036('0x51')](_0xd542b9[_0x2036('0x40')]);_0x16245e[_0x2036('0x52')]=_[_0x2036('0x53')](_0x16245e[_0x2036('0x4f')],_0x16245e[_0x2036('0x40')]);_0x295586['attributes']=_['intersection'](_0x16245e[_0x2036('0x4f')],qs[_0x2036('0x54')](_0xd542b9[_0x2036('0x40')][_0x2036('0x54')]));_0x295586[_0x2036('0x43')]=_0x295586[_0x2036('0x43')][_0x2036('0x55')]?_0x295586[_0x2036('0x43')]:_0x16245e['model'];_0x295586[_0x2036('0xc2')]=qs['sort'](_0xd542b9[_0x2036('0x40')][_0x2036('0xc3')]);_0x295586[_0x2036('0x3d')]=qs[_0x2036('0x52')](_['pick'](_0xd542b9['query'],_0x16245e[_0x2036('0x52')]));if(_0xd542b9[_0x2036('0x40')][_0x2036('0x39')]){_0x295586[_0x2036('0x3d')]=_[_0x2036('0x56')](_0x295586[_0x2036('0x3d')],{'$or':_[_0x2036('0x2c')](_0x295586[_0x2036('0x43')],function(_0x3f71f3){var _0x3db5f4={};_0x3db5f4[_0x3f71f3]={'$like':'%'+_0xd542b9['query'][_0x2036('0x39')]+'%'};return _0x3db5f4;})});}_0x295586=_[_0x2036('0x56')]({},_0x295586,_0xd542b9[_0x2036('0x57')]);return _0x3a1f07['getContacts'](_0x295586);}})[_0x2036('0x11')](function(_0x3fe4b5){if(_0x3fe4b5){_0x4a2b67=_0x3fe4b5[_0x2036('0x55')];if(_0xd542b9[_0x2036('0x40')]['hasOwnProperty']('includeAll')){_0x295586[_0x2036('0x3f')]=[{'model':db['CmList'],'as':_0x2036('0xc4'),'required':![]},{'model':db[_0x2036('0xc5')],'as':_0x2036('0xc6'),'attributes':['id',_0x2036('0x32'),_0x2036('0xc7')],'where':_0xd542b9[_0x2036('0x40')]['tag']?{'id':_0xd542b9[_0x2036('0x40')]['tag']}:undefined,'required':_0xd542b9['query'][_0x2036('0xc8')]?!![]:![]}];}if(!_0xd542b9[_0x2036('0x40')]['hasOwnProperty'](_0x2036('0xc9'))){_0x295586[_0x2036('0x20')]=qs[_0x2036('0x20')](_0xd542b9[_0x2036('0x40')][_0x2036('0x20')]);_0x295586[_0x2036('0x1e')]=qs['offset'](_0xd542b9[_0x2036('0x40')][_0x2036('0x1e')]);}return _0x3a1f07[_0x2036('0xca')](_0x295586);}})[_0x2036('0x11')](function(_0x28972a){if(_0x28972a){return _0x28972a?{'count':_0x4a2b67,'rows':_0x28972a}:null;}})[_0x2036('0x11')](respondWithResult(_0x514ef4,null))[_0x2036('0x19')](handleError(_0x514ef4,null));};exports[_0x2036('0xcb')]=function(_0x5b864b,_0x5a688d){var _0x340d04;var _0x29a22c={};var _0x2b66a4;return db[_0x2036('0x35')]['findOne']({'where':{'id':_0x5b864b[_0x2036('0x5a')]['id']},'attributes':['id','name','role']})[_0x2036('0x11')](handleEntityNotFound(_0x5a688d,null))[_0x2036('0x11')](function(_0x4121dc){if(!utils[_0x2036('0x9b')](_0x5b864b['query'][_0x2036('0x98')])){throw new db[(_0x2036('0x8f'))]['ValidationError'](_0x2036('0xaa'));}_0x340d04=_0x4121dc;var _0x571778={};_0x571778['model']=_['keys'](db[_[_0x2036('0x9c')](_0x5b864b['query'][_0x2036('0x98')])+_0x2036('0xcc')][_0x2036('0x50')]);_0x571778['query']=_[_0x2036('0x51')](_0x5b864b[_0x2036('0x40')]);_0x571778[_0x2036('0x52')]=_['intersection'](_0x571778[_0x2036('0x4f')],_0x571778['query']);_0x29a22c[_0x2036('0x43')]=_['intersection'](_0x571778[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x5b864b[_0x2036('0x40')]['fields']));_0x29a22c[_0x2036('0x43')]=_0x29a22c['attributes'][_0x2036('0x55')]?_0x29a22c[_0x2036('0x43')]:_0x571778[_0x2036('0x4f')];_0x29a22c[_0x2036('0xc2')]=qs[_0x2036('0xc3')](_0x5b864b[_0x2036('0x40')][_0x2036('0xc3')]);_0x29a22c['where']=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x5b864b['query'],_0x571778[_0x2036('0x52')]));if(_0x5b864b[_0x2036('0x40')][_0x2036('0x39')]){_0x29a22c['where']=_[_0x2036('0x56')](_0x29a22c[_0x2036('0x3d')],{'$or':_['map'](_0x29a22c[_0x2036('0x43')],function(_0x5e7899){var _0x3a18d6={};_0x3a18d6[_0x5e7899]={'$like':'%'+_0x5b864b[_0x2036('0x40')][_0x2036('0x39')]+'%'};return _0x3a18d6;})});}_0x29a22c=_['merge']({},_0x29a22c,_0x5b864b[_0x2036('0x57')]);switch(_0x340d04[_0x2036('0x26')]){case _0x2036('0x27'):return db[_[_0x2036('0x9c')](_0x5b864b['query']['channel'])+'Queue'][_0x2036('0x45')](_0x29a22c);case _0x2036('0x29'):case _0x2036('0x2a'):return _0x340d04['get'+_[_0x2036('0x9c')](_0x5b864b[_0x2036('0x40')][_0x2036('0x98')])+_0x2036('0xab')](_0x29a22c);default:throw new db['Sequelize'][(_0x2036('0x8c'))](_0x2036('0xce'));}})[_0x2036('0x11')](function(_0x5daaa4){_0x2b66a4=_0x5daaa4[_0x2036('0x55')];if(!_0x5b864b[_0x2036('0x40')]['hasOwnProperty'](_0x2036('0xc9'))){_0x29a22c['limit']=qs[_0x2036('0x20')](_0x5b864b['query'][_0x2036('0x20')]);_0x29a22c['offset']=qs[_0x2036('0x1e')](_0x5b864b[_0x2036('0x40')]['offset']);}switch(_0x340d04['role']){case _0x2036('0x27'):return db[_[_0x2036('0x9c')](_0x5b864b['query'][_0x2036('0x98')])+_0x2036('0xcc')][_0x2036('0x45')](_0x29a22c);case _0x2036('0x29'):case _0x2036('0x2a'):return _0x340d04['get'+_[_0x2036('0x9c')](_0x5b864b['query'][_0x2036('0x98')])+'Queues'](_0x29a22c);}})[_0x2036('0x11')](function(_0x1816ab){return{'count':_0x2b66a4,'rows':_0x1816ab};})[_0x2036('0x11')](respondWithResult(_0x5a688d,null))[_0x2036('0x19')](handleError(_0x5a688d,null));};exports[_0x2036('0xcf')]=function(_0x58df92,_0x52d17d){var _0x4bb756={};var _0x411bec={};var _0x11d7d4;var _0x2e62b0;return db[_0x2036('0x35')][_0x2036('0x91')]({'where':{'id':_0x58df92[_0x2036('0x5a')]['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x52d17d,null))[_0x2036('0x11')](function(_0x1e3cd6){if(_0x1e3cd6){_0x11d7d4=_0x1e3cd6;_0x411bec[_0x2036('0x4f')]=_['keys'](db[_0x2036('0xa8')][_0x2036('0x50')]);_0x411bec[_0x2036('0x40')]=_[_0x2036('0x51')](_0x58df92['query']);_0x411bec['filters']=_[_0x2036('0x53')](_0x411bec[_0x2036('0x4f')],_0x411bec[_0x2036('0x40')]);_0x4bb756[_0x2036('0x43')]=_[_0x2036('0x53')](_0x411bec[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x58df92[_0x2036('0x40')]['fields']));_0x4bb756['attributes']=_0x4bb756['attributes'][_0x2036('0x55')]?_0x4bb756[_0x2036('0x43')]:_0x411bec[_0x2036('0x4f')];_0x4bb756[_0x2036('0xc2')]=qs[_0x2036('0xc3')](_0x58df92[_0x2036('0x40')][_0x2036('0xc3')]);_0x4bb756[_0x2036('0x3d')]=qs['filters'](_[_0x2036('0xcd')](_0x58df92['query'],_0x411bec[_0x2036('0x52')]));if(_0x58df92[_0x2036('0x40')][_0x2036('0x39')]){_0x4bb756['where']=_[_0x2036('0x56')](_0x4bb756[_0x2036('0x3d')],{'$or':_[_0x2036('0x2c')](_0x4bb756[_0x2036('0x43')],function(_0x151f58){var _0x30c649={};_0x30c649[_0x151f58]={'$like':'%'+_0x58df92['query'][_0x2036('0x39')]+'%'};return _0x30c649;})});}_0x4bb756=_[_0x2036('0x56')]({},_0x4bb756,_0x58df92[_0x2036('0x57')]);return _0x11d7d4[_0x2036('0xcf')](_0x4bb756);}})[_0x2036('0x11')](function(_0x187ac3){if(_0x187ac3){_0x2e62b0=_0x187ac3[_0x2036('0x55')];if(!_0x58df92[_0x2036('0x40')]['hasOwnProperty'](_0x2036('0xc9'))){_0x4bb756[_0x2036('0x20')]=qs[_0x2036('0x20')](_0x58df92[_0x2036('0x40')]['limit']);_0x4bb756[_0x2036('0x1e')]=qs['offset'](_0x58df92[_0x2036('0x40')][_0x2036('0x1e')]);}return _0x11d7d4[_0x2036('0xcf')](_0x4bb756);}})[_0x2036('0x11')](function(_0x3e0ff7){if(_0x3e0ff7){return _0x3e0ff7?{'count':_0x2e62b0,'rows':_0x3e0ff7}:null;}})[_0x2036('0x11')](respondWithResult(_0x52d17d,null))[_0x2036('0x19')](handleError(_0x52d17d,null));};exports[_0x2036('0xd0')]=function(_0x279d03,_0x2fd49d){var _0x117512={};var _0x1163c8={};var _0x393ffd;var _0x53676e;return db['User']['findOne']({'where':{'id':_0x279d03[_0x2036('0x5a')]['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x2fd49d,null))['then'](function(_0x13fded){if(_0x13fded){_0x393ffd=_0x13fded;_0x1163c8[_0x2036('0x4f')]=_['keys'](db[_0x2036('0xd1')][_0x2036('0x50')]);_0x1163c8[_0x2036('0x40')]=_[_0x2036('0x51')](_0x279d03[_0x2036('0x40')]);_0x1163c8[_0x2036('0x52')]=_['intersection'](_0x1163c8[_0x2036('0x4f')],_0x1163c8['query']);_0x117512['attributes']=_[_0x2036('0x53')](_0x1163c8[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x279d03[_0x2036('0x40')]['fields']));_0x117512[_0x2036('0x43')]=_0x117512[_0x2036('0x43')][_0x2036('0x55')]?_0x117512['attributes']:_0x1163c8[_0x2036('0x4f')];_0x117512['order']=qs[_0x2036('0xc3')](_0x279d03['query'][_0x2036('0xc3')]);_0x117512[_0x2036('0x3d')]=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x279d03['query'],_0x1163c8[_0x2036('0x52')]));if(_0x279d03[_0x2036('0x40')][_0x2036('0x39')]){_0x117512[_0x2036('0x3d')]=_['merge'](_0x117512['where'],{'$or':_[_0x2036('0x2c')](_0x117512['attributes'],function(_0x19f751){var _0x46639b={};_0x46639b[_0x19f751]={'$like':'%'+_0x279d03['query'][_0x2036('0x39')]+'%'};return _0x46639b;})});}_0x117512=_['merge']({},_0x117512,_0x279d03[_0x2036('0x57')]);return _0x393ffd['getGroups'](_0x117512);}})[_0x2036('0x11')](function(_0xdfb473){if(_0xdfb473){_0x53676e=_0xdfb473[_0x2036('0x55')];if(!_0x279d03[_0x2036('0x40')][_0x2036('0xd2')](_0x2036('0xc9'))){_0x117512[_0x2036('0x20')]=qs['limit'](_0x279d03[_0x2036('0x40')]['limit']);_0x117512[_0x2036('0x1e')]=qs[_0x2036('0x1e')](_0x279d03[_0x2036('0x40')][_0x2036('0x1e')]);}return _0x393ffd[_0x2036('0xd0')](_0x117512);}})[_0x2036('0x11')](function(_0x1c1e5e){if(_0x1c1e5e){return _0x1c1e5e?{'count':_0x53676e,'rows':_0x1c1e5e}:null;}})['then'](respondWithResult(_0x2fd49d,null))[_0x2036('0x19')](handleError(_0x2fd49d,null));};exports[_0x2036('0xd3')]=function(_0x3f488e,_0x25b450){var _0x5b8ef4={'raw':!![],'where':{}};var _0x496a15={};var _0xc5614c={'count':0x0,'rows':[]};return db[_0x2036('0x35')][_0x2036('0x91')]({'where':{'id':_0x3f488e[_0x2036('0x5a')]['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x25b450,null))[_0x2036('0x11')](function(_0x632f66){if(_0x632f66){_0x496a15[_0x2036('0x4f')]=_[_0x2036('0x51')](db[_0x2036('0xd4')]['rawAttributes']);_0x496a15[_0x2036('0x40')]=_[_0x2036('0x51')](_0x3f488e[_0x2036('0x40')]);_0x496a15[_0x2036('0x52')]=_[_0x2036('0x53')](_0x496a15[_0x2036('0x4f')],_0x496a15['query']);_0x5b8ef4[_0x2036('0x43')]=_['intersection'](_0x496a15[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x3f488e[_0x2036('0x40')][_0x2036('0x54')]));_0x5b8ef4[_0x2036('0x43')]=_0x5b8ef4['attributes'][_0x2036('0x55')]?_0x5b8ef4['attributes']:_0x496a15[_0x2036('0x4f')];if(!_0x3f488e['query'][_0x2036('0xd2')]('nolimit')){_0x5b8ef4[_0x2036('0x20')]=qs['limit'](_0x3f488e['query'][_0x2036('0x20')]);_0x5b8ef4[_0x2036('0x1e')]=qs[_0x2036('0x1e')](_0x3f488e[_0x2036('0x40')][_0x2036('0x1e')]);}_0x5b8ef4[_0x2036('0xc2')]=qs[_0x2036('0xc3')](_0x3f488e[_0x2036('0x40')][_0x2036('0xc3')]);_0x5b8ef4[_0x2036('0x3d')]=qs['filters'](_[_0x2036('0xcd')](_0x3f488e['query'],_0x496a15['filters']));_0x5b8ef4[_0x2036('0x3d')]['UserId']=_0x632f66['id'];if(_0x3f488e['query'][_0x2036('0x39')]){_0x5b8ef4[_0x2036('0x3d')]=_[_0x2036('0x56')](_0x5b8ef4['where'],{'$or':_[_0x2036('0x2c')](_0x5b8ef4[_0x2036('0x43')],function(_0x12764c){var _0xf913dc={};_0xf913dc[_0x12764c]={'$like':'%'+_0x3f488e[_0x2036('0x40')][_0x2036('0x39')]+'%'};return _0xf913dc;})});}_0x5b8ef4=_[_0x2036('0x56')]({},_0x5b8ef4,_0x3f488e[_0x2036('0x57')]);return db['VoiceRecording'][_0x2036('0x21')]({'where':_0x5b8ef4[_0x2036('0x3d')]})[_0x2036('0x11')](function(_0x35612c){_0xc5614c['count']=_0x35612c;if(_0x3f488e[_0x2036('0x40')]['includeAll']){_0x5b8ef4[_0x2036('0x3f')]=[{'all':!![]}];}return db[_0x2036('0xd4')][_0x2036('0x45')](_0x5b8ef4);})[_0x2036('0x11')](function(_0x1c63e5){_0xc5614c[_0x2036('0x46')]=_0x1c63e5;return _0xc5614c;});}})[_0x2036('0x11')](respondWithFilteredResult(_0x25b450,_0x5b8ef4))[_0x2036('0x19')](handleError(_0x25b450,null));};exports[_0x2036('0xd5')]=function(_0x52804a,_0x5610c2){var _0x218679={'raw':!![],'where':{}};var _0x472cb6={};var _0x49da0b={'count':0x0,'rows':[]};return db[_0x2036('0x35')]['findOne']({'where':{'id':_0x52804a[_0x2036('0x5a')]['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x5610c2,null))[_0x2036('0x11')](function(_0x52fbd7){if(_0x52fbd7){_0x472cb6[_0x2036('0x4f')]=_[_0x2036('0x51')](db['ScreenRecording'][_0x2036('0x50')]);_0x472cb6[_0x2036('0x40')]=_['keys'](_0x52804a[_0x2036('0x40')]);_0x472cb6['filters']=_[_0x2036('0x53')](_0x472cb6[_0x2036('0x4f')],_0x472cb6['query']);_0x218679[_0x2036('0x43')]=_[_0x2036('0x53')](_0x472cb6[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x52804a[_0x2036('0x40')][_0x2036('0x54')]));_0x218679[_0x2036('0x43')]=_0x218679['attributes'][_0x2036('0x55')]?_0x218679[_0x2036('0x43')]:_0x472cb6[_0x2036('0x4f')];if(!_0x52804a[_0x2036('0x40')]['hasOwnProperty'](_0x2036('0xc9'))){_0x218679[_0x2036('0x20')]=qs[_0x2036('0x20')](_0x52804a[_0x2036('0x40')][_0x2036('0x20')]);_0x218679[_0x2036('0x1e')]=qs[_0x2036('0x1e')](_0x52804a['query']['offset']);}_0x218679[_0x2036('0xc2')]=qs[_0x2036('0xc3')](_0x52804a[_0x2036('0x40')][_0x2036('0xc3')]);_0x218679[_0x2036('0x3d')]=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x52804a[_0x2036('0x40')],_0x472cb6[_0x2036('0x52')]));_0x218679['where'][_0x2036('0xd6')]=_0x52fbd7['id'];if(_0x52804a[_0x2036('0x40')]['filter']){_0x218679[_0x2036('0x3d')]=_[_0x2036('0x56')](_0x218679['where'],{'$or':_['map'](_0x218679[_0x2036('0x43')],function(_0x1bc272){var _0x5f35aa={};_0x5f35aa[_0x1bc272]={'$like':'%'+_0x52804a[_0x2036('0x40')][_0x2036('0x39')]+'%'};return _0x5f35aa;})});}_0x218679=_['merge']({},_0x218679,_0x52804a[_0x2036('0x57')]);return db[_0x2036('0xd7')]['count']({'where':_0x218679['where']})[_0x2036('0x11')](function(_0x53cb82){_0x49da0b['count']=_0x53cb82;if(_0x52804a['query'][_0x2036('0x3e')]){_0x218679[_0x2036('0x3f')]=[{'all':!![]}];}return db['ScreenRecording'][_0x2036('0x45')](_0x218679);})[_0x2036('0x11')](function(_0x236fb8){_0x49da0b[_0x2036('0x46')]=_0x236fb8;return _0x49da0b;});}})['then'](respondWithFilteredResult(_0x5610c2,_0x218679))['catch'](handleError(_0x5610c2,null));};exports[_0x2036('0xd8')]=function(_0x335e49,_0x55bbd6){var _0x261f64={};var _0xa7f18={};var _0xe27480;var _0x37dd9c;return db[_0x2036('0x35')][_0x2036('0x91')]({'where':{'id':_0x335e49['params']['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x55bbd6,null))[_0x2036('0x11')](function(_0x53edd1){if(_0x53edd1){_0xe27480=_0x53edd1;_0xa7f18[_0x2036('0x4f')]=_[_0x2036('0x51')](db[_0x2036('0xd9')][_0x2036('0x50')]);_0xa7f18['query']=_['keys'](_0x335e49[_0x2036('0x40')]);_0xa7f18[_0x2036('0x52')]=_[_0x2036('0x53')](_0xa7f18[_0x2036('0x4f')],_0xa7f18[_0x2036('0x40')]);_0x261f64[_0x2036('0x43')]=_[_0x2036('0x53')](_0xa7f18[_0x2036('0x4f')],qs['fields'](_0x335e49['query']['fields']));_0x261f64[_0x2036('0x43')]=_0x261f64['attributes']['length']?_0x261f64[_0x2036('0x43')]:_0xa7f18[_0x2036('0x4f')];_0x261f64[_0x2036('0xc2')]=qs[_0x2036('0xc3')](_0x335e49[_0x2036('0x40')][_0x2036('0xc3')]);_0x261f64[_0x2036('0x3d')]=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x335e49[_0x2036('0x40')],_0xa7f18[_0x2036('0x52')]));if(_0x335e49[_0x2036('0x40')][_0x2036('0x39')]){_0x261f64[_0x2036('0x3d')]=_[_0x2036('0x56')](_0x261f64['where'],{'$or':_[_0x2036('0x2c')](_0x261f64[_0x2036('0x43')],function(_0x1e24f6){var _0x44c083={};_0x44c083[_0x1e24f6]={'$like':'%'+_0x335e49[_0x2036('0x40')][_0x2036('0x39')]+'%'};return _0x44c083;})});}_0x261f64=_[_0x2036('0x56')]({},_0x261f64,_0x335e49[_0x2036('0x57')]);return _0xe27480[_0x2036('0xd8')](_0x261f64);}})[_0x2036('0x11')](function(_0x1df25f){if(_0x1df25f){_0x37dd9c=_0x1df25f['length'];if(!_0x335e49[_0x2036('0x40')][_0x2036('0xd2')](_0x2036('0xc9'))){_0x261f64['limit']=qs[_0x2036('0x20')](_0x335e49[_0x2036('0x40')][_0x2036('0x20')]);_0x261f64[_0x2036('0x1e')]=qs['offset'](_0x335e49[_0x2036('0x40')]['offset']);}return _0xe27480[_0x2036('0xd8')](_0x261f64);}})['then'](function(_0x18d0b9){if(_0x18d0b9){return _0x18d0b9?{'count':_0x37dd9c,'rows':_0x18d0b9}:null;}})[_0x2036('0x11')](respondWithResult(_0x55bbd6,null))[_0x2036('0x19')](handleError(_0x55bbd6,null));};exports['getOpenchannelInteractions']=function(_0x3d2ff6,_0x22c48d){var _0x246a92={};var _0x71dba1={};var _0x353bdb;var _0x465ad7;return db[_0x2036('0x35')][_0x2036('0x91')]({'where':{'id':_0x3d2ff6[_0x2036('0x5a')]['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x22c48d,null))['then'](function(_0x5d7c5d){if(_0x5d7c5d){_0x353bdb=_0x5d7c5d;_0x71dba1[_0x2036('0x4f')]=_[_0x2036('0x51')](db[_0x2036('0xda')][_0x2036('0x50')]);_0x71dba1['query']=_[_0x2036('0x51')](_0x3d2ff6['query']);_0x71dba1['filters']=_['intersection'](_0x71dba1[_0x2036('0x4f')],_0x71dba1[_0x2036('0x40')]);_0x246a92[_0x2036('0x43')]=_[_0x2036('0x53')](_0x71dba1['model'],qs[_0x2036('0x54')](_0x3d2ff6['query'][_0x2036('0x54')]));_0x246a92['attributes']=_0x246a92['attributes']['length']?_0x246a92['attributes']:_0x71dba1[_0x2036('0x4f')];_0x246a92[_0x2036('0xc2')]=qs[_0x2036('0xc3')](_0x3d2ff6[_0x2036('0x40')][_0x2036('0xc3')]);_0x246a92[_0x2036('0x3d')]=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x3d2ff6[_0x2036('0x40')],_0x71dba1[_0x2036('0x52')]));if(_0x3d2ff6[_0x2036('0x40')][_0x2036('0x39')]){_0x246a92[_0x2036('0x3d')]=_[_0x2036('0x56')](_0x246a92[_0x2036('0x3d')],{'$or':_[_0x2036('0x2c')](_0x246a92['attributes'],function(_0x1fd5f5){var _0x478c64={};_0x478c64[_0x1fd5f5]={'$like':'%'+_0x3d2ff6[_0x2036('0x40')][_0x2036('0x39')]+'%'};return _0x478c64;})});}_0x246a92=_['merge']({},_0x246a92,_0x3d2ff6['options']);return _0x353bdb[_0x2036('0xdb')](_0x246a92);}})['then'](function(_0x30ef64){if(_0x30ef64){_0x465ad7=_0x30ef64[_0x2036('0x55')];if(!_0x3d2ff6[_0x2036('0x40')][_0x2036('0xd2')]('nolimit')){_0x246a92[_0x2036('0x20')]=qs[_0x2036('0x20')](_0x3d2ff6[_0x2036('0x40')][_0x2036('0x20')]);_0x246a92[_0x2036('0x1e')]=qs[_0x2036('0x1e')](_0x3d2ff6[_0x2036('0x40')][_0x2036('0x1e')]);}return _0x353bdb['getOpenchannelInteractions'](_0x246a92);}})[_0x2036('0x11')](function(_0x3baee6){if(_0x3baee6){return _0x3baee6?{'count':_0x465ad7,'rows':_0x3baee6}:null;}})[_0x2036('0x11')](respondWithResult(_0x22c48d,null))['catch'](handleError(_0x22c48d,null));};exports[_0x2036('0xdc')]=function(_0x297405,_0x1bc814){var _0x379d86={'raw':!![],'where':{}};var _0x188653={};var _0x3e6105={'count':0x0,'rows':[]};return db[_0x2036('0x35')][_0x2036('0x91')]({'where':{'id':_0x297405['params']['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x1bc814,null))[_0x2036('0x11')](function(_0x1f7f7b){if(_0x1f7f7b){_0x188653[_0x2036('0x4f')]=_['keys'](db['MailInteraction'][_0x2036('0x50')]);_0x188653[_0x2036('0x40')]=_['keys'](_0x297405[_0x2036('0x40')]);_0x188653[_0x2036('0x52')]=_[_0x2036('0x53')](_0x188653[_0x2036('0x4f')],_0x188653[_0x2036('0x40')]);_0x379d86[_0x2036('0x43')]=_[_0x2036('0x53')](_0x188653['model'],qs[_0x2036('0x54')](_0x297405['query'][_0x2036('0x54')]));_0x379d86[_0x2036('0x43')]=_0x379d86[_0x2036('0x43')][_0x2036('0x55')]?_0x379d86['attributes']:_0x188653[_0x2036('0x4f')];if(!_0x297405[_0x2036('0x40')][_0x2036('0xd2')](_0x2036('0xc9'))){_0x379d86[_0x2036('0x20')]=qs[_0x2036('0x20')](_0x297405[_0x2036('0x40')][_0x2036('0x20')]);_0x379d86[_0x2036('0x1e')]=qs[_0x2036('0x1e')](_0x297405['query']['offset']);}_0x379d86[_0x2036('0xc2')]=qs['sort'](_0x297405[_0x2036('0x40')][_0x2036('0xc3')]);_0x379d86[_0x2036('0x3d')]=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x297405[_0x2036('0x40')],_0x188653[_0x2036('0x52')]));_0x379d86[_0x2036('0x3d')][_0x2036('0xd6')]=_0x1f7f7b['id'];if(_0x297405[_0x2036('0x40')][_0x2036('0x39')]){_0x379d86[_0x2036('0x3d')]=_['merge'](_0x379d86[_0x2036('0x3d')],{'$or':_[_0x2036('0x2c')](_0x379d86[_0x2036('0x43')],function(_0x37f335){var _0x3bcf4c={};_0x3bcf4c[_0x37f335]={'$like':'%'+_0x297405[_0x2036('0x40')][_0x2036('0x39')]+'%'};return _0x3bcf4c;})});}_0x379d86=_[_0x2036('0x56')]({},_0x379d86,_0x297405[_0x2036('0x57')]);return db['MailInteraction'][_0x2036('0x21')]({'where':_0x379d86[_0x2036('0x3d')]})[_0x2036('0x11')](function(_0x533a5f){_0x3e6105['count']=_0x533a5f;if(_0x297405[_0x2036('0x40')]['includeAll']){_0x379d86[_0x2036('0x3f')]=[{'all':!![]}];}return db[_0x2036('0xdd')][_0x2036('0x45')](_0x379d86);})[_0x2036('0x11')](function(_0x1ed4bc){_0x3e6105[_0x2036('0x46')]=_0x1ed4bc;return _0x3e6105;});}})[_0x2036('0x11')](respondWithFilteredResult(_0x1bc814,_0x379d86))[_0x2036('0x19')](handleError(_0x1bc814,null));};exports[_0x2036('0xde')]=function(_0x5c91f0,_0x45de14){var _0x1b2b4c={};var _0x495380={};var _0x214852;var _0x4a027f;return db[_0x2036('0x35')][_0x2036('0x91')]({'where':{'id':_0x5c91f0[_0x2036('0x5a')]['id']}})['then'](handleEntityNotFound(_0x45de14,null))[_0x2036('0x11')](function(_0x449fa5){if(_0x449fa5){_0x214852=_0x449fa5;_0x495380[_0x2036('0x4f')]=_[_0x2036('0x51')](db[_0x2036('0xdf')]['rawAttributes']);_0x495380[_0x2036('0x40')]=_[_0x2036('0x51')](_0x5c91f0[_0x2036('0x40')]);_0x495380[_0x2036('0x52')]=_[_0x2036('0x53')](_0x495380[_0x2036('0x4f')],_0x495380['query']);_0x1b2b4c[_0x2036('0x43')]=_['intersection'](_0x495380[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x5c91f0[_0x2036('0x40')][_0x2036('0x54')]));_0x1b2b4c['attributes']=_0x1b2b4c['attributes'][_0x2036('0x55')]?_0x1b2b4c[_0x2036('0x43')]:_0x495380['model'];_0x1b2b4c[_0x2036('0xc2')]=qs['sort'](_0x5c91f0[_0x2036('0x40')][_0x2036('0xc3')]);_0x1b2b4c[_0x2036('0x3d')]=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x5c91f0[_0x2036('0x40')],_0x495380['filters']));if(_0x5c91f0[_0x2036('0x40')]['filter']){_0x1b2b4c[_0x2036('0x3d')]=_[_0x2036('0x56')](_0x1b2b4c[_0x2036('0x3d')],{'$or':_[_0x2036('0x2c')](_0x1b2b4c['attributes'],function(_0x192fc0){var _0x5a6656={};_0x5a6656[_0x192fc0]={'$like':'%'+_0x5c91f0[_0x2036('0x40')][_0x2036('0x39')]+'%'};return _0x5a6656;})});}_0x1b2b4c=_[_0x2036('0x56')]({},_0x1b2b4c,_0x5c91f0[_0x2036('0x57')]);return _0x214852[_0x2036('0xde')](_0x1b2b4c);}})[_0x2036('0x11')](function(_0x1d3948){if(_0x1d3948){_0x4a027f=_0x1d3948[_0x2036('0x55')];if(!_0x5c91f0[_0x2036('0x40')][_0x2036('0xd2')](_0x2036('0xc9'))){_0x1b2b4c[_0x2036('0x20')]=qs[_0x2036('0x20')](_0x5c91f0[_0x2036('0x40')][_0x2036('0x20')]);_0x1b2b4c['offset']=qs[_0x2036('0x1e')](_0x5c91f0['query'][_0x2036('0x1e')]);}return _0x214852[_0x2036('0xde')](_0x1b2b4c);}})[_0x2036('0x11')](function(_0x4c0ed2){if(_0x4c0ed2){return _0x4c0ed2?{'count':_0x4a027f,'rows':_0x4c0ed2}:null;}})['then'](respondWithResult(_0x45de14,null))[_0x2036('0x19')](handleError(_0x45de14,null));};exports[_0x2036('0xe0')]=function(_0x2866ce,_0x52de48){var _0x2f0d64={};var _0x4d69b1={};var _0xa3b3c8;var _0x5e14bf;return db[_0x2036('0x35')][_0x2036('0x91')]({'where':{'id':_0x2866ce['params']['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x52de48,null))[_0x2036('0x11')](function(_0x5322a1){if(_0x5322a1){_0xa3b3c8=_0x5322a1;_0x4d69b1['model']=_[_0x2036('0x51')](db[_0x2036('0xe1')][_0x2036('0x50')]);_0x4d69b1[_0x2036('0x40')]=_[_0x2036('0x51')](_0x2866ce['query']);_0x4d69b1[_0x2036('0x52')]=_['intersection'](_0x4d69b1['model'],_0x4d69b1[_0x2036('0x40')]);_0x2f0d64[_0x2036('0x43')]=_[_0x2036('0x53')](_0x4d69b1[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x2866ce[_0x2036('0x40')][_0x2036('0x54')]));_0x2f0d64[_0x2036('0x43')]=_0x2f0d64['attributes'][_0x2036('0x55')]?_0x2f0d64[_0x2036('0x43')]:_0x4d69b1[_0x2036('0x4f')];_0x2f0d64[_0x2036('0xc2')]=qs[_0x2036('0xc3')](_0x2866ce[_0x2036('0x40')]['sort']);_0x2f0d64[_0x2036('0x3d')]=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x2866ce[_0x2036('0x40')],_0x4d69b1[_0x2036('0x52')]));if(_0x2866ce[_0x2036('0x40')]['filter']){_0x2f0d64[_0x2036('0x3d')]=_['merge'](_0x2f0d64['where'],{'$or':_[_0x2036('0x2c')](_0x2f0d64[_0x2036('0x43')],function(_0x10fce2){var _0x182ac3={};_0x182ac3[_0x10fce2]={'$like':'%'+_0x2866ce[_0x2036('0x40')][_0x2036('0x39')]+'%'};return _0x182ac3;})});}_0x2f0d64=_['merge']({},_0x2f0d64,_0x2866ce[_0x2036('0x57')]);return _0xa3b3c8[_0x2036('0xe0')](_0x2f0d64);}})[_0x2036('0x11')](function(_0xa3cb76){if(_0xa3cb76){_0x5e14bf=_0xa3cb76[_0x2036('0x55')];if(!_0x2866ce[_0x2036('0x40')][_0x2036('0xd2')]('nolimit')){_0x2f0d64[_0x2036('0x20')]=qs[_0x2036('0x20')](_0x2866ce[_0x2036('0x40')][_0x2036('0x20')]);_0x2f0d64['offset']=qs[_0x2036('0x1e')](_0x2866ce['query'][_0x2036('0x1e')]);}return _0xa3b3c8[_0x2036('0xe0')](_0x2f0d64);}})[_0x2036('0x11')](function(_0x482a8d){if(_0x482a8d){return _0x482a8d?{'count':_0x5e14bf,'rows':_0x482a8d}:null;}})[_0x2036('0x11')](respondWithResult(_0x52de48,null))[_0x2036('0x19')](handleError(_0x52de48,null));};exports[_0x2036('0xe2')]=function(_0x1b8dd6,_0x356ed9){var _0x2a5d9b={};var _0x3857e8={};var _0x21ceca;var _0x3b1920;return db[_0x2036('0x35')][_0x2036('0x91')]({'where':{'id':_0x1b8dd6[_0x2036('0x5a')]['id']}})['then'](handleEntityNotFound(_0x356ed9,null))['then'](function(_0x25909e){if(_0x25909e){_0x21ceca=_0x25909e;_0x3857e8[_0x2036('0x4f')]=_[_0x2036('0x51')](db[_0x2036('0xe3')][_0x2036('0x50')]);_0x3857e8[_0x2036('0x40')]=_[_0x2036('0x51')](_0x1b8dd6[_0x2036('0x40')]);_0x3857e8[_0x2036('0x52')]=_[_0x2036('0x53')](_0x3857e8['model'],_0x3857e8['query']);_0x2a5d9b[_0x2036('0x43')]=_[_0x2036('0x53')](_0x3857e8[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x1b8dd6[_0x2036('0x40')][_0x2036('0x54')]));_0x2a5d9b[_0x2036('0x43')]=_0x2a5d9b['attributes']['length']?_0x2a5d9b[_0x2036('0x43')]:_0x3857e8[_0x2036('0x4f')];_0x2a5d9b[_0x2036('0xc2')]=qs[_0x2036('0xc3')](_0x1b8dd6[_0x2036('0x40')][_0x2036('0xc3')]);_0x2a5d9b[_0x2036('0x3d')]=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x1b8dd6['query'],_0x3857e8[_0x2036('0x52')]));if(_0x1b8dd6['query']['filter']){_0x2a5d9b[_0x2036('0x3d')]=_[_0x2036('0x56')](_0x2a5d9b['where'],{'$or':_['map'](_0x2a5d9b['attributes'],function(_0x4e8c67){var _0x32e468={};_0x32e468[_0x4e8c67]={'$like':'%'+_0x1b8dd6['query'][_0x2036('0x39')]+'%'};return _0x32e468;})});}_0x2a5d9b=_['merge']({},_0x2a5d9b,_0x1b8dd6[_0x2036('0x57')]);return _0x21ceca[_0x2036('0xe2')](_0x2a5d9b);}})[_0x2036('0x11')](function(_0x3d8862){if(_0x3d8862){_0x3b1920=_0x3d8862[_0x2036('0x55')];if(!_0x1b8dd6[_0x2036('0x40')][_0x2036('0xd2')](_0x2036('0xc9'))){_0x2a5d9b['limit']=qs['limit'](_0x1b8dd6[_0x2036('0x40')][_0x2036('0x20')]);_0x2a5d9b[_0x2036('0x1e')]=qs['offset'](_0x1b8dd6[_0x2036('0x40')][_0x2036('0x1e')]);}return _0x21ceca['getWhatsappInteractions'](_0x2a5d9b);}})[_0x2036('0x11')](function(_0x297d80){if(_0x297d80){return _0x297d80?{'count':_0x3b1920,'rows':_0x297d80}:null;}})[_0x2036('0x11')](respondWithResult(_0x356ed9,null))[_0x2036('0x19')](handleError(_0x356ed9,null));};exports[_0x2036('0xe4')]=function(_0x899f34,_0x28ee46,_0x29d879){var _0x4b0d32;var _0x5de1f7;var _0x19881c;var _0x2fb79=!_[_0x2036('0x62')](_0x899f34[_0x2036('0x5a')]['id'])?_0x899f34[_0x2036('0x5a')]['id']:!_[_0x2036('0x62')](_0x899f34[_0x2036('0x29')]['id'])?_0x899f34['user']['id']:null;return db[_0x2036('0x35')]['find']({'where':{'id':_0x2fb79,'role':{'$or':[_0x2036('0x27'),_0x2036('0x29'),_0x2036('0x2a')]}},'attributes':['id',_0x2036('0x32'),_0x2036('0xe5'),_0x2036('0xe6'),'role',_0x2036('0x5d'),_0x2036('0xe7')]})[_0x2036('0x11')](function(_0x2683e2){if(_0x2683e2){if(_0x2683e2[_0x2036('0x26')]===_0x2036('0x2a')){_0x4b0d32=_0x2683e2;if(_0x899f34[_0x2036('0x59')][_0x2036('0xa5')]){_0x19881c=util[_0x2036('0xa6')](_0x2036('0xe8'),_0x4b0d32[_0x899f34[_0x2036('0x59')]['interface']]);}else if(_0x899f34['body'][_0x2036('0xe9')]){_0x19881c=util[_0x2036('0xa6')]('SIP/%s',_0x899f34['body'][_0x2036('0xe9')]);}else{_0x19881c=util[_0x2036('0xa6')]('SIP/%s',_0x4b0d32[_0x2036('0x32')]);}socket['to'](util[_0x2036('0xa6')](_0x2036('0xea'),_0x4b0d32[_0x2036('0x32')]))['emit'](_0x2036('0xeb'),{'user':{'id':_0x4b0d32['id'],'name':_0x4b0d32[_0x2036('0x32')]},'ip':_0x899f34[_0x2036('0xec')][_0x2036('0xed')]||_0x899f34[_0x2036('0xee')][_0x2036('0xef')]||_0x899f34[_0x2036('0xf0')][_0x2036('0xef')]||_0x899f34[_0x2036('0xee')][_0x2036('0xf0')][_0x2036('0xef')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x4b0d32[_0x2036('0x32')]},'individualHooks':!![]});}}else{throw new db[(_0x2036('0x8f'))][(_0x2036('0x8c'))](_0x2036('0xf1'));}})[_0x2036('0x11')](function(){if(_0x4b0d32){return _0x4b0d32['getVoiceQueues']({'raw':!![]});}})[_0x2036('0x11')](function(_0x1b0025){if(_0x4b0d32){var _0x42039d=[];if(_0x1b0025){_0x5de1f7=_0x1b0025;if(_0x5de1f7['length']){for(var _0x40f6a2=0x0;_0x40f6a2<_0x5de1f7['length'];_0x40f6a2++){_0x42039d[_0x2036('0x44')]({'membername':_0x4b0d32['name'],'UserId':_0x4b0d32['id'],'queue_name':_0x5de1f7[_0x40f6a2][_0x2036('0x32')],'VoiceQueueId':_0x5de1f7[_0x40f6a2]['id'],'interface':_0x19881c,'paused':_0x4b0d32['loginInPause']||![],'penalty':_0x5de1f7[_0x40f6a2][_0x2036('0xf2')]||0x0});}return BPromise['each'](_0x42039d,function(_0x19d614){return db['UserVoiceQueueRt']['upsert'](_0x19d614);});}}}})[_0x2036('0x11')](function(){if(_0x4b0d32){return db[_0x2036('0xf3')]['findAll']({'where':{'membername':_0x4b0d32[_0x2036('0x32')],'exitAt':null}});}})[_0x2036('0x11')](function(_0x562ac7){if(_0x4b0d32){var _0x34629b=[];_0x562ac7[_0x2036('0xf4')](function(_0x18b523){_0x34629b[_0x2036('0x44')](_0x18b523[_0x2036('0x23')]({'exitAt':moment()[_0x2036('0xa6')](_0x2036('0xf5'))}));});return BPromise[_0x2036('0x4e')](_0x34629b);}})[_0x2036('0x11')](function(){if(_0x4b0d32){var _0x41b9d0=[];var _0x5f2a03=[];var _0x228e42=utils[_0x2036('0xf6')]();var _0x2a2258={'membername':_0x4b0d32[_0x2036('0x32')],'interface':_0x19881c,'enterAt':moment()[_0x2036('0xa6')](_0x2036('0xf5')),'role':_0x4b0d32[_0x2036('0x26')],'internal':_0x4b0d32['internal']};_0x228e42[_0x2036('0xf4')](function(_0x5cebdc){_0x41b9d0[_0x2036('0x44')](_['merge']({'channel':_0x5cebdc,'type':_0x2036('0xf7'),'data1':_0x899f34['body'][_0x2036('0xf8')],'data2':_0x19881c},_0x2a2258));if(_0x4b0d32[_0x2036('0xe7')]){_0x5f2a03[_0x2036('0x44')](_[_0x2036('0x56')]({'channel':_0x5cebdc,'type':_0x2036('0xf9'),'data1':_0x2036('0xfa')},_0x2a2258));}});return db[_0x2036('0xf3')]['bulkCreate'](_0x41b9d0[_0x2036('0xfb')](_0x5f2a03),{'individualHooks':!![]});}})[_0x2036('0x11')](function(){if(_0x4b0d32){return _0x4b0d32[_0x2036('0x23')]({'online':!![],'lastLoginAt':moment()[_0x2036('0xa6')](_0x2036('0xf5')),'voicePause':_0x4b0d32[_0x2036('0xe7')]||![],'mailPause':_0x4b0d32['loginInPause']||![],'chatPause':_0x4b0d32[_0x2036('0xe7')]||![],'faxPause':_0x4b0d32[_0x2036('0xe7')]||![],'smsPause':_0x4b0d32[_0x2036('0xe7')]||![],'openchannelPause':_0x4b0d32['loginInPause']||![],'whatsappPause':_0x4b0d32[_0x2036('0xe7')]||![],'pauseType':_0x4b0d32['loginInPause']?_0x2036('0xfa'):null,'interface':_0x19881c,'lastPauseAt':moment()['format'](_0x2036('0xf5'))});}})[_0x2036('0x11')](function(_0x457287){if(_0x899f34['isMiddleware']){return _0x29d879();}else{return BPromise[_0x2036('0xfc')](_0x457287)[_0x2036('0x11')](respondWithResult(_0x28ee46,null));}})[_0x2036('0x19')](handleError(_0x28ee46,null));};exports[_0x2036('0xfd')]=function(_0x24a0c0,_0x45d0d0){var _0x108660;return db[_0x2036('0x35')][_0x2036('0x2f')]({'where':{'id':_0x24a0c0[_0x2036('0x5a')]['id'],'role':'agent'},'attributes':['id',_0x2036('0x32'),_0x2036('0x26')]})[_0x2036('0x11')](handleEntityNotFound(_0x45d0d0,null))[_0x2036('0x11')](function(_0x2bed27){if(_0x2bed27){_0x108660=_0x2bed27;return db['UserVoiceQueueRt'][_0x2036('0x24')]({'where':{'membername':_0x108660[_0x2036('0x32')]},'individualHooks':!![]});}})[_0x2036('0x11')](function(){return db[_0x2036('0xf3')]['findAll']({'where':{'membername':_0x108660[_0x2036('0x32')],'exitAt':null}});})[_0x2036('0x11')](function(_0x1ca5c3){var _0xe9c66a=[];_0x1ca5c3[_0x2036('0xf4')](function(_0x2e6a3b){_0xe9c66a[_0x2036('0x44')](_0x2e6a3b[_0x2036('0x23')]({'exitAt':moment()[_0x2036('0xa6')](_0x2036('0xf5'))}));});return BPromise[_0x2036('0x4e')](_0xe9c66a);})[_0x2036('0x11')](function(){return _0x108660['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2036('0x11')](respondWithResult(_0x45d0d0,null))[_0x2036('0x19')](handleError(_0x45d0d0,null));};exports[_0x2036('0xfe')]=function(_0x1e4349,_0x3bf190){var _0x4387e1;return db[_0x2036('0xa8')][_0x2036('0x23')]({'paused':0x1},{'where':{'UserId':_0x1e4349[_0x2036('0x5a')]['id']},'individualHooks':!![]})[_0x2036('0x11')](function(){return db[_0x2036('0x35')][_0x2036('0x2f')]({'where':{'id':_0x1e4349[_0x2036('0x5a')]['id'],'role':'agent'},'attributes':['id','name','role','internal',_0x2036('0xa5')]});})[_0x2036('0x11')](handleEntityNotFound(_0x3bf190,null))[_0x2036('0x11')](function(_0x565b2d){if(_0x565b2d){_0x4387e1=_0x565b2d;return respondWithRpcPromise(_0x2036('0xff'),'pause',{'id':_0x4387e1['id'],'name':_0x4387e1[_0x2036('0x32')],'pause':!![]});}})[_0x2036('0x11')](function(){if(_0x4387e1){return db[_0x2036('0xf3')]['findAll']({'where':{'membername':_0x4387e1[_0x2036('0x32')],'type':'PAUSE','exitAt':null}});}})[_0x2036('0x11')](function(_0x433651){if(_0x433651['length']){var _0x1d0254=moment()[_0x2036('0xa6')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x117f5f=0x0,_0x1a9af6=_0x433651[_0x2036('0x55')];_0x117f5f<_0x1a9af6;_0x117f5f++){_0x433651[_0x117f5f]['updateAttributes']({'exitAt':_0x1d0254});}}})['then'](function(){var _0x1aa05f=[];var _0x1faccd=utils[_0x2036('0xf6')]();_0x1faccd['forEach'](function(_0xe94ece){_0x1aa05f['push']({'channel':_0xe94ece,'membername':_0x4387e1[_0x2036('0x32')],'interface':_[_0x2036('0x62')](_0x4387e1[_0x2036('0xa5')])?util['format']('SIP/%s',_0x4387e1[_0x2036('0x32')]):_0x4387e1[_0x2036('0xa5')],'type':_0x2036('0xf9'),'enterAt':moment()[_0x2036('0xa6')](_0x2036('0xf5')),'data1':_0x1e4349[_0x2036('0x59')][_0x2036('0x37')]||_0x2036('0x100'),'role':_0x4387e1[_0x2036('0x26')],'internal':_0x4387e1[_0x2036('0x5d')]});});return db[_0x2036('0xf3')][_0x2036('0x101')](_0x1aa05f,{'individualHooks':!![]});})[_0x2036('0x11')](function(){return _0x4387e1[_0x2036('0x23')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1e4349[_0x2036('0x59')]['type']||_0x2036('0x100'),'lastPauseAt':moment()[_0x2036('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2036('0x11')](respondWithResult(_0x3bf190,null))['catch'](handleError(_0x3bf190,null));};exports[_0x2036('0x102')]=function(_0x1860f0,_0x35b014){var _0x76dc98;return db['User'][_0x2036('0x2f')]({'where':{'id':_0x1860f0['params']['id']},'attributes':['id',_0x2036('0x32'),_0x2036('0x26'),_0x2036('0x9a'),_0x2036('0x103'),'chatPause',_0x2036('0x104'),_0x2036('0x105'),'smsPause','whatsapppause',_0x2036('0x106'),_0x2036('0x107')]})[_0x2036('0x11')](handleEntityNotFound(_0x35b014,null))[_0x2036('0x11')](function(_0x1ca5c8){if(_0x1ca5c8){_0x76dc98=_0x1ca5c8;if(_0x1860f0[_0x2036('0x59')]['channel']&&!utils[_0x2036('0x9b')](_0x1860f0['body'][_0x2036('0x98')])){throw new db[(_0x2036('0x8f'))][(_0x2036('0x8c'))](_0x2036('0xaa'));}switch(_0x1860f0[_0x2036('0x59')][_0x2036('0x98')]){case _0x2036('0xa4'):return respondWithRpcPromise(_0x2036('0xff'),_0x2036('0x102'),{'id':_0x76dc98['id'],'name':_0x76dc98[_0x2036('0x32')],'pause':![]})['then'](function(){return db[_0x2036('0xa8')][_0x2036('0x23')]({'paused':0x0},{'where':{'UserId':_0x76dc98['id']},'individualHooks':!![]});})[_0x2036('0x11')](function(){return db['MemberReport'][_0x2036('0x2f')]({'where':{'channel':_0x1860f0['body']['channel'],'membername':_0x76dc98[_0x2036('0x32')],'type':_0x2036('0xf9'),'exitAt':null}});})[_0x2036('0x11')](function(_0x41ac44){if(_0x41ac44){return _0x41ac44[_0x2036('0x23')]({'exitAt':moment()[_0x2036('0xa6')](_0x2036('0xf5')),'data2':_0x2036('0x108')},{'individualHooks':!![]});}return null;})[_0x2036('0x11')](function(){return _0x76dc98[_0x2036('0x23')]({'voicePause':![]});});case _0x2036('0x4c'):case _0x2036('0x49'):case'fax':case _0x2036('0xb7'):case _0x2036('0x4d'):case _0x2036('0x58'):return db[_0x2036('0xf3')]['find']({'where':{'channel':_0x1860f0[_0x2036('0x59')][_0x2036('0x98')],'membername':_0x76dc98['name'],'type':_0x2036('0xf9'),'exitAt':null}})[_0x2036('0x11')](function(_0xc498ac){if(_0xc498ac){return _0xc498ac[_0x2036('0x23')]({'exitAt':moment()[_0x2036('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2036('0x108')},{'individualHooks':!![]});}return null;})[_0x2036('0x11')](function(){var _0x40880c={};_[_0x2036('0x109')](_0x40880c,util['format'](_0x2036('0x10a'),_0x1860f0[_0x2036('0x59')][_0x2036('0x98')],_0x2036('0x10b')),![]);return _0x76dc98[_0x2036('0x23')](_0x40880c);});default:return respondWithRpcPromise('QueuePause',_0x2036('0x102'),{'id':_0x76dc98['id'],'name':_0x76dc98[_0x2036('0x32')],'pause':![]})[_0x2036('0x11')](function(){return db[_0x2036('0xa8')][_0x2036('0x23')]({'paused':0x0},{'where':{'UserId':_0x76dc98['id']}});})[_0x2036('0x11')](function(){return db[_0x2036('0xf3')][_0x2036('0x45')]({'where':{'membername':_0x76dc98[_0x2036('0x32')],'type':'PAUSE','exitAt':null}});})[_0x2036('0x11')](function(_0x1a3305){var _0x1c1be9=[];_0x1a3305[_0x2036('0xf4')](function(_0x43ab6f){_0x1c1be9[_0x2036('0x44')](_0x43ab6f[_0x2036('0x23')]({'exitAt':moment()[_0x2036('0xa6')](_0x2036('0xf5')),'data2':'manual'}));});return BPromise[_0x2036('0x4e')](_0x1c1be9);})[_0x2036('0x11')](function(){return _0x76dc98[_0x2036('0x23')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x2036('0x11')](respondWithResult(_0x35b014,null))[_0x2036('0x19')](handleError(_0x35b014,null));};exports[_0x2036('0x10c')]=function(_0x360f3a,_0x2a29d1){var _0xbf0445={};var _0x111e17={};var _0xddcc49;var _0x218f07;return db['User'][_0x2036('0x91')]({'where':{'id':_0x360f3a['params']['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x2a29d1,null))['then'](function(_0x2d7934){if(_0x2d7934){_0xddcc49=_0x2d7934;_0x111e17[_0x2036('0x4f')]=_[_0x2036('0x51')](db[_0x2036('0x10d')][_0x2036('0x50')]);_0x111e17[_0x2036('0x40')]=_[_0x2036('0x51')](_0x360f3a['query']);_0x111e17[_0x2036('0x52')]=_[_0x2036('0x53')](_0x111e17['model'],_0x111e17[_0x2036('0x40')]);_0xbf0445[_0x2036('0x43')]=_[_0x2036('0x53')](_0x111e17[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x360f3a[_0x2036('0x40')][_0x2036('0x54')]));_0xbf0445[_0x2036('0x43')]=_0xbf0445[_0x2036('0x43')][_0x2036('0x55')]?_0xbf0445[_0x2036('0x43')]:_0x111e17[_0x2036('0x4f')];_0xbf0445['order']=qs[_0x2036('0xc3')](_0x360f3a[_0x2036('0x40')]['sort']);_0xbf0445[_0x2036('0x3d')]=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x360f3a['query'],_0x111e17[_0x2036('0x52')]));if(_0x360f3a[_0x2036('0x40')][_0x2036('0x39')]){_0xbf0445[_0x2036('0x3d')]=_[_0x2036('0x56')](_0xbf0445[_0x2036('0x3d')],{'$or':_[_0x2036('0x2c')](_0xbf0445['attributes'],function(_0x42686b){var _0x579cf2={};_0x579cf2[_0x42686b]={'$like':'%'+_0x360f3a[_0x2036('0x40')]['filter']+'%'};return _0x579cf2;})});}_0xbf0445=_[_0x2036('0x56')]({},_0xbf0445,_0x360f3a[_0x2036('0x57')]);return _0xddcc49[_0x2036('0x10c')](_0xbf0445);}})[_0x2036('0x11')](function(_0x340567){if(_0x340567){_0x218f07=_0x340567[_0x2036('0x55')];if(!_0x360f3a['query'][_0x2036('0xd2')](_0x2036('0xc9'))){_0xbf0445[_0x2036('0x20')]=qs[_0x2036('0x20')](_0x360f3a['query'][_0x2036('0x20')]);_0xbf0445[_0x2036('0x1e')]=qs[_0x2036('0x1e')](_0x360f3a['query'][_0x2036('0x1e')]);}return _0xddcc49[_0x2036('0x10c')](_0xbf0445);}})[_0x2036('0x11')](function(_0x529fa5){if(_0x529fa5){return _0x529fa5?{'count':_0x218f07,'rows':_0x529fa5}:null;}})[_0x2036('0x11')](respondWithResult(_0x2a29d1,null))[_0x2036('0x19')](handleError(_0x2a29d1,null));};exports['addTeams']=function(_0x56698a,_0x31077c){return db[_0x2036('0x35')][_0x2036('0x2f')]({'where':{'id':_0x56698a[_0x2036('0x5a')]['id']}})['then'](handleEntityNotFound(_0x31077c,null))['then'](function(_0x58a5b1){if(_0x58a5b1){var _0x2e5b51=_0x58a5b1[_0x2036('0x25')]({'plain':!![]});return _0x58a5b1[_0x2036('0x10e')](_0x56698a[_0x2036('0x59')][_0x2036('0x9d')],_[_0x2036('0x5c')](_0x56698a[_0x2036('0x59')],[_0x2036('0x9d'),'id'])||{})['then'](function(){for(var _0x2dbd1d=0x0;_0x2dbd1d<_0x56698a[_0x2036('0x59')][_0x2036('0x9d')][_0x2036('0x55')];_0x2dbd1d++){var _0x2f43ff=[];var _0x38108a={};db[_0x2036('0x10d')]['findOne']({'where':{'id':_0x56698a[_0x2036('0x59')]['ids'][_0x2dbd1d]}})['then'](function(_0x46d02e){_0x38108a=_0x46d02e['dataValues'];_0x2f43ff[_0x2036('0x44')](_0x46d02e['getVoiceQueues']()['then'](function(_0x27a5f8){for(var _0x3a1430=0x0;_0x3a1430<_0x27a5f8[_0x2036('0x55')];_0x3a1430++){_0x27a5f8[_0x3a1430][_0x2036('0x10f')]('channel',_0x2036('0x110'));}return _0x27a5f8;}));_0x2f43ff[_0x2036('0x44')](_0x46d02e[_0x2036('0x111')]()[_0x2036('0x11')](function(_0x470394){for(var _0x156358=0x0;_0x156358<_0x470394[_0x2036('0x55')];_0x156358++){_0x470394[_0x156358][_0x2036('0x10f')](_0x2036('0x98'),_0x2036('0x112'));}return _0x470394;}));_0x2f43ff['push'](_0x46d02e[_0x2036('0x113')]()['then'](function(_0x17f555){for(var _0x77a0d5=0x0;_0x77a0d5<_0x17f555[_0x2036('0x55')];_0x77a0d5++){_0x17f555[_0x77a0d5][_0x2036('0x10f')](_0x2036('0x98'),_0x2036('0x114'));}return _0x17f555;}));_0x2f43ff[_0x2036('0x44')](_0x46d02e['getSmsQueues']()['then'](function(_0x38cf75){for(var _0x2490d2=0x0;_0x2490d2<_0x38cf75[_0x2036('0x55')];_0x2490d2++){_0x38cf75[_0x2490d2][_0x2036('0x10f')]('channel',_0x2036('0x115'));}return _0x38cf75;}));_0x2f43ff[_0x2036('0x44')](_0x46d02e[_0x2036('0x116')]()[_0x2036('0x11')](function(_0x56a26a){for(var _0x18fc11=0x0;_0x18fc11<_0x56a26a[_0x2036('0x55')];_0x18fc11++){_0x56a26a[_0x18fc11]['setDataValue'](_0x2036('0x98'),_0x2036('0x117'));}return _0x56a26a;}));_0x2f43ff[_0x2036('0x44')](_0x46d02e['getFaxQueues']()[_0x2036('0x11')](function(_0x35d435){for(var _0x12e52e=0x0;_0x12e52e<_0x35d435['length'];_0x12e52e++){_0x35d435[_0x12e52e][_0x2036('0x10f')](_0x2036('0x98'),_0x2036('0x118'));}return _0x35d435;}));_0x2f43ff['push'](_0x46d02e[_0x2036('0x119')]()['then'](function(_0x39800d){for(var _0x3f1fdb=0x0;_0x3f1fdb<_0x39800d[_0x2036('0x55')];_0x3f1fdb++){_0x39800d[_0x3f1fdb]['setDataValue'](_0x2036('0x98'),_0x2036('0x11a'));}return _0x39800d;}));return BPromise[_0x2036('0x4e')](_0x2f43ff);})[_0x2036('0x11')](function(_0x484f38){var _0x53ee73=_['flatten'](_0x484f38);_0x2f43ff=[];return db[_0x2036('0x64')][_0x2036('0x11b')](function(_0x19daa2){for(var _0x264919=0x0;_0x264919<_0x53ee73[_0x2036('0x55')];_0x264919++){_0x2f43ff[_0x2036('0x44')](_0x53ee73[_0x264919][_0x2036('0x11c')](_0x2e5b51['id']),{'transaction':_0x19daa2});}return BPromise['all'](_0x2f43ff)[_0x2036('0x11')](function(){if(_0x2e5b51['online']){return BPromise[_0x2036('0x85')](_[_0x2036('0x39')](_0x53ee73,function(_0x55953a){return _0x55953a[_0x2036('0x11d')]('channel')===_0x2036('0x110');}),function(_0x1dcf7a){return db[_0x2036('0xa8')]['upsert']({'membername':_0x2e5b51[_0x2036('0x32')],'UserId':_0x2e5b51['id'],'queue_name':_0x1dcf7a[_0x2036('0x32')],'VoiceQueueId':_0x1dcf7a['id'],'interface':_[_0x2036('0x62')](_0x2e5b51[_0x2036('0xa5')])?util['format']('SIP/%s',_0x2e5b51[_0x2036('0x32')]):_0x2e5b51['interface'],'paused':_0x2e5b51['voicePause']||![],'penalty':_0x2e5b51['penalty']},{'transaction':_0x19daa2});});}else{return;}})[_0x2036('0x11')](function(){for(var _0x33746b=0x0;_0x33746b<_0x53ee73['length'];_0x33746b++){var _0x43bc24=_0x53ee73[_0x33746b][_0x2036('0x11d')]('channel');var _0x157e9a=_0x43bc24+_0x2036('0xa1');socket[_0x2036('0xa2')](_0x2036('0x29')+_0x43bc24+'Queue:save',{'UserId':_0x2e5b51['id'],['queueField']:_0x53ee73[_0x33746b]['id']});}});});})[_0x2036('0x11')](function(){db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x38108a['id']}})['then'](function(_0x4cf1d4){if(_0x4cf1d4){db[_0x2036('0x11e')]['create']({'UserId':_0x56698a[_0x2036('0x5a')]['id'],'VoicePrefixId':_0x4cf1d4[_0x2036('0x11f')]});}});});}});}})[_0x2036('0x11')](respondWithStatusCode(_0x31077c,null))[_0x2036('0x19')](handleError(_0x31077c,null));};exports[_0x2036('0x120')]=function(_0x454877,_0x52e578){return db['User'][_0x2036('0x91')]({'where':{'id':_0x454877[_0x2036('0x5a')]['id']}})['then'](handleEntityNotFound(_0x52e578,null))[_0x2036('0x11')](function(_0x467142){if(_0x467142){var _0x45ecdd=_0x467142[_0x2036('0x25')]({'plain':!![]});var _0x1131e2=_0x454877[_0x2036('0x40')][_0x2036('0x9d')];return _0x467142['removeTeams'](_0x1131e2)['then'](function(){for(var _0x1cedc7=0x0;_0x1cedc7<_0x1131e2['length'];_0x1cedc7++){var _0x4f5150=[];var _0x2e01ed={};db['Team'][_0x2036('0x91')]({'where':{'id':_0x1131e2[_0x1cedc7]}})[_0x2036('0x11')](function(_0x4cd106){_0x2e01ed=_0x4cd106[_0x2036('0x4a')];_0x4f5150[_0x2036('0x44')](_0x4cd106[_0x2036('0x121')]()[_0x2036('0x11')](function(_0x3a6ed7){for(var _0x49b558=0x0;_0x49b558<_0x3a6ed7[_0x2036('0x55')];_0x49b558++){_0x3a6ed7[_0x49b558][_0x2036('0x10f')](_0x2036('0x98'),_0x2036('0x110'));}return _0x3a6ed7;}));_0x4f5150['push'](_0x4cd106[_0x2036('0x111')]()['then'](function(_0x4b9922){for(var _0x434e24=0x0;_0x434e24<_0x4b9922[_0x2036('0x55')];_0x434e24++){_0x4b9922[_0x434e24][_0x2036('0x10f')](_0x2036('0x98'),_0x2036('0x112'));}return _0x4b9922;}));_0x4f5150[_0x2036('0x44')](_0x4cd106[_0x2036('0x113')]()[_0x2036('0x11')](function(_0x55dffb){for(var _0x370bee=0x0;_0x370bee<_0x55dffb[_0x2036('0x55')];_0x370bee++){_0x55dffb[_0x370bee][_0x2036('0x10f')](_0x2036('0x98'),_0x2036('0x114'));}return _0x55dffb;}));_0x4f5150['push'](_0x4cd106['getSmsQueues']()[_0x2036('0x11')](function(_0x9715aa){for(var _0x5bd1fd=0x0;_0x5bd1fd<_0x9715aa[_0x2036('0x55')];_0x5bd1fd++){_0x9715aa[_0x5bd1fd]['setDataValue']('channel','Sms');}return _0x9715aa;}));_0x4f5150[_0x2036('0x44')](_0x4cd106[_0x2036('0x116')]()['then'](function(_0x50b698){for(var _0x1fe65d=0x0;_0x1fe65d<_0x50b698[_0x2036('0x55')];_0x1fe65d++){_0x50b698[_0x1fe65d][_0x2036('0x10f')](_0x2036('0x98'),_0x2036('0x117'));}return _0x50b698;}));_0x4f5150[_0x2036('0x44')](_0x4cd106[_0x2036('0x122')]()[_0x2036('0x11')](function(_0x39c9c8){for(var _0x38e455=0x0;_0x38e455<_0x39c9c8[_0x2036('0x55')];_0x38e455++){_0x39c9c8[_0x38e455]['setDataValue'](_0x2036('0x98'),_0x2036('0x118'));}return _0x39c9c8;}));_0x4f5150[_0x2036('0x44')](_0x4cd106[_0x2036('0x119')]()[_0x2036('0x11')](function(_0x5ebc8c){for(var _0x5616a2=0x0;_0x5616a2<_0x5ebc8c['length'];_0x5616a2++){_0x5ebc8c[_0x5616a2][_0x2036('0x10f')]('channel',_0x2036('0x11a'));}return _0x5ebc8c;}));return BPromise[_0x2036('0x4e')](_0x4f5150);})[_0x2036('0x11')](function(_0x2a2ccf){var _0x4b2461=_[_0x2036('0x123')](_0x2a2ccf);_0x4f5150=[];return db['sequelize'][_0x2036('0x11b')](function(_0x6b5f30){for(var _0x1f4d2f=0x0;_0x1f4d2f<_0x4b2461[_0x2036('0x55')];_0x1f4d2f++){_0x4f5150[_0x2036('0x44')](_0x4b2461[_0x1f4d2f]['removeAgent'](_0x45ecdd['id']),{'transaction':_0x6b5f30});}return BPromise[_0x2036('0x4e')](_0x4f5150)['then'](function(){if(_0x45ecdd[_0x2036('0x99')]){return BPromise[_0x2036('0x85')](_[_0x2036('0x39')](_0x4b2461,function(_0x565541){return _0x565541[_0x2036('0x11d')](_0x2036('0x98'))==='Voice';}),function(_0x508119){return db[_0x2036('0xa8')][_0x2036('0x24')]({'where':{'VoiceQueueId':_0x508119['id'],'UserId':_0x45ecdd['id']},'transaction':_0x6b5f30});});}else{return;}})[_0x2036('0x11')](function(){db[_0x2036('0x124')][_0x2036('0x91')]({'where':{'teamId':_0x2e01ed['id']}})['then'](function(_0x293a40){if(_0x293a40){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x45ecdd['id'],'VoicePrefixId':_0x293a40[_0x2036('0x4a')][_0x2036('0x11f')]}});}});})[_0x2036('0x11')](function(){for(var _0x58a3fe=0x0;_0x58a3fe<_0x4b2461[_0x2036('0x55')];_0x58a3fe++){var _0x2b8618=_0x4b2461[_0x58a3fe][_0x2036('0x11d')]('channel');var _0x55437f=_0x2b8618+'QueueId';socket[_0x2036('0xa2')](_0x2036('0x29')+_0x2b8618+_0x2036('0xac'),{'UserId':_0x45ecdd['id'],['queueField']:_0x4b2461[_0x58a3fe]['id']});}});});});}});}})[_0x2036('0x11')](respondWithStatusCode(_0x52e578,null))[_0x2036('0x19')](handleError(_0x52e578,null));};exports[_0x2036('0x125')]=function(_0x2a33c7,_0x422627){var _0x5665f6={};var _0xd242c8={};var _0x543264;var _0x45f97a;return db[_0x2036('0x35')]['findOne']({'where':{'id':_0x2a33c7['params']['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x422627,null))['then'](function(_0x1fdc26){if(_0x1fdc26){_0x543264=_0x1fdc26;_0xd242c8[_0x2036('0x4f')]=_['keys'](db['CmList'][_0x2036('0x50')]);_0xd242c8[_0x2036('0x40')]=_['keys'](_0x2a33c7['query']);_0xd242c8['filters']=_['intersection'](_0xd242c8[_0x2036('0x4f')],_0xd242c8[_0x2036('0x40')]);_0x5665f6['attributes']=_['intersection'](_0xd242c8['model'],qs[_0x2036('0x54')](_0x2a33c7[_0x2036('0x40')][_0x2036('0x54')]));_0x5665f6[_0x2036('0x43')]=_0x5665f6['attributes'][_0x2036('0x55')]?_0x5665f6[_0x2036('0x43')]:_0xd242c8['model'];_0x5665f6[_0x2036('0xc2')]=qs[_0x2036('0xc3')](_0x2a33c7[_0x2036('0x40')][_0x2036('0xc3')]);_0x5665f6['where']=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x2a33c7[_0x2036('0x40')],_0xd242c8[_0x2036('0x52')]));if(_0x2a33c7['query']['filter']){_0x5665f6[_0x2036('0x3d')]=_[_0x2036('0x56')](_0x5665f6['where'],{'$or':_[_0x2036('0x2c')](_0x5665f6[_0x2036('0x43')],function(_0x3e6e39){var _0x14a073={};_0x14a073[_0x3e6e39]={'$like':'%'+_0x2a33c7['query'][_0x2036('0x39')]+'%'};return _0x14a073;})});}_0x5665f6=_['merge']({},_0x5665f6,_0x2a33c7[_0x2036('0x57')]);return _0x543264['getLists'](_0x5665f6);}})[_0x2036('0x11')](function(_0x39a935){if(_0x39a935){_0x45f97a=_0x39a935[_0x2036('0x55')];if(!_0x2a33c7[_0x2036('0x40')][_0x2036('0xd2')]('nolimit')){_0x5665f6['limit']=qs[_0x2036('0x20')](_0x2a33c7[_0x2036('0x40')]['limit']);_0x5665f6[_0x2036('0x1e')]=qs[_0x2036('0x1e')](_0x2a33c7['query'][_0x2036('0x1e')]);}return _0x543264['getLists'](_0x5665f6);}})['then'](function(_0x153c3c){if(_0x153c3c){return _0x153c3c?{'count':_0x45f97a,'rows':_0x153c3c}:null;}})[_0x2036('0x11')](respondWithResult(_0x422627,null))[_0x2036('0x19')](handleError(_0x422627,null));};exports['getAgents']=function(_0x4047e6,_0x2dac17){var _0x938014={};var _0x5ce211={};var _0x17cc81;return db[_0x2036('0x35')][_0x2036('0x91')]({'where':{'id':_0x4047e6[_0x2036('0x5a')]['id']}})[_0x2036('0x11')](handleEntityNotFound(_0x2dac17,null))[_0x2036('0x11')](function(_0x3f2852){if(_0x3f2852){_0x17cc81=_0x3f2852;_0x5ce211[_0x2036('0x4f')]=_[_0x2036('0x51')](db[_0x2036('0x35')][_0x2036('0x50')]);_0x5ce211[_0x2036('0x40')]=_[_0x2036('0x51')](_0x4047e6[_0x2036('0x40')]);_0x5ce211['filters']=_[_0x2036('0x53')](_0x5ce211[_0x2036('0x4f')],_0x5ce211[_0x2036('0x40')]);_0x938014[_0x2036('0x43')]=_[_0x2036('0x53')](_0x5ce211[_0x2036('0x4f')],qs[_0x2036('0x54')](_0x4047e6[_0x2036('0x40')][_0x2036('0x54')]));_0x938014[_0x2036('0x43')]=_0x938014['attributes'][_0x2036('0x55')]?_0x938014['attributes']:_0x5ce211[_0x2036('0x4f')];_0x938014['order']=qs[_0x2036('0xc3')](_0x4047e6['query'][_0x2036('0xc3')]);_0x938014[_0x2036('0x3d')]=qs[_0x2036('0x52')](_[_0x2036('0xcd')](_0x4047e6[_0x2036('0x40')],_0x5ce211[_0x2036('0x52')]));if(_0x4047e6['query']['filter']){_0x938014['where']=_[_0x2036('0x56')](_0x938014[_0x2036('0x3d')],{'$or':_[_0x2036('0x2c')](_0x938014[_0x2036('0x43')],function(_0x20e414){var _0x4278fc={};_0x4278fc[_0x20e414]={'$like':'%'+_0x4047e6[_0x2036('0x40')][_0x2036('0x39')]+'%'};return _0x4278fc;})});}_0x938014[_0x2036('0x4f')]=db[_0x2036('0x35')];_0x938014['as']=_0x2036('0x80');_0x938014=_[_0x2036('0x56')]({},_0x938014,_0x4047e6['options']);return _0x17cc81[_0x2036('0x121')]({'include':[_0x938014]});}})['then'](function(_0x18d14c){if(_0x18d14c){var _0x32d0c5={},_0x45a1c6=[];for(var _0x3cb692=0x0;_0x3cb692<_0x18d14c['length'];_0x3cb692+=0x1){for(var _0x567f3a=0x0,_0x55305a;_0x567f3a<_0x18d14c[_0x3cb692][_0x2036('0x80')][_0x2036('0x55')];_0x567f3a+=0x1){_0x55305a=_0x18d14c[_0x3cb692][_0x2036('0x80')][_0x567f3a]['get']({'plain':!![]});_0x32d0c5[_0x55305a['id']]=_0x55305a;}}_0x32d0c5=_['values'](_0x32d0c5);for(var _0x42e071=qs[_0x2036('0x1e')](_0x4047e6[_0x2036('0x40')][_0x2036('0x1e')]);_0x42e071<_0x32d0c5[_0x2036('0x55')]&&_0x45a1c6['length']=_0x1a0391[_0xe58f('0x50')]){throw new Error(_0xe58f('0x51'));}})['then'](function(){if(_0x4e5eb3){return db[_0xe58f('0x2c')][_0xe58f('0x52')]({'where':{'membername':_0x4e5eb3[_0xe58f('0x2a')]},'individualHooks':!![]});}})[_0xe58f('0x11')](function(){if(_0x4e5eb3){return _0x4e5eb3[_0xe58f('0x53')]({'raw':!![]});}})['then'](function(_0x3ecbb2){if(_0x4e5eb3){if(_0x3ecbb2){var _0x171cb0=[];_0x10fc23=_0x3ecbb2;if(_0x10fc23[_0xe58f('0x30')]){for(var _0x5c7841=0x0;_0x5c7841<_0x10fc23[_0xe58f('0x30')];_0x5c7841++){_0x171cb0[_0xe58f('0x34')](db[_0xe58f('0x2c')]['upsert']({'membername':_0x4e5eb3[_0xe58f('0x2a')],'UserId':_0x4e5eb3['id'],'queue_name':_0x10fc23[_0x5c7841]['name'],'VoiceQueueId':_0x10fc23[_0x5c7841]['id'],'interface':_0xf34451,'paused':_0x4e5eb3[_0xe58f('0x54')]||![],'penalty':_0x10fc23[_0x5c7841][_0xe58f('0x55')]||0x0}));}return BPromise[_0xe58f('0x4a')](_0x171cb0);}}}})[_0xe58f('0x11')](function(){if(_0x4e5eb3){return db['MemberReport'][_0xe58f('0x1e')]({'where':{'membername':_0x4e5eb3[_0xe58f('0x2a')],'exitAt':null}});}})[_0xe58f('0x11')](function(_0x492152){if(_0x4e5eb3){if(_0x492152&&_0x492152['length']){var _0x189868=[];_0x492152[_0xe58f('0x33')](function(_0x2b01f1){_0x189868[_0xe58f('0x34')](_0x2b01f1[_0xe58f('0x2d')]({'exitAt':moment()[_0xe58f('0x31')](_0xe58f('0x37'))}));});return BPromise[_0xe58f('0x4a')](_0x189868);}}})['then'](function(_0x5adb9a){if(_0x4e5eb3){var _0x39b32f=[];var _0x1e5081=[];var _0x3cc9cb=utils[_0xe58f('0x56')]();var _0x895b75={'membername':_0x4e5eb3['name'],'interface':_0xf34451,'enterAt':moment()[_0xe58f('0x31')](_0xe58f('0x37')),'role':_0x4e5eb3['role'],'internal':_0x4e5eb3[_0xe58f('0x3c')]};_0x3cc9cb[_0xe58f('0x33')](function(_0x465629){_0x39b32f[_0xe58f('0x34')](_[_0xe58f('0x57')]({'channel':_0x465629,'type':_0xe58f('0x58'),'data1':'callysquare','data2':_0xf34451},_0x895b75));if(_0x4e5eb3[_0xe58f('0x54')]){_0x1e5081[_0xe58f('0x34')](_[_0xe58f('0x57')]({'channel':_0x465629,'type':'PAUSE','data1':_0xe58f('0x59')},_0x895b75));}});return db[_0xe58f('0x2e')][_0xe58f('0x3d')](_0x39b32f[_0xe58f('0x5a')](_0x1e5081),{'individualHooks':!![]});}})[_0xe58f('0x11')](function(){if(_0x4e5eb3){return _0x4e5eb3[_0xe58f('0x2d')]({'online':!![],'lastLoginAt':moment()[_0xe58f('0x31')](_0xe58f('0x37')),'voicePause':_0x4e5eb3[_0xe58f('0x54')]||![],'mailPause':_0x4e5eb3['loginInPause']||![],'chatPause':_0x4e5eb3['loginInPause']||![],'faxPause':_0x4e5eb3[_0xe58f('0x54')]||![],'smsPause':_0x4e5eb3['loginInPause']||![],'openchannelPause':_0x4e5eb3[_0xe58f('0x54')]||![],'pauseType':_0x4e5eb3[_0xe58f('0x54')]?_0xe58f('0x59'):null,'lastPauseAt':moment()[_0xe58f('0x31')](_0xe58f('0x37')),'interface':_0xf34451});}})[_0xe58f('0x11')](function(_0x5d7a6e){_0x32ee86(_0x5d7a6e);})[_0xe58f('0x1b')](function(_0x2a1a13){_0x575866(_0x2be7b4[_0xe58f('0x17')](0x1f4,_0x2a1a13['message']));});});}; \ No newline at end of file +var _0x294b=['LoginUser','mobile','phone','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetUser','findAll','options','raw','attributes','limit','include','model','map','catch','ShowUser','find','where','PauseUser','User','name','role','UserVoiceQueueRt','update','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','interface','PAUSE','body','type','DEFAULT\x20PAUSE','internal','MemberReport','bulkCreate','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','sms','whatsapp','set','%s%s','Pause','all','destroy'];(function(_0xbc83f,_0x530f44){var _0x1e5c58=function(_0x30ecfe){while(--_0x30ecfe){_0xbc83f['push'](_0xbc83f['shift']());}};_0x1e5c58(++_0x530f44);}(_0x294b,0x110));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var util=require(_0xb294('0x1'));var moment=require(_0xb294('0x2'));var BPromise=require(_0xb294('0x3'));var rs=require(_0xb294('0x4'));var fs=require('fs');var Redis=require(_0xb294('0x5'));var db=require(_0xb294('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb294('0x7'));var config=require(_0xb294('0x8'));var jayson=require(_0xb294('0x9'));var client=jayson['client'][_0xb294('0xa')]({'port':0x232a});config[_0xb294('0xb')]=_[_0xb294('0xc')](config[_0xb294('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb294('0xd'))(new Redis(config[_0xb294('0xb')]));require(_0xb294('0xe'))[_0xb294('0xf')](socket);function respondWithRpcPromise(_0x438263,_0x515f67,_0x82995e){return new BPromise(function(_0x58766b,_0x1b87b1){return client['request'](_0x438263,_0x82995e)[_0xb294('0x10')](function(_0x4e75fe){logger[_0xb294('0x11')](_0xb294('0x12'),_0x515f67,_0xb294('0x13'));logger[_0xb294('0x14')](_0xb294('0x15'),_0x515f67,_0xb294('0x13'),JSON[_0xb294('0x16')](_0x4e75fe));if(_0x4e75fe['error']){if(_0x4e75fe[_0xb294('0x17')]['code']===0x1f4){logger[_0xb294('0x17')](_0xb294('0x12'),_0x515f67,_0x4e75fe['error'][_0xb294('0x18')]);return _0x1b87b1(_0x4e75fe[_0xb294('0x17')][_0xb294('0x18')]);}logger[_0xb294('0x17')](_0xb294('0x12'),_0x515f67,_0x4e75fe[_0xb294('0x17')][_0xb294('0x18')]);return _0x58766b(_0x4e75fe[_0xb294('0x17')][_0xb294('0x18')]);}else{logger['info']('User,\x20%s,\x20%s',_0x515f67,_0xb294('0x13'));_0x58766b(_0x4e75fe[_0xb294('0x19')][_0xb294('0x18')]);}})['catch'](function(_0x517152){logger['error'](_0xb294('0x12'),_0x515f67,_0x517152);_0x1b87b1(_0x517152);});});}exports[_0xb294('0x1a')]=function(_0x3110fe){var _0x34cecd=this;return new Promise(function(_0x203945,_0x1fd5f7){return db['User'][_0xb294('0x1b')]({'raw':_0x3110fe[_0xb294('0x1c')]?_0x3110fe['options'][_0xb294('0x1d')]===undefined?!![]:![]:!![],'where':_0x3110fe[_0xb294('0x1c')]?_0x3110fe[_0xb294('0x1c')]['where']||null:null,'attributes':_0x3110fe[_0xb294('0x1c')]?_0x3110fe[_0xb294('0x1c')][_0xb294('0x1e')]||null:null,'limit':_0x3110fe[_0xb294('0x1c')]?_0x3110fe[_0xb294('0x1c')][_0xb294('0x1f')]||null:null,'include':_0x3110fe['options']?_0x3110fe['options'][_0xb294('0x20')]?_['map'](_0x3110fe[_0xb294('0x1c')][_0xb294('0x20')],function(_0x58ebdf){return{'model':db[_0x58ebdf[_0xb294('0x21')]],'as':_0x58ebdf['as'],'attributes':_0x58ebdf['attributes'],'include':_0x58ebdf[_0xb294('0x20')]?_[_0xb294('0x22')](_0x58ebdf[_0xb294('0x20')],function(_0x16c6f3){return{'model':db[_0x16c6f3[_0xb294('0x21')]],'as':_0x16c6f3['as'],'attributes':_0x16c6f3[_0xb294('0x1e')],'include':_0x16c6f3[_0xb294('0x20')]?_[_0xb294('0x22')](_0x16c6f3[_0xb294('0x20')],function(_0x39eab7){return{'model':db[_0x39eab7['model']],'as':_0x39eab7['as'],'attributes':_0x39eab7[_0xb294('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x832f70){logger[_0xb294('0x11')](_0xb294('0x1a'),_0x3110fe);logger['debug']('GetUser',_0x3110fe,JSON[_0xb294('0x16')](_0x832f70));_0x203945(_0x832f70);})[_0xb294('0x23')](function(_0xcbcc84){logger[_0xb294('0x17')](_0xb294('0x1a'),_0xcbcc84[_0xb294('0x18')],_0x3110fe);_0x1fd5f7(_0x34cecd['error'](0x1f4,_0xcbcc84[_0xb294('0x18')]));});});};exports[_0xb294('0x24')]=function(_0x59d4a2){var _0x4c793a=this;return new Promise(function(_0x2e9c00,_0x471cfe){return db['User'][_0xb294('0x25')]({'raw':_0x59d4a2[_0xb294('0x1c')]?_0x59d4a2['options']['raw']===undefined?!![]:![]:!![],'where':_0x59d4a2[_0xb294('0x1c')]?_0x59d4a2[_0xb294('0x1c')][_0xb294('0x26')]||null:null,'attributes':_0x59d4a2[_0xb294('0x1c')]?_0x59d4a2[_0xb294('0x1c')][_0xb294('0x1e')]||null:null,'include':_0x59d4a2[_0xb294('0x1c')]?_0x59d4a2[_0xb294('0x1c')][_0xb294('0x20')]?_[_0xb294('0x22')](_0x59d4a2[_0xb294('0x1c')][_0xb294('0x20')],function(_0x53d046){return{'model':db[_0x53d046[_0xb294('0x21')]],'as':_0x53d046['as'],'attributes':_0x53d046['attributes'],'include':_0x53d046[_0xb294('0x20')]?_[_0xb294('0x22')](_0x53d046['include'],function(_0x14f4ac){return{'model':db[_0x14f4ac['model']],'as':_0x14f4ac['as'],'attributes':_0x14f4ac[_0xb294('0x1e')],'include':_0x14f4ac[_0xb294('0x20')]?_[_0xb294('0x22')](_0x14f4ac[_0xb294('0x20')],function(_0x2bc966){return{'model':db[_0x2bc966[_0xb294('0x21')]],'as':_0x2bc966['as'],'attributes':_0x2bc966['attributes']};}):[]};}):[]};}):[]:[]})[_0xb294('0x10')](function(_0x2153f9){logger[_0xb294('0x11')]('ShowUser',_0x59d4a2);logger[_0xb294('0x14')](_0xb294('0x24'),_0x59d4a2,JSON[_0xb294('0x16')](_0x2153f9));_0x2e9c00(_0x2153f9);})['catch'](function(_0x28121b){logger['error'](_0xb294('0x24'),_0x28121b['message'],_0x59d4a2);_0x471cfe(_0x4c793a[_0xb294('0x17')](0x1f4,_0x28121b[_0xb294('0x18')]));});});};exports[_0xb294('0x27')]=function(_0x7e5483){var _0x15cbab=this;return new Promise(function(_0x30251e,_0x25fbbb){var _0x321b04;return db[_0xb294('0x28')]['find']({'where':_0x7e5483[_0xb294('0x1c')][_0xb294('0x26')]||{},'attributes':['id',_0xb294('0x29'),_0xb294('0x2a'),'internal','interface']})[_0xb294('0x10')](function(_0x21bb75){if(_0x21bb75){_0x321b04=_0x21bb75;return db[_0xb294('0x2b')][_0xb294('0x2c')]({'paused':0x1},{'where':{'UserId':_0x321b04['id']},'individualHooks':!![]});}})[_0xb294('0x10')](function(){if(_0x321b04){return db['MemberReport'][_0xb294('0x1b')]({'where':{'membername':_0x321b04['name'],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x4c76d9){if(_0x321b04){if(_0x4c76d9&&_0x4c76d9[_0xb294('0x2d')]){var _0x15978d=moment()[_0xb294('0x2e')](_0xb294('0x2f'));for(var _0x15999e=0x0,_0xbedf4b=_0x4c76d9[_0xb294('0x2d')];_0x15999e<_0xbedf4b;_0x15999e++){_0x4c76d9[_0x15999e]['updateAttributes']({'exitAt':_0x15978d});}}}})[_0xb294('0x10')](function(){if(_0x321b04){var _0x219689=[];var _0x50a951=utils[_0xb294('0x30')]();_0x50a951[_0xb294('0x31')](function(_0x33f10d){_0x219689[_0xb294('0x32')]({'channel':_0x33f10d,'membername':_0x321b04['name'],'interface':_['isNil'](_0x321b04[_0xb294('0x33')])?util[_0xb294('0x2e')]('SIP/%s',_0x321b04['name']):_0x321b04['interface'],'type':_0xb294('0x34'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x7e5483[_0xb294('0x35')][_0xb294('0x36')]||_0xb294('0x37'),'role':_0x321b04[_0xb294('0x2a')],'internal':_0x321b04[_0xb294('0x38')],'uniqueid':_0x7e5483[_0xb294('0x35')]['uniqueid']||null});});return db[_0xb294('0x39')][_0xb294('0x3a')](_0x219689,{'individualHooks':!![]});}})['then'](function(){if(_0x321b04){return _0x321b04[_0xb294('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x7e5483['body'][_0xb294('0x36')]||_0xb294('0x37'),'lastPauseAt':moment()[_0xb294('0x2e')](_0xb294('0x2f'))});}})['then'](function(_0x121260){_0x30251e(_0x121260);})[_0xb294('0x23')](function(_0x33cbcd){_0x25fbbb(_0x15cbab['error'](0x1f4,_0x33cbcd[_0xb294('0x18')]));});});};exports['UnpauseUser']=function(_0x265640){var _0x3fa3f2=this;return new Promise(function(_0x2ba67e,_0x51d6b0){var _0x3d4c27;return db[_0xb294('0x28')][_0xb294('0x3b')]({'where':_0x265640[_0xb294('0x1c')][_0xb294('0x26')]||{},'attributes':['id',_0xb294('0x29')]})[_0xb294('0x10')](function(_0x1b923f){if(_0x1b923f){_0x3d4c27=_0x1b923f;if(_0x265640[_0xb294('0x35')][_0xb294('0x3c')]&&!utils[_0xb294('0x3d')](_0x265640[_0xb294('0x35')][_0xb294('0x3c')])){throw new Error(_0xb294('0x3e'));}switch(_0x265640[_0xb294('0x35')][_0xb294('0x3c')]){case _0xb294('0x3f'):return db[_0xb294('0x2b')]['update']({'paused':0x0},{'where':{'UserId':_0x3d4c27['id']}})[_0xb294('0x10')](function(){return db[_0xb294('0x39')][_0xb294('0x25')]({'where':{'channel':_0x265640[_0xb294('0x35')][_0xb294('0x3c')],'membername':_0x3d4c27[_0xb294('0x29')],'type':_0xb294('0x34'),'exitAt':null}});})[_0xb294('0x10')](function(_0x3c5dd7){if(_0x3c5dd7){return _0x3c5dd7['update']({'exitAt':moment()[_0xb294('0x2e')](_0xb294('0x2f')),'data2':_0xb294('0x40')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x3d4c27[_0xb294('0x2c')]({'voicePause':![]});});case'mail':case'chat':case'fax':case _0xb294('0x41'):case'openchannel':case _0xb294('0x42'):return db[_0xb294('0x39')][_0xb294('0x25')]({'where':{'channel':_0x265640[_0xb294('0x35')][_0xb294('0x3c')],'membername':_0x3d4c27[_0xb294('0x29')],'type':'PAUSE','exitAt':null}})[_0xb294('0x10')](function(_0x49f51e){return _0x49f51e[_0xb294('0x2c')]({'exitAt':moment()[_0xb294('0x2e')](_0xb294('0x2f')),'data2':_0xb294('0x40')},{'individualHooks':!![]});})[_0xb294('0x10')](function(){var _0x2f536b={};_[_0xb294('0x43')](_0x2f536b,util[_0xb294('0x2e')](_0xb294('0x44'),_0x265640['body']['channel'],_0xb294('0x45')),![]);return _0x3d4c27[_0xb294('0x2c')](_0x2f536b);});default:return db[_0xb294('0x2b')][_0xb294('0x2c')]({'paused':0x0},{'where':{'UserId':_0x3d4c27['id']}})[_0xb294('0x10')](function(){return db[_0xb294('0x39')][_0xb294('0x1b')]({'where':{'membername':_0x3d4c27[_0xb294('0x29')],'type':_0xb294('0x34'),'exitAt':null}});})[_0xb294('0x10')](function(_0x541a0f){var _0x5ad8ef=[];_0x541a0f[_0xb294('0x31')](function(_0x2504e3){_0x5ad8ef[_0xb294('0x32')](_0x2504e3[_0xb294('0x2c')]({'exitAt':moment()[_0xb294('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xb294('0x40')}));});return BPromise[_0xb294('0x46')](_0x5ad8ef);})[_0xb294('0x10')](function(){return _0x3d4c27['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x5a4ec8){_0x2ba67e(_0x5a4ec8);})[_0xb294('0x23')](function(_0x5adccc){_0x51d6b0(_0x3fa3f2['error'](0x1f4,_0x5adccc['message']));});});};exports['LogoutUser']=function(_0x1925fb){var _0x46e91f=this;return new Promise(function(_0x26685a,_0x103f64){var _0x33834c;return db[_0xb294('0x28')][_0xb294('0x3b')]({'where':_0x1925fb['options']['where']||{},'attributes':['id','name']})[_0xb294('0x10')](function(_0x4c7663){if(_0x4c7663){_0x33834c=_0x4c7663;return db['UserVoiceQueueRt'][_0xb294('0x47')]({'where':{'membername':_0x33834c['name']},'individualHooks':!![]});}})[_0xb294('0x10')](function(){if(_0x33834c){return db[_0xb294('0x39')][_0xb294('0x1b')]({'where':{'membername':_0x33834c['name'],'exitAt':null}});}})[_0xb294('0x10')](function(_0x6daa7a){if(_0x33834c){if(_0x6daa7a&&_0x6daa7a[_0xb294('0x2d')]){var _0x346cb5=[];_0x6daa7a[_0xb294('0x31')](function(_0x21c57e){_0x346cb5['push'](_0x21c57e[_0xb294('0x2c')]({'exitAt':moment()[_0xb294('0x2e')](_0xb294('0x2f'))}));});return BPromise[_0xb294('0x46')](_0x346cb5);}}})['then'](function(){if(_0x33834c){return _0x33834c[_0xb294('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xb294('0x10')](function(_0x38d638){_0x26685a(_0x38d638);})[_0xb294('0x23')](function(_0x49298e){_0x103f64(_0x46e91f[_0xb294('0x17')](0x1f4,_0x49298e[_0xb294('0x18')]));});});};exports[_0xb294('0x48')]=function(_0x958f00){var _0x50e335=this;return new Promise(function(_0x8b7ff3,_0x1ee7b5){var _0x21c955;var _0x125527;var _0x3b7621;var _0x4eb66b;return db[_0xb294('0x28')][_0xb294('0x3b')]({'where':_0x958f00[_0xb294('0x1c')][_0xb294('0x26')]||{},'attributes':['id',_0xb294('0x29'),_0xb294('0x2a'),_0xb294('0x49'),_0xb294('0x4a'),_0xb294('0x38'),'loginInPause',_0xb294('0x33')]})[_0xb294('0x10')](function(_0x22c315){if(_0x22c315){_0x21c955=_0x22c315;_0x4eb66b=_0x958f00['body'][_0xb294('0x33')]?_0x958f00[_0xb294('0x35')][_0xb294('0x33')]:util[_0xb294('0x2e')]('SIP/%s',_0x21c955[_0xb294('0x29')]);return db[_0xb294('0x28')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x21c955['id']}}});}})[_0xb294('0x10')](function(_0x1ab06a){if(_0x1ab06a){_0x3b7621=_0x1ab06a;return require('../../config/license/util')[_0xb294('0x4b')]();}})[_0xb294('0x10')](function(_0x454daf){if(_0x454daf&&_0x454daf[_0xb294('0x4c')]&&_0x3b7621>=_0x454daf[_0xb294('0x4c')]){throw new Error(_0xb294('0x4d'));}})[_0xb294('0x10')](function(){if(_0x21c955){return db[_0xb294('0x2b')][_0xb294('0x47')]({'where':{'membername':_0x21c955[_0xb294('0x29')]},'individualHooks':!![]});}})[_0xb294('0x10')](function(){if(_0x21c955){return _0x21c955[_0xb294('0x4e')]({'raw':!![]});}})[_0xb294('0x10')](function(_0x4b76c8){if(_0x21c955){if(_0x4b76c8){var _0x35424d=[];_0x125527=_0x4b76c8;if(_0x125527[_0xb294('0x2d')]){for(var _0x2f1698=0x0;_0x2f1698<_0x125527[_0xb294('0x2d')];_0x2f1698++){_0x35424d[_0xb294('0x32')](db['UserVoiceQueueRt'][_0xb294('0x4f')]({'membername':_0x21c955['name'],'UserId':_0x21c955['id'],'queue_name':_0x125527[_0x2f1698][_0xb294('0x29')],'VoiceQueueId':_0x125527[_0x2f1698]['id'],'interface':_0x4eb66b,'paused':_0x21c955[_0xb294('0x50')]||![],'penalty':_0x125527[_0x2f1698][_0xb294('0x51')]||0x0}));}return BPromise[_0xb294('0x46')](_0x35424d);}}}})[_0xb294('0x10')](function(){if(_0x21c955){return db['MemberReport']['findAll']({'where':{'membername':_0x21c955[_0xb294('0x29')],'exitAt':null}});}})['then'](function(_0x5b110b){if(_0x21c955){if(_0x5b110b&&_0x5b110b['length']){var _0x234196=[];_0x5b110b['forEach'](function(_0x3466f3){_0x234196[_0xb294('0x32')](_0x3466f3[_0xb294('0x2c')]({'exitAt':moment()['format'](_0xb294('0x2f'))}));});return BPromise[_0xb294('0x46')](_0x234196);}}})['then'](function(_0x168393){if(_0x21c955){var _0xbc3ac2=[];var _0x3c08ad=[];var _0x4fbcbc=utils['getChannels']();var _0xb5d08a={'membername':_0x21c955['name'],'interface':_0x4eb66b,'enterAt':moment()[_0xb294('0x2e')](_0xb294('0x2f')),'role':_0x21c955[_0xb294('0x2a')],'internal':_0x21c955[_0xb294('0x38')]};_0x4fbcbc[_0xb294('0x31')](function(_0x5bdd9a){_0xbc3ac2[_0xb294('0x32')](_[_0xb294('0x52')]({'channel':_0x5bdd9a,'type':_0xb294('0x53'),'data1':_0xb294('0x54'),'data2':_0x4eb66b},_0xb5d08a));if(_0x21c955[_0xb294('0x50')]){_0x3c08ad[_0xb294('0x32')](_[_0xb294('0x52')]({'channel':_0x5bdd9a,'type':_0xb294('0x34'),'data1':_0xb294('0x55')},_0xb5d08a));}});return db[_0xb294('0x39')][_0xb294('0x3a')](_0xbc3ac2['concat'](_0x3c08ad),{'individualHooks':!![]});}})['then'](function(){if(_0x21c955){return _0x21c955['update']({'online':!![],'lastLoginAt':moment()[_0xb294('0x2e')](_0xb294('0x2f')),'voicePause':_0x21c955[_0xb294('0x50')]||![],'mailPause':_0x21c955[_0xb294('0x50')]||![],'chatPause':_0x21c955[_0xb294('0x50')]||![],'faxPause':_0x21c955[_0xb294('0x50')]||![],'smsPause':_0x21c955['loginInPause']||![],'openchannelPause':_0x21c955[_0xb294('0x50')]||![],'pauseType':_0x21c955[_0xb294('0x50')]?_0xb294('0x55'):null,'lastPauseAt':moment()[_0xb294('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4eb66b});}})[_0xb294('0x10')](function(_0x27542a){_0x8b7ff3(_0x27542a);})[_0xb294('0x23')](function(_0x228c4e){_0x1ee7b5(_0x50e335['error'](0x1f4,_0x228c4e[_0xb294('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index e72f739..92027cc 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 _0xa698=['emit','removeListener','register','length','user:','./user.events','save','remove','update'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xa698,0x1b5));var _0x8a69=function(_0x13fb93,_0x595468){_0x13fb93=_0x13fb93-0x0;var _0x334dc4=_0xa698[_0x13fb93];return _0x334dc4;};'use strict';var UserEvents=require(_0x8a69('0x0'));var events=[_0x8a69('0x1'),_0x8a69('0x2'),_0x8a69('0x3')];function createListener(_0x392429,_0x58841c){return function(_0x1fbdb8){_0x58841c[_0x8a69('0x4')](_0x392429,_0x1fbdb8);};}function removeListener(_0x56b8b8,_0x17ca12){return function(){UserEvents[_0x8a69('0x5')](_0x56b8b8,_0x17ca12);};}exports[_0x8a69('0x6')]=function(_0x134d21){for(var _0x13a151=0x0,_0x403a67=events[_0x8a69('0x7')];_0x13a151<_0x403a67;_0x13a151++){var _0x3705e2=events[_0x13a151];var _0x5368e0=createListener(_0x8a69('0x8')+_0x3705e2,_0x134d21);UserEvents['on'](_0x3705e2,_0x5368e0);}}; \ No newline at end of file +var _0xac32=['remove','emit','removeListener','user:','./user.events','save'];(function(_0x169250,_0x249036){var _0x5d489e=function(_0x1db482){while(--_0x1db482){_0x169250['push'](_0x169250['shift']());}};_0x5d489e(++_0x249036);}(_0xac32,0x1de));var _0x2ac3=function(_0x28c1c9,_0x51f155){_0x28c1c9=_0x28c1c9-0x0;var _0x4e588e=_0xac32[_0x28c1c9];return _0x4e588e;};'use strict';var UserEvents=require(_0x2ac3('0x0'));var events=[_0x2ac3('0x1'),_0x2ac3('0x2'),'update'];function createListener(_0x2308ce,_0x1361a5){return function(_0x567e7d){_0x1361a5[_0x2ac3('0x3')](_0x2308ce,_0x567e7d);};}function removeListener(_0x296c5a,_0xe4b7e2){return function(){UserEvents[_0x2ac3('0x4')](_0x296c5a,_0xe4b7e2);};}exports['register']=function(_0x1769fd){for(var _0x1da621=0x0,_0xb8b4f0=events['length'];_0x1da621<_0xb8b4f0;_0x1da621++){var _0x4d4ff8=events[_0x1da621];var _0x39dfb8=createListener(_0x2ac3('0x5')+_0x4d4ff8,_0x1769fd);UserEvents['on'](_0x4d4ff8,_0x39dfb8);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index aeccc2b..6acc36e 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x288ceb,_0x185eaf){var _0x5368a9=function(_0x15e601){while(--_0x15e601){_0x288ceb['push'](_0x288ceb['shift']());}};_0x5368a9(++_0x185eaf);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x47b37e,_0x5afb98){var _0x1c1eb9=function(_0x59c1a3){while(--_0x59c1a3){_0x47b37e['push'](_0x47b37e['shift']());}};_0x1c1eb9(++_0x5afb98);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 75ef55a..25dafa1 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 _0xa4e4=['sequelize','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa4e4,0x1de));var _0x4a4e=function(_0x16e1d5,_0x26b53b){_0x16e1d5=_0x16e1d5-0x0;var _0x534f2c=_0xa4e4[_0x16e1d5];return _0x534f2c;};'use strict';var Sequelize=require(_0x4a4e('0x0'));module[_0x4a4e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x890c=['exports','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x890c,0xf1));var _0xc890=function(_0x2ecdd9,_0x43fa85){_0x2ecdd9=_0x2ecdd9-0x0;var _0xbee666=_0x890c[_0x2ecdd9];return _0xbee666;};'use strict';var Sequelize=require(_0xc890('0x0'));module[_0xc890('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index afe9560..21d6a27 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 _0x87a0=['api','moment','bluebird','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x3b0152,_0x2e2105){var _0x478f7b=function(_0x236088){while(--_0x236088){_0x3b0152['push'](_0x3b0152['shift']());}};_0x478f7b(++_0x2e2105);}(_0x87a0,0x81));var _0x087a=function(_0x5be281,_0x3ef1da){_0x5be281=_0x5be281-0x0;var _0x5968a1=_0x87a0[_0x5be281];return _0x5968a1;};'use strict';var _=require(_0x087a('0x0'));var util=require(_0x087a('0x1'));var logger=require(_0x087a('0x2'))(_0x087a('0x3'));var moment=require(_0x087a('0x4'));var BPromise=require(_0x087a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x087a('0x6'));var config=require(_0x087a('0x7'));var attributes=require(_0x087a('0x8'));module[_0x087a('0x9')]=function(_0x1c2b53,_0x45db3c){return _0x1c2b53['define'](_0x087a('0xa'),attributes,{'tableName':_0x087a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7095=['moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0x4d3ab7,_0x5abbbe){var _0x293462=function(_0x4dd7eb){while(--_0x4dd7eb){_0x4d3ab7['push'](_0x4d3ab7['shift']());}};_0x293462(++_0x5abbbe);}(_0x7095,0x114));var _0x5709=function(_0x20d6eb,_0x204347){_0x20d6eb=_0x20d6eb-0x0;var _0xe2c3d9=_0x7095[_0x20d6eb];return _0xe2c3d9;};'use strict';var _=require(_0x5709('0x0'));var util=require(_0x5709('0x1'));var logger=require(_0x5709('0x2'))(_0x5709('0x3'));var moment=require(_0x5709('0x4'));var BPromise=require('bluebird');var rp=require(_0x5709('0x5'));var fs=require('fs');var path=require(_0x5709('0x6'));var rimraf=require(_0x5709('0x7'));var config=require(_0x5709('0x8'));var attributes=require(_0x5709('0x9'));module[_0x5709('0xa')]=function(_0x15d0df,_0x41cf64){return _0x15d0df[_0x5709('0xb')](_0x5709('0xc'),attributes,{'tableName':_0x5709('0xd'),'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 1d95389..83cd579 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 _0xb259=['request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb259,0x173));var _0x9b25=function(_0xfc36d8,_0x233b0b){_0xfc36d8=_0xfc36d8-0x0;var _0x234f42=_0xb259[_0xfc36d8];return _0x234f42;};'use strict';var _=require(_0x9b25('0x0'));var util=require(_0x9b25('0x1'));var moment=require(_0x9b25('0x2'));var BPromise=require(_0x9b25('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b25('0x4'))['db'];var utils=require(_0x9b25('0x5'));var logger=require('../../config/logger')(_0x9b25('0x6'));var config=require(_0x9b25('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9b25('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4afcc0,_0x2dc3b0,_0x226854){return new BPromise(function(_0xe0415,_0x501be7){return client[_0x9b25('0x9')](_0x4afcc0,_0x226854)['then'](function(_0x167270){logger[_0x9b25('0xa')](_0x9b25('0xb'),_0x2dc3b0,_0x9b25('0xc'));logger[_0x9b25('0xd')](_0x9b25('0xe'),_0x2dc3b0,_0x9b25('0xc'),JSON['stringify'](_0x167270));if(_0x167270['error']){if(_0x167270[_0x9b25('0xf')][_0x9b25('0x10')]===0x1f4){logger[_0x9b25('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x2dc3b0,_0x167270['error'][_0x9b25('0x11')]);return _0x501be7(_0x167270[_0x9b25('0xf')]['message']);}logger['error'](_0x9b25('0xb'),_0x2dc3b0,_0x167270['error'][_0x9b25('0x11')]);return _0xe0415(_0x167270[_0x9b25('0xf')][_0x9b25('0x11')]);}else{logger[_0x9b25('0xa')](_0x9b25('0xb'),_0x2dc3b0,_0x9b25('0xc'));_0xe0415(_0x167270[_0x9b25('0x12')][_0x9b25('0x11')]);}})[_0x9b25('0x13')](function(_0x34bbf8){logger[_0x9b25('0xf')](_0x9b25('0xb'),_0x2dc3b0,_0x34bbf8);_0x501be7(_0x34bbf8);});});} \ No newline at end of file +var _0xc446=['jayson/promise','http','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x28b1ac,_0x2981ba){var _0xbf4fe1=function(_0x3d7b86){while(--_0x3d7b86){_0x28b1ac['push'](_0x28b1ac['shift']());}};_0xbf4fe1(++_0x2981ba);}(_0xc446,0x1ad));var _0x6c44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc446[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c44('0x0'));var util=require(_0x6c44('0x1'));var moment=require(_0x6c44('0x2'));var BPromise=require(_0x6c44('0x3'));var rs=require(_0x6c44('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c44('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6c44('0x6'));var config=require(_0x6c44('0x7'));var jayson=require(_0x6c44('0x8'));var client=jayson['client'][_0x6c44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a8d08,_0x56a709,_0x53c729){return new BPromise(function(_0x49189b,_0x417245){return client['request'](_0x1a8d08,_0x53c729)[_0x6c44('0xa')](function(_0x3b487e){logger[_0x6c44('0xb')](_0x6c44('0xc'),_0x56a709,'request\x20sent');logger[_0x6c44('0xd')](_0x6c44('0xe'),_0x56a709,_0x6c44('0xf'),JSON['stringify'](_0x3b487e));if(_0x3b487e[_0x6c44('0x10')]){if(_0x3b487e['error']['code']===0x1f4){logger[_0x6c44('0x10')](_0x6c44('0xc'),_0x56a709,_0x3b487e[_0x6c44('0x10')]['message']);return _0x417245(_0x3b487e[_0x6c44('0x10')][_0x6c44('0x11')]);}logger[_0x6c44('0x10')](_0x6c44('0xc'),_0x56a709,_0x3b487e['error'][_0x6c44('0x11')]);return _0x49189b(_0x3b487e[_0x6c44('0x10')][_0x6c44('0x11')]);}else{logger[_0x6c44('0xb')](_0x6c44('0xc'),_0x56a709,'request\x20sent');_0x49189b(_0x3b487e['result']['message']);}})[_0x6c44('0x12')](function(_0x176694){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x56a709,_0x176694);_0x417245(_0x176694);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2df39c5..c8fdd66 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x302e06,_0x40b336){var _0x22987e=function(_0x4c509a){while(--_0x4c509a){_0x302e06['push'](_0x302e06['shift']());}};_0x22987e(++_0x40b336);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xa7d462,_0x27679f){var _0x410b13=function(_0xa1596d){while(--_0xa1596d){_0xa7d462['push'](_0xa7d462['shift']());}};_0x410b13(++_0x27679f);}(_0xedd9,0xfc));var _0x9edd=function(_0x526da6,_0x3c4584){_0x526da6=_0x526da6-0x0;var _0x485241=_0xedd9[_0x526da6];return _0x485241;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a707c97..93327b3 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 _0xb80c=['INTEGER','exports'];(function(_0x425d46,_0x38d08a){var _0x43cd97=function(_0x485ea8){while(--_0x485ea8){_0x425d46['push'](_0x425d46['shift']());}};_0x43cd97(++_0x38d08a);}(_0xb80c,0xb3));var _0xcb80=function(_0x127257,_0x1cce66){_0x127257=_0x127257-0x0;var _0x54efcc=_0xb80c[_0x127257];return _0x54efcc;};'use strict';var Sequelize=require('sequelize');module[_0xcb80('0x0')]={'penalty':{'type':Sequelize[_0xcb80('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcb80('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa4f2=['INTEGER','STRING'];(function(_0x10385f,_0x1f7083){var _0xa48457=function(_0x5dceba){while(--_0x5dceba){_0x10385f['push'](_0x10385f['shift']());}};_0xa48457(++_0x1f7083);}(_0xa4f2,0xee));var _0x2a4f=function(_0x52e272,_0x3ee0e3){_0x52e272=_0x52e272-0x0;var _0x34f3a2=_0xa4f2[_0x52e272];return _0x34f3a2;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x2a4f('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2a4f('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index cd19182..3b54f66 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 _0xffac=['exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x484387,_0x3fe5a3){var _0x108c80=function(_0x268f29){while(--_0x268f29){_0x484387['push'](_0x484387['shift']());}};_0x108c80(++_0x3fe5a3);}(_0xffac,0xc8));var _0xcffa=function(_0x1701ce,_0x2bccf9){_0x1701ce=_0x1701ce-0x0;var _0x1446eb=_0xffac[_0x1701ce];return _0x1446eb;};'use strict';var _=require(_0xcffa('0x0'));var util=require(_0xcffa('0x1'));var logger=require(_0xcffa('0x2'))(_0xcffa('0x3'));var moment=require(_0xcffa('0x4'));var BPromise=require(_0xcffa('0x5'));var rp=require(_0xcffa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcffa('0x7'));var config=require(_0xcffa('0x8'));var attributes=require(_0xcffa('0x9'));module[_0xcffa('0xa')]=function(_0x3be13f,_0xaa2c74){return _0x3be13f[_0xcffa('0xb')](_0xcffa('0xc'),attributes,{'tableName':_0xcffa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2272=['util','api','moment','request-promise','path','rimraf','./userFaxQueue.attributes','exports','user_has_fax_queues'];(function(_0x34fd8a,_0x4e685e){var _0x399f5=function(_0x40ac82){while(--_0x40ac82){_0x34fd8a['push'](_0x34fd8a['shift']());}};_0x399f5(++_0x4e685e);}(_0x2272,0x1b0));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x2227('0x0'));var logger=require('../../config/logger')(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require('bluebird');var rp=require(_0x2227('0x3'));var fs=require('fs');var path=require(_0x2227('0x4'));var rimraf=require(_0x2227('0x5'));var config=require('../../config/environment');var attributes=require(_0x2227('0x6'));module[_0x2227('0x7')]=function(_0x1e01ea,_0x50eb53){return _0x1e01ea['define']('UserFaxQueue',attributes,{'tableName':_0x2227('0x8'),'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 9748ad5..e0cf378 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 _0x64ce=['http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x64ce,0x1b0));var _0xe64c=function(_0xb02eed,_0x13d074){_0xb02eed=_0xb02eed-0x0;var _0x43455b=_0x64ce[_0xb02eed];return _0x43455b;};'use strict';var _=require(_0xe64c('0x0'));var util=require(_0xe64c('0x1'));var moment=require(_0xe64c('0x2'));var BPromise=require(_0xe64c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe64c('0x4'));var db=require(_0xe64c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe64c('0x6'));var jayson=require(_0xe64c('0x7'));var client=jayson[_0xe64c('0x8')][_0xe64c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x163064,_0x3718bd,_0x16c320){return new BPromise(function(_0x34fa58,_0x465129){return client[_0xe64c('0xa')](_0x163064,_0x16c320)[_0xe64c('0xb')](function(_0x364c19){logger[_0xe64c('0xc')](_0xe64c('0xd'),_0x3718bd,_0xe64c('0xe'));logger['debug'](_0xe64c('0xf'),_0x3718bd,_0xe64c('0xe'),JSON[_0xe64c('0x10')](_0x364c19));if(_0x364c19[_0xe64c('0x11')]){if(_0x364c19[_0xe64c('0x11')][_0xe64c('0x12')]===0x1f4){logger[_0xe64c('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x3718bd,_0x364c19[_0xe64c('0x11')]['message']);return _0x465129(_0x364c19[_0xe64c('0x11')][_0xe64c('0x13')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3718bd,_0x364c19[_0xe64c('0x11')][_0xe64c('0x13')]);return _0x34fa58(_0x364c19[_0xe64c('0x11')][_0xe64c('0x13')]);}else{logger[_0xe64c('0xc')](_0xe64c('0xd'),_0x3718bd,_0xe64c('0xe'));_0x34fa58(_0x364c19['result'][_0xe64c('0x13')]);}})[_0xe64c('0x14')](function(_0x321a95){logger['error'](_0xe64c('0xd'),_0x3718bd,_0x321a95);_0x465129(_0x321a95);});});} \ No newline at end of file +var _0xcb57=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','result'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcb57,0xfe));var _0x7cb5=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xcb57[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x7cb5('0x0'));var util=require(_0x7cb5('0x1'));var moment=require(_0x7cb5('0x2'));var BPromise=require('bluebird');var rs=require(_0x7cb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cb5('0x4'))['db'];var utils=require(_0x7cb5('0x5'));var logger=require(_0x7cb5('0x6'))(_0x7cb5('0x7'));var config=require(_0x7cb5('0x8'));var jayson=require(_0x7cb5('0x9'));var client=jayson[_0x7cb5('0xa')][_0x7cb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d388c,_0xf831d9,_0x246a3d){return new BPromise(function(_0x29f584,_0xc45bbc){return client['request'](_0x1d388c,_0x246a3d)[_0x7cb5('0xc')](function(_0x389f3c){logger[_0x7cb5('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0xf831d9,_0x7cb5('0xe'));logger[_0x7cb5('0xf')](_0x7cb5('0x10'),_0xf831d9,_0x7cb5('0xe'),JSON['stringify'](_0x389f3c));if(_0x389f3c[_0x7cb5('0x11')]){if(_0x389f3c['error'][_0x7cb5('0x12')]===0x1f4){logger[_0x7cb5('0x11')](_0x7cb5('0x13'),_0xf831d9,_0x389f3c[_0x7cb5('0x11')]['message']);return _0xc45bbc(_0x389f3c[_0x7cb5('0x11')][_0x7cb5('0x14')]);}logger['error'](_0x7cb5('0x13'),_0xf831d9,_0x389f3c[_0x7cb5('0x11')][_0x7cb5('0x14')]);return _0x29f584(_0x389f3c['error'][_0x7cb5('0x14')]);}else{logger[_0x7cb5('0xd')](_0x7cb5('0x13'),_0xf831d9,'request\x20sent');_0x29f584(_0x389f3c[_0x7cb5('0x15')][_0x7cb5('0x14')]);}})[_0x7cb5('0x16')](function(_0x4b7fe4){logger[_0x7cb5('0x11')](_0x7cb5('0x13'),_0xf831d9,_0x4b7fe4);_0xc45bbc(_0x4b7fe4);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index aeb38f7..84413d3 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5b6d34,_0x2a32a0){var _0x65eb46=function(_0x2fed53){while(--_0x2fed53){_0x5b6d34['push'](_0x5b6d34['shift']());}};_0x65eb46(++_0x2a32a0);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2053aa,_0x3df40e){var _0x30f5bb=function(_0x1b3f36){while(--_0x1b3f36){_0x2053aa['push'](_0x2053aa['shift']());}};_0x30f5bb(++_0x3df40e);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 3e05628..af36b9c 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 _0x0e34=['INTEGER','sequelize'];(function(_0x3ee917,_0x3eeb1b){var _0xa190e4=function(_0x5db709){while(--_0x5db709){_0x3ee917['push'](_0x3ee917['shift']());}};_0xa190e4(++_0x3eeb1b);}(_0x0e34,0x13d));var _0x40e3=function(_0x1dd52d,_0x3b6332){_0x1dd52d=_0x1dd52d-0x0;var _0x25c746=_0x0e34[_0x1dd52d];return _0x25c746;};'use strict';var Sequelize=require(_0x40e3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x40e3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3dc1=['INTEGER'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3dc1,0x127));var _0x13dc=function(_0x1933f2,_0x18e28c){_0x1933f2=_0x1933f2-0x0;var _0x3c87e9=_0x3dc1[_0x1933f2];return _0x3c87e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x13dc('0x0')],'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 48024de..e40caa6 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 _0x087b=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','user_has_mail_queues','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x087b,0x16a));var _0xb087=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x087b[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var logger=require(_0xb087('0x2'))(_0xb087('0x3'));var moment=require(_0xb087('0x4'));var BPromise=require(_0xb087('0x5'));var rp=require(_0xb087('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb087('0x7'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0xb087('0x8')]=function(_0x278284,_0x3fd4ec){return _0x278284[_0xb087('0x9')]('UserMailQueue',attributes,{'tableName':_0xb087('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfbe=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x53dcd1,_0x89f9a5){var _0xc829ec=function(_0x48dd51){while(--_0x48dd51){_0x53dcd1['push'](_0x53dcd1['shift']());}};_0xc829ec(++_0x89f9a5);}(_0xbfbe,0x1d4));var _0xebfb=function(_0x4ddfc9,_0x23f05f){_0x4ddfc9=_0x4ddfc9-0x0;var _0x47da83=_0xbfbe[_0x4ddfc9];return _0x47da83;};'use strict';var _=require(_0xebfb('0x0'));var util=require(_0xebfb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xebfb('0x2'));var BPromise=require(_0xebfb('0x3'));var rp=require(_0xebfb('0x4'));var fs=require('fs');var path=require(_0xebfb('0x5'));var rimraf=require(_0xebfb('0x6'));var config=require(_0xebfb('0x7'));var attributes=require(_0xebfb('0x8'));module[_0xebfb('0x9')]=function(_0x125dcd,_0x30acd8){return _0x125dcd[_0xebfb('0xa')](_0xebfb('0xb'),attributes,{'tableName':'user_has_mail_queues','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 2277960..43abecb 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x008c,0x188));var _0xc008=function(_0x3c49b2,_0x285e48){_0x3c49b2=_0x3c49b2-0x0;var _0x2d9203=_0x008c[_0x3c49b2];return _0x2d9203;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x1d70f6,_0x2f5e01){var _0x4a44cc=function(_0x3c990e){while(--_0x3c990e){_0x1d70f6['push'](_0x1d70f6['shift']());}};_0x4a44cc(++_0x2f5e01);}(_0xe14b,0x93));var _0xbe14=function(_0x2c47e0,_0x1e4b09){_0x2c47e0=_0x2c47e0-0x0;var _0x533890=_0xe14b[_0x2c47e0];return _0x533890;};'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/userNotification/index.js b/server/api/userNotification/index.js index 061a1b7..7ad543f 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 _0x91e3=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','sendUserNotification'];(function(_0x3fecd6,_0x23a98e){var _0x4883ad=function(_0x45a87e){while(--_0x45a87e){_0x3fecd6['push'](_0x3fecd6['shift']());}};_0x4883ad(++_0x23a98e);}(_0x91e3,0x65));var _0x391e=function(_0x15681d,_0x40d775){_0x15681d=_0x15681d-0x0;var _0x21f3df=_0x91e3[_0x15681d];return _0x21f3df;};'use strict';var multer=require(_0x391e('0x0'));var util=require(_0x391e('0x1'));var path=require(_0x391e('0x2'));var timeout=require('connect-timeout');var express=require(_0x391e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x391e('0x4'));var interaction=require(_0x391e('0x5'));var config=require('../../config/environment');var controller=require(_0x391e('0x6'));router[_0x391e('0x7')]('/',auth['isAuthenticated'](),controller[_0x391e('0x8')]);module[_0x391e('0x9')]=router; \ No newline at end of file +var _0x3650=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x765a0e,_0x380989){var _0x47bc23=function(_0x3fb066){while(--_0x3fb066){_0x765a0e['push'](_0x765a0e['shift']());}};_0x47bc23(++_0x380989);}(_0x3650,0xa1));var _0x0365=function(_0x1de164,_0x1ccf5f){_0x1de164=_0x1de164-0x0;var _0x5613b4=_0x3650[_0x1de164];return _0x5613b4;};'use strict';var multer=require(_0x0365('0x0'));var util=require('util');var path=require(_0x0365('0x1'));var timeout=require(_0x0365('0x2'));var express=require(_0x0365('0x3'));var router=express[_0x0365('0x4')]();var fs_extra=require(_0x0365('0x5'));var auth=require(_0x0365('0x6'));var interaction=require(_0x0365('0x7'));var config=require(_0x0365('0x8'));var controller=require(_0x0365('0x9'));router[_0x0365('0xa')]('/',auth[_0x0365('0xb')](),controller[_0x0365('0xc')]);module[_0x0365('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 abea867..3070ddc 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 _0x010b=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x5471fd,_0x360767){var _0x1a46bd=function(_0x5c3983){while(--_0x5c3983){_0x5471fd['push'](_0x5471fd['shift']());}};_0x1a46bd(++_0x360767);}(_0x010b,0xac));var _0xb010=function(_0x735ff7,_0x4d7544){_0x735ff7=_0x735ff7-0x0;var _0x253992=_0x010b[_0x735ff7];return _0x253992;};'use strict';var Sequelize=require(_0xb010('0x0'));module[_0xb010('0x1')]={'body':{'type':Sequelize[_0xb010('0x2')]},'senderName':{'type':Sequelize[_0xb010('0x3')]},'recipientsId':{'type':Sequelize[_0xb010('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xb010('0x4')]}}; \ No newline at end of file +var _0xd463=['BOOLEAN','exports','STRING','TEXT'];(function(_0x144fda,_0x5bcf4b){var _0x290a40=function(_0x4c79ff){while(--_0x4c79ff){_0x144fda['push'](_0x144fda['shift']());}};_0x290a40(++_0x5bcf4b);}(_0xd463,0xdd));var _0x3d46=function(_0x3b2526,_0x278079){_0x3b2526=_0x3b2526-0x0;var _0x5e40bf=_0xd463[_0x3b2526];return _0x5e40bf;};'use strict';var Sequelize=require('sequelize');module[_0x3d46('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x3d46('0x1')]},'recipientsId':{'type':Sequelize[_0x3d46('0x2')]},'recipientsDescription':{'type':Sequelize[_0x3d46('0x1')]},'beep':{'type':Sequelize[_0x3d46('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index f153b5e..b5b65e1 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 _0x53a4=['startCase','union','queue','replace','Queue','forEach','push','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','redis','defaults','register','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27recipients\x27\x20parameter','recipients','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','senderName','fullname','recipientsDescription','beep','SenderId','user','recipientsId','join','sequelize','transaction','UserNotification','emit','catch','Template','findOne','render','html'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53a4,0x1e0));var _0x453a=function(_0x54772e,_0x48a173){_0x54772e=_0x54772e-0x0;var _0x496fce=_0x53a4[_0x54772e];return _0x496fce;};'use strict';var emlformat=require(_0x453a('0x0'));var rimraf=require(_0x453a('0x1'));var zipdir=require(_0x453a('0x2'));var jsonpatch=require(_0x453a('0x3'));var rp=require(_0x453a('0x4'));var moment=require(_0x453a('0x5'));var BPromise=require(_0x453a('0x6'));var Mustache=require(_0x453a('0x7'));var util=require(_0x453a('0x8'));var path=require(_0x453a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x453a('0xa'));var _=require(_0x453a('0xb'));var squel=require(_0x453a('0xc'));var crypto=require(_0x453a('0xd'));var jsforce=require(_0x453a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x453a('0xf'));var querystring=require(_0x453a('0x10'));var Papa=require(_0x453a('0x11'));var Redis=require(_0x453a('0x12'));var authService=require(_0x453a('0x13'));var qs=require(_0x453a('0x14'));var as=require(_0x453a('0x15'));var hardwareService=require(_0x453a('0x16'));var logger=require(_0x453a('0x17'))(_0x453a('0x18'));var utils=require('../../config/utils');var config=require(_0x453a('0x19'));var licenseUtil=require(_0x453a('0x1a'));var db=require('../../mysqldb')['db'];config[_0x453a('0x1b')]=_[_0x453a('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x453a('0x1b')]));require('./userNotification.socket')[_0x453a('0x1d')](socket);function respondWithStatusCode(_0x4d3ba8,_0x52ff16){_0x52ff16=_0x52ff16||0xcc;return function(_0x176b9b){if(_0x176b9b){return _0x4d3ba8[_0x453a('0x1e')](_0x52ff16);}return _0x4d3ba8[_0x453a('0x1f')](_0x52ff16)[_0x453a('0x20')]();};}function respondWithResult(_0x5d006c,_0x35aad2){_0x35aad2=_0x35aad2||0xc8;return function(_0x59b7e1){if(_0x59b7e1){return _0x5d006c[_0x453a('0x1f')](_0x35aad2)[_0x453a('0x21')](_0x59b7e1);}};}function respondWithFilteredResult(_0x49acc4,_0x256438){return function(_0x180e9c){if(_0x180e9c){var _0xd7e712=typeof _0x256438['offset']===_0x453a('0x22')&&typeof _0x256438['limit']===_0x453a('0x22');var _0x199861=_0x180e9c[_0x453a('0x23')];var _0x1941da=_0xd7e712?0x0:_0x256438[_0x453a('0x24')];var _0x4b1ddf=_0xd7e712?_0x180e9c['count']:_0x256438[_0x453a('0x24')]+_0x256438['limit'];var _0x1a209f;if(_0x4b1ddf>=_0x199861){_0x4b1ddf=_0x199861;_0x1a209f=0xc8;}else{_0x1a209f=0xce;}_0x49acc4[_0x453a('0x1f')](_0x1a209f);return _0x49acc4['set'](_0x453a('0x25'),_0x1941da+'-'+_0x4b1ddf+'/'+_0x199861)[_0x453a('0x21')](_0x180e9c);}return null;};}function patchUpdates(_0x5f327c){return function(_0x3eb9b8){try{jsonpatch[_0x453a('0x26')](_0x3eb9b8,_0x5f327c,!![]);}catch(_0x15036f){return BPromise[_0x453a('0x27')](_0x15036f);}return _0x3eb9b8[_0x453a('0x28')]();};}function saveUpdates(_0x5ae3b1,_0x1dde7d){return function(_0x4d7880){if(_0x4d7880){return _0x4d7880[_0x453a('0x29')](_0x5ae3b1)['then'](function(_0x4d7983){return _0x4d7983;});}return null;};}function removeEntity(_0x459af2,_0x35eaf3){return function(_0xe8bc2d){if(_0xe8bc2d){return _0xe8bc2d[_0x453a('0x2a')]()[_0x453a('0x2b')](function(){_0x459af2[_0x453a('0x1f')](0xcc)[_0x453a('0x20')]();});}};}function handleEntityNotFound(_0x587c06,_0x277978){return function(_0x1fff6e){if(!_0x1fff6e){_0x587c06[_0x453a('0x1e')](0x194);}return _0x1fff6e;};}function handleError(_0x47347f,_0x35d2ce){_0x35d2ce=_0x35d2ce||0x1f4;return function(_0x130cae){logger[_0x453a('0x2c')](_0x130cae['stack']);if(_0x130cae['name']){delete _0x130cae[_0x453a('0x2d')];}_0x47347f[_0x453a('0x1f')](_0x35d2ce)['send'](_0x130cae);};}exports[_0x453a('0x2e')]=function(_0x537470,_0x52b1b3,_0x5daf6f){if(!_0x537470[_0x453a('0x2f')][_0x453a('0x30')](_0x453a('0x31'))&&!_0x537470[_0x453a('0x2f')][_0x453a('0x30')](_0x453a('0x32'))){throw new db[(_0x453a('0x33'))][(_0x453a('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x537470[_0x453a('0x2f')][_0x453a('0x30')]('TemplateId')&&!_0x537470[_0x453a('0x2f')][_0x453a('0x30')](_0x453a('0x35'))){throw new db['Sequelize'][(_0x453a('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x537470[_0x453a('0x2f')]['hasOwnProperty']('recipients')){throw new db[(_0x453a('0x33'))]['ValidationError'](_0x453a('0x36'));}else{try{var _0x29c65=JSON['parse'](_0x537470[_0x453a('0x2f')][_0x453a('0x37')]);}catch(_0x437e21){logger[_0x453a('0x2c')](_0x437e21);throw new db[(_0x453a('0x33'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x2157c7=[_0x453a('0x38'),_0x453a('0x39'),_0x453a('0x3a'),_0x453a('0x3b'),_0x453a('0x3c'),_0x453a('0x3d'),_0x453a('0x3e'),_0x453a('0x3f'),'user'];if(_[_0x453a('0x40')](_0x29c65,function(_0x27ed0f){return!_[_0x453a('0x41')](_0x2157c7,_0x27ed0f[_0x453a('0x42')]['toLowerCase']());})){throw new db['Sequelize'][(_0x453a('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2def52={};_0x2def52[_0x453a('0x43')]=_0x537470['body']['hasOwnProperty']('senderName')?_0x537470[_0x453a('0x2f')]['senderName']:_0x537470['user'][_0x453a('0x44')];_0x2def52[_0x453a('0x45')]=_['isEmpty'](_0x537470['body'][_0x453a('0x45')])?null:_0x537470[_0x453a('0x2f')]['recipientsDescription'];_0x2def52[_0x453a('0x46')]=_0x537470[_0x453a('0x2f')]['beep']||![];_0x2def52[_0x453a('0x47')]=_0x537470[_0x453a('0x48')]['id'];return getContent(_0x537470['body'])[_0x453a('0x2b')](function(_0x559767){_0x2def52['body']=_0x559767;return getRecipients(_0x29c65);})[_0x453a('0x2b')](function(_0x4c608c){_0x2def52[_0x453a('0x49')]=_['sortBy'](_0x4c608c)[_0x453a('0x4a')](',');return db[_0x453a('0x4b')][_0x453a('0x4c')](function(_0x554ff0){return db[_0x453a('0x4d')]['create'](_0x2def52,{'raw':!![],'transaction':_0x554ff0})[_0x453a('0x2b')](function(_0x4807f1){var _0x500e4a={'sender':_0x2def52['senderName'],'description':_0x2def52[_0x453a('0x45')],'content':_0x2def52[_0x453a('0x2f')],'beep':_0x2def52['beep']};_0x4c608c['forEach'](function(_0xb3eb5a){_0x500e4a['recipient']=_0xb3eb5a;socket[_0x453a('0x4e')]('userNotification:send',_0x500e4a);});return _0x4807f1;});});})[_0x453a('0x2b')](respondWithResult(_0x52b1b3,0xc9))[_0x453a('0x4f')](handleError(_0x52b1b3,null));};function getContent(_0x117ca0){return new BPromise(function(_0x42de60,_0x2449c6){if(_0x117ca0[_0x453a('0x31')]){_0x42de60(_0x117ca0['text']);return;}return db[_0x453a('0x50')][_0x453a('0x51')]({'attributes':['html'],'where':{'id':_0x117ca0[_0x453a('0x32')]},'raw':!![]})['then'](function(_0xf1c7a8){if(!_0xf1c7a8)throw new db[(_0x453a('0x33'))][(_0x453a('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x370abf=Mustache[_0x453a('0x52')](_0xf1c7a8[_0x453a('0x53')],_0x117ca0['view']);_0x42de60(_0x370abf);})[_0x453a('0x4f')](function(_0xc80579){_0x2449c6(_0xc80579);});});}function getRecipients(_0x1d3d33){return new BPromise(function(_0x1a4b45,_0x6e6b22){var _0x5f21d9=[];var _0x122609=[];_0x1d3d33['forEach'](function(_0x41cbd0){var _0xc5f402=_[_0x453a('0x54')](_0x41cbd0[_0x453a('0x42')]['toLowerCase']());if(_0xc5f402==='User'){_0x5f21d9=_[_0x453a('0x55')](_0x5f21d9,_0x41cbd0['ids']);}else{if(_['includes'](_0xc5f402,_0x453a('0x56')))_0xc5f402=_0xc5f402[_0x453a('0x57')](_0x453a('0x56'),_0x453a('0x58'));_0x41cbd0['ids'][_0x453a('0x59')](function(_0x4d3129){_0x122609[_0x453a('0x5a')](getAgents(_0xc5f402,_0x4d3129));});}});return BPromise[_0x453a('0x5b')](_0x122609)[_0x453a('0x2b')](function(_0x2a6875){_0x5f21d9=_[_0x453a('0x55')](_0x5f21d9,_['flatten'](_0x2a6875));_0x1a4b45(_0x5f21d9);})[_0x453a('0x4f')](function(_0x2312fe){_0x6e6b22(_0x2312fe);});});}function getAgents(_0xb8791a,_0x14dc06){return new BPromise(function(_0xee19f5,_0x40f072){return db[_0xb8791a][_0x453a('0x51')]({'where':{'id':_0x14dc06}})[_0x453a('0x2b')](function(_0x37f396){return _0x37f396[_0x453a('0x5c')]({'attributes':['id'],'raw':!![]})[_0x453a('0x2b')](function(_0x33ccf9){var _0x1bf881=_[_0x453a('0x5d')](_0x33ccf9,'id');_0xee19f5(_0x1bf881);});})['catch'](function(_0x1d696b){_0x40f072(_0x1d696b);});});} \ No newline at end of file +var _0xb038=['mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','then','error','stack','name','body','text','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','user','some','toLowerCase','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','UserNotification','create','forEach','recipient','userNotification:send','Template','html','render','startCase','model','User','union','ids','includes','queue','push','all','flatten','catch','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x436517,_0x3efee3){var _0x2b00e1=function(_0x183c8a){while(--_0x183c8a){_0x436517['push'](_0x436517['shift']());}};_0x2b00e1(++_0x3efee3);}(_0xb038,0xb3));var _0x8b03=function(_0x1de998,_0x449e5e){_0x1de998=_0x1de998-0x0;var _0x3dde4d=_0xb038[_0x1de998];return _0x3dde4d;};'use strict';var emlformat=require(_0x8b03('0x0'));var rimraf=require(_0x8b03('0x1'));var zipdir=require(_0x8b03('0x2'));var jsonpatch=require(_0x8b03('0x3'));var rp=require(_0x8b03('0x4'));var moment=require(_0x8b03('0x5'));var BPromise=require(_0x8b03('0x6'));var Mustache=require(_0x8b03('0x7'));var util=require(_0x8b03('0x8'));var path=require(_0x8b03('0x9'));var sox=require(_0x8b03('0xa'));var csv=require('to-csv');var ejs=require(_0x8b03('0xb'));var fs=require('fs');var fs_extra=require(_0x8b03('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8b03('0xd'));var deskjs=require(_0x8b03('0xe'));var toCsv=require(_0x8b03('0xf'));var querystring=require(_0x8b03('0x10'));var Papa=require(_0x8b03('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8b03('0x12'));var as=require(_0x8b03('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b03('0x14'))(_0x8b03('0x15'));var utils=require(_0x8b03('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8b03('0x17'));var db=require('../../mysqldb')['db'];config[_0x8b03('0x18')]=_[_0x8b03('0x19')](config[_0x8b03('0x18')],{'host':_0x8b03('0x1a'),'port':0x18eb});var socket=require(_0x8b03('0x1b'))(new Redis(config['redis']));require(_0x8b03('0x1c'))['register'](socket);function respondWithStatusCode(_0xf62e42,_0x1cadf9){_0x1cadf9=_0x1cadf9||0xcc;return function(_0x17cbfc){if(_0x17cbfc){return _0xf62e42[_0x8b03('0x1d')](_0x1cadf9);}return _0xf62e42[_0x8b03('0x1e')](_0x1cadf9)[_0x8b03('0x1f')]();};}function respondWithResult(_0x4c7fa9,_0x37d804){_0x37d804=_0x37d804||0xc8;return function(_0x32ff7e){if(_0x32ff7e){return _0x4c7fa9['status'](_0x37d804)[_0x8b03('0x20')](_0x32ff7e);}};}function respondWithFilteredResult(_0x504b26,_0x38617f){return function(_0x51f1d3){if(_0x51f1d3){var _0x3a9a56=typeof _0x38617f[_0x8b03('0x21')]===_0x8b03('0x22')&&typeof _0x38617f[_0x8b03('0x23')]===_0x8b03('0x22');var _0x362cab=_0x51f1d3['count'];var _0x42cbe7=_0x3a9a56?0x0:_0x38617f[_0x8b03('0x21')];var _0x3152dd=_0x3a9a56?_0x51f1d3[_0x8b03('0x24')]:_0x38617f[_0x8b03('0x21')]+_0x38617f[_0x8b03('0x23')];var _0x18089d;if(_0x3152dd>=_0x362cab){_0x3152dd=_0x362cab;_0x18089d=0xc8;}else{_0x18089d=0xce;}_0x504b26[_0x8b03('0x1e')](_0x18089d);return _0x504b26['set'](_0x8b03('0x25'),_0x42cbe7+'-'+_0x3152dd+'/'+_0x362cab)[_0x8b03('0x20')](_0x51f1d3);}return null;};}function patchUpdates(_0x5d4295){return function(_0x47668c){try{jsonpatch['apply'](_0x47668c,_0x5d4295,!![]);}catch(_0x1a5e44){return BPromise['reject'](_0x1a5e44);}return _0x47668c['save']();};}function saveUpdates(_0x4967cd,_0x167d82){return function(_0xfe02f2){if(_0xfe02f2){return _0xfe02f2[_0x8b03('0x26')](_0x4967cd)['then'](function(_0x113d1a){return _0x113d1a;});}return null;};}function removeEntity(_0x5cd786,_0x2d767c){return function(_0x4010d3){if(_0x4010d3){return _0x4010d3[_0x8b03('0x27')]()[_0x8b03('0x28')](function(){_0x5cd786[_0x8b03('0x1e')](0xcc)[_0x8b03('0x1f')]();});}};}function handleEntityNotFound(_0x574e73,_0x11571a){return function(_0xc54b52){if(!_0xc54b52){_0x574e73[_0x8b03('0x1d')](0x194);}return _0xc54b52;};}function handleError(_0x48878c,_0x458b5a){_0x458b5a=_0x458b5a||0x1f4;return function(_0x4ac4c8){logger[_0x8b03('0x29')](_0x4ac4c8[_0x8b03('0x2a')]);if(_0x4ac4c8[_0x8b03('0x2b')]){delete _0x4ac4c8['name'];}_0x48878c[_0x8b03('0x1e')](_0x458b5a)['send'](_0x4ac4c8);};}exports['sendUserNotification']=function(_0x35a97d,_0x334ab7,_0x4f647d){if(!_0x35a97d[_0x8b03('0x2c')]['hasOwnProperty'](_0x8b03('0x2d'))&&!_0x35a97d['body'][_0x8b03('0x2e')]('TemplateId')){throw new db[(_0x8b03('0x2f'))][(_0x8b03('0x30'))](_0x8b03('0x31'));}else{if(_0x35a97d[_0x8b03('0x2c')][_0x8b03('0x2e')](_0x8b03('0x32'))&&!_0x35a97d[_0x8b03('0x2c')][_0x8b03('0x2e')](_0x8b03('0x33'))){throw new db[(_0x8b03('0x2f'))][(_0x8b03('0x30'))](_0x8b03('0x34'));}if(!_0x35a97d[_0x8b03('0x2c')][_0x8b03('0x2e')]('recipients')){throw new db[(_0x8b03('0x2f'))][(_0x8b03('0x30'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x543803=JSON[_0x8b03('0x35')](_0x35a97d[_0x8b03('0x2c')][_0x8b03('0x36')]);}catch(_0x150b74){logger[_0x8b03('0x29')](_0x150b74);throw new db[(_0x8b03('0x2f'))][(_0x8b03('0x30'))](_0x8b03('0x37'));}var _0x50cfe1=[_0x8b03('0x38'),_0x8b03('0x39'),_0x8b03('0x3a'),_0x8b03('0x3b'),_0x8b03('0x3c'),'voicequeue','whatsappqueue','team',_0x8b03('0x3d')];if(_[_0x8b03('0x3e')](_0x543803,function(_0x439286){return!_['includes'](_0x50cfe1,_0x439286['model'][_0x8b03('0x3f')]());})){throw new db[(_0x8b03('0x2f'))][(_0x8b03('0x30'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2058a3={};_0x2058a3[_0x8b03('0x40')]=_0x35a97d['body'][_0x8b03('0x2e')](_0x8b03('0x40'))?_0x35a97d[_0x8b03('0x2c')][_0x8b03('0x40')]:_0x35a97d[_0x8b03('0x3d')]['fullname'];_0x2058a3[_0x8b03('0x41')]=_[_0x8b03('0x42')](_0x35a97d['body']['recipientsDescription'])?null:_0x35a97d['body']['recipientsDescription'];_0x2058a3[_0x8b03('0x43')]=_0x35a97d[_0x8b03('0x2c')]['beep']||![];_0x2058a3[_0x8b03('0x44')]=_0x35a97d[_0x8b03('0x3d')]['id'];return getContent(_0x35a97d[_0x8b03('0x2c')])[_0x8b03('0x28')](function(_0x42135b){_0x2058a3[_0x8b03('0x2c')]=_0x42135b;return getRecipients(_0x543803);})[_0x8b03('0x28')](function(_0x43e699){_0x2058a3[_0x8b03('0x45')]=_[_0x8b03('0x46')](_0x43e699)['join'](',');return db['sequelize']['transaction'](function(_0x1c0cf8){return db[_0x8b03('0x47')][_0x8b03('0x48')](_0x2058a3,{'raw':!![],'transaction':_0x1c0cf8})['then'](function(_0x34049f){var _0x30074e={'sender':_0x2058a3[_0x8b03('0x40')],'description':_0x2058a3[_0x8b03('0x41')],'content':_0x2058a3[_0x8b03('0x2c')],'beep':_0x2058a3['beep']};_0x43e699[_0x8b03('0x49')](function(_0x98d687){_0x30074e[_0x8b03('0x4a')]=_0x98d687;socket['emit'](_0x8b03('0x4b'),_0x30074e);});return _0x34049f;});});})[_0x8b03('0x28')](respondWithResult(_0x334ab7,0xc9))['catch'](handleError(_0x334ab7,null));};function getContent(_0x142f9e){return new BPromise(function(_0x374ebb,_0x9785cc){if(_0x142f9e[_0x8b03('0x2d')]){_0x374ebb(_0x142f9e[_0x8b03('0x2d')]);return;}return db[_0x8b03('0x4c')]['findOne']({'attributes':[_0x8b03('0x4d')],'where':{'id':_0x142f9e[_0x8b03('0x32')]},'raw':!![]})[_0x8b03('0x28')](function(_0x46131a){if(!_0x46131a)throw new db[(_0x8b03('0x2f'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x247a80=Mustache[_0x8b03('0x4e')](_0x46131a[_0x8b03('0x4d')],_0x142f9e['view']);_0x374ebb(_0x247a80);})['catch'](function(_0x33645d){_0x9785cc(_0x33645d);});});}function getRecipients(_0x4bc081){return new BPromise(function(_0x1f5d3f,_0x175856){var _0xf99fd7=[];var _0x3162fb=[];_0x4bc081['forEach'](function(_0x30ec15){var _0x1d430e=_[_0x8b03('0x4f')](_0x30ec15[_0x8b03('0x50')][_0x8b03('0x3f')]());if(_0x1d430e===_0x8b03('0x51')){_0xf99fd7=_[_0x8b03('0x52')](_0xf99fd7,_0x30ec15[_0x8b03('0x53')]);}else{if(_[_0x8b03('0x54')](_0x1d430e,_0x8b03('0x55')))_0x1d430e=_0x1d430e['replace'](_0x8b03('0x55'),'Queue');_0x30ec15[_0x8b03('0x53')]['forEach'](function(_0x3d50d5){_0x3162fb[_0x8b03('0x56')](getAgents(_0x1d430e,_0x3d50d5));});}});return BPromise[_0x8b03('0x57')](_0x3162fb)['then'](function(_0x3ddf7e){_0xf99fd7=_[_0x8b03('0x52')](_0xf99fd7,_[_0x8b03('0x58')](_0x3ddf7e));_0x1f5d3f(_0xf99fd7);})[_0x8b03('0x59')](function(_0x1c1629){_0x175856(_0x1c1629);});});}function getAgents(_0x337351,_0x5e4705){return new BPromise(function(_0x4df168,_0xcda16){return db[_0x337351][_0x8b03('0x5a')]({'where':{'id':_0x5e4705}})[_0x8b03('0x28')](function(_0x1bdde2){return _0x1bdde2[_0x8b03('0x5b')]({'attributes':['id'],'raw':!![]})[_0x8b03('0x28')](function(_0x86d7fc){var _0x20a024=_[_0x8b03('0x5c')](_0x86d7fc,'id');_0x4df168(_0x20a024);});})['catch'](function(_0x245c38){_0xcda16(_0x245c38);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 3000427..eccc44e 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 _0xc3e3=['update','emit','hasOwnProperty','exports','events','UserNotification','setMaxListeners','save'];(function(_0x5e8c7c,_0x3429c6){var _0x48f7bd=function(_0x2b8a0f){while(--_0x2b8a0f){_0x5e8c7c['push'](_0x5e8c7c['shift']());}};_0x48f7bd(++_0x3429c6);}(_0xc3e3,0x15c));var _0x3c3e=function(_0x4da0d8,_0x27c7ba){_0x4da0d8=_0x4da0d8-0x0;var _0x4bc13b=_0xc3e3[_0x4da0d8];return _0x4bc13b;};'use strict';var EventEmitter=require(_0x3c3e('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x3c3e('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3c3e('0x2')](0x0);var events={'afterCreate':_0x3c3e('0x3'),'afterUpdate':_0x3c3e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c15e3){return function(_0x164399,_0x342097,_0x5eea5b){UserNotificationEvents[_0x3c3e('0x5')](_0x2c15e3+':'+_0x164399['id'],_0x164399);UserNotificationEvents['emit'](_0x2c15e3,_0x164399);_0x5eea5b(null);};}for(var e in events){if(events[_0x3c3e('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x3c3e('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x0a6d=['events','../../mysqldb','UserNotification','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x2ef183,_0x34d55b){var _0x2d7c3e=function(_0x21d5fa){while(--_0x21d5fa){_0x2ef183['push'](_0x2ef183['shift']());}};_0x2d7c3e(++_0x34d55b);}(_0x0a6d,0x18c));var _0xd0a6=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x0a6d[_0xdea41a];return _0x15d0d8;};'use strict';var EventEmitter=require(_0xd0a6('0x0'));var UserNotification=require(_0xd0a6('0x1'))['db'][_0xd0a6('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xd0a6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd0a6('0x4'),'afterDestroy':_0xd0a6('0x5')};function emitEvent(_0x34f653){return function(_0x38ebfd,_0x1da691,_0x25084e){UserNotificationEvents['emit'](_0x34f653+':'+_0x38ebfd['id'],_0x38ebfd);UserNotificationEvents[_0xd0a6('0x6')](_0x34f653,_0x38ebfd);_0x25084e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xd0a6('0x7')](e,emitEvent(event));}}module[_0xd0a6('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index c8c972a..bebffc3 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 _0x8658=['./userNotification.attributes','UserNotification','userNotifications','utf8mb4','util','rimraf','../../config/environment'];(function(_0x213215,_0x69d2f9){var _0x8cf25b=function(_0x6d80e0){while(--_0x6d80e0){_0x213215['push'](_0x213215['shift']());}};_0x8cf25b(++_0x69d2f9);}(_0x8658,0x9e));var _0x8865=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8658[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0x8865('0x0'));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('path');var rimraf=require(_0x8865('0x1'));var config=require(_0x8865('0x2'));var attributes=require(_0x8865('0x3'));module['exports']=function(_0x49bb33,_0x3b5081){return _0x49bb33['define'](_0x8865('0x4'),attributes,{'tableName':_0x8865('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8865('0x6'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf762=['request-promise','path','rimraf','../../config/environment','./userNotification.attributes','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird'];(function(_0x51a303,_0x694349){var _0x443f5d=function(_0x366ca6){while(--_0x366ca6){_0x51a303['push'](_0x51a303['shift']());}};_0x443f5d(++_0x694349);}(_0xf762,0x127));var _0x2f76=function(_0x41d57b,_0x19dbc4){_0x41d57b=_0x41d57b-0x0;var _0x48b4bb=_0xf762[_0x41d57b];return _0x48b4bb;};'use strict';var _=require(_0x2f76('0x0'));var util=require(_0x2f76('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2f76('0x2'));var BPromise=require(_0x2f76('0x3'));var rp=require(_0x2f76('0x4'));var fs=require('fs');var path=require(_0x2f76('0x5'));var rimraf=require(_0x2f76('0x6'));var config=require(_0x2f76('0x7'));var attributes=require(_0x2f76('0x8'));module['exports']=function(_0x37822c,_0x3cc904){return _0x37822c[_0x2f76('0x9')]('UserNotification',attributes,{'tableName':_0x2f76('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f76('0xb'),'collate':_0x2f76('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d13ca45..b01e03b 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 _0x6df4=['socket.io-emitter','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6df4,0xa9));var _0x46df=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0x6df4[_0x151334];return _0x3d03da;};'use strict';var _=require(_0x46df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x46df('0x1'));var rs=require(_0x46df('0x2'));var fs=require('fs');var Redis=require(_0x46df('0x3'));var db=require(_0x46df('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x46df('0x5'));var config=require(_0x46df('0x6'));var jayson=require(_0x46df('0x7'));var client=jayson[_0x46df('0x8')][_0x46df('0x9')]({'port':0x232a});config[_0x46df('0xa')]=_[_0x46df('0xb')](config[_0x46df('0xa')],{'host':_0x46df('0xc'),'port':0x18eb});var socket=require(_0x46df('0xd'))(new Redis(config[_0x46df('0xa')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x32649a,_0x36281a,_0x11f54a){return new BPromise(function(_0x227fd2,_0x3054f4){return client[_0x46df('0xe')](_0x32649a,_0x11f54a)[_0x46df('0xf')](function(_0x59c1c6){logger[_0x46df('0x10')]('UserNotification,\x20%s,\x20%s',_0x36281a,_0x46df('0x11'));logger[_0x46df('0x12')](_0x46df('0x13'),_0x36281a,'request\x20sent',JSON[_0x46df('0x14')](_0x59c1c6));if(_0x59c1c6[_0x46df('0x15')]){if(_0x59c1c6['error']['code']===0x1f4){logger[_0x46df('0x15')](_0x46df('0x16'),_0x36281a,_0x59c1c6[_0x46df('0x15')][_0x46df('0x17')]);return _0x3054f4(_0x59c1c6['error'][_0x46df('0x17')]);}logger[_0x46df('0x15')](_0x46df('0x16'),_0x36281a,_0x59c1c6['error']['message']);return _0x227fd2(_0x59c1c6['error']['message']);}else{logger[_0x46df('0x10')](_0x46df('0x16'),_0x36281a,_0x46df('0x11'));_0x227fd2(_0x59c1c6[_0x46df('0x18')][_0x46df('0x17')]);}})[_0x46df('0x19')](function(_0x3fa799){logger[_0x46df('0x15')](_0x46df('0x16'),_0x36281a,_0x3fa799);_0x3054f4(_0x3fa799);});});} \ No newline at end of file +var _0xff93=['request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0xff93,0x94));var _0x3ff9=function(_0x2dbeb4,_0x499544){_0x2dbeb4=_0x2dbeb4-0x0;var _0x18a513=_0xff93[_0x2dbeb4];return _0x18a513;};'use strict';var _=require(_0x3ff9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ff9('0x1'));var fs=require('fs');var Redis=require(_0x3ff9('0x2'));var db=require(_0x3ff9('0x3'))['db'];var utils=require(_0x3ff9('0x4'));var logger=require(_0x3ff9('0x5'))(_0x3ff9('0x6'));var config=require(_0x3ff9('0x7'));var jayson=require(_0x3ff9('0x8'));var client=jayson[_0x3ff9('0x9')]['http']({'port':0x232a});config[_0x3ff9('0xa')]=_[_0x3ff9('0xb')](config[_0x3ff9('0xa')],{'host':_0x3ff9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ff9('0xa')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x10eb56,_0x4eaa7d,_0x3e2347){return new BPromise(function(_0x2903ca,_0x4d3d41){return client[_0x3ff9('0xd')](_0x10eb56,_0x3e2347)[_0x3ff9('0xe')](function(_0x437fee){logger[_0x3ff9('0xf')](_0x3ff9('0x10'),_0x4eaa7d,_0x3ff9('0x11'));logger['debug'](_0x3ff9('0x12'),_0x4eaa7d,_0x3ff9('0x11'),JSON['stringify'](_0x437fee));if(_0x437fee['error']){if(_0x437fee[_0x3ff9('0x13')][_0x3ff9('0x14')]===0x1f4){logger['error'](_0x3ff9('0x10'),_0x4eaa7d,_0x437fee['error']['message']);return _0x4d3d41(_0x437fee[_0x3ff9('0x13')][_0x3ff9('0x15')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x4eaa7d,_0x437fee[_0x3ff9('0x13')][_0x3ff9('0x15')]);return _0x2903ca(_0x437fee[_0x3ff9('0x13')][_0x3ff9('0x15')]);}else{logger[_0x3ff9('0xf')](_0x3ff9('0x10'),_0x4eaa7d,_0x3ff9('0x11'));_0x2903ca(_0x437fee['result'][_0x3ff9('0x15')]);}})[_0x3ff9('0x16')](function(_0x278602){logger[_0x3ff9('0x13')](_0x3ff9('0x10'),_0x4eaa7d,_0x278602);_0x4d3d41(_0x278602);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 4209dcf..77b95d1 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 _0xfc58=['./userNotification.events','save','emit','removeListener','register','length','userNotification:'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xfc58,0x77));var _0x8fc5=function(_0x40005d,_0x2a47bf){_0x40005d=_0x40005d-0x0;var _0x106958=_0xfc58[_0x40005d];return _0x106958;};'use strict';var UserNotificationEvents=require(_0x8fc5('0x0'));var events=[_0x8fc5('0x1'),'remove','update'];function createListener(_0x58f9e9,_0x7d546b){return function(_0x4c8f64){_0x7d546b[_0x8fc5('0x2')](_0x58f9e9,_0x4c8f64);};}function removeListener(_0xa95b3d,_0x24b858){return function(){UserNotificationEvents[_0x8fc5('0x3')](_0xa95b3d,_0x24b858);};}exports[_0x8fc5('0x4')]=function(_0x15fca9){for(var _0x576054=0x0,_0xd454a9=events[_0x8fc5('0x5')];_0x576054<_0xd454a9;_0x576054++){var _0x20c6df=events[_0x576054];var _0x1bc8e1=createListener(_0x8fc5('0x6')+_0x20c6df,_0x15fca9);UserNotificationEvents['on'](_0x20c6df,_0x1bc8e1);}}; \ No newline at end of file +var _0xddee=['remove','update','emit','register','userNotification:','./userNotification.events','save'];(function(_0x18801d,_0x3fee8e){var _0x3e98e0=function(_0x4468df){while(--_0x4468df){_0x18801d['push'](_0x18801d['shift']());}};_0x3e98e0(++_0x3fee8e);}(_0xddee,0x17f));var _0xedde=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xddee[_0x1d50f2];return _0x3769b8;};'use strict';var UserNotificationEvents=require(_0xedde('0x0'));var events=[_0xedde('0x1'),_0xedde('0x2'),_0xedde('0x3')];function createListener(_0xe50eea,_0x366e37){return function(_0x3adc8d){_0x366e37[_0xedde('0x4')](_0xe50eea,_0x3adc8d);};}function removeListener(_0x5a34c7,_0x3ee70b){return function(){UserNotificationEvents['removeListener'](_0x5a34c7,_0x3ee70b);};}exports[_0xedde('0x5')]=function(_0x5bc2a7){for(var _0x5ba517=0x0,_0xdd2544=events['length'];_0x5ba517<_0xdd2544;_0x5ba517++){var _0x315e41=events[_0x5ba517];var _0x4e1bd0=createListener(_0xedde('0x6')+_0x315e41,_0x5bc2a7);UserNotificationEvents['on'](_0x315e41,_0x4e1bd0);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index b8df554..06d3417 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x11a2dd,_0x5bf4bc){var _0x4bc0e2=function(_0x54f2a7){while(--_0x54f2a7){_0x11a2dd['push'](_0x11a2dd['shift']());}};_0x4bc0e2(++_0x5bf4bc);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2e59fe,_0x27d28f){var _0x7815cc=function(_0x54008a){while(--_0x54008a){_0x2e59fe['push'](_0x2e59fe['shift']());}};_0x7815cc(++_0x27d28f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 32d0e03..4826ea1 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 _0x08aa=['exports','INTEGER'];(function(_0x517b6f,_0x5c10a8){var _0x251b8a=function(_0x21c0d7){while(--_0x21c0d7){_0x517b6f['push'](_0x517b6f['shift']());}};_0x251b8a(++_0x5c10a8);}(_0x08aa,0x9a));var _0xa08a=function(_0x16aec1,_0x5bfc15){_0x16aec1=_0x16aec1-0x0;var _0x495aa1=_0x08aa[_0x16aec1];return _0x495aa1;};'use strict';var Sequelize=require('sequelize');module[_0xa08a('0x0')]={'penalty':{'type':Sequelize[_0xa08a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe142=['INTEGER'];(function(_0x5320f2,_0x49795c){var _0x14a2d6=function(_0x539dc9){while(--_0x539dc9){_0x5320f2['push'](_0x5320f2['shift']());}};_0x14a2d6(++_0x49795c);}(_0xe142,0xaa));var _0x2e14=function(_0x1de0bc,_0x312122){_0x1de0bc=_0x1de0bc-0x0;var _0x16d1aa=_0xe142[_0x1de0bc];return _0x16d1aa;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x2e14('0x0')],'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 aad9d31..fad3c69 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 _0xb1fc=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userOpenchannelQueue.attributes','exports'];(function(_0x46d51c,_0x58cd91){var _0x402086=function(_0x5c3660){while(--_0x5c3660){_0x46d51c['push'](_0x46d51c['shift']());}};_0x402086(++_0x58cd91);}(_0xb1fc,0x6e));var _0xcb1f=function(_0x2d1017,_0x195eb6){_0x2d1017=_0x2d1017-0x0;var _0x279b28=_0xb1fc[_0x2d1017];return _0x279b28;};'use strict';var _=require(_0xcb1f('0x0'));var util=require(_0xcb1f('0x1'));var logger=require(_0xcb1f('0x2'))(_0xcb1f('0x3'));var moment=require(_0xcb1f('0x4'));var BPromise=require(_0xcb1f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb1f('0x6'));var rimraf=require('rimraf');var config=require(_0xcb1f('0x7'));var attributes=require(_0xcb1f('0x8'));module[_0xcb1f('0x9')]=function(_0x418e87,_0x3b7e07){return _0x418e87['define'](_0xcb1f('0xa'),attributes,{'tableName':_0xcb1f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bcd=['user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x3b925e,_0x570503){var _0x5b398b=function(_0x56294d){while(--_0x56294d){_0x3b925e['push'](_0x3b925e['shift']());}};_0x5b398b(++_0x570503);}(_0x1bcd,0xd3));var _0xd1bc=function(_0x58b201,_0x4546aa){_0x58b201=_0x58b201-0x0;var _0x39fc02=_0x1bcd[_0x58b201];return _0x39fc02;};'use strict';var _=require(_0xd1bc('0x0'));var util=require(_0xd1bc('0x1'));var logger=require(_0xd1bc('0x2'))(_0xd1bc('0x3'));var moment=require(_0xd1bc('0x4'));var BPromise=require('bluebird');var rp=require(_0xd1bc('0x5'));var fs=require('fs');var path=require(_0xd1bc('0x6'));var rimraf=require(_0xd1bc('0x7'));var config=require(_0xd1bc('0x8'));var attributes=require(_0xd1bc('0x9'));module[_0xd1bc('0xa')]=function(_0x2483d7,_0xb8c7a7){return _0x2483d7[_0xd1bc('0xb')](_0xd1bc('0xc'),attributes,{'tableName':_0xd1bc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index b9ec496..0244717 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 _0x081e=['catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0x081e,0x8d));var _0xe081=function(_0x20f9bc,_0x1057f0){_0x20f9bc=_0x20f9bc-0x0;var _0x2060a4=_0x081e[_0x20f9bc];return _0x2060a4;};'use strict';var _=require('lodash');var util=require(_0xe081('0x0'));var moment=require(_0xe081('0x1'));var BPromise=require(_0xe081('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe081('0x3'));var db=require(_0xe081('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe081('0x5'));var config=require(_0xe081('0x6'));var jayson=require(_0xe081('0x7'));var client=jayson[_0xe081('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c7219,_0x365b48,_0x4ea9d8){return new BPromise(function(_0x34bfeb,_0x2e8a46){return client[_0xe081('0x9')](_0x3c7219,_0x4ea9d8)[_0xe081('0xa')](function(_0x564090){logger[_0xe081('0xb')](_0xe081('0xc'),_0x365b48,'request\x20sent');logger[_0xe081('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x365b48,_0xe081('0xe'),JSON[_0xe081('0xf')](_0x564090));if(_0x564090['error']){if(_0x564090[_0xe081('0x10')][_0xe081('0x11')]===0x1f4){logger[_0xe081('0x10')](_0xe081('0xc'),_0x365b48,_0x564090[_0xe081('0x10')]['message']);return _0x2e8a46(_0x564090[_0xe081('0x10')][_0xe081('0x12')]);}logger[_0xe081('0x10')](_0xe081('0xc'),_0x365b48,_0x564090[_0xe081('0x10')][_0xe081('0x12')]);return _0x34bfeb(_0x564090['error'][_0xe081('0x12')]);}else{logger[_0xe081('0xb')](_0xe081('0xc'),_0x365b48,_0xe081('0xe'));_0x34bfeb(_0x564090['result'][_0xe081('0x12')]);}})[_0xe081('0x13')](function(_0x3a8c75){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x365b48,_0x3a8c75);_0x2e8a46(_0x3a8c75);});});} \ No newline at end of file +var _0xd37d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2912da,_0x1ca480){var _0x3b1dd7=function(_0x134cfa){while(--_0x134cfa){_0x2912da['push'](_0x2912da['shift']());}};_0x3b1dd7(++_0x1ca480);}(_0xd37d,0x1a6));var _0xdd37=function(_0x4ea6ae,_0x2644d0){_0x4ea6ae=_0x4ea6ae-0x0;var _0x17704b=_0xd37d[_0x4ea6ae];return _0x17704b;};'use strict';var _=require(_0xdd37('0x0'));var util=require(_0xdd37('0x1'));var moment=require(_0xdd37('0x2'));var BPromise=require(_0xdd37('0x3'));var rs=require(_0xdd37('0x4'));var fs=require('fs');var Redis=require(_0xdd37('0x5'));var db=require(_0xdd37('0x6'))['db'];var utils=require(_0xdd37('0x7'));var logger=require(_0xdd37('0x8'))(_0xdd37('0x9'));var config=require('../../config/environment');var jayson=require(_0xdd37('0xa'));var client=jayson[_0xdd37('0xb')][_0xdd37('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25f779,_0x19f111,_0x7d27ff){return new BPromise(function(_0x523d3c,_0x54e170){return client[_0xdd37('0xd')](_0x25f779,_0x7d27ff)[_0xdd37('0xe')](function(_0x235484){logger[_0xdd37('0xf')](_0xdd37('0x10'),_0x19f111,'request\x20sent');logger[_0xdd37('0x11')](_0xdd37('0x12'),_0x19f111,_0xdd37('0x13'),JSON[_0xdd37('0x14')](_0x235484));if(_0x235484[_0xdd37('0x15')]){if(_0x235484[_0xdd37('0x15')][_0xdd37('0x16')]===0x1f4){logger['error'](_0xdd37('0x10'),_0x19f111,_0x235484[_0xdd37('0x15')][_0xdd37('0x17')]);return _0x54e170(_0x235484[_0xdd37('0x15')]['message']);}logger[_0xdd37('0x15')](_0xdd37('0x10'),_0x19f111,_0x235484['error'][_0xdd37('0x17')]);return _0x523d3c(_0x235484[_0xdd37('0x15')][_0xdd37('0x17')]);}else{logger[_0xdd37('0xf')](_0xdd37('0x10'),_0x19f111,'request\x20sent');_0x523d3c(_0x235484['result'][_0xdd37('0x17')]);}})[_0xdd37('0x18')](function(_0x4da01a){logger[_0xdd37('0x15')](_0xdd37('0x10'),_0x19f111,_0x4da01a);_0x54e170(_0x4da01a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 3723ee0..0725db8 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 _0x59ca=['/:id','update','destroy','delete','/:id/sections','removeResources','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','show','getSections','/:id/resources','getResources','post','create','addSections','addResources','put'];(function(_0x97f737,_0xc81741){var _0x4c8e84=function(_0x1ed673){while(--_0x1ed673){_0x97f737['push'](_0x97f737['shift']());}};_0x4c8e84(++_0xc81741);}(_0x59ca,0x162));var _0xa59c=function(_0x3845f7,_0x18565e){_0x3845f7=_0x3845f7-0x0;var _0x3fc579=_0x59ca[_0x3845f7];return _0x3fc579;};'use strict';var multer=require(_0xa59c('0x0'));var util=require(_0xa59c('0x1'));var path=require(_0xa59c('0x2'));var timeout=require(_0xa59c('0x3'));var express=require(_0xa59c('0x4'));var router=express[_0xa59c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa59c('0x6'));var interaction=require(_0xa59c('0x7'));var config=require(_0xa59c('0x8'));var controller=require(_0xa59c('0x9'));router[_0xa59c('0xa')]('/',auth[_0xa59c('0xb')](),controller[_0xa59c('0xc')]);router[_0xa59c('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xa59c('0xd')]);router[_0xa59c('0xa')]('/:id',auth[_0xa59c('0xb')](),controller[_0xa59c('0xe')]);router[_0xa59c('0xa')]('/:id/sections',auth[_0xa59c('0xb')](),controller[_0xa59c('0xf')]);router[_0xa59c('0xa')](_0xa59c('0x10'),auth[_0xa59c('0xb')](),controller[_0xa59c('0x11')]);router[_0xa59c('0x12')]('/',auth['isAuthenticated'](),controller[_0xa59c('0x13')]);router[_0xa59c('0x12')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0xa59c('0x12')]('/:id/sections',auth[_0xa59c('0xb')](),controller[_0xa59c('0x14')]);router[_0xa59c('0x12')](_0xa59c('0x10'),auth[_0xa59c('0xb')](),controller[_0xa59c('0x15')]);router[_0xa59c('0x16')](_0xa59c('0x17'),auth['isAuthenticated'](),controller[_0xa59c('0x18')]);router['delete']('/:id',auth[_0xa59c('0xb')](),controller[_0xa59c('0x19')]);router[_0xa59c('0x1a')](_0xa59c('0x1b'),auth[_0xa59c('0xb')](),controller['removeSections']);router[_0xa59c('0x1a')](_0xa59c('0x10'),auth[_0xa59c('0xb')](),controller[_0xa59c('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x24b0=['/:id','show','/:id/sections','getSections','getResources','create','post','/:id/clone','addSections','/:id/resources','addResources','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x19bd0e,_0x4d76fc){var _0x19a7e3=function(_0x112df1){while(--_0x112df1){_0x19bd0e['push'](_0x19bd0e['shift']());}};_0x19a7e3(++_0x4d76fc);}(_0x24b0,0xda));var _0x024b=function(_0x4d10f5,_0xed15f9){_0x4d10f5=_0x4d10f5-0x0;var _0x43be08=_0x24b0[_0x4d10f5];return _0x43be08;};'use strict';var multer=require('multer');var util=require(_0x024b('0x0'));var path=require(_0x024b('0x1'));var timeout=require(_0x024b('0x2'));var express=require(_0x024b('0x3'));var router=express['Router']();var fs_extra=require(_0x024b('0x4'));var auth=require(_0x024b('0x5'));var interaction=require(_0x024b('0x6'));var config=require(_0x024b('0x7'));var controller=require(_0x024b('0x8'));router[_0x024b('0x9')]('/',auth['isAuthenticated'](),controller[_0x024b('0xa')]);router[_0x024b('0x9')](_0x024b('0xb'),auth[_0x024b('0xc')](),controller[_0x024b('0xd')]);router[_0x024b('0x9')](_0x024b('0xe'),auth[_0x024b('0xc')](),controller[_0x024b('0xf')]);router[_0x024b('0x9')](_0x024b('0x10'),auth[_0x024b('0xc')](),controller[_0x024b('0x11')]);router['get']('/:id/resources',auth[_0x024b('0xc')](),controller[_0x024b('0x12')]);router['post']('/',auth[_0x024b('0xc')](),controller[_0x024b('0x13')]);router[_0x024b('0x14')](_0x024b('0x15'),auth[_0x024b('0xc')](),controller['clone']);router[_0x024b('0x14')](_0x024b('0x10'),auth[_0x024b('0xc')](),controller[_0x024b('0x16')]);router[_0x024b('0x14')](_0x024b('0x17'),auth['isAuthenticated'](),controller[_0x024b('0x18')]);router[_0x024b('0x19')](_0x024b('0xe'),auth[_0x024b('0xc')](),controller[_0x024b('0x1a')]);router[_0x024b('0x1b')](_0x024b('0xe'),auth['isAuthenticated'](),controller[_0x024b('0x1c')]);router['delete'](_0x024b('0x10'),auth[_0x024b('0xc')](),controller['removeSections']);router[_0x024b('0x1b')](_0x024b('0x17'),auth[_0x024b('0xc')](),controller['removeResources']);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 42d3f6b..23c725e 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 _0xa3b8=['STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','name'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xa3b8,0x115));var _0x8a3b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa3b8[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x8a3b('0x0'));module[_0x8a3b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8a3b('0x2')},'crudPermissions':{'type':Sequelize[_0x8a3b('0x3')],'set':function(_0x493e23){this[_0x8a3b('0x4')](_0x8a3b('0x5'),_0x493e23?_0x493e23[_0x8a3b('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x8a3b('0x5'))?this[_0x8a3b('0x7')](_0x8a3b('0x5'))[_0x8a3b('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8a3b('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8a3b('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8a3b('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8a3b('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8a3b('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8a3b('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8a3b('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3fb8=['setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','name','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3fb8,0x72));var _0x83fb=function(_0x6c75da,_0x1b96d6){_0x6c75da=_0x6c75da-0x0;var _0x5f5d21=_0x3fb8[_0x6c75da];return _0x5f5d21;};'use strict';var Sequelize=require(_0x83fb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x83fb('0x1')},'crudPermissions':{'type':Sequelize[_0x83fb('0x2')],'set':function(_0x51a537){this[_0x83fb('0x3')]('crudPermissions',_0x51a537?_0x51a537[_0x83fb('0x4')](''):[]);},'get':function(){return this[_0x83fb('0x5')](_0x83fb('0x6'))?this[_0x83fb('0x5')]('crudPermissions')[_0x83fb('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x83fb('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x83fb('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x83fb('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x83fb('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x83fb('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 3e77b68..ec8ac30 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 _0x2deb=['mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userProfile.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','catch','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','autoAssociation','sectionId','UserProfileSection','UserProfileResource','Resources','describe','addSections','userProfileId','push','ids','getSections','isEmpty','includes','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb2de('0x0'));var rimraf=require(_0xb2de('0x1'));var zipdir=require(_0xb2de('0x2'));var jsonpatch=require(_0xb2de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb2de('0x4'));var Mustache=require(_0xb2de('0x5'));var util=require(_0xb2de('0x6'));var path=require(_0xb2de('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb2de('0x8'));var fs=require('fs');var fs_extra=require(_0xb2de('0x9'));var _=require(_0xb2de('0xa'));var squel=require('squel');var crypto=require(_0xb2de('0xb'));var jsforce=require(_0xb2de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb2de('0xd'));var querystring=require(_0xb2de('0xe'));var Papa=require(_0xb2de('0xf'));var Redis=require('ioredis');var authService=require(_0xb2de('0x10'));var qs=require(_0xb2de('0x11'));var as=require(_0xb2de('0x12'));var hardwareService=require(_0xb2de('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb2de('0x14'));var config=require(_0xb2de('0x15'));var licenseUtil=require(_0xb2de('0x16'));var db=require('../../mysqldb')['db'];config[_0xb2de('0x17')]=_[_0xb2de('0x18')](config[_0xb2de('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2de('0x19'))(new Redis(config['redis']));require(_0xb2de('0x1a'))['register'](socket);function respondWithStatusCode(_0x10ef21,_0x839c22){_0x839c22=_0x839c22||0xcc;return function(_0x3f9541){if(_0x3f9541){return _0x10ef21['sendStatus'](_0x839c22);}return _0x10ef21[_0xb2de('0x1b')](_0x839c22)[_0xb2de('0x1c')]();};}function respondWithResult(_0x2dc98f,_0x1413f6){_0x1413f6=_0x1413f6||0xc8;return function(_0x317528){if(_0x317528){return _0x2dc98f[_0xb2de('0x1b')](_0x1413f6)[_0xb2de('0x1d')](_0x317528);}};}function respondWithFilteredResult(_0x2db287,_0x1809b1){return function(_0x5d06ac){if(_0x5d06ac){var _0x2a7e89=typeof _0x1809b1['offset']===_0xb2de('0x1e')&&typeof _0x1809b1[_0xb2de('0x1f')]==='undefined';var _0x2fbe63=_0x5d06ac[_0xb2de('0x20')];var _0x499c2f=_0x2a7e89?0x0:_0x1809b1[_0xb2de('0x21')];var _0x1743d1=_0x2a7e89?_0x5d06ac[_0xb2de('0x20')]:_0x1809b1[_0xb2de('0x21')]+_0x1809b1[_0xb2de('0x1f')];var _0x3014b9;if(_0x1743d1>=_0x2fbe63){_0x1743d1=_0x2fbe63;_0x3014b9=0xc8;}else{_0x3014b9=0xce;}_0x2db287[_0xb2de('0x1b')](_0x3014b9);return _0x2db287[_0xb2de('0x22')](_0xb2de('0x23'),_0x499c2f+'-'+_0x1743d1+'/'+_0x2fbe63)['json'](_0x5d06ac);}return null;};}function patchUpdates(_0x280644){return function(_0x2ebdde){try{jsonpatch[_0xb2de('0x24')](_0x2ebdde,_0x280644,!![]);}catch(_0xa97fb4){return BPromise['reject'](_0xa97fb4);}return _0x2ebdde['save']();};}function saveUpdates(_0x102da8,_0x1efd51){return function(_0x3d9ece){if(_0x3d9ece){return _0x3d9ece['update'](_0x102da8)[_0xb2de('0x25')](function(_0x1cc2db){return _0x1cc2db;});}return null;};}function removeEntity(_0x4a6d12,_0x16c249){return function(_0x5b7c2f){if(_0x5b7c2f){return _0x5b7c2f[_0xb2de('0x26')]()[_0xb2de('0x25')](function(){_0x4a6d12[_0xb2de('0x1b')](0xcc)[_0xb2de('0x1c')]();});}};}function handleEntityNotFound(_0xeb4e31,_0x1ad5a2){return function(_0x48675d){if(!_0x48675d){_0xeb4e31[_0xb2de('0x27')](0x194);}return _0x48675d;};}function handleError(_0x5b04ae,_0x38fee9){_0x38fee9=_0x38fee9||0x1f4;return function(_0x5c74e6){logger['error'](_0x5c74e6[_0xb2de('0x28')]);if(_0x5c74e6[_0xb2de('0x29')]){delete _0x5c74e6[_0xb2de('0x29')];}_0x5b04ae[_0xb2de('0x1b')](_0x38fee9)[_0xb2de('0x2a')](_0x5c74e6);};}exports[_0xb2de('0x2b')]=function(_0x1e7248,_0x88f02){var _0x1e0f6d={},_0x379e5f={},_0x40c5d7={'count':0x0,'rows':[]};var _0x101878=_['map'](db[_0xb2de('0x2c')][_0xb2de('0x2d')],function(_0x5b8700){return{'name':_0x5b8700[_0xb2de('0x2e')],'type':_0x5b8700[_0xb2de('0x2f')]['key']};});_0x379e5f[_0xb2de('0x30')]=_[_0xb2de('0x31')](_0x101878,_0xb2de('0x29'));_0x379e5f['query']=_[_0xb2de('0x32')](_0x1e7248[_0xb2de('0x33')]);_0x379e5f[_0xb2de('0x34')]=_[_0xb2de('0x35')](_0x379e5f[_0xb2de('0x30')],_0x379e5f[_0xb2de('0x33')]);_0x1e0f6d[_0xb2de('0x36')]=_[_0xb2de('0x35')](_0x379e5f[_0xb2de('0x30')],qs[_0xb2de('0x37')](_0x1e7248[_0xb2de('0x33')]['fields']));_0x1e0f6d[_0xb2de('0x36')]=_0x1e0f6d[_0xb2de('0x36')][_0xb2de('0x38')]?_0x1e0f6d[_0xb2de('0x36')]:_0x379e5f[_0xb2de('0x30')];if(!_0x1e7248[_0xb2de('0x33')][_0xb2de('0x39')](_0xb2de('0x3a'))){_0x1e0f6d[_0xb2de('0x1f')]=qs[_0xb2de('0x1f')](_0x1e7248[_0xb2de('0x33')][_0xb2de('0x1f')]);_0x1e0f6d[_0xb2de('0x21')]=qs[_0xb2de('0x21')](_0x1e7248[_0xb2de('0x33')]['offset']);}_0x1e0f6d[_0xb2de('0x3b')]=qs['sort'](_0x1e7248[_0xb2de('0x33')][_0xb2de('0x3c')]);_0x1e0f6d[_0xb2de('0x3d')]=qs[_0xb2de('0x34')](_[_0xb2de('0x3e')](_0x1e7248[_0xb2de('0x33')],_0x379e5f[_0xb2de('0x34')]),_0x101878);if(_0x1e7248[_0xb2de('0x33')][_0xb2de('0x3f')]){_0x1e0f6d[_0xb2de('0x3d')]=_[_0xb2de('0x40')](_0x1e0f6d[_0xb2de('0x3d')],{'$or':_[_0xb2de('0x31')](_0x101878,function(_0x1e7091){if(_0x1e7091[_0xb2de('0x2f')]!=='VIRTUAL'){var _0x179a92={};_0x179a92[_0x1e7091[_0xb2de('0x29')]]={'$like':'%'+_0x1e7248['query'][_0xb2de('0x3f')]+'%'};return _0x179a92;}})});}_0x1e0f6d=_[_0xb2de('0x40')]({},_0x1e0f6d,_0x1e7248[_0xb2de('0x41')]);var _0x12b5b7={'where':_0x1e0f6d['where']};return db[_0xb2de('0x2c')][_0xb2de('0x20')](_0x12b5b7)['then'](function(_0x47448a){_0x40c5d7[_0xb2de('0x20')]=_0x47448a;if(_0x1e7248['query'][_0xb2de('0x42')]){_0x1e0f6d['include']=[{'all':!![]}];}return db['UserProfile'][_0xb2de('0x43')](_0x1e0f6d);})['then'](function(_0x514623){_0x40c5d7[_0xb2de('0x44')]=_0x514623;return _0x40c5d7;})[_0xb2de('0x25')](respondWithFilteredResult(_0x88f02,_0x1e0f6d))['catch'](handleError(_0x88f02,null));};exports[_0xb2de('0x45')]=function(_0x1e35a5,_0x14b0b2){var _0x25f7d1={'raw':![],'where':{'id':_0x1e35a5[_0xb2de('0x46')]['id']}},_0x5d447f={};_0x5d447f[_0xb2de('0x30')]=_[_0xb2de('0x32')](db[_0xb2de('0x2c')][_0xb2de('0x2d')]);_0x5d447f[_0xb2de('0x33')]=_[_0xb2de('0x32')](_0x1e35a5['query']);_0x5d447f[_0xb2de('0x34')]=_[_0xb2de('0x35')](_0x5d447f[_0xb2de('0x30')],_0x5d447f['query']);_0x25f7d1[_0xb2de('0x36')]=_['intersection'](_0x5d447f[_0xb2de('0x30')],qs[_0xb2de('0x37')](_0x1e35a5[_0xb2de('0x33')][_0xb2de('0x37')]));_0x25f7d1['attributes']=_0x25f7d1[_0xb2de('0x36')][_0xb2de('0x38')]?_0x25f7d1['attributes']:_0x5d447f['model'];if(_0x1e35a5[_0xb2de('0x33')][_0xb2de('0x42')]){_0x25f7d1[_0xb2de('0x47')]=[{'all':!![]}];}_0x25f7d1=_[_0xb2de('0x40')]({},_0x25f7d1,_0x1e35a5[_0xb2de('0x41')]);return db['UserProfile'][_0xb2de('0x48')](_0x25f7d1)['then'](handleEntityNotFound(_0x14b0b2,null))[_0xb2de('0x25')](respondWithResult(_0x14b0b2,null))['catch'](handleError(_0x14b0b2,null));};exports[_0xb2de('0x49')]=function(_0x3dca27,_0x4c52bc){return db[_0xb2de('0x2c')]['create'](_0x3dca27[_0xb2de('0x4a')],{})[_0xb2de('0x25')](respondWithResult(_0x4c52bc,0xc9))[_0xb2de('0x4b')](handleError(_0x4c52bc,null));};exports[_0xb2de('0x4c')]=function(_0x5e0968,_0x2e7506){var _0x1eabf7={'where':{'id':_0x5e0968[_0xb2de('0x46')]['id']}},_0xeb9165={};_0xeb9165[_0xb2de('0x30')]=_['keys'](db[_0xb2de('0x2c')][_0xb2de('0x2d')]);_0x1eabf7[_0xb2de('0x36')]=_[_0xb2de('0x35')](_0xeb9165[_0xb2de('0x30')],qs['fields'](_0x5e0968[_0xb2de('0x33')][_0xb2de('0x37')]));_0x1eabf7['attributes']=_0x1eabf7[_0xb2de('0x36')]['length']?_0x1eabf7[_0xb2de('0x36')]:_0xeb9165[_0xb2de('0x30')];if(_0x5e0968[_0xb2de('0x33')][_0xb2de('0x42')]){_0x1eabf7['include']=[{'all':!![]}];}_0x1eabf7=_[_0xb2de('0x40')]({},_0x1eabf7,_0x5e0968[_0xb2de('0x41')]);return db['UserProfile']['find'](_0x1eabf7)[_0xb2de('0x25')](handleEntityNotFound(_0x2e7506,null))[_0xb2de('0x25')](function(_0x15165f){if(_0x15165f){var _0x3ec51d=_0x15165f[_0xb2de('0x4d')]({'plain':!![]});_0x3ec51d=qs[_0xb2de('0x4e')](_0x3ec51d,['id',_0xb2de('0x4f'),_0xb2de('0x50'),_0xb2de('0x51')]);_0x5e0968[_0xb2de('0x4a')]=_[_0xb2de('0x4e')](_0x5e0968['body'],['id','createdAt',_0xb2de('0x50')]);return db[_0xb2de('0x52')][_0xb2de('0x53')](function(_0x1a0ace){return db[_0xb2de('0x2c')][_0xb2de('0x49')](_[_0xb2de('0x40')](_0x3ec51d,_0x5e0968['body']),{'include':_0x5e0968['query'][_0xb2de('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x1a0ace})[_0xb2de('0x25')](function(_0x10ac78){var _0x46282c=_0x10ac78['get']({'plain':!![]});return db['UserProfileSection'][_0xb2de('0x43')]({'where':{'userProfileId':_0x5e0968[_0xb2de('0x46')]['id']},'raw':!![]})[_0xb2de('0x25')](function(_0x4d4af5){if(_0x4d4af5){return BPromise[_0xb2de('0x54')](_0x4d4af5,function(_0x42d894){return new BPromise(function(_0xafe72,_0x41ed6a){if(_0x42d894[_0xb2de('0x55')]===null||_0x42d894[_0xb2de('0x55')]===0x1)_0xafe72(null);return db['UserProfileResource'][_0xb2de('0x43')]({'where':{'sectionId':_0x42d894['id']},'raw':!![]})[_0xb2de('0x25')](function(_0x322b11){var _0x1c1253=_[_0xb2de('0x31')](_0x322b11,function(_0xfce2d5){return qs['omit'](_0xfce2d5,['id',_0xb2de('0x4f'),'updatedAt',_0xb2de('0x56')]);});_0xafe72(_0x1c1253);})[_0xb2de('0x4b')](function(_0x4c76ab){_0x41ed6a(_0x4c76ab);});})[_0xb2de('0x25')](function(_0x4adb89){var _0x594e8a=qs['omit'](_0x42d894,['id',_0xb2de('0x4f'),'updatedAt']);_0x594e8a['userProfileId']=_0x46282c['id'];if(_0x4adb89)_0x594e8a['Resources']=_0x4adb89;return _0x594e8a;})[_0xb2de('0x25')](function(_0x41de3b){return db[_0xb2de('0x57')][_0xb2de('0x49')](_0x41de3b,{'include':[{'model':db[_0xb2de('0x58')],'as':_0xb2de('0x59')}],'raw':!![],'transaction':_0x1a0ace});});})[_0xb2de('0x25')](function(){return _0x46282c;});}});});});}})[_0xb2de('0x25')](respondWithResult(_0x2e7506,0xc9))['catch'](handleError(_0x2e7506,null));};exports['update']=function(_0x135833,_0x5178c8){if(_0x135833['body']['id']){delete _0x135833[_0xb2de('0x4a')]['id'];}return db['UserProfile'][_0xb2de('0x48')]({'where':{'id':_0x135833['params']['id']}})['then'](handleEntityNotFound(_0x5178c8,null))[_0xb2de('0x25')](saveUpdates(_0x135833['body'],null))[_0xb2de('0x25')](respondWithResult(_0x5178c8,null))[_0xb2de('0x4b')](handleError(_0x5178c8,null));};exports[_0xb2de('0x26')]=function(_0x116e74,_0x14cd30){return db[_0xb2de('0x2c')][_0xb2de('0x48')]({'where':{'id':_0x116e74[_0xb2de('0x46')]['id']}})[_0xb2de('0x25')](handleEntityNotFound(_0x14cd30,null))[_0xb2de('0x25')](removeEntity(_0x14cd30,null))[_0xb2de('0x4b')](handleError(_0x14cd30,null));};exports[_0xb2de('0x5a')]=function(_0x14a730,_0x1d47ab){return db['UserProfile'][_0xb2de('0x5a')]()[_0xb2de('0x25')](respondWithResult(_0x1d47ab,null))[_0xb2de('0x4b')](handleError(_0x1d47ab,null));};exports[_0xb2de('0x5b')]=function(_0x16293e,_0x470a8a){var _0x643557=_0x16293e[_0xb2de('0x4a')];return db['UserProfile'][_0xb2de('0x48')]({'where':{'id':_0x16293e[_0xb2de('0x46')]['id']}})[_0xb2de('0x25')](handleEntityNotFound(_0x470a8a,null))[_0xb2de('0x25')](function(_0x36f1af){if(_0x36f1af){return db[_0xb2de('0x52')][_0xb2de('0x53')](function(_0x36476b){return db[_0xb2de('0x57')][_0xb2de('0x26')]({'where':{'userProfileId':_0x16293e[_0xb2de('0x46')]['id'],'sectionId':_[_0xb2de('0x31')](_0x643557,function(_0x5802b3){return _0x5802b3[_0xb2de('0x56')];})},'transaction':_0x36476b})[_0xb2de('0x25')](function(){var _0x110d3a=_['map'](_0x643557,function(_0x59db9e){_0x59db9e[_0xb2de('0x5c')]=_0x16293e[_0xb2de('0x46')]['id'];return _0x59db9e;});var _0x24f892=[];return BPromise['each'](_0x110d3a,function(_0x1fff3c){return db[_0xb2de('0x57')][_0xb2de('0x49')](_0x1fff3c,{'include':[{'model':db[_0xb2de('0x58')],'as':_0xb2de('0x59')}],'raw':!![],'transaction':_0x36476b})[_0xb2de('0x25')](function(_0x44d562){_0x24f892[_0xb2de('0x5d')](_0x44d562[_0xb2de('0x4d')]({'plain':!![]}));});})[_0xb2de('0x25')](function(){return _0x24f892;});});});}})['then'](function(_0x563bdb){return _0x563bdb;})[_0xb2de('0x25')](respondWithResult(_0x470a8a,null))[_0xb2de('0x4b')](handleError(_0x470a8a,null));};exports['removeSections']=function(_0x130f5d,_0x11b299){var _0x1ebbbb;return db[_0xb2de('0x2c')]['find']({'where':{'id':_0x130f5d[_0xb2de('0x46')]['id']},'attributes':['id',_0xb2de('0x29')]})['then'](handleEntityNotFound(_0x11b299,null))[_0xb2de('0x25')](function(_0xf4bc84){if(_0xf4bc84){_0x1ebbbb=_0xf4bc84;return db[_0xb2de('0x57')][_0xb2de('0x26')]({'where':{'userProfileId':_0x130f5d['params']['id'],'sectionId':_0x130f5d['query'][_0xb2de('0x5e')]}});}})[_0xb2de('0x25')](function(){return _0x1ebbbb;})[_0xb2de('0x25')](respondWithStatusCode(_0x11b299,null))[_0xb2de('0x4b')](handleError(_0x11b299,null));};exports[_0xb2de('0x5f')]=function(_0x3c43d1,_0x52188f){var _0x5bbedf=[];var _0x79de58=[];return db[_0xb2de('0x57')][_0xb2de('0x43')]({'where':{'userProfileId':_0x3c43d1[_0xb2de('0x46')]['id']},'raw':!![]})[_0xb2de('0x25')](function(_0x227030){_0x5bbedf=_[_0xb2de('0x3f')](_0x227030,function(_0x47c7b6){return _0x47c7b6['enabled']===0x1||_['includes']([0x3eb,0x709],_0x47c7b6[_0xb2de('0x56')]);});if(!_[_0xb2de('0x60')](_0x5bbedf)){return _[_0xb2de('0x31')](_0x5bbedf,function(_0x2b92db){return _0x2b92db[_0xb2de('0x56')];});}else{return;}})[_0xb2de('0x25')](function(_0x3ca7d4){if(_0x3ca7d4)_0x79de58=_0x3ca7d4;if(_[_0xb2de('0x61')](_0x79de58,0x64)){var _0x35a9f4=_[_0xb2de('0x48')](_0x5bbedf,{'sectionId':0x64});return hasDefaultDashboard(_0x35a9f4)[_0xb2de('0x25')](function(_0x823071){return _[_0xb2de('0x31')](_0x5bbedf,function(_0x3b99ab){if(_0x3b99ab[_0xb2de('0x56')]===0x64){_0x3b99ab[_0xb2de('0x62')]=_0x823071;}return _0x3b99ab;});});}else{return;}})[_0xb2de('0x25')](function(_0x55f45e){if(_0x55f45e)_0x5bbedf=_0x55f45e;if(_['includes'](_0x79de58,0x3eb)){var _0x275539=_[_0xb2de('0x48')](_0x5bbedf,{'sectionId':0x3eb});return getCustomDashboards(_0x275539)[_0xb2de('0x25')](function(_0x487030){return _[_0xb2de('0x31')](_0x5bbedf,function(_0x4bb348){if(_0x275539[_0xb2de('0x63')]){if(_0x4bb348[_0xb2de('0x56')]===0x3eb){_0x4bb348[_0xb2de('0x62')]=_0x487030;}}else{if(_0x4bb348[_0xb2de('0x56')]===0x64){_0x4bb348[_0xb2de('0x62')]=_0x487030;}}return _0x4bb348;});});}else{return;}})['then'](function(_0x3f043d){if(_0x3f043d)_0x5bbedf=_0x3f043d;if(_[_0xb2de('0x61')](_0x79de58,0x709)){var _0x544015=_[_0xb2de('0x48')](_0x5bbedf,{'sectionId':0x709});return getPlugins(_0x544015)['then'](function(_0x2ab4ea){if(_0x544015[_0xb2de('0x63')]){return _[_0xb2de('0x31')](_0x5bbedf,function(_0x37de79){if(_0x37de79[_0xb2de('0x56')]===0x709){_0x37de79[_0xb2de('0x62')]=_0x2ab4ea;}return _0x37de79;});}else{var _0x19cde8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2ab4ea};var _0xb20560=_[_0xb2de('0x31')](_0x5bbedf);_0xb20560['push'](_0x19cde8);return _0xb20560;}});}else{return;}})['then'](function(_0x427b9d){if(_0x427b9d)_0x5bbedf=_0x427b9d;return _[_0xb2de('0x3f')](_0x5bbedf,['enabled',0x1]);})['then'](respondWithResult(_0x52188f,null))[_0xb2de('0x4b')](handleError(_0x52188f,null));};function hasDefaultDashboard(_0x1ea080){var _0x4883cd=[0x65];return new BPromise(function(_0x370685,_0x1e925c){try{if(_0x1ea080['autoAssociation']){_0x370685(_0x4883cd);}else{return db['UserProfileResource'][_0xb2de('0x64')]({'where':{'sectionId':_0x1ea080['id']},'raw':!![]})[_0xb2de('0x25')](function(_0x151b19){_0x151b19?_0x370685(_0x4883cd):_0x370685();});}}catch(_0x1dff1d){_0x1e925c(_0x1dff1d);}});}function getCustomDashboards(_0x5d8db7){var _0x273a9a=[];return new BPromise(function(_0x40f801,_0x41f9e8){try{if(_0x5d8db7[_0xb2de('0x55')]){return db[_0xb2de('0x65')][_0xb2de('0x43')]({'raw':!![]})['then'](function(_0x48d204){_0x48d204[_0xb2de('0x66')](function(_0x22d7d3){_0x273a9a[_0xb2de('0x5d')](_0x22d7d3['id']+0x1869f);});_0x40f801(_0x273a9a);});}else{return db[_0xb2de('0x58')][_0xb2de('0x43')]({'where':{'sectionId':_0x5d8db7['id']},'raw':!![]})['then'](function(_0x3ec3c8){_0x3ec3c8[_0xb2de('0x66')](function(_0x1cb271){_0x273a9a[_0xb2de('0x5d')](_0x1cb271[_0xb2de('0x67')]+0x1869f);});_0x40f801(_0x273a9a);});}}catch(_0xf4a624){_0x41f9e8(_0xf4a624);}});}function getPlugins(_0x85fe26){var _0x5cc9b2=[];return new BPromise(function(_0x544a32,_0x5c8d38){try{if(_0x85fe26[_0xb2de('0x55')]){return db[_0xb2de('0x68')]['findAll']({'raw':!![]})['then'](function(_0x5246c1){_0x5246c1[_0xb2de('0x66')](function(_0x2c74cb){_0x5cc9b2['push'](_0x2c74cb['id']+0x15b38);});_0x544a32(_0x5cc9b2);});}else{return db['UserProfileResource'][_0xb2de('0x43')]({'where':{'sectionId':_0x85fe26['id']},'raw':!![]})[_0xb2de('0x25')](function(_0x1313c5){_0x1313c5[_0xb2de('0x66')](function(_0x4b46f4){_0x5cc9b2[_0xb2de('0x5d')](_0x4b46f4[_0xb2de('0x67')]+0x15b38);});_0x544a32(_0x5cc9b2);});}}catch(_0x5196f3){_0x5c8d38(_0x5196f3);}});}exports[_0xb2de('0x69')]=function(_0x4149df,_0xb454b4){return db['UserProfile'][_0xb2de('0x48')]({'where':{'id':_0x4149df[_0xb2de('0x46')]['id']}})[_0xb2de('0x25')](handleEntityNotFound(_0xb454b4,null))[_0xb2de('0x25')](function(_0xea3661){if(_0xea3661){return db['sequelize'][_0xb2de('0x53')](function(_0x6aca7a){return db[_0xb2de('0x57')][_0xb2de('0x43')]({'where':{'userProfileId':_0x4149df[_0xb2de('0x46')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x50eb1a){if(_0x50eb1a){return db[_0xb2de('0x57')]['destroy']({'where':{'userProfileId':_0x4149df[_0xb2de('0x46')]['id'],'id':_[_0xb2de('0x31')](_0x50eb1a,function(_0x39d83a){return _0x39d83a['id'];})},'transaction':_0x6aca7a});}})['then'](function(_0x2d8b74){var _0x47df11=_[_0xb2de('0x31')](_0x4149df[_0xb2de('0x4a')],function(_0x3169f0){_0x3169f0[_0xb2de('0x5c')]=_0x4149df[_0xb2de('0x46')]['id'];return _0x3169f0;});return db[_0xb2de('0x57')][_0xb2de('0x6a')](_0x47df11,{'raw':!![],'transaction':_0x6aca7a});})[_0xb2de('0x25')](function(_0x481b1c){var _0x50ed45=_[_0xb2de('0x3f')](_['map'](_0x481b1c,function(_0x530eea){return _0x530eea['get']({'plain':!![]});}),{'includeAll':![]});if(_0x50ed45){return db['UserProfileSection'][_0xb2de('0x43')]({'where':{'userProfileId':_0x4149df[_0xb2de('0x46')]['id'],'sectionId':_[_0xb2de('0x31')](_0x50ed45,function(_0x3f4996){return _0x3f4996[_0xb2de('0x56')];})},'attributes':['id',_0xb2de('0x56')],'raw':!![]})[_0xb2de('0x25')](function(_0x22e557){var _0x511fd7=_[_0xb2de('0x31')](_0x4149df[_0xb2de('0x4a')],function(_0x3e2b6d){_0x3e2b6d[_0xb2de('0x5c')]=_0x4149df[_0xb2de('0x46')]['id'];return _0x3e2b6d;});return db[_0xb2de('0x58')][_0xb2de('0x6a')](_0x511fd7,{'raw':!![],'transaction':_0x6aca7a});});}})[_0xb2de('0x4b')](handleError(_0xb454b4,null));});}})[_0xb2de('0x25')](function(_0x243183){var _0x36cce6=_[_0xb2de('0x31')](_0x243183,function(_0x4d7af4){return _0x4d7af4['get']({'plain':!![]});});})['then'](respondWithResult(_0xb454b4,null))[_0xb2de('0x4b')](handleError(_0xb454b4,null));};exports[_0xb2de('0x6b')]=function(_0x2fb0c5,_0x2b71ef,_0x151cf4){return db[_0xb2de('0x2c')][_0xb2de('0x48')]({'where':{'id':_0x2fb0c5[_0xb2de('0x46')]['id']}})[_0xb2de('0x25')](handleEntityNotFound(_0x2b71ef,null))[_0xb2de('0x25')](function(_0x353993){if(_0x353993){return _0x353993[_0xb2de('0x6b')](_0x2fb0c5['query'][_0xb2de('0x5e')]);}})['then'](respondWithStatusCode(_0x2b71ef,null))[_0xb2de('0x4b')](handleError(_0x2b71ef,null));};exports[_0xb2de('0x6c')]=function(_0x3aa7c0,_0x2b294b){var _0x3854bc={};if(!_0x3aa7c0[_0xb2de('0x33')][_0xb2de('0x6d')])throw new Error(_0xb2de('0x6e'));if(!_0x3aa7c0[_0xb2de('0x33')]['hasOwnProperty'](_0xb2de('0x3a'))){_0x3854bc[_0xb2de('0x1f')]=qs[_0xb2de('0x1f')](_0x3aa7c0[_0xb2de('0x33')][_0xb2de('0x1f')]);_0x3854bc[_0xb2de('0x21')]=qs[_0xb2de('0x21')](_0x3aa7c0['query'][_0xb2de('0x21')]);}return db[_0xb2de('0x2c')][_0xb2de('0x48')]({'where':{'id':_0x3aa7c0[_0xb2de('0x46')]['id']}})[_0xb2de('0x25')](function(_0x42994e){if(!_0x42994e)throw new Error(_0xb2de('0x6f')+_0x3aa7c0[_0xb2de('0x46')]['id']);return db[_0xb2de('0x2c')][_0xb2de('0x6c')](_0x3aa7c0);})['then'](respondWithFilteredResult(_0x2b294b,_0x3854bc))[_0xb2de('0x4b')](handleError(_0x2b294b,null));}; \ No newline at end of file +var _0xe98f=['eml-format','zip-dir','request-promise','moment','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','catch','create','clone','options','get','createdAt','body','omit','updatedAt','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','find','describe','addSections','transaction','userProfileId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20'];(function(_0x5b8892,_0x1e7af1){var _0x2661b5=function(_0x5ab4ec){while(--_0x5ab4ec){_0x5b8892['push'](_0x5b8892['shift']());}};_0x2661b5(++_0x1e7af1);}(_0xe98f,0xde));var _0xfe98=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe98f[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0xfe98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe98('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe98('0x2'));var moment=require(_0xfe98('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfe98('0x4'));var path=require('path');var sox=require(_0xfe98('0x5'));var csv=require(_0xfe98('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe98('0x7'));var _=require('lodash');var squel=require(_0xfe98('0x8'));var crypto=require(_0xfe98('0x9'));var jsforce=require(_0xfe98('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfe98('0x6'));var querystring=require(_0xfe98('0xb'));var Papa=require('papaparse');var Redis=require(_0xfe98('0xc'));var authService=require(_0xfe98('0xd'));var qs=require(_0xfe98('0xe'));var as=require(_0xfe98('0xf'));var hardwareService=require(_0xfe98('0x10'));var logger=require(_0xfe98('0x11'))('api');var utils=require(_0xfe98('0x12'));var config=require(_0xfe98('0x13'));var licenseUtil=require(_0xfe98('0x14'));var db=require(_0xfe98('0x15'))['db'];config[_0xfe98('0x16')]=_['defaults'](config[_0xfe98('0x16')],{'host':_0xfe98('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe98('0x16')]));require('./userProfile.socket')[_0xfe98('0x18')](socket);function respondWithStatusCode(_0x3386de,_0x1b2155){_0x1b2155=_0x1b2155||0xcc;return function(_0x15e6b7){if(_0x15e6b7){return _0x3386de['sendStatus'](_0x1b2155);}return _0x3386de[_0xfe98('0x19')](_0x1b2155)['end']();};}function respondWithResult(_0x416c4c,_0x8c527c){_0x8c527c=_0x8c527c||0xc8;return function(_0x20d565){if(_0x20d565){return _0x416c4c[_0xfe98('0x19')](_0x8c527c)['json'](_0x20d565);}};}function respondWithFilteredResult(_0x56c0f4,_0x41dca9){return function(_0x26ad78){if(_0x26ad78){var _0x31bb37=typeof _0x41dca9['offset']===_0xfe98('0x1a')&&typeof _0x41dca9[_0xfe98('0x1b')]===_0xfe98('0x1a');var _0x40f0b1=_0x26ad78[_0xfe98('0x1c')];var _0x6d2220=_0x31bb37?0x0:_0x41dca9[_0xfe98('0x1d')];var _0x5cbdb0=_0x31bb37?_0x26ad78[_0xfe98('0x1c')]:_0x41dca9['offset']+_0x41dca9[_0xfe98('0x1b')];var _0x51d257;if(_0x5cbdb0>=_0x40f0b1){_0x5cbdb0=_0x40f0b1;_0x51d257=0xc8;}else{_0x51d257=0xce;}_0x56c0f4['status'](_0x51d257);return _0x56c0f4[_0xfe98('0x1e')](_0xfe98('0x1f'),_0x6d2220+'-'+_0x5cbdb0+'/'+_0x40f0b1)[_0xfe98('0x20')](_0x26ad78);}return null;};}function patchUpdates(_0xc3c06a){return function(_0x59e3ff){try{jsonpatch[_0xfe98('0x21')](_0x59e3ff,_0xc3c06a,!![]);}catch(_0x4b808c){return BPromise[_0xfe98('0x22')](_0x4b808c);}return _0x59e3ff[_0xfe98('0x23')]();};}function saveUpdates(_0xb628ed,_0x59fbde){return function(_0x52a381){if(_0x52a381){return _0x52a381[_0xfe98('0x24')](_0xb628ed)['then'](function(_0x7b629e){return _0x7b629e;});}return null;};}function removeEntity(_0x2c9323,_0x4d17b7){return function(_0x3dc31d){if(_0x3dc31d){return _0x3dc31d[_0xfe98('0x25')]()[_0xfe98('0x26')](function(){_0x2c9323[_0xfe98('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e40f0,_0x5921f0){return function(_0x51da63){if(!_0x51da63){_0x4e40f0[_0xfe98('0x27')](0x194);}return _0x51da63;};}function handleError(_0x221d7c,_0x3e8723){_0x3e8723=_0x3e8723||0x1f4;return function(_0x21c730){logger[_0xfe98('0x28')](_0x21c730[_0xfe98('0x29')]);if(_0x21c730[_0xfe98('0x2a')]){delete _0x21c730[_0xfe98('0x2a')];}_0x221d7c[_0xfe98('0x19')](_0x3e8723)[_0xfe98('0x2b')](_0x21c730);};}exports['index']=function(_0x1bed97,_0x1c56e5){var _0x9eb9c9={},_0x4507be={},_0x3094df={'count':0x0,'rows':[]};var _0x20ae5d=_[_0xfe98('0x2c')](db[_0xfe98('0x2d')][_0xfe98('0x2e')],function(_0xaf782){return{'name':_0xaf782[_0xfe98('0x2f')],'type':_0xaf782[_0xfe98('0x30')][_0xfe98('0x31')]};});_0x4507be[_0xfe98('0x32')]=_[_0xfe98('0x2c')](_0x20ae5d,'name');_0x4507be['query']=_[_0xfe98('0x33')](_0x1bed97[_0xfe98('0x34')]);_0x4507be['filters']=_[_0xfe98('0x35')](_0x4507be[_0xfe98('0x32')],_0x4507be[_0xfe98('0x34')]);_0x9eb9c9[_0xfe98('0x36')]=_[_0xfe98('0x35')](_0x4507be['model'],qs[_0xfe98('0x37')](_0x1bed97[_0xfe98('0x34')][_0xfe98('0x37')]));_0x9eb9c9[_0xfe98('0x36')]=_0x9eb9c9[_0xfe98('0x36')]['length']?_0x9eb9c9[_0xfe98('0x36')]:_0x4507be['model'];if(!_0x1bed97[_0xfe98('0x34')][_0xfe98('0x38')](_0xfe98('0x39'))){_0x9eb9c9[_0xfe98('0x1b')]=qs[_0xfe98('0x1b')](_0x1bed97[_0xfe98('0x34')][_0xfe98('0x1b')]);_0x9eb9c9[_0xfe98('0x1d')]=qs['offset'](_0x1bed97['query'][_0xfe98('0x1d')]);}_0x9eb9c9[_0xfe98('0x3a')]=qs[_0xfe98('0x3b')](_0x1bed97[_0xfe98('0x34')][_0xfe98('0x3b')]);_0x9eb9c9['where']=qs[_0xfe98('0x3c')](_[_0xfe98('0x3d')](_0x1bed97[_0xfe98('0x34')],_0x4507be['filters']),_0x20ae5d);if(_0x1bed97[_0xfe98('0x34')][_0xfe98('0x3e')]){_0x9eb9c9[_0xfe98('0x3f')]=_[_0xfe98('0x40')](_0x9eb9c9['where'],{'$or':_[_0xfe98('0x2c')](_0x20ae5d,function(_0x3abd5d){if(_0x3abd5d['type']!==_0xfe98('0x41')){var _0x14afbc={};_0x14afbc[_0x3abd5d[_0xfe98('0x2a')]]={'$like':'%'+_0x1bed97['query']['filter']+'%'};return _0x14afbc;}})});}_0x9eb9c9=_['merge']({},_0x9eb9c9,_0x1bed97['options']);var _0x2b796a={'where':_0x9eb9c9['where']};return db[_0xfe98('0x2d')][_0xfe98('0x1c')](_0x2b796a)['then'](function(_0x43b085){_0x3094df[_0xfe98('0x1c')]=_0x43b085;if(_0x1bed97[_0xfe98('0x34')][_0xfe98('0x42')]){_0x9eb9c9[_0xfe98('0x43')]=[{'all':!![]}];}return db[_0xfe98('0x2d')][_0xfe98('0x44')](_0x9eb9c9);})[_0xfe98('0x26')](function(_0x5dae05){_0x3094df[_0xfe98('0x45')]=_0x5dae05;return _0x3094df;})[_0xfe98('0x26')](respondWithFilteredResult(_0x1c56e5,_0x9eb9c9))['catch'](handleError(_0x1c56e5,null));};exports[_0xfe98('0x46')]=function(_0xd2cc2e,_0x575ff3){var _0x36643c={'raw':![],'where':{'id':_0xd2cc2e[_0xfe98('0x47')]['id']}},_0x50ccd7={};_0x50ccd7['model']=_[_0xfe98('0x33')](db[_0xfe98('0x2d')][_0xfe98('0x2e')]);_0x50ccd7[_0xfe98('0x34')]=_['keys'](_0xd2cc2e[_0xfe98('0x34')]);_0x50ccd7[_0xfe98('0x3c')]=_[_0xfe98('0x35')](_0x50ccd7[_0xfe98('0x32')],_0x50ccd7[_0xfe98('0x34')]);_0x36643c[_0xfe98('0x36')]=_['intersection'](_0x50ccd7[_0xfe98('0x32')],qs[_0xfe98('0x37')](_0xd2cc2e[_0xfe98('0x34')][_0xfe98('0x37')]));_0x36643c[_0xfe98('0x36')]=_0x36643c[_0xfe98('0x36')][_0xfe98('0x48')]?_0x36643c['attributes']:_0x50ccd7[_0xfe98('0x32')];if(_0xd2cc2e[_0xfe98('0x34')][_0xfe98('0x42')]){_0x36643c[_0xfe98('0x43')]=[{'all':!![]}];}_0x36643c=_[_0xfe98('0x40')]({},_0x36643c,_0xd2cc2e['options']);return db[_0xfe98('0x2d')]['find'](_0x36643c)[_0xfe98('0x26')](handleEntityNotFound(_0x575ff3,null))[_0xfe98('0x26')](respondWithResult(_0x575ff3,null))[_0xfe98('0x49')](handleError(_0x575ff3,null));};exports[_0xfe98('0x4a')]=function(_0x27b100,_0x475394){return db[_0xfe98('0x2d')][_0xfe98('0x4a')](_0x27b100['body'],{})[_0xfe98('0x26')](respondWithResult(_0x475394,0xc9))[_0xfe98('0x49')](handleError(_0x475394,null));};exports[_0xfe98('0x4b')]=function(_0x1720d3,_0x5ad61e){var _0x26cb3d={'where':{'id':_0x1720d3[_0xfe98('0x47')]['id']}},_0xc0573c={};_0xc0573c[_0xfe98('0x32')]=_[_0xfe98('0x33')](db[_0xfe98('0x2d')]['rawAttributes']);_0x26cb3d[_0xfe98('0x36')]=_[_0xfe98('0x35')](_0xc0573c[_0xfe98('0x32')],qs[_0xfe98('0x37')](_0x1720d3[_0xfe98('0x34')]['fields']));_0x26cb3d['attributes']=_0x26cb3d[_0xfe98('0x36')][_0xfe98('0x48')]?_0x26cb3d[_0xfe98('0x36')]:_0xc0573c[_0xfe98('0x32')];if(_0x1720d3[_0xfe98('0x34')][_0xfe98('0x42')]){_0x26cb3d[_0xfe98('0x43')]=[{'all':!![]}];}_0x26cb3d=_[_0xfe98('0x40')]({},_0x26cb3d,_0x1720d3[_0xfe98('0x4c')]);return db[_0xfe98('0x2d')]['find'](_0x26cb3d)[_0xfe98('0x26')](handleEntityNotFound(_0x5ad61e,null))['then'](function(_0x29eff4){if(_0x29eff4){var _0x278839=_0x29eff4[_0xfe98('0x4d')]({'plain':!![]});_0x278839=qs['omit'](_0x278839,['id',_0xfe98('0x4e'),'updatedAt','crudPermissions']);_0x1720d3[_0xfe98('0x4f')]=_[_0xfe98('0x50')](_0x1720d3[_0xfe98('0x4f')],['id',_0xfe98('0x4e'),_0xfe98('0x51')]);return db[_0xfe98('0x52')]['transaction'](function(_0x23e897){return db['UserProfile'][_0xfe98('0x4a')](_['merge'](_0x278839,_0x1720d3['body']),{'include':_0x1720d3['query'][_0xfe98('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x23e897})[_0xfe98('0x26')](function(_0x2b50c8){var _0x448025=_0x2b50c8['get']({'plain':!![]});return db[_0xfe98('0x53')]['findAll']({'where':{'userProfileId':_0x1720d3[_0xfe98('0x47')]['id']},'raw':!![]})[_0xfe98('0x26')](function(_0x5b2132){if(_0x5b2132){return BPromise[_0xfe98('0x54')](_0x5b2132,function(_0x6299e9){return new BPromise(function(_0xc2cc1b,_0x4753d2){if(_0x6299e9['autoAssociation']===null||_0x6299e9[_0xfe98('0x55')]===0x1)_0xc2cc1b(null);return db[_0xfe98('0x56')][_0xfe98('0x44')]({'where':{'sectionId':_0x6299e9['id']},'raw':!![]})[_0xfe98('0x26')](function(_0x4ab9c4){var _0x4192e0=_['map'](_0x4ab9c4,function(_0x7ca5b9){return qs[_0xfe98('0x50')](_0x7ca5b9,['id',_0xfe98('0x4e'),_0xfe98('0x51'),_0xfe98('0x57')]);});_0xc2cc1b(_0x4192e0);})[_0xfe98('0x49')](function(_0x4435d1){_0x4753d2(_0x4435d1);});})[_0xfe98('0x26')](function(_0x36a92f){var _0x3b8626=qs[_0xfe98('0x50')](_0x6299e9,['id',_0xfe98('0x4e'),_0xfe98('0x51')]);_0x3b8626['userProfileId']=_0x448025['id'];if(_0x36a92f)_0x3b8626[_0xfe98('0x58')]=_0x36a92f;return _0x3b8626;})['then'](function(_0x52befb){return db[_0xfe98('0x53')]['create'](_0x52befb,{'include':[{'model':db[_0xfe98('0x56')],'as':_0xfe98('0x58')}],'raw':!![],'transaction':_0x23e897});});})[_0xfe98('0x26')](function(){return _0x448025;});}});});});}})[_0xfe98('0x26')](respondWithResult(_0x5ad61e,0xc9))[_0xfe98('0x49')](handleError(_0x5ad61e,null));};exports[_0xfe98('0x24')]=function(_0x46a8fb,_0x1b5436){if(_0x46a8fb[_0xfe98('0x4f')]['id']){delete _0x46a8fb[_0xfe98('0x4f')]['id'];}return db[_0xfe98('0x2d')]['find']({'where':{'id':_0x46a8fb[_0xfe98('0x47')]['id']}})[_0xfe98('0x26')](handleEntityNotFound(_0x1b5436,null))[_0xfe98('0x26')](saveUpdates(_0x46a8fb[_0xfe98('0x4f')],null))[_0xfe98('0x26')](respondWithResult(_0x1b5436,null))['catch'](handleError(_0x1b5436,null));};exports[_0xfe98('0x25')]=function(_0xaa3d51,_0x2b827d){return db[_0xfe98('0x2d')][_0xfe98('0x59')]({'where':{'id':_0xaa3d51[_0xfe98('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b827d,null))[_0xfe98('0x26')](removeEntity(_0x2b827d,null))[_0xfe98('0x49')](handleError(_0x2b827d,null));};exports[_0xfe98('0x5a')]=function(_0x363584,_0x2d195e){return db[_0xfe98('0x2d')][_0xfe98('0x5a')]()['then'](respondWithResult(_0x2d195e,null))[_0xfe98('0x49')](handleError(_0x2d195e,null));};exports[_0xfe98('0x5b')]=function(_0x1ecaeb,_0x351129){var _0x3d9113=_0x1ecaeb[_0xfe98('0x4f')];return db[_0xfe98('0x2d')][_0xfe98('0x59')]({'where':{'id':_0x1ecaeb[_0xfe98('0x47')]['id']}})[_0xfe98('0x26')](handleEntityNotFound(_0x351129,null))[_0xfe98('0x26')](function(_0x2516e5){if(_0x2516e5){return db[_0xfe98('0x52')][_0xfe98('0x5c')](function(_0x1f0bc3){return db[_0xfe98('0x53')][_0xfe98('0x25')]({'where':{'userProfileId':_0x1ecaeb[_0xfe98('0x47')]['id'],'sectionId':_[_0xfe98('0x2c')](_0x3d9113,function(_0x3c14d9){return _0x3c14d9[_0xfe98('0x57')];})},'transaction':_0x1f0bc3})[_0xfe98('0x26')](function(){var _0x25c207=_[_0xfe98('0x2c')](_0x3d9113,function(_0xa5c1a7){_0xa5c1a7[_0xfe98('0x5d')]=_0x1ecaeb[_0xfe98('0x47')]['id'];return _0xa5c1a7;});var _0x59bcb0=[];return BPromise['each'](_0x25c207,function(_0x2683f2){return db[_0xfe98('0x53')][_0xfe98('0x4a')](_0x2683f2,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x1f0bc3})[_0xfe98('0x26')](function(_0x539e83){_0x59bcb0[_0xfe98('0x5e')](_0x539e83[_0xfe98('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x59bcb0;});});});}})[_0xfe98('0x26')](function(_0x4418e8){return _0x4418e8;})[_0xfe98('0x26')](respondWithResult(_0x351129,null))[_0xfe98('0x49')](handleError(_0x351129,null));};exports[_0xfe98('0x5f')]=function(_0x308b99,_0x271c09){var _0xc89e3a;return db[_0xfe98('0x2d')]['find']({'where':{'id':_0x308b99[_0xfe98('0x47')]['id']},'attributes':['id','name']})[_0xfe98('0x26')](handleEntityNotFound(_0x271c09,null))[_0xfe98('0x26')](function(_0x2bd663){if(_0x2bd663){_0xc89e3a=_0x2bd663;return db[_0xfe98('0x53')][_0xfe98('0x25')]({'where':{'userProfileId':_0x308b99[_0xfe98('0x47')]['id'],'sectionId':_0x308b99[_0xfe98('0x34')][_0xfe98('0x60')]}});}})[_0xfe98('0x26')](function(){return _0xc89e3a;})[_0xfe98('0x26')](respondWithStatusCode(_0x271c09,null))[_0xfe98('0x49')](handleError(_0x271c09,null));};exports[_0xfe98('0x61')]=function(_0x471499,_0x5c8015){var _0x4b5be5=[];var _0x454a42=[];return db[_0xfe98('0x53')][_0xfe98('0x44')]({'where':{'userProfileId':_0x471499[_0xfe98('0x47')]['id']},'raw':!![]})[_0xfe98('0x26')](function(_0x1921b4){_0x4b5be5=_[_0xfe98('0x3e')](_0x1921b4,function(_0x1b97bb){return _0x1b97bb[_0xfe98('0x62')]===0x1||_[_0xfe98('0x63')]([0x3eb,0x709],_0x1b97bb[_0xfe98('0x57')]);});if(!_[_0xfe98('0x64')](_0x4b5be5)){return _[_0xfe98('0x2c')](_0x4b5be5,function(_0x27f70e){return _0x27f70e[_0xfe98('0x57')];});}else{return;}})[_0xfe98('0x26')](function(_0x57756e){if(_0x57756e)_0x454a42=_0x57756e;if(_[_0xfe98('0x63')](_0x454a42,0x64)){var _0x9433b9=_[_0xfe98('0x59')](_0x4b5be5,{'sectionId':0x64});return hasDefaultDashboard(_0x9433b9)['then'](function(_0x180cff){return _[_0xfe98('0x2c')](_0x4b5be5,function(_0x1de511){if(_0x1de511[_0xfe98('0x57')]===0x64){_0x1de511[_0xfe98('0x65')]=_0x180cff;}return _0x1de511;});});}else{return;}})['then'](function(_0x548b82){if(_0x548b82)_0x4b5be5=_0x548b82;if(_[_0xfe98('0x63')](_0x454a42,0x3eb)){var _0x17141c=_['find'](_0x4b5be5,{'sectionId':0x3eb});return getCustomDashboards(_0x17141c)['then'](function(_0x4a686d){return _['map'](_0x4b5be5,function(_0x1382e2){if(_0x17141c[_0xfe98('0x62')]){if(_0x1382e2[_0xfe98('0x57')]===0x3eb){_0x1382e2['subsections']=_0x4a686d;}}else{if(_0x1382e2[_0xfe98('0x57')]===0x64){_0x1382e2[_0xfe98('0x65')]=_0x4a686d;}}return _0x1382e2;});});}else{return;}})[_0xfe98('0x26')](function(_0x2c039e){if(_0x2c039e)_0x4b5be5=_0x2c039e;if(_[_0xfe98('0x63')](_0x454a42,0x709)){var _0x131240=_[_0xfe98('0x59')](_0x4b5be5,{'sectionId':0x709});return getPlugins(_0x131240)['then'](function(_0x47b756){if(_0x131240['enabled']){return _[_0xfe98('0x2c')](_0x4b5be5,function(_0x35290b){if(_0x35290b[_0xfe98('0x57')]===0x709){_0x35290b[_0xfe98('0x65')]=_0x47b756;}return _0x35290b;});}else{var _0x425576={'sectionId':0x76c,'enabled':0x1,'subsections':_0x47b756};var _0xfc79a1=_[_0xfe98('0x2c')](_0x4b5be5);_0xfc79a1[_0xfe98('0x5e')](_0x425576);return _0xfc79a1;}});}else{return;}})['then'](function(_0x5df11e){if(_0x5df11e)_0x4b5be5=_0x5df11e;return _['filter'](_0x4b5be5,['enabled',0x1]);})[_0xfe98('0x26')](respondWithResult(_0x5c8015,null))[_0xfe98('0x49')](handleError(_0x5c8015,null));};function hasDefaultDashboard(_0x14e2e4){var _0x3153f0=[0x65];return new BPromise(function(_0x2de027,_0x19385b){try{if(_0x14e2e4['autoAssociation']){_0x2de027(_0x3153f0);}else{return db[_0xfe98('0x56')][_0xfe98('0x66')]({'where':{'sectionId':_0x14e2e4['id']},'raw':!![]})['then'](function(_0x4a9028){_0x4a9028?_0x2de027(_0x3153f0):_0x2de027();});}}catch(_0xd5b171){_0x19385b(_0xd5b171);}});}function getCustomDashboards(_0x11ba08){var _0x573815=[];return new BPromise(function(_0x8223f1,_0xed4caa){try{if(_0x11ba08['autoAssociation']){return db[_0xfe98('0x67')]['findAll']({'raw':!![]})[_0xfe98('0x26')](function(_0x376c8f){_0x376c8f[_0xfe98('0x68')](function(_0x234b80){_0x573815['push'](_0x234b80['id']+0x1869f);});_0x8223f1(_0x573815);});}else{return db[_0xfe98('0x56')][_0xfe98('0x44')]({'where':{'sectionId':_0x11ba08['id']},'raw':!![]})[_0xfe98('0x26')](function(_0x5919f1){_0x5919f1[_0xfe98('0x68')](function(_0x406758){_0x573815['push'](_0x406758[_0xfe98('0x69')]+0x1869f);});_0x8223f1(_0x573815);});}}catch(_0x4733d3){_0xed4caa(_0x4733d3);}});}function getPlugins(_0x51c65b){var _0xc6421f=[];return new BPromise(function(_0x4d9e98,_0x3e140f){try{if(_0x51c65b[_0xfe98('0x55')]){return db[_0xfe98('0x6a')][_0xfe98('0x44')]({'raw':!![]})['then'](function(_0x4f8099){_0x4f8099['forEach'](function(_0x10454b){_0xc6421f[_0xfe98('0x5e')](_0x10454b['id']+0x15b38);});_0x4d9e98(_0xc6421f);});}else{return db[_0xfe98('0x56')][_0xfe98('0x44')]({'where':{'sectionId':_0x51c65b['id']},'raw':!![]})[_0xfe98('0x26')](function(_0x147b1e){_0x147b1e[_0xfe98('0x68')](function(_0x4fe8cb){_0xc6421f[_0xfe98('0x5e')](_0x4fe8cb[_0xfe98('0x69')]+0x15b38);});_0x4d9e98(_0xc6421f);});}}catch(_0xd367d9){_0x3e140f(_0xd367d9);}});}exports['addResources']=function(_0x2ad8bb,_0x481789){return db[_0xfe98('0x2d')][_0xfe98('0x59')]({'where':{'id':_0x2ad8bb[_0xfe98('0x47')]['id']}})[_0xfe98('0x26')](handleEntityNotFound(_0x481789,null))['then'](function(_0x5165bc){if(_0x5165bc){return db[_0xfe98('0x52')]['transaction'](function(_0x361c00){return db[_0xfe98('0x53')][_0xfe98('0x44')]({'where':{'userProfileId':_0x2ad8bb[_0xfe98('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xfe98('0x26')](function(_0x1a5d43){if(_0x1a5d43){return db[_0xfe98('0x53')][_0xfe98('0x25')]({'where':{'userProfileId':_0x2ad8bb[_0xfe98('0x47')]['id'],'id':_[_0xfe98('0x2c')](_0x1a5d43,function(_0x17470a){return _0x17470a['id'];})},'transaction':_0x361c00});}})['then'](function(_0xd58077){var _0x5b1421=_[_0xfe98('0x2c')](_0x2ad8bb['body'],function(_0x1d2873){_0x1d2873[_0xfe98('0x5d')]=_0x2ad8bb[_0xfe98('0x47')]['id'];return _0x1d2873;});return db[_0xfe98('0x53')][_0xfe98('0x6b')](_0x5b1421,{'raw':!![],'transaction':_0x361c00});})['then'](function(_0x1befdb){var _0x8ecf07=_['filter'](_[_0xfe98('0x2c')](_0x1befdb,function(_0x416705){return _0x416705[_0xfe98('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x8ecf07){return db[_0xfe98('0x53')][_0xfe98('0x44')]({'where':{'userProfileId':_0x2ad8bb[_0xfe98('0x47')]['id'],'sectionId':_[_0xfe98('0x2c')](_0x8ecf07,function(_0x40714b){return _0x40714b['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xfe98('0x26')](function(_0x4d7a13){var _0x1be023=_[_0xfe98('0x2c')](_0x2ad8bb[_0xfe98('0x4f')],function(_0x11cf80){_0x11cf80['userProfileId']=_0x2ad8bb['params']['id'];return _0x11cf80;});return db[_0xfe98('0x56')]['bulkCreate'](_0x1be023,{'raw':!![],'transaction':_0x361c00});});}})['catch'](handleError(_0x481789,null));});}})[_0xfe98('0x26')](function(_0x5cd22f){var _0x3cf1a2=_[_0xfe98('0x2c')](_0x5cd22f,function(_0x2dc3ae){return _0x2dc3ae[_0xfe98('0x4d')]({'plain':!![]});});})[_0xfe98('0x26')](respondWithResult(_0x481789,null))['catch'](handleError(_0x481789,null));};exports[_0xfe98('0x6c')]=function(_0x3a53c1,_0x3f9b11,_0x1efc1a){return db[_0xfe98('0x2d')][_0xfe98('0x59')]({'where':{'id':_0x3a53c1['params']['id']}})[_0xfe98('0x26')](handleEntityNotFound(_0x3f9b11,null))[_0xfe98('0x26')](function(_0x250eb2){if(_0x250eb2){return _0x250eb2[_0xfe98('0x6c')](_0x3a53c1[_0xfe98('0x34')][_0xfe98('0x60')]);}})[_0xfe98('0x26')](respondWithStatusCode(_0x3f9b11,null))['catch'](handleError(_0x3f9b11,null));};exports[_0xfe98('0x6d')]=function(_0x233182,_0x148e11){var _0x37f452={};if(!_0x233182['query']['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x233182['query'][_0xfe98('0x38')](_0xfe98('0x39'))){_0x37f452[_0xfe98('0x1b')]=qs[_0xfe98('0x1b')](_0x233182['query']['limit']);_0x37f452[_0xfe98('0x1d')]=qs[_0xfe98('0x1d')](_0x233182[_0xfe98('0x34')][_0xfe98('0x1d')]);}return db[_0xfe98('0x2d')][_0xfe98('0x59')]({'where':{'id':_0x233182[_0xfe98('0x47')]['id']}})['then'](function(_0x3bc6fb){if(!_0x3bc6fb)throw new Error(_0xfe98('0x6e')+_0x233182[_0xfe98('0x47')]['id']);return db[_0xfe98('0x2d')][_0xfe98('0x6d')](_0x233182);})[_0xfe98('0x26')](respondWithFilteredResult(_0x148e11,_0x37f452))['catch'](handleError(_0x148e11,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index f075f6d..f4c7847 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 _0x3d49=['emit','../../mysqldb','UserProfile','setMaxListeners','save','remove'];(function(_0x5a1e40,_0x172118){var _0x494eec=function(_0x13861a){while(--_0x13861a){_0x5a1e40['push'](_0x5a1e40['shift']());}};_0x494eec(++_0x172118);}(_0x3d49,0x151));var _0x93d4=function(_0x246227,_0x12bfcb){_0x246227=_0x246227-0x0;var _0x37bd4a=_0x3d49[_0x246227];return _0x37bd4a;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x93d4('0x0'))['db'][_0x93d4('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x93d4('0x2')](0x0);var events={'afterCreate':_0x93d4('0x3'),'afterUpdate':'update','afterDestroy':_0x93d4('0x4')};function emitEvent(_0x9846c2){return function(_0xa1de2e,_0x41313a,_0x20e6c7){UserProfileEvents[_0x93d4('0x5')](_0x9846c2+':'+_0xa1de2e['id'],_0xa1de2e);UserProfileEvents['emit'](_0x9846c2,_0xa1de2e);_0x20e6c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x4317=['remove','hasOwnProperty','hook','exports','../../mysqldb','UserProfile','setMaxListeners','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4317,0x7c));var _0x7431=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4317[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x7431('0x0'))['db'][_0x7431('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7431('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7431('0x3'),'afterDestroy':_0x7431('0x4')};function emitEvent(_0x290b11){return function(_0xa4197b,_0x12c492,_0x201287){UserProfileEvents['emit'](_0x290b11+':'+_0xa4197b['id'],_0xa4197b);UserProfileEvents['emit'](_0x290b11,_0xa4197b);_0x201287(null);};}for(var e in events){if(events[_0x7431('0x5')](e)){var event=events[e];UserProfile[_0x7431('0x6')](e,emitEvent(event));}}module[_0x7431('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index cb578fc..92b4f72 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 _0x4137=['QueryTypes','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','define','user_profiles','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','ignore','autoAssociation','model','all','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','VIRTUAL','push','foreignKey','forEach','merge','options','include','reportType','default','reportId','DefaultReports','custom','CustomReports','rows','ids','count','includeAll','Tags','color','tag','ThroughTags','Agents','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','associatedResources','catch','then','map','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','name','role','Telephones','membername','User','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','Disposition','customdashboards','Dashboard','Interval','Sound','tags','Tag','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','toUpperCase','slice','Sequelize'];(function(_0x34cf30,_0x52107b){var _0x4e78ba=function(_0xf226bd){while(--_0xf226bd){_0x34cf30['push'](_0x34cf30['shift']());}};_0x4e78ba(++_0x52107b);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7413('0x0'));var attributes=require(_0x7413('0x1'));var qs=require(_0x7413('0x2'));var squel=require(_0x7413('0x3'));module[_0x7413('0x4')]=function(_0x410971){var _0x2e6df7=_0x410971[_0x7413('0x5')];function _0x258255(_0x3dc48a,_0x451a96){return new Promise(function(_0x3bb181,_0x4fbade){if(!_0x451a96)return _0x3bb181(null);var _0xc808cd=_0x451a96[_0x7413('0x6')]?{[_0x451a96[_0x7413('0x6')][_0x7413('0x7')]]:_0x451a96['filter'][_0x7413('0x8')]}:undefined;return _0x2e6df7[_0x3dc48a][_0x7413('0x9')]({'where':_0xc808cd,'raw':!![]})['then'](function(_0x422bf5){_0x451a96[_0x7413('0xa')]=_['map'](_0x422bf5,'id');_0x3bb181(_0x451a96);})[_0x7413('0xb')](function(_0x427b3b){_0x4fbade(_0x427b3b);});});}function _0x737ab4(_0x3e026b,_0x14212d){return new Promise(function(_0x5a1e62,_0xa25d72){var _0x32034c=_0x3e026b['filter']?{[_0x3e026b[_0x7413('0x6')][_0x7413('0x7')]]:_0x3e026b[_0x7413('0x6')]['value']}:undefined;return _0x2e6df7[_0x3e026b['model']]['findAll']({'where':_0x32034c,'raw':!![]})[_0x7413('0xc')](function(_0x336c4c){_0x14212d['associatedResources']=_[_0x7413('0xd')](_0x336c4c,function(_0x45bef0){return _0x45bef0['name'];});_0x5a1e62(_0x14212d);})[_0x7413('0xb')](function(_0x50f301){_0xa25d72(_0x50f301);});});}function _0x4b9a5b(_0x26501b,_0x568d1f,_0x195c72){if(!_0x568d1f)return Promise['resolve'](null);return new Promise(function(_0x2036b6,_0x3230d8){return _0x2e6df7[_0x7413('0xe')][_0x7413('0x9')]({'where':{'sectionId':_0x568d1f['id']},'raw':!![]})[_0x7413('0xc')](function(_0x26dafe){if(_0x26501b['field']&&_0x26501b[_0x7413('0x7')]!=='id'){_0x568d1f[_0x7413('0xa')]=_[_0x7413('0xd')](_0x26dafe,function(_0xfe5b8c){return _0xfe5b8c[_0x26501b['field']];});}else{if(_0x195c72===_0x7413('0xf')){_0x568d1f[_0x7413('0xa')]=_[_0x7413('0xd')](_0x26dafe,function(_0x20d3d2){return{'id':_0x20d3d2[_0x7413('0x10')],'type':_0x20d3d2[_0x7413('0x11')]};});}else{_0x568d1f[_0x7413('0xa')]=_[_0x7413('0xd')](_0x26dafe,function(_0x56a06a){return _0x56a06a['resourceId'];});}}_0x2036b6(_0x568d1f);})[_0x7413('0xb')](function(_0x599654){_0x3230d8(_0x599654);});});}function _0x1585ba(_0x372944,_0x3b0c81){var _0x2fc0f4={'parentSections':[]};switch(_0x372944[_0x7413('0x12')]()){case _0x7413('0x13'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x15');break;case _0x7413('0x16'):_0x2fc0f4['childModel']='SquareOdbc';break;case _0x7413('0x17'):_0x2fc0f4['childModel']=_0x7413('0x18');_0x2fc0f4[_0x7413('0x19')]=[{'name':_0x7413('0x1a'),'field':'name','foreignKey':_0x7413('0x1b')}];break;case _0x7413('0x1c'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x1d');break;case _0x7413('0x1e'):_0x2fc0f4[_0x7413('0x14')]='CmContact';_0x2fc0f4[_0x7413('0x19')]=[{'name':'Lists','field':'id','foreignKey':_0x7413('0x1f')}];break;case _0x7413('0x20'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x21');break;case _0x7413('0x22'):_0x2fc0f4[_0x7413('0x14')]='CmCompany';break;case _0x7413('0x23'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x24');break;case _0x7413('0x25'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x26');break;case _0x7413('0x27'):_0x2fc0f4['childModel']=_0x7413('0x28');break;case _0x7413('0x29'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x2a');break;case _0x7413('0x2b'):_0x2fc0f4['childModel']=_0x7413('0x2c');break;case'inboundroutes':case _0x7413('0x2d'):case _0x7413('0x2e'):_0x2fc0f4[_0x7413('0x14')]='VoiceExtension';break;case _0x7413('0x2f'):_0x2fc0f4['childModel']=_0x7413('0x30');break;case _0x7413('0x31'):_0x2fc0f4['childModel']='VoiceMail';break;case _0x7413('0x32'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x33');_0x2fc0f4['parentSections']=[{'name':'Agents','field':_0x7413('0x34'),'foreignKey':'membername','model':'User','filter':{'field':_0x7413('0x35'),'value':['agent']}},{'name':_0x7413('0x36'),'field':_0x7413('0x34'),'foreignKey':_0x7413('0x37'),'model':_0x7413('0x38'),'filter':{'field':_0x7413('0x35'),'value':['telephone']}},{'name':_0x7413('0x39'),'field':_0x7413('0x34'),'foreignKey':_0x7413('0x3a'),'model':_0x7413('0x3b'),'filter':{'field':_0x7413('0x11'),'value':[_0x7413('0x3c')]}},{'name':_0x7413('0x3d'),'field':_0x7413('0x34'),'foreignKey':_0x7413('0x3a'),'model':_0x7413('0x3b'),'filter':{'field':_0x7413('0x11'),'value':[_0x7413('0x3e')]}}];break;case'musiconholds':_0x2fc0f4[_0x7413('0x14')]='VoiceMusicOnHold';break;case'chanspies':_0x2fc0f4['childModel']='VoiceChanSpy';break;case'voiceprefixes':_0x2fc0f4[_0x7413('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0x2fc0f4[_0x7413('0x14')]='Campaign';break;case'mailqueues':_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x3f');break;case _0x7413('0x40'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x41');break;case'mailsubstatuses':_0x2fc0f4[_0x7413('0x14')]='MailSubstatus';break;case _0x7413('0x42'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x43');break;case _0x7413('0x44'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x45');break;case _0x7413('0x46'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x47');break;case _0x7413('0x48'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x49');break;case _0x7413('0x4a'):_0x2fc0f4['childModel']=_0x7413('0x4b');break;case _0x7413('0x4c'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x4d');break;case _0x7413('0x4e'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x4f');break;case _0x7413('0x50'):case _0x7413('0x51'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x3b');if(_0x3b0c81){_0x2fc0f4['parentSections']=[{'name':_0x7413('0x39')},{'name':'QueueCampaigns'}];}break;case _0x7413('0x52'):case _0x7413('0x53'):case _0x7413('0x54'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x38');if(_0x3b0c81){_0x2fc0f4[_0x7413('0x19')]=[{'name':_0x7413('0x55'),'filter':{'field':_0x7413('0x35'),'value':[_0x7413('0x56'),_0x7413('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x7413('0x58'):_0x2fc0f4['childModel']='ZendeskAccount';break;case _0x7413('0x59'):_0x2fc0f4[_0x7413('0x14')]='SalesforceAccount';break;case _0x7413('0x5a'):_0x2fc0f4['childModel']='FreshdeskAccount';break;case _0x7413('0x5b'):_0x2fc0f4['childModel']=_0x7413('0x5c');break;case _0x7413('0x5d'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x5e');break;case _0x7413('0x5f'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x60');break;case _0x7413('0x61'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x38');break;case'cannedanswers':_0x2fc0f4[_0x7413('0x14')]='CannedAnswer';break;case'dispositions':_0x2fc0f4['childModel']=_0x7413('0x62');break;case _0x7413('0x63'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x64');break;case'intervals':_0x2fc0f4['childModel']=_0x7413('0x65');break;case'pauses':_0x2fc0f4[_0x7413('0x14')]='Pause';break;case'scheduler':_0x2fc0f4['childModel']='Schedule';break;case'sounds':_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x66');break;case _0x7413('0x67'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x68');break;case'templates':_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x69');break;case _0x7413('0x6a'):_0x2fc0f4['childModel']=_0x7413('0x6b');break;case'trunks':_0x2fc0f4['childModel']=_0x7413('0x6c');break;case _0x7413('0x6d'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x6e');break;case _0x7413('0x6f'):_0x2fc0f4[_0x7413('0x14')]='Plugin';break;case _0x7413('0x70'):_0x2fc0f4['childModel']=_0x7413('0xf');_0x2fc0f4['parentSections']=[{'name':_0x7413('0x71'),'field':'id','foreignKey':'reportId'}];break;case _0x7413('0x72'):_0x2fc0f4[_0x7413('0x14')]='AnalyticMetric';break;}return _0x2fc0f4;}function _0x269976(_0x549623,_0xf01452){var _0x2a5db6=_0x549623['charAt'](0x0)[_0x7413('0x73')]()+_0x549623[_0x7413('0x74')](0x1);var _0x59d639={'type':_0x2e6df7[_0x7413('0x75')][_0x7413('0x76')]['SELECT'],'raw':!![]};return new Promise(function(_0xf4641,_0x28eaf4){var _0x34211b=squel[_0x7413('0x77')]()[_0x7413('0x7')](_0x7413('0x78')+_0x2a5db6+_0x7413('0x79'),'id')[_0x7413('0x7')]('ui.createdAt')[_0x7413('0x7a')]('user_has_'+_0x549623+_0x7413('0x7b'),'ui')[_0x7413('0x7c')](_0x7413('0x7d'),_0xf01452['id']);return _0x2e6df7[_0x7413('0x7e')]['query'](_0x34211b['toString'](),_0x59d639)['then'](function(_0x56b090){_0xf01452[_0x2a5db6+'OpenTabs']=_0x56b090;_0xf4641(_0x56b090);})[_0x7413('0xb')](function(_0x1c00e6){_0x28eaf4(_0x1c00e6);});});}return _0x410971[_0x7413('0x7f')]('UserProfile',attributes,{'tableName':_0x7413('0x80'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xb7dd83){var _0x12544d={'raw':_0xb7dd83[_0x7413('0x81')][_0x7413('0x82')],'where':{}};var _0x3db284={};var _0x2f0f0c={'count':0x0,'rows':[]};var _0x295a0a=_0xb7dd83[_0x7413('0x81')][_0x7413('0x83')];var _0x3f9cfd=_0xb7dd83[_0x7413('0x81')][_0x7413('0x84')]||![];var _0x4b381e=_0x1585ba(_0x295a0a,_0x3f9cfd);if(!_0x4b381e[_0x7413('0x14')])throw new Error(_0x7413('0x85')+_0x295a0a+'\x27');var _0x4cab22=[{'name':_0x295a0a}];if(!_[_0x7413('0x86')](_0x4b381e[_0x7413('0x19')]))_0x4cab22=_0x4b381e[_0x7413('0x19')];var _0x5e4aa1=[];for(var _0x102fd2=0x0;_0x102fd2<_0x4cab22[_0x7413('0x87')];_0x102fd2++){_0x5e4aa1['push'](_0x2e6df7[_0x7413('0x88')][_0x7413('0x89')]({'where':{'userProfileId':_0xb7dd83['params']['id'],'name':_0x4cab22[_0x102fd2][_0x7413('0x34')]},'raw':!![]}));}return Promise['all'](_0x5e4aa1)['then'](function(_0xbb819a){var _0xbd74d9=_[_0x7413('0x6')](_0xbb819a,function(_0x3d2f93){return _0x3d2f93?_0x3d2f93:undefined;});var _0x128419=_[_0x7413('0x6')](_0x4cab22,[_0x7413('0x8a'),!![]]);var _0x2f8637=_['isEmpty'](_0xbd74d9)&&_[_0x7413('0x86')](_0x128419)?null:_['union'](_0x128419,_0xbd74d9);if(!_0x2f8637)return null;var _0xd9c741=[];for(var _0x3deb37=0x0;_0x3deb37<_0x2f8637[_0x7413('0x87')];_0x3deb37++){var _0x3054f5=_[_0x7413('0x89')](_0x4cab22,function(_0x29d919){return _0x2f8637[_0x3deb37]?_0x29d919[_0x7413('0x34')]===_0x2f8637[_0x3deb37][_0x7413('0x34')]:null;});if(_0x3054f5){if(_0x2f8637[_0x3deb37][_0x7413('0x8a')]){_0xd9c741['push'](_0x258255(_0x4b381e[_0x7413('0x14')],_0x2f8637[_0x3deb37]));}else{if(!_0x2f8637[_0x3deb37][_0x7413('0x8b')]){_0xd9c741['push'](_0x4b9a5b(_0x3054f5,_0x2f8637[_0x3deb37],_0x4b381e[_0x7413('0x14')]));}else{if(_0x3054f5[_0x7413('0x8c')]){_0xd9c741['push'](_0x737ab4(_0x3054f5,_0x2f8637[_0x3deb37]));}}}}}return Promise[_0x7413('0x8d')](_0xd9c741);})['then'](function(_0xcbc6e){var _0x3d4ce3=_0xcbc6e;var _0x54f03d=null;if(_0x3d4ce3){_0x54f03d=_0x3d4ce3['length']===0x1?_0x3d4ce3[0x0]:null;}if(!_0x54f03d&&!_0x3d4ce3)return _0x2f0f0c;var _0x227a66=_0x2e6df7[_0x4b381e[_0x7413('0x14')]][_0x7413('0x8e')];_0x3db284['model']=_[_0x7413('0x8f')](_0x227a66);_0x3db284[_0x7413('0x81')]=_[_0x7413('0x8f')](_0xb7dd83[_0x7413('0x81')]);_0x3db284[_0x7413('0x90')]=_[_0x7413('0x91')](_0x3db284['model'],_0x3db284[_0x7413('0x81')]);_0x12544d[_0x7413('0x92')]=_[_0x7413('0x91')](_0x3db284['model'],qs[_0x7413('0x93')](_0xb7dd83[_0x7413('0x81')][_0x7413('0x93')]));_0x12544d[_0x7413('0x92')]=_0x12544d[_0x7413('0x92')][_0x7413('0x87')]?_0x12544d[_0x7413('0x92')]:_0x3db284[_0x7413('0x8c')];if(!_0xb7dd83[_0x7413('0x81')]['hasOwnProperty'](_0x7413('0x94'))){_0x12544d[_0x7413('0x95')]=qs[_0x7413('0x95')](_0xb7dd83[_0x7413('0x81')][_0x7413('0x95')]);_0x12544d[_0x7413('0x96')]=qs['offset'](_0xb7dd83[_0x7413('0x81')]['offset']);}_0x12544d['order']=qs[_0x7413('0x97')](_0xb7dd83[_0x7413('0x81')]['sort']);_0x12544d[_0x7413('0x7c')]=qs[_0x7413('0x90')](_[_0x7413('0x98')](_0xb7dd83[_0x7413('0x81')],_0x3db284[_0x7413('0x90')]));if(_0xb7dd83[_0x7413('0x81')][_0x7413('0x6')]){_0x12544d[_0x7413('0x7c')]=_['merge'](_0x12544d[_0x7413('0x7c')],{'$or':_['map'](_0x227a66,function(_0xeaf166){if(_0xeaf166[_0x7413('0x11')]['key']!==_0x7413('0x99')){var _0x1f4ce0={};_0x1f4ce0[_0xeaf166[_0x7413('0x7')]]={'$like':'%'+_0xb7dd83[_0x7413('0x81')][_0x7413('0x6')]+'%'};return _0x1f4ce0;}})});}var _0x3920b5=[];var _0x3dcbfb=null;var _0x12fbb2={};if(_0x54f03d){_0x3dcbfb=_[_0x7413('0x89')](_0x4cab22,[_0x7413('0x34'),_0x54f03d['name']]);if(_0x3dcbfb[_0x7413('0x7')]){_0x12fbb2={};if(_0x4b381e[_0x7413('0x14')]==='AnalyticExtractedReport'){_0x12fbb2[_0x3dcbfb['foreignKey']]=_['map'](_0x54f03d[_0x7413('0xa')],'id');}else{_0x12fbb2[_0x3dcbfb['foreignKey']]=_0x54f03d[_0x7413('0xa')];}_0x3920b5[_0x7413('0x9a')](_0x12fbb2);}else{_0x12544d[_0x7413('0x7c')]['id']=_0x54f03d[_0x7413('0xa')];}}else{for(var _0x470c21=0x0;_0x470c21<_0x3d4ce3[_0x7413('0x87')];_0x470c21++){_0x3dcbfb=_[_0x7413('0x89')](_0x4cab22,[_0x7413('0x34'),_0x3d4ce3[_0x470c21][_0x7413('0x34')]]);if(_0x3dcbfb['field']){_0x12fbb2={};_0x12fbb2[_0x3dcbfb[_0x7413('0x9b')]]=_0x3d4ce3[_0x470c21][_0x7413('0xa')];_0x3920b5[_0x7413('0x9a')](_0x12fbb2);}else{if(!_0x12544d['where']['id'])_0x12544d[_0x7413('0x7c')]['id']=[];_0x3d4ce3[_0x470c21][_0x7413('0xa')][_0x7413('0x9c')](function(_0x432906){_0x12544d[_0x7413('0x7c')]['id'][_0x7413('0x9a')](_0x432906);});}}}if(!_[_0x7413('0x86')](_0x3920b5)){_0x12544d[_0x7413('0x7c')]=_[_0x7413('0x9d')](_0x12544d[_0x7413('0x7c')],{'$and':{'$or':_0x3920b5}});}_0x12544d=_['merge']({},_0x12544d,_0xb7dd83[_0x7413('0x9e')]);if(_0x54f03d&&!_0x54f03d[_0x7413('0x8b')]&&_0x4b381e['childModel']===_0x7413('0xf')){if(_0xb7dd83[_0x7413('0x81')]['includeAll']){_0x12544d[_0x7413('0x9f')]=[{'all':!![]}];}return _0x2e6df7[_0x4b381e[_0x7413('0x14')]][_0x7413('0x9')](_0x12544d)['then'](function(_0x36d8cf){var _0x5a44bd=[];_0x36d8cf[_0x7413('0x9c')](function(_0x35f721){var _0x4537b5;switch(_0x35f721[_0x7413('0xa0')]){case _0x7413('0xa1'):_0x4537b5=_[_0x7413('0x89')](_0x54f03d['associatedResources'],function(_0x4ece1){return _0x4ece1['id']===_0x35f721[_0x7413('0xa2')]&&_0x4ece1[_0x7413('0x11')]===_0x7413('0xa3');});break;case _0x7413('0xa4'):_0x4537b5=_['find'](_0x54f03d[_0x7413('0xa')],function(_0x566ee0){return _0x566ee0['id']===_0x35f721[_0x7413('0xa2')]&&_0x566ee0[_0x7413('0x11')]===_0x7413('0xa5');});break;}if(_0x4537b5)_0x5a44bd['push'](_0x35f721);});_0x2f0f0c['count']=_0x5a44bd[_0x7413('0x87')];_0x2f0f0c[_0x7413('0xa6')]=_0x5a44bd;return _0x2f0f0c;});}else{if(!_[_0x7413('0x86')](_0xb7dd83[_0x7413('0x81')]['ids'])){_0x12544d['where']['id']=_0x12544d[_0x7413('0x7c')]['id']?_[_0x7413('0x91')](_0x12544d[_0x7413('0x7c')]['id'],_0xb7dd83['query']['ids']):_0xb7dd83[_0x7413('0x81')][_0x7413('0xa7')];}return _0x2e6df7[_0x4b381e[_0x7413('0x14')]][_0x7413('0xa8')]({'where':_0x12544d[_0x7413('0x7c')]})[_0x7413('0xc')](function(_0x5fd045){_0x2f0f0c['count']=_0x5fd045;if(_0xb7dd83['query'][_0x7413('0xa9')]){if(_0x4b381e[_0x7413('0x14')]==='CmContact'){_0x12544d[_0x7413('0x9f')]=[{'model':_0x2e6df7[_0x7413('0x68')],'as':_0x7413('0xaa'),'attributes':['id',_0x7413('0x34'),_0x7413('0xab')],'required':_0xb7dd83[_0x7413('0x81')][_0x7413('0xac')]?!![]:![]},{'model':_0x2e6df7[_0x7413('0x68')],'as':_0x7413('0xad'),'attributes':['id','name',_0x7413('0xab')],'through':_0xb7dd83[_0x7413('0x81')][_0x7413('0xac')]?{'attributes':[],'where':{'TagId':_0xb7dd83[_0x7413('0x81')][_0x7413('0xac')]||undefined}}:{},'required':_0xb7dd83[_0x7413('0x81')]['tag']?!![]:![]}];}else{_0x12544d['include']=[{'all':!![]}];}}return _0x2e6df7[_0x4b381e['childModel']][_0x7413('0x9')](_0x12544d);})[_0x7413('0xc')](function(_0x999109){_0x2f0f0c[_0x7413('0xa6')]=_0x999109;if(_0x295a0a===_0x7413('0xae')&&_0xb7dd83[_0x7413('0x81')][_0x7413('0xaf')]===_0x7413('0xb0')){var _0x4e872e=[];for(var _0x11f5a3=0x0;_0x11f5a3<_0x2f0f0c['rows'][_0x7413('0x87')];_0x11f5a3++){_0x4e872e[_0x7413('0x9a')](_0x269976(_0x7413('0xb1'),_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));_0x4e872e['push'](_0x269976(_0x7413('0xb3'),_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));_0x4e872e[_0x7413('0x9a')](_0x269976(_0x7413('0xb4'),_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));_0x4e872e[_0x7413('0x9a')](_0x269976(_0x7413('0xb5'),_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));_0x4e872e[_0x7413('0x9a')](_0x269976(_0x7413('0xb6'),_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));_0x4e872e['push'](_0x269976('whatsapp',_0x2f0f0c[_0x7413('0xa6')][_0x11f5a3][_0x7413('0xb2')]));}return Promise['all'](_0x4e872e)[_0x7413('0xc')](function(){return _0x2f0f0c;});}return _0x2f0f0c;});}});}}});}; \ No newline at end of file +var _0xda2d=['variables','Variable','plugins','reportId','metrics','charAt','toUpperCase','slice','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','mergeResources','isEmpty','length','push','UserProfileSection','params','find','ignore','autoAssociation','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','default','DefaultReports','custom','CustomReports','count','ids','CmContact','Tag','Tags','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','fax','mail','openchannel','all','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','then','map','catch','model','findAll','name','resolve','UserProfileResource','associatedResources','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatWebsite','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','role','agent','Telephones','User','telephone','VoiceQueues','VoiceQueue','queue','outbound','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','telephones','Users','user','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','scheduler','Schedule','sounds','Sound','tags','templates','Template','Trigger'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0xda2d,0x102));var _0xdda2=function(_0x22c6b0,_0x69f99){_0x22c6b0=_0x22c6b0-0x0;var _0x2db8fe=_0xda2d[_0x22c6b0];return _0x2db8fe;};'use strict';var _=require('lodash');var attributes=require(_0xdda2('0x0'));var qs=require(_0xdda2('0x1'));var squel=require(_0xdda2('0x2'));module[_0xdda2('0x3')]=function(_0x329c5e){var _0x58973d=_0x329c5e['models'];function _0x5a5f9f(_0x357e97,_0x319129){return new Promise(function(_0x2965a5,_0x39f6c9){if(!_0x319129)return _0x2965a5(null);var _0xc256bc=_0x319129[_0xdda2('0x4')]?{[_0x319129[_0xdda2('0x4')][_0xdda2('0x5')]]:_0x319129[_0xdda2('0x4')][_0xdda2('0x6')]}:undefined;return _0x58973d[_0x357e97]['findAll']({'where':_0xc256bc,'raw':!![]})[_0xdda2('0x7')](function(_0x22c6e5){_0x319129['associatedResources']=_[_0xdda2('0x8')](_0x22c6e5,'id');_0x2965a5(_0x319129);})[_0xdda2('0x9')](function(_0x42d990){_0x39f6c9(_0x42d990);});});}function _0x346119(_0x171123,_0x30ca9a){return new Promise(function(_0x26fe81,_0x1dac9a){var _0x57aba3=_0x171123['filter']?{[_0x171123['filter'][_0xdda2('0x5')]]:_0x171123[_0xdda2('0x4')][_0xdda2('0x6')]}:undefined;return _0x58973d[_0x171123[_0xdda2('0xa')]][_0xdda2('0xb')]({'where':_0x57aba3,'raw':!![]})[_0xdda2('0x7')](function(_0x3490f1){_0x30ca9a['associatedResources']=_[_0xdda2('0x8')](_0x3490f1,function(_0x4b0220){return _0x4b0220[_0xdda2('0xc')];});_0x26fe81(_0x30ca9a);})[_0xdda2('0x9')](function(_0x3553d5){_0x1dac9a(_0x3553d5);});});}function _0x457764(_0x1922b1,_0x5d8a83,_0x55d674){if(!_0x5d8a83)return Promise[_0xdda2('0xd')](null);return new Promise(function(_0x518c6d,_0x1a5192){return _0x58973d[_0xdda2('0xe')][_0xdda2('0xb')]({'where':{'sectionId':_0x5d8a83['id']},'raw':!![]})[_0xdda2('0x7')](function(_0x8d44b7){if(_0x1922b1[_0xdda2('0x5')]&&_0x1922b1[_0xdda2('0x5')]!=='id'){_0x5d8a83[_0xdda2('0xf')]=_[_0xdda2('0x8')](_0x8d44b7,function(_0x337b0b){return _0x337b0b[_0x1922b1[_0xdda2('0x5')]];});}else{if(_0x55d674===_0xdda2('0x10')){_0x5d8a83['associatedResources']=_[_0xdda2('0x8')](_0x8d44b7,function(_0x5dfce7){return{'id':_0x5dfce7[_0xdda2('0x11')],'type':_0x5dfce7[_0xdda2('0x12')]};});}else{_0x5d8a83[_0xdda2('0xf')]=_['map'](_0x8d44b7,function(_0x347ee6){return _0x347ee6['resourceId'];});}}_0x518c6d(_0x5d8a83);})[_0xdda2('0x9')](function(_0x107ee4){_0x1a5192(_0x107ee4);});});}function _0x4ac3eb(_0x144f1e,_0xfda248){var _0x2528d7={'parentSections':[]};switch(_0x144f1e[_0xdda2('0x13')]()){case _0xdda2('0x14'):_0x2528d7['childModel']=_0xdda2('0x15');break;case _0xdda2('0x16'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x18');break;case'squarerecordings':_0x2528d7['childModel']=_0xdda2('0x19');_0x2528d7[_0xdda2('0x1a')]=[{'name':_0xdda2('0x1b'),'field':'name','foreignKey':_0xdda2('0x1c')}];break;case _0xdda2('0x1d'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x1e');break;case _0xdda2('0x1f'):_0x2528d7[_0xdda2('0x17')]='CmContact';_0x2528d7[_0xdda2('0x1a')]=[{'name':_0xdda2('0x20'),'field':'id','foreignKey':'ListId'}];break;case _0xdda2('0x21'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x22');break;case _0xdda2('0x23'):_0x2528d7['childModel']=_0xdda2('0x24');break;case _0xdda2('0x25'):_0x2528d7['childModel']=_0xdda2('0x26');break;case'chatqueues':_0x2528d7[_0xdda2('0x17')]='ChatQueue';break;case'chatwebsites':_0x2528d7['childModel']=_0xdda2('0x27');break;case'faxqueues':_0x2528d7[_0xdda2('0x17')]='FaxQueue';break;case'faxaccounts':_0x2528d7['childModel']=_0xdda2('0x28');break;case _0xdda2('0x29'):case _0xdda2('0x2a'):case _0xdda2('0x2b'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x2c');break;case _0xdda2('0x2d'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x2e');break;case _0xdda2('0x2f'):_0x2528d7['childModel']=_0xdda2('0x30');break;case _0xdda2('0x31'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x32');_0x2528d7[_0xdda2('0x1a')]=[{'name':_0xdda2('0x33'),'field':_0xdda2('0xc'),'foreignKey':'membername','model':'User','filter':{'field':_0xdda2('0x34'),'value':[_0xdda2('0x35')]}},{'name':_0xdda2('0x36'),'field':'name','foreignKey':'membername','model':_0xdda2('0x37'),'filter':{'field':_0xdda2('0x34'),'value':[_0xdda2('0x38')]}},{'name':_0xdda2('0x39'),'field':_0xdda2('0xc'),'foreignKey':'queue','model':_0xdda2('0x3a'),'filter':{'field':_0xdda2('0x12'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0xdda2('0xc'),'foreignKey':_0xdda2('0x3b'),'model':_0xdda2('0x3a'),'filter':{'field':_0xdda2('0x12'),'value':[_0xdda2('0x3c')]}}];break;case'musiconholds':_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x3d');break;case _0xdda2('0x3e'):_0x2528d7[_0xdda2('0x17')]='VoiceChanSpy';break;case'voiceprefixes':_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x3f');break;case _0xdda2('0x40'):_0x2528d7['childModel']=_0xdda2('0x41');break;case'mailqueues':_0x2528d7[_0xdda2('0x17')]='MailQueue';break;case _0xdda2('0x42'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x43');break;case _0xdda2('0x44'):_0x2528d7['childModel']=_0xdda2('0x45');break;case'openchannelqueues':_0x2528d7[_0xdda2('0x17')]='OpenchannelQueue';break;case _0xdda2('0x46'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x47');break;case _0xdda2('0x48'):_0x2528d7[_0xdda2('0x17')]='SmsQueue';break;case _0xdda2('0x49'):_0x2528d7[_0xdda2('0x17')]='SmsAccount';break;case _0xdda2('0x4a'):_0x2528d7['childModel']=_0xdda2('0x4b');break;case _0xdda2('0x4c'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x4d');break;case _0xdda2('0x4e'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x4f');break;case _0xdda2('0x50'):case _0xdda2('0x51'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x3a');if(_0xfda248){_0x2528d7[_0xdda2('0x1a')]=[{'name':_0xdda2('0x39')},{'name':'QueueCampaigns'}];}break;case'users':case'agents':case _0xdda2('0x52'):_0x2528d7[_0xdda2('0x17')]='User';if(_0xfda248){_0x2528d7[_0xdda2('0x1a')]=[{'name':_0xdda2('0x53'),'filter':{'field':_0xdda2('0x34'),'value':['admin',_0xdda2('0x54')]},'ignore':!![]},{'name':_0xdda2('0x33')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x2528d7[_0xdda2('0x17')]='ZendeskAccount';break;case _0xdda2('0x55'):_0x2528d7['childModel']=_0xdda2('0x56');break;case _0xdda2('0x57'):_0x2528d7['childModel']='FreshdeskAccount';break;case _0xdda2('0x58'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x59');break;case _0xdda2('0x5a'):_0x2528d7['childModel']=_0xdda2('0x5b');break;case _0xdda2('0x5c'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x5d');break;case _0xdda2('0x5e'):_0x2528d7['childModel']=_0xdda2('0x37');break;case _0xdda2('0x5f'):_0x2528d7['childModel']=_0xdda2('0x60');break;case _0xdda2('0x61'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x62');break;case _0xdda2('0x63'):_0x2528d7[_0xdda2('0x17')]='Dashboard';break;case _0xdda2('0x64'):_0x2528d7['childModel']=_0xdda2('0x65');break;case'pauses':_0x2528d7[_0xdda2('0x17')]='Pause';break;case _0xdda2('0x66'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x67');break;case _0xdda2('0x68'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x69');break;case _0xdda2('0x6a'):_0x2528d7[_0xdda2('0x17')]='Tag';break;case _0xdda2('0x6b'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x6c');break;case'triggers':_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x6d');break;case'trunks':_0x2528d7[_0xdda2('0x17')]='Trunk';break;case _0xdda2('0x6e'):_0x2528d7[_0xdda2('0x17')]=_0xdda2('0x6f');break;case _0xdda2('0x70'):_0x2528d7[_0xdda2('0x17')]='Plugin';break;case'extractedreports':_0x2528d7['childModel']=_0xdda2('0x10');_0x2528d7[_0xdda2('0x1a')]=[{'name':'Reports','field':'id','foreignKey':_0xdda2('0x71')}];break;case _0xdda2('0x72'):_0x2528d7[_0xdda2('0x17')]='AnalyticMetric';break;}return _0x2528d7;}function _0x3fd76c(_0x14af86,_0x113266){var _0x58ae15=_0x14af86[_0xdda2('0x73')](0x0)[_0xdda2('0x74')]()+_0x14af86[_0xdda2('0x75')](0x1);var _0x25c9a9={'type':_0x58973d['Sequelize'][_0xdda2('0x76')]['SELECT'],'raw':!![]};return new Promise(function(_0x494b81,_0x58fcec){var _0x285cec=squel[_0xdda2('0x77')]()[_0xdda2('0x5')](_0xdda2('0x78')+_0x58ae15+_0xdda2('0x79'),'id')[_0xdda2('0x5')](_0xdda2('0x7a'))[_0xdda2('0x7b')](_0xdda2('0x7c')+_0x14af86+_0xdda2('0x7d'),'ui')[_0xdda2('0x7e')]('ui.UserId\x20=\x20?',_0x113266['id']);return _0x58973d[_0xdda2('0x7f')][_0xdda2('0x80')](_0x285cec[_0xdda2('0x81')](),_0x25c9a9)[_0xdda2('0x7')](function(_0x90bb5c){_0x113266[_0x58ae15+_0xdda2('0x82')]=_0x90bb5c;_0x494b81(_0x90bb5c);})[_0xdda2('0x9')](function(_0x57fb41){_0x58fcec(_0x57fb41);});});}return _0x329c5e[_0xdda2('0x83')](_0xdda2('0x84'),attributes,{'tableName':_0xdda2('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xe8d81a){var _0x44f619={'raw':_0xe8d81a['query'][_0xdda2('0x86')],'where':{}};var _0x145d45={};var _0xbc441a={'count':0x0,'rows':[]};var _0x2c442e=_0xe8d81a[_0xdda2('0x80')]['section'];var _0x17aaab=_0xe8d81a[_0xdda2('0x80')][_0xdda2('0x87')]||![];var _0x4530b7=_0x4ac3eb(_0x2c442e,_0x17aaab);if(!_0x4530b7[_0xdda2('0x17')])throw new Error('Invalid\x20section\x20\x27'+_0x2c442e+'\x27');var _0x29dd19=[{'name':_0x2c442e}];if(!_[_0xdda2('0x88')](_0x4530b7[_0xdda2('0x1a')]))_0x29dd19=_0x4530b7['parentSections'];var _0x1b7b96=[];for(var _0x483c17=0x0;_0x483c17<_0x29dd19[_0xdda2('0x89')];_0x483c17++){_0x1b7b96[_0xdda2('0x8a')](_0x58973d[_0xdda2('0x8b')]['find']({'where':{'userProfileId':_0xe8d81a[_0xdda2('0x8c')]['id'],'name':_0x29dd19[_0x483c17][_0xdda2('0xc')]},'raw':!![]}));}return Promise['all'](_0x1b7b96)[_0xdda2('0x7')](function(_0x5adab5){var _0x3d645b=_[_0xdda2('0x4')](_0x5adab5,function(_0x354fb9){return _0x354fb9?_0x354fb9:undefined;});var _0x29cf1a=_[_0xdda2('0x4')](_0x29dd19,['ignore',!![]]);var _0x586ca1=_[_0xdda2('0x88')](_0x3d645b)&&_[_0xdda2('0x88')](_0x29cf1a)?null:_['union'](_0x29cf1a,_0x3d645b);if(!_0x586ca1)return null;var _0x53e9e0=[];for(var _0x439eb0=0x0;_0x439eb0<_0x586ca1['length'];_0x439eb0++){var _0x12a052=_[_0xdda2('0x8d')](_0x29dd19,function(_0x4910a6){return _0x586ca1[_0x439eb0]?_0x4910a6[_0xdda2('0xc')]===_0x586ca1[_0x439eb0][_0xdda2('0xc')]:null;});if(_0x12a052){if(_0x586ca1[_0x439eb0][_0xdda2('0x8e')]){_0x53e9e0[_0xdda2('0x8a')](_0x5a5f9f(_0x4530b7[_0xdda2('0x17')],_0x586ca1[_0x439eb0]));}else{if(!_0x586ca1[_0x439eb0][_0xdda2('0x8f')]){_0x53e9e0['push'](_0x457764(_0x12a052,_0x586ca1[_0x439eb0],_0x4530b7[_0xdda2('0x17')]));}else{if(_0x12a052[_0xdda2('0xa')]){_0x53e9e0[_0xdda2('0x8a')](_0x346119(_0x12a052,_0x586ca1[_0x439eb0]));}}}}}return Promise['all'](_0x53e9e0);})[_0xdda2('0x7')](function(_0x2ec405){var _0x51963f=_0x2ec405;var _0x4e721b=null;if(_0x51963f){_0x4e721b=_0x51963f[_0xdda2('0x89')]===0x1?_0x51963f[0x0]:null;}if(!_0x4e721b&&!_0x51963f)return _0xbc441a;var _0x232823=_0x58973d[_0x4530b7[_0xdda2('0x17')]]['rawAttributes'];_0x145d45['model']=_[_0xdda2('0x90')](_0x232823);_0x145d45['query']=_[_0xdda2('0x90')](_0xe8d81a[_0xdda2('0x80')]);_0x145d45[_0xdda2('0x91')]=_[_0xdda2('0x92')](_0x145d45[_0xdda2('0xa')],_0x145d45[_0xdda2('0x80')]);_0x44f619['attributes']=_['intersection'](_0x145d45[_0xdda2('0xa')],qs['fields'](_0xe8d81a[_0xdda2('0x80')][_0xdda2('0x93')]));_0x44f619[_0xdda2('0x94')]=_0x44f619[_0xdda2('0x94')][_0xdda2('0x89')]?_0x44f619[_0xdda2('0x94')]:_0x145d45[_0xdda2('0xa')];if(!_0xe8d81a[_0xdda2('0x80')][_0xdda2('0x95')]('nolimit')){_0x44f619[_0xdda2('0x96')]=qs[_0xdda2('0x96')](_0xe8d81a[_0xdda2('0x80')][_0xdda2('0x96')]);_0x44f619['offset']=qs[_0xdda2('0x97')](_0xe8d81a[_0xdda2('0x80')][_0xdda2('0x97')]);}_0x44f619[_0xdda2('0x98')]=qs['sort'](_0xe8d81a['query'][_0xdda2('0x99')]);_0x44f619[_0xdda2('0x7e')]=qs[_0xdda2('0x91')](_[_0xdda2('0x9a')](_0xe8d81a['query'],_0x145d45[_0xdda2('0x91')]));if(_0xe8d81a[_0xdda2('0x80')][_0xdda2('0x4')]){_0x44f619[_0xdda2('0x7e')]=_[_0xdda2('0x9b')](_0x44f619[_0xdda2('0x7e')],{'$or':_[_0xdda2('0x8')](_0x232823,function(_0x103e37){if(_0x103e37[_0xdda2('0x12')][_0xdda2('0x9c')]!==_0xdda2('0x9d')){var _0x23a80a={};_0x23a80a[_0x103e37[_0xdda2('0x5')]]={'$like':'%'+_0xe8d81a[_0xdda2('0x80')][_0xdda2('0x4')]+'%'};return _0x23a80a;}})});}var _0x4b9481=[];var _0x221f72=null;var _0x20969b={};if(_0x4e721b){_0x221f72=_['find'](_0x29dd19,['name',_0x4e721b[_0xdda2('0xc')]]);if(_0x221f72[_0xdda2('0x5')]){_0x20969b={};if(_0x4530b7[_0xdda2('0x17')]===_0xdda2('0x10')){_0x20969b[_0x221f72[_0xdda2('0x9e')]]=_[_0xdda2('0x8')](_0x4e721b['associatedResources'],'id');}else{_0x20969b[_0x221f72[_0xdda2('0x9e')]]=_0x4e721b[_0xdda2('0xf')];}_0x4b9481[_0xdda2('0x8a')](_0x20969b);}else{_0x44f619[_0xdda2('0x7e')]['id']=_0x4e721b['associatedResources'];}}else{for(var _0xbf1248=0x0;_0xbf1248<_0x51963f['length'];_0xbf1248++){_0x221f72=_[_0xdda2('0x8d')](_0x29dd19,[_0xdda2('0xc'),_0x51963f[_0xbf1248]['name']]);if(_0x221f72[_0xdda2('0x5')]){_0x20969b={};_0x20969b[_0x221f72[_0xdda2('0x9e')]]=_0x51963f[_0xbf1248][_0xdda2('0xf')];_0x4b9481[_0xdda2('0x8a')](_0x20969b);}else{if(!_0x44f619[_0xdda2('0x7e')]['id'])_0x44f619[_0xdda2('0x7e')]['id']=[];_0x51963f[_0xbf1248][_0xdda2('0xf')][_0xdda2('0x9f')](function(_0x3a375d){_0x44f619[_0xdda2('0x7e')]['id'][_0xdda2('0x8a')](_0x3a375d);});}}}if(!_['isEmpty'](_0x4b9481)){_0x44f619[_0xdda2('0x7e')]=_[_0xdda2('0x9b')](_0x44f619[_0xdda2('0x7e')],{'$and':{'$or':_0x4b9481}});}_0x44f619=_[_0xdda2('0x9b')]({},_0x44f619,_0xe8d81a[_0xdda2('0xa0')]);if(_0x4e721b&&!_0x4e721b['autoAssociation']&&_0x4530b7[_0xdda2('0x17')]===_0xdda2('0x10')){if(_0xe8d81a['query'][_0xdda2('0xa1')]){_0x44f619[_0xdda2('0xa2')]=[{'all':!![]}];}return _0x58973d[_0x4530b7['childModel']]['findAll'](_0x44f619)[_0xdda2('0x7')](function(_0x304609){var _0x179b1a=[];_0x304609[_0xdda2('0x9f')](function(_0x14d8fa){var _0x2478e2;switch(_0x14d8fa['reportType']){case _0xdda2('0xa3'):_0x2478e2=_[_0xdda2('0x8d')](_0x4e721b['associatedResources'],function(_0x4bd37d){return _0x4bd37d['id']===_0x14d8fa[_0xdda2('0x71')]&&_0x4bd37d['type']===_0xdda2('0xa4');});break;case _0xdda2('0xa5'):_0x2478e2=_[_0xdda2('0x8d')](_0x4e721b['associatedResources'],function(_0xe6f37b){return _0xe6f37b['id']===_0x14d8fa['reportId']&&_0xe6f37b[_0xdda2('0x12')]===_0xdda2('0xa6');});break;}if(_0x2478e2)_0x179b1a[_0xdda2('0x8a')](_0x14d8fa);});_0xbc441a[_0xdda2('0xa7')]=_0x179b1a['length'];_0xbc441a['rows']=_0x179b1a;return _0xbc441a;});}else{if(!_[_0xdda2('0x88')](_0xe8d81a[_0xdda2('0x80')]['ids'])){_0x44f619[_0xdda2('0x7e')]['id']=_0x44f619[_0xdda2('0x7e')]['id']?_[_0xdda2('0x92')](_0x44f619[_0xdda2('0x7e')]['id'],_0xe8d81a[_0xdda2('0x80')][_0xdda2('0xa8')]):_0xe8d81a[_0xdda2('0x80')][_0xdda2('0xa8')];}return _0x58973d[_0x4530b7[_0xdda2('0x17')]][_0xdda2('0xa7')]({'where':_0x44f619[_0xdda2('0x7e')]})[_0xdda2('0x7')](function(_0x528185){_0xbc441a['count']=_0x528185;if(_0xe8d81a['query'][_0xdda2('0xa1')]){if(_0x4530b7['childModel']===_0xdda2('0xa9')){_0x44f619[_0xdda2('0xa2')]=[{'model':_0x58973d[_0xdda2('0xaa')],'as':_0xdda2('0xab'),'attributes':['id','name',_0xdda2('0xac')],'required':_0xe8d81a[_0xdda2('0x80')][_0xdda2('0xad')]?!![]:![]},{'model':_0x58973d['Tag'],'as':_0xdda2('0xae'),'attributes':['id',_0xdda2('0xc'),_0xdda2('0xac')],'through':_0xe8d81a['query']['tag']?{'attributes':[],'where':{'TagId':_0xe8d81a[_0xdda2('0x80')][_0xdda2('0xad')]||undefined}}:{},'required':_0xe8d81a[_0xdda2('0x80')]['tag']?!![]:![]}];}else{_0x44f619[_0xdda2('0xa2')]=[{'all':!![]}];}}return _0x58973d[_0x4530b7[_0xdda2('0x17')]][_0xdda2('0xb')](_0x44f619);})[_0xdda2('0x7')](function(_0x354f35){_0xbc441a[_0xdda2('0xaf')]=_0x354f35;if(_0x2c442e===_0xdda2('0x33')&&_0xe8d81a['query'][_0xdda2('0xb0')]===_0xdda2('0xb1')){var _0x43e405=[];for(var _0x75b905=0x0;_0x75b905<_0xbc441a['rows'][_0xdda2('0x89')];_0x75b905++){_0x43e405[_0xdda2('0x8a')](_0x3fd76c(_0xdda2('0xb2'),_0xbc441a[_0xdda2('0xaf')][_0x75b905]['dataValues']));_0x43e405['push'](_0x3fd76c('sms',_0xbc441a[_0xdda2('0xaf')][_0x75b905][_0xdda2('0xb3')]));_0x43e405[_0xdda2('0x8a')](_0x3fd76c(_0xdda2('0xb4'),_0xbc441a[_0xdda2('0xaf')][_0x75b905][_0xdda2('0xb3')]));_0x43e405['push'](_0x3fd76c(_0xdda2('0xb5'),_0xbc441a[_0xdda2('0xaf')][_0x75b905][_0xdda2('0xb3')]));_0x43e405[_0xdda2('0x8a')](_0x3fd76c(_0xdda2('0xb6'),_0xbc441a[_0xdda2('0xaf')][_0x75b905][_0xdda2('0xb3')]));_0x43e405[_0xdda2('0x8a')](_0x3fd76c('whatsapp',_0xbc441a[_0xdda2('0xaf')][_0x75b905]['dataValues']));}return Promise[_0xdda2('0xb7')](_0x43e405)['then'](function(){return _0xbc441a;});}return _0xbc441a;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index af2885a..495ad19 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 _0xa064=['request','then','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfile,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','./userProfile.socket','register'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa064,0x192));var _0x4a06=function(_0xd6ca7,_0xf8aca2){_0xd6ca7=_0xd6ca7-0x0;var _0x5f269f=_0xa064[_0xd6ca7];return _0x5f269f;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var moment=require(_0x4a06('0x2'));var BPromise=require(_0x4a06('0x3'));var rs=require(_0x4a06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a06('0x5'));var logger=require('../../config/logger')(_0x4a06('0x6'));var config=require(_0x4a06('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a06('0x8')][_0x4a06('0x9')]({'port':0x232a});config['redis']=_[_0x4a06('0xa')](config[_0x4a06('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a06('0xb')]));require(_0x4a06('0xc'))[_0x4a06('0xd')](socket);function respondWithRpcPromise(_0x157495,_0x51079c,_0x167769){return new BPromise(function(_0x1b8308,_0x40bf75){return client[_0x4a06('0xe')](_0x157495,_0x167769)[_0x4a06('0xf')](function(_0x455225){logger[_0x4a06('0x10')]('UserProfile,\x20%s,\x20%s',_0x51079c,_0x4a06('0x11'));logger['debug'](_0x4a06('0x12'),_0x51079c,_0x4a06('0x11'),JSON[_0x4a06('0x13')](_0x455225));if(_0x455225['error']){if(_0x455225[_0x4a06('0x14')][_0x4a06('0x15')]===0x1f4){logger[_0x4a06('0x14')]('UserProfile,\x20%s,\x20%s',_0x51079c,_0x455225[_0x4a06('0x14')][_0x4a06('0x16')]);return _0x40bf75(_0x455225[_0x4a06('0x14')]['message']);}logger[_0x4a06('0x14')](_0x4a06('0x17'),_0x51079c,_0x455225[_0x4a06('0x14')][_0x4a06('0x16')]);return _0x1b8308(_0x455225[_0x4a06('0x14')]['message']);}else{logger[_0x4a06('0x10')]('UserProfile,\x20%s,\x20%s',_0x51079c,_0x4a06('0x11'));_0x1b8308(_0x455225[_0x4a06('0x18')][_0x4a06('0x16')]);}})[_0x4a06('0x19')](function(_0x28b067){logger[_0x4a06('0x14')](_0x4a06('0x17'),_0x51079c,_0x28b067);_0x40bf75(_0x28b067);});});} \ No newline at end of file +var _0x15b2=['localhost','socket.io-emitter','./userProfile.socket','register','request','info','request\x20sent','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults'];(function(_0x487ee4,_0x3d3e66){var _0x3b0877=function(_0x5fba36){while(--_0x5fba36){_0x487ee4['push'](_0x487ee4['shift']());}};_0x3b0877(++_0x3d3e66);}(_0x15b2,0x145));var _0x215b=function(_0x42fd67,_0x5dbdfd){_0x42fd67=_0x42fd67-0x0;var _0x3293f5=_0x15b2[_0x42fd67];return _0x3293f5;};'use strict';var _=require('lodash');var util=require(_0x215b('0x0'));var moment=require('moment');var BPromise=require(_0x215b('0x1'));var rs=require(_0x215b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x215b('0x3'))['db'];var utils=require(_0x215b('0x4'));var logger=require(_0x215b('0x5'))(_0x215b('0x6'));var config=require('../../config/environment');var jayson=require(_0x215b('0x7'));var client=jayson['client'][_0x215b('0x8')]({'port':0x232a});config[_0x215b('0x9')]=_[_0x215b('0xa')](config[_0x215b('0x9')],{'host':_0x215b('0xb'),'port':0x18eb});var socket=require(_0x215b('0xc'))(new Redis(config['redis']));require(_0x215b('0xd'))[_0x215b('0xe')](socket);function respondWithRpcPromise(_0x50ef7a,_0x2f736e,_0x44bbd9){return new BPromise(function(_0x5578e4,_0x4de4ad){return client[_0x215b('0xf')](_0x50ef7a,_0x44bbd9)['then'](function(_0x401260){logger[_0x215b('0x10')]('UserProfile,\x20%s,\x20%s',_0x2f736e,_0x215b('0x11'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x2f736e,_0x215b('0x11'),JSON['stringify'](_0x401260));if(_0x401260[_0x215b('0x12')]){if(_0x401260['error'][_0x215b('0x13')]===0x1f4){logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x401260['error']['message']);return _0x4de4ad(_0x401260['error'][_0x215b('0x15')]);}logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x401260[_0x215b('0x12')][_0x215b('0x15')]);return _0x5578e4(_0x401260[_0x215b('0x12')][_0x215b('0x15')]);}else{logger['info'](_0x215b('0x14'),_0x2f736e,_0x215b('0x11'));_0x5578e4(_0x401260[_0x215b('0x16')][_0x215b('0x15')]);}})[_0x215b('0x17')](function(_0x4492da){logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x4492da);_0x4de4ad(_0x4492da);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6e4744d..21e3cda 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 _0x2482=['remove','update','emit','removeListener','register','length','userProfile:','save'];(function(_0x562d2a,_0x5b12b6){var _0x51aa29=function(_0x32d5a4){while(--_0x32d5a4){_0x562d2a['push'](_0x562d2a['shift']());}};_0x51aa29(++_0x5b12b6);}(_0x2482,0x10f));var _0x2248=function(_0x1d0458,_0x389f29){_0x1d0458=_0x1d0458-0x0;var _0x35eea4=_0x2482[_0x1d0458];return _0x35eea4;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x2248('0x0'),_0x2248('0x1'),_0x2248('0x2')];function createListener(_0x5750ff,_0x1e47e2){return function(_0x218f0d){_0x1e47e2[_0x2248('0x3')](_0x5750ff,_0x218f0d);};}function removeListener(_0x37beee,_0x515687){return function(){UserProfileEvents[_0x2248('0x4')](_0x37beee,_0x515687);};}exports[_0x2248('0x5')]=function(_0x4be501){for(var _0x4908c7=0x0,_0x18ba30=events[_0x2248('0x6')];_0x4908c7<_0x18ba30;_0x4908c7++){var _0x40768e=events[_0x4908c7];var _0x5efd5e=createListener(_0x2248('0x7')+_0x40768e,_0x4be501);UserProfileEvents['on'](_0x40768e,_0x5efd5e);}}; \ No newline at end of file +var _0xffa3=['./userProfile.events','save','remove','update','removeListener','register','length'];(function(_0xf66c15,_0xf099e5){var _0x506314=function(_0xea3841){while(--_0xea3841){_0xf66c15['push'](_0xf66c15['shift']());}};_0x506314(++_0xf099e5);}(_0xffa3,0x1c0));var _0x3ffa=function(_0x382f44,_0x3a1b12){_0x382f44=_0x382f44-0x0;var _0x2fe454=_0xffa3[_0x382f44];return _0x2fe454;};'use strict';var UserProfileEvents=require(_0x3ffa('0x0'));var events=[_0x3ffa('0x1'),_0x3ffa('0x2'),_0x3ffa('0x3')];function createListener(_0x2595a0,_0x52c767){return function(_0x599d98){_0x52c767['emit'](_0x2595a0,_0x599d98);};}function removeListener(_0x45e0ff,_0x4cb6fc){return function(){UserProfileEvents[_0x3ffa('0x4')](_0x45e0ff,_0x4cb6fc);};}exports[_0x3ffa('0x5')]=function(_0x114148){for(var _0x47f339=0x0,_0x43e26e=events[_0x3ffa('0x6')];_0x47f339<_0x43e26e;_0x47f339++){var _0x207e51=events[_0x47f339];var _0x2c0ecf=createListener('userProfile:'+_0x207e51,_0x114148);UserProfileEvents['on'](_0x207e51,_0x2c0ecf);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 0f2fada..5fc4524 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 _0x265b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports'];(function(_0x2bc1fe,_0x45da98){var _0x1a47a5=function(_0x2e5053){while(--_0x2e5053){_0x2bc1fe['push'](_0x2bc1fe['shift']());}};_0x1a47a5(++_0x45da98);}(_0x265b,0x6e));var _0xb265=function(_0x264290,_0xc8926d){_0x264290=_0x264290-0x0;var _0x3f1b46=_0x265b[_0x264290];return _0x3f1b46;};'use strict';var multer=require(_0xb265('0x0'));var util=require(_0xb265('0x1'));var path=require(_0xb265('0x2'));var timeout=require(_0xb265('0x3'));var express=require(_0xb265('0x4'));var router=express[_0xb265('0x5')]();var fs_extra=require(_0xb265('0x6'));var auth=require(_0xb265('0x7'));var interaction=require(_0xb265('0x8'));var config=require(_0xb265('0x9'));var controller=require('./userProfileResource.controller');router[_0xb265('0xa')]('/',auth[_0xb265('0xb')](),controller[_0xb265('0xc')]);router['get'](_0xb265('0xd'),auth['isAuthenticated'](),controller[_0xb265('0xe')]);router[_0xb265('0xa')](_0xb265('0xf'),auth['isAuthenticated'](),controller[_0xb265('0x10')]);router[_0xb265('0x11')]('/',auth['isAuthenticated'](),controller[_0xb265('0x12')]);router['put'](_0xb265('0xf'),auth[_0xb265('0xb')](),controller[_0xb265('0x13')]);router[_0xb265('0x14')](_0xb265('0xf'),auth[_0xb265('0xb')](),controller['destroy']);module[_0xb265('0x15')]=router; \ No newline at end of file +var _0x9b7e=['describe','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe'];(function(_0xf1b2fb,_0x4f414a){var _0x5b6f6a=function(_0x37e151){while(--_0x37e151){_0xf1b2fb['push'](_0xf1b2fb['shift']());}};_0x5b6f6a(++_0x4f414a);}(_0x9b7e,0x181));var _0xe9b7=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x9b7e[_0x53bcc3];return _0x47c959;};'use strict';var multer=require(_0xe9b7('0x0'));var util=require(_0xe9b7('0x1'));var path=require(_0xe9b7('0x2'));var timeout=require(_0xe9b7('0x3'));var express=require(_0xe9b7('0x4'));var router=express[_0xe9b7('0x5')]();var fs_extra=require(_0xe9b7('0x6'));var auth=require(_0xe9b7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe9b7('0x8'));var controller=require(_0xe9b7('0x9'));router[_0xe9b7('0xa')]('/',auth[_0xe9b7('0xb')](),controller[_0xe9b7('0xc')]);router['get'](_0xe9b7('0xd'),auth[_0xe9b7('0xb')](),controller[_0xe9b7('0xe')]);router[_0xe9b7('0xa')](_0xe9b7('0xf'),auth[_0xe9b7('0xb')](),controller[_0xe9b7('0x10')]);router['post']('/',auth[_0xe9b7('0xb')](),controller[_0xe9b7('0x11')]);router['put'](_0xe9b7('0xf'),auth[_0xe9b7('0xb')](),controller[_0xe9b7('0x12')]);router['delete'](_0xe9b7('0xf'),auth[_0xe9b7('0xb')](),controller[_0xe9b7('0x13')]);module[_0xe9b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index c1153ed..075aa06 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 _0x7e55=['INTEGER','STRING','sequelize','exports'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x7e55,0x9a));var _0x57e5=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x7e55[_0xf26d40];return _0x50b68c;};'use strict';var Sequelize=require(_0x57e5('0x0'));module[_0x57e5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x57e5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x57e5('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x3d65=['exports','STRING','INTEGER','sequelize'];(function(_0x37c5fc,_0x21f6ea){var _0x4733d1=function(_0x5badb5){while(--_0x5badb5){_0x37c5fc['push'](_0x37c5fc['shift']());}};_0x4733d1(++_0x21f6ea);}(_0x3d65,0x107));var _0x53d6=function(_0x3406d2,_0x17338c){_0x3406d2=_0x3406d2-0x0;var _0x46f2ed=_0x3d65[_0x3406d2];return _0x46f2ed;};'use strict';var Sequelize=require(_0x53d6('0x0'));module[_0x53d6('0x1')]={'name':{'type':Sequelize[_0x53d6('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x53d6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x53d6('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 4407445..4749c35 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 _0x9536=['rawAttributes','intersection','length','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','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','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','UserProfileResource','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9536,0x179));var _0x6953=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x9536[_0x33a694];return _0x41ff01;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));};exports[_0x6953('0x49')]=function(_0x50b962,_0x5f15b0){return db['UserProfileResource']['describe']()[_0x6953('0x3c')](respondWithResult(_0x5f15b0,null))[_0x6953('0x41')](handleError(_0x5f15b0,null));}; \ No newline at end of file +var _0x5fab=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x5fab,0x177));var _0xb5fa=function(_0x35b80e,_0x120fd7){_0x35b80e=_0x35b80e-0x0;var _0x363914=_0x5fab[_0x35b80e];return _0x363914;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['UserProfileResource'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')](_0x33eb2c[_0xb5fa('0x4d')],{})[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,0xc9))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x3a39f2,_0x52f5d8){if(_0x3a39f2['body']['id']){delete _0x3a39f2[_0xb5fa('0x4d')]['id'];}return db['UserProfileResource'][_0xb5fa('0x4a')]({'where':{'id':_0x3a39f2[_0xb5fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f5d8,null))[_0xb5fa('0x43')](saveUpdates(_0x3a39f2[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x52f5d8,null))[_0xb5fa('0x4b')](handleError(_0x52f5d8,null));};exports[_0xb5fa('0x26')]=function(_0x3ffee0,_0x51d5f7){return db[_0xb5fa('0x2d')]['find']({'where':{'id':_0x3ffee0[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x51d5f7,null))[_0xb5fa('0x43')](removeEntity(_0x51d5f7,null))['catch'](handleError(_0x51d5f7,null));};exports[_0xb5fa('0x4e')]=function(_0x130a0d,_0x4dea87){return db['UserProfileResource'][_0xb5fa('0x4e')]()[_0xb5fa('0x43')](respondWithResult(_0x4dea87,null))[_0xb5fa('0x4b')](handleError(_0x4dea87,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0efe4a8..8d88e5e 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 _0x73ec=['UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0xb5a65b,_0x982a3e){var _0x1d48c3=function(_0x44a54d){while(--_0x44a54d){_0xb5a65b['push'](_0xb5a65b['shift']());}};_0x1d48c3(++_0x982a3e);}(_0x73ec,0x138));var _0xc73e=function(_0x525ba5,_0x4103d7){_0x525ba5=_0x525ba5-0x0;var _0xe0ef92=_0x73ec[_0x525ba5];return _0xe0ef92;};'use strict';var _=require(_0xc73e('0x0'));var util=require(_0xc73e('0x1'));var logger=require(_0xc73e('0x2'))(_0xc73e('0x3'));var moment=require('moment');var BPromise=require(_0xc73e('0x4'));var rp=require(_0xc73e('0x5'));var fs=require('fs');var path=require(_0xc73e('0x6'));var rimraf=require(_0xc73e('0x7'));var config=require(_0xc73e('0x8'));var attributes=require(_0xc73e('0x9'));module['exports']=function(_0x4e6554,_0x391c11){return _0x4e6554['define'](_0xc73e('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xc73e('0xb'),'fields':[_0xc73e('0xc'),_0xc73e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d5f=['moment','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','../../config/logger','api'];(function(_0x3ac769,_0x2825df){var _0x2185eb=function(_0x43cc1d){while(--_0x43cc1d){_0x3ac769['push'](_0x3ac769['shift']());}};_0x2185eb(++_0x2825df);}(_0x4d5f,0x177));var _0xf4d5=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4d5f[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4d5('0x0'))(_0xf4d5('0x1'));var moment=require(_0xf4d5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4d5('0x3'));var rimraf=require(_0xf4d5('0x4'));var config=require(_0xf4d5('0x5'));var attributes=require(_0xf4d5('0x6'));module[_0xf4d5('0x7')]=function(_0x10d9b1,_0x2dae53){return _0x10d9b1[_0xf4d5('0x8')](_0xf4d5('0x9'),attributes,{'tableName':_0xf4d5('0xa'),'paranoid':![],'indexes':[{'name':_0xf4d5('0xb'),'fields':[_0xf4d5('0xc'),'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 96239a7..09876fd 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 _0xda02=['stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0xda02,0x133));var _0x2da0=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0xda02[_0x2d2e85];return _0x3e9f5e;};'use strict';var _=require('lodash');var util=require(_0x2da0('0x0'));var moment=require(_0x2da0('0x1'));var BPromise=require(_0x2da0('0x2'));var rs=require(_0x2da0('0x3'));var fs=require('fs');var Redis=require(_0x2da0('0x4'));var db=require(_0x2da0('0x5'))['db'];var utils=require(_0x2da0('0x6'));var logger=require(_0x2da0('0x7'))(_0x2da0('0x8'));var config=require(_0x2da0('0x9'));var jayson=require(_0x2da0('0xa'));var client=jayson[_0x2da0('0xb')][_0x2da0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53fe80,_0x1165ea,_0x4d0572){return new BPromise(function(_0x2fecdd,_0x565881){return client[_0x2da0('0xd')](_0x53fe80,_0x4d0572)[_0x2da0('0xe')](function(_0x4fad26){logger['info'](_0x2da0('0xf'),_0x1165ea,_0x2da0('0x10'));logger[_0x2da0('0x11')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x1165ea,_0x2da0('0x10'),JSON[_0x2da0('0x12')](_0x4fad26));if(_0x4fad26[_0x2da0('0x13')]){if(_0x4fad26[_0x2da0('0x13')][_0x2da0('0x14')]===0x1f4){logger[_0x2da0('0x13')](_0x2da0('0xf'),_0x1165ea,_0x4fad26['error'][_0x2da0('0x15')]);return _0x565881(_0x4fad26[_0x2da0('0x13')][_0x2da0('0x15')]);}logger['error'](_0x2da0('0xf'),_0x1165ea,_0x4fad26['error']['message']);return _0x2fecdd(_0x4fad26['error'][_0x2da0('0x15')]);}else{logger[_0x2da0('0x16')]('UserProfileResource,\x20%s,\x20%s',_0x1165ea,'request\x20sent');_0x2fecdd(_0x4fad26[_0x2da0('0x17')][_0x2da0('0x15')]);}})[_0x2da0('0x18')](function(_0x5111d0){logger[_0x2da0('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x1165ea,_0x5111d0);_0x565881(_0x5111d0);});});} \ No newline at end of file +var _0x9ac6=['../../config/utils','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3fbbf8,_0x567ff6){var _0x45bf7c=function(_0x130d1e){while(--_0x130d1e){_0x3fbbf8['push'](_0x3fbbf8['shift']());}};_0x45bf7c(++_0x567ff6);}(_0x9ac6,0x113));var _0x69ac=function(_0x1c9a7b,_0x3d6c29){_0x1c9a7b=_0x1c9a7b-0x0;var _0x1b6510=_0x9ac6[_0x1c9a7b];return _0x1b6510;};'use strict';var _=require('lodash');var util=require(_0x69ac('0x0'));var moment=require(_0x69ac('0x1'));var BPromise=require('bluebird');var rs=require(_0x69ac('0x2'));var fs=require('fs');var Redis=require(_0x69ac('0x3'));var db=require(_0x69ac('0x4'))['db'];var utils=require(_0x69ac('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x69ac('0x6'));var jayson=require(_0x69ac('0x7'));var client=jayson[_0x69ac('0x8')][_0x69ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15f0b1,_0x9398dd,_0x5cfcfb){return new BPromise(function(_0x50d7c2,_0x51fbae){return client[_0x69ac('0xa')](_0x15f0b1,_0x5cfcfb)['then'](function(_0x72519a){logger[_0x69ac('0xb')](_0x69ac('0xc'),_0x9398dd,'request\x20sent');logger[_0x69ac('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x9398dd,_0x69ac('0xe'),JSON[_0x69ac('0xf')](_0x72519a));if(_0x72519a[_0x69ac('0x10')]){if(_0x72519a['error'][_0x69ac('0x11')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x9398dd,_0x72519a[_0x69ac('0x10')][_0x69ac('0x12')]);return _0x51fbae(_0x72519a['error']['message']);}logger[_0x69ac('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x9398dd,_0x72519a[_0x69ac('0x10')][_0x69ac('0x12')]);return _0x50d7c2(_0x72519a['error'][_0x69ac('0x12')]);}else{logger[_0x69ac('0xb')](_0x69ac('0xc'),_0x9398dd,'request\x20sent');_0x50d7c2(_0x72519a[_0x69ac('0x13')]['message']);}})['catch'](function(_0x5b9397){logger[_0x69ac('0x10')](_0x69ac('0xc'),_0x9398dd,_0x5b9397);_0x51fbae(_0x5b9397);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index d4832a1..5fe5a74 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 _0x39a9=['../../components/auth/service','../../config/environment','./userProfileSection.controller','get','index','isAuthenticated','/:id','show','put','delete','destroy','multer','path','Router','fs-extra'];(function(_0x3e7336,_0x242b6d){var _0x1f9ff6=function(_0x1c574f){while(--_0x1c574f){_0x3e7336['push'](_0x3e7336['shift']());}};_0x1f9ff6(++_0x242b6d);}(_0x39a9,0x128));var _0x939a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x39a9[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x939a('0x0'));var util=require('util');var path=require(_0x939a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x939a('0x2')]();var fs_extra=require(_0x939a('0x3'));var auth=require(_0x939a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x939a('0x5'));var controller=require(_0x939a('0x6'));router[_0x939a('0x7')]('/',auth['isAuthenticated'](),controller[_0x939a('0x8')]);router[_0x939a('0x7')]('/describe',auth[_0x939a('0x9')](),controller['describe']);router[_0x939a('0x7')](_0x939a('0xa'),auth[_0x939a('0x9')](),controller[_0x939a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x939a('0xc')](_0x939a('0xa'),auth[_0x939a('0x9')](),controller['update']);router[_0x939a('0xd')](_0x939a('0xa'),auth['isAuthenticated'](),controller[_0x939a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x2e09=['/describe','show','post','create','put','update','delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index'];(function(_0x16ab6b,_0x45a73e){var _0x91b89=function(_0xf7561b){while(--_0xf7561b){_0x16ab6b['push'](_0x16ab6b['shift']());}};_0x91b89(++_0x45a73e);}(_0x2e09,0x144));var _0x92e0=function(_0x1f1bfb,_0x1a7437){_0x1f1bfb=_0x1f1bfb-0x0;var _0x1688bd=_0x2e09[_0x1f1bfb];return _0x1688bd;};'use strict';var multer=require(_0x92e0('0x0'));var util=require(_0x92e0('0x1'));var path=require(_0x92e0('0x2'));var timeout=require('connect-timeout');var express=require(_0x92e0('0x3'));var router=express[_0x92e0('0x4')]();var fs_extra=require(_0x92e0('0x5'));var auth=require(_0x92e0('0x6'));var interaction=require(_0x92e0('0x7'));var config=require('../../config/environment');var controller=require(_0x92e0('0x8'));router[_0x92e0('0x9')]('/',auth[_0x92e0('0xa')](),controller[_0x92e0('0xb')]);router[_0x92e0('0x9')](_0x92e0('0xc'),auth[_0x92e0('0xa')](),controller['describe']);router['get']('/:id',auth[_0x92e0('0xa')](),controller[_0x92e0('0xd')]);router[_0x92e0('0xe')]('/',auth[_0x92e0('0xa')](),controller[_0x92e0('0xf')]);router[_0x92e0('0x10')]('/:id',auth[_0x92e0('0xa')](),controller[_0x92e0('0x11')]);router[_0x92e0('0x12')](_0x92e0('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x92e0('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index cef4d86..7162f26 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 _0xb62e=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'name':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb62('0x2')],'set':function(_0x929329){this[_0xeb62('0x4')](_0xeb62('0x5'),_0x929329?_0x929329['join'](''):[]);},'get':function(){return this[_0xeb62('0x6')](_0xeb62('0x5'))?this[_0xeb62('0x6')]('crudPermissions')[_0xeb62('0x7')](''):[];}}}; \ No newline at end of file +var _0xcf2f=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING'];(function(_0x4f0345,_0x430595){var _0x18fc0c=function(_0x2f09dc){while(--_0x2f09dc){_0x4f0345['push'](_0x4f0345['shift']());}};_0x18fc0c(++_0x430595);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x57bd3b,_0x211c87){_0x57bd3b=_0x57bd3b-0x0;var _0x865ad=_0xcf2f[_0x57bd3b];return _0x865ad;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'name':{'type':Sequelize[_0xfcf2('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xfcf2('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xfcf2('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xfcf2('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xfcf2('0x2')],'set':function(_0x1e3661){this[_0xfcf2('0x5')](_0xfcf2('0x6'),_0x1e3661?_0x1e3661[_0xfcf2('0x7')](''):[]);},'get':function(){return this[_0xfcf2('0x8')](_0xfcf2('0x6'))?this[_0xfcf2('0x8')](_0xfcf2('0x6'))[_0xfcf2('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c951d9c..a35c3dc 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 _0xf2fc=['destroy','sendStatus','error','stack','name','send','UserProfileSection','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2fc,0x72));var _0xcf2f=function(_0x258dea,_0x14051c){_0x258dea=_0x258dea-0x0;var _0x5b7c1a=_0xf2fc[_0x258dea];return _0x5b7c1a;};'use strict';var emlformat=require(_0xcf2f('0x0'));var rimraf=require(_0xcf2f('0x1'));var zipdir=require(_0xcf2f('0x2'));var jsonpatch=require(_0xcf2f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xcf2f('0x4'));var sox=require(_0xcf2f('0x5'));var csv=require(_0xcf2f('0x6'));var ejs=require(_0xcf2f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcf2f('0x8'));var crypto=require(_0xcf2f('0x9'));var jsforce=require(_0xcf2f('0xa'));var deskjs=require(_0xcf2f('0xb'));var toCsv=require(_0xcf2f('0x6'));var querystring=require(_0xcf2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xcf2f('0xd'));var authService=require(_0xcf2f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xcf2f('0xf'));var hardwareService=require(_0xcf2f('0x10'));var logger=require('../../config/logger')(_0xcf2f('0x11'));var utils=require('../../config/utils');var config=require(_0xcf2f('0x12'));var licenseUtil=require(_0xcf2f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ad633,_0x3e96ae){_0x3e96ae=_0x3e96ae||0xcc;return function(_0xc1beeb){if(_0xc1beeb){return _0x3ad633['sendStatus'](_0x3e96ae);}return _0x3ad633[_0xcf2f('0x14')](_0x3e96ae)[_0xcf2f('0x15')]();};}function respondWithResult(_0x324122,_0x2bcba2){_0x2bcba2=_0x2bcba2||0xc8;return function(_0x58b4bd){if(_0x58b4bd){return _0x324122[_0xcf2f('0x14')](_0x2bcba2)['json'](_0x58b4bd);}};}function respondWithFilteredResult(_0x1a0293,_0x3b75af){return function(_0x250cb7){if(_0x250cb7){var _0x2cabad=typeof _0x3b75af[_0xcf2f('0x16')]===_0xcf2f('0x17')&&typeof _0x3b75af[_0xcf2f('0x18')]===_0xcf2f('0x17');var _0x344533=_0x250cb7['count'];var _0xa443aa=_0x2cabad?0x0:_0x3b75af['offset'];var _0x746b89=_0x2cabad?_0x250cb7[_0xcf2f('0x19')]:_0x3b75af[_0xcf2f('0x16')]+_0x3b75af[_0xcf2f('0x18')];var _0x5cecf3;if(_0x746b89>=_0x344533){_0x746b89=_0x344533;_0x5cecf3=0xc8;}else{_0x5cecf3=0xce;}_0x1a0293[_0xcf2f('0x14')](_0x5cecf3);return _0x1a0293[_0xcf2f('0x1a')](_0xcf2f('0x1b'),_0xa443aa+'-'+_0x746b89+'/'+_0x344533)[_0xcf2f('0x1c')](_0x250cb7);}return null;};}function patchUpdates(_0x44f92a){return function(_0x4819e0){try{jsonpatch[_0xcf2f('0x1d')](_0x4819e0,_0x44f92a,!![]);}catch(_0x1c7749){return BPromise['reject'](_0x1c7749);}return _0x4819e0[_0xcf2f('0x1e')]();};}function saveUpdates(_0x3eb121,_0x4c04e5){return function(_0x47bae8){if(_0x47bae8){return _0x47bae8['update'](_0x3eb121)[_0xcf2f('0x1f')](function(_0x11fa52){return _0x11fa52;});}return null;};}function removeEntity(_0x1e7674,_0x1702a4){return function(_0x31cb61){if(_0x31cb61){return _0x31cb61[_0xcf2f('0x20')]()['then'](function(){_0x1e7674[_0xcf2f('0x14')](0xcc)[_0xcf2f('0x15')]();});}};}function handleEntityNotFound(_0x4c3e48,_0x321819){return function(_0x27b81c){if(!_0x27b81c){_0x4c3e48[_0xcf2f('0x21')](0x194);}return _0x27b81c;};}function handleError(_0x140c59,_0x111f60){_0x111f60=_0x111f60||0x1f4;return function(_0x35bc3e){logger[_0xcf2f('0x22')](_0x35bc3e[_0xcf2f('0x23')]);if(_0x35bc3e[_0xcf2f('0x24')]){delete _0x35bc3e[_0xcf2f('0x24')];}_0x140c59[_0xcf2f('0x14')](_0x111f60)[_0xcf2f('0x25')](_0x35bc3e);};}exports['index']=function(_0x446767,_0x354aa6){var _0x2a843d={},_0x44d3d9={},_0x5583a2={'count':0x0,'rows':[]};var _0x27f801=_['map'](db[_0xcf2f('0x26')][_0xcf2f('0x27')],function(_0x873812){return{'name':_0x873812[_0xcf2f('0x28')],'type':_0x873812['type'][_0xcf2f('0x29')]};});_0x44d3d9[_0xcf2f('0x2a')]=_[_0xcf2f('0x2b')](_0x27f801,_0xcf2f('0x24'));_0x44d3d9[_0xcf2f('0x2c')]=_[_0xcf2f('0x2d')](_0x446767[_0xcf2f('0x2c')]);_0x44d3d9[_0xcf2f('0x2e')]=_[_0xcf2f('0x2f')](_0x44d3d9[_0xcf2f('0x2a')],_0x44d3d9['query']);_0x2a843d[_0xcf2f('0x30')]=_['intersection'](_0x44d3d9['model'],qs[_0xcf2f('0x31')](_0x446767[_0xcf2f('0x2c')][_0xcf2f('0x31')]));_0x2a843d['attributes']=_0x2a843d[_0xcf2f('0x30')]['length']?_0x2a843d[_0xcf2f('0x30')]:_0x44d3d9[_0xcf2f('0x2a')];if(!_0x446767[_0xcf2f('0x2c')][_0xcf2f('0x32')](_0xcf2f('0x33'))){_0x2a843d[_0xcf2f('0x18')]=qs['limit'](_0x446767[_0xcf2f('0x2c')][_0xcf2f('0x18')]);_0x2a843d[_0xcf2f('0x16')]=qs['offset'](_0x446767[_0xcf2f('0x2c')][_0xcf2f('0x16')]);}_0x2a843d[_0xcf2f('0x34')]=qs[_0xcf2f('0x35')](_0x446767[_0xcf2f('0x2c')]['sort']);_0x2a843d[_0xcf2f('0x36')]=qs[_0xcf2f('0x2e')](_[_0xcf2f('0x37')](_0x446767[_0xcf2f('0x2c')],_0x44d3d9[_0xcf2f('0x2e')]),_0x27f801);if(_0x446767[_0xcf2f('0x2c')]['filter']){_0x2a843d[_0xcf2f('0x36')]=_[_0xcf2f('0x38')](_0x2a843d['where'],{'$or':_[_0xcf2f('0x2b')](_0x27f801,function(_0xce6fa6){if(_0xce6fa6[_0xcf2f('0x39')]!==_0xcf2f('0x3a')){var _0x313ec2={};_0x313ec2[_0xce6fa6[_0xcf2f('0x24')]]={'$like':'%'+_0x446767[_0xcf2f('0x2c')]['filter']+'%'};return _0x313ec2;}})});}_0x2a843d=_[_0xcf2f('0x38')]({},_0x2a843d,_0x446767[_0xcf2f('0x3b')]);var _0x59f57c={'where':_0x2a843d[_0xcf2f('0x36')]};return db['UserProfileSection'][_0xcf2f('0x19')](_0x59f57c)['then'](function(_0xdfe49b){_0x5583a2['count']=_0xdfe49b;if(_0x446767['query'][_0xcf2f('0x3c')]){_0x2a843d[_0xcf2f('0x3d')]=[{'all':!![]}];}return db['UserProfileSection'][_0xcf2f('0x3e')](_0x2a843d);})[_0xcf2f('0x1f')](function(_0x415c66){_0x5583a2[_0xcf2f('0x3f')]=_0x415c66;return _0x5583a2;})[_0xcf2f('0x1f')](respondWithFilteredResult(_0x354aa6,_0x2a843d))[_0xcf2f('0x40')](handleError(_0x354aa6,null));};exports[_0xcf2f('0x41')]=function(_0x30edd9,_0x5c97b3){var _0x5f1713={'raw':![],'where':{'id':_0x30edd9[_0xcf2f('0x42')]['id']}},_0x4f4366={};_0x4f4366[_0xcf2f('0x2a')]=_[_0xcf2f('0x2d')](db[_0xcf2f('0x26')][_0xcf2f('0x27')]);_0x4f4366[_0xcf2f('0x2c')]=_[_0xcf2f('0x2d')](_0x30edd9[_0xcf2f('0x2c')]);_0x4f4366['filters']=_['intersection'](_0x4f4366[_0xcf2f('0x2a')],_0x4f4366[_0xcf2f('0x2c')]);_0x5f1713[_0xcf2f('0x30')]=_[_0xcf2f('0x2f')](_0x4f4366[_0xcf2f('0x2a')],qs[_0xcf2f('0x31')](_0x30edd9['query'][_0xcf2f('0x31')]));_0x5f1713['attributes']=_0x5f1713[_0xcf2f('0x30')][_0xcf2f('0x43')]?_0x5f1713['attributes']:_0x4f4366['model'];if(_0x30edd9['query'][_0xcf2f('0x3c')]){_0x5f1713[_0xcf2f('0x3d')]=[{'all':!![]}];}_0x5f1713=_[_0xcf2f('0x38')]({},_0x5f1713,_0x30edd9[_0xcf2f('0x3b')]);return db['UserProfileSection'][_0xcf2f('0x44')](_0x5f1713)[_0xcf2f('0x1f')](handleEntityNotFound(_0x5c97b3,null))[_0xcf2f('0x1f')](respondWithResult(_0x5c97b3,null))['catch'](handleError(_0x5c97b3,null));};exports[_0xcf2f('0x45')]=function(_0x14c315,_0x30e28e){return db['UserProfileSection'][_0xcf2f('0x45')](_0x14c315[_0xcf2f('0x46')],{})[_0xcf2f('0x1f')](respondWithResult(_0x30e28e,0xc9))[_0xcf2f('0x40')](handleError(_0x30e28e,null));};exports[_0xcf2f('0x47')]=function(_0x3b6699,_0x20d43e){if(_0x3b6699[_0xcf2f('0x46')]['id']){delete _0x3b6699[_0xcf2f('0x46')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x3b6699['params']['id']}})[_0xcf2f('0x1f')](handleEntityNotFound(_0x20d43e,null))['then'](saveUpdates(_0x3b6699[_0xcf2f('0x46')],null))[_0xcf2f('0x1f')](respondWithResult(_0x20d43e,null))[_0xcf2f('0x40')](handleError(_0x20d43e,null));};exports[_0xcf2f('0x20')]=function(_0xda53c4,_0x46b2ed){return db[_0xcf2f('0x26')][_0xcf2f('0x44')]({'where':{'id':_0xda53c4[_0xcf2f('0x42')]['id']}})[_0xcf2f('0x1f')](handleEntityNotFound(_0x46b2ed,null))[_0xcf2f('0x1f')](removeEntity(_0x46b2ed,null))[_0xcf2f('0x40')](handleError(_0x46b2ed,null));};exports[_0xcf2f('0x48')]=function(_0x3ce8a4,_0x4973dd){return db[_0xcf2f('0x26')][_0xcf2f('0x48')]()[_0xcf2f('0x1f')](respondWithResult(_0x4973dd,null))[_0xcf2f('0x40')](handleError(_0x4973dd,null));}; \ No newline at end of file +var _0x177f=['squel','crypto','jsforce','desk.js','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','reject','destroy','then','sendStatus','error','stack','name','send','index','UserProfileSection','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','body','find','describe','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash'];(function(_0x356b6d,_0x4a7d1a){var _0x3b77f2=function(_0x291d3d){while(--_0x291d3d){_0x356b6d['push'](_0x356b6d['shift']());}};_0x3b77f2(++_0x4a7d1a);}(_0x177f,0x150));var _0xf177=function(_0x143e4f,_0x510ec7){_0x143e4f=_0x143e4f-0x0;var _0x185a8e=_0x177f[_0x143e4f];return _0x185a8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf177('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf177('0x1'));var moment=require(_0xf177('0x2'));var BPromise=require(_0xf177('0x3'));var Mustache=require(_0xf177('0x4'));var util=require('util');var path=require(_0xf177('0x5'));var sox=require(_0xf177('0x6'));var csv=require(_0xf177('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf177('0x8'));var squel=require(_0xf177('0x9'));var crypto=require(_0xf177('0xa'));var jsforce=require(_0xf177('0xb'));var deskjs=require(_0xf177('0xc'));var toCsv=require(_0xf177('0x7'));var querystring=require(_0xf177('0xd'));var Papa=require(_0xf177('0xe'));var Redis=require(_0xf177('0xf'));var authService=require(_0xf177('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf177('0x11'));var hardwareService=require(_0xf177('0x12'));var logger=require(_0xf177('0x13'))(_0xf177('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf177('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b371,_0x4c07db){_0x4c07db=_0x4c07db||0xcc;return function(_0x58d5d3){if(_0x58d5d3){return _0x52b371['sendStatus'](_0x4c07db);}return _0x52b371[_0xf177('0x16')](_0x4c07db)[_0xf177('0x17')]();};}function respondWithResult(_0x423bd2,_0x8858c0){_0x8858c0=_0x8858c0||0xc8;return function(_0x28357a){if(_0x28357a){return _0x423bd2[_0xf177('0x16')](_0x8858c0)[_0xf177('0x18')](_0x28357a);}};}function respondWithFilteredResult(_0x5ecefd,_0x294368){return function(_0x5506ab){if(_0x5506ab){var _0x28adf3=typeof _0x294368[_0xf177('0x19')]===_0xf177('0x1a')&&typeof _0x294368['limit']===_0xf177('0x1a');var _0xca15b3=_0x5506ab[_0xf177('0x1b')];var _0x36c796=_0x28adf3?0x0:_0x294368[_0xf177('0x19')];var _0x46690b=_0x28adf3?_0x5506ab['count']:_0x294368[_0xf177('0x19')]+_0x294368[_0xf177('0x1c')];var _0x429b3e;if(_0x46690b>=_0xca15b3){_0x46690b=_0xca15b3;_0x429b3e=0xc8;}else{_0x429b3e=0xce;}_0x5ecefd['status'](_0x429b3e);return _0x5ecefd[_0xf177('0x1d')](_0xf177('0x1e'),_0x36c796+'-'+_0x46690b+'/'+_0xca15b3)['json'](_0x5506ab);}return null;};}function patchUpdates(_0x2014db){return function(_0x331a72){try{jsonpatch['apply'](_0x331a72,_0x2014db,!![]);}catch(_0x3f38bd){return BPromise[_0xf177('0x1f')](_0x3f38bd);}return _0x331a72['save']();};}function saveUpdates(_0xc256e4,_0x5263b1){return function(_0x23dc44){if(_0x23dc44){return _0x23dc44['update'](_0xc256e4)['then'](function(_0x2da217){return _0x2da217;});}return null;};}function removeEntity(_0x2fa20f,_0x5a53f1){return function(_0x2f6837){if(_0x2f6837){return _0x2f6837[_0xf177('0x20')]()[_0xf177('0x21')](function(){_0x2fa20f['status'](0xcc)[_0xf177('0x17')]();});}};}function handleEntityNotFound(_0x441a69,_0x2e4097){return function(_0x1ac413){if(!_0x1ac413){_0x441a69[_0xf177('0x22')](0x194);}return _0x1ac413;};}function handleError(_0x53f4ba,_0x4ebcc6){_0x4ebcc6=_0x4ebcc6||0x1f4;return function(_0x3a865b){logger[_0xf177('0x23')](_0x3a865b[_0xf177('0x24')]);if(_0x3a865b[_0xf177('0x25')]){delete _0x3a865b[_0xf177('0x25')];}_0x53f4ba['status'](_0x4ebcc6)[_0xf177('0x26')](_0x3a865b);};}exports[_0xf177('0x27')]=function(_0x26dfbb,_0x313d32){var _0x1ad612={},_0x109267={},_0xc20a35={'count':0x0,'rows':[]};var _0x138ca0=_['map'](db[_0xf177('0x28')][_0xf177('0x29')],function(_0x10a4d4){return{'name':_0x10a4d4['fieldName'],'type':_0x10a4d4[_0xf177('0x2a')]['key']};});_0x109267[_0xf177('0x2b')]=_[_0xf177('0x2c')](_0x138ca0,_0xf177('0x25'));_0x109267[_0xf177('0x2d')]=_[_0xf177('0x2e')](_0x26dfbb[_0xf177('0x2d')]);_0x109267[_0xf177('0x2f')]=_['intersection'](_0x109267[_0xf177('0x2b')],_0x109267[_0xf177('0x2d')]);_0x1ad612['attributes']=_[_0xf177('0x30')](_0x109267[_0xf177('0x2b')],qs['fields'](_0x26dfbb[_0xf177('0x2d')][_0xf177('0x31')]));_0x1ad612[_0xf177('0x32')]=_0x1ad612['attributes'][_0xf177('0x33')]?_0x1ad612[_0xf177('0x32')]:_0x109267[_0xf177('0x2b')];if(!_0x26dfbb[_0xf177('0x2d')]['hasOwnProperty'](_0xf177('0x34'))){_0x1ad612[_0xf177('0x1c')]=qs[_0xf177('0x1c')](_0x26dfbb[_0xf177('0x2d')]['limit']);_0x1ad612[_0xf177('0x19')]=qs[_0xf177('0x19')](_0x26dfbb[_0xf177('0x2d')]['offset']);}_0x1ad612[_0xf177('0x35')]=qs['sort'](_0x26dfbb[_0xf177('0x2d')][_0xf177('0x36')]);_0x1ad612['where']=qs['filters'](_['pick'](_0x26dfbb[_0xf177('0x2d')],_0x109267[_0xf177('0x2f')]),_0x138ca0);if(_0x26dfbb['query'][_0xf177('0x37')]){_0x1ad612[_0xf177('0x38')]=_[_0xf177('0x39')](_0x1ad612[_0xf177('0x38')],{'$or':_[_0xf177('0x2c')](_0x138ca0,function(_0x20cb3b){if(_0x20cb3b[_0xf177('0x2a')]!==_0xf177('0x3a')){var _0x483d39={};_0x483d39[_0x20cb3b['name']]={'$like':'%'+_0x26dfbb[_0xf177('0x2d')]['filter']+'%'};return _0x483d39;}})});}_0x1ad612=_[_0xf177('0x39')]({},_0x1ad612,_0x26dfbb[_0xf177('0x3b')]);var _0x3fb572={'where':_0x1ad612[_0xf177('0x38')]};return db[_0xf177('0x28')][_0xf177('0x1b')](_0x3fb572)['then'](function(_0x3c7e62){_0xc20a35[_0xf177('0x1b')]=_0x3c7e62;if(_0x26dfbb[_0xf177('0x2d')]['includeAll']){_0x1ad612[_0xf177('0x3c')]=[{'all':!![]}];}return db[_0xf177('0x28')]['findAll'](_0x1ad612);})[_0xf177('0x21')](function(_0x25a0d4){_0xc20a35[_0xf177('0x3d')]=_0x25a0d4;return _0xc20a35;})['then'](respondWithFilteredResult(_0x313d32,_0x1ad612))[_0xf177('0x3e')](handleError(_0x313d32,null));};exports[_0xf177('0x3f')]=function(_0x3d20fb,_0x3c2f06){var _0x418671={'raw':![],'where':{'id':_0x3d20fb[_0xf177('0x40')]['id']}},_0x54ea87={};_0x54ea87['model']=_[_0xf177('0x2e')](db['UserProfileSection'][_0xf177('0x29')]);_0x54ea87[_0xf177('0x2d')]=_[_0xf177('0x2e')](_0x3d20fb['query']);_0x54ea87['filters']=_['intersection'](_0x54ea87[_0xf177('0x2b')],_0x54ea87[_0xf177('0x2d')]);_0x418671['attributes']=_[_0xf177('0x30')](_0x54ea87[_0xf177('0x2b')],qs[_0xf177('0x31')](_0x3d20fb['query'][_0xf177('0x31')]));_0x418671[_0xf177('0x32')]=_0x418671[_0xf177('0x32')][_0xf177('0x33')]?_0x418671[_0xf177('0x32')]:_0x54ea87[_0xf177('0x2b')];if(_0x3d20fb['query'][_0xf177('0x41')]){_0x418671[_0xf177('0x3c')]=[{'all':!![]}];}_0x418671=_['merge']({},_0x418671,_0x3d20fb[_0xf177('0x3b')]);return db[_0xf177('0x28')]['find'](_0x418671)['then'](handleEntityNotFound(_0x3c2f06,null))[_0xf177('0x21')](respondWithResult(_0x3c2f06,null))[_0xf177('0x3e')](handleError(_0x3c2f06,null));};exports['create']=function(_0x12c514,_0x52964f){return db['UserProfileSection']['create'](_0x12c514[_0xf177('0x42')],{})[_0xf177('0x21')](respondWithResult(_0x52964f,0xc9))[_0xf177('0x3e')](handleError(_0x52964f,null));};exports['update']=function(_0x2008d6,_0x5618d4){if(_0x2008d6[_0xf177('0x42')]['id']){delete _0x2008d6[_0xf177('0x42')]['id'];}return db[_0xf177('0x28')][_0xf177('0x43')]({'where':{'id':_0x2008d6[_0xf177('0x40')]['id']}})['then'](handleEntityNotFound(_0x5618d4,null))[_0xf177('0x21')](saveUpdates(_0x2008d6[_0xf177('0x42')],null))[_0xf177('0x21')](respondWithResult(_0x5618d4,null))['catch'](handleError(_0x5618d4,null));};exports['destroy']=function(_0x1f4f75,_0x42b6ca){return db['UserProfileSection']['find']({'where':{'id':_0x1f4f75[_0xf177('0x40')]['id']}})[_0xf177('0x21')](handleEntityNotFound(_0x42b6ca,null))['then'](removeEntity(_0x42b6ca,null))[_0xf177('0x3e')](handleError(_0x42b6ca,null));};exports[_0xf177('0x44')]=function(_0x2746f6,_0x19c29d){return db[_0xf177('0x28')][_0xf177('0x44')]()['then'](respondWithResult(_0x19c29d,null))[_0xf177('0x3e')](handleError(_0x19c29d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 0a276a3..dde05b3 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 _0x9679=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','compositeIndex','userProfileId'];(function(_0x469648,_0x4ddaa3){var _0x3014db=function(_0x50614c){while(--_0x50614c){_0x469648['push'](_0x469648['shift']());}};_0x3014db(++_0x4ddaa3);}(_0x9679,0x15f));var _0x9967=function(_0x5a9739,_0xc7730d){_0x5a9739=_0x5a9739-0x0;var _0xcc635e=_0x9679[_0x5a9739];return _0xcc635e;};'use strict';var _=require(_0x9967('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9967('0x1'));var moment=require(_0x9967('0x2'));var BPromise=require(_0x9967('0x3'));var rp=require(_0x9967('0x4'));var fs=require('fs');var path=require(_0x9967('0x5'));var rimraf=require(_0x9967('0x6'));var config=require(_0x9967('0x7'));var attributes=require(_0x9967('0x8'));module['exports']=function(_0x5c8725,_0x5b577f){return _0x5c8725[_0x9967('0x9')](_0x9967('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x9967('0xb'),'fields':['sectionId',_0x9967('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x129d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x437a54,_0xc16999){var _0x5bc43f=function(_0x4f3e8){while(--_0x4f3e8){_0x437a54['push'](_0x437a54['shift']());}};_0x5bc43f(++_0xc16999);}(_0x129d,0x1b3));var _0xd129=function(_0x8c0c6f,_0x4bfa98){_0x8c0c6f=_0x8c0c6f-0x0;var _0x5e3aa2=_0x129d[_0x8c0c6f];return _0x5e3aa2;};'use strict';var _=require(_0xd129('0x0'));var util=require(_0xd129('0x1'));var logger=require(_0xd129('0x2'))(_0xd129('0x3'));var moment=require(_0xd129('0x4'));var BPromise=require(_0xd129('0x5'));var rp=require(_0xd129('0x6'));var fs=require('fs');var path=require(_0xd129('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xd129('0x8')]=function(_0x2ccfce,_0x1f92d3){return _0x2ccfce[_0xd129('0x9')](_0xd129('0xa'),attributes,{'tableName':_0xd129('0xb'),'paranoid':![],'indexes':[{'name':_0xd129('0xc'),'fields':[_0xd129('0xd'),_0xd129('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index a74cd03..905a6be 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 _0x89a6=['request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4485e7,_0x14c289){var _0x167d06=function(_0xad65dd){while(--_0xad65dd){_0x4485e7['push'](_0x4485e7['shift']());}};_0x167d06(++_0x14c289);}(_0x89a6,0x6a));var _0x689a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x89a6[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x689a('0x0'));var util=require(_0x689a('0x1'));var moment=require(_0x689a('0x2'));var BPromise=require(_0x689a('0x3'));var rs=require(_0x689a('0x4'));var fs=require('fs');var Redis=require(_0x689a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x689a('0x6'));var logger=require(_0x689a('0x7'))(_0x689a('0x8'));var config=require(_0x689a('0x9'));var jayson=require(_0x689a('0xa'));var client=jayson[_0x689a('0xb')][_0x689a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x567f16,_0x47ac69,_0x464347){return new BPromise(function(_0x13ca13,_0x370037){return client[_0x689a('0xd')](_0x567f16,_0x464347)['then'](function(_0x30cfb6){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x47ac69,_0x689a('0xe'));logger['debug'](_0x689a('0xf'),_0x47ac69,_0x689a('0xe'),JSON[_0x689a('0x10')](_0x30cfb6));if(_0x30cfb6[_0x689a('0x11')]){if(_0x30cfb6[_0x689a('0x11')][_0x689a('0x12')]===0x1f4){logger[_0x689a('0x11')](_0x689a('0x13'),_0x47ac69,_0x30cfb6['error'][_0x689a('0x14')]);return _0x370037(_0x30cfb6['error'][_0x689a('0x14')]);}logger[_0x689a('0x11')](_0x689a('0x13'),_0x47ac69,_0x30cfb6['error'][_0x689a('0x14')]);return _0x13ca13(_0x30cfb6[_0x689a('0x11')][_0x689a('0x14')]);}else{logger[_0x689a('0x15')](_0x689a('0x13'),_0x47ac69,'request\x20sent');_0x13ca13(_0x30cfb6[_0x689a('0x16')]['message']);}})[_0x689a('0x17')](function(_0x38af94){logger['error'](_0x689a('0x13'),_0x47ac69,_0x38af94);_0x370037(_0x38af94);});});} \ No newline at end of file +var _0x46e4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x2c7bfe,_0x2c951b){var _0x5bedd7=function(_0x5669ec){while(--_0x5669ec){_0x2c7bfe['push'](_0x2c7bfe['shift']());}};_0x5bedd7(++_0x2c951b);}(_0x46e4,0xdd));var _0x446e=function(_0x4a5635,_0x443b90){_0x4a5635=_0x4a5635-0x0;var _0x18d602=_0x46e4[_0x4a5635];return _0x18d602;};'use strict';var _=require(_0x446e('0x0'));var util=require('util');var moment=require(_0x446e('0x1'));var BPromise=require(_0x446e('0x2'));var rs=require(_0x446e('0x3'));var fs=require('fs');var Redis=require(_0x446e('0x4'));var db=require(_0x446e('0x5'))['db'];var utils=require(_0x446e('0x6'));var logger=require(_0x446e('0x7'))(_0x446e('0x8'));var config=require(_0x446e('0x9'));var jayson=require(_0x446e('0xa'));var client=jayson[_0x446e('0xb')][_0x446e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3096ef,_0x80bde3,_0x45d89e){return new BPromise(function(_0x223436,_0x29b441){return client[_0x446e('0xd')](_0x3096ef,_0x45d89e)[_0x446e('0xe')](function(_0x599989){logger[_0x446e('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x80bde3,_0x446e('0x10'));logger['debug'](_0x446e('0x11'),_0x80bde3,_0x446e('0x10'),JSON[_0x446e('0x12')](_0x599989));if(_0x599989[_0x446e('0x13')]){if(_0x599989['error'][_0x446e('0x14')]===0x1f4){logger[_0x446e('0x13')](_0x446e('0x15'),_0x80bde3,_0x599989['error'][_0x446e('0x16')]);return _0x29b441(_0x599989[_0x446e('0x13')][_0x446e('0x16')]);}logger[_0x446e('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x80bde3,_0x599989[_0x446e('0x13')][_0x446e('0x16')]);return _0x223436(_0x599989[_0x446e('0x13')][_0x446e('0x16')]);}else{logger['info'](_0x446e('0x15'),_0x80bde3,'request\x20sent');_0x223436(_0x599989[_0x446e('0x17')][_0x446e('0x16')]);}})[_0x446e('0x18')](function(_0x8be0f0){logger[_0x446e('0x13')](_0x446e('0x15'),_0x80bde3,_0x8be0f0);_0x29b441(_0x8be0f0);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index fce98d2..80a6f74 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x27b3bf,_0x58125a){var _0x515eaa=function(_0x49e3fd){while(--_0x49e3fd){_0x27b3bf['push'](_0x27b3bf['shift']());}};_0x515eaa(++_0x58125a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0xcb91[_0x2ed7d1];return _0x38ae3c;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xe0a19c,_0x1f349d){var _0x25c1cf=function(_0x132a79){while(--_0x132a79){_0xe0a19c['push'](_0xe0a19c['shift']());}};_0x25c1cf(++_0x1f349d);}(_0xe706,0xa3));var _0x6e70=function(_0x4c0e31,_0xa79bf2){_0x4c0e31=_0x4c0e31-0x0;var _0x41707d=_0xe706[_0x4c0e31];return _0x41707d;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 84137bc..bf79ba1 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 _0xbd5a=['exports','INTEGER','sequelize'];(function(_0x1ddbee,_0x5c0373){var _0x5c6189=function(_0x71ffc7){while(--_0x71ffc7){_0x1ddbee['push'](_0x1ddbee['shift']());}};_0x5c6189(++_0x5c0373);}(_0xbd5a,0x1d0));var _0xabd5=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xbd5a[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0xabd5('0x0'));module[_0xabd5('0x1')]={'penalty':{'type':Sequelize[_0xabd5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8994=['exports','sequelize'];(function(_0x4b84ae,_0x26f981){var _0x3325f8=function(_0x242b05){while(--_0x242b05){_0x4b84ae['push'](_0x4b84ae['shift']());}};_0x3325f8(++_0x26f981);}(_0x8994,0x121));var _0x4899=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x8994[_0x2fc012];return _0x2891f9;};'use strict';var Sequelize=require(_0x4899('0x0'));module[_0x4899('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 1e4b284..e973cf4 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x309991,_0x457e73){var _0x4ca94d=function(_0x294acc){while(--_0x294acc){_0x309991['push'](_0x309991['shift']());}};_0x4ca94d(++_0x457e73);}(_0x7a54,0x106));var _0x47a5=function(_0x50024a,_0x46cc0a){_0x50024a=_0x50024a-0x0;var _0x49fd9d=_0x7a54[_0x50024a];return _0x49fd9d;};'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 _0x9a5a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x9a5a,0x194));var _0xa9a5=function(_0x5719b7,_0xbe971f){_0x5719b7=_0x5719b7-0x0;var _0x1272a3=_0x9a5a[_0x5719b7];return _0x1272a3;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'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 b35ee7d..69e4984 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 _0x99d5=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0x99d5,0xe4));var _0x599d=function(_0x157e93,_0x4668f9){_0x157e93=_0x157e93-0x0;var _0x4459af=_0x99d5[_0x157e93];return _0x4459af;};'use strict';var _=require(_0x599d('0x0'));var util=require('util');var moment=require(_0x599d('0x1'));var BPromise=require(_0x599d('0x2'));var rs=require(_0x599d('0x3'));var fs=require('fs');var Redis=require(_0x599d('0x4'));var db=require(_0x599d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x599d('0x6'))(_0x599d('0x7'));var config=require('../../config/environment');var jayson=require(_0x599d('0x8'));var client=jayson[_0x599d('0x9')][_0x599d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b161a,_0x108c07,_0x3348fe){return new BPromise(function(_0x55fa93,_0x5ddc11){return client[_0x599d('0xb')](_0x2b161a,_0x3348fe)['then'](function(_0x5cb0bf){logger[_0x599d('0xc')](_0x599d('0xd'),_0x108c07,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x108c07,_0x599d('0xe'),JSON['stringify'](_0x5cb0bf));if(_0x5cb0bf[_0x599d('0xf')]){if(_0x5cb0bf[_0x599d('0xf')][_0x599d('0x10')]===0x1f4){logger[_0x599d('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x108c07,_0x5cb0bf['error'][_0x599d('0x11')]);return _0x5ddc11(_0x5cb0bf[_0x599d('0xf')][_0x599d('0x11')]);}logger[_0x599d('0xf')](_0x599d('0xd'),_0x108c07,_0x5cb0bf['error'][_0x599d('0x11')]);return _0x55fa93(_0x5cb0bf[_0x599d('0xf')][_0x599d('0x11')]);}else{logger[_0x599d('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x108c07,_0x599d('0xe'));_0x55fa93(_0x5cb0bf['result'][_0x599d('0x11')]);}})[_0x599d('0x12')](function(_0x5f08c0){logger[_0x599d('0xf')](_0x599d('0xd'),_0x108c07,_0x5f08c0);_0x5ddc11(_0x5f08c0);});});} \ No newline at end of file +var _0x8dac=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x68a0b0,_0x2bba91){var _0x4b4ee6=function(_0x36f6da){while(--_0x36f6da){_0x68a0b0['push'](_0x68a0b0['shift']());}};_0x4b4ee6(++_0x2bba91);}(_0x8dac,0x68));var _0xc8da=function(_0x5d51bc,_0x2183b9){_0x5d51bc=_0x5d51bc-0x0;var _0x1643c1=_0x8dac[_0x5d51bc];return _0x1643c1;};'use strict';var _=require(_0xc8da('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc8da('0x1'));var rs=require(_0xc8da('0x2'));var fs=require('fs');var Redis=require(_0xc8da('0x3'));var db=require(_0xc8da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8da('0x5'))(_0xc8da('0x6'));var config=require('../../config/environment');var jayson=require(_0xc8da('0x7'));var client=jayson[_0xc8da('0x8')][_0xc8da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9a82d2,_0x3dddc5,_0x344d72){return new BPromise(function(_0x2c28a9,_0x191a07){return client[_0xc8da('0xa')](_0x9a82d2,_0x344d72)[_0xc8da('0xb')](function(_0x5ddc70){logger[_0xc8da('0xc')](_0xc8da('0xd'),_0x3dddc5,_0xc8da('0xe'));logger[_0xc8da('0xf')](_0xc8da('0x10'),_0x3dddc5,'request\x20sent',JSON['stringify'](_0x5ddc70));if(_0x5ddc70[_0xc8da('0x11')]){if(_0x5ddc70[_0xc8da('0x11')][_0xc8da('0x12')]===0x1f4){logger[_0xc8da('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x3dddc5,_0x5ddc70[_0xc8da('0x11')][_0xc8da('0x13')]);return _0x191a07(_0x5ddc70[_0xc8da('0x11')][_0xc8da('0x13')]);}logger[_0xc8da('0x11')](_0xc8da('0xd'),_0x3dddc5,_0x5ddc70['error'][_0xc8da('0x13')]);return _0x2c28a9(_0x5ddc70['error'][_0xc8da('0x13')]);}else{logger[_0xc8da('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x3dddc5,_0xc8da('0xe'));_0x2c28a9(_0x5ddc70['result'][_0xc8da('0x13')]);}})[_0xc8da('0x14')](function(_0x5010d5){logger['error'](_0xc8da('0xd'),_0x3dddc5,_0x5010d5);_0x191a07(_0x5010d5);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index f558a30..5fe3b81 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 _0x1a54=['exports','INTEGER','sequelize'];(function(_0x31d6c2,_0x422dcd){var _0x295dd0=function(_0x2b5dd1){while(--_0x2b5dd1){_0x31d6c2['push'](_0x31d6c2['shift']());}};_0x295dd0(++_0x422dcd);}(_0x1a54,0x86));var _0x41a5=function(_0x3412fb,_0x13df0c){_0x3412fb=_0x3412fb-0x0;var _0x344a25=_0x1a54[_0x3412fb];return _0x344a25;};'use strict';var Sequelize=require(_0x41a5('0x0'));module[_0x41a5('0x1')]={'UserId':{'type':Sequelize[_0x41a5('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x41a5('0x2')]}}; \ No newline at end of file +var _0x39ff=['sequelize','exports','INTEGER'];(function(_0xc61ea8,_0x56e451){var _0x22c845=function(_0x143785){while(--_0x143785){_0xc61ea8['push'](_0xc61ea8['shift']());}};_0x22c845(++_0x56e451);}(_0x39ff,0x1bc));var _0xf39f=function(_0x44d6df,_0x26d6df){_0x44d6df=_0x44d6df-0x0;var _0x77c23=_0x39ff[_0x44d6df];return _0x77c23;};'use strict';var Sequelize=require(_0xf39f('0x0'));module[_0xf39f('0x1')]={'UserId':{'type':Sequelize[_0xf39f('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index d15da35..fe595fe 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(_0x2484f8,_0x1ea92a){var _0x2ac7f0=function(_0x1c9a4e){while(--_0x1c9a4e){_0x2484f8['push'](_0x2484f8['shift']());}};_0x2ac7f0(++_0x1ea92a);}(_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 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(_0x1c91d0,_0x3de229){var _0x1cda9f=function(_0x1a8cb6){while(--_0x1a8cb6){_0x1c91d0['push'](_0x1c91d0['shift']());}};_0x1cda9f(++_0x3de229);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 3bec5af..5d0a187 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(_0x26278a,_0x161f57){var _0x108b8f=function(_0x35ab70){while(--_0x35ab70){_0x26278a['push'](_0x26278a['shift']());}};_0x108b8f(++_0x161f57);}(_0x70e0,0x17b));var _0x070e=function(_0x59e469,_0x1e8647){_0x59e469=_0x59e469-0x0;var _0x17a2ab=_0x70e0[_0x59e469];return _0x17a2ab;};'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(_0x40503c,_0xadfadc){var _0x597fda=function(_0x629359){while(--_0x629359){_0x40503c['push'](_0x40503c['shift']());}};_0x597fda(++_0xadfadc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xcb91[_0x5f09c5];return _0x426ad9;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index ba7357e..15a9136 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 _0xd58c=['INTEGER','sequelize','exports'];(function(_0xe7acb9,_0x479726){var _0x364bb6=function(_0x235cda){while(--_0x235cda){_0xe7acb9['push'](_0xe7acb9['shift']());}};_0x364bb6(++_0x479726);}(_0xd58c,0x70));var _0xcd58=function(_0x5c64e6,_0x3cece4){_0x5c64e6=_0x5c64e6-0x0;var _0x2d5571=_0xd58c[_0x5c64e6];return _0x2d5571;};'use strict';var Sequelize=require(_0xcd58('0x0'));module[_0xcd58('0x1')]={'penalty':{'type':Sequelize[_0xcd58('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x988a=['INTEGER','exports'];(function(_0x5c589e,_0x190534){var _0x2daf47=function(_0x581f79){while(--_0x581f79){_0x5c589e['push'](_0x5c589e['shift']());}};_0x2daf47(++_0x190534);}(_0x988a,0xe9));var _0xa988=function(_0x2d3881,_0x2ac343){_0x2d3881=_0x2d3881-0x0;var _0x101b51=_0x988a[_0x2d3881];return _0x101b51;};'use strict';var Sequelize=require('sequelize');module[_0xa988('0x0')]={'penalty':{'type':Sequelize[_0xa988('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 9b96d2e..2eab2b4 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 _0x5369=['../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x18fec8,_0x31d0cd){var _0x5e400c=function(_0x1f3bc0){while(--_0x1f3bc0){_0x18fec8['push'](_0x18fec8['shift']());}};_0x5e400c(++_0x31d0cd);}(_0x5369,0x118));var _0x9536=function(_0x169879,_0x2364bc){_0x169879=_0x169879-0x0;var _0x2f3199=_0x5369[_0x169879];return _0x2f3199;};'use strict';var _=require(_0x9536('0x0'));var util=require('util');var logger=require(_0x9536('0x1'))('api');var moment=require(_0x9536('0x2'));var BPromise=require(_0x9536('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9536('0x4'));var rimraf=require(_0x9536('0x5'));var config=require(_0x9536('0x6'));var attributes=require(_0x9536('0x7'));module[_0x9536('0x8')]=function(_0x5a6a52,_0x18a58e){return _0x5a6a52['define'](_0x9536('0x9'),attributes,{'tableName':_0x9536('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7c4=['UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa7c4,0x1ca));var _0x4a7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4a7c('0x0'));var util=require('util');var logger=require(_0x4a7c('0x1'))(_0x4a7c('0x2'));var moment=require(_0x4a7c('0x3'));var BPromise=require(_0x4a7c('0x4'));var rp=require(_0x4a7c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4a7c('0x6'));var attributes=require(_0x4a7c('0x7'));module[_0x4a7c('0x8')]=function(_0x437b63,_0xdf8d1d){return _0x437b63[_0x4a7c('0x9')](_0x4a7c('0xa'),attributes,{'tableName':_0x4a7c('0xb'),'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 9ef4432..85f5c5e 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 _0xe15e=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe15e,0x6e));var _0xee15=function(_0x11e43a,_0x4dc616){_0x11e43a=_0x11e43a-0x0;var _0x247f0=_0xe15e[_0x11e43a];return _0x247f0;};'use strict';var _=require('lodash');var util=require(_0xee15('0x0'));var moment=require(_0xee15('0x1'));var BPromise=require(_0xee15('0x2'));var rs=require(_0xee15('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee15('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xee15('0x5'))(_0xee15('0x6'));var config=require(_0xee15('0x7'));var jayson=require(_0xee15('0x8'));var client=jayson[_0xee15('0x9')][_0xee15('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x438e76,_0x2a80d4,_0xe1581a){return new BPromise(function(_0x24c19f,_0x76525e){return client[_0xee15('0xb')](_0x438e76,_0xe1581a)[_0xee15('0xc')](function(_0x3e082a){logger['info'](_0xee15('0xd'),_0x2a80d4,_0xee15('0xe'));logger[_0xee15('0xf')](_0xee15('0x10'),_0x2a80d4,_0xee15('0xe'),JSON[_0xee15('0x11')](_0x3e082a));if(_0x3e082a[_0xee15('0x12')]){if(_0x3e082a[_0xee15('0x12')][_0xee15('0x13')]===0x1f4){logger[_0xee15('0x12')](_0xee15('0xd'),_0x2a80d4,_0x3e082a[_0xee15('0x12')]['message']);return _0x76525e(_0x3e082a[_0xee15('0x12')]['message']);}logger[_0xee15('0x12')](_0xee15('0xd'),_0x2a80d4,_0x3e082a[_0xee15('0x12')][_0xee15('0x14')]);return _0x24c19f(_0x3e082a[_0xee15('0x12')][_0xee15('0x14')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x2a80d4,_0xee15('0xe'));_0x24c19f(_0x3e082a['result'][_0xee15('0x14')]);}})['catch'](function(_0x3ff1c2){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x2a80d4,_0x3ff1c2);_0x76525e(_0x3ff1c2);});});} \ No newline at end of file +var _0xa661=['error','code','message','UserVoiceQueue,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5899ca,_0x30e5b1){var _0x1bd5aa=function(_0x307854){while(--_0x307854){_0x5899ca['push'](_0x5899ca['shift']());}};_0x1bd5aa(++_0x30e5b1);}(_0xa661,0x91));var _0x1a66=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0xa661[_0x4afac5];return _0x2404b3;};'use strict';var _=require(_0x1a66('0x0'));var util=require(_0x1a66('0x1'));var moment=require(_0x1a66('0x2'));var BPromise=require('bluebird');var rs=require(_0x1a66('0x3'));var fs=require('fs');var Redis=require(_0x1a66('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a66('0x5'));var logger=require(_0x1a66('0x6'))('rpc');var config=require(_0x1a66('0x7'));var jayson=require(_0x1a66('0x8'));var client=jayson[_0x1a66('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fca4c,_0x58b954,_0x28d2e5){return new BPromise(function(_0x409e4a,_0x3495e4){return client[_0x1a66('0xa')](_0x1fca4c,_0x28d2e5)[_0x1a66('0xb')](function(_0x38d297){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x58b954,_0x1a66('0xc'));logger['debug'](_0x1a66('0xd'),_0x58b954,_0x1a66('0xc'),JSON[_0x1a66('0xe')](_0x38d297));if(_0x38d297['error']){if(_0x38d297[_0x1a66('0xf')][_0x1a66('0x10')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x58b954,_0x38d297[_0x1a66('0xf')][_0x1a66('0x11')]);return _0x3495e4(_0x38d297[_0x1a66('0xf')][_0x1a66('0x11')]);}logger[_0x1a66('0xf')](_0x1a66('0x12'),_0x58b954,_0x38d297[_0x1a66('0xf')][_0x1a66('0x11')]);return _0x409e4a(_0x38d297[_0x1a66('0xf')][_0x1a66('0x11')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x58b954,_0x1a66('0xc'));_0x409e4a(_0x38d297['result']['message']);}})[_0x1a66('0x13')](function(_0x488dd6){logger[_0x1a66('0xf')](_0x1a66('0x12'),_0x58b954,_0x488dd6);_0x3495e4(_0x488dd6);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 9900381..9b93383 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x15f6a0,_0x5b34fc){var _0x10f8c7=function(_0x5b7d95){while(--_0x5b7d95){_0x15f6a0['push'](_0x15f6a0['shift']());}};_0x10f8c7(++_0x5b34fc);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x553621,_0x18ff21){var _0x30d42f=function(_0x4e98cb){while(--_0x4e98cb){_0x553621['push'](_0x553621['shift']());}};_0x30d42f(++_0x18ff21);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 4266eeb..dd48f93 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 _0x7825=['INTEGER','queue_interface','exports','STRING','Required\x20by\x20Asterisk'];(function(_0x447175,_0x23efc7){var _0x4e4544=function(_0x367f83){while(--_0x367f83){_0x447175['push'](_0x447175['shift']());}};_0x4e4544(++_0x23efc7);}(_0x7825,0x138));var _0x5782=function(_0x3b970b,_0x2ff4aa){_0x3b970b=_0x3b970b-0x0;var _0x202d50=_0x7825[_0x3b970b];return _0x202d50;};'use strict';var Sequelize=require('sequelize');module[_0x5782('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x5782('0x1')],'allowNull':![],'comment':_0x5782('0x2')},'UserId':{'type':Sequelize[_0x5782('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5782('0x4'),'comment':_0x5782('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x5782('0x1')],'allowNull':![],'unique':'queue_interface','comment':_0x5782('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x5782('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x3f60=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x49a612,_0x5692dd){var _0x2489f1=function(_0x4826bb){while(--_0x4826bb){_0x49a612['push'](_0x49a612['shift']());}};_0x2489f1(++_0x5692dd);}(_0x3f60,0xc4));var _0x03f6=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x3f60[_0x90a39a];return _0x2b62f7;};'use strict';var Sequelize=require('sequelize');module[_0x03f6('0x0')]={'uniqueid':{'type':Sequelize[_0x03f6('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x03f6('0x2')},'membername':{'type':Sequelize[_0x03f6('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x03f6('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x03f6('0x3')],'allowNull':![],'unique':_0x03f6('0x4'),'comment':_0x03f6('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x03f6('0x2')},'penalty':{'type':Sequelize[_0x03f6('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x03f6('0x1')](0xb),'defaultValue':0x0,'comment':_0x03f6('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 7de3e93..2647b90 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 _0xc729=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc729,0x84));var _0x9c72=function(_0x203a0b,_0x583c98){_0x203a0b=_0x203a0b-0x0;var _0x590daf=_0xc729[_0x203a0b];return _0x590daf;};'use strict';var EventEmitter=require(_0x9c72('0x0'));var UserVoiceQueueRt=require(_0x9c72('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9c72('0x2')](0x0);var events={'afterCreate':_0x9c72('0x3'),'afterUpdate':'update','afterDestroy':_0x9c72('0x4')};function emitEvent(_0x19b0ad){return function(_0x27e5c1,_0x4302c7,_0x2362b0){UserVoiceQueueRtEvents[_0x9c72('0x5')](_0x19b0ad+':'+_0x27e5c1['id'],_0x27e5c1);UserVoiceQueueRtEvents[_0x9c72('0x5')](_0x19b0ad,_0x27e5c1);_0x2362b0(null);};}for(var e in events){if(events[_0x9c72('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x9c72('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xb901=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x598f9c,_0x2527a9){var _0x593fdd=function(_0x432fb8){while(--_0x432fb8){_0x598f9c['push'](_0x598f9c['shift']());}};_0x593fdd(++_0x2527a9);}(_0xb901,0x10c));var _0x1b90=function(_0x29740e,_0x200cc1){_0x29740e=_0x29740e-0x0;var _0x89660b=_0xb901[_0x29740e];return _0x89660b;};'use strict';var EventEmitter=require(_0x1b90('0x0'));var UserVoiceQueueRt=require(_0x1b90('0x1'))['db'][_0x1b90('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1b90('0x3')](0x0);var events={'afterCreate':_0x1b90('0x4'),'afterUpdate':_0x1b90('0x5'),'afterDestroy':_0x1b90('0x6')};function emitEvent(_0x518ed4){return function(_0x481650,_0x5bbfe3,_0x3df394){UserVoiceQueueRtEvents[_0x1b90('0x7')](_0x518ed4+':'+_0x481650['id'],_0x481650);UserVoiceQueueRtEvents[_0x1b90('0x7')](_0x518ed4,_0x481650);_0x3df394(null);};}for(var e in events){if(events[_0x1b90('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x1b90('0x9')](e,emitEvent(event));}}module[_0x1b90('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 913c094..88338a3 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 _0x67df=['bluebird','path','rimraf','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api'];(function(_0x1dea16,_0x4f7a5c){var _0x3923a3=function(_0x200a3a){while(--_0x200a3a){_0x1dea16['push'](_0x1dea16['shift']());}};_0x3923a3(++_0x4f7a5c);}(_0x67df,0x1d0));var _0xf67d=function(_0x22ebc6,_0x265d0b){_0x22ebc6=_0x22ebc6-0x0;var _0x350676=_0x67df[_0x22ebc6];return _0x350676;};'use strict';var _=require(_0xf67d('0x0'));var util=require(_0xf67d('0x1'));var logger=require(_0xf67d('0x2'))(_0xf67d('0x3'));var moment=require('moment');var BPromise=require(_0xf67d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf67d('0x5'));var rimraf=require(_0xf67d('0x6'));var config=require(_0xf67d('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xf67d('0x8')]=function(_0x9e1f8f,_0x5edeae){return _0x9e1f8f[_0xf67d('0x9')](_0xf67d('0xa'),attributes,{'tableName':_0xf67d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9eae=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define'];(function(_0x2c6047,_0x485481){var _0x5a9f17=function(_0x505fe8){while(--_0x505fe8){_0x2c6047['push'](_0x2c6047['shift']());}};_0x5a9f17(++_0x485481);}(_0x9eae,0x17b));var _0xe9ea=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x9eae[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xe9ea('0x0'));var util=require(_0xe9ea('0x1'));var logger=require(_0xe9ea('0x2'))(_0xe9ea('0x3'));var moment=require('moment');var BPromise=require(_0xe9ea('0x4'));var rp=require(_0xe9ea('0x5'));var fs=require('fs');var path=require(_0xe9ea('0x6'));var rimraf=require(_0xe9ea('0x7'));var config=require(_0xe9ea('0x8'));var attributes=require(_0xe9ea('0x9'));module['exports']=function(_0x2e1f40,_0x33a7f8){return _0x2e1f40[_0xe9ea('0xa')](_0xe9ea('0xb'),attributes,{'tableName':_0xe9ea('0xc'),'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 756e19f..1341268 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 _0x5086=['outboundQueuePauses','GetVoiceQueueRtPauses','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x5086,0x6f));var _0x6508=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x5086[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x6508('0x0'));var util=require(_0x6508('0x1'));var moment=require(_0x6508('0x2'));var BPromise=require(_0x6508('0x3'));var rs=require(_0x6508('0x4'));var fs=require('fs');var Redis=require(_0x6508('0x5'));var db=require(_0x6508('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6508('0x7'))(_0x6508('0x8'));var config=require(_0x6508('0x9'));var jayson=require(_0x6508('0xa'));var client=jayson[_0x6508('0xb')]['http']({'port':0x232a});config[_0x6508('0xc')]=_['defaults'](config[_0x6508('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6508('0xd'))(new Redis(config[_0x6508('0xc')]));require(_0x6508('0xe'))[_0x6508('0xf')](socket);function respondWithRpcPromise(_0x3d9abe,_0x5612bf,_0x2a268c){return new BPromise(function(_0x4aa08d,_0x428e58){return client['request'](_0x3d9abe,_0x2a268c)[_0x6508('0x10')](function(_0x354ba7){logger['info'](_0x6508('0x11'),_0x5612bf,_0x6508('0x12'));logger[_0x6508('0x13')](_0x6508('0x14'),_0x5612bf,_0x6508('0x12'),JSON[_0x6508('0x15')](_0x354ba7));if(_0x354ba7[_0x6508('0x16')]){if(_0x354ba7[_0x6508('0x16')][_0x6508('0x17')]===0x1f4){logger['error'](_0x6508('0x11'),_0x5612bf,_0x354ba7[_0x6508('0x16')][_0x6508('0x18')]);return _0x428e58(_0x354ba7['error'][_0x6508('0x18')]);}logger['error'](_0x6508('0x11'),_0x5612bf,_0x354ba7[_0x6508('0x16')][_0x6508('0x18')]);return _0x4aa08d(_0x354ba7[_0x6508('0x16')][_0x6508('0x18')]);}else{logger[_0x6508('0x19')](_0x6508('0x11'),_0x5612bf,_0x6508('0x12'));_0x4aa08d(_0x354ba7['result'][_0x6508('0x18')]);}})['catch'](function(_0x4ff71a){logger[_0x6508('0x16')](_0x6508('0x11'),_0x5612bf,_0x4ff71a);_0x428e58(_0x4ff71a);});});}exports['GetVoiceQueueRtPauses']=function(_0x58e7ab){var _0x51dee1=this;return new Promise(function(_0x2c65d0,_0x70c179){return db[_0x6508('0x1a')][_0x6508('0x1b')]({'raw':_0x58e7ab[_0x6508('0x1c')]?_0x58e7ab['options'][_0x6508('0x1d')]===undefined?!![]:![]:!![],'where':_0x58e7ab[_0x6508('0x1c')]?_0x58e7ab['options']['where']||null:null,'attributes':[[db[_0x6508('0x1e')]['fn'](_0x6508('0x1f'),db[_0x6508('0x1e')]['fn']('IF',db[_0x6508('0x1e')]['literal'](_0x6508('0x20')))),_0x6508('0x21')]]})['then'](function(_0x254e2a){logger[_0x6508('0x19')](_0x6508('0x22'),_0x58e7ab);logger[_0x6508('0x13')]('GetVoiceQueueRtPauses',_0x58e7ab,JSON['stringify'](_0x254e2a));_0x2c65d0(_0x254e2a);})[_0x6508('0x23')](function(_0x3b47b9){logger[_0x6508('0x16')]('GetVoiceQueueRtPauses',_0x3b47b9[_0x6508('0x18')],_0x58e7ab);_0x70c179(_0x51dee1[_0x6508('0x16')](0x1f4,_0x3b47b9['message']));});});}; \ No newline at end of file +var _0xb6af=['result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb6af,0x8f));var _0xfb6a=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0xb6af[_0x119cd8];return _0x7072a3;};'use strict';var _=require(_0xfb6a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfb6a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb6a('0x2'))['db'];var utils=require(_0xfb6a('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xfb6a('0x4'));var jayson=require(_0xfb6a('0x5'));var client=jayson[_0xfb6a('0x6')][_0xfb6a('0x7')]({'port':0x232a});config[_0xfb6a('0x8')]=_[_0xfb6a('0x9')](config[_0xfb6a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb6a('0xa'))(new Redis(config[_0xfb6a('0x8')]));require('./userVoiceQueueRt.socket')[_0xfb6a('0xb')](socket);function respondWithRpcPromise(_0x146e03,_0x4e6295,_0x4b2189){return new BPromise(function(_0x272843,_0x2f8b48){return client[_0xfb6a('0xc')](_0x146e03,_0x4b2189)[_0xfb6a('0xd')](function(_0x2cffc5){logger[_0xfb6a('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4e6295,_0xfb6a('0xf'));logger[_0xfb6a('0x10')](_0xfb6a('0x11'),_0x4e6295,_0xfb6a('0xf'),JSON['stringify'](_0x2cffc5));if(_0x2cffc5[_0xfb6a('0x12')]){if(_0x2cffc5[_0xfb6a('0x12')][_0xfb6a('0x13')]===0x1f4){logger[_0xfb6a('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4e6295,_0x2cffc5[_0xfb6a('0x12')][_0xfb6a('0x14')]);return _0x2f8b48(_0x2cffc5['error'][_0xfb6a('0x14')]);}logger[_0xfb6a('0x12')](_0xfb6a('0x15'),_0x4e6295,_0x2cffc5[_0xfb6a('0x12')][_0xfb6a('0x14')]);return _0x272843(_0x2cffc5['error'][_0xfb6a('0x14')]);}else{logger[_0xfb6a('0xe')](_0xfb6a('0x15'),_0x4e6295,'request\x20sent');_0x272843(_0x2cffc5[_0xfb6a('0x16')][_0xfb6a('0x14')]);}})[_0xfb6a('0x17')](function(_0x4fd9bb){logger[_0xfb6a('0x12')](_0xfb6a('0x15'),_0x4e6295,_0x4fd9bb);_0x2f8b48(_0x4fd9bb);});});}exports[_0xfb6a('0x18')]=function(_0x3c6249){var _0x1772d0=this;return new Promise(function(_0x284765,_0x40069e){return db[_0xfb6a('0x19')]['findAll']({'raw':_0x3c6249[_0xfb6a('0x1a')]?_0x3c6249[_0xfb6a('0x1a')][_0xfb6a('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c6249[_0xfb6a('0x1a')]?_0x3c6249[_0xfb6a('0x1a')][_0xfb6a('0x1c')]||null:null,'attributes':[[db[_0xfb6a('0x1d')]['fn'](_0xfb6a('0x1e'),db[_0xfb6a('0x1d')]['fn']('IF',db['sequelize'][_0xfb6a('0x1f')](_0xfb6a('0x20')))),'outboundQueuePauses']]})[_0xfb6a('0xd')](function(_0x51fe8e){logger[_0xfb6a('0xe')](_0xfb6a('0x18'),_0x3c6249);logger[_0xfb6a('0x10')](_0xfb6a('0x18'),_0x3c6249,JSON['stringify'](_0x51fe8e));_0x284765(_0x51fe8e);})['catch'](function(_0x335449){logger[_0xfb6a('0x12')](_0xfb6a('0x18'),_0x335449[_0xfb6a('0x14')],_0x3c6249);_0x40069e(_0x1772d0[_0xfb6a('0x12')](0x1f4,_0x335449[_0xfb6a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 40a0396..35f05da 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 _0x88b0=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','emit'];(function(_0x50aec5,_0x12464c){var _0x3b86c4=function(_0x4d457b){while(--_0x4d457b){_0x50aec5['push'](_0x50aec5['shift']());}};_0x3b86c4(++_0x12464c);}(_0x88b0,0x1cb));var _0x088b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x88b0[_0x501510];return _0x1e6ee5;};'use strict';var UserVoiceQueueRtEvents=require(_0x088b('0x0'));var events=[_0x088b('0x1'),'remove','update'];function createListener(_0x3f8d4a,_0x1ead50){return function(_0x28a565){_0x1ead50[_0x088b('0x2')](_0x3f8d4a,_0x28a565);};}function removeListener(_0x49e80b,_0x211dfb){return function(){UserVoiceQueueRtEvents[_0x088b('0x3')](_0x49e80b,_0x211dfb);};}exports[_0x088b('0x4')]=function(_0x5af8a4){for(var _0x4a9986=0x0,_0xfd98a3=events[_0x088b('0x5')];_0x4a9986<_0xfd98a3;_0x4a9986++){var _0x18fa42=events[_0x4a9986];var _0x2164cb=createListener(_0x088b('0x6')+_0x18fa42,_0x5af8a4);UserVoiceQueueRtEvents['on'](_0x18fa42,_0x2164cb);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x4e9c5b,_0x58c860){var _0x3d4075=function(_0x585b78){while(--_0x585b78){_0x4e9c5b['push'](_0x4e9c5b['shift']());}};_0x3d4075(++_0x58c860);}(_0x7a54,0x106));var _0x47a5=function(_0x4391cd,_0x36445c){_0x4391cd=_0x4391cd-0x0;var _0x34af42=_0x7a54[_0x4391cd];return _0x34af42;};'use strict';var UserVoiceQueueRtEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){UserVoiceQueueRtEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);UserVoiceQueueRtEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 830b90e..caa046b 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1a5a87,_0x5b093b){var _0x20ed26=function(_0x29a5f5){while(--_0x29a5f5){_0x1a5a87['push'](_0x1a5a87['shift']());}};_0x20ed26(++_0x5b093b);}(_0xedd9,0xfc));var _0x9edd=function(_0x36ebf8,_0x6e8b8){_0x36ebf8=_0x36ebf8-0x0;var _0x2256f5=_0xedd9[_0x36ebf8];return _0x2256f5;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5392c3,_0x1d4cbc){var _0x41d9d1=function(_0x21f03c){while(--_0x21f03c){_0x5392c3['push'](_0x5392c3['shift']());}};_0x41d9d1(++_0x1d4cbc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0xcb91[_0x4232d8];return _0x324de2;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index ef33f7e..a57a264 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 _0xc9b9=['INTEGER'];(function(_0x5ebaf0,_0x230ca7){var _0x7a90a0=function(_0x31ec9f){while(--_0x31ec9f){_0x5ebaf0['push'](_0x5ebaf0['shift']());}};_0x7a90a0(++_0x230ca7);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0xc9b9[_0x3932eb];return _0x5316e5;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x9c9b('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x01e7=['exports','INTEGER','sequelize'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x01e7,0x125));var _0x701e=function(_0x461dc6,_0x4e78bf){_0x461dc6=_0x461dc6-0x0;var _0x460f6e=_0x01e7[_0x461dc6];return _0x460f6e;};'use strict';var Sequelize=require(_0x701e('0x0'));module[_0x701e('0x1')]={'penalty':{'type':Sequelize[_0x701e('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 d56576b..180e945 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 _0xc72c=['user_has_whatsapp_queues','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue'];(function(_0x4b8da2,_0x5c97ca){var _0x16b62b=function(_0x573a0e){while(--_0x573a0e){_0x4b8da2['push'](_0x4b8da2['shift']());}};_0x16b62b(++_0x5c97ca);}(_0xc72c,0x119));var _0xcc72=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc72c[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xcc72('0x0'));var util=require('util');var logger=require(_0xcc72('0x1'))(_0xcc72('0x2'));var moment=require(_0xcc72('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc72('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc72('0x5'));var config=require(_0xcc72('0x6'));var attributes=require(_0xcc72('0x7'));module['exports']=function(_0x2cc65c,_0x31ad4b){return _0x2cc65c['define'](_0xcc72('0x8'),attributes,{'tableName':_0xcc72('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfab1=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfab1,0x1ba));var _0x1fab=function(_0x3e2cfb,_0x7c12c6){_0x3e2cfb=_0x3e2cfb-0x0;var _0x3e4308=_0xfab1[_0x3e2cfb];return _0x3e4308;};'use strict';var _=require(_0x1fab('0x0'));var util=require(_0x1fab('0x1'));var logger=require(_0x1fab('0x2'))('api');var moment=require(_0x1fab('0x3'));var BPromise=require(_0x1fab('0x4'));var rp=require(_0x1fab('0x5'));var fs=require('fs');var path=require(_0x1fab('0x6'));var rimraf=require('rimraf');var config=require(_0x1fab('0x7'));var attributes=require(_0x1fab('0x8'));module[_0x1fab('0x9')]=function(_0x1b0600,_0x330c8e){return _0x1b0600[_0x1fab('0xa')](_0x1fab('0xb'),attributes,{'tableName':_0x1fab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index c79f3bb..fb8ecfa 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 _0x4183=['info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4183,0xeb));var _0x3418=function(_0x2cd74c,_0x421a6b){_0x2cd74c=_0x2cd74c-0x0;var _0x1d0269=_0x4183[_0x2cd74c];return _0x1d0269;};'use strict';var _=require(_0x3418('0x0'));var util=require(_0x3418('0x1'));var moment=require(_0x3418('0x2'));var BPromise=require(_0x3418('0x3'));var rs=require(_0x3418('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3418('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3418('0x6'))(_0x3418('0x7'));var config=require('../../config/environment');var jayson=require(_0x3418('0x8'));var client=jayson[_0x3418('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4232b3,_0x4821a8,_0x2ff8ee){return new BPromise(function(_0x4e34b4,_0x4e6a80){return client[_0x3418('0xa')](_0x4232b3,_0x2ff8ee)[_0x3418('0xb')](function(_0x1df61a){logger[_0x3418('0xc')](_0x3418('0xd'),_0x4821a8,_0x3418('0xe'));logger[_0x3418('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4821a8,'request\x20sent',JSON[_0x3418('0x10')](_0x1df61a));if(_0x1df61a[_0x3418('0x11')]){if(_0x1df61a[_0x3418('0x11')]['code']===0x1f4){logger[_0x3418('0x11')](_0x3418('0xd'),_0x4821a8,_0x1df61a[_0x3418('0x11')][_0x3418('0x12')]);return _0x4e6a80(_0x1df61a['error'][_0x3418('0x12')]);}logger[_0x3418('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4821a8,_0x1df61a['error'][_0x3418('0x12')]);return _0x4e34b4(_0x1df61a[_0x3418('0x11')]['message']);}else{logger[_0x3418('0xc')](_0x3418('0xd'),_0x4821a8,_0x3418('0xe'));_0x4e34b4(_0x1df61a['result']['message']);}})['catch'](function(_0x85c439){logger[_0x3418('0x11')](_0x3418('0xd'),_0x4821a8,_0x85c439);_0x4e6a80(_0x85c439);});});} \ No newline at end of file +var _0x7083=['UserWhatsappQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7083,0x137));var _0x3708=function(_0x42c94f,_0x17bb1d){_0x42c94f=_0x42c94f-0x0;var _0x30da79=_0x7083[_0x42c94f];return _0x30da79;};'use strict';var _=require(_0x3708('0x0'));var util=require(_0x3708('0x1'));var moment=require(_0x3708('0x2'));var BPromise=require(_0x3708('0x3'));var rs=require(_0x3708('0x4'));var fs=require('fs');var Redis=require(_0x3708('0x5'));var db=require(_0x3708('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3708('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3708('0x8')][_0x3708('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a01af,_0x310406,_0xcd83e1){return new BPromise(function(_0x3fd321,_0x524626){return client[_0x3708('0xa')](_0x3a01af,_0xcd83e1)[_0x3708('0xb')](function(_0x1f15bf){logger[_0x3708('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x310406,_0x3708('0xd'));logger['debug'](_0x3708('0xe'),_0x310406,_0x3708('0xd'),JSON[_0x3708('0xf')](_0x1f15bf));if(_0x1f15bf['error']){if(_0x1f15bf[_0x3708('0x10')][_0x3708('0x11')]===0x1f4){logger[_0x3708('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x310406,_0x1f15bf['error'][_0x3708('0x12')]);return _0x524626(_0x1f15bf['error']['message']);}logger[_0x3708('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x310406,_0x1f15bf['error']['message']);return _0x3fd321(_0x1f15bf[_0x3708('0x10')][_0x3708('0x12')]);}else{logger[_0x3708('0xc')](_0x3708('0x13'),_0x310406,_0x3708('0xd'));_0x3fd321(_0x1f15bf[_0x3708('0x14')][_0x3708('0x12')]);}})[_0x3708('0x15')](function(_0x73b7bd){logger[_0x3708('0x10')](_0x3708('0x13'),_0x310406,_0x73b7bd);_0x524626(_0x73b7bd);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 309bfa7..135d6e1 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 _0xad53=['post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show'];(function(_0x236b13,_0xd848df){var _0x4def23=function(_0x804f56){while(--_0x804f56){_0x236b13['push'](_0x236b13['shift']());}};_0x4def23(++_0xd848df);}(_0xad53,0x1ea));var _0x3ad5=function(_0x413906,_0x3c7066){_0x413906=_0x413906-0x0;var _0x19d510=_0xad53[_0x413906];return _0x19d510;};'use strict';var multer=require(_0x3ad5('0x0'));var util=require(_0x3ad5('0x1'));var path=require(_0x3ad5('0x2'));var timeout=require(_0x3ad5('0x3'));var express=require(_0x3ad5('0x4'));var router=express[_0x3ad5('0x5')]();var fs_extra=require(_0x3ad5('0x6'));var auth=require(_0x3ad5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3ad5('0x8'));var controller=require(_0x3ad5('0x9'));router[_0x3ad5('0xa')]('/',auth[_0x3ad5('0xb')](),controller[_0x3ad5('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3ad5('0xd')]);router[_0x3ad5('0xe')]('/',auth[_0x3ad5('0xb')](),controller[_0x3ad5('0xf')]);router[_0x3ad5('0x10')](_0x3ad5('0x11'),auth[_0x3ad5('0xb')](),controller[_0x3ad5('0x12')]);router['delete'](_0x3ad5('0x11'),auth[_0x3ad5('0xb')](),controller[_0x3ad5('0x13')]);module[_0x3ad5('0x14')]=router; \ No newline at end of file +var _0xba47=['Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','index','get','/:id','isAuthenticated','show','post','create','delete','destroy','multer','util','path','express'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xba47,0x1ac));var _0x7ba4=function(_0x1c11bc,_0x17a00e){_0x1c11bc=_0x1c11bc-0x0;var _0x14efd2=_0xba47[_0x1c11bc];return _0x14efd2;};'use strict';var multer=require(_0x7ba4('0x0'));var util=require(_0x7ba4('0x1'));var path=require(_0x7ba4('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ba4('0x3'));var router=express[_0x7ba4('0x4')]();var fs_extra=require(_0x7ba4('0x5'));var auth=require(_0x7ba4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7ba4('0x7'));var controller=require(_0x7ba4('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7ba4('0x9')]);router[_0x7ba4('0xa')](_0x7ba4('0xb'),auth[_0x7ba4('0xc')](),controller[_0x7ba4('0xd')]);router[_0x7ba4('0xe')]('/',auth[_0x7ba4('0xc')](),controller[_0x7ba4('0xf')]);router['put']('/:id',auth[_0x7ba4('0xc')](),controller['update']);router[_0x7ba4('0x10')](_0x7ba4('0xb'),auth[_0x7ba4('0xc')](),controller[_0x7ba4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 37f879b..6b8eaaf 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 _0x1500=['STRING','exports'];(function(_0x145f74,_0x346ce8){var _0x13ec90=function(_0x3bbd81){while(--_0x3bbd81){_0x145f74['push'](_0x145f74['shift']());}};_0x13ec90(++_0x346ce8);}(_0x1500,0x191));var _0x0150=function(_0x57a949,_0x8844d9){_0x57a949=_0x57a949-0x0;var _0x2c4d35=_0x1500[_0x57a949];return _0x2c4d35;};'use strict';var Sequelize=require('sequelize');module[_0x0150('0x0')]={'name':{'type':Sequelize[_0x0150('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0150('0x1')]}}; \ No newline at end of file +var _0xa175=['name','exports','STRING'];(function(_0x136fa5,_0x47747c){var _0x328d2f=function(_0x137792){while(--_0x137792){_0x136fa5['push'](_0x136fa5['shift']());}};_0x328d2f(++_0x47747c);}(_0xa175,0x15d));var _0x5a17=function(_0x29c585,_0x8bf08c){_0x29c585=_0x29c585-0x0;var _0x2e9516=_0xa175[_0x29c585];return _0x2e9516;};'use strict';var Sequelize=require('sequelize');module[_0x5a17('0x0')]={'name':{'type':Sequelize[_0x5a17('0x1')],'unique':_0x5a17('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5a17('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 25326e4..212744a 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 _0xb20a=['send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','Variable','includeAll','findAll','rows','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','update','destroy','then','Variables','error','stack','name'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb20a,0x1ce));var _0xab20=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb20a[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab20('0x0'));var zipdir=require(_0xab20('0x1'));var jsonpatch=require(_0xab20('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab20('0x3'));var util=require(_0xab20('0x4'));var path=require(_0xab20('0x5'));var sox=require(_0xab20('0x6'));var csv=require(_0xab20('0x7'));var ejs=require(_0xab20('0x8'));var fs=require('fs');var fs_extra=require(_0xab20('0x9'));var _=require('lodash');var squel=require(_0xab20('0xa'));var crypto=require(_0xab20('0xb'));var jsforce=require(_0xab20('0xc'));var deskjs=require(_0xab20('0xd'));var toCsv=require(_0xab20('0x7'));var querystring=require(_0xab20('0xe'));var Papa=require(_0xab20('0xf'));var Redis=require(_0xab20('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab20('0x11'));var hardwareService=require(_0xab20('0x12'));var logger=require(_0xab20('0x13'))('api');var utils=require(_0xab20('0x14'));var config=require(_0xab20('0x15'));var licenseUtil=require(_0xab20('0x16'));var db=require(_0xab20('0x17'))['db'];function respondWithStatusCode(_0x32d1cf,_0x479b47){_0x479b47=_0x479b47||0xcc;return function(_0x570252){if(_0x570252){return _0x32d1cf[_0xab20('0x18')](_0x479b47);}return _0x32d1cf['status'](_0x479b47)[_0xab20('0x19')]();};}function respondWithResult(_0x10aced,_0x2af82e){_0x2af82e=_0x2af82e||0xc8;return function(_0x31ccdb){if(_0x31ccdb){return _0x10aced[_0xab20('0x1a')](_0x2af82e)[_0xab20('0x1b')](_0x31ccdb);}};}function respondWithFilteredResult(_0x54a391,_0x3c5cd5){return function(_0x3007b3){if(_0x3007b3){var _0x4f7ddb=typeof _0x3c5cd5[_0xab20('0x1c')]==='undefined'&&typeof _0x3c5cd5[_0xab20('0x1d')]===_0xab20('0x1e');var _0xb2bd9=_0x3007b3[_0xab20('0x1f')];var _0x4a0617=_0x4f7ddb?0x0:_0x3c5cd5[_0xab20('0x1c')];var _0x847163=_0x4f7ddb?_0x3007b3[_0xab20('0x1f')]:_0x3c5cd5[_0xab20('0x1c')]+_0x3c5cd5[_0xab20('0x1d')];var _0x1867fb;if(_0x847163>=_0xb2bd9){_0x847163=_0xb2bd9;_0x1867fb=0xc8;}else{_0x1867fb=0xce;}_0x54a391[_0xab20('0x1a')](_0x1867fb);return _0x54a391[_0xab20('0x20')]('Content-Range',_0x4a0617+'-'+_0x847163+'/'+_0xb2bd9)[_0xab20('0x1b')](_0x3007b3);}return null;};}function patchUpdates(_0x5e1428){return function(_0x31331b){try{jsonpatch[_0xab20('0x21')](_0x31331b,_0x5e1428,!![]);}catch(_0x3876a7){return BPromise[_0xab20('0x22')](_0x3876a7);}return _0x31331b['save']();};}function saveUpdates(_0x47f05d,_0x366a59){return function(_0x7390ce){if(_0x7390ce){return _0x7390ce[_0xab20('0x23')](_0x47f05d)['then'](function(_0x297c86){return _0x297c86;});}return null;};}function removeEntity(_0x2c51af,_0x57562e){return function(_0x25eade){if(_0x25eade){return _0x25eade[_0xab20('0x24')]()[_0xab20('0x25')](function(){var _0x437068=_0x25eade['get']({'plain':!![]});var _0x40c3d5=_0xab20('0x26');return db['UserProfileResource'][_0xab20('0x24')]({'where':{'type':_0x40c3d5,'resourceId':_0x437068['id']}})[_0xab20('0x25')](function(){return _0x25eade;});})[_0xab20('0x25')](function(){_0x2c51af[_0xab20('0x1a')](0xcc)[_0xab20('0x19')]();});}};}function handleEntityNotFound(_0x5dcc6b,_0x4ec7e3){return function(_0x4af5a1){if(!_0x4af5a1){_0x5dcc6b[_0xab20('0x18')](0x194);}return _0x4af5a1;};}function handleError(_0x5de401,_0x449767){_0x449767=_0x449767||0x1f4;return function(_0x1d9cf0){logger[_0xab20('0x27')](_0x1d9cf0[_0xab20('0x28')]);if(_0x1d9cf0['name']){delete _0x1d9cf0[_0xab20('0x29')];}_0x5de401['status'](_0x449767)[_0xab20('0x2a')](_0x1d9cf0);};}exports[_0xab20('0x2b')]=function(_0x2739b5,_0x558f99){var _0x27eee8={},_0x5eb961={},_0x4147df={'count':0x0,'rows':[]};var _0x453db3=_[_0xab20('0x2c')](db['Variable']['rawAttributes'],function(_0x236ec1){return{'name':_0x236ec1[_0xab20('0x2d')],'type':_0x236ec1[_0xab20('0x2e')][_0xab20('0x2f')]};});_0x5eb961[_0xab20('0x30')]=_['map'](_0x453db3,'name');_0x5eb961[_0xab20('0x31')]=_[_0xab20('0x32')](_0x2739b5[_0xab20('0x31')]);_0x5eb961[_0xab20('0x33')]=_[_0xab20('0x34')](_0x5eb961[_0xab20('0x30')],_0x5eb961[_0xab20('0x31')]);_0x27eee8[_0xab20('0x35')]=_[_0xab20('0x34')](_0x5eb961[_0xab20('0x30')],qs['fields'](_0x2739b5['query'][_0xab20('0x36')]));_0x27eee8[_0xab20('0x35')]=_0x27eee8['attributes'][_0xab20('0x37')]?_0x27eee8[_0xab20('0x35')]:_0x5eb961['model'];if(!_0x2739b5[_0xab20('0x31')][_0xab20('0x38')](_0xab20('0x39'))){_0x27eee8['limit']=qs[_0xab20('0x1d')](_0x2739b5[_0xab20('0x31')]['limit']);_0x27eee8[_0xab20('0x1c')]=qs[_0xab20('0x1c')](_0x2739b5[_0xab20('0x31')]['offset']);}_0x27eee8[_0xab20('0x3a')]=qs[_0xab20('0x3b')](_0x2739b5['query'][_0xab20('0x3b')]);_0x27eee8['where']=qs[_0xab20('0x33')](_['pick'](_0x2739b5['query'],_0x5eb961[_0xab20('0x33')]),_0x453db3);if(_0x2739b5[_0xab20('0x31')][_0xab20('0x3c')]){_0x27eee8[_0xab20('0x3d')]=_[_0xab20('0x3e')](_0x27eee8[_0xab20('0x3d')],{'$or':_[_0xab20('0x2c')](_0x453db3,function(_0x18c47b){if(_0x18c47b[_0xab20('0x2e')]!==_0xab20('0x3f')){var _0x3ad4a6={};_0x3ad4a6[_0x18c47b['name']]={'$like':'%'+_0x2739b5[_0xab20('0x31')]['filter']+'%'};return _0x3ad4a6;}})});}_0x27eee8=_[_0xab20('0x3e')]({},_0x27eee8,_0x2739b5[_0xab20('0x40')]);var _0x1276d8={'where':_0x27eee8[_0xab20('0x3d')]};return db[_0xab20('0x41')]['count'](_0x1276d8)['then'](function(_0x1359dc){_0x4147df[_0xab20('0x1f')]=_0x1359dc;if(_0x2739b5[_0xab20('0x31')][_0xab20('0x42')]){_0x27eee8['include']=[{'all':!![]}];}return db[_0xab20('0x41')][_0xab20('0x43')](_0x27eee8);})[_0xab20('0x25')](function(_0xf78fa0){_0x4147df[_0xab20('0x44')]=_0xf78fa0;return _0x4147df;})[_0xab20('0x25')](respondWithFilteredResult(_0x558f99,_0x27eee8))['catch'](handleError(_0x558f99,null));};exports[_0xab20('0x45')]=function(_0x4a9547,_0x535cec){var _0x3ad564={'raw':!![],'where':{'id':_0x4a9547[_0xab20('0x46')]['id']}},_0xbb8c4a={};_0xbb8c4a['model']=_[_0xab20('0x32')](db[_0xab20('0x41')][_0xab20('0x47')]);_0xbb8c4a[_0xab20('0x31')]=_[_0xab20('0x32')](_0x4a9547[_0xab20('0x31')]);_0xbb8c4a[_0xab20('0x33')]=_[_0xab20('0x34')](_0xbb8c4a[_0xab20('0x30')],_0xbb8c4a[_0xab20('0x31')]);_0x3ad564[_0xab20('0x35')]=_['intersection'](_0xbb8c4a['model'],qs[_0xab20('0x36')](_0x4a9547['query'][_0xab20('0x36')]));_0x3ad564['attributes']=_0x3ad564[_0xab20('0x35')][_0xab20('0x37')]?_0x3ad564[_0xab20('0x35')]:_0xbb8c4a[_0xab20('0x30')];if(_0x4a9547['query'][_0xab20('0x42')]){_0x3ad564['include']=[{'all':!![]}];}_0x3ad564=_[_0xab20('0x3e')]({},_0x3ad564,_0x4a9547[_0xab20('0x40')]);return db[_0xab20('0x41')]['find'](_0x3ad564)[_0xab20('0x25')](handleEntityNotFound(_0x535cec,null))['then'](respondWithResult(_0x535cec,null))['catch'](handleError(_0x535cec,null));};exports[_0xab20('0x48')]=function(_0x4915ee,_0x4cd62c){return db[_0xab20('0x41')][_0xab20('0x48')](_0x4915ee[_0xab20('0x49')],{})[_0xab20('0x25')](function(_0x3cfbd2){var _0x5d0736=_0x4915ee[_0xab20('0x4a')][_0xab20('0x4b')]({'plain':!![]});if(!_0x5d0736)throw new Error(_0xab20('0x4c'));if(_0x5d0736[_0xab20('0x4d')]===_0xab20('0x4a')){var _0x334c34=_0x3cfbd2[_0xab20('0x4b')]({'plain':!![]});var _0x1ec4f1='Variables';return db[_0xab20('0x4e')][_0xab20('0x4f')]({'where':{'name':_0x1ec4f1,'userProfileId':_0x5d0736['userProfileId']},'raw':!![]})[_0xab20('0x25')](function(_0x30aa5b){if(_0x30aa5b&&_0x30aa5b[_0xab20('0x50')]===0x0){return db[_0xab20('0x51')][_0xab20('0x48')]({'name':_0x334c34['name'],'resourceId':_0x334c34['id'],'type':_0x30aa5b[_0xab20('0x29')],'sectionId':_0x30aa5b['id']},{})[_0xab20('0x25')](function(){return _0x3cfbd2;});}else{return _0x3cfbd2;}})['catch'](function(_0x51db99){logger['error'](_0xab20('0x52'),_0x51db99);throw _0x51db99;});}return _0x3cfbd2;})[_0xab20('0x25')](respondWithResult(_0x4cd62c,0xc9))['catch'](handleError(_0x4cd62c,null));};exports['update']=function(_0x442f29,_0x2d8842){if(_0x442f29[_0xab20('0x49')]['id']){delete _0x442f29[_0xab20('0x49')]['id'];}return db['Variable'][_0xab20('0x4f')]({'where':{'id':_0x442f29[_0xab20('0x46')]['id']}})[_0xab20('0x25')](handleEntityNotFound(_0x2d8842,null))[_0xab20('0x25')](saveUpdates(_0x442f29['body'],null))[_0xab20('0x25')](respondWithResult(_0x2d8842,null))[_0xab20('0x53')](handleError(_0x2d8842,null));};exports['destroy']=function(_0x1835ca,_0x58aaf1){return db[_0xab20('0x41')][_0xab20('0x4f')]({'where':{'id':_0x1835ca[_0xab20('0x46')]['id']}})[_0xab20('0x25')](handleEntityNotFound(_0x58aaf1,null))[_0xab20('0x25')](removeEntity(_0x58aaf1,null))[_0xab20('0x53')](handleError(_0x58aaf1,null));}; \ No newline at end of file +var _0x2a34=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','Variables','UserProfileResource','then','error','stack','name','send','index','map','Variable','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x5265d5,_0x51a837){var _0x44899d=function(_0x13d39b){while(--_0x13d39b){_0x5265d5['push'](_0x5265d5['shift']());}};_0x44899d(++_0x51a837);}(_0x2a34,0x1e5));var _0x42a3=function(_0x2b5251,_0x4273c5){_0x2b5251=_0x2b5251-0x0;var _0x5050f0=_0x2a34[_0x2b5251];return _0x5050f0;};'use strict';var emlformat=require(_0x42a3('0x0'));var rimraf=require(_0x42a3('0x1'));var zipdir=require(_0x42a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x42a3('0x3'));var BPromise=require(_0x42a3('0x4'));var Mustache=require('mustache');var util=require(_0x42a3('0x5'));var path=require('path');var sox=require(_0x42a3('0x6'));var csv=require(_0x42a3('0x7'));var ejs=require(_0x42a3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42a3('0x9'));var squel=require('squel');var crypto=require(_0x42a3('0xa'));var jsforce=require(_0x42a3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x42a3('0xc'));var Papa=require(_0x42a3('0xd'));var Redis=require(_0x42a3('0xe'));var authService=require(_0x42a3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x42a3('0x10'));var hardwareService=require(_0x42a3('0x11'));var logger=require(_0x42a3('0x12'))('api');var utils=require(_0x42a3('0x13'));var config=require(_0x42a3('0x14'));var licenseUtil=require(_0x42a3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ae118,_0x42fd73){_0x42fd73=_0x42fd73||0xcc;return function(_0x1e43de){if(_0x1e43de){return _0x1ae118['sendStatus'](_0x42fd73);}return _0x1ae118['status'](_0x42fd73)[_0x42a3('0x16')]();};}function respondWithResult(_0x12e483,_0x26f236){_0x26f236=_0x26f236||0xc8;return function(_0x2daa2a){if(_0x2daa2a){return _0x12e483[_0x42a3('0x17')](_0x26f236)['json'](_0x2daa2a);}};}function respondWithFilteredResult(_0x2ddda3,_0x45f677){return function(_0x1460cf){if(_0x1460cf){var _0x487eef=typeof _0x45f677[_0x42a3('0x18')]===_0x42a3('0x19')&&typeof _0x45f677[_0x42a3('0x1a')]==='undefined';var _0x556d19=_0x1460cf[_0x42a3('0x1b')];var _0x107ccb=_0x487eef?0x0:_0x45f677[_0x42a3('0x18')];var _0x5a0718=_0x487eef?_0x1460cf['count']:_0x45f677[_0x42a3('0x18')]+_0x45f677[_0x42a3('0x1a')];var _0x5e58cb;if(_0x5a0718>=_0x556d19){_0x5a0718=_0x556d19;_0x5e58cb=0xc8;}else{_0x5e58cb=0xce;}_0x2ddda3[_0x42a3('0x17')](_0x5e58cb);return _0x2ddda3[_0x42a3('0x1c')](_0x42a3('0x1d'),_0x107ccb+'-'+_0x5a0718+'/'+_0x556d19)['json'](_0x1460cf);}return null;};}function patchUpdates(_0x25aed1){return function(_0x4a7a1a){try{jsonpatch[_0x42a3('0x1e')](_0x4a7a1a,_0x25aed1,!![]);}catch(_0x5761f2){return BPromise['reject'](_0x5761f2);}return _0x4a7a1a['save']();};}function saveUpdates(_0x918d79,_0xc5362d){return function(_0x1a0b00){if(_0x1a0b00){return _0x1a0b00[_0x42a3('0x1f')](_0x918d79)['then'](function(_0x12274b){return _0x12274b;});}return null;};}function removeEntity(_0x1867b1,_0x177ef7){return function(_0x53fa93){if(_0x53fa93){return _0x53fa93[_0x42a3('0x20')]()['then'](function(){var _0x21d796=_0x53fa93[_0x42a3('0x21')]({'plain':!![]});var _0x188fd0=_0x42a3('0x22');return db[_0x42a3('0x23')][_0x42a3('0x20')]({'where':{'type':_0x188fd0,'resourceId':_0x21d796['id']}})[_0x42a3('0x24')](function(){return _0x53fa93;});})['then'](function(){_0x1867b1[_0x42a3('0x17')](0xcc)[_0x42a3('0x16')]();});}};}function handleEntityNotFound(_0x17e6bd,_0x35e7cf){return function(_0xb524e8){if(!_0xb524e8){_0x17e6bd['sendStatus'](0x194);}return _0xb524e8;};}function handleError(_0x5c5335,_0x2f77b1){_0x2f77b1=_0x2f77b1||0x1f4;return function(_0x4bec11){logger[_0x42a3('0x25')](_0x4bec11[_0x42a3('0x26')]);if(_0x4bec11[_0x42a3('0x27')]){delete _0x4bec11[_0x42a3('0x27')];}_0x5c5335[_0x42a3('0x17')](_0x2f77b1)[_0x42a3('0x28')](_0x4bec11);};}exports[_0x42a3('0x29')]=function(_0x2e34b5,_0x21d918){var _0x10356b={},_0x3d53a2={},_0xa1d60c={'count':0x0,'rows':[]};var _0x5b39db=_[_0x42a3('0x2a')](db[_0x42a3('0x2b')]['rawAttributes'],function(_0x58188f){return{'name':_0x58188f[_0x42a3('0x2c')],'type':_0x58188f[_0x42a3('0x2d')][_0x42a3('0x2e')]};});_0x3d53a2[_0x42a3('0x2f')]=_[_0x42a3('0x2a')](_0x5b39db,_0x42a3('0x27'));_0x3d53a2[_0x42a3('0x30')]=_[_0x42a3('0x31')](_0x2e34b5['query']);_0x3d53a2[_0x42a3('0x32')]=_['intersection'](_0x3d53a2['model'],_0x3d53a2[_0x42a3('0x30')]);_0x10356b[_0x42a3('0x33')]=_[_0x42a3('0x34')](_0x3d53a2[_0x42a3('0x2f')],qs[_0x42a3('0x35')](_0x2e34b5[_0x42a3('0x30')][_0x42a3('0x35')]));_0x10356b[_0x42a3('0x33')]=_0x10356b[_0x42a3('0x33')][_0x42a3('0x36')]?_0x10356b[_0x42a3('0x33')]:_0x3d53a2[_0x42a3('0x2f')];if(!_0x2e34b5['query'][_0x42a3('0x37')]('nolimit')){_0x10356b[_0x42a3('0x1a')]=qs[_0x42a3('0x1a')](_0x2e34b5[_0x42a3('0x30')][_0x42a3('0x1a')]);_0x10356b['offset']=qs['offset'](_0x2e34b5[_0x42a3('0x30')][_0x42a3('0x18')]);}_0x10356b['order']=qs[_0x42a3('0x38')](_0x2e34b5[_0x42a3('0x30')][_0x42a3('0x38')]);_0x10356b[_0x42a3('0x39')]=qs[_0x42a3('0x32')](_[_0x42a3('0x3a')](_0x2e34b5['query'],_0x3d53a2['filters']),_0x5b39db);if(_0x2e34b5[_0x42a3('0x30')][_0x42a3('0x3b')]){_0x10356b[_0x42a3('0x39')]=_['merge'](_0x10356b['where'],{'$or':_[_0x42a3('0x2a')](_0x5b39db,function(_0x30267a){if(_0x30267a['type']!==_0x42a3('0x3c')){var _0x2210b7={};_0x2210b7[_0x30267a['name']]={'$like':'%'+_0x2e34b5[_0x42a3('0x30')][_0x42a3('0x3b')]+'%'};return _0x2210b7;}})});}_0x10356b=_[_0x42a3('0x3d')]({},_0x10356b,_0x2e34b5['options']);var _0x24575a={'where':_0x10356b[_0x42a3('0x39')]};return db[_0x42a3('0x2b')][_0x42a3('0x1b')](_0x24575a)[_0x42a3('0x24')](function(_0x1fa495){_0xa1d60c['count']=_0x1fa495;if(_0x2e34b5[_0x42a3('0x30')][_0x42a3('0x3e')]){_0x10356b[_0x42a3('0x3f')]=[{'all':!![]}];}return db[_0x42a3('0x2b')][_0x42a3('0x40')](_0x10356b);})['then'](function(_0x1c7b80){_0xa1d60c[_0x42a3('0x41')]=_0x1c7b80;return _0xa1d60c;})[_0x42a3('0x24')](respondWithFilteredResult(_0x21d918,_0x10356b))[_0x42a3('0x42')](handleError(_0x21d918,null));};exports[_0x42a3('0x43')]=function(_0x44dbc4,_0x170ded){var _0x21fe09={'raw':!![],'where':{'id':_0x44dbc4['params']['id']}},_0x323987={};_0x323987['model']=_[_0x42a3('0x31')](db['Variable']['rawAttributes']);_0x323987[_0x42a3('0x30')]=_[_0x42a3('0x31')](_0x44dbc4[_0x42a3('0x30')]);_0x323987[_0x42a3('0x32')]=_['intersection'](_0x323987[_0x42a3('0x2f')],_0x323987[_0x42a3('0x30')]);_0x21fe09[_0x42a3('0x33')]=_[_0x42a3('0x34')](_0x323987[_0x42a3('0x2f')],qs[_0x42a3('0x35')](_0x44dbc4[_0x42a3('0x30')][_0x42a3('0x35')]));_0x21fe09[_0x42a3('0x33')]=_0x21fe09[_0x42a3('0x33')][_0x42a3('0x36')]?_0x21fe09[_0x42a3('0x33')]:_0x323987[_0x42a3('0x2f')];if(_0x44dbc4[_0x42a3('0x30')][_0x42a3('0x3e')]){_0x21fe09['include']=[{'all':!![]}];}_0x21fe09=_['merge']({},_0x21fe09,_0x44dbc4[_0x42a3('0x44')]);return db['Variable'][_0x42a3('0x45')](_0x21fe09)['then'](handleEntityNotFound(_0x170ded,null))[_0x42a3('0x24')](respondWithResult(_0x170ded,null))[_0x42a3('0x42')](handleError(_0x170ded,null));};exports[_0x42a3('0x46')]=function(_0x4ff084,_0x3a5159){return db[_0x42a3('0x2b')]['create'](_0x4ff084[_0x42a3('0x47')],{})['then'](function(_0x1ea663){var _0x2f75ac=_0x4ff084[_0x42a3('0x48')][_0x42a3('0x21')]({'plain':!![]});if(!_0x2f75ac)throw new Error(_0x42a3('0x49'));if(_0x2f75ac[_0x42a3('0x4a')]===_0x42a3('0x48')){var _0x213d1e=_0x1ea663[_0x42a3('0x21')]({'plain':!![]});var _0x3b72c7='Variables';return db[_0x42a3('0x4b')][_0x42a3('0x45')]({'where':{'name':_0x3b72c7,'userProfileId':_0x2f75ac[_0x42a3('0x4c')]},'raw':!![]})['then'](function(_0x44f942){if(_0x44f942&&_0x44f942[_0x42a3('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x213d1e['name'],'resourceId':_0x213d1e['id'],'type':_0x44f942[_0x42a3('0x27')],'sectionId':_0x44f942['id']},{})[_0x42a3('0x24')](function(){return _0x1ea663;});}else{return _0x1ea663;}})[_0x42a3('0x42')](function(_0x18a9dd){logger[_0x42a3('0x25')](_0x42a3('0x4e'),_0x18a9dd);throw _0x18a9dd;});}return _0x1ea663;})[_0x42a3('0x24')](respondWithResult(_0x3a5159,0xc9))[_0x42a3('0x42')](handleError(_0x3a5159,null));};exports['update']=function(_0x5b28b8,_0x15df7a){if(_0x5b28b8[_0x42a3('0x47')]['id']){delete _0x5b28b8[_0x42a3('0x47')]['id'];}return db[_0x42a3('0x2b')][_0x42a3('0x45')]({'where':{'id':_0x5b28b8[_0x42a3('0x4f')]['id']}})[_0x42a3('0x24')](handleEntityNotFound(_0x15df7a,null))[_0x42a3('0x24')](saveUpdates(_0x5b28b8['body'],null))[_0x42a3('0x24')](respondWithResult(_0x15df7a,null))[_0x42a3('0x42')](handleError(_0x15df7a,null));};exports['destroy']=function(_0x26ecdc,_0x21b134){return db[_0x42a3('0x2b')][_0x42a3('0x45')]({'where':{'id':_0x26ecdc[_0x42a3('0x4f')]['id']}})[_0x42a3('0x24')](handleEntityNotFound(_0x21b134,null))[_0x42a3('0x24')](removeEntity(_0x21b134,null))[_0x42a3('0x42')](handleError(_0x21b134,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 4f84c36..f13d6c6 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 _0x527d=['exports','define','tools_variables','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./variable.attributes'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x527d,0x93));var _0xd527=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x527d[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0xd527('0x0'));var util=require(_0xd527('0x1'));var logger=require(_0xd527('0x2'))('api');var moment=require(_0xd527('0x3'));var BPromise=require(_0xd527('0x4'));var rp=require(_0xd527('0x5'));var fs=require('fs');var path=require(_0xd527('0x6'));var rimraf=require(_0xd527('0x7'));var config=require('../../config/environment');var attributes=require(_0xd527('0x8'));module[_0xd527('0x9')]=function(_0xa034cc,_0x166529){return _0xa034cc[_0xd527('0xa')]('Variable',attributes,{'tableName':_0xd527('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x034a=['path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment'];(function(_0xbe679a,_0x2375a4){var _0x1a28d1=function(_0x5e1aba){while(--_0x5e1aba){_0xbe679a['push'](_0xbe679a['shift']());}};_0x1a28d1(++_0x2375a4);}(_0x034a,0x1e9));var _0xa034=function(_0x3317f5,_0x563f5d){_0x3317f5=_0x3317f5-0x0;var _0x57451a=_0x034a[_0x3317f5];return _0x57451a;};'use strict';var _=require(_0xa034('0x0'));var util=require(_0xa034('0x1'));var logger=require(_0xa034('0x2'))(_0xa034('0x3'));var moment=require(_0xa034('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa034('0x5'));var rimraf=require(_0xa034('0x6'));var config=require(_0xa034('0x7'));var attributes=require(_0xa034('0x8'));module[_0xa034('0x9')]=function(_0x53ddcb,_0x4c15a1){return _0x53ddcb[_0xa034('0xa')](_0xa034('0xb'),attributes,{'tableName':_0xa034('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index ee7adde..fd0dad5 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 _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x2eb67e,_0x3a85be){var _0x1cee38=function(_0x355d06){while(--_0x355d06){_0x2eb67e['push'](_0x2eb67e['shift']());}};_0x1cee38(++_0x3a85be);}(_0x7217,0x19e));var _0x7721=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7217[_0x21aec3];return _0x288bbc;};'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')]('Variable,\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']('Variable,\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);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0x5fc3,0xa8));var _0x35fc=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0x5fc3[_0x529f1c];return _0x4d57ab;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index dc8240e..c178488 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 _0x02ea=['../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','fetch','isAuthenticated','pull','/restart','restart','/migrations','migrations','exports','express'];(function(_0x167538,_0x5216ff){var _0x53b517=function(_0x3913ce){while(--_0x3913ce){_0x167538['push'](_0x167538['shift']());}};_0x53b517(++_0x5216ff);}(_0x02ea,0xd1));var _0xa02e=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x02ea[_0x4350c2];return _0x8b6406;};'use strict';var express=require(_0xa02e('0x0'));var router=express['Router']();var auth=require(_0xa02e('0x1'));var controller=require(_0xa02e('0x2'));router[_0xa02e('0x3')]('/',controller[_0xa02e('0x4')]);router[_0xa02e('0x3')](_0xa02e('0x5'),auth['isAuthenticated'](),auth[_0xa02e('0x6')](),controller[_0xa02e('0x7')]);router[_0xa02e('0x3')]('/reset',auth[_0xa02e('0x8')](),auth[_0xa02e('0x6')](),controller['reset']);router['get']('/pull',auth[_0xa02e('0x8')](),auth['canUpdate'](),controller[_0xa02e('0x9')]);router[_0xa02e('0x3')](_0xa02e('0xa'),auth['isAuthenticated'](),controller[_0xa02e('0xb')]);router['get'](_0xa02e('0xc'),controller[_0xa02e('0xd')]);module[_0xa02e('0xe')]=router; \ No newline at end of file +var _0x16bb=['/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','isAuthenticated','fetch','/reset','canUpdate','/pull','/restart','restart'];(function(_0x326b40,_0x48522e){var _0x2f73e1=function(_0x3ca988){while(--_0x3ca988){_0x326b40['push'](_0x326b40['shift']());}};_0x2f73e1(++_0x48522e);}(_0x16bb,0x133));var _0xb16b=function(_0x19a383,_0x4d9250){_0x19a383=_0x19a383-0x0;var _0x326f2d=_0x16bb[_0x19a383];return _0x326f2d;};'use strict';var express=require(_0xb16b('0x0'));var router=express[_0xb16b('0x1')]();var auth=require(_0xb16b('0x2'));var controller=require(_0xb16b('0x3'));router[_0xb16b('0x4')]('/',controller[_0xb16b('0x5')]);router[_0xb16b('0x4')]('/fetch',auth[_0xb16b('0x6')](),auth['canUpdate'](),controller[_0xb16b('0x7')]);router[_0xb16b('0x4')](_0xb16b('0x8'),auth[_0xb16b('0x6')](),auth[_0xb16b('0x9')](),controller['reset']);router['get'](_0xb16b('0xa'),auth[_0xb16b('0x6')](),auth[_0xb16b('0x9')](),controller['pull']);router[_0xb16b('0x4')](_0xb16b('0xb'),auth[_0xb16b('0x6')](),controller[_0xb16b('0xc')]);router['get'](_0xb16b('0xd'),controller[_0xb16b('0xe')]);module[_0xb16b('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 3470ec8..07fdcca 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 _0x2289=['error','info','git\x20fetch','status','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','.js','push','sequelize','getQueryInterface','constructor','server','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','exec','../../config/environment','../../config/logger','update','simple-git','root','exports','query','tags','latest','json','fetch','origin','master'];(function(_0x4b36c9,_0xa03a46){var _0x53fd89=function(_0x4c35f4){while(--_0x4c35f4){_0x4b36c9['push'](_0x4b36c9['shift']());}};_0x53fd89(++_0xa03a46);}(_0x2289,0x165));var _0x9228=function(_0x1dda39,_0x221826){_0x1dda39=_0x1dda39-0x0;var _0x269408=_0x2289[_0x1dda39];return _0x269408;};'use strict';var Umzug=require(_0x9228('0x0'));var path=require(_0x9228('0x1'));var fs=require('fs');var _=require(_0x9228('0x2'));var pkginfo=require(_0x9228('0x3'))(module,_0x9228('0x4'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0x9228('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x9228('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x9228('0x7'))(_0x9228('0x8'));var git=require(_0x9228('0x9'))(config[_0x9228('0xa')]);exports['index']=function(_0xd25aed,_0x16e187){var _0x1c2671={'current':module[_0x9228('0xb')][_0x9228('0x4')],'phonebar':0x2};if(_0xd25aed[_0x9228('0xc')]&&_0xd25aed[_0x9228('0xc')]['latest']){return git['fetch']()[_0x9228('0xd')](function(_0x4e5a76,_0xb7a30a){_0x1c2671['latest']=(_0x4e5a76?module[_0x9228('0xb')][_0x9228('0x4')]:_0xb7a30a[_0x9228('0xe')])||'2.0.0';return _0x16e187['status'](0xc8)[_0x9228('0xf')](_0x1c2671);});}else{return _0x16e187['status'](0xc8)[_0x9228('0xf')](_0x1c2671);}};exports[_0x9228('0x10')]=function(_0x660199,_0x265ff4){return git[_0x9228('0x10')]([_0x9228('0x11'),_0x9228('0x12')],function(_0x385bb6){if(_0x385bb6){logger[_0x9228('0x13')](_0x385bb6);return _0x265ff4['status'](0x1f4)[_0x9228('0xf')](_0x385bb6);}logger[_0x9228('0x14')](_0x9228('0x15'));return _0x265ff4[_0x9228('0x16')](0xc8)['json']({'output':_0x9228('0x17')});});};exports['reset']=function(_0x490ff0,_0x35147b){return git['reset']([_0x9228('0x18'),_0x9228('0x19')],function(_0x2dc6db){if(_0x2dc6db){logger['error'](_0x2dc6db);return _0x35147b['status'](0x1f4)[_0x9228('0xf')](_0x2dc6db);}logger['info'](_0x9228('0x1a'));return _0x35147b[_0x9228('0x16')](0xc8)[_0x9228('0xf')]({'output':_0x9228('0x1b')});});};exports[_0x9228('0x1c')]=function(_0x117504,_0x3729a0){exec(_0x9228('0x1d'),function(_0x1efe78,_0x20e26f,_0x5a1a69){logger[_0x9228('0x14')](_0x20e26f);logger[_0x9228('0x14')](_0x5a1a69);if(_0x1efe78){logger['error'](_0x1efe78);return _0x3729a0['status'](0x1f4)[_0x9228('0xf')](_0x1efe78);}return _0x3729a0[_0x9228('0x16')](0xc8)[_0x9228('0xf')]({'output':_0x20e26f});});};exports['restart']=function(_0x349e0a,_0xef1de0){return pm2[_0x9228('0x1e')]('motion2')[_0x9228('0x1f')](function(_0x573ac7){logger[_0x9228('0x14')](_0x9228('0x20'),_0x573ac7);return _0xef1de0['status'](0xc8)[_0x9228('0xf')]({'output':_0x9228('0x21')});})[_0x9228('0x22')](function(_0x5dac47){logger['error'](_0x5dac47);return _0xef1de0[_0x9228('0x16')](0x1f4)['json'](_0x5dac47);});};exports[_0x9228('0x23')]=function(_0x4dff88,_0x3b89fd){var _0x55afe0=fs['readdirSync'](path[_0x9228('0x24')](config[_0x9228('0xa')],'server',_0x9228('0x23')));var _0x5ee96d=[];for(var _0x4a2d58=0x0;_0x4a2d58<_0x55afe0[_0x9228('0x25')];_0x4a2d58++){var _0x33b75c=_0x55afe0[_0x4a2d58][_0x9228('0x26')](_0x9228('0x27'),'');if(compareVersions(module[_0x9228('0xb')][_0x9228('0x4')],_0x33b75c)===-0x1){_0x5ee96d[_0x9228('0x28')](_0x33b75c);}}if(_0x5ee96d[_0x9228('0x25')]){var _0x61aa6b=_0x5ee96d['sort'](compareVersions);var _0x133009=new Umzug({'storage':_0x9228('0x29'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x9228('0x29')][_0x9228('0x2a')](),db[_0x9228('0x29')][_0x9228('0x2b')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x9228('0x24')](config['root'],_0x9228('0x2c'),_0x9228('0x23')),'pattern':/\.js$/}});_0x133009['up']({'migrations':_['map'](_0x61aa6b,function(_0x565f7c){return _0x565f7c+'.js';})})[_0x9228('0x1f')](function(){return _0x3b89fd[_0x9228('0x16')](0xc8)[_0x9228('0xf')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports']['version']+_0x9228('0x2d')+_['last'](_0x61aa6b),'migrations':_[_0x9228('0x24')](_0x61aa6b)});})[_0x9228('0x22')](function(_0x3fb223){if(_0x3fb223 instanceof db['sequelize']['UniqueConstraintError']){return _0x3b89fd[_0x9228('0x16')](0xc8)['json']({'output':_0x9228('0x2e')});}else{return _0x3b89fd[_0x9228('0x16')](0x1f4)[_0x9228('0xf')](_0x3fb223);}});}else{return _0x3b89fd[_0x9228('0x16')](0xc8)[_0x9228('0xf')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x3c5a=['Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../config/environment','../../config/pm2','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','origin','master','error','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s'];(function(_0x4bfc7a,_0x578eac){var _0x24edff=function(_0x5ea63c){while(--_0x5ea63c){_0x4bfc7a['push'](_0x4bfc7a['shift']());}};_0x24edff(++_0x578eac);}(_0x3c5a,0x1a5));var _0xa3c5=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0x3c5a[_0x20ebb5];return _0x487182;};'use strict';var Umzug=require(_0xa3c5('0x0'));var path=require(_0xa3c5('0x1'));var fs=require('fs');var _=require(_0xa3c5('0x2'));var pkginfo=require(_0xa3c5('0x3'))(module,_0xa3c5('0x4'));var compareVersions=require(_0xa3c5('0x5'));var exec=require('child_process')[_0xa3c5('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0xa3c5('0x7'));var pm2=require(_0xa3c5('0x8'));var logger=require('../../config/logger')('update');var git=require(_0xa3c5('0x9'))(config[_0xa3c5('0xa')]);exports[_0xa3c5('0xb')]=function(_0x1188c2,_0x58fddf){var _0x202d00={'current':module[_0xa3c5('0xc')]['version'],'phonebar':0x2};if(_0x1188c2[_0xa3c5('0xd')]&&_0x1188c2['query'][_0xa3c5('0xe')]){return git[_0xa3c5('0xf')]()[_0xa3c5('0x10')](function(_0x327b32,_0x399510){_0x202d00[_0xa3c5('0xe')]=(_0x327b32?module['exports'][_0xa3c5('0x4')]:_0x399510[_0xa3c5('0xe')])||_0xa3c5('0x11');return _0x58fddf[_0xa3c5('0x12')](0xc8)['json'](_0x202d00);});}else{return _0x58fddf['status'](0xc8)['json'](_0x202d00);}};exports[_0xa3c5('0xf')]=function(_0x525b92,_0x29f72d){return git['fetch']([_0xa3c5('0x13'),_0xa3c5('0x14')],function(_0x45d3d1){if(_0x45d3d1){logger[_0xa3c5('0x15')](_0x45d3d1);return _0x29f72d['status'](0x1f4)[_0xa3c5('0x16')](_0x45d3d1);}logger[_0xa3c5('0x17')](_0xa3c5('0x18'));return _0x29f72d['status'](0xc8)['json']({'output':_0xa3c5('0x19')});});};exports[_0xa3c5('0x1a')]=function(_0x3a7c66,_0x393c5b){return git[_0xa3c5('0x1a')]([_0xa3c5('0x1b'),_0xa3c5('0x1c')],function(_0x4d4fec){if(_0x4d4fec){logger[_0xa3c5('0x15')](_0x4d4fec);return _0x393c5b[_0xa3c5('0x12')](0x1f4)[_0xa3c5('0x16')](_0x4d4fec);}logger[_0xa3c5('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x393c5b[_0xa3c5('0x12')](0xc8)['json']({'output':_0xa3c5('0x1d')});});};exports['pull']=function(_0x497af9,_0x263148){exec(_0xa3c5('0x1e'),function(_0x46b5d9,_0x125517,_0x3e8915){logger[_0xa3c5('0x17')](_0x125517);logger[_0xa3c5('0x17')](_0x3e8915);if(_0x46b5d9){logger['error'](_0x46b5d9);return _0x263148[_0xa3c5('0x12')](0x1f4)[_0xa3c5('0x16')](_0x46b5d9);}return _0x263148[_0xa3c5('0x12')](0xc8)[_0xa3c5('0x16')]({'output':_0x125517});});};exports[_0xa3c5('0x1f')]=function(_0x12ea33,_0x20886b){return pm2['restart'](_0xa3c5('0x20'))[_0xa3c5('0x21')](function(_0x1db916){logger[_0xa3c5('0x17')](_0xa3c5('0x22'),_0x1db916);return _0x20886b[_0xa3c5('0x12')](0xc8)[_0xa3c5('0x16')]({'output':_0xa3c5('0x23')});})[_0xa3c5('0x24')](function(_0x3a42fb){logger['error'](_0x3a42fb);return _0x20886b[_0xa3c5('0x12')](0x1f4)[_0xa3c5('0x16')](_0x3a42fb);});};exports[_0xa3c5('0x25')]=function(_0xdf7607,_0x1e1729){var _0x3a928e=fs[_0xa3c5('0x26')](path[_0xa3c5('0x27')](config['root'],_0xa3c5('0x28'),'migrations'));var _0xe8b42b=[];for(var _0x303c2b=0x0;_0x303c2b<_0x3a928e['length'];_0x303c2b++){var _0x4053f0=_0x3a928e[_0x303c2b][_0xa3c5('0x29')](_0xa3c5('0x2a'),'');if(compareVersions(module['exports']['version'],_0x4053f0)===-0x1){_0xe8b42b[_0xa3c5('0x2b')](_0x4053f0);}}if(_0xe8b42b[_0xa3c5('0x2c')]){var _0x5da348=_0xe8b42b[_0xa3c5('0x2d')](compareVersions);var _0x263440=new Umzug({'storage':_0xa3c5('0x2e'),'storageOptions':{'model':db[_0xa3c5('0x2f')],'modelName':_0xa3c5('0x2f'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0xa3c5('0x30')](),db['sequelize'][_0xa3c5('0x31')],function(){throw new Error(_0xa3c5('0x32'));}],'path':path[_0xa3c5('0x27')](config['root'],_0xa3c5('0x28'),_0xa3c5('0x25')),'pattern':/\.js$/}});_0x263440['up']({'migrations':_[_0xa3c5('0x33')](_0x5da348,function(_0x5112de){return _0x5112de+_0xa3c5('0x2a');})})[_0xa3c5('0x21')](function(){return _0x1e1729[_0xa3c5('0x12')](0xc8)[_0xa3c5('0x16')]({'output':_0xa3c5('0x34')+module[_0xa3c5('0xc')]['version']+_0xa3c5('0x35')+_[_0xa3c5('0x36')](_0x5da348),'migrations':_['join'](_0x5da348)});})[_0xa3c5('0x24')](function(_0x54bdd0){if(_0x54bdd0 instanceof db[_0xa3c5('0x2e')][_0xa3c5('0x37')]){return _0x1e1729[_0xa3c5('0x12')](0xc8)[_0xa3c5('0x16')]({'output':_0xa3c5('0x38')});}else{return _0x1e1729['status'](0x1f4)[_0xa3c5('0x16')](_0x54bdd0);}});}else{return _0x1e1729[_0xa3c5('0x12')](0xc8)['json']({'output':_0xa3c5('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3bc50ab..d181bc1 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 _0x823a=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe'];(function(_0x4573dd,_0x22088d){var _0x42ee7a=function(_0x6ee6f8){while(--_0x6ee6f8){_0x4573dd['push'](_0x4573dd['shift']());}};_0x42ee7a(++_0x22088d);}(_0x823a,0x14a));var _0xa823=function(_0xf1f2e0,_0x37c415){_0xf1f2e0=_0xf1f2e0-0x0;var _0x991373=_0x823a[_0xf1f2e0];return _0x991373;};'use strict';var multer=require(_0xa823('0x0'));var util=require(_0xa823('0x1'));var path=require(_0xa823('0x2'));var timeout=require(_0xa823('0x3'));var express=require(_0xa823('0x4'));var router=express[_0xa823('0x5')]();var fs_extra=require(_0xa823('0x6'));var auth=require(_0xa823('0x7'));var interaction=require(_0xa823('0x8'));var config=require(_0xa823('0x9'));var controller=require(_0xa823('0xa'));router[_0xa823('0xb')]('/',auth[_0xa823('0xc')](),controller[_0xa823('0xd')]);router[_0xa823('0xb')]('/describe',auth[_0xa823('0xc')](),controller[_0xa823('0xe')]);router['get'](_0xa823('0xf'),auth[_0xa823('0xc')](),controller['show']);router[_0xa823('0x10')]('/',auth['isAuthenticated'](),controller[_0xa823('0x11')]);router[_0xa823('0x12')](_0xa823('0xf'),auth[_0xa823('0xc')](),controller[_0xa823('0x13')]);router[_0xa823('0x14')](_0xa823('0xf'),auth['isAuthenticated'](),controller[_0xa823('0x15')]);module[_0xa823('0x16')]=router; \ No newline at end of file +var _0x5ba9=['./voiceAgentReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ba9,0x115));var _0x95ba=function(_0x32eef3,_0x2a7f1c){_0x32eef3=_0x32eef3-0x0;var _0x59aa7c=_0x5ba9[_0x32eef3];return _0x59aa7c;};'use strict';var multer=require('multer');var util=require(_0x95ba('0x0'));var path=require(_0x95ba('0x1'));var timeout=require(_0x95ba('0x2'));var express=require(_0x95ba('0x3'));var router=express[_0x95ba('0x4')]();var fs_extra=require(_0x95ba('0x5'));var auth=require(_0x95ba('0x6'));var interaction=require(_0x95ba('0x7'));var config=require('../../config/environment');var controller=require(_0x95ba('0x8'));router[_0x95ba('0x9')]('/',auth[_0x95ba('0xa')](),controller[_0x95ba('0xb')]);router[_0x95ba('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x95ba('0x9')](_0x95ba('0xc'),auth[_0x95ba('0xa')](),controller[_0x95ba('0xd')]);router[_0x95ba('0xe')]('/',auth[_0x95ba('0xa')](),controller[_0x95ba('0xf')]);router[_0x95ba('0x10')](_0x95ba('0xc'),auth[_0x95ba('0xa')](),controller[_0x95ba('0x11')]);router[_0x95ba('0x12')](_0x95ba('0xc'),auth[_0x95ba('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 861b39f..8c9f7d9 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 _0x0120=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x5a446d,_0x498ff6){var _0xd31b0d=function(_0x3f9890){while(--_0x3f9890){_0x5a446d['push'](_0x5a446d['shift']());}};_0xd31b0d(++_0x498ff6);}(_0x0120,0x6f));var _0x0012=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x0120[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'type':{'type':Sequelize[_0x0012('0x2')]},'uniqueid':{'type':Sequelize[_0x0012('0x2')]},'calleridnum':{'type':Sequelize[_0x0012('0x2')]},'calleridname':{'type':Sequelize[_0x0012('0x2')]},'queue':{'type':Sequelize[_0x0012('0x2')]},'interface':{'type':Sequelize[_0x0012('0x2')]},'membername':{'type':Sequelize[_0x0012('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0012('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0012('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x0012('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0012('0x5')]},'agentacw':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0012('0x2')]},'lastevent':{'type':Sequelize[_0x0012('0x2')]},'channel':{'type':Sequelize[_0x0012('0x2')]},'channelstate':{'type':Sequelize[_0x0012('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0012('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0012('0x2')]},'accountcode':{'type':Sequelize[_0x0012('0x2')]},'context':{'type':Sequelize[_0x0012('0x2')]},'exten':{'type':Sequelize[_0x0012('0x2')]},'priority':{'type':Sequelize[_0x0012('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x0012('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0012('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x0012('0x2')]},'destcontext':{'type':Sequelize[_0x0012('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x0012('0x2')]},'destuniqueid':{'type':Sequelize[_0x0012('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0012('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x0012('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x0012('0x6')},'transferexten':{'type':Sequelize[_0x0012('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0012('0x2')]},'agententerreason':{'type':Sequelize[_0x0012('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x065e=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x10afad,_0x30da9d){var _0x588d7e=function(_0x25e897){while(--_0x25e897){_0x10afad['push'](_0x10afad['shift']());}};_0x588d7e(++_0x30da9d);}(_0x065e,0x1a7));var _0xe065=function(_0x55d94e,_0x34a202){_0x55d94e=_0x55d94e-0x0;var _0x37110c=_0x065e[_0x55d94e];return _0x37110c;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe065('0x1')]},'calleridname':{'type':Sequelize[_0xe065('0x1')]},'queue':{'type':Sequelize[_0xe065('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xe065('0x2')]},'agentconnectAt':{'type':Sequelize[_0xe065('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xe065('0x2')]},'agentdumpAt':{'type':Sequelize[_0xe065('0x2')]},'holdtime':{'type':Sequelize[_0xe065('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe065('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe065('0x3')]},'agentacw':{'type':Sequelize[_0xe065('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe065('0x3')]},'reason':{'type':Sequelize[_0xe065('0x1')]},'lastevent':{'type':Sequelize[_0xe065('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xe065('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe065('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe065('0x1')]},'connectedlinename':{'type':Sequelize[_0xe065('0x1')]},'language':{'type':Sequelize[_0xe065('0x1')]},'accountcode':{'type':Sequelize[_0xe065('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe065('0x1')]},'destchannel':{'type':Sequelize[_0xe065('0x1')]},'destchannelstate':{'type':Sequelize[_0xe065('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe065('0x1')]},'destcalleridname':{'type':Sequelize[_0xe065('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe065('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe065('0x1')]},'destlanguage':{'type':Sequelize[_0xe065('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe065('0x1')]},'destexten':{'type':Sequelize[_0xe065('0x1')]},'destpriority':{'type':Sequelize[_0xe065('0x1')]},'destuniqueid':{'type':Sequelize[_0xe065('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe065('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xe065('0x1')]},'transfer':{'type':Sequelize[_0xe065('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xe065('0x5')},'transferexten':{'type':Sequelize[_0xe065('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xe065('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 80cf676..922939e 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(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 d8f3007..dac14f3 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 _0xb38e=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_agent','uniqueid','destuniqueid','lodash'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0xb38e,0xa7));var _0xeb38=function(_0x444ac8,_0x52cb81){_0x444ac8=_0x444ac8-0x0;var _0x3ba5bb=_0xb38e[_0x444ac8];return _0x3ba5bb;};'use strict';var _=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var logger=require(_0xeb38('0x2'))(_0xeb38('0x3'));var moment=require(_0xeb38('0x4'));var BPromise=require(_0xeb38('0x5'));var rp=require(_0xeb38('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb38('0x7'));var config=require(_0xeb38('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0xeb38('0x9')]=function(_0xd3e5dc,_0x28e501){return _0xd3e5dc[_0xeb38('0xa')]('VoiceAgentReport',attributes,{'tableName':_0xeb38('0xb'),'paranoid':![],'indexes':[{'fields':[_0xeb38('0xc'),_0xeb38('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb5d=['../../config/logger','api','moment','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util'];(function(_0x48d9b4,_0x2da666){var _0x10b98d=function(_0xcdadac){while(--_0xcdadac){_0x48d9b4['push'](_0x48d9b4['shift']());}};_0x10b98d(++_0x2da666);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xeb5d[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb5('0x4'));var rimraf=require(_0xdeb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x6'));module[_0xdeb5('0x7')]=function(_0x164ecb,_0x33af72){return _0x164ecb[_0xdeb5('0x8')](_0xdeb5('0x9'),attributes,{'tableName':_0xdeb5('0xa'),'paranoid':![],'indexes':[{'fields':[_0xdeb5('0xb'),_0xdeb5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index b12f6ca..0a20a0d 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 _0x012f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','stringify','update','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x240134,_0x2742a4){var _0x181532=function(_0x77d4c2){while(--_0x77d4c2){_0x240134['push'](_0x240134['shift']());}};_0x181532(++_0x2742a4);}(_0x012f,0x119));var _0xf012=function(_0xf7fda0,_0x27c453){_0xf7fda0=_0xf7fda0-0x0;var _0x5a4a51=_0x012f[_0xf7fda0];return _0x5a4a51;};'use strict';var _=require(_0xf012('0x0'));var util=require(_0xf012('0x1'));var moment=require(_0xf012('0x2'));var BPromise=require('bluebird');var rs=require(_0xf012('0x3'));var fs=require('fs');var Redis=require(_0xf012('0x4'));var db=require(_0xf012('0x5'))['db'];var utils=require(_0xf012('0x6'));var logger=require(_0xf012('0x7'))(_0xf012('0x8'));var config=require(_0xf012('0x9'));var jayson=require(_0xf012('0xa'));var client=jayson[_0xf012('0xb')][_0xf012('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f6d68,_0x2f6478,_0x2d7955){return new BPromise(function(_0x103a25,_0x29f509){return client['request'](_0x2f6d68,_0x2d7955)[_0xf012('0xd')](function(_0x3b4524){logger['info'](_0xf012('0xe'),_0x2f6478,_0xf012('0xf'));logger[_0xf012('0x10')](_0xf012('0x11'),_0x2f6478,'request\x20sent',JSON['stringify'](_0x3b4524));if(_0x3b4524[_0xf012('0x12')]){if(_0x3b4524[_0xf012('0x12')][_0xf012('0x13')]===0x1f4){logger[_0xf012('0x12')](_0xf012('0xe'),_0x2f6478,_0x3b4524[_0xf012('0x12')][_0xf012('0x14')]);return _0x29f509(_0x3b4524[_0xf012('0x12')][_0xf012('0x14')]);}logger['error'](_0xf012('0xe'),_0x2f6478,_0x3b4524[_0xf012('0x12')][_0xf012('0x14')]);return _0x103a25(_0x3b4524['error'][_0xf012('0x14')]);}else{logger[_0xf012('0x15')](_0xf012('0xe'),_0x2f6478,'request\x20sent');_0x103a25(_0x3b4524[_0xf012('0x16')]['message']);}})[_0xf012('0x17')](function(_0x48227c){logger[_0xf012('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x2f6478,_0x48227c);_0x29f509(_0x48227c);});});}exports[_0xf012('0x18')]=function(_0x1bec84){var _0x1bc93a=this;return new Promise(function(_0x463fc7,_0x23932a){return db[_0xf012('0x19')][_0xf012('0x1a')](_0x1bec84[_0xf012('0x1b')],{'raw':_0x1bec84['options']?_0x1bec84[_0xf012('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5c68c5){logger['info'](_0xf012('0x18'),_0x1bec84);logger['debug'](_0xf012('0x18'),_0x1bec84,JSON[_0xf012('0x1d')](_0x5c68c5));_0x463fc7(_0x5c68c5);})[_0xf012('0x17')](function(_0x7d71ba){logger['error'](_0xf012('0x18'),_0x7d71ba[_0xf012('0x14')],_0x1bec84);_0x23932a(_0x1bc93a[_0xf012('0x12')](0x1f4,_0x7d71ba[_0xf012('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x194f0b){var _0x445d9b=this;return new Promise(function(_0x403885,_0x300c60){return db[_0xf012('0x19')][_0xf012('0x1e')](_0x194f0b[_0xf012('0x1b')],{'raw':_0x194f0b[_0xf012('0x1c')]?_0x194f0b[_0xf012('0x1c')][_0xf012('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x194f0b[_0xf012('0x1c')]?_0x194f0b['options'][_0xf012('0x20')]||null:null,'attributes':_0x194f0b[_0xf012('0x1c')]?_0x194f0b['options'][_0xf012('0x21')]||null:null,'limit':_0x194f0b[_0xf012('0x1c')]?_0x194f0b[_0xf012('0x1c')][_0xf012('0x22')]||null:null})[_0xf012('0xd')](function(_0x3b0943){logger[_0xf012('0x15')](_0xf012('0x23'),_0x194f0b);logger[_0xf012('0x10')]('UpdateVoiceAgentReport',_0x194f0b,JSON[_0xf012('0x1d')](_0x3b0943));_0x403885(_0x3b0943);})['catch'](function(_0x4f795d){logger[_0xf012('0x12')](_0xf012('0x23'),_0x4f795d[_0xf012('0x14')],_0x194f0b);_0x300c60(_0x445d9b[_0xf012('0x12')](0x1f4,_0x4f795d[_0xf012('0x14')]));});});}; \ No newline at end of file +var _0x1e1b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','attributes','limit','UpdateVoiceAgentReport','lodash','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x47679a,_0x92f555){var _0x22bce3=function(_0x37f95f){while(--_0x37f95f){_0x47679a['push'](_0x47679a['shift']());}};_0x22bce3(++_0x92f555);}(_0x1e1b,0x91));var _0xb1e1=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0x1e1b[_0x65d12e];return _0x4274e0;};'use strict';var _=require(_0xb1e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb1e1('0x1'));var fs=require('fs');var Redis=require(_0xb1e1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1e1('0x3'));var logger=require(_0xb1e1('0x4'))(_0xb1e1('0x5'));var config=require(_0xb1e1('0x6'));var jayson=require(_0xb1e1('0x7'));var client=jayson[_0xb1e1('0x8')][_0xb1e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5342fc,_0x33a4c1,_0x4eba86){return new BPromise(function(_0x1af9f5,_0x11df91){return client[_0xb1e1('0xa')](_0x5342fc,_0x4eba86)[_0xb1e1('0xb')](function(_0x14093f){logger[_0xb1e1('0xc')](_0xb1e1('0xd'),_0x33a4c1,_0xb1e1('0xe'));logger[_0xb1e1('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x33a4c1,_0xb1e1('0xe'),JSON[_0xb1e1('0x10')](_0x14093f));if(_0x14093f[_0xb1e1('0x11')]){if(_0x14093f['error'][_0xb1e1('0x12')]===0x1f4){logger[_0xb1e1('0x11')](_0xb1e1('0xd'),_0x33a4c1,_0x14093f[_0xb1e1('0x11')][_0xb1e1('0x13')]);return _0x11df91(_0x14093f[_0xb1e1('0x11')][_0xb1e1('0x13')]);}logger['error'](_0xb1e1('0xd'),_0x33a4c1,_0x14093f[_0xb1e1('0x11')][_0xb1e1('0x13')]);return _0x1af9f5(_0x14093f[_0xb1e1('0x11')]['message']);}else{logger['info'](_0xb1e1('0xd'),_0x33a4c1,'request\x20sent');_0x1af9f5(_0x14093f['result'][_0xb1e1('0x13')]);}})[_0xb1e1('0x14')](function(_0x2bcc09){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x33a4c1,_0x2bcc09);_0x11df91(_0x2bcc09);});});}exports[_0xb1e1('0x15')]=function(_0x3d31a4){var _0x3bfcad=this;return new Promise(function(_0x209018,_0x3076dc){return db[_0xb1e1('0x16')][_0xb1e1('0x17')](_0x3d31a4[_0xb1e1('0x18')],{'raw':_0x3d31a4[_0xb1e1('0x19')]?_0x3d31a4['options'][_0xb1e1('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x20c21b){logger[_0xb1e1('0xc')](_0xb1e1('0x15'),_0x3d31a4);logger[_0xb1e1('0xf')](_0xb1e1('0x15'),_0x3d31a4,JSON[_0xb1e1('0x10')](_0x20c21b));_0x209018(_0x20c21b);})['catch'](function(_0x334c03){logger[_0xb1e1('0x11')](_0xb1e1('0x15'),_0x334c03[_0xb1e1('0x13')],_0x3d31a4);_0x3076dc(_0x3bfcad[_0xb1e1('0x11')](0x1f4,_0x334c03[_0xb1e1('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x1bb0f8){var _0x1e0094=this;return new Promise(function(_0x8a8090,_0x2ee725){return db[_0xb1e1('0x16')]['update'](_0x1bb0f8[_0xb1e1('0x18')],{'raw':_0x1bb0f8['options']?_0x1bb0f8[_0xb1e1('0x19')][_0xb1e1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bb0f8['options']?_0x1bb0f8['options']['where']||null:null,'attributes':_0x1bb0f8[_0xb1e1('0x19')]?_0x1bb0f8[_0xb1e1('0x19')][_0xb1e1('0x1b')]||null:null,'limit':_0x1bb0f8[_0xb1e1('0x19')]?_0x1bb0f8[_0xb1e1('0x19')][_0xb1e1('0x1c')]||null:null})[_0xb1e1('0xb')](function(_0x4b3ea4){logger[_0xb1e1('0xc')](_0xb1e1('0x1d'),_0x1bb0f8);logger['debug']('UpdateVoiceAgentReport',_0x1bb0f8,JSON[_0xb1e1('0x10')](_0x4b3ea4));_0x8a8090(_0x4b3ea4);})[_0xb1e1('0x14')](function(_0x4060eb){logger[_0xb1e1('0x11')](_0xb1e1('0x1d'),_0x4060eb[_0xb1e1('0x13')],_0x1bb0f8);_0x2ee725(_0x1e0094[_0xb1e1('0x11')](0x1f4,_0x4060eb[_0xb1e1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 5f48a3b..e0a087e 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 _0xdc97=['get','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller'];(function(_0x198541,_0x2e1dea){var _0x24c19a=function(_0x28f701){while(--_0x28f701){_0x198541['push'](_0x198541['shift']());}};_0x24c19a(++_0x2e1dea);}(_0xdc97,0x13b));var _0x7dc9=function(_0x153f4f,_0x2a0688){_0x153f4f=_0x153f4f-0x0;var _0x1911da=_0xdc97[_0x153f4f];return _0x1911da;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['post']('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0xe')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe5b3=['../../config/environment','./voiceCallReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5e041c,_0x3952b6){var _0x58273f=function(_0x200aec){while(--_0x200aec){_0x5e041c['push'](_0x5e041c['shift']());}};_0x58273f(++_0x3952b6);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1d2cdb,_0x39f853){_0x1d2cdb=_0x1d2cdb-0x0;var _0x42ad94=_0xe5b3[_0x1d2cdb];return _0x42ad94;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/describe',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xa')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e5b('0xf')]('/',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);router['delete'](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x13')]);module[_0x3e5b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0093b3a..a5e76db 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 _0xe5ff=['exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize'];(function(_0x561c51,_0x428fb6){var _0x5949c4=function(_0x2ef04f){while(--_0x2ef04f){_0x561c51['push'](_0x561c51['shift']());}};_0x5949c4(++_0x428fb6);}(_0xe5ff,0x197));var _0xfe5f=function(_0x394be9,_0x588d2d){_0x394be9=_0x394be9-0x0;var _0x2229fb=_0xe5ff[_0x394be9];return _0x2229fb;};'use strict';var Sequelize=require(_0xfe5f('0x0'));module[_0xfe5f('0x1')]={'uniqueid':{'type':Sequelize[_0xfe5f('0x2')]},'type':{'type':Sequelize[_0xfe5f('0x3')](_0xfe5f('0x4'),_0xfe5f('0x5'),_0xfe5f('0x6'),_0xfe5f('0x7'),_0xfe5f('0x8'),_0xfe5f('0x9'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xfe5f('0x2')]},'source':{'type':Sequelize[_0xfe5f('0x2')]},'destination':{'type':Sequelize[_0xfe5f('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xfe5f('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xfe5f('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfe5f('0xa')]},'endtime':{'type':Sequelize[_0xfe5f('0xa')]},'duration':{'type':Sequelize[_0xfe5f('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xfe5f('0x2')]},'userfield':{'type':Sequelize[_0xfe5f('0x2')]},'userDisposition':{'type':Sequelize[_0xfe5f('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfe5f('0x2')]},'prefix':{'type':Sequelize[_0xfe5f('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xfe5f('0x2')]}}; \ No newline at end of file +var _0x0137=['exports','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize'];(function(_0x4e0ab4,_0x3cc679){var _0x3f5faa=function(_0x5d5f08){while(--_0x5d5f08){_0x4e0ab4['push'](_0x4e0ab4['shift']());}};_0x3f5faa(++_0x3cc679);}(_0x0137,0x1d8));var _0x7013=function(_0x2a8b3b,_0x5efd92){_0x2a8b3b=_0x2a8b3b-0x0;var _0x546b6c=_0x0137[_0x2a8b3b];return _0x546b6c;};'use strict';var Sequelize=require(_0x7013('0x0'));module[_0x7013('0x1')]={'uniqueid':{'type':Sequelize[_0x7013('0x2')]},'type':{'type':Sequelize[_0x7013('0x3')](_0x7013('0x4'),'internal',_0x7013('0x5'),_0x7013('0x6'),_0x7013('0x7'),_0x7013('0x8'))},'tag':{'type':Sequelize[_0x7013('0x2')]},'accountcode':{'type':Sequelize[_0x7013('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x7013('0x2')]},'destinationcontext':{'type':Sequelize[_0x7013('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7013('0x2')]},'destinationchannel':{'type':Sequelize[_0x7013('0x2')]},'lastapplication':{'type':Sequelize[_0x7013('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7013('0x9')]},'systemanswertime':{'type':Sequelize[_0x7013('0x9')]},'answertime':{'type':Sequelize[_0x7013('0x9')]},'endtime':{'type':Sequelize[_0x7013('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x7013('0xa')]},'mohtime':{'type':Sequelize[_0x7013('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7013('0x2')]},'amaflags':{'type':Sequelize[_0x7013('0x2')]},'userfield':{'type':Sequelize[_0x7013('0x2')]},'userDisposition':{'type':Sequelize[_0x7013('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x7013('0x2')]},'note':{'type':Sequelize[_0x7013('0x2')]},'prefix':{'type':Sequelize[_0x7013('0x2')]},'routeid':{'type':Sequelize[_0x7013('0xa')]},'sipcallid':{'type':Sequelize[_0x7013('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8cdfd7a..43f4407 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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x2ef3,0xba));var _0x32ef=function(_0x1f4fa2,_0x2d1375){_0x1f4fa2=_0x1f4fa2-0x0;var _0xbc90e6=_0x2ef3[_0x1f4fa2];return _0xbc90e6;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3a962d8..907c8ad 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 _0xef98=['../../config/logger','api','bluebird','path','rimraf','exports','define','report_call','uniqueid'];(function(_0x2e666f,_0x1bc5f3){var _0x455047=function(_0x269c89){while(--_0x269c89){_0x2e666f['push'](_0x2e666f['shift']());}};_0x455047(++_0x1bc5f3);}(_0xef98,0x1c2));var _0x8ef9=function(_0x854a02,_0x315dbd){_0x854a02=_0x854a02-0x0;var _0x265aa3=_0xef98[_0x854a02];return _0x265aa3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8ef9('0x0'))(_0x8ef9('0x1'));var moment=require('moment');var BPromise=require(_0x8ef9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ef9('0x3'));var rimraf=require(_0x8ef9('0x4'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x8ef9('0x5')]=function(_0x5df7ec,_0x1cab8c){return _0x5df7ec[_0x8ef9('0x6')]('VoiceCallReport',attributes,{'tableName':_0x8ef9('0x7'),'paranoid':![],'indexes':[{'fields':[_0x8ef9('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf54=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x33f31b,_0x550ae9){var _0x33514e=function(_0x266538){while(--_0x266538){_0x33f31b['push'](_0x33f31b['shift']());}};_0x33514e(++_0x550ae9);}(_0xaf54,0xb2));var _0x4af5=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0xaf54[_0x4b4277];return _0x1ff405;};'use strict';var _=require(_0x4af5('0x0'));var util=require('util');var logger=require(_0x4af5('0x1'))(_0x4af5('0x2'));var moment=require(_0x4af5('0x3'));var BPromise=require(_0x4af5('0x4'));var rp=require(_0x4af5('0x5'));var fs=require('fs');var path=require(_0x4af5('0x6'));var rimraf=require(_0x4af5('0x7'));var config=require(_0x4af5('0x8'));var attributes=require(_0x4af5('0x9'));module['exports']=function(_0x2855d2,_0x1bacd9){return _0x2855d2[_0x4af5('0xa')](_0x4af5('0xb'),attributes,{'tableName':_0x4af5('0xc'),'paranoid':![],'indexes':[{'fields':[_0x4af5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 2a39257..7720b53 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 _0x9882=['include','map','model','VoiceCallReport','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceCallReport','findAll','options','raw','attributes','limit'];(function(_0x3e8199,_0x35e076){var _0x1a51da=function(_0xb47928){while(--_0xb47928){_0x3e8199['push'](_0x3e8199['shift']());}};_0x1a51da(++_0x35e076);}(_0x9882,0x139));var _0x2988=function(_0x35ee13,_0x39b512){_0x35ee13=_0x35ee13-0x0;var _0x3ebaad=_0x9882[_0x35ee13];return _0x3ebaad;};'use strict';var _=require(_0x2988('0x0'));var util=require(_0x2988('0x1'));var moment=require(_0x2988('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2988('0x3'));var db=require(_0x2988('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2988('0x5'))(_0x2988('0x6'));var config=require('../../config/environment');var jayson=require(_0x2988('0x7'));var client=jayson[_0x2988('0x8')][_0x2988('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e3439,_0x547b94,_0x22263f){return new BPromise(function(_0x13074e,_0x527454){return client[_0x2988('0xa')](_0x2e3439,_0x22263f)[_0x2988('0xb')](function(_0x3028b7){logger['info'](_0x2988('0xc'),_0x547b94,_0x2988('0xd'));logger[_0x2988('0xe')](_0x2988('0xf'),_0x547b94,_0x2988('0xd'),JSON[_0x2988('0x10')](_0x3028b7));if(_0x3028b7[_0x2988('0x11')]){if(_0x3028b7[_0x2988('0x11')][_0x2988('0x12')]===0x1f4){logger[_0x2988('0x11')](_0x2988('0xc'),_0x547b94,_0x3028b7[_0x2988('0x11')][_0x2988('0x13')]);return _0x527454(_0x3028b7[_0x2988('0x11')][_0x2988('0x13')]);}logger[_0x2988('0x11')](_0x2988('0xc'),_0x547b94,_0x3028b7[_0x2988('0x11')][_0x2988('0x13')]);return _0x13074e(_0x3028b7['error'][_0x2988('0x13')]);}else{logger[_0x2988('0x14')](_0x2988('0xc'),_0x547b94,_0x2988('0xd'));_0x13074e(_0x3028b7[_0x2988('0x15')][_0x2988('0x13')]);}})[_0x2988('0x16')](function(_0x11ad45){logger['error'](_0x2988('0xc'),_0x547b94,_0x11ad45);_0x527454(_0x11ad45);});});}exports[_0x2988('0x17')]=function(_0x42706b){var _0xc9133=this;return new Promise(function(_0x2757b0,_0x3ad412){return db['VoiceCallReport'][_0x2988('0x18')]({'raw':_0x42706b[_0x2988('0x19')]?_0x42706b[_0x2988('0x19')][_0x2988('0x1a')]===undefined?!![]:![]:!![],'where':_0x42706b['options']?_0x42706b[_0x2988('0x19')]['where']||null:null,'attributes':_0x42706b['options']?_0x42706b[_0x2988('0x19')][_0x2988('0x1b')]||null:null,'limit':_0x42706b['options']?_0x42706b[_0x2988('0x19')][_0x2988('0x1c')]||null:null,'include':_0x42706b[_0x2988('0x19')]?_0x42706b[_0x2988('0x19')][_0x2988('0x1d')]?_[_0x2988('0x1e')](_0x42706b[_0x2988('0x19')][_0x2988('0x1d')],function(_0x352cf3){return{'model':db[_0x352cf3[_0x2988('0x1f')]],'as':_0x352cf3['as'],'attributes':_0x352cf3[_0x2988('0x1b')],'include':_0x352cf3['include']?_[_0x2988('0x1e')](_0x352cf3[_0x2988('0x1d')],function(_0x3d37be){return{'model':db[_0x3d37be[_0x2988('0x1f')]],'as':_0x3d37be['as'],'attributes':_0x3d37be[_0x2988('0x1b')],'include':_0x3d37be['include']?_[_0x2988('0x1e')](_0x3d37be['include'],function(_0x281115){return{'model':db[_0x281115['model']],'as':_0x281115['as'],'attributes':_0x281115[_0x2988('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2988('0xb')](function(_0x49fcc1){logger[_0x2988('0x14')](_0x2988('0x17'),_0x42706b);logger[_0x2988('0xe')]('GetVoiceCallReport',_0x42706b,JSON[_0x2988('0x10')](_0x49fcc1));_0x2757b0(_0x49fcc1);})[_0x2988('0x16')](function(_0x1df082){logger[_0x2988('0x11')](_0x2988('0x17'),_0x1df082[_0x2988('0x13')],_0x42706b);_0x3ad412(_0xc9133[_0x2988('0x11')](0x1f4,_0x1df082[_0x2988('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x5070ab){var _0x555148=this;return new Promise(function(_0x18d654,_0x5ec039){return db[_0x2988('0x20')][_0x2988('0x21')](_0x5070ab[_0x2988('0x22')],{'raw':_0x5070ab[_0x2988('0x19')]?_0x5070ab[_0x2988('0x19')][_0x2988('0x1a')]===undefined?!![]:![]:!![]})[_0x2988('0xb')](function(_0x23ca20){logger[_0x2988('0x14')](_0x2988('0x23'),_0x5070ab);logger[_0x2988('0xe')](_0x2988('0x23'),_0x5070ab,JSON[_0x2988('0x10')](_0x23ca20));_0x18d654(_0x23ca20);})['catch'](function(_0x5b9261){logger['error'](_0x2988('0x23'),_0x5b9261['message'],_0x5070ab);_0x5ec039(_0x555148[_0x2988('0x11')](0x1f4,_0x5b9261[_0x2988('0x13')]));});});};exports[_0x2988('0x24')]=function(_0x340565){var _0x397d77=this;return new Promise(function(_0x34cb69,_0x5a0080){return db[_0x2988('0x20')][_0x2988('0x25')](_0x340565[_0x2988('0x22')],{'raw':_0x340565[_0x2988('0x19')]?_0x340565['options'][_0x2988('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x340565[_0x2988('0x19')]?_0x340565[_0x2988('0x19')]['where']||null:null,'attributes':_0x340565[_0x2988('0x19')]?_0x340565[_0x2988('0x19')][_0x2988('0x1b')]||null:null,'limit':_0x340565['options']?_0x340565[_0x2988('0x19')][_0x2988('0x1c')]||null:null})[_0x2988('0xb')](function(_0xad9a7a){logger[_0x2988('0x14')](_0x2988('0x24'),_0x340565);logger['debug']('UpdateVoiceCallReport',_0x340565,JSON['stringify'](_0xad9a7a));_0x34cb69(_0xad9a7a);})[_0x2988('0x16')](function(_0x2c2ff2){logger[_0x2988('0x11')]('UpdateVoiceCallReport',_0x2c2ff2[_0x2988('0x13')],_0x340565);_0x5a0080(_0x397d77[_0x2988('0x11')](0x1f4,_0x2c2ff2['message']));});});}; \ No newline at end of file +var _0x07d0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','model','then','GetVoiceCallReport','debug','VoiceCallReport','body','CreateVoiceCallReport','UpdateVoiceCallReport','where','lodash','moment','bluebird'];(function(_0x4fe1a5,_0x50ba8b){var _0x599b40=function(_0x26da56){while(--_0x26da56){_0x4fe1a5['push'](_0x4fe1a5['shift']());}};_0x599b40(++_0x50ba8b);}(_0x07d0,0xb6));var _0x007d=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x07d0[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require(_0x007d('0x0'));var util=require('util');var moment=require(_0x007d('0x1'));var BPromise=require(_0x007d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x007d('0x3'));var db=require(_0x007d('0x4'))['db'];var utils=require(_0x007d('0x5'));var logger=require(_0x007d('0x6'))('rpc');var config=require(_0x007d('0x7'));var jayson=require(_0x007d('0x8'));var client=jayson[_0x007d('0x9')][_0x007d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x471086,_0x272480,_0x413656){return new BPromise(function(_0x522705,_0x4b58e0){return client[_0x007d('0xb')](_0x471086,_0x413656)['then'](function(_0x19f5a4){logger[_0x007d('0xc')](_0x007d('0xd'),_0x272480,_0x007d('0xe'));logger['debug'](_0x007d('0xf'),_0x272480,'request\x20sent',JSON[_0x007d('0x10')](_0x19f5a4));if(_0x19f5a4[_0x007d('0x11')]){if(_0x19f5a4[_0x007d('0x11')][_0x007d('0x12')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x272480,_0x19f5a4[_0x007d('0x11')]['message']);return _0x4b58e0(_0x19f5a4[_0x007d('0x11')][_0x007d('0x13')]);}logger[_0x007d('0x11')](_0x007d('0xd'),_0x272480,_0x19f5a4[_0x007d('0x11')][_0x007d('0x13')]);return _0x522705(_0x19f5a4[_0x007d('0x11')][_0x007d('0x13')]);}else{logger[_0x007d('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x272480,_0x007d('0xe'));_0x522705(_0x19f5a4[_0x007d('0x14')][_0x007d('0x13')]);}})[_0x007d('0x15')](function(_0x16c365){logger[_0x007d('0x11')](_0x007d('0xd'),_0x272480,_0x16c365);_0x4b58e0(_0x16c365);});});}exports['GetVoiceCallReport']=function(_0x5e479f){var _0x58f844=this;return new Promise(function(_0x2b6c9c,_0x5ecaa6){return db['VoiceCallReport'][_0x007d('0x16')]({'raw':_0x5e479f['options']?_0x5e479f[_0x007d('0x17')][_0x007d('0x18')]===undefined?!![]:![]:!![],'where':_0x5e479f[_0x007d('0x17')]?_0x5e479f['options']['where']||null:null,'attributes':_0x5e479f[_0x007d('0x17')]?_0x5e479f[_0x007d('0x17')][_0x007d('0x19')]||null:null,'limit':_0x5e479f[_0x007d('0x17')]?_0x5e479f[_0x007d('0x17')][_0x007d('0x1a')]||null:null,'include':_0x5e479f[_0x007d('0x17')]?_0x5e479f[_0x007d('0x17')][_0x007d('0x1b')]?_['map'](_0x5e479f[_0x007d('0x17')][_0x007d('0x1b')],function(_0x5d28e2){return{'model':db[_0x5d28e2['model']],'as':_0x5d28e2['as'],'attributes':_0x5d28e2[_0x007d('0x19')],'include':_0x5d28e2[_0x007d('0x1b')]?_['map'](_0x5d28e2[_0x007d('0x1b')],function(_0x393162){return{'model':db[_0x393162[_0x007d('0x1c')]],'as':_0x393162['as'],'attributes':_0x393162[_0x007d('0x19')],'include':_0x393162[_0x007d('0x1b')]?_['map'](_0x393162[_0x007d('0x1b')],function(_0xac5dc){return{'model':db[_0xac5dc['model']],'as':_0xac5dc['as'],'attributes':_0xac5dc[_0x007d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x007d('0x1d')](function(_0x3ae2b9){logger[_0x007d('0xc')](_0x007d('0x1e'),_0x5e479f);logger[_0x007d('0x1f')]('GetVoiceCallReport',_0x5e479f,JSON[_0x007d('0x10')](_0x3ae2b9));_0x2b6c9c(_0x3ae2b9);})[_0x007d('0x15')](function(_0x48cb2a){logger[_0x007d('0x11')](_0x007d('0x1e'),_0x48cb2a[_0x007d('0x13')],_0x5e479f);_0x5ecaa6(_0x58f844['error'](0x1f4,_0x48cb2a['message']));});});};exports['CreateVoiceCallReport']=function(_0xb266b9){var _0x194fbe=this;return new Promise(function(_0x308539,_0x2ad6f5){return db[_0x007d('0x20')]['create'](_0xb266b9[_0x007d('0x21')],{'raw':_0xb266b9[_0x007d('0x17')]?_0xb266b9[_0x007d('0x17')][_0x007d('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x24ecce){logger[_0x007d('0xc')]('CreateVoiceCallReport',_0xb266b9);logger['debug']('CreateVoiceCallReport',_0xb266b9,JSON[_0x007d('0x10')](_0x24ecce));_0x308539(_0x24ecce);})[_0x007d('0x15')](function(_0x125b73){logger[_0x007d('0x11')](_0x007d('0x22'),_0x125b73[_0x007d('0x13')],_0xb266b9);_0x2ad6f5(_0x194fbe['error'](0x1f4,_0x125b73['message']));});});};exports[_0x007d('0x23')]=function(_0x56c20c){var _0x15c611=this;return new Promise(function(_0x2f1ce1,_0x58d764){return db[_0x007d('0x20')]['update'](_0x56c20c[_0x007d('0x21')],{'raw':_0x56c20c[_0x007d('0x17')]?_0x56c20c[_0x007d('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c20c[_0x007d('0x17')]?_0x56c20c[_0x007d('0x17')][_0x007d('0x24')]||null:null,'attributes':_0x56c20c[_0x007d('0x17')]?_0x56c20c['options'][_0x007d('0x19')]||null:null,'limit':_0x56c20c[_0x007d('0x17')]?_0x56c20c[_0x007d('0x17')]['limit']||null:null})[_0x007d('0x1d')](function(_0x1b1397){logger[_0x007d('0xc')](_0x007d('0x23'),_0x56c20c);logger[_0x007d('0x1f')]('UpdateVoiceCallReport',_0x56c20c,JSON[_0x007d('0x10')](_0x1b1397));_0x2f1ce1(_0x1b1397);})[_0x007d('0x15')](function(_0x5eceea){logger['error']('UpdateVoiceCallReport',_0x5eceea[_0x007d('0x13')],_0x56c20c);_0x58d764(_0x15c611[_0x007d('0x11')](0x1f4,_0x5eceea[_0x007d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index bfd6edf..d704850 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 _0x184c=['./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x389c78,_0x1a872e){var _0x9cea6e=function(_0x9858ee){while(--_0x9858ee){_0x389c78['push'](_0x389c78['shift']());}};_0x9cea6e(++_0x1a872e);}(_0x184c,0x148));var _0xc184=function(_0x4c7662,_0x4813b3){_0x4c7662=_0x4c7662-0x0;var _0x8da52a=_0x184c[_0x4c7662];return _0x8da52a;};'use strict';var multer=require('multer');var util=require(_0xc184('0x0'));var path=require(_0xc184('0x1'));var timeout=require(_0xc184('0x2'));var express=require(_0xc184('0x3'));var router=express[_0xc184('0x4')]();var fs_extra=require(_0xc184('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc184('0x6'));var config=require(_0xc184('0x7'));var controller=require(_0xc184('0x8'));router[_0xc184('0x9')]('/',auth['isAuthenticated'](),controller[_0xc184('0xa')]);router[_0xc184('0x9')](_0xc184('0xb'),auth[_0xc184('0xc')](),controller[_0xc184('0xd')]);router[_0xc184('0xe')]('/',auth[_0xc184('0xc')](),controller[_0xc184('0xf')]);router[_0xc184('0x10')](_0xc184('0xb'),auth[_0xc184('0xc')](),controller[_0xc184('0x11')]);router[_0xc184('0x12')]('/:id',auth[_0xc184('0xc')](),controller[_0xc184('0x13')]);module[_0xc184('0x14')]=router; \ No newline at end of file +var _0x0909=['express','Router','fs-extra','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','update','multer','util','path'];(function(_0x15ac59,_0x1194f5){var _0x229498=function(_0x1dbeb8){while(--_0x1dbeb8){_0x15ac59['push'](_0x15ac59['shift']());}};_0x229498(++_0x1194f5);}(_0x0909,0x11d));var _0x9090=function(_0x574221,_0x24cb4d){_0x574221=_0x574221-0x0;var _0x1fc802=_0x0909[_0x574221];return _0x1fc802;};'use strict';var multer=require(_0x9090('0x0'));var util=require(_0x9090('0x1'));var path=require(_0x9090('0x2'));var timeout=require('connect-timeout');var express=require(_0x9090('0x3'));var router=express[_0x9090('0x4')]();var fs_extra=require(_0x9090('0x5'));var auth=require(_0x9090('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9090('0x7'));router[_0x9090('0x8')]('/',auth[_0x9090('0x9')](),controller[_0x9090('0xa')]);router[_0x9090('0x8')](_0x9090('0xb'),auth['isAuthenticated'](),controller[_0x9090('0xc')]);router[_0x9090('0xd')]('/',auth[_0x9090('0x9')](),controller['create']);router[_0x9090('0xe')]('/:id',auth[_0x9090('0x9')](),controller[_0x9090('0xf')]);router['delete'](_0x9090('0xb'),auth[_0x9090('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 762972e..fb29216 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 _0xcb2c=['join','getDataValue','BOOLEAN','sequelize','STRING','name','setDataValue','options'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xcb2c,0xab));var _0xccb2=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xcb2c[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0xccb2('0x0'));module['exports']={'name':{'type':Sequelize[_0xccb2('0x1')]},'prefix':{'type':Sequelize[_0xccb2('0x1')],'unique':_0xccb2('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x36d8e8){this[_0xccb2('0x3')](_0xccb2('0x4'),_0x36d8e8?_0x36d8e8[_0xccb2('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xccb2('0x4'))?this[_0xccb2('0x6')](_0xccb2('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xccb2('0x1')]},'record':{'type':Sequelize[_0xccb2('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xccb2('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8b7d=['name','setDataValue','options','join','getDataValue','BOOLEAN','sequelize','exports','STRING'];(function(_0x4e9b28,_0x71507a){var _0x3cce38=function(_0x148867){while(--_0x148867){_0x4e9b28['push'](_0x4e9b28['shift']());}};_0x3cce38(++_0x71507a);}(_0x8b7d,0x1ad));var _0xd8b7=function(_0x52850c,_0x249dc8){_0x52850c=_0x52850c-0x0;var _0x113595=_0x8b7d[_0x52850c];return _0x113595;};'use strict';var Sequelize=require(_0xd8b7('0x0'));module[_0xd8b7('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xd8b7('0x2')],'unique':_0xd8b7('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x3953cb){this[_0xd8b7('0x4')](_0xd8b7('0x5'),_0x3953cb?_0x3953cb[_0xd8b7('0x6')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xd8b7('0x7')](_0xd8b7('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xd8b7('0x2')]},'record':{'type':Sequelize[_0xd8b7('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd8b7('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 329ad90..6b1034c 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 _0x8a1b=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','ChanSpies','UserProfileResource','destroy','sendStatus','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','create','body','user','get','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x22e22e,_0x54c6fc){var _0x10a02a=function(_0x42b867){while(--_0x42b867){_0x22e22e['push'](_0x22e22e['shift']());}};_0x10a02a(++_0x54c6fc);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x2a8e36,_0x4265c2){_0x2a8e36=_0x2a8e36-0x0;var _0x5768f5=_0x8a1b[_0x2a8e36];return _0x5768f5;};'use strict';var emlformat=require(_0xb8a1('0x0'));var rimraf=require(_0xb8a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8a1('0x2'));var rp=require(_0xb8a1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb8a1('0x4'));var util=require(_0xb8a1('0x5'));var path=require(_0xb8a1('0x6'));var sox=require(_0xb8a1('0x7'));var csv=require(_0xb8a1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb8a1('0x9'));var _=require(_0xb8a1('0xa'));var squel=require(_0xb8a1('0xb'));var crypto=require(_0xb8a1('0xc'));var jsforce=require(_0xb8a1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb8a1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb8a1('0xe'));var authService=require(_0xb8a1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb8a1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8a1('0x11'))(_0xb8a1('0x12'));var utils=require(_0xb8a1('0x13'));var config=require(_0xb8a1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb8a1('0x15'))['db'];function respondWithStatusCode(_0x31f76e,_0x34aa9a){_0x34aa9a=_0x34aa9a||0xcc;return function(_0x7420ea){if(_0x7420ea){return _0x31f76e['sendStatus'](_0x34aa9a);}return _0x31f76e[_0xb8a1('0x16')](_0x34aa9a)[_0xb8a1('0x17')]();};}function respondWithResult(_0x24f8fc,_0x2feffe){_0x2feffe=_0x2feffe||0xc8;return function(_0xed7f42){if(_0xed7f42){return _0x24f8fc[_0xb8a1('0x16')](_0x2feffe)[_0xb8a1('0x18')](_0xed7f42);}};}function respondWithFilteredResult(_0x7c2479,_0x4710be){return function(_0x320151){if(_0x320151){var _0x367436=typeof _0x4710be['offset']===_0xb8a1('0x19')&&typeof _0x4710be[_0xb8a1('0x1a')]===_0xb8a1('0x19');var _0x5b410c=_0x320151[_0xb8a1('0x1b')];var _0x2ad525=_0x367436?0x0:_0x4710be[_0xb8a1('0x1c')];var _0xdf75f0=_0x367436?_0x320151[_0xb8a1('0x1b')]:_0x4710be[_0xb8a1('0x1c')]+_0x4710be[_0xb8a1('0x1a')];var _0x155df4;if(_0xdf75f0>=_0x5b410c){_0xdf75f0=_0x5b410c;_0x155df4=0xc8;}else{_0x155df4=0xce;}_0x7c2479[_0xb8a1('0x16')](_0x155df4);return _0x7c2479['set']('Content-Range',_0x2ad525+'-'+_0xdf75f0+'/'+_0x5b410c)[_0xb8a1('0x18')](_0x320151);}return null;};}function patchUpdates(_0x51859f){return function(_0x58bca0){try{jsonpatch[_0xb8a1('0x1d')](_0x58bca0,_0x51859f,!![]);}catch(_0x26be92){return BPromise[_0xb8a1('0x1e')](_0x26be92);}return _0x58bca0[_0xb8a1('0x1f')]();};}function saveUpdates(_0x655293,_0x3f616f){return function(_0x2618bd){if(_0x2618bd){return _0x2618bd[_0xb8a1('0x20')](_0x655293)[_0xb8a1('0x21')](function(_0xff7f41){return _0xff7f41;});}return null;};}function removeEntity(_0x1a3e62,_0x1829b7){return function(_0x2d9d56){if(_0x2d9d56){return _0x2d9d56['destroy']()[_0xb8a1('0x21')](function(){var _0x116232=_0x2d9d56['get']({'plain':!![]});var _0x4b69b8=_0xb8a1('0x22');return db[_0xb8a1('0x23')][_0xb8a1('0x24')]({'where':{'type':_0x4b69b8,'resourceId':_0x116232['id']}})[_0xb8a1('0x21')](function(){return _0x2d9d56;});})['then'](function(){_0x1a3e62['status'](0xcc)[_0xb8a1('0x17')]();});}};}function handleEntityNotFound(_0x22311f,_0x3b1ce5){return function(_0x58e717){if(!_0x58e717){_0x22311f[_0xb8a1('0x25')](0x194);}return _0x58e717;};}function handleError(_0x58d346,_0x997618){_0x997618=_0x997618||0x1f4;return function(_0x1a3837){logger['error'](_0x1a3837[_0xb8a1('0x26')]);if(_0x1a3837['name']){delete _0x1a3837[_0xb8a1('0x27')];}_0x58d346[_0xb8a1('0x16')](_0x997618)[_0xb8a1('0x28')](_0x1a3837);};}exports[_0xb8a1('0x29')]=function(_0x322294,_0x512317){var _0x2ad164={},_0x12b5a1={},_0x518f9f={'count':0x0,'rows':[]};var _0x128c9b=_['map'](db[_0xb8a1('0x2a')][_0xb8a1('0x2b')],function(_0x362fae){return{'name':_0x362fae[_0xb8a1('0x2c')],'type':_0x362fae[_0xb8a1('0x2d')][_0xb8a1('0x2e')]};});_0x12b5a1['model']=_[_0xb8a1('0x2f')](_0x128c9b,_0xb8a1('0x27'));_0x12b5a1[_0xb8a1('0x30')]=_[_0xb8a1('0x31')](_0x322294[_0xb8a1('0x30')]);_0x12b5a1[_0xb8a1('0x32')]=_[_0xb8a1('0x33')](_0x12b5a1[_0xb8a1('0x34')],_0x12b5a1['query']);_0x2ad164['attributes']=_[_0xb8a1('0x33')](_0x12b5a1['model'],qs[_0xb8a1('0x35')](_0x322294[_0xb8a1('0x30')][_0xb8a1('0x35')]));_0x2ad164[_0xb8a1('0x36')]=_0x2ad164[_0xb8a1('0x36')][_0xb8a1('0x37')]?_0x2ad164[_0xb8a1('0x36')]:_0x12b5a1[_0xb8a1('0x34')];if(!_0x322294[_0xb8a1('0x30')][_0xb8a1('0x38')](_0xb8a1('0x39'))){_0x2ad164[_0xb8a1('0x1a')]=qs[_0xb8a1('0x1a')](_0x322294[_0xb8a1('0x30')][_0xb8a1('0x1a')]);_0x2ad164[_0xb8a1('0x1c')]=qs[_0xb8a1('0x1c')](_0x322294['query'][_0xb8a1('0x1c')]);}_0x2ad164[_0xb8a1('0x3a')]=qs[_0xb8a1('0x3b')](_0x322294[_0xb8a1('0x30')][_0xb8a1('0x3b')]);_0x2ad164[_0xb8a1('0x3c')]=qs['filters'](_[_0xb8a1('0x3d')](_0x322294[_0xb8a1('0x30')],_0x12b5a1[_0xb8a1('0x32')]),_0x128c9b);if(_0x322294[_0xb8a1('0x30')][_0xb8a1('0x3e')]){_0x2ad164[_0xb8a1('0x3c')]=_[_0xb8a1('0x3f')](_0x2ad164[_0xb8a1('0x3c')],{'$or':_[_0xb8a1('0x2f')](_0x128c9b,function(_0x36df2f){if(_0x36df2f[_0xb8a1('0x2d')]!==_0xb8a1('0x40')){var _0x409182={};_0x409182[_0x36df2f[_0xb8a1('0x27')]]={'$like':'%'+_0x322294[_0xb8a1('0x30')]['filter']+'%'};return _0x409182;}})});}_0x2ad164=_[_0xb8a1('0x3f')]({},_0x2ad164,_0x322294[_0xb8a1('0x41')]);var _0x41b652={'where':_0x2ad164[_0xb8a1('0x3c')]};return db['VoiceChanSpy'][_0xb8a1('0x1b')](_0x41b652)[_0xb8a1('0x21')](function(_0xe9410a){_0x518f9f[_0xb8a1('0x1b')]=_0xe9410a;if(_0x322294[_0xb8a1('0x30')]['includeAll']){_0x2ad164['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0xb8a1('0x42')](_0x2ad164);})[_0xb8a1('0x21')](function(_0x26870b){_0x518f9f[_0xb8a1('0x43')]=_0x26870b;return _0x518f9f;})[_0xb8a1('0x21')](respondWithFilteredResult(_0x512317,_0x2ad164))[_0xb8a1('0x44')](handleError(_0x512317,null));};exports[_0xb8a1('0x45')]=function(_0x1850ad,_0x2abd9f){var _0x3e2dca={'raw':![],'where':{'id':_0x1850ad[_0xb8a1('0x46')]['id']}},_0xbe944c={};_0xbe944c['model']=_[_0xb8a1('0x31')](db['VoiceChanSpy'][_0xb8a1('0x2b')]);_0xbe944c[_0xb8a1('0x30')]=_['keys'](_0x1850ad[_0xb8a1('0x30')]);_0xbe944c[_0xb8a1('0x32')]=_[_0xb8a1('0x33')](_0xbe944c[_0xb8a1('0x34')],_0xbe944c[_0xb8a1('0x30')]);_0x3e2dca[_0xb8a1('0x36')]=_[_0xb8a1('0x33')](_0xbe944c[_0xb8a1('0x34')],qs[_0xb8a1('0x35')](_0x1850ad[_0xb8a1('0x30')][_0xb8a1('0x35')]));_0x3e2dca[_0xb8a1('0x36')]=_0x3e2dca[_0xb8a1('0x36')][_0xb8a1('0x37')]?_0x3e2dca['attributes']:_0xbe944c['model'];if(_0x1850ad[_0xb8a1('0x30')][_0xb8a1('0x47')]){_0x3e2dca['include']=[{'all':!![]}];}_0x3e2dca=_[_0xb8a1('0x3f')]({},_0x3e2dca,_0x1850ad[_0xb8a1('0x41')]);return db[_0xb8a1('0x2a')]['find'](_0x3e2dca)['then'](handleEntityNotFound(_0x2abd9f,null))[_0xb8a1('0x21')](respondWithResult(_0x2abd9f,null))[_0xb8a1('0x44')](handleError(_0x2abd9f,null));};exports[_0xb8a1('0x48')]=function(_0xf14f4f,_0xdcd04b){return db['VoiceChanSpy'][_0xb8a1('0x48')](_0xf14f4f[_0xb8a1('0x49')],{})[_0xb8a1('0x21')](function(_0x34faf1){var _0x3acc0b=_0xf14f4f[_0xb8a1('0x4a')]['get']({'plain':!![]});if(!_0x3acc0b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3acc0b['role']==='user'){var _0xe557b7=_0x34faf1[_0xb8a1('0x4b')]({'plain':!![]});var _0x20fff9=_0xb8a1('0x22');return db[_0xb8a1('0x4c')][_0xb8a1('0x4d')]({'where':{'name':_0x20fff9,'userProfileId':_0x3acc0b[_0xb8a1('0x4e')]},'raw':!![]})[_0xb8a1('0x21')](function(_0x18d0ad){if(_0x18d0ad&&_0x18d0ad[_0xb8a1('0x4f')]===0x0){return db['UserProfileResource'][_0xb8a1('0x48')]({'name':_0xe557b7[_0xb8a1('0x27')],'resourceId':_0xe557b7['id'],'type':_0x18d0ad[_0xb8a1('0x27')],'sectionId':_0x18d0ad['id']},{})[_0xb8a1('0x21')](function(){return _0x34faf1;});}else{return _0x34faf1;}})[_0xb8a1('0x44')](function(_0x41dc40){logger[_0xb8a1('0x50')](_0xb8a1('0x51'),_0x41dc40);throw _0x41dc40;});}return _0x34faf1;})['then'](respondWithResult(_0xdcd04b,0xc9))['catch'](handleError(_0xdcd04b,null));};exports[_0xb8a1('0x20')]=function(_0x42bc4f,_0x3b10de){if(_0x42bc4f['body']['id']){delete _0x42bc4f[_0xb8a1('0x49')]['id'];}return db[_0xb8a1('0x2a')][_0xb8a1('0x4d')]({'where':{'id':_0x42bc4f['params']['id']}})[_0xb8a1('0x21')](handleEntityNotFound(_0x3b10de,null))[_0xb8a1('0x21')](saveUpdates(_0x42bc4f[_0xb8a1('0x49')],null))[_0xb8a1('0x21')](respondWithResult(_0x3b10de,null))[_0xb8a1('0x44')](handleError(_0x3b10de,null));};exports[_0xb8a1('0x24')]=function(_0x907971,_0x1805dc){return db[_0xb8a1('0x2a')][_0xb8a1('0x4d')]({'where':{'id':_0x907971['params']['id']}})[_0xb8a1('0x21')](handleEntityNotFound(_0x1805dc,null))[_0xb8a1('0x21')](removeEntity(_0x1805dc,null))['catch'](handleError(_0x1805dc,null));}; \ No newline at end of file +var _0xd136=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse'];(function(_0x44507a,_0x5499ea){var _0xa6ff20=function(_0x2023d6){while(--_0x2023d6){_0x44507a['push'](_0x44507a['shift']());}};_0xa6ff20(++_0x5499ea);}(_0xd136,0x94));var _0x6d13=function(_0x14e7b1,_0x3bfd85){_0x14e7b1=_0x14e7b1-0x0;var _0x3037bb=_0xd136[_0x14e7b1];return _0x3037bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d13('0x0'));var zipdir=require(_0x6d13('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d13('0x2'));var moment=require(_0x6d13('0x3'));var BPromise=require(_0x6d13('0x4'));var Mustache=require(_0x6d13('0x5'));var util=require(_0x6d13('0x6'));var path=require(_0x6d13('0x7'));var sox=require(_0x6d13('0x8'));var csv=require(_0x6d13('0x9'));var ejs=require(_0x6d13('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d13('0xb'));var squel=require(_0x6d13('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d13('0xd'));var toCsv=require(_0x6d13('0x9'));var querystring=require(_0x6d13('0xe'));var Papa=require(_0x6d13('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d13('0x10'));var as=require(_0x6d13('0x11'));var hardwareService=require(_0x6d13('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6d13('0x13'));var config=require(_0x6d13('0x14'));var licenseUtil=require(_0x6d13('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b4cc3,_0x5ef7e6){_0x5ef7e6=_0x5ef7e6||0xcc;return function(_0x37d3c1){if(_0x37d3c1){return _0x1b4cc3[_0x6d13('0x16')](_0x5ef7e6);}return _0x1b4cc3['status'](_0x5ef7e6)['end']();};}function respondWithResult(_0x4ca95d,_0x37efd8){_0x37efd8=_0x37efd8||0xc8;return function(_0x10709d){if(_0x10709d){return _0x4ca95d[_0x6d13('0x17')](_0x37efd8)[_0x6d13('0x18')](_0x10709d);}};}function respondWithFilteredResult(_0x2f4c2b,_0x4f1bdf){return function(_0xf27049){if(_0xf27049){var _0x405368=typeof _0x4f1bdf[_0x6d13('0x19')]===_0x6d13('0x1a')&&typeof _0x4f1bdf[_0x6d13('0x1b')]===_0x6d13('0x1a');var _0xb17857=_0xf27049[_0x6d13('0x1c')];var _0xc6c2b=_0x405368?0x0:_0x4f1bdf['offset'];var _0x276fdd=_0x405368?_0xf27049[_0x6d13('0x1c')]:_0x4f1bdf[_0x6d13('0x19')]+_0x4f1bdf[_0x6d13('0x1b')];var _0x1f3603;if(_0x276fdd>=_0xb17857){_0x276fdd=_0xb17857;_0x1f3603=0xc8;}else{_0x1f3603=0xce;}_0x2f4c2b[_0x6d13('0x17')](_0x1f3603);return _0x2f4c2b[_0x6d13('0x1d')](_0x6d13('0x1e'),_0xc6c2b+'-'+_0x276fdd+'/'+_0xb17857)[_0x6d13('0x18')](_0xf27049);}return null;};}function patchUpdates(_0x427bb8){return function(_0x40f629){try{jsonpatch[_0x6d13('0x1f')](_0x40f629,_0x427bb8,!![]);}catch(_0x18889d){return BPromise[_0x6d13('0x20')](_0x18889d);}return _0x40f629[_0x6d13('0x21')]();};}function saveUpdates(_0x208876,_0x5619fc){return function(_0x387de2){if(_0x387de2){return _0x387de2['update'](_0x208876)[_0x6d13('0x22')](function(_0x204438){return _0x204438;});}return null;};}function removeEntity(_0x151aa4,_0x5bbc9d){return function(_0x1b0f94){if(_0x1b0f94){return _0x1b0f94[_0x6d13('0x23')]()[_0x6d13('0x22')](function(){var _0x4366a0=_0x1b0f94[_0x6d13('0x24')]({'plain':!![]});var _0x361432=_0x6d13('0x25');return db[_0x6d13('0x26')]['destroy']({'where':{'type':_0x361432,'resourceId':_0x4366a0['id']}})[_0x6d13('0x22')](function(){return _0x1b0f94;});})['then'](function(){_0x151aa4['status'](0xcc)[_0x6d13('0x27')]();});}};}function handleEntityNotFound(_0x588c40,_0x37b3fd){return function(_0x2618e5){if(!_0x2618e5){_0x588c40[_0x6d13('0x16')](0x194);}return _0x2618e5;};}function handleError(_0x49e74a,_0x3a17c3){_0x3a17c3=_0x3a17c3||0x1f4;return function(_0xd469b6){logger['error'](_0xd469b6[_0x6d13('0x28')]);if(_0xd469b6[_0x6d13('0x29')]){delete _0xd469b6[_0x6d13('0x29')];}_0x49e74a[_0x6d13('0x17')](_0x3a17c3)[_0x6d13('0x2a')](_0xd469b6);};}exports[_0x6d13('0x2b')]=function(_0x907f2f,_0x34abc4){var _0x531e8c={},_0x3857f9={},_0xa0024d={'count':0x0,'rows':[]};var _0x56b554=_[_0x6d13('0x2c')](db[_0x6d13('0x2d')][_0x6d13('0x2e')],function(_0x58ab35){return{'name':_0x58ab35[_0x6d13('0x2f')],'type':_0x58ab35[_0x6d13('0x30')][_0x6d13('0x31')]};});_0x3857f9[_0x6d13('0x32')]=_[_0x6d13('0x2c')](_0x56b554,_0x6d13('0x29'));_0x3857f9[_0x6d13('0x33')]=_['keys'](_0x907f2f[_0x6d13('0x33')]);_0x3857f9['filters']=_[_0x6d13('0x34')](_0x3857f9[_0x6d13('0x32')],_0x3857f9[_0x6d13('0x33')]);_0x531e8c[_0x6d13('0x35')]=_[_0x6d13('0x34')](_0x3857f9[_0x6d13('0x32')],qs['fields'](_0x907f2f['query'][_0x6d13('0x36')]));_0x531e8c[_0x6d13('0x35')]=_0x531e8c[_0x6d13('0x35')][_0x6d13('0x37')]?_0x531e8c[_0x6d13('0x35')]:_0x3857f9[_0x6d13('0x32')];if(!_0x907f2f['query'][_0x6d13('0x38')](_0x6d13('0x39'))){_0x531e8c[_0x6d13('0x1b')]=qs[_0x6d13('0x1b')](_0x907f2f[_0x6d13('0x33')][_0x6d13('0x1b')]);_0x531e8c[_0x6d13('0x19')]=qs[_0x6d13('0x19')](_0x907f2f[_0x6d13('0x33')][_0x6d13('0x19')]);}_0x531e8c['order']=qs['sort'](_0x907f2f[_0x6d13('0x33')]['sort']);_0x531e8c['where']=qs[_0x6d13('0x3a')](_[_0x6d13('0x3b')](_0x907f2f[_0x6d13('0x33')],_0x3857f9['filters']),_0x56b554);if(_0x907f2f[_0x6d13('0x33')][_0x6d13('0x3c')]){_0x531e8c[_0x6d13('0x3d')]=_['merge'](_0x531e8c[_0x6d13('0x3d')],{'$or':_['map'](_0x56b554,function(_0x296098){if(_0x296098['type']!=='VIRTUAL'){var _0x29e6c3={};_0x29e6c3[_0x296098[_0x6d13('0x29')]]={'$like':'%'+_0x907f2f['query']['filter']+'%'};return _0x29e6c3;}})});}_0x531e8c=_[_0x6d13('0x3e')]({},_0x531e8c,_0x907f2f[_0x6d13('0x3f')]);var _0x2a6d57={'where':_0x531e8c[_0x6d13('0x3d')]};return db['VoiceChanSpy'][_0x6d13('0x1c')](_0x2a6d57)[_0x6d13('0x22')](function(_0x4b4cc5){_0xa0024d[_0x6d13('0x1c')]=_0x4b4cc5;if(_0x907f2f[_0x6d13('0x33')][_0x6d13('0x40')]){_0x531e8c[_0x6d13('0x41')]=[{'all':!![]}];}return db[_0x6d13('0x2d')][_0x6d13('0x42')](_0x531e8c);})[_0x6d13('0x22')](function(_0x5f1238){_0xa0024d[_0x6d13('0x43')]=_0x5f1238;return _0xa0024d;})[_0x6d13('0x22')](respondWithFilteredResult(_0x34abc4,_0x531e8c))[_0x6d13('0x44')](handleError(_0x34abc4,null));};exports[_0x6d13('0x45')]=function(_0x3f3746,_0x1b43b1){var _0x29b07e={'raw':![],'where':{'id':_0x3f3746[_0x6d13('0x46')]['id']}},_0x4bd115={};_0x4bd115['model']=_[_0x6d13('0x47')](db[_0x6d13('0x2d')][_0x6d13('0x2e')]);_0x4bd115[_0x6d13('0x33')]=_[_0x6d13('0x47')](_0x3f3746[_0x6d13('0x33')]);_0x4bd115[_0x6d13('0x3a')]=_[_0x6d13('0x34')](_0x4bd115['model'],_0x4bd115[_0x6d13('0x33')]);_0x29b07e['attributes']=_[_0x6d13('0x34')](_0x4bd115[_0x6d13('0x32')],qs[_0x6d13('0x36')](_0x3f3746[_0x6d13('0x33')][_0x6d13('0x36')]));_0x29b07e[_0x6d13('0x35')]=_0x29b07e[_0x6d13('0x35')][_0x6d13('0x37')]?_0x29b07e[_0x6d13('0x35')]:_0x4bd115[_0x6d13('0x32')];if(_0x3f3746[_0x6d13('0x33')]['includeAll']){_0x29b07e[_0x6d13('0x41')]=[{'all':!![]}];}_0x29b07e=_[_0x6d13('0x3e')]({},_0x29b07e,_0x3f3746[_0x6d13('0x3f')]);return db['VoiceChanSpy']['find'](_0x29b07e)[_0x6d13('0x22')](handleEntityNotFound(_0x1b43b1,null))[_0x6d13('0x22')](respondWithResult(_0x1b43b1,null))[_0x6d13('0x44')](handleError(_0x1b43b1,null));};exports['create']=function(_0x3ac978,_0x31872b){return db[_0x6d13('0x2d')]['create'](_0x3ac978[_0x6d13('0x48')],{})[_0x6d13('0x22')](function(_0x4de130){var _0x50134a=_0x3ac978[_0x6d13('0x49')][_0x6d13('0x24')]({'plain':!![]});if(!_0x50134a)throw new Error(_0x6d13('0x4a'));if(_0x50134a[_0x6d13('0x4b')]===_0x6d13('0x49')){var _0x3d3244=_0x4de130['get']({'plain':!![]});var _0x48f88a=_0x6d13('0x25');return db[_0x6d13('0x4c')][_0x6d13('0x4d')]({'where':{'name':_0x48f88a,'userProfileId':_0x50134a[_0x6d13('0x4e')]},'raw':!![]})[_0x6d13('0x22')](function(_0x5a9131){if(_0x5a9131&&_0x5a9131[_0x6d13('0x4f')]===0x0){return db['UserProfileResource'][_0x6d13('0x50')]({'name':_0x3d3244[_0x6d13('0x29')],'resourceId':_0x3d3244['id'],'type':_0x5a9131[_0x6d13('0x29')],'sectionId':_0x5a9131['id']},{})['then'](function(){return _0x4de130;});}else{return _0x4de130;}})[_0x6d13('0x44')](function(_0x53854e){logger['error'](_0x6d13('0x51'),_0x53854e);throw _0x53854e;});}return _0x4de130;})['then'](respondWithResult(_0x31872b,0xc9))[_0x6d13('0x44')](handleError(_0x31872b,null));};exports['update']=function(_0x13c342,_0x4962cd){if(_0x13c342[_0x6d13('0x48')]['id']){delete _0x13c342[_0x6d13('0x48')]['id'];}return db['VoiceChanSpy'][_0x6d13('0x4d')]({'where':{'id':_0x13c342['params']['id']}})[_0x6d13('0x22')](handleEntityNotFound(_0x4962cd,null))[_0x6d13('0x22')](saveUpdates(_0x13c342[_0x6d13('0x48')],null))[_0x6d13('0x22')](respondWithResult(_0x4962cd,null))['catch'](handleError(_0x4962cd,null));};exports[_0x6d13('0x23')]=function(_0x37bada,_0x35db79){return db[_0x6d13('0x2d')][_0x6d13('0x4d')]({'where':{'id':_0x37bada[_0x6d13('0x46')]['id']}})[_0x6d13('0x22')](handleEntityNotFound(_0x35db79,null))[_0x6d13('0x22')](removeEntity(_0x35db79,null))['catch'](handleError(_0x35db79,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1062cae..6daf53b 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 _0xdb52=['merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','auth','Authenticate','password','SIP/%s,%s','options','StopMixMonitor','length','internal','User','findAll','name','then','catch','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','context','from-sip','format','%s%s','prefix','push'];(function(_0x33f4a8,_0x2d7496){var _0x49606a=function(_0x460591){while(--_0x460591){_0x33f4a8['push'](_0x33f4a8['shift']());}};_0x49606a(++_0x2d7496);}(_0xdb52,0x80));var _0x2db5=function(_0x2fd02d,_0x178092){_0x2fd02d=_0x2fd02d-0x0;var _0x468c64=_0xdb52[_0x2fd02d];return _0x468c64;};'use strict';var _=require('lodash');var util=require(_0x2db5('0x0'));var BPromise=require(_0x2db5('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x2ced3b,_0x28e88d,_0x3452a3){var _0x284b9f=0x1;var _0x2e7365=[];var _0x33f20d={'context':_0x28e88d[_0x2db5('0x2')]||_0x2db5('0x3'),'exten':util[_0x2db5('0x4')](_0x2db5('0x5'),_0x2ced3b[_0x2db5('0x6')],_0x3452a3),'type':'system','isApp':![],'ChanSpyId':_0x2ced3b['id'],'UserId':_0x28e88d['id']};_0x2e7365[_0x2db5('0x7')](_[_0x2db5('0x8')]({'app':_0x2db5('0x9'),'appdata':util['format'](_0x2db5('0xa'),_0x2db5('0xb')),'priority':_0x284b9f++},_0x33f20d));if(_0x2ced3b[_0x2db5('0xc')]){_0x2e7365[_0x2db5('0x7')](_[_0x2db5('0x8')]({'app':'MixMonitor','appdata':util[_0x2db5('0x4')](_0x2db5('0xd'),_0x2ced3b['recordingFormat']),'priority':_0x284b9f++},_0x33f20d));}if(_0x2ced3b[_0x2db5('0xe')]){_0x2e7365[_0x2db5('0x7')](_[_0x2db5('0x8')]({'app':_0x2db5('0xf'),'appdata':_0x2ced3b[_0x2db5('0x10')],'priority':_0x284b9f++},_0x33f20d));}_0x2e7365[_0x2db5('0x7')](_[_0x2db5('0x8')]({'app':'ChanSpy','appdata':util['format'](_0x2db5('0x11'),_0x28e88d['name'],_0x2ced3b[_0x2db5('0x12')]?_0x2ced3b['options']['join'](''):''),'priority':_0x284b9f++},_0x33f20d));if(_0x2ced3b[_0x2db5('0xc')]){_0x2e7365[_0x2db5('0x7')](_['merge']({'app':_0x2db5('0x13'),'priority':_0x284b9f++},_0x33f20d));}return _0x2e7365;};var getChanSpyApplications=function(_0x17476f,_0x29233b){var _0x5c39f2=[];for(var _0x320ad7=0x0,_0x8656ca=0x1;_0x320ad7<_0x29233b[_0x2db5('0x14')];_0x320ad7++,_0x8656ca=0x1){_0x5c39f2=_0x5c39f2['concat'](getUserApplications(_0x17476f,_0x29233b[_0x320ad7],_0x29233b[_0x320ad7][_0x2db5('0x15')]));if(_0x29233b[_0x320ad7][_0x2db5('0x15')]!=_0x29233b[_0x320ad7]['name']){_0x5c39f2=_0x5c39f2['concat'](getUserApplications(_0x17476f,_0x29233b[_0x320ad7],_0x29233b[_0x320ad7]['name']));}}return _0x5c39f2;};var getChanSpyPromise=function(_0x23597f,_0xf887b5){return new BPromise(function(_0x3efc40,_0xc6d044){return _0x23597f[_0x2db5('0x16')][_0x2db5('0x17')]({'attributes':['id',_0x2db5('0x18'),_0x2db5('0x15')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x2db5('0x19')](function(_0x46e94d){if(_0x46e94d){return _0x3efc40(getChanSpyApplications(_0xf887b5,_0x46e94d));}return _0x3efc40([]);})[_0x2db5('0x1a')](function(_0x53afab){_0xc6d044(_0x53afab);});});};module[_0x2db5('0x1b')]=function(_0x24b097,_0x493dd5){var _0x457f60=_0x24b097[_0x2db5('0x1c')];return _0x24b097['define'](_0x2db5('0x1d'),attributes,{'tableName':_0x2db5('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xaf9a21,_0x2a6ab4,_0x26ac08){return getChanSpyPromise(_0x457f60,_0xaf9a21)['then'](function(_0x2feecd){if(_0x2feecd&&_0x2feecd['length']){return _0x457f60[_0x2db5('0x1f')][_0x2db5('0x20')](_0x2feecd);}})['then'](function(){_0x26ac08();})[_0x2db5('0x1a')](function(_0x299bc9){_0x26ac08(_0x299bc9);});},'afterUpdate':function(_0x3f2707,_0x3a4334,_0x2b5fde){return _0x457f60[_0x2db5('0x1f')]['destroy']({'where':{'ChanSpyId':_0x3f2707['id']}})[_0x2db5('0x19')](function(){return getChanSpyPromise(_0x457f60,_0x3f2707);})[_0x2db5('0x19')](function(_0x2213f5){if(_0x2213f5&&_0x2213f5[_0x2db5('0x14')]){return _0x457f60['VoiceExtension'][_0x2db5('0x20')](_0x2213f5);}})['then'](function(){_0x2b5fde();})[_0x2db5('0x1a')](function(_0x354c7f){_0x2b5fde(_0x354c7f);});},'afterDestroy':function(_0x1de76b,_0x7ffdd5,_0x2ca34f){return _0x457f60['VoiceExtension'][_0x2db5('0x21')]({'where':{'ChanSpyId':_0x1de76b['id']}})[_0x2db5('0x19')](function(){_0x2ca34f();})['catch'](function(_0x234af3){_0x2ca34f(_0x234af3);});}}});}; \ No newline at end of file +var _0x5990=['VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','merge','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','models','define','VoiceChanSpy'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x5990,0x17f));var _0x0599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5990[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0599('0x0'));var util=require(_0x0599('0x1'));var BPromise=require(_0x0599('0x2'));var attributes=require(_0x0599('0x3'));var getUserApplications=function(_0x4161ef,_0x5b70a1,_0xd5b7c3){var _0x4f008e=0x1;var _0x4fd434=[];var _0x2521aa={'context':_0x5b70a1[_0x0599('0x4')]||_0x0599('0x5'),'exten':util[_0x0599('0x6')]('%s%s',_0x4161ef[_0x0599('0x7')],_0xd5b7c3),'type':_0x0599('0x8'),'isApp':![],'ChanSpyId':_0x4161ef['id'],'UserId':_0x5b70a1['id']};_0x4fd434[_0x0599('0x9')](_['merge']({'app':'Set','appdata':util[_0x0599('0x6')](_0x0599('0xa'),_0x0599('0xb')),'priority':_0x4f008e++},_0x2521aa));if(_0x4161ef[_0x0599('0xc')]){_0x4fd434['push'](_['merge']({'app':_0x0599('0xd'),'appdata':util[_0x0599('0x6')](_0x0599('0xe'),_0x4161ef['recordingFormat']),'priority':_0x4f008e++},_0x2521aa));}if(_0x4161ef[_0x0599('0xf')]){_0x4fd434[_0x0599('0x9')](_[_0x0599('0x10')]({'app':_0x0599('0x11'),'appdata':_0x4161ef[_0x0599('0x12')],'priority':_0x4f008e++},_0x2521aa));}_0x4fd434[_0x0599('0x9')](_[_0x0599('0x10')]({'app':_0x0599('0x13'),'appdata':util[_0x0599('0x6')](_0x0599('0x14'),_0x5b70a1[_0x0599('0x15')],_0x4161ef[_0x0599('0x16')]?_0x4161ef['options']['join'](''):''),'priority':_0x4f008e++},_0x2521aa));if(_0x4161ef[_0x0599('0xc')]){_0x4fd434[_0x0599('0x9')](_['merge']({'app':_0x0599('0x17'),'priority':_0x4f008e++},_0x2521aa));}return _0x4fd434;};var getChanSpyApplications=function(_0x2ae85d,_0x189637){var _0x273348=[];for(var _0x3f8485=0x0,_0x1a02c4=0x1;_0x3f8485<_0x189637[_0x0599('0x18')];_0x3f8485++,_0x1a02c4=0x1){_0x273348=_0x273348[_0x0599('0x19')](getUserApplications(_0x2ae85d,_0x189637[_0x3f8485],_0x189637[_0x3f8485]['internal']));if(_0x189637[_0x3f8485][_0x0599('0x1a')]!=_0x189637[_0x3f8485][_0x0599('0x15')]){_0x273348=_0x273348[_0x0599('0x19')](getUserApplications(_0x2ae85d,_0x189637[_0x3f8485],_0x189637[_0x3f8485][_0x0599('0x15')]));}}return _0x273348;};var getChanSpyPromise=function(_0x13af4d,_0x392365){return new BPromise(function(_0x46a531,_0x259f4b){return _0x13af4d[_0x0599('0x1b')][_0x0599('0x1c')]({'attributes':['id',_0x0599('0x15'),_0x0599('0x1a')],'where':{'role':_0x0599('0x1d'),'chanspy':!![]},'raw':!![]})[_0x0599('0x1e')](function(_0x30a276){if(_0x30a276){return _0x46a531(getChanSpyApplications(_0x392365,_0x30a276));}return _0x46a531([]);})[_0x0599('0x1f')](function(_0x2f4b98){_0x259f4b(_0x2f4b98);});});};module['exports']=function(_0xce92ee,_0x32b2e7){var _0x33c895=_0xce92ee[_0x0599('0x20')];return _0xce92ee[_0x0599('0x21')](_0x0599('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x520981,_0x34c246,_0x34a396){return getChanSpyPromise(_0x33c895,_0x520981)['then'](function(_0x470510){if(_0x470510&&_0x470510[_0x0599('0x18')]){return _0x33c895[_0x0599('0x23')][_0x0599('0x24')](_0x470510);}})[_0x0599('0x1e')](function(){_0x34a396();})[_0x0599('0x1f')](function(_0x23f640){_0x34a396(_0x23f640);});},'afterUpdate':function(_0x740e85,_0x53e400,_0x3572c6){return _0x33c895[_0x0599('0x23')]['destroy']({'where':{'ChanSpyId':_0x740e85['id']}})[_0x0599('0x1e')](function(){return getChanSpyPromise(_0x33c895,_0x740e85);})[_0x0599('0x1e')](function(_0x52222d){if(_0x52222d&&_0x52222d[_0x0599('0x18')]){return _0x33c895[_0x0599('0x23')][_0x0599('0x24')](_0x52222d);}})['then'](function(){_0x3572c6();})[_0x0599('0x1f')](function(_0x48c121){_0x3572c6(_0x48c121);});},'afterDestroy':function(_0xa8082d,_0x415af0,_0x4b234f){return _0x33c895[_0x0599('0x23')][_0x0599('0x25')]({'where':{'ChanSpyId':_0xa8082d['id']}})[_0x0599('0x1e')](function(){_0x4b234f();})[_0x0599('0x1f')](function(_0x53d834){_0x4b234f(_0x53d834);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 641e66b..5fbe444 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 _0x5ec6=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','debug'];(function(_0x421c7c,_0x3beef3){var _0x1f5c72=function(_0x22168c){while(--_0x22168c){_0x421c7c['push'](_0x421c7c['shift']());}};_0x1f5c72(++_0x3beef3);}(_0x5ec6,0x7f));var _0x65ec=function(_0x272023,_0x3bc423){_0x272023=_0x272023-0x0;var _0xa4144c=_0x5ec6[_0x272023];return _0xa4144c;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});} \ No newline at end of file +var _0x235a=['http','then','VoiceChanSpy,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3493bb,_0x2b611a){var _0x549162=function(_0x1af2ba){while(--_0x1af2ba){_0x3493bb['push'](_0x3493bb['shift']());}};_0x549162(++_0x2b611a);}(_0x235a,0x1ef));var _0xa235=function(_0x5ed229,_0x1ac203){_0x5ed229=_0x5ed229-0x0;var _0x43f4c2=_0x235a[_0x5ed229];return _0x43f4c2;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require('bluebird');var rs=require(_0xa235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa235('0x4'))['db'];var utils=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var config=require(_0xa235('0x8'));var jayson=require(_0xa235('0x9'));var client=jayson[_0xa235('0xa')][_0xa235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b849b,_0x2e535e,_0x2dc1ba){return new BPromise(function(_0x450e27,_0x2f3403){return client['request'](_0x4b849b,_0x2dc1ba)[_0xa235('0xc')](function(_0x561602){logger['info'](_0xa235('0xd'),_0x2e535e,'request\x20sent');logger[_0xa235('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2e535e,'request\x20sent',JSON['stringify'](_0x561602));if(_0x561602[_0xa235('0xf')]){if(_0x561602[_0xa235('0xf')][_0xa235('0x10')]===0x1f4){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x561602['error']['message']);return _0x2f3403(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}logger[_0xa235('0xf')](_0xa235('0xd'),_0x2e535e,_0x561602[_0xa235('0xf')][_0xa235('0x11')]);return _0x450e27(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}else{logger[_0xa235('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0xa235('0x13'));_0x450e27(_0x561602[_0xa235('0x14')][_0xa235('0x11')]);}})[_0xa235('0x15')](function(_0x16dbe9){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x16dbe9);_0x2f3403(_0x16dbe9);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8bfc264..4b554df 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 _0xcf15=['post','create','put','isAuthenticated','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','./voiceContext.controller','get','index','show'];(function(_0x47d934,_0x405618){var _0x7c7e5b=function(_0x1511eb){while(--_0x1511eb){_0x47d934['push'](_0x47d934['shift']());}};_0x7c7e5b(++_0x405618);}(_0xcf15,0x17e));var _0x5cf1=function(_0xcd8813,_0x5228bd){_0xcd8813=_0xcd8813-0x0;var _0xf0f522=_0xcf15[_0xcd8813];return _0xf0f522;};'use strict';var multer=require(_0x5cf1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5cf1('0x1'));var express=require(_0x5cf1('0x2'));var router=express[_0x5cf1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5cf1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5cf1('0x5'));router[_0x5cf1('0x6')]('/',auth['isAuthenticated'](),controller[_0x5cf1('0x7')]);router[_0x5cf1('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x5cf1('0x8')]);router[_0x5cf1('0x9')]('/',auth['isAuthenticated'](),controller[_0x5cf1('0xa')]);router[_0x5cf1('0xb')]('/:id',auth[_0x5cf1('0xc')](),controller['update']);router[_0x5cf1('0xd')](_0x5cf1('0xe'),auth[_0x5cf1('0xc')](),controller[_0x5cf1('0xf')]);module[_0x5cf1('0x10')]=router; \ No newline at end of file +var _0x72f4=['post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show'];(function(_0xe8e439,_0x1fb310){var _0x44bcd8=function(_0x42bdba){while(--_0x42bdba){_0xe8e439['push'](_0xe8e439['shift']());}};_0x44bcd8(++_0x1fb310);}(_0x72f4,0x16a));var _0x472f=function(_0x1ba010,_0x27536){_0x1ba010=_0x1ba010-0x0;var _0x4e6d60=_0x72f4[_0x1ba010];return _0x4e6d60;};'use strict';var multer=require(_0x472f('0x0'));var util=require(_0x472f('0x1'));var path=require(_0x472f('0x2'));var timeout=require(_0x472f('0x3'));var express=require(_0x472f('0x4'));var router=express[_0x472f('0x5')]();var fs_extra=require(_0x472f('0x6'));var auth=require(_0x472f('0x7'));var interaction=require(_0x472f('0x8'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x472f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x472f('0x9')]('/:id',auth[_0x472f('0xa')](),controller[_0x472f('0xb')]);router[_0x472f('0xc')]('/',auth[_0x472f('0xa')](),controller['create']);router['put']('/:id',auth[_0x472f('0xa')](),controller[_0x472f('0xd')]);router[_0x472f('0xe')]('/:id',auth[_0x472f('0xa')](),controller[_0x472f('0xf')]);module[_0x472f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index aba0ea6..af980b8 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 _0x740e=['sequelize','name','STRING','BOOLEAN'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x740e,0x144));var _0xe740=function(_0x1162fd,_0x3f470c){_0x1162fd=_0x1162fd-0x0;var _0x32e449=_0x740e[_0x1162fd];return _0x32e449;};'use strict';var Sequelize=require(_0xe740('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe740('0x1')},'description':{'type':Sequelize[_0xe740('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe740('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c9c=['STRING','BOOLEAN','exports'];(function(_0x3098dc,_0xdde89c){var _0x68711=function(_0x3f2665){while(--_0x3f2665){_0x3098dc['push'](_0x3098dc['shift']());}};_0x68711(++_0xdde89c);}(_0x3c9c,0x131));var _0xc3c9=function(_0x3e9006,_0x1d98f1){_0x3e9006=_0x3e9006-0x0;var _0xbee0e5=_0x3c9c[_0x3e9006];return _0xbee0e5;};'use strict';var Sequelize=require('sequelize');module[_0xc3c9('0x0')]={'name':{'type':Sequelize[_0xc3c9('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xc3c9('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc3c9('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index a8d482e..2cb266f 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 _0x9877=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','offset','limit','count','set','json','apply','reject','save','update','destroy','Contexts','stack','name','index','VoiceContext','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','keys','length','find','create','join','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','readFileSync','server/files/templates/context.ejs','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x56d403,_0x5d2a62){var _0x24f353=function(_0x14d739){while(--_0x14d739){_0x56d403['push'](_0x56d403['shift']());}};_0x24f353(++_0x5d2a62);}(_0x9877,0xcf));var _0x7987=function(_0x3233d1,_0x54f5cb){_0x3233d1=_0x3233d1-0x0;var _0x276411=_0x9877[_0x3233d1];return _0x276411;};'use strict';var emlformat=require(_0x7987('0x0'));var rimraf=require(_0x7987('0x1'));var zipdir=require(_0x7987('0x2'));var jsonpatch=require(_0x7987('0x3'));var rp=require(_0x7987('0x4'));var moment=require(_0x7987('0x5'));var BPromise=require(_0x7987('0x6'));var Mustache=require(_0x7987('0x7'));var util=require(_0x7987('0x8'));var path=require(_0x7987('0x9'));var sox=require(_0x7987('0xa'));var csv=require(_0x7987('0xb'));var ejs=require(_0x7987('0xc'));var fs=require('fs');var fs_extra=require(_0x7987('0xd'));var _=require(_0x7987('0xe'));var squel=require(_0x7987('0xf'));var crypto=require('crypto');var jsforce=require(_0x7987('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7987('0xb'));var querystring=require(_0x7987('0x11'));var Papa=require(_0x7987('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7987('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7987('0x14'));var logger=require(_0x7987('0x15'))(_0x7987('0x16'));var utils=require(_0x7987('0x17'));var config=require(_0x7987('0x18'));var licenseUtil=require(_0x7987('0x19'));var db=require(_0x7987('0x1a'))['db'];var jayson=require(_0x7987('0x1b'));var client=jayson[_0x7987('0x1c')][_0x7987('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x178f0d,_0x4fa5d1,_0x15c76d,_0x472950){return new BPromise(function(_0x14fea6,_0x23fd42){var _0x584a57=_0x472950||client;return _0x584a57[_0x7987('0x1e')](_0x178f0d,_0x15c76d)[_0x7987('0x1f')](function(_0x5e565d){logger['info'](_0x7987('0x20'),_0x4fa5d1,_0x7987('0x21'));logger['debug'](_0x7987('0x22'),_0x4fa5d1,_0x7987('0x21'),JSON[_0x7987('0x23')](_0x5e565d));if(_0x5e565d['error']){if(_0x5e565d['error'][_0x7987('0x24')]===0x1f4){logger[_0x7987('0x25')](_0x7987('0x20'),_0x4fa5d1,_0x5e565d[_0x7987('0x25')][_0x7987('0x26')]);return _0x23fd42(_0x5e565d[_0x7987('0x25')][_0x7987('0x26')]);}logger[_0x7987('0x25')]('VoiceContext,\x20%s,\x20%s',_0x4fa5d1,_0x5e565d[_0x7987('0x25')]['message']);return _0x14fea6(_0x5e565d[_0x7987('0x25')][_0x7987('0x26')]);}else{logger[_0x7987('0x27')](_0x7987('0x20'),_0x4fa5d1,'request\x20sent');_0x14fea6(_0x5e565d[_0x7987('0x28')]['message']);}})[_0x7987('0x29')](function(_0x3df386){logger['error'](_0x7987('0x20'),_0x4fa5d1,_0x3df386);_0x23fd42(_0x3df386);});});}function respondWithStatusCode(_0x184250,_0x1f051d){_0x1f051d=_0x1f051d||0xcc;return function(_0x2b4c82){if(_0x2b4c82){return _0x184250[_0x7987('0x2a')](_0x1f051d);}return _0x184250[_0x7987('0x2b')](_0x1f051d)['end']();};}function respondWithResult(_0x5b7f59,_0x121767){_0x121767=_0x121767||0xc8;return function(_0x26ece2){if(_0x26ece2){return _0x5b7f59['status'](_0x121767)['json'](_0x26ece2);}};}function respondWithFilteredResult(_0x53cfb4,_0x3a6e){return function(_0x4b9b20){if(_0x4b9b20){var _0x494a8b=typeof _0x3a6e[_0x7987('0x2c')]==='undefined'&&typeof _0x3a6e[_0x7987('0x2d')]==='undefined';var _0x2551f8=_0x4b9b20[_0x7987('0x2e')];var _0x551ee7=_0x494a8b?0x0:_0x3a6e[_0x7987('0x2c')];var _0x546ed5=_0x494a8b?_0x4b9b20[_0x7987('0x2e')]:_0x3a6e['offset']+_0x3a6e[_0x7987('0x2d')];var _0x3a760d;if(_0x546ed5>=_0x2551f8){_0x546ed5=_0x2551f8;_0x3a760d=0xc8;}else{_0x3a760d=0xce;}_0x53cfb4[_0x7987('0x2b')](_0x3a760d);return _0x53cfb4[_0x7987('0x2f')]('Content-Range',_0x551ee7+'-'+_0x546ed5+'/'+_0x2551f8)[_0x7987('0x30')](_0x4b9b20);}return null;};}function patchUpdates(_0x4f45ff){return function(_0xb5045){try{jsonpatch[_0x7987('0x31')](_0xb5045,_0x4f45ff,!![]);}catch(_0x4d768b){return BPromise[_0x7987('0x32')](_0x4d768b);}return _0xb5045[_0x7987('0x33')]();};}function saveUpdates(_0x4b263b,_0xc18640){return function(_0x3c4d9c){if(_0x3c4d9c){return _0x3c4d9c[_0x7987('0x34')](_0x4b263b)[_0x7987('0x1f')](function(_0x2c2d4d){return _0x2c2d4d;});}return null;};}function removeEntity(_0x12201a,_0x2058ba){return function(_0x3b107c){if(_0x3b107c){return _0x3b107c[_0x7987('0x35')]()[_0x7987('0x1f')](function(){var _0x38389e=_0x3b107c['get']({'plain':!![]});var _0x16bdea=_0x7987('0x36');return db['UserProfileResource'][_0x7987('0x35')]({'where':{'type':_0x16bdea,'resourceId':_0x38389e['id']}})[_0x7987('0x1f')](function(){return _0x3b107c;});})['then'](function(){_0x12201a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x156f3a,_0x13ae83){return function(_0x2a612d){if(!_0x2a612d){_0x156f3a[_0x7987('0x2a')](0x194);}return _0x2a612d;};}function handleError(_0x54cde4,_0x24191e){_0x24191e=_0x24191e||0x1f4;return function(_0xf1692){logger[_0x7987('0x25')](_0xf1692[_0x7987('0x37')]);if(_0xf1692[_0x7987('0x38')]){delete _0xf1692['name'];}_0x54cde4[_0x7987('0x2b')](_0x24191e)['send'](_0xf1692);};}exports[_0x7987('0x39')]=function(_0x1c3ce2,_0xcafcb4){var _0x85c999={},_0x479ce7={},_0x18902d={'count':0x0,'rows':[]};var _0x57e019=_['map'](db[_0x7987('0x3a')][_0x7987('0x3b')],function(_0x2d494f){return{'name':_0x2d494f[_0x7987('0x3c')],'type':_0x2d494f[_0x7987('0x3d')]['key']};});_0x479ce7[_0x7987('0x3e')]=_['map'](_0x57e019,_0x7987('0x38'));_0x479ce7[_0x7987('0x3f')]=_['keys'](_0x1c3ce2['query']);_0x479ce7[_0x7987('0x40')]=_[_0x7987('0x41')](_0x479ce7['model'],_0x479ce7[_0x7987('0x3f')]);_0x85c999[_0x7987('0x42')]=_[_0x7987('0x41')](_0x479ce7['model'],qs[_0x7987('0x43')](_0x1c3ce2[_0x7987('0x3f')][_0x7987('0x43')]));_0x85c999[_0x7987('0x42')]=_0x85c999[_0x7987('0x42')]['length']?_0x85c999[_0x7987('0x42')]:_0x479ce7['model'];if(!_0x1c3ce2[_0x7987('0x3f')][_0x7987('0x44')]('nolimit')){_0x85c999[_0x7987('0x2d')]=qs['limit'](_0x1c3ce2['query'][_0x7987('0x2d')]);_0x85c999[_0x7987('0x2c')]=qs[_0x7987('0x2c')](_0x1c3ce2[_0x7987('0x3f')][_0x7987('0x2c')]);}_0x85c999[_0x7987('0x45')]=qs[_0x7987('0x46')](_0x1c3ce2['query'][_0x7987('0x46')]);_0x85c999[_0x7987('0x47')]=qs[_0x7987('0x40')](_[_0x7987('0x48')](_0x1c3ce2[_0x7987('0x3f')],_0x479ce7[_0x7987('0x40')]),_0x57e019);if(_0x1c3ce2['query'][_0x7987('0x49')]){_0x85c999[_0x7987('0x47')]=_[_0x7987('0x4a')](_0x85c999[_0x7987('0x47')],{'$or':_[_0x7987('0x4b')](_0x57e019,function(_0xc4b1e7){if(_0xc4b1e7[_0x7987('0x3d')]!==_0x7987('0x4c')){var _0x40c46e={};_0x40c46e[_0xc4b1e7[_0x7987('0x38')]]={'$like':'%'+_0x1c3ce2[_0x7987('0x3f')][_0x7987('0x49')]+'%'};return _0x40c46e;}})});}_0x85c999=_[_0x7987('0x4a')]({},_0x85c999,_0x1c3ce2[_0x7987('0x4d')]);var _0x4c6d61={'where':_0x85c999[_0x7987('0x47')]};return db['VoiceContext'][_0x7987('0x2e')](_0x4c6d61)[_0x7987('0x1f')](function(_0x3163a3){_0x18902d[_0x7987('0x2e')]=_0x3163a3;if(_0x1c3ce2[_0x7987('0x3f')][_0x7987('0x4e')]){_0x85c999[_0x7987('0x4f')]=[{'all':!![]}];}return db['VoiceContext'][_0x7987('0x50')](_0x85c999);})[_0x7987('0x1f')](function(_0x675ddd){_0x18902d[_0x7987('0x51')]=_0x675ddd;return _0x18902d;})[_0x7987('0x1f')](respondWithFilteredResult(_0xcafcb4,_0x85c999))['catch'](handleError(_0xcafcb4,null));};exports['show']=function(_0x542b00,_0x14e704){var _0x52e81e={'raw':![],'where':{'id':_0x542b00['params']['id']}},_0x2cd24e={};_0x2cd24e[_0x7987('0x3e')]=_[_0x7987('0x52')](db[_0x7987('0x3a')]['rawAttributes']);_0x2cd24e[_0x7987('0x3f')]=_[_0x7987('0x52')](_0x542b00[_0x7987('0x3f')]);_0x2cd24e['filters']=_[_0x7987('0x41')](_0x2cd24e[_0x7987('0x3e')],_0x2cd24e['query']);_0x52e81e[_0x7987('0x42')]=_[_0x7987('0x41')](_0x2cd24e['model'],qs[_0x7987('0x43')](_0x542b00[_0x7987('0x3f')][_0x7987('0x43')]));_0x52e81e[_0x7987('0x42')]=_0x52e81e['attributes'][_0x7987('0x53')]?_0x52e81e[_0x7987('0x42')]:_0x2cd24e['model'];if(_0x542b00[_0x7987('0x3f')]['includeAll']){_0x52e81e[_0x7987('0x4f')]=[{'all':!![]}];}_0x52e81e=_[_0x7987('0x4a')]({},_0x52e81e,_0x542b00[_0x7987('0x4d')]);return db[_0x7987('0x3a')][_0x7987('0x54')](_0x52e81e)[_0x7987('0x1f')](handleEntityNotFound(_0x14e704,null))['then'](respondWithResult(_0x14e704,null))[_0x7987('0x29')](handleError(_0x14e704,null));};exports[_0x7987('0x55')]=function(_0x51bc87,_0xb96abd,_0x52707f){var _0x28fa7a;return db[_0x7987('0x3a')][_0x7987('0x55')](_0x51bc87['body'],{'raw':!![]})['then'](function(_0x48c8e7){_0x28fa7a=_0x48c8e7;return db[_0x7987('0x3a')][_0x7987('0x50')]({'raw':!![]});})[_0x7987('0x1f')](function(_0x4b59d1){var _0xb5d857=fs['readFileSync'](path[_0x7987('0x56')](config[_0x7987('0x57')],'server/files/templates/context.ejs'),_0x7987('0x58'));var _0x268ddd=ejs[_0x7987('0x59')](_0xb5d857,{'contexts':_0x4b59d1||[]});fs['writeFileSync'](_0x7987('0x5a'),_0x268ddd);})[_0x7987('0x1f')](function(){return respondWithRpcPromise(_0x7987('0x5b'),_0x7987('0x55'),{'module':_0x7987('0x5c')});})[_0x7987('0x1f')](function(){var _0x244e48=_0x51bc87[_0x7987('0x5d')][_0x7987('0x5e')]({'plain':!![]});if(!_0x244e48)throw new Error(_0x7987('0x5f'));if(_0x244e48[_0x7987('0x60')]==='user'){var _0x31329e=_0x28fa7a[_0x7987('0x5e')]({'plain':!![]});return db[_0x7987('0x61')][_0x7987('0x54')]({'where':{'name':_0x7987('0x36'),'userProfileId':_0x244e48[_0x7987('0x62')]},'raw':!![]})['then'](function(_0x5d4e58){if(_0x5d4e58&&_0x5d4e58[_0x7987('0x63')]===0x0){return db[_0x7987('0x64')][_0x7987('0x55')]({'name':_0x31329e[_0x7987('0x38')],'resourceId':_0x31329e['id'],'type':_0x5d4e58[_0x7987('0x38')],'sectionId':_0x5d4e58['id']},{})['then'](function(){return _0x28fa7a;});}else{return _0x28fa7a;}})['catch'](function(_0x44abe9){logger[_0x7987('0x25')](_0x7987('0x65'),_0x44abe9);throw _0x44abe9;});}return _0x28fa7a;})[_0x7987('0x1f')](respondWithResult(_0xb96abd,0xc9))[_0x7987('0x29')](handleError(_0xb96abd,null));};exports[_0x7987('0x34')]=function(_0x1b7e6e,_0x1bae29,_0x55d856){var _0x223ffd;return db[_0x7987('0x3a')][_0x7987('0x54')]({'where':{'id':_0x1b7e6e[_0x7987('0x66')]['id']}})[_0x7987('0x1f')](handleEntityNotFound(_0x1bae29,null))[_0x7987('0x1f')](saveUpdates(_0x1b7e6e[_0x7987('0x67')],null))[_0x7987('0x1f')](function(_0xe3863a){if(_0xe3863a){_0x223ffd=_0xe3863a;return db[_0x7987('0x3a')]['findAll']({'raw':!![]});}})[_0x7987('0x1f')](function(_0x573ce0){var _0x46ec15=fs[_0x7987('0x68')](path[_0x7987('0x56')](config['root'],_0x7987('0x69')),'utf8');var _0x3e14ea=ejs[_0x7987('0x59')](_0x46ec15,{'contexts':_0x573ce0||[]});fs[_0x7987('0x6a')](_0x7987('0x5a'),_0x3e14ea);})[_0x7987('0x1f')](function(){return respondWithRpcPromise('Reload',_0x7987('0x34'),{'module':_0x7987('0x5c')});})[_0x7987('0x1f')](function(){return _0x223ffd;})[_0x7987('0x1f')](respondWithResult(_0x1bae29,null))[_0x7987('0x29')](handleError(_0x1bae29,null));};exports[_0x7987('0x35')]=function(_0xe59548,_0x3b84ec,_0x491700){var _0x29befb;return db[_0x7987('0x3a')][_0x7987('0x54')]({'where':{'id':_0xe59548[_0x7987('0x66')]['id']}})[_0x7987('0x1f')](handleEntityNotFound(_0x3b84ec,null))[_0x7987('0x1f')](removeEntity(_0x3b84ec,null))[_0x7987('0x1f')](function(){return db[_0x7987('0x3a')][_0x7987('0x50')]({'raw':!![]});})[_0x7987('0x1f')](function(_0x30d952){var _0x40e788=fs[_0x7987('0x68')](path['join'](config[_0x7987('0x57')],'server/files/templates/context.ejs'),_0x7987('0x58'));var _0x3cc774=ejs[_0x7987('0x59')](_0x40e788,{'contexts':_0x30d952});fs['writeFileSync'](_0x7987('0x5a'),_0x3cc774);return respondWithRpcPromise('Reload',_0x7987('0x35'),{'module':_0x7987('0x5c')});})['catch'](handleError(_0x3b84ec,null));}; \ No newline at end of file +var _0x4c9a=['VoiceContext','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','findAll','utf8','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','index','map'];(function(_0x4fe350,_0x5e5c06){var _0x29de24=function(_0x58a874){while(--_0x58a874){_0x4fe350['push'](_0x4fe350['shift']());}};_0x29de24(++_0x5e5c06);}(_0x4c9a,0x96));var _0xa4c9=function(_0x35771b,_0x57e19b){_0x35771b=_0x35771b-0x0;var _0x57b06e=_0x4c9a[_0x35771b];return _0x57b06e;};'use strict';var emlformat=require(_0xa4c9('0x0'));var rimraf=require(_0xa4c9('0x1'));var zipdir=require(_0xa4c9('0x2'));var jsonpatch=require(_0xa4c9('0x3'));var rp=require(_0xa4c9('0x4'));var moment=require(_0xa4c9('0x5'));var BPromise=require(_0xa4c9('0x6'));var Mustache=require(_0xa4c9('0x7'));var util=require(_0xa4c9('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa4c9('0x9'));var ejs=require(_0xa4c9('0xa'));var fs=require('fs');var fs_extra=require(_0xa4c9('0xb'));var _=require('lodash');var squel=require(_0xa4c9('0xc'));var crypto=require(_0xa4c9('0xd'));var jsforce=require(_0xa4c9('0xe'));var deskjs=require(_0xa4c9('0xf'));var toCsv=require(_0xa4c9('0x9'));var querystring=require('querystring');var Papa=require(_0xa4c9('0x10'));var Redis=require(_0xa4c9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa4c9('0x12'));var hardwareService=require(_0xa4c9('0x13'));var logger=require(_0xa4c9('0x14'))('api');var utils=require(_0xa4c9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa4c9('0x16'));var db=require(_0xa4c9('0x17'))['db'];var jayson=require(_0xa4c9('0x18'));var client=jayson[_0xa4c9('0x19')][_0xa4c9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x11d775,_0x3140a3,_0x3a4822,_0x3bde07){return new BPromise(function(_0x3073c7,_0xdea982){var _0x146140=_0x3bde07||client;return _0x146140[_0xa4c9('0x1b')](_0x11d775,_0x3a4822)[_0xa4c9('0x1c')](function(_0x4890f5){logger[_0xa4c9('0x1d')](_0xa4c9('0x1e'),_0x3140a3,_0xa4c9('0x1f'));logger[_0xa4c9('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3140a3,_0xa4c9('0x1f'),JSON[_0xa4c9('0x21')](_0x4890f5));if(_0x4890f5[_0xa4c9('0x22')]){if(_0x4890f5['error'][_0xa4c9('0x23')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3140a3,_0x4890f5[_0xa4c9('0x22')][_0xa4c9('0x24')]);return _0xdea982(_0x4890f5[_0xa4c9('0x22')][_0xa4c9('0x24')]);}logger[_0xa4c9('0x22')]('VoiceContext,\x20%s,\x20%s',_0x3140a3,_0x4890f5[_0xa4c9('0x22')]['message']);return _0x3073c7(_0x4890f5[_0xa4c9('0x22')][_0xa4c9('0x24')]);}else{logger['info'](_0xa4c9('0x1e'),_0x3140a3,_0xa4c9('0x1f'));_0x3073c7(_0x4890f5[_0xa4c9('0x25')][_0xa4c9('0x24')]);}})[_0xa4c9('0x26')](function(_0x374bba){logger[_0xa4c9('0x22')](_0xa4c9('0x1e'),_0x3140a3,_0x374bba);_0xdea982(_0x374bba);});});}function respondWithStatusCode(_0x1ace31,_0x204a9b){_0x204a9b=_0x204a9b||0xcc;return function(_0x5f26dd){if(_0x5f26dd){return _0x1ace31[_0xa4c9('0x27')](_0x204a9b);}return _0x1ace31['status'](_0x204a9b)[_0xa4c9('0x28')]();};}function respondWithResult(_0xcda250,_0x307425){_0x307425=_0x307425||0xc8;return function(_0x3dd5cf){if(_0x3dd5cf){return _0xcda250[_0xa4c9('0x29')](_0x307425)['json'](_0x3dd5cf);}};}function respondWithFilteredResult(_0x20a44a,_0x4e229e){return function(_0xa89156){if(_0xa89156){var _0xbd675=typeof _0x4e229e['offset']===_0xa4c9('0x2a')&&typeof _0x4e229e[_0xa4c9('0x2b')]===_0xa4c9('0x2a');var _0x2da529=_0xa89156[_0xa4c9('0x2c')];var _0x190fc6=_0xbd675?0x0:_0x4e229e[_0xa4c9('0x2d')];var _0x14ea27=_0xbd675?_0xa89156[_0xa4c9('0x2c')]:_0x4e229e['offset']+_0x4e229e[_0xa4c9('0x2b')];var _0x430b9c;if(_0x14ea27>=_0x2da529){_0x14ea27=_0x2da529;_0x430b9c=0xc8;}else{_0x430b9c=0xce;}_0x20a44a[_0xa4c9('0x29')](_0x430b9c);return _0x20a44a['set'](_0xa4c9('0x2e'),_0x190fc6+'-'+_0x14ea27+'/'+_0x2da529)[_0xa4c9('0x2f')](_0xa89156);}return null;};}function patchUpdates(_0xd5847f){return function(_0x54b622){try{jsonpatch[_0xa4c9('0x30')](_0x54b622,_0xd5847f,!![]);}catch(_0x15fc51){return BPromise[_0xa4c9('0x31')](_0x15fc51);}return _0x54b622[_0xa4c9('0x32')]();};}function saveUpdates(_0x5f344b,_0x19f76d){return function(_0x598a12){if(_0x598a12){return _0x598a12[_0xa4c9('0x33')](_0x5f344b)[_0xa4c9('0x1c')](function(_0x30ffc4){return _0x30ffc4;});}return null;};}function removeEntity(_0x43e801,_0x1efa94){return function(_0x56473f){if(_0x56473f){return _0x56473f['destroy']()['then'](function(){var _0x45dd16=_0x56473f[_0xa4c9('0x34')]({'plain':!![]});var _0x5ee609=_0xa4c9('0x35');return db[_0xa4c9('0x36')][_0xa4c9('0x37')]({'where':{'type':_0x5ee609,'resourceId':_0x45dd16['id']}})[_0xa4c9('0x1c')](function(){return _0x56473f;});})[_0xa4c9('0x1c')](function(){_0x43e801[_0xa4c9('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ecf43,_0x5b754b){return function(_0x31fce1){if(!_0x31fce1){_0x5ecf43[_0xa4c9('0x27')](0x194);}return _0x31fce1;};}function handleError(_0x58550c,_0x1304d6){_0x1304d6=_0x1304d6||0x1f4;return function(_0x1be030){logger[_0xa4c9('0x22')](_0x1be030[_0xa4c9('0x38')]);if(_0x1be030[_0xa4c9('0x39')]){delete _0x1be030[_0xa4c9('0x39')];}_0x58550c[_0xa4c9('0x29')](_0x1304d6)['send'](_0x1be030);};}exports[_0xa4c9('0x3a')]=function(_0x2cca43,_0x5c603d){var _0x1bbda2={},_0x15aa21={},_0x3aba04={'count':0x0,'rows':[]};var _0x1715d4=_[_0xa4c9('0x3b')](db[_0xa4c9('0x3c')]['rawAttributes'],function(_0x3ef661){return{'name':_0x3ef661[_0xa4c9('0x3d')],'type':_0x3ef661['type'][_0xa4c9('0x3e')]};});_0x15aa21['model']=_[_0xa4c9('0x3b')](_0x1715d4,_0xa4c9('0x39'));_0x15aa21[_0xa4c9('0x3f')]=_[_0xa4c9('0x40')](_0x2cca43[_0xa4c9('0x3f')]);_0x15aa21[_0xa4c9('0x41')]=_[_0xa4c9('0x42')](_0x15aa21['model'],_0x15aa21[_0xa4c9('0x3f')]);_0x1bbda2[_0xa4c9('0x43')]=_[_0xa4c9('0x42')](_0x15aa21[_0xa4c9('0x44')],qs[_0xa4c9('0x45')](_0x2cca43['query'][_0xa4c9('0x45')]));_0x1bbda2['attributes']=_0x1bbda2[_0xa4c9('0x43')][_0xa4c9('0x46')]?_0x1bbda2[_0xa4c9('0x43')]:_0x15aa21[_0xa4c9('0x44')];if(!_0x2cca43[_0xa4c9('0x3f')][_0xa4c9('0x47')]('nolimit')){_0x1bbda2[_0xa4c9('0x2b')]=qs['limit'](_0x2cca43[_0xa4c9('0x3f')][_0xa4c9('0x2b')]);_0x1bbda2[_0xa4c9('0x2d')]=qs['offset'](_0x2cca43['query'][_0xa4c9('0x2d')]);}_0x1bbda2[_0xa4c9('0x48')]=qs[_0xa4c9('0x49')](_0x2cca43['query']['sort']);_0x1bbda2[_0xa4c9('0x4a')]=qs[_0xa4c9('0x41')](_[_0xa4c9('0x4b')](_0x2cca43[_0xa4c9('0x3f')],_0x15aa21[_0xa4c9('0x41')]),_0x1715d4);if(_0x2cca43[_0xa4c9('0x3f')][_0xa4c9('0x4c')]){_0x1bbda2['where']=_[_0xa4c9('0x4d')](_0x1bbda2[_0xa4c9('0x4a')],{'$or':_['map'](_0x1715d4,function(_0x1a6d31){if(_0x1a6d31[_0xa4c9('0x4e')]!==_0xa4c9('0x4f')){var _0x1d41f1={};_0x1d41f1[_0x1a6d31[_0xa4c9('0x39')]]={'$like':'%'+_0x2cca43['query'][_0xa4c9('0x4c')]+'%'};return _0x1d41f1;}})});}_0x1bbda2=_['merge']({},_0x1bbda2,_0x2cca43[_0xa4c9('0x50')]);var _0x4167cb={'where':_0x1bbda2['where']};return db[_0xa4c9('0x3c')][_0xa4c9('0x2c')](_0x4167cb)['then'](function(_0x507576){_0x3aba04[_0xa4c9('0x2c')]=_0x507576;if(_0x2cca43[_0xa4c9('0x3f')][_0xa4c9('0x51')]){_0x1bbda2[_0xa4c9('0x52')]=[{'all':!![]}];}return db[_0xa4c9('0x3c')]['findAll'](_0x1bbda2);})['then'](function(_0x1ff395){_0x3aba04[_0xa4c9('0x53')]=_0x1ff395;return _0x3aba04;})['then'](respondWithFilteredResult(_0x5c603d,_0x1bbda2))[_0xa4c9('0x26')](handleError(_0x5c603d,null));};exports[_0xa4c9('0x54')]=function(_0x17f212,_0xd0b38f){var _0x35d258={'raw':![],'where':{'id':_0x17f212[_0xa4c9('0x55')]['id']}},_0x1e934e={};_0x1e934e[_0xa4c9('0x44')]=_[_0xa4c9('0x40')](db[_0xa4c9('0x3c')][_0xa4c9('0x56')]);_0x1e934e['query']=_[_0xa4c9('0x40')](_0x17f212[_0xa4c9('0x3f')]);_0x1e934e['filters']=_[_0xa4c9('0x42')](_0x1e934e[_0xa4c9('0x44')],_0x1e934e['query']);_0x35d258[_0xa4c9('0x43')]=_['intersection'](_0x1e934e['model'],qs[_0xa4c9('0x45')](_0x17f212[_0xa4c9('0x3f')][_0xa4c9('0x45')]));_0x35d258[_0xa4c9('0x43')]=_0x35d258[_0xa4c9('0x43')][_0xa4c9('0x46')]?_0x35d258[_0xa4c9('0x43')]:_0x1e934e[_0xa4c9('0x44')];if(_0x17f212[_0xa4c9('0x3f')][_0xa4c9('0x51')]){_0x35d258[_0xa4c9('0x52')]=[{'all':!![]}];}_0x35d258=_[_0xa4c9('0x4d')]({},_0x35d258,_0x17f212[_0xa4c9('0x50')]);return db[_0xa4c9('0x3c')][_0xa4c9('0x57')](_0x35d258)['then'](handleEntityNotFound(_0xd0b38f,null))[_0xa4c9('0x1c')](respondWithResult(_0xd0b38f,null))[_0xa4c9('0x26')](handleError(_0xd0b38f,null));};exports[_0xa4c9('0x58')]=function(_0x1c2c01,_0x3524f7,_0x5a7e44){var _0x428925;return db[_0xa4c9('0x3c')][_0xa4c9('0x58')](_0x1c2c01[_0xa4c9('0x59')],{'raw':!![]})[_0xa4c9('0x1c')](function(_0x298a83){_0x428925=_0x298a83;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x2fb06f){var _0x1072ff=fs[_0xa4c9('0x5a')](path[_0xa4c9('0x5b')](config[_0xa4c9('0x5c')],_0xa4c9('0x5d')),'utf8');var _0x509736=ejs[_0xa4c9('0x5e')](_0x1072ff,{'contexts':_0x2fb06f||[]});fs[_0xa4c9('0x5f')](_0xa4c9('0x60'),_0x509736);})[_0xa4c9('0x1c')](function(){return respondWithRpcPromise(_0xa4c9('0x61'),_0xa4c9('0x58'),{'module':_0xa4c9('0x62')});})['then'](function(){var _0x29ce0c=_0x1c2c01['user'][_0xa4c9('0x34')]({'plain':!![]});if(!_0x29ce0c)throw new Error(_0xa4c9('0x63'));if(_0x29ce0c[_0xa4c9('0x64')]==='user'){var _0x11e0e6=_0x428925['get']({'plain':!![]});return db['UserProfileSection'][_0xa4c9('0x57')]({'where':{'name':_0xa4c9('0x35'),'userProfileId':_0x29ce0c[_0xa4c9('0x65')]},'raw':!![]})[_0xa4c9('0x1c')](function(_0x44f89a){if(_0x44f89a&&_0x44f89a[_0xa4c9('0x66')]===0x0){return db[_0xa4c9('0x36')][_0xa4c9('0x58')]({'name':_0x11e0e6[_0xa4c9('0x39')],'resourceId':_0x11e0e6['id'],'type':_0x44f89a['name'],'sectionId':_0x44f89a['id']},{})[_0xa4c9('0x1c')](function(){return _0x428925;});}else{return _0x428925;}})['catch'](function(_0x2b6aa0){logger[_0xa4c9('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b6aa0);throw _0x2b6aa0;});}return _0x428925;})[_0xa4c9('0x1c')](respondWithResult(_0x3524f7,0xc9))['catch'](handleError(_0x3524f7,null));};exports[_0xa4c9('0x33')]=function(_0x2afc27,_0x125583,_0x81fa3e){var _0x1218ef;return db[_0xa4c9('0x3c')][_0xa4c9('0x57')]({'where':{'id':_0x2afc27[_0xa4c9('0x55')]['id']}})[_0xa4c9('0x1c')](handleEntityNotFound(_0x125583,null))[_0xa4c9('0x1c')](saveUpdates(_0x2afc27[_0xa4c9('0x59')],null))['then'](function(_0x4ba7bb){if(_0x4ba7bb){_0x1218ef=_0x4ba7bb;return db[_0xa4c9('0x3c')][_0xa4c9('0x67')]({'raw':!![]});}})[_0xa4c9('0x1c')](function(_0x126228){var _0x57f5e4=fs[_0xa4c9('0x5a')](path[_0xa4c9('0x5b')](config[_0xa4c9('0x5c')],_0xa4c9('0x5d')),_0xa4c9('0x68'));var _0x211039=ejs['render'](_0x57f5e4,{'contexts':_0x126228||[]});fs[_0xa4c9('0x5f')](_0xa4c9('0x60'),_0x211039);})['then'](function(){return respondWithRpcPromise(_0xa4c9('0x61'),_0xa4c9('0x33'),{'module':'chan_sip.so'});})[_0xa4c9('0x1c')](function(){return _0x1218ef;})[_0xa4c9('0x1c')](respondWithResult(_0x125583,null))[_0xa4c9('0x26')](handleError(_0x125583,null));};exports[_0xa4c9('0x37')]=function(_0x3375b3,_0x14f546,_0x58bed7){var _0xace0fc;return db['VoiceContext'][_0xa4c9('0x57')]({'where':{'id':_0x3375b3[_0xa4c9('0x55')]['id']}})[_0xa4c9('0x1c')](handleEntityNotFound(_0x14f546,null))[_0xa4c9('0x1c')](removeEntity(_0x14f546,null))[_0xa4c9('0x1c')](function(){return db['VoiceContext'][_0xa4c9('0x67')]({'raw':!![]});})[_0xa4c9('0x1c')](function(_0xa3272b){var _0x2c6cb2=fs['readFileSync'](path[_0xa4c9('0x5b')](config[_0xa4c9('0x5c')],_0xa4c9('0x5d')),_0xa4c9('0x68'));var _0x23d2e9=ejs[_0xa4c9('0x5e')](_0x2c6cb2,{'contexts':_0xa3272b});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x23d2e9);return respondWithRpcPromise(_0xa4c9('0x61'),_0xa4c9('0x37'),{'module':_0xa4c9('0x62')});})[_0xa4c9('0x26')](handleError(_0x14f546,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 5585d0e..9f213a5 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 _0x5a9b=['../../config/environment','exports','define','VoiceContext','util','../../config/logger','api','bluebird'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x5a9b,0x18c));var _0xb5a9=function(_0x147445,_0x91a83b){_0x147445=_0x147445-0x0;var _0x12becb=_0x5a9b[_0x147445];return _0x12becb;};'use strict';var _=require('lodash');var util=require(_0xb5a9('0x0'));var logger=require(_0xb5a9('0x1'))(_0xb5a9('0x2'));var moment=require('moment');var BPromise=require(_0xb5a9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb5a9('0x4'));var attributes=require('./voiceContext.attributes');module[_0xb5a9('0x5')]=function(_0x26a77e,_0x1fb4ca){return _0x26a77e[_0xb5a9('0x6')](_0xb5a9('0x7'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39bc=['bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','util','../../config/logger','api','moment'];(function(_0x32e865,_0x317078){var _0x850461=function(_0x37417f){while(--_0x37417f){_0x32e865['push'](_0x32e865['shift']());}};_0x850461(++_0x317078);}(_0x39bc,0xf8));var _0xc39b=function(_0x527400,_0x4ea483){_0x527400=_0x527400-0x0;var _0x4e06b4=_0x39bc[_0x527400];return _0x4e06b4;};'use strict';var _=require('lodash');var util=require(_0xc39b('0x0'));var logger=require(_0xc39b('0x1'))(_0xc39b('0x2'));var moment=require(_0xc39b('0x3'));var BPromise=require(_0xc39b('0x4'));var rp=require(_0xc39b('0x5'));var fs=require('fs');var path=require(_0xc39b('0x6'));var rimraf=require('rimraf');var config=require(_0xc39b('0x7'));var attributes=require(_0xc39b('0x8'));module['exports']=function(_0x196c5e,_0xdb15f0){return _0x196c5e[_0xc39b('0x9')](_0xc39b('0xa'),attributes,{'tableName':_0xc39b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index e0f4a47..2527d58 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 _0x13eb=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x13eb,0x8f));var _0xb13e=function(_0xc81f5f,_0x181205){_0xc81f5f=_0xc81f5f-0x0;var _0x4410dc=_0x13eb[_0xc81f5f];return _0x4410dc;};'use strict';var _=require(_0xb13e('0x0'));var util=require(_0xb13e('0x1'));var moment=require('moment');var BPromise=require(_0xb13e('0x2'));var rs=require(_0xb13e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb13e('0x4'))['db'];var utils=require(_0xb13e('0x5'));var logger=require(_0xb13e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb13e('0x7'));var client=jayson[_0xb13e('0x8')][_0xb13e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1722ad,_0x215b85,_0x2184d5){return new BPromise(function(_0x4c2374,_0x3390be){return client[_0xb13e('0xa')](_0x1722ad,_0x2184d5)['then'](function(_0x44e6b4){logger[_0xb13e('0xb')](_0xb13e('0xc'),_0x215b85,_0xb13e('0xd'));logger[_0xb13e('0xe')](_0xb13e('0xf'),_0x215b85,_0xb13e('0xd'),JSON[_0xb13e('0x10')](_0x44e6b4));if(_0x44e6b4[_0xb13e('0x11')]){if(_0x44e6b4[_0xb13e('0x11')]['code']===0x1f4){logger[_0xb13e('0x11')](_0xb13e('0xc'),_0x215b85,_0x44e6b4[_0xb13e('0x11')][_0xb13e('0x12')]);return _0x3390be(_0x44e6b4['error'][_0xb13e('0x12')]);}logger[_0xb13e('0x11')](_0xb13e('0xc'),_0x215b85,_0x44e6b4[_0xb13e('0x11')][_0xb13e('0x12')]);return _0x4c2374(_0x44e6b4[_0xb13e('0x11')][_0xb13e('0x12')]);}else{logger[_0xb13e('0xb')](_0xb13e('0xc'),_0x215b85,_0xb13e('0xd'));_0x4c2374(_0x44e6b4[_0xb13e('0x13')][_0xb13e('0x12')]);}})[_0xb13e('0x14')](function(_0x3e5fa2){logger[_0xb13e('0x11')](_0xb13e('0xc'),_0x215b85,_0x3e5fa2);_0x3390be(_0x3e5fa2);});});} \ No newline at end of file +var _0x1b0e=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1b0e,0x132));var _0xe1b0=function(_0x1e7274,_0x4c2493){_0x1e7274=_0x1e7274-0x0;var _0x6aad07=_0x1b0e[_0x1e7274];return _0x6aad07;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 2e599ad..29af487 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 _0xa486=['/:id','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','create','put'];(function(_0x19e6b3,_0x433159){var _0x2649f2=function(_0x31d402){while(--_0x31d402){_0x19e6b3['push'](_0x19e6b3['shift']());}};_0x2649f2(++_0x433159);}(_0xa486,0xd5));var _0x6a48=function(_0x417285,_0x421d14){_0x417285=_0x417285-0x0;var _0x293c6b=_0xa486[_0x417285];return _0x293c6b;};'use strict';var multer=require(_0x6a48('0x0'));var util=require('util');var path=require(_0x6a48('0x1'));var timeout=require(_0x6a48('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6a48('0x3'));var auth=require(_0x6a48('0x4'));var interaction=require(_0x6a48('0x5'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x6a48('0x6')]('/',auth[_0x6a48('0x7')](),controller[_0x6a48('0x8')]);router['get'](_0x6a48('0x9'),auth[_0x6a48('0x7')](),controller[_0x6a48('0xa')]);router[_0x6a48('0x6')]('/:id',auth[_0x6a48('0x7')](),controller[_0x6a48('0xb')]);router[_0x6a48('0xc')]('/',auth[_0x6a48('0x7')](),controller[_0x6a48('0xd')]);router[_0x6a48('0xe')](_0x6a48('0xf'),auth[_0x6a48('0x7')](),controller['update']);router[_0x6a48('0x10')](_0x6a48('0xf'),auth[_0x6a48('0x7')](),controller[_0x6a48('0x11')]);module[_0x6a48('0x12')]=router; \ No newline at end of file +var _0x085c=['exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','delete'];(function(_0x3af318,_0x481b7b){var _0x12f367=function(_0x4056da){while(--_0x4056da){_0x3af318['push'](_0x3af318['shift']());}};_0x12f367(++_0x481b7b);}(_0x085c,0xd9));var _0xc085=function(_0x48f9d2,_0x33ba0d){_0x48f9d2=_0x48f9d2-0x0;var _0x5228da=_0x085c[_0x48f9d2];return _0x5228da;};'use strict';var multer=require(_0xc085('0x0'));var util=require(_0xc085('0x1'));var path=require(_0xc085('0x2'));var timeout=require('connect-timeout');var express=require(_0xc085('0x3'));var router=express['Router']();var fs_extra=require(_0xc085('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc085('0x5'));var config=require(_0xc085('0x6'));var controller=require(_0xc085('0x7'));router[_0xc085('0x8')]('/',auth['isAuthenticated'](),controller[_0xc085('0x9')]);router[_0xc085('0x8')](_0xc085('0xa'),auth[_0xc085('0xb')](),controller[_0xc085('0xc')]);router[_0xc085('0x8')](_0xc085('0xd'),auth['isAuthenticated'](),controller[_0xc085('0xe')]);router['post']('/',auth[_0xc085('0xb')](),controller['create']);router[_0xc085('0xf')](_0xc085('0xd'),auth[_0xc085('0xb')](),controller['update']);router[_0xc085('0x10')](_0xc085('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc085('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index cfde1bd..e9c7a9f 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 _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3550c9,_0x1d6cb0){var _0x59fd90=function(_0x269468){while(--_0x269468){_0x3550c9['push'](_0x3550c9['shift']());}};_0x59fd90(++_0x1d6cb0);}(_0x98a8,0x12c));var _0x898a=function(_0x1d1867,_0x1cdce8){_0x1d1867=_0x1d1867-0x0;var _0x168217=_0x98a8[_0x1d1867];return _0x168217;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file +var _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x1f8ba1,_0x3232cf){var _0x2a501e=function(_0x45ba34){while(--_0x45ba34){_0x1f8ba1['push'](_0x1f8ba1['shift']());}};_0x2a501e(++_0x3232cf);}(_0x6aa7,0x178));var _0x76aa=function(_0x210114,_0x5169ab){_0x210114=_0x210114-0x0;var _0x522433=_0x6aa7[_0x210114];return _0x522433;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5bcd938..fad23a6 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 _0xde10=['describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceDialReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params'];(function(_0x1d0b80,_0x41fc24){var _0x35d642=function(_0x4c2cb5){while(--_0x4c2cb5){_0x1d0b80['push'](_0x1d0b80['shift']());}};_0x35d642(++_0x41fc24);}(_0xde10,0x1d5));var _0x0de1=function(_0x592855,_0x4eecf6){_0x592855=_0x592855-0x0;var _0x500595=_0xde10[_0x592855];return _0x500595;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0de1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0de1('0x1'));var rp=require(_0x0de1('0x2'));var moment=require(_0x0de1('0x3'));var BPromise=require(_0x0de1('0x4'));var Mustache=require(_0x0de1('0x5'));var util=require(_0x0de1('0x6'));var path=require(_0x0de1('0x7'));var sox=require('sox');var csv=require(_0x0de1('0x8'));var ejs=require(_0x0de1('0x9'));var fs=require('fs');var fs_extra=require(_0x0de1('0xa'));var _=require(_0x0de1('0xb'));var squel=require(_0x0de1('0xc'));var crypto=require(_0x0de1('0xd'));var jsforce=require(_0x0de1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0de1('0xf'));var Redis=require(_0x0de1('0x10'));var authService=require(_0x0de1('0x11'));var qs=require(_0x0de1('0x12'));var as=require(_0x0de1('0x13'));var hardwareService=require(_0x0de1('0x14'));var logger=require(_0x0de1('0x15'))(_0x0de1('0x16'));var utils=require('../../config/utils');var config=require(_0x0de1('0x17'));var licenseUtil=require(_0x0de1('0x18'));var db=require(_0x0de1('0x19'))['db'];function respondWithStatusCode(_0xa78866,_0x4bb9b0){_0x4bb9b0=_0x4bb9b0||0xcc;return function(_0x490d0a){if(_0x490d0a){return _0xa78866[_0x0de1('0x1a')](_0x4bb9b0);}return _0xa78866[_0x0de1('0x1b')](_0x4bb9b0)[_0x0de1('0x1c')]();};}function respondWithResult(_0x7cfd37,_0x54648c){_0x54648c=_0x54648c||0xc8;return function(_0xd45f86){if(_0xd45f86){return _0x7cfd37[_0x0de1('0x1b')](_0x54648c)[_0x0de1('0x1d')](_0xd45f86);}};}function respondWithFilteredResult(_0x5ed69c,_0x50d153){return function(_0x66f570){if(_0x66f570){var _0x2f891d=typeof _0x50d153[_0x0de1('0x1e')]==='undefined'&&typeof _0x50d153['limit']===_0x0de1('0x1f');var _0x14bb06=_0x66f570[_0x0de1('0x20')];var _0x402a86=_0x2f891d?0x0:_0x50d153['offset'];var _0xd925c2=_0x2f891d?_0x66f570['count']:_0x50d153[_0x0de1('0x1e')]+_0x50d153['limit'];var _0x174722;if(_0xd925c2>=_0x14bb06){_0xd925c2=_0x14bb06;_0x174722=0xc8;}else{_0x174722=0xce;}_0x5ed69c['status'](_0x174722);return _0x5ed69c[_0x0de1('0x21')]('Content-Range',_0x402a86+'-'+_0xd925c2+'/'+_0x14bb06)[_0x0de1('0x1d')](_0x66f570);}return null;};}function patchUpdates(_0x550add){return function(_0x3f8455){try{jsonpatch[_0x0de1('0x22')](_0x3f8455,_0x550add,!![]);}catch(_0x52ae2b){return BPromise[_0x0de1('0x23')](_0x52ae2b);}return _0x3f8455[_0x0de1('0x24')]();};}function saveUpdates(_0x777ec2,_0x2f716f){return function(_0x5292fd){if(_0x5292fd){return _0x5292fd[_0x0de1('0x25')](_0x777ec2)[_0x0de1('0x26')](function(_0x1653e1){return _0x1653e1;});}return null;};}function removeEntity(_0x46fd78,_0x384537){return function(_0x3b1ebe){if(_0x3b1ebe){return _0x3b1ebe[_0x0de1('0x27')]()['then'](function(){_0x46fd78[_0x0de1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x251017,_0x3192af){return function(_0x1911ee){if(!_0x1911ee){_0x251017['sendStatus'](0x194);}return _0x1911ee;};}function handleError(_0x58fd44,_0x25cb06){_0x25cb06=_0x25cb06||0x1f4;return function(_0x5a1fea){logger[_0x0de1('0x28')](_0x5a1fea[_0x0de1('0x29')]);if(_0x5a1fea[_0x0de1('0x2a')]){delete _0x5a1fea[_0x0de1('0x2a')];}_0x58fd44[_0x0de1('0x1b')](_0x25cb06)[_0x0de1('0x2b')](_0x5a1fea);};}exports[_0x0de1('0x2c')]=function(_0x401cf2,_0x2cf8da){var _0x4fee97={},_0x63925={},_0x21a3b9={'count':0x0,'rows':[]};var _0x446316=_['map'](db[_0x0de1('0x2d')]['rawAttributes'],function(_0x2d34f3){return{'name':_0x2d34f3[_0x0de1('0x2e')],'type':_0x2d34f3[_0x0de1('0x2f')][_0x0de1('0x30')]};});_0x63925[_0x0de1('0x31')]=_[_0x0de1('0x32')](_0x446316,_0x0de1('0x2a'));_0x63925[_0x0de1('0x33')]=_[_0x0de1('0x34')](_0x401cf2[_0x0de1('0x33')]);_0x63925[_0x0de1('0x35')]=_[_0x0de1('0x36')](_0x63925[_0x0de1('0x31')],_0x63925[_0x0de1('0x33')]);_0x4fee97[_0x0de1('0x37')]=_[_0x0de1('0x36')](_0x63925['model'],qs[_0x0de1('0x38')](_0x401cf2[_0x0de1('0x33')]['fields']));_0x4fee97[_0x0de1('0x37')]=_0x4fee97['attributes'][_0x0de1('0x39')]?_0x4fee97[_0x0de1('0x37')]:_0x63925[_0x0de1('0x31')];if(!_0x401cf2['query'][_0x0de1('0x3a')](_0x0de1('0x3b'))){_0x4fee97['limit']=qs[_0x0de1('0x3c')](_0x401cf2[_0x0de1('0x33')]['limit']);_0x4fee97[_0x0de1('0x1e')]=qs[_0x0de1('0x1e')](_0x401cf2[_0x0de1('0x33')][_0x0de1('0x1e')]);}_0x4fee97[_0x0de1('0x3d')]=qs['sort'](_0x401cf2[_0x0de1('0x33')][_0x0de1('0x3e')]);_0x4fee97[_0x0de1('0x3f')]=qs[_0x0de1('0x35')](_[_0x0de1('0x40')](_0x401cf2['query'],_0x63925[_0x0de1('0x35')]),_0x446316);if(_0x401cf2[_0x0de1('0x33')][_0x0de1('0x41')]){_0x4fee97['where']=_[_0x0de1('0x42')](_0x4fee97['where'],{'$or':_[_0x0de1('0x32')](_0x446316,function(_0x1d2e4c){if(_0x1d2e4c[_0x0de1('0x2f')]!=='VIRTUAL'){var _0x2c8985={};_0x2c8985[_0x1d2e4c[_0x0de1('0x2a')]]={'$like':'%'+_0x401cf2[_0x0de1('0x33')]['filter']+'%'};return _0x2c8985;}})});}_0x4fee97=_[_0x0de1('0x42')]({},_0x4fee97,_0x401cf2['options']);var _0x54ed32={'where':_0x4fee97[_0x0de1('0x3f')]};return db[_0x0de1('0x2d')][_0x0de1('0x20')](_0x54ed32)[_0x0de1('0x26')](function(_0x218ec5){_0x21a3b9['count']=_0x218ec5;if(_0x401cf2[_0x0de1('0x33')][_0x0de1('0x43')]){_0x4fee97[_0x0de1('0x44')]=[{'all':!![]}];}return db[_0x0de1('0x2d')]['findAll'](_0x4fee97);})['then'](function(_0x3f35c2){_0x21a3b9[_0x0de1('0x45')]=_0x3f35c2;return _0x21a3b9;})[_0x0de1('0x26')](respondWithFilteredResult(_0x2cf8da,_0x4fee97))[_0x0de1('0x46')](handleError(_0x2cf8da,null));};exports[_0x0de1('0x47')]=function(_0x1a090a,_0x1bf938){var _0x3ae58d={'raw':!![],'where':{'id':_0x1a090a['params']['id']}},_0x54cbd9={};_0x54cbd9[_0x0de1('0x31')]=_[_0x0de1('0x34')](db[_0x0de1('0x2d')][_0x0de1('0x48')]);_0x54cbd9[_0x0de1('0x33')]=_[_0x0de1('0x34')](_0x1a090a['query']);_0x54cbd9['filters']=_[_0x0de1('0x36')](_0x54cbd9[_0x0de1('0x31')],_0x54cbd9['query']);_0x3ae58d[_0x0de1('0x37')]=_['intersection'](_0x54cbd9[_0x0de1('0x31')],qs[_0x0de1('0x38')](_0x1a090a[_0x0de1('0x33')][_0x0de1('0x38')]));_0x3ae58d[_0x0de1('0x37')]=_0x3ae58d[_0x0de1('0x37')][_0x0de1('0x39')]?_0x3ae58d[_0x0de1('0x37')]:_0x54cbd9[_0x0de1('0x31')];if(_0x1a090a[_0x0de1('0x33')][_0x0de1('0x43')]){_0x3ae58d[_0x0de1('0x44')]=[{'all':!![]}];}_0x3ae58d=_[_0x0de1('0x42')]({},_0x3ae58d,_0x1a090a['options']);return db['VoiceDialReport'][_0x0de1('0x49')](_0x3ae58d)['then'](handleEntityNotFound(_0x1bf938,null))[_0x0de1('0x26')](respondWithResult(_0x1bf938,null))[_0x0de1('0x46')](handleError(_0x1bf938,null));};exports[_0x0de1('0x4a')]=function(_0x4b036f,_0x437e3d){return db[_0x0de1('0x2d')][_0x0de1('0x4a')](_0x4b036f[_0x0de1('0x4b')],{})[_0x0de1('0x26')](respondWithResult(_0x437e3d,0xc9))[_0x0de1('0x46')](handleError(_0x437e3d,null));};exports['update']=function(_0x353b9e,_0x35ca9){if(_0x353b9e[_0x0de1('0x4b')]['id']){delete _0x353b9e[_0x0de1('0x4b')]['id'];}return db[_0x0de1('0x2d')]['find']({'where':{'id':_0x353b9e['params']['id']}})['then'](handleEntityNotFound(_0x35ca9,null))[_0x0de1('0x26')](saveUpdates(_0x353b9e[_0x0de1('0x4b')],null))[_0x0de1('0x26')](respondWithResult(_0x35ca9,null))[_0x0de1('0x46')](handleError(_0x35ca9,null));};exports['destroy']=function(_0x5e7b5d,_0x2ed4f1){return db['VoiceDialReport'][_0x0de1('0x49')]({'where':{'id':_0x5e7b5d[_0x0de1('0x4c')]['id']}})[_0x0de1('0x26')](handleEntityNotFound(_0x2ed4f1,null))[_0x0de1('0x26')](removeEntity(_0x2ed4f1,null))['catch'](handleError(_0x2ed4f1,null));};exports['describe']=function(_0x192c6c,_0x5a022e){return db[_0x0de1('0x2d')][_0x0de1('0x4d')]()['then'](respondWithResult(_0x5a022e,null))[_0x0de1('0x46')](handleError(_0x5a022e,null));}; \ No newline at end of file +var _0x3731=['Content-Range','apply','reject','save','update','then','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set'];(function(_0x12039a,_0x386be3){var _0x133246=function(_0x1be843){while(--_0x1be843){_0x12039a['push'](_0x12039a['shift']());}};_0x133246(++_0x386be3);}(_0x3731,0x19c));var _0x1373=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3731[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x1373('0x0'));var rimraf=require(_0x1373('0x1'));var zipdir=require(_0x1373('0x2'));var jsonpatch=require(_0x1373('0x3'));var rp=require(_0x1373('0x4'));var moment=require(_0x1373('0x5'));var BPromise=require(_0x1373('0x6'));var Mustache=require(_0x1373('0x7'));var util=require('util');var path=require(_0x1373('0x8'));var sox=require('sox');var csv=require(_0x1373('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1373('0xa'));var _=require(_0x1373('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1373('0xc'));var deskjs=require(_0x1373('0xd'));var toCsv=require(_0x1373('0x9'));var querystring=require(_0x1373('0xe'));var Papa=require(_0x1373('0xf'));var Redis=require('ioredis');var authService=require(_0x1373('0x10'));var qs=require(_0x1373('0x11'));var as=require(_0x1373('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1373('0x13'));var utils=require(_0x1373('0x14'));var config=require(_0x1373('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1373('0x16'))['db'];function respondWithStatusCode(_0x1bdaca,_0x209a22){_0x209a22=_0x209a22||0xcc;return function(_0x1bf406){if(_0x1bf406){return _0x1bdaca[_0x1373('0x17')](_0x209a22);}return _0x1bdaca['status'](_0x209a22)[_0x1373('0x18')]();};}function respondWithResult(_0x32ac14,_0x21f333){_0x21f333=_0x21f333||0xc8;return function(_0x9a72b7){if(_0x9a72b7){return _0x32ac14[_0x1373('0x19')](_0x21f333)[_0x1373('0x1a')](_0x9a72b7);}};}function respondWithFilteredResult(_0x369286,_0x4b3215){return function(_0x534d73){if(_0x534d73){var _0x469980=typeof _0x4b3215[_0x1373('0x1b')]==='undefined'&&typeof _0x4b3215[_0x1373('0x1c')]===_0x1373('0x1d');var _0x4d9a05=_0x534d73[_0x1373('0x1e')];var _0xac4a54=_0x469980?0x0:_0x4b3215[_0x1373('0x1b')];var _0xf87b98=_0x469980?_0x534d73[_0x1373('0x1e')]:_0x4b3215[_0x1373('0x1b')]+_0x4b3215[_0x1373('0x1c')];var _0x213020;if(_0xf87b98>=_0x4d9a05){_0xf87b98=_0x4d9a05;_0x213020=0xc8;}else{_0x213020=0xce;}_0x369286[_0x1373('0x19')](_0x213020);return _0x369286[_0x1373('0x1f')](_0x1373('0x20'),_0xac4a54+'-'+_0xf87b98+'/'+_0x4d9a05)[_0x1373('0x1a')](_0x534d73);}return null;};}function patchUpdates(_0x845d95){return function(_0x3d10c6){try{jsonpatch[_0x1373('0x21')](_0x3d10c6,_0x845d95,!![]);}catch(_0x44d336){return BPromise[_0x1373('0x22')](_0x44d336);}return _0x3d10c6[_0x1373('0x23')]();};}function saveUpdates(_0x1dea65,_0x1738c2){return function(_0x11d4ff){if(_0x11d4ff){return _0x11d4ff[_0x1373('0x24')](_0x1dea65)['then'](function(_0x2930c7){return _0x2930c7;});}return null;};}function removeEntity(_0x290c35,_0x24dd90){return function(_0x11a79d){if(_0x11a79d){return _0x11a79d['destroy']()[_0x1373('0x25')](function(){_0x290c35[_0x1373('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48323a,_0x1c98e2){return function(_0x4b9e91){if(!_0x4b9e91){_0x48323a['sendStatus'](0x194);}return _0x4b9e91;};}function handleError(_0x2862ec,_0x22c64a){_0x22c64a=_0x22c64a||0x1f4;return function(_0x4ed326){logger[_0x1373('0x26')](_0x4ed326[_0x1373('0x27')]);if(_0x4ed326['name']){delete _0x4ed326[_0x1373('0x28')];}_0x2862ec[_0x1373('0x19')](_0x22c64a)[_0x1373('0x29')](_0x4ed326);};}exports['index']=function(_0x397fac,_0x1e8299){var _0x65bebc={},_0x31075d={},_0x228db3={'count':0x0,'rows':[]};var _0x4a8a6d=_[_0x1373('0x2a')](db[_0x1373('0x2b')][_0x1373('0x2c')],function(_0x320107){return{'name':_0x320107[_0x1373('0x2d')],'type':_0x320107['type']['key']};});_0x31075d[_0x1373('0x2e')]=_[_0x1373('0x2a')](_0x4a8a6d,_0x1373('0x28'));_0x31075d[_0x1373('0x2f')]=_['keys'](_0x397fac['query']);_0x31075d['filters']=_[_0x1373('0x30')](_0x31075d['model'],_0x31075d[_0x1373('0x2f')]);_0x65bebc['attributes']=_[_0x1373('0x30')](_0x31075d[_0x1373('0x2e')],qs[_0x1373('0x31')](_0x397fac[_0x1373('0x2f')]['fields']));_0x65bebc[_0x1373('0x32')]=_0x65bebc['attributes'][_0x1373('0x33')]?_0x65bebc['attributes']:_0x31075d[_0x1373('0x2e')];if(!_0x397fac[_0x1373('0x2f')][_0x1373('0x34')](_0x1373('0x35'))){_0x65bebc[_0x1373('0x1c')]=qs[_0x1373('0x1c')](_0x397fac[_0x1373('0x2f')]['limit']);_0x65bebc[_0x1373('0x1b')]=qs[_0x1373('0x1b')](_0x397fac[_0x1373('0x2f')][_0x1373('0x1b')]);}_0x65bebc['order']=qs['sort'](_0x397fac['query'][_0x1373('0x36')]);_0x65bebc[_0x1373('0x37')]=qs['filters'](_[_0x1373('0x38')](_0x397fac['query'],_0x31075d[_0x1373('0x39')]),_0x4a8a6d);if(_0x397fac[_0x1373('0x2f')][_0x1373('0x3a')]){_0x65bebc[_0x1373('0x37')]=_[_0x1373('0x3b')](_0x65bebc['where'],{'$or':_['map'](_0x4a8a6d,function(_0x40e104){if(_0x40e104[_0x1373('0x3c')]!=='VIRTUAL'){var _0x260e51={};_0x260e51[_0x40e104[_0x1373('0x28')]]={'$like':'%'+_0x397fac[_0x1373('0x2f')]['filter']+'%'};return _0x260e51;}})});}_0x65bebc=_[_0x1373('0x3b')]({},_0x65bebc,_0x397fac[_0x1373('0x3d')]);var _0x54011c={'where':_0x65bebc[_0x1373('0x37')]};return db[_0x1373('0x2b')]['count'](_0x54011c)[_0x1373('0x25')](function(_0x2e20be){_0x228db3['count']=_0x2e20be;if(_0x397fac[_0x1373('0x2f')][_0x1373('0x3e')]){_0x65bebc[_0x1373('0x3f')]=[{'all':!![]}];}return db[_0x1373('0x2b')]['findAll'](_0x65bebc);})[_0x1373('0x25')](function(_0xaad113){_0x228db3[_0x1373('0x40')]=_0xaad113;return _0x228db3;})[_0x1373('0x25')](respondWithFilteredResult(_0x1e8299,_0x65bebc))[_0x1373('0x41')](handleError(_0x1e8299,null));};exports[_0x1373('0x42')]=function(_0x243074,_0x7aca31){var _0x33dd08={'raw':!![],'where':{'id':_0x243074[_0x1373('0x43')]['id']}},_0x317ba8={};_0x317ba8['model']=_[_0x1373('0x44')](db['VoiceDialReport'][_0x1373('0x2c')]);_0x317ba8[_0x1373('0x2f')]=_['keys'](_0x243074['query']);_0x317ba8[_0x1373('0x39')]=_[_0x1373('0x30')](_0x317ba8[_0x1373('0x2e')],_0x317ba8[_0x1373('0x2f')]);_0x33dd08[_0x1373('0x32')]=_[_0x1373('0x30')](_0x317ba8[_0x1373('0x2e')],qs[_0x1373('0x31')](_0x243074[_0x1373('0x2f')][_0x1373('0x31')]));_0x33dd08[_0x1373('0x32')]=_0x33dd08['attributes']['length']?_0x33dd08[_0x1373('0x32')]:_0x317ba8[_0x1373('0x2e')];if(_0x243074[_0x1373('0x2f')][_0x1373('0x3e')]){_0x33dd08[_0x1373('0x3f')]=[{'all':!![]}];}_0x33dd08=_[_0x1373('0x3b')]({},_0x33dd08,_0x243074[_0x1373('0x3d')]);return db['VoiceDialReport'][_0x1373('0x45')](_0x33dd08)[_0x1373('0x25')](handleEntityNotFound(_0x7aca31,null))[_0x1373('0x25')](respondWithResult(_0x7aca31,null))[_0x1373('0x41')](handleError(_0x7aca31,null));};exports[_0x1373('0x46')]=function(_0x3b13e9,_0x23787d){return db[_0x1373('0x2b')][_0x1373('0x46')](_0x3b13e9[_0x1373('0x47')],{})['then'](respondWithResult(_0x23787d,0xc9))[_0x1373('0x41')](handleError(_0x23787d,null));};exports[_0x1373('0x24')]=function(_0x2143b3,_0x59cc9c){if(_0x2143b3[_0x1373('0x47')]['id']){delete _0x2143b3[_0x1373('0x47')]['id'];}return db[_0x1373('0x2b')][_0x1373('0x45')]({'where':{'id':_0x2143b3[_0x1373('0x43')]['id']}})[_0x1373('0x25')](handleEntityNotFound(_0x59cc9c,null))[_0x1373('0x25')](saveUpdates(_0x2143b3[_0x1373('0x47')],null))[_0x1373('0x25')](respondWithResult(_0x59cc9c,null))[_0x1373('0x41')](handleError(_0x59cc9c,null));};exports[_0x1373('0x48')]=function(_0x3a7450,_0x11f255){return db[_0x1373('0x2b')][_0x1373('0x45')]({'where':{'id':_0x3a7450[_0x1373('0x43')]['id']}})['then'](handleEntityNotFound(_0x11f255,null))[_0x1373('0x25')](removeEntity(_0x11f255,null))[_0x1373('0x41')](handleError(_0x11f255,null));};exports[_0x1373('0x49')]=function(_0x16e64e,_0x5e662d){return db[_0x1373('0x2b')][_0x1373('0x49')]()[_0x1373('0x25')](respondWithResult(_0x5e662d,null))[_0x1373('0x41')](handleError(_0x5e662d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 44adc92..6e179f4 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 _0x9917=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x4ab2fd,_0x16480d){var _0x2bd55f=function(_0x382bf1){while(--_0x382bf1){_0x4ab2fd['push'](_0x4ab2fd['shift']());}};_0x2bd55f(++_0x16480d);}(_0x9917,0xe6));var _0x7991=function(_0x3c89bc,_0x5d349e){_0x3c89bc=_0x3c89bc-0x0;var _0x43837d=_0x9917[_0x3c89bc];return _0x43837d;};'use strict';var _=require(_0x7991('0x0'));var util=require('util');var logger=require(_0x7991('0x1'))(_0x7991('0x2'));var moment=require(_0x7991('0x3'));var BPromise=require('bluebird');var rp=require(_0x7991('0x4'));var fs=require('fs');var path=require(_0x7991('0x5'));var rimraf=require(_0x7991('0x6'));var config=require(_0x7991('0x7'));var attributes=require(_0x7991('0x8'));module[_0x7991('0x9')]=function(_0x2235eb,_0xd3bd12){return _0x2235eb[_0x7991('0xa')]('VoiceDialReport',attributes,{'tableName':_0x7991('0xb'),'paranoid':![],'indexes':[{'fields':[_0x7991('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8de=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','report_dial','uniqueid','lodash','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa8de,0x17e));var _0xea8d=function(_0x493b66,_0x10f8b4){_0x493b66=_0x493b66-0x0;var _0x47888d=_0xa8de[_0x493b66];return _0x47888d;};'use strict';var _=require(_0xea8d('0x0'));var util=require(_0xea8d('0x1'));var logger=require(_0xea8d('0x2'))(_0xea8d('0x3'));var moment=require(_0xea8d('0x4'));var BPromise=require(_0xea8d('0x5'));var rp=require(_0xea8d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea8d('0x7'));var config=require(_0xea8d('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0xea8d('0x9')]=function(_0x568d27,_0x63d306){return _0x568d27['define']('VoiceDialReport',attributes,{'tableName':_0xea8d('0xa'),'paranoid':![],'indexes':[{'fields':[_0xea8d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 9e87454..e65bf23 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 _0xd8fb=['where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update'];(function(_0x453ff1,_0x51d06b){var _0x36f097=function(_0x5af956){while(--_0x5af956){_0x453ff1['push'](_0x453ff1['shift']());}};_0x36f097(++_0x51d06b);}(_0xd8fb,0xb1));var _0xbd8f=function(_0x401bfa,_0x1c36bc){_0x401bfa=_0x401bfa-0x0;var _0x52fd2b=_0xd8fb[_0x401bfa];return _0x52fd2b;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require(_0xbd8f('0x4'));var fs=require('fs');var Redis=require(_0xbd8f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x6'));var logger=require(_0xbd8f('0x7'))(_0xbd8f('0x8'));var config=require(_0xbd8f('0x9'));var jayson=require(_0xbd8f('0xa'));var client=jayson[_0xbd8f('0xb')][_0xbd8f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d4cc6,_0x34cbea,_0x8c81b5){return new BPromise(function(_0x14defb,_0x55012f){return client[_0xbd8f('0xd')](_0x1d4cc6,_0x8c81b5)[_0xbd8f('0xe')](function(_0xc0c29e){logger[_0xbd8f('0xf')](_0xbd8f('0x10'),_0x34cbea,_0xbd8f('0x11'));logger[_0xbd8f('0x12')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x34cbea,_0xbd8f('0x11'),JSON[_0xbd8f('0x13')](_0xc0c29e));if(_0xc0c29e[_0xbd8f('0x14')]){if(_0xc0c29e[_0xbd8f('0x14')][_0xbd8f('0x15')]===0x1f4){logger[_0xbd8f('0x14')](_0xbd8f('0x10'),_0x34cbea,_0xc0c29e[_0xbd8f('0x14')][_0xbd8f('0x16')]);return _0x55012f(_0xc0c29e[_0xbd8f('0x14')][_0xbd8f('0x16')]);}logger['error'](_0xbd8f('0x10'),_0x34cbea,_0xc0c29e['error']['message']);return _0x14defb(_0xc0c29e[_0xbd8f('0x14')][_0xbd8f('0x16')]);}else{logger[_0xbd8f('0xf')](_0xbd8f('0x10'),_0x34cbea,_0xbd8f('0x11'));_0x14defb(_0xc0c29e[_0xbd8f('0x17')][_0xbd8f('0x16')]);}})[_0xbd8f('0x18')](function(_0xb04258){logger[_0xbd8f('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x34cbea,_0xb04258);_0x55012f(_0xb04258);});});}exports[_0xbd8f('0x19')]=function(_0x2af2e5){var _0x237795=this;return new Promise(function(_0x54b098,_0x2fc061){return db[_0xbd8f('0x1a')][_0xbd8f('0x1b')](_0x2af2e5[_0xbd8f('0x1c')],{'raw':_0x2af2e5[_0xbd8f('0x1d')]?_0x2af2e5[_0xbd8f('0x1d')][_0xbd8f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x461017){logger['info']('CreateVoiceDialReport',_0x2af2e5);logger[_0xbd8f('0x12')]('CreateVoiceDialReport',_0x2af2e5,JSON[_0xbd8f('0x13')](_0x461017));_0x54b098(_0x461017);})[_0xbd8f('0x18')](function(_0x153f2c){logger[_0xbd8f('0x14')](_0xbd8f('0x19'),_0x153f2c[_0xbd8f('0x16')],_0x2af2e5);_0x2fc061(_0x237795['error'](0x1f4,_0x153f2c[_0xbd8f('0x16')]));});});};exports[_0xbd8f('0x1f')]=function(_0x1ac8f6){var _0xc05953=this;return new Promise(function(_0xbfa031,_0x13451d){return db[_0xbd8f('0x1a')][_0xbd8f('0x20')](_0x1ac8f6[_0xbd8f('0x1c')],{'raw':_0x1ac8f6[_0xbd8f('0x1d')]?_0x1ac8f6[_0xbd8f('0x1d')][_0xbd8f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac8f6[_0xbd8f('0x1d')]?_0x1ac8f6['options'][_0xbd8f('0x21')]||null:null,'attributes':_0x1ac8f6[_0xbd8f('0x1d')]?_0x1ac8f6['options']['attributes']||null:null,'limit':_0x1ac8f6[_0xbd8f('0x1d')]?_0x1ac8f6[_0xbd8f('0x1d')][_0xbd8f('0x22')]||null:null})['then'](function(_0xa02538){logger[_0xbd8f('0xf')](_0xbd8f('0x1f'),_0x1ac8f6);logger['debug'](_0xbd8f('0x1f'),_0x1ac8f6,JSON['stringify'](_0xa02538));_0xbfa031(_0xa02538);})[_0xbd8f('0x18')](function(_0x2943e2){logger[_0xbd8f('0x14')]('UpdateVoiceDialReport',_0x2943e2['message'],_0x1ac8f6);_0x13451d(_0xc05953[_0xbd8f('0x14')](0x1f4,_0x2943e2['message']));});});}; \ No newline at end of file +var _0x80ba=['code','message','result','VoiceDialReport','create','body','options','then','catch','CreateVoiceDialReport','UpdateVoiceDialReport','update','attributes','limit','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x80ba,0x1af));var _0xa80b=function(_0x301a19,_0x4523e9){_0x301a19=_0x301a19-0x0;var _0x4bdc6d=_0x80ba[_0x301a19];return _0x4bdc6d;};'use strict';var _=require(_0xa80b('0x0'));var util=require(_0xa80b('0x1'));var moment=require('moment');var BPromise=require(_0xa80b('0x2'));var rs=require(_0xa80b('0x3'));var fs=require('fs');var Redis=require(_0xa80b('0x4'));var db=require(_0xa80b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa80b('0x6'))(_0xa80b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa80b('0x8')][_0xa80b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4639c1,_0x5e9c6e,_0x56c834){return new BPromise(function(_0x5d56a9,_0x55b096){return client[_0xa80b('0xa')](_0x4639c1,_0x56c834)['then'](function(_0xd10bbd){logger[_0xa80b('0xb')](_0xa80b('0xc'),_0x5e9c6e,_0xa80b('0xd'));logger[_0xa80b('0xe')](_0xa80b('0xf'),_0x5e9c6e,_0xa80b('0xd'),JSON['stringify'](_0xd10bbd));if(_0xd10bbd[_0xa80b('0x10')]){if(_0xd10bbd[_0xa80b('0x10')][_0xa80b('0x11')]===0x1f4){logger['error'](_0xa80b('0xc'),_0x5e9c6e,_0xd10bbd[_0xa80b('0x10')][_0xa80b('0x12')]);return _0x55b096(_0xd10bbd[_0xa80b('0x10')][_0xa80b('0x12')]);}logger['error'](_0xa80b('0xc'),_0x5e9c6e,_0xd10bbd[_0xa80b('0x10')][_0xa80b('0x12')]);return _0x5d56a9(_0xd10bbd[_0xa80b('0x10')]['message']);}else{logger[_0xa80b('0xb')](_0xa80b('0xc'),_0x5e9c6e,'request\x20sent');_0x5d56a9(_0xd10bbd[_0xa80b('0x13')]['message']);}})['catch'](function(_0x25016e){logger[_0xa80b('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x5e9c6e,_0x25016e);_0x55b096(_0x25016e);});});}exports['CreateVoiceDialReport']=function(_0x587c64){var _0x5595d4=this;return new Promise(function(_0xce76f6,_0x1dc5de){return db[_0xa80b('0x14')][_0xa80b('0x15')](_0x587c64[_0xa80b('0x16')],{'raw':_0x587c64[_0xa80b('0x17')]?_0x587c64['options']['raw']===undefined?!![]:![]:!![]})[_0xa80b('0x18')](function(_0x5884cc){logger[_0xa80b('0xb')]('CreateVoiceDialReport',_0x587c64);logger[_0xa80b('0xe')]('CreateVoiceDialReport',_0x587c64,JSON['stringify'](_0x5884cc));_0xce76f6(_0x5884cc);})[_0xa80b('0x19')](function(_0x556af5){logger['error'](_0xa80b('0x1a'),_0x556af5[_0xa80b('0x12')],_0x587c64);_0x1dc5de(_0x5595d4['error'](0x1f4,_0x556af5[_0xa80b('0x12')]));});});};exports[_0xa80b('0x1b')]=function(_0x28fa48){var _0x239690=this;return new Promise(function(_0x4c1b4c,_0x57950c){return db[_0xa80b('0x14')][_0xa80b('0x1c')](_0x28fa48[_0xa80b('0x16')],{'raw':_0x28fa48[_0xa80b('0x17')]?_0x28fa48['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28fa48['options']?_0x28fa48['options']['where']||null:null,'attributes':_0x28fa48['options']?_0x28fa48[_0xa80b('0x17')][_0xa80b('0x1d')]||null:null,'limit':_0x28fa48[_0xa80b('0x17')]?_0x28fa48['options'][_0xa80b('0x1e')]||null:null})['then'](function(_0x22c38e){logger['info'](_0xa80b('0x1b'),_0x28fa48);logger[_0xa80b('0xe')](_0xa80b('0x1b'),_0x28fa48,JSON[_0xa80b('0x1f')](_0x22c38e));_0x4c1b4c(_0x22c38e);})[_0xa80b('0x19')](function(_0x4d7f61){logger['error'](_0xa80b('0x1b'),_0x4d7f61[_0xa80b('0x12')],_0x28fa48);_0x57950c(_0x239690[_0xa80b('0x10')](0x1f4,_0x4d7f61[_0xa80b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 990e13f..5006d2d 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 _0xc212=['post','/:id/applications','addApplications','/:id','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show'];(function(_0xb00f0d,_0xa51fd3){var _0x2a9876=function(_0x4f7795){while(--_0x4f7795){_0xb00f0d['push'](_0xb00f0d['shift']());}};_0x2a9876(++_0xa51fd3);}(_0xc212,0x1c0));var _0x2c21=function(_0x26cb93,_0x4c3007){_0x26cb93=_0x26cb93-0x0;var _0x2b947b=_0xc212[_0x26cb93];return _0x2b947b;};'use strict';var multer=require('multer');var util=require(_0x2c21('0x0'));var path=require(_0x2c21('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c21('0x2')]();var fs_extra=require(_0x2c21('0x3'));var auth=require(_0x2c21('0x4'));var interaction=require(_0x2c21('0x5'));var config=require(_0x2c21('0x6'));var controller=require(_0x2c21('0x7'));router[_0x2c21('0x8')]('/',auth[_0x2c21('0x9')](),controller[_0x2c21('0xa')]);router[_0x2c21('0x8')]('/:id',auth[_0x2c21('0x9')](),controller[_0x2c21('0xb')]);router[_0x2c21('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2c21('0xc')](_0x2c21('0xd'),auth[_0x2c21('0x9')](),controller[_0x2c21('0xe')]);router['put'](_0x2c21('0xf'),auth[_0x2c21('0x9')](),controller[_0x2c21('0x10')]);router[_0x2c21('0x11')](_0x2c21('0xf'),auth['isAuthenticated'](),controller[_0x2c21('0x12')]);module[_0x2c21('0x13')]=router; \ No newline at end of file +var _0x103d=['index','/:id','create','post','addApplications','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated'];(function(_0x534c98,_0x978442){var _0x3b2382=function(_0x55db7e){while(--_0x55db7e){_0x534c98['push'](_0x534c98['shift']());}};_0x3b2382(++_0x978442);}(_0x103d,0xbc));var _0xd103=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x103d[_0x2ec461];return _0x28603d;};'use strict';var multer=require('multer');var util=require(_0xd103('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd103('0x1'));var router=express[_0xd103('0x2')]();var fs_extra=require(_0xd103('0x3'));var auth=require(_0xd103('0x4'));var interaction=require(_0xd103('0x5'));var config=require(_0xd103('0x6'));var controller=require(_0xd103('0x7'));router[_0xd103('0x8')]('/',auth[_0xd103('0x9')](),controller[_0xd103('0xa')]);router[_0xd103('0x8')](_0xd103('0xb'),auth[_0xd103('0x9')](),controller['show']);router['post']('/',auth[_0xd103('0x9')](),controller[_0xd103('0xc')]);router[_0xd103('0xd')]('/:id/applications',auth[_0xd103('0x9')](),controller[_0xd103('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd103('0xf')]);router[_0xd103('0x10')](_0xd103('0xb'),auth[_0xd103('0x9')](),controller[_0xd103('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 70e93dd..20ddb87 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 _0x95bd=['exten','sequelize','exports','STRING','compositeIndex','inbound','internal','inbound-fax','outbound-fax','system','*,*,*,*','INTEGER','wav','BOOLEAN','VIRTUAL'];(function(_0x9fc40a,_0x2da87f){var _0x43623e=function(_0xc932d){while(--_0xc932d){_0x9fc40a['push'](_0x9fc40a['shift']());}};_0x43623e(++_0x2da87f);}(_0x95bd,0x1e1));var _0xd95b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x95bd[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd95b('0x0'));module[_0xd95b('0x1')]={'context':{'type':Sequelize[_0xd95b('0x2')],'allowNull':![],'unique':_0xd95b('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd95b('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd95b('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xd95b('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xd95b('0x4'),'outbound',_0xd95b('0x5'),_0xd95b('0x6'),_0xd95b('0x7'),_0xd95b('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0xd95b('0x2')]},'interval':{'type':Sequelize[_0xd95b('0x2')],'allowNull':![],'defaultValue':_0xd95b('0x9')},'IntervalId':{'type':Sequelize[_0xd95b('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd95b('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd95b('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd95b('0xa')]},'recordingFormat':{'type':Sequelize[_0xd95b('0x2')],'defaultValue':_0xd95b('0xb')},'answer':{'type':Sequelize[_0xd95b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xd95b('0xd')],'get':function(_0x381f92){return this['getDataValue'](_0xd95b('0xe'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8765=['INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax','system','any'];(function(_0x5af305,_0xaf3cf8){var _0x4d9831=function(_0x5bc3c7){while(--_0x5bc3c7){_0x5af305['push'](_0x5af305['shift']());}};_0x4d9831(++_0xaf3cf8);}(_0x8765,0x105));var _0x5876=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8765[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x5876('0x0'));module['exports']={'context':{'type':Sequelize[_0x5876('0x1')],'allowNull':![],'unique':_0x5876('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5876('0x1')],'allowNull':![],'unique':_0x5876('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x5876('0x2')},'tag':{'type':Sequelize[_0x5876('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5876('0x1')],'allowNull':![],'defaultValue':_0x5876('0x3')},'appdata':{'type':Sequelize[_0x5876('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5876('0x4')](_0x5876('0x5'),_0x5876('0x6'),'internal',_0x5876('0x7'),_0x5876('0x8'),_0x5876('0x9'),_0x5876('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x5876('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x5876('0xb')]},'isApp':{'type':Sequelize[_0x5876('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x5876('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x5876('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5876('0xb')]},'recordingFormat':{'type':Sequelize[_0x5876('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x5876('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x5876('0xd')],'get':function(_0x19a6d6){return this[_0x5876('0xe')](_0x5876('0xf'));}},'alias':{'type':Sequelize[_0x5876('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 7527497..be48163 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 _0x5852=['create','startsWith','body','exten','user','InboundRoutes','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','recordingFormat','cutdigits','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','bulkCreate','cast(priority\x20as\x20unsigned)','finally','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','type','find','then','name','send','index','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VoiceExtension','includeAll','rows','show','params','include','options','catch'];(function(_0x5356e2,_0xdbc166){var _0x4848c2=function(_0x3ceefa){while(--_0x3ceefa){_0x5356e2['push'](_0x5356e2['shift']());}};_0x4848c2(++_0xdbc166);}(_0x5852,0x161));var _0x2585=function(_0x2dfe07,_0x2b663f){_0x2dfe07=_0x2dfe07-0x0;var _0x30aee0=_0x5852[_0x2dfe07];return _0x30aee0;};'use strict';var _=require('lodash');var Redis=require(_0x2585('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x2585('0x1'))(_0x2585('0x2'));var config=require('../../config/environment');var db=require(_0x2585('0x3'))['db'];config[_0x2585('0x4')]=_[_0x2585('0x5')](config[_0x2585('0x4')],{'host':_0x2585('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2585('0x4')]));require(_0x2585('0x7'))['register'](socket);function respondWithStatusCode(_0x1c89b3,_0x5b181b){_0x5b181b=_0x5b181b||0xcc;return function(_0x5a08a5){if(_0x5a08a5){return _0x1c89b3[_0x2585('0x8')](_0x5b181b);}return _0x1c89b3[_0x2585('0x9')](_0x5b181b)[_0x2585('0xa')]();};}function respondWithResult(_0x23d40b,_0x2c6fdd){_0x2c6fdd=_0x2c6fdd||0xc8;return function(_0x17630c){if(_0x17630c){return _0x23d40b[_0x2585('0x9')](_0x2c6fdd)[_0x2585('0xb')](_0x17630c);}};}function respondWithFilteredResult(_0x5a8d7d,_0x30a8a6){return function(_0x32c642){if(_0x32c642){var _0x2f0490=typeof _0x30a8a6[_0x2585('0xc')]===_0x2585('0xd')&&typeof _0x30a8a6[_0x2585('0xe')]===_0x2585('0xd');var _0x29d67b=_0x32c642[_0x2585('0xf')];var _0x70b753=_0x2f0490?0x0:_0x30a8a6['offset'];var _0x563d3b=_0x2f0490?_0x32c642['count']:_0x30a8a6['offset']+_0x30a8a6[_0x2585('0xe')];var _0x1a1234;if(_0x563d3b>=_0x29d67b){_0x563d3b=_0x29d67b;_0x1a1234=0xc8;}else{_0x1a1234=0xce;}_0x5a8d7d['status'](_0x1a1234);return _0x5a8d7d[_0x2585('0x10')]('Content-Range',_0x70b753+'-'+_0x563d3b+'/'+_0x29d67b)[_0x2585('0xb')](_0x32c642);}return null;};}function removeEntity(_0x2fe8ac){return function(_0x13893b){if(_0x13893b){return _0x13893b[_0x2585('0x11')]()['then'](function(){var _0x4f0bcd=_0x13893b[_0x2585('0x12')]({'plain':!![]});var _0x50f2d0=[{'name':'InboundRoutes','value':_0x2585('0x13'),'ignore':![]},{'name':_0x2585('0x14'),'value':_0x2585('0x15'),'ignore':![]},{'name':_0x2585('0x16'),'value':_0x2585('0x17'),'ignore':![]}];var _0x456a01=_(_0x50f2d0)[_0x2585('0x18')]('ignore')[_0x2585('0x19')](_0x2585('0x1a'))[_0x2585('0x1a')]();if(_['includes'](_0x456a01,_0x4f0bcd[_0x2585('0x1b')])){return;}var _0x48826a=_[_0x2585('0x1c')](_0x50f2d0,['value',_0x4f0bcd['type']])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x48826a,'resourceId':_0x4f0bcd['id']}})[_0x2585('0x1d')](function(){return _0x13893b;});})[_0x2585('0x1d')](function(){_0x2fe8ac[_0x2585('0x9')](0xcc)[_0x2585('0xa')]();});}};}function handleEntityNotFound(_0x4c9d0f){return function(_0x284a68){if(!_0x284a68){_0x4c9d0f['sendStatus'](0x194);}return _0x284a68;};}function handleError(_0x46f53e,_0x2ba7b8){_0x2ba7b8=_0x2ba7b8||0x1f4;return function(_0x2f4037){logger['error'](_0x2f4037['stack']);if(_0x2f4037[_0x2585('0x1e')]){delete _0x2f4037[_0x2585('0x1e')];}_0x46f53e['status'](_0x2ba7b8)[_0x2585('0x1f')](_0x2f4037);};}exports[_0x2585('0x20')]=function(_0x779f76,_0x9f145c){var _0x348d9a={},_0xab628e={},_0x36c00a={'count':0x0,'rows':[]};var _0x14209b=_[_0x2585('0x19')](db['VoiceExtension'][_0x2585('0x21')],function(_0x37a98e){return{'name':_0x37a98e['fieldName'],'type':_0x37a98e[_0x2585('0x1b')][_0x2585('0x22')]};});_0xab628e[_0x2585('0x23')]=_['map'](_0x14209b,_0x2585('0x1e'));_0xab628e[_0x2585('0x24')]=_[_0x2585('0x25')](_0x779f76[_0x2585('0x24')]);_0xab628e[_0x2585('0x26')]=_['intersection'](_0xab628e[_0x2585('0x23')],_0xab628e[_0x2585('0x24')]);_0x348d9a[_0x2585('0x27')]=_[_0x2585('0x28')](_0xab628e[_0x2585('0x23')],qs[_0x2585('0x29')](_0x779f76[_0x2585('0x24')][_0x2585('0x29')]));_0x348d9a[_0x2585('0x27')]=_0x348d9a[_0x2585('0x27')][_0x2585('0x2a')]?_0x348d9a[_0x2585('0x27')]:_0xab628e[_0x2585('0x23')];if(!_0x779f76[_0x2585('0x24')][_0x2585('0x2b')](_0x2585('0x2c'))){_0x348d9a[_0x2585('0xe')]=qs[_0x2585('0xe')](_0x779f76[_0x2585('0x24')]['limit']);_0x348d9a[_0x2585('0xc')]=qs[_0x2585('0xc')](_0x779f76['query'][_0x2585('0xc')]);}_0x348d9a[_0x2585('0x2d')]=qs[_0x2585('0x2e')](_0x779f76['query'][_0x2585('0x2e')]);_0x348d9a[_0x2585('0x2f')]=qs[_0x2585('0x26')](_['pick'](_0x779f76[_0x2585('0x24')],_0xab628e[_0x2585('0x26')]),_0x14209b);if(_0x779f76[_0x2585('0x24')][_0x2585('0x18')]){_0x348d9a[_0x2585('0x2f')]=_[_0x2585('0x30')](_0x348d9a[_0x2585('0x2f')],{'$or':_[_0x2585('0x19')](_0x14209b,function(_0x3b6748){if(_0x3b6748[_0x2585('0x1b')]!=='VIRTUAL'){var _0x270975={};_0x270975[_0x3b6748[_0x2585('0x1e')]]={'$like':'%'+_0x779f76[_0x2585('0x24')][_0x2585('0x18')]+'%'};return _0x270975;}})});}_0x348d9a=_[_0x2585('0x30')]({},_0x348d9a,_0x779f76['options']);var _0x214f94={'where':_0x348d9a[_0x2585('0x2f')]};return db[_0x2585('0x31')][_0x2585('0xf')](_0x214f94)[_0x2585('0x1d')](function(_0xe1266){_0x36c00a[_0x2585('0xf')]=_0xe1266;if(_0x779f76[_0x2585('0x24')][_0x2585('0x32')]){_0x348d9a['include']=[{'all':!![]}];}return db[_0x2585('0x31')]['findAll'](_0x348d9a);})['then'](function(_0x3032ea){_0x36c00a[_0x2585('0x33')]=_0x3032ea;return _0x36c00a;})['then'](respondWithFilteredResult(_0x9f145c,_0x348d9a))['catch'](handleError(_0x9f145c,null));};exports[_0x2585('0x34')]=function(_0x23962e,_0x31f50d){var _0x17d3af={'raw':![],'where':{'id':_0x23962e[_0x2585('0x35')]['id']}},_0xd9bf19={};_0xd9bf19[_0x2585('0x23')]=_[_0x2585('0x25')](db[_0x2585('0x31')]['rawAttributes']);_0xd9bf19[_0x2585('0x24')]=_['keys'](_0x23962e['query']);_0xd9bf19[_0x2585('0x26')]=_['intersection'](_0xd9bf19[_0x2585('0x23')],_0xd9bf19[_0x2585('0x24')]);_0x17d3af[_0x2585('0x27')]=_[_0x2585('0x28')](_0xd9bf19[_0x2585('0x23')],qs[_0x2585('0x29')](_0x23962e['query'][_0x2585('0x29')]));_0x17d3af[_0x2585('0x27')]=_0x17d3af['attributes'][_0x2585('0x2a')]?_0x17d3af['attributes']:_0xd9bf19[_0x2585('0x23')];if(_0x23962e[_0x2585('0x24')][_0x2585('0x32')]){_0x17d3af[_0x2585('0x36')]=[{'all':!![]}];}_0x17d3af=_[_0x2585('0x30')]({},_0x17d3af,_0x23962e[_0x2585('0x37')]);return db[_0x2585('0x31')][_0x2585('0x1c')](_0x17d3af)[_0x2585('0x1d')](handleEntityNotFound(_0x31f50d,null))[_0x2585('0x1d')](respondWithResult(_0x31f50d,null))[_0x2585('0x38')](handleError(_0x31f50d,null));};exports[_0x2585('0x11')]=function(_0x3f042e,_0x449926){return db[_0x2585('0x31')][_0x2585('0x1c')]({'where':{'id':_0x3f042e[_0x2585('0x35')]['id']}})[_0x2585('0x1d')](handleEntityNotFound(_0x449926,null))[_0x2585('0x1d')](removeEntity(_0x449926,null))['catch'](handleError(_0x449926,null));};exports[_0x2585('0x39')]=function(_0x5ad3d4,_0x1abdf5){if(_0x5ad3d4['body'][_0x2585('0x1b')]==='outbound'&&!_[_0x2585('0x3a')](_0x5ad3d4[_0x2585('0x3b')][_0x2585('0x3c')],'_')){_0x5ad3d4[_0x2585('0x3b')]['exten']='_'['concat'](_0x5ad3d4[_0x2585('0x3b')][_0x2585('0x3c')]);}return db[_0x2585('0x31')][_0x2585('0x39')](_0x5ad3d4[_0x2585('0x3b')],{'raw':![]})[_0x2585('0x1d')](function(_0x487fbf){var _0x1ef62b=_0x5ad3d4[_0x2585('0x3d')][_0x2585('0x12')]({'plain':!![]});if(!_0x1ef62b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ef62b['role']===_0x2585('0x3d')){var _0x1c5b26=_0x487fbf['get']({'plain':!![]});var _0x4e4f64=[{'name':_0x2585('0x3e'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x2585('0x15')},{'name':_0x2585('0x16'),'value':'internal'}];var _0x474030=_[_0x2585('0x1c')](_0x4e4f64,['value',_0x1c5b26[_0x2585('0x1b')]])['name'];return db['UserProfileSection'][_0x2585('0x1c')]({'where':{'name':_0x474030,'userProfileId':_0x1ef62b[_0x2585('0x3f')]},'raw':!![]})[_0x2585('0x1d')](function(_0x250c4d){if(_0x250c4d&&_0x250c4d[_0x2585('0x40')]===0x0){return db[_0x2585('0x41')][_0x2585('0x39')]({'name':_0x1c5b26[_0x2585('0x1e')],'resourceId':_0x1c5b26['id'],'type':_0x250c4d[_0x2585('0x1e')],'sectionId':_0x250c4d['id']},{})[_0x2585('0x1d')](function(){return _0x487fbf;});}else{return _0x487fbf;}})['catch'](function(_0x52edd5){logger[_0x2585('0x42')](_0x2585('0x43'),_0x52edd5);throw _0x52edd5;});}return _0x487fbf;})['then'](respondWithResult(_0x1abdf5,0xc9))[_0x2585('0x38')](handleError(_0x1abdf5,null));};exports[_0x2585('0x44')]=function(_0x31cc0f,_0x2920c9){if(_0x31cc0f[_0x2585('0x3b')]['id']){delete _0x31cc0f[_0x2585('0x3b')]['id'];}return db[_0x2585('0x31')][_0x2585('0x1c')]({'where':{'id':_0x31cc0f[_0x2585('0x35')]['id']}})[_0x2585('0x1d')](handleEntityNotFound(_0x2920c9,null))[_0x2585('0x1d')](function(_0x349b55){if(_0x349b55){return db[_0x2585('0x31')][_0x2585('0x44')](_[_0x2585('0x45')](_0x31cc0f[_0x2585('0x3b')],[_0x2585('0x3c'),_0x2585('0x46'),'description',_0x2585('0x47'),_0x2585('0x48'),'mandatoryDisposition','alias']),{'where':{'context':_0x349b55[_0x2585('0x46')],'exten':_0x349b55[_0x2585('0x3c')]},'individualHooks':!![]})[_0x2585('0x1d')](function(_0x559a3b){return _0x559a3b;});}return null;})['then'](respondWithStatusCode(_0x2920c9,null))[_0x2585('0x38')](handleError(_0x2920c9,null));};exports[_0x2585('0x49')]=function(_0x27e2be,_0x86f87b){var _0x57bb59=_0x27e2be[_0x2585('0x35')]['id'];var _0x1e0dd8=_0x27e2be[_0x2585('0x3b')];var _0x3a3c30=0xc8;var _0x450489=null;return db[_0x2585('0x4a')][_0x2585('0x4b')]({'isolationLevel':db[_0x2585('0x4a')][_0x2585('0x4c')][_0x2585('0x4d')]['READ_COMMITTED']},function(_0x4550c4){return db[_0x2585('0x31')][_0x2585('0x4e')]({'where':{'id':_0x57bb59},'transaction':_0x4550c4})['then'](function(_0x41fa86){if(_0x41fa86){return db[_0x2585('0x31')]['destroy']({'where':{'VoiceExtensionId':_0x57bb59},'transaction':_0x4550c4})[_0x2585('0x1d')](function(){var _0x55b254=_[_0x2585('0x19')](_0x1e0dd8,function(_0x5a9869){_0x5a9869['VoiceExtensionId']=_0x57bb59;_0x5a9869['isApp']=!![];return _0x5a9869;});return _0x41fa86['createRouting'](_0x55b254);})[_0x2585('0x1d')](function(_0x54f4f1){return db[_0x2585('0x31')][_0x2585('0x4f')](_0x54f4f1,{'transaction':_0x4550c4});});}else{_0x3a3c30=0x194;_0x450489=[];}});})[_0x2585('0x1d')](function(){if(_0x3a3c30!==0x194){return db[_0x2585('0x31')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x57bb59},'order':_0x2585('0x50')})[_0x2585('0x1d')](function(_0x8cc5f6){_0x450489=_0x8cc5f6;});}})[_0x2585('0x38')](function(_0x47e2e4){_0x3a3c30=0x1f4;logger[_0x2585('0x42')](_0x47e2e4['stack']);if(_0x47e2e4['name']){delete _0x47e2e4[_0x2585('0x1e')];}_0x450489=_0x47e2e4;})[_0x2585('0x51')](function(){if(_0x450489===null){_0x86f87b[_0x2585('0x8')](_0x3a3c30);}else{if(_0x3a3c30===0x1f4){_0x86f87b[_0x2585('0x9')](_0x3a3c30)['send'](_0x450489);}else{_0x86f87b[_0x2585('0x9')](_0x3a3c30)[_0x2585('0xb')](_0x450489);}}});}; \ No newline at end of file +var _0x7fca=['json','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','UserProfileResource','error','name','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','destroy','find','create','body','startsWith','exten','concat','user','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','lodash','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x872537,_0x596bee){var _0x2f4168=function(_0x2235da){while(--_0x2235da){_0x872537['push'](_0x872537['shift']());}};_0x2f4168(++_0x596bee);}(_0x7fca,0x166));var _0xa7fc=function(_0x3d000e,_0x59cd1d){_0x3d000e=_0x3d000e-0x0;var _0x1898fd=_0x7fca[_0x3d000e];return _0x1898fd;};'use strict';var _=require(_0xa7fc('0x0'));var Redis=require('ioredis');var qs=require(_0xa7fc('0x1'));var logger=require('../../config/logger')('api');var config=require(_0xa7fc('0x2'));var db=require('../../mysqldb')['db'];config[_0xa7fc('0x3')]=_[_0xa7fc('0x4')](config[_0xa7fc('0x3')],{'host':_0xa7fc('0x5'),'port':0x18eb});var socket=require(_0xa7fc('0x6'))(new Redis(config['redis']));require(_0xa7fc('0x7'))[_0xa7fc('0x8')](socket);function respondWithStatusCode(_0x5ae9ac,_0x569001){_0x569001=_0x569001||0xcc;return function(_0x51c5f2){if(_0x51c5f2){return _0x5ae9ac[_0xa7fc('0x9')](_0x569001);}return _0x5ae9ac[_0xa7fc('0xa')](_0x569001)[_0xa7fc('0xb')]();};}function respondWithResult(_0x248418,_0x46f96e){_0x46f96e=_0x46f96e||0xc8;return function(_0x541be9){if(_0x541be9){return _0x248418[_0xa7fc('0xa')](_0x46f96e)['json'](_0x541be9);}};}function respondWithFilteredResult(_0xfd1457,_0x23566d){return function(_0xfab92f){if(_0xfab92f){var _0x4b0f4b=typeof _0x23566d[_0xa7fc('0xc')]===_0xa7fc('0xd')&&typeof _0x23566d[_0xa7fc('0xe')]===_0xa7fc('0xd');var _0x743d06=_0xfab92f['count'];var _0x53cc40=_0x4b0f4b?0x0:_0x23566d['offset'];var _0x147bd9=_0x4b0f4b?_0xfab92f[_0xa7fc('0xf')]:_0x23566d[_0xa7fc('0xc')]+_0x23566d[_0xa7fc('0xe')];var _0x790b50;if(_0x147bd9>=_0x743d06){_0x147bd9=_0x743d06;_0x790b50=0xc8;}else{_0x790b50=0xce;}_0xfd1457['status'](_0x790b50);return _0xfd1457[_0xa7fc('0x10')](_0xa7fc('0x11'),_0x53cc40+'-'+_0x147bd9+'/'+_0x743d06)[_0xa7fc('0x12')](_0xfab92f);}return null;};}function removeEntity(_0xab5e29){return function(_0x3699e4){if(_0x3699e4){return _0x3699e4['destroy']()[_0xa7fc('0x13')](function(){var _0x4bce56=_0x3699e4[_0xa7fc('0x14')]({'plain':!![]});var _0x43ce94=[{'name':'InboundRoutes','value':_0xa7fc('0x15'),'ignore':![]},{'name':_0xa7fc('0x16'),'value':_0xa7fc('0x17'),'ignore':![]},{'name':_0xa7fc('0x18'),'value':_0xa7fc('0x19'),'ignore':![]}];var _0x2494a7=_(_0x43ce94)[_0xa7fc('0x1a')](_0xa7fc('0x1b'))[_0xa7fc('0x1c')](_0xa7fc('0x1d'))[_0xa7fc('0x1d')]();if(_[_0xa7fc('0x1e')](_0x2494a7,_0x4bce56[_0xa7fc('0x1f')])){return;}var _0x48d2e5=_['find'](_0x43ce94,['value',_0x4bce56[_0xa7fc('0x1f')]])['name'];return db[_0xa7fc('0x20')]['destroy']({'where':{'type':_0x48d2e5,'resourceId':_0x4bce56['id']}})[_0xa7fc('0x13')](function(){return _0x3699e4;});})['then'](function(){_0xab5e29[_0xa7fc('0xa')](0xcc)[_0xa7fc('0xb')]();});}};}function handleEntityNotFound(_0x518494){return function(_0x2abd7c){if(!_0x2abd7c){_0x518494['sendStatus'](0x194);}return _0x2abd7c;};}function handleError(_0x41b449,_0x63b8e8){_0x63b8e8=_0x63b8e8||0x1f4;return function(_0xe4ecc8){logger[_0xa7fc('0x21')](_0xe4ecc8['stack']);if(_0xe4ecc8[_0xa7fc('0x22')]){delete _0xe4ecc8[_0xa7fc('0x22')];}_0x41b449['status'](_0x63b8e8)[_0xa7fc('0x23')](_0xe4ecc8);};}exports[_0xa7fc('0x24')]=function(_0x5e837a,_0x3fdd16){var _0x6b8f56={},_0x382612={},_0x46cfd7={'count':0x0,'rows':[]};var _0x305c35=_['map'](db[_0xa7fc('0x25')][_0xa7fc('0x26')],function(_0x138a11){return{'name':_0x138a11[_0xa7fc('0x27')],'type':_0x138a11[_0xa7fc('0x1f')]['key']};});_0x382612[_0xa7fc('0x28')]=_[_0xa7fc('0x1c')](_0x305c35,_0xa7fc('0x22'));_0x382612[_0xa7fc('0x29')]=_[_0xa7fc('0x2a')](_0x5e837a[_0xa7fc('0x29')]);_0x382612[_0xa7fc('0x2b')]=_[_0xa7fc('0x2c')](_0x382612[_0xa7fc('0x28')],_0x382612['query']);_0x6b8f56[_0xa7fc('0x2d')]=_[_0xa7fc('0x2c')](_0x382612[_0xa7fc('0x28')],qs[_0xa7fc('0x2e')](_0x5e837a[_0xa7fc('0x29')][_0xa7fc('0x2e')]));_0x6b8f56['attributes']=_0x6b8f56[_0xa7fc('0x2d')][_0xa7fc('0x2f')]?_0x6b8f56[_0xa7fc('0x2d')]:_0x382612[_0xa7fc('0x28')];if(!_0x5e837a[_0xa7fc('0x29')][_0xa7fc('0x30')](_0xa7fc('0x31'))){_0x6b8f56[_0xa7fc('0xe')]=qs['limit'](_0x5e837a[_0xa7fc('0x29')][_0xa7fc('0xe')]);_0x6b8f56[_0xa7fc('0xc')]=qs[_0xa7fc('0xc')](_0x5e837a[_0xa7fc('0x29')][_0xa7fc('0xc')]);}_0x6b8f56[_0xa7fc('0x32')]=qs[_0xa7fc('0x33')](_0x5e837a['query'][_0xa7fc('0x33')]);_0x6b8f56[_0xa7fc('0x34')]=qs['filters'](_[_0xa7fc('0x35')](_0x5e837a[_0xa7fc('0x29')],_0x382612[_0xa7fc('0x2b')]),_0x305c35);if(_0x5e837a[_0xa7fc('0x29')][_0xa7fc('0x1a')]){_0x6b8f56['where']=_[_0xa7fc('0x36')](_0x6b8f56['where'],{'$or':_['map'](_0x305c35,function(_0xfe8f86){if(_0xfe8f86[_0xa7fc('0x1f')]!==_0xa7fc('0x37')){var _0x480484={};_0x480484[_0xfe8f86[_0xa7fc('0x22')]]={'$like':'%'+_0x5e837a[_0xa7fc('0x29')]['filter']+'%'};return _0x480484;}})});}_0x6b8f56=_[_0xa7fc('0x36')]({},_0x6b8f56,_0x5e837a[_0xa7fc('0x38')]);var _0x34e24f={'where':_0x6b8f56['where']};return db[_0xa7fc('0x25')][_0xa7fc('0xf')](_0x34e24f)['then'](function(_0x40b09b){_0x46cfd7[_0xa7fc('0xf')]=_0x40b09b;if(_0x5e837a[_0xa7fc('0x29')][_0xa7fc('0x39')]){_0x6b8f56[_0xa7fc('0x3a')]=[{'all':!![]}];}return db[_0xa7fc('0x25')][_0xa7fc('0x3b')](_0x6b8f56);})['then'](function(_0x1b13c2){_0x46cfd7[_0xa7fc('0x3c')]=_0x1b13c2;return _0x46cfd7;})[_0xa7fc('0x13')](respondWithFilteredResult(_0x3fdd16,_0x6b8f56))[_0xa7fc('0x3d')](handleError(_0x3fdd16,null));};exports[_0xa7fc('0x3e')]=function(_0xc9ec61,_0x4ff97c){var _0x4f5a9c={'raw':![],'where':{'id':_0xc9ec61[_0xa7fc('0x3f')]['id']}},_0x2c5595={};_0x2c5595[_0xa7fc('0x28')]=_[_0xa7fc('0x2a')](db[_0xa7fc('0x25')][_0xa7fc('0x26')]);_0x2c5595[_0xa7fc('0x29')]=_[_0xa7fc('0x2a')](_0xc9ec61[_0xa7fc('0x29')]);_0x2c5595[_0xa7fc('0x2b')]=_[_0xa7fc('0x2c')](_0x2c5595[_0xa7fc('0x28')],_0x2c5595['query']);_0x4f5a9c['attributes']=_['intersection'](_0x2c5595['model'],qs[_0xa7fc('0x2e')](_0xc9ec61[_0xa7fc('0x29')]['fields']));_0x4f5a9c[_0xa7fc('0x2d')]=_0x4f5a9c[_0xa7fc('0x2d')][_0xa7fc('0x2f')]?_0x4f5a9c[_0xa7fc('0x2d')]:_0x2c5595[_0xa7fc('0x28')];if(_0xc9ec61['query']['includeAll']){_0x4f5a9c[_0xa7fc('0x3a')]=[{'all':!![]}];}_0x4f5a9c=_['merge']({},_0x4f5a9c,_0xc9ec61[_0xa7fc('0x38')]);return db[_0xa7fc('0x25')]['find'](_0x4f5a9c)['then'](handleEntityNotFound(_0x4ff97c,null))[_0xa7fc('0x13')](respondWithResult(_0x4ff97c,null))[_0xa7fc('0x3d')](handleError(_0x4ff97c,null));};exports[_0xa7fc('0x40')]=function(_0x420834,_0x4965c0){return db[_0xa7fc('0x25')][_0xa7fc('0x41')]({'where':{'id':_0x420834[_0xa7fc('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4965c0,null))['then'](removeEntity(_0x4965c0,null))[_0xa7fc('0x3d')](handleError(_0x4965c0,null));};exports[_0xa7fc('0x42')]=function(_0x4fe8a9,_0x37e22){if(_0x4fe8a9[_0xa7fc('0x43')]['type']===_0xa7fc('0x17')&&!_[_0xa7fc('0x44')](_0x4fe8a9['body'][_0xa7fc('0x45')],'_')){_0x4fe8a9[_0xa7fc('0x43')][_0xa7fc('0x45')]='_'[_0xa7fc('0x46')](_0x4fe8a9[_0xa7fc('0x43')][_0xa7fc('0x45')]);}return db['VoiceExtension'][_0xa7fc('0x42')](_0x4fe8a9[_0xa7fc('0x43')],{'raw':![]})[_0xa7fc('0x13')](function(_0x4c9516){var _0x18f1ee=_0x4fe8a9[_0xa7fc('0x47')][_0xa7fc('0x14')]({'plain':!![]});if(!_0x18f1ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18f1ee['role']===_0xa7fc('0x47')){var _0x17454b=_0x4c9516[_0xa7fc('0x14')]({'plain':!![]});var _0x3365c6=[{'name':_0xa7fc('0x48'),'value':_0xa7fc('0x15')},{'name':'OutboundRoutes','value':_0xa7fc('0x17')},{'name':_0xa7fc('0x18'),'value':_0xa7fc('0x19')}];var _0x1af733=_[_0xa7fc('0x41')](_0x3365c6,[_0xa7fc('0x1d'),_0x17454b['type']])[_0xa7fc('0x22')];return db[_0xa7fc('0x49')][_0xa7fc('0x41')]({'where':{'name':_0x1af733,'userProfileId':_0x18f1ee[_0xa7fc('0x4a')]},'raw':!![]})[_0xa7fc('0x13')](function(_0x467769){if(_0x467769&&_0x467769[_0xa7fc('0x4b')]===0x0){return db[_0xa7fc('0x20')][_0xa7fc('0x42')]({'name':_0x17454b[_0xa7fc('0x22')],'resourceId':_0x17454b['id'],'type':_0x467769[_0xa7fc('0x22')],'sectionId':_0x467769['id']},{})['then'](function(){return _0x4c9516;});}else{return _0x4c9516;}})['catch'](function(_0x135142){logger[_0xa7fc('0x21')](_0xa7fc('0x4c'),_0x135142);throw _0x135142;});}return _0x4c9516;})[_0xa7fc('0x13')](respondWithResult(_0x37e22,0xc9))['catch'](handleError(_0x37e22,null));};exports[_0xa7fc('0x4d')]=function(_0x4cb3b2,_0x56a86f){if(_0x4cb3b2[_0xa7fc('0x43')]['id']){delete _0x4cb3b2['body']['id'];}return db[_0xa7fc('0x25')]['find']({'where':{'id':_0x4cb3b2['params']['id']}})['then'](handleEntityNotFound(_0x56a86f,null))[_0xa7fc('0x13')](function(_0x567e69){if(_0x567e69){return db[_0xa7fc('0x25')]['update'](_[_0xa7fc('0x35')](_0x4cb3b2[_0xa7fc('0x43')],[_0xa7fc('0x45'),_0xa7fc('0x4e'),_0xa7fc('0x4f'),'recordingFormat',_0xa7fc('0x50'),'mandatoryDisposition',_0xa7fc('0x51')]),{'where':{'context':_0x567e69[_0xa7fc('0x4e')],'exten':_0x567e69[_0xa7fc('0x45')]},'individualHooks':!![]})[_0xa7fc('0x13')](function(_0x59a1e4){return _0x59a1e4;});}return null;})[_0xa7fc('0x13')](respondWithStatusCode(_0x56a86f,null))['catch'](handleError(_0x56a86f,null));};exports[_0xa7fc('0x52')]=function(_0x27b52d,_0x12953a){var _0xba4440=_0x27b52d[_0xa7fc('0x3f')]['id'];var _0x2f485d=_0x27b52d[_0xa7fc('0x43')];var _0xc8ed58=0xc8;var _0x7943=null;return db[_0xa7fc('0x53')][_0xa7fc('0x54')]({'isolationLevel':db[_0xa7fc('0x53')][_0xa7fc('0x55')][_0xa7fc('0x56')]['READ_COMMITTED']},function(_0x4e7382){return db[_0xa7fc('0x25')][_0xa7fc('0x57')]({'where':{'id':_0xba4440},'transaction':_0x4e7382})[_0xa7fc('0x13')](function(_0x454c0a){if(_0x454c0a){return db[_0xa7fc('0x25')][_0xa7fc('0x40')]({'where':{'VoiceExtensionId':_0xba4440},'transaction':_0x4e7382})['then'](function(){var _0x501da0=_['map'](_0x2f485d,function(_0x5723a9){_0x5723a9[_0xa7fc('0x58')]=_0xba4440;_0x5723a9[_0xa7fc('0x59')]=!![];return _0x5723a9;});return _0x454c0a[_0xa7fc('0x5a')](_0x501da0);})[_0xa7fc('0x13')](function(_0x21e81d){return db[_0xa7fc('0x25')]['bulkCreate'](_0x21e81d,{'transaction':_0x4e7382});});}else{_0xc8ed58=0x194;_0x7943=[];}});})[_0xa7fc('0x13')](function(){if(_0xc8ed58!==0x194){return db['VoiceExtension'][_0xa7fc('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0xba4440},'order':_0xa7fc('0x5c')})[_0xa7fc('0x13')](function(_0x45f190){_0x7943=_0x45f190;});}})['catch'](function(_0x5ab04a){_0xc8ed58=0x1f4;logger[_0xa7fc('0x21')](_0x5ab04a[_0xa7fc('0x5d')]);if(_0x5ab04a[_0xa7fc('0x22')]){delete _0x5ab04a[_0xa7fc('0x22')];}_0x7943=_0x5ab04a;})['finally'](function(){if(_0x7943===null){_0x12953a[_0xa7fc('0x9')](_0xc8ed58);}else{if(_0xc8ed58===0x1f4){_0x12953a[_0xa7fc('0xa')](_0xc8ed58)[_0xa7fc('0x23')](_0x7943);}else{_0x12953a[_0xa7fc('0xa')](_0xc8ed58)[_0xa7fc('0x12')](_0x7943);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4aa5076..97bff14 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 _0x53e5=['remove','emit','hasOwnProperty','../../mysqldb','VoiceExtension','save','update'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x53e5,0x18b));var _0x553e=function(_0x452c37,_0x25ebd4){_0x452c37=_0x452c37-0x0;var _0x2ce2fb=_0x53e5[_0x452c37];return _0x2ce2fb;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x553e('0x0'))['db'][_0x553e('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x553e('0x2'),'afterUpdate':_0x553e('0x3'),'afterDestroy':_0x553e('0x4')};function emitEvent(_0xcac43){return function(_0x3c6b37,_0x4b67b4,_0x2e1f2b){VoiceExtensionEvents['emit'](_0xcac43+':'+_0x3c6b37['id'],_0x3c6b37);VoiceExtensionEvents[_0x553e('0x5')](_0xcac43,_0x3c6b37);_0x2e1f2b(null);};}for(var e in events){if(events[_0x553e('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x094b=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x094b,0x1af));var _0xb094=function(_0x59dc55,_0x36b12b){_0x59dc55=_0x59dc55-0x0;var _0x4044a2=_0x094b[_0x59dc55];return _0x4044a2;};'use strict';var EventEmitter=require(_0xb094('0x0'));var VoiceExtension=require(_0xb094('0x1'))['db'][_0xb094('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb094('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb094('0x4'),'afterDestroy':_0xb094('0x5')};function emitEvent(_0x357828){return function(_0x1793d3,_0x406883,_0x1119c1){VoiceExtensionEvents[_0xb094('0x6')](_0x357828+':'+_0x1793d3['id'],_0x1793d3);VoiceExtensionEvents[_0xb094('0x6')](_0x357828,_0x1793d3);_0x1119c1(null);};}for(var e in events){if(events[_0xb094('0x7')](e)){var event=events[e];VoiceExtension[_0xb094('0x8')](e,emitEvent(event));}}module[_0xb094('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 0aa0581..7be7265 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 _0xe8a1=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','priority','last','concat','define','VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','exports','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','outbound','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','timeout','url','split','length','name','trunk','param','prefix','phone','${EXTEN}','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','isEmpty','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1'];(function(_0x15359b,_0x2bbeb0){var _0x42e8ae=function(_0x345086){while(--_0x345086){_0x15359b['push'](_0x15359b['shift']());}};_0x42e8ae(++_0x2bbeb0);}(_0xe8a1,0xad));var _0x1e8a=function(_0x56cd86,_0x5e07eb){_0x56cd86=_0x56cd86-0x0;var _0x33003b=_0xe8a1[_0x56cd86];return _0x33003b;};'use strict';var _=require(_0x1e8a('0x0'));var attributes=require(_0x1e8a('0x1'));module[_0x1e8a('0x2')]=function(_0x5607b6){var _0x2f4060=_0x5607b6['models'];function _0x3142e6(_0x563bf0){var _0x3d2731=0x2;var _0x48e299=[{'type':_0x563bf0['type'],'app':_0x1e8a('0x3'),'appdata':_0x1e8a('0x4')+_0x563bf0[_0x1e8a('0x5')],'context':_0x563bf0[_0x1e8a('0x6')],'exten':_0x563bf0[_0x1e8a('0x7')],'priority':_0x3d2731++,'VoiceExtensionId':_0x563bf0['id']},{'type':_0x563bf0[_0x1e8a('0x5')],'app':_0x563bf0[_0x1e8a('0x8')]?_0x1e8a('0x3'):_0x1e8a('0x9'),'appdata':_0x563bf0[_0x1e8a('0x8')]?_0x1e8a('0xa')+_0x563bf0['alias']:'No\x20alias\x20set','context':_0x563bf0['context'],'exten':_0x563bf0[_0x1e8a('0x7')],'priority':_0x3d2731++,'VoiceExtensionId':_0x563bf0['id']}];if(_0x563bf0['type']===_0x1e8a('0xb')){_0x48e299[_0x1e8a('0xc')]({'type':_0x1e8a('0xb'),'app':_0x1e8a('0x3'),'appdata':_0x1e8a('0xd')+_0x563bf0['id'],'context':_0x563bf0['context'],'exten':_0x563bf0['exten'],'priority':_0x3d2731++,'VoiceExtensionId':_0x563bf0['id']});}_0x48e299['push']({'type':_0x563bf0[_0x1e8a('0x5')],'app':_0x1e8a('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x563bf0[_0x1e8a('0x6')],'exten':_0x563bf0[_0x1e8a('0x7')],'priority':_0x3d2731++,'VoiceExtensionId':_0x563bf0['id']},{'type':_0x563bf0[_0x1e8a('0x5')],'app':_0x1e8a('0x3'),'appdata':_0x1e8a('0xe'),'context':_0x563bf0[_0x1e8a('0x6')],'exten':_0x563bf0[_0x1e8a('0x7')],'priority':_0x3d2731++,'VoiceExtensionId':_0x563bf0['id']},{'type':_0x563bf0['type'],'app':_0x1e8a('0x3'),'appdata':_0x1e8a('0xf'),'context':_0x563bf0['context'],'exten':_0x563bf0[_0x1e8a('0x7')],'priority':_0x3d2731++,'VoiceExtensionId':_0x563bf0['id']});return _0x48e299;}function _0x1f7793(_0x49bd16){var _0xd22576=0x2;var _0x5e10c3=[{'type':'outbound','app':'Set','appdata':_0x1e8a('0x10'),'context':_0x49bd16[_0x1e8a('0x6')],'exten':_0x49bd16[_0x1e8a('0x7')],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']},{'type':'outbound','app':_0x49bd16[_0x1e8a('0x8')]?'Set':'NoOp','appdata':_0x49bd16[_0x1e8a('0x8')]?_0x1e8a('0xa')+_0x49bd16[_0x1e8a('0x8')]:_0x1e8a('0x11'),'context':_0x49bd16['context'],'exten':_0x49bd16[_0x1e8a('0x7')],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']},{'type':'outbound','app':_0x1e8a('0x3'),'appdata':_0x1e8a('0x12')+(_0x49bd16[_0x1e8a('0x13')]?_0x1e8a('0x14')+_0x49bd16[_0x1e8a('0x13')]+'}':'${EXTEN}'),'context':_0x49bd16[_0x1e8a('0x6')],'exten':_0x49bd16['exten'],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']},{'type':_0x1e8a('0x15'),'app':_0x1e8a('0x3'),'appdata':_0x1e8a('0xd')+_0x49bd16['id'],'context':_0x49bd16[_0x1e8a('0x6')],'exten':_0x49bd16['exten'],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']},{'type':_0x1e8a('0x15'),'app':_0x1e8a('0x16'),'appdata':_0x1e8a('0x17')+(_0xd22576+0x2)+'):Goto('+(_0xd22576+0x1)+')','context':_0x49bd16[_0x1e8a('0x6')],'exten':_0x49bd16[_0x1e8a('0x7')],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']},{'type':_0x1e8a('0x15'),'app':_0x1e8a('0x3'),'appdata':_0x49bd16['cutdigits']?_0x1e8a('0x18')+_0x49bd16[_0x1e8a('0x13')]+'}':_0x1e8a('0x19'),'context':_0x49bd16[_0x1e8a('0x6')],'exten':_0x49bd16[_0x1e8a('0x7')],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']},{'type':_0x1e8a('0x15'),'app':_0x1e8a('0x3'),'appdata':_0x1e8a('0x1a'),'context':_0x49bd16[_0x1e8a('0x6')],'exten':_0x49bd16[_0x1e8a('0x7')],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']},{'type':'outbound','app':'Set','appdata':_0x1e8a('0xe'),'context':_0x49bd16[_0x1e8a('0x6')],'exten':_0x49bd16[_0x1e8a('0x7')],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']},{'type':'outbound','app':_0x1e8a('0x3'),'appdata':_0x1e8a('0xf'),'context':_0x49bd16[_0x1e8a('0x6')],'exten':_0x49bd16[_0x1e8a('0x7')],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']},{'type':_0x1e8a('0x15'),'app':_0x1e8a('0x3'),'appdata':_0x1e8a('0x1b')+_0x49bd16['id'],'context':_0x49bd16['context'],'exten':_0x49bd16[_0x1e8a('0x7')],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']}];if(_0x49bd16[_0x1e8a('0x1c')]('recordingFormat')&&_0x49bd16[_0x1e8a('0x1d')]!==_0x1e8a('0x1e')){_0x5e10c3[_0x1e8a('0xc')]({'type':_0x1e8a('0x15'),'app':_0x1e8a('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x49bd16['context'],'exten':_0x49bd16[_0x1e8a('0x7')],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']},{'type':_0x1e8a('0x15'),'app':_0x1e8a('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x49bd16[_0x1e8a('0x1d')]||'wav','context':_0x49bd16[_0x1e8a('0x6')],'exten':_0x49bd16['exten'],'priority':_0xd22576++,'VoiceExtensionId':_0x49bd16['id']});}return _0x5e10c3;}function _0x196c68(_0x2703ce,_0x281219){var _0x53b4dd=[{'name':'trunk','param':0x0},{'name':_0x1e8a('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x1e8a('0x20'),'param':0x3}];var _0x486985={};var _0x240ca8=_0x281219[_0x1e8a('0x21')](',');var _0x2bab99=[];for(var _0x30cb66=0x0;_0x30cb66<_0x53b4dd[_0x1e8a('0x22')];_0x30cb66++){switch(_0x53b4dd[_0x30cb66][_0x1e8a('0x23')]){case _0x1e8a('0x24'):_0x486985['trunk']=_0x240ca8[_0x53b4dd[_0x30cb66]['param']][_0x1e8a('0x21')]('/')[0x1];_0x486985['phone']=_0x240ca8[_0x53b4dd[_0x30cb66][_0x1e8a('0x25')]][_0x1e8a('0x21')]('/')[0x2];_0x486985[_0x1e8a('0x26')]=_0x486985[_0x1e8a('0x27')]?_0x486985['phone'][_0x1e8a('0x21')]('$')[0x0]:undefined;_0x486985['phone']=_0x2703ce[_0x1e8a('0x13')]?(_0x486985[_0x1e8a('0x26')]||'')+_0x1e8a('0x14')+_0x2703ce[_0x1e8a('0x13')]+'}':(_0x486985[_0x1e8a('0x26')]||'')+_0x1e8a('0x28');_0x2bab99[_0x53b4dd[_0x30cb66]['param']]=[_0x1e8a('0x29'),_0x486985[_0x1e8a('0x24')],_0x486985['phone']][_0x1e8a('0x2a')]('/');break;case'options':_0x486985[_0x1e8a('0x2b')]=_0x240ca8[_0x53b4dd[_0x30cb66][_0x1e8a('0x25')]];if(_0x2703ce['recordingFormat']!==_0x1e8a('0x1e')){if(_0x486985[_0x1e8a('0x2b')][_0x1e8a('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x486985[_0x1e8a('0x2b')]+='U(xcally-mixmonitor-context)';}}else{_0x486985['options']=_0x486985[_0x1e8a('0x2b')]['replace'](_0x1e8a('0x2d'),'');}_0x2bab99[_0x53b4dd[_0x30cb66][_0x1e8a('0x25')]]=_0x486985[_0x1e8a('0x2b')];break;default:_0x2bab99[_0x53b4dd[_0x30cb66][_0x1e8a('0x25')]]=_0x240ca8[_0x53b4dd[_0x30cb66][_0x1e8a('0x25')]];}}return _0x2bab99['join'](',');}function _0x407878(_0x367767,_0x263735,_0x3d0bd0){return new Promise(function(_0x250718,_0x4ab289){var _0x34def3=[];if(_[_0x1e8a('0x2e')](_0x263735))return _0x250718(_0x34def3);_0x2f4060['Interval']['findAll']({'attributes':['id',_0x1e8a('0x2f'),_0x1e8a('0x30')],'raw':!![]})[_0x1e8a('0x31')](function(_0x1490d9){for(var _0x57dfdf=0x0,_0x57a7c=0x0;_0x57dfdf<_0x263735[_0x1e8a('0x22')];_0x57dfdf++,_0x57a7c=0x0){var _0x361599=_0x263735[_0x57dfdf];var _0x1c09fc=[];var _0x43690a=[];delete _0x361599['id'];if(_0x361599[_0x1e8a('0x2f')]!==_0x1e8a('0x32')){_0x361599[_0x1e8a('0x33')]=[_0x361599[_0x1e8a('0x2f')]];}else{_0x361599[_0x1e8a('0x33')]=_0x361599[_0x1e8a('0x30')]?_[_0x1e8a('0x34')](_[_0x1e8a('0x35')](_0x1490d9,{'IntervalId':_0x361599[_0x1e8a('0x30')]}),_0x1e8a('0x2f')):[];}_0x361599[_0x1e8a('0x6')]=_0x367767['context'];_0x361599[_0x1e8a('0x7')]=_0x367767[_0x1e8a('0x7')];if(_0x361599[_0x1e8a('0x5')])_0x361599['type']=_0x361599[_0x1e8a('0x5')][_0x1e8a('0x36')]();if(_0x367767[_0x1e8a('0x5')]===_0x1e8a('0x15')){if(_0x361599[_0x1e8a('0x1c')]('tag')&&_0x361599[_0x1e8a('0x37')]&&_0x361599['tag']!=='--'){_0x1c09fc[_0x1e8a('0xc')]({'type':_0x361599[_0x1e8a('0x5')][_0x1e8a('0x36')](),'app':_0x1e8a('0x3'),'appdata':_0x1e8a('0x38')+_0x361599[_0x1e8a('0x37')],'context':_0x367767[_0x1e8a('0x6')],'exten':_0x367767[_0x1e8a('0x7')],'priority':_0x361599['intervals'][_0x1e8a('0x22')]+_0x3d0bd0+_0x57a7c++,'VoiceExtensionId':_0x367767['id']});}_0x1c09fc[_0x1e8a('0xc')]({'type':_0x361599['type'][_0x1e8a('0x36')](),'app':'ExecIf','appdata':_0x1e8a('0x39')+(_0x361599[_0x1e8a('0x3a')]?_0x1e8a('0x3b')+_0x361599['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x367767['context'],'exten':_0x367767['exten'],'priority':_0x361599[_0x1e8a('0x33')][_0x1e8a('0x22')]+_0x3d0bd0+_0x57a7c++,'VoiceExtensionId':_0x367767['id']});}else{if(_0x361599[_0x1e8a('0x1c')](_0x1e8a('0x3c'))){if([_0x1e8a('0x3d'),_0x1e8a('0x3e')]['includes'](_0x361599[_0x1e8a('0x3f')][_0x1e8a('0x36')]())&&_0x361599[_0x1e8a('0x40')]!=='custom'){if(_0x361599[_0x1e8a('0x3c')]){_0x1c09fc[_0x1e8a('0xc')]({'type':_0x361599[_0x1e8a('0x5')][_0x1e8a('0x36')](),'app':_0x1e8a('0x16'),'appdata':_0x1e8a('0x41'),'context':_0x367767[_0x1e8a('0x6')],'exten':_0x367767[_0x1e8a('0x7')],'priority':_0x361599[_0x1e8a('0x33')][_0x1e8a('0x22')]+_0x3d0bd0+_0x57a7c++,'VoiceExtensionId':_0x367767['id']});_0x1c09fc['push']({'type':_0x361599[_0x1e8a('0x5')][_0x1e8a('0x36')](),'app':'Set','appdata':_0x1e8a('0x42'),'context':_0x367767[_0x1e8a('0x6')],'exten':_0x367767[_0x1e8a('0x7')],'priority':_0x361599[_0x1e8a('0x33')][_0x1e8a('0x22')]+_0x3d0bd0+_0x57a7c++,'VoiceExtensionId':_0x367767['id']});}else{_0x1c09fc[_0x1e8a('0xc')]({'type':_0x361599['type'][_0x1e8a('0x36')](),'app':_0x1e8a('0x16'),'appdata':_0x1e8a('0x43'),'context':_0x367767[_0x1e8a('0x6')],'exten':_0x367767[_0x1e8a('0x7')],'priority':_0x361599[_0x1e8a('0x33')]['length']+_0x3d0bd0+_0x57a7c++,'VoiceExtensionId':_0x367767['id']});_0x1c09fc[_0x1e8a('0xc')]({'type':_0x361599[_0x1e8a('0x5')]['toLowerCase'](),'app':_0x1e8a('0x3'),'appdata':_0x1e8a('0x44'),'context':_0x367767[_0x1e8a('0x6')],'exten':_0x367767[_0x1e8a('0x7')],'priority':_0x361599[_0x1e8a('0x33')][_0x1e8a('0x22')]+_0x3d0bd0+_0x57a7c++,'VoiceExtensionId':_0x367767['id']});}}}}for(var _0x93608e=0x0;_0x93608e<_0x361599[_0x1e8a('0x33')][_0x1e8a('0x22')];_0x93608e++){var _0x1e90ec=_0x3d0bd0+_0x361599[_0x1e8a('0x33')][_0x1e8a('0x22')];var _0x4045e6=_0x93608e===_0x361599[_0x1e8a('0x33')]['length']-0x1?_0x3d0bd0+_0x1c09fc['length']+_0x43690a[_0x1e8a('0x22')]+0x2:_0x3d0bd0+_0x93608e+0x1;_0x1c09fc[_0x1e8a('0x45')](_0x93608e,0x0,{'type':_0x367767[_0x1e8a('0x5')],'app':_0x1e8a('0x46'),'appdata':_0x361599[_0x1e8a('0x33')][_0x93608e]+'?'+_0x367767[_0x1e8a('0x6')]+',${EXTEN},'+_0x1e90ec+':'+_0x367767['context']+_0x1e8a('0x47')+_0x4045e6,'exten':_0x367767['exten'],'context':_0x367767[_0x1e8a('0x6')],'priority':_0x3d0bd0+_0x93608e,'VoiceExtensionId':_0x367767['id']});}if(_0x361599[_0x1e8a('0x40')]===_0x1e8a('0x48'))_0x361599['appdata']=_0x196c68(_0x367767,_0x361599['appdata']);_0x361599[_0x1e8a('0x49')]=_0x1c09fc[_0x1e8a('0x22')]?_[_0x1e8a('0x4a')](_0x1c09fc)[_0x1e8a('0x49')]+0x1:_0x3d0bd0;_0x34def3=_[_0x1e8a('0x4b')](_0x34def3,_0x1c09fc,[_0x361599],_0x43690a);_0x3d0bd0=_[_0x1e8a('0x4a')](_0x34def3)[_0x1e8a('0x49')]+0x1;}return _0x250718(_0x34def3);})['catch'](function(_0x1f9e86){_0x4ab289(_0x1f9e86);});});}return _0x5607b6[_0x1e8a('0x4c')](_0x1e8a('0x4d'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x31e783){var _0xbde17e=this[_0x1e8a('0x4e')]({'plain':!![]});var _0x40f53e=_0xbde17e[_0x1e8a('0x5')]===_0x1e8a('0x15')?_0x1f7793(_0xbde17e):_0x3142e6(_0xbde17e);return _0x407878(_0xbde17e,_0x31e783,_[_0x1e8a('0x4a')](_0x40f53e)['priority']+0x1)[_0x1e8a('0x31')](function(_0x53b9f6){var _0x16bb95=_['concat'](_0x40f53e,_0x53b9f6);_0x16bb95[_0x1e8a('0xc')]({'type':_0xbde17e['type'],'app':_0x1e8a('0x4f'),'exten':_0xbde17e[_0x1e8a('0x7')],'context':_0xbde17e['context'],'priority':_['last'](_0x16bb95)[_0x1e8a('0x49')]+0x1,'VoiceExtensionId':_0xbde17e['id']});return _0x16bb95;});}}});}; \ No newline at end of file +var _0x61df=['tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','splice',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','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)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','name','param','split','phone','prefix','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0x61df,0xbd));var _0xf61d=function(_0x2b333b,_0x592332){_0x2b333b=_0x2b333b-0x0;var _0x5c07b1=_0x61df[_0x2b333b];return _0x5c07b1;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x5cda8a){var _0x449fc=_0x5cda8a['models'];function _0x40127d(_0x380f27){var _0x485a55=0x2;var _0x3170e7=[{'type':_0x380f27[_0xf61d('0x0')],'app':_0xf61d('0x1'),'appdata':_0xf61d('0x2')+_0x380f27[_0xf61d('0x0')],'context':_0x380f27[_0xf61d('0x3')],'exten':_0x380f27['exten'],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']},{'type':_0x380f27[_0xf61d('0x0')],'app':_0x380f27['alias']?_0xf61d('0x1'):_0xf61d('0x4'),'appdata':_0x380f27[_0xf61d('0x5')]?_0xf61d('0x6')+_0x380f27[_0xf61d('0x5')]:_0xf61d('0x7'),'context':_0x380f27[_0xf61d('0x3')],'exten':_0x380f27[_0xf61d('0x8')],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']}];if(_0x380f27[_0xf61d('0x0')]===_0xf61d('0x9')){_0x3170e7[_0xf61d('0xa')]({'type':_0xf61d('0x9'),'app':'Set','appdata':_0xf61d('0xb')+_0x380f27['id'],'context':_0x380f27['context'],'exten':_0x380f27['exten'],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']});}_0x3170e7[_0xf61d('0xa')]({'type':_0x380f27['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x380f27[_0xf61d('0x3')],'exten':_0x380f27['exten'],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']},{'type':_0x380f27['type'],'app':_0xf61d('0x1'),'appdata':_0xf61d('0xc'),'context':_0x380f27[_0xf61d('0x3')],'exten':_0x380f27[_0xf61d('0x8')],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']},{'type':_0x380f27['type'],'app':_0xf61d('0x1'),'appdata':_0xf61d('0xd'),'context':_0x380f27[_0xf61d('0x3')],'exten':_0x380f27[_0xf61d('0x8')],'priority':_0x485a55++,'VoiceExtensionId':_0x380f27['id']});return _0x3170e7;}function _0x51405a(_0x4d229d){var _0x20a048=0x2;var _0x3d5b61=[{'type':_0xf61d('0xe'),'app':_0xf61d('0x1'),'appdata':_0xf61d('0xf'),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':'outbound','app':_0x4d229d['alias']?_0xf61d('0x1'):_0xf61d('0x4'),'appdata':_0x4d229d[_0xf61d('0x5')]?_0xf61d('0x6')+_0x4d229d[_0xf61d('0x5')]:_0xf61d('0x7'),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d['exten'],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':'Set','appdata':_0xf61d('0x10')+(_0x4d229d[_0xf61d('0x11')]?_0xf61d('0x12')+_0x4d229d[_0xf61d('0x11')]+'}':_0xf61d('0x13')),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':'Set','appdata':'CDR(routeid)='+_0x4d229d['id'],'context':_0x4d229d['context'],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':_0xf61d('0x14'),'appdata':_0xf61d('0x15')+(_0x20a048+0x2)+'):Goto('+(_0x20a048+0x1)+')','context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':'outbound','app':'Set','appdata':_0x4d229d[_0xf61d('0x11')]?_0xf61d('0x16')+_0x4d229d['cutdigits']+'}':_0xf61d('0x17'),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d['exten'],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':'outbound','app':_0xf61d('0x1'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d['exten'],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':_0xf61d('0x1'),'appdata':_0xf61d('0xd'),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d['exten'],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':_0xf61d('0xe'),'app':_0xf61d('0x1'),'appdata':_0xf61d('0x18')+_0x4d229d['id'],'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']}];if(_0x4d229d[_0xf61d('0x19')](_0xf61d('0x1a'))&&_0x4d229d[_0xf61d('0x1a')]!=='none'){_0x3d5b61[_0xf61d('0xa')]({'type':_0xf61d('0xe'),'app':_0xf61d('0x1'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']},{'type':'outbound','app':'Set','appdata':_0xf61d('0x1b')+_0x4d229d[_0xf61d('0x1a')]||_0xf61d('0x1c'),'context':_0x4d229d[_0xf61d('0x3')],'exten':_0x4d229d[_0xf61d('0x8')],'priority':_0x20a048++,'VoiceExtensionId':_0x4d229d['id']});}return _0x3d5b61;}function _0x5224a5(_0x373d86,_0x310b22){var _0x1d308f=[{'name':_0xf61d('0x1d'),'param':0x0},{'name':_0xf61d('0x1e'),'param':0x1},{'name':_0xf61d('0x1f'),'param':0x2},{'name':_0xf61d('0x20'),'param':0x3}];var _0x3cd341={};var _0x353258=_0x310b22['split'](',');var _0x52b296=[];for(var _0x2f170c=0x0;_0x2f170c<_0x1d308f[_0xf61d('0x21')];_0x2f170c++){switch(_0x1d308f[_0x2f170c][_0xf61d('0x22')]){case _0xf61d('0x1d'):_0x3cd341[_0xf61d('0x1d')]=_0x353258[_0x1d308f[_0x2f170c][_0xf61d('0x23')]][_0xf61d('0x24')]('/')[0x1];_0x3cd341[_0xf61d('0x25')]=_0x353258[_0x1d308f[_0x2f170c][_0xf61d('0x23')]][_0xf61d('0x24')]('/')[0x2];_0x3cd341[_0xf61d('0x26')]=_0x3cd341[_0xf61d('0x25')]?_0x3cd341[_0xf61d('0x25')][_0xf61d('0x24')]('$')[0x0]:undefined;_0x3cd341['phone']=_0x373d86[_0xf61d('0x11')]?(_0x3cd341[_0xf61d('0x26')]||'')+'${EXTEN:'+_0x373d86['cutdigits']+'}':(_0x3cd341[_0xf61d('0x26')]||'')+'${EXTEN}';_0x52b296[_0x1d308f[_0x2f170c]['param']]=['SIP',_0x3cd341[_0xf61d('0x1d')],_0x3cd341[_0xf61d('0x25')]][_0xf61d('0x27')]('/');break;case _0xf61d('0x1f'):_0x3cd341['options']=_0x353258[_0x1d308f[_0x2f170c][_0xf61d('0x23')]];if(_0x373d86[_0xf61d('0x1a')]!==_0xf61d('0x28')){if(_0x3cd341[_0xf61d('0x1f')][_0xf61d('0x29')](_0xf61d('0x2a'))<0x0){_0x3cd341['options']+=_0xf61d('0x2a');}}else{_0x3cd341[_0xf61d('0x1f')]=_0x3cd341[_0xf61d('0x1f')][_0xf61d('0x2b')]('U(xcally-mixmonitor-context)','');}_0x52b296[_0x1d308f[_0x2f170c][_0xf61d('0x23')]]=_0x3cd341[_0xf61d('0x1f')];break;default:_0x52b296[_0x1d308f[_0x2f170c][_0xf61d('0x23')]]=_0x353258[_0x1d308f[_0x2f170c][_0xf61d('0x23')]];}}return _0x52b296['join'](',');}function _0xeabb66(_0x4407e6,_0x429188,_0x3bce4c){return new Promise(function(_0x35d118,_0x30b75b){var _0x4c2a67=[];if(_[_0xf61d('0x2c')](_0x429188))return _0x35d118(_0x4c2a67);_0x449fc[_0xf61d('0x2d')][_0xf61d('0x2e')]({'attributes':['id',_0xf61d('0x2f'),_0xf61d('0x30')],'raw':!![]})[_0xf61d('0x31')](function(_0x4a7c94){for(var _0xa2f124=0x0,_0x28a753=0x0;_0xa2f124<_0x429188['length'];_0xa2f124++,_0x28a753=0x0){var _0x5a9c19=_0x429188[_0xa2f124];var _0xc6e1c3=[];var _0x542f7a=[];delete _0x5a9c19['id'];if(_0x5a9c19[_0xf61d('0x2f')]!==_0xf61d('0x32')){_0x5a9c19['intervals']=[_0x5a9c19['interval']];}else{_0x5a9c19[_0xf61d('0x33')]=_0x5a9c19[_0xf61d('0x30')]?_[_0xf61d('0x34')](_[_0xf61d('0x35')](_0x4a7c94,{'IntervalId':_0x5a9c19[_0xf61d('0x30')]}),'interval'):[];}_0x5a9c19['context']=_0x4407e6[_0xf61d('0x3')];_0x5a9c19[_0xf61d('0x8')]=_0x4407e6[_0xf61d('0x8')];if(_0x5a9c19[_0xf61d('0x0')])_0x5a9c19['type']=_0x5a9c19[_0xf61d('0x0')]['toLowerCase']();if(_0x4407e6[_0xf61d('0x0')]==='outbound'){if(_0x5a9c19[_0xf61d('0x19')](_0xf61d('0x36'))&&_0x5a9c19[_0xf61d('0x36')]&&_0x5a9c19['tag']!=='--'){_0xc6e1c3[_0xf61d('0xa')]({'type':_0x5a9c19['type']['toLowerCase'](),'app':_0xf61d('0x1'),'appdata':'CDR(tag)='+_0x5a9c19[_0xf61d('0x36')],'context':_0x4407e6[_0xf61d('0x3')],'exten':_0x4407e6[_0xf61d('0x8')],'priority':_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')]+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});}_0xc6e1c3[_0xf61d('0xa')]({'type':_0x5a9c19['type'][_0xf61d('0x37')](),'app':_0xf61d('0x14'),'appdata':_0xf61d('0x38')+(_0x5a9c19[_0xf61d('0x39')]?_0xf61d('0x3a')+_0x5a9c19[_0xf61d('0x39')]+')':_0xf61d('0x3b')),'context':_0x4407e6[_0xf61d('0x3')],'exten':_0x4407e6[_0xf61d('0x8')],'priority':_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')]+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});}else{if(_0x5a9c19[_0xf61d('0x19')](_0xf61d('0x3c'))){if([_0xf61d('0x3d'),_0xf61d('0x3e')][_0xf61d('0x3f')](_0x5a9c19[_0xf61d('0x40')]['toLowerCase']())&&_0x5a9c19[_0xf61d('0x41')]!==_0xf61d('0x42')){if(_0x5a9c19['answer']){_0xc6e1c3[_0xf61d('0xa')]({'type':_0x5a9c19['type'][_0xf61d('0x37')](),'app':_0xf61d('0x14'),'appdata':_0xf61d('0x43'),'context':_0x4407e6['context'],'exten':_0x4407e6[_0xf61d('0x8')],'priority':_0x5a9c19['intervals'][_0xf61d('0x21')]+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});_0xc6e1c3[_0xf61d('0xa')]({'type':_0x5a9c19[_0xf61d('0x0')][_0xf61d('0x37')](),'app':_0xf61d('0x1'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4407e6[_0xf61d('0x3')],'exten':_0x4407e6['exten'],'priority':_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')]+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});}else{_0xc6e1c3[_0xf61d('0xa')]({'type':_0x5a9c19[_0xf61d('0x0')][_0xf61d('0x37')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4407e6[_0xf61d('0x3')],'exten':_0x4407e6['exten'],'priority':_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')]+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});_0xc6e1c3['push']({'type':_0x5a9c19['type']['toLowerCase'](),'app':_0xf61d('0x1'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4407e6[_0xf61d('0x3')],'exten':_0x4407e6[_0xf61d('0x8')],'priority':_0x5a9c19['intervals']['length']+_0x3bce4c+_0x28a753++,'VoiceExtensionId':_0x4407e6['id']});}}}}for(var _0x150824=0x0;_0x150824<_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')];_0x150824++){var _0x51ca8e=_0x3bce4c+_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')];var _0x263d6b=_0x150824===_0x5a9c19[_0xf61d('0x33')][_0xf61d('0x21')]-0x1?_0x3bce4c+_0xc6e1c3[_0xf61d('0x21')]+_0x542f7a[_0xf61d('0x21')]+0x2:_0x3bce4c+_0x150824+0x1;_0xc6e1c3[_0xf61d('0x44')](_0x150824,0x0,{'type':_0x4407e6[_0xf61d('0x0')],'app':'GotoIfTime','appdata':_0x5a9c19[_0xf61d('0x33')][_0x150824]+'?'+_0x4407e6[_0xf61d('0x3')]+_0xf61d('0x45')+_0x51ca8e+':'+_0x4407e6[_0xf61d('0x3')]+',${EXTEN},'+_0x263d6b,'exten':_0x4407e6[_0xf61d('0x8')],'context':_0x4407e6[_0xf61d('0x3')],'priority':_0x3bce4c+_0x150824,'VoiceExtensionId':_0x4407e6['id']});}if(_0x5a9c19['appType']===_0xf61d('0x46'))_0x5a9c19[_0xf61d('0x47')]=_0x5224a5(_0x4407e6,_0x5a9c19[_0xf61d('0x47')]);_0x5a9c19[_0xf61d('0x48')]=_0xc6e1c3[_0xf61d('0x21')]?_[_0xf61d('0x49')](_0xc6e1c3)[_0xf61d('0x48')]+0x1:_0x3bce4c;_0x4c2a67=_[_0xf61d('0x4a')](_0x4c2a67,_0xc6e1c3,[_0x5a9c19],_0x542f7a);_0x3bce4c=_[_0xf61d('0x49')](_0x4c2a67)[_0xf61d('0x48')]+0x1;}return _0x35d118(_0x4c2a67);})[_0xf61d('0x4b')](function(_0x3f33b2){_0x30b75b(_0x3f33b2);});});}return _0x5cda8a[_0xf61d('0x4c')](_0xf61d('0x4d'),attributes,{'tableName':_0xf61d('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x18d44e){var _0x516cc4=this[_0xf61d('0x4f')]({'plain':!![]});var _0x2ae887=_0x516cc4[_0xf61d('0x0')]===_0xf61d('0xe')?_0x51405a(_0x516cc4):_0x40127d(_0x516cc4);return _0xeabb66(_0x516cc4,_0x18d44e,_[_0xf61d('0x49')](_0x2ae887)[_0xf61d('0x48')]+0x1)[_0xf61d('0x31')](function(_0x5de308){var _0x4513ae=_[_0xf61d('0x4a')](_0x2ae887,_0x5de308);_0x4513ae[_0xf61d('0xa')]({'type':_0x516cc4[_0xf61d('0x0')],'app':_0xf61d('0x50'),'exten':_0x516cc4[_0xf61d('0x8')],'context':_0x516cc4[_0xf61d('0x3')],'priority':_[_0xf61d('0x49')](_0x4513ae)[_0xf61d('0x48')]+0x1,'VoiceExtensionId':_0x516cc4['id']});return _0x4513ae;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 51213e4..2516104 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 _0x965d=['stringify','error','message','info','GetVoiceExtension','VoiceExtension','findAll','options','where','limit','include','map','model','attributes','then','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','./voiceExtension.socket','register','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x8d7a30,_0x336422){var _0x41c062=function(_0x1fe9ac){while(--_0x1fe9ac){_0x8d7a30['push'](_0x8d7a30['shift']());}};_0x41c062(++_0x336422);}(_0x965d,0x1be));var _0xd965=function(_0x507320,_0x279428){_0x507320=_0x507320-0x0;var _0x259201=_0x965d[_0x507320];return _0x259201;};'use strict';var _=require(_0xd965('0x0'));var util=require(_0xd965('0x1'));var moment=require('moment');var BPromise=require(_0xd965('0x2'));var rs=require(_0xd965('0x3'));var fs=require('fs');var Redis=require(_0xd965('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd965('0x5'));var logger=require(_0xd965('0x6'))(_0xd965('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd965('0x8')]=_[_0xd965('0x9')](config['redis'],{'host':_0xd965('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd965('0x8')]));require(_0xd965('0xb'))[_0xd965('0xc')](socket);function respondWithRpcPromise(_0xb3956f,_0x59fadc,_0x3d7453){return new BPromise(function(_0x433714,_0x21c632){return client['request'](_0xb3956f,_0x3d7453)['then'](function(_0x4ad301){logger['info'](_0xd965('0xd'),_0x59fadc,_0xd965('0xe'));logger['debug'](_0xd965('0xf'),_0x59fadc,_0xd965('0xe'),JSON[_0xd965('0x10')](_0x4ad301));if(_0x4ad301[_0xd965('0x11')]){if(_0x4ad301[_0xd965('0x11')]['code']===0x1f4){logger[_0xd965('0x11')](_0xd965('0xd'),_0x59fadc,_0x4ad301['error']['message']);return _0x21c632(_0x4ad301['error'][_0xd965('0x12')]);}logger[_0xd965('0x11')](_0xd965('0xd'),_0x59fadc,_0x4ad301[_0xd965('0x11')]['message']);return _0x433714(_0x4ad301[_0xd965('0x11')][_0xd965('0x12')]);}else{logger[_0xd965('0x13')](_0xd965('0xd'),_0x59fadc,_0xd965('0xe'));_0x433714(_0x4ad301['result'][_0xd965('0x12')]);}})['catch'](function(_0x47b63a){logger['error'](_0xd965('0xd'),_0x59fadc,_0x47b63a);_0x21c632(_0x47b63a);});});}exports[_0xd965('0x14')]=function(_0x876ef4){var _0xabe074=this;return new Promise(function(_0x532c40,_0x46ccf3){return db[_0xd965('0x15')][_0xd965('0x16')]({'raw':_0x876ef4['options']?_0x876ef4['options']['raw']===undefined?!![]:![]:!![],'where':_0x876ef4[_0xd965('0x17')]?_0x876ef4['options'][_0xd965('0x18')]||null:null,'attributes':_0x876ef4[_0xd965('0x17')]?_0x876ef4['options']['attributes']||null:null,'limit':_0x876ef4[_0xd965('0x17')]?_0x876ef4[_0xd965('0x17')][_0xd965('0x19')]||null:null,'include':_0x876ef4[_0xd965('0x17')]?_0x876ef4[_0xd965('0x17')][_0xd965('0x1a')]?_[_0xd965('0x1b')](_0x876ef4[_0xd965('0x17')][_0xd965('0x1a')],function(_0xc30f4d){return{'model':db[_0xc30f4d[_0xd965('0x1c')]],'as':_0xc30f4d['as'],'attributes':_0xc30f4d[_0xd965('0x1d')],'include':_0xc30f4d['include']?_[_0xd965('0x1b')](_0xc30f4d[_0xd965('0x1a')],function(_0x540d0c){return{'model':db[_0x540d0c['model']],'as':_0x540d0c['as'],'attributes':_0x540d0c['attributes'],'include':_0x540d0c['include']?_['map'](_0x540d0c[_0xd965('0x1a')],function(_0x182b87){return{'model':db[_0x182b87[_0xd965('0x1c')]],'as':_0x182b87['as'],'attributes':_0x182b87['attributes']};}):[]};}):[]};}):[]:[]})[_0xd965('0x1e')](function(_0xf6007e){logger[_0xd965('0x13')]('GetVoiceExtension',_0x876ef4);logger[_0xd965('0x1f')]('GetVoiceExtension',_0x876ef4,JSON['stringify'](_0xf6007e));_0x532c40(_0xf6007e);})[_0xd965('0x20')](function(_0x26379d){logger['error'](_0xd965('0x14'),_0x26379d['message'],_0x876ef4);_0x46ccf3(_0xabe074[_0xd965('0x11')](0x1f4,_0x26379d[_0xd965('0x12')]));});});}; \ No newline at end of file +var _0x7ed1=['where','attributes','limit','map','include','model','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceExtension','findAll','options','raw'];(function(_0x2a1338,_0x29f7aa){var _0xc02469=function(_0x475e5f){while(--_0x475e5f){_0x2a1338['push'](_0x2a1338['shift']());}};_0xc02469(++_0x29f7aa);}(_0x7ed1,0xca));var _0x17ed=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x7ed1[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x17ed('0x0'));var util=require('util');var moment=require(_0x17ed('0x1'));var BPromise=require(_0x17ed('0x2'));var rs=require(_0x17ed('0x3'));var fs=require('fs');var Redis=require(_0x17ed('0x4'));var db=require(_0x17ed('0x5'))['db'];var utils=require(_0x17ed('0x6'));var logger=require('../../config/logger')(_0x17ed('0x7'));var config=require(_0x17ed('0x8'));var jayson=require(_0x17ed('0x9'));var client=jayson[_0x17ed('0xa')]['http']({'port':0x232a});config['redis']=_[_0x17ed('0xb')](config[_0x17ed('0xc')],{'host':_0x17ed('0xd'),'port':0x18eb});var socket=require(_0x17ed('0xe'))(new Redis(config['redis']));require(_0x17ed('0xf'))[_0x17ed('0x10')](socket);function respondWithRpcPromise(_0x25cd40,_0x415d22,_0x29c926){return new BPromise(function(_0x1d50b0,_0x59a471){return client[_0x17ed('0x11')](_0x25cd40,_0x29c926)['then'](function(_0x4c8f8e){logger[_0x17ed('0x12')](_0x17ed('0x13'),_0x415d22,_0x17ed('0x14'));logger[_0x17ed('0x15')](_0x17ed('0x16'),_0x415d22,'request\x20sent',JSON[_0x17ed('0x17')](_0x4c8f8e));if(_0x4c8f8e[_0x17ed('0x18')]){if(_0x4c8f8e[_0x17ed('0x18')]['code']===0x1f4){logger[_0x17ed('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x415d22,_0x4c8f8e['error'][_0x17ed('0x19')]);return _0x59a471(_0x4c8f8e['error'][_0x17ed('0x19')]);}logger[_0x17ed('0x18')](_0x17ed('0x13'),_0x415d22,_0x4c8f8e[_0x17ed('0x18')]['message']);return _0x1d50b0(_0x4c8f8e[_0x17ed('0x18')][_0x17ed('0x19')]);}else{logger[_0x17ed('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x415d22,'request\x20sent');_0x1d50b0(_0x4c8f8e[_0x17ed('0x1a')][_0x17ed('0x19')]);}})[_0x17ed('0x1b')](function(_0x22e43d){logger[_0x17ed('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x415d22,_0x22e43d);_0x59a471(_0x22e43d);});});}exports[_0x17ed('0x1c')]=function(_0x3dc4cb){var _0x4d51b6=this;return new Promise(function(_0x2cac50,_0x3368aa){return db['VoiceExtension'][_0x17ed('0x1d')]({'raw':_0x3dc4cb[_0x17ed('0x1e')]?_0x3dc4cb[_0x17ed('0x1e')][_0x17ed('0x1f')]===undefined?!![]:![]:!![],'where':_0x3dc4cb[_0x17ed('0x1e')]?_0x3dc4cb[_0x17ed('0x1e')][_0x17ed('0x20')]||null:null,'attributes':_0x3dc4cb['options']?_0x3dc4cb[_0x17ed('0x1e')][_0x17ed('0x21')]||null:null,'limit':_0x3dc4cb['options']?_0x3dc4cb['options'][_0x17ed('0x22')]||null:null,'include':_0x3dc4cb['options']?_0x3dc4cb['options']['include']?_[_0x17ed('0x23')](_0x3dc4cb['options'][_0x17ed('0x24')],function(_0x225721){return{'model':db[_0x225721[_0x17ed('0x25')]],'as':_0x225721['as'],'attributes':_0x225721['attributes'],'include':_0x225721[_0x17ed('0x24')]?_[_0x17ed('0x23')](_0x225721[_0x17ed('0x24')],function(_0x4d1de9){return{'model':db[_0x4d1de9['model']],'as':_0x4d1de9['as'],'attributes':_0x4d1de9[_0x17ed('0x21')],'include':_0x4d1de9[_0x17ed('0x24')]?_[_0x17ed('0x23')](_0x4d1de9['include'],function(_0x38bb50){return{'model':db[_0x38bb50[_0x17ed('0x25')]],'as':_0x38bb50['as'],'attributes':_0x38bb50[_0x17ed('0x21')]};}):[]};}):[]};}):[]:[]})[_0x17ed('0x26')](function(_0x52db34){logger[_0x17ed('0x12')](_0x17ed('0x1c'),_0x3dc4cb);logger['debug'](_0x17ed('0x1c'),_0x3dc4cb,JSON[_0x17ed('0x17')](_0x52db34));_0x2cac50(_0x52db34);})[_0x17ed('0x1b')](function(_0x529966){logger[_0x17ed('0x18')](_0x17ed('0x1c'),_0x529966[_0x17ed('0x19')],_0x3dc4cb);_0x3368aa(_0x4d51b6[_0x17ed('0x18')](0x1f4,_0x529966['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 92015fe..a7bde8e 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 _0x2ef3=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x51a7b0,_0x4d07cf){var _0x481289=function(_0x2306a2){while(--_0x2306a2){_0x51a7b0['push'](_0x51a7b0['shift']());}};_0x481289(++_0x4d07cf);}(_0x2ef3,0xba));var _0x32ef=function(_0x1986ee,_0x5ca9a2){_0x1986ee=_0x1986ee-0x0;var _0x46a579=_0x2ef3[_0x1986ee];return _0x46a579;};'use strict';var VoiceExtensionEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){VoiceExtensionEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);VoiceExtensionEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x2f44de,_0x23ad0a){var _0x216ae8=function(_0x263ede){while(--_0x263ede){_0x2f44de['push'](_0x2f44de['shift']());}};_0x216ae8(++_0x23ad0a);}(_0x326f,0xd1));var _0xf326=function(_0x5440aa,_0x590d74){_0x5440aa=_0x5440aa-0x0;var _0x5a49ac=_0x326f[_0x5440aa];return _0x5a49ac;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 6253633..5a0d62a 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 _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(_0x129a0e,_0x3f08fb){var _0x424099=function(_0x30cdef){while(--_0x30cdef){_0x129a0e['push'](_0x129a0e['shift']());}};_0x424099(++_0x3f08fb);}(_0x2ef3,0xba));var _0x32ef=function(_0x133705,_0x236cf6){_0x133705=_0x133705-0x0;var _0x275eec=_0x2ef3[_0x133705];return _0x275eec;};'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 +var _0x5fdc=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id/messages','getMessages','create','put','/:id','update'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x5fdc,0x127));var _0xc5fd=function(_0x388f7a,_0x67499c){_0x388f7a=_0x388f7a-0x0;var _0x23ad4a=_0x5fdc[_0x388f7a];return _0x23ad4a;};'use strict';var multer=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var path=require(_0xc5fd('0x2'));var timeout=require(_0xc5fd('0x3'));var express=require(_0xc5fd('0x4'));var router=express[_0xc5fd('0x5')]();var fs_extra=require(_0xc5fd('0x6'));var auth=require(_0xc5fd('0x7'));var interaction=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var controller=require(_0xc5fd('0xa'));router[_0xc5fd('0xb')]('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xd')]);router[_0xc5fd('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc5fd('0xb')](_0xc5fd('0xe'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc5fd('0x10')]);router[_0xc5fd('0x11')](_0xc5fd('0x12'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x13')]);router[_0xc5fd('0x14')]('/:id',auth[_0xc5fd('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index cbdbdfb..a229fad 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 _0x81ae=['\x20-\x20','exports','from-voicemail','contest_mailbox','STRING','string','trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x81ae,0x196));var _0xe81a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x81ae[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');module[_0xe81a('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0xe81a('0x1'),'unique':_0xe81a('0x2')},'mailbox':{'type':Sequelize[_0xe81a('0x3')],'defaultValue':'','allowNull':![],'unique':_0xe81a('0x2')},'password':{'type':Sequelize[_0xe81a('0x3')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4eab15){this['setDataValue']('email',typeof _0x4eab15===_0xe81a('0x4')&&_0x4eab15[_0xe81a('0x5')]()?_0x4eab15[_0xe81a('0x5')]():null);}},'pager':{'type':Sequelize[_0xe81a('0x3')]},'tz':{'type':Sequelize[_0xe81a('0x3')],'defaultValue':_0xe81a('0x6')},'attach':{'type':Sequelize['ENUM'](_0xe81a('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xe81a('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0xe81a('0x3')]},'callback':{'type':Sequelize[_0xe81a('0x3')]},'review':{'type':Sequelize[_0xe81a('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe81a('0x8')](_0xe81a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xe81a('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe81a('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xe81a('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe81a('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe81a('0x8')](_0xe81a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xe81a('0x8')](_0xe81a('0x7'),'no'),'defaultValue':_0xe81a('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xe81a('0x8')](_0xe81a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xe81a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe81a('0x8')](_0xe81a('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xe81a('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xe81a('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe81a('0xb')],'get':function(){return this[_0xe81a('0xc')](_0xe81a('0xd'))+_0xe81a('0xe')+this[_0xe81a('0xc')]('mailbox');}}}; \ No newline at end of file +var _0x0370=['ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','contest_mailbox','email','trim','central','yes'];(function(_0x1d0e07,_0x2037e9){var _0x8912e0=function(_0x3b1c66){while(--_0x3b1c66){_0x1d0e07['push'](_0x1d0e07['shift']());}};_0x8912e0(++_0x2037e9);}(_0x0370,0x76));var _0x0037=function(_0x3e38bf,_0x1dec44){_0x3e38bf=_0x3e38bf-0x0;var _0x3126fe=_0x0370[_0x3e38bf];return _0x3126fe;};'use strict';var Sequelize=require(_0x0037('0x0'));module[_0x0037('0x1')]={'customer_id':{'type':Sequelize[_0x0037('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0x0037('0x3')},'mailbox':{'type':Sequelize[_0x0037('0x2')],'defaultValue':'','allowNull':![],'unique':_0x0037('0x3')},'password':{'type':Sequelize[_0x0037('0x2')]},'fullname':{'type':Sequelize[_0x0037('0x2')]},'email':{'type':Sequelize[_0x0037('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3bbff2){this['setDataValue'](_0x0037('0x4'),typeof _0x3bbff2==='string'&&_0x3bbff2[_0x0037('0x5')]()?_0x3bbff2[_0x0037('0x5')]():null);}},'pager':{'type':Sequelize[_0x0037('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x0037('0x6')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x0037('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x0037('0x2')]},'review':{'type':Sequelize[_0x0037('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0037('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0037('0x8')](_0x0037('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0037('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0037('0x8')](_0x0037('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0037('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x0037('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0037('0x8')](_0x0037('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0037('0x8')](_0x0037('0x7'),'no'),'defaultValue':_0x0037('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x0037('0x2')]},'emailbody':{'type':Sequelize[_0x0037('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0037('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0037('0xb')],'get':function(){return this[_0x0037('0xc')]('fullname')+'\x20-\x20'+this[_0x0037('0xc')](_0x0037('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 062bffd..b269f05 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 _0x236c=['fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','Voicemails','UserProfileResource','error','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x16a6a7,_0x13cfce){var _0x38af75=function(_0x15fe75){while(--_0x15fe75){_0x16a6a7['push'](_0x16a6a7['shift']());}};_0x38af75(++_0x13cfce);}(_0x236c,0x155));var _0xc236=function(_0x16d7ff,_0x180aa7){_0x16d7ff=_0x16d7ff-0x0;var _0x5b183f=_0x236c[_0x16d7ff];return _0x5b183f;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];function respondWithStatusCode(_0x5ee3a5,_0x5b9638){_0x5b9638=_0x5b9638||0xcc;return function(_0x5bce83){if(_0x5bce83){return _0x5ee3a5['sendStatus'](_0x5b9638);}return _0x5ee3a5[_0xc236('0x18')](_0x5b9638)[_0xc236('0x19')]();};}function respondWithResult(_0x2184c9,_0x71bce2){_0x71bce2=_0x71bce2||0xc8;return function(_0x5052db){if(_0x5052db){return _0x2184c9[_0xc236('0x18')](_0x71bce2)['json'](_0x5052db);}};}function respondWithFilteredResult(_0x5221bf,_0x9a65e8){return function(_0x32f2fd){if(_0x32f2fd){var _0x443a46=typeof _0x9a65e8[_0xc236('0x1a')]===_0xc236('0x1b')&&typeof _0x9a65e8['limit']==='undefined';var _0x57355b=_0x32f2fd[_0xc236('0x1c')];var _0x76f45=_0x443a46?0x0:_0x9a65e8[_0xc236('0x1a')];var _0x541a20=_0x443a46?_0x32f2fd[_0xc236('0x1c')]:_0x9a65e8['offset']+_0x9a65e8['limit'];var _0x1eafba;if(_0x541a20>=_0x57355b){_0x541a20=_0x57355b;_0x1eafba=0xc8;}else{_0x1eafba=0xce;}_0x5221bf[_0xc236('0x18')](_0x1eafba);return _0x5221bf[_0xc236('0x1d')](_0xc236('0x1e'),_0x76f45+'-'+_0x541a20+'/'+_0x57355b)[_0xc236('0x1f')](_0x32f2fd);}return null;};}function patchUpdates(_0x27c6ab){return function(_0x3f0e2f){try{jsonpatch[_0xc236('0x20')](_0x3f0e2f,_0x27c6ab,!![]);}catch(_0x54ffac){return BPromise[_0xc236('0x21')](_0x54ffac);}return _0x3f0e2f[_0xc236('0x22')]();};}function saveUpdates(_0x4a9006,_0x208c3f){return function(_0x34d73a){if(_0x34d73a){return _0x34d73a[_0xc236('0x23')](_0x4a9006)[_0xc236('0x24')](function(_0x27afba){return _0x27afba;});}return null;};}function removeEntity(_0x21fab8,_0x3a315b){return function(_0xf921e6){if(_0xf921e6){return _0xf921e6[_0xc236('0x25')]()[_0xc236('0x24')](function(){var _0x17cb3b=_0xf921e6['get']({'plain':!![]});var _0x308cd6=_0xc236('0x26');return db[_0xc236('0x27')][_0xc236('0x25')]({'where':{'type':_0x308cd6,'resourceId':_0x17cb3b['id']}})['then'](function(){return _0xf921e6;});})[_0xc236('0x24')](function(){_0x21fab8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ead8,_0x4eace8){return function(_0x36e578){if(!_0x36e578){_0x15ead8['sendStatus'](0x194);}return _0x36e578;};}function handleError(_0x54365,_0x5c79d6){_0x5c79d6=_0x5c79d6||0x1f4;return function(_0x423842){logger[_0xc236('0x28')](_0x423842['stack']);if(_0x423842['name']){delete _0x423842[_0xc236('0x29')];}_0x54365[_0xc236('0x18')](_0x5c79d6)[_0xc236('0x2a')](_0x423842);};}exports[_0xc236('0x2b')]=function(_0x5f3891,_0x4e3262){var _0x28ffa5={},_0x53b767={},_0x2c756f={'count':0x0,'rows':[]};var _0x4ddc87=_[_0xc236('0x2c')](db[_0xc236('0x2d')]['rawAttributes'],function(_0x5a5ec3){return{'name':_0x5a5ec3[_0xc236('0x2e')],'type':_0x5a5ec3[_0xc236('0x2f')][_0xc236('0x30')]};});_0x53b767[_0xc236('0x31')]=_[_0xc236('0x2c')](_0x4ddc87,_0xc236('0x29'));_0x53b767[_0xc236('0x32')]=_[_0xc236('0x33')](_0x5f3891[_0xc236('0x32')]);_0x53b767['filters']=_['intersection'](_0x53b767['model'],_0x53b767[_0xc236('0x32')]);_0x28ffa5[_0xc236('0x34')]=_[_0xc236('0x35')](_0x53b767[_0xc236('0x31')],qs[_0xc236('0x36')](_0x5f3891[_0xc236('0x32')][_0xc236('0x36')]));_0x28ffa5['attributes']=_0x28ffa5[_0xc236('0x34')][_0xc236('0x37')]?_0x28ffa5[_0xc236('0x34')]:_0x53b767['model'];if(!_0x5f3891[_0xc236('0x32')][_0xc236('0x38')](_0xc236('0x39'))){_0x28ffa5[_0xc236('0x3a')]=qs['limit'](_0x5f3891[_0xc236('0x32')][_0xc236('0x3a')]);_0x28ffa5[_0xc236('0x1a')]=qs[_0xc236('0x1a')](_0x5f3891[_0xc236('0x32')][_0xc236('0x1a')]);}_0x28ffa5[_0xc236('0x3b')]=qs[_0xc236('0x3c')](_0x5f3891[_0xc236('0x32')][_0xc236('0x3c')]);_0x28ffa5[_0xc236('0x3d')]=qs[_0xc236('0x3e')](_[_0xc236('0x3f')](_0x5f3891[_0xc236('0x32')],_0x53b767[_0xc236('0x3e')]),_0x4ddc87);if(_0x5f3891[_0xc236('0x32')][_0xc236('0x40')]){_0x28ffa5['where']=_['merge'](_0x28ffa5['where'],{'$or':_['map'](_0x4ddc87,function(_0x369a79){if(_0x369a79['type']!==_0xc236('0x41')){var _0x361526={};_0x361526[_0x369a79[_0xc236('0x29')]]={'$like':'%'+_0x5f3891[_0xc236('0x32')][_0xc236('0x40')]+'%'};return _0x361526;}})});}_0x28ffa5=_[_0xc236('0x42')]({},_0x28ffa5,_0x5f3891[_0xc236('0x43')]);var _0x201ba3={'where':_0x28ffa5[_0xc236('0x3d')]};return db[_0xc236('0x2d')][_0xc236('0x1c')](_0x201ba3)[_0xc236('0x24')](function(_0x3b2f2f){_0x2c756f[_0xc236('0x1c')]=_0x3b2f2f;if(_0x5f3891[_0xc236('0x32')]['includeAll']){_0x28ffa5[_0xc236('0x44')]=[{'all':!![]}];}return db[_0xc236('0x2d')]['findAll'](_0x28ffa5);})[_0xc236('0x24')](function(_0x5b0bc5){_0x2c756f[_0xc236('0x45')]=_0x5b0bc5;return _0x2c756f;})['then'](respondWithFilteredResult(_0x4e3262,_0x28ffa5))[_0xc236('0x46')](handleError(_0x4e3262,null));};exports[_0xc236('0x47')]=function(_0x8d04c9,_0x479e02){var _0x11e3dd={'raw':!![],'where':{'id':_0x8d04c9[_0xc236('0x48')]['id']}},_0x429e08={};_0x429e08['model']=_[_0xc236('0x33')](db[_0xc236('0x2d')][_0xc236('0x49')]);_0x429e08[_0xc236('0x32')]=_[_0xc236('0x33')](_0x8d04c9[_0xc236('0x32')]);_0x429e08['filters']=_[_0xc236('0x35')](_0x429e08['model'],_0x429e08[_0xc236('0x32')]);_0x11e3dd[_0xc236('0x34')]=_[_0xc236('0x35')](_0x429e08[_0xc236('0x31')],qs[_0xc236('0x36')](_0x8d04c9[_0xc236('0x32')][_0xc236('0x36')]));_0x11e3dd['attributes']=_0x11e3dd[_0xc236('0x34')]['length']?_0x11e3dd[_0xc236('0x34')]:_0x429e08[_0xc236('0x31')];if(_0x8d04c9['query'][_0xc236('0x4a')]){_0x11e3dd[_0xc236('0x44')]=[{'all':!![]}];}_0x11e3dd=_[_0xc236('0x42')]({},_0x11e3dd,_0x8d04c9[_0xc236('0x43')]);return db[_0xc236('0x2d')][_0xc236('0x4b')](_0x11e3dd)[_0xc236('0x24')](handleEntityNotFound(_0x479e02,null))['then'](respondWithResult(_0x479e02,null))['catch'](handleError(_0x479e02,null));};exports[_0xc236('0x4c')]=function(_0x2afed2,_0x510f7f){return db[_0xc236('0x2d')][_0xc236('0x4c')](_0x2afed2[_0xc236('0x4d')],{})[_0xc236('0x24')](function(_0x45fa20){var _0x1683f4=_0x2afed2[_0xc236('0x4e')][_0xc236('0x4f')]({'plain':!![]});if(!_0x1683f4)throw new Error(_0xc236('0x50'));if(_0x1683f4['role']===_0xc236('0x4e')){var _0x307663=_0x45fa20[_0xc236('0x4f')]({'plain':!![]});var _0x447a83=_0xc236('0x26');return db[_0xc236('0x51')][_0xc236('0x4b')]({'where':{'name':_0x447a83,'userProfileId':_0x1683f4['userProfileId']},'raw':!![]})[_0xc236('0x24')](function(_0x3788ff){if(_0x3788ff&&_0x3788ff[_0xc236('0x52')]===0x0){return db[_0xc236('0x27')]['create']({'name':_0x307663[_0xc236('0x29')],'resourceId':_0x307663['id'],'type':_0x3788ff[_0xc236('0x29')],'sectionId':_0x3788ff['id']},{})[_0xc236('0x24')](function(){return _0x45fa20;});}else{return _0x45fa20;}})[_0xc236('0x46')](function(_0x9d81c8){logger['error'](_0xc236('0x53'),_0x9d81c8);throw _0x9d81c8;});}return _0x45fa20;})['then'](respondWithResult(_0x510f7f,0xc9))[_0xc236('0x46')](handleError(_0x510f7f,null));};exports[_0xc236('0x23')]=function(_0x3f9e85,_0x15defc){if(_0x3f9e85[_0xc236('0x4d')]['id']){delete _0x3f9e85['body']['id'];}return db['VoiceMail'][_0xc236('0x4b')]({'where':{'id':_0x3f9e85[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x15defc,null))[_0xc236('0x24')](saveUpdates(_0x3f9e85[_0xc236('0x4d')],null))[_0xc236('0x24')](respondWithResult(_0x15defc,null))[_0xc236('0x46')](handleError(_0x15defc,null));};exports[_0xc236('0x25')]=function(_0x24af08,_0x2d27e7){return db['VoiceMail']['find']({'where':{'id':_0x24af08[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x2d27e7,null))[_0xc236('0x24')](removeEntity(_0x2d27e7,null))[_0xc236('0x46')](handleError(_0x2d27e7,null));};exports['getMessages']=function(_0x94fc7,_0x460076,_0x56e476){return db[_0xc236('0x2d')][_0xc236('0x54')]({'where':{'id':_0x94fc7[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x460076,null))['then'](function(_0x1558dd){var _0xec00da;var _0x35955c={},_0x2602f8={};_0x2602f8[_0xc236('0x31')]=_[_0xc236('0x33')](db[_0xc236('0x55')]['rawAttributes']);_0x2602f8[_0xc236('0x32')]=_['keys'](_0x94fc7[_0xc236('0x32')]);_0x2602f8[_0xc236('0x3e')]=_[_0xc236('0x35')](_0x2602f8[_0xc236('0x31')],_0x2602f8['query']);_0x35955c[_0xc236('0x34')]=_[_0xc236('0x35')](_0x2602f8[_0xc236('0x31')],qs['fields'](_0x94fc7[_0xc236('0x32')][_0xc236('0x36')]));_0x35955c[_0xc236('0x34')]=_0x35955c[_0xc236('0x34')][_0xc236('0x37')]?_0x35955c[_0xc236('0x34')]:_0x2602f8['model'];if(!_0x94fc7['query'][_0xc236('0x38')](_0xc236('0x39'))){_0x35955c[_0xc236('0x3a')]=qs[_0xc236('0x3a')](_0x94fc7[_0xc236('0x32')][_0xc236('0x3a')]);_0x35955c[_0xc236('0x1a')]=qs['offset'](_0x94fc7['query']['offset']);}_0x35955c[_0xc236('0x3b')]=qs[_0xc236('0x3c')](_0x94fc7[_0xc236('0x32')][_0xc236('0x3c')]);_0x35955c['where']=qs['filters'](_['pick'](_0x94fc7['query'],_0x2602f8[_0xc236('0x3e')]));if(_0x94fc7['query'][_0xc236('0x40')]){_0x35955c['where']=_[_0xc236('0x42')](_0x35955c[_0xc236('0x3d')],{'$or':_[_0xc236('0x2c')](_0x35955c[_0xc236('0x34')],function(_0x26d708){var _0x169e73={};_0x169e73[_0x26d708]={'$like':'%'+_0x94fc7[_0xc236('0x32')]['filter']+'%'};return _0x169e73;})});}_0x35955c[_0xc236('0x3d')]=_['merge'](_0x35955c[_0xc236('0x3d')],{'mailboxuser':_0x1558dd[_0xc236('0x56')]});_0x35955c=_[_0xc236('0x42')]({},_0x35955c,_0x94fc7[_0xc236('0x43')]);return db[_0xc236('0x55')][_0xc236('0x57')](_0x35955c)['then'](respondWithFilteredResult(_0x460076,_0x35955c));})[_0xc236('0x46')](handleError(_0x460076,null));}; \ No newline at end of file +var _0xeffd=['create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','nolimit','order','pick','mailbox','findAndCountAll','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','update','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','type','merge','count','includeAll','include','findAll','catch','show','params','rawAttributes','options','find'];(function(_0x3db8a0,_0x24f51d){var _0x13af4c=function(_0x1fc6ba){while(--_0x1fc6ba){_0x3db8a0['push'](_0x3db8a0['shift']());}};_0x13af4c(++_0x24f51d);}(_0xeffd,0x6b));var _0xdeff=function(_0x407f27,_0x5aa56a){_0x407f27=_0x407f27-0x0;var _0xcbc250=_0xeffd[_0x407f27];return _0xcbc250;};'use strict';var emlformat=require(_0xdeff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdeff('0x1'));var jsonpatch=require(_0xdeff('0x2'));var rp=require(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var BPromise=require(_0xdeff('0x5'));var Mustache=require(_0xdeff('0x6'));var util=require(_0xdeff('0x7'));var path=require(_0xdeff('0x8'));var sox=require(_0xdeff('0x9'));var csv=require(_0xdeff('0xa'));var ejs=require(_0xdeff('0xb'));var fs=require('fs');var fs_extra=require(_0xdeff('0xc'));var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdeff('0x15'));var as=require(_0xdeff('0x16'));var hardwareService=require(_0xdeff('0x17'));var logger=require(_0xdeff('0x18'))(_0xdeff('0x19'));var utils=require(_0xdeff('0x1a'));var config=require(_0xdeff('0x1b'));var licenseUtil=require(_0xdeff('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461699,_0x116bf9){_0x116bf9=_0x116bf9||0xcc;return function(_0x4952f2){if(_0x4952f2){return _0x461699[_0xdeff('0x1d')](_0x116bf9);}return _0x461699['status'](_0x116bf9)['end']();};}function respondWithResult(_0x3e56a1,_0x47410f){_0x47410f=_0x47410f||0xc8;return function(_0x1585e8){if(_0x1585e8){return _0x3e56a1[_0xdeff('0x1e')](_0x47410f)['json'](_0x1585e8);}};}function respondWithFilteredResult(_0x826132,_0x314ded){return function(_0xea6c4){if(_0xea6c4){var _0x391633=typeof _0x314ded[_0xdeff('0x1f')]===_0xdeff('0x20')&&typeof _0x314ded['limit']==='undefined';var _0x7440af=_0xea6c4['count'];var _0x5c9837=_0x391633?0x0:_0x314ded[_0xdeff('0x1f')];var _0x369e13=_0x391633?_0xea6c4['count']:_0x314ded[_0xdeff('0x1f')]+_0x314ded[_0xdeff('0x21')];var _0x1ab1fa;if(_0x369e13>=_0x7440af){_0x369e13=_0x7440af;_0x1ab1fa=0xc8;}else{_0x1ab1fa=0xce;}_0x826132[_0xdeff('0x1e')](_0x1ab1fa);return _0x826132[_0xdeff('0x22')](_0xdeff('0x23'),_0x5c9837+'-'+_0x369e13+'/'+_0x7440af)[_0xdeff('0x24')](_0xea6c4);}return null;};}function patchUpdates(_0x919c93){return function(_0x488faa){try{jsonpatch['apply'](_0x488faa,_0x919c93,!![]);}catch(_0x56cb84){return BPromise[_0xdeff('0x25')](_0x56cb84);}return _0x488faa['save']();};}function saveUpdates(_0x189627,_0x91c0b4){return function(_0x543653){if(_0x543653){return _0x543653[_0xdeff('0x26')](_0x189627)[_0xdeff('0x27')](function(_0x4eb2a8){return _0x4eb2a8;});}return null;};}function removeEntity(_0x5dbe96,_0x3b2554){return function(_0x15c425){if(_0x15c425){return _0x15c425[_0xdeff('0x28')]()[_0xdeff('0x27')](function(){var _0x32add9=_0x15c425['get']({'plain':!![]});var _0xb08f19=_0xdeff('0x29');return db[_0xdeff('0x2a')][_0xdeff('0x28')]({'where':{'type':_0xb08f19,'resourceId':_0x32add9['id']}})[_0xdeff('0x27')](function(){return _0x15c425;});})[_0xdeff('0x27')](function(){_0x5dbe96[_0xdeff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31bb72,_0x1a546c){return function(_0x53b168){if(!_0x53b168){_0x31bb72['sendStatus'](0x194);}return _0x53b168;};}function handleError(_0x830be4,_0x2ea8e9){_0x2ea8e9=_0x2ea8e9||0x1f4;return function(_0x16b2d0){logger[_0xdeff('0x2b')](_0x16b2d0[_0xdeff('0x2c')]);if(_0x16b2d0[_0xdeff('0x2d')]){delete _0x16b2d0[_0xdeff('0x2d')];}_0x830be4['status'](_0x2ea8e9)[_0xdeff('0x2e')](_0x16b2d0);};}exports[_0xdeff('0x2f')]=function(_0x34e258,_0x5045b8){var _0x59f7a0={},_0x346743={},_0x505e3f={'count':0x0,'rows':[]};var _0x69842a=_[_0xdeff('0x30')](db[_0xdeff('0x31')]['rawAttributes'],function(_0x189a51){return{'name':_0x189a51['fieldName'],'type':_0x189a51['type'][_0xdeff('0x32')]};});_0x346743[_0xdeff('0x33')]=_[_0xdeff('0x30')](_0x69842a,_0xdeff('0x2d'));_0x346743['query']=_[_0xdeff('0x34')](_0x34e258[_0xdeff('0x35')]);_0x346743[_0xdeff('0x36')]=_[_0xdeff('0x37')](_0x346743[_0xdeff('0x33')],_0x346743[_0xdeff('0x35')]);_0x59f7a0[_0xdeff('0x38')]=_['intersection'](_0x346743[_0xdeff('0x33')],qs['fields'](_0x34e258[_0xdeff('0x35')][_0xdeff('0x39')]));_0x59f7a0[_0xdeff('0x38')]=_0x59f7a0[_0xdeff('0x38')][_0xdeff('0x3a')]?_0x59f7a0[_0xdeff('0x38')]:_0x346743['model'];if(!_0x34e258[_0xdeff('0x35')][_0xdeff('0x3b')]('nolimit')){_0x59f7a0[_0xdeff('0x21')]=qs[_0xdeff('0x21')](_0x34e258[_0xdeff('0x35')][_0xdeff('0x21')]);_0x59f7a0[_0xdeff('0x1f')]=qs[_0xdeff('0x1f')](_0x34e258[_0xdeff('0x35')][_0xdeff('0x1f')]);}_0x59f7a0['order']=qs[_0xdeff('0x3c')](_0x34e258['query'][_0xdeff('0x3c')]);_0x59f7a0[_0xdeff('0x3d')]=qs[_0xdeff('0x36')](_['pick'](_0x34e258[_0xdeff('0x35')],_0x346743[_0xdeff('0x36')]),_0x69842a);if(_0x34e258[_0xdeff('0x35')][_0xdeff('0x3e')]){_0x59f7a0[_0xdeff('0x3d')]=_['merge'](_0x59f7a0[_0xdeff('0x3d')],{'$or':_['map'](_0x69842a,function(_0x393d75){if(_0x393d75[_0xdeff('0x3f')]!=='VIRTUAL'){var _0x30609b={};_0x30609b[_0x393d75[_0xdeff('0x2d')]]={'$like':'%'+_0x34e258[_0xdeff('0x35')][_0xdeff('0x3e')]+'%'};return _0x30609b;}})});}_0x59f7a0=_[_0xdeff('0x40')]({},_0x59f7a0,_0x34e258['options']);var _0x3d8a33={'where':_0x59f7a0[_0xdeff('0x3d')]};return db[_0xdeff('0x31')][_0xdeff('0x41')](_0x3d8a33)[_0xdeff('0x27')](function(_0x5dfbb3){_0x505e3f['count']=_0x5dfbb3;if(_0x34e258[_0xdeff('0x35')][_0xdeff('0x42')]){_0x59f7a0[_0xdeff('0x43')]=[{'all':!![]}];}return db[_0xdeff('0x31')][_0xdeff('0x44')](_0x59f7a0);})[_0xdeff('0x27')](function(_0x2cd68a){_0x505e3f['rows']=_0x2cd68a;return _0x505e3f;})[_0xdeff('0x27')](respondWithFilteredResult(_0x5045b8,_0x59f7a0))[_0xdeff('0x45')](handleError(_0x5045b8,null));};exports[_0xdeff('0x46')]=function(_0x54fa5b,_0x1c3532){var _0x2c5eee={'raw':!![],'where':{'id':_0x54fa5b[_0xdeff('0x47')]['id']}},_0x14dc7b={};_0x14dc7b['model']=_[_0xdeff('0x34')](db[_0xdeff('0x31')][_0xdeff('0x48')]);_0x14dc7b[_0xdeff('0x35')]=_[_0xdeff('0x34')](_0x54fa5b[_0xdeff('0x35')]);_0x14dc7b[_0xdeff('0x36')]=_[_0xdeff('0x37')](_0x14dc7b['model'],_0x14dc7b[_0xdeff('0x35')]);_0x2c5eee[_0xdeff('0x38')]=_[_0xdeff('0x37')](_0x14dc7b[_0xdeff('0x33')],qs[_0xdeff('0x39')](_0x54fa5b['query'][_0xdeff('0x39')]));_0x2c5eee[_0xdeff('0x38')]=_0x2c5eee[_0xdeff('0x38')][_0xdeff('0x3a')]?_0x2c5eee[_0xdeff('0x38')]:_0x14dc7b['model'];if(_0x54fa5b[_0xdeff('0x35')]['includeAll']){_0x2c5eee[_0xdeff('0x43')]=[{'all':!![]}];}_0x2c5eee=_[_0xdeff('0x40')]({},_0x2c5eee,_0x54fa5b[_0xdeff('0x49')]);return db[_0xdeff('0x31')][_0xdeff('0x4a')](_0x2c5eee)[_0xdeff('0x27')](handleEntityNotFound(_0x1c3532,null))['then'](respondWithResult(_0x1c3532,null))['catch'](handleError(_0x1c3532,null));};exports[_0xdeff('0x4b')]=function(_0xf91a72,_0x3dc206){return db['VoiceMail']['create'](_0xf91a72[_0xdeff('0x4c')],{})[_0xdeff('0x27')](function(_0x497d9f){var _0x23f17d=_0xf91a72[_0xdeff('0x4d')][_0xdeff('0x4e')]({'plain':!![]});if(!_0x23f17d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23f17d[_0xdeff('0x4f')]===_0xdeff('0x4d')){var _0x1ca376=_0x497d9f['get']({'plain':!![]});var _0xce8379=_0xdeff('0x29');return db[_0xdeff('0x50')][_0xdeff('0x4a')]({'where':{'name':_0xce8379,'userProfileId':_0x23f17d[_0xdeff('0x51')]},'raw':!![]})[_0xdeff('0x27')](function(_0x2c7fa4){if(_0x2c7fa4&&_0x2c7fa4['autoAssociation']===0x0){return db[_0xdeff('0x2a')][_0xdeff('0x4b')]({'name':_0x1ca376['name'],'resourceId':_0x1ca376['id'],'type':_0x2c7fa4[_0xdeff('0x2d')],'sectionId':_0x2c7fa4['id']},{})[_0xdeff('0x27')](function(){return _0x497d9f;});}else{return _0x497d9f;}})[_0xdeff('0x45')](function(_0x33482b){logger[_0xdeff('0x2b')](_0xdeff('0x52'),_0x33482b);throw _0x33482b;});}return _0x497d9f;})[_0xdeff('0x27')](respondWithResult(_0x3dc206,0xc9))[_0xdeff('0x45')](handleError(_0x3dc206,null));};exports['update']=function(_0x1b7eb3,_0x3a518d){if(_0x1b7eb3[_0xdeff('0x4c')]['id']){delete _0x1b7eb3['body']['id'];}return db['VoiceMail'][_0xdeff('0x4a')]({'where':{'id':_0x1b7eb3[_0xdeff('0x47')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x3a518d,null))[_0xdeff('0x27')](saveUpdates(_0x1b7eb3[_0xdeff('0x4c')],null))[_0xdeff('0x27')](respondWithResult(_0x3a518d,null))['catch'](handleError(_0x3a518d,null));};exports['destroy']=function(_0x38338b,_0x1cc2c1){return db['VoiceMail']['find']({'where':{'id':_0x38338b[_0xdeff('0x47')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x1cc2c1,null))['then'](removeEntity(_0x1cc2c1,null))[_0xdeff('0x45')](handleError(_0x1cc2c1,null));};exports[_0xdeff('0x53')]=function(_0x577fa8,_0x14fa7f,_0xe731d8){return db['VoiceMail'][_0xdeff('0x54')]({'where':{'id':_0x577fa8[_0xdeff('0x47')]['id']}})['then'](handleEntityNotFound(_0x14fa7f,null))[_0xdeff('0x27')](function(_0x152187){var _0x2a83ac;var _0x592ea6={},_0x47e86d={};_0x47e86d[_0xdeff('0x33')]=_['keys'](db[_0xdeff('0x55')][_0xdeff('0x48')]);_0x47e86d[_0xdeff('0x35')]=_[_0xdeff('0x34')](_0x577fa8[_0xdeff('0x35')]);_0x47e86d['filters']=_['intersection'](_0x47e86d[_0xdeff('0x33')],_0x47e86d[_0xdeff('0x35')]);_0x592ea6[_0xdeff('0x38')]=_[_0xdeff('0x37')](_0x47e86d[_0xdeff('0x33')],qs[_0xdeff('0x39')](_0x577fa8['query'][_0xdeff('0x39')]));_0x592ea6['attributes']=_0x592ea6[_0xdeff('0x38')][_0xdeff('0x3a')]?_0x592ea6[_0xdeff('0x38')]:_0x47e86d[_0xdeff('0x33')];if(!_0x577fa8[_0xdeff('0x35')][_0xdeff('0x3b')](_0xdeff('0x56'))){_0x592ea6[_0xdeff('0x21')]=qs[_0xdeff('0x21')](_0x577fa8['query'][_0xdeff('0x21')]);_0x592ea6['offset']=qs[_0xdeff('0x1f')](_0x577fa8[_0xdeff('0x35')]['offset']);}_0x592ea6[_0xdeff('0x57')]=qs['sort'](_0x577fa8[_0xdeff('0x35')]['sort']);_0x592ea6['where']=qs[_0xdeff('0x36')](_[_0xdeff('0x58')](_0x577fa8['query'],_0x47e86d[_0xdeff('0x36')]));if(_0x577fa8[_0xdeff('0x35')][_0xdeff('0x3e')]){_0x592ea6[_0xdeff('0x3d')]=_[_0xdeff('0x40')](_0x592ea6[_0xdeff('0x3d')],{'$or':_[_0xdeff('0x30')](_0x592ea6[_0xdeff('0x38')],function(_0x46046a){var _0x517ca7={};_0x517ca7[_0x46046a]={'$like':'%'+_0x577fa8[_0xdeff('0x35')][_0xdeff('0x3e')]+'%'};return _0x517ca7;})});}_0x592ea6['where']=_['merge'](_0x592ea6[_0xdeff('0x3d')],{'mailboxuser':_0x152187[_0xdeff('0x59')]});_0x592ea6=_['merge']({},_0x592ea6,_0x577fa8[_0xdeff('0x49')]);return db[_0xdeff('0x55')][_0xdeff('0x5a')](_0x592ea6)[_0xdeff('0x27')](respondWithFilteredResult(_0x14fa7f,_0x592ea6));})[_0xdeff('0x45')](handleError(_0x14fa7f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 35cac2c..2329f86 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 _0xf194=['../../config/logger','bluebird','path','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','context','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf194,0x1b7));var _0x4f19=function(_0x302f42,_0x3734b6){_0x302f42=_0x302f42-0x0;var _0x36532b=_0xf194[_0x302f42];return _0x36532b;};'use strict';var _=require('lodash');var util=require(_0x4f19('0x0'));var logger=require(_0x4f19('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4f19('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f19('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4f19('0x4'));module[_0x4f19('0x5')]=function(_0x2cf7bf,_0x184cd2){return _0x2cf7bf[_0x4f19('0x6')](_0x4f19('0x7'),attributes,{'tableName':_0x4f19('0x8'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x4f19('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b81=['../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','context','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3b81,0x1ed));var _0x13b8=function(_0xe7bf01,_0x59923d){_0xe7bf01=_0xe7bf01-0x0;var _0xc29a5=_0x3b81[_0xe7bf01];return _0xc29a5;};'use strict';var _=require('lodash');var util=require(_0x13b8('0x0'));var logger=require(_0x13b8('0x1'))(_0x13b8('0x2'));var moment=require(_0x13b8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x13b8('0x4'));var rimraf=require(_0x13b8('0x5'));var config=require(_0x13b8('0x6'));var attributes=require(_0x13b8('0x7'));module['exports']=function(_0x2d6b5f,_0x5497f1){return _0x2d6b5f[_0x13b8('0x8')](_0x13b8('0x9'),attributes,{'tableName':_0x13b8('0xa'),'paranoid':![],'indexes':[{'name':_0x13b8('0xb'),'fields':['mailbox',_0x13b8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 49c088c..25a916c 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 _0x6cec=['randomstring','ioredis','../../mysqldb','../../config/utils','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','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x4c2e0f,_0x39c1c2){var _0x4bd0b6=function(_0x2d0eea){while(--_0x2d0eea){_0x4c2e0f['push'](_0x4c2e0f['shift']());}};_0x4bd0b6(++_0x39c1c2);}(_0x6cec,0xac));var _0xc6ce=function(_0x13639d,_0x3c996b){_0x13639d=_0x13639d-0x0;var _0x52ef14=_0x6cec[_0x13639d];return _0x52ef14;};'use strict';var _=require(_0xc6ce('0x0'));var util=require(_0xc6ce('0x1'));var moment=require('moment');var BPromise=require(_0xc6ce('0x2'));var rs=require(_0xc6ce('0x3'));var fs=require('fs');var Redis=require(_0xc6ce('0x4'));var db=require(_0xc6ce('0x5'))['db'];var utils=require(_0xc6ce('0x6'));var logger=require('../../config/logger')(_0xc6ce('0x7'));var config=require(_0xc6ce('0x8'));var jayson=require(_0xc6ce('0x9'));var client=jayson[_0xc6ce('0xa')][_0xc6ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1016,_0x2112b4,_0x42ad6f){return new BPromise(function(_0x4b77a3,_0x39893e){return client[_0xc6ce('0xc')](_0x4b1016,_0x42ad6f)[_0xc6ce('0xd')](function(_0x3305da){logger[_0xc6ce('0xe')](_0xc6ce('0xf'),_0x2112b4,_0xc6ce('0x10'));logger[_0xc6ce('0x11')](_0xc6ce('0x12'),_0x2112b4,_0xc6ce('0x10'),JSON[_0xc6ce('0x13')](_0x3305da));if(_0x3305da[_0xc6ce('0x14')]){if(_0x3305da[_0xc6ce('0x14')][_0xc6ce('0x15')]===0x1f4){logger[_0xc6ce('0x14')](_0xc6ce('0xf'),_0x2112b4,_0x3305da['error'][_0xc6ce('0x16')]);return _0x39893e(_0x3305da[_0xc6ce('0x14')][_0xc6ce('0x16')]);}logger[_0xc6ce('0x14')](_0xc6ce('0xf'),_0x2112b4,_0x3305da[_0xc6ce('0x14')][_0xc6ce('0x16')]);return _0x4b77a3(_0x3305da['error'][_0xc6ce('0x16')]);}else{logger[_0xc6ce('0xe')](_0xc6ce('0xf'),_0x2112b4,_0xc6ce('0x10'));_0x4b77a3(_0x3305da[_0xc6ce('0x17')]['message']);}})[_0xc6ce('0x18')](function(_0x4cdcbd){logger[_0xc6ce('0x14')](_0xc6ce('0xf'),_0x2112b4,_0x4cdcbd);_0x39893e(_0x4cdcbd);});});} \ No newline at end of file +var _0x043a=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info'];(function(_0x4982e2,_0x1b7a5b){var _0x37095c=function(_0xab4530){while(--_0xab4530){_0x4982e2['push'](_0x4982e2['shift']());}};_0x37095c(++_0x1b7a5b);}(_0x043a,0x138));var _0xa043=function(_0x249916,_0x2d794a){_0x249916=_0x249916-0x0;var _0x196f0a=_0x043a[_0x249916];return _0x196f0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa043('0x0'));var BPromise=require(_0xa043('0x1'));var rs=require(_0xa043('0x2'));var fs=require('fs');var Redis=require(_0xa043('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa043('0x4'));var logger=require(_0xa043('0x5'))(_0xa043('0x6'));var config=require(_0xa043('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30f599,_0x554738,_0xf7dd17){return new BPromise(function(_0x5be665,_0x4a9e9f){return client[_0xa043('0x8')](_0x30f599,_0xf7dd17)[_0xa043('0x9')](function(_0x19cde0){logger[_0xa043('0xa')](_0xa043('0xb'),_0x554738,_0xa043('0xc'));logger[_0xa043('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x554738,'request\x20sent',JSON[_0xa043('0xe')](_0x19cde0));if(_0x19cde0[_0xa043('0xf')]){if(_0x19cde0[_0xa043('0xf')]['code']===0x1f4){logger[_0xa043('0xf')](_0xa043('0xb'),_0x554738,_0x19cde0[_0xa043('0xf')][_0xa043('0x10')]);return _0x4a9e9f(_0x19cde0[_0xa043('0xf')]['message']);}logger[_0xa043('0xf')](_0xa043('0xb'),_0x554738,_0x19cde0[_0xa043('0xf')][_0xa043('0x10')]);return _0x5be665(_0x19cde0['error'][_0xa043('0x10')]);}else{logger[_0xa043('0xa')](_0xa043('0xb'),_0x554738,_0xa043('0xc'));_0x5be665(_0x19cde0[_0xa043('0x11')][_0xa043('0x10')]);}})[_0xa043('0x12')](function(_0xfa73ed){logger['error'](_0xa043('0xb'),_0x554738,_0xfa73ed);_0x4a9e9f(_0xfa73ed);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3c3511c..af17dba 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 _0x7156=['./voiceMailMessage.controller','index','get','/:id','isAuthenticated','/:id/download','download','post','create','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x275e73,_0x8d5ff6){var _0x43829d=function(_0x490b75){while(--_0x490b75){_0x275e73['push'](_0x275e73['shift']());}};_0x43829d(++_0x8d5ff6);}(_0x7156,0x173));var _0x6715=function(_0x3b2f59,_0x185551){_0x3b2f59=_0x3b2f59-0x0;var _0x50b017=_0x7156[_0x3b2f59];return _0x50b017;};'use strict';var multer=require(_0x6715('0x0'));var util=require(_0x6715('0x1'));var path=require(_0x6715('0x2'));var timeout=require(_0x6715('0x3'));var express=require('express');var router=express[_0x6715('0x4')]();var fs_extra=require(_0x6715('0x5'));var auth=require(_0x6715('0x6'));var interaction=require(_0x6715('0x7'));var config=require(_0x6715('0x8'));var controller=require(_0x6715('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6715('0xa')]);router[_0x6715('0xb')](_0x6715('0xc'),auth[_0x6715('0xd')](),controller['show']);router['get'](_0x6715('0xe'),auth[_0x6715('0xd')](),controller[_0x6715('0xf')]);router[_0x6715('0x10')]('/',auth['isAuthenticated'](),controller[_0x6715('0x11')]);router['put'](_0x6715('0xc'),auth[_0x6715('0xd')](),controller['update']);router[_0x6715('0x12')]('/:id',auth[_0x6715('0xd')](),controller[_0x6715('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1df0=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','update','delete'];(function(_0x3d3441,_0x89beb8){var _0x3fcc6c=function(_0x99cf99){while(--_0x99cf99){_0x3d3441['push'](_0x3d3441['shift']());}};_0x3fcc6c(++_0x89beb8);}(_0x1df0,0x1ba));var _0x01df=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x1df0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x01df('0x0'));var util=require(_0x01df('0x1'));var path=require(_0x01df('0x2'));var timeout=require('connect-timeout');var express=require(_0x01df('0x3'));var router=express[_0x01df('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x01df('0x5'));var interaction=require(_0x01df('0x6'));var config=require(_0x01df('0x7'));var controller=require(_0x01df('0x8'));router[_0x01df('0x9')]('/',auth[_0x01df('0xa')](),controller[_0x01df('0xb')]);router['get'](_0x01df('0xc'),auth[_0x01df('0xa')](),controller[_0x01df('0xd')]);router[_0x01df('0x9')](_0x01df('0xe'),auth[_0x01df('0xa')](),controller['download']);router[_0x01df('0xf')]('/',auth[_0x01df('0xa')](),controller[_0x01df('0x10')]);router[_0x01df('0x11')](_0x01df('0xc'),auth[_0x01df('0xa')](),controller[_0x01df('0x12')]);router[_0x01df('0x13')](_0x01df('0xc'),auth[_0x01df('0xa')](),controller[_0x01df('0x14')]);module[_0x01df('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index bf18dbd..1f1a0c3 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 _0x1844=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0x1844,0x1ab));var _0x4184=function(_0xdbec4d,_0xfb4626){_0xdbec4d=_0xdbec4d-0x0;var _0x208681=_0x1844[_0xdbec4d];return _0x208681;};'use strict';var Sequelize=require(_0x4184('0x0'));module[_0x4184('0x1')]={'name':{'type':Sequelize[_0x4184('0x2')],'get':function(_0x470807){return this[_0x4184('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x4184('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4184('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x4184('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x4184('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4184('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x4184('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x4184('0x6')](_0x4184('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x4184('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x4184('0x8'),'defaultValue':Sequelize['literal'](_0x4184('0x9'))}}; \ No newline at end of file +var _0x3084=['sequelize','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x456518,_0x52d2ca){var _0x331b72=function(_0x2d655a){while(--_0x2d655a){_0x456518['push'](_0x456518['shift']());}};_0x331b72(++_0x52d2ca);}(_0x3084,0xb0));var _0x4308=function(_0x4b7fe7,_0x5a88f3){_0x4b7fe7=_0x4b7fe7-0x0;var _0x2269a7=_0x3084[_0x4b7fe7];return _0x2269a7;};'use strict';var Sequelize=require(_0x4308('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x43ba91){return this[_0x4308('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x4308('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4308('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x4308('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4308('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x4308('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x4308('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x4308('0x4')](_0x4308('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x4308('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4308('0x3')],'defaultValue':''},'stamp':{'type':_0x4308('0x6'),'defaultValue':Sequelize['literal'](_0x4308('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 559a6f7..92c2af7 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 _0xf58f=['save','update','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','body','find','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','apply'];(function(_0x1454c5,_0x11d3e8){var _0x362cbe=function(_0x552709){while(--_0x552709){_0x1454c5['push'](_0x1454c5['shift']());}};_0x362cbe(++_0x11d3e8);}(_0xf58f,0x1d7));var _0xff58=function(_0x4dd3a5,_0x3457c3){_0x4dd3a5=_0x4dd3a5-0x0;var _0x37da0d=_0xf58f[_0x4dd3a5];return _0x37da0d;};'use strict';var emlformat=require(_0xff58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff58('0x1'));var jsonpatch=require(_0xff58('0x2'));var rp=require(_0xff58('0x3'));var moment=require(_0xff58('0x4'));var BPromise=require(_0xff58('0x5'));var Mustache=require('mustache');var util=require(_0xff58('0x6'));var path=require(_0xff58('0x7'));var sox=require(_0xff58('0x8'));var csv=require(_0xff58('0x9'));var ejs=require(_0xff58('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xff58('0xb'));var crypto=require('crypto');var jsforce=require(_0xff58('0xc'));var deskjs=require(_0xff58('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff58('0xe'));var Redis=require(_0xff58('0xf'));var authService=require(_0xff58('0x10'));var qs=require(_0xff58('0x11'));var as=require(_0xff58('0x12'));var hardwareService=require(_0xff58('0x13'));var logger=require('../../config/logger')(_0xff58('0x14'));var utils=require(_0xff58('0x15'));var config=require(_0xff58('0x16'));var licenseUtil=require(_0xff58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x374f69,_0x5c15b1){_0x5c15b1=_0x5c15b1||0xcc;return function(_0x34da98){if(_0x34da98){return _0x374f69[_0xff58('0x18')](_0x5c15b1);}return _0x374f69['status'](_0x5c15b1)[_0xff58('0x19')]();};}function respondWithResult(_0x5bb13f,_0x28f15b){_0x28f15b=_0x28f15b||0xc8;return function(_0x13cdc6){if(_0x13cdc6){return _0x5bb13f[_0xff58('0x1a')](_0x28f15b)[_0xff58('0x1b')](_0x13cdc6);}};}function respondWithFilteredResult(_0x2d36ed,_0x58fdf0){return function(_0x3baf46){if(_0x3baf46){var _0x5f9fac=typeof _0x58fdf0[_0xff58('0x1c')]===_0xff58('0x1d')&&typeof _0x58fdf0[_0xff58('0x1e')]===_0xff58('0x1d');var _0x5d8f70=_0x3baf46[_0xff58('0x1f')];var _0x37f7b7=_0x5f9fac?0x0:_0x58fdf0[_0xff58('0x1c')];var _0x3db0ef=_0x5f9fac?_0x3baf46[_0xff58('0x1f')]:_0x58fdf0[_0xff58('0x1c')]+_0x58fdf0['limit'];var _0x1000bb;if(_0x3db0ef>=_0x5d8f70){_0x3db0ef=_0x5d8f70;_0x1000bb=0xc8;}else{_0x1000bb=0xce;}_0x2d36ed['status'](_0x1000bb);return _0x2d36ed['set']('Content-Range',_0x37f7b7+'-'+_0x3db0ef+'/'+_0x5d8f70)[_0xff58('0x1b')](_0x3baf46);}return null;};}function patchUpdates(_0x316bcf){return function(_0x1d88a4){try{jsonpatch[_0xff58('0x20')](_0x1d88a4,_0x316bcf,!![]);}catch(_0x1fa023){return BPromise['reject'](_0x1fa023);}return _0x1d88a4[_0xff58('0x21')]();};}function saveUpdates(_0x4815ba,_0x1fc204){return function(_0x47161f){if(_0x47161f){return _0x47161f[_0xff58('0x22')](_0x4815ba)[_0xff58('0x23')](function(_0x8ab62e){return _0x8ab62e;});}return null;};}function removeEntity(_0x1f7383,_0x213856){return function(_0x2abd0d){if(_0x2abd0d){return _0x2abd0d[_0xff58('0x24')]()[_0xff58('0x23')](function(){_0x1f7383[_0xff58('0x1a')](0xcc)[_0xff58('0x19')]();});}};}function handleEntityNotFound(_0x112dbe,_0x1b97e9){return function(_0x361a20){if(!_0x361a20){_0x112dbe[_0xff58('0x18')](0x194);}return _0x361a20;};}function handleError(_0x41b33c,_0x299903){_0x299903=_0x299903||0x1f4;return function(_0x47cd1b){logger[_0xff58('0x25')](_0x47cd1b[_0xff58('0x26')]);if(_0x47cd1b[_0xff58('0x27')]){delete _0x47cd1b[_0xff58('0x27')];}_0x41b33c[_0xff58('0x1a')](_0x299903)[_0xff58('0x28')](_0x47cd1b);};}exports['index']=function(_0x402e6a,_0xe15834){var _0x403509={},_0x1eb46d={},_0x371d76={'count':0x0,'rows':[]};var _0x456a85=_[_0xff58('0x29')](db[_0xff58('0x2a')][_0xff58('0x2b')],function(_0x4efa62){return{'name':_0x4efa62[_0xff58('0x2c')],'type':_0x4efa62[_0xff58('0x2d')]['key']};});_0x1eb46d[_0xff58('0x2e')]=_[_0xff58('0x2f')](_[_0xff58('0x29')](_0x456a85,'name'),[_0xff58('0x27')]);_0x1eb46d[_0xff58('0x30')]=_[_0xff58('0x31')](_0x402e6a[_0xff58('0x30')]);_0x1eb46d[_0xff58('0x32')]=_[_0xff58('0x33')](_0x1eb46d['model'],_0x1eb46d['query']);_0x403509[_0xff58('0x34')]=_['intersection'](_0x1eb46d[_0xff58('0x2e')],qs['fields'](_0x402e6a['query'][_0xff58('0x35')]));_0x403509[_0xff58('0x34')]=_0x403509[_0xff58('0x34')]['length']?_0x403509['attributes']:_0x1eb46d[_0xff58('0x2e')];if(!_0x402e6a[_0xff58('0x30')][_0xff58('0x36')](_0xff58('0x37'))){_0x403509[_0xff58('0x1e')]=qs[_0xff58('0x1e')](_0x402e6a[_0xff58('0x30')][_0xff58('0x1e')]);_0x403509['offset']=qs[_0xff58('0x1c')](_0x402e6a[_0xff58('0x30')]['offset']);}_0x403509[_0xff58('0x38')]=qs['sort'](_0x402e6a[_0xff58('0x30')][_0xff58('0x39')]);_0x403509['where']=qs[_0xff58('0x32')](_['pick'](_0x402e6a[_0xff58('0x30')],_0x1eb46d[_0xff58('0x32')]),_0x456a85);if(_0x402e6a[_0xff58('0x30')][_0xff58('0x3a')]){_0x403509[_0xff58('0x3b')]=_[_0xff58('0x3c')](_0x403509[_0xff58('0x3b')],{'$or':_[_0xff58('0x29')](_0x456a85,function(_0x519e2c){if(_0x519e2c[_0xff58('0x2d')]!==_0xff58('0x3d')){var _0x58e4d6={};_0x58e4d6[_0x519e2c[_0xff58('0x27')]]={'$like':'%'+_0x402e6a['query']['filter']+'%'};return _0x58e4d6;}})});}_0x403509=_[_0xff58('0x3c')]({},_0x403509,_0x402e6a[_0xff58('0x3e')]);var _0x4164bc={'where':_0x403509[_0xff58('0x3b')]};return db[_0xff58('0x2a')][_0xff58('0x1f')](_0x4164bc)[_0xff58('0x23')](function(_0x14f303){_0x371d76[_0xff58('0x1f')]=_0x14f303;if(_0x402e6a[_0xff58('0x30')][_0xff58('0x3f')]){_0x403509[_0xff58('0x40')]=[{'all':!![]}];}return db[_0xff58('0x2a')][_0xff58('0x41')](_0x403509);})[_0xff58('0x23')](function(_0xf9d2dd){_0x371d76[_0xff58('0x42')]=_0xf9d2dd;return _0x371d76;})[_0xff58('0x23')](respondWithFilteredResult(_0xe15834,_0x403509))['catch'](handleError(_0xe15834,null));};exports[_0xff58('0x43')]=function(_0x1ccfb5,_0x174eb2){var _0x2e04fd={'raw':!![],'where':{'id':_0x1ccfb5[_0xff58('0x44')]['id']}},_0x990635={};_0x990635['model']=_[_0xff58('0x31')](db[_0xff58('0x2a')]['rawAttributes']);_0x990635['query']=_[_0xff58('0x31')](_0x1ccfb5[_0xff58('0x30')]);_0x990635[_0xff58('0x32')]=_[_0xff58('0x33')](_0x990635[_0xff58('0x2e')],_0x990635[_0xff58('0x30')]);_0x2e04fd[_0xff58('0x34')]=_[_0xff58('0x33')](_0x990635[_0xff58('0x2e')],qs['fields'](_0x1ccfb5[_0xff58('0x30')][_0xff58('0x35')]));_0x2e04fd[_0xff58('0x34')]=_0x2e04fd[_0xff58('0x34')][_0xff58('0x45')]?_0x2e04fd['attributes']:_0x990635['model'];if(_0x1ccfb5[_0xff58('0x30')][_0xff58('0x3f')]){_0x2e04fd[_0xff58('0x40')]=[{'all':!![]}];}_0x2e04fd=_[_0xff58('0x3c')]({},_0x2e04fd,_0x1ccfb5['options']);return db[_0xff58('0x2a')]['find'](_0x2e04fd)[_0xff58('0x23')](handleEntityNotFound(_0x174eb2,null))[_0xff58('0x23')](respondWithResult(_0x174eb2,null))[_0xff58('0x46')](handleError(_0x174eb2,null));};exports['create']=function(_0x4a4168,_0xc6b4d6){return db[_0xff58('0x2a')]['create'](_0x4a4168['body'],{})[_0xff58('0x23')](respondWithResult(_0xc6b4d6,0xc9))['catch'](handleError(_0xc6b4d6,null));};exports[_0xff58('0x22')]=function(_0x457841,_0x152b10){if(_0x457841[_0xff58('0x47')]['id']){delete _0x457841[_0xff58('0x47')]['id'];}return db[_0xff58('0x2a')][_0xff58('0x48')]({'where':{'id':_0x457841['params']['id']}})[_0xff58('0x23')](handleEntityNotFound(_0x152b10,null))[_0xff58('0x23')](saveUpdates(_0x457841['body'],null))['then'](respondWithResult(_0x152b10,null))[_0xff58('0x46')](handleError(_0x152b10,null));};exports[_0xff58('0x24')]=function(_0x564d8f,_0x321db1){return db[_0xff58('0x2a')][_0xff58('0x48')]({'where':{'id':_0x564d8f[_0xff58('0x44')]['id']}})[_0xff58('0x23')](handleEntityNotFound(_0x321db1,null))['then'](removeEntity(_0x321db1,null))[_0xff58('0x46')](handleError(_0x321db1,null));};exports[_0xff58('0x49')]=function(_0x4f54e3,_0x38410b,_0xb128ae){return db['VoiceMailMessage'][_0xff58('0x48')]({'where':{'id':_0x4f54e3[_0xff58('0x44')]['id']},'attributes':['id',_0xff58('0x4a'),_0xff58('0x4b')]})[_0xff58('0x23')](handleEntityNotFound(_0x38410b,null))['then'](function(_0x9720ed){if(_0x9720ed){if(!_0x9720ed[_0xff58('0x4a')]){throw new db[(_0xff58('0x4c'))]['ValidationError'](_0xff58('0x4d'));}var _0x32921b={'Content-Type':_0xff58('0x4e'),'Content-Disposition':_0xff58('0x4f')};if(_0x9720ed['msg_id']){_0x32921b[_0xff58('0x50')]=_0xff58('0x51')+_0x9720ed[_0xff58('0x4b')]+_0xff58('0x52');}_0x38410b[_0xff58('0x53')](_0x32921b);return _0x38410b[_0xff58('0x28')](new Buffer(_0x9720ed['recording']));}})['catch'](handleError(_0x38410b,null));}; \ No newline at end of file +var _0x9c00=['create','body','update','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c00,0x1ba));var _0x09c0=function(_0x272587,_0x4e5fb1){_0x272587=_0x272587-0x0;var _0x3c2ff6=_0x9c00[_0x272587];return _0x3c2ff6;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require(_0x09c0('0x2'));var jsonpatch=require(_0x09c0('0x3'));var rp=require('request-promise');var moment=require(_0x09c0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x5'));var util=require(_0x09c0('0x6'));var path=require(_0x09c0('0x7'));var sox=require(_0x09c0('0x8'));var csv=require(_0x09c0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09c0('0xa'));var _=require('lodash');var squel=require(_0x09c0('0xb'));var crypto=require('crypto');var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09c0('0x12'));var logger=require(_0x09c0('0x13'))(_0x09c0('0x14'));var utils=require(_0x09c0('0x15'));var config=require(_0x09c0('0x16'));var licenseUtil=require(_0x09c0('0x17'));var db=require(_0x09c0('0x18'))['db'];function respondWithStatusCode(_0x4742a3,_0x54e822){_0x54e822=_0x54e822||0xcc;return function(_0x4f3e71){if(_0x4f3e71){return _0x4742a3[_0x09c0('0x19')](_0x54e822);}return _0x4742a3[_0x09c0('0x1a')](_0x54e822)[_0x09c0('0x1b')]();};}function respondWithResult(_0x4d4568,_0x42a72d){_0x42a72d=_0x42a72d||0xc8;return function(_0x218e3e){if(_0x218e3e){return _0x4d4568[_0x09c0('0x1a')](_0x42a72d)['json'](_0x218e3e);}};}function respondWithFilteredResult(_0x4911f9,_0x344476){return function(_0x500e70){if(_0x500e70){var _0xbcc3b=typeof _0x344476['offset']==='undefined'&&typeof _0x344476[_0x09c0('0x1c')]==='undefined';var _0x2873ab=_0x500e70[_0x09c0('0x1d')];var _0x400290=_0xbcc3b?0x0:_0x344476[_0x09c0('0x1e')];var _0x36feeb=_0xbcc3b?_0x500e70[_0x09c0('0x1d')]:_0x344476[_0x09c0('0x1e')]+_0x344476[_0x09c0('0x1c')];var _0x63811;if(_0x36feeb>=_0x2873ab){_0x36feeb=_0x2873ab;_0x63811=0xc8;}else{_0x63811=0xce;}_0x4911f9['status'](_0x63811);return _0x4911f9[_0x09c0('0x1f')](_0x09c0('0x20'),_0x400290+'-'+_0x36feeb+'/'+_0x2873ab)[_0x09c0('0x21')](_0x500e70);}return null;};}function patchUpdates(_0x33ed85){return function(_0x115f54){try{jsonpatch[_0x09c0('0x22')](_0x115f54,_0x33ed85,!![]);}catch(_0x2b28b3){return BPromise['reject'](_0x2b28b3);}return _0x115f54[_0x09c0('0x23')]();};}function saveUpdates(_0x1a3961,_0x10e849){return function(_0x13a219){if(_0x13a219){return _0x13a219['update'](_0x1a3961)[_0x09c0('0x24')](function(_0x173e0c){return _0x173e0c;});}return null;};}function removeEntity(_0x2cc13d,_0x2d72da){return function(_0xce4bf4){if(_0xce4bf4){return _0xce4bf4[_0x09c0('0x25')]()[_0x09c0('0x24')](function(){_0x2cc13d[_0x09c0('0x1a')](0xcc)[_0x09c0('0x1b')]();});}};}function handleEntityNotFound(_0xccd47f,_0x53c035){return function(_0x306a40){if(!_0x306a40){_0xccd47f[_0x09c0('0x19')](0x194);}return _0x306a40;};}function handleError(_0x4579ea,_0x4c278d){_0x4c278d=_0x4c278d||0x1f4;return function(_0x210b73){logger[_0x09c0('0x26')](_0x210b73[_0x09c0('0x27')]);if(_0x210b73[_0x09c0('0x28')]){delete _0x210b73['name'];}_0x4579ea[_0x09c0('0x1a')](_0x4c278d)[_0x09c0('0x29')](_0x210b73);};}exports[_0x09c0('0x2a')]=function(_0x430f3d,_0x5468eb){var _0x1398c6={},_0x58afda={},_0x16ea9c={'count':0x0,'rows':[]};var _0x573473=_[_0x09c0('0x2b')](db[_0x09c0('0x2c')][_0x09c0('0x2d')],function(_0x2664a7){return{'name':_0x2664a7['fieldName'],'type':_0x2664a7[_0x09c0('0x2e')][_0x09c0('0x2f')]};});_0x58afda[_0x09c0('0x30')]=_[_0x09c0('0x31')](_[_0x09c0('0x2b')](_0x573473,'name'),[_0x09c0('0x28')]);_0x58afda['query']=_[_0x09c0('0x32')](_0x430f3d['query']);_0x58afda[_0x09c0('0x33')]=_[_0x09c0('0x34')](_0x58afda[_0x09c0('0x30')],_0x58afda[_0x09c0('0x35')]);_0x1398c6[_0x09c0('0x36')]=_[_0x09c0('0x34')](_0x58afda[_0x09c0('0x30')],qs[_0x09c0('0x37')](_0x430f3d['query'][_0x09c0('0x37')]));_0x1398c6[_0x09c0('0x36')]=_0x1398c6[_0x09c0('0x36')]['length']?_0x1398c6[_0x09c0('0x36')]:_0x58afda['model'];if(!_0x430f3d[_0x09c0('0x35')][_0x09c0('0x38')]('nolimit')){_0x1398c6[_0x09c0('0x1c')]=qs[_0x09c0('0x1c')](_0x430f3d[_0x09c0('0x35')]['limit']);_0x1398c6[_0x09c0('0x1e')]=qs[_0x09c0('0x1e')](_0x430f3d[_0x09c0('0x35')][_0x09c0('0x1e')]);}_0x1398c6[_0x09c0('0x39')]=qs[_0x09c0('0x3a')](_0x430f3d['query'][_0x09c0('0x3a')]);_0x1398c6[_0x09c0('0x3b')]=qs[_0x09c0('0x33')](_[_0x09c0('0x3c')](_0x430f3d['query'],_0x58afda[_0x09c0('0x33')]),_0x573473);if(_0x430f3d[_0x09c0('0x35')][_0x09c0('0x3d')]){_0x1398c6[_0x09c0('0x3b')]=_[_0x09c0('0x3e')](_0x1398c6[_0x09c0('0x3b')],{'$or':_['map'](_0x573473,function(_0x301e46){if(_0x301e46['type']!==_0x09c0('0x3f')){var _0x12a84a={};_0x12a84a[_0x301e46[_0x09c0('0x28')]]={'$like':'%'+_0x430f3d[_0x09c0('0x35')][_0x09c0('0x3d')]+'%'};return _0x12a84a;}})});}_0x1398c6=_[_0x09c0('0x3e')]({},_0x1398c6,_0x430f3d['options']);var _0x57967d={'where':_0x1398c6[_0x09c0('0x3b')]};return db[_0x09c0('0x2c')]['count'](_0x57967d)['then'](function(_0x167d5e){_0x16ea9c['count']=_0x167d5e;if(_0x430f3d[_0x09c0('0x35')][_0x09c0('0x40')]){_0x1398c6[_0x09c0('0x41')]=[{'all':!![]}];}return db[_0x09c0('0x2c')][_0x09c0('0x42')](_0x1398c6);})[_0x09c0('0x24')](function(_0x25d764){_0x16ea9c[_0x09c0('0x43')]=_0x25d764;return _0x16ea9c;})[_0x09c0('0x24')](respondWithFilteredResult(_0x5468eb,_0x1398c6))['catch'](handleError(_0x5468eb,null));};exports[_0x09c0('0x44')]=function(_0x285548,_0x46eb9b){var _0x559bb0={'raw':!![],'where':{'id':_0x285548[_0x09c0('0x45')]['id']}},_0x4dcf08={};_0x4dcf08['model']=_['keys'](db['VoiceMailMessage'][_0x09c0('0x2d')]);_0x4dcf08[_0x09c0('0x35')]=_['keys'](_0x285548[_0x09c0('0x35')]);_0x4dcf08['filters']=_[_0x09c0('0x34')](_0x4dcf08[_0x09c0('0x30')],_0x4dcf08[_0x09c0('0x35')]);_0x559bb0['attributes']=_['intersection'](_0x4dcf08[_0x09c0('0x30')],qs[_0x09c0('0x37')](_0x285548[_0x09c0('0x35')]['fields']));_0x559bb0['attributes']=_0x559bb0[_0x09c0('0x36')][_0x09c0('0x46')]?_0x559bb0[_0x09c0('0x36')]:_0x4dcf08[_0x09c0('0x30')];if(_0x285548['query']['includeAll']){_0x559bb0['include']=[{'all':!![]}];}_0x559bb0=_['merge']({},_0x559bb0,_0x285548[_0x09c0('0x47')]);return db[_0x09c0('0x2c')][_0x09c0('0x48')](_0x559bb0)[_0x09c0('0x24')](handleEntityNotFound(_0x46eb9b,null))[_0x09c0('0x24')](respondWithResult(_0x46eb9b,null))[_0x09c0('0x49')](handleError(_0x46eb9b,null));};exports['create']=function(_0x4960f5,_0x395c86){return db['VoiceMailMessage'][_0x09c0('0x4a')](_0x4960f5[_0x09c0('0x4b')],{})[_0x09c0('0x24')](respondWithResult(_0x395c86,0xc9))['catch'](handleError(_0x395c86,null));};exports[_0x09c0('0x4c')]=function(_0x1f2168,_0x107cbf){if(_0x1f2168[_0x09c0('0x4b')]['id']){delete _0x1f2168[_0x09c0('0x4b')]['id'];}return db[_0x09c0('0x2c')][_0x09c0('0x48')]({'where':{'id':_0x1f2168[_0x09c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x107cbf,null))[_0x09c0('0x24')](saveUpdates(_0x1f2168[_0x09c0('0x4b')],null))['then'](respondWithResult(_0x107cbf,null))['catch'](handleError(_0x107cbf,null));};exports['destroy']=function(_0x5ae83f,_0x191081){return db[_0x09c0('0x2c')][_0x09c0('0x48')]({'where':{'id':_0x5ae83f[_0x09c0('0x45')]['id']}})[_0x09c0('0x24')](handleEntityNotFound(_0x191081,null))['then'](removeEntity(_0x191081,null))['catch'](handleError(_0x191081,null));};exports['download']=function(_0x512f22,_0x8c9df7,_0x2d49bf){return db['VoiceMailMessage'][_0x09c0('0x48')]({'where':{'id':_0x512f22[_0x09c0('0x45')]['id']},'attributes':['id',_0x09c0('0x4d'),_0x09c0('0x4e')]})['then'](handleEntityNotFound(_0x8c9df7,null))[_0x09c0('0x24')](function(_0x5e9522){if(_0x5e9522){if(!_0x5e9522[_0x09c0('0x4d')]){throw new db[(_0x09c0('0x4f'))][(_0x09c0('0x50'))](_0x09c0('0x51'));}var _0x19f57e={'Content-Type':_0x09c0('0x52'),'Content-Disposition':_0x09c0('0x53')};if(_0x5e9522[_0x09c0('0x4e')]){_0x19f57e[_0x09c0('0x54')]='attachment;\x20filename=\x22'+_0x5e9522[_0x09c0('0x4e')]+_0x09c0('0x55');}_0x8c9df7[_0x09c0('0x1f')](_0x19f57e);return _0x8c9df7[_0x09c0('0x29')](new Buffer(_0x5e9522[_0x09c0('0x4d')]));}})['catch'](handleError(_0x8c9df7,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2c11652..edf0865 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 _0xbe14=['define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbe14,0xb7));var _0x4be1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4be1('0x0'));var util=require(_0x4be1('0x1'));var logger=require(_0x4be1('0x2'))(_0x4be1('0x3'));var moment=require(_0x4be1('0x4'));var BPromise=require(_0x4be1('0x5'));var rp=require(_0x4be1('0x6'));var fs=require('fs');var path=require(_0x4be1('0x7'));var rimraf=require(_0x4be1('0x8'));var config=require(_0x4be1('0x9'));var attributes=require(_0x4be1('0xa'));module[_0x4be1('0xb')]=function(_0x11c35f,_0x530ab3){return _0x11c35f[_0x4be1('0xc')](_0x4be1('0xd'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x4be1('0xe'),'fields':[_0x4be1('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6891=['bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment'];(function(_0x55fae7,_0x361973){var _0x5ad8ba=function(_0x51d3cd){while(--_0x51d3cd){_0x55fae7['push'](_0x55fae7['shift']());}};_0x5ad8ba(++_0x361973);}(_0x6891,0x122));var _0x1689=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0x6891[_0x45161c];return _0x186581;};'use strict';var _=require('lodash');var util=require(_0x1689('0x0'));var logger=require(_0x1689('0x1'))(_0x1689('0x2'));var moment=require(_0x1689('0x3'));var BPromise=require(_0x1689('0x4'));var rp=require(_0x1689('0x5'));var fs=require('fs');var path=require(_0x1689('0x6'));var rimraf=require('rimraf');var config=require(_0x1689('0x7'));var attributes=require(_0x1689('0x8'));module[_0x1689('0x9')]=function(_0x478746,_0x23e9cb){return _0x478746[_0x1689('0xa')](_0x1689('0xb'),attributes,{'tableName':_0x1689('0xc'),'paranoid':![],'indexes':[{'name':_0x1689('0xd'),'fields':[_0x1689('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index bea5bd4..aadeb39 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 _0x70b1=['then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x70b1,0x19a));var _0x170b=function(_0x1734cf,_0x198405){_0x1734cf=_0x1734cf-0x0;var _0x524290=_0x70b1[_0x1734cf];return _0x524290;};'use strict';var _=require('lodash');var util=require(_0x170b('0x0'));var moment=require(_0x170b('0x1'));var BPromise=require('bluebird');var rs=require(_0x170b('0x2'));var fs=require('fs');var Redis=require(_0x170b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x170b('0x4'))(_0x170b('0x5'));var config=require(_0x170b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x170b('0x7')][_0x170b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd3a752,_0x308e29,_0x4b3457){return new BPromise(function(_0x46df7a,_0x1e6568){return client[_0x170b('0x9')](_0xd3a752,_0x4b3457)[_0x170b('0xa')](function(_0x1781d6){logger['info'](_0x170b('0xb'),_0x308e29,_0x170b('0xc'));logger[_0x170b('0xd')](_0x170b('0xe'),_0x308e29,_0x170b('0xc'),JSON[_0x170b('0xf')](_0x1781d6));if(_0x1781d6[_0x170b('0x10')]){if(_0x1781d6['error'][_0x170b('0x11')]===0x1f4){logger[_0x170b('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x308e29,_0x1781d6['error'][_0x170b('0x12')]);return _0x1e6568(_0x1781d6[_0x170b('0x10')][_0x170b('0x12')]);}logger[_0x170b('0x10')](_0x170b('0xb'),_0x308e29,_0x1781d6[_0x170b('0x10')][_0x170b('0x12')]);return _0x46df7a(_0x1781d6[_0x170b('0x10')][_0x170b('0x12')]);}else{logger[_0x170b('0x13')](_0x170b('0xb'),_0x308e29,_0x170b('0xc'));_0x46df7a(_0x1781d6[_0x170b('0x14')][_0x170b('0x12')]);}})['catch'](function(_0x489093){logger[_0x170b('0x10')](_0x170b('0xb'),_0x308e29,_0x489093);_0x1e6568(_0x489093);});});} \ No newline at end of file +var _0x2389=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x2389,0x1c9));var _0x9238=function(_0xffd29a,_0x441d81){_0xffd29a=_0xffd29a-0x0;var _0x32555=_0x2389[_0xffd29a];return _0x32555;};'use strict';var _=require(_0x9238('0x0'));var util=require(_0x9238('0x1'));var moment=require(_0x9238('0x2'));var BPromise=require('bluebird');var rs=require(_0x9238('0x3'));var fs=require('fs');var Redis=require(_0x9238('0x4'));var db=require(_0x9238('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9238('0x6'))('rpc');var config=require(_0x9238('0x7'));var jayson=require(_0x9238('0x8'));var client=jayson['client'][_0x9238('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c59dd,_0x1225d3,_0x5d5b55){return new BPromise(function(_0x416a64,_0x23c780){return client[_0x9238('0xa')](_0x2c59dd,_0x5d5b55)[_0x9238('0xb')](function(_0x10d199){logger['info'](_0x9238('0xc'),_0x1225d3,_0x9238('0xd'));logger[_0x9238('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1225d3,_0x9238('0xd'),JSON[_0x9238('0xf')](_0x10d199));if(_0x10d199[_0x9238('0x10')]){if(_0x10d199[_0x9238('0x10')][_0x9238('0x11')]===0x1f4){logger[_0x9238('0x10')](_0x9238('0xc'),_0x1225d3,_0x10d199[_0x9238('0x10')]['message']);return _0x23c780(_0x10d199[_0x9238('0x10')][_0x9238('0x12')]);}logger[_0x9238('0x10')](_0x9238('0xc'),_0x1225d3,_0x10d199[_0x9238('0x10')][_0x9238('0x12')]);return _0x416a64(_0x10d199['error']['message']);}else{logger[_0x9238('0x13')](_0x9238('0xc'),_0x1225d3,_0x9238('0xd'));_0x416a64(_0x10d199['result'][_0x9238('0x12')]);}})[_0x9238('0x14')](function(_0x383577){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x1225d3,_0x383577);_0x23c780(_0x383577);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 2fa2200..f5a2917 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 _0x6891=['index','/:id','show','/:id/sounds','getSounds','post','create','put','update','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated'];(function(_0x1c7d23,_0x3e5209){var _0x5b0127=function(_0x4ae14a){while(--_0x4ae14a){_0x1c7d23['push'](_0x1c7d23['shift']());}};_0x5b0127(++_0x3e5209);}(_0x6891,0x115));var _0x1689=function(_0x1521be,_0x34aa83){_0x1521be=_0x1521be-0x0;var _0x156a8e=_0x6891[_0x1521be];return _0x156a8e;};'use strict';var multer=require(_0x1689('0x0'));var util=require(_0x1689('0x1'));var path=require(_0x1689('0x2'));var timeout=require(_0x1689('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1689('0x4'));var auth=require(_0x1689('0x5'));var interaction=require(_0x1689('0x6'));var config=require(_0x1689('0x7'));var controller=require(_0x1689('0x8'));router[_0x1689('0x9')]('/',auth[_0x1689('0xa')](),controller[_0x1689('0xb')]);router[_0x1689('0x9')](_0x1689('0xc'),auth['isAuthenticated'](),controller[_0x1689('0xd')]);router[_0x1689('0x9')](_0x1689('0xe'),auth[_0x1689('0xa')](),controller[_0x1689('0xf')]);router[_0x1689('0x10')]('/',auth[_0x1689('0xa')](),controller[_0x1689('0x11')]);router['post'](_0x1689('0xe'),auth[_0x1689('0xa')](),controller['addSound']);router[_0x1689('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1689('0x13')]);router['delete'](_0x1689('0xc'),auth[_0x1689('0xa')](),controller[_0x1689('0x14')]);router['delete'](_0x1689('0x15'),auth[_0x1689('0xa')](),controller[_0x1689('0x16')]);module[_0x1689('0x17')]=router; \ No newline at end of file +var _0xa09e=['get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','destroy','delete','removeSound','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xa09e,0x99));var _0xea09=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xa09e[_0x4a3898];return _0x25ceb0;};'use strict';var multer=require(_0xea09('0x0'));var util=require(_0xea09('0x1'));var path=require(_0xea09('0x2'));var timeout=require('connect-timeout');var express=require(_0xea09('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xea09('0x4'));var interaction=require(_0xea09('0x5'));var config=require(_0xea09('0x6'));var controller=require(_0xea09('0x7'));router[_0xea09('0x8')]('/',auth[_0xea09('0x9')](),controller[_0xea09('0xa')]);router['get'](_0xea09('0xb'),auth[_0xea09('0x9')](),controller[_0xea09('0xc')]);router[_0xea09('0x8')](_0xea09('0xd'),auth[_0xea09('0x9')](),controller[_0xea09('0xe')]);router[_0xea09('0xf')]('/',auth[_0xea09('0x9')](),controller[_0xea09('0x10')]);router[_0xea09('0xf')](_0xea09('0xd'),auth['isAuthenticated'](),controller[_0xea09('0x11')]);router[_0xea09('0x12')](_0xea09('0xb'),auth['isAuthenticated'](),controller[_0xea09('0x13')]);router['delete'](_0xea09('0xb'),auth[_0xea09('0x9')](),controller[_0xea09('0x14')]);router[_0xea09('0x15')]('/:id/sounds/:id2',auth[_0xea09('0x9')](),controller[_0xea09('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f213974..5d043ef 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 _0x1d6f=['exports','name','ENUM','custom','files','mp3nb','quietmp3nb','STRING','alpha','sequelize'];(function(_0x164ae0,_0x3c7ad4){var _0x45860e=function(_0x1d415b){while(--_0x1d415b){_0x164ae0['push'](_0x164ae0['shift']());}};_0x45860e(++_0x3c7ad4);}(_0x1d6f,0xef));var _0xf1d6=function(_0x142c1a,_0x7195f2){_0x142c1a=_0x142c1a-0x0;var _0x6fe077=_0x1d6f[_0x142c1a];return _0x6fe077;};'use strict';var Sequelize=require(_0xf1d6('0x0'));module[_0xf1d6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf1d6('0x2')},'mode':{'type':Sequelize[_0xf1d6('0x3')](_0xf1d6('0x4'),_0xf1d6('0x5'),_0xf1d6('0x6'),_0xf1d6('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0xf1d6('0x5')},'directory':{'type':Sequelize[_0xf1d6('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0xf1d6('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf1d6('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf1d6('0x8')],'allowNull':!![],'defaultValue':_0xf1d6('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7f2a=['name','files','quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x24c692,_0x557e14){var _0xfd6410=function(_0x5d6a02){while(--_0x5d6a02){_0x24c692['push'](_0x24c692['shift']());}};_0xfd6410(++_0x557e14);}(_0x7f2a,0x133));var _0xa7f2=function(_0xc5b4ef,_0x5b409e){_0xc5b4ef=_0xc5b4ef-0x0;var _0x2b242c=_0x7f2a[_0xc5b4ef];return _0x2b242c;};'use strict';var Sequelize=require(_0xa7f2('0x0'));module[_0xa7f2('0x1')]={'name':{'type':Sequelize[_0xa7f2('0x2')],'allowNull':![],'unique':_0xa7f2('0x3')},'mode':{'type':Sequelize['ENUM']('custom',_0xa7f2('0x4'),'mp3nb',_0xa7f2('0x5'),'quietmp3',_0xa7f2('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xa7f2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa7f2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xa7f2('0x2')],'allowNull':!![],'defaultValue':_0xa7f2('0x7')},'format':{'type':Sequelize[_0xa7f2('0x2')],'allowNull':!![]},'stamp':{'type':_0xa7f2('0x8')},'defaultEntry':{'type':Sequelize[_0xa7f2('0x9')],'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 3884b6a..505f23b 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 _0x7681=['length','find','body','create','sequelize','transaction','files','join','server/files/moh','mode','mkdirSync','directory','0777','user','get','role','UserProfileSection','MusicOnHolds','autoAssociation','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','root','server/files/sounds/converted','format','basename','extname','converted_format','%s.%s','symlinkSync','removeSound','id2','getSounds','hasOwnProperty','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','UserProfileResource','destroy','error','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys'];(function(_0x47f973,_0x5e88f2){var _0x5150ed=function(_0x17a8f0){while(--_0x17a8f0){_0x47f973['push'](_0x47f973['shift']());}};_0x5150ed(++_0x5e88f2);}(_0x7681,0x1e1));var _0x1768=function(_0x42614a,_0x2439c7){_0x42614a=_0x42614a-0x0;var _0x2d5163=_0x7681[_0x42614a];return _0x2d5163;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1768('0x0'));var rp=require(_0x1768('0x1'));var moment=require(_0x1768('0x2'));var BPromise=require(_0x1768('0x3'));var Mustache=require(_0x1768('0x4'));var util=require('util');var path=require(_0x1768('0x5'));var sox=require(_0x1768('0x6'));var csv=require('to-csv');var ejs=require(_0x1768('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1768('0x8'));var crypto=require(_0x1768('0x9'));var jsforce=require(_0x1768('0xa'));var deskjs=require(_0x1768('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1768('0xc'));var Papa=require(_0x1768('0xd'));var Redis=require('ioredis');var authService=require(_0x1768('0xe'));var qs=require(_0x1768('0xf'));var as=require(_0x1768('0x10'));var hardwareService=require(_0x1768('0x11'));var logger=require(_0x1768('0x12'))('api');var utils=require(_0x1768('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1768('0x14'));var db=require(_0x1768('0x15'))['db'];function respondWithStatusCode(_0x3af457,_0x5269f1){_0x5269f1=_0x5269f1||0xcc;return function(_0x32c5ed){if(_0x32c5ed){return _0x3af457[_0x1768('0x16')](_0x5269f1);}return _0x3af457[_0x1768('0x17')](_0x5269f1)[_0x1768('0x18')]();};}function respondWithResult(_0x5d557a,_0x16053b){_0x16053b=_0x16053b||0xc8;return function(_0x18ab99){if(_0x18ab99){return _0x5d557a[_0x1768('0x17')](_0x16053b)[_0x1768('0x19')](_0x18ab99);}};}function respondWithFilteredResult(_0xc1d0b8,_0x122221){return function(_0x5e7650){if(_0x5e7650){var _0x39eaf7=typeof _0x122221['offset']===_0x1768('0x1a')&&typeof _0x122221[_0x1768('0x1b')]===_0x1768('0x1a');var _0x28256a=_0x5e7650['count'];var _0x54b7f8=_0x39eaf7?0x0:_0x122221[_0x1768('0x1c')];var _0x55d8fe=_0x39eaf7?_0x5e7650[_0x1768('0x1d')]:_0x122221[_0x1768('0x1c')]+_0x122221['limit'];var _0x517789;if(_0x55d8fe>=_0x28256a){_0x55d8fe=_0x28256a;_0x517789=0xc8;}else{_0x517789=0xce;}_0xc1d0b8['status'](_0x517789);return _0xc1d0b8[_0x1768('0x1e')](_0x1768('0x1f'),_0x54b7f8+'-'+_0x55d8fe+'/'+_0x28256a)[_0x1768('0x19')](_0x5e7650);}return null;};}function patchUpdates(_0x10698e){return function(_0x5e05df){try{jsonpatch['apply'](_0x5e05df,_0x10698e,!![]);}catch(_0x128677){return BPromise[_0x1768('0x20')](_0x128677);}return _0x5e05df[_0x1768('0x21')]();};}function saveUpdates(_0x42917d,_0x2763fe){return function(_0x2a9466){if(_0x2a9466){return _0x2a9466[_0x1768('0x22')](_0x42917d)['then'](function(_0x4bca0b){return _0x4bca0b;});}return null;};}function removeEntity(_0x57a984,_0x4f6d2e){return function(_0x338616){if(_0x338616){return _0x338616['destroy']()[_0x1768('0x23')](function(){var _0x3d3216=_0x338616['get']({'plain':!![]});var _0x136fac='MusicOnHolds';return db[_0x1768('0x24')][_0x1768('0x25')]({'where':{'type':_0x136fac,'resourceId':_0x3d3216['id']}})[_0x1768('0x23')](function(){return _0x338616;});})['then'](function(){_0x57a984[_0x1768('0x17')](0xcc)[_0x1768('0x18')]();});}};}function handleEntityNotFound(_0x4ca7c3,_0x3f2cc5){return function(_0x2adb50){if(!_0x2adb50){_0x4ca7c3['sendStatus'](0x194);}return _0x2adb50;};}function handleError(_0x466d44,_0x23bcfe){_0x23bcfe=_0x23bcfe||0x1f4;return function(_0x2be600){logger[_0x1768('0x26')](_0x2be600['stack']);if(_0x2be600[_0x1768('0x27')]){delete _0x2be600[_0x1768('0x27')];}_0x466d44[_0x1768('0x17')](_0x23bcfe)[_0x1768('0x28')](_0x2be600);};}exports[_0x1768('0x29')]=function(_0x28c474,_0x268245){var _0x43b3db={},_0x5de779={},_0x3d0628={'count':0x0,'rows':[]};var _0x3e3c23=_['map'](db[_0x1768('0x2a')][_0x1768('0x2b')],function(_0x123cc4){return{'name':_0x123cc4[_0x1768('0x2c')],'type':_0x123cc4[_0x1768('0x2d')]['key']};});_0x5de779['model']=_[_0x1768('0x2e')](_0x3e3c23,_0x1768('0x27'));_0x5de779[_0x1768('0x2f')]=_['keys'](_0x28c474[_0x1768('0x2f')]);_0x5de779[_0x1768('0x30')]=_[_0x1768('0x31')](_0x5de779[_0x1768('0x32')],_0x5de779[_0x1768('0x2f')]);_0x43b3db['attributes']=_['intersection'](_0x5de779['model'],qs[_0x1768('0x33')](_0x28c474[_0x1768('0x2f')]['fields']));_0x43b3db[_0x1768('0x34')]=_0x43b3db[_0x1768('0x34')]['length']?_0x43b3db['attributes']:_0x5de779[_0x1768('0x32')];if(!_0x28c474[_0x1768('0x2f')]['hasOwnProperty'](_0x1768('0x35'))){_0x43b3db['limit']=qs[_0x1768('0x1b')](_0x28c474['query'][_0x1768('0x1b')]);_0x43b3db[_0x1768('0x1c')]=qs['offset'](_0x28c474[_0x1768('0x2f')][_0x1768('0x1c')]);}_0x43b3db[_0x1768('0x36')]=qs[_0x1768('0x37')](_0x28c474['query'][_0x1768('0x37')]);delete _0x28c474[_0x1768('0x2f')][_0x1768('0x37')];_0x43b3db[_0x1768('0x38')]=qs[_0x1768('0x30')](_[_0x1768('0x39')](_0x28c474['query'],_0x5de779[_0x1768('0x30')]),_0x3e3c23);if(_0x28c474[_0x1768('0x2f')][_0x1768('0x3a')]){_0x43b3db[_0x1768('0x38')]=_[_0x1768('0x3b')](_0x43b3db['where'],{'$or':_[_0x1768('0x2e')](_0x3e3c23,function(_0x25bd94){if(_0x25bd94[_0x1768('0x2d')]!==_0x1768('0x3c')){var _0x580299={};_0x580299[_0x25bd94[_0x1768('0x27')]]={'$like':'%'+_0x28c474[_0x1768('0x2f')][_0x1768('0x3a')]+'%'};return _0x580299;}})});}_0x43b3db=_[_0x1768('0x3b')]({},_0x43b3db,_0x28c474[_0x1768('0x3d')]);var _0x91b0b1={'where':_0x43b3db[_0x1768('0x38')]};return db[_0x1768('0x2a')][_0x1768('0x1d')](_0x91b0b1)[_0x1768('0x23')](function(_0x5b5daf){_0x3d0628[_0x1768('0x1d')]=_0x5b5daf;if(_0x28c474[_0x1768('0x2f')][_0x1768('0x3e')]){_0x43b3db[_0x1768('0x3f')]=[{'all':!![]}];}return db[_0x1768('0x2a')]['findAll'](_0x43b3db);})[_0x1768('0x23')](function(_0x56b188){_0x3d0628[_0x1768('0x40')]=_0x56b188;return _0x3d0628;})[_0x1768('0x23')](respondWithFilteredResult(_0x268245,_0x43b3db))[_0x1768('0x41')](handleError(_0x268245,null));};exports[_0x1768('0x42')]=function(_0x5b406a,_0x308780){var _0x2df843={'raw':![],'where':{'id':_0x5b406a[_0x1768('0x43')]['id']}},_0x26e17c={};_0x26e17c['model']=_['keys'](db[_0x1768('0x2a')]['rawAttributes']);_0x26e17c['query']=_[_0x1768('0x44')](_0x5b406a[_0x1768('0x2f')]);_0x26e17c['filters']=_['intersection'](_0x26e17c[_0x1768('0x32')],_0x26e17c['query']);_0x2df843[_0x1768('0x34')]=_[_0x1768('0x31')](_0x26e17c[_0x1768('0x32')],qs[_0x1768('0x33')](_0x5b406a[_0x1768('0x2f')][_0x1768('0x33')]));_0x2df843[_0x1768('0x34')]=_0x2df843[_0x1768('0x34')][_0x1768('0x45')]?_0x2df843['attributes']:_0x26e17c[_0x1768('0x32')];if(_0x5b406a['query'][_0x1768('0x3e')]){_0x2df843[_0x1768('0x3f')]=[{'all':!![]}];}_0x2df843=_[_0x1768('0x3b')]({},_0x2df843,_0x5b406a['options']);return db[_0x1768('0x2a')][_0x1768('0x46')](_0x2df843)[_0x1768('0x23')](handleEntityNotFound(_0x308780,null))[_0x1768('0x23')](respondWithResult(_0x308780,null))[_0x1768('0x41')](handleError(_0x308780,null));};exports['update']=function(_0xf5121b,_0x261545){if(_0xf5121b['body']['id']){delete _0xf5121b[_0x1768('0x47')]['id'];}return db[_0x1768('0x2a')][_0x1768('0x46')]({'where':{'id':_0xf5121b[_0x1768('0x43')]['id']}})[_0x1768('0x23')](handleEntityNotFound(_0x261545,null))[_0x1768('0x23')](saveUpdates(_0xf5121b[_0x1768('0x47')],null))['then'](respondWithResult(_0x261545,null))['catch'](handleError(_0x261545,null));};exports[_0x1768('0x48')]=function(_0x4ef973,_0x3bda22,_0x1b284e){return db[_0x1768('0x49')][_0x1768('0x4a')](function(_0x5465be){if(_0x4ef973[_0x1768('0x47')]['mode']===_0x1768('0x4b')){_0x4ef973[_0x1768('0x47')]['directory']=path[_0x1768('0x4c')](config['root'],_0x1768('0x4d'),_0x4ef973[_0x1768('0x47')][_0x1768('0x27')]);}return db[_0x1768('0x2a')]['create'](_0x4ef973[_0x1768('0x47')],{'transaction':_0x5465be})[_0x1768('0x23')](function(_0x3c59f5){if(_0x4ef973['body'][_0x1768('0x4e')]==='files'){fs[_0x1768('0x4f')](_0x3c59f5[_0x1768('0x50')],parseInt(_0x1768('0x51'),0x8));}var _0x11121f=_0x4ef973[_0x1768('0x52')][_0x1768('0x53')]({'plain':!![]});if(!_0x11121f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11121f[_0x1768('0x54')]==='user'){var _0x33a718=_0x3c59f5[_0x1768('0x53')]({'plain':!![]});return db[_0x1768('0x55')][_0x1768('0x46')]({'where':{'name':_0x1768('0x56'),'userProfileId':_0x11121f['userProfileId']},'raw':!![]})[_0x1768('0x23')](function(_0x2ce124){if(_0x2ce124&&_0x2ce124[_0x1768('0x57')]===0x0){return db[_0x1768('0x24')][_0x1768('0x48')]({'name':_0x33a718[_0x1768('0x27')],'resourceId':_0x33a718['id'],'type':_0x2ce124[_0x1768('0x27')],'sectionId':_0x2ce124['id']},{})[_0x1768('0x23')](function(){return _0x3c59f5;});}else{return _0x3c59f5;}})['catch'](function(_0x1bd431){logger[_0x1768('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bd431);});}return _0x3c59f5;});})['then'](respondWithResult(_0x3bda22,0xc9))['catch'](handleError(_0x3bda22,null));};exports['destroy']=function(_0x2e20e1,_0x2e6497,_0x438c20){var _0x4f99b0;return db['VoiceMusicOnHold'][_0x1768('0x46')]({'where':{'id':_0x2e20e1['params']['id']}})[_0x1768('0x23')](function(_0x2633c0){if(_0x2633c0){return db[_0x1768('0x49')][_0x1768('0x4a')](function(_0x3bdaad){return _0x2633c0['destroy']({'transaction':_0x3bdaad,'raw':!![]})[_0x1768('0x23')](function(_0x19f2af){if(_0x19f2af['directory']){fs['readdirSync'](_0x19f2af['directory'])[_0x1768('0x58')](function(_0x47d2de){fs[_0x1768('0x59')](path[_0x1768('0x4c')](_0x19f2af[_0x1768('0x50')],_0x47d2de));});fs[_0x1768('0x5a')](_0x19f2af[_0x1768('0x50')]);}return _0x19f2af;});})[_0x1768('0x41')](function(_0x4133d0){throw new db[(_0x1768('0x5b'))][(_0x1768('0x5c'))](_0x4133d0[_0x1768('0x5d')]);});}})[_0x1768('0x23')](handleEntityNotFound(_0x2e6497,null))[_0x1768('0x23')](removeEntity(_0x2e6497,null))[_0x1768('0x41')](handleError(_0x2e6497,null));};exports[_0x1768('0x5e')]=function(_0x2157aa,_0xd6bf5,_0x112466){return db[_0x1768('0x49')][_0x1768('0x4a')](function(_0x57e0f9){var _0x92f93d;return db[_0x1768('0x2a')]['find']({'where':{'id':_0x2157aa[_0x1768('0x43')]['id']}})[_0x1768('0x23')](function(_0x54c187){if(_0x54c187){_0x92f93d=_0x54c187;return _0x54c187[_0x1768('0x5e')](_0x2157aa[_0x1768('0x47')]['id'],{'transaction':_0x57e0f9});}})['then'](function(_0x249958){if(_0x249958){return db[_0x1768('0x5f')][_0x1768('0x60')]({'where':{'id':_0x2157aa[_0x1768('0x47')]['id']},'attributes':['id','name',_0x1768('0x61'),'converted_format','createdAt'],'raw':!![]});}})[_0x1768('0x23')](function(_0x26432a){if(_0x26432a){var _0x1a6975=path[_0x1768('0x4c')](config[_0x1768('0x62')],_0x1768('0x63'),util[_0x1768('0x64')]('%s.%s',path[_0x1768('0x65')](_0x26432a[_0x1768('0x61')],path[_0x1768('0x66')](_0x26432a[_0x1768('0x61')])),_0x26432a[_0x1768('0x67')]));var _0x4716ef=path[_0x1768('0x4c')](config[_0x1768('0x62')],_0x1768('0x4d'),_0x92f93d[_0x1768('0x27')],util[_0x1768('0x64')](_0x1768('0x68'),_0x26432a['name'],_0x26432a[_0x1768('0x67')]));fs[_0x1768('0x69')](_0x1a6975,_0x4716ef);return _0x26432a;}})[_0x1768('0x41')](function(_0x1f66ad){throw new db[(_0x1768('0x5b'))]['ValidationError'](_0x1f66ad[_0x1768('0x5d')]);});})[_0x1768('0x23')](handleEntityNotFound(_0xd6bf5,null))[_0x1768('0x23')](respondWithResult(_0xd6bf5,0xc9))[_0x1768('0x41')](handleError(_0xd6bf5,null));};exports[_0x1768('0x6a')]=function(_0x13935d,_0x2d81a2,_0xbc4e1f){return db[_0x1768('0x49')]['transaction'](function(_0x45600d){var _0x4360d5;return db[_0x1768('0x2a')]['findOne']({'where':{'id':_0x13935d[_0x1768('0x43')]['id']}})[_0x1768('0x23')](handleEntityNotFound(_0x2d81a2,null))[_0x1768('0x23')](function(_0xa09718){if(_0xa09718){_0x4360d5=_0xa09718;return _0xa09718['removeSound'](_0x13935d[_0x1768('0x43')][_0x1768('0x6b')]);}})[_0x1768('0x23')](function(_0x16ee82){if(_0x16ee82){return db[_0x1768('0x5f')]['findOne']({'where':{'id':_0x13935d['params']['id2']},'attributes':['id',_0x1768('0x27'),_0x1768('0x61'),_0x1768('0x67'),'createdAt'],'raw':!![]});}})[_0x1768('0x23')](function(_0x147910){if(_0x147910){fs[_0x1768('0x59')](path[_0x1768('0x4c')](_0x4360d5[_0x1768('0x50')],util[_0x1768('0x64')](_0x1768('0x68'),_0x147910[_0x1768('0x27')],_0x147910[_0x1768('0x67')])));return _0x147910;}})[_0x1768('0x41')](function(_0x29b107){throw new db[(_0x1768('0x5b'))][(_0x1768('0x5c'))](_0x29b107[_0x1768('0x5d')]);});})[_0x1768('0x23')](handleEntityNotFound(_0x2d81a2,null))[_0x1768('0x23')](respondWithStatusCode(_0x2d81a2,0xcc))[_0x1768('0x41')](handleError(_0x2d81a2,null));};exports[_0x1768('0x6c')]=function(_0x2c762f,_0x15cd2c,_0x1ff07f){var _0x2b9cd2={};var _0x32227a={};var _0x1f945b;var _0x335f36;return db[_0x1768('0x2a')]['findOne']({'where':{'id':_0x2c762f[_0x1768('0x43')]['id']}})[_0x1768('0x23')](handleEntityNotFound(_0x15cd2c,null))[_0x1768('0x23')](function(_0xdd4c3e){if(_0xdd4c3e){_0x1f945b=_0xdd4c3e;_0x32227a[_0x1768('0x32')]=_[_0x1768('0x44')](db[_0x1768('0x5f')][_0x1768('0x2b')]);_0x32227a['query']=_[_0x1768('0x44')](_0x2c762f[_0x1768('0x2f')]);_0x32227a[_0x1768('0x30')]=_[_0x1768('0x31')](_0x32227a[_0x1768('0x32')],_0x32227a[_0x1768('0x2f')]);_0x2b9cd2[_0x1768('0x34')]=_[_0x1768('0x31')](_0x32227a[_0x1768('0x32')],qs[_0x1768('0x33')](_0x2c762f[_0x1768('0x2f')][_0x1768('0x33')]));_0x2b9cd2['attributes']=_0x2b9cd2[_0x1768('0x34')][_0x1768('0x45')]?_0x2b9cd2[_0x1768('0x34')]:_0x32227a[_0x1768('0x32')];_0x2b9cd2[_0x1768('0x36')]=qs['sort'](_0x2c762f['query']['sort']);_0x2b9cd2[_0x1768('0x38')]=qs[_0x1768('0x30')](_[_0x1768('0x39')](_0x2c762f[_0x1768('0x2f')],_0x32227a[_0x1768('0x30')]));if(_0x2c762f[_0x1768('0x2f')][_0x1768('0x3a')]){_0x2b9cd2['where']=_[_0x1768('0x3b')](_0x2b9cd2[_0x1768('0x38')],{'$or':_[_0x1768('0x2e')](_0x2b9cd2['attributes'],function(_0x17f372){var _0x3b4fc6={};_0x3b4fc6[_0x17f372]={'$like':'%'+_0x2c762f[_0x1768('0x2f')][_0x1768('0x3a')]+'%'};return _0x3b4fc6;})});}_0x2b9cd2=_[_0x1768('0x3b')]({},_0x2b9cd2,_0x2c762f[_0x1768('0x3d')]);return _0x1f945b[_0x1768('0x6c')](_0x2b9cd2);}})[_0x1768('0x23')](function(_0x1cef00){if(_0x1cef00){_0x335f36=_0x1cef00[_0x1768('0x45')];if(!_0x2c762f[_0x1768('0x2f')][_0x1768('0x6d')](_0x1768('0x35'))){_0x2b9cd2[_0x1768('0x1b')]=qs[_0x1768('0x1b')](_0x2c762f[_0x1768('0x2f')][_0x1768('0x1b')]);_0x2b9cd2[_0x1768('0x1c')]=qs[_0x1768('0x1c')](_0x2c762f[_0x1768('0x2f')][_0x1768('0x1c')]);}return _0x1f945b[_0x1768('0x6c')](_0x2b9cd2);}})[_0x1768('0x23')](function(_0x1043c1){if(_0x1043c1){return _0x1043c1?{'count':_0x335f36,'rows':_0x1043c1}:null;}})[_0x1768('0x23')](respondWithResult(_0x15cd2c,null))[_0x1768('0x41')](handleError(_0x15cd2c,null));}; \ No newline at end of file +var _0x1a6d=['Sequelize','ValidationError','message','addSound','Sound','server/files/sounds/converted','format','%s.%s','basename','save_name','converted_format','symlinkSync','removeSound','id2','findOne','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','get','MusicOnHolds','UserProfileResource','error','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','then','includeAll','findAll','rows','catch','show','params','keys','fields','include','body','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','destroy','readdirSync','unlinkSync','rmdirSync'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1a6d,0xf2));var _0xd1a6=function(_0x1cd2dc,_0x2834d8){_0x1cd2dc=_0x1cd2dc-0x0;var _0x49d4cb=_0x1a6d[_0x1cd2dc];return _0x49d4cb;};'use strict';var emlformat=require(_0xd1a6('0x0'));var rimraf=require(_0xd1a6('0x1'));var zipdir=require(_0xd1a6('0x2'));var jsonpatch=require(_0xd1a6('0x3'));var rp=require(_0xd1a6('0x4'));var moment=require(_0xd1a6('0x5'));var BPromise=require(_0xd1a6('0x6'));var Mustache=require(_0xd1a6('0x7'));var util=require(_0xd1a6('0x8'));var path=require(_0xd1a6('0x9'));var sox=require(_0xd1a6('0xa'));var csv=require('to-csv');var ejs=require(_0xd1a6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd1a6('0xc'));var crypto=require('crypto');var jsforce=require(_0xd1a6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd1a6('0xe'));var Papa=require(_0xd1a6('0xf'));var Redis=require(_0xd1a6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd1a6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1a6('0x12'));var logger=require(_0xd1a6('0x13'))('api');var utils=require(_0xd1a6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd1a6('0x15'));var db=require(_0xd1a6('0x16'))['db'];function respondWithStatusCode(_0x184ca0,_0x38df73){_0x38df73=_0x38df73||0xcc;return function(_0x4e71be){if(_0x4e71be){return _0x184ca0[_0xd1a6('0x17')](_0x38df73);}return _0x184ca0[_0xd1a6('0x18')](_0x38df73)[_0xd1a6('0x19')]();};}function respondWithResult(_0x2a090e,_0x1c29c7){_0x1c29c7=_0x1c29c7||0xc8;return function(_0x3fd37e){if(_0x3fd37e){return _0x2a090e[_0xd1a6('0x18')](_0x1c29c7)[_0xd1a6('0x1a')](_0x3fd37e);}};}function respondWithFilteredResult(_0x503b36,_0x23647e){return function(_0xf0ba13){if(_0xf0ba13){var _0x38388b=typeof _0x23647e[_0xd1a6('0x1b')]===_0xd1a6('0x1c')&&typeof _0x23647e['limit']===_0xd1a6('0x1c');var _0x3ba557=_0xf0ba13[_0xd1a6('0x1d')];var _0x31552e=_0x38388b?0x0:_0x23647e[_0xd1a6('0x1b')];var _0x3cf494=_0x38388b?_0xf0ba13[_0xd1a6('0x1d')]:_0x23647e[_0xd1a6('0x1b')]+_0x23647e[_0xd1a6('0x1e')];var _0x3f035f;if(_0x3cf494>=_0x3ba557){_0x3cf494=_0x3ba557;_0x3f035f=0xc8;}else{_0x3f035f=0xce;}_0x503b36[_0xd1a6('0x18')](_0x3f035f);return _0x503b36[_0xd1a6('0x1f')](_0xd1a6('0x20'),_0x31552e+'-'+_0x3cf494+'/'+_0x3ba557)['json'](_0xf0ba13);}return null;};}function patchUpdates(_0x4aa84c){return function(_0x1a198b){try{jsonpatch['apply'](_0x1a198b,_0x4aa84c,!![]);}catch(_0x8ada28){return BPromise['reject'](_0x8ada28);}return _0x1a198b[_0xd1a6('0x21')]();};}function saveUpdates(_0x4b07ff,_0x31f463){return function(_0x109928){if(_0x109928){return _0x109928[_0xd1a6('0x22')](_0x4b07ff)['then'](function(_0x4f1d1b){return _0x4f1d1b;});}return null;};}function removeEntity(_0x44801d,_0x251889){return function(_0x5a9461){if(_0x5a9461){return _0x5a9461['destroy']()['then'](function(){var _0x19f659=_0x5a9461[_0xd1a6('0x23')]({'plain':!![]});var _0x5cdb73=_0xd1a6('0x24');return db[_0xd1a6('0x25')]['destroy']({'where':{'type':_0x5cdb73,'resourceId':_0x19f659['id']}})['then'](function(){return _0x5a9461;});})['then'](function(){_0x44801d[_0xd1a6('0x18')](0xcc)[_0xd1a6('0x19')]();});}};}function handleEntityNotFound(_0x303780,_0x5c1cd0){return function(_0x31657e){if(!_0x31657e){_0x303780[_0xd1a6('0x17')](0x194);}return _0x31657e;};}function handleError(_0x3e306c,_0xf74869){_0xf74869=_0xf74869||0x1f4;return function(_0x175b76){logger[_0xd1a6('0x26')](_0x175b76['stack']);if(_0x175b76[_0xd1a6('0x27')]){delete _0x175b76[_0xd1a6('0x27')];}_0x3e306c[_0xd1a6('0x18')](_0xf74869)['send'](_0x175b76);};}exports[_0xd1a6('0x28')]=function(_0x2b781f,_0x546f83){var _0x49c1df={},_0x2cfe2f={},_0x3f0e7d={'count':0x0,'rows':[]};var _0x34c625=_[_0xd1a6('0x29')](db[_0xd1a6('0x2a')][_0xd1a6('0x2b')],function(_0x2c1040){return{'name':_0x2c1040[_0xd1a6('0x2c')],'type':_0x2c1040[_0xd1a6('0x2d')][_0xd1a6('0x2e')]};});_0x2cfe2f[_0xd1a6('0x2f')]=_[_0xd1a6('0x29')](_0x34c625,'name');_0x2cfe2f[_0xd1a6('0x30')]=_['keys'](_0x2b781f[_0xd1a6('0x30')]);_0x2cfe2f[_0xd1a6('0x31')]=_[_0xd1a6('0x32')](_0x2cfe2f[_0xd1a6('0x2f')],_0x2cfe2f[_0xd1a6('0x30')]);_0x49c1df[_0xd1a6('0x33')]=_[_0xd1a6('0x32')](_0x2cfe2f[_0xd1a6('0x2f')],qs['fields'](_0x2b781f[_0xd1a6('0x30')]['fields']));_0x49c1df[_0xd1a6('0x33')]=_0x49c1df[_0xd1a6('0x33')][_0xd1a6('0x34')]?_0x49c1df[_0xd1a6('0x33')]:_0x2cfe2f[_0xd1a6('0x2f')];if(!_0x2b781f['query'][_0xd1a6('0x35')](_0xd1a6('0x36'))){_0x49c1df[_0xd1a6('0x1e')]=qs[_0xd1a6('0x1e')](_0x2b781f['query'][_0xd1a6('0x1e')]);_0x49c1df[_0xd1a6('0x1b')]=qs[_0xd1a6('0x1b')](_0x2b781f[_0xd1a6('0x30')][_0xd1a6('0x1b')]);}_0x49c1df[_0xd1a6('0x37')]=qs[_0xd1a6('0x38')](_0x2b781f[_0xd1a6('0x30')][_0xd1a6('0x38')]);delete _0x2b781f[_0xd1a6('0x30')][_0xd1a6('0x38')];_0x49c1df['where']=qs[_0xd1a6('0x31')](_[_0xd1a6('0x39')](_0x2b781f[_0xd1a6('0x30')],_0x2cfe2f['filters']),_0x34c625);if(_0x2b781f[_0xd1a6('0x30')][_0xd1a6('0x3a')]){_0x49c1df[_0xd1a6('0x3b')]=_['merge'](_0x49c1df[_0xd1a6('0x3b')],{'$or':_['map'](_0x34c625,function(_0x19eae4){if(_0x19eae4[_0xd1a6('0x2d')]!==_0xd1a6('0x3c')){var _0x1369a7={};_0x1369a7[_0x19eae4[_0xd1a6('0x27')]]={'$like':'%'+_0x2b781f[_0xd1a6('0x30')][_0xd1a6('0x3a')]+'%'};return _0x1369a7;}})});}_0x49c1df=_[_0xd1a6('0x3d')]({},_0x49c1df,_0x2b781f[_0xd1a6('0x3e')]);var _0x129ba5={'where':_0x49c1df['where']};return db[_0xd1a6('0x2a')]['count'](_0x129ba5)[_0xd1a6('0x3f')](function(_0x3665d5){_0x3f0e7d['count']=_0x3665d5;if(_0x2b781f[_0xd1a6('0x30')][_0xd1a6('0x40')]){_0x49c1df['include']=[{'all':!![]}];}return db[_0xd1a6('0x2a')][_0xd1a6('0x41')](_0x49c1df);})[_0xd1a6('0x3f')](function(_0x3bebb7){_0x3f0e7d[_0xd1a6('0x42')]=_0x3bebb7;return _0x3f0e7d;})['then'](respondWithFilteredResult(_0x546f83,_0x49c1df))[_0xd1a6('0x43')](handleError(_0x546f83,null));};exports[_0xd1a6('0x44')]=function(_0xd000ee,_0x3e8d70){var _0x522681={'raw':![],'where':{'id':_0xd000ee[_0xd1a6('0x45')]['id']}},_0x590153={};_0x590153[_0xd1a6('0x2f')]=_[_0xd1a6('0x46')](db[_0xd1a6('0x2a')][_0xd1a6('0x2b')]);_0x590153[_0xd1a6('0x30')]=_[_0xd1a6('0x46')](_0xd000ee[_0xd1a6('0x30')]);_0x590153[_0xd1a6('0x31')]=_[_0xd1a6('0x32')](_0x590153[_0xd1a6('0x2f')],_0x590153['query']);_0x522681[_0xd1a6('0x33')]=_[_0xd1a6('0x32')](_0x590153['model'],qs[_0xd1a6('0x47')](_0xd000ee[_0xd1a6('0x30')][_0xd1a6('0x47')]));_0x522681[_0xd1a6('0x33')]=_0x522681[_0xd1a6('0x33')][_0xd1a6('0x34')]?_0x522681['attributes']:_0x590153[_0xd1a6('0x2f')];if(_0xd000ee['query'][_0xd1a6('0x40')]){_0x522681[_0xd1a6('0x48')]=[{'all':!![]}];}_0x522681=_['merge']({},_0x522681,_0xd000ee[_0xd1a6('0x3e')]);return db[_0xd1a6('0x2a')]['find'](_0x522681)['then'](handleEntityNotFound(_0x3e8d70,null))['then'](respondWithResult(_0x3e8d70,null))[_0xd1a6('0x43')](handleError(_0x3e8d70,null));};exports[_0xd1a6('0x22')]=function(_0x14097d,_0x435a47){if(_0x14097d[_0xd1a6('0x49')]['id']){delete _0x14097d[_0xd1a6('0x49')]['id'];}return db[_0xd1a6('0x2a')]['find']({'where':{'id':_0x14097d[_0xd1a6('0x45')]['id']}})[_0xd1a6('0x3f')](handleEntityNotFound(_0x435a47,null))[_0xd1a6('0x3f')](saveUpdates(_0x14097d['body'],null))[_0xd1a6('0x3f')](respondWithResult(_0x435a47,null))[_0xd1a6('0x43')](handleError(_0x435a47,null));};exports[_0xd1a6('0x4a')]=function(_0x250392,_0x8f0a13,_0x147eb3){return db[_0xd1a6('0x4b')]['transaction'](function(_0xcd146a){if(_0x250392['body'][_0xd1a6('0x4c')]===_0xd1a6('0x4d')){_0x250392[_0xd1a6('0x49')][_0xd1a6('0x4e')]=path[_0xd1a6('0x4f')](config[_0xd1a6('0x50')],_0xd1a6('0x51'),_0x250392[_0xd1a6('0x49')]['name']);}return db['VoiceMusicOnHold']['create'](_0x250392[_0xd1a6('0x49')],{'transaction':_0xcd146a})[_0xd1a6('0x3f')](function(_0x2a4799){if(_0x250392[_0xd1a6('0x49')][_0xd1a6('0x4c')]===_0xd1a6('0x4d')){fs[_0xd1a6('0x52')](_0x2a4799['directory'],parseInt(_0xd1a6('0x53'),0x8));}var _0x4a2586=_0x250392[_0xd1a6('0x54')][_0xd1a6('0x23')]({'plain':!![]});if(!_0x4a2586)throw new Error(_0xd1a6('0x55'));if(_0x4a2586[_0xd1a6('0x56')]===_0xd1a6('0x54')){var _0x57ef86=_0x2a4799[_0xd1a6('0x23')]({'plain':!![]});return db[_0xd1a6('0x57')][_0xd1a6('0x58')]({'where':{'name':_0xd1a6('0x24'),'userProfileId':_0x4a2586[_0xd1a6('0x59')]},'raw':!![]})[_0xd1a6('0x3f')](function(_0x2faff7){if(_0x2faff7&&_0x2faff7[_0xd1a6('0x5a')]===0x0){return db[_0xd1a6('0x25')][_0xd1a6('0x4a')]({'name':_0x57ef86['name'],'resourceId':_0x57ef86['id'],'type':_0x2faff7[_0xd1a6('0x27')],'sectionId':_0x2faff7['id']},{})[_0xd1a6('0x3f')](function(){return _0x2a4799;});}else{return _0x2a4799;}})[_0xd1a6('0x43')](function(_0x1b7093){logger[_0xd1a6('0x26')](_0xd1a6('0x5b'),_0x1b7093);});}return _0x2a4799;});})['then'](respondWithResult(_0x8f0a13,0xc9))[_0xd1a6('0x43')](handleError(_0x8f0a13,null));};exports['destroy']=function(_0x7c600a,_0x40ee14,_0x52981a){var _0x2f375e;return db[_0xd1a6('0x2a')]['find']({'where':{'id':_0x7c600a[_0xd1a6('0x45')]['id']}})[_0xd1a6('0x3f')](function(_0x25c4db){if(_0x25c4db){return db[_0xd1a6('0x4b')][_0xd1a6('0x5c')](function(_0x12931e){return _0x25c4db[_0xd1a6('0x5d')]({'transaction':_0x12931e,'raw':!![]})['then'](function(_0x415cc6){if(_0x415cc6[_0xd1a6('0x4e')]){fs[_0xd1a6('0x5e')](_0x415cc6[_0xd1a6('0x4e')])['forEach'](function(_0x5cc3f5){fs[_0xd1a6('0x5f')](path[_0xd1a6('0x4f')](_0x415cc6[_0xd1a6('0x4e')],_0x5cc3f5));});fs[_0xd1a6('0x60')](_0x415cc6[_0xd1a6('0x4e')]);}return _0x415cc6;});})[_0xd1a6('0x43')](function(_0x4aae3){throw new db[(_0xd1a6('0x61'))][(_0xd1a6('0x62'))](_0x4aae3[_0xd1a6('0x63')]);});}})[_0xd1a6('0x3f')](handleEntityNotFound(_0x40ee14,null))[_0xd1a6('0x3f')](removeEntity(_0x40ee14,null))[_0xd1a6('0x43')](handleError(_0x40ee14,null));};exports['addSound']=function(_0x327031,_0x19ca78,_0x9312e2){return db['sequelize'][_0xd1a6('0x5c')](function(_0x460d17){var _0x36b81c;return db[_0xd1a6('0x2a')]['find']({'where':{'id':_0x327031[_0xd1a6('0x45')]['id']}})[_0xd1a6('0x3f')](function(_0x3bccb4){if(_0x3bccb4){_0x36b81c=_0x3bccb4;return _0x3bccb4[_0xd1a6('0x64')](_0x327031[_0xd1a6('0x49')]['id'],{'transaction':_0x460d17});}})['then'](function(_0x3d69e5){if(_0x3d69e5){return db[_0xd1a6('0x65')]['findOne']({'where':{'id':_0x327031[_0xd1a6('0x49')]['id']},'attributes':['id',_0xd1a6('0x27'),'save_name','converted_format','createdAt'],'raw':!![]});}})['then'](function(_0xca9664){if(_0xca9664){var _0x37b6c0=path[_0xd1a6('0x4f')](config['root'],_0xd1a6('0x66'),util[_0xd1a6('0x67')](_0xd1a6('0x68'),path[_0xd1a6('0x69')](_0xca9664[_0xd1a6('0x6a')],path['extname'](_0xca9664[_0xd1a6('0x6a')])),_0xca9664[_0xd1a6('0x6b')]));var _0x25075f=path['join'](config[_0xd1a6('0x50')],'server/files/moh',_0x36b81c[_0xd1a6('0x27')],util[_0xd1a6('0x67')](_0xd1a6('0x68'),_0xca9664['name'],_0xca9664[_0xd1a6('0x6b')]));fs[_0xd1a6('0x6c')](_0x37b6c0,_0x25075f);return _0xca9664;}})['catch'](function(_0x26dee5){throw new db[(_0xd1a6('0x61'))][(_0xd1a6('0x62'))](_0x26dee5[_0xd1a6('0x63')]);});})[_0xd1a6('0x3f')](handleEntityNotFound(_0x19ca78,null))[_0xd1a6('0x3f')](respondWithResult(_0x19ca78,0xc9))['catch'](handleError(_0x19ca78,null));};exports[_0xd1a6('0x6d')]=function(_0xd35fcf,_0x5ddc53,_0x80cc5b){return db[_0xd1a6('0x4b')]['transaction'](function(_0x57341c){var _0x2ba6e7;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0xd35fcf['params']['id']}})['then'](handleEntityNotFound(_0x5ddc53,null))['then'](function(_0x36e16d){if(_0x36e16d){_0x2ba6e7=_0x36e16d;return _0x36e16d[_0xd1a6('0x6d')](_0xd35fcf[_0xd1a6('0x45')][_0xd1a6('0x6e')]);}})[_0xd1a6('0x3f')](function(_0x784b47){if(_0x784b47){return db[_0xd1a6('0x65')][_0xd1a6('0x6f')]({'where':{'id':_0xd35fcf[_0xd1a6('0x45')][_0xd1a6('0x6e')]},'attributes':['id',_0xd1a6('0x27'),_0xd1a6('0x6a'),'converted_format','createdAt'],'raw':!![]});}})[_0xd1a6('0x3f')](function(_0x1d8b5d){if(_0x1d8b5d){fs['unlinkSync'](path[_0xd1a6('0x4f')](_0x2ba6e7[_0xd1a6('0x4e')],util['format'](_0xd1a6('0x68'),_0x1d8b5d['name'],_0x1d8b5d[_0xd1a6('0x6b')])));return _0x1d8b5d;}})[_0xd1a6('0x43')](function(_0x4d5436){throw new db[(_0xd1a6('0x61'))][(_0xd1a6('0x62'))](_0x4d5436['message']);});})[_0xd1a6('0x3f')](handleEntityNotFound(_0x5ddc53,null))[_0xd1a6('0x3f')](respondWithStatusCode(_0x5ddc53,0xcc))[_0xd1a6('0x43')](handleError(_0x5ddc53,null));};exports[_0xd1a6('0x70')]=function(_0x1dc513,_0x2070a7,_0x1a07fb){var _0x48dde1={};var _0x2f71a2={};var _0x3d8b83;var _0x4af141;return db[_0xd1a6('0x2a')][_0xd1a6('0x6f')]({'where':{'id':_0x1dc513[_0xd1a6('0x45')]['id']}})[_0xd1a6('0x3f')](handleEntityNotFound(_0x2070a7,null))[_0xd1a6('0x3f')](function(_0x4463be){if(_0x4463be){_0x3d8b83=_0x4463be;_0x2f71a2[_0xd1a6('0x2f')]=_['keys'](db[_0xd1a6('0x65')][_0xd1a6('0x2b')]);_0x2f71a2[_0xd1a6('0x30')]=_['keys'](_0x1dc513[_0xd1a6('0x30')]);_0x2f71a2[_0xd1a6('0x31')]=_[_0xd1a6('0x32')](_0x2f71a2[_0xd1a6('0x2f')],_0x2f71a2[_0xd1a6('0x30')]);_0x48dde1['attributes']=_[_0xd1a6('0x32')](_0x2f71a2[_0xd1a6('0x2f')],qs[_0xd1a6('0x47')](_0x1dc513[_0xd1a6('0x30')][_0xd1a6('0x47')]));_0x48dde1[_0xd1a6('0x33')]=_0x48dde1[_0xd1a6('0x33')][_0xd1a6('0x34')]?_0x48dde1[_0xd1a6('0x33')]:_0x2f71a2[_0xd1a6('0x2f')];_0x48dde1[_0xd1a6('0x37')]=qs['sort'](_0x1dc513[_0xd1a6('0x30')]['sort']);_0x48dde1[_0xd1a6('0x3b')]=qs[_0xd1a6('0x31')](_[_0xd1a6('0x39')](_0x1dc513[_0xd1a6('0x30')],_0x2f71a2[_0xd1a6('0x31')]));if(_0x1dc513[_0xd1a6('0x30')][_0xd1a6('0x3a')]){_0x48dde1[_0xd1a6('0x3b')]=_[_0xd1a6('0x3d')](_0x48dde1['where'],{'$or':_[_0xd1a6('0x29')](_0x48dde1[_0xd1a6('0x33')],function(_0x5290e3){var _0x47fcef={};_0x47fcef[_0x5290e3]={'$like':'%'+_0x1dc513['query'][_0xd1a6('0x3a')]+'%'};return _0x47fcef;})});}_0x48dde1=_[_0xd1a6('0x3d')]({},_0x48dde1,_0x1dc513[_0xd1a6('0x3e')]);return _0x3d8b83['getSounds'](_0x48dde1);}})['then'](function(_0x128aff){if(_0x128aff){_0x4af141=_0x128aff['length'];if(!_0x1dc513[_0xd1a6('0x30')]['hasOwnProperty'](_0xd1a6('0x36'))){_0x48dde1[_0xd1a6('0x1e')]=qs['limit'](_0x1dc513['query'][_0xd1a6('0x1e')]);_0x48dde1[_0xd1a6('0x1b')]=qs[_0xd1a6('0x1b')](_0x1dc513['query'][_0xd1a6('0x1b')]);}return _0x3d8b83[_0xd1a6('0x70')](_0x48dde1);}})[_0xd1a6('0x3f')](function(_0x43ec23){if(_0x43ec23){return _0x43ec23?{'count':_0x4af141,'rows':_0x43ec23}:null;}})[_0xd1a6('0x3f')](respondWithResult(_0x2070a7,null))['catch'](handleError(_0x2070a7,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 9046c91..ee70f47 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 _0x6898=['VoiceMusicOnHold','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x5b6514,_0x3001df){var _0x532331=function(_0x352b22){while(--_0x352b22){_0x5b6514['push'](_0x5b6514['shift']());}};_0x532331(++_0x3001df);}(_0x6898,0xfe));var _0x8689=function(_0x51c303,_0x3305a4){_0x51c303=_0x51c303-0x0;var _0x4d2167=_0x6898[_0x51c303];return _0x4d2167;};'use strict';var _=require(_0x8689('0x0'));var util=require('util');var logger=require(_0x8689('0x1'))(_0x8689('0x2'));var moment=require('moment');var BPromise=require(_0x8689('0x3'));var rp=require(_0x8689('0x4'));var fs=require('fs');var path=require(_0x8689('0x5'));var rimraf=require(_0x8689('0x6'));var config=require(_0x8689('0x7'));var attributes=require(_0x8689('0x8'));module[_0x8689('0x9')]=function(_0x2de64d,_0x29f4bc){return _0x2de64d['define'](_0x8689('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc354=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util'];(function(_0x54e1c9,_0x590e6d){var _0x4caa9b=function(_0x1655f4){while(--_0x1655f4){_0x54e1c9['push'](_0x54e1c9['shift']());}};_0x4caa9b(++_0x590e6d);}(_0xc354,0x15a));var _0x4c35=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc354[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4c35('0x0'));var util=require(_0x4c35('0x1'));var logger=require(_0x4c35('0x2'))(_0x4c35('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4c35('0x4'));var fs=require('fs');var path=require(_0x4c35('0x5'));var rimraf=require(_0x4c35('0x6'));var config=require(_0x4c35('0x7'));var attributes=require(_0x4c35('0x8'));module[_0x4c35('0x9')]=function(_0xfdd1c9,_0x1312f5){return _0xfdd1c9[_0x4c35('0xa')](_0x4c35('0xb'),attributes,{'tableName':'voice_musiconhold','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 96b547a..5e409d2 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 _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(_0xc4f842,_0x4bdd8c){var _0x3d2703=function(_0x20cfeb){while(--_0x20cfeb){_0xc4f842['push'](_0xc4f842['shift']());}};_0x3d2703(++_0x4bdd8c);}(_0x70e0,0x17b));var _0x070e=function(_0x275cee,_0x417138){_0x275cee=_0x275cee-0x0;var _0x43cee1=_0x70e0[_0x275cee];return _0x43cee1;};'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 +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x22e4be,_0xe08073){var _0x2a40d1=function(_0x36433b){while(--_0x36433b){_0x22e4be['push'](_0x22e4be['shift']());}};_0x2a40d1(++_0xe08073);}(_0xe706,0xa3));var _0x6e70=function(_0x409d51,_0x1f0de6){_0x409d51=_0x409d51-0x0;var _0x13eb4b=_0xe706[_0x409d51];return _0x13eb4b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index f4bc5b6..8f1ab32 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 _0x1360=['describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addTeams','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index'];(function(_0x2064f5,_0x2186d0){var _0x29c5a4=function(_0x41f2b0){while(--_0x41f2b0){_0x2064f5['push'](_0x2064f5['shift']());}};_0x29c5a4(++_0x2186d0);}(_0x1360,0xd6));var _0x0136=function(_0xb37311,_0x180fef){_0xb37311=_0xb37311-0x0;var _0x496834=_0x1360[_0xb37311];return _0x496834;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0136('0x0'));var timeout=require(_0x0136('0x1'));var express=require(_0x0136('0x2'));var router=express[_0x0136('0x3')]();var fs_extra=require(_0x0136('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0136('0x5'));var config=require(_0x0136('0x6'));var controller=require(_0x0136('0x7'));router[_0x0136('0x8')]('/',auth[_0x0136('0x9')](),controller[_0x0136('0xa')]);router['get']('/describe',auth[_0x0136('0x9')](),controller[_0x0136('0xb')]);router[_0x0136('0x8')](_0x0136('0xc'),auth[_0x0136('0x9')](),controller[_0x0136('0xd')]);router[_0x0136('0x8')](_0x0136('0xe'),auth[_0x0136('0x9')](),controller[_0x0136('0xf')]);router['get'](_0x0136('0x10'),auth[_0x0136('0x9')](),controller[_0x0136('0x11')]);router[_0x0136('0x12')]('/',auth[_0x0136('0x9')](),controller[_0x0136('0x13')]);router[_0x0136('0x12')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x0136('0x12')](_0x0136('0x10'),auth[_0x0136('0x9')](),controller[_0x0136('0x14')]);router[_0x0136('0x15')](_0x0136('0xc'),auth[_0x0136('0x9')](),controller[_0x0136('0x16')]);router[_0x0136('0x17')](_0x0136('0xc'),auth['isAuthenticated'](),controller[_0x0136('0x18')]);router[_0x0136('0x17')]('/:id/users',auth[_0x0136('0x9')](),controller['removeAgents']);router['delete'](_0x0136('0x10'),auth[_0x0136('0x9')](),controller['removeTeams']);module['exports']=router; \ No newline at end of file +var _0xb9c6=['express','Router','fs-extra','../../config/environment','./voicePrefix.controller','index','/describe','isAuthenticated','get','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0x4ac3bd,_0x6c14ed){var _0x37d125=function(_0x308f7a){while(--_0x308f7a){_0x4ac3bd['push'](_0x4ac3bd['shift']());}};_0x37d125(++_0x6c14ed);}(_0xb9c6,0x1d8));var _0x6b9c=function(_0x3347a1,_0x102677){_0x3347a1=_0x3347a1-0x0;var _0x9eaa0=_0xb9c6[_0x3347a1];return _0x9eaa0;};'use strict';var multer=require(_0x6b9c('0x0'));var util=require(_0x6b9c('0x1'));var path=require(_0x6b9c('0x2'));var timeout=require(_0x6b9c('0x3'));var express=require(_0x6b9c('0x4'));var router=express[_0x6b9c('0x5')]();var fs_extra=require(_0x6b9c('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6b9c('0x7'));var controller=require(_0x6b9c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6b9c('0x9')]);router['get'](_0x6b9c('0xa'),auth[_0x6b9c('0xb')](),controller['describe']);router[_0x6b9c('0xc')](_0x6b9c('0xd'),auth[_0x6b9c('0xb')](),controller[_0x6b9c('0xe')]);router[_0x6b9c('0xc')](_0x6b9c('0xf'),auth[_0x6b9c('0xb')](),controller[_0x6b9c('0x10')]);router['get'](_0x6b9c('0x11'),auth[_0x6b9c('0xb')](),controller[_0x6b9c('0x12')]);router[_0x6b9c('0x13')]('/',auth[_0x6b9c('0xb')](),controller['create']);router[_0x6b9c('0x13')](_0x6b9c('0xf'),auth[_0x6b9c('0xb')](),controller['addAgents']);router['post'](_0x6b9c('0x11'),auth['isAuthenticated'](),controller[_0x6b9c('0x14')]);router[_0x6b9c('0x15')](_0x6b9c('0xd'),auth['isAuthenticated'](),controller[_0x6b9c('0x16')]);router[_0x6b9c('0x17')]('/:id',auth[_0x6b9c('0xb')](),controller[_0x6b9c('0x18')]);router[_0x6b9c('0x17')](_0x6b9c('0xf'),auth[_0x6b9c('0xb')](),controller[_0x6b9c('0x19')]);router['delete'](_0x6b9c('0x11'),auth[_0x6b9c('0xb')](),controller[_0x6b9c('0x1a')]);module[_0x6b9c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 962b89a..5906663 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 _0x86b1=['system-','getDataValue','INTEGER','sequelize','STRING','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x86b1,0x1cb));var _0x186b=function(_0x1d148f,_0x487ab9){_0x1d148f=_0x1d148f-0x0;var _0x57ac51=_0x86b1[_0x1d148f];return _0x57ac51;};'use strict';var Sequelize=require(_0x186b('0x0'));module['exports']={'name':{'type':Sequelize[_0x186b('0x1')],'allowNull':![],'unique':_0x186b('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x288fe6){return _0x186b('0x3')+this[_0x186b('0x4')](_0x186b('0x2'))+'-';}},'description':{'type':Sequelize[_0x186b('0x1')]},'callerIdAll':{'type':Sequelize[_0x186b('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x186b('0x5')]}}; \ No newline at end of file +var _0x752a=['getDataValue','name','sequelize','STRING','system-'];(function(_0x1a6096,_0x543d1c){var _0x1cb84a=function(_0x3b2b31){while(--_0x3b2b31){_0x1a6096['push'](_0x1a6096['shift']());}};_0x1cb84a(++_0x543d1c);}(_0x752a,0xc0));var _0xa752=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x752a[_0x264545];return _0x114d10;};'use strict';var Sequelize=require(_0xa752('0x0'));module['exports']={'name':{'type':Sequelize[_0xa752('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x53fa19){return _0xa752('0x2')+this[_0xa752('0x3')](_0xa752('0x4'))+'-';}},'description':{'type':Sequelize[_0xa752('0x1')]},'callerIdAll':{'type':Sequelize[_0xa752('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c729045..9facf3a 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 _0xfef3=['../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','VoicePrefixes','then','error','stack','name','index','map','VoicePrefix','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','describe','create','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','hasOwnProperty','Team','Agents','online','interface','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','value','isEmpty','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x25f2be,_0xe12346){var _0x481ac6=function(_0x15a9b6){while(--_0x15a9b6){_0x25f2be['push'](_0x25f2be['shift']());}};_0x481ac6(++_0xe12346);}(_0xfef3,0x118));var _0x3fef=function(_0x6ad6c0,_0x39de11){_0x6ad6c0=_0x6ad6c0-0x0;var _0x139825=_0xfef3[_0x6ad6c0];return _0x139825;};'use strict';var emlformat=require(_0x3fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fef('0x2'));var moment=require(_0x3fef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x4'));var util=require(_0x3fef('0x5'));var path=require('path');var sox=require(_0x3fef('0x6'));var csv=require(_0x3fef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fef('0x8'));var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0x7'));var querystring=require(_0x3fef('0xe'));var Papa=require(_0x3fef('0xf'));var Redis=require(_0x3fef('0x10'));var authService=require(_0x3fef('0x11'));var qs=require(_0x3fef('0x12'));var as=require(_0x3fef('0x13'));var hardwareService=require(_0x3fef('0x14'));var logger=require('../../config/logger')(_0x3fef('0x15'));var utils=require(_0x3fef('0x16'));var config=require(_0x3fef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fef('0x18'))['db'];config['redis']=_[_0x3fef('0x19')](config[_0x3fef('0x1a')],{'host':_0x3fef('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3fef('0x1a')]));require('./voicePrefix.socket')[_0x3fef('0x1c')](socket);function respondWithStatusCode(_0x14c053,_0x56a65d){_0x56a65d=_0x56a65d||0xcc;return function(_0x2dec1b){if(_0x2dec1b){return _0x14c053[_0x3fef('0x1d')](_0x56a65d);}return _0x14c053[_0x3fef('0x1e')](_0x56a65d)[_0x3fef('0x1f')]();};}function respondWithResult(_0x395df0,_0x2af1ba){_0x2af1ba=_0x2af1ba||0xc8;return function(_0x5c899f){if(_0x5c899f){return _0x395df0[_0x3fef('0x1e')](_0x2af1ba)[_0x3fef('0x20')](_0x5c899f);}};}function respondWithFilteredResult(_0x1ec282,_0x3f2997){return function(_0x1613ad){if(_0x1613ad){var _0xaa0ae3=typeof _0x3f2997['offset']===_0x3fef('0x21')&&typeof _0x3f2997[_0x3fef('0x22')]==='undefined';var _0x2c7f36=_0x1613ad[_0x3fef('0x23')];var _0x42e095=_0xaa0ae3?0x0:_0x3f2997[_0x3fef('0x24')];var _0x245332=_0xaa0ae3?_0x1613ad[_0x3fef('0x23')]:_0x3f2997[_0x3fef('0x24')]+_0x3f2997[_0x3fef('0x22')];var _0x124e7c;if(_0x245332>=_0x2c7f36){_0x245332=_0x2c7f36;_0x124e7c=0xc8;}else{_0x124e7c=0xce;}_0x1ec282[_0x3fef('0x1e')](_0x124e7c);return _0x1ec282[_0x3fef('0x25')](_0x3fef('0x26'),_0x42e095+'-'+_0x245332+'/'+_0x2c7f36)[_0x3fef('0x20')](_0x1613ad);}return null;};}function patchUpdates(_0x39a8ea){return function(_0x433a3e){try{jsonpatch['apply'](_0x433a3e,_0x39a8ea,!![]);}catch(_0x5b56de){return BPromise['reject'](_0x5b56de);}return _0x433a3e[_0x3fef('0x27')]();};}function saveUpdates(_0x3ba38d,_0xa16dc){return function(_0x5f047c){if(_0x5f047c){return _0x5f047c[_0x3fef('0x28')](_0x3ba38d)['then'](function(_0x45464b){return _0x45464b;});}return null;};}function removeEntity(_0x2c0848,_0x64d3e6){return function(_0xf2b269){if(_0xf2b269){return _0xf2b269[_0x3fef('0x29')]()['then'](function(){var _0x4b4dee=_0xf2b269['get']({'plain':!![]});var _0x121ff0=_0x3fef('0x2a');return db['UserProfileResource'][_0x3fef('0x29')]({'where':{'type':_0x121ff0,'resourceId':_0x4b4dee['id']}})[_0x3fef('0x2b')](function(){return _0xf2b269;});})['then'](function(){_0x2c0848[_0x3fef('0x1e')](0xcc)[_0x3fef('0x1f')]();});}};}function handleEntityNotFound(_0xf892bb,_0x2b73fb){return function(_0x3a1a0a){if(!_0x3a1a0a){_0xf892bb[_0x3fef('0x1d')](0x194);}return _0x3a1a0a;};}function handleError(_0x20abb6,_0x4a632c){_0x4a632c=_0x4a632c||0x1f4;return function(_0x34576a){logger[_0x3fef('0x2c')](_0x34576a[_0x3fef('0x2d')]);if(_0x34576a[_0x3fef('0x2e')]){delete _0x34576a['name'];}_0x20abb6[_0x3fef('0x1e')](_0x4a632c)['send'](_0x34576a);};}exports[_0x3fef('0x2f')]=function(_0x3c4483,_0x16009a){var _0x1136b3={},_0x10b803={},_0x464763={'count':0x0,'rows':[]};var _0x355c03=_[_0x3fef('0x30')](db[_0x3fef('0x31')][_0x3fef('0x32')],function(_0x4f1061){return{'name':_0x4f1061['fieldName'],'type':_0x4f1061[_0x3fef('0x33')]['key']};});_0x10b803[_0x3fef('0x34')]=_[_0x3fef('0x30')](_0x355c03,_0x3fef('0x2e'));_0x10b803[_0x3fef('0x35')]=_[_0x3fef('0x36')](_0x3c4483[_0x3fef('0x35')]);_0x10b803[_0x3fef('0x37')]=_[_0x3fef('0x38')](_0x10b803[_0x3fef('0x34')],_0x10b803[_0x3fef('0x35')]);_0x1136b3[_0x3fef('0x39')]=_[_0x3fef('0x38')](_0x10b803[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x3c4483['query'][_0x3fef('0x3a')]));_0x1136b3[_0x3fef('0x39')]=_0x1136b3[_0x3fef('0x39')][_0x3fef('0x3b')]?_0x1136b3[_0x3fef('0x39')]:_0x10b803[_0x3fef('0x34')];if(!_0x3c4483['query']['hasOwnProperty'](_0x3fef('0x3c'))){_0x1136b3[_0x3fef('0x22')]=qs[_0x3fef('0x22')](_0x3c4483[_0x3fef('0x35')][_0x3fef('0x22')]);_0x1136b3[_0x3fef('0x24')]=qs[_0x3fef('0x24')](_0x3c4483[_0x3fef('0x35')][_0x3fef('0x24')]);}_0x1136b3[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x3c4483['query'][_0x3fef('0x3e')]);_0x1136b3[_0x3fef('0x3f')]=qs['filters'](_['pick'](_0x3c4483[_0x3fef('0x35')],_0x10b803[_0x3fef('0x37')]),_0x355c03);if(_0x3c4483[_0x3fef('0x35')][_0x3fef('0x40')]){_0x1136b3[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x1136b3[_0x3fef('0x3f')],{'$or':_[_0x3fef('0x30')](_0x355c03,function(_0x577ab8){if(_0x577ab8[_0x3fef('0x33')]!==_0x3fef('0x42')){var _0x2859db={};_0x2859db[_0x577ab8[_0x3fef('0x2e')]]={'$like':'%'+_0x3c4483[_0x3fef('0x35')][_0x3fef('0x40')]+'%'};return _0x2859db;}})});}_0x1136b3=_[_0x3fef('0x41')]({},_0x1136b3,_0x3c4483[_0x3fef('0x43')]);var _0x3df52b={'where':_0x1136b3[_0x3fef('0x3f')]};return db[_0x3fef('0x31')][_0x3fef('0x23')](_0x3df52b)[_0x3fef('0x2b')](function(_0x15d2c7){_0x464763[_0x3fef('0x23')]=_0x15d2c7;if(_0x3c4483['query'][_0x3fef('0x44')]){_0x1136b3[_0x3fef('0x45')]=[{'all':!![]}];}return db[_0x3fef('0x31')][_0x3fef('0x46')](_0x1136b3);})[_0x3fef('0x2b')](function(_0x33b145){_0x464763['rows']=_0x33b145;return _0x464763;})[_0x3fef('0x2b')](respondWithFilteredResult(_0x16009a,_0x1136b3))['catch'](handleError(_0x16009a,null));};exports[_0x3fef('0x47')]=function(_0x40a206,_0x59e3b0){var _0xa1a53d={'raw':![],'where':{'id':_0x40a206[_0x3fef('0x48')]['id']}},_0x4e662c={};_0x4e662c[_0x3fef('0x34')]=_[_0x3fef('0x36')](db[_0x3fef('0x31')][_0x3fef('0x32')]);_0x4e662c[_0x3fef('0x35')]=_[_0x3fef('0x36')](_0x40a206[_0x3fef('0x35')]);_0x4e662c[_0x3fef('0x37')]=_[_0x3fef('0x38')](_0x4e662c[_0x3fef('0x34')],_0x4e662c[_0x3fef('0x35')]);_0xa1a53d[_0x3fef('0x39')]=_['intersection'](_0x4e662c[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x40a206['query'][_0x3fef('0x3a')]));_0xa1a53d[_0x3fef('0x39')]=_0xa1a53d[_0x3fef('0x39')]['length']?_0xa1a53d[_0x3fef('0x39')]:_0x4e662c[_0x3fef('0x34')];if(_0x40a206['query'][_0x3fef('0x44')]){_0xa1a53d['include']=[{'all':!![]}];}_0xa1a53d=_['merge']({},_0xa1a53d,_0x40a206[_0x3fef('0x43')]);return db['VoicePrefix'][_0x3fef('0x49')](_0xa1a53d)[_0x3fef('0x2b')](handleEntityNotFound(_0x59e3b0,null))['then'](respondWithResult(_0x59e3b0,null))[_0x3fef('0x4a')](handleError(_0x59e3b0,null));};exports[_0x3fef('0x29')]=function(_0x2f8bb2,_0x5902b1){return db[_0x3fef('0x31')][_0x3fef('0x49')]({'where':{'id':_0x2f8bb2[_0x3fef('0x48')]['id']}})['then'](handleEntityNotFound(_0x5902b1,null))[_0x3fef('0x2b')](removeEntity(_0x5902b1,null))[_0x3fef('0x4a')](handleError(_0x5902b1,null));};exports[_0x3fef('0x4b')]=function(_0x6a5321,_0x3ae6a7){return db['VoicePrefix'][_0x3fef('0x4b')]()[_0x3fef('0x2b')](respondWithResult(_0x3ae6a7,null))[_0x3fef('0x4a')](handleError(_0x3ae6a7,null));};exports[_0x3fef('0x4c')]=function(_0x3dc5b5,_0x15be93){var _0x3f9d35;return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0x4862a5){return db['VoicePrefix'][_0x3fef('0x4c')](_0x3dc5b5[_0x3fef('0x4f')],{'transaction':_0x4862a5})[_0x3fef('0x2b')](function(_0x29c619){_0x3f9d35=_0x29c619[_0x3fef('0x50')]({'plain':!![]});return db[_0x3fef('0x51')][_0x3fef('0x49')]({'where':{'id':_0x3f9d35[_0x3fef('0x52')]},'raw':!![]})[_0x3fef('0x2b')](function(_0x36e054){return createVoicePrefixExtensions(_0x3f9d35,_0x36e054,_0x4862a5);});});})[_0x3fef('0x2b')](function(){var _0x109fac=_0x3dc5b5['user'][_0x3fef('0x50')]({'plain':!![]});if(!_0x109fac)throw new Error(_0x3fef('0x53'));if(_0x109fac[_0x3fef('0x54')]===_0x3fef('0x55')){var _0x5b0415=_0x3f9d35;return db[_0x3fef('0x56')][_0x3fef('0x49')]({'where':{'name':_0x3fef('0x2a'),'userProfileId':_0x109fac[_0x3fef('0x57')]},'raw':!![]})['then'](function(_0x189d48){if(_0x189d48&&_0x189d48[_0x3fef('0x58')]===0x0){return db[_0x3fef('0x59')]['create']({'name':_0x5b0415['name'],'resourceId':_0x5b0415['id'],'type':_0x189d48[_0x3fef('0x2e')],'sectionId':_0x189d48['id']},{})[_0x3fef('0x2b')](function(){return _0x3f9d35;});}else{return _0x3f9d35;}})[_0x3fef('0x4a')](function(_0x3370ef){logger['error'](_0x3fef('0x5a'),_0x3370ef);throw _0x3370ef;});}return _0x3f9d35;})['then'](respondWithResult(_0x15be93,null))[_0x3fef('0x4a')](handleError(_0x15be93,null));};function Extension(_0x48a329,_0x43b311,_0x4cc6de,_0x155fcb){this[_0x3fef('0x5b')]=_0x3fef('0x5c');this['exten']=_0x48a329;this['app']=_0x4cc6de;this[_0x3fef('0x33')]=_0x3fef('0x5d');this[_0x3fef('0x5e')]=_0x3fef('0x5f');this[_0x3fef('0x60')]=_0x43b311;this[_0x3fef('0x61')]=_0x155fcb;}function createVoicePrefixExtensions(_0x1095b6,_0x2b9a5e,_0x5493a8){return new BPromise(function(_0x12ffca,_0x4b6d74){var _0x5ec4e7=new Extension(formatPrefixName(_0x1095b6[_0x3fef('0x62')]),0x1,_0x3fef('0x63'),_0x3fef('0x64'));_0x5ec4e7[_0x3fef('0x65')]=_0x1095b6['id'];return db[_0x3fef('0x51')][_0x3fef('0x4c')](_0x5ec4e7,{'transaction':_0x5493a8})[_0x3fef('0x2b')](function(_0x187c0f){var _0x62e2c4=_0x187c0f['get']({'plain':!![]});var _0x2d36fd=_['map'](addVoicePrefixExtensions(_0x1095b6,_0x2b9a5e),function(_0xc01327){_0xc01327[_0x3fef('0x52')]=_0x62e2c4['id'];_0xc01327[_0x3fef('0x65')]=_0x1095b6['id'];return _0xc01327;});return db[_0x3fef('0x51')][_0x3fef('0x66')](_0x2d36fd,{'transaction':_0x5493a8})[_0x3fef('0x2b')](function(_0x4a4631){if(!_0x4a4631){return _0x4b6d74(_0x3fef('0x67'));}else{return _0x12ffca(_0x4a4631);}})[_0x3fef('0x4a')](function(_0x3e98fb){return _0x4b6d74(_0x3e98fb);});});;});};function addVoicePrefixExtensions(_0x200d07,_0x6cc4a3){var _0x40bd7e=[];var _0x10b869=formatPrefixName(_0x200d07[_0x3fef('0x62')]);_0x40bd7e[_0x3fef('0x68')](new Extension(_0x10b869,0x2,_0x3fef('0x69'),_0x3fef('0x6a')+_0x200d07['name']));if(_0x200d07[_0x3fef('0x6b')]){_0x40bd7e['push'](new Extension(_0x10b869,0x3,'Set','PREFIX-CALLERIDALL='+_0x200d07[_0x3fef('0x6b')]));}else{_0x40bd7e['push'](new Extension(_0x10b869,0x3,_0x3fef('0x63'),_0x3fef('0x6c')));}_0x40bd7e[_0x3fef('0x68')](new Extension(_0x10b869,0x4,'goto',_0x6cc4a3[_0x3fef('0x5b')]+','+'${EXTEN:'+(0x8+_0x200d07[_0x3fef('0x2e')][_0x3fef('0x3b')])+'}'+','+0x1));return _0x40bd7e;}function formatPrefixName(_0x51ea04){var _0x1d0ae0='_';for(var _0x458583=0x0;_0x458583<_0x51ea04[_0x3fef('0x3b')];_0x458583++){if(_0x51ea04[_0x3fef('0x6d')](_0x458583)=='-'){_0x1d0ae0+=_0x51ea04[_0x3fef('0x6d')](_0x458583);}else{_0x1d0ae0+='['+_0x51ea04[_0x3fef('0x6d')](_0x458583)+']';}}_0x1d0ae0+='.';return _0x1d0ae0;}exports[_0x3fef('0x28')]=function(_0x1362ce,_0x4fde10,_0x25467e){var _0x410951=_0x1362ce[_0x3fef('0x4f')];_0x410951[_0x3fef('0x62')]=_0x3fef('0x6e')+_0x410951[_0x3fef('0x2e')]+'-';return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0xaff567){return db[_0x3fef('0x31')][_0x3fef('0x28')](_0x410951,{'where':{'id':_0x410951['id']},'transaction':_0xaff567})[_0x3fef('0x2b')](function(){return db[_0x3fef('0x51')][_0x3fef('0x29')]({'where':{'VoicePrefixId':_0x410951['id']},'transaction':_0xaff567})['then'](function(){return db[_0x3fef('0x51')][_0x3fef('0x49')]({'where':{'id':_0x410951[_0x3fef('0x52')]},'raw':!![]})['then'](function(_0x5e430a){return createVoicePrefixExtensions(_0x410951,_0x5e430a,_0xaff567);});});});})['then'](function(){return db[_0x3fef('0x31')][_0x3fef('0x6f')](_0x410951['id']);})[_0x3fef('0x2b')](respondWithResult(_0x4fde10,null))[_0x3fef('0x4a')](handleError(_0x4fde10,null));};exports['addAgents']=function(_0x441f1f,_0x17856b,_0x2f9b5f){return db[_0x3fef('0x31')]['find']({'where':{'id':_0x441f1f[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x17856b,null))[_0x3fef('0x2b')](function(_0xf80bab){if(_0xf80bab){return _0xf80bab[_0x3fef('0x70')](_0x441f1f['body'][_0x3fef('0x71')],_['omit'](_0x441f1f[_0x3fef('0x4f')],['ids','id'])||{})[_0x3fef('0x72')](function(_0x13b272){for(var _0x2948c4=0x0;_0x2948c4<_0x441f1f[_0x3fef('0x4f')][_0x3fef('0x71')][_0x3fef('0x3b')];_0x2948c4+=0x1){socket[_0x3fef('0x73')](_0x3fef('0x74'),{'UserId':Number(_0x441f1f[_0x3fef('0x4f')]['ids'][_0x2948c4]),'VoicePrefixId':Number(_0x441f1f[_0x3fef('0x48')]['id'])});}return _0x13b272;});}})[_0x3fef('0x2b')](respondWithResult(_0x17856b,null))[_0x3fef('0x4a')](handleError(_0x17856b,null));};exports[_0x3fef('0x75')]=function(_0x4d8a00,_0x766e5d,_0x244d0b){return db[_0x3fef('0x31')][_0x3fef('0x49')]({'where':{'id':_0x4d8a00[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x766e5d,null))['then'](function(_0x34aecb){if(_0x34aecb){return _0x34aecb[_0x3fef('0x75')](_0x4d8a00[_0x3fef('0x35')][_0x3fef('0x71')])[_0x3fef('0x2b')](function(){if(_[_0x3fef('0x76')](_0x4d8a00['query'][_0x3fef('0x71')])){for(var _0x414bfe=0x0;_0x414bfe<_0x4d8a00[_0x3fef('0x35')][_0x3fef('0x71')][_0x3fef('0x3b')];_0x414bfe+=0x1){socket['emit'](_0x3fef('0x77'),{'UserId':Number(_0x4d8a00[_0x3fef('0x35')][_0x3fef('0x71')][_0x414bfe]),'VoicePrefixId':Number(_0x4d8a00['params']['id'])});}}else{socket[_0x3fef('0x73')](_0x3fef('0x77'),{'UserId':Number(_0x4d8a00[_0x3fef('0x35')]['ids']),'VoicePrefixId':Number(_0x4d8a00['params']['id'])});}});}})[_0x3fef('0x2b')](respondWithStatusCode(_0x766e5d,null))[_0x3fef('0x4a')](handleError(_0x766e5d,null));};exports[_0x3fef('0x78')]=function(_0x25914c,_0x573323,_0x169b33){var _0x1361d2={};var _0x29b668={};var _0x5bf8b7;var _0x1cddf6;return db[_0x3fef('0x31')][_0x3fef('0x79')]({'where':{'id':_0x25914c[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x573323,null))[_0x3fef('0x2b')](function(_0x277f65){if(_0x277f65){_0x5bf8b7=_0x277f65;_0x29b668['model']=_['keys'](db[_0x3fef('0x7a')]['rawAttributes']);_0x29b668[_0x3fef('0x35')]=_[_0x3fef('0x36')](_0x25914c[_0x3fef('0x35')]);_0x29b668['filters']=_[_0x3fef('0x38')](_0x29b668['model'],_0x29b668[_0x3fef('0x35')]);_0x1361d2['attributes']=_['intersection'](_0x29b668['model'],qs[_0x3fef('0x3a')](_0x25914c[_0x3fef('0x35')][_0x3fef('0x3a')]));_0x1361d2[_0x3fef('0x39')]=_0x1361d2[_0x3fef('0x39')][_0x3fef('0x3b')]?_0x1361d2[_0x3fef('0x39')]:_0x29b668['model'];_0x1361d2[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x25914c[_0x3fef('0x35')]['sort']);_0x1361d2[_0x3fef('0x3f')]=qs[_0x3fef('0x37')](_[_0x3fef('0x7b')](_0x25914c[_0x3fef('0x35')],_0x29b668['filters']));if(_0x25914c[_0x3fef('0x35')]['filter']){_0x1361d2[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x1361d2[_0x3fef('0x3f')],{'$or':_[_0x3fef('0x30')](_0x1361d2[_0x3fef('0x39')],function(_0x1804a5){var _0x3100c3={};_0x3100c3[_0x1804a5]={'$like':'%'+_0x25914c[_0x3fef('0x35')]['filter']+'%'};return _0x3100c3;})});}_0x1361d2=_[_0x3fef('0x41')]({},_0x1361d2,_0x25914c['options']);return _0x5bf8b7['getAgents'](_0x1361d2);}})[_0x3fef('0x2b')](function(_0x1b9cdc){if(_0x1b9cdc){_0x1cddf6=_0x1b9cdc[_0x3fef('0x3b')];if(!_0x25914c[_0x3fef('0x35')]['hasOwnProperty'](_0x3fef('0x3c'))){_0x1361d2[_0x3fef('0x22')]=qs[_0x3fef('0x22')](_0x25914c[_0x3fef('0x35')]['limit']);_0x1361d2[_0x3fef('0x24')]=qs[_0x3fef('0x24')](_0x25914c[_0x3fef('0x35')][_0x3fef('0x24')]);}return _0x5bf8b7[_0x3fef('0x78')](_0x1361d2);}})['then'](function(_0x27fd0b){if(_0x27fd0b){return _0x27fd0b?{'count':_0x1cddf6,'rows':_0x27fd0b}:null;}})[_0x3fef('0x2b')](respondWithResult(_0x573323,null))[_0x3fef('0x4a')](handleError(_0x573323,null));};exports[_0x3fef('0x7c')]=function(_0x14e142,_0x5894f5,_0xe6a6b7){var _0x26b1c0={};var _0x2000b2={};var _0x44310b;var _0x400fff;return db['VoicePrefix'][_0x3fef('0x79')]({'where':{'id':_0x14e142[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x5894f5,null))[_0x3fef('0x2b')](function(_0x1a5f47){if(_0x1a5f47){_0x44310b=_0x1a5f47;_0x2000b2[_0x3fef('0x34')]=_['keys'](db['Team']['rawAttributes']);_0x2000b2['query']=_['keys'](_0x14e142[_0x3fef('0x35')]);_0x2000b2[_0x3fef('0x37')]=_[_0x3fef('0x38')](_0x2000b2[_0x3fef('0x34')],_0x2000b2[_0x3fef('0x35')]);_0x26b1c0['attributes']=_[_0x3fef('0x38')](_0x2000b2[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x14e142[_0x3fef('0x35')][_0x3fef('0x3a')]));_0x26b1c0[_0x3fef('0x39')]=_0x26b1c0[_0x3fef('0x39')]['length']?_0x26b1c0[_0x3fef('0x39')]:_0x2000b2['model'];_0x26b1c0[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x14e142[_0x3fef('0x35')][_0x3fef('0x3e')]);_0x26b1c0[_0x3fef('0x3f')]=qs[_0x3fef('0x37')](_[_0x3fef('0x7b')](_0x14e142['query'],_0x2000b2['filters']));if(_0x14e142['query']['filter']){_0x26b1c0[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x26b1c0[_0x3fef('0x3f')],{'$or':_[_0x3fef('0x30')](_0x26b1c0[_0x3fef('0x39')],function(_0x580a23){var _0x8d6d0e={};_0x8d6d0e[_0x580a23]={'$like':'%'+_0x14e142[_0x3fef('0x35')][_0x3fef('0x40')]+'%'};return _0x8d6d0e;})});}_0x26b1c0=_['merge']({},_0x26b1c0,_0x14e142[_0x3fef('0x43')]);return _0x44310b[_0x3fef('0x7c')](_0x26b1c0);}})['then'](function(_0x59654f){if(_0x59654f){_0x400fff=_0x59654f[_0x3fef('0x3b')];if(!_0x14e142['query'][_0x3fef('0x7d')](_0x3fef('0x3c'))){_0x26b1c0['limit']=qs[_0x3fef('0x22')](_0x14e142[_0x3fef('0x35')][_0x3fef('0x22')]);_0x26b1c0['offset']=qs[_0x3fef('0x24')](_0x14e142[_0x3fef('0x35')]['offset']);}return _0x44310b[_0x3fef('0x7c')](_0x26b1c0);}})[_0x3fef('0x2b')](function(_0xb08e2c){if(_0xb08e2c){return _0xb08e2c?{'count':_0x400fff,'rows':_0xb08e2c}:null;}})[_0x3fef('0x2b')](respondWithResult(_0x5894f5,null))['catch'](handleError(_0x5894f5,null));};exports['addTeams']=function(_0x91a872,_0x5ce3d8,_0x15cc4f){var _0x11a3d3=_0x91a872[_0x3fef('0x4f')][_0x3fef('0x71')];var _0x4e4a3c;return db[_0x3fef('0x7e')][_0x3fef('0x46')]({'where':{'id':_0x11a3d3},'attributes':['id'],'include':[{'model':db[_0x3fef('0x7a')],'as':_0x3fef('0x7f'),'attributes':['id','name',_0x3fef('0x80'),'voicePause',_0x3fef('0x81')],'raw':!![]}]})[_0x3fef('0x2b')](function(_0x578303){if(_0x578303){_0x4e4a3c=_0x578303;var _0x4c575a=_[_0x3fef('0x82')](_0x578303,function(_0xee8848){var _0x5089f2=_0xee8848[_0x3fef('0x50')]({'plain':!![]});return _0x5089f2[_0x3fef('0x7f')];});return db['VoicePrefix']['find']({'where':{'id':_0x91a872[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](function(_0x5e5b34){return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0x14c4bb){return _0x5e5b34['addTeams'](_0x11a3d3,{'transaction':_0x14c4bb})[_0x3fef('0x2b')](function(){return BPromise[_0x3fef('0x83')](_0x4e4a3c,function(_0x349180){return db[_0x3fef('0x84')][_0x3fef('0x85')]({'TeamId':_0x349180['id'],'VoicePrefixId':_0x91a872['params']['id']},{'transaction':_0x14c4bb});});})[_0x3fef('0x2b')](function(){return BPromise[_0x3fef('0x83')](_0x4c575a,function(_0x45ab57){return db['UserVoicePrefix'][_0x3fef('0x86')]({'where':{'UserId':_0x45ab57['id'],'VoicePrefixId':_0x91a872['params']['id']},'transaction':_0x14c4bb});});})['then'](function(){_0x4c575a[_0x3fef('0x87')](function(_0x1d43ba){socket['emit'](_0x3fef('0x74'),{'UserId':_0x1d43ba['id'],'VoicePrefixId':_0x5e5b34['id']});});});});});}})[_0x3fef('0x2b')](respondWithStatusCode(_0x5ce3d8,null))['catch'](handleError(_0x5ce3d8,null));};exports['removeTeams']=function(_0x373a45,_0x1a792b,_0x34e182){return db['Team'][_0x3fef('0x46')]({'where':{'id':_0x373a45[_0x3fef('0x35')][_0x3fef('0x71')]},'attributes':['id'],'include':[{'model':db[_0x3fef('0x7a')],'as':_0x3fef('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x3fef('0x2b')](handleEntityNotFound(_0x1a792b,null))[_0x3fef('0x2b')](function(_0x114585){var _0x4725dd=_[_0x3fef('0x30')](_0x114585,'id');var _0x3b9285=[];var _0x550ba3=[];var _0x778837=squel[_0x3fef('0x88')]();_0x778837[_0x3fef('0x89')](_0x3fef('0x8a'))['from'](_0x3fef('0x8b'),'tq')[_0x3fef('0x8c')](_0x3fef('0x8d'),'ut',_0x3fef('0x8e'))['where']('VoicePrefixId\x20=\x20?',_0x373a45[_0x3fef('0x48')]['id']);for(var _0x9110ca=0x0;_0x9110ca<_0x114585[_0x3fef('0x3b')];_0x9110ca+=0x1){let _0x2bb28c=_0x114585[_0x9110ca];for(var _0x99fa04=0x0;_0x99fa04<_0x2bb28c['Agents'][_0x3fef('0x3b')];_0x99fa04+=0x1){let _0x2aa67e=_0x2bb28c['Agents'][_0x99fa04];var _0x541b46=_0x778837[_0x3fef('0x8f')]();_0x541b46[_0x3fef('0x3f')](_0x3fef('0x90'),_0x2aa67e['id']);_0x550ba3[_0x3fef('0x68')](db[_0x3fef('0x4d')][_0x3fef('0x35')](_0x541b46['toString'](),{'type':db['sequelize'][_0x3fef('0x91')]['SELECT']})[_0x3fef('0x2b')](function(_0x18afc9){if(_0x18afc9[_0x3fef('0x3b')]===0x1){return _0x2aa67e['id'];}else{var _0x5b6489=_[_0x3fef('0x92')](_[_0x3fef('0x30')](_0x18afc9,_0x3fef('0x93')),function(_0x259fc1){return _['includes'](_0x4725dd,_0x259fc1);});if(_0x5b6489){return _0x2aa67e['id'];}}}));}}return BPromise[_0x3fef('0x94')](_0x550ba3)[_0x3fef('0x2b')](function(_0x37b1a3){_0x3b9285=_(_0x3b9285)[_0x3fef('0x95')](_0x37b1a3)['compact']()[_0x3fef('0x96')]();return db[_0x3fef('0x31')][_0x3fef('0x49')]({'where':{'id':_0x373a45[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](function(_0x446bab){return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0x2eddc5){return _0x446bab['removeTeams'](_0x373a45['query'][_0x3fef('0x71')],{'transaction':_0x2eddc5})[_0x3fef('0x2b')](function(){if(!_[_0x3fef('0x97')](_0x3b9285)){return _0x446bab[_0x3fef('0x75')](_0x3b9285,{'transaction':_0x2eddc5});}})['then'](function(){_0x3b9285[_0x3fef('0x87')](function(_0x2e642d){socket[_0x3fef('0x73')]('userVoicePrefix:remove',{'UserId':_0x2e642d,'VoicePrefixId':_0x446bab['id']});});});});});});})[_0x3fef('0x2b')](respondWithStatusCode(_0x1a792b,null))['catch'](handleError(_0x1a792b,null));}; \ No newline at end of file +var _0x0abf=['show','params','rawAttributes','length','merge','find','sequelize','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoicePrefixes','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','type','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','VoiceExtensionId','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','goto','charAt','update','system-','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','getTeams','Team','Agents','voicePause','flatMap','addTeams','each','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','VoicePrefix','fieldName','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x49c088,_0x33ecac){var _0x1eea49=function(_0x2da011){while(--_0x2da011){_0x49c088['push'](_0x49c088['shift']());}};_0x1eea49(++_0x33ecac);}(_0x0abf,0xe8));var _0xf0ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0abf[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];config[_0xf0ab('0x17')]=_[_0xf0ab('0x18')](config['redis'],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x17')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);function respondWithStatusCode(_0x36cabe,_0x3d7129){_0x3d7129=_0x3d7129||0xcc;return function(_0x1fb4e5){if(_0x1fb4e5){return _0x36cabe[_0xf0ab('0x1d')](_0x3d7129);}return _0x36cabe[_0xf0ab('0x1e')](_0x3d7129)[_0xf0ab('0x1f')]();};}function respondWithResult(_0x221bac,_0x200cf5){_0x200cf5=_0x200cf5||0xc8;return function(_0x2f4618){if(_0x2f4618){return _0x221bac[_0xf0ab('0x1e')](_0x200cf5)['json'](_0x2f4618);}};}function respondWithFilteredResult(_0x457465,_0x9e3b47){return function(_0x1803f0){if(_0x1803f0){var _0x1ffeb5=typeof _0x9e3b47[_0xf0ab('0x20')]===_0xf0ab('0x21')&&typeof _0x9e3b47[_0xf0ab('0x22')]===_0xf0ab('0x21');var _0x1713d6=_0x1803f0[_0xf0ab('0x23')];var _0x715579=_0x1ffeb5?0x0:_0x9e3b47[_0xf0ab('0x20')];var _0xf43bc4=_0x1ffeb5?_0x1803f0[_0xf0ab('0x23')]:_0x9e3b47[_0xf0ab('0x20')]+_0x9e3b47[_0xf0ab('0x22')];var _0x537673;if(_0xf43bc4>=_0x1713d6){_0xf43bc4=_0x1713d6;_0x537673=0xc8;}else{_0x537673=0xce;}_0x457465[_0xf0ab('0x1e')](_0x537673);return _0x457465[_0xf0ab('0x24')](_0xf0ab('0x25'),_0x715579+'-'+_0xf43bc4+'/'+_0x1713d6)[_0xf0ab('0x26')](_0x1803f0);}return null;};}function patchUpdates(_0x3bf6a1){return function(_0x374531){try{jsonpatch[_0xf0ab('0x27')](_0x374531,_0x3bf6a1,!![]);}catch(_0x20140b){return BPromise[_0xf0ab('0x28')](_0x20140b);}return _0x374531[_0xf0ab('0x29')]();};}function saveUpdates(_0x43119f,_0x5645b2){return function(_0x585841){if(_0x585841){return _0x585841['update'](_0x43119f)[_0xf0ab('0x2a')](function(_0x4f0caf){return _0x4f0caf;});}return null;};}function removeEntity(_0x3eca32,_0x16b979){return function(_0x51ac90){if(_0x51ac90){return _0x51ac90[_0xf0ab('0x2b')]()[_0xf0ab('0x2a')](function(){var _0x10bf5f=_0x51ac90[_0xf0ab('0x2c')]({'plain':!![]});var _0x7d4ff9='VoicePrefixes';return db[_0xf0ab('0x2d')]['destroy']({'where':{'type':_0x7d4ff9,'resourceId':_0x10bf5f['id']}})['then'](function(){return _0x51ac90;});})[_0xf0ab('0x2a')](function(){_0x3eca32[_0xf0ab('0x1e')](0xcc)[_0xf0ab('0x1f')]();});}};}function handleEntityNotFound(_0x445160,_0x43476c){return function(_0x174052){if(!_0x174052){_0x445160[_0xf0ab('0x1d')](0x194);}return _0x174052;};}function handleError(_0x14da9c,_0x76a3f3){_0x76a3f3=_0x76a3f3||0x1f4;return function(_0x2f0fcd){logger[_0xf0ab('0x2e')](_0x2f0fcd[_0xf0ab('0x2f')]);if(_0x2f0fcd['name']){delete _0x2f0fcd[_0xf0ab('0x30')];}_0x14da9c[_0xf0ab('0x1e')](_0x76a3f3)['send'](_0x2f0fcd);};}exports['index']=function(_0x1eff91,_0x1dc84e){var _0x43e500={},_0x4dd5b7={},_0x58efce={'count':0x0,'rows':[]};var _0x3ef37c=_['map'](db[_0xf0ab('0x31')]['rawAttributes'],function(_0x3f66fa){return{'name':_0x3f66fa[_0xf0ab('0x32')],'type':_0x3f66fa['type']['key']};});_0x4dd5b7[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x3ef37c,_0xf0ab('0x30'));_0x4dd5b7[_0xf0ab('0x35')]=_[_0xf0ab('0x36')](_0x1eff91[_0xf0ab('0x35')]);_0x4dd5b7[_0xf0ab('0x37')]=_[_0xf0ab('0x38')](_0x4dd5b7[_0xf0ab('0x33')],_0x4dd5b7[_0xf0ab('0x35')]);_0x43e500[_0xf0ab('0x39')]=_[_0xf0ab('0x38')](_0x4dd5b7[_0xf0ab('0x33')],qs[_0xf0ab('0x3a')](_0x1eff91['query'][_0xf0ab('0x3a')]));_0x43e500[_0xf0ab('0x39')]=_0x43e500[_0xf0ab('0x39')]['length']?_0x43e500[_0xf0ab('0x39')]:_0x4dd5b7[_0xf0ab('0x33')];if(!_0x1eff91[_0xf0ab('0x35')]['hasOwnProperty'](_0xf0ab('0x3b'))){_0x43e500['limit']=qs[_0xf0ab('0x22')](_0x1eff91['query'][_0xf0ab('0x22')]);_0x43e500[_0xf0ab('0x20')]=qs[_0xf0ab('0x20')](_0x1eff91[_0xf0ab('0x35')][_0xf0ab('0x20')]);}_0x43e500[_0xf0ab('0x3c')]=qs['sort'](_0x1eff91[_0xf0ab('0x35')][_0xf0ab('0x3d')]);_0x43e500['where']=qs[_0xf0ab('0x37')](_[_0xf0ab('0x3e')](_0x1eff91[_0xf0ab('0x35')],_0x4dd5b7[_0xf0ab('0x37')]),_0x3ef37c);if(_0x1eff91[_0xf0ab('0x35')][_0xf0ab('0x3f')]){_0x43e500[_0xf0ab('0x40')]=_['merge'](_0x43e500[_0xf0ab('0x40')],{'$or':_[_0xf0ab('0x34')](_0x3ef37c,function(_0x7c4629){if(_0x7c4629['type']!==_0xf0ab('0x41')){var _0x234315={};_0x234315[_0x7c4629[_0xf0ab('0x30')]]={'$like':'%'+_0x1eff91[_0xf0ab('0x35')][_0xf0ab('0x3f')]+'%'};return _0x234315;}})});}_0x43e500=_['merge']({},_0x43e500,_0x1eff91[_0xf0ab('0x42')]);var _0x39a212={'where':_0x43e500[_0xf0ab('0x40')]};return db[_0xf0ab('0x31')][_0xf0ab('0x23')](_0x39a212)[_0xf0ab('0x2a')](function(_0x45849c){_0x58efce[_0xf0ab('0x23')]=_0x45849c;if(_0x1eff91[_0xf0ab('0x35')][_0xf0ab('0x43')]){_0x43e500[_0xf0ab('0x44')]=[{'all':!![]}];}return db[_0xf0ab('0x31')][_0xf0ab('0x45')](_0x43e500);})['then'](function(_0x4c4ab9){_0x58efce[_0xf0ab('0x46')]=_0x4c4ab9;return _0x58efce;})['then'](respondWithFilteredResult(_0x1dc84e,_0x43e500))[_0xf0ab('0x47')](handleError(_0x1dc84e,null));};exports[_0xf0ab('0x48')]=function(_0x4bbdf6,_0x8c2d2c){var _0x17ac48={'raw':![],'where':{'id':_0x4bbdf6[_0xf0ab('0x49')]['id']}},_0x591d37={};_0x591d37[_0xf0ab('0x33')]=_[_0xf0ab('0x36')](db[_0xf0ab('0x31')][_0xf0ab('0x4a')]);_0x591d37[_0xf0ab('0x35')]=_[_0xf0ab('0x36')](_0x4bbdf6[_0xf0ab('0x35')]);_0x591d37[_0xf0ab('0x37')]=_[_0xf0ab('0x38')](_0x591d37[_0xf0ab('0x33')],_0x591d37[_0xf0ab('0x35')]);_0x17ac48[_0xf0ab('0x39')]=_[_0xf0ab('0x38')](_0x591d37['model'],qs['fields'](_0x4bbdf6[_0xf0ab('0x35')]['fields']));_0x17ac48['attributes']=_0x17ac48['attributes'][_0xf0ab('0x4b')]?_0x17ac48[_0xf0ab('0x39')]:_0x591d37[_0xf0ab('0x33')];if(_0x4bbdf6[_0xf0ab('0x35')][_0xf0ab('0x43')]){_0x17ac48[_0xf0ab('0x44')]=[{'all':!![]}];}_0x17ac48=_[_0xf0ab('0x4c')]({},_0x17ac48,_0x4bbdf6[_0xf0ab('0x42')]);return db[_0xf0ab('0x31')][_0xf0ab('0x4d')](_0x17ac48)[_0xf0ab('0x2a')](handleEntityNotFound(_0x8c2d2c,null))[_0xf0ab('0x2a')](respondWithResult(_0x8c2d2c,null))['catch'](handleError(_0x8c2d2c,null));};exports[_0xf0ab('0x2b')]=function(_0x41065c,_0x43abde){return db[_0xf0ab('0x31')][_0xf0ab('0x4d')]({'where':{'id':_0x41065c[_0xf0ab('0x49')]['id']}})[_0xf0ab('0x2a')](handleEntityNotFound(_0x43abde,null))[_0xf0ab('0x2a')](removeEntity(_0x43abde,null))['catch'](handleError(_0x43abde,null));};exports['describe']=function(_0x51b4a9,_0xc73871){return db[_0xf0ab('0x31')]['describe']()[_0xf0ab('0x2a')](respondWithResult(_0xc73871,null))[_0xf0ab('0x47')](handleError(_0xc73871,null));};exports['create']=function(_0x1a9981,_0x53d6a4){var _0x1352ac;return db[_0xf0ab('0x4e')][_0xf0ab('0x4f')](function(_0x33112b){return db[_0xf0ab('0x31')]['create'](_0x1a9981[_0xf0ab('0x50')],{'transaction':_0x33112b})['then'](function(_0x229184){_0x1352ac=_0x229184['get']({'plain':!![]});return db[_0xf0ab('0x51')]['find']({'where':{'id':_0x1352ac['VoiceExtensionId']},'raw':!![]})[_0xf0ab('0x2a')](function(_0x58ac39){return createVoicePrefixExtensions(_0x1352ac,_0x58ac39,_0x33112b);});});})[_0xf0ab('0x2a')](function(){var _0x54efed=_0x1a9981[_0xf0ab('0x52')]['get']({'plain':!![]});if(!_0x54efed)throw new Error(_0xf0ab('0x53'));if(_0x54efed[_0xf0ab('0x54')]===_0xf0ab('0x52')){var _0x57f9dd=_0x1352ac;return db['UserProfileSection']['find']({'where':{'name':_0xf0ab('0x55'),'userProfileId':_0x54efed[_0xf0ab('0x56')]},'raw':!![]})['then'](function(_0x511e23){if(_0x511e23&&_0x511e23[_0xf0ab('0x57')]===0x0){return db[_0xf0ab('0x2d')][_0xf0ab('0x58')]({'name':_0x57f9dd[_0xf0ab('0x30')],'resourceId':_0x57f9dd['id'],'type':_0x511e23[_0xf0ab('0x30')],'sectionId':_0x511e23['id']},{})[_0xf0ab('0x2a')](function(){return _0x1352ac;});}else{return _0x1352ac;}})[_0xf0ab('0x47')](function(_0x3bc749){logger[_0xf0ab('0x2e')](_0xf0ab('0x59'),_0x3bc749);throw _0x3bc749;});}return _0x1352ac;})[_0xf0ab('0x2a')](respondWithResult(_0x53d6a4,null))['catch'](handleError(_0x53d6a4,null));};function Extension(_0x41ed17,_0x5b24e3,_0x185b3c,_0x61d3db){this[_0xf0ab('0x5a')]=_0xf0ab('0x5b');this[_0xf0ab('0x5c')]=_0x41ed17;this[_0xf0ab('0x5d')]=_0x185b3c;this[_0xf0ab('0x5e')]=_0xf0ab('0x5f');this[_0xf0ab('0x60')]=_0xf0ab('0x61');this['priority']=_0x5b24e3;this[_0xf0ab('0x62')]=_0x61d3db;}function createVoicePrefixExtensions(_0x2266f3,_0x4062b7,_0x1d4a72){return new BPromise(function(_0x2232eb,_0x314a26){var _0x2a906e=new Extension(formatPrefixName(_0x2266f3[_0xf0ab('0x63')]),0x1,_0xf0ab('0x64'),'Voice\x20Prefix');_0x2a906e['VoicePrefixId']=_0x2266f3['id'];return db[_0xf0ab('0x51')][_0xf0ab('0x58')](_0x2a906e,{'transaction':_0x1d4a72})[_0xf0ab('0x2a')](function(_0x52058a){var _0x3f6c02=_0x52058a[_0xf0ab('0x2c')]({'plain':!![]});var _0xd61dcf=_['map'](addVoicePrefixExtensions(_0x2266f3,_0x4062b7),function(_0x2c1a44){_0x2c1a44[_0xf0ab('0x65')]=_0x3f6c02['id'];_0x2c1a44[_0xf0ab('0x66')]=_0x2266f3['id'];return _0x2c1a44;});return db[_0xf0ab('0x51')][_0xf0ab('0x67')](_0xd61dcf,{'transaction':_0x1d4a72})['then'](function(_0x3f0e11){if(!_0x3f0e11){return _0x314a26(_0xf0ab('0x68'));}else{return _0x2232eb(_0x3f0e11);}})[_0xf0ab('0x47')](function(_0x4531ae){return _0x314a26(_0x4531ae);});});;});};function addVoicePrefixExtensions(_0x14cd6f,_0x3ba915){var _0xe3fc19=[];var _0x2b0b89=formatPrefixName(_0x14cd6f[_0xf0ab('0x63')]);_0xe3fc19[_0xf0ab('0x69')](new Extension(_0x2b0b89,0x2,_0xf0ab('0x6a'),_0xf0ab('0x6b')+_0x14cd6f[_0xf0ab('0x30')]));if(_0x14cd6f['callerIdAll']){_0xe3fc19['push'](new Extension(_0x2b0b89,0x3,_0xf0ab('0x6a'),_0xf0ab('0x6c')+_0x14cd6f[_0xf0ab('0x6d')]));}else{_0xe3fc19['push'](new Extension(_0x2b0b89,0x3,_0xf0ab('0x64'),'No\x20callerid\x20available'));}_0xe3fc19[_0xf0ab('0x69')](new Extension(_0x2b0b89,0x4,_0xf0ab('0x6e'),_0x3ba915[_0xf0ab('0x5a')]+','+'${EXTEN:'+(0x8+_0x14cd6f[_0xf0ab('0x30')]['length'])+'}'+','+0x1));return _0xe3fc19;}function formatPrefixName(_0x5dbeac){var _0x43f9c0='_';for(var _0x461c7a=0x0;_0x461c7a<_0x5dbeac[_0xf0ab('0x4b')];_0x461c7a++){if(_0x5dbeac['charAt'](_0x461c7a)=='-'){_0x43f9c0+=_0x5dbeac[_0xf0ab('0x6f')](_0x461c7a);}else{_0x43f9c0+='['+_0x5dbeac[_0xf0ab('0x6f')](_0x461c7a)+']';}}_0x43f9c0+='.';return _0x43f9c0;}exports[_0xf0ab('0x70')]=function(_0x122c41,_0x5b6923,_0x50137a){var _0x5398e2=_0x122c41[_0xf0ab('0x50')];_0x5398e2[_0xf0ab('0x63')]=_0xf0ab('0x71')+_0x5398e2[_0xf0ab('0x30')]+'-';return db[_0xf0ab('0x4e')][_0xf0ab('0x4f')](function(_0x3a5205){return db[_0xf0ab('0x31')][_0xf0ab('0x70')](_0x5398e2,{'where':{'id':_0x5398e2['id']},'transaction':_0x3a5205})[_0xf0ab('0x2a')](function(){return db[_0xf0ab('0x51')]['destroy']({'where':{'VoicePrefixId':_0x5398e2['id']},'transaction':_0x3a5205})[_0xf0ab('0x2a')](function(){return db[_0xf0ab('0x51')][_0xf0ab('0x4d')]({'where':{'id':_0x5398e2[_0xf0ab('0x65')]},'raw':!![]})[_0xf0ab('0x2a')](function(_0x2d9797){return createVoicePrefixExtensions(_0x5398e2,_0x2d9797,_0x3a5205);});});});})[_0xf0ab('0x2a')](function(){return db[_0xf0ab('0x31')]['findById'](_0x5398e2['id']);})[_0xf0ab('0x2a')](respondWithResult(_0x5b6923,null))[_0xf0ab('0x47')](handleError(_0x5b6923,null));};exports['addAgents']=function(_0x515e2f,_0x4b1a28,_0x331433){return db[_0xf0ab('0x31')][_0xf0ab('0x4d')]({'where':{'id':_0x515e2f[_0xf0ab('0x49')]['id']}})[_0xf0ab('0x2a')](handleEntityNotFound(_0x4b1a28,null))[_0xf0ab('0x2a')](function(_0x4d011e){if(_0x4d011e){return _0x4d011e[_0xf0ab('0x72')](_0x515e2f['body'][_0xf0ab('0x73')],_['omit'](_0x515e2f[_0xf0ab('0x50')],['ids','id'])||{})[_0xf0ab('0x74')](function(_0x4ffd8d){for(var _0x58ca28=0x0;_0x58ca28<_0x515e2f[_0xf0ab('0x50')][_0xf0ab('0x73')][_0xf0ab('0x4b')];_0x58ca28+=0x1){socket[_0xf0ab('0x75')](_0xf0ab('0x76'),{'UserId':Number(_0x515e2f[_0xf0ab('0x50')][_0xf0ab('0x73')][_0x58ca28]),'VoicePrefixId':Number(_0x515e2f[_0xf0ab('0x49')]['id'])});}return _0x4ffd8d;});}})[_0xf0ab('0x2a')](respondWithResult(_0x4b1a28,null))[_0xf0ab('0x47')](handleError(_0x4b1a28,null));};exports[_0xf0ab('0x77')]=function(_0x31f464,_0x228688,_0x59d215){return db[_0xf0ab('0x31')][_0xf0ab('0x4d')]({'where':{'id':_0x31f464[_0xf0ab('0x49')]['id']}})[_0xf0ab('0x2a')](handleEntityNotFound(_0x228688,null))[_0xf0ab('0x2a')](function(_0x3aafc4){if(_0x3aafc4){return _0x3aafc4[_0xf0ab('0x77')](_0x31f464[_0xf0ab('0x35')][_0xf0ab('0x73')])[_0xf0ab('0x2a')](function(){if(_[_0xf0ab('0x78')](_0x31f464[_0xf0ab('0x35')]['ids'])){for(var _0x38249b=0x0;_0x38249b<_0x31f464[_0xf0ab('0x35')][_0xf0ab('0x73')][_0xf0ab('0x4b')];_0x38249b+=0x1){socket['emit'](_0xf0ab('0x79'),{'UserId':Number(_0x31f464[_0xf0ab('0x35')][_0xf0ab('0x73')][_0x38249b]),'VoicePrefixId':Number(_0x31f464[_0xf0ab('0x49')]['id'])});}}else{socket[_0xf0ab('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x31f464[_0xf0ab('0x35')][_0xf0ab('0x73')]),'VoicePrefixId':Number(_0x31f464['params']['id'])});}});}})[_0xf0ab('0x2a')](respondWithStatusCode(_0x228688,null))['catch'](handleError(_0x228688,null));};exports[_0xf0ab('0x7a')]=function(_0x277cec,_0x597a3d,_0x104542){var _0x148a72={};var _0x4c62cb={};var _0x4c5e63;var _0x2cffac;return db['VoicePrefix'][_0xf0ab('0x7b')]({'where':{'id':_0x277cec[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x597a3d,null))['then'](function(_0x50c52c){if(_0x50c52c){_0x4c5e63=_0x50c52c;_0x4c62cb[_0xf0ab('0x33')]=_[_0xf0ab('0x36')](db[_0xf0ab('0x7c')][_0xf0ab('0x4a')]);_0x4c62cb['query']=_[_0xf0ab('0x36')](_0x277cec[_0xf0ab('0x35')]);_0x4c62cb[_0xf0ab('0x37')]=_[_0xf0ab('0x38')](_0x4c62cb[_0xf0ab('0x33')],_0x4c62cb['query']);_0x148a72['attributes']=_[_0xf0ab('0x38')](_0x4c62cb[_0xf0ab('0x33')],qs['fields'](_0x277cec['query'][_0xf0ab('0x3a')]));_0x148a72[_0xf0ab('0x39')]=_0x148a72[_0xf0ab('0x39')][_0xf0ab('0x4b')]?_0x148a72[_0xf0ab('0x39')]:_0x4c62cb[_0xf0ab('0x33')];_0x148a72[_0xf0ab('0x3c')]=qs[_0xf0ab('0x3d')](_0x277cec[_0xf0ab('0x35')][_0xf0ab('0x3d')]);_0x148a72[_0xf0ab('0x40')]=qs['filters'](_['pick'](_0x277cec[_0xf0ab('0x35')],_0x4c62cb['filters']));if(_0x277cec[_0xf0ab('0x35')][_0xf0ab('0x3f')]){_0x148a72[_0xf0ab('0x40')]=_[_0xf0ab('0x4c')](_0x148a72['where'],{'$or':_[_0xf0ab('0x34')](_0x148a72[_0xf0ab('0x39')],function(_0x22923d){var _0xde9d9a={};_0xde9d9a[_0x22923d]={'$like':'%'+_0x277cec[_0xf0ab('0x35')][_0xf0ab('0x3f')]+'%'};return _0xde9d9a;})});}_0x148a72=_[_0xf0ab('0x4c')]({},_0x148a72,_0x277cec[_0xf0ab('0x42')]);return _0x4c5e63[_0xf0ab('0x7a')](_0x148a72);}})[_0xf0ab('0x2a')](function(_0x8671e7){if(_0x8671e7){_0x2cffac=_0x8671e7[_0xf0ab('0x4b')];if(!_0x277cec[_0xf0ab('0x35')][_0xf0ab('0x7d')]('nolimit')){_0x148a72[_0xf0ab('0x22')]=qs[_0xf0ab('0x22')](_0x277cec[_0xf0ab('0x35')][_0xf0ab('0x22')]);_0x148a72[_0xf0ab('0x20')]=qs[_0xf0ab('0x20')](_0x277cec[_0xf0ab('0x35')]['offset']);}return _0x4c5e63['getAgents'](_0x148a72);}})[_0xf0ab('0x2a')](function(_0x200a20){if(_0x200a20){return _0x200a20?{'count':_0x2cffac,'rows':_0x200a20}:null;}})[_0xf0ab('0x2a')](respondWithResult(_0x597a3d,null))['catch'](handleError(_0x597a3d,null));};exports[_0xf0ab('0x7e')]=function(_0x405b34,_0x2dc1d5,_0x1a717e){var _0x334718={};var _0x543638={};var _0x4a91dc;var _0x2a3dd3;return db['VoicePrefix'][_0xf0ab('0x7b')]({'where':{'id':_0x405b34[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x2dc1d5,null))[_0xf0ab('0x2a')](function(_0x223090){if(_0x223090){_0x4a91dc=_0x223090;_0x543638[_0xf0ab('0x33')]=_[_0xf0ab('0x36')](db[_0xf0ab('0x7f')]['rawAttributes']);_0x543638[_0xf0ab('0x35')]=_[_0xf0ab('0x36')](_0x405b34[_0xf0ab('0x35')]);_0x543638[_0xf0ab('0x37')]=_[_0xf0ab('0x38')](_0x543638['model'],_0x543638[_0xf0ab('0x35')]);_0x334718[_0xf0ab('0x39')]=_[_0xf0ab('0x38')](_0x543638[_0xf0ab('0x33')],qs[_0xf0ab('0x3a')](_0x405b34['query'][_0xf0ab('0x3a')]));_0x334718[_0xf0ab('0x39')]=_0x334718[_0xf0ab('0x39')]['length']?_0x334718[_0xf0ab('0x39')]:_0x543638['model'];_0x334718[_0xf0ab('0x3c')]=qs[_0xf0ab('0x3d')](_0x405b34[_0xf0ab('0x35')][_0xf0ab('0x3d')]);_0x334718['where']=qs[_0xf0ab('0x37')](_['pick'](_0x405b34['query'],_0x543638[_0xf0ab('0x37')]));if(_0x405b34['query']['filter']){_0x334718[_0xf0ab('0x40')]=_[_0xf0ab('0x4c')](_0x334718['where'],{'$or':_['map'](_0x334718['attributes'],function(_0x4ca025){var _0x3cba0d={};_0x3cba0d[_0x4ca025]={'$like':'%'+_0x405b34[_0xf0ab('0x35')][_0xf0ab('0x3f')]+'%'};return _0x3cba0d;})});}_0x334718=_[_0xf0ab('0x4c')]({},_0x334718,_0x405b34[_0xf0ab('0x42')]);return _0x4a91dc['getTeams'](_0x334718);}})[_0xf0ab('0x2a')](function(_0x2dd8c0){if(_0x2dd8c0){_0x2a3dd3=_0x2dd8c0[_0xf0ab('0x4b')];if(!_0x405b34[_0xf0ab('0x35')][_0xf0ab('0x7d')](_0xf0ab('0x3b'))){_0x334718[_0xf0ab('0x22')]=qs['limit'](_0x405b34[_0xf0ab('0x35')][_0xf0ab('0x22')]);_0x334718[_0xf0ab('0x20')]=qs[_0xf0ab('0x20')](_0x405b34[_0xf0ab('0x35')][_0xf0ab('0x20')]);}return _0x4a91dc['getTeams'](_0x334718);}})[_0xf0ab('0x2a')](function(_0x45a3f3){if(_0x45a3f3){return _0x45a3f3?{'count':_0x2a3dd3,'rows':_0x45a3f3}:null;}})[_0xf0ab('0x2a')](respondWithResult(_0x2dc1d5,null))[_0xf0ab('0x47')](handleError(_0x2dc1d5,null));};exports['addTeams']=function(_0x426419,_0x395bf6,_0x5b7744){var _0x4a0a43=_0x426419[_0xf0ab('0x50')][_0xf0ab('0x73')];var _0x89b176;return db[_0xf0ab('0x7f')][_0xf0ab('0x45')]({'where':{'id':_0x4a0a43},'attributes':['id'],'include':[{'model':db[_0xf0ab('0x7c')],'as':_0xf0ab('0x80'),'attributes':['id',_0xf0ab('0x30'),'online',_0xf0ab('0x81'),'interface'],'raw':!![]}]})['then'](function(_0x2e7aff){if(_0x2e7aff){_0x89b176=_0x2e7aff;var _0x1e9aab=_[_0xf0ab('0x82')](_0x2e7aff,function(_0x3c799f){var _0x409295=_0x3c799f[_0xf0ab('0x2c')]({'plain':!![]});return _0x409295[_0xf0ab('0x80')];});return db[_0xf0ab('0x31')]['find']({'where':{'id':_0x426419[_0xf0ab('0x49')]['id']}})[_0xf0ab('0x2a')](function(_0x202014){return db[_0xf0ab('0x4e')][_0xf0ab('0x4f')](function(_0x42cb5f){return _0x202014[_0xf0ab('0x83')](_0x4a0a43,{'transaction':_0x42cb5f})[_0xf0ab('0x2a')](function(){return BPromise[_0xf0ab('0x84')](_0x89b176,function(_0x1c77e4){return db['TeamVoicePrefix']['upsert']({'TeamId':_0x1c77e4['id'],'VoicePrefixId':_0x426419['params']['id']},{'transaction':_0x42cb5f});});})[_0xf0ab('0x2a')](function(){return BPromise['each'](_0x1e9aab,function(_0x562b44){return db[_0xf0ab('0x85')][_0xf0ab('0x86')]({'where':{'UserId':_0x562b44['id'],'VoicePrefixId':_0x426419[_0xf0ab('0x49')]['id']},'transaction':_0x42cb5f});});})[_0xf0ab('0x2a')](function(){_0x1e9aab[_0xf0ab('0x87')](function(_0x55a296){socket[_0xf0ab('0x75')](_0xf0ab('0x76'),{'UserId':_0x55a296['id'],'VoicePrefixId':_0x202014['id']});});});});});}})[_0xf0ab('0x2a')](respondWithStatusCode(_0x395bf6,null))[_0xf0ab('0x47')](handleError(_0x395bf6,null));};exports[_0xf0ab('0x88')]=function(_0x1c7ced,_0x3130ea,_0x44d791){return db['Team'][_0xf0ab('0x45')]({'where':{'id':_0x1c7ced['query'][_0xf0ab('0x73')]},'attributes':['id'],'include':[{'model':db[_0xf0ab('0x7c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf0ab('0x2a')](handleEntityNotFound(_0x3130ea,null))[_0xf0ab('0x2a')](function(_0x485eb3){var _0x42a8c4=_[_0xf0ab('0x34')](_0x485eb3,'id');var _0x2286b1=[];var _0x1f2efa=[];var _0x1d12fb=squel[_0xf0ab('0x89')]();_0x1d12fb['field'](_0xf0ab('0x8a'))[_0xf0ab('0x8b')]('team_has_voice_prefixes','tq')[_0xf0ab('0x8c')](_0xf0ab('0x8d'),'ut',_0xf0ab('0x8e'))[_0xf0ab('0x40')]('VoicePrefixId\x20=\x20?',_0x1c7ced['params']['id']);for(var _0x7c7c3b=0x0;_0x7c7c3b<_0x485eb3[_0xf0ab('0x4b')];_0x7c7c3b+=0x1){let _0x550b8c=_0x485eb3[_0x7c7c3b];for(var _0x2f957b=0x0;_0x2f957b<_0x550b8c[_0xf0ab('0x80')][_0xf0ab('0x4b')];_0x2f957b+=0x1){let _0x169831=_0x550b8c[_0xf0ab('0x80')][_0x2f957b];var _0x21283a=_0x1d12fb['clone']();_0x21283a[_0xf0ab('0x40')]('ut.UserId\x20=\x20?',_0x169831['id']);_0x1f2efa[_0xf0ab('0x69')](db[_0xf0ab('0x4e')][_0xf0ab('0x35')](_0x21283a['toString'](),{'type':db[_0xf0ab('0x4e')][_0xf0ab('0x8f')][_0xf0ab('0x90')]})[_0xf0ab('0x2a')](function(_0x3b4538){if(_0x3b4538[_0xf0ab('0x4b')]===0x1){return _0x169831['id'];}else{var _0x31689f=_[_0xf0ab('0x91')](_[_0xf0ab('0x34')](_0x3b4538,'TeamId'),function(_0x4ca354){return _[_0xf0ab('0x92')](_0x42a8c4,_0x4ca354);});if(_0x31689f){return _0x169831['id'];}}}));}}return BPromise[_0xf0ab('0x93')](_0x1f2efa)[_0xf0ab('0x2a')](function(_0x3ece93){_0x2286b1=_(_0x2286b1)[_0xf0ab('0x94')](_0x3ece93)[_0xf0ab('0x95')]()[_0xf0ab('0x96')]();return db[_0xf0ab('0x31')][_0xf0ab('0x4d')]({'where':{'id':_0x1c7ced[_0xf0ab('0x49')]['id']}})['then'](function(_0x1ad0f1){return db[_0xf0ab('0x4e')][_0xf0ab('0x4f')](function(_0x45080a){return _0x1ad0f1[_0xf0ab('0x88')](_0x1c7ced[_0xf0ab('0x35')]['ids'],{'transaction':_0x45080a})[_0xf0ab('0x2a')](function(){if(!_[_0xf0ab('0x97')](_0x2286b1)){return _0x1ad0f1[_0xf0ab('0x77')](_0x2286b1,{'transaction':_0x45080a});}})['then'](function(){_0x2286b1[_0xf0ab('0x87')](function(_0x53f38b){socket['emit'](_0xf0ab('0x79'),{'UserId':_0x53f38b,'VoicePrefixId':_0x1ad0f1['id']});});});});});});})[_0xf0ab('0x2a')](respondWithStatusCode(_0x3130ea,null))[_0xf0ab('0x47')](handleError(_0x3130ea,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7ce62fb..b8a2f22 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 _0xff16=['../../mysqldb','VoicePrefix','setMaxListeners','remove','emit','hasOwnProperty','exports','events'];(function(_0x1dcf04,_0x1be406){var _0x3a08df=function(_0x3e987a){while(--_0x3e987a){_0x1dcf04['push'](_0x1dcf04['shift']());}};_0x3a08df(++_0x1be406);}(_0xff16,0x167));var _0x6ff1=function(_0x2d7374,_0x1f5726){_0x2d7374=_0x2d7374-0x0;var _0x236bf2=_0xff16[_0x2d7374];return _0x236bf2;};'use strict';var EventEmitter=require(_0x6ff1('0x0'));var VoicePrefix=require(_0x6ff1('0x1'))['db'][_0x6ff1('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6ff1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6ff1('0x4')};function emitEvent(_0x2fce62){return function(_0x5633a1,_0x4576bb,_0x1a14a3){VoicePrefixEvents[_0x6ff1('0x5')](_0x2fce62+':'+_0x5633a1['id'],_0x5633a1);VoicePrefixEvents[_0x6ff1('0x5')](_0x2fce62,_0x5633a1);_0x1a14a3(null);};}for(var e in events){if(events[_0x6ff1('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x6ff1('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x6ff5=['VoicePrefix','update','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6ff5,0x7d));var _0x56ff=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6ff5[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x56ff('0x0'))['db'][_0x56ff('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x56ff('0x2'),'afterDestroy':'remove'};function emitEvent(_0xb71e11){return function(_0x5bfdd3,_0x2593cb,_0x3f3f01){VoicePrefixEvents['emit'](_0xb71e11+':'+_0x5bfdd3['id'],_0x5bfdd3);VoicePrefixEvents[_0x56ff('0x3')](_0xb71e11,_0x5bfdd3);_0x3f3f01(null);};}for(var e in events){if(events[_0x56ff('0x4')](e)){var event=events[e];VoicePrefix[_0x56ff('0x5')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 6a83f79..02fabf2 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 _0x034d=['define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./voicePrefix.attributes','exports'];(function(_0x196555,_0x368ed4){var _0x556a6d=function(_0x15ff63){while(--_0x15ff63){_0x196555['push'](_0x196555['shift']());}};_0x556a6d(++_0x368ed4);}(_0x034d,0xab));var _0xd034=function(_0x445b71,_0x4a4bc5){_0x445b71=_0x445b71-0x0;var _0x816452=_0x034d[_0x445b71];return _0x816452;};'use strict';var _=require(_0xd034('0x0'));var util=require(_0xd034('0x1'));var logger=require(_0xd034('0x2'))(_0xd034('0x3'));var moment=require('moment');var BPromise=require(_0xd034('0x4'));var rp=require(_0xd034('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd034('0x6'));var config=require('../../config/environment');var attributes=require(_0xd034('0x7'));module[_0xd034('0x8')]=function(_0xfe7cdb,_0x291bf1){return _0xfe7cdb[_0xd034('0x9')](_0xd034('0xa'),attributes,{'tableName':_0xd034('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fd4=['VoicePrefix','voice_prefixes','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','define'];(function(_0xf94493,_0x3def91){var _0x2d04b1=function(_0x27547e){while(--_0x27547e){_0xf94493['push'](_0xf94493['shift']());}};_0x2d04b1(++_0x3def91);}(_0x7fd4,0xb2));var _0x47fd=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x7fd4[_0x37ffea];return _0x2e2615;};'use strict';var _=require(_0x47fd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x47fd('0x1'));var moment=require(_0x47fd('0x2'));var BPromise=require(_0x47fd('0x3'));var rp=require(_0x47fd('0x4'));var fs=require('fs');var path=require(_0x47fd('0x5'));var rimraf=require('rimraf');var config=require(_0x47fd('0x6'));var attributes=require(_0x47fd('0x7'));module['exports']=function(_0x528897,_0x3caa19){return _0x528897[_0x47fd('0x8')](_0x47fd('0x9'),attributes,{'tableName':_0x47fd('0xa'),'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 3887f08..e50ed24 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 _0xeda7=['redis','defaults','localhost','socket.io-emitter','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ee3e6,_0x3ef99f){var _0x4464f9=function(_0x45da00){while(--_0x45da00){_0x1ee3e6['push'](_0x1ee3e6['shift']());}};_0x4464f9(++_0x3ef99f);}(_0xeda7,0x196));var _0x7eda=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xeda7[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var moment=require(_0x7eda('0x2'));var BPromise=require(_0x7eda('0x3'));var rs=require(_0x7eda('0x4'));var fs=require('fs');var Redis=require(_0x7eda('0x5'));var db=require(_0x7eda('0x6'))['db'];var utils=require(_0x7eda('0x7'));var logger=require(_0x7eda('0x8'))(_0x7eda('0x9'));var config=require(_0x7eda('0xa'));var jayson=require(_0x7eda('0xb'));var client=jayson[_0x7eda('0xc')][_0x7eda('0xd')]({'port':0x232a});config[_0x7eda('0xe')]=_[_0x7eda('0xf')](config[_0x7eda('0xe')],{'host':_0x7eda('0x10'),'port':0x18eb});var socket=require(_0x7eda('0x11'))(new Redis(config[_0x7eda('0xe')]));require('./voicePrefix.socket')[_0x7eda('0x12')](socket);function respondWithRpcPromise(_0x506476,_0x4f69a7,_0x1a0e32){return new BPromise(function(_0x177458,_0x3dfcdb){return client[_0x7eda('0x13')](_0x506476,_0x1a0e32)['then'](function(_0x53792a){logger[_0x7eda('0x14')](_0x7eda('0x15'),_0x4f69a7,_0x7eda('0x16'));logger[_0x7eda('0x17')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x4f69a7,_0x7eda('0x16'),JSON['stringify'](_0x53792a));if(_0x53792a[_0x7eda('0x18')]){if(_0x53792a[_0x7eda('0x18')][_0x7eda('0x19')]===0x1f4){logger[_0x7eda('0x18')](_0x7eda('0x15'),_0x4f69a7,_0x53792a[_0x7eda('0x18')][_0x7eda('0x1a')]);return _0x3dfcdb(_0x53792a[_0x7eda('0x18')][_0x7eda('0x1a')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4f69a7,_0x53792a[_0x7eda('0x18')]['message']);return _0x177458(_0x53792a['error'][_0x7eda('0x1a')]);}else{logger[_0x7eda('0x14')](_0x7eda('0x15'),_0x4f69a7,_0x7eda('0x16'));_0x177458(_0x53792a[_0x7eda('0x1b')]['message']);}})['catch'](function(_0x5dc833){logger[_0x7eda('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x4f69a7,_0x5dc833);_0x3dfcdb(_0x5dc833);});});} \ No newline at end of file +var _0x00f0=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x00f0,0xec));var _0x000f=function(_0x5ea991,_0x823a1){_0x5ea991=_0x5ea991-0x0;var _0x16a734=_0x00f0[_0x5ea991];return _0x16a734;};'use strict';var _=require(_0x000f('0x0'));var util=require(_0x000f('0x1'));var moment=require(_0x000f('0x2'));var BPromise=require(_0x000f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x000f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x000f('0x5'))('rpc');var config=require(_0x000f('0x6'));var jayson=require(_0x000f('0x7'));var client=jayson['client'][_0x000f('0x8')]({'port':0x232a});config[_0x000f('0x9')]=_[_0x000f('0xa')](config[_0x000f('0x9')],{'host':_0x000f('0xb'),'port':0x18eb});var socket=require(_0x000f('0xc'))(new Redis(config[_0x000f('0x9')]));require(_0x000f('0xd'))[_0x000f('0xe')](socket);function respondWithRpcPromise(_0x278cd8,_0x190417,_0x504f65){return new BPromise(function(_0x59749b,_0x1a8ebf){return client[_0x000f('0xf')](_0x278cd8,_0x504f65)['then'](function(_0x2bac47){logger[_0x000f('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x190417,'request\x20sent');logger[_0x000f('0x11')](_0x000f('0x12'),_0x190417,'request\x20sent',JSON['stringify'](_0x2bac47));if(_0x2bac47[_0x000f('0x13')]){if(_0x2bac47[_0x000f('0x13')][_0x000f('0x14')]===0x1f4){logger[_0x000f('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x190417,_0x2bac47[_0x000f('0x13')]['message']);return _0x1a8ebf(_0x2bac47['error'][_0x000f('0x15')]);}logger['error'](_0x000f('0x16'),_0x190417,_0x2bac47[_0x000f('0x13')][_0x000f('0x15')]);return _0x59749b(_0x2bac47[_0x000f('0x13')][_0x000f('0x15')]);}else{logger[_0x000f('0x10')](_0x000f('0x16'),_0x190417,_0x000f('0x17'));_0x59749b(_0x2bac47[_0x000f('0x18')][_0x000f('0x15')]);}})[_0x000f('0x19')](function(_0x156342){logger[_0x000f('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x190417,_0x156342);_0x1a8ebf(_0x156342);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 54115ad..0c4d63e 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 _0x1b32=['save','remove','update','emit','removeListener','register','length'];(function(_0xd23930,_0xed8238){var _0x2909c4=function(_0x2d5e83){while(--_0x2d5e83){_0xd23930['push'](_0xd23930['shift']());}};_0x2909c4(++_0xed8238);}(_0x1b32,0x85));var _0x21b3=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x1b32[_0x2dadb9];return _0x2f0097;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x21b3('0x0'),_0x21b3('0x1'),_0x21b3('0x2')];function createListener(_0x776353,_0xa6a010){return function(_0x2f43c5){_0xa6a010[_0x21b3('0x3')](_0x776353,_0x2f43c5);};}function removeListener(_0x2aba68,_0x34fdac){return function(){VoicePrefixEvents[_0x21b3('0x4')](_0x2aba68,_0x34fdac);};}exports[_0x21b3('0x5')]=function(_0x403803){for(var _0x37859f=0x0,_0x47516a=events[_0x21b3('0x6')];_0x37859f<_0x47516a;_0x37859f++){var _0x5c0f36=events[_0x37859f];var _0x45b1b7=createListener('voicePrefix:'+_0x5c0f36,_0x403803);VoicePrefixEvents['on'](_0x5c0f36,_0x45b1b7);}}; \ No newline at end of file +var _0x3f8c=['remove','update','register','length','voicePrefix:'];(function(_0x3172cf,_0x48389d){var _0xefbccd=function(_0x87edd3){while(--_0x87edd3){_0x3172cf['push'](_0x3172cf['shift']());}};_0xefbccd(++_0x48389d);}(_0x3f8c,0x104));var _0xc3f8=function(_0x87ba3b,_0x3c0032){_0x87ba3b=_0x87ba3b-0x0;var _0x4151a5=_0x3f8c[_0x87ba3b];return _0x4151a5;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xc3f8('0x0'),_0xc3f8('0x1')];function createListener(_0x2e70c4,_0xab5f83){return function(_0x4de1c7){_0xab5f83['emit'](_0x2e70c4,_0x4de1c7);};}function removeListener(_0x54035a,_0x4e5dbd){return function(){VoicePrefixEvents['removeListener'](_0x54035a,_0x4e5dbd);};}exports[_0xc3f8('0x2')]=function(_0x1a6976){for(var _0x3a4e2f=0x0,_0x44c25d=events[_0xc3f8('0x3')];_0x3a4e2f<_0x44c25d;_0x3a4e2f++){var _0x15512a=events[_0x3a4e2f];var _0x51093a=createListener(_0xc3f8('0x4')+_0x15512a,_0x1a6976);VoicePrefixEvents['on'](_0x15512a,_0x51093a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 457019a..3908e70 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x43e7c4,_0x24fb15){var _0x4685d9=function(_0x223a94){while(--_0x223a94){_0x43e7c4['push'](_0x43e7c4['shift']());}};_0x4685d9(++_0x24fb15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _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(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0xb10b,0x12a));var _0xbb10=function(_0x652b90,_0x52865b){_0x652b90=_0x652b90-0x0;var _0x523368=_0xb10b[_0x652b90];return _0x523368;};'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 c10a0d9..4447501 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 _0xa0b5=['predictive','INTEGER','yes','all','once','TEXT','periodic_announce','joinempty','join','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','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','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','fewestcalls','rrmemory','rrordered','setDataValue','getDataValue','type','dialMethod','strategy','booked','progressive'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa0b5,0x1e1));var _0x5a0b=function(_0x294791,_0x80430a){_0x294791=_0x294791-0x0;var _0x159d85=_0xa0b5[_0x294791];return _0x159d85;};'use strict';var Sequelize=require(_0x5a0b('0x0'));module[_0x5a0b('0x1')]={'name':{'type':Sequelize[_0x5a0b('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x4'),_0x5a0b('0x5')),'allowNull':![],'defaultValue':_0x5a0b('0x4')},'musiconhold':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':_0x5a0b('0x6')},'announce':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall','leastrecent',_0x5a0b('0x7'),'random',_0x5a0b('0x8'),'linear','wrandom',_0x5a0b('0x9')),'allowNull':![],'defaultValue':'ringall','set':function(_0x97ca82){this[_0x5a0b('0xa')]('strategy',_0x97ca82?_0x97ca82:_0x5a0b('0x8'));},'get':function(){var _0x43c4af=this[_0x5a0b('0xb')](_0x5a0b('0xc'));var _0x4a82fc=this[_0x5a0b('0xb')](_0x5a0b('0xd'));var _0x544ae0=this[_0x5a0b('0xb')](_0x5a0b('0xe'));if(_0x43c4af==='inbound'){return _0x544ae0;}if(_0x4a82fc===_0x5a0b('0xf')&&_0x544ae0===_0x5a0b('0x8')||_0x4a82fc===_0x5a0b('0xf')&&_0x544ae0==='roundrobin'){return _0x544ae0;}if(_0x4a82fc===_0x5a0b('0x10')||_0x4a82fc===_0x5a0b('0x11')||_0x4a82fc==='power'){return _0x544ae0;}return null;}},'servicelevel':{'type':Sequelize[_0x5a0b('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5a0b('0x12')](0xb)},'timeout':{'type':Sequelize[_0x5a0b('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5a0b('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5a0b('0x2')]},'weight':{'type':Sequelize[_0x5a0b('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no'),'defaultValue':_0x5a0b('0x13')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x5a0b('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5a0b('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5a0b('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5a0b('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5a0b('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x5a0b('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5a0b('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x5a0b('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no'),'defaultValue':_0x5a0b('0x13')},'announce_holdtime':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no',_0x5a0b('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x5a0b('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x5a0b('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5a0b('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5a0b('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x5a0b('0x2')]},'queue_quantity1':{'type':Sequelize[_0x5a0b('0x2')]},'queue_quantity2':{'type':Sequelize[_0x5a0b('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x5a0b('0x2')]},'queue_less_than':{'type':Sequelize[_0x5a0b('0x2')]},'periodic_announce':{'type':Sequelize[_0x5a0b('0x16')],'set':function(_0x4234d3){this['setDataValue'](_0x5a0b('0x17'),_0x4234d3?_0x4234d3['join'](','):[]);},'get':function(){return this[_0x5a0b('0xb')](_0x5a0b('0x17'))?this[_0x5a0b('0xb')](_0x5a0b('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x5a0b('0x13'),'set':function(_0xfd31eb){this[_0x5a0b('0xa')](_0x5a0b('0x18'),_0xfd31eb?_0xfd31eb[_0x5a0b('0x19')](','):undefined);},'get':function(){return this[_0x5a0b('0xb')](_0x5a0b('0x18'))?this[_0x5a0b('0xb')](_0x5a0b('0x18'))[_0x5a0b('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x5721d8){this[_0x5a0b('0xa')]('leavewhenempty',_0x5721d8?_0x5721d8[_0x5a0b('0x19')](','):undefined);},'get':function(){return this[_0x5a0b('0xb')](_0x5a0b('0x1b'))?this[_0x5a0b('0xb')](_0x5a0b('0x1b'))[_0x5a0b('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x5a0b('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5a0b('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5a0b('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x5a0b('0x1c')],'defaultValue':0x0,'set':function(_0x1c67f6){this[_0x5a0b('0xa')](_0x5a0b('0x1d'),_0x1c67f6);if(_0x1c67f6){if(this[_0x5a0b('0xb')](_0x5a0b('0x1e'))<0x2){this['setDataValue'](_0x5a0b('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5a0b('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5a0b('0x1f')},'dialMethod':{'type':Sequelize['ENUM'](_0x5a0b('0x20'),_0x5a0b('0x10'),'power','predictive',_0x5a0b('0xf')),'defaultValue':_0x5a0b('0x10'),'comment':_0x5a0b('0x21')},'dialLimitChannel':{'type':Sequelize[_0x5a0b('0x12')](0x4)[_0x5a0b('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5a0b('0x23')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x5a0b('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5a0b('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x5a0b('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5a0b('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x26'),'dropRate'),'defaultValue':_0x5a0b('0x27'),'comment':_0x5a0b('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5a0b('0x29')](0x2)[_0x5a0b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5a0b('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5a0b('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5a0b('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':_0x5a0b('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5a0b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5a0b('0x2e')},'dialQueueProject':{'type':Sequelize[_0x5a0b('0x2')],'comment':_0x5a0b('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5a0b('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5a0b('0x12')](0x5)[_0x5a0b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5a0b('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5a0b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5a0b('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5a0b('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'defaultValue':0x3,'comment':_0x5a0b('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5a0b('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5a0b('0x36')},'dialTimezone':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x5a0b('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5a0b('0x3')]('always',_0x5a0b('0x38'),_0x5a0b('0x39')),'defaultValue':_0x5a0b('0x3a')},'dialAMDActive':{'type':Sequelize[_0x5a0b('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5a0b('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5a0b('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5a0b('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5a0b('0x12')](0x9)[_0x5a0b('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5a0b('0x12')](0x9)[_0x5a0b('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5a0b('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x5a0b('0x12')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5a0b('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5a0b('0x12')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5a0b('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5a0b('0x12')](0x9)[_0x5a0b('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5a0b('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5a0b('0x12')](0x5)[_0x5a0b('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5a0b('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5a0b('0x12')](0x9)[_0x5a0b('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5a0b('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x5a0b('0x12')](0x5)[_0x5a0b('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5a0b('0x43')},'dialRecallInQueue':{'type':Sequelize[_0x5a0b('0x1c')],'defaultValue':0x0,'comment':_0x5a0b('0x44')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5a0b('0x3')](_0x5a0b('0x45'),_0x5a0b('0x46')),'defaultValue':_0x5a0b('0x45')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x5a0b('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5a0b('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5a0b('0x47')},'dialCutDigit':{'type':Sequelize[_0x5a0b('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5a0b('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5a0b('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5a0b('0x12')](0x5)[_0x5a0b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5a0b('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5a0b('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5a0b('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5a0b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x5a0b('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5a0b('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5a0b('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5a0b('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5a0b('0x12')](0x5)[_0x5a0b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5a0b('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5a0b('0x12')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5a0b('0x50'),'set':function(_0x15809c){if(!_0x15809c)this[_0x5a0b('0xa')](_0x5a0b('0x51'),null);this[_0x5a0b('0xa')](_0x5a0b('0x52'),_0x15809c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5a0b('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5a0b('0x12')](0x3)[_0x5a0b('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x5a0b('0x1c')],'defaultValue':![]}}; \ No newline at end of file +var _0x8b28=['#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','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\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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','STRING','name','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','type','getDataValue','roundrobin','predictive','INTEGER','yes','ENUM','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x2a78d9,_0x271b92){var _0x293145=function(_0x164b12){while(--_0x164b12){_0x2a78d9['push'](_0x2a78d9['shift']());}};_0x293145(++_0x271b92);}(_0x8b28,0x151));var _0x88b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b28[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x88b2('0x0'));module[_0x88b2('0x1')]={'name':{'type':Sequelize[_0x88b2('0x2')],'allowNull':![],'unique':_0x88b2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x88b2('0x4'),_0x88b2('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':_0x88b2('0x6')},'announce':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x88b2('0x7'),_0x88b2('0x8'),_0x88b2('0x9'),'random',_0x88b2('0xa'),_0x88b2('0xb'),_0x88b2('0xc'),_0x88b2('0xd')),'allowNull':![],'defaultValue':_0x88b2('0x7'),'set':function(_0x405e3c){this[_0x88b2('0xe')](_0x88b2('0xf'),_0x405e3c?_0x405e3c:_0x88b2('0xa'));},'get':function(){var _0x6ab838=this['getDataValue'](_0x88b2('0x10'));var _0x4dbb9b=this[_0x88b2('0x11')]('dialMethod');var _0x38737f=this['getDataValue']('strategy');if(_0x6ab838===_0x88b2('0x4')){return _0x38737f;}if(_0x4dbb9b==='booked'&&_0x38737f==='rrmemory'||_0x4dbb9b==='booked'&&_0x38737f===_0x88b2('0x12')){return _0x38737f;}if(_0x4dbb9b==='progressive'||_0x4dbb9b===_0x88b2('0x13')||_0x4dbb9b==='power'){return _0x38737f;}return null;}},'servicelevel':{'type':Sequelize[_0x88b2('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x88b2('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x88b2('0x2')]},'weight':{'type':Sequelize[_0x88b2('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x88b2('0x15'),'no'),'defaultValue':_0x88b2('0x15')},'autopause':{'type':Sequelize[_0x88b2('0x16')](_0x88b2('0x15'),'no',_0x88b2('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x88b2('0x16')](_0x88b2('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x88b2('0x16')](_0x88b2('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x88b2('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x88b2('0x16')](_0x88b2('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x88b2('0x16')](_0x88b2('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x88b2('0x16')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x88b2('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x88b2('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x88b2('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x88b2('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x88b2('0x16')](_0x88b2('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x88b2('0x16')](_0x88b2('0x15'),'no'),'defaultValue':_0x88b2('0x15')},'announce_holdtime':{'type':Sequelize[_0x88b2('0x16')]('yes','no',_0x88b2('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0x88b2('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x88b2('0x2')]},'queue_youarenext':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x88b2('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x88b2('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x88b2('0x2')]},'queue_less_than':{'type':Sequelize[_0x88b2('0x2')]},'periodic_announce':{'type':Sequelize[_0x88b2('0x19')],'set':function(_0x580a10){this['setDataValue'](_0x88b2('0x1a'),_0x580a10?_0x580a10[_0x88b2('0x1b')](','):[]);},'get':function(){return this[_0x88b2('0x11')](_0x88b2('0x1a'))?this[_0x88b2('0x11')](_0x88b2('0x1a'))[_0x88b2('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x88b2('0x15'),'set':function(_0x2eeac6){this[_0x88b2('0xe')](_0x88b2('0x1d'),_0x2eeac6?_0x2eeac6['join'](','):undefined);},'get':function(){return this[_0x88b2('0x11')]('joinempty')?this[_0x88b2('0x11')](_0x88b2('0x1d'))[_0x88b2('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':'no','set':function(_0x1333c6){this[_0x88b2('0xe')](_0x88b2('0x1e'),_0x1333c6?_0x1333c6[_0x88b2('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x88b2('0x1e'))?this[_0x88b2('0x11')](_0x88b2('0x1e'))[_0x88b2('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x88b2('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x88b2('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x88b2('0x1f')],'defaultValue':0x0,'set':function(_0x3ccef8){this[_0x88b2('0xe')]('acw',_0x3ccef8);if(_0x3ccef8){if(this[_0x88b2('0x11')](_0x88b2('0x20'))<0x2){this[_0x88b2('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x88b2('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x88b2('0x1f')],'defaultValue':0x0,'comment':_0x88b2('0x21')},'dialMethod':{'type':Sequelize[_0x88b2('0x16')](_0x88b2('0x22'),_0x88b2('0x23'),_0x88b2('0x24'),_0x88b2('0x13'),'booked'),'defaultValue':'progressive','comment':_0x88b2('0x25')},'dialLimitChannel':{'type':Sequelize[_0x88b2('0x14')](0x4)[_0x88b2('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x88b2('0x27')},'dialLimitQueue':{'type':Sequelize[_0x88b2('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x88b2('0x28')](0x2)[_0x88b2('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x88b2('0x16')](_0x88b2('0x29'),_0x88b2('0x2a')),'defaultValue':_0x88b2('0x2a'),'comment':_0x88b2('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x88b2('0x28')](0x2)[_0x88b2('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x88b2('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x88b2('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x88b2('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x88b2('0x14')](0x3)[_0x88b2('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':_0x88b2('0x2e'),'comment':_0x88b2('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x88b2('0x14')](0x3)[_0x88b2('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88b2('0x30')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x88b2('0x14')](0x3)[_0x88b2('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88b2('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x88b2('0x14')](0x5)[_0x88b2('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x88b2('0x32')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x88b2('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88b2('0x33')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x88b2('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x88b2('0x26')],'defaultValue':0x3,'comment':_0x88b2('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x88b2('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x88b2('0x14')](0x3)[_0x88b2('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':_0x88b2('0x36')},'dialPrefix':{'type':Sequelize[_0x88b2('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x88b2('0x16')](_0x88b2('0x37'),_0x88b2('0x38'),_0x88b2('0x39')),'defaultValue':_0x88b2('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x88b2('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x88b2('0x14')](0x9)[_0x88b2('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x88b2('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x88b2('0x14')](0x9)[_0x88b2('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x88b2('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x88b2('0x14')](0x9)[_0x88b2('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x88b2('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x88b2('0x14')](0x9)[_0x88b2('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x88b2('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0x88b2('0x14')](0x9)[_0x88b2('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x88b2('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x88b2('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x88b2('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x88b2('0x14')](0x9)[_0x88b2('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x88b2('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x88b2('0x14')](0x5)[_0x88b2('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x88b2('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x88b2('0x14')](0x9)[_0x88b2('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x88b2('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0x88b2('0x14')](0x5)[_0x88b2('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x88b2('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x88b2('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x88b2('0x45'),_0x88b2('0x46')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x88b2('0x2')],'comment':_0x88b2('0x47')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x88b2('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x88b2('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x88b2('0x14')](0x3)[_0x88b2('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x88b2('0x48')},'dialCutDigit':{'type':Sequelize[_0x88b2('0x14')](0x3)[_0x88b2('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x88b2('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88b2('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x88b2('0x14')](0x5)[_0x88b2('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x88b2('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0x88b2('0x14')](0x3)[_0x88b2('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88b2('0x4b')},'dialDropRetryFrequency':{'type':Sequelize[_0x88b2('0x14')](0x5)[_0x88b2('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88b2('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x88b2('0x14')](0x5)[_0x88b2('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x88b2('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0x88b2('0x14')](0x3)[_0x88b2('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88b2('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x88b2('0x14')](0x5)[_0x88b2('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x88b2('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x88b2('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x88b2('0x1f')],'defaultValue':![],'comment':_0x88b2('0x50'),'set':function(_0x35f30b){if(!_0x35f30b)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x88b2('0xe')]('mandatoryDisposition',_0x35f30b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x88b2('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x88b2('0x14')](0x3)[_0x88b2('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x88b2('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x88b2('0x14')](0x3)[_0x88b2('0x26')],'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 8f37409..7a594b1 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 _0x03db=['map','value','includes','type','find','name','UserProfileResource','sendStatus','stack','send','index','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','VoiceQueue','include','findAll','show','includeAll','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','QueueCampaigns','outbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','rawAttributes','omit','createdAt','updatedAt','body','error','getHoppers','CmHopper','sort','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','pick','CmHopperFinal','rows','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','interface','flatMap','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','format','forEach','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','voicePause','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','insert','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','VoiceQueues','inbound','filter','ignore'];(function(_0x5652d3,_0x543250){var _0x17a8c2=function(_0x1ffe4d){while(--_0x1ffe4d){_0x5652d3['push'](_0x5652d3['shift']());}};_0x17a8c2(++_0x543250);}(_0x03db,0x156));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb03d('0x0'));var rimraf=require(_0xb03d('0x1'));var zipdir=require(_0xb03d('0x2'));var jsonpatch=require(_0xb03d('0x3'));var rp=require('request-promise');var moment=require(_0xb03d('0x4'));var BPromise=require(_0xb03d('0x5'));var Mustache=require(_0xb03d('0x6'));var util=require(_0xb03d('0x7'));var path=require(_0xb03d('0x8'));var sox=require('sox');var csv=require(_0xb03d('0x9'));var ejs=require(_0xb03d('0xa'));var fs=require('fs');var fs_extra=require(_0xb03d('0xb'));var _=require('lodash');var squel=require(_0xb03d('0xc'));var crypto=require('crypto');var jsforce=require(_0xb03d('0xd'));var deskjs=require(_0xb03d('0xe'));var toCsv=require(_0xb03d('0x9'));var querystring=require(_0xb03d('0xf'));var Papa=require(_0xb03d('0x10'));var Redis=require(_0xb03d('0x11'));var authService=require(_0xb03d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb03d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb03d('0x14'));var utils=require(_0xb03d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb03d('0x16'))['db'];config['redis']=_['defaults'](config[_0xb03d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xb03d('0x18'))(new Redis(config[_0xb03d('0x17')]));require(_0xb03d('0x19'))[_0xb03d('0x1a')](socket);function respondWithStatusCode(_0x1e85d5,_0x2fb19e){_0x2fb19e=_0x2fb19e||0xcc;return function(_0x443fed){if(_0x443fed){return _0x1e85d5['sendStatus'](_0x2fb19e);}return _0x1e85d5[_0xb03d('0x1b')](_0x2fb19e)[_0xb03d('0x1c')]();};}function respondWithResult(_0x2de6db,_0x5980a6){_0x5980a6=_0x5980a6||0xc8;return function(_0x5ca81f){if(_0x5ca81f){return _0x2de6db[_0xb03d('0x1b')](_0x5980a6)[_0xb03d('0x1d')](_0x5ca81f);}};}function respondWithFilteredResult(_0xc0a76a,_0x10b526){return function(_0x17398a){if(_0x17398a){var _0x54fd94=typeof _0x10b526[_0xb03d('0x1e')]===_0xb03d('0x1f')&&typeof _0x10b526['limit']===_0xb03d('0x1f');var _0xfd13c6=_0x17398a[_0xb03d('0x20')];var _0x29c20=_0x54fd94?0x0:_0x10b526[_0xb03d('0x1e')];var _0x331d45=_0x54fd94?_0x17398a[_0xb03d('0x20')]:_0x10b526[_0xb03d('0x1e')]+_0x10b526[_0xb03d('0x21')];var _0x491105;if(_0x331d45>=_0xfd13c6){_0x331d45=_0xfd13c6;_0x491105=0xc8;}else{_0x491105=0xce;}_0xc0a76a['status'](_0x491105);return _0xc0a76a[_0xb03d('0x22')](_0xb03d('0x23'),_0x29c20+'-'+_0x331d45+'/'+_0xfd13c6)[_0xb03d('0x1d')](_0x17398a);}return null;};}function patchUpdates(_0x809c5f){return function(_0x3de6fd){try{jsonpatch['apply'](_0x3de6fd,_0x809c5f,!![]);}catch(_0x380844){return BPromise[_0xb03d('0x24')](_0x380844);}return _0x3de6fd['save']();};}function saveUpdates(_0x2e6783,_0x233761){return function(_0x50885d){if(_0x50885d){return _0x50885d[_0xb03d('0x25')](_0x2e6783)[_0xb03d('0x26')](function(_0x594009){return _0x594009;});}return null;};}function removeEntity(_0xdc21cf,_0x350fe6){return function(_0x2217b1){if(_0x2217b1){return _0x2217b1[_0xb03d('0x27')]()['then'](function(){var _0x214144=_0x2217b1['get']({'plain':!![]});var _0x23f24c=[{'name':_0xb03d('0x28'),'value':_0xb03d('0x29'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5c70ad=_(_0x23f24c)[_0xb03d('0x2a')](_0xb03d('0x2b'))[_0xb03d('0x2c')]('value')[_0xb03d('0x2d')]();if(_[_0xb03d('0x2e')](_0x5c70ad,_0x214144[_0xb03d('0x2f')])){return;}var _0x3f9851=_[_0xb03d('0x30')](_0x23f24c,['value',_0x214144[_0xb03d('0x2f')]])[_0xb03d('0x31')];return db[_0xb03d('0x32')][_0xb03d('0x27')]({'where':{'type':_0x3f9851,'resourceId':_0x214144['id']}})[_0xb03d('0x26')](function(){return _0x2217b1;});})[_0xb03d('0x26')](function(){_0xdc21cf[_0xb03d('0x1b')](0xcc)[_0xb03d('0x1c')]();});}};}function handleEntityNotFound(_0x5f615b,_0x3c7a44){return function(_0x57434c){if(!_0x57434c){_0x5f615b[_0xb03d('0x33')](0x194);}return _0x57434c;};}function handleError(_0x5eeaeb,_0x2ae830){_0x2ae830=_0x2ae830||0x1f4;return function(_0x3639f8){logger['error'](_0x3639f8[_0xb03d('0x34')]);if(_0x3639f8[_0xb03d('0x31')]){delete _0x3639f8['name'];}_0x5eeaeb[_0xb03d('0x1b')](_0x2ae830)[_0xb03d('0x35')](_0x3639f8);};}exports[_0xb03d('0x36')]=function(_0x4a8d37,_0x3cc531){var _0x216cd2={},_0xb1ec44={},_0x2178ad={'count':0x0,'rows':[]};var _0x12ff94=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3b9d0d){return{'name':_0x3b9d0d['fieldName'],'type':_0x3b9d0d[_0xb03d('0x2f')]['key']};});_0xb1ec44[_0xb03d('0x37')]=_['map'](_0x12ff94,_0xb03d('0x31'));_0xb1ec44['query']=_[_0xb03d('0x38')](_0x4a8d37[_0xb03d('0x39')]);_0xb1ec44['filters']=_[_0xb03d('0x3a')](_0xb1ec44[_0xb03d('0x37')],_0xb1ec44[_0xb03d('0x39')]);_0x216cd2[_0xb03d('0x3b')]=_['intersection'](_0xb1ec44[_0xb03d('0x37')],qs[_0xb03d('0x3c')](_0x4a8d37[_0xb03d('0x39')][_0xb03d('0x3c')]));_0x216cd2['attributes']=_0x216cd2['attributes'][_0xb03d('0x3d')]?_0x216cd2['attributes']:_0xb1ec44[_0xb03d('0x37')];if(!_0x4a8d37[_0xb03d('0x39')][_0xb03d('0x3e')](_0xb03d('0x3f'))){_0x216cd2[_0xb03d('0x21')]=qs[_0xb03d('0x21')](_0x4a8d37['query']['limit']);_0x216cd2[_0xb03d('0x1e')]=qs[_0xb03d('0x1e')](_0x4a8d37['query'][_0xb03d('0x1e')]);}_0x216cd2[_0xb03d('0x40')]=qs['sort'](_0x4a8d37[_0xb03d('0x39')]['sort']);_0x216cd2[_0xb03d('0x41')]=qs[_0xb03d('0x42')](_['pick'](_0x4a8d37['query'],_0xb1ec44[_0xb03d('0x42')]),_0x12ff94);if(_0x4a8d37['query'][_0xb03d('0x2a')]){_0x216cd2['where']=_[_0xb03d('0x43')](_0x216cd2['where'],{'$or':_[_0xb03d('0x2c')](_0x12ff94,function(_0x330d86){if(_0x330d86[_0xb03d('0x2f')]!==_0xb03d('0x44')){var _0x3fc54f={};_0x3fc54f[_0x330d86['name']]={'$like':'%'+_0x4a8d37[_0xb03d('0x39')][_0xb03d('0x2a')]+'%'};return _0x3fc54f;}})});}_0x216cd2=_[_0xb03d('0x43')]({},_0x216cd2,_0x4a8d37[_0xb03d('0x45')]);var _0x312de4={'where':_0x216cd2[_0xb03d('0x41')]};return db[_0xb03d('0x46')][_0xb03d('0x20')](_0x312de4)[_0xb03d('0x26')](function(_0x351a3b){_0x2178ad['count']=_0x351a3b;if(_0x4a8d37[_0xb03d('0x39')]['includeAll']){_0x216cd2[_0xb03d('0x47')]=[{'all':!![]}];}return db[_0xb03d('0x46')][_0xb03d('0x48')](_0x216cd2);})[_0xb03d('0x26')](function(_0x1623f4){_0x2178ad['rows']=_0x1623f4;return _0x2178ad;})[_0xb03d('0x26')](respondWithFilteredResult(_0x3cc531,_0x216cd2))['catch'](handleError(_0x3cc531,null));};exports[_0xb03d('0x49')]=function(_0x4a116b,_0x4d48d0){var _0x47d50a={'raw':![],'where':{'id':_0x4a116b['params']['id']}},_0x4e6737={};_0x4e6737[_0xb03d('0x37')]=_[_0xb03d('0x38')](db['VoiceQueue']['rawAttributes']);_0x4e6737[_0xb03d('0x39')]=_[_0xb03d('0x38')](_0x4a116b[_0xb03d('0x39')]);_0x4e6737[_0xb03d('0x42')]=_[_0xb03d('0x3a')](_0x4e6737[_0xb03d('0x37')],_0x4e6737[_0xb03d('0x39')]);_0x47d50a[_0xb03d('0x3b')]=_['intersection'](_0x4e6737[_0xb03d('0x37')],qs[_0xb03d('0x3c')](_0x4a116b[_0xb03d('0x39')]['fields']));_0x47d50a[_0xb03d('0x3b')]=_0x47d50a[_0xb03d('0x3b')][_0xb03d('0x3d')]?_0x47d50a[_0xb03d('0x3b')]:_0x4e6737['model'];if(_0x4a116b[_0xb03d('0x39')][_0xb03d('0x4a')]){_0x47d50a[_0xb03d('0x47')]=[{'all':!![]}];}_0x47d50a=_[_0xb03d('0x43')]({},_0x47d50a,_0x4a116b[_0xb03d('0x45')]);return db[_0xb03d('0x46')][_0xb03d('0x30')](_0x47d50a)[_0xb03d('0x26')](handleEntityNotFound(_0x4d48d0,null))[_0xb03d('0x26')](respondWithResult(_0x4d48d0,null))[_0xb03d('0x4b')](handleError(_0x4d48d0,null));};exports['create']=function(_0x2411c5,_0x13ff57){return db[_0xb03d('0x46')][_0xb03d('0x4c')](_0x2411c5['body'],{})[_0xb03d('0x26')](function(_0x15460a){var _0x5c3d4e=_0x2411c5['user'][_0xb03d('0x4d')]({'plain':!![]});if(!_0x5c3d4e)throw new Error(_0xb03d('0x4e'));if(_0x5c3d4e[_0xb03d('0x4f')]===_0xb03d('0x50')){var _0x371cbb=_0x15460a[_0xb03d('0x4d')]({'plain':!![]});var _0x588eb7=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xb03d('0x51'),'value':_0xb03d('0x52')}];var _0x4e0429=_[_0xb03d('0x30')](_0x588eb7,[_0xb03d('0x2d'),_0x371cbb['type']])[_0xb03d('0x31')];return db[_0xb03d('0x53')][_0xb03d('0x30')]({'where':{'name':_0x4e0429,'userProfileId':_0x5c3d4e[_0xb03d('0x54')]},'raw':!![]})['then'](function(_0xd95952){if(_0xd95952&&_0xd95952[_0xb03d('0x55')]===0x0){return db[_0xb03d('0x32')][_0xb03d('0x4c')]({'name':_0x371cbb[_0xb03d('0x31')],'resourceId':_0x371cbb['id'],'type':_0xd95952['name'],'sectionId':_0xd95952['id']},{})[_0xb03d('0x26')](function(){return _0x15460a;});}else{return _0x15460a;}})[_0xb03d('0x4b')](function(_0x55d563){logger['error'](_0xb03d('0x56'),_0x55d563);throw _0x55d563;});}return _0x15460a;})['then'](respondWithResult(_0x13ff57,0xc9))[_0xb03d('0x4b')](handleError(_0x13ff57,null));};exports[_0xb03d('0x57')]=function(_0x41c98e,_0x324307){var _0x184fb7={'where':{'id':_0x41c98e[_0xb03d('0x58')]['id']}},_0x266528={};_0x266528['model']=_[_0xb03d('0x38')](db['VoiceQueue'][_0xb03d('0x59')]);_0x184fb7[_0xb03d('0x3b')]=_[_0xb03d('0x3a')](_0x266528[_0xb03d('0x37')],qs[_0xb03d('0x3c')](_0x41c98e[_0xb03d('0x39')][_0xb03d('0x3c')]));_0x184fb7[_0xb03d('0x3b')]=_0x184fb7['attributes']['length']?_0x184fb7[_0xb03d('0x3b')]:_0x266528[_0xb03d('0x37')];if(_0x41c98e[_0xb03d('0x39')][_0xb03d('0x4a')]){_0x184fb7['include']=[{'all':!![]}];}_0x184fb7=_['merge']({},_0x184fb7,_0x41c98e[_0xb03d('0x45')]);return db[_0xb03d('0x46')]['find'](_0x184fb7)[_0xb03d('0x26')](handleEntityNotFound(_0x324307,null))['then'](function(_0x185988){if(_0x185988){var _0x3f8ea3=_0x185988['get']({'plain':!![]});_0x3f8ea3=qs[_0xb03d('0x5a')](_0x3f8ea3,['id',_0xb03d('0x5b'),_0xb03d('0x5c')]);_0x41c98e[_0xb03d('0x5d')]=_[_0xb03d('0x5a')](_0x41c98e[_0xb03d('0x5d')],['id',_0xb03d('0x5b'),_0xb03d('0x5c')]);return db[_0xb03d('0x46')]['create'](_[_0xb03d('0x43')](_0x3f8ea3,_0x41c98e[_0xb03d('0x5d')]),{'include':_0x41c98e[_0xb03d('0x39')][_0xb03d('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x5f375d){var _0xd8c7e7=_0x41c98e['user'][_0xb03d('0x4d')]({'plain':!![]});if(!_0xd8c7e7)throw new Error(_0xb03d('0x4e'));if(_0xd8c7e7[_0xb03d('0x4f')]==='user'){var _0x4315bb=_0x5f375d[_0xb03d('0x4d')]({'plain':!![]});var _0x8efbfa=[{'name':'VoiceQueues','value':_0xb03d('0x29')},{'name':'QueueCampaigns','value':'outbound'}];var _0x6afa56=_[_0xb03d('0x30')](_0x8efbfa,[_0xb03d('0x2d'),_0x4315bb[_0xb03d('0x2f')]])['name'];return db[_0xb03d('0x53')][_0xb03d('0x30')]({'where':{'name':_0x6afa56,'userProfileId':_0xd8c7e7[_0xb03d('0x54')]},'raw':!![]})[_0xb03d('0x26')](function(_0x49b864){if(_0x49b864&&_0x49b864[_0xb03d('0x55')]===0x0){return db[_0xb03d('0x32')][_0xb03d('0x4c')]({'name':_0x4315bb['name'],'resourceId':_0x4315bb['id'],'type':_0x49b864[_0xb03d('0x31')],'sectionId':_0x49b864['id']},{})['then'](function(){return _0x5f375d;});}else{return _0x5f375d;}})[_0xb03d('0x4b')](function(_0x28af78){logger[_0xb03d('0x5e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28af78);throw _0x28af78;});}return _0x5f375d;});}})[_0xb03d('0x26')](respondWithResult(_0x324307,0xc9))[_0xb03d('0x4b')](handleError(_0x324307,null));};exports[_0xb03d('0x25')]=function(_0x2d13ef,_0xfdceae){if(_0x2d13ef[_0xb03d('0x5d')]['id']){delete _0x2d13ef['body']['id'];}return db[_0xb03d('0x46')][_0xb03d('0x30')]({'where':{'id':_0x2d13ef[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0xfdceae,null))[_0xb03d('0x26')](saveUpdates(_0x2d13ef[_0xb03d('0x5d')],null))[_0xb03d('0x26')](respondWithResult(_0xfdceae,null))[_0xb03d('0x4b')](handleError(_0xfdceae,null));};exports['destroy']=function(_0x276b30,_0x139fef){return db[_0xb03d('0x46')]['find']({'where':{'id':_0x276b30[_0xb03d('0x58')]['id']}})['then'](handleEntityNotFound(_0x139fef,null))[_0xb03d('0x26')](removeEntity(_0x139fef,null))[_0xb03d('0x4b')](handleError(_0x139fef,null));};exports[_0xb03d('0x5f')]=function(_0x103e62,_0x2bd7d9,_0x2f1b7f){var _0x1c9c3d={'raw':![],'where':{}};var _0x46f8a8={};var _0x4c4bc8={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x103e62[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x2bd7d9,null))[_0xb03d('0x26')](function(_0x3f902f){if(_0x3f902f){_0x46f8a8[_0xb03d('0x37')]=_[_0xb03d('0x38')](db[_0xb03d('0x60')][_0xb03d('0x59')]);_0x46f8a8[_0xb03d('0x39')]=_[_0xb03d('0x38')](_0x103e62['query']);_0x46f8a8[_0xb03d('0x42')]=_[_0xb03d('0x3a')](_0x46f8a8[_0xb03d('0x37')],_0x46f8a8[_0xb03d('0x39')]);_0x1c9c3d[_0xb03d('0x3b')]=_[_0xb03d('0x3a')](_0x46f8a8[_0xb03d('0x37')],qs[_0xb03d('0x3c')](_0x103e62[_0xb03d('0x39')]['fields']));_0x1c9c3d[_0xb03d('0x3b')]=_0x1c9c3d[_0xb03d('0x3b')][_0xb03d('0x3d')]?_0x1c9c3d[_0xb03d('0x3b')]:_0x46f8a8['model'];if(!_0x103e62[_0xb03d('0x39')][_0xb03d('0x3e')](_0xb03d('0x3f'))){_0x1c9c3d[_0xb03d('0x21')]=qs[_0xb03d('0x21')](_0x103e62['query'][_0xb03d('0x21')]);_0x1c9c3d[_0xb03d('0x1e')]=qs[_0xb03d('0x1e')](_0x103e62[_0xb03d('0x39')][_0xb03d('0x1e')]);}_0x1c9c3d[_0xb03d('0x40')]=qs[_0xb03d('0x61')](_0x103e62[_0xb03d('0x39')][_0xb03d('0x61')]);_0x1c9c3d['where']=qs[_0xb03d('0x42')](_['pick'](_0x103e62['query'],_0x46f8a8[_0xb03d('0x42')]));_0x1c9c3d[_0xb03d('0x41')][_0xb03d('0x62')]=_0x3f902f['id'];if(_0x103e62[_0xb03d('0x39')]['filter']){_0x1c9c3d[_0xb03d('0x41')]=_[_0xb03d('0x43')](_0x1c9c3d[_0xb03d('0x41')],{'$or':_[_0xb03d('0x2c')](_0x1c9c3d[_0xb03d('0x3b')],function(_0xe5bd46){var _0x397524={};_0x397524[_0xe5bd46]={'$like':'%'+_0x103e62['query'][_0xb03d('0x2a')]+'%'};return _0x397524;})});}_0x1c9c3d=_[_0xb03d('0x43')]({},_0x1c9c3d,_0x103e62[_0xb03d('0x45')]);return db[_0xb03d('0x60')][_0xb03d('0x20')]({'where':_0x1c9c3d[_0xb03d('0x41')]})['then'](function(_0x56e70d){_0x4c4bc8[_0xb03d('0x20')]=_0x56e70d;if(_0x103e62[_0xb03d('0x39')][_0xb03d('0x4a')]){_0x1c9c3d[_0xb03d('0x47')]=[{'all':!![]}];}return db['CmHopper'][_0xb03d('0x48')](_0x1c9c3d);})[_0xb03d('0x26')](function(_0x1922d6){_0x4c4bc8['rows']=_0x1922d6;return _0x4c4bc8;});}})[_0xb03d('0x26')](respondWithFilteredResult(_0x2bd7d9,_0x1c9c3d))[_0xb03d('0x4b')](handleError(_0x2bd7d9,null));};exports[_0xb03d('0x63')]=function(_0x3e7b9e,_0x20488b,_0x4b1426){var _0x454db4={'raw':!![],'where':{}};var _0x554ed7={};var _0x2db9f2={'count':0x0,'rows':[]};return db[_0xb03d('0x46')][_0xb03d('0x64')]({'where':{'id':_0x3e7b9e['params']['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x20488b,null))[_0xb03d('0x26')](function(_0x24a94e){if(_0x24a94e){_0x554ed7[_0xb03d('0x37')]=_[_0xb03d('0x38')](db[_0xb03d('0x65')][_0xb03d('0x59')]);_0x554ed7['query']=_[_0xb03d('0x38')](_0x3e7b9e[_0xb03d('0x39')]);_0x554ed7[_0xb03d('0x42')]=_[_0xb03d('0x3a')](_0x554ed7[_0xb03d('0x37')],_0x554ed7[_0xb03d('0x39')]);_0x454db4[_0xb03d('0x3b')]=_[_0xb03d('0x3a')](_0x554ed7[_0xb03d('0x37')],qs['fields'](_0x3e7b9e['query']['fields']));_0x454db4['attributes']=_0x454db4[_0xb03d('0x3b')][_0xb03d('0x3d')]?_0x454db4[_0xb03d('0x3b')]:_0x554ed7['model'];if(!_0x3e7b9e[_0xb03d('0x39')]['hasOwnProperty'](_0xb03d('0x3f'))){_0x454db4[_0xb03d('0x21')]=qs[_0xb03d('0x21')](_0x3e7b9e['query'][_0xb03d('0x21')]);_0x454db4[_0xb03d('0x1e')]=qs[_0xb03d('0x1e')](_0x3e7b9e['query']['offset']);}_0x454db4[_0xb03d('0x40')]=qs['sort'](_0x3e7b9e[_0xb03d('0x39')][_0xb03d('0x61')]);_0x454db4[_0xb03d('0x41')]=qs[_0xb03d('0x42')](_[_0xb03d('0x66')](_0x3e7b9e[_0xb03d('0x39')],_0x554ed7['filters']));_0x454db4[_0xb03d('0x41')][_0xb03d('0x62')]=_0x24a94e['id'];if(_0x3e7b9e['query'][_0xb03d('0x2a')]){_0x454db4[_0xb03d('0x41')]=_[_0xb03d('0x43')](_0x454db4['where'],{'$or':_[_0xb03d('0x2c')](_0x454db4[_0xb03d('0x3b')],function(_0x7fd365){var _0xbe1f77={};_0xbe1f77[_0x7fd365]={'$like':'%'+_0x3e7b9e[_0xb03d('0x39')][_0xb03d('0x2a')]+'%'};return _0xbe1f77;})});}_0x454db4=_[_0xb03d('0x43')]({},_0x454db4,_0x3e7b9e[_0xb03d('0x45')]);return db[_0xb03d('0x65')]['count']({'where':_0x454db4['where']})[_0xb03d('0x26')](function(_0x184308){_0x2db9f2[_0xb03d('0x20')]=_0x184308;if(_0x3e7b9e[_0xb03d('0x39')][_0xb03d('0x4a')]){_0x454db4[_0xb03d('0x47')]=[{'all':!![]}];}return db[_0xb03d('0x65')][_0xb03d('0x48')](_0x454db4);})['then'](function(_0x480e57){_0x2db9f2['rows']=_0x480e57;return _0x2db9f2;});}})[_0xb03d('0x26')](respondWithFilteredResult(_0x20488b,_0x454db4))[_0xb03d('0x4b')](handleError(_0x20488b,null));};exports['getHopperFinals']=function(_0x12aad0,_0x4f969b,_0x17c2af){var _0x3196c1={'raw':!![],'where':{}};var _0x1b2edc={};var _0x4a0eef={'count':0x0,'rows':[]};return db[_0xb03d('0x46')]['findOne']({'where':{'id':_0x12aad0[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x4f969b,null))[_0xb03d('0x26')](function(_0x3ffb8c){if(_0x3ffb8c){_0x1b2edc[_0xb03d('0x37')]=_[_0xb03d('0x38')](db[_0xb03d('0x67')][_0xb03d('0x59')]);_0x1b2edc['query']=_[_0xb03d('0x38')](_0x12aad0[_0xb03d('0x39')]);_0x1b2edc[_0xb03d('0x42')]=_['intersection'](_0x1b2edc[_0xb03d('0x37')],_0x1b2edc[_0xb03d('0x39')]);_0x3196c1[_0xb03d('0x3b')]=_[_0xb03d('0x3a')](_0x1b2edc[_0xb03d('0x37')],qs['fields'](_0x12aad0[_0xb03d('0x39')]['fields']));_0x3196c1['attributes']=_0x3196c1[_0xb03d('0x3b')][_0xb03d('0x3d')]?_0x3196c1['attributes']:_0x1b2edc[_0xb03d('0x37')];if(!_0x12aad0[_0xb03d('0x39')][_0xb03d('0x3e')](_0xb03d('0x3f'))){_0x3196c1[_0xb03d('0x21')]=qs[_0xb03d('0x21')](_0x12aad0['query'][_0xb03d('0x21')]);_0x3196c1[_0xb03d('0x1e')]=qs['offset'](_0x12aad0[_0xb03d('0x39')][_0xb03d('0x1e')]);}_0x3196c1[_0xb03d('0x40')]=qs[_0xb03d('0x61')](_0x12aad0[_0xb03d('0x39')][_0xb03d('0x61')]);_0x3196c1['where']=qs['filters'](_[_0xb03d('0x66')](_0x12aad0['query'],_0x1b2edc[_0xb03d('0x42')]));_0x3196c1[_0xb03d('0x41')]['VoiceQueueId']=_0x3ffb8c['id'];if(_0x12aad0[_0xb03d('0x39')][_0xb03d('0x2a')]){_0x3196c1[_0xb03d('0x41')]=_[_0xb03d('0x43')](_0x3196c1['where'],{'$or':_[_0xb03d('0x2c')](_0x3196c1[_0xb03d('0x3b')],function(_0x2c6486){var _0x2c7e39={};_0x2c7e39[_0x2c6486]={'$like':'%'+_0x12aad0[_0xb03d('0x39')][_0xb03d('0x2a')]+'%'};return _0x2c7e39;})});}_0x3196c1=_['merge']({},_0x3196c1,_0x12aad0['options']);return db[_0xb03d('0x67')][_0xb03d('0x20')]({'where':_0x3196c1[_0xb03d('0x41')]})[_0xb03d('0x26')](function(_0x32e8c1){_0x4a0eef['count']=_0x32e8c1;if(_0x12aad0['query'][_0xb03d('0x4a')]){_0x3196c1[_0xb03d('0x47')]=[{'all':!![]}];}return db[_0xb03d('0x67')][_0xb03d('0x48')](_0x3196c1);})[_0xb03d('0x26')](function(_0x5db8a9){_0x4a0eef[_0xb03d('0x68')]=_0x5db8a9;return _0x4a0eef;});}})['then'](respondWithFilteredResult(_0x4f969b,_0x3196c1))[_0xb03d('0x4b')](handleError(_0x4f969b,null));};exports[_0xb03d('0x69')]=function(_0x314f79,_0x12d80a,_0x5d9d14){var _0xd1b95d={'raw':!![],'where':{}};var _0x4da6cc={};var _0x29e225={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x314f79[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x12d80a,null))['then'](function(_0x7e0e80){if(_0x7e0e80){_0x4da6cc['model']=_[_0xb03d('0x38')](db['CmHopperBlack'][_0xb03d('0x59')]);_0x4da6cc[_0xb03d('0x39')]=_[_0xb03d('0x38')](_0x314f79[_0xb03d('0x39')]);_0x4da6cc[_0xb03d('0x42')]=_[_0xb03d('0x3a')](_0x4da6cc[_0xb03d('0x37')],_0x4da6cc[_0xb03d('0x39')]);_0xd1b95d[_0xb03d('0x3b')]=_[_0xb03d('0x3a')](_0x4da6cc[_0xb03d('0x37')],qs['fields'](_0x314f79[_0xb03d('0x39')]['fields']));_0xd1b95d[_0xb03d('0x3b')]=_0xd1b95d[_0xb03d('0x3b')][_0xb03d('0x3d')]?_0xd1b95d[_0xb03d('0x3b')]:_0x4da6cc[_0xb03d('0x37')];if(!_0x314f79[_0xb03d('0x39')]['hasOwnProperty'](_0xb03d('0x3f'))){_0xd1b95d[_0xb03d('0x21')]=qs['limit'](_0x314f79[_0xb03d('0x39')][_0xb03d('0x21')]);_0xd1b95d[_0xb03d('0x1e')]=qs[_0xb03d('0x1e')](_0x314f79['query'][_0xb03d('0x1e')]);}_0xd1b95d[_0xb03d('0x40')]=qs['sort'](_0x314f79[_0xb03d('0x39')]['sort']);_0xd1b95d['where']=qs['filters'](_['pick'](_0x314f79[_0xb03d('0x39')],_0x4da6cc[_0xb03d('0x42')]));_0xd1b95d[_0xb03d('0x41')]['VoiceQueueId']=_0x7e0e80['id'];if(_0x314f79[_0xb03d('0x39')]['filter']){_0xd1b95d[_0xb03d('0x41')]=_[_0xb03d('0x43')](_0xd1b95d['where'],{'$or':_['map'](_0xd1b95d[_0xb03d('0x3b')],function(_0xade177){var _0x5256a3={};_0x5256a3[_0xade177]={'$like':'%'+_0x314f79[_0xb03d('0x39')][_0xb03d('0x2a')]+'%'};return _0x5256a3;})});}_0xd1b95d=_[_0xb03d('0x43')]({},_0xd1b95d,_0x314f79['options']);return db['CmHopperBlack'][_0xb03d('0x20')]({'where':_0xd1b95d[_0xb03d('0x41')]})[_0xb03d('0x26')](function(_0x367f7b){_0x29e225[_0xb03d('0x20')]=_0x367f7b;if(_0x314f79[_0xb03d('0x39')]['includeAll']){_0xd1b95d[_0xb03d('0x47')]=[{'all':!![]}];}return db[_0xb03d('0x6a')]['findAll'](_0xd1b95d);})[_0xb03d('0x26')](function(_0x4cce94){_0x29e225['rows']=_0x4cce94;return _0x29e225;});}})['then'](respondWithFilteredResult(_0x12d80a,_0xd1b95d))[_0xb03d('0x4b')](handleError(_0x12d80a,null));};exports[_0xb03d('0x6b')]=function(_0x31dfe3,_0x5a80e8,_0x3f2de9){var _0x476bab={};var _0x584f68={};var _0x17bcf5;var _0x38dff0;return db[_0xb03d('0x46')][_0xb03d('0x64')]({'where':{'id':_0x31dfe3['params']['id']}})['then'](handleEntityNotFound(_0x5a80e8,null))[_0xb03d('0x26')](function(_0x28c0cf){if(_0x28c0cf){_0x17bcf5=_0x28c0cf;_0x584f68[_0xb03d('0x37')]=_[_0xb03d('0x38')](db['Team'][_0xb03d('0x59')]);_0x584f68[_0xb03d('0x39')]=_[_0xb03d('0x38')](_0x31dfe3[_0xb03d('0x39')]);_0x584f68['filters']=_[_0xb03d('0x3a')](_0x584f68[_0xb03d('0x37')],_0x584f68[_0xb03d('0x39')]);_0x476bab[_0xb03d('0x3b')]=_[_0xb03d('0x3a')](_0x584f68[_0xb03d('0x37')],qs[_0xb03d('0x3c')](_0x31dfe3[_0xb03d('0x39')][_0xb03d('0x3c')]));_0x476bab[_0xb03d('0x3b')]=_0x476bab[_0xb03d('0x3b')][_0xb03d('0x3d')]?_0x476bab['attributes']:_0x584f68['model'];_0x476bab[_0xb03d('0x40')]=qs['sort'](_0x31dfe3[_0xb03d('0x39')][_0xb03d('0x61')]);_0x476bab[_0xb03d('0x41')]=qs[_0xb03d('0x42')](_[_0xb03d('0x66')](_0x31dfe3[_0xb03d('0x39')],_0x584f68[_0xb03d('0x42')]));if(_0x31dfe3[_0xb03d('0x39')]['filter']){_0x476bab[_0xb03d('0x41')]=_[_0xb03d('0x43')](_0x476bab[_0xb03d('0x41')],{'$or':_[_0xb03d('0x2c')](_0x476bab['attributes'],function(_0x17c69b){var _0x501c67={};_0x501c67[_0x17c69b]={'$like':'%'+_0x31dfe3['query'][_0xb03d('0x2a')]+'%'};return _0x501c67;})});}_0x476bab=_[_0xb03d('0x43')]({},_0x476bab,_0x31dfe3['options']);return _0x17bcf5[_0xb03d('0x6b')](_0x476bab);}})[_0xb03d('0x26')](function(_0x293db8){if(_0x293db8){_0x38dff0=_0x293db8[_0xb03d('0x3d')];if(!_0x31dfe3['query']['hasOwnProperty']('nolimit')){_0x476bab[_0xb03d('0x21')]=qs['limit'](_0x31dfe3[_0xb03d('0x39')][_0xb03d('0x21')]);_0x476bab[_0xb03d('0x1e')]=qs['offset'](_0x31dfe3['query'][_0xb03d('0x1e')]);}return _0x17bcf5[_0xb03d('0x6b')](_0x476bab);}})[_0xb03d('0x26')](function(_0x35fc9e){if(_0x35fc9e){return _0x35fc9e?{'count':_0x38dff0,'rows':_0x35fc9e}:null;}})[_0xb03d('0x26')](respondWithResult(_0x5a80e8,null))['catch'](handleError(_0x5a80e8,null));};exports[_0xb03d('0x6c')]=function(_0x5410de,_0x1b48ae,_0x8f0d58){var _0x19e997=_0x5410de['body'][_0xb03d('0x6d')];var _0x440f4a=_[_0xb03d('0x2c')](_0x19e997,'id');return db[_0xb03d('0x6e')][_0xb03d('0x48')]({'where':{'id':_0x440f4a},'attributes':['id'],'include':[{'model':db[_0xb03d('0x6f')],'as':_0xb03d('0x70'),'attributes':['id',_0xb03d('0x31'),_0xb03d('0x71'),'voicePause',_0xb03d('0x72')],'raw':!![]}]})[_0xb03d('0x26')](function(_0x51ca9e){if(_0x51ca9e){var _0x514b83=_[_0xb03d('0x73')](_0x51ca9e,function(_0x1d3eac){var _0x3995bf=_0x1d3eac[_0xb03d('0x4d')]({'plain':!![]});_0x3995bf[_0xb03d('0x70')]['forEach'](function(_0xa39703){_0xa39703[_0xb03d('0x74')]=_[_0xb03d('0x30')](_0x19e997,{'id':_0x3995bf['id']})['penalty'];});return _0x3995bf[_0xb03d('0x70')];});return db[_0xb03d('0x46')][_0xb03d('0x30')]({'where':{'id':_0x5410de[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](function(_0x24b634){return db[_0xb03d('0x75')][_0xb03d('0x76')](function(_0x2c032c){return _0x24b634[_0xb03d('0x6c')](_0x440f4a,{'transaction':_0x2c032c})[_0xb03d('0x26')](function(){return BPromise[_0xb03d('0x77')](_0x19e997,function(_0x388764){return db[_0xb03d('0x78')][_0xb03d('0x79')]({'TeamId':_0x388764['id'],'VoiceQueueId':_0x5410de[_0xb03d('0x58')]['id'],'penalty':_0x388764[_0xb03d('0x74')]},{'transaction':_0x2c032c});});})[_0xb03d('0x26')](function(){return BPromise[_0xb03d('0x77')](_0x514b83,function(_0x331385){return db[_0xb03d('0x7a')]['findOrCreate']({'where':{'UserId':_0x331385['id'],'VoiceQueueId':_0x5410de[_0xb03d('0x58')]['id']},'defaults':{'penalty':_0x331385[_0xb03d('0x74')]},'transaction':_0x2c032c});});})[_0xb03d('0x26')](function(){return BPromise[_0xb03d('0x77')](_[_0xb03d('0x2a')](_0x514b83,{'online':!![]}),function(_0x5635d5){return db[_0xb03d('0x7b')]['upsert']({'membername':_0x5635d5[_0xb03d('0x31')],'UserId':_0x5635d5['id'],'queue_name':_0x24b634[_0xb03d('0x31')],'VoiceQueueId':_0x24b634['id'],'interface':_['isNil'](_0x5635d5[_0xb03d('0x72')])?util[_0xb03d('0x7c')]('SIP/%s',_0x5635d5[_0xb03d('0x31')]):_0x5635d5['interface'],'paused':_0x5635d5['voicePause']||![],'penalty':_0x5635d5[_0xb03d('0x74')]},{'transaction':_0x2c032c});});})[_0xb03d('0x26')](function(){_0x514b83[_0xb03d('0x7d')](function(_0x2e07a5){socket['emit'](_0xb03d('0x7e'),{'UserId':_0x2e07a5['id'],'VoiceQueueId':_0x24b634['id']});});});});});}})[_0xb03d('0x26')](respondWithStatusCode(_0x1b48ae,null))['catch'](handleError(_0x1b48ae,null));};exports[_0xb03d('0x7f')]=function(_0x1c547f,_0xaa254c,_0x128cb8){return db[_0xb03d('0x6e')][_0xb03d('0x48')]({'where':{'id':_0x1c547f[_0xb03d('0x39')][_0xb03d('0x80')]},'attributes':['id'],'include':[{'model':db[_0xb03d('0x6f')],'as':_0xb03d('0x70'),'attributes':['id'],'raw':!![]}]})[_0xb03d('0x26')](handleEntityNotFound(_0xaa254c,null))[_0xb03d('0x26')](function(_0x446eb0){var _0x2c020d=_[_0xb03d('0x2c')](_0x446eb0,'id');var _0x53a43c=[];var _0x3fec23=[];var _0x2d1ee0=squel['select']();_0x2d1ee0[_0xb03d('0x81')](_0xb03d('0x82'))[_0xb03d('0x83')]('team_has_voice_queues','tq')['join'](_0xb03d('0x84'),'ut',_0xb03d('0x85'))[_0xb03d('0x41')](_0xb03d('0x86'),_0x1c547f[_0xb03d('0x58')]['id']);for(var _0x18d051=0x0;_0x18d051<_0x446eb0[_0xb03d('0x3d')];_0x18d051+=0x1){let _0x22a83c=_0x446eb0[_0x18d051];for(var _0x63a1a8=0x0;_0x63a1a8<_0x22a83c[_0xb03d('0x70')][_0xb03d('0x3d')];_0x63a1a8+=0x1){let _0x2babed=_0x22a83c['Agents'][_0x63a1a8];var _0x726c89=_0x2d1ee0['clone']();_0x726c89[_0xb03d('0x41')](_0xb03d('0x87'),_0x2babed['id']);_0x3fec23[_0xb03d('0x88')](db['sequelize'][_0xb03d('0x39')](_0x726c89[_0xb03d('0x89')](),{'type':db[_0xb03d('0x75')][_0xb03d('0x8a')][_0xb03d('0x8b')]})[_0xb03d('0x26')](function(_0x25d3cd){if(_0x25d3cd['length']===0x1){return _0x2babed['id'];}else{var _0x3348cd=_['every'](_[_0xb03d('0x2c')](_0x25d3cd,_0xb03d('0x8c')),function(_0x5afc50){return _['includes'](_0x2c020d,_0x5afc50);});if(_0x3348cd){return _0x2babed['id'];}}}));}}return BPromise[_0xb03d('0x8d')](_0x3fec23)['then'](function(_0x4bafc4){_0x53a43c=_(_0x53a43c)[_0xb03d('0x8e')](_0x4bafc4)[_0xb03d('0x8f')]()[_0xb03d('0x2d')]();return db[_0xb03d('0x46')][_0xb03d('0x30')]({'where':{'id':_0x1c547f['params']['id']}})[_0xb03d('0x26')](function(_0x49940f){return db[_0xb03d('0x75')][_0xb03d('0x76')](function(_0xc56f1c){return _0x49940f[_0xb03d('0x7f')](_0x1c547f[_0xb03d('0x39')][_0xb03d('0x80')],{'transaction':_0xc56f1c})[_0xb03d('0x26')](function(){if(!_[_0xb03d('0x90')](_0x53a43c)){return _0x49940f[_0xb03d('0x91')](_0x53a43c,{'transaction':_0xc56f1c})[_0xb03d('0x26')](function(){return db[_0xb03d('0x7b')][_0xb03d('0x27')]({'where':{'VoiceQueueId':_0x1c547f['params']['id'],'UserId':_0x53a43c},'transaction':_0xc56f1c});});}})[_0xb03d('0x26')](function(){_0x53a43c['forEach'](function(_0x42153a){socket[_0xb03d('0x92')](_0xb03d('0x93'),{'UserId':_0x42153a,'VoiceQueueId':_0x49940f['id']});});});});});});})[_0xb03d('0x26')](respondWithStatusCode(_0xaa254c,null))[_0xb03d('0x4b')](handleError(_0xaa254c,null));};exports[_0xb03d('0x94')]=function(_0x2abdf4,_0x3d3022,_0x46e2b9){var _0x90a4ba,_0x53a350;return db['VoiceQueue'][_0xb03d('0x30')]({'where':{'id':_0x2abdf4['params']['id']}})['then'](handleEntityNotFound(_0x3d3022,null))[_0xb03d('0x26')](function(_0x54f262){if(_0x54f262){_0x53a350=_0x54f262;return _0x54f262['addAgents'](_0x2abdf4[_0xb03d('0x5d')]['ids'],_[_0xb03d('0x5a')](_0x2abdf4['body'],[_0xb03d('0x80'),'id'])||{})[_0xb03d('0x95')](function(_0x8fb6b2){for(var _0x35e1d0=0x0;_0x35e1d0<_0x2abdf4['body'][_0xb03d('0x80')][_0xb03d('0x3d')];_0x35e1d0+=0x1){socket[_0xb03d('0x92')]('userVoiceQueue:save',{'UserId':Number(_0x2abdf4[_0xb03d('0x5d')]['ids'][_0x35e1d0]),'VoiceQueueId':Number(_0x2abdf4[_0xb03d('0x58')]['id'])});}return _0x8fb6b2;});}})[_0xb03d('0x26')](function(_0x260888){_0x90a4ba=_0x260888||[];if(_0x53a350){return db['User'][_0xb03d('0x48')]({'where':{'id':_0x2abdf4['body'][_0xb03d('0x80')]},'attributes':['id',_0xb03d('0x31'),_0xb03d('0x71'),_0xb03d('0x96'),_0xb03d('0x72')],'raw':!![]});}})[_0xb03d('0x26')](function(_0x2b0d6a){if(!_[_0xb03d('0x90')](_0x2b0d6a)){var _0x2244d4=[];for(var _0x13e963=0x0;_0x13e963<_0x2b0d6a['length'];_0x13e963++){if(_0x2b0d6a[_0x13e963][_0xb03d('0x71')]){_0x2244d4['push'](db[_0xb03d('0x7b')]['upsert']({'membername':_0x2b0d6a[_0x13e963][_0xb03d('0x31')],'UserId':_0x2b0d6a[_0x13e963]['id'],'queue_name':_0x53a350[_0xb03d('0x31')],'VoiceQueueId':_0x53a350['id'],'interface':_['isNil'](_0x2b0d6a[_0x13e963][_0xb03d('0x72')])?util[_0xb03d('0x7c')]('SIP/%s',_0x2b0d6a[_0x13e963][_0xb03d('0x31')]):_0x2b0d6a[_0x13e963][_0xb03d('0x72')],'paused':_0x2b0d6a[_0x13e963]['voicePause']||![],'penalty':_0x2abdf4[_0xb03d('0x5d')][_0xb03d('0x74')]||0x0}));}}return BPromise['all'](_0x2244d4);}})[_0xb03d('0x26')](function(){return _0x90a4ba;})[_0xb03d('0x26')](respondWithResult(_0x3d3022,null))['catch'](handleError(_0x3d3022,null));};exports[_0xb03d('0x91')]=function(_0x808379,_0x219205,_0x8ffd57){return db[_0xb03d('0x46')]['find']({'where':{'id':_0x808379[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x219205,null))[_0xb03d('0x26')](function(_0x4eaa86){if(_0x4eaa86){return _0x4eaa86[_0xb03d('0x91')](_0x808379['query'][_0xb03d('0x80')])['then'](function(){if(_[_0xb03d('0x97')](_0x808379['query'][_0xb03d('0x80')])){for(var _0x5dbba2=0x0;_0x5dbba2<_0x808379[_0xb03d('0x39')]['ids'][_0xb03d('0x3d')];_0x5dbba2+=0x1){socket[_0xb03d('0x92')](_0xb03d('0x93'),{'UserId':Number(_0x808379['query']['ids'][_0x5dbba2]),'VoiceQueueId':Number(_0x808379[_0xb03d('0x58')]['id'])});}}else{socket[_0xb03d('0x92')](_0xb03d('0x93'),{'UserId':Number(_0x808379['query'][_0xb03d('0x80')]),'VoiceQueueId':Number(_0x808379[_0xb03d('0x58')]['id'])});}});}})['then'](function(_0x4b8b11){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x808379[_0xb03d('0x58')]['id'],'UserId':_0x808379[_0xb03d('0x39')][_0xb03d('0x80')]}})[_0xb03d('0x26')](function(){return _0x4b8b11;});})[_0xb03d('0x26')](respondWithStatusCode(_0x219205,null))[_0xb03d('0x4b')](handleError(_0x219205,null));};exports['getAgents']=function(_0x3f7e21,_0x353486,_0x4d05bb){var _0x58d851={};var _0x50acfe={};var _0xce324a;var _0x36391d;return db['VoiceQueue']['findOne']({'where':{'id':_0x3f7e21[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x353486,null))[_0xb03d('0x26')](function(_0x805d37){if(_0x805d37){_0xce324a=_0x805d37;_0x50acfe[_0xb03d('0x37')]=_['keys'](db['User'][_0xb03d('0x59')]);_0x50acfe['query']=_['keys'](_0x3f7e21[_0xb03d('0x39')]);_0x50acfe['filters']=_['intersection'](_0x50acfe[_0xb03d('0x37')],_0x50acfe[_0xb03d('0x39')]);_0x58d851[_0xb03d('0x3b')]=_[_0xb03d('0x3a')](_0x50acfe[_0xb03d('0x37')],qs['fields'](_0x3f7e21[_0xb03d('0x39')][_0xb03d('0x3c')]));_0x58d851[_0xb03d('0x3b')]=_0x58d851[_0xb03d('0x3b')][_0xb03d('0x3d')]?_0x58d851[_0xb03d('0x3b')]:_0x50acfe[_0xb03d('0x37')];_0x58d851['order']=qs[_0xb03d('0x61')](_0x3f7e21[_0xb03d('0x39')][_0xb03d('0x61')]);_0x58d851['where']=qs[_0xb03d('0x42')](_[_0xb03d('0x66')](_0x3f7e21[_0xb03d('0x39')],_0x50acfe[_0xb03d('0x42')]));if(_0x3f7e21[_0xb03d('0x39')][_0xb03d('0x2a')]){_0x58d851[_0xb03d('0x41')]=_[_0xb03d('0x43')](_0x58d851[_0xb03d('0x41')],{'$or':_['map'](_0x58d851[_0xb03d('0x3b')],function(_0x34b911){var _0x18ccb0={};_0x18ccb0[_0x34b911]={'$like':'%'+_0x3f7e21[_0xb03d('0x39')][_0xb03d('0x2a')]+'%'};return _0x18ccb0;})});}_0x58d851=_[_0xb03d('0x43')]({},_0x58d851,_0x3f7e21[_0xb03d('0x45')]);return _0xce324a[_0xb03d('0x98')](_0x58d851);}})['then'](function(_0x535957){if(_0x535957){_0x36391d=_0x535957[_0xb03d('0x3d')];if(!_0x3f7e21[_0xb03d('0x39')][_0xb03d('0x3e')](_0xb03d('0x3f'))){_0x58d851['limit']=qs['limit'](_0x3f7e21['query'][_0xb03d('0x21')]);_0x58d851[_0xb03d('0x1e')]=qs[_0xb03d('0x1e')](_0x3f7e21[_0xb03d('0x39')][_0xb03d('0x1e')]);}return _0xce324a['getAgents'](_0x58d851);}})[_0xb03d('0x26')](function(_0x12c790){if(_0x12c790){return _0x12c790?{'count':_0x36391d,'rows':_0x12c790}:null;}})[_0xb03d('0x26')](respondWithResult(_0x353486,null))[_0xb03d('0x4b')](handleError(_0x353486,null));};exports[_0xb03d('0x99')]=function(_0x462112,_0xe4897d,_0x3d24ff){var _0x514e50={};var _0x2cd8d4={};var _0x2fbbf5;var _0x87098c;return db[_0xb03d('0x46')][_0xb03d('0x64')]({'where':{'id':_0x462112[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0xe4897d,null))[_0xb03d('0x26')](function(_0x4cf7c9){if(_0x4cf7c9){_0x2fbbf5=_0x4cf7c9;_0x2cd8d4[_0xb03d('0x37')]=_[_0xb03d('0x38')](db[_0xb03d('0x7b')][_0xb03d('0x59')]);_0x2cd8d4[_0xb03d('0x39')]=_[_0xb03d('0x38')](_0x462112[_0xb03d('0x39')]);_0x2cd8d4[_0xb03d('0x42')]=_['intersection'](_0x2cd8d4[_0xb03d('0x37')],_0x2cd8d4[_0xb03d('0x39')]);_0x514e50['attributes']=_[_0xb03d('0x3a')](_0x2cd8d4[_0xb03d('0x37')],qs[_0xb03d('0x3c')](_0x462112[_0xb03d('0x39')][_0xb03d('0x3c')]));_0x514e50[_0xb03d('0x3b')]=_0x514e50[_0xb03d('0x3b')][_0xb03d('0x3d')]?_0x514e50[_0xb03d('0x3b')]:_0x2cd8d4[_0xb03d('0x37')];_0x514e50[_0xb03d('0x40')]=qs[_0xb03d('0x61')](_0x462112[_0xb03d('0x39')][_0xb03d('0x61')]);_0x514e50[_0xb03d('0x41')]=qs[_0xb03d('0x42')](_[_0xb03d('0x66')](_0x462112[_0xb03d('0x39')],_0x2cd8d4[_0xb03d('0x42')]));if(_0x462112[_0xb03d('0x39')][_0xb03d('0x2a')]){_0x514e50[_0xb03d('0x41')]=_['merge'](_0x514e50[_0xb03d('0x41')],{'$or':_['map'](_0x514e50['attributes'],function(_0x369ef6){var _0x32e8f9={};_0x32e8f9[_0x369ef6]={'$like':'%'+_0x462112[_0xb03d('0x39')][_0xb03d('0x2a')]+'%'};return _0x32e8f9;})});}_0x514e50=_[_0xb03d('0x43')]({},_0x514e50,_0x462112[_0xb03d('0x45')]);return _0x2fbbf5[_0xb03d('0x99')](_0x514e50);}})[_0xb03d('0x26')](function(_0xe1dce2){if(_0xe1dce2){_0x87098c=_0xe1dce2[_0xb03d('0x3d')];if(!_0x462112[_0xb03d('0x39')][_0xb03d('0x3e')](_0xb03d('0x3f'))){_0x514e50[_0xb03d('0x21')]=qs[_0xb03d('0x21')](_0x462112[_0xb03d('0x39')]['limit']);_0x514e50[_0xb03d('0x1e')]=qs['offset'](_0x462112[_0xb03d('0x39')]['offset']);}return _0x2fbbf5[_0xb03d('0x99')](_0x514e50);}})[_0xb03d('0x26')](function(_0xde01a9){return _0xde01a9?{'count':_0x87098c,'rows':_0xde01a9}:null;})[_0xb03d('0x26')](respondWithResult(_0xe4897d,null))[_0xb03d('0x4b')](handleError(_0xe4897d,null));};exports[_0xb03d('0x9a')]=function(_0x4b4437,_0xb30a7a,_0x409b0d){var _0x3f66d9={};var _0x1c2d9f={};var _0x338a14;var _0x31ecdd;return db[_0xb03d('0x46')][_0xb03d('0x64')]({'where':{'id':_0x4b4437[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0xb30a7a,null))['then'](function(_0x376e6b){if(_0x376e6b){_0x338a14=_0x376e6b;_0x1c2d9f['model']=_['keys'](db[_0xb03d('0x9b')][_0xb03d('0x59')]);_0x1c2d9f[_0xb03d('0x39')]=_[_0xb03d('0x38')](_0x4b4437[_0xb03d('0x39')]);_0x1c2d9f['filters']=_['intersection'](_0x1c2d9f[_0xb03d('0x37')],_0x1c2d9f[_0xb03d('0x39')]);_0x3f66d9[_0xb03d('0x3b')]=_[_0xb03d('0x3a')](_0x1c2d9f[_0xb03d('0x37')],qs['fields'](_0x4b4437[_0xb03d('0x39')][_0xb03d('0x3c')]));_0x3f66d9['attributes']=_0x3f66d9['attributes'][_0xb03d('0x3d')]?_0x3f66d9['attributes']:_0x1c2d9f[_0xb03d('0x37')];_0x3f66d9[_0xb03d('0x40')]=qs['sort'](_0x4b4437[_0xb03d('0x39')][_0xb03d('0x61')]);_0x3f66d9['where']=qs[_0xb03d('0x42')](_[_0xb03d('0x66')](_0x4b4437[_0xb03d('0x39')],_0x1c2d9f[_0xb03d('0x42')]));if(_0x4b4437[_0xb03d('0x39')][_0xb03d('0x2a')]){_0x3f66d9['where']=_[_0xb03d('0x43')](_0x3f66d9[_0xb03d('0x41')],{'$or':_[_0xb03d('0x2c')](_0x3f66d9[_0xb03d('0x3b')],function(_0x46e9bb){var _0x149f7d={};_0x149f7d[_0x46e9bb]={'$like':'%'+_0x4b4437[_0xb03d('0x39')][_0xb03d('0x2a')]+'%'};return _0x149f7d;})});}_0x3f66d9=_[_0xb03d('0x43')]({},_0x3f66d9,_0x4b4437[_0xb03d('0x45')]);return _0x338a14['getLists'](_0x3f66d9);}})[_0xb03d('0x26')](function(_0x1dd1df){if(_0x1dd1df){_0x31ecdd=_0x1dd1df[_0xb03d('0x3d')];if(!_0x4b4437[_0xb03d('0x39')][_0xb03d('0x3e')](_0xb03d('0x3f'))){_0x3f66d9[_0xb03d('0x21')]=qs[_0xb03d('0x21')](_0x4b4437[_0xb03d('0x39')][_0xb03d('0x21')]);_0x3f66d9[_0xb03d('0x1e')]=qs[_0xb03d('0x1e')](_0x4b4437[_0xb03d('0x39')][_0xb03d('0x1e')]);}return _0x338a14[_0xb03d('0x9a')](_0x3f66d9);}})['then'](function(_0x317808){if(_0x317808){return _0x317808?{'count':_0x31ecdd,'rows':_0x317808}:null;}})[_0xb03d('0x26')](respondWithResult(_0xb30a7a,null))[_0xb03d('0x4b')](handleError(_0xb30a7a,null));};exports[_0xb03d('0x9c')]=function(_0x654b40,_0x2e434c,_0x28505f){var _0x1a76e2=moment()[_0xb03d('0x7c')](_0xb03d('0x9d'));var _0xec9802,_0x198a45;return db[_0xb03d('0x46')][_0xb03d('0x30')]({'where':{'id':_0x654b40[_0xb03d('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e434c,null))[_0xb03d('0x26')](function(_0x1f2420){if(_0x1f2420){_0x198a45=_0x1f2420;return _0x1f2420[_0xb03d('0x9c')](_0x654b40[_0xb03d('0x5d')]['ids'],_[_0xb03d('0x5a')](_0x654b40[_0xb03d('0x5d')],['ids','id'])||{});}return null;})[_0xb03d('0x95')](function(_0x596ca3){var _0x53bca5;_0xec9802=_0x596ca3||[];var _0x2b8a73=[];if(_0x596ca3){for(var _0x176ba2=0x0;_0x176ba2<_0x596ca3[_0xb03d('0x3d')];_0x176ba2+=0x1){var _0x44346d=_0x596ca3[_0x176ba2][_0xb03d('0x4d')]({'plain':!![]});_0x198a45[_0xb03d('0x9e')]=_0x654b40['body']['dialCheckDuplicateType']?_0x654b40['body'][_0xb03d('0x9e')]:_0x198a45[_0xb03d('0x9e')];switch(_0x198a45[_0xb03d('0x9e')]){case _0xb03d('0x9f'):_0x53bca5=squel['insert']()[_0xb03d('0xa0')]('cm_hopper')[_0xb03d('0xa1')]([_0xb03d('0xa2'),_0xb03d('0xa3'),_0xb03d('0xa4'),_0xb03d('0xa5'),_0xb03d('0x62'),_0xb03d('0x5b'),_0xb03d('0x5c')],squel[_0xb03d('0xa6')]()[_0xb03d('0x81')]('phone','phone')[_0xb03d('0x81')]('\x27'+_0x1a76e2+'\x27',_0xb03d('0xa3'))[_0xb03d('0x81')]('id',_0xb03d('0xa4'))[_0xb03d('0x81')](_0x44346d['CmListId'][_0xb03d('0x89')](),_0xb03d('0xa5'))[_0xb03d('0x81')](_0x654b40[_0xb03d('0x58')]['id'][_0xb03d('0x89')](),_0xb03d('0x62'))['field']('\x27'+_0x1a76e2+'\x27',_0xb03d('0x5b'))['field']('\x27'+_0x1a76e2+'\x27',_0xb03d('0x5c'))['from'](_0xb03d('0xa7'))[_0xb03d('0x41')]('deletedAt\x20IS\x20NULL')[_0xb03d('0x41')](_0xb03d('0xa8'),_0x44346d[_0xb03d('0xa9')][_0xb03d('0x89')]())[_0xb03d('0x41')](_0xb03d('0xaa'))[_0xb03d('0x41')](_0xb03d('0xab'),squel['select']()[_0xb03d('0x81')](_0xb03d('0xac'))['from'](_0xb03d('0xad'))[_0xb03d('0x41')]('VoiceQueueId\x20=\x20?',_0x654b40[_0xb03d('0x58')]['id']['toString']()))[_0xb03d('0x41')](_0xb03d('0xab'),squel[_0xb03d('0xa6')]()[_0xb03d('0x81')](_0xb03d('0xae'))[_0xb03d('0x83')](_0xb03d('0xaf'))[_0xb03d('0x41')]('VoiceQueueId\x20=\x20?',_0x654b40[_0xb03d('0x58')]['id'][_0xb03d('0x89')]())))[_0xb03d('0x89')]();break;case'onlyIfOpen':_0x53bca5=squel[_0xb03d('0xb0')]()[_0xb03d('0xa0')](_0xb03d('0xaf'))[_0xb03d('0xa1')](['phone','scheduledAt','ContactId',_0xb03d('0xa5'),_0xb03d('0x62'),_0xb03d('0x5b'),_0xb03d('0x5c')],squel[_0xb03d('0xa6')]()[_0xb03d('0x81')](_0xb03d('0xa2'),_0xb03d('0xa2'))[_0xb03d('0x81')]('\x27'+_0x1a76e2+'\x27','scheduledAt')[_0xb03d('0x81')]('id',_0xb03d('0xa4'))[_0xb03d('0x81')](_0x44346d[_0xb03d('0xa9')][_0xb03d('0x89')](),_0xb03d('0xa5'))['field'](_0x654b40['params']['id'][_0xb03d('0x89')](),_0xb03d('0x62'))['field']('\x27'+_0x1a76e2+'\x27',_0xb03d('0x5b'))['field']('\x27'+_0x1a76e2+'\x27',_0xb03d('0x5c'))[_0xb03d('0x83')](_0xb03d('0xa7'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xb03d('0xa8'),_0x44346d[_0xb03d('0xa9')][_0xb03d('0x89')]())[_0xb03d('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0xb03d('0x41')](_0xb03d('0xab'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb03d('0x83')]('cm_hopper')[_0xb03d('0x41')](_0xb03d('0x86'),_0x654b40[_0xb03d('0x58')]['id'][_0xb03d('0x89')]())))[_0xb03d('0x89')]();break;default:_0x53bca5=squel[_0xb03d('0xb0')]()['into']('cm_hopper')['fromQuery']([_0xb03d('0xa2'),'scheduledAt','ContactId',_0xb03d('0xa5'),'VoiceQueueId',_0xb03d('0x5b'),_0xb03d('0x5c')],squel[_0xb03d('0xa6')]()[_0xb03d('0x81')](_0xb03d('0xa2'),'phone')[_0xb03d('0x81')]('\x27'+_0x1a76e2+'\x27',_0xb03d('0xa3'))[_0xb03d('0x81')]('id','ContactId')[_0xb03d('0x81')](_0x44346d[_0xb03d('0xa9')][_0xb03d('0x89')](),_0xb03d('0xa5'))[_0xb03d('0x81')](_0x654b40[_0xb03d('0x58')]['id'][_0xb03d('0x89')](),_0xb03d('0x62'))[_0xb03d('0x81')]('\x27'+_0x1a76e2+'\x27','createdAt')[_0xb03d('0x81')]('\x27'+_0x1a76e2+'\x27',_0xb03d('0x5c'))['from'](_0xb03d('0xa7'))[_0xb03d('0x41')](_0xb03d('0xb1'))['where']('ListId\x20=\x20?',_0x44346d[_0xb03d('0xa9')][_0xb03d('0x89')]())['where'](_0xb03d('0xaa')))[_0xb03d('0x89')]();}_0x2b8a73[_0xb03d('0x88')](db[_0xb03d('0x75')][_0xb03d('0x39')](_0x53bca5));}return BPromise[_0xb03d('0x8d')](_0x2b8a73);}})[_0xb03d('0x26')](function(){var _0xe5010c=[];var _0x1fff64=squel[_0xb03d('0xb0')]()[_0xb03d('0xa0')](_0xb03d('0xb2'))[_0xb03d('0xa1')](['CmHopperId',_0xb03d('0xa2'),_0xb03d('0xb3'),'createdAt','updatedAt'],squel['select']()[_0xb03d('0x81')](_0xb03d('0xb4'))['field'](_0xb03d('0xb5'))['field'](_0xb03d('0xb6'))[_0xb03d('0x81')]('\x27'+_0x1a76e2+'\x27',_0xb03d('0x5b'))['field']('\x27'+_0x1a76e2+'\x27','updatedAt')[_0xb03d('0x83')](_0xb03d('0xb7'),'ci')[_0xb03d('0xb8')](_0xb03d('0xaf'),'h','h.ContactId=ci.CmContactId')[_0xb03d('0x41')]('h.scheduledat=?',_0x1a76e2)['where'](_0xb03d('0xb9'),_0xb03d('0xba')))[_0xb03d('0x89')]();_0xe5010c['push'](db[_0xb03d('0x75')][_0xb03d('0x39')](_0x1fff64));return BPromise[_0xb03d('0x8d')](_0xe5010c);})[_0xb03d('0x26')](function(){return _0xec9802;})[_0xb03d('0x26')](respondWithResult(_0x2e434c,null))['catch'](handleError(_0x2e434c,null));};exports[_0xb03d('0xbb')]=function(_0xb676a,_0x1d94ab,_0x5ef171){return db[_0xb03d('0x46')][_0xb03d('0x30')]({'where':{'id':_0xb676a[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x1d94ab,null))[_0xb03d('0x26')](function(_0x556fba){if(_0x556fba){return _0x556fba[_0xb03d('0xbb')](_0xb676a[_0xb03d('0x39')]['ids']);}})[_0xb03d('0x26')](function(_0x30bd33){if(_0x30bd33){return db[_0xb03d('0x60')][_0xb03d('0x27')]({'where':{'ListId':_0xb676a[_0xb03d('0x39')]['ids'],'VoiceQueueId':_0xb676a['params']['id']}})[_0xb03d('0x26')](function(){return _0x30bd33;});}})[_0xb03d('0x26')](respondWithStatusCode(_0x1d94ab,null))[_0xb03d('0x4b')](handleError(_0x1d94ab,null));};exports['getBlackLists']=function(_0x2280df,_0x13ff29,_0x5dc243){var _0x56c2db={};var _0x135e69={};var _0x9816bf;var _0x49b2a8;return db[_0xb03d('0x46')][_0xb03d('0x64')]({'where':{'id':_0x2280df['params']['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x13ff29,null))[_0xb03d('0x26')](function(_0x4b0813){if(_0x4b0813){_0x9816bf=_0x4b0813;_0x135e69[_0xb03d('0x37')]=_[_0xb03d('0x38')](db[_0xb03d('0x9b')]['rawAttributes']);_0x135e69['query']=_[_0xb03d('0x38')](_0x2280df['query']);_0x135e69[_0xb03d('0x42')]=_[_0xb03d('0x3a')](_0x135e69['model'],_0x135e69[_0xb03d('0x39')]);_0x56c2db[_0xb03d('0x3b')]=_[_0xb03d('0x3a')](_0x135e69[_0xb03d('0x37')],qs[_0xb03d('0x3c')](_0x2280df[_0xb03d('0x39')][_0xb03d('0x3c')]));_0x56c2db[_0xb03d('0x3b')]=_0x56c2db[_0xb03d('0x3b')][_0xb03d('0x3d')]?_0x56c2db[_0xb03d('0x3b')]:_0x135e69['model'];_0x56c2db['order']=qs[_0xb03d('0x61')](_0x2280df[_0xb03d('0x39')][_0xb03d('0x61')]);_0x56c2db[_0xb03d('0x41')]=qs[_0xb03d('0x42')](_['pick'](_0x2280df['query'],_0x135e69['filters']));if(_0x2280df[_0xb03d('0x39')][_0xb03d('0x2a')]){_0x56c2db[_0xb03d('0x41')]=_['merge'](_0x56c2db['where'],{'$or':_[_0xb03d('0x2c')](_0x56c2db[_0xb03d('0x3b')],function(_0x51281e){var _0x30b270={};_0x30b270[_0x51281e]={'$like':'%'+_0x2280df[_0xb03d('0x39')]['filter']+'%'};return _0x30b270;})});}_0x56c2db=_['merge']({},_0x56c2db,_0x2280df['options']);return _0x9816bf['getBlackLists'](_0x56c2db);}})[_0xb03d('0x26')](function(_0x20b959){if(_0x20b959){_0x49b2a8=_0x20b959[_0xb03d('0x3d')];if(!_0x2280df['query'][_0xb03d('0x3e')](_0xb03d('0x3f'))){_0x56c2db[_0xb03d('0x21')]=qs[_0xb03d('0x21')](_0x2280df[_0xb03d('0x39')]['limit']);_0x56c2db[_0xb03d('0x1e')]=qs[_0xb03d('0x1e')](_0x2280df[_0xb03d('0x39')][_0xb03d('0x1e')]);}return _0x9816bf[_0xb03d('0xbc')](_0x56c2db);}})[_0xb03d('0x26')](function(_0xeb9f6){if(_0xeb9f6){return _0xeb9f6?{'count':_0x49b2a8,'rows':_0xeb9f6}:null;}})[_0xb03d('0x26')](respondWithResult(_0x13ff29,null))[_0xb03d('0x4b')](handleError(_0x13ff29,null));};exports[_0xb03d('0xbd')]=function(_0x5eccbf,_0x447c89,_0x1cdbb9){var _0x523f0a,_0x4d24b4;return db[_0xb03d('0x46')]['find']({'where':{'id':_0x5eccbf[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x447c89,null))['then'](function(_0xbba66c){if(_0xbba66c){_0x4d24b4=_0xbba66c;return _0xbba66c[_0xb03d('0xbd')](_0x5eccbf['body'][_0xb03d('0x80')],_[_0xb03d('0x5a')](_0x5eccbf['body'],['ids','id'])||{});}return null;})[_0xb03d('0x95')](function(_0x12e2bb){var _0x3a879e;_0x523f0a=_0x12e2bb||[];var _0x17f2e9=[];if(_0x12e2bb){for(var _0x5ced5d=0x0;_0x5ced5d<_0x12e2bb[_0xb03d('0x3d')];_0x5ced5d+=0x1){var _0x2bd077=_0x12e2bb[_0x5ced5d][_0xb03d('0x4d')]({'plain':!![]});_0x3a879e=squel[_0xb03d('0xb0')]()[_0xb03d('0xa0')](_0xb03d('0xbe'))[_0xb03d('0xa1')]([_0xb03d('0xa2'),_0xb03d('0xa4'),'ListId',_0xb03d('0x62'),_0xb03d('0x5b'),'updatedAt'],squel['select']()[_0xb03d('0x81')](_0xb03d('0xa2'),_0xb03d('0xa2'))[_0xb03d('0x81')]('id',_0xb03d('0xa4'))[_0xb03d('0x81')](_0x2bd077[_0xb03d('0xa9')][_0xb03d('0x89')](),_0xb03d('0xa5'))[_0xb03d('0x81')](_0x5eccbf['params']['id'][_0xb03d('0x89')](),_0xb03d('0x62'))[_0xb03d('0x81')](_0xb03d('0xbf'),_0xb03d('0x5b'))[_0xb03d('0x81')](_0xb03d('0xbf'),'updatedAt')['from'](_0xb03d('0xa7'))['where'](_0xb03d('0xb1'))['where']('ListId\x20=\x20?',_0x2bd077['CmListId']['toString']())[_0xb03d('0x41')](_0xb03d('0xaa')))['toString']();_0x17f2e9['push'](db['sequelize']['query'](_0x3a879e));}return BPromise[_0xb03d('0x8d')](_0x17f2e9);}})[_0xb03d('0x26')](function(){return _0x523f0a;})['then'](respondWithResult(_0x447c89,null))[_0xb03d('0x4b')](handleError(_0x447c89,null));};exports['removeBlackLists']=function(_0xe2a05,_0x3802a0,_0x265dc5){return db['VoiceQueue'][_0xb03d('0x30')]({'where':{'id':_0xe2a05[_0xb03d('0x58')]['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x3802a0,null))['then'](function(_0x597409){if(_0x597409){return _0x597409[_0xb03d('0xc0')](_0xe2a05['query'][_0xb03d('0x80')]);}})['then'](function(_0x3732da){if(_0x3732da){return db[_0xb03d('0x6a')][_0xb03d('0x27')]({'where':{'ListId':_0xe2a05['query'][_0xb03d('0x80')],'VoiceQueueId':_0xe2a05['params']['id']}})[_0xb03d('0x26')](function(){return _0x3732da;});}})['then'](respondWithStatusCode(_0x3802a0,null))['catch'](handleError(_0x3802a0,null));}; \ No newline at end of file +var _0x4312=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','apply','reject','then','get','VoiceQueues','inbound','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','VoiceQueue','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','QueueCampaigns','outbound','UserProfileSection','update','getHoppers','CmHopper','count','getHopperHistories','findOne','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','from','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','isArray','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','cm_hopper','fromQuery','scheduledAt','ContactId','field','phone','CmListId','ListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','into','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x4493dd,_0x563d3a){var _0x5bb331=function(_0x105dd4){while(--_0x105dd4){_0x4493dd['push'](_0x4493dd['shift']());}};_0x5bb331(++_0x563d3a);}(_0x4312,0xaf));var _0x2431=function(_0x2d2623,_0x1aaea0){_0x2d2623=_0x2d2623-0x0;var _0x28f6c1=_0x4312[_0x2d2623];return _0x28f6c1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2431('0x0'));var jsonpatch=require(_0x2431('0x1'));var rp=require('request-promise');var moment=require(_0x2431('0x2'));var BPromise=require(_0x2431('0x3'));var Mustache=require(_0x2431('0x4'));var util=require(_0x2431('0x5'));var path=require(_0x2431('0x6'));var sox=require(_0x2431('0x7'));var csv=require('to-csv');var ejs=require(_0x2431('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2431('0x9'));var squel=require(_0x2431('0xa'));var crypto=require('crypto');var jsforce=require(_0x2431('0xb'));var deskjs=require(_0x2431('0xc'));var toCsv=require(_0x2431('0xd'));var querystring=require('querystring');var Papa=require(_0x2431('0xe'));var Redis=require(_0x2431('0xf'));var authService=require(_0x2431('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2431('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2431('0x12'))(_0x2431('0x13'));var utils=require(_0x2431('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2431('0x15'));var db=require(_0x2431('0x16'))['db'];config[_0x2431('0x17')]=_[_0x2431('0x18')](config['redis'],{'host':_0x2431('0x19'),'port':0x18eb});var socket=require(_0x2431('0x1a'))(new Redis(config[_0x2431('0x17')]));require(_0x2431('0x1b'))[_0x2431('0x1c')](socket);function respondWithStatusCode(_0x347052,_0x491a9f){_0x491a9f=_0x491a9f||0xcc;return function(_0x893bad){if(_0x893bad){return _0x347052[_0x2431('0x1d')](_0x491a9f);}return _0x347052['status'](_0x491a9f)[_0x2431('0x1e')]();};}function respondWithResult(_0x399a7a,_0x4c83d8){_0x4c83d8=_0x4c83d8||0xc8;return function(_0x30f370){if(_0x30f370){return _0x399a7a[_0x2431('0x1f')](_0x4c83d8)[_0x2431('0x20')](_0x30f370);}};}function respondWithFilteredResult(_0x889fe2,_0x1a4afd){return function(_0x21516b){if(_0x21516b){var _0x2c3ac8=typeof _0x1a4afd[_0x2431('0x21')]===_0x2431('0x22')&&typeof _0x1a4afd[_0x2431('0x23')]===_0x2431('0x22');var _0x5e58c6=_0x21516b['count'];var _0x3b4fa0=_0x2c3ac8?0x0:_0x1a4afd[_0x2431('0x21')];var _0x2e6b2b=_0x2c3ac8?_0x21516b['count']:_0x1a4afd[_0x2431('0x21')]+_0x1a4afd[_0x2431('0x23')];var _0x5f21bf;if(_0x2e6b2b>=_0x5e58c6){_0x2e6b2b=_0x5e58c6;_0x5f21bf=0xc8;}else{_0x5f21bf=0xce;}_0x889fe2['status'](_0x5f21bf);return _0x889fe2['set']('Content-Range',_0x3b4fa0+'-'+_0x2e6b2b+'/'+_0x5e58c6)[_0x2431('0x20')](_0x21516b);}return null;};}function patchUpdates(_0x4199cf){return function(_0xb3aaa1){try{jsonpatch[_0x2431('0x24')](_0xb3aaa1,_0x4199cf,!![]);}catch(_0x48cc76){return BPromise[_0x2431('0x25')](_0x48cc76);}return _0xb3aaa1['save']();};}function saveUpdates(_0x296c49,_0x2f4d6a){return function(_0x466c99){if(_0x466c99){return _0x466c99['update'](_0x296c49)[_0x2431('0x26')](function(_0x3d401a){return _0x3d401a;});}return null;};}function removeEntity(_0x764b2e,_0x55914b){return function(_0x4e1156){if(_0x4e1156){return _0x4e1156['destroy']()[_0x2431('0x26')](function(){var _0x47c2d5=_0x4e1156[_0x2431('0x27')]({'plain':!![]});var _0xf7afb5=[{'name':_0x2431('0x28'),'value':_0x2431('0x29'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x24995f=_(_0xf7afb5)[_0x2431('0x2a')]('ignore')[_0x2431('0x2b')](_0x2431('0x2c'))['value']();if(_[_0x2431('0x2d')](_0x24995f,_0x47c2d5[_0x2431('0x2e')])){return;}var _0x553b1e=_[_0x2431('0x2f')](_0xf7afb5,[_0x2431('0x2c'),_0x47c2d5[_0x2431('0x2e')]])[_0x2431('0x30')];return db[_0x2431('0x31')][_0x2431('0x32')]({'where':{'type':_0x553b1e,'resourceId':_0x47c2d5['id']}})[_0x2431('0x26')](function(){return _0x4e1156;});})[_0x2431('0x26')](function(){_0x764b2e[_0x2431('0x1f')](0xcc)[_0x2431('0x1e')]();});}};}function handleEntityNotFound(_0x1dcc23,_0x3979f6){return function(_0x448349){if(!_0x448349){_0x1dcc23[_0x2431('0x1d')](0x194);}return _0x448349;};}function handleError(_0x5597e6,_0x1f2591){_0x1f2591=_0x1f2591||0x1f4;return function(_0x481403){logger[_0x2431('0x33')](_0x481403[_0x2431('0x34')]);if(_0x481403[_0x2431('0x30')]){delete _0x481403['name'];}_0x5597e6[_0x2431('0x1f')](_0x1f2591)[_0x2431('0x35')](_0x481403);};}exports[_0x2431('0x36')]=function(_0x57e424,_0x3fbf94){var _0x3ac1fc={},_0x56d09a={},_0x961170={'count':0x0,'rows':[]};var _0x4db8ca=_[_0x2431('0x2b')](db[_0x2431('0x37')]['rawAttributes'],function(_0x19ba23){return{'name':_0x19ba23[_0x2431('0x38')],'type':_0x19ba23[_0x2431('0x2e')][_0x2431('0x39')]};});_0x56d09a[_0x2431('0x3a')]=_[_0x2431('0x2b')](_0x4db8ca,_0x2431('0x30'));_0x56d09a[_0x2431('0x3b')]=_[_0x2431('0x3c')](_0x57e424[_0x2431('0x3b')]);_0x56d09a[_0x2431('0x3d')]=_[_0x2431('0x3e')](_0x56d09a[_0x2431('0x3a')],_0x56d09a['query']);_0x3ac1fc['attributes']=_[_0x2431('0x3e')](_0x56d09a['model'],qs[_0x2431('0x3f')](_0x57e424[_0x2431('0x3b')][_0x2431('0x3f')]));_0x3ac1fc['attributes']=_0x3ac1fc[_0x2431('0x40')][_0x2431('0x41')]?_0x3ac1fc['attributes']:_0x56d09a[_0x2431('0x3a')];if(!_0x57e424[_0x2431('0x3b')][_0x2431('0x42')](_0x2431('0x43'))){_0x3ac1fc[_0x2431('0x23')]=qs['limit'](_0x57e424['query']['limit']);_0x3ac1fc['offset']=qs['offset'](_0x57e424['query']['offset']);}_0x3ac1fc[_0x2431('0x44')]=qs[_0x2431('0x45')](_0x57e424[_0x2431('0x3b')][_0x2431('0x45')]);_0x3ac1fc[_0x2431('0x46')]=qs['filters'](_[_0x2431('0x47')](_0x57e424[_0x2431('0x3b')],_0x56d09a[_0x2431('0x3d')]),_0x4db8ca);if(_0x57e424['query'][_0x2431('0x2a')]){_0x3ac1fc[_0x2431('0x46')]=_[_0x2431('0x48')](_0x3ac1fc[_0x2431('0x46')],{'$or':_['map'](_0x4db8ca,function(_0x157926){if(_0x157926[_0x2431('0x2e')]!==_0x2431('0x49')){var _0x31c084={};_0x31c084[_0x157926[_0x2431('0x30')]]={'$like':'%'+_0x57e424[_0x2431('0x3b')][_0x2431('0x2a')]+'%'};return _0x31c084;}})});}_0x3ac1fc=_[_0x2431('0x48')]({},_0x3ac1fc,_0x57e424[_0x2431('0x4a')]);var _0x184723={'where':_0x3ac1fc[_0x2431('0x46')]};return db[_0x2431('0x37')]['count'](_0x184723)[_0x2431('0x26')](function(_0x28537f){_0x961170['count']=_0x28537f;if(_0x57e424['query'][_0x2431('0x4b')]){_0x3ac1fc['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x2431('0x4c')](_0x3ac1fc);})[_0x2431('0x26')](function(_0x1f0de1){_0x961170[_0x2431('0x4d')]=_0x1f0de1;return _0x961170;})[_0x2431('0x26')](respondWithFilteredResult(_0x3fbf94,_0x3ac1fc))[_0x2431('0x4e')](handleError(_0x3fbf94,null));};exports[_0x2431('0x4f')]=function(_0x6d3c5e,_0x1ad8cc){var _0x3423c1={'raw':![],'where':{'id':_0x6d3c5e['params']['id']}},_0x15ce4b={};_0x15ce4b[_0x2431('0x3a')]=_['keys'](db[_0x2431('0x37')][_0x2431('0x50')]);_0x15ce4b[_0x2431('0x3b')]=_[_0x2431('0x3c')](_0x6d3c5e[_0x2431('0x3b')]);_0x15ce4b[_0x2431('0x3d')]=_[_0x2431('0x3e')](_0x15ce4b['model'],_0x15ce4b[_0x2431('0x3b')]);_0x3423c1[_0x2431('0x40')]=_[_0x2431('0x3e')](_0x15ce4b['model'],qs[_0x2431('0x3f')](_0x6d3c5e[_0x2431('0x3b')]['fields']));_0x3423c1[_0x2431('0x40')]=_0x3423c1[_0x2431('0x40')][_0x2431('0x41')]?_0x3423c1[_0x2431('0x40')]:_0x15ce4b['model'];if(_0x6d3c5e[_0x2431('0x3b')][_0x2431('0x4b')]){_0x3423c1[_0x2431('0x51')]=[{'all':!![]}];}_0x3423c1=_[_0x2431('0x48')]({},_0x3423c1,_0x6d3c5e[_0x2431('0x4a')]);return db[_0x2431('0x37')][_0x2431('0x2f')](_0x3423c1)[_0x2431('0x26')](handleEntityNotFound(_0x1ad8cc,null))[_0x2431('0x26')](respondWithResult(_0x1ad8cc,null))[_0x2431('0x4e')](handleError(_0x1ad8cc,null));};exports[_0x2431('0x52')]=function(_0x51d728,_0x448027){return db[_0x2431('0x37')][_0x2431('0x52')](_0x51d728[_0x2431('0x53')],{})[_0x2431('0x26')](function(_0x4e13a8){var _0x2ae012=_0x51d728[_0x2431('0x54')][_0x2431('0x27')]({'plain':!![]});if(!_0x2ae012)throw new Error(_0x2431('0x55'));if(_0x2ae012[_0x2431('0x56')]===_0x2431('0x54')){var _0x1355d3=_0x4e13a8[_0x2431('0x27')]({'plain':!![]});var _0x1311a8=[{'name':_0x2431('0x28'),'value':_0x2431('0x29')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5b1ab4=_[_0x2431('0x2f')](_0x1311a8,['value',_0x1355d3['type']])[_0x2431('0x30')];return db['UserProfileSection']['find']({'where':{'name':_0x5b1ab4,'userProfileId':_0x2ae012[_0x2431('0x57')]},'raw':!![]})['then'](function(_0x3933b1){if(_0x3933b1&&_0x3933b1[_0x2431('0x58')]===0x0){return db['UserProfileResource'][_0x2431('0x52')]({'name':_0x1355d3['name'],'resourceId':_0x1355d3['id'],'type':_0x3933b1[_0x2431('0x30')],'sectionId':_0x3933b1['id']},{})[_0x2431('0x26')](function(){return _0x4e13a8;});}else{return _0x4e13a8;}})['catch'](function(_0x2aa359){logger[_0x2431('0x33')](_0x2431('0x59'),_0x2aa359);throw _0x2aa359;});}return _0x4e13a8;})[_0x2431('0x26')](respondWithResult(_0x448027,0xc9))['catch'](handleError(_0x448027,null));};exports[_0x2431('0x5a')]=function(_0x5cc951,_0x378fa2){var _0x19c9b3={'where':{'id':_0x5cc951[_0x2431('0x5b')]['id']}},_0x1b6028={};_0x1b6028['model']=_['keys'](db[_0x2431('0x37')][_0x2431('0x50')]);_0x19c9b3['attributes']=_[_0x2431('0x3e')](_0x1b6028[_0x2431('0x3a')],qs[_0x2431('0x3f')](_0x5cc951['query']['fields']));_0x19c9b3[_0x2431('0x40')]=_0x19c9b3[_0x2431('0x40')][_0x2431('0x41')]?_0x19c9b3[_0x2431('0x40')]:_0x1b6028[_0x2431('0x3a')];if(_0x5cc951[_0x2431('0x3b')][_0x2431('0x4b')]){_0x19c9b3[_0x2431('0x51')]=[{'all':!![]}];}_0x19c9b3=_['merge']({},_0x19c9b3,_0x5cc951[_0x2431('0x4a')]);return db[_0x2431('0x37')][_0x2431('0x2f')](_0x19c9b3)[_0x2431('0x26')](handleEntityNotFound(_0x378fa2,null))[_0x2431('0x26')](function(_0x4c7a67){if(_0x4c7a67){var _0xf1f74f=_0x4c7a67[_0x2431('0x27')]({'plain':!![]});_0xf1f74f=qs[_0x2431('0x5c')](_0xf1f74f,['id',_0x2431('0x5d'),'updatedAt']);_0x5cc951['body']=_['omit'](_0x5cc951[_0x2431('0x53')],['id',_0x2431('0x5d'),_0x2431('0x5e')]);return db[_0x2431('0x37')][_0x2431('0x52')](_[_0x2431('0x48')](_0xf1f74f,_0x5cc951[_0x2431('0x53')]),{'include':_0x5cc951[_0x2431('0x3b')][_0x2431('0x4b')]?[{'all':!![]}]:undefined})[_0x2431('0x26')](function(_0x9d86f3){var _0x168b81=_0x5cc951['user'][_0x2431('0x27')]({'plain':!![]});if(!_0x168b81)throw new Error(_0x2431('0x55'));if(_0x168b81[_0x2431('0x56')]===_0x2431('0x54')){var _0x5dfc83=_0x9d86f3[_0x2431('0x27')]({'plain':!![]});var _0x3789e2=[{'name':_0x2431('0x28'),'value':'inbound'},{'name':_0x2431('0x5f'),'value':_0x2431('0x60')}];var _0x56a3b5=_['find'](_0x3789e2,[_0x2431('0x2c'),_0x5dfc83[_0x2431('0x2e')]])['name'];return db[_0x2431('0x61')][_0x2431('0x2f')]({'where':{'name':_0x56a3b5,'userProfileId':_0x168b81[_0x2431('0x57')]},'raw':!![]})[_0x2431('0x26')](function(_0x2b9d4f){if(_0x2b9d4f&&_0x2b9d4f[_0x2431('0x58')]===0x0){return db[_0x2431('0x31')][_0x2431('0x52')]({'name':_0x5dfc83[_0x2431('0x30')],'resourceId':_0x5dfc83['id'],'type':_0x2b9d4f[_0x2431('0x30')],'sectionId':_0x2b9d4f['id']},{})[_0x2431('0x26')](function(){return _0x9d86f3;});}else{return _0x9d86f3;}})[_0x2431('0x4e')](function(_0xada6af){logger['error'](_0x2431('0x59'),_0xada6af);throw _0xada6af;});}return _0x9d86f3;});}})['then'](respondWithResult(_0x378fa2,0xc9))['catch'](handleError(_0x378fa2,null));};exports[_0x2431('0x62')]=function(_0x3ba312,_0xf754ad){if(_0x3ba312[_0x2431('0x53')]['id']){delete _0x3ba312[_0x2431('0x53')]['id'];}return db[_0x2431('0x37')][_0x2431('0x2f')]({'where':{'id':_0x3ba312[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0xf754ad,null))[_0x2431('0x26')](saveUpdates(_0x3ba312['body'],null))[_0x2431('0x26')](respondWithResult(_0xf754ad,null))['catch'](handleError(_0xf754ad,null));};exports[_0x2431('0x32')]=function(_0x3833f6,_0x13c5c3){return db[_0x2431('0x37')][_0x2431('0x2f')]({'where':{'id':_0x3833f6['params']['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x13c5c3,null))[_0x2431('0x26')](removeEntity(_0x13c5c3,null))[_0x2431('0x4e')](handleError(_0x13c5c3,null));};exports[_0x2431('0x63')]=function(_0x45eafd,_0x33f4cd,_0x3d0ae4){var _0x4ab6ed={'raw':![],'where':{}};var _0x5ba87f={};var _0xd6b433={'count':0x0,'rows':[]};return db[_0x2431('0x37')]['findOne']({'where':{'id':_0x45eafd[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x33f4cd,null))[_0x2431('0x26')](function(_0x4e985d){if(_0x4e985d){_0x5ba87f[_0x2431('0x3a')]=_[_0x2431('0x3c')](db['CmHopper']['rawAttributes']);_0x5ba87f[_0x2431('0x3b')]=_['keys'](_0x45eafd[_0x2431('0x3b')]);_0x5ba87f[_0x2431('0x3d')]=_[_0x2431('0x3e')](_0x5ba87f[_0x2431('0x3a')],_0x5ba87f[_0x2431('0x3b')]);_0x4ab6ed[_0x2431('0x40')]=_[_0x2431('0x3e')](_0x5ba87f[_0x2431('0x3a')],qs[_0x2431('0x3f')](_0x45eafd[_0x2431('0x3b')][_0x2431('0x3f')]));_0x4ab6ed[_0x2431('0x40')]=_0x4ab6ed[_0x2431('0x40')][_0x2431('0x41')]?_0x4ab6ed['attributes']:_0x5ba87f['model'];if(!_0x45eafd[_0x2431('0x3b')]['hasOwnProperty'](_0x2431('0x43'))){_0x4ab6ed[_0x2431('0x23')]=qs[_0x2431('0x23')](_0x45eafd[_0x2431('0x3b')]['limit']);_0x4ab6ed[_0x2431('0x21')]=qs['offset'](_0x45eafd['query']['offset']);}_0x4ab6ed[_0x2431('0x44')]=qs['sort'](_0x45eafd['query']['sort']);_0x4ab6ed['where']=qs[_0x2431('0x3d')](_[_0x2431('0x47')](_0x45eafd[_0x2431('0x3b')],_0x5ba87f[_0x2431('0x3d')]));_0x4ab6ed[_0x2431('0x46')]['VoiceQueueId']=_0x4e985d['id'];if(_0x45eafd['query'][_0x2431('0x2a')]){_0x4ab6ed[_0x2431('0x46')]=_[_0x2431('0x48')](_0x4ab6ed[_0x2431('0x46')],{'$or':_[_0x2431('0x2b')](_0x4ab6ed[_0x2431('0x40')],function(_0x53f01f){var _0x186b05={};_0x186b05[_0x53f01f]={'$like':'%'+_0x45eafd[_0x2431('0x3b')]['filter']+'%'};return _0x186b05;})});}_0x4ab6ed=_['merge']({},_0x4ab6ed,_0x45eafd[_0x2431('0x4a')]);return db[_0x2431('0x64')][_0x2431('0x65')]({'where':_0x4ab6ed['where']})[_0x2431('0x26')](function(_0x5945d4){_0xd6b433[_0x2431('0x65')]=_0x5945d4;if(_0x45eafd[_0x2431('0x3b')][_0x2431('0x4b')]){_0x4ab6ed[_0x2431('0x51')]=[{'all':!![]}];}return db[_0x2431('0x64')]['findAll'](_0x4ab6ed);})['then'](function(_0x22f924){_0xd6b433[_0x2431('0x4d')]=_0x22f924;return _0xd6b433;});}})['then'](respondWithFilteredResult(_0x33f4cd,_0x4ab6ed))[_0x2431('0x4e')](handleError(_0x33f4cd,null));};exports[_0x2431('0x66')]=function(_0x4a742e,_0x539c31,_0x4b9842){var _0x2c9c52={'raw':!![],'where':{}};var _0x45c1a1={};var _0x44c35d={'count':0x0,'rows':[]};return db[_0x2431('0x37')][_0x2431('0x67')]({'where':{'id':_0x4a742e[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x539c31,null))['then'](function(_0x49cbc7){if(_0x49cbc7){_0x45c1a1[_0x2431('0x3a')]=_[_0x2431('0x3c')](db[_0x2431('0x68')]['rawAttributes']);_0x45c1a1['query']=_['keys'](_0x4a742e['query']);_0x45c1a1[_0x2431('0x3d')]=_['intersection'](_0x45c1a1[_0x2431('0x3a')],_0x45c1a1['query']);_0x2c9c52[_0x2431('0x40')]=_[_0x2431('0x3e')](_0x45c1a1['model'],qs['fields'](_0x4a742e['query'][_0x2431('0x3f')]));_0x2c9c52['attributes']=_0x2c9c52[_0x2431('0x40')]['length']?_0x2c9c52[_0x2431('0x40')]:_0x45c1a1[_0x2431('0x3a')];if(!_0x4a742e[_0x2431('0x3b')][_0x2431('0x42')]('nolimit')){_0x2c9c52['limit']=qs[_0x2431('0x23')](_0x4a742e[_0x2431('0x3b')][_0x2431('0x23')]);_0x2c9c52[_0x2431('0x21')]=qs[_0x2431('0x21')](_0x4a742e[_0x2431('0x3b')][_0x2431('0x21')]);}_0x2c9c52[_0x2431('0x44')]=qs[_0x2431('0x45')](_0x4a742e['query']['sort']);_0x2c9c52[_0x2431('0x46')]=qs[_0x2431('0x3d')](_[_0x2431('0x47')](_0x4a742e['query'],_0x45c1a1[_0x2431('0x3d')]));_0x2c9c52[_0x2431('0x46')][_0x2431('0x69')]=_0x49cbc7['id'];if(_0x4a742e[_0x2431('0x3b')][_0x2431('0x2a')]){_0x2c9c52['where']=_['merge'](_0x2c9c52[_0x2431('0x46')],{'$or':_[_0x2431('0x2b')](_0x2c9c52[_0x2431('0x40')],function(_0x103bda){var _0x46f01e={};_0x46f01e[_0x103bda]={'$like':'%'+_0x4a742e[_0x2431('0x3b')][_0x2431('0x2a')]+'%'};return _0x46f01e;})});}_0x2c9c52=_[_0x2431('0x48')]({},_0x2c9c52,_0x4a742e['options']);return db['CmHopperHistory'][_0x2431('0x65')]({'where':_0x2c9c52[_0x2431('0x46')]})[_0x2431('0x26')](function(_0x104d7e){_0x44c35d['count']=_0x104d7e;if(_0x4a742e[_0x2431('0x3b')][_0x2431('0x4b')]){_0x2c9c52[_0x2431('0x51')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x2431('0x4c')](_0x2c9c52);})[_0x2431('0x26')](function(_0x556b00){_0x44c35d[_0x2431('0x4d')]=_0x556b00;return _0x44c35d;});}})['then'](respondWithFilteredResult(_0x539c31,_0x2c9c52))[_0x2431('0x4e')](handleError(_0x539c31,null));};exports[_0x2431('0x6a')]=function(_0xd86e6d,_0x433d02,_0x5e3fd7){var _0x435c57={'raw':!![],'where':{}};var _0x13fe6a={};var _0x2f1df6={'count':0x0,'rows':[]};return db[_0x2431('0x37')][_0x2431('0x67')]({'where':{'id':_0xd86e6d[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x433d02,null))[_0x2431('0x26')](function(_0x3b20fa){if(_0x3b20fa){_0x13fe6a[_0x2431('0x3a')]=_['keys'](db[_0x2431('0x6b')][_0x2431('0x50')]);_0x13fe6a[_0x2431('0x3b')]=_['keys'](_0xd86e6d[_0x2431('0x3b')]);_0x13fe6a[_0x2431('0x3d')]=_[_0x2431('0x3e')](_0x13fe6a[_0x2431('0x3a')],_0x13fe6a[_0x2431('0x3b')]);_0x435c57[_0x2431('0x40')]=_[_0x2431('0x3e')](_0x13fe6a[_0x2431('0x3a')],qs[_0x2431('0x3f')](_0xd86e6d[_0x2431('0x3b')][_0x2431('0x3f')]));_0x435c57[_0x2431('0x40')]=_0x435c57[_0x2431('0x40')][_0x2431('0x41')]?_0x435c57[_0x2431('0x40')]:_0x13fe6a[_0x2431('0x3a')];if(!_0xd86e6d[_0x2431('0x3b')][_0x2431('0x42')](_0x2431('0x43'))){_0x435c57[_0x2431('0x23')]=qs['limit'](_0xd86e6d[_0x2431('0x3b')][_0x2431('0x23')]);_0x435c57[_0x2431('0x21')]=qs[_0x2431('0x21')](_0xd86e6d['query'][_0x2431('0x21')]);}_0x435c57[_0x2431('0x44')]=qs[_0x2431('0x45')](_0xd86e6d[_0x2431('0x3b')][_0x2431('0x45')]);_0x435c57['where']=qs['filters'](_[_0x2431('0x47')](_0xd86e6d['query'],_0x13fe6a[_0x2431('0x3d')]));_0x435c57[_0x2431('0x46')][_0x2431('0x69')]=_0x3b20fa['id'];if(_0xd86e6d[_0x2431('0x3b')][_0x2431('0x2a')]){_0x435c57[_0x2431('0x46')]=_[_0x2431('0x48')](_0x435c57[_0x2431('0x46')],{'$or':_[_0x2431('0x2b')](_0x435c57[_0x2431('0x40')],function(_0x3f99a2){var _0xccfa0b={};_0xccfa0b[_0x3f99a2]={'$like':'%'+_0xd86e6d['query'][_0x2431('0x2a')]+'%'};return _0xccfa0b;})});}_0x435c57=_[_0x2431('0x48')]({},_0x435c57,_0xd86e6d[_0x2431('0x4a')]);return db['CmHopperFinal'][_0x2431('0x65')]({'where':_0x435c57['where']})[_0x2431('0x26')](function(_0x1ac6c6){_0x2f1df6[_0x2431('0x65')]=_0x1ac6c6;if(_0xd86e6d[_0x2431('0x3b')]['includeAll']){_0x435c57[_0x2431('0x51')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x435c57);})[_0x2431('0x26')](function(_0x2e2cf1){_0x2f1df6[_0x2431('0x4d')]=_0x2e2cf1;return _0x2f1df6;});}})['then'](respondWithFilteredResult(_0x433d02,_0x435c57))[_0x2431('0x4e')](handleError(_0x433d02,null));};exports['getHopperBlacks']=function(_0x2300cc,_0x3d841a,_0x94e524){var _0x1ba8f9={'raw':!![],'where':{}};var _0x4f6968={};var _0x13170d={'count':0x0,'rows':[]};return db[_0x2431('0x37')][_0x2431('0x67')]({'where':{'id':_0x2300cc[_0x2431('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3d841a,null))['then'](function(_0x3e22c3){if(_0x3e22c3){_0x4f6968[_0x2431('0x3a')]=_[_0x2431('0x3c')](db[_0x2431('0x6c')][_0x2431('0x50')]);_0x4f6968[_0x2431('0x3b')]=_[_0x2431('0x3c')](_0x2300cc['query']);_0x4f6968['filters']=_['intersection'](_0x4f6968['model'],_0x4f6968['query']);_0x1ba8f9[_0x2431('0x40')]=_[_0x2431('0x3e')](_0x4f6968[_0x2431('0x3a')],qs[_0x2431('0x3f')](_0x2300cc['query'][_0x2431('0x3f')]));_0x1ba8f9[_0x2431('0x40')]=_0x1ba8f9[_0x2431('0x40')][_0x2431('0x41')]?_0x1ba8f9[_0x2431('0x40')]:_0x4f6968[_0x2431('0x3a')];if(!_0x2300cc[_0x2431('0x3b')][_0x2431('0x42')](_0x2431('0x43'))){_0x1ba8f9[_0x2431('0x23')]=qs[_0x2431('0x23')](_0x2300cc[_0x2431('0x3b')][_0x2431('0x23')]);_0x1ba8f9[_0x2431('0x21')]=qs[_0x2431('0x21')](_0x2300cc['query'][_0x2431('0x21')]);}_0x1ba8f9[_0x2431('0x44')]=qs['sort'](_0x2300cc[_0x2431('0x3b')][_0x2431('0x45')]);_0x1ba8f9['where']=qs[_0x2431('0x3d')](_[_0x2431('0x47')](_0x2300cc['query'],_0x4f6968[_0x2431('0x3d')]));_0x1ba8f9[_0x2431('0x46')][_0x2431('0x69')]=_0x3e22c3['id'];if(_0x2300cc[_0x2431('0x3b')][_0x2431('0x2a')]){_0x1ba8f9['where']=_[_0x2431('0x48')](_0x1ba8f9[_0x2431('0x46')],{'$or':_['map'](_0x1ba8f9[_0x2431('0x40')],function(_0x8ca1f7){var _0x14fe1d={};_0x14fe1d[_0x8ca1f7]={'$like':'%'+_0x2300cc[_0x2431('0x3b')][_0x2431('0x2a')]+'%'};return _0x14fe1d;})});}_0x1ba8f9=_[_0x2431('0x48')]({},_0x1ba8f9,_0x2300cc[_0x2431('0x4a')]);return db[_0x2431('0x6c')][_0x2431('0x65')]({'where':_0x1ba8f9[_0x2431('0x46')]})['then'](function(_0x84f38c){_0x13170d['count']=_0x84f38c;if(_0x2300cc[_0x2431('0x3b')][_0x2431('0x4b')]){_0x1ba8f9[_0x2431('0x51')]=[{'all':!![]}];}return db[_0x2431('0x6c')][_0x2431('0x4c')](_0x1ba8f9);})['then'](function(_0x1ff6bb){_0x13170d[_0x2431('0x4d')]=_0x1ff6bb;return _0x13170d;});}})['then'](respondWithFilteredResult(_0x3d841a,_0x1ba8f9))[_0x2431('0x4e')](handleError(_0x3d841a,null));};exports[_0x2431('0x6d')]=function(_0x2d2dbc,_0xbfebc5,_0x3c6092){var _0x200c66={};var _0x80be88={};var _0x2edfc1;var _0x4a7f2a;return db[_0x2431('0x37')][_0x2431('0x67')]({'where':{'id':_0x2d2dbc['params']['id']}})[_0x2431('0x26')](handleEntityNotFound(_0xbfebc5,null))[_0x2431('0x26')](function(_0x149bcd){if(_0x149bcd){_0x2edfc1=_0x149bcd;_0x80be88['model']=_[_0x2431('0x3c')](db[_0x2431('0x6e')][_0x2431('0x50')]);_0x80be88['query']=_[_0x2431('0x3c')](_0x2d2dbc['query']);_0x80be88['filters']=_['intersection'](_0x80be88[_0x2431('0x3a')],_0x80be88[_0x2431('0x3b')]);_0x200c66[_0x2431('0x40')]=_[_0x2431('0x3e')](_0x80be88[_0x2431('0x3a')],qs[_0x2431('0x3f')](_0x2d2dbc[_0x2431('0x3b')][_0x2431('0x3f')]));_0x200c66[_0x2431('0x40')]=_0x200c66[_0x2431('0x40')][_0x2431('0x41')]?_0x200c66[_0x2431('0x40')]:_0x80be88[_0x2431('0x3a')];_0x200c66[_0x2431('0x44')]=qs[_0x2431('0x45')](_0x2d2dbc[_0x2431('0x3b')]['sort']);_0x200c66[_0x2431('0x46')]=qs[_0x2431('0x3d')](_[_0x2431('0x47')](_0x2d2dbc[_0x2431('0x3b')],_0x80be88['filters']));if(_0x2d2dbc[_0x2431('0x3b')]['filter']){_0x200c66[_0x2431('0x46')]=_[_0x2431('0x48')](_0x200c66[_0x2431('0x46')],{'$or':_[_0x2431('0x2b')](_0x200c66[_0x2431('0x40')],function(_0x41f044){var _0x49e9e0={};_0x49e9e0[_0x41f044]={'$like':'%'+_0x2d2dbc[_0x2431('0x3b')][_0x2431('0x2a')]+'%'};return _0x49e9e0;})});}_0x200c66=_[_0x2431('0x48')]({},_0x200c66,_0x2d2dbc[_0x2431('0x4a')]);return _0x2edfc1[_0x2431('0x6d')](_0x200c66);}})[_0x2431('0x26')](function(_0x20992b){if(_0x20992b){_0x4a7f2a=_0x20992b[_0x2431('0x41')];if(!_0x2d2dbc[_0x2431('0x3b')][_0x2431('0x42')](_0x2431('0x43'))){_0x200c66[_0x2431('0x23')]=qs['limit'](_0x2d2dbc[_0x2431('0x3b')][_0x2431('0x23')]);_0x200c66[_0x2431('0x21')]=qs[_0x2431('0x21')](_0x2d2dbc[_0x2431('0x3b')][_0x2431('0x21')]);}return _0x2edfc1[_0x2431('0x6d')](_0x200c66);}})[_0x2431('0x26')](function(_0x3729c8){if(_0x3729c8){return _0x3729c8?{'count':_0x4a7f2a,'rows':_0x3729c8}:null;}})[_0x2431('0x26')](respondWithResult(_0xbfebc5,null))[_0x2431('0x4e')](handleError(_0xbfebc5,null));};exports['addTeams']=function(_0x447db8,_0x4436ce,_0x280db){var _0x5093ca=_0x447db8[_0x2431('0x53')][_0x2431('0x6f')];var _0x27cfc9=_[_0x2431('0x2b')](_0x5093ca,'id');return db[_0x2431('0x6e')][_0x2431('0x4c')]({'where':{'id':_0x27cfc9},'attributes':['id'],'include':[{'model':db[_0x2431('0x70')],'as':'Agents','attributes':['id',_0x2431('0x30'),_0x2431('0x71'),_0x2431('0x72'),_0x2431('0x73')],'raw':!![]}]})[_0x2431('0x26')](function(_0x33ca85){if(_0x33ca85){var _0x53ef8e=_[_0x2431('0x74')](_0x33ca85,function(_0x548e3f){var _0x2cc62e=_0x548e3f[_0x2431('0x27')]({'plain':!![]});_0x2cc62e[_0x2431('0x75')][_0x2431('0x76')](function(_0x59ed){_0x59ed[_0x2431('0x77')]=_['find'](_0x5093ca,{'id':_0x2cc62e['id']})[_0x2431('0x77')];});return _0x2cc62e[_0x2431('0x75')];});return db[_0x2431('0x37')][_0x2431('0x2f')]({'where':{'id':_0x447db8['params']['id']}})[_0x2431('0x26')](function(_0x4d8eb1){return db['sequelize'][_0x2431('0x78')](function(_0x599bd5){return _0x4d8eb1[_0x2431('0x79')](_0x27cfc9,{'transaction':_0x599bd5})[_0x2431('0x26')](function(){return BPromise[_0x2431('0x7a')](_0x5093ca,function(_0x5cb479){return db[_0x2431('0x7b')][_0x2431('0x7c')]({'TeamId':_0x5cb479['id'],'VoiceQueueId':_0x447db8[_0x2431('0x5b')]['id'],'penalty':_0x5cb479['penalty']},{'transaction':_0x599bd5});});})['then'](function(){return BPromise['each'](_0x53ef8e,function(_0x35d1d6){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x35d1d6['id'],'VoiceQueueId':_0x447db8[_0x2431('0x5b')]['id']},'defaults':{'penalty':_0x35d1d6[_0x2431('0x77')]},'transaction':_0x599bd5});});})['then'](function(){return BPromise['each'](_[_0x2431('0x2a')](_0x53ef8e,{'online':!![]}),function(_0x5f1593){return db[_0x2431('0x7d')][_0x2431('0x7c')]({'membername':_0x5f1593['name'],'UserId':_0x5f1593['id'],'queue_name':_0x4d8eb1[_0x2431('0x30')],'VoiceQueueId':_0x4d8eb1['id'],'interface':_['isNil'](_0x5f1593[_0x2431('0x73')])?util[_0x2431('0x7e')](_0x2431('0x7f'),_0x5f1593[_0x2431('0x30')]):_0x5f1593[_0x2431('0x73')],'paused':_0x5f1593[_0x2431('0x72')]||![],'penalty':_0x5f1593[_0x2431('0x77')]},{'transaction':_0x599bd5});});})[_0x2431('0x26')](function(){_0x53ef8e[_0x2431('0x76')](function(_0x35b46e){socket[_0x2431('0x80')](_0x2431('0x81'),{'UserId':_0x35b46e['id'],'VoiceQueueId':_0x4d8eb1['id']});});});});});}})[_0x2431('0x26')](respondWithStatusCode(_0x4436ce,null))[_0x2431('0x4e')](handleError(_0x4436ce,null));};exports[_0x2431('0x82')]=function(_0x368ba4,_0x4603b1,_0x5db637){return db[_0x2431('0x6e')][_0x2431('0x4c')]({'where':{'id':_0x368ba4[_0x2431('0x3b')][_0x2431('0x83')]},'attributes':['id'],'include':[{'model':db[_0x2431('0x70')],'as':_0x2431('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4603b1,null))[_0x2431('0x26')](function(_0x3e0cd4){var _0x3303d9=_[_0x2431('0x2b')](_0x3e0cd4,'id');var _0x3fc4e3=[];var _0x58f50a=[];var _0x12f7d3=squel[_0x2431('0x84')]();_0x12f7d3['field']('tq.TeamId')[_0x2431('0x85')]('team_has_voice_queues','tq')[_0x2431('0x86')]('user_has_teams','ut',_0x2431('0x87'))[_0x2431('0x46')](_0x2431('0x88'),_0x368ba4['params']['id']);for(var _0x1d549e=0x0;_0x1d549e<_0x3e0cd4[_0x2431('0x41')];_0x1d549e+=0x1){let _0x24c155=_0x3e0cd4[_0x1d549e];for(var _0x353adc=0x0;_0x353adc<_0x24c155[_0x2431('0x75')][_0x2431('0x41')];_0x353adc+=0x1){let _0x3395df=_0x24c155[_0x2431('0x75')][_0x353adc];var _0x50480c=_0x12f7d3[_0x2431('0x5a')]();_0x50480c[_0x2431('0x46')]('ut.UserId\x20=\x20?',_0x3395df['id']);_0x58f50a[_0x2431('0x89')](db[_0x2431('0x8a')][_0x2431('0x3b')](_0x50480c[_0x2431('0x8b')](),{'type':db[_0x2431('0x8a')][_0x2431('0x8c')][_0x2431('0x8d')]})[_0x2431('0x26')](function(_0x2aca2b){if(_0x2aca2b[_0x2431('0x41')]===0x1){return _0x3395df['id'];}else{var _0x486ae2=_[_0x2431('0x8e')](_[_0x2431('0x2b')](_0x2aca2b,_0x2431('0x8f')),function(_0x5c6714){return _[_0x2431('0x2d')](_0x3303d9,_0x5c6714);});if(_0x486ae2){return _0x3395df['id'];}}}));}}return BPromise[_0x2431('0x90')](_0x58f50a)['then'](function(_0x3fb43f){_0x3fc4e3=_(_0x3fc4e3)[_0x2431('0x91')](_0x3fb43f)['compact']()[_0x2431('0x2c')]();return db[_0x2431('0x37')]['find']({'where':{'id':_0x368ba4[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](function(_0x14e423){return db['sequelize'][_0x2431('0x78')](function(_0x51705d){return _0x14e423['removeTeams'](_0x368ba4[_0x2431('0x3b')][_0x2431('0x83')],{'transaction':_0x51705d})[_0x2431('0x26')](function(){if(!_['isEmpty'](_0x3fc4e3)){return _0x14e423[_0x2431('0x92')](_0x3fc4e3,{'transaction':_0x51705d})['then'](function(){return db[_0x2431('0x7d')]['destroy']({'where':{'VoiceQueueId':_0x368ba4[_0x2431('0x5b')]['id'],'UserId':_0x3fc4e3},'transaction':_0x51705d});});}})[_0x2431('0x26')](function(){_0x3fc4e3[_0x2431('0x76')](function(_0x211257){socket[_0x2431('0x80')](_0x2431('0x93'),{'UserId':_0x211257,'VoiceQueueId':_0x14e423['id']});});});});});});})[_0x2431('0x26')](respondWithStatusCode(_0x4603b1,null))[_0x2431('0x4e')](handleError(_0x4603b1,null));};exports[_0x2431('0x94')]=function(_0x260598,_0x6e0e78,_0x1a2c38){var _0x16086a,_0x228008;return db[_0x2431('0x37')][_0x2431('0x2f')]({'where':{'id':_0x260598['params']['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x6e0e78,null))[_0x2431('0x26')](function(_0x504357){if(_0x504357){_0x228008=_0x504357;return _0x504357[_0x2431('0x94')](_0x260598[_0x2431('0x53')][_0x2431('0x83')],_['omit'](_0x260598[_0x2431('0x53')],[_0x2431('0x83'),'id'])||{})[_0x2431('0x95')](function(_0x24ecc9){for(var _0x3ac72e=0x0;_0x3ac72e<_0x260598[_0x2431('0x53')]['ids'][_0x2431('0x41')];_0x3ac72e+=0x1){socket[_0x2431('0x80')]('userVoiceQueue:save',{'UserId':Number(_0x260598['body']['ids'][_0x3ac72e]),'VoiceQueueId':Number(_0x260598[_0x2431('0x5b')]['id'])});}return _0x24ecc9;});}})[_0x2431('0x26')](function(_0x4344b2){_0x16086a=_0x4344b2||[];if(_0x228008){return db['User'][_0x2431('0x4c')]({'where':{'id':_0x260598[_0x2431('0x53')]['ids']},'attributes':['id','name',_0x2431('0x71'),_0x2431('0x72'),_0x2431('0x73')],'raw':!![]});}})[_0x2431('0x26')](function(_0x53aaf0){if(!_[_0x2431('0x96')](_0x53aaf0)){var _0x104c15=[];for(var _0x250269=0x0;_0x250269<_0x53aaf0[_0x2431('0x41')];_0x250269++){if(_0x53aaf0[_0x250269][_0x2431('0x71')]){_0x104c15[_0x2431('0x89')](db[_0x2431('0x7d')][_0x2431('0x7c')]({'membername':_0x53aaf0[_0x250269][_0x2431('0x30')],'UserId':_0x53aaf0[_0x250269]['id'],'queue_name':_0x228008['name'],'VoiceQueueId':_0x228008['id'],'interface':_['isNil'](_0x53aaf0[_0x250269][_0x2431('0x73')])?util[_0x2431('0x7e')]('SIP/%s',_0x53aaf0[_0x250269][_0x2431('0x30')]):_0x53aaf0[_0x250269]['interface'],'paused':_0x53aaf0[_0x250269][_0x2431('0x72')]||![],'penalty':_0x260598['body'][_0x2431('0x77')]||0x0}));}}return BPromise[_0x2431('0x90')](_0x104c15);}})[_0x2431('0x26')](function(){return _0x16086a;})[_0x2431('0x26')](respondWithResult(_0x6e0e78,null))[_0x2431('0x4e')](handleError(_0x6e0e78,null));};exports[_0x2431('0x92')]=function(_0x444ea3,_0xd8b509,_0x5d8ced){return db['VoiceQueue'][_0x2431('0x2f')]({'where':{'id':_0x444ea3[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0xd8b509,null))[_0x2431('0x26')](function(_0x392ea9){if(_0x392ea9){return _0x392ea9['removeAgents'](_0x444ea3[_0x2431('0x3b')][_0x2431('0x83')])[_0x2431('0x26')](function(){if(_[_0x2431('0x97')](_0x444ea3[_0x2431('0x3b')][_0x2431('0x83')])){for(var _0x4a9d4c=0x0;_0x4a9d4c<_0x444ea3[_0x2431('0x3b')][_0x2431('0x83')][_0x2431('0x41')];_0x4a9d4c+=0x1){socket['emit'](_0x2431('0x93'),{'UserId':Number(_0x444ea3[_0x2431('0x3b')][_0x2431('0x83')][_0x4a9d4c]),'VoiceQueueId':Number(_0x444ea3['params']['id'])});}}else{socket[_0x2431('0x80')](_0x2431('0x93'),{'UserId':Number(_0x444ea3[_0x2431('0x3b')][_0x2431('0x83')]),'VoiceQueueId':Number(_0x444ea3[_0x2431('0x5b')]['id'])});}});}})[_0x2431('0x26')](function(_0x3ccd8f){return db[_0x2431('0x7d')][_0x2431('0x32')]({'where':{'VoiceQueueId':_0x444ea3[_0x2431('0x5b')]['id'],'UserId':_0x444ea3[_0x2431('0x3b')][_0x2431('0x83')]}})['then'](function(){return _0x3ccd8f;});})['then'](respondWithStatusCode(_0xd8b509,null))[_0x2431('0x4e')](handleError(_0xd8b509,null));};exports[_0x2431('0x98')]=function(_0x9ac252,_0x45e940,_0x5cf873){var _0x10a322={};var _0x15ba12={};var _0x4aa55b;var _0x15d701;return db[_0x2431('0x37')]['findOne']({'where':{'id':_0x9ac252[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x45e940,null))['then'](function(_0x95c85c){if(_0x95c85c){_0x4aa55b=_0x95c85c;_0x15ba12['model']=_[_0x2431('0x3c')](db[_0x2431('0x70')][_0x2431('0x50')]);_0x15ba12[_0x2431('0x3b')]=_[_0x2431('0x3c')](_0x9ac252['query']);_0x15ba12[_0x2431('0x3d')]=_[_0x2431('0x3e')](_0x15ba12[_0x2431('0x3a')],_0x15ba12[_0x2431('0x3b')]);_0x10a322['attributes']=_[_0x2431('0x3e')](_0x15ba12['model'],qs['fields'](_0x9ac252[_0x2431('0x3b')][_0x2431('0x3f')]));_0x10a322['attributes']=_0x10a322['attributes'][_0x2431('0x41')]?_0x10a322[_0x2431('0x40')]:_0x15ba12['model'];_0x10a322[_0x2431('0x44')]=qs[_0x2431('0x45')](_0x9ac252[_0x2431('0x3b')][_0x2431('0x45')]);_0x10a322[_0x2431('0x46')]=qs[_0x2431('0x3d')](_['pick'](_0x9ac252['query'],_0x15ba12[_0x2431('0x3d')]));if(_0x9ac252[_0x2431('0x3b')][_0x2431('0x2a')]){_0x10a322[_0x2431('0x46')]=_[_0x2431('0x48')](_0x10a322[_0x2431('0x46')],{'$or':_[_0x2431('0x2b')](_0x10a322[_0x2431('0x40')],function(_0x570dd3){var _0x1473cd={};_0x1473cd[_0x570dd3]={'$like':'%'+_0x9ac252[_0x2431('0x3b')][_0x2431('0x2a')]+'%'};return _0x1473cd;})});}_0x10a322=_[_0x2431('0x48')]({},_0x10a322,_0x9ac252[_0x2431('0x4a')]);return _0x4aa55b[_0x2431('0x98')](_0x10a322);}})[_0x2431('0x26')](function(_0x21b21c){if(_0x21b21c){_0x15d701=_0x21b21c[_0x2431('0x41')];if(!_0x9ac252[_0x2431('0x3b')][_0x2431('0x42')](_0x2431('0x43'))){_0x10a322[_0x2431('0x23')]=qs[_0x2431('0x23')](_0x9ac252[_0x2431('0x3b')]['limit']);_0x10a322[_0x2431('0x21')]=qs[_0x2431('0x21')](_0x9ac252[_0x2431('0x3b')][_0x2431('0x21')]);}return _0x4aa55b[_0x2431('0x98')](_0x10a322);}})[_0x2431('0x26')](function(_0xdfafc0){if(_0xdfafc0){return _0xdfafc0?{'count':_0x15d701,'rows':_0xdfafc0}:null;}})[_0x2431('0x26')](respondWithResult(_0x45e940,null))[_0x2431('0x4e')](handleError(_0x45e940,null));};exports[_0x2431('0x99')]=function(_0x3e0993,_0x963b9b,_0x262680){var _0x33ef1e={};var _0x2b98b9={};var _0x5c1bad;var _0x3cd198;return db[_0x2431('0x37')][_0x2431('0x67')]({'where':{'id':_0x3e0993[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x963b9b,null))[_0x2431('0x26')](function(_0x8298b){if(_0x8298b){_0x5c1bad=_0x8298b;_0x2b98b9[_0x2431('0x3a')]=_['keys'](db[_0x2431('0x7d')][_0x2431('0x50')]);_0x2b98b9[_0x2431('0x3b')]=_[_0x2431('0x3c')](_0x3e0993[_0x2431('0x3b')]);_0x2b98b9[_0x2431('0x3d')]=_[_0x2431('0x3e')](_0x2b98b9[_0x2431('0x3a')],_0x2b98b9[_0x2431('0x3b')]);_0x33ef1e[_0x2431('0x40')]=_[_0x2431('0x3e')](_0x2b98b9[_0x2431('0x3a')],qs[_0x2431('0x3f')](_0x3e0993[_0x2431('0x3b')][_0x2431('0x3f')]));_0x33ef1e['attributes']=_0x33ef1e['attributes'][_0x2431('0x41')]?_0x33ef1e[_0x2431('0x40')]:_0x2b98b9[_0x2431('0x3a')];_0x33ef1e[_0x2431('0x44')]=qs['sort'](_0x3e0993[_0x2431('0x3b')][_0x2431('0x45')]);_0x33ef1e[_0x2431('0x46')]=qs[_0x2431('0x3d')](_[_0x2431('0x47')](_0x3e0993[_0x2431('0x3b')],_0x2b98b9[_0x2431('0x3d')]));if(_0x3e0993['query'][_0x2431('0x2a')]){_0x33ef1e[_0x2431('0x46')]=_['merge'](_0x33ef1e[_0x2431('0x46')],{'$or':_[_0x2431('0x2b')](_0x33ef1e[_0x2431('0x40')],function(_0x1a82c7){var _0x4b2c6c={};_0x4b2c6c[_0x1a82c7]={'$like':'%'+_0x3e0993[_0x2431('0x3b')][_0x2431('0x2a')]+'%'};return _0x4b2c6c;})});}_0x33ef1e=_[_0x2431('0x48')]({},_0x33ef1e,_0x3e0993[_0x2431('0x4a')]);return _0x5c1bad[_0x2431('0x99')](_0x33ef1e);}})[_0x2431('0x26')](function(_0x2e7e23){if(_0x2e7e23){_0x3cd198=_0x2e7e23[_0x2431('0x41')];if(!_0x3e0993[_0x2431('0x3b')][_0x2431('0x42')](_0x2431('0x43'))){_0x33ef1e[_0x2431('0x23')]=qs[_0x2431('0x23')](_0x3e0993[_0x2431('0x3b')][_0x2431('0x23')]);_0x33ef1e[_0x2431('0x21')]=qs[_0x2431('0x21')](_0x3e0993[_0x2431('0x3b')]['offset']);}return _0x5c1bad[_0x2431('0x99')](_0x33ef1e);}})[_0x2431('0x26')](function(_0x1d6aa2){return _0x1d6aa2?{'count':_0x3cd198,'rows':_0x1d6aa2}:null;})[_0x2431('0x26')](respondWithResult(_0x963b9b,null))[_0x2431('0x4e')](handleError(_0x963b9b,null));};exports['getLists']=function(_0x48c46d,_0x161836,_0x118c13){var _0x3045df={};var _0x386592={};var _0x5404c0;var _0x4a238c;return db['VoiceQueue'][_0x2431('0x67')]({'where':{'id':_0x48c46d[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x161836,null))[_0x2431('0x26')](function(_0x6474b0){if(_0x6474b0){_0x5404c0=_0x6474b0;_0x386592[_0x2431('0x3a')]=_[_0x2431('0x3c')](db[_0x2431('0x9a')][_0x2431('0x50')]);_0x386592[_0x2431('0x3b')]=_[_0x2431('0x3c')](_0x48c46d['query']);_0x386592[_0x2431('0x3d')]=_[_0x2431('0x3e')](_0x386592['model'],_0x386592[_0x2431('0x3b')]);_0x3045df[_0x2431('0x40')]=_[_0x2431('0x3e')](_0x386592[_0x2431('0x3a')],qs['fields'](_0x48c46d[_0x2431('0x3b')]['fields']));_0x3045df[_0x2431('0x40')]=_0x3045df[_0x2431('0x40')][_0x2431('0x41')]?_0x3045df['attributes']:_0x386592[_0x2431('0x3a')];_0x3045df[_0x2431('0x44')]=qs[_0x2431('0x45')](_0x48c46d[_0x2431('0x3b')][_0x2431('0x45')]);_0x3045df['where']=qs[_0x2431('0x3d')](_[_0x2431('0x47')](_0x48c46d['query'],_0x386592['filters']));if(_0x48c46d[_0x2431('0x3b')][_0x2431('0x2a')]){_0x3045df['where']=_[_0x2431('0x48')](_0x3045df['where'],{'$or':_['map'](_0x3045df[_0x2431('0x40')],function(_0x8596aa){var _0x280624={};_0x280624[_0x8596aa]={'$like':'%'+_0x48c46d[_0x2431('0x3b')][_0x2431('0x2a')]+'%'};return _0x280624;})});}_0x3045df=_[_0x2431('0x48')]({},_0x3045df,_0x48c46d[_0x2431('0x4a')]);return _0x5404c0['getLists'](_0x3045df);}})['then'](function(_0x451e20){if(_0x451e20){_0x4a238c=_0x451e20['length'];if(!_0x48c46d[_0x2431('0x3b')]['hasOwnProperty'](_0x2431('0x43'))){_0x3045df[_0x2431('0x23')]=qs[_0x2431('0x23')](_0x48c46d[_0x2431('0x3b')][_0x2431('0x23')]);_0x3045df[_0x2431('0x21')]=qs[_0x2431('0x21')](_0x48c46d[_0x2431('0x3b')][_0x2431('0x21')]);}return _0x5404c0[_0x2431('0x9b')](_0x3045df);}})[_0x2431('0x26')](function(_0x411066){if(_0x411066){return _0x411066?{'count':_0x4a238c,'rows':_0x411066}:null;}})['then'](respondWithResult(_0x161836,null))[_0x2431('0x4e')](handleError(_0x161836,null));};exports[_0x2431('0x9c')]=function(_0x3d2de7,_0x168ea5,_0x141433){var _0x15d107=moment()[_0x2431('0x7e')](_0x2431('0x9d'));var _0x33a27f,_0x20372a;return db[_0x2431('0x37')]['find']({'where':{'id':_0x3d2de7[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x168ea5,null))[_0x2431('0x26')](function(_0x24d86d){if(_0x24d86d){_0x20372a=_0x24d86d;return _0x24d86d[_0x2431('0x9c')](_0x3d2de7[_0x2431('0x53')][_0x2431('0x83')],_['omit'](_0x3d2de7[_0x2431('0x53')],[_0x2431('0x83'),'id'])||{});}return null;})[_0x2431('0x95')](function(_0x21f56e){var _0x10d225;_0x33a27f=_0x21f56e||[];var _0x5ce808=[];if(_0x21f56e){for(var _0x2dce54=0x0;_0x2dce54<_0x21f56e[_0x2431('0x41')];_0x2dce54+=0x1){var _0x4f055c=_0x21f56e[_0x2dce54][_0x2431('0x27')]({'plain':!![]});_0x20372a[_0x2431('0x9e')]=_0x3d2de7['body'][_0x2431('0x9e')]?_0x3d2de7[_0x2431('0x53')][_0x2431('0x9e')]:_0x20372a[_0x2431('0x9e')];switch(_0x20372a[_0x2431('0x9e')]){case'always':_0x10d225=squel[_0x2431('0x9f')]()['into'](_0x2431('0xa0'))[_0x2431('0xa1')](['phone',_0x2431('0xa2'),_0x2431('0xa3'),'ListId','VoiceQueueId',_0x2431('0x5d'),_0x2431('0x5e')],squel['select']()[_0x2431('0xa4')](_0x2431('0xa5'),_0x2431('0xa5'))[_0x2431('0xa4')]('\x27'+_0x15d107+'\x27',_0x2431('0xa2'))[_0x2431('0xa4')]('id','ContactId')[_0x2431('0xa4')](_0x4f055c[_0x2431('0xa6')][_0x2431('0x8b')](),_0x2431('0xa7'))[_0x2431('0xa4')](_0x3d2de7[_0x2431('0x5b')]['id'][_0x2431('0x8b')](),_0x2431('0x69'))[_0x2431('0xa4')]('\x27'+_0x15d107+'\x27',_0x2431('0x5d'))['field']('\x27'+_0x15d107+'\x27',_0x2431('0x5e'))[_0x2431('0x85')]('cm_contacts')[_0x2431('0x46')](_0x2431('0xa8'))[_0x2431('0x46')](_0x2431('0xa9'),_0x4f055c['CmListId']['toString']())[_0x2431('0x46')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x2431('0xaa'),squel['select']()[_0x2431('0xa4')]('COALESCE(calleridnum,\x27\x27)')[_0x2431('0x85')](_0x2431('0xab'))[_0x2431('0x46')](_0x2431('0x88'),_0x3d2de7[_0x2431('0x5b')]['id'][_0x2431('0x8b')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2431('0xa4')]('COALESCE(phone,\x27\x27)')['from'](_0x2431('0xa0'))[_0x2431('0x46')]('VoiceQueueId\x20=\x20?',_0x3d2de7[_0x2431('0x5b')]['id']['toString']())))[_0x2431('0x8b')]();break;case'onlyIfOpen':_0x10d225=squel[_0x2431('0x9f')]()[_0x2431('0xac')](_0x2431('0xa0'))[_0x2431('0xa1')]([_0x2431('0xa5'),_0x2431('0xa2'),_0x2431('0xa3'),'ListId',_0x2431('0x69'),'createdAt',_0x2431('0x5e')],squel[_0x2431('0x84')]()[_0x2431('0xa4')](_0x2431('0xa5'),_0x2431('0xa5'))[_0x2431('0xa4')]('\x27'+_0x15d107+'\x27',_0x2431('0xa2'))[_0x2431('0xa4')]('id','ContactId')[_0x2431('0xa4')](_0x4f055c[_0x2431('0xa6')][_0x2431('0x8b')](),_0x2431('0xa7'))[_0x2431('0xa4')](_0x3d2de7[_0x2431('0x5b')]['id']['toString'](),_0x2431('0x69'))[_0x2431('0xa4')]('\x27'+_0x15d107+'\x27','createdAt')[_0x2431('0xa4')]('\x27'+_0x15d107+'\x27',_0x2431('0x5e'))['from'](_0x2431('0xad'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x4f055c[_0x2431('0xa6')][_0x2431('0x8b')]())['where'](_0x2431('0xae'))[_0x2431('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2431('0x84')]()[_0x2431('0xa4')](_0x2431('0xaf'))[_0x2431('0x85')]('cm_hopper')[_0x2431('0x46')]('VoiceQueueId\x20=\x20?',_0x3d2de7[_0x2431('0x5b')]['id']['toString']())))[_0x2431('0x8b')]();break;default:_0x10d225=squel['insert']()['into'](_0x2431('0xa0'))[_0x2431('0xa1')]([_0x2431('0xa5'),_0x2431('0xa2'),_0x2431('0xa3'),_0x2431('0xa7'),_0x2431('0x69'),_0x2431('0x5d'),_0x2431('0x5e')],squel[_0x2431('0x84')]()[_0x2431('0xa4')](_0x2431('0xa5'),_0x2431('0xa5'))[_0x2431('0xa4')]('\x27'+_0x15d107+'\x27','scheduledAt')[_0x2431('0xa4')]('id',_0x2431('0xa3'))['field'](_0x4f055c[_0x2431('0xa6')][_0x2431('0x8b')](),_0x2431('0xa7'))[_0x2431('0xa4')](_0x3d2de7['params']['id'][_0x2431('0x8b')](),_0x2431('0x69'))[_0x2431('0xa4')]('\x27'+_0x15d107+'\x27',_0x2431('0x5d'))[_0x2431('0xa4')]('\x27'+_0x15d107+'\x27',_0x2431('0x5e'))['from'](_0x2431('0xad'))[_0x2431('0x46')](_0x2431('0xa8'))[_0x2431('0x46')](_0x2431('0xa9'),_0x4f055c[_0x2431('0xa6')][_0x2431('0x8b')]())['where'](_0x2431('0xae')))[_0x2431('0x8b')]();}_0x5ce808[_0x2431('0x89')](db[_0x2431('0x8a')][_0x2431('0x3b')](_0x10d225));}return BPromise['all'](_0x5ce808);}})['then'](function(){var _0x13415d=[];var _0x4d6be9=squel['insert']()[_0x2431('0xac')](_0x2431('0xb0'))['fromQuery']([_0x2431('0xb1'),_0x2431('0xa5'),_0x2431('0xb2'),_0x2431('0x5d'),_0x2431('0x5e')],squel[_0x2431('0x84')]()[_0x2431('0xa4')](_0x2431('0xb3'))['field'](_0x2431('0xb4'))[_0x2431('0xa4')](_0x2431('0xb5'))['field']('\x27'+_0x15d107+'\x27',_0x2431('0x5d'))[_0x2431('0xa4')]('\x27'+_0x15d107+'\x27',_0x2431('0x5e'))[_0x2431('0x85')]('cm_contact_has_items','ci')['join']('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x2431('0x46')]('h.scheduledat=?',_0x15d107)[_0x2431('0x46')](_0x2431('0xb6'),'PHONE'))['toString']();_0x13415d[_0x2431('0x89')](db[_0x2431('0x8a')]['query'](_0x4d6be9));return BPromise[_0x2431('0x90')](_0x13415d);})[_0x2431('0x26')](function(){return _0x33a27f;})[_0x2431('0x26')](respondWithResult(_0x168ea5,null))[_0x2431('0x4e')](handleError(_0x168ea5,null));};exports[_0x2431('0xb7')]=function(_0x470fc1,_0x3bc99a,_0xf9424a){return db[_0x2431('0x37')]['find']({'where':{'id':_0x470fc1[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x3bc99a,null))[_0x2431('0x26')](function(_0x3d409c){if(_0x3d409c){return _0x3d409c['removeLists'](_0x470fc1[_0x2431('0x3b')][_0x2431('0x83')]);}})['then'](function(_0x5ccf5e){if(_0x5ccf5e){return db['CmHopper'][_0x2431('0x32')]({'where':{'ListId':_0x470fc1['query'][_0x2431('0x83')],'VoiceQueueId':_0x470fc1[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](function(){return _0x5ccf5e;});}})['then'](respondWithStatusCode(_0x3bc99a,null))['catch'](handleError(_0x3bc99a,null));};exports[_0x2431('0xb8')]=function(_0x111411,_0x31be24,_0x37220a){var _0x1ced4a={};var _0x35e7c9={};var _0x12608b;var _0x4ab8a9;return db[_0x2431('0x37')]['findOne']({'where':{'id':_0x111411[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](handleEntityNotFound(_0x31be24,null))[_0x2431('0x26')](function(_0x439d5a){if(_0x439d5a){_0x12608b=_0x439d5a;_0x35e7c9[_0x2431('0x3a')]=_[_0x2431('0x3c')](db[_0x2431('0x9a')][_0x2431('0x50')]);_0x35e7c9[_0x2431('0x3b')]=_['keys'](_0x111411[_0x2431('0x3b')]);_0x35e7c9[_0x2431('0x3d')]=_['intersection'](_0x35e7c9[_0x2431('0x3a')],_0x35e7c9[_0x2431('0x3b')]);_0x1ced4a[_0x2431('0x40')]=_[_0x2431('0x3e')](_0x35e7c9['model'],qs[_0x2431('0x3f')](_0x111411[_0x2431('0x3b')][_0x2431('0x3f')]));_0x1ced4a[_0x2431('0x40')]=_0x1ced4a['attributes'][_0x2431('0x41')]?_0x1ced4a[_0x2431('0x40')]:_0x35e7c9[_0x2431('0x3a')];_0x1ced4a[_0x2431('0x44')]=qs[_0x2431('0x45')](_0x111411['query'][_0x2431('0x45')]);_0x1ced4a[_0x2431('0x46')]=qs[_0x2431('0x3d')](_['pick'](_0x111411[_0x2431('0x3b')],_0x35e7c9[_0x2431('0x3d')]));if(_0x111411[_0x2431('0x3b')][_0x2431('0x2a')]){_0x1ced4a['where']=_['merge'](_0x1ced4a[_0x2431('0x46')],{'$or':_[_0x2431('0x2b')](_0x1ced4a[_0x2431('0x40')],function(_0x27aace){var _0x3753cc={};_0x3753cc[_0x27aace]={'$like':'%'+_0x111411['query']['filter']+'%'};return _0x3753cc;})});}_0x1ced4a=_['merge']({},_0x1ced4a,_0x111411['options']);return _0x12608b[_0x2431('0xb8')](_0x1ced4a);}})[_0x2431('0x26')](function(_0x37c513){if(_0x37c513){_0x4ab8a9=_0x37c513[_0x2431('0x41')];if(!_0x111411[_0x2431('0x3b')][_0x2431('0x42')]('nolimit')){_0x1ced4a['limit']=qs[_0x2431('0x23')](_0x111411[_0x2431('0x3b')]['limit']);_0x1ced4a[_0x2431('0x21')]=qs[_0x2431('0x21')](_0x111411[_0x2431('0x3b')][_0x2431('0x21')]);}return _0x12608b[_0x2431('0xb8')](_0x1ced4a);}})[_0x2431('0x26')](function(_0x579549){if(_0x579549){return _0x579549?{'count':_0x4ab8a9,'rows':_0x579549}:null;}})[_0x2431('0x26')](respondWithResult(_0x31be24,null))[_0x2431('0x4e')](handleError(_0x31be24,null));};exports['addBlackLists']=function(_0x449dc2,_0x196293,_0x4f39da){var _0x52ddad,_0x426ca0;return db[_0x2431('0x37')][_0x2431('0x2f')]({'where':{'id':_0x449dc2[_0x2431('0x5b')]['id']}})['then'](handleEntityNotFound(_0x196293,null))['then'](function(_0x18aa46){if(_0x18aa46){_0x426ca0=_0x18aa46;return _0x18aa46[_0x2431('0xb9')](_0x449dc2[_0x2431('0x53')]['ids'],_[_0x2431('0x5c')](_0x449dc2[_0x2431('0x53')],[_0x2431('0x83'),'id'])||{});}return null;})[_0x2431('0x95')](function(_0x425e73){var _0x2b05fe;_0x52ddad=_0x425e73||[];var _0x1cfa4a=[];if(_0x425e73){for(var _0x268795=0x0;_0x268795<_0x425e73[_0x2431('0x41')];_0x268795+=0x1){var _0x34a435=_0x425e73[_0x268795]['get']({'plain':!![]});_0x2b05fe=squel[_0x2431('0x9f')]()[_0x2431('0xac')](_0x2431('0xba'))[_0x2431('0xa1')]([_0x2431('0xa5'),'ContactId','ListId',_0x2431('0x69'),_0x2431('0x5d'),_0x2431('0x5e')],squel[_0x2431('0x84')]()[_0x2431('0xa4')](_0x2431('0xa5'),'phone')[_0x2431('0xa4')]('id',_0x2431('0xa3'))[_0x2431('0xa4')](_0x34a435[_0x2431('0xa6')][_0x2431('0x8b')](),_0x2431('0xa7'))[_0x2431('0xa4')](_0x449dc2[_0x2431('0x5b')]['id']['toString'](),_0x2431('0x69'))['field'](_0x2431('0xbb'),_0x2431('0x5d'))[_0x2431('0xa4')](_0x2431('0xbb'),_0x2431('0x5e'))[_0x2431('0x85')]('cm_contacts')[_0x2431('0x46')](_0x2431('0xa8'))[_0x2431('0x46')](_0x2431('0xa9'),_0x34a435[_0x2431('0xa6')][_0x2431('0x8b')]())[_0x2431('0x46')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x1cfa4a[_0x2431('0x89')](db[_0x2431('0x8a')]['query'](_0x2b05fe));}return BPromise[_0x2431('0x90')](_0x1cfa4a);}})[_0x2431('0x26')](function(){return _0x52ddad;})[_0x2431('0x26')](respondWithResult(_0x196293,null))[_0x2431('0x4e')](handleError(_0x196293,null));};exports[_0x2431('0xbc')]=function(_0x395548,_0x4cbbb4,_0x2ae159){return db[_0x2431('0x37')]['find']({'where':{'id':_0x395548[_0x2431('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4cbbb4,null))[_0x2431('0x26')](function(_0x101626){if(_0x101626){return _0x101626[_0x2431('0xbc')](_0x395548[_0x2431('0x3b')]['ids']);}})['then'](function(_0x320bff){if(_0x320bff){return db['CmHopperBlack'][_0x2431('0x32')]({'where':{'ListId':_0x395548['query']['ids'],'VoiceQueueId':_0x395548[_0x2431('0x5b')]['id']}})[_0x2431('0x26')](function(){return _0x320bff;});}})[_0x2431('0x26')](respondWithStatusCode(_0x4cbbb4,null))[_0x2431('0x4e')](handleError(_0x4cbbb4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 7235fe9..8c7c1ad 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 _0x70be=['update','emit','hasOwnProperty','hook','exports','VoiceQueue','setMaxListeners','save'];(function(_0x5968c5,_0x47c5d7){var _0x2e725a=function(_0x515f2d){while(--_0x515f2d){_0x5968c5['push'](_0x5968c5['shift']());}};_0x2e725a(++_0x47c5d7);}(_0x70be,0x12d));var _0xe70b=function(_0xddfcc0,_0x38943a){_0xddfcc0=_0xddfcc0-0x0;var _0x47b45e=_0x70be[_0xddfcc0];return _0x47b45e;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0xe70b('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe70b('0x1')](0x0);var events={'afterCreate':_0xe70b('0x2'),'afterUpdate':_0xe70b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3628ef){return function(_0x19256f,_0x33345c,_0x2a4d34){VoiceQueueEvents[_0xe70b('0x4')](_0x3628ef+':'+_0x19256f['id'],_0x19256f);VoiceQueueEvents['emit'](_0x3628ef,_0x19256f);_0x2a4d34(null);};}for(var e in events){if(events[_0xe70b('0x5')](e)){var event=events[e];VoiceQueue[_0xe70b('0x6')](e,emitEvent(event));}}module[_0xe70b('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x7b5b=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x56b3c3,_0xe16059){var _0x53d0ee=function(_0x1b032f){while(--_0x1b032f){_0x56b3c3['push'](_0x56b3c3['shift']());}};_0x53d0ee(++_0xe16059);}(_0x7b5b,0x14d));var _0xb7b5=function(_0x16a1f3,_0x2acff9){_0x16a1f3=_0x16a1f3-0x0;var _0x294e4e=_0x7b5b[_0x16a1f3];return _0x294e4e;};'use strict';var EventEmitter=require(_0xb7b5('0x0'));var VoiceQueue=require(_0xb7b5('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb7b5('0x2'),'afterUpdate':_0xb7b5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2301f3){return function(_0x3cd78a,_0x131801,_0x46adde){VoiceQueueEvents['emit'](_0x2301f3+':'+_0x3cd78a['id'],_0x3cd78a);VoiceQueueEvents[_0xb7b5('0x4')](_0x2301f3,_0x3cd78a);_0x46adde(null);};}for(var e in events){if(events[_0xb7b5('0x5')](e)){var event=events[e];VoiceQueue[_0xb7b5('0x6')](e,emitEvent(event));}}module[_0xb7b5('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 14be0c3..b390341 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x70e0,0x17b));var _0x070e=function(_0x5822b3,_0x1191b8){_0x5822b3=_0x5822b3-0x0;var _0x4c7697=_0x70e0[_0x5822b3];return _0x4c7697;};'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 +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x5c98ea,_0xa782aa){var _0x51e853=function(_0x57d5b0){while(--_0x57d5b0){_0x5c98ea['push'](_0x5c98ea['shift']());}};_0x51e853(++_0xa782aa);}(_0x3e74,0x175));var _0x43e7=function(_0x431612,_0x44cbfc){_0x431612=_0x431612-0x0;var _0x2ac791=_0x3e74[_0x431612];return _0x2ac791;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index e6410bf..cfb5a39 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 _0xda68=['include','model','ShowVoiceQueue','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','map'];(function(_0x226106,_0x18e497){var _0x6c66b2=function(_0xab7fe0){while(--_0xab7fe0){_0x226106['push'](_0x226106['shift']());}};_0x6c66b2(++_0x18e497);}(_0xda68,0x124));var _0x8da6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8da6('0x0'));var moment=require(_0x8da6('0x1'));var BPromise=require(_0x8da6('0x2'));var rs=require(_0x8da6('0x3'));var fs=require('fs');var Redis=require(_0x8da6('0x4'));var db=require(_0x8da6('0x5'))['db'];var utils=require(_0x8da6('0x6'));var logger=require('../../config/logger')(_0x8da6('0x7'));var config=require('../../config/environment');var jayson=require(_0x8da6('0x8'));var client=jayson[_0x8da6('0x9')][_0x8da6('0xa')]({'port':0x232a});config[_0x8da6('0xb')]=_[_0x8da6('0xc')](config[_0x8da6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8da6('0xd'))(new Redis(config[_0x8da6('0xb')]));require('./voiceQueue.socket')[_0x8da6('0xe')](socket);function respondWithRpcPromise(_0x50d88b,_0x589122,_0x2af6eb){return new BPromise(function(_0x2bd949,_0x1afaf2){return client[_0x8da6('0xf')](_0x50d88b,_0x2af6eb)[_0x8da6('0x10')](function(_0x1a05e3){logger[_0x8da6('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x589122,'request\x20sent');logger[_0x8da6('0x12')](_0x8da6('0x13'),_0x589122,_0x8da6('0x14'),JSON[_0x8da6('0x15')](_0x1a05e3));if(_0x1a05e3[_0x8da6('0x16')]){if(_0x1a05e3[_0x8da6('0x16')][_0x8da6('0x17')]===0x1f4){logger[_0x8da6('0x16')](_0x8da6('0x18'),_0x589122,_0x1a05e3[_0x8da6('0x16')][_0x8da6('0x19')]);return _0x1afaf2(_0x1a05e3[_0x8da6('0x16')]['message']);}logger[_0x8da6('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x589122,_0x1a05e3[_0x8da6('0x16')][_0x8da6('0x19')]);return _0x2bd949(_0x1a05e3[_0x8da6('0x16')]['message']);}else{logger['info'](_0x8da6('0x18'),_0x589122,_0x8da6('0x14'));_0x2bd949(_0x1a05e3[_0x8da6('0x1a')][_0x8da6('0x19')]);}})[_0x8da6('0x1b')](function(_0x1805e4){logger[_0x8da6('0x16')](_0x8da6('0x18'),_0x589122,_0x1805e4);_0x1afaf2(_0x1805e4);});});}exports[_0x8da6('0x1c')]=function(_0x4cf58c){var _0x233662=this;return new Promise(function(_0x29fb1e,_0x35be36){return db[_0x8da6('0x1d')][_0x8da6('0x1e')]({'raw':_0x4cf58c['options']?_0x4cf58c[_0x8da6('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4cf58c[_0x8da6('0x1f')]?_0x4cf58c[_0x8da6('0x1f')][_0x8da6('0x20')]||null:null,'attributes':_0x4cf58c[_0x8da6('0x1f')]?_0x4cf58c[_0x8da6('0x1f')][_0x8da6('0x21')]||null:null,'limit':_0x4cf58c[_0x8da6('0x1f')]?_0x4cf58c[_0x8da6('0x1f')][_0x8da6('0x22')]||null:null,'include':_0x4cf58c[_0x8da6('0x1f')]?_0x4cf58c[_0x8da6('0x1f')]['include']?_[_0x8da6('0x23')](_0x4cf58c[_0x8da6('0x1f')][_0x8da6('0x24')],function(_0x5bed39){return{'model':db[_0x5bed39['model']],'as':_0x5bed39['as'],'attributes':_0x5bed39[_0x8da6('0x21')],'include':_0x5bed39['include']?_[_0x8da6('0x23')](_0x5bed39[_0x8da6('0x24')],function(_0x239e47){return{'model':db[_0x239e47[_0x8da6('0x25')]],'as':_0x239e47['as'],'attributes':_0x239e47[_0x8da6('0x21')],'include':_0x239e47[_0x8da6('0x24')]?_[_0x8da6('0x23')](_0x239e47[_0x8da6('0x24')],function(_0x2661e9){return{'model':db[_0x2661e9['model']],'as':_0x2661e9['as'],'attributes':_0x2661e9[_0x8da6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8da6('0x10')](function(_0x22be72){logger[_0x8da6('0x11')](_0x8da6('0x1c'),_0x4cf58c);logger[_0x8da6('0x12')](_0x8da6('0x1c'),_0x4cf58c,JSON['stringify'](_0x22be72));_0x29fb1e(_0x22be72);})['catch'](function(_0x2e6c46){logger[_0x8da6('0x16')]('GetVoiceQueue',_0x2e6c46[_0x8da6('0x19')],_0x4cf58c);_0x35be36(_0x233662[_0x8da6('0x16')](0x1f4,_0x2e6c46[_0x8da6('0x19')]));});});};exports[_0x8da6('0x26')]=function(_0xedb6b5){var _0x5162c6=this;return new Promise(function(_0x39218f,_0x197be7){return db[_0x8da6('0x1d')][_0x8da6('0x27')]({'raw':_0xedb6b5[_0x8da6('0x1f')]?_0xedb6b5['options'][_0x8da6('0x28')]===undefined?!![]:![]:!![],'where':_0xedb6b5['options']?_0xedb6b5['options'][_0x8da6('0x20')]||null:null,'attributes':_0xedb6b5['options']?_0xedb6b5[_0x8da6('0x1f')][_0x8da6('0x21')]||null:null,'include':_0xedb6b5['options']?_0xedb6b5[_0x8da6('0x1f')][_0x8da6('0x24')]?_['map'](_0xedb6b5[_0x8da6('0x1f')][_0x8da6('0x24')],function(_0x51ff75){return{'model':db[_0x51ff75[_0x8da6('0x25')]],'as':_0x51ff75['as'],'attributes':_0x51ff75[_0x8da6('0x21')],'include':_0x51ff75['include']?_[_0x8da6('0x23')](_0x51ff75[_0x8da6('0x24')],function(_0x2591c6){return{'model':db[_0x2591c6['model']],'as':_0x2591c6['as'],'attributes':_0x2591c6[_0x8da6('0x21')],'include':_0x2591c6[_0x8da6('0x24')]?_[_0x8da6('0x23')](_0x2591c6[_0x8da6('0x24')],function(_0x39418e){return{'model':db[_0x39418e[_0x8da6('0x25')]],'as':_0x39418e['as'],'attributes':_0x39418e[_0x8da6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x352002){logger['info'](_0x8da6('0x26'),_0xedb6b5);logger[_0x8da6('0x12')](_0x8da6('0x26'),_0xedb6b5,JSON['stringify'](_0x352002));_0x39218f(_0x352002);})[_0x8da6('0x1b')](function(_0xfc71f2){logger['error']('ShowVoiceQueue',_0xfc71f2['message'],_0xedb6b5);_0x197be7(_0x5162c6[_0x8da6('0x16')](0x1f4,_0xfc71f2[_0x8da6('0x19')]));});});}; \ No newline at end of file +var _0x4e72=['debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','raw','attributes','limit','map','include','model','GetVoiceQueue','ShowVoiceQueue','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3eb43b,_0xebca6c){var _0x202f31=function(_0x49f1bb){while(--_0x49f1bb){_0x3eb43b['push'](_0x3eb43b['shift']());}};_0x202f31(++_0xebca6c);}(_0x4e72,0xb0));var _0x24e7=function(_0x49a13e,_0x5e680d){_0x49a13e=_0x49a13e-0x0;var _0x731dc6=_0x4e72[_0x49a13e];return _0x731dc6;};'use strict';var _=require(_0x24e7('0x0'));var util=require(_0x24e7('0x1'));var moment=require(_0x24e7('0x2'));var BPromise=require(_0x24e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24e7('0x4'));var db=require(_0x24e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x24e7('0x6'))('rpc');var config=require(_0x24e7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x24e7('0x8')][_0x24e7('0x9')]({'port':0x232a});config['redis']=_[_0x24e7('0xa')](config[_0x24e7('0xb')],{'host':_0x24e7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24e7('0xb')]));require(_0x24e7('0xd'))[_0x24e7('0xe')](socket);function respondWithRpcPromise(_0x40f44c,_0x187abe,_0x1fa657){return new BPromise(function(_0x9c963c,_0x123a36){return client[_0x24e7('0xf')](_0x40f44c,_0x1fa657)['then'](function(_0x2e68fc){logger[_0x24e7('0x10')](_0x24e7('0x11'),_0x187abe,_0x24e7('0x12'));logger[_0x24e7('0x13')](_0x24e7('0x14'),_0x187abe,_0x24e7('0x12'),JSON[_0x24e7('0x15')](_0x2e68fc));if(_0x2e68fc[_0x24e7('0x16')]){if(_0x2e68fc[_0x24e7('0x16')][_0x24e7('0x17')]===0x1f4){logger[_0x24e7('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x187abe,_0x2e68fc[_0x24e7('0x16')][_0x24e7('0x18')]);return _0x123a36(_0x2e68fc[_0x24e7('0x16')][_0x24e7('0x18')]);}logger[_0x24e7('0x16')](_0x24e7('0x11'),_0x187abe,_0x2e68fc[_0x24e7('0x16')][_0x24e7('0x18')]);return _0x9c963c(_0x2e68fc[_0x24e7('0x16')]['message']);}else{logger['info'](_0x24e7('0x11'),_0x187abe,'request\x20sent');_0x9c963c(_0x2e68fc[_0x24e7('0x19')][_0x24e7('0x18')]);}})[_0x24e7('0x1a')](function(_0x4dbada){logger[_0x24e7('0x16')](_0x24e7('0x11'),_0x187abe,_0x4dbada);_0x123a36(_0x4dbada);});});}exports['GetVoiceQueue']=function(_0x3b1832){var _0x1de4b2=this;return new Promise(function(_0x5fcada,_0xfe8900){return db[_0x24e7('0x1b')][_0x24e7('0x1c')]({'raw':_0x3b1832[_0x24e7('0x1d')]?_0x3b1832[_0x24e7('0x1d')][_0x24e7('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b1832['options']?_0x3b1832['options']['where']||null:null,'attributes':_0x3b1832[_0x24e7('0x1d')]?_0x3b1832[_0x24e7('0x1d')][_0x24e7('0x1f')]||null:null,'limit':_0x3b1832[_0x24e7('0x1d')]?_0x3b1832[_0x24e7('0x1d')][_0x24e7('0x20')]||null:null,'include':_0x3b1832['options']?_0x3b1832[_0x24e7('0x1d')]['include']?_[_0x24e7('0x21')](_0x3b1832[_0x24e7('0x1d')][_0x24e7('0x22')],function(_0x36cec3){return{'model':db[_0x36cec3[_0x24e7('0x23')]],'as':_0x36cec3['as'],'attributes':_0x36cec3['attributes'],'include':_0x36cec3['include']?_[_0x24e7('0x21')](_0x36cec3[_0x24e7('0x22')],function(_0x427785){return{'model':db[_0x427785['model']],'as':_0x427785['as'],'attributes':_0x427785['attributes'],'include':_0x427785[_0x24e7('0x22')]?_[_0x24e7('0x21')](_0x427785[_0x24e7('0x22')],function(_0x448ad4){return{'model':db[_0x448ad4[_0x24e7('0x23')]],'as':_0x448ad4['as'],'attributes':_0x448ad4[_0x24e7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fef25){logger[_0x24e7('0x10')](_0x24e7('0x24'),_0x3b1832);logger[_0x24e7('0x13')]('GetVoiceQueue',_0x3b1832,JSON[_0x24e7('0x15')](_0x3fef25));_0x5fcada(_0x3fef25);})[_0x24e7('0x1a')](function(_0x7e1e8f){logger[_0x24e7('0x16')]('GetVoiceQueue',_0x7e1e8f[_0x24e7('0x18')],_0x3b1832);_0xfe8900(_0x1de4b2[_0x24e7('0x16')](0x1f4,_0x7e1e8f[_0x24e7('0x18')]));});});};exports[_0x24e7('0x25')]=function(_0x2fcbbb){var _0x3f237f=this;return new Promise(function(_0x18841c,_0x5d45d4){return db[_0x24e7('0x1b')]['find']({'raw':_0x2fcbbb[_0x24e7('0x1d')]?_0x2fcbbb[_0x24e7('0x1d')][_0x24e7('0x1e')]===undefined?!![]:![]:!![],'where':_0x2fcbbb[_0x24e7('0x1d')]?_0x2fcbbb[_0x24e7('0x1d')]['where']||null:null,'attributes':_0x2fcbbb[_0x24e7('0x1d')]?_0x2fcbbb[_0x24e7('0x1d')]['attributes']||null:null,'include':_0x2fcbbb[_0x24e7('0x1d')]?_0x2fcbbb[_0x24e7('0x1d')]['include']?_[_0x24e7('0x21')](_0x2fcbbb[_0x24e7('0x1d')][_0x24e7('0x22')],function(_0x1e9dcb){return{'model':db[_0x1e9dcb[_0x24e7('0x23')]],'as':_0x1e9dcb['as'],'attributes':_0x1e9dcb[_0x24e7('0x1f')],'include':_0x1e9dcb['include']?_[_0x24e7('0x21')](_0x1e9dcb['include'],function(_0x7b4493){return{'model':db[_0x7b4493[_0x24e7('0x23')]],'as':_0x7b4493['as'],'attributes':_0x7b4493[_0x24e7('0x1f')],'include':_0x7b4493[_0x24e7('0x22')]?_[_0x24e7('0x21')](_0x7b4493['include'],function(_0x3397ee){return{'model':db[_0x3397ee[_0x24e7('0x23')]],'as':_0x3397ee['as'],'attributes':_0x3397ee[_0x24e7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x24e7('0x26')](function(_0xd6403){logger[_0x24e7('0x10')](_0x24e7('0x25'),_0x2fcbbb);logger[_0x24e7('0x13')](_0x24e7('0x25'),_0x2fcbbb,JSON['stringify'](_0xd6403));_0x18841c(_0xd6403);})[_0x24e7('0x1a')](function(_0xb51164){logger['error'](_0x24e7('0x25'),_0xb51164['message'],_0x2fcbbb);_0x5d45d4(_0x3f237f[_0x24e7('0x16')](0x1f4,_0xb51164[_0x24e7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7f4bd55..c80f665 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 _0x6982=['register','length','voiceQueue:','./voiceQueue.events','save','remove','update','removeListener'];(function(_0x46bf18,_0x24c5a8){var _0x3798bb=function(_0x47ba00){while(--_0x47ba00){_0x46bf18['push'](_0x46bf18['shift']());}};_0x3798bb(++_0x24c5a8);}(_0x6982,0x1e3));var _0x2698=function(_0x4af4fa,_0xe3089c){_0x4af4fa=_0x4af4fa-0x0;var _0x1eb771=_0x6982[_0x4af4fa];return _0x1eb771;};'use strict';var VoiceQueueEvents=require(_0x2698('0x0'));var events=[_0x2698('0x1'),_0x2698('0x2'),_0x2698('0x3')];function createListener(_0x1e00a5,_0x54e000){return function(_0x4629e4){_0x54e000['emit'](_0x1e00a5,_0x4629e4);};}function removeListener(_0x57e1c0,_0x4feda8){return function(){VoiceQueueEvents[_0x2698('0x4')](_0x57e1c0,_0x4feda8);};}exports[_0x2698('0x5')]=function(_0x4ba62b){for(var _0x1ffe26=0x0,_0x3f2644=events[_0x2698('0x6')];_0x1ffe26<_0x3f2644;_0x1ffe26++){var _0x73359=events[_0x1ffe26];var _0x24eccf=createListener(_0x2698('0x7')+_0x73359,_0x4ba62b);VoiceQueueEvents['on'](_0x73359,_0x24eccf);}}; \ No newline at end of file +var _0x9703=['./voiceQueue.events','save','update','removeListener','length'];(function(_0x4a4b3c,_0x42f623){var _0x126a63=function(_0x5a7124){while(--_0x5a7124){_0x4a4b3c['push'](_0x4a4b3c['shift']());}};_0x126a63(++_0x42f623);}(_0x9703,0x15e));var _0x3970=function(_0x2e0def,_0x11f7df){_0x2e0def=_0x2e0def-0x0;var _0x397c2b=_0x9703[_0x2e0def];return _0x397c2b;};'use strict';var VoiceQueueEvents=require(_0x3970('0x0'));var events=[_0x3970('0x1'),'remove',_0x3970('0x2')];function createListener(_0x1a0a82,_0x1bdc3b){return function(_0x282162){_0x1bdc3b['emit'](_0x1a0a82,_0x282162);};}function removeListener(_0x281bf9,_0x58b012){return function(){VoiceQueueEvents[_0x3970('0x3')](_0x281bf9,_0x58b012);};}exports['register']=function(_0x5ae316){for(var _0x2c6de9=0x0,_0x230dc8=events[_0x3970('0x4')];_0x2c6de9<_0x230dc8;_0x2c6de9++){var _0x46018a=events[_0x2c6de9];var _0x2dea61=createListener('voiceQueue:'+_0x46018a,_0x5ae316);VoiceQueueEvents['on'](_0x46018a,_0x2dea61);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 745c7ee..40d1818 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 _0x07ca=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','describe','/index','isAuthenticated','getVoiceQueuesReport','/:id','show','post','create','put','update','delete'];(function(_0x4fb993,_0x4fd8ef){var _0x348c09=function(_0x38c9da){while(--_0x38c9da){_0x4fb993['push'](_0x4fb993['shift']());}};_0x348c09(++_0x4fd8ef);}(_0x07ca,0x1b2));var _0xa07c=function(_0x457c96,_0x13785c){_0x457c96=_0x457c96-0x0;var _0x4e5ebc=_0x07ca[_0x457c96];return _0x4e5ebc;};'use strict';var multer=require(_0xa07c('0x0'));var util=require(_0xa07c('0x1'));var path=require(_0xa07c('0x2'));var timeout=require(_0xa07c('0x3'));var express=require(_0xa07c('0x4'));var router=express[_0xa07c('0x5')]();var fs_extra=require(_0xa07c('0x6'));var auth=require(_0xa07c('0x7'));var interaction=require(_0xa07c('0x8'));var config=require(_0xa07c('0x9'));var controller=require(_0xa07c('0xa'));router[_0xa07c('0xb')]('/',auth['isAuthenticated'](),controller[_0xa07c('0xc')]);router[_0xa07c('0xb')](_0xa07c('0xd'),auth['isAuthenticated'](),controller[_0xa07c('0xe')]);router['get'](_0xa07c('0xf'),auth[_0xa07c('0x10')](),controller[_0xa07c('0x11')]);router[_0xa07c('0xb')](_0xa07c('0x12'),auth['isAuthenticated'](),controller[_0xa07c('0x13')]);router[_0xa07c('0x14')]('/',auth[_0xa07c('0x10')](),controller[_0xa07c('0x15')]);router[_0xa07c('0x16')](_0xa07c('0x12'),auth['isAuthenticated'](),controller[_0xa07c('0x17')]);router[_0xa07c('0x18')](_0xa07c('0x12'),auth[_0xa07c('0x10')](),controller[_0xa07c('0x19')]);module[_0xa07c('0x1a')]=router; \ No newline at end of file +var _0xc97a=['getVoiceQueuesReport','/:id','show','post','create','put','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/index'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0xc97a,0x183));var _0xac97=function(_0x4f0877,_0x526a6e){_0x4f0877=_0x4f0877-0x0;var _0x50787f=_0xc97a[_0x4f0877];return _0x50787f;};'use strict';var multer=require(_0xac97('0x0'));var util=require(_0xac97('0x1'));var path=require(_0xac97('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac97('0x3')]();var fs_extra=require(_0xac97('0x4'));var auth=require(_0xac97('0x5'));var interaction=require(_0xac97('0x6'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xac97('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xac97('0x7')](_0xac97('0x8'),auth[_0xac97('0x9')](),controller[_0xac97('0xa')]);router[_0xac97('0x7')](_0xac97('0xb'),auth[_0xac97('0x9')](),controller[_0xac97('0xc')]);router['get'](_0xac97('0xd'),auth[_0xac97('0x9')](),controller[_0xac97('0xe')]);router[_0xac97('0xf')]('/',auth[_0xac97('0x9')](),controller[_0xac97('0x10')]);router[_0xac97('0x11')](_0xac97('0xd'),auth[_0xac97('0x9')](),controller['update']);router[_0xac97('0x12')](_0xac97('0xd'),auth[_0xac97('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index e28513f..30f3943 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 _0xe0cc=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xe0cc,0x1cd));var _0xce0c=function(_0x180e4e,_0x1740d3){_0x180e4e=_0x180e4e-0x0;var _0x3410fa=_0xe0cc[_0x180e4e];return _0x3410fa;};'use strict';var Sequelize=require(_0xce0c('0x0'));var moment=require(_0xce0c('0x1'));module[_0xce0c('0x2')]={'type':{'type':Sequelize[_0xce0c('0x3')]},'uniqueid':{'type':Sequelize[_0xce0c('0x3')]},'calleridnum':{'type':Sequelize[_0xce0c('0x3')]},'calleridname':{'type':Sequelize[_0xce0c('0x3')]},'queue':{'type':Sequelize[_0xce0c('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xce0c('0x4')],'set':function(_0x10eb31){var _0x3bbedb=moment(_0x10eb31);var _0x196137=moment(this[_0xce0c('0x5')](_0xce0c('0x6')))[_0xce0c('0x7')](_0xce0c('0x8'));var _0x73c8d1=_0x3bbedb[_0xce0c('0x9')](_0x196137,_0xce0c('0xa'));this['setDataValue']('queuecallerleaveAt',_0x10eb31);this[_0xce0c('0xb')](_0xce0c('0xc'),_0x73c8d1||null);}},'position':{'type':Sequelize[_0xce0c('0xd')]},'count':{'type':Sequelize[_0xce0c('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xce0c('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xce0c('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xce0c('0x4')]},'queuecallerexit':{'type':Sequelize[_0xce0c('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xce0c('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xce0c('0x3')],'comment':_0xce0c('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xce0c('0x3')]},'connectedlinenum':{'type':Sequelize[_0xce0c('0x3')]},'connectedlinename':{'type':Sequelize[_0xce0c('0x3')]},'accountcode':{'type':Sequelize[_0xce0c('0x3')]},'context':{'type':Sequelize[_0xce0c('0x3')]},'exten':{'type':Sequelize[_0xce0c('0x3')]},'priority':{'type':Sequelize[_0xce0c('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xce0c('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xce0c('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xce0c('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xce0c('0x3')],'comment':_0xce0c('0x10')},'transferexten':{'type':Sequelize[_0xce0c('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xce0c('0x3')]},'secondDisposition':{'type':Sequelize[_0xce0c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xce0c('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xce0c('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1bfb=['seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x5e2aaf,_0x5ee3e3){var _0x508383=function(_0x5ea4a7){while(--_0x5ea4a7){_0x5e2aaf['push'](_0x5e2aaf['shift']());}};_0x508383(++_0x5ee3e3);}(_0x1bfb,0x15b));var _0xb1bf=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x1bfb[_0x219d87];return _0x22823d;};'use strict';var Sequelize=require(_0xb1bf('0x0'));var moment=require(_0xb1bf('0x1'));module[_0xb1bf('0x2')]={'type':{'type':Sequelize[_0xb1bf('0x3')]},'uniqueid':{'type':Sequelize[_0xb1bf('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb1bf('0x3')]},'queue':{'type':Sequelize[_0xb1bf('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xb1bf('0x4')],'set':function(_0x51940f){var _0x4c7376=moment(_0x51940f);var _0xfa957b=moment(this[_0xb1bf('0x5')](_0xb1bf('0x6')))[_0xb1bf('0x7')](_0xb1bf('0x8'));var _0x256d7d=_0x4c7376[_0xb1bf('0x9')](_0xfa957b,_0xb1bf('0xa'));this['setDataValue']('queuecallerleaveAt',_0x51940f);this[_0xb1bf('0xb')](_0xb1bf('0xc'),_0x256d7d||null);}},'position':{'type':Sequelize[_0xb1bf('0xd')]},'count':{'type':Sequelize[_0xb1bf('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xb1bf('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb1bf('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xb1bf('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xb1bf('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xb1bf('0x3')],'comment':_0xb1bf('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xb1bf('0x3')]},'connectedlinenum':{'type':Sequelize[_0xb1bf('0x3')]},'connectedlinename':{'type':Sequelize[_0xb1bf('0x3')]},'accountcode':{'type':Sequelize[_0xb1bf('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb1bf('0x3')]},'priority':{'type':Sequelize[_0xb1bf('0x3')]},'holdtime':{'type':Sequelize[_0xb1bf('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb1bf('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb1bf('0x3')]},'transfer':{'type':Sequelize[_0xb1bf('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb1bf('0x3')],'comment':_0xb1bf('0x10')},'transferexten':{'type':Sequelize[_0xb1bf('0x3')]},'transferuniqueid':{'type':Sequelize[_0xb1bf('0x3')]},'disposition':{'type':Sequelize[_0xb1bf('0x3')]},'secondDisposition':{'type':Sequelize[_0xb1bf('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb1bf('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 5514995..256b8d3 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 _0x62f8=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','findAll','rows','show','params','fields','includeAll','include','find','create','catch','body','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus'];(function(_0x275386,_0x506260){var _0x58e8b4=function(_0x3aab63){while(--_0x3aab63){_0x275386['push'](_0x275386['shift']());}};_0x58e8b4(++_0x506260);}(_0x62f8,0x83));var _0x862f=function(_0x10bdbe,_0x249c38){_0x10bdbe=_0x10bdbe-0x0;var _0x2bdb9d=_0x62f8[_0x10bdbe];return _0x2bdb9d;};'use strict';var emlformat=require(_0x862f('0x0'));var rimraf=require(_0x862f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x862f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x862f('0x3'));var Mustache=require(_0x862f('0x4'));var util=require(_0x862f('0x5'));var path=require(_0x862f('0x6'));var sox=require(_0x862f('0x7'));var csv=require('to-csv');var ejs=require(_0x862f('0x8'));var fs=require('fs');var fs_extra=require(_0x862f('0x9'));var _=require(_0x862f('0xa'));var squel=require(_0x862f('0xb'));var crypto=require(_0x862f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x862f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x862f('0xe'));var Papa=require('papaparse');var Redis=require(_0x862f('0xf'));var authService=require(_0x862f('0x10'));var qs=require(_0x862f('0x11'));var as=require(_0x862f('0x12'));var hardwareService=require(_0x862f('0x13'));var logger=require(_0x862f('0x14'))('api');var utils=require(_0x862f('0x15'));var config=require(_0x862f('0x16'));var licenseUtil=require(_0x862f('0x17'));var db=require('../../mysqldb')['db'];config[_0x862f('0x18')]=_[_0x862f('0x19')](config[_0x862f('0x18')],{'host':_0x862f('0x1a'),'port':0x18eb});var socket=require(_0x862f('0x1b'))(new Redis(config[_0x862f('0x18')]));require(_0x862f('0x1c'))[_0x862f('0x1d')](socket);function respondWithStatusCode(_0x4bb784,_0x3356ee){_0x3356ee=_0x3356ee||0xcc;return function(_0x5bbfe9){if(_0x5bbfe9){return _0x4bb784[_0x862f('0x1e')](_0x3356ee);}return _0x4bb784[_0x862f('0x1f')](_0x3356ee)[_0x862f('0x20')]();};}function respondWithResult(_0x447ca8,_0x2f8a00){_0x2f8a00=_0x2f8a00||0xc8;return function(_0x400a8c){if(_0x400a8c){return _0x447ca8[_0x862f('0x1f')](_0x2f8a00)[_0x862f('0x21')](_0x400a8c);}};}function respondWithFilteredResult(_0x17127b,_0x113e49){return function(_0x3cd2a9){if(_0x3cd2a9){var _0x392ff4=typeof _0x113e49[_0x862f('0x22')]===_0x862f('0x23')&&typeof _0x113e49[_0x862f('0x24')]===_0x862f('0x23');var _0x3f321f=_0x3cd2a9[_0x862f('0x25')];var _0x5471cb=_0x392ff4?0x0:_0x113e49['offset'];var _0x377184=_0x392ff4?_0x3cd2a9['count']:_0x113e49[_0x862f('0x22')]+_0x113e49[_0x862f('0x24')];var _0x3cab45;if(_0x377184>=_0x3f321f){_0x377184=_0x3f321f;_0x3cab45=0xc8;}else{_0x3cab45=0xce;}_0x17127b[_0x862f('0x1f')](_0x3cab45);return _0x17127b[_0x862f('0x26')](_0x862f('0x27'),_0x5471cb+'-'+_0x377184+'/'+_0x3f321f)[_0x862f('0x21')](_0x3cd2a9);}return null;};}function patchUpdates(_0x316102){return function(_0xdac28){try{jsonpatch[_0x862f('0x28')](_0xdac28,_0x316102,!![]);}catch(_0xdc7b96){return BPromise[_0x862f('0x29')](_0xdc7b96);}return _0xdac28['save']();};}function saveUpdates(_0x3cf923,_0x4471b1){return function(_0x1331d3){if(_0x1331d3){return _0x1331d3['update'](_0x3cf923)[_0x862f('0x2a')](function(_0x3daac7){return _0x3daac7;});}return null;};}function removeEntity(_0x44944e,_0x5372b8){return function(_0x1eafcb){if(_0x1eafcb){return _0x1eafcb['destroy']()[_0x862f('0x2a')](function(){_0x44944e[_0x862f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd86f,_0x1a782b){return function(_0x12417a){if(!_0x12417a){_0x2cd86f[_0x862f('0x1e')](0x194);}return _0x12417a;};}function handleError(_0x9fbf4f,_0x437982){_0x437982=_0x437982||0x1f4;return function(_0x1782ab){logger['error'](_0x1782ab[_0x862f('0x2b')]);if(_0x1782ab[_0x862f('0x2c')]){delete _0x1782ab[_0x862f('0x2c')];}_0x9fbf4f[_0x862f('0x1f')](_0x437982)['send'](_0x1782ab);};}exports[_0x862f('0x2d')]=function(_0x41d805,_0x3b70c){var _0xc2f02b={},_0xb313b3={},_0x20f074={'count':0x0,'rows':[]};var _0x55eccc=_[_0x862f('0x2e')](db['VoiceQueueReport'][_0x862f('0x2f')],function(_0x316c75){return{'name':_0x316c75[_0x862f('0x30')],'type':_0x316c75[_0x862f('0x31')]['key']};});_0xb313b3[_0x862f('0x32')]=_[_0x862f('0x2e')](_0x55eccc,_0x862f('0x2c'));_0xb313b3[_0x862f('0x33')]=_[_0x862f('0x34')](_0x41d805['query']);_0xb313b3[_0x862f('0x35')]=_[_0x862f('0x36')](_0xb313b3[_0x862f('0x32')],_0xb313b3[_0x862f('0x33')]);_0xc2f02b[_0x862f('0x37')]=_['intersection'](_0xb313b3[_0x862f('0x32')],qs['fields'](_0x41d805[_0x862f('0x33')]['fields']));_0xc2f02b['attributes']=_0xc2f02b[_0x862f('0x37')][_0x862f('0x38')]?_0xc2f02b[_0x862f('0x37')]:_0xb313b3[_0x862f('0x32')];if(!_0x41d805[_0x862f('0x33')][_0x862f('0x39')](_0x862f('0x3a'))){_0xc2f02b[_0x862f('0x24')]=qs[_0x862f('0x24')](_0x41d805[_0x862f('0x33')][_0x862f('0x24')]);_0xc2f02b[_0x862f('0x22')]=qs[_0x862f('0x22')](_0x41d805[_0x862f('0x33')][_0x862f('0x22')]);}_0xc2f02b[_0x862f('0x3b')]=qs[_0x862f('0x3c')](_0x41d805[_0x862f('0x33')][_0x862f('0x3c')]);_0xc2f02b[_0x862f('0x3d')]=qs['filters'](_[_0x862f('0x3e')](_0x41d805['query'],_0xb313b3[_0x862f('0x35')]),_0x55eccc);if(_0x41d805['query'][_0x862f('0x3f')]){_0xc2f02b[_0x862f('0x3d')]=_[_0x862f('0x40')](_0xc2f02b[_0x862f('0x3d')],{'$or':_[_0x862f('0x2e')](_0x55eccc,function(_0x2cd922){if(_0x2cd922[_0x862f('0x31')]!==_0x862f('0x41')){var _0x24827f={};_0x24827f[_0x2cd922['name']]={'$like':'%'+_0x41d805[_0x862f('0x33')][_0x862f('0x3f')]+'%'};return _0x24827f;}})});}_0xc2f02b=_['merge']({},_0xc2f02b,_0x41d805[_0x862f('0x42')]);var _0x2ef6d3={'where':_0xc2f02b['where']};return db[_0x862f('0x43')][_0x862f('0x25')](_0x2ef6d3)[_0x862f('0x2a')](function(_0x5a77bf){_0x20f074[_0x862f('0x25')]=_0x5a77bf;if(_0x41d805[_0x862f('0x33')]['includeAll']){_0xc2f02b['include']=[{'all':!![]}];}return db[_0x862f('0x43')][_0x862f('0x44')](_0xc2f02b);})[_0x862f('0x2a')](function(_0x1570b1){_0x20f074[_0x862f('0x45')]=_0x1570b1;return _0x20f074;})[_0x862f('0x2a')](respondWithFilteredResult(_0x3b70c,_0xc2f02b))['catch'](handleError(_0x3b70c,null));};exports[_0x862f('0x46')]=function(_0x459581,_0x331a0a){var _0x266df6={'raw':![],'where':{'id':_0x459581[_0x862f('0x47')]['id']}},_0xe44d1d={};_0xe44d1d['model']=_[_0x862f('0x34')](db[_0x862f('0x43')][_0x862f('0x2f')]);_0xe44d1d[_0x862f('0x33')]=_[_0x862f('0x34')](_0x459581['query']);_0xe44d1d['filters']=_[_0x862f('0x36')](_0xe44d1d[_0x862f('0x32')],_0xe44d1d[_0x862f('0x33')]);_0x266df6['attributes']=_['intersection'](_0xe44d1d[_0x862f('0x32')],qs[_0x862f('0x48')](_0x459581['query']['fields']));_0x266df6[_0x862f('0x37')]=_0x266df6[_0x862f('0x37')][_0x862f('0x38')]?_0x266df6[_0x862f('0x37')]:_0xe44d1d[_0x862f('0x32')];if(_0x459581['query'][_0x862f('0x49')]){_0x266df6[_0x862f('0x4a')]=[{'all':!![]}];}_0x266df6=_[_0x862f('0x40')]({},_0x266df6,_0x459581[_0x862f('0x42')]);return db[_0x862f('0x43')][_0x862f('0x4b')](_0x266df6)['then'](handleEntityNotFound(_0x331a0a,null))[_0x862f('0x2a')](respondWithResult(_0x331a0a,null))['catch'](handleError(_0x331a0a,null));};exports[_0x862f('0x4c')]=function(_0x244eda,_0x4c1173){return db[_0x862f('0x43')][_0x862f('0x4c')](_0x244eda['body'],{})[_0x862f('0x2a')](respondWithResult(_0x4c1173,0xc9))[_0x862f('0x4d')](handleError(_0x4c1173,null));};exports['update']=function(_0x77d924,_0x1f36c8){if(_0x77d924[_0x862f('0x4e')]['id']){delete _0x77d924['body']['id'];}return db[_0x862f('0x43')][_0x862f('0x4b')]({'where':{'id':_0x77d924[_0x862f('0x47')]['id']}})[_0x862f('0x2a')](handleEntityNotFound(_0x1f36c8,null))[_0x862f('0x2a')](saveUpdates(_0x77d924['body'],null))[_0x862f('0x2a')](respondWithResult(_0x1f36c8,null))[_0x862f('0x4d')](handleError(_0x1f36c8,null));};exports['destroy']=function(_0x4f63a2,_0x4a95d1){return db[_0x862f('0x43')][_0x862f('0x4b')]({'where':{'id':_0x4f63a2[_0x862f('0x47')]['id']}})[_0x862f('0x2a')](handleEntityNotFound(_0x4a95d1,null))[_0x862f('0x2a')](removeEntity(_0x4a95d1,null))[_0x862f('0x4d')](handleError(_0x4a95d1,null));};exports[_0x862f('0x4f')]=function(_0x24c93b,_0x5db55b){return db[_0x862f('0x43')][_0x862f('0x4f')]()[_0x862f('0x2a')](respondWithResult(_0x5db55b,null))[_0x862f('0x4d')](handleError(_0x5db55b,null));};exports['getVoiceQueuesReport']=function(_0x43d999,_0x279ee3){var _0x2c52b7={},_0x3dd2c9={},_0x19b64b={'count':0x0,'rows':[]};_0x3dd2c9['model']=_[_0x862f('0x34')](db[_0x862f('0x43')][_0x862f('0x2f')]);_0x3dd2c9[_0x862f('0x33')]=_[_0x862f('0x34')](_0x43d999['query']);_0x3dd2c9[_0x862f('0x35')]=_['intersection'](_0x3dd2c9[_0x862f('0x32')],_0x3dd2c9[_0x862f('0x33')]);_0x2c52b7[_0x862f('0x37')]=_[_0x862f('0x36')](_0x3dd2c9[_0x862f('0x32')],qs[_0x862f('0x48')](_0x43d999[_0x862f('0x33')][_0x862f('0x48')]));_0x2c52b7[_0x862f('0x37')]=_0x2c52b7[_0x862f('0x37')]['length']?_0x2c52b7[_0x862f('0x37')]:_0x3dd2c9[_0x862f('0x32')];if(!_0x43d999[_0x862f('0x33')][_0x862f('0x39')](_0x862f('0x3a'))){_0x2c52b7[_0x862f('0x24')]=qs[_0x862f('0x24')](_0x43d999[_0x862f('0x33')][_0x862f('0x24')]);_0x2c52b7[_0x862f('0x22')]=qs[_0x862f('0x22')](_0x43d999[_0x862f('0x33')]['offset']);}_0x2c52b7[_0x862f('0x3b')]=qs[_0x862f('0x3c')](_0x43d999['query'][_0x862f('0x3c')]);_0x2c52b7[_0x862f('0x3d')]=qs[_0x862f('0x35')](_[_0x862f('0x3e')](_0x43d999[_0x862f('0x33')],_0x3dd2c9['filters']));if(_0x43d999[_0x862f('0x33')][_0x862f('0x3f')]){_0x2c52b7[_0x862f('0x3d')]=_[_0x862f('0x40')](_0x2c52b7[_0x862f('0x3d')],{'$or':_[_0x862f('0x2e')](_0x2c52b7['attributes'],function(_0x3d2372){var _0x101ead={};_0x101ead[_0x3d2372]={'$like':'%'+_0x43d999['query'][_0x862f('0x3f')]+'%'};return _0x101ead;})});}_0x2c52b7=_[_0x862f('0x40')]({},_0x2c52b7,_0x43d999[_0x862f('0x42')]);var _0x24b494={'where':_0x2c52b7[_0x862f('0x3d')]};return db[_0x862f('0x43')][_0x862f('0x25')](_0x24b494)[_0x862f('0x2a')](function(_0x3331e7){_0x19b64b[_0x862f('0x25')]=_0x3331e7;if(_0x43d999['query'][_0x862f('0x49')]){_0x2c52b7['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x862f('0x44')](_0x2c52b7);})[_0x862f('0x2a')](function(_0x26d39d){_0x19b64b[_0x862f('0x45')]=_0x26d39d;return _0x19b64b;})[_0x862f('0x2a')](respondWithFilteredResult(_0x279ee3,_0x2c52b7,_0x862f('0x50')))[_0x862f('0x4d')](handleError(_0x279ee3,null,_0x862f('0x50')));}; \ No newline at end of file +var _0xd91b=['type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','describe','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','error','name','send','index','map','VoiceQueueReport','fieldName'];(function(_0x5e2ac3,_0x130ab1){var _0xe8416d=function(_0x1e459c){while(--_0x1e459c){_0x5e2ac3['push'](_0x5e2ac3['shift']());}};_0xe8416d(++_0x130ab1);}(_0xd91b,0x70));var _0xbd91=function(_0x485d87,_0x2f97ea){_0x485d87=_0x485d87-0x0;var _0x2287bc=_0xd91b[_0x485d87];return _0x2287bc;};'use strict';var emlformat=require(_0xbd91('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd91('0x1'));var jsonpatch=require(_0xbd91('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd91('0x3'));var Mustache=require(_0xbd91('0x4'));var util=require(_0xbd91('0x5'));var path=require(_0xbd91('0x6'));var sox=require(_0xbd91('0x7'));var csv=require(_0xbd91('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd91('0x9'));var _=require(_0xbd91('0xa'));var squel=require(_0xbd91('0xb'));var crypto=require(_0xbd91('0xc'));var jsforce=require(_0xbd91('0xd'));var deskjs=require(_0xbd91('0xe'));var toCsv=require(_0xbd91('0x8'));var querystring=require(_0xbd91('0xf'));var Papa=require(_0xbd91('0x10'));var Redis=require(_0xbd91('0x11'));var authService=require(_0xbd91('0x12'));var qs=require(_0xbd91('0x13'));var as=require(_0xbd91('0x14'));var hardwareService=require(_0xbd91('0x15'));var logger=require(_0xbd91('0x16'))('api');var utils=require(_0xbd91('0x17'));var config=require(_0xbd91('0x18'));var licenseUtil=require(_0xbd91('0x19'));var db=require(_0xbd91('0x1a'))['db'];config[_0xbd91('0x1b')]=_['defaults'](config['redis'],{'host':_0xbd91('0x1c'),'port':0x18eb});var socket=require(_0xbd91('0x1d'))(new Redis(config[_0xbd91('0x1b')]));require(_0xbd91('0x1e'))[_0xbd91('0x1f')](socket);function respondWithStatusCode(_0x5e8a6c,_0x160987){_0x160987=_0x160987||0xcc;return function(_0x2009f5){if(_0x2009f5){return _0x5e8a6c[_0xbd91('0x20')](_0x160987);}return _0x5e8a6c['status'](_0x160987)[_0xbd91('0x21')]();};}function respondWithResult(_0x1af1f4,_0x3b316f){_0x3b316f=_0x3b316f||0xc8;return function(_0x4ab7b6){if(_0x4ab7b6){return _0x1af1f4[_0xbd91('0x22')](_0x3b316f)[_0xbd91('0x23')](_0x4ab7b6);}};}function respondWithFilteredResult(_0x27d802,_0x3e69ec){return function(_0x34d126){if(_0x34d126){var _0x2c0095=typeof _0x3e69ec[_0xbd91('0x24')]==='undefined'&&typeof _0x3e69ec['limit']===_0xbd91('0x25');var _0x97e365=_0x34d126[_0xbd91('0x26')];var _0x85e9b7=_0x2c0095?0x0:_0x3e69ec[_0xbd91('0x24')];var _0x1a7753=_0x2c0095?_0x34d126['count']:_0x3e69ec['offset']+_0x3e69ec[_0xbd91('0x27')];var _0x37d219;if(_0x1a7753>=_0x97e365){_0x1a7753=_0x97e365;_0x37d219=0xc8;}else{_0x37d219=0xce;}_0x27d802[_0xbd91('0x22')](_0x37d219);return _0x27d802['set'](_0xbd91('0x28'),_0x85e9b7+'-'+_0x1a7753+'/'+_0x97e365)[_0xbd91('0x23')](_0x34d126);}return null;};}function patchUpdates(_0x43b492){return function(_0xe82f3c){try{jsonpatch['apply'](_0xe82f3c,_0x43b492,!![]);}catch(_0x475020){return BPromise[_0xbd91('0x29')](_0x475020);}return _0xe82f3c[_0xbd91('0x2a')]();};}function saveUpdates(_0x1fcb3d,_0x4f0a6b){return function(_0x2f5990){if(_0x2f5990){return _0x2f5990[_0xbd91('0x2b')](_0x1fcb3d)[_0xbd91('0x2c')](function(_0x2be7e3){return _0x2be7e3;});}return null;};}function removeEntity(_0x4915e7,_0x25033b){return function(_0x141c2d){if(_0x141c2d){return _0x141c2d['destroy']()[_0xbd91('0x2c')](function(){_0x4915e7['status'](0xcc)[_0xbd91('0x21')]();});}};}function handleEntityNotFound(_0x2b25ad,_0x8a0b5c){return function(_0x51ba51){if(!_0x51ba51){_0x2b25ad[_0xbd91('0x20')](0x194);}return _0x51ba51;};}function handleError(_0x1138a7,_0x5f2466){_0x5f2466=_0x5f2466||0x1f4;return function(_0x2ec8dd){logger[_0xbd91('0x2d')](_0x2ec8dd['stack']);if(_0x2ec8dd[_0xbd91('0x2e')]){delete _0x2ec8dd['name'];}_0x1138a7[_0xbd91('0x22')](_0x5f2466)[_0xbd91('0x2f')](_0x2ec8dd);};}exports[_0xbd91('0x30')]=function(_0x2afeee,_0xcc14c7){var _0x3b6ff9={},_0x4a12f4={},_0x5cdda1={'count':0x0,'rows':[]};var _0x48e912=_[_0xbd91('0x31')](db[_0xbd91('0x32')]['rawAttributes'],function(_0x7846a0){return{'name':_0x7846a0[_0xbd91('0x33')],'type':_0x7846a0[_0xbd91('0x34')][_0xbd91('0x35')]};});_0x4a12f4[_0xbd91('0x36')]=_[_0xbd91('0x31')](_0x48e912,'name');_0x4a12f4[_0xbd91('0x37')]=_[_0xbd91('0x38')](_0x2afeee[_0xbd91('0x37')]);_0x4a12f4[_0xbd91('0x39')]=_['intersection'](_0x4a12f4[_0xbd91('0x36')],_0x4a12f4[_0xbd91('0x37')]);_0x3b6ff9[_0xbd91('0x3a')]=_['intersection'](_0x4a12f4[_0xbd91('0x36')],qs[_0xbd91('0x3b')](_0x2afeee[_0xbd91('0x37')]['fields']));_0x3b6ff9['attributes']=_0x3b6ff9[_0xbd91('0x3a')][_0xbd91('0x3c')]?_0x3b6ff9[_0xbd91('0x3a')]:_0x4a12f4[_0xbd91('0x36')];if(!_0x2afeee['query'][_0xbd91('0x3d')](_0xbd91('0x3e'))){_0x3b6ff9[_0xbd91('0x27')]=qs[_0xbd91('0x27')](_0x2afeee['query'][_0xbd91('0x27')]);_0x3b6ff9['offset']=qs[_0xbd91('0x24')](_0x2afeee[_0xbd91('0x37')][_0xbd91('0x24')]);}_0x3b6ff9[_0xbd91('0x3f')]=qs[_0xbd91('0x40')](_0x2afeee['query'][_0xbd91('0x40')]);_0x3b6ff9[_0xbd91('0x41')]=qs[_0xbd91('0x39')](_[_0xbd91('0x42')](_0x2afeee[_0xbd91('0x37')],_0x4a12f4[_0xbd91('0x39')]),_0x48e912);if(_0x2afeee[_0xbd91('0x37')][_0xbd91('0x43')]){_0x3b6ff9[_0xbd91('0x41')]=_[_0xbd91('0x44')](_0x3b6ff9[_0xbd91('0x41')],{'$or':_[_0xbd91('0x31')](_0x48e912,function(_0x9ebb25){if(_0x9ebb25['type']!=='VIRTUAL'){var _0x3b917b={};_0x3b917b[_0x9ebb25['name']]={'$like':'%'+_0x2afeee[_0xbd91('0x37')][_0xbd91('0x43')]+'%'};return _0x3b917b;}})});}_0x3b6ff9=_[_0xbd91('0x44')]({},_0x3b6ff9,_0x2afeee[_0xbd91('0x45')]);var _0x41ecfc={'where':_0x3b6ff9[_0xbd91('0x41')]};return db[_0xbd91('0x32')]['count'](_0x41ecfc)[_0xbd91('0x2c')](function(_0x4f9dd1){_0x5cdda1[_0xbd91('0x26')]=_0x4f9dd1;if(_0x2afeee[_0xbd91('0x37')][_0xbd91('0x46')]){_0x3b6ff9[_0xbd91('0x47')]=[{'all':!![]}];}return db[_0xbd91('0x32')]['findAll'](_0x3b6ff9);})[_0xbd91('0x2c')](function(_0x414f59){_0x5cdda1[_0xbd91('0x48')]=_0x414f59;return _0x5cdda1;})['then'](respondWithFilteredResult(_0xcc14c7,_0x3b6ff9))[_0xbd91('0x49')](handleError(_0xcc14c7,null));};exports[_0xbd91('0x4a')]=function(_0x20b68a,_0x4820bf){var _0x38ba52={'raw':![],'where':{'id':_0x20b68a[_0xbd91('0x4b')]['id']}},_0x511707={};_0x511707[_0xbd91('0x36')]=_['keys'](db[_0xbd91('0x32')]['rawAttributes']);_0x511707[_0xbd91('0x37')]=_['keys'](_0x20b68a[_0xbd91('0x37')]);_0x511707[_0xbd91('0x39')]=_[_0xbd91('0x4c')](_0x511707[_0xbd91('0x36')],_0x511707[_0xbd91('0x37')]);_0x38ba52[_0xbd91('0x3a')]=_[_0xbd91('0x4c')](_0x511707[_0xbd91('0x36')],qs['fields'](_0x20b68a[_0xbd91('0x37')][_0xbd91('0x3b')]));_0x38ba52[_0xbd91('0x3a')]=_0x38ba52[_0xbd91('0x3a')][_0xbd91('0x3c')]?_0x38ba52[_0xbd91('0x3a')]:_0x511707[_0xbd91('0x36')];if(_0x20b68a['query'][_0xbd91('0x46')]){_0x38ba52[_0xbd91('0x47')]=[{'all':!![]}];}_0x38ba52=_[_0xbd91('0x44')]({},_0x38ba52,_0x20b68a[_0xbd91('0x45')]);return db[_0xbd91('0x32')][_0xbd91('0x4d')](_0x38ba52)[_0xbd91('0x2c')](handleEntityNotFound(_0x4820bf,null))['then'](respondWithResult(_0x4820bf,null))[_0xbd91('0x49')](handleError(_0x4820bf,null));};exports[_0xbd91('0x4e')]=function(_0xaccc1e,_0x304149){return db[_0xbd91('0x32')][_0xbd91('0x4e')](_0xaccc1e[_0xbd91('0x4f')],{})['then'](respondWithResult(_0x304149,0xc9))[_0xbd91('0x49')](handleError(_0x304149,null));};exports[_0xbd91('0x2b')]=function(_0x3f63ac,_0x2c6ef5){if(_0x3f63ac['body']['id']){delete _0x3f63ac['body']['id'];}return db[_0xbd91('0x32')][_0xbd91('0x4d')]({'where':{'id':_0x3f63ac['params']['id']}})[_0xbd91('0x2c')](handleEntityNotFound(_0x2c6ef5,null))['then'](saveUpdates(_0x3f63ac[_0xbd91('0x4f')],null))[_0xbd91('0x2c')](respondWithResult(_0x2c6ef5,null))[_0xbd91('0x49')](handleError(_0x2c6ef5,null));};exports['destroy']=function(_0x5bc0d8,_0x324952){return db[_0xbd91('0x32')][_0xbd91('0x4d')]({'where':{'id':_0x5bc0d8[_0xbd91('0x4b')]['id']}})[_0xbd91('0x2c')](handleEntityNotFound(_0x324952,null))[_0xbd91('0x2c')](removeEntity(_0x324952,null))['catch'](handleError(_0x324952,null));};exports['describe']=function(_0xb3b16a,_0x587322){return db[_0xbd91('0x32')][_0xbd91('0x50')]()[_0xbd91('0x2c')](respondWithResult(_0x587322,null))[_0xbd91('0x49')](handleError(_0x587322,null));};exports[_0xbd91('0x51')]=function(_0x2feef3,_0xcf652b){var _0x1e99ce={},_0x233d47={},_0x45af44={'count':0x0,'rows':[]};_0x233d47[_0xbd91('0x36')]=_[_0xbd91('0x38')](db[_0xbd91('0x32')]['rawAttributes']);_0x233d47[_0xbd91('0x37')]=_[_0xbd91('0x38')](_0x2feef3[_0xbd91('0x37')]);_0x233d47[_0xbd91('0x39')]=_[_0xbd91('0x4c')](_0x233d47[_0xbd91('0x36')],_0x233d47[_0xbd91('0x37')]);_0x1e99ce[_0xbd91('0x3a')]=_[_0xbd91('0x4c')](_0x233d47[_0xbd91('0x36')],qs[_0xbd91('0x3b')](_0x2feef3[_0xbd91('0x37')][_0xbd91('0x3b')]));_0x1e99ce[_0xbd91('0x3a')]=_0x1e99ce[_0xbd91('0x3a')][_0xbd91('0x3c')]?_0x1e99ce['attributes']:_0x233d47['model'];if(!_0x2feef3[_0xbd91('0x37')][_0xbd91('0x3d')](_0xbd91('0x3e'))){_0x1e99ce[_0xbd91('0x27')]=qs['limit'](_0x2feef3[_0xbd91('0x37')][_0xbd91('0x27')]);_0x1e99ce[_0xbd91('0x24')]=qs['offset'](_0x2feef3['query'][_0xbd91('0x24')]);}_0x1e99ce[_0xbd91('0x3f')]=qs[_0xbd91('0x40')](_0x2feef3['query'][_0xbd91('0x40')]);_0x1e99ce[_0xbd91('0x41')]=qs[_0xbd91('0x39')](_['pick'](_0x2feef3[_0xbd91('0x37')],_0x233d47[_0xbd91('0x39')]));if(_0x2feef3[_0xbd91('0x37')]['filter']){_0x1e99ce[_0xbd91('0x41')]=_[_0xbd91('0x44')](_0x1e99ce[_0xbd91('0x41')],{'$or':_['map'](_0x1e99ce[_0xbd91('0x3a')],function(_0x4ebbf5){var _0x354312={};_0x354312[_0x4ebbf5]={'$like':'%'+_0x2feef3[_0xbd91('0x37')][_0xbd91('0x43')]+'%'};return _0x354312;})});}_0x1e99ce=_[_0xbd91('0x44')]({},_0x1e99ce,_0x2feef3[_0xbd91('0x45')]);var _0x1f0583={'where':_0x1e99ce[_0xbd91('0x41')]};return db[_0xbd91('0x32')]['count'](_0x1f0583)[_0xbd91('0x2c')](function(_0x23fe7e){_0x45af44[_0xbd91('0x26')]=_0x23fe7e;if(_0x2feef3['query'][_0xbd91('0x46')]){_0x1e99ce[_0xbd91('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x1e99ce);})[_0xbd91('0x2c')](function(_0x2861d9){_0x45af44[_0xbd91('0x48')]=_0x2861d9;return _0x45af44;})[_0xbd91('0x2c')](respondWithFilteredResult(_0xcf652b,_0x1e99ce,_0xbd91('0x51')))['catch'](handleError(_0xcf652b,null,_0xbd91('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ee691f3..b15dbaa 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 _0x68a2=['events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','hook'];(function(_0x450275,_0x7abe4c){var _0x2076d4=function(_0xee579c){while(--_0xee579c){_0x450275['push'](_0x450275['shift']());}};_0x2076d4(++_0x7abe4c);}(_0x68a2,0x1a8));var _0x268a=function(_0x4723eb,_0x7f6b1e){_0x4723eb=_0x4723eb-0x0;var _0x37e188=_0x68a2[_0x4723eb];return _0x37e188;};'use strict';var EventEmitter=require(_0x268a('0x0'));var VoiceQueueReport=require(_0x268a('0x1'))['db'][_0x268a('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x268a('0x3'),'afterUpdate':_0x268a('0x4'),'afterDestroy':_0x268a('0x5')};function emitEvent(_0x1e967f){return function(_0x4cba00,_0xd72f64,_0x26137f){VoiceQueueReportEvents[_0x268a('0x6')](_0x1e967f+':'+_0x4cba00['id'],_0x4cba00);VoiceQueueReportEvents[_0x268a('0x6')](_0x1e967f,_0x4cba00);_0x26137f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x268a('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x8461=['remove','emit','hasOwnProperty','hook','exports','events','update'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x8461,0x147));var _0x1846=function(_0x14aee3,_0x4be548){_0x14aee3=_0x14aee3-0x0;var _0x58954c=_0x8461[_0x14aee3];return _0x58954c;};'use strict';var EventEmitter=require(_0x1846('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1846('0x1'),'afterDestroy':_0x1846('0x2')};function emitEvent(_0x5743ad){return function(_0x4b887d,_0x15e464,_0x497c46){VoiceQueueReportEvents[_0x1846('0x3')](_0x5743ad+':'+_0x4b887d['id'],_0x4b887d);VoiceQueueReportEvents['emit'](_0x5743ad,_0x4b887d);_0x497c46(null);};}for(var e in events){if(events[_0x1846('0x4')](e)){var event=events[e];VoiceQueueReport[_0x1846('0x5')](e,emitEvent(event));}}module[_0x1846('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 60fc014..8e79176 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 _0x4e39=['report_queue','uniqueid','calleridnum','util','../../config/logger','api','moment','bluebird','define','VoiceQueueReport'];(function(_0x37cf3f,_0x233853){var _0x4f47e1=function(_0x103d63){while(--_0x103d63){_0x37cf3f['push'](_0x37cf3f['shift']());}};_0x4f47e1(++_0x233853);}(_0x4e39,0xfd));var _0x94e3=function(_0x56aa66,_0x1ddf52){_0x56aa66=_0x56aa66-0x0;var _0xeba9ff=_0x4e39[_0x56aa66];return _0xeba9ff;};'use strict';var _=require('lodash');var util=require(_0x94e3('0x0'));var logger=require(_0x94e3('0x1'))(_0x94e3('0x2'));var moment=require(_0x94e3('0x3'));var BPromise=require(_0x94e3('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('./voiceQueueReport.attributes');module['exports']=function(_0x54b130,_0x2a283f){return _0x54b130[_0x94e3('0x5')](_0x94e3('0x6'),attributes,{'tableName':_0x94e3('0x7'),'paranoid':![],'indexes':[{'fields':[_0x94e3('0x8')]},{'fields':[_0x94e3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0ee=['lodash','util','../../config/logger','moment','request-promise','path','./voiceQueueReport.attributes','define','VoiceQueueReport','uniqueid','calleridnum'];(function(_0x1b4e29,_0x1ea6d9){var _0x178f97=function(_0x21c49d){while(--_0x21c49d){_0x1b4e29['push'](_0x1b4e29['shift']());}};_0x178f97(++_0x1ea6d9);}(_0xd0ee,0x18c));var _0xed0e=function(_0x53765c,_0x299159){_0x53765c=_0x53765c-0x0;var _0x36ae8f=_0xd0ee[_0x53765c];return _0x36ae8f;};'use strict';var _=require(_0xed0e('0x0'));var util=require(_0xed0e('0x1'));var logger=require(_0xed0e('0x2'))('api');var moment=require(_0xed0e('0x3'));var BPromise=require('bluebird');var rp=require(_0xed0e('0x4'));var fs=require('fs');var path=require(_0xed0e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed0e('0x6'));module['exports']=function(_0x110f38,_0x2d4bf7){return _0x110f38[_0xed0e('0x7')](_0xed0e('0x8'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xed0e('0x9')]},{'fields':[_0xed0e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index cc84b9b..958c26c 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 _0xc683=['localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','request\x20sent','debug','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0xc683,0x14c));var _0x3c68=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xc683[_0x263a74];return _0x2aa86c;};'use strict';var _=require('lodash');var util=require(_0x3c68('0x0'));var moment=require(_0x3c68('0x1'));var BPromise=require(_0x3c68('0x2'));var rs=require(_0x3c68('0x3'));var fs=require('fs');var Redis=require(_0x3c68('0x4'));var db=require(_0x3c68('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c68('0x6'));var config=require('../../config/environment');var jayson=require(_0x3c68('0x7'));var client=jayson[_0x3c68('0x8')][_0x3c68('0x9')]({'port':0x232a});config[_0x3c68('0xa')]=_[_0x3c68('0xb')](config[_0x3c68('0xa')],{'host':_0x3c68('0xc'),'port':0x18eb});var socket=require(_0x3c68('0xd'))(new Redis(config[_0x3c68('0xa')]));require(_0x3c68('0xe'))[_0x3c68('0xf')](socket);function respondWithRpcPromise(_0x3a84dc,_0x55acdf,_0x531d35){return new BPromise(function(_0x3b84ad,_0x22894a){return client['request'](_0x3a84dc,_0x531d35)[_0x3c68('0x10')](function(_0x45c19c){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x55acdf,_0x3c68('0x11'));logger[_0x3c68('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x55acdf,'request\x20sent',JSON[_0x3c68('0x13')](_0x45c19c));if(_0x45c19c['error']){if(_0x45c19c[_0x3c68('0x14')][_0x3c68('0x15')]===0x1f4){logger['error'](_0x3c68('0x16'),_0x55acdf,_0x45c19c['error'][_0x3c68('0x17')]);return _0x22894a(_0x45c19c['error'][_0x3c68('0x17')]);}logger['error'](_0x3c68('0x16'),_0x55acdf,_0x45c19c[_0x3c68('0x14')][_0x3c68('0x17')]);return _0x3b84ad(_0x45c19c['error']['message']);}else{logger[_0x3c68('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x55acdf,_0x3c68('0x11'));_0x3b84ad(_0x45c19c[_0x3c68('0x19')][_0x3c68('0x17')]);}})[_0x3c68('0x1a')](function(_0x450d50){logger['error'](_0x3c68('0x16'),_0x55acdf,_0x450d50);_0x22894a(_0x450d50);});});}exports[_0x3c68('0x1b')]=function(_0x4ed0c2){var _0x2aeeec=this;return new Promise(function(_0x5aa269,_0x2f70fa){return db[_0x3c68('0x1c')][_0x3c68('0x1d')]({'raw':_0x4ed0c2[_0x3c68('0x1e')]?_0x4ed0c2[_0x3c68('0x1e')][_0x3c68('0x1f')]===undefined?!![]:![]:!![],'where':_0x4ed0c2[_0x3c68('0x1e')]?_0x4ed0c2[_0x3c68('0x1e')][_0x3c68('0x20')]||null:null,'attributes':_0x4ed0c2['options']?_0x4ed0c2['options'][_0x3c68('0x21')]||null:null,'limit':_0x4ed0c2[_0x3c68('0x1e')]?_0x4ed0c2['options'][_0x3c68('0x22')]||null:null,'include':_0x4ed0c2['options']?_0x4ed0c2['options']['include']?_[_0x3c68('0x23')](_0x4ed0c2[_0x3c68('0x1e')][_0x3c68('0x24')],function(_0x1b7cbc){return{'model':db[_0x1b7cbc['model']],'as':_0x1b7cbc['as'],'attributes':_0x1b7cbc[_0x3c68('0x21')],'include':_0x1b7cbc['include']?_[_0x3c68('0x23')](_0x1b7cbc[_0x3c68('0x24')],function(_0x53277a){return{'model':db[_0x53277a['model']],'as':_0x53277a['as'],'attributes':_0x53277a[_0x3c68('0x21')],'include':_0x53277a[_0x3c68('0x24')]?_[_0x3c68('0x23')](_0x53277a['include'],function(_0x453f8e){return{'model':db[_0x453f8e[_0x3c68('0x25')]],'as':_0x453f8e['as'],'attributes':_0x453f8e[_0x3c68('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3c68('0x10')](function(_0x4eb0fa){logger['info'](_0x3c68('0x1b'),_0x4ed0c2);logger[_0x3c68('0x12')](_0x3c68('0x1b'),_0x4ed0c2,JSON[_0x3c68('0x13')](_0x4eb0fa));_0x5aa269(_0x4eb0fa);})['catch'](function(_0x3964d){logger[_0x3c68('0x14')](_0x3c68('0x1b'),_0x3964d[_0x3c68('0x17')],_0x4ed0c2);_0x2f70fa(_0x2aeeec[_0x3c68('0x14')](0x1f4,_0x3964d['message']));});});};exports[_0x3c68('0x26')]=function(_0x33656e){var _0x3c1e1c=this;return new Promise(function(_0x1850dd,_0x3c69b9){return db[_0x3c68('0x1c')][_0x3c68('0x27')](_0x33656e[_0x3c68('0x28')],{'raw':_0x33656e['options']?_0x33656e[_0x3c68('0x1e')][_0x3c68('0x1f')]===undefined?!![]:![]:!![]})[_0x3c68('0x10')](function(_0x180da1){logger[_0x3c68('0x18')](_0x3c68('0x26'),_0x33656e);logger[_0x3c68('0x12')]('CreateVoiceQueueReport',_0x33656e,JSON[_0x3c68('0x13')](_0x180da1));_0x1850dd(_0x180da1);})[_0x3c68('0x1a')](function(_0xb5ed1c){logger['error']('CreateVoiceQueueReport',_0xb5ed1c[_0x3c68('0x17')],_0x33656e);_0x3c69b9(_0x3c1e1c['error'](0x1f4,_0xb5ed1c['message']));});});};exports[_0x3c68('0x29')]=function(_0x5ae8bd){var _0x3673d3=this;return new Promise(function(_0x559672,_0x300e14){return db[_0x3c68('0x1c')][_0x3c68('0x2a')](_0x5ae8bd[_0x3c68('0x28')],{'raw':_0x5ae8bd[_0x3c68('0x1e')]?_0x5ae8bd[_0x3c68('0x1e')][_0x3c68('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ae8bd[_0x3c68('0x1e')]?_0x5ae8bd[_0x3c68('0x1e')][_0x3c68('0x20')]||null:null,'attributes':_0x5ae8bd[_0x3c68('0x1e')]?_0x5ae8bd[_0x3c68('0x1e')]['attributes']||null:null,'limit':_0x5ae8bd[_0x3c68('0x1e')]?_0x5ae8bd['options'][_0x3c68('0x22')]||null:null})[_0x3c68('0x10')](function(_0x7debb8){logger[_0x3c68('0x18')](_0x3c68('0x29'),_0x5ae8bd);logger['debug'](_0x3c68('0x29'),_0x5ae8bd,JSON[_0x3c68('0x13')](_0x7debb8));_0x559672(_0x7debb8);})[_0x3c68('0x1a')](function(_0x4e5b4b){logger[_0x3c68('0x14')]('UpdateVoiceQueueReport',_0x4e5b4b[_0x3c68('0x17')],_0x5ae8bd);_0x300e14(_0x3673d3[_0x3c68('0x14')](0x1f4,_0x4e5b4b[_0x3c68('0x17')]));});});}; \ No newline at end of file +var _0x1467=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','defaults','redis','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','model','include','then','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update'];(function(_0x1da8ad,_0x217618){var _0x2fc8c4=function(_0x175dba){while(--_0x175dba){_0x1da8ad['push'](_0x1da8ad['shift']());}};_0x2fc8c4(++_0x217618);}(_0x1467,0xa0));var _0x7146=function(_0x57560d,_0x215718){_0x57560d=_0x57560d-0x0;var _0x50b44a=_0x1467[_0x57560d];return _0x50b44a;};'use strict';var _=require(_0x7146('0x0'));var util=require(_0x7146('0x1'));var moment=require('moment');var BPromise=require(_0x7146('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7146('0x3'));var db=require(_0x7146('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7146('0x5'))('rpc');var config=require(_0x7146('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7146('0x7')]({'port':0x232a});config['redis']=_[_0x7146('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7146('0x9')]));require(_0x7146('0xa'))[_0x7146('0xb')](socket);function respondWithRpcPromise(_0x3194ed,_0x449ba6,_0x34bfa6){return new BPromise(function(_0x436e8e,_0x57da71){return client[_0x7146('0xc')](_0x3194ed,_0x34bfa6)['then'](function(_0x1619a5){logger[_0x7146('0xd')](_0x7146('0xe'),_0x449ba6,_0x7146('0xf'));logger[_0x7146('0x10')](_0x7146('0x11'),_0x449ba6,_0x7146('0xf'),JSON[_0x7146('0x12')](_0x1619a5));if(_0x1619a5[_0x7146('0x13')]){if(_0x1619a5[_0x7146('0x13')]['code']===0x1f4){logger[_0x7146('0x13')](_0x7146('0xe'),_0x449ba6,_0x1619a5[_0x7146('0x13')][_0x7146('0x14')]);return _0x57da71(_0x1619a5['error']['message']);}logger['error'](_0x7146('0xe'),_0x449ba6,_0x1619a5[_0x7146('0x13')]['message']);return _0x436e8e(_0x1619a5['error'][_0x7146('0x14')]);}else{logger['info'](_0x7146('0xe'),_0x449ba6,_0x7146('0xf'));_0x436e8e(_0x1619a5[_0x7146('0x15')]['message']);}})[_0x7146('0x16')](function(_0x39d8b9){logger[_0x7146('0x13')](_0x7146('0xe'),_0x449ba6,_0x39d8b9);_0x57da71(_0x39d8b9);});});}exports['GetVoiceQueueReport']=function(_0x4ebcf7){var _0x5c326f=this;return new Promise(function(_0x287a10,_0x3082e6){return db[_0x7146('0x17')][_0x7146('0x18')]({'raw':_0x4ebcf7[_0x7146('0x19')]?_0x4ebcf7[_0x7146('0x19')][_0x7146('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ebcf7[_0x7146('0x19')]?_0x4ebcf7[_0x7146('0x19')][_0x7146('0x1b')]||null:null,'attributes':_0x4ebcf7[_0x7146('0x19')]?_0x4ebcf7[_0x7146('0x19')][_0x7146('0x1c')]||null:null,'limit':_0x4ebcf7['options']?_0x4ebcf7[_0x7146('0x19')][_0x7146('0x1d')]||null:null,'include':_0x4ebcf7[_0x7146('0x19')]?_0x4ebcf7[_0x7146('0x19')]['include']?_[_0x7146('0x1e')](_0x4ebcf7[_0x7146('0x19')]['include'],function(_0x309da4){return{'model':db[_0x309da4[_0x7146('0x1f')]],'as':_0x309da4['as'],'attributes':_0x309da4[_0x7146('0x1c')],'include':_0x309da4[_0x7146('0x20')]?_[_0x7146('0x1e')](_0x309da4[_0x7146('0x20')],function(_0x133145){return{'model':db[_0x133145['model']],'as':_0x133145['as'],'attributes':_0x133145['attributes'],'include':_0x133145[_0x7146('0x20')]?_[_0x7146('0x1e')](_0x133145[_0x7146('0x20')],function(_0x4c8155){return{'model':db[_0x4c8155[_0x7146('0x1f')]],'as':_0x4c8155['as'],'attributes':_0x4c8155['attributes']};}):[]};}):[]};}):[]:[]})[_0x7146('0x21')](function(_0x2e4e96){logger[_0x7146('0xd')](_0x7146('0x22'),_0x4ebcf7);logger[_0x7146('0x10')](_0x7146('0x22'),_0x4ebcf7,JSON['stringify'](_0x2e4e96));_0x287a10(_0x2e4e96);})[_0x7146('0x16')](function(_0xf2da8c){logger[_0x7146('0x13')](_0x7146('0x22'),_0xf2da8c[_0x7146('0x14')],_0x4ebcf7);_0x3082e6(_0x5c326f[_0x7146('0x13')](0x1f4,_0xf2da8c['message']));});});};exports[_0x7146('0x23')]=function(_0x182920){var _0x9b1e4d=this;return new Promise(function(_0x1a524f,_0x2e9a04){return db[_0x7146('0x17')][_0x7146('0x24')](_0x182920[_0x7146('0x25')],{'raw':_0x182920[_0x7146('0x19')]?_0x182920[_0x7146('0x19')][_0x7146('0x1a')]===undefined?!![]:![]:!![]})[_0x7146('0x21')](function(_0x27f4c1){logger[_0x7146('0xd')]('CreateVoiceQueueReport',_0x182920);logger[_0x7146('0x10')](_0x7146('0x23'),_0x182920,JSON['stringify'](_0x27f4c1));_0x1a524f(_0x27f4c1);})['catch'](function(_0x4d3bb9){logger[_0x7146('0x13')](_0x7146('0x23'),_0x4d3bb9[_0x7146('0x14')],_0x182920);_0x2e9a04(_0x9b1e4d[_0x7146('0x13')](0x1f4,_0x4d3bb9[_0x7146('0x14')]));});});};exports[_0x7146('0x26')]=function(_0x55d45b){var _0x2ce253=this;return new Promise(function(_0x2420d0,_0x379c8a){return db['VoiceQueueReport'][_0x7146('0x27')](_0x55d45b[_0x7146('0x25')],{'raw':_0x55d45b['options']?_0x55d45b[_0x7146('0x19')][_0x7146('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55d45b[_0x7146('0x19')]?_0x55d45b[_0x7146('0x19')][_0x7146('0x1b')]||null:null,'attributes':_0x55d45b['options']?_0x55d45b[_0x7146('0x19')][_0x7146('0x1c')]||null:null,'limit':_0x55d45b['options']?_0x55d45b[_0x7146('0x19')][_0x7146('0x1d')]||null:null})[_0x7146('0x21')](function(_0x5eef78){logger[_0x7146('0xd')](_0x7146('0x26'),_0x55d45b);logger['debug']('UpdateVoiceQueueReport',_0x55d45b,JSON['stringify'](_0x5eef78));_0x2420d0(_0x5eef78);})['catch'](function(_0x2e8b5d){logger[_0x7146('0x13')](_0x7146('0x26'),_0x2e8b5d[_0x7146('0x14')],_0x55d45b);_0x379c8a(_0x2ce253[_0x7146('0x13')](0x1f4,_0x2e8b5d['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 46b399e..464b96f 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 _0x2f91=['remove','emit','removeListener','register','length','./voiceQueueReport.events','save'];(function(_0x5366ea,_0x11dcea){var _0x5e248a=function(_0x1be5d2){while(--_0x1be5d2){_0x5366ea['push'](_0x5366ea['shift']());}};_0x5e248a(++_0x11dcea);}(_0x2f91,0x98));var _0x12f9=function(_0x1c0690,_0x83febb){_0x1c0690=_0x1c0690-0x0;var _0x3421e3=_0x2f91[_0x1c0690];return _0x3421e3;};'use strict';var VoiceQueueReportEvents=require(_0x12f9('0x0'));var events=[_0x12f9('0x1'),_0x12f9('0x2'),'update'];function createListener(_0x3280e9,_0xf4931b){return function(_0x28cdd9){_0xf4931b[_0x12f9('0x3')](_0x3280e9,_0x28cdd9);};}function removeListener(_0x5198f0,_0x473285){return function(){VoiceQueueReportEvents[_0x12f9('0x4')](_0x5198f0,_0x473285);};}exports[_0x12f9('0x5')]=function(_0xf06fa3){for(var _0x57a5ff=0x0,_0x7811e=events[_0x12f9('0x6')];_0x57a5ff<_0x7811e;_0x57a5ff++){var _0x4ea10c=events[_0x57a5ff];var _0x5b892a=createListener('voiceQueueReport:'+_0x4ea10c,_0xf06fa3);VoiceQueueReportEvents['on'](_0x4ea10c,_0x5b892a);}}; \ No newline at end of file +var _0x72b1=['register','length','./voiceQueueReport.events','remove','update','emit','removeListener'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x72b1,0x16e));var _0x172b=function(_0x111d19,_0x3f35a4){_0x111d19=_0x111d19-0x0;var _0x25af34=_0x72b1[_0x111d19];return _0x25af34;};'use strict';var VoiceQueueReportEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){VoiceQueueReportEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('voiceQueueReport:'+_0x517363,_0x475fd6);VoiceQueueReportEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3cf9196..552c80d 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 _0xa809=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0xa809,0x1a8));var _0x9a80=function(_0x371402,_0x58d782){_0x371402=_0x371402-0x0;var _0x2bda3b=_0xa809[_0x371402];return _0x2bda3b;};'use strict';var multer=require(_0x9a80('0x0'));var util=require(_0x9a80('0x1'));var path=require(_0x9a80('0x2'));var timeout=require(_0x9a80('0x3'));var express=require(_0x9a80('0x4'));var router=express[_0x9a80('0x5')]();var fs_extra=require(_0x9a80('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9a80('0x7'));var config=require(_0x9a80('0x8'));var controller=require(_0x9a80('0x9'));router[_0x9a80('0xa')]('/',auth[_0x9a80('0xb')](),controller[_0x9a80('0xc')]);router[_0x9a80('0xa')](_0x9a80('0xd'),auth[_0x9a80('0xb')](),controller[_0x9a80('0xe')]);router[_0x9a80('0xf')]('/',auth[_0x9a80('0xb')](),controller[_0x9a80('0x10')]);router[_0x9a80('0x11')](_0x9a80('0xd'),auth[_0x9a80('0xb')](),controller[_0x9a80('0x12')]);router[_0x9a80('0x13')](_0x9a80('0xd'),auth[_0x9a80('0xb')](),controller[_0x9a80('0x14')]);module[_0x9a80('0x15')]=router; \ No newline at end of file +var _0x1bf3=['fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x135459,_0x19f5b2){var _0x4cfd01=function(_0x5b936b){while(--_0x5b936b){_0x135459['push'](_0x135459['shift']());}};_0x4cfd01(++_0x19f5b2);}(_0x1bf3,0xc1));var _0x31bf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1bf3[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x31bf('0x0'));var util=require(_0x31bf('0x1'));var path=require(_0x31bf('0x2'));var timeout=require(_0x31bf('0x3'));var express=require(_0x31bf('0x4'));var router=express['Router']();var fs_extra=require(_0x31bf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x31bf('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x31bf('0x7')]('/',auth[_0x31bf('0x8')](),controller[_0x31bf('0x9')]);router[_0x31bf('0x7')](_0x31bf('0xa'),auth[_0x31bf('0x8')](),controller['show']);router[_0x31bf('0xb')]('/',auth[_0x31bf('0x8')](),controller[_0x31bf('0xc')]);router[_0x31bf('0xd')](_0x31bf('0xa'),auth[_0x31bf('0x8')](),controller[_0x31bf('0xe')]);router[_0x31bf('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x31bf('0x10')]);module[_0x31bf('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 989141a..8b440f3 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 _0x0142=['exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x1455aa,_0x1f2cf9){var _0x37d526=function(_0x146ce1){while(--_0x146ce1){_0x1455aa['push'](_0x1455aa['shift']());}};_0x37d526(++_0x1f2cf9);}(_0x0142,0x130));var _0x2014=function(_0x519cc4,_0x59d532){_0x519cc4=_0x519cc4-0x0;var _0x34f572=_0x0142[_0x519cc4];return _0x34f572;};'use strict';var Sequelize=require(_0x2014('0x0'));var moment=require('moment');module[_0x2014('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x2014('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2014('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2014('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x2014('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x2014('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x2014('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x2014('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2014('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0x2014('0x4'))}}; \ No newline at end of file +var _0xda58=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x2a18b7,_0x5041c8){var _0x45e74e=function(_0x1d32d6){while(--_0x1d32d6){_0x2a18b7['push'](_0x2a18b7['shift']());}};_0x45e74e(++_0x5041c8);}(_0xda58,0x1c5));var _0x8da5=function(_0x172826,_0x4de75f){_0x172826=_0x172826-0x0;var _0x148ba1=_0xda58[_0x172826];return _0x148ba1;};'use strict';var Sequelize=require(_0x8da5('0x0'));var moment=require(_0x8da5('0x1'));module['exports']={'time':{'type':Sequelize[_0x8da5('0x2')]},'callid':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x8da5('0x3')](_0x8da5('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 82ecf6c..8230cf4 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 _0x0de6=['filter','count','include','findAll','rows','catch','params','options','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x193f03,_0xabfdb8){var _0x26f348=function(_0x4bb382){while(--_0x4bb382){_0x193f03['push'](_0x193f03['shift']());}};_0x26f348(++_0xabfdb8);}(_0x0de6,0x9e));var _0x60de=function(_0x4de002,_0x3fb911){_0x4de002=_0x4de002-0x0;var _0x442036=_0x0de6[_0x4de002];return _0x442036;};'use strict';var emlformat=require(_0x60de('0x0'));var rimraf=require(_0x60de('0x1'));var zipdir=require(_0x60de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60de('0x3'));var moment=require(_0x60de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x60de('0x5'));var util=require(_0x60de('0x6'));var path=require(_0x60de('0x7'));var sox=require(_0x60de('0x8'));var csv=require(_0x60de('0x9'));var ejs=require(_0x60de('0xa'));var fs=require('fs');var fs_extra=require(_0x60de('0xb'));var _=require('lodash');var squel=require(_0x60de('0xc'));var crypto=require(_0x60de('0xd'));var jsforce=require(_0x60de('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x60de('0x9'));var querystring=require('querystring');var Papa=require(_0x60de('0xf'));var Redis=require(_0x60de('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x60de('0x11'));var as=require(_0x60de('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x60de('0x13'))(_0x60de('0x14'));var utils=require(_0x60de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x60de('0x16'));var db=require(_0x60de('0x17'))['db'];function respondWithStatusCode(_0x5f1228,_0x40e648){_0x40e648=_0x40e648||0xcc;return function(_0x5a1d96){if(_0x5a1d96){return _0x5f1228[_0x60de('0x18')](_0x40e648);}return _0x5f1228[_0x60de('0x19')](_0x40e648)[_0x60de('0x1a')]();};}function respondWithResult(_0x1db37d,_0x2b7d15){_0x2b7d15=_0x2b7d15||0xc8;return function(_0x3ef9de){if(_0x3ef9de){return _0x1db37d[_0x60de('0x19')](_0x2b7d15)['json'](_0x3ef9de);}};}function respondWithFilteredResult(_0x2b3dc2,_0x11579c){return function(_0x5148b3){if(_0x5148b3){var _0x3bd0e6=typeof _0x11579c[_0x60de('0x1b')]===_0x60de('0x1c')&&typeof _0x11579c[_0x60de('0x1d')]===_0x60de('0x1c');var _0x573060=_0x5148b3['count'];var _0x5aefcb=_0x3bd0e6?0x0:_0x11579c['offset'];var _0x1dbefb=_0x3bd0e6?_0x5148b3['count']:_0x11579c[_0x60de('0x1b')]+_0x11579c['limit'];var _0x3e960b;if(_0x1dbefb>=_0x573060){_0x1dbefb=_0x573060;_0x3e960b=0xc8;}else{_0x3e960b=0xce;}_0x2b3dc2[_0x60de('0x19')](_0x3e960b);return _0x2b3dc2[_0x60de('0x1e')](_0x60de('0x1f'),_0x5aefcb+'-'+_0x1dbefb+'/'+_0x573060)['json'](_0x5148b3);}return null;};}function patchUpdates(_0x4c78f7){return function(_0x4cadfe){try{jsonpatch['apply'](_0x4cadfe,_0x4c78f7,!![]);}catch(_0x18b286){return BPromise[_0x60de('0x20')](_0x18b286);}return _0x4cadfe['save']();};}function saveUpdates(_0x18cf9d,_0x465b99){return function(_0x5da2dd){if(_0x5da2dd){return _0x5da2dd[_0x60de('0x21')](_0x18cf9d)[_0x60de('0x22')](function(_0x53b52f){return _0x53b52f;});}return null;};}function removeEntity(_0x5e028f,_0x3727ec){return function(_0x2a4e02){if(_0x2a4e02){return _0x2a4e02['destroy']()['then'](function(){_0x5e028f['status'](0xcc)[_0x60de('0x1a')]();});}};}function handleEntityNotFound(_0x242819,_0x2f111b){return function(_0x4d9b52){if(!_0x4d9b52){_0x242819['sendStatus'](0x194);}return _0x4d9b52;};}function handleError(_0x20ca6c,_0x474698){_0x474698=_0x474698||0x1f4;return function(_0x32f431){logger[_0x60de('0x23')](_0x32f431[_0x60de('0x24')]);if(_0x32f431['name']){delete _0x32f431[_0x60de('0x25')];}_0x20ca6c[_0x60de('0x19')](_0x474698)[_0x60de('0x26')](_0x32f431);};}exports[_0x60de('0x27')]=function(_0x10fba4,_0x265a4b){var _0x5e4a1f={},_0x2c7063={},_0x3228b9={'count':0x0,'rows':[]};var _0x95b6d7=_[_0x60de('0x28')](db[_0x60de('0x29')][_0x60de('0x2a')],function(_0x490e2c){return{'name':_0x490e2c[_0x60de('0x2b')],'type':_0x490e2c[_0x60de('0x2c')]['key']};});_0x2c7063[_0x60de('0x2d')]=_['map'](_0x95b6d7,'name');_0x2c7063[_0x60de('0x2e')]=_[_0x60de('0x2f')](_0x10fba4['query']);_0x2c7063[_0x60de('0x30')]=_[_0x60de('0x31')](_0x2c7063[_0x60de('0x2d')],_0x2c7063[_0x60de('0x2e')]);_0x5e4a1f['attributes']=_[_0x60de('0x31')](_0x2c7063['model'],qs['fields'](_0x10fba4[_0x60de('0x2e')][_0x60de('0x32')]));_0x5e4a1f[_0x60de('0x33')]=_0x5e4a1f[_0x60de('0x33')][_0x60de('0x34')]?_0x5e4a1f[_0x60de('0x33')]:_0x2c7063[_0x60de('0x2d')];if(!_0x10fba4['query'][_0x60de('0x35')](_0x60de('0x36'))){_0x5e4a1f[_0x60de('0x1d')]=qs[_0x60de('0x1d')](_0x10fba4[_0x60de('0x2e')][_0x60de('0x1d')]);_0x5e4a1f['offset']=qs['offset'](_0x10fba4[_0x60de('0x2e')][_0x60de('0x1b')]);}_0x5e4a1f[_0x60de('0x37')]=qs[_0x60de('0x38')](_0x10fba4[_0x60de('0x2e')]['sort']);_0x5e4a1f[_0x60de('0x39')]=qs[_0x60de('0x30')](_[_0x60de('0x3a')](_0x10fba4[_0x60de('0x2e')],_0x2c7063['filters']),_0x95b6d7);if(_0x10fba4[_0x60de('0x2e')]['filter']){_0x5e4a1f[_0x60de('0x39')]=_[_0x60de('0x3b')](_0x5e4a1f[_0x60de('0x39')],{'$or':_['map'](_0x95b6d7,function(_0x3ed576){if(_0x3ed576[_0x60de('0x2c')]!==_0x60de('0x3c')){var _0x56665d={};_0x56665d[_0x3ed576['name']]={'$like':'%'+_0x10fba4[_0x60de('0x2e')][_0x60de('0x3d')]+'%'};return _0x56665d;}})});}_0x5e4a1f=_[_0x60de('0x3b')]({},_0x5e4a1f,_0x10fba4['options']);var _0x406e58={'where':_0x5e4a1f[_0x60de('0x39')]};return db[_0x60de('0x29')]['count'](_0x406e58)[_0x60de('0x22')](function(_0xf8170f){_0x3228b9[_0x60de('0x3e')]=_0xf8170f;if(_0x10fba4['query']['includeAll']){_0x5e4a1f[_0x60de('0x3f')]=[{'all':!![]}];}return db[_0x60de('0x29')][_0x60de('0x40')](_0x5e4a1f);})['then'](function(_0xf9dcbf){_0x3228b9[_0x60de('0x41')]=_0xf9dcbf;return _0x3228b9;})[_0x60de('0x22')](respondWithFilteredResult(_0x265a4b,_0x5e4a1f))[_0x60de('0x42')](handleError(_0x265a4b,null));};exports['show']=function(_0x2f4d54,_0x192f65){var _0x175762={'raw':!![],'where':{'id':_0x2f4d54[_0x60de('0x43')]['id']}},_0x23092e={};_0x23092e['model']=_[_0x60de('0x2f')](db[_0x60de('0x29')][_0x60de('0x2a')]);_0x23092e['query']=_[_0x60de('0x2f')](_0x2f4d54[_0x60de('0x2e')]);_0x23092e[_0x60de('0x30')]=_[_0x60de('0x31')](_0x23092e[_0x60de('0x2d')],_0x23092e[_0x60de('0x2e')]);_0x175762[_0x60de('0x33')]=_['intersection'](_0x23092e['model'],qs[_0x60de('0x32')](_0x2f4d54[_0x60de('0x2e')][_0x60de('0x32')]));_0x175762['attributes']=_0x175762['attributes']['length']?_0x175762[_0x60de('0x33')]:_0x23092e[_0x60de('0x2d')];if(_0x2f4d54['query']['includeAll']){_0x175762[_0x60de('0x3f')]=[{'all':!![]}];}_0x175762=_[_0x60de('0x3b')]({},_0x175762,_0x2f4d54[_0x60de('0x44')]);return db['VoiceQueuesLog'][_0x60de('0x45')](_0x175762)[_0x60de('0x22')](handleEntityNotFound(_0x192f65,null))['then'](respondWithResult(_0x192f65,null))[_0x60de('0x42')](handleError(_0x192f65,null));};exports[_0x60de('0x46')]=function(_0x234dd4,_0x6e2271){return db[_0x60de('0x29')][_0x60de('0x46')](_0x234dd4['body'],{})[_0x60de('0x22')](respondWithResult(_0x6e2271,0xc9))['catch'](handleError(_0x6e2271,null));};exports[_0x60de('0x21')]=function(_0x46c3ff,_0x237b98){if(_0x46c3ff[_0x60de('0x47')]['id']){delete _0x46c3ff[_0x60de('0x47')]['id'];}return db[_0x60de('0x29')][_0x60de('0x45')]({'where':{'id':_0x46c3ff[_0x60de('0x43')]['id']}})[_0x60de('0x22')](handleEntityNotFound(_0x237b98,null))[_0x60de('0x22')](saveUpdates(_0x46c3ff[_0x60de('0x47')],null))['then'](respondWithResult(_0x237b98,null))[_0x60de('0x42')](handleError(_0x237b98,null));};exports[_0x60de('0x48')]=function(_0x1332ca,_0x295ec3){return db[_0x60de('0x29')][_0x60de('0x45')]({'where':{'id':_0x1332ca['params']['id']}})[_0x60de('0x22')](handleEntityNotFound(_0x295ec3,null))['then'](removeEntity(_0x295ec3,null))['catch'](handleError(_0x295ec3,null));}; \ No newline at end of file +var _0xf65a=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','VoiceQueuesLog','fieldName','map','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','findAll','rows','show','params','rawAttributes','keys','length','include','options','find','create','body','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3d3bef,_0x491eac){var _0x2394ac=function(_0x40d724){while(--_0x40d724){_0x3d3bef['push'](_0x3d3bef['shift']());}};_0x2394ac(++_0x491eac);}(_0xf65a,0xca));var _0xaf65=function(_0x5d0856,_0x2fd008){_0x5d0856=_0x5d0856-0x0;var _0x3e87af=_0xf65a[_0x5d0856];return _0x3e87af;};'use strict';var emlformat=require(_0xaf65('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf65('0x1'));var rp=require(_0xaf65('0x2'));var moment=require(_0xaf65('0x3'));var BPromise=require(_0xaf65('0x4'));var Mustache=require('mustache');var util=require(_0xaf65('0x5'));var path=require(_0xaf65('0x6'));var sox=require(_0xaf65('0x7'));var csv=require(_0xaf65('0x8'));var ejs=require(_0xaf65('0x9'));var fs=require('fs');var fs_extra=require(_0xaf65('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaf65('0xb'));var jsforce=require(_0xaf65('0xc'));var deskjs=require(_0xaf65('0xd'));var toCsv=require(_0xaf65('0x8'));var querystring=require(_0xaf65('0xe'));var Papa=require(_0xaf65('0xf'));var Redis=require('ioredis');var authService=require(_0xaf65('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaf65('0x11'));var hardwareService=require(_0xaf65('0x12'));var logger=require(_0xaf65('0x13'))(_0xaf65('0x14'));var utils=require('../../config/utils');var config=require(_0xaf65('0x15'));var licenseUtil=require(_0xaf65('0x16'));var db=require(_0xaf65('0x17'))['db'];function respondWithStatusCode(_0x24c00d,_0x3124c3){_0x3124c3=_0x3124c3||0xcc;return function(_0x1fca40){if(_0x1fca40){return _0x24c00d[_0xaf65('0x18')](_0x3124c3);}return _0x24c00d[_0xaf65('0x19')](_0x3124c3)[_0xaf65('0x1a')]();};}function respondWithResult(_0x20ec62,_0x5d5189){_0x5d5189=_0x5d5189||0xc8;return function(_0x2fcc52){if(_0x2fcc52){return _0x20ec62[_0xaf65('0x19')](_0x5d5189)[_0xaf65('0x1b')](_0x2fcc52);}};}function respondWithFilteredResult(_0x3327bc,_0x4f2e50){return function(_0x14bdce){if(_0x14bdce){var _0x3bf122=typeof _0x4f2e50['offset']===_0xaf65('0x1c')&&typeof _0x4f2e50[_0xaf65('0x1d')]==='undefined';var _0x297f8c=_0x14bdce[_0xaf65('0x1e')];var _0xd74c42=_0x3bf122?0x0:_0x4f2e50[_0xaf65('0x1f')];var _0x4b82d9=_0x3bf122?_0x14bdce[_0xaf65('0x1e')]:_0x4f2e50[_0xaf65('0x1f')]+_0x4f2e50[_0xaf65('0x1d')];var _0x317a68;if(_0x4b82d9>=_0x297f8c){_0x4b82d9=_0x297f8c;_0x317a68=0xc8;}else{_0x317a68=0xce;}_0x3327bc['status'](_0x317a68);return _0x3327bc[_0xaf65('0x20')](_0xaf65('0x21'),_0xd74c42+'-'+_0x4b82d9+'/'+_0x297f8c)[_0xaf65('0x1b')](_0x14bdce);}return null;};}function patchUpdates(_0x3cf434){return function(_0xdc31cb){try{jsonpatch['apply'](_0xdc31cb,_0x3cf434,!![]);}catch(_0x48fe1b){return BPromise['reject'](_0x48fe1b);}return _0xdc31cb[_0xaf65('0x22')]();};}function saveUpdates(_0x1d90cf,_0x2ee18b){return function(_0x59a0b2){if(_0x59a0b2){return _0x59a0b2[_0xaf65('0x23')](_0x1d90cf)[_0xaf65('0x24')](function(_0xdadc2c){return _0xdadc2c;});}return null;};}function removeEntity(_0x973749,_0x111a89){return function(_0x25f54a){if(_0x25f54a){return _0x25f54a[_0xaf65('0x25')]()[_0xaf65('0x24')](function(){_0x973749['status'](0xcc)[_0xaf65('0x1a')]();});}};}function handleEntityNotFound(_0x14ad9b,_0x2f1ea5){return function(_0x40ae36){if(!_0x40ae36){_0x14ad9b[_0xaf65('0x18')](0x194);}return _0x40ae36;};}function handleError(_0x4ab064,_0x3c691c){_0x3c691c=_0x3c691c||0x1f4;return function(_0x115709){logger[_0xaf65('0x26')](_0x115709[_0xaf65('0x27')]);if(_0x115709[_0xaf65('0x28')]){delete _0x115709[_0xaf65('0x28')];}_0x4ab064[_0xaf65('0x19')](_0x3c691c)['send'](_0x115709);};}exports['index']=function(_0x21643a,_0x4d342d){var _0x595852={},_0x4e0f4a={},_0x5726a8={'count':0x0,'rows':[]};var _0x21e2a4=_['map'](db[_0xaf65('0x29')]['rawAttributes'],function(_0x15f03b){return{'name':_0x15f03b[_0xaf65('0x2a')],'type':_0x15f03b['type']['key']};});_0x4e0f4a['model']=_[_0xaf65('0x2b')](_0x21e2a4,'name');_0x4e0f4a[_0xaf65('0x2c')]=_['keys'](_0x21643a[_0xaf65('0x2c')]);_0x4e0f4a['filters']=_[_0xaf65('0x2d')](_0x4e0f4a[_0xaf65('0x2e')],_0x4e0f4a[_0xaf65('0x2c')]);_0x595852['attributes']=_[_0xaf65('0x2d')](_0x4e0f4a[_0xaf65('0x2e')],qs[_0xaf65('0x2f')](_0x21643a['query']['fields']));_0x595852[_0xaf65('0x30')]=_0x595852['attributes']['length']?_0x595852[_0xaf65('0x30')]:_0x4e0f4a[_0xaf65('0x2e')];if(!_0x21643a[_0xaf65('0x2c')][_0xaf65('0x31')](_0xaf65('0x32'))){_0x595852[_0xaf65('0x1d')]=qs['limit'](_0x21643a['query'][_0xaf65('0x1d')]);_0x595852['offset']=qs[_0xaf65('0x1f')](_0x21643a['query'][_0xaf65('0x1f')]);}_0x595852[_0xaf65('0x33')]=qs['sort'](_0x21643a[_0xaf65('0x2c')][_0xaf65('0x34')]);_0x595852[_0xaf65('0x35')]=qs[_0xaf65('0x36')](_[_0xaf65('0x37')](_0x21643a[_0xaf65('0x2c')],_0x4e0f4a['filters']),_0x21e2a4);if(_0x21643a[_0xaf65('0x2c')]['filter']){_0x595852['where']=_['merge'](_0x595852[_0xaf65('0x35')],{'$or':_['map'](_0x21e2a4,function(_0x14fc9f){if(_0x14fc9f[_0xaf65('0x38')]!==_0xaf65('0x39')){var _0xb3a524={};_0xb3a524[_0x14fc9f[_0xaf65('0x28')]]={'$like':'%'+_0x21643a[_0xaf65('0x2c')][_0xaf65('0x3a')]+'%'};return _0xb3a524;}})});}_0x595852=_[_0xaf65('0x3b')]({},_0x595852,_0x21643a['options']);var _0x3cd40a={'where':_0x595852[_0xaf65('0x35')]};return db['VoiceQueuesLog'][_0xaf65('0x1e')](_0x3cd40a)['then'](function(_0x5eee1a){_0x5726a8['count']=_0x5eee1a;if(_0x21643a[_0xaf65('0x2c')][_0xaf65('0x3c')]){_0x595852['include']=[{'all':!![]}];}return db[_0xaf65('0x29')][_0xaf65('0x3d')](_0x595852);})[_0xaf65('0x24')](function(_0x27199a){_0x5726a8[_0xaf65('0x3e')]=_0x27199a;return _0x5726a8;})[_0xaf65('0x24')](respondWithFilteredResult(_0x4d342d,_0x595852))['catch'](handleError(_0x4d342d,null));};exports[_0xaf65('0x3f')]=function(_0x5a8e1d,_0x481e4f){var _0x54824d={'raw':!![],'where':{'id':_0x5a8e1d[_0xaf65('0x40')]['id']}},_0x4ef8b5={};_0x4ef8b5[_0xaf65('0x2e')]=_['keys'](db[_0xaf65('0x29')][_0xaf65('0x41')]);_0x4ef8b5['query']=_[_0xaf65('0x42')](_0x5a8e1d[_0xaf65('0x2c')]);_0x4ef8b5['filters']=_[_0xaf65('0x2d')](_0x4ef8b5[_0xaf65('0x2e')],_0x4ef8b5[_0xaf65('0x2c')]);_0x54824d[_0xaf65('0x30')]=_[_0xaf65('0x2d')](_0x4ef8b5['model'],qs['fields'](_0x5a8e1d['query'][_0xaf65('0x2f')]));_0x54824d[_0xaf65('0x30')]=_0x54824d[_0xaf65('0x30')][_0xaf65('0x43')]?_0x54824d['attributes']:_0x4ef8b5[_0xaf65('0x2e')];if(_0x5a8e1d[_0xaf65('0x2c')][_0xaf65('0x3c')]){_0x54824d[_0xaf65('0x44')]=[{'all':!![]}];}_0x54824d=_[_0xaf65('0x3b')]({},_0x54824d,_0x5a8e1d[_0xaf65('0x45')]);return db[_0xaf65('0x29')][_0xaf65('0x46')](_0x54824d)['then'](handleEntityNotFound(_0x481e4f,null))[_0xaf65('0x24')](respondWithResult(_0x481e4f,null))['catch'](handleError(_0x481e4f,null));};exports[_0xaf65('0x47')]=function(_0x1b367a,_0x373fa9){return db[_0xaf65('0x29')][_0xaf65('0x47')](_0x1b367a[_0xaf65('0x48')],{})['then'](respondWithResult(_0x373fa9,0xc9))[_0xaf65('0x49')](handleError(_0x373fa9,null));};exports[_0xaf65('0x23')]=function(_0x16ae37,_0x5a7f38){if(_0x16ae37[_0xaf65('0x48')]['id']){delete _0x16ae37[_0xaf65('0x48')]['id'];}return db[_0xaf65('0x29')][_0xaf65('0x46')]({'where':{'id':_0x16ae37[_0xaf65('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a7f38,null))[_0xaf65('0x24')](saveUpdates(_0x16ae37[_0xaf65('0x48')],null))[_0xaf65('0x24')](respondWithResult(_0x5a7f38,null))[_0xaf65('0x49')](handleError(_0x5a7f38,null));};exports[_0xaf65('0x25')]=function(_0x2d6d7b,_0x4d98a6){return db[_0xaf65('0x29')][_0xaf65('0x46')]({'where':{'id':_0x2d6d7b[_0xaf65('0x40')]['id']}})[_0xaf65('0x24')](handleEntityNotFound(_0x4d98a6,null))[_0xaf65('0x24')](removeEntity(_0x4d98a6,null))[_0xaf65('0x49')](handleError(_0x4d98a6,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 2c9ce7f..d50a432 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 _0xddee=['VoiceQueuesLog','event_dtm','event','dtm','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xddee,0x1d2));var _0xedde=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0xddee[_0x3e6729];return _0x535bcd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xedde('0x0'))(_0xedde('0x1'));var moment=require(_0xedde('0x2'));var BPromise=require('bluebird');var rp=require(_0xedde('0x3'));var fs=require('fs');var path=require(_0xedde('0x4'));var rimraf=require(_0xedde('0x5'));var config=require(_0xedde('0x6'));var attributes=require(_0xedde('0x7'));module[_0xedde('0x8')]=function(_0x2d370e,_0x4483c7){return _0x2d370e[_0xedde('0x9')](_0xedde('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xedde('0xb'),'fields':[_0xedde('0xc'),_0xedde('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x39c1=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x39c1,0x1e1));var _0x139c=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0x39c1[_0x349a9e];return _0x24c207;};'use strict';var _=require('lodash');var util=require(_0x139c('0x0'));var logger=require(_0x139c('0x1'))(_0x139c('0x2'));var moment=require(_0x139c('0x3'));var BPromise=require(_0x139c('0x4'));var rp=require(_0x139c('0x5'));var fs=require('fs');var path=require(_0x139c('0x6'));var rimraf=require(_0x139c('0x7'));var config=require(_0x139c('0x8'));var attributes=require(_0x139c('0x9'));module[_0x139c('0xa')]=function(_0x2e01b9,_0x2c964b){return _0x2e01b9[_0x139c('0xb')](_0x139c('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x139c('0xd'),'fields':['event','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 2941cdc..cfaa92f 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 _0x4bd1=['VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x65ed75,_0x10aaf7){var _0x3684f1=function(_0x128d13){while(--_0x128d13){_0x65ed75['push'](_0x65ed75['shift']());}};_0x3684f1(++_0x10aaf7);}(_0x4bd1,0x90));var _0x14bd=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x4bd1[_0x1f9f37];return _0x21c080;};'use strict';var _=require('lodash');var util=require(_0x14bd('0x0'));var moment=require('moment');var BPromise=require(_0x14bd('0x1'));var rs=require(_0x14bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14bd('0x3'))['db'];var utils=require(_0x14bd('0x4'));var logger=require('../../config/logger')(_0x14bd('0x5'));var config=require(_0x14bd('0x6'));var jayson=require(_0x14bd('0x7'));var client=jayson[_0x14bd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35806e,_0x2cec06,_0xb06dbf){return new BPromise(function(_0x2e9a2f,_0x302ffa){return client[_0x14bd('0x9')](_0x35806e,_0xb06dbf)[_0x14bd('0xa')](function(_0x4193ff){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x2cec06,'request\x20sent');logger[_0x14bd('0xb')](_0x14bd('0xc'),_0x2cec06,_0x14bd('0xd'),JSON['stringify'](_0x4193ff));if(_0x4193ff[_0x14bd('0xe')]){if(_0x4193ff[_0x14bd('0xe')][_0x14bd('0xf')]===0x1f4){logger[_0x14bd('0xe')](_0x14bd('0x10'),_0x2cec06,_0x4193ff[_0x14bd('0xe')][_0x14bd('0x11')]);return _0x302ffa(_0x4193ff[_0x14bd('0xe')]['message']);}logger[_0x14bd('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2cec06,_0x4193ff[_0x14bd('0xe')]['message']);return _0x2e9a2f(_0x4193ff[_0x14bd('0xe')][_0x14bd('0x11')]);}else{logger['info'](_0x14bd('0x10'),_0x2cec06,'request\x20sent');_0x2e9a2f(_0x4193ff[_0x14bd('0x12')][_0x14bd('0x11')]);}})[_0x14bd('0x13')](function(_0x1853ba){logger[_0x14bd('0xe')](_0x14bd('0x10'),_0x2cec06,_0x1853ba);_0x302ffa(_0x1853ba);});});} \ No newline at end of file +var _0x0c96=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','code','error','message','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c96,0x1a6));var _0x60c9=function(_0x229055,_0x4dc906){_0x229055=_0x229055-0x0;var _0x2f72b4=_0x0c96[_0x229055];return _0x2f72b4;};'use strict';var _=require(_0x60c9('0x0'));var util=require('util');var moment=require(_0x60c9('0x1'));var BPromise=require(_0x60c9('0x2'));var rs=require(_0x60c9('0x3'));var fs=require('fs');var Redis=require(_0x60c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x60c9('0x5'))(_0x60c9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x60c9('0x7')][_0x60c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3caeae,_0x58a47b,_0x26d689){return new BPromise(function(_0x1fe57a,_0x3b0ce4){return client['request'](_0x3caeae,_0x26d689)['then'](function(_0x394398){logger[_0x60c9('0x9')](_0x60c9('0xa'),_0x58a47b,_0x60c9('0xb'));logger['debug'](_0x60c9('0xc'),_0x58a47b,_0x60c9('0xb'),JSON['stringify'](_0x394398));if(_0x394398['error']){if(_0x394398['error'][_0x60c9('0xd')]===0x1f4){logger['error'](_0x60c9('0xa'),_0x58a47b,_0x394398[_0x60c9('0xe')][_0x60c9('0xf')]);return _0x3b0ce4(_0x394398[_0x60c9('0xe')][_0x60c9('0xf')]);}logger['error'](_0x60c9('0xa'),_0x58a47b,_0x394398[_0x60c9('0xe')][_0x60c9('0xf')]);return _0x1fe57a(_0x394398[_0x60c9('0xe')][_0x60c9('0xf')]);}else{logger[_0x60c9('0x9')](_0x60c9('0xa'),_0x58a47b,_0x60c9('0xb'));_0x1fe57a(_0x394398['result'][_0x60c9('0xf')]);}})['catch'](function(_0x58a2db){logger[_0x60c9('0xe')](_0x60c9('0xa'),_0x58a47b,_0x58a2db);_0x3b0ce4(_0x58a2db);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index ceb8e46..e3fd459 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 _0x7d6b=['/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x56a616,_0x5a3c7c){var _0xe94844=function(_0x1d3816){while(--_0x1d3816){_0x56a616['push'](_0x56a616['shift']());}};_0xe94844(++_0x5a3c7c);}(_0x7d6b,0xd8));var _0xb7d6=function(_0x4526e9,_0xbff7c8){_0x4526e9=_0x4526e9-0x0;var _0x4e1da7=_0x7d6b[_0x4526e9];return _0x4e1da7;};'use strict';var multer=require(_0xb7d6('0x0'));var util=require(_0xb7d6('0x1'));var path=require(_0xb7d6('0x2'));var timeout=require(_0xb7d6('0x3'));var express=require('express');var router=express[_0xb7d6('0x4')]();var fs_extra=require(_0xb7d6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb7d6('0x6'));var config=require(_0xb7d6('0x7'));var controller=require(_0xb7d6('0x8'));router[_0xb7d6('0x9')]('/',auth[_0xb7d6('0xa')](),controller[_0xb7d6('0xb')]);router[_0xb7d6('0x9')](_0xb7d6('0xc'),auth[_0xb7d6('0xa')](),controller[_0xb7d6('0xd')]);router['get'](_0xb7d6('0xe'),auth[_0xb7d6('0xa')](),controller[_0xb7d6('0xf')]);router[_0xb7d6('0x9')](_0xb7d6('0x10'),auth[_0xb7d6('0xa')](),controller[_0xb7d6('0x11')]);router[_0xb7d6('0x9')](_0xb7d6('0x12'),controller[_0xb7d6('0x13')]);router[_0xb7d6('0x9')](_0xb7d6('0x14'),auth['isAuthenticated'](),controller[_0xb7d6('0x15')]);router[_0xb7d6('0x16')]('/',auth[_0xb7d6('0xa')](),controller[_0xb7d6('0x17')]);router[_0xb7d6('0x16')]('/:id/transcribe',auth[_0xb7d6('0xa')](),controller[_0xb7d6('0x18')]);router[_0xb7d6('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xb7d6('0x1a')]);router[_0xb7d6('0x1b')](_0xb7d6('0xe'),auth[_0xb7d6('0xa')](),controller[_0xb7d6('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x52af=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','put','update','/:id'];(function(_0x11ab4f,_0x425fbf){var _0x4181b9=function(_0x1c0f67){while(--_0x1c0f67){_0x11ab4f['push'](_0x11ab4f['shift']());}};_0x4181b9(++_0x425fbf);}(_0x52af,0x1d6));var _0xf52a=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x52af[_0x1da527];return _0x40fc7c;};'use strict';var multer=require(_0xf52a('0x0'));var util=require('util');var path=require(_0xf52a('0x1'));var timeout=require(_0xf52a('0x2'));var express=require(_0xf52a('0x3'));var router=express[_0xf52a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf52a('0x5'));var interaction=require(_0xf52a('0x6'));var config=require(_0xf52a('0x7'));var controller=require(_0xf52a('0x8'));router[_0xf52a('0x9')]('/',auth[_0xf52a('0xa')](),controller['index']);router['get'](_0xf52a('0xb'),auth[_0xf52a('0xa')](),controller['describe']);router[_0xf52a('0x9')]('/:id',auth[_0xf52a('0xa')](),controller[_0xf52a('0xc')]);router[_0xf52a('0x9')](_0xf52a('0xd'),auth[_0xf52a('0xa')](),controller[_0xf52a('0xe')]);router[_0xf52a('0x9')](_0xf52a('0xf'),controller[_0xf52a('0x10')]);router[_0xf52a('0x9')](_0xf52a('0x11'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0xf52a('0x12')]('/',auth['isAuthenticated'](),controller[_0xf52a('0x13')]);router[_0xf52a('0x12')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xf52a('0x14')]);router[_0xf52a('0x15')]('/:id',auth[_0xf52a('0xa')](),controller[_0xf52a('0x16')]);router['delete'](_0xf52a('0x17'),auth[_0xf52a('0xa')](),controller[_0xf52a('0x18')]);module[_0xf52a('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 8c2f669..d58c8d2 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(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 14e4be1..75e7eed 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 _0x60cb=['../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','VoiceRecording','rawAttributes','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','download','../../components/encryptor','uniqueid','value','%s.cypher','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','existsSync','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','listBuckets','createBucket','upload','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','.txt','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x60cb,0x81));var _0xb60c=function(_0x90a2f2,_0x2b2d10){_0x90a2f2=_0x90a2f2-0x0;var _0x3aa938=_0x60cb[_0x90a2f2];return _0x3aa938;};'use strict';var emlformat=require(_0xb60c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb60c('0x1'));var jsonpatch=require(_0xb60c('0x2'));var rp=require(_0xb60c('0x3'));var moment=require(_0xb60c('0x4'));var BPromise=require(_0xb60c('0x5'));var Mustache=require(_0xb60c('0x6'));var util=require('util');var path=require(_0xb60c('0x7'));var sox=require(_0xb60c('0x8'));var csv=require(_0xb60c('0x9'));var ejs=require(_0xb60c('0xa'));var fs=require('fs');var fs_extra=require(_0xb60c('0xb'));var _=require(_0xb60c('0xc'));var squel=require('squel');var crypto=require(_0xb60c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb60c('0x9'));var querystring=require(_0xb60c('0xe'));var Papa=require(_0xb60c('0xf'));var AWS=require(_0xb60c('0x10'));var uuidv4=require(_0xb60c('0x11'));var Redis=require(_0xb60c('0x12'));var authService=require(_0xb60c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb60c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb60c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb60c('0x16'));var licenseUtil=require(_0xb60c('0x17'));var db=require(_0xb60c('0x18'))['db'];function respondWithStatusCode(_0x53a83d,_0x6e06ae){_0x6e06ae=_0x6e06ae||0xcc;return function(_0x8873ec){if(_0x8873ec){return _0x53a83d[_0xb60c('0x19')](_0x6e06ae);}return _0x53a83d[_0xb60c('0x1a')](_0x6e06ae)['end']();};}function respondWithResult(_0x467d34,_0x58b63a){_0x58b63a=_0x58b63a||0xc8;return function(_0x43a8e3){if(_0x43a8e3){return _0x467d34[_0xb60c('0x1a')](_0x58b63a)[_0xb60c('0x1b')](_0x43a8e3);}};}function respondWithFilteredResult(_0x5226f8,_0x1f08be){return function(_0x1fbcf4){if(_0x1fbcf4){var _0x4f4eb3=typeof _0x1f08be[_0xb60c('0x1c')]===_0xb60c('0x1d')&&typeof _0x1f08be[_0xb60c('0x1e')]===_0xb60c('0x1d');var _0x2513c7=_0x1fbcf4[_0xb60c('0x1f')];var _0x13dc0c=_0x4f4eb3?0x0:_0x1f08be[_0xb60c('0x1c')];var _0x18366b=_0x4f4eb3?_0x1fbcf4[_0xb60c('0x1f')]:_0x1f08be[_0xb60c('0x1c')]+_0x1f08be['limit'];var _0x5ae2ae;if(_0x18366b>=_0x2513c7){_0x18366b=_0x2513c7;_0x5ae2ae=0xc8;}else{_0x5ae2ae=0xce;}_0x5226f8[_0xb60c('0x1a')](_0x5ae2ae);return _0x5226f8[_0xb60c('0x20')](_0xb60c('0x21'),_0x13dc0c+'-'+_0x18366b+'/'+_0x2513c7)['json'](_0x1fbcf4);}return null;};}function patchUpdates(_0xb774be){return function(_0x12e756){try{jsonpatch[_0xb60c('0x22')](_0x12e756,_0xb774be,!![]);}catch(_0x2484b2){return BPromise[_0xb60c('0x23')](_0x2484b2);}return _0x12e756[_0xb60c('0x24')]();};}function saveUpdates(_0x1af3cf,_0x556d27){return function(_0x4b0c9c){if(_0x4b0c9c){return _0x4b0c9c[_0xb60c('0x25')](_0x1af3cf)[_0xb60c('0x26')](function(_0x16e52f){return _0x16e52f;});}return null;};}function removeEntity(_0x3c0d7e,_0x2caea4){return function(_0x2ee952){if(_0x2ee952){return _0x2ee952[_0xb60c('0x27')]()[_0xb60c('0x26')](function(){_0x3c0d7e[_0xb60c('0x1a')](0xcc)[_0xb60c('0x28')]();});}};}function handleEntityNotFound(_0x2dfbe5,_0x414e2e){return function(_0x4f7966){if(!_0x4f7966){_0x2dfbe5['sendStatus'](0x194);}return _0x4f7966;};}function handleError(_0x585a0a,_0x4aa09b){_0x4aa09b=_0x4aa09b||0x1f4;return function(_0x358b06){logger['error'](_0x358b06[_0xb60c('0x29')]);if(_0x358b06[_0xb60c('0x2a')]){delete _0x358b06[_0xb60c('0x2a')];}_0x585a0a[_0xb60c('0x1a')](_0x4aa09b)[_0xb60c('0x2b')](_0x358b06);};}exports[_0xb60c('0x2c')]=function(_0x26192f,_0x4fc659){var _0x463c74={},_0x44650b={},_0x2e20c8={'count':0x0,'rows':[]};var _0x3888c5=_[_0xb60c('0x2d')](db[_0xb60c('0x2e')][_0xb60c('0x2f')],function(_0x2482ec){return{'name':_0x2482ec['fieldName'],'type':_0x2482ec['type']['key']};});_0x44650b[_0xb60c('0x30')]=_[_0xb60c('0x31')](_[_0xb60c('0x2d')](_0x3888c5,'name'),[_0xb60c('0x32')]);_0x44650b[_0xb60c('0x33')]=_[_0xb60c('0x34')](_0x26192f[_0xb60c('0x33')]);_0x44650b[_0xb60c('0x35')]=_[_0xb60c('0x36')](_0x44650b[_0xb60c('0x30')],_0x44650b[_0xb60c('0x33')]);_0x463c74[_0xb60c('0x37')]=_['intersection'](_0x44650b['model'],qs[_0xb60c('0x38')](_0x26192f[_0xb60c('0x33')][_0xb60c('0x38')]));_0x463c74['attributes']=_0x463c74[_0xb60c('0x37')][_0xb60c('0x39')]?_0x463c74[_0xb60c('0x37')]:_0x44650b['model'];if(!_0x26192f[_0xb60c('0x33')][_0xb60c('0x3a')](_0xb60c('0x3b'))){_0x463c74[_0xb60c('0x1e')]=qs[_0xb60c('0x1e')](_0x26192f[_0xb60c('0x33')][_0xb60c('0x1e')]);_0x463c74[_0xb60c('0x1c')]=qs[_0xb60c('0x1c')](_0x26192f[_0xb60c('0x33')]['offset']);}_0x463c74['order']=qs[_0xb60c('0x3c')](_0x26192f[_0xb60c('0x33')]['sort']);_0x463c74[_0xb60c('0x3d')]=qs[_0xb60c('0x35')](_[_0xb60c('0x3e')](_0x26192f[_0xb60c('0x33')],_0x44650b['filters']),_0x3888c5);if(_0x26192f[_0xb60c('0x33')][_0xb60c('0x3f')]){_0x463c74[_0xb60c('0x3d')]=_[_0xb60c('0x40')](_0x463c74[_0xb60c('0x3d')],{'$or':_[_0xb60c('0x2d')](_0x3888c5,function(_0x1d2162){if(_0x1d2162[_0xb60c('0x41')]!==_0xb60c('0x42')){var _0x332b13={};_0x332b13[_0x1d2162[_0xb60c('0x2a')]]={'$like':'%'+_0x26192f[_0xb60c('0x33')][_0xb60c('0x3f')]+'%'};return _0x332b13;}})});}_0x463c74=_[_0xb60c('0x40')]({},_0x463c74,_0x26192f[_0xb60c('0x43')]);var _0x317f9a={'where':_0x463c74['where']};return db[_0xb60c('0x2e')][_0xb60c('0x1f')](_0x317f9a)['then'](function(_0x88b935){_0x2e20c8[_0xb60c('0x1f')]=_0x88b935;if(_0x26192f['query'][_0xb60c('0x44')]){_0x463c74[_0xb60c('0x45')]=[{'all':!![]}];}return db[_0xb60c('0x2e')][_0xb60c('0x46')](_0x463c74);})[_0xb60c('0x26')](function(_0x391ed8){_0x2e20c8[_0xb60c('0x47')]=_0x391ed8;return _0x2e20c8;})[_0xb60c('0x26')](respondWithFilteredResult(_0x4fc659,_0x463c74))['catch'](handleError(_0x4fc659,null));};exports['show']=function(_0x4fd658,_0x27d24a){var _0x3896cf={'raw':![],'where':{'id':_0x4fd658[_0xb60c('0x48')]['id']}},_0x50dd9f={};_0x50dd9f[_0xb60c('0x30')]=_[_0xb60c('0x34')](db[_0xb60c('0x2e')]['rawAttributes']);_0x50dd9f[_0xb60c('0x33')]=_['keys'](_0x4fd658[_0xb60c('0x33')]);_0x50dd9f[_0xb60c('0x35')]=_[_0xb60c('0x36')](_0x50dd9f[_0xb60c('0x30')],_0x50dd9f[_0xb60c('0x33')]);_0x3896cf['attributes']=_[_0xb60c('0x36')](_0x50dd9f[_0xb60c('0x30')],qs['fields'](_0x4fd658[_0xb60c('0x33')][_0xb60c('0x38')]));_0x3896cf[_0xb60c('0x37')]=_0x3896cf[_0xb60c('0x37')][_0xb60c('0x39')]?_0x3896cf['attributes']:_0x50dd9f[_0xb60c('0x30')];if(_0x4fd658[_0xb60c('0x33')]['includeAll']){_0x3896cf['include']=[{'all':!![]}];}_0x3896cf=_[_0xb60c('0x40')]({},_0x3896cf,_0x4fd658[_0xb60c('0x43')]);return db['VoiceRecording'][_0xb60c('0x49')](_0x3896cf)[_0xb60c('0x26')](handleEntityNotFound(_0x27d24a,null))['then'](respondWithResult(_0x27d24a,null))[_0xb60c('0x4a')](handleError(_0x27d24a,null));};exports[_0xb60c('0x4b')]=function(_0xa8a33a,_0xbbdf28){return db['VoiceRecording'][_0xb60c('0x4b')](_0xa8a33a['body'],{})['then'](respondWithResult(_0xbbdf28,0xc9))[_0xb60c('0x4a')](handleError(_0xbbdf28,null));};exports[_0xb60c('0x25')]=function(_0x225a0f,_0x7e03b4){if(_0x225a0f[_0xb60c('0x4c')]['id']){delete _0x225a0f['body']['id'];}return db[_0xb60c('0x2e')][_0xb60c('0x49')]({'where':{'id':_0x225a0f['params']['id']}})[_0xb60c('0x26')](handleEntityNotFound(_0x7e03b4,null))[_0xb60c('0x26')](saveUpdates(_0x225a0f[_0xb60c('0x4c')],null))[_0xb60c('0x26')](respondWithResult(_0x7e03b4,null))[_0xb60c('0x4a')](handleError(_0x7e03b4,null));};exports['describe']=function(_0x1cb7f7,_0x593788){return db[_0xb60c('0x2e')]['describe']()[_0xb60c('0x26')](respondWithResult(_0x593788,null))[_0xb60c('0x4a')](handleError(_0x593788,null));};exports[_0xb60c('0x4d')]=function(_0x36b311,_0x75ec6d,_0x3a6ad2){var _0x226cec=require(_0xb60c('0x4e'));var _0x23202f=![];var _0x1369f5={};if(_0x36b311['query'][_0xb60c('0x41')]&&_0x36b311[_0xb60c('0x33')][_0xb60c('0x41')]===_0xb60c('0x4f')){_0x1369f5['uniqueid']=_0x36b311[_0xb60c('0x48')]['id'];}else{_0x1369f5['id']=_0x36b311[_0xb60c('0x48')]['id'];}return db[_0xb60c('0x2e')][_0xb60c('0x49')]({'where':_0x1369f5,'attributes':['id',_0xb60c('0x50')],'raw':!![]})[_0xb60c('0x26')](handleEntityNotFound(_0x75ec6d,null))[_0xb60c('0x26')](function(_0x55a41a){if(_0x55a41a){var _0x5d916a=_0x55a41a['value'];var _0x27e3fd=util[_0xb60c('0x32')](_0xb60c('0x51'),_0x5d916a);if(fs['existsSync'](_0x27e3fd)){_0x23202f=!![];return _0x226cec['decryptFile'](_0x27e3fd,_0x5d916a,config[_0xb60c('0x52')][_0xb60c('0x53')])['then'](function(){return _0x55a41a;});}return _0x55a41a;}})[_0xb60c('0x26')](function(_0x38f9ee){if(_0x38f9ee){var _0x31df1f=_0x38f9ee[_0xb60c('0x50')];if(!fs['existsSync'](_0x31df1f)){throw new db[(_0xb60c('0x54'))][(_0xb60c('0x55'))](_0xb60c('0x56'));}if(_0x38f9ee[_0xb60c('0x57')]){return _0x75ec6d[_0xb60c('0x4d')](_0x31df1f,_0x38f9ee['filename']+path[_0xb60c('0x58')](_0x31df1f),function(){if(_0x23202f){fs[_0xb60c('0x59')](_0x31df1f);}});}else{return _0x75ec6d[_0xb60c('0x4d')](_0x31df1f,function(_0x10fa9b){if(_0x23202f){fs['unlink'](_0x31df1f);}});}}})['catch'](function(_0x3b26df){if(_0x3b26df['message']===_0xb60c('0x56')){_0x75ec6d[_0xb60c('0x1a')](0x194)['send'](_0xb60c('0x5a'));}else{return handleError(_0x75ec6d,null);}});};exports[_0xb60c('0x5b')]=function(_0x7ee07d,_0x38494b,_0x15b9ee){var _0x3e8c0a=require(_0xb60c('0x4e'));var _0x1c30ca=![];var _0x42255e={'$and':[db[_0xb60c('0x5c')][_0xb60c('0x3d')](db[_0xb60c('0x5c')]['fn'](_0xb60c('0x5d'),db[_0xb60c('0x5c')][_0xb60c('0x5e')]('uniqueid')),_0x7ee07d[_0xb60c('0x33')][_0xb60c('0x5f')])]};if(_0x7ee07d['query'][_0xb60c('0x41')]&&_0x7ee07d['query']['type']===_0xb60c('0x4f')){_0x42255e[_0xb60c('0x60')][_0xb60c('0x61')]({'uniqueid':_0x7ee07d['params']['id']});}else{_0x42255e[_0xb60c('0x60')][_0xb60c('0x61')]({'id':_0x7ee07d[_0xb60c('0x48')]['id']});}return db[_0xb60c('0x2e')]['find']({'where':_0x42255e,'attributes':['id','value'],'raw':!![]})[_0xb60c('0x26')](handleEntityNotFound(_0x38494b,null))[_0xb60c('0x26')](function(_0xf087b7){if(_0xf087b7){var _0x1de341=util[_0xb60c('0x32')]('%s.cypher',_0xf087b7[_0xb60c('0x50')]);if(fs[_0xb60c('0x62')](_0x1de341)){_0x1c30ca=!![];return _0x3e8c0a['decryptFile'](_0x1de341,_0xf087b7['value'],config['secrets'][_0xb60c('0x53')])[_0xb60c('0x26')](function(){return _0xf087b7;});}return _0xf087b7;}})[_0xb60c('0x26')](function(_0x54ac07){if(_0x54ac07){if(!fs[_0xb60c('0x62')](_0x54ac07[_0xb60c('0x50')])){throw new db[(_0xb60c('0x54'))][(_0xb60c('0x55'))](_0xb60c('0x56'));}if(_0x54ac07[_0xb60c('0x57')]){return _0x38494b[_0xb60c('0x4d')](_0x54ac07['value'],_0x54ac07[_0xb60c('0x57')]+path[_0xb60c('0x58')](_0x54ac07[_0xb60c('0x50')]),function(){if(_0x1c30ca){fs[_0xb60c('0x59')](_0x54ac07[_0xb60c('0x50')]);}});}else{return _0x38494b[_0xb60c('0x4d')](_0x54ac07[_0xb60c('0x50')],function(_0xfb3cee){if(_0x1c30ca){fs[_0xb60c('0x59')](_0x54ac07[_0xb60c('0x50')]);}});}}})['catch'](handleError(_0x38494b,null));};exports[_0xb60c('0x27')]=function(_0xd597d7,_0x473d09){return db['VoiceRecording'][_0xb60c('0x49')]({'where':{'id':_0xd597d7[_0xb60c('0x48')]['id']}})[_0xb60c('0x26')](function(_0xdd9bcb){if(_[_0xb60c('0x63')](_0xdd9bcb)){throw new ReferenceError('Entity\x20not\x20found');}return _0xdd9bcb;})['then'](function(_0x2e6976){var _0x5aa3cb=_0x2e6976['value'];logger[_0xb60c('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x5aa3cb);if(!_[_0xb60c('0x63')](_0x2e6976[_0xb60c('0x50')])&&fs[_0xb60c('0x62')](_0x5aa3cb)){logger[_0xb60c('0x64')]('File:\x20\x22'+_0x5aa3cb+_0xb60c('0x65'));fs['unlinkSync'](_0x5aa3cb);}_0x5aa3cb=_0x5aa3cb+_0xb60c('0x66');if(!_['isNil'](_0x2e6976[_0xb60c('0x50')])&&fs[_0xb60c('0x62')](_0x5aa3cb)){logger[_0xb60c('0x64')](_0xb60c('0x67')+_0x5aa3cb+_0xb60c('0x65'));fs['unlinkSync'](_0x5aa3cb);}return _0x2e6976;})['then'](function(_0x1c836d){if(!_0x1c836d)throw new InternalError();return _0x1c836d['destroy']();})[_0xb60c('0x26')](function(){_0x473d09[_0xb60c('0x1a')](0xcc)[_0xb60c('0x28')]();})[_0xb60c('0x4a')](handleError(_0x473d09,null));};function getBucketslist(_0x1c5d60,_0x1b8cc5,_0x56ac90){return new Promise(function(_0xdeddd,_0x114b4c){var _0x1d2943=new AWS['S3']({'accessKeyId':_0x1b8cc5,'secretAccessKey':_0x1c5d60,'region':_0x56ac90});_0x1d2943[_0xb60c('0x68')]({},function(_0x45e598,_0x4cfd4f){if(_0x45e598){return _0x114b4c(_0x45e598);}else{return _0xdeddd(_0x4cfd4f);}});});}function createBucket(_0x573580,_0xe09d5a,_0x9d22e8,_0x11c589){return new Promise(function(_0x1cdfc1,_0x1b5c07){var _0x2b7128=new AWS['S3']({'accessKeyId':_0xe09d5a,'secretAccessKey':_0x573580,'region':_0x9d22e8});_0x2b7128[_0xb60c('0x69')]({'Bucket':_0x11c589},function(_0x2e5bd1,_0x43efef){if(_0x2e5bd1){return _0x1b5c07(_0x2e5bd1);}else{return _0x1cdfc1(_0x43efef);}});});}function uploadFile(_0x5068a6,_0x971d2,_0x39b963,_0x2b1a94,_0x430324,_0x22debe){return new Promise(function(_0x36f9b9,_0x152b8e){var _0x1ce79d=new AWS['S3']({'accessKeyId':_0x971d2,'secretAccessKey':_0x5068a6,'region':_0x39b963});_0x1ce79d[_0xb60c('0x6a')]({'Bucket':_0x2b1a94,'Key':_0x430324,'Body':_0x22debe},function(_0x5f06b9,_0x2d2b93){if(_0x5f06b9){return _0x152b8e(_0x5f06b9);}else{return _0x36f9b9(_0x2d2b93);}});});}function startTranscribe(_0x694a43,_0x290028,_0x7a6946,_0x53d3f0,_0x4397f7,_0x2ca36f){return new Promise(function(_0x4c58c7,_0x4ecdd7){var _0x3fd81f=new AWS['TranscribeService']({'accessKeyId':_0x290028,'secretAccessKey':_0x694a43,'region':_0x7a6946});_0x3fd81f[_0xb60c('0x6b')]({'TranscriptionJobName':_0x53d3f0,'LanguageCode':_0x4397f7,'Media':{'MediaFileUri':_0x2ca36f}},function(_0x16399d,_0x5d86e8){if(_0x16399d){return _0x4ecdd7(_0x16399d);}else{return _0x4c58c7(_0x5d86e8);}});});}function transcribe(_0x2e7df1,_0x4aa1e7,_0x397d1d,_0xeb6ae1,_0x1d4e43,_0x57a4c7,_0x19079d){return new Promise(function(_0x294663,_0x263be4){var _0x150fd4={};logger[_0xb60c('0x64')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2e7df1,_0x1d4e43));return uploadFile(_0x4aa1e7,_0x397d1d,_0xeb6ae1,_0x1d4e43,path[_0xb60c('0x6c')](_0x57a4c7),fs[_0xb60c('0x6d')](_0x57a4c7))['then'](function(_0x1e078f){logger['info'](util[_0xb60c('0x32')](_0xb60c('0x6e'),_0x2e7df1,_0x1d4e43,_0x1e078f[_0xb60c('0x6f')]));_0x150fd4[_0xb60c('0x70')]=_0x1e078f['Bucket'];_0x150fd4[_0xb60c('0x71')]=_0x1e078f[_0xb60c('0x6f')];logger[_0xb60c('0x64')](util[_0xb60c('0x32')](_0xb60c('0x72'),_0x2e7df1));return startTranscribe(_0x4aa1e7,_0x397d1d,_0xeb6ae1,uuidv4(),_0x19079d,_0x1e078f[_0xb60c('0x6f')]);})[_0xb60c('0x26')](function(_0x245b37){logger[_0xb60c('0x64')](util['format'](_0xb60c('0x73'),_0x2e7df1,_0x245b37[_0xb60c('0x74')][_0xb60c('0x75')]));_0x150fd4['transcribeName']=_0x245b37[_0xb60c('0x74')]['TranscriptionJobName'];_0x150fd4[_0xb60c('0x76')]=_0x245b37[_0xb60c('0x74')][_0xb60c('0x77')];return _0x294663(_0x150fd4);})[_0xb60c('0x4a')](function(_0x46fb32){return _0x263be4(_0x46fb32);});});}exports[_0xb60c('0x78')]=function(_0x3248cd,_0x9f9a46,_0x4663e9){var _0x4c4a96;var _0x349c14;var _0x134aa7;var _0x5f24a4=require(_0xb60c('0x4e'));return db[_0xb60c('0x2e')]['findOne']({'where':{'id':_0x3248cd[_0xb60c('0x48')]['id']}})[_0xb60c('0x26')](function(_0x10c378){if(_0x10c378){var _0x14d43b=util[_0xb60c('0x32')](_0xb60c('0x51'),_0x10c378[_0xb60c('0x50')]);if(fs[_0xb60c('0x62')](_0x14d43b)){cypher=!![];return _0x5f24a4['decryptFile'](_0x14d43b,_0x10c378['value'],config[_0xb60c('0x52')][_0xb60c('0x53')])[_0xb60c('0x26')](function(){return _0x10c378;});}return _0x10c378;}})[_0xb60c('0x26')](function(_0x49144f){if(!_0x49144f){throw new db[(_0xb60c('0x54'))][(_0xb60c('0x55'))](_0xb60c('0x79'));}_0x349c14=_0x49144f;return db[_0xb60c('0x7a')][_0xb60c('0x7b')]({'where':{'id':0x1}});})[_0xb60c('0x26')](handleEntityNotFound(_0x9f9a46,null))[_0xb60c('0x26')](function(_0x297f0c){if(_0x297f0c){_0x4c4a96=_0x297f0c;if(!_0x4c4a96[_0xb60c('0x7c')]||!_0x4c4a96[_0xb60c('0x7d')]||!_0x4c4a96[_0xb60c('0x7e')]||!_0x4c4a96[_0xb60c('0x7f')]||!_0x4c4a96[_0xb60c('0x70')]){throw new db[(_0xb60c('0x54'))][(_0xb60c('0x55'))](_0xb60c('0x80'));}if(_0x3248cd['body'][_0xb60c('0x81')]&&(!_0x4c4a96[_0xb60c('0x82')]||!_0x4c4a96[_0xb60c('0x83')]||!_0x4c4a96[_0xb60c('0x84')]||!_0x4c4a96['language']||!_0x4c4a96[_0xb60c('0x70')])){throw new db[(_0xb60c('0x54'))]['ValidationError'](_0xb60c('0x85'));}return db['CloudProvider']['findOne']({'where':{'id':_0x4c4a96[_0xb60c('0x7d')]}});}})[_0xb60c('0x26')](function(_0x136172){if(!_0x136172){throw new db[(_0xb60c('0x54'))]['ValidationError'](_0xb60c('0x86'));}if(!_0x136172['data1']||!_0x136172[_0xb60c('0x87')]){throw new db['Sequelize'][(_0xb60c('0x55'))](_0xb60c('0x88'));}_0x134aa7=_0x136172;return getBucketslist(_0x134aa7['data1'],_0x134aa7[_0xb60c('0x87')],_0x4c4a96['transcribeRegion']);})['then'](function(_0x33b85e){if(_0x33b85e&&_0x33b85e[_0xb60c('0x89')]){var _0x4a0a52=_[_0xb60c('0x49')](_0x33b85e[_0xb60c('0x89')],function(_0x15e6e3){return _0x15e6e3['Name']===_0x4c4a96[_0xb60c('0x70')];});if(!_0x4a0a52){logger[_0xb60c('0x64')](util[_0xb60c('0x32')](_0xb60c('0x8a'),_0x3248cd[_0xb60c('0x48')]['id'],_0x4c4a96[_0xb60c('0x70')]));return createBucket(_0x134aa7[_0xb60c('0x8b')],_0x134aa7[_0xb60c('0x87')],_0x4c4a96[_0xb60c('0x7e')],_0x4c4a96['bucket']);}logger[_0xb60c('0x64')](util['format'](_0xb60c('0x8c'),_0x3248cd['params']['id'],_0x4c4a96[_0xb60c('0x70')]));return;}})[_0xb60c('0x26')](function(_0x2febb7){if(_0x349c14['transcribeStatus']===_0xb60c('0x8d')){return transcribe(_0x3248cd[_0xb60c('0x48')]['id'],_0x134aa7[_0xb60c('0x8b')],_0x134aa7[_0xb60c('0x87')],_0x4c4a96['transcribeRegion'],_0x4c4a96['bucket'],_0x349c14[_0xb60c('0x50')],_0x4c4a96[_0xb60c('0x7f')]);}else{logger[_0xb60c('0x64')](util[_0xb60c('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3248cd[_0xb60c('0x48')]['id']));return{'transcribeStatus':_0xb60c('0x8e')};}})[_0xb60c('0x26')](function(_0x1d0b74){if(_0x1d0b74){_0x1d0b74[_0xb60c('0x8f')]=_0x3248cd[_0xb60c('0x4c')]['runSentiment'];return _0x349c14['updateAttributes'](_0x1d0b74);}})[_0xb60c('0x26')](respondWithResult(_0x9f9a46,null))[_0xb60c('0x4a')](handleError(_0x9f9a46,null));};function writeFile(_0x4ee3cf,_0x4473ad){return new Promise(function(_0x3df8e1,_0x5aec8a){fs[_0xb60c('0x90')](_0x4473ad,_0x4ee3cf,function(_0x58d889,_0x153a84){if(_0x58d889){return _0x5aec8a(_0x58d889);}else{return _0x3df8e1(_0x153a84);}});});}exports[_0xb60c('0x91')]=function(_0x1ca24e,_0x589ad3,_0x3140ec){return db['VoiceRecording']['findOne']({'where':{'id':_0x1ca24e[_0xb60c('0x48')]['id']}})['then'](handleEntityNotFound(_0x589ad3))[_0xb60c('0x26')](function(_0x1023e5){if(_0x1023e5&&_0x1023e5[_0xb60c('0x92')]){var _0x5387cd=_0x1023e5[_0xb60c('0x92')];var _0x1ffd4a=config[_0xb60c('0x93')]+'/server/files/transcribes/transcribe_'+_0x1023e5['id']+_0xb60c('0x94');if(fs[_0xb60c('0x62')](_0x1ffd4a)){return _0x1ffd4a;}return writeFile(_0x5387cd,_0x1ffd4a)['then'](function(){return _0x1ffd4a;});}else{throw new db[(_0xb60c('0x54'))][(_0xb60c('0x55'))]('Transcript\x20not\x20available');}})[_0xb60c('0x26')](function(_0x438254){return _0x589ad3[_0xb60c('0x4d')](_0x438254);})[_0xb60c('0x4a')](handleError(_0x589ad3));}; \ No newline at end of file +var _0x46b5=['[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','params','keys','include','create','body','describe','download','../../components/encryptor','uniqueid','find','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','$and','push','Sequelize','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20configured','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available'];(function(_0x25d5b1,_0x523cd9){var _0x5814c6=function(_0x4115bb){while(--_0x4115bb){_0x25d5b1['push'](_0x25d5b1['shift']());}};_0x5814c6(++_0x523cd9);}(_0x46b5,0x1e0));var _0x546b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x46b5[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x546b('0x0'));var rimraf=require(_0x546b('0x1'));var zipdir=require(_0x546b('0x2'));var jsonpatch=require(_0x546b('0x3'));var rp=require(_0x546b('0x4'));var moment=require(_0x546b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x546b('0x6'));var util=require(_0x546b('0x7'));var path=require('path');var sox=require(_0x546b('0x8'));var csv=require(_0x546b('0x9'));var ejs=require(_0x546b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x546b('0xb'));var squel=require(_0x546b('0xc'));var crypto=require(_0x546b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x546b('0xe'));var toCsv=require(_0x546b('0x9'));var querystring=require(_0x546b('0xf'));var Papa=require(_0x546b('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x546b('0x11'));var Redis=require(_0x546b('0x12'));var authService=require(_0x546b('0x13'));var qs=require(_0x546b('0x14'));var as=require(_0x546b('0x15'));var hardwareService=require(_0x546b('0x16'));var logger=require('../../config/logger')(_0x546b('0x17'));var utils=require('../../config/utils');var config=require(_0x546b('0x18'));var licenseUtil=require(_0x546b('0x19'));var db=require(_0x546b('0x1a'))['db'];function respondWithStatusCode(_0x917e82,_0x50ed99){_0x50ed99=_0x50ed99||0xcc;return function(_0x55d499){if(_0x55d499){return _0x917e82[_0x546b('0x1b')](_0x50ed99);}return _0x917e82[_0x546b('0x1c')](_0x50ed99)['end']();};}function respondWithResult(_0x5f468f,_0x5be752){_0x5be752=_0x5be752||0xc8;return function(_0x372c83){if(_0x372c83){return _0x5f468f['status'](_0x5be752)['json'](_0x372c83);}};}function respondWithFilteredResult(_0x4ce6f6,_0x5a3327){return function(_0x5d2048){if(_0x5d2048){var _0x3b0ae1=typeof _0x5a3327[_0x546b('0x1d')]===_0x546b('0x1e')&&typeof _0x5a3327[_0x546b('0x1f')]==='undefined';var _0x3877c0=_0x5d2048[_0x546b('0x20')];var _0xb74889=_0x3b0ae1?0x0:_0x5a3327[_0x546b('0x1d')];var _0x1cd48a=_0x3b0ae1?_0x5d2048[_0x546b('0x20')]:_0x5a3327[_0x546b('0x1d')]+_0x5a3327[_0x546b('0x1f')];var _0x556972;if(_0x1cd48a>=_0x3877c0){_0x1cd48a=_0x3877c0;_0x556972=0xc8;}else{_0x556972=0xce;}_0x4ce6f6[_0x546b('0x1c')](_0x556972);return _0x4ce6f6[_0x546b('0x21')](_0x546b('0x22'),_0xb74889+'-'+_0x1cd48a+'/'+_0x3877c0)[_0x546b('0x23')](_0x5d2048);}return null;};}function patchUpdates(_0x30f0e4){return function(_0x560df2){try{jsonpatch[_0x546b('0x24')](_0x560df2,_0x30f0e4,!![]);}catch(_0x38f8d8){return BPromise[_0x546b('0x25')](_0x38f8d8);}return _0x560df2[_0x546b('0x26')]();};}function saveUpdates(_0x57f138,_0x40620e){return function(_0x1b2870){if(_0x1b2870){return _0x1b2870[_0x546b('0x27')](_0x57f138)[_0x546b('0x28')](function(_0x5adbbc){return _0x5adbbc;});}return null;};}function removeEntity(_0xfa5508,_0x31fbbe){return function(_0x3d1be5){if(_0x3d1be5){return _0x3d1be5[_0x546b('0x29')]()[_0x546b('0x28')](function(){_0xfa5508['status'](0xcc)[_0x546b('0x2a')]();});}};}function handleEntityNotFound(_0x172c5b,_0x2c03c3){return function(_0x484496){if(!_0x484496){_0x172c5b[_0x546b('0x1b')](0x194);}return _0x484496;};}function handleError(_0x3842c2,_0x114094){_0x114094=_0x114094||0x1f4;return function(_0xef575b){logger[_0x546b('0x2b')](_0xef575b[_0x546b('0x2c')]);if(_0xef575b[_0x546b('0x2d')]){delete _0xef575b[_0x546b('0x2d')];}_0x3842c2[_0x546b('0x1c')](_0x114094)[_0x546b('0x2e')](_0xef575b);};}exports[_0x546b('0x2f')]=function(_0x51ccb0,_0x516831){var _0x1cb040={},_0x134482={},_0x46eb93={'count':0x0,'rows':[]};var _0x4a0006=_[_0x546b('0x30')](db[_0x546b('0x31')][_0x546b('0x32')],function(_0x114811){return{'name':_0x114811[_0x546b('0x33')],'type':_0x114811[_0x546b('0x34')][_0x546b('0x35')]};});_0x134482[_0x546b('0x36')]=_[_0x546b('0x37')](_[_0x546b('0x30')](_0x4a0006,_0x546b('0x2d')),[_0x546b('0x38')]);_0x134482[_0x546b('0x39')]=_['keys'](_0x51ccb0[_0x546b('0x39')]);_0x134482[_0x546b('0x3a')]=_[_0x546b('0x3b')](_0x134482['model'],_0x134482[_0x546b('0x39')]);_0x1cb040[_0x546b('0x3c')]=_['intersection'](_0x134482['model'],qs[_0x546b('0x3d')](_0x51ccb0[_0x546b('0x39')][_0x546b('0x3d')]));_0x1cb040[_0x546b('0x3c')]=_0x1cb040[_0x546b('0x3c')][_0x546b('0x3e')]?_0x1cb040[_0x546b('0x3c')]:_0x134482[_0x546b('0x36')];if(!_0x51ccb0[_0x546b('0x39')][_0x546b('0x3f')](_0x546b('0x40'))){_0x1cb040[_0x546b('0x1f')]=qs[_0x546b('0x1f')](_0x51ccb0[_0x546b('0x39')][_0x546b('0x1f')]);_0x1cb040[_0x546b('0x1d')]=qs[_0x546b('0x1d')](_0x51ccb0[_0x546b('0x39')]['offset']);}_0x1cb040['order']=qs['sort'](_0x51ccb0[_0x546b('0x39')][_0x546b('0x41')]);_0x1cb040[_0x546b('0x42')]=qs[_0x546b('0x3a')](_[_0x546b('0x43')](_0x51ccb0[_0x546b('0x39')],_0x134482['filters']),_0x4a0006);if(_0x51ccb0[_0x546b('0x39')][_0x546b('0x44')]){_0x1cb040[_0x546b('0x42')]=_['merge'](_0x1cb040[_0x546b('0x42')],{'$or':_['map'](_0x4a0006,function(_0x2f5b99){if(_0x2f5b99[_0x546b('0x34')]!==_0x546b('0x45')){var _0x36dfc7={};_0x36dfc7[_0x2f5b99[_0x546b('0x2d')]]={'$like':'%'+_0x51ccb0['query']['filter']+'%'};return _0x36dfc7;}})});}_0x1cb040=_[_0x546b('0x46')]({},_0x1cb040,_0x51ccb0[_0x546b('0x47')]);var _0x4bb487={'where':_0x1cb040[_0x546b('0x42')]};return db[_0x546b('0x31')][_0x546b('0x20')](_0x4bb487)[_0x546b('0x28')](function(_0x32ff8c){_0x46eb93[_0x546b('0x20')]=_0x32ff8c;if(_0x51ccb0['query'][_0x546b('0x48')]){_0x1cb040['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x546b('0x49')](_0x1cb040);})[_0x546b('0x28')](function(_0x42c108){_0x46eb93['rows']=_0x42c108;return _0x46eb93;})[_0x546b('0x28')](respondWithFilteredResult(_0x516831,_0x1cb040))[_0x546b('0x4a')](handleError(_0x516831,null));};exports['show']=function(_0x11c840,_0x28aa35){var _0x24fc75={'raw':![],'where':{'id':_0x11c840[_0x546b('0x4b')]['id']}},_0x37eb6b={};_0x37eb6b[_0x546b('0x36')]=_['keys'](db['VoiceRecording'][_0x546b('0x32')]);_0x37eb6b[_0x546b('0x39')]=_[_0x546b('0x4c')](_0x11c840['query']);_0x37eb6b['filters']=_['intersection'](_0x37eb6b[_0x546b('0x36')],_0x37eb6b[_0x546b('0x39')]);_0x24fc75[_0x546b('0x3c')]=_[_0x546b('0x3b')](_0x37eb6b[_0x546b('0x36')],qs['fields'](_0x11c840[_0x546b('0x39')][_0x546b('0x3d')]));_0x24fc75[_0x546b('0x3c')]=_0x24fc75[_0x546b('0x3c')][_0x546b('0x3e')]?_0x24fc75[_0x546b('0x3c')]:_0x37eb6b[_0x546b('0x36')];if(_0x11c840[_0x546b('0x39')][_0x546b('0x48')]){_0x24fc75[_0x546b('0x4d')]=[{'all':!![]}];}_0x24fc75=_['merge']({},_0x24fc75,_0x11c840['options']);return db['VoiceRecording']['find'](_0x24fc75)[_0x546b('0x28')](handleEntityNotFound(_0x28aa35,null))[_0x546b('0x28')](respondWithResult(_0x28aa35,null))[_0x546b('0x4a')](handleError(_0x28aa35,null));};exports[_0x546b('0x4e')]=function(_0xc27cff,_0x222ea6){return db['VoiceRecording'][_0x546b('0x4e')](_0xc27cff['body'],{})[_0x546b('0x28')](respondWithResult(_0x222ea6,0xc9))[_0x546b('0x4a')](handleError(_0x222ea6,null));};exports[_0x546b('0x27')]=function(_0xe11edb,_0x454ff5){if(_0xe11edb[_0x546b('0x4f')]['id']){delete _0xe11edb[_0x546b('0x4f')]['id'];}return db[_0x546b('0x31')]['find']({'where':{'id':_0xe11edb[_0x546b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x454ff5,null))[_0x546b('0x28')](saveUpdates(_0xe11edb[_0x546b('0x4f')],null))[_0x546b('0x28')](respondWithResult(_0x454ff5,null))[_0x546b('0x4a')](handleError(_0x454ff5,null));};exports[_0x546b('0x50')]=function(_0x17d719,_0x47dade){return db['VoiceRecording'][_0x546b('0x50')]()[_0x546b('0x28')](respondWithResult(_0x47dade,null))['catch'](handleError(_0x47dade,null));};exports[_0x546b('0x51')]=function(_0x47809d,_0x10ba1a,_0x20de8c){var _0x5822aa=require(_0x546b('0x52'));var _0x5bdb85=![];var _0x1e2746={};if(_0x47809d[_0x546b('0x39')][_0x546b('0x34')]&&_0x47809d[_0x546b('0x39')][_0x546b('0x34')]===_0x546b('0x53')){_0x1e2746[_0x546b('0x53')]=_0x47809d[_0x546b('0x4b')]['id'];}else{_0x1e2746['id']=_0x47809d[_0x546b('0x4b')]['id'];}return db[_0x546b('0x31')][_0x546b('0x54')]({'where':_0x1e2746,'attributes':['id',_0x546b('0x55')],'raw':!![]})[_0x546b('0x28')](handleEntityNotFound(_0x10ba1a,null))[_0x546b('0x28')](function(_0x431aaa){if(_0x431aaa){var _0x4c242f=_0x431aaa['value'];var _0x39dc8c=util['format'](_0x546b('0x56'),_0x4c242f);if(fs[_0x546b('0x57')](_0x39dc8c)){_0x5bdb85=!![];return _0x5822aa[_0x546b('0x58')](_0x39dc8c,_0x4c242f,config[_0x546b('0x59')][_0x546b('0x5a')])[_0x546b('0x28')](function(){return _0x431aaa;});}return _0x431aaa;}})['then'](function(_0x1b19df){if(_0x1b19df){var _0x28f137=_0x1b19df[_0x546b('0x55')];if(!fs[_0x546b('0x57')](_0x28f137)){throw new db['Sequelize'][(_0x546b('0x5b'))](_0x546b('0x5c'));}if(_0x1b19df['filename']){return _0x10ba1a[_0x546b('0x51')](_0x28f137,_0x1b19df[_0x546b('0x5d')]+path[_0x546b('0x5e')](_0x28f137),function(){if(_0x5bdb85){fs[_0x546b('0x5f')](_0x28f137);}});}else{return _0x10ba1a[_0x546b('0x51')](_0x28f137,function(_0x40e1c0){if(_0x5bdb85){fs[_0x546b('0x5f')](_0x28f137);}});}}})[_0x546b('0x4a')](function(_0x2a593b){if(_0x2a593b[_0x546b('0x60')]==='VoiceRecording\x20not\x20found'){_0x10ba1a['status'](0x194)[_0x546b('0x2e')]('Not\x20found');}else{return handleError(_0x10ba1a,null);}});};exports[_0x546b('0x61')]=function(_0x28b7de,_0xcf202a,_0xd13538){var _0x18b5e9=require(_0x546b('0x52'));var _0x3b3bbb=![];var _0x29e929={'$and':[db[_0x546b('0x62')][_0x546b('0x42')](db[_0x546b('0x62')]['fn'](_0x546b('0x63'),db['sequelize'][_0x546b('0x64')]('uniqueid')),_0x28b7de[_0x546b('0x39')][_0x546b('0x65')])]};if(_0x28b7de[_0x546b('0x39')][_0x546b('0x34')]&&_0x28b7de[_0x546b('0x39')]['type']===_0x546b('0x53')){_0x29e929[_0x546b('0x66')][_0x546b('0x67')]({'uniqueid':_0x28b7de[_0x546b('0x4b')]['id']});}else{_0x29e929[_0x546b('0x66')][_0x546b('0x67')]({'id':_0x28b7de[_0x546b('0x4b')]['id']});}return db[_0x546b('0x31')][_0x546b('0x54')]({'where':_0x29e929,'attributes':['id','value'],'raw':!![]})[_0x546b('0x28')](handleEntityNotFound(_0xcf202a,null))[_0x546b('0x28')](function(_0x251429){if(_0x251429){var _0xbb4d0d=util[_0x546b('0x38')](_0x546b('0x56'),_0x251429[_0x546b('0x55')]);if(fs[_0x546b('0x57')](_0xbb4d0d)){_0x3b3bbb=!![];return _0x18b5e9['decryptFile'](_0xbb4d0d,_0x251429[_0x546b('0x55')],config[_0x546b('0x59')][_0x546b('0x5a')])[_0x546b('0x28')](function(){return _0x251429;});}return _0x251429;}})[_0x546b('0x28')](function(_0x4c3d82){if(_0x4c3d82){if(!fs['existsSync'](_0x4c3d82[_0x546b('0x55')])){throw new db[(_0x546b('0x68'))]['ValidationError'](_0x546b('0x5c'));}if(_0x4c3d82[_0x546b('0x5d')]){return _0xcf202a[_0x546b('0x51')](_0x4c3d82[_0x546b('0x55')],_0x4c3d82[_0x546b('0x5d')]+path[_0x546b('0x5e')](_0x4c3d82[_0x546b('0x55')]),function(){if(_0x3b3bbb){fs[_0x546b('0x5f')](_0x4c3d82['value']);}});}else{return _0xcf202a['download'](_0x4c3d82[_0x546b('0x55')],function(_0x1992de){if(_0x3b3bbb){fs[_0x546b('0x5f')](_0x4c3d82['value']);}});}}})[_0x546b('0x4a')](handleError(_0xcf202a,null));};exports[_0x546b('0x29')]=function(_0xfae2b6,_0x25557e){return db[_0x546b('0x31')][_0x546b('0x54')]({'where':{'id':_0xfae2b6['params']['id']}})[_0x546b('0x28')](function(_0xd8ad6c){if(_['isNil'](_0xd8ad6c)){throw new ReferenceError(_0x546b('0x69'));}return _0xd8ad6c;})[_0x546b('0x28')](function(_0xeba0aa){var _0x46def2=_0xeba0aa['value'];logger[_0x546b('0x6a')](_0x546b('0x6b'),_0x46def2);if(!_['isNil'](_0xeba0aa[_0x546b('0x55')])&&fs['existsSync'](_0x46def2)){logger[_0x546b('0x6a')]('File:\x20\x22'+_0x46def2+_0x546b('0x6c'));fs['unlinkSync'](_0x46def2);}_0x46def2=_0x46def2+_0x546b('0x6d');if(!_['isNil'](_0xeba0aa['value'])&&fs[_0x546b('0x57')](_0x46def2)){logger[_0x546b('0x6a')]('File:\x20\x22'+_0x46def2+_0x546b('0x6c'));fs['unlinkSync'](_0x46def2);}return _0xeba0aa;})[_0x546b('0x28')](function(_0x3f73f0){if(!_0x3f73f0)throw new InternalError();return _0x3f73f0['destroy']();})[_0x546b('0x28')](function(){_0x25557e[_0x546b('0x1c')](0xcc)[_0x546b('0x2a')]();})[_0x546b('0x4a')](handleError(_0x25557e,null));};function getBucketslist(_0x248e5d,_0x34a402,_0x5c0beb){return new Promise(function(_0x1e963c,_0x37e880){var _0x12aa1f=new AWS['S3']({'accessKeyId':_0x34a402,'secretAccessKey':_0x248e5d,'region':_0x5c0beb});_0x12aa1f[_0x546b('0x6e')]({},function(_0x5602e9,_0x16b9e9){if(_0x5602e9){return _0x37e880(_0x5602e9);}else{return _0x1e963c(_0x16b9e9);}});});}function createBucket(_0x174aa9,_0x274e42,_0x56f517,_0xe983e3){return new Promise(function(_0x288c4f,_0x1accbd){var _0x45e334=new AWS['S3']({'accessKeyId':_0x274e42,'secretAccessKey':_0x174aa9,'region':_0x56f517});_0x45e334[_0x546b('0x6f')]({'Bucket':_0xe983e3},function(_0x6f3784,_0x21ca79){if(_0x6f3784){return _0x1accbd(_0x6f3784);}else{return _0x288c4f(_0x21ca79);}});});}function uploadFile(_0x1ce6a1,_0x4940ad,_0x58e51e,_0x21b320,_0x129416,_0x3400bd){return new Promise(function(_0x38b988,_0x40ee9e){var _0x182c10=new AWS['S3']({'accessKeyId':_0x4940ad,'secretAccessKey':_0x1ce6a1,'region':_0x58e51e});_0x182c10[_0x546b('0x70')]({'Bucket':_0x21b320,'Key':_0x129416,'Body':_0x3400bd},function(_0x471af6,_0x2afcba){if(_0x471af6){return _0x40ee9e(_0x471af6);}else{return _0x38b988(_0x2afcba);}});});}function startTranscribe(_0x3ee6d3,_0x1546a8,_0xdc3819,_0x202c8f,_0x59c5b3,_0x374191){return new Promise(function(_0x4c7cf7,_0x8e64a4){var _0x351743=new AWS[(_0x546b('0x71'))]({'accessKeyId':_0x1546a8,'secretAccessKey':_0x3ee6d3,'region':_0xdc3819});_0x351743[_0x546b('0x72')]({'TranscriptionJobName':_0x202c8f,'LanguageCode':_0x59c5b3,'Media':{'MediaFileUri':_0x374191}},function(_0x428739,_0x2b6a04){if(_0x428739){return _0x8e64a4(_0x428739);}else{return _0x4c7cf7(_0x2b6a04);}});});}function transcribe(_0x136000,_0x201c52,_0xf442f2,_0x10ebed,_0x5ea782,_0x50cdde,_0x4412e2){return new Promise(function(_0x3134ad,_0x47fae6){var _0x2969a0={};logger['info'](util[_0x546b('0x38')](_0x546b('0x73'),_0x136000,_0x5ea782));return uploadFile(_0x201c52,_0xf442f2,_0x10ebed,_0x5ea782,path[_0x546b('0x74')](_0x50cdde),fs[_0x546b('0x75')](_0x50cdde))[_0x546b('0x28')](function(_0x36b19f){logger['info'](util[_0x546b('0x38')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x136000,_0x5ea782,_0x36b19f['Location']));_0x2969a0[_0x546b('0x76')]=_0x36b19f[_0x546b('0x77')];_0x2969a0[_0x546b('0x78')]=_0x36b19f[_0x546b('0x79')];logger['info'](util[_0x546b('0x38')](_0x546b('0x7a'),_0x136000));return startTranscribe(_0x201c52,_0xf442f2,_0x10ebed,uuidv4(),_0x4412e2,_0x36b19f[_0x546b('0x79')]);})[_0x546b('0x28')](function(_0x48870d){logger[_0x546b('0x6a')](util['format'](_0x546b('0x7b'),_0x136000,_0x48870d['TranscriptionJob']['TranscriptionJobName']));_0x2969a0[_0x546b('0x7c')]=_0x48870d[_0x546b('0x7d')][_0x546b('0x7e')];_0x2969a0[_0x546b('0x7f')]=_0x48870d[_0x546b('0x7d')][_0x546b('0x80')];return _0x3134ad(_0x2969a0);})['catch'](function(_0x2ac472){return _0x47fae6(_0x2ac472);});});}exports[_0x546b('0x81')]=function(_0x1991be,_0x46f1aa,_0x41f70f){var _0x2ea31a;var _0x217c3e;var _0x229971;var _0x22b9dd=require('../../components/encryptor');return db[_0x546b('0x31')][_0x546b('0x82')]({'where':{'id':_0x1991be[_0x546b('0x4b')]['id']}})[_0x546b('0x28')](function(_0xbc4cad){if(_0xbc4cad){var _0x160905=util[_0x546b('0x38')]('%s.cypher',_0xbc4cad[_0x546b('0x55')]);if(fs[_0x546b('0x57')](_0x160905)){cypher=!![];return _0x22b9dd[_0x546b('0x58')](_0x160905,_0xbc4cad[_0x546b('0x55')],config['secrets'][_0x546b('0x5a')])[_0x546b('0x28')](function(){return _0xbc4cad;});}return _0xbc4cad;}})['then'](function(_0x488e45){if(!_0x488e45){throw new db[(_0x546b('0x68'))][(_0x546b('0x5b'))](_0x546b('0x83'));}_0x217c3e=_0x488e45;return db[_0x546b('0x84')]['findOne']({'where':{'id':0x1}});})[_0x546b('0x28')](handleEntityNotFound(_0x46f1aa,null))[_0x546b('0x28')](function(_0x221c82){if(_0x221c82){_0x2ea31a=_0x221c82;if(!_0x2ea31a[_0x546b('0x85')]||!_0x2ea31a[_0x546b('0x86')]||!_0x2ea31a['transcribeRegion']||!_0x2ea31a[_0x546b('0x87')]||!_0x2ea31a['bucket']){throw new db['Sequelize'][(_0x546b('0x5b'))]('Transcribe\x20not\x20configured');}if(_0x1991be[_0x546b('0x4f')][_0x546b('0x88')]&&(!_0x2ea31a['sentiment']||!_0x2ea31a[_0x546b('0x89')]||!_0x2ea31a[_0x546b('0x8a')]||!_0x2ea31a['language']||!_0x2ea31a['bucket'])){throw new db[(_0x546b('0x68'))][(_0x546b('0x5b'))](_0x546b('0x8b'));}return db[_0x546b('0x8c')][_0x546b('0x82')]({'where':{'id':_0x2ea31a['transcribeAccountId']}});}})[_0x546b('0x28')](function(_0xde3ab1){if(!_0xde3ab1){throw new db['Sequelize'][(_0x546b('0x5b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xde3ab1['data1']||!_0xde3ab1['data2']){throw new db[(_0x546b('0x68'))]['ValidationError'](_0x546b('0x8d'));}_0x229971=_0xde3ab1;return getBucketslist(_0x229971[_0x546b('0x8e')],_0x229971[_0x546b('0x8f')],_0x2ea31a[_0x546b('0x90')]);})['then'](function(_0x51de4f){if(_0x51de4f&&_0x51de4f['Buckets']){var _0x3800d4=_[_0x546b('0x54')](_0x51de4f[_0x546b('0x91')],function(_0x52b292){return _0x52b292[_0x546b('0x92')]===_0x2ea31a[_0x546b('0x76')];});if(!_0x3800d4){logger[_0x546b('0x6a')](util[_0x546b('0x38')](_0x546b('0x93'),_0x1991be[_0x546b('0x4b')]['id'],_0x2ea31a[_0x546b('0x76')]));return createBucket(_0x229971[_0x546b('0x8e')],_0x229971[_0x546b('0x8f')],_0x2ea31a[_0x546b('0x90')],_0x2ea31a[_0x546b('0x76')]);}logger[_0x546b('0x6a')](util[_0x546b('0x38')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1991be[_0x546b('0x4b')]['id'],_0x2ea31a[_0x546b('0x76')]));return;}})[_0x546b('0x28')](function(_0x462dce){if(_0x217c3e[_0x546b('0x7f')]==='NEW'){return transcribe(_0x1991be[_0x546b('0x4b')]['id'],_0x229971[_0x546b('0x8e')],_0x229971[_0x546b('0x8f')],_0x2ea31a[_0x546b('0x90')],_0x2ea31a[_0x546b('0x76')],_0x217c3e['value'],_0x2ea31a['language']);}else{logger['info'](util[_0x546b('0x38')](_0x546b('0x94'),_0x1991be[_0x546b('0x4b')]['id']));return{'transcribeStatus':_0x546b('0x95')};}})['then'](function(_0x234bb1){if(_0x234bb1){_0x234bb1['tempSentiment']=_0x1991be[_0x546b('0x4f')][_0x546b('0x88')];return _0x217c3e[_0x546b('0x96')](_0x234bb1);}})[_0x546b('0x28')](respondWithResult(_0x46f1aa,null))[_0x546b('0x4a')](handleError(_0x46f1aa,null));};function writeFile(_0x15c48c,_0x580512){return new Promise(function(_0x126534,_0x5476a0){fs[_0x546b('0x97')](_0x580512,_0x15c48c,function(_0x2954c7,_0x5977e6){if(_0x2954c7){return _0x5476a0(_0x2954c7);}else{return _0x126534(_0x5977e6);}});});}exports[_0x546b('0x98')]=function(_0x34aac3,_0x1c234b,_0x832b4f){return db[_0x546b('0x31')][_0x546b('0x82')]({'where':{'id':_0x34aac3[_0x546b('0x4b')]['id']}})[_0x546b('0x28')](handleEntityNotFound(_0x1c234b))['then'](function(_0x4d0c77){if(_0x4d0c77&&_0x4d0c77['fileText']){var _0x170543=_0x4d0c77[_0x546b('0x99')];var _0x467ac5=config[_0x546b('0x9a')]+'/server/files/transcribes/transcribe_'+_0x4d0c77['id']+_0x546b('0x9b');if(fs[_0x546b('0x57')](_0x467ac5)){return _0x467ac5;}return writeFile(_0x170543,_0x467ac5)[_0x546b('0x28')](function(){return _0x467ac5;});}else{throw new db[(_0x546b('0x68'))]['ValidationError'](_0x546b('0x9c'));}})[_0x546b('0x28')](function(_0x52d038){return _0x1c234b[_0x546b('0x51')](_0x52d038);})[_0x546b('0x4a')](handleError(_0x1c234b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index c3af289..dccc56d 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 _0x46b7=['uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x41a023,_0x3b570e){var _0x50f761=function(_0x17f518){while(--_0x17f518){_0x41a023['push'](_0x41a023['shift']());}};_0x50f761(++_0x3b570e);}(_0x46b7,0xa9));var _0x746b=function(_0x459c43,_0x3f1229){_0x459c43=_0x459c43-0x0;var _0x1d7e46=_0x46b7[_0x459c43];return _0x1d7e46;};'use strict';var _=require('lodash');var util=require(_0x746b('0x0'));var logger=require(_0x746b('0x1'))(_0x746b('0x2'));var moment=require(_0x746b('0x3'));var BPromise=require('bluebird');var rp=require(_0x746b('0x4'));var fs=require('fs');var path=require(_0x746b('0x5'));var rimraf=require(_0x746b('0x6'));var config=require('../../config/environment');var attributes=require(_0x746b('0x7'));module[_0x746b('0x8')]=function(_0x167839,_0x50b09e){return _0x167839[_0x746b('0x9')](_0x746b('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x746b('0xb'),'fields':[_0x746b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xffc8=['VoiceRecording','voice_recordings','uniqueid','../../config/logger','api','moment','bluebird','request-promise','./voiceRecording.attributes'];(function(_0x28d9f2,_0x1dd7da){var _0x5e864f=function(_0x455556){while(--_0x455556){_0x28d9f2['push'](_0x28d9f2['shift']());}};_0x5e864f(++_0x1dd7da);}(_0xffc8,0x111));var _0x8ffc=function(_0x362891,_0x3361b2){_0x362891=_0x362891-0x0;var _0x5f2d36=_0xffc8[_0x362891];return _0x5f2d36;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8ffc('0x0'))(_0x8ffc('0x1'));var moment=require(_0x8ffc('0x2'));var BPromise=require(_0x8ffc('0x3'));var rp=require(_0x8ffc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8ffc('0x5'));module['exports']=function(_0x1a820e,_0x20aea6){return _0x1a820e['define'](_0x8ffc('0x6'),attributes,{'tableName':_0x8ffc('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8ffc('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 085a385..c3bbc9d 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 _0xb145=['info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','then','create','existsSync','format','value','encryptFile','recording','unlink','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb145,0xa3));var _0x5b14=function(_0x4d602e,_0x6d47f2){_0x4d602e=_0x4d602e-0x0;var _0x529761=_0xb145[_0x4d602e];return _0x529761;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});}exports['UpdateVoiceRecording']=function(_0x48d395){var _0x58bf3c=this;return new Promise(function(_0x3f397d,_0x3035b5){return db[_0x5b14('0x17')][_0x5b14('0x18')](_0x48d395[_0x5b14('0x19')],{'raw':_0x48d395[_0x5b14('0x1a')]?_0x48d395[_0x5b14('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48d395['options']?_0x48d395['options'][_0x5b14('0x1b')]||null:null,'attributes':_0x48d395[_0x5b14('0x1a')]?_0x48d395[_0x5b14('0x1a')][_0x5b14('0x1c')]||null:null,'limit':_0x48d395['options']?_0x48d395[_0x5b14('0x1a')][_0x5b14('0x1d')]||null:null})['then'](function(_0x2d7b38){logger[_0x5b14('0xd')]('UpdateVoiceRecording',_0x48d395);logger[_0x5b14('0xf')]('UpdateVoiceRecording',_0x48d395,JSON['stringify'](_0x2d7b38));_0x3f397d(_0x2d7b38);})['catch'](function(_0x4def4b){logger[_0x5b14('0x12')](_0x5b14('0x1e'),_0x4def4b[_0x5b14('0x14')],_0x48d395);_0x3035b5(_0x58bf3c['error'](0x1f4,_0x4def4b[_0x5b14('0x14')]));});});};exports[_0x5b14('0x1f')]=function(_0x2ac7b0){var _0x143648=this;return new Promise(function(_0xe6851b,_0x1bbbd7){var _0x422d22=require(_0x5b14('0x20'));var _0x296d65;return db[_0x5b14('0x21')][_0x5b14('0x22')]({'attributes':['id',_0x5b14('0x23')],'where':{'id':0x1},'raw':!![]})[_0x5b14('0x24')](function(_0x266bbe){_0x296d65=_0x266bbe;return db['VoiceRecording'][_0x5b14('0x25')](_0x2ac7b0[_0x5b14('0x19')]);})['then'](function(_0x4ecf7c){if(_0x296d65[_0x5b14('0x23')]&&fs[_0x5b14('0x26')](_0x4ecf7c['value'])){var _0x4c1f0e=util[_0x5b14('0x27')]('%s.cypher',_0x4ecf7c[_0x5b14('0x28')]);return _0x422d22[_0x5b14('0x29')](_0x4ecf7c['value'],_0x4c1f0e,config['secrets'][_0x5b14('0x2a')])[_0x5b14('0x24')](function(){fs[_0x5b14('0x2b')](_0x4ecf7c['value']);logger[_0x5b14('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x4ecf7c;});}return _0x4ecf7c;})[_0x5b14('0x24')](function(_0x291c92){logger[_0x5b14('0xd')](_0x5b14('0x1f'),_0x2ac7b0);logger['debug'](_0x5b14('0x1f'),_0x2ac7b0,JSON[_0x5b14('0x11')](_0x291c92));_0xe6851b(_0x291c92);})[_0x5b14('0x16')](function(_0x37f62c){logger['error'](_0x5b14('0x1f'),_0x37f62c[_0x5b14('0x14')],_0x2ac7b0);_0x1bbbd7(_0x143648[_0x5b14('0x12')](0x1f4,_0x37f62c['message']));});});}; \ No newline at end of file +var _0x5204=['attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','callRecordingEncryption','value','format','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where'];(function(_0x9b28f3,_0x437bb5){var _0x160b10=function(_0x3927f9){while(--_0x3927f9){_0x9b28f3['push'](_0x9b28f3['shift']());}};_0x160b10(++_0x437bb5);}(_0x5204,0xdf));var _0x4520=function(_0x40a77f,_0x1d5f8d){_0x40a77f=_0x40a77f-0x0;var _0x415aa1=_0x5204[_0x40a77f];return _0x415aa1;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e00f4['options']?_0x2e00f4['options'][_0x4520('0x1c')]||null:null,'attributes':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')][_0x4520('0x1d')]||null:null,'limit':_0x2e00f4[_0x4520('0x1b')]?_0x2e00f4['options'][_0x4520('0x1e')]||null:null})[_0x4520('0x1f')](function(_0x3b2ede){logger['info'](_0x4520('0x17'),_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x3b2ede));_0x4ba69f(_0x3b2ede);})[_0x4520('0x16')](function(_0x552da1){logger[_0x4520('0x12')](_0x4520('0x17'),_0x552da1[_0x4520('0x14')],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x552da1['message']));});});};exports[_0x4520('0x20')]=function(_0x4602a4){var _0x92168b=this;return new Promise(function(_0x21e1f3,_0xad9f8){var _0x2c95ea=require(_0x4520('0x21'));var _0x195c58;return db[_0x4520('0x22')][_0x4520('0x23')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x4520('0x1f')](function(_0x5c1a0b){_0x195c58=_0x5c1a0b;return db[_0x4520('0x18')][_0x4520('0x24')](_0x4602a4[_0x4520('0x1a')]);})[_0x4520('0x1f')](function(_0x1da740){if(_0x195c58[_0x4520('0x25')]&&fs['existsSync'](_0x1da740[_0x4520('0x26')])){var _0x508c05=util[_0x4520('0x27')]('%s.cypher',_0x1da740[_0x4520('0x26')]);return _0x2c95ea['encryptFile'](_0x1da740[_0x4520('0x26')],_0x508c05,config['secrets']['recording'])[_0x4520('0x1f')](function(){fs[_0x4520('0x28')](_0x1da740[_0x4520('0x26')]);logger['info'](_0x4520('0x29'));return _0x1da740;});}return _0x1da740;})[_0x4520('0x1f')](function(_0x2acb4e){logger[_0x4520('0xc')]('CreateVoiceRecording',_0x4602a4);logger['debug'](_0x4520('0x20'),_0x4602a4,JSON[_0x4520('0x11')](_0x2acb4e));_0x21e1f3(_0x2acb4e);})['catch'](function(_0x779e94){logger[_0x4520('0x12')](_0x4520('0x20'),_0x779e94[_0x4520('0x14')],_0x4602a4);_0xad9f8(_0x92168b[_0x4520('0x12')](0x1f4,_0x779e94[_0x4520('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index af81474..ff70784 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 _0x364c=['express','Router','fs-extra','../../components/auth/service','./voiceTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','put','delete','multer','path'];(function(_0x44b533,_0x221c8d){var _0x42325b=function(_0x309350){while(--_0x309350){_0x44b533['push'](_0x44b533['shift']());}};_0x42325b(++_0x221c8d);}(_0x364c,0x157));var _0xc364=function(_0x535e36,_0x3b5960){_0x535e36=_0x535e36-0x0;var _0x30df15=_0x364c[_0x535e36];return _0x30df15;};'use strict';var multer=require(_0xc364('0x0'));var util=require('util');var path=require(_0xc364('0x1'));var timeout=require('connect-timeout');var express=require(_0xc364('0x2'));var router=express[_0xc364('0x3')]();var fs_extra=require(_0xc364('0x4'));var auth=require(_0xc364('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc364('0x6'));router[_0xc364('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc364('0x7')](_0xc364('0x8'),auth[_0xc364('0x9')](),controller[_0xc364('0xa')]);router[_0xc364('0x7')](_0xc364('0xb'),auth[_0xc364('0x9')](),controller[_0xc364('0xc')]);router['post']('/',auth[_0xc364('0x9')](),controller['create']);router[_0xc364('0xd')](_0xc364('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc364('0xe')](_0xc364('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf372=['post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x3345c1,_0x4c1ba5){var _0x10d736=function(_0x474bf1){while(--_0x474bf1){_0x3345c1['push'](_0x3345c1['shift']());}};_0x10d736(++_0x4c1ba5);}(_0xf372,0x15e));var _0x2f37=function(_0x51ab97,_0x47bb41){_0x51ab97=_0x51ab97-0x0;var _0x59aff8=_0xf372[_0x51ab97];return _0x59aff8;};'use strict';var multer=require('multer');var util=require(_0x2f37('0x0'));var path=require(_0x2f37('0x1'));var timeout=require('connect-timeout');var express=require(_0x2f37('0x2'));var router=express[_0x2f37('0x3')]();var fs_extra=require(_0x2f37('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2f37('0x5'));var config=require(_0x2f37('0x6'));var controller=require('./voiceTransferReport.controller');router[_0x2f37('0x7')]('/',auth[_0x2f37('0x8')](),controller['index']);router[_0x2f37('0x7')]('/describe',auth[_0x2f37('0x8')](),controller[_0x2f37('0x9')]);router[_0x2f37('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2f37('0xa')]('/',auth[_0x2f37('0x8')](),controller[_0x2f37('0xb')]);router[_0x2f37('0xc')](_0x2f37('0xd'),auth['isAuthenticated'](),controller[_0x2f37('0xe')]);router[_0x2f37('0xf')](_0x2f37('0xd'),auth[_0x2f37('0x8')](),controller[_0x2f37('0x10')]);module[_0x2f37('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 9ce067b..719cdcf 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 _0x5658=['Yes','moment','ENUM','blind','attended','STRING'];(function(_0x3e733e,_0x57fffa){var _0x461d56=function(_0x23db86){while(--_0x23db86){_0x3e733e['push'](_0x3e733e['shift']());}};_0x461d56(++_0x57fffa);}(_0x5658,0x14b));var _0x8565=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5658[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8565('0x0'));module['exports']={'type':{'type':Sequelize[_0x8565('0x1')](_0x8565('0x2'),_0x8565('0x3'))},'result':{'type':Sequelize[_0x8565('0x4')]},'transfererchannel':{'type':Sequelize[_0x8565('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x8565('0x4')]},'transferercalleridname':{'type':Sequelize[_0x8565('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x8565('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x8565('0x4')]},'transfererexten':{'type':Sequelize[_0x8565('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x8565('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x8565('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x8565('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8565('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8565('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x8565('0x4')]},'transfereecontext':{'type':Sequelize[_0x8565('0x4')]},'transfereeexten':{'type':Sequelize[_0x8565('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x8565('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x8565('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x261d=['moment','exports','attended','STRING','Yes'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0x261d,0x1d1));var _0xd261=function(_0x6762d9,_0x3fc20d){_0x6762d9=_0x6762d9-0x0;var _0xe00468=_0x261d[_0x6762d9];return _0xe00468;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd261('0x0'));module[_0xd261('0x1')]={'type':{'type':Sequelize['ENUM']('blind',_0xd261('0x2'))},'result':{'type':Sequelize[_0xd261('0x3')]},'transfererchannel':{'type':Sequelize[_0xd261('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xd261('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xd261('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xd261('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xd261('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xd261('0x3')]},'transfereechannel':{'type':Sequelize[_0xd261('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xd261('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xd261('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd261('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xd261('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xd261('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0xd261('0x4'),'No')},'context':{'type':Sequelize[_0xd261('0x3')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index c29b00a..cf9600d 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 _0xd89c=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceTransferReport','findAll','catch','show','params','includeAll','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0xd89c,0xd0));var _0xcd89=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xd89c[_0x278e3c];return _0x3e2d9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd89('0x0'));var zipdir=require(_0xcd89('0x1'));var jsonpatch=require(_0xcd89('0x2'));var rp=require(_0xcd89('0x3'));var moment=require(_0xcd89('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcd89('0x5'));var path=require(_0xcd89('0x6'));var sox=require(_0xcd89('0x7'));var csv=require(_0xcd89('0x8'));var ejs=require(_0xcd89('0x9'));var fs=require('fs');var fs_extra=require(_0xcd89('0xa'));var _=require(_0xcd89('0xb'));var squel=require(_0xcd89('0xc'));var crypto=require(_0xcd89('0xd'));var jsforce=require(_0xcd89('0xe'));var deskjs=require(_0xcd89('0xf'));var toCsv=require(_0xcd89('0x8'));var querystring=require(_0xcd89('0x10'));var Papa=require(_0xcd89('0x11'));var Redis=require(_0xcd89('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcd89('0x13'));var as=require(_0xcd89('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd89('0x15'))('api');var utils=require(_0xcd89('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd89('0x17'))['db'];function respondWithStatusCode(_0x19b734,_0x45e86a){_0x45e86a=_0x45e86a||0xcc;return function(_0x2ec5d4){if(_0x2ec5d4){return _0x19b734['sendStatus'](_0x45e86a);}return _0x19b734[_0xcd89('0x18')](_0x45e86a)[_0xcd89('0x19')]();};}function respondWithResult(_0x53d8d0,_0x3c8aab){_0x3c8aab=_0x3c8aab||0xc8;return function(_0x58b04a){if(_0x58b04a){return _0x53d8d0[_0xcd89('0x18')](_0x3c8aab)[_0xcd89('0x1a')](_0x58b04a);}};}function respondWithFilteredResult(_0x5d65e0,_0x1ffa28){return function(_0x465d4a){if(_0x465d4a){var _0x5c98e6=typeof _0x1ffa28[_0xcd89('0x1b')]===_0xcd89('0x1c')&&typeof _0x1ffa28['limit']===_0xcd89('0x1c');var _0x2004b9=_0x465d4a[_0xcd89('0x1d')];var _0x217b27=_0x5c98e6?0x0:_0x1ffa28['offset'];var _0x59aeaa=_0x5c98e6?_0x465d4a[_0xcd89('0x1d')]:_0x1ffa28[_0xcd89('0x1b')]+_0x1ffa28['limit'];var _0x5f579b;if(_0x59aeaa>=_0x2004b9){_0x59aeaa=_0x2004b9;_0x5f579b=0xc8;}else{_0x5f579b=0xce;}_0x5d65e0[_0xcd89('0x18')](_0x5f579b);return _0x5d65e0[_0xcd89('0x1e')](_0xcd89('0x1f'),_0x217b27+'-'+_0x59aeaa+'/'+_0x2004b9)[_0xcd89('0x1a')](_0x465d4a);}return null;};}function patchUpdates(_0x39267d){return function(_0x3f1bb7){try{jsonpatch[_0xcd89('0x20')](_0x3f1bb7,_0x39267d,!![]);}catch(_0x4a9fb0){return BPromise['reject'](_0x4a9fb0);}return _0x3f1bb7[_0xcd89('0x21')]();};}function saveUpdates(_0x4b165f,_0x51fe52){return function(_0x1c13f8){if(_0x1c13f8){return _0x1c13f8[_0xcd89('0x22')](_0x4b165f)[_0xcd89('0x23')](function(_0x1290bf){return _0x1290bf;});}return null;};}function removeEntity(_0x2012ee,_0x2642fd){return function(_0x4be909){if(_0x4be909){return _0x4be909[_0xcd89('0x24')]()[_0xcd89('0x23')](function(){_0x2012ee[_0xcd89('0x18')](0xcc)[_0xcd89('0x19')]();});}};}function handleEntityNotFound(_0x18c26a,_0x22349c){return function(_0x456d9f){if(!_0x456d9f){_0x18c26a[_0xcd89('0x25')](0x194);}return _0x456d9f;};}function handleError(_0x49ee96,_0x318a18){_0x318a18=_0x318a18||0x1f4;return function(_0x36616b){logger['error'](_0x36616b['stack']);if(_0x36616b['name']){delete _0x36616b[_0xcd89('0x26')];}_0x49ee96['status'](_0x318a18)[_0xcd89('0x27')](_0x36616b);};}exports[_0xcd89('0x28')]=function(_0x2679ef,_0x174013){var _0x107c10={},_0x5dec26={},_0x12cc5e={'count':0x0,'rows':[]};var _0x503fb5=_['map'](db['VoiceTransferReport'][_0xcd89('0x29')],function(_0x2b914b){return{'name':_0x2b914b[_0xcd89('0x2a')],'type':_0x2b914b[_0xcd89('0x2b')][_0xcd89('0x2c')]};});_0x5dec26[_0xcd89('0x2d')]=_[_0xcd89('0x2e')](_0x503fb5,_0xcd89('0x26'));_0x5dec26[_0xcd89('0x2f')]=_[_0xcd89('0x30')](_0x2679ef[_0xcd89('0x2f')]);_0x5dec26[_0xcd89('0x31')]=_[_0xcd89('0x32')](_0x5dec26[_0xcd89('0x2d')],_0x5dec26['query']);_0x107c10[_0xcd89('0x33')]=_[_0xcd89('0x32')](_0x5dec26[_0xcd89('0x2d')],qs[_0xcd89('0x34')](_0x2679ef[_0xcd89('0x2f')][_0xcd89('0x34')]));_0x107c10[_0xcd89('0x33')]=_0x107c10['attributes'][_0xcd89('0x35')]?_0x107c10['attributes']:_0x5dec26[_0xcd89('0x2d')];if(!_0x2679ef[_0xcd89('0x2f')][_0xcd89('0x36')](_0xcd89('0x37'))){_0x107c10[_0xcd89('0x38')]=qs[_0xcd89('0x38')](_0x2679ef[_0xcd89('0x2f')][_0xcd89('0x38')]);_0x107c10[_0xcd89('0x1b')]=qs[_0xcd89('0x1b')](_0x2679ef[_0xcd89('0x2f')][_0xcd89('0x1b')]);}_0x107c10[_0xcd89('0x39')]=qs[_0xcd89('0x3a')](_0x2679ef[_0xcd89('0x2f')][_0xcd89('0x3a')]);_0x107c10['where']=qs['filters'](_[_0xcd89('0x3b')](_0x2679ef['query'],_0x5dec26[_0xcd89('0x31')]),_0x503fb5);if(_0x2679ef[_0xcd89('0x2f')][_0xcd89('0x3c')]){_0x107c10[_0xcd89('0x3d')]=_[_0xcd89('0x3e')](_0x107c10['where'],{'$or':_['map'](_0x503fb5,function(_0x201767){if(_0x201767[_0xcd89('0x2b')]!==_0xcd89('0x3f')){var _0x12ac00={};_0x12ac00[_0x201767[_0xcd89('0x26')]]={'$like':'%'+_0x2679ef[_0xcd89('0x2f')][_0xcd89('0x3c')]+'%'};return _0x12ac00;}})});}_0x107c10=_[_0xcd89('0x3e')]({},_0x107c10,_0x2679ef[_0xcd89('0x40')]);var _0x5cc785={'where':_0x107c10[_0xcd89('0x3d')]};return db[_0xcd89('0x41')][_0xcd89('0x1d')](_0x5cc785)[_0xcd89('0x23')](function(_0x236276){_0x12cc5e[_0xcd89('0x1d')]=_0x236276;if(_0x2679ef[_0xcd89('0x2f')]['includeAll']){_0x107c10['include']=[{'all':!![]}];}return db[_0xcd89('0x41')][_0xcd89('0x42')](_0x107c10);})[_0xcd89('0x23')](function(_0x37b030){_0x12cc5e['rows']=_0x37b030;return _0x12cc5e;})[_0xcd89('0x23')](respondWithFilteredResult(_0x174013,_0x107c10))[_0xcd89('0x43')](handleError(_0x174013,null));};exports[_0xcd89('0x44')]=function(_0x58f8dd,_0x7b0e67){var _0xe2f627={'raw':!![],'where':{'id':_0x58f8dd[_0xcd89('0x45')]['id']}},_0x214aea={};_0x214aea[_0xcd89('0x2d')]=_[_0xcd89('0x30')](db[_0xcd89('0x41')]['rawAttributes']);_0x214aea[_0xcd89('0x2f')]=_[_0xcd89('0x30')](_0x58f8dd[_0xcd89('0x2f')]);_0x214aea['filters']=_[_0xcd89('0x32')](_0x214aea[_0xcd89('0x2d')],_0x214aea['query']);_0xe2f627[_0xcd89('0x33')]=_[_0xcd89('0x32')](_0x214aea[_0xcd89('0x2d')],qs[_0xcd89('0x34')](_0x58f8dd[_0xcd89('0x2f')][_0xcd89('0x34')]));_0xe2f627['attributes']=_0xe2f627[_0xcd89('0x33')]['length']?_0xe2f627['attributes']:_0x214aea[_0xcd89('0x2d')];if(_0x58f8dd[_0xcd89('0x2f')][_0xcd89('0x46')]){_0xe2f627[_0xcd89('0x47')]=[{'all':!![]}];}_0xe2f627=_['merge']({},_0xe2f627,_0x58f8dd[_0xcd89('0x40')]);return db[_0xcd89('0x41')][_0xcd89('0x48')](_0xe2f627)['then'](handleEntityNotFound(_0x7b0e67,null))[_0xcd89('0x23')](respondWithResult(_0x7b0e67,null))[_0xcd89('0x43')](handleError(_0x7b0e67,null));};exports[_0xcd89('0x49')]=function(_0x87df45,_0x5090b0){return db['VoiceTransferReport'][_0xcd89('0x49')](_0x87df45[_0xcd89('0x4a')],{})[_0xcd89('0x23')](respondWithResult(_0x5090b0,0xc9))[_0xcd89('0x43')](handleError(_0x5090b0,null));};exports[_0xcd89('0x22')]=function(_0x1c9f58,_0x15fe15){if(_0x1c9f58[_0xcd89('0x4a')]['id']){delete _0x1c9f58[_0xcd89('0x4a')]['id'];}return db['VoiceTransferReport'][_0xcd89('0x48')]({'where':{'id':_0x1c9f58[_0xcd89('0x45')]['id']}})['then'](handleEntityNotFound(_0x15fe15,null))[_0xcd89('0x23')](saveUpdates(_0x1c9f58[_0xcd89('0x4a')],null))[_0xcd89('0x23')](respondWithResult(_0x15fe15,null))[_0xcd89('0x43')](handleError(_0x15fe15,null));};exports[_0xcd89('0x24')]=function(_0x2227b7,_0xa06038){return db['VoiceTransferReport'][_0xcd89('0x48')]({'where':{'id':_0x2227b7[_0xcd89('0x45')]['id']}})[_0xcd89('0x23')](handleEntityNotFound(_0xa06038,null))[_0xcd89('0x23')](removeEntity(_0xa06038,null))[_0xcd89('0x43')](handleError(_0xa06038,null));};exports[_0xcd89('0x4b')]=function(_0x57c870,_0x583fbf){return db[_0xcd89('0x41')]['describe']()[_0xcd89('0x23')](respondWithResult(_0x583fbf,null))[_0xcd89('0x43')](handleError(_0x583fbf,null));}; \ No newline at end of file +var _0xd700=['../../config/environment','../../config/license/util','../../mysqldb','end','status','limit','undefined','offset','set','Content-Range','json','apply','reject','save','update','then','sendStatus','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','count','includeAll','include','rows','show','keys','length','options','find','catch','create','body','destroy','params','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5952a3,_0x1c482a){var _0x1de507=function(_0x38c691){while(--_0x38c691){_0x5952a3['push'](_0x5952a3['shift']());}};_0x1de507(++_0x1c482a);}(_0xd700,0x85));var _0x0d70=function(_0x37e8e8,_0x1be63e){_0x37e8e8=_0x37e8e8-0x0;var _0x2c3c9e=_0xd700[_0x37e8e8];return _0x2c3c9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d70('0x0'));var zipdir=require(_0x0d70('0x1'));var jsonpatch=require(_0x0d70('0x2'));var rp=require('request-promise');var moment=require(_0x0d70('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0d70('0x4'));var util=require('util');var path=require(_0x0d70('0x5'));var sox=require(_0x0d70('0x6'));var csv=require(_0x0d70('0x7'));var ejs=require(_0x0d70('0x8'));var fs=require('fs');var fs_extra=require(_0x0d70('0x9'));var _=require(_0x0d70('0xa'));var squel=require(_0x0d70('0xb'));var crypto=require(_0x0d70('0xc'));var jsforce=require(_0x0d70('0xd'));var deskjs=require(_0x0d70('0xe'));var toCsv=require(_0x0d70('0x7'));var querystring=require(_0x0d70('0xf'));var Papa=require(_0x0d70('0x10'));var Redis=require(_0x0d70('0x11'));var authService=require(_0x0d70('0x12'));var qs=require(_0x0d70('0x13'));var as=require(_0x0d70('0x14'));var hardwareService=require(_0x0d70('0x15'));var logger=require(_0x0d70('0x16'))(_0x0d70('0x17'));var utils=require(_0x0d70('0x18'));var config=require(_0x0d70('0x19'));var licenseUtil=require(_0x0d70('0x1a'));var db=require(_0x0d70('0x1b'))['db'];function respondWithStatusCode(_0x5f0ebe,_0x12bf7c){_0x12bf7c=_0x12bf7c||0xcc;return function(_0x1d1bdc){if(_0x1d1bdc){return _0x5f0ebe['sendStatus'](_0x12bf7c);}return _0x5f0ebe['status'](_0x12bf7c)[_0x0d70('0x1c')]();};}function respondWithResult(_0x1ebbc4,_0x5a4740){_0x5a4740=_0x5a4740||0xc8;return function(_0x3e16df){if(_0x3e16df){return _0x1ebbc4[_0x0d70('0x1d')](_0x5a4740)['json'](_0x3e16df);}};}function respondWithFilteredResult(_0x4fbe49,_0x3e7f8a){return function(_0x1f68ec){if(_0x1f68ec){var _0x5247c7=typeof _0x3e7f8a['offset']==='undefined'&&typeof _0x3e7f8a[_0x0d70('0x1e')]===_0x0d70('0x1f');var _0x294747=_0x1f68ec['count'];var _0x3d42ff=_0x5247c7?0x0:_0x3e7f8a[_0x0d70('0x20')];var _0x53465c=_0x5247c7?_0x1f68ec['count']:_0x3e7f8a['offset']+_0x3e7f8a[_0x0d70('0x1e')];var _0x47118a;if(_0x53465c>=_0x294747){_0x53465c=_0x294747;_0x47118a=0xc8;}else{_0x47118a=0xce;}_0x4fbe49[_0x0d70('0x1d')](_0x47118a);return _0x4fbe49[_0x0d70('0x21')](_0x0d70('0x22'),_0x3d42ff+'-'+_0x53465c+'/'+_0x294747)[_0x0d70('0x23')](_0x1f68ec);}return null;};}function patchUpdates(_0x58e0bf){return function(_0xed1cdd){try{jsonpatch[_0x0d70('0x24')](_0xed1cdd,_0x58e0bf,!![]);}catch(_0x34ccda){return BPromise[_0x0d70('0x25')](_0x34ccda);}return _0xed1cdd[_0x0d70('0x26')]();};}function saveUpdates(_0x4c566e,_0x195fbf){return function(_0xef70a4){if(_0xef70a4){return _0xef70a4[_0x0d70('0x27')](_0x4c566e)[_0x0d70('0x28')](function(_0x2455e5){return _0x2455e5;});}return null;};}function removeEntity(_0x162064,_0x5c1a6f){return function(_0x38cdd9){if(_0x38cdd9){return _0x38cdd9['destroy']()['then'](function(){_0x162064['status'](0xcc)[_0x0d70('0x1c')]();});}};}function handleEntityNotFound(_0x2da7e4,_0x5ca2a1){return function(_0x4443e6){if(!_0x4443e6){_0x2da7e4[_0x0d70('0x29')](0x194);}return _0x4443e6;};}function handleError(_0x4a6fcd,_0x5524f1){_0x5524f1=_0x5524f1||0x1f4;return function(_0x3b3b29){logger['error'](_0x3b3b29['stack']);if(_0x3b3b29[_0x0d70('0x2a')]){delete _0x3b3b29[_0x0d70('0x2a')];}_0x4a6fcd[_0x0d70('0x1d')](_0x5524f1)[_0x0d70('0x2b')](_0x3b3b29);};}exports[_0x0d70('0x2c')]=function(_0x5b6139,_0x30c537){var _0x2c2ba6={},_0x190d42={},_0x244d55={'count':0x0,'rows':[]};var _0x5f0645=_[_0x0d70('0x2d')](db[_0x0d70('0x2e')][_0x0d70('0x2f')],function(_0x2d8c76){return{'name':_0x2d8c76['fieldName'],'type':_0x2d8c76[_0x0d70('0x30')][_0x0d70('0x31')]};});_0x190d42['model']=_[_0x0d70('0x2d')](_0x5f0645,_0x0d70('0x2a'));_0x190d42[_0x0d70('0x32')]=_['keys'](_0x5b6139['query']);_0x190d42[_0x0d70('0x33')]=_['intersection'](_0x190d42[_0x0d70('0x34')],_0x190d42[_0x0d70('0x32')]);_0x2c2ba6[_0x0d70('0x35')]=_[_0x0d70('0x36')](_0x190d42[_0x0d70('0x34')],qs[_0x0d70('0x37')](_0x5b6139[_0x0d70('0x32')][_0x0d70('0x37')]));_0x2c2ba6[_0x0d70('0x35')]=_0x2c2ba6[_0x0d70('0x35')]['length']?_0x2c2ba6[_0x0d70('0x35')]:_0x190d42[_0x0d70('0x34')];if(!_0x5b6139[_0x0d70('0x32')][_0x0d70('0x38')](_0x0d70('0x39'))){_0x2c2ba6['limit']=qs[_0x0d70('0x1e')](_0x5b6139['query'][_0x0d70('0x1e')]);_0x2c2ba6[_0x0d70('0x20')]=qs[_0x0d70('0x20')](_0x5b6139['query'][_0x0d70('0x20')]);}_0x2c2ba6[_0x0d70('0x3a')]=qs[_0x0d70('0x3b')](_0x5b6139[_0x0d70('0x32')][_0x0d70('0x3b')]);_0x2c2ba6['where']=qs['filters'](_[_0x0d70('0x3c')](_0x5b6139[_0x0d70('0x32')],_0x190d42[_0x0d70('0x33')]),_0x5f0645);if(_0x5b6139[_0x0d70('0x32')]['filter']){_0x2c2ba6[_0x0d70('0x3d')]=_[_0x0d70('0x3e')](_0x2c2ba6[_0x0d70('0x3d')],{'$or':_[_0x0d70('0x2d')](_0x5f0645,function(_0x1ffefe){if(_0x1ffefe[_0x0d70('0x30')]!=='VIRTUAL'){var _0x11984e={};_0x11984e[_0x1ffefe['name']]={'$like':'%'+_0x5b6139['query'][_0x0d70('0x3f')]+'%'};return _0x11984e;}})});}_0x2c2ba6=_['merge']({},_0x2c2ba6,_0x5b6139['options']);var _0x1bbed7={'where':_0x2c2ba6[_0x0d70('0x3d')]};return db['VoiceTransferReport'][_0x0d70('0x40')](_0x1bbed7)[_0x0d70('0x28')](function(_0x4a8fa7){_0x244d55[_0x0d70('0x40')]=_0x4a8fa7;if(_0x5b6139[_0x0d70('0x32')][_0x0d70('0x41')]){_0x2c2ba6[_0x0d70('0x42')]=[{'all':!![]}];}return db[_0x0d70('0x2e')]['findAll'](_0x2c2ba6);})[_0x0d70('0x28')](function(_0x25a8e7){_0x244d55[_0x0d70('0x43')]=_0x25a8e7;return _0x244d55;})[_0x0d70('0x28')](respondWithFilteredResult(_0x30c537,_0x2c2ba6))['catch'](handleError(_0x30c537,null));};exports[_0x0d70('0x44')]=function(_0x332f6f,_0x4822f7){var _0x265bdd={'raw':!![],'where':{'id':_0x332f6f['params']['id']}},_0x2d1cc5={};_0x2d1cc5['model']=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x2d1cc5['query']=_[_0x0d70('0x45')](_0x332f6f[_0x0d70('0x32')]);_0x2d1cc5[_0x0d70('0x33')]=_['intersection'](_0x2d1cc5[_0x0d70('0x34')],_0x2d1cc5[_0x0d70('0x32')]);_0x265bdd[_0x0d70('0x35')]=_[_0x0d70('0x36')](_0x2d1cc5['model'],qs[_0x0d70('0x37')](_0x332f6f['query'][_0x0d70('0x37')]));_0x265bdd[_0x0d70('0x35')]=_0x265bdd[_0x0d70('0x35')][_0x0d70('0x46')]?_0x265bdd[_0x0d70('0x35')]:_0x2d1cc5[_0x0d70('0x34')];if(_0x332f6f[_0x0d70('0x32')][_0x0d70('0x41')]){_0x265bdd[_0x0d70('0x42')]=[{'all':!![]}];}_0x265bdd=_['merge']({},_0x265bdd,_0x332f6f[_0x0d70('0x47')]);return db[_0x0d70('0x2e')][_0x0d70('0x48')](_0x265bdd)[_0x0d70('0x28')](handleEntityNotFound(_0x4822f7,null))[_0x0d70('0x28')](respondWithResult(_0x4822f7,null))[_0x0d70('0x49')](handleError(_0x4822f7,null));};exports[_0x0d70('0x4a')]=function(_0x44d419,_0x1f0f67){return db['VoiceTransferReport'][_0x0d70('0x4a')](_0x44d419['body'],{})[_0x0d70('0x28')](respondWithResult(_0x1f0f67,0xc9))['catch'](handleError(_0x1f0f67,null));};exports[_0x0d70('0x27')]=function(_0x5ba68d,_0x12c69a){if(_0x5ba68d[_0x0d70('0x4b')]['id']){delete _0x5ba68d[_0x0d70('0x4b')]['id'];}return db[_0x0d70('0x2e')][_0x0d70('0x48')]({'where':{'id':_0x5ba68d['params']['id']}})['then'](handleEntityNotFound(_0x12c69a,null))[_0x0d70('0x28')](saveUpdates(_0x5ba68d[_0x0d70('0x4b')],null))[_0x0d70('0x28')](respondWithResult(_0x12c69a,null))['catch'](handleError(_0x12c69a,null));};exports[_0x0d70('0x4c')]=function(_0x58139b,_0x5d4b64){return db['VoiceTransferReport'][_0x0d70('0x48')]({'where':{'id':_0x58139b[_0x0d70('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d4b64,null))[_0x0d70('0x28')](removeEntity(_0x5d4b64,null))['catch'](handleError(_0x5d4b64,null));};exports[_0x0d70('0x4e')]=function(_0x5f0af0,_0x33c417){return db[_0x0d70('0x2e')][_0x0d70('0x4e')]()['then'](respondWithResult(_0x33c417,null))[_0x0d70('0x49')](handleError(_0x33c417,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c02f60c..11c41a7 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 _0x76ba=['moment','bluebird','path','../../config/environment','exports','define','report_call_transfer','lodash','util','../../config/logger','api'];(function(_0x4802b0,_0x1fe664){var _0xe38fea=function(_0x371ae9){while(--_0x371ae9){_0x4802b0['push'](_0x4802b0['shift']());}};_0xe38fea(++_0x1fe664);}(_0x76ba,0x1d5));var _0xa76b=function(_0x281515,_0xc37c63){_0x281515=_0x281515-0x0;var _0x522887=_0x76ba[_0x281515];return _0x522887;};'use strict';var _=require(_0xa76b('0x0'));var util=require(_0xa76b('0x1'));var logger=require(_0xa76b('0x2'))(_0xa76b('0x3'));var moment=require(_0xa76b('0x4'));var BPromise=require(_0xa76b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa76b('0x6'));var rimraf=require('rimraf');var config=require(_0xa76b('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0xa76b('0x8')]=function(_0x2c55a6,_0x2bc805){return _0x2c55a6[_0xa76b('0x9')]('VoiceTransferReport',attributes,{'tableName':_0xa76b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x386a=['VoiceTransferReport','report_call_transfer','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x2bf5f2,_0x36b1cb){var _0x24335a=function(_0x157c5f){while(--_0x157c5f){_0x2bf5f2['push'](_0x2bf5f2['shift']());}};_0x24335a(++_0x36b1cb);}(_0x386a,0x10a));var _0xa386=function(_0x34f749,_0x39ed5e){_0x34f749=_0x34f749-0x0;var _0x290f07=_0x386a[_0x34f749];return _0x290f07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa386('0x0'))(_0xa386('0x1'));var moment=require(_0xa386('0x2'));var BPromise=require(_0xa386('0x3'));var rp=require(_0xa386('0x4'));var fs=require('fs');var path=require(_0xa386('0x5'));var rimraf=require('rimraf');var config=require(_0xa386('0x6'));var attributes=require(_0xa386('0x7'));module[_0xa386('0x8')]=function(_0x5a6841,_0x22d91c){return _0x5a6841[_0xa386('0x9')](_0xa386('0xa'),attributes,{'tableName':_0xa386('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 3df8a0b..0cb3261 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 _0xa1d7=['../../config/utils','jayson/promise','client','http','request','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','then','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1d7,0xfe));var _0x7a1d=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xa1d7[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x7a1d('0x0'));var util=require(_0x7a1d('0x1'));var moment=require(_0x7a1d('0x2'));var BPromise=require(_0x7a1d('0x3'));var rs=require(_0x7a1d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a1d('0x5'))['db'];var utils=require(_0x7a1d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7a1d('0x7'));var client=jayson[_0x7a1d('0x8')][_0x7a1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x487b5f,_0x10f147,_0x316b62){return new BPromise(function(_0x11b964,_0xdac870){return client[_0x7a1d('0xa')](_0x487b5f,_0x316b62)['then'](function(_0x4fcd3f){logger['info'](_0x7a1d('0xb'),_0x10f147,_0x7a1d('0xc'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x10f147,_0x7a1d('0xc'),JSON[_0x7a1d('0xd')](_0x4fcd3f));if(_0x4fcd3f[_0x7a1d('0xe')]){if(_0x4fcd3f['error'][_0x7a1d('0xf')]===0x1f4){logger[_0x7a1d('0xe')](_0x7a1d('0xb'),_0x10f147,_0x4fcd3f[_0x7a1d('0xe')][_0x7a1d('0x10')]);return _0xdac870(_0x4fcd3f[_0x7a1d('0xe')][_0x7a1d('0x10')]);}logger[_0x7a1d('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x10f147,_0x4fcd3f['error'][_0x7a1d('0x10')]);return _0x11b964(_0x4fcd3f[_0x7a1d('0xe')][_0x7a1d('0x10')]);}else{logger[_0x7a1d('0x11')](_0x7a1d('0xb'),_0x10f147,'request\x20sent');_0x11b964(_0x4fcd3f['result'][_0x7a1d('0x10')]);}})[_0x7a1d('0x12')](function(_0xbea585){logger[_0x7a1d('0xe')](_0x7a1d('0xb'),_0x10f147,_0xbea585);_0xdac870(_0xbea585);});});}exports[_0x7a1d('0x13')]=function(_0x516f41){var _0x1fe8b1=this;return new Promise(function(_0x298364,_0x9d4c6){return db[_0x7a1d('0x14')][_0x7a1d('0x15')](_0x516f41[_0x7a1d('0x16')],{'raw':_0x516f41['options']?_0x516f41[_0x7a1d('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7a1d('0x18')](function(_0x264887){logger[_0x7a1d('0x11')](_0x7a1d('0x13'),_0x516f41);logger[_0x7a1d('0x19')](_0x7a1d('0x13'),_0x516f41,JSON[_0x7a1d('0xd')](_0x264887));_0x298364(_0x264887);})['catch'](function(_0x340e01){logger['error'](_0x7a1d('0x13'),_0x340e01[_0x7a1d('0x10')],_0x516f41);_0x9d4c6(_0x1fe8b1[_0x7a1d('0xe')](0x1f4,_0x340e01[_0x7a1d('0x10')]));});});}; \ No newline at end of file +var _0x5659=['client','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5659,0x13a));var _0x9565=function(_0x2f3d29,_0x150e7b){_0x2f3d29=_0x2f3d29-0x0;var _0x53d69d=_0x5659[_0x2f3d29];return _0x53d69d;};'use strict';var _=require(_0x9565('0x0'));var util=require(_0x9565('0x1'));var moment=require(_0x9565('0x2'));var BPromise=require(_0x9565('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9565('0x4'));var db=require(_0x9565('0x5'))['db'];var utils=require(_0x9565('0x6'));var logger=require(_0x9565('0x7'))(_0x9565('0x8'));var config=require(_0x9565('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9565('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ae431,_0x12ed52,_0x3cec1b){return new BPromise(function(_0x5d3d9b,_0x2f345f){return client['request'](_0x1ae431,_0x3cec1b)[_0x9565('0xb')](function(_0x5409cd){logger[_0x9565('0xc')](_0x9565('0xd'),_0x12ed52,_0x9565('0xe'));logger[_0x9565('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x12ed52,_0x9565('0xe'),JSON[_0x9565('0x10')](_0x5409cd));if(_0x5409cd[_0x9565('0x11')]){if(_0x5409cd[_0x9565('0x11')][_0x9565('0x12')]===0x1f4){logger[_0x9565('0x11')](_0x9565('0xd'),_0x12ed52,_0x5409cd[_0x9565('0x11')][_0x9565('0x13')]);return _0x2f345f(_0x5409cd['error'][_0x9565('0x13')]);}logger[_0x9565('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x12ed52,_0x5409cd['error'][_0x9565('0x13')]);return _0x5d3d9b(_0x5409cd[_0x9565('0x11')]['message']);}else{logger[_0x9565('0xc')](_0x9565('0xd'),_0x12ed52,'request\x20sent');_0x5d3d9b(_0x5409cd[_0x9565('0x14')][_0x9565('0x13')]);}})['catch'](function(_0x4ab2a9){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x12ed52,_0x4ab2a9);_0x2f345f(_0x4ab2a9);});});}exports['CreateVoiceTransferReport']=function(_0x2f3200){var _0x18bdf8=this;return new Promise(function(_0x2d8d32,_0x163ba9){return db[_0x9565('0x15')][_0x9565('0x16')](_0x2f3200[_0x9565('0x17')],{'raw':_0x2f3200['options']?_0x2f3200[_0x9565('0x18')][_0x9565('0x19')]===undefined?!![]:![]:!![]})[_0x9565('0xb')](function(_0x23064f){logger[_0x9565('0xc')](_0x9565('0x1a'),_0x2f3200);logger['debug'](_0x9565('0x1a'),_0x2f3200,JSON[_0x9565('0x10')](_0x23064f));_0x2d8d32(_0x23064f);})['catch'](function(_0x1f9f91){logger[_0x9565('0x11')](_0x9565('0x1a'),_0x1f9f91['message'],_0x2f3200);_0x163ba9(_0x18bdf8[_0x9565('0x11')](0x1f4,_0x1f9f91[_0x9565('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index df2b38d..8053658 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 _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x34f0d8,_0x40a101){var _0x44f566=function(_0x1a4050){while(--_0x1a4050){_0x34f0d8['push'](_0x34f0d8['shift']());}};_0x44f566(++_0x40a101);}(_0xedd9,0xfc));var _0x9edd=function(_0x581c60,_0x371c9c){_0x581c60=_0x581c60-0x0;var _0x131aaf=_0xedd9[_0x581c60];return _0x131aaf;};'use strict';var express=require('express');var router=express[_0x9edd('0x0')]();var auth=require(_0x9edd('0x1'));var controller=require(_0x9edd('0x2'));router[_0x9edd('0x3')](_0x9edd('0x4'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x7')]);router['post'](_0x9edd('0x8'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x9')]);router['post'](_0x9edd('0xa'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xb')]);router[_0x9edd('0x3')](_0x9edd('0xc'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller['hold']);router[_0x9edd('0x3')](_0x9edd('0xd'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xe')]);router['post'](_0x9edd('0xf'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x3')](_0x9edd('0x11'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller['transfer']);module[_0x9edd('0x12')]=router; \ No newline at end of file +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb43b,0x1b2));var _0xbb43=function(_0x791491,_0xdd66d0){_0x791491=_0x791491-0x0;var _0x24abfb=_0xb43b[_0x791491];return _0x24abfb;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b7da4e4..71db4f1 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 _0x3667=['defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','send','request','then','error','code','message','catch','User','agent','VoiceChannels','filter','rows','UserId','sessionId','originate\x20fired:','body','length','json','userId','callNumber','callerId','entityFound:','format','status','hangup\x20fired:','user:%s','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis'];(function(_0xe3f3a5,_0x26955e){var _0x261ac5=function(_0x9ab524){while(--_0x9ab524){_0xe3f3a5['push'](_0xe3f3a5['shift']());}};_0x261ac5(++_0x26955e);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x7366('0x0'));var fs=require('fs');var _=require(_0x7366('0x1'));var db=require(_0x7366('0x2'))['db'];var config=require(_0x7366('0x3'));var util=require(_0x7366('0x4'));var BPromise=require('bluebird');var jayson=require(_0x7366('0x5'));var amiClient=jayson[_0x7366('0x6')]['http']({'port':0x232a});var logger=require(_0x7366('0x7'))(_0x7366('0x8'));var Redis=require(_0x7366('0x9'));config[_0x7366('0xa')]=_[_0x7366('0xb')](config['redis'],{'host':_0x7366('0xc'),'port':0x18eb});var io=require(_0x7366('0xd'))(new Redis(config[_0x7366('0xa')]));var Schema=require(_0x7366('0xe'));var originateValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'callNumber':{'type':_0x7366('0x11'),'required':[!![],_0x7366('0x12')]},'callerId':{'type':_0x7366('0x11')},'callbackUrl':{'type':_0x7366('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'sessionId':{'type':_0x7366('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'sessionId':{'type':_0x7366('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'sessionId':{'type':_0x7366('0x11'),'required':[!![],_0x7366('0x13')]},'transferNumber':{'type':_0x7366('0x11'),'required':[!![],_0x7366('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'sessionId':{'type':_0x7366('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'sessionId':{'type':_0x7366('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7366('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]}});function emit(_0x2c0422,_0xe2c87b,_0x431c01){logger[_0x7366('0x15')](_0x2c0422,_0xe2c87b,JSON[_0x7366('0x16')](_0x431c01));io['to'](_0x2c0422)[_0x7366('0x17')](_0xe2c87b,_0x431c01);}function handleError(_0x41113f){return function(_0x1a71f5){console['log'](_0x7366('0x18'),_0x1a71f5,_0x1a71f5 instanceof RangeError);logger['error'](_0x1a71f5[_0x7366('0x19')]);if(_0x1a71f5 instanceof RangeError){if(_0x1a71f5[_0x7366('0x1a')]){delete _0x1a71f5[_0x7366('0x1a')];}_0x41113f['status'](0x194)[_0x7366('0x1b')](_0x1a71f5);}else{if(_0x1a71f5[_0x7366('0x1a')]){delete _0x1a71f5[_0x7366('0x1a')];}_0x41113f['status'](0x1f4)[_0x7366('0x1b')](_0x1a71f5);}};}function checkError(){return function(_0x1946c6){if(!_0x1946c6){throw new RangeError('NotFound');}return _0x1946c6;};}function respondWithRpcPromise(_0x3bfbca,_0x411dfe){return new BPromise(function(_0xaab659,_0x1a12d2){var _0x3c30a2=amiClient;return _0x3c30a2[_0x7366('0x1c')](_0x3bfbca,_0x411dfe)[_0x7366('0x1d')](function(_0x22ed7e){if(_0x22ed7e[_0x7366('0x1e')]){if(_0x22ed7e[_0x7366('0x1e')][_0x7366('0x1f')]===0x1f4){return _0x1a12d2(_0x22ed7e[_0x7366('0x1e')][_0x7366('0x20')]);}return _0xaab659(_0x22ed7e['error'][_0x7366('0x20')]);}else{_0xaab659(_0x22ed7e['result']);}})[_0x7366('0x21')](function(_0x4ab987){_0x1a12d2(_0x4ab987);});});}function getAgent(_0x5e30fb){return db[_0x7366('0x22')]['findOne']({'where':{'id':_0x5e30fb,'role':_0x7366('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x256633,_0x191177){return new BPromise(function(_0x5c37e2,_0x6d196a){var _0x565aa7=respondWithRpcPromise(_0x7366('0x24'));var _0x2b61af=getAgent(_0x256633);Promise['all']([_0x565aa7,_0x2b61af])[_0x7366('0x1d')](function(_0x507baf){var _0xc58ac7=_0x507baf[0x0];var _0x46f80f=_0x507baf[0x1];var _0x39d6ea=_[_0x7366('0x25')](_0xc58ac7[_0x7366('0x26')],function(_0x5e075c){return _0x5e075c[_0x7366('0x27')]==_0x46f80f['id']&&_0x5e075c[_0x7366('0x28')]==_0x191177;});if(_0x39d6ea['length']==0x1){_0x5c37e2(_0x46f80f);}else{_0x6d196a(new RangeError('sessionId\x20'+_0x191177+'\x20not\x20found!'));}});});}exports['originate']=function(_0x2a1d46,_0x43d487){logger[_0x7366('0x15')](_0x7366('0x29'),_0x2a1d46['body']);var _0x3ca5e6=originateValidation[_0x7366('0xe')](_0x2a1d46[_0x7366('0x2a')]);if(_0x3ca5e6[_0x7366('0x2b')]>0x0){return _0x43d487['status'](0x190)[_0x7366('0x2c')](_0x3ca5e6);}var _0x311dab=_0x2a1d46['body'][_0x7366('0x2d')];var _0x44c81e=_0x2a1d46[_0x7366('0x2a')][_0x7366('0x2e')];var _0x7779c7=_0x2a1d46[_0x7366('0x2a')][_0x7366('0x2f')];var _0x26858b=_0x2a1d46[_0x7366('0x2a')]['callbackUrl'];return getAgent(_0x311dab)[_0x7366('0x1d')](function(_0x83b879){logger['info'](_0x7366('0x30'),_0x83b879[_0x7366('0x1a')]);emit(util[_0x7366('0x31')]('user:%s',_0x83b879[_0x7366('0x1a')]),'webbar:originate',{'callNumber':_0x44c81e,'callerId':_0x7779c7,'callbackUrl':_0x26858b});return _0x43d487[_0x7366('0x32')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x7366('0x21')](handleError(_0x43d487));};exports['hangup']=function(_0x3228b5,_0x116081){logger['info'](_0x7366('0x33'),_0x3228b5['body']);var _0x36f861=hangupValidation[_0x7366('0xe')](_0x3228b5[_0x7366('0x2a')]);if(_0x36f861[_0x7366('0x2b')]>0x0){return _0x116081['status'](0x190)[_0x7366('0x2c')](_0x36f861);}var _0x1d8be3=_0x3228b5[_0x7366('0x2a')]['userId'];var _0x487e36=_0x3228b5[_0x7366('0x2a')][_0x7366('0x28')];return getAgent(_0x1d8be3)[_0x7366('0x1d')](function(_0x18e9b1){logger[_0x7366('0x15')](_0x7366('0x30'),_0x18e9b1['name']);emit(util['format'](_0x7366('0x34'),_0x18e9b1[_0x7366('0x1a')]),'webbar:hangup',{'sessionId':_0x487e36});return _0x116081[_0x7366('0x32')](0xc8)[_0x7366('0x2c')]({'error':![],'message':'hangup\x20executed!'});})[_0x7366('0x21')](handleError(_0x116081));};exports['answer']=function(_0xafac5,_0x1834cf){logger['info']('answer\x20fired:',_0xafac5[_0x7366('0x2a')]);var _0xedc3c7=answerValidation[_0x7366('0xe')](_0xafac5[_0x7366('0x2a')]);if(_0xedc3c7['length']>0x0){return _0x1834cf[_0x7366('0x32')](0x190)[_0x7366('0x2c')](_0xedc3c7);}var _0xb9d7e4=_0xafac5[_0x7366('0x2a')][_0x7366('0x2d')];var _0x3d8c79=_0xafac5[_0x7366('0x2a')]['sessionId'];return getAgent(_0xb9d7e4)[_0x7366('0x1d')](function(_0x320fc2){logger[_0x7366('0x15')]('entityFound:',_0x320fc2[_0x7366('0x1a')]);emit(util[_0x7366('0x31')]('user:%s',_0x320fc2[_0x7366('0x1a')]),_0x7366('0x35'),{'sessionId':_0x3d8c79});return _0x1834cf[_0x7366('0x32')](0xc8)['json']({'error':![],'message':_0x7366('0x36')});})[_0x7366('0x21')](handleError(_0x1834cf));};exports[_0x7366('0x37')]=function(_0x570459,_0x37b251){logger[_0x7366('0x15')](_0x7366('0x38'),_0x570459['body']);var _0xb32e28=holdValidation[_0x7366('0xe')](_0x570459[_0x7366('0x2a')]);if(_0xb32e28[_0x7366('0x2b')]>0x0){return _0x37b251['status'](0x190)[_0x7366('0x2c')](_0xb32e28);}var _0x2d1c52=_0x570459[_0x7366('0x2a')][_0x7366('0x2d')];var _0x3cf180=_0x570459[_0x7366('0x2a')][_0x7366('0x28')];return getAgent(_0x2d1c52)[_0x7366('0x1d')](function(_0x2ad8bf){logger['info'](_0x7366('0x30'),_0x2ad8bf[_0x7366('0x1a')]);emit(util['format'](_0x7366('0x34'),_0x2ad8bf[_0x7366('0x1a')]),'webbar:hold',{'sessionId':_0x3cf180});return _0x37b251[_0x7366('0x32')](0xc8)['json']({'error':![],'message':_0x7366('0x39')});})[_0x7366('0x21')](handleError(_0x37b251));};exports[_0x7366('0x3a')]=function(_0x22026a,_0x588b31){logger[_0x7366('0x15')](_0x7366('0x3b'),_0x22026a[_0x7366('0x2a')]);var _0x46a532=unholdValidation[_0x7366('0xe')](_0x22026a[_0x7366('0x2a')]);if(_0x46a532[_0x7366('0x2b')]>0x0){return _0x588b31[_0x7366('0x32')](0x190)[_0x7366('0x2c')](_0x46a532);}var _0x336b4d=_0x22026a[_0x7366('0x2a')][_0x7366('0x2d')];var _0x5d2a2c=_0x22026a[_0x7366('0x2a')]['sessionId'];return getAgent(_0x336b4d)['then'](function(_0x1d488b){logger[_0x7366('0x15')]('entityFound:',_0x1d488b[_0x7366('0x1a')]);emit(util[_0x7366('0x31')]('user:%s',_0x1d488b['name']),_0x7366('0x3c'),{'sessionId':_0x5d2a2c});return _0x588b31['status'](0xc8)[_0x7366('0x2c')]({'error':![],'message':_0x7366('0x3d')});})['catch'](handleError(_0x588b31));};exports[_0x7366('0x3e')]=function(_0x1b3923,_0xcce4ef){logger['info'](_0x7366('0x3f'),_0xcce4ef[_0x7366('0x2a')]);var _0x2ca931=callsValidation[_0x7366('0xe')](_0x1b3923['body']);if(_0x2ca931[_0x7366('0x2b')]>0x0){return _0xcce4ef[_0x7366('0x32')](0x190)[_0x7366('0x2c')](_0x2ca931);}var _0xa15c2b=_0x1b3923[_0x7366('0x2a')]['userId'];var _0x1249a7=respondWithRpcPromise(_0x7366('0x24'));var _0x5b3160=getAgent(_0xa15c2b);return Promise[_0x7366('0x40')]([_0x1249a7,_0x5b3160])['then'](function(_0x2335cc){var _0x5cbefc=_0x2335cc[0x0];var _0x427066=_0x2335cc[0x1];var _0x16d438=_['filter'](_0x5cbefc[_0x7366('0x26')],function(_0xec468a){return _0xec468a[_0x7366('0x27')]==_0x427066['id'];});return _0xcce4ef[_0x7366('0x32')](0xc8)['json']({'count':_0x16d438['length'],'rows':_0x16d438});})[_0x7366('0x21')](handleError(_0xcce4ef));};exports['conference']=function(_0x432755,_0x14f758){logger[_0x7366('0x15')](_0x7366('0x41'),_0x432755[_0x7366('0x2a')]);var _0x3e64b7=conferenceValidation[_0x7366('0xe')](_0x432755[_0x7366('0x2a')]);if(_0x3e64b7[_0x7366('0x2b')]>0x0){return _0x14f758['status'](0x190)[_0x7366('0x2c')](_0x3e64b7);}var _0x52d254=_0x432755['body']['userId'];return getAgent(_0x52d254)[_0x7366('0x1d')](function(_0x523016){logger[_0x7366('0x15')]('entityFound:',_0x523016[_0x7366('0x1a')]);emit(util['format'](_0x7366('0x34'),_0x523016[_0x7366('0x1a')]),'webbar:conference');return _0x14f758['status'](0xc8)[_0x7366('0x2c')]({'error':![],'message':_0x7366('0x42')});})[_0x7366('0x21')](handleError(_0x14f758));};exports[_0x7366('0x43')]=function(_0x5dc9e2,_0x349bd2){logger[_0x7366('0x15')](_0x7366('0x44'),_0x5dc9e2['body']);var _0x5a9aeb=transferValidation[_0x7366('0xe')](_0x5dc9e2[_0x7366('0x2a')]);if(_0x5a9aeb[_0x7366('0x2b')]>0x0){return _0x349bd2['status'](0x190)[_0x7366('0x2c')](_0x5a9aeb);}var _0x1e121f=_0x5dc9e2[_0x7366('0x2a')][_0x7366('0x2d')];var _0x3aa57b=_0x5dc9e2[_0x7366('0x2a')][_0x7366('0x28')];var _0x38c65b=_0x5dc9e2[_0x7366('0x2a')][_0x7366('0x45')];return getAgent(_0x1e121f)[_0x7366('0x1d')](function(_0x5d5c2e){logger[_0x7366('0x15')](_0x7366('0x30'),_0x5d5c2e['name']);emit(util[_0x7366('0x31')]('user:%s',_0x5d5c2e['name']),_0x7366('0x46'),{'sessionId':_0x3aa57b,'transferNumber':_0x38c65b});return _0x349bd2[_0x7366('0x32')](0xc8)[_0x7366('0x2c')]({'error':![],'message':_0x7366('0x47')});})[_0x7366('0x21')](handleError(_0x349bd2));}; \ No newline at end of file +var _0x180f=['webbar:unhold','unhold\x20executed!','calls\x20fired:','conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','hangup','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:'];(function(_0x28981a,_0x7d591b){var _0xa6680e=function(_0x19b943){while(--_0x19b943){_0x28981a['push'](_0x28981a['shift']());}};_0xa6680e(++_0x7d591b);}(_0x180f,0xf3));var _0xf180=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x180f[_0x50f392];return _0x5926f2;};'use strict';var path=require(_0xf180('0x0'));var fs=require('fs');var _=require(_0xf180('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xf180('0x2'));var util=require(_0xf180('0x3'));var BPromise=require('bluebird');var jayson=require(_0xf180('0x4'));var amiClient=jayson[_0xf180('0x5')][_0xf180('0x6')]({'port':0x232a});var logger=require(_0xf180('0x7'))(_0xf180('0x8'));var Redis=require('ioredis');config[_0xf180('0x9')]=_[_0xf180('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf180('0xb'))(new Redis(config[_0xf180('0x9')]));var Schema=require(_0xf180('0xc'));var originateValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],_0xf180('0xe')]},'callNumber':{'type':_0xf180('0xf'),'required':[!![],_0xf180('0x10')]},'callerId':{'type':_0xf180('0xf')},'callbackUrl':{'type':_0xf180('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf180('0xe')]},'sessionId':{'type':_0xf180('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],_0xf180('0xe')]},'sessionId':{'type':_0xf180('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],_0xf180('0xe')]},'sessionId':{'type':_0xf180('0xf'),'required':[!![],_0xf180('0x11')]},'transferNumber':{'type':_0xf180('0xf'),'required':[!![],_0xf180('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf180('0xe')]},'sessionId':{'type':_0xf180('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],_0xf180('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],_0xf180('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x105c6a,_0x726be6,_0x496e65){logger[_0xf180('0x13')](_0x105c6a,_0x726be6,JSON[_0xf180('0x14')](_0x496e65));io['to'](_0x105c6a)['emit'](_0x726be6,_0x496e65);}function handleError(_0x4aa215){return function(_0x14ddc6){console[_0xf180('0x15')](_0xf180('0x16'),_0x14ddc6,_0x14ddc6 instanceof RangeError);logger[_0xf180('0x17')](_0x14ddc6[_0xf180('0x18')]);if(_0x14ddc6 instanceof RangeError){if(_0x14ddc6[_0xf180('0x19')]){delete _0x14ddc6[_0xf180('0x19')];}_0x4aa215[_0xf180('0x1a')](0x194)[_0xf180('0x1b')](_0x14ddc6);}else{if(_0x14ddc6[_0xf180('0x19')]){delete _0x14ddc6[_0xf180('0x19')];}_0x4aa215[_0xf180('0x1a')](0x1f4)['send'](_0x14ddc6);}};}function checkError(){return function(_0x3054d7){if(!_0x3054d7){throw new RangeError(_0xf180('0x1c'));}return _0x3054d7;};}function respondWithRpcPromise(_0x50f3b0,_0x466d1d){return new BPromise(function(_0x538bac,_0x36aeee){var _0x4c54b6=amiClient;return _0x4c54b6[_0xf180('0x1d')](_0x50f3b0,_0x466d1d)[_0xf180('0x1e')](function(_0x5d5ead){if(_0x5d5ead['error']){if(_0x5d5ead[_0xf180('0x17')][_0xf180('0x1f')]===0x1f4){return _0x36aeee(_0x5d5ead['error'][_0xf180('0x20')]);}return _0x538bac(_0x5d5ead[_0xf180('0x17')][_0xf180('0x20')]);}else{_0x538bac(_0x5d5ead[_0xf180('0x21')]);}})[_0xf180('0x22')](function(_0x2ca8f9){_0x36aeee(_0x2ca8f9);});});}function getAgent(_0x21498f){return db[_0xf180('0x23')][_0xf180('0x24')]({'where':{'id':_0x21498f,'role':_0xf180('0x25')}})['then'](checkError());}function getAgentCheckSession(_0x3cda7b,_0x158d1a){return new BPromise(function(_0x151b90,_0x113478){var _0x37379c=respondWithRpcPromise(_0xf180('0x26'));var _0xe1db31=getAgent(_0x3cda7b);Promise[_0xf180('0x27')]([_0x37379c,_0xe1db31])[_0xf180('0x1e')](function(_0x3bb197){var _0x564ce1=_0x3bb197[0x0];var _0x323482=_0x3bb197[0x1];var _0xe9a66b=_[_0xf180('0x28')](_0x564ce1[_0xf180('0x29')],function(_0x466895){return _0x466895[_0xf180('0x2a')]==_0x323482['id']&&_0x466895[_0xf180('0x2b')]==_0x158d1a;});if(_0xe9a66b[_0xf180('0x2c')]==0x1){_0x151b90(_0x323482);}else{_0x113478(new RangeError(_0xf180('0x2d')+_0x158d1a+_0xf180('0x2e')));}});});}exports[_0xf180('0x2f')]=function(_0x2702b1,_0x247068){logger[_0xf180('0x13')]('originate\x20fired:',_0x2702b1[_0xf180('0x30')]);var _0x37e211=originateValidation['validate'](_0x2702b1[_0xf180('0x30')]);if(_0x37e211['length']>0x0){return _0x247068[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x37e211);}var _0x303a39=_0x2702b1['body'][_0xf180('0x32')];var _0x2c5d05=_0x2702b1[_0xf180('0x30')][_0xf180('0x33')];var _0x52b1c3=_0x2702b1[_0xf180('0x30')][_0xf180('0x34')];var _0x438d2c=_0x2702b1[_0xf180('0x30')][_0xf180('0x35')];return getAgent(_0x303a39)[_0xf180('0x1e')](function(_0x3ec832){logger[_0xf180('0x13')](_0xf180('0x36'),_0x3ec832[_0xf180('0x19')]);emit(util['format'](_0xf180('0x37'),_0x3ec832['name']),'webbar:originate',{'callNumber':_0x2c5d05,'callerId':_0x52b1c3,'callbackUrl':_0x438d2c});return _0x247068[_0xf180('0x1a')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0xf180('0x22')](handleError(_0x247068));};exports[_0xf180('0x38')]=function(_0x9d65e0,_0x46b53c){logger['info']('hangup\x20fired:',_0x9d65e0[_0xf180('0x30')]);var _0x57dead=hangupValidation[_0xf180('0xc')](_0x9d65e0['body']);if(_0x57dead[_0xf180('0x2c')]>0x0){return _0x46b53c[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x57dead);}var _0x1d0978=_0x9d65e0[_0xf180('0x30')][_0xf180('0x32')];var _0xf43653=_0x9d65e0[_0xf180('0x30')][_0xf180('0x2b')];return getAgent(_0x1d0978)['then'](function(_0x389de4){logger[_0xf180('0x13')]('entityFound:',_0x389de4[_0xf180('0x19')]);emit(util[_0xf180('0x39')](_0xf180('0x37'),_0x389de4[_0xf180('0x19')]),'webbar:hangup',{'sessionId':_0xf43653});return _0x46b53c[_0xf180('0x1a')](0xc8)['json']({'error':![],'message':_0xf180('0x3a')});})[_0xf180('0x22')](handleError(_0x46b53c));};exports[_0xf180('0x3b')]=function(_0x21ac7,_0x5e0701){logger['info'](_0xf180('0x3c'),_0x21ac7[_0xf180('0x30')]);var _0xafbff7=answerValidation[_0xf180('0xc')](_0x21ac7[_0xf180('0x30')]);if(_0xafbff7[_0xf180('0x2c')]>0x0){return _0x5e0701[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0xafbff7);}var _0x321668=_0x21ac7[_0xf180('0x30')]['userId'];var _0x1c4821=_0x21ac7['body'][_0xf180('0x2b')];return getAgent(_0x321668)[_0xf180('0x1e')](function(_0x2cc5ad){logger['info'](_0xf180('0x36'),_0x2cc5ad[_0xf180('0x19')]);emit(util['format'](_0xf180('0x37'),_0x2cc5ad[_0xf180('0x19')]),_0xf180('0x3d'),{'sessionId':_0x1c4821});return _0x5e0701[_0xf180('0x1a')](0xc8)[_0xf180('0x31')]({'error':![],'message':_0xf180('0x3e')});})[_0xf180('0x22')](handleError(_0x5e0701));};exports[_0xf180('0x3f')]=function(_0x17e0a0,_0x2c505c){logger[_0xf180('0x13')](_0xf180('0x40'),_0x17e0a0[_0xf180('0x30')]);var _0x1bd35d=holdValidation[_0xf180('0xc')](_0x17e0a0[_0xf180('0x30')]);if(_0x1bd35d[_0xf180('0x2c')]>0x0){return _0x2c505c[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x1bd35d);}var _0x43c26c=_0x17e0a0['body']['userId'];var _0x2c692e=_0x17e0a0[_0xf180('0x30')][_0xf180('0x2b')];return getAgent(_0x43c26c)[_0xf180('0x1e')](function(_0x1915b4){logger[_0xf180('0x13')](_0xf180('0x36'),_0x1915b4[_0xf180('0x19')]);emit(util[_0xf180('0x39')](_0xf180('0x37'),_0x1915b4[_0xf180('0x19')]),_0xf180('0x41'),{'sessionId':_0x2c692e});return _0x2c505c[_0xf180('0x1a')](0xc8)[_0xf180('0x31')]({'error':![],'message':_0xf180('0x42')});})['catch'](handleError(_0x2c505c));};exports[_0xf180('0x43')]=function(_0x12fabe,_0x4b0dcd){logger[_0xf180('0x13')](_0xf180('0x44'),_0x12fabe[_0xf180('0x30')]);var _0x3603ca=unholdValidation[_0xf180('0xc')](_0x12fabe[_0xf180('0x30')]);if(_0x3603ca[_0xf180('0x2c')]>0x0){return _0x4b0dcd[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x3603ca);}var _0x34579a=_0x12fabe[_0xf180('0x30')][_0xf180('0x32')];var _0x581626=_0x12fabe[_0xf180('0x30')]['sessionId'];return getAgent(_0x34579a)[_0xf180('0x1e')](function(_0x5eb6af){logger['info']('entityFound:',_0x5eb6af['name']);emit(util[_0xf180('0x39')](_0xf180('0x37'),_0x5eb6af['name']),_0xf180('0x45'),{'sessionId':_0x581626});return _0x4b0dcd[_0xf180('0x1a')](0xc8)['json']({'error':![],'message':_0xf180('0x46')});})['catch'](handleError(_0x4b0dcd));};exports['calls']=function(_0x59500f,_0x40ebbc){logger[_0xf180('0x13')](_0xf180('0x47'),_0x40ebbc['body']);var _0x2dcc9e=callsValidation[_0xf180('0xc')](_0x59500f[_0xf180('0x30')]);if(_0x2dcc9e[_0xf180('0x2c')]>0x0){return _0x40ebbc[_0xf180('0x1a')](0x190)['json'](_0x2dcc9e);}var _0x1a6cf2=_0x59500f[_0xf180('0x30')]['userId'];var _0x2f4899=respondWithRpcPromise(_0xf180('0x26'));var _0x2d3ce7=getAgent(_0x1a6cf2);return Promise[_0xf180('0x27')]([_0x2f4899,_0x2d3ce7])[_0xf180('0x1e')](function(_0x516365){var _0x3d815b=_0x516365[0x0];var _0x3edc18=_0x516365[0x1];var _0x430f57=_[_0xf180('0x28')](_0x3d815b['rows'],function(_0xeefb20){return _0xeefb20[_0xf180('0x2a')]==_0x3edc18['id'];});return _0x40ebbc[_0xf180('0x1a')](0xc8)[_0xf180('0x31')]({'count':_0x430f57[_0xf180('0x2c')],'rows':_0x430f57});})['catch'](handleError(_0x40ebbc));};exports[_0xf180('0x48')]=function(_0x5dbc6c,_0x2c8c50){logger[_0xf180('0x13')]('conference\x20fired:',_0x5dbc6c['body']);var _0x527066=conferenceValidation[_0xf180('0xc')](_0x5dbc6c[_0xf180('0x30')]);if(_0x527066[_0xf180('0x2c')]>0x0){return _0x2c8c50[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x527066);}var _0x5b6f3d=_0x5dbc6c['body'][_0xf180('0x32')];return getAgent(_0x5b6f3d)['then'](function(_0x348984){logger[_0xf180('0x13')](_0xf180('0x36'),_0x348984[_0xf180('0x19')]);emit(util[_0xf180('0x39')](_0xf180('0x37'),_0x348984[_0xf180('0x19')]),'webbar:conference');return _0x2c8c50[_0xf180('0x1a')](0xc8)[_0xf180('0x31')]({'error':![],'message':_0xf180('0x49')});})['catch'](handleError(_0x2c8c50));};exports[_0xf180('0x4a')]=function(_0x365821,_0x216854){logger['info'](_0xf180('0x4b'),_0x365821[_0xf180('0x30')]);var _0x41fde4=transferValidation[_0xf180('0xc')](_0x365821[_0xf180('0x30')]);if(_0x41fde4['length']>0x0){return _0x216854[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x41fde4);}var _0x2ff5d1=_0x365821['body'][_0xf180('0x32')];var _0x66ac3a=_0x365821['body'][_0xf180('0x2b')];var _0x4bd8b6=_0x365821[_0xf180('0x30')][_0xf180('0x4c')];return getAgent(_0x2ff5d1)['then'](function(_0x35edb1){logger[_0xf180('0x13')](_0xf180('0x36'),_0x35edb1[_0xf180('0x19')]);emit(util[_0xf180('0x39')](_0xf180('0x37'),_0x35edb1['name']),'webbar:transfer',{'sessionId':_0x66ac3a,'transferNumber':_0x4bd8b6});return _0x216854[_0xf180('0x1a')](0xc8)[_0xf180('0x31')]({'error':![],'message':_0xf180('0x4d')});})[_0xf180('0x22')](handleError(_0x216854));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 6b455e1..b871c85 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 _0x524e=['index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeAnswers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0xdec230,_0x4b3c25){var _0x2fe253=function(_0xeacc88){while(--_0xeacc88){_0xdec230['push'](_0xdec230['shift']());}};_0x2fe253(++_0x4b3c25);}(_0x524e,0x15e));var _0xe524=function(_0x49622f,_0x5bcb80){_0x49622f=_0x49622f-0x0;var _0x5b6ecd=_0x524e[_0x49622f];return _0x5b6ecd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x9')](_0xe524('0x10'),auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x9')](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x9')](_0xe524('0x14'),auth[_0xe524('0xe')](),controller['getAgents']);router['get'](_0xe524('0x15'),auth[_0xe524('0xe')](),controller[_0xe524('0x16')]);router[_0xe524('0x17')]('/',auth[_0xe524('0xe')](),controller['create']);router[_0xe524('0x17')]('/:id/dispositions',auth[_0xe524('0xe')](),controller[_0xe524('0x18')]);router['post'](_0xe524('0x12'),auth['isAuthenticated'](),controller[_0xe524('0x19')]);router['post'](_0xe524('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0xe524('0x15'),auth['isAuthenticated'](),controller[_0xe524('0x1a')]);router[_0xe524('0x17')](_0xe524('0x1b'),controller[_0xe524('0x1c')]);router['post'](_0xe524('0x1d'),auth[_0xe524('0xe')](),controller['send']);router[_0xe524('0x1e')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x1f')]);router[_0xe524('0x20')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x21')]);router[_0xe524('0x20')]('/:id/dispositions',auth[_0xe524('0xe')](),controller['removeDispositions']);router['delete'](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x22')]);router[_0xe524('0x20')]('/:id/users',auth[_0xe524('0xe')](),controller['removeAgents']);module[_0xe524('0x23')]=router; \ No newline at end of file +var _0x781d=['post','addDisposition','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications'];(function(_0x317bf0,_0x277c03){var _0x225932=function(_0x2c280e){while(--_0x2c280e){_0x317bf0['push'](_0x317bf0['shift']());}};_0x225932(++_0x277c03);}(_0x781d,0x14a));var _0xd781=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x781d[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var fs_extra=require(_0xd781('0x4'));var auth=require(_0xd781('0x5'));var interaction=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var controller=require(_0xd781('0x8'));router[_0xd781('0x9')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0xb')]);router['get'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0xd')]);router[_0xd781('0x9')]('/:id',auth[_0xd781('0xa')](),controller['show']);router[_0xd781('0x9')](_0xd781('0xe'),auth['isAuthenticated'](),controller[_0xd781('0xf')]);router[_0xd781('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd781('0x10')]);router[_0xd781('0x9')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x12')]);router[_0xd781('0x9')](_0xd781('0x13'),auth[_0xd781('0xa')](),controller[_0xd781('0x14')]);router[_0xd781('0x15')]('/',auth[_0xd781('0xa')](),controller['create']);router[_0xd781('0x15')](_0xd781('0xe'),auth['isAuthenticated'](),controller[_0xd781('0x16')]);router['post'](_0xd781('0x17'),auth[_0xd781('0xa')](),controller[_0xd781('0x18')]);router[_0xd781('0x15')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x19')]);router['post'](_0xd781('0x13'),auth[_0xd781('0xa')](),controller[_0xd781('0x1a')]);router[_0xd781('0x15')](_0xd781('0x1b'),controller[_0xd781('0x1c')]);router[_0xd781('0x15')](_0xd781('0x1d'),auth['isAuthenticated'](),controller[_0xd781('0x1e')]);router[_0xd781('0x1f')](_0xd781('0x20'),auth[_0xd781('0xa')](),controller[_0xd781('0x21')]);router[_0xd781('0x22')](_0xd781('0x20'),auth['isAuthenticated'](),controller[_0xd781('0x23')]);router['delete']('/:id/dispositions',auth[_0xd781('0xa')](),controller['removeDispositions']);router[_0xd781('0x22')](_0xd781('0x17'),auth[_0xd781('0xa')](),controller[_0xd781('0x24')]);router[_0xd781('0x22')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x25')]);module[_0xd781('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 58ba834..517ac0c 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 _0xd3b0=['twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','generate'];(function(_0x471256,_0x12b9e8){var _0x2b29c6=function(_0x32183d){while(--_0x32183d){_0x471256['push'](_0x471256['shift']());}};_0x2b29c6(++_0x12b9e8);}(_0xd3b0,0x11a));var _0x0d3b=function(_0x1938af,_0x4f65b1){_0x1938af=_0x1938af-0x0;var _0x220cfc=_0xd3b0[_0x1938af];return _0x220cfc;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0d3b('0x0'));module[_0x0d3b('0x1')]={'name':{'type':Sequelize[_0x0d3b('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0d3b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x0d3b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x0d3b('0x2')],'defaultValue':function(){return rs[_0x0d3b('0x3')]();}},'phone':{'type':Sequelize[_0x0d3b('0x2')]},'type':{'type':Sequelize['ENUM'](_0x0d3b('0x4'),_0x0d3b('0x5'))},'accountSid':{'type':Sequelize[_0x0d3b('0x2')]},'baseUrl':{'type':Sequelize[_0x0d3b('0x2')]},'authToken':{'type':Sequelize[_0x0d3b('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0d3b('0x6');}},'notificationSound':{'type':Sequelize[_0x0d3b('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0d3b('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0d3b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0d3b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0d3b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0d3b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0d3b('0x8')],'comment':_0x0d3b('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0d3b('0xa'),'set':function(_0x232105){if(!_0x232105){this[_0x0d3b('0xb')](_0x0d3b('0xc'),null);}this[_0x0d3b('0xb')]('mandatoryDisposition',_0x232105);}},'description':{'type':Sequelize[_0x0d3b('0x2')]}}; \ No newline at end of file +var _0x1f52=['sequelize','exports','STRING','name','generate','ENUM','twilio','sinch','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','mandatoryDisposition'];(function(_0x3eef60,_0x9eb279){var _0x569efe=function(_0xe79c0c){while(--_0xe79c0c){_0x3eef60['push'](_0x3eef60['shift']());}};_0x569efe(++_0x9eb279);}(_0x1f52,0x13b));var _0x21f5=function(_0x2cf52,_0xfe4e12){_0x2cf52=_0x2cf52-0x0;var _0x366206=_0x1f52[_0x2cf52];return _0x366206;};'use strict';var Sequelize=require(_0x21f5('0x0'));var rs=require('randomstring');module[_0x21f5('0x1')]={'name':{'type':Sequelize[_0x21f5('0x2')],'unique':_0x21f5('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x21f5('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x21f5('0x4')]();}},'phone':{'type':Sequelize[_0x21f5('0x2')]},'type':{'type':Sequelize[_0x21f5('0x5')](_0x21f5('0x6'),_0x21f5('0x7'))},'accountSid':{'type':Sequelize[_0x21f5('0x2')]},'baseUrl':{'type':Sequelize[_0x21f5('0x2')]},'authToken':{'type':Sequelize[_0x21f5('0x2')]},'notificationTemplate':{'type':Sequelize[_0x21f5('0x8')],'defaultValue':function(){return _0x21f5('0x9');}},'notificationSound':{'type':Sequelize[_0x21f5('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x21f5('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x21f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x21f5('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x21f5('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x21f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x21f5('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x21f5('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1d3112){if(!_0x1d3112){this[_0x21f5('0xd')]('mandatoryDispositionPauseId',null);}this[_0x21f5('0xd')](_0x21f5('0xe'),_0x1d3112);}},'description':{'type':Sequelize[_0x21f5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index c8d847b..06dab51 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 _0x5472=['nolimit','order','sort','pick','where','filter','merge','options','includeAll','rows','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','stack','finally','getApplications','whatsapp','Applications','account','statuses','read','WhatsappMessage','update','timestamp','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From','replace','whatsapp:','Body','sinch','from','notifications','messageId','isNil','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','WhatsappInteraction','spread','interaction','created','applications','push','close','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','get','WhatsappAccounts','UserProfileResource','destroy','end','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length'];(function(_0x1bc53d,_0x45db73){var _0x4fd791=function(_0xb96ea){while(--_0xb96ea){_0x1bc53d['push'](_0x1bc53d['shift']());}};_0x4fd791(++_0x45db73);}(_0x5472,0x76));var _0x2547=function(_0x34c2b3,_0x46b3fc){_0x34c2b3=_0x34c2b3-0x0;var _0x36a73f=_0x5472[_0x34c2b3];return _0x36a73f;};'use strict';var emlformat=require(_0x2547('0x0'));var rimraf=require(_0x2547('0x1'));var zipdir=require(_0x2547('0x2'));var jsonpatch=require(_0x2547('0x3'));var rp=require(_0x2547('0x4'));var moment=require(_0x2547('0x5'));var BPromise=require(_0x2547('0x6'));var Mustache=require(_0x2547('0x7'));var util=require('util');var path=require(_0x2547('0x8'));var sox=require('sox');var csv=require(_0x2547('0x9'));var ejs=require(_0x2547('0xa'));var fs=require('fs');var fs_extra=require(_0x2547('0xb'));var _=require(_0x2547('0xc'));var squel=require(_0x2547('0xd'));var crypto=require(_0x2547('0xe'));var jsforce=require(_0x2547('0xf'));var deskjs=require(_0x2547('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2547('0x11'));var authService=require(_0x2547('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2547('0x13'));var logger=require('../../config/logger')(_0x2547('0x14'));var utils=require(_0x2547('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2547('0x16'));var db=require('../../mysqldb')['db'];config[_0x2547('0x17')]=_[_0x2547('0x18')](config[_0x2547('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2547('0x19'))(new Redis(config[_0x2547('0x17')]));require(_0x2547('0x1a'))[_0x2547('0x1b')](socket);var jayson=require(_0x2547('0x1c'));var client=jayson['client'][_0x2547('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x16a2a5,_0x1df586,_0x3a71cd,_0x45b135){return new BPromise(function(_0x2738b7,_0x150853){var _0x3840a4=_0x45b135||client;return _0x3840a4[_0x2547('0x1e')](_0x16a2a5,_0x3a71cd)['then'](function(_0x22362b){logger[_0x2547('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x1df586,'request\x20sent');logger[_0x2547('0x20')](_0x2547('0x21'),_0x1df586,_0x2547('0x22'),JSON[_0x2547('0x23')](_0x22362b));if(_0x22362b[_0x2547('0x24')]){if(_0x22362b[_0x2547('0x24')]['code']===0x1f4){logger[_0x2547('0x24')](_0x2547('0x25'),_0x1df586,_0x22362b['error']['message']);return _0x150853(_0x22362b[_0x2547('0x24')][_0x2547('0x26')]);}logger['error'](_0x2547('0x25'),_0x1df586,_0x22362b['error'][_0x2547('0x26')]);return _0x2738b7(_0x22362b[_0x2547('0x24')][_0x2547('0x26')]);}else{logger[_0x2547('0x1f')](_0x2547('0x25'),_0x1df586,_0x2547('0x22'));_0x2738b7(_0x22362b[_0x2547('0x27')][_0x2547('0x26')]);}})[_0x2547('0x28')](function(_0x5d3974){logger[_0x2547('0x24')](_0x2547('0x25'),_0x1df586,_0x5d3974);_0x150853(_0x5d3974);});});}function respondWithStatusCode(_0x59679f,_0x117d3b){_0x117d3b=_0x117d3b||0xcc;return function(_0x5a8550){if(_0x5a8550){return _0x59679f[_0x2547('0x29')](_0x117d3b);}return _0x59679f[_0x2547('0x2a')](_0x117d3b)['end']();};}function respondWithResult(_0x63dace,_0xcf0403){_0xcf0403=_0xcf0403||0xc8;return function(_0x48ceaa){if(_0x48ceaa){return _0x63dace[_0x2547('0x2a')](_0xcf0403)[_0x2547('0x2b')](_0x48ceaa);}};}function respondWithFilteredResult(_0x21012c,_0x4916cb){return function(_0x566a64){if(_0x566a64){var _0x34ec95=typeof _0x4916cb[_0x2547('0x2c')]==='undefined'&&typeof _0x4916cb[_0x2547('0x2d')]===_0x2547('0x2e');var _0xa4d26b=_0x566a64[_0x2547('0x2f')];var _0x57fc63=_0x34ec95?0x0:_0x4916cb[_0x2547('0x2c')];var _0x2d2771=_0x34ec95?_0x566a64['count']:_0x4916cb[_0x2547('0x2c')]+_0x4916cb[_0x2547('0x2d')];var _0x3e10db;if(_0x2d2771>=_0xa4d26b){_0x2d2771=_0xa4d26b;_0x3e10db=0xc8;}else{_0x3e10db=0xce;}_0x21012c['status'](_0x3e10db);return _0x21012c[_0x2547('0x30')](_0x2547('0x31'),_0x57fc63+'-'+_0x2d2771+'/'+_0xa4d26b)[_0x2547('0x2b')](_0x566a64);}return null;};}function patchUpdates(_0x2f1f21){return function(_0x3b8ae1){try{jsonpatch[_0x2547('0x32')](_0x3b8ae1,_0x2f1f21,!![]);}catch(_0x23ad5d){return BPromise['reject'](_0x23ad5d);}return _0x3b8ae1[_0x2547('0x33')]();};}function saveUpdates(_0x487caa,_0x30f9ac){return function(_0x3ebbb2){if(_0x3ebbb2){return _0x3ebbb2['update'](_0x487caa)[_0x2547('0x34')](function(_0x11cb59){return _0x11cb59;});}return null;};}function removeEntity(_0x2e3210,_0x4e90df){return function(_0xbd8666){if(_0xbd8666){return _0xbd8666['destroy']()[_0x2547('0x34')](function(){var _0x448c51=_0xbd8666[_0x2547('0x35')]({'plain':!![]});var _0x2800b3=_0x2547('0x36');return db[_0x2547('0x37')][_0x2547('0x38')]({'where':{'type':_0x2800b3,'resourceId':_0x448c51['id']}})['then'](function(){return _0xbd8666;});})[_0x2547('0x34')](function(){_0x2e3210[_0x2547('0x2a')](0xcc)[_0x2547('0x39')]();});}};}function handleEntityNotFound(_0x295824,_0x29cbb8){return function(_0x2cc651){if(!_0x2cc651){_0x295824[_0x2547('0x29')](0x194);}return _0x2cc651;};}function handleError(_0x5a9214,_0x7a46b2){_0x7a46b2=_0x7a46b2||0x1f4;return function(_0x323cbb){logger[_0x2547('0x24')](_0x323cbb['stack']);if(_0x323cbb[_0x2547('0x3a')]){delete _0x323cbb[_0x2547('0x3a')];}_0x5a9214[_0x2547('0x2a')](_0x7a46b2)[_0x2547('0x3b')](_0x323cbb);};}exports[_0x2547('0x3c')]=function(_0x2fb4a6,_0x3b7e62){var _0x18419b={'include':[{'model':db[_0x2547('0x3d')],'as':_0x2547('0x3e')}]},_0x1f6923={},_0xbe9b86={'count':0x0,'rows':[]};var _0x465940=_[_0x2547('0x3f')](db[_0x2547('0x40')]['rawAttributes'],function(_0x4d2642){return{'name':_0x4d2642[_0x2547('0x41')],'type':_0x4d2642[_0x2547('0x42')]['key']};});_0x1f6923['model']=_[_0x2547('0x3f')](_0x465940,_0x2547('0x3a'));_0x1f6923['query']=_[_0x2547('0x43')](_0x2fb4a6[_0x2547('0x44')]);_0x1f6923[_0x2547('0x45')]=_[_0x2547('0x46')](_0x1f6923[_0x2547('0x47')],_0x1f6923[_0x2547('0x44')]);_0x18419b[_0x2547('0x48')]=_['intersection'](_0x1f6923[_0x2547('0x47')],qs[_0x2547('0x49')](_0x2fb4a6[_0x2547('0x44')][_0x2547('0x49')]));_0x18419b[_0x2547('0x48')]=_0x18419b[_0x2547('0x48')][_0x2547('0x4a')]?_0x18419b[_0x2547('0x48')]:_0x1f6923[_0x2547('0x47')];if(!_0x2fb4a6['query']['hasOwnProperty'](_0x2547('0x4b'))){_0x18419b[_0x2547('0x2d')]=qs[_0x2547('0x2d')](_0x2fb4a6['query'][_0x2547('0x2d')]);_0x18419b['offset']=qs[_0x2547('0x2c')](_0x2fb4a6[_0x2547('0x44')][_0x2547('0x2c')]);}_0x18419b[_0x2547('0x4c')]=qs[_0x2547('0x4d')](_0x2fb4a6[_0x2547('0x44')]['sort']);_0x18419b['where']=qs[_0x2547('0x45')](_[_0x2547('0x4e')](_0x2fb4a6[_0x2547('0x44')],_0x1f6923[_0x2547('0x45')]),_0x465940);if(_0x2fb4a6[_0x2547('0x44')]['filter']){_0x18419b[_0x2547('0x4f')]=_['merge'](_0x18419b[_0x2547('0x4f')],{'$or':_[_0x2547('0x3f')](_0x465940,function(_0x322315){if(_0x322315['type']!=='VIRTUAL'){var _0x297de1={};_0x297de1[_0x322315[_0x2547('0x3a')]]={'$like':'%'+_0x2fb4a6[_0x2547('0x44')][_0x2547('0x50')]+'%'};return _0x297de1;}})});}_0x18419b=_[_0x2547('0x51')]({},_0x18419b,_0x2fb4a6[_0x2547('0x52')]);var _0x30c8e3={'where':_0x18419b['where']};return db[_0x2547('0x40')]['count'](_0x30c8e3)[_0x2547('0x34')](function(_0x332615){_0xbe9b86[_0x2547('0x2f')]=_0x332615;if(_0x2fb4a6[_0x2547('0x44')][_0x2547('0x53')]){_0x18419b['include']=[{'all':!![]}];}return db[_0x2547('0x40')]['findAll'](_0x18419b);})[_0x2547('0x34')](function(_0x4af540){_0xbe9b86[_0x2547('0x54')]=_0x4af540;return _0xbe9b86;})[_0x2547('0x34')](respondWithFilteredResult(_0x3b7e62,_0x18419b))[_0x2547('0x28')](handleError(_0x3b7e62,null));};exports['show']=function(_0xe24cef,_0x5a36ab){var _0x9249fa={'raw':![],'where':{'id':_0xe24cef['params']['id']},'include':[{'model':db[_0x2547('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2fb144={};_0x2fb144['model']=_[_0x2547('0x43')](db[_0x2547('0x40')][_0x2547('0x55')]);_0x2fb144[_0x2547('0x44')]=_['keys'](_0xe24cef['query']);_0x2fb144[_0x2547('0x45')]=_['intersection'](_0x2fb144[_0x2547('0x47')],_0x2fb144['query']);_0x9249fa[_0x2547('0x48')]=_[_0x2547('0x46')](_0x2fb144[_0x2547('0x47')],qs[_0x2547('0x49')](_0xe24cef['query'][_0x2547('0x49')]));_0x9249fa[_0x2547('0x48')]=_0x9249fa[_0x2547('0x48')]['length']?_0x9249fa[_0x2547('0x48')]:_0x2fb144[_0x2547('0x47')];if(_0xe24cef['query'][_0x2547('0x53')]){_0x9249fa[_0x2547('0x56')]=[{'all':!![]}];}_0x9249fa=_['merge']({},_0x9249fa,_0xe24cef[_0x2547('0x52')]);return db[_0x2547('0x40')][_0x2547('0x57')](_0x9249fa)[_0x2547('0x34')](handleEntityNotFound(_0x5a36ab,null))['then'](respondWithResult(_0x5a36ab,null))[_0x2547('0x28')](handleError(_0x5a36ab,null));};exports[_0x2547('0x58')]=function(_0xc2def5,_0x2db675){return db[_0x2547('0x40')][_0x2547('0x58')](_0xc2def5[_0x2547('0x59')],{})[_0x2547('0x34')](function(_0x47952c){var _0x113eb4=_0xc2def5[_0x2547('0x5a')]['get']({'plain':!![]});if(!_0x113eb4)throw new Error(_0x2547('0x5b'));if(_0x113eb4['role']===_0x2547('0x5a')){var _0x52f8e6=_0x47952c[_0x2547('0x35')]({'plain':!![]});var _0x17f58f=_0x2547('0x36');return db[_0x2547('0x5c')][_0x2547('0x57')]({'where':{'name':_0x17f58f,'userProfileId':_0x113eb4[_0x2547('0x5d')]},'raw':!![]})[_0x2547('0x34')](function(_0x2e3116){if(_0x2e3116&&_0x2e3116['autoAssociation']===0x0){return db[_0x2547('0x37')][_0x2547('0x58')]({'name':_0x52f8e6[_0x2547('0x3a')],'resourceId':_0x52f8e6['id'],'type':_0x2e3116[_0x2547('0x3a')],'sectionId':_0x2e3116['id']},{})[_0x2547('0x34')](function(){return _0x47952c;});}else{return _0x47952c;}})[_0x2547('0x28')](function(_0x55aa65){logger[_0x2547('0x24')](_0x2547('0x5e'),_0x55aa65);throw _0x55aa65;});}return _0x47952c;})[_0x2547('0x34')](respondWithResult(_0x2db675,0xc9))[_0x2547('0x28')](handleError(_0x2db675,null));};exports['update']=function(_0x1ebc02,_0x50b501){if(_0x1ebc02[_0x2547('0x59')]['id']){delete _0x1ebc02['body']['id'];}return db[_0x2547('0x40')]['find']({'where':{'id':_0x1ebc02[_0x2547('0x5f')]['id']},'include':[{'model':db[_0x2547('0x3d')],'as':_0x2547('0x3e')}]})[_0x2547('0x34')](handleEntityNotFound(_0x50b501,null))[_0x2547('0x34')](saveUpdates(_0x1ebc02[_0x2547('0x59')],null))[_0x2547('0x34')](respondWithResult(_0x50b501,null))[_0x2547('0x28')](handleError(_0x50b501,null));};exports[_0x2547('0x38')]=function(_0x2494cb,_0x33fc25){return db[_0x2547('0x40')][_0x2547('0x57')]({'where':{'id':_0x2494cb['params']['id']}})[_0x2547('0x34')](handleEntityNotFound(_0x33fc25,null))[_0x2547('0x34')](removeEntity(_0x33fc25,null))['catch'](handleError(_0x33fc25,null));};exports[_0x2547('0x60')]=function(_0x3caf5a,_0x40aad7){return db['WhatsappAccount'][_0x2547('0x60')]()[_0x2547('0x34')](respondWithResult(_0x40aad7,null))[_0x2547('0x28')](handleError(_0x40aad7,null));};exports[_0x2547('0x61')]=function(_0x48a5a6,_0x246273,_0x5f66e6){if(_0x48a5a6[_0x2547('0x59')]['id']){delete _0x48a5a6[_0x2547('0x59')]['id'];}return db['WhatsappAccount'][_0x2547('0x57')]({'where':{'id':_0x48a5a6[_0x2547('0x5f')]['id']}})[_0x2547('0x34')](handleEntityNotFound(_0x246273,null))[_0x2547('0x34')](function(_0x636103){if(_0x636103){_0x48a5a6[_0x2547('0x59')][_0x2547('0x62')]=_0x636103['id'];return db[_0x2547('0x63')][_0x2547('0x58')](_0x48a5a6[_0x2547('0x59')]);}})[_0x2547('0x34')](respondWithResult(_0x246273,null))[_0x2547('0x28')](handleError(_0x246273,null));};exports[_0x2547('0x64')]=function(_0x530dbe,_0x1406a6,_0x470590){var _0x397060={'raw':![],'where':{}};var _0x1497c6={};var _0x1c323e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2547('0x65')]({'where':{'id':_0x530dbe[_0x2547('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1406a6,null))['then'](function(_0x19de29){if(_0x19de29){_0x1497c6[_0x2547('0x47')]=_[_0x2547('0x43')](db[_0x2547('0x63')]['rawAttributes']);_0x1497c6[_0x2547('0x44')]=_[_0x2547('0x43')](_0x530dbe[_0x2547('0x44')]);_0x1497c6['filters']=_[_0x2547('0x46')](_0x1497c6[_0x2547('0x47')],_0x1497c6[_0x2547('0x44')]);_0x397060[_0x2547('0x48')]=_[_0x2547('0x46')](_0x1497c6[_0x2547('0x47')],qs[_0x2547('0x49')](_0x530dbe[_0x2547('0x44')][_0x2547('0x49')]));_0x397060[_0x2547('0x48')]=_0x397060[_0x2547('0x48')][_0x2547('0x4a')]?_0x397060['attributes']:_0x1497c6[_0x2547('0x47')];if(!_0x530dbe[_0x2547('0x44')]['hasOwnProperty'](_0x2547('0x4b'))){_0x397060[_0x2547('0x2d')]=qs[_0x2547('0x2d')](_0x530dbe[_0x2547('0x44')]['limit']);_0x397060['offset']=qs[_0x2547('0x2c')](_0x530dbe[_0x2547('0x44')]['offset']);}_0x397060[_0x2547('0x4c')]=qs['sort'](_0x530dbe[_0x2547('0x44')][_0x2547('0x4d')]);_0x397060[_0x2547('0x4f')]=qs['filters'](_[_0x2547('0x4e')](_0x530dbe['query'],_0x1497c6[_0x2547('0x45')]));_0x397060['where'][_0x2547('0x62')]=_0x19de29['id'];if(_0x530dbe[_0x2547('0x44')]['filter']){_0x397060['where']=_['merge'](_0x397060[_0x2547('0x4f')],{'$or':_[_0x2547('0x3f')](_0x397060[_0x2547('0x48')],function(_0x4c101c){var _0x45d70a={};_0x45d70a[_0x4c101c]={'$like':'%'+_0x530dbe[_0x2547('0x44')]['filter']+'%'};return _0x45d70a;})});}_0x397060=_[_0x2547('0x51')]({},_0x397060,_0x530dbe[_0x2547('0x52')]);return db[_0x2547('0x63')][_0x2547('0x2f')]({'where':_0x397060[_0x2547('0x4f')]})[_0x2547('0x34')](function(_0x2da54d){_0x1c323e[_0x2547('0x2f')]=_0x2da54d;if(_0x530dbe[_0x2547('0x44')][_0x2547('0x53')]){_0x397060[_0x2547('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x2547('0x66')](_0x397060);})[_0x2547('0x34')](function(_0x3a04d0){_0x1c323e['rows']=_0x3a04d0;return _0x1c323e;});}})[_0x2547('0x34')](respondWithFilteredResult(_0x1406a6,_0x397060))[_0x2547('0x28')](handleError(_0x1406a6,null));};exports[_0x2547('0x67')]=function(_0x3cbcf0,_0x3f86b2,_0x13bea3){return db['WhatsappAccount'][_0x2547('0x57')]({'where':{'id':_0x3cbcf0[_0x2547('0x5f')]['id']}})[_0x2547('0x34')](handleEntityNotFound(_0x3f86b2,null))['then'](function(_0x463814){if(_0x463814){return _0x463814[_0x2547('0x67')](_0x3cbcf0[_0x2547('0x44')][_0x2547('0x68')]);}})[_0x2547('0x34')](respondWithStatusCode(_0x3f86b2,null))[_0x2547('0x28')](handleError(_0x3f86b2,null));};exports[_0x2547('0x69')]=function(_0x587190,_0x372df8,_0x15733a){if(_0x587190[_0x2547('0x59')]['id']){delete _0x587190['body']['id'];}return db[_0x2547('0x40')]['find']({'where':{'id':_0x587190['params']['id']}})['then'](handleEntityNotFound(_0x372df8,null))[_0x2547('0x34')](function(_0x24c5fd){if(_0x24c5fd){_0x587190['body']['WhatsappAccountId']=_0x24c5fd['id'];return db[_0x2547('0x6a')][_0x2547('0x58')](_0x587190[_0x2547('0x59')]);}})[_0x2547('0x34')](respondWithResult(_0x372df8,null))[_0x2547('0x28')](handleError(_0x372df8,null));};exports['getAnswers']=function(_0x1052fe,_0xad76bb,_0x23d03d){var _0x52b232={'raw':![],'where':{}};var _0x309efb={};var _0x491f17={'count':0x0,'rows':[]};return db[_0x2547('0x40')]['findOne']({'where':{'id':_0x1052fe['params']['id']}})['then'](handleEntityNotFound(_0xad76bb,null))[_0x2547('0x34')](function(_0x947eca){if(_0x947eca){_0x309efb[_0x2547('0x47')]=_[_0x2547('0x43')](db[_0x2547('0x6a')]['rawAttributes']);_0x309efb['query']=_[_0x2547('0x43')](_0x1052fe['query']);_0x309efb[_0x2547('0x45')]=_[_0x2547('0x46')](_0x309efb['model'],_0x309efb['query']);_0x52b232['attributes']=_['intersection'](_0x309efb[_0x2547('0x47')],qs[_0x2547('0x49')](_0x1052fe[_0x2547('0x44')][_0x2547('0x49')]));_0x52b232[_0x2547('0x48')]=_0x52b232[_0x2547('0x48')]['length']?_0x52b232[_0x2547('0x48')]:_0x309efb[_0x2547('0x47')];if(!_0x1052fe[_0x2547('0x44')][_0x2547('0x6b')]('nolimit')){_0x52b232['limit']=qs[_0x2547('0x2d')](_0x1052fe[_0x2547('0x44')]['limit']);_0x52b232[_0x2547('0x2c')]=qs[_0x2547('0x2c')](_0x1052fe[_0x2547('0x44')][_0x2547('0x2c')]);}_0x52b232[_0x2547('0x4c')]=qs[_0x2547('0x4d')](_0x1052fe[_0x2547('0x44')][_0x2547('0x4d')]);_0x52b232[_0x2547('0x4f')]=qs['filters'](_['pick'](_0x1052fe['query'],_0x309efb[_0x2547('0x45')]));_0x52b232['where'][_0x2547('0x62')]=_0x947eca['id'];if(_0x1052fe[_0x2547('0x44')][_0x2547('0x50')]){_0x52b232['where']=_[_0x2547('0x51')](_0x52b232[_0x2547('0x4f')],{'$or':_[_0x2547('0x3f')](_0x52b232[_0x2547('0x48')],function(_0xa7b7ee){var _0x4e3314={};_0x4e3314[_0xa7b7ee]={'$like':'%'+_0x1052fe['query'][_0x2547('0x50')]+'%'};return _0x4e3314;})});}_0x52b232=_[_0x2547('0x51')]({},_0x52b232,_0x1052fe['options']);return db[_0x2547('0x6a')][_0x2547('0x2f')]({'where':_0x52b232[_0x2547('0x4f')]})[_0x2547('0x34')](function(_0x19238c){_0x491f17['count']=_0x19238c;if(_0x1052fe[_0x2547('0x44')]['includeAll']){_0x52b232['include']=[{'all':!![]}];}return db[_0x2547('0x6a')][_0x2547('0x66')](_0x52b232);})[_0x2547('0x34')](function(_0x27f6fb){_0x491f17[_0x2547('0x54')]=_0x27f6fb;return _0x491f17;});}})['then'](respondWithFilteredResult(_0xad76bb,_0x52b232))[_0x2547('0x28')](handleError(_0xad76bb,null));};exports[_0x2547('0x6c')]=function(_0x543b27,_0x5be981,_0x47569f){return db[_0x2547('0x40')]['find']({'where':{'id':_0x543b27[_0x2547('0x5f')]['id']}})[_0x2547('0x34')](handleEntityNotFound(_0x5be981,null))[_0x2547('0x34')](function(_0x5c4165){if(_0x5c4165){return _0x5c4165[_0x2547('0x6c')](_0x543b27[_0x2547('0x44')][_0x2547('0x68')]);}})[_0x2547('0x34')](respondWithStatusCode(_0x5be981,null))[_0x2547('0x28')](handleError(_0x5be981,null));};exports[_0x2547('0x6d')]=function(_0x41ae3c,_0x5b4e9c,_0xfe1856){return db[_0x2547('0x40')][_0x2547('0x57')]({'where':{'id':_0x41ae3c[_0x2547('0x5f')]['id']}})[_0x2547('0x34')](handleEntityNotFound(_0x5b4e9c,null))[_0x2547('0x34')](function(_0x560dfe){if(_0x560dfe){return _0x560dfe[_0x2547('0x6d')](_0x41ae3c[_0x2547('0x59')][_0x2547('0x68')],_[_0x2547('0x6e')](_0x41ae3c['body'],[_0x2547('0x68'),'id'])||{})['spread'](function(_0x1543e9){for(var _0x4131cf=0x0;_0x4131cf<_0x41ae3c[_0x2547('0x59')]['ids']['length'];_0x4131cf+=0x1){socket[_0x2547('0x6f')](_0x2547('0x70'),{'UserId':Number(_0x41ae3c[_0x2547('0x59')][_0x2547('0x68')][_0x4131cf]),'WhatsappAccountId':Number(_0x41ae3c[_0x2547('0x5f')]['id'])});}return _0x1543e9;});}})['then'](respondWithResult(_0x5b4e9c,null))[_0x2547('0x28')](handleError(_0x5b4e9c,null));};exports['removeAgents']=function(_0x29a7ba,_0x26c265,_0x14c199){return db[_0x2547('0x40')]['find']({'where':{'id':_0x29a7ba[_0x2547('0x5f')]['id']}})[_0x2547('0x34')](handleEntityNotFound(_0x26c265,null))[_0x2547('0x34')](function(_0x48d6e0){if(_0x48d6e0){return _0x48d6e0[_0x2547('0x71')](_0x29a7ba[_0x2547('0x44')][_0x2547('0x68')])['then'](function(){if(_[_0x2547('0x72')](_0x29a7ba['query'][_0x2547('0x68')])){for(var _0x520634=0x0;_0x520634<_0x29a7ba[_0x2547('0x44')][_0x2547('0x68')]['length'];_0x520634+=0x1){socket[_0x2547('0x6f')](_0x2547('0x73'),{'UserId':Number(_0x29a7ba[_0x2547('0x44')][_0x2547('0x68')][_0x520634]),'WhatsappAccountId':Number(_0x29a7ba[_0x2547('0x5f')]['id'])});}}else{socket[_0x2547('0x6f')](_0x2547('0x73'),{'UserId':Number(_0x29a7ba['query'][_0x2547('0x68')]),'WhatsappAccountId':Number(_0x29a7ba[_0x2547('0x5f')]['id'])});}});}})[_0x2547('0x34')](respondWithStatusCode(_0x26c265,null))[_0x2547('0x28')](handleError(_0x26c265,null));};exports['getAgents']=function(_0x128d2a,_0x5499a5,_0x2be3a3){var _0xb3469b={};var _0x7d3677={};var _0x300fdb;var _0x25f084;return db['WhatsappAccount'][_0x2547('0x65')]({'where':{'id':_0x128d2a[_0x2547('0x5f')]['id']}})[_0x2547('0x34')](handleEntityNotFound(_0x5499a5,null))[_0x2547('0x34')](function(_0x51f811){if(_0x51f811){_0x300fdb=_0x51f811;_0x7d3677[_0x2547('0x47')]=_['keys'](db[_0x2547('0x74')]['rawAttributes']);_0x7d3677['query']=_[_0x2547('0x43')](_0x128d2a[_0x2547('0x44')]);_0x7d3677[_0x2547('0x45')]=_[_0x2547('0x46')](_0x7d3677[_0x2547('0x47')],_0x7d3677[_0x2547('0x44')]);_0xb3469b['attributes']=_['intersection'](_0x7d3677[_0x2547('0x47')],qs['fields'](_0x128d2a[_0x2547('0x44')]['fields']));_0xb3469b[_0x2547('0x48')]=_0xb3469b[_0x2547('0x48')][_0x2547('0x4a')]?_0xb3469b[_0x2547('0x48')]:_0x7d3677[_0x2547('0x47')];_0xb3469b['order']=qs['sort'](_0x128d2a['query']['sort']);_0xb3469b[_0x2547('0x4f')]=qs[_0x2547('0x45')](_[_0x2547('0x4e')](_0x128d2a[_0x2547('0x44')],_0x7d3677[_0x2547('0x45')]));if(_0x128d2a[_0x2547('0x44')][_0x2547('0x50')]){_0xb3469b[_0x2547('0x4f')]=_[_0x2547('0x51')](_0xb3469b['where'],{'$or':_[_0x2547('0x3f')](_0xb3469b[_0x2547('0x48')],function(_0x30646c){var _0x4c3550={};_0x4c3550[_0x30646c]={'$like':'%'+_0x128d2a[_0x2547('0x44')]['filter']+'%'};return _0x4c3550;})});}_0xb3469b=_[_0x2547('0x51')]({},_0xb3469b,_0x128d2a[_0x2547('0x52')]);return _0x300fdb['getAgents'](_0xb3469b);}})[_0x2547('0x34')](function(_0x9ecdaa){if(_0x9ecdaa){_0x25f084=_0x9ecdaa[_0x2547('0x4a')];if(!_0x128d2a['query'][_0x2547('0x6b')](_0x2547('0x4b'))){_0xb3469b[_0x2547('0x2d')]=qs[_0x2547('0x2d')](_0x128d2a[_0x2547('0x44')][_0x2547('0x2d')]);_0xb3469b['offset']=qs['offset'](_0x128d2a['query'][_0x2547('0x2c')]);}return _0x300fdb['getAgents'](_0xb3469b);}})['then'](function(_0x4ccd68){if(_0x4ccd68){return _0x4ccd68?{'count':_0x25f084,'rows':_0x4ccd68}:null;}})[_0x2547('0x34')](respondWithResult(_0x5499a5,null))[_0x2547('0x28')](handleError(_0x5499a5,null));};exports[_0x2547('0x75')]=function(_0x112d28,_0x276e46){var _0x15b4d4=_0x112d28['params']['id'];var _0x4a38c9=_0x112d28[_0x2547('0x59')];var _0x1eb822=0xc8;var _0x2bcc89=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2547('0x76')]['Transaction'][_0x2547('0x77')][_0x2547('0x78')]},function(_0x2a34aa){return db[_0x2547('0x40')]['findOne']({'where':{'id':_0x15b4d4},'transaction':_0x2a34aa})[_0x2547('0x34')](function(_0x4b5628){if(_0x4b5628){return db['WhatsappApplication'][_0x2547('0x38')]({'where':{'WhatsappAccountId':_0x15b4d4},'transaction':_0x2a34aa})[_0x2547('0x34')](function(){var _0x24f67e=_[_0x2547('0x3f')](_0x4a38c9,function(_0x470370){_0x470370['WhatsappAccountId']=_0x15b4d4;return _0x470370;});return db[_0x2547('0x79')][_0x2547('0x7a')](_0x24f67e,{'transaction':_0x2a34aa});});}else{_0x1eb822=0x194;_0x2bcc89=[];}});})[_0x2547('0x34')](function(){if(_0x1eb822!==0x194){return db[_0x2547('0x79')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x15b4d4},'order':_0x2547('0x7b')})['then'](function(_0xf6ef6a){_0x2bcc89=_0xf6ef6a;});}})[_0x2547('0x28')](function(_0x24f35b){_0x1eb822=0x1f4;logger[_0x2547('0x24')](_0x24f35b[_0x2547('0x7c')]);if(_0x24f35b[_0x2547('0x3a')]){delete _0x24f35b[_0x2547('0x3a')];}_0x2bcc89=_0x24f35b;})[_0x2547('0x7d')](function(){if(_0x2bcc89===null){_0x276e46['sendStatus'](_0x1eb822);}else{if(_0x1eb822===0x1f4){_0x276e46[_0x2547('0x2a')](_0x1eb822)[_0x2547('0x3b')](_0x2bcc89);}else{_0x276e46[_0x2547('0x2a')](_0x1eb822)['json'](_0x2bcc89);}}});};exports['getApplications']=function(_0x55f1ae,_0x2e12d5,_0x2096a7){var _0xe9ec8b={};var _0x1e224c={};var _0x42ab63;var _0x2f583d;return db['WhatsappAccount'][_0x2547('0x65')]({'where':{'id':_0x55f1ae['params']['id']}})[_0x2547('0x34')](handleEntityNotFound(_0x2e12d5,null))[_0x2547('0x34')](function(_0x4691ac){if(_0x4691ac){_0x42ab63=_0x4691ac;_0x1e224c[_0x2547('0x47')]=_[_0x2547('0x43')](db[_0x2547('0x79')]['rawAttributes']);_0x1e224c['query']=_[_0x2547('0x43')](_0x55f1ae[_0x2547('0x44')]);_0x1e224c['filters']=_[_0x2547('0x46')](_0x1e224c['model'],_0x1e224c['query']);_0xe9ec8b['attributes']=_[_0x2547('0x46')](_0x1e224c[_0x2547('0x47')],qs[_0x2547('0x49')](_0x55f1ae[_0x2547('0x44')]['fields']));_0xe9ec8b[_0x2547('0x48')]=_0xe9ec8b[_0x2547('0x48')][_0x2547('0x4a')]?_0xe9ec8b[_0x2547('0x48')]:_0x1e224c['model'];_0xe9ec8b[_0x2547('0x4c')]=qs[_0x2547('0x4d')](_0x55f1ae[_0x2547('0x44')]['sort']);_0xe9ec8b[_0x2547('0x4f')]=qs[_0x2547('0x45')](_['pick'](_0x55f1ae[_0x2547('0x44')],_0x1e224c[_0x2547('0x45')]));if(_0x55f1ae['query'][_0x2547('0x50')]){_0xe9ec8b[_0x2547('0x4f')]=_[_0x2547('0x51')](_0xe9ec8b[_0x2547('0x4f')],{'$or':_[_0x2547('0x3f')](_0xe9ec8b[_0x2547('0x48')],function(_0x169b0d){var _0x58e296={};_0x58e296[_0x169b0d]={'$like':'%'+_0x55f1ae[_0x2547('0x44')][_0x2547('0x50')]+'%'};return _0x58e296;})});}_0xe9ec8b=_[_0x2547('0x51')]({},_0xe9ec8b,_0x55f1ae[_0x2547('0x52')]);return _0x42ab63[_0x2547('0x7e')](_0xe9ec8b);}})['then'](function(_0x57ba62){if(_0x57ba62){_0x2f583d=_0x57ba62[_0x2547('0x4a')];if(!_0x55f1ae['query'][_0x2547('0x6b')](_0x2547('0x4b'))){_0xe9ec8b['limit']=qs[_0x2547('0x2d')](_0x55f1ae[_0x2547('0x44')][_0x2547('0x2d')]);_0xe9ec8b[_0x2547('0x2c')]=qs[_0x2547('0x2c')](_0x55f1ae[_0x2547('0x44')]['offset']);}return _0x42ab63[_0x2547('0x7e')](_0xe9ec8b);}})[_0x2547('0x34')](function(_0xea3e59){if(_0xea3e59){return _0xea3e59?{'count':_0x2f583d,'rows':_0xea3e59}:null;}})[_0x2547('0x34')](respondWithResult(_0x2e12d5,null))[_0x2547('0x28')](handleError(_0x2e12d5,null));};exports['notify']=function(_0x2b877f,_0x2867ae,_0x3e49fc){var _0x19e310={'channel':_0x2547('0x7f')};var _0x43cdec=[];var _0x2e9f00=[];var _0x23ad3b={};return db['WhatsappAccount'][_0x2547('0x57')]({'where':{'id':_0x2b877f['params']['id']},'include':[{'model':db[_0x2547('0x79')],'as':_0x2547('0x80')}]})[_0x2547('0x34')](handleEntityNotFound(_0x2867ae,null))[_0x2547('0x34')](function(_0x1aeaca){_0x19e310[_0x2547('0x81')]=_0x1aeaca;if(_0x19e310[_0x2547('0x81')]&&_0x19e310[_0x2547('0x81')]['type']==='sinch'&&_0x2b877f[_0x2547('0x59')][_0x2547('0x82')]){if(_0x2b877f[_0x2547('0x59')][_0x2547('0x82')][_0x2547('0x4a')]===0x0)return;if(_0x2b877f[_0x2547('0x59')][_0x2547('0x82')][0x0]['state']!==_0x2547('0x83'))return;return db[_0x2547('0x84')][_0x2547('0x85')]({'read':!![],'readAt':_0x2b877f[_0x2547('0x59')][_0x2547('0x82')][0x0][_0x2547('0x86')]},{'where':{'messageId':_0x2b877f[_0x2547('0x59')][_0x2547('0x82')][0x0][_0x2547('0x87')]},'individualHooks':!![]})['then'](function(_0x3a990c){return _0x2867ae[_0x2547('0x2a')](0xc8)['json'](_0x3a990c);});}_0x19e310['applications']=_[_0x2547('0x88')](_0x1aeaca['Applications'],['priority'],[_0x2547('0x89')]);if(_0x19e310[_0x2547('0x81')][_0x2547('0x80')]){delete _0x19e310[_0x2547('0x81')][_0x2547('0x80')];}return db[_0x2547('0x8a')]['describe']()[_0x2547('0x34')](function(_0x36cafb){if(!_0x36cafb){throw new db[(_0x2547('0x8b'))][(_0x2547('0x8c'))](_0x2547('0x8d'));}_0x43cdec=_[_0x2547('0x8e')](_[_0x2547('0x43')](_0x36cafb),[_0x2547('0x8f'),'updatedAt']);_0x2e9f00=_['difference'](_[_0x2547('0x43')](_0x36cafb),[_0x2547('0x8f'),_0x2547('0x90'),_0x2547('0x91'),_0x2547('0x92')]);_0x19e310[_0x2547('0x59')]={'mapKey':_0x2547('0x93')};if(_0x19e310[_0x2547('0x81')]&&_0x19e310['account'][_0x2547('0x42')]==='twilio'){_0x19e310[_0x2547('0x59')]['from']=_0x2b877f[_0x2547('0x59')][_0x2547('0x94')][_0x2547('0x95')](_0x2547('0x96'),'');_0x19e310[_0x2547('0x59')][_0x2547('0x59')]=_0x2b877f[_0x2547('0x59')][_0x2547('0x97')];_0x19e310[_0x2547('0x59')]['messageId']=_0x2b877f['body']['MessageSid'];}if(_0x19e310[_0x2547('0x81')]&&_0x19e310[_0x2547('0x81')]['type']===_0x2547('0x98')){_0x19e310[_0x2547('0x59')][_0x2547('0x99')]=_0x2b877f[_0x2547('0x59')]['notifications'][0x0][_0x2547('0x99')];_0x19e310[_0x2547('0x59')][_0x2547('0x59')]=_0x2b877f[_0x2547('0x59')][_0x2547('0x9a')][0x0][_0x2547('0x26')][_0x2547('0x59')];_0x19e310[_0x2547('0x59')][_0x2547('0x9b')]=_0x2b877f[_0x2547('0x59')][_0x2547('0x9a')][0x0]['message_id'];}if(_0x19e310[_0x2547('0x59')]['id']){delete _0x19e310[_0x2547('0x59')]['id'];}if(_[_0x2547('0x9c')](_0x19e310['body']['from'])){throw new db['Sequelize'][(_0x2547('0x8c'))](_0x2547('0x9d'));}if(_[_0x2547('0x9c')](_0x19e310[_0x2547('0x59')]['body'])||_0x19e310[_0x2547('0x59')][_0x2547('0x59')]===''){throw new db[(_0x2547('0x8b'))][(_0x2547('0x8c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x19e310[_0x2547('0x59')]['mapKey'])){throw new db[(_0x2547('0x8b'))][(_0x2547('0x8c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e9f00);}if(!_[_0x2547('0x9e')](_0x2e9f00,_0x19e310[_0x2547('0x59')][_0x2547('0x9f')])){throw new db[(_0x2547('0x8b'))]['ValidationError'](_0x2547('0xa0')+_0x2e9f00);}_0x23ad3b[_0x19e310['body'][_0x2547('0x9f')]]=_0x19e310[_0x2547('0x59')][_0x2547('0x99')];return db[_0x2547('0xa1')][_0x2547('0x57')]({'where':{'id':_0x19e310[_0x2547('0x81')]['ListId']},'include':[{'model':db[_0x2547('0x8a')],'as':_0x2547('0xa2'),'where':_0x23ad3b,'limit':0x1,'order':[[_0x2547('0x90'),'DESC']]}]});})['then'](handleEntityNotFound(_0x2867ae,null))[_0x2547('0x34')](function(_0x24923e){if(_0x24923e){_0x19e310['list']=_['omit'](_0x24923e,[_0x2547('0xa2')]);if(_0x24923e[_0x2547('0xa2')]['length']){return _0x24923e['Contacts'][0x0];}var _0x5e88c6=_[_0x2547('0x18')](_0x19e310[_0x2547('0x59')],{'firstName':_0x19e310['body'][_0x2547('0x99')],'ListId':_0x24923e['id']});_0x5e88c6[_0x19e310[_0x2547('0x59')][_0x2547('0x9f')]]=_0x19e310['body'][_0x2547('0x99')];return db['CmContact'][_0x2547('0x58')](_0x5e88c6,{'fields':_0x43cdec,'raw':!![]});}})[_0x2547('0x34')](handleEntityNotFound(_0x2867ae,null))[_0x2547('0x34')](function(_0x2422a9){if(_0x2422a9){_0x19e310[_0x2547('0xa3')]=_0x2422a9;var _0x12ee3f={'ContactId':_0x2422a9['id'],'phone':_0x19e310['body'][_0x2547('0x99')],'WhatsappAccountId':_0x2b877f[_0x2547('0x5f')]['id']};var _0x5245ef={'ContactId':_0x2422a9['id'],'WhatsappAccountId':_0x2b877f['params']['id'],'closed':![]};return db[_0x2547('0xa4')][_0x2547('0x57')]({'where':_0x5245ef})[_0x2547('0x34')](function(_0x2e7e2e){if(_0x2e7e2e){return[_0x2e7e2e,![]];}return db[_0x2547('0xa4')][_0x2547('0x58')](_0x12ee3f)[_0x2547('0x34')](function(_0x42b9a4){return[_0x42b9a4,!![]];});});}})[_0x2547('0xa5')](function(_0x477346,_0x2993c7){_0x19e310[_0x2547('0xa6')]=_0x477346[_0x2547('0x35')]({'plain':!![]});_0x19e310[_0x2547('0xa6')][_0x2547('0xa7')]=![];if(_0x2993c7){if(_0x19e310[_0x2547('0x81')]['autoclose']){_0x19e310[_0x2547('0xa8')][_0x2547('0xa9')]({'id':0x0,'priority':_0x19e310['applications'][_0x2547('0x4a')]+0x1,'app':_0x2547('0xaa'),'appdata':_0x2547('0xab'),'interval':_0x2547('0xac')});}_0x19e310[_0x2547('0xa6')][_0x2547('0xa7')]=!![];}return db[_0x2547('0x84')]['create']({'phone':_0x19e310['body'][_0x2547('0x99')],'messageId':_0x19e310[_0x2547('0x59')][_0x2547('0x9b')],'body':_0x19e310['body']['body'],'WhatsappAccountId':_0x2b877f[_0x2547('0x5f')]['id'],'WhatsappInteractionId':_0x477346['id'],'direction':'in','ContactId':_0x477346[_0x2547('0xad')],'AttachmentId':_0x19e310['body']['AttachmentId']});})[_0x2547('0x34')](function(_0x199e07){_0x19e310[_0x2547('0x26')]=_0x199e07;if(_0x19e310[_0x2547('0xa6')][_0x2547('0xae')]){return db[_0x2547('0x74')]['find']({'attributes':['id',_0x2547('0x3a')],'where':{'id':_0x19e310[_0x2547('0xa6')][_0x2547('0xae')]}})[_0x2547('0x34')](function(_0x338efc){if(_0x338efc){_0x19e310[_0x2547('0xa8')][_0x2547('0xaf')]({'id':0x0,'priority':0x0,'app':_0x2547('0xb0'),'appdata':_0x338efc[_0x2547('0x3a')]+','+(_0x19e310[_0x2547('0x81')][_0x2547('0xb1')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x2547('0xb2'),_0x19e310);});}return respondWithRpcPromise(_0x2547('0xb3'),_0x2547('0xb2'),_0x19e310);})[_0x2547('0x34')](function(_0x25b969){if(_0x25b969){var _0x482e92=0xc8;var _0x35e5db=_0x2547('0xb4');logger[_0x2547('0x1f')](_0x2547('0x21'),_0x35e5db,_0x482e92,_0x2547('0xb5'));logger[_0x2547('0x20')](_0x2547('0xb6'),_0x35e5db,_0x482e92,_0x2547('0xb5'),JSON[_0x2547('0x23')](_0x25b969));if(_0x19e310[_0x2547('0x81')][_0x2547('0x42')]===_0x2547('0xb7')){return _0x2867ae['status'](_0x482e92)[_0x2547('0x30')](_0x2547('0xb8'),_0x2547('0xb9'))[_0x2547('0x3b')](_0x2547('0xba'));}else{return _0x2867ae[_0x2547('0x2a')](_0x482e92)[_0x2547('0x2b')](_0x25b969);}}});})[_0x2547('0x28')](handleError(_0x2867ae,null));};exports[_0x2547('0x3b')]=function(_0x38fb32,_0xea9bc4,_0x2c07f9){var _0x6904ae,_0x563108,_0x1f5faa;if(_[_0x2547('0x9c')](_0x38fb32['body']['body'])||_0x38fb32[_0x2547('0x59')]['body']===''){throw new db[(_0x2547('0x8b'))][(_0x2547('0x8c'))](_0x2547('0xbb'));}if(_['isNil'](_0x38fb32[_0x2547('0x59')]['to'])){throw new db[(_0x2547('0x8b'))][(_0x2547('0x8c'))](_0x2547('0xbc'));}_0x6904ae=_0x38fb32[_0x2547('0x59')]['to'];return db[_0x2547('0x40')][_0x2547('0x57')]({'where':{'id':_0x38fb32[_0x2547('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0x2547('0xbd'),'include':[{'model':db[_0x2547('0x8a')],'as':_0x2547('0xa2'),'where':{'mobile':_0x6904ae},'limit':0x1,'order':[[_0x2547('0x90'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xea9bc4,null))[_0x2547('0x34')](function(_0x4936f6){if(_0x4936f6&&_0x4936f6[_0x2547('0xbd')]){_0x563108=_0x4936f6[_0x2547('0x35')]({'plain':!![]});if(_0x563108['List']&&_0x563108[_0x2547('0xbd')]['Contacts']['length']){return _0x563108[_0x2547('0xbd')]['Contacts'][0x0];}return db['CmContact'][_0x2547('0x58')](_[_0x2547('0x18')](_0x38fb32[_0x2547('0x59')],{'firstName':_0x6904ae,'mobile':_0x6904ae,'phone':_0x6904ae,'ListId':_0x563108[_0x2547('0x92')]}));}})[_0x2547('0x34')](handleEntityNotFound(_0xea9bc4,null))[_0x2547('0x34')](function(_0x124e20){if(_0x124e20){_0x1f5faa=_0x124e20;return db[_0x2547('0xa4')][_0x2547('0x57')]({'where':{'ContactId':_0x1f5faa['id'],'closed':![],'WhatsappAccountId':_0x563108['id']}})[_0x2547('0x34')](function(_0x5d1589){if(_0x5d1589){return[_0x5d1589,![]];}return db[_0x2547('0xa4')][_0x2547('0x58')]({'UserId':_0x38fb32[_0x2547('0x5a')]['id'],'ContactId':_0x1f5faa['id'],'WhatsappAccountId':_0x563108['id'],'phone':_0x6904ae,'firstMsgDirection':_0x2547('0xbe'),'Messages':[_[_0x2547('0x51')](_0x38fb32[_0x2547('0x59')],{'read':![],'body':_0x38fb32['body']['body'],'phone':_0x6904ae,'WhatsappAccountId':_0x563108['id'],'UserId':_0x38fb32[_0x2547('0x5a')]['id'],'ContactId':_0x1f5faa['id']})]},{'include':[{'model':db[_0x2547('0x84')],'as':_0x2547('0xbf')}]})[_0x2547('0x34')](function(_0x2875fb){return[_0x2875fb,!![]];});});}})['spread'](function(_0x231f9a,_0x23d790){if(_0x23d790){return _0x231f9a;}return db['WhatsappMessage'][_0x2547('0x58')](_[_0x2547('0x51')](_0x38fb32['body'],{'read':![],'body':_0x38fb32[_0x2547('0x59')][_0x2547('0x59')],'phone':_0x6904ae,'WhatsappAccountId':_0x563108['id'],'WhatsappInteractionId':_0x231f9a['id'],'UserId':_0x38fb32[_0x2547('0x5a')]['id'],'ContactId':_0x1f5faa['id']}))['then'](function(_0x11843e){_0x231f9a[_0x2547('0xc0')][_0x2547('0xbf')]=[];_0x231f9a[_0x2547('0xc0')][_0x2547('0xbf')]['push'](_0x11843e[_0x2547('0xc0')]);return _0x231f9a;});})['then'](respondWithResult(_0xea9bc4,null))['catch'](handleError(_0xea9bc4,null));}; \ No newline at end of file +var _0x55d7=['replace','Body','messageId','MessageSid','from','notifications','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','Contacts','WhatsappInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','set','text/xml','send','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','count','limit','apply','reject','save','destroy','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','body','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','WhatsappAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','sort','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','removeAgents','isArray','emit','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','sinch','statuses','state','WhatsappMessage','update','timestamp','message_id','applications','orderBy','Applications','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From'];(function(_0x39d481,_0x468019){var _0x510b49=function(_0x3f57d9){while(--_0x3f57d9){_0x39d481['push'](_0x39d481['shift']());}};_0x510b49(++_0x468019);}(_0x55d7,0x1bd));var _0x755d=function(_0x454017,_0x4c2948){_0x454017=_0x454017-0x0;var _0x22d946=_0x55d7[_0x454017];return _0x22d946;};'use strict';var emlformat=require(_0x755d('0x0'));var rimraf=require(_0x755d('0x1'));var zipdir=require(_0x755d('0x2'));var jsonpatch=require(_0x755d('0x3'));var rp=require(_0x755d('0x4'));var moment=require('moment');var BPromise=require(_0x755d('0x5'));var Mustache=require(_0x755d('0x6'));var util=require(_0x755d('0x7'));var path=require(_0x755d('0x8'));var sox=require(_0x755d('0x9'));var csv=require(_0x755d('0xa'));var ejs=require(_0x755d('0xb'));var fs=require('fs');var fs_extra=require(_0x755d('0xc'));var _=require('lodash');var squel=require(_0x755d('0xd'));var crypto=require(_0x755d('0xe'));var jsforce=require(_0x755d('0xf'));var deskjs=require(_0x755d('0x10'));var toCsv=require(_0x755d('0xa'));var querystring=require(_0x755d('0x11'));var Papa=require(_0x755d('0x12'));var Redis=require(_0x755d('0x13'));var authService=require(_0x755d('0x14'));var qs=require(_0x755d('0x15'));var as=require(_0x755d('0x16'));var hardwareService=require(_0x755d('0x17'));var logger=require(_0x755d('0x18'))(_0x755d('0x19'));var utils=require(_0x755d('0x1a'));var config=require(_0x755d('0x1b'));var licenseUtil=require(_0x755d('0x1c'));var db=require(_0x755d('0x1d'))['db'];config[_0x755d('0x1e')]=_[_0x755d('0x1f')](config[_0x755d('0x1e')],{'host':_0x755d('0x20'),'port':0x18eb});var socket=require(_0x755d('0x21'))(new Redis(config[_0x755d('0x1e')]));require(_0x755d('0x22'))[_0x755d('0x23')](socket);var jayson=require(_0x755d('0x24'));var client=jayson[_0x755d('0x25')][_0x755d('0x26')]({'port':0x232c});function respondWithRpcPromise(_0xfc6dd4,_0x38f2d4,_0x36d4ed,_0x5aeacb){return new BPromise(function(_0x5bc91e,_0x3faf11){var _0x599c64=_0x5aeacb||client;return _0x599c64[_0x755d('0x27')](_0xfc6dd4,_0x36d4ed)[_0x755d('0x28')](function(_0x314d61){logger[_0x755d('0x29')](_0x755d('0x2a'),_0x38f2d4,_0x755d('0x2b'));logger[_0x755d('0x2c')](_0x755d('0x2d'),_0x38f2d4,_0x755d('0x2b'),JSON[_0x755d('0x2e')](_0x314d61));if(_0x314d61[_0x755d('0x2f')]){if(_0x314d61[_0x755d('0x2f')][_0x755d('0x30')]===0x1f4){logger[_0x755d('0x2f')](_0x755d('0x2a'),_0x38f2d4,_0x314d61[_0x755d('0x2f')][_0x755d('0x31')]);return _0x3faf11(_0x314d61['error'][_0x755d('0x31')]);}logger['error'](_0x755d('0x2a'),_0x38f2d4,_0x314d61[_0x755d('0x2f')][_0x755d('0x31')]);return _0x5bc91e(_0x314d61[_0x755d('0x2f')][_0x755d('0x31')]);}else{logger[_0x755d('0x29')](_0x755d('0x2a'),_0x38f2d4,_0x755d('0x2b'));_0x5bc91e(_0x314d61['result'][_0x755d('0x31')]);}})[_0x755d('0x32')](function(_0x2b3ce9){logger[_0x755d('0x2f')](_0x755d('0x2a'),_0x38f2d4,_0x2b3ce9);_0x3faf11(_0x2b3ce9);});});}function respondWithStatusCode(_0x91bfb4,_0x27333f){_0x27333f=_0x27333f||0xcc;return function(_0x4225a5){if(_0x4225a5){return _0x91bfb4['sendStatus'](_0x27333f);}return _0x91bfb4[_0x755d('0x33')](_0x27333f)[_0x755d('0x34')]();};}function respondWithResult(_0x3cada1,_0x57b8e8){_0x57b8e8=_0x57b8e8||0xc8;return function(_0x158a5c){if(_0x158a5c){return _0x3cada1[_0x755d('0x33')](_0x57b8e8)[_0x755d('0x35')](_0x158a5c);}};}function respondWithFilteredResult(_0x12adec,_0x156b03){return function(_0x3c4dbd){if(_0x3c4dbd){var _0x2ffc4a=typeof _0x156b03[_0x755d('0x36')]==='undefined'&&typeof _0x156b03['limit']===_0x755d('0x37');var _0x42bdb0=_0x3c4dbd[_0x755d('0x38')];var _0x540767=_0x2ffc4a?0x0:_0x156b03[_0x755d('0x36')];var _0x511d14=_0x2ffc4a?_0x3c4dbd[_0x755d('0x38')]:_0x156b03[_0x755d('0x36')]+_0x156b03[_0x755d('0x39')];var _0x5ab821;if(_0x511d14>=_0x42bdb0){_0x511d14=_0x42bdb0;_0x5ab821=0xc8;}else{_0x5ab821=0xce;}_0x12adec[_0x755d('0x33')](_0x5ab821);return _0x12adec['set']('Content-Range',_0x540767+'-'+_0x511d14+'/'+_0x42bdb0)[_0x755d('0x35')](_0x3c4dbd);}return null;};}function patchUpdates(_0x5921ae){return function(_0x1ff4e6){try{jsonpatch[_0x755d('0x3a')](_0x1ff4e6,_0x5921ae,!![]);}catch(_0x1ffd77){return BPromise[_0x755d('0x3b')](_0x1ffd77);}return _0x1ff4e6[_0x755d('0x3c')]();};}function saveUpdates(_0x3c3e66,_0x1631ab){return function(_0x268d11){if(_0x268d11){return _0x268d11['update'](_0x3c3e66)[_0x755d('0x28')](function(_0x2f8805){return _0x2f8805;});}return null;};}function removeEntity(_0x557a04,_0x390abc){return function(_0x1cb73d){if(_0x1cb73d){return _0x1cb73d[_0x755d('0x3d')]()[_0x755d('0x28')](function(){var _0x47b0a3=_0x1cb73d['get']({'plain':!![]});var _0x40a7ce=_0x755d('0x3e');return db[_0x755d('0x3f')][_0x755d('0x3d')]({'where':{'type':_0x40a7ce,'resourceId':_0x47b0a3['id']}})[_0x755d('0x28')](function(){return _0x1cb73d;});})[_0x755d('0x28')](function(){_0x557a04[_0x755d('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5159,_0x580af2){return function(_0x45110a){if(!_0x45110a){_0x3f5159[_0x755d('0x40')](0x194);}return _0x45110a;};}function handleError(_0x111c0b,_0x572c6f){_0x572c6f=_0x572c6f||0x1f4;return function(_0x25f537){logger[_0x755d('0x2f')](_0x25f537[_0x755d('0x41')]);if(_0x25f537['name']){delete _0x25f537[_0x755d('0x42')];}_0x111c0b[_0x755d('0x33')](_0x572c6f)['send'](_0x25f537);};}exports[_0x755d('0x43')]=function(_0x41cfc3,_0x341f77){var _0x5d2ee4={'include':[{'model':db['Pause'],'as':_0x755d('0x44')}]},_0x133843={},_0x2683aa={'count':0x0,'rows':[]};var _0x1d0e48=_[_0x755d('0x45')](db[_0x755d('0x46')][_0x755d('0x47')],function(_0x4f0bfa){return{'name':_0x4f0bfa[_0x755d('0x48')],'type':_0x4f0bfa[_0x755d('0x49')]['key']};});_0x133843[_0x755d('0x4a')]=_['map'](_0x1d0e48,_0x755d('0x42'));_0x133843['query']=_[_0x755d('0x4b')](_0x41cfc3[_0x755d('0x4c')]);_0x133843[_0x755d('0x4d')]=_[_0x755d('0x4e')](_0x133843['model'],_0x133843[_0x755d('0x4c')]);_0x5d2ee4[_0x755d('0x4f')]=_[_0x755d('0x4e')](_0x133843[_0x755d('0x4a')],qs[_0x755d('0x50')](_0x41cfc3[_0x755d('0x4c')]['fields']));_0x5d2ee4[_0x755d('0x4f')]=_0x5d2ee4[_0x755d('0x4f')][_0x755d('0x51')]?_0x5d2ee4[_0x755d('0x4f')]:_0x133843[_0x755d('0x4a')];if(!_0x41cfc3['query']['hasOwnProperty'](_0x755d('0x52'))){_0x5d2ee4['limit']=qs[_0x755d('0x39')](_0x41cfc3[_0x755d('0x4c')]['limit']);_0x5d2ee4[_0x755d('0x36')]=qs['offset'](_0x41cfc3[_0x755d('0x4c')][_0x755d('0x36')]);}_0x5d2ee4[_0x755d('0x53')]=qs['sort'](_0x41cfc3[_0x755d('0x4c')]['sort']);_0x5d2ee4[_0x755d('0x54')]=qs[_0x755d('0x4d')](_[_0x755d('0x55')](_0x41cfc3[_0x755d('0x4c')],_0x133843[_0x755d('0x4d')]),_0x1d0e48);if(_0x41cfc3[_0x755d('0x4c')][_0x755d('0x56')]){_0x5d2ee4[_0x755d('0x54')]=_[_0x755d('0x57')](_0x5d2ee4[_0x755d('0x54')],{'$or':_[_0x755d('0x45')](_0x1d0e48,function(_0x1289c5){if(_0x1289c5[_0x755d('0x49')]!=='VIRTUAL'){var _0x49c8ae={};_0x49c8ae[_0x1289c5[_0x755d('0x42')]]={'$like':'%'+_0x41cfc3[_0x755d('0x4c')][_0x755d('0x56')]+'%'};return _0x49c8ae;}})});}_0x5d2ee4=_['merge']({},_0x5d2ee4,_0x41cfc3[_0x755d('0x58')]);var _0x5087d6={'where':_0x5d2ee4['where']};return db[_0x755d('0x46')][_0x755d('0x38')](_0x5087d6)['then'](function(_0x363eeb){_0x2683aa['count']=_0x363eeb;if(_0x41cfc3['query'][_0x755d('0x59')]){_0x5d2ee4['include']=[{'all':!![]}];}return db[_0x755d('0x46')][_0x755d('0x5a')](_0x5d2ee4);})['then'](function(_0x513b44){_0x2683aa[_0x755d('0x5b')]=_0x513b44;return _0x2683aa;})['then'](respondWithFilteredResult(_0x341f77,_0x5d2ee4))[_0x755d('0x32')](handleError(_0x341f77,null));};exports[_0x755d('0x5c')]=function(_0x46cdc3,_0x3ecc96){var _0x43c6a6={'raw':![],'where':{'id':_0x46cdc3[_0x755d('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x755d('0x44')}]},_0xe97f7a={};_0xe97f7a[_0x755d('0x4a')]=_[_0x755d('0x4b')](db[_0x755d('0x46')][_0x755d('0x47')]);_0xe97f7a[_0x755d('0x4c')]=_[_0x755d('0x4b')](_0x46cdc3['query']);_0xe97f7a[_0x755d('0x4d')]=_[_0x755d('0x4e')](_0xe97f7a[_0x755d('0x4a')],_0xe97f7a[_0x755d('0x4c')]);_0x43c6a6['attributes']=_[_0x755d('0x4e')](_0xe97f7a[_0x755d('0x4a')],qs[_0x755d('0x50')](_0x46cdc3['query']['fields']));_0x43c6a6[_0x755d('0x4f')]=_0x43c6a6[_0x755d('0x4f')][_0x755d('0x51')]?_0x43c6a6[_0x755d('0x4f')]:_0xe97f7a['model'];if(_0x46cdc3[_0x755d('0x4c')][_0x755d('0x59')]){_0x43c6a6[_0x755d('0x5e')]=[{'all':!![]}];}_0x43c6a6=_['merge']({},_0x43c6a6,_0x46cdc3[_0x755d('0x58')]);return db[_0x755d('0x46')][_0x755d('0x5f')](_0x43c6a6)[_0x755d('0x28')](handleEntityNotFound(_0x3ecc96,null))[_0x755d('0x28')](respondWithResult(_0x3ecc96,null))[_0x755d('0x32')](handleError(_0x3ecc96,null));};exports['create']=function(_0x5c03a6,_0x5d4f07){return db[_0x755d('0x46')]['create'](_0x5c03a6[_0x755d('0x60')],{})[_0x755d('0x28')](function(_0x4a9f30){var _0x7b5630=_0x5c03a6[_0x755d('0x61')][_0x755d('0x62')]({'plain':!![]});if(!_0x7b5630)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7b5630[_0x755d('0x63')]==='user'){var _0x27ed44=_0x4a9f30[_0x755d('0x62')]({'plain':!![]});var _0x1beba=_0x755d('0x3e');return db['UserProfileSection'][_0x755d('0x5f')]({'where':{'name':_0x1beba,'userProfileId':_0x7b5630[_0x755d('0x64')]},'raw':!![]})['then'](function(_0x16886f){if(_0x16886f&&_0x16886f[_0x755d('0x65')]===0x0){return db[_0x755d('0x3f')]['create']({'name':_0x27ed44[_0x755d('0x42')],'resourceId':_0x27ed44['id'],'type':_0x16886f['name'],'sectionId':_0x16886f['id']},{})[_0x755d('0x28')](function(){return _0x4a9f30;});}else{return _0x4a9f30;}})[_0x755d('0x32')](function(_0x47159a){logger[_0x755d('0x2f')](_0x755d('0x66'),_0x47159a);throw _0x47159a;});}return _0x4a9f30;})[_0x755d('0x28')](respondWithResult(_0x5d4f07,0xc9))[_0x755d('0x32')](handleError(_0x5d4f07,null));};exports['update']=function(_0x37dcb7,_0x346020){if(_0x37dcb7[_0x755d('0x60')]['id']){delete _0x37dcb7[_0x755d('0x60')]['id'];}return db[_0x755d('0x46')][_0x755d('0x5f')]({'where':{'id':_0x37dcb7['params']['id']},'include':[{'model':db[_0x755d('0x67')],'as':_0x755d('0x44')}]})[_0x755d('0x28')](handleEntityNotFound(_0x346020,null))['then'](saveUpdates(_0x37dcb7['body'],null))[_0x755d('0x28')](respondWithResult(_0x346020,null))[_0x755d('0x32')](handleError(_0x346020,null));};exports['destroy']=function(_0x538fce,_0x4b6405){return db[_0x755d('0x46')][_0x755d('0x5f')]({'where':{'id':_0x538fce[_0x755d('0x5d')]['id']}})[_0x755d('0x28')](handleEntityNotFound(_0x4b6405,null))[_0x755d('0x28')](removeEntity(_0x4b6405,null))[_0x755d('0x32')](handleError(_0x4b6405,null));};exports[_0x755d('0x68')]=function(_0x899797,_0x202b31){return db['WhatsappAccount'][_0x755d('0x68')]()[_0x755d('0x28')](respondWithResult(_0x202b31,null))[_0x755d('0x32')](handleError(_0x202b31,null));};exports['addDisposition']=function(_0x127288,_0x421d6b,_0x5caa59){if(_0x127288[_0x755d('0x60')]['id']){delete _0x127288['body']['id'];}return db[_0x755d('0x46')][_0x755d('0x5f')]({'where':{'id':_0x127288[_0x755d('0x5d')]['id']}})[_0x755d('0x28')](handleEntityNotFound(_0x421d6b,null))[_0x755d('0x28')](function(_0x5f345b){if(_0x5f345b){_0x127288[_0x755d('0x60')][_0x755d('0x69')]=_0x5f345b['id'];return db[_0x755d('0x6a')][_0x755d('0x6b')](_0x127288['body']);}})['then'](respondWithResult(_0x421d6b,null))['catch'](handleError(_0x421d6b,null));};exports[_0x755d('0x6c')]=function(_0x24cf9e,_0xa6c294,_0x29caa6){var _0x3ab85c={'raw':![],'where':{}};var _0x4c0ff1={};var _0x3f87a7={'count':0x0,'rows':[]};return db[_0x755d('0x46')][_0x755d('0x6d')]({'where':{'id':_0x24cf9e[_0x755d('0x5d')]['id']}})[_0x755d('0x28')](handleEntityNotFound(_0xa6c294,null))['then'](function(_0x4d45b9){if(_0x4d45b9){_0x4c0ff1['model']=_[_0x755d('0x4b')](db[_0x755d('0x6a')][_0x755d('0x47')]);_0x4c0ff1[_0x755d('0x4c')]=_[_0x755d('0x4b')](_0x24cf9e['query']);_0x4c0ff1['filters']=_[_0x755d('0x4e')](_0x4c0ff1[_0x755d('0x4a')],_0x4c0ff1[_0x755d('0x4c')]);_0x3ab85c[_0x755d('0x4f')]=_[_0x755d('0x4e')](_0x4c0ff1[_0x755d('0x4a')],qs[_0x755d('0x50')](_0x24cf9e['query'][_0x755d('0x50')]));_0x3ab85c[_0x755d('0x4f')]=_0x3ab85c[_0x755d('0x4f')][_0x755d('0x51')]?_0x3ab85c[_0x755d('0x4f')]:_0x4c0ff1['model'];if(!_0x24cf9e['query'][_0x755d('0x6e')]('nolimit')){_0x3ab85c[_0x755d('0x39')]=qs[_0x755d('0x39')](_0x24cf9e[_0x755d('0x4c')]['limit']);_0x3ab85c[_0x755d('0x36')]=qs[_0x755d('0x36')](_0x24cf9e['query']['offset']);}_0x3ab85c[_0x755d('0x53')]=qs[_0x755d('0x6f')](_0x24cf9e[_0x755d('0x4c')][_0x755d('0x6f')]);_0x3ab85c[_0x755d('0x54')]=qs[_0x755d('0x4d')](_[_0x755d('0x55')](_0x24cf9e['query'],_0x4c0ff1[_0x755d('0x4d')]));_0x3ab85c['where'][_0x755d('0x69')]=_0x4d45b9['id'];if(_0x24cf9e[_0x755d('0x4c')][_0x755d('0x56')]){_0x3ab85c[_0x755d('0x54')]=_[_0x755d('0x57')](_0x3ab85c[_0x755d('0x54')],{'$or':_['map'](_0x3ab85c[_0x755d('0x4f')],function(_0x514c51){var _0x1ed427={};_0x1ed427[_0x514c51]={'$like':'%'+_0x24cf9e[_0x755d('0x4c')][_0x755d('0x56')]+'%'};return _0x1ed427;})});}_0x3ab85c=_[_0x755d('0x57')]({},_0x3ab85c,_0x24cf9e[_0x755d('0x58')]);return db[_0x755d('0x6a')]['count']({'where':_0x3ab85c[_0x755d('0x54')]})[_0x755d('0x28')](function(_0x5c9b30){_0x3f87a7[_0x755d('0x38')]=_0x5c9b30;if(_0x24cf9e[_0x755d('0x4c')][_0x755d('0x59')]){_0x3ab85c[_0x755d('0x5e')]=[{'all':!![]}];}return db[_0x755d('0x6a')][_0x755d('0x5a')](_0x3ab85c);})['then'](function(_0x14c027){_0x3f87a7[_0x755d('0x5b')]=_0x14c027;return _0x3f87a7;});}})[_0x755d('0x28')](respondWithFilteredResult(_0xa6c294,_0x3ab85c))['catch'](handleError(_0xa6c294,null));};exports['removeDispositions']=function(_0x5daff2,_0x25814e,_0x638c74){return db['WhatsappAccount'][_0x755d('0x5f')]({'where':{'id':_0x5daff2['params']['id']}})['then'](handleEntityNotFound(_0x25814e,null))[_0x755d('0x28')](function(_0x2a24a0){if(_0x2a24a0){return _0x2a24a0[_0x755d('0x70')](_0x5daff2[_0x755d('0x4c')][_0x755d('0x71')]);}})[_0x755d('0x28')](respondWithStatusCode(_0x25814e,null))['catch'](handleError(_0x25814e,null));};exports['addAnswer']=function(_0x35a914,_0x1a55ea,_0x14a9be){if(_0x35a914[_0x755d('0x60')]['id']){delete _0x35a914[_0x755d('0x60')]['id'];}return db[_0x755d('0x46')][_0x755d('0x5f')]({'where':{'id':_0x35a914[_0x755d('0x5d')]['id']}})[_0x755d('0x28')](handleEntityNotFound(_0x1a55ea,null))[_0x755d('0x28')](function(_0x1d1bf7){if(_0x1d1bf7){_0x35a914[_0x755d('0x60')][_0x755d('0x69')]=_0x1d1bf7['id'];return db[_0x755d('0x72')][_0x755d('0x6b')](_0x35a914[_0x755d('0x60')]);}})[_0x755d('0x28')](respondWithResult(_0x1a55ea,null))[_0x755d('0x32')](handleError(_0x1a55ea,null));};exports[_0x755d('0x73')]=function(_0x47fcee,_0x36b6e1,_0x5f11bc){var _0x4d57ee={'raw':![],'where':{}};var _0xa47b35={};var _0x903fe0={'count':0x0,'rows':[]};return db[_0x755d('0x46')]['findOne']({'where':{'id':_0x47fcee[_0x755d('0x5d')]['id']}})[_0x755d('0x28')](handleEntityNotFound(_0x36b6e1,null))['then'](function(_0x41f32d){if(_0x41f32d){_0xa47b35[_0x755d('0x4a')]=_[_0x755d('0x4b')](db[_0x755d('0x72')]['rawAttributes']);_0xa47b35[_0x755d('0x4c')]=_[_0x755d('0x4b')](_0x47fcee['query']);_0xa47b35[_0x755d('0x4d')]=_[_0x755d('0x4e')](_0xa47b35[_0x755d('0x4a')],_0xa47b35[_0x755d('0x4c')]);_0x4d57ee['attributes']=_[_0x755d('0x4e')](_0xa47b35[_0x755d('0x4a')],qs[_0x755d('0x50')](_0x47fcee[_0x755d('0x4c')][_0x755d('0x50')]));_0x4d57ee[_0x755d('0x4f')]=_0x4d57ee['attributes'][_0x755d('0x51')]?_0x4d57ee[_0x755d('0x4f')]:_0xa47b35[_0x755d('0x4a')];if(!_0x47fcee[_0x755d('0x4c')][_0x755d('0x6e')](_0x755d('0x52'))){_0x4d57ee['limit']=qs[_0x755d('0x39')](_0x47fcee[_0x755d('0x4c')]['limit']);_0x4d57ee[_0x755d('0x36')]=qs[_0x755d('0x36')](_0x47fcee['query'][_0x755d('0x36')]);}_0x4d57ee[_0x755d('0x53')]=qs[_0x755d('0x6f')](_0x47fcee[_0x755d('0x4c')][_0x755d('0x6f')]);_0x4d57ee[_0x755d('0x54')]=qs[_0x755d('0x4d')](_[_0x755d('0x55')](_0x47fcee['query'],_0xa47b35[_0x755d('0x4d')]));_0x4d57ee[_0x755d('0x54')][_0x755d('0x69')]=_0x41f32d['id'];if(_0x47fcee[_0x755d('0x4c')]['filter']){_0x4d57ee[_0x755d('0x54')]=_[_0x755d('0x57')](_0x4d57ee[_0x755d('0x54')],{'$or':_[_0x755d('0x45')](_0x4d57ee[_0x755d('0x4f')],function(_0x30d892){var _0x4ae17b={};_0x4ae17b[_0x30d892]={'$like':'%'+_0x47fcee['query'][_0x755d('0x56')]+'%'};return _0x4ae17b;})});}_0x4d57ee=_['merge']({},_0x4d57ee,_0x47fcee[_0x755d('0x58')]);return db[_0x755d('0x72')][_0x755d('0x38')]({'where':_0x4d57ee[_0x755d('0x54')]})[_0x755d('0x28')](function(_0x1ecb09){_0x903fe0[_0x755d('0x38')]=_0x1ecb09;if(_0x47fcee[_0x755d('0x4c')][_0x755d('0x59')]){_0x4d57ee['include']=[{'all':!![]}];}return db[_0x755d('0x72')][_0x755d('0x5a')](_0x4d57ee);})['then'](function(_0x4c1835){_0x903fe0[_0x755d('0x5b')]=_0x4c1835;return _0x903fe0;});}})[_0x755d('0x28')](respondWithFilteredResult(_0x36b6e1,_0x4d57ee))[_0x755d('0x32')](handleError(_0x36b6e1,null));};exports[_0x755d('0x74')]=function(_0x5a9f30,_0x73a470,_0x302dc5){return db[_0x755d('0x46')][_0x755d('0x5f')]({'where':{'id':_0x5a9f30[_0x755d('0x5d')]['id']}})[_0x755d('0x28')](handleEntityNotFound(_0x73a470,null))[_0x755d('0x28')](function(_0x3c3f1c){if(_0x3c3f1c){return _0x3c3f1c[_0x755d('0x74')](_0x5a9f30[_0x755d('0x4c')][_0x755d('0x71')]);}})['then'](respondWithStatusCode(_0x73a470,null))['catch'](handleError(_0x73a470,null));};exports[_0x755d('0x75')]=function(_0x11b0b9,_0x2b46de,_0x2b6d5a){return db['WhatsappAccount']['find']({'where':{'id':_0x11b0b9[_0x755d('0x5d')]['id']}})[_0x755d('0x28')](handleEntityNotFound(_0x2b46de,null))[_0x755d('0x28')](function(_0x18a378){if(_0x18a378){return _0x18a378[_0x755d('0x75')](_0x11b0b9[_0x755d('0x60')][_0x755d('0x71')],_[_0x755d('0x76')](_0x11b0b9[_0x755d('0x60')],['ids','id'])||{})['spread'](function(_0xbe757d){for(var _0x37e32=0x0;_0x37e32<_0x11b0b9['body']['ids']['length'];_0x37e32+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x11b0b9[_0x755d('0x60')][_0x755d('0x71')][_0x37e32]),'WhatsappAccountId':Number(_0x11b0b9[_0x755d('0x5d')]['id'])});}return _0xbe757d;});}})['then'](respondWithResult(_0x2b46de,null))[_0x755d('0x32')](handleError(_0x2b46de,null));};exports[_0x755d('0x77')]=function(_0xdd859f,_0x5a2839,_0x38bd0d){return db[_0x755d('0x46')]['find']({'where':{'id':_0xdd859f[_0x755d('0x5d')]['id']}})[_0x755d('0x28')](handleEntityNotFound(_0x5a2839,null))[_0x755d('0x28')](function(_0x56efd5){if(_0x56efd5){return _0x56efd5['removeAgents'](_0xdd859f['query'][_0x755d('0x71')])[_0x755d('0x28')](function(){if(_[_0x755d('0x78')](_0xdd859f['query'][_0x755d('0x71')])){for(var _0x20e17f=0x0;_0x20e17f<_0xdd859f[_0x755d('0x4c')][_0x755d('0x71')]['length'];_0x20e17f+=0x1){socket[_0x755d('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0xdd859f[_0x755d('0x4c')][_0x755d('0x71')][_0x20e17f]),'WhatsappAccountId':Number(_0xdd859f[_0x755d('0x5d')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0xdd859f['query'][_0x755d('0x71')]),'WhatsappAccountId':Number(_0xdd859f[_0x755d('0x5d')]['id'])});}});}})[_0x755d('0x28')](respondWithStatusCode(_0x5a2839,null))[_0x755d('0x32')](handleError(_0x5a2839,null));};exports[_0x755d('0x7a')]=function(_0x38d3b8,_0x352319,_0x2e7731){var _0x17a9e2={};var _0x3a0199={};var _0x119a05;var _0x43bd20;return db[_0x755d('0x46')][_0x755d('0x6d')]({'where':{'id':_0x38d3b8[_0x755d('0x5d')]['id']}})[_0x755d('0x28')](handleEntityNotFound(_0x352319,null))['then'](function(_0x29412e){if(_0x29412e){_0x119a05=_0x29412e;_0x3a0199['model']=_['keys'](db[_0x755d('0x7b')]['rawAttributes']);_0x3a0199[_0x755d('0x4c')]=_[_0x755d('0x4b')](_0x38d3b8[_0x755d('0x4c')]);_0x3a0199[_0x755d('0x4d')]=_[_0x755d('0x4e')](_0x3a0199[_0x755d('0x4a')],_0x3a0199['query']);_0x17a9e2[_0x755d('0x4f')]=_[_0x755d('0x4e')](_0x3a0199[_0x755d('0x4a')],qs[_0x755d('0x50')](_0x38d3b8[_0x755d('0x4c')][_0x755d('0x50')]));_0x17a9e2[_0x755d('0x4f')]=_0x17a9e2['attributes'][_0x755d('0x51')]?_0x17a9e2['attributes']:_0x3a0199[_0x755d('0x4a')];_0x17a9e2[_0x755d('0x53')]=qs[_0x755d('0x6f')](_0x38d3b8[_0x755d('0x4c')][_0x755d('0x6f')]);_0x17a9e2[_0x755d('0x54')]=qs[_0x755d('0x4d')](_['pick'](_0x38d3b8['query'],_0x3a0199[_0x755d('0x4d')]));if(_0x38d3b8['query'][_0x755d('0x56')]){_0x17a9e2['where']=_[_0x755d('0x57')](_0x17a9e2[_0x755d('0x54')],{'$or':_[_0x755d('0x45')](_0x17a9e2[_0x755d('0x4f')],function(_0x506fbe){var _0x3ca52b={};_0x3ca52b[_0x506fbe]={'$like':'%'+_0x38d3b8['query'][_0x755d('0x56')]+'%'};return _0x3ca52b;})});}_0x17a9e2=_['merge']({},_0x17a9e2,_0x38d3b8[_0x755d('0x58')]);return _0x119a05[_0x755d('0x7a')](_0x17a9e2);}})[_0x755d('0x28')](function(_0x206aaf){if(_0x206aaf){_0x43bd20=_0x206aaf[_0x755d('0x51')];if(!_0x38d3b8[_0x755d('0x4c')][_0x755d('0x6e')](_0x755d('0x52'))){_0x17a9e2[_0x755d('0x39')]=qs['limit'](_0x38d3b8[_0x755d('0x4c')]['limit']);_0x17a9e2[_0x755d('0x36')]=qs[_0x755d('0x36')](_0x38d3b8[_0x755d('0x4c')][_0x755d('0x36')]);}return _0x119a05['getAgents'](_0x17a9e2);}})['then'](function(_0xf44c59){if(_0xf44c59){return _0xf44c59?{'count':_0x43bd20,'rows':_0xf44c59}:null;}})[_0x755d('0x28')](respondWithResult(_0x352319,null))[_0x755d('0x32')](handleError(_0x352319,null));};exports[_0x755d('0x7c')]=function(_0x7a84a9,_0x3f1224){var _0x22b819=_0x7a84a9[_0x755d('0x5d')]['id'];var _0x357dfa=_0x7a84a9[_0x755d('0x60')];var _0x27fc7a=0xc8;var _0x24fc42=null;return db[_0x755d('0x7d')]['transaction']({'isolationLevel':db[_0x755d('0x7d')][_0x755d('0x7e')][_0x755d('0x7f')][_0x755d('0x80')]},function(_0x1e141a){return db[_0x755d('0x46')][_0x755d('0x6d')]({'where':{'id':_0x22b819},'transaction':_0x1e141a})[_0x755d('0x28')](function(_0x4dfcf3){if(_0x4dfcf3){return db[_0x755d('0x81')][_0x755d('0x3d')]({'where':{'WhatsappAccountId':_0x22b819},'transaction':_0x1e141a})[_0x755d('0x28')](function(){var _0x107784=_[_0x755d('0x45')](_0x357dfa,function(_0x9d7a51){_0x9d7a51[_0x755d('0x69')]=_0x22b819;return _0x9d7a51;});return db[_0x755d('0x81')][_0x755d('0x82')](_0x107784,{'transaction':_0x1e141a});});}else{_0x27fc7a=0x194;_0x24fc42=[];}});})[_0x755d('0x28')](function(){if(_0x27fc7a!==0x194){return db[_0x755d('0x81')][_0x755d('0x83')]({'where':{'WhatsappAccountId':_0x22b819},'order':_0x755d('0x84')})[_0x755d('0x28')](function(_0x350f8d){_0x24fc42=_0x350f8d;});}})[_0x755d('0x32')](function(_0x3a85cb){_0x27fc7a=0x1f4;logger[_0x755d('0x2f')](_0x3a85cb['stack']);if(_0x3a85cb['name']){delete _0x3a85cb['name'];}_0x24fc42=_0x3a85cb;})['finally'](function(){if(_0x24fc42===null){_0x3f1224[_0x755d('0x40')](_0x27fc7a);}else{if(_0x27fc7a===0x1f4){_0x3f1224['status'](_0x27fc7a)['send'](_0x24fc42);}else{_0x3f1224[_0x755d('0x33')](_0x27fc7a)[_0x755d('0x35')](_0x24fc42);}}});};exports['getApplications']=function(_0x58ad7d,_0x26644f,_0x3260c2){var _0x254864={};var _0xd1b533={};var _0x7b0ab4;var _0x148f83;return db['WhatsappAccount'][_0x755d('0x6d')]({'where':{'id':_0x58ad7d[_0x755d('0x5d')]['id']}})[_0x755d('0x28')](handleEntityNotFound(_0x26644f,null))['then'](function(_0x163f5a){if(_0x163f5a){_0x7b0ab4=_0x163f5a;_0xd1b533[_0x755d('0x4a')]=_[_0x755d('0x4b')](db['WhatsappApplication']['rawAttributes']);_0xd1b533[_0x755d('0x4c')]=_[_0x755d('0x4b')](_0x58ad7d['query']);_0xd1b533[_0x755d('0x4d')]=_[_0x755d('0x4e')](_0xd1b533[_0x755d('0x4a')],_0xd1b533[_0x755d('0x4c')]);_0x254864['attributes']=_[_0x755d('0x4e')](_0xd1b533[_0x755d('0x4a')],qs[_0x755d('0x50')](_0x58ad7d['query'][_0x755d('0x50')]));_0x254864[_0x755d('0x4f')]=_0x254864[_0x755d('0x4f')][_0x755d('0x51')]?_0x254864[_0x755d('0x4f')]:_0xd1b533[_0x755d('0x4a')];_0x254864[_0x755d('0x53')]=qs[_0x755d('0x6f')](_0x58ad7d[_0x755d('0x4c')][_0x755d('0x6f')]);_0x254864[_0x755d('0x54')]=qs['filters'](_[_0x755d('0x55')](_0x58ad7d[_0x755d('0x4c')],_0xd1b533[_0x755d('0x4d')]));if(_0x58ad7d[_0x755d('0x4c')][_0x755d('0x56')]){_0x254864[_0x755d('0x54')]=_['merge'](_0x254864[_0x755d('0x54')],{'$or':_[_0x755d('0x45')](_0x254864['attributes'],function(_0xb4ecca){var _0x233080={};_0x233080[_0xb4ecca]={'$like':'%'+_0x58ad7d[_0x755d('0x4c')][_0x755d('0x56')]+'%'};return _0x233080;})});}_0x254864=_['merge']({},_0x254864,_0x58ad7d[_0x755d('0x58')]);return _0x7b0ab4[_0x755d('0x85')](_0x254864);}})[_0x755d('0x28')](function(_0x25796d){if(_0x25796d){_0x148f83=_0x25796d['length'];if(!_0x58ad7d[_0x755d('0x4c')]['hasOwnProperty'](_0x755d('0x52'))){_0x254864[_0x755d('0x39')]=qs[_0x755d('0x39')](_0x58ad7d[_0x755d('0x4c')][_0x755d('0x39')]);_0x254864[_0x755d('0x36')]=qs[_0x755d('0x36')](_0x58ad7d['query']['offset']);}return _0x7b0ab4[_0x755d('0x85')](_0x254864);}})[_0x755d('0x28')](function(_0x277ced){if(_0x277ced){return _0x277ced?{'count':_0x148f83,'rows':_0x277ced}:null;}})[_0x755d('0x28')](respondWithResult(_0x26644f,null))[_0x755d('0x32')](handleError(_0x26644f,null));};exports[_0x755d('0x86')]=function(_0x48eef8,_0x53e5b7,_0x4c0bc7){var _0x578890={'channel':_0x755d('0x87')};var _0x24bf91=[];var _0x2fe795=[];var _0x4a2795={};return db[_0x755d('0x46')][_0x755d('0x5f')]({'where':{'id':_0x48eef8[_0x755d('0x5d')]['id']},'include':[{'model':db[_0x755d('0x81')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x53e5b7,null))[_0x755d('0x28')](function(_0x22970e){_0x578890['account']=_0x22970e;if(_0x578890['account']&&_0x578890[_0x755d('0x88')][_0x755d('0x49')]===_0x755d('0x89')&&_0x48eef8['body'][_0x755d('0x8a')]){if(_0x48eef8[_0x755d('0x60')][_0x755d('0x8a')][_0x755d('0x51')]===0x0)return;if(_0x48eef8[_0x755d('0x60')][_0x755d('0x8a')][0x0][_0x755d('0x8b')]!=='read')return;return db[_0x755d('0x8c')][_0x755d('0x8d')]({'read':!![],'readAt':_0x48eef8[_0x755d('0x60')]['statuses'][0x0][_0x755d('0x8e')]},{'where':{'messageId':_0x48eef8['body'][_0x755d('0x8a')][0x0][_0x755d('0x8f')]},'individualHooks':!![]})[_0x755d('0x28')](function(_0x2357f5){return _0x53e5b7[_0x755d('0x33')](0xc8)['json'](_0x2357f5);});}_0x578890[_0x755d('0x90')]=_[_0x755d('0x91')](_0x22970e[_0x755d('0x92')],[_0x755d('0x84')],[_0x755d('0x93')]);if(_0x578890[_0x755d('0x88')][_0x755d('0x92')]){delete _0x578890['account'][_0x755d('0x92')];}return db['CmContact'][_0x755d('0x68')]()[_0x755d('0x28')](function(_0x4ecea0){if(!_0x4ecea0){throw new db[(_0x755d('0x94'))]['ValidationError'](_0x755d('0x95'));}_0x24bf91=_[_0x755d('0x96')](_[_0x755d('0x4b')](_0x4ecea0),[_0x755d('0x97'),_0x755d('0x98')]);_0x2fe795=_[_0x755d('0x96')](_['keys'](_0x4ecea0),[_0x755d('0x97'),_0x755d('0x98'),_0x755d('0x99'),_0x755d('0x9a')]);_0x578890[_0x755d('0x60')]={'mapKey':_0x755d('0x9b')};if(_0x578890[_0x755d('0x88')]&&_0x578890[_0x755d('0x88')][_0x755d('0x49')]===_0x755d('0x9c')){_0x578890['body']['from']=_0x48eef8['body'][_0x755d('0x9d')][_0x755d('0x9e')]('whatsapp:','');_0x578890[_0x755d('0x60')][_0x755d('0x60')]=_0x48eef8[_0x755d('0x60')][_0x755d('0x9f')];_0x578890[_0x755d('0x60')][_0x755d('0xa0')]=_0x48eef8[_0x755d('0x60')][_0x755d('0xa1')];}if(_0x578890[_0x755d('0x88')]&&_0x578890[_0x755d('0x88')]['type']==='sinch'){_0x578890[_0x755d('0x60')][_0x755d('0xa2')]=_0x48eef8[_0x755d('0x60')][_0x755d('0xa3')][0x0][_0x755d('0xa2')];_0x578890['body'][_0x755d('0x60')]=_0x48eef8[_0x755d('0x60')][_0x755d('0xa3')][0x0][_0x755d('0x31')]['body'];_0x578890[_0x755d('0x60')][_0x755d('0xa0')]=_0x48eef8[_0x755d('0x60')][_0x755d('0xa3')][0x0][_0x755d('0x8f')];}if(_0x578890['body']['id']){delete _0x578890['body']['id'];}if(_[_0x755d('0xa4')](_0x578890[_0x755d('0x60')][_0x755d('0xa2')])){throw new db['Sequelize'][(_0x755d('0xa5'))]('from\x20is\x20mandatory');}if(_[_0x755d('0xa4')](_0x578890['body']['body'])||_0x578890[_0x755d('0x60')][_0x755d('0x60')]===''){throw new db[(_0x755d('0x94'))][(_0x755d('0xa5'))](_0x755d('0xa6'));}if(_[_0x755d('0xa4')](_0x578890['body'][_0x755d('0xa7')])){throw new db[(_0x755d('0x94'))][(_0x755d('0xa5'))](_0x755d('0xa8')+_0x2fe795);}if(!_[_0x755d('0xa9')](_0x2fe795,_0x578890[_0x755d('0x60')][_0x755d('0xa7')])){throw new db[(_0x755d('0x94'))]['ValidationError'](_0x755d('0xaa')+_0x2fe795);}_0x4a2795[_0x578890[_0x755d('0x60')][_0x755d('0xa7')]]=_0x578890[_0x755d('0x60')][_0x755d('0xa2')];return db[_0x755d('0xab')][_0x755d('0x5f')]({'where':{'id':_0x578890[_0x755d('0x88')][_0x755d('0x9a')]},'include':[{'model':db[_0x755d('0xac')],'as':'Contacts','where':_0x4a2795,'limit':0x1,'order':[[_0x755d('0x98'),_0x755d('0xad')]]}]});})[_0x755d('0x28')](handleEntityNotFound(_0x53e5b7,null))[_0x755d('0x28')](function(_0x59a37e){if(_0x59a37e){_0x578890[_0x755d('0xae')]=_[_0x755d('0x76')](_0x59a37e,[_0x755d('0xaf')]);if(_0x59a37e['Contacts'][_0x755d('0x51')]){return _0x59a37e[_0x755d('0xaf')][0x0];}var _0x192d40=_[_0x755d('0x1f')](_0x578890['body'],{'firstName':_0x578890[_0x755d('0x60')][_0x755d('0xa2')],'ListId':_0x59a37e['id']});_0x192d40[_0x578890['body']['mapKey']]=_0x578890[_0x755d('0x60')][_0x755d('0xa2')];return db[_0x755d('0xac')][_0x755d('0x6b')](_0x192d40,{'fields':_0x24bf91,'raw':!![]});}})[_0x755d('0x28')](handleEntityNotFound(_0x53e5b7,null))[_0x755d('0x28')](function(_0x3e154d){if(_0x3e154d){_0x578890['contact']=_0x3e154d;var _0x163d6b={'ContactId':_0x3e154d['id'],'phone':_0x578890[_0x755d('0x60')][_0x755d('0xa2')],'WhatsappAccountId':_0x48eef8[_0x755d('0x5d')]['id']};var _0x4ce80b={'ContactId':_0x3e154d['id'],'WhatsappAccountId':_0x48eef8[_0x755d('0x5d')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x755d('0x5f')]({'where':_0x4ce80b})[_0x755d('0x28')](function(_0x289eeb){if(_0x289eeb){return[_0x289eeb,![]];}return db[_0x755d('0xb0')][_0x755d('0x6b')](_0x163d6b)[_0x755d('0x28')](function(_0x4683dc){return[_0x4683dc,!![]];});});}})[_0x755d('0xb1')](function(_0x17dd17,_0x569145){_0x578890[_0x755d('0xb2')]=_0x17dd17[_0x755d('0x62')]({'plain':!![]});_0x578890[_0x755d('0xb2')][_0x755d('0xb3')]=![];if(_0x569145){if(_0x578890[_0x755d('0x88')][_0x755d('0xb4')]){_0x578890[_0x755d('0x90')][_0x755d('0xb5')]({'id':0x0,'priority':_0x578890[_0x755d('0x90')]['length']+0x1,'app':_0x755d('0xb6'),'appdata':_0x755d('0xb7'),'interval':_0x755d('0xb8')});}_0x578890['interaction'][_0x755d('0xb3')]=!![];}return db[_0x755d('0x8c')]['create']({'phone':_0x578890['body']['from'],'messageId':_0x578890[_0x755d('0x60')][_0x755d('0xa0')],'body':_0x578890['body'][_0x755d('0x60')],'WhatsappAccountId':_0x48eef8[_0x755d('0x5d')]['id'],'WhatsappInteractionId':_0x17dd17['id'],'direction':'in','ContactId':_0x17dd17[_0x755d('0xb9')],'AttachmentId':_0x578890[_0x755d('0x60')][_0x755d('0xba')]});})['then'](function(_0x3c74ab){_0x578890[_0x755d('0x31')]=_0x3c74ab;if(_0x578890[_0x755d('0xb2')]['UserId']){return db[_0x755d('0x7b')][_0x755d('0x5f')]({'attributes':['id',_0x755d('0x42')],'where':{'id':_0x578890[_0x755d('0xb2')][_0x755d('0xbb')]}})[_0x755d('0x28')](function(_0x242599){if(_0x242599){_0x578890[_0x755d('0x90')]['unshift']({'id':0x0,'priority':0x0,'app':_0x755d('0xbc'),'appdata':_0x242599[_0x755d('0x42')]+','+(_0x578890[_0x755d('0x88')][_0x755d('0xbd')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x755d('0xbe'),_0x578890);});}return respondWithRpcPromise('Start',_0x755d('0xbe'),_0x578890);})[_0x755d('0x28')](function(_0x112bec){if(_0x112bec){var _0x2c6f5d=0xc8;var _0x4b5f96=_0x755d('0xbf');logger['info'](_0x755d('0x2d'),_0x4b5f96,_0x2c6f5d,_0x755d('0xc0'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4b5f96,_0x2c6f5d,_0x755d('0xc0'),JSON[_0x755d('0x2e')](_0x112bec));if(_0x578890[_0x755d('0x88')][_0x755d('0x49')]===_0x755d('0x9c')){return _0x53e5b7['status'](_0x2c6f5d)[_0x755d('0xc1')]('Content-Type',_0x755d('0xc2'))[_0x755d('0xc3')]('\x0a');}else{return _0x53e5b7[_0x755d('0x33')](_0x2c6f5d)['json'](_0x112bec);}}});})[_0x755d('0x32')](handleError(_0x53e5b7,null));};exports[_0x755d('0xc3')]=function(_0x3fcb26,_0x45bcf4,_0x30c259){var _0x37a351,_0x5124c0,_0x2b069d;if(_[_0x755d('0xa4')](_0x3fcb26[_0x755d('0x60')][_0x755d('0x60')])||_0x3fcb26['body']['body']===''){throw new db[(_0x755d('0x94'))]['ValidationError'](_0x755d('0xa6'));}if(_[_0x755d('0xa4')](_0x3fcb26[_0x755d('0x60')]['to'])){throw new db[(_0x755d('0x94'))][(_0x755d('0xa5'))](_0x755d('0xc4'));}_0x37a351=_0x3fcb26[_0x755d('0x60')]['to'];return db[_0x755d('0x46')][_0x755d('0x5f')]({'where':{'id':_0x3fcb26[_0x755d('0x5d')]['id']},'include':[{'model':db[_0x755d('0xab')],'as':_0x755d('0xc5'),'include':[{'model':db[_0x755d('0xac')],'as':'Contacts','where':{'mobile':_0x37a351},'limit':0x1,'order':[[_0x755d('0x98'),_0x755d('0xad')]]}]}]})['then'](handleEntityNotFound(_0x45bcf4,null))['then'](function(_0x211011){if(_0x211011&&_0x211011[_0x755d('0xc5')]){_0x5124c0=_0x211011[_0x755d('0x62')]({'plain':!![]});if(_0x5124c0['List']&&_0x5124c0['List'][_0x755d('0xaf')]['length']){return _0x5124c0[_0x755d('0xc5')][_0x755d('0xaf')][0x0];}return db[_0x755d('0xac')][_0x755d('0x6b')](_[_0x755d('0x1f')](_0x3fcb26['body'],{'firstName':_0x37a351,'mobile':_0x37a351,'phone':_0x37a351,'ListId':_0x5124c0[_0x755d('0x9a')]}));}})[_0x755d('0x28')](handleEntityNotFound(_0x45bcf4,null))[_0x755d('0x28')](function(_0x15b06c){if(_0x15b06c){_0x2b069d=_0x15b06c;return db['WhatsappInteraction'][_0x755d('0x5f')]({'where':{'ContactId':_0x2b069d['id'],'closed':![],'WhatsappAccountId':_0x5124c0['id']}})['then'](function(_0x27ff14){if(_0x27ff14){return[_0x27ff14,![]];}return db[_0x755d('0xb0')]['create']({'UserId':_0x3fcb26[_0x755d('0x61')]['id'],'ContactId':_0x2b069d['id'],'WhatsappAccountId':_0x5124c0['id'],'phone':_0x37a351,'firstMsgDirection':_0x755d('0xc6'),'Messages':[_[_0x755d('0x57')](_0x3fcb26['body'],{'read':![],'body':_0x3fcb26[_0x755d('0x60')][_0x755d('0x60')],'phone':_0x37a351,'WhatsappAccountId':_0x5124c0['id'],'UserId':_0x3fcb26[_0x755d('0x61')]['id'],'ContactId':_0x2b069d['id']})]},{'include':[{'model':db[_0x755d('0x8c')],'as':_0x755d('0xc7')}]})[_0x755d('0x28')](function(_0x55614e){return[_0x55614e,!![]];});});}})[_0x755d('0xb1')](function(_0x36ef3f,_0x5132d6){if(_0x5132d6){return _0x36ef3f;}return db[_0x755d('0x8c')][_0x755d('0x6b')](_[_0x755d('0x57')](_0x3fcb26[_0x755d('0x60')],{'read':![],'body':_0x3fcb26[_0x755d('0x60')]['body'],'phone':_0x37a351,'WhatsappAccountId':_0x5124c0['id'],'WhatsappInteractionId':_0x36ef3f['id'],'UserId':_0x3fcb26[_0x755d('0x61')]['id'],'ContactId':_0x2b069d['id']}))[_0x755d('0x28')](function(_0x556c59){_0x36ef3f['dataValues'][_0x755d('0xc7')]=[];_0x36ef3f[_0x755d('0xc8')]['Messages'][_0x755d('0xb5')](_0x556c59[_0x755d('0xc8')]);return _0x36ef3f;});})['then'](respondWithResult(_0x45bcf4,null))[_0x755d('0x32')](handleError(_0x45bcf4,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index ad962c7..6cbd0f1 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 _0x790b=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x879177,_0x55a48e){var _0x1f737a=function(_0x5ba11a){while(--_0x5ba11a){_0x879177['push'](_0x879177['shift']());}};_0x1f737a(++_0x55a48e);}(_0x790b,0x70));var _0xb790=function(_0x2cf986,_0x54bbea){_0x2cf986=_0x2cf986-0x0;var _0x20e954=_0x790b[_0x2cf986];return _0x20e954;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xb790('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb790('0x1')](0x0);var events={'afterCreate':_0xb790('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b481a){return function(_0x292fbe,_0x599fdf,_0xda25e8){WhatsappAccountEvents[_0xb790('0x3')](_0x1b481a+':'+_0x292fbe['id'],_0x292fbe);WhatsappAccountEvents[_0xb790('0x3')](_0x1b481a,_0x292fbe);_0xda25e8(null);};}for(var e in events){if(events[_0xb790('0x4')](e)){var event=events[e];WhatsappAccount[_0xb790('0x5')](e,emitEvent(event));}}module[_0xb790('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0xd85b=['../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4a6979,_0x5f3d1a){var _0x226f93=function(_0x471572){while(--_0x471572){_0x4a6979['push'](_0x4a6979['shift']());}};_0x226f93(++_0x5f3d1a);}(_0xd85b,0x88));var _0xbd85=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd85b[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xbd85('0x0'))['db'][_0xbd85('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd85('0x2'),'afterUpdate':_0xbd85('0x3'),'afterDestroy':_0xbd85('0x4')};function emitEvent(_0x558f72){return function(_0x184951,_0xe9c821,_0xf3d90b){WhatsappAccountEvents[_0xbd85('0x5')](_0x558f72+':'+_0x184951['id'],_0x184951);WhatsappAccountEvents[_0xbd85('0x5')](_0x558f72,_0x184951);_0xf3d90b(null);};}for(var e in events){if(events[_0xbd85('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xbd85('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 105261f..d9d3cac 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 _0x4828=['whatsapp_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount'];(function(_0x18e7e5,_0x5ad463){var _0x30c78a=function(_0x473e33){while(--_0x473e33){_0x18e7e5['push'](_0x18e7e5['shift']());}};_0x30c78a(++_0x5ad463);}(_0x4828,0x91));var _0x8482=function(_0x587f3a,_0x160bad){_0x587f3a=_0x587f3a-0x0;var _0x4fead2=_0x4828[_0x587f3a];return _0x4fead2;};'use strict';var _=require(_0x8482('0x0'));var util=require(_0x8482('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8482('0x2'));var BPromise=require(_0x8482('0x3'));var rp=require(_0x8482('0x4'));var fs=require('fs');var path=require(_0x8482('0x5'));var rimraf=require(_0x8482('0x6'));var config=require('../../config/environment');var attributes=require(_0x8482('0x7'));module[_0x8482('0x8')]=function(_0x5080bf,_0xa0d35d){return _0x5080bf[_0x8482('0x9')](_0x8482('0xa'),attributes,{'tableName':_0x8482('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2b3=['WhatsappAccount','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0xe2b3,0x187));var _0x3e2b=function(_0x5f32b4,_0x29f00a){_0x5f32b4=_0x5f32b4-0x0;var _0xc71ce6=_0xe2b3[_0x5f32b4];return _0xc71ce6;};'use strict';var _=require(_0x3e2b('0x0'));var util=require(_0x3e2b('0x1'));var logger=require('../../config/logger')(_0x3e2b('0x2'));var moment=require(_0x3e2b('0x3'));var BPromise=require(_0x3e2b('0x4'));var rp=require(_0x3e2b('0x5'));var fs=require('fs');var path=require(_0x3e2b('0x6'));var rimraf=require(_0x3e2b('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x3e2b('0x8')]=function(_0x4b6e16,_0x264461){return _0x4b6e16['define'](_0x3e2b('0x9'),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 a6d6253..44047d8 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 _0xf0c3=['model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map'];(function(_0x343bd9,_0x546514){var _0x3345e=function(_0x4aa917){while(--_0x4aa917){_0x343bd9['push'](_0x343bd9['shift']());}};_0x3345e(++_0x546514);}(_0xf0c3,0x104));var _0x3f0c=function(_0x283d91,_0x42bb77){_0x283d91=_0x283d91-0x0;var _0x7d21de=_0xf0c3[_0x283d91];return _0x7d21de;};'use strict';var _=require(_0x3f0c('0x0'));var util=require(_0x3f0c('0x1'));var moment=require('moment');var BPromise=require(_0x3f0c('0x2'));var rs=require(_0x3f0c('0x3'));var fs=require('fs');var Redis=require(_0x3f0c('0x4'));var db=require(_0x3f0c('0x5'))['db'];var utils=require(_0x3f0c('0x6'));var logger=require(_0x3f0c('0x7'))(_0x3f0c('0x8'));var config=require(_0x3f0c('0x9'));var jayson=require(_0x3f0c('0xa'));var client=jayson[_0x3f0c('0xb')]['http']({'port':0x232a});config[_0x3f0c('0xc')]=_[_0x3f0c('0xd')](config['redis'],{'host':_0x3f0c('0xe'),'port':0x18eb});var socket=require(_0x3f0c('0xf'))(new Redis(config[_0x3f0c('0xc')]));require(_0x3f0c('0x10'))[_0x3f0c('0x11')](socket);function respondWithRpcPromise(_0x17b594,_0x5d00d2,_0x54e770){return new BPromise(function(_0x184d7e,_0x34028c){return client[_0x3f0c('0x12')](_0x17b594,_0x54e770)[_0x3f0c('0x13')](function(_0x46bf3c){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5d00d2,_0x3f0c('0x14'));logger['debug'](_0x3f0c('0x15'),_0x5d00d2,_0x3f0c('0x14'),JSON['stringify'](_0x46bf3c));if(_0x46bf3c[_0x3f0c('0x16')]){if(_0x46bf3c[_0x3f0c('0x16')]['code']===0x1f4){logger[_0x3f0c('0x16')](_0x3f0c('0x17'),_0x5d00d2,_0x46bf3c[_0x3f0c('0x16')][_0x3f0c('0x18')]);return _0x34028c(_0x46bf3c[_0x3f0c('0x16')][_0x3f0c('0x18')]);}logger[_0x3f0c('0x16')](_0x3f0c('0x17'),_0x5d00d2,_0x46bf3c['error'][_0x3f0c('0x18')]);return _0x184d7e(_0x46bf3c['error'][_0x3f0c('0x18')]);}else{logger[_0x3f0c('0x19')](_0x3f0c('0x17'),_0x5d00d2,_0x3f0c('0x14'));_0x184d7e(_0x46bf3c[_0x3f0c('0x1a')][_0x3f0c('0x18')]);}})[_0x3f0c('0x1b')](function(_0x22cf07){logger[_0x3f0c('0x16')](_0x3f0c('0x17'),_0x5d00d2,_0x22cf07);_0x34028c(_0x22cf07);});});}exports[_0x3f0c('0x1c')]=function(_0x50d15e){var _0x175620=this;return new Promise(function(_0x302aeb,_0xca5a95){return db[_0x3f0c('0x1d')][_0x3f0c('0x1e')]({'raw':_0x50d15e['options']?_0x50d15e[_0x3f0c('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x50d15e[_0x3f0c('0x1f')]?_0x50d15e[_0x3f0c('0x1f')][_0x3f0c('0x20')]||null:null,'attributes':_0x50d15e['options']?_0x50d15e[_0x3f0c('0x1f')][_0x3f0c('0x21')]||null:null,'include':_0x50d15e[_0x3f0c('0x1f')]?_0x50d15e['options'][_0x3f0c('0x22')]?_[_0x3f0c('0x23')](_0x50d15e[_0x3f0c('0x1f')][_0x3f0c('0x22')],function(_0x4dca78){return{'model':db[_0x4dca78[_0x3f0c('0x24')]],'as':_0x4dca78['as'],'attributes':_0x4dca78['attributes'],'include':_0x4dca78[_0x3f0c('0x22')]?_[_0x3f0c('0x23')](_0x4dca78[_0x3f0c('0x22')],function(_0x258c45){return{'model':db[_0x258c45[_0x3f0c('0x24')]],'as':_0x258c45['as'],'attributes':_0x258c45[_0x3f0c('0x21')],'include':_0x258c45[_0x3f0c('0x22')]?_[_0x3f0c('0x23')](_0x258c45[_0x3f0c('0x22')],function(_0x433b40){return{'model':db[_0x433b40[_0x3f0c('0x24')]],'as':_0x433b40['as'],'attributes':_0x433b40[_0x3f0c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3f0c('0x13')](function(_0x1706aa){logger['info'](_0x3f0c('0x1c'),_0x50d15e);logger['debug'](_0x3f0c('0x1c'),_0x50d15e,JSON['stringify'](_0x1706aa));_0x302aeb(_0x1706aa);})['catch'](function(_0xc999e7){logger[_0x3f0c('0x16')](_0x3f0c('0x1c'),_0xc999e7[_0x3f0c('0x18')],_0x50d15e);_0xca5a95(_0x175620[_0x3f0c('0x16')](0x1f4,_0xc999e7[_0x3f0c('0x18')]));});});}; \ No newline at end of file +var _0xa2f8=['model','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map'];(function(_0x4a8619,_0x2bfa83){var _0x527a48=function(_0x59f232){while(--_0x59f232){_0x4a8619['push'](_0x4a8619['shift']());}};_0x527a48(++_0x2bfa83);}(_0xa2f8,0x71));var _0x8a2f=function(_0x5a1117,_0x118b64){_0x5a1117=_0x5a1117-0x0;var _0x546c7e=_0xa2f8[_0x5a1117];return _0x546c7e;};'use strict';var _=require(_0x8a2f('0x0'));var util=require(_0x8a2f('0x1'));var moment=require('moment');var BPromise=require(_0x8a2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a2f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a2f('0x4'));var logger=require(_0x8a2f('0x5'))(_0x8a2f('0x6'));var config=require(_0x8a2f('0x7'));var jayson=require(_0x8a2f('0x8'));var client=jayson[_0x8a2f('0x9')]['http']({'port':0x232a});config['redis']=_[_0x8a2f('0xa')](config[_0x8a2f('0xb')],{'host':_0x8a2f('0xc'),'port':0x18eb});var socket=require(_0x8a2f('0xd'))(new Redis(config[_0x8a2f('0xb')]));require('./whatsappAccount.socket')[_0x8a2f('0xe')](socket);function respondWithRpcPromise(_0x5c606d,_0x31ad9d,_0x28d04c){return new BPromise(function(_0x47bfa2,_0x3f96b8){return client[_0x8a2f('0xf')](_0x5c606d,_0x28d04c)[_0x8a2f('0x10')](function(_0x1237f2){logger['info'](_0x8a2f('0x11'),_0x31ad9d,'request\x20sent');logger[_0x8a2f('0x12')](_0x8a2f('0x13'),_0x31ad9d,_0x8a2f('0x14'),JSON['stringify'](_0x1237f2));if(_0x1237f2[_0x8a2f('0x15')]){if(_0x1237f2[_0x8a2f('0x15')][_0x8a2f('0x16')]===0x1f4){logger[_0x8a2f('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x31ad9d,_0x1237f2[_0x8a2f('0x15')][_0x8a2f('0x17')]);return _0x3f96b8(_0x1237f2['error']['message']);}logger['error'](_0x8a2f('0x11'),_0x31ad9d,_0x1237f2[_0x8a2f('0x15')][_0x8a2f('0x17')]);return _0x47bfa2(_0x1237f2[_0x8a2f('0x15')][_0x8a2f('0x17')]);}else{logger[_0x8a2f('0x18')](_0x8a2f('0x11'),_0x31ad9d,_0x8a2f('0x14'));_0x47bfa2(_0x1237f2[_0x8a2f('0x19')][_0x8a2f('0x17')]);}})['catch'](function(_0x258954){logger[_0x8a2f('0x15')](_0x8a2f('0x11'),_0x31ad9d,_0x258954);_0x3f96b8(_0x258954);});});}exports[_0x8a2f('0x1a')]=function(_0x2a49a5){var _0x304501=this;return new Promise(function(_0x59ee25,_0x31f843){return db[_0x8a2f('0x1b')][_0x8a2f('0x1c')]({'raw':_0x2a49a5['options']?_0x2a49a5[_0x8a2f('0x1d')][_0x8a2f('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a49a5[_0x8a2f('0x1d')]?_0x2a49a5[_0x8a2f('0x1d')][_0x8a2f('0x1f')]||null:null,'attributes':_0x2a49a5[_0x8a2f('0x1d')]?_0x2a49a5['options'][_0x8a2f('0x20')]||null:null,'include':_0x2a49a5[_0x8a2f('0x1d')]?_0x2a49a5[_0x8a2f('0x1d')]['include']?_['map'](_0x2a49a5[_0x8a2f('0x1d')][_0x8a2f('0x21')],function(_0x5578dd){return{'model':db[_0x5578dd['model']],'as':_0x5578dd['as'],'attributes':_0x5578dd['attributes'],'include':_0x5578dd[_0x8a2f('0x21')]?_[_0x8a2f('0x22')](_0x5578dd[_0x8a2f('0x21')],function(_0xdc7086){return{'model':db[_0xdc7086[_0x8a2f('0x23')]],'as':_0xdc7086['as'],'attributes':_0xdc7086[_0x8a2f('0x20')],'include':_0xdc7086[_0x8a2f('0x21')]?_[_0x8a2f('0x22')](_0xdc7086[_0x8a2f('0x21')],function(_0x2fe711){return{'model':db[_0x2fe711[_0x8a2f('0x23')]],'as':_0x2fe711['as'],'attributes':_0x2fe711['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a2f('0x10')](function(_0xde614a){logger['info'](_0x8a2f('0x1a'),_0x2a49a5);logger['debug'](_0x8a2f('0x1a'),_0x2a49a5,JSON['stringify'](_0xde614a));_0x59ee25(_0xde614a);})[_0x8a2f('0x24')](function(_0x146f83){logger[_0x8a2f('0x15')](_0x8a2f('0x1a'),_0x146f83[_0x8a2f('0x17')],_0x2a49a5);_0x31f843(_0x304501[_0x8a2f('0x15')](0x1f4,_0x146f83['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b4a8b7f..ff7e705 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 _0x2d4c=['./whatsappAccount.events','save','remove','update','emit','removeListener','whatsappAccount:'];(function(_0x146f9c,_0x43fa83){var _0x24d6b5=function(_0x14a8be){while(--_0x14a8be){_0x146f9c['push'](_0x146f9c['shift']());}};_0x24d6b5(++_0x43fa83);}(_0x2d4c,0x16c));var _0xc2d4=function(_0x162c59,_0x292e9d){_0x162c59=_0x162c59-0x0;var _0x5d812c=_0x2d4c[_0x162c59];return _0x5d812c;};'use strict';var WhatsappAccountEvents=require(_0xc2d4('0x0'));var events=[_0xc2d4('0x1'),_0xc2d4('0x2'),_0xc2d4('0x3')];function createListener(_0xaabc2c,_0x164453){return function(_0x3221ed){_0x164453[_0xc2d4('0x4')](_0xaabc2c,_0x3221ed);};}function removeListener(_0x46c7c1,_0x5a80ce){return function(){WhatsappAccountEvents[_0xc2d4('0x5')](_0x46c7c1,_0x5a80ce);};}exports['register']=function(_0x5ead4c){for(var _0x41b8ef=0x0,_0x1372f8=events['length'];_0x41b8ef<_0x1372f8;_0x41b8ef++){var _0x136d30=events[_0x41b8ef];var _0x8b98f0=createListener(_0xc2d4('0x6')+_0x136d30,_0x5ead4c);WhatsappAccountEvents['on'](_0x136d30,_0x8b98f0);}}; \ No newline at end of file +var _0x7c47=['./whatsappAccount.events','save','remove','update','length','whatsappAccount:'];(function(_0x154282,_0x43999e){var _0x303262=function(_0x2812dd){while(--_0x2812dd){_0x154282['push'](_0x154282['shift']());}};_0x303262(++_0x43999e);}(_0x7c47,0x1e0));var _0x77c4=function(_0x3194f6,_0x37dbfc){_0x3194f6=_0x3194f6-0x0;var _0x480e1c=_0x7c47[_0x3194f6];return _0x480e1c;};'use strict';var WhatsappAccountEvents=require(_0x77c4('0x0'));var events=[_0x77c4('0x1'),_0x77c4('0x2'),_0x77c4('0x3')];function createListener(_0x264558,_0x3f2e91){return function(_0x2bd109){_0x3f2e91['emit'](_0x264558,_0x2bd109);};}function removeListener(_0x2f6404,_0x728261){return function(){WhatsappAccountEvents['removeListener'](_0x2f6404,_0x728261);};}exports['register']=function(_0x24246b){for(var _0x365741=0x0,_0x28244a=events[_0x77c4('0x4')];_0x365741<_0x28244a;_0x365741++){var _0x1f4e35=events[_0x365741];var _0x10df07=createListener(_0x77c4('0x5')+_0x1f4e35,_0x24246b);WhatsappAccountEvents['on'](_0x1f4e35,_0x10df07);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index cd21b1d..0fdeae1 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 _0x1506=['/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','index','get'];(function(_0x249999,_0x288ff1){var _0x233078=function(_0x428d23){while(--_0x428d23){_0x249999['push'](_0x249999['shift']());}};_0x233078(++_0x288ff1);}(_0x1506,0x95));var _0x6150=function(_0x59dadc,_0x56896a){_0x59dadc=_0x59dadc-0x0;var _0xa26f74=_0x1506[_0x59dadc];return _0xa26f74;};'use strict';var multer=require('multer');var util=require(_0x6150('0x0'));var path=require(_0x6150('0x1'));var timeout=require(_0x6150('0x2'));var express=require(_0x6150('0x3'));var router=express[_0x6150('0x4')]();var fs_extra=require(_0x6150('0x5'));var auth=require(_0x6150('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6150('0x7'));var controller=require(_0x6150('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6150('0x9')]);router[_0x6150('0xa')](_0x6150('0xb'),auth['isAuthenticated'](),controller[_0x6150('0xc')]);router[_0x6150('0xd')]('/',auth[_0x6150('0xe')](),controller[_0x6150('0xf')]);router[_0x6150('0x10')](_0x6150('0xb'),auth[_0x6150('0xe')](),controller['update']);router[_0x6150('0x11')](_0x6150('0xb'),auth['isAuthenticated'](),controller[_0x6150('0x12')]);module[_0x6150('0x13')]=router; \ No newline at end of file +var _0x8e47=['post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','show'];(function(_0x499044,_0x1b0dd0){var _0x1d004b=function(_0xa4ca8f){while(--_0xa4ca8f){_0x499044['push'](_0x499044['shift']());}};_0x1d004b(++_0x1b0dd0);}(_0x8e47,0x1d2));var _0x78e4=function(_0x29d48f,_0x480c3d){_0x29d48f=_0x29d48f-0x0;var _0x5310f5=_0x8e47[_0x29d48f];return _0x5310f5;};'use strict';var multer=require(_0x78e4('0x0'));var util=require('util');var path=require(_0x78e4('0x1'));var timeout=require(_0x78e4('0x2'));var express=require(_0x78e4('0x3'));var router=express[_0x78e4('0x4')]();var fs_extra=require(_0x78e4('0x5'));var auth=require(_0x78e4('0x6'));var interaction=require(_0x78e4('0x7'));var config=require(_0x78e4('0x8'));var controller=require(_0x78e4('0x9'));router[_0x78e4('0xa')]('/',auth['isAuthenticated'](),controller[_0x78e4('0xb')]);router['get'](_0x78e4('0xc'),auth['isAuthenticated'](),controller[_0x78e4('0xd')]);router[_0x78e4('0xe')]('/',auth[_0x78e4('0xf')](),controller['create']);router[_0x78e4('0x10')](_0x78e4('0xc'),auth[_0x78e4('0xf')](),controller['update']);router[_0x78e4('0x11')](_0x78e4('0xc'),auth[_0x78e4('0xf')](),controller[_0x78e4('0x12')]);module[_0x78e4('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 79ba87e..838baa0 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 _0xbef9=['INTEGER','noop','STRING','*,*,*,*','sequelize','exports'];(function(_0x1e4510,_0x178584){var _0x1f4b75=function(_0x23ea58){while(--_0x23ea58){_0x1e4510['push'](_0x1e4510['shift']());}};_0x1f4b75(++_0x178584);}(_0xbef9,0xe8));var _0x9bef=function(_0x190800,_0x35fc4e){_0x190800=_0x190800-0x0;var _0x3d1d4f=_0xbef9[_0x190800];return _0x3d1d4f;};'use strict';var Sequelize=require(_0x9bef('0x0'));module[_0x9bef('0x1')]={'priority':{'type':Sequelize[_0x9bef('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9bef('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9bef('0x4')]},'interval':{'type':Sequelize[_0x9bef('0x4')],'defaultValue':_0x9bef('0x5')}}; \ No newline at end of file +var _0x4b27=['noop','TEXT','STRING'];(function(_0x1f8a7b,_0x375442){var _0x1794e3=function(_0x9b2907){while(--_0x9b2907){_0x1f8a7b['push'](_0x1f8a7b['shift']());}};_0x1794e3(++_0x375442);}(_0x4b27,0xc9));var _0x74b2=function(_0x25ffdf,_0x2ca7a7){_0x25ffdf=_0x25ffdf-0x0;var _0x33f595=_0x4b27[_0x25ffdf];return _0x33f595;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x74b2('0x0')},'appdata':{'type':Sequelize[_0x74b2('0x1')]()},'description':{'type':Sequelize[_0x74b2('0x2')]},'interval':{'type':Sequelize[_0x74b2('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index e8ba494..6ad1bf8 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 _0x47c5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','WhatsappApplication'];(function(_0x297913,_0x39132b){var _0x297c2f=function(_0x44592f){while(--_0x44592f){_0x297913['push'](_0x297913['shift']());}};_0x297c2f(++_0x39132b);}(_0x47c5,0x165));var _0x547c=function(_0x2dc367,_0x591c8a){_0x2dc367=_0x2dc367-0x0;var _0x14845a=_0x47c5[_0x2dc367];return _0x14845a;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':!![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['WhatsappApplication']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['WhatsappApplication'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['WhatsappApplication'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));}; \ No newline at end of file +var _0x7753=['stack','name','send','index','map','WhatsappApplication','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','show','params','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','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','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy'];(function(_0x43ec86,_0x3f7909){var _0x35933c=function(_0x4a4aa0){while(--_0x4a4aa0){_0x43ec86['push'](_0x43ec86['shift']());}};_0x35933c(++_0x3f7909);}(_0x7753,0xfd));var _0x3775=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0x7753[_0x484cac];return _0x1d6e77;};'use strict';var emlformat=require(_0x3775('0x0'));var rimraf=require(_0x3775('0x1'));var zipdir=require(_0x3775('0x2'));var jsonpatch=require(_0x3775('0x3'));var rp=require(_0x3775('0x4'));var moment=require('moment');var BPromise=require(_0x3775('0x5'));var Mustache=require(_0x3775('0x6'));var util=require(_0x3775('0x7'));var path=require('path');var sox=require(_0x3775('0x8'));var csv=require(_0x3775('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3775('0xa'));var _=require(_0x3775('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3775('0xc'));var deskjs=require(_0x3775('0xd'));var toCsv=require(_0x3775('0x9'));var querystring=require(_0x3775('0xe'));var Papa=require(_0x3775('0xf'));var Redis=require('ioredis');var authService=require(_0x3775('0x10'));var qs=require(_0x3775('0x11'));var as=require(_0x3775('0x12'));var hardwareService=require(_0x3775('0x13'));var logger=require(_0x3775('0x14'))(_0x3775('0x15'));var utils=require('../../config/utils');var config=require(_0x3775('0x16'));var licenseUtil=require(_0x3775('0x17'));var db=require(_0x3775('0x18'))['db'];function respondWithStatusCode(_0x5817f1,_0x59b8f0){_0x59b8f0=_0x59b8f0||0xcc;return function(_0x47e8f8){if(_0x47e8f8){return _0x5817f1['sendStatus'](_0x59b8f0);}return _0x5817f1[_0x3775('0x19')](_0x59b8f0)[_0x3775('0x1a')]();};}function respondWithResult(_0x14a183,_0x5ae266){_0x5ae266=_0x5ae266||0xc8;return function(_0x17ac2f){if(_0x17ac2f){return _0x14a183['status'](_0x5ae266)['json'](_0x17ac2f);}};}function respondWithFilteredResult(_0xaea735,_0x3d86fa){return function(_0xaea1ea){if(_0xaea1ea){var _0x3372f7=typeof _0x3d86fa[_0x3775('0x1b')]===_0x3775('0x1c')&&typeof _0x3d86fa[_0x3775('0x1d')]===_0x3775('0x1c');var _0x4edbee=_0xaea1ea[_0x3775('0x1e')];var _0x4a149d=_0x3372f7?0x0:_0x3d86fa[_0x3775('0x1b')];var _0x307a80=_0x3372f7?_0xaea1ea[_0x3775('0x1e')]:_0x3d86fa['offset']+_0x3d86fa[_0x3775('0x1d')];var _0x2a5cb0;if(_0x307a80>=_0x4edbee){_0x307a80=_0x4edbee;_0x2a5cb0=0xc8;}else{_0x2a5cb0=0xce;}_0xaea735[_0x3775('0x19')](_0x2a5cb0);return _0xaea735[_0x3775('0x1f')](_0x3775('0x20'),_0x4a149d+'-'+_0x307a80+'/'+_0x4edbee)[_0x3775('0x21')](_0xaea1ea);}return null;};}function patchUpdates(_0x4aa5b7){return function(_0x9d084e){try{jsonpatch[_0x3775('0x22')](_0x9d084e,_0x4aa5b7,!![]);}catch(_0x58263a){return BPromise[_0x3775('0x23')](_0x58263a);}return _0x9d084e[_0x3775('0x24')]();};}function saveUpdates(_0x176adb,_0x326ab9){return function(_0x58affa){if(_0x58affa){return _0x58affa['update'](_0x176adb)[_0x3775('0x25')](function(_0xd9d181){return _0xd9d181;});}return null;};}function removeEntity(_0x28bd8c,_0x57dbb1){return function(_0x5787fd){if(_0x5787fd){return _0x5787fd[_0x3775('0x26')]()[_0x3775('0x25')](function(){_0x28bd8c[_0x3775('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd6e1e3,_0x13d08d){return function(_0x38ba1c){if(!_0x38ba1c){_0xd6e1e3['sendStatus'](0x194);}return _0x38ba1c;};}function handleError(_0x815783,_0x5183c2){_0x5183c2=_0x5183c2||0x1f4;return function(_0x3bb405){logger['error'](_0x3bb405[_0x3775('0x27')]);if(_0x3bb405['name']){delete _0x3bb405[_0x3775('0x28')];}_0x815783[_0x3775('0x19')](_0x5183c2)[_0x3775('0x29')](_0x3bb405);};}exports[_0x3775('0x2a')]=function(_0x487529,_0xa102fa){var _0x351d2d={},_0x1361b0={},_0x12d95b={'count':0x0,'rows':[]};var _0x440af8=_[_0x3775('0x2b')](db[_0x3775('0x2c')][_0x3775('0x2d')],function(_0xa508b2){return{'name':_0xa508b2['fieldName'],'type':_0xa508b2['type'][_0x3775('0x2e')]};});_0x1361b0[_0x3775('0x2f')]=_[_0x3775('0x2b')](_0x440af8,_0x3775('0x28'));_0x1361b0[_0x3775('0x30')]=_[_0x3775('0x31')](_0x487529[_0x3775('0x30')]);_0x1361b0['filters']=_[_0x3775('0x32')](_0x1361b0['model'],_0x1361b0[_0x3775('0x30')]);_0x351d2d[_0x3775('0x33')]=_[_0x3775('0x32')](_0x1361b0[_0x3775('0x2f')],qs['fields'](_0x487529[_0x3775('0x30')][_0x3775('0x34')]));_0x351d2d[_0x3775('0x33')]=_0x351d2d[_0x3775('0x33')]['length']?_0x351d2d[_0x3775('0x33')]:_0x1361b0[_0x3775('0x2f')];if(!_0x487529[_0x3775('0x30')][_0x3775('0x35')]('nolimit')){_0x351d2d[_0x3775('0x1d')]=qs[_0x3775('0x1d')](_0x487529[_0x3775('0x30')]['limit']);_0x351d2d[_0x3775('0x1b')]=qs[_0x3775('0x1b')](_0x487529['query'][_0x3775('0x1b')]);}_0x351d2d[_0x3775('0x36')]=qs[_0x3775('0x37')](_0x487529[_0x3775('0x30')][_0x3775('0x37')]);_0x351d2d[_0x3775('0x38')]=qs[_0x3775('0x39')](_[_0x3775('0x3a')](_0x487529[_0x3775('0x30')],_0x1361b0[_0x3775('0x39')]),_0x440af8);if(_0x487529['query'][_0x3775('0x3b')]){_0x351d2d[_0x3775('0x38')]=_[_0x3775('0x3c')](_0x351d2d['where'],{'$or':_[_0x3775('0x2b')](_0x440af8,function(_0x79b534){if(_0x79b534[_0x3775('0x3d')]!=='VIRTUAL'){var _0x101eba={};_0x101eba[_0x79b534['name']]={'$like':'%'+_0x487529[_0x3775('0x30')][_0x3775('0x3b')]+'%'};return _0x101eba;}})});}_0x351d2d=_[_0x3775('0x3c')]({},_0x351d2d,_0x487529[_0x3775('0x3e')]);var _0x42bcfc={'where':_0x351d2d[_0x3775('0x38')]};return db[_0x3775('0x2c')][_0x3775('0x1e')](_0x42bcfc)['then'](function(_0x4855f8){_0x12d95b[_0x3775('0x1e')]=_0x4855f8;if(_0x487529[_0x3775('0x30')][_0x3775('0x3f')]){_0x351d2d[_0x3775('0x40')]=[{'all':!![]}];}return db[_0x3775('0x2c')]['findAll'](_0x351d2d);})['then'](function(_0x4c65b1){_0x12d95b[_0x3775('0x41')]=_0x4c65b1;return _0x12d95b;})[_0x3775('0x25')](respondWithFilteredResult(_0xa102fa,_0x351d2d))['catch'](handleError(_0xa102fa,null));};exports[_0x3775('0x42')]=function(_0x4a8803,_0x846554){var _0x5d1a90={'raw':!![],'where':{'id':_0x4a8803[_0x3775('0x43')]['id']}},_0x3fa553={};_0x3fa553[_0x3775('0x2f')]=_['keys'](db[_0x3775('0x2c')]['rawAttributes']);_0x3fa553[_0x3775('0x30')]=_[_0x3775('0x31')](_0x4a8803[_0x3775('0x30')]);_0x3fa553[_0x3775('0x39')]=_[_0x3775('0x32')](_0x3fa553[_0x3775('0x2f')],_0x3fa553[_0x3775('0x30')]);_0x5d1a90[_0x3775('0x33')]=_[_0x3775('0x32')](_0x3fa553['model'],qs['fields'](_0x4a8803[_0x3775('0x30')][_0x3775('0x34')]));_0x5d1a90['attributes']=_0x5d1a90[_0x3775('0x33')][_0x3775('0x44')]?_0x5d1a90[_0x3775('0x33')]:_0x3fa553[_0x3775('0x2f')];if(_0x4a8803[_0x3775('0x30')][_0x3775('0x3f')]){_0x5d1a90[_0x3775('0x40')]=[{'all':!![]}];}_0x5d1a90=_[_0x3775('0x3c')]({},_0x5d1a90,_0x4a8803[_0x3775('0x3e')]);return db['WhatsappApplication'][_0x3775('0x45')](_0x5d1a90)['then'](handleEntityNotFound(_0x846554,null))['then'](respondWithResult(_0x846554,null))[_0x3775('0x46')](handleError(_0x846554,null));};exports[_0x3775('0x47')]=function(_0x46efba,_0x5e3904){return db[_0x3775('0x2c')][_0x3775('0x47')](_0x46efba[_0x3775('0x48')],{})[_0x3775('0x25')](respondWithResult(_0x5e3904,0xc9))[_0x3775('0x46')](handleError(_0x5e3904,null));};exports['update']=function(_0x5a1aba,_0x365315){if(_0x5a1aba[_0x3775('0x48')]['id']){delete _0x5a1aba[_0x3775('0x48')]['id'];}return db[_0x3775('0x2c')][_0x3775('0x45')]({'where':{'id':_0x5a1aba[_0x3775('0x43')]['id']}})['then'](handleEntityNotFound(_0x365315,null))['then'](saveUpdates(_0x5a1aba[_0x3775('0x48')],null))[_0x3775('0x25')](respondWithResult(_0x365315,null))['catch'](handleError(_0x365315,null));};exports[_0x3775('0x26')]=function(_0x3edfa3,_0x2ea7cd){return db[_0x3775('0x2c')][_0x3775('0x45')]({'where':{'id':_0x3edfa3[_0x3775('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ea7cd,null))[_0x3775('0x25')](removeEntity(_0x2ea7cd,null))[_0x3775('0x46')](handleError(_0x2ea7cd,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 397baba..317e114 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 _0x4876=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','WhatsappApplication','whatsapp_applications'];(function(_0x3e74b1,_0x2c8497){var _0x5c734e=function(_0x351f15){while(--_0x351f15){_0x3e74b1['push'](_0x3e74b1['shift']());}};_0x5c734e(++_0x2c8497);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6487('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6487('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6487('0x2'));var rimraf=require(_0x6487('0x3'));var config=require(_0x6487('0x4'));var attributes=require(_0x6487('0x5'));module['exports']=function(_0x23e50b,_0x856b1c){return _0x23e50b['define'](_0x6487('0x6'),attributes,{'tableName':_0x6487('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6487('0x8'),'collate':_0x6487('0x9')});}; \ No newline at end of file +var _0x5c12=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c12,0x188));var _0x25c1=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x5c12[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))('api');var moment=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var rp=require(_0x25c1('0x4'));var fs=require('fs');var path=require(_0x25c1('0x5'));var rimraf=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var attributes=require(_0x25c1('0x8'));module['exports']=function(_0x204287,_0x42ac16){return _0x204287[_0x25c1('0x9')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25c1('0xa'),'collate':_0x25c1('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b6b77d3..0bdf4b2 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 _0xd6d6=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x46f30c,_0xb757ea){var _0x2a0a07=function(_0x42e1f9){while(--_0x42e1f9){_0x46f30c['push'](_0x46f30c['shift']());}};_0x2a0a07(++_0xb757ea);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x35d777,_0x442ed9){_0x35d777=_0x35d777-0x0;var _0x87dca8=_0xd6d6[_0x35d777];return _0x87dca8;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file +var _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x142343,_0xea72f4){var _0x4b323b=function(_0x37a392){while(--_0x37a392){_0x142343['push'](_0x142343['shift']());}};_0x4b323b(++_0xea72f4);}(_0x9bde,0xe1));var _0xe9bd=function(_0x8002a7,_0x3b1700){_0x8002a7=_0x8002a7-0x0;var _0x292b45=_0x9bde[_0x8002a7];return _0x292b45;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ae6e4ce..4cef07b 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 _0x4975=['removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','whatsapp','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy'];(function(_0x2cd1fb,_0x291f55){var _0x48fd2b=function(_0x18e23e){while(--_0x18e23e){_0x2cd1fb['push'](_0x2cd1fb['shift']());}};_0x48fd2b(++_0x291f55);}(_0x4975,0x86));var _0x5497=function(_0x9062c2,_0xfadf36){_0x9062c2=_0x9062c2-0x0;var _0xbb8117=_0x4975[_0x9062c2];return _0xbb8117;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x5497('0x14')]);router[_0x5497('0x15')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0x15')](_0x5497('0x17'),auth[_0x5497('0xd')](),interaction[_0x5497('0x18')](_0x5497('0x19'),'whatsappinteraction:addtags'),controller[_0x5497('0x1a')]);router['put'](_0x5497('0xf'),auth[_0x5497('0xd')](),interaction[_0x5497('0x18')](_0x5497('0x19'),_0x5497('0x1b')),controller[_0x5497('0x1c')]);router[_0x5497('0x1d')]('/:id',auth['isAuthenticated'](),interaction[_0x5497('0x18')](_0x5497('0x19'),_0x5497('0x1e')),controller['destroy']);router[_0x5497('0x1d')](_0x5497('0x17'),auth[_0x5497('0xd')](),controller[_0x5497('0x1f')]);module[_0x5497('0x20')]=router; \ No newline at end of file +var _0x885a=['describe','/:id','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x885a,0x180));var _0xa885=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x885a[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require(_0xa885('0x0'));var path=require(_0xa885('0x1'));var timeout=require(_0xa885('0x2'));var express=require(_0xa885('0x3'));var router=express['Router']();var fs_extra=require(_0xa885('0x4'));var auth=require(_0xa885('0x5'));var interaction=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var controller=require(_0xa885('0x8'));router[_0xa885('0x9')]('/',auth['isAuthenticated'](),controller[_0xa885('0xa')]);router[_0xa885('0x9')](_0xa885('0xb'),auth['isAuthenticated'](),controller[_0xa885('0xc')]);router[_0xa885('0x9')](_0xa885('0xd'),auth['isAuthenticated'](),controller[_0xa885('0xe')]);router[_0xa885('0x9')](_0xa885('0xf'),auth[_0xa885('0x10')](),controller[_0xa885('0x11')]);router[_0xa885('0x9')](_0xa885('0x12'),auth['isAuthenticated'](),controller[_0xa885('0x13')]);router[_0xa885('0x14')]('/',auth[_0xa885('0x10')](),controller[_0xa885('0x15')]);router[_0xa885('0x14')](_0xa885('0xf'),auth[_0xa885('0x10')](),controller['addMessage']);router[_0xa885('0x14')](_0xa885('0x16'),auth[_0xa885('0x10')](),interaction[_0xa885('0x17')](_0xa885('0x18'),'whatsappinteraction:addtags'),controller[_0xa885('0x19')]);router[_0xa885('0x1a')]('/:id',auth[_0xa885('0x10')](),interaction[_0xa885('0x17')]('whatsapp',_0xa885('0x1b')),controller[_0xa885('0x1c')]);router['delete'](_0xa885('0xd'),auth['isAuthenticated'](),interaction[_0xa885('0x17')](_0xa885('0x18'),_0xa885('0x1d')),controller['destroy']);router[_0xa885('0x1e')]('/:id/tags',auth[_0xa885('0x10')](),controller[_0xa885('0x1f')]);module[_0xa885('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 40f6654..68b03b0 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 _0x4b19=['DATE','STRING','ENUM','sequelize','exports','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b19,0x195));var _0x94b1=function(_0x26ee00,_0x4409f8){_0x26ee00=_0x26ee00-0x0;var _0x42f0e4=_0x4b19[_0x26ee00];return _0x42f0e4;};'use strict';var Sequelize=require(_0x94b1('0x0'));var moment=require('moment');module[_0x94b1('0x1')]={'closed':{'type':Sequelize[_0x94b1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x94b1('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x94b1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x94b1('0x4')]},'note':{'type':Sequelize[_0x94b1('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x94b1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x94b1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x94b1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x94b1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x94b1('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xcee8=['STRING','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x330d1f,_0x47c710){var _0x1df784=function(_0x3ec796){while(--_0x3ec796){_0x330d1f['push'](_0x330d1f['shift']());}};_0x1df784(++_0x47c710);}(_0xcee8,0xb1));var _0x8cee=function(_0x4dd5ef,_0x57af72){_0x4dd5ef=_0x4dd5ef-0x0;var _0x17eb82=_0xcee8[_0x4dd5ef];return _0x17eb82;};'use strict';var Sequelize=require(_0x8cee('0x0'));var moment=require(_0x8cee('0x1'));module[_0x8cee('0x2')]={'closed':{'type':Sequelize[_0x8cee('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8cee('0x4')]},'disposition':{'type':Sequelize[_0x8cee('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8cee('0x5')]},'note':{'type':Sequelize[_0x8cee('0x5')]},'phone':{'type':Sequelize[_0x8cee('0x5')]},'read1stAt':{'type':Sequelize[_0x8cee('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8cee('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8cee('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8cee('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 0de5e61..7cb12fe 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 _0xf69c=['\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','having','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','show','params','keys','includeAll','include','options','create','body','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','format','firstName','lastName','attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','Messages','basename','createReadStream','pipe','out','System','renderFile','views','transcript-','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','answered','unmanaged','total','closed','UserId','waiting','talking','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','field','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','whatsapp_interactions','cm_contacts','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','unreadMessages','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0xf69c,0x151));var _0xcf69=function(_0x210b46,_0x52a05f){_0x210b46=_0x210b46-0x0;var _0x203df2=_0xf69c[_0x210b46];return _0x203df2;};'use strict';var emlformat=require(_0xcf69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf69('0x1'));var jsonpatch=require(_0xcf69('0x2'));var rp=require('request-promise');var moment=require(_0xcf69('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcf69('0x4'));var util=require('util');var path=require(_0xcf69('0x5'));var sox=require('sox');var csv=require(_0xcf69('0x6'));var ejs=require(_0xcf69('0x7'));var fs=require('fs');var fs_extra=require(_0xcf69('0x8'));var _=require(_0xcf69('0x9'));var squel=require(_0xcf69('0xa'));var crypto=require('crypto');var jsforce=require(_0xcf69('0xb'));var deskjs=require(_0xcf69('0xc'));var toCsv=require(_0xcf69('0x6'));var querystring=require(_0xcf69('0xd'));var Papa=require('papaparse');var Redis=require(_0xcf69('0xe'));var authService=require(_0xcf69('0xf'));var qs=require(_0xcf69('0x10'));var as=require(_0xcf69('0x11'));var pdf=require(_0xcf69('0x12'));var hardwareService=require(_0xcf69('0x13'));var logger=require('../../config/logger')(_0xcf69('0x14'));var utils=require('../../config/utils');var config=require(_0xcf69('0x15'));var licenseUtil=require(_0xcf69('0x16'));var db=require(_0xcf69('0x17'))['db'];config[_0xcf69('0x18')]=_[_0xcf69('0x19')](config[_0xcf69('0x18')],{'host':_0xcf69('0x1a'),'port':0x18eb});var socket=require(_0xcf69('0x1b'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x525102,_0x41ff4a){_0x41ff4a=_0x41ff4a||0xcc;return function(_0x569d0b){if(_0x569d0b){return _0x525102[_0xcf69('0x1c')](_0x41ff4a);}return _0x525102[_0xcf69('0x1d')](_0x41ff4a)[_0xcf69('0x1e')]();};}function respondWithResult(_0x2ca371,_0x5691ec){_0x5691ec=_0x5691ec||0xc8;return function(_0x32cbcf){if(_0x32cbcf){return _0x2ca371[_0xcf69('0x1d')](_0x5691ec)['json'](_0x32cbcf);}};}function respondWithFilteredResult(_0x486e06,_0x438700){return function(_0x3198a6){if(_0x3198a6){var _0x39306a=typeof _0x438700[_0xcf69('0x1f')]===_0xcf69('0x20')&&typeof _0x438700[_0xcf69('0x21')]===_0xcf69('0x20');var _0x210630=_0x3198a6['count'];var _0x19b5ed=_0x39306a?0x0:_0x438700['offset'];var _0xbe9cd5=_0x39306a?_0x3198a6[_0xcf69('0x22')]:_0x438700[_0xcf69('0x1f')]+_0x438700[_0xcf69('0x21')];var _0x2af301;if(_0xbe9cd5>=_0x210630){_0xbe9cd5=_0x210630;_0x2af301=0xc8;}else{_0x2af301=0xce;}_0x486e06[_0xcf69('0x1d')](_0x2af301);return _0x486e06[_0xcf69('0x23')](_0xcf69('0x24'),_0x19b5ed+'-'+_0xbe9cd5+'/'+_0x210630)[_0xcf69('0x25')](_0x3198a6);}return null;};}function patchUpdates(_0x1061d4){return function(_0x11bd31){try{jsonpatch[_0xcf69('0x26')](_0x11bd31,_0x1061d4,!![]);}catch(_0x2170c1){return BPromise[_0xcf69('0x27')](_0x2170c1);}return _0x11bd31[_0xcf69('0x28')]();};}function saveUpdates(_0x5d16ef,_0x2b4c1b){return function(_0x1abce9){if(_0x1abce9){return _0x1abce9[_0xcf69('0x29')](_0x5d16ef)[_0xcf69('0x2a')](function(_0x9a006b){return _0x9a006b;});}return null;};}function removeEntity(_0x1a0b33,_0x5643b3){return function(_0x4a07c5){if(_0x4a07c5){return _0x4a07c5[_0xcf69('0x2b')]()['then'](function(){_0x1a0b33[_0xcf69('0x1d')](0xcc)[_0xcf69('0x1e')]();});}};}function handleEntityNotFound(_0xddec25,_0x42dbed){return function(_0x39a1b6){if(!_0x39a1b6){_0xddec25[_0xcf69('0x1c')](0x194);}return _0x39a1b6;};}function handleError(_0x17d1e5,_0x360bc2){_0x360bc2=_0x360bc2||0x1f4;return function(_0x54ad03){logger['error'](_0x54ad03[_0xcf69('0x2c')]);if(_0x54ad03[_0xcf69('0x2d')]){delete _0x54ad03[_0xcf69('0x2d')];}_0x17d1e5[_0xcf69('0x1d')](_0x360bc2)['send'](_0x54ad03);};}function getInteractionUsers(_0x200762,_0xd19ace){return new BPromise(function(_0x7a011b,_0x477511){try{if(_0xd19ace[_0x200762['id']]){_0x200762[_0xcf69('0x2e')]=_[_0xcf69('0x2f')](_0xd19ace[_0x200762['id']],function(_0x1a517f){return{'id':_0x1a517f['id'],'fullname':_0x1a517f[_0xcf69('0x30')]};});}}catch(_0xcdb8c5){_0x477511(_0xcdb8c5);}_0x7a011b(_0x200762);});}function getInteractionTags(_0x6ca69b,_0x4a5db6){return new BPromise(function(_0x38753b,_0x490c22){try{if(_0x6ca69b[_0xcf69('0x31')]){_0x6ca69b[_0xcf69('0x32')]=[];_0x6ca69b[_0xcf69('0x31')][_0xcf69('0x33')](',')[_0xcf69('0x34')](function(_0x1762b7){_0x6ca69b[_0xcf69('0x32')][_0xcf69('0x35')](_0x4a5db6[_0x1762b7]);});}delete _0x6ca69b[_0xcf69('0x31')];}catch(_0x1ada1f){_0x490c22(_0x1ada1f);}_0x38753b(_0x6ca69b);});}function updateWhatsappInteraction(_0x573618,_0x2753fe,_0x10da39){return new BPromise(function(_0x58739d,_0x171bd5){return getInteractionUsers(_0x573618,_0x10da39)['then'](function(_0x4018ac){return getInteractionTags(_0x4018ac,_0x2753fe);})['then'](function(_0x5211a0){return getStateInteraction(_0x5211a0);})[_0xcf69('0x2a')](function(_0x33ec6c){_0x58739d(_0x33ec6c);})[_0xcf69('0x36')](function(_0x40221e){_0x171bd5(_0x40221e);});});}function getStateInteraction(_0x1a105e){return new BPromise(function(_0x90d2b5){_0x1a105e['waiting']=0x0;_0x1a105e['talking']=0x0;_0x1a105e[_0xcf69('0x37')]=0x0;_0x1a105e[_0xcf69('0x38')]=0x0;_0x1a105e[_0xcf69('0x39')]=0x0;if(!_0x1a105e[_0xcf69('0x3a')]&&!_0x1a105e[_0xcf69('0x3b')]){_0x1a105e[_0xcf69('0x3c')]+=0x1;}if(!_0x1a105e[_0xcf69('0x3a')]&&_0x1a105e[_0xcf69('0x3b')]){_0x1a105e[_0xcf69('0x3d')]+=0x1;if(_0x1a105e[_0xcf69('0x3c')]){_0x1a105e[_0xcf69('0x3c')]-=0x1;}}if(_0x1a105e[_0xcf69('0x3a')]&&_0x1a105e[_0xcf69('0x3b')]){_0x1a105e[_0xcf69('0x37')]+=0x1;if(_0x1a105e[_0xcf69('0x3d')]){_0x1a105e[_0xcf69('0x3d')]-=0x1;}}if(_0x1a105e[_0xcf69('0x3a')]&&!_0x1a105e[_0xcf69('0x3b')]){_0x1a105e[_0xcf69('0x38')]+=0x1;if(_0x1a105e[_0xcf69('0x3c')]){_0x1a105e[_0xcf69('0x3c')]-=0x1;}}_0x1a105e['total']+=0x1;_0x90d2b5(_0x1a105e);});}exports['index']=function(_0x8179f8,_0x35c5ea){var _0x129d73={},_0x3f18c6={},_0x4d285f={'count':0x0,'rows':[]};var _0x104f3d=_[_0xcf69('0x2f')](db[_0xcf69('0x3e')][_0xcf69('0x3f')],function(_0x161f11){return{'name':_0x161f11['fieldName'],'type':_0x161f11[_0xcf69('0x40')][_0xcf69('0x41')]};});_0x3f18c6['model']=_[_0xcf69('0x2f')](_0x104f3d,_0xcf69('0x2d'));_0x3f18c6[_0xcf69('0x42')]=_['keys'](_0x8179f8[_0xcf69('0x42')]);_0x3f18c6['filters']=_[_0xcf69('0x43')](_0x3f18c6[_0xcf69('0x44')],_0x3f18c6['query']);_0x129d73['attributes']=_[_0xcf69('0x43')](_0x3f18c6[_0xcf69('0x44')],qs[_0xcf69('0x45')](_0x8179f8['query']['fields']));_0x129d73[_0xcf69('0x46')]=_0x129d73[_0xcf69('0x46')]['length']?_0x129d73[_0xcf69('0x46')]:_0x3f18c6[_0xcf69('0x44')];if(!_0x8179f8[_0xcf69('0x42')][_0xcf69('0x47')](_0xcf69('0x48'))){_0x129d73[_0xcf69('0x21')]=qs['limit'](_0x8179f8[_0xcf69('0x42')][_0xcf69('0x21')]);_0x129d73[_0xcf69('0x1f')]=qs['offset'](_0x8179f8[_0xcf69('0x42')]['offset']);}_0x129d73[_0xcf69('0x49')]=qs[_0xcf69('0x4a')](_0x8179f8[_0xcf69('0x42')][_0xcf69('0x4a')]);_0x129d73[_0xcf69('0x4b')]=qs['filters'](_['pick'](_0x8179f8[_0xcf69('0x42')],_0x3f18c6[_0xcf69('0x4c')]),_0x104f3d);var _0x43ded1=[];var _0x547d8c=squel['select']()['field']('id')[_0xcf69('0x4d')](_0xcf69('0x2d'))[_0xcf69('0x4d')]('color')[_0xcf69('0x4e')]('tools_tags');var _0x1cb56d=squel['select']()[_0xcf69('0x4d')](_0xcf69('0x4f'))[_0xcf69('0x4d')](_0xcf69('0x50'))[_0xcf69('0x4d')](_0xcf69('0x51'))[_0xcf69('0x4e')](_0xcf69('0x52'),'ui')[_0xcf69('0x53')](_0xcf69('0x54'),'u',_0xcf69('0x55'));var _0x52473a=squel[_0xcf69('0x56')]()[_0xcf69('0x4e')](_0xcf69('0x57'),'i')['left_join'](_0xcf69('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xcf69('0x53')](_0xcf69('0x54'),'o',_0xcf69('0x59'))[_0xcf69('0x53')](_0xcf69('0x5a'),'a',_0xcf69('0x5b'))[_0xcf69('0x53')](_0xcf69('0x5c'),'me',_0xcf69('0x5d'))[_0xcf69('0x53')](_0xcf69('0x5e'),'it',_0xcf69('0x5f'))[_0xcf69('0x53')]('tools_tags','t',_0xcf69('0x60'));var _0x2d5fb3=squel[_0xcf69('0x61')]();var _0x4907b1=[];var _0x4ecf0f=squel[_0xcf69('0x61')]();var _0x5d0df7;if(_0x8179f8[_0xcf69('0x42')][_0xcf69('0x62')]){_0x5d0df7=as['parseSearch'](_0x8179f8[_0xcf69('0x42')]['search']);var _0x4eb387=_0x5d0df7[_0xcf69('0x63')];for(var _0x51234a=0x0;_0x51234a<_0x5d0df7[_0xcf69('0x64')][_0xcf69('0x65')];_0x51234a++){var _0x59294e=_0x5d0df7[_0xcf69('0x64')][_0x51234a];var _0x200813='i';var _0x19fd95=_['find'](_0x104f3d,['name',_0x59294e[_0xcf69('0x4d')]]);if(!_0x19fd95){switch(_0x59294e[_0xcf69('0x4d')]){case _0xcf69('0x66'):if(_0x59294e['value']==0x1){_0x52473a['having']('`'+_0x59294e['field']+'`\x20=\x200');}else{_0x52473a['having']('`'+_0x59294e['field']+_0xcf69('0x67'));}break;case _0xcf69('0x68'):if(_0x59294e['operator']===_0xcf69('0x69')){if(_0x59294e[_0xcf69('0x6a')][_0xcf69('0x33')]('\x20')[_0xcf69('0x65')]>0x1){_0x2d5fb3[_0x4eb387](_0xcf69('0x6b'),qs[_0xcf69('0x6c')](_0x59294e['value']),null);}else{var _0x5605f4='%'+_0x59294e[_0xcf69('0x6a')]+'%';_0x2d5fb3[_0x4eb387](_0xcf69('0x6d'),_0x5605f4,_0x5605f4,_0x5605f4);}}else{_0x19fd95=_[_0xcf69('0x6e')](_0x104f3d,[_0xcf69('0x2d'),'ContactId']);_0x59294e['field']='ContactId';_0x39db20=as['buildExpression'](_0x200813,_0x19fd95[_0xcf69('0x40')],_0x59294e);_0x2d5fb3[_0x4eb387](_0x39db20[_0xcf69('0x6f')],_0x39db20[_0xcf69('0x6a')][_0xcf69('0x70')],_0x39db20[_0xcf69('0x6a')][_0xcf69('0x1e')]);}break;case'Tag':var _0x2c249f=_0x59294e[_0xcf69('0x6a')][_0xcf69('0x33')](',')[_0xcf69('0x2f')](function(_0xcc88d6){return Number(_0xcc88d6);});_0x2c249f[_0xcf69('0x34')](function(_0x4227e8){_0x4ecf0f['or'](_0xcf69('0x71'),'%,'+_0x4227e8+',%');});_0x4907b1=_[_0xcf69('0x72')](_0x4907b1,_0x2c249f);break;case _0xcf69('0x73'):if(_0x59294e[_0xcf69('0x74')]==='$substring'){_0x2d5fb3[_0x4eb387](_0xcf69('0x75'),'%'+_0x59294e[_0xcf69('0x6a')]+'%',null);}else{_0x19fd95=_[_0xcf69('0x6e')](_0x104f3d,['name',_0xcf69('0x3b')]);_0x59294e['field']=_0xcf69('0x3b');_0x39db20=as['buildExpression'](_0x200813,_0x19fd95['type'],_0x59294e);_0x2d5fb3[_0x4eb387](_0x39db20[_0xcf69('0x6f')],_0x39db20[_0xcf69('0x6a')][_0xcf69('0x70')],_0x39db20[_0xcf69('0x6a')][_0xcf69('0x1e')]);}break;case'body':_0x39db20=as[_0xcf69('0x76')]('me',null,_0x59294e);_0x2d5fb3[_0x4eb387](_0x39db20[_0xcf69('0x6f')],_0x39db20[_0xcf69('0x6a')]['start'],_0x39db20['value']['end']);break;}}else{var _0x39db20=as[_0xcf69('0x76')](_0x200813,_0x19fd95['type'],_0x59294e);_0x2d5fb3[_0x4eb387](_0x39db20[_0xcf69('0x6f')],_0x39db20['value'][_0xcf69('0x70')],_0x39db20[_0xcf69('0x6a')][_0xcf69('0x1e')]);}}}else{var _0x12633e=_(_0x8179f8[_0xcf69('0x42')])['keys']()['map'](function(_0x277996){return _['some'](_0x104f3d,[_0xcf69('0x2d'),_0x277996])?_0x277996:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x12633e)){_0x12633e[_0xcf69('0x34')](function(_0x24a361){if(_0x24a361===_0xcf69('0x77')){_0x52473a[_0xcf69('0x4b')](_0xcf69('0x78'),[][_0xcf69('0x79')](_0x8179f8['query'][_0x24a361]));}else if(_0x24a361===_0xcf69('0x7a')){var _0x4d372c=JSON[_0xcf69('0x7b')](_0x8179f8[_0xcf69('0x42')][_0x24a361])['$gte'];var _0x2bf787=JSON[_0xcf69('0x7b')](_0x8179f8[_0xcf69('0x42')][_0x24a361])['$lte'];_0x52473a['where'](_0xcf69('0x7c'),_0x4d372c,_0x2bf787);}else{if(_0x8179f8[_0xcf69('0x42')][_0x24a361]==='null'){_0x52473a[_0xcf69('0x4b')]('i.'+_0x24a361+_0xcf69('0x7d'));}else{_0x52473a[_0xcf69('0x4b')]('i.'+_0x24a361+'\x20=\x20?',_0x8179f8['query'][_0x24a361]);}}});}if(_0x8179f8[_0xcf69('0x42')]['read']){if(_0x8179f8[_0xcf69('0x42')][_0xcf69('0x7e')]==0x1){_0x52473a['having'](_0xcf69('0x7f'));}else{_0x52473a[_0xcf69('0x80')]('`unreadMessages`\x20>\x200');}}if(_0x8179f8[_0xcf69('0x42')]['tag']){_0x4907b1=_[_0xcf69('0x81')](_0x8179f8[_0xcf69('0x42')][_0xcf69('0x82')])?_0x8179f8[_0xcf69('0x42')][_0xcf69('0x82')]:new Array(_0x8179f8[_0xcf69('0x42')][_0xcf69('0x82')]);_0x4907b1['forEach'](function(_0x2ed020){_0x4ecf0f['or'](_0xcf69('0x71'),'%,'+_0x2ed020+',%');});}if(_0x8179f8[_0xcf69('0x42')][_0xcf69('0x83')]){var _0x54afbc=_0x8179f8['query'][_0xcf69('0x83')][_0xcf69('0x84')]('\x5c','\x5c\x5c')[_0xcf69('0x84')](/'/g,'\x27\x27');if(qs[_0xcf69('0x85')](_0x54afbc)){_0x2d5fb3['or'](_0xcf69('0x86'),_0x54afbc+'%')['or'](_0xcf69('0x87'),_0x54afbc+'%');}else{_0x2d5fb3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcf69('0x6c')](_0x54afbc))['or'](_0xcf69('0x88'),_0x54afbc+'%');}}}_0x52473a[_0xcf69('0x4b')](_0x2d5fb3);_0x52473a[_0xcf69('0x89')](_0xcf69('0x8a'));var _0x4f57f9={'type':db[_0xcf69('0x8b')]['QueryTypes']['SELECT'],'raw':!![]};var _0x96cf1d=_0x52473a[_0xcf69('0x8c')]();_0x96cf1d['field']('i.id');_0x96cf1d['field'](_0xcf69('0x8d'),_0xcf69('0x66'));if(_0x129d73[_0xcf69('0x49')]){_0x129d73[_0xcf69('0x49')][_0xcf69('0x34')](function(_0x19661b){var _0x49d1cc=_0x19661b[0x0]===_0xcf69('0x8e')?_0x19661b[0x0]:'i.'+_0x19661b[0x0];_0x52473a[_0xcf69('0x49')](_0x49d1cc,_0x19661b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xcf69('0x8f')](_0x4907b1)){_0x52473a[_0xcf69('0x80')](_0x4ecf0f);_0x96cf1d[_0xcf69('0x4b')](_0xcf69('0x90'),_0x4907b1);}BPromise[_0xcf69('0x91')]()[_0xcf69('0x2a')](function(){if(!_0x5d0df7){if(_0x8179f8['query'][_0xcf69('0x77')])return;_0x96cf1d[_0xcf69('0x4b')](_0xcf69('0x92'));_0x52473a[_0xcf69('0x4b')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x8179f8[_0xcf69('0x93')][_0xcf69('0x94')]!==_0xcf69('0x95'))return;return _0x8179f8[_0xcf69('0x93')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xcf69('0x2a')](function(_0x531d0e){if(_[_0xcf69('0x8f')](_0x531d0e)){_0x96cf1d[_0xcf69('0x4b')]('i.WhatsappAccountId\x20IS\x20NULL');_0x52473a['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x96cf1d[_0xcf69('0x4b')](_0xcf69('0x78'),_['map'](_0x531d0e,'id'));_0x52473a[_0xcf69('0x4b')](_0xcf69('0x78'),_[_0xcf69('0x2f')](_0x531d0e,'id'));}});})[_0xcf69('0x2a')](function(){if(_0x8179f8[_0xcf69('0x93')][_0xcf69('0x94')]===_0xcf69('0x95')&&!_0x5d0df7&&!_0x8179f8[_0xcf69('0x42')][_0xcf69('0x77')])return[];return db['sequelize'][_0xcf69('0x42')](_0x96cf1d[_0xcf69('0x96')](),_0x4f57f9);})[_0xcf69('0x2a')](function(_0x538755){_0x4d285f['count']=_0x538755['length'];if(_0x4d285f[_0xcf69('0x22')]===0x0)return[];return db['sequelize']['query'](_0x547d8c[_0xcf69('0x96')](),_0x4f57f9)[_0xcf69('0x2a')](function(_0x3a84fb){_0x43ded1=_[_0xcf69('0x97')](_0x3a84fb,'id');_0x4f57f9=_[_0xcf69('0x98')](_0x4f57f9,{'model':db[_0xcf69('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x8179f8[_0xcf69('0x42')]['fields']){_0x129d73[_0xcf69('0x46')][_0xcf69('0x34')](function(_0x29e5fc){_0x52473a[_0xcf69('0x4d')]('i.'+_0x29e5fc);});}else{_0x52473a['field'](_0xcf69('0x8d'),_0xcf69('0x66'));_0x52473a[_0xcf69('0x4d')](_0xcf69('0x99'),_0xcf69('0x9a'));_0x52473a['field']('a.mandatoryDisposition',_0xcf69('0x9b'));_0x52473a[_0xcf69('0x4d')]('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',_0xcf69('0x8e'));_0x52473a[_0xcf69('0x4d')]('i.*');_0x52473a[_0xcf69('0x4d')]('c.firstName',_0xcf69('0x9c'));_0x52473a[_0xcf69('0x4d')](_0xcf69('0x9d'),_0xcf69('0x9e'));_0x52473a[_0xcf69('0x4d')](_0xcf69('0x9f'),_0xcf69('0xa0'));_0x52473a[_0xcf69('0x4d')](_0xcf69('0xa1'),_0xcf69('0xa2'));_0x52473a[_0xcf69('0x4d')]('c.mobile',_0xcf69('0xa3'));_0x52473a[_0xcf69('0x4d')]('c.fax','Contact.fax');_0x52473a[_0xcf69('0x4d')](_0xcf69('0xa4'),_0xcf69('0xa5'));_0x52473a['field']('o.internal',_0xcf69('0xa6'));_0x52473a[_0xcf69('0x4d')](_0xcf69('0xa7'),'TagIds');}if(_0x129d73[_0xcf69('0x21')])_0x52473a[_0xcf69('0x21')](_0x129d73[_0xcf69('0x21')]);if(_0x129d73['offset'])_0x52473a[_0xcf69('0x1f')](_0x129d73[_0xcf69('0x1f')]);return db[_0xcf69('0xa8')][_0xcf69('0x42')](_0x52473a[_0xcf69('0x96')](),_0x4f57f9);})[_0xcf69('0x2a')](function(_0x2d1bbf){if(_0x2d1bbf[_0xcf69('0x65')]>0x0)_0x1cb56d[_0xcf69('0x4b')](_0xcf69('0xa9'),_['map'](_0x2d1bbf,'id'));return db[_0xcf69('0xa8')][_0xcf69('0x42')](_0x1cb56d[_0xcf69('0x96')](),_0x4f57f9)[_0xcf69('0x2a')](function(_0x18db19){var _0x816161=_['groupBy'](_0x18db19,_0xcf69('0xaa'));var _0x333438=[];_0x2d1bbf[_0xcf69('0x34')](function(_0x1c4364){_0x333438[_0xcf69('0x35')](updateWhatsappInteraction(_0x1c4364,_0x43ded1,_0x816161));});return BPromise['all'](_0x333438);});});})[_0xcf69('0x2a')](function(_0x5b3431){_0x4d285f['rows']=_0x5b3431;return _0x4d285f;})[_0xcf69('0x2a')](respondWithFilteredResult(_0x35c5ea,_0x129d73))[_0xcf69('0x36')](handleError(_0x35c5ea,null));};exports[_0xcf69('0xab')]=function(_0x3dc521,_0x37991c){var _0x1d6dd7={'raw':![],'where':{'id':_0x3dc521[_0xcf69('0xac')]['id']}},_0x575c70={};_0x575c70[_0xcf69('0x44')]=_[_0xcf69('0xad')](db['WhatsappInteraction'][_0xcf69('0x3f')]);_0x575c70[_0xcf69('0x42')]=_[_0xcf69('0xad')](_0x3dc521[_0xcf69('0x42')]);_0x575c70[_0xcf69('0x4c')]=_[_0xcf69('0x43')](_0x575c70[_0xcf69('0x44')],_0x575c70['query']);_0x1d6dd7[_0xcf69('0x46')]=_[_0xcf69('0x43')](_0x575c70[_0xcf69('0x44')],qs['fields'](_0x3dc521[_0xcf69('0x42')][_0xcf69('0x45')]));_0x1d6dd7['attributes']=_0x1d6dd7['attributes'][_0xcf69('0x65')]?_0x1d6dd7[_0xcf69('0x46')]:_0x575c70[_0xcf69('0x44')];if(_0x3dc521[_0xcf69('0x42')][_0xcf69('0xae')]){_0x1d6dd7[_0xcf69('0xaf')]=[{'all':!![]}];}_0x1d6dd7=_[_0xcf69('0x98')]({},_0x1d6dd7,_0x3dc521[_0xcf69('0xb0')]);return db[_0xcf69('0x3e')][_0xcf69('0x6e')](_0x1d6dd7)[_0xcf69('0x2a')](handleEntityNotFound(_0x37991c,null))[_0xcf69('0x2a')](respondWithResult(_0x37991c,null))['catch'](handleError(_0x37991c,null));};exports[_0xcf69('0xb1')]=function(_0x3b8aaf,_0x15cddb){return db[_0xcf69('0x3e')][_0xcf69('0xb1')](_0x3b8aaf['body'],{})[_0xcf69('0x2a')](respondWithResult(_0x15cddb,0xc9))[_0xcf69('0x36')](handleError(_0x15cddb,null));};exports[_0xcf69('0x29')]=function(_0x39321a,_0x20de71){if(_0x39321a['body']['id']){delete _0x39321a[_0xcf69('0xb2')]['id'];}return db[_0xcf69('0x3e')][_0xcf69('0x6e')]({'where':{'id':_0x39321a[_0xcf69('0xac')]['id']}})[_0xcf69('0x2a')](handleEntityNotFound(_0x20de71,null))['then'](saveUpdates(_0x39321a['body'],null))['then'](respondWithResult(_0x20de71,null))[_0xcf69('0x36')](handleError(_0x20de71,null));};exports[_0xcf69('0x2b')]=function(_0x26455b,_0x46d90a){return db[_0xcf69('0x3e')]['find']({'where':{'id':_0x26455b[_0xcf69('0xac')]['id']}})[_0xcf69('0x2a')](handleEntityNotFound(_0x46d90a,null))['then'](removeEntity(_0x46d90a,null))['catch'](handleError(_0x46d90a,null));};exports[_0xcf69('0xb3')]=function(_0x2ca5e9,_0x2d929b){return db[_0xcf69('0x3e')]['describe']()['then'](respondWithResult(_0x2d929b,null))[_0xcf69('0x36')](handleError(_0x2d929b,null));};exports[_0xcf69('0xb4')]=function(_0x2bd6fd,_0xf36300,_0x33548e){return db['WhatsappMessage'][_0xcf69('0x6e')]({'where':{'id':_0x2bd6fd[_0xcf69('0xac')]['id']}})[_0xcf69('0x2a')](handleEntityNotFound(_0xf36300,null))[_0xcf69('0x2a')](function(_0x46e43a){if(_0x46e43a){return _0x46e43a[_0xcf69('0xb4')](_0x2bd6fd[_0xcf69('0xb2')][_0xcf69('0xb5')],_[_0xcf69('0xb6')](_0x2bd6fd[_0xcf69('0xb2')],[_0xcf69('0xb5'),'id'])||{});}})['then'](respondWithResult(_0xf36300,null))[_0xcf69('0x36')](handleError(_0xf36300,null));};exports[_0xcf69('0xb7')]=function(_0x4ad8f2,_0x2fb36f,_0xe78908){var _0x4edf0f={'raw':![],'where':{}};var _0x66f58={};var _0x12acde={'count':0x0,'rows':[]};return db[_0xcf69('0x3e')][_0xcf69('0xb8')]({'where':{'id':_0x4ad8f2['params']['id']}})[_0xcf69('0x2a')](handleEntityNotFound(_0x2fb36f,null))[_0xcf69('0x2a')](function(_0x198ac5){if(_0x198ac5){_0x66f58[_0xcf69('0x44')]=_['keys'](db[_0xcf69('0xb9')][_0xcf69('0x3f')]);_0x66f58['query']=_[_0xcf69('0xad')](_0x4ad8f2[_0xcf69('0x42')]);_0x66f58[_0xcf69('0x4c')]=_['intersection'](_0x66f58[_0xcf69('0x44')],_0x66f58[_0xcf69('0x42')]);_0x4edf0f[_0xcf69('0x46')]=_[_0xcf69('0x43')](_0x66f58[_0xcf69('0x44')],qs['fields'](_0x4ad8f2[_0xcf69('0x42')]['fields']));_0x4edf0f[_0xcf69('0x46')]=_0x4edf0f[_0xcf69('0x46')][_0xcf69('0x65')]?_0x4edf0f[_0xcf69('0x46')]:_0x66f58['model'];if(!_0x4ad8f2[_0xcf69('0x42')][_0xcf69('0x47')](_0xcf69('0x48'))){_0x4edf0f[_0xcf69('0x21')]=qs[_0xcf69('0x21')](_0x4ad8f2['query']['limit']);_0x4edf0f[_0xcf69('0x1f')]=qs[_0xcf69('0x1f')](_0x4ad8f2[_0xcf69('0x42')][_0xcf69('0x1f')]);}_0x4edf0f[_0xcf69('0x49')]=qs[_0xcf69('0x4a')](_0x4ad8f2[_0xcf69('0x42')][_0xcf69('0x4a')]);_0x4edf0f['where']=qs['filters'](_[_0xcf69('0xba')](_0x4ad8f2['query'],_0x66f58[_0xcf69('0x4c')]));_0x4edf0f[_0xcf69('0x4b')]['WhatsappInteractionId']=_0x198ac5['id'];if(_0x4ad8f2[_0xcf69('0x42')][_0xcf69('0x83')]){_0x4edf0f[_0xcf69('0x4b')]=_[_0xcf69('0x98')](_0x4edf0f['where'],{'$or':_[_0xcf69('0x2f')](_0x4edf0f[_0xcf69('0x46')],function(_0x2341fd){var _0x5966e0={};_0x5966e0[_0x2341fd]={'$like':'%'+_0x4ad8f2[_0xcf69('0x42')][_0xcf69('0x83')]+'%'};return _0x5966e0;})});}if(_0x4ad8f2[_0xcf69('0x42')]['$gte']){var _0x1ebc7f=_0x4ad8f2[_0xcf69('0x42')][_0xcf69('0xbb')]['split'](',');var _0x2c623d={};_0x2c623d[_0x1ebc7f[0x0]]={'$gte':moment(_0x1ebc7f[0x1])['format'](_0xcf69('0xbc'))};_0x4edf0f[_0xcf69('0x4b')]=_[_0xcf69('0x98')](_0x4edf0f[_0xcf69('0x4b')],_0x2c623d);}_0x4edf0f=_[_0xcf69('0x98')]({},_0x4edf0f,_0x4ad8f2['options']);return db['WhatsappMessage'][_0xcf69('0x22')]({'where':_0x4edf0f[_0xcf69('0x4b')]})[_0xcf69('0x2a')](function(_0x2afeb0){_0x12acde['count']=_0x2afeb0;if(_0x4ad8f2[_0xcf69('0x42')][_0xcf69('0xae')]){_0x4edf0f['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x4edf0f);})['then'](function(_0x42affe){_0x12acde[_0xcf69('0xbd')]=_0x42affe;return _0x12acde;});}})['then'](respondWithFilteredResult(_0x2fb36f,_0x4edf0f))[_0xcf69('0x36')](handleError(_0x2fb36f,null));};exports['addTags']=function(_0x1df08f,_0x3fd78c,_0x14c3ad){return db['WhatsappInteraction']['find']({'where':{'id':_0x1df08f[_0xcf69('0xac')]['id']}})[_0xcf69('0x2a')](handleEntityNotFound(_0x3fd78c,null))[_0xcf69('0x2a')](function(_0x58c992){if(_0x58c992){return _0x58c992[_0xcf69('0xbe')](_0x1df08f[_0xcf69('0xb2')]['ids'],_[_0xcf69('0xb6')](_0x1df08f[_0xcf69('0xb2')],['ids','id'])||{})[_0xcf69('0xbf')](function(){return db['Tag'][_0xcf69('0xc0')]({'attributes':['id',_0xcf69('0x2d'),_0xcf69('0xc1')],'where':{'id':_0x1df08f[_0xcf69('0xb2')][_0xcf69('0xb5')]}});})[_0xcf69('0x2a')](function(_0x4d684d){socket[_0xcf69('0xc2')](_0xcf69('0xc3'),{'id':Number(_0x1df08f[_0xcf69('0xac')]['id']),'tags':_0x4d684d||[]});return{'id':Number(_0x1df08f[_0xcf69('0xac')]['id']),'tags':_0x4d684d||[]};});}})['then'](respondWithResult(_0x3fd78c,null))['catch'](handleError(_0x3fd78c,null));};exports[_0xcf69('0xc4')]=function(_0x2785d4,_0x530a9a,_0x421440){return db['WhatsappInteraction'][_0xcf69('0x6e')]({'where':{'id':_0x2785d4[_0xcf69('0xac')]['id']}})['then'](handleEntityNotFound(_0x530a9a,null))[_0xcf69('0x2a')](function(_0x4d7776){if(_0x4d7776){return _0x4d7776[_0xcf69('0xc4')](_0x2785d4['query'][_0xcf69('0xb5')]);}})[_0xcf69('0x2a')](respondWithStatusCode(_0x530a9a,null))[_0xcf69('0x36')](handleError(_0x530a9a,null));};exports[_0xcf69('0xc5')]=function(_0x14ba92,_0x511e49){var _0x5842d4=moment()[_0xcf69('0xc6')]()[_0xcf69('0x96')]();var _0x112c26=path['join'](config[_0xcf69('0xc7')],_0xcf69('0xc8'),_0xcf69('0xc9'),_0xcf69('0xca'));var _0x2c184e=path[_0xcf69('0xcb')](config['root'],_0xcf69('0xc8'),_0xcf69('0xc9'),'attachments');var _0x9e31ac=path[_0xcf69('0xcb')](_0x112c26,_0x5842d4);var _0x42cdf4=util[_0xcf69('0xcc')]('transcript-%d-%s.zip',_0x14ba92[_0xcf69('0xac')]['id'],_0x5842d4);var _0x2a4499=path[_0xcf69('0xcb')](_0x112c26,_0x42cdf4);var _0x32f86c=[];_0x32f86c['push']({'model':db['User'],'as':_0xcf69('0x73'),'attributes':['id',_0xcf69('0x30')],'raw':!![]});_0x32f86c[_0xcf69('0x35')]({'model':db['CmContact'],'as':_0xcf69('0x68'),'attributes':['id',_0xcf69('0xcd'),_0xcf69('0xce')],'raw':!![]});if(_0x14ba92[_0xcf69('0x42')][_0xcf69('0xcf')]){_0x32f86c[_0xcf69('0x35')]({'model':db[_0xcf69('0xd0')],'as':_0xcf69('0xd0'),'raw':!![]});}var _0x4ea0d9=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0xcf69('0xb2'),_0xcf69('0x7a'),_0xcf69('0xd1'),_0xcf69('0xd2'),_0xcf69('0x7e')],'include':_0x32f86c}];_0x4ea0d9['push']({'model':db[_0xcf69('0xd3')],'as':_0xcf69('0xd4'),'attributes':['id',_0xcf69('0x2d')]});_0x4ea0d9['push']({'model':db[_0xcf69('0x73')],'as':_0xcf69('0xd5'),'attributes':['id',_0xcf69('0x30')]});return db[_0xcf69('0x3e')][_0xcf69('0x6e')]({'where':{'id':_0x14ba92[_0xcf69('0xac')]['id']},'include':_0x4ea0d9})[_0xcf69('0x2a')](handleEntityNotFound(_0x511e49,null))[_0xcf69('0x2a')](function(_0x2532b3){if(_0x2532b3){var _0x1ae3d8=_0x2532b3[_0xcf69('0xd6')]({'plain':!![]});fs[_0xcf69('0xd7')](_0x9e31ac);var _0x34b401={'channel':_0xcf69('0xd8'),'account':_0x1ae3d8[_0xcf69('0xd4')]['name'],'agent':_0x1ae3d8[_0xcf69('0xd5')]?_0x1ae3d8[_0xcf69('0xd5')]['fullname']:_0xcf69('0xd9'),'createdAt':moment(_0x1ae3d8[_0xcf69('0x7a')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xcf69('0x96')](),'closedAt':_0x1ae3d8[_0xcf69('0x3a')]?moment(_0x1ae3d8['closedAt'])[_0xcf69('0xcc')](_0xcf69('0xbc'))['toString']():'','disposition':_0x1ae3d8['disposition'],'messages':_(_0x1ae3d8[_0xcf69('0xda')])['filter']({'secret':![]})[_0xcf69('0x2f')](function(_0x2556f4){if(_0x2556f4[_0xcf69('0xd0')]){var _0xdaaba2=path[_0xcf69('0xcb')](_0x2c184e,_0x2556f4['Attachment'][_0xcf69('0xdb')]);if(fs['existsSync'](_0xdaaba2)){fs[_0xcf69('0xdc')](_0xdaaba2)[_0xcf69('0xdd')](fs['createWriteStream'](path[_0xcf69('0xcb')](_0x9e31ac,_0x2556f4[_0xcf69('0xd0')]['basename'])));}}return{'date':moment(_0x2556f4['createdAt'])[_0xcf69('0xcc')](_0xcf69('0xbc'))['toString'](),'sender':_0x2556f4[_0xcf69('0xd1')]===_0xcf69('0xde')?_0x2556f4[_0xcf69('0x73')]?_0x2556f4[_0xcf69('0x73')][_0xcf69('0x30')]:_0xcf69('0xdf'):_0x2556f4['Contact'][_0xcf69('0xcd')]+(_0x2556f4[_0xcf69('0x68')]['lastName']?'\x20'+_0x2556f4[_0xcf69('0x68')]['lastName']:''),'body':_0x2556f4[_0xcf69('0xd0')]?_0x2556f4[_0xcf69('0xd0')]['basename']:_0x2556f4[_0xcf69('0xb2')],'direction':_0x2556f4[_0xcf69('0xd1')]===_0xcf69('0xde')?'A':'C','secret':_0x2556f4[_0xcf69('0xd2')],'read':_0x2556f4[_0xcf69('0x7e')],'attachment':_0x2556f4[_0xcf69('0xd0')]};})[_0xcf69('0x6a')]()};return ejs[_0xcf69('0xe0')](path[_0xcf69('0xcb')](config[_0xcf69('0xc7')],_0xcf69('0xc8'),_0xcf69('0xe1'),'downloadInteraction.ejs'),{'interaction':_0x34b401})[_0xcf69('0x2a')](function(_0x1f7835){var _0x56ae3e=path['join'](_0x9e31ac,_0xcf69('0xe2')+_0x1ae3d8['id']+'-'+_0x5842d4+'.pdf');var _0x50af07={'path':_0x56ae3e,'channel':_0xcf69('0xd8'),'interactionId':_0x1ae3d8['id']};return pdf[_0xcf69('0xe3')](_0x1f7835,_0x50af07);})['then'](function(){return new BPromise(function(_0x32f766,_0x23d7f6){zipdir(_0x9e31ac,{'saveTo':_0x2a4499},function(_0x216e27,_0x41ca91){if(_0x216e27)return _0x23d7f6(_0x216e27);return _0x32f766(_0x41ca91);});})[_0xcf69('0x2a')](function(){return new BPromise(function(_0x412f67,_0xe07a85){rimraf(_0x9e31ac,function(_0x17990a){if(_0x17990a)_0xe07a85(_0x17990a);return _0x412f67();});});})[_0xcf69('0x2a')](function(){return _0x511e49[_0xcf69('0xc5')](_0x2a4499,_0x42cdf4,function(_0x4068e7){if(_0x4068e7){console[_0xcf69('0xe4')](_0xcf69('0xe5'),_0x4068e7);}else{fs[_0xcf69('0xe6')](_0x2a4499);}});});});}else{return _0x511e49[_0xcf69('0x1c')](0xc8);}})[_0xcf69('0x36')](handleError(_0x511e49,null));}; \ No newline at end of file +var _0xf40b=['answered','total','closed','UserId','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$substring','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','text','body','some','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','SELECT','i.id','contactName','DESC','t.id\x20IN\x20?','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','show','includeAll','include','options','create','params','describe','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','findAll','rows','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','attachments','transcript-%d-%s.zip','join','CmContact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','out','Contact','renderFile','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','waiting','talking'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xf40b,0xb0));var _0xbf40=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0xf40b[_0x21b359];return _0x57b8e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf40('0x0'));var zipdir=require(_0xbf40('0x1'));var jsonpatch=require(_0xbf40('0x2'));var rp=require(_0xbf40('0x3'));var moment=require('moment');var BPromise=require(_0xbf40('0x4'));var Mustache=require(_0xbf40('0x5'));var util=require(_0xbf40('0x6'));var path=require(_0xbf40('0x7'));var sox=require(_0xbf40('0x8'));var csv=require('to-csv');var ejs=require(_0xbf40('0x9'));var fs=require('fs');var fs_extra=require(_0xbf40('0xa'));var _=require(_0xbf40('0xb'));var squel=require(_0xbf40('0xc'));var crypto=require(_0xbf40('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbf40('0xe'));var toCsv=require(_0xbf40('0xf'));var querystring=require(_0xbf40('0x10'));var Papa=require(_0xbf40('0x11'));var Redis=require(_0xbf40('0x12'));var authService=require(_0xbf40('0x13'));var qs=require(_0xbf40('0x14'));var as=require(_0xbf40('0x15'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xbf40('0x16'));var logger=require(_0xbf40('0x17'))(_0xbf40('0x18'));var utils=require(_0xbf40('0x19'));var config=require(_0xbf40('0x1a'));var licenseUtil=require(_0xbf40('0x1b'));var db=require(_0xbf40('0x1c'))['db'];config[_0xbf40('0x1d')]=_['defaults'](config['redis'],{'host':_0xbf40('0x1e'),'port':0x18eb});var socket=require(_0xbf40('0x1f'))(new Redis(config[_0xbf40('0x1d')]));require(_0xbf40('0x20'))['register'](socket);function respondWithStatusCode(_0xb61909,_0x3c9329){_0x3c9329=_0x3c9329||0xcc;return function(_0x3965f6){if(_0x3965f6){return _0xb61909[_0xbf40('0x21')](_0x3c9329);}return _0xb61909[_0xbf40('0x22')](_0x3c9329)[_0xbf40('0x23')]();};}function respondWithResult(_0x128f7d,_0x37ea0c){_0x37ea0c=_0x37ea0c||0xc8;return function(_0x54c517){if(_0x54c517){return _0x128f7d[_0xbf40('0x22')](_0x37ea0c)[_0xbf40('0x24')](_0x54c517);}};}function respondWithFilteredResult(_0x28b9e1,_0x1e50f9){return function(_0x391ea1){if(_0x391ea1){var _0x414123=typeof _0x1e50f9[_0xbf40('0x25')]===_0xbf40('0x26')&&typeof _0x1e50f9['limit']===_0xbf40('0x26');var _0x6aa551=_0x391ea1[_0xbf40('0x27')];var _0x2d6492=_0x414123?0x0:_0x1e50f9['offset'];var _0x46a864=_0x414123?_0x391ea1[_0xbf40('0x27')]:_0x1e50f9[_0xbf40('0x25')]+_0x1e50f9[_0xbf40('0x28')];var _0x2db94f;if(_0x46a864>=_0x6aa551){_0x46a864=_0x6aa551;_0x2db94f=0xc8;}else{_0x2db94f=0xce;}_0x28b9e1[_0xbf40('0x22')](_0x2db94f);return _0x28b9e1[_0xbf40('0x29')](_0xbf40('0x2a'),_0x2d6492+'-'+_0x46a864+'/'+_0x6aa551)[_0xbf40('0x24')](_0x391ea1);}return null;};}function patchUpdates(_0x3e22a1){return function(_0x1788a8){try{jsonpatch[_0xbf40('0x2b')](_0x1788a8,_0x3e22a1,!![]);}catch(_0x17fa9a){return BPromise[_0xbf40('0x2c')](_0x17fa9a);}return _0x1788a8[_0xbf40('0x2d')]();};}function saveUpdates(_0xadf34b,_0x5c5e6d){return function(_0x2df7a8){if(_0x2df7a8){return _0x2df7a8[_0xbf40('0x2e')](_0xadf34b)[_0xbf40('0x2f')](function(_0xb9adcd){return _0xb9adcd;});}return null;};}function removeEntity(_0x2d3936,_0x383b1c){return function(_0x2464d9){if(_0x2464d9){return _0x2464d9[_0xbf40('0x30')]()[_0xbf40('0x2f')](function(){_0x2d3936[_0xbf40('0x22')](0xcc)[_0xbf40('0x23')]();});}};}function handleEntityNotFound(_0x2528f2,_0x2af9ce){return function(_0x3db5e7){if(!_0x3db5e7){_0x2528f2['sendStatus'](0x194);}return _0x3db5e7;};}function handleError(_0x17a29a,_0x5bc1cb){_0x5bc1cb=_0x5bc1cb||0x1f4;return function(_0x342f3d){logger[_0xbf40('0x31')](_0x342f3d[_0xbf40('0x32')]);if(_0x342f3d['name']){delete _0x342f3d[_0xbf40('0x33')];}_0x17a29a[_0xbf40('0x22')](_0x5bc1cb)[_0xbf40('0x34')](_0x342f3d);};}function getInteractionUsers(_0x55660d,_0xda9b8c){return new BPromise(function(_0x5b99ea,_0x186dc1){try{if(_0xda9b8c[_0x55660d['id']]){_0x55660d[_0xbf40('0x35')]=_[_0xbf40('0x36')](_0xda9b8c[_0x55660d['id']],function(_0x53f872){return{'id':_0x53f872['id'],'fullname':_0x53f872[_0xbf40('0x37')]};});}}catch(_0x321edf){_0x186dc1(_0x321edf);}_0x5b99ea(_0x55660d);});}function getInteractionTags(_0xa38cc1,_0x2c3f48){return new BPromise(function(_0x1ccdb9,_0x38e39f){try{if(_0xa38cc1[_0xbf40('0x38')]){_0xa38cc1[_0xbf40('0x39')]=[];_0xa38cc1[_0xbf40('0x38')]['split'](',')[_0xbf40('0x3a')](function(_0xcf3823){_0xa38cc1[_0xbf40('0x39')][_0xbf40('0x3b')](_0x2c3f48[_0xcf3823]);});}delete _0xa38cc1['TagIds'];}catch(_0x393964){_0x38e39f(_0x393964);}_0x1ccdb9(_0xa38cc1);});}function updateWhatsappInteraction(_0x5dae1f,_0x4acd9e,_0x660a28){return new BPromise(function(_0x1493b3,_0x4976d8){return getInteractionUsers(_0x5dae1f,_0x660a28)[_0xbf40('0x2f')](function(_0x45d073){return getInteractionTags(_0x45d073,_0x4acd9e);})[_0xbf40('0x2f')](function(_0xba837b){return getStateInteraction(_0xba837b);})[_0xbf40('0x2f')](function(_0x4aa382){_0x1493b3(_0x4aa382);})[_0xbf40('0x3c')](function(_0x114d24){_0x4976d8(_0x114d24);});});}function getStateInteraction(_0xa7ad3a){return new BPromise(function(_0x496a2f){_0xa7ad3a[_0xbf40('0x3d')]=0x0;_0xa7ad3a[_0xbf40('0x3e')]=0x0;_0xa7ad3a[_0xbf40('0x3f')]=0x0;_0xa7ad3a['unmanaged']=0x0;_0xa7ad3a[_0xbf40('0x40')]=0x0;if(!_0xa7ad3a[_0xbf40('0x41')]&&!_0xa7ad3a[_0xbf40('0x42')]){_0xa7ad3a[_0xbf40('0x3d')]+=0x1;}if(!_0xa7ad3a[_0xbf40('0x41')]&&_0xa7ad3a[_0xbf40('0x42')]){_0xa7ad3a[_0xbf40('0x3e')]+=0x1;if(_0xa7ad3a[_0xbf40('0x3d')]){_0xa7ad3a[_0xbf40('0x3d')]-=0x1;}}if(_0xa7ad3a[_0xbf40('0x41')]&&_0xa7ad3a[_0xbf40('0x42')]){_0xa7ad3a[_0xbf40('0x3f')]+=0x1;if(_0xa7ad3a[_0xbf40('0x3e')]){_0xa7ad3a[_0xbf40('0x3e')]-=0x1;}}if(_0xa7ad3a['closed']&&!_0xa7ad3a[_0xbf40('0x42')]){_0xa7ad3a['unmanaged']+=0x1;if(_0xa7ad3a[_0xbf40('0x3d')]){_0xa7ad3a[_0xbf40('0x3d')]-=0x1;}}_0xa7ad3a[_0xbf40('0x40')]+=0x1;_0x496a2f(_0xa7ad3a);});}exports[_0xbf40('0x43')]=function(_0x3fa440,_0x5e6256){var _0x1f04ed={},_0xfd6710={},_0x51aa33={'count':0x0,'rows':[]};var _0x14f87c=_['map'](db[_0xbf40('0x44')][_0xbf40('0x45')],function(_0x21db9b){return{'name':_0x21db9b[_0xbf40('0x46')],'type':_0x21db9b[_0xbf40('0x47')][_0xbf40('0x48')]};});_0xfd6710[_0xbf40('0x49')]=_['map'](_0x14f87c,_0xbf40('0x33'));_0xfd6710[_0xbf40('0x4a')]=_[_0xbf40('0x4b')](_0x3fa440[_0xbf40('0x4a')]);_0xfd6710[_0xbf40('0x4c')]=_[_0xbf40('0x4d')](_0xfd6710[_0xbf40('0x49')],_0xfd6710[_0xbf40('0x4a')]);_0x1f04ed['attributes']=_[_0xbf40('0x4d')](_0xfd6710['model'],qs[_0xbf40('0x4e')](_0x3fa440[_0xbf40('0x4a')][_0xbf40('0x4e')]));_0x1f04ed[_0xbf40('0x4f')]=_0x1f04ed['attributes']['length']?_0x1f04ed[_0xbf40('0x4f')]:_0xfd6710[_0xbf40('0x49')];if(!_0x3fa440[_0xbf40('0x4a')]['hasOwnProperty']('nolimit')){_0x1f04ed[_0xbf40('0x28')]=qs['limit'](_0x3fa440[_0xbf40('0x4a')]['limit']);_0x1f04ed[_0xbf40('0x25')]=qs[_0xbf40('0x25')](_0x3fa440['query'][_0xbf40('0x25')]);}_0x1f04ed[_0xbf40('0x50')]=qs['sort'](_0x3fa440['query'][_0xbf40('0x51')]);_0x1f04ed[_0xbf40('0x52')]=qs['filters'](_[_0xbf40('0x53')](_0x3fa440[_0xbf40('0x4a')],_0xfd6710[_0xbf40('0x4c')]),_0x14f87c);var _0x379977=[];var _0x4a24dc=squel['select']()[_0xbf40('0x54')]('id')[_0xbf40('0x54')](_0xbf40('0x33'))[_0xbf40('0x54')](_0xbf40('0x55'))[_0xbf40('0x56')](_0xbf40('0x57'));var _0x50af71=squel['select']()[_0xbf40('0x54')](_0xbf40('0x58'))['field'](_0xbf40('0x59'))[_0xbf40('0x54')](_0xbf40('0x5a'))['from'](_0xbf40('0x5b'),'ui')[_0xbf40('0x5c')](_0xbf40('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x155f38=squel['select']()[_0xbf40('0x56')]('whatsapp_interactions','i')[_0xbf40('0x5c')]('cm_contacts','c',_0xbf40('0x5e'))[_0xbf40('0x5c')](_0xbf40('0x5d'),'o',_0xbf40('0x5f'))[_0xbf40('0x5c')](_0xbf40('0x60'),'a',_0xbf40('0x61'))[_0xbf40('0x5c')](_0xbf40('0x62'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xbf40('0x5c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xbf40('0x5c')]('tools_tags','t',_0xbf40('0x63'));var _0xb8a729=squel[_0xbf40('0x64')]();var _0x3a78f6=[];var _0x52e5ed=squel['expr']();var _0x2b18ed;if(_0x3fa440[_0xbf40('0x4a')]['search']){_0x2b18ed=as[_0xbf40('0x65')](_0x3fa440['query'][_0xbf40('0x66')]);var _0x500bc6=_0x2b18ed['sqlOperator'];for(var _0x48c14f=0x0;_0x48c14f<_0x2b18ed['conditions']['length'];_0x48c14f++){var _0x2a30ce=_0x2b18ed[_0xbf40('0x67')][_0x48c14f];var _0x3294d6='i';var _0xa13cac=_[_0xbf40('0x68')](_0x14f87c,['name',_0x2a30ce[_0xbf40('0x54')]]);if(!_0xa13cac){switch(_0x2a30ce[_0xbf40('0x54')]){case _0xbf40('0x69'):if(_0x2a30ce[_0xbf40('0x6a')]==0x1){_0x155f38[_0xbf40('0x6b')]('`'+_0x2a30ce[_0xbf40('0x54')]+_0xbf40('0x6c'));}else{_0x155f38[_0xbf40('0x6b')]('`'+_0x2a30ce[_0xbf40('0x54')]+_0xbf40('0x6d'));}break;case'Contact':if(_0x2a30ce['operator']===_0xbf40('0x6e')){if(_0x2a30ce[_0xbf40('0x6a')][_0xbf40('0x6f')]('\x20')[_0xbf40('0x70')]>0x1){_0xb8a729[_0x500bc6](_0xbf40('0x71'),qs['getFullTextValue'](_0x2a30ce[_0xbf40('0x6a')]),null);}else{var _0x391782='%'+_0x2a30ce[_0xbf40('0x6a')]+'%';_0xb8a729[_0x500bc6](_0xbf40('0x72'),_0x391782,_0x391782,_0x391782);}}else{_0xa13cac=_[_0xbf40('0x68')](_0x14f87c,[_0xbf40('0x33'),_0xbf40('0x73')]);_0x2a30ce['field']=_0xbf40('0x73');_0x3baeb1=as[_0xbf40('0x74')](_0x3294d6,_0xa13cac[_0xbf40('0x47')],_0x2a30ce);_0xb8a729[_0x500bc6](_0x3baeb1['text'],_0x3baeb1[_0xbf40('0x6a')][_0xbf40('0x75')],_0x3baeb1[_0xbf40('0x6a')][_0xbf40('0x23')]);}break;case _0xbf40('0x76'):var _0x3be6fe=_0x2a30ce[_0xbf40('0x6a')]['split'](',')['map'](function(_0x44ea89){return Number(_0x44ea89);});_0x3be6fe[_0xbf40('0x3a')](function(_0x493e85){_0x52e5ed['or'](_0xbf40('0x77'),'%,'+_0x493e85+',%');});_0x3a78f6=_[_0xbf40('0x78')](_0x3a78f6,_0x3be6fe);break;case _0xbf40('0x79'):if(_0x2a30ce[_0xbf40('0x7a')]===_0xbf40('0x6e')){_0xb8a729[_0x500bc6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2a30ce[_0xbf40('0x6a')]+'%',null);}else{_0xa13cac=_[_0xbf40('0x68')](_0x14f87c,['name',_0xbf40('0x42')]);_0x2a30ce[_0xbf40('0x54')]=_0xbf40('0x42');_0x3baeb1=as[_0xbf40('0x74')](_0x3294d6,_0xa13cac[_0xbf40('0x47')],_0x2a30ce);_0xb8a729[_0x500bc6](_0x3baeb1[_0xbf40('0x7b')],_0x3baeb1[_0xbf40('0x6a')][_0xbf40('0x75')],_0x3baeb1[_0xbf40('0x6a')][_0xbf40('0x23')]);}break;case _0xbf40('0x7c'):_0x3baeb1=as[_0xbf40('0x74')]('me',null,_0x2a30ce);_0xb8a729[_0x500bc6](_0x3baeb1['text'],_0x3baeb1['value'][_0xbf40('0x75')],_0x3baeb1[_0xbf40('0x6a')][_0xbf40('0x23')]);break;}}else{var _0x3baeb1=as[_0xbf40('0x74')](_0x3294d6,_0xa13cac[_0xbf40('0x47')],_0x2a30ce);_0xb8a729[_0x500bc6](_0x3baeb1['text'],_0x3baeb1['value'][_0xbf40('0x75')],_0x3baeb1['value'][_0xbf40('0x23')]);}}}else{var _0x39f9b4=_(_0x3fa440['query'])['keys']()[_0xbf40('0x36')](function(_0x205fd4){return _[_0xbf40('0x7d')](_0x14f87c,[_0xbf40('0x33'),_0x205fd4])?_0x205fd4:undefined;})['compact']()[_0xbf40('0x6a')]();if(!_[_0xbf40('0x7e')](_0x39f9b4)){_0x39f9b4['forEach'](function(_0x3936fb){if(_0x3936fb==='WhatsappAccountId'){_0x155f38[_0xbf40('0x52')](_0xbf40('0x7f'),[][_0xbf40('0x80')](_0x3fa440[_0xbf40('0x4a')][_0x3936fb]));}else if(_0x3936fb===_0xbf40('0x81')){var _0x441175=JSON[_0xbf40('0x82')](_0x3fa440[_0xbf40('0x4a')][_0x3936fb])[_0xbf40('0x83')];var _0x185417=JSON['parse'](_0x3fa440['query'][_0x3936fb])[_0xbf40('0x84')];_0x155f38[_0xbf40('0x52')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x441175,_0x185417);}else{if(_0x3fa440[_0xbf40('0x4a')][_0x3936fb]===_0xbf40('0x85')){_0x155f38[_0xbf40('0x52')]('i.'+_0x3936fb+'\x20IS\x20NULL');}else{_0x155f38[_0xbf40('0x52')]('i.'+_0x3936fb+_0xbf40('0x86'),_0x3fa440[_0xbf40('0x4a')][_0x3936fb]);}}});}if(_0x3fa440[_0xbf40('0x4a')]['read']){if(_0x3fa440['query']['read']==0x1){_0x155f38[_0xbf40('0x6b')]('`unreadMessages`\x20=\x200');}else{_0x155f38[_0xbf40('0x6b')](_0xbf40('0x87'));}}if(_0x3fa440[_0xbf40('0x4a')][_0xbf40('0x88')]){_0x3a78f6=_[_0xbf40('0x89')](_0x3fa440[_0xbf40('0x4a')][_0xbf40('0x88')])?_0x3fa440[_0xbf40('0x4a')][_0xbf40('0x88')]:new Array(_0x3fa440[_0xbf40('0x4a')][_0xbf40('0x88')]);_0x3a78f6[_0xbf40('0x3a')](function(_0x5c6d7f){_0x52e5ed['or'](_0xbf40('0x77'),'%,'+_0x5c6d7f+',%');});}if(_0x3fa440[_0xbf40('0x4a')]['filter']){var _0xe294d9=_0x3fa440['query'][_0xbf40('0x8a')][_0xbf40('0x8b')]('\x5c','\x5c\x5c')[_0xbf40('0x8b')](/'/g,'\x27\x27');if(qs[_0xbf40('0x8c')](_0xe294d9)){_0xb8a729['or'](_0xbf40('0x8d'),_0xe294d9+'%')['or'](_0xbf40('0x8e'),_0xe294d9+'%');}else{_0xb8a729['or'](_0xbf40('0x8f'),qs[_0xbf40('0x90')](_0xe294d9))['or'](_0xbf40('0x91'),_0xe294d9+'%');}}}_0x155f38['where'](_0xb8a729);_0x155f38['group']('i.id');var _0x131f27={'type':db['Sequelize'][_0xbf40('0x92')][_0xbf40('0x93')],'raw':!![]};var _0x4142f0=_0x155f38['clone']();_0x4142f0[_0xbf40('0x54')](_0xbf40('0x94'));_0x4142f0[_0xbf40('0x54')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbf40('0x69'));if(_0x1f04ed[_0xbf40('0x50')]){_0x1f04ed['order'][_0xbf40('0x3a')](function(_0xc23248){var _0x2648ed=_0xc23248[0x0]===_0xbf40('0x95')?_0xc23248[0x0]:'i.'+_0xc23248[0x0];_0x155f38[_0xbf40('0x50')](_0x2648ed,_0xc23248[0x1]===_0xbf40('0x96')?![]:!![]);});}if(!_[_0xbf40('0x7e')](_0x3a78f6)){_0x155f38[_0xbf40('0x6b')](_0x52e5ed);_0x4142f0[_0xbf40('0x52')](_0xbf40('0x97'),_0x3a78f6);}BPromise['resolve']()[_0xbf40('0x2f')](function(){if(!_0x2b18ed){if(_0x3fa440[_0xbf40('0x4a')][_0xbf40('0x98')])return;_0x4142f0[_0xbf40('0x52')](_0xbf40('0x99'));_0x155f38[_0xbf40('0x52')](_0xbf40('0x99'));return;}if(_0x3fa440[_0xbf40('0x9a')]['role']!==_0xbf40('0x9b'))return;return _0x3fa440[_0xbf40('0x9a')][_0xbf40('0x9c')]({'attributes':['id'],'raw':!![]})[_0xbf40('0x2f')](function(_0x35c562){if(_[_0xbf40('0x7e')](_0x35c562)){_0x4142f0['where'](_0xbf40('0x9d'));_0x155f38[_0xbf40('0x52')](_0xbf40('0x9d'));}else{_0x4142f0[_0xbf40('0x52')](_0xbf40('0x7f'),_[_0xbf40('0x36')](_0x35c562,'id'));_0x155f38[_0xbf40('0x52')](_0xbf40('0x7f'),_[_0xbf40('0x36')](_0x35c562,'id'));}});})[_0xbf40('0x2f')](function(){if(_0x3fa440['user'][_0xbf40('0x9e')]===_0xbf40('0x9b')&&!_0x2b18ed&&!_0x3fa440[_0xbf40('0x4a')]['WhatsappAccountId'])return[];return db[_0xbf40('0x9f')][_0xbf40('0x4a')](_0x4142f0[_0xbf40('0xa0')](),_0x131f27);})[_0xbf40('0x2f')](function(_0x4912c3){_0x51aa33[_0xbf40('0x27')]=_0x4912c3[_0xbf40('0x70')];if(_0x51aa33[_0xbf40('0x27')]===0x0)return[];return db[_0xbf40('0x9f')][_0xbf40('0x4a')](_0x4a24dc[_0xbf40('0xa0')](),_0x131f27)['then'](function(_0x59f1fe){_0x379977=_['keyBy'](_0x59f1fe,'id');_0x131f27=_[_0xbf40('0xa1')](_0x131f27,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fa440[_0xbf40('0x4a')][_0xbf40('0x4e')]){_0x1f04ed[_0xbf40('0x4f')][_0xbf40('0x3a')](function(_0x1302bc){_0x155f38[_0xbf40('0x54')]('i.'+_0x1302bc);});}else{_0x155f38[_0xbf40('0x54')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbf40('0x69'));_0x155f38[_0xbf40('0x54')](_0xbf40('0xa2'),_0xbf40('0xa3'));_0x155f38['field']('a.mandatoryDisposition',_0xbf40('0xa4'));_0x155f38[_0xbf40('0x54')](_0xbf40('0xa5'),_0xbf40('0x95'));_0x155f38[_0xbf40('0x54')]('i.*');_0x155f38[_0xbf40('0x54')](_0xbf40('0xa6'),'Contact.firstName');_0x155f38[_0xbf40('0x54')](_0xbf40('0xa7'),'Contact.lastName');_0x155f38[_0xbf40('0x54')](_0xbf40('0xa8'),_0xbf40('0xa9'));_0x155f38[_0xbf40('0x54')](_0xbf40('0xaa'),'Contact.phone');_0x155f38[_0xbf40('0x54')](_0xbf40('0xab'),'Contact.mobile');_0x155f38[_0xbf40('0x54')]('c.fax',_0xbf40('0xac'));_0x155f38[_0xbf40('0x54')](_0xbf40('0xad'),'Owner.fullname');_0x155f38[_0xbf40('0x54')](_0xbf40('0xae'),_0xbf40('0xaf'));_0x155f38[_0xbf40('0x54')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbf40('0x38'));}if(_0x1f04ed[_0xbf40('0x28')])_0x155f38[_0xbf40('0x28')](_0x1f04ed[_0xbf40('0x28')]);if(_0x1f04ed['offset'])_0x155f38[_0xbf40('0x25')](_0x1f04ed[_0xbf40('0x25')]);return db['sequelize'][_0xbf40('0x4a')](_0x155f38[_0xbf40('0xa0')](),_0x131f27);})[_0xbf40('0x2f')](function(_0xc9a4cd){if(_0xc9a4cd[_0xbf40('0x70')]>0x0)_0x50af71[_0xbf40('0x52')](_0xbf40('0xb0'),_['map'](_0xc9a4cd,'id'));return db[_0xbf40('0x9f')]['query'](_0x50af71[_0xbf40('0xa0')](),_0x131f27)[_0xbf40('0x2f')](function(_0x1ea21f){var _0xe830d2=_[_0xbf40('0xb1')](_0x1ea21f,'WhatsappInteractionId');var _0x20058e=[];_0xc9a4cd[_0xbf40('0x3a')](function(_0x36da33){_0x20058e[_0xbf40('0x3b')](updateWhatsappInteraction(_0x36da33,_0x379977,_0xe830d2));});return BPromise[_0xbf40('0xb2')](_0x20058e);});});})[_0xbf40('0x2f')](function(_0x12de84){_0x51aa33['rows']=_0x12de84;return _0x51aa33;})[_0xbf40('0x2f')](respondWithFilteredResult(_0x5e6256,_0x1f04ed))[_0xbf40('0x3c')](handleError(_0x5e6256,null));};exports[_0xbf40('0xb3')]=function(_0x535d9e,_0x5807dc){var _0x21cdd8={'raw':![],'where':{'id':_0x535d9e['params']['id']}},_0x228b39={};_0x228b39[_0xbf40('0x49')]=_['keys'](db[_0xbf40('0x44')]['rawAttributes']);_0x228b39['query']=_['keys'](_0x535d9e[_0xbf40('0x4a')]);_0x228b39[_0xbf40('0x4c')]=_[_0xbf40('0x4d')](_0x228b39[_0xbf40('0x49')],_0x228b39[_0xbf40('0x4a')]);_0x21cdd8[_0xbf40('0x4f')]=_[_0xbf40('0x4d')](_0x228b39[_0xbf40('0x49')],qs[_0xbf40('0x4e')](_0x535d9e['query'][_0xbf40('0x4e')]));_0x21cdd8[_0xbf40('0x4f')]=_0x21cdd8['attributes'][_0xbf40('0x70')]?_0x21cdd8[_0xbf40('0x4f')]:_0x228b39[_0xbf40('0x49')];if(_0x535d9e['query'][_0xbf40('0xb4')]){_0x21cdd8[_0xbf40('0xb5')]=[{'all':!![]}];}_0x21cdd8=_[_0xbf40('0xa1')]({},_0x21cdd8,_0x535d9e[_0xbf40('0xb6')]);return db['WhatsappInteraction']['find'](_0x21cdd8)[_0xbf40('0x2f')](handleEntityNotFound(_0x5807dc,null))['then'](respondWithResult(_0x5807dc,null))['catch'](handleError(_0x5807dc,null));};exports[_0xbf40('0xb7')]=function(_0x38fa64,_0x147ffa){return db[_0xbf40('0x44')]['create'](_0x38fa64[_0xbf40('0x7c')],{})[_0xbf40('0x2f')](respondWithResult(_0x147ffa,0xc9))[_0xbf40('0x3c')](handleError(_0x147ffa,null));};exports[_0xbf40('0x2e')]=function(_0x24b570,_0x3877e4){if(_0x24b570['body']['id']){delete _0x24b570[_0xbf40('0x7c')]['id'];}return db[_0xbf40('0x44')][_0xbf40('0x68')]({'where':{'id':_0x24b570[_0xbf40('0xb8')]['id']}})[_0xbf40('0x2f')](handleEntityNotFound(_0x3877e4,null))[_0xbf40('0x2f')](saveUpdates(_0x24b570[_0xbf40('0x7c')],null))['then'](respondWithResult(_0x3877e4,null))[_0xbf40('0x3c')](handleError(_0x3877e4,null));};exports[_0xbf40('0x30')]=function(_0x1ee7a3,_0x44955c){return db[_0xbf40('0x44')]['find']({'where':{'id':_0x1ee7a3[_0xbf40('0xb8')]['id']}})['then'](handleEntityNotFound(_0x44955c,null))['then'](removeEntity(_0x44955c,null))['catch'](handleError(_0x44955c,null));};exports[_0xbf40('0xb9')]=function(_0x74f10c,_0x206f3a){return db[_0xbf40('0x44')][_0xbf40('0xb9')]()['then'](respondWithResult(_0x206f3a,null))[_0xbf40('0x3c')](handleError(_0x206f3a,null));};exports[_0xbf40('0xba')]=function(_0xba7076,_0x2358c3,_0x4c56de){return db['WhatsappMessage'][_0xbf40('0x68')]({'where':{'id':_0xba7076[_0xbf40('0xb8')]['id']}})[_0xbf40('0x2f')](handleEntityNotFound(_0x2358c3,null))['then'](function(_0xb09e51){if(_0xb09e51){return _0xb09e51[_0xbf40('0xba')](_0xba7076[_0xbf40('0x7c')][_0xbf40('0xbb')],_[_0xbf40('0xbc')](_0xba7076['body'],[_0xbf40('0xbb'),'id'])||{});}})[_0xbf40('0x2f')](respondWithResult(_0x2358c3,null))[_0xbf40('0x3c')](handleError(_0x2358c3,null));};exports[_0xbf40('0xbd')]=function(_0x214296,_0x1940d4,_0x4ba1e2){var _0x59e88a={'raw':![],'where':{}};var _0x85b3ad={};var _0x5ca627={'count':0x0,'rows':[]};return db[_0xbf40('0x44')]['findOne']({'where':{'id':_0x214296[_0xbf40('0xb8')]['id']}})[_0xbf40('0x2f')](handleEntityNotFound(_0x1940d4,null))[_0xbf40('0x2f')](function(_0x15151f){if(_0x15151f){_0x85b3ad[_0xbf40('0x49')]=_[_0xbf40('0x4b')](db['WhatsappMessage'][_0xbf40('0x45')]);_0x85b3ad[_0xbf40('0x4a')]=_['keys'](_0x214296[_0xbf40('0x4a')]);_0x85b3ad[_0xbf40('0x4c')]=_[_0xbf40('0x4d')](_0x85b3ad['model'],_0x85b3ad[_0xbf40('0x4a')]);_0x59e88a['attributes']=_[_0xbf40('0x4d')](_0x85b3ad['model'],qs[_0xbf40('0x4e')](_0x214296[_0xbf40('0x4a')][_0xbf40('0x4e')]));_0x59e88a[_0xbf40('0x4f')]=_0x59e88a['attributes'][_0xbf40('0x70')]?_0x59e88a[_0xbf40('0x4f')]:_0x85b3ad[_0xbf40('0x49')];if(!_0x214296[_0xbf40('0x4a')][_0xbf40('0xbe')](_0xbf40('0xbf'))){_0x59e88a[_0xbf40('0x28')]=qs[_0xbf40('0x28')](_0x214296[_0xbf40('0x4a')][_0xbf40('0x28')]);_0x59e88a[_0xbf40('0x25')]=qs[_0xbf40('0x25')](_0x214296['query'][_0xbf40('0x25')]);}_0x59e88a[_0xbf40('0x50')]=qs[_0xbf40('0x51')](_0x214296['query'][_0xbf40('0x51')]);_0x59e88a['where']=qs['filters'](_[_0xbf40('0x53')](_0x214296[_0xbf40('0x4a')],_0x85b3ad['filters']));_0x59e88a[_0xbf40('0x52')]['WhatsappInteractionId']=_0x15151f['id'];if(_0x214296['query'][_0xbf40('0x8a')]){_0x59e88a[_0xbf40('0x52')]=_['merge'](_0x59e88a[_0xbf40('0x52')],{'$or':_[_0xbf40('0x36')](_0x59e88a['attributes'],function(_0x23bd61){var _0x596a05={};_0x596a05[_0x23bd61]={'$like':'%'+_0x214296[_0xbf40('0x4a')][_0xbf40('0x8a')]+'%'};return _0x596a05;})});}if(_0x214296[_0xbf40('0x4a')][_0xbf40('0x83')]){var _0x47b7f7=_0x214296[_0xbf40('0x4a')][_0xbf40('0x83')][_0xbf40('0x6f')](',');var _0x252234={};_0x252234[_0x47b7f7[0x0]]={'$gte':moment(_0x47b7f7[0x1])[_0xbf40('0xc0')](_0xbf40('0xc1'))};_0x59e88a[_0xbf40('0x52')]=_[_0xbf40('0xa1')](_0x59e88a['where'],_0x252234);}_0x59e88a=_[_0xbf40('0xa1')]({},_0x59e88a,_0x214296[_0xbf40('0xb6')]);return db[_0xbf40('0xc2')][_0xbf40('0x27')]({'where':_0x59e88a[_0xbf40('0x52')]})['then'](function(_0x3f7df7){_0x5ca627['count']=_0x3f7df7;if(_0x214296[_0xbf40('0x4a')][_0xbf40('0xb4')]){_0x59e88a['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xbf40('0xc3')](_0x59e88a);})['then'](function(_0x2a8a02){_0x5ca627[_0xbf40('0xc4')]=_0x2a8a02;return _0x5ca627;});}})['then'](respondWithFilteredResult(_0x1940d4,_0x59e88a))[_0xbf40('0x3c')](handleError(_0x1940d4,null));};exports['addTags']=function(_0x144a5d,_0x3ed162,_0x58aae2){return db[_0xbf40('0x44')][_0xbf40('0x68')]({'where':{'id':_0x144a5d[_0xbf40('0xb8')]['id']}})[_0xbf40('0x2f')](handleEntityNotFound(_0x3ed162,null))[_0xbf40('0x2f')](function(_0x2a72c6){if(_0x2a72c6){return _0x2a72c6[_0xbf40('0xc5')](_0x144a5d[_0xbf40('0x7c')][_0xbf40('0xbb')],_[_0xbf40('0xbc')](_0x144a5d[_0xbf40('0x7c')],[_0xbf40('0xbb'),'id'])||{})[_0xbf40('0xc6')](function(){return db['Tag'][_0xbf40('0xc3')]({'attributes':['id',_0xbf40('0x33'),_0xbf40('0x55')],'where':{'id':_0x144a5d[_0xbf40('0x7c')][_0xbf40('0xbb')]}});})[_0xbf40('0x2f')](function(_0x5f364a){socket[_0xbf40('0xc7')](_0xbf40('0xc8'),{'id':Number(_0x144a5d['params']['id']),'tags':_0x5f364a||[]});return{'id':Number(_0x144a5d[_0xbf40('0xb8')]['id']),'tags':_0x5f364a||[]};});}})['then'](respondWithResult(_0x3ed162,null))[_0xbf40('0x3c')](handleError(_0x3ed162,null));};exports[_0xbf40('0xc9')]=function(_0x33a35f,_0x44cfb1,_0x5bafa8){return db[_0xbf40('0x44')][_0xbf40('0x68')]({'where':{'id':_0x33a35f[_0xbf40('0xb8')]['id']}})[_0xbf40('0x2f')](handleEntityNotFound(_0x44cfb1,null))[_0xbf40('0x2f')](function(_0x1e02f2){if(_0x1e02f2){return _0x1e02f2[_0xbf40('0xc9')](_0x33a35f[_0xbf40('0x4a')]['ids']);}})[_0xbf40('0x2f')](respondWithStatusCode(_0x44cfb1,null))[_0xbf40('0x3c')](handleError(_0x44cfb1,null));};exports[_0xbf40('0xca')]=function(_0x58dfe1,_0x509d40){var _0x3e02eb=moment()[_0xbf40('0xcb')]()['toString']();var _0x30db68=path['join'](config[_0xbf40('0xcc')],_0xbf40('0xcd'),'files','tmp');var _0x24c521=path['join'](config[_0xbf40('0xcc')],'server',_0xbf40('0xce'),_0xbf40('0xcf'));var _0x421d14=path['join'](_0x30db68,_0x3e02eb);var _0x29a6d1=util['format'](_0xbf40('0xd0'),_0x58dfe1[_0xbf40('0xb8')]['id'],_0x3e02eb);var _0x3b22bf=path[_0xbf40('0xd1')](_0x30db68,_0x29a6d1);var _0x189db5=[];_0x189db5[_0xbf40('0x3b')]({'model':db[_0xbf40('0x79')],'as':_0xbf40('0x79'),'attributes':['id',_0xbf40('0x37')],'raw':!![]});_0x189db5[_0xbf40('0x3b')]({'model':db[_0xbf40('0xd2')],'as':'Contact','attributes':['id',_0xbf40('0xd3'),_0xbf40('0xd4')],'raw':!![]});if(_0x58dfe1['query'][_0xbf40('0xcf')]){_0x189db5[_0xbf40('0x3b')]({'model':db[_0xbf40('0xd5')],'as':_0xbf40('0xd5'),'raw':!![]});}var _0x1842c6=[{'model':db[_0xbf40('0xc2')],'as':_0xbf40('0xd6'),'attributes':['id',_0xbf40('0x7c'),_0xbf40('0x81'),_0xbf40('0xd7'),_0xbf40('0xd8'),_0xbf40('0xd9')],'include':_0x189db5}];_0x1842c6[_0xbf40('0x3b')]({'model':db[_0xbf40('0xda')],'as':_0xbf40('0xdb'),'attributes':['id',_0xbf40('0x33')]});_0x1842c6['push']({'model':db[_0xbf40('0x79')],'as':_0xbf40('0xdc'),'attributes':['id','fullname']});return db[_0xbf40('0x44')][_0xbf40('0x68')]({'where':{'id':_0x58dfe1[_0xbf40('0xb8')]['id']},'include':_0x1842c6})[_0xbf40('0x2f')](handleEntityNotFound(_0x509d40,null))[_0xbf40('0x2f')](function(_0x53ffae){if(_0x53ffae){var _0x8d4a3a=_0x53ffae[_0xbf40('0xdd')]({'plain':!![]});fs[_0xbf40('0xde')](_0x421d14);var _0x5c067e={'channel':'Whatsapp','account':_0x8d4a3a[_0xbf40('0xdb')][_0xbf40('0x33')],'agent':_0x8d4a3a['Owner']?_0x8d4a3a[_0xbf40('0xdc')][_0xbf40('0x37')]:_0xbf40('0xdf'),'createdAt':moment(_0x8d4a3a[_0xbf40('0x81')])[_0xbf40('0xc0')](_0xbf40('0xc1'))['toString'](),'closedAt':_0x8d4a3a[_0xbf40('0x41')]?moment(_0x8d4a3a[_0xbf40('0xe0')])[_0xbf40('0xc0')](_0xbf40('0xc1'))[_0xbf40('0xa0')]():'','disposition':_0x8d4a3a[_0xbf40('0xe1')],'messages':_(_0x8d4a3a[_0xbf40('0xd6')])['filter']({'secret':![]})['map'](function(_0x2c5699){if(_0x2c5699[_0xbf40('0xd5')]){var _0x2f995d=path[_0xbf40('0xd1')](_0x24c521,_0x2c5699[_0xbf40('0xd5')][_0xbf40('0xe2')]);if(fs[_0xbf40('0xe3')](_0x2f995d)){fs[_0xbf40('0xe4')](_0x2f995d)[_0xbf40('0xe5')](fs['createWriteStream'](path[_0xbf40('0xd1')](_0x421d14,_0x2c5699['Attachment'][_0xbf40('0xe2')])));}}return{'date':moment(_0x2c5699[_0xbf40('0x81')])[_0xbf40('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x2c5699[_0xbf40('0xd7')]===_0xbf40('0xe6')?_0x2c5699[_0xbf40('0x79')]?_0x2c5699['User'][_0xbf40('0x37')]:'System':_0x2c5699['Contact'][_0xbf40('0xd3')]+(_0x2c5699[_0xbf40('0xe7')][_0xbf40('0xd4')]?'\x20'+_0x2c5699[_0xbf40('0xe7')][_0xbf40('0xd4')]:''),'body':_0x2c5699[_0xbf40('0xd5')]?_0x2c5699[_0xbf40('0xd5')][_0xbf40('0xe2')]:_0x2c5699[_0xbf40('0x7c')],'direction':_0x2c5699['direction']===_0xbf40('0xe6')?'A':'C','secret':_0x2c5699[_0xbf40('0xd8')],'read':_0x2c5699[_0xbf40('0xd9')],'attachment':_0x2c5699[_0xbf40('0xd5')]};})[_0xbf40('0x6a')]()};return ejs[_0xbf40('0xe8')](path[_0xbf40('0xd1')](config['root'],_0xbf40('0xcd'),'views',_0xbf40('0xe9')),{'interaction':_0x5c067e})['then'](function(_0x423abf){var _0x151baa=path[_0xbf40('0xd1')](_0x421d14,_0xbf40('0xea')+_0x8d4a3a['id']+'-'+_0x3e02eb+_0xbf40('0xeb'));var _0x25454c={'path':_0x151baa,'channel':_0xbf40('0xec'),'interactionId':_0x8d4a3a['id']};return pdf[_0xbf40('0xed')](_0x423abf,_0x25454c);})[_0xbf40('0x2f')](function(){return new BPromise(function(_0x1f2c07,_0x2f6f20){zipdir(_0x421d14,{'saveTo':_0x3b22bf},function(_0x29cd2d,_0x52ea9c){if(_0x29cd2d)return _0x2f6f20(_0x29cd2d);return _0x1f2c07(_0x52ea9c);});})[_0xbf40('0x2f')](function(){return new BPromise(function(_0x433e40,_0x400331){rimraf(_0x421d14,function(_0x1b89da){if(_0x1b89da)_0x400331(_0x1b89da);return _0x433e40();});});})['then'](function(){return _0x509d40[_0xbf40('0xca')](_0x3b22bf,_0x29a6d1,function(_0xf165cd){if(_0xf165cd){console[_0xbf40('0xee')]('err',_0xf165cd);}else{fs['unlinkSync'](_0x3b22bf);}});});});}else{return _0x509d40[_0xbf40('0x21')](0xc8);}})[_0xbf40('0x3c')](handleError(_0x509d40,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index fb168c2..108079d 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 _0x01d3=['WhatsappMessage','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','WhatsappInteraction','../../mysqldb'];(function(_0x513510,_0x554bae){var _0x32a434=function(_0xf207e){while(--_0xf207e){_0x513510['push'](_0x513510['shift']());}};_0x32a434(++_0x554bae);}(_0x01d3,0xdb));var _0x301d=function(_0x562ed4,_0x4320d3){_0x562ed4=_0x562ed4-0x0;var _0x4890de=_0x01d3[_0x562ed4];return _0x4890de;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x301d('0x0')];var WhatsappMessage=require(_0x301d('0x1'))['db'][_0x301d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x301d('0x3'),'afterUpdate':_0x301d('0x4'),'afterDestroy':_0x301d('0x5')};function emitEvent(_0x11ba0e){return function(_0x13cd36,_0x4f3b25,_0x44f428){_0x13cd36[_0x301d('0x6')]({'attributes':['id'],'raw':!![]})[_0x301d('0x7')](function(_0x30e89e){_0x13cd36[_0x301d('0x8')]('Users',_0x30e89e[_0x301d('0x9')](function(_0x1d8e83){return{'id':_0x1d8e83['id']};}));return WhatsappMessage[_0x301d('0xa')]({'where':{'WhatsappInteractionId':_0x13cd36['id'],'direction':'in','read':![]},'raw':!![]});})[_0x301d('0x7')](function(_0xc54235){_0x13cd36[_0x301d('0x8')](_0x301d('0xb'),_0xc54235[_0x301d('0xc')]);WhatsappInteractionEvents[_0x301d('0xd')](_0x11ba0e+':'+_0x13cd36['id'],_0x13cd36);WhatsappInteractionEvents['emit'](_0x11ba0e,_0x13cd36);_0x44f428(null);})[_0x301d('0xe')](_0x44f428(null));};}for(var e in events){if(events[_0x301d('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x301d('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x92d7=['findAll','unreadMessages','emit','catch','hasOwnProperty','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map'];(function(_0x1df7d2,_0x215d86){var _0x46e62b=function(_0x1ebb8b){while(--_0x1ebb8b){_0x1df7d2['push'](_0x1df7d2['shift']());}};_0x46e62b(++_0x215d86);}(_0x92d7,0x17b));var _0x792d=function(_0xf8a98a,_0x438a9d){_0xf8a98a=_0xf8a98a-0x0;var _0x153d5d=_0x92d7[_0xf8a98a];return _0x153d5d;};'use strict';var EventEmitter=require(_0x792d('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x792d('0x1')];var WhatsappMessage=require(_0x792d('0x2'))['db'][_0x792d('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x792d('0x4')](0x0);var events={'afterCreate':_0x792d('0x5'),'afterUpdate':_0x792d('0x6'),'afterDestroy':_0x792d('0x7')};function emitEvent(_0x1c052c){return function(_0x6d9df2,_0x29832a,_0x54374f){_0x6d9df2[_0x792d('0x8')]({'attributes':['id'],'raw':!![]})[_0x792d('0x9')](function(_0x7cfc16){_0x6d9df2[_0x792d('0xa')]('Users',_0x7cfc16[_0x792d('0xb')](function(_0x3a0a49){return{'id':_0x3a0a49['id']};}));return WhatsappMessage[_0x792d('0xc')]({'where':{'WhatsappInteractionId':_0x6d9df2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x792d('0x9')](function(_0x35bf20){_0x6d9df2[_0x792d('0xa')](_0x792d('0xd'),_0x35bf20['length']);WhatsappInteractionEvents[_0x792d('0xe')](_0x1c052c+':'+_0x6d9df2['id'],_0x6d9df2);WhatsappInteractionEvents['emit'](_0x1c052c,_0x6d9df2);_0x54374f(null);})[_0x792d('0xf')](_0x54374f(null));};}for(var e in events){if(events[_0x792d('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 3485007..9ea7f22 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 _0x8293=['./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x12ed1d,_0x1fc9f3){var _0x23c8f7=function(_0x23c69f){while(--_0x23c69f){_0x12ed1d['push'](_0x12ed1d['shift']());}};_0x23c8f7(++_0x1fc9f3);}(_0x8293,0xb9));var _0x3829=function(_0x14ad31,_0x207db1){_0x14ad31=_0x14ad31-0x0;var _0x302540=_0x8293[_0x14ad31];return _0x302540;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3829('0x0'));var moment=require(_0x3829('0x1'));var BPromise=require(_0x3829('0x2'));var rp=require(_0x3829('0x3'));var fs=require('fs');var path=require(_0x3829('0x4'));var rimraf=require(_0x3829('0x5'));var config=require(_0x3829('0x6'));var attributes=require(_0x3829('0x7'));module[_0x3829('0x8')]=function(_0x4ca9a2,_0x506872){return _0x4ca9a2[_0x3829('0x9')](_0x3829('0xa'),attributes,{'tableName':_0x3829('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x383578,_0x5d8943,_0x5ebea6){if(_0x383578[_0x3829('0xc')](_0x3829('0xd'))){_0x383578[_0x3829('0xe')]=moment()[_0x3829('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5ebea6(null,_0x383578);}}});}; \ No newline at end of file +var _0x2657=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x496e94,_0x315300){var _0x4f736c=function(_0x32a198){while(--_0x32a198){_0x496e94['push'](_0x496e94['shift']());}};_0x4f736c(++_0x315300);}(_0x2657,0xed));var _0x7265=function(_0x55c591,_0x30bb98){_0x55c591=_0x55c591-0x0;var _0x141925=_0x2657[_0x55c591];return _0x141925;};'use strict';var _=require('lodash');var util=require(_0x7265('0x0'));var logger=require(_0x7265('0x1'))(_0x7265('0x2'));var moment=require(_0x7265('0x3'));var BPromise=require(_0x7265('0x4'));var rp=require(_0x7265('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7265('0x6'));var attributes=require(_0x7265('0x7'));module['exports']=function(_0x445f3e,_0x3722d5){return _0x445f3e[_0x7265('0x8')](_0x7265('0x9'),attributes,{'tableName':_0x7265('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x259a1e,_0x2b8949,_0x7eda76){if(_0x259a1e['changed'](_0x7265('0xb'))){_0x259a1e[_0x7265('0xc')]=moment()['format'](_0x7265('0xd'));}_0x7eda76(null,_0x259a1e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 1668dcc..a4d0fc5 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 _0x4d82=['catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x2c24b8,_0x168e0b){var _0x563ed6=function(_0x7c1aa9){while(--_0x7c1aa9){_0x2c24b8['push'](_0x2c24b8['shift']());}};_0x563ed6(++_0x168e0b);}(_0x4d82,0x158));var _0x24d8=function(_0xef2a14,_0x4c359a){_0xef2a14=_0xef2a14-0x0;var _0x242a4d=_0x4d82[_0xef2a14];return _0x242a4d;};'use strict';var _=require(_0x24d8('0x0'));var util=require(_0x24d8('0x1'));var moment=require(_0x24d8('0x2'));var BPromise=require(_0x24d8('0x3'));var rs=require(_0x24d8('0x4'));var fs=require('fs');var Redis=require(_0x24d8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x24d8('0x6'));var logger=require('../../config/logger')(_0x24d8('0x7'));var config=require(_0x24d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24d8('0x9')][_0x24d8('0xa')]({'port':0x232a});config['redis']=_[_0x24d8('0xb')](config[_0x24d8('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24d8('0xc')]));require('./whatsappInteraction.socket')[_0x24d8('0xd')](socket);function respondWithRpcPromise(_0xcd335e,_0x36f832,_0x459757){return new BPromise(function(_0x51e3d1,_0x69c0fc){return client[_0x24d8('0xe')](_0xcd335e,_0x459757)[_0x24d8('0xf')](function(_0x2a313d){logger[_0x24d8('0x10')](_0x24d8('0x11'),_0x36f832,_0x24d8('0x12'));logger[_0x24d8('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x36f832,'request\x20sent',JSON[_0x24d8('0x14')](_0x2a313d));if(_0x2a313d[_0x24d8('0x15')]){if(_0x2a313d[_0x24d8('0x15')][_0x24d8('0x16')]===0x1f4){logger[_0x24d8('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x36f832,_0x2a313d[_0x24d8('0x15')]['message']);return _0x69c0fc(_0x2a313d[_0x24d8('0x15')][_0x24d8('0x17')]);}logger[_0x24d8('0x15')](_0x24d8('0x11'),_0x36f832,_0x2a313d[_0x24d8('0x15')][_0x24d8('0x17')]);return _0x51e3d1(_0x2a313d[_0x24d8('0x15')][_0x24d8('0x17')]);}else{logger[_0x24d8('0x10')](_0x24d8('0x11'),_0x36f832,_0x24d8('0x12'));_0x51e3d1(_0x2a313d[_0x24d8('0x18')][_0x24d8('0x17')]);}})[_0x24d8('0x19')](function(_0xa52449){logger[_0x24d8('0x15')](_0x24d8('0x11'),_0x36f832,_0xa52449);_0x69c0fc(_0xa52449);});});}exports[_0x24d8('0x1a')]=function(_0x47a663){var _0x5e79ea=this;return new Promise(function(_0x2cc751,_0x4d0c3d){return db['WhatsappInteraction'][_0x24d8('0x1b')](_0x47a663[_0x24d8('0x1c')],{'raw':_0x47a663[_0x24d8('0x1d')]?_0x47a663[_0x24d8('0x1d')][_0x24d8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47a663[_0x24d8('0x1d')]?_0x47a663['options'][_0x24d8('0x1f')]||null:null,'attributes':_0x47a663[_0x24d8('0x1d')]?_0x47a663[_0x24d8('0x1d')][_0x24d8('0x20')]||null:null,'limit':_0x47a663['options']?_0x47a663['options']['limit']||null:null})['then'](function(_0x583894){logger['info'](_0x24d8('0x1a'),_0x47a663);logger['debug'](_0x24d8('0x1a'),_0x47a663,JSON['stringify'](_0x583894));_0x2cc751(_0x583894);})[_0x24d8('0x19')](function(_0x4ca52c){logger['error']('UpdateWhatsappInteraction',_0x4ca52c['message'],_0x47a663);_0x4d0c3d(_0x5e79ea[_0x24d8('0x15')](0x1f4,_0x4ca52c[_0x24d8('0x17')]));});});};exports[_0x24d8('0x21')]=function(_0x1e55d7){return new Promise(function(_0x11a352,_0xb45b74){return db[_0x24d8('0x22')][_0x24d8('0x23')]({'where':_0x1e55d7['options']?_0x1e55d7[_0x24d8('0x1d')][_0x24d8('0x1f')]||null:null})[_0x24d8('0xf')](function(_0x2b7119){if(_0x2b7119){return _0x2b7119[_0x24d8('0x24')](_0x1e55d7[_0x24d8('0x1c')][_0x24d8('0x25')],_[_0x24d8('0x26')](_0x1e55d7['body'],[_0x24d8('0x25'),'id'])||{});}})[_0x24d8('0x27')](function(_0x39f6b6){logger['info'](_0x24d8('0x28'),_0x1e55d7);logger[_0x24d8('0x13')]('AddTags',_0x1e55d7,JSON['stringify'](_0x39f6b6));_0x11a352(_0x39f6b6);})[_0x24d8('0x19')](function(_0x2424e9){logger[_0x24d8('0x15')](_0x24d8('0x28'),_0x2424e9[_0x24d8('0x17')],_0x1e55d7);_0xb45b74(_this[_0x24d8('0x15')](0x1f4,_0x2424e9['message']));});});}; \ No newline at end of file +var _0x6610=['message','result','catch','UpdateWhatsappInteraction','update','body','raw','options','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','where','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4c67b8,_0x571e13){var _0xbc26e=function(_0x16e9ac){while(--_0x16e9ac){_0x4c67b8['push'](_0x4c67b8['shift']());}};_0xbc26e(++_0x571e13);}(_0x6610,0x11b));var _0x0661=function(_0x3cc118,_0x139a13){_0x3cc118=_0x3cc118-0x0;var _0x4a8b09=_0x6610[_0x3cc118];return _0x4a8b09;};'use strict';var _=require(_0x0661('0x0'));var util=require(_0x0661('0x1'));var moment=require(_0x0661('0x2'));var BPromise=require(_0x0661('0x3'));var rs=require(_0x0661('0x4'));var fs=require('fs');var Redis=require(_0x0661('0x5'));var db=require(_0x0661('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0661('0x7'))(_0x0661('0x8'));var config=require(_0x0661('0x9'));var jayson=require(_0x0661('0xa'));var client=jayson[_0x0661('0xb')][_0x0661('0xc')]({'port':0x232a});config[_0x0661('0xd')]=_[_0x0661('0xe')](config[_0x0661('0xd')],{'host':_0x0661('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0661('0x10'))['register'](socket);function respondWithRpcPromise(_0x547b30,_0xdff6fb,_0x3e4a42){return new BPromise(function(_0x2c7f2b,_0x27a3e1){return client[_0x0661('0x11')](_0x547b30,_0x3e4a42)[_0x0661('0x12')](function(_0x19f97f){logger[_0x0661('0x13')](_0x0661('0x14'),_0xdff6fb,'request\x20sent');logger[_0x0661('0x15')](_0x0661('0x16'),_0xdff6fb,_0x0661('0x17'),JSON['stringify'](_0x19f97f));if(_0x19f97f[_0x0661('0x18')]){if(_0x19f97f[_0x0661('0x18')]['code']===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0xdff6fb,_0x19f97f[_0x0661('0x18')][_0x0661('0x19')]);return _0x27a3e1(_0x19f97f[_0x0661('0x18')]['message']);}logger[_0x0661('0x18')](_0x0661('0x14'),_0xdff6fb,_0x19f97f['error'][_0x0661('0x19')]);return _0x2c7f2b(_0x19f97f[_0x0661('0x18')]['message']);}else{logger['info'](_0x0661('0x14'),_0xdff6fb,_0x0661('0x17'));_0x2c7f2b(_0x19f97f[_0x0661('0x1a')]['message']);}})[_0x0661('0x1b')](function(_0x5f4a08){logger[_0x0661('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0xdff6fb,_0x5f4a08);_0x27a3e1(_0x5f4a08);});});}exports[_0x0661('0x1c')]=function(_0x39e12a){var _0x55fcae=this;return new Promise(function(_0x3cbb1b,_0x23a8ab){return db['WhatsappInteraction'][_0x0661('0x1d')](_0x39e12a[_0x0661('0x1e')],{'raw':_0x39e12a['options']?_0x39e12a['options'][_0x0661('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39e12a[_0x0661('0x20')]?_0x39e12a['options']['where']||null:null,'attributes':_0x39e12a[_0x0661('0x20')]?_0x39e12a['options'][_0x0661('0x21')]||null:null,'limit':_0x39e12a[_0x0661('0x20')]?_0x39e12a[_0x0661('0x20')][_0x0661('0x22')]||null:null})[_0x0661('0x12')](function(_0x59cad5){logger['info']('UpdateWhatsappInteraction',_0x39e12a);logger[_0x0661('0x15')](_0x0661('0x1c'),_0x39e12a,JSON['stringify'](_0x59cad5));_0x3cbb1b(_0x59cad5);})[_0x0661('0x1b')](function(_0x4781a0){logger[_0x0661('0x18')](_0x0661('0x1c'),_0x4781a0['message'],_0x39e12a);_0x23a8ab(_0x55fcae[_0x0661('0x18')](0x1f4,_0x4781a0[_0x0661('0x19')]));});});};exports[_0x0661('0x23')]=function(_0x5974f5){return new Promise(function(_0x564c0e,_0x5eea45){return db[_0x0661('0x24')]['find']({'where':_0x5974f5[_0x0661('0x20')]?_0x5974f5[_0x0661('0x20')][_0x0661('0x25')]||null:null})[_0x0661('0x12')](function(_0x31c88e){if(_0x31c88e){return _0x31c88e[_0x0661('0x26')](_0x5974f5[_0x0661('0x1e')][_0x0661('0x27')],_[_0x0661('0x28')](_0x5974f5[_0x0661('0x1e')],[_0x0661('0x27'),'id'])||{});}})[_0x0661('0x29')](function(_0x412f3a){logger[_0x0661('0x13')](_0x0661('0x2a'),_0x5974f5);logger[_0x0661('0x15')](_0x0661('0x2a'),_0x5974f5,JSON[_0x0661('0x2b')](_0x412f3a));_0x564c0e(_0x412f3a);})[_0x0661('0x1b')](function(_0x4a7071){logger[_0x0661('0x18')]('AddTags',_0x4a7071['message'],_0x5974f5);_0x5eea45(_this[_0x0661('0x18')](0x1f4,_0x4a7071[_0x0661('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index cc95d24..a615d7a 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 _0x747d=['save','remove','update','removeListener','whatsappInteraction:'];(function(_0x42fabe,_0xa440d0){var _0x38035a=function(_0x1d1091){while(--_0x1d1091){_0x42fabe['push'](_0x42fabe['shift']());}};_0x38035a(++_0xa440d0);}(_0x747d,0x1ef));var _0xd747=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x747d[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xd747('0x0'),_0xd747('0x1'),_0xd747('0x2')];function createListener(_0x3baaee,_0x58086b){return function(_0x4f8628){_0x58086b['emit'](_0x3baaee,_0x4f8628);};}function removeListener(_0x40ef61,_0xa6406d){return function(){WhatsappInteractionEvents[_0xd747('0x3')](_0x40ef61,_0xa6406d);};}exports['register']=function(_0x58370a){for(var _0x5bf45b=0x0,_0x21e823=events['length'];_0x5bf45b<_0x21e823;_0x5bf45b++){var _0x243bdc=events[_0x5bf45b];var _0x4b58a0=createListener(_0xd747('0x4')+_0x243bdc,_0x58370a);WhatsappInteractionEvents['on'](_0x243bdc,_0x4b58a0);}}; \ No newline at end of file +var _0xf7c1=['remove','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0xf7c1,0xce));var _0x1f7c=function(_0x2f8568,_0x36aa59){_0x2f8568=_0x2f8568-0x0;var _0x236c4c=_0xf7c1[_0x2f8568];return _0x236c4c;};'use strict';var WhatsappInteractionEvents=require(_0x1f7c('0x0'));var events=[_0x1f7c('0x1'),_0x1f7c('0x2'),'update'];function createListener(_0x37093c,_0x24107c){return function(_0x3b6724){_0x24107c[_0x1f7c('0x3')](_0x37093c,_0x3b6724);};}function removeListener(_0x471b95,_0x25b0a9){return function(){WhatsappInteractionEvents[_0x1f7c('0x4')](_0x471b95,_0x25b0a9);};}exports[_0x1f7c('0x5')]=function(_0x18229c){for(var _0x5866fc=0x0,_0x919ea1=events[_0x1f7c('0x6')];_0x5866fc<_0x919ea1;_0x5866fc++){var _0xaa8641=events[_0x5866fc];var _0xbfec52=createListener(_0x1f7c('0x7')+_0xaa8641,_0x18229c);WhatsappInteractionEvents['on'](_0xaa8641,_0xbfec52);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 6633424..a4a8ba5 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 _0x3f8d=['tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id/accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xd3842a,_0x56fefa){var _0x28f30b=function(_0x2aac75){while(--_0x2aac75){_0xd3842a['push'](_0xd3842a['shift']());}};_0x28f30b(++_0x56fefa);}(_0x3f8d,0x1f1));var _0xd3f8=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x3f8d[_0x1f99a0];return _0x1e0849;};'use strict';var multer=require('multer');var util=require(_0xd3f8('0x0'));var path=require(_0xd3f8('0x1'));var timeout=require(_0xd3f8('0x2'));var express=require(_0xd3f8('0x3'));var router=express[_0xd3f8('0x4')]();var fs_extra=require(_0xd3f8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd3f8('0x6'));var config=require('../../config/environment');var controller=require(_0xd3f8('0x7'));router[_0xd3f8('0x8')]('/',auth[_0xd3f8('0x9')](),controller[_0xd3f8('0xa')]);router[_0xd3f8('0x8')](_0xd3f8('0xb'),auth['isAuthenticated'](),controller[_0xd3f8('0xc')]);router[_0xd3f8('0x8')](_0xd3f8('0xd'),auth[_0xd3f8('0x9')](),controller[_0xd3f8('0xe')]);router[_0xd3f8('0xf')]('/',auth['isAuthenticated'](),interaction[_0xd3f8('0x10')](_0xd3f8('0x11'),_0xd3f8('0x12')),controller['create']);router['post'](_0xd3f8('0x13'),controller[_0xd3f8('0x14')]);router[_0xd3f8('0x15')](_0xd3f8('0xd'),auth[_0xd3f8('0x9')](),controller['update']);router['put'](_0xd3f8('0x16'),auth[_0xd3f8('0x9')](),controller['accept']);router['put'](_0xd3f8('0x17'),auth[_0xd3f8('0x9')](),controller[_0xd3f8('0x18')]);router[_0xd3f8('0x19')](_0xd3f8('0xd'),auth[_0xd3f8('0x9')](),controller['destroy']);module[_0xd3f8('0x1a')]=router; \ No newline at end of file +var _0x6b21=['index','get','/:id','tracked','whatsapp','create','/:id/status','status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x1b9438,_0x5081c6){var _0x132e53=function(_0xf906ef){while(--_0xf906ef){_0x1b9438['push'](_0x1b9438['shift']());}};_0x132e53(++_0x5081c6);}(_0x6b21,0xa0));var _0x16b2=function(_0x14c688,_0x4e0ef4){_0x14c688=_0x14c688-0x0;var _0x4e15e4=_0x6b21[_0x14c688];return _0x4e15e4;};'use strict';var multer=require(_0x16b2('0x0'));var util=require('util');var path=require(_0x16b2('0x1'));var timeout=require(_0x16b2('0x2'));var express=require('express');var router=express[_0x16b2('0x3')]();var fs_extra=require(_0x16b2('0x4'));var auth=require(_0x16b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x16b2('0x6'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x16b2('0x7')](),controller[_0x16b2('0x8')]);router[_0x16b2('0x9')]('/describe',auth[_0x16b2('0x7')](),controller['describe']);router[_0x16b2('0x9')](_0x16b2('0xa'),auth[_0x16b2('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x16b2('0xb')](_0x16b2('0xc'),'whatsappmessage:create'),controller[_0x16b2('0xd')]);router['post'](_0x16b2('0xe'),controller[_0x16b2('0xf')]);router[_0x16b2('0x10')](_0x16b2('0xa'),auth[_0x16b2('0x7')](),controller[_0x16b2('0x11')]);router[_0x16b2('0x10')]('/:id/accept',auth[_0x16b2('0x7')](),controller[_0x16b2('0x12')]);router[_0x16b2('0x10')](_0x16b2('0x13'),auth[_0x16b2('0x7')](),controller[_0x16b2('0x14')]);router[_0x16b2('0x15')]('/:id',auth[_0x16b2('0x7')](),controller[_0x16b2('0x16')]);module[_0x16b2('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 9c40047..c2f05e8 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 _0x615a=['DATE','sequelize','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x179616,_0x209655){var _0x3a0aa8=function(_0x5b3b9a){while(--_0x5b3b9a){_0x179616['push'](_0x179616['shift']());}};_0x3a0aa8(++_0x209655);}(_0x615a,0x119));var _0xa615=function(_0x1a3bd2,_0x344d4a){_0x1a3bd2=_0x1a3bd2-0x0;var _0x4222e6=_0x615a[_0x1a3bd2];return _0x4222e6;};'use strict';var Sequelize=require(_0xa615('0x0'));module['exports']={'body':{'type':Sequelize[_0xa615('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa615('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa615('0x3')]('in',_0xa615('0x4')),'defaultValue':_0xa615('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa615('0x5')]},'readAt':{'type':Sequelize[_0xa615('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa615('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdb10=['DATE','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x411b68,_0x52e768){var _0x41ff90=function(_0x2ab602){while(--_0x2ab602){_0x411b68['push'](_0x411b68['shift']());}};_0x41ff90(++_0x52e768);}(_0xdb10,0xd2));var _0x0db1=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xdb10[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x0db1('0x0'));module['exports']={'body':{'type':Sequelize[_0x0db1('0x1')](_0x0db1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0db1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0db1('0x4')]('in',_0x0db1('0x5')),'defaultValue':_0x0db1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0db1('0x6')]},'secret':{'type':Sequelize[_0x0db1('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0db1('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b39dbab..f3335b9 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 _0x91c5=['user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','QueryTypes','motionChannel','rejectmessage','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','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','json','apply','save','update','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','show','params','include','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x12f8db,_0x16300f){var _0x5286c3=function(_0x4ac256){while(--_0x4ac256){_0x12f8db['push'](_0x12f8db['shift']());}};_0x5286c3(++_0x16300f);}(_0x91c5,0x1df));var _0x591c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91c5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x591c('0x0'));var rimraf=require(_0x591c('0x1'));var zipdir=require(_0x591c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x591c('0x3'));var moment=require(_0x591c('0x4'));var BPromise=require(_0x591c('0x5'));var Mustache=require(_0x591c('0x6'));var util=require(_0x591c('0x7'));var path=require(_0x591c('0x8'));var sox=require(_0x591c('0x9'));var csv=require(_0x591c('0xa'));var ejs=require(_0x591c('0xb'));var fs=require('fs');var fs_extra=require(_0x591c('0xc'));var _=require(_0x591c('0xd'));var squel=require('squel');var crypto=require(_0x591c('0xe'));var jsforce=require(_0x591c('0xf'));var deskjs=require(_0x591c('0x10'));var toCsv=require(_0x591c('0xa'));var querystring=require(_0x591c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x591c('0x12'));var qs=require(_0x591c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x591c('0x14'));var logger=require(_0x591c('0x15'))(_0x591c('0x16'));var utils=require(_0x591c('0x17'));var config=require(_0x591c('0x18'));var licenseUtil=require(_0x591c('0x19'));var db=require(_0x591c('0x1a'))['db'];config[_0x591c('0x1b')]=_[_0x591c('0x1c')](config[_0x591c('0x1b')],{'host':_0x591c('0x1d'),'port':0x18eb});var socket=require(_0x591c('0x1e'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x591c('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x591c('0x20')]({'port':0x232c});var client9002=jayson[_0x591c('0x21')][_0x591c('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x42ed62,_0x2e756c,_0x745993,_0x18407c){return new BPromise(function(_0x139c1c,_0x2ffbe4){var _0x485dfe=_0x18407c||client;return _0x485dfe[_0x591c('0x22')](_0x42ed62,_0x745993)[_0x591c('0x23')](function(_0x3e8682){logger[_0x591c('0x24')](_0x591c('0x25'),_0x2e756c,_0x591c('0x26'));logger[_0x591c('0x27')](_0x591c('0x28'),_0x2e756c,_0x591c('0x26'),JSON[_0x591c('0x29')](_0x3e8682));if(_0x3e8682[_0x591c('0x2a')]){if(_0x3e8682[_0x591c('0x2a')][_0x591c('0x2b')]===0x1f4){logger[_0x591c('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x2e756c,_0x3e8682[_0x591c('0x2a')][_0x591c('0x2c')]);return _0x2ffbe4(_0x3e8682[_0x591c('0x2a')][_0x591c('0x2c')]);}logger['error'](_0x591c('0x25'),_0x2e756c,_0x3e8682['error']['message']);return _0x139c1c(_0x3e8682['error']['message']);}else{logger[_0x591c('0x24')](_0x591c('0x25'),_0x2e756c,'request\x20sent');_0x139c1c(_0x3e8682[_0x591c('0x2d')][_0x591c('0x2c')]);}})[_0x591c('0x2e')](function(_0x2f03cb){logger[_0x591c('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x2e756c,_0x2f03cb);_0x2ffbe4(_0x2f03cb);});});}function respondWithStatusCode(_0xfd2f43,_0x4f2ec5){_0x4f2ec5=_0x4f2ec5||0xcc;return function(_0xcde434){if(_0xcde434){return _0xfd2f43['sendStatus'](_0x4f2ec5);}return _0xfd2f43[_0x591c('0x2f')](_0x4f2ec5)[_0x591c('0x30')]();};}function respondWithResult(_0x48d9dd,_0x372722){_0x372722=_0x372722||0xc8;return function(_0x46417c){if(_0x46417c){return _0x48d9dd['status'](_0x372722)['json'](_0x46417c);}};}function respondWithFilteredResult(_0x493cae,_0x5c0779){return function(_0x94a602){if(_0x94a602){var _0x25668f=typeof _0x5c0779[_0x591c('0x31')]===_0x591c('0x32')&&typeof _0x5c0779[_0x591c('0x33')]===_0x591c('0x32');var _0x2d92a9=_0x94a602[_0x591c('0x34')];var _0x573b50=_0x25668f?0x0:_0x5c0779[_0x591c('0x31')];var _0x2a19bf=_0x25668f?_0x94a602['count']:_0x5c0779['offset']+_0x5c0779[_0x591c('0x33')];var _0x4788bb;if(_0x2a19bf>=_0x2d92a9){_0x2a19bf=_0x2d92a9;_0x4788bb=0xc8;}else{_0x4788bb=0xce;}_0x493cae[_0x591c('0x2f')](_0x4788bb);return _0x493cae[_0x591c('0x35')]('Content-Range',_0x573b50+'-'+_0x2a19bf+'/'+_0x2d92a9)[_0x591c('0x36')](_0x94a602);}return null;};}function patchUpdates(_0x23efdd){return function(_0x5471f0){try{jsonpatch[_0x591c('0x37')](_0x5471f0,_0x23efdd,!![]);}catch(_0x2a2301){return BPromise['reject'](_0x2a2301);}return _0x5471f0[_0x591c('0x38')]();};}function saveUpdates(_0x48ebb6,_0x423714){return function(_0x31bbcd){if(_0x31bbcd){return _0x31bbcd[_0x591c('0x39')](_0x48ebb6)[_0x591c('0x23')](function(_0x14c286){return _0x14c286;});}return null;};}function removeEntity(_0x312549,_0x22bd77){return function(_0x52953a){if(_0x52953a){return _0x52953a['destroy']()[_0x591c('0x23')](function(){_0x312549[_0x591c('0x2f')](0xcc)[_0x591c('0x30')]();});}};}function handleEntityNotFound(_0x2438df,_0x1285f1){return function(_0x2385ba){if(!_0x2385ba){_0x2438df['sendStatus'](0x194);}return _0x2385ba;};}function handleError(_0x49269f,_0x3297c2){_0x3297c2=_0x3297c2||0x1f4;return function(_0xf534d1){logger[_0x591c('0x2a')](_0xf534d1[_0x591c('0x3a')]);if(_0xf534d1[_0x591c('0x3b')]){delete _0xf534d1[_0x591c('0x3b')];}_0x49269f[_0x591c('0x2f')](_0x3297c2)['send'](_0xf534d1);};}exports[_0x591c('0x3c')]=function(_0x148ecb,_0x3c58c0){var _0x26bde5={},_0x10e037={},_0x898ad6={'count':0x0,'rows':[]};var _0x1947f2=_[_0x591c('0x3d')](db[_0x591c('0x3e')][_0x591c('0x3f')],function(_0x1b9db1){return{'name':_0x1b9db1[_0x591c('0x40')],'type':_0x1b9db1[_0x591c('0x41')][_0x591c('0x42')]};});_0x10e037['model']=_[_0x591c('0x3d')](_0x1947f2,_0x591c('0x3b'));_0x10e037['query']=_[_0x591c('0x43')](_0x148ecb[_0x591c('0x44')]);_0x10e037[_0x591c('0x45')]=_[_0x591c('0x46')](_0x10e037['model'],_0x10e037['query']);_0x26bde5[_0x591c('0x47')]=_[_0x591c('0x46')](_0x10e037[_0x591c('0x48')],qs[_0x591c('0x49')](_0x148ecb[_0x591c('0x44')]['fields']));_0x26bde5[_0x591c('0x47')]=_0x26bde5[_0x591c('0x47')][_0x591c('0x4a')]?_0x26bde5[_0x591c('0x47')]:_0x10e037[_0x591c('0x48')];if(!_0x148ecb[_0x591c('0x44')][_0x591c('0x4b')]('nolimit')){_0x26bde5[_0x591c('0x33')]=qs[_0x591c('0x33')](_0x148ecb[_0x591c('0x44')][_0x591c('0x33')]);_0x26bde5['offset']=qs[_0x591c('0x31')](_0x148ecb[_0x591c('0x44')][_0x591c('0x31')]);}_0x26bde5[_0x591c('0x4c')]=qs['sort'](_0x148ecb[_0x591c('0x44')][_0x591c('0x4d')]);_0x26bde5['where']=qs[_0x591c('0x45')](_[_0x591c('0x4e')](_0x148ecb['query'],_0x10e037[_0x591c('0x45')]),_0x1947f2);if(_0x148ecb[_0x591c('0x44')][_0x591c('0x4f')]){_0x26bde5['where']=_[_0x591c('0x50')](_0x26bde5[_0x591c('0x51')],{'$or':_[_0x591c('0x3d')](_0x1947f2,function(_0x2e33d2){if(_0x2e33d2['type']!==_0x591c('0x52')){var _0x531bc={};_0x531bc[_0x2e33d2[_0x591c('0x3b')]]={'$like':'%'+_0x148ecb[_0x591c('0x44')]['filter']+'%'};return _0x531bc;}})});}_0x26bde5=_[_0x591c('0x50')]({},_0x26bde5,_0x148ecb[_0x591c('0x53')]);var _0x41817f={'where':_0x26bde5['where']};return db[_0x591c('0x3e')][_0x591c('0x34')](_0x41817f)[_0x591c('0x23')](function(_0x1a4121){_0x898ad6['count']=_0x1a4121;if(_0x148ecb[_0x591c('0x44')]['includeAll']){_0x26bde5['include']=[{'all':!![]}];}return db[_0x591c('0x3e')][_0x591c('0x54')](_0x26bde5);})[_0x591c('0x23')](function(_0x781cc6){_0x898ad6[_0x591c('0x55')]=_0x781cc6;return _0x898ad6;})[_0x591c('0x23')](respondWithFilteredResult(_0x3c58c0,_0x26bde5))[_0x591c('0x2e')](handleError(_0x3c58c0,null));};exports[_0x591c('0x56')]=function(_0x24e992,_0x39b85b){var _0x3fae99={'raw':!![],'where':{'id':_0x24e992[_0x591c('0x57')]['id']}},_0xd96c74={};_0xd96c74[_0x591c('0x48')]=_[_0x591c('0x43')](db[_0x591c('0x3e')][_0x591c('0x3f')]);_0xd96c74[_0x591c('0x44')]=_[_0x591c('0x43')](_0x24e992[_0x591c('0x44')]);_0xd96c74[_0x591c('0x45')]=_[_0x591c('0x46')](_0xd96c74['model'],_0xd96c74[_0x591c('0x44')]);_0x3fae99['attributes']=_[_0x591c('0x46')](_0xd96c74['model'],qs[_0x591c('0x49')](_0x24e992[_0x591c('0x44')][_0x591c('0x49')]));_0x3fae99['attributes']=_0x3fae99[_0x591c('0x47')][_0x591c('0x4a')]?_0x3fae99[_0x591c('0x47')]:_0xd96c74[_0x591c('0x48')];if(_0x24e992['query']['includeAll']){_0x3fae99[_0x591c('0x58')]=[{'all':!![]}];}_0x3fae99=_['merge']({},_0x3fae99,_0x24e992[_0x591c('0x53')]);return db[_0x591c('0x3e')][_0x591c('0x59')](_0x3fae99)[_0x591c('0x23')](handleEntityNotFound(_0x39b85b,null))['then'](respondWithResult(_0x39b85b,null))[_0x591c('0x2e')](handleError(_0x39b85b,null));};exports[_0x591c('0x5a')]=function(_0x5d9e13,_0x3e95dc){return db[_0x591c('0x3e')]['create'](_0x5d9e13[_0x591c('0x5b')],{})[_0x591c('0x23')](respondWithResult(_0x3e95dc,0xc9))[_0x591c('0x2e')](handleError(_0x3e95dc,null));};exports[_0x591c('0x39')]=function(_0x47fbd9,_0x3ce0e9){if(_0x47fbd9[_0x591c('0x5b')]['id']){delete _0x47fbd9[_0x591c('0x5b')]['id'];}return db[_0x591c('0x3e')][_0x591c('0x59')]({'where':{'id':_0x47fbd9[_0x591c('0x57')]['id']}})[_0x591c('0x23')](handleEntityNotFound(_0x3ce0e9,null))['then'](saveUpdates(_0x47fbd9[_0x591c('0x5b')],null))[_0x591c('0x23')](respondWithResult(_0x3ce0e9,null))[_0x591c('0x2e')](handleError(_0x3ce0e9,null));};exports[_0x591c('0x5c')]=function(_0x2320f9,_0x10c05c){return db[_0x591c('0x3e')][_0x591c('0x59')]({'where':{'id':_0x2320f9[_0x591c('0x57')]['id']}})[_0x591c('0x23')](handleEntityNotFound(_0x10c05c,null))[_0x591c('0x23')](removeEntity(_0x10c05c,null))[_0x591c('0x2e')](handleError(_0x10c05c,null));};exports[_0x591c('0x5d')]=function(_0x1d9e66,_0x4d0ce0){return db['WhatsappMessage'][_0x591c('0x5d')]()[_0x591c('0x23')](respondWithResult(_0x4d0ce0,null))[_0x591c('0x2e')](handleError(_0x4d0ce0,null));};var interaction_log=require(_0x591c('0x15'))(_0x591c('0x5e'));exports[_0x591c('0x5f')]=function(_0x50e702,_0x338467,_0x27a3b0){var _0x18ae06={'agent':{},'channel':_0x591c('0x60')};if(_0x50e702['body']['id']){delete _0x50e702[_0x591c('0x5b')]['id'];}_0x50e702['body'][_0x591c('0x61')]=!![];_0x50e702[_0x591c('0x5b')]['readAt']=moment()[_0x591c('0x62')](_0x591c('0x63'));_0x50e702[_0x591c('0x5b')][_0x591c('0x64')]=_0x50e702[_0x591c('0x5b')][_0x591c('0x64')]||_0x50e702[_0x591c('0x65')]['id'];_0x18ae06['agent']['id']=_0x50e702[_0x591c('0x5b')]['UserId'];return db[_0x591c('0x3e')][_0x591c('0x59')]({'where':{'id':_0x50e702[_0x591c('0x57')]['id'],'UserId':null}})[_0x591c('0x23')](handleEntityNotFound(_0x338467,null))['then'](saveUpdates(_0x50e702[_0x591c('0x5b')],null))[_0x591c('0x23')](function(_0x1b9bf5){if(_0x1b9bf5){_0x18ae06[_0x591c('0x2c')]=_0x1b9bf5[_0x591c('0x66')]({'plain':!![]});return db[_0x591c('0x67')][_0x591c('0x59')]({'where':{'id':_0x1b9bf5[_0x591c('0x68')]}});}return null;})[_0x591c('0x23')](handleEntityNotFound(_0x338467,null))['then'](function(_0x407e2c){if(_0x407e2c){return _0x407e2c['update']({'UserId':_0x50e702[_0x591c('0x5b')][_0x591c('0x64')],'read1stAt':_[_0x591c('0x69')](_0x407e2c[_0x591c('0x6a')])?moment()['format'](_0x591c('0x63')):undefined});}return null;})[_0x591c('0x23')](function(_0x286292){if(_0x286292){_0x18ae06[_0x591c('0x6b')]=_0x286292['get']({'plain':!![]});interaction_log[_0x591c('0x24')](_0x591c('0x6c'),_0x50e702[_0x591c('0x65')]['id'],_0x50e702[_0x591c('0x65')]['name'],_0x50e702[_0x591c('0x65')][_0x591c('0x6d')],_0x18ae06[_0x591c('0x6b')]['id'],_0x50e702['body']?JSON[_0x591c('0x29')](_0x50e702[_0x591c('0x5b')]):'null');return respondWithRpcPromise(_0x591c('0x6e'),_0x591c('0x6f'),_0x18ae06);}return null;})[_0x591c('0x23')](function(_0x448054){var _0x12fd37=_0x591c('0x70')+_0x448054[_0x591c('0x2c')][_0x591c('0x71')];return db[_0x591c('0x72')][_0x591c('0x44')](_0x12fd37,{'type':db[_0x591c('0x73')]['QueryTypes'][_0x591c('0x74')],'raw':!![]})[_0x591c('0x23')](function(_0xe2ec6e){return _0xe2ec6e;});})[_0x591c('0x23')](function(_0x37c87b){if(_0x37c87b){_0x18ae06['message'][_0x591c('0x75')]=_0x37c87b[0x0];if(!_0x50e702[_0x591c('0x5b')]['UserId'])return;return db[_0x591c('0x76')]['find']({'where':{'id':_0x50e702[_0x591c('0x5b')][_0x591c('0x64')],'role':_0x591c('0x77')},'attributes':['id',_0x591c('0x3b'),_0x591c('0x78'),_0x591c('0x79'),_0x591c('0x7a')],'raw':!![]});}return null;})[_0x591c('0x23')](function(_0xbb191d){if(!_0xbb191d)return null;_0x18ae06[_0x591c('0x2c')]['agent']=_0xbb191d;return _0x18ae06;})[_0x591c('0x23')](function(_0x2243d6){if(_0x2243d6){if(_0x50e702[_0x591c('0x5b')][_0x591c('0x7b')]){_0x18ae06[_0x591c('0x2c')]['interface']=util[_0x591c('0x62')](_0x591c('0x7c'),_0x50e702[_0x591c('0x65')][_0x591c('0x3b')]);_0x18ae06[_0x591c('0x2c')][_0x591c('0x7d')]=_0x18ae06[_0x591c('0x7d')];_0x18ae06[_0x591c('0x2c')]['motionChannel']=_0x18ae06[_0x591c('0x7d')];_0x18ae06[_0x591c('0x2c')][_0x591c('0x7e')]=_0x591c('0x5f');return respondWithRpcPromise(_0x591c('0x7f'),_0x591c('0x7f'),{'event':'acceptmessage','message':_0x18ae06[_0x591c('0x2c')]},client9002)[_0x591c('0x23')](function(){return _0x18ae06;});}return _0x18ae06;}return null;})['then'](respondWithResult(_0x338467,null))[_0x591c('0x2e')](handleError(_0x338467,null));};var interaction_log=require(_0x591c('0x15'))('whatsapp-interactions');exports[_0x591c('0x80')]=function(_0x12a7c0,_0xae674e,_0x322c94){var _0x122f9f={'agent':{},'channel':_0x591c('0x60')};if(_0x12a7c0[_0x591c('0x5b')]['id']){delete _0x12a7c0[_0x591c('0x5b')]['id'];}_0x12a7c0[_0x591c('0x5b')][_0x591c('0x64')]=_0x12a7c0['body'][_0x591c('0x64')]||_0x12a7c0[_0x591c('0x65')]['id'];_0x122f9f[_0x591c('0x77')]['id']=_0x12a7c0[_0x591c('0x5b')][_0x591c('0x64')];return db['WhatsappMessage']['find']({'where':{'id':_0x12a7c0[_0x591c('0x57')]['id'],'UserId':null}})[_0x591c('0x23')](handleEntityNotFound(_0xae674e,null))[_0x591c('0x23')](function(_0x284e87){if(_0x284e87){_0x122f9f[_0x591c('0x2c')]=_0x284e87['get']({'plain':!![]});return db[_0x591c('0x67')][_0x591c('0x59')]({'where':{'id':_0x284e87[_0x591c('0x68')]}});}return null;})[_0x591c('0x23')](handleEntityNotFound(_0xae674e,null))[_0x591c('0x23')](function(_0x50198c){if(_0x50198c){_0x122f9f[_0x591c('0x6b')]=_0x50198c['get']({'plain':!![]});interaction_log[_0x591c('0x24')](_0x591c('0x81'),_0x12a7c0[_0x591c('0x65')]['id'],_0x12a7c0[_0x591c('0x65')][_0x591c('0x3b')],_0x12a7c0[_0x591c('0x65')][_0x591c('0x6d')],_0x122f9f[_0x591c('0x6b')]['id'],_0x12a7c0[_0x591c('0x5b')]?JSON[_0x591c('0x29')](_0x12a7c0[_0x591c('0x5b')]):_0x591c('0x82'));return respondWithRpcPromise('RejectMessage',_0x591c('0x83'),_0x122f9f);}return null;})[_0x591c('0x23')](function(_0x5e4a98){var _0x1f3017='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e4a98[_0x591c('0x2c')]['ContactId'];return db[_0x591c('0x72')][_0x591c('0x44')](_0x1f3017,{'type':db[_0x591c('0x73')][_0x591c('0x84')]['SELECT'],'raw':!![]})[_0x591c('0x23')](function(_0x9f2888){return _0x9f2888;});})['then'](function(_0x208647){if(_0x208647){_0x122f9f[_0x591c('0x2c')]['contact']=_0x208647[0x0];if(!_0x12a7c0[_0x591c('0x5b')]['UserId'])return;return db[_0x591c('0x76')]['find']({'where':{'id':_0x12a7c0[_0x591c('0x5b')][_0x591c('0x64')],'role':_0x591c('0x77')},'attributes':['id',_0x591c('0x3b'),'fullname','email',_0x591c('0x7a')],'raw':!![]});}return null;})[_0x591c('0x23')](function(_0x42a23d){if(!_0x42a23d)return null;_0x122f9f[_0x591c('0x2c')][_0x591c('0x77')]=_0x42a23d;return _0x122f9f;})['then'](function(_0x5ba949){if(_0x5ba949){_0x5ba949[_0x591c('0x2c')]['interface']=util[_0x591c('0x62')]('SIP/%s',_0x12a7c0[_0x591c('0x65')]['name']);_0x5ba949[_0x591c('0x2c')][_0x591c('0x7d')]=_0x122f9f['channel'];_0x5ba949[_0x591c('0x2c')][_0x591c('0x85')]=_0x122f9f[_0x591c('0x7d')];_0x5ba949[_0x591c('0x2c')][_0x591c('0x7e')]='reject';respondWithRpcPromise(_0x591c('0x7f'),'EventManager',{'event':_0x591c('0x86'),'message':_0x5ba949[_0x591c('0x2c')]},client9002);return _0x122f9f;}return null;})[_0x591c('0x23')](respondWithResult(_0xae674e,null))['catch'](handleError(_0xae674e,null));};exports[_0x591c('0x2f')]=function(_0x410ce5,_0x716882,_0x182642){if(_0x410ce5[_0x591c('0x5b')]['id']){delete _0x410ce5[_0x591c('0x5b')]['id'];}var _0x20afe9;return db['WhatsappMessage']['find']({'where':{'id':_0x410ce5[_0x591c('0x57')]['id']}})['then'](handleEntityNotFound(_0x716882,null))['then'](function(_0x5643e9){if(_0x5643e9){_0x20afe9=_0x5643e9;return db[_0x591c('0x87')][_0x591c('0x59')]({'where':{'id':_0x5643e9[_0x591c('0x88')]}});}})[_0x591c('0x23')](handleEntityNotFound(_0x716882,null))[_0x591c('0x23')](function(_0x329f18){if(_0x329f18){logger[_0x591c('0x27')](_0x591c('0x89'),_0x591c('0x2f'),_0x591c('0x8a'),_0x329f18[_0x591c('0x41')],util[_0x591c('0x8b')](_0x410ce5['body'],{'showHidden':![],'depth':null}));switch(_0x329f18['type']){case _0x591c('0x8c'):if(_0x410ce5[_0x591c('0x5b')][_0x591c('0x8d')]&&_0x410ce5[_0x591c('0x5b')][_0x591c('0x8d')]===_0x20afe9[_0x591c('0x8e')]&&_0x410ce5[_0x591c('0x5b')]['MessageStatus']&&_0x410ce5[_0x591c('0x5b')][_0x591c('0x8f')]===_0x591c('0x61')){return _0x20afe9[_0x591c('0x39')]({'read':!![]});}else{logger[_0x591c('0x2a')](_0x591c('0x90'),_0x591c('0x2f'),_0x591c('0x8c'),util['inspect'](_0x410ce5['body'],{'showHidden':![],'depth':null}));}break;}return _0x20afe9;}})[_0x591c('0x23')](respondWithResult(_0x716882,null))['catch'](handleError(_0x716882,null));}; \ No newline at end of file +var _0x2532=['stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','filters','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','intersection','length','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','contact','User','agent','email','SIP/%s','channel','motionChannel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','sequelize','Sequelize','SELECT','fullname','internal','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','client','http','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x5f3e72,_0x3ff8e0){var _0x4bc542=function(_0x55091c){while(--_0x55091c){_0x5f3e72['push'](_0x5f3e72['shift']());}};_0x4bc542(++_0x3ff8e0);}(_0x2532,0x69));var _0x2253=function(_0x378a29,_0x65d651){_0x378a29=_0x378a29-0x0;var _0x27af2f=_0x2532[_0x378a29];return _0x27af2f;};'use strict';var emlformat=require(_0x2253('0x0'));var rimraf=require(_0x2253('0x1'));var zipdir=require(_0x2253('0x2'));var jsonpatch=require(_0x2253('0x3'));var rp=require(_0x2253('0x4'));var moment=require(_0x2253('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2253('0x6'));var csv=require(_0x2253('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2253('0x8'));var jsforce=require(_0x2253('0x9'));var deskjs=require(_0x2253('0xa'));var toCsv=require(_0x2253('0x7'));var querystring=require(_0x2253('0xb'));var Papa=require(_0x2253('0xc'));var Redis=require('ioredis');var authService=require(_0x2253('0xd'));var qs=require(_0x2253('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2253('0xf'));var logger=require(_0x2253('0x10'))(_0x2253('0x11'));var utils=require(_0x2253('0x12'));var config=require(_0x2253('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2253('0x14'))['db'];config[_0x2253('0x15')]=_[_0x2253('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2253('0x17'))(new Redis(config[_0x2253('0x15')]));require(_0x2253('0x18'))[_0x2253('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2253('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x2253('0x1a')][_0x2253('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x53f379,_0x12bb7a,_0x596f1b,_0x2809e9){return new BPromise(function(_0x21e6af,_0x17a539){var _0x149755=_0x2809e9||client;return _0x149755['request'](_0x53f379,_0x596f1b)['then'](function(_0x7cbce5){logger[_0x2253('0x1c')]('WhatsappMessage,\x20%s,\x20%s',_0x12bb7a,_0x2253('0x1d'));logger['debug'](_0x2253('0x1e'),_0x12bb7a,_0x2253('0x1d'),JSON[_0x2253('0x1f')](_0x7cbce5));if(_0x7cbce5['error']){if(_0x7cbce5[_0x2253('0x20')][_0x2253('0x21')]===0x1f4){logger[_0x2253('0x20')](_0x2253('0x22'),_0x12bb7a,_0x7cbce5[_0x2253('0x20')][_0x2253('0x23')]);return _0x17a539(_0x7cbce5['error'][_0x2253('0x23')]);}logger[_0x2253('0x20')](_0x2253('0x22'),_0x12bb7a,_0x7cbce5[_0x2253('0x20')][_0x2253('0x23')]);return _0x21e6af(_0x7cbce5[_0x2253('0x20')]['message']);}else{logger[_0x2253('0x1c')]('WhatsappMessage,\x20%s,\x20%s',_0x12bb7a,_0x2253('0x1d'));_0x21e6af(_0x7cbce5[_0x2253('0x24')]['message']);}})[_0x2253('0x25')](function(_0x2f28ea){logger[_0x2253('0x20')](_0x2253('0x22'),_0x12bb7a,_0x2f28ea);_0x17a539(_0x2f28ea);});});}function respondWithStatusCode(_0x2624c6,_0xf2d8de){_0xf2d8de=_0xf2d8de||0xcc;return function(_0xb962ec){if(_0xb962ec){return _0x2624c6[_0x2253('0x26')](_0xf2d8de);}return _0x2624c6[_0x2253('0x27')](_0xf2d8de)['end']();};}function respondWithResult(_0x4bd3be,_0x308515){_0x308515=_0x308515||0xc8;return function(_0x551a35){if(_0x551a35){return _0x4bd3be['status'](_0x308515)[_0x2253('0x28')](_0x551a35);}};}function respondWithFilteredResult(_0xae9c74,_0x29daa8){return function(_0x1520f5){if(_0x1520f5){var _0x177824=typeof _0x29daa8[_0x2253('0x29')]==='undefined'&&typeof _0x29daa8[_0x2253('0x2a')]===_0x2253('0x2b');var _0x5f02b2=_0x1520f5['count'];var _0x43860a=_0x177824?0x0:_0x29daa8[_0x2253('0x29')];var _0x5cccb0=_0x177824?_0x1520f5[_0x2253('0x2c')]:_0x29daa8[_0x2253('0x29')]+_0x29daa8[_0x2253('0x2a')];var _0x64d468;if(_0x5cccb0>=_0x5f02b2){_0x5cccb0=_0x5f02b2;_0x64d468=0xc8;}else{_0x64d468=0xce;}_0xae9c74[_0x2253('0x27')](_0x64d468);return _0xae9c74[_0x2253('0x2d')](_0x2253('0x2e'),_0x43860a+'-'+_0x5cccb0+'/'+_0x5f02b2)[_0x2253('0x28')](_0x1520f5);}return null;};}function patchUpdates(_0x4edaf7){return function(_0x1dd6a5){try{jsonpatch[_0x2253('0x2f')](_0x1dd6a5,_0x4edaf7,!![]);}catch(_0x392b65){return BPromise[_0x2253('0x30')](_0x392b65);}return _0x1dd6a5[_0x2253('0x31')]();};}function saveUpdates(_0x420154,_0x76dd64){return function(_0x4f9bb8){if(_0x4f9bb8){return _0x4f9bb8[_0x2253('0x32')](_0x420154)[_0x2253('0x33')](function(_0x5cf99d){return _0x5cf99d;});}return null;};}function removeEntity(_0x15d1cf,_0x56cd42){return function(_0xeefb4b){if(_0xeefb4b){return _0xeefb4b[_0x2253('0x34')]()['then'](function(){_0x15d1cf[_0x2253('0x27')](0xcc)[_0x2253('0x35')]();});}};}function handleEntityNotFound(_0x370fdf,_0x42ceae){return function(_0x4d0404){if(!_0x4d0404){_0x370fdf['sendStatus'](0x194);}return _0x4d0404;};}function handleError(_0x42a359,_0x19e4fa){_0x19e4fa=_0x19e4fa||0x1f4;return function(_0x62065f){logger[_0x2253('0x20')](_0x62065f[_0x2253('0x36')]);if(_0x62065f[_0x2253('0x37')]){delete _0x62065f[_0x2253('0x37')];}_0x42a359[_0x2253('0x27')](_0x19e4fa)[_0x2253('0x38')](_0x62065f);};}exports[_0x2253('0x39')]=function(_0x2a1e75,_0xc2bbd8){var _0x37302f={},_0x754323={},_0x495ebe={'count':0x0,'rows':[]};var _0x437871=_[_0x2253('0x3a')](db[_0x2253('0x3b')]['rawAttributes'],function(_0x2b9d0c){return{'name':_0x2b9d0c[_0x2253('0x3c')],'type':_0x2b9d0c[_0x2253('0x3d')][_0x2253('0x3e')]};});_0x754323[_0x2253('0x3f')]=_['map'](_0x437871,_0x2253('0x37'));_0x754323[_0x2253('0x40')]=_['keys'](_0x2a1e75['query']);_0x754323[_0x2253('0x41')]=_['intersection'](_0x754323['model'],_0x754323[_0x2253('0x40')]);_0x37302f['attributes']=_['intersection'](_0x754323['model'],qs[_0x2253('0x42')](_0x2a1e75['query'][_0x2253('0x42')]));_0x37302f['attributes']=_0x37302f[_0x2253('0x43')]['length']?_0x37302f['attributes']:_0x754323[_0x2253('0x3f')];if(!_0x2a1e75[_0x2253('0x40')][_0x2253('0x44')]('nolimit')){_0x37302f[_0x2253('0x2a')]=qs[_0x2253('0x2a')](_0x2a1e75[_0x2253('0x40')][_0x2253('0x2a')]);_0x37302f[_0x2253('0x29')]=qs[_0x2253('0x29')](_0x2a1e75[_0x2253('0x40')][_0x2253('0x29')]);}_0x37302f['order']=qs[_0x2253('0x45')](_0x2a1e75[_0x2253('0x40')]['sort']);_0x37302f[_0x2253('0x46')]=qs[_0x2253('0x41')](_[_0x2253('0x47')](_0x2a1e75[_0x2253('0x40')],_0x754323[_0x2253('0x41')]),_0x437871);if(_0x2a1e75[_0x2253('0x40')][_0x2253('0x48')]){_0x37302f[_0x2253('0x46')]=_[_0x2253('0x49')](_0x37302f[_0x2253('0x46')],{'$or':_[_0x2253('0x3a')](_0x437871,function(_0x885e27){if(_0x885e27['type']!==_0x2253('0x4a')){var _0x5330cc={};_0x5330cc[_0x885e27[_0x2253('0x37')]]={'$like':'%'+_0x2a1e75[_0x2253('0x40')][_0x2253('0x48')]+'%'};return _0x5330cc;}})});}_0x37302f=_[_0x2253('0x49')]({},_0x37302f,_0x2a1e75[_0x2253('0x4b')]);var _0x30d6e7={'where':_0x37302f['where']};return db[_0x2253('0x3b')][_0x2253('0x2c')](_0x30d6e7)[_0x2253('0x33')](function(_0x218640){_0x495ebe['count']=_0x218640;if(_0x2a1e75[_0x2253('0x40')][_0x2253('0x4c')]){_0x37302f[_0x2253('0x4d')]=[{'all':!![]}];}return db[_0x2253('0x3b')][_0x2253('0x4e')](_0x37302f);})[_0x2253('0x33')](function(_0x356772){_0x495ebe[_0x2253('0x4f')]=_0x356772;return _0x495ebe;})[_0x2253('0x33')](respondWithFilteredResult(_0xc2bbd8,_0x37302f))['catch'](handleError(_0xc2bbd8,null));};exports['show']=function(_0x5f2e3b,_0xe16bea){var _0x1d000b={'raw':!![],'where':{'id':_0x5f2e3b[_0x2253('0x50')]['id']}},_0xae98bb={};_0xae98bb[_0x2253('0x3f')]=_[_0x2253('0x51')](db[_0x2253('0x3b')][_0x2253('0x52')]);_0xae98bb['query']=_[_0x2253('0x51')](_0x5f2e3b[_0x2253('0x40')]);_0xae98bb[_0x2253('0x41')]=_[_0x2253('0x53')](_0xae98bb[_0x2253('0x3f')],_0xae98bb[_0x2253('0x40')]);_0x1d000b[_0x2253('0x43')]=_[_0x2253('0x53')](_0xae98bb[_0x2253('0x3f')],qs[_0x2253('0x42')](_0x5f2e3b[_0x2253('0x40')][_0x2253('0x42')]));_0x1d000b['attributes']=_0x1d000b[_0x2253('0x43')][_0x2253('0x54')]?_0x1d000b[_0x2253('0x43')]:_0xae98bb['model'];if(_0x5f2e3b[_0x2253('0x40')]['includeAll']){_0x1d000b['include']=[{'all':!![]}];}_0x1d000b=_['merge']({},_0x1d000b,_0x5f2e3b[_0x2253('0x4b')]);return db[_0x2253('0x3b')]['find'](_0x1d000b)[_0x2253('0x33')](handleEntityNotFound(_0xe16bea,null))[_0x2253('0x33')](respondWithResult(_0xe16bea,null))[_0x2253('0x25')](handleError(_0xe16bea,null));};exports[_0x2253('0x55')]=function(_0x1949af,_0x5054c6){return db[_0x2253('0x3b')][_0x2253('0x55')](_0x1949af['body'],{})[_0x2253('0x33')](respondWithResult(_0x5054c6,0xc9))[_0x2253('0x25')](handleError(_0x5054c6,null));};exports['update']=function(_0x5535c8,_0x463711){if(_0x5535c8[_0x2253('0x56')]['id']){delete _0x5535c8[_0x2253('0x56')]['id'];}return db['WhatsappMessage'][_0x2253('0x57')]({'where':{'id':_0x5535c8[_0x2253('0x50')]['id']}})['then'](handleEntityNotFound(_0x463711,null))[_0x2253('0x33')](saveUpdates(_0x5535c8[_0x2253('0x56')],null))[_0x2253('0x33')](respondWithResult(_0x463711,null))[_0x2253('0x25')](handleError(_0x463711,null));};exports['destroy']=function(_0x40dcae,_0x44ed95){return db[_0x2253('0x3b')][_0x2253('0x57')]({'where':{'id':_0x40dcae['params']['id']}})[_0x2253('0x33')](handleEntityNotFound(_0x44ed95,null))[_0x2253('0x33')](removeEntity(_0x44ed95,null))[_0x2253('0x25')](handleError(_0x44ed95,null));};exports[_0x2253('0x58')]=function(_0x335811,_0x44b250){return db[_0x2253('0x3b')][_0x2253('0x58')]()['then'](respondWithResult(_0x44b250,null))[_0x2253('0x25')](handleError(_0x44b250,null));};var interaction_log=require(_0x2253('0x10'))(_0x2253('0x59'));exports[_0x2253('0x5a')]=function(_0x4a31a1,_0x2d6b50,_0x3f5913){var _0x56990e={'agent':{},'channel':_0x2253('0x5b')};if(_0x4a31a1[_0x2253('0x56')]['id']){delete _0x4a31a1['body']['id'];}_0x4a31a1['body'][_0x2253('0x5c')]=!![];_0x4a31a1[_0x2253('0x56')][_0x2253('0x5d')]=moment()[_0x2253('0x5e')](_0x2253('0x5f'));_0x4a31a1[_0x2253('0x56')]['UserId']=_0x4a31a1['body'][_0x2253('0x60')]||_0x4a31a1[_0x2253('0x61')]['id'];_0x56990e['agent']['id']=_0x4a31a1[_0x2253('0x56')][_0x2253('0x60')];return db['WhatsappMessage'][_0x2253('0x57')]({'where':{'id':_0x4a31a1[_0x2253('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d6b50,null))[_0x2253('0x33')](saveUpdates(_0x4a31a1[_0x2253('0x56')],null))['then'](function(_0x2ea632){if(_0x2ea632){_0x56990e[_0x2253('0x23')]=_0x2ea632[_0x2253('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0x2253('0x57')]({'where':{'id':_0x2ea632[_0x2253('0x63')]}});}return null;})[_0x2253('0x33')](handleEntityNotFound(_0x2d6b50,null))['then'](function(_0x3a781c){if(_0x3a781c){return _0x3a781c[_0x2253('0x32')]({'UserId':_0x4a31a1['body']['UserId'],'read1stAt':_[_0x2253('0x64')](_0x3a781c[_0x2253('0x65')])?moment()[_0x2253('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4b6748){if(_0x4b6748){_0x56990e[_0x2253('0x66')]=_0x4b6748['get']({'plain':!![]});interaction_log[_0x2253('0x1c')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a31a1[_0x2253('0x61')]['id'],_0x4a31a1[_0x2253('0x61')]['name'],_0x4a31a1[_0x2253('0x61')]['role'],_0x56990e[_0x2253('0x66')]['id'],_0x4a31a1[_0x2253('0x56')]?JSON[_0x2253('0x1f')](_0x4a31a1['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x2253('0x67'),_0x56990e);}return null;})[_0x2253('0x33')](function(_0x2430dc){var _0x436d0a=_0x2253('0x68')+_0x2430dc['message'][_0x2253('0x69')];return db['sequelize'][_0x2253('0x40')](_0x436d0a,{'type':db['Sequelize'][_0x2253('0x6a')]['SELECT'],'raw':!![]})[_0x2253('0x33')](function(_0x4e5305){return _0x4e5305;});})[_0x2253('0x33')](function(_0x4172be){if(_0x4172be){_0x56990e[_0x2253('0x23')][_0x2253('0x6b')]=_0x4172be[0x0];if(!_0x4a31a1[_0x2253('0x56')][_0x2253('0x60')])return;return db[_0x2253('0x6c')][_0x2253('0x57')]({'where':{'id':_0x4a31a1['body'][_0x2253('0x60')],'role':_0x2253('0x6d')},'attributes':['id',_0x2253('0x37'),'fullname',_0x2253('0x6e'),'internal'],'raw':!![]});}return null;})[_0x2253('0x33')](function(_0x3d9412){if(!_0x3d9412)return null;_0x56990e[_0x2253('0x23')][_0x2253('0x6d')]=_0x3d9412;return _0x56990e;})[_0x2253('0x33')](function(_0x16d63a){if(_0x16d63a){if(_0x4a31a1['body']['manual']){_0x56990e['message']['interface']=util[_0x2253('0x5e')](_0x2253('0x6f'),_0x4a31a1[_0x2253('0x61')]['name']);_0x56990e[_0x2253('0x23')][_0x2253('0x70')]=_0x56990e['channel'];_0x56990e[_0x2253('0x23')][_0x2253('0x71')]=_0x56990e[_0x2253('0x70')];_0x56990e[_0x2253('0x23')][_0x2253('0x72')]=_0x2253('0x5a');return respondWithRpcPromise(_0x2253('0x73'),'EventManager',{'event':'acceptmessage','message':_0x56990e[_0x2253('0x23')]},client9002)[_0x2253('0x33')](function(){return _0x56990e;});}return _0x56990e;}return null;})[_0x2253('0x33')](respondWithResult(_0x2d6b50,null))[_0x2253('0x25')](handleError(_0x2d6b50,null));};var interaction_log=require(_0x2253('0x10'))(_0x2253('0x59'));exports[_0x2253('0x30')]=function(_0x26660a,_0x303e8d,_0x2db8fd){var _0x50b000={'agent':{},'channel':_0x2253('0x5b')};if(_0x26660a['body']['id']){delete _0x26660a[_0x2253('0x56')]['id'];}_0x26660a[_0x2253('0x56')]['UserId']=_0x26660a[_0x2253('0x56')][_0x2253('0x60')]||_0x26660a['user']['id'];_0x50b000[_0x2253('0x6d')]['id']=_0x26660a['body'][_0x2253('0x60')];return db[_0x2253('0x3b')][_0x2253('0x57')]({'where':{'id':_0x26660a[_0x2253('0x50')]['id'],'UserId':null}})[_0x2253('0x33')](handleEntityNotFound(_0x303e8d,null))[_0x2253('0x33')](function(_0x516315){if(_0x516315){_0x50b000[_0x2253('0x23')]=_0x516315[_0x2253('0x62')]({'plain':!![]});return db[_0x2253('0x74')][_0x2253('0x57')]({'where':{'id':_0x516315['WhatsappInteractionId']}});}return null;})[_0x2253('0x33')](handleEntityNotFound(_0x303e8d,null))['then'](function(_0x247b66){if(_0x247b66){_0x50b000[_0x2253('0x66')]=_0x247b66[_0x2253('0x62')]({'plain':!![]});interaction_log[_0x2253('0x1c')](_0x2253('0x75'),_0x26660a['user']['id'],_0x26660a['user'][_0x2253('0x37')],_0x26660a['user'][_0x2253('0x76')],_0x50b000['interaction']['id'],_0x26660a[_0x2253('0x56')]?JSON[_0x2253('0x1f')](_0x26660a[_0x2253('0x56')]):_0x2253('0x77'));return respondWithRpcPromise('RejectMessage',_0x2253('0x78'),_0x50b000);}return null;})[_0x2253('0x33')](function(_0x5f20d4){var _0x11dd87='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f20d4[_0x2253('0x23')]['ContactId'];return db[_0x2253('0x79')]['query'](_0x11dd87,{'type':db[_0x2253('0x7a')][_0x2253('0x6a')][_0x2253('0x7b')],'raw':!![]})[_0x2253('0x33')](function(_0x2b2f31){return _0x2b2f31;});})[_0x2253('0x33')](function(_0x19d861){if(_0x19d861){_0x50b000['message'][_0x2253('0x6b')]=_0x19d861[0x0];if(!_0x26660a[_0x2253('0x56')]['UserId'])return;return db[_0x2253('0x6c')][_0x2253('0x57')]({'where':{'id':_0x26660a[_0x2253('0x56')][_0x2253('0x60')],'role':_0x2253('0x6d')},'attributes':['id',_0x2253('0x37'),_0x2253('0x7c'),_0x2253('0x6e'),_0x2253('0x7d')],'raw':!![]});}return null;})['then'](function(_0x5eb088){if(!_0x5eb088)return null;_0x50b000['message'][_0x2253('0x6d')]=_0x5eb088;return _0x50b000;})['then'](function(_0x5e53b3){if(_0x5e53b3){_0x5e53b3['message']['interface']=util['format'](_0x2253('0x6f'),_0x26660a['user'][_0x2253('0x37')]);_0x5e53b3[_0x2253('0x23')][_0x2253('0x70')]=_0x50b000[_0x2253('0x70')];_0x5e53b3[_0x2253('0x23')]['motionChannel']=_0x50b000[_0x2253('0x70')];_0x5e53b3[_0x2253('0x23')][_0x2253('0x72')]=_0x2253('0x30');respondWithRpcPromise(_0x2253('0x73'),_0x2253('0x73'),{'event':_0x2253('0x7e'),'message':_0x5e53b3['message']},client9002);return _0x50b000;}return null;})[_0x2253('0x33')](respondWithResult(_0x303e8d,null))[_0x2253('0x25')](handleError(_0x303e8d,null));};exports[_0x2253('0x27')]=function(_0x4c1299,_0x58abb4,_0x143a9f){if(_0x4c1299[_0x2253('0x56')]['id']){delete _0x4c1299[_0x2253('0x56')]['id'];}var _0x472e6c;return db[_0x2253('0x3b')][_0x2253('0x57')]({'where':{'id':_0x4c1299['params']['id']}})[_0x2253('0x33')](handleEntityNotFound(_0x58abb4,null))[_0x2253('0x33')](function(_0x332c46){if(_0x332c46){_0x472e6c=_0x332c46;return db['WhatsappAccount'][_0x2253('0x57')]({'where':{'id':_0x332c46[_0x2253('0x7f')]}});}})['then'](handleEntityNotFound(_0x58abb4,null))[_0x2253('0x33')](function(_0x391401){if(_0x391401){logger['debug'](_0x2253('0x80'),_0x2253('0x27'),_0x2253('0x81'),_0x391401['type'],util[_0x2253('0x82')](_0x4c1299[_0x2253('0x56')],{'showHidden':![],'depth':null}));switch(_0x391401['type']){case _0x2253('0x83'):if(_0x4c1299[_0x2253('0x56')][_0x2253('0x84')]&&_0x4c1299[_0x2253('0x56')][_0x2253('0x84')]===_0x472e6c[_0x2253('0x85')]&&_0x4c1299[_0x2253('0x56')][_0x2253('0x86')]&&_0x4c1299['body'][_0x2253('0x86')]===_0x2253('0x5c')){return _0x472e6c[_0x2253('0x32')]({'read':!![]});}else{logger['error'](_0x2253('0x87'),'status','twilio',util[_0x2253('0x82')](_0x4c1299['body'],{'showHidden':![],'depth':null}));}break;}return _0x472e6c;}})[_0x2253('0x33')](respondWithResult(_0x58abb4,null))['catch'](handleError(_0x58abb4,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 49fd793..0880db5 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 _0x351d=['events','WhatsappMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x859a3a,_0x2864cd){var _0x48e4f0=function(_0x2dc3c1){while(--_0x2dc3c1){_0x859a3a['push'](_0x859a3a['shift']());}};_0x48e4f0(++_0x2864cd);}(_0x351d,0x90));var _0xd351=function(_0xdacf14,_0x257a3a){_0xdacf14=_0xdacf14-0x0;var _0x36d2cd=_0x351d[_0xdacf14];return _0x36d2cd;};'use strict';var EventEmitter=require(_0xd351('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xd351('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd351('0x2')](0x0);var events={'afterCreate':_0xd351('0x3'),'afterUpdate':'update','afterDestroy':_0xd351('0x4')};function emitEvent(_0x48f60e){return function(_0x41d16d,_0x151391,_0x49610f){WhatsappMessageEvents[_0xd351('0x5')](_0x48f60e+':'+_0x41d16d['id'],_0x41d16d);WhatsappMessageEvents[_0xd351('0x5')](_0x48f60e,_0x41d16d);_0x49610f(null);};}for(var e in events){if(events[_0xd351('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xd351('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xd757=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x4287bd,_0x4b6c73){var _0x7a7d4b=function(_0x43a825){while(--_0x43a825){_0x4287bd['push'](_0x4287bd['shift']());}};_0x7a7d4b(++_0x4b6c73);}(_0xd757,0x1e5));var _0x7d75=function(_0x4e17b2,_0x51f630){_0x4e17b2=_0x4e17b2-0x0;var _0xef5233=_0xd757[_0x4e17b2];return _0xef5233;};'use strict';var EventEmitter=require(_0x7d75('0x0'));var WhatsappMessage=require(_0x7d75('0x1'))['db'][_0x7d75('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7d75('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7d75('0x4')};function emitEvent(_0x2772a3){return function(_0x5e4a4c,_0xa7df66,_0x10d11a){WhatsappMessageEvents[_0x7d75('0x5')](_0x2772a3+':'+_0x5e4a4c['id'],_0x5e4a4c);WhatsappMessageEvents['emit'](_0x2772a3,_0x5e4a4c);_0x10d11a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x7d75('0x6')](e,emitEvent(event));}}module[_0x7d75('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 88f4eb8..1c0bb88 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 _0x3819=['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','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','then','update','createdAt','catch','error','out','WhatsappAccount','find','type','twilio','accountSid','authToken','phone'];(function(_0x55309e,_0x5f3918){var _0x2eb393=function(_0x2c7971){while(--_0x2c7971){_0x55309e['push'](_0x55309e['shift']());}};_0x2eb393(++_0x5f3918);}(_0x3819,0x83));var _0x9381=function(_0x15419f,_0x415967){_0x15419f=_0x15419f-0x0;var _0x3f7973=_0x3819[_0x15419f];return _0x3f7973;};'use strict';var _=require('lodash');var util=require(_0x9381('0x0'));var logger=require('../../config/logger')(_0x9381('0x1'));var moment=require(_0x9381('0x2'));var BPromise=require(_0x9381('0x3'));var rp=require(_0x9381('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0x9381('0x5'));var config=require(_0x9381('0x6'));var attributes=require(_0x9381('0x7'));module[_0x9381('0x8')]=function(_0x52577f,_0x508d28){return _0x52577f[_0x9381('0x9')](_0x9381('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9381('0xb')]},{'name':_0x9381('0xc'),'fields':['body'],'type':_0x9381('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2357d6,_0x3e3443,_0x50b0c3){var _0x507623=_0x52577f[_0x9381('0xe')];var _0x287d41=_0x2357d6['get']({'plain':!![]});if(_0x287d41[_0x9381('0xf')]['toLowerCase']()==='in'||_0x287d41[_0x9381('0xf')][_0x9381('0x10')]()==='out'&&!_0x287d41[_0x9381('0x11')]&&!_[_0x9381('0x12')](_0x287d41[_0x9381('0x13')])){_0x507623[_0x9381('0x14')]['findOne']({'where':{'id':_0x287d41['WhatsappInteractionId']}})[_0x9381('0x15')](function(_0x3f693b){if(_0x3f693b){_0x3f693b[_0x9381('0x16')]({'lastMsgAt':_0x287d41[_0x9381('0x17')],'lastMsgDirection':_0x287d41[_0x9381('0xf')][_0x9381('0x10')]()});}})[_0x9381('0x18')](function(_0x2afb52){console[_0x9381('0x19')](_0x2afb52);});}if(_0x287d41[_0x9381('0xf')]===_0x9381('0x1a')&&!_0x287d41[_0x9381('0x11')]){var _0x57afca;_0x507623[_0x9381('0x1b')][_0x9381('0x1c')]({'where':{'id':_0x287d41['WhatsappAccountId']},'raw':!![]})[_0x9381('0x15')](function(_0x18b7f3){_0x57afca=_0x18b7f3;if(_0x57afca&&_0x57afca[_0x9381('0x1d')]){switch(_0x57afca['type']){case _0x9381('0x1e'):var _0x38ac59=require(_0x9381('0x1e'));if(_0x57afca[_0x9381('0x1f')]&&_0x57afca[_0x9381('0x20')]&&_0x57afca[_0x9381('0x21')]){var _0xead05c=new _0x38ac59(_0x57afca[_0x9381('0x1f')],_0x57afca[_0x9381('0x20')]);_0xead05c[_0x9381('0x22')][_0x9381('0x23')]({'body':_0x287d41[_0x9381('0x24')],'to':_0x9381('0x25')+_0x287d41[_0x9381('0x21')],'from':_0x9381('0x25')+_0x57afca[_0x9381('0x21')],'statusCallback':_0x57afca[_0x9381('0x26')]+_0x9381('0x27')+_0x287d41['id']+_0x9381('0x28')+_0x57afca[_0x9381('0x29')]})[_0x9381('0x15')](function(_0x447551){if(_0x447551[_0x9381('0x2a')]){return _0x2357d6[_0x9381('0x16')]({'messageId':_0x447551[_0x9381('0x2a')]});}})[_0x9381('0x18')](function(_0x23403c){logger['error'](_0x9381('0x2b'),_0x9381('0x2c'),'twilio',util[_0x9381('0x2d')](_0x23403c,{'showHidden':![],'depth':null}));});}else{logger[_0x9381('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x9381('0x2c'),_0x9381('0x1e'),_0x9381('0x2e'));}break;case _0x9381('0x2f'):var _0x38a14c=_0x57afca['accountSid'];var _0xb8aade=_0x57afca[_0x9381('0x20')];var _0x24bc9c=_0x57afca['baseUrl']+'/whatsapp/v1/'+_0x38a14c+'/messages/';var _0xa79480={'to':[_0x287d41[_0x9381('0x21')]],'message':{'type':'text','text':_0x287d41['body']}};var _0x1e2bdc={'method':'POST','uri':_0x24bc9c,'headers':{'Authorization':'Bearer\x20'+_0xb8aade,'Content-Type':'application/json'},'body':_0xa79480,'json':!![]};rp(_0x1e2bdc)[_0x9381('0x15')](function(_0x5c5af8){if(_0x5c5af8[_0x9381('0x30')][0x0][_0x9381('0x31')]){return _0x2357d6[_0x9381('0x16')]({'messageId':_0x5c5af8[_0x9381('0x30')][0x0][_0x9381('0x31')]});}})[_0x9381('0x18')](function(_0x784942){logger[_0x9381('0x32')](_0x9381('0x33'),_0x784942);});break;}}})[_0x9381('0x34')](function(){_0x50b0c3();});}else{_0x50b0c3();}}},'charset':_0x9381('0x35'),'collate':_0x9381('0x36')});}; \ No newline at end of file +var _0x385a=['define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text','body','POST','application/json','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','node-fetch','path','rimraf'];(function(_0x3002ec,_0x44d659){var _0x4238af=function(_0x196d54){while(--_0x196d54){_0x3002ec['push'](_0x3002ec['shift']());}};_0x4238af(++_0x44d659);}(_0x385a,0xa4));var _0xa385=function(_0x484130,_0x12b9c7){_0x484130=_0x484130-0x0;var _0x44f645=_0x385a[_0x484130];return _0x44f645;};'use strict';var _=require('lodash');var util=require(_0xa385('0x0'));var logger=require(_0xa385('0x1'))(_0xa385('0x2'));var moment=require(_0xa385('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0xa385('0x4'));var fs=require('fs');var path=require(_0xa385('0x5'));var rimraf=require(_0xa385('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x3e4c26,_0x288595){return _0x3e4c26[_0xa385('0x7')](_0xa385('0x8'),attributes,{'tableName':_0xa385('0x9'),'paranoid':![],'indexes':[{'name':_0xa385('0xa'),'fields':['messageId']},{'name':_0xa385('0xb'),'fields':['body'],'type':_0xa385('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ce9d3,_0x3f5325,_0x133e08){var _0x232334=_0x3e4c26[_0xa385('0xd')];var _0x39058f=_0x3ce9d3[_0xa385('0xe')]({'plain':!![]});if(_0x39058f['direction'][_0xa385('0xf')]()==='in'||_0x39058f[_0xa385('0x10')][_0xa385('0xf')]()===_0xa385('0x11')&&!_0x39058f[_0xa385('0x12')]&&!_[_0xa385('0x13')](_0x39058f['UserId'])){_0x232334[_0xa385('0x14')][_0xa385('0x15')]({'where':{'id':_0x39058f[_0xa385('0x16')]}})[_0xa385('0x17')](function(_0x193f8e){if(_0x193f8e){_0x193f8e['update']({'lastMsgAt':_0x39058f[_0xa385('0x18')],'lastMsgDirection':_0x39058f[_0xa385('0x10')][_0xa385('0xf')]()});}})[_0xa385('0x19')](function(_0xbacd78){console[_0xa385('0x1a')](_0xbacd78);});}if(_0x39058f['direction']===_0xa385('0x11')&&!_0x39058f[_0xa385('0x12')]){var _0x364f2b;_0x232334['WhatsappAccount'][_0xa385('0x1b')]({'where':{'id':_0x39058f[_0xa385('0x1c')]},'raw':!![]})['then'](function(_0x2c8f74){_0x364f2b=_0x2c8f74;if(_0x364f2b&&_0x364f2b[_0xa385('0x1d')]){switch(_0x364f2b[_0xa385('0x1d')]){case _0xa385('0x1e'):var _0x136e9b=require(_0xa385('0x1e'));if(_0x364f2b[_0xa385('0x1f')]&&_0x364f2b[_0xa385('0x20')]&&_0x364f2b[_0xa385('0x21')]){var _0xc8ce48=new _0x136e9b(_0x364f2b[_0xa385('0x1f')],_0x364f2b[_0xa385('0x20')]);_0xc8ce48[_0xa385('0x22')][_0xa385('0x23')]({'body':_0x39058f['body'],'to':_0xa385('0x24')+_0x39058f['phone'],'from':_0xa385('0x24')+_0x364f2b[_0xa385('0x21')],'statusCallback':_0x364f2b[_0xa385('0x25')]+_0xa385('0x26')+_0x39058f['id']+'/status?token='+_0x364f2b['token']})[_0xa385('0x17')](function(_0x4b7256){if(_0x4b7256[_0xa385('0x27')]){return _0x3ce9d3[_0xa385('0x28')]({'messageId':_0x4b7256[_0xa385('0x27')]});}})[_0xa385('0x19')](function(_0xe8a6ef){logger[_0xa385('0x1a')](_0xa385('0x29'),'afterCreate',_0xa385('0x1e'),util[_0xa385('0x2a')](_0xe8a6ef,{'showHidden':![],'depth':null}));});}else{logger[_0xa385('0x1a')](_0xa385('0x29'),_0xa385('0x2b'),_0xa385('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xa385('0x2c'):var _0x44115e=_0x364f2b[_0xa385('0x1f')];var _0x51e824=_0x364f2b[_0xa385('0x20')];var _0xaa930b=_0x364f2b[_0xa385('0x2d')]+_0xa385('0x2e')+_0x44115e+_0xa385('0x2f');var _0x4b04fd={'to':[_0x39058f[_0xa385('0x21')]],'message':{'type':_0xa385('0x30'),'text':_0x39058f[_0xa385('0x31')]}};var _0x22ebef={'method':_0xa385('0x32'),'uri':_0xaa930b,'headers':{'Authorization':'Bearer\x20'+_0x51e824,'Content-Type':_0xa385('0x33')},'body':_0x4b04fd,'json':!![]};rp(_0x22ebef)[_0xa385('0x17')](function(_0x2183ff){if(_0x2183ff[_0xa385('0x34')][0x0][_0xa385('0x35')]){return _0x3ce9d3[_0xa385('0x28')]({'messageId':_0x2183ff[_0xa385('0x34')][0x0][_0xa385('0x35')]});}})[_0xa385('0x19')](function(_0x13242b){logger['err'](_0xa385('0x36'),_0x13242b);});break;}}})['finally'](function(){_0x133e08();});}else{_0x133e08();}}},'charset':_0xa385('0x37'),'collate':_0xa385('0x38')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 09d1d32..9765005 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 _0xe116=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','CreateWhatsappMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x29de96,_0x42cc38){var _0x1b9352=function(_0x4a288a){while(--_0x4a288a){_0x29de96['push'](_0x29de96['shift']());}};_0x1b9352(++_0x42cc38);}(_0xe116,0x1c2));var _0x6e11=function(_0x166983,_0x3da258){_0x166983=_0x166983-0x0;var _0x5b6366=_0xe116[_0x166983];return _0x5b6366;};'use strict';var _=require(_0x6e11('0x0'));var util=require(_0x6e11('0x1'));var moment=require(_0x6e11('0x2'));var BPromise=require(_0x6e11('0x3'));var rs=require(_0x6e11('0x4'));var fs=require('fs');var Redis=require(_0x6e11('0x5'));var db=require(_0x6e11('0x6'))['db'];var utils=require(_0x6e11('0x7'));var logger=require(_0x6e11('0x8'))('rpc');var config=require(_0x6e11('0x9'));var jayson=require(_0x6e11('0xa'));var client=jayson[_0x6e11('0xb')]['http']({'port':0x232a});config[_0x6e11('0xc')]=_[_0x6e11('0xd')](config['redis'],{'host':_0x6e11('0xe'),'port':0x18eb});var socket=require(_0x6e11('0xf'))(new Redis(config['redis']));require(_0x6e11('0x10'))['register'](socket);function respondWithRpcPromise(_0x21cf96,_0x2dd58f,_0x422006){return new BPromise(function(_0x15b361,_0x3c64df){return client[_0x6e11('0x11')](_0x21cf96,_0x422006)[_0x6e11('0x12')](function(_0x55346b){logger[_0x6e11('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x2dd58f,_0x6e11('0x14'));logger[_0x6e11('0x15')](_0x6e11('0x16'),_0x2dd58f,_0x6e11('0x14'),JSON[_0x6e11('0x17')](_0x55346b));if(_0x55346b[_0x6e11('0x18')]){if(_0x55346b['error'][_0x6e11('0x19')]===0x1f4){logger[_0x6e11('0x18')](_0x6e11('0x1a'),_0x2dd58f,_0x55346b[_0x6e11('0x18')][_0x6e11('0x1b')]);return _0x3c64df(_0x55346b[_0x6e11('0x18')][_0x6e11('0x1b')]);}logger[_0x6e11('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x2dd58f,_0x55346b['error'][_0x6e11('0x1b')]);return _0x15b361(_0x55346b[_0x6e11('0x18')]['message']);}else{logger['info'](_0x6e11('0x1a'),_0x2dd58f,_0x6e11('0x14'));_0x15b361(_0x55346b[_0x6e11('0x1c')][_0x6e11('0x1b')]);}})['catch'](function(_0xfb57eb){logger[_0x6e11('0x18')](_0x6e11('0x1a'),_0x2dd58f,_0xfb57eb);_0x3c64df(_0xfb57eb);});});}exports[_0x6e11('0x1d')]=function(_0xcf7de5){var _0x43b12f=this;return new Promise(function(_0x19be6d,_0x3d89e4){return db['WhatsappMessage'][_0x6e11('0x1e')](_0xcf7de5[_0x6e11('0x1f')],{'raw':_0xcf7de5[_0x6e11('0x20')]?_0xcf7de5[_0x6e11('0x20')][_0x6e11('0x21')]===undefined?!![]:![]:!![]})[_0x6e11('0x12')](function(_0x3fb0de){logger[_0x6e11('0x13')](_0x6e11('0x1d'),_0xcf7de5);logger[_0x6e11('0x15')](_0x6e11('0x1d'),_0xcf7de5,JSON['stringify'](_0x3fb0de));_0x19be6d(_0x3fb0de);})[_0x6e11('0x22')](function(_0x16279d){logger['error'](_0x6e11('0x1d'),_0x16279d[_0x6e11('0x1b')],_0xcf7de5);_0x3d89e4(_0x43b12f[_0x6e11('0x18')](0x1f4,_0x16279d[_0x6e11('0x1b')]));});});}; \ No newline at end of file +var _0xb00c=['request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register','then','WhatsappMessage,\x20%s,\x20%s'];(function(_0x4cd0fc,_0x30bb05){var _0x5e7703=function(_0x4aeb4d){while(--_0x4aeb4d){_0x4cd0fc['push'](_0x4cd0fc['shift']());}};_0x5e7703(++_0x30bb05);}(_0xb00c,0x1ee));var _0xcb00=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0xb00c[_0x51ab83];return _0x14b6de;};'use strict';var _=require(_0xcb00('0x0'));var util=require(_0xcb00('0x1'));var moment=require(_0xcb00('0x2'));var BPromise=require(_0xcb00('0x3'));var rs=require(_0xcb00('0x4'));var fs=require('fs');var Redis=require(_0xcb00('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb00('0x6'));var logger=require('../../config/logger')(_0xcb00('0x7'));var config=require(_0xcb00('0x8'));var jayson=require(_0xcb00('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xcb00('0xa')]=_['defaults'](config[_0xcb00('0xa')],{'host':_0xcb00('0xb'),'port':0x18eb});var socket=require(_0xcb00('0xc'))(new Redis(config[_0xcb00('0xa')]));require('./whatsappMessage.socket')[_0xcb00('0xd')](socket);function respondWithRpcPromise(_0x1c5652,_0x2f5b39,_0x8789cb){return new BPromise(function(_0x433b92,_0x1300cf){return client['request'](_0x1c5652,_0x8789cb)[_0xcb00('0xe')](function(_0x12b106){logger['info'](_0xcb00('0xf'),_0x2f5b39,_0xcb00('0x10'));logger[_0xcb00('0x11')](_0xcb00('0x12'),_0x2f5b39,_0xcb00('0x10'),JSON['stringify'](_0x12b106));if(_0x12b106[_0xcb00('0x13')]){if(_0x12b106['error'][_0xcb00('0x14')]===0x1f4){logger[_0xcb00('0x13')](_0xcb00('0xf'),_0x2f5b39,_0x12b106[_0xcb00('0x13')][_0xcb00('0x15')]);return _0x1300cf(_0x12b106[_0xcb00('0x13')][_0xcb00('0x15')]);}logger['error'](_0xcb00('0xf'),_0x2f5b39,_0x12b106[_0xcb00('0x13')][_0xcb00('0x15')]);return _0x433b92(_0x12b106['error']['message']);}else{logger[_0xcb00('0x16')](_0xcb00('0xf'),_0x2f5b39,_0xcb00('0x10'));_0x433b92(_0x12b106[_0xcb00('0x17')][_0xcb00('0x15')]);}})[_0xcb00('0x18')](function(_0x2d0d26){logger[_0xcb00('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x2f5b39,_0x2d0d26);_0x1300cf(_0x2d0d26);});});}exports[_0xcb00('0x19')]=function(_0x210eab){var _0x4b483c=this;return new Promise(function(_0x48fce2,_0x47f28c){return db[_0xcb00('0x1a')][_0xcb00('0x1b')](_0x210eab['body'],{'raw':_0x210eab[_0xcb00('0x1c')]?_0x210eab[_0xcb00('0x1c')][_0xcb00('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x213e22){logger[_0xcb00('0x16')]('CreateWhatsappMessage',_0x210eab);logger[_0xcb00('0x11')](_0xcb00('0x19'),_0x210eab,JSON['stringify'](_0x213e22));_0x48fce2(_0x213e22);})[_0xcb00('0x18')](function(_0x452d0a){logger['error'](_0xcb00('0x19'),_0x452d0a[_0xcb00('0x15')],_0x210eab);_0x47f28c(_0x4b483c[_0xcb00('0x13')](0x1f4,_0x452d0a[_0xcb00('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index bc203ea..b4e37a4 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 _0x367b=['./whatsappMessage.events','remove','update','emit','register','length','whatsappMessage:'];(function(_0x443984,_0x51a94f){var _0x44b14e=function(_0x5a5ff8){while(--_0x5a5ff8){_0x443984['push'](_0x443984['shift']());}};_0x44b14e(++_0x51a94f);}(_0x367b,0x1b9));var _0xb367=function(_0x32ad79,_0x3540de){_0x32ad79=_0x32ad79-0x0;var _0x22a942=_0x367b[_0x32ad79];return _0x22a942;};'use strict';var WhatsappMessageEvents=require(_0xb367('0x0'));var events=['save',_0xb367('0x1'),_0xb367('0x2')];function createListener(_0x1cb16e,_0x55629a){return function(_0x28fc05){_0x55629a[_0xb367('0x3')](_0x1cb16e,_0x28fc05);};}function removeListener(_0x5147ba,_0x459d80){return function(){WhatsappMessageEvents['removeListener'](_0x5147ba,_0x459d80);};}exports[_0xb367('0x4')]=function(_0x595b55){for(var _0x14bbfc=0x0,_0x355ad8=events[_0xb367('0x5')];_0x14bbfc<_0x355ad8;_0x14bbfc++){var _0x32ef96=events[_0x14bbfc];var _0x12b99a=createListener(_0xb367('0x6')+_0x32ef96,_0x595b55);WhatsappMessageEvents['on'](_0x32ef96,_0x12b99a);}}; \ No newline at end of file +var _0x63cf=['whatsappMessage:','./whatsappMessage.events','save','emit','removeListener','register','length'];(function(_0x149338,_0x4db976){var _0x412453=function(_0x76d24b){while(--_0x76d24b){_0x149338['push'](_0x149338['shift']());}};_0x412453(++_0x4db976);}(_0x63cf,0x1ba));var _0xf63c=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0x63cf[_0x2bcb75];return _0x175345;};'use strict';var WhatsappMessageEvents=require(_0xf63c('0x0'));var events=[_0xf63c('0x1'),'remove','update'];function createListener(_0x44792f,_0x34dfb1){return function(_0x3f20e2){_0x34dfb1[_0xf63c('0x2')](_0x44792f,_0x3f20e2);};}function removeListener(_0x37527e,_0x1204cd){return function(){WhatsappMessageEvents[_0xf63c('0x3')](_0x37527e,_0x1204cd);};}exports[_0xf63c('0x4')]=function(_0x4680f3){for(var _0x3890c2=0x0,_0x47022d=events[_0xf63c('0x5')];_0x3890c2<_0x47022d;_0x3890c2++){var _0x2daba2=events[_0x3890c2];var _0x1514a2=createListener(_0xf63c('0x6')+_0x2daba2,_0x4680f3);WhatsappMessageEvents['on'](_0x2daba2,_0x1514a2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index a3dfde6..e58bec2 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 _0x4fdb=['index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get'];(function(_0x1d4262,_0x27781b){var _0x1faf63=function(_0x5a9ae4){while(--_0x5a9ae4){_0x1d4262['push'](_0x1d4262['shift']());}};_0x1faf63(++_0x27781b);}(_0x4fdb,0x1a8));var _0xb4fd=function(_0x524760,_0x154745){_0x524760=_0x524760-0x0;var _0x55d019=_0x4fdb[_0x524760];return _0x55d019;};'use strict';var multer=require(_0xb4fd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb4fd('0x1'));var express=require(_0xb4fd('0x2'));var router=express[_0xb4fd('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb4fd('0x4'));var config=require(_0xb4fd('0x5'));var controller=require(_0xb4fd('0x6'));router[_0xb4fd('0x7')]('/',auth['isAuthenticated'](),controller[_0xb4fd('0x8')]);router[_0xb4fd('0x7')](_0xb4fd('0x9'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0xb')]);router[_0xb4fd('0x7')](_0xb4fd('0xc'),auth[_0xb4fd('0xa')](),controller['show']);router[_0xb4fd('0x7')](_0xb4fd('0xd'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0xe')]);router[_0xb4fd('0x7')](_0xb4fd('0xf'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x10')]);router[_0xb4fd('0x7')](_0xb4fd('0x11'),auth[_0xb4fd('0xa')](),controller['getAgents']);router[_0xb4fd('0x12')]('/',auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x13')]);router[_0xb4fd('0x12')]('/:id/teams',auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x14')]);router[_0xb4fd('0x12')](_0xb4fd('0x11'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x15')]);router[_0xb4fd('0x16')](_0xb4fd('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb4fd('0xc'),auth['isAuthenticated'](),controller[_0xb4fd('0x17')]);router[_0xb4fd('0x18')](_0xb4fd('0xf'),auth['isAuthenticated'](),controller[_0xb4fd('0x19')]);router['delete']('/:id/users',auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x020e=['destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete'];(function(_0x585afe,_0x2a3866){var _0x406443=function(_0x4f21cb){while(--_0x4f21cb){_0x585afe['push'](_0x585afe['shift']());}};_0x406443(++_0x2a3866);}(_0x020e,0x7d));var _0xe020=function(_0x48e8ee,_0x23f0dd){_0x48e8ee=_0x48e8ee-0x0;var _0x278234=_0x020e[_0x48e8ee];return _0x278234;};'use strict';var multer=require(_0xe020('0x0'));var util=require(_0xe020('0x1'));var path=require(_0xe020('0x2'));var timeout=require('connect-timeout');var express=require(_0xe020('0x3'));var router=express[_0xe020('0x4')]();var fs_extra=require(_0xe020('0x5'));var auth=require(_0xe020('0x6'));var interaction=require(_0xe020('0x7'));var config=require('../../config/environment');var controller=require(_0xe020('0x8'));router[_0xe020('0x9')]('/',auth[_0xe020('0xa')](),controller['index']);router[_0xe020('0x9')](_0xe020('0xb'),auth[_0xe020('0xa')](),controller[_0xe020('0xc')]);router[_0xe020('0x9')](_0xe020('0xd'),auth[_0xe020('0xa')](),controller[_0xe020('0xe')]);router[_0xe020('0x9')](_0xe020('0xf'),auth['isAuthenticated'](),controller[_0xe020('0x10')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get']('/:id/users',auth[_0xe020('0xa')](),controller[_0xe020('0x11')]);router[_0xe020('0x12')]('/',auth['isAuthenticated'](),controller[_0xe020('0x13')]);router[_0xe020('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe020('0x14')]);router[_0xe020('0x12')](_0xe020('0x15'),auth[_0xe020('0xa')](),controller[_0xe020('0x16')]);router[_0xe020('0x17')](_0xe020('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe020('0x18')](_0xe020('0xd'),auth['isAuthenticated'](),controller[_0xe020('0x19')]);router[_0xe020('0x18')](_0xe020('0x1a'),auth[_0xe020('0xa')](),controller[_0xe020('0x1b')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe020('0x1c')]);module[_0xe020('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 53bea00..e962a5d 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 _0x9434=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x2afc6c,_0x37986b){var _0x1fa040=function(_0x1aa9b5){while(--_0x1aa9b5){_0x2afc6c['push'](_0x2afc6c['shift']());}};_0x1fa040(++_0x37986b);}(_0x9434,0x168));var _0x4943=function(_0x1d83cb,_0x48a8f9){_0x1d83cb=_0x1d83cb-0x0;var _0x165101=_0x9434[_0x1d83cb];return _0x165101;};'use strict';var Sequelize=require(_0x4943('0x0'));module[_0x4943('0x1')]={'name':{'type':Sequelize[_0x4943('0x2')],'unique':_0x4943('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4943('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4943('0x5')]('rrmemory',_0x4943('0x6'),_0x4943('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6611=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6611,0xdd));var _0x1661=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6611[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x1661('0x0')]={'name':{'type':Sequelize[_0x1661('0x1')],'unique':_0x1661('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1661('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1661('0x4')](_0x1661('0x5'),_0x1661('0x6'),_0x1661('0x7'))},'description':{'type':Sequelize[_0x1661('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f38250f..c4cd96a 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 _0x2b13=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','limit','undefined','count','json','apply','then','destroy','WhatsappQueues','UserProfileResource','error','stack','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','fields','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4a53e2,_0x13321e){var _0x3f2d76=function(_0x50c5cf){while(--_0x50c5cf){_0x4a53e2['push'](_0x4a53e2['shift']());}};_0x3f2d76(++_0x13321e);}(_0x2b13,0x101));var _0x32b1=function(_0xdb98f0,_0x12d521){_0xdb98f0=_0xdb98f0-0x0;var _0x5affc4=_0x2b13[_0xdb98f0];return _0x5affc4;};'use strict';var emlformat=require(_0x32b1('0x0'));var rimraf=require(_0x32b1('0x1'));var zipdir=require(_0x32b1('0x2'));var jsonpatch=require(_0x32b1('0x3'));var rp=require('request-promise');var moment=require(_0x32b1('0x4'));var BPromise=require(_0x32b1('0x5'));var Mustache=require(_0x32b1('0x6'));var util=require('util');var path=require(_0x32b1('0x7'));var sox=require(_0x32b1('0x8'));var csv=require(_0x32b1('0x9'));var ejs=require(_0x32b1('0xa'));var fs=require('fs');var fs_extra=require(_0x32b1('0xb'));var _=require(_0x32b1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x32b1('0xd'));var deskjs=require(_0x32b1('0xe'));var toCsv=require(_0x32b1('0x9'));var querystring=require('querystring');var Papa=require(_0x32b1('0xf'));var Redis=require('ioredis');var authService=require(_0x32b1('0x10'));var qs=require(_0x32b1('0x11'));var as=require(_0x32b1('0x12'));var hardwareService=require(_0x32b1('0x13'));var logger=require('../../config/logger')(_0x32b1('0x14'));var utils=require(_0x32b1('0x15'));var config=require(_0x32b1('0x16'));var licenseUtil=require(_0x32b1('0x17'));var db=require(_0x32b1('0x18'))['db'];config['redis']=_[_0x32b1('0x19')](config[_0x32b1('0x1a')],{'host':_0x32b1('0x1b'),'port':0x18eb});var socket=require(_0x32b1('0x1c'))(new Redis(config[_0x32b1('0x1a')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x54391c,_0x39fd83){_0x39fd83=_0x39fd83||0xcc;return function(_0x3dcd83){if(_0x3dcd83){return _0x54391c[_0x32b1('0x1d')](_0x39fd83);}return _0x54391c[_0x32b1('0x1e')](_0x39fd83)[_0x32b1('0x1f')]();};}function respondWithResult(_0x527221,_0x5d6cff){_0x5d6cff=_0x5d6cff||0xc8;return function(_0x52f14d){if(_0x52f14d){return _0x527221[_0x32b1('0x1e')](_0x5d6cff)['json'](_0x52f14d);}};}function respondWithFilteredResult(_0x1eadfd,_0x499edb){return function(_0x598e2d){if(_0x598e2d){var _0x4fce46=typeof _0x499edb[_0x32b1('0x20')]==='undefined'&&typeof _0x499edb[_0x32b1('0x21')]===_0x32b1('0x22');var _0x2e3b01=_0x598e2d[_0x32b1('0x23')];var _0x5e8dda=_0x4fce46?0x0:_0x499edb['offset'];var _0x4fa710=_0x4fce46?_0x598e2d[_0x32b1('0x23')]:_0x499edb[_0x32b1('0x20')]+_0x499edb['limit'];var _0x584ba4;if(_0x4fa710>=_0x2e3b01){_0x4fa710=_0x2e3b01;_0x584ba4=0xc8;}else{_0x584ba4=0xce;}_0x1eadfd['status'](_0x584ba4);return _0x1eadfd['set']('Content-Range',_0x5e8dda+'-'+_0x4fa710+'/'+_0x2e3b01)[_0x32b1('0x24')](_0x598e2d);}return null;};}function patchUpdates(_0x137382){return function(_0x2e314c){try{jsonpatch[_0x32b1('0x25')](_0x2e314c,_0x137382,!![]);}catch(_0x56d4ca){return BPromise['reject'](_0x56d4ca);}return _0x2e314c['save']();};}function saveUpdates(_0x12135b,_0x5a27f8){return function(_0x43c096){if(_0x43c096){return _0x43c096['update'](_0x12135b)[_0x32b1('0x26')](function(_0x295d5c){return _0x295d5c;});}return null;};}function removeEntity(_0x14d79b,_0x32f947){return function(_0x387cf6){if(_0x387cf6){return _0x387cf6[_0x32b1('0x27')]()['then'](function(){var _0x41b388=_0x387cf6['get']({'plain':!![]});var _0x17239c=_0x32b1('0x28');return db[_0x32b1('0x29')][_0x32b1('0x27')]({'where':{'type':_0x17239c,'resourceId':_0x41b388['id']}})[_0x32b1('0x26')](function(){return _0x387cf6;});})[_0x32b1('0x26')](function(){_0x14d79b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0e8c,_0x434b0c){return function(_0x2f904e){if(!_0x2f904e){_0x4e0e8c[_0x32b1('0x1d')](0x194);}return _0x2f904e;};}function handleError(_0x8f4454,_0x476193){_0x476193=_0x476193||0x1f4;return function(_0x1054b4){logger[_0x32b1('0x2a')](_0x1054b4[_0x32b1('0x2b')]);if(_0x1054b4['name']){delete _0x1054b4['name'];}_0x8f4454[_0x32b1('0x1e')](_0x476193)[_0x32b1('0x2c')](_0x1054b4);};}exports[_0x32b1('0x2d')]=function(_0x69a09d,_0x1934dc){var _0x24dc53={},_0x27383a={},_0x5154fa={'count':0x0,'rows':[]};var _0x50a6b2=_[_0x32b1('0x2e')](db[_0x32b1('0x2f')][_0x32b1('0x30')],function(_0x1a7eca){return{'name':_0x1a7eca[_0x32b1('0x31')],'type':_0x1a7eca[_0x32b1('0x32')][_0x32b1('0x33')]};});_0x27383a[_0x32b1('0x34')]=_[_0x32b1('0x2e')](_0x50a6b2,_0x32b1('0x35'));_0x27383a[_0x32b1('0x36')]=_['keys'](_0x69a09d[_0x32b1('0x36')]);_0x27383a[_0x32b1('0x37')]=_['intersection'](_0x27383a[_0x32b1('0x34')],_0x27383a[_0x32b1('0x36')]);_0x24dc53[_0x32b1('0x38')]=_[_0x32b1('0x39')](_0x27383a[_0x32b1('0x34')],qs['fields'](_0x69a09d[_0x32b1('0x36')]['fields']));_0x24dc53[_0x32b1('0x38')]=_0x24dc53['attributes'][_0x32b1('0x3a')]?_0x24dc53[_0x32b1('0x38')]:_0x27383a[_0x32b1('0x34')];if(!_0x69a09d['query'][_0x32b1('0x3b')](_0x32b1('0x3c'))){_0x24dc53[_0x32b1('0x21')]=qs[_0x32b1('0x21')](_0x69a09d['query'][_0x32b1('0x21')]);_0x24dc53[_0x32b1('0x20')]=qs['offset'](_0x69a09d[_0x32b1('0x36')][_0x32b1('0x20')]);}_0x24dc53[_0x32b1('0x3d')]=qs[_0x32b1('0x3e')](_0x69a09d[_0x32b1('0x36')][_0x32b1('0x3e')]);_0x24dc53[_0x32b1('0x3f')]=qs[_0x32b1('0x37')](_[_0x32b1('0x40')](_0x69a09d[_0x32b1('0x36')],_0x27383a[_0x32b1('0x37')]),_0x50a6b2);if(_0x69a09d[_0x32b1('0x36')][_0x32b1('0x41')]){_0x24dc53[_0x32b1('0x3f')]=_[_0x32b1('0x42')](_0x24dc53[_0x32b1('0x3f')],{'$or':_[_0x32b1('0x2e')](_0x50a6b2,function(_0x367667){if(_0x367667[_0x32b1('0x32')]!==_0x32b1('0x43')){var _0x4f44c5={};_0x4f44c5[_0x367667[_0x32b1('0x35')]]={'$like':'%'+_0x69a09d[_0x32b1('0x36')][_0x32b1('0x41')]+'%'};return _0x4f44c5;}})});}_0x24dc53=_[_0x32b1('0x42')]({},_0x24dc53,_0x69a09d[_0x32b1('0x44')]);var _0x13bf16={'where':_0x24dc53[_0x32b1('0x3f')]};return db[_0x32b1('0x2f')][_0x32b1('0x23')](_0x13bf16)[_0x32b1('0x26')](function(_0x3e6e1d){_0x5154fa[_0x32b1('0x23')]=_0x3e6e1d;if(_0x69a09d['query']['includeAll']){_0x24dc53[_0x32b1('0x45')]=[{'all':!![]}];}return db[_0x32b1('0x2f')][_0x32b1('0x46')](_0x24dc53);})[_0x32b1('0x26')](function(_0x5a47d7){_0x5154fa[_0x32b1('0x47')]=_0x5a47d7;return _0x5154fa;})['then'](respondWithFilteredResult(_0x1934dc,_0x24dc53))[_0x32b1('0x48')](handleError(_0x1934dc,null));};exports['show']=function(_0x58df67,_0x34d268){var _0x2ceaaf={'raw':!![],'where':{'id':_0x58df67[_0x32b1('0x49')]['id']}},_0x5938e2={};_0x5938e2[_0x32b1('0x34')]=_[_0x32b1('0x4a')](db[_0x32b1('0x2f')]['rawAttributes']);_0x5938e2[_0x32b1('0x36')]=_[_0x32b1('0x4a')](_0x58df67['query']);_0x5938e2[_0x32b1('0x37')]=_['intersection'](_0x5938e2[_0x32b1('0x34')],_0x5938e2[_0x32b1('0x36')]);_0x2ceaaf['attributes']=_[_0x32b1('0x39')](_0x5938e2[_0x32b1('0x34')],qs[_0x32b1('0x4b')](_0x58df67['query']['fields']));_0x2ceaaf[_0x32b1('0x38')]=_0x2ceaaf['attributes'][_0x32b1('0x3a')]?_0x2ceaaf[_0x32b1('0x38')]:_0x5938e2[_0x32b1('0x34')];if(_0x58df67['query']['includeAll']){_0x2ceaaf[_0x32b1('0x45')]=[{'all':!![]}];}_0x2ceaaf=_[_0x32b1('0x42')]({},_0x2ceaaf,_0x58df67['options']);return db[_0x32b1('0x2f')][_0x32b1('0x4c')](_0x2ceaaf)[_0x32b1('0x26')](handleEntityNotFound(_0x34d268,null))['then'](respondWithResult(_0x34d268,null))[_0x32b1('0x48')](handleError(_0x34d268,null));};exports['create']=function(_0x1244b4,_0x3e2862){return db[_0x32b1('0x2f')][_0x32b1('0x4d')](_0x1244b4[_0x32b1('0x4e')],{})[_0x32b1('0x26')](function(_0x6b20b){var _0x3d77bc=_0x1244b4['user'][_0x32b1('0x4f')]({'plain':!![]});if(!_0x3d77bc)throw new Error(_0x32b1('0x50'));if(_0x3d77bc[_0x32b1('0x51')]==='user'){var _0x1f9004=_0x6b20b[_0x32b1('0x4f')]({'plain':!![]});var _0x23c397=_0x32b1('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x23c397,'userProfileId':_0x3d77bc[_0x32b1('0x52')]},'raw':!![]})[_0x32b1('0x26')](function(_0x11239e){if(_0x11239e&&_0x11239e[_0x32b1('0x53')]===0x0){return db[_0x32b1('0x29')][_0x32b1('0x4d')]({'name':_0x1f9004[_0x32b1('0x35')],'resourceId':_0x1f9004['id'],'type':_0x11239e['name'],'sectionId':_0x11239e['id']},{})['then'](function(){return _0x6b20b;});}else{return _0x6b20b;}})[_0x32b1('0x48')](function(_0x54e509){logger[_0x32b1('0x2a')](_0x32b1('0x54'),_0x54e509);throw _0x54e509;});}return _0x6b20b;})[_0x32b1('0x26')](respondWithResult(_0x3e2862,0xc9))[_0x32b1('0x48')](handleError(_0x3e2862,null));};exports[_0x32b1('0x55')]=function(_0x52e1d0,_0x126106){if(_0x52e1d0[_0x32b1('0x4e')]['id']){delete _0x52e1d0[_0x32b1('0x4e')]['id'];}return db[_0x32b1('0x2f')][_0x32b1('0x4c')]({'where':{'id':_0x52e1d0[_0x32b1('0x49')]['id']}})['then'](handleEntityNotFound(_0x126106,null))[_0x32b1('0x26')](saveUpdates(_0x52e1d0['body'],null))[_0x32b1('0x26')](respondWithResult(_0x126106,null))['catch'](handleError(_0x126106,null));};exports['destroy']=function(_0x430d23,_0x2afb40){return db['WhatsappQueue'][_0x32b1('0x4c')]({'where':{'id':_0x430d23[_0x32b1('0x49')]['id']}})[_0x32b1('0x26')](handleEntityNotFound(_0x2afb40,null))[_0x32b1('0x26')](removeEntity(_0x2afb40,null))[_0x32b1('0x48')](handleError(_0x2afb40,null));};exports['describe']=function(_0x55549b,_0x517f84){return db['WhatsappQueue'][_0x32b1('0x56')]()[_0x32b1('0x26')](respondWithResult(_0x517f84,null))['catch'](handleError(_0x517f84,null));};exports[_0x32b1('0x57')]=function(_0x3b534f,_0x2ef657,_0x15af8b){var _0xe19469={'raw':!![],'where':{}},_0x1ae9ed={},_0xdfbd28;return db[_0x32b1('0x2f')]['findOne']({'where':{'id':_0x3b534f['params']['id']}})[_0x32b1('0x26')](handleEntityNotFound(_0x2ef657,null))[_0x32b1('0x26')](function(_0x1fa0ec){if(_0x1fa0ec){_0xdfbd28=_0x1fa0ec[_0x32b1('0x4f')]({'plain':!![]});_0x1ae9ed[_0x32b1('0x34')]=_[_0x32b1('0x4a')](db['UserWhatsappQueue'][_0x32b1('0x30')]);_0x1ae9ed['query']=_[_0x32b1('0x4a')](_0x3b534f[_0x32b1('0x36')]);_0x1ae9ed[_0x32b1('0x37')]=_[_0x32b1('0x39')](_0x1ae9ed[_0x32b1('0x34')],_0x1ae9ed[_0x32b1('0x36')]);_0xe19469[_0x32b1('0x38')]=_['intersection'](_0x1ae9ed['model'],qs[_0x32b1('0x4b')](_0x3b534f[_0x32b1('0x36')][_0x32b1('0x4b')]));_0xe19469[_0x32b1('0x38')]=_0xe19469['attributes'][_0x32b1('0x3a')]?_0xe19469[_0x32b1('0x38')]:_0x1ae9ed[_0x32b1('0x34')];if(!_0x3b534f[_0x32b1('0x36')][_0x32b1('0x3b')](_0x32b1('0x3c'))){_0xe19469['limit']=qs['limit'](_0x3b534f[_0x32b1('0x36')][_0x32b1('0x21')]);_0xe19469[_0x32b1('0x20')]=qs[_0x32b1('0x20')](_0x3b534f['query']['offset']);}_0xe19469[_0x32b1('0x3d')]=qs[_0x32b1('0x3e')](_0x3b534f[_0x32b1('0x36')]['sort']);_0xe19469[_0x32b1('0x3f')]=qs[_0x32b1('0x37')](_[_0x32b1('0x40')](_0x3b534f['query'],_0x1ae9ed[_0x32b1('0x37')]));_0xe19469[_0x32b1('0x3f')]['WhatsappQueueId']=_0x1fa0ec['id'];if(_0x3b534f[_0x32b1('0x36')][_0x32b1('0x41')]){_0xe19469[_0x32b1('0x3f')]=_[_0x32b1('0x42')](_0xe19469[_0x32b1('0x3f')],{'$or':_[_0x32b1('0x2e')](_0xe19469[_0x32b1('0x38')],function(_0xdbbea5){var _0x45ed01={};_0x45ed01[_0xdbbea5]={'$like':'%'+_0x3b534f['query']['filter']+'%'};return _0x45ed01;})});}_0xe19469=_['merge']({},_0xe19469,_0x3b534f[_0x32b1('0x44')]);return db['UserWhatsappQueue'][_0x32b1('0x46')](_0xe19469);}})[_0x32b1('0x26')](function(_0x25ac69){if(_0x25ac69){return db[_0x32b1('0x58')][_0x32b1('0x59')]({'where':{'id':_[_0x32b1('0x2e')](_0x25ac69,_0x32b1('0x5a')),'role':_0x32b1('0x5b')},'attributes':['id','name',_0x32b1('0x5c'),_0x32b1('0x5d'),_0x32b1('0x5e')]});}})[_0x32b1('0x26')](function(_0x3ab9d9){if(_0x3ab9d9){return{'count':_0x3ab9d9[_0x32b1('0x23')],'rows':_[_0x32b1('0x2e')](_0x3ab9d9[_0x32b1('0x47')],function(_0x2fe669){return{'membername':_0x2fe669[_0x32b1('0x35')],'UserId':_0x2fe669['id'],'queue_name':_0xdfbd28[_0x32b1('0x35')],'WhatsappQueueId':_0xdfbd28['id'],'interface':util[_0x32b1('0x5f')]('%s/%s',_0x32b1('0x60'),_0x2fe669[_0x32b1('0x35')]),'penalty':0x0,'paused':_0x2fe669[_0x32b1('0x5c')],'createdAt':_0x2fe669[_0x32b1('0x5e')],'updatedAt':_0x2fe669[_0x32b1('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32b1('0x26')](respondWithFilteredResult(_0x2ef657,_0xe19469))[_0x32b1('0x48')](handleError(_0x2ef657,null));};exports[_0x32b1('0x61')]=function(_0x561ff5,_0x2e9fc6,_0x14ecde){var _0x38a0c5={};var _0x21cd1b={};var _0x21ee7c;var _0x577cac;return db[_0x32b1('0x2f')][_0x32b1('0x62')]({'where':{'id':_0x561ff5['params']['id']}})[_0x32b1('0x26')](handleEntityNotFound(_0x2e9fc6,null))[_0x32b1('0x26')](function(_0x4847dc){if(_0x4847dc){_0x21ee7c=_0x4847dc;_0x21cd1b['model']=_[_0x32b1('0x4a')](db[_0x32b1('0x63')]['rawAttributes']);_0x21cd1b[_0x32b1('0x36')]=_[_0x32b1('0x4a')](_0x561ff5[_0x32b1('0x36')]);_0x21cd1b['filters']=_[_0x32b1('0x39')](_0x21cd1b[_0x32b1('0x34')],_0x21cd1b[_0x32b1('0x36')]);_0x38a0c5[_0x32b1('0x38')]=_[_0x32b1('0x39')](_0x21cd1b[_0x32b1('0x34')],qs[_0x32b1('0x4b')](_0x561ff5[_0x32b1('0x36')][_0x32b1('0x4b')]));_0x38a0c5[_0x32b1('0x38')]=_0x38a0c5['attributes'][_0x32b1('0x3a')]?_0x38a0c5[_0x32b1('0x38')]:_0x21cd1b[_0x32b1('0x34')];_0x38a0c5[_0x32b1('0x3d')]=qs['sort'](_0x561ff5[_0x32b1('0x36')][_0x32b1('0x3e')]);_0x38a0c5[_0x32b1('0x3f')]=qs[_0x32b1('0x37')](_[_0x32b1('0x40')](_0x561ff5['query'],_0x21cd1b[_0x32b1('0x37')]));if(_0x561ff5[_0x32b1('0x36')][_0x32b1('0x41')]){_0x38a0c5[_0x32b1('0x3f')]=_[_0x32b1('0x42')](_0x38a0c5[_0x32b1('0x3f')],{'$or':_['map'](_0x38a0c5[_0x32b1('0x38')],function(_0x4ca00f){var _0x509dda={};_0x509dda[_0x4ca00f]={'$like':'%'+_0x561ff5[_0x32b1('0x36')]['filter']+'%'};return _0x509dda;})});}_0x38a0c5=_[_0x32b1('0x42')]({},_0x38a0c5,_0x561ff5[_0x32b1('0x44')]);return _0x21ee7c[_0x32b1('0x61')](_0x38a0c5);}})[_0x32b1('0x26')](function(_0x380553){if(_0x380553){_0x577cac=_0x380553['length'];if(!_0x561ff5[_0x32b1('0x36')][_0x32b1('0x3b')]('nolimit')){_0x38a0c5['limit']=qs[_0x32b1('0x21')](_0x561ff5['query']['limit']);_0x38a0c5[_0x32b1('0x20')]=qs['offset'](_0x561ff5[_0x32b1('0x36')][_0x32b1('0x20')]);}return _0x21ee7c[_0x32b1('0x61')](_0x38a0c5);}})[_0x32b1('0x26')](function(_0x35ef57){if(_0x35ef57){return _0x35ef57?{'count':_0x577cac,'rows':_0x35ef57}:null;}})[_0x32b1('0x26')](respondWithResult(_0x2e9fc6,null))[_0x32b1('0x48')](handleError(_0x2e9fc6,null));};exports[_0x32b1('0x64')]=function(_0x44021f,_0x4a6882,_0x333e5b){var _0x5a457e=_0x44021f[_0x32b1('0x4e')][_0x32b1('0x65')];return db[_0x32b1('0x63')]['findAll']({'where':{'id':_0x5a457e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x32b1('0x66'),'attributes':['id','name',_0x32b1('0x67'),_0x32b1('0x68'),_0x32b1('0x69')],'raw':!![]}]})[_0x32b1('0x26')](function(_0x46437e){if(_0x46437e){var _0x8b7c7e=_[_0x32b1('0x6a')](_0x46437e,function(_0x308f07){var _0x51af0c=_0x308f07[_0x32b1('0x4f')]({'plain':!![]});return _0x51af0c[_0x32b1('0x66')];});return db[_0x32b1('0x2f')][_0x32b1('0x4c')]({'where':{'id':_0x44021f[_0x32b1('0x49')]['id']}})[_0x32b1('0x26')](function(_0x3b6934){return db[_0x32b1('0x6b')][_0x32b1('0x6c')](function(_0x2100a9){return _0x3b6934[_0x32b1('0x64')](_0x5a457e,{'transaction':_0x2100a9})[_0x32b1('0x26')](function(){return BPromise['each'](_0x8b7c7e,function(_0x4621f3){return db['UserWhatsappQueue'][_0x32b1('0x6d')]({'where':{'UserId':_0x4621f3['id'],'WhatsappQueueId':_0x44021f['params']['id']},'transaction':_0x2100a9});});})[_0x32b1('0x26')](function(){_0x8b7c7e[_0x32b1('0x6e')](function(_0x3a0721){socket[_0x32b1('0x6f')](_0x32b1('0x70'),{'UserId':_0x3a0721['id'],'WhatsappQueueId':_0x3b6934['id']});});});});});}})[_0x32b1('0x26')](respondWithStatusCode(_0x4a6882,null))[_0x32b1('0x48')](handleError(_0x4a6882,null));};exports[_0x32b1('0x71')]=function(_0x11964e,_0x2c619d,_0x2ea684){return db[_0x32b1('0x63')][_0x32b1('0x46')]({'where':{'id':_0x11964e[_0x32b1('0x36')][_0x32b1('0x65')]},'attributes':['id'],'include':[{'model':db[_0x32b1('0x58')],'as':_0x32b1('0x66'),'attributes':['id'],'raw':!![]}]})[_0x32b1('0x26')](handleEntityNotFound(_0x2c619d,null))[_0x32b1('0x26')](function(_0x25ac61){var _0x561b51=_[_0x32b1('0x2e')](_0x25ac61,'id');var _0x253db5=[];var _0x120b2b=[];var _0x25cee4=squel['select']();_0x25cee4[_0x32b1('0x72')](_0x32b1('0x73'))[_0x32b1('0x74')](_0x32b1('0x75'),'tq')[_0x32b1('0x76')](_0x32b1('0x77'),'ut',_0x32b1('0x78'))[_0x32b1('0x3f')](_0x32b1('0x79'),_0x11964e[_0x32b1('0x49')]['id']);for(var _0x4388b2=0x0;_0x4388b2<_0x25ac61[_0x32b1('0x3a')];_0x4388b2+=0x1){let _0x5586be=_0x25ac61[_0x4388b2];for(var _0x244308=0x0;_0x244308<_0x5586be[_0x32b1('0x66')][_0x32b1('0x3a')];_0x244308+=0x1){let _0x5bd9c6=_0x5586be[_0x32b1('0x66')][_0x244308];var _0x25458a=_0x25cee4['clone']();_0x25458a['where'](_0x32b1('0x7a'),_0x5bd9c6['id']);_0x120b2b['push'](db[_0x32b1('0x6b')][_0x32b1('0x36')](_0x25458a[_0x32b1('0x7b')](),{'type':db[_0x32b1('0x6b')][_0x32b1('0x7c')][_0x32b1('0x7d')]})[_0x32b1('0x26')](function(_0x37d3dc){if(_0x37d3dc[_0x32b1('0x3a')]===0x1){return _0x5bd9c6['id'];}else{var _0x2963f7=_['every'](_[_0x32b1('0x2e')](_0x37d3dc,'TeamId'),function(_0x40a12d){return _[_0x32b1('0x7e')](_0x561b51,_0x40a12d);});if(_0x2963f7){return _0x5bd9c6['id'];}}}));}}return BPromise[_0x32b1('0x7f')](_0x120b2b)[_0x32b1('0x26')](function(_0x7797dd){_0x253db5=_(_0x253db5)[_0x32b1('0x80')](_0x7797dd)[_0x32b1('0x81')]()[_0x32b1('0x82')]();return db[_0x32b1('0x2f')][_0x32b1('0x4c')]({'where':{'id':_0x11964e[_0x32b1('0x49')]['id']}})[_0x32b1('0x26')](function(_0x272a39){return db[_0x32b1('0x6b')][_0x32b1('0x6c')](function(_0x1214a3){return _0x272a39[_0x32b1('0x71')](_0x11964e['query'][_0x32b1('0x65')],{'transaction':_0x1214a3})[_0x32b1('0x26')](function(){if(!_[_0x32b1('0x83')](_0x253db5)){return _0x272a39[_0x32b1('0x84')](_0x253db5,{'transaction':_0x1214a3});}})['then'](function(){_0x253db5[_0x32b1('0x6e')](function(_0x3abffb){socket['emit'](_0x32b1('0x85'),{'UserId':_0x3abffb,'WhatsappQueueId':_0x272a39['id']});});});});});});})['then'](respondWithStatusCode(_0x2c619d,null))[_0x32b1('0x48')](handleError(_0x2c619d,null));};exports[_0x32b1('0x86')]=function(_0x58906a,_0x458988,_0x25239b){return db[_0x32b1('0x2f')]['find']({'where':{'id':_0x58906a[_0x32b1('0x49')]['id']}})[_0x32b1('0x26')](handleEntityNotFound(_0x458988,null))[_0x32b1('0x26')](function(_0x554d9f){if(_0x554d9f){return _0x554d9f[_0x32b1('0x86')](_0x58906a['body']['ids'],_['omit'](_0x58906a['body'],['ids','id'])||{})[_0x32b1('0x87')](function(_0x19c4e7){for(var _0x1ac172=0x0;_0x1ac172<_0x58906a[_0x32b1('0x4e')][_0x32b1('0x65')][_0x32b1('0x3a')];_0x1ac172+=0x1){socket[_0x32b1('0x6f')]('userWhatsappQueue:save',{'UserId':Number(_0x58906a[_0x32b1('0x4e')][_0x32b1('0x65')][_0x1ac172]),'WhatsappQueueId':Number(_0x58906a['params']['id'])});}return _0x19c4e7;});}})[_0x32b1('0x26')](respondWithResult(_0x458988,null))[_0x32b1('0x48')](handleError(_0x458988,null));};exports['removeAgents']=function(_0x1b284f,_0x1ad499,_0x1630e6){return db[_0x32b1('0x2f')][_0x32b1('0x4c')]({'where':{'id':_0x1b284f[_0x32b1('0x49')]['id']}})[_0x32b1('0x26')](handleEntityNotFound(_0x1ad499,null))[_0x32b1('0x26')](function(_0x29f0bf){if(_0x29f0bf){return _0x29f0bf[_0x32b1('0x84')](_0x1b284f[_0x32b1('0x36')][_0x32b1('0x65')])['then'](function(){if(_[_0x32b1('0x88')](_0x1b284f[_0x32b1('0x36')][_0x32b1('0x65')])){for(var _0x5896d8=0x0;_0x5896d8<_0x1b284f[_0x32b1('0x36')][_0x32b1('0x65')]['length'];_0x5896d8+=0x1){socket[_0x32b1('0x6f')](_0x32b1('0x85'),{'UserId':Number(_0x1b284f['query']['ids'][_0x5896d8]),'WhatsappQueueId':Number(_0x1b284f[_0x32b1('0x49')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x1b284f[_0x32b1('0x36')][_0x32b1('0x65')]),'WhatsappQueueId':Number(_0x1b284f[_0x32b1('0x49')]['id'])});}});}})[_0x32b1('0x26')](respondWithStatusCode(_0x1ad499,null))[_0x32b1('0x48')](handleError(_0x1ad499,null));};exports['getAgents']=function(_0xc5e23e,_0x3f8af5,_0x240854){var _0x279565={};var _0x459037={};var _0x3ad98a;var _0x343d51;return db[_0x32b1('0x2f')][_0x32b1('0x62')]({'where':{'id':_0xc5e23e[_0x32b1('0x49')]['id']}})[_0x32b1('0x26')](handleEntityNotFound(_0x3f8af5,null))[_0x32b1('0x26')](function(_0x3e989b){if(_0x3e989b){_0x3ad98a=_0x3e989b;_0x459037[_0x32b1('0x34')]=_[_0x32b1('0x4a')](db[_0x32b1('0x58')][_0x32b1('0x30')]);_0x459037[_0x32b1('0x36')]=_['keys'](_0xc5e23e[_0x32b1('0x36')]);_0x459037[_0x32b1('0x37')]=_['intersection'](_0x459037[_0x32b1('0x34')],_0x459037['query']);_0x279565[_0x32b1('0x38')]=_[_0x32b1('0x39')](_0x459037[_0x32b1('0x34')],qs[_0x32b1('0x4b')](_0xc5e23e[_0x32b1('0x36')][_0x32b1('0x4b')]));_0x279565['attributes']=_0x279565[_0x32b1('0x38')]['length']?_0x279565[_0x32b1('0x38')]:_0x459037[_0x32b1('0x34')];_0x279565[_0x32b1('0x3d')]=qs[_0x32b1('0x3e')](_0xc5e23e[_0x32b1('0x36')][_0x32b1('0x3e')]);_0x279565[_0x32b1('0x3f')]=qs[_0x32b1('0x37')](_[_0x32b1('0x40')](_0xc5e23e['query'],_0x459037['filters']));if(_0xc5e23e['query'][_0x32b1('0x41')]){_0x279565['where']=_[_0x32b1('0x42')](_0x279565[_0x32b1('0x3f')],{'$or':_[_0x32b1('0x2e')](_0x279565['attributes'],function(_0x585293){var _0x3c4975={};_0x3c4975[_0x585293]={'$like':'%'+_0xc5e23e[_0x32b1('0x36')][_0x32b1('0x41')]+'%'};return _0x3c4975;})});}_0x279565=_[_0x32b1('0x42')]({},_0x279565,_0xc5e23e['options']);return _0x3ad98a['getAgents'](_0x279565);}})[_0x32b1('0x26')](function(_0x563337){if(_0x563337){_0x343d51=_0x563337[_0x32b1('0x3a')];if(!_0xc5e23e['query']['hasOwnProperty'](_0x32b1('0x3c'))){_0x279565[_0x32b1('0x21')]=qs[_0x32b1('0x21')](_0xc5e23e[_0x32b1('0x36')]['limit']);_0x279565[_0x32b1('0x20')]=qs['offset'](_0xc5e23e[_0x32b1('0x36')][_0x32b1('0x20')]);}return _0x3ad98a[_0x32b1('0x89')](_0x279565);}})[_0x32b1('0x26')](function(_0x1f55c3){if(_0x1f55c3){return _0x1f55c3?{'count':_0x343d51,'rows':_0x1f55c3}:null;}})['then'](respondWithResult(_0x3f8af5,null))['catch'](handleError(_0x3f8af5,null));}; \ No newline at end of file +var _0xaa36=['set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','WhatsappQueue','findAll','rows','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','format','%s/%s','getTeams','Team','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','compact','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','undefined','count','offset','limit'];(function(_0x668717,_0x3beaf0){var _0x1b8400=function(_0x3a401c){while(--_0x3a401c){_0x668717['push'](_0x668717['shift']());}};_0x1b8400(++_0x3beaf0);}(_0xaa36,0x184));var _0x6aa3=function(_0x3b1448,_0x5500a5){_0x3b1448=_0x3b1448-0x0;var _0x37f2e7=_0xaa36[_0x3b1448];return _0x37f2e7;};'use strict';var emlformat=require(_0x6aa3('0x0'));var rimraf=require(_0x6aa3('0x1'));var zipdir=require(_0x6aa3('0x2'));var jsonpatch=require(_0x6aa3('0x3'));var rp=require(_0x6aa3('0x4'));var moment=require('moment');var BPromise=require(_0x6aa3('0x5'));var Mustache=require(_0x6aa3('0x6'));var util=require(_0x6aa3('0x7'));var path=require(_0x6aa3('0x8'));var sox=require(_0x6aa3('0x9'));var csv=require(_0x6aa3('0xa'));var ejs=require(_0x6aa3('0xb'));var fs=require('fs');var fs_extra=require(_0x6aa3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6aa3('0xd'));var jsforce=require(_0x6aa3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6aa3('0xf'));var Papa=require('papaparse');var Redis=require(_0x6aa3('0x10'));var authService=require(_0x6aa3('0x11'));var qs=require(_0x6aa3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6aa3('0x13'));var logger=require(_0x6aa3('0x14'))(_0x6aa3('0x15'));var utils=require(_0x6aa3('0x16'));var config=require(_0x6aa3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6aa3('0x18'))['db'];config[_0x6aa3('0x19')]=_[_0x6aa3('0x1a')](config['redis'],{'host':_0x6aa3('0x1b'),'port':0x18eb});var socket=require(_0x6aa3('0x1c'))(new Redis(config[_0x6aa3('0x19')]));require(_0x6aa3('0x1d'))[_0x6aa3('0x1e')](socket);function respondWithStatusCode(_0x556a95,_0x260950){_0x260950=_0x260950||0xcc;return function(_0x142ea6){if(_0x142ea6){return _0x556a95['sendStatus'](_0x260950);}return _0x556a95[_0x6aa3('0x1f')](_0x260950)[_0x6aa3('0x20')]();};}function respondWithResult(_0x44f597,_0x4f169e){_0x4f169e=_0x4f169e||0xc8;return function(_0x310700){if(_0x310700){return _0x44f597[_0x6aa3('0x1f')](_0x4f169e)[_0x6aa3('0x21')](_0x310700);}};}function respondWithFilteredResult(_0x3923bb,_0x191042){return function(_0x4bc9e5){if(_0x4bc9e5){var _0x321189=typeof _0x191042['offset']===_0x6aa3('0x22')&&typeof _0x191042['limit']===_0x6aa3('0x22');var _0x35d9e4=_0x4bc9e5[_0x6aa3('0x23')];var _0x29eba7=_0x321189?0x0:_0x191042[_0x6aa3('0x24')];var _0x451c89=_0x321189?_0x4bc9e5[_0x6aa3('0x23')]:_0x191042[_0x6aa3('0x24')]+_0x191042[_0x6aa3('0x25')];var _0x3307d3;if(_0x451c89>=_0x35d9e4){_0x451c89=_0x35d9e4;_0x3307d3=0xc8;}else{_0x3307d3=0xce;}_0x3923bb['status'](_0x3307d3);return _0x3923bb[_0x6aa3('0x26')](_0x6aa3('0x27'),_0x29eba7+'-'+_0x451c89+'/'+_0x35d9e4)[_0x6aa3('0x21')](_0x4bc9e5);}return null;};}function patchUpdates(_0x1abf47){return function(_0x272353){try{jsonpatch[_0x6aa3('0x28')](_0x272353,_0x1abf47,!![]);}catch(_0x46db33){return BPromise['reject'](_0x46db33);}return _0x272353[_0x6aa3('0x29')]();};}function saveUpdates(_0xc130e4,_0x286a4c){return function(_0xc655d5){if(_0xc655d5){return _0xc655d5[_0x6aa3('0x2a')](_0xc130e4)[_0x6aa3('0x2b')](function(_0x93bec4){return _0x93bec4;});}return null;};}function removeEntity(_0x34a575,_0x447980){return function(_0x50dff1){if(_0x50dff1){return _0x50dff1[_0x6aa3('0x2c')]()['then'](function(){var _0x3e4123=_0x50dff1[_0x6aa3('0x2d')]({'plain':!![]});var _0x3d237b=_0x6aa3('0x2e');return db[_0x6aa3('0x2f')]['destroy']({'where':{'type':_0x3d237b,'resourceId':_0x3e4123['id']}})[_0x6aa3('0x2b')](function(){return _0x50dff1;});})[_0x6aa3('0x2b')](function(){_0x34a575[_0x6aa3('0x1f')](0xcc)[_0x6aa3('0x20')]();});}};}function handleEntityNotFound(_0xd5e247,_0x57639f){return function(_0x2173ec){if(!_0x2173ec){_0xd5e247['sendStatus'](0x194);}return _0x2173ec;};}function handleError(_0x4b18f0,_0x14e6be){_0x14e6be=_0x14e6be||0x1f4;return function(_0x376d66){logger[_0x6aa3('0x30')](_0x376d66[_0x6aa3('0x31')]);if(_0x376d66[_0x6aa3('0x32')]){delete _0x376d66[_0x6aa3('0x32')];}_0x4b18f0[_0x6aa3('0x1f')](_0x14e6be)['send'](_0x376d66);};}exports['index']=function(_0x9b60f3,_0x2d426f){var _0x19e76d={},_0x547e33={},_0x4dc548={'count':0x0,'rows':[]};var _0x3e11cf=_[_0x6aa3('0x33')](db['WhatsappQueue'][_0x6aa3('0x34')],function(_0x2cf98a){return{'name':_0x2cf98a[_0x6aa3('0x35')],'type':_0x2cf98a[_0x6aa3('0x36')][_0x6aa3('0x37')]};});_0x547e33[_0x6aa3('0x38')]=_['map'](_0x3e11cf,_0x6aa3('0x32'));_0x547e33[_0x6aa3('0x39')]=_['keys'](_0x9b60f3[_0x6aa3('0x39')]);_0x547e33[_0x6aa3('0x3a')]=_[_0x6aa3('0x3b')](_0x547e33[_0x6aa3('0x38')],_0x547e33[_0x6aa3('0x39')]);_0x19e76d[_0x6aa3('0x3c')]=_[_0x6aa3('0x3b')](_0x547e33[_0x6aa3('0x38')],qs['fields'](_0x9b60f3[_0x6aa3('0x39')][_0x6aa3('0x3d')]));_0x19e76d[_0x6aa3('0x3c')]=_0x19e76d[_0x6aa3('0x3c')][_0x6aa3('0x3e')]?_0x19e76d[_0x6aa3('0x3c')]:_0x547e33[_0x6aa3('0x38')];if(!_0x9b60f3['query'][_0x6aa3('0x3f')](_0x6aa3('0x40'))){_0x19e76d[_0x6aa3('0x25')]=qs[_0x6aa3('0x25')](_0x9b60f3[_0x6aa3('0x39')][_0x6aa3('0x25')]);_0x19e76d[_0x6aa3('0x24')]=qs[_0x6aa3('0x24')](_0x9b60f3[_0x6aa3('0x39')]['offset']);}_0x19e76d[_0x6aa3('0x41')]=qs[_0x6aa3('0x42')](_0x9b60f3[_0x6aa3('0x39')][_0x6aa3('0x42')]);_0x19e76d[_0x6aa3('0x43')]=qs[_0x6aa3('0x3a')](_[_0x6aa3('0x44')](_0x9b60f3[_0x6aa3('0x39')],_0x547e33['filters']),_0x3e11cf);if(_0x9b60f3[_0x6aa3('0x39')][_0x6aa3('0x45')]){_0x19e76d[_0x6aa3('0x43')]=_[_0x6aa3('0x46')](_0x19e76d[_0x6aa3('0x43')],{'$or':_['map'](_0x3e11cf,function(_0xd310d7){if(_0xd310d7[_0x6aa3('0x36')]!==_0x6aa3('0x47')){var _0x3c476a={};_0x3c476a[_0xd310d7[_0x6aa3('0x32')]]={'$like':'%'+_0x9b60f3[_0x6aa3('0x39')][_0x6aa3('0x45')]+'%'};return _0x3c476a;}})});}_0x19e76d=_['merge']({},_0x19e76d,_0x9b60f3['options']);var _0x3d84a8={'where':_0x19e76d[_0x6aa3('0x43')]};return db['WhatsappQueue'][_0x6aa3('0x23')](_0x3d84a8)[_0x6aa3('0x2b')](function(_0x32bb8f){_0x4dc548['count']=_0x32bb8f;if(_0x9b60f3[_0x6aa3('0x39')][_0x6aa3('0x48')]){_0x19e76d[_0x6aa3('0x49')]=[{'all':!![]}];}return db[_0x6aa3('0x4a')][_0x6aa3('0x4b')](_0x19e76d);})[_0x6aa3('0x2b')](function(_0x2e80d3){_0x4dc548[_0x6aa3('0x4c')]=_0x2e80d3;return _0x4dc548;})['then'](respondWithFilteredResult(_0x2d426f,_0x19e76d))['catch'](handleError(_0x2d426f,null));};exports[_0x6aa3('0x4d')]=function(_0x229472,_0x4c0e49){var _0xe554d5={'raw':!![],'where':{'id':_0x229472[_0x6aa3('0x4e')]['id']}},_0x20de5c={};_0x20de5c[_0x6aa3('0x38')]=_[_0x6aa3('0x4f')](db[_0x6aa3('0x4a')][_0x6aa3('0x34')]);_0x20de5c[_0x6aa3('0x39')]=_['keys'](_0x229472[_0x6aa3('0x39')]);_0x20de5c[_0x6aa3('0x3a')]=_[_0x6aa3('0x3b')](_0x20de5c[_0x6aa3('0x38')],_0x20de5c[_0x6aa3('0x39')]);_0xe554d5['attributes']=_[_0x6aa3('0x3b')](_0x20de5c[_0x6aa3('0x38')],qs[_0x6aa3('0x3d')](_0x229472[_0x6aa3('0x39')][_0x6aa3('0x3d')]));_0xe554d5[_0x6aa3('0x3c')]=_0xe554d5[_0x6aa3('0x3c')][_0x6aa3('0x3e')]?_0xe554d5[_0x6aa3('0x3c')]:_0x20de5c['model'];if(_0x229472[_0x6aa3('0x39')][_0x6aa3('0x48')]){_0xe554d5[_0x6aa3('0x49')]=[{'all':!![]}];}_0xe554d5=_[_0x6aa3('0x46')]({},_0xe554d5,_0x229472[_0x6aa3('0x50')]);return db[_0x6aa3('0x4a')][_0x6aa3('0x51')](_0xe554d5)[_0x6aa3('0x2b')](handleEntityNotFound(_0x4c0e49,null))[_0x6aa3('0x2b')](respondWithResult(_0x4c0e49,null))['catch'](handleError(_0x4c0e49,null));};exports[_0x6aa3('0x52')]=function(_0x1f41cb,_0xba46a9){return db[_0x6aa3('0x4a')][_0x6aa3('0x52')](_0x1f41cb['body'],{})['then'](function(_0xed8559){var _0x875894=_0x1f41cb[_0x6aa3('0x53')][_0x6aa3('0x2d')]({'plain':!![]});if(!_0x875894)throw new Error(_0x6aa3('0x54'));if(_0x875894[_0x6aa3('0x55')]==='user'){var _0x596c30=_0xed8559[_0x6aa3('0x2d')]({'plain':!![]});var _0x37802a=_0x6aa3('0x2e');return db[_0x6aa3('0x56')]['find']({'where':{'name':_0x37802a,'userProfileId':_0x875894[_0x6aa3('0x57')]},'raw':!![]})['then'](function(_0x4b2032){if(_0x4b2032&&_0x4b2032[_0x6aa3('0x58')]===0x0){return db[_0x6aa3('0x2f')]['create']({'name':_0x596c30[_0x6aa3('0x32')],'resourceId':_0x596c30['id'],'type':_0x4b2032['name'],'sectionId':_0x4b2032['id']},{})[_0x6aa3('0x2b')](function(){return _0xed8559;});}else{return _0xed8559;}})[_0x6aa3('0x59')](function(_0x8aa79b){logger['error'](_0x6aa3('0x5a'),_0x8aa79b);throw _0x8aa79b;});}return _0xed8559;})[_0x6aa3('0x2b')](respondWithResult(_0xba46a9,0xc9))['catch'](handleError(_0xba46a9,null));};exports[_0x6aa3('0x2a')]=function(_0x3125ba,_0x43cf03){if(_0x3125ba['body']['id']){delete _0x3125ba[_0x6aa3('0x5b')]['id'];}return db[_0x6aa3('0x4a')][_0x6aa3('0x51')]({'where':{'id':_0x3125ba[_0x6aa3('0x4e')]['id']}})[_0x6aa3('0x2b')](handleEntityNotFound(_0x43cf03,null))[_0x6aa3('0x2b')](saveUpdates(_0x3125ba['body'],null))[_0x6aa3('0x2b')](respondWithResult(_0x43cf03,null))[_0x6aa3('0x59')](handleError(_0x43cf03,null));};exports[_0x6aa3('0x2c')]=function(_0x35d7a3,_0x563678){return db[_0x6aa3('0x4a')]['find']({'where':{'id':_0x35d7a3['params']['id']}})['then'](handleEntityNotFound(_0x563678,null))[_0x6aa3('0x2b')](removeEntity(_0x563678,null))[_0x6aa3('0x59')](handleError(_0x563678,null));};exports[_0x6aa3('0x5c')]=function(_0x140e5f,_0x5b70b2){return db[_0x6aa3('0x4a')]['describe']()['then'](respondWithResult(_0x5b70b2,null))[_0x6aa3('0x59')](handleError(_0x5b70b2,null));};exports['getMembers']=function(_0x236a35,_0x3a2596,_0x2c52d9){var _0xc4ebf={'raw':!![],'where':{}},_0x4b7a62={},_0x1dbe2f;return db[_0x6aa3('0x4a')][_0x6aa3('0x5d')]({'where':{'id':_0x236a35[_0x6aa3('0x4e')]['id']}})[_0x6aa3('0x2b')](handleEntityNotFound(_0x3a2596,null))['then'](function(_0x1d0420){if(_0x1d0420){_0x1dbe2f=_0x1d0420['get']({'plain':!![]});_0x4b7a62[_0x6aa3('0x38')]=_[_0x6aa3('0x4f')](db[_0x6aa3('0x5e')][_0x6aa3('0x34')]);_0x4b7a62[_0x6aa3('0x39')]=_[_0x6aa3('0x4f')](_0x236a35['query']);_0x4b7a62[_0x6aa3('0x3a')]=_['intersection'](_0x4b7a62[_0x6aa3('0x38')],_0x4b7a62[_0x6aa3('0x39')]);_0xc4ebf['attributes']=_['intersection'](_0x4b7a62[_0x6aa3('0x38')],qs['fields'](_0x236a35[_0x6aa3('0x39')]['fields']));_0xc4ebf['attributes']=_0xc4ebf[_0x6aa3('0x3c')][_0x6aa3('0x3e')]?_0xc4ebf[_0x6aa3('0x3c')]:_0x4b7a62[_0x6aa3('0x38')];if(!_0x236a35['query']['hasOwnProperty'](_0x6aa3('0x40'))){_0xc4ebf['limit']=qs['limit'](_0x236a35[_0x6aa3('0x39')][_0x6aa3('0x25')]);_0xc4ebf['offset']=qs[_0x6aa3('0x24')](_0x236a35[_0x6aa3('0x39')][_0x6aa3('0x24')]);}_0xc4ebf['order']=qs[_0x6aa3('0x42')](_0x236a35[_0x6aa3('0x39')][_0x6aa3('0x42')]);_0xc4ebf[_0x6aa3('0x43')]=qs['filters'](_[_0x6aa3('0x44')](_0x236a35[_0x6aa3('0x39')],_0x4b7a62[_0x6aa3('0x3a')]));_0xc4ebf[_0x6aa3('0x43')][_0x6aa3('0x5f')]=_0x1d0420['id'];if(_0x236a35[_0x6aa3('0x39')][_0x6aa3('0x45')]){_0xc4ebf['where']=_[_0x6aa3('0x46')](_0xc4ebf[_0x6aa3('0x43')],{'$or':_[_0x6aa3('0x33')](_0xc4ebf[_0x6aa3('0x3c')],function(_0x1135fe){var _0x5c2d3d={};_0x5c2d3d[_0x1135fe]={'$like':'%'+_0x236a35[_0x6aa3('0x39')][_0x6aa3('0x45')]+'%'};return _0x5c2d3d;})});}_0xc4ebf=_['merge']({},_0xc4ebf,_0x236a35['options']);return db[_0x6aa3('0x5e')][_0x6aa3('0x4b')](_0xc4ebf);}})[_0x6aa3('0x2b')](function(_0x73a24a){if(_0x73a24a){return db[_0x6aa3('0x60')][_0x6aa3('0x61')]({'where':{'id':_[_0x6aa3('0x33')](_0x73a24a,_0x6aa3('0x62')),'role':'agent'},'attributes':['id',_0x6aa3('0x32'),_0x6aa3('0x63'),_0x6aa3('0x64'),'createdAt']});}})['then'](function(_0x49b178){if(_0x49b178){return{'count':_0x49b178[_0x6aa3('0x23')],'rows':_['map'](_0x49b178[_0x6aa3('0x4c')],function(_0x24e206){return{'membername':_0x24e206[_0x6aa3('0x32')],'UserId':_0x24e206['id'],'queue_name':_0x1dbe2f[_0x6aa3('0x32')],'WhatsappQueueId':_0x1dbe2f['id'],'interface':util[_0x6aa3('0x65')](_0x6aa3('0x66'),'SIP',_0x24e206[_0x6aa3('0x32')]),'penalty':0x0,'paused':_0x24e206[_0x6aa3('0x63')],'createdAt':_0x24e206['createdAt'],'updatedAt':_0x24e206[_0x6aa3('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6aa3('0x2b')](respondWithFilteredResult(_0x3a2596,_0xc4ebf))['catch'](handleError(_0x3a2596,null));};exports[_0x6aa3('0x67')]=function(_0x5706ab,_0x249c29,_0x306988){var _0xfacc3b={};var _0x113cbe={};var _0x22de46;var _0x18501f;return db[_0x6aa3('0x4a')][_0x6aa3('0x5d')]({'where':{'id':_0x5706ab[_0x6aa3('0x4e')]['id']}})[_0x6aa3('0x2b')](handleEntityNotFound(_0x249c29,null))['then'](function(_0x523a1e){if(_0x523a1e){_0x22de46=_0x523a1e;_0x113cbe[_0x6aa3('0x38')]=_[_0x6aa3('0x4f')](db[_0x6aa3('0x68')][_0x6aa3('0x34')]);_0x113cbe[_0x6aa3('0x39')]=_[_0x6aa3('0x4f')](_0x5706ab[_0x6aa3('0x39')]);_0x113cbe['filters']=_[_0x6aa3('0x3b')](_0x113cbe[_0x6aa3('0x38')],_0x113cbe['query']);_0xfacc3b[_0x6aa3('0x3c')]=_[_0x6aa3('0x3b')](_0x113cbe[_0x6aa3('0x38')],qs['fields'](_0x5706ab[_0x6aa3('0x39')]['fields']));_0xfacc3b['attributes']=_0xfacc3b[_0x6aa3('0x3c')][_0x6aa3('0x3e')]?_0xfacc3b['attributes']:_0x113cbe[_0x6aa3('0x38')];_0xfacc3b[_0x6aa3('0x41')]=qs[_0x6aa3('0x42')](_0x5706ab[_0x6aa3('0x39')][_0x6aa3('0x42')]);_0xfacc3b[_0x6aa3('0x43')]=qs[_0x6aa3('0x3a')](_['pick'](_0x5706ab[_0x6aa3('0x39')],_0x113cbe[_0x6aa3('0x3a')]));if(_0x5706ab[_0x6aa3('0x39')]['filter']){_0xfacc3b['where']=_[_0x6aa3('0x46')](_0xfacc3b[_0x6aa3('0x43')],{'$or':_['map'](_0xfacc3b[_0x6aa3('0x3c')],function(_0x51a2e2){var _0x96004={};_0x96004[_0x51a2e2]={'$like':'%'+_0x5706ab['query'][_0x6aa3('0x45')]+'%'};return _0x96004;})});}_0xfacc3b=_[_0x6aa3('0x46')]({},_0xfacc3b,_0x5706ab[_0x6aa3('0x50')]);return _0x22de46['getTeams'](_0xfacc3b);}})[_0x6aa3('0x2b')](function(_0x4b0dc4){if(_0x4b0dc4){_0x18501f=_0x4b0dc4['length'];if(!_0x5706ab[_0x6aa3('0x39')][_0x6aa3('0x3f')](_0x6aa3('0x40'))){_0xfacc3b[_0x6aa3('0x25')]=qs[_0x6aa3('0x25')](_0x5706ab[_0x6aa3('0x39')]['limit']);_0xfacc3b[_0x6aa3('0x24')]=qs[_0x6aa3('0x24')](_0x5706ab[_0x6aa3('0x39')][_0x6aa3('0x24')]);}return _0x22de46['getTeams'](_0xfacc3b);}})[_0x6aa3('0x2b')](function(_0x4d4ae4){if(_0x4d4ae4){return _0x4d4ae4?{'count':_0x18501f,'rows':_0x4d4ae4}:null;}})['then'](respondWithResult(_0x249c29,null))[_0x6aa3('0x59')](handleError(_0x249c29,null));};exports['addTeams']=function(_0x15256a,_0x5764ca,_0x55455a){var _0x9c1da1=_0x15256a[_0x6aa3('0x5b')][_0x6aa3('0x69')];return db['Team'][_0x6aa3('0x4b')]({'where':{'id':_0x9c1da1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6aa3('0x6a'),'attributes':['id',_0x6aa3('0x32'),'online',_0x6aa3('0x6b'),_0x6aa3('0x6c')],'raw':!![]}]})[_0x6aa3('0x2b')](function(_0x233d1e){if(_0x233d1e){var _0x3d5a20=_[_0x6aa3('0x6d')](_0x233d1e,function(_0x327ab3){var _0x9d85f5=_0x327ab3[_0x6aa3('0x2d')]({'plain':!![]});return _0x9d85f5['Agents'];});return db[_0x6aa3('0x4a')][_0x6aa3('0x51')]({'where':{'id':_0x15256a[_0x6aa3('0x4e')]['id']}})[_0x6aa3('0x2b')](function(_0x381d4c){return db[_0x6aa3('0x6e')][_0x6aa3('0x6f')](function(_0x3b1f0f){return _0x381d4c['addTeams'](_0x9c1da1,{'transaction':_0x3b1f0f})['then'](function(){return BPromise[_0x6aa3('0x70')](_0x3d5a20,function(_0x54bf2d){return db[_0x6aa3('0x5e')][_0x6aa3('0x71')]({'where':{'UserId':_0x54bf2d['id'],'WhatsappQueueId':_0x15256a['params']['id']},'transaction':_0x3b1f0f});});})[_0x6aa3('0x2b')](function(){_0x3d5a20[_0x6aa3('0x72')](function(_0x3c4c3e){socket['emit']('userWhatsappQueue:save',{'UserId':_0x3c4c3e['id'],'WhatsappQueueId':_0x381d4c['id']});});});});});}})['then'](respondWithStatusCode(_0x5764ca,null))[_0x6aa3('0x59')](handleError(_0x5764ca,null));};exports[_0x6aa3('0x73')]=function(_0x5e7196,_0x54ae99,_0x13b84b){return db['Team'][_0x6aa3('0x4b')]({'where':{'id':_0x5e7196['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x6aa3('0x60')],'as':_0x6aa3('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x6aa3('0x2b')](handleEntityNotFound(_0x54ae99,null))[_0x6aa3('0x2b')](function(_0x58acd1){var _0x2c4ac5=_[_0x6aa3('0x33')](_0x58acd1,'id');var _0x11ac85=[];var _0x2200cb=[];var _0x193c7d=squel[_0x6aa3('0x74')]();_0x193c7d[_0x6aa3('0x75')]('tq.TeamId')[_0x6aa3('0x76')]('team_has_whatsapp_queues','tq')[_0x6aa3('0x77')](_0x6aa3('0x78'),'ut',_0x6aa3('0x79'))[_0x6aa3('0x43')](_0x6aa3('0x7a'),_0x5e7196[_0x6aa3('0x4e')]['id']);for(var _0x355e04=0x0;_0x355e04<_0x58acd1[_0x6aa3('0x3e')];_0x355e04+=0x1){let _0x118d21=_0x58acd1[_0x355e04];for(var _0x2ef841=0x0;_0x2ef841<_0x118d21[_0x6aa3('0x6a')][_0x6aa3('0x3e')];_0x2ef841+=0x1){let _0x78e23b=_0x118d21[_0x6aa3('0x6a')][_0x2ef841];var _0xf95b52=_0x193c7d[_0x6aa3('0x7b')]();_0xf95b52[_0x6aa3('0x43')](_0x6aa3('0x7c'),_0x78e23b['id']);_0x2200cb[_0x6aa3('0x7d')](db[_0x6aa3('0x6e')][_0x6aa3('0x39')](_0xf95b52[_0x6aa3('0x7e')](),{'type':db['sequelize'][_0x6aa3('0x7f')]['SELECT']})[_0x6aa3('0x2b')](function(_0x41ee05){if(_0x41ee05[_0x6aa3('0x3e')]===0x1){return _0x78e23b['id'];}else{var _0x20e224=_[_0x6aa3('0x80')](_[_0x6aa3('0x33')](_0x41ee05,_0x6aa3('0x81')),function(_0x16e51c){return _[_0x6aa3('0x82')](_0x2c4ac5,_0x16e51c);});if(_0x20e224){return _0x78e23b['id'];}}}));}}return BPromise['all'](_0x2200cb)[_0x6aa3('0x2b')](function(_0x3bec67){_0x11ac85=_(_0x11ac85)[_0x6aa3('0x83')](_0x3bec67)[_0x6aa3('0x84')]()['value']();return db[_0x6aa3('0x4a')][_0x6aa3('0x51')]({'where':{'id':_0x5e7196[_0x6aa3('0x4e')]['id']}})[_0x6aa3('0x2b')](function(_0x8fbd4b){return db[_0x6aa3('0x6e')]['transaction'](function(_0x709844){return _0x8fbd4b[_0x6aa3('0x73')](_0x5e7196[_0x6aa3('0x39')]['ids'],{'transaction':_0x709844})[_0x6aa3('0x2b')](function(){if(!_[_0x6aa3('0x85')](_0x11ac85)){return _0x8fbd4b[_0x6aa3('0x86')](_0x11ac85,{'transaction':_0x709844});}})[_0x6aa3('0x2b')](function(){_0x11ac85['forEach'](function(_0xb66f31){socket[_0x6aa3('0x87')](_0x6aa3('0x88'),{'UserId':_0xb66f31,'WhatsappQueueId':_0x8fbd4b['id']});});});});});});})[_0x6aa3('0x2b')](respondWithStatusCode(_0x54ae99,null))['catch'](handleError(_0x54ae99,null));};exports[_0x6aa3('0x89')]=function(_0x15380c,_0x491daf,_0x252392){return db['WhatsappQueue'][_0x6aa3('0x51')]({'where':{'id':_0x15380c['params']['id']}})['then'](handleEntityNotFound(_0x491daf,null))['then'](function(_0x576981){if(_0x576981){return _0x576981[_0x6aa3('0x89')](_0x15380c[_0x6aa3('0x5b')]['ids'],_[_0x6aa3('0x8a')](_0x15380c[_0x6aa3('0x5b')],['ids','id'])||{})[_0x6aa3('0x8b')](function(_0xd19029){for(var _0x381173=0x0;_0x381173<_0x15380c[_0x6aa3('0x5b')]['ids'][_0x6aa3('0x3e')];_0x381173+=0x1){socket[_0x6aa3('0x87')]('userWhatsappQueue:save',{'UserId':Number(_0x15380c[_0x6aa3('0x5b')][_0x6aa3('0x69')][_0x381173]),'WhatsappQueueId':Number(_0x15380c[_0x6aa3('0x4e')]['id'])});}return _0xd19029;});}})['then'](respondWithResult(_0x491daf,null))[_0x6aa3('0x59')](handleError(_0x491daf,null));};exports[_0x6aa3('0x86')]=function(_0x28dece,_0x17067c,_0x5529e8){return db[_0x6aa3('0x4a')][_0x6aa3('0x51')]({'where':{'id':_0x28dece[_0x6aa3('0x4e')]['id']}})[_0x6aa3('0x2b')](handleEntityNotFound(_0x17067c,null))[_0x6aa3('0x2b')](function(_0x1fbc07){if(_0x1fbc07){return _0x1fbc07['removeAgents'](_0x28dece[_0x6aa3('0x39')][_0x6aa3('0x69')])[_0x6aa3('0x2b')](function(){if(_[_0x6aa3('0x8c')](_0x28dece[_0x6aa3('0x39')][_0x6aa3('0x69')])){for(var _0x39031e=0x0;_0x39031e<_0x28dece[_0x6aa3('0x39')][_0x6aa3('0x69')][_0x6aa3('0x3e')];_0x39031e+=0x1){socket[_0x6aa3('0x87')](_0x6aa3('0x88'),{'UserId':Number(_0x28dece[_0x6aa3('0x39')][_0x6aa3('0x69')][_0x39031e]),'WhatsappQueueId':Number(_0x28dece[_0x6aa3('0x4e')]['id'])});}}else{socket[_0x6aa3('0x87')](_0x6aa3('0x88'),{'UserId':Number(_0x28dece[_0x6aa3('0x39')][_0x6aa3('0x69')]),'WhatsappQueueId':Number(_0x28dece[_0x6aa3('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x17067c,null))[_0x6aa3('0x59')](handleError(_0x17067c,null));};exports['getAgents']=function(_0x235f95,_0x148187,_0xeb1146){var _0x94ee28={};var _0x2ab594={};var _0x105430;var _0x359192;return db[_0x6aa3('0x4a')][_0x6aa3('0x5d')]({'where':{'id':_0x235f95[_0x6aa3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x148187,null))[_0x6aa3('0x2b')](function(_0xd326){if(_0xd326){_0x105430=_0xd326;_0x2ab594[_0x6aa3('0x38')]=_['keys'](db[_0x6aa3('0x60')]['rawAttributes']);_0x2ab594['query']=_[_0x6aa3('0x4f')](_0x235f95['query']);_0x2ab594[_0x6aa3('0x3a')]=_['intersection'](_0x2ab594[_0x6aa3('0x38')],_0x2ab594[_0x6aa3('0x39')]);_0x94ee28['attributes']=_[_0x6aa3('0x3b')](_0x2ab594[_0x6aa3('0x38')],qs[_0x6aa3('0x3d')](_0x235f95[_0x6aa3('0x39')][_0x6aa3('0x3d')]));_0x94ee28[_0x6aa3('0x3c')]=_0x94ee28[_0x6aa3('0x3c')][_0x6aa3('0x3e')]?_0x94ee28[_0x6aa3('0x3c')]:_0x2ab594[_0x6aa3('0x38')];_0x94ee28[_0x6aa3('0x41')]=qs[_0x6aa3('0x42')](_0x235f95['query'][_0x6aa3('0x42')]);_0x94ee28[_0x6aa3('0x43')]=qs[_0x6aa3('0x3a')](_['pick'](_0x235f95[_0x6aa3('0x39')],_0x2ab594['filters']));if(_0x235f95[_0x6aa3('0x39')][_0x6aa3('0x45')]){_0x94ee28['where']=_['merge'](_0x94ee28['where'],{'$or':_['map'](_0x94ee28[_0x6aa3('0x3c')],function(_0x12a9ec){var _0x4ac805={};_0x4ac805[_0x12a9ec]={'$like':'%'+_0x235f95['query']['filter']+'%'};return _0x4ac805;})});}_0x94ee28=_['merge']({},_0x94ee28,_0x235f95[_0x6aa3('0x50')]);return _0x105430[_0x6aa3('0x8d')](_0x94ee28);}})[_0x6aa3('0x2b')](function(_0x54694b){if(_0x54694b){_0x359192=_0x54694b[_0x6aa3('0x3e')];if(!_0x235f95[_0x6aa3('0x39')][_0x6aa3('0x3f')](_0x6aa3('0x40'))){_0x94ee28[_0x6aa3('0x25')]=qs['limit'](_0x235f95[_0x6aa3('0x39')][_0x6aa3('0x25')]);_0x94ee28[_0x6aa3('0x24')]=qs[_0x6aa3('0x24')](_0x235f95[_0x6aa3('0x39')][_0x6aa3('0x24')]);}return _0x105430[_0x6aa3('0x8d')](_0x94ee28);}})[_0x6aa3('0x2b')](function(_0x50066f){if(_0x50066f){return _0x50066f?{'count':_0x359192,'rows':_0x50066f}:null;}})[_0x6aa3('0x2b')](respondWithResult(_0x148187,null))[_0x6aa3('0x59')](handleError(_0x148187,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 28314c5..8bd2be9 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 _0x0bf9=['save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners'];(function(_0x2aca6e,_0x3bae74){var _0x4cc000=function(_0x5a53f4){while(--_0x5a53f4){_0x2aca6e['push'](_0x2aca6e['shift']());}};_0x4cc000(++_0x3bae74);}(_0x0bf9,0xcf));var _0x90bf=function(_0x19281a,_0x32a151){_0x19281a=_0x19281a-0x0;var _0x3609bb=_0x0bf9[_0x19281a];return _0x3609bb;};'use strict';var EventEmitter=require(_0x90bf('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x90bf('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x90bf('0x2')](0x0);var events={'afterCreate':_0x90bf('0x3'),'afterUpdate':_0x90bf('0x4'),'afterDestroy':_0x90bf('0x5')};function emitEvent(_0x181d71){return function(_0x54c35f,_0x1fded3,_0x55d86f){WhatsappQueueEvents[_0x90bf('0x6')](_0x181d71+':'+_0x54c35f['id'],_0x54c35f);WhatsappQueueEvents[_0x90bf('0x6')](_0x181d71,_0x54c35f);_0x55d86f(null);};}for(var e in events){if(events[_0x90bf('0x7')](e)){var event=events[e];WhatsappQueue[_0x90bf('0x8')](e,emitEvent(event));}}module[_0x90bf('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x0b3e=['hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x1c158d,_0xbdbc3c){var _0x5e0515=function(_0x5dc36f){while(--_0x5dc36f){_0x1c158d['push'](_0x1c158d['shift']());}};_0x5e0515(++_0xbdbc3c);}(_0x0b3e,0x19a));var _0xe0b3=function(_0x1fe5ad,_0x4005dd){_0x1fe5ad=_0x1fe5ad-0x0;var _0x106e86=_0x0b3e[_0x1fe5ad];return _0x106e86;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xe0b3('0x0'))['db'][_0xe0b3('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xe0b3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe0b3('0x3')};function emitEvent(_0xdd4b9b){return function(_0xc85d8e,_0x33936c,_0x2f0c8b){WhatsappQueueEvents[_0xe0b3('0x4')](_0xdd4b9b+':'+_0xc85d8e['id'],_0xc85d8e);WhatsappQueueEvents['emit'](_0xdd4b9b,_0xc85d8e);_0x2f0c8b(null);};}for(var e in events){if(events[_0xe0b3('0x5')](e)){var event=events[e];WhatsappQueue[_0xe0b3('0x6')](e,emitEvent(event));}}module[_0xe0b3('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 173e13d..feb95ee 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 _0xc0bc=['exports','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2378d7,_0x49801e){var _0x29c8c1=function(_0x58314d){while(--_0x58314d){_0x2378d7['push'](_0x2378d7['shift']());}};_0x29c8c1(++_0x49801e);}(_0xc0bc,0x1ee));var _0xcc0b=function(_0x1a8773,_0x27d2ce){_0x1a8773=_0x1a8773-0x0;var _0x1f6367=_0xc0bc[_0x1a8773];return _0x1f6367;};'use strict';var _=require(_0xcc0b('0x0'));var util=require(_0xcc0b('0x1'));var logger=require(_0xcc0b('0x2'))(_0xcc0b('0x3'));var moment=require(_0xcc0b('0x4'));var BPromise=require(_0xcc0b('0x5'));var rp=require(_0xcc0b('0x6'));var fs=require('fs');var path=require(_0xcc0b('0x7'));var rimraf=require(_0xcc0b('0x8'));var config=require(_0xcc0b('0x9'));var attributes=require('./whatsappQueue.attributes');module[_0xcc0b('0xa')]=function(_0x1bf83d,_0x25c402){return _0x1bf83d['define']('WhatsappQueue',attributes,{'tableName':_0xcc0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x953b=['path','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x152a69,_0x613282){var _0x3d529b=function(_0xec4e71){while(--_0xec4e71){_0x152a69['push'](_0x152a69['shift']());}};_0x3d529b(++_0x613282);}(_0x953b,0xeb));var _0xb953=function(_0x5943a1,_0x2b7cec){_0x5943a1=_0x5943a1-0x0;var _0x4d7a40=_0x953b[_0x5943a1];return _0x4d7a40;};'use strict';var _=require('lodash');var util=require(_0xb953('0x0'));var logger=require(_0xb953('0x1'))(_0xb953('0x2'));var moment=require(_0xb953('0x3'));var BPromise=require(_0xb953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb953('0x5'));var rimraf=require(_0xb953('0x6'));var config=require(_0xb953('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0xb953('0x8')]=function(_0xabe456,_0x19a040){return _0xabe456[_0xb953('0x9')](_0xb953('0xa'),attributes,{'tableName':_0xb953('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 213e808..3b67a8e 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 _0x4be7=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowWhatsappQueue','find','lodash','util'];(function(_0x316138,_0x129321){var _0x4f0cd9=function(_0x4cef4e){while(--_0x4cef4e){_0x316138['push'](_0x316138['shift']());}};_0x4f0cd9(++_0x129321);}(_0x4be7,0x1b6));var _0x74be=function(_0x1b892b,_0x4efe48){_0x1b892b=_0x1b892b-0x0;var _0xa99e57=_0x4be7[_0x1b892b];return _0xa99e57;};'use strict';var _=require(_0x74be('0x0'));var util=require(_0x74be('0x1'));var moment=require(_0x74be('0x2'));var BPromise=require(_0x74be('0x3'));var rs=require(_0x74be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74be('0x5'))['db'];var utils=require(_0x74be('0x6'));var logger=require('../../config/logger')(_0x74be('0x7'));var config=require(_0x74be('0x8'));var jayson=require(_0x74be('0x9'));var client=jayson[_0x74be('0xa')][_0x74be('0xb')]({'port':0x232a});config[_0x74be('0xc')]=_[_0x74be('0xd')](config[_0x74be('0xc')],{'host':_0x74be('0xe'),'port':0x18eb});var socket=require(_0x74be('0xf'))(new Redis(config[_0x74be('0xc')]));require(_0x74be('0x10'))[_0x74be('0x11')](socket);function respondWithRpcPromise(_0x3dc889,_0x174fa8,_0xba8032){return new BPromise(function(_0x10a306,_0x285fc6){return client[_0x74be('0x12')](_0x3dc889,_0xba8032)['then'](function(_0x1294e8){logger[_0x74be('0x13')](_0x74be('0x14'),_0x174fa8,_0x74be('0x15'));logger[_0x74be('0x16')](_0x74be('0x17'),_0x174fa8,_0x74be('0x15'),JSON[_0x74be('0x18')](_0x1294e8));if(_0x1294e8['error']){if(_0x1294e8[_0x74be('0x19')][_0x74be('0x1a')]===0x1f4){logger[_0x74be('0x19')](_0x74be('0x14'),_0x174fa8,_0x1294e8[_0x74be('0x19')][_0x74be('0x1b')]);return _0x285fc6(_0x1294e8[_0x74be('0x19')][_0x74be('0x1b')]);}logger[_0x74be('0x19')](_0x74be('0x14'),_0x174fa8,_0x1294e8[_0x74be('0x19')][_0x74be('0x1b')]);return _0x10a306(_0x1294e8['error'][_0x74be('0x1b')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x174fa8,_0x74be('0x15'));_0x10a306(_0x1294e8[_0x74be('0x1c')]['message']);}})[_0x74be('0x1d')](function(_0x1d04fa){logger['error'](_0x74be('0x14'),_0x174fa8,_0x1d04fa);_0x285fc6(_0x1d04fa);});});}exports[_0x74be('0x1e')]=function(_0x1d9289){var _0xbf0a97=this;return new Promise(function(_0x4fc74b,_0x42a1b0){return db[_0x74be('0x1f')][_0x74be('0x20')]({'raw':_0x1d9289[_0x74be('0x21')]?_0x1d9289[_0x74be('0x21')][_0x74be('0x22')]===undefined?!![]:![]:!![],'where':_0x1d9289[_0x74be('0x21')]?_0x1d9289[_0x74be('0x21')][_0x74be('0x23')]||null:null,'attributes':_0x1d9289[_0x74be('0x21')]?_0x1d9289[_0x74be('0x21')][_0x74be('0x24')]||null:null,'limit':_0x1d9289['options']?_0x1d9289[_0x74be('0x21')][_0x74be('0x25')]||null:null,'include':_0x1d9289[_0x74be('0x21')]?_0x1d9289[_0x74be('0x21')][_0x74be('0x26')]?_['map'](_0x1d9289[_0x74be('0x21')][_0x74be('0x26')],function(_0x26a0b3){return{'model':db[_0x26a0b3[_0x74be('0x27')]],'as':_0x26a0b3['as'],'attributes':_0x26a0b3[_0x74be('0x24')],'include':_0x26a0b3['include']?_[_0x74be('0x28')](_0x26a0b3[_0x74be('0x26')],function(_0x54a54a){return{'model':db[_0x54a54a[_0x74be('0x27')]],'as':_0x54a54a['as'],'attributes':_0x54a54a[_0x74be('0x24')],'include':_0x54a54a[_0x74be('0x26')]?_['map'](_0x54a54a[_0x74be('0x26')],function(_0x53bd5d){return{'model':db[_0x53bd5d['model']],'as':_0x53bd5d['as'],'attributes':_0x53bd5d[_0x74be('0x24')]};}):[]};}):[]};}):[]:[]})[_0x74be('0x29')](function(_0x142efd){logger['info'](_0x74be('0x1e'),_0x1d9289);logger[_0x74be('0x16')](_0x74be('0x1e'),_0x1d9289,JSON[_0x74be('0x18')](_0x142efd));_0x4fc74b(_0x142efd);})['catch'](function(_0x30b22e){logger[_0x74be('0x19')](_0x74be('0x1e'),_0x30b22e[_0x74be('0x1b')],_0x1d9289);_0x42a1b0(_0xbf0a97['error'](0x1f4,_0x30b22e['message']));});});};exports[_0x74be('0x2a')]=function(_0x357199){var _0x346725=this;return new Promise(function(_0x40fbb0,_0x4f1a3b){return db['WhatsappQueue'][_0x74be('0x2b')]({'raw':_0x357199[_0x74be('0x21')]?_0x357199[_0x74be('0x21')][_0x74be('0x22')]===undefined?!![]:![]:!![],'where':_0x357199[_0x74be('0x21')]?_0x357199['options'][_0x74be('0x23')]||null:null,'attributes':_0x357199[_0x74be('0x21')]?_0x357199['options'][_0x74be('0x24')]||null:null,'include':_0x357199[_0x74be('0x21')]?_0x357199[_0x74be('0x21')][_0x74be('0x26')]?_[_0x74be('0x28')](_0x357199[_0x74be('0x21')][_0x74be('0x26')],function(_0x299b4c){return{'model':db[_0x299b4c[_0x74be('0x27')]],'as':_0x299b4c['as'],'attributes':_0x299b4c[_0x74be('0x24')],'include':_0x299b4c[_0x74be('0x26')]?_[_0x74be('0x28')](_0x299b4c['include'],function(_0x326cd4){return{'model':db[_0x326cd4['model']],'as':_0x326cd4['as'],'attributes':_0x326cd4[_0x74be('0x24')],'include':_0x326cd4[_0x74be('0x26')]?_[_0x74be('0x28')](_0x326cd4[_0x74be('0x26')],function(_0x252443){return{'model':db[_0x252443[_0x74be('0x27')]],'as':_0x252443['as'],'attributes':_0x252443[_0x74be('0x24')]};}):[]};}):[]};}):[]:[]})[_0x74be('0x29')](function(_0x4c0811){logger['info'](_0x74be('0x2a'),_0x357199);logger['debug'](_0x74be('0x2a'),_0x357199,JSON[_0x74be('0x18')](_0x4c0811));_0x40fbb0(_0x4c0811);})[_0x74be('0x1d')](function(_0x450fcf){logger[_0x74be('0x19')](_0x74be('0x2a'),_0x450fcf['message'],_0x357199);_0x4f1a3b(_0x346725[_0x74be('0x19')](0x1f4,_0x450fcf[_0x74be('0x1b')]));});});}; \ No newline at end of file +var _0xc707=['localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappQueue','findAll','options','where','attributes','include','model','map','GetWhatsappQueue','catch','ShowWhatsappQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults'];(function(_0x439784,_0x43caf8){var _0x46b0c8=function(_0x5c8878){while(--_0x5c8878){_0x439784['push'](_0x439784['shift']());}};_0x46b0c8(++_0x43caf8);}(_0xc707,0x1ca));var _0x7c70=function(_0x1ce9ea,_0x32e6f4){_0x1ce9ea=_0x1ce9ea-0x0;var _0x2a95b9=_0xc707[_0x1ce9ea];return _0x2a95b9;};'use strict';var _=require(_0x7c70('0x0'));var util=require(_0x7c70('0x1'));var moment=require('moment');var BPromise=require(_0x7c70('0x2'));var rs=require(_0x7c70('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c70('0x4'))['db'];var utils=require(_0x7c70('0x5'));var logger=require('../../config/logger')(_0x7c70('0x6'));var config=require('../../config/environment');var jayson=require(_0x7c70('0x7'));var client=jayson[_0x7c70('0x8')]['http']({'port':0x232a});config['redis']=_[_0x7c70('0x9')](config['redis'],{'host':_0x7c70('0xa'),'port':0x18eb});var socket=require(_0x7c70('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x7c70('0xc')](socket);function respondWithRpcPromise(_0x2f34d6,_0x23c470,_0x1b7946){return new BPromise(function(_0x3bfd63,_0x266426){return client[_0x7c70('0xd')](_0x2f34d6,_0x1b7946)[_0x7c70('0xe')](function(_0x1674ea){logger[_0x7c70('0xf')](_0x7c70('0x10'),_0x23c470,_0x7c70('0x11'));logger[_0x7c70('0x12')](_0x7c70('0x13'),_0x23c470,_0x7c70('0x11'),JSON[_0x7c70('0x14')](_0x1674ea));if(_0x1674ea[_0x7c70('0x15')]){if(_0x1674ea[_0x7c70('0x15')][_0x7c70('0x16')]===0x1f4){logger[_0x7c70('0x15')](_0x7c70('0x10'),_0x23c470,_0x1674ea[_0x7c70('0x15')][_0x7c70('0x17')]);return _0x266426(_0x1674ea[_0x7c70('0x15')][_0x7c70('0x17')]);}logger[_0x7c70('0x15')](_0x7c70('0x10'),_0x23c470,_0x1674ea['error'][_0x7c70('0x17')]);return _0x3bfd63(_0x1674ea[_0x7c70('0x15')][_0x7c70('0x17')]);}else{logger[_0x7c70('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x23c470,_0x7c70('0x11'));_0x3bfd63(_0x1674ea[_0x7c70('0x18')][_0x7c70('0x17')]);}})['catch'](function(_0x2b2df9){logger[_0x7c70('0x15')](_0x7c70('0x10'),_0x23c470,_0x2b2df9);_0x266426(_0x2b2df9);});});}exports['GetWhatsappQueue']=function(_0x44921e){var _0x561789=this;return new Promise(function(_0x39ed62,_0x4f91b4){return db[_0x7c70('0x19')][_0x7c70('0x1a')]({'raw':_0x44921e['options']?_0x44921e[_0x7c70('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x44921e[_0x7c70('0x1b')]?_0x44921e[_0x7c70('0x1b')][_0x7c70('0x1c')]||null:null,'attributes':_0x44921e[_0x7c70('0x1b')]?_0x44921e[_0x7c70('0x1b')][_0x7c70('0x1d')]||null:null,'limit':_0x44921e[_0x7c70('0x1b')]?_0x44921e[_0x7c70('0x1b')]['limit']||null:null,'include':_0x44921e['options']?_0x44921e[_0x7c70('0x1b')][_0x7c70('0x1e')]?_['map'](_0x44921e[_0x7c70('0x1b')][_0x7c70('0x1e')],function(_0x4326c2){return{'model':db[_0x4326c2[_0x7c70('0x1f')]],'as':_0x4326c2['as'],'attributes':_0x4326c2['attributes'],'include':_0x4326c2[_0x7c70('0x1e')]?_[_0x7c70('0x20')](_0x4326c2[_0x7c70('0x1e')],function(_0x380c2f){return{'model':db[_0x380c2f[_0x7c70('0x1f')]],'as':_0x380c2f['as'],'attributes':_0x380c2f['attributes'],'include':_0x380c2f[_0x7c70('0x1e')]?_[_0x7c70('0x20')](_0x380c2f['include'],function(_0x187702){return{'model':db[_0x187702[_0x7c70('0x1f')]],'as':_0x187702['as'],'attributes':_0x187702[_0x7c70('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7c70('0xe')](function(_0x245aff){logger[_0x7c70('0xf')](_0x7c70('0x21'),_0x44921e);logger['debug'](_0x7c70('0x21'),_0x44921e,JSON['stringify'](_0x245aff));_0x39ed62(_0x245aff);})[_0x7c70('0x22')](function(_0x33cc3a){logger[_0x7c70('0x15')](_0x7c70('0x21'),_0x33cc3a[_0x7c70('0x17')],_0x44921e);_0x4f91b4(_0x561789[_0x7c70('0x15')](0x1f4,_0x33cc3a[_0x7c70('0x17')]));});});};exports['ShowWhatsappQueue']=function(_0x7bd4ce){var _0x35b22a=this;return new Promise(function(_0x46d400,_0x252a3a){return db[_0x7c70('0x19')]['find']({'raw':_0x7bd4ce[_0x7c70('0x1b')]?_0x7bd4ce[_0x7c70('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x7bd4ce[_0x7c70('0x1b')]?_0x7bd4ce[_0x7c70('0x1b')][_0x7c70('0x1c')]||null:null,'attributes':_0x7bd4ce[_0x7c70('0x1b')]?_0x7bd4ce['options'][_0x7c70('0x1d')]||null:null,'include':_0x7bd4ce['options']?_0x7bd4ce['options'][_0x7c70('0x1e')]?_[_0x7c70('0x20')](_0x7bd4ce[_0x7c70('0x1b')][_0x7c70('0x1e')],function(_0x36318b){return{'model':db[_0x36318b[_0x7c70('0x1f')]],'as':_0x36318b['as'],'attributes':_0x36318b[_0x7c70('0x1d')],'include':_0x36318b[_0x7c70('0x1e')]?_['map'](_0x36318b[_0x7c70('0x1e')],function(_0x131900){return{'model':db[_0x131900[_0x7c70('0x1f')]],'as':_0x131900['as'],'attributes':_0x131900[_0x7c70('0x1d')],'include':_0x131900[_0x7c70('0x1e')]?_[_0x7c70('0x20')](_0x131900[_0x7c70('0x1e')],function(_0x45a06c){return{'model':db[_0x45a06c['model']],'as':_0x45a06c['as'],'attributes':_0x45a06c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c70('0xe')](function(_0x30fcc6){logger[_0x7c70('0xf')]('ShowWhatsappQueue',_0x7bd4ce);logger['debug'](_0x7c70('0x23'),_0x7bd4ce,JSON['stringify'](_0x30fcc6));_0x46d400(_0x30fcc6);})[_0x7c70('0x22')](function(_0x1788a5){logger[_0x7c70('0x15')](_0x7c70('0x23'),_0x1788a5[_0x7c70('0x17')],_0x7bd4ce);_0x252a3a(_0x35b22a[_0x7c70('0x15')](0x1f4,_0x1788a5[_0x7c70('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index cfc78f1..bb23213 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 _0x1c64=['length','./whatsappQueue.events','save','emit','register'];(function(_0x58427a,_0x3f10d1){var _0x4852e8=function(_0x3b28fb){while(--_0x3b28fb){_0x58427a['push'](_0x58427a['shift']());}};_0x4852e8(++_0x3f10d1);}(_0x1c64,0x6f));var _0x41c6=function(_0x1aafcd,_0x223bc4){_0x1aafcd=_0x1aafcd-0x0;var _0x582d5c=_0x1c64[_0x1aafcd];return _0x582d5c;};'use strict';var WhatsappQueueEvents=require(_0x41c6('0x0'));var events=[_0x41c6('0x1'),'remove','update'];function createListener(_0x381520,_0x5651e5){return function(_0x2e9c14){_0x5651e5[_0x41c6('0x2')](_0x381520,_0x2e9c14);};}function removeListener(_0x53517f,_0x32d40e){return function(){WhatsappQueueEvents['removeListener'](_0x53517f,_0x32d40e);};}exports[_0x41c6('0x3')]=function(_0xb31a0b){for(var _0x328762=0x0,_0x5134d4=events[_0x41c6('0x4')];_0x328762<_0x5134d4;_0x328762++){var _0x553663=events[_0x328762];var _0x3ee68a=createListener('whatsappQueue:'+_0x553663,_0xb31a0b);WhatsappQueueEvents['on'](_0x553663,_0x3ee68a);}}; \ No newline at end of file +var _0x9b8f=['whatsappQueue:','./whatsappQueue.events','save','update','emit','removeListener','register','length'];(function(_0x2f5652,_0x5b031a){var _0x395e92=function(_0x15ea29){while(--_0x15ea29){_0x2f5652['push'](_0x2f5652['shift']());}};_0x395e92(++_0x5b031a);}(_0x9b8f,0x111));var _0xf9b8=function(_0x161c0b,_0x22a73f){_0x161c0b=_0x161c0b-0x0;var _0x29bcab=_0x9b8f[_0x161c0b];return _0x29bcab;};'use strict';var WhatsappQueueEvents=require(_0xf9b8('0x0'));var events=[_0xf9b8('0x1'),'remove',_0xf9b8('0x2')];function createListener(_0x4d9115,_0x197fae){return function(_0x4a440d){_0x197fae[_0xf9b8('0x3')](_0x4d9115,_0x4a440d);};}function removeListener(_0x3a5659,_0x201510){return function(){WhatsappQueueEvents[_0xf9b8('0x4')](_0x3a5659,_0x201510);};}exports[_0xf9b8('0x5')]=function(_0x1b3cfb){for(var _0x4652ea=0x0,_0xc80bea=events[_0xf9b8('0x6')];_0x4652ea<_0xc80bea;_0x4652ea++){var _0x14ef2d=events[_0x4652ea];var _0x1105d8=createListener(_0xf9b8('0x7')+_0x14ef2d,_0x1b3cfb);WhatsappQueueEvents['on'](_0x14ef2d,_0x1105d8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 17b77f3..4ed3526 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 _0x0aff=['./whatsappQueueReport.controller','get','isAuthenticated','index','create','put','/:id','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4353ac,_0x1e24d7){var _0x312a73=function(_0x26d2eb){while(--_0x26d2eb){_0x4353ac['push'](_0x4353ac['shift']());}};_0x312a73(++_0x1e24d7);}(_0x0aff,0xe1));var _0xf0af=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0x0aff[_0x104a84];return _0x4973ff;};'use strict';var multer=require(_0xf0af('0x0'));var util=require(_0xf0af('0x1'));var path=require(_0xf0af('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0af('0x3'));var router=express[_0xf0af('0x4')]();var fs_extra=require(_0xf0af('0x5'));var auth=require(_0xf0af('0x6'));var interaction=require(_0xf0af('0x7'));var config=require(_0xf0af('0x8'));var controller=require(_0xf0af('0x9'));router[_0xf0af('0xa')]('/',auth[_0xf0af('0xb')](),controller[_0xf0af('0xc')]);router['get']('/describe',auth[_0xf0af('0xb')](),controller['describe']);router[_0xf0af('0xa')]('/:id',auth[_0xf0af('0xb')](),controller['show']);router['post']('/',auth[_0xf0af('0xb')](),controller[_0xf0af('0xd')]);router[_0xf0af('0xe')](_0xf0af('0xf'),auth[_0xf0af('0xb')](),controller[_0xf0af('0x10')]);router['delete'](_0xf0af('0xf'),auth[_0xf0af('0xb')](),controller[_0xf0af('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8dae=['show','post','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4d0c40,_0x5403fc){var _0x3aaa1e=function(_0xd269aa){while(--_0xd269aa){_0x4d0c40['push'](_0x4d0c40['shift']());}};_0x3aaa1e(++_0x5403fc);}(_0x8dae,0xa7));var _0xe8da=function(_0x4aec15,_0x1ac739){_0x4aec15=_0x4aec15-0x0;var _0x2cfaab=_0x8dae[_0x4aec15];return _0x2cfaab;};'use strict';var multer=require(_0xe8da('0x0'));var util=require('util');var path=require(_0xe8da('0x1'));var timeout=require(_0xe8da('0x2'));var express=require(_0xe8da('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8da('0x4'));var interaction=require(_0xe8da('0x5'));var config=require(_0xe8da('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xe8da('0x7')]('/',auth[_0xe8da('0x8')](),controller[_0xe8da('0x9')]);router[_0xe8da('0x7')](_0xe8da('0xa'),auth[_0xe8da('0x8')](),controller[_0xe8da('0xb')]);router['get'](_0xe8da('0xc'),auth['isAuthenticated'](),controller[_0xe8da('0xd')]);router[_0xe8da('0xe')]('/',auth[_0xe8da('0x8')](),controller['create']);router['put'](_0xe8da('0xc'),auth[_0xe8da('0x8')](),controller[_0xe8da('0xf')]);router[_0xe8da('0x10')](_0xe8da('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe8da('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 798da30..1f798ce 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(_0x42d482,_0x4b6d46){var _0x347902=function(_0x12e81e){while(--_0x12e81e){_0x42d482['push'](_0x42d482['shift']());}};_0x347902(++_0x4b6d46);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x40263a,_0x4b4143){var _0x35f214=function(_0x2a37c3){while(--_0x2a37c3){_0x40263a['push'](_0x40263a['shift']());}};_0x35f214(++_0x4b4143);}(_0x7a54,0x106));var _0x47a5=function(_0x1ff3a1,_0x3325c4){_0x1ff3a1=_0x1ff3a1-0x0;var _0x488bcc=_0x7a54[_0x1ff3a1];return _0x488bcc;};'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 dbd4927..ce1ce53 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 _0x351d=['includeAll','include','catch','show','params','rawAttributes','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','limit','count','offset','apply','reject','save','update','destroy','then','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappQueueReport'];(function(_0x5e1ca7,_0x34b97d){var _0x182e83=function(_0xd6c287){while(--_0xd6c287){_0x5e1ca7['push'](_0x5e1ca7['shift']());}};_0x182e83(++_0x34b97d);}(_0x351d,0x90));var _0xd351=function(_0x5bc111,_0x3a0d3c){_0x5bc111=_0x5bc111-0x0;var _0x54285c=_0x351d[_0x5bc111];return _0x54285c;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb40c,_0x15549a){_0x15549a=_0x15549a||0xcc;return function(_0x23445f){if(_0x23445f){return _0x3eb40c[_0xd351('0x13')](_0x15549a);}return _0x3eb40c['status'](_0x15549a)[_0xd351('0x14')]();};}function respondWithResult(_0x316cf6,_0x597d7c){_0x597d7c=_0x597d7c||0xc8;return function(_0xc5a145){if(_0xc5a145){return _0x316cf6[_0xd351('0x15')](_0x597d7c)[_0xd351('0x16')](_0xc5a145);}};}function respondWithFilteredResult(_0xf1c285,_0x3867fb){return function(_0x4d238c){if(_0x4d238c){var _0x9f790f=typeof _0x3867fb['offset']==='undefined'&&typeof _0x3867fb[_0xd351('0x17')]==='undefined';var _0x21e591=_0x4d238c[_0xd351('0x18')];var _0x4e0164=_0x9f790f?0x0:_0x3867fb['offset'];var _0x1e1a3c=_0x9f790f?_0x4d238c[_0xd351('0x18')]:_0x3867fb[_0xd351('0x19')]+_0x3867fb[_0xd351('0x17')];var _0x51f265;if(_0x1e1a3c>=_0x21e591){_0x1e1a3c=_0x21e591;_0x51f265=0xc8;}else{_0x51f265=0xce;}_0xf1c285[_0xd351('0x15')](_0x51f265);return _0xf1c285['set']('Content-Range',_0x4e0164+'-'+_0x1e1a3c+'/'+_0x21e591)[_0xd351('0x16')](_0x4d238c);}return null;};}function patchUpdates(_0x4a427b){return function(_0x33b1e5){try{jsonpatch[_0xd351('0x1a')](_0x33b1e5,_0x4a427b,!![]);}catch(_0x3634c9){return BPromise[_0xd351('0x1b')](_0x3634c9);}return _0x33b1e5[_0xd351('0x1c')]();};}function saveUpdates(_0x53e729,_0x18625b){return function(_0xbbc58){if(_0xbbc58){return _0xbbc58[_0xd351('0x1d')](_0x53e729)['then'](function(_0x1ce7f7){return _0x1ce7f7;});}return null;};}function removeEntity(_0x2d9aa0,_0x365bbc){return function(_0x59fb6d){if(_0x59fb6d){return _0x59fb6d[_0xd351('0x1e')]()[_0xd351('0x1f')](function(){_0x2d9aa0[_0xd351('0x15')](0xcc)[_0xd351('0x14')]();});}};}function handleEntityNotFound(_0x489c9a,_0x40f7f3){return function(_0x483c92){if(!_0x483c92){_0x489c9a[_0xd351('0x13')](0x194);}return _0x483c92;};}function handleError(_0x8ad0a6,_0x54f471){_0x54f471=_0x54f471||0x1f4;return function(_0x2648d0){logger['error'](_0x2648d0['stack']);if(_0x2648d0[_0xd351('0x20')]){delete _0x2648d0['name'];}_0x8ad0a6['status'](_0x54f471)[_0xd351('0x21')](_0x2648d0);};}exports['index']=function(_0x38471c,_0x2ddae8){var _0x407b50={},_0x4d3f48={},_0x71ce9c={'count':0x0,'rows':[]};var _0x4aa902=_[_0xd351('0x22')](db['WhatsappQueueReport']['rawAttributes'],function(_0xeb4da9){return{'name':_0xeb4da9[_0xd351('0x23')],'type':_0xeb4da9[_0xd351('0x24')][_0xd351('0x25')]};});_0x4d3f48['model']=_[_0xd351('0x22')](_0x4aa902,_0xd351('0x20'));_0x4d3f48[_0xd351('0x26')]=_[_0xd351('0x27')](_0x38471c[_0xd351('0x26')]);_0x4d3f48[_0xd351('0x28')]=_[_0xd351('0x29')](_0x4d3f48[_0xd351('0x2a')],_0x4d3f48[_0xd351('0x26')]);_0x407b50['attributes']=_[_0xd351('0x29')](_0x4d3f48[_0xd351('0x2a')],qs[_0xd351('0x2b')](_0x38471c[_0xd351('0x26')]['fields']));_0x407b50[_0xd351('0x2c')]=_0x407b50[_0xd351('0x2c')][_0xd351('0x2d')]?_0x407b50[_0xd351('0x2c')]:_0x4d3f48[_0xd351('0x2a')];if(!_0x38471c[_0xd351('0x26')][_0xd351('0x2e')](_0xd351('0x2f'))){_0x407b50[_0xd351('0x17')]=qs['limit'](_0x38471c['query'][_0xd351('0x17')]);_0x407b50[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x38471c[_0xd351('0x26')][_0xd351('0x19')]);}_0x407b50[_0xd351('0x30')]=qs['sort'](_0x38471c['query'][_0xd351('0x31')]);_0x407b50['where']=qs[_0xd351('0x28')](_[_0xd351('0x32')](_0x38471c[_0xd351('0x26')],_0x4d3f48[_0xd351('0x28')]),_0x4aa902);if(_0x38471c[_0xd351('0x26')][_0xd351('0x33')]){_0x407b50[_0xd351('0x34')]=_[_0xd351('0x35')](_0x407b50[_0xd351('0x34')],{'$or':_[_0xd351('0x22')](_0x4aa902,function(_0x2b7170){if(_0x2b7170['type']!==_0xd351('0x36')){var _0x5f0b1c={};_0x5f0b1c[_0x2b7170[_0xd351('0x20')]]={'$like':'%'+_0x38471c[_0xd351('0x26')][_0xd351('0x33')]+'%'};return _0x5f0b1c;}})});}_0x407b50=_[_0xd351('0x35')]({},_0x407b50,_0x38471c[_0xd351('0x37')]);var _0x3db72a={'where':_0x407b50['where']};return db[_0xd351('0x38')][_0xd351('0x18')](_0x3db72a)['then'](function(_0x2e1219){_0x71ce9c[_0xd351('0x18')]=_0x2e1219;if(_0x38471c[_0xd351('0x26')][_0xd351('0x39')]){_0x407b50[_0xd351('0x3a')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x407b50);})[_0xd351('0x1f')](function(_0x3935aa){_0x71ce9c['rows']=_0x3935aa;return _0x71ce9c;})['then'](respondWithFilteredResult(_0x2ddae8,_0x407b50))[_0xd351('0x3b')](handleError(_0x2ddae8,null));};exports[_0xd351('0x3c')]=function(_0x4ff06a,_0x570d57){var _0x46af23={'raw':!![],'where':{'id':_0x4ff06a[_0xd351('0x3d')]['id']}},_0x18f9d1={};_0x18f9d1[_0xd351('0x2a')]=_[_0xd351('0x27')](db[_0xd351('0x38')][_0xd351('0x3e')]);_0x18f9d1[_0xd351('0x26')]=_[_0xd351('0x27')](_0x4ff06a['query']);_0x18f9d1['filters']=_[_0xd351('0x29')](_0x18f9d1[_0xd351('0x2a')],_0x18f9d1[_0xd351('0x26')]);_0x46af23[_0xd351('0x2c')]=_[_0xd351('0x29')](_0x18f9d1[_0xd351('0x2a')],qs[_0xd351('0x2b')](_0x4ff06a[_0xd351('0x26')][_0xd351('0x2b')]));_0x46af23[_0xd351('0x2c')]=_0x46af23[_0xd351('0x2c')][_0xd351('0x2d')]?_0x46af23[_0xd351('0x2c')]:_0x18f9d1[_0xd351('0x2a')];if(_0x4ff06a[_0xd351('0x26')][_0xd351('0x39')]){_0x46af23['include']=[{'all':!![]}];}_0x46af23=_[_0xd351('0x35')]({},_0x46af23,_0x4ff06a[_0xd351('0x37')]);return db[_0xd351('0x38')]['find'](_0x46af23)[_0xd351('0x1f')](handleEntityNotFound(_0x570d57,null))[_0xd351('0x1f')](respondWithResult(_0x570d57,null))[_0xd351('0x3b')](handleError(_0x570d57,null));};exports[_0xd351('0x3f')]=function(_0xbb92d4,_0x5bc86a){return db[_0xd351('0x38')]['create'](_0xbb92d4[_0xd351('0x40')],{})[_0xd351('0x1f')](respondWithResult(_0x5bc86a,0xc9))['catch'](handleError(_0x5bc86a,null));};exports['update']=function(_0x1bd727,_0x444206){if(_0x1bd727[_0xd351('0x40')]['id']){delete _0x1bd727['body']['id'];}return db[_0xd351('0x38')][_0xd351('0x41')]({'where':{'id':_0x1bd727['params']['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x444206,null))['then'](saveUpdates(_0x1bd727[_0xd351('0x40')],null))[_0xd351('0x1f')](respondWithResult(_0x444206,null))['catch'](handleError(_0x444206,null));};exports['destroy']=function(_0x25ea1e,_0x58ce5a){return db[_0xd351('0x38')][_0xd351('0x41')]({'where':{'id':_0x25ea1e[_0xd351('0x3d')]['id']}})['then'](handleEntityNotFound(_0x58ce5a,null))[_0xd351('0x1f')](removeEntity(_0x58ce5a,null))['catch'](handleError(_0x58ce5a,null));};exports['describe']=function(_0x48c287,_0x7e4bad){return db[_0xd351('0x38')][_0xd351('0x42')]()['then'](respondWithResult(_0x7e4bad,null))['catch'](handleError(_0x7e4bad,null));}; \ No newline at end of file +var _0x97c1=['describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappQueueReport','includeAll','include','rows','catch','params','find','create','body'];(function(_0x44d204,_0x3cf575){var _0x12d981=function(_0x269024){while(--_0x269024){_0x44d204['push'](_0x44d204['shift']());}};_0x12d981(++_0x3cf575);}(_0x97c1,0xdf));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x2911dd,_0x2b6319){return function(_0x499051){if(!_0x499051){_0x2911dd[_0x197c('0x26')](0x194);}return _0x499051;};}function handleError(_0x3331ac,_0x4c3337){_0x4c3337=_0x4c3337||0x1f4;return function(_0x5e7bc9){logger[_0x197c('0x27')](_0x5e7bc9['stack']);if(_0x5e7bc9[_0x197c('0x28')]){delete _0x5e7bc9[_0x197c('0x28')];}_0x3331ac[_0x197c('0x17')](_0x4c3337)[_0x197c('0x29')](_0x5e7bc9);};}exports[_0x197c('0x2a')]=function(_0x3cdcd8,_0x2b6154){var _0x215df1={},_0x4422d1={},_0x5df39e={'count':0x0,'rows':[]};var _0x50dea3=_['map'](db['WhatsappQueueReport'][_0x197c('0x2b')],function(_0x4c9256){return{'name':_0x4c9256[_0x197c('0x2c')],'type':_0x4c9256[_0x197c('0x2d')]['key']};});_0x4422d1[_0x197c('0x2e')]=_['map'](_0x50dea3,_0x197c('0x28'));_0x4422d1[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x3cdcd8[_0x197c('0x2f')]);_0x4422d1[_0x197c('0x31')]=_[_0x197c('0x32')](_0x4422d1[_0x197c('0x2e')],_0x4422d1[_0x197c('0x2f')]);_0x215df1[_0x197c('0x33')]=_['intersection'](_0x4422d1['model'],qs[_0x197c('0x34')](_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x34')]));_0x215df1[_0x197c('0x33')]=_0x215df1[_0x197c('0x33')][_0x197c('0x35')]?_0x215df1[_0x197c('0x33')]:_0x4422d1['model'];if(!_0x3cdcd8['query'][_0x197c('0x36')](_0x197c('0x37'))){_0x215df1['limit']=qs['limit'](_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x1b')]);_0x215df1[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x19')]);}_0x215df1[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x3cdcd8[_0x197c('0x2f')]['sort']);_0x215df1[_0x197c('0x3a')]=qs[_0x197c('0x31')](_[_0x197c('0x3b')](_0x3cdcd8[_0x197c('0x2f')],_0x4422d1[_0x197c('0x31')]),_0x50dea3);if(_0x3cdcd8[_0x197c('0x2f')]['filter']){_0x215df1[_0x197c('0x3a')]=_[_0x197c('0x3c')](_0x215df1[_0x197c('0x3a')],{'$or':_['map'](_0x50dea3,function(_0x28ce19){if(_0x28ce19[_0x197c('0x2d')]!==_0x197c('0x3d')){var _0xdb64da={};_0xdb64da[_0x28ce19[_0x197c('0x28')]]={'$like':'%'+_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x3e')]+'%'};return _0xdb64da;}})});}_0x215df1=_[_0x197c('0x3c')]({},_0x215df1,_0x3cdcd8[_0x197c('0x3f')]);var _0x1dc01b={'where':_0x215df1['where']};return db[_0x197c('0x40')][_0x197c('0x1c')](_0x1dc01b)['then'](function(_0x4c715a){_0x5df39e[_0x197c('0x1c')]=_0x4c715a;if(_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x41')]){_0x215df1[_0x197c('0x42')]=[{'all':!![]}];}return db[_0x197c('0x40')]['findAll'](_0x215df1);})[_0x197c('0x24')](function(_0x3efae){_0x5df39e[_0x197c('0x43')]=_0x3efae;return _0x5df39e;})[_0x197c('0x24')](respondWithFilteredResult(_0x2b6154,_0x215df1))[_0x197c('0x44')](handleError(_0x2b6154,null));};exports['show']=function(_0x3e21bd,_0x37bb94){var _0x6d7bda={'raw':!![],'where':{'id':_0x3e21bd[_0x197c('0x45')]['id']}},_0x197b27={};_0x197b27['model']=_[_0x197c('0x30')](db[_0x197c('0x40')][_0x197c('0x2b')]);_0x197b27[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x3e21bd[_0x197c('0x2f')]);_0x197b27[_0x197c('0x31')]=_[_0x197c('0x32')](_0x197b27[_0x197c('0x2e')],_0x197b27[_0x197c('0x2f')]);_0x6d7bda[_0x197c('0x33')]=_['intersection'](_0x197b27['model'],qs['fields'](_0x3e21bd['query'][_0x197c('0x34')]));_0x6d7bda[_0x197c('0x33')]=_0x6d7bda['attributes'][_0x197c('0x35')]?_0x6d7bda[_0x197c('0x33')]:_0x197b27['model'];if(_0x3e21bd[_0x197c('0x2f')][_0x197c('0x41')]){_0x6d7bda['include']=[{'all':!![]}];}_0x6d7bda=_[_0x197c('0x3c')]({},_0x6d7bda,_0x3e21bd[_0x197c('0x3f')]);return db['WhatsappQueueReport'][_0x197c('0x46')](_0x6d7bda)[_0x197c('0x24')](handleEntityNotFound(_0x37bb94,null))[_0x197c('0x24')](respondWithResult(_0x37bb94,null))['catch'](handleError(_0x37bb94,null));};exports[_0x197c('0x47')]=function(_0x3f26df,_0x220909){return db[_0x197c('0x40')]['create'](_0x3f26df[_0x197c('0x48')],{})[_0x197c('0x24')](respondWithResult(_0x220909,0xc9))[_0x197c('0x44')](handleError(_0x220909,null));};exports['update']=function(_0x5994bf,_0x3a5089){if(_0x5994bf[_0x197c('0x48')]['id']){delete _0x5994bf[_0x197c('0x48')]['id'];}return db[_0x197c('0x40')][_0x197c('0x46')]({'where':{'id':_0x5994bf[_0x197c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a5089,null))[_0x197c('0x24')](saveUpdates(_0x5994bf['body'],null))[_0x197c('0x24')](respondWithResult(_0x3a5089,null))[_0x197c('0x44')](handleError(_0x3a5089,null));};exports[_0x197c('0x25')]=function(_0x9e8c6a,_0x34a211){return db[_0x197c('0x40')][_0x197c('0x46')]({'where':{'id':_0x9e8c6a[_0x197c('0x45')]['id']}})['then'](handleEntityNotFound(_0x34a211,null))[_0x197c('0x24')](removeEntity(_0x34a211,null))[_0x197c('0x44')](handleError(_0x34a211,null));};exports[_0x197c('0x49')]=function(_0x4b0048,_0x114ef5){return db['WhatsappQueueReport'][_0x197c('0x49')]()[_0x197c('0x24')](respondWithResult(_0x114ef5,null))[_0x197c('0x44')](handleError(_0x114ef5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 67b00ca..16ec5b4 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 _0x91e0=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','bluebird'];(function(_0x14745d,_0x42451a){var _0x57008f=function(_0x51798b){while(--_0x51798b){_0x14745d['push'](_0x14745d['shift']());}};_0x57008f(++_0x42451a);}(_0x91e0,0xf2));var _0x091e=function(_0x1c5481,_0x2361da){_0x1c5481=_0x1c5481-0x0;var _0x515425=_0x91e0[_0x1c5481];return _0x515425;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x091e('0x0'));var rp=require(_0x091e('0x1'));var fs=require('fs');var path=require(_0x091e('0x2'));var rimraf=require(_0x091e('0x3'));var config=require(_0x091e('0x4'));var attributes=require(_0x091e('0x5'));module['exports']=function(_0x7cd103,_0x1451c2){return _0x7cd103[_0x091e('0x6')](_0x091e('0x7'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x091e('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xba40=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','uniqueid','lodash'];(function(_0x1ddc91,_0x132ec7){var _0x3559bb=function(_0x570589){while(--_0x570589){_0x1ddc91['push'](_0x1ddc91['shift']());}};_0x3559bb(++_0x132ec7);}(_0xba40,0x1e3));var _0x0ba4=function(_0x14c0e0,_0x3ad847){_0x14c0e0=_0x14c0e0-0x0;var _0x4cbd72=_0xba40[_0x14c0e0];return _0x4cbd72;};'use strict';var _=require(_0x0ba4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0ba4('0x1'));var BPromise=require(_0x0ba4('0x2'));var rp=require(_0x0ba4('0x3'));var fs=require('fs');var path=require(_0x0ba4('0x4'));var rimraf=require(_0x0ba4('0x5'));var config=require(_0x0ba4('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x0ba4('0x7')]=function(_0x35aef1,_0x9929c5){return _0x35aef1[_0x0ba4('0x8')](_0x0ba4('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x0ba4('0xa'),'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 30aa203..fea8b34 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 _0x2b33=['code','WhatsappQueueReport,\x20%s,\x20%s','message','info','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','debug','update','attributes','limit','UpdateWhatsappQueueReport','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x13f374,_0x256cc2){var _0x5879bf=function(_0x5d8d3b){while(--_0x5d8d3b){_0x13f374['push'](_0x13f374['shift']());}};_0x5879bf(++_0x256cc2);}(_0x2b33,0x91));var _0x32b3=function(_0x5da2e1,_0x2adbbf){_0x5da2e1=_0x5da2e1-0x0;var _0x478240=_0x2b33[_0x5da2e1];return _0x478240;};'use strict';var _=require(_0x32b3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x32b3('0x1'));var rs=require(_0x32b3('0x2'));var fs=require('fs');var Redis=require(_0x32b3('0x3'));var db=require(_0x32b3('0x4'))['db'];var utils=require(_0x32b3('0x5'));var logger=require(_0x32b3('0x6'))('rpc');var config=require(_0x32b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32b3('0x8')][_0x32b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e455b,_0x4ccaeb,_0x5d2e6a){return new BPromise(function(_0x28917a,_0x30d471){return client[_0x32b3('0xa')](_0x1e455b,_0x5d2e6a)[_0x32b3('0xb')](function(_0x323a01){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4ccaeb,_0x32b3('0xc'));logger['debug'](_0x32b3('0xd'),_0x4ccaeb,_0x32b3('0xc'),JSON['stringify'](_0x323a01));if(_0x323a01[_0x32b3('0xe')]){if(_0x323a01['error'][_0x32b3('0xf')]===0x1f4){logger[_0x32b3('0xe')](_0x32b3('0x10'),_0x4ccaeb,_0x323a01[_0x32b3('0xe')][_0x32b3('0x11')]);return _0x30d471(_0x323a01['error'][_0x32b3('0x11')]);}logger['error'](_0x32b3('0x10'),_0x4ccaeb,_0x323a01['error'][_0x32b3('0x11')]);return _0x28917a(_0x323a01[_0x32b3('0xe')]['message']);}else{logger[_0x32b3('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4ccaeb,_0x32b3('0xc'));_0x28917a(_0x323a01[_0x32b3('0x13')][_0x32b3('0x11')]);}})[_0x32b3('0x14')](function(_0x1a3304){logger[_0x32b3('0xe')](_0x32b3('0x10'),_0x4ccaeb,_0x1a3304);_0x30d471(_0x1a3304);});});}exports['CreateWhatsappQueueReport']=function(_0x196e1a){var _0x339466=this;return new Promise(function(_0x3f6380,_0x377883){return db[_0x32b3('0x15')]['create'](_0x196e1a[_0x32b3('0x16')],{'raw':_0x196e1a[_0x32b3('0x17')]?_0x196e1a[_0x32b3('0x17')][_0x32b3('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xbe8fa1){logger[_0x32b3('0x12')](_0x32b3('0x19'),_0x196e1a);logger[_0x32b3('0x1a')](_0x32b3('0x19'),_0x196e1a,JSON['stringify'](_0xbe8fa1));_0x3f6380(_0xbe8fa1);})[_0x32b3('0x14')](function(_0x3129cd){logger[_0x32b3('0xe')](_0x32b3('0x19'),_0x3129cd['message'],_0x196e1a);_0x377883(_0x339466[_0x32b3('0xe')](0x1f4,_0x3129cd[_0x32b3('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0xeefbd4){var _0x9cbec5=this;return new Promise(function(_0x46312d,_0x400568){return db['WhatsappQueueReport'][_0x32b3('0x1b')](_0xeefbd4[_0x32b3('0x16')],{'raw':_0xeefbd4['options']?_0xeefbd4['options'][_0x32b3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeefbd4[_0x32b3('0x17')]?_0xeefbd4[_0x32b3('0x17')]['where']||null:null,'attributes':_0xeefbd4['options']?_0xeefbd4[_0x32b3('0x17')][_0x32b3('0x1c')]||null:null,'limit':_0xeefbd4['options']?_0xeefbd4[_0x32b3('0x17')][_0x32b3('0x1d')]||null:null})['then'](function(_0x1820f1){logger[_0x32b3('0x12')]('UpdateWhatsappQueueReport',_0xeefbd4);logger[_0x32b3('0x1a')](_0x32b3('0x1e'),_0xeefbd4,JSON[_0x32b3('0x1f')](_0x1820f1));_0x46312d(_0x1820f1);})['catch'](function(_0x4a1c1e){logger[_0x32b3('0xe')](_0x32b3('0x1e'),_0x4a1c1e[_0x32b3('0x11')],_0xeefbd4);_0x400568(_0x9cbec5[_0x32b3('0xe')](0x1f4,_0x4a1c1e['message']));});});}; \ No newline at end of file +var _0xa4eb=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','then','UpdateWhatsappQueueReport','update','body','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x43a0c1,_0x473a91){var _0x5b4dd4=function(_0x30b6a8){while(--_0x30b6a8){_0x43a0c1['push'](_0x43a0c1['shift']());}};_0x5b4dd4(++_0x473a91);}(_0xa4eb,0xc3));var _0xba4e=function(_0x405b39,_0x5d791c){_0x405b39=_0x405b39-0x0;var _0x35fc15=_0xa4eb[_0x405b39];return _0x35fc15;};'use strict';var _=require(_0xba4e('0x0'));var util=require(_0xba4e('0x1'));var moment=require('moment');var BPromise=require(_0xba4e('0x2'));var rs=require(_0xba4e('0x3'));var fs=require('fs');var Redis=require(_0xba4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xba4e('0x5'));var logger=require(_0xba4e('0x6'))('rpc');var config=require(_0xba4e('0x7'));var jayson=require(_0xba4e('0x8'));var client=jayson[_0xba4e('0x9')][_0xba4e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x271f05,_0x439085,_0x4cbb23){return new BPromise(function(_0xc26c64,_0x2078fe){return client[_0xba4e('0xb')](_0x271f05,_0x4cbb23)['then'](function(_0x18d295){logger[_0xba4e('0xc')](_0xba4e('0xd'),_0x439085,_0xba4e('0xe'));logger[_0xba4e('0xf')](_0xba4e('0x10'),_0x439085,_0xba4e('0xe'),JSON[_0xba4e('0x11')](_0x18d295));if(_0x18d295[_0xba4e('0x12')]){if(_0x18d295[_0xba4e('0x12')][_0xba4e('0x13')]===0x1f4){logger['error'](_0xba4e('0xd'),_0x439085,_0x18d295['error'][_0xba4e('0x14')]);return _0x2078fe(_0x18d295['error'][_0xba4e('0x14')]);}logger[_0xba4e('0x12')](_0xba4e('0xd'),_0x439085,_0x18d295[_0xba4e('0x12')][_0xba4e('0x14')]);return _0xc26c64(_0x18d295[_0xba4e('0x12')]['message']);}else{logger['info'](_0xba4e('0xd'),_0x439085,_0xba4e('0xe'));_0xc26c64(_0x18d295[_0xba4e('0x15')]['message']);}})[_0xba4e('0x16')](function(_0x21f438){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x439085,_0x21f438);_0x2078fe(_0x21f438);});});}exports[_0xba4e('0x17')]=function(_0x35bfb5){var _0x59f401=this;return new Promise(function(_0x52d048,_0x124fbe){return db[_0xba4e('0x18')][_0xba4e('0x19')](_0x35bfb5['body'],{'raw':_0x35bfb5[_0xba4e('0x1a')]?_0x35bfb5[_0xba4e('0x1a')][_0xba4e('0x1b')]===undefined?!![]:![]:!![]})[_0xba4e('0x1c')](function(_0x263784){logger[_0xba4e('0xc')]('CreateWhatsappQueueReport',_0x35bfb5);logger['debug'](_0xba4e('0x17'),_0x35bfb5,JSON['stringify'](_0x263784));_0x52d048(_0x263784);})[_0xba4e('0x16')](function(_0x194556){logger[_0xba4e('0x12')](_0xba4e('0x17'),_0x194556[_0xba4e('0x14')],_0x35bfb5);_0x124fbe(_0x59f401[_0xba4e('0x12')](0x1f4,_0x194556[_0xba4e('0x14')]));});});};exports[_0xba4e('0x1d')]=function(_0x35d7c8){var _0x3b4923=this;return new Promise(function(_0x4ef608,_0x542883){return db['WhatsappQueueReport'][_0xba4e('0x1e')](_0x35d7c8[_0xba4e('0x1f')],{'raw':_0x35d7c8[_0xba4e('0x1a')]?_0x35d7c8[_0xba4e('0x1a')][_0xba4e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35d7c8['options']?_0x35d7c8[_0xba4e('0x1a')][_0xba4e('0x20')]||null:null,'attributes':_0x35d7c8[_0xba4e('0x1a')]?_0x35d7c8['options'][_0xba4e('0x21')]||null:null,'limit':_0x35d7c8[_0xba4e('0x1a')]?_0x35d7c8[_0xba4e('0x1a')][_0xba4e('0x22')]||null:null})[_0xba4e('0x1c')](function(_0xec7cba){logger[_0xba4e('0xc')]('UpdateWhatsappQueueReport',_0x35d7c8);logger[_0xba4e('0xf')](_0xba4e('0x1d'),_0x35d7c8,JSON[_0xba4e('0x11')](_0xec7cba));_0x4ef608(_0xec7cba);})[_0xba4e('0x16')](function(_0x393021){logger[_0xba4e('0x12')](_0xba4e('0x1d'),_0x393021[_0xba4e('0x14')],_0x35d7c8);_0x542883(_0x3b4923[_0xba4e('0x12')](0x1f4,_0x393021[_0xba4e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 663e259..1026001 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 _0x39d3=['/:id','show','post','create','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2e281a,_0x21ec9a){var _0x4749b0=function(_0x2593bc){while(--_0x2593bc){_0x2e281a['push'](_0x2e281a['shift']());}};_0x4749b0(++_0x21ec9a);}(_0x39d3,0x1aa));var _0x339d=function(_0x55678b,_0x4113ed){_0x55678b=_0x55678b-0x0;var _0x507605=_0x39d3[_0x55678b];return _0x507605;};'use strict';var multer=require(_0x339d('0x0'));var util=require(_0x339d('0x1'));var path=require(_0x339d('0x2'));var timeout=require('connect-timeout');var express=require(_0x339d('0x3'));var router=express[_0x339d('0x4')]();var fs_extra=require(_0x339d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x339d('0x6'));var config=require(_0x339d('0x7'));var controller=require(_0x339d('0x8'));router[_0x339d('0x9')]('/',auth[_0x339d('0xa')](),controller[_0x339d('0xb')]);router[_0x339d('0x9')](_0x339d('0xc'),auth[_0x339d('0xa')](),controller[_0x339d('0xd')]);router['get'](_0x339d('0xe'),auth[_0x339d('0xa')](),controller[_0x339d('0xf')]);router[_0x339d('0x10')]('/',auth['isAuthenticated'](),controller[_0x339d('0x11')]);router['put'](_0x339d('0xe'),auth[_0x339d('0xa')](),controller['update']);router[_0x339d('0x12')](_0x339d('0xe'),auth[_0x339d('0xa')](),controller['destroy']);module[_0x339d('0x13')]=router; \ No newline at end of file +var _0x48b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','express'];(function(_0x3db1dd,_0x4cb0d7){var _0xd7a239=function(_0x5474a2){while(--_0x5474a2){_0x3db1dd['push'](_0x3db1dd['shift']());}};_0xd7a239(++_0x4cb0d7);}(_0x48b0,0x1cb));var _0x048b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x48b0[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x048b('0x0'));var util=require(_0x048b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x048b('0x2'));var router=express[_0x048b('0x3')]();var fs_extra=require(_0x048b('0x4'));var auth=require(_0x048b('0x5'));var interaction=require(_0x048b('0x6'));var config=require('../../config/environment');var controller=require(_0x048b('0x7'));router[_0x048b('0x8')]('/',auth['isAuthenticated'](),controller[_0x048b('0x9')]);router[_0x048b('0x8')]('/describe',auth[_0x048b('0xa')](),controller[_0x048b('0xb')]);router[_0x048b('0x8')]('/:id',auth[_0x048b('0xa')](),controller[_0x048b('0xc')]);router[_0x048b('0xd')]('/',auth[_0x048b('0xa')](),controller[_0x048b('0xe')]);router[_0x048b('0xf')](_0x048b('0x10'),auth[_0x048b('0xa')](),controller[_0x048b('0x11')]);router[_0x048b('0x12')](_0x048b('0x10'),auth[_0x048b('0xa')](),controller[_0x048b('0x13')]);module[_0x048b('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 35880f4..170a83c 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 _0x6f54=['agent','queue','DATE','sequelize','exports','STRING'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x6f54,0xcf));var _0x46f5=function(_0x99b432,_0x2b80a7){_0x99b432=_0x99b432-0x0;var _0x5e6301=_0x6f54[_0x99b432];return _0x5e6301;};'use strict';var Sequelize=require(_0x46f5('0x0'));module[_0x46f5('0x1')]={'uniqueid':{'type':Sequelize[_0x46f5('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x46f5('0x3'),_0x46f5('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x46f5('0x5')]}}; \ No newline at end of file +var _0xa702=['STRING','ENUM','account','queue','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa702,0x1ae));var _0x2a70=function(_0x53f4ab,_0x5b69fb){_0x53f4ab=_0x53f4ab-0x0;var _0x2168ee=_0xa702[_0x53f4ab];return _0x2168ee;};'use strict';var Sequelize=require(_0x2a70('0x0'));module[_0x2a70('0x1')]={'uniqueid':{'type':Sequelize[_0x2a70('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2a70('0x3')](_0x2a70('0x4'),'agent',_0x2a70('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c0e4868..2100c82 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 _0x81fc=['zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','params','describe','eml-format','rimraf'];(function(_0x37e0a8,_0x184bc8){var _0x5ca63c=function(_0x1af002){while(--_0x1af002){_0x37e0a8['push'](_0x37e0a8['shift']());}};_0x5ca63c(++_0x184bc8);}(_0x81fc,0x92));var _0xc81f=function(_0x45606c,_0x1132d6){_0x45606c=_0x45606c-0x0;var _0x18fd3f=_0x81fc[_0x45606c];return _0x18fd3f;};'use strict';var emlformat=require(_0xc81f('0x0'));var rimraf=require(_0xc81f('0x1'));var zipdir=require(_0xc81f('0x2'));var jsonpatch=require(_0xc81f('0x3'));var rp=require('request-promise');var moment=require(_0xc81f('0x4'));var BPromise=require(_0xc81f('0x5'));var Mustache=require('mustache');var util=require(_0xc81f('0x6'));var path=require('path');var sox=require(_0xc81f('0x7'));var csv=require(_0xc81f('0x8'));var ejs=require(_0xc81f('0x9'));var fs=require('fs');var fs_extra=require(_0xc81f('0xa'));var _=require('lodash');var squel=require(_0xc81f('0xb'));var crypto=require('crypto');var jsforce=require(_0xc81f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc81f('0xd'));var Redis=require(_0xc81f('0xe'));var authService=require(_0xc81f('0xf'));var qs=require(_0xc81f('0x10'));var as=require(_0xc81f('0x11'));var hardwareService=require(_0xc81f('0x12'));var logger=require(_0xc81f('0x13'))(_0xc81f('0x14'));var utils=require('../../config/utils');var config=require(_0xc81f('0x15'));var licenseUtil=require(_0xc81f('0x16'));var db=require(_0xc81f('0x17'))['db'];function respondWithStatusCode(_0x89e86b,_0x3286f9){_0x3286f9=_0x3286f9||0xcc;return function(_0x5f02e4){if(_0x5f02e4){return _0x89e86b[_0xc81f('0x18')](_0x3286f9);}return _0x89e86b[_0xc81f('0x19')](_0x3286f9)['end']();};}function respondWithResult(_0x54809d,_0x395c36){_0x395c36=_0x395c36||0xc8;return function(_0x50d70b){if(_0x50d70b){return _0x54809d[_0xc81f('0x19')](_0x395c36)[_0xc81f('0x1a')](_0x50d70b);}};}function respondWithFilteredResult(_0x1999c1,_0x31b5b5){return function(_0x20a304){if(_0x20a304){var _0x52b87b=typeof _0x31b5b5[_0xc81f('0x1b')]==='undefined'&&typeof _0x31b5b5[_0xc81f('0x1c')]===_0xc81f('0x1d');var _0xac597b=_0x20a304['count'];var _0x1140a1=_0x52b87b?0x0:_0x31b5b5['offset'];var _0x18d96a=_0x52b87b?_0x20a304[_0xc81f('0x1e')]:_0x31b5b5[_0xc81f('0x1b')]+_0x31b5b5[_0xc81f('0x1c')];var _0x3f27e2;if(_0x18d96a>=_0xac597b){_0x18d96a=_0xac597b;_0x3f27e2=0xc8;}else{_0x3f27e2=0xce;}_0x1999c1['status'](_0x3f27e2);return _0x1999c1[_0xc81f('0x1f')](_0xc81f('0x20'),_0x1140a1+'-'+_0x18d96a+'/'+_0xac597b)[_0xc81f('0x1a')](_0x20a304);}return null;};}function patchUpdates(_0x450055){return function(_0x457a93){try{jsonpatch['apply'](_0x457a93,_0x450055,!![]);}catch(_0x53d182){return BPromise['reject'](_0x53d182);}return _0x457a93[_0xc81f('0x21')]();};}function saveUpdates(_0x3a9cdc,_0x361d60){return function(_0x263826){if(_0x263826){return _0x263826[_0xc81f('0x22')](_0x3a9cdc)[_0xc81f('0x23')](function(_0x306dfb){return _0x306dfb;});}return null;};}function removeEntity(_0x3dc3e5,_0x199554){return function(_0x1a2b72){if(_0x1a2b72){return _0x1a2b72['destroy']()['then'](function(){_0x3dc3e5[_0xc81f('0x19')](0xcc)[_0xc81f('0x24')]();});}};}function handleEntityNotFound(_0x512c88,_0x2b2520){return function(_0x108ff2){if(!_0x108ff2){_0x512c88[_0xc81f('0x18')](0x194);}return _0x108ff2;};}function handleError(_0x5c9c5b,_0x4e43bb){_0x4e43bb=_0x4e43bb||0x1f4;return function(_0x4d5a48){logger[_0xc81f('0x25')](_0x4d5a48[_0xc81f('0x26')]);if(_0x4d5a48[_0xc81f('0x27')]){delete _0x4d5a48[_0xc81f('0x27')];}_0x5c9c5b[_0xc81f('0x19')](_0x4e43bb)[_0xc81f('0x28')](_0x4d5a48);};}exports[_0xc81f('0x29')]=function(_0x35220a,_0xdfe216){var _0x43fe5a={},_0x14fc8f={},_0xca7d80={'count':0x0,'rows':[]};var _0x4c7043=_[_0xc81f('0x2a')](db[_0xc81f('0x2b')][_0xc81f('0x2c')],function(_0xb5d85){return{'name':_0xb5d85['fieldName'],'type':_0xb5d85[_0xc81f('0x2d')][_0xc81f('0x2e')]};});_0x14fc8f['model']=_['map'](_0x4c7043,_0xc81f('0x27'));_0x14fc8f[_0xc81f('0x2f')]=_[_0xc81f('0x30')](_0x35220a['query']);_0x14fc8f['filters']=_['intersection'](_0x14fc8f[_0xc81f('0x31')],_0x14fc8f['query']);_0x43fe5a[_0xc81f('0x32')]=_[_0xc81f('0x33')](_0x14fc8f['model'],qs['fields'](_0x35220a[_0xc81f('0x2f')][_0xc81f('0x34')]));_0x43fe5a['attributes']=_0x43fe5a[_0xc81f('0x32')][_0xc81f('0x35')]?_0x43fe5a[_0xc81f('0x32')]:_0x14fc8f[_0xc81f('0x31')];if(!_0x35220a[_0xc81f('0x2f')][_0xc81f('0x36')](_0xc81f('0x37'))){_0x43fe5a[_0xc81f('0x1c')]=qs[_0xc81f('0x1c')](_0x35220a[_0xc81f('0x2f')][_0xc81f('0x1c')]);_0x43fe5a['offset']=qs[_0xc81f('0x1b')](_0x35220a[_0xc81f('0x2f')][_0xc81f('0x1b')]);}_0x43fe5a[_0xc81f('0x38')]=qs['sort'](_0x35220a[_0xc81f('0x2f')][_0xc81f('0x39')]);_0x43fe5a[_0xc81f('0x3a')]=qs[_0xc81f('0x3b')](_[_0xc81f('0x3c')](_0x35220a[_0xc81f('0x2f')],_0x14fc8f['filters']),_0x4c7043);if(_0x35220a[_0xc81f('0x2f')][_0xc81f('0x3d')]){_0x43fe5a[_0xc81f('0x3a')]=_[_0xc81f('0x3e')](_0x43fe5a['where'],{'$or':_[_0xc81f('0x2a')](_0x4c7043,function(_0x137ccd){if(_0x137ccd[_0xc81f('0x2d')]!==_0xc81f('0x3f')){var _0x22719c={};_0x22719c[_0x137ccd[_0xc81f('0x27')]]={'$like':'%'+_0x35220a[_0xc81f('0x2f')][_0xc81f('0x3d')]+'%'};return _0x22719c;}})});}_0x43fe5a=_['merge']({},_0x43fe5a,_0x35220a[_0xc81f('0x40')]);var _0x282c91={'where':_0x43fe5a[_0xc81f('0x3a')]};return db[_0xc81f('0x2b')]['count'](_0x282c91)[_0xc81f('0x23')](function(_0x306e87){_0xca7d80[_0xc81f('0x1e')]=_0x306e87;if(_0x35220a['query'][_0xc81f('0x41')]){_0x43fe5a[_0xc81f('0x42')]=[{'all':!![]}];}return db[_0xc81f('0x2b')]['findAll'](_0x43fe5a);})[_0xc81f('0x23')](function(_0xf5c217){_0xca7d80[_0xc81f('0x43')]=_0xf5c217;return _0xca7d80;})[_0xc81f('0x23')](respondWithFilteredResult(_0xdfe216,_0x43fe5a))[_0xc81f('0x44')](handleError(_0xdfe216,null));};exports['show']=function(_0x2b8d55,_0x4556e3){var _0x48805c={'raw':!![],'where':{'id':_0x2b8d55['params']['id']}},_0x3176b8={};_0x3176b8['model']=_[_0xc81f('0x30')](db[_0xc81f('0x2b')][_0xc81f('0x2c')]);_0x3176b8['query']=_[_0xc81f('0x30')](_0x2b8d55[_0xc81f('0x2f')]);_0x3176b8[_0xc81f('0x3b')]=_['intersection'](_0x3176b8['model'],_0x3176b8[_0xc81f('0x2f')]);_0x48805c['attributes']=_[_0xc81f('0x33')](_0x3176b8[_0xc81f('0x31')],qs[_0xc81f('0x34')](_0x2b8d55[_0xc81f('0x2f')][_0xc81f('0x34')]));_0x48805c[_0xc81f('0x32')]=_0x48805c[_0xc81f('0x32')]['length']?_0x48805c[_0xc81f('0x32')]:_0x3176b8[_0xc81f('0x31')];if(_0x2b8d55[_0xc81f('0x2f')][_0xc81f('0x41')]){_0x48805c[_0xc81f('0x42')]=[{'all':!![]}];}_0x48805c=_['merge']({},_0x48805c,_0x2b8d55['options']);return db[_0xc81f('0x2b')][_0xc81f('0x45')](_0x48805c)[_0xc81f('0x23')](handleEntityNotFound(_0x4556e3,null))['then'](respondWithResult(_0x4556e3,null))['catch'](handleError(_0x4556e3,null));};exports['create']=function(_0x57a14e,_0x37ddf4){return db[_0xc81f('0x2b')][_0xc81f('0x46')](_0x57a14e[_0xc81f('0x47')],{})[_0xc81f('0x23')](respondWithResult(_0x37ddf4,0xc9))[_0xc81f('0x44')](handleError(_0x37ddf4,null));};exports[_0xc81f('0x22')]=function(_0x1208db,_0x54df9c){if(_0x1208db['body']['id']){delete _0x1208db[_0xc81f('0x47')]['id'];}return db[_0xc81f('0x2b')]['find']({'where':{'id':_0x1208db[_0xc81f('0x48')]['id']}})[_0xc81f('0x23')](handleEntityNotFound(_0x54df9c,null))[_0xc81f('0x23')](saveUpdates(_0x1208db[_0xc81f('0x47')],null))[_0xc81f('0x23')](respondWithResult(_0x54df9c,null))[_0xc81f('0x44')](handleError(_0x54df9c,null));};exports['destroy']=function(_0x36e83f,_0x3c0dce){return db[_0xc81f('0x2b')][_0xc81f('0x45')]({'where':{'id':_0x36e83f[_0xc81f('0x48')]['id']}})[_0xc81f('0x23')](handleEntityNotFound(_0x3c0dce,null))[_0xc81f('0x23')](removeEntity(_0x3c0dce,null))[_0xc81f('0x44')](handleError(_0x3c0dce,null));};exports[_0xc81f('0x49')]=function(_0x30ef56,_0x16d1ed){return db['WhatsappTransferReport'][_0xc81f('0x49')]()[_0xc81f('0x23')](respondWithResult(_0x16d1ed,null))[_0xc81f('0x44')](handleError(_0x16d1ed,null));}; \ No newline at end of file +var _0x4e52=['stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','include','catch','show','params','keys','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0x1008de,_0x41a073){var _0x5567b2=function(_0x81db4f){while(--_0x81db4f){_0x1008de['push'](_0x1008de['shift']());}};_0x5567b2(++_0x41a073);}(_0x4e52,0x6e));var _0x24e5=function(_0x2c713a,_0x1156c8){_0x2c713a=_0x2c713a-0x0;var _0x2519c0=_0x4e52[_0x2c713a];return _0x2519c0;};'use strict';var emlformat=require(_0x24e5('0x0'));var rimraf=require(_0x24e5('0x1'));var zipdir=require(_0x24e5('0x2'));var jsonpatch=require(_0x24e5('0x3'));var rp=require(_0x24e5('0x4'));var moment=require('moment');var BPromise=require(_0x24e5('0x5'));var Mustache=require(_0x24e5('0x6'));var util=require(_0x24e5('0x7'));var path=require(_0x24e5('0x8'));var sox=require('sox');var csv=require(_0x24e5('0x9'));var ejs=require(_0x24e5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24e5('0xb'));var squel=require(_0x24e5('0xc'));var crypto=require(_0x24e5('0xd'));var jsforce=require(_0x24e5('0xe'));var deskjs=require(_0x24e5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x24e5('0x10'));var Papa=require(_0x24e5('0x11'));var Redis=require(_0x24e5('0x12'));var authService=require(_0x24e5('0x13'));var qs=require(_0x24e5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x24e5('0x15'))(_0x24e5('0x16'));var utils=require(_0x24e5('0x17'));var config=require(_0x24e5('0x18'));var licenseUtil=require(_0x24e5('0x19'));var db=require(_0x24e5('0x1a'))['db'];function respondWithStatusCode(_0x42994c,_0xe6ac25){_0xe6ac25=_0xe6ac25||0xcc;return function(_0x5dc4c7){if(_0x5dc4c7){return _0x42994c[_0x24e5('0x1b')](_0xe6ac25);}return _0x42994c[_0x24e5('0x1c')](_0xe6ac25)[_0x24e5('0x1d')]();};}function respondWithResult(_0x5668bd,_0xcdb684){_0xcdb684=_0xcdb684||0xc8;return function(_0x5594de){if(_0x5594de){return _0x5668bd[_0x24e5('0x1c')](_0xcdb684)[_0x24e5('0x1e')](_0x5594de);}};}function respondWithFilteredResult(_0x33f0ee,_0x2c2717){return function(_0x1829de){if(_0x1829de){var _0x4d0a39=typeof _0x2c2717['offset']===_0x24e5('0x1f')&&typeof _0x2c2717['limit']===_0x24e5('0x1f');var _0xf61099=_0x1829de['count'];var _0x42e79f=_0x4d0a39?0x0:_0x2c2717[_0x24e5('0x20')];var _0x232548=_0x4d0a39?_0x1829de[_0x24e5('0x21')]:_0x2c2717[_0x24e5('0x20')]+_0x2c2717[_0x24e5('0x22')];var _0x20e483;if(_0x232548>=_0xf61099){_0x232548=_0xf61099;_0x20e483=0xc8;}else{_0x20e483=0xce;}_0x33f0ee[_0x24e5('0x1c')](_0x20e483);return _0x33f0ee['set'](_0x24e5('0x23'),_0x42e79f+'-'+_0x232548+'/'+_0xf61099)[_0x24e5('0x1e')](_0x1829de);}return null;};}function patchUpdates(_0x461fb1){return function(_0x20fdaa){try{jsonpatch[_0x24e5('0x24')](_0x20fdaa,_0x461fb1,!![]);}catch(_0x3ef7db){return BPromise[_0x24e5('0x25')](_0x3ef7db);}return _0x20fdaa[_0x24e5('0x26')]();};}function saveUpdates(_0x35ee3d,_0x102157){return function(_0x3625f7){if(_0x3625f7){return _0x3625f7[_0x24e5('0x27')](_0x35ee3d)[_0x24e5('0x28')](function(_0xdebfcf){return _0xdebfcf;});}return null;};}function removeEntity(_0x4b45e0,_0x3dbb53){return function(_0x22e3aa){if(_0x22e3aa){return _0x22e3aa['destroy']()[_0x24e5('0x28')](function(){_0x4b45e0[_0x24e5('0x1c')](0xcc)[_0x24e5('0x1d')]();});}};}function handleEntityNotFound(_0x50d72e,_0x4a7415){return function(_0x4160f1){if(!_0x4160f1){_0x50d72e[_0x24e5('0x1b')](0x194);}return _0x4160f1;};}function handleError(_0x111ba5,_0x30693a){_0x30693a=_0x30693a||0x1f4;return function(_0x5d186f){logger[_0x24e5('0x29')](_0x5d186f[_0x24e5('0x2a')]);if(_0x5d186f['name']){delete _0x5d186f[_0x24e5('0x2b')];}_0x111ba5['status'](_0x30693a)[_0x24e5('0x2c')](_0x5d186f);};}exports[_0x24e5('0x2d')]=function(_0x2a81ff,_0x28214c){var _0x1a3874={},_0x41e977={},_0x2882db={'count':0x0,'rows':[]};var _0x80e74d=_[_0x24e5('0x2e')](db[_0x24e5('0x2f')][_0x24e5('0x30')],function(_0x161d91){return{'name':_0x161d91[_0x24e5('0x31')],'type':_0x161d91['type'][_0x24e5('0x32')]};});_0x41e977[_0x24e5('0x33')]=_['map'](_0x80e74d,_0x24e5('0x2b'));_0x41e977[_0x24e5('0x34')]=_['keys'](_0x2a81ff[_0x24e5('0x34')]);_0x41e977[_0x24e5('0x35')]=_[_0x24e5('0x36')](_0x41e977[_0x24e5('0x33')],_0x41e977[_0x24e5('0x34')]);_0x1a3874['attributes']=_[_0x24e5('0x36')](_0x41e977[_0x24e5('0x33')],qs[_0x24e5('0x37')](_0x2a81ff[_0x24e5('0x34')]['fields']));_0x1a3874[_0x24e5('0x38')]=_0x1a3874[_0x24e5('0x38')]['length']?_0x1a3874[_0x24e5('0x38')]:_0x41e977[_0x24e5('0x33')];if(!_0x2a81ff[_0x24e5('0x34')][_0x24e5('0x39')](_0x24e5('0x3a'))){_0x1a3874['limit']=qs['limit'](_0x2a81ff[_0x24e5('0x34')][_0x24e5('0x22')]);_0x1a3874['offset']=qs['offset'](_0x2a81ff[_0x24e5('0x34')][_0x24e5('0x20')]);}_0x1a3874[_0x24e5('0x3b')]=qs[_0x24e5('0x3c')](_0x2a81ff[_0x24e5('0x34')][_0x24e5('0x3c')]);_0x1a3874[_0x24e5('0x3d')]=qs[_0x24e5('0x35')](_['pick'](_0x2a81ff['query'],_0x41e977[_0x24e5('0x35')]),_0x80e74d);if(_0x2a81ff[_0x24e5('0x34')]['filter']){_0x1a3874['where']=_[_0x24e5('0x3e')](_0x1a3874['where'],{'$or':_['map'](_0x80e74d,function(_0x201a5c){if(_0x201a5c['type']!=='VIRTUAL'){var _0x20793c={};_0x20793c[_0x201a5c['name']]={'$like':'%'+_0x2a81ff['query'][_0x24e5('0x3f')]+'%'};return _0x20793c;}})});}_0x1a3874=_['merge']({},_0x1a3874,_0x2a81ff[_0x24e5('0x40')]);var _0x3ef879={'where':_0x1a3874[_0x24e5('0x3d')]};return db[_0x24e5('0x2f')][_0x24e5('0x21')](_0x3ef879)[_0x24e5('0x28')](function(_0x24454a){_0x2882db['count']=_0x24454a;if(_0x2a81ff[_0x24e5('0x34')]['includeAll']){_0x1a3874[_0x24e5('0x41')]=[{'all':!![]}];}return db[_0x24e5('0x2f')]['findAll'](_0x1a3874);})[_0x24e5('0x28')](function(_0x32bbfd){_0x2882db['rows']=_0x32bbfd;return _0x2882db;})['then'](respondWithFilteredResult(_0x28214c,_0x1a3874))[_0x24e5('0x42')](handleError(_0x28214c,null));};exports[_0x24e5('0x43')]=function(_0x5ba17e,_0x3d5513){var _0x8a0f1e={'raw':!![],'where':{'id':_0x5ba17e[_0x24e5('0x44')]['id']}},_0x394e6e={};_0x394e6e[_0x24e5('0x33')]=_[_0x24e5('0x45')](db['WhatsappTransferReport']['rawAttributes']);_0x394e6e['query']=_[_0x24e5('0x45')](_0x5ba17e[_0x24e5('0x34')]);_0x394e6e['filters']=_[_0x24e5('0x36')](_0x394e6e[_0x24e5('0x33')],_0x394e6e[_0x24e5('0x34')]);_0x8a0f1e[_0x24e5('0x38')]=_[_0x24e5('0x36')](_0x394e6e[_0x24e5('0x33')],qs[_0x24e5('0x37')](_0x5ba17e[_0x24e5('0x34')][_0x24e5('0x37')]));_0x8a0f1e[_0x24e5('0x38')]=_0x8a0f1e[_0x24e5('0x38')][_0x24e5('0x46')]?_0x8a0f1e[_0x24e5('0x38')]:_0x394e6e[_0x24e5('0x33')];if(_0x5ba17e['query'][_0x24e5('0x47')]){_0x8a0f1e['include']=[{'all':!![]}];}_0x8a0f1e=_['merge']({},_0x8a0f1e,_0x5ba17e[_0x24e5('0x40')]);return db['WhatsappTransferReport']['find'](_0x8a0f1e)[_0x24e5('0x28')](handleEntityNotFound(_0x3d5513,null))['then'](respondWithResult(_0x3d5513,null))['catch'](handleError(_0x3d5513,null));};exports[_0x24e5('0x48')]=function(_0x124fcf,_0x4b6c8d){return db[_0x24e5('0x2f')][_0x24e5('0x48')](_0x124fcf[_0x24e5('0x49')],{})[_0x24e5('0x28')](respondWithResult(_0x4b6c8d,0xc9))[_0x24e5('0x42')](handleError(_0x4b6c8d,null));};exports['update']=function(_0x11b0a1,_0x3bd018){if(_0x11b0a1[_0x24e5('0x49')]['id']){delete _0x11b0a1[_0x24e5('0x49')]['id'];}return db[_0x24e5('0x2f')][_0x24e5('0x4a')]({'where':{'id':_0x11b0a1[_0x24e5('0x44')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x3bd018,null))[_0x24e5('0x28')](saveUpdates(_0x11b0a1[_0x24e5('0x49')],null))[_0x24e5('0x28')](respondWithResult(_0x3bd018,null))[_0x24e5('0x42')](handleError(_0x3bd018,null));};exports['destroy']=function(_0x52e3db,_0x217fd7){return db[_0x24e5('0x2f')][_0x24e5('0x4a')]({'where':{'id':_0x52e3db[_0x24e5('0x44')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x217fd7,null))[_0x24e5('0x28')](removeEntity(_0x217fd7,null))[_0x24e5('0x42')](handleError(_0x217fd7,null));};exports[_0x24e5('0x4b')]=function(_0x3b1f54,_0x8967bc){return db['WhatsappTransferReport'][_0x24e5('0x4b')]()[_0x24e5('0x28')](respondWithResult(_0x8967bc,null))[_0x24e5('0x42')](handleError(_0x8967bc,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 8b19aac..62d6cdc 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 _0xa046=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','moment','bluebird','request-promise','path'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0xa046,0xb0));var _0x6a04=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xa046[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x6a04('0x0'));var util=require(_0x6a04('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6a04('0x2'));var BPromise=require(_0x6a04('0x3'));var rp=require(_0x6a04('0x4'));var fs=require('fs');var path=require(_0x6a04('0x5'));var rimraf=require(_0x6a04('0x6'));var config=require(_0x6a04('0x7'));var attributes=require(_0x6a04('0x8'));module[_0x6a04('0x9')]=function(_0x5d0970,_0x52d42b){return _0x5d0970[_0x6a04('0xa')](_0x6a04('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x6a04('0xc'),'fields':[_0x6a04('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf000=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','request-promise','path'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0xf000,0x17d));var _0x0f00=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xf000[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x0f00('0x0'));var util=require('util');var logger=require(_0x0f00('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0f00('0x2'));var fs=require('fs');var path=require(_0x0f00('0x3'));var rimraf=require(_0x0f00('0x4'));var config=require(_0x0f00('0x5'));var attributes=require(_0x0f00('0x6'));module[_0x0f00('0x7')]=function(_0x995d58,_0x249d73){return _0x995d58['define'](_0x0f00('0x8'),attributes,{'tableName':_0x0f00('0x9'),'paranoid':![],'indexes':[{'name':_0x0f00('0xa'),'fields':[_0x0f00('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 4c41489..e40f504 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 _0x5ce4=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x3fadae,_0x286c69){var _0x166651=function(_0x888400){while(--_0x888400){_0x3fadae['push'](_0x3fadae['shift']());}};_0x166651(++_0x286c69);}(_0x5ce4,0x1c1));var _0x45ce=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0x5ce4[_0x3299d1];return _0x44356e;};'use strict';var _=require(_0x45ce('0x0'));var util=require(_0x45ce('0x1'));var moment=require('moment');var BPromise=require(_0x45ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45ce('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x45ce('0x4'))(_0x45ce('0x5'));var config=require(_0x45ce('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x45ce('0x7')][_0x45ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x549293,_0x531fd7,_0x58631e){return new BPromise(function(_0x5a64b8,_0x1f0e2d){return client['request'](_0x549293,_0x58631e)[_0x45ce('0x9')](function(_0x4271e2){logger[_0x45ce('0xa')](_0x45ce('0xb'),_0x531fd7,_0x45ce('0xc'));logger['debug'](_0x45ce('0xd'),_0x531fd7,_0x45ce('0xc'),JSON['stringify'](_0x4271e2));if(_0x4271e2['error']){if(_0x4271e2[_0x45ce('0xe')][_0x45ce('0xf')]===0x1f4){logger['error'](_0x45ce('0xb'),_0x531fd7,_0x4271e2['error']['message']);return _0x1f0e2d(_0x4271e2[_0x45ce('0xe')][_0x45ce('0x10')]);}logger[_0x45ce('0xe')](_0x45ce('0xb'),_0x531fd7,_0x4271e2['error'][_0x45ce('0x10')]);return _0x5a64b8(_0x4271e2[_0x45ce('0xe')]['message']);}else{logger[_0x45ce('0xa')](_0x45ce('0xb'),_0x531fd7,_0x45ce('0xc'));_0x5a64b8(_0x4271e2['result'][_0x45ce('0x10')]);}})['catch'](function(_0x1b72bd){logger[_0x45ce('0xe')](_0x45ce('0xb'),_0x531fd7,_0x1b72bd);_0x1f0e2d(_0x1b72bd);});});} \ No newline at end of file +var _0x88c3=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info'];(function(_0x40776d,_0x2a60ac){var _0xc0e91d=function(_0x546a01){while(--_0x546a01){_0x40776d['push'](_0x40776d['shift']());}};_0xc0e91d(++_0x2a60ac);}(_0x88c3,0x7b));var _0x388c=function(_0x438509,_0x98abbe){_0x438509=_0x438509-0x0;var _0x35cddc=_0x88c3[_0x438509];return _0x35cddc;};'use strict';var _=require('lodash');var util=require(_0x388c('0x0'));var moment=require(_0x388c('0x1'));var BPromise=require('bluebird');var rs=require(_0x388c('0x2'));var fs=require('fs');var Redis=require(_0x388c('0x3'));var db=require(_0x388c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x388c('0x5'));var config=require(_0x388c('0x6'));var jayson=require(_0x388c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29c588,_0x427020,_0x1416bb){return new BPromise(function(_0x5bdb75,_0x396dc0){return client[_0x388c('0x8')](_0x29c588,_0x1416bb)['then'](function(_0x11a782){logger[_0x388c('0x9')](_0x388c('0xa'),_0x427020,_0x388c('0xb'));logger[_0x388c('0xc')](_0x388c('0xd'),_0x427020,_0x388c('0xb'),JSON[_0x388c('0xe')](_0x11a782));if(_0x11a782[_0x388c('0xf')]){if(_0x11a782[_0x388c('0xf')][_0x388c('0x10')]===0x1f4){logger['error'](_0x388c('0xa'),_0x427020,_0x11a782['error'][_0x388c('0x11')]);return _0x396dc0(_0x11a782[_0x388c('0xf')][_0x388c('0x11')]);}logger[_0x388c('0xf')](_0x388c('0xa'),_0x427020,_0x11a782[_0x388c('0xf')][_0x388c('0x11')]);return _0x5bdb75(_0x11a782[_0x388c('0xf')][_0x388c('0x11')]);}else{logger[_0x388c('0x9')](_0x388c('0xa'),_0x427020,_0x388c('0xb'));_0x5bdb75(_0x11a782['result'][_0x388c('0x11')]);}})[_0x388c('0x12')](function(_0x4baeed){logger[_0x388c('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x427020,_0x4baeed);_0x396dc0(_0x4baeed);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index e93f999..732d6b4 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b20=['None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status'];(function(_0x1954ba,_0x142730){var _0x432c9f=function(_0x5a2687){while(--_0x5a2687){_0x1954ba['push'](_0x1954ba['shift']());}};_0x432c9f(++_0x142730);}(_0x5b20,0x86));var _0x05b2=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5b20[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x05b2('0x0'));var db=require(_0x05b2('0x1'))['db'];var seedDb=require(_0x05b2('0x2'));var checkLicense=require(_0x05b2('0x3'));var rpc=require(_0x05b2('0x4'));var config=require(_0x05b2('0x5'));var logger=require(_0x05b2('0x6'))(_0x05b2('0x7'));var pm2=require(_0x05b2('0x8'));var pm2Config=require(_0x05b2('0x9'));var schedule=require(_0x05b2('0xa'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x05b2('0xb'));var transcribe=require(_0x05b2('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x05b2('0xd')][_0x05b2('0xe')]()[_0x05b2('0xf')](function(){if(config[_0x05b2('0x10')]){return seedDb[_0x05b2('0x11')]();}})[_0x05b2('0xf')](function(){return checkLicense[_0x05b2('0x11')]();})[_0x05b2('0xf')](function(){return rpc[_0x05b2('0x12')]();})[_0x05b2('0xf')](function(_0x9a7fd7){logger[_0x05b2('0x13')](_0x9a7fd7);return chat[_0x05b2('0x14')]();})[_0x05b2('0xf')](function(){return whatsapp[_0x05b2('0x14')]();})[_0x05b2('0xf')](function(){return schedule['start']();})[_0x05b2('0xf')](function(){return transcribe[_0x05b2('0x14')]();})[_0x05b2('0xf')](function(){return provider[_0x05b2('0x14')]();})['then'](function(_0x1339ad){logger[_0x05b2('0x13')](_0x1339ad);return pm2[_0x05b2('0x14')](pm2Config);})['then'](function(_0x4e5c5d){var _0x961aca=_0x4e5c5d[_0x05b2('0x15')](function(_0x4d6d7e){return typeof _0x4d6d7e['exitCode']===_0x05b2('0x16')&&_0x4d6d7e[_0x05b2('0x17')]>=0x0;});if(_0x961aca[_0x05b2('0x18')]>0x0){throw new Error(_0x961aca[_0x05b2('0x18')]+_0x05b2('0x19')+_[_0x05b2('0x1a')](_0x961aca,function(_0x290cce){return'\x22'+_0x290cce[_0x05b2('0x1b')][_0x05b2('0x1c')]+'\x22';}));}logger[_0x05b2('0x13')](_0x05b2('0x1d'),_[_0x05b2('0x1a')](_[_0x05b2('0x15')](_0x4e5c5d,{'status':_0x05b2('0x1e')}),_0x05b2('0x1c'))[_0x05b2('0x1f')]());logger['info'](_0x05b2('0x20'),_[_0x05b2('0x1a')](_[_0x05b2('0x15')](_0x4e5c5d,function(_0x41bea5){return _0x41bea5[_0x05b2('0x21')]!==_0x05b2('0x1e');}),_0x05b2('0x1c'))['join']()||_0x05b2('0x22'));console['log'](_0x05b2('0x23'));})[_0x05b2('0x24')](function(_0x4b2eac){console[_0x05b2('0x25')](_0x05b2('0x26'),_0x4b2eac);logger[_0x05b2('0x27')](_0x05b2('0x28'),_0x4b2eac);process[_0x05b2('0x29')](0x1);});}main(); \ No newline at end of file +var _0x16d8=['start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','join','status','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','info'];(function(_0x13647a,_0x23799f){var _0x41f50c=function(_0x45cdd6){while(--_0x45cdd6){_0x13647a['push'](_0x13647a['shift']());}};_0x41f50c(++_0x23799f);}(_0x16d8,0xa3));var _0x816d=function(_0xf65e1d,_0x2bbdc4){_0xf65e1d=_0xf65e1d-0x0;var _0x3ea3ce=_0x16d8[_0xf65e1d];return _0x3ea3ce;};'use strict';var _=require('lodash');var db=require(_0x816d('0x0'))['db'];var seedDb=require(_0x816d('0x1'));var checkLicense=require(_0x816d('0x2'));var rpc=require(_0x816d('0x3'));var config=require(_0x816d('0x4'));var logger=require(_0x816d('0x5'))(_0x816d('0x6'));var pm2=require(_0x816d('0x7'));var pm2Config=require(_0x816d('0x8'));var schedule=require('./config/schedule');var chat=require(_0x816d('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x816d('0xa'));var provider=require(_0x816d('0xb'));function main(){return db[_0x816d('0xc')][_0x816d('0xd')]()[_0x816d('0xe')](function(){if(config['seedDB']){return seedDb[_0x816d('0xf')]();}})[_0x816d('0xe')](function(){return checkLicense[_0x816d('0xf')]();})['then'](function(){return rpc['listen']();})['then'](function(_0x1c0bda){logger[_0x816d('0x10')](_0x1c0bda);return chat[_0x816d('0x11')]();})[_0x816d('0xe')](function(){return whatsapp['start']();})[_0x816d('0xe')](function(){return schedule[_0x816d('0x11')]();})[_0x816d('0xe')](function(){return transcribe['start']();})[_0x816d('0xe')](function(){return provider[_0x816d('0x11')]();})['then'](function(_0x39c256){logger[_0x816d('0x10')](_0x39c256);return pm2['start'](pm2Config);})[_0x816d('0xe')](function(_0x3a50c8){var _0x4e2aa9=_0x3a50c8[_0x816d('0x12')](function(_0xa2c0f){return typeof _0xa2c0f[_0x816d('0x13')]===_0x816d('0x14')&&_0xa2c0f[_0x816d('0x13')]>=0x0;});if(_0x4e2aa9[_0x816d('0x15')]>0x0){throw new Error(_0x4e2aa9[_0x816d('0x15')]+_0x816d('0x16')+_[_0x816d('0x17')](_0x4e2aa9,function(_0x525c3b){return'\x22'+_0x525c3b[_0x816d('0x18')][_0x816d('0x19')]+'\x22';}));}logger[_0x816d('0x10')]('Online\x20apps:',_[_0x816d('0x17')](_[_0x816d('0x12')](_0x3a50c8,{'status':_0x816d('0x1a')}),_0x816d('0x19'))[_0x816d('0x1b')]());logger[_0x816d('0x10')]('Offline\x20apps:',_[_0x816d('0x17')](_[_0x816d('0x12')](_0x3a50c8,function(_0x11ff2b){return _0x11ff2b[_0x816d('0x1c')]!==_0x816d('0x1a');}),_0x816d('0x19'))[_0x816d('0x1b')]()||_0x816d('0x1d'));console['log'](_0x816d('0x1e'));})['catch'](function(_0xd77200){console[_0x816d('0x1f')](_0x816d('0x20'),_0xd77200);logger[_0x816d('0x21')](_0x816d('0x22'),_0xd77200);process[_0x816d('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e2546ab..fb24cb5 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 _0xf3cd=['role','name','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','authorization','startsWith','Basic','User','authenticate','catch','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session'];(function(_0x2bddb2,_0x1f4aaf){var _0x41cfbe=function(_0x4943c9){while(--_0x4943c9){_0x2bddb2['push'](_0x2bddb2['shift']());}};_0x41cfbe(++_0x1f4aaf);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x450d4e,_0xcacc3){_0x450d4e=_0x450d4e-0x0;var _0x300304=_0xf3cd[_0x450d4e];return _0x300304;};'use strict';var db=require(_0xdf3c('0x0'))['db'];var config=require(_0xdf3c('0x1'));var hardwareConf=require(_0xdf3c('0x2'));var licenseUtil=require(_0xdf3c('0x3'));var encryptor=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf3c('0x6'));var compose=require(_0xdf3c('0x7'));var basicAuth=require(_0xdf3c('0x8'));var crypto=require('crypto');var BPromise=require(_0xdf3c('0x9'));var util=require(_0xdf3c('0xa'));var moment=require(_0xdf3c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdf3c('0xc')][_0xdf3c('0xd')]});var userAttributes=['id',_0xdf3c('0xe'),'fullname',_0xdf3c('0xf'),'internal','email',_0xdf3c('0x10'),_0xdf3c('0x11'),'md5secret',_0xdf3c('0x12'),_0xdf3c('0x13'),_0xdf3c('0x14'),_0xdf3c('0x15'),_0xdf3c('0x16'),_0xdf3c('0x17'),_0xdf3c('0x18'),_0xdf3c('0x19'),'lastLoginAt',_0xdf3c('0x1a'),_0xdf3c('0x1b'),_0xdf3c('0x1c'),_0xdf3c('0x1d'),'alias',_0xdf3c('0x1e'),_0xdf3c('0x1f'),_0xdf3c('0x20'),'phoneBarEnableRecording',_0xdf3c('0x21'),_0xdf3c('0x22'),_0xdf3c('0x23'),_0xdf3c('0x24'),_0xdf3c('0x25'),_0xdf3c('0x26'),_0xdf3c('0x27'),_0xdf3c('0x28'),_0xdf3c('0x29'),_0xdf3c('0x2a'),'settingsEnabled',_0xdf3c('0x2b'),_0xdf3c('0x2c'),_0xdf3c('0x2d'),_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30'),_0xdf3c('0x31'),_0xdf3c('0x32'),_0xdf3c('0x33'),_0xdf3c('0x34'),_0xdf3c('0x35'),_0xdf3c('0x36'),_0xdf3c('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xdf3c('0x38'),'whatsappAutoanswer',_0xdf3c('0x39')];exports[_0xdf3c('0x3a')]=function(){return this[_0xdf3c('0x3b')](!![])[_0xdf3c('0x3c')](function(_0x33652f,_0x36ba1c,_0x50d8ca){if(_0x33652f[_0xdf3c('0x3d')]){_0x50d8ca();}else{return db[_0xdf3c('0x3e')][_0xdf3c('0x3f')]({'where':{'id':_0x33652f[_0xdf3c('0x40')]['id']},'attributes':['id',_0xdf3c('0x41'),_0xdf3c('0x42')],'raw':!![]})[_0xdf3c('0x43')](function(_0x155f54){if(_0x155f54&&_0x155f54[_0xdf3c('0x41')]){return _0x36ba1c[_0xdf3c('0x44')](_0x155f54['disposition']===_0xdf3c('0x45')?0x195:0x193)[_0xdf3c('0x46')]({'message':_0x155f54['disposition']===_0xdf3c('0x45')?'Unmanaged.':'Forbidden.'});}else{_0x50d8ca();}})['catch'](function(_0x14aac9){_0x50d8ca(_0x14aac9);});}});};exports[_0xdf3c('0x3b')]=function isAuthenticated(_0x52b8f6){return compose()['use'](function(_0x37ecfd,_0x1f2ce4,_0xd3cfcb){var _0x1ccdd4;if(_0x37ecfd['headers'][_0xdf3c('0x47')]){if(_[_0xdf3c('0x48')](_0x37ecfd['headers']['authorization'],_0xdf3c('0x49'))){var _0x46f0e3=basicAuth(_0x37ecfd);db[_0xdf3c('0x4a')]['find']({'where':{'name':_0x46f0e3[_0xdf3c('0xf')]}})[_0xdf3c('0x43')](function(_0x21e7b8){if(!_0x21e7b8||!_0x21e7b8[_0xdf3c('0x4b')](_0x46f0e3['pass'])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':'Wrong\x20credentials.'});}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x21e7b8['id']};_0xd3cfcb();})[_0xdf3c('0x4c')](function(_0x217a65){_0xd3cfcb(_0x217a65);});}else if(_[_0xdf3c('0x48')](_0x37ecfd['headers'][_0xdf3c('0x47')],_0xdf3c('0x4d'))){validateJwt(_0x37ecfd,_0x1f2ce4,_0xd3cfcb);}else{if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4[_0xdf3c('0x44')](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37ecfd[_0xdf3c('0x4e')][_0xdf3c('0x4f')]){try{var _0x5ddd21={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};verifyJwt(_0x37ecfd['query'][_0xdf3c('0x4f')],_0x5ddd21)['then'](function(_0x57faba){return db['User'][_0xdf3c('0x51')]({'where':{'id':_0x57faba[_0xdf3c('0x52')]}})[_0xdf3c('0x43')](function(_0x29b5b7){_0x1ccdd4=_0x29b5b7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdf3c('0x53'),'blockDuration'],'raw':!![]});})[_0xdf3c('0x43')](function(_0x17b502){if(!_0x1ccdd4||!_[_0xdf3c('0x54')](_0x1ccdd4[_0xdf3c('0x55')],_0x57faba[_0xdf3c('0x56')])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x57')});}if(_0x1ccdd4[_0xdf3c('0x58')]){return _0x1f2ce4['status'](0x191)[_0xdf3c('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1ccdd4['blocked']){if(_0x17b502[_0xdf3c('0x59')]>0x0){if(moment(_0x1ccdd4['blockedAt'])[_0xdf3c('0x5a')](_0x17b502['blockDuration'],_0xdf3c('0x5b'))>moment()){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}else{return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x1ccdd4['id']};_0xd3cfcb();});})[_0xdf3c('0x4c')](function(){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});});}catch(_0x57e0ab){_0xd3cfcb(_0x57e0ab);}}else if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4['status'](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}})[_0xdf3c('0x3c')](function(_0x14d8e1,_0x46194d,_0x328b18){if(_0x14d8e1['user']){db['User'][_0xdf3c('0x51')]({'where':{'id':_0x14d8e1[_0xdf3c('0x3d')]['id']},'attributes':userAttributes})[_0xdf3c('0x43')](function(_0x4c59ef){if(!_0x4c59ef){return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5d')});}_0x14d8e1[_0xdf3c('0x3d')]=_0x4c59ef;_0x328b18();})['catch'](function(_0x127685){_0x328b18(_0x127685);});}else if(_0x52b8f6){_0x328b18();}else{return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5e')});}});};exports[_0xdf3c('0x5f')]=function canUpdate(){return compose()['use'](function(_0x410aaf,_0x286b72,_0x437443){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x344f1e){if(_0x344f1e['update']){_0x437443();}else{return _0x286b72['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})['catch'](function(_0x5c9885){_0x437443(_0x5c9885);});});};exports[_0xdf3c('0x62')]=function isWebrtcLicence(){return compose()[_0xdf3c('0x3c')](function(_0x46b2bd,_0x2aeb29,_0xaae4bc){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x84c5c2){if(_0x84c5c2[_0xdf3c('0x63')]){_0xaae4bc();}else{return _0x2aeb29['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})[_0xdf3c('0x4c')](function(_0xe760dd){_0xaae4bc(_0xe760dd);});});};exports[_0xdf3c('0x64')]=function(_0x385824,_0x28a468,_0x553f70){_0x385824[_0xdf3c('0x64')]=!![];return _0x553f70();};exports['signToken']=function signToken(_0xa4e137){return signJwt(_0xa4e137);};exports['setTokenCookie']=function(_0x41b78c,_0x28144f){if(!_0x41b78c[_0xdf3c('0x3d')]){return _0x28144f[_0xdf3c('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a068a={'payload':{'id':_0x41b78c[_0xdf3c('0x3d')]['id'],'role':_0x41b78c['user'][_0xdf3c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a068a)[_0xdf3c('0x43')](function(_0x446713){_0x28144f[_0xdf3c('0x65')](_0xdf3c('0x66'),_0x446713);_0x28144f['redirect']('/dashboards/general');})[_0xdf3c('0x4c')](function(_0x27a541){return _0x28144f['status'](0x1f4)[_0xdf3c('0x67')](_0x27a541);});};exports[_0xdf3c('0x68')]=function(_0x168eaf){if(_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x55')])||_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x6a')])){return null;}else{return createJwt(_0x168eaf);}};exports['generateApiKey']=function(_0x4c98dc){_0x4c98dc[_0xdf3c('0x55')]=generateNonce();_0x4c98dc[_0xdf3c('0x6a')]=generateIssuedAt();return createJwt(_0x4c98dc);};exports[_0xdf3c('0x6b')]=function(_0x1ad771,_0x22de6c){var _0x39f38f=_0x1ad771[_0xdf3c('0x4e')][_0xdf3c('0x4f')];if(_0x39f38f){var _0x143d01={'nonce':_0x22de6c[_0xdf3c('0x55')],'iat':_0x22de6c[_0xdf3c('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};return verifyJwt(_0x39f38f,_0x143d01)['then'](function(){return generateApiKey(_0x22de6c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x58fcbf){var _0x541c57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x541c57[_0xdf3c('0x6c')](_0x58fcbf))throw new db[(_0xdf3c('0x6d'))]['ValidationError'](_0xdf3c('0x6e'));return;};exports[_0xdf3c('0x6f')]=function(_0x51f8dd,_0xa8dddb,_0x28f935){var _0x10e9d5=encryptor[_0xdf3c('0x70')](_0xa8dddb)[_0xdf3c('0x71')](',');for(var _0x28f387=0x0;_0x28f387<_0x28f935;_0x28f387++){if(!_0x10e9d5[_0x28f387])break;if(_0x51f8dd[_0xdf3c('0x72')]()===_0x10e9d5[_0x28f387][_0xdf3c('0x72')]()){var _0x42efa2=util[_0xdf3c('0x73')](_0xdf3c('0x74'),_0x28f935);if(_0x28f935===0x1){_0x42efa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xdf3c('0x6d'))][(_0xdf3c('0x75'))](_0x42efa2);}}return;};exports[_0xdf3c('0x76')]=function(_0x5a3d63,_0x245c68){var _0x3e327e=_0x245c68?encryptor[_0xdf3c('0x70')](_0x245c68)['split'](','):[];if(_0x3e327e[_0xdf3c('0x77')]===0x5){_0x3e327e[_0xdf3c('0x78')](-0x1,0x1);}_0x3e327e['unshift'](_0x5a3d63);return encryptor[_0xdf3c('0x79')](_0x3e327e['join'](','));};function signJwt(_0x28c296){var _0x1b03e7=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7b')],{'context':jwt});var _0xed2a78=_0x28c296[_0xdf3c('0x7c')]||config[_0xdf3c('0xc')][_0xdf3c('0xd')];return new BPromise(function(_0x2922d8,_0x330730){_0x1b03e7(_0x28c296[_0xdf3c('0x7d')],_0xed2a78,_0x28c296[_0xdf3c('0x7e')])[_0xdf3c('0x43')](function(_0x206a18){_0x2922d8(_0x206a18);})[_0xdf3c('0x4c')](function(_0xe42432){_0x330730(_0xe42432);});});}function verifyJwt(_0xd7fb2d,_0x510538,_0x4dade5){var _0x2e8511=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7f')],{'context':jwt});var _0x596282=_0x4dade5||config[_0xdf3c('0xc')]['session'];return new BPromise(function(_0x574852,_0x184952){_0x2e8511(_0xd7fb2d,_0x596282,_0x510538)[_0xdf3c('0x43')](function(_0x1121b9){_0x574852(_0x1121b9);})[_0xdf3c('0x4c')](function(_0x68f487){_0x184952(_0x68f487);});});}function generateNonce(){return crypto[_0xdf3c('0x80')](0x10)[_0xdf3c('0x81')](_0xdf3c('0x82'));}function generateIssuedAt(){return Math[_0xdf3c('0x83')](Date[_0xdf3c('0x84')]()/0x3e8)[_0xdf3c('0x81')]();}function createJwt(_0x5a2dad){var _0x34000c={'payload':{'iat':_0x5a2dad['apiKeyIat'],'nonce':_0x5a2dad[_0xdf3c('0x55')]},'options':{'algorithm':_0xdf3c('0x85'),'subject':_0x5a2dad['id'][_0xdf3c('0x81')](),'issuer':hardwareConf[_0xdf3c('0x50')](),'audience':hardwareConf[_0xdf3c('0x50')]()}};return signJwt(_0x34000c)['then'](function(_0x18bf4f){return{'iat':_0x5a2dad[_0xdf3c('0x6a')],'nonce':_0x5a2dad[_0xdf3c('0x55')],'token':_0x18bf4f};});} \ No newline at end of file +var _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x2ceec2,_0x284b13){var _0x11d812=function(_0x58f3ec){while(--_0x58f3ec){_0x2ceec2['push'](_0x2ceec2['shift']());}};_0x11d812(++_0x284b13);}(_0xedd9,0xfc));var _0x9edd=function(_0x34c0d7,_0xf797dc){_0x34c0d7=_0x34c0d7-0x0;var _0x253501=_0xedd9[_0x34c0d7];return _0x253501;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 35f7d1e..d421261 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 _0x7b40=['data','update','binary','write','end','close','unlink','decryptFile','createReadStream','createDecipher','encryptString','secret','base64','final','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','hasOwnProperty','createWriteStream','createCipher'];(function(_0x1fd313,_0xa26467){var _0x15a0b0=function(_0x522ccf){while(--_0x522ccf){_0x1fd313['push'](_0x1fd313['shift']());}};_0x15a0b0(++_0xa26467);}(_0x7b40,0x1e4));var _0x07b4=function(_0x52088c,_0x6ecd27){_0x52088c=_0x52088c-0x0;var _0x5d0869=_0x7b40[_0x52088c];return _0x5d0869;};'use strict';var crypto=require(_0x07b4('0x0'));var fs=require('fs');var BPromise=require(_0x07b4('0x1'));var _=require(_0x07b4('0x2'));var config=require(_0x07b4('0x3'));var logger=require(_0x07b4('0x4'))(_0x07b4('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x07b4('0x6')][_0x07b4('0x7')],'algorithm':_0x07b4('0x8')};const fileOptions={'algorithm':_0x07b4('0x9')};if(config[_0x07b4('0xa')]&&config[_0x07b4('0xa')][_0x07b4('0xb')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x07b4('0xb')]);if(isSupported){fileOptions['algorithm']=config[_0x07b4('0xa')][_0x07b4('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x07b4('0xc')](',\x20');logger[_0x07b4('0xd')](config[_0x07b4('0xa')][_0x07b4('0xb')],_0x07b4('0xe'),supportedAlgorithms);}}function isASupportedCipher(_0x25369a){return AES_SUPPORTED_RX[_0x07b4('0xf')](_0x25369a);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x07b4('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x28f18f){return getSupportedCiphers()['indexOf'](_0x28f18f)>-0x1;}function combineOptions(_0x559f37){var _0x313e47={};for(var _0x20dcfd in fileOptions){if(fileOptions[_0x07b4('0x11')](_0x20dcfd)){_0x313e47[_0x20dcfd]=fileOptions[_0x20dcfd];}}if(_0x559f37){for(var _0x1a2316 in _0x559f37){if(_0x559f37['hasOwnProperty'](_0x1a2316)){_0x313e47[_0x1a2316]=_0x559f37[_0x1a2316];}}}return _0x313e47;}exports['encryptFile']=function(_0x43d68e,_0x78fc8,_0x3eabef,_0xe78f2f){return new BPromise(function(_0xb41671,_0x100c6f){_0xe78f2f=combineOptions(_0xe78f2f);var _0x38ff3a=new Buffer(_0x3eabef);var _0x2097e3=fs['createReadStream'](_0x43d68e);var _0x5466d7=fs[_0x07b4('0x12')](_0x78fc8);var _0x53eeb8=crypto[_0x07b4('0x13')](_0xe78f2f[_0x07b4('0xb')],_0x38ff3a);_0x2097e3['on'](_0x07b4('0x14'),function(_0x494fdf){var _0x36e5e1=new Buffer(_0x53eeb8[_0x07b4('0x15')](_0x494fdf),_0x07b4('0x16'));_0x5466d7[_0x07b4('0x17')](_0x36e5e1);});_0x2097e3['on']('end',function(){try{var _0x4ae939=new Buffer(_0x53eeb8['final']('binary'),_0x07b4('0x16'));_0x5466d7[_0x07b4('0x17')](_0x4ae939);_0x5466d7[_0x07b4('0x18')]();_0x5466d7['on'](_0x07b4('0x19'),function(){return _0xb41671(_0x78fc8);});}catch(_0x5c30ac){fs[_0x07b4('0x1a')](_0x78fc8);return _0x100c6f(_0x5c30ac);}});});};exports[_0x07b4('0x1b')]=function(_0x4c56c9,_0x493004,_0x1650b6,_0x29fd85){return new BPromise(function(_0x50cf35,_0x369cdd){_0x29fd85=combineOptions(_0x29fd85);var _0x822e93=new Buffer(_0x1650b6);var _0x2a843a=fs[_0x07b4('0x1c')](_0x4c56c9);var _0x38df83=fs['createWriteStream'](_0x493004);var _0x11d5bf=crypto[_0x07b4('0x1d')](_0x29fd85[_0x07b4('0xb')],_0x822e93);_0x2a843a['on'](_0x07b4('0x14'),function(_0x4f6d3b){var _0x51647e=new Buffer(_0x11d5bf[_0x07b4('0x15')](_0x4f6d3b),_0x07b4('0x16'));_0x38df83[_0x07b4('0x17')](_0x51647e);});_0x2a843a['on']('end',function(){try{var _0x437397=new Buffer(_0x11d5bf['final'](_0x07b4('0x16')),_0x07b4('0x16'));_0x38df83[_0x07b4('0x17')](_0x437397);_0x38df83[_0x07b4('0x18')]();_0x38df83['on'](_0x07b4('0x19'),function(){return _0x50cf35(_0x493004);});}catch(_0x4d0dfa){fs[_0x07b4('0x1a')](_0x493004);return _0x369cdd(_0x4d0dfa);}});});};exports[_0x07b4('0x1e')]=function(_0x505c13,_0x45912e,_0xf11f77){var _0x15b13e=_0xf11f77||stringOptions[_0x07b4('0xb')];var _0x21ce72=_0x45912e||stringOptions[_0x07b4('0x1f')];var _0x16dfa6=crypto[_0x07b4('0x13')](_0x15b13e,_0x21ce72);var _0x50a0a2=_0x16dfa6[_0x07b4('0x15')](_0x505c13,'utf8',_0x07b4('0x20'));_0x50a0a2+=_0x16dfa6[_0x07b4('0x21')](_0x07b4('0x20'));return _0x50a0a2;};exports[_0x07b4('0x22')]=function(_0x1ef83b,_0x5e70e6,_0xc39966){var _0x3d8aaf=_0xc39966||stringOptions['algorithm'];var _0x3f3f7a=_0x5e70e6||stringOptions['secret'];var _0x10be51=crypto['createDecipher'](_0x3d8aaf,_0x3f3f7a);var _0x34dcce=_0x10be51[_0x07b4('0x15')](_0x1ef83b,_0x07b4('0x20'),_0x07b4('0x23'));_0x34dcce+=_0x10be51['final'](_0x07b4('0x23'));return _0x34dcce;}; \ No newline at end of file +var _0x5443=['aes192','encrypt','algorithm','join','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','write','end','final','close','unlink','encryptString','secret','utf8','base64','createDecipher','crypto','lodash','../../config/logger','secrets','session','aes-256-ctr'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5443,0x18d));var _0x3544=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5443[_0x199572];return _0x13cfa3;};'use strict';var crypto=require(_0x3544('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x3544('0x1'));var config=require('../../config/environment');var logger=require(_0x3544('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x3544('0x3')][_0x3544('0x4')],'algorithm':_0x3544('0x5')};const fileOptions={'algorithm':_0x3544('0x6')};if(config[_0x3544('0x7')]&&config[_0x3544('0x7')][_0x3544('0x8')]){var isSupported=isAlgorithmSupported(config[_0x3544('0x7')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x3544('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3544('0x9')](',\x20');logger['error'](config[_0x3544('0x7')][_0x3544('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x45f8d0){return AES_SUPPORTED_RX[_0x3544('0xa')](_0x45f8d0);}function getSupportedCiphers(){return crypto[_0x3544('0xb')]()[_0x3544('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x3a64bb){return getSupportedCiphers()[_0x3544('0xd')](_0x3a64bb)>-0x1;}function combineOptions(_0x1b04f5){var _0x558fb3={};for(var _0x222ba3 in fileOptions){if(fileOptions[_0x3544('0xe')](_0x222ba3)){_0x558fb3[_0x222ba3]=fileOptions[_0x222ba3];}}if(_0x1b04f5){for(var _0x400a26 in _0x1b04f5){if(_0x1b04f5['hasOwnProperty'](_0x400a26)){_0x558fb3[_0x400a26]=_0x1b04f5[_0x400a26];}}}return _0x558fb3;}exports[_0x3544('0xf')]=function(_0x5b6995,_0x57b5e6,_0x33a4f2,_0x27e569){return new BPromise(function(_0xf7228,_0x17fd4c){_0x27e569=combineOptions(_0x27e569);var _0x2a09cc=new Buffer(_0x33a4f2);var _0x2a6080=fs[_0x3544('0x10')](_0x5b6995);var _0x502112=fs['createWriteStream'](_0x57b5e6);var _0x139891=crypto[_0x3544('0x11')](_0x27e569[_0x3544('0x8')],_0x2a09cc);_0x2a6080['on'](_0x3544('0x12'),function(_0x3ebdee){var _0x4f5cc4=new Buffer(_0x139891[_0x3544('0x13')](_0x3ebdee),_0x3544('0x14'));_0x502112[_0x3544('0x15')](_0x4f5cc4);});_0x2a6080['on'](_0x3544('0x16'),function(){try{var _0x2cf7c5=new Buffer(_0x139891[_0x3544('0x17')](_0x3544('0x14')),'binary');_0x502112['write'](_0x2cf7c5);_0x502112[_0x3544('0x16')]();_0x502112['on'](_0x3544('0x18'),function(){return _0xf7228(_0x57b5e6);});}catch(_0x4bec6b){fs['unlink'](_0x57b5e6);return _0x17fd4c(_0x4bec6b);}});});};exports['decryptFile']=function(_0x10b214,_0x2663d6,_0x2592f3,_0x25ced7){return new BPromise(function(_0x4209e9,_0x2ac1a0){_0x25ced7=combineOptions(_0x25ced7);var _0x2fc945=new Buffer(_0x2592f3);var _0x13a92e=fs['createReadStream'](_0x10b214);var _0x2fb52d=fs['createWriteStream'](_0x2663d6);var _0xc3c291=crypto['createDecipher'](_0x25ced7['algorithm'],_0x2fc945);_0x13a92e['on'](_0x3544('0x12'),function(_0x267e86){var _0x3f2c8f=new Buffer(_0xc3c291[_0x3544('0x13')](_0x267e86),_0x3544('0x14'));_0x2fb52d[_0x3544('0x15')](_0x3f2c8f);});_0x13a92e['on'](_0x3544('0x16'),function(){try{var _0x587293=new Buffer(_0xc3c291[_0x3544('0x17')](_0x3544('0x14')),_0x3544('0x14'));_0x2fb52d[_0x3544('0x15')](_0x587293);_0x2fb52d[_0x3544('0x16')]();_0x2fb52d['on'](_0x3544('0x18'),function(){return _0x4209e9(_0x2663d6);});}catch(_0x44902a){fs[_0x3544('0x19')](_0x2663d6);return _0x2ac1a0(_0x44902a);}});});};exports[_0x3544('0x1a')]=function(_0x2581ba,_0x21b918,_0x7fc995){var _0x63d669=_0x7fc995||stringOptions[_0x3544('0x8')];var _0x3b076f=_0x21b918||stringOptions[_0x3544('0x1b')];var _0x4f4274=crypto[_0x3544('0x11')](_0x63d669,_0x3b076f);var _0x4cc0a8=_0x4f4274['update'](_0x2581ba,_0x3544('0x1c'),_0x3544('0x1d'));_0x4cc0a8+=_0x4f4274['final'](_0x3544('0x1d'));return _0x4cc0a8;};exports['decryptString']=function(_0x5005b2,_0x528458,_0xe0c231){var _0x59ed54=_0xe0c231||stringOptions[_0x3544('0x8')];var _0x49c9dd=_0x528458||stringOptions['secret'];var _0x120d05=crypto[_0x3544('0x1e')](_0x59ed54,_0x49c9dd);var _0x9d6abd=_0x120d05[_0x3544('0x13')](_0x5005b2,_0x3544('0x1d'),'utf8');_0x9d6abd+=_0x120d05[_0x3544('0x17')](_0x3544('0x1c'));return _0x9d6abd;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 25c6a13..fa7e62b 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 _0x8309=['CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x35fdff,_0x58bf32){var _0x44b12a=function(_0x5f5c1a){while(--_0x5f5c1a){_0x35fdff['push'](_0x35fdff['shift']());}};_0x44b12a(++_0x58bf32);}(_0x8309,0xaa));var _0x9830=function(_0x55e0f9,_0x38e14d){_0x55e0f9=_0x55e0f9-0x0;var _0x4ef1da=_0x8309[_0x55e0f9];return _0x4ef1da;};'use strict';var util=require('util');var path=require(_0x9830('0x0'));var _=require('lodash');var csv=require(_0x9830('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x9830('0x2'));var db=require(_0x9830('0x3'))['db'];var dbH=require(_0x9830('0x3'))[_0x9830('0x4')];var logger=require(_0x9830('0x5'))(_0x9830('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9830('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xbcbe67,_0x1030b3){var _0x128464={'status':_0xbcbe67};var _0x1ebfa8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1030b3){_0x128464[_0x9830('0x8')]=_0x1030b3;}return db[_0x9830('0x9')][_0x9830('0xa')](_0x128464,_0x1ebfa8);}function main(){var _0x5d718e=0x1388;var _0x5c8178;logger[_0x9830('0xb')](util[_0x9830('0xc')](_0x9830('0xd'),EXTRACTED_REPORT_ID,_0x9830('0xe')));return db[_0x9830('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9830('0x10'),_0x9830('0x11')]})[_0x9830('0x12')](function(_0x1562a1){if(_0x1562a1){_0x5c8178=_0x1562a1;_0x5d718e=_0x5c8178[_0x9830('0x11')]||0x1388;}})['then'](function(){return dbH[_0x9830('0x13')][_0x9830('0x14')](util['format'](_0x9830('0x15'),QUERY),{'type':dbH[_0x9830('0x13')][_0x9830('0x16')][_0x9830('0x17')]});})['then'](function(_0x27421b){if(!_0x27421b[0x0][_0x9830('0x18')]){return analyticExtractedReport('Empty');}var _0x430b10=[];var _0x240f6d=0x0;if(_0x5c8178[_0x9830('0x10')]){if(_0x27421b&&_0x27421b[_0x9830('0x19')]){var _0x5ae89d=_['range'](_0x27421b[0x0][_0x9830('0x18')]/_0x5d718e);var _0x5a13e8=Number['isInteger'](_0x27421b[0x0]['num']/_0x5d718e)?_0x27421b[0x0]['num']%_0x5d718e:0x0;_0x5ae89d[_0x9830('0x1a')](function(_0xdf93b0){if(_0xdf93b0>0x0){_0x240f6d+=_0x5d718e;}_0x430b10[_0x9830('0x1b')](dbH[_0x9830('0x13')]['query'](util[_0x9830('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5d718e,_0x240f6d),{'type':dbH[_0x9830('0x13')]['QueryTypes'][_0x9830('0x17')]}));});if(_0x5a13e8>0x0){_0x240f6d+=_0x5d718e;_0x430b10[_0x9830('0x1b')](dbH[_0x9830('0x13')][_0x9830('0x14')](util[_0x9830('0xc')](_0x9830('0x1c'),QUERY,_0x5a13e8,_0x240f6d),{'type':dbH[_0x9830('0x13')][_0x9830('0x16')][_0x9830('0x17')]}));}}}else{_0x430b10[_0x9830('0x1b')](dbH[_0x9830('0x13')]['query'](QUERY,{'type':dbH[_0x9830('0x13')][_0x9830('0x16')][_0x9830('0x17')]}));}var _0x4e05e3=path['dirname'](PATH);var _0x350bc9=path[_0x9830('0x1d')](PATH,_0x9830('0x1e'));var _0x2dccc2=_0x5c8178['split']&&_0x430b10['length']>0x1;var _0x4225d7=[];if(!fs['existsSync'](path[_0x9830('0x1f')](_0x4e05e3,_0x350bc9))&&_0x2dccc2){fs[_0x9830('0x20')](path[_0x9830('0x1f')](_0x4e05e3,_0x350bc9));}return BPromise['each'](_0x430b10,function(_0xdd4152){_0x4225d7[_0x9830('0x1b')](_0xdd4152);})[_0x9830('0x12')](function(){for(var _0xb6b696=0x0;_0xb6b696<_0x4225d7[_0x9830('0x19')];_0xb6b696+=0x1){var _0x4039c0;var _0x3ec651=_0x4225d7[_0xb6b696];if(_0x2dccc2){_0x4039c0=path[_0x9830('0x1f')](_0x4e05e3,_0x350bc9,util[_0x9830('0xc')](_0x9830('0x21'),_0x350bc9,_0xb6b696,_0x9830('0x22')));}else{_0x4039c0=path[_0x9830('0x1f')](_0x4e05e3,util[_0x9830('0xc')](_0x9830('0x23'),_0x350bc9,_0x9830('0x22')));}fs[_0x9830('0x24')](_0x4039c0,csv(_0x3ec651));}})[_0x9830('0x12')](function(){if(_0x2dccc2){return new Promise(function(_0x523d5c){zipdir(path[_0x9830('0x1f')](_0x4e05e3,_0x350bc9),{'saveTo':path[_0x9830('0x1f')](_0x4e05e3,util['format'](_0x9830('0x23'),_0x350bc9,_0x9830('0x25')))},function(_0x3bd303,_0x458291){rimraf(path[_0x9830('0x1f')](_0x4e05e3,_0x350bc9),function(){});_0x523d5c(_0x9830('0x26'));});});}})[_0x9830('0x12')](function(){logger[_0x9830('0xb')](util[_0x9830('0xc')](_0x9830('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x9830('0x28'),_0x2dccc2?util['format'](_0x9830('0x23'),_0x350bc9,_0x2dccc2?_0x9830('0x25'):_0x9830('0x22')):null);});})[_0x9830('0x29')](function(_0x17d883){logger['info'](util['format'](_0x9830('0x2a'),EXTRACTED_REPORT_ID,_0x9830('0xe')),util[_0x9830('0x2b')](_0x17d883,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9830('0x2c'));})['finally'](function(){process[_0x9830('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3c0f=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','catch','Failed','finally','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','splitSizeCsv'];(function(_0x121ac6,_0x26b801){var _0x38e47f=function(_0x5bb103){while(--_0x5bb103){_0x121ac6['push'](_0x121ac6['shift']());}};_0x38e47f(++_0x26b801);}(_0x3c0f,0xe5));var _0xf3c0=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x3c0f[_0x307086];return _0x699043;};'use strict';var util=require(_0xf3c0('0x0'));var path=require('path');var _=require(_0xf3c0('0x1'));var csv=require(_0xf3c0('0x2'));var fs=require('fs');var BPromise=require(_0xf3c0('0x3'));var zipdir=require(_0xf3c0('0x4'));var rimraf=require(_0xf3c0('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf3c0('0x6'))['dbH'];var logger=require(_0xf3c0('0x7'))(_0xf3c0('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xf3c0('0x9')][0x2]);var QUERY=process[_0xf3c0('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x52fb0d,_0x322d9c){var _0x39110f={'status':_0x52fb0d};var _0x4976b6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x322d9c){_0x39110f[_0xf3c0('0xa')]=_0x322d9c;}return db[_0xf3c0('0xb')][_0xf3c0('0xc')](_0x39110f,_0x4976b6);}function main(){var _0x17bae1=0x1388;var _0x496aa6;logger[_0xf3c0('0xd')](util[_0xf3c0('0xe')](_0xf3c0('0xf'),EXTRACTED_REPORT_ID,_0xf3c0('0x10')));return db[_0xf3c0('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf3c0('0x12'),'splitSizeCsv']})[_0xf3c0('0x13')](function(_0x3b3478){if(_0x3b3478){_0x496aa6=_0x3b3478;_0x17bae1=_0x496aa6[_0xf3c0('0x14')]||0x1388;}})[_0xf3c0('0x13')](function(){return dbH['sequelize']['query'](util[_0xf3c0('0xe')](_0xf3c0('0x15'),QUERY),{'type':dbH[_0xf3c0('0x16')][_0xf3c0('0x17')][_0xf3c0('0x18')]});})[_0xf3c0('0x13')](function(_0x2c4bb5){if(!_0x2c4bb5[0x0][_0xf3c0('0x19')]){return analyticExtractedReport(_0xf3c0('0x1a'));}var _0x1b1ac6=[];var _0x5f23e4=0x0;if(_0x496aa6[_0xf3c0('0x12')]){if(_0x2c4bb5&&_0x2c4bb5[_0xf3c0('0x1b')]){var _0x32d5aa=_[_0xf3c0('0x1c')](_0x2c4bb5[0x0][_0xf3c0('0x19')]/_0x17bae1);var _0x54e1eb=Number[_0xf3c0('0x1d')](_0x2c4bb5[0x0][_0xf3c0('0x19')]/_0x17bae1)?_0x2c4bb5[0x0][_0xf3c0('0x19')]%_0x17bae1:0x0;_0x32d5aa[_0xf3c0('0x1e')](function(_0x56be39){if(_0x56be39>0x0){_0x5f23e4+=_0x17bae1;}_0x1b1ac6[_0xf3c0('0x1f')](dbH[_0xf3c0('0x16')][_0xf3c0('0x20')](util['format'](_0xf3c0('0x21'),QUERY,_0x17bae1,_0x5f23e4),{'type':dbH[_0xf3c0('0x16')][_0xf3c0('0x17')][_0xf3c0('0x18')]}));});if(_0x54e1eb>0x0){_0x5f23e4+=_0x17bae1;_0x1b1ac6['push'](dbH[_0xf3c0('0x16')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x54e1eb,_0x5f23e4),{'type':dbH['sequelize'][_0xf3c0('0x17')]['SELECT']}));}}}else{_0x1b1ac6['push'](dbH[_0xf3c0('0x16')][_0xf3c0('0x20')](QUERY,{'type':dbH[_0xf3c0('0x16')]['QueryTypes'][_0xf3c0('0x18')]}));}var _0xd5640e=path[_0xf3c0('0x22')](PATH);var _0x2fdedd=path[_0xf3c0('0x23')](PATH,_0xf3c0('0x24'));var _0x253b6c=_0x496aa6[_0xf3c0('0x12')]&&_0x1b1ac6[_0xf3c0('0x1b')]>0x1;var _0x4de257=[];if(!fs[_0xf3c0('0x25')](path[_0xf3c0('0x26')](_0xd5640e,_0x2fdedd))&&_0x253b6c){fs['mkdirSync'](path[_0xf3c0('0x26')](_0xd5640e,_0x2fdedd));}return BPromise[_0xf3c0('0x27')](_0x1b1ac6,function(_0x2200ba){_0x4de257[_0xf3c0('0x1f')](_0x2200ba);})[_0xf3c0('0x13')](function(){for(var _0x27da9f=0x0;_0x27da9f<_0x4de257[_0xf3c0('0x1b')];_0x27da9f+=0x1){var _0x54bab8;var _0x2e520d=_0x4de257[_0x27da9f];if(_0x253b6c){_0x54bab8=path[_0xf3c0('0x26')](_0xd5640e,_0x2fdedd,util[_0xf3c0('0xe')](_0xf3c0('0x28'),_0x2fdedd,_0x27da9f,_0xf3c0('0x29')));}else{_0x54bab8=path[_0xf3c0('0x26')](_0xd5640e,util[_0xf3c0('0xe')](_0xf3c0('0x2a'),_0x2fdedd,_0xf3c0('0x29')));}fs[_0xf3c0('0x2b')](_0x54bab8,csv(_0x2e520d));}})[_0xf3c0('0x13')](function(){if(_0x253b6c){return new Promise(function(_0x5e46dd){zipdir(path['join'](_0xd5640e,_0x2fdedd),{'saveTo':path[_0xf3c0('0x26')](_0xd5640e,util['format'](_0xf3c0('0x2a'),_0x2fdedd,_0xf3c0('0x2c')))},function(_0x58e23a,_0x1564c0){rimraf(path[_0xf3c0('0x26')](_0xd5640e,_0x2fdedd),function(){});_0x5e46dd(_0xf3c0('0x2d'));});});}})[_0xf3c0('0x13')](function(){logger[_0xf3c0('0xd')](util[_0xf3c0('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xf3c0('0x2e'),_0x253b6c?util[_0xf3c0('0xe')](_0xf3c0('0x2a'),_0x2fdedd,_0x253b6c?_0xf3c0('0x2c'):'csv'):null);});})[_0xf3c0('0x2f')](function(_0x24285b){logger[_0xf3c0('0xd')](util[_0xf3c0('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x24285b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf3c0('0x30'));})[_0xf3c0('0x31')](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 a6677ad..91bd354 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 _0xb0c1=['push','header','pageBreak','landscape','\x20/\x20','Arial','black','Empty','Setting','find','split','then','num','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','SELECT','dirname','basename','.pdf','join','mkdirSync','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','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','PDF','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','end','lodash','util','path','moment','pdfmake/src/printer','rimraf','jsdom','JSDOM','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','toString','value','fill','length','auto','body','concat','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','endDate'];(function(_0x220464,_0x15e026){var _0x21ca3e=function(_0x3a06ed){while(--_0x3a06ed){_0x220464['push'](_0x220464['shift']());}};_0x21ca3e(++_0x15e026);}(_0xb0c1,0x183));var _0x1b0c=function(_0x1100f5,_0xdbe2e7){_0x1100f5=_0x1100f5-0x0;var _0x15e288=_0xb0c1[_0x1100f5];return _0x15e288;};'use strict';var _=require(_0x1b0c('0x0'));var fs=require('fs');var util=require(_0x1b0c('0x1'));var path=require(_0x1b0c('0x2'));var moment=require(_0x1b0c('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x1b0c('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x1b0c('0x5'));var JSDOM=require(_0x1b0c('0x6'))[_0x1b0c('0x7')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x1b0c('0x8'))['db'];var dbH=require(_0x1b0c('0x8'))[_0x1b0c('0x9')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x1b0c('0xa')][0x3];var PATH=process[_0x1b0c('0xa')][0x4];var NAME=process[_0x1b0c('0xa')][0x5];var FORMAT=_0x1b0c('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x501789,_0x172c20){var _0x1426c6={'status':_0x501789};var _0x6f6a60={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x172c20){_0x1426c6[_0x1b0c('0xc')]=_0x172c20;}return db['AnalyticExtractedReport'][_0x1b0c('0xd')](_0x1426c6,_0x6f6a60);}function getHeaders(_0x2b7a7f){return _[_0x1b0c('0xe')](_0x2b7a7f,function(_0x1f45e4){return{'text':_0x1f45e4,'style':'tableHeader'};});}function getRows(_0x34082d,_0x1b32e2){return _[_0x1b0c('0xe')](_0x1b32e2,function(_0x320b2c){return _(_0x320b2c)['pick'](_0x34082d)[_0x1b0c('0xe')](function(_0x241de3){return _0x241de3?_[_0x1b0c('0xf')](_0x241de3):'';})[_0x1b0c('0x10')]();});}function createTable(_0x199ed2,_0x364489){var _0x47b06e={'widths':_[_0x1b0c('0x11')](Array(_0x199ed2[_0x1b0c('0x12')]),0x91),'heights':function(_0x132d9d){return _0x132d9d===0x0?_0x1b0c('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3b0362=getHeaders(_0x199ed2);_0x47b06e[_0x1b0c('0x14')]['push'](_0x3b0362);var _0x355169=getRows(_0x199ed2,_0x364489);_0x47b06e[_0x1b0c('0x14')]=_0x47b06e['body'][_0x1b0c('0x15')](_0x355169);return _0x47b06e;}function createTables(_0x517e94){var _0x4ff051=[];var _0x510238=_['chunk'](Object[_0x1b0c('0x16')](_0x517e94[0x0]),0x5);_0x510238[_0x1b0c('0x17')](function(_0xc7c47){_0x4ff051['push'](createTable(_0xc7c47,_0x517e94));});return _0x4ff051;}function getPDFDocDefinition(_0x2f8270){var _0x5cd8a4=util['format'](_0x1b0c('0x18'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x1b0c('0x19')])[_0x1b0c('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x1b0c('0x1b')])[_0x1b0c('0x1a')](FORMAT));var _0x2ce80d=[];for(var _0x12121f=0x0;_0x12121f<_0x2f8270[_0x1b0c('0x12')];_0x12121f++){var _0x260b05=[];if(_0x12121f===0x0){_0x260b05[_0x1b0c('0x1c')]({'text':_0x5cd8a4,'style':_0x1b0c('0x1d')});}var _0x1787ed={'table':_0x2f8270[_0x12121f]};if(_0x12121f>0x0){_0x1787ed[_0x1b0c('0x1e')]='before';_0x1787ed['margin']=[0x0,0x46,0x0,0x0];}_0x260b05[_0x1b0c('0x1c')](_0x1787ed);_0x2ce80d[_0x1b0c('0x1c')](_0x260b05);}return{'pageSize':'A4','pageOrientation':_0x1b0c('0x1f'),'content':_0x2ce80d,'footer':function(_0xe98636,_0x1cc117){return{'text':_0xe98636['toString']()+_0x1b0c('0x20')+_0x1cc117,'style':'footer'};},'defaultStyle':{'font':_0x1b0c('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1b0c('0x22')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x22195c){var _0x3b0179=0x1388;var _0x458d4c;if(!_0x22195c[0x0]['num']){return analyticExtractedReport(_0x1b0c('0x23'));}return db[_0x1b0c('0x24')][_0x1b0c('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1b0c('0x26'),'splitSizePdf']})['then'](function(_0x45acec){if(_0x45acec){_0x458d4c=_0x45acec;_0x3b0179=_0x458d4c['splitSizePdf']||0x3e8;}})[_0x1b0c('0x27')](function(){var _0x2115de=[];var _0x4fdb96=0x0;if(_0x458d4c['split']){if(_0x22195c&&_0x22195c['length']){var _0x24acbe=_['range'](_0x22195c[0x0][_0x1b0c('0x28')]/_0x3b0179);var _0x3672ce=Number[_0x1b0c('0x29')](_0x22195c[0x0][_0x1b0c('0x28')]/_0x3b0179)?_0x22195c[0x0][_0x1b0c('0x28')]%_0x3b0179:0x0;_0x24acbe[_0x1b0c('0x17')](function(_0x2c8f39){if(_0x2c8f39>0x0){_0x4fdb96+=_0x3b0179;}_0x2115de[_0x1b0c('0x1c')](dbH[_0x1b0c('0x2a')]['query'](util[_0x1b0c('0x1a')](_0x1b0c('0x2b'),QUERY,_0x3b0179,_0x4fdb96),{'type':dbH[_0x1b0c('0x2a')][_0x1b0c('0x2c')]['SELECT']}));});if(_0x3672ce>0x0){_0x4fdb96+=_0x3b0179;_0x2115de[_0x1b0c('0x1c')](dbH[_0x1b0c('0x2a')][_0x1b0c('0x2d')](util[_0x1b0c('0x1a')](_0x1b0c('0x2b'),QUERY,_0x3672ce,_0x4fdb96),{'type':dbH[_0x1b0c('0x2a')][_0x1b0c('0x2c')][_0x1b0c('0x2e')]}));}}}else{_0x2115de[_0x1b0c('0x1c')](dbH['sequelize'][_0x1b0c('0x2d')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x1b0c('0x2e')]}));}var _0x14810d=path[_0x1b0c('0x2f')](PATH);var _0x1aec1b=path[_0x1b0c('0x30')](PATH,_0x1b0c('0x31'));var _0x5000a1=_0x458d4c[_0x1b0c('0x26')]&&_0x2115de[_0x1b0c('0x12')]>0x1;var _0xb00acd=[];if(!fs['existsSync'](path[_0x1b0c('0x32')](_0x14810d,_0x1aec1b))&&_0x5000a1){fs[_0x1b0c('0x33')](path['join'](_0x14810d,_0x1aec1b));}return BPromise['each'](_0x2115de,function(_0x42a490){_0xb00acd[_0x1b0c('0x1c')](_0x42a490);})['then'](function(){var _0x3f848b=[];for(var _0x22bbf2=0x0;_0x22bbf2<_0xb00acd[_0x1b0c('0x12')];_0x22bbf2+=0x1){var _0xbb53ca=_0xb00acd[_0x22bbf2];var _0x1b5f0=createTables(_['flatten'](_0xbb53ca));var _0x46ce8a;var _0xf36c1f=getPDFDocDefinition(_0x1b5f0);var _0x161b10=getPDFPrinter();var _0x36a0f7=_0x161b10['createPdfKitDocument'](_0xf36c1f);if(_0x5000a1){_0x46ce8a=path[_0x1b0c('0x32')](_0x14810d,_0x1aec1b,util[_0x1b0c('0x1a')](_0x1b0c('0x34'),_0x1aec1b,_0x22bbf2,_0x1b0c('0x35')));}else{_0x46ce8a=path[_0x1b0c('0x32')](_0x14810d,util[_0x1b0c('0x1a')](_0x1b0c('0x36'),_0x1aec1b,_0x1b0c('0x35')));}_0x3f848b[_0x1b0c('0x1c')](writePDFDocument(_0x36a0f7,_0x46ce8a));}return Promise[_0x1b0c('0x37')](_0x3f848b);})[_0x1b0c('0x27')](function(){if(_0x5000a1){return new Promise(function(_0x3b93c3){zipdir(path[_0x1b0c('0x32')](_0x14810d,_0x1aec1b),{'saveTo':path[_0x1b0c('0x32')](_0x14810d,util[_0x1b0c('0x1a')](_0x1b0c('0x36'),_0x1aec1b,_0x1b0c('0x38')))},function(){rimraf(path['join'](_0x14810d,_0x1aec1b),function(){});_0x3b93c3(_0x1b0c('0x39'));});});}})[_0x1b0c('0x27')](function(){if(!_0x5000a1)return;rimraf(path['join'](_0x14810d,_0x1aec1b),function(){});})[_0x1b0c('0x27')](function(){logger[_0x1b0c('0x3a')](util[_0x1b0c('0x1a')](_0x1b0c('0x3b'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x1b0c('0x3c'),_0x5000a1?util['format'](_0x1b0c('0x36'),_0x1aec1b,_0x5000a1?_0x1b0c('0x38'):_0x1b0c('0x35')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1b0c('0x3a')](util[_0x1b0c('0x1a')](_0x1b0c('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x1b0c('0x3e')][_0x1b0c('0x3f')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x32f776){EXTRACTED_REPORT=_0x32f776;return dbH[_0x1b0c('0x2a')]['query'](util[_0x1b0c('0x1a')](_0x1b0c('0x40'),QUERY),{'type':dbH[_0x1b0c('0x2a')][_0x1b0c('0x2c')][_0x1b0c('0x2e')]});})[_0x1b0c('0x27')](extractReport)[_0x1b0c('0x41')](function(_0x31c7e8){logger[_0x1b0c('0x3a')](util[_0x1b0c('0x1a')](_0x1b0c('0x42'),EXTRACTED_REPORT_ID,_0x1b0c('0x43')),util[_0x1b0c('0x44')](_0x31c7e8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1b0c('0x45'));})['finally'](function(){process[_0x1b0c('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x710e7e=new PdfPrinter({'Arial':{'normal':__dirname+_0x1b0c('0x47'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x1b0c('0x48'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x710e7e;}function getPDFDocDefinitionFromHTML(_0x2917b0,_0x4b41b8){var _0x5b3c57=util['format'](_0x1b0c('0x49'),_0x4b41b8[_0x1b0c('0x4a')],_0x4b41b8[_0x1b0c('0x4b')]);var _0x1a13b4=moment()['format'](_0x1b0c('0x4c'))[_0x1b0c('0xf')]();var _0x66334b=htmlToPdfmake(_0x2917b0,{'window':window,'tableAutoSize':!![]});return{'content':[_0x66334b],'defaultStyle':{'font':_0x1b0c('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1b0c('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1b0c('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x1b0c('0x1d')}];},'footer':function(_0x55f3aa,_0x4f66f4){return[{'text':util[_0x1b0c('0x1a')](_0x1b0c('0x4e'),_0x5b3c57,_0x55f3aa,_0x4f66f4,_0x1a13b4),'style':_0x1b0c('0x4f')}];}};}function writePDFDocument(_0x111911,_0x2a4f66){return new Promise(function(_0x49f3d0,_0x5637f5){var _0x245b3d=_0x111911[_0x1b0c('0x50')](fs['createWriteStream'](_0x2a4f66));_0x245b3d['on'](_0x1b0c('0x51'),function(){_0x49f3d0(_0x1b0c('0x51'));});_0x245b3d['on']('error',function(_0x29274c){_0x5637f5(_0x29274c);});_0x111911[_0x1b0c('0x52')]();});}exports['createPdfFromHTML']=function(_0x31d2ab,_0x1e158f){var _0x5b8fb2=getPDFPrinter();var _0x3e5a16=getPDFDocDefinitionFromHTML(_0x31d2ab,_0x1e158f);var _0x5040b0=_0x5b8fb2['createPdfKitDocument'](_0x3e5a16);return writePDFDocument(_0x5040b0,_0x1e158f[_0x1b0c('0x2')])[_0x1b0c('0x41')](function(_0x3c677f){throw _0x3c677f;});}; \ No newline at end of file +var _0x6311=['QueryTypes','SELECT','sequelize','dirname','.pdf','mkdirSync','join','each','flatten','createPdfKitDocument','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','catch','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','window','bluebird','analytics','argv','AnalyticExtractedReport','update','map','tableHeader','toString','value','length','auto','body','push','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','endDate','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x17a578,_0xb0d395){var _0x263927=function(_0x1e6b45){while(--_0x1e6b45){_0x17a578['push'](_0x17a578['shift']());}};_0x263927(++_0xb0d395);}(_0x6311,0xd6));var _0x1631=function(_0x597009,_0x254949){_0x597009=_0x597009-0x0;var _0x4e88bd=_0x6311[_0x597009];return _0x4e88bd;};'use strict';var _=require(_0x1631('0x0'));var fs=require('fs');var util=require(_0x1631('0x1'));var path=require('path');var moment=require(_0x1631('0x2'));var htmlToPdfmake=require(_0x1631('0x3'));var PdfPrinter=require(_0x1631('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x1631('0x5')];var BPromise=require(_0x1631('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x1631('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x1631('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x1631('0x8')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x492ad4,_0x1a0236){var _0x3b9e8f={'status':_0x492ad4};var _0x997dce={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1a0236){_0x3b9e8f['savename']=_0x1a0236;}return db[_0x1631('0x9')][_0x1631('0xa')](_0x3b9e8f,_0x997dce);}function getHeaders(_0x286cec){return _[_0x1631('0xb')](_0x286cec,function(_0x9c6209){return{'text':_0x9c6209,'style':_0x1631('0xc')};});}function getRows(_0xc4c045,_0x482ced){return _[_0x1631('0xb')](_0x482ced,function(_0x48c6b9){return _(_0x48c6b9)['pick'](_0xc4c045)['map'](function(_0x385546){return _0x385546?_[_0x1631('0xd')](_0x385546):'';})[_0x1631('0xe')]();});}function createTable(_0x59bd3d,_0x5e3351){var _0x486ef1={'widths':_['fill'](Array(_0x59bd3d[_0x1631('0xf')]),0x91),'heights':function(_0x34d43b){return _0x34d43b===0x0?_0x1631('0x10'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x217e90=getHeaders(_0x59bd3d);_0x486ef1[_0x1631('0x11')][_0x1631('0x12')](_0x217e90);var _0x1eaeea=getRows(_0x59bd3d,_0x5e3351);_0x486ef1['body']=_0x486ef1[_0x1631('0x11')]['concat'](_0x1eaeea);return _0x486ef1;}function createTables(_0x2cd89e){var _0x273d05=[];var _0x91c5f0=_['chunk'](Object[_0x1631('0x13')](_0x2cd89e[0x0]),0x5);_0x91c5f0['forEach'](function(_0x1a224f){_0x273d05['push'](createTable(_0x1a224f,_0x2cd89e));});return _0x273d05;}function getPDFDocDefinition(_0x1a5374){var _0x7a9b8c=util['format'](_0x1631('0x14'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x1631('0x15')])[_0x1631('0x16')](FORMAT),moment(EXTRACTED_REPORT[_0x1631('0x17')])[_0x1631('0x16')](FORMAT));var _0xb3cc7f=[];for(var _0x29430f=0x0;_0x29430f<_0x1a5374['length'];_0x29430f++){var _0xdac5f4=[];if(_0x29430f===0x0){_0xdac5f4['push']({'text':_0x7a9b8c,'style':'header'});}var _0x386d1b={'table':_0x1a5374[_0x29430f]};if(_0x29430f>0x0){_0x386d1b['pageBreak']=_0x1631('0x18');_0x386d1b[_0x1631('0x19')]=[0x0,0x46,0x0,0x0];}_0xdac5f4[_0x1631('0x12')](_0x386d1b);_0xb3cc7f[_0x1631('0x12')](_0xdac5f4);}return{'pageSize':'A4','pageOrientation':_0x1631('0x1a'),'content':_0xb3cc7f,'footer':function(_0x1cf5f1,_0x1c7d4d){return{'text':_0x1cf5f1[_0x1631('0xd')]()+_0x1631('0x1b')+_0x1c7d4d,'style':_0x1631('0x1c')};},'defaultStyle':{'font':_0x1631('0x1d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1631('0x1e')},'footer':{'alignment':_0x1631('0x1f'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x26184f){var _0x22c2d9=0x1388;var _0x2b9160;if(!_0x26184f[0x0][_0x1631('0x20')]){return analyticExtractedReport(_0x1631('0x21'));}return db[_0x1631('0x22')][_0x1631('0x23')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1631('0x24'),_0x1631('0x25')]})[_0x1631('0x26')](function(_0x24fdc2){if(_0x24fdc2){_0x2b9160=_0x24fdc2;_0x22c2d9=_0x2b9160[_0x1631('0x25')]||0x3e8;}})[_0x1631('0x26')](function(){var _0x1b448a=[];var _0xffd069=0x0;if(_0x2b9160['split']){if(_0x26184f&&_0x26184f['length']){var _0x13c2e6=_[_0x1631('0x27')](_0x26184f[0x0][_0x1631('0x20')]/_0x22c2d9);var _0x155068=Number[_0x1631('0x28')](_0x26184f[0x0]['num']/_0x22c2d9)?_0x26184f[0x0][_0x1631('0x20')]%_0x22c2d9:0x0;_0x13c2e6[_0x1631('0x29')](function(_0x5d0eb6){if(_0x5d0eb6>0x0){_0xffd069+=_0x22c2d9;}_0x1b448a['push'](dbH['sequelize'][_0x1631('0x2a')](util[_0x1631('0x16')](_0x1631('0x2b'),QUERY,_0x22c2d9,_0xffd069),{'type':dbH['sequelize'][_0x1631('0x2c')][_0x1631('0x2d')]}));});if(_0x155068>0x0){_0xffd069+=_0x22c2d9;_0x1b448a[_0x1631('0x12')](dbH['sequelize']['query'](util[_0x1631('0x16')](_0x1631('0x2b'),QUERY,_0x155068,_0xffd069),{'type':dbH[_0x1631('0x2e')][_0x1631('0x2c')][_0x1631('0x2d')]}));}}}else{_0x1b448a[_0x1631('0x12')](dbH[_0x1631('0x2e')]['query'](QUERY,{'type':dbH['sequelize'][_0x1631('0x2c')]['SELECT']}));}var _0x10e99e=path[_0x1631('0x2f')](PATH);var _0x1ccb52=path['basename'](PATH,_0x1631('0x30'));var _0x298c8d=_0x2b9160[_0x1631('0x24')]&&_0x1b448a['length']>0x1;var _0x422430=[];if(!fs['existsSync'](path['join'](_0x10e99e,_0x1ccb52))&&_0x298c8d){fs[_0x1631('0x31')](path[_0x1631('0x32')](_0x10e99e,_0x1ccb52));}return BPromise[_0x1631('0x33')](_0x1b448a,function(_0x8df179){_0x422430[_0x1631('0x12')](_0x8df179);})[_0x1631('0x26')](function(){var _0xbac023=[];for(var _0x1e4047=0x0;_0x1e4047<_0x422430[_0x1631('0xf')];_0x1e4047+=0x1){var _0x53e211=_0x422430[_0x1e4047];var _0x70aef2=createTables(_[_0x1631('0x34')](_0x53e211));var _0x4b5f44;var _0x3d121d=getPDFDocDefinition(_0x70aef2);var _0x586758=getPDFPrinter();var _0x3bc8aa=_0x586758[_0x1631('0x35')](_0x3d121d);if(_0x298c8d){_0x4b5f44=path[_0x1631('0x32')](_0x10e99e,_0x1ccb52,util[_0x1631('0x16')]('%s%d.%s',_0x1ccb52,_0x1e4047,'pdf'));}else{_0x4b5f44=path[_0x1631('0x32')](_0x10e99e,util['format']('%s.%s',_0x1ccb52,'pdf'));}_0xbac023[_0x1631('0x12')](writePDFDocument(_0x3bc8aa,_0x4b5f44));}return Promise['all'](_0xbac023);})[_0x1631('0x26')](function(){if(_0x298c8d){return new Promise(function(_0x767b64){zipdir(path[_0x1631('0x32')](_0x10e99e,_0x1ccb52),{'saveTo':path[_0x1631('0x32')](_0x10e99e,util[_0x1631('0x16')](_0x1631('0x36'),_0x1ccb52,_0x1631('0x37')))},function(){rimraf(path[_0x1631('0x32')](_0x10e99e,_0x1ccb52),function(){});_0x767b64(_0x1631('0x38'));});});}})['then'](function(){if(!_0x298c8d)return;rimraf(path[_0x1631('0x32')](_0x10e99e,_0x1ccb52),function(){});})[_0x1631('0x26')](function(){logger[_0x1631('0x39')](util[_0x1631('0x16')](_0x1631('0x3a'),EXTRACTED_REPORT_ID,_0x1631('0x3b')));return analyticExtractedReport(_0x1631('0x3c'),_0x298c8d?util[_0x1631('0x16')](_0x1631('0x36'),_0x1ccb52,_0x298c8d?_0x1631('0x37'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1631('0x39')](util[_0x1631('0x16')](_0x1631('0x3d'),EXTRACTED_REPORT_ID,_0x1631('0x3b')));return db[_0x1631('0x9')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1631('0x26')](function(_0x575c97){EXTRACTED_REPORT=_0x575c97;return dbH[_0x1631('0x2e')]['query'](util[_0x1631('0x16')](_0x1631('0x3e'),QUERY),{'type':dbH[_0x1631('0x2e')]['QueryTypes']['SELECT']});})[_0x1631('0x26')](extractReport)['catch'](function(_0x26829f){logger[_0x1631('0x39')](util[_0x1631('0x16')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x1631('0x3f')](_0x26829f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1631('0x40'));})[_0x1631('0x41')](function(){process[_0x1631('0x42')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x24a795=new PdfPrinter({'Arial':{'normal':__dirname+_0x1631('0x43'),'bold':__dirname+_0x1631('0x44'),'italics':__dirname+_0x1631('0x45'),'bolditalics':__dirname+_0x1631('0x46')}});return _0x24a795;}function getPDFDocDefinitionFromHTML(_0x494fc4,_0x409d92){var _0x239ec9=util['format'](_0x1631('0x47'),_0x409d92[_0x1631('0x48')],_0x409d92[_0x1631('0x49')]);var _0x33041f=moment()['format'](_0x1631('0x4a'))[_0x1631('0xd')]();var _0x4651bf=htmlToPdfmake(_0x494fc4,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4651bf],'defaultStyle':{'font':_0x1631('0x1d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1631('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1631('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1631('0x4b')}},'header':function(){return[{'text':_0x1631('0x4c'),'style':'header'}];},'footer':function(_0x40d096,_0x41c64b){return[{'text':util[_0x1631('0x16')](_0x1631('0x4d'),_0x239ec9,_0x40d096,_0x41c64b,_0x33041f),'style':_0x1631('0x1c')}];}};}function writePDFDocument(_0x4217db,_0x472944){return new Promise(function(_0x58a260,_0x593bd9){var _0x27079d=_0x4217db[_0x1631('0x4e')](fs[_0x1631('0x4f')](_0x472944));_0x27079d['on'](_0x1631('0x50'),function(){_0x58a260(_0x1631('0x50'));});_0x27079d['on'](_0x1631('0x51'),function(_0x57499f){_0x593bd9(_0x57499f);});_0x4217db[_0x1631('0x52')]();});}exports[_0x1631('0x53')]=function(_0xa833e8,_0x52809a){var _0x3f238b=getPDFPrinter();var _0x311e39=getPDFDocDefinitionFromHTML(_0xa833e8,_0x52809a);var _0x565e50=_0x3f238b[_0x1631('0x35')](_0x311e39);return writePDFDocument(_0x565e50,_0x52809a[_0x1631('0x54')])[_0x1631('0x55')](function(_0x7ee6b3){throw _0x7ee6b3;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 22073a6..5d7b303 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 _0x4e19=['join','mkdirSync','each','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync'];(function(_0x5f275e,_0x101a04){var _0x3d759a=function(_0x3f9da2){while(--_0x3f9da2){_0x5f275e['push'](_0x5f275e['shift']());}};_0x3d759a(++_0x101a04);}(_0x4e19,0xc2));var _0x94e1=function(_0x15497f,_0x15ecb3){_0x15497f=_0x15497f-0x0;var _0x3dff4e=_0x4e19[_0x15497f];return _0x3dff4e;};'use strict';var util=require(_0x94e1('0x0'));var path=require('path');var _=require(_0x94e1('0x1'));var fs=require('fs');var json2xls=require(_0x94e1('0x2'));var BPromise=require(_0x94e1('0x3'));var zipdir=require(_0x94e1('0x4'));var rimraf=require('rimraf');var db=require(_0x94e1('0x5'))['db'];var dbH=require(_0x94e1('0x5'))[_0x94e1('0x6')];var logger=require(_0x94e1('0x7'))(_0x94e1('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x94e1('0x9')][0x2]);var QUERY=process[_0x94e1('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x74f07f,_0x14458d){var _0x3bf47e={'status':_0x74f07f};var _0x13796e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x14458d){_0x3bf47e[_0x94e1('0xa')]=_0x14458d;}return db[_0x94e1('0xb')][_0x94e1('0xc')](_0x3bf47e,_0x13796e);}function main(){var _0x344af1=0x1388;var _0x3d8373;logger[_0x94e1('0xd')](util[_0x94e1('0xe')](_0x94e1('0xf'),EXTRACTED_REPORT_ID,_0x94e1('0x10')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x94e1('0x11'),_0x94e1('0x12')]})[_0x94e1('0x13')](function(_0x11bd27){if(_0x11bd27){_0x3d8373=_0x11bd27;_0x344af1=_0x3d8373[_0x94e1('0x12')]||0x1388;}})[_0x94e1('0x13')](function(){return dbH[_0x94e1('0x14')][_0x94e1('0x15')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x94e1('0x14')][_0x94e1('0x16')][_0x94e1('0x17')]});})['then'](function(_0xbb4bf1){if(!_0xbb4bf1[0x0][_0x94e1('0x18')]){return analyticExtractedReport('Empty');}var _0x32bc3d=[];var _0x1192d7=0x0;if(_0x3d8373[_0x94e1('0x11')]){if(_0xbb4bf1&&_0xbb4bf1[_0x94e1('0x19')]){var _0x255f35=_['range'](_0xbb4bf1[0x0][_0x94e1('0x18')]/_0x344af1);var _0x49f144=Number['isInteger'](_0xbb4bf1[0x0][_0x94e1('0x18')]/_0x344af1)?_0xbb4bf1[0x0][_0x94e1('0x18')]%_0x344af1:0x0;_0x255f35['forEach'](function(_0x16c1e5){if(_0x16c1e5>0x0){_0x1192d7+=_0x344af1;}_0x32bc3d[_0x94e1('0x1a')](dbH[_0x94e1('0x14')][_0x94e1('0x15')](util['format'](_0x94e1('0x1b'),QUERY,_0x344af1,_0x1192d7),{'type':dbH[_0x94e1('0x14')][_0x94e1('0x16')][_0x94e1('0x17')]}));});if(_0x49f144>0x0){_0x1192d7+=_0x344af1;_0x32bc3d[_0x94e1('0x1a')](dbH[_0x94e1('0x14')][_0x94e1('0x15')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x49f144,_0x1192d7),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x32bc3d['push'](dbH[_0x94e1('0x14')][_0x94e1('0x15')](QUERY,{'type':dbH[_0x94e1('0x14')]['QueryTypes']['SELECT']}));}var _0xb2b020=path[_0x94e1('0x1c')](PATH);var _0x3b56ef=path['basename'](PATH,_0x94e1('0x1d'));var _0x4928c7=_0x3d8373[_0x94e1('0x11')]&&_0x32bc3d[_0x94e1('0x19')]>0x1;var _0x39caad=[];if(!fs[_0x94e1('0x1e')](path[_0x94e1('0x1f')](_0xb2b020,_0x3b56ef))&&_0x4928c7){fs[_0x94e1('0x20')](path[_0x94e1('0x1f')](_0xb2b020,_0x3b56ef));}return BPromise[_0x94e1('0x21')](_0x32bc3d,function(_0x54a3ff){_0x39caad[_0x94e1('0x1a')](_0x54a3ff);})['then'](function(){for(var _0x19fca3=0x0;_0x19fca3<_0x39caad[_0x94e1('0x19')];_0x19fca3+=0x1){var _0x4b051;var _0x5d48ee=_0x39caad[_0x19fca3];if(_0x4928c7){_0x4b051=path['join'](_0xb2b020,_0x3b56ef,util[_0x94e1('0xe')]('%s%d.%s',_0x3b56ef,_0x19fca3,_0x94e1('0x22')));}else{_0x4b051=path['join'](_0xb2b020,util[_0x94e1('0xe')](_0x94e1('0x23'),_0x3b56ef,_0x94e1('0x22')));}fs[_0x94e1('0x24')](_0x4b051,json2xls(_0x5d48ee),_0x94e1('0x25'));}})[_0x94e1('0x13')](function(){if(_0x4928c7){return new Promise(function(_0x405696){zipdir(path[_0x94e1('0x1f')](_0xb2b020,_0x3b56ef),{'saveTo':path['join'](_0xb2b020,util[_0x94e1('0xe')](_0x94e1('0x23'),_0x3b56ef,_0x94e1('0x26')))},function(_0x2075bf,_0x43b659){rimraf(path[_0x94e1('0x1f')](_0xb2b020,_0x3b56ef),function(){});_0x405696(_0x94e1('0x27'));});});}})['then'](function(){logger[_0x94e1('0xd')](util[_0x94e1('0xe')](_0x94e1('0x28'),EXTRACTED_REPORT_ID,_0x94e1('0x10')));return analyticExtractedReport('Completed',_0x4928c7?util[_0x94e1('0xe')](_0x94e1('0x23'),_0x3b56ef,_0x4928c7?_0x94e1('0x26'):_0x94e1('0x22')):null);});})[_0x94e1('0x29')](function(_0x4e81f4){logger[_0x94e1('0xd')](util[_0x94e1('0xe')](_0x94e1('0x2a'),EXTRACTED_REPORT_ID,_0x94e1('0x10')),util[_0x94e1('0x2b')](_0x4e81f4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x94e1('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x33b4=['splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','Empty','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','xlsx','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split'];(function(_0x11ec6a,_0x6b9437){var _0x26cec7=function(_0x13f693){while(--_0x13f693){_0x11ec6a['push'](_0x11ec6a['shift']());}};_0x26cec7(++_0x6b9437);}(_0x33b4,0x160));var _0x433b=function(_0xe4c71c,_0x39209f){_0xe4c71c=_0xe4c71c-0x0;var _0x53292d=_0x33b4[_0xe4c71c];return _0x53292d;};'use strict';var util=require('util');var path=require(_0x433b('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x433b('0x1'));var BPromise=require(_0x433b('0x2'));var zipdir=require(_0x433b('0x3'));var rimraf=require(_0x433b('0x4'));var db=require(_0x433b('0x5'))['db'];var dbH=require(_0x433b('0x5'))[_0x433b('0x6')];var logger=require(_0x433b('0x7'))(_0x433b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x433b('0x9')][0x2]);var QUERY=process[_0x433b('0x9')][0x3];var PATH=process[_0x433b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5dac86,_0x361a53){var _0x309e90={'status':_0x5dac86};var _0x4dcf82={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x361a53){_0x309e90[_0x433b('0xa')]=_0x361a53;}return db['AnalyticExtractedReport'][_0x433b('0xb')](_0x309e90,_0x4dcf82);}function main(){var _0x21d44f=0x1388;var _0x27c704;logger[_0x433b('0xc')](util[_0x433b('0xd')](_0x433b('0xe'),EXTRACTED_REPORT_ID,_0x433b('0xf')));return db[_0x433b('0x10')][_0x433b('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x433b('0x12'),_0x433b('0x13')]})['then'](function(_0x21ef19){if(_0x21ef19){_0x27c704=_0x21ef19;_0x21d44f=_0x27c704[_0x433b('0x13')]||0x1388;}})['then'](function(){return dbH[_0x433b('0x14')][_0x433b('0x15')](util[_0x433b('0xd')](_0x433b('0x16'),QUERY),{'type':dbH[_0x433b('0x14')][_0x433b('0x17')][_0x433b('0x18')]});})[_0x433b('0x19')](function(_0x459af6){if(!_0x459af6[0x0]['num']){return analyticExtractedReport(_0x433b('0x1a'));}var _0xb5e593=[];var _0x1b4af4=0x0;if(_0x27c704['split']){if(_0x459af6&&_0x459af6[_0x433b('0x1b')]){var _0x15e943=_[_0x433b('0x1c')](_0x459af6[0x0][_0x433b('0x1d')]/_0x21d44f);var _0x261ad7=Number[_0x433b('0x1e')](_0x459af6[0x0][_0x433b('0x1d')]/_0x21d44f)?_0x459af6[0x0]['num']%_0x21d44f:0x0;_0x15e943[_0x433b('0x1f')](function(_0x3b41a3){if(_0x3b41a3>0x0){_0x1b4af4+=_0x21d44f;}_0xb5e593[_0x433b('0x20')](dbH[_0x433b('0x14')][_0x433b('0x15')](util[_0x433b('0xd')](_0x433b('0x21'),QUERY,_0x21d44f,_0x1b4af4),{'type':dbH[_0x433b('0x14')][_0x433b('0x17')][_0x433b('0x18')]}));});if(_0x261ad7>0x0){_0x1b4af4+=_0x21d44f;_0xb5e593[_0x433b('0x20')](dbH[_0x433b('0x14')][_0x433b('0x15')](util[_0x433b('0xd')](_0x433b('0x21'),QUERY,_0x261ad7,_0x1b4af4),{'type':dbH[_0x433b('0x14')][_0x433b('0x17')][_0x433b('0x18')]}));}}}else{_0xb5e593[_0x433b('0x20')](dbH[_0x433b('0x14')][_0x433b('0x15')](QUERY,{'type':dbH[_0x433b('0x14')][_0x433b('0x17')][_0x433b('0x18')]}));}var _0x14d1a2=path['dirname'](PATH);var _0x3d50cf=path[_0x433b('0x22')](PATH,_0x433b('0x23'));var _0x319cd1=_0x27c704[_0x433b('0x12')]&&_0xb5e593[_0x433b('0x1b')]>0x1;var _0x555a51=[];if(!fs[_0x433b('0x24')](path[_0x433b('0x25')](_0x14d1a2,_0x3d50cf))&&_0x319cd1){fs[_0x433b('0x26')](path['join'](_0x14d1a2,_0x3d50cf));}return BPromise[_0x433b('0x27')](_0xb5e593,function(_0x599d5f){_0x555a51[_0x433b('0x20')](_0x599d5f);})[_0x433b('0x19')](function(){for(var _0x10efc3=0x0;_0x10efc3<_0x555a51['length'];_0x10efc3+=0x1){var _0x50cc8b;var _0x2da3ca=_0x555a51[_0x10efc3];if(_0x319cd1){_0x50cc8b=path[_0x433b('0x25')](_0x14d1a2,_0x3d50cf,util['format'](_0x433b('0x28'),_0x3d50cf,_0x10efc3,'xlsx'));}else{_0x50cc8b=path[_0x433b('0x25')](_0x14d1a2,util[_0x433b('0xd')](_0x433b('0x29'),_0x3d50cf,'xlsx'));}fs[_0x433b('0x2a')](_0x50cc8b,json2xls(_0x2da3ca),_0x433b('0x2b'));}})[_0x433b('0x19')](function(){if(_0x319cd1){return new Promise(function(_0x3dc807){zipdir(path['join'](_0x14d1a2,_0x3d50cf),{'saveTo':path['join'](_0x14d1a2,util[_0x433b('0xd')](_0x433b('0x29'),_0x3d50cf,_0x433b('0x2c')))},function(_0x2575d1,_0x3f0651){rimraf(path[_0x433b('0x25')](_0x14d1a2,_0x3d50cf),function(){});_0x3dc807(_0x433b('0x2d'));});});}})[_0x433b('0x19')](function(){logger[_0x433b('0xc')](util['format'](_0x433b('0x2e'),EXTRACTED_REPORT_ID,_0x433b('0xf')));return analyticExtractedReport('Completed',_0x319cd1?util[_0x433b('0xd')](_0x433b('0x29'),_0x3d50cf,_0x319cd1?_0x433b('0x2c'):_0x433b('0x2f')):null);});})[_0x433b('0x30')](function(_0x1359e9){logger['info'](util[_0x433b('0xd')](_0x433b('0x31'),EXTRACTED_REPORT_ID,_0x433b('0xf')),util[_0x433b('0x32')](_0x1359e9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x433b('0x33'));})[_0x433b('0x34')](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 a5fdc47..e29462a 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 _0x1bb4=['map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','playback','hasOwnProperty','extensions','find','push','type','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','Set','CDR(routeid)=','extension','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','then','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','VoiceExtension','IntervalId'];(function(_0x3382e1,_0x1b69ee){var _0x166bd5=function(_0x548a6d){while(--_0x548a6d){_0x3382e1['push'](_0x3382e1['shift']());}};_0x166bd5(++_0x1b69ee);}(_0x1bb4,0x11d));var _0x41bb=function(_0x121228,_0x29c3a6){_0x121228=_0x121228-0x0;var _0x47a49a=_0x1bb4[_0x121228];return _0x47a49a;};'use strict';var _=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));function rewrite(_0x3db127,_0x3fa52f){var _0x1bb934=this;return _0x3db127[_0x41bb('0x2')][_0x41bb('0x3')][_0x41bb('0x4')]({'raw':!![]})['then'](function(_0x205a2d){_0x1bb934['intervals']=_0x205a2d;return _0x3db127[_0x41bb('0x2')][_0x41bb('0x5')][_0x41bb('0x4')]({'where':{'IntervalId':_0x3fa52f[_0x41bb('0x6')]},'raw':!![]});})['then'](function(_0x185dc4){return _0x3db127[_0x41bb('0x2')][_0x41bb('0x5')][_0x41bb('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x41bb('0x7')](_0x185dc4,'exten'))}},'order':[{'raw':_0x41bb('0x8')}],'raw':!![]});})['then'](function(_0xd0c89c){var _0x291392=_[_0x41bb('0x9')](_0xd0c89c,{'priority':'1'});var _0x1bdedb=_[_0x41bb('0x9')](_0xd0c89c,{'isApp':0x1});var _0x3e2ab4=_[_0x41bb('0xa')](_0x1bdedb,_0x41bb('0xb'));var _0x10d894=['queue',_0x41bb('0xc')];var _0x4cebf8=[];var _0x120168=[];for(var _0x3526d0 in _0x3e2ab4){if(_0x3e2ab4[_0x41bb('0xd')](_0x3526d0)){_0x1bb934['priority']=0x2;_0x1bb934[_0x41bb('0xe')]=[];_0x1bb934['extension']=_[_0x41bb('0xf')](_0x291392,{'exten':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0xb')]});_0x1bb934['extensions'][_0x41bb('0x10')]({'type':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')],'app':'Set','appdata':util[_0x41bb('0x12')](_0x41bb('0x13'),_0x3e2ab4[_0x3526d0][0x0]['type']),'context':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x14')],'exten':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0xb')],'priority':_0x1bb934[_0x41bb('0x15')]++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});if(_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')]===_0x41bb('0x17')){_0x1bb934[_0x41bb('0xe')]['push']({'type':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')],'app':_0x41bb('0x18'),'appdata':_0x41bb('0x19')+_0x3e2ab4[_0x3526d0][0x0]['VoiceExtensionId'],'context':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x14')],'exten':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0xb')],'priority':_0x1bb934[_0x41bb('0x15')]++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});}else if(_0x3e2ab4[_0x3526d0][0x0]['type']==='outbound'){if(_0x1bb934[_0x41bb('0x1a')]){_0x1bb934[_0x41bb('0xe')][_0x41bb('0x10')]({'type':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')],'app':_0x41bb('0x18'),'appdata':_0x41bb('0x1b')+(_0x1bb934[_0x41bb('0x1a')]['cutdigits']?_0x41bb('0x1c')+_0x1bb934['extension'][_0x41bb('0x1d')]+'}':_0x41bb('0x1e')),'context':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x14')],'exten':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0xb')],'priority':_0x1bb934[_0x41bb('0x15')]++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});}_0x1bb934['extensions']['push']({'type':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')],'app':_0x41bb('0x18'),'appdata':_0x41bb('0x19')+_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')],'context':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x14')],'exten':_0x3e2ab4[_0x3526d0][0x0]['exten'],'priority':_0x1bb934['priority']++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});var _0x59a0fb=_0x1bb934[_0x41bb('0x15')]++;_0x1bb934[_0x41bb('0xe')][_0x41bb('0x10')]({'type':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')],'app':_0x41bb('0x1f'),'appdata':_0x41bb('0x20')+(_0x59a0fb+0x2)+_0x41bb('0x21')+(_0x59a0fb+0x1)+')','context':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x14')],'exten':_0x3e2ab4[_0x3526d0][0x0]['exten'],'priority':_0x59a0fb,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});if(_0x1bb934[_0x41bb('0x1a')]){_0x1bb934[_0x41bb('0xe')][_0x41bb('0x10')]({'type':_0x3e2ab4[_0x3526d0][0x0]['type'],'app':_0x41bb('0x18'),'appdata':_0x1bb934[_0x41bb('0x1a')]['cutdigits']?_0x41bb('0x22')+_0x1bb934[_0x41bb('0x1a')]['cutdigits']+'}':_0x41bb('0x23'),'context':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x14')],'exten':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0xb')],'priority':_0x1bb934[_0x41bb('0x15')]++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0]['VoiceExtensionId']});}_0x1bb934[_0x41bb('0xe')][_0x41bb('0x10')]({'type':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')],'app':_0x41bb('0x18'),'appdata':_0x41bb('0x24')+_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')],'context':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x14')],'exten':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0xb')],'priority':_0x1bb934[_0x41bb('0x15')]++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});if(_0x1bb934['extension']&&_0x1bb934[_0x41bb('0x1a')][_0x41bb('0xd')](_0x41bb('0x25'))&&_0x1bb934[_0x41bb('0x1a')][_0x41bb('0x25')]!==_0x41bb('0x26')){_0x1bb934[_0x41bb('0xe')]['push']({'type':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')],'app':_0x41bb('0x18'),'appdata':_0x41bb('0x27'),'context':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x14')],'exten':_0x3e2ab4[_0x3526d0][0x0]['exten'],'priority':_0x1bb934['priority']++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});_0x1bb934[_0x41bb('0xe')][_0x41bb('0x10')]({'type':_0x3e2ab4[_0x3526d0][0x0]['type'],'app':_0x41bb('0x18'),'appdata':_0x41bb('0x28')+_0x1bb934[_0x41bb('0x1a')][_0x41bb('0x25')]||_0x41bb('0x29'),'context':_0x3e2ab4[_0x3526d0][0x0]['context'],'exten':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0xb')],'priority':_0x1bb934[_0x41bb('0x15')]++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});}}_0x1bb934['extensions'][_0x41bb('0x10')]({'type':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3e2ab4[_0x3526d0][0x0]['context'],'exten':_0x3e2ab4[_0x3526d0][0x0]['exten'],'priority':_0x1bb934[_0x41bb('0x15')]++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});_0x1bb934[_0x41bb('0xe')]['push']({'type':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')],'app':_0x41bb('0x18'),'appdata':_0x41bb('0x2a'),'context':_0x3e2ab4[_0x3526d0][0x0]['context'],'exten':_0x3e2ab4[_0x3526d0][0x0]['exten'],'priority':_0x1bb934[_0x41bb('0x15')]++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});_0x1bb934[_0x41bb('0xe')][_0x41bb('0x10')]({'type':_0x3e2ab4[_0x3526d0][0x0]['type'],'app':_0x41bb('0x18'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x14')],'exten':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0xb')],'priority':_0x1bb934[_0x41bb('0x15')]++,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0]['VoiceExtensionId']});for(var _0x2410fa=0x0,_0x34bb0d=0x0;_0x2410fa<_0x3e2ab4[_0x3526d0][_0x41bb('0x2b')];_0x2410fa+=0x1,_0x34bb0d=0x0){var _0x8e200d=_0x3e2ab4[_0x3526d0][_0x2410fa];if(_0x8e200d[_0x41bb('0x11')]){_0x8e200d['type']=_0x8e200d[_0x41bb('0x11')][_0x41bb('0x2c')]();}var _0x50e6c9=[];var _0x18aeeb=[];delete _0x8e200d['id'];delete _0x8e200d[_0x41bb('0x2d')];delete _0x8e200d[_0x41bb('0x2e')];var _0x4e1a73=_0x8e200d[_0x41bb('0x2f')]!==_0x41bb('0x30')?[_0x8e200d[_0x41bb('0x2f')]]:_0x8e200d[_0x41bb('0x6')]?_[_0x41bb('0x7')](_[_0x41bb('0x9')](_0x1bb934[_0x41bb('0x31')],{'IntervalId':_0x8e200d[_0x41bb('0x6')]}),'interval'):[];if(_0x8e200d['hasOwnProperty'](_0x41bb('0x32'))){if(_0x8e200d['tag']&&_0x8e200d[_0x41bb('0x32')]!=='--'){_0x50e6c9[_0x41bb('0x10')]({'type':_0x8e200d[_0x41bb('0x11')],'app':_0x41bb('0x18'),'appdata':'CDR(tag)='+_0x8e200d[_0x41bb('0x32')],'context':_0x8e200d[_0x41bb('0x14')],'exten':_0x8e200d[_0x41bb('0xb')],'priority':_0x4e1a73[_0x41bb('0x2b')]+_0x1bb934[_0x41bb('0x15')]+_0x34bb0d++,'VoiceExtensionId':_0x8e200d[_0x41bb('0x16')]});}}if(_0x8e200d[_0x41bb('0x11')]===_0x41bb('0x33')&&_0x8e200d['hasOwnProperty'](_0x41bb('0x34'))){if(_0x8e200d[_0x41bb('0x34')]){_0x50e6c9[_0x41bb('0x10')]({'type':_0x8e200d[_0x41bb('0x11')],'app':_0x41bb('0x1f'),'appdata':_0x41bb('0x35')+_0x8e200d['callerID']+')','context':_0x8e200d[_0x41bb('0x14')],'exten':_0x8e200d['exten'],'priority':_0x4e1a73[_0x41bb('0x2b')]+_0x1bb934[_0x41bb('0x15')]+_0x34bb0d++,'VoiceExtensionId':_0x8e200d[_0x41bb('0x16')]});}else{_0x50e6c9['push']({'type':_0x8e200d[_0x41bb('0x11')],'app':_0x41bb('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x8e200d[_0x41bb('0x14')],'exten':_0x8e200d[_0x41bb('0xb')],'priority':_0x4e1a73[_0x41bb('0x2b')]+_0x1bb934[_0x41bb('0x15')]+_0x34bb0d++,'VoiceExtensionId':_0x8e200d[_0x41bb('0x16')]});}}if(_0x8e200d[_0x41bb('0xd')](_0x41bb('0x36'))){if(_0x10d894[_0x41bb('0x37')](_0x8e200d[_0x41bb('0x38')][_0x41bb('0x2c')]())>=0x0&&_0x8e200d[_0x41bb('0x39')]!==_0x41bb('0x3a')){if(_0x8e200d[_0x41bb('0x36')]){_0x50e6c9[_0x41bb('0x10')]({'type':_0x8e200d['type'],'app':_0x41bb('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x8e200d[_0x41bb('0x14')],'exten':_0x8e200d[_0x41bb('0xb')],'priority':_0x4e1a73[_0x41bb('0x2b')]+_0x1bb934['priority']+_0x34bb0d++,'VoiceExtensionId':_0x8e200d[_0x41bb('0x16')]});_0x50e6c9[_0x41bb('0x10')]({'type':_0x8e200d[_0x41bb('0x11')],'app':_0x41bb('0x18'),'appdata':_0x41bb('0x3b'),'context':_0x8e200d[_0x41bb('0x14')],'exten':_0x8e200d[_0x41bb('0xb')],'priority':_0x4e1a73[_0x41bb('0x2b')]+_0x1bb934[_0x41bb('0x15')]+_0x34bb0d++,'VoiceExtensionId':_0x8e200d[_0x41bb('0x16')]});}else{_0x50e6c9[_0x41bb('0x10')]({'type':_0x8e200d[_0x41bb('0x11')],'app':_0x41bb('0x1f'),'appdata':_0x41bb('0x3c'),'context':_0x8e200d['context'],'exten':_0x8e200d[_0x41bb('0xb')],'priority':_0x4e1a73[_0x41bb('0x2b')]+_0x1bb934[_0x41bb('0x15')]+_0x34bb0d++,'VoiceExtensionId':_0x8e200d['VoiceExtensionId']});_0x50e6c9['push']({'type':_0x8e200d['type'],'app':_0x41bb('0x18'),'appdata':_0x41bb('0x3d'),'context':_0x8e200d[_0x41bb('0x14')],'exten':_0x8e200d[_0x41bb('0xb')],'priority':_0x4e1a73[_0x41bb('0x2b')]+_0x1bb934[_0x41bb('0x15')]+_0x34bb0d++,'VoiceExtensionId':_0x8e200d['VoiceExtensionId']});}}}for(var _0x3a570a=0x0;_0x3a570a<_0x4e1a73[_0x41bb('0x2b')];_0x3a570a+=0x1){var _0x5ad0e9=_0x1bb934[_0x41bb('0x15')]+_0x4e1a73[_0x41bb('0x2b')];var _0x4bcee6=_0x3a570a===_0x4e1a73[_0x41bb('0x2b')]-0x1?_0x1bb934['priority']+_0x50e6c9['length']+_0x18aeeb[_0x41bb('0x2b')]+0x2:_0x1bb934[_0x41bb('0x15')]+_0x3a570a+0x1;_0x50e6c9[_0x41bb('0x3e')](_0x3a570a,0x0,{'type':_0x8e200d[_0x41bb('0x11')],'app':_0x41bb('0x3f'),'appdata':_0x4e1a73[_0x3a570a]+'?'+_0x8e200d[_0x41bb('0x14')]+_0x41bb('0x40')+_0x5ad0e9+':'+_0x8e200d[_0x41bb('0x14')]+_0x41bb('0x40')+_0x4bcee6,'exten':_0x8e200d['exten'],'context':_0x8e200d[_0x41bb('0x14')],'priority':_0x1bb934['priority']+_0x3a570a,'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0]['VoiceExtensionId']});}_0x8e200d[_0x41bb('0x15')]=_0x50e6c9['length']?_['last'](_0x50e6c9)[_0x41bb('0x15')]+0x1:_0x1bb934[_0x41bb('0x15')];_0x1bb934[_0x41bb('0x15')]=(_0x18aeeb[_0x41bb('0x2b')]?_[_0x41bb('0x41')](_0x18aeeb)[_0x41bb('0x15')]:_0x8e200d[_0x41bb('0x15')])+0x1;_0x1bb934['extensions']=_['concat'](_0x1bb934['extensions'],_0x50e6c9,[_0x8e200d],_0x18aeeb);}_0x1bb934[_0x41bb('0xe')][_0x41bb('0x10')]({'type':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x11')],'app':_0x41bb('0x42'),'exten':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0xb')],'context':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x14')],'priority':_0x1bb934[_0x41bb('0x15')],'VoiceExtensionId':_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]});_0x4cebf8[_0x41bb('0x10')](_0x3e2ab4[_0x3526d0][0x0][_0x41bb('0x16')]);_0x120168=_[_0x41bb('0x43')](_0x120168,_0x1bb934[_0x41bb('0xe')]);}}return _0x3db127[_0x41bb('0x44')](function(_0x485aea){return _0x3db127[_0x41bb('0x2')][_0x41bb('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x4cebf8}},'transaction':_0x485aea})[_0x41bb('0x45')](function(_0x229f60){return _0x3db127[_0x41bb('0x2')][_0x41bb('0x5')]['bulkCreate'](_[_0x41bb('0x46')](_0x120168,_0x41bb('0x15')),{'transaction':_0x485aea});});});})[_0x41bb('0x47')](function(_0x421aa2){console['error'](_0x421aa2);});}exports[_0x41bb('0x48')]=rewrite; \ No newline at end of file +var _0xf748=['answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','lodash','models','Interval','then','intervals','findAll','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','playback','hasOwnProperty','priority','find','push','Set','format','type','context','inbound','extensions','CDR(routeid)=','VoiceExtensionId','extension','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','CDR(tag)=','tag','outbound','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)'];(function(_0x39b8a0,_0x577744){var _0x4832b5=function(_0x53a6eb){while(--_0x53a6eb){_0x39b8a0['push'](_0x39b8a0['shift']());}};_0x4832b5(++_0x577744);}(_0xf748,0x175));var _0x8f74=function(_0x5b8d02,_0x5c7aef){_0x5b8d02=_0x5b8d02-0x0;var _0x1cf81a=_0xf748[_0x5b8d02];return _0x1cf81a;};'use strict';var _=require(_0x8f74('0x0'));var util=require('util');function rewrite(_0x219acd,_0x4e25a1){var _0x8221d7=this;return _0x219acd[_0x8f74('0x1')][_0x8f74('0x2')]['findAll']({'raw':!![]})[_0x8f74('0x3')](function(_0x132ff4){_0x8221d7[_0x8f74('0x4')]=_0x132ff4;return _0x219acd[_0x8f74('0x1')]['VoiceExtension'][_0x8f74('0x5')]({'where':{'IntervalId':_0x4e25a1['IntervalId']},'raw':!![]});})[_0x8f74('0x3')](function(_0x540905){return _0x219acd['models'][_0x8f74('0x6')][_0x8f74('0x5')]({'where':{'exten':{'$in':_[_0x8f74('0x7')](_[_0x8f74('0x8')](_0x540905,'exten'))}},'order':[{'raw':_0x8f74('0x9')}],'raw':!![]});})['then'](function(_0x2efd20){var _0x24c7e3=_[_0x8f74('0xa')](_0x2efd20,{'priority':'1'});var _0x13e794=_[_0x8f74('0xa')](_0x2efd20,{'isApp':0x1});var _0x5a2c9c=_['groupBy'](_0x13e794,_0x8f74('0xb'));var _0x5864e2=['queue',_0x8f74('0xc')];var _0x519cb4=[];var _0x218219=[];for(var _0x405439 in _0x5a2c9c){if(_0x5a2c9c[_0x8f74('0xd')](_0x405439)){_0x8221d7[_0x8f74('0xe')]=0x2;_0x8221d7['extensions']=[];_0x8221d7['extension']=_[_0x8f74('0xf')](_0x24c7e3,{'exten':_0x5a2c9c[_0x405439][0x0]['exten']});_0x8221d7['extensions'][_0x8f74('0x10')]({'type':_0x5a2c9c[_0x405439][0x0]['type'],'app':_0x8f74('0x11'),'appdata':util[_0x8f74('0x12')]('CDR(type)=%s',_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')]),'context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x8221d7[_0x8f74('0xe')]++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0]['VoiceExtensionId']});if(_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')]===_0x8f74('0x15')){_0x8221d7[_0x8f74('0x16')][_0x8f74('0x10')]({'type':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')],'app':'Set','appdata':_0x8f74('0x17')+_0x5a2c9c[_0x405439][0x0]['VoiceExtensionId'],'context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x8221d7[_0x8f74('0xe')]++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});}else if(_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')]==='outbound'){if(_0x8221d7[_0x8f74('0x19')]){_0x8221d7['extensions']['push']({'type':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')],'app':'Set','appdata':'CDR(destination)='+(_0x8221d7[_0x8f74('0x19')][_0x8f74('0x1a')]?_0x8f74('0x1b')+_0x8221d7[_0x8f74('0x19')]['cutdigits']+'}':_0x8f74('0x1c')),'context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x8221d7[_0x8f74('0xe')]++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0]['VoiceExtensionId']});}_0x8221d7[_0x8f74('0x16')][_0x8f74('0x10')]({'type':_0x5a2c9c[_0x405439][0x0]['type'],'app':_0x8f74('0x11'),'appdata':_0x8f74('0x17')+_0x5a2c9c[_0x405439][0x0]['VoiceExtensionId'],'context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x8221d7[_0x8f74('0xe')]++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});var _0x253615=_0x8221d7[_0x8f74('0xe')]++;_0x8221d7[_0x8f74('0x16')]['push']({'type':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')],'app':'ExecIf','appdata':_0x8f74('0x1d')+(_0x253615+0x2)+'):Goto('+(_0x253615+0x1)+')','context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x253615,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});if(_0x8221d7[_0x8f74('0x19')]){_0x8221d7[_0x8f74('0x16')][_0x8f74('0x10')]({'type':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')],'app':_0x8f74('0x11'),'appdata':_0x8221d7[_0x8f74('0x19')][_0x8f74('0x1a')]?_0x8f74('0x1e')+_0x8221d7['extension']['cutdigits']+'}':_0x8f74('0x1f'),'context':_0x5a2c9c[_0x405439][0x0]['context'],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x8221d7[_0x8f74('0xe')]++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});}_0x8221d7['extensions']['push']({'type':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')],'app':_0x8f74('0x11'),'appdata':'outboundrouteid='+_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')],'context':_0x5a2c9c[_0x405439][0x0]['context'],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x8221d7[_0x8f74('0xe')]++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});if(_0x8221d7['extension']&&_0x8221d7['extension']['hasOwnProperty'](_0x8f74('0x20'))&&_0x8221d7[_0x8f74('0x19')][_0x8f74('0x20')]!==_0x8f74('0x21')){_0x8221d7['extensions']['push']({'type':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')],'app':_0x8f74('0x11'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x8221d7[_0x8f74('0xe')]++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});_0x8221d7[_0x8f74('0x16')][_0x8f74('0x10')]({'type':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')],'app':_0x8f74('0x11'),'appdata':_0x8f74('0x22')+_0x8221d7['extension']['recordingFormat']||_0x8f74('0x23'),'context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x8221d7[_0x8f74('0xe')]++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});}}_0x8221d7[_0x8f74('0x16')][_0x8f74('0x10')]({'type':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')],'app':_0x8f74('0x11'),'appdata':_0x8f74('0x24'),'context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x8221d7[_0x8f74('0xe')]++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});_0x8221d7[_0x8f74('0x16')][_0x8f74('0x10')]({'type':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')],'app':'Set','appdata':_0x8f74('0x25'),'context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'exten':_0x5a2c9c[_0x405439][0x0]['exten'],'priority':_0x8221d7['priority']++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});_0x8221d7['extensions'][_0x8f74('0x10')]({'type':_0x5a2c9c[_0x405439][0x0]['type'],'app':'Set','appdata':_0x8f74('0x26'),'context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'exten':_0x5a2c9c[_0x405439][0x0][_0x8f74('0xb')],'priority':_0x8221d7[_0x8f74('0xe')]++,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});for(var _0x4f07f7=0x0,_0x442b74=0x0;_0x4f07f7<_0x5a2c9c[_0x405439]['length'];_0x4f07f7+=0x1,_0x442b74=0x0){var _0x4a5a44=_0x5a2c9c[_0x405439][_0x4f07f7];if(_0x4a5a44[_0x8f74('0x13')]){_0x4a5a44['type']=_0x4a5a44[_0x8f74('0x13')][_0x8f74('0x27')]();}var _0x280ff2=[];var _0x537b8c=[];delete _0x4a5a44['id'];delete _0x4a5a44[_0x8f74('0x28')];delete _0x4a5a44[_0x8f74('0x29')];var _0x4a2d3d=_0x4a5a44[_0x8f74('0x2a')]!==_0x8f74('0x2b')?[_0x4a5a44[_0x8f74('0x2a')]]:_0x4a5a44[_0x8f74('0x2c')]?_['map'](_[_0x8f74('0xa')](_0x8221d7['intervals'],{'IntervalId':_0x4a5a44['IntervalId']}),'interval'):[];if(_0x4a5a44[_0x8f74('0xd')]('tag')){if(_0x4a5a44['tag']&&_0x4a5a44['tag']!=='--'){_0x280ff2[_0x8f74('0x10')]({'type':_0x4a5a44[_0x8f74('0x13')],'app':_0x8f74('0x11'),'appdata':_0x8f74('0x2d')+_0x4a5a44[_0x8f74('0x2e')],'context':_0x4a5a44[_0x8f74('0x14')],'exten':_0x4a5a44[_0x8f74('0xb')],'priority':_0x4a2d3d['length']+_0x8221d7['priority']+_0x442b74++,'VoiceExtensionId':_0x4a5a44[_0x8f74('0x18')]});}}if(_0x4a5a44[_0x8f74('0x13')]===_0x8f74('0x2f')&&_0x4a5a44[_0x8f74('0xd')]('callerID')){if(_0x4a5a44['callerID']){_0x280ff2[_0x8f74('0x10')]({'type':_0x4a5a44['type'],'app':_0x8f74('0x30'),'appdata':_0x8f74('0x31')+_0x4a5a44[_0x8f74('0x32')]+')','context':_0x4a5a44[_0x8f74('0x14')],'exten':_0x4a5a44[_0x8f74('0xb')],'priority':_0x4a2d3d[_0x8f74('0x33')]+_0x8221d7[_0x8f74('0xe')]+_0x442b74++,'VoiceExtensionId':_0x4a5a44[_0x8f74('0x18')]});}else{_0x280ff2['push']({'type':_0x4a5a44['type'],'app':_0x8f74('0x30'),'appdata':_0x8f74('0x34'),'context':_0x4a5a44[_0x8f74('0x14')],'exten':_0x4a5a44[_0x8f74('0xb')],'priority':_0x4a2d3d[_0x8f74('0x33')]+_0x8221d7['priority']+_0x442b74++,'VoiceExtensionId':_0x4a5a44[_0x8f74('0x18')]});}}if(_0x4a5a44[_0x8f74('0xd')](_0x8f74('0x35'))){if(_0x5864e2[_0x8f74('0x36')](_0x4a5a44[_0x8f74('0x37')]['toLowerCase']())>=0x0&&_0x4a5a44[_0x8f74('0x38')]!=='custom'){if(_0x4a5a44['answer']){_0x280ff2[_0x8f74('0x10')]({'type':_0x4a5a44[_0x8f74('0x13')],'app':_0x8f74('0x30'),'appdata':_0x8f74('0x39'),'context':_0x4a5a44[_0x8f74('0x14')],'exten':_0x4a5a44[_0x8f74('0xb')],'priority':_0x4a2d3d['length']+_0x8221d7[_0x8f74('0xe')]+_0x442b74++,'VoiceExtensionId':_0x4a5a44[_0x8f74('0x18')]});_0x280ff2[_0x8f74('0x10')]({'type':_0x4a5a44[_0x8f74('0x13')],'app':_0x8f74('0x11'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4a5a44['context'],'exten':_0x4a5a44['exten'],'priority':_0x4a2d3d['length']+_0x8221d7[_0x8f74('0xe')]+_0x442b74++,'VoiceExtensionId':_0x4a5a44[_0x8f74('0x18')]});}else{_0x280ff2['push']({'type':_0x4a5a44[_0x8f74('0x13')],'app':_0x8f74('0x30'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4a5a44[_0x8f74('0x14')],'exten':_0x4a5a44[_0x8f74('0xb')],'priority':_0x4a2d3d[_0x8f74('0x33')]+_0x8221d7[_0x8f74('0xe')]+_0x442b74++,'VoiceExtensionId':_0x4a5a44[_0x8f74('0x18')]});_0x280ff2[_0x8f74('0x10')]({'type':_0x4a5a44[_0x8f74('0x13')],'app':'Set','appdata':_0x8f74('0x3a'),'context':_0x4a5a44[_0x8f74('0x14')],'exten':_0x4a5a44[_0x8f74('0xb')],'priority':_0x4a2d3d['length']+_0x8221d7[_0x8f74('0xe')]+_0x442b74++,'VoiceExtensionId':_0x4a5a44['VoiceExtensionId']});}}}for(var _0x1e155c=0x0;_0x1e155c<_0x4a2d3d[_0x8f74('0x33')];_0x1e155c+=0x1){var _0x63f1e9=_0x8221d7[_0x8f74('0xe')]+_0x4a2d3d[_0x8f74('0x33')];var _0x2ea26a=_0x1e155c===_0x4a2d3d[_0x8f74('0x33')]-0x1?_0x8221d7[_0x8f74('0xe')]+_0x280ff2[_0x8f74('0x33')]+_0x537b8c[_0x8f74('0x33')]+0x2:_0x8221d7[_0x8f74('0xe')]+_0x1e155c+0x1;_0x280ff2[_0x8f74('0x3b')](_0x1e155c,0x0,{'type':_0x4a5a44['type'],'app':_0x8f74('0x3c'),'appdata':_0x4a2d3d[_0x1e155c]+'?'+_0x4a5a44[_0x8f74('0x14')]+_0x8f74('0x3d')+_0x63f1e9+':'+_0x4a5a44[_0x8f74('0x14')]+',${EXTEN},'+_0x2ea26a,'exten':_0x4a5a44[_0x8f74('0xb')],'context':_0x4a5a44[_0x8f74('0x14')],'priority':_0x8221d7['priority']+_0x1e155c,'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});}_0x4a5a44[_0x8f74('0xe')]=_0x280ff2[_0x8f74('0x33')]?_[_0x8f74('0x3e')](_0x280ff2)['priority']+0x1:_0x8221d7['priority'];_0x8221d7[_0x8f74('0xe')]=(_0x537b8c['length']?_['last'](_0x537b8c)[_0x8f74('0xe')]:_0x4a5a44[_0x8f74('0xe')])+0x1;_0x8221d7[_0x8f74('0x16')]=_[_0x8f74('0x3f')](_0x8221d7[_0x8f74('0x16')],_0x280ff2,[_0x4a5a44],_0x537b8c);}_0x8221d7['extensions']['push']({'type':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x13')],'app':_0x8f74('0x40'),'exten':_0x5a2c9c[_0x405439][0x0]['exten'],'context':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x14')],'priority':_0x8221d7['priority'],'VoiceExtensionId':_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]});_0x519cb4['push'](_0x5a2c9c[_0x405439][0x0][_0x8f74('0x18')]);_0x218219=_[_0x8f74('0x3f')](_0x218219,_0x8221d7['extensions']);}}return _0x219acd[_0x8f74('0x41')](function(_0x1d7aba){return _0x219acd['models']['VoiceExtension'][_0x8f74('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x519cb4}},'transaction':_0x1d7aba})[_0x8f74('0x3')](function(_0x2985bf){return _0x219acd[_0x8f74('0x1')]['VoiceExtension']['bulkCreate'](_[_0x8f74('0x43')](_0x218219,'priority'),{'transaction':_0x1d7aba});});});})[_0x8f74('0x44')](function(_0x506fb4){console[_0x8f74('0x45')](_0x506fb4);});}exports[_0x8f74('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index f381041..b09e9cd 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 _0x9cb8=['then','get','always','sequelize','VoiceQueueId','push','query','all','BlackLists','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','localhost','socket.io-emitter','argv','null','undefined','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','create','keys','catch','stringify','cmContact','inspect','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','select','\x20=\x20?','into','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists'];(function(_0x367ea5,_0xeb4c3f){var _0x1b0ede=function(_0xd0dcf8){while(--_0xd0dcf8){_0x367ea5['push'](_0x367ea5['shift']());}};_0x1b0ede(++_0xeb4c3f);}(_0x9cb8,0x89));var _0x89cb=function(_0x2fd8e2,_0x8cbd99){_0x2fd8e2=_0x2fd8e2-0x0;var _0x35bdb4=_0x9cb8[_0x2fd8e2];return _0x35bdb4;};'use strict';var BPromise=require('bluebird');var util=require(_0x89cb('0x0'));var _=require(_0x89cb('0x1'));var fs=require('fs');var squel=require(_0x89cb('0x2'));var Papa=require(_0x89cb('0x3'));var Redis=require(_0x89cb('0x4'));var db=require(_0x89cb('0x5'))['db'];var config=require(_0x89cb('0x6'));var logger=require('../../../config/logger')(_0x89cb('0x7'));config['redis']=_['defaults'](config[_0x89cb('0x8')],{'host':_0x89cb('0x9'),'port':0x18eb});var socket=require(_0x89cb('0xa'))(new Redis(config[_0x89cb('0x8')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x89cb('0xb')][0x2]||process[_0x89cb('0xb')][0x2]==='undefined'||process[_0x89cb('0xb')][0x2]===_0x89cb('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x89cb('0xb')][0x2];if(!process[_0x89cb('0xb')][0x3]||process['argv'][0x3]===_0x89cb('0xd')||process[_0x89cb('0xb')][0x3]===_0x89cb('0xc')||!process[_0x89cb('0xb')][0x4]||process[_0x89cb('0xb')][0x4]===_0x89cb('0xd')||process['argv'][0x4]==='null'){throw new Error(_0x89cb('0xe'));}var FIELDS=_['zipObject'](process[_0x89cb('0xb')][0x3][_0x89cb('0xf')](','),process[_0x89cb('0xb')][0x4][_0x89cb('0xf')](','));if(!process[_0x89cb('0xb')][0x5]||process['argv'][0x5]===_0x89cb('0xd')||process['argv'][0x5]===_0x89cb('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x89cb('0xb')][0x5];var COMPANYID=process[_0x89cb('0xb')][0x6]&&process[_0x89cb('0xb')][0x6]!==_0x89cb('0xd')&&process[_0x89cb('0xb')][0x6]!==_0x89cb('0xc')?process[_0x89cb('0xb')][0x6]:null;var DUPLICATES=process[_0x89cb('0xb')][0x7]&&process[_0x89cb('0xb')][0x7]!=='undefined'&&process[_0x89cb('0xb')][0x7]!=='null'?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x89cb('0xb')][0x8]==='undefined'||process[_0x89cb('0xb')][0x8]==='null'){throw new Error(_0x89cb('0x10'));}var SOCKET_TIMESTAMP=process[_0x89cb('0xb')][0x8];}catch(_0xf028ce){logger[_0x89cb('0x11')](_0xf028ce);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(_0x4fb63a,_0x551096,_0x45b88c,_0x3bb723){var _0x128a42={'message':_0x551096};_0x128a42[_0x4fb63a]=!![];if(_0x45b88c){_0x128a42[_0x89cb('0x12')]=_0x45b88c;}if(_0x3bb723){_0x128a42[_0x89cb('0x13')]=_0x3bb723;}return _0x128a42;}function isEmail(_0x593fb4){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))*$/[_0x89cb('0x14')](_0x593fb4);}function checkRow(_0x11e49c,_0x3b4a11,_0x4615b2){return new BPromise(function(_0x46fd0b,_0x24c291){if(_[_0x89cb('0x15')](_0x11e49c)){return _0x24c291(handleCheckRowError(_0x89cb('0x11'),_0x89cb('0x16'),null,_0x4615b2));}if(_0x11e49c[_0x89cb('0x17')]&&_0x11e49c[_0x89cb('0x17')][_0x89cb('0x18')]){var _0x5f1d69=_['map'](_0x11e49c[_0x89cb('0x17')],_0x89cb('0x19'))[_0x89cb('0x1a')](';');return _0x24c291(handleCheckRowError(_0x89cb('0x11'),_0x5f1d69,null,_0x4615b2));}var _0x37602b={};for(var _0x15c57b in FIELDS){if(FIELDS[_0x89cb('0x1b')](_0x15c57b)&&FIELDS[_0x15c57b]){_0x37602b[_0x15c57b]=_0x11e49c[_0x89cb('0x1c')][0x0][FIELDS[_0x15c57b]]||_0x11e49c[_0x89cb('0x1c')][0x0]['\ufeff'+FIELDS[_0x15c57b]];}}if(!_0x37602b[_0x89cb('0x1d')]){return _0x24c291(handleCheckRowError(_0x89cb('0x11'),'firstName\x20not\x20specified!',null,_0x4615b2));}if(!_0x37602b['phone']){return _0x24c291(handleCheckRowError(_0x89cb('0x11'),_0x89cb('0x1e'),null,_0x4615b2));}if(_0x37602b[_0x89cb('0x1f')]){var _0x5becd7=moment(_0x37602b[_0x89cb('0x1f')],_0x89cb('0x20'));if(!_0x5becd7['isValid']()){return _0x24c291(handleCheckRowError(_0x89cb('0x11'),_0x89cb('0x21'),null,_0x4615b2));}}if(_0x37602b[_0x89cb('0x22')]){if(!isEmail(_0x37602b[_0x89cb('0x22')])){return _0x24c291(handleCheckRowError('error',_0x89cb('0x23'),null,_0x4615b2));}}_0x37602b[_0x89cb('0x24')]=LISTID;_0x37602b['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x89cb('0x18')]&&_0x3b4a11){var _0x36627a={};for(var _0x1939b2=0x0,_0x233776=DUPLICATES[_0x89cb('0x18')];_0x1939b2<_0x233776;_0x1939b2+=0x1){_0x36627a[DUPLICATES[_0x1939b2]]=_0x37602b[DUPLICATES[_0x1939b2]];}var _0x5336ac=_[_0x89cb('0x25')](_0x3b4a11,_0x36627a);if(_0x5336ac){return _0x24c291(handleCheckRowError(_0x89cb('0x26'),_0x89cb('0x27'),_0x5336ac,_0x4615b2));}}return db['CmContact'][_0x89cb('0x28')](_0x37602b,{'raw':!![],'hooks':![],'fields':_[_0x89cb('0x29')](_0x37602b)})['then'](function(_0x3beec7){if(DUPLICATES&&DUPLICATES[_0x89cb('0x18')]&&_0x3b4a11){_0x3b4a11['push'](_['pick'](_0x37602b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3beec7['id'];return _0x46fd0b();})[_0x89cb('0x2a')](function(_0x52365e){return _0x24c291(handleCheckRowError(_0x89cb('0x11'),'Error\x20while\x20creating\x20contact:\x20'+(_0x52365e[_0x89cb('0x19')]||JSON[_0x89cb('0x2b')](_0x52365e)),null,_0x4615b2));});});}function checkHopper(){function _0x16ee24(){return function(_0xfe683f){logger[_0x89cb('0x11')](_0x89cb('0x2c'),'checkHopper',util[_0x89cb('0x2d')](_0xfe683f,{'showHidden':![],'depth':null}));};}var _0x48272f=function(_0x23c224,_0x47e356){var _0x458a0b=squel[_0x89cb('0x2e')]()['into'](_0x89cb('0x2f'))[_0x89cb('0x30')]([_0x89cb('0x31'),_0x89cb('0x32'),_0x89cb('0x33'),_0x89cb('0x24'),_0x47e356,_0x89cb('0x34'),_0x89cb('0x35')],squel['select']()[_0x89cb('0x36')](_0x89cb('0x31'),_0x89cb('0x31'))[_0x89cb('0x36')](_0x89cb('0x37'),_0x89cb('0x32'))[_0x89cb('0x36')]('id',_0x89cb('0x33'))[_0x89cb('0x36')](LISTID[_0x89cb('0x38')](),_0x89cb('0x24'))['field'](_0x23c224['id']['toString'](),_0x47e356)[_0x89cb('0x36')](_0x89cb('0x37'),_0x89cb('0x34'))[_0x89cb('0x36')]('NOW()',_0x89cb('0x35'))[_0x89cb('0x39')](_0x89cb('0x3a'))[_0x89cb('0x3b')](_0x89cb('0x3c'))[_0x89cb('0x3b')]('ListId\x20=\x20?',LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x89cb('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x89cb('0x3d')]()['field'](_0x89cb('0x31'))[_0x89cb('0x39')]('cm_hopper')['where'](_0x47e356+_0x89cb('0x3e'),_0x23c224['id'][_0x89cb('0x38')]())))[_0x89cb('0x38')]();return _0x458a0b;};var _0x499864=function(_0x5b47bc,_0x1afe9e){var _0x5599a6=squel[_0x89cb('0x2e')]()[_0x89cb('0x3f')]('cm_hopper')[_0x89cb('0x30')]([_0x89cb('0x31'),_0x89cb('0x32'),_0x89cb('0x33'),_0x89cb('0x24'),_0x1afe9e,_0x89cb('0x34'),'updatedAt'],squel[_0x89cb('0x3d')]()[_0x89cb('0x36')](_0x89cb('0x31'),_0x89cb('0x31'))[_0x89cb('0x36')](_0x89cb('0x37'),_0x89cb('0x32'))[_0x89cb('0x36')]('id',_0x89cb('0x33'))[_0x89cb('0x36')](LISTID[_0x89cb('0x38')](),_0x89cb('0x24'))[_0x89cb('0x36')](_0x5b47bc['id'][_0x89cb('0x38')](),_0x1afe9e)['field'](_0x89cb('0x37'),_0x89cb('0x34'))['field'](_0x89cb('0x37'),_0x89cb('0x35'))[_0x89cb('0x39')]('cm_contacts')[_0x89cb('0x3b')]('deletedAt\x20IS\x20NULL')[_0x89cb('0x3b')](_0x89cb('0x40'),LISTID[_0x89cb('0x38')]())[_0x89cb('0x3b')](_0x89cb('0x41'),squel[_0x89cb('0x42')](hopperContacts))[_0x89cb('0x3b')](_0x89cb('0x43'))[_0x89cb('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x89cb('0x3d')]()['field'](_0x89cb('0x44'))['from'](_0x89cb('0x45'))['where'](_0x1afe9e+_0x89cb('0x3e'),_0x5b47bc['id'][_0x89cb('0x38')]()))['where'](_0x89cb('0x46'),squel['select']()[_0x89cb('0x36')]('phone')[_0x89cb('0x39')](_0x89cb('0x2f'))['where'](_0x1afe9e+'\x20=\x20?',_0x5b47bc['id'][_0x89cb('0x38')]())))[_0x89cb('0x38')]();return _0x5599a6;};function _0x26b172(_0x71a42,_0x578db0){var _0x117e85=squel['insert']()[_0x89cb('0x3f')](_0x89cb('0x2f'))['fromQuery'](['phone',_0x89cb('0x32'),_0x89cb('0x33'),_0x89cb('0x24'),_0x578db0,_0x89cb('0x34'),_0x89cb('0x35')],squel[_0x89cb('0x3d')]()[_0x89cb('0x36')](_0x89cb('0x31'),_0x89cb('0x31'))['field'](_0x89cb('0x37'),'scheduledAt')[_0x89cb('0x36')]('id','ContactId')['field'](LISTID[_0x89cb('0x38')](),_0x89cb('0x24'))[_0x89cb('0x36')](_0x71a42['id'][_0x89cb('0x38')](),_0x578db0)[_0x89cb('0x36')](_0x89cb('0x37'),_0x89cb('0x34'))[_0x89cb('0x36')](_0x89cb('0x37'),_0x89cb('0x35'))[_0x89cb('0x39')](_0x89cb('0x3a'))[_0x89cb('0x3b')]('deletedAt\x20IS\x20NULL')[_0x89cb('0x3b')](_0x89cb('0x40'),LISTID['toString']())[_0x89cb('0x3b')]('id\x20IN\x20?',squel[_0x89cb('0x42')](hopperContacts))[_0x89cb('0x3b')](_0x89cb('0x43')))['toString']();return _0x117e85;}function _0x5e03a7(_0x59d9d4,_0x453fea){var _0x5e86eb=squel[_0x89cb('0x2e')]()[_0x89cb('0x3f')]('cm_hopper_black')[_0x89cb('0x30')]([_0x89cb('0x31'),_0x89cb('0x33'),_0x89cb('0x24'),_0x453fea,_0x89cb('0x34'),'updatedAt'],squel['select']()[_0x89cb('0x36')](_0x89cb('0x31'),_0x89cb('0x31'))[_0x89cb('0x36')]('id',_0x89cb('0x33'))[_0x89cb('0x36')](LISTID[_0x89cb('0x38')](),_0x89cb('0x24'))['field'](_0x59d9d4['id']['toString'](),_0x453fea)['field'](_0x89cb('0x37'),_0x89cb('0x34'))[_0x89cb('0x36')]('NOW()',_0x89cb('0x35'))['from'](_0x89cb('0x3a'))[_0x89cb('0x3b')](_0x89cb('0x3c'))['where'](_0x89cb('0x40'),LISTID[_0x89cb('0x38')]())[_0x89cb('0x3b')](_0x89cb('0x41'),squel[_0x89cb('0x42')](hopperContacts))[_0x89cb('0x3b')](_0x89cb('0x43')))[_0x89cb('0x38')]();return _0x5e86eb;}return db[_0x89cb('0x47')][_0x89cb('0x48')]({'where':{'type':_0x89cb('0x49')},'attributes':['id',_0x89cb('0x4a')],'include':[{'model':db[_0x89cb('0x4b')],'as':_0x89cb('0x4c'),'where':{'id':LISTID}}]})[_0x89cb('0x4d')](function(_0x283d0d){var _0xacfe0e=[];if(_0x283d0d){var _0x12d678;for(var _0x59e392=0x0,_0x360273;_0x59e392<_0x283d0d[_0x89cb('0x18')];_0x59e392+=0x1){_0x360273=_0x283d0d[_0x59e392][_0x89cb('0x4e')]({'plain':!![]});switch(_0x360273[_0x89cb('0x4a')]){case _0x89cb('0x4f'):_0xacfe0e['push'](db[_0x89cb('0x50')]['query'](_0x499864(_0x360273,_0x89cb('0x51')))['then'](function(){})[_0x89cb('0x2a')](_0x16ee24()));break;case'onlyIfOpen':_0xacfe0e[_0x89cb('0x52')](db[_0x89cb('0x50')][_0x89cb('0x53')](_0x48272f(_0x360273,'VoiceQueueId'))[_0x89cb('0x4d')](function(){})['catch'](_0x16ee24()));break;default:_0xacfe0e[_0x89cb('0x52')](db['sequelize'][_0x89cb('0x53')](_0x26b172(_0x360273,_0x89cb('0x51')))[_0x89cb('0x4d')](function(){})[_0x89cb('0x2a')](_0x16ee24()));}}}return _0xacfe0e;})[_0x89cb('0x54')]()[_0x89cb('0x4d')](function(){return db[_0x89cb('0x47')]['findAll']({'where':{'type':_0x89cb('0x49')},'attributes':['id'],'include':[{'model':db[_0x89cb('0x4b')],'as':_0x89cb('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x34546c){var _0x4e7cdd=[];if(_0x34546c){var _0x9a1179;for(var _0x5b032e=0x0,_0x2f1c5f;_0x5b032e<_0x34546c[_0x89cb('0x18')];_0x5b032e+=0x1){_0x2f1c5f=_0x34546c[_0x5b032e]['get']({'plain':!![]});_0x4e7cdd[_0x89cb('0x52')](db[_0x89cb('0x50')]['query'](_0x5e03a7(_0x2f1c5f,_0x89cb('0x51')))['then'](function(){})[_0x89cb('0x2a')](_0x16ee24()));}}return _0x4e7cdd;})[_0x89cb('0x54')]();})[_0x89cb('0x4d')](function(){return db[_0x89cb('0x56')]['findAll']({'attributes':['id',_0x89cb('0x4a')],'include':[{'model':db[_0x89cb('0x4b')],'as':_0x89cb('0x4c'),'where':{'id':LISTID}}]})['then'](function(_0x269976){var _0x14f0df=[];if(_0x269976){for(var _0x3bf560=0x0,_0x535e6f;_0x3bf560<_0x269976[_0x89cb('0x18')];_0x3bf560+=0x1){_0x535e6f=_0x269976[_0x3bf560][_0x89cb('0x4e')]({'plain':!![]});switch(_0x535e6f[_0x89cb('0x4a')]){case'always':_0x14f0df[_0x89cb('0x52')](db[_0x89cb('0x50')][_0x89cb('0x53')](_0x499864(_0x535e6f,_0x89cb('0x57')))[_0x89cb('0x4d')](function(){})['catch'](_0x16ee24()));break;case _0x89cb('0x58'):_0x14f0df[_0x89cb('0x52')](db[_0x89cb('0x50')]['query'](_0x48272f(_0x535e6f,_0x89cb('0x57')))[_0x89cb('0x4d')](function(){})[_0x89cb('0x2a')](_0x16ee24()));break;default:_0x14f0df[_0x89cb('0x52')](db[_0x89cb('0x50')][_0x89cb('0x53')](_0x26b172(_0x535e6f,_0x89cb('0x57')))['then'](function(){})[_0x89cb('0x2a')](_0x16ee24()));}}}return _0x14f0df;})[_0x89cb('0x54')]();})[_0x89cb('0x4d')](function(){return db[_0x89cb('0x56')][_0x89cb('0x48')]({'attributes':['id'],'include':[{'model':db[_0x89cb('0x4b')],'as':_0x89cb('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x273ca2){var _0x2fc84a=[];if(_0x273ca2){for(var _0x5b3dad=0x0,_0x2d16b2;_0x5b3dad<_0x273ca2['length'];_0x5b3dad+=0x1){_0x2d16b2=_0x273ca2[_0x5b3dad][_0x89cb('0x4e')]({'plain':!![]});_0x2fc84a['push'](db[_0x89cb('0x50')][_0x89cb('0x53')](_0x5e03a7(_0x2d16b2,_0x89cb('0x57')))[_0x89cb('0x4d')](function(){})[_0x89cb('0x2a')](_0x16ee24()));}}return _0x2fc84a;})[_0x89cb('0x54')]();})[_0x89cb('0x2a')](function(_0x285344){logger[_0x89cb('0x11')](_0x89cb('0x59'),_0x89cb('0x5a'),_0x285344[_0x89cb('0x19')]);});}var processPromises=function(_0x4b18e3){return BPromise[_0x89cb('0x54')](promises)[_0x89cb('0x4d')](function(_0x25d979){})[_0x89cb('0x2a')](function(_0x4cfbfc){logger[_0x89cb('0x11')](_0x89cb('0x5b'),JSON[_0x89cb('0x2b')](_0x4cfbfc));})[_0x89cb('0x5c')](function(){socket[_0x89cb('0x5d')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4b18e3){return _0x4b18e3[_0x89cb('0x5e')]();}});};var endCsv=function(){return BPromise[_0x89cb('0x5f')]()[_0x89cb('0x4d')](function(){if(hopperContacts){return checkHopper();}})[_0x89cb('0x4d')](function(){socket[_0x89cb('0x5d')](_0x89cb('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x51977e){logger[_0x89cb('0x11')](_0x89cb('0x61'),JSON[_0x89cb('0x2b')](_0x51977e));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x89cb('0x62')](_0x89cb('0x63'));endCsv();});function main(){return BPromise[_0x89cb('0x5f')]()[_0x89cb('0x4d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x89cb('0xf')](',');return db[_0x89cb('0x64')][_0x89cb('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x89cb('0x4d')](function(_0x1bcc8b){var _0x571583=fs[_0x89cb('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x89cb('0x66')](_0x571583,{'header':!![],'skipEmptyLines':!![],'step':function(_0x9c5eb6,_0x459a29){total+=0x1;var _0x5e6ebe=total;promises['push'](checkRow(_0x9c5eb6,_0x1bcc8b,_0x5e6ebe)[_0x89cb('0x4d')](function(){success+=0x1;})[_0x89cb('0x2a')](function(_0x4ba477){if(_0x4ba477['error']){errors+=0x1;delete _0x4ba477[_0x89cb('0x11')];}else if(_0x4ba477[_0x89cb('0x26')]){duplicates+=0x1;delete _0x4ba477[_0x89cb('0x26')];}rows['push'](_0x4ba477);}));if(total%0xc8===0x0){_0x459a29[_0x89cb('0x67')]();return processPromises(_0x459a29);}},'complete':function(){return processPromises()[_0x89cb('0x4d')](function(){logger[_0x89cb('0x62')](_0x89cb('0x68'));endCsv();});},'error':function(_0x44650a,_0xc22755){logger['info'](_0x89cb('0x69'),JSON[_0x89cb('0x2b')](_0x44650a));endCsv();}});})['catch'](function(_0x512f78){logger['error'](_0x89cb('0x6a'),JSON['stringify'](_0x512f78));});}main(); \ No newline at end of file +var _0x15e0=['insert','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','resume','resolve','emit','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','squel','../../../mysqldb','../../../config/environment','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','null','Missing\x20binding\x20parameters!','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','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','\x20=\x20?','scheduledAt','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)'];(function(_0x82d2b0,_0x3136f0){var _0x5d529e=function(_0x7e464b){while(--_0x7e464b){_0x82d2b0['push'](_0x82d2b0['shift']());}};_0x5d529e(++_0x3136f0);}(_0x15e0,0xf5));var _0x015e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x15e0[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x015e('0x0'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0x015e('0x1'))['db'];var config=require(_0x015e('0x2'));var logger=require('../../../config/logger')(_0x015e('0x3'));config[_0x015e('0x4')]=_[_0x015e('0x5')](config[_0x015e('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x015e('0x6'))(new Redis(config[_0x015e('0x4')]));require(_0x015e('0x7'))[_0x015e('0x8')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x015e('0x9')||process[_0x015e('0xa')][0x2]===_0x015e('0xb')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x015e('0xa')][0x2];if(!process[_0x015e('0xa')][0x3]||process[_0x015e('0xa')][0x3]===_0x015e('0x9')||process[_0x015e('0xa')][0x3]===_0x015e('0xb')||!process[_0x015e('0xa')][0x4]||process[_0x015e('0xa')][0x4]==='undefined'||process['argv'][0x4]===_0x015e('0xb')){throw new Error(_0x015e('0xc'));}var FIELDS=_['zipObject'](process[_0x015e('0xa')][0x3][_0x015e('0xd')](','),process[_0x015e('0xa')][0x4]['split'](','));if(!process[_0x015e('0xa')][0x5]||process[_0x015e('0xa')][0x5]==='undefined'||process[_0x015e('0xa')][0x5]==='null'){throw new Error(_0x015e('0xe'));}var LISTID=process[_0x015e('0xa')][0x5];var COMPANYID=process[_0x015e('0xa')][0x6]&&process[_0x015e('0xa')][0x6]!==_0x015e('0x9')&&process[_0x015e('0xa')][0x6]!=='null'?process[_0x015e('0xa')][0x6]:null;var DUPLICATES=process[_0x015e('0xa')][0x7]&&process[_0x015e('0xa')][0x7]!==_0x015e('0x9')&&process[_0x015e('0xa')][0x7]!==_0x015e('0xb')?process[_0x015e('0xa')][0x7]:null;if(!process[_0x015e('0xa')][0x8]||process['argv'][0x8]===_0x015e('0x9')||process[_0x015e('0xa')][0x8]===_0x015e('0xb')){throw new Error(_0x015e('0xf'));}var SOCKET_TIMESTAMP=process[_0x015e('0xa')][0x8];}catch(_0x5f3d0a){logger[_0x015e('0x10')](_0x5f3d0a);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(_0x244b00,_0xdbd8f5,_0x1ebd78,_0x29bafa){var _0x4c392e={'message':_0xdbd8f5};_0x4c392e[_0x244b00]=!![];if(_0x1ebd78){_0x4c392e[_0x015e('0x11')]=_0x1ebd78;}if(_0x29bafa){_0x4c392e[_0x015e('0x12')]=_0x29bafa;}return _0x4c392e;}function isEmail(_0x48ea0a){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))*$/[_0x015e('0x13')](_0x48ea0a);}function checkRow(_0x560639,_0x273601,_0xf27b17){return new BPromise(function(_0x3bcf83,_0x4ba477){if(_['isNil'](_0x560639)){return _0x4ba477(handleCheckRowError('error',_0x015e('0x14'),null,_0xf27b17));}if(_0x560639['errors']&&_0x560639[_0x015e('0x15')][_0x015e('0x16')]){var _0x4c9592=_[_0x015e('0x17')](_0x560639[_0x015e('0x15')],_0x015e('0x18'))['join'](';');return _0x4ba477(handleCheckRowError(_0x015e('0x10'),_0x4c9592,null,_0xf27b17));}var _0x5ce779={};for(var _0x10b51b in FIELDS){if(FIELDS['hasOwnProperty'](_0x10b51b)&&FIELDS[_0x10b51b]){_0x5ce779[_0x10b51b]=_0x560639[_0x015e('0x19')][0x0][FIELDS[_0x10b51b]]||_0x560639[_0x015e('0x19')][0x0]['\ufeff'+FIELDS[_0x10b51b]];}}if(!_0x5ce779[_0x015e('0x1a')]){return _0x4ba477(handleCheckRowError(_0x015e('0x10'),_0x015e('0x1b'),null,_0xf27b17));}if(!_0x5ce779[_0x015e('0x1c')]){return _0x4ba477(handleCheckRowError('error',_0x015e('0x1d'),null,_0xf27b17));}if(_0x5ce779['birthDate']){var _0x39ef36=moment(_0x5ce779[_0x015e('0x1e')],_0x015e('0x1f'));if(!_0x39ef36[_0x015e('0x20')]()){return _0x4ba477(handleCheckRowError(_0x015e('0x10'),_0x015e('0x21'),null,_0xf27b17));}}if(_0x5ce779[_0x015e('0x22')]){if(!isEmail(_0x5ce779['email'])){return _0x4ba477(handleCheckRowError(_0x015e('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0xf27b17));}}_0x5ce779[_0x015e('0x23')]=LISTID;_0x5ce779[_0x015e('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x273601){var _0x533dbc={};for(var _0x50e072=0x0,_0x3006b8=DUPLICATES['length'];_0x50e072<_0x3006b8;_0x50e072+=0x1){_0x533dbc[DUPLICATES[_0x50e072]]=_0x5ce779[DUPLICATES[_0x50e072]];}var _0x28fb28=_['find'](_0x273601,_0x533dbc);if(_0x28fb28){return _0x4ba477(handleCheckRowError(_0x015e('0x25'),_0x015e('0x26'),_0x28fb28,_0xf27b17));}}return db['CmContact'][_0x015e('0x27')](_0x5ce779,{'raw':!![],'hooks':![],'fields':_[_0x015e('0x28')](_0x5ce779)})[_0x015e('0x29')](function(_0x3ed428){if(DUPLICATES&&DUPLICATES[_0x015e('0x16')]&&_0x273601){_0x273601[_0x015e('0x2a')](_[_0x015e('0x2b')](_0x5ce779,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3ed428['id'];return _0x3bcf83();})[_0x015e('0x2c')](function(_0x6ecff8){return _0x4ba477(handleCheckRowError(_0x015e('0x10'),_0x015e('0x2d')+(_0x6ecff8['message']||JSON[_0x015e('0x2e')](_0x6ecff8)),null,_0xf27b17));});});}function checkHopper(){function _0x1764e1(){return function(_0x73a03f){logger['error']('cmContact',_0x015e('0x2f'),util[_0x015e('0x30')](_0x73a03f,{'showHidden':![],'depth':null}));};}var _0x279f15=function(_0x35139c,_0x3e4473){var _0x2867fd=squel['insert']()[_0x015e('0x31')](_0x015e('0x32'))[_0x015e('0x33')]([_0x015e('0x1c'),'scheduledAt',_0x015e('0x34'),_0x015e('0x23'),_0x3e4473,_0x015e('0x35'),_0x015e('0x36')],squel[_0x015e('0x37')]()[_0x015e('0x38')](_0x015e('0x1c'),_0x015e('0x1c'))[_0x015e('0x38')](_0x015e('0x39'),'scheduledAt')[_0x015e('0x38')]('id',_0x015e('0x34'))[_0x015e('0x38')](LISTID['toString'](),'ListId')[_0x015e('0x38')](_0x35139c['id'][_0x015e('0x3a')](),_0x3e4473)[_0x015e('0x38')](_0x015e('0x39'),_0x015e('0x35'))[_0x015e('0x38')](_0x015e('0x39'),_0x015e('0x36'))[_0x015e('0x3b')](_0x015e('0x3c'))[_0x015e('0x3d')](_0x015e('0x3e'))[_0x015e('0x3d')](_0x015e('0x3f'),LISTID[_0x015e('0x3a')]())[_0x015e('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x015e('0x38')](_0x015e('0x1c'))[_0x015e('0x3b')](_0x015e('0x32'))[_0x015e('0x3d')](_0x3e4473+_0x015e('0x40'),_0x35139c['id'][_0x015e('0x3a')]())))[_0x015e('0x3a')]();return _0x2867fd;};var _0x13c4a5=function(_0x59a1a7,_0x120b2d){var _0x1e3021=squel['insert']()[_0x015e('0x31')](_0x015e('0x32'))[_0x015e('0x33')](['phone',_0x015e('0x41'),_0x015e('0x34'),_0x015e('0x23'),_0x120b2d,'createdAt','updatedAt'],squel[_0x015e('0x37')]()[_0x015e('0x38')]('phone',_0x015e('0x1c'))[_0x015e('0x38')]('NOW()','scheduledAt')[_0x015e('0x38')]('id',_0x015e('0x34'))[_0x015e('0x38')](LISTID['toString'](),_0x015e('0x23'))[_0x015e('0x38')](_0x59a1a7['id'][_0x015e('0x3a')](),_0x120b2d)[_0x015e('0x38')]('NOW()','createdAt')[_0x015e('0x38')](_0x015e('0x39'),_0x015e('0x36'))[_0x015e('0x3b')](_0x015e('0x3c'))['where'](_0x015e('0x3e'))[_0x015e('0x3d')](_0x015e('0x3f'),LISTID[_0x015e('0x3a')]())[_0x015e('0x3d')](_0x015e('0x42'),squel[_0x015e('0x43')](hopperContacts))[_0x015e('0x3d')](_0x015e('0x44'))['where'](_0x015e('0x45'),squel[_0x015e('0x37')]()['field']('calleridnum')[_0x015e('0x3b')]('cm_hopper_final')[_0x015e('0x3d')](_0x120b2d+'\x20=\x20?',_0x59a1a7['id'][_0x015e('0x3a')]()))[_0x015e('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x015e('0x37')]()['field']('phone')[_0x015e('0x3b')]('cm_hopper')[_0x015e('0x3d')](_0x120b2d+'\x20=\x20?',_0x59a1a7['id'][_0x015e('0x3a')]())))[_0x015e('0x3a')]();return _0x1e3021;};function _0x11866b(_0x3b59c0,_0x3af50f){var _0x5adc77=squel[_0x015e('0x46')]()[_0x015e('0x31')](_0x015e('0x32'))[_0x015e('0x33')]([_0x015e('0x1c'),_0x015e('0x41'),_0x015e('0x34'),'ListId',_0x3af50f,_0x015e('0x35'),'updatedAt'],squel[_0x015e('0x37')]()['field'](_0x015e('0x1c'),_0x015e('0x1c'))[_0x015e('0x38')](_0x015e('0x39'),_0x015e('0x41'))[_0x015e('0x38')]('id',_0x015e('0x34'))['field'](LISTID[_0x015e('0x3a')](),_0x015e('0x23'))['field'](_0x3b59c0['id'][_0x015e('0x3a')](),_0x3af50f)[_0x015e('0x38')](_0x015e('0x39'),_0x015e('0x35'))[_0x015e('0x38')](_0x015e('0x39'),_0x015e('0x36'))[_0x015e('0x3b')](_0x015e('0x3c'))[_0x015e('0x3d')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x015e('0x3a')]())[_0x015e('0x3d')]('id\x20IN\x20?',squel[_0x015e('0x43')](hopperContacts))[_0x015e('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x015e('0x3a')]();return _0x5adc77;}function _0x2400d9(_0x557174,_0x43b89c){var _0x188f9d=squel[_0x015e('0x46')]()[_0x015e('0x31')](_0x015e('0x47'))[_0x015e('0x33')]([_0x015e('0x1c'),_0x015e('0x34'),'ListId',_0x43b89c,_0x015e('0x35'),_0x015e('0x36')],squel[_0x015e('0x37')]()[_0x015e('0x38')]('phone',_0x015e('0x1c'))['field']('id',_0x015e('0x34'))[_0x015e('0x38')](LISTID[_0x015e('0x3a')](),_0x015e('0x23'))[_0x015e('0x38')](_0x557174['id']['toString'](),_0x43b89c)['field'](_0x015e('0x39'),'createdAt')[_0x015e('0x38')]('NOW()',_0x015e('0x36'))[_0x015e('0x3b')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x015e('0x3d')](_0x015e('0x3f'),LISTID[_0x015e('0x3a')]())[_0x015e('0x3d')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x015e('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x188f9d;}return db[_0x015e('0x48')][_0x015e('0x49')]({'where':{'type':_0x015e('0x4a')},'attributes':['id',_0x015e('0x4b')],'include':[{'model':db[_0x015e('0x4c')],'as':_0x015e('0x4d'),'where':{'id':LISTID}}]})['then'](function(_0x1da823){var _0x4dd55c=[];if(_0x1da823){var _0x690913;for(var _0x219ef0=0x0,_0x571d4c;_0x219ef0<_0x1da823[_0x015e('0x16')];_0x219ef0+=0x1){_0x571d4c=_0x1da823[_0x219ef0][_0x015e('0x4e')]({'plain':!![]});switch(_0x571d4c[_0x015e('0x4b')]){case _0x015e('0x4f'):_0x4dd55c['push'](db['sequelize'][_0x015e('0x50')](_0x13c4a5(_0x571d4c,_0x015e('0x51')))[_0x015e('0x29')](function(){})['catch'](_0x1764e1()));break;case _0x015e('0x52'):_0x4dd55c[_0x015e('0x2a')](db[_0x015e('0x53')][_0x015e('0x50')](_0x279f15(_0x571d4c,_0x015e('0x51')))['then'](function(){})['catch'](_0x1764e1()));break;default:_0x4dd55c[_0x015e('0x2a')](db[_0x015e('0x53')]['query'](_0x11866b(_0x571d4c,_0x015e('0x51')))[_0x015e('0x29')](function(){})[_0x015e('0x2c')](_0x1764e1()));}}}return _0x4dd55c;})[_0x015e('0x54')]()[_0x015e('0x29')](function(){return db[_0x015e('0x48')][_0x015e('0x49')]({'where':{'type':_0x015e('0x4a')},'attributes':['id'],'include':[{'model':db[_0x015e('0x4c')],'as':_0x015e('0x55'),'where':{'id':LISTID}}]})[_0x015e('0x29')](function(_0x1ebb65){var _0x19a571=[];if(_0x1ebb65){var _0x404653;for(var _0x1a6f6e=0x0,_0x2fc268;_0x1a6f6e<_0x1ebb65[_0x015e('0x16')];_0x1a6f6e+=0x1){_0x2fc268=_0x1ebb65[_0x1a6f6e][_0x015e('0x4e')]({'plain':!![]});_0x19a571[_0x015e('0x2a')](db[_0x015e('0x53')][_0x015e('0x50')](_0x2400d9(_0x2fc268,_0x015e('0x51')))[_0x015e('0x29')](function(){})['catch'](_0x1764e1()));}}return _0x19a571;})[_0x015e('0x54')]();})[_0x015e('0x29')](function(){return db[_0x015e('0x56')][_0x015e('0x49')]({'attributes':['id',_0x015e('0x4b')],'include':[{'model':db[_0x015e('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0x015e('0x29')](function(_0x50044d){var _0x47cd42=[];if(_0x50044d){for(var _0x3fedb9=0x0,_0xf9ad3b;_0x3fedb9<_0x50044d[_0x015e('0x16')];_0x3fedb9+=0x1){_0xf9ad3b=_0x50044d[_0x3fedb9]['get']({'plain':!![]});switch(_0xf9ad3b[_0x015e('0x4b')]){case _0x015e('0x4f'):_0x47cd42[_0x015e('0x2a')](db[_0x015e('0x53')][_0x015e('0x50')](_0x13c4a5(_0xf9ad3b,_0x015e('0x57')))[_0x015e('0x29')](function(){})[_0x015e('0x2c')](_0x1764e1()));break;case'onlyIfOpen':_0x47cd42['push'](db[_0x015e('0x53')]['query'](_0x279f15(_0xf9ad3b,_0x015e('0x57')))['then'](function(){})[_0x015e('0x2c')](_0x1764e1()));break;default:_0x47cd42[_0x015e('0x2a')](db[_0x015e('0x53')][_0x015e('0x50')](_0x11866b(_0xf9ad3b,_0x015e('0x57')))[_0x015e('0x29')](function(){})[_0x015e('0x2c')](_0x1764e1()));}}}return _0x47cd42;})[_0x015e('0x54')]();})['then'](function(){return db[_0x015e('0x56')][_0x015e('0x49')]({'attributes':['id'],'include':[{'model':db[_0x015e('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x015e('0x29')](function(_0x2a52cb){var _0x93b4c9=[];if(_0x2a52cb){for(var _0x4b22f9=0x0,_0x45b500;_0x4b22f9<_0x2a52cb[_0x015e('0x16')];_0x4b22f9+=0x1){_0x45b500=_0x2a52cb[_0x4b22f9]['get']({'plain':!![]});_0x93b4c9[_0x015e('0x2a')](db['sequelize']['query'](_0x2400d9(_0x45b500,'CampaignId'))['then'](function(){})[_0x015e('0x2c')](_0x1764e1()));}}return _0x93b4c9;})[_0x015e('0x54')]();})['catch'](function(_0x2235ed){logger[_0x015e('0x10')](_0x015e('0x58'),_0x015e('0x59'),_0x2235ed[_0x015e('0x18')]);});}var processPromises=function(_0x5bd757){return BPromise['all'](promises)[_0x015e('0x29')](function(_0x53b144){})[_0x015e('0x2c')](function(_0x3ae10a){logger[_0x015e('0x10')]('Error\x20processing\x20rows\x20block:',JSON[_0x015e('0x2e')](_0x3ae10a));})[_0x015e('0x5a')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5bd757){return _0x5bd757[_0x015e('0x5b')]();}});};var endCsv=function(){return BPromise[_0x015e('0x5c')]()[_0x015e('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x015e('0x29')](function(){socket[_0x015e('0x5d')](_0x015e('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x451dc4){logger['error'](_0x015e('0x5f'),JSON[_0x015e('0x2e')](_0x451dc4));}finally{process['exit'](0x0);}});};process['on'](_0x015e('0x60'),function(){logger['info'](_0x015e('0x61'));endCsv();});function main(){return BPromise[_0x015e('0x5c')]()[_0x015e('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x015e('0xd')](',');return db[_0x015e('0x62')][_0x015e('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x015e('0x29')](function(_0x24e8f1){var _0x9e48f6=fs[_0x015e('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x015e('0x64')](_0x9e48f6,{'header':!![],'skipEmptyLines':!![],'step':function(_0xb4355f,_0x3aabb7){total+=0x1;var _0xc6df9a=total;promises[_0x015e('0x2a')](checkRow(_0xb4355f,_0x24e8f1,_0xc6df9a)[_0x015e('0x29')](function(){success+=0x1;})[_0x015e('0x2c')](function(_0x4e2757){if(_0x4e2757[_0x015e('0x10')]){errors+=0x1;delete _0x4e2757[_0x015e('0x10')];}else if(_0x4e2757[_0x015e('0x25')]){duplicates+=0x1;delete _0x4e2757[_0x015e('0x25')];}rows[_0x015e('0x2a')](_0x4e2757);}));if(total%0xc8===0x0){_0x3aabb7[_0x015e('0x65')]();return processPromises(_0x3aabb7);}},'complete':function(){return processPromises()['then'](function(){logger[_0x015e('0x66')](_0x015e('0x67'));endCsv();});},'error':function(_0x12c202,_0x212e0b){logger[_0x015e('0x66')]('CSV\x20parse\x20error',JSON[_0x015e('0x2e')](_0x12c202));endCsv();}});})[_0x015e('0x2c')](function(_0x31f0c5){logger[_0x015e('0x10')](_0x015e('0x68'),JSON[_0x015e('0x2e')](_0x31f0c5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6a88be6..7a6f8b7 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 _0x1f2d=['campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','catch','voice_queues_has_cm_lists.CmListId=','set','offset','dialTimezone','main','stringify','send','start','clone','socket_timestamp','.csv','header','ContactItemType','name','_description','writeFileSync','data','rows','errors','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','description','SystemRow','emit','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','create','PHONE','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.createdAt','fields','field','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','scheduledat','UserId','cm_hopper_black','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','min_id','info','error','message','exit','code','sequelize','query','spread','campaigns.id','campaigns.dialTimezone','campaigns'];(function(_0x2aeac7,_0x1995e0){var _0x128bc4=function(_0x5ed43d){while(--_0x5ed43d){_0x2aeac7['push'](_0x2aeac7['shift']());}};_0x128bc4(++_0x1995e0);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x1f2d[_0x4b1032];return _0x5a1d55;};'use strict';var fs=require('fs');var path=require(_0xd1f2('0x0'));var _=require(_0xd1f2('0x1'));var Papa=require(_0xd1f2('0x2'));var util=require(_0xd1f2('0x3'));var BPromise=require('bluebird');var moment=require(_0xd1f2('0x4'));var squel=require(_0xd1f2('0x5'));var Redis=require(_0xd1f2('0x6'));var db=require(_0xd1f2('0x7'))['db'];var config=require(_0xd1f2('0x8'));var shared=require(_0xd1f2('0x9'));var logger=require(_0xd1f2('0xa'))(_0xd1f2('0xb'));config[_0xd1f2('0xc')]=_[_0xd1f2('0xd')](config[_0xd1f2('0xc')],{'host':_0xd1f2('0xe'),'port':0x18eb});var socket=require(_0xd1f2('0xf'))(new Redis(config[_0xd1f2('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xd1f2('0x10')](_0xd1f2('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xd1f2('0x10')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x309e6a){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))*$/[_0xd1f2('0x12')](_0x309e6a);}function selectNotIn(_0x34bd59,_0x2073c7,_0x48f3d7,_0x3f8dbc,_0x3ff96b){return squel[_0xd1f2('0x13')]()['field'](_0xd1f2('0x14'))[_0xd1f2('0x15')](_0x3f8dbc)[_0xd1f2('0x16')](_0x2073c7,null,_0x2073c7+_0xd1f2('0x17')+_0x3f8dbc+'.'+_0x48f3d7)[_0xd1f2('0x18')](_0x3f8dbc+'.'+_0x48f3d7+_0xd1f2('0x19')+_0x34bd59+'.'+_0x48f3d7)[_0xd1f2('0x18')](_0x2073c7+'.dialCheckDuplicateType\x20IN\x20('+_0x3ff96b[_0xd1f2('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5a3c44,_0x50648f){promisesAdditionalPhones=[];return db['CmContact'][_0xd1f2('0x1a')]({'raw':!![],'attributes':['id',_0xd1f2('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xd1f2('0x1c')](function(_0x1bd6ac){if(_0x1bd6ac!==null){var _0x2b4c50=[];for(var _0x3315b1=0x0;_0x3315b1<_0x1bd6ac[_0xd1f2('0x1d')];_0x3315b1++){var _0x59433d=_0x1bd6ac[_0x3315b1];_0x2b4c50[_0xd1f2('0x1e')](insertAdditionalPhones(_0x59433d));}}Promise[_0xd1f2('0x1f')](_0x2b4c50)[_0xd1f2('0x1c')](function(){_0x5a3c44({'val':0x1});});});});}function insertAdditionalPhones(_0x2301dd){return new Promise(function(_0x1f05f4,_0x1a3332){var _0x426854=_0x2301dd['AdditionalPhones'];var _0x12343a=_0x426854[_0xd1f2('0x20')](';');var _0x214a99=[];orderBy=0x0;for(var _0x29a817=0x0;_0x29a817<_0x12343a[_0xd1f2('0x1d')];_0x29a817++){_0x214a99[_0xd1f2('0x1e')](splitAdditionalPhone(_0x2301dd['id'],_0x12343a[_0x29a817]));}Promise[_0xd1f2('0x1f')](_0x214a99)[_0xd1f2('0x1c')](function(){_0x1f05f4({'val':_0x12343a[_0xd1f2('0x1d')]});});});}function splitAdditionalPhone(_0x3aaefd,_0x8c7385){return new Promise(function(_0x4b74ff,_0x3ccd12){var _0x779022=_0x8c7385['split'](':');var _0x59954d=_0x779022[0x0];var _0x36c147=_0x779022[0x1];if(!_[_0xd1f2('0x21')](_0x36c147)){var _0x5a5278=_0x36c147['split']('|');var _0x4ec9a3=[];for(var _0x559243=0x0;_0x559243<_0x5a5278['length'];_0x559243++){if(_0x5a5278[_0x559243]!==''){var _0x471406=_[_0xd1f2('0x22')](promisesAdditionalPhones,{'contactId':_0x3aaefd,'phone':_0x5a5278[_0x559243]});if(_0x471406[_0xd1f2('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0xd1f2('0x1e')]({'contactId':_0x3aaefd,'contactTypeId':_0x59954d,'phone':_0x5a5278[_0x559243],'orderBy':orderBy});}}}_0x4b74ff({'ok':0x1});}else _0x4b74ff({'res':0x0});});}function createAdditionalPhone(_0x1f648a,_0x493870,_0xf935fc,_0x3a99b2){var _0x215a8b='';var _0x464b1f='';var _0x10f224=_0xf935fc[_0xd1f2('0x20')]('§');_0x215a8b=_0x10f224[0x0];if(_0x10f224[_0xd1f2('0x1d')]==0x2)_0x464b1f=_0x10f224[0x1];return new Promise(function(_0x4628dd,_0x23ebcb){return db[_0xd1f2('0x23')][_0xd1f2('0x24')]({'where':{'CmContactId':_0x1f648a,'item':_0x215a8b}})['then'](function(_0x4ef315){if(_0x4ef315){return db[_0xd1f2('0x23')][_0xd1f2('0x25')]({'ItemTypeId':_0x493870,'description':_0x464b1f,'OrderBy':_0x3a99b2},{'where':{'CmContactId':_0x1f648a,'item':_0x215a8b}})['then'](function(_0x71dd2b){_0x4628dd({'res':'updated'});});}else{return db[_0xd1f2('0x23')][_0xd1f2('0x26')]({'CmContactId':_0x1f648a,'item':_0x215a8b,'description':_0x464b1f,'ItemTypeId':_0x493870,'OrderBy':_0x3a99b2,'ItemClass':_0xd1f2('0x27')})['then'](function(_0x40c086){_0x4628dd({'res':'inserted'});});}});});}function insertCmHopper(_0x5f0400,_0x144749,_0x3236d6,_0x2c850d,_0x1bb41d){var _0x4b8600=[_0xd1f2('0x28'),'cm_contacts.scheduledat',_0xd1f2('0x29'),_0xd1f2('0x2a'),_0x144749+'.'+_0x2c850d,'cm_contacts.createdAt',_0xd1f2('0x2b'),'cm_contacts.priority',_0xd1f2('0x2c'),'\x22'+_0x1bb41d+'\x22'];return squel[_0xd1f2('0x2d')]()[_0xd1f2('0x2e')](_0xd1f2('0x2f'))[_0xd1f2('0x30')]([_0xd1f2('0x14'),'scheduledat',_0xd1f2('0x31'),_0xd1f2('0x32'),_0x2c850d,_0xd1f2('0x33'),_0xd1f2('0x34'),_0xd1f2('0x35'),'UserId',_0xd1f2('0x36')],squel[_0xd1f2('0x13')]()['fields'](_0x4b8600)[_0xd1f2('0x15')](_0x144749)['join'](_0xd1f2('0x37'),null,_0xd1f2('0x38')+_0x144749+_0xd1f2('0x39'))[_0xd1f2('0x16')](_0x3236d6,null,_0x3236d6+'.id\x20=\x20'+_0x144749+'.'+_0x2c850d)[_0xd1f2('0x18')](_0x144749+_0xd1f2('0x3a'),_0x5f0400)[_0xd1f2('0x18')](_0xd1f2('0x3b'),NOW)[_0xd1f2('0x18')](_0xd1f2('0x3c'),selectNotIn(_0x144749,_0x3236d6,_0x2c850d,_0xd1f2('0x2f'),['\x22always\x22',_0xd1f2('0x3d')]))['where'](_0xd1f2('0x3c'),selectNotIn(_0x144749,_0x3236d6,_0x2c850d,_0xd1f2('0x2f'),[_0xd1f2('0x3e')])))['toString']();}function insertCmHopperBlack(_0x258d3f,_0x5e4030,_0x3e2a47,_0x3aa62d){var _0x3c4cc1=[_0xd1f2('0x28'),_0xd1f2('0x29'),'cm_contacts.ListId',_0x5e4030+'.'+_0x3aa62d,_0xd1f2('0x3f'),_0xd1f2('0x2b')];return squel['insert']()[_0xd1f2('0x2e')]('cm_hopper_black')[_0xd1f2('0x30')]([_0xd1f2('0x14'),_0xd1f2('0x31'),'ListId',_0x3aa62d,_0xd1f2('0x33'),'updatedAt'],squel[_0xd1f2('0x13')]()[_0xd1f2('0x40')](_0x3c4cc1)[_0xd1f2('0x15')](_0x5e4030)[_0xd1f2('0x16')](_0xd1f2('0x37'),null,_0xd1f2('0x38')+_0x5e4030+_0xd1f2('0x39'))[_0xd1f2('0x16')](_0x3e2a47,null,_0x3e2a47+'.id\x20=\x20'+_0x5e4030+'.'+_0x3aa62d)[_0xd1f2('0x18')](_0x5e4030+_0xd1f2('0x3a'),_0x258d3f)[_0xd1f2('0x18')](_0xd1f2('0x3b'),NOW)[_0xd1f2('0x18')](_0xd1f2('0x3c'),squel['select']()[_0xd1f2('0x41')](_0xd1f2('0x14'))[_0xd1f2('0x15')]('cm_hopper_black')[_0xd1f2('0x18')](_0xd1f2('0x42'),_0x258d3f)[_0xd1f2('0x18')](_0x3aa62d+_0xd1f2('0x19')+_0x5e4030+'.'+_0x3aa62d)))[_0xd1f2('0x43')]();}function insertTzCmHopper(_0x171f2c,_0x4aa258,_0x31af57,_0x459d5d,_0x3f555f,_0x2756a0){var _0x590e89=[_0xd1f2('0x28'),_0xd1f2('0x44')+_0x2756a0+'.offset-cm_contacts.utcOffset\x20minute)',_0xd1f2('0x29'),'cm_contacts.ListId',_0x4aa258+'.'+_0x459d5d,_0xd1f2('0x3f'),'cm_contacts.updatedAt',_0xd1f2('0x45'),_0xd1f2('0x2c'),'\x22'+_0x3f555f+'\x22'];var _0x45b0c6=squel[_0xd1f2('0x2d')]()[_0xd1f2('0x2e')](_0xd1f2('0x2f'))['fromQuery']([_0xd1f2('0x14'),_0xd1f2('0x46'),_0xd1f2('0x31'),_0xd1f2('0x32'),_0x459d5d,_0xd1f2('0x33'),'updatedAt',_0xd1f2('0x35'),_0xd1f2('0x47'),_0xd1f2('0x36')],squel[_0xd1f2('0x13')]()[_0xd1f2('0x40')](_0x590e89)['from'](_0x4aa258)[_0xd1f2('0x16')](_0xd1f2('0x37'),null,_0xd1f2('0x38')+_0x4aa258+_0xd1f2('0x39'))[_0xd1f2('0x16')](_0x31af57,null,_0x31af57+_0xd1f2('0x17')+_0x4aa258+'.'+_0x459d5d)[_0xd1f2('0x16')](_0x2756a0,null,_0x2756a0+_0xd1f2('0x17')+_0x4aa258+'.'+_0x459d5d)[_0xd1f2('0x18')](_0x4aa258+_0xd1f2('0x3a'),_0x171f2c)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xd1f2('0x18')](_0xd1f2('0x3c'),selectNotIn(_0x4aa258,_0x31af57,_0x459d5d,_0xd1f2('0x2f'),[_0xd1f2('0x3e'),_0xd1f2('0x3d')]))['where'](_0xd1f2('0x3c'),selectNotIn(_0x4aa258,_0x31af57,_0x459d5d,_0xd1f2('0x2f'),['\x22always\x22'])))[_0xd1f2('0x43')]();return _0x45b0c6;}function insertTzCmHopperBlack(_0x3625af,_0x14a73d,_0x3d85f6,_0x5315a7){var _0x4b2b13=[_0xd1f2('0x28'),_0xd1f2('0x29'),'cm_contacts.ListId',_0x14a73d+'.'+_0x5315a7,'cm_contacts.createdAt',_0xd1f2('0x2b')];return squel[_0xd1f2('0x2d')]()['into'](_0xd1f2('0x48'))[_0xd1f2('0x30')]([_0xd1f2('0x14'),_0xd1f2('0x31'),_0xd1f2('0x32'),_0x5315a7,_0xd1f2('0x33'),_0xd1f2('0x34')],squel[_0xd1f2('0x13')]()[_0xd1f2('0x40')](_0x4b2b13)[_0xd1f2('0x15')](_0x14a73d)[_0xd1f2('0x16')]('cm_contacts',null,_0xd1f2('0x38')+_0x14a73d+'.CmListId')[_0xd1f2('0x16')](_0x3d85f6,null,_0x3d85f6+'.id\x20=\x20'+_0x14a73d+'.'+_0x5315a7)[_0xd1f2('0x18')](_0x14a73d+_0xd1f2('0x3a'),_0x3625af)[_0xd1f2('0x18')](_0xd1f2('0x3b'),NOW)[_0xd1f2('0x18')](_0xd1f2('0x3c'),squel[_0xd1f2('0x13')]()[_0xd1f2('0x41')]('phone')[_0xd1f2('0x15')](_0xd1f2('0x48'))[_0xd1f2('0x18')](_0xd1f2('0x42'),_0x3625af)[_0xd1f2('0x18')](_0x5315a7+_0xd1f2('0x19')+_0x14a73d+'.'+_0x5315a7)))[_0xd1f2('0x43')]();}function insertCmHopperAdditionalPhones(_0x31e0b9){var _0x5c8956=['cm_hopper.id',_0xd1f2('0x49'),_0xd1f2('0x4a'),'cm_contact_has_items.createdAt',_0xd1f2('0x4b')];return squel[_0xd1f2('0x2d')]()['into'](_0xd1f2('0x4c'))['fromQuery']([_0xd1f2('0x4d'),_0xd1f2('0x14'),_0xd1f2('0x4e'),_0xd1f2('0x33'),'updatedAt'],squel['select']()[_0xd1f2('0x40')](_0x5c8956)[_0xd1f2('0x15')](_0xd1f2('0x2f'))[_0xd1f2('0x16')](_0xd1f2('0x37'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xd1f2('0x16')]('cm_contact_has_items',null,_0xd1f2('0x4f'))[_0xd1f2('0x18')](_0xd1f2('0x50'),_0x31e0b9)[_0xd1f2('0x18')](_0xd1f2('0x3b'),NOW))[_0xd1f2('0x43')]();}function insertCmContact(_0x1a96c7,_0x53d296,_0xb314e1,_0x3957a0){var _0x521cd5=_[_0xd1f2('0x51')](_[_0xd1f2('0x52')](_0x3957a0),[_0xd1f2('0x32'),_0xd1f2('0x53'),_0xd1f2('0x33'),_0xd1f2('0x34')]);return squel[_0xd1f2('0x2d')]()[_0xd1f2('0x2e')](_0xd1f2('0x37'))[_0xd1f2('0x30')](_0x521cd5,squel[_0xd1f2('0x13')]()[_0xd1f2('0x40')](_0x521cd5)[_0xd1f2('0x15')](_0x53d296)['where']('('+_0xb314e1['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xd1f2('0x13')]()[_0xd1f2('0x40')](_0xb314e1)[_0xd1f2('0x15')](_0xd1f2('0x37'))[_0xd1f2('0x18')](_0xd1f2('0x42'),_0x1a96c7)[_0xd1f2('0x18')](_0xd1f2('0x54')))[_0xd1f2('0x18')]('id\x20IN\x20?',squel['select']()['field']('MIN(id)',_0xd1f2('0x55'))[_0xd1f2('0x15')](_0x53d296)['group'](_0xb314e1[_0xd1f2('0x16')](','))))[_0xd1f2('0x43')]();}function handleStop(){logger[_0xd1f2('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2a5ec3){logger[_0xd1f2('0x57')](_0x2a5ec3[_0xd1f2('0x58')]);process[_0xd1f2('0x59')](0x1);}function handleError(_0x488ba6,_0x310106){stats['errors'][_0xd1f2('0x1e')]({'name':_0x310106[_0xd1f2('0x5a')],'message':_0x310106[_0xd1f2('0x58')],'row':_0x488ba6});}function handleQuery(_0x2b45b1){logger['info'](_0x2b45b1);return db[_0xd1f2('0x5b')][_0xd1f2('0x5c')](_0x2b45b1)[_0xd1f2('0x5d')](function(_0x9f321){results[_0xd1f2('0x1e')](_0x9f321);})['catch'](function(_0x2ca0f6){logger[_0xd1f2('0x57')](_0x2ca0f6[_0xd1f2('0x58')]);});}function updateTzCampaigns(_0x1a0191){return new Promise(function(_0x47efd1,_0x73cd5b){var _0x38f031=squel[_0xd1f2('0x13')]()[_0xd1f2('0x40')]([_0xd1f2('0x5e'),_0xd1f2('0x5f')])[_0xd1f2('0x15')](_0xd1f2('0x60'))[_0xd1f2('0x16')](_0xd1f2('0x61'),null,_0xd1f2('0x62'))[_0xd1f2('0x18')]('campaigns_has_cm_lists.CmListId='+_0x1a0191);db[_0xd1f2('0x5b')][_0xd1f2('0x5c')](_0x38f031[_0xd1f2('0x43')]())[_0xd1f2('0x5d')](function(_0x12c2f1){var _0x2df57a=[];for(var _0x3e204b=0x0;_0x3e204b<_0x12c2f1[_0xd1f2('0x1d')];_0x3e204b++){_0x2df57a[_0xd1f2('0x1e')](getTimezoneData(_0x12c2f1[_0x3e204b],tmp_campaigns));}BPromise[_0xd1f2('0x1f')](_0x2df57a)['then'](function(){_0x47efd1({'val':0x1});});})[_0xd1f2('0x63')](function(_0x2f7e7d){logger[_0xd1f2('0x57')](_0x2f7e7d['message']);_0x47efd1({'val':0x0});});});}function updateTzVoiceQueues(_0x5c7777){return new Promise(function(_0x4d29b2,_0x48c566){var _0x3a56e3=squel[_0xd1f2('0x13')]()['fields'](['voice_queues.id','voice_queues.dialTimezone'])[_0xd1f2('0x15')]('voice_queues')[_0xd1f2('0x16')]('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xd1f2('0x18')](_0xd1f2('0x64')+_0x5c7777);db['sequelize'][_0xd1f2('0x5c')](_0x3a56e3[_0xd1f2('0x43')]())[_0xd1f2('0x5d')](function(_0x35748a){var _0xb6238f=[];for(var _0x24a0e7=0x0;_0x24a0e7<_0x35748a[_0xd1f2('0x1d')];_0x24a0e7++){_0xb6238f[_0xd1f2('0x1e')](getTimezoneData(_0x35748a[_0x24a0e7],tmp_voice_queues));}BPromise[_0xd1f2('0x1f')](_0xb6238f)[_0xd1f2('0x1c')](function(){_0x4d29b2({'val':0x1});});})[_0xd1f2('0x63')](function(_0x320f48){logger[_0xd1f2('0x57')](_0x320f48[_0xd1f2('0x58')]);_0x4d29b2({'val':0x0});});});}function getTimezoneData(_0x57d300,_0xa146dd){return new Promise(function(_0x2caa0b,_0x382527){var _0x15a896=shared['timezones'];var _0x330b81=_0x15a896[_0x57d300['dialTimezone']];if(_[_0xd1f2('0x21')](_0x330b81)){_0x2caa0b({'ret':0x1});}else{var _0x3f454b=_0x330b81['utcOffset'];var _0x18aa82=squel[_0xd1f2('0x2d')]()[_0xd1f2('0x2e')](_0xa146dd)[_0xd1f2('0x65')]('id',_0x57d300['id'])[_0xd1f2('0x65')](_0xd1f2('0x66'),_0x3f454b)[_0xd1f2('0x65')](_0xd1f2('0x67'),_0x57d300[_0xd1f2('0x67')])['toString']();return db[_0xd1f2('0x5b')][_0xd1f2('0x5c')](_0x18aa82)[_0xd1f2('0x5d')](function(_0x304534){_0x2caa0b({'ret':0x1});})[_0xd1f2('0x63')](function(_0xb0b798){logger[_0xd1f2('0x57')](_0xb0b798[_0xd1f2('0x58')]);_0x382527({'ret':0x1});});}});}function handleTZQuery(_0x451efd){logger[_0xd1f2('0x56')](_0x451efd);return db[_0xd1f2('0x5b')][_0xd1f2('0x5c')](_0x451efd)[_0xd1f2('0x5d')](function(_0x5dd125){})[_0xd1f2('0x63')](function(_0x466e92){logger[_0xd1f2('0x57')](_0x466e92[_0xd1f2('0x58')]);});}function main(_0x5c9b68,_0x24b2cf,_0x486f0e,_0x32d994){logger[_0xd1f2('0x56')](_0xd1f2('0x68'),_0x5c9b68,JSON[_0xd1f2('0x69')](_0x24b2cf));process[_0xd1f2('0x6a')](_0xd1f2('0x6b'));var _0x1c464e=_0x24b2cf['binding'];var _0x26023f=_[_0xd1f2('0x6c')](_0x1c464e);var _0x14cccb=_0x24b2cf[_0xd1f2('0x6d')];var _0x4101b8=path[_0xd1f2('0x16')](config['root'],'server/files/tmp',_0x14cccb+_0xd1f2('0x6e'));hasTZ=_['keys'](_0x1c464e)['includes'](_0xd1f2('0x67'));var _0x35a649=_[_0xd1f2('0x52')](_0x1c464e)[_0xd1f2('0x16')]();logger[_0xd1f2('0x56')](_0xd1f2('0x6f'),_0x35a649);db[_0xd1f2('0x70')][_0xd1f2('0x1a')]({'raw':!![],'attributes':['id',_0xd1f2('0x71')]})[_0xd1f2('0x1c')](function(_0x3f44f9){for(var _0x43d837=0x0;_0x43d837<_0x3f44f9['length'];_0x43d837++){if(_0x3f44f9[_0x43d837]['name']in _0x1c464e){contactItemTypes[_0xd1f2('0x1e')](_0x3f44f9[_0x43d837]);delete _0x26023f[_0x3f44f9[_0x43d837][_0xd1f2('0x71')]];hasAdditionalPhones=!![];}for(var _0x2ac842 in _0x1c464e){if(_0x3f44f9[_0x43d837][_0xd1f2('0x71')]+_0xd1f2('0x72')===_0x2ac842){phoneDescriptions[_0xd1f2('0x1e')]({'itemTypeId':_0x3f44f9[_0x43d837]['id'],'description':_0x2ac842});delete _0x26023f[_0x2ac842];}}}if(hasAdditionalPhones)_0x26023f[_0xd1f2('0x1b')]='';var _0x499458=_['keys'](_0x26023f)[_0xd1f2('0x16')]();logger[_0xd1f2('0x56')](_0xd1f2('0x6f'),_0x499458);fs[_0xd1f2('0x73')](_0x4101b8,_0x499458+'\x0a');Papa['parse'](fs['createReadStream'](_0x5c9b68),{'header':!![],'skipEmptyLines':!![],'step':function(_0xcf5cf9,_0x3d2c9b){try{for(var _0x1816d1=0x0,_0x38294b=[];_0x1816d1<_0xcf5cf9[_0xd1f2('0x74')][_0xd1f2('0x1d')];_0x1816d1++){stats[_0xd1f2('0x75')]+=0x1;if(_0xcf5cf9[_0xd1f2('0x76')][_0x1816d1]){handleError(_0xcf5cf9[_0xd1f2('0x74')][_0x1816d1],_0xcf5cf9[_0xd1f2('0x76')][_0x1816d1]);}else{var _0x5d48b7=[];var _0x4ca93e=[];var _0x587467={};for(var _0xcf55f7 in _0x1c464e){let _0x402c99=contactItemTypes[_0xd1f2('0x77')](_0x3bc826=>_0x3bc826[_0xd1f2('0x71')]===_0xcf55f7);let _0x39854b=contactItemTypes['find'](_0x5ed50e=>_0x5ed50e['name']+_0xd1f2('0x72')===_0xcf55f7);if(_[_0xd1f2('0x21')](_0x402c99)&&_['isNil'](_0x39854b)){if(_0x1c464e[_0xd1f2('0x78')](_0xcf55f7)){if(_0xcf5cf9[_0xd1f2('0x74')][_0x1816d1][_0x1c464e[_0xcf55f7]]){var _0x1cf667=_[_0xd1f2('0x79')](_0xcf5cf9[_0xd1f2('0x74')][_0x1816d1][_0x1c464e[_0xcf55f7]][_0xd1f2('0x7a')](/"/g,'\x27'));switch(_0xcf55f7){case _0xd1f2('0x46'):var _0x21be96=moment(_0x1cf667,_0xd1f2('0x11'),!![]);if(_0x21be96[_0xd1f2('0x7b')]()){_0x38294b[_0xd1f2('0x1e')]('\x22'+_0x1cf667+'\x22');}else{_0x5d48b7[_0xd1f2('0x1e')](_0xd1f2('0x7c'));}break;case _0xd1f2('0x35'):var _0x17f809=parseInt(_0x1cf667);_0x1cf667=_[_0xd1f2('0x7d')](_0x17f809)||_0x17f809<0x0||_0x17f809>0x4?_0x32d994?0x3:0x2:_0x17f809;_0x38294b[_0xd1f2('0x1e')]('\x22'+_0x1cf667+'\x22');break;case _0xd1f2('0x47'):var _0x4c8c99=parseInt(_0x1cf667);if(_[_0xd1f2('0x7e')](_0x4c8c99)&&_[_0xd1f2('0x7f')](_0x486f0e,_0x4c8c99)){_0x38294b['push']('\x22'+_0x4c8c99+'\x22');}else{_0x5d48b7[_0xd1f2('0x1e')](_0xd1f2('0x80'));}break;case _0xd1f2('0x81'):if(isEmail(_0x1cf667)){_0x38294b[_0xd1f2('0x1e')]('\x22'+_0x1cf667+'\x22');}else{_0x5d48b7[_0xd1f2('0x1e')](_0xd1f2('0x82'));}break;case _0xd1f2('0x83'):var _0x5dc5de=moment(_0x1cf667,_0xd1f2('0x84'),!![]);if(_0x5dc5de[_0xd1f2('0x7b')]()){_0x38294b[_0xd1f2('0x1e')]('\x22'+_0x1cf667+'\x22');}else{_0x5d48b7[_0xd1f2('0x1e')](_0xd1f2('0x85'));}break;case'dialTimezone':var _0x2412a0=shared['timezones'];var _0x516ec5=_0x2412a0[_0x1cf667];if(!_[_0xd1f2('0x21')](_0x516ec5)){var _0xa54234=_0x516ec5[_0xd1f2('0x86')];_0x38294b[_0xd1f2('0x1e')]('\x22'+_0x1cf667+'\x22');_0x38294b[_0xd1f2('0x1e')]('\x22'+_0xa54234+'\x22');}break;default:_0x38294b[_0xd1f2('0x1e')]('\x22'+_0x1cf667+'\x22');}}else{switch(_0xcf55f7){case _0xd1f2('0x87'):case _0xd1f2('0x14'):_0x5d48b7[_0xd1f2('0x1e')](_0xcf55f7+_0xd1f2('0x88'));break;default:_0x38294b[_0xd1f2('0x1e')]('\x22\x22');}}}}else{var _0x7df6ca='';if(!_['isNil'](_0x402c99)){if(!_0x587467[_0xd1f2('0x78')](_0x402c99['id'])){if(!_[_0xd1f2('0x21')](_0xcf5cf9[_0xd1f2('0x74')][_0x1816d1][_0x1c464e[_0xcf55f7]])){var _0x1cf667=_[_0xd1f2('0x79')](_0xcf5cf9[_0xd1f2('0x74')][_0x1816d1][_0x1c464e[_0xcf55f7]][_0xd1f2('0x7a')](/"/g,'\x27'));var _0x1d5a72=phoneDescriptions['find'](_0x4cfa76=>_0x4cfa76['itemTypeId']===_0x402c99['id']);if(!_[_0xd1f2('0x21')](_0x1d5a72)){var _0x2daa4a=_[_0xd1f2('0x79')](_0xcf5cf9[_0xd1f2('0x74')][_0x1816d1][_0x1c464e[_0x1d5a72[_0xd1f2('0x89')]]]['replace'](/"/g,'\x27'));if(!_[_0xd1f2('0x21')](_0x2daa4a))_0x1cf667=_0x1cf667+'§'+_0x2daa4a;}if(_0x7df6ca=='')_0x7df6ca=_0x1cf667;else _0x7df6ca+='|'+_0x1cf667;}_0x4ca93e['push'](_0x402c99['id']+':'+_0x7df6ca);_0x587467[_0x402c99['id']]=0x1;}}}}if(hasAdditionalPhones){_0x38294b['push']('\x22'+_0x4ca93e[_0xd1f2('0x16')](';')+'\x22');}if(_0x5d48b7[_0xd1f2('0x1d')]){handleError(_0xcf5cf9[_0xd1f2('0x74')][_0x1816d1],{'code':_0xd1f2('0x8a'),'message':_0x5d48b7[_0xd1f2('0x16')]()});}else{fs['appendFileSync'](_0x4101b8,_0x38294b['join']()+'\x0a');}_0x38294b=[];}if(!(stats['rows']%0xc8)){socket[_0xd1f2('0x8b')]('contact:import:'+_0x14cccb,stats);stats[_0xd1f2('0x76')]=[];}}if(stopped){logger['info'](_0xd1f2('0x8c'));_0x3d2c9b[_0xd1f2('0x8d')]();}}catch(_0x50298f){handleError(_0xcf5cf9[_0xd1f2('0x74')][_0x1816d1],{'code':_0xd1f2('0x8e'),'message':_0x50298f[_0xd1f2('0x58')]});logger['error'](_0xd1f2('0x8f'),_0x50298f[_0xd1f2('0x58')]);}},'complete':function(){try{var _0x83d897=[];var _0x2325f4=[];var _0x32aca5=_0xd1f2('0x37');if(_0x24b2cf[_0xd1f2('0x90')]&&_0x24b2cf['duplicates'][_0xd1f2('0x1d')]){_0x32aca5='cm_contacts_'+_0x14cccb;_0x83d897[_0xd1f2('0x1e')](_0xd1f2('0x91')+_0x32aca5+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xd1f2('0x92')+_0x14cccb;tmp_voice_queues='voice_queues_'+_0x14cccb;_0x2325f4[_0xd1f2('0x1e')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xd1f2('0x93'));_0x2325f4[_0xd1f2('0x1e')](_0xd1f2('0x91')+tmp_voice_queues+_0xd1f2('0x93'));BPromise[_0xd1f2('0x94')](_0x2325f4,handleTZQuery)[_0xd1f2('0x1c')](function(_0x1b116f){updateTzCampaigns(_0x24b2cf['ListId'])[_0xd1f2('0x1c')](function(_0x2d6e31){updateTzVoiceQueues(_0x24b2cf[_0xd1f2('0x32')])[_0xd1f2('0x1c')](function(_0x59e723){if(hasTZ)_0x499458=_0x499458['replace'](_0xd1f2('0x67'),_0xd1f2('0x95'));var _0xbae51d=util[_0xd1f2('0x10')](_0xd1f2('0x96'),_0x4101b8,_0x32aca5,_0x499458,_0x24b2cf['ListId'],_0x24b2cf[_0xd1f2('0x53')]||null,NOW,NOW);if(_[_0xd1f2('0x21')](_0x1c464e[_0xd1f2('0x46')])){_0xbae51d+=_0xd1f2('0x97');}_0x83d897[_0xd1f2('0x1e')](_0xbae51d);if(_0x24b2cf[_0xd1f2('0x90')]&&_0x24b2cf[_0xd1f2('0x90')][_0xd1f2('0x1d')]){_0x83d897[_0xd1f2('0x1e')](insertCmContact(_0x24b2cf['ListId'],_0x32aca5,_0x24b2cf[_0xd1f2('0x90')],_0x1c464e));_0x83d897[_0xd1f2('0x1e')](_0xd1f2('0x98')+_0x32aca5+';');}BPromise['each'](_0x83d897,handleQuery)[_0xd1f2('0x1c')](function(_0x50b846){BPromise[_0xd1f2('0x1f')]([handleAdditionalPhones()])[_0xd1f2('0x1c')](function(){_0x83d897=[];for(var _0x447ba2=0x0;_0x447ba2\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','test','select','field','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','all','AdditionalPhones','split','push','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','insert','into','fromQuery','phone','scheduledat','ContactId','ListId','priority','UserId','recallme','fields'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x2cdd('0x0'));var _=require(_0x2cdd('0x1'));var Papa=require(_0x2cdd('0x2'));var util=require(_0x2cdd('0x3'));var BPromise=require('bluebird');var moment=require(_0x2cdd('0x4'));var squel=require(_0x2cdd('0x5'));var Redis=require(_0x2cdd('0x6'));var db=require(_0x2cdd('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x2cdd('0x8'));var logger=require(_0x2cdd('0x9'))('import');config[_0x2cdd('0xa')]=_[_0x2cdd('0xb')](config[_0x2cdd('0xa')],{'host':_0x2cdd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x2cdd('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x2cdd('0xd'));function isEmail(_0x3e3cf0){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))*$/[_0x2cdd('0xe')](_0x3e3cf0);}function selectNotIn(_0x555ba7,_0x3feff9,_0xa4b1b8,_0x315b10,_0x20ab30){return squel[_0x2cdd('0xf')]()[_0x2cdd('0x10')]('phone')['from'](_0x315b10)[_0x2cdd('0x11')](_0x3feff9,null,_0x3feff9+_0x2cdd('0x12')+_0x315b10+'.'+_0xa4b1b8)['where'](_0x315b10+'.'+_0xa4b1b8+_0x2cdd('0x13')+_0x555ba7+'.'+_0xa4b1b8)[_0x2cdd('0x14')](_0x3feff9+_0x2cdd('0x15')+_0x20ab30[_0x2cdd('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4093f,_0x5934bd){promisesAdditionalPhones=[];return db[_0x2cdd('0x16')][_0x2cdd('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x2cdd('0x18')](function(_0x1c6bc7){if(_0x1c6bc7!==null){var _0x1e8479=[];for(var _0x1767d5=0x0;_0x1767d5<_0x1c6bc7[_0x2cdd('0x19')];_0x1767d5++){var _0x2587fb=_0x1c6bc7[_0x1767d5];_0x1e8479['push'](insertAdditionalPhones(_0x2587fb));}}Promise[_0x2cdd('0x1a')](_0x1e8479)[_0x2cdd('0x18')](function(){_0x4093f({'val':0x1});});});});}function insertAdditionalPhones(_0x281101){return new Promise(function(_0x23eb4e,_0x57fcb8){var _0x23f7a6=_0x281101[_0x2cdd('0x1b')];var _0x240cdf=_0x23f7a6[_0x2cdd('0x1c')](';');var _0x3056e7=[];orderBy=0x0;for(var _0x871fd2=0x0;_0x871fd2<_0x240cdf[_0x2cdd('0x19')];_0x871fd2++){_0x3056e7[_0x2cdd('0x1d')](splitAdditionalPhone(_0x281101['id'],_0x240cdf[_0x871fd2]));}Promise[_0x2cdd('0x1a')](_0x3056e7)[_0x2cdd('0x18')](function(){_0x23eb4e({'val':_0x240cdf['length']});});});}function splitAdditionalPhone(_0x4fab7a,_0x206942){return new Promise(function(_0x5e874e,_0x50fdcb){var _0x1ea860=_0x206942[_0x2cdd('0x1c')](':');var _0x3ea948=_0x1ea860[0x0];var _0x1f436a=_0x1ea860[0x1];if(!_['isNil'](_0x1f436a)){var _0x5a7b76=_0x1f436a[_0x2cdd('0x1c')]('|');var _0x1194d5=[];for(var _0x340a47=0x0;_0x340a47<_0x5a7b76[_0x2cdd('0x19')];_0x340a47++){if(_0x5a7b76[_0x340a47]!==''){var _0x7a0d70=_[_0x2cdd('0x1e')](promisesAdditionalPhones,{'contactId':_0x4fab7a,'phone':_0x5a7b76[_0x340a47]});if(_0x7a0d70[_0x2cdd('0x19')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x4fab7a,'contactTypeId':_0x3ea948,'phone':_0x5a7b76[_0x340a47],'orderBy':orderBy});}}}_0x5e874e({'ok':0x1});}else _0x5e874e({'res':0x0});});}function createAdditionalPhone(_0x7d2aa4,_0x3327fa,_0xda5a64,_0x5a8eff){var _0x4cbc21='';var _0x5ef69f='';var _0x17d25d=_0xda5a64[_0x2cdd('0x1c')]('§');_0x4cbc21=_0x17d25d[0x0];if(_0x17d25d['length']==0x2)_0x5ef69f=_0x17d25d[0x1];return new Promise(function(_0x49669c,_0x42cd1a){return db[_0x2cdd('0x1f')][_0x2cdd('0x20')]({'where':{'CmContactId':_0x7d2aa4,'item':_0x4cbc21}})[_0x2cdd('0x18')](function(_0x33117f){if(_0x33117f){return db['CmContactHasItem'][_0x2cdd('0x21')]({'ItemTypeId':_0x3327fa,'description':_0x5ef69f,'OrderBy':_0x5a8eff},{'where':{'CmContactId':_0x7d2aa4,'item':_0x4cbc21}})[_0x2cdd('0x18')](function(_0x1f837a){_0x49669c({'res':_0x2cdd('0x22')});});}else{return db['CmContactHasItem'][_0x2cdd('0x23')]({'CmContactId':_0x7d2aa4,'item':_0x4cbc21,'description':_0x5ef69f,'ItemTypeId':_0x3327fa,'OrderBy':_0x5a8eff,'ItemClass':_0x2cdd('0x24')})['then'](function(_0x1ca10a){_0x49669c({'res':_0x2cdd('0x25')});});}});});}function insertCmHopper(_0x439010,_0x1725a0,_0x1326ce,_0x41f1fd,_0x46b08e){var _0x1a7552=[_0x2cdd('0x26'),'cm_contacts.scheduledat',_0x2cdd('0x27'),_0x2cdd('0x28'),_0x1725a0+'.'+_0x41f1fd,_0x2cdd('0x29'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x46b08e+'\x22'];return squel[_0x2cdd('0x2a')]()[_0x2cdd('0x2b')]('cm_hopper')[_0x2cdd('0x2c')]([_0x2cdd('0x2d'),_0x2cdd('0x2e'),_0x2cdd('0x2f'),_0x2cdd('0x30'),_0x41f1fd,'createdAt','updatedAt',_0x2cdd('0x31'),_0x2cdd('0x32'),_0x2cdd('0x33')],squel[_0x2cdd('0xf')]()[_0x2cdd('0x34')](_0x1a7552)['from'](_0x1725a0)[_0x2cdd('0x11')](_0x2cdd('0x35'),null,_0x2cdd('0x36')+_0x1725a0+_0x2cdd('0x37'))[_0x2cdd('0x11')](_0x1326ce,null,_0x1326ce+_0x2cdd('0x12')+_0x1725a0+'.'+_0x41f1fd)[_0x2cdd('0x14')](_0x1725a0+'.CmListId\x20=\x20?',_0x439010)[_0x2cdd('0x14')](_0x2cdd('0x38'),NOW)[_0x2cdd('0x14')](_0x2cdd('0x39'),selectNotIn(_0x1725a0,_0x1326ce,_0x41f1fd,_0x2cdd('0x3a'),[_0x2cdd('0x3b'),_0x2cdd('0x3c')]))[_0x2cdd('0x14')](_0x2cdd('0x39'),selectNotIn(_0x1725a0,_0x1326ce,_0x41f1fd,'cm_hopper',['\x22always\x22'])))[_0x2cdd('0x3d')]();}function insertCmHopperBlack(_0x20ee21,_0x1f4a77,_0x492985,_0x45e423){var _0x59e7d8=['cm_contacts.phone',_0x2cdd('0x27'),_0x2cdd('0x28'),_0x1f4a77+'.'+_0x45e423,_0x2cdd('0x29'),_0x2cdd('0x3e')];return squel[_0x2cdd('0x2a')]()[_0x2cdd('0x2b')](_0x2cdd('0x3f'))[_0x2cdd('0x2c')]([_0x2cdd('0x2d'),'ContactId',_0x2cdd('0x30'),_0x45e423,_0x2cdd('0x40'),_0x2cdd('0x41')],squel['select']()[_0x2cdd('0x34')](_0x59e7d8)[_0x2cdd('0x42')](_0x1f4a77)[_0x2cdd('0x11')](_0x2cdd('0x35'),null,_0x2cdd('0x36')+_0x1f4a77+'.CmListId')['join'](_0x492985,null,_0x492985+_0x2cdd('0x12')+_0x1f4a77+'.'+_0x45e423)[_0x2cdd('0x14')](_0x1f4a77+_0x2cdd('0x43'),_0x20ee21)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2cdd('0x14')](_0x2cdd('0x39'),squel['select']()['field'](_0x2cdd('0x2d'))[_0x2cdd('0x42')](_0x2cdd('0x3f'))[_0x2cdd('0x14')](_0x2cdd('0x44'),_0x20ee21)[_0x2cdd('0x14')](_0x45e423+_0x2cdd('0x13')+_0x1f4a77+'.'+_0x45e423)))[_0x2cdd('0x3d')]();}function insertTzCmHopper(_0x1bb4c6,_0x1458f5,_0xc62693,_0x5a09e4,_0x1310a1,_0x1f9fb3){var _0x2ff7ff=['cm_contacts.phone',_0x2cdd('0x45')+_0x1f9fb3+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0x2cdd('0x28'),_0x1458f5+'.'+_0x5a09e4,'cm_contacts.createdAt',_0x2cdd('0x3e'),_0x2cdd('0x46'),_0x2cdd('0x47'),'\x22'+_0x1310a1+'\x22'];var _0x4c55f5=squel[_0x2cdd('0x2a')]()[_0x2cdd('0x2b')](_0x2cdd('0x3a'))[_0x2cdd('0x2c')]([_0x2cdd('0x2d'),_0x2cdd('0x2e'),_0x2cdd('0x2f'),_0x2cdd('0x30'),_0x5a09e4,'createdAt',_0x2cdd('0x41'),_0x2cdd('0x31'),_0x2cdd('0x32'),_0x2cdd('0x33')],squel[_0x2cdd('0xf')]()[_0x2cdd('0x34')](_0x2ff7ff)['from'](_0x1458f5)[_0x2cdd('0x11')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1458f5+_0x2cdd('0x37'))[_0x2cdd('0x11')](_0xc62693,null,_0xc62693+'.id\x20=\x20'+_0x1458f5+'.'+_0x5a09e4)['join'](_0x1f9fb3,null,_0x1f9fb3+_0x2cdd('0x12')+_0x1458f5+'.'+_0x5a09e4)['where'](_0x1458f5+_0x2cdd('0x43'),_0x1bb4c6)[_0x2cdd('0x14')](_0x2cdd('0x38'),NOW)[_0x2cdd('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1458f5,_0xc62693,_0x5a09e4,_0x2cdd('0x3a'),['\x22always\x22','\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1458f5,_0xc62693,_0x5a09e4,'cm_hopper',[_0x2cdd('0x3b')])))[_0x2cdd('0x3d')]();return _0x4c55f5;}function insertTzCmHopperBlack(_0x3a99c7,_0x231d1c,_0x7dd297,_0x3761e4){var _0x446b97=[_0x2cdd('0x26'),'cm_contacts.id',_0x2cdd('0x28'),_0x231d1c+'.'+_0x3761e4,_0x2cdd('0x29'),_0x2cdd('0x3e')];return squel[_0x2cdd('0x2a')]()[_0x2cdd('0x2b')](_0x2cdd('0x3f'))[_0x2cdd('0x2c')](['phone',_0x2cdd('0x2f'),_0x2cdd('0x30'),_0x3761e4,_0x2cdd('0x40'),_0x2cdd('0x41')],squel[_0x2cdd('0xf')]()['fields'](_0x446b97)[_0x2cdd('0x42')](_0x231d1c)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x231d1c+'.CmListId')[_0x2cdd('0x11')](_0x7dd297,null,_0x7dd297+_0x2cdd('0x12')+_0x231d1c+'.'+_0x3761e4)[_0x2cdd('0x14')](_0x231d1c+_0x2cdd('0x43'),_0x3a99c7)['where'](_0x2cdd('0x38'),NOW)[_0x2cdd('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x2cdd('0xf')]()[_0x2cdd('0x10')](_0x2cdd('0x2d'))[_0x2cdd('0x42')](_0x2cdd('0x3f'))[_0x2cdd('0x14')](_0x2cdd('0x44'),_0x3a99c7)['where'](_0x3761e4+_0x2cdd('0x13')+_0x231d1c+'.'+_0x3761e4)))[_0x2cdd('0x3d')]();}function insertCmHopperAdditionalPhones(_0x1cd5ea){var _0x56eca2=[_0x2cdd('0x48'),'cm_contact_has_items.item',_0x2cdd('0x49'),_0x2cdd('0x4a'),_0x2cdd('0x4b')];return squel[_0x2cdd('0x2a')]()['into'](_0x2cdd('0x4c'))[_0x2cdd('0x2c')]([_0x2cdd('0x4d'),_0x2cdd('0x2d'),'OrderBy',_0x2cdd('0x40'),'updatedAt'],squel[_0x2cdd('0xf')]()[_0x2cdd('0x34')](_0x56eca2)[_0x2cdd('0x42')]('cm_hopper')[_0x2cdd('0x11')](_0x2cdd('0x35'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x2cdd('0x11')](_0x2cdd('0x4e'),null,_0x2cdd('0x4f'))['where']('cm_hopper.ListId\x20=\x20?',_0x1cd5ea)['where'](_0x2cdd('0x38'),NOW))['toString']();}function insertCmContact(_0x3b3953,_0x19a3a5,_0x4e5863,_0xbbfe4b){var _0x5556e9=_[_0x2cdd('0x50')](_[_0x2cdd('0x51')](_0xbbfe4b),[_0x2cdd('0x30'),_0x2cdd('0x52'),'createdAt','updatedAt']);return squel['insert']()[_0x2cdd('0x2b')](_0x2cdd('0x35'))['fromQuery'](_0x5556e9,squel['select']()[_0x2cdd('0x34')](_0x5556e9)['from'](_0x19a3a5)[_0x2cdd('0x14')]('('+_0x4e5863[_0x2cdd('0x11')](',')+_0x2cdd('0x53'),squel[_0x2cdd('0xf')]()[_0x2cdd('0x34')](_0x4e5863)['from'](_0x2cdd('0x35'))[_0x2cdd('0x14')](_0x2cdd('0x44'),_0x3b3953)['where'](_0x2cdd('0x54')))[_0x2cdd('0x14')]('id\x20IN\x20?',squel[_0x2cdd('0xf')]()[_0x2cdd('0x10')]('MIN(id)','min_id')[_0x2cdd('0x42')](_0x19a3a5)[_0x2cdd('0x55')](_0x4e5863[_0x2cdd('0x11')](','))))[_0x2cdd('0x3d')]();}function handleStop(){logger[_0x2cdd('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x7c0da1){logger['error'](_0x7c0da1[_0x2cdd('0x57')]);process['exit'](0x1);}function handleError(_0x247a3e,_0x7ce6c8){stats[_0x2cdd('0x58')][_0x2cdd('0x1d')]({'name':_0x7ce6c8['code'],'message':_0x7ce6c8[_0x2cdd('0x57')],'row':_0x247a3e});}function handleQuery(_0x6b70ee){logger['info'](_0x6b70ee);return db['sequelize'][_0x2cdd('0x59')](_0x6b70ee)[_0x2cdd('0x5a')](function(_0x1b13ba){results[_0x2cdd('0x1d')](_0x1b13ba);})['catch'](function(_0x190329){logger[_0x2cdd('0x5b')](_0x190329[_0x2cdd('0x57')]);});}function updateTzCampaigns(_0x3c4bbd){return new Promise(function(_0x222333,_0x358e3d){var _0x12e3cc=squel[_0x2cdd('0xf')]()[_0x2cdd('0x34')]([_0x2cdd('0x5c'),'campaigns.dialTimezone'])[_0x2cdd('0x42')]('campaigns')['join'](_0x2cdd('0x5d'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x2cdd('0x14')](_0x2cdd('0x5e')+_0x3c4bbd);db['sequelize']['query'](_0x12e3cc['toString']())['spread'](function(_0x510f39){var _0x47643e=[];for(var _0x2724c6=0x0;_0x2724c6<_0x510f39['length'];_0x2724c6++){_0x47643e[_0x2cdd('0x1d')](getTimezoneData(_0x510f39[_0x2724c6],tmp_campaigns));}BPromise[_0x2cdd('0x1a')](_0x47643e)[_0x2cdd('0x18')](function(){_0x222333({'val':0x1});});})['catch'](function(_0x2f2ee1){logger[_0x2cdd('0x5b')](_0x2f2ee1[_0x2cdd('0x57')]);_0x222333({'val':0x0});});});}function updateTzVoiceQueues(_0x1bdb04){return new Promise(function(_0x1bda3e,_0x2d9908){var _0x31843a=squel[_0x2cdd('0xf')]()['fields']([_0x2cdd('0x5f'),_0x2cdd('0x60')])[_0x2cdd('0x42')](_0x2cdd('0x61'))[_0x2cdd('0x11')](_0x2cdd('0x62'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x2cdd('0x14')](_0x2cdd('0x63')+_0x1bdb04);db[_0x2cdd('0x64')][_0x2cdd('0x59')](_0x31843a[_0x2cdd('0x3d')]())['spread'](function(_0x6eec77){var _0x3e7682=[];for(var _0x44d21d=0x0;_0x44d21d<_0x6eec77[_0x2cdd('0x19')];_0x44d21d++){_0x3e7682['push'](getTimezoneData(_0x6eec77[_0x44d21d],tmp_voice_queues));}BPromise[_0x2cdd('0x1a')](_0x3e7682)[_0x2cdd('0x18')](function(){_0x1bda3e({'val':0x1});});})[_0x2cdd('0x65')](function(_0x3d801e){logger[_0x2cdd('0x5b')](_0x3d801e['message']);_0x1bda3e({'val':0x0});});});}function getTimezoneData(_0x178a5b,_0x56b3b0){return new Promise(function(_0x5ba42b,_0x151a97){var _0x44867d=shared[_0x2cdd('0x66')];var _0x446526=_0x44867d[_0x178a5b['dialTimezone']];if(_[_0x2cdd('0x67')](_0x446526)){_0x5ba42b({'ret':0x1});}else{var _0x2175ea=_0x446526['utcOffset'];var _0x34de0f=squel[_0x2cdd('0x2a')]()[_0x2cdd('0x2b')](_0x56b3b0)['set']('id',_0x178a5b['id'])[_0x2cdd('0x68')]('offset',_0x2175ea)[_0x2cdd('0x68')]('dialTimezone',_0x178a5b[_0x2cdd('0x69')])['toString']();return db[_0x2cdd('0x64')][_0x2cdd('0x59')](_0x34de0f)['spread'](function(_0x514015){_0x5ba42b({'ret':0x1});})['catch'](function(_0x5ac599){logger[_0x2cdd('0x5b')](_0x5ac599[_0x2cdd('0x57')]);_0x151a97({'ret':0x1});});}});}function handleTZQuery(_0x45b262){logger[_0x2cdd('0x56')](_0x45b262);return db[_0x2cdd('0x64')]['query'](_0x45b262)['spread'](function(_0x23d209){})[_0x2cdd('0x65')](function(_0x1b10c6){logger[_0x2cdd('0x5b')](_0x1b10c6[_0x2cdd('0x57')]);});}function main(_0x310917,_0x30b0ad,_0x2ab2d4,_0x305e12){logger['info'](_0x2cdd('0x6a'),_0x310917,JSON['stringify'](_0x30b0ad));process[_0x2cdd('0x6b')](_0x2cdd('0x6c'));var _0x50260a=_0x30b0ad[_0x2cdd('0x6d')];var _0x8daa11=_[_0x2cdd('0x6e')](_0x50260a);var _0x23a902=_0x30b0ad[_0x2cdd('0x6f')];var _0x1345c9=path['join'](config[_0x2cdd('0x70')],_0x2cdd('0x71'),_0x23a902+_0x2cdd('0x72'));hasTZ=_['keys'](_0x50260a)[_0x2cdd('0x73')]('dialTimezone');var _0x4126ff=_[_0x2cdd('0x51')](_0x50260a)[_0x2cdd('0x11')]();logger['info'](_0x2cdd('0x74'),_0x4126ff);db['ContactItemType'][_0x2cdd('0x17')]({'raw':!![],'attributes':['id',_0x2cdd('0x75')]})[_0x2cdd('0x18')](function(_0x553933){for(var _0x3f9f97=0x0;_0x3f9f97<_0x553933[_0x2cdd('0x19')];_0x3f9f97++){if(_0x553933[_0x3f9f97][_0x2cdd('0x75')]in _0x50260a){contactItemTypes[_0x2cdd('0x1d')](_0x553933[_0x3f9f97]);delete _0x8daa11[_0x553933[_0x3f9f97][_0x2cdd('0x75')]];hasAdditionalPhones=!![];}for(var _0x2182d6 in _0x50260a){if(_0x553933[_0x3f9f97]['name']+_0x2cdd('0x76')===_0x2182d6){phoneDescriptions[_0x2cdd('0x1d')]({'itemTypeId':_0x553933[_0x3f9f97]['id'],'description':_0x2182d6});delete _0x8daa11[_0x2182d6];}}}if(hasAdditionalPhones)_0x8daa11[_0x2cdd('0x1b')]='';var _0x2d95d7=_[_0x2cdd('0x51')](_0x8daa11)[_0x2cdd('0x11')]();logger[_0x2cdd('0x56')](_0x2cdd('0x74'),_0x2d95d7);fs[_0x2cdd('0x77')](_0x1345c9,_0x2d95d7+'\x0a');Papa[_0x2cdd('0x78')](fs[_0x2cdd('0x79')](_0x310917),{'header':!![],'skipEmptyLines':!![],'step':function(_0x11f0d6,_0x588052){try{for(var _0x5ccd86=0x0,_0x40a265=[];_0x5ccd86<_0x11f0d6['data'][_0x2cdd('0x19')];_0x5ccd86++){stats[_0x2cdd('0x7a')]+=0x1;if(_0x11f0d6[_0x2cdd('0x58')][_0x5ccd86]){handleError(_0x11f0d6[_0x2cdd('0x7b')][_0x5ccd86],_0x11f0d6[_0x2cdd('0x58')][_0x5ccd86]);}else{var _0x29d548=[];var _0x4fda23=[];var _0x32c759={};for(var _0xf89299 in _0x50260a){let _0x14ccdb=contactItemTypes[_0x2cdd('0x7c')](_0x5dd996=>_0x5dd996[_0x2cdd('0x75')]===_0xf89299);let _0x12386b=contactItemTypes[_0x2cdd('0x7c')](_0x442b87=>_0x442b87[_0x2cdd('0x75')]+_0x2cdd('0x76')===_0xf89299);if(_[_0x2cdd('0x67')](_0x14ccdb)&&_['isNil'](_0x12386b)){if(_0x50260a['hasOwnProperty'](_0xf89299)){if(_0x11f0d6[_0x2cdd('0x7b')][_0x5ccd86][_0x50260a[_0xf89299]]){var _0x157c07=_[_0x2cdd('0x7d')](_0x11f0d6[_0x2cdd('0x7b')][_0x5ccd86][_0x50260a[_0xf89299]][_0x2cdd('0x7e')](/"/g,'\x27'));switch(_0xf89299){case _0x2cdd('0x2e'):var _0x19c05d=moment(_0x157c07,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x19c05d[_0x2cdd('0x7f')]()){_0x40a265[_0x2cdd('0x1d')]('\x22'+_0x157c07+'\x22');}else{_0x29d548[_0x2cdd('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2cdd('0x31'):var _0x4c61eb=parseInt(_0x157c07);_0x157c07=_['isNaN'](_0x4c61eb)||_0x4c61eb<0x0||_0x4c61eb>0x4?_0x305e12?0x3:0x2:_0x4c61eb;_0x40a265[_0x2cdd('0x1d')]('\x22'+_0x157c07+'\x22');break;case _0x2cdd('0x32'):var _0x1db886=parseInt(_0x157c07);if(_[_0x2cdd('0x80')](_0x1db886)&&_[_0x2cdd('0x73')](_0x2ab2d4,_0x1db886)){_0x40a265[_0x2cdd('0x1d')]('\x22'+_0x1db886+'\x22');}else{_0x29d548[_0x2cdd('0x1d')](_0x2cdd('0x81'));}break;case'email':if(isEmail(_0x157c07)){_0x40a265[_0x2cdd('0x1d')]('\x22'+_0x157c07+'\x22');}else{_0x29d548['push'](_0x2cdd('0x82'));}break;case _0x2cdd('0x83'):var _0xb82056=moment(_0x157c07,_0x2cdd('0x84'),!![]);if(_0xb82056[_0x2cdd('0x7f')]()){_0x40a265[_0x2cdd('0x1d')]('\x22'+_0x157c07+'\x22');}else{_0x29d548[_0x2cdd('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x2cdd('0x69'):var _0x1299d4=shared[_0x2cdd('0x66')];var _0x2cc6f1=_0x1299d4[_0x157c07];if(!_[_0x2cdd('0x67')](_0x2cc6f1)){var _0x2f0c32=_0x2cc6f1[_0x2cdd('0x85')];_0x40a265[_0x2cdd('0x1d')]('\x22'+_0x157c07+'\x22');_0x40a265[_0x2cdd('0x1d')]('\x22'+_0x2f0c32+'\x22');}break;default:_0x40a265[_0x2cdd('0x1d')]('\x22'+_0x157c07+'\x22');}}else{switch(_0xf89299){case _0x2cdd('0x86'):case _0x2cdd('0x2d'):_0x29d548[_0x2cdd('0x1d')](_0xf89299+_0x2cdd('0x87'));break;default:_0x40a265[_0x2cdd('0x1d')]('\x22\x22');}}}}else{var _0x1534f9='';if(!_[_0x2cdd('0x67')](_0x14ccdb)){if(!_0x32c759[_0x2cdd('0x88')](_0x14ccdb['id'])){if(!_[_0x2cdd('0x67')](_0x11f0d6['data'][_0x5ccd86][_0x50260a[_0xf89299]])){var _0x157c07=_[_0x2cdd('0x7d')](_0x11f0d6['data'][_0x5ccd86][_0x50260a[_0xf89299]][_0x2cdd('0x7e')](/"/g,'\x27'));var _0x51abfd=phoneDescriptions[_0x2cdd('0x7c')](_0x3c6516=>_0x3c6516['itemTypeId']===_0x14ccdb['id']);if(!_[_0x2cdd('0x67')](_0x51abfd)){var _0x2cff28=_['trim'](_0x11f0d6[_0x2cdd('0x7b')][_0x5ccd86][_0x50260a[_0x51abfd[_0x2cdd('0x89')]]][_0x2cdd('0x7e')](/"/g,'\x27'));if(!_[_0x2cdd('0x67')](_0x2cff28))_0x157c07=_0x157c07+'§'+_0x2cff28;}if(_0x1534f9=='')_0x1534f9=_0x157c07;else _0x1534f9+='|'+_0x157c07;}_0x4fda23['push'](_0x14ccdb['id']+':'+_0x1534f9);_0x32c759[_0x14ccdb['id']]=0x1;}}}}if(hasAdditionalPhones){_0x40a265[_0x2cdd('0x1d')]('\x22'+_0x4fda23['join'](';')+'\x22');}if(_0x29d548['length']){handleError(_0x11f0d6[_0x2cdd('0x7b')][_0x5ccd86],{'code':_0x2cdd('0x8a'),'message':_0x29d548[_0x2cdd('0x11')]()});}else{fs[_0x2cdd('0x8b')](_0x1345c9,_0x40a265[_0x2cdd('0x11')]()+'\x0a');}_0x40a265=[];}if(!(stats[_0x2cdd('0x7a')]%0xc8)){socket[_0x2cdd('0x8c')](_0x2cdd('0x8d')+_0x23a902,stats);stats['errors']=[];}}if(stopped){logger[_0x2cdd('0x56')](_0x2cdd('0x8e'));_0x588052[_0x2cdd('0x8f')]();}}catch(_0x3b7ea7){handleError(_0x11f0d6[_0x2cdd('0x7b')][_0x5ccd86],{'code':_0x2cdd('0x90'),'message':_0x3b7ea7['message']});logger[_0x2cdd('0x5b')](_0x2cdd('0x91'),_0x3b7ea7[_0x2cdd('0x57')]);}},'complete':function(){try{var _0x4f4888=[];var _0x4be8a1=[];var _0x505202=_0x2cdd('0x35');if(_0x30b0ad['duplicates']&&_0x30b0ad[_0x2cdd('0x92')][_0x2cdd('0x19')]){_0x505202=_0x2cdd('0x93')+_0x23a902;_0x4f4888[_0x2cdd('0x1d')](_0x2cdd('0x94')+_0x505202+_0x2cdd('0x95'));}tmp_campaigns=_0x2cdd('0x96')+_0x23a902;tmp_voice_queues=_0x2cdd('0x97')+_0x23a902;_0x4be8a1[_0x2cdd('0x1d')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x2cdd('0x98'));_0x4be8a1[_0x2cdd('0x1d')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x2cdd('0x98'));BPromise[_0x2cdd('0x99')](_0x4be8a1,handleTZQuery)[_0x2cdd('0x18')](function(_0x3e6d24){updateTzCampaigns(_0x30b0ad[_0x2cdd('0x30')])[_0x2cdd('0x18')](function(_0x1ad2a1){updateTzVoiceQueues(_0x30b0ad[_0x2cdd('0x30')])[_0x2cdd('0x18')](function(_0x555f98){if(hasTZ)_0x2d95d7=_0x2d95d7[_0x2cdd('0x7e')]('dialTimezone',_0x2cdd('0x9a'));var _0x2e256e=util[_0x2cdd('0x9b')](_0x2cdd('0x9c'),_0x1345c9,_0x505202,_0x2d95d7,_0x30b0ad[_0x2cdd('0x30')],_0x30b0ad[_0x2cdd('0x52')]||null,NOW,NOW);if(_[_0x2cdd('0x67')](_0x50260a[_0x2cdd('0x2e')])){_0x2e256e+=_0x2cdd('0x9d');}_0x4f4888[_0x2cdd('0x1d')](_0x2e256e);if(_0x30b0ad[_0x2cdd('0x92')]&&_0x30b0ad[_0x2cdd('0x92')]['length']){_0x4f4888[_0x2cdd('0x1d')](insertCmContact(_0x30b0ad[_0x2cdd('0x30')],_0x505202,_0x30b0ad[_0x2cdd('0x92')],_0x50260a));_0x4f4888[_0x2cdd('0x1d')](_0x2cdd('0x9e')+_0x505202+';');}BPromise[_0x2cdd('0x99')](_0x4f4888,handleQuery)[_0x2cdd('0x18')](function(_0x28f94f){BPromise[_0x2cdd('0x1a')]([handleAdditionalPhones()])[_0x2cdd('0x18')](function(){_0x4f4888=[];for(var _0xdd9f49=0x0;_0xdd9f49\x20\x20','root','server/files/tmp','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','from','join','.id\x20=\x20','where','\x20=\x20','sequelize','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','CmContactHasItem','updated','create','PHONE','inserted','CmContact','CmHopper','update','phone','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xf15d,0x113));var _0xdf15=function(_0x396c1c,_0x24fc77){_0x396c1c=_0x396c1c-0x0;var _0x74f196=_0xf15d[_0x396c1c];return _0x74f196;};'use strict';var fs=require('fs');var path=require(_0xdf15('0x0'));var _=require('lodash');var Papa=require(_0xdf15('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xdf15('0x2'));var squel=require(_0xdf15('0x3'));var Redis=require(_0xdf15('0x4'));var db=require(_0xdf15('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xdf15('0x6'))(_0xdf15('0x7'));config[_0xdf15('0x8')]=_['defaults'](config[_0xdf15('0x8')],{'host':_0xdf15('0x9'),'port':0x18eb});var socket=require(_0xdf15('0xa'))(new Redis(config[_0xdf15('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xdf15('0xb')](_0xdf15('0xc'));var tempTableName=_0xdf15('0xd')+moment()[_0xdf15('0xb')](_0xdf15('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x43f5ea){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))*$/[_0xdf15('0xf')](_0x43f5ea);}function selectNotIn(_0x5d7666,_0x1075dd,_0x9762b8,_0x22e309,_0x427fd7){return squel['select']()['field']('phone')[_0xdf15('0x10')](_0x22e309)[_0xdf15('0x11')](_0x1075dd,null,_0x1075dd+_0xdf15('0x12')+_0x22e309+'.'+_0x9762b8)[_0xdf15('0x13')](_0x22e309+'.'+_0x9762b8+_0xdf15('0x14')+_0x5d7666+'.'+_0x9762b8)[_0xdf15('0x13')](_0x1075dd+'.dialCheckDuplicateType\x20IN\x20('+_0x427fd7[_0xdf15('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1a66aa,_0x4f89d8){promisesAdditionalPhones=[];promisesContact=[];return db[_0xdf15('0x15')]['query'](_0xdf15('0x16')+tempTableName)['spread'](function(_0xbd1de2){if(_0xbd1de2!==null){var _0x53a875=[];for(var _0x34109e=0x0;_0x34109e<_0xbd1de2[_0xdf15('0x17')];_0x34109e++){var _0x57305d=_0xbd1de2[_0x34109e];if(!_['isNil'](_0x57305d['phone'])){if(!_[_0xdf15('0x18')](_0x57305d[_0xdf15('0x19')]))_0x53a875[_0xdf15('0x1a')](insertAdditionalPhones(_0x57305d));promisesContact['push']({'contact':_0x57305d});}}}Promise[_0xdf15('0x1b')](_0x53a875)[_0xdf15('0x1c')](function(){_0x1a66aa({'val':0x1});});})[_0xdf15('0x1d')](function(_0x8749da){logger[_0xdf15('0x1e')](_0x8749da[_0xdf15('0x1f')]);});});}function insertAdditionalPhones(_0x485449){return new Promise(function(_0x32f2f4,_0x1d3d3a){var _0x2b742c=_0x485449[_0xdf15('0x19')];if(_['isNil'](_0x2b742c))_0x1d3d3a({'val':0x0});else{var _0x235b49=_0x2b742c['split'](';');var _0x169704=[];orderBy=0x0;for(var _0x2b4d8a=0x0;_0x2b4d8a<_0x235b49[_0xdf15('0x17')];_0x2b4d8a++){_0x169704['push'](splitAdditionalPhone(_0x485449['id'],_0x235b49[_0x2b4d8a]));}Promise[_0xdf15('0x1b')](_0x169704)['then'](function(){_0x32f2f4({'val':_0x235b49[_0xdf15('0x17')]});});}});}function splitAdditionalPhone(_0x5059d8,_0x4d3701){return new Promise(function(_0x3fbbd7,_0x4b7b91){var _0x14a214=_0x4d3701['split'](':');var _0x372909=_0x14a214[0x0];var _0x4142fc=_0x14a214[0x1];if(_0x4142fc!==''){var _0x2c8d71=_0x4142fc[_0xdf15('0x20')]('|');var _0x37e13b=[];for(var _0x435f89=0x0;_0x435f89<_0x2c8d71['length'];_0x435f89++){if(_0x2c8d71[_0x435f89]!==''){var _0x518101=_[_0xdf15('0x21')](promisesAdditionalPhones,{'contactId':_0x5059d8,'phone':_0x2c8d71[_0x435f89]});if(_0x518101[_0xdf15('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0xdf15('0x1a')]({'contactId':_0x5059d8,'contactTypeId':_0x372909,'phone':_0x2c8d71[_0x435f89],'orderBy':orderBy});}}}_0x3fbbd7({'ok':0x1});}else _0x3fbbd7({'res':0x0});});}function createAdditionalPhone(_0x2a75c7,_0x351b55,_0x5e95b1,_0x5a67c1){var _0x1c761b='';var _0x194626='';var _0xac3af6=_0x5e95b1['split']('§');_0x1c761b=_0xac3af6[0x0];if(_0xac3af6[_0xdf15('0x17')]==0x2)_0x194626=_0xac3af6[0x1];return new Promise(function(_0x226b21,_0x271d31){return db[_0xdf15('0x22')]['findOne']({'where':{'CmContactId':_0x2a75c7,'item':_0x1c761b}})[_0xdf15('0x1c')](function(_0x254189){if(_0x254189){return db[_0xdf15('0x22')]['update']({'ItemTypeId':_0x351b55,'description':_0x194626,'OrderBy':_0x5a67c1},{'where':{'CmContactId':_0x2a75c7,'item':_0x1c761b}})[_0xdf15('0x1c')](function(_0x15f94d){_0x226b21({'res':_0xdf15('0x23')});});}else{return db[_0xdf15('0x22')][_0xdf15('0x24')]({'CmContactId':_0x2a75c7,'item':_0x1c761b,'ItemTypeId':_0x351b55,'description':_0x194626,'OrderBy':_0x5a67c1,'ItemClass':_0xdf15('0x25')})['then'](function(_0x112bf1){_0x226b21({'res':_0xdf15('0x26')});});}});});}function updateContact(_0x458493){return new Promise(function(_0x4b0dc7,_0xb2399c){var _0x2278d5=_0x458493['id'];delete _0x458493['id'];return db[_0xdf15('0x27')]['update'](_0x458493,{'where':{'id':_0x2278d5}})[_0xdf15('0x1c')](function(_0x3a25d5){updatedRows+=0x1;return db[_0xdf15('0x28')][_0xdf15('0x29')]({'phone':_0x458493[_0xdf15('0x2a')]},{'where':{'ContactId':_0x2278d5}})[_0xdf15('0x1c')](function(_0x5249b2){_0x4b0dc7({'ret':'OK'});});});});}function insertCmHopper(_0x158927,_0x400a4a,_0x2d2dca,_0x4e8893,_0x50ed){var _0x40ac0c=[_0xdf15('0x2b'),_0xdf15('0x2c'),_0xdf15('0x2d'),_0xdf15('0x2e'),_0x400a4a+'.'+_0x4e8893,_0xdf15('0x2f'),'cm_contacts.updatedAt',_0xdf15('0x30'),_0xdf15('0x31'),'\x22'+_0x50ed+'\x22'];return squel['insert']()[_0xdf15('0x32')](_0xdf15('0x33'))[_0xdf15('0x34')]([_0xdf15('0x2a'),_0xdf15('0x35'),_0xdf15('0x36'),_0xdf15('0x37'),_0x4e8893,'createdAt',_0xdf15('0x38'),_0xdf15('0x39'),_0xdf15('0x3a'),'recallme'],squel[_0xdf15('0x3b')]()[_0xdf15('0x3c')](_0x40ac0c)[_0xdf15('0x10')](_0x400a4a)[_0xdf15('0x11')](_0xdf15('0x3d'),null,_0xdf15('0x3e')+_0x400a4a+'.CmListId')['join'](_0x2d2dca,null,_0x2d2dca+_0xdf15('0x12')+_0x400a4a+'.'+_0x4e8893)[_0xdf15('0x13')](_0x400a4a+_0xdf15('0x3f'),_0x158927)['where'](_0xdf15('0x40'),NOW)[_0xdf15('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x400a4a,_0x2d2dca,_0x4e8893,_0xdf15('0x33'),[_0xdf15('0x41'),_0xdf15('0x42')]))['where'](_0xdf15('0x43'),selectNotIn(_0x400a4a,_0x2d2dca,_0x4e8893,'cm_hopper',[_0xdf15('0x41')])))['toString']();}function insertCmHopperBlack(_0x411ed4,_0x1b90c8,_0x271d91,_0x2fb1cf){var _0x6d974d=[_0xdf15('0x2b'),_0xdf15('0x2d'),_0xdf15('0x2e'),_0x1b90c8+'.'+_0x2fb1cf,'cm_contacts.createdAt',_0xdf15('0x44')];return squel[_0xdf15('0x45')]()[_0xdf15('0x32')]('cm_hopper_black')[_0xdf15('0x34')](['phone','ContactId',_0xdf15('0x37'),_0x2fb1cf,_0xdf15('0x46'),_0xdf15('0x38')],squel[_0xdf15('0x3b')]()[_0xdf15('0x3c')](_0x6d974d)[_0xdf15('0x10')](_0x1b90c8)[_0xdf15('0x11')](_0xdf15('0x3d'),null,_0xdf15('0x3e')+_0x1b90c8+_0xdf15('0x47'))[_0xdf15('0x11')](_0x271d91,null,_0x271d91+_0xdf15('0x12')+_0x1b90c8+'.'+_0x2fb1cf)[_0xdf15('0x13')](_0x1b90c8+_0xdf15('0x3f'),_0x411ed4)[_0xdf15('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xdf15('0x13')](_0xdf15('0x43'),squel[_0xdf15('0x3b')]()[_0xdf15('0x48')](_0xdf15('0x2a'))[_0xdf15('0x10')](_0xdf15('0x49'))[_0xdf15('0x13')]('ListId\x20=\x20?',_0x411ed4)['where'](_0x2fb1cf+'\x20=\x20?',_0x1b90c8+'.'+_0x2fb1cf)))[_0xdf15('0x4a')]();}function insertCmHopperAdditionalPhones(_0x413caf){var _0x492566=[_0xdf15('0x4b'),_0xdf15('0x4c'),_0xdf15('0x4d'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xdf15('0x45')]()[_0xdf15('0x32')](_0xdf15('0x4e'))['fromQuery']([_0xdf15('0x4f'),'phone',_0xdf15('0x50'),_0xdf15('0x46'),'updatedAt'],squel[_0xdf15('0x3b')]()[_0xdf15('0x3c')](_0x492566)[_0xdf15('0x10')](_0xdf15('0x33'))[_0xdf15('0x11')](_0xdf15('0x3d'),null,_0xdf15('0x51'))[_0xdf15('0x11')](_0xdf15('0x52'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0xdf15('0x53'),_0x413caf)['where'](_0xdf15('0x40'),NOW))[_0xdf15('0x4a')]();}function insertCmContact(_0x223a99,_0x33d5c0,_0x33f7ff,_0xf18b8e){var _0x2f371d=_[_0xdf15('0x54')](_['keys'](_0xf18b8e),[_0xdf15('0x37'),_0xdf15('0x55'),_0xdf15('0x46'),_0xdf15('0x38')]);return squel[_0xdf15('0x45')]()['into']('cm_contacts')['fromQuery'](_0x2f371d,squel[_0xdf15('0x3b')]()[_0xdf15('0x3c')](_0x2f371d)[_0xdf15('0x10')](_0x33d5c0)['where']('('+_0x33f7ff[_0xdf15('0x11')](',')+_0xdf15('0x56'),squel[_0xdf15('0x3b')]()[_0xdf15('0x3c')](_0x33f7ff)[_0xdf15('0x10')](_0xdf15('0x3d'))[_0xdf15('0x13')](_0xdf15('0x57'),_0x223a99))[_0xdf15('0x13')](_0xdf15('0x58'),squel[_0xdf15('0x3b')]()[_0xdf15('0x48')](_0xdf15('0x59'),'min_id')[_0xdf15('0x10')](_0x33d5c0)[_0xdf15('0x5a')](_0x33f7ff[_0xdf15('0x11')](','))))[_0xdf15('0x4a')]();}function handleStop(){logger[_0xdf15('0x5b')](_0xdf15('0x5c'));stopped=!![];}function handleUncaughtException(_0x4a838){logger[_0xdf15('0x1e')](_0x4a838[_0xdf15('0x1f')]);process[_0xdf15('0x5d')](0x1);}function handleError(_0x57758d,_0x46236c){stats[_0xdf15('0x5e')]['push']({'name':_0x46236c['code'],'message':_0x46236c[_0xdf15('0x1f')],'row':_0x57758d});}function handleQuery(_0x2bd969){logger[_0xdf15('0x5b')](_0x2bd969);return db[_0xdf15('0x15')][_0xdf15('0x5f')](_0x2bd969)[_0xdf15('0x60')](function(_0x3222dc){results[_0xdf15('0x1a')](_0x3222dc);})['catch'](function(_0xce2816){logger[_0xdf15('0x1e')](_0xce2816[_0xdf15('0x1f')]);});}function main(_0x50d429,_0x58beea,_0x2bcfef,_0x5a48db){logger[_0xdf15('0x5b')](_0xdf15('0x61'),_0x50d429,JSON[_0xdf15('0x62')](_0x58beea));process[_0xdf15('0x63')](_0xdf15('0x64'));var _0x4768ba=_0x58beea[_0xdf15('0x65')];var _0x18657e=_[_0xdf15('0x66')](_0x4768ba);var _0x5bcf36=_0x58beea[_0xdf15('0x67')];var _0x195fa2=path[_0xdf15('0x11')](config['root'],'server/files/tmp',_0x5bcf36+_0xdf15('0x68'));logger[_0xdf15('0x5b')](_0xdf15('0x69'),_0x58beea);db[_0xdf15('0x6a')]['findAll']({'raw':!![],'attributes':['id',_0xdf15('0x6b')]})[_0xdf15('0x1c')](function(_0x1543ce){for(var _0x3844cc=0x0;_0x3844cc<_0x1543ce['length'];_0x3844cc++){if(_0x1543ce[_0x3844cc]['name']in _0x4768ba){contactItemTypes['push'](_0x1543ce[_0x3844cc]);delete _0x18657e[_0x1543ce[_0x3844cc]['name']];hasAdditionalPhones=!![];}for(var _0x5223db in _0x4768ba){if(_0x1543ce[_0x3844cc]['name']+_0xdf15('0x6c')===_0x5223db){phoneDescriptions['push']({'itemTypeId':_0x1543ce[_0x3844cc]['id'],'description':_0x5223db});delete _0x18657e[_0x5223db];}}}if(hasAdditionalPhones)_0x18657e[_0xdf15('0x19')]='';var _0x3366c4=_[_0xdf15('0x6d')](_0x18657e)[_0xdf15('0x11')]();logger[_0xdf15('0x5b')](_0xdf15('0x6e'),_0x3366c4);fs[_0xdf15('0x6f')](_0x195fa2,_0x3366c4+'\x0a');Papa['parse'](fs[_0xdf15('0x70')](_0x50d429),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3df369,_0x5a04f4){try{for(var _0x3c74f2=0x0,_0x21affc=[];_0x3c74f2<_0x3df369[_0xdf15('0x71')][_0xdf15('0x17')];_0x3c74f2++){stats[_0xdf15('0x72')]+=0x1;if(_0x3df369['errors'][_0x3c74f2]){handleError(_0x3df369[_0xdf15('0x71')][_0x3c74f2],_0x3df369[_0xdf15('0x5e')][_0x3c74f2]);}else{var _0x30867d=[];var _0x5767ca=[];var _0x1607cd={};for(var _0x590385 in _0x4768ba){let _0x5b2799=contactItemTypes['find'](_0x294d7d=>_0x294d7d[_0xdf15('0x6b')]===_0x590385);let _0x52dbbe=contactItemTypes[_0xdf15('0x73')](_0x395469=>_0x395469[_0xdf15('0x6b')]+_0xdf15('0x6c')===_0x590385);if(_[_0xdf15('0x18')](_0x5b2799)&&_[_0xdf15('0x18')](_0x52dbbe)){if(_0x4768ba['hasOwnProperty'](_0x590385)){if(_0x3df369[_0xdf15('0x71')][_0x3c74f2][_0x4768ba[_0x590385]]){var _0x89adf=_['trim'](_0x3df369[_0xdf15('0x71')][_0x3c74f2][_0x4768ba[_0x590385]]['replace'](/"/g,'\x27'));switch(_0x590385){case'scheduledat':var _0x55402a=moment(_0x89adf,_0xdf15('0xc'),!![]);if(_0x55402a[_0xdf15('0x74')]()){_0x21affc['push']('\x22'+_0x89adf+'\x22');}else{_0x30867d[_0xdf15('0x1a')](_0xdf15('0x75'));}break;case _0xdf15('0x39'):var _0x566563=parseInt(_0x89adf);_0x89adf=_[_0xdf15('0x76')](_0x566563)||_0x566563<0x0||_0x566563>0x4?_0x5a48db?0x3:0x2:_0x566563;_0x21affc[_0xdf15('0x1a')]('\x22'+_0x89adf+'\x22');break;case _0xdf15('0x3a'):var _0x523089=parseInt(_0x89adf);if(_[_0xdf15('0x77')](_0x523089)&&_[_0xdf15('0x78')](_0x2bcfef,_0x523089)){_0x21affc['push']('\x22'+_0x523089+'\x22');}else{_0x30867d[_0xdf15('0x1a')](_0xdf15('0x79'));}break;case'email':if(isEmail(_0x89adf)){_0x21affc[_0xdf15('0x1a')]('\x22'+_0x89adf+'\x22');}else{_0x30867d[_0xdf15('0x1a')](_0xdf15('0x7a'));}break;case'dateOfBirth':var _0x135e38=moment(_0x89adf,_0xdf15('0x7b'),!![]);if(_0x135e38[_0xdf15('0x74')]()){_0x21affc[_0xdf15('0x1a')]('\x22'+_0x89adf+'\x22');}else{_0x30867d[_0xdf15('0x1a')](_0xdf15('0x7c'));}break;default:_0x21affc['push']('\x22'+_0x89adf+'\x22');}}else{switch(_0x590385){case'firstName':case _0xdf15('0x2a'):_0x30867d[_0xdf15('0x1a')](_0x590385+_0xdf15('0x7d'));break;default:_0x21affc[_0xdf15('0x1a')]('\x22\x22');}}}}else{var _0x502c90='';if(!_[_0xdf15('0x18')](_0x5b2799)){if(!_0x1607cd['hasOwnProperty'](_0x5b2799['id'])){for(var _0x1c656b=0x0;_0x1c656b<_0x4768ba[_0x590385][_0xdf15('0x17')];_0x1c656b++){var _0x89adf=_['trim'](_0x3df369[_0xdf15('0x71')][_0x3c74f2][_0x4768ba[_0x590385][_0x1c656b]][_0xdf15('0x7e')](/"/g,'\x27'));var _0x5439c8=phoneDescriptions['find'](_0x13e437=>_0x13e437[_0xdf15('0x7f')]===_0x5b2799['id']);if(!_[_0xdf15('0x18')](_0x5439c8)){var _0x20f4b0=_[_0xdf15('0x80')](_0x3df369[_0xdf15('0x71')][_0x3c74f2][_0x4768ba[_0x5439c8[_0xdf15('0x81')]][0x0]][_0xdf15('0x7e')](/"/g,'\x27'));if(!_[_0xdf15('0x18')](_0x20f4b0))_0x89adf=_0x89adf+'§'+_0x20f4b0;}if(_0x502c90=='')_0x502c90=_0x89adf;else _0x502c90+='|'+_0x89adf;}_0x5767ca[_0xdf15('0x1a')](_0x5b2799['id']+':'+_0x502c90);_0x1607cd[_0x5b2799['id']]=0x1;}}}}if(hasAdditionalPhones){_0x21affc[_0xdf15('0x1a')]('\x22'+_0x5767ca[_0xdf15('0x11')](';')+'\x22');}if(_0x30867d[_0xdf15('0x17')]){handleError(_0x3df369[_0xdf15('0x71')][_0x3c74f2],{'code':_0xdf15('0x82'),'message':_0x30867d[_0xdf15('0x11')]()});}else{fs[_0xdf15('0x83')](_0x195fa2,_0x21affc[_0xdf15('0x11')]()+'\x0a');}_0x21affc=[];}if(!(stats[_0xdf15('0x72')]%0xc8)){socket[_0xdf15('0x84')]('contact:import:'+_0x5bcf36,stats);stats['errors']=[];}}if(stopped){logger[_0xdf15('0x5b')](_0xdf15('0x85'));_0x5a04f4['abort']();}}catch(_0x46076a){handleError(_0x3df369[_0xdf15('0x71')][_0x3c74f2],{'code':'SystemError','message':_0x46076a[_0xdf15('0x1f')]});logger['error']('step',_0x46076a['message']);}},'complete':function(){try{var _0xc1b1b9=[];var _0x5d79d0=tempTableName;_0xc1b1b9[_0xdf15('0x1a')](_0xdf15('0x86')+_0x5d79d0+_0xdf15('0x87'));logger[_0xdf15('0x5b')](_0xdf15('0x88'),contactItemTypes['length']);var _0x267901=util[_0xdf15('0xb')](_0xdf15('0x89'),_0x195fa2,_0x5d79d0,_0x3366c4,_0x58beea[_0xdf15('0x37')],_0x58beea[_0xdf15('0x55')]||null,NOW,NOW);if(_[_0xdf15('0x18')](_0x4768ba[_0xdf15('0x35')])){_0x267901+=_0xdf15('0x8a');}_0xc1b1b9['push'](_0x267901);BPromise['each'](_0xc1b1b9,handleQuery)[_0xdf15('0x1c')](function(_0xf50787){BPromise[_0xdf15('0x1b')]([handleAdditionalPhones()])[_0xdf15('0x1c')](function(){_0xc1b1b9=[];for(var _0x5eb89c=0x0;_0x5eb89c\x20\x20','existsSync','binding','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','squel','ioredis','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_'];(function(_0x1c443c,_0x478c3c){var _0x117781=function(_0x407ae1){while(--_0x407ae1){_0x1c443c['push'](_0x1c443c['shift']());}};_0x117781(++_0x478c3c);}(_0x609a,0x11c));var _0xa609=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x609a[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var path=require(_0xa609('0x0'));var _=require(_0xa609('0x1'));var Papa=require('papaparse');var util=require(_0xa609('0x2'));var BPromise=require(_0xa609('0x3'));var moment=require('moment');var squel=require(_0xa609('0x4'));var Redis=require(_0xa609('0x5'));var db=require(_0xa609('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xa609('0x7'));config[_0xa609('0x8')]=_[_0xa609('0x9')](config[_0xa609('0x8')],{'host':_0xa609('0xa'),'port':0x18eb});var socket=require(_0xa609('0xb'))(new Redis(config[_0xa609('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xa609('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xa609('0xd')+moment()[_0xa609('0xc')](_0xa609('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x322b1a){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))*$/[_0xa609('0xf')](_0x322b1a);}function selectNotIn(_0x4c30fa,_0x352266,_0x46988b,_0x3f7bd1,_0x32dc1d){return squel[_0xa609('0x10')]()[_0xa609('0x11')](_0xa609('0x12'))[_0xa609('0x13')](_0x3f7bd1)[_0xa609('0x14')](_0x352266,null,_0x352266+_0xa609('0x15')+_0x3f7bd1+'.'+_0x46988b)[_0xa609('0x16')](_0x3f7bd1+'.'+_0x46988b+_0xa609('0x17')+_0x4c30fa+'.'+_0x46988b)['where'](_0x352266+_0xa609('0x18')+_0x32dc1d[_0xa609('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2beaa1,_0x19d179){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xa609('0x19')](_0xa609('0x1a')+tempTableName)[_0xa609('0x1b')](function(_0x2ad7b3){if(_0x2ad7b3!==null){var _0x3b41b3=[];for(var _0x561be7=0x0;_0x561be7<_0x2ad7b3['length'];_0x561be7++){var _0x2a5658=_0x2ad7b3[_0x561be7];if(!_[_0xa609('0x1c')](_0x2a5658[_0xa609('0x12')])){if(!_[_0xa609('0x1c')](_0x2a5658['AdditionalPhones']))_0x3b41b3[_0xa609('0x1d')](insertAdditionalPhones(_0x2a5658));promisesContact[_0xa609('0x1d')]({'contact':_0x2a5658});}}}Promise[_0xa609('0x1e')](_0x3b41b3)['then'](function(){_0x2beaa1({'val':0x1});});})['catch'](function(_0x22f233){logger[_0xa609('0x1f')](_0x22f233[_0xa609('0x20')]);});});}function insertAdditionalPhones(_0x1c0ba6){return new Promise(function(_0x28515c,_0x272ea8){var _0x131537=_0x1c0ba6['AdditionalPhones'];if(_['isNil'](_0x131537))_0x272ea8({'val':0x0});else{var _0x2425c5=_0x131537['split'](';');var _0x523638=[];orderBy=0x0;for(var _0x58b4f4=0x0;_0x58b4f4<_0x2425c5[_0xa609('0x21')];_0x58b4f4++){_0x523638[_0xa609('0x1d')](splitAdditionalPhone(_0x1c0ba6['id'],_0x2425c5[_0x58b4f4]));}Promise[_0xa609('0x1e')](_0x523638)[_0xa609('0x22')](function(){_0x28515c({'val':_0x2425c5[_0xa609('0x21')]});});}});}function splitAdditionalPhone(_0x54dd3c,_0x49a22d){return new Promise(function(_0x475237,_0x4eefce){var _0x33a10a=_0x49a22d['split'](':');var _0x4e1753=_0x33a10a[0x0];var _0x1e455c=_0x33a10a[0x1];if(_0x1e455c!==''){var _0x4dbc8b=_0x1e455c[_0xa609('0x23')]('|');var _0x2acc15=[];for(var _0x53ea6d=0x0;_0x53ea6d<_0x4dbc8b['length'];_0x53ea6d++){if(_0x4dbc8b[_0x53ea6d]!==''){var _0x15ec2c=_[_0xa609('0x24')](promisesAdditionalPhones,{'contactId':_0x54dd3c,'phone':_0x4dbc8b[_0x53ea6d]});if(_0x15ec2c[_0xa609('0x21')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x54dd3c,'contactTypeId':_0x4e1753,'phone':_0x4dbc8b[_0x53ea6d],'orderBy':orderBy});}}}_0x475237({'ok':0x1});}else _0x475237({'res':0x0});});}function createAdditionalPhone(_0x24ef0c,_0x24ebff,_0x187da6,_0xf01172){var _0x400e9d='';var _0x82ad6f='';var _0x9b4139=_0x187da6[_0xa609('0x23')]('§');_0x400e9d=_0x9b4139[0x0];if(_0x9b4139[_0xa609('0x21')]==0x2)_0x82ad6f=_0x9b4139[0x1];return new Promise(function(_0x35520b,_0x21450a){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x24ef0c,'item':_0x400e9d}})[_0xa609('0x22')](function(_0x52c240){if(_0x52c240){return db[_0xa609('0x25')]['update']({'ItemTypeId':_0x24ebff,'description':_0x82ad6f,'OrderBy':_0xf01172},{'where':{'CmContactId':_0x24ef0c,'item':_0x400e9d}})[_0xa609('0x22')](function(_0x3780ec){_0x35520b({'res':_0xa609('0x26')});});}else{return db[_0xa609('0x25')]['create']({'CmContactId':_0x24ef0c,'item':_0x400e9d,'ItemTypeId':_0x24ebff,'description':_0x82ad6f,'OrderBy':_0xf01172,'ItemClass':'PHONE'})['then'](function(_0x3f0e41){_0x35520b({'res':_0xa609('0x27')});});}});});}function updateContact(_0x3f5453){return new Promise(function(_0x41840,_0x11bed2){var _0x4eed2b=_0x3f5453['id'];delete _0x3f5453['id'];return db[_0xa609('0x28')][_0xa609('0x29')](_0x3f5453,{'where':{'id':_0x4eed2b}})[_0xa609('0x22')](function(_0x1fe25c){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x3f5453['phone']},{'where':{'ContactId':_0x4eed2b}})[_0xa609('0x22')](function(_0x202688){_0x41840({'ret':'OK'});});});});}function insertCmHopper(_0x469881,_0x2494b8,_0x6f9bf7,_0x581d29,_0x1c5bb6){var _0x2d3030=[_0xa609('0x2a'),_0xa609('0x2b'),'cm_contacts.id',_0xa609('0x2c'),_0x2494b8+'.'+_0x581d29,_0xa609('0x2d'),_0xa609('0x2e'),_0xa609('0x2f'),_0xa609('0x30'),'\x22'+_0x1c5bb6+'\x22'];return squel['insert']()[_0xa609('0x31')](_0xa609('0x32'))[_0xa609('0x33')]([_0xa609('0x12'),_0xa609('0x34'),_0xa609('0x35'),_0xa609('0x36'),_0x581d29,_0xa609('0x37'),_0xa609('0x38'),_0xa609('0x39'),_0xa609('0x3a'),_0xa609('0x3b')],squel[_0xa609('0x10')]()[_0xa609('0x3c')](_0x2d3030)[_0xa609('0x13')](_0x2494b8)[_0xa609('0x14')](_0xa609('0x3d'),null,_0xa609('0x3e')+_0x2494b8+_0xa609('0x3f'))[_0xa609('0x14')](_0x6f9bf7,null,_0x6f9bf7+'.id\x20=\x20'+_0x2494b8+'.'+_0x581d29)[_0xa609('0x16')](_0x2494b8+_0xa609('0x40'),_0x469881)[_0xa609('0x16')](_0xa609('0x41'),NOW)['where'](_0xa609('0x42'),selectNotIn(_0x2494b8,_0x6f9bf7,_0x581d29,_0xa609('0x32'),[_0xa609('0x43'),_0xa609('0x44')]))[_0xa609('0x16')](_0xa609('0x42'),selectNotIn(_0x2494b8,_0x6f9bf7,_0x581d29,_0xa609('0x32'),['\x22always\x22'])))[_0xa609('0x45')]();}function insertCmHopperBlack(_0x428e66,_0x8647d3,_0x4ba8ec,_0x4f7dfb){var _0x2c9c24=[_0xa609('0x2a'),'cm_contacts.id','cm_contacts.ListId',_0x8647d3+'.'+_0x4f7dfb,_0xa609('0x2d'),_0xa609('0x2e')];return squel[_0xa609('0x46')]()[_0xa609('0x31')](_0xa609('0x47'))[_0xa609('0x33')]([_0xa609('0x12'),_0xa609('0x35'),_0xa609('0x36'),_0x4f7dfb,_0xa609('0x37'),_0xa609('0x38')],squel[_0xa609('0x10')]()[_0xa609('0x3c')](_0x2c9c24)[_0xa609('0x13')](_0x8647d3)[_0xa609('0x14')]('cm_contacts',null,_0xa609('0x3e')+_0x8647d3+_0xa609('0x3f'))[_0xa609('0x14')](_0x4ba8ec,null,_0x4ba8ec+_0xa609('0x15')+_0x8647d3+'.'+_0x4f7dfb)[_0xa609('0x16')](_0x8647d3+_0xa609('0x40'),_0x428e66)[_0xa609('0x16')](_0xa609('0x41'),NOW)[_0xa609('0x16')](_0xa609('0x42'),squel[_0xa609('0x10')]()[_0xa609('0x11')](_0xa609('0x12'))[_0xa609('0x13')]('cm_hopper_black')[_0xa609('0x16')](_0xa609('0x48'),_0x428e66)['where'](_0x4f7dfb+_0xa609('0x49'),_0x8647d3+'.'+_0x4f7dfb)))[_0xa609('0x45')]();}function insertCmHopperAdditionalPhones(_0x29067a){var _0x1fe5f5=[_0xa609('0x4a'),_0xa609('0x4b'),_0xa609('0x4c'),_0xa609('0x4d'),_0xa609('0x4e')];return squel['insert']()[_0xa609('0x31')](_0xa609('0x4f'))[_0xa609('0x33')]([_0xa609('0x50'),_0xa609('0x12'),'OrderBy',_0xa609('0x37'),_0xa609('0x38')],squel[_0xa609('0x10')]()[_0xa609('0x3c')](_0x1fe5f5)[_0xa609('0x13')](_0xa609('0x32'))[_0xa609('0x14')](_0xa609('0x3d'),null,_0xa609('0x51'))[_0xa609('0x14')]('cm_contact_has_items',null,_0xa609('0x52'))[_0xa609('0x16')]('cm_hopper.ListId\x20=\x20?',_0x29067a)[_0xa609('0x16')](_0xa609('0x41'),NOW))[_0xa609('0x45')]();}function insertCmContact(_0x5d0fe8,_0x25c88a,_0x27ae01,_0x3cd29d){var _0x563c4b=_[_0xa609('0x53')](_['keys'](_0x3cd29d),[_0xa609('0x36'),_0xa609('0x54'),_0xa609('0x37'),_0xa609('0x38')]);return squel[_0xa609('0x46')]()[_0xa609('0x31')](_0xa609('0x3d'))[_0xa609('0x33')](_0x563c4b,squel['select']()[_0xa609('0x3c')](_0x563c4b)[_0xa609('0x13')](_0x25c88a)['where']('('+_0x27ae01[_0xa609('0x14')](',')+_0xa609('0x55'),squel[_0xa609('0x10')]()[_0xa609('0x3c')](_0x27ae01)[_0xa609('0x13')](_0xa609('0x3d'))[_0xa609('0x16')]('ListId\x20=\x20?',_0x5d0fe8))[_0xa609('0x16')](_0xa609('0x56'),squel[_0xa609('0x10')]()[_0xa609('0x11')](_0xa609('0x57'),'min_id')[_0xa609('0x13')](_0x25c88a)[_0xa609('0x58')](_0x27ae01['join'](','))))[_0xa609('0x45')]();}function handleStop(){logger[_0xa609('0x59')](_0xa609('0x5a'));stopped=!![];}function handleUncaughtException(_0x5af251){logger[_0xa609('0x1f')](_0x5af251[_0xa609('0x20')]);process[_0xa609('0x5b')](0x1);}function handleError(_0x2a26c2,_0xa4784b){stats['errors']['push']({'name':_0xa4784b['code'],'message':_0xa4784b['message'],'row':_0x2a26c2});}function handleQuery(_0x4d6d35){logger['info'](_0x4d6d35);return db[_0xa609('0x5c')]['query'](_0x4d6d35)[_0xa609('0x1b')](function(_0x3dba1b){results[_0xa609('0x1d')](_0x3dba1b);})['catch'](function(_0x17d2cc){logger[_0xa609('0x1f')](_0x17d2cc[_0xa609('0x20')]);});}function main(_0xe2c006,_0x5cda44,_0x4e5fe2,_0x10760f){logger[_0xa609('0x59')](_0xa609('0x5d'),_0xe2c006,JSON['stringify'](_0x5cda44));process['send'](_0xa609('0x5e'));var _0x40484a=_0x5cda44['binding'];var _0x47668f=_['clone'](_0x40484a);var _0x2c9a1e=_0x5cda44[_0xa609('0x5f')];var _0x2d11fc=path[_0xa609('0x14')](config['root'],_0xa609('0x60'),_0x2c9a1e+_0xa609('0x61'));logger['info']('body',_0x5cda44);db[_0xa609('0x62')]['findAll']({'raw':!![],'attributes':['id',_0xa609('0x63')]})[_0xa609('0x22')](function(_0xc02011){for(var _0x50a241=0x0;_0x50a241<_0xc02011[_0xa609('0x21')];_0x50a241++){if(_0xc02011[_0x50a241][_0xa609('0x63')]in _0x40484a){contactItemTypes['push'](_0xc02011[_0x50a241]);delete _0x47668f[_0xc02011[_0x50a241][_0xa609('0x63')]];hasAdditionalPhones=!![];}for(var _0x4663ac in _0x40484a){if(_0xc02011[_0x50a241][_0xa609('0x63')]+_0xa609('0x64')===_0x4663ac){phoneDescriptions[_0xa609('0x1d')]({'itemTypeId':_0xc02011[_0x50a241]['id'],'description':_0x4663ac});delete _0x47668f[_0x4663ac];}}}if(hasAdditionalPhones)_0x47668f[_0xa609('0x65')]='';var _0x3c9afa=_[_0xa609('0x66')](_0x47668f)[_0xa609('0x14')]();logger[_0xa609('0x59')]('header',_0x3c9afa);fs[_0xa609('0x67')](_0x2d11fc,_0x3c9afa+'\x0a');Papa[_0xa609('0x68')](fs['createReadStream'](_0xe2c006),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1ce4b2,_0x3b0a4f){try{for(var _0x3c95d0=0x0,_0x26f474=[];_0x3c95d0<_0x1ce4b2[_0xa609('0x69')]['length'];_0x3c95d0++){stats[_0xa609('0x6a')]+=0x1;if(_0x1ce4b2[_0xa609('0x6b')][_0x3c95d0]){handleError(_0x1ce4b2['data'][_0x3c95d0],_0x1ce4b2[_0xa609('0x6b')][_0x3c95d0]);}else{var _0x589501=[];var _0x485a71=[];var _0x405ae5={};for(var _0x249443 in _0x40484a){let _0x1c7107=contactItemTypes[_0xa609('0x6c')](_0x423d61=>_0x423d61[_0xa609('0x63')]===_0x249443);let _0x35a345=contactItemTypes[_0xa609('0x6c')](_0x203e0c=>_0x203e0c[_0xa609('0x63')]+_0xa609('0x64')===_0x249443);if(_[_0xa609('0x1c')](_0x1c7107)&&_[_0xa609('0x1c')](_0x35a345)){if(_0x40484a[_0xa609('0x6d')](_0x249443)){if(_0x1ce4b2[_0xa609('0x69')][_0x3c95d0][_0x40484a[_0x249443]]){var _0x423e63=_[_0xa609('0x6e')](_0x1ce4b2[_0xa609('0x69')][_0x3c95d0][_0x40484a[_0x249443]][_0xa609('0x6f')](/"/g,'\x27'));switch(_0x249443){case'scheduledat':var _0x35af8e=moment(_0x423e63,_0xa609('0x70'),!![]);if(_0x35af8e[_0xa609('0x71')]()){_0x26f474['push']('\x22'+_0x423e63+'\x22');}else{_0x589501[_0xa609('0x1d')](_0xa609('0x72'));}break;case _0xa609('0x39'):var _0x2ee631=parseInt(_0x423e63);_0x423e63=_[_0xa609('0x73')](_0x2ee631)||_0x2ee631<0x0||_0x2ee631>0x4?_0x10760f?0x3:0x2:_0x2ee631;_0x26f474['push']('\x22'+_0x423e63+'\x22');break;case _0xa609('0x3a'):var _0xa90c1e=parseInt(_0x423e63);if(_[_0xa609('0x74')](_0xa90c1e)&&_[_0xa609('0x75')](_0x4e5fe2,_0xa90c1e)){_0x26f474['push']('\x22'+_0xa90c1e+'\x22');}else{_0x589501['push'](_0xa609('0x76'));}break;case _0xa609('0x77'):if(isEmail(_0x423e63)){_0x26f474[_0xa609('0x1d')]('\x22'+_0x423e63+'\x22');}else{_0x589501[_0xa609('0x1d')]('email\x20wrong\x20format');}break;case _0xa609('0x78'):var _0x3e5211=moment(_0x423e63,'YYYY-MM-DD',!![]);if(_0x3e5211[_0xa609('0x71')]()){_0x26f474[_0xa609('0x1d')]('\x22'+_0x423e63+'\x22');}else{_0x589501[_0xa609('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x26f474[_0xa609('0x1d')]('\x22'+_0x423e63+'\x22');}}else{switch(_0x249443){case _0xa609('0x79'):case _0xa609('0x12'):_0x589501['push'](_0x249443+'\x20not\x20specified');break;default:_0x26f474[_0xa609('0x1d')]('\x22\x22');}}}}else{var _0x399815='';if(!_[_0xa609('0x1c')](_0x1c7107)){if(!_0x405ae5['hasOwnProperty'](_0x1c7107['id'])){for(var _0x15ff31=0x0;_0x15ff31<_0x40484a[_0x249443][_0xa609('0x21')];_0x15ff31++){var _0x423e63=_[_0xa609('0x6e')](_0x1ce4b2[_0xa609('0x69')][_0x3c95d0][_0x40484a[_0x249443][_0x15ff31]][_0xa609('0x6f')](/"/g,'\x27'));var _0x160780=phoneDescriptions[_0xa609('0x6c')](_0x32c717=>_0x32c717[_0xa609('0x7a')]===_0x1c7107['id']);if(!_['isNil'](_0x160780)){var _0x349ca2=_['trim'](_0x1ce4b2[_0xa609('0x69')][_0x3c95d0][_0x40484a[_0x160780[_0xa609('0x7b')]][0x0]][_0xa609('0x6f')](/"/g,'\x27'));if(!_[_0xa609('0x1c')](_0x349ca2))_0x423e63=_0x423e63+'§'+_0x349ca2;}if(_0x399815=='')_0x399815=_0x423e63;else _0x399815+='|'+_0x423e63;}_0x485a71[_0xa609('0x1d')](_0x1c7107['id']+':'+_0x399815);_0x405ae5[_0x1c7107['id']]=0x1;}}}}if(hasAdditionalPhones){_0x26f474[_0xa609('0x1d')]('\x22'+_0x485a71[_0xa609('0x14')](';')+'\x22');}if(_0x589501[_0xa609('0x21')]){handleError(_0x1ce4b2[_0xa609('0x69')][_0x3c95d0],{'code':'SystemRow','message':_0x589501[_0xa609('0x14')]()});}else{fs['appendFileSync'](_0x2d11fc,_0x26f474[_0xa609('0x14')]()+'\x0a');}_0x26f474=[];}if(!(stats[_0xa609('0x6a')]%0xc8)){socket[_0xa609('0x7c')](_0xa609('0x7d')+_0x2c9a1e,stats);stats[_0xa609('0x6b')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x3b0a4f[_0xa609('0x7e')]();}}catch(_0x48f5a2){handleError(_0x1ce4b2[_0xa609('0x69')][_0x3c95d0],{'code':'SystemError','message':_0x48f5a2[_0xa609('0x20')]});logger[_0xa609('0x1f')](_0xa609('0x7f'),_0x48f5a2[_0xa609('0x20')]);}},'complete':function(){try{var _0x5a7639=[];var _0x287cfe=tempTableName;_0x5a7639[_0xa609('0x1d')](_0xa609('0x80')+_0x287cfe+_0xa609('0x81'));logger[_0xa609('0x59')](_0xa609('0x82'),contactItemTypes[_0xa609('0x21')]);var _0x51a3ed=util['format'](_0xa609('0x83'),_0x2d11fc,_0x287cfe,_0x3c9afa,_0x5cda44[_0xa609('0x36')],_0x5cda44['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x40484a[_0xa609('0x34')])){_0x51a3ed+=',\x20scheduledAt\x20=\x20NOW()';}_0x5a7639['push'](_0x51a3ed);BPromise[_0xa609('0x84')](_0x5a7639,handleQuery)[_0xa609('0x22')](function(_0x376ede){BPromise[_0xa609('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x5a7639=[];for(var _0x1d3c96=0x0;_0x1d3c96=_0x4b7c0c){return _0xb58653[_0x88f6('0x14')](0x193)[_0x88f6('0x15')]({'message':util['format'](_0x88f6('0x16'),_0x314806)});}_0x23fff1();})[_0x88f6('0x17')](function(_0x575d4e){_0x23fff1(_0x575d4e);});});}function isUserLimit(){return isLimit(_0x88f6('0x18'),0x1,db[_0x88f6('0x19')],{'where':{'$or':[{'role':_0x88f6('0x1a')},{'role':_0x88f6('0x1b')}]}});}exports[_0x88f6('0x1c')]=isUserLimit; \ No newline at end of file +var _0x63c0=['License','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','use'];(function(_0x401c58,_0x22620d){var _0x2e7943=function(_0x2154f3){while(--_0x2154f3){_0x401c58['push'](_0x401c58['shift']());}};_0x2e7943(++_0x22620d);}(_0x63c0,0xe2));var _0x063c=function(_0x26dd9a,_0x28a8e1){_0x26dd9a=_0x26dd9a-0x0;var _0x32c5f8=_0x63c0[_0x26dd9a];return _0x32c5f8;};'use strict';var crypto=require('crypto');var util=require(_0x063c('0x0'));var compose=require(_0x063c('0x1'));var db=require(_0x063c('0x2'))['db'];var config=require(_0x063c('0x3'));function getValueFromLicense(_0x5e97fd,_0x54eed5){if(_0x5e97fd&&_0x54eed5){if(_0x54eed5[_0x063c('0x4')]&&_0x54eed5[_0x063c('0x5')]){var _0x106e85=_0x54eed5['data1'];var _0x51f23b=_0x54eed5[_0x063c('0x5')];var _0x586dcf=_0x106e85[_0x063c('0x6')]('-')[0x4];var _0x100c63=_0x106e85[_0x063c('0x6')]('-')[0x0];var _0x26968c=crypto[_0x063c('0x7')](_0x063c('0x8'),util[_0x063c('0x9')](_0x063c('0xa'),_0x586dcf,_0x106e85,_0x100c63));var _0x43351d=_0x26968c[_0x063c('0xb')](_0x51f23b,_0x063c('0xc'),'utf8');_0x43351d+=_0x26968c['final'](_0x063c('0xd'));var _0x2c01b1=JSON[_0x063c('0xe')](_0x43351d);return _0x2c01b1[_0x063c('0xf')](_0x5e97fd)?_0x2c01b1[_0x5e97fd]:null;}}return null;}function isLimit(_0x2a863d,_0x27c9e6,_0x400963,_0x5ba1fd){var _0x33c61b=_0x27c9e6;return compose()[_0x063c('0x10')](function(_0x7bfd79,_0x55b503,_0x113a8a){return db[_0x063c('0x11')][_0x063c('0x12')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x366da0){var _0x1233c6=getValueFromLicense(_0x2a863d,_0x366da0);return _0x1233c6?_0x1233c6:_0x33c61b;})['then'](function(_0x14669f){_0x33c61b=_0x14669f;return _0x400963['count'](_0x5ba1fd);})[_0x063c('0x13')](function(_0x4f05c5){if(_0x4f05c5>=_0x33c61b){return _0x55b503['status'](0x193)[_0x063c('0x14')]({'message':util[_0x063c('0x9')](_0x063c('0x15'),_0x2a863d)});}_0x113a8a();})['catch'](function(_0x2fd468){_0x113a8a(_0x2fd468);});});}function isUserLimit(){return isLimit(_0x063c('0x16'),0x1,db[_0x063c('0x17')],{'where':{'$or':[{'role':_0x063c('0x18')},{'role':_0x063c('0x19')}]}});}exports[_0x063c('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a6df9b5..5b94d82 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 _0x0cbc=['sqlOperator','startsWith','and','[$and]','[$or]','split','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','start','pop','utcOffset','hours','minutes','seconds','moment','parseSearch'];(function(_0x13eb4c,_0x15fb3c){var _0x183daf=function(_0x398118){while(--_0x398118){_0x13eb4c['push'](_0x13eb4c['shift']());}};_0x183daf(++_0x15fb3c);}(_0x0cbc,0x194));var _0xc0cb=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x0cbc[_0x450689];return _0x46ffb0;};'use strict';var _=require('lodash');var moment=require(_0xc0cb('0x0'));exports[_0xc0cb('0x1')]=function(_0x16d76f){var _0x4daf5e={'conditions':[]};_0x4daf5e[_0xc0cb('0x2')]=_[_0xc0cb('0x3')](_0x16d76f,'[$or]')?'or':_0xc0cb('0x4');var _0x5a34b4=_0x16d76f['replace'](_0xc0cb('0x5'),'')['replace'](_0xc0cb('0x6'),'')[_0xc0cb('0x7')]('||');for(var _0x3181c5=0x0;_0x3181c5<_0x5a34b4['length'];_0x3181c5++){var _0x195940=_0x5a34b4[_0x3181c5]['split'](':=');var _0x393d8b=_0x195940[0x0];var _0x56daff=_0x195940[_0xc0cb('0x8')](0x1);_0x56daff[_0xc0cb('0x9')](function(_0x3eaddd){var _0x312087=_0x3eaddd[_0xc0cb('0x7')]('[')[_0xc0cb('0xa')]();var _0x421da3=_0x3eaddd[_0xc0cb('0xb')](/\[(.*?)\]/g);_0x421da3['forEach'](function(_0x43146c){var _0x54308e=_0x43146c[_0xc0cb('0x7')]('[')[_0xc0cb('0xc')](function(_0x5bb874){return _0x5bb874[_0xc0cb('0xd')](']')>-0x1;})[_0xc0cb('0xe')](function(_0x348e90){return _0x348e90[_0xc0cb('0x7')](']')[0x0];})[0x0];_0x4daf5e[_0xc0cb('0xf')][_0xc0cb('0x10')]({'field':_0x393d8b,'operator':_0x312087,'value':_0x54308e});});});}return _0x4daf5e;};exports[_0xc0cb('0x11')]=function(_0x4cc1fa,_0x819945,_0x4a0e3f){var _0x34d96c={};if(_0x819945===_0xc0cb('0x12')){if(_0x4a0e3f['operator']===_0xc0cb('0x13')){_0x4a0e3f[_0xc0cb('0x14')]=_0xc0cb('0x15');_0x4a0e3f[_0xc0cb('0x16')]+=','+_0x4a0e3f[_0xc0cb('0x16')];}else if(_[_0xc0cb('0x17')]([_0xc0cb('0x18'),_0xc0cb('0x19')],_0x4a0e3f[_0xc0cb('0x14')])){_0x4a0e3f[_0xc0cb('0x16')]=moment(_0x4a0e3f[_0xc0cb('0x16')])[_0xc0cb('0x1a')](0x1,_0xc0cb('0x1b'))[_0xc0cb('0x1c')](_0xc0cb('0x1d'));}}if(_0x4a0e3f[_0xc0cb('0x1e')]){_0x819945=_0x4a0e3f[_0xc0cb('0x1e')];_0x34d96c[_0xc0cb('0x1f')]=_0xc0cb('0x20')+_0x4cc1fa+'.'+_0x4a0e3f[_0xc0cb('0x21')]+_0xc0cb('0x22')+_0x4a0e3f[_0xc0cb('0x1e')]+')\x20'+parseOperator(_0x4a0e3f['operator']);}else{_0x34d96c['text']=_0x4cc1fa+'.'+_0x4a0e3f['field']+'\x20'+parseOperator(_0x4a0e3f[_0xc0cb('0x14')]);}if(_[_0xc0cb('0x17')]([_0xc0cb('0x23'),'$notIn'],_0x4a0e3f[_0xc0cb('0x14')]))_0x34d96c[_0xc0cb('0x1f')]='('+_0x34d96c[_0xc0cb('0x1f')]+_0xc0cb('0x24')+_0x4cc1fa+'.'+_0x4a0e3f['field']+_0xc0cb('0x25');_0x34d96c[_0xc0cb('0x16')]=parseValue(_0x819945,_0x4a0e3f[_0xc0cb('0x14')],_0x4a0e3f[_0xc0cb('0x16')]);return _0x34d96c;};function parseOperator(_0xf00e19){var _0x35ad5d;switch(_0xf00e19){case _0xc0cb('0x26'):_0x35ad5d=_0xc0cb('0x27');break;case _0xc0cb('0x28'):_0x35ad5d=_0xc0cb('0x29');break;case'$eq':_0x35ad5d=_0xc0cb('0x2a');break;case _0xc0cb('0x23'):_0x35ad5d='<>\x20?';break;case _0xc0cb('0x2b'):case _0xc0cb('0x2c'):case _0xc0cb('0x2d'):_0x35ad5d=_0xc0cb('0x2e');break;case _0xc0cb('0x2f'):_0x35ad5d=_0xc0cb('0x30');break;case _0xc0cb('0x18'):_0x35ad5d=_0xc0cb('0x31');break;case'$lte':_0x35ad5d='<=\x20?';break;case _0xc0cb('0x32'):_0x35ad5d=_0xc0cb('0x33');break;case _0xc0cb('0x15'):_0x35ad5d='BETWEEN\x20?\x20AND\x20?';break;}return _0x35ad5d;}function parseValue(_0x410f3f,_0x2fb541,_0x63e9be){var _0x538c3f={'start':undefined,'end':undefined};switch(_0x2fb541){case _0xc0cb('0x26'):case _0xc0cb('0x28'):_0x538c3f[_0xc0cb('0x34')]=_0x63e9be[_0xc0cb('0x7')](',');break;case _0xc0cb('0x2b'):_0x538c3f['start']='%'+_0x63e9be+'%';break;case'$startsWith':_0x538c3f[_0xc0cb('0x34')]=_0x63e9be+'%';break;case _0xc0cb('0x2d'):_0x538c3f[_0xc0cb('0x34')]='%'+_0x63e9be;break;case'$between':var _0x283f7d=_0x63e9be['split'](',');var _0x63e9be=_0x283f7d[_0xc0cb('0xa')]();var _0x2315a9=_0x283f7d[_0xc0cb('0x35')]();if(_0x410f3f==='DATE'){_0x63e9be=moment(_0x63e9be)[_0xc0cb('0x36')](0x0,!![])[_0xc0cb('0x1c')]();_0x2315a9=moment(_0x2315a9)['utcOffset'](0x0,!![])[_0xc0cb('0x1a')](0x17,_0xc0cb('0x37'))[_0xc0cb('0x1a')](0x3b,_0xc0cb('0x38'))['add'](0x3b,_0xc0cb('0x39'))[_0xc0cb('0x1c')]();}_0x538c3f={'start':_0x63e9be,'end':_0x2315a9};break;default:_0x538c3f[_0xc0cb('0x34')]=_0x63e9be;break;}return _0x538c3f;} \ No newline at end of file +var _0x8470=['BETWEEN\x20?\x20AND\x20?','start','$substring','$startsWith','pop','format','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','value','includes','add','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$endsWith','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','$between'];(function(_0x49bf90,_0x564cbe){var _0x557bc3=function(_0x41607a){while(--_0x41607a){_0x49bf90['push'](_0x49bf90['shift']());}};_0x557bc3(++_0x564cbe);}(_0x8470,0xe8));var _0x0847=function(_0x39b839,_0x18907a){_0x39b839=_0x39b839-0x0;var _0x577a8e=_0x8470[_0x39b839];return _0x577a8e;};'use strict';var _=require(_0x0847('0x0'));var moment=require(_0x0847('0x1'));exports[_0x0847('0x2')]=function(_0x5686de){var _0x20d223={'conditions':[]};_0x20d223[_0x0847('0x3')]=_[_0x0847('0x4')](_0x5686de,_0x0847('0x5'))?'or':_0x0847('0x6');var _0xfe945a=_0x5686de[_0x0847('0x7')]('[$and]','')[_0x0847('0x7')](_0x0847('0x5'),'')[_0x0847('0x8')]('||');for(var _0x2e66b1=0x0;_0x2e66b1<_0xfe945a[_0x0847('0x9')];_0x2e66b1++){var _0x4a391a=_0xfe945a[_0x2e66b1][_0x0847('0x8')](':=');var _0x1027cd=_0x4a391a[0x0];var _0xb70b88=_0x4a391a[_0x0847('0xa')](0x1);_0xb70b88[_0x0847('0xb')](function(_0x384268){var _0x45bd76=_0x384268[_0x0847('0x8')]('[')[_0x0847('0xc')]();var _0xa65b90=_0x384268[_0x0847('0xd')](/\[(.*?)\]/g);_0xa65b90[_0x0847('0xb')](function(_0x53afb1){var _0x9d5ee5=_0x53afb1['split']('[')[_0x0847('0xe')](function(_0x581721){return _0x581721[_0x0847('0xf')](']')>-0x1;})['map'](function(_0x283722){return _0x283722[_0x0847('0x8')](']')[0x0];})[0x0];_0x20d223[_0x0847('0x10')][_0x0847('0x11')]({'field':_0x1027cd,'operator':_0x45bd76,'value':_0x9d5ee5});});});}return _0x20d223;};exports[_0x0847('0x12')]=function(_0xb932d9,_0x103a1b,_0x5fa9aa){var _0x3ea913={};if(_0x103a1b===_0x0847('0x13')){if(_0x5fa9aa[_0x0847('0x14')]==='$eq'){_0x5fa9aa[_0x0847('0x14')]='$between';_0x5fa9aa['value']+=','+_0x5fa9aa[_0x0847('0x15')];}else if(_[_0x0847('0x16')](['$gt','$lte'],_0x5fa9aa[_0x0847('0x14')])){_0x5fa9aa['value']=moment(_0x5fa9aa['value'])[_0x0847('0x17')](0x1,'days')['format'](_0x0847('0x18'));}}if(_0x5fa9aa[_0x0847('0x19')]){_0x103a1b=_0x5fa9aa['castTo'];_0x3ea913[_0x0847('0x1a')]=_0x0847('0x1b')+_0xb932d9+'.'+_0x5fa9aa[_0x0847('0x1c')]+_0x0847('0x1d')+_0x5fa9aa[_0x0847('0x19')]+')\x20'+parseOperator(_0x5fa9aa[_0x0847('0x14')]);}else{_0x3ea913['text']=_0xb932d9+'.'+_0x5fa9aa[_0x0847('0x1c')]+'\x20'+parseOperator(_0x5fa9aa[_0x0847('0x14')]);}if(_[_0x0847('0x16')]([_0x0847('0x1e'),_0x0847('0x1f')],_0x5fa9aa[_0x0847('0x14')]))_0x3ea913['text']='('+_0x3ea913[_0x0847('0x1a')]+_0x0847('0x20')+_0xb932d9+'.'+_0x5fa9aa[_0x0847('0x1c')]+_0x0847('0x21');_0x3ea913[_0x0847('0x15')]=parseValue(_0x103a1b,_0x5fa9aa[_0x0847('0x14')],_0x5fa9aa[_0x0847('0x15')]);return _0x3ea913;};function parseOperator(_0x43437c){var _0x3e7c36;switch(_0x43437c){case _0x0847('0x22'):_0x3e7c36=_0x0847('0x23');break;case'$notIn':_0x3e7c36=_0x0847('0x24');break;case _0x0847('0x25'):_0x3e7c36=_0x0847('0x26');break;case _0x0847('0x1e'):_0x3e7c36=_0x0847('0x27');break;case'$substring':case'$startsWith':case _0x0847('0x28'):_0x3e7c36='LIKE\x20?';break;case'$lt':_0x3e7c36=_0x0847('0x29');break;case _0x0847('0x2a'):_0x3e7c36=_0x0847('0x2b');break;case'$lte':_0x3e7c36=_0x0847('0x2c');break;case _0x0847('0x2d'):_0x3e7c36=_0x0847('0x2e');break;case _0x0847('0x2f'):_0x3e7c36=_0x0847('0x30');break;}return _0x3e7c36;}function parseValue(_0x4d3270,_0x5c8b5e,_0x9b4e6a){var _0x33a4ca={'start':undefined,'end':undefined};switch(_0x5c8b5e){case _0x0847('0x22'):case _0x0847('0x1f'):_0x33a4ca[_0x0847('0x31')]=_0x9b4e6a[_0x0847('0x8')](',');break;case _0x0847('0x32'):_0x33a4ca[_0x0847('0x31')]='%'+_0x9b4e6a+'%';break;case _0x0847('0x33'):_0x33a4ca[_0x0847('0x31')]=_0x9b4e6a+'%';break;case _0x0847('0x28'):_0x33a4ca[_0x0847('0x31')]='%'+_0x9b4e6a;break;case _0x0847('0x2f'):var _0x5ef36c=_0x9b4e6a['split'](',');var _0x9b4e6a=_0x5ef36c[_0x0847('0xc')]();var _0x393022=_0x5ef36c[_0x0847('0x34')]();if(_0x4d3270==='DATE'){_0x9b4e6a=moment(_0x9b4e6a)['utcOffset'](0x0,!![])[_0x0847('0x35')]();_0x393022=moment(_0x393022)['utcOffset'](0x0,!![])[_0x0847('0x17')](0x17,_0x0847('0x36'))[_0x0847('0x17')](0x3b,'minutes')[_0x0847('0x17')](0x3b,_0x0847('0x37'))[_0x0847('0x35')]();}_0x33a4ca={'start':_0x9b4e6a,'end':_0x393022};break;default:_0x33a4ca[_0x0847('0x31')]=_0x9b4e6a;break;}return _0x33a4ca;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 879fbdc..a690269 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 _0x44e8=['sort','map','indexOf','col','priority','unsigned','substr','cast','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','fields','nolimit','filter','object','columns','value','where','lower','merge','options','lodash','parse','keys','includes','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','limit','offset'];(function(_0x241a78,_0x18e674){var _0x268acc=function(_0x55274e){while(--_0x55274e){_0x241a78['push'](_0x241a78['shift']());}};_0x268acc(++_0x18e674);}(_0x44e8,0xd7));var _0x844e=function(_0x198cda,_0x39ecc7){_0x198cda=_0x198cda-0x0;var _0x312688=_0x44e8[_0x198cda];return _0x312688;};'use strict';var _=require(_0x844e('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b5be7){var _0x21307e=['ne'];try{var _0x2afcef=JSON[_0x844e('0x1')](_0x1b5be7);var _0x49ce1b=Object[_0x844e('0x2')](_0x2afcef)[0x0];return _0x21307e[_0x844e('0x3')](_0x49ce1b);}catch(_0x2c8b9e){return![];}}function getOperatorValue(_0x446f47){var _0x5c8f67=JSON[_0x844e('0x1')](_0x446f47);var _0x238796=Object[_0x844e('0x2')](_0x5c8f67)[0x0];var _0x11cbd6=_0x5c8f67[_0x238796];return{['$'+_0x238796]:_0x11cbd6};}exports['fields']=function(_0x31ab50){var _0x7dff16=null;if(_0x31ab50){_0x7dff16=_0x31ab50[_0x844e('0x4')](',');}return _0x7dff16;};exports[_0x844e('0x5')]=function(_0x32c6c7,_0x1f9921){var _0x536601={};if(!_[_0x844e('0x6')](_0x32c6c7)){_[_0x844e('0x7')](_0x32c6c7,function(_0x183c7e,_0x285a64){try{if(_0x1f9921){var _0x14909f=_[_0x844e('0x8')](_0x1f9921,{'name':_0x285a64})||{};if(hasSequelizeOperator(_0x183c7e)){_0x536601[_0x285a64]=getOperatorValue(_0x183c7e);}else if(_0x14909f[_0x844e('0x9')]==='DATE'&&_[_0x844e('0xa')](_0x183c7e)){var _0x23df3f=JSON['parse'](_0x183c7e);var _0x3a09d0={'$gte':moment(moment(_0x23df3f[_0x844e('0xb')])['format'](_0x844e('0xc')))[_0x844e('0xd')]()[_0x844e('0xe')](),'$lte':moment(moment(_0x23df3f['$lte'])[_0x844e('0xe')](_0x844e('0xc')))[_0x844e('0xd')]()[_0x844e('0xf')](0x1,'s')[_0x844e('0xe')]()};_0x536601[_0x285a64]=_0x3a09d0;}else if(_0x14909f[_0x844e('0x10')]===_0x844e('0x11')){_0x536601[_0x285a64]=_0x183c7e;}else{_0x536601[_0x285a64]=_[_0x844e('0x12')](_0x183c7e)?_0x183c7e:JSON['parse'](_0x183c7e);}}else{_0x536601[_0x285a64]=_[_0x844e('0x12')](_0x183c7e)?_0x183c7e:JSON['parse'](_0x183c7e);}}catch(_0x3c307f){_0x536601[_0x285a64]=_0x183c7e['split'](',');}});}return _0x536601;};exports[_0x844e('0x13')]=function(_0x55bcd6){_0x55bcd6=parseInt(_0x55bcd6,0xa);if(!_0x55bcd6||_0x55bcd6<0x0){_0x55bcd6=LIMIT_VALUE;}return _0x55bcd6;};exports[_0x844e('0x14')]=function(_0x10739f){_0x10739f=parseInt(_0x10739f,0xa);if(!_0x10739f||_0x10739f<0x0){_0x10739f=0x0;}return _0x10739f;};exports[_0x844e('0x15')]=function(_0x410325){var _0x3ea7da,_0x2b58c7=null;if(_0x410325){_0x3ea7da=_0x410325[_0x844e('0x4')](',');_0x2b58c7=_[_0x844e('0x16')](_0x3ea7da,function(_0x4ffb86){if(_0x4ffb86[_0x844e('0x17')]('-')===0x0){return[_0x4ffb86==='priority'?sequelize['cast'](sequelize[_0x844e('0x18')](_0x844e('0x19')),_0x844e('0x1a')):_0x4ffb86[_0x844e('0x1b')](0x1),'DESC'];}else{return[_0x4ffb86===_0x844e('0x19')?sequelize[_0x844e('0x1c')](sequelize['col'](_0x844e('0x19')),_0x844e('0x1a')):_0x4ffb86,_0x844e('0x1d')];}});}return _0x2b58c7;};exports[_0x844e('0x1e')]=function(_0x35236b,_0x3a65fc){if(_['isEmpty'](_0x35236b)){return _0x35236b;}if(_[_0x844e('0x12')](_0x35236b)){for(var _0xadf0d8=0x0;_0xadf0d8<_0x35236b[_0x844e('0x1f')];_0xadf0d8+=0x1){_0x35236b[_0xadf0d8]=this[_0x844e('0x1e')](_0x35236b[_0xadf0d8],_0x3a65fc);}return _0x35236b;}if(!_[_0x844e('0x20')](_0x35236b)){return _0x35236b;}if(_['isString'](_0x3a65fc)){_0x3a65fc=[_0x3a65fc];}if(!_[_0x844e('0x12')](_0x3a65fc)){return _0x35236b;}for(var _0x5080c1=0x0;_0x5080c1<_0x3a65fc['length'];_0x5080c1+=0x1){_[_0x844e('0x21')](_0x35236b,_0x3a65fc[_0x5080c1]);}for(var _0x130d87 in _0x35236b){if(_0x35236b[_0x844e('0x22')](_0x130d87)){_0x35236b[_0x130d87]=this['omit'](_0x35236b[_0x130d87],_0x3a65fc);}}return _0x35236b;};exports[_0x844e('0x23')]=function(_0x2d4acd){return _0x2d4acd[_0x844e('0x24')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x844e('0x25')]=function(_0x81d4de){return _0x81d4de[_0x844e('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x844e('0x26')]=function(_0x454b68){var _0x799cde=[];_0x454b68[_0x844e('0x4')](/[ ,]+/)[_0x844e('0x27')](function(_0x618bf6){_0x618bf6=_0x618bf6[_0x844e('0x28')](/([^:]")"+/g,'$1');_0x618bf6='+'+_0x618bf6+'*';var _0x550240=/[ `!@#$%^&*()_\-?~]/;if(_0x618bf6[_0x844e('0x24')](_0x550240))_0x618bf6='\x22'+_0x618bf6+'\x22';_0x799cde[_0x844e('0x29')](_0x618bf6);});return _0x799cde[_0x844e('0x2a')]('\x20');};exports[_0x844e('0x2b')]=function(_0x43ae36,_0x31754e,_0x27e5b3){var _0x55c488={},_0x26d6f2={};if(_0x31754e[_0x844e('0x2c')][_0x844e('0x2d')]){_0x31754e['query']['id']=_0x31754e[_0x844e('0x2c')][_0x844e('0x2d')];delete _0x31754e['query'][_0x844e('0x2d')];}_0x55c488[_0x844e('0x2e')]=_['map'](_0x43ae36,_0x844e('0x10'));_0x55c488[_0x844e('0x2c')]=_[_0x844e('0x2')](_0x31754e[_0x844e('0x2c')]);_0x55c488[_0x844e('0x5')]=_[_0x844e('0x2f')](_0x55c488[_0x844e('0x2e')],_0x55c488['query']);_0x26d6f2[_0x844e('0x30')]=_[_0x844e('0x2f')](_0x55c488[_0x844e('0x2e')],this[_0x844e('0x31')](_0x31754e[_0x844e('0x2c')][_0x844e('0x31')]));_0x26d6f2[_0x844e('0x30')]=_0x26d6f2[_0x844e('0x30')][_0x844e('0x1f')]?_0x26d6f2[_0x844e('0x30')]:_0x55c488[_0x844e('0x2e')];if(!_0x31754e['query']['hasOwnProperty'](_0x844e('0x32'))){_0x26d6f2[_0x844e('0x13')]=this[_0x844e('0x13')](_0x31754e[_0x844e('0x2c')][_0x844e('0x13')]);_0x26d6f2[_0x844e('0x14')]=this[_0x844e('0x14')](_0x31754e[_0x844e('0x2c')][_0x844e('0x14')]);}_0x26d6f2['order']=this[_0x844e('0x15')](_0x31754e['query'][_0x844e('0x15')]);_0x26d6f2['where']=this[_0x844e('0x5')](_['pick'](_0x31754e[_0x844e('0x2c')],_0x55c488[_0x844e('0x5')]),_0x43ae36);if(_0x31754e[_0x844e('0x2c')][_0x844e('0x33')]){var _0x2eb412=_0x43ae36;var _0x3b4c9e=_0x31754e[_0x844e('0x2c')][_0x844e('0x33')];if(typeof _0x3b4c9e===_0x844e('0x34')){_0x2eb412=_[_0x844e('0x33')](_0x43ae36,function(_0x3bdf19){return _['includes'](_0x3b4c9e[_0x844e('0x35')],_0x3bdf19[_0x844e('0x10')]);});_0x3b4c9e=_0x3b4c9e[_0x844e('0x36')];}_0x26d6f2['where']=_['merge'](_0x26d6f2[_0x844e('0x37')],{'$or':_[_0x844e('0x16')](_0x2eb412,function(_0x1a7817){if(_0x1a7817['type']!=='VIRTUAL'){if(_0x27e5b3){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x844e('0x18')](_0x1a7817[_0x844e('0x10')])),{'$like':sequelize['fn'](_0x844e('0x38'),'%'+_0x31754e[_0x844e('0x2c')][_0x844e('0x33')]+'%')});}else{var _0x4c756b={};_0x4c756b[_0x1a7817[_0x844e('0x10')]]={'$like':'%'+_0x31754e['query']['filter']+'%'};return _0x4c756b;}}})});}_0x26d6f2=_[_0x844e('0x39')]({},_0x26d6f2,_0x31754e[_0x844e('0x3a')]);return _0x26d6f2;}; \ No newline at end of file +var _0x46ed=['format','$lte','subtract','name','isArray','limit','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','omit','length','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','filters','intersection','attributes','nolimit','offset','order','where','pick','object','filter','includes','columns','value','merge','type','VIRTUAL','options','lodash','sequelize','keys','parse','fields','split','isEmpty','forOwn','find','DATE','YYYY-MM-DD','utc'];(function(_0x545af1,_0x49bd3e){var _0x3b122d=function(_0x1c4699){while(--_0x1c4699){_0x545af1['push'](_0x545af1['shift']());}};_0x3b122d(++_0x49bd3e);}(_0x46ed,0x168));var _0xd46e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x46ed[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xd46e('0x0'));var sequelize=require(_0xd46e('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x392bc1){var _0x1df30e=['ne'];try{var _0x1f15e7=JSON['parse'](_0x392bc1);var _0x2e6b84=Object[_0xd46e('0x2')](_0x1f15e7)[0x0];return _0x1df30e['includes'](_0x2e6b84);}catch(_0x15c96e){return![];}}function getOperatorValue(_0x1926d9){var _0x160bcf=JSON[_0xd46e('0x3')](_0x1926d9);var _0x45e680=Object[_0xd46e('0x2')](_0x160bcf)[0x0];var _0x437ea0=_0x160bcf[_0x45e680];return{['$'+_0x45e680]:_0x437ea0};}exports[_0xd46e('0x4')]=function(_0x31259b){var _0x19e4f4=null;if(_0x31259b){_0x19e4f4=_0x31259b[_0xd46e('0x5')](',');}return _0x19e4f4;};exports['filters']=function(_0x7b2d69,_0x81235b){var _0x50ccd3={};if(!_[_0xd46e('0x6')](_0x7b2d69)){_[_0xd46e('0x7')](_0x7b2d69,function(_0x3a4397,_0x443000){try{if(_0x81235b){var _0x1ad723=_[_0xd46e('0x8')](_0x81235b,{'name':_0x443000})||{};if(hasSequelizeOperator(_0x3a4397)){_0x50ccd3[_0x443000]=getOperatorValue(_0x3a4397);}else if(_0x1ad723['type']===_0xd46e('0x9')&&_['isPlainObject'](_0x3a4397)){var _0x48550b=JSON[_0xd46e('0x3')](_0x3a4397);var _0x27dbfb={'$gte':moment(moment(_0x48550b['$gte'])['format'](_0xd46e('0xa')))[_0xd46e('0xb')]()[_0xd46e('0xc')](),'$lte':moment(moment(_0x48550b[_0xd46e('0xd')])['format'](_0xd46e('0xa')))[_0xd46e('0xb')]()[_0xd46e('0xe')](0x1,'s')[_0xd46e('0xc')]()};_0x50ccd3[_0x443000]=_0x27dbfb;}else if(_0x1ad723[_0xd46e('0xf')]==='uniqueid'){_0x50ccd3[_0x443000]=_0x3a4397;}else{_0x50ccd3[_0x443000]=_[_0xd46e('0x10')](_0x3a4397)?_0x3a4397:JSON[_0xd46e('0x3')](_0x3a4397);}}else{_0x50ccd3[_0x443000]=_[_0xd46e('0x10')](_0x3a4397)?_0x3a4397:JSON['parse'](_0x3a4397);}}catch(_0x5ddd04){_0x50ccd3[_0x443000]=_0x3a4397[_0xd46e('0x5')](',');}});}return _0x50ccd3;};exports[_0xd46e('0x11')]=function(_0x488690){_0x488690=parseInt(_0x488690,0xa);if(!_0x488690||_0x488690<0x0){_0x488690=LIMIT_VALUE;}return _0x488690;};exports['offset']=function(_0x2d6f2c){_0x2d6f2c=parseInt(_0x2d6f2c,0xa);if(!_0x2d6f2c||_0x2d6f2c<0x0){_0x2d6f2c=0x0;}return _0x2d6f2c;};exports[_0xd46e('0x12')]=function(_0x362885){var _0x2273c5,_0x409010=null;if(_0x362885){_0x2273c5=_0x362885[_0xd46e('0x5')](',');_0x409010=_[_0xd46e('0x13')](_0x2273c5,function(_0x327b7e){if(_0x327b7e[_0xd46e('0x14')]('-')===0x0){return[_0x327b7e===_0xd46e('0x15')?sequelize[_0xd46e('0x16')](sequelize['col'](_0xd46e('0x15')),_0xd46e('0x17')):_0x327b7e[_0xd46e('0x18')](0x1),_0xd46e('0x19')];}else{return[_0x327b7e===_0xd46e('0x15')?sequelize[_0xd46e('0x16')](sequelize[_0xd46e('0x1a')](_0xd46e('0x15')),_0xd46e('0x17')):_0x327b7e,'ASC'];}});}return _0x409010;};exports[_0xd46e('0x1b')]=function(_0x5424e5,_0x4b8f6a){if(_[_0xd46e('0x6')](_0x5424e5)){return _0x5424e5;}if(_[_0xd46e('0x10')](_0x5424e5)){for(var _0x21135f=0x0;_0x21135f<_0x5424e5[_0xd46e('0x1c')];_0x21135f+=0x1){_0x5424e5[_0x21135f]=this[_0xd46e('0x1b')](_0x5424e5[_0x21135f],_0x4b8f6a);}return _0x5424e5;}if(!_[_0xd46e('0x1d')](_0x5424e5)){return _0x5424e5;}if(_[_0xd46e('0x1e')](_0x4b8f6a)){_0x4b8f6a=[_0x4b8f6a];}if(!_['isArray'](_0x4b8f6a)){return _0x5424e5;}for(var _0x45d789=0x0;_0x45d789<_0x4b8f6a[_0xd46e('0x1c')];_0x45d789+=0x1){_[_0xd46e('0x1f')](_0x5424e5,_0x4b8f6a[_0x45d789]);}for(var _0x17db79 in _0x5424e5){if(_0x5424e5[_0xd46e('0x20')](_0x17db79)){_0x5424e5[_0x17db79]=this[_0xd46e('0x1b')](_0x5424e5[_0x17db79],_0x4b8f6a);}}return _0x5424e5;};exports['isNumeric']=function(_0x465d54){return _0x465d54[_0xd46e('0x21')](RegExp(_0xd46e('0x22')))?!![]:![];};exports[_0xd46e('0x23')]=function(_0x106edc){return _0x106edc[_0xd46e('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xd46e('0x24')]=function(_0x2c5ec7){var _0x18f060=[];_0x2c5ec7[_0xd46e('0x5')](/[ ,]+/)[_0xd46e('0x25')](function(_0x504324){_0x504324=_0x504324[_0xd46e('0x26')](/([^:]")"+/g,'$1');_0x504324='+'+_0x504324+'*';var _0x5ed8dc=/[ `!@#$%^&*()_\-?~]/;if(_0x504324[_0xd46e('0x21')](_0x5ed8dc))_0x504324='\x22'+_0x504324+'\x22';_0x18f060[_0xd46e('0x27')](_0x504324);});return _0x18f060[_0xd46e('0x28')]('\x20');};exports[_0xd46e('0x29')]=function(_0x5ef248,_0x2eed3a,_0x3e2eca){var _0x5ab9df={},_0x4e7246={};if(_0x2eed3a[_0xd46e('0x2a')]['$id']){_0x2eed3a[_0xd46e('0x2a')]['id']=_0x2eed3a[_0xd46e('0x2a')][_0xd46e('0x2b')];delete _0x2eed3a['query']['$id'];}_0x5ab9df[_0xd46e('0x2c')]=_[_0xd46e('0x13')](_0x5ef248,_0xd46e('0xf'));_0x5ab9df[_0xd46e('0x2a')]=_[_0xd46e('0x2')](_0x2eed3a[_0xd46e('0x2a')]);_0x5ab9df[_0xd46e('0x2d')]=_[_0xd46e('0x2e')](_0x5ab9df['model'],_0x5ab9df[_0xd46e('0x2a')]);_0x4e7246[_0xd46e('0x2f')]=_[_0xd46e('0x2e')](_0x5ab9df[_0xd46e('0x2c')],this[_0xd46e('0x4')](_0x2eed3a[_0xd46e('0x2a')][_0xd46e('0x4')]));_0x4e7246['attributes']=_0x4e7246[_0xd46e('0x2f')][_0xd46e('0x1c')]?_0x4e7246['attributes']:_0x5ab9df[_0xd46e('0x2c')];if(!_0x2eed3a[_0xd46e('0x2a')][_0xd46e('0x20')](_0xd46e('0x30'))){_0x4e7246['limit']=this[_0xd46e('0x11')](_0x2eed3a[_0xd46e('0x2a')][_0xd46e('0x11')]);_0x4e7246[_0xd46e('0x31')]=this[_0xd46e('0x31')](_0x2eed3a[_0xd46e('0x2a')][_0xd46e('0x31')]);}_0x4e7246[_0xd46e('0x32')]=this['sort'](_0x2eed3a[_0xd46e('0x2a')][_0xd46e('0x12')]);_0x4e7246[_0xd46e('0x33')]=this[_0xd46e('0x2d')](_[_0xd46e('0x34')](_0x2eed3a['query'],_0x5ab9df[_0xd46e('0x2d')]),_0x5ef248);if(_0x2eed3a['query']['filter']){var _0x4c325f=_0x5ef248;var _0x55098d=_0x2eed3a[_0xd46e('0x2a')]['filter'];if(typeof _0x55098d===_0xd46e('0x35')){_0x4c325f=_[_0xd46e('0x36')](_0x5ef248,function(_0x57f803){return _[_0xd46e('0x37')](_0x55098d[_0xd46e('0x38')],_0x57f803[_0xd46e('0xf')]);});_0x55098d=_0x55098d[_0xd46e('0x39')];}_0x4e7246[_0xd46e('0x33')]=_[_0xd46e('0x3a')](_0x4e7246[_0xd46e('0x33')],{'$or':_[_0xd46e('0x13')](_0x4c325f,function(_0x3a98e4){if(_0x3a98e4[_0xd46e('0x3b')]!==_0xd46e('0x3c')){if(_0x3e2eca){return sequelize['where'](sequelize['fn']('lower',sequelize['col'](_0x3a98e4[_0xd46e('0xf')])),{'$like':sequelize['fn']('lower','%'+_0x2eed3a[_0xd46e('0x2a')][_0xd46e('0x36')]+'%')});}else{var _0x3fdf67={};_0x3fdf67[_0x3a98e4[_0xd46e('0xf')]]={'$like':'%'+_0x2eed3a[_0xd46e('0x2a')][_0xd46e('0x36')]+'%'};return _0x3fdf67;}}})});}_0x4e7246=_[_0xd46e('0x3a')]({},_0x4e7246,_0x2eed3a[_0xd46e('0x3d')]);return _0x4e7246;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8ac1ed0..1779e25 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x5bda3b,_0x41160f){var _0x431bb9=function(_0x160122){while(--_0x160122){_0x5bda3b['push'](_0x5bda3b['shift']());}};_0x431bb9(++_0x41160f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _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(_0x4c139d,_0xf5e7bf){var _0x5d7bb1=function(_0x2ddf30){while(--_0x2ddf30){_0x4c139d['push'](_0x4c139d['shift']());}};_0x5d7bb1(++_0xf5e7bf);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 1c5fd35..d1ab672 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 _0xa4de=['substring','lodash','crypto','child_process','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','hex','getUuid','test','licenseToken','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','digest'];(function(_0x57a755,_0xfffd78){var _0x182e75=function(_0x5f2642){while(--_0x5f2642){_0x57a755['push'](_0x57a755['shift']());}};_0x182e75(++_0xfffd78);}(_0xa4de,0x6a));var _0xea4d=function(_0x2075db,_0x70a905){_0x2075db=_0x2075db-0x0;var _0x2a615b=_0xa4de[_0x2075db];return _0x2a615b;};'use strict';var _=require(_0xea4d('0x0'));var os=require('os');var crypto=require(_0xea4d('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xea4d('0x2'))['execSync'];var config=require('../environment');function getInterfaces(){var _0xc65040=[];var _0x193b22=os[_0xea4d('0x3')]();var _0x4aee10=_['orderBy'](_[_0xea4d('0x4')](_0x193b22));for(var _0x24f15f=0x0;_0x24f15f<_0x4aee10[_0xea4d('0x5')];_0x24f15f++){var _0xb192f0=_0x193b22[_0x4aee10[_0x24f15f]][_0xea4d('0x6')](function(_0x2075a2){return _0x2075a2[_0xea4d('0x7')]===_0xea4d('0x8')&&_0x2075a2[_0xea4d('0x9')]===![];});_0xc65040=_0xc65040[_0xea4d('0xa')](_0xb192f0);}return _0xc65040;}function getFirstInterface(){var _0xaae1ee=_[_0xea4d('0xb')](getInterfaces());return{'macAddress':_0xaae1ee&&_0xaae1ee[_0xea4d('0xc')]?_0xaae1ee[_0xea4d('0xc')]:_0xea4d('0xd'),'ipAddress':_0xaae1ee&&_0xaae1ee[_0xea4d('0xe')]?_0xaae1ee[_0xea4d('0xe')]:_0xea4d('0xf')};}exports[_0xea4d('0x10')]=getFirstInterface;function getCPUhash(){var _0x5a14ad=_[_0xea4d('0x11')](os[_0xea4d('0x12')]()[_0xea4d('0x13')](function(_0x2cadbf){return _0x2cadbf[_0xea4d('0x14')];}))[_0xea4d('0x15')](':');return crypto[_0xea4d('0x16')](_0xea4d('0x17'))[_0xea4d('0x18')](_0x5a14ad)['digest'](_0xea4d('0x19'));}exports[_0xea4d('0x1a')]=function(){var _0x1196fb=os['platform']();var _0x19db97=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x19db97[_0xea4d('0x1b')](config[_0xea4d('0x1c')])){return config[_0xea4d('0x1c')];}else if(_0x1196fb==='win32'){return exec(_0xea4d('0x1d'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x367cd8=getFirstInterface();var _0x5f4993=getCPUhash();var _0x207f9e=_0x5f4993+'|'+os[_0xea4d('0x1e')]()+'|'+_0x367cd8[_0xea4d('0x1f')]+'|'+_0x367cd8[_0xea4d('0x20')];var _0x333fc2=crypto[_0xea4d('0x16')]('md5')[_0xea4d('0x18')](_0x207f9e)[_0xea4d('0x21')]('hex');return _0x333fc2[_0xea4d('0x22')](0x0,0x8)+'-'+_0x333fc2[_0xea4d('0x22')](0x8,0xc)+'-'+_0x333fc2[_0xea4d('0x22')](0xc,0x10)+'-'+_0x333fc2[_0xea4d('0x22')](0x10,0x14)+'-'+_0x333fc2[_0xea4d('0x22')](0x14);}}; \ No newline at end of file +var _0xe4db=['test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','digest','substring','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys','length','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','join','md5','update','hex','platform','licenseToken'];(function(_0x2e6a69,_0x1ba014){var _0x583b2a=function(_0x1e8d49){while(--_0x1e8d49){_0x2e6a69['push'](_0x2e6a69['shift']());}};_0x583b2a(++_0x1ba014);}(_0xe4db,0x13d));var _0xbe4d=function(_0x5e9e9d,_0x1151b9){_0x5e9e9d=_0x5e9e9d-0x0;var _0x18ed2c=_0xe4db[_0x5e9e9d];return _0x18ed2c;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0xbe4d('0x0'));var exec=require(_0xbe4d('0x1'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x56764c=[];var _0x3d40ee=os[_0xbe4d('0x2')]();var _0x3b409d=_[_0xbe4d('0x3')](_[_0xbe4d('0x4')](_0x3d40ee));for(var _0x175b6d=0x0;_0x175b6d<_0x3b409d[_0xbe4d('0x5')];_0x175b6d++){var _0x59601f=_0x3d40ee[_0x3b409d[_0x175b6d]]['filter'](function(_0x3bd324){return _0x3bd324[_0xbe4d('0x6')]===_0xbe4d('0x7')&&_0x3bd324[_0xbe4d('0x8')]===![];});_0x56764c=_0x56764c[_0xbe4d('0x9')](_0x59601f);}return _0x56764c;}function getFirstInterface(){var _0x1b0a06=_[_0xbe4d('0xa')](getInterfaces());return{'macAddress':_0x1b0a06&&_0x1b0a06[_0xbe4d('0xb')]?_0x1b0a06[_0xbe4d('0xb')]:_0xbe4d('0xc'),'ipAddress':_0x1b0a06&&_0x1b0a06['address']?_0x1b0a06[_0xbe4d('0xd')]:_0xbe4d('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x28fe07=_['orderBy'](os[_0xbe4d('0xf')]()[_0xbe4d('0x10')](function(_0x3fadd6){return _0x3fadd6['model'];}))[_0xbe4d('0x11')](':');return crypto['createHash'](_0xbe4d('0x12'))[_0xbe4d('0x13')](_0x28fe07)['digest'](_0xbe4d('0x14'));}exports['getUuid']=function(){var _0x1b6d33=os[_0xbe4d('0x15')]();var _0x599807=/[0-9a-f-]{36}/;if(config[_0xbe4d('0x16')]&&_0x599807[_0xbe4d('0x17')](config[_0xbe4d('0x16')])){return config[_0xbe4d('0x16')];}else if(_0x1b6d33===_0xbe4d('0x18')){return exec(_0xbe4d('0x19'),{'encoding':_0xbe4d('0x1a')})[_0xbe4d('0x1b')]('\x0d\x0a','');}else{var _0x536dc1=getFirstInterface();var _0x124960=getCPUhash();var _0x14bd88=_0x124960+'|'+os[_0xbe4d('0x1c')]()+'|'+_0x536dc1[_0xbe4d('0x1d')]+'|'+_0x536dc1[_0xbe4d('0x1e')];var _0x25fbe6=crypto[_0xbe4d('0x1f')](_0xbe4d('0x12'))[_0xbe4d('0x13')](_0x14bd88)[_0xbe4d('0x20')](_0xbe4d('0x14'));return _0x25fbe6[_0xbe4d('0x21')](0x0,0x8)+'-'+_0x25fbe6[_0xbe4d('0x21')](0x8,0xc)+'-'+_0x25fbe6['substring'](0xc,0x10)+'-'+_0x25fbe6['substring'](0x10,0x14)+'-'+_0x25fbe6[_0xbe4d('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7048674..39d8af8 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 _0xa05e=['./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor'];(function(_0x5e5c16,_0xf14e8d){var _0x551241=function(_0x1b8cd){while(--_0x1b8cd){_0x5e5c16['push'](_0x5e5c16['shift']());}};_0x551241(++_0xf14e8d);}(_0xa05e,0x1b2));var _0xea05=function(_0x37e4d6,_0x4ed6e8){_0x37e4d6=_0x37e4d6-0x0;var _0x2d3a0a=_0xa05e[_0x37e4d6];return _0x2d3a0a;};'use strict';var util=require(_0xea05('0x0'));var moment=require('moment');var rp=require(_0xea05('0x1'));var BPromise=require(_0xea05('0x2'));var pkginfo=require(_0xea05('0x3'))(module,'version');var db=require(_0xea05('0x4'))['db'];var encryptor=require(_0xea05('0x5'));var hardware=require(_0xea05('0x6'));var logger=require('../logger')(_0xea05('0x7'));var HOST=_0xea05('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x405732){return new BPromise(function(_0x1c18f4,_0x5bdd40){var _0x1ca4bc=util[_0xea05('0x9')](_0xea05('0xa'),HOST,_0x405732,module[_0xea05('0xb')][_0xea05('0xc')]);if(oldToken){_0x1ca4bc=util['format'](_0xea05('0xd'),HOST,_0x405732,module[_0xea05('0xb')][_0xea05('0xc')],oldToken);}var _0x4c06ad={'uri':_0x1ca4bc,'method':_0xea05('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x4c06ad)[_0xea05('0xf')](function(_0x91915d){_0x1c18f4(_0x91915d);})[_0xea05('0x10')](function(_0x1b6ff1){_0x5bdd40(_0x1b6ff1);});});}function manageLicense(_0x403a2d,_0x3d2dd3){var _0x4dd8a5=_0x3d2dd3[_0xea05('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x4dd8a5[_0xea05('0x12')]!==_0x403a2d&&!_0x4dd8a5[_0xea05('0x13')]){oldToken=_0x4dd8a5[_0xea05('0x12')];}httpRequest(_0x403a2d)[_0xea05('0xf')](function(_0x21fb1b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x21fb1b[_0xea05('0x14')]){isOldTokenSent=![];if(!_0x4dd8a5[_0xea05('0x7')]&&_0x4dd8a5['license']!=_0x21fb1b['license']||_0x4dd8a5[_0xea05('0x7')]&&_0x4dd8a5[_0xea05('0x13')]){logger[_0xea05('0x15')](_0xea05('0x16'));}if(_0x4dd8a5[_0xea05('0x7')]&&!_0x4dd8a5[_0xea05('0x13')]&&_0x4dd8a5[_0xea05('0x7')]!=_0x21fb1b[_0xea05('0x7')]){logger[_0xea05('0x15')](_0xea05('0x17'));}if(_0x4dd8a5[_0xea05('0x7')]&&!_0x4dd8a5[_0xea05('0x13')]&&_0x4dd8a5[_0xea05('0x7')]==_0x21fb1b[_0xea05('0x7')]){return _0x3d2dd3;}return _0x3d2dd3[_0xea05('0x18')]({'data1':_0x403a2d,'data2':null,'license':_0x21fb1b[_0xea05('0x7')]});}else{if(_0x21fb1b[_0xea05('0x7')]||_0x4dd8a5['license']){if(!_0x4dd8a5[_0xea05('0x13')]){if(_0x4dd8a5[_0xea05('0x12')]==_0x403a2d){GRAY_PERIOD_REASON=_0xea05('0x19');logger[_0xea05('0x15')](_0xea05('0x1a'));}else{GRAY_PERIOD_REASON=_0xea05('0x1b');logger[_0xea05('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4dd8a5[_0xea05('0x12')],_0x403a2d);}logger[_0xea05('0x15')](_0xea05('0x1c'),GRAY_PERIOD_REASON[_0xea05('0x1d')](),moment()[_0xea05('0x9')](_0xea05('0x1e')));return _0x3d2dd3[_0xea05('0x18')]({'data2':encryptor[_0xea05('0x1f')](moment()[_0xea05('0x9')](_0xea05('0x1e')))});}else{if(moment()[_0xea05('0x20')](encryptor['decryptString'](_0x4dd8a5[_0xea05('0x13')]),_0xea05('0x21'))>DAYS){logger['info'](_0xea05('0x22'),moment()['format'](_0xea05('0x1e')));isOldTokenSent=![];return _0x3d2dd3['update']({'data1':_0x403a2d,'data2':null,'license':null});}}}else{if(_0x4dd8a5[_0xea05('0x12')]!=_0x403a2d){logger[_0xea05('0x15')](_0xea05('0x23'),_0x4dd8a5[_0xea05('0x12')],_0x403a2d);return _0x3d2dd3[_0xea05('0x18')]({'data1':_0x403a2d,'data2':null,'license':null});}}}return _0x3d2dd3;})[_0xea05('0xf')](function(_0x5df941){_0x3d2dd3=_0x5df941;})[_0xea05('0x10')](function(_0x3a354b){logger['error'](_0x3a354b[_0xea05('0x24')]);})[_0xea05('0x25')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3d2dd3);},TIME);});}function defaultLicense(){var _0x51dd0c=hardware[_0xea05('0x26')]();if(_0x51dd0c){return db[_0xea05('0x27')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x51dd0c}})[_0xea05('0x28')](function(_0x41d40e,_0xc25316){logger[_0xea05('0x15')](_0xea05('0x29'),_0x51dd0c);manageLicense(_0x51dd0c,_0x41d40e);})['catch'](function(_0x131705){logger[_0xea05('0x2a')](_0x131705['message']);});}}exports[_0xea05('0x2b')]=defaultLicense; \ No newline at end of file +var _0x5c34=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','update','encryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info'];(function(_0x2ce297,_0x421d96){var _0xb429a=function(_0x3cc51b){while(--_0x3cc51b){_0x2ce297['push'](_0x2ce297['shift']());}};_0xb429a(++_0x421d96);}(_0x5c34,0xfa));var _0x45c3=function(_0x5b81b7,_0x53a9e6){_0x5b81b7=_0x5b81b7-0x0;var _0x385e12=_0x5c34[_0x5b81b7];return _0x385e12;};'use strict';var util=require('util');var moment=require(_0x45c3('0x0'));var rp=require(_0x45c3('0x1'));var BPromise=require(_0x45c3('0x2'));var pkginfo=require(_0x45c3('0x3'))(module,_0x45c3('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x45c3('0x5'));var hardware=require(_0x45c3('0x6'));var logger=require(_0x45c3('0x7'))(_0x45c3('0x8'));var HOST=_0x45c3('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x39e9ca){return new BPromise(function(_0x327101,_0x4a9fa1){var _0x21c2c9=util[_0x45c3('0xa')](_0x45c3('0xb'),HOST,_0x39e9ca,module[_0x45c3('0xc')][_0x45c3('0x4')]);if(oldToken){_0x21c2c9=util[_0x45c3('0xa')](_0x45c3('0xd'),HOST,_0x39e9ca,module[_0x45c3('0xc')][_0x45c3('0x4')],oldToken);}var _0x3fe977={'uri':_0x21c2c9,'method':_0x45c3('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x3fe977)[_0x45c3('0xf')](function(_0x3e27c4){_0x327101(_0x3e27c4);})[_0x45c3('0x10')](function(_0x530bf4){_0x4a9fa1(_0x530bf4);});});}function manageLicense(_0x147369,_0x4f5c2c){var _0x32ab75=_0x4f5c2c[_0x45c3('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x32ab75[_0x45c3('0x12')]!==_0x147369&&!_0x32ab75['data2']){oldToken=_0x32ab75[_0x45c3('0x12')];}httpRequest(_0x147369)[_0x45c3('0xf')](function(_0x5a2619){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5a2619[_0x45c3('0x13')]){isOldTokenSent=![];if(!_0x32ab75[_0x45c3('0x8')]&&_0x32ab75[_0x45c3('0x8')]!=_0x5a2619[_0x45c3('0x8')]||_0x32ab75[_0x45c3('0x8')]&&_0x32ab75[_0x45c3('0x14')]){logger['info'](_0x45c3('0x15'));}if(_0x32ab75[_0x45c3('0x8')]&&!_0x32ab75[_0x45c3('0x14')]&&_0x32ab75[_0x45c3('0x8')]!=_0x5a2619[_0x45c3('0x8')]){logger[_0x45c3('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x32ab75[_0x45c3('0x8')]&&!_0x32ab75[_0x45c3('0x14')]&&_0x32ab75['license']==_0x5a2619[_0x45c3('0x8')]){return _0x4f5c2c;}return _0x4f5c2c['update']({'data1':_0x147369,'data2':null,'license':_0x5a2619[_0x45c3('0x8')]});}else{if(_0x5a2619[_0x45c3('0x8')]||_0x32ab75[_0x45c3('0x8')]){if(!_0x32ab75[_0x45c3('0x14')]){if(_0x32ab75['data1']==_0x147369){GRAY_PERIOD_REASON=_0x45c3('0x17');logger[_0x45c3('0x16')](_0x45c3('0x18'));}else{GRAY_PERIOD_REASON=_0x45c3('0x19');logger[_0x45c3('0x16')](_0x45c3('0x1a'),_0x32ab75['data1'],_0x147369);}logger[_0x45c3('0x16')](_0x45c3('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x45c3('0xa')](_0x45c3('0x1c')));return _0x4f5c2c[_0x45c3('0x1d')]({'data2':encryptor[_0x45c3('0x1e')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor['decryptString'](_0x32ab75[_0x45c3('0x14')]),'days')>DAYS){logger['info'](_0x45c3('0x1f'),moment()[_0x45c3('0xa')](_0x45c3('0x1c')));isOldTokenSent=![];return _0x4f5c2c['update']({'data1':_0x147369,'data2':null,'license':null});}}}else{if(_0x32ab75[_0x45c3('0x12')]!=_0x147369){logger['info'](_0x45c3('0x1a'),_0x32ab75['data1'],_0x147369);return _0x4f5c2c[_0x45c3('0x1d')]({'data1':_0x147369,'data2':null,'license':null});}}}return _0x4f5c2c;})[_0x45c3('0xf')](function(_0x25d9b1){_0x4f5c2c=_0x25d9b1;})[_0x45c3('0x10')](function(_0x2931fe){logger[_0x45c3('0x20')](_0x2931fe[_0x45c3('0x21')]);})[_0x45c3('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4f5c2c);},TIME);});}function defaultLicense(){var _0x5407b5=hardware[_0x45c3('0x23')]();if(_0x5407b5){return db[_0x45c3('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x5407b5}})[_0x45c3('0x25')](function(_0x1b0ab2,_0x82619e){logger[_0x45c3('0x16')](_0x45c3('0x26'),_0x5407b5);manageLicense(_0x5407b5,_0x1b0ab2);})['catch'](function(_0x442792){logger['error'](_0x442792[_0x45c3('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a059d5a..b1143e1 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 _0xaac4=['sequelize','col','count','user','telephone','users','admin','pick','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','isEmpty','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','add','days','grayReason','disabled','message','findAll','role','COUNT'];(function(_0x38433b,_0x2e0de2){var _0x40309e=function(_0x256025){while(--_0x256025){_0x38433b['push'](_0x38433b['shift']());}};_0x40309e(++_0x2e0de2);}(_0xaac4,0x1ee));var _0x4aac=function(_0x3e9b06,_0x417393){_0x3e9b06=_0x3e9b06-0x0;var _0x442af8=_0xaac4[_0x3e9b06];return _0x442af8;};'use strict';var util=require(_0x4aac('0x0'));var _=require(_0x4aac('0x1'));var moment=require(_0x4aac('0x2'));var BPromise=require('bluebird');var hardware=require(_0x4aac('0x3'));var encryptor=require(_0x4aac('0x4'));var db=require(_0x4aac('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4aac('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4aac('0x7'),'machineUuid':hardware[_0x4aac('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4aac('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4aac('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x388cf8){return new BPromise(function(_0x25dbf6,_0x52438d){return db['License'][_0x4aac('0xa')](_[_0x4aac('0xb')](_0x388cf8,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x2f88a1){return checkLicense(_0x2f88a1,null);})[_0x4aac('0xc')](function(_0xa4d73){_0x25dbf6(_0xa4d73);return;})[_0x4aac('0xd')](function(_0xcba3c2){_0x52438d(_0xcba3c2);});});}function checkLicense(_0x7dec97,_0x5098dd){if(!_0x7dec97){demoLicense[_0x4aac('0xe')]=_0x7dec97['data1'];return demoLicense;}try{var _0x219071=_0x5098dd||_0x7dec97['license'];if(_[_0x4aac('0xf')](_0x219071)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xd7c2a4=_0x7dec97[_0x4aac('0x10')];var _0x14160e=_0x7dec97[_0x4aac('0x11')];var _0x44a33a=_0xd7c2a4[_0x4aac('0x12')]('-')[0x4];var _0x113b29=_0xd7c2a4[_0x4aac('0x12')]('-')[0x0];var _0x38e737=encryptor[_0x4aac('0x13')](_0x219071,util[_0x4aac('0x14')](_0x4aac('0x15'),_0x44a33a,_0xd7c2a4,_0x113b29));var _0x4a342a=JSON[_0x4aac('0x16')](_0x38e737);_0x4a342a[_0x4aac('0x17')]=![];_0x4a342a['uuid']=_0xd7c2a4;_0x4a342a[_0x4aac('0x18')]=hardware[_0x4aac('0x8')]();if(_0x14160e){var _0x46655c=encryptor[_0x4aac('0x13')](_0x14160e);_0x4a342a[_0x4aac('0x19')]=_0x46655c;_0x4a342a['deadline']=moment(_0x46655c)[_0x4aac('0x1a')](0x7,_0x4aac('0x1b'))[_0x4aac('0x14')]();_0x4a342a[_0x4aac('0x1c')]=_0x4a342a[_0x4aac('0xe')]!=_0x4a342a[_0x4aac('0x18')]?'changed':_0x4aac('0x1d');}return _0x4a342a;}catch(_0x42b314){breakingLicense['uuid']=_0x7dec97[_0x4aac('0x10')];breakingLicense[_0x4aac('0x1e')]=_0x42b314[_0x4aac('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4918bf,_0x336289){getLicense()[_0x4aac('0xc')](function(_0x1b5de5){return db['User'][_0x4aac('0x1f')]({'attributes':[_0x4aac('0x20'),[db['sequelize']['fn'](_0x4aac('0x21'),db[_0x4aac('0x22')][_0x4aac('0x23')](_0x4aac('0x20'))),_0x4aac('0x24')]],'group':'role','where':{'role':{'$or':['admin',_0x4aac('0x25'),_0x4aac('0x26')]}},'raw':!![]})[_0x4aac('0xc')](function(_0x125e04){var _0x492cfd={'user':_0x1b5de5[_0x4aac('0x27')]||0x0,'telephone':_0x1b5de5['telephones']||0x0};_0x125e04['forEach'](function(_0x200f4f){var _0x4017a3=_0x200f4f['role']===_0x4aac('0x28')?_0x4aac('0x25'):_0x200f4f[_0x4aac('0x20')];_0x492cfd[_0x4017a3]-=_0x200f4f[_0x4aac('0x24')];if(_0x492cfd[_0x4017a3]<0x0)_0x492cfd[_0x4017a3]=0x0;});_0x4918bf(_0x492cfd);return;});})['catch'](function(_0x373255){_0x336289(_0x373255);});});}function checkUserLimits(_0x2ffcd5){return new BPromise(function(_0x5eb0f8,_0x1c4e98){getLimits()[_0x4aac('0xc')](function(_0x33dbbf){var _0x257c8a=_[_0x4aac('0x29')](_['countBy'](_0x2ffcd5,_0x4aac('0x20')),['admin','user',_0x4aac('0x26')]);var _0x2a803b=(_0x257c8a['admin']||0x0)+(_0x257c8a['user']||0x0);var _0x25becc=_0x257c8a['telephone']||0x0;if(_0x2a803b>_0x33dbbf[_0x4aac('0x25')])return _0x1c4e98('License\x20limit\x20reached\x20for\x20users');if(_0x25becc>_0x33dbbf[_0x4aac('0x26')])return _0x1c4e98(_0x4aac('0x2a'));return _0x5eb0f8();})[_0x4aac('0xd')](function(_0x43a584){_0x1c4e98(_0x43a584);});});}module[_0x4aac('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x64ca=['bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','data2','decryptString','format','%s:%s:%s','parse','machineUuid','gray','deadline','add','days','grayReason','changed','message','findAll','sequelize','col','role','count','admin','users','telephones','pick','countBy','user','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment'];(function(_0x3037f6,_0x46d319){var _0x29bf5b=function(_0x207893){while(--_0x207893){_0x3037f6['push'](_0x3037f6['shift']());}};_0x29bf5b(++_0x46d319);}(_0x64ca,0x131));var _0xa64c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x64ca[_0x5ddb1c];return _0x354adc;};'use strict';var util=require(_0xa64c('0x0'));var _=require(_0xa64c('0x1'));var moment=require(_0xa64c('0x2'));var BPromise=require(_0xa64c('0x3'));var hardware=require(_0xa64c('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0xa64c('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa64c('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa64c('0x7'),'machineUuid':hardware[_0xa64c('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xa64c('0x9'),'machineUuid':hardware[_0xa64c('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x20ac9d){return new BPromise(function(_0x24f678,_0x592d97){return db[_0xa64c('0xa')][_0xa64c('0xb')](_[_0xa64c('0xc')](_0x20ac9d,{'raw':!![],'where':{'id':0x1}}))[_0xa64c('0xd')](function(_0x335bf8){return checkLicense(_0x335bf8,null);})[_0xa64c('0xd')](function(_0x3526cc){_0x24f678(_0x3526cc);return;})[_0xa64c('0xe')](function(_0x42a4eb){_0x592d97(_0x42a4eb);});});}function checkLicense(_0x22fbe0,_0x1f3ec3){if(!_0x22fbe0){demoLicense[_0xa64c('0xf')]=_0x22fbe0[_0xa64c('0x10')];return demoLicense;}try{var _0x3ddac1=_0x1f3ec3||_0x22fbe0['license'];if(_['isEmpty'](_0x3ddac1)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x225b8c=_0x22fbe0[_0xa64c('0x10')];var _0x269bdf=_0x22fbe0[_0xa64c('0x11')];var _0x5f3167=_0x225b8c['split']('-')[0x4];var _0x1e578e=_0x225b8c['split']('-')[0x0];var _0xcc0875=encryptor[_0xa64c('0x12')](_0x3ddac1,util[_0xa64c('0x13')](_0xa64c('0x14'),_0x5f3167,_0x225b8c,_0x1e578e));var _0x3f3121=JSON[_0xa64c('0x15')](_0xcc0875);_0x3f3121['demo']=![];_0x3f3121[_0xa64c('0xf')]=_0x225b8c;_0x3f3121[_0xa64c('0x16')]=hardware[_0xa64c('0x8')]();if(_0x269bdf){var _0x9051ee=encryptor[_0xa64c('0x12')](_0x269bdf);_0x3f3121[_0xa64c('0x17')]=_0x9051ee;_0x3f3121[_0xa64c('0x18')]=moment(_0x9051ee)[_0xa64c('0x19')](0x7,_0xa64c('0x1a'))['format']();_0x3f3121[_0xa64c('0x1b')]=_0x3f3121[_0xa64c('0xf')]!=_0x3f3121[_0xa64c('0x16')]?_0xa64c('0x1c'):'disabled';}return _0x3f3121;}catch(_0x257832){breakingLicense[_0xa64c('0xf')]=_0x22fbe0['data1'];breakingLicense[_0xa64c('0x1d')]=_0x257832[_0xa64c('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4df4d1,_0x9895b1){getLicense()[_0xa64c('0xd')](function(_0x2b288e){return db['User'][_0xa64c('0x1e')]({'attributes':['role',[db['sequelize']['fn']('COUNT',db[_0xa64c('0x1f')][_0xa64c('0x20')](_0xa64c('0x21'))),_0xa64c('0x22')]],'group':_0xa64c('0x21'),'where':{'role':{'$or':[_0xa64c('0x23'),'user','telephone']}},'raw':!![]})[_0xa64c('0xd')](function(_0xbaa5f0){var _0x20ea05={'user':_0x2b288e[_0xa64c('0x24')]||0x0,'telephone':_0x2b288e[_0xa64c('0x25')]||0x0};_0xbaa5f0['forEach'](function(_0x4369db){var _0x40eee8=_0x4369db[_0xa64c('0x21')]===_0xa64c('0x23')?'user':_0x4369db[_0xa64c('0x21')];_0x20ea05[_0x40eee8]-=_0x4369db['count'];if(_0x20ea05[_0x40eee8]<0x0)_0x20ea05[_0x40eee8]=0x0;});_0x4df4d1(_0x20ea05);return;});})[_0xa64c('0xe')](function(_0x92b517){_0x9895b1(_0x92b517);});});}function checkUserLimits(_0x2870d4){return new BPromise(function(_0x3c4c2c,_0x33a6be){getLimits()[_0xa64c('0xd')](function(_0x12e9f4){var _0x4b5441=_[_0xa64c('0x26')](_[_0xa64c('0x27')](_0x2870d4,_0xa64c('0x21')),['admin','user','telephone']);var _0x2e9ae5=(_0x4b5441[_0xa64c('0x23')]||0x0)+(_0x4b5441[_0xa64c('0x28')]||0x0);var _0x3a83ca=_0x4b5441['telephone']||0x0;if(_0x2e9ae5>_0x12e9f4[_0xa64c('0x28')])return _0x33a6be('License\x20limit\x20reached\x20for\x20users');if(_0x3a83ca>_0x12e9f4[_0xa64c('0x29')])return _0x33a6be(_0xa64c('0x2a'));return _0x3c4c2c();})[_0xa64c('0xe')](function(_0x3d019c){_0x33a6be(_0x3d019c);});});}module[_0xa64c('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 28ac300..a2186bc 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 _0x8aad=['http://localhost:9000','app-id','exports'];(function(_0x2b778d,_0x5dd9e4){var _0x46a581=function(_0x3eb2ee){while(--_0x3eb2ee){_0x2b778d['push'](_0x2b778d['shift']());}};_0x46a581(++_0x5dd9e4);}(_0x8aad,0x146));var _0xd8aa=function(_0x22f769,_0x1a6720){_0x22f769=_0x22f769-0x0;var _0x131e28=_0x8aad[_0x22f769];return _0x131e28;};'use strict';module[_0xd8aa('0x0')]={'DOMAIN':_0xd8aa('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xd8aa('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x36ee=['myappanuglar-secret','secret'];(function(_0x118b34,_0x516bc8){var _0x5ecd77=function(_0x29c393){while(--_0x29c393){_0x118b34['push'](_0x118b34['shift']());}};_0x5ecd77(++_0x516bc8);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xe36e('0x0'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe36e('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index abddec1..01b4877 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a55=['../utils/loggers','fileLogger','exports'];(function(_0x292649,_0x571e2f){var _0x4d74fd=function(_0x5e741c){while(--_0x5e741c){_0x292649['push'](_0x292649['shift']());}};_0x4d74fd(++_0x571e2f);}(_0x7a55,0x159));var _0x57a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a55[_0x20a584];return _0x4b41a8;};'use strict';var fileLogger=require(_0x57a5('0x0'))[_0x57a5('0x1')];module[_0x57a5('0x2')]=fileLogger; \ No newline at end of file +var _0x2544=['exports','../utils/loggers'];(function(_0x35468d,_0x2a7240){var _0x30da52=function(_0xd9d2f){while(--_0xd9d2f){_0x35468d['push'](_0x35468d['shift']());}};_0x30da52(++_0x2a7240);}(_0x2544,0x97));var _0x4254=function(_0x18f7d8,_0xecd7cd){_0x18f7d8=_0x18f7d8-0x0;var _0x1e7cb5=_0x2544[_0x18f7d8];return _0x1e7cb5;};'use strict';var fileLogger=require(_0x4254('0x0'))['fileLogger'];module[_0x4254('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 197df86..213a8b9 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 _0xa425=['join','../../services/ami/index.js','agi','email','routing','../../services/routing/index.js','xdr','path','../../services/express/index.js','ami'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0xa425,0x133));var _0x5a42=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xa425[_0x28669c];return _0x4a3af6;};'use strict';var path=require(_0x5a42('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x5a42('0x1'))},{'name':_0x5a42('0x2'),'script':path[_0x5a42('0x3')](__dirname,_0x5a42('0x4'))},{'name':_0x5a42('0x5'),'script':path[_0x5a42('0x3')](__dirname,'../../services/agi/index.js')},{'name':_0x5a42('0x6'),'script':path[_0x5a42('0x3')](__dirname,'../../services/email/index.js')},{'name':_0x5a42('0x7'),'script':path[_0x5a42('0x3')](__dirname,_0x5a42('0x8'))},{'name':_0x5a42('0x9'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0x9bb1=['join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bb1,0x66));var _0x19bb=function(_0x445f00,_0x41cdfc){_0x445f00=_0x445f00-0x0;var _0x113e84=_0x9bb1[_0x445f00];return _0x113e84;};'use strict';var path=require(_0x19bb('0x0'));var os=require('os');var config={'apps':[{'name':_0x19bb('0x1'),'script':path[_0x19bb('0x2')](__dirname,_0x19bb('0x3'))},{'name':_0x19bb('0x4'),'script':path[_0x19bb('0x2')](__dirname,_0x19bb('0x5'))},{'name':_0x19bb('0x6'),'script':path[_0x19bb('0x2')](__dirname,_0x19bb('0x7'))},{'name':'email','script':path[_0x19bb('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x19bb('0x8'),'script':path[_0x19bb('0x2')](__dirname,_0x19bb('0x9'))},{'name':_0x19bb('0xa'),'script':path[_0x19bb('0x2')](__dirname,_0x19bb('0xb'))}]};module[_0x19bb('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2487f24..7c16b67 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 _0xbba2=['then','disconnect','stop','list','describe','delete','dump','saved','pm2','start'];(function(_0x56b18b,_0x4eedd5){var _0x46720f=function(_0x4e72e4){while(--_0x4e72e4){_0x56b18b['push'](_0x56b18b['shift']());}};_0x46720f(++_0x4eedd5);}(_0xbba2,0xe4));var _0x2bba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbba2[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x2bba('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x295ca2,_0x9d01ed){return pm2['connect'](function(_0x3fada8){if(_0x3fada8){return _0x9d01ed(_0x3fada8);}return _0x295ca2('connected');});});};exports[_0x2bba('0x1')]=function(_0x3f2242){return connect()[_0x2bba('0x2')](function(){return new BPromise(function(_0xdb7db5,_0x24b294){return pm2[_0x2bba('0x1')](_0x3f2242,function(_0x5a2ae4,_0x115f8a){if(_0x5a2ae4){return _0x24b294(_0x5a2ae4);}pm2[_0x2bba('0x3')]();return _0xdb7db5(_0x115f8a);});});});};exports['stop']=function(_0x5bbefa){return connect()[_0x2bba('0x2')](function(){return new BPromise(function(_0x286b2c,_0x4d785f){return pm2[_0x2bba('0x4')](_0x5bbefa,function(_0x52338d,_0x993a7a){if(_0x52338d){return _0x4d785f(_0x52338d);}pm2[_0x2bba('0x3')]();return _0x286b2c(_0x993a7a);});});});};exports['restart']=function(_0x354229){return connect()[_0x2bba('0x2')](function(){return new BPromise(function(_0xcbd952,_0x5cc1d3){return pm2['restart'](_0x354229,function(_0x4e10ad,_0x16e50d){if(_0x4e10ad){return _0x5cc1d3(_0x4e10ad);}pm2[_0x2bba('0x3')]();return _0xcbd952(_0x16e50d);});});});};exports[_0x2bba('0x5')]=function(){return connect()[_0x2bba('0x2')](function(){return new BPromise(function(_0x1f6ce8,_0x3fe23d){return pm2[_0x2bba('0x5')](function(_0x29d7e3,_0x4702cd){if(_0x29d7e3){return _0x3fe23d(_0x29d7e3);}pm2[_0x2bba('0x3')]();return _0x1f6ce8(_0x4702cd);});});});};exports[_0x2bba('0x6')]=function(_0x371a4c){return connect()['then'](function(){return new BPromise(function(_0x3d3f02,_0x27f3ba){return pm2[_0x2bba('0x6')](_0x371a4c,function(_0xb2d8b,_0x432c85){if(_0xb2d8b){return _0x27f3ba(_0xb2d8b);}pm2[_0x2bba('0x3')]();return _0x3d3f02(_0x432c85);});});});};exports[_0x2bba('0x7')]=function(_0x423a71){return connect()[_0x2bba('0x2')](function(){return new BPromise(function(_0x2b42fe,_0x1f91ab){return pm2[_0x2bba('0x7')](_0x423a71,function(_0x346822,_0x10054f){if(_0x346822){return _0x1f91ab(_0x346822);}pm2['disconnect']();return _0x2b42fe(_0x10054f);});});});};exports[_0x2bba('0x8')]=function(){return connect()[_0x2bba('0x2')](function(){return new BPromise(function(_0x593667,_0x1f0012){return pm2[_0x2bba('0x8')](function(_0x37bc4f){if(_0x37bc4f){return _0x1f0012(_0x37bc4f);}return _0x593667(_0x2bba('0x9'));});});});}; \ No newline at end of file +var _0xcc4f=['restart','disconnect','list','describe','delete','dump','pm2','bluebird','connect','start','stop','then'];(function(_0x4f2cc8,_0x1dccf3){var _0x48b130=function(_0x306658){while(--_0x306658){_0x4f2cc8['push'](_0x4f2cc8['shift']());}};_0x48b130(++_0x1dccf3);}(_0xcc4f,0x1aa));var _0xfcc4=function(_0x21cd6d,_0x5d0a2d){_0x21cd6d=_0x21cd6d-0x0;var _0x31217c=_0xcc4f[_0x21cd6d];return _0x31217c;};'use strict';var pm2=require(_0xfcc4('0x0'));var BPromise=require(_0xfcc4('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x1061f5,_0x306c1d){return pm2[_0xfcc4('0x2')](function(_0x1affdb){if(_0x1affdb){return _0x306c1d(_0x1affdb);}return _0x1061f5('connected');});});};exports['start']=function(_0x4eb993){return connect()['then'](function(){return new BPromise(function(_0x5c515b,_0x29f9ee){return pm2[_0xfcc4('0x3')](_0x4eb993,function(_0x5c9f03,_0x18e740){if(_0x5c9f03){return _0x29f9ee(_0x5c9f03);}pm2['disconnect']();return _0x5c515b(_0x18e740);});});});};exports[_0xfcc4('0x4')]=function(_0x4c39bf){return connect()[_0xfcc4('0x5')](function(){return new BPromise(function(_0x3474c5,_0x16b4ec){return pm2[_0xfcc4('0x4')](_0x4c39bf,function(_0x4193dc,_0x201f40){if(_0x4193dc){return _0x16b4ec(_0x4193dc);}pm2['disconnect']();return _0x3474c5(_0x201f40);});});});};exports[_0xfcc4('0x6')]=function(_0x3d5d20){return connect()[_0xfcc4('0x5')](function(){return new BPromise(function(_0x51d57b,_0x34eee8){return pm2[_0xfcc4('0x6')](_0x3d5d20,function(_0x2daef0,_0x35ace0){if(_0x2daef0){return _0x34eee8(_0x2daef0);}pm2[_0xfcc4('0x7')]();return _0x51d57b(_0x35ace0);});});});};exports[_0xfcc4('0x8')]=function(){return connect()[_0xfcc4('0x5')](function(){return new BPromise(function(_0x50cd07,_0x1fa3eb){return pm2[_0xfcc4('0x8')](function(_0x283901,_0x5331be){if(_0x283901){return _0x1fa3eb(_0x283901);}pm2[_0xfcc4('0x7')]();return _0x50cd07(_0x5331be);});});});};exports[_0xfcc4('0x9')]=function(_0x445cd9){return connect()[_0xfcc4('0x5')](function(){return new BPromise(function(_0x5efc51,_0x2fa7ba){return pm2['describe'](_0x445cd9,function(_0x41a357,_0x2e9a02){if(_0x41a357){return _0x2fa7ba(_0x41a357);}pm2['disconnect']();return _0x5efc51(_0x2e9a02);});});});};exports[_0xfcc4('0xa')]=function(_0x28bff3){return connect()[_0xfcc4('0x5')](function(){return new BPromise(function(_0x2ad2cb,_0x122510){return pm2[_0xfcc4('0xa')](_0x28bff3,function(_0x3c0c26,_0x2d24d8){if(_0x3c0c26){return _0x122510(_0x3c0c26);}pm2[_0xfcc4('0x7')]();return _0x2ad2cb(_0x2d24d8);});});});};exports[_0xfcc4('0xb')]=function(){return connect()[_0xfcc4('0x5')](function(){return new BPromise(function(_0x4df61f,_0x196636){return pm2[_0xfcc4('0xb')](function(_0x3a74b0){if(_0x3a74b0){return _0x196636(_0x3a74b0);}return _0x4df61f('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7ab5ee3..66d2f34 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 _0x2315=['emit','catch','error','inspect','start','ioredis','util','../../mysqldb','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','length','info','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2315,0x1d0));var _0x5231=function(_0x5ae639,_0x239056){_0x5ae639=_0x5ae639-0x0;var _0x2d0693=_0x2315[_0x5ae639];return _0x2d0693;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x5231('0x0'));var util=require(_0x5231('0x1'));var config=require('../../config/environment');var db=require(_0x5231('0x2'))['db'];var logger=require('../logger')('schedule');config[_0x5231('0x3')]=_[_0x5231('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5231('0x5'))(new Redis(config[_0x5231('0x3')]));function closeInteractions(){var _0x36d2d6=0x0;var _0x58478f=[];return db[_0x5231('0x6')][_0x5231('0x7')]({'raw':!![],'attributes':['id',_0x5231('0x8')],'where':{'id':0x1}})[_0x5231('0x9')](function(_0x52cfaa){_0x36d2d6=_0x52cfaa['chatTimeout'];if(_0x36d2d6){return db[_0x5231('0xa')][_0x5231('0xb')]({'raw':!![],'attributes':['id',_0x5231('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x52cfaa[_0x5231('0x8')],_0x5231('0xd'))}}});}else{return[];}})[_0x5231('0x9')](function(_0x115ebb){if(_0x115ebb&&_0x115ebb[_0x5231('0xe')]){_0x58478f=_['map'](_0x115ebb||[],'id');logger[_0x5231('0xf')]('[CHAT]\x20Interactions\x20to\x20close:',_0x58478f[_0x5231('0x10')]());return db[_0x5231('0xa')][_0x5231('0x11')]({'closeReason':_0x5231('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x5231('0x13')](_0x5231('0x14'))},{'where':{'id':_0x58478f}});}})[_0x5231('0x9')](function(){if(_0x58478f&&_0x58478f[_0x5231('0xe')]){logger[_0x5231('0xf')](_0x5231('0x15'),_0x58478f[_0x5231('0x10')]());for(var _0x291cf7=0x0;_0x291cf7<_0x58478f[_0x5231('0xe')];_0x291cf7++){io[_0x5231('0x16')]('chatInteraction:update',{'id':_0x58478f[_0x291cf7],'closed':!![]});}}})[_0x5231('0x17')](function(_0x1da91c){logger[_0x5231('0x18')]('[CHAT]\x20Error\x20closing\x20interactions',_0x1da91c?util[_0x5231('0x19')](_0x1da91c,{'showHidden':![],'depth':null}):'');});}exports[_0x5231('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0da1=['inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','subtract','minutes','then','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update'];(function(_0x9d9343,_0x494c83){var _0x2abcd2=function(_0x101a63){while(--_0x101a63){_0x9d9343['push'](_0x9d9343['shift']());}};_0x2abcd2(++_0x494c83);}(_0x0da1,0x102));var _0x10da=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x0da1[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x10da('0x0'));var moment=require(_0x10da('0x1'));var Redis=require(_0x10da('0x2'));var util=require(_0x10da('0x3'));var config=require(_0x10da('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x10da('0x5'))(_0x10da('0x6'));config['redis']=_[_0x10da('0x7')](config[_0x10da('0x8')],{'host':_0x10da('0x9'),'port':0x18eb});var io=require(_0x10da('0xa'))(new Redis(config[_0x10da('0x8')]));function closeInteractions(){var _0x189d0e=0x0;var _0x46170f=[];return db[_0x10da('0xb')][_0x10da('0xc')]({'raw':!![],'attributes':['id',_0x10da('0xd')],'where':{'id':0x1}})['then'](function(_0x43d1a2){_0x189d0e=_0x43d1a2['chatTimeout'];if(_0x189d0e){return db[_0x10da('0xe')][_0x10da('0xf')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x10da('0x10')](_0x43d1a2[_0x10da('0xd')],_0x10da('0x11'))}}});}else{return[];}})[_0x10da('0x12')](function(_0x1624aa){if(_0x1624aa&&_0x1624aa[_0x10da('0x13')]){_0x46170f=_['map'](_0x1624aa||[],'id');logger[_0x10da('0x14')](_0x10da('0x15'),_0x46170f[_0x10da('0x16')]());return db[_0x10da('0xe')][_0x10da('0x17')]({'closeReason':'system','disposition':_0x10da('0x18'),'closed':!![],'closedAt':moment()[_0x10da('0x19')](_0x10da('0x1a'))},{'where':{'id':_0x46170f}});}})[_0x10da('0x12')](function(){if(_0x46170f&&_0x46170f[_0x10da('0x13')]){logger['info'](_0x10da('0x1b'),_0x46170f[_0x10da('0x16')]());for(var _0x153588=0x0;_0x153588<_0x46170f[_0x10da('0x13')];_0x153588++){io[_0x10da('0x1c')](_0x10da('0x1d'),{'id':_0x46170f[_0x153588],'closed':!![]});}}})['catch'](function(_0x3859a2){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x3859a2?util[_0x10da('0x1e')](_0x3859a2,{'showHidden':![],'depth':null}):'');});}exports[_0x10da('0x1f')]=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 6c50c12..78018fe 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 _0x7c4b=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x2f1f41,_0x1937cb){var _0x269870=function(_0x351844){while(--_0x351844){_0x2f1f41['push'](_0x2f1f41['shift']());}};_0x269870(++_0x1937cb);}(_0x7c4b,0x8a));var _0xb7c4=function(_0x541a29,_0x2577c9){_0x541a29=_0x541a29-0x0;var _0x31263c=_0x7c4b[_0x541a29];return _0x31263c;};'use strict';function start(){var _0x414792=require(_0xb7c4('0x0'));return _0x414792['startAllRefreshIntervals']();}module[_0xb7c4('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xdabc=['startAllRefreshIntervals'];(function(_0x40d5ed,_0x2deb3b){var _0x3eaf4f=function(_0x490856){while(--_0x490856){_0x40d5ed['push'](_0x40d5ed['shift']());}};_0x3eaf4f(++_0x2deb3b);}(_0xdabc,0x158));var _0xcdab=function(_0x48baa3,_0x3cebbf){_0x48baa3=_0x48baa3-0x0;var _0x394bba=_0xdabc[_0x48baa3];return _0x394bba;};'use strict';function start(){var _0x19f299=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x19f299[_0xcdab('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 6f869f7..d1857bf 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 _0x450f=['bcc','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','extname','zip','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','run\x20job','cron','active','startAt','endAt','add','start','stop\x20cron','isBetween','update','update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','name','email','Smtp'];(function(_0x1d046a,_0x30db41){var _0x2c0b0c=function(_0x30a3c5){while(--_0x30a3c5){_0x1d046a['push'](_0x1d046a['shift']());}};_0x2c0b0c(++_0x30db41);}(_0x450f,0xe9));var _0xf450=function(_0x145eff,_0x269003){_0x145eff=_0x145eff-0x0;var _0x1a7a9e=_0x450f[_0x145eff];return _0x1a7a9e;};'use strict';var fs=require('fs');var util=require(_0xf450('0x0'));var path=require('path');var _=require(_0xf450('0x1'));var moment=require(_0xf450('0x2'));var CronJobManager=require(_0xf450('0x3'));var jayson=require(_0xf450('0x4'));var BPromise=require(_0xf450('0x5'));var logger=require('../logger')(_0xf450('0x6'));var db=require(_0xf450('0x7'))['db'];var analyticCustomReportController=require(_0xf450('0x8'));var analyticDefaultReportController=require(_0xf450('0x9'));var client=jayson['client'][_0xf450('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xad03b,_0x61b23){return function(){logger[_0xf450('0xb')](_0xf450('0xc'),_0xad03b['email']);var _0x1c98ec=!![];var _0xeb8a80=_0xad03b[_0xf450('0xd')][_0xf450('0xe')]();var _0x2129ad={'account':_0xeb8a80,'message':{'from':util[_0xf450('0xf')]('\x22%s\x22\x20<%s>',_0xad03b[_0xf450('0xd')][_0xf450('0x10')],_0xad03b[_0xf450('0xd')][_0xf450('0x11')]||_0xad03b[_0xf450('0xd')][_0xf450('0x12')]['user']),'to':_0xad03b['email'],'cc':_0xad03b['cc'],'bcc':_0xad03b[_0xf450('0x13')],'subject':util[_0xf450('0xf')](_0xf450('0x14'),_0x61b23[_0xf450('0x10')],_0xad03b['subtractNumber'],_0xad03b['subtractUnit'])}};var _0x18048b=path[_0xf450('0x15')](__dirname,_0xf450('0x16'));var _0x18d736=_0x61b23[_0xf450('0x17')];var _0x24bf15=util[_0xf450('0xf')]('%s.%s',path['basename'](_0x61b23[_0xf450('0x17')],path[_0xf450('0x18')](_0x61b23[_0xf450('0x17')])),_0xf450('0x19'));var _0x28357c=path[_0xf450('0x15')](_0x18048b,_0x18d736);var _0x1b662c=path[_0xf450('0x15')](_0x18048b,_0x24bf15);if(fs[_0xf450('0x1a')](_0x28357c)){_0x61b23[_0xf450('0x1b')]='Sent';_0x2129ad[_0xf450('0x1c')][_0xf450('0x1d')]=[{'filename':_0x18d736,'path':_0x28357c}];_0x2129ad[_0xf450('0x1c')][_0xf450('0x1e')]=util['format'](_0xf450('0x1f'),JSON[_0xf450('0x20')](_0x61b23,null,0x2));}else if(fs[_0xf450('0x1a')](_0x1b662c)){_0x61b23[_0xf450('0x1b')]=_0xf450('0x21');_0x2129ad[_0xf450('0x1c')][_0xf450('0x1d')]=[{'filename':_0x24bf15,'path':_0x1b662c}];}else{_0x2129ad[_0xf450('0x1c')][_0xf450('0x1e')]=_0xf450('0x22');if(!_0xad03b[_0xf450('0x23')]){_0x1c98ec=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1c98ec){return client[_0xf450('0x24')](_0xf450('0x25'),_0x2129ad)['then'](function(_0x15e5e8){if(_0x15e5e8['error']){return logger[_0xf450('0x26')]('error\x20mail',JSON[_0xf450('0x20')](_0x15e5e8));}return logger[_0xf450('0xb')]('email\x20sent');})['catch'](function(_0x3fc349){return logger[_0xf450('0x26')](_0xf450('0x27'),JSON[_0xf450('0x20')](_0x3fc349));});}};}function handleError(){return function(_0x127f9a){return logger['error'](JSON['stringify'](_0x127f9a));};}function handleResult(_0x56abcb){return function(_0x2f9e42){logger[_0xf450('0xb')](_0xf450('0x28'),JSON[_0xf450('0x20')](_0x2f9e42));if(_0x56abcb[_0xf450('0xd')]&&_0x56abcb['MailAccount'][_0xf450('0x12')]&&!_[_0xf450('0x29')](_0x56abcb['email'])){setTimeout(handleSendEmail(_0x56abcb,_0x2f9e42),0x3c*0x3e8);}};}function handleJob(_0x4a9325){return function(){try{if(_[_0xf450('0x29')](_0x4a9325['subtractNumber'])){return logger[_0xf450('0xb')](_0xf450('0x2a'));}if(_['isNil'](_0x4a9325[_0xf450('0x2b')])){return logger['info'](_0xf450('0x2c'));}var _0x4d5c8c={'startDate':moment()[_0xf450('0x2d')](_0x4a9325['subtractNumber'],_0x4a9325[_0xf450('0x2b')])[_0xf450('0xf')](_0xf450('0x2e')),'endDate':moment()[_0xf450('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xf450('0x2f'),'output':_0x4a9325[_0xf450('0x30')],'name':_0x4a9325['name']};if(!_[_0xf450('0x29')](_0x4a9325[_0xf450('0x31')])){logger[_0xf450('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x4a9325[_0xf450('0x31')]);return analyticDefaultReportController[_0xf450('0x32')]({'id':_0x4a9325[_0xf450('0x31')]},_0x4d5c8c)[_0xf450('0x33')](handleResult(_0x4a9325))[_0xf450('0x34')](handleError());}if(!_[_0xf450('0x29')](_0x4a9325[_0xf450('0x35')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x4a9325['CustomReportId']);return analyticCustomReportController[_0xf450('0x32')]({'id':_0x4a9325[_0xf450('0x35')]},_0x4d5c8c)['then'](handleResult(_0x4a9325))[_0xf450('0x34')](handleError());}}catch(_0x5b3bda){logger[_0xf450('0x26')](JSON[_0xf450('0x20')](_0x5b3bda));}return logger[_0xf450('0xb')](_0xf450('0x36'));};}function getJobs(_0x244296){var _0x1cb51a={};if(_0x244296){_0x1cb51a['id']=_0x244296;}return db[_0xf450('0x37')][_0xf450('0x38')]({'where':_0x1cb51a,'include':[{'model':db[_0xf450('0xd')],'attributes':['id',_0xf450('0x10'),_0xf450('0x11')],'include':[{'model':db[_0xf450('0x39')],'as':_0xf450('0x12'),'include':[{'model':db[_0xf450('0x3a')],'as':_0xf450('0x3a')}]}]}]})[_0xf450('0x33')](function(_0x5a39fe){var _0x39090a=_[_0xf450('0x3b')](manager[_0xf450('0x3c')]);var _0x83e39d=_['map'](_0x5a39fe,function(_0x389ac7){return _0x389ac7['id'][_0xf450('0x3d')]();});var _0x1488d7=_[_0xf450('0x3e')](_0x5a39fe,function(_0x3cc69f){return _0x3cc69f['id']['toString']();});var _0x499486=_0x244296?_0x83e39d:_[_0xf450('0x3f')](_0x83e39d,_0x39090a);var _0x140364=_[_0xf450('0x40')](_0x83e39d,_0x39090a);var _0x35d770=_['difference'](_0x39090a,_0x83e39d);var _0x56629c;var _0x5aef34;for(_0x56629c=0x0;_0x56629c<_0x35d770[_0xf450('0x41')]&&!_0x244296;_0x56629c+=0x1){_0x5aef34=_0x35d770[_0x56629c]['toString']();if(manager[_0xf450('0x42')](_0x5aef34)){manager[_0xf450('0x43')](_0x5aef34);manager[_0xf450('0x44')](_0x5aef34);logger[_0xf450('0xb')]('delete\x20cron',_0x5aef34);}}logger[_0xf450('0xb')](_0xf450('0x45'),JSON[_0xf450('0x20')](_0x499486));for(_0x56629c=0x0;_0x56629c<_0x499486['length'];_0x56629c+=0x1){_0x5aef34=_0x499486[_0x56629c][_0xf450('0x3d')]();logger['info'](_0xf450('0x46'),_0x5aef34);if(_0x244296){logger[_0xf450('0xb')](_0xf450('0x47'),_0x244296);logger[_0xf450('0xb')](JSON['stringify'](_0x1488d7[_0x5aef34]));BPromise['resolve']()[_0xf450('0x33')](handleJob(_0x1488d7[_0x5aef34]));logger['info'](_0xf450('0x48'),_0x1488d7[_0x5aef34][_0xf450('0x10')],_0x1488d7[_0x5aef34][_0xf450('0x49')]);}else if(_0x1488d7[_0x5aef34][_0xf450('0x49')]&&_0x1488d7[_0x5aef34][_0xf450('0x4a')]&&moment()['isBetween'](_0x1488d7[_0x5aef34][_0xf450('0x4b')],_0x1488d7[_0x5aef34][_0xf450('0x4c')])){manager[_0xf450('0x4d')](_0x5aef34,_0x1488d7[_0x5aef34][_0xf450('0x49')],handleJob(_0x1488d7[_0x5aef34]));manager[_0xf450('0x4e')](_0x5aef34);logger[_0xf450('0xb')]('add\x20cron',_0x1488d7[_0x5aef34][_0xf450('0x10')],_0x1488d7[_0x5aef34][_0xf450('0x49')]);}else if(manager[_0xf450('0x42')](_0x5aef34)){manager[_0xf450('0x43')](_0x5aef34);manager['deleteJob'](_0x5aef34);logger[_0xf450('0xb')](_0xf450('0x4f'),_0x1488d7[_0x5aef34][_0xf450('0x10')],_0x1488d7[_0x5aef34][_0xf450('0x49')]);}}for(_0x56629c=0x0,_0x5aef34;_0x56629c<_0x140364[_0xf450('0x41')]&&!_0x244296;_0x56629c+=0x1){_0x5aef34=_0x140364[_0x56629c][_0xf450('0x3d')]();if(manager['exists'](_0x5aef34)){if(_0x1488d7[_0x5aef34][_0xf450('0x49')]&&_0x1488d7[_0x5aef34]['active']&&moment()[_0xf450('0x50')](_0x1488d7[_0x5aef34][_0xf450('0x4b')],_0x1488d7[_0x5aef34][_0xf450('0x4c')])){manager[_0xf450('0x51')](_0x5aef34,_0x1488d7[_0x5aef34][_0xf450('0x49')],handleJob(_0x1488d7[_0x5aef34]));logger['info'](_0xf450('0x52'),_0x1488d7[_0x5aef34][_0xf450('0x10')],_0x1488d7[_0x5aef34][_0xf450('0x49')]);}else{manager[_0xf450('0x43')](_0x5aef34);manager['deleteJob'](_0x5aef34);logger[_0xf450('0xb')]('stop\x20cron',_0x1488d7[_0x5aef34][_0xf450('0x10')],_0x1488d7[_0x5aef34][_0xf450('0x49')]);}}}})[_0xf450('0x34')](function(_0xb486e7){logger[_0xf450('0x26')](JSON['stringify'](_0xb486e7));});}exports[_0xf450('0x53')]=function(_0x210b2e){return getJobs(_0x210b2e);};exports[_0xf450('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x60e1=['join','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','MailServerOut','CloudProvider','jobs','map','toString','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','format','MailAccount','name','email','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','%s.%s','basename','savename','extname','zip'];(function(_0x56bd1b,_0x5d0362){var _0x1b6eb7=function(_0x533614){while(--_0x533614){_0x56bd1b['push'](_0x56bd1b['shift']());}};_0x1b6eb7(++_0x5d0362);}(_0x60e1,0x92));var _0x160e=function(_0x125ca5,_0x2ee8d1){_0x125ca5=_0x125ca5-0x0;var _0x768824=_0x60e1[_0x125ca5];return _0x768824;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x160e('0x0'));var _=require(_0x160e('0x1'));var moment=require(_0x160e('0x2'));var CronJobManager=require(_0x160e('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x160e('0x4'));var logger=require(_0x160e('0x5'))(_0x160e('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x160e('0x7'));var analyticDefaultReportController=require(_0x160e('0x8'));var client=jayson[_0x160e('0x9')][_0x160e('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x38f850,_0x52090b){return function(){logger['info'](_0x160e('0xb'),_0x38f850['email']);var _0xbeedc0=!![];var _0x565208=_0x38f850['MailAccount'][_0x160e('0xc')]();var _0x5a7def={'account':_0x565208,'message':{'from':util[_0x160e('0xd')]('\x22%s\x22\x20<%s>',_0x38f850[_0x160e('0xe')][_0x160e('0xf')],_0x38f850[_0x160e('0xe')][_0x160e('0x10')]||_0x38f850[_0x160e('0xe')][_0x160e('0x11')][_0x160e('0x12')]),'to':_0x38f850[_0x160e('0x10')],'cc':_0x38f850['cc'],'bcc':_0x38f850['bcc'],'subject':util[_0x160e('0xd')](_0x160e('0x13'),_0x52090b[_0x160e('0xf')],_0x38f850['subtractNumber'],_0x38f850[_0x160e('0x14')])}};var _0x11447a=path['join'](__dirname,'../../files/reports');var _0x406a43=_0x52090b['savename'];var _0x5d77b6=util[_0x160e('0xd')](_0x160e('0x15'),path[_0x160e('0x16')](_0x52090b[_0x160e('0x17')],path[_0x160e('0x18')](_0x52090b['savename'])),_0x160e('0x19'));var _0x4e64a8=path[_0x160e('0x1a')](_0x11447a,_0x406a43);var _0x1f2ce3=path[_0x160e('0x1a')](_0x11447a,_0x5d77b6);if(fs[_0x160e('0x1b')](_0x4e64a8)){_0x52090b[_0x160e('0x1c')]=_0x160e('0x1d');_0x5a7def['message'][_0x160e('0x1e')]=[{'filename':_0x406a43,'path':_0x4e64a8}];_0x5a7def[_0x160e('0x1f')][_0x160e('0x20')]=util[_0x160e('0xd')](_0x160e('0x21'),JSON[_0x160e('0x22')](_0x52090b,null,0x2));}else if(fs[_0x160e('0x1b')](_0x1f2ce3)){_0x52090b[_0x160e('0x1c')]=_0x160e('0x1d');_0x5a7def['message'][_0x160e('0x1e')]=[{'filename':_0x5d77b6,'path':_0x1f2ce3}];}else{_0x5a7def[_0x160e('0x1f')]['text']=_0x160e('0x23');if(!_0x38f850['sendIfEmpty']){_0xbeedc0=![];logger[_0x160e('0x24')](_0x160e('0x25'));}}if(_0xbeedc0){return client[_0x160e('0x26')](_0x160e('0x27'),_0x5a7def)[_0x160e('0x28')](function(_0x597cd1){if(_0x597cd1[_0x160e('0x29')]){return logger[_0x160e('0x29')](_0x160e('0x2a'),JSON['stringify'](_0x597cd1));}return logger[_0x160e('0x24')](_0x160e('0x2b'));})[_0x160e('0x2c')](function(_0x3cb8ee){return logger[_0x160e('0x29')](_0x160e('0x2a'),JSON[_0x160e('0x22')](_0x3cb8ee));});}};}function handleError(){return function(_0x39c8e1){return logger[_0x160e('0x29')](JSON[_0x160e('0x22')](_0x39c8e1));};}function handleResult(_0x122f6e){return function(_0x2326e2){logger['info']('data',JSON[_0x160e('0x22')](_0x2326e2));if(_0x122f6e[_0x160e('0xe')]&&_0x122f6e[_0x160e('0xe')]['Smtp']&&!_[_0x160e('0x2d')](_0x122f6e[_0x160e('0x10')])){setTimeout(handleSendEmail(_0x122f6e,_0x2326e2),0x3c*0x3e8);}};}function handleJob(_0x15d706){return function(){try{if(_[_0x160e('0x2d')](_0x15d706[_0x160e('0x2e')])){return logger[_0x160e('0x24')](_0x160e('0x2f'));}if(_['isNil'](_0x15d706[_0x160e('0x14')])){return logger[_0x160e('0x24')](_0x160e('0x30'));}var _0x2f02b9={'startDate':moment()[_0x160e('0x31')](_0x15d706[_0x160e('0x2e')],_0x15d706[_0x160e('0x14')])[_0x160e('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x160e('0xd')](_0x160e('0x32')),'type':_0x160e('0x33'),'output':_0x15d706[_0x160e('0x34')],'name':_0x15d706[_0x160e('0xf')]};if(!_['isNil'](_0x15d706[_0x160e('0x35')])){logger[_0x160e('0x24')](_0x160e('0x36'),_0x15d706['DefaultReportId']);return analyticDefaultReportController[_0x160e('0x37')]({'id':_0x15d706[_0x160e('0x35')]},_0x2f02b9)['then'](handleResult(_0x15d706))['catch'](handleError());}if(!_['isNil'](_0x15d706[_0x160e('0x38')])){logger['info'](_0x160e('0x39'),_0x15d706[_0x160e('0x38')]);return analyticCustomReportController[_0x160e('0x37')]({'id':_0x15d706[_0x160e('0x38')]},_0x2f02b9)[_0x160e('0x28')](handleResult(_0x15d706))[_0x160e('0x2c')](handleError());}}catch(_0x2a61e6){logger[_0x160e('0x29')](JSON['stringify'](_0x2a61e6));}return logger[_0x160e('0x24')]('no\x20report\x20id');};}function getJobs(_0x15038a){var _0x1bf9e6={};if(_0x15038a){_0x1bf9e6['id']=_0x15038a;}return db[_0x160e('0x3a')]['findAll']({'where':_0x1bf9e6,'include':[{'model':db[_0x160e('0xe')],'attributes':['id',_0x160e('0xf'),_0x160e('0x10')],'include':[{'model':db[_0x160e('0x3b')],'as':'Smtp','include':[{'model':db[_0x160e('0x3c')],'as':_0x160e('0x3c')}]}]}]})[_0x160e('0x28')](function(_0x3d74c6){var _0x343b8c=_['keys'](manager[_0x160e('0x3d')]);var _0x4b574f=_[_0x160e('0x3e')](_0x3d74c6,function(_0x13551f){return _0x13551f['id'][_0x160e('0x3f')]();});var _0x40f1e4=_['keyBy'](_0x3d74c6,function(_0x57717b){return _0x57717b['id'][_0x160e('0x3f')]();});var _0x32b2e0=_0x15038a?_0x4b574f:_[_0x160e('0x40')](_0x4b574f,_0x343b8c);var _0x61bef9=_['intersection'](_0x4b574f,_0x343b8c);var _0x27a8ed=_[_0x160e('0x40')](_0x343b8c,_0x4b574f);var _0x56c86c;var _0x988882;for(_0x56c86c=0x0;_0x56c86c<_0x27a8ed[_0x160e('0x41')]&&!_0x15038a;_0x56c86c+=0x1){_0x988882=_0x27a8ed[_0x56c86c][_0x160e('0x3f')]();if(manager[_0x160e('0x42')](_0x988882)){manager[_0x160e('0x43')](_0x988882);manager[_0x160e('0x44')](_0x988882);logger[_0x160e('0x24')](_0x160e('0x45'),_0x988882);}}logger[_0x160e('0x24')](_0x160e('0x46'),JSON[_0x160e('0x22')](_0x32b2e0));for(_0x56c86c=0x0;_0x56c86c<_0x32b2e0[_0x160e('0x41')];_0x56c86c+=0x1){_0x988882=_0x32b2e0[_0x56c86c][_0x160e('0x3f')]();logger[_0x160e('0x24')](_0x160e('0x47'),_0x988882);if(_0x15038a){logger[_0x160e('0x24')](_0x160e('0x48'),_0x15038a);logger[_0x160e('0x24')](JSON[_0x160e('0x22')](_0x40f1e4[_0x988882]));BPromise[_0x160e('0x49')]()[_0x160e('0x28')](handleJob(_0x40f1e4[_0x988882]));logger['info'](_0x160e('0x4a'),_0x40f1e4[_0x988882]['name'],_0x40f1e4[_0x988882][_0x160e('0x4b')]);}else if(_0x40f1e4[_0x988882][_0x160e('0x4b')]&&_0x40f1e4[_0x988882]['active']&&moment()[_0x160e('0x4c')](_0x40f1e4[_0x988882][_0x160e('0x4d')],_0x40f1e4[_0x988882][_0x160e('0x4e')])){manager[_0x160e('0x4f')](_0x988882,_0x40f1e4[_0x988882][_0x160e('0x4b')],handleJob(_0x40f1e4[_0x988882]));manager[_0x160e('0x50')](_0x988882);logger[_0x160e('0x24')](_0x160e('0x51'),_0x40f1e4[_0x988882][_0x160e('0xf')],_0x40f1e4[_0x988882][_0x160e('0x4b')]);}else if(manager['exists'](_0x988882)){manager[_0x160e('0x43')](_0x988882);manager[_0x160e('0x44')](_0x988882);logger[_0x160e('0x24')](_0x160e('0x52'),_0x40f1e4[_0x988882]['name'],_0x40f1e4[_0x988882][_0x160e('0x4b')]);}}for(_0x56c86c=0x0,_0x988882;_0x56c86c<_0x61bef9[_0x160e('0x41')]&&!_0x15038a;_0x56c86c+=0x1){_0x988882=_0x61bef9[_0x56c86c][_0x160e('0x3f')]();if(manager[_0x160e('0x42')](_0x988882)){if(_0x40f1e4[_0x988882][_0x160e('0x4b')]&&_0x40f1e4[_0x988882]['active']&&moment()[_0x160e('0x4c')](_0x40f1e4[_0x988882][_0x160e('0x4d')],_0x40f1e4[_0x988882]['endAt'])){manager[_0x160e('0x53')](_0x988882,_0x40f1e4[_0x988882][_0x160e('0x4b')],handleJob(_0x40f1e4[_0x988882]));logger[_0x160e('0x24')](_0x160e('0x54'),_0x40f1e4[_0x988882][_0x160e('0xf')],_0x40f1e4[_0x988882]['cron']);}else{manager[_0x160e('0x43')](_0x988882);manager[_0x160e('0x44')](_0x988882);logger[_0x160e('0x24')](_0x160e('0x52'),_0x40f1e4[_0x988882][_0x160e('0xf')],_0x40f1e4[_0x988882][_0x160e('0x4b')]);}}}})[_0x160e('0x2c')](function(_0x4bc821){logger[_0x160e('0x29')](JSON['stringify'](_0x4bc821));});}exports[_0x160e('0x55')]=function(_0x8e8157){return getJobs(_0x8e8157);};exports[_0x160e('0x50')]=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 67bf2f9..e9e4427 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 _0x5a1c=['Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','forEach','push','all','start','lodash','aws-sdk','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentiment','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20configured','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative'];(function(_0x3018a9,_0xbb3d81){var _0x357d4d=function(_0x592f7d){while(--_0x592f7d){_0x3018a9['push'](_0x3018a9['shift']());}};_0x357d4d(++_0xbb3d81);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x23b57,_0x5b7329){_0x23b57=_0x23b57-0x0;var _0x180823=_0x5a1c[_0x23b57];return _0x180823;};var _=require(_0xc5a1('0x0'));var AWS=require(_0xc5a1('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0xc5a1('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xc5a1('0x3'))(_0xc5a1('0x4'));function getTranscriptionJob(_0x71fc1,_0x5c3f2d,_0x57b342,_0x429a68){return new Promise(function(_0x3d356e,_0x1ed54a){var _0x5782b9=new AWS[(_0xc5a1('0x5'))]({'accessKeyId':_0x5c3f2d,'secretAccessKey':_0x71fc1,'region':_0x57b342});_0x5782b9[_0xc5a1('0x6')]({'TranscriptionJobName':_0x429a68},function(_0x1ce1df,_0x111921){if(_0x1ce1df){return _0x1ed54a(_0x1ce1df);}else{return _0x3d356e(_0x111921);}});});}function sentiment(_0x42b181,_0x54a2de,_0x28234b,_0x45c8b8,_0x2fb166){return new Promise(function(_0x364ef4,_0x363a3e){var _0x501d85=new AWS[(_0xc5a1('0x7'))]({'accessKeyId':_0x54a2de,'secretAccessKey':_0x42b181,'region':_0x28234b});_0x501d85[_0xc5a1('0x8')]({'Text':_0x45c8b8,'LanguageCode':_0x2fb166['substring'](0x0,0x2)},function(_0x5bac8b,_0xb6fe3b){if(_0x5bac8b){return _0x363a3e(_0x5bac8b);}else{return _0x364ef4(_0xb6fe3b);}});});}function checkTranscribeJob(_0x514744,_0x17d063,_0x5f2534){var _0x37b863;return new BPromise(function(_0x3fafdc,_0x4f4b59){logger[_0xc5a1('0x9')](util['format'](_0xc5a1('0xa'),_0x514744['id'],_0x514744['transcribeName']));return getTranscriptionJob(_0x5f2534[_0xc5a1('0xb')],_0x5f2534[_0xc5a1('0xc')],_0x17d063[_0xc5a1('0xd')],_0x514744[_0xc5a1('0xe')])[_0xc5a1('0xf')](function(_0x5af680){logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')](_0xc5a1('0x11'),_0x514744['id'],_0x514744[_0xc5a1('0xe')],_0x5af680[_0xc5a1('0x12')][_0xc5a1('0x13')]));if(!_0x514744[_0xc5a1('0x14')]){switch(_0x5af680['TranscriptionJob'][_0xc5a1('0x13')]){case _0xc5a1('0x15'):var _0x3b7e90={'transcribeStatus':_0x5af680[_0xc5a1('0x12')]['TranscriptionJobStatus'],'fileUri':_0x5af680[_0xc5a1('0x12')][_0xc5a1('0x16')][_0xc5a1('0x17')]};logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')](_0xc5a1('0x18'),_0x514744['id']));return rp({'uri':_0x5af680[_0xc5a1('0x12')][_0xc5a1('0x16')]['TranscriptFileUri'],'json':!![]})[_0xc5a1('0xf')](function(_0x578788){logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x514744['id']));if(_0x578788&&_0x578788[_0xc5a1('0x19')]&&_0x578788[_0xc5a1('0x19')]['transcripts']&&_0x578788['results'][_0xc5a1('0x1a')][_0xc5a1('0x1b')]){_0x3b7e90['fileText']='';for(var _0x9168e2=0x0;_0x9168e2<_0x578788['results'][_0xc5a1('0x1a')][_0xc5a1('0x1b')];_0x9168e2++){_0x3b7e90[_0xc5a1('0x14')]+=_0x578788[_0xc5a1('0x19')][_0xc5a1('0x1a')][_0x9168e2][_0xc5a1('0x1c')]+'';}}return _0x514744[_0xc5a1('0x1d')](_0x3b7e90);})[_0xc5a1('0xf')](function(){logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')](_0xc5a1('0x1e'),_0x514744['id']));if(!_0x514744['tempSentiment']){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x17d063[_0xc5a1('0x21')]||!_0x17d063['sentimentAccountId']||!_0x17d063[_0xc5a1('0x22')]||!_0x17d063['language']||!_0x17d063[_0xc5a1('0x23')]){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))](_0xc5a1('0x24'));}if(!_0x3b7e90[_0xc5a1('0x14')]){throw new Error(_0xc5a1('0x25'));}if(_0x17d063['sentimentAccountId']===_0x5f2534['id']){return _0x5f2534;}else{return db[_0xc5a1('0x26')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc5a1('0xf')](function(_0x2ec457){if(!_0x2ec457){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2ec457[_0xc5a1('0xb')]||!_0x2ec457['data2']){throw new db[(_0xc5a1('0x1f'))]['ValidationError'](_0xc5a1('0x27'));}_0x37b863=_0x2ec457;logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x514744['id']));return sentiment(_0x37b863[_0xc5a1('0xb')],_0x37b863[_0xc5a1('0xc')],_0x17d063[_0xc5a1('0x22')],_0x3b7e90['fileText'],_0x17d063[_0xc5a1('0x28')]);})['then'](function(_0x2d4d56){logger['info'](util[_0xc5a1('0x10')](_0xc5a1('0x29'),_0x514744['id']));return _0x514744[_0xc5a1('0x1d')]({'sentiment':_0x2d4d56[_0xc5a1('0x2a')],'sPositive':_0x2d4d56[_0xc5a1('0x2b')][_0xc5a1('0x2c')],'sNegative':_0x2d4d56[_0xc5a1('0x2b')][_0xc5a1('0x2d')],'sMixed':_0x2d4d56['SentimentScore']['Mixed'],'sNeutral':_0x2d4d56[_0xc5a1('0x2b')][_0xc5a1('0x2e')]});})[_0xc5a1('0xf')](function(){logger[_0xc5a1('0x9')](util['format'](_0xc5a1('0x1e'),_0x514744['id']));_0x3fafdc();});case _0xc5a1('0x2f'):return _0x514744[_0xc5a1('0x1d')]({'transcribeStatus':_0xc5a1('0x2f'),'failureReason':_0x5af680['TranscriptionJob']['FailureReason']})[_0xc5a1('0xf')](function(){logger['info'](util['format'](_0xc5a1('0x1e'),_0x514744['id']));_0x3fafdc();});default:logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')](_0xc5a1('0x30'),_0x514744['id']));break;}}else{return BPromise[_0xc5a1('0x31')]()[_0xc5a1('0xf')](function(){if(!_0x514744['tempSentiment']){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))](_0xc5a1('0x32'));}if(!_0x17d063[_0xc5a1('0x21')]||!_0x17d063['sentimentAccountId']||!_0x17d063['sentimentRegion']||!_0x17d063[_0xc5a1('0x28')]||!_0x17d063[_0xc5a1('0x23')]){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x514744['fileText']){throw new Error(_0xc5a1('0x25'));}if(_0x17d063['sentimentAccountId']===_0x5f2534['id']){return _0x5f2534;}else{return db[_0xc5a1('0x26')][_0xc5a1('0x33')]({'where':{'id':_settings[_0xc5a1('0x34')]}});}})['then'](function(_0x5cd707){if(!_0x5cd707){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))](_0xc5a1('0x35'));}if(!_0x5cd707[_0xc5a1('0xb')]||!_0x5cd707[_0xc5a1('0xc')]){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))](_0xc5a1('0x27'));}_0x37b863=_0x5cd707;logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')](_0xc5a1('0x36'),_0x514744['id']));return sentiment(_0x37b863[_0xc5a1('0xb')],_0x37b863['data2'],_0x17d063['sentimentRegion'],_0x514744[_0xc5a1('0x14')],_0x17d063[_0xc5a1('0x28')]);})['then'](function(_0xb0fa81){logger['info'](util['format'](_0xc5a1('0x29'),_0x514744['id']));return _0x514744[_0xc5a1('0x1d')]({'sentiment':_0xb0fa81[_0xc5a1('0x2a')],'sPositive':_0xb0fa81[_0xc5a1('0x2b')][_0xc5a1('0x2c')],'sNegative':_0xb0fa81['SentimentScore'][_0xc5a1('0x2d')],'sMixed':_0xb0fa81[_0xc5a1('0x2b')][_0xc5a1('0x37')],'sNeutral':_0xb0fa81[_0xc5a1('0x2b')][_0xc5a1('0x2e')],'transcribeStatus':_0xc5a1('0x15')});})[_0xc5a1('0xf')](function(){logger['info'](util[_0xc5a1('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x514744['id']));_0x3fafdc();});}})[_0xc5a1('0x38')](function(_0x207524){if(_0x207524){if(!_0x207524[_0xc5a1('0x39')]||_0x207524[_0xc5a1('0x39')]!==_0xc5a1('0x3a')){logger[_0xc5a1('0x3b')](util[_0xc5a1('0x10')](_0xc5a1('0x3c'),_0x514744['id']),util[_0xc5a1('0x3d')](_0x207524,{'showHidden':![],'depth':null}));}}_0x3fafdc();});});}function checkTranscribe(){var _0x12e97f;var _0xc98bde;var _0x57e111;return db['VoiceRecording'][_0xc5a1('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0xfe4a4f){if(!_0xfe4a4f||!_0xfe4a4f[_0xc5a1('0x1b')]){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))](_0xc5a1('0x3f'));}_0x12e97f=_0xfe4a4f;return db[_0xc5a1('0x40')][_0xc5a1('0x33')]({'where':{'id':0x1}});})[_0xc5a1('0xf')](function(_0x3e74af){if(!_0x3e74af){throw new db['Sequelize'][(_0xc5a1('0x20'))]('Settings\x20not\x20available');}_0xc98bde=_0x3e74af;if(!_0xc98bde[_0xc5a1('0x4')]||!_0xc98bde['transcribeAccountId']||!_0xc98bde['transcribeRegion']||!_0xc98bde[_0xc5a1('0x28')]||!_0xc98bde[_0xc5a1('0x23')]){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xc5a1('0x33')]({'where':{'id':_0xc98bde['transcribeAccountId']}});})[_0xc5a1('0xf')](function(_0x55f332){if(!_0x55f332){throw new db['Sequelize'][(_0xc5a1('0x20'))](_0xc5a1('0x35'));}if(!_0x55f332['data1']||!_0x55f332[_0xc5a1('0xc')]){throw new db[(_0xc5a1('0x1f'))]['ValidationError'](_0xc5a1('0x27'));}_0x57e111=_0x55f332;var _0x2e93e5=[];_0x12e97f[_0xc5a1('0x41')](function(_0x6ce549){_0x2e93e5[_0xc5a1('0x42')](checkTranscribeJob(_0x6ce549,_0xc98bde,_0x57e111));});return BPromise[_0xc5a1('0x43')](_0x2e93e5);})[_0xc5a1('0x38')](function(_0x10dc18){if(_0x10dc18){if(!_0x10dc18[_0xc5a1('0x39')]||_0x10dc18[_0xc5a1('0x39')]!==_0xc5a1('0x3a')){logger[_0xc5a1('0x3b')](util[_0xc5a1('0x3d')](_0x10dc18,{'showHidden':![],'depth':null}));}}});}exports[_0xc5a1('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe511=['Sentiment','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Neutral','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','transcribeAccountId','forEach','lodash','aws-sdk','util','../../mysqldb','../../config/logger','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured'];(function(_0x2b36c5,_0x1bc9c9){var _0x4108c3=function(_0x4422fa){while(--_0x4422fa){_0x2b36c5['push'](_0x2b36c5['shift']());}};_0x4108c3(++_0x1bc9c9);}(_0xe511,0x16f));var _0x1e51=function(_0xf237f7,_0xb11ac){_0xf237f7=_0xf237f7-0x0;var _0x2c183b=_0xe511[_0xf237f7];return _0x2c183b;};var _=require(_0x1e51('0x0'));var AWS=require(_0x1e51('0x1'));var rp=require('request-promise');var util=require(_0x1e51('0x2'));var BPromise=require('bluebird');var db=require(_0x1e51('0x3'))['db'];var logger=require(_0x1e51('0x4'))('transcribe');function getTranscriptionJob(_0x42e242,_0x2be2b7,_0x204da7,_0x16ec99){return new Promise(function(_0x480cca,_0x26b22c){var _0x21ed6b=new AWS['TranscribeService']({'accessKeyId':_0x2be2b7,'secretAccessKey':_0x42e242,'region':_0x204da7});_0x21ed6b['getTranscriptionJob']({'TranscriptionJobName':_0x16ec99},function(_0x394ad8,_0x133021){if(_0x394ad8){return _0x26b22c(_0x394ad8);}else{return _0x480cca(_0x133021);}});});}function sentiment(_0x4fa8a9,_0x49d359,_0x658941,_0x2712e0,_0x29da1f){return new Promise(function(_0x706e60,_0x4241a6){var _0x141e2e=new AWS['Comprehend']({'accessKeyId':_0x49d359,'secretAccessKey':_0x4fa8a9,'region':_0x658941});_0x141e2e[_0x1e51('0x5')]({'Text':_0x2712e0,'LanguageCode':_0x29da1f[_0x1e51('0x6')](0x0,0x2)},function(_0x3350bb,_0x2ea35d){if(_0x3350bb){return _0x4241a6(_0x3350bb);}else{return _0x706e60(_0x2ea35d);}});});}function checkTranscribeJob(_0x34ad70,_0x3c5330,_0x5544eb){var _0x408a77;return new BPromise(function(_0x102f01,_0x2acdf5){logger[_0x1e51('0x7')](util[_0x1e51('0x8')](_0x1e51('0x9'),_0x34ad70['id'],_0x34ad70[_0x1e51('0xa')]));return getTranscriptionJob(_0x5544eb[_0x1e51('0xb')],_0x5544eb[_0x1e51('0xc')],_0x3c5330[_0x1e51('0xd')],_0x34ad70['transcribeName'])[_0x1e51('0xe')](function(_0x24db4f){logger[_0x1e51('0x7')](util['format'](_0x1e51('0xf'),_0x34ad70['id'],_0x34ad70['transcribeName'],_0x24db4f['TranscriptionJob'][_0x1e51('0x10')]));if(!_0x34ad70[_0x1e51('0x11')]){switch(_0x24db4f[_0x1e51('0x12')][_0x1e51('0x10')]){case _0x1e51('0x13'):var _0x3e4234={'transcribeStatus':_0x24db4f['TranscriptionJob'][_0x1e51('0x10')],'fileUri':_0x24db4f['TranscriptionJob'][_0x1e51('0x14')][_0x1e51('0x15')]};logger[_0x1e51('0x7')](util[_0x1e51('0x8')]('[RECORDING:%d]\x20Get\x20transcript',_0x34ad70['id']));return rp({'uri':_0x24db4f['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})[_0x1e51('0xe')](function(_0x4f1f56){logger[_0x1e51('0x7')](util[_0x1e51('0x8')](_0x1e51('0x16'),_0x34ad70['id']));if(_0x4f1f56&&_0x4f1f56[_0x1e51('0x17')]&&_0x4f1f56[_0x1e51('0x17')][_0x1e51('0x18')]&&_0x4f1f56[_0x1e51('0x17')][_0x1e51('0x18')]['length']){_0x3e4234['fileText']='';for(var _0x43f5c5=0x0;_0x43f5c5<_0x4f1f56[_0x1e51('0x17')][_0x1e51('0x18')][_0x1e51('0x19')];_0x43f5c5++){_0x3e4234['fileText']+=_0x4f1f56['results']['transcripts'][_0x43f5c5][_0x1e51('0x1a')]+'';}}return _0x34ad70[_0x1e51('0x1b')](_0x3e4234);})[_0x1e51('0xe')](function(){logger['info'](util[_0x1e51('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x34ad70['id']));if(!_0x34ad70['tempSentiment']){throw new db[(_0x1e51('0x1c'))]['ValidationError'](_0x1e51('0x1d'));}if(!_0x3c5330[_0x1e51('0x1e')]||!_0x3c5330['sentimentAccountId']||!_0x3c5330[_0x1e51('0x1f')]||!_0x3c5330[_0x1e51('0x20')]||!_0x3c5330[_0x1e51('0x21')]){throw new db[(_0x1e51('0x1c'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3e4234['fileText']){throw new Error(_0x1e51('0x22'));}if(_0x3c5330[_0x1e51('0x23')]===_0x5544eb['id']){return _0x5544eb;}else{return db[_0x1e51('0x24')][_0x1e51('0x25')]({'where':{'id':_settings[_0x1e51('0x23')]}});}})[_0x1e51('0xe')](function(_0x378206){if(!_0x378206){throw new db[(_0x1e51('0x1c'))][(_0x1e51('0x26'))](_0x1e51('0x27'));}if(!_0x378206[_0x1e51('0xb')]||!_0x378206['data2']){throw new db[(_0x1e51('0x1c'))][(_0x1e51('0x26'))](_0x1e51('0x28'));}_0x408a77=_0x378206;logger[_0x1e51('0x7')](util[_0x1e51('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x34ad70['id']));return sentiment(_0x408a77[_0x1e51('0xb')],_0x408a77['data2'],_0x3c5330[_0x1e51('0x1f')],_0x3e4234[_0x1e51('0x11')],_0x3c5330[_0x1e51('0x20')]);})['then'](function(_0x3e3742){logger['info'](util[_0x1e51('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x34ad70['id']));return _0x34ad70['update']({'sentiment':_0x3e3742[_0x1e51('0x29')],'sPositive':_0x3e3742[_0x1e51('0x2a')][_0x1e51('0x2b')],'sNegative':_0x3e3742['SentimentScore'][_0x1e51('0x2c')],'sMixed':_0x3e3742['SentimentScore'][_0x1e51('0x2d')],'sNeutral':_0x3e3742[_0x1e51('0x2a')]['Neutral']});})[_0x1e51('0xe')](function(){logger[_0x1e51('0x7')](util[_0x1e51('0x8')](_0x1e51('0x2e'),_0x34ad70['id']));_0x102f01();});case _0x1e51('0x2f'):return _0x34ad70[_0x1e51('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x24db4f['TranscriptionJob'][_0x1e51('0x30')]})['then'](function(){logger[_0x1e51('0x7')](util[_0x1e51('0x8')](_0x1e51('0x2e'),_0x34ad70['id']));_0x102f01();});default:logger[_0x1e51('0x7')](util[_0x1e51('0x8')](_0x1e51('0x31'),_0x34ad70['id']));break;}}else{return BPromise[_0x1e51('0x32')]()[_0x1e51('0xe')](function(){if(!_0x34ad70[_0x1e51('0x33')]){throw new db[(_0x1e51('0x1c'))][(_0x1e51('0x26'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3c5330[_0x1e51('0x1e')]||!_0x3c5330['sentimentAccountId']||!_0x3c5330[_0x1e51('0x1f')]||!_0x3c5330[_0x1e51('0x20')]||!_0x3c5330[_0x1e51('0x21')]){throw new db[(_0x1e51('0x1c'))][(_0x1e51('0x26'))](_0x1e51('0x34'));}if(!_0x34ad70[_0x1e51('0x11')]){throw new Error(_0x1e51('0x22'));}if(_0x3c5330[_0x1e51('0x23')]===_0x5544eb['id']){return _0x5544eb;}else{return db[_0x1e51('0x24')][_0x1e51('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x13da51){if(!_0x13da51){throw new db[(_0x1e51('0x1c'))][(_0x1e51('0x26'))](_0x1e51('0x27'));}if(!_0x13da51[_0x1e51('0xb')]||!_0x13da51[_0x1e51('0xc')]){throw new db[(_0x1e51('0x1c'))][(_0x1e51('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x408a77=_0x13da51;logger[_0x1e51('0x7')](util[_0x1e51('0x8')](_0x1e51('0x35'),_0x34ad70['id']));return sentiment(_0x408a77[_0x1e51('0xb')],_0x408a77[_0x1e51('0xc')],_0x3c5330[_0x1e51('0x1f')],_0x34ad70[_0x1e51('0x11')],_0x3c5330['language']);})[_0x1e51('0xe')](function(_0x232789){logger['info'](util[_0x1e51('0x8')](_0x1e51('0x36'),_0x34ad70['id']));return _0x34ad70[_0x1e51('0x1b')]({'sentiment':_0x232789['Sentiment'],'sPositive':_0x232789[_0x1e51('0x2a')][_0x1e51('0x2b')],'sNegative':_0x232789[_0x1e51('0x2a')][_0x1e51('0x2c')],'sMixed':_0x232789[_0x1e51('0x2a')][_0x1e51('0x2d')],'sNeutral':_0x232789[_0x1e51('0x2a')][_0x1e51('0x37')],'transcribeStatus':_0x1e51('0x13')});})['then'](function(){logger[_0x1e51('0x7')](util[_0x1e51('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x34ad70['id']));_0x102f01();});}})[_0x1e51('0x38')](function(_0x41ac31){if(_0x41ac31){if(!_0x41ac31[_0x1e51('0x39')]||_0x41ac31['name']!==_0x1e51('0x3a')){logger[_0x1e51('0x3b')](util[_0x1e51('0x8')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x34ad70['id']),util[_0x1e51('0x3c')](_0x41ac31,{'showHidden':![],'depth':null}));}}_0x102f01();});});}function checkTranscribe(){var _0x52e7da;var _0x581f7a;var _0x54688b;return db[_0x1e51('0x3d')][_0x1e51('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x191a79){if(!_0x191a79||!_0x191a79[_0x1e51('0x19')]){throw new db[(_0x1e51('0x1c'))][(_0x1e51('0x26'))](_0x1e51('0x3f'));}_0x52e7da=_0x191a79;return db[_0x1e51('0x40')]['findOne']({'where':{'id':0x1}});})[_0x1e51('0xe')](function(_0x48a2d0){if(!_0x48a2d0){throw new db[(_0x1e51('0x1c'))][(_0x1e51('0x26'))]('Settings\x20not\x20available');}_0x581f7a=_0x48a2d0;if(!_0x581f7a['transcribe']||!_0x581f7a['transcribeAccountId']||!_0x581f7a[_0x1e51('0xd')]||!_0x581f7a[_0x1e51('0x20')]||!_0x581f7a[_0x1e51('0x21')]){throw new db['Sequelize'][(_0x1e51('0x26'))](_0x1e51('0x41'));}return db[_0x1e51('0x24')][_0x1e51('0x25')]({'where':{'id':_0x581f7a[_0x1e51('0x42')]}});})[_0x1e51('0xe')](function(_0x32fe1f){if(!_0x32fe1f){throw new db[(_0x1e51('0x1c'))]['ValidationError'](_0x1e51('0x27'));}if(!_0x32fe1f[_0x1e51('0xb')]||!_0x32fe1f[_0x1e51('0xc')]){throw new db[(_0x1e51('0x1c'))][(_0x1e51('0x26'))](_0x1e51('0x28'));}_0x54688b=_0x32fe1f;var _0x5ba6c2=[];_0x52e7da[_0x1e51('0x43')](function(_0x4a2c1b){_0x5ba6c2['push'](checkTranscribeJob(_0x4a2c1b,_0x581f7a,_0x54688b));});return BPromise['all'](_0x5ba6c2);})[_0x1e51('0x38')](function(_0xfbc40f){if(_0xfbc40f){if(!_0xfbc40f[_0x1e51('0x39')]||_0xfbc40f['name']!==_0x1e51('0x3a')){logger[_0x1e51('0x3b')](util[_0x1e51('0x3c')](_0xfbc40f,{'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 f6e42c7..3c9ff43 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 _0xab9c=['util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','moment','ioredis'];(function(_0x162167,_0x52203f){var _0x13fda6=function(_0x47848e){while(--_0x47848e){_0x162167['push'](_0x162167['shift']());}};_0x13fda6(++_0x52203f);}(_0xab9c,0xd0));var _0xcab9=function(_0x339b8d,_0x585742){_0x339b8d=_0x339b8d-0x0;var _0x41b9ab=_0xab9c[_0x339b8d];return _0x41b9ab;};'use strict';var _=require('lodash');var moment=require(_0xcab9('0x0'));var Redis=require(_0xcab9('0x1'));var util=require(_0xcab9('0x2'));var config=require(_0xcab9('0x3'));var db=require(_0xcab9('0x4'))['db'];var logger=require(_0xcab9('0x5'))(_0xcab9('0x6'));config[_0xcab9('0x7')]=_[_0xcab9('0x8')](config['redis'],{'host':_0xcab9('0x9'),'port':0x18eb});var io=require(_0xcab9('0xa'))(new Redis(config[_0xcab9('0x7')]));function closeInteractions(){var _0x4ecd1b=[];return db[_0xcab9('0xb')][_0xcab9('0xc')]({'raw':!![],'attributes':['id',_0xcab9('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xcab9('0xe'))}}})[_0xcab9('0xf')](function(_0x225d42){if(_0x225d42&&_0x225d42[_0xcab9('0x10')]){_0x4ecd1b=_[_0xcab9('0x11')](_0x225d42||[],'id');logger[_0xcab9('0x12')](_0xcab9('0x13'),_0x4ecd1b[_0xcab9('0x14')]());return db[_0xcab9('0xb')][_0xcab9('0x15')]({'closeReason':_0xcab9('0x16'),'disposition':_0xcab9('0x17'),'closed':!![],'closedAt':moment()[_0xcab9('0x18')](_0xcab9('0x19'))},{'where':{'id':_0x4ecd1b}});}})[_0xcab9('0xf')](function(){if(_0x4ecd1b&&_0x4ecd1b[_0xcab9('0x10')]){logger[_0xcab9('0x12')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4ecd1b[_0xcab9('0x14')]());for(var _0x45b091=0x0;_0x45b091<_0x4ecd1b[_0xcab9('0x10')];_0x45b091++){io['emit'](_0xcab9('0x1a'),{'id':_0x4ecd1b[_0x45b091],'closed':!![]});}}})[_0xcab9('0x1b')](function(_0xaae9a4){logger[_0xcab9('0x1c')](_0xcab9('0x1d'),_0xaae9a4?util['inspect'](_0xaae9a4,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8a7b=['WhatsappInteraction','findAll','lastMsgAt','hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter'];(function(_0x299027,_0x5d2e4f){var _0x1bc622=function(_0x281430){while(--_0x281430){_0x299027['push'](_0x299027['shift']());}};_0x1bc622(++_0x5d2e4f);}(_0x8a7b,0x188));var _0xb8a7=function(_0x2d98f1,_0x254499){_0x2d98f1=_0x2d98f1-0x0;var _0x5cbe38=_0x8a7b[_0x2d98f1];return _0x5cbe38;};'use strict';var _=require(_0xb8a7('0x0'));var moment=require(_0xb8a7('0x1'));var Redis=require('ioredis');var util=require(_0xb8a7('0x2'));var config=require(_0xb8a7('0x3'));var db=require(_0xb8a7('0x4'))['db'];var logger=require(_0xb8a7('0x5'))(_0xb8a7('0x6'));config[_0xb8a7('0x7')]=_[_0xb8a7('0x8')](config[_0xb8a7('0x7')],{'host':_0xb8a7('0x9'),'port':0x18eb});var io=require(_0xb8a7('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x1d30ad=[];return db[_0xb8a7('0xb')][_0xb8a7('0xc')]({'raw':!![],'attributes':['id',_0xb8a7('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xb8a7('0xe'))}}})[_0xb8a7('0xf')](function(_0x31e021){if(_0x31e021&&_0x31e021[_0xb8a7('0x10')]){_0x1d30ad=_['map'](_0x31e021||[],'id');logger['info'](_0xb8a7('0x11'),_0x1d30ad[_0xb8a7('0x12')]());return db['WhatsappInteraction'][_0xb8a7('0x13')]({'closeReason':_0xb8a7('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xb8a7('0x15')](_0xb8a7('0x16'))},{'where':{'id':_0x1d30ad}});}})[_0xb8a7('0xf')](function(){if(_0x1d30ad&&_0x1d30ad[_0xb8a7('0x10')]){logger[_0xb8a7('0x17')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x1d30ad[_0xb8a7('0x12')]());for(var _0x115ba5=0x0;_0x115ba5<_0x1d30ad[_0xb8a7('0x10')];_0x115ba5++){io[_0xb8a7('0x18')](_0xb8a7('0x19'),{'id':_0x1d30ad[_0x115ba5],'closed':!![]});}}})[_0xb8a7('0x1a')](function(_0x3815c4){logger[_0xb8a7('0x1b')](_0xb8a7('0x1c'),_0x3815c4?util[_0xb8a7('0x1d')](_0x3815c4,{'showHidden':![],'depth':null}):'');});}exports[_0xb8a7('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index d093690..a1a33c5 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7c6=['catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','destroy','then','log','finished\x20populating','CmHopper','bulkCreate','CmContact','hopper2'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe7c6,0x177));var _0x6e7c=function(_0x1c2062,_0x2d3964){_0x1c2062=_0x1c2062-0x0;var _0x29de73=_0xe7c6[_0x1c2062];return _0x29de73;};'use strict';var util=require(_0x6e7c('0x0'));var db=require(_0x6e7c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x6e7c('0x2')+i,'lastName':_0x6e7c('0x3')+i,'phone':0xf879fb460+i,'email':_0x6e7c('0x4')+i+_0x6e7c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6e7c('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x6e7c('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6e7c('0x7')](),'updatedAt':Date[_0x6e7c('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x6e7c('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x6e7c('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x6e7c('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6e7c('0x7')](),'updatedAt':Date[_0x6e7c('0x7')]()});}db['CmContact'][_0x6e7c('0x8')]({'where':{}})[_0x6e7c('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0x6e7c('0xa')](_0x6e7c('0xb'),'contacts1');return db[_0x6e7c('0xc')][_0x6e7c('0x8')]({'where':{}});})[_0x6e7c('0x9')](function(){return db['CmHopper'][_0x6e7c('0xd')](hopper);})[_0x6e7c('0x9')](function(){console[_0x6e7c('0xa')]('finished\x20populating','hopper1');return db[_0x6e7c('0xe')][_0x6e7c('0xd')](contacts2);})['then'](function(){console[_0x6e7c('0xa')]('finished\x20populating','contacts2');return db[_0x6e7c('0xc')][_0x6e7c('0xd')](hopper2);})[_0x6e7c('0x9')](function(){console[_0x6e7c('0xa')](_0x6e7c('0xb'),_0x6e7c('0xf'));})[_0x6e7c('0x10')](function(_0x4cd28c){console[_0x6e7c('0xa')](_0x4cd28c);}); \ No newline at end of file +var _0x4251=['hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','now','innocenzo.biondo','@xcally.com','CmContact','destroy','then','bulkCreate','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','log'];(function(_0x3db5a3,_0x13a80e){var _0x4b4547=function(_0x38526f){while(--_0x38526f){_0x3db5a3['push'](_0x3db5a3['shift']());}};_0x4b4547(++_0x13a80e);}(_0x4251,0xf2));var _0x1425=function(_0x43d7ee,_0x514960){_0x43d7ee=_0x43d7ee-0x0;var _0x5ec8be=_0x4251[_0x43d7ee];return _0x5ec8be;};'use strict';var util=require(_0x1425('0x0'));var db=require(_0x1425('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1425('0x2')]({'id':i,'firstName':_0x1425('0x3')+i,'lastName':_0x1425('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1425('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1425('0x5')](),'updatedAt':Date[_0x1425('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1425('0x2')]({'id':i,'firstName':_0x1425('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x1425('0x6')+i+_0x1425('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1425('0x5')](),'updatedAt':Date['now']()});}db[_0x1425('0x8')][_0x1425('0x9')]({'where':{}})[_0x1425('0xa')](function(){return db[_0x1425('0x8')][_0x1425('0xb')](contacts);})['then'](function(){console['log']('finished\x20populating',_0x1425('0xc'));return db[_0x1425('0xd')][_0x1425('0x9')]({'where':{}});})[_0x1425('0xa')](function(){return db['CmHopper'][_0x1425('0xb')](hopper);})['then'](function(){console['log'](_0x1425('0xe'),_0x1425('0xf'));return db[_0x1425('0x8')][_0x1425('0xb')](contacts2);})[_0x1425('0xa')](function(){console['log'](_0x1425('0xe'),_0x1425('0x10'));return db['CmHopper']['bulkCreate'](hopper2);})[_0x1425('0xa')](function(){console[_0x1425('0x11')](_0x1425('0xe'),_0x1425('0x12'));})[_0x1425('0x13')](function(_0x5ea13b){console[_0x1425('0x11')](_0x5ea13b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index edc167d..0b46ad6 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca8e=['format','%s%s','agent','password','udp','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','push'];(function(_0x440d49,_0x4d456d){var _0x55bc4f=function(_0x63c17){while(--_0x63c17){_0x440d49['push'](_0x440d49['shift']());}};_0x55bc4f(++_0x4d456d);}(_0xca8e,0x149));var _0xeca8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca8e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xeca8('0x0')]({'name':util[_0xeca8('0x1')](_0xeca8('0x2'),'agent',i),'fullname':util[_0xeca8('0x1')](_0xeca8('0x2'),_0xeca8('0x3'),i),'email':util['format']('%s%s@xcally.com','agent',i),'role':_0xeca8('0x3'),'password':_0xeca8('0x4'),'internal':0xfa0+i,'type':'friend','transport':[_0xeca8('0x5'),'ws','wss'],'disallow':['all'],'allow':[_0xeca8('0x6')],'defaultuser':util[_0xeca8('0x1')](_0xeca8('0x2'),'agent',i),'encryption':_0xeca8('0x7'),'avpf':_0xeca8('0x7'),'force_avp':'yes','icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xeca8('0x8'),'callerid':util[_0xeca8('0x1')](_0xeca8('0x9'),util[_0xeca8('0x1')](_0xeca8('0x2'),_0xeca8('0x3'),i),0xfa0+i)});}db[_0xeca8('0xa')][_0xeca8('0xb')](users)[_0xeca8('0xc')](function(){console[_0xeca8('0xd')]('add\x20user');})[_0xeca8('0xe')](function(_0x3b3a76){console['log'](_0x3b3a76);}); \ No newline at end of file +var _0xad0a=['%s%s','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','push','format','agent'];(function(_0x8fee0f,_0x118ab0){var _0xa5e569=function(_0x3d5a70){while(--_0x3d5a70){_0x8fee0f['push'](_0x8fee0f['shift']());}};_0xa5e569(++_0x118ab0);}(_0xad0a,0x182));var _0xaad0=function(_0x27dca5,_0x44c495){_0x27dca5=_0x27dca5-0x0;var _0xa57974=_0xad0a[_0x27dca5];return _0xa57974;};'use strict';var util=require(_0xaad0('0x0'));var db=require(_0xaad0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xaad0('0x2')]({'name':util[_0xaad0('0x3')]('%s%s',_0xaad0('0x4'),i),'fullname':util[_0xaad0('0x3')](_0xaad0('0x5'),_0xaad0('0x4'),i),'email':util['format'](_0xaad0('0x6'),_0xaad0('0x4'),i),'role':_0xaad0('0x4'),'password':_0xaad0('0x7'),'internal':0xfa0+i,'type':_0xaad0('0x8'),'transport':[_0xaad0('0x9'),'ws',_0xaad0('0xa')],'disallow':[_0xaad0('0xb')],'allow':[_0xaad0('0xc')],'defaultuser':util['format'](_0xaad0('0x5'),_0xaad0('0x4'),i),'encryption':'yes','avpf':_0xaad0('0xd'),'force_avp':_0xaad0('0xd'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xaad0('0xe'),'dtlsprivatekey':_0xaad0('0xf'),'dtlssetup':_0xaad0('0x10'),'callerid':util[_0xaad0('0x3')](_0xaad0('0x11'),util[_0xaad0('0x3')]('%s%s',_0xaad0('0x4'),i),0xfa0+i)});}db['User'][_0xaad0('0x12')](users)[_0xaad0('0x13')](function(){console['log'](_0xaad0('0x14'));})[_0xaad0('0x15')](function(_0x2548f1){console[_0xaad0('0x16')](_0x2548f1);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 5fa619c..5842f7a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7939=['query','User','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','voice:inbound','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','emit','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','join','default','connection','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','format','%s:queue:%s','Agents','length','handshake'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x7939,0x11c));var _0x9793=function(_0xb920be,_0x48e21e){_0xb920be=_0xb920be-0x0;var _0x54a992=_0x7939[_0xb920be];return _0x54a992;};'use strict';var _=require('lodash');var util=require(_0x9793('0x0'));var BPromise=require(_0x9793('0x1'));var db=require(_0x9793('0x2'))['db'];var config=require(_0x9793('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x9793('0x4'),_0x9793('0x5')],'raw':!![],'where':{'role':_0x9793('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9793('0x4')],'where':{'role':_0x9793('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x9793('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x9793('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9793('0x4'),_0x9793('0x8')],'where':{'type':_0x9793('0x9')}};function getAssociatedResources(_0x2a9b7c,_0x4e5923,_0x3901f3){return db['UserProfileSection'][_0x9793('0xa')]({'where':{'name':_0x2a9b7c,'userProfileId':_0x4e5923},'raw':!![]})[_0x9793('0xb')](function(_0x5ea2e2){if(_0x5ea2e2){if(_0x5ea2e2[_0x9793('0xc')]){switch(_0x2a9b7c){case _0x9793('0xd'):case _0x9793('0xe'):case _0x9793('0xf'):case _0x9793('0x10'):case'MailQueues':case'OpenchannelQueues':case _0x9793('0x11'):return db[_0x3901f3][_0x9793('0x12')](queryQueues);case _0x9793('0x13'):return db[_0x3901f3][_0x9793('0x12')](queryTelephones);case _0x9793('0x14'):return db[_0x3901f3][_0x9793('0x12')](queryTrunks);case _0x9793('0x15'):return db[_0x3901f3][_0x9793('0x12')](queryCampaigns);}}else{return db[_0x9793('0x16')][_0x9793('0x12')]({'attributes':[_0x9793('0x17')],'where':{'sectionId':_0x5ea2e2['id']},'raw':!![]})[_0x9793('0xb')](function(_0x4f0d68){if(_0x4f0d68){var _0x277e9b={'where':{'id':_[_0x9793('0x18')](_0x4f0d68,'resourceId')},'raw':!![]};switch(_0x3901f3){case'User':_0x277e9b[_0x9793('0x19')]['role']=_0x9793('0x7');break;case'Campaign':_0x277e9b[_0x9793('0x19')][_0x9793('0x8')]=_0x9793('0x9');break;}return db[_0x3901f3]['findAll'](_0x277e9b);}else{return[];}});}}else{return[];}})['then'](function(_0x2d6656){return _0x2d6656;});}function joinOrLeaveQueues(_0x53aa43,_0x5407c5,_0x369f5e,_0x4d1769){_0x53aa43[_0x5407c5](util[_0x9793('0x1a')](_0x9793('0x1b'),_0x369f5e,_0x4d1769[_0x9793('0x4')]));if(_0x4d1769[_0x9793('0x1c')]){for(var _0x23b51e=0x0;_0x23b51e<_0x4d1769['Agents'][_0x9793('0x1d')];_0x23b51e+=0x1){_0x53aa43[_0x5407c5](util[_0x9793('0x1a')]('user:%s',_0x4d1769[_0x9793('0x1c')][_0x23b51e]['name']));}}}function joinOrLeave(_0x3054ec,_0x1f079d,_0x566c92){var _0x4eacb2;if(_0x3054ec[_0x9793('0x1e')][_0x9793('0x1f')]['id']){db[_0x9793('0x20')]['find']({'attributes':['id',_0x9793('0x4'),_0x9793('0x5'),_0x9793('0x21')],'where':{'id':_0x3054ec[_0x9793('0x1e')][_0x9793('0x1f')]['id']},'include':[{'model':db[_0x9793('0x22')],'as':_0x9793('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x9793('0x24')],'as':_0x9793('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x9793('0x26')],'as':_0x9793('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x9793('0x28')],'as':_0x9793('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x9793('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x9793('0x2b')],'as':_0x9793('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x9793('0xb')](function(_0x481e8a){if(_0x481e8a){_0x4eacb2=_0x481e8a;_0x3054ec[_0x1f079d](util[_0x9793('0x1a')](_0x9793('0x2d'),_0x481e8a['name']));var _0x3048d8=[];switch(_0x481e8a[_0x9793('0x5')]){case _0x9793('0x2e'):_0x3054ec[_0x1f079d]('voice:inbound');_0x3054ec[_0x1f079d](_0x9793('0x2f'));if(queryQueues[_0x9793('0x30')](_0x9793('0x31'))){delete queryQueues['include'];}_0x3048d8[_0x9793('0x32')](db[_0x9793('0x33')]['findAll'](queryQueues));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x34')]['findAll'](queryQueues));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x35')][_0x9793('0x12')](queryQueues));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x36')][_0x9793('0x12')](queryQueues));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x37')][_0x9793('0x12')](queryQueues));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x38')][_0x9793('0x12')](queryQueues));_0x3048d8['push'](db[_0x9793('0x39')][_0x9793('0x12')](queryQueues));_0x3048d8[_0x9793('0x32')](db['User']['findAll'](queryTelephones));_0x3048d8['push'](db[_0x9793('0x3a')]['findAll'](queryTrunks));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x3b')][_0x9793('0x12')](queryCampaigns));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x20')][_0x9793('0x12')](queryAgents));break;case _0x9793('0x3c'):_0x3054ec[_0x1f079d](_0x9793('0x3d'));_0x3054ec[_0x1f079d]('voice:outbound');_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0xd'),_0x481e8a[_0x9793('0x21')],_0x9793('0x33')));_0x3048d8[_0x9793('0x32')](getAssociatedResources('ChatQueues',_0x481e8a['userProfileId'],_0x9793('0x34')));_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0xf'),_0x481e8a[_0x9793('0x21')],_0x9793('0x35')));_0x3048d8[_0x9793('0x32')](getAssociatedResources('SmsQueues',_0x481e8a[_0x9793('0x21')],_0x9793('0x36')));_0x3048d8[_0x9793('0x32')](getAssociatedResources('MailQueues',_0x481e8a[_0x9793('0x21')],'MailQueue'));_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0x3e'),_0x481e8a['userProfileId'],'OpenchannelQueue'));_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0x11'),_0x481e8a[_0x9793('0x21')],_0x9793('0x39')));_0x3048d8['push'](getAssociatedResources(_0x9793('0x13'),_0x481e8a['userProfileId'],'User'));_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0x14'),_0x481e8a['userProfileId'],'Trunk'));_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0x15'),_0x481e8a[_0x9793('0x21')],_0x9793('0x3b')));_0x3048d8['push'](db[_0x9793('0x20')]['findAll'](queryAgents));break;case _0x9793('0x6'):_0x3054ec[_0x1f079d](_0x9793('0x3d'));_0x3054ec[_0x1f079d](_0x9793('0x2f'));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x3f')]({'attributes':['id',_0x9793('0x4')]}));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x40')]({'attributes':['id',_0x9793('0x4')]}));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x41')]({'attributes':['id','name']}));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x42')]({'attributes':['id',_0x9793('0x4')]}));_0x3048d8['push'](_0x481e8a[_0x9793('0x43')]({'attributes':['id',_0x9793('0x4')]}));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x44')]({'attributes':['id','name']}));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x45')]({'attributes':['id','name']}));break;}return BPromise[_0x9793('0x46')](_0x3048d8);}})['then'](function(_0xe4171c){if(_0xe4171c&&_0xe4171c['length']){for(var _0x6c8092=0x0;_0x6c8092<_0xe4171c[_0x9793('0x1d')];_0x6c8092+=0x1){for(var _0x1c9d48=0x0;_0x1c9d48<_0xe4171c[_0x6c8092][_0x9793('0x1d')];_0x1c9d48+=0x1){switch(_0x6c8092){case 0x0:joinOrLeaveQueues(_0x3054ec,_0x1f079d,_0x9793('0x47'),_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x1:joinOrLeaveQueues(_0x3054ec,_0x1f079d,_0x9793('0x48'),_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x2:joinOrLeaveQueues(_0x3054ec,_0x1f079d,_0x9793('0x49'),_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x3:joinOrLeaveQueues(_0x3054ec,_0x1f079d,_0x9793('0x4a'),_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x4:joinOrLeaveQueues(_0x3054ec,_0x1f079d,_0x9793('0x4b'),_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x5:joinOrLeaveQueues(_0x3054ec,_0x1f079d,'openchannel',_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x6:joinOrLeaveQueues(_0x3054ec,_0x1f079d,'whatsapp',_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x7:if(_0x4eacb2['role']!=='agent')_0x3054ec[_0x1f079d](util[_0x9793('0x1a')](_0x9793('0x4c'),_0xe4171c[_0x6c8092][_0x1c9d48]['name']));break;case 0x8:if(_0x4eacb2[_0x9793('0x5')]!==_0x9793('0x6'))_0x3054ec[_0x1f079d](util[_0x9793('0x1a')](_0x9793('0x4d'),_0xe4171c[_0x6c8092][_0x1c9d48][_0x9793('0x4')]));break;case 0x9:if(_0x4eacb2['role']!=='agent')_0x3054ec[_0x1f079d](util[_0x9793('0x1a')]('campaign:%s:%s',_0xe4171c[_0x6c8092][_0x1c9d48]['type'],_0xe4171c[_0x6c8092][_0x1c9d48][_0x9793('0x4')]));break;case 0xa:_0x3054ec[_0x1f079d](util[_0x9793('0x1a')]('user:%s',_0xe4171c[_0x6c8092][_0x1c9d48][_0x9793('0x4')]));break;}}}}})[_0x9793('0xb')](function(){if(_0x1f079d===_0x9793('0x4e')){var _0x2445fa=_['map'](_0x4eacb2[_0x9793('0x23')],'id');return _0x4eacb2[_0x9793('0x4f')](_0x2445fa)[_0x9793('0xb')](function(){for(var _0x3ca143=0x0;_0x3ca143<_0x2445fa[_0x9793('0x1d')];_0x3ca143+=0x1){_0x566c92['emit'](_0x9793('0x50'),{'ChatInteractionId':Number(_0x2445fa[_0x3ca143]),'UserId':Number(_0x4eacb2['id'])});}});}})[_0x9793('0xb')](function(){if(_0x1f079d===_0x9793('0x4e')){var _0xed9987=_['map'](_0x4eacb2['MailInteractions'],'id');return _0x4eacb2[_0x9793('0x51')](_0xed9987)[_0x9793('0xb')](function(){for(var _0xb15e63=0x0;_0xb15e63<_0xed9987['length'];_0xb15e63+=0x1){_0x566c92['emit'](_0x9793('0x52'),{'MailInteractionId':Number(_0xed9987[_0xb15e63]),'UserId':Number(_0x4eacb2['id'])});}});}})[_0x9793('0xb')](function(){if(_0x1f079d===_0x9793('0x4e')){var _0x3dbf43=_['map'](_0x4eacb2[_0x9793('0x27')],'id');return _0x4eacb2[_0x9793('0x53')](_0x3dbf43)[_0x9793('0xb')](function(){for(var _0x2298c6=0x0;_0x2298c6<_0x3dbf43['length'];_0x2298c6+=0x1){_0x566c92['emit'](_0x9793('0x54'),{'FaxInteractionId':Number(_0x3dbf43[_0x2298c6]),'UserId':Number(_0x4eacb2['id'])});}});}})[_0x9793('0xb')](function(){if(_0x1f079d===_0x9793('0x4e')){var _0x40c043=_['map'](_0x4eacb2['SmsInteractions'],'id');return _0x4eacb2[_0x9793('0x55')](_0x40c043)[_0x9793('0xb')](function(){for(var _0x1ffe3d=0x0;_0x1ffe3d<_0x40c043[_0x9793('0x1d')];_0x1ffe3d+=0x1){_0x566c92[_0x9793('0x56')](_0x9793('0x57'),{'SmsInteractionId':Number(_0x40c043[_0x1ffe3d]),'UserId':Number(_0x4eacb2['id'])});}});}})[_0x9793('0xb')](function(){if(_0x1f079d==='leave'){var _0x1d6f8b=_[_0x9793('0x18')](_0x4eacb2['OpenchannelInteractions'],'id');return _0x4eacb2[_0x9793('0x58')](_0x1d6f8b)[_0x9793('0xb')](function(){for(var _0x43e872=0x0;_0x43e872<_0x1d6f8b[_0x9793('0x1d')];_0x43e872+=0x1){_0x566c92[_0x9793('0x56')](_0x9793('0x59'),{'OpenchannelInteractionId':Number(_0x1d6f8b[_0x43e872]),'UserId':Number(_0x4eacb2['id'])});}});}})['then'](function(){if(_0x1f079d===_0x9793('0x4e')){var _0x3572db=_[_0x9793('0x18')](_0x4eacb2[_0x9793('0x2c')],'id');return _0x4eacb2[_0x9793('0x5a')](_0x3572db)[_0x9793('0xb')](function(){for(var _0x4fd474=0x0;_0x4fd474<_0x3572db[_0x9793('0x1d')];_0x4fd474+=0x1){_0x566c92[_0x9793('0x56')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3572db[_0x4fd474]),'UserId':Number(_0x4eacb2['id'])});}});}})['catch'](function(_0x31fad5){_0x3054ec['log'](_0x31fad5);});}}function onDisconnect(_0x3cccfa,_0x14bcba){joinOrLeave(_0x3cccfa,_0x9793('0x4e'),_0x14bcba);}function onConnect(_0x37e70b){joinOrLeave(_0x37e70b,_0x9793('0x5b'));}exports[_0x9793('0x5c')]=function(_0x643d8){_0x643d8['on'](_0x9793('0x5d'),function(_0x1f5b60){_0x1f5b60['setMaxListeners'](0x0);_0x1f5b60['address']=_0x1f5b60[_0x9793('0x5e')]['connection'][_0x9793('0x5f')]+':'+_0x1f5b60[_0x9793('0x5e')][_0x9793('0x5d')][_0x9793('0x60')];_0x1f5b60[_0x9793('0x61')]=new Date();_0x1f5b60['log']=function(_0x23dccc){console[_0x9793('0x62')](_0x9793('0x63')+_0x1f5b60[_0x9793('0x64')][_0x9793('0x4')]+'['+_0x1f5b60[_0x9793('0x65')]+']',_0x23dccc);};_0x1f5b60['on'](_0x9793('0x66'),function(){onDisconnect(_0x1f5b60,_0x643d8);_0x1f5b60[_0x9793('0x62')](_0x9793('0x67'));});onConnect(_0x1f5b60);_0x1f5b60[_0x9793('0x62')](_0x9793('0x68'));});}; \ No newline at end of file +var _0x3d3d=['format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Campaign','user','Trunks','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','then','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','IvrCampaigns','map','resourceId'];(function(_0x5d0dfc,_0x4c1392){var _0x275e08=function(_0x56d21c){while(--_0x56d21c){_0x5d0dfc['push'](_0x5d0dfc['shift']());}};_0x275e08(++_0x4c1392);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var BPromise=require(_0xd3d3('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xd3d3('0x2'));var queryQueues={'attributes':['id',_0xd3d3('0x3')],'include':[{'as':_0xd3d3('0x4'),'model':db[_0xd3d3('0x5')],'attributes':['id',_0xd3d3('0x3'),_0xd3d3('0x6')],'raw':!![],'where':{'role':_0xd3d3('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd3d3('0x3')],'where':{'role':_0xd3d3('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd3d3('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xd3d3('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd3d3('0x3'),_0xd3d3('0x9')],'where':{'type':_0xd3d3('0xa')}};function getAssociatedResources(_0x578050,_0x368895,_0x412054){return db[_0xd3d3('0xb')][_0xd3d3('0xc')]({'where':{'name':_0x578050,'userProfileId':_0x368895},'raw':!![]})['then'](function(_0x2c523f){if(_0x2c523f){if(_0x2c523f[_0xd3d3('0xd')]){switch(_0x578050){case _0xd3d3('0xe'):case _0xd3d3('0xf'):case _0xd3d3('0x10'):case _0xd3d3('0x11'):case'MailQueues':case _0xd3d3('0x12'):case'WhatsappQueues':return db[_0x412054]['findAll'](queryQueues);case'Telephones':return db[_0x412054][_0xd3d3('0x13')](queryTelephones);case'Trunks':return db[_0x412054]['findAll'](queryTrunks);case _0xd3d3('0x14'):return db[_0x412054][_0xd3d3('0x13')](queryCampaigns);}}else{return db['UserProfileResource'][_0xd3d3('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x2c523f['id']},'raw':!![]})['then'](function(_0x364bb3){if(_0x364bb3){var _0x531cb3={'where':{'id':_[_0xd3d3('0x15')](_0x364bb3,_0xd3d3('0x16'))},'raw':!![]};switch(_0x412054){case _0xd3d3('0x5'):_0x531cb3['where'][_0xd3d3('0x6')]=_0xd3d3('0x8');break;case'Campaign':_0x531cb3['where'][_0xd3d3('0x9')]=_0xd3d3('0xa');break;}return db[_0x412054][_0xd3d3('0x13')](_0x531cb3);}else{return[];}});}}else{return[];}})['then'](function(_0x2ff74e){return _0x2ff74e;});}function joinOrLeaveQueues(_0x37fc96,_0x32d518,_0x5273ca,_0x53d62c){_0x37fc96[_0x32d518](util[_0xd3d3('0x17')](_0xd3d3('0x18'),_0x5273ca,_0x53d62c['name']));if(_0x53d62c[_0xd3d3('0x4')]){for(var _0x53ac55=0x0;_0x53ac55<_0x53d62c['Agents'][_0xd3d3('0x19')];_0x53ac55+=0x1){_0x37fc96[_0x32d518](util[_0xd3d3('0x17')](_0xd3d3('0x1a'),_0x53d62c[_0xd3d3('0x4')][_0x53ac55]['name']));}}}function joinOrLeave(_0x258207,_0x65b986,_0x133e41){var _0x358ecc;if(_0x258207[_0xd3d3('0x1b')][_0xd3d3('0x1c')]['id']){db[_0xd3d3('0x5')][_0xd3d3('0x1d')]({'attributes':['id',_0xd3d3('0x3'),_0xd3d3('0x6'),_0xd3d3('0x1e')],'where':{'id':_0x258207[_0xd3d3('0x1b')]['query']['id']},'include':[{'model':db[_0xd3d3('0x1f')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd3d3('0x20')],'as':_0xd3d3('0x21'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xd3d3('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xd3d3('0x23')],'as':_0xd3d3('0x24'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xd3d3('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd3d3('0x26')],'as':_0xd3d3('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x47688a){if(_0x47688a){_0x358ecc=_0x47688a;_0x258207[_0x65b986](util[_0xd3d3('0x17')](_0xd3d3('0x1a'),_0x47688a[_0xd3d3('0x3')]));var _0xd5ad91=[];switch(_0x47688a[_0xd3d3('0x6')]){case _0xd3d3('0x28'):_0x258207[_0x65b986](_0xd3d3('0x29'));_0x258207[_0x65b986](_0xd3d3('0x2a'));if(queryQueues[_0xd3d3('0x2b')](_0xd3d3('0x2c'))){delete queryQueues[_0xd3d3('0x2c')];}_0xd5ad91[_0xd3d3('0x2d')](db[_0xd3d3('0x2e')]['findAll'](queryQueues));_0xd5ad91['push'](db[_0xd3d3('0x2f')][_0xd3d3('0x13')](queryQueues));_0xd5ad91['push'](db[_0xd3d3('0x30')][_0xd3d3('0x13')](queryQueues));_0xd5ad91[_0xd3d3('0x2d')](db[_0xd3d3('0x31')][_0xd3d3('0x13')](queryQueues));_0xd5ad91['push'](db[_0xd3d3('0x32')]['findAll'](queryQueues));_0xd5ad91['push'](db[_0xd3d3('0x33')]['findAll'](queryQueues));_0xd5ad91[_0xd3d3('0x2d')](db['WhatsappQueue'][_0xd3d3('0x13')](queryQueues));_0xd5ad91[_0xd3d3('0x2d')](db[_0xd3d3('0x5')][_0xd3d3('0x13')](queryTelephones));_0xd5ad91[_0xd3d3('0x2d')](db['Trunk'][_0xd3d3('0x13')](queryTrunks));_0xd5ad91[_0xd3d3('0x2d')](db[_0xd3d3('0x34')][_0xd3d3('0x13')](queryCampaigns));_0xd5ad91[_0xd3d3('0x2d')](db[_0xd3d3('0x5')][_0xd3d3('0x13')](queryAgents));break;case _0xd3d3('0x35'):_0x258207[_0x65b986](_0xd3d3('0x29'));_0x258207[_0x65b986]('voice:outbound');_0xd5ad91[_0xd3d3('0x2d')](getAssociatedResources(_0xd3d3('0xe'),_0x47688a[_0xd3d3('0x1e')],_0xd3d3('0x2e')));_0xd5ad91[_0xd3d3('0x2d')](getAssociatedResources('ChatQueues',_0x47688a['userProfileId'],_0xd3d3('0x2f')));_0xd5ad91[_0xd3d3('0x2d')](getAssociatedResources('FaxQueues',_0x47688a[_0xd3d3('0x1e')],_0xd3d3('0x30')));_0xd5ad91[_0xd3d3('0x2d')](getAssociatedResources(_0xd3d3('0x11'),_0x47688a[_0xd3d3('0x1e')],_0xd3d3('0x31')));_0xd5ad91[_0xd3d3('0x2d')](getAssociatedResources('MailQueues',_0x47688a[_0xd3d3('0x1e')],_0xd3d3('0x32')));_0xd5ad91[_0xd3d3('0x2d')](getAssociatedResources(_0xd3d3('0x12'),_0x47688a[_0xd3d3('0x1e')],'OpenchannelQueue'));_0xd5ad91['push'](getAssociatedResources('WhatsappQueues',_0x47688a['userProfileId'],'WhatsappQueue'));_0xd5ad91['push'](getAssociatedResources('Telephones',_0x47688a['userProfileId'],_0xd3d3('0x5')));_0xd5ad91[_0xd3d3('0x2d')](getAssociatedResources(_0xd3d3('0x36'),_0x47688a[_0xd3d3('0x1e')],'Trunk'));_0xd5ad91['push'](getAssociatedResources('IvrCampaigns',_0x47688a[_0xd3d3('0x1e')],'Campaign'));_0xd5ad91[_0xd3d3('0x2d')](db[_0xd3d3('0x5')][_0xd3d3('0x13')](queryAgents));break;case _0xd3d3('0x7'):_0x258207[_0x65b986](_0xd3d3('0x29'));_0x258207[_0x65b986]('voice:outbound');_0xd5ad91[_0xd3d3('0x2d')](_0x47688a['getVoiceQueues']({'attributes':['id',_0xd3d3('0x3')]}));_0xd5ad91['push'](_0x47688a[_0xd3d3('0x37')]({'attributes':['id','name']}));_0xd5ad91[_0xd3d3('0x2d')](_0x47688a[_0xd3d3('0x38')]({'attributes':['id','name']}));_0xd5ad91['push'](_0x47688a[_0xd3d3('0x39')]({'attributes':['id','name']}));_0xd5ad91[_0xd3d3('0x2d')](_0x47688a[_0xd3d3('0x3a')]({'attributes':['id',_0xd3d3('0x3')]}));_0xd5ad91[_0xd3d3('0x2d')](_0x47688a[_0xd3d3('0x3b')]({'attributes':['id','name']}));_0xd5ad91[_0xd3d3('0x2d')](_0x47688a[_0xd3d3('0x3c')]({'attributes':['id','name']}));break;}return BPromise['all'](_0xd5ad91);}})[_0xd3d3('0x3d')](function(_0xe5f0b2){if(_0xe5f0b2&&_0xe5f0b2[_0xd3d3('0x19')]){for(var _0xf78070=0x0;_0xf78070<_0xe5f0b2[_0xd3d3('0x19')];_0xf78070+=0x1){for(var _0x3938e3=0x0;_0x3938e3<_0xe5f0b2[_0xf78070]['length'];_0x3938e3+=0x1){switch(_0xf78070){case 0x0:joinOrLeaveQueues(_0x258207,_0x65b986,_0xd3d3('0x3e'),_0xe5f0b2[_0xf78070][_0x3938e3]);break;case 0x1:joinOrLeaveQueues(_0x258207,_0x65b986,_0xd3d3('0x3f'),_0xe5f0b2[_0xf78070][_0x3938e3]);break;case 0x2:joinOrLeaveQueues(_0x258207,_0x65b986,_0xd3d3('0x40'),_0xe5f0b2[_0xf78070][_0x3938e3]);break;case 0x3:joinOrLeaveQueues(_0x258207,_0x65b986,_0xd3d3('0x41'),_0xe5f0b2[_0xf78070][_0x3938e3]);break;case 0x4:joinOrLeaveQueues(_0x258207,_0x65b986,'mail',_0xe5f0b2[_0xf78070][_0x3938e3]);break;case 0x5:joinOrLeaveQueues(_0x258207,_0x65b986,_0xd3d3('0x42'),_0xe5f0b2[_0xf78070][_0x3938e3]);break;case 0x6:joinOrLeaveQueues(_0x258207,_0x65b986,_0xd3d3('0x43'),_0xe5f0b2[_0xf78070][_0x3938e3]);break;case 0x7:if(_0x358ecc[_0xd3d3('0x6')]!==_0xd3d3('0x7'))_0x258207[_0x65b986](util[_0xd3d3('0x17')](_0xd3d3('0x44'),_0xe5f0b2[_0xf78070][_0x3938e3][_0xd3d3('0x3')]));break;case 0x8:if(_0x358ecc[_0xd3d3('0x6')]!==_0xd3d3('0x7'))_0x258207[_0x65b986](util[_0xd3d3('0x17')](_0xd3d3('0x45'),_0xe5f0b2[_0xf78070][_0x3938e3][_0xd3d3('0x3')]));break;case 0x9:if(_0x358ecc['role']!==_0xd3d3('0x7'))_0x258207[_0x65b986](util['format'](_0xd3d3('0x46'),_0xe5f0b2[_0xf78070][_0x3938e3][_0xd3d3('0x9')],_0xe5f0b2[_0xf78070][_0x3938e3][_0xd3d3('0x3')]));break;case 0xa:_0x258207[_0x65b986](util[_0xd3d3('0x17')]('user:%s',_0xe5f0b2[_0xf78070][_0x3938e3][_0xd3d3('0x3')]));break;}}}}})[_0xd3d3('0x3d')](function(){if(_0x65b986===_0xd3d3('0x47')){var _0x3ba97c=_[_0xd3d3('0x15')](_0x358ecc[_0xd3d3('0x48')],'id');return _0x358ecc['removeChatInteractions'](_0x3ba97c)[_0xd3d3('0x3d')](function(){for(var _0x2f1033=0x0;_0x2f1033<_0x3ba97c[_0xd3d3('0x19')];_0x2f1033+=0x1){_0x133e41[_0xd3d3('0x49')](_0xd3d3('0x4a'),{'ChatInteractionId':Number(_0x3ba97c[_0x2f1033]),'UserId':Number(_0x358ecc['id'])});}});}})[_0xd3d3('0x3d')](function(){if(_0x65b986===_0xd3d3('0x47')){var _0x182751=_[_0xd3d3('0x15')](_0x358ecc['MailInteractions'],'id');return _0x358ecc['removeMailInteractions'](_0x182751)['then'](function(){for(var _0x252023=0x0;_0x252023<_0x182751[_0xd3d3('0x19')];_0x252023+=0x1){_0x133e41[_0xd3d3('0x49')](_0xd3d3('0x4b'),{'MailInteractionId':Number(_0x182751[_0x252023]),'UserId':Number(_0x358ecc['id'])});}});}})[_0xd3d3('0x3d')](function(){if(_0x65b986==='leave'){var _0x1c5977=_[_0xd3d3('0x15')](_0x358ecc[_0xd3d3('0x22')],'id');return _0x358ecc['removeFaxInteractions'](_0x1c5977)[_0xd3d3('0x3d')](function(){for(var _0x48e0d5=0x0;_0x48e0d5<_0x1c5977[_0xd3d3('0x19')];_0x48e0d5+=0x1){_0x133e41['emit'](_0xd3d3('0x4c'),{'FaxInteractionId':Number(_0x1c5977[_0x48e0d5]),'UserId':Number(_0x358ecc['id'])});}});}})[_0xd3d3('0x3d')](function(){if(_0x65b986===_0xd3d3('0x47')){var _0x367d5e=_[_0xd3d3('0x15')](_0x358ecc['SmsInteractions'],'id');return _0x358ecc[_0xd3d3('0x4d')](_0x367d5e)['then'](function(){for(var _0x2c3a37=0x0;_0x2c3a37<_0x367d5e[_0xd3d3('0x19')];_0x2c3a37+=0x1){_0x133e41['emit'](_0xd3d3('0x4e'),{'SmsInteractionId':Number(_0x367d5e[_0x2c3a37]),'UserId':Number(_0x358ecc['id'])});}});}})[_0xd3d3('0x3d')](function(){if(_0x65b986===_0xd3d3('0x47')){var _0xfb1ca7=_['map'](_0x358ecc[_0xd3d3('0x25')],'id');return _0x358ecc[_0xd3d3('0x4f')](_0xfb1ca7)[_0xd3d3('0x3d')](function(){for(var _0x4e9941=0x0;_0x4e9941<_0xfb1ca7[_0xd3d3('0x19')];_0x4e9941+=0x1){_0x133e41[_0xd3d3('0x49')](_0xd3d3('0x50'),{'OpenchannelInteractionId':Number(_0xfb1ca7[_0x4e9941]),'UserId':Number(_0x358ecc['id'])});}});}})[_0xd3d3('0x3d')](function(){if(_0x65b986===_0xd3d3('0x47')){var _0x24d4e4=_[_0xd3d3('0x15')](_0x358ecc['WhatsappInteractions'],'id');return _0x358ecc['removeWhatsappInteractions'](_0x24d4e4)[_0xd3d3('0x3d')](function(){for(var _0x2a67ca=0x0;_0x2a67ca<_0x24d4e4[_0xd3d3('0x19')];_0x2a67ca+=0x1){_0x133e41['emit'](_0xd3d3('0x51'),{'WhatsappInteractionId':Number(_0x24d4e4[_0x2a67ca]),'UserId':Number(_0x358ecc['id'])});}});}})[_0xd3d3('0x52')](function(_0x185857){_0x258207['log'](_0x185857);});}}function onDisconnect(_0x31e000,_0x4b5d13){joinOrLeave(_0x31e000,_0xd3d3('0x47'),_0x4b5d13);}function onConnect(_0x57d754){joinOrLeave(_0x57d754,'join');}exports[_0xd3d3('0x53')]=function(_0x3b07be){_0x3b07be['on'](_0xd3d3('0x54'),function(_0x2d7e9b){_0x2d7e9b[_0xd3d3('0x55')](0x0);_0x2d7e9b[_0xd3d3('0x56')]=_0x2d7e9b[_0xd3d3('0x57')][_0xd3d3('0x54')][_0xd3d3('0x58')]+':'+_0x2d7e9b[_0xd3d3('0x57')][_0xd3d3('0x54')][_0xd3d3('0x59')];_0x2d7e9b[_0xd3d3('0x5a')]=new Date();_0x2d7e9b[_0xd3d3('0x5b')]=function(_0x12c2c4){console[_0xd3d3('0x5b')](_0xd3d3('0x5c')+_0x2d7e9b[_0xd3d3('0x5d')][_0xd3d3('0x3')]+'['+_0x2d7e9b[_0xd3d3('0x56')]+']',_0x12c2c4);};_0x2d7e9b['on'](_0xd3d3('0x5e'),function(){onDisconnect(_0x2d7e9b,_0x3b07be);_0x2d7e9b[_0xd3d3('0x5b')](_0xd3d3('0x5f'));});onConnect(_0x2d7e9b);_0x2d7e9b[_0xd3d3('0x5b')](_0xd3d3('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7a2a4f4..c9ac38d 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 _0x67b2=['QueryTypes','contact','UserId','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','offlineMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','interface','format','changed','closed','substatus','AfterUpdate','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','toLowerCase','condition','util','jayson/promise','triggers','client','Chat','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','Openchannel','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','catch','channel','motionChannel','event','direction','resolve','ContactId','undefined','sequelize','query'];(function(_0x295c6d,_0x11a9fb){var _0xa31b90=function(_0x454527){while(--_0x454527){_0x295c6d['push'](_0x295c6d['shift']());}};_0xa31b90(++_0x11a9fb);}(_0x67b2,0x188));var _0x267b=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x67b2[_0x489b87];return _0x1823b6;};'use strict';var util=require(_0x267b('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x267b('0x1'));var logger=require('../logger')(_0x267b('0x2'));var client=jayson[_0x267b('0x3')]['http']({'port':0x232a});var triggers=[{'channel':_0x267b('0x4'),'model':_0x267b('0x5'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x267b('0x4'),'model':'ChatInteraction','event':_0x267b('0x6'),'condition':_0x267b('0x7'),'callback':afterUpdate},{'channel':_0x267b('0x4'),'model':_0x267b('0x8'),'event':_0x267b('0x9'),'condition':_0x267b('0xa'),'callback':afterCreateMessage},{'channel':_0x267b('0x4'),'model':_0x267b('0xb'),'event':'afterCreate','condition':_0x267b('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x267b('0xc'),'model':_0x267b('0xd'),'event':_0x267b('0x9'),'condition':_0x267b('0xe'),'callback':afterCreate},{'channel':'Sms','model':_0x267b('0xd'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x267b('0xf'),'event':_0x267b('0x9'),'condition':_0x267b('0xa'),'callback':afterCreateMessage},{'channel':_0x267b('0x10'),'model':_0x267b('0x11'),'event':_0x267b('0x9'),'condition':_0x267b('0xe'),'callback':afterCreate},{'channel':_0x267b('0x10'),'model':_0x267b('0x11'),'event':_0x267b('0x6'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x267b('0x10'),'model':'WhatsappMessage','event':_0x267b('0x9'),'condition':_0x267b('0xa'),'callback':afterCreateMessage},{'channel':_0x267b('0x12'),'model':_0x267b('0x13'),'event':_0x267b('0x9'),'condition':_0x267b('0xe'),'callback':afterCreate},{'channel':_0x267b('0x12'),'model':_0x267b('0x13'),'event':_0x267b('0x6'),'condition':_0x267b('0x7'),'callback':afterUpdate},{'channel':_0x267b('0x12'),'model':_0x267b('0x14'),'event':_0x267b('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0x267b('0x15'),'event':_0x267b('0x9'),'condition':_0x267b('0xe'),'callback':afterCreate},{'channel':_0x267b('0x16'),'model':_0x267b('0x15'),'event':_0x267b('0x6'),'condition':_0x267b('0x7'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0x267b('0x9'),'condition':_0x267b('0xa'),'callback':afterCreateMessage},{'channel':_0x267b('0x17'),'model':'OpenchannelInteraction','event':_0x267b('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x267b('0x17'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x267b('0x17'),'model':_0x267b('0x18'),'event':_0x267b('0x9'),'condition':_0x267b('0xa'),'callback':afterCreateMessage}];function request(_0x17ef3d){return client[_0x267b('0x19')](_0x267b('0x1a'),_0x17ef3d)[_0x267b('0x1b')](function(_0x184339){logger['info'](_0x267b('0x1c'),'EventManager',_0x184339);if(_0x184339['error']){if(_0x184339[_0x267b('0x1d')]['code']===0x1f4){logger['error'](_0x267b('0x1c'),_0x267b('0x1a'),_0x184339['error']);}}})[_0x267b('0x1e')](function(_0x2b477a){logger[_0x267b('0x1d')](_0x267b('0x1c'),_0x267b('0x1a'),_0x2b477a);});}function afterCreateMessage(_0x3e2d15){return function(_0x266784){_0x266784=_0x266784['get']({'plain':!![]});_0x266784[_0x267b('0x1f')]=_0x3e2d15;_0x266784[_0x267b('0x20')]=_0x3e2d15;_0x266784[_0x267b('0x21')]=_0x266784[_0x267b('0x22')];Promise[_0x267b('0x23')]()[_0x267b('0x1b')](function(){if(typeof _0x266784[_0x267b('0x24')]===_0x267b('0x25'))return null;var _0x424900='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x266784[_0x267b('0x24')];return db[_0x267b('0x26')][_0x267b('0x27')](_0x424900,{'type':db['Sequelize'][_0x267b('0x28')]['SELECT'],'raw':!![]});})[_0x267b('0x1b')](function(_0x1f3461){if(_0x1f3461){_0x266784[_0x267b('0x29')]=_0x1f3461[0x0];}if(typeof _0x266784['UserId']===_0x267b('0x25'))return;return getAgent(_0x266784[_0x267b('0x2a')]);})[_0x267b('0x1b')](function(_0x163d49){if(_0x163d49){_0x266784['interface']=util['format'](_0x267b('0x2b'),_0x163d49[_0x267b('0x2c')]);_0x266784[_0x267b('0x2d')]=_0x163d49;_0x266784['channel']=_0x3e2d15;return request({'event':_0x267b('0x2e'),'message':_0x266784});}else{return request({'event':_0x267b('0x2f'),'message':_0x266784});}})[_0x267b('0x1e')](function(_0x332a18){logger[_0x267b('0x1d')](_0x267b('0x1c'),_0x267b('0x30'),_0x332a18);});};}function afterCreateOfflineMessage(_0x56be00){return function(_0x4f27ea){_0x4f27ea=_0x4f27ea[_0x267b('0x31')]({'plain':!![]});_0x4f27ea[_0x267b('0x1f')]=_0x56be00;_0x4f27ea[_0x267b('0x20')]=_0x56be00;_0x4f27ea[_0x267b('0x21')]=_0x267b('0x32');return request({'event':_0x4f27ea['event'],'message':_0x4f27ea});};}function afterCreate(_0x533d13,_0x386aef){return function(_0x1c452c){_0x1c452c=_0x1c452c['get']({'plain':!![]});_0x1c452c['channel']=_0x533d13;_0x1c452c[_0x267b('0x20')]=_0x533d13;_0x1c452c[_0x267b('0x21')]='opened';Promise[_0x267b('0x23')]()[_0x267b('0x1b')](function(){var _0x120fbc=_0x267b('0x33')+_0x1c452c[_0x267b('0x24')];return db[_0x267b('0x26')][_0x267b('0x27')](_0x120fbc,{'type':db[_0x267b('0x34')][_0x267b('0x28')][_0x267b('0x35')],'raw':!![]});})[_0x267b('0x1b')](function(_0x4f364f){if(_0x4f364f){_0x1c452c[_0x267b('0x29')]=_0x4f364f[0x0];}if(typeof _0x1c452c['UserId']===_0x267b('0x25'))return;return getAgent(_0x1c452c[_0x267b('0x2a')]);})[_0x267b('0x1b')](function(_0x21d2c9){if(_0x21d2c9){_0x1c452c[_0x267b('0x36')]=util[_0x267b('0x37')](_0x267b('0x2b'),_0x21d2c9[_0x267b('0x2c')]);_0x1c452c[_0x267b('0x2d')]=_0x21d2c9;}return request({'event':_0x386aef,'message':_0x1c452c});})[_0x267b('0x1e')](function(_0x1200e4){logger[_0x267b('0x1d')](_0x267b('0x1c'),'AfterCreate',_0x1200e4);});};}function afterUpdate(_0x2d926b){return function(_0x1e4a9a){var _0xa643f2=_0x1e4a9a[_0x267b('0x38')](_0x267b('0x39'))&&_0x1e4a9a[_0x267b('0x39')];var _0x3a5fff=_0x1e4a9a[_0x267b('0x38')]('substatus');if(_0xa643f2||_0x3a5fff){var _0x5b2cbd=_0xa643f2?_0x267b('0x7'):'substatus';var _0x33885a=_0x1e4a9a['get']({'plain':!![]});_0x33885a['channel']=_0x2d926b;_0x33885a[_0x267b('0x20')]=_0x2d926b;_0x33885a[_0x267b('0x21')]=_0xa643f2?_0x267b('0x39'):_0x267b('0x3a');var _0x1e9ec1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x33885a[_0x267b('0x24')];return db[_0x267b('0x26')][_0x267b('0x27')](_0x1e9ec1,{'type':db[_0x267b('0x34')][_0x267b('0x28')][_0x267b('0x35')],'raw':!![]})['then'](function(_0x8cc153){if(_0x8cc153){_0x33885a['contact']=_0x8cc153[0x0];}if(typeof _0x33885a['UserId']===_0x267b('0x25'))return;return getAgent(_0x33885a[_0x267b('0x2a')]);})['then'](function(_0x197c06){if(_0x197c06){_0x33885a[_0x267b('0x36')]=util[_0x267b('0x37')](_0x267b('0x2b'),_0x197c06[_0x267b('0x2c')]);_0x33885a['agent']=_0x197c06;}return request({'event':_0x5b2cbd,'message':_0x33885a});})[_0x267b('0x1e')](function(_0x4e335c){logger[_0x267b('0x1d')]('Trigger,\x20%s',_0x267b('0x3b'),_0x4e335c);});}};}function getAgent(_0x312a21){return db[_0x267b('0x3c')][_0x267b('0x3d')]({'where':{'id':_0x312a21},'attributes':['id',_0x267b('0x2c'),_0x267b('0x3e'),_0x267b('0x3f'),_0x267b('0x40')],'raw':!![]})['then'](function(_0x411784){return _0x411784;});}exports[_0x267b('0x41')]=function(){for(var _0x34b196=0x0;_0x34b196=_0x382dd4[_0x3f23('0x14')]){throw Error(_0x3f23('0x15'));}_0xa0bc2b(_0x29e3b1);})[_0x3f23('0x16')](function(_0x3358b0){_0x89eb5b(_0x3358b0);});});}; \ No newline at end of file +var _0x295d=['mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb'];(function(_0x535fde,_0x3ed8cc){var _0x30da39=function(_0x5e3a4c){while(--_0x5e3a4c){_0x535fde['push'](_0x535fde['shift']());}};_0x30da39(++_0x3ed8cc);}(_0x295d,0x195));var _0xd295=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x295d[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xd295('0x0'));var BPromise=require(_0xd295('0x1'));var db=require(_0xd295('0x2'))['db'];var util=require('./license/util');var channels=['voice',_0xd295('0x3'),_0xd295('0x4'),_0xd295('0x5'),_0xd295('0x6'),_0xd295('0x7'),_0xd295('0x8')];exports[_0xd295('0x9')]=function(){return channels;};exports[_0xd295('0xa')]=function(_0x363070){_0x363070=_0x363070['toLowerCase']();return _[_0xd295('0xb')](channels,_0x363070);};exports[_0xd295('0xc')]=function(_0x15bb30,_0x52b79c,_0x5d9a32,_0xa3040c){var _0x11a2bd={'loginAttempts':_0x52b79c,'blocked':_0x5d9a32};if(!_[_0xd295('0xd')](_0xa3040c)){_0x11a2bd[_0xd295('0xe')]=_0xa3040c;}return _0x15bb30[_0xd295('0xf')](_0x11a2bd);};exports[_0xd295('0x10')]=function(_0x242754){return new BPromise(function(_0x7bfa1e,_0x332423){var _0xb0eaf=0x0;if(_0x242754[_0xd295('0x11')]!=='agent'){_0x7bfa1e(_0x242754);}db[_0xd295('0x12')][_0xd295('0x13')]({'where':{'role':_0xd295('0x14'),'online':!![],'id':{'$ne':_0x242754['id']}}})['then'](function(_0x3f520f){_0xb0eaf=_0x3f520f;return util[_0xd295('0x10')]();})[_0xd295('0x15')](function(_0x4d6712){if(_0x4d6712&&_0x4d6712[_0xd295('0x16')]&&_0xb0eaf>=_0x4d6712['agents']){throw Error(_0xd295('0x17'));}_0x7bfa1e(_0x242754);})['catch'](function(_0x2ae307){_0x332423(_0x2ae307);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index ac0e025..16f8c7e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bec=['render','send','exports','status'];(function(_0x3af2a6,_0x407540){var _0x4eaa15=function(_0x193ee4){while(--_0x193ee4){_0x3af2a6['push'](_0x3af2a6['shift']());}};_0x4eaa15(++_0x407540);}(_0x8bec,0x6e));var _0xc8be=function(_0xb05e5f,_0x58f114){_0xb05e5f=_0xb05e5f-0x0;var _0x4e4fa5=_0x8bec[_0xb05e5f];return _0x4e4fa5;};'use strict';module[_0xc8be('0x0')][0x194]=function pageNotFound(_0xa6272f,_0x1ce28a){var _0x66a07e='404';var _0x238bf8=0x194;var _0x377f23={'status':_0x238bf8};_0x1ce28a[_0xc8be('0x1')](_0x377f23[_0xc8be('0x1')]);_0x1ce28a[_0xc8be('0x2')](_0x66a07e,{},function(_0x1b827b,_0x5376a8){if(_0x1b827b){return _0x1ce28a[_0xc8be('0x1')](_0x377f23['status'])['json'](_0x377f23);}_0x1ce28a[_0xc8be('0x3')](_0x5376a8);});}; \ No newline at end of file +var _0x10a5=['404','status','render','exports'];(function(_0x128495,_0x25a304){var _0xcb1a0e=function(_0x451f3f){while(--_0x451f3f){_0x128495['push'](_0x128495['shift']());}};_0xcb1a0e(++_0x25a304);}(_0x10a5,0x163));var _0x510a=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x10a5[_0x134192];return _0x3cd080;};'use strict';module[_0x510a('0x0')][0x194]=function pageNotFound(_0xb959f3,_0x1df3d1){var _0x16726e=_0x510a('0x1');var _0x3dce5a=0x194;var _0x68c824={'status':_0x3dce5a};_0x1df3d1[_0x510a('0x2')](_0x68c824[_0x510a('0x2')]);_0x1df3d1[_0x510a('0x3')](_0x16726e,{},function(_0x2ef9db,_0x4081a9){if(_0x2ef9db){return _0x1df3d1[_0x510a('0x2')](_0x68c824[_0x510a('0x2')])['json'](_0x68c824);}_0x1df3d1['send'](_0x4081a9);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index bcc19ba..f87f9af 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cf9=['Dispositions','Answers','Messages','Interactions','Applications','List','ListId','Template','Agents','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','Dashboard','Items','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','Account','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','CmContactHasItem','Hoppers','Company','CompanyId','cm_contact_has_tags','CmHopperId','Agent','Campaign','CampaignId','OwnerId','Automation','Condition','OneAll','Any','AutomationAnyId','AutomationId','ParentId','Intervals','Extensions','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','WhatsappInteraction','ItemType','Hopper','CmContactId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','CustomReportId','MetricId','Configurations','AccountId','Subjects','DescriptionId','FieldId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','ZohoAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ToId','SessionId','JscriptyAnswerReport','SmsQueueReport','ProjectId','user_has_square_projects','team_has_mail_queues','team_has_chat_queues','team_has_whatsapp_queues','WhatsappQueues','VoicePrefixes','TrunkId','SquareProjectId','Lists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAccount','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','CustomFields','Queues','voice_queues_has_cm_lists','sectionId','WhatsappAccountId','WhatsappMessage','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappQueueReport','ToQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','sequelizeHistory','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/squareReport/squareReport.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','VoiceMail','hasOne','UserSetting','cascade','UserId','hasMany','VoiceQueuesRt','CmHopperFinal','HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','CmList','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','cm_user_has_lists','ChatWebsites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp'];(function(_0x5a0fdb,_0x3ad7a6){var _0x1f7b18=function(_0x3e00fc){while(--_0x3e00fc){_0x5a0fdb['push'](_0x5a0fdb['shift']());}};_0x1f7b18(++_0x3ad7a6);}(_0x4cf9,0x9d));var _0x94cf=function(_0xd8442b,_0x439852){_0xd8442b=_0xd8442b-0x0;var _0x27ef78=_0x4cf9[_0xd8442b];return _0x27ef78;};'use strict';var config=require(_0x94cf('0x0'));var Sequelize=require(_0x94cf('0x1'));var _=require(_0x94cf('0x2'));var jstz=require(_0x94cf('0x3'));var timezone=jstz[_0x94cf('0x4')]();config['sequelize']=_[_0x94cf('0x5')](config[_0x94cf('0x1')],{'database':_0x94cf('0x6'),'username':_0x94cf('0x7'),'password':_0x94cf('0x8'),'options':{'host':_0x94cf('0x9'),'port':0xcea,'dialect':_0x94cf('0xa'),'dialectOptions':{'charset':_0x94cf('0xb')},'logging':![],'timezone':timezone[_0x94cf('0xc')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x94cf('0x5')](config[_0x94cf('0xd')],{'database':_0x94cf('0x6'),'username':'xcall','password':_0x94cf('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x94cf('0xa'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x94cf('0xc')](),'define':{'charset':'utf8','collate':_0x94cf('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x94cf('0x1')][_0x94cf('0xf')],config[_0x94cf('0x1')][_0x94cf('0x10')],config[_0x94cf('0x1')][_0x94cf('0x11')],config['sequelize'][_0x94cf('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x94cf('0xd')][_0x94cf('0x10')],config[_0x94cf('0xd')]['password'],config['sequelizeHistory'][_0x94cf('0x12')])};db[_0x94cf('0x13')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x15'));db[_0x94cf('0x16')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x17'));db[_0x94cf('0x18')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x19'));db[_0x94cf('0x1a')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x1b'));db[_0x94cf('0x1c')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x1d'));db[_0x94cf('0x1e')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x1f'));db[_0x94cf('0x20')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x21'));db['ScreenRecording']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x22'));db['VoiceMail']=db['sequelize'][_0x94cf('0x14')]('../api/voiceMail/voiceMail.model');db[_0x94cf('0x23')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x24'));db[_0x94cf('0x25')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x26'));db[_0x94cf('0x27')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x28'));db['VoiceAgentReport']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x29'));db['VoiceQueueReport']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x2a'));db[_0x94cf('0x2b')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x2c'));db[_0x94cf('0x2d')]=db['sequelize']['import'](_0x94cf('0x2e'));db[_0x94cf('0x2f')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x30'));db[_0x94cf('0x31')]=db[_0x94cf('0x1')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x94cf('0x32')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x33'));db[_0x94cf('0x34')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x35'));db[_0x94cf('0x36')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x37'));db[_0x94cf('0x38')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0x94cf('0x39')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x3a'));db[_0x94cf('0x3b')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x3c'));db[_0x94cf('0x3d')]=db['sequelize'][_0x94cf('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x94cf('0x3e')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x3f'));db[_0x94cf('0x40')]=db[_0x94cf('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db[_0x94cf('0x41')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x42'));db[_0x94cf('0x43')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x44'));db[_0x94cf('0x45')]=db['sequelize']['import']('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x46'));db[_0x94cf('0x47')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/mailMessage/mailMessage.model');db[_0x94cf('0x48')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x49'));db['MailQueueReport']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x4a'));db['Dashboard']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x4b'));db[_0x94cf('0x4c')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x4d'));db['FaxAccount']=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x4e'));db[_0x94cf('0x4f')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x50'));db[_0x94cf('0x51')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x52'));db['FaxMessage']=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/faxMessage/faxMessage.model');db[_0x94cf('0x53')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x54'));db['FaxQueueReport']=db[_0x94cf('0x1')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x94cf('0x55')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x56'));db[_0x94cf('0x57')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x58'));db[_0x94cf('0x59')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x5a'));db[_0x94cf('0x5b')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x5c'));db[_0x94cf('0x5d')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x5e'));db[_0x94cf('0x5f')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x60'));db[_0x94cf('0x61')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/openchannelApplication/openchannelApplication.model');db[_0x94cf('0x62')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x63'));db[_0x94cf('0x64')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x65'));db[_0x94cf('0x66')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0x94cf('0x67')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x68'));db[_0x94cf('0x69')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x6a'));db[_0x94cf('0x6b')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x6c'));db[_0x94cf('0x6d')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x6e'));db[_0x94cf('0x6f')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x70'));db[_0x94cf('0x71')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x72'));db[_0x94cf('0x73')]=db[_0x94cf('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x94cf('0x74')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x75'));db[_0x94cf('0x76')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x77'));db[_0x94cf('0x78')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x79'));db['CmContact']=db[_0x94cf('0x1')]['import'](_0x94cf('0x7a'));db['CmHopper']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x7b'));db[_0x94cf('0x7c')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x7d'));db['CmHopperFinal']=db[_0x94cf('0x1')]['import'](_0x94cf('0x7e'));db['CmHopperHistory']=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x7f'));db['ReportAgentPreview']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x80'));db[_0x94cf('0x81')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x82'));db[_0x94cf('0x83')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x84'));db['Automation']=db[_0x94cf('0x1')]['import'](_0x94cf('0x85'));db[_0x94cf('0x86')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x87'));db[_0x94cf('0x88')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x89'));db['Condition']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x8a'));db[_0x94cf('0x8b')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/interval/interval.model');db[_0x94cf('0x8c')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x8d'));db[_0x94cf('0x8e')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x8f'));db[_0x94cf('0x90')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x91'));db[_0x94cf('0x92')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/schedule/schedule.model');db[_0x94cf('0x93')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x94'));db[_0x94cf('0x95')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x96'));db[_0x94cf('0x97')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/contactItemType/contactItemType.model');db['CmContactHasItem']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x98'));db[_0x94cf('0x99')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x9a'));db['Template']=db['sequelize'][_0x94cf('0x14')](_0x94cf('0x9b'));db['Trigger']=db['sequelize']['import'](_0x94cf('0x9c'));db[_0x94cf('0x9d')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x9e'));db[_0x94cf('0x9f')]=db[_0x94cf('0x1')]['import']('../api/integration/integration.model');db[_0x94cf('0xa0')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0xa1'));db[_0x94cf('0xa2')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x94cf('0xa3')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xa4'));db[_0x94cf('0xa5')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0xa6'));db[_0x94cf('0xa7')]=db[_0x94cf('0x1')]['import'](_0x94cf('0xa8'));db['AnalyticFieldReport']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xa9'));db[_0x94cf('0xaa')]=db[_0x94cf('0x1')]['import'](_0x94cf('0xab'));db[_0x94cf('0xac')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xad'));db[_0x94cf('0xae')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0xaf'));db[_0x94cf('0xb0')]=db['sequelize']['import'](_0x94cf('0xb1'));db[_0x94cf('0xb2')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xb3'));db[_0x94cf('0xb4')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xb5'));db['DeskAccount']=db['sequelize'][_0x94cf('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0x94cf('0xb6')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xb7'));db['DeskField']=db['sequelize'][_0x94cf('0x14')](_0x94cf('0xb8'));db['ZohoAccount']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xb9'));db['ZohoConfiguration']=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x94cf('0xba')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xbb'));db[_0x94cf('0xbc')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xbd'));db[_0x94cf('0xbe')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x94cf('0xbf')]=db[_0x94cf('0x1')]['import'](_0x94cf('0xc0'));db[_0x94cf('0xc1')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xc2'));db[_0x94cf('0xc3')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0xc4'));db[_0x94cf('0xc5')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0xc6'));db[_0x94cf('0xc7')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x94cf('0xc8')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xc9'));db[_0x94cf('0xca')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x94cf('0xcb')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x94cf('0xcc')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xcd'));db[_0x94cf('0xce')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xcf'));db[_0x94cf('0xd0')]=db[_0x94cf('0x1')]['import'](_0x94cf('0xd1'));db[_0x94cf('0xd2')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xd3'));db[_0x94cf('0xd4')]=db['sequelize'][_0x94cf('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x94cf('0xd5')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xd6'));db[_0x94cf('0xd7')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0xd8'));db[_0x94cf('0xd9')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xda'));db[_0x94cf('0xdb')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xdc'));db[_0x94cf('0xdd')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0xde'));db[_0x94cf('0xdf')]=db[_0x94cf('0x1')]['import'](_0x94cf('0xe0'));db['JscriptyAnswerReport']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xe1'));db[_0x94cf('0xe2')]=db[_0x94cf('0x1')]['import'](_0x94cf('0xe3'));db[_0x94cf('0xe4')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xe5'));db['SmsQueueReport']=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0x94cf('0x1')]['import'](_0x94cf('0xe6'));db['SquareDetailsReport']=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0x94cf('0xe7')]=db[_0x94cf('0x1')]['import'](_0x94cf('0xe8'));db[_0x94cf('0xe9')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xea'));db['SquareProject']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xeb'));db[_0x94cf('0xec')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xed'));db[_0x94cf('0xee')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xef'));db[_0x94cf('0xf0')]=db['sequelize'][_0x94cf('0x14')](_0x94cf('0xf1'));db[_0x94cf('0xf2')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/license/license.model');db['Campaign']=db['sequelize'][_0x94cf('0x14')](_0x94cf('0xf3'));db[_0x94cf('0xf4')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xf5'));db[_0x94cf('0xf6')]=db[_0x94cf('0x1')]['import'](_0x94cf('0xf7'));db[_0x94cf('0xf8')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xf9'));db['MailTransferReport']=db['sequelize'][_0x94cf('0x14')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xfa'));db[_0x94cf('0xfb')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xfc'));db['OpenchannelTransferReport']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xfd'));db['SmsTransferReport']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xfe'));db['CmList']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0xff'));db[_0x94cf('0x100')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x101'));db[_0x94cf('0x102')]=db['sequelize'][_0x94cf('0x14')]('../api/userProfile/userProfile.model');db[_0x94cf('0x103')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x104'));db[_0x94cf('0x105')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x106'));db['UserNotification']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x107'));db[_0x94cf('0x108')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0x94cf('0x109')]=db[_0x94cf('0x1')][_0x94cf('0x14')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x10a'));db['WhatsappMessage']=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x10b'));db['WhatsappQueueReport']=db[_0x94cf('0x1')]['import'](_0x94cf('0x10c'));db[_0x94cf('0x10d')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x10e'));db[_0x94cf('0x10f')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x110'));db['CloudProvider']=db['sequelize']['import']('../api/cloudProvider/cloudProvider.model');db[_0x94cf('0x111')]=db[_0x94cf('0x1')][_0x94cf('0x14')](_0x94cf('0x112'));db[_0x94cf('0x113')]=db[_0x94cf('0x1')]['import'](_0x94cf('0x114'));db[_0x94cf('0x115')]=db[_0x94cf('0x1')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0x94cf('0x1')]['import']('../api/user-setting/user-setting.model');db[_0x94cf('0x13')]['hasOne'](db[_0x94cf('0x116')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x94cf('0x13')][_0x94cf('0x117')](db[_0x94cf('0x118')],{'as':'userSetting','onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x13')][_0x94cf('0x11b')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x13')][_0x94cf('0x11b')](db['UserVoiceQueueRt'],{'as':_0x94cf('0x11c'),'foreignKey':_0x94cf('0x11a')});db['User'][_0x94cf('0x11b')](db[_0x94cf('0x1a')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x94cf('0x13')][_0x94cf('0x11b')](db[_0x94cf('0x11d')],{'as':_0x94cf('0x11e'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x13')][_0x94cf('0x11b')](db[_0x94cf('0x11f')],{'as':_0x94cf('0x120'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x13')][_0x94cf('0x11b')](db[_0x94cf('0x121')],{'as':_0x94cf('0x121'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x13')][_0x94cf('0x11b')](db[_0x94cf('0x62')],{'as':_0x94cf('0x122'),'foreignKey':'UserId'});db[_0x94cf('0x13')][_0x94cf('0x11b')](db['ChatInteraction'],{'as':_0x94cf('0x123'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x13')][_0x94cf('0x11b')](db[_0x94cf('0x59')],{'as':'SmsInteractions','foreignKey':'UserId'});db['User']['hasMany'](db[_0x94cf('0x51')],{'as':'FaxInteractions','foreignKey':_0x94cf('0x11a')});db['User'][_0x94cf('0x11b')](db[_0x94cf('0x124')],{'as':_0x94cf('0x125'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x13')][_0x94cf('0x11b')](db['WhatsappInteraction'],{'as':_0x94cf('0x126'),'foreignKey':_0x94cf('0x11a')});db['User'][_0x94cf('0x11b')](db[_0x94cf('0x127')],{'as':_0x94cf('0x128'),'foreignKey':'SenderId'});db[_0x94cf('0x13')][_0x94cf('0x129')](db[_0x94cf('0x102')],{'as':'UserProfile','foreignKey':_0x94cf('0x12a')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x74')],{'as':_0x94cf('0x12c'),'through':_0x94cf('0x12d')});db['User']['belongsToMany'](db[_0x94cf('0x12e')],{'as':_0x94cf('0x12f'),'through':_0x94cf('0x130')});db[_0x94cf('0x13')]['belongsToMany'](db[_0x94cf('0x131')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0xf0')],{'through':_0x94cf('0x132')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x124')],{'as':_0x94cf('0x125'),'through':_0x94cf('0x133')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x6d')],{'as':_0x94cf('0x123'),'through':_0x94cf('0x134')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db['FaxInteraction'],{'as':_0x94cf('0x135'),'through':_0x94cf('0x136')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db['SmsInteraction'],{'as':_0x94cf('0x137'),'through':_0x94cf('0x138')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x62')],{'as':_0x94cf('0x122'),'through':'user_has_openchannel_interactions'});db[_0x94cf('0x13')][_0x94cf('0x12b')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x94cf('0x139')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db['VoiceQueue'],{'as':_0x94cf('0x13a'),'through':_0x94cf('0x32'),'required':![]});db[_0x94cf('0x13')][_0x94cf('0x12b')](db['VoicePrefix'],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db['User']['belongsToMany'](db['MailQueue'],{'as':_0x94cf('0x13b'),'through':'UserMailQueue','required':![]});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x73')],{'as':_0x94cf('0x13c'),'through':_0x94cf('0x34'),'required':![],'hooks':!![]});db['User'][_0x94cf('0x12b')](db['FaxQueue'],{'as':_0x94cf('0x13d'),'through':_0x94cf('0x38'),'required':![]});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x5d')],{'as':_0x94cf('0x13e'),'through':'UserSmsQueue','required':![]});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x66')],{'as':_0x94cf('0x13f'),'through':_0x94cf('0x3b'),'required':![]});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x10f')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db['User'][_0x94cf('0x12b')](db[_0x94cf('0x131')],{'through':_0x94cf('0x140')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x67')],{'as':_0x94cf('0x141'),'through':'user_has_chat_websites'});db['User'][_0x94cf('0x12b')](db[_0x94cf('0x142')],{'as':_0x94cf('0x143'),'through':_0x94cf('0x144')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x41')],{'as':_0x94cf('0x145'),'through':_0x94cf('0x146')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x5f')],{'as':_0x94cf('0x147'),'through':_0x94cf('0x148')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x55')],{'as':'SmsAccounts','through':_0x94cf('0x149')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x108')],{'as':_0x94cf('0x14a'),'through':_0x94cf('0x14b')});db[_0x94cf('0x13')][_0x94cf('0x12b')](db[_0x94cf('0x14c')],{'as':_0x94cf('0x14d'),'through':'user_has_square_projects'});db[_0x94cf('0x16')][_0x94cf('0x11b')](db[_0x94cf('0x1a')],{'as':_0x94cf('0x14e'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x14f')});db['VoiceContext']['hasMany'](db['VoiceExtension'],{'onDelete':_0x94cf('0x119')});db[_0x94cf('0x1a')][_0x94cf('0x11b')](db[_0x94cf('0x1a')],{'as':'Applications','onDelete':_0x94cf('0x119')});db[_0x94cf('0x1c')]['belongsToMany'](db[_0x94cf('0x93')],{'as':_0x94cf('0x150'),'through':_0x94cf('0x151')});db[_0x94cf('0x1e')]['hasMany'](db[_0x94cf('0x31')],{'as':_0x94cf('0x152'),'foreignKey':_0x94cf('0x153')});db['VoiceQueue'][_0x94cf('0x11b')](db[_0x94cf('0x154')],{'as':'Hoppers','foreignKey':_0x94cf('0x153')});db[_0x94cf('0x1e')]['hasMany'](db[_0x94cf('0x11d')],{'as':_0x94cf('0x11e'),'foreignKey':_0x94cf('0x153')});db[_0x94cf('0x1e')][_0x94cf('0x11b')](db[_0x94cf('0x11f')],{'as':_0x94cf('0x155'),'foreignKey':_0x94cf('0x153')});db[_0x94cf('0x1e')][_0x94cf('0x11b')](db['ReportAgentPreview'],{'as':_0x94cf('0x121'),'foreignKey':_0x94cf('0x153')});db[_0x94cf('0x1e')][_0x94cf('0x11b')](db[_0x94cf('0x7c')],{'as':_0x94cf('0x156'),'foreignKey':_0x94cf('0x153')});db[_0x94cf('0x1e')][_0x94cf('0x11b')](db[_0x94cf('0xe4')],{'as':_0x94cf('0x157'),'foreignKey':_0x94cf('0x153')});db['VoiceQueue'][_0x94cf('0x129')](db[_0x94cf('0x2d')],{'as':_0x94cf('0x2d'),'foreignKey':'TrunkId'});db[_0x94cf('0x1e')][_0x94cf('0x129')](db['Trunk'],{'as':_0x94cf('0x158'),'foreignKey':_0x94cf('0x159')});db[_0x94cf('0x1e')][_0x94cf('0x129')](db[_0x94cf('0x8b')],{'as':_0x94cf('0x8b'),'foreignKey':_0x94cf('0x15a')});db[_0x94cf('0x1e')][_0x94cf('0x129')](db[_0x94cf('0x8c')],{'as':_0x94cf('0x15b'),'foreignKey':_0x94cf('0x15c')});db['VoiceQueue'][_0x94cf('0x12b')](db[_0x94cf('0x131')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x94cf('0x1e')][_0x94cf('0x12b')](db[_0x94cf('0xf0')],{'as':_0x94cf('0x15d'),'through':_0x94cf('0x111')});db[_0x94cf('0x1e')][_0x94cf('0x12b')](db[_0x94cf('0x131')],{'as':_0x94cf('0x15e'),'through':_0x94cf('0x15f')});db[_0x94cf('0x20')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':_0x94cf('0x13'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x160')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':_0x94cf('0x13'),'foreignKey':_0x94cf('0x11a')});db['VoiceMail'][_0x94cf('0x11b')](db[_0x94cf('0x23')],{'as':'Messages','onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x161'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x94cf('0x129')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x94cf('0x162')});db[_0x94cf('0x25')][_0x94cf('0x11b')](db[_0x94cf('0x163')],{'as':_0x94cf('0x164'),'foreignKey':_0x94cf('0x165'),'constraints':![]});db[_0x94cf('0x25')]['hasMany'](db[_0x94cf('0x166')],{'as':_0x94cf('0x167'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':'User','foreignKey':_0x94cf('0x11a')});db['VoiceCallReport'][_0x94cf('0x129')](db['CmContact'],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x3e')]['belongsTo'](db[_0x94cf('0x41')],{'as':_0x94cf('0x41'),'foreignKey':_0x94cf('0x16a')});db[_0x94cf('0x3e')][_0x94cf('0x129')](db[_0x94cf('0x16b')],{'as':'CloudProvider','foreignKey':_0x94cf('0x16c'),'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x40')]['belongsTo'](db[_0x94cf('0x41')],{'as':_0x94cf('0x41'),'foreignKey':_0x94cf('0x16a')});db[_0x94cf('0x40')]['belongsTo'](db['CloudProvider'],{'as':_0x94cf('0x16b'),'foreignKey':_0x94cf('0x16c'),'onDelete':_0x94cf('0x16d')});db['MailAccount'][_0x94cf('0x117')](db[_0x94cf('0x3e')],{'as':_0x94cf('0x16e'),'onDelete':'cascade'});db[_0x94cf('0x41')][_0x94cf('0x117')](db[_0x94cf('0x40')],{'as':_0x94cf('0x16f'),'onDelete':'cascade'});db[_0x94cf('0x41')]['hasMany'](db[_0x94cf('0x88')],{'as':_0x94cf('0x170'),'foreignKey':_0x94cf('0x16a'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x41')]['hasMany'](db['CannedAnswer'],{'as':_0x94cf('0x171'),'foreignKey':'MailAccountId'});db[_0x94cf('0x41')]['hasMany'](db[_0x94cf('0x47')],{'as':_0x94cf('0x172'),'foreignKey':_0x94cf('0x16a')});db[_0x94cf('0x41')][_0x94cf('0x11b')](db[_0x94cf('0x124')],{'as':_0x94cf('0x173')});db['MailAccount'][_0x94cf('0x11b')](db['MailApplication'],{'as':_0x94cf('0x174')});db[_0x94cf('0x41')][_0x94cf('0x129')](db['CmList'],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176')});db[_0x94cf('0x41')][_0x94cf('0x129')](db[_0x94cf('0x177')],{'as':'Template','foreignKey':'TemplateId'});db[_0x94cf('0x41')][_0x94cf('0x129')](db[_0x94cf('0x8c')],{'as':_0x94cf('0x15b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x94cf('0x41')][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x178'),'through':'user_has_mail_accounts'});db[_0x94cf('0x43')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x94cf('0x36')});db[_0x94cf('0x43')][_0x94cf('0x12b')](db[_0x94cf('0xf0')],{'through':'team_has_mail_queues','as':_0x94cf('0x15d')});db[_0x94cf('0x124')]['hasMany'](db['MailMessage'],{'as':_0x94cf('0x172'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x179')});db['MailInteraction'][_0x94cf('0x129')](db[_0x94cf('0x41')],{'as':'Account','foreignKey':_0x94cf('0x16a')});db[_0x94cf('0x124')][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x124')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':_0x94cf('0x17a'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x124')][_0x94cf('0x12b')](db[_0x94cf('0x95')],{'through':_0x94cf('0x17b'),'as':_0x94cf('0x17c')});db[_0x94cf('0x124')]['belongsToMany'](db[_0x94cf('0x95')],{'through':_0x94cf('0x17b'),'as':_0x94cf('0x17d')});db[_0x94cf('0x124')][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x17e'),'through':_0x94cf('0x133'),'foreignKey':'MailInteractionId'});db[_0x94cf('0x47')]['hasMany'](db[_0x94cf('0xf6')],{'as':_0x94cf('0x17f'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x47')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':_0x94cf('0x13')});db[_0x94cf('0x47')]['belongsTo'](db['CmContact'],{'onDelete':_0x94cf('0x119'),'as':_0x94cf('0x168')});db['MailMessage'][_0x94cf('0x129')](db[_0x94cf('0x124')],{'as':_0x94cf('0x180'),'foreignKey':_0x94cf('0x179')});db[_0x94cf('0x47')][_0x94cf('0x129')](db[_0x94cf('0x41')],{'as':'Account','foreignKey':_0x94cf('0x16a')});db['MailMessage'][_0x94cf('0x129')](db['ChatWebsite'],{'as':_0x94cf('0x67'),'foreignKey':_0x94cf('0x181')});db['MailMessage'][_0x94cf('0x129')](db[_0x94cf('0x71')],{'as':_0x94cf('0x71'),'foreignKey':_0x94cf('0x182')});db[_0x94cf('0x48')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'onDelete':_0x94cf('0x16d')});db['MailApplication'][_0x94cf('0x129')](db[_0x94cf('0x43')],{'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x48')][_0x94cf('0x129')](db[_0x94cf('0x41')],{'onDelete':'restrict'});db[_0x94cf('0x48')]['belongsTo'](db[_0x94cf('0x8b')],{'onDelete':_0x94cf('0x16d'),'foreignKey':'IntervalId'});db[_0x94cf('0x48')]['belongsTo'](db[_0x94cf('0x95')],{'onDelete':_0x94cf('0x16d'),'foreignKey':_0x94cf('0x183')});db['MailQueueReport'][_0x94cf('0x129')](db[_0x94cf('0x41')],{});db[_0x94cf('0x184')]['belongsTo'](db['CmList'],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176')});db[_0x94cf('0x184')][_0x94cf('0x129')](db['CmContact'],{'as':_0x94cf('0x168'),'foreignKey':'ContactId'});db[_0x94cf('0x184')][_0x94cf('0x129')](db[_0x94cf('0x124')],{});db[_0x94cf('0x184')][_0x94cf('0x129')](db[_0x94cf('0x47')],{});db[_0x94cf('0x184')][_0x94cf('0x129')](db[_0x94cf('0x13')],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db[_0x94cf('0x185')][_0x94cf('0x11b')](db[_0x94cf('0x4c')],{'as':_0x94cf('0x186'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x142')][_0x94cf('0x11b')](db['Disposition'],{'as':_0x94cf('0x170'),'foreignKey':_0x94cf('0x187'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x142')][_0x94cf('0x11b')](db[_0x94cf('0x86')],{'as':_0x94cf('0x171'),'foreignKey':'FaxAccountId'});db[_0x94cf('0x142')]['hasMany'](db[_0x94cf('0x51')],{'as':'Interactions'});db['FaxAccount'][_0x94cf('0x11b')](db[_0x94cf('0x4f')],{'as':_0x94cf('0x174')});db['FaxAccount']['hasMany'](db[_0x94cf('0x1a')],{'as':_0x94cf('0x188'),'onDelete':_0x94cf('0x119')});db['FaxAccount'][_0x94cf('0x11b')](db[_0x94cf('0x189')],{'as':'Messages'});db[_0x94cf('0x142')][_0x94cf('0x129')](db['Trunk'],{'as':_0x94cf('0x2d')});db[_0x94cf('0x142')][_0x94cf('0x129')](db['CmList'],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176')});db[_0x94cf('0x142')][_0x94cf('0x129')](db['Pause'],{'as':_0x94cf('0x15b'),'foreignKey':_0x94cf('0x15c')});db['FaxAccount']['belongsToMany'](db[_0x94cf('0x13')],{'as':_0x94cf('0x178'),'through':_0x94cf('0x144')});db[_0x94cf('0x4f')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'onDelete':_0x94cf('0x16d')});db['FaxApplication']['belongsTo'](db[_0x94cf('0x53')],{'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x4f')]['belongsTo'](db[_0x94cf('0x142')],{'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x4f')][_0x94cf('0x129')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x94cf('0x183')});db[_0x94cf('0x51')]['hasMany'](db[_0x94cf('0x189')],{'as':_0x94cf('0x172'),'onDelete':'cascade','foreignKey':_0x94cf('0x18a')});db[_0x94cf('0x51')][_0x94cf('0x129')](db[_0x94cf('0x142')],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x187')});db[_0x94cf('0x51')]['belongsTo'](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169')});db['FaxInteraction'][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':_0x94cf('0x17a'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x51')]['belongsToMany'](db[_0x94cf('0x95')],{'through':_0x94cf('0x18c'),'as':_0x94cf('0x17c')});db[_0x94cf('0x51')][_0x94cf('0x12b')](db['Tag'],{'through':_0x94cf('0x18c'),'as':'ThroughTags'});db[_0x94cf('0x51')]['belongsToMany'](db[_0x94cf('0x13')],{'as':_0x94cf('0x17e'),'through':_0x94cf('0x136'),'foreignKey':_0x94cf('0x18a')});db[_0x94cf('0x189')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'onDelete':_0x94cf('0x119'),'as':_0x94cf('0x13')});db['FaxMessage'][_0x94cf('0x129')](db[_0x94cf('0x51')],{'as':_0x94cf('0x180'),'foreignKey':_0x94cf('0x18a')});db[_0x94cf('0x189')][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'onDelete':_0x94cf('0x119'),'as':_0x94cf('0x168')});db[_0x94cf('0x189')][_0x94cf('0x129')](db[_0x94cf('0xf6')],{'as':_0x94cf('0xf6'),'foreignKey':_0x94cf('0x18d')});db[_0x94cf('0x189')]['belongsTo'](db['FaxAccount'],{'as':_0x94cf('0x18b'),'foreignKey':'FaxAccountId'});db[_0x94cf('0x53')]['belongsToMany'](db[_0x94cf('0x13')],{'as':'Agents','through':'UserFaxQueue'});db[_0x94cf('0x53')][_0x94cf('0x12b')](db[_0x94cf('0xf0')],{'through':_0x94cf('0x18e'),'as':'Teams'});db[_0x94cf('0x18f')]['belongsTo'](db[_0x94cf('0x142')],{});db['FaxQueueReport'][_0x94cf('0x129')](db[_0x94cf('0x131')],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176')});db['FaxQueueReport'][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x18f')][_0x94cf('0x129')](db['FaxInteraction'],{});db[_0x94cf('0x18f')][_0x94cf('0x129')](db[_0x94cf('0x189')],{});db[_0x94cf('0x18f')][_0x94cf('0x129')](db[_0x94cf('0x13')],{});db['FaxQueueReport'][_0x94cf('0x129')](db[_0x94cf('0x53')],{});db['SmsAccount'][_0x94cf('0x11b')](db[_0x94cf('0x88')],{'as':'Dispositions','foreignKey':_0x94cf('0x190'),'onDelete':_0x94cf('0x119')});db['SmsAccount'][_0x94cf('0x11b')](db[_0x94cf('0x86')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x94cf('0x55')]['hasMany'](db['SmsMessage'],{'as':_0x94cf('0x172'),'foreignKey':_0x94cf('0x190')});db['SmsAccount'][_0x94cf('0x11b')](db['SmsInteraction'],{'as':'Interactions'});db['SmsAccount']['hasMany'](db['SmsApplication'],{'as':_0x94cf('0x174')});db[_0x94cf('0x55')][_0x94cf('0x129')](db[_0x94cf('0x131')],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176')});db[_0x94cf('0x55')][_0x94cf('0x129')](db['Pause'],{'as':_0x94cf('0x15b'),'foreignKey':_0x94cf('0x15c')});db[_0x94cf('0x55')][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x178'),'through':_0x94cf('0x149')});db[_0x94cf('0x57')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'onDelete':'restrict'});db[_0x94cf('0x57')][_0x94cf('0x129')](db['SmsQueue'],{'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x57')][_0x94cf('0x129')](db[_0x94cf('0x55')],{'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x57')][_0x94cf('0x129')](db[_0x94cf('0x8b')],{'onDelete':_0x94cf('0x16d'),'foreignKey':_0x94cf('0x15a')});db[_0x94cf('0x57')]['belongsTo'](db[_0x94cf('0x95')],{'onDelete':_0x94cf('0x16d'),'foreignKey':'TagId'});db[_0x94cf('0x59')]['hasMany'](db[_0x94cf('0x5b')],{'as':_0x94cf('0x172'),'onDelete':_0x94cf('0x119'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x94cf('0x129')](db['SmsAccount'],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x190')});db['SmsInteraction'][_0x94cf('0x129')](db['CmContact'],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x59')][_0x94cf('0x129')](db['User'],{'as':_0x94cf('0x17a'),'foreignKey':_0x94cf('0x11a')});db['SmsInteraction'][_0x94cf('0x12b')](db[_0x94cf('0x95')],{'through':_0x94cf('0x191'),'as':_0x94cf('0x17c')});db[_0x94cf('0x59')][_0x94cf('0x12b')](db[_0x94cf('0x95')],{'through':_0x94cf('0x191'),'as':'ThroughTags'});db[_0x94cf('0x59')][_0x94cf('0x12b')](db['User'],{'as':_0x94cf('0x17e'),'through':_0x94cf('0x138'),'foreignKey':_0x94cf('0x192')});db[_0x94cf('0x5b')][_0x94cf('0x129')](db['User'],{'as':_0x94cf('0x13')});db[_0x94cf('0x5b')][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'onDelete':_0x94cf('0x119'),'as':'Contact'});db[_0x94cf('0x5b')][_0x94cf('0x129')](db['SmsInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x94cf('0x192')});db['SmsMessage'][_0x94cf('0x129')](db[_0x94cf('0x55')],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x190')});db[_0x94cf('0x5d')][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x178'),'through':_0x94cf('0x39'),'foreignKey':_0x94cf('0x193')});db[_0x94cf('0x5d')][_0x94cf('0x12b')](db[_0x94cf('0xf0')],{'through':_0x94cf('0x194'),'as':_0x94cf('0x15d')});db[_0x94cf('0x5f')][_0x94cf('0x11b')](db[_0x94cf('0x88')],{'as':_0x94cf('0x170'),'foreignKey':_0x94cf('0x195'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x5f')]['hasMany'](db[_0x94cf('0x86')],{'as':_0x94cf('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x94cf('0x5f')][_0x94cf('0x11b')](db[_0x94cf('0x62')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0x94cf('0x5f')][_0x94cf('0x11b')](db['OpenchannelMessage'],{'as':_0x94cf('0x172'),'foreignKey':_0x94cf('0x195')});db[_0x94cf('0x5f')]['hasMany'](db[_0x94cf('0x61')],{'as':_0x94cf('0x174'),'foreignKey':_0x94cf('0x195')});db['OpenchannelAccount'][_0x94cf('0x129')](db[_0x94cf('0x131')],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176')});db[_0x94cf('0x5f')][_0x94cf('0x129')](db[_0x94cf('0x8c')],{'as':_0x94cf('0x15b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x94cf('0x5f')][_0x94cf('0x12b')](db['User'],{'as':_0x94cf('0x178'),'through':_0x94cf('0x148')});db[_0x94cf('0x61')]['belongsTo'](db[_0x94cf('0x13')],{'onDelete':_0x94cf('0x16d')});db['OpenchannelApplication'][_0x94cf('0x129')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x94cf('0x129')](db[_0x94cf('0x5f')],{'onDelete':_0x94cf('0x16d'),'foreignKey':_0x94cf('0x195')});db[_0x94cf('0x61')][_0x94cf('0x129')](db[_0x94cf('0x8b')],{'onDelete':_0x94cf('0x16d'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x94cf('0x129')](db[_0x94cf('0x95')],{'onDelete':_0x94cf('0x16d'),'foreignKey':_0x94cf('0x183')});db[_0x94cf('0x62')]['hasMany'](db['OpenchannelMessage'],{'as':_0x94cf('0x172'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction']['belongsTo'](db[_0x94cf('0x5f')],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x195')});db[_0x94cf('0x62')][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169')});db['OpenchannelInteraction'][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':_0x94cf('0x17a'),'foreignKey':'UserId'});db['OpenchannelInteraction']['belongsToMany'](db[_0x94cf('0x95')],{'through':_0x94cf('0x196'),'as':_0x94cf('0x17c')});db[_0x94cf('0x62')][_0x94cf('0x12b')](db[_0x94cf('0x95')],{'through':_0x94cf('0x196'),'as':'ThroughTags'});db[_0x94cf('0x62')][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x17e'),'through':_0x94cf('0x197'),'foreignKey':_0x94cf('0x198')});db[_0x94cf('0x64')][_0x94cf('0x129')](db['User'],{'onDelete':_0x94cf('0x119'),'as':'User'});db[_0x94cf('0x64')][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'onDelete':_0x94cf('0x119'),'as':'Contact'});db[_0x94cf('0x64')]['belongsTo'](db[_0x94cf('0x62')],{'onDelete':_0x94cf('0x119'),'as':_0x94cf('0x180'),'foreignKey':_0x94cf('0x198')});db[_0x94cf('0x64')][_0x94cf('0x129')](db['Attachment'],{'as':_0x94cf('0xf6'),'foreignKey':_0x94cf('0x18d')});db[_0x94cf('0x64')][_0x94cf('0x129')](db[_0x94cf('0x5f')],{'as':'Account','foreignKey':_0x94cf('0x195')});db['OpenchannelQueue'][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x178'),'through':_0x94cf('0x3b'),'foreignKey':_0x94cf('0x199')});db[_0x94cf('0x66')][_0x94cf('0x12b')](db[_0x94cf('0xf0')],{'through':_0x94cf('0x19a'),'as':_0x94cf('0x15d')});db[_0x94cf('0x67')][_0x94cf('0x11b')](db[_0x94cf('0x88')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0x94cf('0x119')});db[_0x94cf('0x67')][_0x94cf('0x11b')](db[_0x94cf('0x86')],{'as':_0x94cf('0x171'),'foreignKey':_0x94cf('0x181')});db[_0x94cf('0x67')][_0x94cf('0x11b')](db['ChatProactiveAction'],{'as':_0x94cf('0x19b')});db[_0x94cf('0x67')][_0x94cf('0x11b')](db[_0x94cf('0x6d')],{'as':'Interactions'});db[_0x94cf('0x67')]['hasMany'](db['ChatApplication'],{'as':'Applications'});db['ChatWebsite'][_0x94cf('0x11b')](db[_0x94cf('0x6f')],{'as':_0x94cf('0x172')});db['ChatWebsite'][_0x94cf('0x129')](db[_0x94cf('0x131')],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176')});db['ChatWebsite'][_0x94cf('0x129')](db['Interval'],{'as':_0x94cf('0x8b'),'foreignKey':_0x94cf('0x15a')});db['ChatWebsite'][_0x94cf('0x129')](db[_0x94cf('0x41')],{'as':_0x94cf('0x41'),'foreignKey':_0x94cf('0x16a')});db[_0x94cf('0x67')]['belongsTo'](db[_0x94cf('0x8c')],{'as':_0x94cf('0x15b'),'foreignKey':_0x94cf('0x15c')});db[_0x94cf('0x67')]['belongsToMany'](db[_0x94cf('0x13')],{'as':_0x94cf('0x178'),'through':_0x94cf('0x19c')});db[_0x94cf('0x69')][_0x94cf('0x129')](db[_0x94cf('0x5f')],{});db[_0x94cf('0x69')][_0x94cf('0x129')](db[_0x94cf('0x131')],{'as':_0x94cf('0x175'),'foreignKey':'ListId'});db[_0x94cf('0x69')]['belongsTo'](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x69')][_0x94cf('0x129')](db[_0x94cf('0x62')],{});db[_0x94cf('0x69')][_0x94cf('0x129')](db[_0x94cf('0x64')],{});db[_0x94cf('0x69')][_0x94cf('0x129')](db[_0x94cf('0x13')],{});db[_0x94cf('0x69')][_0x94cf('0x129')](db[_0x94cf('0x66')],{});db['ChatApplication']['belongsTo'](db[_0x94cf('0x13')],{'as':'Agent','foreignKey':_0x94cf('0x11a'),'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x6b')]['belongsTo'](db['ChatQueue'],{'as':_0x94cf('0x19d'),'foreignKey':_0x94cf('0x19e'),'onDelete':'restrict'});db[_0x94cf('0x6b')]['belongsTo'](db['ChatWebsite'],{'as':_0x94cf('0x19f'),'foreignKey':_0x94cf('0x181'),'onDelete':'restrict'});db[_0x94cf('0x6b')]['belongsTo'](db[_0x94cf('0x95')],{'onDelete':'restrict','foreignKey':_0x94cf('0x183')});db[_0x94cf('0x6d')][_0x94cf('0x11b')](db[_0x94cf('0x6f')],{'as':_0x94cf('0x172'),'onDelete':'cascade','foreignKey':_0x94cf('0x1a0')});db[_0x94cf('0x6d')][_0x94cf('0x129')](db[_0x94cf('0x67')],{'as':'Account','foreignKey':_0x94cf('0x181')});db[_0x94cf('0x6d')][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':'ContactId'});db[_0x94cf('0x6d')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':_0x94cf('0x17a'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x6d')][_0x94cf('0x12b')](db[_0x94cf('0x95')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0x94cf('0x6d')]['belongsToMany'](db[_0x94cf('0x95')],{'through':_0x94cf('0x1a1'),'as':_0x94cf('0x17d')});db[_0x94cf('0x6d')]['belongsToMany'](db[_0x94cf('0x13')],{'as':_0x94cf('0x17e'),'through':_0x94cf('0x134'),'foreignKey':_0x94cf('0x1a0')});db['ChatMessage'][_0x94cf('0x129')](db[_0x94cf('0x13')],{'onDelete':_0x94cf('0x119'),'as':_0x94cf('0x13')});db[_0x94cf('0x6f')][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'onDelete':_0x94cf('0x119'),'as':'Contact','foreignKey':'ContactId'});db[_0x94cf('0x6f')][_0x94cf('0x129')](db[_0x94cf('0x6d')],{'onDelete':'cascade','as':_0x94cf('0x180'),'foreignKey':_0x94cf('0x1a0')});db[_0x94cf('0x6f')][_0x94cf('0x129')](db[_0x94cf('0xf6')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x94cf('0x6f')][_0x94cf('0x129')](db[_0x94cf('0x67')],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x181')});db[_0x94cf('0x71')][_0x94cf('0x11b')](db['Attachment'],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x94cf('0x119'),'hooks':!![]});db['ChatOfflineMessage'][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'onDelete':'cascade','as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169')});db['ChatOfflineMessage'][_0x94cf('0x129')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x178'),'through':'UserChatQueue','hooks':!![]});db[_0x94cf('0x73')][_0x94cf('0x12b')](db[_0x94cf('0xf0')],{'through':'team_has_chat_queues','as':'Teams'});db['ChatGroup'][_0x94cf('0x11b')](db[_0x94cf('0xdf')],{'as':_0x94cf('0x172'),'foreignKey':_0x94cf('0x1a2'),'onDelete':'cascade'});db[_0x94cf('0x74')][_0x94cf('0x12b')](db['User'],{'as':_0x94cf('0x152'),'through':_0x94cf('0x12d')});db[_0x94cf('0x76')][_0x94cf('0x129')](db[_0x94cf('0x67')],{'as':_0x94cf('0x19f'),'foreignKey':_0x94cf('0x181')});db[_0x94cf('0x78')][_0x94cf('0x11b')](db[_0x94cf('0x12e')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x94cf('0x12e')][_0x94cf('0x11b')](db[_0x94cf('0x1a3')],{'as':'Phones','foreignKey':'CmContactId'});db[_0x94cf('0x12e')][_0x94cf('0x11b')](db[_0x94cf('0x154')],{'as':_0x94cf('0x1a4'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x12e')][_0x94cf('0x11b')](db[_0x94cf('0x11d')],{'as':_0x94cf('0x11e'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x12e')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x94cf('0x169')});db[_0x94cf('0x12e')]['hasMany'](db[_0x94cf('0x121')],{'as':_0x94cf('0x121'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x12e')][_0x94cf('0x11b')](db['JscriptySessionReport'],{'as':_0x94cf('0x157'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x12e')][_0x94cf('0x11b')](db[_0x94cf('0x62')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x94cf('0x12e')][_0x94cf('0x11b')](db[_0x94cf('0x6d')],{'as':_0x94cf('0x123'),'foreignKey':'ContactId','onDelete':_0x94cf('0x16d')});db[_0x94cf('0x12e')]['hasMany'](db[_0x94cf('0x59')],{'as':_0x94cf('0x137'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x94cf('0x12e')][_0x94cf('0x11b')](db[_0x94cf('0x51')],{'as':_0x94cf('0x135'),'foreignKey':_0x94cf('0x169'),'onDelete':_0x94cf('0x16d')});db['CmContact'][_0x94cf('0x11b')](db['MailInteraction'],{'as':_0x94cf('0x125'),'foreignKey':_0x94cf('0x169'),'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x12e')][_0x94cf('0x129')](db[_0x94cf('0x78')],{'as':_0x94cf('0x1a5'),'foreignKey':_0x94cf('0x1a6')});db['CmContact'][_0x94cf('0x129')](db[_0x94cf('0x131')],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176'),'onDelete':'cascade'});db['CmContact'][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x17e'),'through':_0x94cf('0x130')});db[_0x94cf('0x12e')][_0x94cf('0x12b')](db[_0x94cf('0x95')],{'as':_0x94cf('0x17c'),'through':_0x94cf('0x1a7')});db['CmContact']['belongsToMany'](db[_0x94cf('0x95')],{'through':_0x94cf('0x1a7'),'as':_0x94cf('0x17d')});db[_0x94cf('0x154')][_0x94cf('0x11b')](db[_0x94cf('0x99')],{'as':'AdditionalPhones','foreignKey':_0x94cf('0x1a8')});db['CmHopper']['belongsTo'](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169'),'onDelete':'cascade'});db[_0x94cf('0x154')][_0x94cf('0x129')](db['CmList'],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176'),'onDelete':'cascade'});db[_0x94cf('0x154')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':_0x94cf('0x1a9'),'foreignKey':'UserId'});db[_0x94cf('0x154')][_0x94cf('0x129')](db[_0x94cf('0x1e')],{'as':_0x94cf('0x19d'),'foreignKey':_0x94cf('0x153'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x154')]['belongsTo'](db[_0x94cf('0x1aa')],{'as':'Campaign','foreignKey':_0x94cf('0x1ab'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x154')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':_0x94cf('0x17a'),'foreignKey':_0x94cf('0x1ac')});db[_0x94cf('0x7c')][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x7c')]['belongsTo'](db[_0x94cf('0x131')],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176'),'onDelete':'cascade'});db['CmHopperBlack'][_0x94cf('0x129')](db['VoiceQueue'],{'as':_0x94cf('0x19d'),'foreignKey':_0x94cf('0x153'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x7c')][_0x94cf('0x129')](db[_0x94cf('0x1aa')],{'as':_0x94cf('0x1aa'),'foreignKey':_0x94cf('0x1ab'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x1ad')][_0x94cf('0x11b')](db[_0x94cf('0x1ae')],{'as':{'plural':'All','singular':_0x94cf('0x1af')},'foreignKey':'AutomationAllId','onDelete':_0x94cf('0x119'),'hooks':!![]});db[_0x94cf('0x1ad')][_0x94cf('0x11b')](db[_0x94cf('0x1ae')],{'as':{'plural':_0x94cf('0x1b0'),'singular':'OneAny'},'foreignKey':_0x94cf('0x1b1'),'onDelete':_0x94cf('0x119'),'hooks':!![]});db[_0x94cf('0x1ad')][_0x94cf('0x11b')](db[_0x94cf('0x83')],{'as':'Actions','foreignKey':_0x94cf('0x1b2'),'onDelete':_0x94cf('0x119'),'hooks':!![]});db['Disposition'][_0x94cf('0x11b')](db[_0x94cf('0x88')],{'as':'Dispositions','foreignKey':_0x94cf('0x1b3'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x8b')][_0x94cf('0x11b')](db['Interval'],{'as':_0x94cf('0x1b4'),'foreignKey':_0x94cf('0x15a'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x94cf('0x11b')](db[_0x94cf('0x1a')],{'as':_0x94cf('0x1b5'),'foreignKey':_0x94cf('0x15a'),'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x8b')][_0x94cf('0x11b')](db[_0x94cf('0x48')],{'as':'MailApplications','foreignKey':_0x94cf('0x15a')});db[_0x94cf('0x8b')][_0x94cf('0x11b')](db[_0x94cf('0x6b')],{'as':_0x94cf('0x1b6'),'foreignKey':'IntervalId'});db[_0x94cf('0x8b')][_0x94cf('0x11b')](db[_0x94cf('0x4f')],{'as':_0x94cf('0x1b7'),'foreignKey':_0x94cf('0x15a')});db['Interval'][_0x94cf('0x11b')](db[_0x94cf('0x57')],{'as':_0x94cf('0x1b8'),'foreignKey':_0x94cf('0x15a')});db[_0x94cf('0x92')][_0x94cf('0x129')](db[_0x94cf('0x41')],{});db['Schedule'][_0x94cf('0x129')](db[_0x94cf('0xa3')],{'foreignKey':_0x94cf('0x1b9')});db['Schedule'][_0x94cf('0x129')](db[_0x94cf('0xa2')],{'foreignKey':'CustomReportId'});db['Sound'][_0x94cf('0x12b')](db[_0x94cf('0x1c')],{'as':_0x94cf('0x1ba'),'through':_0x94cf('0x151'),'onDelete':_0x94cf('0x16d')});db['Tag'][_0x94cf('0x12b')](db[_0x94cf('0x12e')],{'through':_0x94cf('0x1a7')});db['Tag'][_0x94cf('0x12b')](db[_0x94cf('0x6d')],{'through':_0x94cf('0x1a1')});db[_0x94cf('0x95')][_0x94cf('0x12b')](db[_0x94cf('0x124')],{'through':_0x94cf('0x17b')});db[_0x94cf('0x95')][_0x94cf('0x12b')](db[_0x94cf('0x59')],{'through':_0x94cf('0x191')});db[_0x94cf('0x95')][_0x94cf('0x12b')](db['FaxInteraction'],{'through':_0x94cf('0x18c')});db['Tag'][_0x94cf('0x12b')](db[_0x94cf('0x62')],{'through':'openchannel_interaction_has_tags'});db[_0x94cf('0x95')][_0x94cf('0x12b')](db[_0x94cf('0x1bb')],{'through':'whatsapp_interaction_has_tags'});db[_0x94cf('0x1a3')][_0x94cf('0x129')](db[_0x94cf('0x97')],{'as':_0x94cf('0x1bc'),'foreignKey':'ItemTypeId'});db[_0x94cf('0x99')][_0x94cf('0x129')](db[_0x94cf('0x154')],{'as':_0x94cf('0x1bd'),'foreignKey':_0x94cf('0x1a8')});db[_0x94cf('0x1a3')]['belongsTo'](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x1be')});db[_0x94cf('0x1bf')][_0x94cf('0x11b')](db[_0x94cf('0x1ae')],{'as':{'plural':_0x94cf('0x1c0'),'singular':_0x94cf('0x1c1')},'foreignKey':_0x94cf('0x1c2'),'onDelete':_0x94cf('0x119'),'hooks':!![]});db[_0x94cf('0x1bf')]['hasMany'](db[_0x94cf('0x1ae')],{'as':{'plural':_0x94cf('0x1c3'),'singular':_0x94cf('0x1c4')},'foreignKey':_0x94cf('0x1c5'),'onDelete':_0x94cf('0x119'),'hooks':!![]});db[_0x94cf('0x1bf')][_0x94cf('0x11b')](db[_0x94cf('0x83')],{'as':_0x94cf('0x1c6'),'foreignKey':_0x94cf('0x1c7'),'onDelete':_0x94cf('0x119'),'hooks':!![]});db['AnalyticCustomReport'][_0x94cf('0x11b')](db[_0x94cf('0x1c8')],{'as':_0x94cf('0x1c9'),'onDelete':'cascade','foreignKey':_0x94cf('0x1ca'),'hooks':!![]});db['AnalyticDefaultReport'][_0x94cf('0x11b')](db['AnalyticFieldReport'],{'as':_0x94cf('0x1c9'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1b9')});db[_0x94cf('0xa7')][_0x94cf('0x11b')](db[_0x94cf('0x1c8')],{'as':_0x94cf('0x1c9'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cb')});db[_0x94cf('0x1c8')][_0x94cf('0x129')](db[_0x94cf('0xa7')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x94cf('0x11b')](db[_0x94cf('0xae')],{'as':_0x94cf('0x1cc'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cd')});db['SalesforceConfiguration'][_0x94cf('0x11b')](db[_0x94cf('0xb0')],{'as':_0x94cf('0x1ce'),'onDelete':_0x94cf('0x119'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x94cf('0x11b')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xae')][_0x94cf('0x11b')](db[_0x94cf('0xb0')],{'as':_0x94cf('0x1c9'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1d0')});db[_0x94cf('0xae')]['belongsTo'](db[_0x94cf('0xac')],{'as':'Account','foreignKey':'AccountId'});db[_0x94cf('0xb0')][_0x94cf('0x11b')](db[_0x94cf('0xb0')],{'as':_0x94cf('0x1d1'),'foreignKey':_0x94cf('0x1d2')});db[_0x94cf('0xb0')][_0x94cf('0x11b')](db[_0x94cf('0xb0')],{'as':_0x94cf('0x1d3'),'foreignKey':_0x94cf('0x1cf')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x94cf('0x1d4'),'foreignKey':'FieldId'});db[_0x94cf('0xb0')][_0x94cf('0x129')](db[_0x94cf('0x9d')],{'as':_0x94cf('0x9d'),'foreignKey':'VariableId'});db[_0x94cf('0xb2')][_0x94cf('0x11b')](db[_0x94cf('0xb4')],{'as':_0x94cf('0x1cc'),'onDelete':_0x94cf('0x119'),'foreignKey':'AccountId'});db[_0x94cf('0xb4')][_0x94cf('0x11b')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x94cf('0x119'),'foreignKey':'SubjectId'});db[_0x94cf('0xb4')][_0x94cf('0x11b')](db[_0x94cf('0x1d5')],{'as':_0x94cf('0x1d6'),'onDelete':'cascade','foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xb4')][_0x94cf('0x11b')](db[_0x94cf('0x1d5')],{'as':_0x94cf('0x1c9'),'onDelete':_0x94cf('0x119'),'foreignKey':'FieldId'});db[_0x94cf('0xb4')][_0x94cf('0x129')](db[_0x94cf('0xb2')],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0x1d5')][_0x94cf('0x11b')](db[_0x94cf('0x1d5')],{'as':_0x94cf('0x1d1'),'foreignKey':_0x94cf('0x1d2')});db['SugarcrmField'][_0x94cf('0x11b')](db['SugarcrmField'],{'as':_0x94cf('0x1d3'),'foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0x1d5')][_0x94cf('0x11b')](db['SugarcrmField'],{'as':'Field','foreignKey':_0x94cf('0x1d0')});db[_0x94cf('0x1d5')][_0x94cf('0x129')](db[_0x94cf('0x9d')],{'as':_0x94cf('0x9d'),'foreignKey':_0x94cf('0x1d7')});db[_0x94cf('0x1d8')]['hasMany'](db['DeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xb6')][_0x94cf('0x11b')](db[_0x94cf('0x1d9')],{'as':'Subjects','onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1d2')});db[_0x94cf('0xb6')][_0x94cf('0x11b')](db[_0x94cf('0x1d9')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xb6')][_0x94cf('0x11b')](db[_0x94cf('0x1d9')],{'as':'Fields','onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1d0')});db['DeskConfiguration'][_0x94cf('0x129')](db[_0x94cf('0x1d8')],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x1cd')});db['DeskConfiguration']['belongsToMany'](db[_0x94cf('0x95')],{'through':_0x94cf('0x1da')});db[_0x94cf('0x1d9')][_0x94cf('0x11b')](db[_0x94cf('0x1d9')],{'as':_0x94cf('0x1d1'),'foreignKey':_0x94cf('0x1d2')});db['DeskField'][_0x94cf('0x11b')](db[_0x94cf('0x1d9')],{'as':_0x94cf('0x1d3'),'foreignKey':'DescriptionId'});db[_0x94cf('0x1d9')][_0x94cf('0x11b')](db[_0x94cf('0x1d9')],{'as':_0x94cf('0x1d4'),'foreignKey':_0x94cf('0x1d0')});db[_0x94cf('0x1d9')][_0x94cf('0x129')](db[_0x94cf('0x9d')],{'as':'Variable','foreignKey':'VariableId'});db['ZohoAccount'][_0x94cf('0x11b')](db['ZohoConfiguration'],{'as':_0x94cf('0x1cc'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0x1db')]['hasMany'](db[_0x94cf('0xba')],{'as':_0x94cf('0x1ce'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1d2')});db[_0x94cf('0x1db')]['hasMany'](db['ZohoField'],{'as':'Descriptions','onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0x1db')]['hasMany'](db['ZohoField'],{'as':_0x94cf('0x1c9'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1d0')});db[_0x94cf('0x1db')]['belongsTo'](db[_0x94cf('0x1dc')],{'as':'Account','foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xba')][_0x94cf('0x11b')](db[_0x94cf('0xba')],{'as':_0x94cf('0x1d1'),'foreignKey':_0x94cf('0x1d2')});db[_0x94cf('0xba')][_0x94cf('0x11b')](db[_0x94cf('0xba')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x94cf('0xba')][_0x94cf('0x11b')](db[_0x94cf('0xba')],{'as':_0x94cf('0x1d4'),'foreignKey':'FieldId'});db['ZohoField'][_0x94cf('0x129')](db['Variable'],{'as':_0x94cf('0x9d'),'foreignKey':_0x94cf('0x1d7')});db[_0x94cf('0xbc')][_0x94cf('0x11b')](db[_0x94cf('0xbe')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xbe')][_0x94cf('0x11b')](db[_0x94cf('0xbf')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x94cf('0xbe')][_0x94cf('0x11b')](db[_0x94cf('0xbf')],{'as':_0x94cf('0x1d6'),'foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xbe')][_0x94cf('0x11b')](db[_0x94cf('0xbf')],{'as':'Fields','foreignKey':'FieldId'});db[_0x94cf('0xbe')][_0x94cf('0x129')](db[_0x94cf('0xbc')],{'as':_0x94cf('0x18b'),'foreignKey':'AccountId'});db[_0x94cf('0xbe')][_0x94cf('0x12b')](db[_0x94cf('0x95')],{'through':_0x94cf('0x1dd')});db[_0x94cf('0xbf')][_0x94cf('0x11b')](db[_0x94cf('0xbf')],{'as':_0x94cf('0x1d1'),'foreignKey':_0x94cf('0x1d2')});db['ZendeskField'][_0x94cf('0x11b')](db[_0x94cf('0xbf')],{'as':_0x94cf('0x1d3'),'foreignKey':_0x94cf('0x1cf')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0x94cf('0x1d4'),'foreignKey':_0x94cf('0x1d0')});db['ZendeskField'][_0x94cf('0x129')](db[_0x94cf('0x9d')],{'as':_0x94cf('0x9d'),'foreignKey':_0x94cf('0x1d7')});db[_0x94cf('0xc1')][_0x94cf('0x11b')](db[_0x94cf('0xc3')],{'as':_0x94cf('0x1cc'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xc3')][_0x94cf('0x11b')](db[_0x94cf('0xc5')],{'as':_0x94cf('0x1ce'),'onDelete':_0x94cf('0x119'),'foreignKey':'SubjectId'});db[_0x94cf('0xc3')][_0x94cf('0x11b')](db[_0x94cf('0xc5')],{'as':_0x94cf('0x1d6'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xc3')][_0x94cf('0x11b')](db['FreshdeskField'],{'as':_0x94cf('0x1c9'),'onDelete':_0x94cf('0x119'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0x94cf('0x129')](db[_0x94cf('0xc1')],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xc3')]['belongsToMany'](db[_0x94cf('0x95')],{'through':_0x94cf('0x1de')});db[_0x94cf('0xc5')][_0x94cf('0x11b')](db[_0x94cf('0xc5')],{'as':_0x94cf('0x1d1'),'foreignKey':_0x94cf('0x1d2')});db['FreshdeskField']['hasMany'](db[_0x94cf('0xc5')],{'as':_0x94cf('0x1d3'),'foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xc5')][_0x94cf('0x11b')](db[_0x94cf('0xc5')],{'as':_0x94cf('0x1d4'),'foreignKey':_0x94cf('0x1d0')});db[_0x94cf('0xc5')]['belongsTo'](db['Variable'],{'as':_0x94cf('0x9d'),'foreignKey':'VariableId'});db[_0x94cf('0xc7')][_0x94cf('0x11b')](db[_0x94cf('0xc8')],{'as':_0x94cf('0x1cc'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xc8')][_0x94cf('0x11b')](db[_0x94cf('0xca')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x94cf('0xc8')]['hasMany'](db['VtigerField'],{'as':_0x94cf('0x1d6'),'foreignKey':'DescriptionId'});db[_0x94cf('0xc8')]['hasMany'](db[_0x94cf('0xca')],{'as':_0x94cf('0x1c9'),'foreignKey':_0x94cf('0x1d0')});db[_0x94cf('0xc8')][_0x94cf('0x129')](db[_0x94cf('0xc7')],{'as':'Account','foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xca')][_0x94cf('0x11b')](db[_0x94cf('0xca')],{'as':_0x94cf('0x1d1'),'foreignKey':_0x94cf('0x1d2')});db['VtigerField'][_0x94cf('0x11b')](db[_0x94cf('0xca')],{'as':_0x94cf('0x1d3'),'foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xca')][_0x94cf('0x11b')](db['VtigerField'],{'as':_0x94cf('0x1d4'),'foreignKey':'FieldId'});db[_0x94cf('0xca')]['belongsTo'](db[_0x94cf('0x9d')],{'as':'Variable','foreignKey':_0x94cf('0x1d7')});db[_0x94cf('0xcb')][_0x94cf('0x11b')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xcc')]['hasMany'](db[_0x94cf('0xce')],{'as':_0x94cf('0x1ce'),'foreignKey':_0x94cf('0x1d2')});db[_0x94cf('0xcc')][_0x94cf('0x11b')](db[_0x94cf('0xce')],{'as':_0x94cf('0x1d6'),'foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xcc')]['hasMany'](db[_0x94cf('0xce')],{'as':'Fields','foreignKey':_0x94cf('0x1d0')});db['ServicenowConfiguration'][_0x94cf('0x129')](db[_0x94cf('0xcb')],{'as':'Account','foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xce')][_0x94cf('0x11b')](db[_0x94cf('0xce')],{'as':_0x94cf('0x1d1'),'foreignKey':_0x94cf('0x1d2')});db[_0x94cf('0xce')][_0x94cf('0x11b')](db[_0x94cf('0xce')],{'as':_0x94cf('0x1d3'),'foreignKey':_0x94cf('0x1cf')});db['ServicenowField'][_0x94cf('0x11b')](db['ServicenowField'],{'as':'Field','foreignKey':_0x94cf('0x1d0')});db['ServicenowField'][_0x94cf('0x129')](db[_0x94cf('0x9d')],{'as':'Variable','foreignKey':'VariableId'});db[_0x94cf('0xd0')][_0x94cf('0x11b')](db['Dynamics365Configuration'],{'as':_0x94cf('0x1cc'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xd0')][_0x94cf('0x129')](db[_0x94cf('0x16b')],{'as':_0x94cf('0x16b'),'foreignKey':_0x94cf('0x16c')});db[_0x94cf('0xd2')][_0x94cf('0x11b')](db[_0x94cf('0xd4')],{'as':_0x94cf('0x1ce'),'onDelete':_0x94cf('0x119'),'foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db[_0x94cf('0xd4')],{'as':_0x94cf('0x1d6'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xd2')][_0x94cf('0x11b')](db['Dynamics365Field'],{'as':_0x94cf('0x1c9'),'onDelete':'cascade','foreignKey':_0x94cf('0x1d0')});db['Dynamics365Configuration']['belongsTo'](db['Dynamics365Account'],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x1cd')});db['Dynamics365Field'][_0x94cf('0x11b')](db[_0x94cf('0xd4')],{'as':_0x94cf('0x1d1'),'foreignKey':_0x94cf('0x1d2')});db[_0x94cf('0xd4')][_0x94cf('0x11b')](db['Dynamics365Field'],{'as':_0x94cf('0x1d3'),'foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xd4')][_0x94cf('0x11b')](db[_0x94cf('0xd4')],{'as':_0x94cf('0x1d4'),'foreignKey':_0x94cf('0x1d0')});db[_0x94cf('0xd4')][_0x94cf('0x129')](db[_0x94cf('0x9d')],{'as':_0x94cf('0x9d'),'foreignKey':'VariableId'});db[_0x94cf('0xd5')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x94cf('0x1cc'),'onDelete':_0x94cf('0x119'),'foreignKey':_0x94cf('0x1cd')});db['FreshsalesConfiguration'][_0x94cf('0x11b')](db[_0x94cf('0xd9')],{'as':'Subjects','foreignKey':_0x94cf('0x1d2')});db['FreshsalesConfiguration'][_0x94cf('0x11b')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xd7')][_0x94cf('0x11b')](db['FreshsalesField'],{'as':_0x94cf('0x1c9'),'foreignKey':_0x94cf('0x1d0')});db['FreshsalesConfiguration'][_0x94cf('0x129')](db[_0x94cf('0xd5')],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x1cd')});db[_0x94cf('0xd9')][_0x94cf('0x11b')](db[_0x94cf('0xd9')],{'as':_0x94cf('0x1d1'),'foreignKey':_0x94cf('0x1d2')});db['FreshsalesField'][_0x94cf('0x11b')](db[_0x94cf('0xd9')],{'as':'Description','foreignKey':_0x94cf('0x1cf')});db[_0x94cf('0xd9')][_0x94cf('0x11b')](db['FreshsalesField'],{'as':_0x94cf('0x1d4'),'foreignKey':'FieldId'});db['FreshsalesField'][_0x94cf('0x129')](db[_0x94cf('0x9d')],{'as':_0x94cf('0x9d'),'foreignKey':'VariableId'});db[_0x94cf('0xdd')]['belongsTo'](db[_0x94cf('0x67')],{});db['ChatQueueReport'][_0x94cf('0x129')](db[_0x94cf('0x131')],{'as':_0x94cf('0x175'),'foreignKey':'ListId'});db[_0x94cf('0xdd')][_0x94cf('0x129')](db['CmContact'],{'as':'Contact','foreignKey':_0x94cf('0x169')});db[_0x94cf('0xdd')]['belongsTo'](db[_0x94cf('0x6d')],{});db[_0x94cf('0xdd')][_0x94cf('0x129')](db[_0x94cf('0x6f')],{});db[_0x94cf('0xdd')]['belongsTo'](db[_0x94cf('0x13')],{});db[_0x94cf('0xdd')][_0x94cf('0x129')](db[_0x94cf('0x73')],{});db['ChatInternalMessage']['belongsTo'](db[_0x94cf('0x13')],{'onDelete':'cascade','foreignKey':'FromId'});db['ChatInternalMessage'][_0x94cf('0x129')](db['User'],{'onDelete':'cascade','foreignKey':_0x94cf('0x1df')});db[_0x94cf('0xe4')][_0x94cf('0x11b')](db[_0x94cf('0xe2')],{'foreignKey':_0x94cf('0x1e0'),'onDelete':'cascade'});db[_0x94cf('0xe4')][_0x94cf('0x11b')](db[_0x94cf('0x1e1')],{'foreignKey':_0x94cf('0x1e0'),'onDelete':'cascade'});db[_0x94cf('0x1e2')][_0x94cf('0x129')](db[_0x94cf('0x55')],{});db['SmsQueueReport'][_0x94cf('0x129')](db[_0x94cf('0x131')],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176')});db[_0x94cf('0x1e2')][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x1e2')][_0x94cf('0x129')](db[_0x94cf('0x59')],{});db['SmsQueueReport']['belongsTo'](db[_0x94cf('0x5b')],{});db[_0x94cf('0x1e2')]['belongsTo'](db[_0x94cf('0x13')],{});db[_0x94cf('0x1e2')]['belongsTo'](db[_0x94cf('0x5d')],{});db[_0x94cf('0xe7')][_0x94cf('0x11b')](db[_0x94cf('0xe4')],{'foreignKey':_0x94cf('0x1e3')});db[_0x94cf('0xe7')][_0x94cf('0x11b')](db[_0x94cf('0xe2')],{'foreignKey':_0x94cf('0x1e3')});db[_0x94cf('0xe7')][_0x94cf('0x11b')](db[_0x94cf('0x1e1')],{'foreignKey':_0x94cf('0x1e3')});db['SquareProject'][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':'Users','through':_0x94cf('0x1e4')});db[_0x94cf('0xf0')][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x178'),'through':_0x94cf('0x132')});db[_0x94cf('0xf0')]['belongsToMany'](db[_0x94cf('0x1e')],{'through':_0x94cf('0x111'),'as':_0x94cf('0x13a')});db[_0x94cf('0xf0')][_0x94cf('0x12b')](db[_0x94cf('0x43')],{'through':_0x94cf('0x1e5'),'as':_0x94cf('0x13b')});db[_0x94cf('0xf0')]['belongsToMany'](db['ChatQueue'],{'through':_0x94cf('0x1e6'),'as':'ChatQueues'});db['Team'][_0x94cf('0x12b')](db[_0x94cf('0x53')],{'through':_0x94cf('0x18e'),'as':_0x94cf('0x13d')});db[_0x94cf('0xf0')]['belongsToMany'](db['SmsQueue'],{'through':_0x94cf('0x194'),'as':_0x94cf('0x13e')});db[_0x94cf('0xf0')]['belongsToMany'](db[_0x94cf('0x66')],{'through':'team_has_openchannel_queues','as':_0x94cf('0x13f')});db[_0x94cf('0xf0')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x94cf('0x1e7'),'as':_0x94cf('0x1e8')});db['Team'][_0x94cf('0x12b')](db[_0x94cf('0x100')],{'through':'TeamVoicePrefix','as':_0x94cf('0x1e9')});db[_0x94cf('0x1aa')][_0x94cf('0x11b')](db[_0x94cf('0x154')],{'as':_0x94cf('0x1a4'),'foreignKey':'CampaignId'});db[_0x94cf('0x1aa')]['hasMany'](db[_0x94cf('0x11d')],{'as':_0x94cf('0x11e'),'foreignKey':_0x94cf('0x1ab')});db[_0x94cf('0x1aa')][_0x94cf('0x11b')](db[_0x94cf('0x11f')],{'as':_0x94cf('0x155'),'foreignKey':_0x94cf('0x1ab')});db[_0x94cf('0x1aa')][_0x94cf('0x11b')](db[_0x94cf('0x7c')],{'as':_0x94cf('0x156'),'foreignKey':_0x94cf('0x1ab')});db['Campaign'][_0x94cf('0x129')](db[_0x94cf('0x2d')],{'as':_0x94cf('0x2d'),'foreignKey':_0x94cf('0x1ea')});db[_0x94cf('0x1aa')][_0x94cf('0x129')](db[_0x94cf('0x2d')],{'as':_0x94cf('0x158'),'foreignKey':_0x94cf('0x159')});db['Campaign']['belongsTo'](db['Interval'],{'as':_0x94cf('0x8b'),'foreignKey':_0x94cf('0x15a')});db[_0x94cf('0x1aa')][_0x94cf('0x129')](db['SquareProject'],{'as':_0x94cf('0x14c'),'foreignKey':_0x94cf('0x1eb')});db[_0x94cf('0x1aa')][_0x94cf('0x12b')](db['CmList'],{'as':_0x94cf('0x1ec'),'through':_0x94cf('0x1ed')});db['Campaign'][_0x94cf('0x12b')](db[_0x94cf('0x131')],{'as':_0x94cf('0x15e'),'through':_0x94cf('0x1ee')});db[_0x94cf('0xf6')][_0x94cf('0x129')](db[_0x94cf('0x71')],{'as':'ChatOfflineMessage','foreignKey':_0x94cf('0x182')});db[_0x94cf('0x1ef')][_0x94cf('0x129')](db[_0x94cf('0x47')],{});db[_0x94cf('0x1ef')][_0x94cf('0x129')](db[_0x94cf('0x124')],{});db[_0x94cf('0x1ef')][_0x94cf('0x129')](db[_0x94cf('0x41')],{'foreignKey':_0x94cf('0x1f0'),'as':_0x94cf('0x1f1')});db[_0x94cf('0x1ef')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'foreignKey':_0x94cf('0x1f2'),'as':_0x94cf('0x1f3')});db[_0x94cf('0x1ef')]['belongsTo'](db[_0x94cf('0x13')],{'foreignKey':_0x94cf('0x1f4'),'as':_0x94cf('0x1f5')});db[_0x94cf('0x1ef')][_0x94cf('0x129')](db[_0x94cf('0x43')],{'foreignKey':_0x94cf('0x1f6'),'as':'ToQueue'});db[_0x94cf('0x1ef')][_0x94cf('0x129')](db[_0x94cf('0x41')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x94cf('0x1f7')][_0x94cf('0x129')](db[_0x94cf('0x6f')],{});db['ChatTransferReport']['belongsTo'](db[_0x94cf('0x6d')],{});db[_0x94cf('0x1f7')]['belongsTo'](db[_0x94cf('0x67')],{'foreignKey':_0x94cf('0x1f8'),'as':_0x94cf('0x1f1')});db[_0x94cf('0x1f7')]['belongsTo'](db[_0x94cf('0x13')],{'foreignKey':_0x94cf('0x1f2'),'as':_0x94cf('0x1f3')});db[_0x94cf('0x1f7')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'foreignKey':_0x94cf('0x1f4'),'as':_0x94cf('0x1f5')});db[_0x94cf('0x1f7')][_0x94cf('0x129')](db[_0x94cf('0x73')],{'foreignKey':_0x94cf('0x1f9'),'as':_0x94cf('0x1fa')});db['ChatTransferReport'][_0x94cf('0x129')](db['ChatWebsite'],{'foreignKey':_0x94cf('0x1fb'),'as':_0x94cf('0x1fc')});db['FaxTransferReport'][_0x94cf('0x129')](db[_0x94cf('0x189')],{});db[_0x94cf('0xfb')][_0x94cf('0x129')](db[_0x94cf('0x51')],{});db[_0x94cf('0xfb')][_0x94cf('0x129')](db[_0x94cf('0x142')],{'foreignKey':'FromFaxAccountId','as':_0x94cf('0x1f1')});db[_0x94cf('0xfb')][_0x94cf('0x129')](db['User'],{'foreignKey':_0x94cf('0x1f2'),'as':'FromAgent'});db[_0x94cf('0xfb')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'foreignKey':_0x94cf('0x1f4'),'as':_0x94cf('0x1f5')});db[_0x94cf('0xfb')][_0x94cf('0x129')](db[_0x94cf('0x53')],{'foreignKey':'ToFaxQueueId','as':_0x94cf('0x1fa')});db[_0x94cf('0xfb')][_0x94cf('0x129')](db['FaxAccount'],{'foreignKey':_0x94cf('0x1fd'),'as':_0x94cf('0x1fc')});db[_0x94cf('0x1fe')][_0x94cf('0x129')](db[_0x94cf('0x64')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x94cf('0x1fe')][_0x94cf('0x129')](db[_0x94cf('0x5f')],{'foreignKey':'FromOpenchannelAccountId','as':_0x94cf('0x1f1')});db[_0x94cf('0x1fe')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'foreignKey':_0x94cf('0x1f2'),'as':'FromAgent'});db['OpenchannelTransferReport'][_0x94cf('0x129')](db[_0x94cf('0x13')],{'foreignKey':_0x94cf('0x1f4'),'as':_0x94cf('0x1f5')});db[_0x94cf('0x1fe')]['belongsTo'](db[_0x94cf('0x66')],{'foreignKey':_0x94cf('0x1ff'),'as':_0x94cf('0x1fa')});db[_0x94cf('0x1fe')]['belongsTo'](db[_0x94cf('0x5f')],{'foreignKey':_0x94cf('0x200'),'as':_0x94cf('0x1fc')});db[_0x94cf('0x201')][_0x94cf('0x129')](db['SmsMessage'],{});db['SmsTransferReport'][_0x94cf('0x129')](db[_0x94cf('0x59')],{});db[_0x94cf('0x201')][_0x94cf('0x129')](db[_0x94cf('0x55')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db['SmsTransferReport'][_0x94cf('0x129')](db['User'],{'foreignKey':_0x94cf('0x1f2'),'as':_0x94cf('0x1f3')});db[_0x94cf('0x201')][_0x94cf('0x129')](db['User'],{'foreignKey':_0x94cf('0x1f4'),'as':_0x94cf('0x1f5')});db['SmsTransferReport'][_0x94cf('0x129')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x94cf('0x1fa')});db[_0x94cf('0x201')][_0x94cf('0x129')](db[_0x94cf('0x55')],{'foreignKey':'ToSmsAccountId','as':_0x94cf('0x1fc')});db[_0x94cf('0x131')][_0x94cf('0x11b')](db[_0x94cf('0x88')],{'as':_0x94cf('0x170'),'foreignKey':_0x94cf('0x176'),'onDelete':'cascade'});db['CmList'][_0x94cf('0x11b')](db[_0x94cf('0x81')],{'as':_0x94cf('0x202'),'foreignKey':_0x94cf('0x176')});db['CmList']['hasMany'](db['CmContact'],{'as':_0x94cf('0x12f'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x94cf('0x131')][_0x94cf('0x11b')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x94cf('0x176')});db[_0x94cf('0x131')]['hasMany'](db[_0x94cf('0x11f')],{'as':_0x94cf('0x120'),'foreignKey':_0x94cf('0x176')});db['CmList']['hasMany'](db[_0x94cf('0x121')],{'as':_0x94cf('0x121'),'foreignKey':_0x94cf('0x176')});db[_0x94cf('0x131')][_0x94cf('0x12b')](db[_0x94cf('0x1e')],{'as':_0x94cf('0x203'),'through':_0x94cf('0x204')});db[_0x94cf('0x131')][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x178'),'through':_0x94cf('0x140')});db[_0x94cf('0x100')][_0x94cf('0x11b')](db[_0x94cf('0x1a')],{'as':_0x94cf('0x1b5'),'onDelete':_0x94cf('0x119')});db['VoicePrefix'][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x178'),'through':'UserVoicePrefix'});db[_0x94cf('0x100')][_0x94cf('0x12b')](db[_0x94cf('0xf0')],{'through':_0x94cf('0x113'),'as':_0x94cf('0x15d')});db['UserProfile'][_0x94cf('0x11b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x17e'),'foreignKey':'userProfileId'});db[_0x94cf('0x102')][_0x94cf('0x11b')](db[_0x94cf('0x103')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':'cascade'});db['UserProfileSection'][_0x94cf('0x11b')](db[_0x94cf('0x105')],{'as':'Resources','foreignKey':_0x94cf('0x205'),'onDelete':'cascade'});db[_0x94cf('0x108')][_0x94cf('0x11b')](db[_0x94cf('0x88')],{'as':_0x94cf('0x170'),'foreignKey':_0x94cf('0x206'),'onDelete':_0x94cf('0x119')});db[_0x94cf('0x108')]['hasMany'](db[_0x94cf('0x86')],{'as':_0x94cf('0x171'),'foreignKey':_0x94cf('0x206')});db[_0x94cf('0x108')][_0x94cf('0x11b')](db[_0x94cf('0x207')],{'as':_0x94cf('0x172'),'foreignKey':_0x94cf('0x206')});db[_0x94cf('0x108')]['hasMany'](db[_0x94cf('0x1bb')],{'as':'Interactions'});db['WhatsappAccount'][_0x94cf('0x11b')](db['WhatsappApplication'],{'as':_0x94cf('0x174')});db[_0x94cf('0x108')][_0x94cf('0x129')](db['CmList'],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176')});db[_0x94cf('0x108')]['belongsTo'](db[_0x94cf('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x94cf('0x15c')});db[_0x94cf('0x108')][_0x94cf('0x12b')](db['User'],{'as':'Agents','through':_0x94cf('0x14b')});db['WhatsappApplication'][_0x94cf('0x129')](db[_0x94cf('0x13')],{'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x109')][_0x94cf('0x129')](db['WhatsappQueue'],{'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x109')][_0x94cf('0x129')](db[_0x94cf('0x108')],{'onDelete':'restrict'});db[_0x94cf('0x109')][_0x94cf('0x129')](db[_0x94cf('0x8b')],{'onDelete':_0x94cf('0x16d'),'foreignKey':_0x94cf('0x15a')});db[_0x94cf('0x109')]['belongsTo'](db[_0x94cf('0x95')],{'onDelete':_0x94cf('0x16d'),'foreignKey':_0x94cf('0x183')});db[_0x94cf('0x1bb')][_0x94cf('0x11b')](db['WhatsappMessage'],{'as':_0x94cf('0x172'),'onDelete':_0x94cf('0x119'),'foreignKey':'WhatsappInteractionId'});db[_0x94cf('0x1bb')][_0x94cf('0x129')](db[_0x94cf('0x108')],{'as':'Account','foreignKey':_0x94cf('0x206')});db[_0x94cf('0x1bb')][_0x94cf('0x129')](db[_0x94cf('0x12e')],{'as':_0x94cf('0x168'),'foreignKey':_0x94cf('0x169')});db[_0x94cf('0x1bb')]['belongsTo'](db[_0x94cf('0x13')],{'as':_0x94cf('0x17a'),'foreignKey':_0x94cf('0x11a')});db[_0x94cf('0x1bb')][_0x94cf('0x12b')](db[_0x94cf('0x95')],{'through':_0x94cf('0x208'),'as':_0x94cf('0x17c')});db[_0x94cf('0x1bb')]['belongsToMany'](db[_0x94cf('0x95')],{'through':'whatsapp_interaction_has_tags','as':_0x94cf('0x17d')});db[_0x94cf('0x1bb')][_0x94cf('0x12b')](db[_0x94cf('0x13')],{'as':_0x94cf('0x17e'),'through':'user_has_whatsapp_interactions','foreignKey':_0x94cf('0x209')});db[_0x94cf('0x207')]['belongsTo'](db[_0x94cf('0x13')],{'as':'User'});db[_0x94cf('0x207')]['belongsTo'](db[_0x94cf('0x12e')],{'onDelete':'cascade','as':_0x94cf('0x168')});db['WhatsappMessage'][_0x94cf('0x129')](db[_0x94cf('0x1bb')],{'onDelete':_0x94cf('0x119'),'as':'Interaction','foreignKey':_0x94cf('0x209')});db[_0x94cf('0x207')]['belongsTo'](db[_0x94cf('0x108')],{'as':_0x94cf('0x18b'),'foreignKey':_0x94cf('0x206')});db[_0x94cf('0x20a')][_0x94cf('0x129')](db[_0x94cf('0x108')],{});db['WhatsappQueueReport'][_0x94cf('0x129')](db['CmList'],{'as':_0x94cf('0x175'),'foreignKey':_0x94cf('0x176')});db['WhatsappQueueReport'][_0x94cf('0x129')](db['CmContact'],{'as':'Contact','foreignKey':_0x94cf('0x169')});db[_0x94cf('0x20a')][_0x94cf('0x129')](db[_0x94cf('0x1bb')],{});db[_0x94cf('0x20a')][_0x94cf('0x129')](db[_0x94cf('0x10f')],{});db[_0x94cf('0x20a')][_0x94cf('0x129')](db[_0x94cf('0x207')],{});db[_0x94cf('0x20a')][_0x94cf('0x129')](db[_0x94cf('0x13')],{});db[_0x94cf('0x10d')][_0x94cf('0x129')](db['WhatsappMessage'],{});db[_0x94cf('0x10d')][_0x94cf('0x129')](db[_0x94cf('0x1bb')],{});db['WhatsappTransferReport'][_0x94cf('0x129')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x94cf('0x10d')][_0x94cf('0x129')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0x94cf('0x1fc')});db['WhatsappTransferReport'][_0x94cf('0x129')](db['WhatsappQueue'],{'foreignKey':_0x94cf('0x20b'),'as':'ToQueue'});db[_0x94cf('0x10d')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'foreignKey':_0x94cf('0x1f2'),'as':_0x94cf('0x1f3')});db['WhatsappTransferReport'][_0x94cf('0x129')](db[_0x94cf('0x13')],{'foreignKey':_0x94cf('0x1f4'),'as':_0x94cf('0x1f5')});db[_0x94cf('0x10f')][_0x94cf('0x12b')](db['User'],{'as':_0x94cf('0x178'),'through':_0x94cf('0x3d'),'foreignKey':'WhatsappQueueId'});db[_0x94cf('0x10f')][_0x94cf('0x12b')](db[_0x94cf('0xf0')],{'through':_0x94cf('0x1e7'),'as':_0x94cf('0x15d')});db[_0x94cf('0x118')][_0x94cf('0x129')](db[_0x94cf('0x13')],{'as':'user','foreignKey':_0x94cf('0x11a'),'onDelete':_0x94cf('0x119'),'hooks':!![]});db[_0x94cf('0x16b')]['hasOne'](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0x94cf('0x16d')});db[_0x94cf('0x16b')]['hasOne'](db[_0x94cf('0x3e')],{'as':_0x94cf('0x16e'),'onDelete':_0x94cf('0x16d')});db[_0x94cf('0x16b')][_0x94cf('0x117')](db[_0x94cf('0x40')],{'as':_0x94cf('0x16f'),'onDelete':'restrict'});module[_0x94cf('0x20c')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xc9d9=['SenderId','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','CmList','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','UserVoicePrefix','MailQueue','MailQueues','UserMailQueue','FaxQueues','UserFaxQueue','SmsQueues','UserSmsQueue','WhatsappQueues','cm_user_has_lists','ChatWebsite','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','VoiceChanSpy','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperFinal','HopperHistories','HopperBlacks','belongsTo','TrunkId','TrunkBackup','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailbox','mailboxuser','QueueCalls','AgentReports','uniqueid','Contact','MailServerIn','CloudProviderId','restrict','MailServerOut','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','Applications','List','ListId','Template','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','FaxAccountId','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','SmsMessage','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','ProactiveActions','ChatMessage','Agent','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','CompanyId','JscriptySessions','ChatInteractions','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','CampaignId','OwnerId','CmHopperBlack','Automation','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','DefaultReportId','AnalyticCustomReport','VoiceMusicOnHold','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactId','AllConditions','AllCondition','AnyCondition','TriggerAnyId','Fields','CustomReportId','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','SalesforceAccount','Description','DescriptionId','Field','VariableId','Subject','DeskAccount','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','int_freshdesk_configuration_has_tags','VtigerField','Dynamics365Account','Dynamics365Field','Dynamics365Configuration','FreshsalesField','ChatQueueReport','FromId','ToId','SessionId','ProjectId','user_has_square_projects','team_has_mail_queues','ChatQueues','OpenchannelQueues','VoicePrefixes','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAccount','ToUserId','ToChatQueueId','ToChatWebsiteId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','HopperHistory','Queues','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','team_has_whatsapp_queues','user','exports','../config/environment','sequelize','lodash','determine','xcall','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','xC@LL1234','name','database','username','password','options','User','import','VoiceContext','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','UserId','userSetting','cascade','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications'];(function(_0x30b6d3,_0xd02c1e){var _0x5c487b=function(_0x1f37f2){while(--_0x1f37f2){_0x30b6d3['push'](_0x30b6d3['shift']());}};_0x5c487b(++_0xd02c1e);}(_0xc9d9,0xe7));var _0x9c9d=function(_0x3264cd,_0x37af9d){_0x3264cd=_0x3264cd-0x0;var _0x5d4173=_0xc9d9[_0x3264cd];return _0x5d4173;};'use strict';var config=require(_0x9c9d('0x0'));var Sequelize=require(_0x9c9d('0x1'));var _=require(_0x9c9d('0x2'));var jstz=require('jstz');var timezone=jstz[_0x9c9d('0x3')]();config[_0x9c9d('0x1')]=_['defaultsDeep'](config[_0x9c9d('0x1')],{'database':'motion2','username':_0x9c9d('0x4'),'password':'xC@LL1234','options':{'host':_0x9c9d('0x5'),'port':0xcea,'dialect':_0x9c9d('0x6'),'dialectOptions':{'charset':_0x9c9d('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x9c9d('0x8')}}});config[_0x9c9d('0x9')]=_[_0x9c9d('0xa')](config['sequelizeHistory'],{'database':_0x9c9d('0xb'),'username':_0x9c9d('0x4'),'password':_0x9c9d('0xc'),'options':{'host':_0x9c9d('0x5'),'port':0xcea,'dialect':_0x9c9d('0x6'),'dialectOptions':{'charset':_0x9c9d('0x7')},'logging':![],'timezone':timezone[_0x9c9d('0xd')](),'define':{'charset':'utf8','collate':_0x9c9d('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9c9d('0x1')][_0x9c9d('0xe')],config[_0x9c9d('0x1')][_0x9c9d('0xf')],config[_0x9c9d('0x1')][_0x9c9d('0x10')],config[_0x9c9d('0x1')][_0x9c9d('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x9c9d('0xe')],config[_0x9c9d('0x9')][_0x9c9d('0xf')],config['sequelizeHistory']['password'],config[_0x9c9d('0x9')][_0x9c9d('0x11')])};db[_0x9c9d('0x12')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/user/user.model');db['VoiceChanSpy']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x9c9d('0x14')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/voiceContext/voiceContext.model');db[_0x9c9d('0x15')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x16'));db['VoiceQueue']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x17'));db[_0x9c9d('0x18')]=db[_0x9c9d('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x19'));db[_0x9c9d('0x1a')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x1b'));db[_0x9c9d('0x1c')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x1d'));db[_0x9c9d('0x1e')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x1f'));db[_0x9c9d('0x20')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x21'));db['VoiceAgentReport']=db['sequelize']['import'](_0x9c9d('0x22'));db[_0x9c9d('0x23')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x9c9d('0x24')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x25'));db[_0x9c9d('0x26')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x27'));db[_0x9c9d('0x28')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x29'));db[_0x9c9d('0x2a')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x2b'));db[_0x9c9d('0x2c')]=db['sequelize']['import'](_0x9c9d('0x2d'));db['UserMailQueue']=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x2e'));db['UserFaxQueue']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x2f'));db['UserSmsQueue']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0x9c9d('0x30')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x31'));db[_0x9c9d('0x32')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x33'));db['MailServerIn']=db[_0x9c9d('0x1')]['import']('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize']['import'](_0x9c9d('0x34'));db[_0x9c9d('0x35')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x36'));db['MailQueue']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/mailQueue/mailQueue.model');db[_0x9c9d('0x37')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x38'));db[_0x9c9d('0x39')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x3a'));db[_0x9c9d('0x3b')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x3c'));db['MailApplication']=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x3d'));db['MailQueueReport']=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x3e'));db[_0x9c9d('0x3f')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x40'));db[_0x9c9d('0x41')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x42'));db[_0x9c9d('0x43')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x44'));db[_0x9c9d('0x45')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x46'));db['FaxInteraction']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x47'));db[_0x9c9d('0x48')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/faxMessage/faxMessage.model');db[_0x9c9d('0x49')]=db['sequelize'][_0x9c9d('0x13')]('../api/faxQueue/faxQueue.model');db[_0x9c9d('0x4a')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x4b'));db[_0x9c9d('0x4c')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x4d'));db[_0x9c9d('0x4e')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x4f'));db[_0x9c9d('0x50')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x51'));db['SmsMessage']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x52'));db[_0x9c9d('0x53')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x54'));db[_0x9c9d('0x55')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x56'));db['OpenchannelApplication']=db[_0x9c9d('0x1')]['import']('../api/openchannelApplication/openchannelApplication.model');db[_0x9c9d('0x57')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x58'));db[_0x9c9d('0x59')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0x9c9d('0x5a')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x5b'));db['ChatWebsite']=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x5c'));db[_0x9c9d('0x5d')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x9c9d('0x5e')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x5f'));db[_0x9c9d('0x60')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x61'));db['ChatMessage']=db['sequelize']['import'](_0x9c9d('0x62'));db['ChatOfflineMessage']=db['sequelize']['import'](_0x9c9d('0x63'));db[_0x9c9d('0x64')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x65'));db[_0x9c9d('0x66')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/chatGroup/chatGroup.model');db[_0x9c9d('0x67')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x9c9d('0x68')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/cmCompany/cmCompany.model');db[_0x9c9d('0x69')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x6a'));db[_0x9c9d('0x6b')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x6c'));db['CmHopperBlack']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x9c9d('0x6d')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x6e'));db['CmCustomField']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x9c9d('0x6f')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x70'));db['Automation']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/automation/automation.model');db[_0x9c9d('0x71')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x72'));db[_0x9c9d('0x73')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/disposition/disposition.model');db[_0x9c9d('0x74')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x75'));db[_0x9c9d('0x76')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x77'));db['Pause']=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x78'));db[_0x9c9d('0x79')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x7a'));db['VoiceQueuesLog']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x7b'));db[_0x9c9d('0x7c')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x7d'));db[_0x9c9d('0x7e')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x7f'));db[_0x9c9d('0x80')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x81'));db[_0x9c9d('0x82')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x83'));db[_0x9c9d('0x84')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x9c9d('0x85')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x86'));db['Template']=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x87'));db[_0x9c9d('0x88')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x89'));db[_0x9c9d('0x8a')]=db[_0x9c9d('0x1')]['import']('../api/variable/variable.model');db[_0x9c9d('0x8b')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/integration/integration.model');db[_0x9c9d('0x8c')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x8d'));db['AnalyticCustomReport']=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x8e'));db[_0x9c9d('0x8f')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x90'));db['AnalyticExtractedReport']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x91'));db['AnalyticMetric']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x92'));db[_0x9c9d('0x93')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x94'));db[_0x9c9d('0x95')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x96'));db[_0x9c9d('0x97')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x98'));db[_0x9c9d('0x99')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x9a'));db[_0x9c9d('0x9b')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x9c'));db[_0x9c9d('0x9d')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x9e'));db[_0x9c9d('0x9f')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xa0'));db['DeskAccount']=db[_0x9c9d('0x1')]['import'](_0x9c9d('0xa1'));db[_0x9c9d('0xa2')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xa3'));db[_0x9c9d('0xa4')]=db['sequelize']['import'](_0x9c9d('0xa5'));db['ZohoAccount']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xa6'));db['ZohoConfiguration']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x9c9d('0xa7')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/intZohoField/intZohoField.model');db[_0x9c9d('0xa8')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0xa9'));db[_0x9c9d('0xaa')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xab'));db[_0x9c9d('0xac')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xad'));db[_0x9c9d('0xae')]=db['sequelize'][_0x9c9d('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x9c9d('0xaf')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xb0'));db[_0x9c9d('0xb1')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0xb2'));db[_0x9c9d('0xb3')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0xb4'));db[_0x9c9d('0xb5')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xb6'));db['VtigerField']=db[_0x9c9d('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db[_0x9c9d('0xb7')]=db['sequelize']['import'](_0x9c9d('0xb8'));db[_0x9c9d('0xb9')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xba'));db[_0x9c9d('0xbb')]=db[_0x9c9d('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x9c9d('0x1')]['import'](_0x9c9d('0xbc'));db['Dynamics365Configuration']=db[_0x9c9d('0x1')]['import'](_0x9c9d('0xbd'));db['Dynamics365Field']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xbe'));db[_0x9c9d('0xbf')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0xc0'));db[_0x9c9d('0xc1')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0xc2'));db['FreshsalesField']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xc3'));db[_0x9c9d('0x8b')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/integration/integration.model');db['Network']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/network/network.model');db['ChatQueueReport']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xc4'));db[_0x9c9d('0xc5')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xc6'));db[_0x9c9d('0xc7')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xc8'));db[_0x9c9d('0xc9')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0xca'));db[_0x9c9d('0xcb')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xcc'));db[_0x9c9d('0xcd')]=db['sequelize']['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x9c9d('0xce')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0xcf'));db[_0x9c9d('0xd0')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x9c9d('0xd1')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xd2'));db[_0x9c9d('0xd3')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0xd4'));db[_0x9c9d('0xd5')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0xd6'));db['SquareProject']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xd7'));db['SquareRecording']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xd8'));db[_0x9c9d('0xd9')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0xda'));db[_0x9c9d('0xdb')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xdc'));db[_0x9c9d('0xdd')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/license/license.model');db[_0x9c9d('0xde')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xdf'));db['Migration']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/migration/migration.model');db[_0x9c9d('0xe0')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0xe1'));db[_0x9c9d('0xe2')]=db[_0x9c9d('0x1')]['import']('../api/plugin/plugin.model');db[_0x9c9d('0xe3')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xe4'));db[_0x9c9d('0xe5')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xe6'));db[_0x9c9d('0xe7')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0xe8'));db[_0x9c9d('0xe9')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0xea'));db[_0x9c9d('0xeb')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xec'));db[_0x9c9d('0xed')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xee'));db[_0x9c9d('0xef')]=db[_0x9c9d('0x1')]['import']('../api/userProfile/userProfile.model');db[_0x9c9d('0xf0')]=db['sequelize']['import'](_0x9c9d('0xf1'));db[_0x9c9d('0xf2')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0xf3'));db[_0x9c9d('0xf4')]=db['sequelize']['import'](_0x9c9d('0xf5'));db[_0x9c9d('0xf6')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0xf7'));db[_0x9c9d('0xf8')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xf9'));db[_0x9c9d('0xfa')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xfb'));db[_0x9c9d('0xfc')]=db['sequelize']['import'](_0x9c9d('0xfd'));db['WhatsappQueueReport']=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0xfe'));db[_0x9c9d('0xff')]=db['sequelize'][_0x9c9d('0x13')](_0x9c9d('0x100'));db[_0x9c9d('0x101')]=db['sequelize']['import'](_0x9c9d('0x102'));db[_0x9c9d('0x103')]=db['sequelize'][_0x9c9d('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0x9c9d('0x104')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x105'));db[_0x9c9d('0x106')]=db[_0x9c9d('0x1')]['import'](_0x9c9d('0x107'));db['UserVoicePrefix']=db[_0x9c9d('0x1')][_0x9c9d('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x9c9d('0x108')]=db[_0x9c9d('0x1')][_0x9c9d('0x13')](_0x9c9d('0x109'));db[_0x9c9d('0x12')][_0x9c9d('0x10a')](db['VoiceMail'],{'as':_0x9c9d('0x1a'),'onDelete':'cascade','foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x12')][_0x9c9d('0x10a')](db['UserSetting'],{'as':_0x9c9d('0x10c'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x10b')});db['User'][_0x9c9d('0x10e')](db['VoiceRecording'],{'as':_0x9c9d('0x10f'),'foreignKey':_0x9c9d('0x10b')});db['User'][_0x9c9d('0x10e')](db['UserVoiceQueueRt'],{'as':_0x9c9d('0x110'),'foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x12')][_0x9c9d('0x10e')](db[_0x9c9d('0x15')],{'as':_0x9c9d('0x111'),'onDelete':_0x9c9d('0x10d'),'hooks':!![]});db[_0x9c9d('0x12')][_0x9c9d('0x10e')](db['CmHopperFinal'],{'as':_0x9c9d('0x112'),'foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x12')][_0x9c9d('0x10e')](db[_0x9c9d('0x113')],{'as':'HopperHistory','foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x12')][_0x9c9d('0x10e')](db[_0x9c9d('0x6d')],{'as':_0x9c9d('0x6d'),'foreignKey':'UserId'});db[_0x9c9d('0x12')][_0x9c9d('0x10e')](db[_0x9c9d('0x57')],{'as':_0x9c9d('0x114'),'foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x12')][_0x9c9d('0x10e')](db[_0x9c9d('0x60')],{'as':'ChatInteractions','foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x12')][_0x9c9d('0x10e')](db[_0x9c9d('0x50')],{'as':_0x9c9d('0x115'),'foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x12')]['hasMany'](db[_0x9c9d('0x116')],{'as':_0x9c9d('0x117'),'foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x12')][_0x9c9d('0x10e')](db['MailInteraction'],{'as':_0x9c9d('0x118'),'foreignKey':_0x9c9d('0x10b')});db['User'][_0x9c9d('0x10e')](db[_0x9c9d('0xfa')],{'as':_0x9c9d('0x119'),'foreignKey':'UserId'});db[_0x9c9d('0x12')][_0x9c9d('0x10e')](db[_0x9c9d('0xf4')],{'as':_0x9c9d('0x11a'),'foreignKey':_0x9c9d('0x11b')});db[_0x9c9d('0x12')]['belongsTo'](db['UserProfile'],{'as':_0x9c9d('0xef'),'foreignKey':_0x9c9d('0x11c')});db[_0x9c9d('0x12')]['belongsToMany'](db[_0x9c9d('0x66')],{'as':_0x9c9d('0x11d'),'through':_0x9c9d('0x11e')});db['User'][_0x9c9d('0x11f')](db['CmContact'],{'as':_0x9c9d('0x120'),'through':'cm_user_has_contacts'});db['User'][_0x9c9d('0x11f')](db[_0x9c9d('0x121')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db[_0x9c9d('0xdb')],{'through':_0x9c9d('0x122')});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db['MailInteraction'],{'as':_0x9c9d('0x118'),'through':_0x9c9d('0x123')});db['User'][_0x9c9d('0x11f')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x9c9d('0x124')});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db['FaxInteraction'],{'as':_0x9c9d('0x117'),'through':_0x9c9d('0x125')});db['User'][_0x9c9d('0x11f')](db[_0x9c9d('0x50')],{'as':_0x9c9d('0x115'),'through':_0x9c9d('0x126')});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db[_0x9c9d('0x57')],{'as':_0x9c9d('0x114'),'through':_0x9c9d('0x127')});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db[_0x9c9d('0xfa')],{'as':_0x9c9d('0x119'),'through':_0x9c9d('0x128')});db[_0x9c9d('0x12')]['belongsToMany'](db[_0x9c9d('0x129')],{'as':_0x9c9d('0x12a'),'through':_0x9c9d('0x2a'),'required':![]});db[_0x9c9d('0x12')]['belongsToMany'](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x9c9d('0x12b'),'required':![]});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db[_0x9c9d('0x12c')],{'as':_0x9c9d('0x12d'),'through':_0x9c9d('0x12e'),'required':![]});db[_0x9c9d('0x12')]['belongsToMany'](db['ChatQueue'],{'as':'ChatQueues','through':_0x9c9d('0x2c'),'required':![],'hooks':!![]});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db[_0x9c9d('0x49')],{'as':_0x9c9d('0x12f'),'through':_0x9c9d('0x130'),'required':![]});db['User'][_0x9c9d('0x11f')](db[_0x9c9d('0x53')],{'as':_0x9c9d('0x131'),'through':_0x9c9d('0x132'),'required':![]});db['User'][_0x9c9d('0x11f')](db[_0x9c9d('0x5a')],{'as':'OpenchannelQueues','through':_0x9c9d('0x30'),'required':![]});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db[_0x9c9d('0x101')],{'as':_0x9c9d('0x133'),'through':_0x9c9d('0x32'),'required':![]});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db[_0x9c9d('0x121')],{'through':_0x9c9d('0x134')});db['User'][_0x9c9d('0x11f')](db[_0x9c9d('0x135')],{'as':'ChatWebsites','through':_0x9c9d('0x136')});db['User'][_0x9c9d('0x11f')](db[_0x9c9d('0x43')],{'as':_0x9c9d('0x137'),'through':_0x9c9d('0x138')});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db[_0x9c9d('0x35')],{'as':_0x9c9d('0x139'),'through':_0x9c9d('0x13a')});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db[_0x9c9d('0x55')],{'as':_0x9c9d('0x13b'),'through':'user_has_openchannel_accounts'});db['User'][_0x9c9d('0x11f')](db['SmsAccount'],{'as':_0x9c9d('0x13c'),'through':_0x9c9d('0x13d')});db['User'][_0x9c9d('0x11f')](db[_0x9c9d('0xf6')],{'as':_0x9c9d('0x13e'),'through':_0x9c9d('0x13f')});db[_0x9c9d('0x12')][_0x9c9d('0x11f')](db[_0x9c9d('0x140')],{'as':_0x9c9d('0x141'),'through':'user_has_square_projects'});db[_0x9c9d('0x142')]['hasMany'](db[_0x9c9d('0x15')],{'as':'SpiedAgents','onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x143')});db[_0x9c9d('0x14')][_0x9c9d('0x10e')](db[_0x9c9d('0x15')],{'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x15')][_0x9c9d('0x10e')](db[_0x9c9d('0x15')],{'as':'Applications','onDelete':_0x9c9d('0x10d')});db['VoiceMusicOnHold'][_0x9c9d('0x11f')](db['Sound'],{'as':_0x9c9d('0x144'),'through':_0x9c9d('0x145')});db['VoiceQueue'][_0x9c9d('0x10e')](db[_0x9c9d('0x28')],{'as':_0x9c9d('0x146'),'foreignKey':_0x9c9d('0x147')});db[_0x9c9d('0x129')]['hasMany'](db['CmHopper'],{'as':_0x9c9d('0x148'),'foreignKey':_0x9c9d('0x147')});db[_0x9c9d('0x129')][_0x9c9d('0x10e')](db[_0x9c9d('0x149')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x9c9d('0x129')][_0x9c9d('0x10e')](db['CmHopperHistory'],{'as':_0x9c9d('0x14a'),'foreignKey':_0x9c9d('0x147')});db[_0x9c9d('0x129')][_0x9c9d('0x10e')](db[_0x9c9d('0x6d')],{'as':_0x9c9d('0x6d'),'foreignKey':_0x9c9d('0x147')});db[_0x9c9d('0x129')][_0x9c9d('0x10e')](db['CmHopperBlack'],{'as':_0x9c9d('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x9c9d('0x129')][_0x9c9d('0x10e')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x9c9d('0x147')});db[_0x9c9d('0x129')][_0x9c9d('0x14c')](db['Trunk'],{'as':_0x9c9d('0x26'),'foreignKey':_0x9c9d('0x14d')});db[_0x9c9d('0x129')][_0x9c9d('0x14c')](db['Trunk'],{'as':_0x9c9d('0x14e'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x9c9d('0x14c')](db[_0x9c9d('0x76')],{'as':_0x9c9d('0x76'),'foreignKey':_0x9c9d('0x14f')});db[_0x9c9d('0x129')][_0x9c9d('0x14c')](db[_0x9c9d('0x150')],{'as':_0x9c9d('0x151'),'foreignKey':_0x9c9d('0x152')});db[_0x9c9d('0x129')][_0x9c9d('0x11f')](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x153'),'through':_0x9c9d('0x154')});db[_0x9c9d('0x129')]['belongsToMany'](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x155'),'through':_0x9c9d('0x2a')});db[_0x9c9d('0x129')][_0x9c9d('0x11f')](db['Team'],{'as':_0x9c9d('0x156'),'through':_0x9c9d('0x104')});db['VoiceQueue'][_0x9c9d('0x11f')](db['CmList'],{'as':_0x9c9d('0x157'),'through':_0x9c9d('0x158')});db['VoiceRecording'][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x12'),'foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x159')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x12'),'foreignKey':_0x9c9d('0x10b')});db['VoiceMail']['hasMany'](db[_0x9c9d('0x1c')],{'as':_0x9c9d('0x15a'),'onDelete':_0x9c9d('0x10d'),'foreignKey':'mailboxuser','sourceKey':_0x9c9d('0x15b')});db['VoiceMailMessage'][_0x9c9d('0x14c')](db[_0x9c9d('0x1a')],{'foreignKey':_0x9c9d('0x15c'),'targetKey':_0x9c9d('0x15b')});db[_0x9c9d('0x1e')][_0x9c9d('0x10e')](db['VoiceQueueReport'],{'as':_0x9c9d('0x15d'),'foreignKey':'uniqueid','constraints':![]});db[_0x9c9d('0x1e')][_0x9c9d('0x10e')](db['VoiceAgentReport'],{'as':_0x9c9d('0x15e'),'foreignKey':_0x9c9d('0x15f'),'constraints':![]});db[_0x9c9d('0x1e')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':'User','foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x1e')][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'as':_0x9c9d('0x160'),'foreignKey':'ContactId'});db[_0x9c9d('0x161')][_0x9c9d('0x14c')](db[_0x9c9d('0x35')],{'as':_0x9c9d('0x35'),'foreignKey':'MailAccountId'});db[_0x9c9d('0x161')][_0x9c9d('0x14c')](db[_0x9c9d('0x103')],{'as':_0x9c9d('0x103'),'foreignKey':_0x9c9d('0x162'),'onDelete':_0x9c9d('0x163')});db[_0x9c9d('0x164')][_0x9c9d('0x14c')](db[_0x9c9d('0x35')],{'as':_0x9c9d('0x35'),'foreignKey':_0x9c9d('0x165')});db[_0x9c9d('0x164')]['belongsTo'](db[_0x9c9d('0x103')],{'as':'CloudProvider','foreignKey':_0x9c9d('0x162'),'onDelete':_0x9c9d('0x163')});db['MailAccount']['hasOne'](db[_0x9c9d('0x161')],{'as':_0x9c9d('0x166'),'onDelete':'cascade'});db[_0x9c9d('0x35')][_0x9c9d('0x10a')](db[_0x9c9d('0x164')],{'as':_0x9c9d('0x167'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x35')][_0x9c9d('0x10e')](db[_0x9c9d('0x73')],{'as':_0x9c9d('0x168'),'foreignKey':'MailAccountId','onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x35')][_0x9c9d('0x10e')](db[_0x9c9d('0x71')],{'as':_0x9c9d('0x169'),'foreignKey':_0x9c9d('0x165')});db['MailAccount']['hasMany'](db[_0x9c9d('0x3b')],{'as':_0x9c9d('0x15a'),'foreignKey':_0x9c9d('0x165')});db[_0x9c9d('0x35')][_0x9c9d('0x10e')](db['MailInteraction'],{'as':_0x9c9d('0x16a')});db[_0x9c9d('0x35')][_0x9c9d('0x10e')](db[_0x9c9d('0x16b')],{'as':_0x9c9d('0x16c')});db[_0x9c9d('0x35')][_0x9c9d('0x14c')](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x16d'),'foreignKey':_0x9c9d('0x16e')});db[_0x9c9d('0x35')][_0x9c9d('0x14c')](db[_0x9c9d('0x16f')],{'as':'Template','foreignKey':'TemplateId'});db[_0x9c9d('0x35')][_0x9c9d('0x14c')](db[_0x9c9d('0x150')],{'as':_0x9c9d('0x151'),'foreignKey':_0x9c9d('0x152')});db[_0x9c9d('0x35')]['belongsToMany'](db['User'],{'as':_0x9c9d('0x155'),'through':'user_has_mail_accounts'});db[_0x9c9d('0x12c')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x155'),'through':'UserMailQueue'});db[_0x9c9d('0x12c')][_0x9c9d('0x11f')](db[_0x9c9d('0xdb')],{'through':'team_has_mail_queues','as':_0x9c9d('0x156')});db[_0x9c9d('0x39')][_0x9c9d('0x10e')](db[_0x9c9d('0x3b')],{'as':_0x9c9d('0x15a'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x170')});db[_0x9c9d('0x39')][_0x9c9d('0x14c')](db['MailAccount'],{'as':_0x9c9d('0x171'),'foreignKey':'MailAccountId'});db[_0x9c9d('0x39')][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'as':_0x9c9d('0x160'),'foreignKey':_0x9c9d('0x172')});db['MailInteraction'][_0x9c9d('0x14c')](db['User'],{'as':_0x9c9d('0x173'),'foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x39')][_0x9c9d('0x11f')](db[_0x9c9d('0x80')],{'through':_0x9c9d('0x174'),'as':_0x9c9d('0x175')});db[_0x9c9d('0x39')][_0x9c9d('0x11f')](db['Tag'],{'through':_0x9c9d('0x174'),'as':_0x9c9d('0x176')});db[_0x9c9d('0x39')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x177'),'through':_0x9c9d('0x123'),'foreignKey':_0x9c9d('0x170')});db[_0x9c9d('0x3b')][_0x9c9d('0x10e')](db[_0x9c9d('0xe0')],{'as':_0x9c9d('0x178'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x3b')]['belongsTo'](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x12')});db[_0x9c9d('0x3b')][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'onDelete':_0x9c9d('0x10d'),'as':'Contact'});db[_0x9c9d('0x3b')][_0x9c9d('0x14c')](db[_0x9c9d('0x39')],{'as':_0x9c9d('0x179'),'foreignKey':_0x9c9d('0x170')});db[_0x9c9d('0x3b')][_0x9c9d('0x14c')](db[_0x9c9d('0x35')],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x165')});db[_0x9c9d('0x3b')][_0x9c9d('0x14c')](db['ChatWebsite'],{'as':_0x9c9d('0x135'),'foreignKey':_0x9c9d('0x17a')});db[_0x9c9d('0x3b')][_0x9c9d('0x14c')](db[_0x9c9d('0x17b')],{'as':_0x9c9d('0x17b'),'foreignKey':_0x9c9d('0x17c')});db['MailApplication'][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'onDelete':_0x9c9d('0x163')});db['MailApplication'][_0x9c9d('0x14c')](db[_0x9c9d('0x12c')],{'onDelete':_0x9c9d('0x163')});db[_0x9c9d('0x16b')]['belongsTo'](db[_0x9c9d('0x35')],{'onDelete':_0x9c9d('0x163')});db[_0x9c9d('0x16b')]['belongsTo'](db[_0x9c9d('0x76')],{'onDelete':_0x9c9d('0x163'),'foreignKey':_0x9c9d('0x14f')});db[_0x9c9d('0x16b')][_0x9c9d('0x14c')](db['Tag'],{'onDelete':_0x9c9d('0x163'),'foreignKey':_0x9c9d('0x17d')});db[_0x9c9d('0x17e')][_0x9c9d('0x14c')](db[_0x9c9d('0x35')],{});db[_0x9c9d('0x17e')][_0x9c9d('0x14c')](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x16d'),'foreignKey':_0x9c9d('0x16e')});db['MailQueueReport'][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'as':_0x9c9d('0x160'),'foreignKey':'ContactId'});db[_0x9c9d('0x17e')][_0x9c9d('0x14c')](db[_0x9c9d('0x39')],{});db[_0x9c9d('0x17e')][_0x9c9d('0x14c')](db[_0x9c9d('0x3b')],{});db[_0x9c9d('0x17e')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{});db[_0x9c9d('0x17e')][_0x9c9d('0x14c')](db['MailQueue'],{});db[_0x9c9d('0x3f')][_0x9c9d('0x10e')](db['DashboardItem'],{'as':'Items','onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x43')][_0x9c9d('0x10e')](db[_0x9c9d('0x73')],{'as':_0x9c9d('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x43')][_0x9c9d('0x10e')](db[_0x9c9d('0x71')],{'as':_0x9c9d('0x169'),'foreignKey':_0x9c9d('0x17f')});db[_0x9c9d('0x43')][_0x9c9d('0x10e')](db[_0x9c9d('0x116')],{'as':_0x9c9d('0x16a')});db[_0x9c9d('0x43')][_0x9c9d('0x10e')](db[_0x9c9d('0x45')],{'as':_0x9c9d('0x16c')});db[_0x9c9d('0x43')]['hasMany'](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x43')]['hasMany'](db[_0x9c9d('0x48')],{'as':_0x9c9d('0x15a')});db[_0x9c9d('0x43')][_0x9c9d('0x14c')](db[_0x9c9d('0x26')],{'as':_0x9c9d('0x26')});db[_0x9c9d('0x43')][_0x9c9d('0x14c')](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x16d'),'foreignKey':'ListId'});db[_0x9c9d('0x43')][_0x9c9d('0x14c')](db[_0x9c9d('0x150')],{'as':'mandatoryDispositionPause','foreignKey':_0x9c9d('0x152')});db[_0x9c9d('0x43')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':'Agents','through':_0x9c9d('0x138')});db[_0x9c9d('0x45')]['belongsTo'](db[_0x9c9d('0x12')],{'onDelete':_0x9c9d('0x163')});db[_0x9c9d('0x45')][_0x9c9d('0x14c')](db[_0x9c9d('0x49')],{'onDelete':_0x9c9d('0x163')});db['FaxApplication'][_0x9c9d('0x14c')](db['FaxAccount'],{'onDelete':_0x9c9d('0x163')});db[_0x9c9d('0x45')][_0x9c9d('0x14c')](db[_0x9c9d('0x80')],{'onDelete':'restrict','foreignKey':_0x9c9d('0x17d')});db[_0x9c9d('0x116')][_0x9c9d('0x10e')](db[_0x9c9d('0x48')],{'as':_0x9c9d('0x15a'),'onDelete':_0x9c9d('0x10d'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x9c9d('0x14c')](db[_0x9c9d('0x43')],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x17f')});db[_0x9c9d('0x116')][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'as':'Contact','foreignKey':_0x9c9d('0x172')});db['FaxInteraction'][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x173'),'foreignKey':'UserId'});db[_0x9c9d('0x116')]['belongsToMany'](db[_0x9c9d('0x80')],{'through':_0x9c9d('0x180'),'as':'Tags'});db[_0x9c9d('0x116')][_0x9c9d('0x11f')](db[_0x9c9d('0x80')],{'through':_0x9c9d('0x180'),'as':_0x9c9d('0x176')});db[_0x9c9d('0x116')]['belongsToMany'](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x177'),'through':_0x9c9d('0x125'),'foreignKey':'FaxInteractionId'});db[_0x9c9d('0x48')][_0x9c9d('0x14c')](db['User'],{'onDelete':_0x9c9d('0x10d'),'as':'User'});db[_0x9c9d('0x48')][_0x9c9d('0x14c')](db[_0x9c9d('0x116')],{'as':'Interaction','foreignKey':_0x9c9d('0x181')});db[_0x9c9d('0x48')]['belongsTo'](db['CmContact'],{'onDelete':_0x9c9d('0x10d'),'as':_0x9c9d('0x160')});db[_0x9c9d('0x48')][_0x9c9d('0x14c')](db[_0x9c9d('0xe0')],{'as':_0x9c9d('0xe0'),'foreignKey':'AttachmentId'});db[_0x9c9d('0x48')]['belongsTo'](db[_0x9c9d('0x43')],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x17f')});db[_0x9c9d('0x49')][_0x9c9d('0x11f')](db['User'],{'as':_0x9c9d('0x155'),'through':_0x9c9d('0x130')});db['FaxQueue'][_0x9c9d('0x11f')](db[_0x9c9d('0xdb')],{'through':_0x9c9d('0x182'),'as':_0x9c9d('0x156')});db[_0x9c9d('0x4a')][_0x9c9d('0x14c')](db[_0x9c9d('0x43')],{});db[_0x9c9d('0x4a')][_0x9c9d('0x14c')](db['CmList'],{'as':_0x9c9d('0x16d'),'foreignKey':'ListId'});db[_0x9c9d('0x4a')]['belongsTo'](db[_0x9c9d('0x69')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9c9d('0x4a')][_0x9c9d('0x14c')](db[_0x9c9d('0x116')],{});db[_0x9c9d('0x4a')][_0x9c9d('0x14c')](db[_0x9c9d('0x48')],{});db['FaxQueueReport'][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{});db[_0x9c9d('0x4a')][_0x9c9d('0x14c')](db[_0x9c9d('0x49')],{});db[_0x9c9d('0x4c')][_0x9c9d('0x10e')](db[_0x9c9d('0x73')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x4c')][_0x9c9d('0x10e')](db[_0x9c9d('0x71')],{'as':_0x9c9d('0x169'),'foreignKey':'SmsAccountId'});db[_0x9c9d('0x4c')][_0x9c9d('0x10e')](db[_0x9c9d('0x183')],{'as':'Messages','foreignKey':_0x9c9d('0x184')});db[_0x9c9d('0x4c')][_0x9c9d('0x10e')](db[_0x9c9d('0x50')],{'as':_0x9c9d('0x16a')});db[_0x9c9d('0x4c')][_0x9c9d('0x10e')](db['SmsApplication'],{'as':_0x9c9d('0x16c')});db['SmsAccount']['belongsTo'](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x16d'),'foreignKey':_0x9c9d('0x16e')});db[_0x9c9d('0x4c')][_0x9c9d('0x14c')](db['Pause'],{'as':_0x9c9d('0x151'),'foreignKey':_0x9c9d('0x152')});db['SmsAccount'][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x155'),'through':_0x9c9d('0x13d')});db[_0x9c9d('0x4e')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'onDelete':_0x9c9d('0x163')});db[_0x9c9d('0x4e')][_0x9c9d('0x14c')](db['SmsQueue'],{'onDelete':_0x9c9d('0x163')});db['SmsApplication']['belongsTo'](db[_0x9c9d('0x4c')],{'onDelete':_0x9c9d('0x163')});db[_0x9c9d('0x4e')]['belongsTo'](db[_0x9c9d('0x76')],{'onDelete':_0x9c9d('0x163'),'foreignKey':_0x9c9d('0x14f')});db[_0x9c9d('0x4e')][_0x9c9d('0x14c')](db[_0x9c9d('0x80')],{'onDelete':_0x9c9d('0x163'),'foreignKey':'TagId'});db[_0x9c9d('0x50')][_0x9c9d('0x10e')](db[_0x9c9d('0x183')],{'as':'Messages','onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x185')});db['SmsInteraction'][_0x9c9d('0x14c')](db[_0x9c9d('0x4c')],{'as':'Account','foreignKey':_0x9c9d('0x184')});db[_0x9c9d('0x50')]['belongsTo'](db[_0x9c9d('0x69')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9c9d('0x50')]['belongsTo'](db[_0x9c9d('0x12')],{'as':'Owner','foreignKey':_0x9c9d('0x10b')});db['SmsInteraction']['belongsToMany'](db[_0x9c9d('0x80')],{'through':_0x9c9d('0x186'),'as':'Tags'});db[_0x9c9d('0x50')][_0x9c9d('0x11f')](db[_0x9c9d('0x80')],{'through':_0x9c9d('0x186'),'as':_0x9c9d('0x176')});db[_0x9c9d('0x50')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x177'),'through':'user_has_sms_interactions','foreignKey':_0x9c9d('0x185')});db[_0x9c9d('0x183')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x12')});db[_0x9c9d('0x183')][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'onDelete':'cascade','as':_0x9c9d('0x160')});db[_0x9c9d('0x183')][_0x9c9d('0x14c')](db['SmsInteraction'],{'onDelete':_0x9c9d('0x10d'),'as':'Interaction','foreignKey':_0x9c9d('0x185')});db[_0x9c9d('0x183')]['belongsTo'](db['SmsAccount'],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x184')});db[_0x9c9d('0x53')]['belongsToMany'](db['User'],{'as':_0x9c9d('0x155'),'through':'UserSmsQueue','foreignKey':_0x9c9d('0x187')});db[_0x9c9d('0x53')][_0x9c9d('0x11f')](db[_0x9c9d('0xdb')],{'through':_0x9c9d('0x188'),'as':_0x9c9d('0x156')});db[_0x9c9d('0x55')][_0x9c9d('0x10e')](db[_0x9c9d('0x73')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0x9c9d('0x10d')});db['OpenchannelAccount'][_0x9c9d('0x10e')](db[_0x9c9d('0x71')],{'as':'Answers','foreignKey':_0x9c9d('0x189')});db[_0x9c9d('0x55')][_0x9c9d('0x10e')](db[_0x9c9d('0x57')],{'as':_0x9c9d('0x16a'),'foreignKey':_0x9c9d('0x189')});db[_0x9c9d('0x55')][_0x9c9d('0x10e')](db[_0x9c9d('0x59')],{'as':_0x9c9d('0x15a'),'foreignKey':'OpenchannelAccountId'});db[_0x9c9d('0x55')]['hasMany'](db[_0x9c9d('0x18a')],{'as':_0x9c9d('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0x9c9d('0x55')]['belongsTo'](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x16d'),'foreignKey':_0x9c9d('0x16e')});db[_0x9c9d('0x55')][_0x9c9d('0x14c')](db[_0x9c9d('0x150')],{'as':'mandatoryDispositionPause','foreignKey':_0x9c9d('0x152')});db['OpenchannelAccount'][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':'Agents','through':_0x9c9d('0x18b')});db[_0x9c9d('0x18a')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'onDelete':'restrict'});db[_0x9c9d('0x18a')][_0x9c9d('0x14c')](db[_0x9c9d('0x5a')],{'onDelete':_0x9c9d('0x163'),'foreignKey':_0x9c9d('0x18c')});db['OpenchannelApplication'][_0x9c9d('0x14c')](db[_0x9c9d('0x55')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0x9c9d('0x18a')]['belongsTo'](db['Interval'],{'onDelete':_0x9c9d('0x163'),'foreignKey':_0x9c9d('0x14f')});db[_0x9c9d('0x18a')][_0x9c9d('0x14c')](db[_0x9c9d('0x80')],{'onDelete':_0x9c9d('0x163'),'foreignKey':_0x9c9d('0x17d')});db[_0x9c9d('0x57')][_0x9c9d('0x10e')](db[_0x9c9d('0x59')],{'as':_0x9c9d('0x15a'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x18d')});db[_0x9c9d('0x57')][_0x9c9d('0x14c')](db[_0x9c9d('0x55')],{'as':'Account','foreignKey':_0x9c9d('0x189')});db[_0x9c9d('0x57')][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'as':'Contact','foreignKey':_0x9c9d('0x172')});db['OpenchannelInteraction'][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x173'),'foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x57')]['belongsToMany'](db[_0x9c9d('0x80')],{'through':_0x9c9d('0x18e'),'as':_0x9c9d('0x175')});db[_0x9c9d('0x57')][_0x9c9d('0x11f')](db['Tag'],{'through':_0x9c9d('0x18e'),'as':'ThroughTags'});db[_0x9c9d('0x57')]['belongsToMany'](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x177'),'through':_0x9c9d('0x127'),'foreignKey':_0x9c9d('0x18d')});db[_0x9c9d('0x59')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'onDelete':_0x9c9d('0x10d'),'as':_0x9c9d('0x12')});db[_0x9c9d('0x59')][_0x9c9d('0x14c')](db['CmContact'],{'onDelete':'cascade','as':_0x9c9d('0x160')});db[_0x9c9d('0x59')][_0x9c9d('0x14c')](db[_0x9c9d('0x57')],{'onDelete':_0x9c9d('0x10d'),'as':'Interaction','foreignKey':_0x9c9d('0x18d')});db[_0x9c9d('0x59')]['belongsTo'](db[_0x9c9d('0xe0')],{'as':_0x9c9d('0xe0'),'foreignKey':_0x9c9d('0x18f')});db['OpenchannelMessage']['belongsTo'](db[_0x9c9d('0x55')],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x189')});db[_0x9c9d('0x5a')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x155'),'through':_0x9c9d('0x30'),'foreignKey':'OpenchannelQueueId'});db[_0x9c9d('0x5a')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':_0x9c9d('0x156')});db['ChatWebsite']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':'cascade'});db['ChatWebsite'][_0x9c9d('0x10e')](db[_0x9c9d('0x71')],{'as':_0x9c9d('0x169'),'foreignKey':_0x9c9d('0x17a')});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':_0x9c9d('0x190')});db['ChatWebsite'][_0x9c9d('0x10e')](db[_0x9c9d('0x60')],{'as':_0x9c9d('0x16a')});db[_0x9c9d('0x135')][_0x9c9d('0x10e')](db[_0x9c9d('0x5e')],{'as':_0x9c9d('0x16c')});db[_0x9c9d('0x135')][_0x9c9d('0x10e')](db[_0x9c9d('0x191')],{'as':_0x9c9d('0x15a')});db[_0x9c9d('0x135')][_0x9c9d('0x14c')](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x16d'),'foreignKey':_0x9c9d('0x16e')});db[_0x9c9d('0x135')][_0x9c9d('0x14c')](db[_0x9c9d('0x76')],{'as':_0x9c9d('0x76'),'foreignKey':_0x9c9d('0x14f')});db[_0x9c9d('0x135')][_0x9c9d('0x14c')](db[_0x9c9d('0x35')],{'as':_0x9c9d('0x35'),'foreignKey':_0x9c9d('0x165')});db['ChatWebsite'][_0x9c9d('0x14c')](db[_0x9c9d('0x150')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x155'),'through':'user_has_chat_websites'});db[_0x9c9d('0x5d')][_0x9c9d('0x14c')](db[_0x9c9d('0x55')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x16d'),'foreignKey':_0x9c9d('0x16e')});db[_0x9c9d('0x5d')][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9c9d('0x5d')]['belongsTo'](db[_0x9c9d('0x57')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x9c9d('0x59')],{});db['OpenchannelQueueReport']['belongsTo'](db['User'],{});db[_0x9c9d('0x5d')]['belongsTo'](db[_0x9c9d('0x5a')],{});db[_0x9c9d('0x5e')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x192'),'foreignKey':'UserId','onDelete':_0x9c9d('0x163')});db['ChatApplication']['belongsTo'](db['ChatQueue'],{'as':'Queue','foreignKey':_0x9c9d('0x193'),'onDelete':'restrict'});db[_0x9c9d('0x5e')][_0x9c9d('0x14c')](db[_0x9c9d('0x135')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x9c9d('0x5e')]['belongsTo'](db[_0x9c9d('0x80')],{'onDelete':_0x9c9d('0x163'),'foreignKey':_0x9c9d('0x17d')});db['ChatInteraction']['hasMany'](db['ChatMessage'],{'as':_0x9c9d('0x15a'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x9c9d('0x14c')](db[_0x9c9d('0x135')],{'as':_0x9c9d('0x171'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'as':_0x9c9d('0x160'),'foreignKey':_0x9c9d('0x172')});db[_0x9c9d('0x60')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':'Owner','foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x60')][_0x9c9d('0x11f')](db[_0x9c9d('0x80')],{'through':'chat_interaction_has_tags','as':_0x9c9d('0x175')});db[_0x9c9d('0x60')][_0x9c9d('0x11f')](db[_0x9c9d('0x80')],{'through':_0x9c9d('0x194'),'as':_0x9c9d('0x176')});db[_0x9c9d('0x60')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x177'),'through':'user_has_chat_interactions','foreignKey':_0x9c9d('0x195')});db[_0x9c9d('0x191')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'onDelete':_0x9c9d('0x10d'),'as':_0x9c9d('0x12')});db[_0x9c9d('0x191')][_0x9c9d('0x14c')](db['CmContact'],{'onDelete':'cascade','as':_0x9c9d('0x160'),'foreignKey':'ContactId'});db[_0x9c9d('0x191')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0x9c9d('0x10d'),'as':_0x9c9d('0x179'),'foreignKey':'ChatInteractionId'});db[_0x9c9d('0x191')][_0x9c9d('0x14c')](db[_0x9c9d('0xe0')],{'as':_0x9c9d('0xe0'),'foreignKey':'AttachmentId'});db[_0x9c9d('0x191')][_0x9c9d('0x14c')](db[_0x9c9d('0x135')],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x17a')});db['ChatOfflineMessage']['hasMany'](db['Attachment'],{'as':_0x9c9d('0x178'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x9c9d('0x10d'),'hooks':!![]});db[_0x9c9d('0x17b')][_0x9c9d('0x14c')](db['CmContact'],{'onDelete':_0x9c9d('0x10d'),'as':'Contact','foreignKey':_0x9c9d('0x172')});db[_0x9c9d('0x17b')]['belongsTo'](db[_0x9c9d('0x135')],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x17a')});db[_0x9c9d('0x64')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x155'),'through':_0x9c9d('0x2c'),'hooks':!![]});db[_0x9c9d('0x64')][_0x9c9d('0x11f')](db[_0x9c9d('0xdb')],{'through':_0x9c9d('0x196'),'as':_0x9c9d('0x156')});db[_0x9c9d('0x66')][_0x9c9d('0x10e')](db[_0x9c9d('0xc5')],{'as':_0x9c9d('0x15a'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x9c9d('0x66')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x146'),'through':_0x9c9d('0x11e')});db[_0x9c9d('0x67')][_0x9c9d('0x14c')](db[_0x9c9d('0x135')],{'as':'Website','foreignKey':_0x9c9d('0x17a')});db[_0x9c9d('0x68')][_0x9c9d('0x10e')](db[_0x9c9d('0x69')],{'as':'Contacts','foreignKey':_0x9c9d('0x197')});db[_0x9c9d('0x69')]['hasMany'](db[_0x9c9d('0x84')],{'as':'Phones','foreignKey':'CmContactId'});db[_0x9c9d('0x69')][_0x9c9d('0x10e')](db['CmHopper'],{'as':_0x9c9d('0x148'),'foreignKey':'ContactId'});db[_0x9c9d('0x69')][_0x9c9d('0x10e')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0x9c9d('0x69')][_0x9c9d('0x10e')](db[_0x9c9d('0x113')],{'as':_0x9c9d('0x14a'),'foreignKey':_0x9c9d('0x172')});db[_0x9c9d('0x69')][_0x9c9d('0x10e')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x9c9d('0x172')});db[_0x9c9d('0x69')][_0x9c9d('0x10e')](db[_0x9c9d('0xcb')],{'as':_0x9c9d('0x198'),'foreignKey':'ContactId'});db[_0x9c9d('0x69')][_0x9c9d('0x10e')](db['OpenchannelInteraction'],{'as':_0x9c9d('0x114'),'foreignKey':_0x9c9d('0x172'),'onDelete':_0x9c9d('0x163')});db[_0x9c9d('0x69')]['hasMany'](db[_0x9c9d('0x60')],{'as':_0x9c9d('0x199'),'foreignKey':_0x9c9d('0x172'),'onDelete':'restrict'});db[_0x9c9d('0x69')][_0x9c9d('0x10e')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x9c9d('0x163')});db['CmContact'][_0x9c9d('0x10e')](db['FaxInteraction'],{'as':_0x9c9d('0x117'),'foreignKey':_0x9c9d('0x172'),'onDelete':_0x9c9d('0x163')});db[_0x9c9d('0x69')][_0x9c9d('0x10e')](db['MailInteraction'],{'as':_0x9c9d('0x118'),'foreignKey':_0x9c9d('0x172'),'onDelete':_0x9c9d('0x163')});db['CmContact'][_0x9c9d('0x14c')](db['CmCompany'],{'as':_0x9c9d('0x19a'),'foreignKey':'CompanyId'});db[_0x9c9d('0x69')][_0x9c9d('0x14c')](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x16d'),'foreignKey':_0x9c9d('0x16e'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x69')][_0x9c9d('0x11f')](db['User'],{'as':_0x9c9d('0x177'),'through':_0x9c9d('0x19b')});db[_0x9c9d('0x69')][_0x9c9d('0x11f')](db[_0x9c9d('0x80')],{'as':_0x9c9d('0x175'),'through':_0x9c9d('0x19c')});db[_0x9c9d('0x69')]['belongsToMany'](db[_0x9c9d('0x80')],{'through':_0x9c9d('0x19c'),'as':_0x9c9d('0x176')});db[_0x9c9d('0x6b')][_0x9c9d('0x10e')](db['CmHopperAdditionalPhone'],{'as':_0x9c9d('0x19d'),'foreignKey':_0x9c9d('0x19e')});db['CmHopper'][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'as':'Contact','foreignKey':_0x9c9d('0x172'),'onDelete':'cascade'});db['CmHopper'][_0x9c9d('0x14c')](db['CmList'],{'as':'List','foreignKey':_0x9c9d('0x16e'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x6b')][_0x9c9d('0x14c')](db['User'],{'as':_0x9c9d('0x192'),'foreignKey':_0x9c9d('0x10b')});db[_0x9c9d('0x6b')][_0x9c9d('0x14c')](db[_0x9c9d('0x129')],{'as':_0x9c9d('0x19f'),'foreignKey':'VoiceQueueId','onDelete':_0x9c9d('0x10d')});db['CmHopper'][_0x9c9d('0x14c')](db[_0x9c9d('0xde')],{'as':_0x9c9d('0xde'),'foreignKey':_0x9c9d('0x1a0'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x6b')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x173'),'foreignKey':_0x9c9d('0x1a1')});db[_0x9c9d('0x1a2')][_0x9c9d('0x14c')](db['CmContact'],{'as':_0x9c9d('0x160'),'foreignKey':_0x9c9d('0x172'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x1a2')][_0x9c9d('0x14c')](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x16d'),'foreignKey':_0x9c9d('0x16e'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x1a2')][_0x9c9d('0x14c')](db[_0x9c9d('0x129')],{'as':'Queue','foreignKey':_0x9c9d('0x147'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x1a2')]['belongsTo'](db[_0x9c9d('0xde')],{'as':_0x9c9d('0xde'),'foreignKey':_0x9c9d('0x1a0'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x1a3')]['hasMany'](db[_0x9c9d('0x74')],{'as':{'plural':'All','singular':_0x9c9d('0x1a4')},'foreignKey':'AutomationAllId','onDelete':_0x9c9d('0x10d'),'hooks':!![]});db[_0x9c9d('0x1a3')]['hasMany'](db[_0x9c9d('0x74')],{'as':{'plural':_0x9c9d('0x1a5'),'singular':_0x9c9d('0x1a6')},'foreignKey':_0x9c9d('0x1a7'),'onDelete':_0x9c9d('0x10d'),'hooks':!![]});db[_0x9c9d('0x1a3')][_0x9c9d('0x10e')](db[_0x9c9d('0x6f')],{'as':_0x9c9d('0x1a8'),'foreignKey':_0x9c9d('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0x9c9d('0x73')][_0x9c9d('0x10e')](db[_0x9c9d('0x73')],{'as':_0x9c9d('0x168'),'foreignKey':_0x9c9d('0x1aa'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x76')][_0x9c9d('0x10e')](db['Interval'],{'as':_0x9c9d('0x1ab'),'foreignKey':_0x9c9d('0x14f'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x9c9d('0x76')][_0x9c9d('0x10e')](db[_0x9c9d('0x15')],{'as':_0x9c9d('0x111'),'foreignKey':_0x9c9d('0x14f'),'onDelete':'restrict'});db[_0x9c9d('0x76')][_0x9c9d('0x10e')](db['MailApplication'],{'as':_0x9c9d('0x1ac'),'foreignKey':_0x9c9d('0x14f')});db[_0x9c9d('0x76')][_0x9c9d('0x10e')](db[_0x9c9d('0x5e')],{'as':_0x9c9d('0x1ad'),'foreignKey':_0x9c9d('0x14f')});db['Interval'][_0x9c9d('0x10e')](db[_0x9c9d('0x45')],{'as':'FaxApplications','foreignKey':_0x9c9d('0x14f')});db[_0x9c9d('0x76')][_0x9c9d('0x10e')](db[_0x9c9d('0x4e')],{'as':'SmsApplications','foreignKey':_0x9c9d('0x14f')});db[_0x9c9d('0x7c')][_0x9c9d('0x14c')](db['MailAccount'],{});db[_0x9c9d('0x7c')][_0x9c9d('0x14c')](db[_0x9c9d('0x8f')],{'foreignKey':_0x9c9d('0x1ae')});db[_0x9c9d('0x7c')][_0x9c9d('0x14c')](db[_0x9c9d('0x1af')],{'foreignKey':'CustomReportId'});db[_0x9c9d('0x7e')]['belongsToMany'](db[_0x9c9d('0x1b0')],{'as':_0x9c9d('0x1b1'),'through':_0x9c9d('0x145'),'onDelete':_0x9c9d('0x163')});db[_0x9c9d('0x80')]['belongsToMany'](db[_0x9c9d('0x69')],{'through':'cm_contact_has_tags'});db[_0x9c9d('0x80')]['belongsToMany'](db[_0x9c9d('0x60')],{'through':_0x9c9d('0x194')});db[_0x9c9d('0x80')][_0x9c9d('0x11f')](db[_0x9c9d('0x39')],{'through':_0x9c9d('0x174')});db[_0x9c9d('0x80')]['belongsToMany'](db[_0x9c9d('0x50')],{'through':_0x9c9d('0x186')});db[_0x9c9d('0x80')][_0x9c9d('0x11f')](db[_0x9c9d('0x116')],{'through':'fax_interaction_has_tags'});db['Tag'][_0x9c9d('0x11f')](db[_0x9c9d('0x57')],{'through':'openchannel_interaction_has_tags'});db[_0x9c9d('0x80')]['belongsToMany'](db[_0x9c9d('0xfa')],{'through':_0x9c9d('0x1b2')});db[_0x9c9d('0x84')][_0x9c9d('0x14c')](db[_0x9c9d('0x82')],{'as':_0x9c9d('0x1b3'),'foreignKey':_0x9c9d('0x1b4')});db['CmHopperAdditionalPhone'][_0x9c9d('0x14c')](db[_0x9c9d('0x6b')],{'as':_0x9c9d('0x1b5'),'foreignKey':_0x9c9d('0x19e')});db[_0x9c9d('0x84')]['belongsTo'](db[_0x9c9d('0x69')],{'as':_0x9c9d('0x160'),'foreignKey':_0x9c9d('0x1b6')});db[_0x9c9d('0x88')][_0x9c9d('0x10e')](db[_0x9c9d('0x74')],{'as':{'plural':_0x9c9d('0x1b7'),'singular':_0x9c9d('0x1b8')},'foreignKey':'TriggerAllId','onDelete':_0x9c9d('0x10d'),'hooks':!![]});db[_0x9c9d('0x88')]['hasMany'](db[_0x9c9d('0x74')],{'as':{'plural':'AnyConditions','singular':_0x9c9d('0x1b9')},'foreignKey':_0x9c9d('0x1ba'),'onDelete':'cascade','hooks':!![]});db[_0x9c9d('0x88')]['hasMany'](db[_0x9c9d('0x6f')],{'as':_0x9c9d('0x1a8'),'foreignKey':'TriggerId','onDelete':_0x9c9d('0x10d'),'hooks':!![]});db[_0x9c9d('0x1af')][_0x9c9d('0x10e')](db['AnalyticFieldReport'],{'as':_0x9c9d('0x1bb'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1bc'),'hooks':!![]});db[_0x9c9d('0x8f')][_0x9c9d('0x10e')](db[_0x9c9d('0x93')],{'as':_0x9c9d('0x1bb'),'onDelete':'cascade','foreignKey':_0x9c9d('0x1ae')});db[_0x9c9d('0x1bd')][_0x9c9d('0x10e')](db['AnalyticFieldReport'],{'as':_0x9c9d('0x1bb'),'onDelete':'cascade','foreignKey':_0x9c9d('0x1be')});db[_0x9c9d('0x93')][_0x9c9d('0x14c')](db[_0x9c9d('0x1bd')],{'foreignKey':_0x9c9d('0x1be')});db['SalesforceAccount']['hasMany'](db[_0x9c9d('0x97')],{'as':_0x9c9d('0x1bf'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c0')});db[_0x9c9d('0x97')][_0x9c9d('0x10e')](db[_0x9c9d('0x99')],{'as':_0x9c9d('0x1c1'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0x97')]['hasMany'](db[_0x9c9d('0x99')],{'as':_0x9c9d('0x1c3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0x9c9d('0x10e')](db[_0x9c9d('0x99')],{'as':'Fields','onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0x97')]['belongsTo'](db[_0x9c9d('0x1c5')],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x1c0')});db['SalesforceField'][_0x9c9d('0x10e')](db[_0x9c9d('0x99')],{'as':'Subject','foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0x99')][_0x9c9d('0x10e')](db[_0x9c9d('0x99')],{'as':_0x9c9d('0x1c6'),'foreignKey':_0x9c9d('0x1c7')});db[_0x9c9d('0x99')][_0x9c9d('0x10e')](db[_0x9c9d('0x99')],{'as':_0x9c9d('0x1c8'),'foreignKey':'FieldId'});db[_0x9c9d('0x99')][_0x9c9d('0x14c')](db[_0x9c9d('0x8a')],{'as':_0x9c9d('0x8a'),'foreignKey':_0x9c9d('0x1c9')});db['SugarcrmAccount'][_0x9c9d('0x10e')](db[_0x9c9d('0x9d')],{'as':_0x9c9d('0x1bf'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c0')});db['SugarcrmConfiguration'][_0x9c9d('0x10e')](db['SugarcrmField'],{'as':_0x9c9d('0x1c1'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0x9d')][_0x9c9d('0x10e')](db['SugarcrmField'],{'as':_0x9c9d('0x1c3'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c7')});db['SugarcrmConfiguration'][_0x9c9d('0x10e')](db[_0x9c9d('0x9f')],{'as':'Fields','onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0x9d')][_0x9c9d('0x14c')](db[_0x9c9d('0x9b')],{'as':_0x9c9d('0x171'),'foreignKey':'AccountId'});db[_0x9c9d('0x9f')][_0x9c9d('0x10e')](db[_0x9c9d('0x9f')],{'as':_0x9c9d('0x1ca'),'foreignKey':'SubjectId'});db[_0x9c9d('0x9f')]['hasMany'](db[_0x9c9d('0x9f')],{'as':'Description','foreignKey':_0x9c9d('0x1c7')});db['SugarcrmField'][_0x9c9d('0x10e')](db[_0x9c9d('0x9f')],{'as':_0x9c9d('0x1c8'),'foreignKey':'FieldId'});db[_0x9c9d('0x9f')]['belongsTo'](db['Variable'],{'as':_0x9c9d('0x8a'),'foreignKey':'VariableId'});db[_0x9c9d('0x1cb')][_0x9c9d('0x10e')](db[_0x9c9d('0xa2')],{'as':_0x9c9d('0x1bf'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c0')});db[_0x9c9d('0xa2')][_0x9c9d('0x10e')](db[_0x9c9d('0xa4')],{'as':'Subjects','onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c2')});db['DeskConfiguration'][_0x9c9d('0x10e')](db[_0x9c9d('0xa4')],{'as':_0x9c9d('0x1c3'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c7')});db[_0x9c9d('0xa2')][_0x9c9d('0x10e')](db[_0x9c9d('0xa4')],{'as':_0x9c9d('0x1bb'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c4')});db['DeskConfiguration']['belongsTo'](db[_0x9c9d('0x1cb')],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x1c0')});db[_0x9c9d('0xa2')][_0x9c9d('0x11f')](db[_0x9c9d('0x80')],{'through':_0x9c9d('0x1cc')});db[_0x9c9d('0xa4')][_0x9c9d('0x10e')](db[_0x9c9d('0xa4')],{'as':_0x9c9d('0x1ca'),'foreignKey':'SubjectId'});db[_0x9c9d('0xa4')]['hasMany'](db[_0x9c9d('0xa4')],{'as':_0x9c9d('0x1c6'),'foreignKey':'DescriptionId'});db[_0x9c9d('0xa4')][_0x9c9d('0x10e')](db['DeskField'],{'as':_0x9c9d('0x1c8'),'foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0xa4')]['belongsTo'](db[_0x9c9d('0x8a')],{'as':'Variable','foreignKey':_0x9c9d('0x1c9')});db[_0x9c9d('0x1cd')]['hasMany'](db['ZohoConfiguration'],{'as':_0x9c9d('0x1bf'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c0')});db['ZohoConfiguration'][_0x9c9d('0x10e')](db[_0x9c9d('0xa7')],{'as':_0x9c9d('0x1c1'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0x1ce')][_0x9c9d('0x10e')](db[_0x9c9d('0xa7')],{'as':'Descriptions','onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c7')});db['ZohoConfiguration'][_0x9c9d('0x10e')](db['ZohoField'],{'as':'Fields','onDelete':_0x9c9d('0x10d'),'foreignKey':'FieldId'});db[_0x9c9d('0x1ce')]['belongsTo'](db[_0x9c9d('0x1cd')],{'as':'Account','foreignKey':_0x9c9d('0x1c0')});db['ZohoField']['hasMany'](db[_0x9c9d('0xa7')],{'as':'Subject','foreignKey':_0x9c9d('0x1c2')});db['ZohoField'][_0x9c9d('0x10e')](db['ZohoField'],{'as':'Description','foreignKey':_0x9c9d('0x1c7')});db['ZohoField'][_0x9c9d('0x10e')](db['ZohoField'],{'as':_0x9c9d('0x1c8'),'foreignKey':'FieldId'});db['ZohoField'][_0x9c9d('0x14c')](db['Variable'],{'as':_0x9c9d('0x8a'),'foreignKey':_0x9c9d('0x1c9')});db[_0x9c9d('0xa8')][_0x9c9d('0x10e')](db['ZendeskConfiguration'],{'as':_0x9c9d('0x1bf'),'onDelete':_0x9c9d('0x10d'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x9c9d('0x10e')](db[_0x9c9d('0xac')],{'as':_0x9c9d('0x1c1'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0xaa')][_0x9c9d('0x10e')](db['ZendeskField'],{'as':_0x9c9d('0x1c3'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x9c9d('0x10e')](db[_0x9c9d('0xac')],{'as':'Fields','foreignKey':_0x9c9d('0x1c4')});db['ZendeskConfiguration'][_0x9c9d('0x14c')](db[_0x9c9d('0xa8')],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x1c0')});db['ZendeskConfiguration'][_0x9c9d('0x11f')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x9c9d('0xac')][_0x9c9d('0x10e')](db['ZendeskField'],{'as':_0x9c9d('0x1ca'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0xac')][_0x9c9d('0x10e')](db[_0x9c9d('0xac')],{'as':'Description','foreignKey':_0x9c9d('0x1c7')});db[_0x9c9d('0xac')][_0x9c9d('0x10e')](db[_0x9c9d('0xac')],{'as':_0x9c9d('0x1c8'),'foreignKey':_0x9c9d('0x1c4')});db['ZendeskField'][_0x9c9d('0x14c')](db['Variable'],{'as':_0x9c9d('0x8a'),'foreignKey':_0x9c9d('0x1c9')});db[_0x9c9d('0xae')][_0x9c9d('0x10e')](db[_0x9c9d('0xaf')],{'as':_0x9c9d('0x1bf'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c0')});db[_0x9c9d('0xaf')][_0x9c9d('0x10e')](db['FreshdeskField'],{'as':_0x9c9d('0x1c1'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0xaf')][_0x9c9d('0x10e')](db[_0x9c9d('0xb1')],{'as':_0x9c9d('0x1c3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x9c9d('0xaf')][_0x9c9d('0x10e')](db[_0x9c9d('0xb1')],{'as':'Fields','onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0xaf')]['belongsTo'](db[_0x9c9d('0xae')],{'as':_0x9c9d('0x171'),'foreignKey':'AccountId'});db[_0x9c9d('0xaf')][_0x9c9d('0x11f')](db[_0x9c9d('0x80')],{'through':_0x9c9d('0x1cf')});db['FreshdeskField'][_0x9c9d('0x10e')](db[_0x9c9d('0xb1')],{'as':_0x9c9d('0x1ca'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0xb1')]['hasMany'](db[_0x9c9d('0xb1')],{'as':_0x9c9d('0x1c6'),'foreignKey':_0x9c9d('0x1c7')});db['FreshdeskField']['hasMany'](db[_0x9c9d('0xb1')],{'as':_0x9c9d('0x1c8'),'foreignKey':'FieldId'});db[_0x9c9d('0xb1')][_0x9c9d('0x14c')](db[_0x9c9d('0x8a')],{'as':_0x9c9d('0x8a'),'foreignKey':_0x9c9d('0x1c9')});db[_0x9c9d('0xb3')][_0x9c9d('0x10e')](db[_0x9c9d('0xb5')],{'as':_0x9c9d('0x1bf'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x9c9d('0xb5')][_0x9c9d('0x10e')](db[_0x9c9d('0x1d0')],{'as':_0x9c9d('0x1c1'),'foreignKey':'SubjectId'});db[_0x9c9d('0xb5')][_0x9c9d('0x10e')](db[_0x9c9d('0x1d0')],{'as':_0x9c9d('0x1c3'),'foreignKey':_0x9c9d('0x1c7')});db[_0x9c9d('0xb5')]['hasMany'](db[_0x9c9d('0x1d0')],{'as':_0x9c9d('0x1bb'),'foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0xb5')]['belongsTo'](db['VtigerAccount'],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x1c0')});db[_0x9c9d('0x1d0')][_0x9c9d('0x10e')](db[_0x9c9d('0x1d0')],{'as':_0x9c9d('0x1ca'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0x1d0')][_0x9c9d('0x10e')](db[_0x9c9d('0x1d0')],{'as':_0x9c9d('0x1c6'),'foreignKey':_0x9c9d('0x1c7')});db[_0x9c9d('0x1d0')][_0x9c9d('0x10e')](db[_0x9c9d('0x1d0')],{'as':_0x9c9d('0x1c8'),'foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0x1d0')][_0x9c9d('0x14c')](db[_0x9c9d('0x8a')],{'as':_0x9c9d('0x8a'),'foreignKey':_0x9c9d('0x1c9')});db[_0x9c9d('0xb7')][_0x9c9d('0x10e')](db[_0x9c9d('0xb9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x9c9d('0x1c0')});db[_0x9c9d('0xb9')][_0x9c9d('0x10e')](db['ServicenowField'],{'as':_0x9c9d('0x1c1'),'foreignKey':'SubjectId'});db[_0x9c9d('0xb9')][_0x9c9d('0x10e')](db[_0x9c9d('0xbb')],{'as':_0x9c9d('0x1c3'),'foreignKey':_0x9c9d('0x1c7')});db[_0x9c9d('0xb9')][_0x9c9d('0x10e')](db['ServicenowField'],{'as':_0x9c9d('0x1bb'),'foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0xb9')][_0x9c9d('0x14c')](db['ServicenowAccount'],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x1c0')});db[_0x9c9d('0xbb')][_0x9c9d('0x10e')](db[_0x9c9d('0xbb')],{'as':_0x9c9d('0x1ca'),'foreignKey':_0x9c9d('0x1c2')});db['ServicenowField'][_0x9c9d('0x10e')](db[_0x9c9d('0xbb')],{'as':_0x9c9d('0x1c6'),'foreignKey':_0x9c9d('0x1c7')});db[_0x9c9d('0xbb')]['hasMany'](db[_0x9c9d('0xbb')],{'as':'Field','foreignKey':'FieldId'});db[_0x9c9d('0xbb')][_0x9c9d('0x14c')](db['Variable'],{'as':_0x9c9d('0x8a'),'foreignKey':_0x9c9d('0x1c9')});db[_0x9c9d('0x1d1')]['hasMany'](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c0')});db[_0x9c9d('0x1d1')][_0x9c9d('0x14c')](db[_0x9c9d('0x103')],{'as':_0x9c9d('0x103'),'foreignKey':_0x9c9d('0x162')});db['Dynamics365Configuration'][_0x9c9d('0x10e')](db[_0x9c9d('0x1d2')],{'as':_0x9c9d('0x1c1'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0x1d3')][_0x9c9d('0x10e')](db[_0x9c9d('0x1d2')],{'as':_0x9c9d('0x1c3'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c7')});db['Dynamics365Configuration'][_0x9c9d('0x10e')](db[_0x9c9d('0x1d2')],{'as':_0x9c9d('0x1bb'),'onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0x1d3')]['belongsTo'](db[_0x9c9d('0x1d1')],{'as':'Account','foreignKey':'AccountId'});db[_0x9c9d('0x1d2')]['hasMany'](db[_0x9c9d('0x1d2')],{'as':_0x9c9d('0x1ca'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0x1d2')][_0x9c9d('0x10e')](db[_0x9c9d('0x1d2')],{'as':'Description','foreignKey':_0x9c9d('0x1c7')});db['Dynamics365Field'][_0x9c9d('0x10e')](db[_0x9c9d('0x1d2')],{'as':_0x9c9d('0x1c8'),'foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0x1d2')][_0x9c9d('0x14c')](db[_0x9c9d('0x8a')],{'as':_0x9c9d('0x8a'),'foreignKey':_0x9c9d('0x1c9')});db['FreshsalesAccount']['hasMany'](db[_0x9c9d('0xc1')],{'as':'Configurations','onDelete':_0x9c9d('0x10d'),'foreignKey':_0x9c9d('0x1c0')});db['FreshsalesConfiguration'][_0x9c9d('0x10e')](db[_0x9c9d('0x1d4')],{'as':_0x9c9d('0x1c1'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x9c9d('0x10e')](db[_0x9c9d('0x1d4')],{'as':_0x9c9d('0x1c3'),'foreignKey':_0x9c9d('0x1c7')});db[_0x9c9d('0xc1')][_0x9c9d('0x10e')](db[_0x9c9d('0x1d4')],{'as':'Fields','foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0xc1')][_0x9c9d('0x14c')](db[_0x9c9d('0xbf')],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x1c0')});db[_0x9c9d('0x1d4')][_0x9c9d('0x10e')](db[_0x9c9d('0x1d4')],{'as':_0x9c9d('0x1ca'),'foreignKey':_0x9c9d('0x1c2')});db[_0x9c9d('0x1d4')][_0x9c9d('0x10e')](db[_0x9c9d('0x1d4')],{'as':'Description','foreignKey':_0x9c9d('0x1c7')});db[_0x9c9d('0x1d4')]['hasMany'](db[_0x9c9d('0x1d4')],{'as':'Field','foreignKey':_0x9c9d('0x1c4')});db[_0x9c9d('0x1d4')]['belongsTo'](db[_0x9c9d('0x8a')],{'as':'Variable','foreignKey':_0x9c9d('0x1c9')});db[_0x9c9d('0x1d5')][_0x9c9d('0x14c')](db[_0x9c9d('0x135')],{});db['ChatQueueReport'][_0x9c9d('0x14c')](db['CmList'],{'as':_0x9c9d('0x16d'),'foreignKey':_0x9c9d('0x16e')});db[_0x9c9d('0x1d5')][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'as':_0x9c9d('0x160'),'foreignKey':_0x9c9d('0x172')});db[_0x9c9d('0x1d5')][_0x9c9d('0x14c')](db['ChatInteraction'],{});db[_0x9c9d('0x1d5')][_0x9c9d('0x14c')](db[_0x9c9d('0x191')],{});db[_0x9c9d('0x1d5')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{});db[_0x9c9d('0x1d5')][_0x9c9d('0x14c')](db[_0x9c9d('0x64')],{});db[_0x9c9d('0xc5')]['belongsTo'](db[_0x9c9d('0x12')],{'onDelete':'cascade','foreignKey':_0x9c9d('0x1d6')});db[_0x9c9d('0xc5')]['belongsTo'](db[_0x9c9d('0x12')],{'onDelete':'cascade','foreignKey':_0x9c9d('0x1d7')});db[_0x9c9d('0xcb')][_0x9c9d('0x10e')](db[_0x9c9d('0xc9')],{'foreignKey':_0x9c9d('0x1d8'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0xcb')][_0x9c9d('0x10e')](db[_0x9c9d('0xc7')],{'foreignKey':'SessionId','onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0xcd')][_0x9c9d('0x14c')](db[_0x9c9d('0x4c')],{});db[_0x9c9d('0xcd')][_0x9c9d('0x14c')](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x16d'),'foreignKey':'ListId'});db[_0x9c9d('0xcd')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x9c9d('0x172')});db[_0x9c9d('0xcd')][_0x9c9d('0x14c')](db[_0x9c9d('0x50')],{});db['SmsQueueReport'][_0x9c9d('0x14c')](db[_0x9c9d('0x183')],{});db[_0x9c9d('0xcd')][_0x9c9d('0x14c')](db['User'],{});db[_0x9c9d('0xcd')][_0x9c9d('0x14c')](db[_0x9c9d('0x53')],{});db[_0x9c9d('0xd1')]['hasMany'](db[_0x9c9d('0xcb')],{'foreignKey':_0x9c9d('0x1d9')});db['JscriptyProject'][_0x9c9d('0x10e')](db[_0x9c9d('0xc9')],{'foreignKey':_0x9c9d('0x1d9')});db[_0x9c9d('0xd1')]['hasMany'](db[_0x9c9d('0xc7')],{'foreignKey':_0x9c9d('0x1d9')});db[_0x9c9d('0x140')]['belongsToMany'](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x177'),'through':_0x9c9d('0x1da')});db[_0x9c9d('0xdb')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':'Agents','through':_0x9c9d('0x122')});db[_0x9c9d('0xdb')]['belongsToMany'](db[_0x9c9d('0x129')],{'through':_0x9c9d('0x104'),'as':'VoiceQueues'});db['Team']['belongsToMany'](db[_0x9c9d('0x12c')],{'through':_0x9c9d('0x1db'),'as':_0x9c9d('0x12d')});db[_0x9c9d('0xdb')][_0x9c9d('0x11f')](db['ChatQueue'],{'through':_0x9c9d('0x196'),'as':_0x9c9d('0x1dc')});db[_0x9c9d('0xdb')]['belongsToMany'](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0x9c9d('0x12f')});db[_0x9c9d('0xdb')][_0x9c9d('0x11f')](db[_0x9c9d('0x53')],{'through':_0x9c9d('0x188'),'as':_0x9c9d('0x131')});db['Team'][_0x9c9d('0x11f')](db[_0x9c9d('0x5a')],{'through':'team_has_openchannel_queues','as':_0x9c9d('0x1dd')});db[_0x9c9d('0xdb')]['belongsToMany'](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0x9c9d('0x133')});db[_0x9c9d('0xdb')][_0x9c9d('0x11f')](db[_0x9c9d('0xed')],{'through':_0x9c9d('0x106'),'as':_0x9c9d('0x1de')});db[_0x9c9d('0xde')][_0x9c9d('0x10e')](db[_0x9c9d('0x6b')],{'as':_0x9c9d('0x148'),'foreignKey':_0x9c9d('0x1a0')});db[_0x9c9d('0xde')][_0x9c9d('0x10e')](db[_0x9c9d('0x149')],{'as':_0x9c9d('0x112'),'foreignKey':_0x9c9d('0x1a0')});db[_0x9c9d('0xde')]['hasMany'](db['CmHopperHistory'],{'as':_0x9c9d('0x14a'),'foreignKey':_0x9c9d('0x1a0')});db[_0x9c9d('0xde')][_0x9c9d('0x10e')](db[_0x9c9d('0x1a2')],{'as':_0x9c9d('0x14b'),'foreignKey':'CampaignId'});db[_0x9c9d('0xde')][_0x9c9d('0x14c')](db['Trunk'],{'as':_0x9c9d('0x26'),'foreignKey':_0x9c9d('0x14d')});db[_0x9c9d('0xde')][_0x9c9d('0x14c')](db[_0x9c9d('0x26')],{'as':_0x9c9d('0x14e'),'foreignKey':_0x9c9d('0x1df')});db['Campaign'][_0x9c9d('0x14c')](db[_0x9c9d('0x76')],{'as':_0x9c9d('0x76'),'foreignKey':_0x9c9d('0x14f')});db[_0x9c9d('0xde')]['belongsTo'](db['SquareProject'],{'as':_0x9c9d('0x140'),'foreignKey':_0x9c9d('0x1e0')});db[_0x9c9d('0xde')][_0x9c9d('0x11f')](db['CmList'],{'as':'Lists','through':_0x9c9d('0x1e1')});db['Campaign'][_0x9c9d('0x11f')](db[_0x9c9d('0x121')],{'as':_0x9c9d('0x157'),'through':_0x9c9d('0x1e2')});db[_0x9c9d('0xe0')][_0x9c9d('0x14c')](db[_0x9c9d('0x17b')],{'as':_0x9c9d('0x17b'),'foreignKey':'ChatOfflineMessageId'});db[_0x9c9d('0xe3')][_0x9c9d('0x14c')](db[_0x9c9d('0x3b')],{});db['MailTransferReport']['belongsTo'](db[_0x9c9d('0x39')],{});db['MailTransferReport'][_0x9c9d('0x14c')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x9c9d('0xe3')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'foreignKey':_0x9c9d('0x1e3'),'as':_0x9c9d('0x1e4')});db['MailTransferReport'][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'foreignKey':'ToUserId','as':_0x9c9d('0x1e5')});db[_0x9c9d('0xe3')][_0x9c9d('0x14c')](db[_0x9c9d('0x12c')],{'foreignKey':_0x9c9d('0x1e6'),'as':_0x9c9d('0x1e7')});db[_0x9c9d('0xe3')][_0x9c9d('0x14c')](db[_0x9c9d('0x35')],{'foreignKey':_0x9c9d('0x1e8'),'as':_0x9c9d('0x1e9')});db['ChatTransferReport']['belongsTo'](db[_0x9c9d('0x191')],{});db[_0x9c9d('0xe5')][_0x9c9d('0x14c')](db[_0x9c9d('0x60')],{});db[_0x9c9d('0xe5')][_0x9c9d('0x14c')](db[_0x9c9d('0x135')],{'foreignKey':'FromChatWebsiteId','as':_0x9c9d('0x1ea')});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x9c9d('0x1e3'),'as':_0x9c9d('0x1e4')});db['ChatTransferReport']['belongsTo'](db[_0x9c9d('0x12')],{'foreignKey':_0x9c9d('0x1eb'),'as':'ToAgent'});db[_0x9c9d('0xe5')]['belongsTo'](db[_0x9c9d('0x64')],{'foreignKey':_0x9c9d('0x1ec'),'as':'ToQueue'});db['ChatTransferReport'][_0x9c9d('0x14c')](db['ChatWebsite'],{'foreignKey':_0x9c9d('0x1ed'),'as':_0x9c9d('0x1e9')});db[_0x9c9d('0xe7')][_0x9c9d('0x14c')](db[_0x9c9d('0x48')],{});db[_0x9c9d('0xe7')][_0x9c9d('0x14c')](db[_0x9c9d('0x116')],{});db[_0x9c9d('0xe7')][_0x9c9d('0x14c')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x9c9d('0x1ea')});db[_0x9c9d('0xe7')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x9c9d('0xe7')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'foreignKey':_0x9c9d('0x1eb'),'as':'ToAgent'});db[_0x9c9d('0xe7')][_0x9c9d('0x14c')](db[_0x9c9d('0x49')],{'foreignKey':'ToFaxQueueId','as':_0x9c9d('0x1e7')});db[_0x9c9d('0xe7')][_0x9c9d('0x14c')](db[_0x9c9d('0x43')],{'foreignKey':_0x9c9d('0x1ee'),'as':_0x9c9d('0x1e9')});db[_0x9c9d('0xe9')][_0x9c9d('0x14c')](db['OpenchannelMessage'],{});db[_0x9c9d('0xe9')]['belongsTo'](db[_0x9c9d('0x57')],{});db[_0x9c9d('0xe9')][_0x9c9d('0x14c')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x9c9d('0xe9')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'foreignKey':'FromUserId','as':_0x9c9d('0x1e4')});db[_0x9c9d('0xe9')]['belongsTo'](db[_0x9c9d('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x9c9d('0xe9')][_0x9c9d('0x14c')](db['OpenchannelQueue'],{'foreignKey':_0x9c9d('0x1ef'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x9c9d('0x14c')](db[_0x9c9d('0x55')],{'foreignKey':_0x9c9d('0x1f0'),'as':_0x9c9d('0x1e9')});db[_0x9c9d('0xeb')][_0x9c9d('0x14c')](db[_0x9c9d('0x183')],{});db[_0x9c9d('0xeb')]['belongsTo'](db[_0x9c9d('0x50')],{});db[_0x9c9d('0xeb')]['belongsTo'](db[_0x9c9d('0x4c')],{'foreignKey':_0x9c9d('0x1f1'),'as':'FromAccount'});db[_0x9c9d('0xeb')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'foreignKey':_0x9c9d('0x1e3'),'as':_0x9c9d('0x1e4')});db[_0x9c9d('0xeb')]['belongsTo'](db[_0x9c9d('0x12')],{'foreignKey':_0x9c9d('0x1eb'),'as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db[_0x9c9d('0x53')],{'foreignKey':_0x9c9d('0x1f2'),'as':'ToQueue'});db[_0x9c9d('0xeb')][_0x9c9d('0x14c')](db[_0x9c9d('0x4c')],{'foreignKey':_0x9c9d('0x1f3'),'as':_0x9c9d('0x1e9')});db['CmList'][_0x9c9d('0x10e')](db[_0x9c9d('0x73')],{'as':'Dispositions','foreignKey':_0x9c9d('0x16e'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0x121')][_0x9c9d('0x10e')](db[_0x9c9d('0x1f4')],{'as':'CustomFields','foreignKey':_0x9c9d('0x16e')});db[_0x9c9d('0x121')][_0x9c9d('0x10e')](db[_0x9c9d('0x69')],{'as':_0x9c9d('0x120'),'onDelete':'cascade','foreignKey':_0x9c9d('0x16e')});db[_0x9c9d('0x121')][_0x9c9d('0x10e')](db[_0x9c9d('0x149')],{'as':_0x9c9d('0x112'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x9c9d('0x113')],{'as':_0x9c9d('0x1f5'),'foreignKey':_0x9c9d('0x16e')});db[_0x9c9d('0x121')][_0x9c9d('0x10e')](db[_0x9c9d('0x6d')],{'as':_0x9c9d('0x6d'),'foreignKey':_0x9c9d('0x16e')});db[_0x9c9d('0x121')][_0x9c9d('0x11f')](db[_0x9c9d('0x129')],{'as':_0x9c9d('0x1f6'),'through':_0x9c9d('0x154')});db[_0x9c9d('0x121')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x155'),'through':_0x9c9d('0x134')});db[_0x9c9d('0xed')][_0x9c9d('0x10e')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0xed')][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x155'),'through':_0x9c9d('0x12b')});db[_0x9c9d('0xed')][_0x9c9d('0x11f')](db[_0x9c9d('0xdb')],{'through':_0x9c9d('0x106'),'as':_0x9c9d('0x156')});db['UserProfile']['hasMany'](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x177'),'foreignKey':_0x9c9d('0x11c')});db[_0x9c9d('0xef')][_0x9c9d('0x10e')](db[_0x9c9d('0xf0')],{'as':_0x9c9d('0x1f7'),'foreignKey':_0x9c9d('0x11c'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0xf0')][_0x9c9d('0x10e')](db[_0x9c9d('0xf2')],{'as':'Resources','foreignKey':_0x9c9d('0x1f8'),'onDelete':_0x9c9d('0x10d')});db[_0x9c9d('0xf6')][_0x9c9d('0x10e')](db['Disposition'],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':'cascade'});db['WhatsappAccount'][_0x9c9d('0x10e')](db[_0x9c9d('0x71')],{'as':'Answers','foreignKey':_0x9c9d('0x1f9')});db[_0x9c9d('0xf6')][_0x9c9d('0x10e')](db[_0x9c9d('0xfc')],{'as':_0x9c9d('0x15a'),'foreignKey':_0x9c9d('0x1f9')});db['WhatsappAccount'][_0x9c9d('0x10e')](db[_0x9c9d('0xfa')],{'as':_0x9c9d('0x16a')});db[_0x9c9d('0xf6')][_0x9c9d('0x10e')](db[_0x9c9d('0xf8')],{'as':_0x9c9d('0x16c')});db[_0x9c9d('0xf6')]['belongsTo'](db['CmList'],{'as':_0x9c9d('0x16d'),'foreignKey':_0x9c9d('0x16e')});db['WhatsappAccount']['belongsTo'](db[_0x9c9d('0x150')],{'as':_0x9c9d('0x151'),'foreignKey':_0x9c9d('0x152')});db[_0x9c9d('0xf6')][_0x9c9d('0x11f')](db['User'],{'as':_0x9c9d('0x155'),'through':_0x9c9d('0x13f')});db[_0x9c9d('0xf8')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x9c9d('0x14c')](db[_0x9c9d('0x101')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x9c9d('0x14c')](db[_0x9c9d('0xf6')],{'onDelete':'restrict'});db[_0x9c9d('0xf8')][_0x9c9d('0x14c')](db['Interval'],{'onDelete':_0x9c9d('0x163'),'foreignKey':_0x9c9d('0x14f')});db[_0x9c9d('0xf8')][_0x9c9d('0x14c')](db[_0x9c9d('0x80')],{'onDelete':_0x9c9d('0x163'),'foreignKey':_0x9c9d('0x17d')});db[_0x9c9d('0xfa')][_0x9c9d('0x10e')](db['WhatsappMessage'],{'as':_0x9c9d('0x15a'),'onDelete':'cascade','foreignKey':_0x9c9d('0x1fa')});db[_0x9c9d('0xfa')][_0x9c9d('0x14c')](db['WhatsappAccount'],{'as':_0x9c9d('0x171'),'foreignKey':_0x9c9d('0x1f9')});db[_0x9c9d('0xfa')][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'as':_0x9c9d('0x160'),'foreignKey':_0x9c9d('0x172')});db[_0x9c9d('0xfa')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x9c9d('0xfa')][_0x9c9d('0x11f')](db[_0x9c9d('0x80')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x9c9d('0xfa')][_0x9c9d('0x11f')](db['Tag'],{'through':_0x9c9d('0x1b2'),'as':_0x9c9d('0x176')});db['WhatsappInteraction'][_0x9c9d('0x11f')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x177'),'through':_0x9c9d('0x128'),'foreignKey':_0x9c9d('0x1fa')});db[_0x9c9d('0xfc')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'as':_0x9c9d('0x12')});db[_0x9c9d('0xfc')][_0x9c9d('0x14c')](db[_0x9c9d('0x69')],{'onDelete':_0x9c9d('0x10d'),'as':_0x9c9d('0x160')});db[_0x9c9d('0xfc')][_0x9c9d('0x14c')](db[_0x9c9d('0xfa')],{'onDelete':_0x9c9d('0x10d'),'as':'Interaction','foreignKey':_0x9c9d('0x1fa')});db[_0x9c9d('0xfc')][_0x9c9d('0x14c')](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport']['belongsTo'](db[_0x9c9d('0xf6')],{});db[_0x9c9d('0x1fb')][_0x9c9d('0x14c')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x9c9d('0x1fb')]['belongsTo'](db['CmContact'],{'as':_0x9c9d('0x160'),'foreignKey':_0x9c9d('0x172')});db[_0x9c9d('0x1fb')][_0x9c9d('0x14c')](db[_0x9c9d('0xfa')],{});db[_0x9c9d('0x1fb')][_0x9c9d('0x14c')](db[_0x9c9d('0x101')],{});db[_0x9c9d('0x1fb')][_0x9c9d('0x14c')](db[_0x9c9d('0xfc')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x9c9d('0x12')],{});db[_0x9c9d('0xff')]['belongsTo'](db[_0x9c9d('0xfc')],{});db[_0x9c9d('0xff')][_0x9c9d('0x14c')](db[_0x9c9d('0xfa')],{});db[_0x9c9d('0xff')]['belongsTo'](db[_0x9c9d('0xf6')],{'foreignKey':_0x9c9d('0x1fc'),'as':_0x9c9d('0x1ea')});db[_0x9c9d('0xff')][_0x9c9d('0x14c')](db[_0x9c9d('0xf6')],{'foreignKey':_0x9c9d('0x1fd'),'as':'ToAccount'});db['WhatsappTransferReport'][_0x9c9d('0x14c')](db[_0x9c9d('0x101')],{'foreignKey':'ToQueueId','as':_0x9c9d('0x1e7')});db[_0x9c9d('0xff')][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'foreignKey':_0x9c9d('0x1e3'),'as':_0x9c9d('0x1e4')});db['WhatsappTransferReport'][_0x9c9d('0x14c')](db[_0x9c9d('0x12')],{'foreignKey':_0x9c9d('0x1eb'),'as':_0x9c9d('0x1e5')});db[_0x9c9d('0x101')][_0x9c9d('0x11f')](db['User'],{'as':_0x9c9d('0x155'),'through':_0x9c9d('0x32'),'foreignKey':_0x9c9d('0x1fe')});db[_0x9c9d('0x101')][_0x9c9d('0x11f')](db[_0x9c9d('0xdb')],{'through':_0x9c9d('0x1ff'),'as':_0x9c9d('0x156')});db['UserSetting'][_0x9c9d('0x14c')](db['User'],{'as':_0x9c9d('0x200'),'foreignKey':_0x9c9d('0x10b'),'onDelete':_0x9c9d('0x10d'),'hooks':!![]});db[_0x9c9d('0x103')][_0x9c9d('0x10a')](db[_0x9c9d('0x1d1')],{'as':'Dynamics365Account','onDelete':'restrict'});db['CloudProvider'][_0x9c9d('0x10a')](db[_0x9c9d('0x161')],{'as':_0x9c9d('0x166'),'onDelete':'restrict'});db['CloudProvider'][_0x9c9d('0x10a')](db['MailServerOut'],{'as':_0x9c9d('0x167'),'onDelete':'restrict'});module[_0x9c9d('0x201')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 1871086..8a95192 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb22f=['/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','root','/www','static','/demo','snippet','3.0.0','join','/:url(api|auth|components|app|bower_components|assets)/*','route','get','appPath','/index.html','path','express','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/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/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles'];(function(_0x5781d0,_0x235a43){var _0x1e175b=function(_0x1c4dee){while(--_0x1c4dee){_0x5781d0['push'](_0x5781d0['shift']());}};_0x1e175b(++_0x235a43);}(_0xb22f,0x141));var _0xfb22=function(_0x1c7994,_0x454316){_0x1c7994=_0x1c7994-0x0;var _0x108f9a=_0xb22f[_0x1c7994];return _0x108f9a;};'use strict';var path=require(_0xfb22('0x0'));var express=require(_0xfb22('0x1'));var errors=require('./errors');var config=require(_0xfb22('0x2'));var setupLoggers=require(_0xfb22('0x3'))['setupLoggers'];var clientSideLogs=require(_0xfb22('0x4'));exports[_0xfb22('0x5')]=function(_0x45ea6d){return setupLoggers(_0x45ea6d)[_0xfb22('0x6')](function(){_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x8'),require(_0xfb22('0x9')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xa'),require(_0xfb22('0xb')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xc'),require('./api/voiceContext'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xd'),require(_0xfb22('0xe')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xf'),require(_0xfb22('0x10')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x11'),require(_0xfb22('0x12')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x13'),require(_0xfb22('0x14')));_0x45ea6d['use'](_0xfb22('0x15'),require(_0xfb22('0x16')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x17'),require(_0xfb22('0x18')));_0x45ea6d['use']('/api/voice/mails/messages',require(_0xfb22('0x19')));_0x45ea6d['use']('/api/voice/calls/reports',require(_0xfb22('0x1a')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x1b'),require(_0xfb22('0x1c')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x1d'),require(_0xfb22('0x1e')));_0x45ea6d['use']('/api/voice/queues/reports',require(_0xfb22('0x1f')));_0x45ea6d['use']('/api/members/reports',require('./api/memberReport'));_0x45ea6d[_0xfb22('0x7')]('/api/trunks',require(_0xfb22('0x20')));_0x45ea6d[_0xfb22('0x7')]('/api/voice/transfers/reports',require(_0xfb22('0x21')));_0x45ea6d['use'](_0xfb22('0x22'),require(_0xfb22('0x23')));_0x45ea6d['use'](_0xfb22('0x24'),require('./api/mailAccount'));_0x45ea6d[_0xfb22('0x7')]('/api/mail/queues',require(_0xfb22('0x25')));_0x45ea6d['use'](_0xfb22('0x26'),require(_0xfb22('0x27')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x28'),require(_0xfb22('0x29')));_0x45ea6d[_0xfb22('0x7')]('/api/mail/messages',require(_0xfb22('0x2a')));_0x45ea6d[_0xfb22('0x7')]('/api/mail/applications',require(_0xfb22('0x2b')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x2c'),require('./api/mailQueueReport'));_0x45ea6d['use'](_0xfb22('0x2d'),require(_0xfb22('0x2e')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x2f'),require(_0xfb22('0x30')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x31'),require('./api/faxAccount'));_0x45ea6d['use'](_0xfb22('0x32'),require('./api/faxApplication'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x33'),require(_0xfb22('0x34')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x35'),require(_0xfb22('0x36')));_0x45ea6d[_0xfb22('0x7')]('/api/fax/queues',require(_0xfb22('0x37')));_0x45ea6d[_0xfb22('0x7')]('/api/fax/reports/queue',require(_0xfb22('0x38')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x39'),require(_0xfb22('0x3a')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x3b'),require(_0xfb22('0x3c')));_0x45ea6d[_0xfb22('0x7')]('/api/sms/interactions',require(_0xfb22('0x3d')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x3e'),require('./api/smsMessage'));_0x45ea6d[_0xfb22('0x7')]('/api/sms/queues',require('./api/smsQueue'));_0x45ea6d[_0xfb22('0x7')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x45ea6d[_0xfb22('0x7')]('/api/openchannel/applications',require(_0xfb22('0x3f')));_0x45ea6d[_0xfb22('0x7')]('/api/openchannel/interactions',require(_0xfb22('0x40')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x41'),require('./api/openchannelMessage'));_0x45ea6d['use'](_0xfb22('0x42'),require(_0xfb22('0x43')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x44'),require(_0xfb22('0x45')));_0x45ea6d['use'](_0xfb22('0x46'),require(_0xfb22('0x47')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x48'),require(_0xfb22('0x49')));_0x45ea6d[_0xfb22('0x7')]('/api/chat/interactions',require(_0xfb22('0x4a')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x4b'),require(_0xfb22('0x4c')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x4d'),require(_0xfb22('0x4e')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x4f'),require(_0xfb22('0x50')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x51'),require(_0xfb22('0x52')));_0x45ea6d[_0xfb22('0x7')]('/api/chat/proactive_actions',require(_0xfb22('0x53')));_0x45ea6d['use'](_0xfb22('0x54'),require(_0xfb22('0x55')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x56'),require(_0xfb22('0x57')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x58'),require(_0xfb22('0x59')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x5a'),require(_0xfb22('0x5b')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x5c'),require('./api/cmHopperFinal'));_0x45ea6d['use'](_0xfb22('0x5d'),require(_0xfb22('0x5e')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x5f'),require(_0xfb22('0x60')));_0x45ea6d[_0xfb22('0x7')]('/api/actions',require(_0xfb22('0x61')));_0x45ea6d['use'](_0xfb22('0x62'),require(_0xfb22('0x63')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x64'),require(_0xfb22('0x65')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x66'),require('./api/disposition'));_0x45ea6d['use'](_0xfb22('0x67'),require(_0xfb22('0x68')));_0x45ea6d[_0xfb22('0x7')]('/api/intervals',require(_0xfb22('0x69')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x6a'),require(_0xfb22('0x6b')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x6c'),require(_0xfb22('0x6d')));_0x45ea6d['use'](_0xfb22('0x6e'),require(_0xfb22('0x6f')));_0x45ea6d['use']('/api/schedules',require(_0xfb22('0x70')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x71'),require('./api/sound'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x72'),require(_0xfb22('0x73')));_0x45ea6d['use'](_0xfb22('0x74'),require(_0xfb22('0x75')));_0x45ea6d['use'](_0xfb22('0x76'),require(_0xfb22('0x77')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x78'),require(_0xfb22('0x79')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x7a'),require(_0xfb22('0x7b')));_0x45ea6d[_0xfb22('0x7')]('/api/triggers',require('./api/trigger'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x7c'),require(_0xfb22('0x7d')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x7e'),require(_0xfb22('0x7f')));_0x45ea6d[_0xfb22('0x7')]('/api/integrations/reports',require('./api/integrationReport'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x80'),require(_0xfb22('0x81')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x82'),require(_0xfb22('0x83')));_0x45ea6d[_0xfb22('0x7')]('/api/analytics/extracted_reports',require(_0xfb22('0x84')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x85'),require(_0xfb22('0x86')));_0x45ea6d['use'](_0xfb22('0x87'),require(_0xfb22('0x88')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x89'),require('./api/analyticTreeReport'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x8a'),require(_0xfb22('0x8b')));_0x45ea6d[_0xfb22('0x7')]('/api/integrations/salesforce/configurations',require(_0xfb22('0x8c')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x8d'),require(_0xfb22('0x8e')));_0x45ea6d['use'](_0xfb22('0x8f'),require(_0xfb22('0x90')));_0x45ea6d[_0xfb22('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xfb22('0x91')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x92'),require(_0xfb22('0x93')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x94'),require(_0xfb22('0x95')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x96'),require(_0xfb22('0x97')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x98'),require(_0xfb22('0x99')));_0x45ea6d['use'](_0xfb22('0x9a'),require('./api/intZohoAccount'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x9b'),require('./api/intZohoConfiguration'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x9c'),require(_0xfb22('0x9d')));_0x45ea6d['use']('/api/integrations/zendesk/accounts',require(_0xfb22('0x9e')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x9f'),require(_0xfb22('0xa0')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xa1'),require(_0xfb22('0xa2')));_0x45ea6d['use']('/api/integrations/freshdesk/accounts',require(_0xfb22('0xa3')));_0x45ea6d['use'](_0xfb22('0xa4'),require(_0xfb22('0xa5')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xa6'),require(_0xfb22('0xa7')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xa8'),require(_0xfb22('0xa9')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xaa'),require(_0xfb22('0xab')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xac'),require('./api/intVtigerField'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xad'),require('./api/intServicenowAccount'));_0x45ea6d['use'](_0xfb22('0xae'),require(_0xfb22('0xaf')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xb0'),require(_0xfb22('0xb1')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xb2'),require(_0xfb22('0xb3')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xb4'),require(_0xfb22('0xb5')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xb6'),require(_0xfb22('0xb7')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xb8'),require(_0xfb22('0xb9')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xba'),require(_0xfb22('0xbb')));_0x45ea6d[_0xfb22('0x7')]('/api/integrations/freshsales/fields',require(_0xfb22('0xbc')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xbd'),require(_0xfb22('0xbe')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xbf'),require('./api/chatQueueReport'));_0x45ea6d['use']('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x45ea6d[_0xfb22('0x7')]('/api/jscripty/answers/reports',require(_0xfb22('0xc0')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xc1'),require(_0xfb22('0xc2')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xc3'),require(_0xfb22('0xc4')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xc5'),require(_0xfb22('0xc6')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xc7'),require(_0xfb22('0xc8')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xc9'),require('./api/squareReportDetail'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xca'),require(_0xfb22('0xcb')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xcc'),require(_0xfb22('0xcd')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xce'),require(_0xfb22('0xcf')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xd0'),require(_0xfb22('0xd1')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xd2'),require(_0xfb22('0xd3')));_0x45ea6d['use'](_0xfb22('0xd4'),require(_0xfb22('0xd5')));_0x45ea6d[_0xfb22('0x7')]('/api/teams',require(_0xfb22('0xd6')));_0x45ea6d['use']('/api/license',require('./api/license'));_0x45ea6d[_0xfb22('0x7')]('/api/campaigns',require('./api/campaign'));_0x45ea6d['use'](_0xfb22('0xd7'),require(_0xfb22('0xd8')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xd9'),require('./api/attachment'));_0x45ea6d['use'](_0xfb22('0xda'),require(_0xfb22('0xdb')));_0x45ea6d[_0xfb22('0x7')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x45ea6d[_0xfb22('0x7')]('/api/chat/reports/transfer',require(_0xfb22('0xdc')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xdd'),require('./api/faxTransferReport'));_0x45ea6d['use'](_0xfb22('0xde'),require(_0xfb22('0xdf')));_0x45ea6d['use'](_0xfb22('0xe0'),require('./api/smsTransferReport'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xe1'),require(_0xfb22('0xe2')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xe3'),require('./api/voicePrefix'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xe4'),require('./api/userProfile'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xe5'),require(_0xfb22('0xe6')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xe7'),require(_0xfb22('0xe8')));_0x45ea6d[_0xfb22('0x7')]('/api/userNotifications',require(_0xfb22('0xe9')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xea'),require(_0xfb22('0xeb')));_0x45ea6d['use']('/api/whatsapp/applications',require(_0xfb22('0xec')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xed'),require('./api/whatsappInteraction'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xee'),require(_0xfb22('0xef')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xf0'),require(_0xfb22('0xf1')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xf2'),require(_0xfb22('0xf3')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xf4'),require('./api/whatsappQueue'));_0x45ea6d[_0xfb22('0x7')]('/api/cloudProviders',require(_0xfb22('0xf5')));_0x45ea6d['use'](_0xfb22('0xf6'),require('./api/realtime'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xf7'),require('./api/user-setting'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xf8'),require(_0xfb22('0xf9')));_0x45ea6d['use'](_0xfb22('0xfa'),require(_0xfb22('0xfb')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xfc'),require(_0xfb22('0xfd')));_0x45ea6d['use'](_0xfb22('0xfe'),require('./api/jira'));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0xff'),require(_0xfb22('0x100')));_0x45ea6d['use']('/api/version',require('./api/version'));_0x45ea6d['use'](_0xfb22('0x101'),require('./api/system'));_0x45ea6d['use'](_0xfb22('0x102'),require(_0xfb22('0x103')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x104'),require('./api/webbar'));_0x45ea6d['use'](_0xfb22('0x105'),clientSideLogs);_0x45ea6d['use'](_0xfb22('0x106'),express['static'](path['join'](config[_0xfb22('0x107')],'/apidoc')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x108'),express[_0xfb22('0x109')](path['join'](config[_0xfb22('0x107')],'/www')));_0x45ea6d[_0xfb22('0x7')](_0xfb22('0x10a'),express['static'](path['join'](config['root'],_0xfb22('0x10a'))));_0x45ea6d[_0xfb22('0x7')]('/snippet',express[_0xfb22('0x109')](path['join'](config[_0xfb22('0x107')],_0xfb22('0x10b'),_0xfb22('0x10c'))));_0x45ea6d[_0xfb22('0x7')]('/plugins',express[_0xfb22('0x109')](path[_0xfb22('0x10d')](config[_0xfb22('0x107')],'/server/files/plugins')));_0x45ea6d['route'](_0xfb22('0x10e'))['get'](errors[0x194]);_0x45ea6d[_0xfb22('0x10f')]('/*')[_0xfb22('0x110')](function(_0x45f107,_0x24359f){_0x24359f['sendFile'](path['resolve'](_0x45ea6d['get'](_0xfb22('0x111'))+_0xfb22('0x112')));});return _0x45ea6d;});}; \ No newline at end of file +var _0x78d1=['/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/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/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/rpc','/api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','snippet','3.0.0','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','then','use','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage'];(function(_0x472b0e,_0x296c5c){var _0x1a8fa5=function(_0x3a0650){while(--_0x3a0650){_0x472b0e['push'](_0x472b0e['shift']());}};_0x1a8fa5(++_0x296c5c);}(_0x78d1,0xcb));var _0x178d=function(_0x197ad4,_0x37f336){_0x197ad4=_0x197ad4-0x0;var _0x2d12d6=_0x78d1[_0x197ad4];return _0x2d12d6;};'use strict';var path=require(_0x178d('0x0'));var express=require(_0x178d('0x1'));var errors=require(_0x178d('0x2'));var config=require(_0x178d('0x3'));var setupLoggers=require(_0x178d('0x4'))[_0x178d('0x5')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x4e7d2f){return setupLoggers(_0x4e7d2f)[_0x178d('0x6')](function(){_0x4e7d2f[_0x178d('0x7')](_0x178d('0x8'),require('./api/user'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x9'),require('./api/voiceChanSpy'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xa'),require('./api/voiceContext'));_0x4e7d2f[_0x178d('0x7')]('/api/voice/extensions',require(_0x178d('0xb')));_0x4e7d2f[_0x178d('0x7')]('/api/voice/mohs',require(_0x178d('0xc')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xd'),require(_0x178d('0xe')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xf'),require('./api/voiceRecording'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x10'),require('./api/screenRecording'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x11'),require('./api/voiceMail'));_0x4e7d2f['use'](_0x178d('0x12'),require(_0x178d('0x13')));_0x4e7d2f['use']('/api/voice/calls/reports',require(_0x178d('0x14')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x15'),require(_0x178d('0x16')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x17'),require(_0x178d('0x18')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x19'),require(_0x178d('0x1a')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x1b'),require(_0x178d('0x1c')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x1d'),require('./api/trunk'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x1e'),require(_0x178d('0x1f')));_0x4e7d2f[_0x178d('0x7')]('/api/mail/out_servers',require(_0x178d('0x20')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x21'),require(_0x178d('0x22')));_0x4e7d2f['use'](_0x178d('0x23'),require(_0x178d('0x24')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x25'),require('./api/mailSubstatus'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x26'),require(_0x178d('0x27')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x28'),require(_0x178d('0x29')));_0x4e7d2f['use']('/api/mail/applications',require(_0x178d('0x2a')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x2b'),require(_0x178d('0x2c')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x2d'),require('./api/dashboard'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x2e'),require(_0x178d('0x2f')));_0x4e7d2f['use'](_0x178d('0x30'),require('./api/faxAccount'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x31'),require(_0x178d('0x32')));_0x4e7d2f['use'](_0x178d('0x33'),require('./api/faxInteraction'));_0x4e7d2f['use'](_0x178d('0x34'),require('./api/faxMessage'));_0x4e7d2f['use']('/api/fax/queues',require(_0x178d('0x35')));_0x4e7d2f['use']('/api/fax/reports/queue',require(_0x178d('0x36')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x37'),require(_0x178d('0x38')));_0x4e7d2f['use'](_0x178d('0x39'),require('./api/smsApplication'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x3a'),require(_0x178d('0x3b')));_0x4e7d2f['use'](_0x178d('0x3c'),require(_0x178d('0x3d')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x3e'),require(_0x178d('0x3f')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x40'),require('./api/openchannelAccount'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x41'),require(_0x178d('0x42')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x43'),require(_0x178d('0x44')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x45'),require(_0x178d('0x46')));_0x4e7d2f[_0x178d('0x7')]('/api/openchannel/queues',require(_0x178d('0x47')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x48'),require('./api/chatWebsite'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x49'),require(_0x178d('0x4a')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x4b'),require(_0x178d('0x4c')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x4d'),require(_0x178d('0x4e')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x4f'),require(_0x178d('0x50')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x51'),require(_0x178d('0x52')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x53'),require(_0x178d('0x54')));_0x4e7d2f['use'](_0x178d('0x55'),require('./api/chatGroup'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x56'),require('./api/chatProactiveAction'));_0x4e7d2f['use'](_0x178d('0x57'),require(_0x178d('0x58')));_0x4e7d2f[_0x178d('0x7')]('/api/cm/contacts',require(_0x178d('0x59')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x5a'),require(_0x178d('0x5b')));_0x4e7d2f[_0x178d('0x7')]('/api/cm/hopper_black',require(_0x178d('0x5c')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x5d'),require(_0x178d('0x5e')));_0x4e7d2f['use'](_0x178d('0x5f'),require('./api/cmHopperHistory'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x60'),require(_0x178d('0x61')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x62'),require(_0x178d('0x63')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x64'),require(_0x178d('0x65')));_0x4e7d2f['use'](_0x178d('0x66'),require(_0x178d('0x67')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x68'),require(_0x178d('0x69')));_0x4e7d2f[_0x178d('0x7')]('/api/conditions',require(_0x178d('0x6a')));_0x4e7d2f[_0x178d('0x7')]('/api/intervals',require(_0x178d('0x6b')));_0x4e7d2f[_0x178d('0x7')]('/api/pauses',require('./api/pause'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x6c'),require(_0x178d('0x6d')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x6e'),require(_0x178d('0x6f')));_0x4e7d2f['use'](_0x178d('0x70'),require(_0x178d('0x71')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x72'),require(_0x178d('0x73')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x74'),require(_0x178d('0x75')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x76'),require('./api/contactItemType'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x77'),require(_0x178d('0x78')));_0x4e7d2f[_0x178d('0x7')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x4e7d2f[_0x178d('0x7')]('/api/templates',require(_0x178d('0x79')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x7a'),require(_0x178d('0x7b')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x7c'),require(_0x178d('0x7d')));_0x4e7d2f['use'](_0x178d('0x7e'),require(_0x178d('0x7f')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x80'),require(_0x178d('0x81')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x82'),require('./api/analyticCustomReport'));_0x4e7d2f['use']('/api/analytics/default_reports',require(_0x178d('0x83')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x84'),require('./api/analyticExtractedReport'));_0x4e7d2f['use'](_0x178d('0x85'),require(_0x178d('0x86')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x87'),require('./api/analyticFieldReport'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x88'),require(_0x178d('0x89')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x8a'),require('./api/intSalesforceAccount'));_0x4e7d2f['use'](_0x178d('0x8b'),require(_0x178d('0x8c')));_0x4e7d2f[_0x178d('0x7')]('/api/integrations/salesforce/fields',require(_0x178d('0x8d')));_0x4e7d2f[_0x178d('0x7')]('/api/integrations/sugarcrm/accounts',require(_0x178d('0x8e')));_0x4e7d2f['use'](_0x178d('0x8f'),require(_0x178d('0x90')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x91'),require(_0x178d('0x92')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x93'),require(_0x178d('0x94')));_0x4e7d2f[_0x178d('0x7')]('/api/integrations/desk/configurations',require(_0x178d('0x95')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x96'),require(_0x178d('0x97')));_0x4e7d2f[_0x178d('0x7')]('/api/integrations/zoho/accounts',require(_0x178d('0x98')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x99'),require(_0x178d('0x9a')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x9b'),require('./api/intZohoField'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x9c'),require(_0x178d('0x9d')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0x9e'),require('./api/intZendeskConfiguration'));_0x4e7d2f['use']('/api/integrations/zendesk/fields',require(_0x178d('0x9f')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xa0'),require('./api/intFreshdeskAccount'));_0x4e7d2f[_0x178d('0x7')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x4e7d2f[_0x178d('0x7')]('/api/integrations/freshdesk/fields',require(_0x178d('0xa1')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xa2'),require(_0x178d('0xa3')));_0x4e7d2f['use']('/api/integrations/vtiger/configurations',require(_0x178d('0xa4')));_0x4e7d2f[_0x178d('0x7')]('/api/integrations/vtiger/fields',require(_0x178d('0xa5')));_0x4e7d2f['use']('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xa6'),require(_0x178d('0xa7')));_0x4e7d2f['use'](_0x178d('0xa8'),require('./api/intServicenowField'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xa9'),require(_0x178d('0xaa')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xab'),require(_0x178d('0xac')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xad'),require(_0x178d('0xae')));_0x4e7d2f[_0x178d('0x7')]('/api/integrations/freshsales/accounts',require(_0x178d('0xaf')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xb0'),require(_0x178d('0xb1')));_0x4e7d2f['use']('/api/integrations/freshsales/fields',require(_0x178d('0xb2')));_0x4e7d2f[_0x178d('0x7')]('/api/networks',require(_0x178d('0xb3')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xb4'),require(_0x178d('0xb5')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xb6'),require(_0x178d('0xb7')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xb8'),require(_0x178d('0xb9')));_0x4e7d2f[_0x178d('0x7')]('/api/jscripty/questions/reports',require(_0x178d('0xba')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xbb'),require(_0x178d('0xbc')));_0x4e7d2f[_0x178d('0x7')]('/api/sms/reports/queue',require(_0x178d('0xbd')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xbe'),require('./api/squareReport'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xbf'),require(_0x178d('0xc0')));_0x4e7d2f['use'](_0x178d('0xc1'),require(_0x178d('0xc2')));_0x4e7d2f['use'](_0x178d('0xc3'),require(_0x178d('0xc4')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xc5'),require(_0x178d('0xc6')));_0x4e7d2f['use'](_0x178d('0xc7'),require('./api/squareProject'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xc8'),require(_0x178d('0xc9')));_0x4e7d2f['use']('/api/square/messages',require('./api/squareMessage'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xca'),require(_0x178d('0xcb')));_0x4e7d2f['use'](_0x178d('0xcc'),require(_0x178d('0xcd')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xce'),require('./api/campaign'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xcf'),require(_0x178d('0xd0')));_0x4e7d2f[_0x178d('0x7')]('/api/attachments',require('./api/attachment'));_0x4e7d2f[_0x178d('0x7')]('/api/plugins',require(_0x178d('0xd1')));_0x4e7d2f[_0x178d('0x7')]('/api/mail/reports/transfer',require(_0x178d('0xd2')));_0x4e7d2f['use'](_0x178d('0xd3'),require('./api/chatTransferReport'));_0x4e7d2f[_0x178d('0x7')]('/api/fax/reports/transfer',require(_0x178d('0xd4')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xd5'),require(_0x178d('0xd6')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xd7'),require(_0x178d('0xd8')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xd9'),require(_0x178d('0xda')));_0x4e7d2f['use']('/api/voice/prefixes',require(_0x178d('0xdb')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xdc'),require(_0x178d('0xdd')));_0x4e7d2f[_0x178d('0x7')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x4e7d2f[_0x178d('0x7')]('/api/userProfile/resources',require(_0x178d('0xde')));_0x4e7d2f['use'](_0x178d('0xdf'),require(_0x178d('0xe0')));_0x4e7d2f['use']('/api/whatsapp/accounts',require(_0x178d('0xe1')));_0x4e7d2f['use'](_0x178d('0xe2'),require(_0x178d('0xe3')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xe4'),require(_0x178d('0xe5')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xe6'),require('./api/whatsappMessage'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xe7'),require('./api/whatsappQueueReport'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xe8'),require(_0x178d('0xe9')));_0x4e7d2f[_0x178d('0x7')]('/api/whatsapp/queues',require(_0x178d('0xea')));_0x4e7d2f['use']('/api/cloudProviders',require(_0x178d('0xeb')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xec'),require(_0x178d('0xed')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xee'),require(_0x178d('0xef')));_0x4e7d2f['use'](_0x178d('0xf0'),require(_0x178d('0xf1')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xf2'),require(_0x178d('0xf3')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xf4'),require('./api/authActiveDirectory'));_0x4e7d2f['use'](_0x178d('0xf5'),require('./api/jira'));_0x4e7d2f[_0x178d('0x7')]('/api/rpc',require(_0x178d('0xf6')));_0x4e7d2f[_0x178d('0x7')]('/api/version',require('./api/version'));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xf7'),require('./api/system'));_0x4e7d2f[_0x178d('0x7')]('/api/pm2',require(_0x178d('0xf8')));_0x4e7d2f['use'](_0x178d('0xf9'),require(_0x178d('0xfa')));_0x4e7d2f[_0x178d('0x7')](_0x178d('0xfb'),clientSideLogs);_0x4e7d2f[_0x178d('0x7')](_0x178d('0xfc'),express[_0x178d('0xfd')](path[_0x178d('0xfe')](config[_0x178d('0xff')],'/apidoc')));_0x4e7d2f[_0x178d('0x7')]('/www',express['static'](path['join'](config[_0x178d('0xff')],_0x178d('0x100'))));_0x4e7d2f['use']('/demo',express[_0x178d('0xfd')](path[_0x178d('0xfe')](config['root'],'/demo')));_0x4e7d2f['use']('/snippet',express['static'](path[_0x178d('0xfe')](config[_0x178d('0xff')],_0x178d('0x101'),_0x178d('0x102'))));_0x4e7d2f[_0x178d('0x7')]('/plugins',express[_0x178d('0xfd')](path[_0x178d('0xfe')](config[_0x178d('0xff')],'/server/files/plugins')));_0x4e7d2f['route'](_0x178d('0x103'))[_0x178d('0x104')](errors[0x194]);_0x4e7d2f['route']('/*')['get'](function(_0x2dfdc8,_0x36521a){_0x36521a[_0x178d('0x105')](path[_0x178d('0x106')](_0x4e7d2f[_0x178d('0x104')](_0x178d('0x107'))+_0x178d('0x108')));});return _0x4e7d2f;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 51300dd..2533f76 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25d9=['../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','error','log','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc'];(function(_0x164d76,_0x33e840){var _0x48ada5=function(_0x180dd4){while(--_0x180dd4){_0x164d76['push'](_0x164d76['shift']());}};_0x48ada5(++_0x33e840);}(_0x25d9,0x16d));var _0x925d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x25d9[_0xfae23b];return _0x200640;};'use strict';var jayson=require(_0x925d('0x0'));var _=require(_0x925d('0x1'));var config=require(_0x925d('0x2'));exports[_0x925d('0x3')]=function(){return new Promise(function(_0x106af9,_0xceac12){var _0x5bbb1f={};_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x5')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x6')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x7')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x8')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x9')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0xa')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0xb')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0xc')));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0xd')));_0x5bbb1f=_['merge'](_0x5bbb1f,require('../api/trunk/trunk.rpc'));_0x5bbb1f=_['merge'](_0x5bbb1f,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0xe')));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0xf')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x10')));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0x11')));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0x12')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x13')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x14')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x15')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x16')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/faxMessage/faxMessage.rpc'));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0x17')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x18')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x19')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/smsInteraction/smsInteraction.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/smsMessage/smsMessage.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x1a')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x1b')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x1c')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x1d')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x1e')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x1f')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x20')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/cmContact/cmContact.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x21')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x22')));_0x5bbb1f=_['merge'](_0x5bbb1f,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0x23')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x24')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/pause/pause.rpc'));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0x25')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x26')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x27')));_0x5bbb1f=_['merge'](_0x5bbb1f,require('../api/trigger/trigger.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/variable/variable.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0x28')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x29')));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0x2a')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x2b')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x2c')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x2d')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x2e')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x2f')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x30')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/squareReport/squareReport.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x31')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x32')));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0x33')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x34')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/squareMessage/squareMessage.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/campaign/campaign.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x35')));_0x5bbb1f=_['merge'](_0x5bbb1f,require(_0x925d('0x36')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x37')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x38')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x39')));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5bbb1f=_[_0x925d('0x4')](_0x5bbb1f,require(_0x925d('0x3a')));var _0x4a95d0=jayson['server'](_0x5bbb1f)['http']();var _0x17aafe=config[_0x925d('0x3b')][_0x925d('0x3c')]||config['port']+0x1;var _0x16eca1=config['rpc']['ip']||'localhost';_0x4a95d0['on'](_0x925d('0x3d'),function(_0x54b6bb){return _0xceac12(_0x54b6bb);});_0x4a95d0[_0x925d('0x3')](_0x17aafe,_0x16eca1,function(){console[_0x925d('0x3e')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x16eca1,_0x17aafe);require(_0x925d('0x3f'))[_0x925d('0x40')]();return _0x106af9('RPC\x20listening\x20on\x20'+_0x16eca1+':'+_0x17aafe);});});}; \ No newline at end of file +var _0x628d=['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/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/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/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','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x628d,0x12b));var _0xd628=function(_0xed61ba,_0x44f52e){_0xed61ba=_0xed61ba-0x0;var _0x21f8f7=_0x628d[_0xed61ba];return _0x21f8f7;};'use strict';var jayson=require(_0xd628('0x0'));var _=require(_0xd628('0x1'));var config=require(_0xd628('0x2'));exports[_0xd628('0x3')]=function(){return new Promise(function(_0x1a4d4f,_0x19b927){var _0x2a1007={};_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/user/user.rpc'));_0x2a1007=_['merge'](_0x2a1007,require('../api/voiceExtension/voiceExtension.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/voiceQueue/voiceQueue.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x5')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x6')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x7')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x8')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x9')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0xa')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0xb')));_0x2a1007=_['merge'](_0x2a1007,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/mailServerIn/mailServerIn.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0xc')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/mailQueue/mailQueue.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0xd')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0xe')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0xf')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x10')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x11')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/faxApplication/faxApplication.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x12')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/faxMessage/faxMessage.rpc'));_0x2a1007=_['merge'](_0x2a1007,require('../api/faxQueue/faxQueue.rpc'));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x13')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x14')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x15')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x16')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x17')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x18')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x19')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x1a')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x1b')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/chatMessage/chatMessage.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x1c')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/cmContact/cmContact.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x1d')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x1e')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x1f')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x20')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x21')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x22')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x23')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x24')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x25')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x26')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x27')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x28')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x29')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x2a')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x2b')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x2c')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x2d')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x2e')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x2f')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x30')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x31')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x32')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x33')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/setting/setting.rpc'));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x34')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x35')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require('../api/squareRecording/squareRecording.rpc'));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x36')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x37')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x38')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x39')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x3a')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x3b')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x3c')));_0x2a1007=_[_0xd628('0x4')](_0x2a1007,require(_0xd628('0x3d')));_0x2a1007=_['merge'](_0x2a1007,require(_0xd628('0x3e')));var _0x252d1e=jayson['server'](_0x2a1007)[_0xd628('0x3f')]();var _0x12c561=config[_0xd628('0x40')][_0xd628('0x41')]||config[_0xd628('0x41')]+0x1;var _0x18509f=config[_0xd628('0x40')]['ip']||_0xd628('0x42');_0x252d1e['on'](_0xd628('0x43'),function(_0x22b16c){return _0x19b927(_0x22b16c);});_0x252d1e[_0xd628('0x3')](_0x12c561,_0x18509f,function(){console[_0xd628('0x44')](_0xd628('0x45'),_0x18509f,_0x12c561);require(_0xd628('0x46'))[_0xd628('0x47')]();return _0x1a4d4f(_0xd628('0x48')+_0x18509f+':'+_0x12c561);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 3ef1383..72fefc1 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 _0x11c3=['label','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','setTimeout','headers','ready','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','emit','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','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','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','noop','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s'];(function(_0x4b7db0,_0x4de404){var _0x57ae37=function(_0x25505c){while(--_0x25505c){_0x4b7db0['push'](_0x4b7db0['shift']());}};_0x57ae37(++_0x4de404);}(_0x11c3,0xee));var _0x311c=function(_0x3efa65,_0x44862f){_0x3efa65=_0x3efa65-0x0;var _0x2dd8f3=_0x11c3[_0x3efa65];return _0x2dd8f3;};'use strict';var util=require(_0x311c('0x0'));var _=require(_0x311c('0x1'));var EventEmitter=require(_0x311c('0x2'))[_0x311c('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x311c('0x4'));function AGIChannel(_0x527270){var _0x10f679=this,_0x408a8a=new AGIReply(),_0x42920c=![],_0x1ec201={};EventEmitter[_0x311c('0x5')](_0x10f679);_0x527270[_0x311c('0x6')](_0x311c('0x7'));_0x527270[_0x311c('0x8')](0x8*0x3c*0x3c*0x3e8);_0x408a8a[_0x311c('0x6')]('utf8');_0x408a8a['on'](_0x311c('0x9'),function(_0x51aeb8){for(var _0xa5224 in _0x51aeb8){_0x10f679[_0xa5224]=_0x51aeb8[_0xa5224];}_0x10f679['emit'](_0x311c('0xa'));});_0x408a8a['on']('line',function(_0x2966b5){if(_0x2966b5['toLowerCase']()==_0x311c('0xb')){_0x10f679['emit']('hangup');return;}if(_0x2966b5[_0x311c('0xc')](0x0,0xb)==_0x311c('0xd')){_0x42920c=!![];}if(_0x42920c){_0x1ec201['rx']+=_0x2966b5+'\x0a';if(_0x2966b5[_0x311c('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x42920c=![];}}else{_0x1ec201['rx']=_0x2966b5;}if(_0x42920c){return;}if(typeof _0x1ec201['cb']==_0x311c('0xf')){var _0x5311f8=_0x1ec201['rx'][_0x311c('0xc')](0x0,0x3),_0x38c245=null,_0x2b3c6d=null;_0x5311f8=parseInt(_0x5311f8);if(isNaN(_0x5311f8)){_0x1ec201['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x311c('0x10')});return;}if(_0x5311f8!=0xc8){_0x1ec201['cb'](null,{'code':_0x5311f8,'result':-0x1,'extra':'KO'});return;}_0x38c245=_0x1ec201['rx'][_0x311c('0xc')](0x4)[_0x311c('0x11')](_0x311c('0x12'),'');if(_0x38c245[_0x311c('0x13')]('\x20')!=-0x1){_0x38c245=_0x38c245[_0x311c('0x14')](0x0,_0x38c245['indexOf']('\x20'));}if(_[_0x311c('0x15')](_0x38c245,'-1')){_0x38c245=parseInt(_0x38c245);}_0x2b3c6d=_0x1ec201['rx'][_0x311c('0x16')]('\x20');if(_0x2b3c6d['length']==0x3){_0x2b3c6d=_0x2b3c6d[0x2][_0x311c('0xc')](0x1,_0x2b3c6d[0x2][_0x311c('0x17')]-0x1);}else if(_0x2b3c6d['length']>0x3){var _0xf9f1d9=/\((.+)\)/;var _0x47d4ad=_0x1ec201['rx'][_0x311c('0x18')](_0xf9f1d9);if(_0x47d4ad){_0x2b3c6d=_0x47d4ad[0x1];}else{_0x2b3c6d=null;}}else{_0x2b3c6d=null;}_0x1ec201['cb'](null,{'code':_0x5311f8,'result':_0x38c245,'extra':_0x2b3c6d});}});_0x527270['on'](_0x311c('0x19'),function(_0xd9a203){_0x10f679[_0x311c('0x1a')]('error',new AGIError(_0x311c('0x1b'),_0xd9a203[_0x311c('0x1c')]));});_0x527270['on'](_0x311c('0x1d'),function(){_0x10f679[_0x311c('0x1a')](_0x311c('0x1d'),new AGIError(_0x311c('0x1e')));});_0x527270['on'](_0x311c('0x1f'),function(){_0x10f679[_0x311c('0x1a')](_0x311c('0x1f'),new AGIError(_0x311c('0x20')));_0x527270[_0x311c('0x21')]();});_0x527270[_0x311c('0x22')](_0x408a8a);this[_0x311c('0x23')]=function(_0x5250ba,_0x55d271){var _0x5250ba=_0x5250ba||'',_0x55d271=typeof _0x55d271==_0x311c('0xf')?_0x55d271:new Function();_0x1ec201={'tx':_0x5250ba,'rx':'','cb':_0x55d271};_0x527270['write'](_0x5250ba+'\x0a');},this['close']=function(){_0x527270['destroy']();};}util[_0x311c('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x311c('0x25')][_0x311c('0x26')]=function(_0xa1cfce){return this[_0x311c('0x23')][_0x311c('0x27')](this,_0xa1cfce);};AGIChannel['prototype'][_0x311c('0x28')]=function(){return this['sendRequest'](_0x311c('0x29'));};AGIChannel['prototype'][_0x311c('0x2a')]=function(_0x534047,_0x1074a0,_0x237c67){_0x534047=_0x534047===undefined?_0x311c('0x2b'):_0x534047;_0x1074a0=_0x1074a0===undefined?'5':_0x1074a0;_0x237c67=_0x237c67===undefined?'1':_0x237c67;return this['sendRequest'](util[_0x311c('0x2c')](_0x311c('0x2d'),_0x534047,_0x1074a0*0x3e8,_0x237c67));};AGIChannel[_0x311c('0x25')]['noop']=function(_0x5d63df){_0x5d63df=_0x5d63df||_0x311c('0x2e');return this[_0x311c('0x26')](util[_0x311c('0x2c')](_0x311c('0x2f'),_0x5d63df));};AGIChannel['prototype'][_0x311c('0x30')]=function(_0x1c4ca6,_0x449b66){if(_[_0x311c('0x31')](_0x449b66)){return this[_0x311c('0x26')](util[_0x311c('0x2c')](_0x311c('0x32'),_0x1c4ca6,_0x449b66[_0x311c('0x33')](',')));}return this['sendRequest'](util[_0x311c('0x2c')](_0x311c('0x32'),_0x1c4ca6,_0x449b66));};AGIChannel[_0x311c('0x25')][_0x311c('0x34')]=function(_0x17b95c){return this[_0x311c('0x26')](util[_0x311c('0x2c')](_0x311c('0x35'),_0x17b95c));};AGIChannel[_0x311c('0x25')][_0x311c('0x36')]=function(_0xf9ef18){return this[_0x311c('0x26')](util['format']('SET\x20EXTENSION\x20%s',_0xf9ef18));};AGIChannel['prototype'][_0x311c('0x37')]=function(_0xbb6e33){return this[_0x311c('0x26')](util['format'](_0x311c('0x38'),_0xbb6e33));};AGIChannel['prototype'][_0x311c('0xb')]=function(){return this[_0x311c('0x26')](_0x311c('0x39'));};AGIChannel[_0x311c('0x25')]['setVariable']=function(_0x257006,_0xef1aef){var _0x31f687=_[_0x311c('0x3a')](_0xef1aef)||_[_0x311c('0x3b')](_0xef1aef)?_0xef1aef[_0x311c('0x3c')]():_0xef1aef;return this['sendRequest'](util[_0x311c('0x2c')](_0x311c('0x3d'),_0x257006,_0x31f687?_0x31f687[_0x311c('0x3c')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x311c('0x25')][_0x311c('0x3e')]=function(_0x470a15,_0x750feb){return this['sendRequest'](util[_0x311c('0x2c')](_0x311c('0x3f'),_0x470a15,_0x750feb));};AGIChannel[_0x311c('0x25')][_0x311c('0x40')]=function(_0x35dbe1,_0x3cbd31){return this[_0x311c('0x26')](util[_0x311c('0x2c')](_0x311c('0x41'),_0x35dbe1,_0x3cbd31));};AGIChannel[_0x311c('0x25')][_0x311c('0x42')]=function(_0x2f84d4,_0x2d5dff){return this['sendRequest'](util[_0x311c('0x2c')](_0x311c('0x43'),_0x2f84d4,_0x2d5dff));};AGIChannel['prototype'][_0x311c('0x44')]=function(_0x2b7cc8,_0x285025,_0x4d6b71){_0x285025=_0x285025||this['extension'];_0x4d6b71=_0x4d6b71||0x1;this['setContext'](_0x2b7cc8);this['setExtension'](_0x285025);this['setPriority'](_0x4d6b71);return this[_0x311c('0x45')](util[_0x311c('0x2c')]('GOTO\x20%s\x20%s\x20%s',_0x2b7cc8,_0x285025,_0x4d6b71));};AGIChannel[_0x311c('0x25')]['getVariable']=function(_0x3ad049){return this[_0x311c('0x26')](util[_0x311c('0x2c')]('GET\x20VARIABLE\x20\x22%s\x22',_0x3ad049));};AGIChannel[_0x311c('0x25')]['recordFile']=function(_0x11c12a,_0x15a7f5,_0x891324,_0x117558,_0x152f73,_0x3f8347){_0x15a7f5=_0x15a7f5||_0x311c('0x46');_0x891324=_0x891324||'';_0x117558=_0x117558===undefined?-0x1:_0x117558==='-1'?-0x1:_0x117558*0x3e8;_0x152f73=_0x152f73===undefined?'':'s='+_0x152f73;_0x3f8347=_0x3f8347?_0x311c('0x47'):'';return this[_0x311c('0x26')](util[_0x311c('0x2c')](_0x311c('0x48'),_0x11c12a,_0x15a7f5,_0x891324,_0x117558,_0x3f8347,_0x152f73));};AGIChannel[_0x311c('0x25')][_0x311c('0x49')]=function(_0x234b51,_0x3e20ce){_0x3e20ce=_0x3e20ce||'';return this[_0x311c('0x26')](util[_0x311c('0x2c')](_0x311c('0x4a'),_0x234b51,_0x3e20ce));};AGIChannel[_0x311c('0x25')][_0x311c('0x4b')]=function(_0x333192){return this[_0x311c('0x30')](_0x311c('0x4c'),_0x333192);};AGIChannel[_0x311c('0x25')]['wait']=function(_0x5981d4){return this['exec']('WAIT',_0x5981d4);};AGIChannel[_0x311c('0x25')]['error']=function(_0x3e682d,_0x1848ba){this[_0x311c('0x45')](util[_0x311c('0x2c')](_0x311c('0x4d'),_0x3e682d['id'],_0x3e682d[_0x311c('0x4e')],_0x1848ba));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xa842=['getVariable','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','./error','call','utf8','setTimeout','setEncoding','headers','emit','line','hangup','substring','520-Invalid','search','function','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sync','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s'];(function(_0x21e6d0,_0xa49904){var _0x5df0ff=function(_0xbee614){while(--_0xbee614){_0x21e6d0['push'](_0x21e6d0['shift']());}};_0x5df0ff(++_0xa49904);}(_0xa842,0x8e));var _0x2a84=function(_0xb5b946,_0x1e0630){_0xb5b946=_0xb5b946-0x0;var _0x1d97db=_0xa842[_0xb5b946];return _0x1d97db;};'use strict';var util=require(_0x2a84('0x0'));var _=require(_0x2a84('0x1'));var EventEmitter=require(_0x2a84('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x2a84('0x3'));function AGIChannel(_0x3b80ae){var _0x4c72e8=this,_0x321cfa=new AGIReply(),_0x504f6e=![],_0x5ac9a2={};EventEmitter[_0x2a84('0x4')](_0x4c72e8);_0x3b80ae['setEncoding'](_0x2a84('0x5'));_0x3b80ae[_0x2a84('0x6')](0x8*0x3c*0x3c*0x3e8);_0x321cfa[_0x2a84('0x7')]('utf8');_0x321cfa['on'](_0x2a84('0x8'),function(_0x231211){for(var _0x4f4cc3 in _0x231211){_0x4c72e8[_0x4f4cc3]=_0x231211[_0x4f4cc3];}_0x4c72e8[_0x2a84('0x9')]('ready');});_0x321cfa['on'](_0x2a84('0xa'),function(_0x10e681){if(_0x10e681['toLowerCase']()==_0x2a84('0xb')){_0x4c72e8['emit'](_0x2a84('0xb'));return;}if(_0x10e681[_0x2a84('0xc')](0x0,0xb)==_0x2a84('0xd')){_0x504f6e=!![];}if(_0x504f6e){_0x5ac9a2['rx']+=_0x10e681+'\x0a';if(_0x10e681[_0x2a84('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x504f6e=![];}}else{_0x5ac9a2['rx']=_0x10e681;}if(_0x504f6e){return;}if(typeof _0x5ac9a2['cb']==_0x2a84('0xf')){var _0x511806=_0x5ac9a2['rx'][_0x2a84('0xc')](0x0,0x3),_0x39d74e=null,_0x19ed93=null;_0x511806=parseInt(_0x511806);if(isNaN(_0x511806)){_0x5ac9a2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x511806!=0xc8){_0x5ac9a2['cb'](null,{'code':_0x511806,'result':-0x1,'extra':'KO'});return;}_0x39d74e=_0x5ac9a2['rx'][_0x2a84('0xc')](0x4)['replace']('result=','');if(_0x39d74e[_0x2a84('0x10')]('\x20')!=-0x1){_0x39d74e=_0x39d74e[_0x2a84('0x11')](0x0,_0x39d74e[_0x2a84('0x10')]('\x20'));}if(_[_0x2a84('0x12')](_0x39d74e,'-1')){_0x39d74e=parseInt(_0x39d74e);}_0x19ed93=_0x5ac9a2['rx'][_0x2a84('0x13')]('\x20');if(_0x19ed93[_0x2a84('0x14')]==0x3){_0x19ed93=_0x19ed93[0x2][_0x2a84('0xc')](0x1,_0x19ed93[0x2]['length']-0x1);}else if(_0x19ed93[_0x2a84('0x14')]>0x3){var _0x208fa7=/\((.+)\)/;var _0x36f07f=_0x5ac9a2['rx']['match'](_0x208fa7);if(_0x36f07f){_0x19ed93=_0x36f07f[0x1];}else{_0x19ed93=null;}}else{_0x19ed93=null;}_0x5ac9a2['cb'](null,{'code':_0x511806,'result':_0x39d74e,'extra':_0x19ed93});}});_0x3b80ae['on'](_0x2a84('0x15'),function(_0x384e4e){_0x4c72e8['emit']('error',new AGIError(_0x2a84('0x16'),_0x384e4e['code']));});_0x3b80ae['on'](_0x2a84('0x17'),function(){_0x4c72e8[_0x2a84('0x9')](_0x2a84('0x17'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3b80ae['on']('timeout',function(){_0x4c72e8[_0x2a84('0x9')]('timeout',new AGIError(_0x2a84('0x18')));_0x3b80ae[_0x2a84('0x19')]();});_0x3b80ae[_0x2a84('0x1a')](_0x321cfa);this[_0x2a84('0x1b')]=function(_0x2201ab,_0x2c8773){var _0x2201ab=_0x2201ab||'',_0x2c8773=typeof _0x2c8773=='function'?_0x2c8773:new Function();_0x5ac9a2={'tx':_0x2201ab,'rx':'','cb':_0x2c8773};_0x3b80ae[_0x2a84('0x1c')](_0x2201ab+'\x0a');},this[_0x2a84('0x17')]=function(){_0x3b80ae[_0x2a84('0x19')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x2a84('0x1d')]['sendRequest']=function(_0x1161de){return this[_0x2a84('0x1b')][_0x2a84('0x1e')](this,_0x1161de);};AGIChannel['prototype'][_0x2a84('0x1f')]=function(){return this[_0x2a84('0x20')](_0x2a84('0x21'));};AGIChannel[_0x2a84('0x1d')][_0x2a84('0x22')]=function(_0x35fcd7,_0x495599,_0x332762){_0x35fcd7=_0x35fcd7===undefined?_0x2a84('0x23'):_0x35fcd7;_0x495599=_0x495599===undefined?'5':_0x495599;_0x332762=_0x332762===undefined?'1':_0x332762;return this[_0x2a84('0x20')](util[_0x2a84('0x24')](_0x2a84('0x25'),_0x35fcd7,_0x495599*0x3e8,_0x332762));};AGIChannel[_0x2a84('0x1d')][_0x2a84('0x26')]=function(_0x3c64c9){_0x3c64c9=_0x3c64c9||_0x2a84('0x27');return this[_0x2a84('0x20')](util[_0x2a84('0x24')]('VERBOSE\x20\x22%s\x22',_0x3c64c9));};AGIChannel[_0x2a84('0x1d')][_0x2a84('0x28')]=function(_0x2737d2,_0x460cd9){if(_[_0x2a84('0x29')](_0x460cd9)){return this[_0x2a84('0x20')](util['format'](_0x2a84('0x2a'),_0x2737d2,_0x460cd9[_0x2a84('0x2b')](',')));}return this[_0x2a84('0x20')](util[_0x2a84('0x24')](_0x2a84('0x2a'),_0x2737d2,_0x460cd9));};AGIChannel['prototype'][_0x2a84('0x2c')]=function(_0x557897){return this[_0x2a84('0x20')](util[_0x2a84('0x24')](_0x2a84('0x2d'),_0x557897));};AGIChannel[_0x2a84('0x1d')][_0x2a84('0x2e')]=function(_0x273b3c){return this[_0x2a84('0x20')](util[_0x2a84('0x24')]('SET\x20EXTENSION\x20%s',_0x273b3c));};AGIChannel[_0x2a84('0x1d')][_0x2a84('0x2f')]=function(_0x369986){return this['sendRequest'](util[_0x2a84('0x24')](_0x2a84('0x30'),_0x369986));};AGIChannel['prototype']['hangup']=function(){return this[_0x2a84('0x20')]('HANGUP');};AGIChannel['prototype']['setVariable']=function(_0xe33ce3,_0x42d263){var _0x579dc3=_['isBoolean'](_0x42d263)||_['isNumber'](_0x42d263)?_0x42d263[_0x2a84('0x31')]():_0x42d263;return this[_0x2a84('0x20')](util[_0x2a84('0x24')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xe33ce3,_0x579dc3?_0x579dc3[_0x2a84('0x31')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2a84('0x1d')][_0x2a84('0x32')]=function(_0x3d5ed6,_0x51ccd4){return this[_0x2a84('0x20')](util[_0x2a84('0x24')](_0x2a84('0x33'),_0x3d5ed6,_0x51ccd4));};AGIChannel[_0x2a84('0x1d')]['sayDigits']=function(_0x285c7c,_0x5d7795){return this[_0x2a84('0x20')](util['format'](_0x2a84('0x34'),_0x285c7c,_0x5d7795));};AGIChannel[_0x2a84('0x1d')]['sayPhonetic']=function(_0x570dbf,_0x22d2a7){return this[_0x2a84('0x20')](util[_0x2a84('0x24')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x570dbf,_0x22d2a7));};AGIChannel[_0x2a84('0x1d')][_0x2a84('0x35')]=function(_0x124094,_0x116b2b,_0x3cb0e7){_0x116b2b=_0x116b2b||this[_0x2a84('0x36')];_0x3cb0e7=_0x3cb0e7||0x1;this[_0x2a84('0x2c')](_0x124094);this['setExtension'](_0x116b2b);this['setPriority'](_0x3cb0e7);return this[_0x2a84('0x26')](util[_0x2a84('0x24')](_0x2a84('0x37'),_0x124094,_0x116b2b,_0x3cb0e7));};AGIChannel[_0x2a84('0x1d')][_0x2a84('0x38')]=function(_0x22dcff){return this['sendRequest'](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x22dcff));};AGIChannel['prototype']['recordFile']=function(_0x3729af,_0x235130,_0x27a1cc,_0x2547b4,_0x17b14f,_0x2738f7){_0x235130=_0x235130||_0x2a84('0x39');_0x27a1cc=_0x27a1cc||'';_0x2547b4=_0x2547b4===undefined?-0x1:_0x2547b4==='-1'?-0x1:_0x2547b4*0x3e8;_0x17b14f=_0x17b14f===undefined?'':'s='+_0x17b14f;_0x2738f7=_0x2738f7?_0x2a84('0x3a'):'';return this['sendRequest'](util[_0x2a84('0x24')](_0x2a84('0x3b'),_0x3729af,_0x235130,_0x27a1cc,_0x2547b4,_0x2738f7,_0x17b14f));};AGIChannel[_0x2a84('0x1d')][_0x2a84('0x3c')]=function(_0x29e01c,_0x18eb2e){_0x18eb2e=_0x18eb2e||'';return this[_0x2a84('0x20')](util['format'](_0x2a84('0x3d'),_0x29e01c,_0x18eb2e));};AGIChannel['prototype'][_0x2a84('0x3e')]=function(_0x27f4b2){return this[_0x2a84('0x28')]('AGI',_0x27f4b2);};AGIChannel[_0x2a84('0x1d')]['wait']=function(_0x54168b){return this[_0x2a84('0x28')](_0x2a84('0x3f'),_0x54168b);};AGIChannel[_0x2a84('0x1d')][_0x2a84('0x15')]=function(_0x1dc6cc,_0x5e39d1){this[_0x2a84('0x26')](util['format'](_0x2a84('0x40'),_0x1dc6cc['id'],_0x1dc6cc[_0x2a84('0x41')],_0x5e39d1));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f20086f..9d4b9d1 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 _0x010b=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x24542b,_0x7752de){var _0x4c7f41=function(_0x4d9c60){while(--_0x4d9c60){_0x24542b['push'](_0x24542b['shift']());}};_0x4c7f41(++_0x7752de);}(_0x010b,0x13a));var _0xb010=function(_0xdd1562,_0x4cb7a4){_0xdd1562=_0xdd1562-0x0;var _0x10920c=_0x010b[_0xdd1562];return _0x10920c;};'use strict';var util=require(_0xb010('0x0'));var error={'E_AGI_UNDEFINED':_0xb010('0x1'),'E_AGI_ARGUMENT_PORT':_0xb010('0x2'),'E_AGI_SERVER_ERROR':_0xb010('0x3'),'E_AGI_SERVER_CLOSE':_0xb010('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xb010('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xb010('0x6'),'E_AGI_SOCKET_ERROR':_0xb010('0x7'),'E_AGI_SOCKET_CLOSE':_0xb010('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xb010('0x9'),'E_AGI_COMMAND_EMPTY':_0xb010('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xb010('0xb'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5cdd2f){var _0x5cdd2f=_0x5cdd2f||null,_0x39e1b7=_0x39e1b7||[],_0x4eec28=0x1,_0x2d8b43='';if(!error[_0x5cdd2f]){_0x5cdd2f=_0xb010('0xc');}_0x39e1b7['push'](error[_0x5cdd2f]);while(arguments[_0x4eec28]){_0x39e1b7[_0xb010('0xd')](arguments[_0x4eec28]);_0x4eec28++;}_0x2d8b43=util[_0xb010('0xe')][_0xb010('0xf')](util,_0x39e1b7);this['message']=_0x2d8b43;this[_0xb010('0x10')]=_0x5cdd2f;}module[_0xb010('0x11')]=AGIError; \ No newline at end of file +var _0x5dbd=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x26236f,_0x36916c){var _0x11c59f=function(_0x25ab7c){while(--_0x25ab7c){_0x26236f['push'](_0x26236f['shift']());}};_0x11c59f(++_0x36916c);}(_0x5dbd,0x1d8));var _0xd5db=function(_0x2885af,_0x300500){_0x2885af=_0x2885af-0x0;var _0x2aa1ed=_0x5dbd[_0x2885af];return _0x2aa1ed;};'use strict';var util=require(_0xd5db('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xd5db('0x1'),'E_AGI_SERVER_ERROR':_0xd5db('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xd5db('0x3'),'E_AGI_SOCKET_ERROR':_0xd5db('0x4'),'E_AGI_SOCKET_CLOSE':_0xd5db('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xd5db('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd5db('0x7'),'E_AGI_IVR_ENTRY':_0xd5db('0x8')};function AGIError(_0x3485b6){var _0x3485b6=_0x3485b6||null,_0x4a4084=_0x4a4084||[],_0x4e5762=0x1,_0x31b0f4='';if(!error[_0x3485b6]){_0x3485b6=_0xd5db('0x9');}_0x4a4084[_0xd5db('0xa')](error[_0x3485b6]);while(arguments[_0x4e5762]){_0x4a4084['push'](arguments[_0x4e5762]);_0x4e5762++;}_0x31b0f4=util[_0xd5db('0xb')][_0xd5db('0xc')](util,_0x4a4084);this[_0xd5db('0xd')]=_0x31b0f4;this[_0xd5db('0xe')]=_0x3485b6;}module[_0xd5db('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c677505..814b7d4 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 _0x7b9a=['addEdge','push','size','no\x20vertex\x20found','info','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','target','default','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','lodash','../../../config/logger','menu','vertices','edges','addVertex','prototype'];(function(_0x253b5c,_0x5062ff){var _0x1ba8e6=function(_0x5407f2){while(--_0x5407f2){_0x253b5c['push'](_0x253b5c['shift']());}};_0x1ba8e6(++_0x5062ff);}(_0x7b9a,0x1e7));var _0xa7b9=function(_0x47abd7,_0x57892e){_0x47abd7=_0x47abd7-0x0;var _0x6d4d17=_0x7b9a[_0x47abd7];return _0x6d4d17;};'use strict';var _=require(_0xa7b9('0x0'));var logger=require(_0xa7b9('0x1'))('agi');var verticesWithRetry=[_0xa7b9('0x2'),'getdigits','getsecretdigits'];var Graph=function(){this[_0xa7b9('0x3')]={};this[_0xa7b9('0x4')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0xa7b9('0x5')]=function(_0x38275e){this[_0xa7b9('0x3')][_0x38275e['id']]=_0x38275e;this[_0xa7b9('0x4')][_0x38275e['id']]=[];};Graph[_0xa7b9('0x6')][_0xa7b9('0x7')]=function(_0x1bda0f,_0x51af29,_0x2e17cc){this['edges'][_0x1bda0f][_0xa7b9('0x8')]({'target':_0x51af29,'condition':_0x2e17cc});this['numberOfEdges']+=0x1;};Graph['prototype']['size']=function(){return _[_0xa7b9('0x9')](this[_0xa7b9('0x3')]);};Graph[_0xa7b9('0x6')]['relations']=function(){return this['numberOfEdges'];};Graph[_0xa7b9('0x6')]['getVertex']=function(_0x472ecd){return this[_0xa7b9('0x3')][_0x472ecd];};Graph[_0xa7b9('0x6')]['traverseBFS']=function(_0x395bf4,_0x18f9d0){if(!this[_0xa7b9('0x3')][_0x395bf4]){return logger['info'](_0xa7b9('0xa'));}var _0x30051b=_0x18f9d0(this[_0xa7b9('0x3')][_0x395bf4]);if(!_0x30051b){return logger[_0xa7b9('0xb')](_0xa7b9('0xc'));}if(this[_0xa7b9('0x4')][_0x395bf4]['length']===0x0){return logger[_0xa7b9('0xb')](_0xa7b9('0xd'));}for(var _0x53723a=0x0,_0x2e8727=[],_0x14f30d=![];_0x53723a\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','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','omit','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','variables','stringify','timeout','hangup','sync','production','start','debug','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','connection','xml2json','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./graph','./vertices','defaults','127.0.0.1','nextTick','stack'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa18d,0x1b8));var _0xda18=function(_0x244118,_0x3b2b04){_0x244118=_0x244118-0x0;var _0x27a6aa=_0xa18d[_0x244118];return _0x27a6aa;};'use strict';var parser=require(_0xda18('0x0'));var _=require(_0xda18('0x1'));var syncho=require(_0xda18('0x2'));var util=require('util');var moment=require(_0xda18('0x3'));var config=require(_0xda18('0x4'));var logger=require(_0xda18('0x5'))(_0xda18('0x6'));var utilLicense=require(_0xda18('0x7'));var rpc=require(_0xda18('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0xda18('0x9'));var Vertices=require(_0xda18('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xda18('0x6')]=_[_0xda18('0xb')](config['agi'],{'ip':_0xda18('0xc'),'port':0x11dd});function connectionHandler(_0x2be09a){process[_0xda18('0xd')](function(){syncho(function(){try{setChannelVariables(_0x2be09a);agiHandler(_0x2be09a);}catch(_0x31be54){logger['error'](_0x31be54[_0xda18('0xe')]);}});});}function listeningHandler(){console[_0xda18('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xda18('0x6')][_0xda18('0x10')]);logger[_0xda18('0x11')](util[_0xda18('0x12')](_0xda18('0x13'),config[_0xda18('0x6')]['ip'],config[_0xda18('0x6')][_0xda18('0x10')]));}function errorHandler(_0x509aaf){if(_0x509aaf&&_0x509aaf[_0xda18('0x14')]&&_0x509aaf['message']){logger['error'](util[_0xda18('0x12')](_0xda18('0x15'),_0x509aaf[_0xda18('0x14')],_0x509aaf['message']));}else{logger[_0xda18('0x16')](util[_0xda18('0x12')](_0xda18('0x17'),_0x509aaf[_0xda18('0xe')]));}}function closeHandler(){logger[_0xda18('0x11')](util['format'](_0xda18('0x18'),this[_0xda18('0x19')],this[_0xda18('0x1a')],this[_0xda18('0x1b')],this[_0xda18('0x1c')],this[_0xda18('0x1d')]));try{createSquareReport(this);}catch(_0x51c376){logger[_0xda18('0x16')](_0x51c376[_0xda18('0xe')]);}}function timeoutHandler(){logger[_0xda18('0x11')](util[_0xda18('0x12')](_0xda18('0x1e'),this[_0xda18('0x19')],this['calleridname'],this['callerid'],this['dnid'],this[_0xda18('0x1d')]));}function hangupHandler(){logger[_0xda18('0x11')](util[_0xda18('0x12')](_0xda18('0x1f'),this[_0xda18('0x19')],this['calleridname'],this['callerid'],this[_0xda18('0x1c')],this[_0xda18('0x1d')]));this[_0xda18('0x20')]=!![];}function getRoot(_0x12defb){return parser['toJson'](_0x12defb,{'object':!![]})[_0xda18('0x21')]['root'];}function addVertex(_0x474616,_0x59f170,_0x568edc){_0x59f170[_0xda18('0x22')]=_0x568edc;if(_0x59f170[_0xda18('0x23')](_0xda18('0x24'))){_0x59f170[_0xda18('0x25')]=parseInt(_0x59f170[_0xda18('0x24')],0xa);}_0x474616['addVertex'](_[_0xda18('0x26')](_0x59f170,'mxCell'));}function initGraph(_0x5feff8,_0x28d602){var _0x1ee843=new Graph();for(var _0x360709 in _0x5feff8){if(_0x5feff8['hasOwnProperty'](_0x360709)){if(_[_0xda18('0x27')](_0x5feff8[_0x360709])){for(var _0x403183=0x0;_0x403183<_0x5feff8[_0x360709][_0xda18('0x28')];_0x403183+=0x1){addVertex(_0x1ee843,_0x5feff8[_0x360709][_0x403183],_0x360709);}}else{addVertex(_0x1ee843,_0x5feff8[_0x360709],_0x360709);}}}for(var _0x252227=0x0;_0x252227<_0x28d602['length'];_0x252227+=0x1){if(_0x28d602[_0x252227][_0xda18('0x29')]&&_0x28d602[_0x252227][_0xda18('0x2a')]){_0x1ee843[_0xda18('0x2b')](_0x28d602[_0x252227]['source'],_0x28d602[_0x252227][_0xda18('0x2a')],_0x28d602[_0x252227][_0xda18('0x2c')]);}}return _0x1ee843;}function getSquareProject(_0x24fabd,_0xc25b56){rpc[_0xda18('0x2d')](_0x24fabd)[_0xda18('0x2e')](function(_0x12490a){_0xc25b56(null,_0x12490a);})[_0xda18('0x2f')](function(_0x4f500a){_0xc25b56(null,_0x4f500a);});}function createSquareReport(_0x41f31f,_0x55ed2d){rpc[_0xda18('0x30')](_0x41f31f)['then'](function(_0x2f57c8){if(_0x55ed2d){_0x55ed2d(null,_0x2f57c8);}})['catch'](function(_0x6b3d82){if(_0x55ed2d){_0x55ed2d(null,_0x6b3d82);}});}function setChannelVariables(_0x443488){for(var _0x34027d in _0x443488){if(_0x443488['hasOwnProperty'](_0x34027d)){if(_0x34027d[_0xda18('0x31')](_0xda18('0x32'))===0x0){_0x443488[_0x34027d[_0xda18('0x33')](0x4)]=_0x443488[_0x34027d];delete _0x443488[_0x34027d];}}}}function getLogFromObject(_0x449903){return util[_0xda18('0x34')](_0x449903,{'showHidden':![],'depth':null});}function agiHandler(_0x391f82){var _0x54ae82,_0x4778e4,_0x44eb37,_0x99d6cd,_0x2ecf6f;logger['debug'](_0xda18('0x35'),JSON[_0xda18('0x36')](_0x391f82,null,0x2));logger[_0xda18('0x11')](util[_0xda18('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x391f82[_0xda18('0x19')],_0x391f82[_0xda18('0x1a')],_0x391f82[_0xda18('0x1b')],_0x391f82[_0xda18('0x1c')],_0x391f82[_0xda18('0x1d')]));_0x391f82['on'](_0xda18('0x16'),errorHandler);_0x391f82['on']('close',closeHandler);_0x391f82['on'](_0xda18('0x37'),timeoutHandler);_0x391f82[_0xda18('0x20')]=![];_0x391f82['on'](_0xda18('0x38'),hangupHandler);var _0x5acda0=getSquareProject[_0xda18('0x39')](null,_0x391f82[_0xda18('0x19')]);if(_0x5acda0){if(_0x5acda0[_0xda18('0x3a')]){_0x54ae82=getRoot(_0x5acda0['production']);if(_0x54ae82&&_0x54ae82[_0xda18('0x3b')]){logger[_0xda18('0x3c')]('root',JSON[_0xda18('0x36')](_0x54ae82,null,0x2));_0x391f82['joinAt']=moment()[_0xda18('0x12')](_0xda18('0x3d'));_0x4778e4=initGraph(_['omit'](_0x54ae82,_0xda18('0x3e')),_0x54ae82['mxCell']);_0x44eb37=new Vertices(_0x391f82,rpc,mailRpc);logger['info'](util[_0xda18('0x12')](_0xda18('0x3f'),_0x391f82[_0xda18('0x19')],_0x391f82['calleridname'],_0x391f82[_0xda18('0x1b')],_0x391f82[_0xda18('0x1c')],_0x391f82[_0xda18('0x1d')]));_0x4778e4[_0xda18('0x40')](_0x54ae82[_0xda18('0x3b')]['id'],function(_0x4659ca){try{_0x4659ca=_0x44eb37[_0xda18('0x41')](_0x4659ca);logger[_0xda18('0x3c')](_0xda18('0x42'),JSON[_0xda18('0x36')](_0x4659ca,null,0x2));if(_0x4659ca[_0xda18('0x22')]===_0xda18('0x43')){logger['info'](_0xda18('0x44'));_0x391f82['context']=_0x4659ca[_0xda18('0x45')]||_0x391f82[_0xda18('0x45')];_0x391f82[_0xda18('0x46')]=_0x4659ca[_0xda18('0x46')];_0x391f82[_0xda18('0x47')]=_0x4659ca['priority']?_0x4659ca[_0xda18('0x47')]-0x1:0x1;return null;}else if(_0x4659ca&&_0x44eb37[_0x4659ca[_0xda18('0x22')]]){_0x2ecf6f=_0x44eb37[_0x4659ca[_0xda18('0x22')]](_0x4659ca);logger[_0xda18('0x11')](_0xda18('0x48'),JSON[_0xda18('0x36')](_0x2ecf6f,null,0x2));if(_0x2ecf6f&&_0x2ecf6f['code']===AGI_CODE_SUCCESS&&_0x2ecf6f[_0xda18('0x49')]!==AGI_RESULT_ERROR&&!_0x391f82[_0xda18('0x20')]){logger[_0xda18('0x3c')]('response',getLogFromObject(_0x2ecf6f));return _[_0xda18('0x4a')](_0x2ecf6f[_0xda18('0x49')])?null:_0x2ecf6f[_0xda18('0x49')]['toString']();}else{logger[_0xda18('0x16')]('response',getLogFromObject(_0x2ecf6f));return null;}}else{logger['error'](_0xda18('0x4b'));return null;}}catch(_0xf2127b){logger['error'](_0xf2127b[_0xda18('0xe')]);return null;}});if(_0x54ae82[_0xda18('0x4c')]){logger['info'](util['format'](_0xda18('0x4d'),_0x391f82[_0xda18('0x19')],_0x391f82[_0xda18('0x1a')],_0x391f82[_0xda18('0x1b')],_0x391f82[_0xda18('0x1c')],_0x391f82[_0xda18('0x1d')]));_0x4778e4[_0xda18('0x40')](_0x54ae82[_0xda18('0x4c')]['id'],function(_0x2c327a){try{_0x2c327a=_0x44eb37[_0xda18('0x41')](_0x2c327a);logger[_0xda18('0x3c')]('vertex',JSON[_0xda18('0x36')](_0x2c327a,null,0x2));if(_0x2c327a&&_0x44eb37[_0x2c327a[_0xda18('0x22')]]){_0x2ecf6f=_0x44eb37[_0x2c327a[_0xda18('0x22')]](_0x2c327a);if(_0x2ecf6f){logger[_0xda18('0x3c')](_0xda18('0x48'),getLogFromObject(_0x2ecf6f));return _[_0xda18('0x4a')](_0x2ecf6f[_0xda18('0x49')])?null:_0x2ecf6f[_0xda18('0x49')][_0xda18('0x4e')]();}else{logger[_0xda18('0x16')](_0xda18('0x48'),getLogFromObject(_0x2ecf6f));return null;}}else{logger[_0xda18('0x16')](_0xda18('0x4b'));return null;}}catch(_0x17e878){logger[_0xda18('0x16')](_0x17e878['stack']);return null;}});}logger[_0xda18('0x11')](util[_0xda18('0x12')](_0xda18('0x4f'),_0x391f82[_0xda18('0x19')],_0x391f82[_0xda18('0x1a')],_0x391f82['callerid'],_0x391f82[_0xda18('0x1c')],_0x391f82[_0xda18('0x1d')]));logger[_0xda18('0x11')](util[_0xda18('0x12')](_0xda18('0x50'),_0x391f82[_0xda18('0x45')],_0x391f82['extension'],parseInt(_0x391f82['priority'],0xa)+0x1));_0x391f82[_0xda18('0x51')](_0x391f82[_0xda18('0x45')],_0x391f82[_0xda18('0x46')],parseInt(_0x391f82['priority'],0xa)+0x1);_0x391f82[_0xda18('0x52')]();}}else{logger[_0xda18('0x16')](util[_0xda18('0x12')](_0xda18('0x53'),_0x391f82[_0xda18('0x19')]));_0x391f82[_0xda18('0x51')](_0x391f82[_0xda18('0x45')],_0x391f82[_0xda18('0x46')],parseInt(_0x391f82[_0xda18('0x47')],0xa)+0x1);_0x391f82[_0xda18('0x52')]();}}else{logger['error'](util[_0xda18('0x12')]('Project\x20%s\x20not\x20found',_0x391f82[_0xda18('0x19')]));_0x391f82[_0xda18('0x51')](_0x391f82[_0xda18('0x45')],_0x391f82['extension'],parseInt(_0x391f82['priority'],0xa)+0x1);_0x391f82['close']();}}function main(){var _0x55c288;return utilLicense[_0xda18('0x54')]()[_0xda18('0x2e')](function(_0x14f365){if(_0x14f365){if(_0x14f365[_0xda18('0x55')]){if(_0x14f365[_0xda18('0x56')]&&_0x14f365[_0xda18('0x56')]>0x0){logger['info'](util[_0xda18('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x14f365['callysquare']));_0x55c288=_0x14f365['callysquare'];}else{logger[_0xda18('0x11')](_0xda18('0x57'));}}else{logger[_0xda18('0x11')](_0xda18('0x58'));_0x55c288=-0x1;}}})['catch'](function(_0x5d5991){logger[_0xda18('0x16')](_0xda18('0x59'),_0x5d5991[_0xda18('0xe')]);})[_0xda18('0x4c')](function(){var _0x300ac1=require('./server')(config[_0xda18('0x6')][_0xda18('0x10')],config['agi']['ip'],_0x55c288);_0x300ac1['on'](_0xda18('0x16'),errorHandler);_0x300ac1['on']('listening',listeningHandler);_0x300ac1['on'](_0xda18('0x5a'),connectionHandler);_0x300ac1['on'](_0xda18('0x52'),closeHandler);});}main(); \ No newline at end of file +var _0x50f4=['inspect','debug','variables','stringify','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','./server','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','calleridname','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','agicommand','retry','maxRetry','omit','mxCell','hasOwnProperty','length','source','target','value','then','catch','createSquareReport','indexOf','agi_','substring'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x50f4,0x1e2));var _0x450f=function(_0x9daaa1,_0x2bb365){_0x9daaa1=_0x9daaa1-0x0;var _0x326549=_0x50f4[_0x9daaa1];return _0x326549;};'use strict';var parser=require('xml2json');var _=require(_0x450f('0x0'));var syncho=require(_0x450f('0x1'));var util=require(_0x450f('0x2'));var moment=require(_0x450f('0x3'));var config=require(_0x450f('0x4'));var logger=require(_0x450f('0x5'))(_0x450f('0x6'));var utilLicense=require(_0x450f('0x7'));var rpc=require(_0x450f('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x450f('0x9'));var Vertices=require(_0x450f('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x450f('0x6')]=_[_0x450f('0xb')](config[_0x450f('0x6')],{'ip':_0x450f('0xc'),'port':0x11dd});function connectionHandler(_0x5608ad){process[_0x450f('0xd')](function(){syncho(function(){try{setChannelVariables(_0x5608ad);agiHandler(_0x5608ad);}catch(_0x1c0139){logger[_0x450f('0xe')](_0x1c0139[_0x450f('0xf')]);}});});}function listeningHandler(){console[_0x450f('0x10')](_0x450f('0x11'),config[_0x450f('0x6')][_0x450f('0x12')]);logger[_0x450f('0x13')](util[_0x450f('0x14')](_0x450f('0x15'),config[_0x450f('0x6')]['ip'],config[_0x450f('0x6')][_0x450f('0x12')]));}function errorHandler(_0x25e63d){if(_0x25e63d&&_0x25e63d['name']&&_0x25e63d[_0x450f('0x16')]){logger[_0x450f('0xe')](util[_0x450f('0x14')](_0x450f('0x17'),_0x25e63d[_0x450f('0x18')],_0x25e63d[_0x450f('0x16')]));}else{logger[_0x450f('0xe')](util[_0x450f('0x14')](_0x450f('0x19'),_0x25e63d[_0x450f('0xf')]));}}function closeHandler(){logger[_0x450f('0x13')](util[_0x450f('0x14')](_0x450f('0x1a'),this[_0x450f('0x1b')],this['calleridname'],this['callerid'],this[_0x450f('0x1c')],this[_0x450f('0x1d')]));try{createSquareReport(this);}catch(_0x2891ed){logger[_0x450f('0xe')](_0x2891ed['stack']);}}function timeoutHandler(){logger['info'](util[_0x450f('0x14')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x450f('0x1b')],this[_0x450f('0x1e')],this[_0x450f('0x1f')],this[_0x450f('0x1c')],this[_0x450f('0x1d')]));}function hangupHandler(){logger[_0x450f('0x13')](util['format'](_0x450f('0x20'),this[_0x450f('0x1b')],this[_0x450f('0x1e')],this[_0x450f('0x1f')],this[_0x450f('0x1c')],this[_0x450f('0x1d')]));this[_0x450f('0x21')]=!![];}function getRoot(_0x90671b){return parser['toJson'](_0x90671b,{'object':!![]})[_0x450f('0x22')][_0x450f('0x23')];}function addVertex(_0x53247a,_0xcca76c,_0x15112f){_0xcca76c[_0x450f('0x24')]=_0x15112f;if(_0xcca76c['hasOwnProperty'](_0x450f('0x25'))){_0xcca76c[_0x450f('0x26')]=parseInt(_0xcca76c['retry'],0xa);}_0x53247a['addVertex'](_[_0x450f('0x27')](_0xcca76c,_0x450f('0x28')));}function initGraph(_0xf81450,_0x2a38ee){var _0x39027b=new Graph();for(var _0x37caa8 in _0xf81450){if(_0xf81450[_0x450f('0x29')](_0x37caa8)){if(_['isArray'](_0xf81450[_0x37caa8])){for(var _0x1fb1b7=0x0;_0x1fb1b7<_0xf81450[_0x37caa8][_0x450f('0x2a')];_0x1fb1b7+=0x1){addVertex(_0x39027b,_0xf81450[_0x37caa8][_0x1fb1b7],_0x37caa8);}}else{addVertex(_0x39027b,_0xf81450[_0x37caa8],_0x37caa8);}}}for(var _0x316d7a=0x0;_0x316d7a<_0x2a38ee[_0x450f('0x2a')];_0x316d7a+=0x1){if(_0x2a38ee[_0x316d7a][_0x450f('0x2b')]&&_0x2a38ee[_0x316d7a][_0x450f('0x2c')]){_0x39027b['addEdge'](_0x2a38ee[_0x316d7a][_0x450f('0x2b')],_0x2a38ee[_0x316d7a][_0x450f('0x2c')],_0x2a38ee[_0x316d7a][_0x450f('0x2d')]);}}return _0x39027b;}function getSquareProject(_0x580380,_0x480491){rpc['getSquareProject'](_0x580380)[_0x450f('0x2e')](function(_0x4faf03){_0x480491(null,_0x4faf03);})[_0x450f('0x2f')](function(_0x35c236){_0x480491(null,_0x35c236);});}function createSquareReport(_0x27fa86,_0x4c3dff){rpc[_0x450f('0x30')](_0x27fa86)[_0x450f('0x2e')](function(_0x21516a){if(_0x4c3dff){_0x4c3dff(null,_0x21516a);}})['catch'](function(_0x315b31){if(_0x4c3dff){_0x4c3dff(null,_0x315b31);}});}function setChannelVariables(_0x19bc3c){for(var _0x4fc9e5 in _0x19bc3c){if(_0x19bc3c[_0x450f('0x29')](_0x4fc9e5)){if(_0x4fc9e5[_0x450f('0x31')](_0x450f('0x32'))===0x0){_0x19bc3c[_0x4fc9e5[_0x450f('0x33')](0x4)]=_0x19bc3c[_0x4fc9e5];delete _0x19bc3c[_0x4fc9e5];}}}}function getLogFromObject(_0x3d8164){return util[_0x450f('0x34')](_0x3d8164,{'showHidden':![],'depth':null});}function agiHandler(_0x4facbe){var _0x321131,_0x49b599,_0xedb7bf,_0xc71de,_0x1de9a7;logger[_0x450f('0x35')](_0x450f('0x36'),JSON[_0x450f('0x37')](_0x4facbe,null,0x2));logger[_0x450f('0x13')](util[_0x450f('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4facbe['arg_1'],_0x4facbe[_0x450f('0x1e')],_0x4facbe[_0x450f('0x1f')],_0x4facbe[_0x450f('0x1c')],_0x4facbe[_0x450f('0x1d')]));_0x4facbe['on'](_0x450f('0xe'),errorHandler);_0x4facbe['on'](_0x450f('0x38'),closeHandler);_0x4facbe['on'](_0x450f('0x39'),timeoutHandler);_0x4facbe[_0x450f('0x21')]=![];_0x4facbe['on'](_0x450f('0x3a'),hangupHandler);var _0x3ea07e=getSquareProject[_0x450f('0x3b')](null,_0x4facbe[_0x450f('0x1b')]);if(_0x3ea07e){if(_0x3ea07e[_0x450f('0x3c')]){_0x321131=getRoot(_0x3ea07e[_0x450f('0x3c')]);if(_0x321131&&_0x321131[_0x450f('0x3d')]){logger[_0x450f('0x35')](_0x450f('0x23'),JSON[_0x450f('0x37')](_0x321131,null,0x2));_0x4facbe[_0x450f('0x3e')]=moment()[_0x450f('0x14')](_0x450f('0x3f'));_0x49b599=initGraph(_['omit'](_0x321131,_0x450f('0x28')),_0x321131[_0x450f('0x28')]);_0xedb7bf=new Vertices(_0x4facbe,rpc,mailRpc);logger[_0x450f('0x13')](util['format'](_0x450f('0x40'),_0x4facbe[_0x450f('0x1b')],_0x4facbe['calleridname'],_0x4facbe[_0x450f('0x1f')],_0x4facbe[_0x450f('0x1c')],_0x4facbe[_0x450f('0x1d')]));_0x49b599[_0x450f('0x41')](_0x321131[_0x450f('0x3d')]['id'],function(_0x2bc284){try{_0x2bc284=_0xedb7bf[_0x450f('0x42')](_0x2bc284);logger[_0x450f('0x35')](_0x450f('0x43'),JSON[_0x450f('0x37')](_0x2bc284,null,0x2));if(_0x2bc284[_0x450f('0x24')]===_0x450f('0x44')){logger[_0x450f('0x13')](_0x450f('0x45'));_0x4facbe[_0x450f('0x46')]=_0x2bc284[_0x450f('0x46')]||_0x4facbe[_0x450f('0x46')];_0x4facbe[_0x450f('0x47')]=_0x2bc284[_0x450f('0x47')];_0x4facbe[_0x450f('0x48')]=_0x2bc284[_0x450f('0x48')]?_0x2bc284[_0x450f('0x48')]-0x1:0x1;return null;}else if(_0x2bc284&&_0xedb7bf[_0x2bc284[_0x450f('0x24')]]){_0x1de9a7=_0xedb7bf[_0x2bc284[_0x450f('0x24')]](_0x2bc284);logger[_0x450f('0x13')](_0x450f('0x49'),JSON[_0x450f('0x37')](_0x1de9a7,null,0x2));if(_0x1de9a7&&_0x1de9a7['code']===AGI_CODE_SUCCESS&&_0x1de9a7[_0x450f('0x4a')]!==AGI_RESULT_ERROR&&!_0x4facbe[_0x450f('0x21')]){logger[_0x450f('0x35')](_0x450f('0x49'),getLogFromObject(_0x1de9a7));return _['isUndefined'](_0x1de9a7[_0x450f('0x4a')])?null:_0x1de9a7[_0x450f('0x4a')][_0x450f('0x4b')]();}else{logger[_0x450f('0xe')](_0x450f('0x49'),getLogFromObject(_0x1de9a7));return null;}}else{logger['error'](_0x450f('0x4c'));return null;}}catch(_0x412e50){logger['error'](_0x412e50['stack']);return null;}});if(_0x321131[_0x450f('0x4d')]){logger[_0x450f('0x13')](util[_0x450f('0x14')](_0x450f('0x4e'),_0x4facbe[_0x450f('0x1b')],_0x4facbe['calleridname'],_0x4facbe[_0x450f('0x1f')],_0x4facbe[_0x450f('0x1c')],_0x4facbe[_0x450f('0x1d')]));_0x49b599[_0x450f('0x41')](_0x321131[_0x450f('0x4d')]['id'],function(_0x1ca9e1){try{_0x1ca9e1=_0xedb7bf[_0x450f('0x42')](_0x1ca9e1);logger['debug'](_0x450f('0x43'),JSON[_0x450f('0x37')](_0x1ca9e1,null,0x2));if(_0x1ca9e1&&_0xedb7bf[_0x1ca9e1[_0x450f('0x24')]]){_0x1de9a7=_0xedb7bf[_0x1ca9e1[_0x450f('0x24')]](_0x1ca9e1);if(_0x1de9a7){logger[_0x450f('0x35')](_0x450f('0x49'),getLogFromObject(_0x1de9a7));return _[_0x450f('0x4f')](_0x1de9a7[_0x450f('0x4a')])?null:_0x1de9a7[_0x450f('0x4a')][_0x450f('0x4b')]();}else{logger[_0x450f('0xe')](_0x450f('0x49'),getLogFromObject(_0x1de9a7));return null;}}else{logger[_0x450f('0xe')]('agicommand\x20not\x20found');return null;}}catch(_0x43f578){logger['error'](_0x43f578[_0x450f('0xf')]);return null;}});}logger[_0x450f('0x13')](util[_0x450f('0x14')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4facbe[_0x450f('0x1b')],_0x4facbe[_0x450f('0x1e')],_0x4facbe[_0x450f('0x1f')],_0x4facbe[_0x450f('0x1c')],_0x4facbe['uniqueid']));logger[_0x450f('0x13')](util[_0x450f('0x14')](_0x450f('0x50'),_0x4facbe[_0x450f('0x46')],_0x4facbe[_0x450f('0x47')],parseInt(_0x4facbe[_0x450f('0x48')],0xa)+0x1));_0x4facbe[_0x450f('0x51')](_0x4facbe[_0x450f('0x46')],_0x4facbe[_0x450f('0x47')],parseInt(_0x4facbe[_0x450f('0x48')],0xa)+0x1);_0x4facbe[_0x450f('0x38')]();}}else{logger['error'](util[_0x450f('0x14')](_0x450f('0x52'),_0x4facbe['arg_1']));_0x4facbe[_0x450f('0x51')](_0x4facbe[_0x450f('0x46')],_0x4facbe[_0x450f('0x47')],parseInt(_0x4facbe[_0x450f('0x48')],0xa)+0x1);_0x4facbe[_0x450f('0x38')]();}}else{logger['error'](util[_0x450f('0x14')]('Project\x20%s\x20not\x20found',_0x4facbe[_0x450f('0x1b')]));_0x4facbe[_0x450f('0x51')](_0x4facbe[_0x450f('0x46')],_0x4facbe[_0x450f('0x47')],parseInt(_0x4facbe['priority'],0xa)+0x1);_0x4facbe[_0x450f('0x38')]();}}function main(){var _0x26390d;return utilLicense['getLicense']()['then'](function(_0x5befba){if(_0x5befba){if(_0x5befba[_0x450f('0x53')]){if(_0x5befba[_0x450f('0x54')]&&_0x5befba[_0x450f('0x54')]>0x0){logger[_0x450f('0x13')](util['format'](_0x450f('0x55'),_0x5befba['callysquare']));_0x26390d=_0x5befba[_0x450f('0x54')];}else{logger[_0x450f('0x13')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x450f('0x13')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x26390d=-0x1;}}})['catch'](function(_0x23d5c9){logger[_0x450f('0xe')]('[LICENSE]',_0x23d5c9[_0x450f('0xf')]);})['finally'](function(){var _0x622a8a=require(_0x450f('0x56'))(config[_0x450f('0x6')][_0x450f('0x12')],config['agi']['ip'],_0x26390d);_0x622a8a['on']('error',errorHandler);_0x622a8a['on'](_0x450f('0x57'),listeningHandler);_0x622a8a['on'](_0x450f('0x58'),connectionHandler);_0x622a8a['on'](_0x450f('0x38'),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 0c72214..45d477d 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 _0xb966=['http','request','then','error','message','result','catch','sendMailMessage','jayson/promise','client'];(function(_0x5787f5,_0x880cdd){var _0x3c69b6=function(_0xdaac49){while(--_0xdaac49){_0x5787f5['push'](_0x5787f5['shift']());}};_0x3c69b6(++_0x880cdd);}(_0xb966,0x12a));var _0x6b96=function(_0x371d88,_0x4acbb9){_0x371d88=_0x371d88-0x0;var _0x3c36b4=_0xb966[_0x371d88];return _0x3c36b4;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x6b96('0x0'));var client=jayson[_0x6b96('0x1')][_0x6b96('0x2')]({'port':0x232b});function request(_0x1f98f1,_0x1e97e8){return new BPromise(function(_0x5a0efa,_0x117822){return client[_0x6b96('0x3')](_0x1f98f1,_0x1e97e8)[_0x6b96('0x4')](function(_0x211e59){if(_0x211e59[_0x6b96('0x5')]){return _0x117822(_0x211e59[_0x6b96('0x5')][_0x6b96('0x6')]);}else{return _0x5a0efa(_0x211e59[_0x6b96('0x7')]);}})[_0x6b96('0x8')](function(_0x2d6495){return _0x117822(_0x2d6495);});});}exports[_0x6b96('0x9')]=function(_0x139192,_0x174f6a){return request('SendMail',{'account':_0x139192,'message':_0x174f6a});}; \ No newline at end of file +var _0x3b2d=['SendMail','bluebird','jayson/promise','client','http','error','message','result','catch','sendMailMessage'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x3b2d,0xb5));var _0xd3b2=function(_0x26cf15,_0x5251ea){_0x26cf15=_0x26cf15-0x0;var _0x47daba=_0x3b2d[_0x26cf15];return _0x47daba;};'use strict';var BPromise=require(_0xd3b2('0x0'));var jayson=require(_0xd3b2('0x1'));var client=jayson[_0xd3b2('0x2')][_0xd3b2('0x3')]({'port':0x232b});function request(_0x162906,_0x1a6f43){return new BPromise(function(_0x13c1b4,_0x2ab9b0){return client['request'](_0x162906,_0x1a6f43)['then'](function(_0x5cc5bc){if(_0x5cc5bc['error']){return _0x2ab9b0(_0x5cc5bc[_0xd3b2('0x4')][_0xd3b2('0x5')]);}else{return _0x13c1b4(_0x5cc5bc[_0xd3b2('0x6')]);}})[_0xd3b2('0x7')](function(_0x349552){return _0x2ab9b0(_0x349552);});});}exports[_0xd3b2('0x8')]=function(_0xff13c4,_0x396e25){return request(_0xd3b2('0x9'),{'account':_0xff13c4,'message':_0x396e25});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index b8eba6b..34c1cbf 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 _0x58a4=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','toString','indexOf','substring','length','slice','trim','emit','headers','line'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x58a4,0xbf));var _0x458a=function(_0x38b149,_0x34ac58){_0x38b149=_0x38b149-0x0;var _0x97edb8=_0x58a4[_0x38b149];return _0x97edb8;};'use strict';var util=require(_0x458a('0x0'));var Transform=require(_0x458a('0x1'))[_0x458a('0x2')];function AGIReply(_0x1e23ea){Transform[_0x458a('0x3')](this,_0x1e23ea);this[_0x458a('0x4')]='';this[_0x458a('0x5')]=![];}util[_0x458a('0x6')](AGIReply,Transform);AGIReply[_0x458a('0x7')][_0x458a('0x8')]=function(_0x2fde72,_0x4443d1,_0x2f5d44){var _0x57de3c='\x0a',_0x5358c2=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x30b095=-0x1,_0x11fcaa=-0x1,_0x2029bc='',_0x1e658e=0x0,_0x41509e='',_0x55bf10='';this[_0x458a('0x4')]+=_0x2fde72[_0x458a('0x9')]();_0x41509e=this[_0x458a('0x4')];if(!this[_0x458a('0x5')]){_0x1e658e=0x0;while(_0x5358c2[_0x1e658e]){while((_0x11fcaa=_0x41509e[_0x458a('0xa')](_0x5358c2[_0x1e658e]))!=-0x1){_0x2029bc=_0x5358c2[_0x1e658e];_0x55bf10=_0x41509e['substring'](0x0,_0x11fcaa);_0x41509e=_0x41509e[_0x458a('0xb')](_0x11fcaa+_0x2029bc[_0x458a('0xc')]);var _0x5a3874=_0x55bf10['split'](_0x57de3c),_0x183d9d=0x0,_0x3ffa68={},_0xee09c6='',_0x2a4934='',_0x2e788b=-0x1;while(_0x5a3874[_0x183d9d]){_0x2e788b=_0x5a3874[_0x183d9d]['indexOf'](':');if(_0x2e788b!=-0x1){_0xee09c6=_0x5a3874[_0x183d9d][_0x458a('0xd')](0x0,_0x2e788b)['trim']();_0x2a4934=_0x5a3874[_0x183d9d][_0x458a('0xd')](_0x2e788b+0x1)[_0x458a('0xe')]();if(_0xee09c6[_0x458a('0xc')]>0x0){_0x3ffa68[_0xee09c6]=_0x2a4934;}}else{}_0x183d9d++;}this[_0x458a('0xf')](_0x458a('0x10'),_0x3ffa68);this[_0x458a('0x5')]=!![];}_0x1e658e++;}this['_localBuffer']=_0x41509e;}else{while((_0x30b095=_0x41509e['indexOf'](_0x57de3c))!=-0x1){_0x55bf10=_0x41509e['substring'](0x0,_0x30b095);this[_0x458a('0xf')](_0x458a('0x11'),_0x55bf10);_0x41509e=_0x41509e[_0x458a('0xb')](_0x30b095+_0x57de3c['length']);}this[_0x458a('0x4')]=_0x41509e;}_0x2f5d44();};module[_0x458a('0x12')]=AGIReply; \ No newline at end of file +var _0xb18e=['slice','trim','length','emit','headers','line','exports','util','stream','Transform','call','_localBuffer','_inBody','_transform','indexOf','substring'];(function(_0x1042c4,_0x390bbe){var _0x349745=function(_0x4dc80c){while(--_0x4dc80c){_0x1042c4['push'](_0x1042c4['shift']());}};_0x349745(++_0x390bbe);}(_0xb18e,0x147));var _0xeb18=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0xb18e[_0x590b63];return _0x3c9380;};'use strict';var util=require(_0xeb18('0x0'));var Transform=require(_0xeb18('0x1'))[_0xeb18('0x2')];function AGIReply(_0x487595){Transform[_0xeb18('0x3')](this,_0x487595);this[_0xeb18('0x4')]='';this[_0xeb18('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0xeb18('0x6')]=function(_0x5dce0c,_0x524b2d,_0x50f935){var _0x474d7b='\x0a',_0x1aade2=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x43c5e2=-0x1,_0x3f7204=-0x1,_0x293512='',_0x3874f1=0x0,_0x210203='',_0x23683f='';this[_0xeb18('0x4')]+=_0x5dce0c['toString']();_0x210203=this['_localBuffer'];if(!this[_0xeb18('0x5')]){_0x3874f1=0x0;while(_0x1aade2[_0x3874f1]){while((_0x3f7204=_0x210203[_0xeb18('0x7')](_0x1aade2[_0x3874f1]))!=-0x1){_0x293512=_0x1aade2[_0x3874f1];_0x23683f=_0x210203[_0xeb18('0x8')](0x0,_0x3f7204);_0x210203=_0x210203[_0xeb18('0x8')](_0x3f7204+_0x293512['length']);var _0x2750f9=_0x23683f['split'](_0x474d7b),_0x262a17=0x0,_0x4d1cfe={},_0x3d9ec5='',_0x26dbdf='',_0x14d2a2=-0x1;while(_0x2750f9[_0x262a17]){_0x14d2a2=_0x2750f9[_0x262a17]['indexOf'](':');if(_0x14d2a2!=-0x1){_0x3d9ec5=_0x2750f9[_0x262a17][_0xeb18('0x9')](0x0,_0x14d2a2)[_0xeb18('0xa')]();_0x26dbdf=_0x2750f9[_0x262a17][_0xeb18('0x9')](_0x14d2a2+0x1)[_0xeb18('0xa')]();if(_0x3d9ec5[_0xeb18('0xb')]>0x0){_0x4d1cfe[_0x3d9ec5]=_0x26dbdf;}}else{}_0x262a17++;}this[_0xeb18('0xc')](_0xeb18('0xd'),_0x4d1cfe);this['_inBody']=!![];}_0x3874f1++;}this['_localBuffer']=_0x210203;}else{while((_0x43c5e2=_0x210203[_0xeb18('0x7')](_0x474d7b))!=-0x1){_0x23683f=_0x210203[_0xeb18('0x8')](0x0,_0x43c5e2);this[_0xeb18('0xc')](_0xeb18('0xe'),_0x23683f);_0x210203=_0x210203[_0xeb18('0x8')](_0x43c5e2+_0x474d7b[_0xeb18('0xb')]);}this[_0xeb18('0x4')]=_0x210203;}_0x50f935();};module[_0xeb18('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 9f1ef7d..6ba66bf 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 _0xcdd8=['LogoutUser','bluebird','lodash','util','jayson/promise','http','then','error','message','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout'];(function(_0x3d540d,_0x3ee0d6){var _0x37b31e=function(_0x356d2b){while(--_0x356d2b){_0x3d540d['push'](_0x3d540d['shift']());}};_0x37b31e(++_0x3ee0d6);}(_0xcdd8,0xaf));var _0x8cdd=function(_0x128a16,_0xd5de88){_0x128a16=_0x128a16-0x0;var _0x4504e4=_0xcdd8[_0x128a16];return _0x4504e4;};'use strict';var BPromise=require(_0x8cdd('0x0'));var moment=require('moment');var _=require(_0x8cdd('0x1'));var util=require(_0x8cdd('0x2'));var jayson=require(_0x8cdd('0x3'));var client=jayson['client'][_0x8cdd('0x4')]({'port':0x2329});function request(_0x8bc9ac,_0x306e2d){return new BPromise(function(_0xd0aa16,_0x65a58f){return client['request'](_0x8bc9ac,_0x306e2d)[_0x8cdd('0x5')](function(_0x3c50dc){if(_0x3c50dc[_0x8cdd('0x6')]){return _0x65a58f(_0x3c50dc[_0x8cdd('0x6')][_0x8cdd('0x7')]);}else{return _0xd0aa16(_0x3c50dc['result']);}})['catch'](function(_0x5aa826){return _0x65a58f(_0x5aa826);});});}exports[_0x8cdd('0x8')]=function(){return request(_0x8cdd('0x9'),{'options':{'raw':![],'attributes':['id',_0x8cdd('0xa'),'production']}});};exports[_0x8cdd('0xb')]=function(_0x5eee96){return request(_0x8cdd('0xc'),{'options':{'raw':![],'where':{'name':_0x5eee96},'attributes':[_0x8cdd('0xd')]}});};exports[_0x8cdd('0xe')]=function(_0x5a0f37){return request(_0x8cdd('0xf'),{'options':{'raw':![],'where':{'id':_0x5a0f37},'include':[{'model':'MailServerOut','as':_0x8cdd('0x10'),'include':[{'model':_0x8cdd('0x11'),'as':_0x8cdd('0x11')}]}],'attributes':['id',_0x8cdd('0xa'),_0x8cdd('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x4648c9){return request(_0x8cdd('0xc'),{'options':{'where':{'id':_0x4648c9},'attributes':[_0x8cdd('0xa')]}});};exports['getVoiceQueueById']=function(_0x391c9d){return request(_0x8cdd('0x13'),{'options':{'where':{'id':_0x391c9d},'attributes':[_0x8cdd('0xa')]}});};exports[_0x8cdd('0x14')]=function(_0x59a554){return request(_0x8cdd('0x15'),{'options':{'where':{'id':_0x59a554},'attributes':[_0x8cdd('0xa')]}});};exports[_0x8cdd('0x16')]=function(_0x453e04){return request(_0x8cdd('0x17'),{'options':{'where':{'id':_0x453e04},'attributes':['dsn']}});};exports[_0x8cdd('0x18')]=function(_0x178a0e){return request('ShowUser',{'options':{'where':{'id':_0x178a0e},'attributes':['name']}});};exports[_0x8cdd('0x19')]=function(_0x4f6e8f){return request(_0x8cdd('0x1a'),{'options':{'where':{'phone':_0x4f6e8f[_0x8cdd('0x1b')]},'attributes':['id']}});};exports[_0x8cdd('0x1c')]=function(_0x428eb3){return request(_0x8cdd('0x1d'),{'options':{'where':{'id':_0x428eb3},'attributes':['name']}});};exports['getSoundById']=function(_0x4ae3f3){return request(_0x8cdd('0x1e'),{'options':{'where':{'id':_0x4ae3f3},'attributes':[_0x8cdd('0x1f')]}});};exports[_0x8cdd('0x20')]=function(_0x1905c4){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1905c4},'include':[{'model':'Interval','as':_0x8cdd('0x21')}]}});};exports[_0x8cdd('0x22')]=function(_0x291302){return request(_0x8cdd('0x23'),{'options':{'where':{'id':_0x291302},'attributes':['id',_0x8cdd('0xa')]}});};exports['createSmsMessage']=function(_0x26b5c8){return request(_0x8cdd('0x24'),{'body':_0x26b5c8});};exports[_0x8cdd('0x25')]=function(_0x4e5662){return request(_0x8cdd('0x26'),{'body':_0x4e5662});};exports['createSquareReport']=function(_0x42a1fc){return request(_0x8cdd('0x27'),{'body':_[_0x8cdd('0x28')](_0x42a1fc,{'project_name':_0x42a1fc[_0x8cdd('0x29')],'prev_project_name':_0x42a1fc['arg_2']||'','is_subproject':_0x42a1fc[_0x8cdd('0x2a')]?!![]:![],'leaveAt':moment()[_0x8cdd('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x34f6e2){return request('CreateSquareRecording',{'body':_0x34f6e2});};exports[_0x8cdd('0x2c')]=function(_0x1697ad){return request(_0x8cdd('0x2d'),{'body':_0x1697ad});};exports[_0x8cdd('0x2e')]=function(_0x331f4e){return request(_0x8cdd('0x2f'),{'options':{'raw':![],'where':{'phone':_0x331f4e[_0x8cdd('0x1b')],'ListId':_0x331f4e[_0x8cdd('0x30')]}}})['then'](function(_0x44dc5b){if(_0x44dc5b){return _0x44dc5b;}return request('CreateCmContact',{'body':_0x331f4e});});};exports[_0x8cdd('0x31')]=function(_0x38a34e){return request('ShowPause',{'options':{'where':{'id':_0x38a34e},'attributes':['name']}});};exports[_0x8cdd('0x32')]=function(_0x50508b,_0x4fcfc3){return request(_0x8cdd('0x33'),{'body':{'interface':_0x4fcfc3},'options':{'where':_0x50508b}});};exports[_0x8cdd('0x34')]=function(_0x470640,_0x37ea99,_0x108755){return request(_0x8cdd('0x35'),{'body':{'type':_0x37ea99,'uniqueid':_0x108755},'options':{'where':_0x470640}});};exports[_0x8cdd('0x36')]=function(_0x3d800a){return request(_0x8cdd('0x37'),{'body':{},'options':{'where':_0x3d800a}});};exports[_0x8cdd('0x38')]=function(_0x3aa16e){return request(_0x8cdd('0x39'),{'body':{},'options':{'where':_0x3aa16e}});}; \ No newline at end of file +var _0x4954=['getSquareProjectById','ShowSquareProject','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','phone','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','client','then','error','message','result','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','name'];(function(_0x411fd8,_0x5dab50){var _0x47ca67=function(_0x918845){while(--_0x918845){_0x411fd8['push'](_0x411fd8['shift']());}};_0x47ca67(++_0x5dab50);}(_0x4954,0x119));var _0x4495=function(_0x384961,_0x2e742b){_0x384961=_0x384961-0x0;var _0x20e3ad=_0x4954[_0x384961];return _0x20e3ad;};'use strict';var BPromise=require(_0x4495('0x0'));var moment=require(_0x4495('0x1'));var _=require(_0x4495('0x2'));var util=require('util');var jayson=require(_0x4495('0x3'));var client=jayson[_0x4495('0x4')]['http']({'port':0x2329});function request(_0xb56372,_0x37cc5c){return new BPromise(function(_0x51ea79,_0xc9991d){return client['request'](_0xb56372,_0x37cc5c)[_0x4495('0x5')](function(_0x126060){if(_0x126060[_0x4495('0x6')]){return _0xc9991d(_0x126060[_0x4495('0x6')][_0x4495('0x7')]);}else{return _0x51ea79(_0x126060[_0x4495('0x8')]);}})[_0x4495('0x9')](function(_0x157856){return _0xc9991d(_0x157856);});});}exports[_0x4495('0xa')]=function(){return request(_0x4495('0xb'),{'options':{'raw':![],'attributes':['id','name',_0x4495('0xc')]}});};exports[_0x4495('0xd')]=function(_0x46f67d){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x46f67d},'attributes':[_0x4495('0xc')]}});};exports[_0x4495('0xe')]=function(_0x3859ba){return request(_0x4495('0xf'),{'options':{'raw':![],'where':{'id':_0x3859ba},'include':[{'model':'MailServerOut','as':_0x4495('0x10'),'include':[{'model':_0x4495('0x11'),'as':_0x4495('0x11')}]}],'attributes':['id',_0x4495('0x12'),'email'],'smtp':!![]}});};exports[_0x4495('0x13')]=function(_0x3e4b9d){return request(_0x4495('0x14'),{'options':{'where':{'id':_0x3e4b9d},'attributes':[_0x4495('0x12')]}});};exports['getVoiceQueueById']=function(_0xdd5bce){return request(_0x4495('0x15'),{'options':{'where':{'id':_0xdd5bce},'attributes':['name']}});};exports[_0x4495('0x16')]=function(_0x28763e){return request(_0x4495('0x17'),{'options':{'where':{'id':_0x28763e},'attributes':[_0x4495('0x12')]}});};exports[_0x4495('0x18')]=function(_0x3a4190){return request(_0x4495('0x19'),{'options':{'where':{'id':_0x3a4190},'attributes':['dsn']}});};exports[_0x4495('0x1a')]=function(_0xd21898){return request(_0x4495('0x1b'),{'options':{'where':{'id':_0xd21898},'attributes':[_0x4495('0x12')]}});};exports[_0x4495('0x1c')]=function(_0x224017){return request(_0x4495('0x1d'),{'options':{'where':{'phone':_0x224017['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x6d2c6b){return request(_0x4495('0x1e'),{'options':{'where':{'id':_0x6d2c6b},'attributes':[_0x4495('0x12')]}});};exports[_0x4495('0x1f')]=function(_0x316079){return request(_0x4495('0x20'),{'options':{'where':{'id':_0x316079},'attributes':[_0x4495('0x21')]}});};exports['getIntervalById']=function(_0x2193d6){return request(_0x4495('0x22'),{'options':{'raw':![],'where':{'id':_0x2193d6},'include':[{'model':'Interval','as':_0x4495('0x23')}]}});};exports[_0x4495('0x24')]=function(_0x8d1b88){return request('ShowSmsAccount',{'options':{'where':{'id':_0x8d1b88},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x408e0f){return request(_0x4495('0x25'),{'body':_0x408e0f});};exports[_0x4495('0x26')]=function(_0x3a0a54){return request(_0x4495('0x27'),{'body':_0x3a0a54});};exports[_0x4495('0x28')]=function(_0x25e3dc){return request(_0x4495('0x29'),{'body':_[_0x4495('0x2a')](_0x25e3dc,{'project_name':_0x25e3dc[_0x4495('0x2b')],'prev_project_name':_0x25e3dc[_0x4495('0x2c')]||'','is_subproject':_0x25e3dc[_0x4495('0x2c')]?!![]:![],'leaveAt':moment()[_0x4495('0x2d')](_0x4495('0x2e'))})});};exports['createSquareRecording']=function(_0x674803){return request(_0x4495('0x2f'),{'body':_0x674803});};exports[_0x4495('0x30')]=function(_0xc2bf5f){return request(_0x4495('0x31'),{'body':_0xc2bf5f});};exports['createCmContact']=function(_0xebbc88){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xebbc88[_0x4495('0x32')],'ListId':_0xebbc88['ListId']}}})['then'](function(_0x3120ee){if(_0x3120ee){return _0x3120ee;}return request('CreateCmContact',{'body':_0xebbc88});});};exports[_0x4495('0x33')]=function(_0x311417){return request(_0x4495('0x34'),{'options':{'where':{'id':_0x311417},'attributes':['name']}});};exports['agentLogin']=function(_0x10ec4a,_0x118789){return request(_0x4495('0x35'),{'body':{'interface':_0x118789},'options':{'where':_0x10ec4a}});};exports[_0x4495('0x36')]=function(_0xe05617,_0x58722e,_0x2b3578){return request(_0x4495('0x37'),{'body':{'type':_0x58722e,'uniqueid':_0x2b3578},'options':{'where':_0xe05617}});};exports[_0x4495('0x38')]=function(_0x48175a){return request(_0x4495('0x39'),{'body':{},'options':{'where':_0x48175a}});};exports[_0x4495('0x3a')]=function(_0x4184a9){return request(_0x4495('0x3b'),{'body':{},'options':{'where':_0x4184a9}});}; \ 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 9313f1e..7143029 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 _0x0c42=['./lex','exports','./polly'];(function(_0x2df724,_0x411382){var _0x1b2504=function(_0x1d3cd1){while(--_0x1d3cd1){_0x2df724['push'](_0x2df724['shift']());}};_0x1b2504(++_0x411382);}(_0x0c42,0x191));var _0x20c4=function(_0x215cf2,_0x137c95){_0x215cf2=_0x215cf2-0x0;var _0x47c2de=_0x0c42[_0x215cf2];return _0x47c2de;};var polly=require(_0x20c4('0x0'));var lex=require(_0x20c4('0x1'));module[_0x20c4('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xf981=['./lex','exports','./polly'];(function(_0x389029,_0x399237){var _0x370b28=function(_0xedd299){while(--_0xedd299){_0x389029['push'](_0x389029['shift']());}};_0x370b28(++_0x399237);}(_0xf981,0xe6));var _0x1f98=function(_0x233255,_0x1e9f19){_0x233255=_0x233255-0x0;var _0x42c980=_0xf981[_0x233255];return _0x42c980;};var polly=require(_0x1f98('0x0'));var lex=require(_0x1f98('0x1'));module[_0x1f98('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 23d2cd1..c7c71e4 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 _0x6f0d=['exports'];(function(_0x4e2426,_0xee3e56){var _0xb40e08=function(_0x266357){while(--_0x266357){_0x4e2426['push'](_0x4e2426['shift']());}};_0xb40e08(++_0xee3e56);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5046c1,_0x467e28){_0x5046c1=_0x5046c1-0x0;var _0x42238f=_0x6f0d[_0x5046c1];return _0x42238f;};'use strict';var lex=require('./lib/api');module[_0xd6f0('0x0')]=function(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93){return lex(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93);}; \ No newline at end of file +var _0x96cc=['./lib/api'];(function(_0x1ec976,_0x59f6f2){var _0x1a5ddb=function(_0x1d74de){while(--_0x1d74de){_0x1ec976['push'](_0x1ec976['shift']());}};_0x1a5ddb(++_0x59f6f2);}(_0x96cc,0x16c));var _0xc96c=function(_0x347826,_0x57f63c){_0x347826=_0x347826-0x0;var _0x1696de=_0x96cc[_0x347826];return _0x1696de;};'use strict';var lex=require(_0xc96c('0x0'));module['exports']=function(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701){return lex(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index a023118..cb538ca 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(_0x49d624,_0x137a11){var _0x4d6d1b=function(_0x39171a){while(--_0x39171a){_0x49d624['push'](_0x49d624['shift']());}};_0x4d6d1b(++_0x137a11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x46b715,_0x18a2d0){var _0x4edc42=function(_0x1697ae){while(--_0x1697ae){_0x46b715['push'](_0x46b715['shift']());}};_0x4edc42(++_0x18a2d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 fe5b576..d3b7bfa 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 _0xfd8a=['exports','./lib/api'];(function(_0x4de7fb,_0x59ccb2){var _0x4cf312=function(_0x32355b){while(--_0x32355b){_0x4de7fb['push'](_0x4de7fb['shift']());}};_0x4cf312(++_0x59ccb2);}(_0xfd8a,0x185));var _0xafd8=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0xfd8a[_0x507ac5];return _0x12c1bc;};'use strict';var polly=require(_0xafd8('0x0'));module[_0xafd8('0x1')]=function(_0x101645,_0xda4574,_0xf3fcc,_0x36b777,_0x11bf2a,_0x1ce4e6,_0x5b77d8){return polly(_0x101645,_0xda4574,_0xf3fcc,_0x36b777,_0x11bf2a,_0x1ce4e6,_0x5b77d8);}; \ No newline at end of file +var _0x2cb3=['./lib/api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2cb3,0x183));var _0x32cb=function(_0x53aa12,_0x2e7921){_0x53aa12=_0x53aa12-0x0;var _0x356775=_0x2cb3[_0x53aa12];return _0x356775;};'use strict';var polly=require(_0x32cb('0x0'));module['exports']=function(_0x27459c,_0xc5a567,_0x149085,_0x22141a,_0x4296b0,_0x26f2fa,_0x9c6209){return polly(_0x27459c,_0xc5a567,_0x149085,_0x22141a,_0x4296b0,_0x26f2fa,_0x9c6209);}; \ 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 5345ee6..4ce5186 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 _0x8925=['synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','randomstring'];(function(_0x55c598,_0xaf362e){var _0x160dc8=function(_0x3bb073){while(--_0x3bb073){_0x55c598['push'](_0x55c598['shift']());}};_0x160dc8(++_0xaf362e);}(_0x8925,0x1de));var _0x5892=function(_0x372515,_0xdd11f){_0x372515=_0x372515-0x0;var _0xa3bf4e=_0x8925[_0x372515];return _0xa3bf4e;};'use strict';var fs=require('fs');var path=require(_0x5892('0x0'));var BPromise=require('bluebird');var rs=require(_0x5892('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x4dc6c1,_0x278977,_0xccc48){return new BPromise(function(_0x38d69e,_0x1eaeae){_0x4dc6c1[_0x5892('0x2')](_0x278977,function(_0x1ca0c7,_0x41e0d2){if(_0x1ca0c7){_0x1eaeae(_0x1ca0c7);}else if(_0x41e0d2){if(_0x41e0d2['AudioStream']instanceof Buffer){fs[_0x5892('0x3')](_0xccc48,_0x41e0d2[_0x5892('0x4')],function(_0x3c84fe){if(_0x3c84fe){_0x1eaeae(_0x3c84fe);}else{_0x38d69e();}});}else{_0x1eaeae(new Error(_0x5892('0x5')));}}else{_0x1eaeae(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x5892('0x6')]=function(_0x1be2ec,_0x1575dd,_0x1cc45a,_0x128e92,_0x5ec1ac,_0x569569,_0x4ad30d){var _0x7a64d1=new AWS[(_0x5892('0x7'))]({'accessKeyId':_0x1be2ec,'secretAccessKey':_0x1575dd,'region':_0x1cc45a});var _0x2ab6d9={'Text':_0x5ec1ac,'TextType':_0x569569||_0x5892('0x8'),'OutputFormat':_0x5892('0x9'),'VoiceId':_0x128e92};return pollyResult(_0x7a64d1,_0x2ab6d9,_0x4ad30d);}; \ No newline at end of file +var _0x278b=['Polly','text','mp3','path','bluebird','randomstring','aws-sdk','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x38c8d3,_0x1409fd){var _0x2e7571=function(_0x3b7545){while(--_0x3b7545){_0x38c8d3['push'](_0x38c8d3['shift']());}};_0x2e7571(++_0x1409fd);}(_0x278b,0x1b1));var _0xb278=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x278b[_0x4521e3];return _0x46a272;};'use strict';var fs=require('fs');var path=require(_0xb278('0x0'));var BPromise=require(_0xb278('0x1'));var rs=require(_0xb278('0x2'));var AWS=require(_0xb278('0x3'));function pollyResult(_0x3c3cbd,_0x43033e,_0x31583c){return new BPromise(function(_0x4f9b3c,_0x1f95f8){_0x3c3cbd['synthesizeSpeech'](_0x43033e,function(_0x2036e5,_0x2cc2af){if(_0x2036e5){_0x1f95f8(_0x2036e5);}else if(_0x2cc2af){if(_0x2cc2af['AudioStream']instanceof Buffer){fs[_0xb278('0x4')](_0x31583c,_0x2cc2af['AudioStream'],function(_0x42e992){if(_0x42e992){_0x1f95f8(_0x42e992);}else{_0x4f9b3c();}});}else{_0x1f95f8(new Error(_0xb278('0x5')));}}else{_0x1f95f8(new Error(_0xb278('0x6')));}});});}module['exports']=function(_0x9bd8ce,_0x50acbd,_0x18a02c,_0x697a44,_0x49ed71,_0x4cf4b1,_0x310cef){var _0xb3bc5=new AWS[(_0xb278('0x7'))]({'accessKeyId':_0x9bd8ce,'secretAccessKey':_0x50acbd,'region':_0x18a02c});var _0x252c27={'Text':_0x49ed71,'TextType':_0x4cf4b1||_0xb278('0x8'),'OutputFormat':_0xb278('0x9'),'VoiceId':_0x697a44};return pollyResult(_0xb3bc5,_0x252c27,_0x310cef);}; \ 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 019d295..f7041d3 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 _0x7484=['./lib/api','exports'];(function(_0x5926f6,_0x4edf99){var _0xd187b4=function(_0x126180){while(--_0x126180){_0x5926f6['push'](_0x5926f6['shift']());}};_0xd187b4(++_0x4edf99);}(_0x7484,0x1ce));var _0x4748=function(_0x44c283,_0x222759){_0x44c283=_0x44c283-0x0;var _0x424c16=_0x7484[_0x44c283];return _0x424c16;};'use strict';var asr=require(_0x4748('0x0'));module[_0x4748('0x1')]=function(_0x393237,_0x50feee,_0x9c4b0,_0x5ac6f1){return asr(_0x393237,_0x50feee,_0x9c4b0);}; \ No newline at end of file +var _0xfcff=['exports','./lib/api'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfcff,0x1c3));var _0xffcf=function(_0x237f8d,_0x474a76){_0x237f8d=_0x237f8d-0x0;var _0x324543=_0xfcff[_0x237f8d];return _0x324543;};'use strict';var asr=require(_0xffcf('0x0'));module[_0xffcf('0x1')]=function(_0x1e4868,_0xf62698,_0x24b359,_0x5b275f){return asr(_0x1e4868,_0xf62698,_0x24b359);}; \ 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 0dfc4fb..9235d74 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 _0xe600=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x2e25af,_0x1e764a){var _0x204862=function(_0x3f7005){while(--_0x3f7005){_0x2e25af['push'](_0x2e25af['shift']());}};_0x204862(++_0x1e764a);}(_0xe600,0x159));var _0x0e60=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe600[_0x122ef9];return _0x42fba0;};'use strict';var url=require('url');var BPromise=require(_0x0e60('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x0e60('0x1')]=function(_0x449b56,_0x1476ac,_0x3f0912){return new BPromise(function(_0x3c7873,_0x276bdb){var _0x1838bf;if(typeof _0x449b56!==_0x0e60('0x2')||_0x449b56[_0x0e60('0x3')]===0x0){return _0x276bdb(_0x0e60('0x4'));}if(typeof _0x1476ac!=='string'||_0x1476ac[_0x0e60('0x3')]===0x0){return _0x276bdb(_0x0e60('0x5'));}if(typeof _0x3f0912!==_0x0e60('0x6')&&(typeof _0x3f0912!==_0x0e60('0x2')||_0x3f0912['length']===0x0)){return _0x276bdb(_0x0e60('0x7'));}try{_0x1838bf=fs[_0x0e60('0x8')](_0x449b56)[_0x0e60('0x9')](_0x0e60('0xa'));}catch(_0x300dfb){return _0x276bdb(_0x300dfb);}return _0x3c7873({'method':_0x0e60('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x1476ac,'body':{'config':{'encoding':_0x0e60('0xc'),'sampleRateHertz':_0x0e60('0xd'),'languageCode':_0x3f0912},'audio':{'content':_0x1838bf}},'json':!![]});});}; \ No newline at end of file +var _0x8868=['base64','/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com','exports','string','length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x8868,0x1ca));var _0x8886=function(_0x2913c3,_0x3d6f06){_0x2913c3=_0x2913c3-0x0;var _0x505d37=_0x8868[_0x2913c3];return _0x505d37;};'use strict';var url=require(_0x8886('0x0'));var BPromise=require(_0x8886('0x1'));var fs=require('fs');var host=_0x8886('0x2');module[_0x8886('0x3')]=function(_0x11d0f9,_0x46ec8e,_0x34cd50){return new BPromise(function(_0x2508b2,_0x230fbb){var _0x224e93;if(typeof _0x11d0f9!==_0x8886('0x4')||_0x11d0f9['length']===0x0){return _0x230fbb('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x46ec8e!==_0x8886('0x4')||_0x46ec8e[_0x8886('0x5')]===0x0){return _0x230fbb('key\x20should\x20be\x20a\x20string');}if(typeof _0x34cd50!==_0x8886('0x6')&&(typeof _0x34cd50!=='string'||_0x34cd50[_0x8886('0x5')]===0x0)){return _0x230fbb(_0x8886('0x7'));}try{_0x224e93=fs[_0x8886('0x8')](_0x11d0f9)[_0x8886('0x9')](_0x8886('0xa'));}catch(_0x57b50){return _0x230fbb(_0x57b50);}return _0x2508b2({'method':'POST','uri':host+_0x8886('0xb')+_0x46ec8e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x34cd50},'audio':{'content':_0x224e93}},'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 85e97c4..98cf396 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 _0xbb4d=['./asr','exports'];(function(_0x5d868d,_0x43775e){var _0x29d5e1=function(_0x566061){while(--_0x566061){_0x5d868d['push'](_0x5d868d['shift']());}};_0x29d5e1(++_0x43775e);}(_0xbb4d,0xa4));var _0xdbb4=function(_0xc8cb25,_0x4468d2){_0xc8cb25=_0xc8cb25-0x0;var _0x3bb6cc=_0xbb4d[_0xc8cb25];return _0x3bb6cc;};var asr=require(_0xdbb4('0x0'));module[_0xdbb4('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5818=['./asr'];(function(_0x1894eb,_0x5e2f8b){var _0x5b4f72=function(_0x3a0d15){while(--_0x3a0d15){_0x1894eb['push'](_0x1894eb['shift']());}};_0x5b4f72(++_0x5e2f8b);}(_0x5818,0x1a9));var _0x8581=function(_0x494bad,_0x5e272a){_0x494bad=_0x494bad-0x0;var _0x4319bb=_0x5818[_0x494bad];return _0x4319bb;};var asr=require(_0x8581('0x0'));module['exports']={'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 6fb7b26..0142b1b 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 _0x0dcb=['writeFileSync','base64','then','unlink','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','POST','tmp','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','map','transcript','alternatives','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','googleDialogflow','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','https:','data','transcode','wav','error\x20convert','resolve','generate','.wav'];(function(_0x1d408d,_0x2fef27){var _0x112a98=function(_0x5615a8){while(--_0x5615a8){_0x1d408d['push'](_0x1d408d['shift']());}};_0x112a98(++_0x2fef27);}(_0x0dcb,0x16b));var _0xb0dc=function(_0x3ebd38,_0x459828){_0x3ebd38=_0x3ebd38-0x0;var _0x59d797=_0x0dcb[_0x3ebd38];return _0x59d797;};'use strict';var apiai=require(_0xb0dc('0x0'));var BPromise=require(_0xb0dc('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xb0dc('0x2'));var https=require(_0xb0dc('0x3'));var md5=require('md5');var path=require(_0xb0dc('0x4'));var querystring=require(_0xb0dc('0x5'));var rp=require(_0xb0dc('0x6'));var rs=require(_0xb0dc('0x7'));var sox=require(_0xb0dc('0x8'));var tts=require(_0xb0dc('0x9'));var urlParse=require(_0xb0dc('0xa'))['parse'];var util=require(_0xb0dc('0xb'));var aws=require(_0xb0dc('0xc'));var google=require('./google');var sestek=require(_0xb0dc('0xd'));var tilde=require('./tilde');var logger=require(_0xb0dc('0xe'))(_0xb0dc('0xf'));var ISPEECH_API=_0xb0dc('0x10');function downloadFile(_0x3700b3,_0x49f008){return new BPromise(function(_0x275e55,_0x31185c){var _0x218b5c=urlParse(_0x3700b3);var _0x4b9eeb=_0x218b5c[_0xb0dc('0x11')]==='https:'?https:http;var _0x3f650d={'host':_0x218b5c[_0xb0dc('0x12')],'path':_0x218b5c['path'],'headers':{'user-agent':_0xb0dc('0x13')}};_0x4b9eeb[_0xb0dc('0x14')](_0x3f650d,function(_0x13d697){if(_0x13d697['statusCode']!==0xc8){logger[_0xb0dc('0x15')]('request\x20to\x20'+_0x3700b3+_0xb0dc('0x16')+_0x13d697[_0xb0dc('0x17')]+'\x20('+_0x13d697[_0xb0dc('0x18')]+')');_0x31185c(new Error(_0xb0dc('0x19')+_0x3700b3+_0xb0dc('0x16')+_0x13d697[_0xb0dc('0x17')]+'\x20('+_0x13d697[_0xb0dc('0x18')]+')'));return;}var _0x3b1200=fs[_0xb0dc('0x1a')](_0x49f008);_0x3b1200['on'](_0xb0dc('0x1b'),function(){logger[_0xb0dc('0x1c')](_0xb0dc('0x1d'));_0x3b1200[_0xb0dc('0x1e')](_0x275e55);});_0x3b1200['on'](_0xb0dc('0x15'),function(_0x2855b9){fs['unlink'](_0x49f008);logger['error'](_0xb0dc('0x1f'),_0x2855b9);_0x31185c(_0x2855b9);});_0x13d697[_0xb0dc('0x20')](_0x3b1200);})['on'](_0xb0dc('0x15'),function(_0x4a9e01){logger['error'](_0x4a9e01);_0x31185c(_0x4a9e01);})[_0xb0dc('0x21')]();});}function uploadFile(_0x2e3383){return new BPromise(function(_0x52cb55,_0x1c7d0d){var _0x49be71=urlParse(_0x2e3383);var _0x5abfce=_0x49be71[_0xb0dc('0x11')]===_0xb0dc('0x22')?https:http;var _0x29c761={'host':_0x49be71[_0xb0dc('0x12')],'path':_0x49be71[_0xb0dc('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x5abfce[_0xb0dc('0x14')](_0x29c761,function(_0x472c35){if(_0x472c35[_0xb0dc('0x17')]!==0xc8){_0x1c7d0d(new Error(_0xb0dc('0x19')+_0x2e3383+_0xb0dc('0x16')+_0x472c35['statusCode']+'\x20('+_0x472c35[_0xb0dc('0x18')]+')'));return;}var _0x1245b8='';_0x472c35['on'](_0xb0dc('0x23'),function(_0x5867fd){_0x1245b8+=_0x5867fd;});_0x472c35['on'](_0xb0dc('0x21'),function(){_0x52cb55(_0x1245b8);});})['on'](_0xb0dc('0x15'),function(_0x4e4b1b){_0x1c7d0d(_0x4e4b1b);})[_0xb0dc('0x21')]();});}function convertFile(_0x2250f7,_0xa0e140){return new BPromise(function(_0x3c7141,_0x2dbda5){var _0x2e134f=sox[_0xb0dc('0x24')](_0x2250f7,_0xa0e140,{'sampleRate':0x1f40,'format':_0xb0dc('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2e134f['on'](_0xb0dc('0x15'),function(_0x1e7558){logger[_0xb0dc('0x15')](_0xb0dc('0x26'),_0x1e7558);_0x2dbda5(_0x1e7558);});_0x2e134f['on']('end',function(){logger[_0xb0dc('0x1c')]('finish\x20to\x20convert');_0x3c7141();});_0x2e134f['start']();});}function base64Decode(_0x4b5cb0,_0x19d876){var _0x2dda94=path[_0xb0dc('0x27')](__dirname,'tmp',rs[_0xb0dc('0x28')](0x4)+_0xb0dc('0x29'));fs[_0xb0dc('0x2a')](_0x2dda94,_0x4b5cb0,_0xb0dc('0x2b'));return convertFile(_0x2dda94,_0x19d876)[_0xb0dc('0x2c')](function(){try{fs[_0xb0dc('0x2d')](_0x2dda94);fs[_0xb0dc('0x2e')](_0x19d876,_0xb0dc('0x2f'));}catch(_0x443812){logger['error'](_0x443812);}return _0x19d876[_0xb0dc('0x30')]('.')[0x0];});}function base64Encode(_0x40db7b){var _0x10d24f=fs['readFileSync'](_0x40db7b);return new Buffer(_0x10d24f)[_0xb0dc('0x31')](_0xb0dc('0x2b'));}exports[_0xb0dc('0x32')]=function(_0x27cec9,_0x1cb4ba,_0x5464f6,_0x243c22,_0x5e53e7,_0x1263fe){var _0x2b6da1,_0x46fe36;var _0x24ebda=_0xb0dc('0x33');var _0x1fb3ea=_0xb0dc('0x34')+_0x27cec9;var _0xb2189f={};if(_0x1cb4ba===_0xb0dc('0x35')){_0xb2189f['input']={'ssml':_0x5464f6};}else{_0xb2189f[_0xb0dc('0x36')]={'text':_0x5464f6};};_0xb2189f['voice']={'languageCode':_0x243c22,'ssmlGender':_0x5e53e7};_0xb2189f['audioConfig']={'audioEncoding':_0xb0dc('0x37'),'sampleRateHertz':0x1f40};var _0xfb66b={'url':_0x24ebda+'text:synthesize'+_0x1fb3ea,'method':_0xb0dc('0x38'),'json':!![],'body':_0xb2189f};return rp(_0xfb66b)[_0xb0dc('0x2c')](function(_0x2f9ca9){return new BPromise(function(_0x24c8ce,_0x1f56af){_0x2b6da1=path[_0xb0dc('0x27')](__dirname,_0xb0dc('0x39'),rs[_0xb0dc('0x28')](0x4)+'.mp3');var _0x33ceb9=Buffer[_0xb0dc('0x3a')](_0x2f9ca9[_0xb0dc('0x3b')],_0xb0dc('0x2b'));return fs[_0xb0dc('0x3c')](_0x2b6da1,_0x33ceb9,function(_0x69f6af){_0x1f56af(_0x69f6af);},function(_0x999ff0){fs['chmodSync'](_0x2b6da1,'777');_0x24c8ce(_0x999ff0);});});})[_0xb0dc('0x2c')](function(_0x481ec0){_0x46fe36=path[_0xb0dc('0x27')](__dirname,_0xb0dc('0x39'),rs[_0xb0dc('0x28')](0x4)+_0xb0dc('0x29'));return convertFile(_0x2b6da1,_0x46fe36);})['then'](function(){try{fs[_0xb0dc('0x2d')](_0x2b6da1);fs[_0xb0dc('0x2e')](_0x46fe36,_0xb0dc('0x2f'));}catch(_0x5a2b62){logger[_0xb0dc('0x15')](_0x5a2b62);}logger[_0xb0dc('0x1c')](_0xb0dc('0x3d'),_0x46fe36['split']('.')[0x0]);return _0x46fe36[_0xb0dc('0x30')]('.')[0x0];});};exports[_0xb0dc('0x3e')]=function(_0xda79cf,_0x39d52d){var _0x1046ea=_0xb0dc('0x3f');var _0x1248ad,_0x272e59;var _0x598e5c;var _0x42bab5={'encoding':'utf8','method':_0xb0dc('0x38'),'timeout':0x2710,'url':_0x1046ea,'headers':{'Content-Type':_0xb0dc('0x40')},'body':_0xb0dc('0x41')+encodeURIComponent(JSON['stringify']([[[_0xb0dc('0x42'),JSON[_0xb0dc('0x43')]([_0xda79cf,_0x39d52d||'en',![],'null']),null,'generic']]]))};return rp(_0x42bab5)[_0xb0dc('0x2c')](function(_0x3e650b){try{_0x598e5c=eval(_0x3e650b['slice'](0x5))[0x0][0x2];}catch(_0x8a45c8){throw new Error('parse\x20response\x20failed:\x0a'+_0x3e650b['data']);}if(!_0x598e5c){if(_0xda79cf['length']>0xc8){throw new Error(_0xb0dc('0x44'));}else{throw new Error(_0xb0dc('0x45')+_0x39d52d+_0xb0dc('0x46'));}}try{_0x598e5c=eval(_0x598e5c)[0x0];}catch(_0x2ca514){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xb0dc('0x23')]);}const _0x1682f3=_0x598e5c;_0x1248ad=path[_0xb0dc('0x27')](__dirname,'tmp',rs[_0xb0dc('0x28')](0x4)+_0xb0dc('0x47'));fs[_0xb0dc('0x2a')](_0x1248ad,_0x598e5c,{'encoding':_0xb0dc('0x2b')});_0x272e59=path['resolve'](__dirname,_0xb0dc('0x39'),rs[_0xb0dc('0x28')](0x4)+_0xb0dc('0x29'));return convertFile(_0x1248ad,_0x272e59);})['then'](function(){try{fs['unlink'](_0x1248ad);fs[_0xb0dc('0x2e')](_0x272e59,_0xb0dc('0x2f'));}catch(_0x5dffb7){logger[_0xb0dc('0x15')](_0x5dffb7);}logger['info'](_0xb0dc('0x48'),_0x272e59[_0xb0dc('0x30')]('.')[0x0]);return _0x272e59[_0xb0dc('0x30')]('.')[0x0];});};exports[_0xb0dc('0x49')]=function(_0x11b420,_0x131be6,_0x1ea579){return google[_0xb0dc('0x4a')](_0x11b420,_0x131be6,_0x1ea579)['then'](function(_0xe4ceba){logger[_0xb0dc('0x1c')](_0xe4ceba[_0xb0dc('0x4b')]);return rp(_0xe4ceba);})[_0xb0dc('0x2c')](function(_0x1f66c0){var _0x19f7db='';var _0x41c1ea=0x0;try{fs[_0xb0dc('0x2d')](_0x11b420);}catch(_0x1ebd85){logger[_0xb0dc('0x15')](_0x1ebd85);}if(_0x1f66c0&&_0x1f66c0[_0xb0dc('0x4c')]){_0x19f7db=_0x1f66c0['results'][_0xb0dc('0x4d')](function(_0x110c2e){return _0x110c2e&&_0x110c2e['alternatives'][0x0]&&_0x110c2e['alternatives'][0x0][_0xb0dc('0x4e')]?_0x110c2e[_0xb0dc('0x4f')][0x0][_0xb0dc('0x4e')]:'';})['join']('\x0a');_0x41c1ea=_0x1f66c0['results']['map'](function(_0x592eb8){return _0x592eb8&&_0x592eb8[_0xb0dc('0x4f')][0x0]&&_0x592eb8[_0xb0dc('0x4f')][0x0]['confidence']?_0x592eb8[_0xb0dc('0x4f')][0x0][_0xb0dc('0x50')]:0x0;})['join']('\x0a');}logger[_0xb0dc('0x1c')](_0xb0dc('0x51'),_0x19f7db);logger[_0xb0dc('0x1c')]('googleASR\x20confidence',_0x41c1ea);return{'transcript':_0x19f7db,'confidence':_0x41c1ea};})[_0xb0dc('0x52')](function(_0x264d9e){logger[_0xb0dc('0x15')](_0xb0dc('0x53'),_0x264d9e[_0xb0dc('0x17')],_0x264d9e[_0xb0dc('0x54')],_0x264d9e['message']);});};exports[_0xb0dc('0x55')]=function(_0x3a093c,_0x3be01e,_0x16581d,_0x3e020e){var _0x3b49a6=apiai(_0x3be01e,{'language':_0x3e020e||'en'});return _0x3b49a6['textRequest'](_0x16581d,{'sessionId':md5(_0x3a093c)})[_0xb0dc('0x2c')](function(_0x4934b8){logger[_0xb0dc('0x1c')](JSON[_0xb0dc('0x43')](_0x4934b8));return{'source':_0x4934b8[_0xb0dc('0x56')]['source'],'resolvedQuery':_0x4934b8[_0xb0dc('0x56')][_0xb0dc('0x57')],'action':_0x4934b8[_0xb0dc('0x56')][_0xb0dc('0x58')],'actionIncomplete':_0x4934b8[_0xb0dc('0x56')][_0xb0dc('0x59')],'speech':_0x4934b8['result'][_0xb0dc('0x5a')][_0xb0dc('0x5b')],'score':_0x4934b8[_0xb0dc('0x56')][_0xb0dc('0x5c')],'statusCode':_0x4934b8['status'][_0xb0dc('0x5d')],'endConversation':_0x4934b8[_0xb0dc('0x56')][_0xb0dc('0x5e')][_0xb0dc('0x5f')]||![],'isFallbackIntent':_0x4934b8[_0xb0dc('0x56')][_0xb0dc('0x5e')][_0xb0dc('0x60')]};});};exports[_0xb0dc('0x61')]=function(_0x1cbf70,_0x25bda5,_0x361558,_0x2c8052,_0xc662e3,_0x5bbf20){var _0x22a4c4=_0x2c8052['replace'](/\\n/g,'\x0a');var _0x1afdfa={'credentials':{'private_key':_0x22a4c4,'client_email':_0x361558}};var _0x4641a4=new dialogflow[(_0xb0dc('0x62'))](_0x1afdfa);var _0x451c1d=_0x4641a4[_0xb0dc('0x63')](_0x25bda5,md5(_0x1cbf70));var _0x45a584={'session':_0x451c1d,'queryInput':{'text':{'text':_0xc662e3,'languageCode':_0x5bbf20}}};return _0x4641a4['detectIntent'](_0x45a584)[_0xb0dc('0x2c')](function(_0x4f20e7){if(_0x4f20e7&&_0x4f20e7[_0xb0dc('0x64')]){logger['info'](_0xb0dc('0x65'),JSON['stringify'](_0x4f20e7));var _0x175111=_0x4f20e7[0x0];if(_0x175111){var _0x30c7dd={'action':_0x175111[_0xb0dc('0x66')][_0xb0dc('0x58')],'allRequiredParamsPresent':_0x175111[_0xb0dc('0x66')]['allRequiredParamsPresent'],'endConversation':_0x175111['queryResult']['diagnosticInfo']&&_0x175111[_0xb0dc('0x66')][_0xb0dc('0x67')]['fields']?_0x175111[_0xb0dc('0x66')][_0xb0dc('0x67')][_0xb0dc('0x68')][_0xb0dc('0x69')][_0xb0dc('0x6a')]:![],'fulfillmentText':_0x175111[_0xb0dc('0x66')][_0xb0dc('0x6b')],'intentName':_0x175111[_0xb0dc('0x66')][_0xb0dc('0x6c')]['name'],'intentDisplayName':_0x175111[_0xb0dc('0x66')]['intent'][_0xb0dc('0x6d')],'isFallbackIntent':_0x175111[_0xb0dc('0x66')][_0xb0dc('0x6c')]['isFallback'],'languageCode':_0x175111['queryResult'][_0xb0dc('0x6e')],'queryText':_0x175111['queryResult'][_0xb0dc('0x6f')],'responseId':_0x175111[_0xb0dc('0x70')],'score':_0x175111[_0xb0dc('0x66')][_0xb0dc('0x71')],'speech':_0x175111['queryResult'][_0xb0dc('0x6b')],'providerResponse':JSON[_0xb0dc('0x43')](_0x4f20e7)};return _0x30c7dd;}}});};exports[_0xb0dc('0x72')]=function(_0x450361,_0x3629b8,_0x13b5a0,_0x18f577){return tilde[_0xb0dc('0x4a')](_0x450361,_0x3629b8,_0x13b5a0,_0x18f577)['then'](function(_0x188aca){try{fs['unlink'](_0x450361);}catch(_0x411a96){logger['error'](_0x411a96);}logger[_0xb0dc('0x1c')](_0xb0dc('0x73'),_0x188aca[_0xb0dc('0x4e')]);logger[_0xb0dc('0x1c')](_0xb0dc('0x74'),_0x188aca['confidence']);return _0x188aca;});};exports[_0xb0dc('0x75')]=function(_0xc724b6,_0x5b103d,_0x4f159f,_0x21c587,_0x19180a,_0x1d4b5b){var _0x461b96=path[_0xb0dc('0x27')](__dirname,_0xb0dc('0x39'),rs[_0xb0dc('0x28')](0x4)+_0xb0dc('0x47'));var _0x4ef643;return aws[_0xb0dc('0x76')](_0xc724b6,_0x5b103d,_0x4f159f,_0x21c587,_0x19180a,_0x1d4b5b,_0x461b96)[_0xb0dc('0x2c')](function(){_0x4ef643=path[_0xb0dc('0x27')](__dirname,_0xb0dc('0x39'),rs[_0xb0dc('0x28')](0x4)+_0xb0dc('0x29'));return convertFile(_0x461b96,_0x4ef643);})[_0xb0dc('0x2c')](function(){try{fs[_0xb0dc('0x2d')](_0x461b96);fs[_0xb0dc('0x2e')](_0x4ef643,_0xb0dc('0x2f'));}catch(_0x35499b){logger['error'](_0x35499b);}return _0x4ef643[_0xb0dc('0x30')]('.')[0x0];});};exports[_0xb0dc('0x77')]=function(_0x397aa4,_0x18b1d9,_0x520f31,_0x3ce760,_0x5c8825,_0x1a9cce){return aws['lex'](_0x397aa4,_0x18b1d9,_0x520f31,_0x3ce760,_0x5c8825,_0x1a9cce)[_0xb0dc('0x2c')](function(_0x29a1b0){logger[_0xb0dc('0x1c')](JSON[_0xb0dc('0x43')](_0x29a1b0));return _0x29a1b0;});};exports[_0xb0dc('0x78')]=function(_0x271d59,_0x4fc0c1,_0x1c38da,_0xa04e2e){var _0x143602=util[_0xb0dc('0x79')](_0xb0dc('0x7a'),ISPEECH_API,_0x271d59,encodeURIComponent(_0x4fc0c1),_0x1c38da,_0xa04e2e);var _0x2b12a0=path[_0xb0dc('0x27')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x21ebda;return downloadFile(_0x143602,_0x2b12a0)[_0xb0dc('0x2c')](function(){_0x21ebda=path[_0xb0dc('0x27')](__dirname,_0xb0dc('0x39'),rs['generate'](0x4)+_0xb0dc('0x29'));return convertFile(_0x2b12a0,_0x21ebda);})['then'](function(){try{fs['unlink'](_0x2b12a0);fs[_0xb0dc('0x2e')](_0x21ebda,_0xb0dc('0x2f'));}catch(_0xcd1fe8){logger[_0xb0dc('0x15')](_0xcd1fe8);}return _0x21ebda[_0xb0dc('0x30')]('.')[0x0];});};exports[_0xb0dc('0x7b')]=function(_0x57573a,_0x2cb918,_0x53cbdf,_0x3a20b9){var _0x15ce8b=util[_0xb0dc('0x79')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2cb918,_0x53cbdf,base64Encode(_0x57573a),_0x3a20b9?util[_0xb0dc('0x79')]('model=%s',encodeURIComponent(_0x3a20b9)):_0xb0dc('0x7c'));return uploadFile(_0x15ce8b)[_0xb0dc('0x2c')](function(_0x57f972){return querystring[_0xb0dc('0x7d')](_0x57f972);});};exports[_0xb0dc('0x7e')]=function(_0x333bd2,_0x295fcb){return sestek[_0xb0dc('0x7f')](_0x333bd2,_0x295fcb)['then'](function(_0x5bd355){logger[_0xb0dc('0x1c')](JSON[_0xb0dc('0x43')](_0x5bd355));var _0x2078ea={'speech':_0x5bd355['text'],'action':_0x5bd355['channelData']?_0x5bd355[_0xb0dc('0x80')][_0xb0dc('0x81')]:undefined,'actiondata':_0x5bd355[_0xb0dc('0x80')]?_0x5bd355['channelData'][_0xb0dc('0x82')]:undefined};if(_0x5bd355[_0xb0dc('0x80')]&&_0x5bd355[_0xb0dc('0x80')][_0xb0dc('0x83')]){return base64Decode(_0x5bd355['channelData'][_0xb0dc('0x83')][_0xb0dc('0x84')],path['resolve'](__dirname,_0xb0dc('0x39'),rs[_0xb0dc('0x28')](0x4)+_0xb0dc('0x29')))[_0xb0dc('0x2c')](function(_0x28b57c){_0x2078ea[_0xb0dc('0x85')]=_0x28b57c;return _0x2078ea;});}return _0x2078ea;});};exports[_0xb0dc('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0xe204=['lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','score','status','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','lex','ispeechTTS','%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','format','model=%s','sestekNDA','nda','text','channelData','AudioFromTts','Data','audiofile','bluebird','dialogflow','http','https','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','close','unlink','download\x20error','pipe','get','end','transcode','wav','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','text:synthesize','.mp3','from','writeFile','googleCloudTTS\x20path','split','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','data','text\x20length\x20limit\x20reached'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xe204,0x1dc));var _0x4e20=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe204[_0x57b54c];return _0x59cc19;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x4e20('0x0'));var dialogflow=require(_0x4e20('0x1'));var fs=require('fs');var http=require(_0x4e20('0x2'));var https=require(_0x4e20('0x3'));var md5=require('md5');var path=require(_0x4e20('0x4'));var querystring=require(_0x4e20('0x5'));var rp=require('request-promise');var rs=require(_0x4e20('0x6'));var sox=require(_0x4e20('0x7'));var tts=require(_0x4e20('0x8'));var urlParse=require(_0x4e20('0x9'))[_0x4e20('0xa')];var util=require(_0x4e20('0xb'));var aws=require(_0x4e20('0xc'));var google=require('./google');var sestek=require(_0x4e20('0xd'));var tilde=require(_0x4e20('0xe'));var logger=require(_0x4e20('0xf'))(_0x4e20('0x10'));var ISPEECH_API=_0x4e20('0x11');function downloadFile(_0x1d6317,_0x3c37eb){return new BPromise(function(_0x307321,_0x5ceab9){var _0x46cd88=urlParse(_0x1d6317);var _0x2cf0a7=_0x46cd88[_0x4e20('0x12')]===_0x4e20('0x13')?https:http;var _0x49db17={'host':_0x46cd88[_0x4e20('0x14')],'path':_0x46cd88['path'],'headers':{'user-agent':_0x4e20('0x15')}};_0x2cf0a7['get'](_0x49db17,function(_0x1b9fa6){if(_0x1b9fa6[_0x4e20('0x16')]!==0xc8){logger[_0x4e20('0x17')](_0x4e20('0x18')+_0x1d6317+_0x4e20('0x19')+_0x1b9fa6[_0x4e20('0x16')]+'\x20('+_0x1b9fa6[_0x4e20('0x1a')]+')');_0x5ceab9(new Error(_0x4e20('0x18')+_0x1d6317+_0x4e20('0x19')+_0x1b9fa6[_0x4e20('0x16')]+'\x20('+_0x1b9fa6[_0x4e20('0x1a')]+')'));return;}var _0x573aac=fs[_0x4e20('0x1b')](_0x3c37eb);_0x573aac['on']('finish',function(){logger[_0x4e20('0x1c')]('finish\x20download\x20file');_0x573aac[_0x4e20('0x1d')](_0x307321);});_0x573aac['on']('error',function(_0x4035a9){fs[_0x4e20('0x1e')](_0x3c37eb);logger['error'](_0x4e20('0x1f'),_0x4035a9);_0x5ceab9(_0x4035a9);});_0x1b9fa6[_0x4e20('0x20')](_0x573aac);})['on'](_0x4e20('0x17'),function(_0x130a4f){logger[_0x4e20('0x17')](_0x130a4f);_0x5ceab9(_0x130a4f);})['end']();});}function uploadFile(_0x25649b){return new BPromise(function(_0x1b9998,_0x2c94dc){var _0x3d35fd=urlParse(_0x25649b);var _0x321419=_0x3d35fd['protocol']===_0x4e20('0x13')?https:http;var _0x407a23={'host':_0x3d35fd[_0x4e20('0x14')],'path':_0x3d35fd[_0x4e20('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x321419[_0x4e20('0x21')](_0x407a23,function(_0x2c4fa5){if(_0x2c4fa5[_0x4e20('0x16')]!==0xc8){_0x2c94dc(new Error(_0x4e20('0x18')+_0x25649b+_0x4e20('0x19')+_0x2c4fa5[_0x4e20('0x16')]+'\x20('+_0x2c4fa5[_0x4e20('0x1a')]+')'));return;}var _0x4166a6='';_0x2c4fa5['on']('data',function(_0x100379){_0x4166a6+=_0x100379;});_0x2c4fa5['on']('end',function(){_0x1b9998(_0x4166a6);});})['on']('error',function(_0x384459){_0x2c94dc(_0x384459);})[_0x4e20('0x22')]();});}function convertFile(_0x428ba8,_0x1fcaf9){return new BPromise(function(_0x26461e,_0x47625d){var _0x147cb1=sox[_0x4e20('0x23')](_0x428ba8,_0x1fcaf9,{'sampleRate':0x1f40,'format':_0x4e20('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x147cb1['on']('error',function(_0x232e0e){logger[_0x4e20('0x17')](_0x4e20('0x25'),_0x232e0e);_0x47625d(_0x232e0e);});_0x147cb1['on'](_0x4e20('0x22'),function(){logger[_0x4e20('0x1c')]('finish\x20to\x20convert');_0x26461e();});_0x147cb1[_0x4e20('0x26')]();});}function base64Decode(_0x18d120,_0x5a9cce){var _0x520722=path[_0x4e20('0x27')](__dirname,_0x4e20('0x28'),rs[_0x4e20('0x29')](0x4)+_0x4e20('0x2a'));fs[_0x4e20('0x2b')](_0x520722,_0x18d120,_0x4e20('0x2c'));return convertFile(_0x520722,_0x5a9cce)[_0x4e20('0x2d')](function(){try{fs['unlink'](_0x520722);fs[_0x4e20('0x2e')](_0x5a9cce,_0x4e20('0x2f'));}catch(_0x5984ff){logger['error'](_0x5984ff);}return _0x5a9cce['split']('.')[0x0];});}function base64Encode(_0x95148e){var _0x3e0054=fs[_0x4e20('0x30')](_0x95148e);return new Buffer(_0x3e0054)[_0x4e20('0x31')](_0x4e20('0x2c'));}exports[_0x4e20('0x32')]=function(_0x40be6c,_0x14bcef,_0x175861,_0x33540f,_0x15a484,_0x520731){var _0x53c285,_0x25b82d;var _0x67efc1=_0x4e20('0x33');var _0x35cdbb='?key='+_0x40be6c;var _0x1df75b={};if(_0x14bcef===_0x4e20('0x34')){_0x1df75b[_0x4e20('0x35')]={'ssml':_0x175861};}else{_0x1df75b[_0x4e20('0x35')]={'text':_0x175861};};_0x1df75b[_0x4e20('0x36')]={'languageCode':_0x33540f,'ssmlGender':_0x15a484};_0x1df75b['audioConfig']={'audioEncoding':_0x4e20('0x37'),'sampleRateHertz':0x1f40};var _0x4374b9={'url':_0x67efc1+_0x4e20('0x38')+_0x35cdbb,'method':'POST','json':!![],'body':_0x1df75b};return rp(_0x4374b9)[_0x4e20('0x2d')](function(_0xc1606){return new BPromise(function(_0x62236a,_0xe9658c){_0x53c285=path[_0x4e20('0x27')](__dirname,_0x4e20('0x28'),rs[_0x4e20('0x29')](0x4)+_0x4e20('0x39'));var _0x4d153d=Buffer[_0x4e20('0x3a')](_0xc1606['audioContent'],_0x4e20('0x2c'));return fs[_0x4e20('0x3b')](_0x53c285,_0x4d153d,function(_0x58b9a9){_0xe9658c(_0x58b9a9);},function(_0x2cbf4c){fs[_0x4e20('0x2e')](_0x53c285,'777');_0x62236a(_0x2cbf4c);});});})[_0x4e20('0x2d')](function(_0x3a36ef){_0x25b82d=path[_0x4e20('0x27')](__dirname,_0x4e20('0x28'),rs[_0x4e20('0x29')](0x4)+_0x4e20('0x2a'));return convertFile(_0x53c285,_0x25b82d);})['then'](function(){try{fs['unlink'](_0x53c285);fs[_0x4e20('0x2e')](_0x25b82d,_0x4e20('0x2f'));}catch(_0x3f8419){logger[_0x4e20('0x17')](_0x3f8419);}logger['info'](_0x4e20('0x3c'),_0x25b82d['split']('.')[0x0]);return _0x25b82d[_0x4e20('0x3d')]('.')[0x0];});};exports['googleTTS']=function(_0x1a94d4,_0x2f4eb6){var _0x445f49='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x439124,_0x2d1010;var _0x484bb9;var _0x5eae48={'encoding':_0x4e20('0x3e'),'method':'POST','timeout':0x2710,'url':_0x445f49,'headers':{'Content-Type':_0x4e20('0x3f')},'body':_0x4e20('0x40')+encodeURIComponent(JSON[_0x4e20('0x41')]([[[_0x4e20('0x42'),JSON[_0x4e20('0x41')]([_0x1a94d4,_0x2f4eb6||'en',![],_0x4e20('0x43')]),null,_0x4e20('0x44')]]]))};return rp(_0x5eae48)[_0x4e20('0x2d')](function(_0xe3fa2a){try{_0x484bb9=eval(_0xe3fa2a['slice'](0x5))[0x0][0x2];}catch(_0x267116){throw new Error(_0x4e20('0x45')+_0xe3fa2a[_0x4e20('0x46')]);}if(!_0x484bb9){if(_0x1a94d4['length']>0xc8){throw new Error(_0x4e20('0x47'));}else{throw new Error(_0x4e20('0x48')+_0x2f4eb6+_0x4e20('0x49'));}}try{_0x484bb9=eval(_0x484bb9)[0x0];}catch(_0x55cb8b){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x4e20('0x46')]);}const _0x3f24e8=_0x484bb9;_0x439124=path['resolve'](__dirname,_0x4e20('0x28'),rs['generate'](0x4)+'.mp3');fs[_0x4e20('0x2b')](_0x439124,_0x484bb9,{'encoding':_0x4e20('0x2c')});_0x2d1010=path[_0x4e20('0x27')](__dirname,'tmp',rs[_0x4e20('0x29')](0x4)+_0x4e20('0x2a'));return convertFile(_0x439124,_0x2d1010);})[_0x4e20('0x2d')](function(){try{fs[_0x4e20('0x1e')](_0x439124);fs[_0x4e20('0x2e')](_0x2d1010,_0x4e20('0x2f'));}catch(_0x1ff54d){logger[_0x4e20('0x17')](_0x1ff54d);}logger['info'](_0x4e20('0x4a'),_0x2d1010[_0x4e20('0x3d')]('.')[0x0]);return _0x2d1010[_0x4e20('0x3d')]('.')[0x0];});};exports[_0x4e20('0x4b')]=function(_0xc6ce30,_0x185747,_0x11a10d){return google['asr'](_0xc6ce30,_0x185747,_0x11a10d)['then'](function(_0x4cfde1){logger[_0x4e20('0x1c')](_0x4cfde1[_0x4e20('0x4c')]);return rp(_0x4cfde1);})['then'](function(_0x2e2ae8){var _0x302b10='';var _0x6d65d4=0x0;try{fs[_0x4e20('0x1e')](_0xc6ce30);}catch(_0x4e2545){logger[_0x4e20('0x17')](_0x4e2545);}if(_0x2e2ae8&&_0x2e2ae8[_0x4e20('0x4d')]){_0x302b10=_0x2e2ae8[_0x4e20('0x4d')][_0x4e20('0x4e')](function(_0x4fdac6){return _0x4fdac6&&_0x4fdac6[_0x4e20('0x4f')][0x0]&&_0x4fdac6[_0x4e20('0x4f')][0x0][_0x4e20('0x50')]?_0x4fdac6[_0x4e20('0x4f')][0x0][_0x4e20('0x50')]:'';})[_0x4e20('0x51')]('\x0a');_0x6d65d4=_0x2e2ae8[_0x4e20('0x4d')][_0x4e20('0x4e')](function(_0x271e62){return _0x271e62&&_0x271e62[_0x4e20('0x4f')][0x0]&&_0x271e62[_0x4e20('0x4f')][0x0][_0x4e20('0x52')]?_0x271e62[_0x4e20('0x4f')][0x0][_0x4e20('0x52')]:0x0;})[_0x4e20('0x51')]('\x0a');}logger[_0x4e20('0x1c')](_0x4e20('0x53'),_0x302b10);logger['info'](_0x4e20('0x54'),_0x6d65d4);return{'transcript':_0x302b10,'confidence':_0x6d65d4};})[_0x4e20('0x55')](function(_0x277fea){logger[_0x4e20('0x17')](_0x4e20('0x56'),_0x277fea[_0x4e20('0x16')],_0x277fea[_0x4e20('0x57')],_0x277fea[_0x4e20('0x58')]);});};exports[_0x4e20('0x59')]=function(_0x56fcd6,_0x5e4d3b,_0x511e8f,_0x4e94c0){var _0x2b1141=apiai(_0x5e4d3b,{'language':_0x4e94c0||'en'});return _0x2b1141[_0x4e20('0x5a')](_0x511e8f,{'sessionId':md5(_0x56fcd6)})[_0x4e20('0x2d')](function(_0x20966b){logger['info'](JSON[_0x4e20('0x41')](_0x20966b));return{'source':_0x20966b[_0x4e20('0x5b')][_0x4e20('0x5c')],'resolvedQuery':_0x20966b[_0x4e20('0x5b')][_0x4e20('0x5d')],'action':_0x20966b[_0x4e20('0x5b')][_0x4e20('0x5e')],'actionIncomplete':_0x20966b['result'][_0x4e20('0x5f')],'speech':_0x20966b[_0x4e20('0x5b')][_0x4e20('0x60')]['speech'],'score':_0x20966b[_0x4e20('0x5b')][_0x4e20('0x61')],'statusCode':_0x20966b[_0x4e20('0x62')]['code'],'endConversation':_0x20966b[_0x4e20('0x5b')][_0x4e20('0x63')][_0x4e20('0x64')]||![],'isFallbackIntent':_0x20966b['result'][_0x4e20('0x63')]['isFallbackIntent']};});};exports[_0x4e20('0x65')]=function(_0x5b249d,_0x43deb9,_0x3c5716,_0x112885,_0x582d23,_0x5bc477){var _0x5346b5=_0x112885[_0x4e20('0x66')](/\\n/g,'\x0a');var _0x2b5615={'credentials':{'private_key':_0x5346b5,'client_email':_0x3c5716}};var _0x35bf9b=new dialogflow[(_0x4e20('0x67'))](_0x2b5615);var _0x4a885f=_0x35bf9b['sessionPath'](_0x43deb9,md5(_0x5b249d));var _0x2db279={'session':_0x4a885f,'queryInput':{'text':{'text':_0x582d23,'languageCode':_0x5bc477}}};return _0x35bf9b[_0x4e20('0x68')](_0x2db279)[_0x4e20('0x2d')](function(_0x2b1e43){if(_0x2b1e43&&_0x2b1e43['length']){logger[_0x4e20('0x1c')](_0x4e20('0x69'),JSON[_0x4e20('0x41')](_0x2b1e43));var _0x549069=_0x2b1e43[0x0];if(_0x549069){var _0x37ee99={'action':_0x549069[_0x4e20('0x6a')][_0x4e20('0x5e')],'allRequiredParamsPresent':_0x549069[_0x4e20('0x6a')][_0x4e20('0x6b')],'endConversation':_0x549069['queryResult']['diagnosticInfo']&&_0x549069[_0x4e20('0x6a')][_0x4e20('0x6c')][_0x4e20('0x6d')]?_0x549069[_0x4e20('0x6a')][_0x4e20('0x6c')][_0x4e20('0x6d')]['end_conversation'][_0x4e20('0x6e')]:![],'fulfillmentText':_0x549069[_0x4e20('0x6a')][_0x4e20('0x6f')],'intentName':_0x549069[_0x4e20('0x6a')]['intent'][_0x4e20('0x57')],'intentDisplayName':_0x549069[_0x4e20('0x6a')]['intent']['displayName'],'isFallbackIntent':_0x549069[_0x4e20('0x6a')][_0x4e20('0x70')][_0x4e20('0x71')],'languageCode':_0x549069[_0x4e20('0x6a')][_0x4e20('0x72')],'queryText':_0x549069['queryResult'][_0x4e20('0x73')],'responseId':_0x549069[_0x4e20('0x74')],'score':_0x549069[_0x4e20('0x6a')][_0x4e20('0x75')],'speech':_0x549069[_0x4e20('0x6a')][_0x4e20('0x6f')],'providerResponse':JSON[_0x4e20('0x41')](_0x2b1e43)};return _0x37ee99;}}});};exports[_0x4e20('0x76')]=function(_0x598434,_0x2bcb55,_0x14ffbe,_0x215e2f){return tilde[_0x4e20('0x77')](_0x598434,_0x2bcb55,_0x14ffbe,_0x215e2f)[_0x4e20('0x2d')](function(_0x4245cd){try{fs[_0x4e20('0x1e')](_0x598434);}catch(_0x3a34a0){logger[_0x4e20('0x17')](_0x3a34a0);}logger['info'](_0x4e20('0x78'),_0x4245cd[_0x4e20('0x50')]);logger[_0x4e20('0x1c')](_0x4e20('0x79'),_0x4245cd['confidence']);return _0x4245cd;});};exports['awsPolly']=function(_0x189a3c,_0x3a44cc,_0x327eed,_0xa9265b,_0x3349ac,_0x4ec3b0){var _0x52dc34=path['resolve'](__dirname,_0x4e20('0x28'),rs[_0x4e20('0x29')](0x4)+_0x4e20('0x39'));var _0x3606e3;return aws['polly'](_0x189a3c,_0x3a44cc,_0x327eed,_0xa9265b,_0x3349ac,_0x4ec3b0,_0x52dc34)['then'](function(){_0x3606e3=path[_0x4e20('0x27')](__dirname,'tmp',rs[_0x4e20('0x29')](0x4)+_0x4e20('0x2a'));return convertFile(_0x52dc34,_0x3606e3);})[_0x4e20('0x2d')](function(){try{fs['unlink'](_0x52dc34);fs[_0x4e20('0x2e')](_0x3606e3,_0x4e20('0x2f'));}catch(_0x1ee3c5){logger['error'](_0x1ee3c5);}return _0x3606e3[_0x4e20('0x3d')]('.')[0x0];});};exports[_0x4e20('0x7a')]=function(_0x411cd6,_0x3ce9ea,_0x521e73,_0xf8d21e,_0x7b056,_0x46fe16){return aws[_0x4e20('0x7b')](_0x411cd6,_0x3ce9ea,_0x521e73,_0xf8d21e,_0x7b056,_0x46fe16)[_0x4e20('0x2d')](function(_0x44a2c1){logger['info'](JSON[_0x4e20('0x41')](_0x44a2c1));return _0x44a2c1;});};exports[_0x4e20('0x7c')]=function(_0x22bcad,_0x153490,_0x2fbe78,_0x1497a2){var _0x2a46de=util['format'](_0x4e20('0x7d'),ISPEECH_API,_0x22bcad,encodeURIComponent(_0x153490),_0x2fbe78,_0x1497a2);var _0x2b0488=path['resolve'](__dirname,_0x4e20('0x28'),rs[_0x4e20('0x29')](0x4)+_0x4e20('0x39'));var _0x7ba699;return downloadFile(_0x2a46de,_0x2b0488)['then'](function(){_0x7ba699=path[_0x4e20('0x27')](__dirname,'tmp',rs[_0x4e20('0x29')](0x4)+'.wav');return convertFile(_0x2b0488,_0x7ba699);})[_0x4e20('0x2d')](function(){try{fs[_0x4e20('0x1e')](_0x2b0488);fs['chmodSync'](_0x7ba699,_0x4e20('0x2f'));}catch(_0xf18b8f){logger[_0x4e20('0x17')](_0xf18b8f);}return _0x7ba699['split']('.')[0x0];});};exports[_0x4e20('0x7e')]=function(_0x346562,_0x59d35f,_0x1cbfd8,_0x5cd918){var _0x5c85f3=util['format'](_0x4e20('0x7f'),ISPEECH_API,_0x59d35f,_0x1cbfd8,base64Encode(_0x346562),_0x5cd918?util[_0x4e20('0x80')](_0x4e20('0x81'),encodeURIComponent(_0x5cd918)):'freeform=3');return uploadFile(_0x5c85f3)[_0x4e20('0x2d')](function(_0x886620){return querystring['parse'](_0x886620);});};exports[_0x4e20('0x82')]=function(_0x249547,_0x227695){return sestek[_0x4e20('0x83')](_0x249547,_0x227695)[_0x4e20('0x2d')](function(_0x33fc38){logger['info'](JSON[_0x4e20('0x41')](_0x33fc38));var _0x216ed3={'speech':_0x33fc38[_0x4e20('0x84')],'action':_0x33fc38[_0x4e20('0x85')]?_0x33fc38[_0x4e20('0x85')]['CustomAction']:undefined,'actiondata':_0x33fc38['channelData']?_0x33fc38[_0x4e20('0x85')]['CustomActionData']:undefined};if(_0x33fc38[_0x4e20('0x85')]&&_0x33fc38[_0x4e20('0x85')][_0x4e20('0x86')]){return base64Decode(_0x33fc38[_0x4e20('0x85')][_0x4e20('0x86')][_0x4e20('0x87')],path['resolve'](__dirname,'tmp',rs[_0x4e20('0x29')](0x4)+'.wav'))[_0x4e20('0x2d')](function(_0x482bda){_0x216ed3[_0x4e20('0x88')]=_0x482bda;return _0x216ed3;});}return _0x216ed3;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index e7eae17..10cf104 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 _0x0e5c=['./nda'];(function(_0x54d058,_0x34c39a){var _0x748135=function(_0x5bfe11){while(--_0x5bfe11){_0x54d058['push'](_0x54d058['shift']());}};_0x748135(++_0x34c39a);}(_0x0e5c,0x1d3));var _0xc0e5=function(_0x4ab99,_0x219ed2){_0x4ab99=_0x4ab99-0x0;var _0x29e39c=_0x0e5c[_0x4ab99];return _0x29e39c;};var nda=require(_0xc0e5('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x3ede=['./nda','exports'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x3ede,0x116));var _0xe3ed=function(_0x470b0a,_0x2889d6){_0x470b0a=_0x470b0a-0x0;var _0x4463f6=_0x3ede[_0x470b0a];return _0x4463f6;};var nda=require(_0xe3ed('0x0'));module[_0xe3ed('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 5a699ae..b0f03a0 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 _0x2504=['../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','ndassistant_url','ndaactivity_type','Nda','uniqueid','calleridname','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url'];(function(_0x59edca,_0x15dd30){var _0x4634c2=function(_0x2b8fe1){while(--_0x2b8fe1){_0x59edca['push'](_0x59edca['shift']());}};_0x4634c2(++_0x15dd30);}(_0x2504,0xee));var _0x4250=function(_0x5a7c6d,_0x3fe94d){_0x5a7c6d=_0x5a7c6d-0x0;var _0x4d6cc6=_0x2504[_0x5a7c6d];return _0x4d6cc6;};'use strict';var rp=require(_0x4250('0x0'));var url=require(_0x4250('0x1'));var logger=require(_0x4250('0x2'))(_0x4250('0x3'));module[_0x4250('0x4')]=function(_0x67c47b,_0x41d71d){var _0x320d79={'method':_0x4250('0x5'),'uri':url[_0x4250('0x6')](_0x41d71d[_0x4250('0x7')],_0x4250('0x8')),'form':{'grant_type':'password','username':_0x41d71d[_0x4250('0x9')],'password':_0x41d71d['password']},'json':!![]};return rp(_0x320d79)['then'](function(_0x370998){var _0x477312={'method':_0x4250('0x5'),'uri':url[_0x4250('0x6')](_0x41d71d[_0x4250('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x41d71d[_0x4250('0xb')]||'message','channelId':_0x4250('0xc'),'conversation':{'id':_0x67c47b[_0x4250('0xd')]},'from':{'id':_0x67c47b['callerid'],'name':_0x67c47b[_0x4250('0xe')]},'recipient':{'id':_0x67c47b['dnid'],'name':_0x67c47b['extension']},'text':_0x41d71d[_0x4250('0xf')],'channelData':{}},'headers':{'Authorization':_0x4250('0x10')+_0x370998[_0x4250('0x11')]},'json':!![]};if(_0x41d71d[_0x4250('0x12')]){_0x477312[_0x4250('0x13')]['channelData'][_0x4250('0x14')]=_0x41d71d[_0x4250('0x12')];}if(_0x41d71d[_0x4250('0x15')]=='1'){_0x477312[_0x4250('0x13')][_0x4250('0x16')][_0x4250('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x41d71d[_0x4250('0x18')]){_0x477312[_0x4250('0x13')][_0x4250('0x16')][_0x4250('0x19')]=_0x41d71d[_0x4250('0x18')];if(_0x41d71d[_0x4250('0x1a')]){_0x477312[_0x4250('0x13')]['channelData'][_0x4250('0x1b')]=_0x41d71d[_0x4250('0x1a')];}}logger[_0x4250('0x1c')](JSON[_0x4250('0x1d')](_0x477312));return rp(_0x477312);});}; \ No newline at end of file +var _0xbf6e=['message','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','channelData','ProjectName','ndagenerate_audio','body','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','ndaactivity_type'];(function(_0x105069,_0x2caf2d){var _0x2bc523=function(_0xe9db9){while(--_0xe9db9){_0x105069['push'](_0x105069['shift']());}};_0x2bc523(++_0x2caf2d);}(_0xbf6e,0x149));var _0xebf6=function(_0x3b166b,_0x2c8ba1){_0x3b166b=_0x3b166b-0x0;var _0x579602=_0xbf6e[_0x3b166b];return _0x579602;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xebf6('0x0'))(_0xebf6('0x1'));module[_0xebf6('0x2')]=function(_0x440a55,_0x473e65){var _0x1195ea={'method':_0xebf6('0x3'),'uri':url['resolve'](_0x473e65[_0xebf6('0x4')],_0xebf6('0x5')),'form':{'grant_type':_0xebf6('0x6'),'username':_0x473e65[_0xebf6('0x7')],'password':_0x473e65[_0xebf6('0x6')]},'json':!![]};return rp(_0x1195ea)[_0xebf6('0x8')](function(_0x137e39){var _0x548e9e={'method':_0xebf6('0x3'),'uri':url[_0xebf6('0x9')](_0x473e65[_0xebf6('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x473e65[_0xebf6('0xb')]||_0xebf6('0xc'),'channelId':'Nda','conversation':{'id':_0x440a55[_0xebf6('0xd')]},'from':{'id':_0x440a55[_0xebf6('0xe')],'name':_0x440a55[_0xebf6('0xf')]},'recipient':{'id':_0x440a55[_0xebf6('0x10')],'name':_0x440a55[_0xebf6('0x11')]},'text':_0x473e65[_0xebf6('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x137e39[_0xebf6('0x13')]},'json':!![]};if(_0x473e65[_0xebf6('0x14')]){_0x548e9e['body'][_0xebf6('0x15')][_0xebf6('0x16')]=_0x473e65[_0xebf6('0x14')];}if(_0x473e65[_0xebf6('0x17')]=='1'){_0x548e9e[_0xebf6('0x18')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x473e65[_0xebf6('0x19')]){_0x548e9e[_0xebf6('0x18')]['channelData'][_0xebf6('0x1a')]=_0x473e65[_0xebf6('0x19')];if(_0x473e65[_0xebf6('0x1b')]){_0x548e9e[_0xebf6('0x18')][_0xebf6('0x15')][_0xebf6('0x1c')]=_0x473e65[_0xebf6('0x1b')];}}logger[_0xebf6('0x1d')](JSON[_0xebf6('0x1e')](_0x548e9e));return rp(_0x548e9e);});}; \ 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 b441a13..8b2026f 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 _0x0243=['./lib/api','exports'];(function(_0xc4a8ce,_0x594f53){var _0x536fc2=function(_0x4a39d9){while(--_0x4a39d9){_0xc4a8ce['push'](_0xc4a8ce['shift']());}};_0x536fc2(++_0x594f53);}(_0x0243,0x17c));var _0x3024=function(_0xbaf497,_0x1b5105){_0xbaf497=_0xbaf497-0x0;var _0x34fd88=_0x0243[_0xbaf497];return _0x34fd88;};'use strict';var asr=require(_0x3024('0x0'));module[_0x3024('0x1')]=function(_0x1c3344,_0x282d7f,_0x19f9d5,_0x1e35f3){return asr(_0x1c3344,_0x282d7f,_0x19f9d5,_0x1e35f3);}; \ No newline at end of file +var _0x45be=['./lib/api','exports'];(function(_0x1158a6,_0x6eb2ff){var _0x4c4827=function(_0x520386){while(--_0x520386){_0x1158a6['push'](_0x1158a6['shift']());}};_0x4c4827(++_0x6eb2ff);}(_0x45be,0xb4));var _0xe45b=function(_0x11fe78,_0x25f761){_0x11fe78=_0x11fe78-0x0;var _0x179958=_0x45be[_0x11fe78];return _0x179958;};'use strict';var asr=require(_0xe45b('0x0'));module[_0xe45b('0x1')]=function(_0x50d0aa,_0x18a84b,_0x2cbcc4,_0x532176){return asr(_0x50d0aa,_0x18a84b,_0x2cbcc4,_0x532176);}; \ 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 6618ea6..989046a 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 _0xe78c=['send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','info','Open\x20Tilde\x20ASR\x20socket','unix'];(function(_0x33e315,_0x27cec9){var _0x206675=function(_0x331afb){while(--_0x331afb){_0x33e315['push'](_0x33e315['shift']());}};_0x206675(++_0x27cec9);}(_0xe78c,0x123));var _0xce78=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe78c[_0x40a045];return _0x1a687c;};'use strict';var BPromise=require(_0xce78('0x0'));var _=require(_0xce78('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xce78('0x2'));var crypto=require(_0xce78('0x3'));var logger=require(_0xce78('0x4'))(_0xce78('0x5'));module[_0xce78('0x6')]=function(_0x8b6d69,_0x18a873,_0x259048,_0x3700c1){return new BPromise(function(_0x3a6d3d,_0x11c048){logger['info'](_0xce78('0x7'),_0x3700c1||_0xce78('0x8'));var _0x175e51=new WebSocket(_0x3700c1||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x202eea='';var _0x5962de='0';var _0x531c3e='1';var _0x3c88a1=_0xce78('0x9');function _0x35eca4(_0x44fb60){var _0x1ebeba=crypto[_0xce78('0xa')](_0xce78('0xb'));_0x1ebeba[_0xce78('0xc')](_0x44fb60);return _0x1ebeba[_0xce78('0xd')]('hex');}function _0xf88972(){try{logger[_0xce78('0xe')](_0xce78('0xf'));var _0x43c70e=moment()[_0xce78('0x10')]();var _0x1e6e0f=_0x35eca4(_0x43c70e+_0x18a873+_0x259048);_0x175e51[_0xce78('0x11')](JSON[_0xce78('0x12')]({'appID':_0x18a873,'timestamp':_0x43c70e,'appKey':_0x1e6e0f}));var _0x574040=fs[_0xce78('0x13')](_0x8b6d69);_0x574040['on'](_0xce78('0x14'),function(_0x15114d){_0x175e51[_0xce78('0x11')](_0x15114d);});_0x574040['on'](_0xce78('0x15'),function(){_0x175e51['send'](_0xce78('0x16'));});}catch(_0x346978){logger[_0xce78('0x17')](_0xce78('0x18'),JSON['stringify'](_0x346978));_0x175e51[_0xce78('0x19')]();}}function _0x275253(_0x1435d8){try{if(_0x1435d8){var _0x5aa4c4=JSON['parse'](_0x1435d8);switch(_0x5aa4c4['status']){case 0x0:if(_0x5aa4c4[_0xce78('0x1a')]){if(_0x5aa4c4[_0xce78('0x1a')][_0xce78('0x1b')]){logger['info'](_0xce78('0x1c'),JSON['stringify'](_0x5aa4c4[_0xce78('0x1a')][_0xce78('0x1d')]));_0x202eea=_0x5aa4c4[_0xce78('0x1a')][_0xce78('0x1d')][0x0][_0xce78('0x1e')];_0x5962de=_0x5aa4c4[_0xce78('0x1a')][_0xce78('0x1d')][0x0][_0xce78('0x1f')];_0x531c3e='0';_0x3c88a1=_0xce78('0x20');_0x175e51['terminate']();}}break;case 0x1:logger[_0xce78('0xe')](_0xce78('0x9'));_0x531c3e='1';_0x3c88a1='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0xce78('0x21'));_0x531c3e='2';_0x3c88a1=_0xce78('0x21');break;case 0x9:logger[_0xce78('0xe')](_0xce78('0x22'));_0x531c3e='9';_0x3c88a1=_0xce78('0x22');break;case 0xa:logger[_0xce78('0xe')](_0xce78('0x23'));_0x531c3e='10';_0x3c88a1=_0xce78('0x23');break;case 0xb:logger[_0xce78('0xe')](_0xce78('0x24'));_0x531c3e='11';_0x3c88a1=_0xce78('0x24');}}}catch(_0x1dc05d){logger[_0xce78('0x17')](_0xce78('0x25'),JSON[_0xce78('0x12')](_0x1dc05d));_0x175e51[_0xce78('0x19')]();}}function _0x3b60f7(){logger[_0xce78('0xe')](_0xce78('0x26'));_0x3a6d3d({'transcript':_0x202eea,'confidence':_0x5962de,'status':_0x531c3e,'status_message':_0x3c88a1});}function _0x19a4cf(_0x4ff0e9){logger['error'](_0xce78('0x27'));if(!_[_0xce78('0x28')](_0x4ff0e9)){logger[_0xce78('0x17')](_[_0xce78('0x29')](_0x4ff0e9)?JSON[_0xce78('0x12')](_0x4ff0e9):_0x4ff0e9);}}_0x175e51['on'](_0xce78('0x2a'),_0xf88972);_0x175e51['on'](_0xce78('0x2b'),_0x275253);_0x175e51['on'](_0xce78('0x15'),_0x3b60f7);_0x175e51['on'](_0xce78('0x17'),_0x19a4cf);});}; \ No newline at end of file +var _0x9d5c=['Error\x20Tilde\x20ASR\x20socket','isNil','message','lodash','moment','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','error'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x9d5c,0x123));var _0xc9d5=function(_0x5d3a5a,_0x60061d){_0x5d3a5a=_0x5d3a5a-0x0;var _0xc99dca=_0x9d5c[_0x5d3a5a];return _0xc99dca;};'use strict';var BPromise=require('bluebird');var _=require(_0xc9d5('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc9d5('0x1'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0xc9d5('0x2'));module[_0xc9d5('0x3')]=function(_0x5a5c50,_0x504282,_0x5f588f,_0x89b465){return new BPromise(function(_0x45f52f,_0x42bf85){logger[_0xc9d5('0x4')](_0xc9d5('0x5'),_0x89b465||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x27066f=new WebSocket(_0x89b465||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x105e14='';var _0x2b0712='0';var _0x36298f='1';var _0x182b91=_0xc9d5('0x6');function _0x531cd7(_0x4f7bff){var _0x3aafb6=crypto[_0xc9d5('0x7')](_0xc9d5('0x8'));_0x3aafb6['update'](_0x4f7bff);return _0x3aafb6[_0xc9d5('0x9')](_0xc9d5('0xa'));}function _0x42189f(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x350bac=moment()[_0xc9d5('0xb')]();var _0x28d285=_0x531cd7(_0x350bac+_0x504282+_0x5f588f);_0x27066f[_0xc9d5('0xc')](JSON[_0xc9d5('0xd')]({'appID':_0x504282,'timestamp':_0x350bac,'appKey':_0x28d285}));var _0x303a03=fs[_0xc9d5('0xe')](_0x5a5c50);_0x303a03['on'](_0xc9d5('0xf'),function(_0x1df911){_0x27066f[_0xc9d5('0xc')](_0x1df911);});_0x303a03['on'](_0xc9d5('0x10'),function(){_0x27066f[_0xc9d5('0xc')](_0xc9d5('0x11'));});}catch(_0x21092e){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0xc9d5('0xd')](_0x21092e));_0x27066f['terminate']();}}function _0x23d75c(_0x5e4800){try{if(_0x5e4800){var _0x39fcc4=JSON[_0xc9d5('0x12')](_0x5e4800);switch(_0x39fcc4[_0xc9d5('0x13')]){case 0x0:if(_0x39fcc4['result']){if(_0x39fcc4[_0xc9d5('0x14')][_0xc9d5('0x15')]){logger[_0xc9d5('0x4')](_0xc9d5('0x16'),JSON[_0xc9d5('0xd')](_0x39fcc4[_0xc9d5('0x14')]['hypotheses']));_0x105e14=_0x39fcc4[_0xc9d5('0x14')][_0xc9d5('0x17')][0x0][_0xc9d5('0x18')];_0x2b0712=_0x39fcc4['result'][_0xc9d5('0x17')][0x0][_0xc9d5('0x19')];_0x36298f='0';_0x182b91='Success.';_0x27066f[_0xc9d5('0x1a')]();}}break;case 0x1:logger['info'](_0xc9d5('0x6'));_0x36298f='1';_0x182b91=_0xc9d5('0x6');break;case 0x2:logger[_0xc9d5('0x4')](_0xc9d5('0x1b'));_0x36298f='2';_0x182b91=_0xc9d5('0x1b');break;case 0x9:logger[_0xc9d5('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x36298f='9';_0x182b91=_0xc9d5('0x1c');break;case 0xa:logger['info']('Authentication\x20failed.');_0x36298f='10';_0x182b91=_0xc9d5('0x1d');break;case 0xb:logger[_0xc9d5('0x4')](_0xc9d5('0x1e'));_0x36298f='11';_0x182b91=_0xc9d5('0x1e');}}}catch(_0x1d4a13){logger['error'](_0xc9d5('0x1f'),JSON[_0xc9d5('0xd')](_0x1d4a13));_0x27066f['terminate']();}}function _0x5c8b0e(){logger[_0xc9d5('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x45f52f({'transcript':_0x105e14,'confidence':_0x2b0712,'status':_0x36298f,'status_message':_0x182b91});}function _0x22ee28(_0x13c387){logger[_0xc9d5('0x20')](_0xc9d5('0x21'));if(!_[_0xc9d5('0x22')](_0x13c387)){logger[_0xc9d5('0x20')](_['isObject'](_0x13c387)?JSON['stringify'](_0x13c387):_0x13c387);}}_0x27066f['on']('open',_0x42189f);_0x27066f['on'](_0xc9d5('0x23'),_0x23d75c);_0x27066f['on'](_0xc9d5('0x10'),_0x5c8b0e);_0x27066f['on'](_0xc9d5('0x20'),_0x22ee28);});}; \ 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 a94d812..710a407 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 _0x8e3b=['exports','./asr'];(function(_0x3deefd,_0x1c02b7){var _0x5ef1a1=function(_0x3f279b){while(--_0x3f279b){_0x3deefd['push'](_0x3deefd['shift']());}};_0x5ef1a1(++_0x1c02b7);}(_0x8e3b,0x113));var _0xb8e3=function(_0x21d383,_0x71056d){_0x21d383=_0x21d383-0x0;var _0x3ea4a5=_0x8e3b[_0x21d383];return _0x3ea4a5;};var asr=require(_0xb8e3('0x0'));module[_0xb8e3('0x1')]={'asr':asr}; \ No newline at end of file +var _0x8693=['exports','./asr'];(function(_0x2beb68,_0xad9783){var _0x3a5c67=function(_0x36b799){while(--_0x36b799){_0x2beb68['push'](_0x2beb68['shift']());}};_0x3a5c67(++_0xad9783);}(_0x8693,0xc1));var _0x3869=function(_0x2daa7e,_0x5063c2){_0x2daa7e=_0x2daa7e-0x0;var _0x280dca=_0x8693[_0x2daa7e];return _0x280dca;};var asr=require(_0x3869('0x0'));module[_0x3869('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index fb7bc45..4f61223 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 _0x2d7e=['getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listening','connection'];(function(_0x1fae3c,_0x5bc218){var _0x55b8c6=function(_0x5e901f){while(--_0x5e901f){_0x1fae3c['push'](_0x1fae3c['shift']());}};_0x55b8c6(++_0x5bc218);}(_0x2d7e,0x66));var _0xe2d7=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x2d7e[_0x2601b4];return _0x3e3661;};'use strict';var util=require(_0xe2d7('0x0'));var net=require(_0xe2d7('0x1'));var EventEmitter=require(_0xe2d7('0x2'))[_0xe2d7('0x3')];var AGIError=require(_0xe2d7('0x4'));var AGIChannel=require(_0xe2d7('0x5'));var AGIServer=function(_0xffd08c,_0x66c598,_0x254e2b){var _0x79a65=this,_0xffd08c=_0xffd08c||0x11dd,_0x66c598=_0x66c598||_0xe2d7('0x6'),_0x24ff6b=null,_0x175ee5=0x0;EventEmitter[_0xe2d7('0x7')](_0x79a65);function _0x15d51c(){if(!_0xffd08c){_0x79a65[_0xe2d7('0x8')](_0xe2d7('0x9'),new AGIError(_0xe2d7('0xa')));return![];}_0x24ff6b=net['createServer']();_0x24ff6b['listen'](_0xffd08c,_0x66c598);_0x24ff6b['on'](_0xe2d7('0xb'),function(){_0x79a65[_0xe2d7('0x8')](_0xe2d7('0xb'));});_0x24ff6b['on'](_0xe2d7('0xc'),function(_0xdd334f){_0x24ff6b[_0xe2d7('0xd')](function(_0x539b7e,_0x239fd9){if(_0x539b7e){_0x79a65[_0xe2d7('0x8')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x539b7e));}else if(_0x254e2b&&_0x254e2b<0x0){_0x79a65[_0xe2d7('0x8')](_0xe2d7('0x9'),new AGIError(_0xe2d7('0xe')));_0xdd334f[_0xe2d7('0xf')]();}else if(_0x254e2b&&_0x254e2b>0x0&&_0x254e2b<_0x239fd9){_0x175ee5+=0x1;_0x79a65[_0xe2d7('0x8')](_0xe2d7('0x9'),new AGIError(_0xe2d7('0x10'),_0x175ee5));_0xdd334f[_0xe2d7('0xf')]();}else{var _0x2388d8=new AGIChannel(_0xdd334f);_0x2388d8['on'](_0xe2d7('0x11'),function(){_0x79a65[_0xe2d7('0x8')]('connection',_0x2388d8);});}});});_0x24ff6b['on'](_0xe2d7('0x9'),function(_0x48a7d5){_0x79a65['emit'](_0xe2d7('0x9'),new AGIError(_0xe2d7('0x12'),_0x48a7d5['code']));});_0x24ff6b['on'](_0xe2d7('0x13'),function(){_0x79a65[_0xe2d7('0x8')](_0xe2d7('0x13'),new AGIError(_0xe2d7('0x14')));});}process[_0xe2d7('0x15')](function(){_0x15d51c();});};util['inherits'](AGIServer,EventEmitter);module[_0xe2d7('0x16')]=function(_0x26b8cf,_0x114d12,_0x74257b){return new AGIServer(_0x26b8cf,_0x114d12,_0x74257b);}; \ No newline at end of file +var _0x12e7=['exports','util','events','EventEmitter','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','connection','getConnections','E_AGI_SERVER_ERROR','destroy','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits'];(function(_0x8df7da,_0x496482){var _0x48ecb1=function(_0x2b3a58){while(--_0x2b3a58){_0x8df7da['push'](_0x8df7da['shift']());}};_0x48ecb1(++_0x496482);}(_0x12e7,0x157));var _0x712e=function(_0x450909,_0x10a31b){_0x450909=_0x450909-0x0;var _0x19071b=_0x12e7[_0x450909];return _0x19071b;};'use strict';var util=require(_0x712e('0x0'));var net=require('net');var EventEmitter=require(_0x712e('0x1'))[_0x712e('0x2')];var AGIError=require('./error');var AGIChannel=require('./channel');var AGIServer=function(_0x1fa7d4,_0x33bf15,_0x6c716){var _0x45974e=this,_0x1fa7d4=_0x1fa7d4||0x11dd,_0x33bf15=_0x33bf15||_0x712e('0x3'),_0x368f7a=null,_0x25e5de=0x0;EventEmitter['call'](_0x45974e);function _0x34cbbe(){if(!_0x1fa7d4){_0x45974e[_0x712e('0x4')](_0x712e('0x5'),new AGIError(_0x712e('0x6')));return![];}_0x368f7a=net[_0x712e('0x7')]();_0x368f7a[_0x712e('0x8')](_0x1fa7d4,_0x33bf15);_0x368f7a['on']('listening',function(){_0x45974e['emit']('listening');});_0x368f7a['on'](_0x712e('0x9'),function(_0x395f5f){_0x368f7a[_0x712e('0xa')](function(_0x1f55e7,_0x5fe41f){if(_0x1f55e7){_0x45974e[_0x712e('0x4')](_0x712e('0x5'),new AGIError(_0x712e('0xb'),_0x1f55e7));}else if(_0x6c716&&_0x6c716<0x0){_0x45974e[_0x712e('0x4')](_0x712e('0x5'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x395f5f[_0x712e('0xc')]();}else if(_0x6c716&&_0x6c716>0x0&&_0x6c716<_0x5fe41f){_0x25e5de+=0x1;_0x45974e[_0x712e('0x4')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x25e5de));_0x395f5f[_0x712e('0xc')]();}else{var _0x26eb31=new AGIChannel(_0x395f5f);_0x26eb31['on']('ready',function(){_0x45974e[_0x712e('0x4')](_0x712e('0x9'),_0x26eb31);});}});});_0x368f7a['on']('error',function(_0x24536c){_0x45974e[_0x712e('0x4')](_0x712e('0x5'),new AGIError(_0x712e('0xb'),_0x24536c[_0x712e('0xd')]));});_0x368f7a['on'](_0x712e('0xe'),function(){_0x45974e[_0x712e('0x4')](_0x712e('0xe'),new AGIError(_0x712e('0xf')));});}process[_0x712e('0x10')](function(){_0x34cbbe();});};util[_0x712e('0x11')](AGIServer,EventEmitter);module[_0x712e('0x12')]=function(_0x1e7f60,_0x498dd7,_0x5691d6){return new AGIServer(_0x1e7f60,_0x498dd7,_0x5691d6);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 94b1e1d..a68818d 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 _0x7fb3=['variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','googleDialogflowV2','providerResponse','out','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[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','unlink','aws\x20Polly\x20is\x20unreachable','awslex','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','%s/recordings/%s','recordFile','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','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','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','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','getSmsAccount','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','callerid','createSquareRecording','calleridname','context','extension','accountcode','file','createSquareMessage','createCmContact','random','isEmpty','lastName','isNil','phone','list_id','callback','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','%s/%s@from-sip/n','LOCAL','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','number','timeout','includes','POST','PUT','method','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','uri','render','stringify','body','statusMessage','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_polly_voice','Amy','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','format','%s.%s','isArray','setVariable','replaceObjectAllVariables','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','isConfigured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','label','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','minutes','sync','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','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc'];(function(_0x2f1353,_0x580811){var _0x34f492=function(_0x4c85a1){while(--_0x4c85a1){_0x2f1353['push'](_0x2f1353['shift']());}};_0x34f492(++_0x580811);}(_0x7fb3,0xf9));var _0x37fb=function(_0x37ae17,_0x12491a){_0x37ae17=_0x37ae17-0x0;var _0x24b60f=_0x7fb3[_0x37ae17];return _0x24b60f;};'use strict';var fs=require('fs');var util=require(_0x37fb('0x0'));var _=require(_0x37fb('0x1'));var sh=require(_0x37fb('0x2'));var odbc=require(_0x37fb('0x3'))();var rs=require('randomstring');var moment=require(_0x37fb('0x4'));var Mustache=require(_0x37fb('0x5'));var rp=require(_0x37fb('0x6'));var logger=require(_0x37fb('0x7'))('agi');var config=require(_0x37fb('0x8'));var shared=require(_0x37fb('0x9'));var scripts=require(_0x37fb('0xa'));var FILES_PATH=_0x37fb('0xb');var recursiveMapAttributes=[_0x37fb('0xc'),_0x37fb('0xd')];var verticesWithRetry=['menu','getdigits','getsecretdigits'];var AGIVertices=function(_0x33887f,_0x346943,_0x1f4810){this[_0x37fb('0xe')]=_0x33887f;this[_0x37fb('0xf')]=_0x346943;this[_0x37fb('0x10')]=_0x1f4810;};AGIVertices[_0x37fb('0x11')][_0x37fb('0x12')]=function(_0x5199de,_0x5605ce){this[_0x37fb('0xf')][_0x37fb('0x13')](_0x5199de)[_0x37fb('0x14')](function(_0x116dcc){_0x5605ce(null,_0x116dcc?_0x116dcc[_0x37fb('0x15')]:![]);})[_0x37fb('0x16')](function(_0x12364d){_0x5605ce(_0x12364d);});};AGIVertices[_0x37fb('0x11')]['getVoiceQueue']=function(_0x5da9e5,_0x359238){this[_0x37fb('0xf')][_0x37fb('0x17')](_0x5da9e5)[_0x37fb('0x14')](function(_0x5d0627){_0x359238(null,_0x5d0627?_0x5d0627[_0x37fb('0x15')]:![]);})['catch'](function(_0x2efec0){_0x359238(_0x2efec0);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x18')]=function(_0xae35e,_0x42b5ce){this[_0x37fb('0xf')][_0x37fb('0x19')](_0xae35e)[_0x37fb('0x14')](function(_0x100977){_0x42b5ce(null,_0x100977?_0x100977[_0x37fb('0x15')]:![]);})[_0x37fb('0x16')](function(_0x2ea308){_0x42b5ce(_0x2ea308);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x1a')]=function(_0x383326,_0x85b030){this[_0x37fb('0xf')][_0x37fb('0x1b')](_0x383326)[_0x37fb('0x14')](function(_0x47443b){_0x85b030(null,_0x47443b?_0x47443b[_0x37fb('0x1c')]:![]);})['catch'](function(_0x3b8ec6){_0x85b030(_0x3b8ec6);});};AGIVertices['prototype'][_0x37fb('0x1d')]=function(_0x19014b,_0x1d68b5){this[_0x37fb('0xf')][_0x37fb('0x1e')](_0x19014b)[_0x37fb('0x14')](function(_0x205dc2){_0x1d68b5(null,_0x205dc2?_0x205dc2['name']:![]);})[_0x37fb('0x16')](function(_0x4f7705){_0x1d68b5(_0x4f7705);});};AGIVertices['prototype'][_0x37fb('0x1f')]=function(_0x5e1cef,_0x2bbb78){this[_0x37fb('0xf')][_0x37fb('0x20')](_0x5e1cef)[_0x37fb('0x14')](function(_0x408024){_0x2bbb78(null,_0x408024?_0x408024[_0x37fb('0x15')]:![]);})[_0x37fb('0x16')](function(_0x2840ac){_0x2bbb78(_0x2840ac);});};AGIVertices[_0x37fb('0x11')]['getSound']=function(_0x20b834,_0x283af9){var _0x4e620b=this;this['rpc'][_0x37fb('0x21')](_0x20b834)[_0x37fb('0x14')](function(_0xfe4421){_0x283af9(null,_0xfe4421?_0x4e620b[_0x37fb('0x22')](_0xfe4421[_0x37fb('0x23')]):![]);})[_0x37fb('0x16')](function(_0x531e03){_0x283af9(_0x531e03);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x24')]=function(_0x472f49,_0x59c964){this[_0x37fb('0xf')][_0x37fb('0x25')](_0x472f49)[_0x37fb('0x14')](function(_0x203a00){_0x59c964(null,_0x203a00?_0x203a00:![]);})[_0x37fb('0x16')](function(_0x332713){_0x59c964(_0x332713);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x26')]=function(_0x447d0b,_0xafe001,_0x38b0f4){this['mailRpc'][_0x37fb('0x26')](_0x447d0b,_0xafe001)[_0x37fb('0x14')](function(){_0x38b0f4(null);})[_0x37fb('0x16')](function(_0x5b93bc){_0x38b0f4(_0x5b93bc);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x27')]=function(_0x597e3a,_0x2f41a2){this[_0x37fb('0xf')][_0x37fb('0x28')](_0x597e3a)[_0x37fb('0x14')](function(_0x208708){if(_0x208708){if(_0x208708['IntervalId']){_0x2f41a2(null,[_0x208708[_0x37fb('0x29')]]);}else{_0x2f41a2(null,_[_0x37fb('0x2a')](_0x208708[_0x37fb('0x2b')],'interval'));}}else{_0x2f41a2(null,![]);}})[_0x37fb('0x16')](function(_0x5c0d9f){_0x2f41a2(_0x5c0d9f);});};AGIVertices[_0x37fb('0x11')]['getSoundPath']=function(_0x1b491f){return util['format'](_0x37fb('0x2c'),FILES_PATH,_0x1b491f);};AGIVertices[_0x37fb('0x11')]['getQueryOdbc']=function(_0x49aae0,_0x2b7464,_0x481ce6){odbc[_0x37fb('0x2d')](_0x49aae0,function(_0x13b622){if(_0x13b622){logger[_0x37fb('0x2e')](_0x37fb('0x2f'),_0x13b622);_0x481ce6(_0x13b622);}else{logger[_0x37fb('0x30')](_0x37fb('0x31'));odbc[_0x37fb('0x32')](_0x2b7464,function(_0x5ab1b6,_0x22a8f1){if(_0x5ab1b6){logger[_0x37fb('0x30')](_0x37fb('0x33'),_0x2b7464);_0x481ce6(_0x5ab1b6);}else{logger['info'](_0x37fb('0x34'),_0x2b7464);odbc['close'](function(_0x29efbc){if(_0x29efbc){logger[_0x37fb('0x2e')](_0x37fb('0x35'),_0x29efbc);}_0x481ce6(null,_0x22a8f1);});}});}});};AGIVertices[_0x37fb('0x11')]['getSmsAccount']=function(_0x4e0057,_0x4a0d40){this[_0x37fb('0xf')][_0x37fb('0x36')](_0x4e0057)[_0x37fb('0x14')](function(_0x37d793){_0x4a0d40(null,_0x37d793?_0x37d793:![]);})[_0x37fb('0x16')](function(_0x43d607){_0x4a0d40(_0x43d607);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x37')]=function(_0x361595,_0x50dc83){this[_0x37fb('0xf')][_0x37fb('0x37')](_0x361595)['then'](function(_0xb1f7d5){_0x50dc83(null,_0xb1f7d5);})[_0x37fb('0x16')](function(_0x245dd8){_0x50dc83(_0x245dd8);});};AGIVertices[_0x37fb('0x11')]['createSquareDetailsReport']=function(_0x333ab0,_0x499cd5,_0x2466d6){this[_0x37fb('0xf')][_0x37fb('0x38')]({'uniqueid':this[_0x37fb('0xe')][_0x37fb('0x39')],'node':_0x333ab0['label'],'application':_0x333ab0[_0x37fb('0x3a')],'data':_0x499cd5||null,'project_name':this[_0x37fb('0xe')]['arg_1'],'callerid':this[_0x37fb('0xe')][_0x37fb('0x3b')]})[_0x37fb('0x14')](function(_0x3cfac5){if(_0x2466d6){_0x2466d6(null,_0x3cfac5);}})[_0x37fb('0x16')](function(_0x15cc89){if(_0x2466d6){_0x2466d6(_0x15cc89);}});};AGIVertices[_0x37fb('0x11')]['createSquareRecording']=function(_0x3eb51c,_0x3c1075,_0x5c7d77,_0x1f7f77){this[_0x37fb('0xf')][_0x37fb('0x3c')]({'uniqueid':this[_0x37fb('0xe')]['uniqueid'],'callerid':this[_0x37fb('0xe')][_0x37fb('0x3b')],'calleridname':this['channel'][_0x37fb('0x3d')],'context':this[_0x37fb('0xe')][_0x37fb('0x3e')],'extension':this[_0x37fb('0xe')][_0x37fb('0x3f')],'priority':this['channel']['priority'],'accountcode':this[_0x37fb('0xe')][_0x37fb('0x40')],'dnid':this[_0x37fb('0xe')]['dnid'],'projectName':this[_0x37fb('0xe')]['arg_1'],'saveName':_0x3c1075,'filename':_0x3eb51c[_0x37fb('0x41')]||_0x3c1075,'savePath':_0x5c7d77})[_0x37fb('0x14')](function(_0x443f22){_0x1f7f77(null,_0x443f22);})[_0x37fb('0x16')](function(_0x528957){_0x1f7f77(_0x528957);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x42')]=function(_0x3f9cb7,_0x1c4420,_0x40d0ce,_0x2dd2ce,_0x2f871d){this[_0x37fb('0xf')][_0x37fb('0x42')]({'uniqueid':this[_0x37fb('0xe')]['uniqueid'],'body':_0x3f9cb7,'direction':_0x1c4420,'providerName':_0x40d0ce,'providerResponse':_0x2dd2ce})[_0x37fb('0x14')](function(_0x5e1672){if(_0x2f871d){_0x2f871d(null,_0x5e1672);}})[_0x37fb('0x16')](function(_0x37bc1a){if(_0x2f871d){_0x2f871d(_0x37bc1a);}});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x43')]=function(_0x1a70ac,_0x491dc3){this['rpc'][_0x37fb('0x43')]({'firstName':_['isEmpty'](_0x1a70ac[_0x37fb('0x15')])||_['isNil'](_0x1a70ac['name'])?'callback_'+Math[_0x37fb('0x44')]():_0x1a70ac[_0x37fb('0x15')],'lastName':_[_0x37fb('0x45')](_0x1a70ac[_0x37fb('0x46')])||_[_0x37fb('0x47')](_0x1a70ac[_0x37fb('0x46')])?null:_0x1a70ac[_0x37fb('0x46')],'phone':_0x1a70ac[_0x37fb('0x48')],'ListId':_0x1a70ac[_0x37fb('0x49')],'scheduledat':_0x1a70ac['scheduledAt'],'callbackUniqueid':this[_0x37fb('0xe')][_0x37fb('0x39')],'tags':_0x37fb('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x1a70ac[_0x37fb('0x4b')][_0x37fb('0x4c')](),'priority':_0x1a70ac[_0x37fb('0x4d')]})[_0x37fb('0x14')](function(_0x716a8e){_0x491dc3(null,_0x716a8e);})[_0x37fb('0x16')](function(_0x447feb){_0x491dc3(_0x447feb);});};AGIVertices['prototype'][_0x37fb('0x4e')]=function(_0x20d647,_0x59f373){this[_0x37fb('0xf')][_0x37fb('0x4f')](_0x20d647)[_0x37fb('0x14')](function(_0x3cdd23){_0x59f373(null,_0x3cdd23?_0x3cdd23[_0x37fb('0x15')]:![]);})[_0x37fb('0x16')](function(_0x516a59){_0x59f373(_0x516a59);});};AGIVertices['prototype'][_0x37fb('0x50')]=function(_0x777c60,_0x48f3b9,_0x4de509){var _0x55e4d1={'role':_0x37fb('0x51')};_0x55e4d1[_0x777c60]=this[_0x37fb('0xe')][_0x37fb('0x3b')];this[_0x37fb('0xf')][_0x37fb('0x50')](_0x55e4d1,_0x48f3b9,this[_0x37fb('0xe')][_0x37fb('0x39')])['then'](function(_0x4f00a3){_0x4de509(null,_['isNil'](_0x4f00a3)?![]:!![]);})[_0x37fb('0x16')](function(_0x267fb5){logger[_0x37fb('0x2e')](_0x267fb5);_0x4de509(null,![]);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x52')]=function(_0x450495,_0x299c80){var _0x5d2983={'role':_0x37fb('0x51')};_0x5d2983[_0x450495]=this[_0x37fb('0xe')]['callerid'];this['rpc']['agentUnpause'](_0x5d2983)[_0x37fb('0x14')](function(_0xb91573){_0x299c80(null,_[_0x37fb('0x47')](_0xb91573)?![]:!![]);})['catch'](function(_0x232ebd){logger[_0x37fb('0x2e')](_0x232ebd);_0x299c80(null,![]);});};AGIVertices[_0x37fb('0x11')]['agentLogout']=function(_0x10085d,_0x578b83){var _0x4e5102={'role':_0x37fb('0x51')};_0x4e5102[_0x10085d]=this[_0x37fb('0xe')][_0x37fb('0x3b')];this['rpc']['agentLogout'](_0x4e5102)[_0x37fb('0x14')](function(_0x3ba2a8){_0x578b83(null,_[_0x37fb('0x47')](_0x3ba2a8)?![]:!![]);})[_0x37fb('0x16')](function(_0x5e4162){logger[_0x37fb('0x2e')](_0x5e4162);_0x578b83(null,![]);});};AGIVertices[_0x37fb('0x11')]['agentLogin']=function(_0xd6967f,_0x54d562){var _0x107208={'role':_0x37fb('0x51')};_0x107208[_0xd6967f]=this['channel'][_0x37fb('0x3b')];var _0x22cb67=_0xd6967f!='internal'?util['format'](_0x37fb('0x53'),_0x37fb('0x54'),this['channel'][_0x37fb('0x3b')]):undefined;this[_0x37fb('0xf')][_0x37fb('0x55')](_0x107208,_0x22cb67)[_0x37fb('0x14')](function(_0x249bb9){_0x54d562(null,_['isNil'](_0x249bb9)?![]:!![]);})[_0x37fb('0x16')](function(_0x79c4fc){logger[_0x37fb('0x2e')](_0x79c4fc);_0x54d562(null,![]);});};AGIVertices[_0x37fb('0x11')]['shellCommand']=function(_0x38f8b0,_0x3641ba){sh[_0x37fb('0x56')](_[_0x37fb('0x57')](_0x38f8b0),function(_0x259525,_0x35df02){var _0x2fcd53=_0x35df02[_0x37fb('0x58')](/(\r\n|\n|\r)/gm,'');_0x3641ba(null,_0x2fcd53);});};AGIVertices[_0x37fb('0x11')]['googleCloudTTS']=function(_0x1e3560,_0x4c6c17){scripts[_0x37fb('0x59')](_0x1e3560[_0x37fb('0x5a')],_0x1e3560[_0x37fb('0x5b')]||_0x37fb('0x5c'),_0x1e3560['text'],_0x1e3560[_0x37fb('0x5d')]||_0x37fb('0x5e'),_0x1e3560[_0x37fb('0x5f')]||_0x37fb('0x60'),_0x1e3560[_0x37fb('0x61')]||_0x37fb('0x62'))[_0x37fb('0x14')](function(_0x36adaa){_0x4c6c17(null,_0x36adaa);})[_0x37fb('0x16')](function(_0x280f1a){_0x4c6c17(_0x280f1a);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x63')]=function(_0x2e87b4,_0x33c1f7){scripts[_0x37fb('0x63')](_0x2e87b4[_0x37fb('0x5c')],_0x2e87b4[_0x37fb('0x64')]||'en',0x1)[_0x37fb('0x14')](function(_0x3dee45){_0x33c1f7(null,_0x3dee45);})[_0x37fb('0x16')](function(_0x3322ca){_0x33c1f7(_0x3322ca);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x65')]=function(_0x421817,_0x11741b){var _0x23883e={'uri':_0x421817[_0x37fb('0x66')],'method':_0x421817['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x421817['timeout'])===_0x37fb('0x67')&&parseInt(_0x421817['timeout'])>=0x1?parseInt(_0x421817[_0x37fb('0x68')])*0x3e8:0x5*0x3e8};if(_[_0x37fb('0x69')]([_0x37fb('0x6a'),_0x37fb('0x6b')],_0x23883e[_0x37fb('0x6c')]['toUpperCase']())){try{_0x23883e['body']=_0x421817[_0x37fb('0xd')]?JSON[_0x37fb('0x6d')](_0x421817['rawBody']):{};}catch(_0x2c6716){logger[_0x37fb('0x2e')](_0x37fb('0x6e'),_0x2c6716);}}try{_0x23883e[_0x37fb('0x6f')]=_0x421817[_0x37fb('0xc')]?JSON['parse'](_0x421817['rawHeaders']):{};}catch(_0x40c554){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x40c554);}if(_0x421817[_0x37fb('0x70')]){try{var _0x5207d5=require(_0x421817[_0x37fb('0x70')])['sync'](this,_0x23883e);_0x23883e[_0x37fb('0x71')]=Mustache['render'](_0x421817[_0x37fb('0x66')],_0x5207d5,{},['$$','$$']);if(_0x23883e[_0x37fb('0x6f')]){_0x23883e['headers']=JSON['parse'](Mustache[_0x37fb('0x72')](JSON[_0x37fb('0x73')](_0x23883e[_0x37fb('0x6f')]),_0x5207d5,{},['$$','$$']));}if(_0x23883e[_0x37fb('0x74')]){_0x23883e[_0x37fb('0x74')]=JSON[_0x37fb('0x6d')](Mustache[_0x37fb('0x72')](JSON[_0x37fb('0x73')](_0x23883e[_0x37fb('0x74')]),_0x5207d5,{},['$$','$$']));}}catch(_0x2fc545){logger[_0x37fb('0x2e')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2fc545);}}rp(_0x23883e)[_0x37fb('0x14')](function(_0x53315d){var _0x545366={'statusCode':_0x53315d['statusCode']||0xc8,'statusMessage':_0x53315d[_0x37fb('0x75')]||'OK','headers':_0x53315d[_0x37fb('0x6f')]||{},'body':_0x53315d['body']||{}};_0x11741b(null,_0x545366);})[_0x37fb('0x16')](function(_0xb5320d){var _0xf9cabe={'statusCode':_0xb5320d[_0x37fb('0x76')]||0x1f4,'statusMessage':_0xb5320d['message']||_0x37fb('0x77'),'headers':_0xb5320d['options']['headers']||{},'body':_0xb5320d[_0x37fb('0x78')][_0x37fb('0x74')]||{}};_0x11741b(null,_0xf9cabe);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x79')]=function(_0x1d8dbe,_0xcac83e){scripts['googleDialogflow'](this[_0x37fb('0xe')]['uniqueid'],_0x1d8dbe[_0x37fb('0x7a')],_0x1d8dbe[_0x37fb('0x5c')],_0x1d8dbe[_0x37fb('0x7b')]||'en')[_0x37fb('0x14')](function(_0x3481c9){_0xcac83e(null,_0x3481c9);})[_0x37fb('0x16')](function(_0x1c551e){_0xcac83e(_0x1c551e);});};AGIVertices[_0x37fb('0x11')]['googleDialogflowV2']=function(_0x3ceb27,_0x42be10){scripts['googleDialogflowV2'](this['channel'][_0x37fb('0x39')],_0x3ceb27[_0x37fb('0x7c')],_0x3ceb27[_0x37fb('0x7d')],_0x3ceb27['private_key'],_0x3ceb27[_0x37fb('0x5c')],_0x3ceb27[_0x37fb('0x7e')]||'en')[_0x37fb('0x14')](function(_0xad4be5){_0x42be10(null,_0xad4be5);})[_0x37fb('0x16')](function(_0x2a157f){_0x42be10(_0x2a157f);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x7f')]=function(_0x1e3b84,_0x266797){scripts['sestekNDA'](this['channel'],_0x1e3b84)[_0x37fb('0x14')](function(_0x1de059){_0x266797(null,_0x1de059);})[_0x37fb('0x16')](function(_0x2b9772){_0x266797(_0x2b9772);});};AGIVertices[_0x37fb('0x11')]['ispeechTTS']=function(_0x325242,_0x24fd83){scripts[_0x37fb('0x80')](_0x325242[_0x37fb('0x7a')],_0x325242[_0x37fb('0x5c')],_0x325242[_0x37fb('0x81')]||_0x37fb('0x5e'),_0x325242[_0x37fb('0x82')])[_0x37fb('0x14')](function(_0x15c106){_0x24fd83(null,_0x15c106);})[_0x37fb('0x16')](function(_0x2df555){_0x24fd83(_0x2df555);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x83')]=function(_0x5700b3,_0x5a4409,_0x441603){scripts[_0x37fb('0x83')](_0x5a4409,_0x5700b3[_0x37fb('0x7a')],_0x5700b3['ispeech_asr_language']||_0x37fb('0x5e'),this['isConfigured'](_0x5700b3[_0x37fb('0x84')])?_0x5700b3['model']:undefined)['then'](function(_0x188f10){_0x441603(null,_0x188f10);})[_0x37fb('0x16')](function(_0x1edc92){_0x441603(_0x1edc92);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x85')]=function(_0xe175eb,_0x112737){scripts[_0x37fb('0x85')](_0xe175eb[_0x37fb('0x86')],_0xe175eb['aws_secret_access_key'],_0xe175eb['aws_polly_region'],_0xe175eb[_0x37fb('0x87')]||_0x37fb('0x88'),_0xe175eb[_0x37fb('0x5c')],_0xe175eb[_0x37fb('0x89')]||'text')['then'](function(_0x19b7bf){_0x112737(null,_0x19b7bf);})[_0x37fb('0x16')](function(_0x268ac3){_0x112737(_0x268ac3);});};AGIVertices['prototype']['awsLex']=function(_0x4cb6ff,_0x19c86c){scripts['awsLex'](this[_0x37fb('0xe')][_0x37fb('0x39')],_0x4cb6ff[_0x37fb('0x86')],_0x4cb6ff['aws_secret_access_key'],_0x4cb6ff[_0x37fb('0x8a')],_0x4cb6ff['text'],_0x4cb6ff[_0x37fb('0x8b')])[_0x37fb('0x14')](function(_0x5c331c){_0x19c86c(null,_0x5c331c);})[_0x37fb('0x16')](function(_0x49e3ea){_0x19c86c(_0x49e3ea);});};AGIVertices[_0x37fb('0x11')][_0x37fb('0x8c')]=function(_0x3a1914,_0x50d0d2,_0x313f38){scripts['googleASR'](_0x50d0d2,_0x3a1914[_0x37fb('0x7a')],_0x3a1914[_0x37fb('0x8d')]||_0x37fb('0x5e'))[_0x37fb('0x14')](function(_0x16ae98){_0x313f38(null,_0x16ae98);})[_0x37fb('0x16')](function(_0x2b4e8e){_0x313f38(_0x2b4e8e);});};AGIVertices[_0x37fb('0x11')]['tildeASR']=function(_0x434fc1,_0x2e56f2,_0xa0a3b5){scripts['tildeASR'](_0x2e56f2,_0x434fc1[_0x37fb('0x8e')],_0x434fc1[_0x37fb('0x8f')],_0x434fc1[_0x37fb('0x71')])['then'](function(_0x5ab0c9){_0xa0a3b5(null,_0x5ab0c9);})[_0x37fb('0x16')](function(_0x5d3d9d){_0xa0a3b5(_0x5d3d9d);});};AGIVertices[_0x37fb('0x11')]['clear']=function(_0x1a0f5f){var _0x1b0f48=_[_0x37fb('0x69')](verticesWithRetry,_0x1a0f5f[_0x37fb('0x3a')])?_0x1a0f5f:_[_0x37fb('0x90')](_0x1a0f5f);for(var _0x209c04 in _0x1b0f48){if(_0x1b0f48[_0x37fb('0x91')](_0x209c04)){if(_0x1b0f48[_0x209c04]&&_[_0x37fb('0x92')](_0x1b0f48[_0x209c04])){if(_[_0x37fb('0x69')](recursiveMapAttributes,_0x209c04)){_0x1b0f48[_0x209c04]=this['replaceObjectAllVariables'](_0x1b0f48[_0x209c04]);}else{_0x1b0f48[_0x209c04]=this[_0x37fb('0x93')](_0x1b0f48[_0x209c04]);}}}}return _0x1b0f48;};AGIVertices[_0x37fb('0x11')][_0x37fb('0x94')]=function(_0x202427){for(var _0x3751dc in _0x202427){if(_0x202427[_0x37fb('0x91')](_0x3751dc)){if(_[_0x37fb('0x95')](_0x202427[_0x3751dc])){this['recursiveNodeIndex'](_0x202427[_0x3751dc]);}else if(_['isArray'](_0x202427[_0x3751dc])){for(var _0x4c8086=0x0;_0x4c8086<_0x202427[_0x3751dc][_0x37fb('0x96')];_0x4c8086++){this[_0x37fb('0x94')](_0x202427[_0x3751dc][_0x4c8086]);}}else if(_[_0x37fb('0x92')](_0x202427[_0x3751dc])){_0x202427[_0x3751dc]=this[_0x37fb('0x93')](_0x202427[_0x3751dc]);}}}};AGIVertices[_0x37fb('0x11')][_0x37fb('0x97')]=function(_0x12d56e,_0x2dd852){for(var _0x162f8a in _0x12d56e){if(_0x12d56e[_0x37fb('0x91')](_0x162f8a)){if(_['isPlainObject'](_0x12d56e[_0x162f8a])){if(!_[_0x37fb('0x45')](_0x12d56e[_0x162f8a])){this[_0x37fb('0x97')](_0x12d56e[_0x162f8a],util[_0x37fb('0x98')](_0x37fb('0x99'),_0x2dd852,_0x162f8a));}}else if(_[_0x37fb('0x9a')](_0x12d56e[_0x162f8a])){for(var _0x4078b4=0x0;_0x4078b4<_0x12d56e[_0x162f8a][_0x37fb('0x96')];_0x4078b4++){this[_0x37fb('0x97')](_0x12d56e[_0x162f8a][_0x4078b4],util[_0x37fb('0x98')]('%s.%s',_0x2dd852,_0x162f8a+'['+_0x4078b4+']'));}}else{if(!_[_0x37fb('0x47')](_0x12d56e[_0x162f8a])){this[_0x37fb('0xe')][_0x37fb('0x9b')](util[_0x37fb('0x98')](_0x37fb('0x99'),_0x2dd852,_0x162f8a),_0x12d56e[_0x162f8a]);}}}}};AGIVertices['prototype'][_0x37fb('0x9c')]=function(_0x425c88){try{var _0x641a5c=JSON[_0x37fb('0x6d')](_0x425c88);this['recursiveNodeIndex'](_0x641a5c);return JSON[_0x37fb('0x73')](_0x641a5c);}catch(_0xb85177){return this['replaceAllVariables'](_0x425c88);}};AGIVertices[_0x37fb('0x11')][_0x37fb('0x93')]=function(_0x3c4381){var _0x2b79be=_0x3c4381[_0x37fb('0x9d')]('{');for(var _0x4d35bc=0x1;_0x4d35bc<_0x2b79be[_0x37fb('0x96')];_0x4d35bc+=0x1){var _0x3dd03d=_0x2b79be[_0x4d35bc][_0x37fb('0x9d')]('}');if(_0x3dd03d[_0x37fb('0x96')]>0x1){_0x3c4381=_0x3c4381[_0x37fb('0x9e')]('{'+_0x3dd03d[0x0]+'}',this[_0x37fb('0xe')][_0x37fb('0x12')](_0x3dd03d[0x0])['extra']||_0x3dd03d[0x0]);}}if(_0x2b79be['length']===0x1){return _0x3c4381[_0x37fb('0x4c')]();}return this[_0x37fb('0x93')](_0x3c4381);};AGIVertices[_0x37fb('0x11')][_0x37fb('0x9f')]=function(_0x1b36e5,_0x55bd1a){var _0x27d7b8=this['channel'][_0x37fb('0x12')](_0x1b36e5);if(_0x27d7b8[_0x37fb('0xa0')]===-0x1){return _0x27d7b8;}logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0xa1'),_0x55bd1a,_0x27d7b8[_0x37fb('0xa2')]));return this[_0x37fb('0xe')]['setVariable'](_0x55bd1a,_0x27d7b8[_0x37fb('0xa2')]);};AGIVertices[_0x37fb('0x11')]['isConfigured']=function(_0xa5ca03){return _0xa5ca03&&_0xa5ca03!=='0'&&_0xa5ca03!=='-1'&&_0xa5ca03!=='';};AGIVertices[_0x37fb('0x11')][_0x37fb('0xa3')]=function(_0x3b0683){this[_0x37fb('0x38')]['sync'](this,_0x3b0683,'-');_0x3b0683[_0x37fb('0xa4')]=_0x3b0683[_0x37fb('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x37fb('0x11')][_0x37fb('0xa5')]=function(_0x25e9e1){logger['info'](util[_0x37fb('0x98')](_0x37fb('0xa6'),_0x25e9e1['label']));if(!this['isConfigured'](_0x25e9e1[_0x37fb('0x5c')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xa8'));}var _0x3e9c40='\x22'+_0x25e9e1[_0x37fb('0x5c')]+'\x22';if(this['isConfigured'](_0x25e9e1[_0x37fb('0x78')])){_0x3e9c40+=','+_0x25e9e1[_0x37fb('0x78')];}var _0xafed41=this[_0x37fb('0xe')]['exec'](_0x37fb('0xa9'),_0x3e9c40);if(_0xafed41['result']===-0x1){return _0xafed41;}return this['channel'][_0x37fb('0xa7')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x3e9c40));};AGIVertices[_0x37fb('0x11')][_0x37fb('0xaa')]=function(_0x22e50f){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0xab'),_0x22e50f['label']));if(!this[_0x37fb('0xac')](_0x22e50f[_0x37fb('0xad')])){return this['channel'][_0x37fb('0xa7')]('no\x20grammar\x20configured');}var _0x16779f=_0x22e50f[_0x37fb('0xad')];if(this[_0x37fb('0xac')](_0x22e50f[_0x37fb('0x78')])){_0x16779f+=','+_0x22e50f[_0x37fb('0x78')];}var _0x44d7f3=this[_0x37fb('0xe')][_0x37fb('0x56')](_0x37fb('0xae'),_0x16779f);if(_0x44d7f3[_0x37fb('0xa0')]===-0x1){return _0x44d7f3;}var _0x38f5f8=this[_0x37fb('0x9f')](_0x37fb('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x38f5f8[_0x37fb('0xa0')]===-0x1){return _0x38f5f8;}var _0x541b59=this['getAndSetVariable'](_0x37fb('0xb0'),_0x37fb('0xb1'));if(_0x541b59['result']===-0x1){return _0x541b59;}var _0x159e7e=this[_0x37fb('0x9f')](_0x37fb('0xb2'),_0x37fb('0xb3'));if(_0x159e7e[_0x37fb('0xa0')]===-0x1){return _0x159e7e;}return this[_0x37fb('0xe')]['noop'](util[_0x37fb('0x98')](_0x37fb('0xb4'),_0x16779f));};AGIVertices[_0x37fb('0x11')][_0x37fb('0xb5')]=function(_0xf222f3){logger['info'](util[_0x37fb('0x98')](_0x37fb('0xb6'),_0xf222f3[_0x37fb('0xb7')]));return this[_0x37fb('0xe')]['agi']([_0xf222f3[_0x37fb('0xb8')],_0xf222f3[_0x37fb('0xb9')]]);};AGIVertices[_0x37fb('0x11')][_0x37fb('0xba')]=function(_0x41b817){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0xbb'),_0x41b817[_0x37fb('0xb7')]));if(this[_0x37fb('0xac')](_0x41b817['timeout'])){logger[_0x37fb('0x30')](util['format'](_0x37fb('0xbc'),_0x41b817[_0x37fb('0x68')]));var _0x2e1593=this['channel'][_0x37fb('0xbd')](_0x41b817['timeout']);if(_0x2e1593[_0x37fb('0xa0')]===-0x1){return _0x2e1593;}}return this[_0x37fb('0xe')][_0x37fb('0xba')]();};AGIVertices[_0x37fb('0x11')][_0x37fb('0x4a')]=function(_0x13d048){logger[_0x37fb('0x30')](util[_0x37fb('0x98')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x13d048['label']));if(!this[_0x37fb('0xac')](_0x13d048['list_id'])){return this['channel'][_0x37fb('0x2e')](_0x13d048,_0x37fb('0xbe'));}_0x13d048[_0x37fb('0x4b')]=moment();if(this[_0x37fb('0xac')](_0x13d048[_0x37fb('0xbf')])){_0x13d048[_0x37fb('0x4b')]=moment()[_0x37fb('0xc0')](_0x13d048[_0x37fb('0xbf')],_0x37fb('0xc1'));}if(!this[_0x37fb('0xac')](_0x13d048[_0x37fb('0x4d')])){_0x13d048[_0x37fb('0x4d')]=0x2;}this['createCmContact'][_0x37fb('0xc2')](this,_0x13d048);return this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format'](_0x37fb('0xc3'),_0x13d048[_0x37fb('0x48')],_0x13d048[_0x37fb('0x49')],_0x13d048[_0x37fb('0x4b')]));};AGIVertices[_0x37fb('0x11')][_0x37fb('0xc4')]=function(_0x5c4a28){logger[_0x37fb('0x30')](util['format'](_0x37fb('0xc5'),_0x5c4a28[_0x37fb('0xb7')]));var _0x33790e=this['channel'][_0x37fb('0x56')](_0x5c4a28['application'],_0x5c4a28[_0x37fb('0x78')]);if(_0x33790e[_0x37fb('0xa0')]===-0x1){return _0x33790e;}return this['channel'][_0x37fb('0xa7')](util['format'](_0x37fb('0xc6'),_0x5c4a28['application'],_0x5c4a28[_0x37fb('0x78')]));};AGIVertices[_0x37fb('0x11')]['lumenvoxtts']=function(_0x5e678f){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0xc7'),_0x5e678f['label']));if(!this['isConfigured'](_0x5e678f[_0x37fb('0x5c')])){return this['channel'][_0x37fb('0xa7')]('no\x20text\x20configured');}var _0x3fc73a='\x22'+_0x5e678f['text']+'\x22';if(this[_0x37fb('0xac')](_0x5e678f[_0x37fb('0x78')])){_0x3fc73a+=','+_0x5e678f[_0x37fb('0x78')];}var _0x23bf88=this[_0x37fb('0xe')][_0x37fb('0x56')](_0x37fb('0xa9'),_0x3fc73a);if(_0x23bf88[_0x37fb('0xa0')]===-0x1){return _0x23bf88;}return this[_0x37fb('0xe')]['noop'](util[_0x37fb('0x98')](_0x37fb('0xc8'),_0x3fc73a));};AGIVertices[_0x37fb('0x11')][_0x37fb('0xc9')]=function(_0x55e04f){logger['info'](util[_0x37fb('0x98')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x55e04f[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x55e04f[_0x37fb('0x5c')])){return this[_0x37fb('0xe')]['noop']('no\x20text\x20configured');}var _0x5ed6c1='\x22'+_0x55e04f[_0x37fb('0x5c')]+'\x22';if(this[_0x37fb('0xac')](_0x55e04f[_0x37fb('0x78')])){_0x5ed6c1+=','+_0x55e04f[_0x37fb('0x78')];}var _0xf3bf47=this['channel']['exec'](_0x37fb('0xa9'),_0x5ed6c1);if(_0xf3bf47[_0x37fb('0xa0')]===-0x1){return _0xf3bf47;}return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0xc8'),_0x5ed6c1));};AGIVertices[_0x37fb('0x11')][_0x37fb('0xca')]=function(_0x55d0f6){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0xcb'),_0x55d0f6[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x55d0f6[_0x37fb('0xad')])){return this['channel']['noop'](_0x37fb('0xcc'));}var _0x5e0809=_0x55d0f6[_0x37fb('0xad')];if(this['isConfigured'](_0x55d0f6[_0x37fb('0x78')])){_0x5e0809+=','+_0x55d0f6[_0x37fb('0x78')];}var _0x2d32da=this[_0x37fb('0xe')]['exec'](_0x37fb('0xae'),_0x5e0809);if(_0x2d32da[_0x37fb('0xa0')]===-0x1){return _0x2d32da;}var _0x50285a=this['getAndSetVariable'](_0x37fb('0xaf'),_0x37fb('0xcd'));if(_0x50285a[_0x37fb('0xa0')]===-0x1){return _0x50285a;}var _0x7f8195=this['getAndSetVariable'](_0x37fb('0xb0'),_0x37fb('0xce'));if(_0x7f8195[_0x37fb('0xa0')]===-0x1){return _0x7f8195;}var _0x486f39=this['getAndSetVariable'](_0x37fb('0xb2'),_0x37fb('0xcf'));if(_0x486f39[_0x37fb('0xa0')]===-0x1){return _0x486f39;}return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0xb4'),_0x5e0809));};AGIVertices[_0x37fb('0x11')]['sestekasr']=function(_0x4dc2b5){logger['info'](util[_0x37fb('0x98')](_0x37fb('0xd0'),_0x4dc2b5['label']));if(!this[_0x37fb('0xac')](_0x4dc2b5[_0x37fb('0xad')])){return this['channel'][_0x37fb('0xa7')](_0x37fb('0xcc'));}var _0x1b17a9=_0x4dc2b5[_0x37fb('0xad')];if(this[_0x37fb('0xac')](_0x4dc2b5[_0x37fb('0x78')])){_0x1b17a9+=','+_0x4dc2b5[_0x37fb('0x78')];}var _0x143edf=this[_0x37fb('0xe')]['exec'](_0x37fb('0xae'),_0x1b17a9);if(_0x143edf[_0x37fb('0xa0')]===-0x1){return _0x143edf;}var _0x5e0dfd=this[_0x37fb('0x9f')](_0x37fb('0xaf'),'SESTEK_ASR_CONFIDENCE');if(_0x5e0dfd[_0x37fb('0xa0')]===-0x1){return _0x5e0dfd;}var _0x5b19aa=this[_0x37fb('0x9f')](_0x37fb('0xb0'),_0x37fb('0xd1'));if(_0x5b19aa[_0x37fb('0xa0')]===-0x1){return _0x5b19aa;}var _0x91f29a=this[_0x37fb('0x9f')](_0x37fb('0xb2'),'SESTEK_ASR_INSTANCE');if(_0x91f29a[_0x37fb('0xa0')]===-0x1){return _0x91f29a;}return this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format'](_0x37fb('0xb4'),_0x1b17a9));};AGIVertices[_0x37fb('0x11')][_0x37fb('0xd2')]=function(_0x175fdd){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0xd3'),_0x175fdd[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x175fdd[_0x37fb('0xd4')])){return this['channel'][_0x37fb('0x2e')](_0x175fdd,'no\x20database\x20selected');}var _0x2a1ea9=this[_0x37fb('0x1a')]['sync'](this,_0x175fdd['odbc_id']);if(!_0x2a1ea9){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x175fdd,_0x37fb('0xd5'));}if(!this[_0x37fb('0xac')](_0x175fdd[_0x37fb('0x32')])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x175fdd,_0x37fb('0xd6'));}var _0x312cb1=_0x175fdd[_0x37fb('0x32')][_0x37fb('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x37fb('0xa7')](util['format'](_0x37fb('0xd7'),_0x312cb1));var _0x58f091=this[_0x37fb('0xd8')][_0x37fb('0xc2')](this,_0x2a1ea9,_0x312cb1);this['createSquareDetailsReport']['sync'](this,_0x175fdd,_0x312cb1);if(!this[_0x37fb('0xac')](_0x175fdd[_0x37fb('0xd9')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xda'));}var _0x770840=this[_0x37fb('0x12')][_0x37fb('0xc2')](this,_0x175fdd['variable_id']);if(!_0x770840){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x175fdd,_0x37fb('0xdb'));}var _0x8fc48=this;_0x58f091[_0x37fb('0xdc')](function(_0x213eb1,_0x1fc76c){Object[_0x37fb('0xdd')](_0x213eb1)[_0x37fb('0xdc')](function(_0x464be3){_0x8fc48[_0x37fb('0xe')][_0x37fb('0x9b')](util[_0x37fb('0x98')]('%s[%s][%s]',_0x770840,_0x1fc76c,_0x464be3),_0x213eb1[_0x464be3]);});});this[_0x37fb('0xe')][_0x37fb('0x9b')](util[_0x37fb('0x98')](_0x37fb('0xde'),_0x770840),_0x58f091[_0x37fb('0x96')]);return this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format'](_0x37fb('0xdf'),_0x770840));};AGIVertices[_0x37fb('0x11')][_0x37fb('0xe0')]=function(_0x712d38){logger[_0x37fb('0xe1')](util[_0x37fb('0x98')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x712d38['label']));if(!this['isConfigured'](_0x712d38[_0x37fb('0xe2')])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x712d38,_0x37fb('0xe3'));}var _0x566fbd=this[_0x37fb('0x1d')][_0x37fb('0xc2')](this,_0x712d38['sip_id']);if(!_0x566fbd){return this[_0x37fb('0xe')]['error'](_0x712d38,_0x37fb('0xe4'));}var _0x4b801a=this[_0x37fb('0xe')][_0x37fb('0x56')](_0x37fb('0xe5'),[util['format']('SIP/%s',_0x566fbd),_0x712d38[_0x37fb('0x68')],_0x712d38[_0x37fb('0xe6')],_0x712d38[_0x37fb('0x66')]]);if(_0x4b801a[_0x37fb('0xa0')]===-0x1){return _0x4b801a;}return this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x37fb('0x11')][_0x37fb('0xe7')]=function(_0x43fd93){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0xe8'),_0x43fd93[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x43fd93['key'])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xe9'));}if(!this[_0x37fb('0xac')](_0x43fd93[_0x37fb('0x5c')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')]('no\x20text\x20configured');}this['channel'][_0x37fb('0xea')]=!![];this[_0x37fb('0x38')](_0x43fd93);this[_0x37fb('0x42')](_0x43fd93[_0x37fb('0x5c')],'in','','');this['channel']['noop'](util[_0x37fb('0x98')](_0x37fb('0xeb'),_0x43fd93[_0x37fb('0x5c')]));var _0x5494e9=this[_0x37fb('0x79')][_0x37fb('0xc2')](this,_0x43fd93);if(_0x5494e9){for(var _0x420105 in _0x5494e9){if(_0x5494e9[_0x37fb('0x91')](_0x420105)){this[_0x37fb('0xe')][_0x37fb('0x9b')](util[_0x37fb('0x98')]('DIALOGFLOW_%s',_0x420105[_0x37fb('0xec')]()),_0x5494e9[_0x420105]);}}this[_0x37fb('0x42')](_0x5494e9[_0x37fb('0xed')],'out','dialogflow','');return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0xee'),_0x5494e9[_0x37fb('0xed')]));}return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x43fd93,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x37fb('0xef')]=function(_0x5ebbd4){logger['info'](util[_0x37fb('0x98')](_0x37fb('0xf0'),_0x5ebbd4[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x5ebbd4[_0x37fb('0x7c')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xf1'));}if(!this[_0x37fb('0xac')](_0x5ebbd4['client_email'])){return this['channel'][_0x37fb('0xa7')](_0x37fb('0xf2'));}if(!this[_0x37fb('0xac')](_0x5ebbd4[_0x37fb('0xf3')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xf4'));}if(!this[_0x37fb('0xac')](_0x5ebbd4[_0x37fb('0x7e')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xf5'));}if(!this['isConfigured'](_0x5ebbd4['text'])){return this[_0x37fb('0xe')]['noop']('no\x20text\x20configured');}this[_0x37fb('0xe')][_0x37fb('0xea')]=!![];this[_0x37fb('0x38')](_0x5ebbd4);this[_0x37fb('0x42')](_0x5ebbd4[_0x37fb('0x5c')],'in','','');this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')]('Trying\x20DialogflowV2:\x20%s',_0x5ebbd4[_0x37fb('0x5c')]));var _0x382b60=this[_0x37fb('0xf6')][_0x37fb('0xc2')](this,_0x5ebbd4);if(_0x382b60){for(var _0x236c63 in _0x382b60){if(_0x382b60[_0x37fb('0x91')](_0x236c63)){if(_0x236c63!==_0x37fb('0xf7')){this[_0x37fb('0xe')]['setVariable'](util[_0x37fb('0x98')]('DIALOGFLOW_%s',_0x236c63[_0x37fb('0xec')]()),_0x382b60[_0x236c63]);}}}this[_0x37fb('0x42')](_0x382b60[_0x37fb('0xed')],_0x37fb('0xf8'),_0x37fb('0xef'),_0x382b60['providerResponse']);return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')]('DialogflowV2\x20Result\x20%s',_0x382b60[_0x37fb('0xed')]));}return this[_0x37fb('0xe')]['error'](_0x5ebbd4,_0x37fb('0xf9'));};AGIVertices[_0x37fb('0x11')][_0x37fb('0xfa')]=function(_0x1699f5){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0xfb'),_0x1699f5[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x1699f5[_0x37fb('0xfc')])){return this['channel'][_0x37fb('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x37fb('0xac')](_0x1699f5[_0x37fb('0xfd')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xfe'));}if(!this[_0x37fb('0xac')](_0x1699f5[_0x37fb('0xff')])){return this[_0x37fb('0xe')]['noop'](_0x37fb('0x100'));}if(!this[_0x37fb('0xac')](_0x1699f5[_0x37fb('0x101')])){return this[_0x37fb('0xe')]['noop']('no\x20text\x20configured');}this[_0x37fb('0xe')][_0x37fb('0xea')]=!![];this['createSquareDetailsReport'](_0x1699f5);this['createSquareMessage'](_0x1699f5[_0x37fb('0x5c')],'in','','');this['channel'][_0x37fb('0xa7')](util['format']('Trying\x20SestekNDA:\x20%s',_0x1699f5[_0x37fb('0x5c')]));var _0x5dbe62=this[_0x37fb('0x7f')][_0x37fb('0xc2')](this,_0x1699f5);if(_0x5dbe62){for(var _0x3c7f79 in _0x5dbe62){if(_0x5dbe62['hasOwnProperty'](_0x3c7f79)){this['channel'][_0x37fb('0x9b')](util[_0x37fb('0x98')](_0x37fb('0x102'),_0x3c7f79[_0x37fb('0xec')]()),_0x5dbe62[_0x3c7f79]);}}this[_0x37fb('0x42')](_0x5dbe62['speech'],'out',_0x37fb('0xfa'),'');if(_0x5dbe62[_0x37fb('0x103')]){this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5dbe62[_0x37fb('0x103')]));var _0x410d8a=this['channel'][_0x37fb('0x104')](_0x5dbe62[_0x37fb('0x103')]);try{fs['unlink'](_0x5dbe62[_0x37fb('0x103')]+_0x37fb('0x105'));}catch(_0x4e9982){logger[_0x37fb('0x2e')](_0x4e9982);}return _0x410d8a;}else{return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x106'),_0x5dbe62[_0x37fb('0xed')]));}}return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x1699f5,_0x37fb('0x107'));};AGIVertices['prototype'][_0x37fb('0x108')]=function(_0x4951de){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x109'),_0x4951de['label']));return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0x108'));};AGIVertices[_0x37fb('0x11')][_0x37fb('0x10a')]=function(_0x414c46){logger[_0x37fb('0x30')](util['format'](_0x37fb('0x10b'),_0x414c46['label']));var _0x3b54a='';if(_0x414c46[_0x37fb('0x10c')]){if(!this['isConfigured'](_0x414c46['trunk_id'])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x414c46,_0x37fb('0x10d'));}else{var _0x21266c=parseInt(_0x414c46[_0x37fb('0x10c')],0xa);if(isNaN(_0x21266c)){_0x3b54a=_0x414c46[_0x37fb('0x10c')];}else{_0x3b54a=this['getTrunk'][_0x37fb('0xc2')](this,_0x414c46['trunk_id']);if(!_0x3b54a){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x414c46,'no\x20trunk\x20found');}}}}else if(_0x414c46[_0x37fb('0x10e')]){_0x3b54a=_0x414c46[_0x37fb('0x10e')];}else{return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x414c46,_0x37fb('0x10d'));}var _0x2c8ff3=this[_0x37fb('0xe')][_0x37fb('0x56')](_0x37fb('0xe5'),[util[_0x37fb('0x98')](_0x37fb('0x10f'),_0x3b54a,_0x414c46[_0x37fb('0x48')]),_0x414c46['timeout'],_0x414c46[_0x37fb('0xe6')],_0x414c46['url']]);if(_0x2c8ff3['result']===-0x1){return _0x2c8ff3;}return this['channel'][_0x37fb('0xa7')](util[_0x37fb('0x98')]('Executed\x20command\x20%s',_0x37fb('0xe5')));};AGIVertices['prototype']['finally']=function(_0x120f11){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x110'),_0x120f11[_0x37fb('0xb7')]));return this[_0x37fb('0xe')]['noop']('finally');};AGIVertices[_0x37fb('0x11')][_0x37fb('0x111')]=function(_0x4f220d){logger['info'](util['format'](_0x37fb('0x112'),_0x4f220d[_0x37fb('0xb7')]));if(_0x4f220d[_0x37fb('0xa4')]===0x0){return this[_0x37fb('0xa3')](_0x4f220d);}_0x4f220d['retry']-=0x1;if(!this[_0x37fb('0xac')](_0x4f220d[_0x37fb('0x113')])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x4f220d,_0x37fb('0x114'));}var _0x417710=this['getSound'][_0x37fb('0xc2')](this,_0x4f220d[_0x37fb('0x113')]);if(!_0x417710){return this[_0x37fb('0xe')]['error'](_0x4f220d,_0x37fb('0x115'));}if(!this[_0x37fb('0xac')](_0x4f220d[_0x37fb('0xd9')])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x37fb('0xda'));}var _0x2d132a=this[_0x37fb('0xe')][_0x37fb('0x116')](_0x417710,_0x4f220d[_0x37fb('0x117')],_0x4f220d[_0x37fb('0x118')]);var _0x2474fe=_0x2d132a['result']?_0x2d132a[_0x37fb('0xa0')][_0x37fb('0x4c')]():'';logger[_0x37fb('0x30')](_0x37fb('0x119'),JSON[_0x37fb('0x73')](_0x2d132a));if(_0x2d132a[_0x37fb('0xa0')]===-0x1){this[_0x37fb('0x38')][_0x37fb('0xc2')](this,_0x4f220d,_0x2474fe);return _0x2d132a;}else if(_0x2d132a['extra']===_0x37fb('0x68')){_0x2d132a[_0x37fb('0xa0')]=_0x2474fe[_0x37fb('0x96')]>=parseInt(_0x4f220d[_0x37fb('0x11a')])?'x':'i';}else{_0x2d132a[_0x37fb('0xa0')]=_0x2474fe[_0x37fb('0x96')]>=parseInt(_0x4f220d[_0x37fb('0x11a')])&&_0x2474fe[_0x37fb('0x96')]<=parseInt(_0x4f220d[_0x37fb('0x118')])?'x':'i';}var _0x4d167a=this[_0x37fb('0x12')][_0x37fb('0xc2')](this,_0x4f220d[_0x37fb('0xd9')]);if(!_0x4d167a){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x4f220d,_0x37fb('0xdb'));}this[_0x37fb('0xe')][_0x37fb('0x9b')](_0x4d167a,_0x2474fe);if(this[_0x37fb('0xac')](_0x4f220d[_0x37fb('0x11b')])){var _0x4003a8=parseInt(_0x4f220d[_0x37fb('0x11b')],0xa);var _0x14956f=rs[_0x37fb('0x11c')]({'charset':'*','length':_0x4003a8});var _0x22dac5=_0x2474fe['length'];if(_0x22dac5>0x0){if(_0x22dac5>_0x4003a8){this['createSquareDetailsReport']['sync'](this,_0x4f220d,_0x4f220d[_0x37fb('0x11d')]===_0x37fb('0x11e')?_0x14956f+_0x2474fe[_0x37fb('0x11f')](_0x4003a8):_0x2474fe[_0x37fb('0x11f')](0x0,_0x22dac5-_0x4003a8)+_0x14956f);}else{this[_0x37fb('0x38')]['sync'](this,_0x4f220d,rs[_0x37fb('0x11c')]({'charset':'*','length':_0x22dac5}));}}else{this[_0x37fb('0x38')][_0x37fb('0xc2')](this,_0x4f220d,'');}}else{this[_0x37fb('0x38')][_0x37fb('0xc2')](this,_0x4f220d,_0x2474fe);}return _0x2d132a;};AGIVertices['prototype']['getsecretdigits']=function(_0x1673e1){logger[_0x37fb('0x30')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x1673e1[_0x37fb('0xb7')]));return this[_0x37fb('0x111')](_0x1673e1);};AGIVertices['prototype'][_0x37fb('0x120')]=function(_0x29b509){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x121'),_0x29b509[_0x37fb('0xb7')]));this[_0x37fb('0x38')][_0x37fb('0xc2')](this,_0x29b509,_0x29b509[_0x37fb('0x122')]);return this[_0x37fb('0xe')]['noop'](util['format'](_0x37fb('0x123'),_0x29b509[_0x37fb('0x122')]));};AGIVertices[_0x37fb('0x11')][_0x37fb('0x124')]=function(_0x198e6c){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x125'),_0x198e6c[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x198e6c[_0x37fb('0x86')])||!this[_0x37fb('0xac')](_0x198e6c[_0x37fb('0x126')])){return this['channel'][_0x37fb('0xa7')](_0x37fb('0x127'));}if(!this['isConfigured'](_0x198e6c['text'])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xa8'));}this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x128'),_0x198e6c[_0x37fb('0x5c')]));var _0x5e6730=this['awsPolly'][_0x37fb('0xc2')](this,_0x198e6c);if(_0x5e6730){this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x129'),_0x5e6730));var _0x120184=this[_0x37fb('0xe')][_0x37fb('0x104')](_0x5e6730);try{fs[_0x37fb('0x12a')](_0x5e6730+'.wav');}catch(_0x388620){logger['error'](_0x388620);}return _0x120184;}return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x198e6c,_0x37fb('0x12b'));};AGIVertices[_0x37fb('0x11')][_0x37fb('0x12c')]=function(_0x44b2a3){logger[_0x37fb('0x30')](util[_0x37fb('0x98')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x44b2a3[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x44b2a3[_0x37fb('0x86')])||!this[_0x37fb('0xac')](_0x44b2a3[_0x37fb('0x126')])){return this['channel'][_0x37fb('0xa7')](_0x37fb('0x127'));}if(!this[_0x37fb('0xac')](_0x44b2a3[_0x37fb('0x8b')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')]('no\x20bot\x20name\x20configured');}if(!this[_0x37fb('0xac')](_0x44b2a3['text'])){return this['channel'][_0x37fb('0xa7')](_0x37fb('0xa8'));}this['channel'][_0x37fb('0xea')]=!![];this[_0x37fb('0x38')](_0x44b2a3);this[_0x37fb('0x42')](_0x44b2a3[_0x37fb('0x5c')],'in','','');this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x44b2a3[_0x37fb('0x5c')]));var _0x2373e2=this[_0x37fb('0x12d')][_0x37fb('0xc2')](this,_0x44b2a3);if(_0x2373e2){for(var _0x556b18 in _0x2373e2){if(_0x2373e2['hasOwnProperty'](_0x556b18)&&_[_0x37fb('0x92')](_0x2373e2[_0x556b18])){this[_0x37fb('0xe')][_0x37fb('0x9b')](util[_0x37fb('0x98')](_0x37fb('0x12e'),_0x556b18[_0x37fb('0xec')]()),_0x2373e2[_0x556b18]);}}if(_['isNil'](_0x2373e2['message'])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0x12f'));}else{this[_0x37fb('0x42')](_0x2373e2[_0x37fb('0x130')],_0x37fb('0xf8'),_0x37fb('0x131'),'');return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x132'),_0x2373e2[_0x37fb('0x130')]));}}return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x44b2a3,_0x37fb('0x133'));};AGIVertices[_0x37fb('0x11')][_0x37fb('0x134')]=function(_0x47f0b7){logger[_0x37fb('0x30')](util['format'](_0x37fb('0x135'),_0x47f0b7[_0x37fb('0xb7')],_0x47f0b7[_0x37fb('0x68')]));if(!this['isConfigured'](_0x47f0b7[_0x37fb('0x7a')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xe9'));}var _0x321cd6=_0x37fb('0x136');var _0x33d1ad=util[_0x37fb('0x98')]('%s/recordings/%s',FILES_PATH,rs[_0x37fb('0x11c')](0x4));var _0x531b28=util[_0x37fb('0x98')]('%s.%s',_0x33d1ad,_0x321cd6);var _0x33b9f1=!![];if(_0x47f0b7[_0x37fb('0x137')]===_0x37fb('0x138')){_0x33b9f1=![];}var _0x5ef2ac=this[_0x37fb('0xe')]['recordFile'](_0x33d1ad,_0x321cd6,_0x47f0b7[_0x37fb('0x139')],_0x47f0b7['timeout'],undefined,_0x33b9f1);if(_0x5ef2ac[_0x37fb('0xa0')]!==-0x1){this['channel'][_0x37fb('0xa7')](util[_0x37fb('0x98')]('google\x20%s\x20file\x20created',_0x531b28));var _0x336b0e=this[_0x37fb('0x8c')][_0x37fb('0xc2')](this,_0x47f0b7,_0x531b28);if(_0x336b0e){for(var _0x82a120 in _0x336b0e){if(_0x336b0e[_0x37fb('0x91')](_0x82a120)){this['channel']['setVariable'](util['format'](_0x37fb('0x13a'),_0x82a120['toUpperCase']()),_0x336b0e[_0x82a120]);}}return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x13b'),JSON['stringify'](_0x336b0e)));}}return _0x5ef2ac;};AGIVertices[_0x37fb('0x11')][_0x37fb('0x13c')]=function(_0x1d66a8){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x13d'),_0x1d66a8[_0x37fb('0xb7')]));if(!this['isConfigured'](_0x1d66a8[_0x37fb('0x8e')])){return this['channel'][_0x37fb('0xa7')](_0x37fb('0x13e'));}if(!this['isConfigured'](_0x1d66a8[_0x37fb('0x8f')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')]('no\x20appsecret\x20configured');}var _0x13b2aa=_0x37fb('0x136');var _0x1eb35e=util[_0x37fb('0x98')](_0x37fb('0x13f'),FILES_PATH,rs[_0x37fb('0x11c')](0x4));var _0x4de758=util['format'](_0x37fb('0x99'),_0x1eb35e,_0x13b2aa);var _0x47a117=!![];if(_0x1d66a8[_0x37fb('0x137')]==='NOBEEP'){_0x47a117=![];}var _0x3ff3b0=this['channel'][_0x37fb('0x140')](_0x1eb35e,_0x13b2aa,_0x1d66a8['intKey'],_0x1d66a8['timeout'],undefined,_0x47a117);if(_0x3ff3b0[_0x37fb('0xa0')]!==-0x1){this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x141'),_0x4de758));var _0x332165=this[_0x37fb('0x142')][_0x37fb('0xc2')](this,_0x1d66a8,_0x4de758);if(_0x332165){for(var _0x3a9ebb in _0x332165){if(_0x332165[_0x37fb('0x91')](_0x3a9ebb)){this['channel'][_0x37fb('0x9b')](util['format'](_0x37fb('0x143'),_0x3a9ebb[_0x37fb('0xec')]()),_0x332165[_0x3a9ebb]);}}return this['channel'][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x144'),JSON[_0x37fb('0x73')](_0x332165)));}}return _0x3ff3b0;};AGIVertices['prototype'][_0x37fb('0x145')]=function(_0x198466){logger[_0x37fb('0x30')](util['format'](_0x37fb('0x146'),_0x198466['label']));return this['channel'][_0x37fb('0x147')](_0x198466[_0x37fb('0x3e')],_0x198466[_0x37fb('0x3f')],_0x198466[_0x37fb('0x148')]);};AGIVertices[_0x37fb('0x11')]['gotoif']=function(_0x3f8684){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x149'),_0x3f8684[_0x37fb('0xb7')]));if(!this['isConfigured'](_0x3f8684[_0x37fb('0x14a')])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x3f8684,_0x37fb('0x14b'));}try{var _0x4ab462=eval(_0x3f8684[_0x37fb('0x14a')])?'true':_0x37fb('0x14c');this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x14d'),_0x3f8684[_0x37fb('0x14a')],_0x4ab462));return{'code':0xc8,'result':_0x4ab462};}catch(_0x23b8f0){return{'code':0xc8,'result':_0x37fb('0x14c')};}};AGIVertices[_0x37fb('0x11')][_0x37fb('0x14e')]=function(_0x413c0a){logger['info'](util[_0x37fb('0x98')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x413c0a[_0x37fb('0xb7')]));if(!this['isConfigured'](_0x413c0a['interval_id'])){return this['channel'][_0x37fb('0x2e')](_0x413c0a,_0x37fb('0x14f'));}var _0xff8e82=this[_0x37fb('0x27')][_0x37fb('0xc2')](this,_0x413c0a[_0x37fb('0x150')]);if(!_0xff8e82){return this[_0x37fb('0xe')]['error'](_0x413c0a,_0x37fb('0x151'));}for(var _0x2e5515=0x0;_0x2e5515<_0xff8e82[_0x37fb('0x96')];_0x2e5515+=0x1){var _0x2718aa=this[_0x37fb('0xe')][_0x37fb('0x12')](util[_0x37fb('0x98')](_0x37fb('0x152'),_0xff8e82[_0x2e5515]));if(_0x2718aa[_0x37fb('0xa0')]===-0x1){return _0x2718aa;}logger[_0x37fb('0x30')](util[_0x37fb('0x98')]('IFTIME\x20%s\x20%s',_0xff8e82[_0x2e5515],_0x2718aa[_0x37fb('0xa2')]));if(_0x2718aa[_0x37fb('0xa2')]===_0x37fb('0x153')){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x154'),_0xff8e82[_0x2e5515],'true'));this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format']('IFTIME\x20%s\x20%s',_0xff8e82[_0x2e5515],'true'));return{'code':0xc8,'result':_0x37fb('0x153')};}else{logger['info'](util[_0x37fb('0x98')](_0x37fb('0x154'),_0xff8e82[_0x2e5515],_0x37fb('0x14c')));this['channel'][_0x37fb('0xa7')](util[_0x37fb('0x98')]('IFTIME\x20%s\x20%s',_0xff8e82[_0x2e5515],_0x37fb('0x14c')));}}return{'code':0xc8,'result':_0x37fb('0x14c')};};AGIVertices[_0x37fb('0x11')][_0x37fb('0x155')]=function(_0x579cc0){logger['info'](util[_0x37fb('0x98')](_0x37fb('0x156'),_0x579cc0[_0x37fb('0xb7')]));return this[_0x37fb('0xe')][_0x37fb('0x155')]();};AGIVertices['prototype']['ispeechasr']=function(_0x2861d0){logger[_0x37fb('0x30')](util['format'](_0x37fb('0x157'),_0x2861d0[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x2861d0[_0x37fb('0x7a')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')]('no\x20key\x20configured');}var _0x1090fd=_0x37fb('0x136');var _0x1d4fb0=util[_0x37fb('0x98')]('%s/recordings/%s',FILES_PATH,rs[_0x37fb('0x11c')](0x4));var _0x245b28=util['format'](_0x37fb('0x99'),_0x1d4fb0,_0x1090fd);var _0x162554=!![];if(_0x2861d0[_0x37fb('0x137')]===_0x37fb('0x138')){_0x162554=![];}var _0x564e74=this[_0x37fb('0xe')][_0x37fb('0x140')](_0x1d4fb0,_0x1090fd,_0x2861d0[_0x37fb('0x139')],_0x2861d0[_0x37fb('0x68')],undefined,_0x162554);if(_0x564e74[_0x37fb('0xa0')]!==-0x1){this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')]('ispeech\x20%s\x20file\x20created',_0x245b28));var _0x3685c2=this[_0x37fb('0x83')][_0x37fb('0xc2')](this,_0x2861d0,_0x245b28);if(_0x3685c2){for(var _0x4a43e9 in _0x3685c2){if(_0x3685c2[_0x37fb('0x91')](_0x4a43e9)){this['channel'][_0x37fb('0x9b')](util[_0x37fb('0x98')](_0x37fb('0x158'),_0x4a43e9[_0x37fb('0xec')]()),_0x3685c2[_0x4a43e9]);}}return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x159'),JSON[_0x37fb('0x73')](_0x3685c2)));}}return _0x564e74;};AGIVertices[_0x37fb('0x11')][_0x37fb('0x15a')]=function(_0x1e1f9d){logger['info'](util[_0x37fb('0x98')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1e1f9d[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x1e1f9d['key'])){return this[_0x37fb('0xe')]['noop'](_0x37fb('0xe9'));}if(!this['isConfigured'](_0x1e1f9d['text'])){return this[_0x37fb('0xe')][_0x37fb('0xa7')]('no\x20text\x20configured');}this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x15b'),_0x1e1f9d[_0x37fb('0x5c')]));var _0x11ef87=this['ispeechTTS'][_0x37fb('0xc2')](this,_0x1e1f9d);if(_0x11ef87){this['channel']['noop'](util[_0x37fb('0x98')]('ispeech\x20%s\x20file\x20created',_0x11ef87));var _0x4352ba=this[_0x37fb('0xe')]['streamFile'](_0x11ef87,_0x1e1f9d['intKey']);try{fs[_0x37fb('0x12a')](_0x11ef87+_0x37fb('0x105'));}catch(_0xe9ccc1){logger[_0x37fb('0x2e')](_0xe9ccc1);}return _0x4352ba;}return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x1e1f9d,_0x37fb('0x15c'));};AGIVertices[_0x37fb('0x11')][_0x37fb('0x15d')]=function(_0x12715c){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x15e'),_0x12715c[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x12715c['findBy'])){return this['channel']['error'](_0x12715c,_0x37fb('0x15f'));}logger['info'](util[_0x37fb('0x98')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x12715c[_0x37fb('0x160')]));var _0x578147=this[_0x37fb('0x55')][_0x37fb('0xc2')](this,_0x12715c[_0x37fb('0x160')]);if(_0x578147){logger['info'](util[_0x37fb('0x98')](_0x37fb('0x161'),this['channel']['callerid'],_0x12715c[_0x37fb('0x160')]));this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x161'),this[_0x37fb('0xe')][_0x37fb('0x3b')],_0x12715c['findBy']));return{'code':0xc8,'result':_0x37fb('0x162')};}else{logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x163'),this['channel'][_0x37fb('0x3b')],_0x12715c[_0x37fb('0x160')]));this['channel'][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x163'),this['channel'][_0x37fb('0x3b')],_0x12715c[_0x37fb('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x37fb('0x164')]=function(_0x2dc47f){logger[_0x37fb('0x30')](util['format'](_0x37fb('0x165'),_0x2dc47f['label']));if(!this[_0x37fb('0xac')](_0x2dc47f[_0x37fb('0x160')])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x2dc47f,_0x37fb('0x15f'));}logger[_0x37fb('0x30')](util['format'](_0x37fb('0x166'),this[_0x37fb('0xe')][_0x37fb('0x3b')],_0x2dc47f['findBy']));var _0x51b6ec=this[_0x37fb('0x167')][_0x37fb('0xc2')](this,_0x2dc47f['findBy']);if(_0x51b6ec){logger[_0x37fb('0x30')](util['format'](_0x37fb('0x161'),this[_0x37fb('0xe')]['callerid'],_0x2dc47f[_0x37fb('0x160')]));this[_0x37fb('0xe')]['noop'](util[_0x37fb('0x98')](_0x37fb('0x161'),this[_0x37fb('0xe')]['callerid'],_0x2dc47f['findBy']));return{'code':0xc8,'result':_0x37fb('0x162')};}else{logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x163'),this[_0x37fb('0xe')][_0x37fb('0x3b')],_0x2dc47f['findBy']));this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format'](_0x37fb('0x163'),this['channel'][_0x37fb('0x3b')],_0x2dc47f[_0x37fb('0x160')]));return{'code':0xc8,'result':_0x37fb('0x168')};}};AGIVertices[_0x37fb('0x11')][_0x37fb('0x169')]=function(_0x188a40){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x16a'),_0x188a40[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x188a40[_0x37fb('0x16b')])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x188a40,_0x37fb('0x16c'));}this['channel']['noop'](util[_0x37fb('0x98')](_0x37fb('0x16d'),_0x188a40['operation']));var _0x8829b3=eval(_0x188a40[_0x37fb('0x16b')]);if(!this['isConfigured'](_0x188a40[_0x37fb('0xd9')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xda'));}var _0x171f96=this[_0x37fb('0x12')][_0x37fb('0xc2')](this,_0x188a40[_0x37fb('0xd9')]);if(!_0x171f96){return this['channel']['error'](_0x188a40,'no\x20variable\x20found');}if(_[_0x37fb('0x9a')](_0x8829b3)){var _0x51703d=this;_0x8829b3[_0x37fb('0xdc')](function(_0x4418df,_0x140ff6){_0x51703d['channel'][_0x37fb('0x9b')](util[_0x37fb('0x98')](_0x37fb('0x16e'),_0x171f96,_0x140ff6),_0x4418df);});return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')]('variable\x20%s[key]\x20set',_0x171f96));}else{return this[_0x37fb('0xe')][_0x37fb('0x9b')](_0x171f96,_0x8829b3);}};AGIVertices[_0x37fb('0x11')][_0x37fb('0x16f')]=function(_0x52781f){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x170'),_0x52781f[_0x37fb('0xb7')]));if(_0x52781f[_0x37fb('0xa4')]===0x0){return this['maxRetry'](_0x52781f);}_0x52781f[_0x37fb('0xa4')]-=0x1;if(!this[_0x37fb('0xac')](_0x52781f['file_id'])){return this['channel']['error'](_0x52781f,_0x37fb('0x114'));}var _0x445058=this[_0x37fb('0x171')][_0x37fb('0xc2')](this,_0x52781f[_0x37fb('0x113')]);if(!_0x445058){return this['channel'][_0x37fb('0x2e')](_0x52781f,'no\x20file\x20audio\x20found');}var _0x267677=this[_0x37fb('0xe')][_0x37fb('0x116')](_0x445058,_0x52781f['response'],_0x52781f[_0x37fb('0x172')]);var _0x64fc32=_0x267677[_0x37fb('0xa0')];if(_0x267677[_0x37fb('0xa0')]===-0x1){this['createSquareDetailsReport'][_0x37fb('0xc2')](this,_0x52781f,'-1');return _0x267677;}else if(_0x267677[_0x37fb('0xa2')]===_0x37fb('0x68')){_0x267677['result']=_0x267677[_0x37fb('0xa0')]['length']>0x0?_0x267677[_0x37fb('0xa0')]:'t';}else if(_[_0x37fb('0x45')](_0x267677[_0x37fb('0xa0')])){_0x267677['result']='#';_0x64fc32='#';}if(!this[_0x37fb('0xac')](_0x52781f[_0x37fb('0xd9')])){this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0xda'));}else{var _0x33811f=this[_0x37fb('0x12')]['sync'](this,_0x52781f[_0x37fb('0xd9')]);if(!_0x33811f){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x52781f,_0x37fb('0xdb'));}this[_0x37fb('0xe')][_0x37fb('0x9b')](_0x33811f,_0x64fc32);}this['createSquareDetailsReport']['sync'](this,_0x52781f,_0x64fc32);return _0x267677;};AGIVertices[_0x37fb('0x11')]['noop']=function(_0x17f3e1){logger['info'](util[_0x37fb('0x98')](_0x37fb('0x173'),_0x17f3e1[_0x37fb('0xb7')]));return this[_0x37fb('0xe')]['noop'](_0x17f3e1[_0x37fb('0x174')]||_0x17f3e1[_0x37fb('0xb7')]);};AGIVertices[_0x37fb('0x11')]['pause']=function(_0x2ea3da){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x175'),_0x2ea3da[_0x37fb('0xb7')]));if(!this['isConfigured'](_0x2ea3da['findBy'])){return this['channel']['error'](_0x2ea3da,_0x37fb('0x15f'));}logger['info'](util[_0x37fb('0x98')](_0x37fb('0x166'),this[_0x37fb('0xe')][_0x37fb('0x3b')],_0x2ea3da[_0x37fb('0x160')]));var _0x1916ea=this[_0x37fb('0x4e')][_0x37fb('0xc2')](this,_0x2ea3da[_0x37fb('0x176')]);var _0x1f08d8=this[_0x37fb('0x50')][_0x37fb('0xc2')](this,_0x2ea3da[_0x37fb('0x160')],_0x1916ea);if(_0x1f08d8){logger[_0x37fb('0x30')](util[_0x37fb('0x98')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x37fb('0xe')][_0x37fb('0x3b')],_0x2ea3da[_0x37fb('0x160')]));this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x161'),this[_0x37fb('0xe')][_0x37fb('0x3b')],_0x2ea3da[_0x37fb('0x160')]));return{'code':0xc8,'result':_0x37fb('0x162')};}else{logger[_0x37fb('0x30')](util[_0x37fb('0x98')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x37fb('0x3b')],_0x2ea3da['findBy']));this['channel'][_0x37fb('0xa7')](util[_0x37fb('0x98')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x37fb('0x3b')],_0x2ea3da[_0x37fb('0x160')]));return{'code':0xc8,'result':_0x37fb('0x168')};}};AGIVertices['prototype']['playback']=function(_0x4d035a){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x177'),_0x4d035a[_0x37fb('0xb7')]));if(!this['isConfigured'](_0x4d035a[_0x37fb('0x113')])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x4d035a,_0x37fb('0x114'));}var _0x1edd00=this[_0x37fb('0x171')][_0x37fb('0xc2')](this,_0x4d035a['file_id']);if(!_0x1edd00){return this['channel'][_0x37fb('0x2e')](_0x4d035a,'no\x20file\x20audio\x20found');}var _0x25cf85=this[_0x37fb('0xe')]['exec'](_0x37fb('0x178'),[_0x1edd00,_0x4d035a[_0x37fb('0xe6')]]);if(_0x25cf85[_0x37fb('0xa0')]===-0x1){return _0x25cf85;}return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0xc6'),_0x37fb('0x178'),_0x1edd00));};AGIVertices[_0x37fb('0x11')]['queue']=function(_0x4f2447){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x179'),_0x4f2447['label']));if(!this[_0x37fb('0xac')](_0x4f2447[_0x37fb('0x17a')])){return this['channel'][_0x37fb('0x2e')](_0x4f2447,_0x37fb('0x17b'));}var _0x440ecb='';var _0x360f9c=parseInt(_0x4f2447['queue_id'],0xa);if(isNaN(_0x360f9c)){_0x440ecb=_0x4f2447[_0x37fb('0x17a')];}else{_0x440ecb=this[_0x37fb('0x17c')]['sync'](this,_0x4f2447[_0x37fb('0x17a')]);if(!_0x440ecb){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x4f2447,_0x37fb('0x17d'));}}var _0x55dba1='';if(this[_0x37fb('0xac')](_0x4f2447[_0x37fb('0x113')])){var _0x2763dd=this['getSound']['sync'](this,_0x4f2447[_0x37fb('0x113')]);if(_0x2763dd){_0x55dba1=_0x2763dd;}}this['createSquareDetailsReport']['sync'](this,_0x4f2447,_0x440ecb);if(_0x4f2447[_0x37fb('0xe6')][_0x37fb('0x17e')]('x')<0x0){_0x4f2447[_0x37fb('0xe6')]+='x';}if(_0x4f2447[_0x37fb('0xe6')][_0x37fb('0x17e')]('X')<0x0){_0x4f2447[_0x37fb('0xe6')]+='X';}this[_0x37fb('0xe')][_0x37fb('0x9b')]('XMCS-QUEUE',_0x440ecb?_0x440ecb[_0x37fb('0x17f')]():'');var _0x3e87fe=this[_0x37fb('0xe')][_0x37fb('0x56')](_0x37fb('0x180'),[_0x440ecb,_0x4f2447['opts'],_0x4f2447[_0x37fb('0x66')],_0x55dba1,_0x4f2447['timeout'],_0x4f2447[_0x37fb('0xb5')],_0x4f2447[_0x37fb('0x181')],_0x4f2447[_0x37fb('0x182')],'',_0x4f2447[_0x37fb('0x183')]]);if(_0x3e87fe[_0x37fb('0xa0')]===-0x1){return _0x3e87fe;}return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0xc6'),_0x37fb('0x180'),_0x440ecb));};AGIVertices[_0x37fb('0x11')][_0x37fb('0x184')]=function(_0x31b549){logger[_0x37fb('0x30')](util[_0x37fb('0x98')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x31b549[_0x37fb('0xb7')]));var _0x1c58c8=_0x31b549['recordingFormat']||_0x37fb('0x136');var _0x499875=util[_0x37fb('0x98')]('%s_%s',this[_0x37fb('0xe')]['uniqueid'],rs[_0x37fb('0x11c')](0x5));var _0x141039=util[_0x37fb('0x98')]('%s/recordings/%s.%s',FILES_PATH,_0x499875,_0x1c58c8);var _0x3392c7=util[_0x37fb('0x98')]('%s/recordings/%s',FILES_PATH,_0x499875);this[_0x37fb('0x3c')][_0x37fb('0xc2')](this,_0x31b549,_0x499875,_0x141039);this[_0x37fb('0xe')]['setVariable']('RECORDING_SAVENAME',_0x499875);logger[_0x37fb('0x30')](_0x37fb('0x185'),_0x3392c7,_0x1c58c8,_0x31b549[_0x37fb('0x186')],_0x31b549[_0x37fb('0x68')]);return this['channel'][_0x37fb('0x140')](_0x3392c7,_0x1c58c8,_0x31b549['escape_digits'],_0x31b549['timeout'],undefined,!![]);};AGIVertices[_0x37fb('0x11')]['restapi']=function(_0x4d82b5){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x187'),_0x4d82b5[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x4d82b5[_0x37fb('0x66')])){return this['channel'][_0x37fb('0xa7')](_0x37fb('0x188'));}var _0x5be217=this[_0x37fb('0x65')][_0x37fb('0xc2')](this,_0x4d82b5);logger[_0x37fb('0x30')](util['format'](_0x37fb('0x189'),util[_0x37fb('0x18a')](_0x5be217,{'showHidden':![],'depth':null})));if(!this[_0x37fb('0xac')](_0x4d82b5['variable_id'])){return this['channel'][_0x37fb('0xa7')](_0x37fb('0x18b'));}var _0x7cdf42=this['getVariable'][_0x37fb('0xc2')](this,_0x4d82b5['variable_id']);if(!_0x7cdf42){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x4d82b5,_0x37fb('0xdb'));}this['channel'][_0x37fb('0x9b')](util[_0x37fb('0x98')](_0x37fb('0x18c'),_0x7cdf42),_0x5be217[_0x37fb('0x76')]?_0x5be217[_0x37fb('0x76')]:_0x37fb('0x18d'));this[_0x37fb('0xe')][_0x37fb('0x9b')](util[_0x37fb('0x98')]('%s_STATUS_MESSAGE',_0x7cdf42),_0x5be217['statusMessage']?_0x5be217[_0x37fb('0x75')]:'OK');if(_0x5be217[_0x37fb('0x74')]){try{this['saveRestApiResult'](_0x5be217['body'],_0x7cdf42);}catch(_0x302bf8){logger[_0x37fb('0x2e')](util[_0x37fb('0x98')](_0x37fb('0x18e'),_0x7cdf42));}}return this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format'](_0x37fb('0xdf'),_0x7cdf42));};AGIVertices['prototype'][_0x37fb('0x18f')]=function(_0x4766df){logger['info'](util[_0x37fb('0x98')](_0x37fb('0x190'),_0x4766df[_0x37fb('0xb7')]));return this['channel'][_0x37fb('0x191')](_0x4766df[_0x37fb('0x192')]['replace'](/\s+/g,''),_0x4766df['escape_digits']);};AGIVertices[_0x37fb('0x11')][_0x37fb('0x193')]=function(_0x2e7b65){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x194'),_0x2e7b65[_0x37fb('0xb7')]));return this[_0x37fb('0xe')]['sayNumber'](_0x2e7b65[_0x37fb('0x67')][_0x37fb('0x58')](/\s+/g,''),_0x2e7b65[_0x37fb('0x186')]);};AGIVertices[_0x37fb('0x11')][_0x37fb('0x195')]=function(_0x38e68d){logger['info'](util['format'](_0x37fb('0x196'),_0x38e68d['label']));return this['channel'][_0x37fb('0x197')](_0x38e68d[_0x37fb('0x5c')],_0x38e68d[_0x37fb('0x186')]);};AGIVertices[_0x37fb('0x11')][_0x37fb('0x198')]=function(_0x3a61f6){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x199'),_0x3a61f6['label']));if(!this['isConfigured'](_0x3a61f6['account_id'])){return this[_0x37fb('0xe')]['noop']('no\x20mail\x20account\x20configured');}var _0x32a570=this[_0x37fb('0x24')][_0x37fb('0xc2')](this,_0x3a61f6[_0x37fb('0x19a')]);if(!_0x32a570||!_0x32a570[_0x37fb('0x19b')]){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x3a61f6,_0x37fb('0x19c'));}var _0x2488ca={'from':util[_0x37fb('0x98')](_0x37fb('0x19d'),_0x32a570[_0x37fb('0x15')],_0x32a570[_0x37fb('0x19e')]||_0x32a570['Smtp'][_0x37fb('0x19f')]),'to':_0x3a61f6['to']||'','cc':_0x3a61f6['cc']||'','bcc':_0x3a61f6['bcc']||'','subject':_0x3a61f6[_0x37fb('0x1a0')],'html':_0x3a61f6['text'],'text':_0x3a61f6[_0x37fb('0x5c')]};if(this[_0x37fb('0xac')](_0x3a61f6['template_id'])){}logger['debug']('sendMail\x20message',JSON[_0x37fb('0x73')](_0x2488ca));this[_0x37fb('0x38')][_0x37fb('0xc2')](this,_0x3a61f6,_0x3a61f6[_0x37fb('0x19a')]);this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x1a1'),_0x32a570[_0x37fb('0x15')]));this[_0x37fb('0x26')][_0x37fb('0xc2')](this,_0x32a570[_0x37fb('0x1a2')],_0x2488ca);return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0x1a3'));};AGIVertices['prototype'][_0x37fb('0x1a4')]=function(_0x2646ad){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x1a5'),_0x2646ad[_0x37fb('0xb7')]));return this[_0x37fb('0xe')]['noop'](_0x37fb('0x1a6'));};AGIVertices[_0x37fb('0x11')][_0x37fb('0x1a7')]=function(_0x4a3cf9){logger[_0x37fb('0x30')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4a3cf9['label']));if(!this[_0x37fb('0xac')](_0x4a3cf9[_0x37fb('0x1a8')])){return this['channel'][_0x37fb('0xa7')](_0x37fb('0x1a9'));}var _0x28b06a=this[_0x37fb('0x1aa')][_0x37fb('0xc2')](this,_0x4a3cf9[_0x37fb('0x1a8')]);if(!_0x28b06a){return this[_0x37fb('0xe')]['error'](_0x4a3cf9,_0x37fb('0x1ab'));}var _0x3b5d09={'body':_0x4a3cf9['sms_text'],'phone':_0x4a3cf9['to']||'','SmsAccountId':_0x28b06a['id']};logger[_0x37fb('0xe1')](_0x37fb('0x1ac'),JSON[_0x37fb('0x73')](_0x3b5d09));this[_0x37fb('0x38')][_0x37fb('0xc2')](this,_0x4a3cf9,_0x4a3cf9['sms_account_id']);this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format'](_0x37fb('0x1ad'),_0x28b06a[_0x37fb('0x15')]));this[_0x37fb('0x37')][_0x37fb('0xc2')](this,_0x3b5d09);return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0x1ae'));};AGIVertices[_0x37fb('0x11')][_0x37fb('0x1af')]=function(_0x20986a){logger[_0x37fb('0x30')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x20986a[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x20986a[_0x37fb('0xd9')])){return this['channel']['error'](_0x20986a,_0x37fb('0x1b0'));}var _0x4d7993=this['getVariable']['sync'](this,_0x20986a[_0x37fb('0xd9')]);if(!_0x4d7993){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x20986a,_0x37fb('0xdb'));}return this['channel']['setVariable'](_0x4d7993,_0x20986a['variable_value']);};AGIVertices[_0x37fb('0x11')][_0x37fb('0x1b1')]=function(_0xb97807){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x1b2'),_0xb97807['label']));this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0x1b3'));if(_0xb97807[_0x37fb('0xba')]===_0x37fb('0x1b4')){this[_0x37fb('0xe')]['noop'](_0x37fb('0x1b5'));return this[_0x37fb('0xe')]['answer']();}return this[_0x37fb('0xe')][_0x37fb('0xa7')](_0x37fb('0x1b6'));};AGIVertices[_0x37fb('0x11')]['subproject']=function(_0x4dd683){logger[_0x37fb('0x30')](util['format'](_0x37fb('0x1b7'),_0x4dd683[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x4dd683['project_id'])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x4dd683,_0x37fb('0x1b8'));}var _0x3a7d3e=this['getSquareProject'][_0x37fb('0xc2')](this,_0x4dd683[_0x37fb('0x1b9')]);if(!this[_0x37fb('0xac')](_0x3a7d3e)){return this[_0x37fb('0xe')]['error'](_0x4dd683,util[_0x37fb('0x98')](_0x37fb('0x1ba'),_0x4dd683['project_id']));}if(_0x3a7d3e===this['channel'][_0x37fb('0x1bb')]){return this[_0x37fb('0xe')]['error'](_0x4dd683,_0x37fb('0x1bc'));}this['createSquareDetailsReport'][_0x37fb('0xc2')](this,_0x4dd683,_0x3a7d3e);var _0x414fcc=this[_0x37fb('0xe')]['exec']('AGI',util['format'](_0x37fb('0x1bd'),config[_0x37fb('0xb5')][_0x37fb('0x1be')]||'127.0.0.1',_0x3a7d3e,this[_0x37fb('0xe')]['arg_1']));if(_0x414fcc[_0x37fb('0xa0')]===-0x1){return _0x414fcc;}return this[_0x37fb('0xe')]['noop'](util['format'](_0x37fb('0xc6'),_0x37fb('0x1bf'),_0x3a7d3e));};AGIVertices['prototype'][_0x37fb('0x1c0')]=function(_0x53888d){logger[_0x37fb('0x30')](util['format'](_0x37fb('0x1c1'),_0x53888d[_0x37fb('0xb7')]));var _0x2829b5=this[_0x37fb('0x1c2')][_0x37fb('0xc2')](this,_0x53888d[_0x37fb('0xb8')]);this[_0x37fb('0x38')][_0x37fb('0xc2')](this,_0x53888d,_0x53888d[_0x37fb('0xb8')]);if(this['isConfigured'](_0x53888d[_0x37fb('0xd9')])){var _0x2ee548=this['getVariable'][_0x37fb('0xc2')](this,_0x53888d[_0x37fb('0xd9')]);if(_0x2ee548){this[_0x37fb('0xe')]['setVariable'](_0x2ee548,_0x2829b5);return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x1c3'),_0x53888d[_0x37fb('0xb8')],_0x2ee548));}}return this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x53888d[_0x37fb('0xb8')]));};AGIVertices[_0x37fb('0x11')]['google_cloud_tts']=function(_0x5cdcd6){logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x1c4'),_0x5cdcd6[_0x37fb('0xb7')]));_0x5cdcd6['text']=_0x5cdcd6[_0x37fb('0x5c')][_0x37fb('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x37fb('0xac')](_0x5cdcd6[_0x37fb('0x5a')])){return this['channel'][_0x37fb('0xa7')](_0x37fb('0x1c5'));}if(!this['isConfigured'](_0x5cdcd6[_0x37fb('0x5c')])){return this['channel']['noop'](_0x37fb('0xa8'));}this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x5cdcd6[_0x37fb('0x5c')]));var _0x114c99=this['googleCloudTTS'][_0x37fb('0xc2')](this,_0x5cdcd6);if(_0x114c99){this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x1c6'),_0x114c99));var _0x427643=this[_0x37fb('0xe')]['streamFile'](_0x114c99);try{fs[_0x37fb('0x12a')](_0x114c99+_0x37fb('0x105'));}catch(_0x40d031){logger[_0x37fb('0x2e')](_0x40d031);}return _0x427643;}return this[_0x37fb('0xe')]['error'](_0x5cdcd6,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x37fb('0x11')][_0x37fb('0x1c7')]=function(_0x263e02){logger['info'](util['format'](_0x37fb('0x1c8'),_0x263e02[_0x37fb('0xb7')]));_0x263e02[_0x37fb('0x5c')]=_0x263e02[_0x37fb('0x5c')][_0x37fb('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x37fb('0xac')](_0x263e02[_0x37fb('0x5c')])){return this[_0x37fb('0xe')][_0x37fb('0xa7')]('no\x20text\x20configured');}this[_0x37fb('0xe')][_0x37fb('0xa7')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x263e02['text']));var _0x133c78=this[_0x37fb('0x63')][_0x37fb('0xc2')](this,_0x263e02);if(_0x133c78){this[_0x37fb('0xe')][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0x1c9'),_0x133c78));var _0x31b6b4=this['channel'][_0x37fb('0x104')](_0x133c78);try{fs[_0x37fb('0x12a')](_0x133c78+'.wav');}catch(_0x1d1b16){logger[_0x37fb('0x2e')](_0x1d1b16);}return _0x31b6b4;}return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x263e02,_0x37fb('0x1ca'));};AGIVertices[_0x37fb('0x11')][_0x37fb('0x1cb')]=function(_0x38088a){logger['info'](util[_0x37fb('0x98')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x38088a['label']));if(!this[_0x37fb('0xac')](_0x38088a[_0x37fb('0x160')])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x38088a,_0x37fb('0x15f'));}logger[_0x37fb('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x37fb('0xe')]['callerid'],_0x38088a['findBy']));var _0x1e02b5=this[_0x37fb('0x52')][_0x37fb('0xc2')](this,_0x38088a[_0x37fb('0x160')]);if(_0x1e02b5){logger['info'](util[_0x37fb('0x98')](_0x37fb('0x161'),this[_0x37fb('0xe')][_0x37fb('0x3b')],_0x38088a['findBy']));this[_0x37fb('0xe')]['noop'](util[_0x37fb('0x98')](_0x37fb('0x161'),this['channel'][_0x37fb('0x3b')],_0x38088a[_0x37fb('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0x37fb('0x30')](util[_0x37fb('0x98')](_0x37fb('0x163'),this[_0x37fb('0xe')]['callerid'],_0x38088a['findBy']));this['channel'][_0x37fb('0xa7')](util['format'](_0x37fb('0x163'),this[_0x37fb('0xe')][_0x37fb('0x3b')],_0x38088a[_0x37fb('0x160')]));return{'code':0xc8,'result':_0x37fb('0x168')};}};AGIVertices[_0x37fb('0x11')][_0x37fb('0x1cc')]=function(_0x254004){logger['info'](util[_0x37fb('0x98')](_0x37fb('0x1cd'),_0x254004[_0x37fb('0xb7')]));var _0x33a5b8=this['channel'][_0x37fb('0x56')](_0x37fb('0x1ce'),[_0x254004[_0x37fb('0x1cf')],_0x254004['options']]);if(_0x33a5b8[_0x37fb('0xa0')]===-0x1){return _0x33a5b8;}return this['channel'][_0x37fb('0xa7')](util[_0x37fb('0x98')](_0x37fb('0xc6'),'VOICEMAIL',_0x254004[_0x37fb('0x1cf')]));};AGIVertices[_0x37fb('0x11')]['vswitch']=function(_0x40aec5){logger[_0x37fb('0x30')](util['format'](_0x37fb('0x1d0'),_0x40aec5[_0x37fb('0xb7')]));if(!this[_0x37fb('0xac')](_0x40aec5['variable_id'])){return this[_0x37fb('0xe')][_0x37fb('0x2e')](_0x40aec5,_0x37fb('0x1b0'));}var _0x188fbf=this[_0x37fb('0x12')]['sync'](this,_0x40aec5['variable_id']);if(!_0x188fbf){return this[_0x37fb('0xe')]['error'](_0x40aec5,_0x37fb('0xdb'));}var _0x53b286=this[_0x37fb('0xe')][_0x37fb('0x12')](_0x188fbf);return{'code':0xc8,'result':_0x53b286[_0x37fb('0xa2')]?_0x53b286[_0x37fb('0xa2')]:'-'};};String[_0x37fb('0x11')][_0x37fb('0x9e')]=function(_0xea3478,_0x43fe0a){return this[_0x37fb('0x9d')](_0xea3478)[_0x37fb('0x1d1')](_0x43fe0a);};module['exports']=AGIVertices; \ No newline at end of file +var _0x8aa7=['retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_access_key_id','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','generate','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','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','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','.wav','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','forEach','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','sayDigits','digits','escape_digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','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','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','label','arg_1','createSquareRecording','callerid','extension','accountcode','uniqueid','createCmContact','isEmpty','callback_','random','isNil','lastName','list_id','scheduledAt','callback','toString','callback_priority','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','key','googleDialogflowV2','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','split','replaceAll','extra','result','isConfigured','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','phone','custom_app','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','RECOG_CONFIDENCE()','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','toUpperCase','DialogflowV2\x20Result\x20%s','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','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block'];(function(_0x433d74,_0x2cf5d0){var _0x5221d2=function(_0xaa7032){while(--_0xaa7032){_0x433d74['push'](_0x433d74['shift']());}};_0x5221d2(++_0x2cf5d0);}(_0x8aa7,0xb6));var _0x78aa=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8aa7[_0x53ccf2];return _0x5a2964;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x78aa('0x0'));var sh=require(_0x78aa('0x1'));var odbc=require(_0x78aa('0x2'))();var rs=require(_0x78aa('0x3'));var moment=require(_0x78aa('0x4'));var Mustache=require(_0x78aa('0x5'));var rp=require(_0x78aa('0x6'));var logger=require('../../config/logger')(_0x78aa('0x7'));var config=require(_0x78aa('0x8'));var shared=require(_0x78aa('0x9'));var scripts=require(_0x78aa('0xa'));var FILES_PATH=_0x78aa('0xb');var recursiveMapAttributes=[_0x78aa('0xc'),_0x78aa('0xd')];var verticesWithRetry=[_0x78aa('0xe'),_0x78aa('0xf'),_0x78aa('0x10')];var AGIVertices=function(_0x1da0ad,_0x116a77,_0x45d377){this[_0x78aa('0x11')]=_0x1da0ad;this[_0x78aa('0x12')]=_0x116a77;this[_0x78aa('0x13')]=_0x45d377;};AGIVertices[_0x78aa('0x14')][_0x78aa('0x15')]=function(_0x4168a2,_0x522c95){this['rpc'][_0x78aa('0x16')](_0x4168a2)[_0x78aa('0x17')](function(_0x47de41){_0x522c95(null,_0x47de41?_0x47de41[_0x78aa('0x18')]:![]);})[_0x78aa('0x19')](function(_0x1ef828){_0x522c95(_0x1ef828);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x1a')]=function(_0x5bda8a,_0xe657d5){this[_0x78aa('0x12')][_0x78aa('0x1b')](_0x5bda8a)[_0x78aa('0x17')](function(_0x38e744){_0xe657d5(null,_0x38e744?_0x38e744['name']:![]);})[_0x78aa('0x19')](function(_0x1cbf5f){_0xe657d5(_0x1cbf5f);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x1c')]=function(_0x390ce5,_0x2897f8){this['rpc']['getSquareProjectById'](_0x390ce5)[_0x78aa('0x17')](function(_0x345e4d){_0x2897f8(null,_0x345e4d?_0x345e4d[_0x78aa('0x18')]:![]);})[_0x78aa('0x19')](function(_0x9879bf){_0x2897f8(_0x9879bf);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x1d')]=function(_0x137354,_0x3f8d7d){this[_0x78aa('0x12')][_0x78aa('0x1e')](_0x137354)['then'](function(_0x18c60d){_0x3f8d7d(null,_0x18c60d?_0x18c60d[_0x78aa('0x1f')]:![]);})['catch'](function(_0xa732df){_0x3f8d7d(_0xa732df);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x20')]=function(_0x507b19,_0x5a9dbf){this[_0x78aa('0x12')][_0x78aa('0x21')](_0x507b19)['then'](function(_0x13a601){_0x5a9dbf(null,_0x13a601?_0x13a601[_0x78aa('0x18')]:![]);})[_0x78aa('0x19')](function(_0x3b17b8){_0x5a9dbf(_0x3b17b8);});};AGIVertices['prototype'][_0x78aa('0x22')]=function(_0x25463d,_0x1309d0){this[_0x78aa('0x12')][_0x78aa('0x23')](_0x25463d)[_0x78aa('0x17')](function(_0x45a391){_0x1309d0(null,_0x45a391?_0x45a391[_0x78aa('0x18')]:![]);})['catch'](function(_0x339805){_0x1309d0(_0x339805);});};AGIVertices['prototype'][_0x78aa('0x24')]=function(_0x4ce671,_0x2d1711){var _0x1bdea2=this;this[_0x78aa('0x12')][_0x78aa('0x25')](_0x4ce671)[_0x78aa('0x17')](function(_0x5683c8){_0x2d1711(null,_0x5683c8?_0x1bdea2[_0x78aa('0x26')](_0x5683c8[_0x78aa('0x27')]):![]);})['catch'](function(_0x156170){_0x2d1711(_0x156170);});};AGIVertices['prototype']['getMailAccount']=function(_0x6d8516,_0x5a7f57){this['rpc'][_0x78aa('0x28')](_0x6d8516)[_0x78aa('0x17')](function(_0xb5fefd){_0x5a7f57(null,_0xb5fefd?_0xb5fefd:![]);})[_0x78aa('0x19')](function(_0x22ea8b){_0x5a7f57(_0x22ea8b);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x29')]=function(_0x53dd7e,_0x47ae09,_0x4976be){this[_0x78aa('0x13')][_0x78aa('0x29')](_0x53dd7e,_0x47ae09)[_0x78aa('0x17')](function(){_0x4976be(null);})[_0x78aa('0x19')](function(_0x565098){_0x4976be(_0x565098);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x2a')]=function(_0x477b34,_0x5d029a){this['rpc']['getIntervalById'](_0x477b34)['then'](function(_0x312a42){if(_0x312a42){if(_0x312a42[_0x78aa('0x2b')]){_0x5d029a(null,[_0x312a42[_0x78aa('0x2c')]]);}else{_0x5d029a(null,_[_0x78aa('0x2d')](_0x312a42[_0x78aa('0x2e')],_0x78aa('0x2c')));}}else{_0x5d029a(null,![]);}})[_0x78aa('0x19')](function(_0x1dc311){_0x5d029a(_0x1dc311);});};AGIVertices[_0x78aa('0x14')]['getSoundPath']=function(_0x1ca73d){return util['format'](_0x78aa('0x2f'),FILES_PATH,_0x1ca73d);};AGIVertices[_0x78aa('0x14')][_0x78aa('0x30')]=function(_0xaa0afa,_0x1c4759,_0x24f718){odbc[_0x78aa('0x31')](_0xaa0afa,function(_0x13af04){if(_0x13af04){logger['error'](_0x78aa('0x32'),_0x13af04);_0x24f718(_0x13af04);}else{logger[_0x78aa('0x33')]('ODBC\x20connection\x20successfully');odbc[_0x78aa('0x34')](_0x1c4759,function(_0x524362,_0x202143){if(_0x524362){logger[_0x78aa('0x33')](_0x78aa('0x35'),_0x1c4759);_0x24f718(_0x524362);}else{logger[_0x78aa('0x33')](_0x78aa('0x36'),_0x1c4759);odbc[_0x78aa('0x37')](function(_0x1f9499){if(_0x1f9499){logger[_0x78aa('0x38')](_0x78aa('0x39'),_0x1f9499);}_0x24f718(null,_0x202143);});}});}});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x3a')]=function(_0x19f4a0,_0x3738ea){this[_0x78aa('0x12')]['getSmsAccountById'](_0x19f4a0)['then'](function(_0x6d7615){_0x3738ea(null,_0x6d7615?_0x6d7615:![]);})['catch'](function(_0x1aad9b){_0x3738ea(_0x1aad9b);});};AGIVertices[_0x78aa('0x14')]['createSmsMessage']=function(_0x5eb009,_0x318648){this['rpc'][_0x78aa('0x3b')](_0x5eb009)['then'](function(_0x4d9913){_0x318648(null,_0x4d9913);})[_0x78aa('0x19')](function(_0x279f94){_0x318648(_0x279f94);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x3c')]=function(_0x59d035,_0x680aac,_0x4fc854){this[_0x78aa('0x12')][_0x78aa('0x3c')]({'uniqueid':this['channel']['uniqueid'],'node':_0x59d035[_0x78aa('0x3d')],'application':_0x59d035['agicommand'],'data':_0x680aac||null,'project_name':this['channel'][_0x78aa('0x3e')],'callerid':this[_0x78aa('0x11')]['callerid']})[_0x78aa('0x17')](function(_0x27e240){if(_0x4fc854){_0x4fc854(null,_0x27e240);}})[_0x78aa('0x19')](function(_0xe86024){if(_0x4fc854){_0x4fc854(_0xe86024);}});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x3f')]=function(_0xe83bd2,_0x35559e,_0x1eb198,_0xd2d2dd){this[_0x78aa('0x12')][_0x78aa('0x3f')]({'uniqueid':this[_0x78aa('0x11')]['uniqueid'],'callerid':this['channel'][_0x78aa('0x40')],'calleridname':this[_0x78aa('0x11')]['calleridname'],'context':this[_0x78aa('0x11')]['context'],'extension':this[_0x78aa('0x11')][_0x78aa('0x41')],'priority':this['channel']['priority'],'accountcode':this[_0x78aa('0x11')][_0x78aa('0x42')],'dnid':this['channel']['dnid'],'projectName':this[_0x78aa('0x11')][_0x78aa('0x3e')],'saveName':_0x35559e,'filename':_0xe83bd2['file']||_0x35559e,'savePath':_0x1eb198})[_0x78aa('0x17')](function(_0x40b244){_0xd2d2dd(null,_0x40b244);})[_0x78aa('0x19')](function(_0x3f9924){_0xd2d2dd(_0x3f9924);});};AGIVertices[_0x78aa('0x14')]['createSquareMessage']=function(_0x1d1717,_0x39497b,_0x35ecf8,_0x2861f3,_0x2c5a27){this[_0x78aa('0x12')]['createSquareMessage']({'uniqueid':this[_0x78aa('0x11')][_0x78aa('0x43')],'body':_0x1d1717,'direction':_0x39497b,'providerName':_0x35ecf8,'providerResponse':_0x2861f3})[_0x78aa('0x17')](function(_0x4e4e53){if(_0x2c5a27){_0x2c5a27(null,_0x4e4e53);}})[_0x78aa('0x19')](function(_0x4bd2a4){if(_0x2c5a27){_0x2c5a27(_0x4bd2a4);}});};AGIVertices['prototype'][_0x78aa('0x44')]=function(_0x3489b8,_0x24f647){this['rpc'][_0x78aa('0x44')]({'firstName':_[_0x78aa('0x45')](_0x3489b8[_0x78aa('0x18')])||_['isNil'](_0x3489b8[_0x78aa('0x18')])?_0x78aa('0x46')+Math[_0x78aa('0x47')]():_0x3489b8[_0x78aa('0x18')],'lastName':_[_0x78aa('0x45')](_0x3489b8['lastName'])||_[_0x78aa('0x48')](_0x3489b8[_0x78aa('0x49')])?null:_0x3489b8[_0x78aa('0x49')],'phone':_0x3489b8['phone'],'ListId':_0x3489b8[_0x78aa('0x4a')],'scheduledat':_0x3489b8[_0x78aa('0x4b')],'callbackUniqueid':this[_0x78aa('0x11')]['uniqueid'],'tags':_0x78aa('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x3489b8[_0x78aa('0x4b')][_0x78aa('0x4d')](),'priority':_0x3489b8[_0x78aa('0x4e')]})['then'](function(_0x1db3d6){_0x24f647(null,_0x1db3d6);})[_0x78aa('0x19')](function(_0x2d9e7a){_0x24f647(_0x2d9e7a);});};AGIVertices[_0x78aa('0x14')]['getPause']=function(_0x2fab59,_0x49d799){this['rpc']['getPauseById'](_0x2fab59)['then'](function(_0x49cf71){_0x49d799(null,_0x49cf71?_0x49cf71[_0x78aa('0x18')]:![]);})[_0x78aa('0x19')](function(_0x505aca){_0x49d799(_0x505aca);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x4f')]=function(_0x2816bb,_0x167f3d,_0x5dd54f){var _0x2755c4={'role':_0x78aa('0x50')};_0x2755c4[_0x2816bb]=this['channel']['callerid'];this['rpc']['agentPause'](_0x2755c4,_0x167f3d,this[_0x78aa('0x11')][_0x78aa('0x43')])[_0x78aa('0x17')](function(_0x5706d7){_0x5dd54f(null,_[_0x78aa('0x48')](_0x5706d7)?![]:!![]);})['catch'](function(_0xc266a0){logger[_0x78aa('0x38')](_0xc266a0);_0x5dd54f(null,![]);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x51')]=function(_0x352cd6,_0x1c738b){var _0x2245b4={'role':_0x78aa('0x50')};_0x2245b4[_0x352cd6]=this['channel'][_0x78aa('0x40')];this['rpc'][_0x78aa('0x51')](_0x2245b4)[_0x78aa('0x17')](function(_0x4057aa){_0x1c738b(null,_[_0x78aa('0x48')](_0x4057aa)?![]:!![]);})[_0x78aa('0x19')](function(_0x568824){logger[_0x78aa('0x38')](_0x568824);_0x1c738b(null,![]);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x52')]=function(_0x46cb4b,_0x1cc67d){var _0x42b037={'role':_0x78aa('0x50')};_0x42b037[_0x46cb4b]=this['channel'][_0x78aa('0x40')];this['rpc'][_0x78aa('0x52')](_0x42b037)[_0x78aa('0x17')](function(_0x2ca371){_0x1cc67d(null,_[_0x78aa('0x48')](_0x2ca371)?![]:!![]);})['catch'](function(_0x5d4345){logger[_0x78aa('0x38')](_0x5d4345);_0x1cc67d(null,![]);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x53')]=function(_0xd30ee2,_0x2927be){var _0x2ce9b7={'role':'agent'};_0x2ce9b7[_0xd30ee2]=this[_0x78aa('0x11')][_0x78aa('0x40')];var _0x34a2e6=_0xd30ee2!=_0x78aa('0x54')?util[_0x78aa('0x55')]('%s/%s@from-sip/n',_0x78aa('0x56'),this['channel']['callerid']):undefined;this[_0x78aa('0x12')][_0x78aa('0x53')](_0x2ce9b7,_0x34a2e6)[_0x78aa('0x17')](function(_0x4f746b){_0x2927be(null,_['isNil'](_0x4f746b)?![]:!![]);})[_0x78aa('0x19')](function(_0x1e5d6d){logger['error'](_0x1e5d6d);_0x2927be(null,![]);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x57')]=function(_0x5704b5,_0x4bbb87){sh[_0x78aa('0x58')](_[_0x78aa('0x59')](_0x5704b5),function(_0x19a867,_0x5eebcb){var _0x3b00bf=_0x5eebcb[_0x78aa('0x5a')](/(\r\n|\n|\r)/gm,'');_0x4bbb87(null,_0x3b00bf);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x5b')]=function(_0x3acb6a,_0x22cc9e){scripts[_0x78aa('0x5b')](_0x3acb6a[_0x78aa('0x5c')],_0x3acb6a[_0x78aa('0x5d')]||_0x78aa('0x5e'),_0x3acb6a[_0x78aa('0x5e')],_0x3acb6a[_0x78aa('0x5f')]||_0x78aa('0x60'),_0x3acb6a[_0x78aa('0x61')]||_0x78aa('0x62'),_0x3acb6a[_0x78aa('0x63')]||_0x78aa('0x64'))['then'](function(_0x22bc59){_0x22cc9e(null,_0x22bc59);})[_0x78aa('0x19')](function(_0x292564){_0x22cc9e(_0x292564);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x65')]=function(_0x260bb2,_0x45af96){scripts[_0x78aa('0x65')](_0x260bb2['text'],_0x260bb2[_0x78aa('0x66')]||'en',0x1)[_0x78aa('0x17')](function(_0x5c1909){_0x45af96(null,_0x5c1909);})[_0x78aa('0x19')](function(_0x5b3c4a){_0x45af96(_0x5b3c4a);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x67')]=function(_0x25d63a,_0x4a019e){var _0x47a18b={'uri':_0x25d63a[_0x78aa('0x68')],'method':_0x25d63a['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x25d63a[_0x78aa('0x69')])===_0x78aa('0x6a')&&parseInt(_0x25d63a['timeout'])>=0x1?parseInt(_0x25d63a['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x78aa('0x6b')]([_0x78aa('0x6c'),_0x78aa('0x6d')],_0x47a18b['method']['toUpperCase']())){try{_0x47a18b[_0x78aa('0x6e')]=_0x25d63a[_0x78aa('0xd')]?JSON[_0x78aa('0x6f')](_0x25d63a[_0x78aa('0xd')]):{};}catch(_0x40ca70){logger['error'](_0x78aa('0x70'),_0x40ca70);}}try{_0x47a18b['headers']=_0x25d63a['rawHeaders']?JSON[_0x78aa('0x6f')](_0x25d63a[_0x78aa('0xc')]):{};}catch(_0x5ff09d){logger[_0x78aa('0x38')](_0x78aa('0x71'),_0x5ff09d);}if(_0x25d63a[_0x78aa('0x72')]){try{var _0x398402=require(_0x25d63a[_0x78aa('0x72')])[_0x78aa('0x73')](this,_0x47a18b);_0x47a18b[_0x78aa('0x74')]=Mustache[_0x78aa('0x75')](_0x25d63a[_0x78aa('0x68')],_0x398402,{},['$$','$$']);if(_0x47a18b[_0x78aa('0x76')]){_0x47a18b[_0x78aa('0x76')]=JSON[_0x78aa('0x6f')](Mustache[_0x78aa('0x75')](JSON[_0x78aa('0x77')](_0x47a18b[_0x78aa('0x76')]),_0x398402,{},['$$','$$']));}if(_0x47a18b['body']){_0x47a18b[_0x78aa('0x6e')]=JSON['parse'](Mustache['render'](JSON[_0x78aa('0x77')](_0x47a18b[_0x78aa('0x6e')]),_0x398402,{},['$$','$$']));}}catch(_0x382913){logger[_0x78aa('0x38')](_0x78aa('0x78'),_0x382913);}}rp(_0x47a18b)[_0x78aa('0x17')](function(_0x34ce29){var _0x2da84e={'statusCode':_0x34ce29[_0x78aa('0x79')]||0xc8,'statusMessage':_0x34ce29[_0x78aa('0x7a')]||'OK','headers':_0x34ce29['headers']||{},'body':_0x34ce29[_0x78aa('0x6e')]||{}};_0x4a019e(null,_0x2da84e);})[_0x78aa('0x19')](function(_0x43018e){var _0x4cdaea={'statusCode':_0x43018e[_0x78aa('0x79')]||0x1f4,'statusMessage':_0x43018e[_0x78aa('0x7b')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x43018e[_0x78aa('0x7c')][_0x78aa('0x76')]||{},'body':_0x43018e[_0x78aa('0x7c')][_0x78aa('0x6e')]||{}};_0x4a019e(null,_0x4cdaea);});};AGIVertices[_0x78aa('0x14')]['googleDialogflow']=function(_0x5bb777,_0x4d2783){scripts['googleDialogflow'](this['channel'][_0x78aa('0x43')],_0x5bb777[_0x78aa('0x7d')],_0x5bb777[_0x78aa('0x5e')],_0x5bb777['dialogflow_language']||'en')[_0x78aa('0x17')](function(_0x2fa504){_0x4d2783(null,_0x2fa504);})[_0x78aa('0x19')](function(_0x1caf28){_0x4d2783(_0x1caf28);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x7e')]=function(_0x3bae4e,_0x578a19){scripts['googleDialogflowV2'](this[_0x78aa('0x11')][_0x78aa('0x43')],_0x3bae4e['dialogflowV2_project_id'],_0x3bae4e[_0x78aa('0x7f')],_0x3bae4e['private_key'],_0x3bae4e[_0x78aa('0x5e')],_0x3bae4e['dialogflowV2_language']||'en')[_0x78aa('0x17')](function(_0x40b185){_0x578a19(null,_0x40b185);})[_0x78aa('0x19')](function(_0x1672a7){_0x578a19(_0x1672a7);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x80')]=function(_0x52b1ff,_0xde9460){scripts[_0x78aa('0x80')](this['channel'],_0x52b1ff)[_0x78aa('0x17')](function(_0x8f6c8b){_0xde9460(null,_0x8f6c8b);})[_0x78aa('0x19')](function(_0x39dacc){_0xde9460(_0x39dacc);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x81')]=function(_0x41f082,_0x489666){scripts[_0x78aa('0x81')](_0x41f082[_0x78aa('0x7d')],_0x41f082[_0x78aa('0x5e')],_0x41f082[_0x78aa('0x82')]||'en-US',_0x41f082[_0x78aa('0x83')])[_0x78aa('0x17')](function(_0x2c3452){_0x489666(null,_0x2c3452);})[_0x78aa('0x19')](function(_0x1fb538){_0x489666(_0x1fb538);});};AGIVertices['prototype'][_0x78aa('0x84')]=function(_0x1efa7b,_0x49a19b,_0x490cde){scripts['ispeechASR'](_0x49a19b,_0x1efa7b[_0x78aa('0x7d')],_0x1efa7b['ispeech_asr_language']||'en-US',this['isConfigured'](_0x1efa7b[_0x78aa('0x85')])?_0x1efa7b['model']:undefined)['then'](function(_0x6898db){_0x490cde(null,_0x6898db);})[_0x78aa('0x19')](function(_0x166ace){_0x490cde(_0x166ace);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x86')]=function(_0x320483,_0x754a4){scripts['awsPolly'](_0x320483['aws_access_key_id'],_0x320483[_0x78aa('0x87')],_0x320483[_0x78aa('0x88')],_0x320483[_0x78aa('0x89')]||'Amy',_0x320483[_0x78aa('0x5e')],_0x320483[_0x78aa('0x8a')]||_0x78aa('0x5e'))[_0x78aa('0x17')](function(_0x2e2204){_0x754a4(null,_0x2e2204);})['catch'](function(_0x2943e6){_0x754a4(_0x2943e6);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x8b')]=function(_0x3159ff,_0x5e4170){scripts['awsLex'](this[_0x78aa('0x11')][_0x78aa('0x43')],_0x3159ff['aws_access_key_id'],_0x3159ff['aws_secret_access_key'],_0x3159ff[_0x78aa('0x8c')],_0x3159ff[_0x78aa('0x5e')],_0x3159ff['aws_bot_name'])[_0x78aa('0x17')](function(_0x1d1a61){_0x5e4170(null,_0x1d1a61);})[_0x78aa('0x19')](function(_0x5b7478){_0x5e4170(_0x5b7478);});};AGIVertices[_0x78aa('0x14')][_0x78aa('0x8d')]=function(_0x1faa58,_0x475774,_0x46e122){scripts[_0x78aa('0x8d')](_0x475774,_0x1faa58['key'],_0x1faa58[_0x78aa('0x8e')]||_0x78aa('0x60'))['then'](function(_0x28eaf8){_0x46e122(null,_0x28eaf8);})[_0x78aa('0x19')](function(_0x24d533){_0x46e122(_0x24d533);});};AGIVertices[_0x78aa('0x14')]['tildeASR']=function(_0x5304a6,_0x3b96b9,_0xff566){scripts[_0x78aa('0x8f')](_0x3b96b9,_0x5304a6[_0x78aa('0x90')],_0x5304a6[_0x78aa('0x91')],_0x5304a6[_0x78aa('0x74')])[_0x78aa('0x17')](function(_0x390a72){_0xff566(null,_0x390a72);})[_0x78aa('0x19')](function(_0x4a008e){_0xff566(_0x4a008e);});};AGIVertices['prototype'][_0x78aa('0x92')]=function(_0xd65292){var _0x24387d=_[_0x78aa('0x6b')](verticesWithRetry,_0xd65292['agicommand'])?_0xd65292:_[_0x78aa('0x93')](_0xd65292);for(var _0x1d8187 in _0x24387d){if(_0x24387d[_0x78aa('0x94')](_0x1d8187)){if(_0x24387d[_0x1d8187]&&_[_0x78aa('0x95')](_0x24387d[_0x1d8187])){if(_[_0x78aa('0x6b')](recursiveMapAttributes,_0x1d8187)){_0x24387d[_0x1d8187]=this[_0x78aa('0x96')](_0x24387d[_0x1d8187]);}else{_0x24387d[_0x1d8187]=this[_0x78aa('0x97')](_0x24387d[_0x1d8187]);}}}}return _0x24387d;};AGIVertices[_0x78aa('0x14')][_0x78aa('0x98')]=function(_0x5922f7){for(var _0x228507 in _0x5922f7){if(_0x5922f7[_0x78aa('0x94')](_0x228507)){if(_[_0x78aa('0x99')](_0x5922f7[_0x228507])){this[_0x78aa('0x98')](_0x5922f7[_0x228507]);}else if(_['isArray'](_0x5922f7[_0x228507])){for(var _0x3a44f1=0x0;_0x3a44f1<_0x5922f7[_0x228507][_0x78aa('0x9a')];_0x3a44f1++){this[_0x78aa('0x98')](_0x5922f7[_0x228507][_0x3a44f1]);}}else if(_[_0x78aa('0x95')](_0x5922f7[_0x228507])){_0x5922f7[_0x228507]=this['replaceAllVariables'](_0x5922f7[_0x228507]);}}}};AGIVertices[_0x78aa('0x14')]['saveRestApiResult']=function(_0x387d54,_0x3f4425){for(var _0x175b67 in _0x387d54){if(_0x387d54[_0x78aa('0x94')](_0x175b67)){if(_[_0x78aa('0x99')](_0x387d54[_0x175b67])){if(!_[_0x78aa('0x45')](_0x387d54[_0x175b67])){this[_0x78aa('0x9b')](_0x387d54[_0x175b67],util['format'](_0x78aa('0x9c'),_0x3f4425,_0x175b67));}}else if(_[_0x78aa('0x9d')](_0x387d54[_0x175b67])){for(var _0x8ec900=0x0;_0x8ec900<_0x387d54[_0x175b67][_0x78aa('0x9a')];_0x8ec900++){this[_0x78aa('0x9b')](_0x387d54[_0x175b67][_0x8ec900],util['format']('%s.%s',_0x3f4425,_0x175b67+'['+_0x8ec900+']'));}}else{if(!_[_0x78aa('0x48')](_0x387d54[_0x175b67])){this[_0x78aa('0x11')][_0x78aa('0x9e')](util[_0x78aa('0x55')]('%s.%s',_0x3f4425,_0x175b67),_0x387d54[_0x175b67]);}}}}};AGIVertices[_0x78aa('0x14')][_0x78aa('0x96')]=function(_0x488f7a){try{var _0x5393d0=JSON['parse'](_0x488f7a);this[_0x78aa('0x98')](_0x5393d0);return JSON[_0x78aa('0x77')](_0x5393d0);}catch(_0x6621f8){return this['replaceAllVariables'](_0x488f7a);}};AGIVertices['prototype'][_0x78aa('0x97')]=function(_0x11a5f0){var _0x5d93ec=_0x11a5f0[_0x78aa('0x9f')]('{');for(var _0x12c9e0=0x1;_0x12c9e0<_0x5d93ec[_0x78aa('0x9a')];_0x12c9e0+=0x1){var _0x6df34f=_0x5d93ec[_0x12c9e0]['split']('}');if(_0x6df34f[_0x78aa('0x9a')]>0x1){_0x11a5f0=_0x11a5f0[_0x78aa('0xa0')]('{'+_0x6df34f[0x0]+'}',this[_0x78aa('0x11')][_0x78aa('0x15')](_0x6df34f[0x0])[_0x78aa('0xa1')]||_0x6df34f[0x0]);}}if(_0x5d93ec['length']===0x1){return _0x11a5f0[_0x78aa('0x4d')]();}return this[_0x78aa('0x97')](_0x11a5f0);};AGIVertices[_0x78aa('0x14')]['getAndSetVariable']=function(_0x43682d,_0x4ad9fa){var _0x46e783=this['channel'][_0x78aa('0x15')](_0x43682d);if(_0x46e783[_0x78aa('0xa2')]===-0x1){return _0x46e783;}logger['info'](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4ad9fa,_0x46e783[_0x78aa('0xa1')]));return this[_0x78aa('0x11')][_0x78aa('0x9e')](_0x4ad9fa,_0x46e783[_0x78aa('0xa1')]);};AGIVertices[_0x78aa('0x14')][_0x78aa('0xa3')]=function(_0x1056a){return _0x1056a&&_0x1056a!=='0'&&_0x1056a!=='-1'&&_0x1056a!=='';};AGIVertices[_0x78aa('0x14')][_0x78aa('0xa4')]=function(_0xeb4480){this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0xeb4480,'-');_0xeb4480['retry']=_0xeb4480[_0x78aa('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x78aa('0x14')]['mrcpsynth']=function(_0x4da715){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0xa5'),_0x4da715[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x4da715[_0x78aa('0x5e')])){return this['channel'][_0x78aa('0xa6')](_0x78aa('0xa7'));}var _0x3ecc43='\x22'+_0x4da715[_0x78aa('0x5e')]+'\x22';if(this['isConfigured'](_0x4da715['options'])){_0x3ecc43+=','+_0x4da715[_0x78aa('0x7c')];}var _0x475ce3=this[_0x78aa('0x11')][_0x78aa('0x58')](_0x78aa('0xa8'),_0x3ecc43);if(_0x475ce3[_0x78aa('0xa2')]===-0x1){return _0x475ce3;}return this[_0x78aa('0x11')]['noop'](util['format'](_0x78aa('0xa9'),_0x3ecc43));};AGIVertices['prototype'][_0x78aa('0xaa')]=function(_0x83e1c1){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0xab'),_0x83e1c1['label']));if(!this[_0x78aa('0xa3')](_0x83e1c1[_0x78aa('0xac')])){return this[_0x78aa('0x11')]['noop'](_0x78aa('0xad'));}var _0x33e37e=_0x83e1c1[_0x78aa('0xac')];if(this[_0x78aa('0xa3')](_0x83e1c1[_0x78aa('0x7c')])){_0x33e37e+=','+_0x83e1c1[_0x78aa('0x7c')];}var _0x2b2cda=this[_0x78aa('0x11')][_0x78aa('0x58')](_0x78aa('0xae'),_0x33e37e);if(_0x2b2cda[_0x78aa('0xa2')]===-0x1){return _0x2b2cda;}var _0x300bd8=this['getAndSetVariable']('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x300bd8['result']===-0x1){return _0x300bd8;}var _0xeb1787=this[_0x78aa('0xaf')](_0x78aa('0xb0'),'MRCP_RECOG_TRANSCRIPT');if(_0xeb1787[_0x78aa('0xa2')]===-0x1){return _0xeb1787;}var _0x520dea=this[_0x78aa('0xaf')](_0x78aa('0xb1'),'MRCP_RECOG_INSTANCE');if(_0x520dea['result']===-0x1){return _0x520dea;}return this['channel']['noop'](util[_0x78aa('0x55')](_0x78aa('0xb2'),_0x33e37e));};AGIVertices[_0x78aa('0x14')][_0x78aa('0x7')]=function(_0x1d6ad8){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0xb3'),_0x1d6ad8[_0x78aa('0x3d')]));return this[_0x78aa('0x11')][_0x78aa('0x7')]([_0x1d6ad8[_0x78aa('0xb4')],_0x1d6ad8[_0x78aa('0xb5')]]);};AGIVertices[_0x78aa('0x14')][_0x78aa('0xb6')]=function(_0x34ce69){logger[_0x78aa('0x33')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x34ce69[_0x78aa('0x3d')]));if(this[_0x78aa('0xa3')](_0x34ce69[_0x78aa('0x69')])){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0xb7'),_0x34ce69[_0x78aa('0x69')]));var _0x5c961d=this[_0x78aa('0x11')]['wait'](_0x34ce69['timeout']);if(_0x5c961d[_0x78aa('0xa2')]===-0x1){return _0x5c961d;}}return this[_0x78aa('0x11')][_0x78aa('0xb6')]();};AGIVertices[_0x78aa('0x14')][_0x78aa('0x4c')]=function(_0x335ecb){logger['info'](util[_0x78aa('0x55')](_0x78aa('0xb8'),_0x335ecb[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x335ecb[_0x78aa('0x4a')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x335ecb,_0x78aa('0xb9'));}_0x335ecb[_0x78aa('0x4b')]=moment();if(this[_0x78aa('0xa3')](_0x335ecb[_0x78aa('0xba')])){_0x335ecb[_0x78aa('0x4b')]=moment()[_0x78aa('0xbb')](_0x335ecb[_0x78aa('0xba')],'minutes');}if(!this[_0x78aa('0xa3')](_0x335ecb[_0x78aa('0x4e')])){_0x335ecb[_0x78aa('0x4e')]=0x2;}this[_0x78aa('0x44')]['sync'](this,_0x335ecb);return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x335ecb[_0x78aa('0xbc')],_0x335ecb[_0x78aa('0x4a')],_0x335ecb[_0x78aa('0x4b')]));};AGIVertices[_0x78aa('0x14')][_0x78aa('0xbd')]=function(_0x2f157b){logger['info'](util[_0x78aa('0x55')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2f157b[_0x78aa('0x3d')]));var _0x2ccd6a=this[_0x78aa('0x11')][_0x78aa('0x58')](_0x2f157b[_0x78aa('0xbe')],_0x2f157b[_0x78aa('0x7c')]);if(_0x2ccd6a['result']===-0x1){return _0x2ccd6a;}return this[_0x78aa('0x11')]['noop'](util[_0x78aa('0x55')](_0x78aa('0xbf'),_0x2f157b[_0x78aa('0xbe')],_0x2f157b['options']));};AGIVertices[_0x78aa('0x14')]['lumenvoxtts']=function(_0x5219d2){logger['info'](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x5219d2[_0x78aa('0x3d')]));if(!this['isConfigured'](_0x5219d2[_0x78aa('0x5e')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')]('no\x20text\x20configured');}var _0xb310f5='\x22'+_0x5219d2[_0x78aa('0x5e')]+'\x22';if(this[_0x78aa('0xa3')](_0x5219d2[_0x78aa('0x7c')])){_0xb310f5+=','+_0x5219d2['options'];}var _0x1c2e0f=this[_0x78aa('0x11')]['exec'](_0x78aa('0xa8'),_0xb310f5);if(_0x1c2e0f[_0x78aa('0xa2')]===-0x1){return _0x1c2e0f;}return this[_0x78aa('0x11')]['noop'](util[_0x78aa('0x55')](_0x78aa('0xa9'),_0xb310f5));};AGIVertices[_0x78aa('0x14')]['sestektts']=function(_0x1f32a2){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0xc0'),_0x1f32a2[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x1f32a2['text'])){return this[_0x78aa('0x11')][_0x78aa('0xa6')]('no\x20text\x20configured');}var _0x7c95a0='\x22'+_0x1f32a2['text']+'\x22';if(this[_0x78aa('0xa3')](_0x1f32a2[_0x78aa('0x7c')])){_0x7c95a0+=','+_0x1f32a2[_0x78aa('0x7c')];}var _0x1abd2e=this[_0x78aa('0x11')][_0x78aa('0x58')](_0x78aa('0xa8'),_0x7c95a0);if(_0x1abd2e[_0x78aa('0xa2')]===-0x1){return _0x1abd2e;}return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xa9'),_0x7c95a0));};AGIVertices[_0x78aa('0x14')][_0x78aa('0xc1')]=function(_0x10b33d){logger[_0x78aa('0x33')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x10b33d[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x10b33d[_0x78aa('0xac')])){return this[_0x78aa('0x11')]['noop']('no\x20grammar\x20configured');}var _0x13dff9=_0x10b33d['grammar'];if(this[_0x78aa('0xa3')](_0x10b33d['options'])){_0x13dff9+=','+_0x10b33d[_0x78aa('0x7c')];}var _0xe5e5b5=this['channel'][_0x78aa('0x58')](_0x78aa('0xae'),_0x13dff9);if(_0xe5e5b5[_0x78aa('0xa2')]===-0x1){return _0xe5e5b5;}var _0x11d84d=this[_0x78aa('0xaf')](_0x78aa('0xc2'),'LUMENVOX_ASR_CONFIDENCE');if(_0x11d84d['result']===-0x1){return _0x11d84d;}var _0x8f70d4=this[_0x78aa('0xaf')](_0x78aa('0xb0'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x8f70d4[_0x78aa('0xa2')]===-0x1){return _0x8f70d4;}var _0x196a58=this[_0x78aa('0xaf')]('RECOG_INSTANCE()',_0x78aa('0xc3'));if(_0x196a58[_0x78aa('0xa2')]===-0x1){return _0x196a58;}return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xb2'),_0x13dff9));};AGIVertices[_0x78aa('0x14')]['sestekasr']=function(_0x4b7a5c){logger['info'](util[_0x78aa('0x55')](_0x78aa('0xc4'),_0x4b7a5c[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x4b7a5c[_0x78aa('0xac')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0xad'));}var _0x3fdbcd=_0x4b7a5c[_0x78aa('0xac')];if(this['isConfigured'](_0x4b7a5c[_0x78aa('0x7c')])){_0x3fdbcd+=','+_0x4b7a5c['options'];}var _0x108f66=this['channel'][_0x78aa('0x58')]('MRCPRecog',_0x3fdbcd);if(_0x108f66[_0x78aa('0xa2')]===-0x1){return _0x108f66;}var _0x1ef55d=this[_0x78aa('0xaf')](_0x78aa('0xc2'),'SESTEK_ASR_CONFIDENCE');if(_0x1ef55d[_0x78aa('0xa2')]===-0x1){return _0x1ef55d;}var _0x47c373=this[_0x78aa('0xaf')](_0x78aa('0xb0'),_0x78aa('0xc5'));if(_0x47c373[_0x78aa('0xa2')]===-0x1){return _0x47c373;}var _0x1fd949=this[_0x78aa('0xaf')](_0x78aa('0xb1'),_0x78aa('0xc6'));if(_0x1fd949['result']===-0x1){return _0x1fd949;}return this['channel'][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xb2'),_0x3fdbcd));};AGIVertices['prototype'][_0x78aa('0xc7')]=function(_0x42433b){logger[_0x78aa('0x33')](util['format'](_0x78aa('0xc8'),_0x42433b[_0x78aa('0x3d')]));if(!this['isConfigured'](_0x42433b[_0x78aa('0xc9')])){return this['channel'][_0x78aa('0x38')](_0x42433b,_0x78aa('0xca'));}var _0x2ee658=this[_0x78aa('0x1d')]['sync'](this,_0x42433b['odbc_id']);if(!_0x2ee658){return this['channel'][_0x78aa('0x38')](_0x42433b,_0x78aa('0xcb'));}if(!this['isConfigured'](_0x42433b[_0x78aa('0x34')])){return this['channel']['error'](_0x42433b,_0x78aa('0xcc'));}var _0x47e9be=_0x42433b[_0x78aa('0x34')][_0x78aa('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xcd'),_0x47e9be));var _0x5ec892=this[_0x78aa('0x30')][_0x78aa('0x73')](this,_0x2ee658,_0x47e9be);this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0x42433b,_0x47e9be);if(!this[_0x78aa('0xa3')](_0x42433b[_0x78aa('0xce')])){return this[_0x78aa('0x11')]['noop'](_0x78aa('0xcf'));}var _0x2f1d33=this[_0x78aa('0x15')][_0x78aa('0x73')](this,_0x42433b[_0x78aa('0xce')]);if(!_0x2f1d33){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x42433b,_0x78aa('0xd0'));}var _0x8c99d2=this;_0x5ec892['forEach'](function(_0x57c6fb,_0x59c647){Object[_0x78aa('0xd1')](_0x57c6fb)['forEach'](function(_0x475d43){_0x8c99d2[_0x78aa('0x11')][_0x78aa('0x9e')](util[_0x78aa('0x55')](_0x78aa('0xd2'),_0x2f1d33,_0x59c647,_0x475d43),_0x57c6fb[_0x475d43]);});});this[_0x78aa('0x11')][_0x78aa('0x9e')](util[_0x78aa('0x55')](_0x78aa('0xd3'),_0x2f1d33),_0x5ec892[_0x78aa('0x9a')]);return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xd4'),_0x2f1d33));};AGIVertices[_0x78aa('0x14')][_0x78aa('0xd5')]=function(_0x15996f){logger[_0x78aa('0xd6')](util[_0x78aa('0x55')](_0x78aa('0xd7'),_0x15996f[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x15996f[_0x78aa('0xd8')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x15996f,_0x78aa('0xd9'));}var _0x46cef5=this[_0x78aa('0x20')][_0x78aa('0x73')](this,_0x15996f[_0x78aa('0xd8')]);if(!_0x46cef5){return this['channel'][_0x78aa('0x38')](_0x15996f,_0x78aa('0xda'));}var _0x3506a6=this[_0x78aa('0x11')][_0x78aa('0x58')]('DIAL',[util[_0x78aa('0x55')](_0x78aa('0xdb'),_0x46cef5),_0x15996f[_0x78aa('0x69')],_0x15996f['opts'],_0x15996f[_0x78aa('0x68')]]);if(_0x3506a6[_0x78aa('0xa2')]===-0x1){return _0x3506a6;}return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xdc'),_0x78aa('0xdd')));};AGIVertices[_0x78aa('0x14')][_0x78aa('0xde')]=function(_0x48ce79){logger['info'](util[_0x78aa('0x55')](_0x78aa('0xdf'),_0x48ce79[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x48ce79[_0x78aa('0x7d')])){return this[_0x78aa('0x11')]['noop'](_0x78aa('0xe0'));}if(!this[_0x78aa('0xa3')](_0x48ce79[_0x78aa('0x5e')])){return this['channel'][_0x78aa('0xa6')](_0x78aa('0xa7'));}this['channel'][_0x78aa('0xe1')]=!![];this[_0x78aa('0x3c')](_0x48ce79);this[_0x78aa('0xe2')](_0x48ce79[_0x78aa('0x5e')],'in','','');this['channel']['noop'](util[_0x78aa('0x55')](_0x78aa('0xe3'),_0x48ce79['text']));var _0x495d54=this[_0x78aa('0xe4')][_0x78aa('0x73')](this,_0x48ce79);if(_0x495d54){for(var _0x449846 in _0x495d54){if(_0x495d54[_0x78aa('0x94')](_0x449846)){this['channel'][_0x78aa('0x9e')](util['format'](_0x78aa('0xe5'),_0x449846['toUpperCase']()),_0x495d54[_0x449846]);}}this[_0x78aa('0xe2')](_0x495d54[_0x78aa('0xe6')],_0x78aa('0xe7'),_0x78aa('0xde'),'');return this[_0x78aa('0x11')][_0x78aa('0xa6')](util['format'](_0x78aa('0xe8'),_0x495d54['speech']));}return this['channel'][_0x78aa('0x38')](_0x48ce79,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x78aa('0x14')][_0x78aa('0xe9')]=function(_0x21306c){logger['info'](util['format'](_0x78aa('0xea'),_0x21306c[_0x78aa('0x3d')]));if(!this['isConfigured'](_0x21306c[_0x78aa('0xeb')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0xec'));}if(!this[_0x78aa('0xa3')](_0x21306c[_0x78aa('0x7f')])){return this[_0x78aa('0x11')]['noop'](_0x78aa('0xed'));}if(!this['isConfigured'](_0x21306c[_0x78aa('0xee')])){return this[_0x78aa('0x11')]['noop']('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x21306c[_0x78aa('0xef')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0xf0'));}if(!this['isConfigured'](_0x21306c[_0x78aa('0x5e')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0xa7'));}this[_0x78aa('0x11')][_0x78aa('0xe1')]=!![];this[_0x78aa('0x3c')](_0x21306c);this['createSquareMessage'](_0x21306c[_0x78aa('0x5e')],'in','','');this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xf1'),_0x21306c['text']));var _0x3efc21=this[_0x78aa('0x7e')][_0x78aa('0x73')](this,_0x21306c);if(_0x3efc21){for(var _0xe0d5cc in _0x3efc21){if(_0x3efc21[_0x78aa('0x94')](_0xe0d5cc)){if(_0xe0d5cc!==_0x78aa('0xf2')){this[_0x78aa('0x11')]['setVariable'](util['format']('DIALOGFLOW_%s',_0xe0d5cc[_0x78aa('0xf3')]()),_0x3efc21[_0xe0d5cc]);}}}this[_0x78aa('0xe2')](_0x3efc21[_0x78aa('0xe6')],'out',_0x78aa('0xe9'),_0x3efc21['providerResponse']);return this[_0x78aa('0x11')][_0x78aa('0xa6')](util['format'](_0x78aa('0xf4'),_0x3efc21['speech']));}return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x21306c,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x78aa('0x14')][_0x78aa('0xf5')]=function(_0x304271){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0xf6'),_0x304271[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x304271[_0x78aa('0xf7')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0xf8'));}if(!this[_0x78aa('0xa3')](_0x304271[_0x78aa('0xf9')])){return this['channel'][_0x78aa('0xa6')](_0x78aa('0xfa'));}if(!this['isConfigured'](_0x304271['password'])){return this['channel'][_0x78aa('0xa6')](_0x78aa('0xfb'));}if(!this[_0x78aa('0xa3')](_0x304271[_0x78aa('0xfc')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')]('no\x20text\x20configured');}this[_0x78aa('0x11')][_0x78aa('0xe1')]=!![];this[_0x78aa('0x3c')](_0x304271);this['createSquareMessage'](_0x304271[_0x78aa('0x5e')],'in','','');this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xfd'),_0x304271['text']));var _0x48c29d=this['sestekNDA'][_0x78aa('0x73')](this,_0x304271);if(_0x48c29d){for(var _0x274116 in _0x48c29d){if(_0x48c29d[_0x78aa('0x94')](_0x274116)){this[_0x78aa('0x11')][_0x78aa('0x9e')](util[_0x78aa('0x55')](_0x78aa('0xfe'),_0x274116[_0x78aa('0xf3')]()),_0x48c29d[_0x274116]);}}this['createSquareMessage'](_0x48c29d[_0x78aa('0xe6')],_0x78aa('0xe7'),_0x78aa('0xf5'),'');if(_0x48c29d[_0x78aa('0xff')]){this['channel'][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x100'),_0x48c29d[_0x78aa('0xff')]));var _0x1024fc=this['channel'][_0x78aa('0x101')](_0x48c29d[_0x78aa('0xff')]);try{fs[_0x78aa('0x102')](_0x48c29d['audiofile']+'.wav');}catch(_0x21b29c){logger[_0x78aa('0x38')](_0x21b29c);}return _0x1024fc;}else{return this['channel']['noop'](util[_0x78aa('0x55')](_0x78aa('0x103'),_0x48c29d[_0x78aa('0xe6')]));}}return this[_0x78aa('0x11')]['error'](_0x304271,_0x78aa('0x104'));};AGIVertices[_0x78aa('0x14')][_0x78aa('0x105')]=function(_0x5f03e2){logger[_0x78aa('0x33')](util[_0x78aa('0x55')]('Enter\x20in\x20END\x20(%s)\x20block',_0x5f03e2[_0x78aa('0x3d')]));return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x105'));};AGIVertices[_0x78aa('0x14')]['ext_dial']=function(_0x44357d){logger['info'](util['format'](_0x78aa('0x106'),_0x44357d[_0x78aa('0x3d')]));var _0x5a61e1='';if(_0x44357d[_0x78aa('0x107')]){if(!this['isConfigured'](_0x44357d[_0x78aa('0x107')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x44357d,'no\x20trunk\x20selected');}else{var _0x4c8f2c=parseInt(_0x44357d['trunk_id'],0xa);if(isNaN(_0x4c8f2c)){_0x5a61e1=_0x44357d[_0x78aa('0x107')];}else{_0x5a61e1=this['getTrunk'][_0x78aa('0x73')](this,_0x44357d[_0x78aa('0x107')]);if(!_0x5a61e1){return this['channel'][_0x78aa('0x38')](_0x44357d,_0x78aa('0x108'));}}}}else if(_0x44357d[_0x78aa('0x109')]){_0x5a61e1=_0x44357d[_0x78aa('0x109')];}else{return this[_0x78aa('0x11')]['error'](_0x44357d,'no\x20trunk\x20selected');}var _0x20e91c=this[_0x78aa('0x11')][_0x78aa('0x58')](_0x78aa('0xdd'),[util['format'](_0x78aa('0x10a'),_0x5a61e1,_0x44357d[_0x78aa('0xbc')]),_0x44357d[_0x78aa('0x69')],_0x44357d[_0x78aa('0x10b')],_0x44357d['url']]);if(_0x20e91c[_0x78aa('0xa2')]===-0x1){return _0x20e91c;}return this[_0x78aa('0x11')][_0x78aa('0xa6')](util['format'](_0x78aa('0xdc'),_0x78aa('0xdd')));};AGIVertices[_0x78aa('0x14')]['finally']=function(_0x5f2d5f){logger[_0x78aa('0x33')](util['format'](_0x78aa('0x10c'),_0x5f2d5f[_0x78aa('0x3d')]));return this[_0x78aa('0x11')]['noop'](_0x78aa('0x10d'));};AGIVertices['prototype'][_0x78aa('0xf')]=function(_0x508e25){logger['info'](util[_0x78aa('0x55')](_0x78aa('0x10e'),_0x508e25[_0x78aa('0x3d')]));if(_0x508e25['retry']===0x0){return this[_0x78aa('0xa4')](_0x508e25);}_0x508e25[_0x78aa('0x10f')]-=0x1;if(!this[_0x78aa('0xa3')](_0x508e25[_0x78aa('0x110')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x508e25,_0x78aa('0x111'));}var _0x568545=this[_0x78aa('0x24')][_0x78aa('0x73')](this,_0x508e25[_0x78aa('0x110')]);if(!_0x568545){return this['channel']['error'](_0x508e25,_0x78aa('0x112'));}if(!this[_0x78aa('0xa3')](_0x508e25['variable_id'])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x78aa('0xcf'));}var _0x33b371=this[_0x78aa('0x11')][_0x78aa('0x113')](_0x568545,_0x508e25['response'],_0x508e25[_0x78aa('0x114')]);var _0x42d896=_0x33b371[_0x78aa('0xa2')]?_0x33b371[_0x78aa('0xa2')][_0x78aa('0x4d')]():'';logger[_0x78aa('0x33')](_0x78aa('0x115'),JSON[_0x78aa('0x77')](_0x33b371));if(_0x33b371[_0x78aa('0xa2')]===-0x1){this['createSquareDetailsReport'][_0x78aa('0x73')](this,_0x508e25,_0x42d896);return _0x33b371;}else if(_0x33b371[_0x78aa('0xa1')]===_0x78aa('0x69')){_0x33b371[_0x78aa('0xa2')]=_0x42d896[_0x78aa('0x9a')]>=parseInt(_0x508e25['mindigit'])?'x':'i';}else{_0x33b371[_0x78aa('0xa2')]=_0x42d896['length']>=parseInt(_0x508e25[_0x78aa('0x116')])&&_0x42d896[_0x78aa('0x9a')]<=parseInt(_0x508e25[_0x78aa('0x114')])?'x':'i';}var _0x3fc83b=this[_0x78aa('0x15')][_0x78aa('0x73')](this,_0x508e25[_0x78aa('0xce')]);if(!_0x3fc83b){return this['channel'][_0x78aa('0x38')](_0x508e25,_0x78aa('0xd0'));}this[_0x78aa('0x11')][_0x78aa('0x9e')](_0x3fc83b,_0x42d896);if(this[_0x78aa('0xa3')](_0x508e25[_0x78aa('0x117')])){var _0x21f8d2=parseInt(_0x508e25[_0x78aa('0x117')],0xa);var _0x1139fa=rs['generate']({'charset':'*','length':_0x21f8d2});var _0x5567da=_0x42d896[_0x78aa('0x9a')];if(_0x5567da>0x0){if(_0x5567da>_0x21f8d2){this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0x508e25,_0x508e25[_0x78aa('0x118')]===_0x78aa('0x119')?_0x1139fa+_0x42d896[_0x78aa('0x11a')](_0x21f8d2):_0x42d896[_0x78aa('0x11a')](0x0,_0x5567da-_0x21f8d2)+_0x1139fa);}else{this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0x508e25,rs['generate']({'charset':'*','length':_0x5567da}));}}else{this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0x508e25,'');}}else{this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0x508e25,_0x42d896);}return _0x33b371;};AGIVertices['prototype'][_0x78aa('0x10')]=function(_0x2e2434){logger['info'](util[_0x78aa('0x55')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x2e2434[_0x78aa('0x3d')]));return this[_0x78aa('0xf')](_0x2e2434);};AGIVertices[_0x78aa('0x14')][_0x78aa('0x11b')]=function(_0x35effc){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x11c'),_0x35effc[_0x78aa('0x3d')]));this[_0x78aa('0x3c')]['sync'](this,_0x35effc,_0x35effc[_0x78aa('0x11d')]);return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x11e'),_0x35effc[_0x78aa('0x11d')]));};AGIVertices['prototype']['awspolly']=function(_0x2c41a6){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x11f'),_0x2c41a6['label']));if(!this[_0x78aa('0xa3')](_0x2c41a6['aws_access_key_id'])||!this[_0x78aa('0xa3')](_0x2c41a6[_0x78aa('0x87')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x120'));}if(!this[_0x78aa('0xa3')](_0x2c41a6[_0x78aa('0x5e')])){return this[_0x78aa('0x11')]['noop'](_0x78aa('0xa7'));}this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x121'),_0x2c41a6[_0x78aa('0x5e')]));var _0xeef03c=this[_0x78aa('0x86')]['sync'](this,_0x2c41a6);if(_0xeef03c){this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x122'),_0xeef03c));var _0x7cd2d=this[_0x78aa('0x11')][_0x78aa('0x101')](_0xeef03c);try{fs[_0x78aa('0x102')](_0xeef03c+'.wav');}catch(_0x1a3c38){logger[_0x78aa('0x38')](_0x1a3c38);}return _0x7cd2d;}return this[_0x78aa('0x11')]['error'](_0x2c41a6,_0x78aa('0x123'));};AGIVertices[_0x78aa('0x14')][_0x78aa('0x124')]=function(_0x1a7349){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x125'),_0x1a7349['label']));if(!this[_0x78aa('0xa3')](_0x1a7349[_0x78aa('0x126')])||!this['isConfigured'](_0x1a7349[_0x78aa('0x87')])){return this['channel']['noop'](_0x78aa('0x120'));}if(!this[_0x78aa('0xa3')](_0x1a7349['aws_bot_name'])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x127'));}if(!this['isConfigured'](_0x1a7349['text'])){return this['channel'][_0x78aa('0xa6')](_0x78aa('0xa7'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x1a7349);this[_0x78aa('0xe2')](_0x1a7349['text'],'in','','');this['channel'][_0x78aa('0xa6')](util[_0x78aa('0x55')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1a7349['text']));var _0x334933=this[_0x78aa('0x8b')][_0x78aa('0x73')](this,_0x1a7349);if(_0x334933){for(var _0x1d5762 in _0x334933){if(_0x334933[_0x78aa('0x94')](_0x1d5762)&&_[_0x78aa('0x95')](_0x334933[_0x1d5762])){this[_0x78aa('0x11')][_0x78aa('0x9e')](util['format']('AWS_LEX_%s',_0x1d5762[_0x78aa('0xf3')]()),_0x334933[_0x1d5762]);}}if(_[_0x78aa('0x48')](_0x334933[_0x78aa('0x7b')])){return this['channel']['noop'](_0x78aa('0x128'));}else{this[_0x78aa('0xe2')](_0x334933[_0x78aa('0x7b')],_0x78aa('0xe7'),'amazonlex','');return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x129'),_0x334933['message']));}}return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x1a7349,_0x78aa('0x12a'));};AGIVertices[_0x78aa('0x14')]['googleasr']=function(_0x2d1147){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x12b'),_0x2d1147[_0x78aa('0x3d')],_0x2d1147[_0x78aa('0x69')]));if(!this[_0x78aa('0xa3')](_0x2d1147['key'])){return this[_0x78aa('0x11')][_0x78aa('0xa6')]('no\x20key\x20configured');}var _0x34964d=_0x78aa('0x12c');var _0x2f830f=util[_0x78aa('0x55')](_0x78aa('0x12d'),FILES_PATH,rs[_0x78aa('0x12e')](0x4));var _0x11b725=util['format'](_0x78aa('0x9c'),_0x2f830f,_0x34964d);var _0x59007c=!![];if(_0x2d1147[_0x78aa('0x12f')]===_0x78aa('0x130')){_0x59007c=![];}var _0x3bb318=this[_0x78aa('0x11')][_0x78aa('0x131')](_0x2f830f,_0x34964d,_0x2d1147[_0x78aa('0x132')],_0x2d1147[_0x78aa('0x69')],undefined,_0x59007c);if(_0x3bb318['result']!==-0x1){this[_0x78aa('0x11')]['noop'](util['format'](_0x78aa('0x133'),_0x11b725));var _0x2a298a=this['googleASR']['sync'](this,_0x2d1147,_0x11b725);if(_0x2a298a){for(var _0x23db99 in _0x2a298a){if(_0x2a298a[_0x78aa('0x94')](_0x23db99)){this[_0x78aa('0x11')]['setVariable'](util[_0x78aa('0x55')](_0x78aa('0x134'),_0x23db99[_0x78aa('0xf3')]()),_0x2a298a[_0x23db99]);}}return this[_0x78aa('0x11')][_0x78aa('0xa6')](util['format'](_0x78aa('0x135'),JSON[_0x78aa('0x77')](_0x2a298a)));}}return _0x3bb318;};AGIVertices[_0x78aa('0x14')][_0x78aa('0x136')]=function(_0x310493){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x137'),_0x310493[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x310493['appid'])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x138'));}if(!this['isConfigured'](_0x310493['appsecret'])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x139'));}var _0x226a0d='wav';var _0x46ea69=util[_0x78aa('0x55')](_0x78aa('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x5e293f=util[_0x78aa('0x55')](_0x78aa('0x9c'),_0x46ea69,_0x226a0d);var _0x46315b=!![];if(_0x310493[_0x78aa('0x12f')]===_0x78aa('0x130')){_0x46315b=![];}var _0x48de3c=this['channel'][_0x78aa('0x131')](_0x46ea69,_0x226a0d,_0x310493[_0x78aa('0x132')],_0x310493['timeout'],undefined,_0x46315b);if(_0x48de3c[_0x78aa('0xa2')]!==-0x1){this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x13a'),_0x5e293f));var _0xbce895=this['tildeASR'][_0x78aa('0x73')](this,_0x310493,_0x5e293f);if(_0xbce895){for(var _0x4925e7 in _0xbce895){if(_0xbce895[_0x78aa('0x94')](_0x4925e7)){this[_0x78aa('0x11')]['setVariable'](util[_0x78aa('0x55')](_0x78aa('0x13b'),_0x4925e7[_0x78aa('0xf3')]()),_0xbce895[_0x4925e7]);}}return this['channel'][_0x78aa('0xa6')](util['format'](_0x78aa('0x13c'),JSON['stringify'](_0xbce895)));}}return _0x48de3c;};AGIVertices['prototype'][_0x78aa('0x13d')]=function(_0x14e071){logger['info'](util['format'](_0x78aa('0x13e'),_0x14e071[_0x78aa('0x3d')]));return this[_0x78aa('0x11')]['continueAt'](_0x14e071[_0x78aa('0x13f')],_0x14e071[_0x78aa('0x41')],_0x14e071[_0x78aa('0x140')]);};AGIVertices[_0x78aa('0x14')][_0x78aa('0x141')]=function(_0x3a98b1){logger['info'](util[_0x78aa('0x55')](_0x78aa('0x142'),_0x3a98b1['label']));if(!this['isConfigured'](_0x3a98b1['condition'])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x3a98b1,_0x78aa('0x143'));}try{var _0x49974b=eval(_0x3a98b1[_0x78aa('0x144')])?_0x78aa('0x145'):_0x78aa('0x146');this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3a98b1['condition'],_0x49974b));return{'code':0xc8,'result':_0x49974b};}catch(_0x19161f){return{'code':0xc8,'result':_0x78aa('0x146')};}};AGIVertices[_0x78aa('0x14')][_0x78aa('0x147')]=function(_0x4038b3){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x148'),_0x4038b3[_0x78aa('0x3d')]));if(!this['isConfigured'](_0x4038b3[_0x78aa('0x149')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x4038b3,_0x78aa('0x14a'));}var _0x2b7aff=this[_0x78aa('0x2a')]['sync'](this,_0x4038b3[_0x78aa('0x149')]);if(!_0x2b7aff){return this['channel'][_0x78aa('0x38')](_0x4038b3,_0x78aa('0x14b'));}for(var _0x27d071=0x0;_0x27d071<_0x2b7aff[_0x78aa('0x9a')];_0x27d071+=0x1){var _0x3aa595=this[_0x78aa('0x11')]['getVariable'](util[_0x78aa('0x55')](_0x78aa('0x14c'),_0x2b7aff[_0x27d071]));if(_0x3aa595['result']===-0x1){return _0x3aa595;}logger['info'](util[_0x78aa('0x55')](_0x78aa('0x14d'),_0x2b7aff[_0x27d071],_0x3aa595['extra']));if(_0x3aa595['extra']===_0x78aa('0x145')){logger['info'](util[_0x78aa('0x55')](_0x78aa('0x14d'),_0x2b7aff[_0x27d071],_0x78aa('0x145')));this['channel']['noop'](util['format'](_0x78aa('0x14d'),_0x2b7aff[_0x27d071],_0x78aa('0x145')));return{'code':0xc8,'result':_0x78aa('0x145')};}else{logger['info'](util[_0x78aa('0x55')](_0x78aa('0x14d'),_0x2b7aff[_0x27d071],_0x78aa('0x146')));this['channel'][_0x78aa('0xa6')](util['format'](_0x78aa('0x14d'),_0x2b7aff[_0x27d071],'false'));}}return{'code':0xc8,'result':_0x78aa('0x146')};};AGIVertices[_0x78aa('0x14')][_0x78aa('0x14e')]=function(_0x2a47ad){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x14f'),_0x2a47ad[_0x78aa('0x3d')]));return this['channel'][_0x78aa('0x14e')]();};AGIVertices[_0x78aa('0x14')]['ispeechasr']=function(_0x4ec0a6){logger[_0x78aa('0x33')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x4ec0a6[_0x78aa('0x3d')]));if(!this['isConfigured'](_0x4ec0a6[_0x78aa('0x7d')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0xe0'));}var _0x50805b='wav';var _0x196b84=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x78aa('0x12e')](0x4));var _0x355e00=util[_0x78aa('0x55')](_0x78aa('0x9c'),_0x196b84,_0x50805b);var _0x56c512=!![];if(_0x4ec0a6[_0x78aa('0x12f')]===_0x78aa('0x130')){_0x56c512=![];}var _0x3dcce2=this[_0x78aa('0x11')]['recordFile'](_0x196b84,_0x50805b,_0x4ec0a6['intKey'],_0x4ec0a6['timeout'],undefined,_0x56c512);if(_0x3dcce2[_0x78aa('0xa2')]!==-0x1){this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x150'),_0x355e00));var _0x5bda98=this[_0x78aa('0x84')][_0x78aa('0x73')](this,_0x4ec0a6,_0x355e00);if(_0x5bda98){for(var _0x135dde in _0x5bda98){if(_0x5bda98[_0x78aa('0x94')](_0x135dde)){this['channel'][_0x78aa('0x9e')](util[_0x78aa('0x55')](_0x78aa('0x151'),_0x135dde[_0x78aa('0xf3')]()),_0x5bda98[_0x135dde]);}}return this['channel'][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x152'),JSON['stringify'](_0x5bda98)));}}return _0x3dcce2;};AGIVertices[_0x78aa('0x14')]['ispeechtts']=function(_0x2358cd){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x153'),_0x2358cd[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x2358cd[_0x78aa('0x7d')])){return this['channel'][_0x78aa('0xa6')](_0x78aa('0xe0'));}if(!this[_0x78aa('0xa3')](_0x2358cd[_0x78aa('0x5e')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0xa7'));}this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')]('Trying\x20ispeech\x20TTS\x20%s',_0x2358cd[_0x78aa('0x5e')]));var _0x230651=this[_0x78aa('0x81')][_0x78aa('0x73')](this,_0x2358cd);if(_0x230651){this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x150'),_0x230651));var _0x874034=this['channel'][_0x78aa('0x101')](_0x230651,_0x2358cd[_0x78aa('0x132')]);try{fs[_0x78aa('0x102')](_0x230651+_0x78aa('0x154'));}catch(_0x4ba548){logger[_0x78aa('0x38')](_0x4ba548);}return _0x874034;}return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x2358cd,_0x78aa('0x155'));};AGIVertices['prototype'][_0x78aa('0x156')]=function(_0x38cce8){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x157'),_0x38cce8[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x38cce8[_0x78aa('0x158')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x38cce8,_0x78aa('0x159'));}logger[_0x78aa('0x33')](util[_0x78aa('0x55')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x78aa('0x11')][_0x78aa('0x40')],_0x38cce8[_0x78aa('0x158')]));var _0x32d39c=this['agentLogin']['sync'](this,_0x38cce8['findBy']);if(_0x32d39c){logger['info'](util[_0x78aa('0x55')](_0x78aa('0x15a'),this[_0x78aa('0x11')]['callerid'],_0x38cce8[_0x78aa('0x158')]));this[_0x78aa('0x11')][_0x78aa('0xa6')](util['format'](_0x78aa('0x15a'),this[_0x78aa('0x11')]['callerid'],_0x38cce8['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x78aa('0x33')](util['format'](_0x78aa('0x15b'),this[_0x78aa('0x11')][_0x78aa('0x40')],_0x38cce8[_0x78aa('0x158')]));this['channel'][_0x78aa('0xa6')](util['format'](_0x78aa('0x15b'),this[_0x78aa('0x11')][_0x78aa('0x40')],_0x38cce8['findBy']));return{'code':0xc8,'result':_0x78aa('0x15c')};}};AGIVertices[_0x78aa('0x14')][_0x78aa('0x15d')]=function(_0x4904a4){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x15e'),_0x4904a4['label']));if(!this[_0x78aa('0xa3')](_0x4904a4[_0x78aa('0x158')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x4904a4,_0x78aa('0x159'));}logger['info'](util[_0x78aa('0x55')](_0x78aa('0x15f'),this[_0x78aa('0x11')]['callerid'],_0x4904a4[_0x78aa('0x158')]));var _0x4dea74=this[_0x78aa('0x52')][_0x78aa('0x73')](this,_0x4904a4[_0x78aa('0x158')]);if(_0x4dea74){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x15a'),this[_0x78aa('0x11')]['callerid'],_0x4904a4[_0x78aa('0x158')]));this[_0x78aa('0x11')][_0x78aa('0xa6')](util['format'](_0x78aa('0x15a'),this[_0x78aa('0x11')]['callerid'],_0x4904a4[_0x78aa('0x158')]));return{'code':0xc8,'result':_0x78aa('0x160')};}else{logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x15b'),this[_0x78aa('0x11')][_0x78aa('0x40')],_0x4904a4['findBy']));this['channel']['noop'](util['format'](_0x78aa('0x15b'),this[_0x78aa('0x11')][_0x78aa('0x40')],_0x4904a4[_0x78aa('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x78aa('0x14')][_0x78aa('0x161')]=function(_0x342355){logger['info'](util[_0x78aa('0x55')](_0x78aa('0x162'),_0x342355['label']));if(!this['isConfigured'](_0x342355[_0x78aa('0x163')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x342355,_0x78aa('0x164'));}this['channel'][_0x78aa('0xa6')](util['format']('math\x20%s',_0x342355[_0x78aa('0x163')]));var _0x583f9b=eval(_0x342355[_0x78aa('0x163')]);if(!this['isConfigured'](_0x342355['variable_id'])){return this[_0x78aa('0x11')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x391e56=this['getVariable'][_0x78aa('0x73')](this,_0x342355[_0x78aa('0xce')]);if(!_0x391e56){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x342355,_0x78aa('0xd0'));}if(_[_0x78aa('0x9d')](_0x583f9b)){var _0x98901b=this;_0x583f9b[_0x78aa('0x165')](function(_0x766b11,_0x3df9fb){_0x98901b['channel']['setVariable'](util[_0x78aa('0x55')](_0x78aa('0x166'),_0x391e56,_0x3df9fb),_0x766b11);});return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')]('variable\x20%s[key]\x20set',_0x391e56));}else{return this[_0x78aa('0x11')][_0x78aa('0x9e')](_0x391e56,_0x583f9b);}};AGIVertices[_0x78aa('0x14')]['menu']=function(_0x1038b3){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x167'),_0x1038b3[_0x78aa('0x3d')]));if(_0x1038b3[_0x78aa('0x10f')]===0x0){return this[_0x78aa('0xa4')](_0x1038b3);}_0x1038b3['retry']-=0x1;if(!this[_0x78aa('0xa3')](_0x1038b3[_0x78aa('0x110')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x1038b3,_0x78aa('0x111'));}var _0x225e68=this[_0x78aa('0x24')][_0x78aa('0x73')](this,_0x1038b3[_0x78aa('0x110')]);if(!_0x225e68){return this['channel']['error'](_0x1038b3,_0x78aa('0x112'));}var _0x1595e4=this['channel'][_0x78aa('0x113')](_0x225e68,_0x1038b3['response'],_0x1038b3[_0x78aa('0x168')]);var _0x552062=_0x1595e4[_0x78aa('0xa2')];if(_0x1595e4[_0x78aa('0xa2')]===-0x1){this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0x1038b3,'-1');return _0x1595e4;}else if(_0x1595e4[_0x78aa('0xa1')]===_0x78aa('0x69')){_0x1595e4[_0x78aa('0xa2')]=_0x1595e4['result'][_0x78aa('0x9a')]>0x0?_0x1595e4[_0x78aa('0xa2')]:'t';}else if(_[_0x78aa('0x45')](_0x1595e4[_0x78aa('0xa2')])){_0x1595e4[_0x78aa('0xa2')]='#';_0x552062='#';}if(!this[_0x78aa('0xa3')](_0x1038b3[_0x78aa('0xce')])){this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0xcf'));}else{var _0x1e6bcc=this[_0x78aa('0x15')]['sync'](this,_0x1038b3['variable_id']);if(!_0x1e6bcc){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x1038b3,_0x78aa('0xd0'));}this[_0x78aa('0x11')]['setVariable'](_0x1e6bcc,_0x552062);}this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0x1038b3,_0x552062);return _0x1595e4;};AGIVertices[_0x78aa('0x14')][_0x78aa('0xa6')]=function(_0x5158b7){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x169'),_0x5158b7['label']));return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x5158b7[_0x78aa('0x16a')]||_0x5158b7[_0x78aa('0x3d')]);};AGIVertices['prototype'][_0x78aa('0x16b')]=function(_0x27c2a0){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x16c'),_0x27c2a0[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x27c2a0['findBy'])){return this['channel'][_0x78aa('0x38')](_0x27c2a0,_0x78aa('0x159'));}logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x15f'),this['channel'][_0x78aa('0x40')],_0x27c2a0['findBy']));var _0x4c510c=this[_0x78aa('0x16d')][_0x78aa('0x73')](this,_0x27c2a0['pause_id']);var _0x5fea9d=this[_0x78aa('0x4f')][_0x78aa('0x73')](this,_0x27c2a0[_0x78aa('0x158')],_0x4c510c);if(_0x5fea9d){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x15a'),this[_0x78aa('0x11')][_0x78aa('0x40')],_0x27c2a0[_0x78aa('0x158')]));this[_0x78aa('0x11')][_0x78aa('0xa6')](util['format'](_0x78aa('0x15a'),this[_0x78aa('0x11')]['callerid'],_0x27c2a0[_0x78aa('0x158')]));return{'code':0xc8,'result':_0x78aa('0x160')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x78aa('0x11')][_0x78aa('0x40')],_0x27c2a0[_0x78aa('0x158')]));this['channel'][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x15a'),this[_0x78aa('0x11')]['callerid'],_0x27c2a0['findBy']));return{'code':0xc8,'result':_0x78aa('0x15c')};}};AGIVertices[_0x78aa('0x14')][_0x78aa('0x16e')]=function(_0x30d532){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x16f'),_0x30d532[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x30d532[_0x78aa('0x110')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x30d532,_0x78aa('0x111'));}var _0xf0a502=this[_0x78aa('0x24')][_0x78aa('0x73')](this,_0x30d532[_0x78aa('0x110')]);if(!_0xf0a502){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x30d532,_0x78aa('0x112'));}var _0x35f004=this['channel']['exec']('PLAYBACK',[_0xf0a502,_0x30d532[_0x78aa('0x10b')]]);if(_0x35f004[_0x78aa('0xa2')]===-0x1){return _0x35f004;}return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xbf'),_0x78aa('0x170'),_0xf0a502));};AGIVertices['prototype']['queue']=function(_0x29ead2){logger[_0x78aa('0x33')](util[_0x78aa('0x55')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x29ead2[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x29ead2['queue_id'])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x29ead2,_0x78aa('0x171'));}var _0x34bcd8='';var _0x52f060=parseInt(_0x29ead2[_0x78aa('0x172')],0xa);if(isNaN(_0x52f060)){_0x34bcd8=_0x29ead2[_0x78aa('0x172')];}else{_0x34bcd8=this['getVoiceQueue'][_0x78aa('0x73')](this,_0x29ead2[_0x78aa('0x172')]);if(!_0x34bcd8){return this['channel'][_0x78aa('0x38')](_0x29ead2,'no\x20queue\x20found');}}var _0x2983b4='';if(this[_0x78aa('0xa3')](_0x29ead2[_0x78aa('0x110')])){var _0x3d36df=this[_0x78aa('0x24')][_0x78aa('0x73')](this,_0x29ead2['file_id']);if(_0x3d36df){_0x2983b4=_0x3d36df;}}this['createSquareDetailsReport'][_0x78aa('0x73')](this,_0x29ead2,_0x34bcd8);if(_0x29ead2[_0x78aa('0x10b')]['indexOf']('x')<0x0){_0x29ead2[_0x78aa('0x10b')]+='x';}if(_0x29ead2['opts'][_0x78aa('0x173')]('X')<0x0){_0x29ead2[_0x78aa('0x10b')]+='X';}this['channel'][_0x78aa('0x9e')](_0x78aa('0x174'),_0x34bcd8?_0x34bcd8[_0x78aa('0x175')]():'');var _0x4ef8f4=this[_0x78aa('0x11')][_0x78aa('0x58')](_0x78aa('0x176'),[_0x34bcd8,_0x29ead2[_0x78aa('0x10b')],_0x29ead2['url'],_0x2983b4,_0x29ead2[_0x78aa('0x69')],_0x29ead2[_0x78aa('0x7')],_0x29ead2[_0x78aa('0x177')],_0x29ead2[_0x78aa('0x178')],'',_0x29ead2[_0x78aa('0x179')]]);if(_0x4ef8f4[_0x78aa('0xa2')]===-0x1){return _0x4ef8f4;}return this['channel'][_0x78aa('0xa6')](util['format']('Executed\x20command\x20%s\x20%s',_0x78aa('0x176'),_0x34bcd8));};AGIVertices[_0x78aa('0x14')][_0x78aa('0x17a')]=function(_0x121919){logger[_0x78aa('0x33')](util['format'](_0x78aa('0x17b'),_0x121919['label']));var _0x239789=_0x121919[_0x78aa('0x17c')]||_0x78aa('0x12c');var _0x4bbf80=util[_0x78aa('0x55')](_0x78aa('0x17d'),this[_0x78aa('0x11')][_0x78aa('0x43')],rs[_0x78aa('0x12e')](0x5));var _0x1f82c8=util['format'](_0x78aa('0x17e'),FILES_PATH,_0x4bbf80,_0x239789);var _0x1e47bd=util[_0x78aa('0x55')](_0x78aa('0x12d'),FILES_PATH,_0x4bbf80);this['createSquareRecording'][_0x78aa('0x73')](this,_0x121919,_0x4bbf80,_0x1f82c8);this['channel'][_0x78aa('0x9e')]('RECORDING_SAVENAME',_0x4bbf80);logger[_0x78aa('0x33')](_0x78aa('0x17f'),_0x1e47bd,_0x239789,_0x121919['escape_digits'],_0x121919[_0x78aa('0x69')]);return this[_0x78aa('0x11')][_0x78aa('0x131')](_0x1e47bd,_0x239789,_0x121919['escape_digits'],_0x121919['timeout'],undefined,!![]);};AGIVertices[_0x78aa('0x14')][_0x78aa('0x180')]=function(_0xb3d86e){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x181'),_0xb3d86e[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0xb3d86e[_0x78aa('0x68')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x182'));}var _0x103991=this[_0x78aa('0x67')]['sync'](this,_0xb3d86e);logger[_0x78aa('0x33')](util[_0x78aa('0x55')]('Response:',util[_0x78aa('0x183')](_0x103991,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xb3d86e[_0x78aa('0xce')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x184'));}var _0x5b1f14=this[_0x78aa('0x15')][_0x78aa('0x73')](this,_0xb3d86e[_0x78aa('0xce')]);if(!_0x5b1f14){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0xb3d86e,_0x78aa('0xd0'));}this[_0x78aa('0x11')]['setVariable'](util['format'](_0x78aa('0x185'),_0x5b1f14),_0x103991['statusCode']?_0x103991[_0x78aa('0x79')]:'200');this['channel'][_0x78aa('0x9e')](util[_0x78aa('0x55')](_0x78aa('0x186'),_0x5b1f14),_0x103991['statusMessage']?_0x103991[_0x78aa('0x7a')]:'OK');if(_0x103991[_0x78aa('0x6e')]){try{this[_0x78aa('0x9b')](_0x103991['body'],_0x5b1f14);}catch(_0x132a4b){logger['error'](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x5b1f14));}}return this[_0x78aa('0x11')]['noop'](util[_0x78aa('0x55')](_0x78aa('0xd4'),_0x5b1f14));};AGIVertices['prototype']['saydigits']=function(_0x993006){logger['info'](util[_0x78aa('0x55')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x993006['label']));return this[_0x78aa('0x11')][_0x78aa('0x187')](_0x993006[_0x78aa('0x188')][_0x78aa('0x5a')](/\s+/g,''),_0x993006[_0x78aa('0x189')]);};AGIVertices['prototype'][_0x78aa('0x18a')]=function(_0x3d69d9){logger[_0x78aa('0x33')](util[_0x78aa('0x55')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x3d69d9[_0x78aa('0x3d')]));return this['channel'][_0x78aa('0x18b')](_0x3d69d9[_0x78aa('0x6a')]['replace'](/\s+/g,''),_0x3d69d9[_0x78aa('0x189')]);};AGIVertices[_0x78aa('0x14')][_0x78aa('0x18c')]=function(_0x3aa75b){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x18d'),_0x3aa75b[_0x78aa('0x3d')]));return this['channel'][_0x78aa('0x18e')](_0x3aa75b['text'],_0x3aa75b[_0x78aa('0x189')]);};AGIVertices['prototype'][_0x78aa('0x18f')]=function(_0x4f59d9){logger['info'](util[_0x78aa('0x55')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4f59d9[_0x78aa('0x3d')]));if(!this['isConfigured'](_0x4f59d9[_0x78aa('0x190')])){return this['channel'][_0x78aa('0xa6')]('no\x20mail\x20account\x20configured');}var _0x5a9797=this[_0x78aa('0x191')][_0x78aa('0x73')](this,_0x4f59d9[_0x78aa('0x190')]);if(!_0x5a9797||!_0x5a9797[_0x78aa('0x192')]){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x4f59d9,_0x78aa('0x193'));}var _0x29dea5={'from':util[_0x78aa('0x55')](_0x78aa('0x194'),_0x5a9797['name'],_0x5a9797[_0x78aa('0x195')]||_0x5a9797[_0x78aa('0x192')][_0x78aa('0x196')]),'to':_0x4f59d9['to']||'','cc':_0x4f59d9['cc']||'','bcc':_0x4f59d9[_0x78aa('0x197')]||'','subject':_0x4f59d9['subject'],'html':_0x4f59d9[_0x78aa('0x5e')],'text':_0x4f59d9['text']};if(this[_0x78aa('0xa3')](_0x4f59d9['template_id'])){}logger['debug']('sendMail\x20message',JSON[_0x78aa('0x77')](_0x29dea5));this[_0x78aa('0x3c')]['sync'](this,_0x4f59d9,_0x4f59d9[_0x78aa('0x190')]);this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x198'),_0x5a9797[_0x78aa('0x18')]));this[_0x78aa('0x29')][_0x78aa('0x73')](this,_0x5a9797[_0x78aa('0x199')],_0x29dea5);return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x19a'));};AGIVertices[_0x78aa('0x14')][_0x78aa('0x19b')]=function(_0x332d07){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x19c'),_0x332d07[_0x78aa('0x3d')]));return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x19d'));};AGIVertices[_0x78aa('0x14')][_0x78aa('0x19e')]=function(_0x3dda0a){logger[_0x78aa('0x33')](util[_0x78aa('0x55')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3dda0a[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x3dda0a[_0x78aa('0x19f')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x1a0'));}var _0x1c4f56=this[_0x78aa('0x3a')]['sync'](this,_0x3dda0a[_0x78aa('0x19f')]);if(!_0x1c4f56){return this['channel'][_0x78aa('0x38')](_0x3dda0a,_0x78aa('0x1a1'));}var _0x16f952={'body':_0x3dda0a[_0x78aa('0x1a2')],'phone':_0x3dda0a['to']||'','SmsAccountId':_0x1c4f56['id']};logger[_0x78aa('0xd6')]('sendSMS\x20message',JSON[_0x78aa('0x77')](_0x16f952));this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0x3dda0a,_0x3dda0a[_0x78aa('0x19f')]);this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x1a3'),_0x1c4f56[_0x78aa('0x18')]));this[_0x78aa('0x3b')][_0x78aa('0x73')](this,_0x16f952);return this['channel'][_0x78aa('0xa6')](_0x78aa('0x1a4'));};AGIVertices[_0x78aa('0x14')][_0x78aa('0x1a5')]=function(_0x3c55ec){logger['info'](util[_0x78aa('0x55')](_0x78aa('0x1a6'),_0x3c55ec[_0x78aa('0x3d')]));if(!this[_0x78aa('0xa3')](_0x3c55ec['variable_id'])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x3c55ec,'no\x20variable\x20selected');}var _0x45052b=this[_0x78aa('0x15')][_0x78aa('0x73')](this,_0x3c55ec[_0x78aa('0xce')]);if(!_0x45052b){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x3c55ec,_0x78aa('0xd0'));}return this['channel']['setVariable'](_0x45052b,_0x3c55ec[_0x78aa('0x1a7')]);};AGIVertices[_0x78aa('0x14')]['start']=function(_0x3a19a7){logger[_0x78aa('0x33')](util['format'](_0x78aa('0x1a8'),_0x3a19a7[_0x78aa('0x3d')]));this['channel']['noop']('START\x20CALLY\x20SQUARE');if(_0x3a19a7[_0x78aa('0xb6')]===_0x78aa('0x1a9')){this[_0x78aa('0x11')]['noop']('Answer');return this['channel'][_0x78aa('0xb6')]();}return this[_0x78aa('0x11')][_0x78aa('0xa6')]('Skipped\x20Answer');};AGIVertices[_0x78aa('0x14')][_0x78aa('0x1aa')]=function(_0x120c18){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x1ab'),_0x120c18[_0x78aa('0x3d')]));if(!this['isConfigured'](_0x120c18[_0x78aa('0x1ac')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x120c18,_0x78aa('0x1ad'));}var _0x279de2=this[_0x78aa('0x1c')][_0x78aa('0x73')](this,_0x120c18[_0x78aa('0x1ac')]);if(!this[_0x78aa('0xa3')](_0x279de2)){return this[_0x78aa('0x11')]['error'](_0x120c18,util[_0x78aa('0x55')](_0x78aa('0x1ae'),_0x120c18['project_id']));}if(_0x279de2===this[_0x78aa('0x11')][_0x78aa('0x3e')]){return this[_0x78aa('0x11')]['error'](_0x120c18,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0x120c18,_0x279de2);var _0x4c3b1c=this[_0x78aa('0x11')]['exec'](_0x78aa('0x1af'),util[_0x78aa('0x55')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x78aa('0x7')][_0x78aa('0x1b0')]||_0x78aa('0x1b1'),_0x279de2,this[_0x78aa('0x11')]['arg_1']));if(_0x4c3b1c['result']===-0x1){return _0x4c3b1c;}return this['channel'][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xbf'),_0x78aa('0x1af'),_0x279de2));};AGIVertices[_0x78aa('0x14')][_0x78aa('0x1b2')]=function(_0x29ec4d){logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x1b3'),_0x29ec4d[_0x78aa('0x3d')]));var _0x48aad9=this['shellCommand'][_0x78aa('0x73')](this,_0x29ec4d[_0x78aa('0xb4')]);this[_0x78aa('0x3c')][_0x78aa('0x73')](this,_0x29ec4d,_0x29ec4d[_0x78aa('0xb4')]);if(this['isConfigured'](_0x29ec4d['variable_id'])){var _0x3f08b2=this['getVariable']['sync'](this,_0x29ec4d[_0x78aa('0xce')]);if(_0x3f08b2){this[_0x78aa('0x11')]['setVariable'](_0x3f08b2,_0x48aad9);return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x1b4'),_0x29ec4d[_0x78aa('0xb4')],_0x3f08b2));}}return this['channel']['noop'](util['format'](_0x78aa('0x1b5'),_0x29ec4d[_0x78aa('0xb4')]));};AGIVertices[_0x78aa('0x14')][_0x78aa('0x1b6')]=function(_0x2dc55c){logger['info'](util[_0x78aa('0x55')](_0x78aa('0x1b7'),_0x2dc55c[_0x78aa('0x3d')]));_0x2dc55c[_0x78aa('0x5e')]=_0x2dc55c[_0x78aa('0x5e')][_0x78aa('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x78aa('0xa3')](_0x2dc55c[_0x78aa('0x5c')])){return this[_0x78aa('0x11')][_0x78aa('0xa6')](_0x78aa('0x1b8'));}if(!this['isConfigured'](_0x2dc55c['text'])){return this['channel'][_0x78aa('0xa6')](_0x78aa('0xa7'));}this[_0x78aa('0x11')]['noop'](util[_0x78aa('0x55')](_0x78aa('0x1b9'),_0x2dc55c[_0x78aa('0x5e')]));var _0x2fd52e=this[_0x78aa('0x5b')]['sync'](this,_0x2dc55c);if(_0x2fd52e){this[_0x78aa('0x11')][_0x78aa('0xa6')](util['format'](_0x78aa('0x1ba'),_0x2fd52e));var _0x2a6c0a=this[_0x78aa('0x11')][_0x78aa('0x101')](_0x2fd52e);try{fs['unlink'](_0x2fd52e+_0x78aa('0x154'));}catch(_0xd28784){logger[_0x78aa('0x38')](_0xd28784);}return _0x2a6c0a;}return this[_0x78aa('0x11')]['error'](_0x2dc55c,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x78aa('0x14')]['tts']=function(_0x456ab6){logger['info'](util['format'](_0x78aa('0x1bb'),_0x456ab6[_0x78aa('0x3d')]));_0x456ab6[_0x78aa('0x5e')]=_0x456ab6[_0x78aa('0x5e')][_0x78aa('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x78aa('0xa3')](_0x456ab6[_0x78aa('0x5e')])){return this['channel'][_0x78aa('0xa6')]('no\x20text\x20configured');}this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')]('Trying\x20Google\x20TTS\x20%s',_0x456ab6[_0x78aa('0x5e')]));var _0x439ac8=this[_0x78aa('0x65')][_0x78aa('0x73')](this,_0x456ab6);if(_0x439ac8){this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x1bc'),_0x439ac8));var _0xdf3e61=this[_0x78aa('0x11')][_0x78aa('0x101')](_0x439ac8);try{fs[_0x78aa('0x102')](_0x439ac8+_0x78aa('0x154'));}catch(_0x3349cd){logger['error'](_0x3349cd);}return _0xdf3e61;}return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x456ab6,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x78aa('0x14')][_0x78aa('0x1bd')]=function(_0x3f1f01){logger[_0x78aa('0x33')](util[_0x78aa('0x55')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3f1f01[_0x78aa('0x3d')]));if(!this['isConfigured'](_0x3f1f01[_0x78aa('0x158')])){return this[_0x78aa('0x11')]['error'](_0x3f1f01,_0x78aa('0x159'));}logger[_0x78aa('0x33')](util[_0x78aa('0x55')](_0x78aa('0x15f'),this[_0x78aa('0x11')][_0x78aa('0x40')],_0x3f1f01[_0x78aa('0x158')]));var _0x4a14fd=this[_0x78aa('0x51')][_0x78aa('0x73')](this,_0x3f1f01[_0x78aa('0x158')]);if(_0x4a14fd){logger[_0x78aa('0x33')](util['format'](_0x78aa('0x15a'),this[_0x78aa('0x11')]['callerid'],_0x3f1f01[_0x78aa('0x158')]));this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x78aa('0x11')][_0x78aa('0x40')],_0x3f1f01[_0x78aa('0x158')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x78aa('0x15b'),this[_0x78aa('0x11')][_0x78aa('0x40')],_0x3f1f01[_0x78aa('0x158')]));this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0x15b'),this[_0x78aa('0x11')]['callerid'],_0x3f1f01[_0x78aa('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x78aa('0x14')][_0x78aa('0x1be')]=function(_0x3b3bd1){logger['info'](util[_0x78aa('0x55')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x3b3bd1[_0x78aa('0x3d')]));var _0x24df5e=this[_0x78aa('0x11')]['exec']('VOICEMAIL',[_0x3b3bd1[_0x78aa('0x1bf')],_0x3b3bd1[_0x78aa('0x7c')]]);if(_0x24df5e['result']===-0x1){return _0x24df5e;}return this[_0x78aa('0x11')][_0x78aa('0xa6')](util[_0x78aa('0x55')](_0x78aa('0xbf'),_0x78aa('0x1c0'),_0x3b3bd1['mailbox']));};AGIVertices[_0x78aa('0x14')][_0x78aa('0x1c1')]=function(_0x2e0f58){logger['info'](util[_0x78aa('0x55')](_0x78aa('0x1c2'),_0x2e0f58['label']));if(!this['isConfigured'](_0x2e0f58[_0x78aa('0xce')])){return this[_0x78aa('0x11')][_0x78aa('0x38')](_0x2e0f58,_0x78aa('0x1c3'));}var _0x4372b4=this[_0x78aa('0x15')][_0x78aa('0x73')](this,_0x2e0f58[_0x78aa('0xce')]);if(!_0x4372b4){return this[_0x78aa('0x11')]['error'](_0x2e0f58,'no\x20variable\x20found');}var _0x5c672a=this['channel'][_0x78aa('0x15')](_0x4372b4);return{'code':0xc8,'result':_0x5c672a[_0x78aa('0xa1')]?_0x5c672a['extra']:'-'};};String[_0x78aa('0x14')]['replaceAll']=function(_0x3582e8,_0x2385b9){return this[_0x78aa('0x9f')](_0x3582e8)[_0x78aa('0x1c4')](_0x2385b9);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 760212e..7b98e17 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 _0x3dfa=['update','uniqueid','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','transfereeuniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','agents','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','channels','queue','mandatoryDisposition','name','mandatoryDispositionPause','Action','then','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','timers','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','voiceQueues','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','timer'];(function(_0x45806b,_0x53eeae){var _0x3e228e=function(_0x3ee031){while(--_0x3ee031){_0x45806b['push'](_0x45806b['shift']());}};_0x3e228e(++_0x53eeae);}(_0x3dfa,0x1ce));var _0xa3df=function(_0x511cf2,_0x44cbeb){_0x511cf2=_0x511cf2-0x0;var _0x30654c=_0x3dfa[_0x511cf2];return _0x30654c;};'use strict';var util=require(_0xa3df('0x0'));var _=require(_0xa3df('0x1'));var moment=require(_0xa3df('0x2'));var ami=require(_0xa3df('0x3'));var logger=require(_0xa3df('0x4'))(_0xa3df('0x5'));var RpcUser=require(_0xa3df('0x6'));var RpcVoiceAgentReport=require(_0xa3df('0x7'));function Acw(_0x3c4993){this['voiceQueues']=_0x3c4993['voiceQueues'];this[_0xa3df('0x8')]=_0x3c4993[_0xa3df('0x8')];this['timers']=_0x3c4993['timers'];this['channels']={};ami['on']('agentconnect',this['syncAgentConnect'][_0xa3df('0x9')](this));ami['on'](_0xa3df('0xa'),this[_0xa3df('0xb')][_0xa3df('0x9')](this));ami['on']('hangup',this[_0xa3df('0xc')][_0xa3df('0x9')](this));ami['on'](_0xa3df('0xd'),this[_0xa3df('0xe')][_0xa3df('0x9')](this));ami['on'](_0xa3df('0xf'),this['syncAttendedTransfer'][_0xa3df('0x9')](this));ami['on'](_0xa3df('0x10'),this[_0xa3df('0x11')][_0xa3df('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0xa3df('0x12')]['bind'](this));}function getDiff(_0x488587){var _0x44d9e6=moment()[_0xa3df('0x13')](0x0);var _0x37f0fb=moment(_0x488587)['milliseconds'](0x0);return _0x44d9e6[_0xa3df('0x14')](_0x37f0fb,_0xa3df('0x15'));}Acw[_0xa3df('0x16')][_0xa3df('0x17')]=function(_0x2cb070){try{var _0x268cd3=this;var _0x422a28=this['channels'][_0x2cb070][_0xa3df('0x18')];var _0x4f7bfe=this[_0xa3df('0x19')][_0x2cb070][_0xa3df('0x1a')];var _0x13b2c5=this['voiceQueues'][_0x4f7bfe];var _0x5149fd=![];var _0x10e535='ACW';if(_0x13b2c5[_0xa3df('0x1b')]){if(_0x13b2c5['mandatoryDispositionPause'][_0xa3df('0x1c')]){_0x5149fd=!![];_0x10e535=_0x13b2c5[_0xa3df('0x1d')][_0xa3df('0x1c')];}}ami[_0xa3df('0x1e')]({'action':'QueuePause','interface':_0x422a28,'paused':!![],'reason':_0x10e535})[_0xa3df('0x1f')](function(_0x4cce6c){if(_0x268cd3[_0xa3df('0x8')][_0x422a28]){return RpcUser[_0xa3df('0x20')](_0x268cd3[_0xa3df('0x8')][_0x422a28]['id'])[_0xa3df('0x1f')](function(_0x3e6f61){if(_0x3e6f61&&!_0x3e6f61['voicePause']){logger['info'](_0xa3df('0x21'),_0x2cb070,_0x422a28,_0x4f7bfe);var _0x48f058=_0x268cd3['channels'][_0x2cb070][_0xa3df('0x22')]&&_0x268cd3['channels'][_0x2cb070][_0xa3df('0x23')]?_0x268cd3[_0xa3df('0x19')][_0x2cb070][_0xa3df('0x23')]:_0x2cb070;return RpcUser[_0xa3df('0x24')](_0x268cd3[_0xa3df('0x8')][_0x422a28],_0x10e535,_0x48f058)[_0xa3df('0x1f')](function(_0x79dc6f){if(!_0x5149fd){_0x268cd3[_0xa3df('0x25')][_0x422a28]={};logger[_0xa3df('0x26')](_0xa3df('0x27'),_0x2cb070,_0x268cd3[_0xa3df('0x28')][_0x4f7bfe][_0xa3df('0x29')],_0x422a28,_0x4f7bfe);_0x268cd3[_0xa3df('0x25')][_0x422a28]['timer']=setTimeout(_0x268cd3[_0xa3df('0x2a')][_0xa3df('0x9')](_0x268cd3,_0x422a28),_0x268cd3[_0xa3df('0x28')][_0x4f7bfe][_0xa3df('0x29')]*0x3e8);_0x268cd3[_0xa3df('0x25')][_0x422a28][_0xa3df('0x2b')]=moment()[_0xa3df('0x2c')](_0xa3df('0x2d'));_0x268cd3[_0xa3df('0x25')][_0x422a28]['uniqueid']=_0x2cb070;_0x268cd3[_0xa3df('0x25')][_0x422a28][_0xa3df('0x1a')]=_0x4f7bfe;_0x268cd3[_0xa3df('0x25')][_0x422a28][_0xa3df('0x2e')]=function(){var _0x53ffaf=getDiff(_0x268cd3[_0xa3df('0x25')][_0x422a28]['lastPauseAt']);clearTimeout(_0x268cd3[_0xa3df('0x25')][_0x422a28]['timer']);_0x268cd3['timers'][_0x422a28][_0xa3df('0x2f')]=![];RpcVoiceAgentReport[_0xa3df('0x30')]({'acwtime':_0x53ffaf},_0x268cd3[_0xa3df('0x25')][_0x422a28][_0xa3df('0x31')],_0x422a28)[_0xa3df('0x1f')](function(_0x5e8d60){logger[_0xa3df('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x2cb070,_0x53ffaf,_0x5e8d60);})[_0xa3df('0x32')](function(_0x2cdffc){logger[_0xa3df('0x33')](_0xa3df('0x34'),_0x2cb070,_0x2cdffc);});delete _0x268cd3[_0xa3df('0x25')][_0x422a28];};}});}else{logger['info'](_0xa3df('0x35'),_0x2cb070,_0x422a28,_0x4f7bfe);}});}})[_0xa3df('0x32')](function(_0x3688b8){logger[_0xa3df('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2cb070,_0x268cd3['voiceQueues'][_0x4f7bfe][_0xa3df('0x29')],_0x422a28,_0x4f7bfe);})[_0xa3df('0x36')](function(){delete _0x268cd3[_0xa3df('0x19')][_0x2cb070];});}catch(_0x3605af){logger['error'](_0xa3df('0x37'),_0x3605af[_0xa3df('0x38')]);}};Acw['prototype'][_0xa3df('0x2a')]=function(_0xe2df47){try{var _0x3213be=this;if(_0x3213be[_0xa3df('0x25')][_0xe2df47]){_0x3213be[_0xa3df('0x25')][_0xe2df47][_0xa3df('0x2f')]=![];var _0x283d3d=_0x3213be[_0xa3df('0x25')][_0xe2df47]['uniqueid'];var _0x65660=_0x3213be[_0xa3df('0x25')][_0xe2df47][_0xa3df('0x1a')];var _0x4ffe27=_0x3213be[_0xa3df('0x28')][_0x65660][_0xa3df('0x29')];logger[_0xa3df('0x26')](_0xa3df('0x39'),_0x283d3d,_0xe2df47);RpcUser[_0xa3df('0x3a')](this[_0xa3df('0x8')][_0xe2df47]);RpcVoiceAgentReport[_0xa3df('0x30')]({'acwtime':_0x4ffe27,'agentacw':!![]},_0x283d3d,_0xe2df47)[_0xa3df('0x1f')](function(_0x215406){logger[_0xa3df('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x283d3d,_0x4ffe27,_0x215406);})[_0xa3df('0x32')](function(_0x34c4ac){logger[_0xa3df('0x33')](_0xa3df('0x34'),_0x283d3d,_0x34c4ac);});}else{logger[_0xa3df('0x33')](_0xa3df('0x3b'),_0xe2df47);if(_0x3213be[_0xa3df('0x25')]){logger[_0xa3df('0x26')](_0xa3df('0x3c'),JSON['stringify'](_0x3213be[_0xa3df('0x25')]));}}}catch(_0x340328){logger[_0xa3df('0x33')](_0xa3df('0x3d'),_0x340328[_0xa3df('0x38')]);}};Acw[_0xa3df('0x16')][_0xa3df('0x3e')]=function(_0x105679){try{if(this[_0xa3df('0x28')][_0x105679[_0xa3df('0x1a')]]&&(this[_0xa3df('0x28')][_0x105679[_0xa3df('0x1a')]][_0xa3df('0x5')]||this['voiceQueues'][_0x105679[_0xa3df('0x1a')]]['mandatoryDisposition'])){if(this['agents'][_0x105679[_0xa3df('0x18')]]){this[_0xa3df('0x19')][_0x105679['uniqueid']]={'queue':_0x105679['queue'],'interface':_0x105679['interface'],'destlinkedid':_0x105679[_0xa3df('0x23')]};}}}catch(_0x3fa020){logger['error'](_0xa3df('0x3f'),_0x3fa020['message']);}};Acw[_0xa3df('0x16')]['syncAgentConnectPreview']=function(_0x2189f7){try{if(this[_0xa3df('0x28')][_0x2189f7['queue']]&&(this[_0xa3df('0x28')][_0x2189f7[_0xa3df('0x1a')]]['acw']||this[_0xa3df('0x28')][_0x2189f7[_0xa3df('0x1a')]][_0xa3df('0x1b')])){if(this[_0xa3df('0x8')][_0x2189f7[_0xa3df('0x18')]]){this['channels'][_0x2189f7[_0xa3df('0x31')]]={'queue':_0x2189f7[_0xa3df('0x1a')],'interface':_0x2189f7[_0xa3df('0x18')]};}}}catch(_0x4b9967){logger[_0xa3df('0x33')](_0xa3df('0x40'),_0x4b9967[_0xa3df('0x38')]);}};Acw[_0xa3df('0x16')][_0xa3df('0xb')]=function(_0x2e0c7b){try{if(this[_0xa3df('0x19')][_0x2e0c7b['uniqueid']]&&_['isUndefined'](this[_0xa3df('0x19')][_0x2e0c7b[_0xa3df('0x31')]][_0xa3df('0x22')])){logger[_0xa3df('0x26')]('[%s][HANGUP:UNIQUEID]',_0x2e0c7b[_0xa3df('0x31')]);this['startAcw'](_0x2e0c7b[_0xa3df('0x31')]);}else if(this[_0xa3df('0x19')][_0x2e0c7b['linkedid']]&&_['isUndefined'](this[_0xa3df('0x19')][_0x2e0c7b[_0xa3df('0x41')]]['attended'])){logger['info']('[%s][HANGUP:LINKEDID]',_0x2e0c7b['linkedid']);this[_0xa3df('0x17')](_0x2e0c7b[_0xa3df('0x41')]);}}catch(_0x3e3b61){logger['error'](_0xa3df('0x42'),_0x3e3b61[_0xa3df('0x38')]);}};Acw['prototype'][_0xa3df('0xc')]=function(_0x3fd46a){try{if(this['channels'][_0x3fd46a[_0xa3df('0x31')]]&&this[_0xa3df('0x19')][_0x3fd46a[_0xa3df('0x31')]][_0xa3df('0x22')]){logger['info'](_0xa3df('0x43'),_0x3fd46a['uniqueid']);this[_0xa3df('0x17')](_0x3fd46a['uniqueid']);}else if(this['channels'][_0x3fd46a[_0xa3df('0x41')]]&&this['channels'][_0x3fd46a[_0xa3df('0x41')]][_0xa3df('0x22')]){logger[_0xa3df('0x26')](_0xa3df('0x44'),_0x3fd46a[_0xa3df('0x41')]);this[_0xa3df('0x17')](_0x3fd46a['linkedid']);}}catch(_0x4b255c){logger['error']('[ACW][syncHangup]\x20%s',_0x4b255c[_0xa3df('0x38')]);}};Acw[_0xa3df('0x16')][_0xa3df('0x45')]=function(_0x10b76d){try{if(!_['isNil'](this[_0xa3df('0x19')][_0x10b76d[_0xa3df('0x46')]])){this[_0xa3df('0x17')](_0x10b76d['transfereeuniqueid']);if(this[_0xa3df('0x19')][_0x10b76d['secondtransfereruniqueid']]){this[_0xa3df('0x19')][_0x10b76d['secondtransfereruniqueid']][_0xa3df('0x22')]=!![];this[_0xa3df('0x19')][_0x10b76d['transfertargetuniqueid']]=this[_0xa3df('0x19')][_0x10b76d['secondtransfereruniqueid']];delete this[_0xa3df('0x19')][_0x10b76d['secondtransfereruniqueid']];}}else if(!_[_0xa3df('0x47')](this[_0xa3df('0x19')][_0x10b76d[_0xa3df('0x48')]])){this['startAcw'](_0x10b76d[_0xa3df('0x48')]);if(this['channels'][_0x10b76d[_0xa3df('0x49')]]){this[_0xa3df('0x19')][_0x10b76d[_0xa3df('0x49')]][_0xa3df('0x22')]=!![];this[_0xa3df('0x19')][_0x10b76d[_0xa3df('0x46')]]=this['channels'][_0x10b76d[_0xa3df('0x49')]];delete this[_0xa3df('0x19')][_0x10b76d[_0xa3df('0x49')]];}}}catch(_0xefece9){logger[_0xa3df('0x33')]('[ACW][syncAttendedTransfer]\x20%s',_0xefece9[_0xa3df('0x38')]);}};Acw[_0xa3df('0x16')][_0xa3df('0x11')]=function(_0x513d91){try{if(this[_0xa3df('0x19')][_0x513d91[_0xa3df('0x4a')]]){logger[_0xa3df('0x26')](_0xa3df('0x4b'),JSON[_0xa3df('0x4c')](_0x513d91[_0xa3df('0x4a')]));this[_0xa3df('0x17')](_0x513d91[_0xa3df('0x4a')]);}else if(this['channels'][_0x513d91['transfererlinkedid']]){logger[_0xa3df('0x26')](_0xa3df('0x4d'),JSON[_0xa3df('0x4c')](_0x513d91['transfererlinkedid']));this[_0xa3df('0x17')](_0x513d91[_0xa3df('0x4e')]);}}catch(_0x3449c4){logger[_0xa3df('0x33')](_0xa3df('0x4f'),_0x3449c4['message']);}};Acw[_0xa3df('0x16')][_0xa3df('0xe')]=function(_0x290079){try{if(this[_0xa3df('0x28')][_0x290079[_0xa3df('0x1a')]]&&this[_0xa3df('0x28')][_0x290079[_0xa3df('0x1a')]]['autopause']===_0xa3df('0x50')){if(this[_0xa3df('0x8')][_0x290079[_0xa3df('0x18')]]){logger[_0xa3df('0x26')](_0xa3df('0x51'),_0x290079[_0xa3df('0x31')],_0x290079[_0xa3df('0x18')],_0x290079['queue']);return RpcUser[_0xa3df('0x24')](this[_0xa3df('0x8')][_0x290079[_0xa3df('0x18')]],_0xa3df('0x52'),_0x290079['uniqueid']);}}}catch(_0x52fd72){logger[_0xa3df('0x33')](_0xa3df('0x53'),_0x52fd72['message']);}};module[_0xa3df('0x54')]=Acw; \ No newline at end of file +var _0xac0e=['[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','mandatoryDisposition','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','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','savePause','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','bind','hanguprequest','syncHangup','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','channels','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]'];(function(_0x13b89c,_0x12d950){var _0x16d492=function(_0x5bcb59){while(--_0x5bcb59){_0x13b89c['push'](_0x13b89c['shift']());}};_0x16d492(++_0x12d950);}(_0xac0e,0xc5));var _0xeac0=function(_0x3ae2af,_0x5b3d08){_0x3ae2af=_0x3ae2af-0x0;var _0x4bd27d=_0xac0e[_0x3ae2af];return _0x4bd27d;};'use strict';var util=require(_0xeac0('0x0'));var _=require(_0xeac0('0x1'));var moment=require(_0xeac0('0x2'));var ami=require(_0xeac0('0x3'));var logger=require(_0xeac0('0x4'))(_0xeac0('0x5'));var RpcUser=require(_0xeac0('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3dab05){this[_0xeac0('0x7')]=_0x3dab05[_0xeac0('0x7')];this[_0xeac0('0x8')]=_0x3dab05[_0xeac0('0x8')];this[_0xeac0('0x9')]=_0x3dab05[_0xeac0('0x9')];this['channels']={};ami['on'](_0xeac0('0xa'),this['syncAgentConnect'][_0xeac0('0xb')](this));ami['on'](_0xeac0('0xc'),this['syncHangupRequest'][_0xeac0('0xb')](this));ami['on']('hangup',this[_0xeac0('0xd')][_0xeac0('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xeac0('0xb')](this));ami['on'](_0xeac0('0xe'),this[_0xeac0('0xf')]['bind'](this));ami['on']('blindtransfer',this[_0xeac0('0x10')][_0xeac0('0xb')](this));ami['on'](_0xeac0('0x11'),this[_0xeac0('0x12')][_0xeac0('0xb')](this));}function getDiff(_0x3ac0ee){var _0x2778e5=moment()['milliseconds'](0x0);var _0x2cd210=moment(_0x3ac0ee)[_0xeac0('0x13')](0x0);return _0x2778e5[_0xeac0('0x14')](_0x2cd210,_0xeac0('0x15'));}Acw[_0xeac0('0x16')]['startAcw']=function(_0x362f27){try{var _0x35b312=this;var _0x25bc0c=this['channels'][_0x362f27][_0xeac0('0x17')];var _0x5e4de8=this[_0xeac0('0x18')][_0x362f27][_0xeac0('0x19')];var _0x3a7d02=this[_0xeac0('0x7')][_0x5e4de8];var _0x1b3374=![];var _0x5db698=_0xeac0('0x1a');if(_0x3a7d02['mandatoryDisposition']){if(_0x3a7d02[_0xeac0('0x1b')]['name']){_0x1b3374=!![];_0x5db698=_0x3a7d02['mandatoryDispositionPause'][_0xeac0('0x1c')];}}ami[_0xeac0('0x1d')]({'action':_0xeac0('0x1e'),'interface':_0x25bc0c,'paused':!![],'reason':_0x5db698})[_0xeac0('0x1f')](function(_0x433e84){if(_0x35b312[_0xeac0('0x8')][_0x25bc0c]){return RpcUser['getAgent'](_0x35b312['agents'][_0x25bc0c]['id'])[_0xeac0('0x1f')](function(_0x447656){if(_0x447656&&!_0x447656[_0xeac0('0x20')]){logger[_0xeac0('0x21')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x362f27,_0x25bc0c,_0x5e4de8);var _0x5a23e0=_0x35b312[_0xeac0('0x18')][_0x362f27][_0xeac0('0x22')]&&_0x35b312[_0xeac0('0x18')][_0x362f27][_0xeac0('0x23')]?_0x35b312[_0xeac0('0x18')][_0x362f27][_0xeac0('0x23')]:_0x362f27;return RpcUser['savePause'](_0x35b312[_0xeac0('0x8')][_0x25bc0c],_0x5db698,_0x5a23e0)[_0xeac0('0x1f')](function(_0x16b157){if(!_0x1b3374){_0x35b312[_0xeac0('0x9')][_0x25bc0c]={};logger[_0xeac0('0x21')](_0xeac0('0x24'),_0x362f27,_0x35b312['voiceQueues'][_0x5e4de8][_0xeac0('0x25')],_0x25bc0c,_0x5e4de8);_0x35b312[_0xeac0('0x9')][_0x25bc0c][_0xeac0('0x26')]=setTimeout(_0x35b312[_0xeac0('0x27')][_0xeac0('0xb')](_0x35b312,_0x25bc0c),_0x35b312[_0xeac0('0x7')][_0x5e4de8][_0xeac0('0x25')]*0x3e8);_0x35b312['timers'][_0x25bc0c][_0xeac0('0x28')]=moment()[_0xeac0('0x29')](_0xeac0('0x2a'));_0x35b312['timers'][_0x25bc0c]['uniqueid']=_0x362f27;_0x35b312[_0xeac0('0x9')][_0x25bc0c][_0xeac0('0x19')]=_0x5e4de8;_0x35b312[_0xeac0('0x9')][_0x25bc0c][_0xeac0('0x2b')]=function(){var _0x1602c0=getDiff(_0x35b312[_0xeac0('0x9')][_0x25bc0c][_0xeac0('0x28')]);clearTimeout(_0x35b312[_0xeac0('0x9')][_0x25bc0c]['timer']);_0x35b312[_0xeac0('0x9')][_0x25bc0c]['timer']=![];RpcVoiceAgentReport[_0xeac0('0x2c')]({'acwtime':_0x1602c0},_0x35b312[_0xeac0('0x9')][_0x25bc0c][_0xeac0('0x2d')],_0x25bc0c)[_0xeac0('0x1f')](function(_0x103249){logger[_0xeac0('0x21')](_0xeac0('0x2e'),_0x362f27,_0x1602c0,_0x103249);})['catch'](function(_0x2fba65){logger[_0xeac0('0x2f')](_0xeac0('0x30'),_0x362f27,_0x2fba65);});delete _0x35b312['timers'][_0x25bc0c];};}});}else{logger[_0xeac0('0x21')](_0xeac0('0x31'),_0x362f27,_0x25bc0c,_0x5e4de8);}});}})[_0xeac0('0x32')](function(_0xbea36c){logger['error'](_0xeac0('0x24'),_0x362f27,_0x35b312[_0xeac0('0x7')][_0x5e4de8][_0xeac0('0x25')],_0x25bc0c,_0x5e4de8);})['finally'](function(){delete _0x35b312[_0xeac0('0x18')][_0x362f27];});}catch(_0x14e9a7){logger['error'](_0xeac0('0x33'),_0x14e9a7['message']);}};Acw[_0xeac0('0x16')][_0xeac0('0x27')]=function(_0x351381){try{var _0x12227a=this;if(_0x12227a[_0xeac0('0x9')][_0x351381]){_0x12227a['timers'][_0x351381][_0xeac0('0x26')]=![];var _0x33599b=_0x12227a[_0xeac0('0x9')][_0x351381][_0xeac0('0x2d')];var _0x27f71b=_0x12227a[_0xeac0('0x9')][_0x351381]['queue'];var _0x4574e9=_0x12227a[_0xeac0('0x7')][_0x27f71b][_0xeac0('0x25')];logger['info'](_0xeac0('0x34'),_0x33599b,_0x351381);RpcUser[_0xeac0('0x35')](this['agents'][_0x351381]);RpcVoiceAgentReport[_0xeac0('0x2c')]({'acwtime':_0x4574e9,'agentacw':!![]},_0x33599b,_0x351381)['then'](function(_0x43693c){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x33599b,_0x4574e9,_0x43693c);})[_0xeac0('0x32')](function(_0x11ff8b){logger[_0xeac0('0x2f')](_0xeac0('0x30'),_0x33599b,_0x11ff8b);});}else{logger['error'](_0xeac0('0x36'),_0x351381);if(_0x12227a['timers']){logger['info']('[ACW][TIMERS]',JSON[_0xeac0('0x37')](_0x12227a['timers']));}}}catch(_0x2886f8){logger[_0xeac0('0x2f')](_0xeac0('0x38'),_0x2886f8[_0xeac0('0x39')]);}};Acw[_0xeac0('0x16')][_0xeac0('0x3a')]=function(_0x1d3717){try{if(this[_0xeac0('0x7')][_0x1d3717[_0xeac0('0x19')]]&&(this['voiceQueues'][_0x1d3717['queue']]['acw']||this[_0xeac0('0x7')][_0x1d3717[_0xeac0('0x19')]][_0xeac0('0x3b')])){if(this[_0xeac0('0x8')][_0x1d3717['interface']]){this['channels'][_0x1d3717['uniqueid']]={'queue':_0x1d3717[_0xeac0('0x19')],'interface':_0x1d3717[_0xeac0('0x17')],'destlinkedid':_0x1d3717[_0xeac0('0x23')]};}}}catch(_0x51add2){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x51add2[_0xeac0('0x39')]);}};Acw[_0xeac0('0x16')][_0xeac0('0x12')]=function(_0x4b3f3d){try{if(this[_0xeac0('0x7')][_0x4b3f3d[_0xeac0('0x19')]]&&(this[_0xeac0('0x7')][_0x4b3f3d['queue']][_0xeac0('0x5')]||this[_0xeac0('0x7')][_0x4b3f3d[_0xeac0('0x19')]][_0xeac0('0x3b')])){if(this['agents'][_0x4b3f3d[_0xeac0('0x17')]]){this[_0xeac0('0x18')][_0x4b3f3d[_0xeac0('0x2d')]]={'queue':_0x4b3f3d[_0xeac0('0x19')],'interface':_0x4b3f3d['interface']};}}}catch(_0x5b3339){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x5b3339['message']);}};Acw[_0xeac0('0x16')][_0xeac0('0x3c')]=function(_0x2f4726){try{if(this[_0xeac0('0x18')][_0x2f4726[_0xeac0('0x2d')]]&&_[_0xeac0('0x3d')](this['channels'][_0x2f4726[_0xeac0('0x2d')]][_0xeac0('0x22')])){logger['info'](_0xeac0('0x3e'),_0x2f4726[_0xeac0('0x2d')]);this[_0xeac0('0x3f')](_0x2f4726[_0xeac0('0x2d')]);}else if(this[_0xeac0('0x18')][_0x2f4726[_0xeac0('0x40')]]&&_[_0xeac0('0x3d')](this[_0xeac0('0x18')][_0x2f4726['linkedid']]['attended'])){logger[_0xeac0('0x21')]('[%s][HANGUP:LINKEDID]',_0x2f4726[_0xeac0('0x40')]);this[_0xeac0('0x3f')](_0x2f4726[_0xeac0('0x40')]);}}catch(_0x50376f){logger[_0xeac0('0x2f')](_0xeac0('0x41'),_0x50376f['message']);}};Acw[_0xeac0('0x16')][_0xeac0('0xd')]=function(_0x1ef5de){try{if(this['channels'][_0x1ef5de[_0xeac0('0x2d')]]&&this['channels'][_0x1ef5de['uniqueid']][_0xeac0('0x22')]){logger[_0xeac0('0x21')](_0xeac0('0x42'),_0x1ef5de[_0xeac0('0x2d')]);this[_0xeac0('0x3f')](_0x1ef5de['uniqueid']);}else if(this[_0xeac0('0x18')][_0x1ef5de[_0xeac0('0x40')]]&&this[_0xeac0('0x18')][_0x1ef5de[_0xeac0('0x40')]][_0xeac0('0x22')]){logger[_0xeac0('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1ef5de['linkedid']);this[_0xeac0('0x3f')](_0x1ef5de[_0xeac0('0x40')]);}}catch(_0x34dc39){logger[_0xeac0('0x2f')](_0xeac0('0x43'),_0x34dc39[_0xeac0('0x39')]);}};Acw['prototype'][_0xeac0('0xf')]=function(_0x57ddfc){try{if(!_[_0xeac0('0x44')](this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x45')]])){this[_0xeac0('0x3f')](_0x57ddfc[_0xeac0('0x45')]);if(this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x46')]]){this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x46')]]['attended']=!![];this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x47')]]=this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x46')]];delete this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x46')]];}}else if(!_[_0xeac0('0x44')](this['channels'][_0x57ddfc[_0xeac0('0x47')]])){this['startAcw'](_0x57ddfc[_0xeac0('0x47')]);if(this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x48')]]){this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x48')]][_0xeac0('0x22')]=!![];this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x45')]]=this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x48')]];delete this[_0xeac0('0x18')][_0x57ddfc[_0xeac0('0x48')]];}}}catch(_0x43fbe0){logger[_0xeac0('0x2f')](_0xeac0('0x49'),_0x43fbe0['message']);}};Acw[_0xeac0('0x16')][_0xeac0('0x10')]=function(_0x10982e){try{if(this[_0xeac0('0x18')][_0x10982e[_0xeac0('0x4a')]]){logger[_0xeac0('0x21')](_0xeac0('0x4b'),JSON[_0xeac0('0x37')](_0x10982e['transfereruniqueid']));this['startAcw'](_0x10982e['transfereruniqueid']);}else if(this[_0xeac0('0x18')][_0x10982e[_0xeac0('0x4c')]]){logger[_0xeac0('0x21')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xeac0('0x37')](_0x10982e[_0xeac0('0x4c')]));this[_0xeac0('0x3f')](_0x10982e['transfererlinkedid']);}}catch(_0x45598a){logger[_0xeac0('0x2f')](_0xeac0('0x4d'),_0x45598a[_0xeac0('0x39')]);}};Acw[_0xeac0('0x16')][_0xeac0('0x4e')]=function(_0x1d59c0){try{if(this[_0xeac0('0x7')][_0x1d59c0['queue']]&&this[_0xeac0('0x7')][_0x1d59c0[_0xeac0('0x19')]][_0xeac0('0x4f')]==='all'){if(this['agents'][_0x1d59c0[_0xeac0('0x17')]]){logger[_0xeac0('0x21')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1d59c0[_0xeac0('0x2d')],_0x1d59c0[_0xeac0('0x17')],_0x1d59c0[_0xeac0('0x19')]);return RpcUser[_0xeac0('0x50')](this[_0xeac0('0x8')][_0x1d59c0[_0xeac0('0x17')]],'Auto-Pause',_0x1d59c0['uniqueid']);}}}catch(_0x34627f){logger[_0xeac0('0x2f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x34627f['message']);}};module[_0xeac0('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index b00c8f8..a407f3f 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 _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x179c13,_0x15e4c5){var _0x1ee81c=function(_0x172124){while(--_0x172124){_0x179c13['push'](_0x179c13['shift']());}};_0x1ee81c(++_0x15e4c5);}(_0x757a,0xde));var _0xa757=function(_0xf0c0d,_0x18fec0){_0xf0c0d=_0xf0c0d-0x0;var _0xc3868=_0x757a[_0xf0c0d];return _0xc3868;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file +var _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x67e291,_0x5e7bcc){var _0x284b16=function(_0x28d99b){while(--_0x28d99b){_0x67e291['push'](_0x67e291['shift']());}};_0x284b16(++_0x5e7bcc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 54e98e7..e4bc8dc 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(_0x50148e,_0x4c99c7){var _0x446e9d=function(_0x42a9ed){while(--_0x42a9ed){_0x50148e['push'](_0x50148e['shift']());}};_0x446e9d(++_0x4c99c7);}(_0xac4a,0x13f));var _0xaac4=function(_0x473668,_0x2452fb){_0x473668=_0x473668-0x0;var _0x59f76c=_0xac4a[_0x473668];return _0x59f76c;};'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(_0xc94c2b,_0x1eb9c0){var _0x274cf0=function(_0x388dec){while(--_0x388dec){_0xc94c2b['push'](_0xc94c2b['shift']());}};_0x274cf0(++_0x1eb9c0);}(_0xb43b,0x1b2));var _0xbb43=function(_0x30c73d,_0x26cc74){_0x30c73d=_0x30c73d-0x0;var _0x2e63da=_0xb43b[_0x30c73d];return _0x2e63da;};'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/action.js b/server/services/ami/dialer/action.js index 5c39883..7a2c5c1 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xccfb=['string','voiceQueue','uniqueid','name','Contact','phone','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','getQueue','util','moment','isNil'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xccfb,0x1b5));var _0xbccf=function(_0x413f57,_0x1ee8b6){_0x413f57=_0x413f57-0x0;var _0x216a7a=_0xccfb[_0x413f57];return _0x216a7a;};'use strict';var util=require(_0xbccf('0x0'));var _=require('lodash');var moment=require(_0xbccf('0x1'));function checkNameSurname(_0x379e4b,_0x3ac6ab,_0x29d886){var _0x136186='';if(!_[_0xbccf('0x2')](_0x3ac6ab)&&_0xbccf('0x3')===typeof _0x3ac6ab){_0x136186+=_0x3ac6ab;}if(!_[_0xbccf('0x2')](_0x29d886)&&_0xbccf('0x3')===typeof _0x29d886){_0x136186+='\x20'+_0x29d886;}if(_0x136186!==''){return _0x136186;}return _0x379e4b;}function Action(_0x193cda,_0x52c0fa,_0xed5763){this[_0xbccf('0x4')]=_0x193cda;this[_0xbccf('0x5')]=_0xed5763||undefined;this[_0xbccf('0x6')]=checkNameSurname(_0x52c0fa[_0xbccf('0x7')][_0xbccf('0x8')],_0x52c0fa[_0xbccf('0x7')]['firstName'],_0x52c0fa[_0xbccf('0x7')]['lastName']);this[_0xbccf('0x9')]=_0x52c0fa[_0xbccf('0x8')];this[_0xbccf('0xa')]=_0x193cda['name'];this['active']=_0x52c0fa['active']||![];this[_0xbccf('0xb')]=_0x193cda[_0xbccf('0xb')];this[_0xbccf('0xc')]=_0x193cda[_0xbccf('0xc')]||0x3;this['scheduledat']=_0x52c0fa[_0xbccf('0xd')];this[_0xbccf('0xe')]=_0x52c0fa[_0xbccf('0xe')];this[_0xbccf('0xf')]=_0x52c0fa[_0xbccf('0xf')];this[_0xbccf('0x10')]=_0x52c0fa[_0xbccf('0x10')];this[_0xbccf('0x11')]=_0x52c0fa[_0xbccf('0x11')];this[_0xbccf('0x12')]=_0x52c0fa['countdropretry'];this[_0xbccf('0x13')]=_0x52c0fa[_0xbccf('0x13')];this[_0xbccf('0x14')]=_0x52c0fa['countmachineretry'];this['countagentrejectretry']=_0x52c0fa[_0xbccf('0x15')];this['ContactId']=_0x52c0fa[_0xbccf('0x16')];this['ListId']=_0x52c0fa[_0xbccf('0x17')];this[_0xbccf('0x18')]=_0x52c0fa[_0xbccf('0x18')];this[_0xbccf('0x19')]=_0x52c0fa[_0xbccf('0x19')];this[_0xbccf('0x1a')]=_0x52c0fa[_0xbccf('0x1a')];this[_0xbccf('0x1b')]=_0x52c0fa['id'];this['ContactFirstName']=_0x52c0fa['Contact']['firstName']||'';this['starttime']=moment()[_0xbccf('0x1c')](_0xbccf('0x1d'));this[_0xbccf('0x1e')]=_0x52c0fa[_0xbccf('0x1e')];this['callbackuniqueid']=_0x52c0fa[_0xbccf('0x1f')];this[_0xbccf('0x20')]=_0x52c0fa[_0xbccf('0x20')];this[_0xbccf('0x21')]=_0x52c0fa[_0xbccf('0x21')];this[_0xbccf('0x22')]='';this[_0xbccf('0x23')]='';}Action[_0xbccf('0x24')][_0xbccf('0x25')]=function(){return util[_0xbccf('0x1c')](_0xbccf('0x26'),this['name'],this['voiceQueue']['dialCutDigit']>0x0?this[_0xbccf('0x9')]['substring'](this[_0xbccf('0x4')]['dialCutDigit']):this[_0xbccf('0x9')]);};Action[_0xbccf('0x24')][_0xbccf('0x27')]=function(){return this[_0xbccf('0xa')];};module['exports']=Action; \ No newline at end of file +var _0x261d=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','voiceQueue','dialCutDigit','substring','getQueue','util','lodash','moment','isNil','string','Contact','phone','firstName','lastName','number','queue','name','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x42335b,_0x5c083b){var _0x3b9b8d=function(_0x390054){while(--_0x390054){_0x42335b['push'](_0x42335b['shift']());}};_0x3b9b8d(++_0x5c083b);}(_0x261d,0xe9));var _0xd261=function(_0xac5770,_0x5393d0){_0xac5770=_0xac5770-0x0;var _0xa03c9e=_0x261d[_0xac5770];return _0xa03c9e;};'use strict';var util=require(_0xd261('0x0'));var _=require(_0xd261('0x1'));var moment=require(_0xd261('0x2'));function checkNameSurname(_0x4a598f,_0x32c10a,_0x1127d6){var _0x494071='';if(!_[_0xd261('0x3')](_0x32c10a)&&_0xd261('0x4')===typeof _0x32c10a){_0x494071+=_0x32c10a;}if(!_[_0xd261('0x3')](_0x1127d6)&&_0xd261('0x4')===typeof _0x1127d6){_0x494071+='\x20'+_0x1127d6;}if(_0x494071!==''){return _0x494071;}return _0x4a598f;}function Action(_0x4809d8,_0x3bed56,_0x4c063f){this['voiceQueue']=_0x4809d8;this['uniqueid']=_0x4c063f||undefined;this['name']=checkNameSurname(_0x3bed56[_0xd261('0x5')][_0xd261('0x6')],_0x3bed56[_0xd261('0x5')][_0xd261('0x7')],_0x3bed56[_0xd261('0x5')][_0xd261('0x8')]);this[_0xd261('0x9')]=_0x3bed56[_0xd261('0x6')];this[_0xd261('0xa')]=_0x4809d8[_0xd261('0xb')];this['active']=_0x3bed56['active']||![];this[_0xd261('0xc')]=_0x4809d8[_0xd261('0xc')];this[_0xd261('0xd')]=_0x4809d8[_0xd261('0xd')]||0x3;this[_0xd261('0xe')]=_0x3bed56[_0xd261('0xe')];this[_0xd261('0xf')]=_0x3bed56['countbusyretry'];this[_0xd261('0x10')]=_0x3bed56[_0xd261('0x10')];this['countnoanswerretry']=_0x3bed56[_0xd261('0x11')];this['countnosuchnumberretry']=_0x3bed56[_0xd261('0x12')];this[_0xd261('0x13')]=_0x3bed56['countdropretry'];this[_0xd261('0x14')]=_0x3bed56[_0xd261('0x14')];this['countmachineretry']=_0x3bed56[_0xd261('0x15')];this[_0xd261('0x16')]=_0x3bed56['countagentrejectretry'];this[_0xd261('0x17')]=_0x3bed56['ContactId'];this[_0xd261('0x18')]=_0x3bed56['ListId'];this[_0xd261('0x19')]=_0x3bed56[_0xd261('0x19')];this[_0xd261('0x1a')]=_0x3bed56[_0xd261('0x1a')];this[_0xd261('0x1b')]=_0x3bed56[_0xd261('0x1b')];this[_0xd261('0x1c')]=_0x3bed56['id'];this['ContactFirstName']=_0x3bed56[_0xd261('0x5')]['firstName']||'';this[_0xd261('0x1d')]=moment()[_0xd261('0x1e')](_0xd261('0x1f'));this['callback']=_0x3bed56[_0xd261('0x20')];this[_0xd261('0x21')]=_0x3bed56[_0xd261('0x21')];this[_0xd261('0x22')]=_0x3bed56[_0xd261('0x22')];this[_0xd261('0x23')]=_0x3bed56[_0xd261('0x23')];this['originatecalleridnum']='';this[_0xd261('0x24')]='';}Action[_0xd261('0x25')]['getCaller']=function(){return util[_0xd261('0x1e')]('\x22%s\x22\x20<%s>',this['name'],this[_0xd261('0x26')][_0xd261('0x27')]>0x0?this[_0xd261('0x9')][_0xd261('0x28')](this[_0xd261('0x26')]['dialCutDigit']):this['number']);};Action[_0xd261('0x25')][_0xd261('0x29')]=function(){return this[_0xd261('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index b684f2b..6176ad9 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7de7=['responsetime','endtime','ringtime','holdtime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','starttime'];(function(_0xba1da7,_0x58c389){var _0x1afc4d=function(_0x45c70c){while(--_0x45c70c){_0xba1da7['push'](_0xba1da7['shift']());}};_0x1afc4d(++_0x58c389);}(_0x7de7,0xbe));var _0x77de=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x7de7[_0xd299c3];return _0x376574;};'use strict';var util=require(_0x77de('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x275e9b,_0x5831de){var _0x208c2e=moment(_0x275e9b)[_0x77de('0x1')](0x0);var _0x9e19c9=moment(_0x5831de)['milliseconds'](0x0);return _0x208c2e[_0x77de('0x2')](_0x9e19c9,_0x77de('0x3'));}function AdditionalPhone(_0x1e12a0){this[_0x77de('0x4')]=_0x1e12a0[_0x77de('0x4')];this[_0x77de('0x5')]=_0x1e12a0[_0x77de('0x5')]||undefined;this[_0x77de('0x6')]=_0x1e12a0[_0x77de('0x6')];this[_0x77de('0x7')]=_0x1e12a0['type']===_0x77de('0x8')?_0x77de('0x9'):_0x1e12a0[_0x77de('0x6')];this['countbusyretry']=_0x1e12a0['countbusyretry'];this[_0x77de('0xa')]=_0x1e12a0[_0x77de('0xa')];this[_0x77de('0xb')]=_0x1e12a0[_0x77de('0xb')];this[_0x77de('0xc')]=_0x1e12a0[_0x77de('0xd')]+_0x1e12a0[_0x77de('0xa')]+_0x1e12a0['countnoanswerretry']+_0x1e12a0['countnosuchnumberretry']+_0x1e12a0[_0x77de('0xe')]+_0x1e12a0['countabandonedretry']+_0x1e12a0[_0x77de('0xf')]+_0x1e12a0[_0x77de('0x10')];this['countnosuchnumberretry']=_0x1e12a0['countnosuchnumberretry'];this['countdropretry']=_0x1e12a0['countdropretry'];this[_0x77de('0x11')]=_0x1e12a0[_0x77de('0x11')];this[_0x77de('0xf')]=_0x1e12a0[_0x77de('0xf')];this[_0x77de('0x10')]=_0x1e12a0[_0x77de('0x10')];this[_0x77de('0x9')]=_0x1e12a0['queue'];this[_0x77de('0x12')]=_0x1e12a0['name'];this['calleridnum']=_0x1e12a0['number'];this['starttime']=_0x1e12a0[_0x77de('0x13')];this[_0x77de('0x14')]=_0x1e12a0[_0x77de('0x14')];this[_0x77de('0x15')]=_0x1e12a0['responsetime'];this[_0x77de('0x16')]=getSeconds(_0x1e12a0[_0x77de('0x14')],_0x1e12a0[_0x77de('0x13')]);this[_0x77de('0x17')]=0x0;this['talktime']=0x0;this[_0x77de('0x18')]=_0x1e12a0[_0x77de('0x18')];this['callbackuniqueid']=_0x1e12a0['callbackuniqueid'];this[_0x77de('0x19')]=_0x1e12a0[_0x77de('0x19')];this[_0x77de('0x1a')]=_0x1e12a0[_0x77de('0x1a')];this['ContactId']=_0x1e12a0[_0x77de('0x1b')];this[_0x77de('0x1c')]=_0x1e12a0[_0x77de('0x1c')];this[_0x77de('0x1d')]=_0x1e12a0[_0x77de('0x1d')];this[_0x77de('0x1e')]=_0x1e12a0[_0x77de('0x1e')];this['CampaignId']=_0x1e12a0[_0x77de('0x1f')];this[_0x77de('0x20')]=_0x1e12a0['originatecalleridnum']||'';this['originatecalleridname']=_0x1e12a0[_0x77de('0x21')]||'';}module[_0x77de('0x22')]=History; \ No newline at end of file +var _0xe6f7=['number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum'];(function(_0x29fc18,_0x3f0906){var _0x16cf54=function(_0x54bcaa){while(--_0x54bcaa){_0x29fc18['push'](_0x29fc18['shift']());}};_0x16cf54(++_0x3f0906);}(_0xe6f7,0xf5));var _0x7e6f=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xe6f7[_0x42245d];return _0x4b211a;};'use strict';var util=require(_0x7e6f('0x0'));var _=require(_0x7e6f('0x1'));var moment=require(_0x7e6f('0x2'));function getSeconds(_0x506fcf,_0x378ce5){var _0x25f273=moment(_0x506fcf)[_0x7e6f('0x3')](0x0);var _0x2d16e8=moment(_0x378ce5)['milliseconds'](0x0);return _0x25f273[_0x7e6f('0x4')](_0x2d16e8,_0x7e6f('0x5'));}function AdditionalPhone(_0xad4cce){this[_0x7e6f('0x6')]=_0xad4cce[_0x7e6f('0x6')];this[_0x7e6f('0x7')]=_0xad4cce['scheduledat']||undefined;this['type']=_0xad4cce[_0x7e6f('0x8')];this['campaigntype']=_0xad4cce[_0x7e6f('0x8')]===_0x7e6f('0x9')?_0x7e6f('0xa'):_0xad4cce[_0x7e6f('0x8')];this[_0x7e6f('0xb')]=_0xad4cce[_0x7e6f('0xb')];this[_0x7e6f('0xc')]=_0xad4cce[_0x7e6f('0xc')];this['countnoanswerretry']=_0xad4cce[_0x7e6f('0xd')];this[_0x7e6f('0xe')]=_0xad4cce[_0x7e6f('0xb')]+_0xad4cce[_0x7e6f('0xc')]+_0xad4cce['countnoanswerretry']+_0xad4cce[_0x7e6f('0xf')]+_0xad4cce[_0x7e6f('0x10')]+_0xad4cce[_0x7e6f('0x11')]+_0xad4cce[_0x7e6f('0x12')]+_0xad4cce['countagentrejectretry'];this['countnosuchnumberretry']=_0xad4cce[_0x7e6f('0xf')];this[_0x7e6f('0x10')]=_0xad4cce[_0x7e6f('0x10')];this['countabandonedretry']=_0xad4cce[_0x7e6f('0x11')];this[_0x7e6f('0x12')]=_0xad4cce[_0x7e6f('0x12')];this[_0x7e6f('0x13')]=_0xad4cce[_0x7e6f('0x13')];this['queue']=_0xad4cce[_0x7e6f('0xa')];this['calleridname']=_0xad4cce['name'];this[_0x7e6f('0x14')]=_0xad4cce[_0x7e6f('0x15')];this[_0x7e6f('0x16')]=_0xad4cce[_0x7e6f('0x16')];this[_0x7e6f('0x17')]=_0xad4cce[_0x7e6f('0x17')];this[_0x7e6f('0x18')]=_0xad4cce[_0x7e6f('0x17')];this['ringtime']=getSeconds(_0xad4cce[_0x7e6f('0x17')],_0xad4cce[_0x7e6f('0x16')]);this['holdtime']=0x0;this[_0x7e6f('0x19')]=0x0;this[_0x7e6f('0x1a')]=_0xad4cce['callback'];this['callbackuniqueid']=_0xad4cce[_0x7e6f('0x1b')];this[_0x7e6f('0x1c')]=_0xad4cce[_0x7e6f('0x1c')];this[_0x7e6f('0x1d')]=_0xad4cce['recallme'];this[_0x7e6f('0x1e')]=_0xad4cce['ContactId'];this[_0x7e6f('0x1f')]=_0xad4cce[_0x7e6f('0x1f')];this[_0x7e6f('0x20')]=_0xad4cce[_0x7e6f('0x20')];this['VoiceQueueId']=_0xad4cce[_0x7e6f('0x21')];this['CampaignId']=_0xad4cce[_0x7e6f('0x22')];this['originatecalleridnum']=_0xad4cce[_0x7e6f('0x23')]||'';this[_0x7e6f('0x24')]=_0xad4cce[_0x7e6f('0x24')]||'';}module[_0x7e6f('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index b76bacd..692a3d2 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacb4=['util','lodash','moment','diff','seconds','state','Answer','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x2bde6c,_0x5bb643){var _0x187c7b=function(_0x4d1fdb){while(--_0x4d1fdb){_0x2bde6c['push'](_0x2bde6c['shift']());}};_0x187c7b(++_0x5bb643);}(_0xacb4,0x142));var _0x4acb=function(_0x127c7b,_0x1f65e7){_0x127c7b=_0x127c7b-0x0;var _0x1708eb=_0xacb4[_0x127c7b];return _0x1708eb;};'use strict';var util=require(_0x4acb('0x0'));var _=require(_0x4acb('0x1'));var moment=require(_0x4acb('0x2'));function getSeconds(_0x4bc4cb,_0x48fb45){var _0x610b33=moment(_0x4bc4cb)['milliseconds'](0x0);var _0x3c07f3=moment(_0x48fb45)['milliseconds'](0x0);return _0x610b33[_0x4acb('0x3')](_0x3c07f3,_0x4acb('0x4'));}function AgentComplete(_0x1985b2,_0x47efac){this[_0x4acb('0x5')]=0x4;this['statedesc']=_0x4acb('0x6');this[_0x4acb('0x7')]=_0x1985b2[_0x4acb('0x7')];this[_0x4acb('0x8')]=_0x1985b2[_0x4acb('0x8')];this[_0x4acb('0x9')]=_0x1985b2['type']==='outbound'?_0x4acb('0xa'):_0x1985b2[_0x4acb('0x8')];this['countbusyretry']=_0x1985b2['countbusyretry'];this[_0x4acb('0xb')]=_0x1985b2[_0x4acb('0xb')];this[_0x4acb('0xc')]=_0x1985b2[_0x4acb('0xc')];this[_0x4acb('0xd')]=_0x1985b2[_0x4acb('0xe')]+_0x1985b2['countcongestionretry']+_0x1985b2[_0x4acb('0xc')]+_0x1985b2['countnosuchnumberretry']+_0x1985b2[_0x4acb('0xf')]+_0x1985b2[_0x4acb('0x10')]+_0x1985b2[_0x4acb('0x11')]+_0x1985b2[_0x4acb('0x12')];this['countnosuchnumberretry']=_0x1985b2[_0x4acb('0x13')];this['countdropretry']=_0x1985b2[_0x4acb('0xf')];this[_0x4acb('0x10')]=_0x1985b2[_0x4acb('0x10')];this[_0x4acb('0x11')]=_0x1985b2['countmachineretry'];this[_0x4acb('0x12')]=_0x1985b2['countagentrejectretry'];this[_0x4acb('0x14')]=_0x47efac[_0x4acb('0x14')];this[_0x4acb('0x15')]=_0x1985b2[_0x4acb('0x16')];this[_0x4acb('0x17')]=_0x1985b2[_0x4acb('0x18')];this[_0x4acb('0x19')]=_0x1985b2[_0x4acb('0x19')];this[_0x4acb('0x1a')]=_0x1985b2[_0x4acb('0x1a')];this[_0x4acb('0x1b')]=_0x1985b2[_0x4acb('0x1b')];this[_0x4acb('0x1c')]=moment()[_0x4acb('0x1d')](_0x4acb('0x1e'));this['ringtime']=getSeconds(_0x1985b2['responsetime'],_0x1985b2[_0x4acb('0x19')]);this[_0x4acb('0x1f')]=getSeconds(_0x1985b2['answertime'],_0x1985b2[_0x4acb('0x1a')]);this[_0x4acb('0x20')]=getSeconds(this[_0x4acb('0x1c')],_0x1985b2['answertime']);this['queue']=_0x47efac[_0x4acb('0xa')];this[_0x4acb('0x21')]=_0x47efac[_0x4acb('0x21')];this[_0x4acb('0x22')]=_0x47efac['reason'];this['callback']=_0x1985b2[_0x4acb('0x23')];this[_0x4acb('0x24')]=_0x1985b2[_0x4acb('0x24')];this[_0x4acb('0x25')]=_0x1985b2['callbackat'];this[_0x4acb('0x26')]=_0x1985b2[_0x4acb('0x26')];this[_0x4acb('0x27')]=_0x1985b2[_0x4acb('0x27')];this[_0x4acb('0x28')]=_0x1985b2[_0x4acb('0x28')];this[_0x4acb('0x29')]=_0x1985b2[_0x4acb('0x29')];this[_0x4acb('0x2a')]=_0x1985b2['VoiceQueueId'];this[_0x4acb('0x2b')]=_0x1985b2[_0x4acb('0x2b')];this[_0x4acb('0x2c')]=_0x1985b2[_0x4acb('0x2c')]||'';this[_0x4acb('0x2d')]=_0x1985b2[_0x4acb('0x2d')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x1046=['countagentrejectretry','uniqueid','calleridname','name','number','responsetime','answertime','endtime','format','starttime','holdtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x1046,0x126));var _0x6104=function(_0x12d031,_0x51f07a){_0x12d031=_0x12d031-0x0;var _0x4bd9ca=_0x1046[_0x12d031];return _0x4bd9ca;};'use strict';var util=require(_0x6104('0x0'));var _=require(_0x6104('0x1'));var moment=require(_0x6104('0x2'));function getSeconds(_0x5c9a79,_0x5485aa){var _0x1641e0=moment(_0x5c9a79)[_0x6104('0x3')](0x0);var _0x482dd3=moment(_0x5485aa)['milliseconds'](0x0);return _0x1641e0[_0x6104('0x4')](_0x482dd3,_0x6104('0x5'));}function AgentComplete(_0x25ba2a,_0x3a7281){this[_0x6104('0x6')]=0x4;this[_0x6104('0x7')]='Answer';this[_0x6104('0x8')]=_0x25ba2a[_0x6104('0x8')];this[_0x6104('0x9')]=_0x25ba2a['type'];this[_0x6104('0xa')]=_0x25ba2a[_0x6104('0x9')]===_0x6104('0xb')?_0x6104('0xc'):_0x25ba2a[_0x6104('0x9')];this[_0x6104('0xd')]=_0x25ba2a[_0x6104('0xd')];this[_0x6104('0xe')]=_0x25ba2a[_0x6104('0xe')];this[_0x6104('0xf')]=_0x25ba2a['countnoanswerretry'];this[_0x6104('0x10')]=_0x25ba2a[_0x6104('0xd')]+_0x25ba2a['countcongestionretry']+_0x25ba2a[_0x6104('0xf')]+_0x25ba2a[_0x6104('0x11')]+_0x25ba2a[_0x6104('0x12')]+_0x25ba2a[_0x6104('0x13')]+_0x25ba2a[_0x6104('0x14')]+_0x25ba2a[_0x6104('0x15')];this[_0x6104('0x11')]=_0x25ba2a[_0x6104('0x11')];this[_0x6104('0x12')]=_0x25ba2a[_0x6104('0x12')];this[_0x6104('0x13')]=_0x25ba2a[_0x6104('0x13')];this[_0x6104('0x14')]=_0x25ba2a['countmachineretry'];this[_0x6104('0x15')]=_0x25ba2a[_0x6104('0x15')];this[_0x6104('0x16')]=_0x3a7281[_0x6104('0x16')];this[_0x6104('0x17')]=_0x25ba2a[_0x6104('0x18')];this['calleridnum']=_0x25ba2a[_0x6104('0x19')];this['starttime']=_0x25ba2a['starttime'];this[_0x6104('0x1a')]=_0x25ba2a[_0x6104('0x1a')];this[_0x6104('0x1b')]=_0x25ba2a[_0x6104('0x1b')];this[_0x6104('0x1c')]=moment()[_0x6104('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x25ba2a[_0x6104('0x1a')],_0x25ba2a[_0x6104('0x1e')]);this[_0x6104('0x1f')]=getSeconds(_0x25ba2a[_0x6104('0x1b')],_0x25ba2a[_0x6104('0x1a')]);this[_0x6104('0x20')]=getSeconds(this[_0x6104('0x1c')],_0x25ba2a['answertime']);this[_0x6104('0xc')]=_0x3a7281[_0x6104('0xc')];this[_0x6104('0x21')]=_0x3a7281[_0x6104('0x21')];this[_0x6104('0x22')]=_0x3a7281[_0x6104('0x22')];this['callback']=_0x25ba2a['callback'];this[_0x6104('0x23')]=_0x25ba2a[_0x6104('0x23')];this[_0x6104('0x24')]=_0x25ba2a['callbackat'];this[_0x6104('0x25')]=_0x25ba2a[_0x6104('0x25')];this['ContactId']=_0x25ba2a[_0x6104('0x26')];this[_0x6104('0x27')]=_0x25ba2a[_0x6104('0x27')];this[_0x6104('0x28')]=_0x25ba2a[_0x6104('0x28')];this[_0x6104('0x29')]=_0x25ba2a['VoiceQueueId'];this[_0x6104('0x2a')]=_0x25ba2a[_0x6104('0x2a')];this[_0x6104('0x2b')]=_0x25ba2a[_0x6104('0x2b')]||'';this['originatecalleridname']=_0x25ba2a[_0x6104('0x2c')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e71a4cb..d08e15e 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7118=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime'];(function(_0x588783,_0x550af0){var _0x146ed6=function(_0x27ffe9){while(--_0x27ffe9){_0x588783['push'](_0x588783['shift']());}};_0x146ed6(++_0x550af0);}(_0x7118,0x159));var _0x8711=function(_0x342143,_0x416fbb){_0x342143=_0x342143-0x0;var _0x50cc24=_0x7118[_0x342143];return _0x50cc24;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x8711('0x0'));function getSeconds(_0xf50b2e,_0x5c64d4){var _0x1758c5=moment(_0xf50b2e)[_0x8711('0x1')](0x0);var _0x348e88=moment(_0x5c64d4)[_0x8711('0x1')](0x0);return _0x1758c5[_0x8711('0x2')](_0x348e88,_0x8711('0x3'));}function Final(_0x206b82){this['uniqueid']=_0x206b82[_0x8711('0x4')];this[_0x8711('0x5')]=_0x206b82[_0x8711('0x5')];this[_0x8711('0x6')]=_0x206b82[_0x8711('0x6')];this[_0x8711('0x7')]=_0x206b82[_0x8711('0x6')]===_0x8711('0x8')?_0x8711('0x9'):_0x206b82[_0x8711('0x6')];this[_0x8711('0xa')]=_0x206b82['countbusyretry'];this['countcongestionretry']=_0x206b82[_0x8711('0xb')];this[_0x8711('0xc')]=_0x206b82[_0x8711('0xc')];this['countglobal']=_0x206b82['countbusyretry']+_0x206b82[_0x8711('0xb')]+_0x206b82[_0x8711('0xc')]+_0x206b82['countnosuchnumberretry']+_0x206b82['countdropretry']+_0x206b82[_0x8711('0xd')]+_0x206b82[_0x8711('0xe')]+_0x206b82[_0x8711('0xf')];this[_0x8711('0x10')]=_0x206b82[_0x8711('0x10')];this[_0x8711('0x11')]=_0x206b82[_0x8711('0x11')];this['countabandonedretry']=_0x206b82[_0x8711('0xd')];this[_0x8711('0xe')]=_0x206b82[_0x8711('0xe')];this[_0x8711('0xf')]=_0x206b82[_0x8711('0xf')];this[_0x8711('0x9')]=_0x206b82['queue'];this[_0x8711('0x12')]=_0x206b82[_0x8711('0x12')];this[_0x8711('0x13')]=_0x206b82[_0x8711('0x13')];this[_0x8711('0x14')]=_0x206b82['starttime'];this['responsetime']=_0x206b82['responsetime'];this[_0x8711('0x15')]=_0x206b82[_0x8711('0x16')];this[_0x8711('0x17')]=_0x206b82['ringtime']||0x0;this['holdtime']=_0x206b82[_0x8711('0x18')]||0x0;this[_0x8711('0x19')]=_0x206b82[_0x8711('0x19')]||0x0;this[_0x8711('0x1a')]=_0x206b82[_0x8711('0x1a')];this[_0x8711('0x1b')]=_0x206b82[_0x8711('0x1b')];this[_0x8711('0x1c')]=_0x206b82[_0x8711('0x1c')];this[_0x8711('0x1d')]=_0x206b82['recallme'];this[_0x8711('0x1e')]=_0x206b82[_0x8711('0x1e')];this[_0x8711('0x1f')]=_0x206b82[_0x8711('0x1f')];this['UserId']=_0x206b82[_0x8711('0x20')];this[_0x8711('0x21')]=_0x206b82[_0x8711('0x21')];this['CampaignId']=_0x206b82[_0x8711('0x22')];this[_0x8711('0x23')]=_0x206b82[_0x8711('0x23')]||'';this[_0x8711('0x24')]=_0x206b82[_0x8711('0x24')]||'';}module['exports']=Final; \ No newline at end of file +var _0x3e74=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','starttime','responsetime','endtime','ringtime'];(function(_0x141599,_0x5624b9){var _0x47997b=function(_0x201758){while(--_0x201758){_0x141599['push'](_0x141599['shift']());}};_0x47997b(++_0x5624b9);}(_0x3e74,0x175));var _0x43e7=function(_0x3315ad,_0x2b684a){_0x3315ad=_0x3315ad-0x0;var _0x5188e2=_0x3e74[_0x3315ad];return _0x5188e2;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var moment=require(_0x43e7('0x1'));function getSeconds(_0x287a1d,_0x151ad2){var _0x494e45=moment(_0x287a1d)['milliseconds'](0x0);var _0xc58479=moment(_0x151ad2)['milliseconds'](0x0);return _0x494e45[_0x43e7('0x2')](_0xc58479,_0x43e7('0x3'));}function Final(_0xe78cb7){this[_0x43e7('0x4')]=_0xe78cb7[_0x43e7('0x4')];this['scheduledat']=_0xe78cb7[_0x43e7('0x5')];this[_0x43e7('0x6')]=_0xe78cb7[_0x43e7('0x6')];this[_0x43e7('0x7')]=_0xe78cb7[_0x43e7('0x6')]==='outbound'?_0x43e7('0x8'):_0xe78cb7['type'];this['countbusyretry']=_0xe78cb7[_0x43e7('0x9')];this[_0x43e7('0xa')]=_0xe78cb7['countcongestionretry'];this[_0x43e7('0xb')]=_0xe78cb7['countnoanswerretry'];this[_0x43e7('0xc')]=_0xe78cb7[_0x43e7('0x9')]+_0xe78cb7['countcongestionretry']+_0xe78cb7[_0x43e7('0xb')]+_0xe78cb7[_0x43e7('0xd')]+_0xe78cb7[_0x43e7('0xe')]+_0xe78cb7[_0x43e7('0xf')]+_0xe78cb7['countmachineretry']+_0xe78cb7['countagentrejectretry'];this[_0x43e7('0xd')]=_0xe78cb7[_0x43e7('0xd')];this[_0x43e7('0xe')]=_0xe78cb7['countdropretry'];this['countabandonedretry']=_0xe78cb7[_0x43e7('0xf')];this[_0x43e7('0x10')]=_0xe78cb7[_0x43e7('0x10')];this[_0x43e7('0x11')]=_0xe78cb7['countagentrejectretry'];this['queue']=_0xe78cb7[_0x43e7('0x8')];this[_0x43e7('0x12')]=_0xe78cb7[_0x43e7('0x12')];this['calleridnum']=_0xe78cb7['calleridnum'];this[_0x43e7('0x13')]=_0xe78cb7[_0x43e7('0x13')];this[_0x43e7('0x14')]=_0xe78cb7[_0x43e7('0x14')];this[_0x43e7('0x15')]=_0xe78cb7[_0x43e7('0x14')];this[_0x43e7('0x16')]=_0xe78cb7[_0x43e7('0x16')]||0x0;this[_0x43e7('0x17')]=_0xe78cb7[_0x43e7('0x17')]||0x0;this[_0x43e7('0x18')]=_0xe78cb7[_0x43e7('0x18')]||0x0;this['callback']=_0xe78cb7[_0x43e7('0x19')];this[_0x43e7('0x1a')]=_0xe78cb7['callbackuniqueid'];this[_0x43e7('0x1b')]=_0xe78cb7[_0x43e7('0x1b')];this[_0x43e7('0x1c')]=_0xe78cb7[_0x43e7('0x1c')];this[_0x43e7('0x1d')]=_0xe78cb7[_0x43e7('0x1d')];this['ListId']=_0xe78cb7[_0x43e7('0x1e')];this['UserId']=_0xe78cb7['UserId'];this[_0x43e7('0x1f')]=_0xe78cb7[_0x43e7('0x1f')];this['CampaignId']=_0xe78cb7[_0x43e7('0x20')];this['originatecalleridnum']=_0xe78cb7[_0x43e7('0x21')]||'';this['originatecalleridname']=_0xe78cb7[_0x43e7('0x22')]||'';}module[_0x43e7('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index fe6c19e..049ef93 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb580=['recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','lodash','moment','milliseconds','seconds','state','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','IVR','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x33443b,_0x3ffdf6){var _0x228f8b=function(_0x176b71){while(--_0x176b71){_0x33443b['push'](_0x33443b['shift']());}};_0x228f8b(++_0x3ffdf6);}(_0xb580,0x1e6));var _0x0b58=function(_0x4df188,_0x355add){_0x4df188=_0x4df188-0x0;var _0xbbdc5=_0xb580[_0x4df188];return _0xbbdc5;};'use strict';var util=require(_0x0b58('0x0'));var _=require(_0x0b58('0x1'));var moment=require(_0x0b58('0x2'));function getSeconds(_0x578198,_0x59a188){var _0x180a50=moment(_0x578198)[_0x0b58('0x3')](0x0);var _0x1b8083=moment(_0x59a188)['milliseconds'](0x0);return _0x180a50['diff'](_0x1b8083,_0x0b58('0x4'));}function Hangup(_0x3bc151,_0x593d15){this[_0x0b58('0x5')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x3bc151[_0x0b58('0x6')];this[_0x0b58('0x7')]=_0x3bc151[_0x0b58('0x7')];this['campaigntype']=_0x3bc151[_0x0b58('0x7')]===_0x0b58('0x8')?'queue':_0x3bc151[_0x0b58('0x7')];this['countbusyretry']=_0x3bc151[_0x0b58('0x9')];this[_0x0b58('0xa')]=_0x3bc151[_0x0b58('0xa')];this[_0x0b58('0xb')]=_0x3bc151[_0x0b58('0xb')];this[_0x0b58('0xc')]=_0x3bc151[_0x0b58('0x9')]+_0x3bc151[_0x0b58('0xa')]+_0x3bc151['countnoanswerretry']+_0x3bc151[_0x0b58('0xd')]+_0x3bc151[_0x0b58('0xe')]+_0x3bc151['countabandonedretry']+_0x3bc151['countmachineretry']+_0x3bc151[_0x0b58('0xf')];this['countnosuchnumberretry']=_0x3bc151[_0x0b58('0xd')];this[_0x0b58('0xe')]=_0x3bc151[_0x0b58('0xe')];this[_0x0b58('0x10')]=_0x3bc151['countabandonedretry'];this['countmachineretry']=_0x3bc151[_0x0b58('0x11')];this[_0x0b58('0xf')]=_0x3bc151[_0x0b58('0xf')];this[_0x0b58('0x12')]=_0x593d15[_0x0b58('0x12')];this['calleridname']=_0x3bc151[_0x0b58('0x13')];this[_0x0b58('0x14')]=_0x3bc151[_0x0b58('0x15')];this['starttime']=_0x3bc151[_0x0b58('0x16')];this[_0x0b58('0x17')]=_0x3bc151['responsetime'];this[_0x0b58('0x18')]=moment()['format'](_0x0b58('0x19'));this[_0x0b58('0x1a')]=getSeconds(_0x3bc151[_0x0b58('0x17')],_0x3bc151[_0x0b58('0x16')]);this['holdtime']=0x0;this[_0x0b58('0x1b')]=getSeconds(this[_0x0b58('0x18')],_0x3bc151['responsetime']);this[_0x0b58('0x1c')]=_0x3bc151[_0x0b58('0x1c')];this['membername']=_0x0b58('0x1d');this['reason']=_0x593d15[_0x0b58('0x1e')];this[_0x0b58('0x1f')]=_0x3bc151[_0x0b58('0x1f')];this[_0x0b58('0x20')]=_0x3bc151[_0x0b58('0x20')];this[_0x0b58('0x21')]=_0x3bc151[_0x0b58('0x21')];this[_0x0b58('0x22')]=_0x3bc151[_0x0b58('0x22')];this[_0x0b58('0x23')]=_0x3bc151[_0x0b58('0x23')];this[_0x0b58('0x24')]=_0x3bc151[_0x0b58('0x24')];this[_0x0b58('0x25')]=_0x3bc151[_0x0b58('0x25')];this['VoiceQueueId']=_0x3bc151[_0x0b58('0x26')];this['CampaignId']=_0x3bc151['CampaignId'];}module[_0x0b58('0x27')]=Hangup; \ No newline at end of file +var _0x8f8a=['diff','seconds','state','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds'];(function(_0x88c91a,_0x5066ee){var _0x1c86f2=function(_0x413fa1){while(--_0x413fa1){_0x88c91a['push'](_0x88c91a['shift']());}};_0x1c86f2(++_0x5066ee);}(_0x8f8a,0x7d));var _0xa8f8=function(_0x10993e,_0x547aa9){_0x10993e=_0x10993e-0x0;var _0x683146=_0x8f8a[_0x10993e];return _0x683146;};'use strict';var util=require(_0xa8f8('0x0'));var _=require(_0xa8f8('0x1'));var moment=require(_0xa8f8('0x2'));function getSeconds(_0xd9abb9,_0x578101){var _0x269268=moment(_0xd9abb9)[_0xa8f8('0x3')](0x0);var _0xc94c12=moment(_0x578101)[_0xa8f8('0x3')](0x0);return _0x269268[_0xa8f8('0x4')](_0xc94c12,_0xa8f8('0x5'));}function Hangup(_0xd29e61,_0x121d29){this[_0xa8f8('0x6')]=0x4;this[_0xa8f8('0x7')]=_0xa8f8('0x8');this['scheduledat']=_0xd29e61['scheduledat'];this['type']=_0xd29e61[_0xa8f8('0x9')];this[_0xa8f8('0xa')]=_0xd29e61['type']===_0xa8f8('0xb')?_0xa8f8('0xc'):_0xd29e61['type'];this[_0xa8f8('0xd')]=_0xd29e61[_0xa8f8('0xd')];this['countcongestionretry']=_0xd29e61['countcongestionretry'];this[_0xa8f8('0xe')]=_0xd29e61[_0xa8f8('0xe')];this['countglobal']=_0xd29e61[_0xa8f8('0xd')]+_0xd29e61[_0xa8f8('0xf')]+_0xd29e61[_0xa8f8('0xe')]+_0xd29e61['countnosuchnumberretry']+_0xd29e61[_0xa8f8('0x10')]+_0xd29e61[_0xa8f8('0x11')]+_0xd29e61[_0xa8f8('0x12')]+_0xd29e61[_0xa8f8('0x13')];this['countnosuchnumberretry']=_0xd29e61['countnosuchnumberretry'];this[_0xa8f8('0x10')]=_0xd29e61[_0xa8f8('0x10')];this[_0xa8f8('0x11')]=_0xd29e61['countabandonedretry'];this['countmachineretry']=_0xd29e61['countmachineretry'];this[_0xa8f8('0x13')]=_0xd29e61[_0xa8f8('0x13')];this[_0xa8f8('0x14')]=_0x121d29[_0xa8f8('0x14')];this[_0xa8f8('0x15')]=_0xd29e61[_0xa8f8('0x16')];this[_0xa8f8('0x17')]=_0xd29e61[_0xa8f8('0x18')];this['starttime']=_0xd29e61[_0xa8f8('0x19')];this[_0xa8f8('0x1a')]=_0xd29e61[_0xa8f8('0x1a')];this[_0xa8f8('0x1b')]=moment()[_0xa8f8('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa8f8('0x1d')]=getSeconds(_0xd29e61[_0xa8f8('0x1a')],_0xd29e61[_0xa8f8('0x19')]);this[_0xa8f8('0x1e')]=0x0;this[_0xa8f8('0x1f')]=getSeconds(this[_0xa8f8('0x1b')],_0xd29e61[_0xa8f8('0x1a')]);this[_0xa8f8('0xc')]=_0xd29e61[_0xa8f8('0xc')];this['membername']=_0xa8f8('0x20');this[_0xa8f8('0x21')]=_0x121d29['cause-txt'];this[_0xa8f8('0x22')]=_0xd29e61[_0xa8f8('0x22')];this[_0xa8f8('0x23')]=_0xd29e61[_0xa8f8('0x23')];this[_0xa8f8('0x24')]=_0xd29e61['callbackat'];this[_0xa8f8('0x25')]=_0xd29e61[_0xa8f8('0x25')];this[_0xa8f8('0x26')]=_0xd29e61[_0xa8f8('0x26')];this[_0xa8f8('0x27')]=_0xd29e61[_0xa8f8('0x27')];this['UserId']=_0xd29e61[_0xa8f8('0x28')];this[_0xa8f8('0x29')]=_0xd29e61[_0xa8f8('0x29')];this[_0xa8f8('0x2a')]=_0xd29e61['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 6653dc2..52fd3df 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8be7=['campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackat','recallme','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','diff','seconds','uniqueid','scheduledat','type'];(function(_0x58a7c4,_0x164298){var _0x3906fa=function(_0x1741ec){while(--_0x1741ec){_0x58a7c4['push'](_0x58a7c4['shift']());}};_0x3906fa(++_0x164298);}(_0x8be7,0x82));var _0x78be=function(_0x87867b,_0x2cc4fb){_0x87867b=_0x87867b-0x0;var _0xc95e2e=_0x8be7[_0x87867b];return _0xc95e2e;};'use strict';var util=require(_0x78be('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x933a28,_0x188461){var _0x32d1e1=moment(_0x933a28)['milliseconds'](0x0);var _0x1c4bde=moment(_0x188461)['milliseconds'](0x0);return _0x32d1e1[_0x78be('0x1')](_0x1c4bde,_0x78be('0x2'));}function History(_0x5c0862){this[_0x78be('0x3')]=_0x5c0862[_0x78be('0x3')];this['scheduledat']=_0x5c0862[_0x78be('0x4')]||undefined;this[_0x78be('0x5')]=_0x5c0862['type'];this[_0x78be('0x6')]=_0x5c0862[_0x78be('0x5')]==='outbound'?_0x78be('0x7'):_0x5c0862[_0x78be('0x5')];this['countbusyretry']=_0x5c0862[_0x78be('0x8')];this[_0x78be('0x9')]=_0x5c0862['countcongestionretry'];this[_0x78be('0xa')]=_0x5c0862['countnoanswerretry'];this['countglobal']=_0x5c0862['countbusyretry']+_0x5c0862[_0x78be('0x9')]+_0x5c0862[_0x78be('0xa')]+_0x5c0862[_0x78be('0xb')]+_0x5c0862[_0x78be('0xc')]+_0x5c0862[_0x78be('0xd')]+_0x5c0862[_0x78be('0xe')]+_0x5c0862[_0x78be('0xf')];this[_0x78be('0xb')]=_0x5c0862[_0x78be('0xb')];this['countdropretry']=_0x5c0862[_0x78be('0xc')];this[_0x78be('0xd')]=_0x5c0862[_0x78be('0xd')];this[_0x78be('0xe')]=_0x5c0862[_0x78be('0xe')];this[_0x78be('0xf')]=_0x5c0862['countagentrejectretry'];this[_0x78be('0x7')]=_0x5c0862[_0x78be('0x7')];this[_0x78be('0x10')]=_0x5c0862[_0x78be('0x11')];this[_0x78be('0x12')]=_0x5c0862[_0x78be('0x13')];this[_0x78be('0x14')]=_0x5c0862[_0x78be('0x14')];this[_0x78be('0x15')]=_0x5c0862['responsetime'];this[_0x78be('0x16')]=_0x5c0862[_0x78be('0x15')];this[_0x78be('0x17')]=getSeconds(_0x5c0862[_0x78be('0x15')],_0x5c0862[_0x78be('0x14')]);this['holdtime']=0x0;this[_0x78be('0x18')]=0x0;this[_0x78be('0x19')]=_0x5c0862[_0x78be('0x19')];this['callbackuniqueid']=_0x5c0862['callbackuniqueid'];this[_0x78be('0x1a')]=_0x5c0862[_0x78be('0x1a')];this['recallme']=_0x5c0862[_0x78be('0x1b')];this['ContactId']=_0x5c0862['ContactId'];this[_0x78be('0x1c')]=_0x5c0862[_0x78be('0x1c')];this[_0x78be('0x1d')]=_0x5c0862[_0x78be('0x1d')];this['VoiceQueueId']=_0x5c0862['VoiceQueueId'];this[_0x78be('0x1e')]=_0x5c0862[_0x78be('0x1e')];this['originatecalleridnum']=_0x5c0862[_0x78be('0x1f')]||'';this['originatecalleridname']=_0x5c0862[_0x78be('0x20')]||'';}module[_0x78be('0x21')]=History; \ No newline at end of file +var _0xa8c8=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0xa8c8,0x169));var _0x8a8c=function(_0x2aa255,_0x1e1d82){_0x2aa255=_0x2aa255-0x0;var _0x1df95b=_0xa8c8[_0x2aa255];return _0x1df95b;};'use strict';var util=require(_0x8a8c('0x0'));var _=require(_0x8a8c('0x1'));var moment=require('moment');function getSeconds(_0x11da14,_0x5cc0c6){var _0x34a154=moment(_0x11da14)[_0x8a8c('0x2')](0x0);var _0x3b629f=moment(_0x5cc0c6)[_0x8a8c('0x2')](0x0);return _0x34a154[_0x8a8c('0x3')](_0x3b629f,_0x8a8c('0x4'));}function History(_0x39c379){this[_0x8a8c('0x5')]=_0x39c379[_0x8a8c('0x5')];this['scheduledat']=_0x39c379[_0x8a8c('0x6')]||undefined;this['type']=_0x39c379[_0x8a8c('0x7')];this[_0x8a8c('0x8')]=_0x39c379[_0x8a8c('0x7')]===_0x8a8c('0x9')?'queue':_0x39c379['type'];this[_0x8a8c('0xa')]=_0x39c379[_0x8a8c('0xa')];this[_0x8a8c('0xb')]=_0x39c379[_0x8a8c('0xb')];this[_0x8a8c('0xc')]=_0x39c379[_0x8a8c('0xc')];this[_0x8a8c('0xd')]=_0x39c379['countbusyretry']+_0x39c379[_0x8a8c('0xb')]+_0x39c379[_0x8a8c('0xc')]+_0x39c379['countnosuchnumberretry']+_0x39c379[_0x8a8c('0xe')]+_0x39c379[_0x8a8c('0xf')]+_0x39c379['countmachineretry']+_0x39c379['countagentrejectretry'];this[_0x8a8c('0x10')]=_0x39c379['countnosuchnumberretry'];this[_0x8a8c('0xe')]=_0x39c379[_0x8a8c('0xe')];this[_0x8a8c('0xf')]=_0x39c379['countabandonedretry'];this[_0x8a8c('0x11')]=_0x39c379[_0x8a8c('0x11')];this[_0x8a8c('0x12')]=_0x39c379['countagentrejectretry'];this[_0x8a8c('0x13')]=_0x39c379['queue'];this[_0x8a8c('0x14')]=_0x39c379[_0x8a8c('0x15')];this[_0x8a8c('0x16')]=_0x39c379[_0x8a8c('0x17')];this[_0x8a8c('0x18')]=_0x39c379[_0x8a8c('0x18')];this[_0x8a8c('0x19')]=_0x39c379[_0x8a8c('0x19')];this[_0x8a8c('0x1a')]=_0x39c379[_0x8a8c('0x19')];this[_0x8a8c('0x1b')]=getSeconds(_0x39c379[_0x8a8c('0x19')],_0x39c379[_0x8a8c('0x18')]);this[_0x8a8c('0x1c')]=0x0;this['talktime']=0x0;this['callback']=_0x39c379['callback'];this['callbackuniqueid']=_0x39c379[_0x8a8c('0x1d')];this[_0x8a8c('0x1e')]=_0x39c379[_0x8a8c('0x1e')];this[_0x8a8c('0x1f')]=_0x39c379['recallme'];this[_0x8a8c('0x20')]=_0x39c379['ContactId'];this[_0x8a8c('0x21')]=_0x39c379[_0x8a8c('0x21')];this[_0x8a8c('0x22')]=_0x39c379[_0x8a8c('0x22')];this[_0x8a8c('0x23')]=_0x39c379[_0x8a8c('0x23')];this[_0x8a8c('0x24')]=_0x39c379[_0x8a8c('0x24')];this[_0x8a8c('0x25')]=_0x39c379[_0x8a8c('0x25')]||'';this['originatecalleridname']=_0x39c379[_0x8a8c('0x26')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index df4fe14..15132a0 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 _0x3b6e=['syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','stringify','milliseconds','diff','seconds','emit','outbound','answered','available','loggedIn','pTalking','sumBillable','total','type','unmanaged','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','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---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','starttime','clearZombieChannels','[uniqueid]','undefined','isNil','Action','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','resolve','catch','[countReScheduled]\x20','checkIsBlackList','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','then','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','status','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','membername','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','AMD','countglobal','countabandonedretry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','dialQueueProject','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','Drop','dropreason','TIMEOUT','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','dialDropRetryFrequency','endtime','calleridname','calleridnum','Abandoned','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','strategy','actionid','locked','paused','stateinterface','queueBooked','idHopper','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','Agent:\x20','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','content','indexOf','true','timezones','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','checkDialMethod','dialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','dialGlobalInterval','dialTimezone','dialPreviewRecallmeReminder','checkIfTime','[syncCampaigns]','\x5cw{0,','pow','replace','match','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','createdAt','updatedAt','%s%s','XMD-','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','dialNoAnswerRetryFrequency','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','recallme','queueStatusComplete','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','reachable','dialOrderByScheduledAt','countReScheduled','ACTIVE','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','--------\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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','Umin:\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','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','moment','md5','ioredis','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','socket.io-emitter','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./history','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3b6e,0x1ea));var _0xe3b6=function(_0x19337f,_0x3e3ff4){_0x19337f=_0x19337f-0x0;var _0x1b89fa=_0x3b6e[_0x19337f];return _0x1b89fa;};'use strict';var util=require(_0xe3b6('0x0'));var _=require(_0xe3b6('0x1'));var BPromise=require(_0xe3b6('0x2'));var uuid=require('uuid');var moment=require(_0xe3b6('0x3'));var rr=require('rr');var md5=require(_0xe3b6('0x4'));var Redis=require(_0xe3b6('0x5'));var ut=require('../preview/util/util');var config=require(_0xe3b6('0x6'));var logger=require('../../../config/logger')(_0xe3b6('0x7'));var loggerBooked=require(_0xe3b6('0x8'))(_0xe3b6('0x9'));var loggerPredictive=require(_0xe3b6('0x8'))(_0xe3b6('0xa'));var loggerPredictiveCalls=require(_0xe3b6('0x8'))(_0xe3b6('0xb'));var loggerSyncQueueSummary=require(_0xe3b6('0x8'))(_0xe3b6('0xc'));var ami=require(_0xe3b6('0xd'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe3b6('0xe'))(new Redis(config[_0xe3b6('0xf')]));var cmHopper=require(_0xe3b6('0x10'));var cmHopperHistory=require(_0xe3b6('0x11'));var cmHopperFinal=require(_0xe3b6('0x12'));var cmHopperAdditionalPhone=require(_0xe3b6('0x13'));var cmHopperBlack=require(_0xe3b6('0x14'));var voiceQueueRt=require(_0xe3b6('0x15'));var RpcSetting=require(_0xe3b6('0x16'));var Action=require('./action');var History=require(_0xe3b6('0x17'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xe3b6('0x18'));var Hangup=require(_0xe3b6('0x19'));var ipAgi=process[_0xe3b6('0x1a')][_0xe3b6('0x1b')]||_0xe3b6('0x1c');var strategy={'rrmemory':_0xe3b6('0x1d'),'roundrobin':_0xe3b6('0x1e')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xe3b6('0x1f')][_0xe3b6('0x20')]=function(_0x148e5c){this['tail']=this[_0xe3b6('0x21')]?this[_0xe3b6('0x21')]['finally'](_0x148e5c):_0x148e5c();};function Dialer(_0x2304ce,_0x112c12){this['sequence']=new Sequence();this[_0xe3b6('0x22')]=_0x112c12;this[_0xe3b6('0x23')]=_0x2304ce[_0xe3b6('0x23')];this[_0xe3b6('0x24')]=_0x2304ce['campaigns'];this[_0xe3b6('0x25')]=_0x2304ce[_0xe3b6('0x25')];this[_0xe3b6('0x26')]=_0x2304ce[_0xe3b6('0x26')];this[_0xe3b6('0x27')]=config['maxNumberOriginate']||0x2;this[_0xe3b6('0x28')]={};this['actions']={};this[_0xe3b6('0x29')]={};this[_0xe3b6('0x2a')]={};this[_0xe3b6('0x2b')]={};this[_0xe3b6('0x2c')]={};this[_0xe3b6('0x2d')]={};this[_0xe3b6('0x2e')]={};this['queueBooked']={};this[_0xe3b6('0x2f')]={};ami['on'](_0xe3b6('0x30'),this[_0xe3b6('0x31')][_0xe3b6('0x32')](this));ami['on'](_0xe3b6('0x33'),this[_0xe3b6('0x34')]['bind'](this));ami['on']('originateresponse',this[_0xe3b6('0x35')][_0xe3b6('0x32')](this));ami['on'](_0xe3b6('0x36'),this[_0xe3b6('0x37')][_0xe3b6('0x32')](this));ami['on'](_0xe3b6('0x38'),this[_0xe3b6('0xc')][_0xe3b6('0x32')](this));ami['on'](_0xe3b6('0x39'),this[_0xe3b6('0x3a')][_0xe3b6('0x32')](this));ami['on'](_0xe3b6('0x3b'),this[_0xe3b6('0x3c')][_0xe3b6('0x32')](this));ami['on'](_0xe3b6('0x3d'),this[_0xe3b6('0x3e')][_0xe3b6('0x32')](this));ami['on'](_0xe3b6('0x3f'),this[_0xe3b6('0x40')][_0xe3b6('0x32')](this));ami['on'](_0xe3b6('0x41'),this[_0xe3b6('0x42')][_0xe3b6('0x32')](this));this[_0xe3b6('0x43')]();this['loopClearZombieChannels']();RpcSetting[_0xe3b6('0x44')]()['then'](function(_0x1241e3){previewRecallmeReminderInterval=_0x1241e3[_0xe3b6('0x45')];});}function isNotNull(_0x106dbe){return _0x106dbe!==null&&!_[_0xe3b6('0x46')](_0x106dbe);}function checkIsLoggedIn(_0x467e98,_0x5ab5e){return function(){if(_0x5ab5e<=0x0){_0x467e98[_0xe3b6('0x47')]=_0xe3b6('0x48');throw _0x467e98[_0xe3b6('0x49')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x517a03){return _0x517a03;}function checkIsActive(_0x57f3c2,_0xac84c5){return function(){if(!isActive(_0xac84c5)){_0x57f3c2['message']='NOT_ACTIVE';throw _0x57f3c2[_0xe3b6('0x49')]+_0xe3b6('0x4a');}};}function checkInterval(_0x15437e){return function(){if(!isNotNull(_0x15437e[_0xe3b6('0x4b')])){_0x15437e['message']=_0xe3b6('0x4c');throw _0x15437e['name']+_0xe3b6('0x4d');}if(!isNotNull(_0x15437e[_0xe3b6('0x4b')][_0xe3b6('0x4e')])){_0x15437e[_0xe3b6('0x47')]=_0xe3b6('0x4c');throw _0x15437e['name']+_0xe3b6('0x4d');}if(!isNotNull(_[_0xe3b6('0x4f')](_0x15437e['Interval'][_0xe3b6('0x4e')]))){_0x15437e['message']=_0xe3b6('0x4c');throw _0x15437e[_0xe3b6('0x49')]+_0xe3b6('0x4d');}};}function msgResponse(_0x19c6c0,_0x4fdbcf,_0x1a68d){return{'action':_0x19c6c0,'response':_0x4fdbcf,'message':_0x1a68d,'stack':_0x1a68d};}function myreject(_0x7515c0){return function(_0x25da77){return _0x7515c0(msgResponse('[ifTime][Action]','Error',JSON[_0xe3b6('0x50')](_0x25da77)));};}function getSeconds(_0x2e3fd7,_0x2d984c){var _0x5a0440=moment(_0x2e3fd7)[_0xe3b6('0x51')](0x0);var _0x3d2e49=moment(_0x2d984c)[_0xe3b6('0x51')](0x0);return _0x5a0440[_0xe3b6('0x52')](_0x3d2e49,_0xe3b6('0x53'));}function emit(_0x5e893b,_0x52ec9e,_0x5478ea){io['to'](_0x5e893b)[_0xe3b6('0x54')](_0x52ec9e,_0x5478ea);}function emitVoiceQueueSummary(_0x3e8cc5){if(_0x3e8cc5['type']===_0xe3b6('0x55')){var _0x25967f={'id':_0x3e8cc5['id'],'name':_0x3e8cc5['name'],'strategy':_0x3e8cc5['strategy'],'answered':_0x3e8cc5[_0xe3b6('0x56')],'available':_0x3e8cc5[_0xe3b6('0x57')],'loggedIn':_0x3e8cc5[_0xe3b6('0x58')],'pTalking':_0x3e8cc5[_0xe3b6('0x59')],'sumBillable':_0x3e8cc5[_0xe3b6('0x5a')],'sumDuration':_0x3e8cc5['sumDuration'],'sumHoldTime':_0x3e8cc5['sumHoldTime']||0x0,'talking':_0x3e8cc5['talking'],'total':_0x3e8cc5[_0xe3b6('0x5b')],'type':_0x3e8cc5[_0xe3b6('0x5c')],'unmanaged':_0x3e8cc5[_0xe3b6('0x5d')],'abandoned':_0x3e8cc5['abandoned'],'waiting':_0x3e8cc5['waiting'],'loggedInDb':_0x3e8cc5['loggedInDb'],'dialActive':_0x3e8cc5[_0xe3b6('0x5e')],'dialMethod':_0x3e8cc5['dialMethod'],'dialOriginateCallerIdName':_0x3e8cc5['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3e8cc5[_0xe3b6('0x5f')],'dialOriginateTimeout':_0x3e8cc5[_0xe3b6('0x60')],'dialPrefix':_0x3e8cc5['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3e8cc5[_0xe3b6('0x61')],'outboundAnswerCallsDay':_0x3e8cc5[_0xe3b6('0x62')],'outboundBlacklistCallsDay':_0x3e8cc5[_0xe3b6('0x63')],'outboundBusyCallsDay':_0x3e8cc5[_0xe3b6('0x64')],'outboundCongestionCallsDay':_0x3e8cc5['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3e8cc5[_0xe3b6('0x65')],'outboundDropCallsDayCallersExit':_0x3e8cc5['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3e8cc5[_0xe3b6('0x66')],'outboundNoAnswerCallsDay':_0x3e8cc5[_0xe3b6('0x67')],'outboundNoSuchCallsDay':_0x3e8cc5[_0xe3b6('0x68')],'outboundOriginateFailureCallsDay':_0x3e8cc5[_0xe3b6('0x69')],'outboundReCallsDay':_0x3e8cc5[_0xe3b6('0x6a')],'outboundRejectCallsDay':_0x3e8cc5[_0xe3b6('0x6b')],'outboundUnknownCallsDay':_0x3e8cc5[_0xe3b6('0x6c')],'predictiveIntervalAnsweredCalls':_0x3e8cc5[_0xe3b6('0x6d')],'predictiveIntervalAvgHoldtime':_0x3e8cc5['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3e8cc5[_0xe3b6('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x3e8cc5[_0xe3b6('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x3e8cc5[_0xe3b6('0x70')],'predictiveIntervalErlangCalls':_0x3e8cc5[_0xe3b6('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x3e8cc5[_0xe3b6('0x72')],'predictiveIntervalHitRate':_0x3e8cc5[_0xe3b6('0x73')],'predictiveIntervalMultiplicativeFactor':_0x3e8cc5[_0xe3b6('0x74')],'predictiveIntervalPauses':_0x3e8cc5[_0xe3b6('0x75')],'predictiveIntervalAvailable':_0x3e8cc5[_0xe3b6('0x76')],'predictiveIntervalTotalCalls':_0x3e8cc5[_0xe3b6('0x77')],'message':_0x3e8cc5[_0xe3b6('0x47')],'originated':_0x3e8cc5[_0xe3b6('0x78')],'erlangCalls':_0x3e8cc5[_0xe3b6('0x79')],'erlangCallToSecond':_0x3e8cc5['erlangCallToSecond'],'erlangAbandonmentRate':_0x3e8cc5[_0xe3b6('0x7a')],'erlangBusyFactor':_0x3e8cc5[_0xe3b6('0x7b')],'startPredictive':_0x3e8cc5[_0xe3b6('0x2c')],'startProgressive':_0x3e8cc5['startProgressive']};if(_0x3e8cc5[_0xe3b6('0x7c')]){_0x25967f['Trunk']={'id':_0x3e8cc5[_0xe3b6('0x7c')]['id'],'name':_0x3e8cc5[_0xe3b6('0x7c')]['name'],'active':_0x3e8cc5[_0xe3b6('0x7c')][_0xe3b6('0x7d')],'callerid':_0x3e8cc5[_0xe3b6('0x7c')]['callerid']};}if(_0x3e8cc5[_0xe3b6('0x4b')]){_0x25967f[_0xe3b6('0x4b')]={'id':_0x3e8cc5[_0xe3b6('0x4b')]['id'],'name':_0x3e8cc5[_0xe3b6('0x4b')][_0xe3b6('0x49')]};}var _0x9c9dcf=md5(JSON[_0xe3b6('0x50')](_0x25967f));if(_0x3e8cc5[_0xe3b6('0x4')]!==_0x9c9dcf){_0x3e8cc5[_0xe3b6('0x4')]=_0x9c9dcf;emit(util[_0xe3b6('0x7e')](_0xe3b6('0x7f'),_0x25967f[_0xe3b6('0x49')]),_0xe3b6('0x80'),_0x25967f);}}}function emitCampaignSummary(_0x49ad22){if(_0x49ad22['type']==='ivr'){emit(util['format'](_0xe3b6('0x81'),_0x49ad22[_0xe3b6('0x49')]),_0xe3b6('0x82'),_0x49ad22);}}function checkGetDataPredictive(_0x42e5c5){if(isNotNull(_0x42e5c5)&&!_[_0xe3b6('0x4f')](_0x42e5c5)){loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x84'));loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x85'),_0x42e5c5[_0xe3b6('0x77')]);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x86'),_0x42e5c5[_0xe3b6('0x6d')]);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x87'),_0x42e5c5[_0xe3b6('0x70')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42e5c5[_0xe3b6('0x6f')]);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x88'),_0x42e5c5[_0xe3b6('0x89')]);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x8a'),_0x42e5c5[_0xe3b6('0x6e')]);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x8b'));if(_0x42e5c5[_0xe3b6('0x77')]>0x0){if(!_[_0xe3b6('0x46')](_0x42e5c5[_0xe3b6('0x6e')])&&_0x42e5c5['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0xe3b6('0x8c'));if(!_['isUndefined'](_0x42e5c5[_0xe3b6('0x89')])&&_0x42e5c5[_0xe3b6('0x89')]>0x0){return!![];}loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x8d'));}else{loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x8e'));}}else{loggerPredictive[_0xe3b6('0x83')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x3697cd){return function(_0x3803da){loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x8f'));loggerPredictive['info'](_0xe3b6('0x90'),_0x3803da['erlangCalls']);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x91'),_0x3803da[_0xe3b6('0x92')]);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x93'),_0x3803da[_0xe3b6('0x7a')]);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x94'),_0x3803da['erlangBusyFactor']);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x93'),_0x3803da[_0xe3b6('0x7a')]);loggerPredictive['info']('---------------------------');_[_0xe3b6('0x95')](_0x3697cd,_0x3803da);};}function getDiff(_0x590b7c){var _0xd76e76=moment()[_0xe3b6('0x51')](0x0);var _0xb20daf=moment(_0x590b7c)[_0xe3b6('0x51')](0x0);return _0xd76e76['diff'](_0xb20daf,'seconds');}function ifInterval(_0xfce54e,_0x454752){if(_['isUndefined'](_0x454752)){return![];}return getDiff(_0x454752)<_0xfce54e*0x3c;}function freeVariablesPredictive(_0x421b60){if(isNotNull(_0x421b60)){if(!_[_0xe3b6('0x46')](_0x421b60[_0xe3b6('0x2d')])){_0x421b60[_0xe3b6('0x2d')]=undefined;loggerPredictive['info'](_0x421b60[_0xe3b6('0x49')],_0xe3b6('0x96'));}if(!_[_0xe3b6('0x46')](_0x421b60['startPredictive'])){_0x421b60[_0xe3b6('0x2c')]=undefined;loggerPredictive[_0xe3b6('0x83')](_0x421b60['name'],_0xe3b6('0x97'));}if(!_[_0xe3b6('0x46')](_0x421b60[_0xe3b6('0x98')])){clearInterval(_0x421b60['handlePredictive']);_0x421b60[_0xe3b6('0x98')]=undefined;loggerPredictive[_0xe3b6('0x83')](_0x421b60[_0xe3b6('0x49')],_0xe3b6('0x99'));}}}function erlangb(_0x1759eb,_0x1933c6){if(_0x1933c6===0x0){return 0x0;}var _0x67f3cb=0x1;for(var _0x1840dd=0x1;_0x1840dd<=_0x1933c6;_0x1840dd+=0x1){_0x67f3cb=0x1+_0x67f3cb*_0x1840dd/_0x1759eb;}return 0x1/_0x67f3cb;}function isVoiceQueueOutbound(_0x302714){return _0x302714===_0xe3b6('0x55');}function isNotPreview(_0x2a2b7f){return _0x2a2b7f!==_0xe3b6('0x22');}function isCampaignIvr(_0xb218ed){return _0xb218ed===_0xe3b6('0x9a');}function getCallerId(_0x26b89d,_0x42cccf,_0x38e769){if(!_[_0xe3b6('0x46')](_0x38e769)&&typeof _0x38e769===_0xe3b6('0x9b')&&!_[_0xe3b6('0x4f')](_0x38e769)){if(!_[_0xe3b6('0x46')](_0x42cccf)&&typeof _0x42cccf==='string'&&!_[_0xe3b6('0x4f')](_0x42cccf)){return util['format'](_0xe3b6('0x9c'),_0x42cccf,_0x38e769);}return util[_0xe3b6('0x7e')]('\x22%s\x22\x20<%s>',_0x38e769,_0x38e769);}if(!_[_0xe3b6('0x46')](_0x26b89d)&&typeof _0x26b89d===_0xe3b6('0x9b')&&!_[_0xe3b6('0x4f')](_0x26b89d)){return _0x26b89d;}return _0xe3b6('0x9d');}function loggerCatchQueueSummary(_0x1ee7a6,_0x4e47f2){return function(_0x21afbe){freeVariablesPredictive(_0x4e47f2);emitVoiceQueueSummary(_0x4e47f2);emitCampaignSummary(_0x4e47f2);loggerSyncQueueSummary[_0xe3b6('0x9e')](_0x1ee7a6,util[_0xe3b6('0x9f')](_0x21afbe,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x55c8be,_0x540c66){return function(_0x31c5c3){loggerPredictive['error'](_0x540c66[_0xe3b6('0x49')],_0x55c8be);loggerPredictive[_0xe3b6('0x9e')](_0x31c5c3['stack']);freeVariablesPredictive(_0x540c66);};}function loggerCatch(_0x15c0f2){return function(_0x4b435d){logger[_0xe3b6('0x9e')](_0x15c0f2,util[_0xe3b6('0x9f')](_0x4b435d,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x328168){return _0x328168&&!_[_0xe3b6('0x46')](_0x328168)&&_0x328168['length']>0x0;}function decremetOriginate(_0x1cb57d){if(!_['isUndefined'](_0x1cb57d)&&_0x1cb57d!==null){if(typeof _0x1cb57d['originated']!=='undefined'){if(_0x1cb57d[_0xe3b6('0x78')]>0x0){_0x1cb57d[_0xe3b6('0x78')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xe3b6('0x9e')](_0xe3b6('0xa0'));}}function checkContactLowerLimitOriginate(_0x452148,_0x386f49,_0x26421e){if(_0x386f49>_0x26421e){for(var _0x1b563c=0x0;_0x1b563c<_0x386f49-_0x26421e;_0x1b563c+=0x1){decremetOriginate(_0x452148);}}}function loggerGetContactDialer(_0x30709b,_0x4e003f,_0x46f236){return function(_0x3305e1){checkContactLowerLimitOriginate(_0x4e003f,_0x46f236,0x0);logger[_0xe3b6('0x9e')](_0x30709b,util[_0xe3b6('0x9f')](_0x3305e1,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x36e6f5){return function(_0x574b2c){if(isNotNull(_0x574b2c)&&isNotNull(_0x574b2c[0x0])){if(_0x574b2c[0x0]['contactsRescheduled']>0x0){_0x36e6f5[_0xe3b6('0x47')]=_0xe3b6('0xa1');logger['info']('[getContactDialer2][ReScheduled]'+_0x36e6f5['name'],_0x574b2c[0x0]['contactsRescheduled'],_0xe3b6('0xa2'));}else{_0x36e6f5['message']=_0xe3b6('0xa3');logger[_0xe3b6('0x83')]('[getContactDialer2][Empty]'+_0x36e6f5[_0xe3b6('0x49')]);}}};}function notSendMessagesQueue(_0x3fd1a6){if(_0x3fd1a6[_0xe3b6('0xa4')]){freeVariablesPredictive(_0x3fd1a6);if(_0x3fd1a6['originated']===0x0&&_0x3fd1a6['talking']===0x0&&_0x3fd1a6['waiting']===0x0&&(_0x3fd1a6[_0xe3b6('0x59')]||0x0)===0x0){_0x3fd1a6[_0xe3b6('0xa4')]=![];_0x3fd1a6[_0xe3b6('0x57')]=0x0;_0x3fd1a6['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xe3b6('0x9e')](_0xe3b6('0xa5'),_0x3fd1a6['name'],_0xe3b6('0xa6'));}else{_0x3fd1a6[_0xe3b6('0x47')]=_0xe3b6('0xa7');loggerSyncQueueSummary[_0xe3b6('0x9e')](_0xe3b6('0xa5'),_0x3fd1a6[_0xe3b6('0x49')],'is\x20disactive');}emitVoiceQueueSummary(_0x3fd1a6);}}function notSendMessagesCampaign(_0x1bf61a){if(_0x1bf61a[_0xe3b6('0xa4')]){if(_0x1bf61a[_0xe3b6('0x78')]===0x0){_0x1bf61a[_0xe3b6('0xa4')]=![];_0x1bf61a[_0xe3b6('0x47')]=_0xe3b6('0xa8');loggerSyncQueueSummary[_0xe3b6('0x9e')](_0xe3b6('0xa9'),_0x1bf61a[_0xe3b6('0x49')],'is\x20not\x20active');}else{_0x1bf61a[_0xe3b6('0x47')]=_0xe3b6('0xa7');loggerSyncQueueSummary[_0xe3b6('0x9e')](_0xe3b6('0xa9'),_0x1bf61a['name'],_0xe3b6('0xaa'));}emitCampaignSummary(_0x1bf61a);}}function createObjHistory(_0x327dbe,_0x3c7fbf,_0x17e51f,_0x113f97,_0x27a3f8){_0x327dbe[_0xe3b6('0x47')]=_0x17e51f;var _0x5b3530=new Action(_0x327dbe,_0x3c7fbf);var _0x38494c=new History(_0x5b3530);_0x38494c[_0xe3b6('0xab')]=_0x113f97;_0x38494c['statedesc']=_0x27a3f8;_0x38494c['endtime']=_0x5b3530[_0xe3b6('0xac')];return _0x38494c;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x490d1a=this;setInterval(function(){_0x490d1a[_0xe3b6('0xad')](_0x490d1a[_0xe3b6('0x2a')],_0xe3b6('0xae'));_0x490d1a[_0xe3b6('0xad')](_0x490d1a['actions'],'[actions]');},0x32c8);};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xad')]=function(_0x420a42,_0xd85e96){var _0x45d117=this;for(var _0x51eedb in _0x420a42){if(typeof _0x420a42[_0x51eedb]!==_0xe3b6('0xaf')){this['sequence']['enqueue'](function(){if(!_[_0xe3b6('0xb0')](_0x420a42[_0x51eedb])){return ami[_0xe3b6('0xb1')]({'action':'status','channel':_0x420a42[_0x51eedb][_0xe3b6('0xb2')]})['catch'](function(_0x202785){if(_0x202785['message']===_0xe3b6('0xb3')){setTimeout(function(){if(_0x420a42[_0x51eedb]&&_0x420a42[_0x51eedb][_0xe3b6('0x5c')]!=='ivr'){_0x45d117[_0xe3b6('0xb4')](_0x45d117['voiceQueues'][_0x420a42[_0x51eedb]['queue']]);logger[_0xe3b6('0x9e')]('[Dialer][checkChannel]',_0xd85e96,_0x51eedb,_0x420a42[_0x51eedb][_0xe3b6('0xb5')]);delete _0x420a42[_0x51eedb];}if(_0x420a42[_0x51eedb]&&_0x420a42[_0x51eedb]['type']===_0xe3b6('0x9a')){_0x45d117['updateOriginated'](_0x45d117[_0xe3b6('0x24')][_0x420a42[_0x51eedb][_0xe3b6('0xb5')]]);logger[_0xe3b6('0x9e')](_0xe3b6('0xb6'),_0xd85e96,_0x51eedb,_0x420a42[_0x51eedb][_0xe3b6('0xb5')]);delete _0x420a42[_0x51eedb];}},0x2328);}});}});}}};Dialer[_0xe3b6('0x1f')]['countReScheduled']=function(_0x2e64af){return BPromise[_0xe3b6('0xb7')]()['then'](cmHopper['countReScheduled'](_0x2e64af))[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xb9')));};Dialer['prototype']['checkIsBlackList']=function(_0x202a37){return BPromise[_0xe3b6('0xb7')]()['then'](cmHopperBlack[_0xe3b6('0xba')](_0x202a37))[_0xe3b6('0xb8')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xbb')]=function(_0x4cfbf9,_0x2116f7,_0x5e342a){return BPromise[_0xe3b6('0xb7')]()['then'](cmHopperAdditionalPhone[_0xe3b6('0xbb')](_0x4cfbf9,_0x2116f7,_0x5e342a))[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xbc')));};Dialer['prototype']['swapAdditionalPhones']=function(_0x25fbbb,_0xc5cb60,_0x3bac69){return BPromise[_0xe3b6('0xb7')]()[_0xe3b6('0xbd')](cmHopperAdditionalPhone[_0xe3b6('0xbe')](_0x25fbbb,_0xc5cb60,_0x3bac69))[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xbf')));};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xc0')]=function(_0x679e25){return BPromise[_0xe3b6('0xb7')]()[_0xe3b6('0xbd')](cmHopperBlack[_0xe3b6('0xc0')](_0x679e25))[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xc1')));};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xc2')]=function(_0xb06a94){return BPromise[_0xe3b6('0xb7')]()[_0xe3b6('0xbd')](cmHopperHistory[_0xe3b6('0xc3')](_0xb06a94))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xc4')]=function(_0x507ca6){return BPromise[_0xe3b6('0xb7')]()[_0xe3b6('0xbd')](cmHopper[_0xe3b6('0xc4')](_0x507ca6))['catch'](loggerCatch(_0xe3b6('0xc5')));};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xc6')]=function(_0x5ab18d,_0x6f18fe,_0x163d0d){return BPromise[_0xe3b6('0xb7')]()['then'](cmHopper[_0xe3b6('0xc6')](_0x5ab18d,_0x6f18fe,_0x163d0d))[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xc7')));};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xc8')]=function(_0x5a574d,_0x1e7a78,_0x2a435b,_0x4f401e,_0xb9556){return BPromise[_0xe3b6('0xb7')]()['then'](cmHopper['getContactDialer'](_0x5a574d,_0x1e7a78,_0x2a435b,_0x4f401e))[_0xe3b6('0xb8')](function(_0x148e76){_0xb9556[_0xe3b6('0xc9')]-=_0x2a435b;_0xb9556[_0xe3b6('0xc9')]=_0xb9556['temp']>0x0?_0xb9556['temp']:0x0;loggerCatch('[getContactDialer]\x20')(_0x148e76);});};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xca')]=function(_0xd84a64,_0x233d4a,_0x3227b5,_0x3c4ecc){return BPromise[_0xe3b6('0xb7')]()[_0xe3b6('0xbd')](cmHopper[_0xe3b6('0xca')](_0xd84a64,_0x233d4a,_0x3227b5))['catch'](function(_0x33318b){_0x3c4ecc[_0xe3b6('0xc9')]-=_0x233d4a;_0x3c4ecc[_0xe3b6('0xc9')]=_0x3c4ecc[_0xe3b6('0xc9')]>0x0?_0x3c4ecc['temp']:0x0;loggerCatch(_0xe3b6('0xcb'))(_0x33318b);});};Dialer[_0xe3b6('0x1f')]['getVoiceQueueRtPauses']=function(_0x73ca70){return BPromise['resolve']()['then'](voiceQueueRt[_0xe3b6('0xcc')](_0x73ca70))[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xcd')));};Dialer['prototype'][_0xe3b6('0xce')]=function(_0x1052f4){return BPromise[_0xe3b6('0xb7')]()['then'](cmHopper[_0xe3b6('0xce')](_0x1052f4))[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xcf')));};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xd0')]=function(_0x3e29bd){return BPromise['resolve']()[_0xe3b6('0xbd')](cmHopperHistory[_0xe3b6('0xd0')](_0x3e29bd))[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xd1')));};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xb4')]=function(_0x3a3c3e){if(!_[_0xe3b6('0x46')](_0x3a3c3e)&&_0x3a3c3e!==null){if(typeof _0x3a3c3e[_0xe3b6('0x78')]!==_0xe3b6('0xaf')){if(_0x3a3c3e[_0xe3b6('0x78')]>0x0){_0x3a3c3e[_0xe3b6('0x78')]-=0x1;}else{logger[_0xe3b6('0x9e')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xe3b6('0x9e')](_0xe3b6('0xd2'));}};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xd3')]=function(_0x24cd56,_0x1b9418){var _0x655329=this;return function(_0x4e850c){_0x655329['updateOriginated'](_0x1b9418);logger[_0xe3b6('0x9e')](_0x24cd56,util[_0xe3b6('0x9f')](_0x4e850c,{'showHidden':![],'depth':null}));};};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xd4')]=function(_0x382cef,_0x5bd850,_0x33823e){var _0x2d80a7={'state':0x19,'statedesc':_0xe3b6('0xd5')};this[_0xe3b6('0xb4')](_0x5bd850);this['saveInDb'](_['merge'](_0x2d80a7,_[_0xe3b6('0xd6')](_0x33823e,[_0xe3b6('0xd7'),_0xe3b6('0xd8'),_0xe3b6('0xd9'),_0xe3b6('0xda'),'CampaignId'])),_0xe3b6('0xdb'),'[emptyContact]');logger['error'](_0x382cef);};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xdc')]=function(_0x29b060){return _0x29b060===_0xe3b6('0xdd');};Dialer['prototype'][_0xe3b6('0xde')]=function(_0xd2bcd7){return!_['isUndefined'](_0xd2bcd7)&&_0xd2bcd7&&!_[_0xe3b6('0x46')](_0xd2bcd7['name'])&&!_['isUndefined'](_0xd2bcd7[_0xe3b6('0x7d')])&&_0xd2bcd7['active']&&(this[_0xe3b6('0x26')][util[_0xe3b6('0x7e')](_0xe3b6('0xdf'),_0xd2bcd7[_0xe3b6('0x49')])]['status']==='reachable'||this[_0xe3b6('0x26')][util['format'](_0xe3b6('0xdf'),_0xd2bcd7[_0xe3b6('0x49')])][_0xe3b6('0xe0')]===_0xe3b6('0xe1'));};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xe2')]=function(_0x1cc4c4,_0x202701,_0x117095){this[_0xe3b6('0xd0')](_0x1cc4c4)[_0xe3b6('0xb8')](loggerCatch(_0x202701));this[_0xe3b6('0xce')](_0x1cc4c4)['catch'](loggerCatch(_0x117095));};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x3e')]=function(_0x504d48){var _0x4510b5=this[_0xe3b6('0x2a')][_0x504d48[_0xe3b6('0xe3')]];var _0x140058;if(!_[_0xe3b6('0xb0')](_0x504d48)&&!_['isNil'](_0x504d48[_0xe3b6('0xe4')])&&!_[_0xe3b6('0xb0')](_0x504d48[_0xe3b6('0xe4')][_0xe3b6('0xe5')])&&_0x504d48[_0xe3b6('0xe6')]===_0xe3b6('0xe7')&&_0x4510b5){if(_0x4510b5[_0xe3b6('0x5c')]!==_0xe3b6('0x9a')&&this[_0xe3b6('0x23')][_0x4510b5[_0xe3b6('0xb5')]][_0xe3b6('0xe8')]&&_0x504d48[_0xe3b6('0xe9')]===_0xe3b6('0xea')){delete this['uniqueId'][_0x504d48[_0xe3b6('0xe3')]];this[_0xe3b6('0xb4')](this[_0xe3b6('0x23')][_0x4510b5[_0xe3b6('0xb5')]]);this[_0xe3b6('0x23')][_0x4510b5[_0xe3b6('0xb5')]][_0xe3b6('0x62')]+=0x1;this[_0xe3b6('0x23')][_0x4510b5[_0xe3b6('0xb5')]][_0xe3b6('0x61')]+=0x1;_0x140058=new Hangup(_0x4510b5,_0x504d48);_0x140058[_0xe3b6('0xab')]=0x12;_0x140058[_0xe3b6('0xeb')]=_0xe3b6('0xec');_0x140058['membername']='AMD';ami[_0xe3b6('0x54')](_0xe3b6('0xed'),ut[_0xe3b6('0xee')](_0x140058,_0xe3b6('0xef')));this[_0xe3b6('0xe2')](_0x140058,_0xe3b6('0xf0'),_0xe3b6('0xf1'));}if(_0x4510b5[_0xe3b6('0x5c')]!=='ivr'&&this['voiceQueues'][_0x4510b5[_0xe3b6('0xb5')]][_0xe3b6('0xe8')]&&_0x504d48['value']==='MACHINE'){var _0x2c8464=this;return new BPromise(function(_0x558023,_0x5b0875){delete _0x2c8464['uniqueId'][_0x504d48[_0xe3b6('0xe3')]];_0x2c8464[_0xe3b6('0xb4')](_0x2c8464[_0xe3b6('0x23')][_0x4510b5[_0xe3b6('0xb5')]]);_0x2c8464['voiceQueues'][_0x4510b5[_0xe3b6('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x2c8464[_0xe3b6('0x23')][_0x4510b5[_0xe3b6('0xb5')]][_0xe3b6('0x61')]+=0x1;var _0x2b80a2=_0x2c8464[_0xe3b6('0x23')][_0x4510b5['queue']];var _0x533023=new Hangup(_0x4510b5,_0x504d48);_0x533023[_0xe3b6('0xab')]=0x13;_0x533023['statedesc']='Machine';_0x533023[_0xe3b6('0xf2')]='AMD';_0x533023[_0xe3b6('0xf3')]+=0x1;_0x533023['countglobal']+=0x1;_0x533023[_0xe3b6('0xef')]=!![];ami['emit'](_0xe3b6('0xed'),ut[_0xe3b6('0xee')](_0x533023,_0xe3b6('0xef')));_0x2c8464[_0xe3b6('0xd0')](_0x533023)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xf4')));if(_0x533023[_0xe3b6('0xf5')]+_0x533023[_0xe3b6('0xf6')]+_0x533023[_0xe3b6('0xf7')]+_0x533023[_0xe3b6('0xf8')]+_0x533023[_0xe3b6('0xf9')]+_0x533023['countabandonedretry']+_0x533023['countmachineretry']+_0x533023[_0xe3b6('0xfa')]>=_0x2b80a2[_0xe3b6('0xfb')]){_0x2c8464[_0xe3b6('0xfc')](_0x533023,_0x558023,_0x5b0875,_0xe3b6('0xfd'));}else{if(_0x533023[_0xe3b6('0xf3')]>=_0x2b80a2[_0xe3b6('0xfe')]){_0x2c8464[_0xe3b6('0xff')](_0x533023,_0x558023,_0x5b0875,'reason\x2019\x20machine....');}else{_0x2c8464[_0xe3b6('0xc4')]({'active':![],'countmachineretry':_0x533023[_0xe3b6('0xf3')],'scheduledat':moment()['add'](_0x2b80a2['dialMachineRetryFrequency'],_0xe3b6('0x100'))[_0xe3b6('0x7e')](_0xe3b6('0x101')),'ContactId':_0x533023[_0xe3b6('0xd7')],'ListId':_0x533023['ListId'],'VoiceQueueId':_0x533023[_0xe3b6('0xda')]||undefined,'CampaignId':_0x533023[_0xe3b6('0x102')]||undefined})['catch'](loggerCatch(_0xe3b6('0x103')));_0x558023({'reschedule':0x1});}}});}if(_0x4510b5[_0xe3b6('0x5c')]===_0xe3b6('0x9a')&&this[_0xe3b6('0x24')][_0x4510b5[_0xe3b6('0xb5')]][_0xe3b6('0xe8')]&&_0x504d48[_0xe3b6('0xe9')]===_0xe3b6('0xea')){delete this[_0xe3b6('0x2a')][_0x504d48[_0xe3b6('0xe3')]];this['updateOriginated'](this[_0xe3b6('0x24')][_0x4510b5[_0xe3b6('0xb5')]]);_0x140058=new Hangup(_0x4510b5,_0x504d48);_0x140058[_0xe3b6('0xab')]=0x12;_0x140058[_0xe3b6('0xeb')]=_0xe3b6('0xec');_0x140058[_0xe3b6('0xf2')]='AMD';ami[_0xe3b6('0x54')](_0xe3b6('0xed'),ut[_0xe3b6('0xee')](_0x140058,'amd'));this[_0xe3b6('0xe2')](_0x140058,_0xe3b6('0x104'),_0xe3b6('0x105'));}if(_0x4510b5[_0xe3b6('0x5c')]===_0xe3b6('0x9a')&&this[_0xe3b6('0x24')][_0x4510b5[_0xe3b6('0xb5')]][_0xe3b6('0xe8')]&&_0x504d48['value']===_0xe3b6('0x106')){var _0x2c8464=this;return new BPromise(function(_0x36e6c8,_0x31fd7f){delete _0x2c8464[_0xe3b6('0x2a')][_0x504d48['uniqueid']];_0x2c8464[_0xe3b6('0xb4')](_0x2c8464['campaigns'][_0x4510b5[_0xe3b6('0xb5')]]);_0x2c8464[_0xe3b6('0x24')][_0x4510b5['queue']][_0xe3b6('0x62')]+=0x1;_0x2c8464[_0xe3b6('0x24')][_0x4510b5[_0xe3b6('0xb5')]][_0xe3b6('0x61')]+=0x1;var _0x69bb24=_0x2c8464[_0xe3b6('0x24')][_0x4510b5[_0xe3b6('0xb5')]];var _0x1552eb=new Hangup(_0x4510b5,_0x504d48);_0x1552eb[_0xe3b6('0xab')]=0x13;_0x1552eb[_0xe3b6('0xeb')]='Machine';_0x1552eb[_0xe3b6('0xf2')]=_0xe3b6('0x107');_0x1552eb[_0xe3b6('0xf3')]+=0x1;_0x1552eb[_0xe3b6('0x108')]+=0x1;_0x1552eb[_0xe3b6('0xef')]=!![];ami['emit'](_0xe3b6('0xed'),ut[_0xe3b6('0xee')](_0x1552eb,_0xe3b6('0xef')));_0x2c8464[_0xe3b6('0xd0')](_0x1552eb)['catch'](loggerCatch(_0xe3b6('0xf4')));if(_0x1552eb['countbusyretry']+_0x1552eb['countcongestionretry']+_0x1552eb[_0xe3b6('0xf7')]+_0x1552eb[_0xe3b6('0xf8')]+_0x1552eb['countdropretry']+_0x1552eb[_0xe3b6('0x109')]+_0x1552eb[_0xe3b6('0xf3')]+_0x1552eb[_0xe3b6('0xfa')]>=_0x69bb24[_0xe3b6('0xfb')]){_0x2c8464[_0xe3b6('0xfc')](_0x1552eb,_0x36e6c8,_0x31fd7f,'reason19\x20machine....');}else{if(_0x1552eb[_0xe3b6('0xf3')]>=_0x69bb24['dialMachineMaxRetry']){_0x2c8464['createStateFinal'](_0x1552eb,_0x36e6c8,_0x31fd7f,_0xe3b6('0x10a'));}else{_0x2c8464[_0xe3b6('0xc4')]({'active':![],'countmachineretry':_0x1552eb[_0xe3b6('0xf3')],'scheduledat':moment()[_0xe3b6('0x10b')](_0x69bb24[_0xe3b6('0x10c')],_0xe3b6('0x100'))[_0xe3b6('0x7e')](_0xe3b6('0x101')),'ContactId':_0x1552eb['ContactId'],'ListId':_0x1552eb[_0xe3b6('0xd8')],'VoiceQueueId':_0x1552eb['VoiceQueueId']||undefined,'CampaignId':_0x1552eb[_0xe3b6('0x102')]||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x103')));_0x36e6c8({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xe3b6('0x3a')]=function(_0x129295){var _0x37a413=this[_0xe3b6('0x2a')][_0x129295[_0xe3b6('0xe3')]];var _0x1990a3=this;var _0x232989;if(_0x37a413&&_0x37a413['type']===_0xe3b6('0x9a')){delete this[_0xe3b6('0x2a')][_0x129295[_0xe3b6('0xe3')]];this[_0xe3b6('0xb4')](this['campaigns'][_0x37a413[_0xe3b6('0xb5')]]);this[_0xe3b6('0x24')][_0x37a413['queue']][_0xe3b6('0x10d')]+=0x1;_0x232989=new Hangup(_0x37a413,_0x129295);this[_0xe3b6('0xd0')](_0x232989)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x10e')));this[_0xe3b6('0xce')](_0x232989)['catch'](loggerCatch(_0xe3b6('0x10f')));}if(_0x37a413&&_0x37a413[_0xe3b6('0x5c')]!==_0xe3b6('0x9a')&&isNotNull(this[_0xe3b6('0x23')][_0x37a413['queue']]['dialQueueProject'])){delete this[_0xe3b6('0x2a')][_0x129295[_0xe3b6('0xe3')]];this[_0xe3b6('0xb4')](this['voiceQueues'][_0x37a413[_0xe3b6('0xb5')]]);this['voiceQueues'][_0x37a413['queue']][_0xe3b6('0x62')]+=0x1;this[_0xe3b6('0x23')][_0x37a413[_0xe3b6('0xb5')]][_0xe3b6('0x61')]+=0x1;_0x232989=new Hangup(_0x37a413,_0x129295);_0x232989[_0xe3b6('0xab')]=0x10;_0x232989[_0xe3b6('0xeb')]=_0xe3b6('0x110');_0x232989[_0xe3b6('0xf2')]='AGI';this['createHistory'](_0x232989)['catch'](loggerCatch(_0xe3b6('0x10e')));this[_0xe3b6('0xce')](_0x232989)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x10f')));}if(_0x37a413&&_0x37a413[_0xe3b6('0x5c')]!==_0xe3b6('0x9a')&&!isNotNull(this[_0xe3b6('0x23')][_0x37a413[_0xe3b6('0xb5')]][_0xe3b6('0x111')])){delete this[_0xe3b6('0x2a')][_0x129295['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x37a413[_0xe3b6('0xb5')]]);this[_0xe3b6('0x23')][_0x37a413[_0xe3b6('0xb5')]][_0xe3b6('0x6c')]+=0x1;_0x232989=new Hangup(_0x37a413,_0x129295);_0x232989[_0xe3b6('0xab')]=0xc;_0x232989[_0xe3b6('0xeb')]=_0x129295['cause-txt'];_0x232989[_0xe3b6('0xf2')]=_0xe3b6('0x112');this[_0xe3b6('0xd0')](_0x232989)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x10e')));this[_0xe3b6('0xce')](_0x232989)[_0xe3b6('0xb8')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x37')]=function(_0x48e56c){var _0x19eb93=this[_0xe3b6('0x2a')][_0x48e56c['uniqueid']];var _0x2506f7=this;if(this[_0xe3b6('0x23')][_0x48e56c[_0xe3b6('0xb5')]]){if(_0x19eb93&&_0x19eb93[_0xe3b6('0x5c')]!==_0xe3b6('0x9a')){delete this[_0xe3b6('0x2a')][_0x48e56c['uniqueid']];this['voiceQueues'][_0x48e56c['queue']][_0xe3b6('0x62')]+=0x1;var _0x23c9f9=new AgentComplete(_0x19eb93,_0x48e56c);if(_0x48e56c[_0xe3b6('0x113')]===_0xe3b6('0x114')){_0x23c9f9[_0xe3b6('0x115')]=this[_0xe3b6('0x23')][_0x48e56c[_0xe3b6('0xb5')]][_0xe3b6('0x116')]&&this[_0xe3b6('0x23')][_0x48e56c[_0xe3b6('0xb5')]][_0xe3b6('0x117')]?moment()[_0xe3b6('0x7e')](_0xe3b6('0x101')):undefined;}this[_0xe3b6('0xd0')](_0x23c9f9)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x118')));this[_0xe3b6('0xce')](_0x23c9f9)[_0xe3b6('0xb8')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x31')]=function(_0x2247ae){if(this[_0xe3b6('0x23')][_0x2247ae[_0xe3b6('0xb5')]]){if(this[_0xe3b6('0x2a')][_0x2247ae[_0xe3b6('0xe3')]]&&this['uniqueId'][_0x2247ae[_0xe3b6('0xe3')]]['type']!==_0xe3b6('0x9a')){this[_0xe3b6('0xb4')](this[_0xe3b6('0x23')][_0x2247ae[_0xe3b6('0xb5')]]);this[_0xe3b6('0x2a')][_0x2247ae['uniqueid']][_0xe3b6('0x119')]=moment()[_0xe3b6('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0xe3b6('0x11a')]=function(_0x278955,_0x9059d9){this[_0xe3b6('0xd0')](_0x278955)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x118')));if(_0x9059d9==0x0){this[_0xe3b6('0xce')](_0x278955)['catch'](loggerCatch(_0xe3b6('0x11b')));}};Dialer['prototype'][_0xe3b6('0x34')]=function(_0x4548e2){var _0x4d9a5a=this[_0xe3b6('0x2a')][_0x4548e2[_0xe3b6('0xe3')]];var _0x510fd6=this;var _0x13c6e9=![];var _0x3d2d87;var _0x1a6023;if(this[_0xe3b6('0x23')][_0x4548e2[_0xe3b6('0xb5')]]){if(_0x4d9a5a&&_0x4d9a5a['type']!==_0xe3b6('0x9a')){delete this[_0xe3b6('0x2a')][_0x4548e2['uniqueid']];this[_0xe3b6('0xb4')](this[_0xe3b6('0x23')][_0x4548e2[_0xe3b6('0xb5')]]);_0x4d9a5a[_0xe3b6('0x11c')]=moment()[_0xe3b6('0x7e')](_0xe3b6('0x101'));var _0xa9293f=new QueueCallerAbandon(_0x4d9a5a,_0x4548e2);if(getSeconds(_0x4d9a5a[_0xe3b6('0x11c')],_0x4d9a5a['responsetime'])>=_0x4d9a5a['dialQueueTimeout']){this[_0xe3b6('0x23')][_0x4548e2['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x4548e2[_0xe3b6('0xb5')]][_0xe3b6('0x66')]+=0x1;this[_0xe3b6('0x23')][_0x4548e2[_0xe3b6('0xb5')]][_0xe3b6('0x72')]+=0x1;_0xa9293f['state']=0xa;_0xa9293f[_0xe3b6('0xeb')]=_0xe3b6('0x11d');_0xa9293f[_0xe3b6('0x11e')]=_0xe3b6('0x11f');_0xa9293f['agiafterat']=this['voiceQueues'][_0x4548e2[_0xe3b6('0xb5')]][_0xe3b6('0x116')]?moment()['format'](_0xe3b6('0x101')):undefined;_0xa9293f[_0xe3b6('0xf9')]+=0x1;_0xa9293f[_0xe3b6('0x108')]+=0x1;_0x3d2d87=this['voiceQueues'][_0x4548e2[_0xe3b6('0xb5')]]['dialDropRetryFrequency'];_0x1a6023=this['voiceQueues'][_0x4548e2[_0xe3b6('0xb5')]][_0xe3b6('0x120')];_0x510fd6[_0xe3b6('0xbb')](_0xa9293f,_0xa9293f[_0xe3b6('0xab')],_0x4d9a5a[_0xe3b6('0x121')])[_0xe3b6('0xbd')](function(_0x2279cf){_0x13c6e9=_0x2279cf[_0xe3b6('0x122')]==0x1;if(_0xa9293f[_0xe3b6('0xf9')]>=_0x510fd6[_0xe3b6('0x23')][_0x4548e2[_0xe3b6('0xb5')]][_0xe3b6('0x123')]){_0x510fd6[_0xe3b6('0x11a')](_0xa9293f,_0x2279cf[_0xe3b6('0x122')]);}else{_0x510fd6['rescheduleContact']({'active':![],'countdropretry':_0xa9293f[_0xe3b6('0xf9')],'scheduledat':moment()[_0xe3b6('0x10b')](_0x510fd6['voiceQueues'][_0x4548e2[_0xe3b6('0xb5')]][_0xe3b6('0x124')],_0xe3b6('0x100'))[_0xe3b6('0x7e')](_0xe3b6('0x101')),'ContactId':_0x4d9a5a[_0xe3b6('0xd7')],'ListId':_0x4d9a5a[_0xe3b6('0xd8')],'VoiceQueueId':_0x4d9a5a[_0xe3b6('0xda')]||undefined,'CampaignId':_0x4d9a5a[_0xe3b6('0x102')]||undefined})[_0xe3b6('0xb8')](loggerCatch('[rescheduleContact][Drop]'));var _0x4db0ef=new History(_0xa9293f);_0x4db0ef[_0xe3b6('0xab')]=0xa;_0x4db0ef[_0xe3b6('0xeb')]='Drop';_0x4db0ef[_0xe3b6('0xac')]=moment()[_0xe3b6('0x7e')](_0xe3b6('0x101'));_0x4db0ef[_0xe3b6('0x125')]=_0x4db0ef[_0xe3b6('0xac')];_0x4db0ef[_0xe3b6('0x126')]=_0xa9293f['calleridname'];_0x4db0ef[_0xe3b6('0x127')]=_0xa9293f['calleridnum'];_0x510fd6['createHistory'](_0x4db0ef)[_0xe3b6('0xb8')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(_0x523a54){if(_0x13c6e9)_0x510fd6[_0xe3b6('0xbe')](_0xa9293f,_0x3d2d87,_0x1a6023)['then'](function(_0x44dd12){return 0x1;});});}else{this[_0xe3b6('0x23')][_0x4548e2[_0xe3b6('0xb5')]][_0xe3b6('0x6f')]+=0x1;this[_0xe3b6('0x23')][_0x4548e2['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0xa9293f['state']=0xb;_0xa9293f[_0xe3b6('0xeb')]=_0xe3b6('0x128');_0xa9293f[_0xe3b6('0x11e')]='CALLEREXIT';_0xa9293f['countabandonedretry']+=0x1;_0xa9293f[_0xe3b6('0x108')]+=0x1;_0x3d2d87=this['voiceQueues'][_0x4548e2['queue']][_0xe3b6('0x129')];_0x1a6023=this['voiceQueues'][_0x4548e2[_0xe3b6('0xb5')]][_0xe3b6('0x120')];_0x510fd6[_0xe3b6('0xbb')](_0xa9293f,_0xa9293f['state'],_0x4d9a5a[_0xe3b6('0x121')])[_0xe3b6('0xbd')](function(_0x1c760b){if(_0xa9293f['countabandonedretry']>=_0x510fd6[_0xe3b6('0x23')][_0x4548e2['queue']][_0xe3b6('0x12a')]){_0x510fd6[_0xe3b6('0x11a')](_0xa9293f,_0x1c760b[_0xe3b6('0x122')]);}else{_0x510fd6[_0xe3b6('0xc4')]({'active':![],'countabandonedretry':_0xa9293f[_0xe3b6('0x109')],'scheduledat':moment()[_0xe3b6('0x10b')](_0x510fd6[_0xe3b6('0x23')][_0x4548e2[_0xe3b6('0xb5')]][_0xe3b6('0x129')],_0xe3b6('0x100'))[_0xe3b6('0x7e')](_0xe3b6('0x101')),'ContactId':_0x4d9a5a[_0xe3b6('0xd7')],'ListId':_0x4d9a5a[_0xe3b6('0xd8')],'VoiceQueueId':_0x4d9a5a['VoiceQueueId']||undefined,'CampaignId':_0x4d9a5a[_0xe3b6('0x102')]||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x12b')));var _0x169909=new History(_0xa9293f);_0x169909[_0xe3b6('0xab')]=0xb;_0x169909[_0xe3b6('0xeb')]=_0xe3b6('0x128');_0x169909[_0xe3b6('0xac')]=moment()[_0xe3b6('0x7e')](_0xe3b6('0x101'));_0x169909['endtime']=_0x169909['starttime'];_0x169909[_0xe3b6('0x126')]=_0xa9293f[_0xe3b6('0x126')];_0x169909[_0xe3b6('0x127')]=_0xa9293f[_0xe3b6('0x127')];_0x510fd6[_0xe3b6('0xd0')](_0x169909)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x12c')));}})[_0xe3b6('0xbd')](function(_0x353639){if(_0x13c6e9)_0x510fd6[_0xe3b6('0xbe')](_0xa9293f,_0x3d2d87,_0x1a6023)[_0xe3b6('0xbd')](function(_0x4e784b){return 0x1;});});}}}};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x3c')]=function(_0x25c0d7){if(this['actions'][_0x25c0d7['uniqueid']]){this[_0xe3b6('0x12d')][_0x25c0d7['uniqueid']][_0xe3b6('0xb2')]=_0x25c0d7[_0xe3b6('0xb2')];}if(this[_0xe3b6('0x2a')][_0x25c0d7[_0xe3b6('0xe3')]]){this[_0xe3b6('0x2a')][_0x25c0d7[_0xe3b6('0xe3')]][_0xe3b6('0xb2')]=_0x25c0d7[_0xe3b6('0xb2')];}};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x40')]=function(_0x5bd485){if(strategy[this[_0xe3b6('0x23')][this['actions'][_0x5bd485['actionid']]['queue']][_0xe3b6('0x12e')]]===_0xe3b6('0x1e')){if(this[_0xe3b6('0x12d')][_0x5bd485[_0xe3b6('0x12f')]]&&_[_0xe3b6('0xb0')](this[_0xe3b6('0x12d')][_0x5bd485[_0xe3b6('0x12f')]][_0xe3b6('0x130')])&&_0x5bd485[_0xe3b6('0xe0')]==='1'&&_0x5bd485[_0xe3b6('0x131')]==='0'){if(this[_0xe3b6('0x25')][_0x5bd485['stateinterface']]){if(!this[_0xe3b6('0x25')][_0x5bd485[_0xe3b6('0x132')]][_0xe3b6('0x130')]){this['agents'][_0x5bd485['stateinterface']][_0xe3b6('0x130')]=!![];this[_0xe3b6('0x12d')][_0x5bd485[_0xe3b6('0x12f')]][_0xe3b6('0x130')]=!![];this[_0xe3b6('0x12d')][_0x5bd485[_0xe3b6('0x12f')]]['stateinterface']=_0x5bd485[_0xe3b6('0x132')];}}}}else if((strategy[this[_0xe3b6('0x23')][this[_0xe3b6('0x12d')][_0x5bd485['actionid']][_0xe3b6('0xb5')]][_0xe3b6('0x12e')]]||_0xe3b6('0x1d'))===_0xe3b6('0x1d')){if(this[_0xe3b6('0x12d')][_0x5bd485['actionid']]){if(this['agents'][_0x5bd485['stateinterface']]){this[_0xe3b6('0x12d')][_0x5bd485[_0xe3b6('0x12f')]]['stateinterface']=_0x5bd485[_0xe3b6('0x132')];if(_['isNil'](this['queueBooked'][this[_0xe3b6('0x12d')][_0x5bd485[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]])){this['queueBooked'][this['actions'][_0x5bd485[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]]=[];}this[_0xe3b6('0x133')][this[_0xe3b6('0x12d')][_0x5bd485['actionid']]['queue']]['push'](_[_0xe3b6('0x95')](_[_0xe3b6('0xd6')](this['actions'][_0x5bd485[_0xe3b6('0x12f')]],[_0xe3b6('0x134'),_0xe3b6('0x132')]),{'status':_0x5bd485['status'],'paused':_0x5bd485[_0xe3b6('0x131')]}));}}}};function unlockQueueStatus(_0x316d38,_0x82ebe0){setTimeout(function(){if(_[_0xe3b6('0x46')](_0x316d38['queueStatusComplete'])){loggerBooked['error'](_0xe3b6('0x135'),_0x82ebe0);}_0x316d38['queueStatusComplete']=!![];loggerBooked[_0xe3b6('0x83')](_0xe3b6('0x136'),_0x82ebe0,JSON[_0xe3b6('0x50')](_[_0xe3b6('0xd6')](_0x316d38,[_0xe3b6('0x49'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xe3b6('0x1f')][_0xe3b6('0x42')]=function(_0x3c08d3){var _0x205b17=this;var _0x2f8293=_0x205b17['voiceQueues'][_0x205b17['actions'][_0x3c08d3['actionid']][_0xe3b6('0xb5')]];if(strategy[this[_0xe3b6('0x23')][this['actions'][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]][_0xe3b6('0x12e')]]===_0xe3b6('0x1e')){if(this['actions'][_0x3c08d3['actionid']]&&this['actions'][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0x132')]){this[_0xe3b6('0x22')][_0xe3b6('0x137')](this['actions'][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0x134')],this[_0xe3b6('0x12d')][_0x3c08d3['actionid']][_0xe3b6('0x132')])['catch'](function(_0x1e67fc){logger['error'](_0xe3b6('0x138'),util[_0xe3b6('0x9f')](_0x1e67fc,{'showHidden':![],'depth':null}));})[_0xe3b6('0x139')](function(){_0x205b17['updateOriginated'](_0x205b17[_0xe3b6('0x23')][_0x205b17[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]]['queue']]);_0x205b17[_0xe3b6('0x25')][_0x205b17[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0x132')]]['locked']=![];delete _0x205b17[_0xe3b6('0x12d')][_0x3c08d3['actionid']];unlockQueueStatus(_0x2f8293);});}else{this['updateOriginated'](this['voiceQueues'][this['actions'][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]]);this[_0xe3b6('0xc4')]({'active':![],'ContactId':this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xd7')],'ListId':this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xd8')],'VoiceQueueId':this['actions'][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xda')]||undefined,'CampaignId':this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0x102')]||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x13a')));delete this[_0xe3b6('0x12d')][_0x3c08d3['actionid']];unlockQueueStatus(_0x2f8293);}}else if((strategy[this[_0xe3b6('0x23')][this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]]['strategy']]||'rrmemory')===_0xe3b6('0x1d')){var _0x4a93f8;if(this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]]&&!_['isEmpty'](this[_0xe3b6('0x133')][this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]]['queue']])){if(this[_0xe3b6('0x2f')][_0x205b17[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]]){this['queueBookedRR'][_0x205b17[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]]=this[_0xe3b6('0x2f')][this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]]?this[_0xe3b6('0x2f')][this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]]:this['queueBooked'][this[_0xe3b6('0x12d')][_0x3c08d3['actionid']]['queue']]?this[_0xe3b6('0x133')][this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]][_0xe3b6('0x13b')]||0x0:0x0;}this['queueBooked'][this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]][_0xe3b6('0x13b')]=this[_0xe3b6('0x2f')][this[_0xe3b6('0x12d')][_0x3c08d3[_0xe3b6('0x12f')]][_0xe3b6('0xb5')]];for(var _0x5c966d=0x0;_0x5c966d=0x0;})['catch'](myreject(_0x25462f)));}}else{_0x54a506[_0xe3b6('0x151')](ami['Action']({'action':_0xe3b6('0x152'),'command':util[_0xe3b6('0x7e')]('iftime\x20%s,%s',_0x5b4be9,!_[_0xe3b6('0x46')](config[_0xe3b6('0x158')][_0x21df35])?_0x21df35:'')})[_0xe3b6('0xbd')](function(_0x467fc6){return _0x467fc6[_0xe3b6('0x155')][_0xe3b6('0x156')](_0xe3b6('0x157'))>=0x0;})[_0xe3b6('0xb8')](myreject(_0x25462f)));}BPromise[_0xe3b6('0x159')](_0x54a506)[_0xe3b6('0xbd')](function(_0x410c57){var _0x4cdf06=_[_0xe3b6('0x15a')](_0x410c57);if(_0x4cdf06){return _0x56c297(_0x4cdf06);}else{_0x4be9e7[_0xe3b6('0x47')]=_0x12f0c4?_0xe3b6('0x15b'):_0xe3b6('0x15c');return _0x25462f(msgResponse(_0xe3b6('0x15d'),_0xe3b6('0x14b'),_0xe3b6('0x15e')+_0x12f0c4+'\x20'+_0x2867fc+'\x20Interval\x20is\x20overtime:\x20'+util[_0xe3b6('0x9f')](_0x5b4be9,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x21df35));}})['catch'](function(_0xfbee03){return _0x25462f(msgResponse(_0xe3b6('0x149'),_0xe3b6('0x14b'),JSON[_0xe3b6('0x50')](_0xfbee03)));});});};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x15f')]=function(_0x1b48a5){var _0x4d9e2f=this;return function(){switch(_0x1b48a5[_0xe3b6('0x160')]){case _0xe3b6('0x161'):freeVariablesPredictive(_0x1b48a5);_0x4d9e2f['handlePower'](_0x1b48a5,0x1);break;case'power':freeVariablesPredictive(_0x1b48a5);_0x4d9e2f[_0xe3b6('0x162')](_0x1b48a5,_0x1b48a5['dialPowerLevel']);break;case _0xe3b6('0xa'):_0x4d9e2f[_0xe3b6('0xa')](_0x1b48a5);break;case _0xe3b6('0x9'):freeVariablesPredictive(_0x1b48a5);_0x4d9e2f[_0xe3b6('0x162')](_0x1b48a5,0x1);break;default:freeVariablesPredictive(_0x1b48a5);logger[_0xe3b6('0x9e')](_0xe3b6('0x163'),_0x1b48a5[_0xe3b6('0x49')],_0xe3b6('0x164'));}};};Dialer['prototype'][_0xe3b6('0x165')]=function(_0x25bd1c){return BPromise[_0xe3b6('0xb7')]()[_0xe3b6('0xbd')](cmHopper[_0xe3b6('0x166')](_0x25bd1c['id'],previewRecallmeReminderInterval))[_0xe3b6('0xbd')](function(_0x7865cf){for(var _0x126c76=0x0;_0x126c76<_0x7865cf[_0xe3b6('0x150')];_0x126c76++){var _0x22eeb4=_0x7865cf[_0x126c76][_0xe3b6('0x167')][_0xe3b6('0x49')];if(_0x22eeb4)io['to'](util[_0xe3b6('0x7e')](_0xe3b6('0x168'),_0x22eeb4))[_0xe3b6('0x54')](_0xe3b6('0x169'),{'hopper':_0x7865cf[_0x126c76]});}})[_0xe3b6('0xb8')](function(_0x3a9fdc){});};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x16a')]=function(_0x53b09a){var _0x119f9d=this;return function(){_0x119f9d['handleIvr'](_0x53b09a);};};Dialer[_0xe3b6('0x1f')][_0xe3b6('0xc')]=function(_0x4e4e60){var _0xa346bd=this;if(isNotPreview(_0x4e4e60['dialMethod'])){if(isVoiceQueueOutbound(_0x4e4e60[_0xe3b6('0x5c')])&&isActive(_0x4e4e60[_0xe3b6('0x5e')])){_0x4e4e60[_0xe3b6('0xa4')]=!![];BPromise[_0xe3b6('0xb7')]()[_0xe3b6('0xbd')](checkIsLoggedIn(_0x4e4e60,_0x4e4e60['loggedIn']))['then'](checkIsActive(_0x4e4e60,_0x4e4e60['dialActive']))['then'](checkInterval(_0x4e4e60))['then'](_0xa346bd[_0xe3b6('0x146')](_0x4e4e60))['then'](_0xa346bd['checkIfTime'](_0x4e4e60[_0xe3b6('0x16b')],_0x4e4e60[_0xe3b6('0x16c')],_0x4e4e60[_0xe3b6('0x49')],_0x4e4e60))['then'](_0xa346bd[_0xe3b6('0x14a')](_0x4e4e60[_0xe3b6('0x4b')],_0x4e4e60['dialTimezone'],_0x4e4e60[_0xe3b6('0x49')],_0x4e4e60))[_0xe3b6('0xbd')](_0xa346bd[_0xe3b6('0x15f')](_0x4e4e60))[_0xe3b6('0xb8')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4e4e60));}else{notSendMessagesQueue(_0x4e4e60);}}else{freeVariablesPredictive(_0x4e4e60);if(_0x4e4e60[_0xe3b6('0x16d')]){_0xa346bd[_0xe3b6('0x165')](_0x4e4e60);}}};Dialer['prototype'][_0xe3b6('0x145')]=function(){var _0xe8d3ef=this;var _0x2f6b86;for(var _0x1c4712 in this[_0xe3b6('0x24')]){if(typeof this['campaigns'][_0x1c4712]!==_0xe3b6('0xaf')){_0x2f6b86=this[_0xe3b6('0x24')][_0x1c4712];if(isCampaignIvr(_0x2f6b86[_0xe3b6('0x5c')])&&isActive(_0x2f6b86['active'])){_0x2f6b86[_0xe3b6('0xa4')]=!![];BPromise[_0xe3b6('0xb7')]()[_0xe3b6('0xbd')](checkIsActive(_0x2f6b86,_0x2f6b86[_0xe3b6('0x7d')]))[_0xe3b6('0xbd')](checkInterval(_0x2f6b86))[_0xe3b6('0xbd')](_0xe8d3ef[_0xe3b6('0x146')](_0x2f6b86))['then'](_0xe8d3ef[_0xe3b6('0x16e')](_0x2f6b86[_0xe3b6('0x16b')],_0x2f6b86[_0xe3b6('0x16c')],_0x2f6b86[_0xe3b6('0x49')],_0x2f6b86))[_0xe3b6('0xbd')](_0xe8d3ef[_0xe3b6('0x14a')](_0x2f6b86[_0xe3b6('0x4b')],_0x2f6b86['dialTimezone'],_0x2f6b86['name'],_0x2f6b86))[_0xe3b6('0xbd')](_0xe8d3ef[_0xe3b6('0x16a')](_0x2f6b86))['catch'](loggerCatchQueueSummary(_0xe3b6('0x16f'),_0x2f6b86));}else{notSendMessagesCampaign(_0x2f6b86);}}}};function getCallerIdRandom(_0x6b3003,_0x2c6de5){var _0x111519;var _0x4cf23d;var _0x26c32a;if(_0x2c6de5<=0x0){_0x2c6de5=0x1;}_0x111519=new RegExp(_0xe3b6('0x170')+_0x2c6de5+'}$');_0x4cf23d=Math['pow'](0xa,_0x2c6de5-0x1);_0x26c32a=Math[_0xe3b6('0x171')](0xa,_0x2c6de5)-0x1;return util[_0xe3b6('0x7e')]('%s',_[_0xe3b6('0x172')](_0x6b3003,_0x111519,_['random'](_0x4cf23d,_0x26c32a)));}function extractCalleridName(_0x23bc49){var _0x5b33a1=_0x23bc49[_0xe3b6('0x173')](/"(.*?)"/);return _0x5b33a1?_0x5b33a1[0x1]:_0x23bc49;}function extractCalleridNumber(_0x4e3164){var _0x4aa4d6=_0x4e3164[_0xe3b6('0x173')](/<(.*?)>/);return _0x4aa4d6?_0x4aa4d6[0x1]:_0x4e3164;}Dialer[_0xe3b6('0x1f')]['actionOriginate']=function(_0x5329a0,_0x19b159){var _0x21e915=this;var _0x3de750=uuid['v4']();this[_0xe3b6('0x12d')][_0x3de750]=new Action(_0x5329a0,_0x19b159,_0x3de750);return new BPromise(function(_0x111c37,_0x2631f2){if(_[_0xe3b6('0x46')](_0x5329a0)&&typeof _0x5329a0!==_0xe3b6('0x174')){return _0x2631f2(msgResponse(_0xe3b6('0x175'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xe3b6('0x46')](_0x19b159[_0xe3b6('0x176')])||_0x19b159['phone']===null){return _0x2631f2(msgResponse(_0xe3b6('0x175'),_0xe3b6('0x14b'),_0xe3b6('0x177')));}var _0x57a542={'XMD-CALLERID':_0x21e915[_0xe3b6('0x12d')][_0x3de750][_0xe3b6('0x178')](),'XMD-AGI':_0x5329a0[_0xe3b6('0x111')]?util[_0xe3b6('0x7e')](_0xe3b6('0x179'),ipAgi,_0x5329a0[_0xe3b6('0x111')]):_0xe3b6('0x17a'),'XMD-AGIAFTER':_0x5329a0['dialQueueProject2']?util['format'](_0xe3b6('0x179'),ipAgi,_0x5329a0[_0xe3b6('0x116')]):_0xe3b6('0x17a'),'XMD-QUEUE':_0x5329a0['type']===_0xe3b6('0x55')?util[_0xe3b6('0x7e')]('\x22%s,%s%s,,,%s\x22',_0x5329a0[_0xe3b6('0x49')],_0x5329a0['dialQueueOptions']||'',_0x5329a0['dialAgiAfterHangupAgent']?'c':'',_0x5329a0[_0xe3b6('0x17b')]||0x3):_0xe3b6('0x17a'),'XMD-CONTACTID':_0x19b159[_0xe3b6('0xd7')],'XMD-CDRTYPE':_0xe3b6('0x7'),'CALLERID(all)':_0x21e915[_0xe3b6('0x12d')][_0x3de750][_0xe3b6('0x178')](),'XMD-AMD':_0x5329a0[_0xe3b6('0xe8')]?'ACTIVE':_0xe3b6('0x17a'),'XMD-DESTINATION':_0xe3b6('0xe7')};if(_0x5329a0[_0xe3b6('0xe8')]){_0x57a542[_0xe3b6('0x17c')]=_0x5329a0[_0xe3b6('0x17d')]||0x9c4;_0x57a542[_0xe3b6('0x17e')]=_0x5329a0[_0xe3b6('0x17f')]||0x5dc;_0x57a542['XMD-AMDAFTERGREETINGSILENCE']=_0x5329a0[_0xe3b6('0x180')]||0x320;_0x57a542['XMD-AMDTOTALANALYSISTIME']=_0x5329a0[_0xe3b6('0x181')]||0x1388;_0x57a542[_0xe3b6('0x182')]=_0x5329a0[_0xe3b6('0x183')]||0x64;_0x57a542[_0xe3b6('0x184')]=_0x5329a0[_0xe3b6('0x185')]||0x32;_0x57a542[_0xe3b6('0x186')]=_0x5329a0[_0xe3b6('0x187')]||0x3;_0x57a542[_0xe3b6('0x188')]=_0x5329a0[_0xe3b6('0x189')]||0x100;_0x57a542[_0xe3b6('0x18a')]=_0x5329a0[_0xe3b6('0x18b')]||0x1388;}if(_0x5329a0[_0xe3b6('0x5c')]===_0xe3b6('0x55')){_0x57a542[_0xe3b6('0x18c')]=_0x19b159[_0xe3b6('0xda')];}else{_0x57a542['XMD-CAMPAIGNID']=_0x19b159[_0xe3b6('0x102')];}for(var _0x19297a in _0x19b159[_0xe3b6('0x18d')]){if(typeof _0x19b159['Contact'][_0x19297a]!==_0xe3b6('0xaf')){if(isNotNull(_0x19b159['Contact'][_0x19297a])&&_0x19297a!=='id'&&_0x19297a!=='tags'&&_0x19297a!==_0xe3b6('0x18e')&&_0x19297a!==_0xe3b6('0x18f')){_0x57a542[util[_0xe3b6('0x7e')](_0xe3b6('0x190'),_0xe3b6('0x191'),_['toUpper'](_0x19297a))]=_0x19b159[_0xe3b6('0x18d')][_0x19297a];}}}var _0x3af250=_0x21e915[_0xe3b6('0xde')](_0x5329a0[_0xe3b6('0x7c')])?getCallerId(_0x5329a0[_0xe3b6('0x7c')]['callerid'],_0x5329a0[_0xe3b6('0x192')],_0x5329a0['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5329a0[_0xe3b6('0x5f')],_0x5329a0[_0xe3b6('0x193')]):_0x5329a0[_0xe3b6('0x5f')]):getCallerId(_[_0xe3b6('0xb0')](_0x5329a0[_0xe3b6('0x147')])?_0x5329a0[_0xe3b6('0x7c')][_0xe3b6('0x194')]:_0x5329a0[_0xe3b6('0x147')][_0xe3b6('0x194')],_0x5329a0['dialOriginateCallerIdName'],_0x5329a0[_0xe3b6('0x193')]>0x0?getCallerIdRandom(_0x5329a0['dialOriginateCallerIdNumber'],_0x5329a0[_0xe3b6('0x193')]):_0x5329a0[_0xe3b6('0x5f')]);if(_0x3af250){_0x57a542[_0xe3b6('0x195')]=_0x21e915[_0xe3b6('0x12d')][_0x3de750][_0xe3b6('0x196')]=extractCalleridName(_0x3af250);_0x57a542[_0xe3b6('0x197')]=_0x19b159[_0xe3b6('0x176')];}return ami[_0xe3b6('0xb1')]({'actionid':_0x3de750,'action':'originate','channel':_0x21e915[_0xe3b6('0xde')](_0x5329a0[_0xe3b6('0x7c')])?util[_0xe3b6('0x7e')](_0xe3b6('0x198'),_0x5329a0['Trunk'][_0xe3b6('0x49')],isNotNull(_0x5329a0['dialPrefix'])?_0x5329a0[_0xe3b6('0x199')]['trim']()||'':'',_0x5329a0[_0xe3b6('0x19a')]>0x0?_0x19b159[_0xe3b6('0x176')][_0xe3b6('0x19b')](_0x5329a0[_0xe3b6('0x19a')]):_0x19b159[_0xe3b6('0x176')]):util[_0xe3b6('0x7e')](_0xe3b6('0x198'),_['isNil'](_0x5329a0[_0xe3b6('0x147')])?_0x5329a0[_0xe3b6('0x7c')][_0xe3b6('0x49')]:_0x5329a0[_0xe3b6('0x147')][_0xe3b6('0x49')],isNotNull(_0x5329a0[_0xe3b6('0x199')])?_0x5329a0[_0xe3b6('0x199')][_0xe3b6('0x19c')]()||'':'',_0x5329a0['dialCutDigit']>0x0?_0x19b159[_0xe3b6('0x176')][_0xe3b6('0x19b')](_0x5329a0['dialCutDigit']):_0x19b159[_0xe3b6('0x176')]),'callerid':_0x3af250,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x57a542,'timeout':(_0x5329a0[_0xe3b6('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3de750})[_0xe3b6('0xbd')](function(_0x413a39){return _0x111c37(_0x413a39);})[_0xe3b6('0xb8')](function(_0x237a0c){_0x5329a0['outboundOriginateFailureCallsDay']+=0x1;var _0x44468a=new History(_0x21e915[_0xe3b6('0x12d')][_0x3de750]);logger['error'](util[_0xe3b6('0x7e')]('[originateError]:\x20%s',JSON[_0xe3b6('0x50')](_0x237a0c)));_0x44468a[_0xe3b6('0xab')]=0xe;_0x44468a[_0xe3b6('0xeb')]=_0xe3b6('0x19d');_0x44468a[_0xe3b6('0xac')]=moment()[_0xe3b6('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x44468a[_0xe3b6('0x125')]=_0x44468a['starttime'];_0x21e915[_0xe3b6('0xd0')](_0x44468a)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x19e')));_0x21e915[_0xe3b6('0xce')](_0x44468a)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x19e')))['finally'](function(){delete _0x21e915[_0xe3b6('0x12d')][_0x3de750];return _0x2631f2(msgResponse(_0xe3b6('0x175'),_0xe3b6('0x19f'),_0xe3b6('0x1a0')));});});});};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x35')]=function(_0x3f8dd7){var _0x11dea5=this['actions'][_0x3f8dd7[_0xe3b6('0x12f')]];if(_0x11dea5){delete this[_0xe3b6('0x12d')][_0x3f8dd7[_0xe3b6('0x12f')]];_0x11dea5['responsetime']=moment()[_0xe3b6('0x7e')](_0xe3b6('0x101'));var _0x1f0378=_0x11dea5['type']===_0xe3b6('0x9a')?this[_0xe3b6('0x24')][_0x11dea5[_0xe3b6('0xb5')]]:this[_0xe3b6('0x23')][_0x11dea5[_0xe3b6('0x1a1')]()];if(!this[_0xe3b6('0xdc')](_0x3f8dd7[_0xe3b6('0x1a2')])){this[_0xe3b6('0xb4')](_0x1f0378);return this[_0xe3b6('0x1a3')](_0x11dea5,_0x1f0378,_0x3f8dd7)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1a4')));}this[_0xe3b6('0x2a')][_0x3f8dd7[_0xe3b6('0xe3')]]=_0x11dea5;}};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x1a5')]=function(_0x402a43,_0x58315c,_0x11a124){var _0x8b0948=new History(_0x58315c);if(_0x8b0948[_0xe3b6('0xf5')]+_0x8b0948[_0xe3b6('0xf6')]+_0x8b0948[_0xe3b6('0xf7')]+_0x8b0948[_0xe3b6('0xf8')]+_0x8b0948[_0xe3b6('0xf9')]+_0x8b0948[_0xe3b6('0x109')]+_0x8b0948[_0xe3b6('0xf3')]+_0x8b0948[_0xe3b6('0xfa')]>=_0x11a124[_0xe3b6('0xfb')]-0x1){return!![];}switch(_0x402a43){case 0x3:if(_0x8b0948[_0xe3b6('0xf7')]>=_0x11a124[_0xe3b6('0x1a6')]-0x1){return!![];}this[_0xe3b6('0xc4')]({'active':![],'countnoanswerretry':_0x8b0948[_0xe3b6('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x11a124['dialNoAnswerRetryFrequency'],_0xe3b6('0x100'))['format'](_0xe3b6('0x101')),'ContactId':_0x8b0948['ContactId'],'ListId':_0x8b0948[_0xe3b6('0xd8')],'VoiceQueueId':_0x8b0948[_0xe3b6('0xda')]||undefined,'CampaignId':_0x8b0948['CampaignId']||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1a7')));break;case 0x5:if(_0x8b0948['countbusyretry']>=_0x11a124[_0xe3b6('0x1a8')]-0x1){return!![];}this[_0xe3b6('0xc4')]({'active':![],'countbusyretry':_0x8b0948[_0xe3b6('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x11a124[_0xe3b6('0x1a9')],_0xe3b6('0x100'))[_0xe3b6('0x7e')](_0xe3b6('0x101')),'ContactId':_0x8b0948[_0xe3b6('0xd7')],'ListId':_0x8b0948[_0xe3b6('0xd8')],'VoiceQueueId':_0x8b0948[_0xe3b6('0xda')]||undefined,'CampaignId':_0x8b0948[_0xe3b6('0x102')]||undefined})['catch'](loggerCatch(_0xe3b6('0x1aa')));break;case 0x8:if(_0x8b0948[_0xe3b6('0xf6')]>=_0x11a124[_0xe3b6('0x1ab')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x8b0948['countcongestionretry']+=0x1,'scheduledat':moment()[_0xe3b6('0x10b')](_0x11a124['dialCongestionRetryFrequency'],_0xe3b6('0x100'))[_0xe3b6('0x7e')](_0xe3b6('0x101')),'ContactId':_0x8b0948[_0xe3b6('0xd7')],'ListId':_0x8b0948['ListId'],'VoiceQueueId':_0x8b0948[_0xe3b6('0xda')]||undefined,'CampaignId':_0x8b0948[_0xe3b6('0x102')]||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1ac')));break;case 0x0:if(_0x8b0948[_0xe3b6('0xf8')]>=_0x11a124['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xe3b6('0xc4')]({'active':![],'countnosuchnumberretry':_0x8b0948[_0xe3b6('0xf8')]+=0x1,'scheduledat':moment()[_0xe3b6('0x10b')](_0x11a124[_0xe3b6('0x1ad')],_0xe3b6('0x100'))[_0xe3b6('0x7e')](_0xe3b6('0x101')),'ContactId':_0x8b0948[_0xe3b6('0xd7')],'ListId':_0x8b0948['ListId'],'VoiceQueueId':_0x8b0948[_0xe3b6('0xda')]||undefined,'CampaignId':_0x8b0948[_0xe3b6('0x102')]||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1ae')));}break;case 0xa:if(_0x8b0948['countdropretry']>=_0x11a124[_0xe3b6('0x123')]-0x1){return!![];}this[_0xe3b6('0xc4')]({'active':![],'countdropretry':_0x8b0948[_0xe3b6('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x11a124[_0xe3b6('0x124')],_0xe3b6('0x100'))[_0xe3b6('0x7e')](_0xe3b6('0x101')),'ContactId':_0x8b0948[_0xe3b6('0xd7')],'ListId':_0x8b0948[_0xe3b6('0xd8')],'VoiceQueueId':_0x8b0948['VoiceQueueId']||undefined,'CampaignId':_0x8b0948[_0xe3b6('0x102')]||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1af')));break;case 0xb:if(_0x8b0948[_0xe3b6('0x109')]>=_0x11a124[_0xe3b6('0x12a')]-0x1){return!![];}this[_0xe3b6('0xc4')]({'active':![],'countabandonedretry':_0x8b0948[_0xe3b6('0x109')]+=0x1,'scheduledat':moment()['add'](_0x11a124['dialAbandonedRetryFrequency'],_0xe3b6('0x100'))['format'](_0xe3b6('0x101')),'ContactId':_0x8b0948[_0xe3b6('0xd7')],'ListId':_0x8b0948[_0xe3b6('0xd8')],'VoiceQueueId':_0x8b0948[_0xe3b6('0xda')]||undefined,'CampaignId':_0x8b0948[_0xe3b6('0x102')]||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x12b')));break;case 0x13:if(_0x8b0948[_0xe3b6('0xf3')]>=_0x11a124[_0xe3b6('0xfe')]-0x1){return!![];}this[_0xe3b6('0xc4')]({'active':![],'countmachineretry':_0x8b0948[_0xe3b6('0xf3')]+=0x1,'scheduledat':moment()[_0xe3b6('0x10b')](_0x11a124[_0xe3b6('0x10c')],_0xe3b6('0x100'))[_0xe3b6('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x8b0948[_0xe3b6('0xd7')],'ListId':_0x8b0948[_0xe3b6('0xd8')],'VoiceQueueId':_0x8b0948[_0xe3b6('0xda')]||undefined,'CampaignId':_0x8b0948[_0xe3b6('0x102')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x8b0948[_0xe3b6('0xfa')]>=_0x11a124['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xe3b6('0xc4')]({'active':![],'countagentrejectretry':_0x8b0948[_0xe3b6('0xfa')]+=0x1,'scheduledat':moment()[_0xe3b6('0x10b')](_0x11a124[_0xe3b6('0x1b0')],'minutes')[_0xe3b6('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x8b0948[_0xe3b6('0xd7')],'ListId':_0x8b0948[_0xe3b6('0xd8')],'VoiceQueueId':_0x8b0948['VoiceQueueId']||undefined,'CampaignId':_0x8b0948['CampaignId']||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1b1')));break;default:return!![];}};Dialer[_0xe3b6('0x1f')]['callProgressDetecting']=function(_0x3c53e9,_0x553e78,_0x2ed8b7){var _0x1e06ef=this;var _0x512dd8=new History(_0x3c53e9);var _0x384ff8=![];var _0x1dbfb2;var _0xf761f3;return new BPromise(function(_0x1a52c9,_0x59e468){if(_[_0xe3b6('0x46')](_0x553e78)&&typeof _0x553e78!==_0xe3b6('0x174')){return _0x59e468(msgResponse('[callProgressDetecting]',_0xe3b6('0x14b'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x2ed8b7)&&typeof _0x2ed8b7!=='object'){return _0x59e468(msgResponse(_0xe3b6('0x1b2'),_0xe3b6('0x14b'),_0xe3b6('0x1b3')));}_0x1e06ef[_0xe3b6('0xbb')](_0x512dd8,_0x2ed8b7['reason'],_0x553e78)[_0xe3b6('0xbd')](function(_0x4b7bb6){if(_0x4b7bb6['additional']==0x1)_0x384ff8=!![];switch(_0x2ed8b7['reason']){case'0':_0x553e78[_0xe3b6('0x68')]+=0x1;_0x512dd8['state']=0x0;_0x512dd8[_0xe3b6('0xeb')]=_0xe3b6('0x1b4');_0x512dd8[_0xe3b6('0xf8')]+=0x1;_0x512dd8[_0xe3b6('0x108')]+=0x1;ami[_0xe3b6('0x54')](_0xe3b6('0x1b5'),ut[_0xe3b6('0xee')](_0x3c53e9,'nosuchnumber'));_0x1dbfb2=_0x553e78[_0xe3b6('0x1ad')];_0xf761f3=_0x553e78[_0xe3b6('0x120')];_0x1e06ef[_0xe3b6('0xd0')](_0x512dd8)['catch'](loggerCatch(_0xe3b6('0xf4')));if(_0x1e06ef['checkRetriveMax'](0x0,_0x3c53e9,_0x553e78)&&!_0x384ff8){if(_0x512dd8['countnosuchnumberretry']>=_0x553e78[_0xe3b6('0x1b6')]){_0x1e06ef[_0xe3b6('0xff')](_0x512dd8,_0x1a52c9,_0x59e468,_0xe3b6('0x1b7'));}else{_0x1e06ef[_0xe3b6('0xfc')](_0x512dd8,_0x1a52c9,_0x59e468,_0xe3b6('0x1b7'));}}break;case'3':_0x553e78[_0xe3b6('0x67')]+=0x1;_0x512dd8['state']=0x3;_0x512dd8[_0xe3b6('0xeb')]='NoAnswer';_0x512dd8[_0xe3b6('0xf7')]+=0x1;_0x512dd8[_0xe3b6('0x108')]+=0x1;ami[_0xe3b6('0x54')](_0xe3b6('0x1b8'),ut[_0xe3b6('0xee')](_0x3c53e9,_0xe3b6('0x1b9')));_0x1dbfb2=_0x553e78[_0xe3b6('0x1ba')];_0xf761f3=_0x553e78[_0xe3b6('0x120')];_0x1e06ef[_0xe3b6('0xd0')](_0x512dd8)[_0xe3b6('0xb8')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1e06ef['checkRetriveMax'](0x3,_0x3c53e9,_0x553e78)&&!_0x384ff8){if(_0x512dd8[_0xe3b6('0xf7')]>=_0x553e78['dialNoAnswerMaxRetry']){_0x1e06ef[_0xe3b6('0xff')](_0x512dd8,_0x1a52c9,_0x59e468,_0xe3b6('0x1bb'));}else{_0x1e06ef[_0xe3b6('0xfc')](_0x512dd8,_0x1a52c9,_0x59e468,_0xe3b6('0x1bb'));}}break;case'5':_0x553e78[_0xe3b6('0x64')]+=0x1;_0x512dd8[_0xe3b6('0xab')]=0x5;_0x512dd8[_0xe3b6('0xeb')]='Busy';_0x512dd8[_0xe3b6('0xf5')]+=0x1;_0x512dd8[_0xe3b6('0x108')]+=0x1;ami[_0xe3b6('0x54')](_0xe3b6('0x1bc'),ut[_0xe3b6('0xee')](_0x3c53e9,_0xe3b6('0x1bd')));_0x1dbfb2=_0x553e78[_0xe3b6('0x1a9')];_0xf761f3=_0x553e78[_0xe3b6('0x120')];_0x1e06ef[_0xe3b6('0xd0')](_0x512dd8)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1be')));if(_0x1e06ef[_0xe3b6('0x1a5')](0x5,_0x3c53e9,_0x553e78)&&!_0x384ff8){if(_0x512dd8[_0xe3b6('0xf5')]>=_0x553e78[_0xe3b6('0x1a8')]){_0x1e06ef[_0xe3b6('0xff')](_0x512dd8,_0x1a52c9,_0x59e468,_0xe3b6('0x1bf'));}else{_0x1e06ef[_0xe3b6('0xfc')](_0x512dd8,_0x1a52c9,_0x59e468,'reason\x205\x20busy');}}break;case'8':_0x553e78[_0xe3b6('0x1c0')]+=0x1;_0x512dd8['state']=0x8;_0x512dd8[_0xe3b6('0xeb')]=_0xe3b6('0x1c1');_0x512dd8['countcongestionretry']+=0x1;_0x512dd8[_0xe3b6('0x108')]+=0x1;_0x1dbfb2=_0x553e78[_0xe3b6('0x1c2')];_0xf761f3=_0x553e78['callAdditionalPhoneAfterMin'];ami['emit'](_0xe3b6('0x1c3'),ut['buildObj'](_0x3c53e9,_0xe3b6('0x1c4')));_0x1e06ef[_0xe3b6('0xd0')](_0x512dd8)[_0xe3b6('0xb8')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1e06ef[_0xe3b6('0x1a5')](0x8,_0x3c53e9,_0x553e78)&&!_0x384ff8){if(_0x512dd8[_0xe3b6('0xf6')]>=_0x553e78[_0xe3b6('0x1ab')]){_0x1e06ef[_0xe3b6('0xff')](_0x512dd8,_0x1a52c9,_0x59e468,_0xe3b6('0x1c5'));}else{_0x1e06ef[_0xe3b6('0xfc')](_0x512dd8,_0x1a52c9,_0x59e468,'reason\x208\x20congestion');}}break;case'11':_0x553e78[_0xe3b6('0x1c6')]+=0x1;_0x512dd8[_0xe3b6('0xab')]=0xb;_0x512dd8[_0xe3b6('0xeb')]='Abandoned';_0x512dd8[_0xe3b6('0x109')]+=0x1;_0x512dd8[_0xe3b6('0x108')]+=0x1;_0x1dbfb2=_0x553e78[_0xe3b6('0x129')];_0xf761f3=_0x553e78[_0xe3b6('0x120')];_0x1e06ef[_0xe3b6('0xd0')](_0x512dd8)['catch'](loggerCatch(_0xe3b6('0x12c')));if(_0x1e06ef[_0xe3b6('0x1a5')](0xb,_0x3c53e9,_0x553e78)&&!_0x384ff8){if(_0x512dd8[_0xe3b6('0x109')]>=_0x553e78[_0xe3b6('0x12a')]){_0x1e06ef[_0xe3b6('0xff')](_0x512dd8,_0x1a52c9,_0x59e468,'reason\x2011\x20abandoned');}else{_0x1e06ef[_0xe3b6('0xfc')](_0x512dd8,_0x1a52c9,_0x59e468,_0xe3b6('0x1c7'));}}break;case'20':_0x553e78[_0xe3b6('0x6b')]+=0x1;_0x512dd8['state']=0x14;_0x512dd8['statedesc']=_0xe3b6('0x1c8');_0x512dd8[_0xe3b6('0xfa')]+=0x1;_0x512dd8[_0xe3b6('0x108')]+=0x1;_0x1dbfb2=_0x553e78[_0xe3b6('0x1b0')];_0xf761f3=_0x553e78[_0xe3b6('0x120')];ami['emit'](_0xe3b6('0x1c9'),ut[_0xe3b6('0xee')](_0x3c53e9,_0xe3b6('0x1ca')));_0x1e06ef[_0xe3b6('0xd0')](_0x512dd8)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1cb')));if(_0x1e06ef[_0xe3b6('0x1a5')](0x14,_0x3c53e9,_0x553e78)&&!_0x384ff8){if(_0x512dd8[_0xe3b6('0xfa')]>=_0x553e78[_0xe3b6('0x1cc')]){_0x1e06ef[_0xe3b6('0xff')](_0x512dd8,_0x1a52c9,_0x59e468,_0xe3b6('0x1cd'));}else{_0x1e06ef[_0xe3b6('0xfc')](_0x512dd8,_0x1a52c9,_0x59e468,_0xe3b6('0x1cd'));}}break;default:_0x553e78[_0xe3b6('0x6c')]+=0x1;_0x512dd8['state']=0xc;_0x512dd8[_0xe3b6('0xeb')]=_0x2ed8b7[_0xe3b6('0x113')];_0x1dbfb2=_0x553e78['dialAgentRejectRetryFrequency'];_0xf761f3=_0x553e78[_0xe3b6('0x120')];_0x1e06ef[_0xe3b6('0xd0')](_0x512dd8)[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1ce')));if(_0x1e06ef[_0xe3b6('0x1a5')](_0x2ed8b7[_0xe3b6('0x113')],_0x3c53e9,_0x553e78)&&!_0x384ff8){if(_0x512dd8[_0xe3b6('0xf5')]+_0x512dd8[_0xe3b6('0xf6')]+_0x512dd8[_0xe3b6('0xf7')]+_0x512dd8[_0xe3b6('0xf8')]+_0x512dd8[_0xe3b6('0xf9')]+_0x512dd8[_0xe3b6('0x109')]+_0x512dd8[_0xe3b6('0xf3')]+_0x512dd8[_0xe3b6('0xfa')]>=_0x553e78['dialGlobalMaxRetry']){_0x1e06ef[_0xe3b6('0xfc')](_0x512dd8,_0x1a52c9,_0x59e468,_0x2ed8b7['reason']);}else{_0x1e06ef['createStateFinal'](_0x512dd8,_0x1a52c9,_0x59e468,_0x2ed8b7[_0xe3b6('0x113')]);}}}})['then'](function(_0x9aff2b){if(_0x384ff8){_0x1e06ef['swapAdditionalPhones'](_0x512dd8,_0x1dbfb2,_0xf761f3)['then'](function(_0x74175c){return _0x1a52c9(0x1);});}});});};Dialer['prototype'][_0xe3b6('0xfc')]=function(_0x1a371a,_0x1da5c2,_0x2802cf,_0x4634a4){var _0x219b2d=new Final(_0x1a371a);_0x219b2d['state']=0xf;_0x219b2d[_0xe3b6('0xeb')]=_0xe3b6('0x1cf');this[_0xe3b6('0xff')](_0x219b2d,_0x1da5c2,_0x2802cf,_0x4634a4);};Dialer[_0xe3b6('0x1f')]['createStateFinal']=function(_0x2b9966,_0x20f0ee,_0x4cb223,_0x2ec587){this[_0xe3b6('0xce')](_0x2b9966)[_0xe3b6('0xbd')](function(){return _0x20f0ee(msgResponse(_0xe3b6('0x1b2'),_0xe3b6('0xdd'),_0x2ec587));})[_0xe3b6('0xb8')](function(){return _0x4cb223(msgResponse('[moveContactManagedDialer][0]','Failure',_0xe3b6('0x1d0')));});};Dialer['prototype'][_0xe3b6('0xa')]=function(_0x2cec39){var _0xee7c2a=_0x2cec39['dialPredictiveOptimizationPercentage']/0x64;var _0x41ad10=_0x2cec39['outboundDropCallsDayTimeout']/(_0x2cec39[_0xe3b6('0x66')]+_0x2cec39[_0xe3b6('0x62')]);var _0x37cd41=Math[_0xe3b6('0x1d1')](_0x2cec39['predictiveIntervalAvailable']*(_0x2cec39[_0xe3b6('0x1d2')]/0x64));var _0xa3b6a1=Math[_0xe3b6('0x1d1')](_0x2cec39['predictiveIntervalAvailable']*(_0x2cec39[_0xe3b6('0x1d3')]/0x64));var _0x2b7943=_0x2cec39[_0xe3b6('0x57')]+_0x2cec39[_0xe3b6('0x1d4')];var _0x30f7bf=Math[_0xe3b6('0x1d5')](_0x2cec39['erlangCalls']*_0x2cec39[_0xe3b6('0x7a')]*_0x2cec39['predictiveIntervalHitRate']*_0x2cec39['predictiveIntervalMultiplicativeFactor']);if(_[_0xe3b6('0x46')](_0x2cec39[_0xe3b6('0x2d')])){if(!_[_0xe3b6('0x46')](_0x2cec39[_0xe3b6('0x2c')])){_0x2cec39['startPredictive']=undefined;loggerPredictive[_0xe3b6('0x9e')](_0xe3b6('0x1d6'),_0xe3b6('0x1d7'));}if(!_[_0xe3b6('0x46')](_0x2cec39[_0xe3b6('0x98')])){loggerPredictive[_0xe3b6('0x9e')](_0xe3b6('0x1d6'),_0xe3b6('0x1d8'));clearInterval(_0x2cec39['handlePredictive']);_0x2cec39['handlePredictive']=undefined;}_0x2cec39['startProgressive']=moment()[_0xe3b6('0x7e')](_0xe3b6('0x101'));loggerPredictive[_0xe3b6('0x83')](_0x2cec39[_0xe3b6('0x49')],_0xe3b6('0x1d9'),_0x2cec39[_0xe3b6('0x2d')]);this[_0xe3b6('0x162')](_0x2cec39,0x1);}else if(ifInterval(_0x2cec39[_0xe3b6('0x1da')],_0x2cec39[_0xe3b6('0x2d')])){this['handlePower'](_0x2cec39,0x1);loggerPredictiveCalls[_0xe3b6('0x83')]('[startMethodPredictive][StartProgressive][Loop]',_0x2cec39[_0xe3b6('0x2d')],_0x2cec39[_0xe3b6('0x49')]);_0x2cec39[_0xe3b6('0x79')]=0x0;_0x2cec39['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xee7c2a<_0x41ad10&&_0x2cec39['dialPredictiveOptimization']===_0xe3b6('0x1db')){freeVariablesPredictive(_0x2cec39);loggerPredictive[_0xe3b6('0x83')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xe3b6('0x1dc'),_0x41ad10,_0xe3b6('0x2d'),_0x2cec39['name']);}else if(_0x30f7bf<_0x2cec39['predictiveIntervalErlangCallsDroppedCalls']&&_0x2cec39[_0xe3b6('0x1dd')]===_0xe3b6('0x1db')){freeVariablesPredictive(_0x2cec39);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x1de'),_0xe3b6('0x1df'),_0x30f7bf,_0xe3b6('0x1e0'),_0x2cec39[_0xe3b6('0x72')],'startProgressive',_0x2cec39[_0xe3b6('0x49')]);}else if(!ifInterval(_0x2cec39[_0xe3b6('0x1da')],_0x2cec39['startProgressive'])&&_[_0xe3b6('0x46')](_0x2cec39[_0xe3b6('0x2c')])&&!_['isUndefined'](_0x2cec39[_0xe3b6('0x2d')])){_0x2cec39[_0xe3b6('0x2c')]=moment()[_0xe3b6('0x7e')](_0xe3b6('0x101'));loggerPredictive[_0xe3b6('0x83')](_0x2cec39['name'],_0xe3b6('0x1e1'),_0x2cec39['startPredictive']);this['averageHandleTime'](_0x2cec39['dialPredictiveInterval'])[_0xe3b6('0xbd')](this[_0xe3b6('0x1e2')](_0x2cec39))[_0xe3b6('0xbd')](mergeDataErlangB(_0x2cec39))['then'](this[_0xe3b6('0x1e3')](_0x2cec39))[_0xe3b6('0xb8')](loggerCatchPredictive(_0xe3b6('0x1e4'),_0x2cec39));}else if(!ifInterval(_0x2cec39[_0xe3b6('0x1da')],_0x2cec39[_0xe3b6('0x2c')])){_0x2cec39['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2cec39[_0xe3b6('0x2c')]=moment()[_0xe3b6('0x7e')](_0xe3b6('0x101'));loggerPredictive[_0xe3b6('0x83')](_0x2cec39[_0xe3b6('0x49')],'recalculate\x20predictive\x20at',_0x2cec39[_0xe3b6('0x2c')]);clearInterval(_0x2cec39['handlePredictive']);_0x2cec39[_0xe3b6('0x98')]=undefined;this['averageHandleTime'](_0x2cec39[_0xe3b6('0x1da')])[_0xe3b6('0xbd')](this[_0xe3b6('0x1e2')](_0x2cec39))[_0xe3b6('0xbd')](mergeDataErlangB(_0x2cec39))[_0xe3b6('0xbd')](this['startMethodPredictive'](_0x2cec39))[_0xe3b6('0xb8')](loggerCatchPredictive(_0xe3b6('0x1e5'),_0x2cec39));}else if(_0x2cec39[_0xe3b6('0x76')]&&_0x2b7943<_0x2cec39[_0xe3b6('0x76')]-_0xa3b6a1){freeVariablesPredictive(_0x2cec39);loggerPredictive[_0xe3b6('0x83')](_0x2cec39['name'],_0xe3b6('0x1e6'),_0x2b7943,')\x20are\x20less\x20than\x20threshold\x20(',_0x2cec39[_0xe3b6('0x76')],'-',_0xa3b6a1,'=',_0x2cec39[_0xe3b6('0x76')]-_0xa3b6a1,')');}else if(_0x2cec39[_0xe3b6('0x76')]&&_0x2b7943>_0x2cec39[_0xe3b6('0x76')]+_0x37cd41){freeVariablesPredictive(_0x2cec39);loggerPredictive[_0xe3b6('0x83')](_0x2cec39[_0xe3b6('0x49')],_0xe3b6('0x1e6'),_0x2b7943,')\x20are\x20more\x20than\x20threshold\x20(',_0x2cec39['predictiveIntervalAvailable'],'+',_0x37cd41,'=',_0x2cec39[_0xe3b6('0x76')]+_0x37cd41,')');}};Dialer['prototype'][_0xe3b6('0x1e2')]=function(_0x317ca6){var _0x3af07c=this;return function(_0x31ef3f){return new BPromise(function(_0x26682e,_0x2fb8c4){_[_0xe3b6('0x95')](_0x317ca6,_0x31ef3f[0x0]);if(checkGetDataPredictive(_0x31ef3f[0x0])){var _0x3b4b7d=_0x317ca6[_0xe3b6('0x76')]=_0x317ca6[_0xe3b6('0x1d4')]+_0x317ca6[_0xe3b6('0x57')];var _0x35d4a7=_0x317ca6['dialPredictiveInterval']*0x3c;var _0x3c4013=_0x31ef3f[0x0][_0xe3b6('0x6e')]+_0x31ef3f[0x0][_0xe3b6('0x89')];var _0x13b096=(_0x31ef3f[0x0][_0xe3b6('0x6d')]+_0x31ef3f[0x0][_0xe3b6('0x70')]+_0x31ef3f[0x0][_0xe3b6('0x6f')])/_0x31ef3f[0x0]['predictiveIntervalTotalCalls'];_0x317ca6[_0xe3b6('0x73')]=_0x13b096>0x0?_0x13b096:0x1;switch(_0x317ca6[_0xe3b6('0x1dd')]){case _0xe3b6('0x1db'):var _0xbba2a8=_0x317ca6['dialPredictiveOptimizationPercentage']/0x64;return _0x3af07c[_0xe3b6('0x1e7')](_0x3b4b7d,_0x35d4a7,_0x3c4013,_0x13b096,_0xbba2a8)[_0xe3b6('0xbd')](function(_0x19ce3f){return _0x26682e(_0x19ce3f);});case _0xe3b6('0x1e8'):var _0x15f296=_0x317ca6[_0xe3b6('0x1e9')]/0x64;return _0x3af07c[_0xe3b6('0x1ea')](_0x3b4b7d,_0x35d4a7,_0x3c4013,_0x13b096,_0x15f296)[_0xe3b6('0xbd')](function(_0x2bdaf5){return _0x26682e(_0x2bdaf5);});default:return _0x2fb8c4(msgResponse(_0xe3b6('0x1eb'),_0xe3b6('0x14b'),_0xe3b6('0x1ec')));}}else{return _0x2fb8c4(msgResponse(_0xe3b6('0x1eb'),'Failure',_0xe3b6('0x1ed')));}});};};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x1ee')]=function(_0x5966a9){var _0x12ad24=this;return function(_0x40e41d){return new BPromise(function(_0x26fda6,_0x478a72){_[_0xe3b6('0x95')](_0x5966a9,_0x40e41d[0x0]);if(checkGetDataPredictive(_0x40e41d[0x0])){loggerPredictive[_0xe3b6('0x83')](JSON[_0xe3b6('0x50')](_0x40e41d[0x0]));if(_0x5966a9['dialPredictiveOptimization']===_0xe3b6('0x1db')){return _0x12ad24[_0xe3b6('0xcc')](_0x5966a9['id'])['then'](function(_0x5da53b){var _0x334b92=_0x5966a9[_0xe3b6('0x58')]-_0x5da53b[0x0]['outboundQueuePauses'];var _0x302f27=_0x5966a9[_0xe3b6('0x1da')]*0x3c;var _0xbae7e9=_0x40e41d[0x0][_0xe3b6('0x6e')]+_0x40e41d[0x0]['predictiveIntervalAvgHoldtime'];var _0x27892a=(_0x40e41d[0x0]['predictiveIntervalAnsweredCalls']+_0x40e41d[0x0][_0xe3b6('0x70')]+_0x40e41d[0x0][_0xe3b6('0x6f')])/_0x40e41d[0x0]['predictiveIntervalTotalCalls'];var _0x4baf26=_0x5966a9[_0xe3b6('0x1e9')]/0x64;_0x5966a9[_0xe3b6('0x75')]=_0x5da53b[0x0][_0xe3b6('0x1ef')]||0x0;_0x5966a9[_0xe3b6('0x73')]=_0x27892a>0x0?_0x27892a:0x1;return _0x12ad24['abandonmentRate'](_0x334b92,_0x302f27,_0xbae7e9,_0x27892a,_0x4baf26);})['then'](function(_0xd9d284){return _0x26fda6(_0xd9d284);})[_0xe3b6('0xb8')](function(_0x14c5fc){return _0x478a72(msgResponse(_0xe3b6('0x1f0'),_0xe3b6('0x14b'),JSON['stringify'](_0x14c5fc)));});}if(_0x5966a9['dialPredictiveOptimization']==='agentBusyFactor'){return _0x12ad24[_0xe3b6('0xcc')](_0x5966a9['id'])[_0xe3b6('0xbd')](function(_0x1f9a9c){var _0x374260=_0x5966a9['loggedIn']-_0x1f9a9c[0x0]['outboundQueuePauses'];var _0x446952=_0x5966a9[_0xe3b6('0x1da')]*0x3c;var _0x213590=_0x40e41d[0x0][_0xe3b6('0x6e')]+_0x40e41d[0x0][_0xe3b6('0x89')];var _0xf2824e=(_0x40e41d[0x0]['predictiveIntervalAnsweredCalls']+_0x40e41d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x40e41d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x40e41d[0x0][_0xe3b6('0x77')];var _0x2c444c=_0x5966a9[_0xe3b6('0x1e9')]/0x64;_0x5966a9[_0xe3b6('0x75')]=_0x1f9a9c[0x0][_0xe3b6('0x1ef')]||0x0;_0x5966a9[_0xe3b6('0x73')]=_0xf2824e>0x0?_0xf2824e:0x1;return _0x12ad24[_0xe3b6('0x1ea')](_0x374260,_0x446952,_0x213590,_0xf2824e,_0x2c444c);})[_0xe3b6('0xbd')](function(_0x37464f){return _0x26fda6(_0x37464f);})[_0xe3b6('0xb8')](function(_0x52230d){return _0x478a72(msgResponse('[CatchErlangB]',_0xe3b6('0x14b'),JSON[_0xe3b6('0x50')](_0x52230d)));});}}else{return _0x478a72(msgResponse(_0xe3b6('0x1eb'),'Failure',_0xe3b6('0x1ed')));}});};};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x1e3')]=function(_0x117384){var _0x43567d=this;return function(){var _0x2da3b0=0x0;var _0x6fe43a=Math[_0xe3b6('0x1d5')](_0x117384[_0xe3b6('0x92')]*0x3e8);if(_0x6fe43a>0x0){_0x6fe43a=_0x6fe43a<0x64?0x64:_0x6fe43a;loggerPredictive[_0xe3b6('0x83')](_0x117384[_0xe3b6('0x49')],_0xe3b6('0x1f1'),_0x6fe43a,_0xe3b6('0x51'));_0x117384[_0xe3b6('0x98')]=setInterval(function(){_0x43567d['handlePredictive'](_0x117384);loggerPredictiveCalls[_0xe3b6('0x83')]('[handlePredictive]',_0x2da3b0+=0x1);},_0x6fe43a);}else{loggerPredictive[_0xe3b6('0x83')](_0x117384[_0xe3b6('0x49')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xe3b6('0x1f')]['checkContactBlack']=function(_0x21d0f8,_0x4c6c81){var _0x5a4a0e=this;return function(_0x56461a){if(_[_0xe3b6('0x4f')](_0x56461a)){if(_['isNil'](_0x4c6c81['UserId'])||!_0x4c6c81[_0xe3b6('0x1f2')]){if(_0x21d0f8[_0xe3b6('0x160')]==='booked'){_0x21d0f8[_0xe3b6('0x1f3')]=_[_0xe3b6('0x46')](_0x21d0f8[_0xe3b6('0x1f3')])?!![]:_0x21d0f8['queueStatusComplete'];var _0xacfe48=uuid['v4']();_0x5a4a0e[_0xe3b6('0x12d')][_0xacfe48]=new Action(_0x21d0f8,_0x4c6c81,_0xacfe48);loggerBooked[_0xe3b6('0x83')](_0xe3b6('0x1f4'),_0xacfe48,_0xe3b6('0x1f5'),JSON[_0xe3b6('0x50')](_0x21d0f8[_0xe3b6('0x1f3')]),_0xe3b6('0x1f6'),_0x21d0f8[_0xe3b6('0x49')]);if(_0x21d0f8[_0xe3b6('0x1f3')]){_0x21d0f8[_0xe3b6('0x1f3')]=![];_0x5a4a0e['queueBooked'][_0x5a4a0e[_0xe3b6('0x12d')][_0xacfe48][_0xe3b6('0xb5')]]=[];ami[_0xe3b6('0xb1')]({'actionid':_0xacfe48,'action':_0xe3b6('0x1f7'),'queue':_0x21d0f8['name']})[_0xe3b6('0xb8')](function(){_0x5a4a0e['updateOriginated'](_0x21d0f8);_0x5a4a0e['rescheduleContact']({'active':![],'ContactId':_0x5a4a0e[_0xe3b6('0x12d')][_0xacfe48]['ContactId'],'ListId':_0x5a4a0e[_0xe3b6('0x12d')][_0xacfe48]['ListId'],'VoiceQueueId':_0x5a4a0e[_0xe3b6('0x12d')][_0xacfe48][_0xe3b6('0xda')]||undefined,'CampaignId':_0x5a4a0e[_0xe3b6('0x12d')][_0xacfe48][_0xe3b6('0x102')]||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1f8')));delete _0x5a4a0e[_0xe3b6('0x12d')][_0xacfe48];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON['stringify'](_0x21d0f8[_0xe3b6('0x1f3')]),_0xe3b6('0x1f6'),_0x21d0f8[_0xe3b6('0x49')]);_0x5a4a0e[_0xe3b6('0xb4')](_0x21d0f8);_0x5a4a0e['rescheduleContact']({'active':![],'ContactId':_0x5a4a0e['actions'][_0xacfe48][_0xe3b6('0xd7')],'ListId':_0x5a4a0e['actions'][_0xacfe48][_0xe3b6('0xd8')],'VoiceQueueId':_0x5a4a0e[_0xe3b6('0x12d')][_0xacfe48][_0xe3b6('0xda')]||undefined,'CampaignId':_0x5a4a0e[_0xe3b6('0x12d')][_0xacfe48][_0xe3b6('0x102')]||undefined})['catch'](loggerCatch(_0xe3b6('0x1f8')));delete _0x5a4a0e['actions'][_0xacfe48];}}else{return _0x5a4a0e[_0xe3b6('0x1f9')](_0x21d0f8,_0x4c6c81);}}else{if(getDiff(_0x4c6c81[_0xe3b6('0x1fa')])<_0x21d0f8[_0xe3b6('0x1fb')]*0x3c){if(_0x4c6c81[_0xe3b6('0x167')]&&!_0x4c6c81[_0xe3b6('0x167')][_0xe3b6('0x1fc')]){_0x5a4a0e[_0xe3b6('0x22')]['run'](_0x4c6c81['id'])[_0xe3b6('0x139')](function(){_0x5a4a0e[_0xe3b6('0xb4')](_0x21d0f8);});}else{_0x5a4a0e['unlockContact']({'active':![]},_0x4c6c81['id'],0x1)[_0xe3b6('0x139')](function(){_0x5a4a0e[_0xe3b6('0xb4')](_0x21d0f8);});}}else{_0x21d0f8['outboundReCallsDay']+=0x1;_0x5a4a0e[_0xe3b6('0xb4')](_0x21d0f8);if(_0x21d0f8['dialRecallInQueue']){_0x5a4a0e[_0xe3b6('0xc4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4c6c81[_0xe3b6('0xd7')],'ListId':_0x4c6c81[_0xe3b6('0xd8')],'VoiceQueueId':_0x4c6c81[_0xe3b6('0xda')]||undefined,'CampaignId':_0x4c6c81['CampaignId']||undefined})[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0x1fd')));_0x5a4a0e[_0xe3b6('0xd0')](createObjHistory(_0x21d0f8,_0x4c6c81,_0xe3b6('0x1fe'),0x17,_0xe3b6('0x1ff')))[_0xe3b6('0xb8')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5a4a0e[_0xe3b6('0xe2')](createObjHistory(_0x21d0f8,_0x4c6c81,_0xe3b6('0x200'),0x16,_0xe3b6('0x201')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x21d0f8[_0xe3b6('0x63')]+=0x1;_0x5a4a0e[_0xe3b6('0xe2')](createObjHistory(_0x21d0f8,_0x4c6c81,'BLACKLIST',0xd,'Blacklist'),_0xe3b6('0x202'),_0xe3b6('0x203'));throw'inBlackList';}};};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x204')]=function(_0x4bfb7c){var _0x2f2c9f=this;var _0x17ccc8=_0x4bfb7c[_0xe3b6('0x205')]-_0x4bfb7c[_0xe3b6('0x78')]-_0x4bfb7c['temp'];emitCampaignSummary(_0x4bfb7c);if(_0x17ccc8>0x0){if(_0x17ccc8>this[_0xe3b6('0x27')]){_0x17ccc8=this['maxNumberOriginate'];}_0x4bfb7c[_0xe3b6('0xc9')]+=_0x17ccc8;this[_0xe3b6('0xca')](_0x4bfb7c['id'],_0x17ccc8,_0x4bfb7c['dialOrderByScheduledAt'],_0x4bfb7c)[_0xe3b6('0xbd')](function(_0x16bc5d){_0x4bfb7c[_0xe3b6('0xc9')]-=_0x17ccc8;_0x4bfb7c['temp']=_0x4bfb7c['temp']>0x0?_0x4bfb7c[_0xe3b6('0xc9')]:0x0;if(!checkContactEmpty(_0x16bc5d)){_0x4bfb7c[_0xe3b6('0x47')]=_0xe3b6('0xa3');logger[_0xe3b6('0x83')](_0xe3b6('0x206')+_0x4bfb7c['name']);}else{_0x4bfb7c[_0xe3b6('0x78')]+=_0x16bc5d[_0xe3b6('0x150')];_0x4bfb7c['message']=_0xe3b6('0x207');for(var _0x552c62=0x0;_0x552c62<_0x16bc5d[_0xe3b6('0x150')];_0x552c62+=0x1){_0x4bfb7c[_0xe3b6('0x208')]+=0x1;if(_[_0xe3b6('0xb0')](_0x16bc5d[_0x552c62])||_[_0xe3b6('0xb0')](_0x16bc5d[_0x552c62][_0xe3b6('0x18d')])||_[_0xe3b6('0xb0')](_0x16bc5d[_0x552c62][_0xe3b6('0x176')])){_0x2f2c9f['emptyContact'](_0xe3b6('0x209'),_0x4bfb7c,_0x16bc5d[_0x552c62]);}else{_0x2f2c9f[_0xe3b6('0xc0')](_[_0xe3b6('0xd6')](_0x16bc5d[_0x552c62],['CampaignId',_0xe3b6('0x20a')]))[_0xe3b6('0xbd')](_0x2f2c9f['checkContactBlack'](_0x4bfb7c,_0x16bc5d[_0x552c62]))[_0xe3b6('0xb8')](_0x2f2c9f[_0xe3b6('0xd3')](_0xe3b6('0x20b'),_0x4bfb7c));}}}})[_0xe3b6('0xb8')](loggerGetContactDialer(_0xe3b6('0x20c'),_0x4bfb7c,_0x17ccc8));}};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x162')]=function(_0x4ca254,_0x2599bc){var _0x4adc08=this;var _0x29c8a4=[];var _0x3ef391=_0x2599bc>=0x1?_0x2599bc:0x1;if(_0x4ca254[_0xe3b6('0x160')]==='booked'){_0x3ef391=0x1;}var _0x487e1c=Math[_0xe3b6('0x1d5')](_0x4ca254['available']*_0x3ef391)-_0x4ca254[_0xe3b6('0x78')]-_0x4ca254[_0xe3b6('0xc9')];emitVoiceQueueSummary(_0x4ca254);if(_0x4ca254[_0xe3b6('0x20d')]>0x0){var _0x546ba3=_0x4ca254['dialLimitQueue']-_0x4ca254[_0xe3b6('0x78')]-_0x4ca254[_0xe3b6('0x1d4')]-_0x4ca254[_0xe3b6('0xc9')]-_0x4ca254[_0xe3b6('0x59')];if(_0x487e1c>_0x546ba3){_0x487e1c=_0x546ba3;}}if(_0x487e1c>0x0){if(_0x4ca254['dialMethod']==='booked'){_0x487e1c=0x1;}if(_0x487e1c>this[_0xe3b6('0x27')]){_0x487e1c=this[_0xe3b6('0x27')];}_0x4ca254['temp']+=_0x487e1c;for(var _0x97111e in this[_0xe3b6('0x25')]){if(typeof this[_0xe3b6('0x25')][_0x97111e]!==_0xe3b6('0xaf')){if(this[_0xe3b6('0x25')][_0x97111e][_0xe3b6('0xab')]==='not_inuse'&&this[_0xe3b6('0x25')][_0x97111e][_0xe3b6('0xe0')]===_0xe3b6('0x20e')){_0x29c8a4[_0xe3b6('0x151')](this[_0xe3b6('0x25')][_0x97111e]['id']);}}}this[_0xe3b6('0xc8')](_0x4ca254['id'],_0x29c8a4,_0x487e1c,_0x4ca254[_0xe3b6('0x20f')],_0x4ca254)['then'](function(_0x4c2da6){_0x4ca254[_0xe3b6('0xc9')]-=_0x487e1c;_0x4ca254['temp']=_0x4ca254[_0xe3b6('0xc9')]>0x0?_0x4ca254['temp']:0x0;if(!checkContactEmpty(_0x4c2da6)){_0x4adc08[_0xe3b6('0x210')](_0x4ca254)[_0xe3b6('0xbd')](sendMessageReschedule(_0x4ca254))[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xb9')));}else{_0x4ca254[_0xe3b6('0x78')]+=_0x4c2da6['length'];_0x4ca254[_0xe3b6('0x47')]=_0x4ca254[_0xe3b6('0x160')]===_0xe3b6('0x9')?_0xe3b6('0x211'):_0xe3b6('0x207');for(var _0x4b417e=0x0;_0x4b417e<_0x4c2da6['length'];_0x4b417e+=0x1){if(_[_0xe3b6('0xb0')](_0x4c2da6[_0x4b417e])||_[_0xe3b6('0xb0')](_0x4c2da6[_0x4b417e]['Contact'])||_[_0xe3b6('0xb0')](_0x4c2da6[_0x4b417e][_0xe3b6('0x176')])){_0x4adc08['emptyContact']('[actionOriginate]\x20',_0x4ca254,_0x4c2da6[_0x4b417e]);}else{_0x4adc08['checkIsBlackList'](_['pick'](_0x4c2da6[_0x4b417e],[_0xe3b6('0xda'),_0xe3b6('0x20a')]))['then'](_0x4adc08['checkContactBlack'](_0x4ca254,_0x4c2da6[_0x4b417e]))[_0xe3b6('0xb8')](_0x4adc08['loggerHandler'](_0xe3b6('0x209'),_0x4ca254));}}}})[_0xe3b6('0xb8')](loggerGetContactDialer(_0xe3b6('0x212'),_0x4ca254,_0x487e1c));}};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x98')]=function(_0x435f88){if(_0x435f88[_0xe3b6('0x20d')]>0x0){var _0x2d24a4=_0x435f88[_0xe3b6('0x20d')]-_0x435f88[_0xe3b6('0x78')]-_0x435f88[_0xe3b6('0x1d4')];if(_0x2d24a4>0x0){this[_0xe3b6('0x213')](_0x435f88);}else{loggerPredictiveCalls['info'](_0xe3b6('0x214'));}}else{this[_0xe3b6('0x213')](_0x435f88);}};Dialer['prototype'][_0xe3b6('0x213')]=function(_0x2f3045){var _0x1587d8=this;var _0x4ca501=[];_0x2f3045[_0xe3b6('0x78')]+=0x1;for(var _0x422f05 in this['agents']){if(typeof this[_0xe3b6('0x25')][_0x422f05]!==_0xe3b6('0xaf')){if(this[_0xe3b6('0x25')][_0x422f05][_0xe3b6('0xab')]===_0xe3b6('0x215')&&this[_0xe3b6('0x25')][_0x422f05][_0xe3b6('0xe0')]==='reachable'){_0x4ca501['push'](this[_0xe3b6('0x25')][_0x422f05]['id']);}}}this[_0xe3b6('0xc8')](_0x2f3045['id'],_0x4ca501,0x1,_0x2f3045[_0xe3b6('0x20f')],_0x2f3045)[_0xe3b6('0xbd')](function(_0x4eaf3a){if(!checkContactEmpty(_0x4eaf3a)){checkContactLowerLimitOriginate(_0x2f3045,0x1,0x0);_0x1587d8[_0xe3b6('0x210')](_0x2f3045)[_0xe3b6('0xbd')](sendMessageReschedule(_0x2f3045))[_0xe3b6('0xb8')](loggerCatch(_0xe3b6('0xb9')));}else{_0x2f3045[_0xe3b6('0x47')]=_0xe3b6('0x207');if(_[_0xe3b6('0xb0')](_0x4eaf3a[0x0])||_[_0xe3b6('0xb0')](_0x4eaf3a[0x0][_0xe3b6('0x18d')])||_['isNil'](_0x4eaf3a[0x0][_0xe3b6('0x176')])){_0x1587d8[_0xe3b6('0xd4')](_0xe3b6('0x209'),_0x2f3045,_0x4eaf3a[0x0]);}else{_0x1587d8[_0xe3b6('0xba')](_[_0xe3b6('0xd6')](_0x4eaf3a[0x0],['VoiceQueueId','Contact.phone']))[_0xe3b6('0xbd')](_0x1587d8['checkContactBlack'](_0x2f3045,_0x4eaf3a[0x0]))[_0xe3b6('0xb8')](_0x1587d8[_0xe3b6('0xd3')](_0xe3b6('0x216'),_0x2f3045));}}})[_0xe3b6('0xb8')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2f3045,0x1));emitVoiceQueueSummary(_0x2f3045);};Dialer[_0xe3b6('0x1f')][_0xe3b6('0x1e7')]=function(_0x19639a,_0x4c8aa3,_0x5f2c29,_0x2457f9,_0x4ef6da,_0xd2f7f3){loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x217'));loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x218'),_0x19639a);loggerPredictive[_0xe3b6('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c8aa3);loggerPredictive['info']('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',_0x5f2c29);loggerPredictive[_0xe3b6('0x83')]('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',_0x2457f9);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x219'),_0x4ef6da);loggerPredictive['info'](_0xe3b6('0x8b'));return new BPromise(function(_0x36115b,_0x2218b0){if(_0x19639a<=0x0||isNaN(_0x19639a)){return _0x2218b0(msgResponse(_0xe3b6('0x21a'),_0xe3b6('0x19f'),'m\x20=\x20'+_0x19639a));}if(_0x5f2c29<=0x0||isNaN(_0x5f2c29)){return _0x2218b0(msgResponse(_0xe3b6('0x21a'),_0xe3b6('0x19f'),_0xe3b6('0x21b')+_0x5f2c29));}if(_0x2457f9<=0x0||isNaN(_0x2457f9)){return _0x2218b0(msgResponse('[abandonmentRate]',_0xe3b6('0x19f'),'p\x20=\x20'+_0x2457f9));}if(_0x4c8aa3<=0x0||isNaN(_0x4c8aa3)){return _0x2218b0(msgResponse('[abandonmentRate]','Error',_0xe3b6('0x21c')+_0x4c8aa3));}if(_0x4ef6da<=0x0||isNaN(_0x4ef6da)){return _0x2218b0(msgResponse(_0xe3b6('0x21a'),_0xe3b6('0x19f'),_0xe3b6('0x21d')+_0x4ef6da));}_0xd2f7f3=_0xd2f7f3||0x0;var _0x1cf6bb=0x1/_0x5f2c29;var _0x3f3b0c=0x0;var _0x3706aa=0x0;var _0x5c6543=0x0;var _0x45f70a=0x0;for(var _0x2e261c=0x0;_0x5c6543<_0x4ef6da;_0x2e261c+=0x1){_0x3706aa=_0x2e261c/_0x4c8aa3;_0x3f3b0c=(_0x2457f9*_0x3706aa+_0xd2f7f3)/_0x1cf6bb;_0x5c6543=erlangb(_0x3f3b0c,_0x19639a);_0x45f70a=_0x3f3b0c/_0x19639a*(0x1-erlangb(_0x3f3b0c,_0x19639a));}return _0x36115b({'erlangCalls':_0x2e261c,'erlangCallToSecond':_0x4c8aa3/_0x2e261c,'erlangAbandonmentRate':_0x5c6543,'erlangBusyFactor':_0x45f70a});});};Dialer[_0xe3b6('0x1f')]['busyFactor']=function(_0x378e37,_0x29c37e,_0x462339,_0x57d02a,_0x2d907e,_0x3dd85e){loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x21e'));loggerPredictive[_0xe3b6('0x83')]('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',_0x378e37);loggerPredictive['info'](_0xe3b6('0x21f'),_0x29c37e);loggerPredictive['info']('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',_0x462339);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x220'),_0x57d02a);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x221'),_0x2d907e);loggerPredictive[_0xe3b6('0x83')](_0xe3b6('0x8b'));return new BPromise(function(_0xa5e640,_0x3db2b4){if(_0x378e37<=0x0||isNaN(_0x378e37)){return _0x3db2b4(msgResponse('[busyFactor]',_0xe3b6('0x19f'),_0xe3b6('0x222')+_0x378e37));}if(_0x462339<=0x0||isNaN(_0x462339)){return _0x3db2b4(msgResponse(_0xe3b6('0x223'),'Error',_0xe3b6('0x21b')+_0x462339));}if(_0x57d02a<=0x0||isNaN(_0x57d02a)){return _0x3db2b4(msgResponse(_0xe3b6('0x223'),_0xe3b6('0x19f'),'p\x20=\x20'+_0x57d02a));}if(_0x29c37e<=0x0||isNaN(_0x29c37e)){return _0x3db2b4(msgResponse(_0xe3b6('0x223'),_0xe3b6('0x19f'),'interval\x20=\x20'+_0x29c37e));}if(_0x2d907e<=0x0||isNaN(_0x2d907e)){return _0x3db2b4(msgResponse(_0xe3b6('0x223'),_0xe3b6('0x19f'),_0xe3b6('0x224')+_0x2d907e));}_0x3dd85e=_0x3dd85e||0x0;var _0x199d7f=0x1/_0x462339;var _0x26a395=0x0;var _0x392578=0x0;var _0x3352e7=0x0;var _0x2763be=0x0;for(var _0x2f8fd8=0x0;_0x2763be<_0x2d907e;_0x2f8fd8+=0x1){_0x392578=_0x2f8fd8/_0x29c37e;_0x26a395=(_0x57d02a*_0x392578+_0x3dd85e)/_0x199d7f;_0x3352e7=erlangb(_0x26a395,_0x378e37);_0x2763be=_0x26a395/_0x378e37*(0x1-erlangb(_0x26a395,_0x378e37));}return _0xa5e640({'erlangCalls':_0x2f8fd8,'erlangCallToSecond':_0x29c37e/_0x2f8fd8,'erlangAbandonmentRate':_0x3352e7,'erlangBusyFactor':_0x2763be});});};module[_0xe3b6('0x225')]=Dialer; \ No newline at end of file +var _0x2876=['originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialCutDigit','substring','phone','SIP/%s/%s%s','trim','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','averageHandleTime',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','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','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','bind','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','Interval','Intervals','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','prototype','clearZombieChannels','uniqueId','[actions]','undefined','sequence','enqueue','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','catch','checkIsBlackList','[checkIsBlackList]\x20','resolve','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','pick','ContactId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isTrunkReachable','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HangupInAMD','membername','custom:amd','[syncHangupInAMD]','Machine','AMD','countmachineretry','amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countglobal','dialMachineRetryFrequency','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','outboundDropCallsDayTimeout','Drop','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','add','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','locked','paused','stateinterface','actionid','queueBooked','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','indexOf','true','command','some','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','handleIvr','syncQueueSummary','checkIfTime','dialTimezone','dialPreviewRecallmeReminder','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','Contact','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME'];(function(_0x119806,_0x4981f8){var _0x1d40b9=function(_0x12a845){while(--_0x12a845){_0x119806['push'](_0x119806['shift']());}};_0x1d40b9(++_0x4981f8);}(_0x2876,0x91));var _0x6287=function(_0x4222e4,_0x25096f){_0x4222e4=_0x4222e4-0x0;var _0x4bfa29=_0x2876[_0x4222e4];return _0x4bfa29;};'use strict';var util=require(_0x6287('0x0'));var _=require(_0x6287('0x1'));var BPromise=require(_0x6287('0x2'));var uuid=require(_0x6287('0x3'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x6287('0x4'));var config=require(_0x6287('0x5'));var logger=require(_0x6287('0x6'))(_0x6287('0x7'));var loggerBooked=require('../../../config/logger')(_0x6287('0x8'));var loggerPredictive=require('../../../config/logger')(_0x6287('0x9'));var loggerPredictiveCalls=require(_0x6287('0x6'))(_0x6287('0xa'));var loggerSyncQueueSummary=require(_0x6287('0x6'))('syncQueueSummary');var ami=require(_0x6287('0xb'));config[_0x6287('0xc')]=_[_0x6287('0xd')](config['redis'],{'host':_0x6287('0xe'),'port':0x18eb});var io=require(_0x6287('0xf'))(new Redis(config[_0x6287('0xc')]));var cmHopper=require(_0x6287('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperFinal=require(_0x6287('0x11'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x6287('0x12'));var RpcSetting=require('../rpc/setting');var Action=require(_0x6287('0x13'));var History=require('./history');var Final=require(_0x6287('0x14'));var AgentComplete=require(_0x6287('0x15'));var QueueCallerAbandon=require(_0x6287('0x16'));var Hangup=require(_0x6287('0x17'));var ipAgi=process[_0x6287('0x18')][_0x6287('0x19')]||_0x6287('0x1a');var strategy={'rrmemory':_0x6287('0x1b'),'roundrobin':_0x6287('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x5a8b13){this[_0x6287('0x1d')]=this['tail']?this[_0x6287('0x1d')][_0x6287('0x1e')](_0x5a8b13):_0x5a8b13();};function Dialer(_0x492c16,_0x26ff47){this['sequence']=new Sequence();this[_0x6287('0x1f')]=_0x26ff47;this[_0x6287('0x20')]=_0x492c16[_0x6287('0x20')];this[_0x6287('0x21')]=_0x492c16[_0x6287('0x21')];this[_0x6287('0x22')]=_0x492c16[_0x6287('0x22')];this[_0x6287('0x23')]=_0x492c16[_0x6287('0x23')];this[_0x6287('0x24')]=config[_0x6287('0x24')]||0x2;this[_0x6287('0x25')]={};this[_0x6287('0x26')]={};this[_0x6287('0x27')]={};this['uniqueId']={};this[_0x6287('0x28')]={};this[_0x6287('0x29')]={};this['startProgressive']={};this[_0x6287('0x2a')]={};this['queueBooked']={};this[_0x6287('0x2b')]={};ami['on']('agentconnect',this[_0x6287('0x2c')]['bind'](this));ami['on'](_0x6287('0x2d'),this[_0x6287('0x2e')]['bind'](this));ami['on'](_0x6287('0x2f'),this[_0x6287('0x30')][_0x6287('0x31')](this));ami['on']('agentcomplete',this[_0x6287('0x32')][_0x6287('0x31')](this));ami['on'](_0x6287('0x33'),this['syncQueueSummary']['bind'](this));ami['on'](_0x6287('0x34'),this[_0x6287('0x35')][_0x6287('0x31')](this));ami['on'](_0x6287('0x36'),this[_0x6287('0x37')]['bind'](this));ami['on'](_0x6287('0x38'),this['syncVarSet'][_0x6287('0x31')](this));ami['on'](_0x6287('0x39'),this[_0x6287('0x3a')]['bind'](this));ami['on'](_0x6287('0x3b'),this[_0x6287('0x3c')]['bind'](this));this[_0x6287('0x3d')]();this[_0x6287('0x3e')]();RpcSetting['getSettings']()[_0x6287('0x3f')](function(_0x1a5c3c){previewRecallmeReminderInterval=_0x1a5c3c[_0x6287('0x40')];});}function isNotNull(_0x1b1f90){return _0x1b1f90!==null&&!_[_0x6287('0x41')](_0x1b1f90);}function checkIsLoggedIn(_0x33955b,_0x476f13){return function(){if(_0x476f13<=0x0){_0x33955b['message']='AGENTS_NOT_LOGGED';throw _0x33955b[_0x6287('0x42')]+_0x6287('0x43');}};}function isActive(_0x312be1){return _0x312be1;}function checkIsActive(_0x5f1eb7,_0x1809a2){return function(){if(!isActive(_0x1809a2)){_0x5f1eb7[_0x6287('0x44')]=_0x6287('0x45');throw _0x5f1eb7[_0x6287('0x42')]+'\x20NOT\x20Active';}};}function checkInterval(_0x389adf){return function(){if(!isNotNull(_0x389adf[_0x6287('0x46')])){_0x389adf[_0x6287('0x44')]='INTERVAL_IS_NULL';throw _0x389adf[_0x6287('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x389adf[_0x6287('0x46')][_0x6287('0x47')])){_0x389adf['message']='INTERVAL_IS_NULL';throw _0x389adf['name']+_0x6287('0x48');}if(!isNotNull(_['isEmpty'](_0x389adf[_0x6287('0x46')][_0x6287('0x47')]))){_0x389adf[_0x6287('0x44')]=_0x6287('0x49');throw _0x389adf['name']+_0x6287('0x48');}};}function msgResponse(_0x4a80b3,_0x4455f2,_0x1fa124){return{'action':_0x4a80b3,'response':_0x4455f2,'message':_0x1fa124,'stack':_0x1fa124};}function myreject(_0xc1e64d){return function(_0x2825aa){return _0xc1e64d(msgResponse(_0x6287('0x4a'),_0x6287('0x4b'),JSON[_0x6287('0x4c')](_0x2825aa)));};}function getSeconds(_0x5beddb,_0x261450){var _0x4c1089=moment(_0x5beddb)[_0x6287('0x4d')](0x0);var _0x50a735=moment(_0x261450)[_0x6287('0x4d')](0x0);return _0x4c1089[_0x6287('0x4e')](_0x50a735,_0x6287('0x4f'));}function emit(_0x4f3799,_0x1c6bb5,_0x5700df){io['to'](_0x4f3799)[_0x6287('0x50')](_0x1c6bb5,_0x5700df);}function emitVoiceQueueSummary(_0x189d32){if(_0x189d32[_0x6287('0x51')]===_0x6287('0x52')){var _0x12aef8={'id':_0x189d32['id'],'name':_0x189d32[_0x6287('0x42')],'strategy':_0x189d32[_0x6287('0x53')],'answered':_0x189d32[_0x6287('0x54')],'available':_0x189d32[_0x6287('0x55')],'loggedIn':_0x189d32['loggedIn'],'pTalking':_0x189d32[_0x6287('0x56')],'sumBillable':_0x189d32[_0x6287('0x57')],'sumDuration':_0x189d32[_0x6287('0x58')],'sumHoldTime':_0x189d32[_0x6287('0x59')]||0x0,'talking':_0x189d32[_0x6287('0x5a')],'total':_0x189d32['total'],'type':_0x189d32[_0x6287('0x51')],'unmanaged':_0x189d32[_0x6287('0x5b')],'abandoned':_0x189d32[_0x6287('0x5c')],'waiting':_0x189d32[_0x6287('0x5d')],'loggedInDb':_0x189d32['loggedInDb'],'dialActive':_0x189d32[_0x6287('0x5e')],'dialMethod':_0x189d32[_0x6287('0x5f')],'dialOriginateCallerIdName':_0x189d32['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x189d32[_0x6287('0x60')],'dialOriginateTimeout':_0x189d32[_0x6287('0x61')],'dialPrefix':_0x189d32[_0x6287('0x62')],'outboundAnswerAgiCallsDay':_0x189d32[_0x6287('0x63')],'outboundAnswerCallsDay':_0x189d32[_0x6287('0x64')],'outboundBlacklistCallsDay':_0x189d32[_0x6287('0x65')],'outboundBusyCallsDay':_0x189d32['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x189d32[_0x6287('0x66')],'outboundDropCallsDayACS':_0x189d32[_0x6287('0x67')],'outboundDropCallsDayCallersExit':_0x189d32[_0x6287('0x68')],'outboundDropCallsDayTimeout':_0x189d32['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x189d32[_0x6287('0x69')],'outboundNoSuchCallsDay':_0x189d32[_0x6287('0x6a')],'outboundOriginateFailureCallsDay':_0x189d32[_0x6287('0x6b')],'outboundReCallsDay':_0x189d32[_0x6287('0x6c')],'outboundRejectCallsDay':_0x189d32[_0x6287('0x6d')],'outboundUnknownCallsDay':_0x189d32[_0x6287('0x6e')],'predictiveIntervalAnsweredCalls':_0x189d32[_0x6287('0x6f')],'predictiveIntervalAvgHoldtime':_0x189d32[_0x6287('0x70')],'predictiveIntervalAvgTalktime':_0x189d32['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x189d32[_0x6287('0x71')],'predictiveIntervalDroppedCallsTimeout':_0x189d32[_0x6287('0x72')],'predictiveIntervalErlangCalls':_0x189d32['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x189d32['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x189d32[_0x6287('0x73')],'predictiveIntervalMultiplicativeFactor':_0x189d32[_0x6287('0x74')],'predictiveIntervalPauses':_0x189d32[_0x6287('0x75')],'predictiveIntervalAvailable':_0x189d32[_0x6287('0x76')],'predictiveIntervalTotalCalls':_0x189d32[_0x6287('0x77')],'message':_0x189d32[_0x6287('0x44')],'originated':_0x189d32[_0x6287('0x78')],'erlangCalls':_0x189d32[_0x6287('0x79')],'erlangCallToSecond':_0x189d32[_0x6287('0x7a')],'erlangAbandonmentRate':_0x189d32[_0x6287('0x7b')],'erlangBusyFactor':_0x189d32[_0x6287('0x7c')],'startPredictive':_0x189d32[_0x6287('0x29')],'startProgressive':_0x189d32[_0x6287('0x7d')]};if(_0x189d32[_0x6287('0x7e')]){_0x12aef8[_0x6287('0x7e')]={'id':_0x189d32['Trunk']['id'],'name':_0x189d32[_0x6287('0x7e')][_0x6287('0x42')],'active':_0x189d32[_0x6287('0x7e')][_0x6287('0x7f')],'callerid':_0x189d32[_0x6287('0x7e')][_0x6287('0x80')]};}if(_0x189d32[_0x6287('0x46')]){_0x12aef8['Interval']={'id':_0x189d32[_0x6287('0x46')]['id'],'name':_0x189d32[_0x6287('0x46')][_0x6287('0x42')]};}var _0x1bbeb7=md5(JSON[_0x6287('0x4c')](_0x12aef8));if(_0x189d32['md5']!==_0x1bbeb7){_0x189d32['md5']=_0x1bbeb7;emit(util['format'](_0x6287('0x81'),_0x12aef8['name']),_0x6287('0x82'),_0x12aef8);}}}function emitCampaignSummary(_0x4ee3fa){if(_0x4ee3fa[_0x6287('0x51')]===_0x6287('0x83')){emit(util[_0x6287('0x84')](_0x6287('0x85'),_0x4ee3fa[_0x6287('0x42')]),_0x6287('0x86'),_0x4ee3fa);}}function checkGetDataPredictive(_0x576b52){if(isNotNull(_0x576b52)&&!_[_0x6287('0x87')](_0x576b52)){loggerPredictive[_0x6287('0x88')](_0x6287('0x89'));loggerPredictive[_0x6287('0x88')](_0x6287('0x8a'),_0x576b52['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x6287('0x8b'),_0x576b52[_0x6287('0x6f')]);loggerPredictive[_0x6287('0x88')](_0x6287('0x8c'),_0x576b52['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x6287('0x88')](_0x6287('0x8d'),_0x576b52[_0x6287('0x71')]);loggerPredictive[_0x6287('0x88')](_0x6287('0x8e'),_0x576b52[_0x6287('0x70')]);loggerPredictive[_0x6287('0x88')](_0x6287('0x8f'),_0x576b52[_0x6287('0x90')]);loggerPredictive[_0x6287('0x88')](_0x6287('0x91'));if(_0x576b52['predictiveIntervalTotalCalls']>0x0){if(!_[_0x6287('0x41')](_0x576b52['predictiveIntervalAvgTalktime'])&&_0x576b52[_0x6287('0x90')]>0x0){return!![];}loggerPredictive[_0x6287('0x88')](_0x6287('0x92'));if(!_[_0x6287('0x41')](_0x576b52[_0x6287('0x70')])&&_0x576b52['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x6287('0x88')](_0x6287('0x93'));}else{loggerPredictive[_0x6287('0x88')](_0x6287('0x94'));}}else{loggerPredictive[_0x6287('0x88')](_0x6287('0x95'));}return![];}function mergeDataErlangB(_0x13ec01){return function(_0x4a7b64){loggerPredictive[_0x6287('0x88')](_0x6287('0x96'));loggerPredictive[_0x6287('0x88')](_0x6287('0x97'),_0x4a7b64[_0x6287('0x79')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4a7b64[_0x6287('0x7a')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4a7b64[_0x6287('0x7b')]);loggerPredictive['info'](_0x6287('0x98'),_0x4a7b64[_0x6287('0x7c')]);loggerPredictive[_0x6287('0x88')](_0x6287('0x99'),_0x4a7b64[_0x6287('0x7b')]);loggerPredictive['info'](_0x6287('0x91'));_[_0x6287('0x9a')](_0x13ec01,_0x4a7b64);};}function getDiff(_0x3bb3e2){var _0x166cc4=moment()['milliseconds'](0x0);var _0x1b137f=moment(_0x3bb3e2)[_0x6287('0x4d')](0x0);return _0x166cc4[_0x6287('0x4e')](_0x1b137f,_0x6287('0x4f'));}function ifInterval(_0x875f01,_0x244ee2){if(_[_0x6287('0x41')](_0x244ee2)){return![];}return getDiff(_0x244ee2)<_0x875f01*0x3c;}function freeVariablesPredictive(_0x594828){if(isNotNull(_0x594828)){if(!_[_0x6287('0x41')](_0x594828[_0x6287('0x7d')])){_0x594828[_0x6287('0x7d')]=undefined;loggerPredictive['info'](_0x594828[_0x6287('0x42')],_0x6287('0x9b'));}if(!_[_0x6287('0x41')](_0x594828['startPredictive'])){_0x594828[_0x6287('0x29')]=undefined;loggerPredictive[_0x6287('0x88')](_0x594828[_0x6287('0x42')],_0x6287('0x9c'));}if(!_[_0x6287('0x41')](_0x594828[_0x6287('0x9d')])){clearInterval(_0x594828[_0x6287('0x9d')]);_0x594828[_0x6287('0x9d')]=undefined;loggerPredictive[_0x6287('0x88')](_0x594828['name'],_0x6287('0x9e'));}}}function erlangb(_0x25bfd2,_0x954b41){if(_0x954b41===0x0){return 0x0;}var _0x1c50e6=0x1;for(var _0xa026ee=0x1;_0xa026ee<=_0x954b41;_0xa026ee+=0x1){_0x1c50e6=0x1+_0x1c50e6*_0xa026ee/_0x25bfd2;}return 0x1/_0x1c50e6;}function isVoiceQueueOutbound(_0x508f3d){return _0x508f3d===_0x6287('0x52');}function isNotPreview(_0x22150e){return _0x22150e!==_0x6287('0x1f');}function isCampaignIvr(_0x1edda7){return _0x1edda7==='ivr';}function getCallerId(_0x5ab09f,_0x351b96,_0x601ac3){if(!_['isUndefined'](_0x601ac3)&&typeof _0x601ac3===_0x6287('0x9f')&&!_[_0x6287('0x87')](_0x601ac3)){if(!_[_0x6287('0x41')](_0x351b96)&&typeof _0x351b96===_0x6287('0x9f')&&!_['isEmpty'](_0x351b96)){return util[_0x6287('0x84')](_0x6287('0xa0'),_0x351b96,_0x601ac3);}return util[_0x6287('0x84')](_0x6287('0xa0'),_0x601ac3,_0x601ac3);}if(!_[_0x6287('0x41')](_0x5ab09f)&&typeof _0x5ab09f===_0x6287('0x9f')&&!_[_0x6287('0x87')](_0x5ab09f)){return _0x5ab09f;}return _0x6287('0xa1');}function loggerCatchQueueSummary(_0x5dd863,_0x58e68a){return function(_0x5b5312){freeVariablesPredictive(_0x58e68a);emitVoiceQueueSummary(_0x58e68a);emitCampaignSummary(_0x58e68a);loggerSyncQueueSummary['error'](_0x5dd863,util[_0x6287('0xa2')](_0x5b5312,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x47d4e7,_0x23b3c7){return function(_0x2fd41b){loggerPredictive['error'](_0x23b3c7[_0x6287('0x42')],_0x47d4e7);loggerPredictive[_0x6287('0xa3')](_0x2fd41b[_0x6287('0xa4')]);freeVariablesPredictive(_0x23b3c7);};}function loggerCatch(_0x36dd59){return function(_0x5bdf3f){logger[_0x6287('0xa3')](_0x36dd59,util[_0x6287('0xa2')](_0x5bdf3f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x52fd14){return _0x52fd14&&!_[_0x6287('0x41')](_0x52fd14)&&_0x52fd14[_0x6287('0xa5')]>0x0;}function decremetOriginate(_0x10947f){if(!_[_0x6287('0x41')](_0x10947f)&&_0x10947f!==null){if(typeof _0x10947f['originated']!=='undefined'){if(_0x10947f['originated']>0x0){_0x10947f[_0x6287('0x78')]-=0x1;}else{logger['error'](_0x6287('0xa6'));}}}else{logger[_0x6287('0xa3')](_0x6287('0xa7'));}}function checkContactLowerLimitOriginate(_0x191a5a,_0x167e81,_0x14ad46){if(_0x167e81>_0x14ad46){for(var _0x13ba22=0x0;_0x13ba22<_0x167e81-_0x14ad46;_0x13ba22+=0x1){decremetOriginate(_0x191a5a);}}}function loggerGetContactDialer(_0x5e11b7,_0x279c83,_0x1811a1){return function(_0x56d51a){checkContactLowerLimitOriginate(_0x279c83,_0x1811a1,0x0);logger['error'](_0x5e11b7,util['inspect'](_0x56d51a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x30d0f5){return function(_0x3c9c08){if(isNotNull(_0x3c9c08)&&isNotNull(_0x3c9c08[0x0])){if(_0x3c9c08[0x0][_0x6287('0xa8')]>0x0){_0x30d0f5[_0x6287('0x44')]=_0x6287('0xa9');logger[_0x6287('0x88')](_0x6287('0xaa')+_0x30d0f5[_0x6287('0x42')],_0x3c9c08[0x0]['contactsRescheduled'],'contacts');}else{_0x30d0f5[_0x6287('0x44')]=_0x6287('0xab');logger['info'](_0x6287('0xac')+_0x30d0f5[_0x6287('0x42')]);}}};}function notSendMessagesQueue(_0x1941df){if(_0x1941df[_0x6287('0xad')]){freeVariablesPredictive(_0x1941df);if(_0x1941df[_0x6287('0x78')]===0x0&&_0x1941df[_0x6287('0x5a')]===0x0&&_0x1941df[_0x6287('0x5d')]===0x0&&(_0x1941df[_0x6287('0x56')]||0x0)===0x0){_0x1941df[_0x6287('0xad')]=![];_0x1941df[_0x6287('0x55')]=0x0;_0x1941df[_0x6287('0x44')]=_0x6287('0x45');loggerSyncQueueSummary['error'](_0x6287('0xae'),_0x1941df[_0x6287('0x42')],_0x6287('0xaf'));}else{_0x1941df['message']=_0x6287('0xb0');loggerSyncQueueSummary['error'](_0x6287('0xae'),_0x1941df['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x1941df);}}function notSendMessagesCampaign(_0x3cfd84){if(_0x3cfd84['sendMessageOneNotActive']){if(_0x3cfd84[_0x6287('0x78')]===0x0){_0x3cfd84[_0x6287('0xad')]=![];_0x3cfd84['message']=_0x6287('0x45');loggerSyncQueueSummary['error'](_0x6287('0xb1'),_0x3cfd84[_0x6287('0x42')],_0x6287('0xaf'));}else{_0x3cfd84[_0x6287('0x44')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x6287('0xb1'),_0x3cfd84[_0x6287('0x42')],_0x6287('0xb2'));}emitCampaignSummary(_0x3cfd84);}}function createObjHistory(_0x53f2e4,_0xd7df4b,_0x25cdf1,_0x4f36b8,_0x15bda1){_0x53f2e4[_0x6287('0x44')]=_0x25cdf1;var _0x40dd85=new Action(_0x53f2e4,_0xd7df4b);var _0x357902=new History(_0x40dd85);_0x357902[_0x6287('0xb3')]=_0x4f36b8;_0x357902[_0x6287('0xb4')]=_0x15bda1;_0x357902[_0x6287('0xb5')]=_0x40dd85[_0x6287('0xb6')];return _0x357902;}Dialer[_0x6287('0xb7')]['loopClearZombieChannels']=function(){var _0x1c9c59=this;setInterval(function(){_0x1c9c59[_0x6287('0xb8')](_0x1c9c59[_0x6287('0xb9')],'[uniqueid]');_0x1c9c59['clearZombieChannels'](_0x1c9c59[_0x6287('0x26')],_0x6287('0xba'));},0x32c8);};Dialer['prototype'][_0x6287('0xb8')]=function(_0x4bc0ae,_0x77b4c5){var _0x200d10=this;for(var _0xeb714f in _0x4bc0ae){if(typeof _0x4bc0ae[_0xeb714f]!==_0x6287('0xbb')){this[_0x6287('0xbc')][_0x6287('0xbd')](function(){if(!_[_0x6287('0xbe')](_0x4bc0ae[_0xeb714f])){return ami[_0x6287('0xbf')]({'action':_0x6287('0xc0'),'channel':_0x4bc0ae[_0xeb714f][_0x6287('0xc1')]})['catch'](function(_0x2d0da4){if(_0x2d0da4['message']===_0x6287('0xc2')){setTimeout(function(){if(_0x4bc0ae[_0xeb714f]&&_0x4bc0ae[_0xeb714f][_0x6287('0x51')]!==_0x6287('0x83')){_0x200d10[_0x6287('0xc3')](_0x200d10[_0x6287('0x20')][_0x4bc0ae[_0xeb714f][_0x6287('0xc4')]]);logger[_0x6287('0xa3')](_0x6287('0xc5'),_0x77b4c5,_0xeb714f,_0x4bc0ae[_0xeb714f][_0x6287('0xc4')]);delete _0x4bc0ae[_0xeb714f];}if(_0x4bc0ae[_0xeb714f]&&_0x4bc0ae[_0xeb714f][_0x6287('0x51')]===_0x6287('0x83')){_0x200d10[_0x6287('0xc3')](_0x200d10[_0x6287('0x21')][_0x4bc0ae[_0xeb714f]['queue']]);logger[_0x6287('0xa3')](_0x6287('0xc6'),_0x77b4c5,_0xeb714f,_0x4bc0ae[_0xeb714f][_0x6287('0xc4')]);delete _0x4bc0ae[_0xeb714f];}},0x2328);}});}});}}};Dialer[_0x6287('0xb7')]['countReScheduled']=function(_0x7c2cce){return BPromise['resolve']()[_0x6287('0x3f')](cmHopper['countReScheduled'](_0x7c2cce))[_0x6287('0xc7')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x6287('0xb7')][_0x6287('0xc8')]=function(_0x4309bb){return BPromise['resolve']()['then'](cmHopperBlack[_0x6287('0xc8')](_0x4309bb))[_0x6287('0xc7')](loggerCatch(_0x6287('0xc9')));};Dialer['prototype']['verifyAdditionalPhones']=function(_0x1e870b,_0x1ecf3a,_0x246e82){return BPromise[_0x6287('0xca')]()[_0x6287('0x3f')](cmHopperAdditionalPhone[_0x6287('0xcb')](_0x1e870b,_0x1ecf3a,_0x246e82))[_0x6287('0xc7')](loggerCatch(_0x6287('0xcc')));};Dialer[_0x6287('0xb7')]['swapAdditionalPhones']=function(_0x5b4e32,_0x2edcda,_0x20c035){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0x6287('0xcd')](_0x5b4e32,_0x2edcda,_0x20c035))[_0x6287('0xc7')](loggerCatch(_0x6287('0xce')));};Dialer['prototype'][_0x6287('0xcf')]=function(_0x49cc3b){return BPromise[_0x6287('0xca')]()[_0x6287('0x3f')](cmHopperBlack['checkIsBlackListIvr'](_0x49cc3b))[_0x6287('0xc7')](loggerCatch(_0x6287('0xd0')));};Dialer['prototype']['averageHandleTime']=function(_0x2fcf43){return BPromise[_0x6287('0xca')]()[_0x6287('0x3f')](cmHopperHistory['avgHandleTime'](_0x2fcf43))[_0x6287('0xc7')](loggerCatch(_0x6287('0xd1')));};Dialer[_0x6287('0xb7')][_0x6287('0xd2')]=function(_0x16134b){return BPromise[_0x6287('0xca')]()[_0x6287('0x3f')](cmHopper[_0x6287('0xd2')](_0x16134b))[_0x6287('0xc7')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype']['unlockContact']=function(_0x138ba3,_0x516848,_0x107578){return BPromise[_0x6287('0xca')]()[_0x6287('0x3f')](cmHopper[_0x6287('0xd3')](_0x138ba3,_0x516848,_0x107578))[_0x6287('0xc7')](loggerCatch(_0x6287('0xd4')));};Dialer[_0x6287('0xb7')][_0x6287('0xd5')]=function(_0x329e13,_0x385036,_0x342ac1,_0x24c624,_0xa7f511){return BPromise['resolve']()[_0x6287('0x3f')](cmHopper[_0x6287('0xd5')](_0x329e13,_0x385036,_0x342ac1,_0x24c624))[_0x6287('0xc7')](function(_0x32591b){_0xa7f511[_0x6287('0xd6')]-=_0x342ac1;_0xa7f511[_0x6287('0xd6')]=_0xa7f511['temp']>0x0?_0xa7f511[_0x6287('0xd6')]:0x0;loggerCatch(_0x6287('0xd7'))(_0x32591b);});};Dialer[_0x6287('0xb7')]['getContactDialerIvr']=function(_0x348591,_0x13ea55,_0x51b805,_0x1c1634){return BPromise[_0x6287('0xca')]()[_0x6287('0x3f')](cmHopper[_0x6287('0xd8')](_0x348591,_0x13ea55,_0x51b805))[_0x6287('0xc7')](function(_0x2bcd30){_0x1c1634['temp']-=_0x13ea55;_0x1c1634[_0x6287('0xd6')]=_0x1c1634['temp']>0x0?_0x1c1634['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x2bcd30);});};Dialer[_0x6287('0xb7')][_0x6287('0xd9')]=function(_0x3b329a){return BPromise['resolve']()[_0x6287('0x3f')](voiceQueueRt[_0x6287('0xd9')](_0x3b329a))[_0x6287('0xc7')](loggerCatch(_0x6287('0xda')));};Dialer[_0x6287('0xb7')][_0x6287('0xdb')]=function(_0x207781){return BPromise[_0x6287('0xca')]()[_0x6287('0x3f')](cmHopper['moveContactManagedDialer'](_0x207781))[_0x6287('0xc7')](loggerCatch(_0x6287('0xdc')));};Dialer[_0x6287('0xb7')][_0x6287('0xdd')]=function(_0x39a7c1){return BPromise[_0x6287('0xca')]()['then'](cmHopperHistory[_0x6287('0xdd')](_0x39a7c1))[_0x6287('0xc7')](loggerCatch('[createHistory]\x20'));};Dialer[_0x6287('0xb7')][_0x6287('0xc3')]=function(_0x2ed3d0){if(!_[_0x6287('0x41')](_0x2ed3d0)&&_0x2ed3d0!==null){if(typeof _0x2ed3d0[_0x6287('0x78')]!==_0x6287('0xbb')){if(_0x2ed3d0[_0x6287('0x78')]>0x0){_0x2ed3d0['originated']-=0x1;}else{logger[_0x6287('0xa3')](_0x6287('0xde'));}}}else{logger[_0x6287('0xa3')](_0x6287('0xdf'));}};Dialer['prototype'][_0x6287('0xe0')]=function(_0x2f5d16,_0x27728c){var _0x3df704=this;return function(_0x75d1cf){_0x3df704[_0x6287('0xc3')](_0x27728c);logger['error'](_0x2f5d16,util[_0x6287('0xa2')](_0x75d1cf,{'showHidden':![],'depth':null}));};};Dialer[_0x6287('0xb7')]['emptyContact']=function(_0x5980a5,_0x2243b3,_0x3122a0){var _0x14f80={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x2243b3);this[_0x6287('0xe1')](_['merge'](_0x14f80,_[_0x6287('0xe2')](_0x3122a0,[_0x6287('0xe3'),'ListId','UserId',_0x6287('0xe4'),_0x6287('0xe5')])),_0x6287('0xe6'),_0x6287('0xe7'));logger['error'](_0x5980a5);};Dialer[_0x6287('0xb7')]['isSuccess']=function(_0x1a1976){return _0x1a1976==='Success';};Dialer[_0x6287('0xb7')][_0x6287('0xe8')]=function(_0x2f6a36){return!_[_0x6287('0x41')](_0x2f6a36)&&_0x2f6a36&&!_['isUndefined'](_0x2f6a36[_0x6287('0x42')])&&!_[_0x6287('0x41')](_0x2f6a36['active'])&&_0x2f6a36[_0x6287('0x7f')]&&(this[_0x6287('0x23')][util[_0x6287('0x84')](_0x6287('0xe9'),_0x2f6a36['name'])]['status']===_0x6287('0xea')||this[_0x6287('0x23')][util[_0x6287('0x84')](_0x6287('0xe9'),_0x2f6a36[_0x6287('0x42')])][_0x6287('0xc0')]===_0x6287('0xeb'));};Dialer[_0x6287('0xb7')]['saveInDb']=function(_0x40d2df,_0x5c0ffc,_0x123318){this[_0x6287('0xdd')](_0x40d2df)['catch'](loggerCatch(_0x5c0ffc));this[_0x6287('0xdb')](_0x40d2df)[_0x6287('0xc7')](loggerCatch(_0x123318));};Dialer[_0x6287('0xb7')][_0x6287('0xec')]=function(_0x37f822){var _0x2e1c36=this[_0x6287('0xb9')][_0x37f822[_0x6287('0xed')]];var _0x4b23d6;if(!_[_0x6287('0xbe')](_0x37f822)&&!_['isNil'](_0x37f822['variable'])&&!_['isNil'](_0x37f822['variable'][_0x6287('0xee')])&&_0x37f822[_0x6287('0xef')]===_0x6287('0xf0')&&_0x2e1c36){if(_0x2e1c36['type']!==_0x6287('0x83')&&this['voiceQueues'][_0x2e1c36[_0x6287('0xc4')]][_0x6287('0xf1')]&&_0x37f822[_0x6287('0xf2')]==='HANGUP'){delete this[_0x6287('0xb9')][_0x37f822['uniqueid']];this[_0x6287('0xc3')](this[_0x6287('0x20')][_0x2e1c36['queue']]);this[_0x6287('0x20')][_0x2e1c36['queue']][_0x6287('0x64')]+=0x1;this['voiceQueues'][_0x2e1c36[_0x6287('0xc4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4b23d6=new Hangup(_0x2e1c36,_0x37f822);_0x4b23d6[_0x6287('0xb3')]=0x12;_0x4b23d6[_0x6287('0xb4')]=_0x6287('0xf3');_0x4b23d6[_0x6287('0xf4')]='AMD';ami[_0x6287('0x50')](_0x6287('0xf5'),ut['buildObj'](_0x4b23d6,'amd'));this['saveInDb'](_0x4b23d6,'[syncHangupInAMD][createHistory]',_0x6287('0xf6'));}if(_0x2e1c36['type']!==_0x6287('0x83')&&this[_0x6287('0x20')][_0x2e1c36[_0x6287('0xc4')]][_0x6287('0xf1')]&&_0x37f822[_0x6287('0xf2')]==='MACHINE'){var _0x18e471=this;return new BPromise(function(_0x8cdf36,_0x56a2e3){delete _0x18e471[_0x6287('0xb9')][_0x37f822[_0x6287('0xed')]];_0x18e471[_0x6287('0xc3')](_0x18e471['voiceQueues'][_0x2e1c36[_0x6287('0xc4')]]);_0x18e471['voiceQueues'][_0x2e1c36[_0x6287('0xc4')]][_0x6287('0x64')]+=0x1;_0x18e471[_0x6287('0x20')][_0x2e1c36[_0x6287('0xc4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4584bc=_0x18e471['voiceQueues'][_0x2e1c36[_0x6287('0xc4')]];var _0x42d135=new Hangup(_0x2e1c36,_0x37f822);_0x42d135[_0x6287('0xb3')]=0x13;_0x42d135[_0x6287('0xb4')]=_0x6287('0xf7');_0x42d135[_0x6287('0xf4')]=_0x6287('0xf8');_0x42d135[_0x6287('0xf9')]+=0x1;_0x42d135['countglobal']+=0x1;_0x42d135[_0x6287('0xfa')]=!![];ami[_0x6287('0x50')](_0x6287('0xf5'),ut[_0x6287('0xfb')](_0x42d135,'amd'));_0x18e471[_0x6287('0xdd')](_0x42d135)[_0x6287('0xc7')](loggerCatch(_0x6287('0xfc')));if(_0x42d135[_0x6287('0xfd')]+_0x42d135[_0x6287('0xfe')]+_0x42d135[_0x6287('0xff')]+_0x42d135[_0x6287('0x100')]+_0x42d135[_0x6287('0x101')]+_0x42d135[_0x6287('0x102')]+_0x42d135[_0x6287('0xf9')]+_0x42d135[_0x6287('0x103')]>=_0x4584bc[_0x6287('0x104')]){_0x18e471[_0x6287('0x105')](_0x42d135,_0x8cdf36,_0x56a2e3,_0x6287('0x106'));}else{if(_0x42d135['countmachineretry']>=_0x4584bc[_0x6287('0x107')]){_0x18e471[_0x6287('0x108')](_0x42d135,_0x8cdf36,_0x56a2e3,_0x6287('0x109'));}else{_0x18e471['rescheduleContact']({'active':![],'countmachineretry':_0x42d135[_0x6287('0xf9')],'scheduledat':moment()['add'](_0x4584bc['dialMachineRetryFrequency'],_0x6287('0x10a'))[_0x6287('0x84')](_0x6287('0x10b')),'ContactId':_0x42d135[_0x6287('0xe3')],'ListId':_0x42d135[_0x6287('0x10c')],'VoiceQueueId':_0x42d135['VoiceQueueId']||undefined,'CampaignId':_0x42d135['CampaignId']||undefined})[_0x6287('0xc7')](loggerCatch('[rescheduleContact][Machine]'));_0x8cdf36({'reschedule':0x1});}}});}if(_0x2e1c36[_0x6287('0x51')]==='ivr'&&this[_0x6287('0x21')][_0x2e1c36['queue']]['dialAMDActive']&&_0x37f822[_0x6287('0xf2')]===_0x6287('0x10d')){delete this[_0x6287('0xb9')][_0x37f822[_0x6287('0xed')]];this['updateOriginated'](this[_0x6287('0x21')][_0x2e1c36['queue']]);_0x4b23d6=new Hangup(_0x2e1c36,_0x37f822);_0x4b23d6[_0x6287('0xb3')]=0x12;_0x4b23d6[_0x6287('0xb4')]='HangupInAMD';_0x4b23d6[_0x6287('0xf4')]=_0x6287('0xf8');ami['emit'](_0x6287('0xf5'),ut['buildObj'](_0x4b23d6,_0x6287('0xfa')));this[_0x6287('0xe1')](_0x4b23d6,_0x6287('0x10e'),_0x6287('0x10f'));}if(_0x2e1c36[_0x6287('0x51')]===_0x6287('0x83')&&this['campaigns'][_0x2e1c36[_0x6287('0xc4')]]['dialAMDActive']&&_0x37f822[_0x6287('0xf2')]===_0x6287('0x110')){var _0x18e471=this;return new BPromise(function(_0x12ef14,_0x21ed5c){delete _0x18e471[_0x6287('0xb9')][_0x37f822['uniqueid']];_0x18e471[_0x6287('0xc3')](_0x18e471[_0x6287('0x21')][_0x2e1c36[_0x6287('0xc4')]]);_0x18e471[_0x6287('0x21')][_0x2e1c36['queue']][_0x6287('0x64')]+=0x1;_0x18e471[_0x6287('0x21')][_0x2e1c36[_0x6287('0xc4')]][_0x6287('0x63')]+=0x1;var _0x21b98f=_0x18e471[_0x6287('0x21')][_0x2e1c36['queue']];var _0x1a97c0=new Hangup(_0x2e1c36,_0x37f822);_0x1a97c0['state']=0x13;_0x1a97c0[_0x6287('0xb4')]=_0x6287('0xf7');_0x1a97c0[_0x6287('0xf4')]='AMD';_0x1a97c0[_0x6287('0xf9')]+=0x1;_0x1a97c0[_0x6287('0x111')]+=0x1;_0x1a97c0[_0x6287('0xfa')]=!![];ami[_0x6287('0x50')]('custom:amd',ut[_0x6287('0xfb')](_0x1a97c0,_0x6287('0xfa')));_0x18e471[_0x6287('0xdd')](_0x1a97c0)[_0x6287('0xc7')](loggerCatch(_0x6287('0xfc')));if(_0x1a97c0['countbusyretry']+_0x1a97c0[_0x6287('0xfe')]+_0x1a97c0['countnoanswerretry']+_0x1a97c0['countnosuchnumberretry']+_0x1a97c0[_0x6287('0x101')]+_0x1a97c0['countabandonedretry']+_0x1a97c0[_0x6287('0xf9')]+_0x1a97c0[_0x6287('0x103')]>=_0x21b98f[_0x6287('0x104')]){_0x18e471[_0x6287('0x105')](_0x1a97c0,_0x12ef14,_0x21ed5c,_0x6287('0x106'));}else{if(_0x1a97c0[_0x6287('0xf9')]>=_0x21b98f['dialMachineMaxRetry']){_0x18e471['createStateFinal'](_0x1a97c0,_0x12ef14,_0x21ed5c,'reason\x2019\x20machine....');}else{_0x18e471[_0x6287('0xd2')]({'active':![],'countmachineretry':_0x1a97c0[_0x6287('0xf9')],'scheduledat':moment()['add'](_0x21b98f[_0x6287('0x112')],_0x6287('0x10a'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1a97c0[_0x6287('0xe3')],'ListId':_0x1a97c0[_0x6287('0x10c')],'VoiceQueueId':_0x1a97c0[_0x6287('0xe4')]||undefined,'CampaignId':_0x1a97c0[_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch('[rescheduleContact][Machine]'));_0x12ef14({'reschedule':0x1});}}});}}};Dialer[_0x6287('0xb7')][_0x6287('0x35')]=function(_0x3998bf){var _0x3019e9=this['uniqueId'][_0x3998bf['uniqueid']];var _0x4f4ea0=this;var _0x500155;if(_0x3019e9&&_0x3019e9[_0x6287('0x51')]===_0x6287('0x83')){delete this[_0x6287('0xb9')][_0x3998bf[_0x6287('0xed')]];this['updateOriginated'](this['campaigns'][_0x3019e9[_0x6287('0xc4')]]);this[_0x6287('0x21')][_0x3019e9[_0x6287('0xc4')]]['ivrAnswerCallsDay']+=0x1;_0x500155=new Hangup(_0x3019e9,_0x3998bf);this['createHistory'](_0x500155)[_0x6287('0xc7')](loggerCatch(_0x6287('0x113')));this['moveContactManagedDialer'](_0x500155)[_0x6287('0xc7')](loggerCatch(_0x6287('0x114')));}if(_0x3019e9&&_0x3019e9['type']!==_0x6287('0x83')&&isNotNull(this[_0x6287('0x20')][_0x3019e9[_0x6287('0xc4')]]['dialQueueProject'])){delete this[_0x6287('0xb9')][_0x3998bf[_0x6287('0xed')]];this['updateOriginated'](this[_0x6287('0x20')][_0x3019e9[_0x6287('0xc4')]]);this[_0x6287('0x20')][_0x3019e9['queue']][_0x6287('0x64')]+=0x1;this[_0x6287('0x20')][_0x3019e9[_0x6287('0xc4')]][_0x6287('0x63')]+=0x1;_0x500155=new Hangup(_0x3019e9,_0x3998bf);_0x500155[_0x6287('0xb3')]=0x10;_0x500155[_0x6287('0xb4')]=_0x6287('0x115');_0x500155['membername']=_0x6287('0x116');this[_0x6287('0xdd')](_0x500155)['catch'](loggerCatch(_0x6287('0x113')));this[_0x6287('0xdb')](_0x500155)[_0x6287('0xc7')](loggerCatch(_0x6287('0x114')));}if(_0x3019e9&&_0x3019e9[_0x6287('0x51')]!==_0x6287('0x83')&&!isNotNull(this['voiceQueues'][_0x3019e9[_0x6287('0xc4')]][_0x6287('0x117')])){delete this[_0x6287('0xb9')][_0x3998bf[_0x6287('0xed')]];this['updateOriginated'](this['voiceQueues'][_0x3019e9[_0x6287('0xc4')]]);this[_0x6287('0x20')][_0x3019e9[_0x6287('0xc4')]][_0x6287('0x6e')]+=0x1;_0x500155=new Hangup(_0x3019e9,_0x3998bf);_0x500155[_0x6287('0xb3')]=0xc;_0x500155[_0x6287('0xb4')]=_0x3998bf[_0x6287('0x118')];_0x500155['membername']='Unknow';this['createHistory'](_0x500155)[_0x6287('0xc7')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6287('0xdb')](_0x500155)[_0x6287('0xc7')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0x6287('0x32')]=function(_0x5b5040){var _0x2bf771=this[_0x6287('0xb9')][_0x5b5040['uniqueid']];var _0xc8cffd=this;if(this[_0x6287('0x20')][_0x5b5040[_0x6287('0xc4')]]){if(_0x2bf771&&_0x2bf771['type']!==_0x6287('0x83')){delete this[_0x6287('0xb9')][_0x5b5040[_0x6287('0xed')]];this[_0x6287('0x20')][_0x5b5040['queue']][_0x6287('0x64')]+=0x1;var _0x5e6281=new AgentComplete(_0x2bf771,_0x5b5040);if(_0x5b5040['reason']===_0x6287('0x119')){_0x5e6281[_0x6287('0x11a')]=this[_0x6287('0x20')][_0x5b5040[_0x6287('0xc4')]][_0x6287('0x11b')]&&this[_0x6287('0x20')][_0x5b5040[_0x6287('0xc4')]]['dialAgiAfterHangupAgent']?moment()['format'](_0x6287('0x10b')):undefined;}this[_0x6287('0xdd')](_0x5e6281)[_0x6287('0xc7')](loggerCatch(_0x6287('0x11c')));this[_0x6287('0xdb')](_0x5e6281)[_0x6287('0xc7')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype']['syncAgentConnect']=function(_0x4aab9c){if(this[_0x6287('0x20')][_0x4aab9c['queue']]){if(this[_0x6287('0xb9')][_0x4aab9c[_0x6287('0xed')]]&&this[_0x6287('0xb9')][_0x4aab9c['uniqueid']]['type']!==_0x6287('0x83')){this['updateOriginated'](this['voiceQueues'][_0x4aab9c[_0x6287('0xc4')]]);this[_0x6287('0xb9')][_0x4aab9c[_0x6287('0xed')]][_0x6287('0x11d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x6287('0x11e')]=function(_0x42b581,_0x269223){this['createHistory'](_0x42b581)[_0x6287('0xc7')](loggerCatch(_0x6287('0x11c')));if(_0x269223==0x0){this[_0x6287('0xdb')](_0x42b581)[_0x6287('0xc7')](loggerCatch(_0x6287('0x11f')));}};Dialer[_0x6287('0xb7')][_0x6287('0x2e')]=function(_0x419e72){var _0xad995a=this[_0x6287('0xb9')][_0x419e72[_0x6287('0xed')]];var _0x16c0d3=this;var _0x520809=![];var _0x1bc2b8;var _0x4a4863;if(this[_0x6287('0x20')][_0x419e72[_0x6287('0xc4')]]){if(_0xad995a&&_0xad995a[_0x6287('0x51')]!==_0x6287('0x83')){delete this[_0x6287('0xb9')][_0x419e72[_0x6287('0xed')]];this['updateOriginated'](this[_0x6287('0x20')][_0x419e72['queue']]);_0xad995a[_0x6287('0x120')]=moment()[_0x6287('0x84')](_0x6287('0x10b'));var _0x3c2e47=new QueueCallerAbandon(_0xad995a,_0x419e72);if(getSeconds(_0xad995a['droptime'],_0xad995a[_0x6287('0x121')])>=_0xad995a['dialQueueTimeout']){this[_0x6287('0x20')][_0x419e72[_0x6287('0xc4')]][_0x6287('0x72')]+=0x1;this[_0x6287('0x20')][_0x419e72[_0x6287('0xc4')]][_0x6287('0x122')]+=0x1;this[_0x6287('0x20')][_0x419e72[_0x6287('0xc4')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3c2e47[_0x6287('0xb3')]=0xa;_0x3c2e47[_0x6287('0xb4')]=_0x6287('0x123');_0x3c2e47['dropreason']=_0x6287('0x124');_0x3c2e47[_0x6287('0x11a')]=this['voiceQueues'][_0x419e72['queue']][_0x6287('0x11b')]?moment()[_0x6287('0x84')](_0x6287('0x10b')):undefined;_0x3c2e47[_0x6287('0x101')]+=0x1;_0x3c2e47[_0x6287('0x111')]+=0x1;_0x1bc2b8=this['voiceQueues'][_0x419e72[_0x6287('0xc4')]][_0x6287('0x125')];_0x4a4863=this[_0x6287('0x20')][_0x419e72[_0x6287('0xc4')]][_0x6287('0x126')];_0x16c0d3[_0x6287('0xcb')](_0x3c2e47,_0x3c2e47[_0x6287('0xb3')],_0xad995a[_0x6287('0x127')])[_0x6287('0x3f')](function(_0x1e5326){_0x520809=_0x1e5326['additional']==0x1;if(_0x3c2e47['countdropretry']>=_0x16c0d3[_0x6287('0x20')][_0x419e72[_0x6287('0xc4')]]['dialDropMaxRetry']){_0x16c0d3[_0x6287('0x11e')](_0x3c2e47,_0x1e5326[_0x6287('0x128')]);}else{_0x16c0d3[_0x6287('0xd2')]({'active':![],'countdropretry':_0x3c2e47['countdropretry'],'scheduledat':moment()[_0x6287('0x129')](_0x16c0d3[_0x6287('0x20')][_0x419e72[_0x6287('0xc4')]][_0x6287('0x125')],_0x6287('0x10a'))[_0x6287('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xad995a[_0x6287('0xe3')],'ListId':_0xad995a[_0x6287('0x10c')],'VoiceQueueId':_0xad995a[_0x6287('0xe4')]||undefined,'CampaignId':_0xad995a[_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x12a')));var _0x1703e7=new History(_0x3c2e47);_0x1703e7[_0x6287('0xb3')]=0xa;_0x1703e7[_0x6287('0xb4')]='Drop';_0x1703e7['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1703e7[_0x6287('0xb5')]=_0x1703e7[_0x6287('0xb6')];_0x1703e7[_0x6287('0x12b')]=_0x3c2e47[_0x6287('0x12b')];_0x1703e7[_0x6287('0x12c')]=_0x3c2e47['calleridnum'];_0x16c0d3[_0x6287('0xdd')](_0x1703e7)[_0x6287('0xc7')](loggerCatch(_0x6287('0x12d')));}})[_0x6287('0x3f')](function(_0x55f218){if(_0x520809)_0x16c0d3[_0x6287('0xcd')](_0x3c2e47,_0x1bc2b8,_0x4a4863)[_0x6287('0x3f')](function(_0x3e6326){return 0x1;});});}else{this['voiceQueues'][_0x419e72[_0x6287('0xc4')]][_0x6287('0x71')]+=0x1;this[_0x6287('0x20')][_0x419e72[_0x6287('0xc4')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3c2e47[_0x6287('0xb3')]=0xb;_0x3c2e47[_0x6287('0xb4')]='Abandoned';_0x3c2e47[_0x6287('0x12e')]=_0x6287('0x12f');_0x3c2e47[_0x6287('0x102')]+=0x1;_0x3c2e47[_0x6287('0x111')]+=0x1;_0x1bc2b8=this['voiceQueues'][_0x419e72[_0x6287('0xc4')]][_0x6287('0x130')];_0x4a4863=this['voiceQueues'][_0x419e72['queue']][_0x6287('0x126')];_0x16c0d3[_0x6287('0xcb')](_0x3c2e47,_0x3c2e47[_0x6287('0xb3')],_0xad995a[_0x6287('0x127')])['then'](function(_0x5e43b8){if(_0x3c2e47['countabandonedretry']>=_0x16c0d3[_0x6287('0x20')][_0x419e72['queue']]['dialAbandonedMaxRetry']){_0x16c0d3[_0x6287('0x11e')](_0x3c2e47,_0x5e43b8['additional']);}else{_0x16c0d3['rescheduleContact']({'active':![],'countabandonedretry':_0x3c2e47[_0x6287('0x102')],'scheduledat':moment()[_0x6287('0x129')](_0x16c0d3[_0x6287('0x20')][_0x419e72[_0x6287('0xc4')]][_0x6287('0x130')],_0x6287('0x10a'))[_0x6287('0x84')](_0x6287('0x10b')),'ContactId':_0xad995a[_0x6287('0xe3')],'ListId':_0xad995a[_0x6287('0x10c')],'VoiceQueueId':_0xad995a[_0x6287('0xe4')]||undefined,'CampaignId':_0xad995a['CampaignId']||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x131')));var _0x57cb43=new History(_0x3c2e47);_0x57cb43[_0x6287('0xb3')]=0xb;_0x57cb43[_0x6287('0xb4')]='Abandoned';_0x57cb43[_0x6287('0xb6')]=moment()[_0x6287('0x84')](_0x6287('0x10b'));_0x57cb43['endtime']=_0x57cb43['starttime'];_0x57cb43[_0x6287('0x12b')]=_0x3c2e47[_0x6287('0x12b')];_0x57cb43[_0x6287('0x12c')]=_0x3c2e47['calleridnum'];_0x16c0d3[_0x6287('0xdd')](_0x57cb43)[_0x6287('0xc7')](loggerCatch(_0x6287('0x132')));}})[_0x6287('0x3f')](function(_0x11e747){if(_0x520809)_0x16c0d3[_0x6287('0xcd')](_0x3c2e47,_0x1bc2b8,_0x4a4863)[_0x6287('0x3f')](function(_0xbd59c6){return 0x1;});});}}}};Dialer[_0x6287('0xb7')][_0x6287('0x37')]=function(_0x50e4af){if(this['actions'][_0x50e4af['uniqueid']]){this[_0x6287('0x26')][_0x50e4af[_0x6287('0xed')]][_0x6287('0xc1')]=_0x50e4af[_0x6287('0xc1')];}if(this[_0x6287('0xb9')][_0x50e4af['uniqueid']]){this[_0x6287('0xb9')][_0x50e4af['uniqueid']][_0x6287('0xc1')]=_0x50e4af[_0x6287('0xc1')];}};Dialer[_0x6287('0xb7')]['syncQueueMember']=function(_0x58babe){if(strategy[this['voiceQueues'][this[_0x6287('0x26')][_0x58babe['actionid']][_0x6287('0xc4')]]['strategy']]===_0x6287('0x1c')){if(this[_0x6287('0x26')][_0x58babe['actionid']]&&_['isNil'](this[_0x6287('0x26')][_0x58babe['actionid']][_0x6287('0x133')])&&_0x58babe[_0x6287('0xc0')]==='1'&&_0x58babe[_0x6287('0x134')]==='0'){if(this[_0x6287('0x22')][_0x58babe[_0x6287('0x135')]]){if(!this[_0x6287('0x22')][_0x58babe[_0x6287('0x135')]][_0x6287('0x133')]){this[_0x6287('0x22')][_0x58babe[_0x6287('0x135')]][_0x6287('0x133')]=!![];this[_0x6287('0x26')][_0x58babe[_0x6287('0x136')]][_0x6287('0x133')]=!![];this[_0x6287('0x26')][_0x58babe[_0x6287('0x136')]][_0x6287('0x135')]=_0x58babe[_0x6287('0x135')];}}}}else if((strategy[this['voiceQueues'][this[_0x6287('0x26')][_0x58babe[_0x6287('0x136')]]['queue']][_0x6287('0x53')]]||_0x6287('0x1b'))==='rrmemory'){if(this[_0x6287('0x26')][_0x58babe[_0x6287('0x136')]]){if(this[_0x6287('0x22')][_0x58babe[_0x6287('0x135')]]){this['actions'][_0x58babe[_0x6287('0x136')]][_0x6287('0x135')]=_0x58babe[_0x6287('0x135')];if(_[_0x6287('0xbe')](this[_0x6287('0x137')][this['actions'][_0x58babe[_0x6287('0x136')]][_0x6287('0xc4')]])){this['queueBooked'][this[_0x6287('0x26')][_0x58babe[_0x6287('0x136')]][_0x6287('0xc4')]]=[];}this[_0x6287('0x137')][this[_0x6287('0x26')][_0x58babe[_0x6287('0x136')]]['queue']][_0x6287('0x138')](_[_0x6287('0x9a')](_[_0x6287('0xe2')](this[_0x6287('0x26')][_0x58babe[_0x6287('0x136')]],[_0x6287('0x139'),_0x6287('0x135')]),{'status':_0x58babe[_0x6287('0xc0')],'paused':_0x58babe[_0x6287('0x134')]}));}}}};function unlockQueueStatus(_0x2f3b98,_0x4438e1){setTimeout(function(){if(_[_0x6287('0x41')](_0x2f3b98[_0x6287('0x13a')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x4438e1);}_0x2f3b98[_0x6287('0x13a')]=!![];loggerBooked['info'](_0x6287('0x13b'),_0x4438e1,JSON['stringify'](_['pick'](_0x2f3b98,[_0x6287('0x42'),_0x6287('0x13a')])));},0x1f3);}Dialer[_0x6287('0xb7')][_0x6287('0x3c')]=function(_0x204eaa){var _0x5415d8=this;var _0x8da585=_0x5415d8[_0x6287('0x20')][_0x5415d8[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]][_0x6287('0xc4')]];if(strategy[this[_0x6287('0x20')][this['actions'][_0x204eaa[_0x6287('0x136')]][_0x6287('0xc4')]]['strategy']]===_0x6287('0x1c')){if(this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]]&&this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]]['stateinterface']){this[_0x6287('0x1f')][_0x6287('0x13c')](this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]]['idHopper'],this['actions'][_0x204eaa['actionid']][_0x6287('0x135')])[_0x6287('0xc7')](function(_0x1e3c34){logger[_0x6287('0xa3')](_0x6287('0x13d'),util['inspect'](_0x1e3c34,{'showHidden':![],'depth':null}));})[_0x6287('0x1e')](function(){_0x5415d8[_0x6287('0xc3')](_0x5415d8[_0x6287('0x20')][_0x5415d8[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]][_0x6287('0xc4')]]);_0x5415d8[_0x6287('0x22')][_0x5415d8[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]]['stateinterface']]['locked']=![];delete _0x5415d8[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]];unlockQueueStatus(_0x8da585);});}else{this[_0x6287('0xc3')](this[_0x6287('0x20')][this['actions'][_0x204eaa[_0x6287('0x136')]][_0x6287('0xc4')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]][_0x6287('0xe3')],'ListId':this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]][_0x6287('0x10c')],'VoiceQueueId':this['actions'][_0x204eaa[_0x6287('0x136')]][_0x6287('0xe4')]||undefined,'CampaignId':this['actions'][_0x204eaa[_0x6287('0x136')]][_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x13e')));delete this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]];unlockQueueStatus(_0x8da585);}}else if((strategy[this[_0x6287('0x20')][this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]]['queue']][_0x6287('0x53')]]||_0x6287('0x1b'))===_0x6287('0x1b')){var _0x9c9817;if(this['actions'][_0x204eaa['actionid']]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0x204eaa[_0x6287('0x136')]][_0x6287('0xc4')]])){if(this[_0x6287('0x2b')][_0x5415d8['actions'][_0x204eaa[_0x6287('0x136')]]['queue']]){this[_0x6287('0x2b')][_0x5415d8[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]]['queue']]=this['queueBookedRR'][this['actions'][_0x204eaa[_0x6287('0x136')]][_0x6287('0xc4')]]?this[_0x6287('0x2b')][this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]][_0x6287('0xc4')]]:this['queueBooked'][this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]][_0x6287('0xc4')]]?this['queueBooked'][this['actions'][_0x204eaa['actionid']][_0x6287('0xc4')]][_0x6287('0x13f')]||0x0:0x0;}this[_0x6287('0x137')][this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]][_0x6287('0xc4')]][_0x6287('0x13f')]=this[_0x6287('0x2b')][this[_0x6287('0x26')][_0x204eaa[_0x6287('0x136')]][_0x6287('0xc4')]];for(var _0x390458=0x0;_0x390458=0x0;})[_0x6287('0xc7')](myreject(_0x36b12d)));}}else{_0x320ceb[_0x6287('0x138')](ami['Action']({'action':_0x6287('0x15c'),'command':util['format']('iftime\x20%s,%s',_0x10a6e5,!_[_0x6287('0x41')](config[_0x6287('0x153')][_0x45d13c])?_0x45d13c:'')})['then'](function(_0x5cf75f){return _0x5cf75f[_0x6287('0x159')][_0x6287('0x15a')]('true')>=0x0;})[_0x6287('0xc7')](myreject(_0x36b12d)));}BPromise['all'](_0x320ceb)[_0x6287('0x3f')](function(_0x2be519){var _0x4a742c=_[_0x6287('0x15d')](_0x2be519);if(_0x4a742c){return _0x1c7c47(_0x4a742c);}else{_0x40ff70[_0x6287('0x44')]=_0x18949c?'GLOBAL_INTERVAL_IS_OVERTIME':_0x6287('0x15e');return _0x36b12d(msgResponse('[ifTime][promiseAll]','Failure',_0x6287('0x15f')+_0x18949c+'\x20'+_0x1e5780+_0x6287('0x160')+util['inspect'](_0x10a6e5,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x45d13c));}})[_0x6287('0xc7')](function(_0x14d3f5){return _0x36b12d(msgResponse(_0x6287('0x14e'),_0x6287('0x14f'),JSON[_0x6287('0x4c')](_0x14d3f5)));});});};Dialer[_0x6287('0xb7')][_0x6287('0x161')]=function(_0x2f9b70){var _0xd73941=this;return function(){switch(_0x2f9b70[_0x6287('0x5f')]){case _0x6287('0x162'):freeVariablesPredictive(_0x2f9b70);_0xd73941[_0x6287('0x163')](_0x2f9b70,0x1);break;case _0x6287('0x164'):freeVariablesPredictive(_0x2f9b70);_0xd73941[_0x6287('0x163')](_0x2f9b70,_0x2f9b70[_0x6287('0x165')]);break;case _0x6287('0x9'):_0xd73941['predictive'](_0x2f9b70);break;case'booked':freeVariablesPredictive(_0x2f9b70);_0xd73941[_0x6287('0x163')](_0x2f9b70,0x1);break;default:freeVariablesPredictive(_0x2f9b70);logger[_0x6287('0xa3')]('Queue',_0x2f9b70['name'],_0x6287('0x166'));}};};Dialer[_0x6287('0xb7')][_0x6287('0x167')]=function(_0x1f0505){return BPromise[_0x6287('0xca')]()[_0x6287('0x3f')](cmHopper[_0x6287('0x168')](_0x1f0505['id'],previewRecallmeReminderInterval))[_0x6287('0x3f')](function(_0x103663){for(var _0x18ecb5=0x0;_0x18ecb5<_0x103663[_0x6287('0xa5')];_0x18ecb5++){var _0x288c20=_0x103663[_0x18ecb5][_0x6287('0x169')][_0x6287('0x42')];if(_0x288c20)io['to'](util[_0x6287('0x84')](_0x6287('0x16a'),_0x288c20))[_0x6287('0x50')](_0x6287('0x16b'),{'hopper':_0x103663[_0x18ecb5]});}})['catch'](function(_0x1ae293){});};Dialer['prototype']['launchHandleIvr']=function(_0x1757fb){var _0x49b6d8=this;return function(){_0x49b6d8[_0x6287('0x16c')](_0x1757fb);};};Dialer['prototype'][_0x6287('0x16d')]=function(_0x4272c8){var _0x376968=this;if(isNotPreview(_0x4272c8[_0x6287('0x5f')])){if(isVoiceQueueOutbound(_0x4272c8[_0x6287('0x51')])&&isActive(_0x4272c8[_0x6287('0x5e')])){_0x4272c8[_0x6287('0xad')]=!![];BPromise[_0x6287('0xca')]()[_0x6287('0x3f')](checkIsLoggedIn(_0x4272c8,_0x4272c8['loggedIn']))['then'](checkIsActive(_0x4272c8,_0x4272c8[_0x6287('0x5e')]))[_0x6287('0x3f')](checkInterval(_0x4272c8))[_0x6287('0x3f')](_0x376968[_0x6287('0x14b')](_0x4272c8))['then'](_0x376968[_0x6287('0x16e')](_0x4272c8['dialGlobalInterval'],_0x4272c8[_0x6287('0x16f')],_0x4272c8['name'],_0x4272c8))['then'](_0x376968[_0x6287('0x14d')](_0x4272c8['Interval'],_0x4272c8['dialTimezone'],_0x4272c8[_0x6287('0x42')],_0x4272c8))['then'](_0x376968[_0x6287('0x161')](_0x4272c8))[_0x6287('0xc7')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4272c8));}else{notSendMessagesQueue(_0x4272c8);}}else{freeVariablesPredictive(_0x4272c8);if(_0x4272c8[_0x6287('0x170')]){_0x376968[_0x6287('0x167')](_0x4272c8);}}};Dialer[_0x6287('0xb7')]['syncCampaigns']=function(){var _0xe98887=this;var _0x3fcfbf;for(var _0x396476 in this[_0x6287('0x21')]){if(typeof this['campaigns'][_0x396476]!==_0x6287('0xbb')){_0x3fcfbf=this['campaigns'][_0x396476];if(isCampaignIvr(_0x3fcfbf[_0x6287('0x51')])&&isActive(_0x3fcfbf[_0x6287('0x7f')])){_0x3fcfbf['sendMessageOneNotActive']=!![];BPromise[_0x6287('0xca')]()['then'](checkIsActive(_0x3fcfbf,_0x3fcfbf['active']))['then'](checkInterval(_0x3fcfbf))[_0x6287('0x3f')](_0xe98887[_0x6287('0x14b')](_0x3fcfbf))[_0x6287('0x3f')](_0xe98887[_0x6287('0x16e')](_0x3fcfbf[_0x6287('0x171')],_0x3fcfbf[_0x6287('0x16f')],_0x3fcfbf[_0x6287('0x42')],_0x3fcfbf))['then'](_0xe98887[_0x6287('0x14d')](_0x3fcfbf[_0x6287('0x46')],_0x3fcfbf[_0x6287('0x16f')],_0x3fcfbf[_0x6287('0x42')],_0x3fcfbf))['then'](_0xe98887[_0x6287('0x172')](_0x3fcfbf))['catch'](loggerCatchQueueSummary(_0x6287('0x173'),_0x3fcfbf));}else{notSendMessagesCampaign(_0x3fcfbf);}}}};function getCallerIdRandom(_0x79122,_0x4d0d13){var _0x105fac;var _0x1eb798;var _0x33ab87;if(_0x4d0d13<=0x0){_0x4d0d13=0x1;}_0x105fac=new RegExp(_0x6287('0x174')+_0x4d0d13+'}$');_0x1eb798=Math['pow'](0xa,_0x4d0d13-0x1);_0x33ab87=Math[_0x6287('0x175')](0xa,_0x4d0d13)-0x1;return util[_0x6287('0x84')]('%s',_[_0x6287('0x176')](_0x79122,_0x105fac,_[_0x6287('0x177')](_0x1eb798,_0x33ab87)));}function extractCalleridName(_0x2f0423){var _0x58ac34=_0x2f0423[_0x6287('0x178')](/"(.*?)"/);return _0x58ac34?_0x58ac34[0x1]:_0x2f0423;}function extractCalleridNumber(_0x55705b){var _0x3dd958=_0x55705b[_0x6287('0x178')](/<(.*?)>/);return _0x3dd958?_0x3dd958[0x1]:_0x55705b;}Dialer[_0x6287('0xb7')][_0x6287('0x179')]=function(_0x2ad92f,_0x32393b){var _0x480cec=this;var _0x8575f2=uuid['v4']();this[_0x6287('0x26')][_0x8575f2]=new Action(_0x2ad92f,_0x32393b,_0x8575f2);return new BPromise(function(_0x11a174,_0x46e5e0){if(_[_0x6287('0x41')](_0x2ad92f)&&typeof _0x2ad92f!==_0x6287('0x17a')){return _0x46e5e0(msgResponse(_0x6287('0x17b'),_0x6287('0x14f'),_0x6287('0x17c')));}if(_[_0x6287('0x41')](_0x32393b['phone'])||_0x32393b['phone']===null){return _0x46e5e0(msgResponse('originate','Failure',_0x6287('0x17d')));}var _0x5090b5={'XMD-CALLERID':_0x480cec[_0x6287('0x26')][_0x8575f2][_0x6287('0x17e')](),'XMD-AGI':_0x2ad92f['dialQueueProject']?util[_0x6287('0x84')](_0x6287('0x17f'),ipAgi,_0x2ad92f[_0x6287('0x117')]):_0x6287('0x180'),'XMD-AGIAFTER':_0x2ad92f[_0x6287('0x11b')]?util[_0x6287('0x84')](_0x6287('0x17f'),ipAgi,_0x2ad92f[_0x6287('0x11b')]):_0x6287('0x180'),'XMD-QUEUE':_0x2ad92f[_0x6287('0x51')]===_0x6287('0x52')?util[_0x6287('0x84')](_0x6287('0x181'),_0x2ad92f['name'],_0x2ad92f['dialQueueOptions']||'',_0x2ad92f[_0x6287('0x182')]?'c':'',_0x2ad92f[_0x6287('0x183')]||0x3):'NONE','XMD-CONTACTID':_0x32393b[_0x6287('0xe3')],'XMD-CDRTYPE':_0x6287('0x7'),'CALLERID(all)':_0x480cec[_0x6287('0x26')][_0x8575f2][_0x6287('0x17e')](),'XMD-AMD':_0x2ad92f['dialAMDActive']?_0x6287('0x184'):'NONE','XMD-DESTINATION':_0x6287('0xf0')};if(_0x2ad92f[_0x6287('0xf1')]){_0x5090b5[_0x6287('0x185')]=_0x2ad92f[_0x6287('0x186')]||0x9c4;_0x5090b5[_0x6287('0x187')]=_0x2ad92f['dialAMDGreeting']||0x5dc;_0x5090b5[_0x6287('0x188')]=_0x2ad92f[_0x6287('0x189')]||0x320;_0x5090b5['XMD-AMDTOTALANALYSISTIME']=_0x2ad92f[_0x6287('0x18a')]||0x1388;_0x5090b5[_0x6287('0x18b')]=_0x2ad92f[_0x6287('0x18c')]||0x64;_0x5090b5['XMD-AMDBETWEENWORDSSILENCE']=_0x2ad92f[_0x6287('0x18d')]||0x32;_0x5090b5['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2ad92f[_0x6287('0x18e')]||0x3;_0x5090b5[_0x6287('0x18f')]=_0x2ad92f[_0x6287('0x190')]||0x100;_0x5090b5[_0x6287('0x191')]=_0x2ad92f[_0x6287('0x192')]||0x1388;}if(_0x2ad92f['type']===_0x6287('0x52')){_0x5090b5[_0x6287('0x193')]=_0x32393b[_0x6287('0xe4')];}else{_0x5090b5[_0x6287('0x194')]=_0x32393b[_0x6287('0xe5')];}for(var _0x5b7837 in _0x32393b['Contact']){if(typeof _0x32393b['Contact'][_0x5b7837]!==_0x6287('0xbb')){if(isNotNull(_0x32393b['Contact'][_0x5b7837])&&_0x5b7837!=='id'&&_0x5b7837!==_0x6287('0x195')&&_0x5b7837!==_0x6287('0x196')&&_0x5b7837!==_0x6287('0x197')){_0x5090b5[util[_0x6287('0x84')](_0x6287('0x198'),_0x6287('0x199'),_[_0x6287('0x19a')](_0x5b7837))]=_0x32393b[_0x6287('0x19b')][_0x5b7837];}}}var _0x3848d3=_0x480cec[_0x6287('0xe8')](_0x2ad92f[_0x6287('0x7e')])?getCallerId(_0x2ad92f['Trunk'][_0x6287('0x80')],_0x2ad92f[_0x6287('0x19c')],_0x2ad92f[_0x6287('0x19d')]>0x0?getCallerIdRandom(_0x2ad92f[_0x6287('0x60')],_0x2ad92f[_0x6287('0x19d')]):_0x2ad92f[_0x6287('0x60')]):getCallerId(_[_0x6287('0xbe')](_0x2ad92f[_0x6287('0x19e')])?_0x2ad92f['Trunk'][_0x6287('0x80')]:_0x2ad92f[_0x6287('0x19e')][_0x6287('0x80')],_0x2ad92f[_0x6287('0x19c')],_0x2ad92f[_0x6287('0x19d')]>0x0?getCallerIdRandom(_0x2ad92f[_0x6287('0x60')],_0x2ad92f[_0x6287('0x19d')]):_0x2ad92f[_0x6287('0x60')]);if(_0x3848d3){_0x5090b5[_0x6287('0x19f')]=_0x480cec['actions'][_0x8575f2][_0x6287('0x1a0')]=extractCalleridName(_0x3848d3);_0x5090b5[_0x6287('0x1a1')]=_0x32393b['phone'];}return ami['Action']({'actionid':_0x8575f2,'action':_0x6287('0x17b'),'channel':_0x480cec[_0x6287('0xe8')](_0x2ad92f[_0x6287('0x7e')])?util[_0x6287('0x84')]('SIP/%s/%s%s',_0x2ad92f['Trunk'][_0x6287('0x42')],isNotNull(_0x2ad92f[_0x6287('0x62')])?_0x2ad92f['dialPrefix']['trim']()||'':'',_0x2ad92f[_0x6287('0x1a2')]>0x0?_0x32393b['phone'][_0x6287('0x1a3')](_0x2ad92f[_0x6287('0x1a2')]):_0x32393b[_0x6287('0x1a4')]):util['format'](_0x6287('0x1a5'),_[_0x6287('0xbe')](_0x2ad92f[_0x6287('0x19e')])?_0x2ad92f[_0x6287('0x7e')][_0x6287('0x42')]:_0x2ad92f['TrunkBackup'][_0x6287('0x42')],isNotNull(_0x2ad92f['dialPrefix'])?_0x2ad92f[_0x6287('0x62')][_0x6287('0x1a6')]()||'':'',_0x2ad92f[_0x6287('0x1a2')]>0x0?_0x32393b[_0x6287('0x1a4')][_0x6287('0x1a3')](_0x2ad92f[_0x6287('0x1a2')]):_0x32393b[_0x6287('0x1a4')]),'callerid':_0x3848d3,'Exten':_0x6287('0xf0'),'Context':_0x6287('0x1a7'),'Priority':'1','variable':_0x5090b5,'timeout':(_0x2ad92f[_0x6287('0x61')]||0x1e)*0x3e8,'async':!![],'channelid':_0x8575f2})[_0x6287('0x3f')](function(_0x34cfc2){return _0x11a174(_0x34cfc2);})['catch'](function(_0x2ba83a){_0x2ad92f[_0x6287('0x6b')]+=0x1;var _0x5b61b8=new History(_0x480cec['actions'][_0x8575f2]);logger[_0x6287('0xa3')](util[_0x6287('0x84')](_0x6287('0x1a8'),JSON['stringify'](_0x2ba83a)));_0x5b61b8[_0x6287('0xb3')]=0xe;_0x5b61b8['statedesc']=_0x6287('0x1a9');_0x5b61b8['starttime']=moment()[_0x6287('0x84')](_0x6287('0x10b'));_0x5b61b8[_0x6287('0xb5')]=_0x5b61b8[_0x6287('0xb6')];_0x480cec[_0x6287('0xdd')](_0x5b61b8)[_0x6287('0xc7')](loggerCatch(_0x6287('0x1aa')));_0x480cec[_0x6287('0xdb')](_0x5b61b8)['catch'](loggerCatch(_0x6287('0x1aa')))['finally'](function(){delete _0x480cec[_0x6287('0x26')][_0x8575f2];return _0x46e5e0(msgResponse(_0x6287('0x17b'),_0x6287('0x4b'),_0x6287('0x1ab')));});});});};Dialer[_0x6287('0xb7')][_0x6287('0x30')]=function(_0x4d5603){var _0x43079a=this[_0x6287('0x26')][_0x4d5603[_0x6287('0x136')]];if(_0x43079a){delete this[_0x6287('0x26')][_0x4d5603['actionid']];_0x43079a['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xa46fc=_0x43079a[_0x6287('0x51')]===_0x6287('0x83')?this[_0x6287('0x21')][_0x43079a[_0x6287('0xc4')]]:this['voiceQueues'][_0x43079a[_0x6287('0x1ac')]()];if(!this[_0x6287('0x1ad')](_0x4d5603[_0x6287('0x1ae')])){this[_0x6287('0xc3')](_0xa46fc);return this[_0x6287('0x1af')](_0x43079a,_0xa46fc,_0x4d5603)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x4d5603[_0x6287('0xed')]]=_0x43079a;}};Dialer[_0x6287('0xb7')][_0x6287('0x1b0')]=function(_0xd8a113,_0x3afa1f,_0x10c0c4){var _0x5d31ac=new History(_0x3afa1f);if(_0x5d31ac[_0x6287('0xfd')]+_0x5d31ac[_0x6287('0xfe')]+_0x5d31ac[_0x6287('0xff')]+_0x5d31ac[_0x6287('0x100')]+_0x5d31ac[_0x6287('0x101')]+_0x5d31ac['countabandonedretry']+_0x5d31ac[_0x6287('0xf9')]+_0x5d31ac['countagentrejectretry']>=_0x10c0c4[_0x6287('0x104')]-0x1){return!![];}switch(_0xd8a113){case 0x3:if(_0x5d31ac[_0x6287('0xff')]>=_0x10c0c4['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x6287('0xd2')]({'active':![],'countnoanswerretry':_0x5d31ac[_0x6287('0xff')]+=0x1,'scheduledat':moment()[_0x6287('0x129')](_0x10c0c4[_0x6287('0x1b1')],'minutes')[_0x6287('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5d31ac[_0x6287('0xe3')],'ListId':_0x5d31ac[_0x6287('0x10c')],'VoiceQueueId':_0x5d31ac['VoiceQueueId']||undefined,'CampaignId':_0x5d31ac[_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x1b2')));break;case 0x5:if(_0x5d31ac['countbusyretry']>=_0x10c0c4['dialBusyMaxRetry']-0x1){return!![];}this[_0x6287('0xd2')]({'active':![],'countbusyretry':_0x5d31ac[_0x6287('0xfd')]+=0x1,'scheduledat':moment()[_0x6287('0x129')](_0x10c0c4[_0x6287('0x1b3')],'minutes')[_0x6287('0x84')](_0x6287('0x10b')),'ContactId':_0x5d31ac['ContactId'],'ListId':_0x5d31ac[_0x6287('0x10c')],'VoiceQueueId':_0x5d31ac[_0x6287('0xe4')]||undefined,'CampaignId':_0x5d31ac[_0x6287('0xe5')]||undefined})['catch'](loggerCatch(_0x6287('0x1b4')));break;case 0x8:if(_0x5d31ac[_0x6287('0xfe')]>=_0x10c0c4['dialCongestionMaxRetry']-0x1){return!![];}this[_0x6287('0xd2')]({'active':![],'countcongestionretry':_0x5d31ac[_0x6287('0xfe')]+=0x1,'scheduledat':moment()['add'](_0x10c0c4[_0x6287('0x1b5')],_0x6287('0x10a'))[_0x6287('0x84')](_0x6287('0x10b')),'ContactId':_0x5d31ac['ContactId'],'ListId':_0x5d31ac['ListId'],'VoiceQueueId':_0x5d31ac['VoiceQueueId']||undefined,'CampaignId':_0x5d31ac[_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x1b6')));break;case 0x0:if(_0x5d31ac['countnosuchnumberretry']>=_0x10c0c4['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x6287('0xd2')]({'active':![],'countnosuchnumberretry':_0x5d31ac[_0x6287('0x100')]+=0x1,'scheduledat':moment()['add'](_0x10c0c4['dialNoSuchNumberRetryFrequency'],_0x6287('0x10a'))[_0x6287('0x84')](_0x6287('0x10b')),'ContactId':_0x5d31ac[_0x6287('0xe3')],'ListId':_0x5d31ac[_0x6287('0x10c')],'VoiceQueueId':_0x5d31ac[_0x6287('0xe4')]||undefined,'CampaignId':_0x5d31ac['CampaignId']||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x1b7')));}break;case 0xa:if(_0x5d31ac[_0x6287('0x101')]>=_0x10c0c4[_0x6287('0x1b8')]-0x1){return!![];}this[_0x6287('0xd2')]({'active':![],'countdropretry':_0x5d31ac[_0x6287('0x101')]+=0x1,'scheduledat':moment()[_0x6287('0x129')](_0x10c0c4['dialDropRetryFrequency'],'minutes')[_0x6287('0x84')](_0x6287('0x10b')),'ContactId':_0x5d31ac['ContactId'],'ListId':_0x5d31ac[_0x6287('0x10c')],'VoiceQueueId':_0x5d31ac[_0x6287('0xe4')]||undefined,'CampaignId':_0x5d31ac[_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x12a')));break;case 0xb:if(_0x5d31ac[_0x6287('0x102')]>=_0x10c0c4['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x6287('0xd2')]({'active':![],'countabandonedretry':_0x5d31ac['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x10c0c4[_0x6287('0x130')],_0x6287('0x10a'))[_0x6287('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5d31ac[_0x6287('0xe3')],'ListId':_0x5d31ac[_0x6287('0x10c')],'VoiceQueueId':_0x5d31ac[_0x6287('0xe4')]||undefined,'CampaignId':_0x5d31ac[_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x5d31ac[_0x6287('0xf9')]>=_0x10c0c4[_0x6287('0x107')]-0x1){return!![];}this[_0x6287('0xd2')]({'active':![],'countmachineretry':_0x5d31ac[_0x6287('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x10c0c4[_0x6287('0x112')],_0x6287('0x10a'))[_0x6287('0x84')](_0x6287('0x10b')),'ContactId':_0x5d31ac[_0x6287('0xe3')],'ListId':_0x5d31ac[_0x6287('0x10c')],'VoiceQueueId':_0x5d31ac[_0x6287('0xe4')]||undefined,'CampaignId':_0x5d31ac[_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x1b9')));break;case 0x14:if(_0x5d31ac['countagentrejectretry']>=_0x10c0c4[_0x6287('0x1ba')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x5d31ac['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x6287('0x129')](_0x10c0c4[_0x6287('0x1bb')],'minutes')['format'](_0x6287('0x10b')),'ContactId':_0x5d31ac[_0x6287('0xe3')],'ListId':_0x5d31ac[_0x6287('0x10c')],'VoiceQueueId':_0x5d31ac[_0x6287('0xe4')]||undefined,'CampaignId':_0x5d31ac[_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x1bc')));break;default:return!![];}};Dialer[_0x6287('0xb7')][_0x6287('0x1af')]=function(_0x48f625,_0x41a496,_0x80a1e1){var _0x17f3ae=this;var _0x49afdc=new History(_0x48f625);var _0x187315=![];var _0x3444f9;var _0x268f2a;return new BPromise(function(_0x4b9793,_0x5411ec){if(_[_0x6287('0x41')](_0x41a496)&&typeof _0x41a496!==_0x6287('0x17a')){return _0x5411ec(msgResponse('[callProgressDetecting]',_0x6287('0x14f'),_0x6287('0x1bd')));}if(_[_0x6287('0x41')](_0x80a1e1)&&typeof _0x80a1e1!==_0x6287('0x17a')){return _0x5411ec(msgResponse(_0x6287('0x1be'),_0x6287('0x14f'),_0x6287('0x1bf')));}_0x17f3ae['verifyAdditionalPhones'](_0x49afdc,_0x80a1e1[_0x6287('0x1c0')],_0x41a496)['then'](function(_0xaf6b12){if(_0xaf6b12[_0x6287('0x128')]==0x1)_0x187315=!![];switch(_0x80a1e1[_0x6287('0x1c0')]){case'0':_0x41a496['outboundNoSuchCallsDay']+=0x1;_0x49afdc[_0x6287('0xb3')]=0x0;_0x49afdc[_0x6287('0xb4')]=_0x6287('0x1c1');_0x49afdc[_0x6287('0x100')]+=0x1;_0x49afdc[_0x6287('0x111')]+=0x1;ami['emit'](_0x6287('0x1c2'),ut['buildObj'](_0x48f625,'nosuchnumber'));_0x3444f9=_0x41a496['dialNoSuchNumberRetryFrequency'];_0x268f2a=_0x41a496[_0x6287('0x126')];_0x17f3ae[_0x6287('0xdd')](_0x49afdc)[_0x6287('0xc7')](loggerCatch(_0x6287('0xfc')));if(_0x17f3ae['checkRetriveMax'](0x0,_0x48f625,_0x41a496)&&!_0x187315){if(_0x49afdc['countnosuchnumberretry']>=_0x41a496[_0x6287('0x1c3')]){_0x17f3ae[_0x6287('0x108')](_0x49afdc,_0x4b9793,_0x5411ec,_0x6287('0x1c4'));}else{_0x17f3ae[_0x6287('0x105')](_0x49afdc,_0x4b9793,_0x5411ec,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x41a496[_0x6287('0x69')]+=0x1;_0x49afdc[_0x6287('0xb3')]=0x3;_0x49afdc['statedesc']=_0x6287('0x1c5');_0x49afdc[_0x6287('0xff')]+=0x1;_0x49afdc[_0x6287('0x111')]+=0x1;ami[_0x6287('0x50')](_0x6287('0x1c6'),ut[_0x6287('0xfb')](_0x48f625,'noanswer'));_0x3444f9=_0x41a496['dialNoAnswerRetryFrequency'];_0x268f2a=_0x41a496[_0x6287('0x126')];_0x17f3ae[_0x6287('0xdd')](_0x49afdc)[_0x6287('0xc7')](loggerCatch(_0x6287('0x1c7')));if(_0x17f3ae[_0x6287('0x1b0')](0x3,_0x48f625,_0x41a496)&&!_0x187315){if(_0x49afdc['countnoanswerretry']>=_0x41a496[_0x6287('0x1c8')]){_0x17f3ae[_0x6287('0x108')](_0x49afdc,_0x4b9793,_0x5411ec,_0x6287('0x1c9'));}else{_0x17f3ae['stateGlobal'](_0x49afdc,_0x4b9793,_0x5411ec,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x41a496[_0x6287('0x1ca')]+=0x1;_0x49afdc[_0x6287('0xb3')]=0x5;_0x49afdc[_0x6287('0xb4')]='Busy';_0x49afdc[_0x6287('0xfd')]+=0x1;_0x49afdc[_0x6287('0x111')]+=0x1;ami[_0x6287('0x50')](_0x6287('0x1cb'),ut[_0x6287('0xfb')](_0x48f625,_0x6287('0x1cc')));_0x3444f9=_0x41a496[_0x6287('0x1b3')];_0x268f2a=_0x41a496[_0x6287('0x126')];_0x17f3ae[_0x6287('0xdd')](_0x49afdc)[_0x6287('0xc7')](loggerCatch(_0x6287('0x1cd')));if(_0x17f3ae['checkRetriveMax'](0x5,_0x48f625,_0x41a496)&&!_0x187315){if(_0x49afdc[_0x6287('0xfd')]>=_0x41a496[_0x6287('0x1ce')]){_0x17f3ae[_0x6287('0x108')](_0x49afdc,_0x4b9793,_0x5411ec,'reason\x205\x20busy');}else{_0x17f3ae[_0x6287('0x105')](_0x49afdc,_0x4b9793,_0x5411ec,_0x6287('0x1cf'));}}break;case'8':_0x41a496[_0x6287('0x66')]+=0x1;_0x49afdc[_0x6287('0xb3')]=0x8;_0x49afdc[_0x6287('0xb4')]='Congestion';_0x49afdc['countcongestionretry']+=0x1;_0x49afdc['countglobal']+=0x1;_0x3444f9=_0x41a496[_0x6287('0x1b5')];_0x268f2a=_0x41a496['callAdditionalPhoneAfterMin'];ami[_0x6287('0x50')]('custom:agentcongestion',ut['buildObj'](_0x48f625,_0x6287('0x1d0')));_0x17f3ae[_0x6287('0xdd')](_0x49afdc)[_0x6287('0xc7')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x17f3ae[_0x6287('0x1b0')](0x8,_0x48f625,_0x41a496)&&!_0x187315){if(_0x49afdc[_0x6287('0xfe')]>=_0x41a496['dialCongestionMaxRetry']){_0x17f3ae[_0x6287('0x108')](_0x49afdc,_0x4b9793,_0x5411ec,_0x6287('0x1d1'));}else{_0x17f3ae[_0x6287('0x105')](_0x49afdc,_0x4b9793,_0x5411ec,_0x6287('0x1d1'));}}break;case'11':_0x41a496[_0x6287('0x1d2')]+=0x1;_0x49afdc[_0x6287('0xb3')]=0xb;_0x49afdc[_0x6287('0xb4')]=_0x6287('0x1d3');_0x49afdc[_0x6287('0x102')]+=0x1;_0x49afdc[_0x6287('0x111')]+=0x1;_0x3444f9=_0x41a496['dialAbandonedRetryFrequency'];_0x268f2a=_0x41a496[_0x6287('0x126')];_0x17f3ae[_0x6287('0xdd')](_0x49afdc)[_0x6287('0xc7')](loggerCatch(_0x6287('0x132')));if(_0x17f3ae[_0x6287('0x1b0')](0xb,_0x48f625,_0x41a496)&&!_0x187315){if(_0x49afdc[_0x6287('0x102')]>=_0x41a496['dialAbandonedMaxRetry']){_0x17f3ae[_0x6287('0x108')](_0x49afdc,_0x4b9793,_0x5411ec,_0x6287('0x1d4'));}else{_0x17f3ae[_0x6287('0x105')](_0x49afdc,_0x4b9793,_0x5411ec,_0x6287('0x1d4'));}}break;case'20':_0x41a496['outboundRejectCallsDay']+=0x1;_0x49afdc['state']=0x14;_0x49afdc[_0x6287('0xb4')]=_0x6287('0x1d5');_0x49afdc[_0x6287('0x103')]+=0x1;_0x49afdc[_0x6287('0x111')]+=0x1;_0x3444f9=_0x41a496['dialAgentRejectRetryFrequency'];_0x268f2a=_0x41a496[_0x6287('0x126')];ami[_0x6287('0x50')](_0x6287('0x1d6'),ut[_0x6287('0xfb')](_0x48f625,_0x6287('0x1d7')));_0x17f3ae[_0x6287('0xdd')](_0x49afdc)[_0x6287('0xc7')](loggerCatch(_0x6287('0x1d8')));if(_0x17f3ae[_0x6287('0x1b0')](0x14,_0x48f625,_0x41a496)&&!_0x187315){if(_0x49afdc['countagentrejectretry']>=_0x41a496[_0x6287('0x1ba')]){_0x17f3ae['createStateFinal'](_0x49afdc,_0x4b9793,_0x5411ec,'reason\x2020\x20agentreject');}else{_0x17f3ae[_0x6287('0x105')](_0x49afdc,_0x4b9793,_0x5411ec,'reason\x2020\x20agentreject');}}break;default:_0x41a496['outboundUnknownCallsDay']+=0x1;_0x49afdc[_0x6287('0xb3')]=0xc;_0x49afdc['statedesc']=_0x80a1e1[_0x6287('0x1c0')];_0x3444f9=_0x41a496[_0x6287('0x1bb')];_0x268f2a=_0x41a496[_0x6287('0x126')];_0x17f3ae[_0x6287('0xdd')](_0x49afdc)[_0x6287('0xc7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x17f3ae[_0x6287('0x1b0')](_0x80a1e1[_0x6287('0x1c0')],_0x48f625,_0x41a496)&&!_0x187315){if(_0x49afdc[_0x6287('0xfd')]+_0x49afdc['countcongestionretry']+_0x49afdc[_0x6287('0xff')]+_0x49afdc['countnosuchnumberretry']+_0x49afdc[_0x6287('0x101')]+_0x49afdc[_0x6287('0x102')]+_0x49afdc[_0x6287('0xf9')]+_0x49afdc[_0x6287('0x103')]>=_0x41a496[_0x6287('0x104')]){_0x17f3ae[_0x6287('0x105')](_0x49afdc,_0x4b9793,_0x5411ec,_0x80a1e1[_0x6287('0x1c0')]);}else{_0x17f3ae[_0x6287('0x108')](_0x49afdc,_0x4b9793,_0x5411ec,_0x80a1e1[_0x6287('0x1c0')]);}}}})[_0x6287('0x3f')](function(_0x3ae791){if(_0x187315){_0x17f3ae[_0x6287('0xcd')](_0x49afdc,_0x3444f9,_0x268f2a)[_0x6287('0x3f')](function(_0x1a1217){return _0x4b9793(0x1);});}});});};Dialer['prototype'][_0x6287('0x105')]=function(_0x3b7585,_0x3e6e88,_0x5daf8d,_0x5b1b6a){var _0x4b75d3=new Final(_0x3b7585);_0x4b75d3[_0x6287('0xb3')]=0xf;_0x4b75d3[_0x6287('0xb4')]=_0x6287('0x1d9');this[_0x6287('0x108')](_0x4b75d3,_0x3e6e88,_0x5daf8d,_0x5b1b6a);};Dialer[_0x6287('0xb7')][_0x6287('0x108')]=function(_0xb46726,_0x31e3ed,_0x29a804,_0x47952d){this[_0x6287('0xdb')](_0xb46726)[_0x6287('0x3f')](function(){return _0x31e3ed(msgResponse(_0x6287('0x1be'),_0x6287('0x1da'),_0x47952d));})['catch'](function(){return _0x29a804(msgResponse(_0x6287('0x1db'),_0x6287('0x14f'),_0x6287('0x1dc')));});};Dialer[_0x6287('0xb7')][_0x6287('0x9')]=function(_0x3cee6e){var _0xce32a=_0x3cee6e[_0x6287('0x1dd')]/0x64;var _0x5b33ee=_0x3cee6e[_0x6287('0x122')]/(_0x3cee6e['outboundDropCallsDayTimeout']+_0x3cee6e[_0x6287('0x64')]);var _0x15195e=Math[_0x6287('0x1de')](_0x3cee6e[_0x6287('0x76')]*(_0x3cee6e['predictiveIntervalMaxThreshold']/0x64));var _0x339ef4=Math[_0x6287('0x1de')](_0x3cee6e[_0x6287('0x76')]*(_0x3cee6e[_0x6287('0x1df')]/0x64));var _0x30c08b=_0x3cee6e['available']+_0x3cee6e[_0x6287('0x5a')];var _0x174525=Math[_0x6287('0x1e0')](_0x3cee6e[_0x6287('0x79')]*_0x3cee6e[_0x6287('0x7b')]*_0x3cee6e[_0x6287('0x73')]*_0x3cee6e[_0x6287('0x74')]);if(_[_0x6287('0x41')](_0x3cee6e['startProgressive'])){if(!_[_0x6287('0x41')](_0x3cee6e['startPredictive'])){_0x3cee6e[_0x6287('0x29')]=undefined;loggerPredictive[_0x6287('0xa3')]('[startMethodPredictive][StartProgressive]',_0x6287('0x1e1'));}if(!_[_0x6287('0x41')](_0x3cee6e[_0x6287('0x9d')])){loggerPredictive[_0x6287('0xa3')](_0x6287('0x1e2'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3cee6e[_0x6287('0x9d')]);_0x3cee6e[_0x6287('0x9d')]=undefined;}_0x3cee6e[_0x6287('0x7d')]=moment()['format'](_0x6287('0x10b'));loggerPredictive[_0x6287('0x88')](_0x3cee6e[_0x6287('0x42')],_0x6287('0x1e3'),_0x3cee6e[_0x6287('0x7d')]);this[_0x6287('0x163')](_0x3cee6e,0x1);}else if(ifInterval(_0x3cee6e[_0x6287('0x1e4')],_0x3cee6e[_0x6287('0x7d')])){this['handlePower'](_0x3cee6e,0x1);loggerPredictiveCalls[_0x6287('0x88')]('[startMethodPredictive][StartProgressive][Loop]',_0x3cee6e['startProgressive'],_0x3cee6e[_0x6287('0x42')]);_0x3cee6e[_0x6287('0x79')]=0x0;_0x3cee6e['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xce32a<_0x5b33ee&&_0x3cee6e[_0x6287('0x1e5')]===_0x6287('0x1e6')){freeVariablesPredictive(_0x3cee6e);loggerPredictive[_0x6287('0x88')](_0x6287('0x1e7'),_0x6287('0x1e8'),_0x5b33ee,_0x6287('0x7d'),_0x3cee6e[_0x6287('0x42')]);}else if(_0x174525<_0x3cee6e[_0x6287('0x1e9')]&&_0x3cee6e['dialPredictiveOptimization']===_0x6287('0x1e6')){freeVariablesPredictive(_0x3cee6e);loggerPredictive[_0x6287('0x88')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x6287('0x1ea'),_0x174525,_0x6287('0x1eb'),_0x3cee6e[_0x6287('0x1e9')],'startProgressive',_0x3cee6e[_0x6287('0x42')]);}else if(!ifInterval(_0x3cee6e[_0x6287('0x1e4')],_0x3cee6e['startProgressive'])&&_[_0x6287('0x41')](_0x3cee6e[_0x6287('0x29')])&&!_[_0x6287('0x41')](_0x3cee6e[_0x6287('0x7d')])){_0x3cee6e[_0x6287('0x29')]=moment()[_0x6287('0x84')](_0x6287('0x10b'));loggerPredictive[_0x6287('0x88')](_0x3cee6e[_0x6287('0x42')],_0x6287('0x1ec'),_0x3cee6e[_0x6287('0x29')]);this['averageHandleTime'](_0x3cee6e[_0x6287('0x1e4')])[_0x6287('0x3f')](this[_0x6287('0x1ed')](_0x3cee6e))[_0x6287('0x3f')](mergeDataErlangB(_0x3cee6e))[_0x6287('0x3f')](this[_0x6287('0x1ee')](_0x3cee6e))['catch'](loggerCatchPredictive(_0x6287('0x1ef'),_0x3cee6e));}else if(!ifInterval(_0x3cee6e['dialPredictiveInterval'],_0x3cee6e['startPredictive'])){_0x3cee6e[_0x6287('0x1e9')]=0x0;_0x3cee6e[_0x6287('0x29')]=moment()[_0x6287('0x84')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x3cee6e[_0x6287('0x42')],_0x6287('0x1f0'),_0x3cee6e[_0x6287('0x29')]);clearInterval(_0x3cee6e[_0x6287('0x9d')]);_0x3cee6e[_0x6287('0x9d')]=undefined;this[_0x6287('0x1f1')](_0x3cee6e[_0x6287('0x1e4')])[_0x6287('0x3f')](this[_0x6287('0x1ed')](_0x3cee6e))[_0x6287('0x3f')](mergeDataErlangB(_0x3cee6e))['then'](this[_0x6287('0x1ee')](_0x3cee6e))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3cee6e));}else if(_0x3cee6e[_0x6287('0x76')]&&_0x30c08b<_0x3cee6e[_0x6287('0x76')]-_0x339ef4){freeVariablesPredictive(_0x3cee6e);loggerPredictive['info'](_0x3cee6e['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x30c08b,_0x6287('0x1f2'),_0x3cee6e[_0x6287('0x76')],'-',_0x339ef4,'=',_0x3cee6e[_0x6287('0x76')]-_0x339ef4,')');}else if(_0x3cee6e[_0x6287('0x76')]&&_0x30c08b>_0x3cee6e[_0x6287('0x76')]+_0x15195e){freeVariablesPredictive(_0x3cee6e);loggerPredictive[_0x6287('0x88')](_0x3cee6e['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x30c08b,')\x20are\x20more\x20than\x20threshold\x20(',_0x3cee6e[_0x6287('0x76')],'+',_0x15195e,'=',_0x3cee6e[_0x6287('0x76')]+_0x15195e,')');}};Dialer[_0x6287('0xb7')]['getDataPredictive']=function(_0x39841e){var _0x214570=this;return function(_0x4738c3){return new BPromise(function(_0x47d73d,_0xcc8b21){_[_0x6287('0x9a')](_0x39841e,_0x4738c3[0x0]);if(checkGetDataPredictive(_0x4738c3[0x0])){var _0x300f7b=_0x39841e[_0x6287('0x76')]=_0x39841e['talking']+_0x39841e[_0x6287('0x55')];var _0x313d18=_0x39841e[_0x6287('0x1e4')]*0x3c;var _0x1df965=_0x4738c3[0x0][_0x6287('0x90')]+_0x4738c3[0x0][_0x6287('0x70')];var _0x3c63a4=(_0x4738c3[0x0]['predictiveIntervalAnsweredCalls']+_0x4738c3[0x0][_0x6287('0x72')]+_0x4738c3[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4738c3[0x0][_0x6287('0x77')];_0x39841e[_0x6287('0x73')]=_0x3c63a4>0x0?_0x3c63a4:0x1;switch(_0x39841e['dialPredictiveOptimization']){case _0x6287('0x1e6'):var _0x46e8cc=_0x39841e[_0x6287('0x1dd')]/0x64;return _0x214570[_0x6287('0x1f3')](_0x300f7b,_0x313d18,_0x1df965,_0x3c63a4,_0x46e8cc)['then'](function(_0x1001ec){return _0x47d73d(_0x1001ec);});case _0x6287('0x1f4'):var _0x23f6b1=_0x39841e['dialPredictiveOptimizationPercentage']/0x64;return _0x214570[_0x6287('0x1f5')](_0x300f7b,_0x313d18,_0x1df965,_0x3c63a4,_0x23f6b1)['then'](function(_0x4f6ff9){return _0x47d73d(_0x4f6ff9);});default:return _0xcc8b21(msgResponse(_0x6287('0x1f6'),_0x6287('0x14f'),_0x6287('0x1f7')));}}else{return _0xcc8b21(msgResponse(_0x6287('0x1f6'),_0x6287('0x14f'),'check\x20failure'));}});};};Dialer['prototype'][_0x6287('0x1f8')]=function(_0x36c8b2){var _0x457ed7=this;return function(_0x36113c){return new BPromise(function(_0x158c6d,_0x4e1de9){_[_0x6287('0x9a')](_0x36c8b2,_0x36113c[0x0]);if(checkGetDataPredictive(_0x36113c[0x0])){loggerPredictive[_0x6287('0x88')](JSON[_0x6287('0x4c')](_0x36113c[0x0]));if(_0x36c8b2[_0x6287('0x1e5')]===_0x6287('0x1e6')){return _0x457ed7[_0x6287('0xd9')](_0x36c8b2['id'])[_0x6287('0x3f')](function(_0x3b2a88){var _0x240a88=_0x36c8b2[_0x6287('0x1f9')]-_0x3b2a88[0x0][_0x6287('0x1fa')];var _0x15ec46=_0x36c8b2[_0x6287('0x1e4')]*0x3c;var _0x1dd3be=_0x36113c[0x0][_0x6287('0x90')]+_0x36113c[0x0][_0x6287('0x70')];var _0x556474=(_0x36113c[0x0][_0x6287('0x6f')]+_0x36113c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x36113c[0x0][_0x6287('0x71')])/_0x36113c[0x0][_0x6287('0x77')];var _0x5a7c1e=_0x36c8b2[_0x6287('0x1dd')]/0x64;_0x36c8b2['predictiveIntervalPauses']=_0x3b2a88[0x0]['outboundQueuePauses']||0x0;_0x36c8b2[_0x6287('0x73')]=_0x556474>0x0?_0x556474:0x1;return _0x457ed7[_0x6287('0x1f3')](_0x240a88,_0x15ec46,_0x1dd3be,_0x556474,_0x5a7c1e);})['then'](function(_0x2513c9){return _0x158c6d(_0x2513c9);})[_0x6287('0xc7')](function(_0x4ed0c9){return _0x4e1de9(msgResponse(_0x6287('0x1fb'),_0x6287('0x14f'),JSON[_0x6287('0x4c')](_0x4ed0c9)));});}if(_0x36c8b2[_0x6287('0x1e5')]==='agentBusyFactor'){return _0x457ed7[_0x6287('0xd9')](_0x36c8b2['id'])[_0x6287('0x3f')](function(_0x2d4ac3){var _0x3d10b8=_0x36c8b2[_0x6287('0x1f9')]-_0x2d4ac3[0x0][_0x6287('0x1fa')];var _0x57ccf1=_0x36c8b2[_0x6287('0x1e4')]*0x3c;var _0x3ff830=_0x36113c[0x0]['predictiveIntervalAvgTalktime']+_0x36113c[0x0][_0x6287('0x70')];var _0x380cd9=(_0x36113c[0x0][_0x6287('0x6f')]+_0x36113c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x36113c[0x0][_0x6287('0x71')])/_0x36113c[0x0][_0x6287('0x77')];var _0x5a0334=_0x36c8b2['dialPredictiveOptimizationPercentage']/0x64;_0x36c8b2['predictiveIntervalPauses']=_0x2d4ac3[0x0][_0x6287('0x1fa')]||0x0;_0x36c8b2[_0x6287('0x73')]=_0x380cd9>0x0?_0x380cd9:0x1;return _0x457ed7[_0x6287('0x1f5')](_0x3d10b8,_0x57ccf1,_0x3ff830,_0x380cd9,_0x5a0334);})[_0x6287('0x3f')](function(_0x3feedd){return _0x158c6d(_0x3feedd);})[_0x6287('0xc7')](function(_0x3c7c66){return _0x4e1de9(msgResponse(_0x6287('0x1fb'),_0x6287('0x14f'),JSON[_0x6287('0x4c')](_0x3c7c66)));});}}else{return _0x4e1de9(msgResponse('[getDataPredictive]','Failure',_0x6287('0x1fc')));}});};};Dialer[_0x6287('0xb7')]['startMethodPredictive']=function(_0x536485){var _0x2ae1cd=this;return function(){var _0x3d6456=0x0;var _0x4185e9=Math[_0x6287('0x1e0')](_0x536485[_0x6287('0x7a')]*0x3e8);if(_0x4185e9>0x0){_0x4185e9=_0x4185e9<0x64?0x64:_0x4185e9;loggerPredictive[_0x6287('0x88')](_0x536485[_0x6287('0x42')],_0x6287('0x1fd'),_0x4185e9,_0x6287('0x4d'));_0x536485[_0x6287('0x9d')]=setInterval(function(){_0x2ae1cd[_0x6287('0x9d')](_0x536485);loggerPredictiveCalls['info'](_0x6287('0x1fe'),_0x3d6456+=0x1);},_0x4185e9);}else{loggerPredictive[_0x6287('0x88')](_0x536485[_0x6287('0x42')],_0x6287('0x1ff'));}};};Dialer[_0x6287('0xb7')][_0x6287('0x200')]=function(_0x5a6ba0,_0xd5cb49){var _0x53a9cd=this;return function(_0x1ca2de){if(_[_0x6287('0x87')](_0x1ca2de)){if(_['isNil'](_0xd5cb49[_0x6287('0x201')])||!_0xd5cb49['recallme']){if(_0x5a6ba0['dialMethod']===_0x6287('0x8')){_0x5a6ba0[_0x6287('0x13a')]=_[_0x6287('0x41')](_0x5a6ba0[_0x6287('0x13a')])?!![]:_0x5a6ba0[_0x6287('0x13a')];var _0x271958=uuid['v4']();_0x53a9cd[_0x6287('0x26')][_0x271958]=new Action(_0x5a6ba0,_0xd5cb49,_0x271958);loggerBooked['info'](_0x6287('0x202'),_0x271958,'queueStatusComplete:\x20',JSON['stringify'](_0x5a6ba0[_0x6287('0x13a')]),_0x6287('0x203'),_0x5a6ba0[_0x6287('0x42')]);if(_0x5a6ba0['queueStatusComplete']){_0x5a6ba0[_0x6287('0x13a')]=![];_0x53a9cd[_0x6287('0x137')][_0x53a9cd[_0x6287('0x26')][_0x271958][_0x6287('0xc4')]]=[];ami[_0x6287('0xbf')]({'actionid':_0x271958,'action':_0x6287('0x204'),'queue':_0x5a6ba0[_0x6287('0x42')]})[_0x6287('0xc7')](function(){_0x53a9cd[_0x6287('0xc3')](_0x5a6ba0);_0x53a9cd[_0x6287('0xd2')]({'active':![],'ContactId':_0x53a9cd['actions'][_0x271958]['ContactId'],'ListId':_0x53a9cd[_0x6287('0x26')][_0x271958][_0x6287('0x10c')],'VoiceQueueId':_0x53a9cd[_0x6287('0x26')][_0x271958][_0x6287('0xe4')]||undefined,'CampaignId':_0x53a9cd[_0x6287('0x26')][_0x271958][_0x6287('0xe5')]||undefined})['catch'](loggerCatch(_0x6287('0x205')));delete _0x53a9cd[_0x6287('0x26')][_0x271958];});}else{loggerBooked[_0x6287('0x88')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x5a6ba0[_0x6287('0x13a')]),_0x6287('0x203'),_0x5a6ba0[_0x6287('0x42')]);_0x53a9cd['updateOriginated'](_0x5a6ba0);_0x53a9cd[_0x6287('0xd2')]({'active':![],'ContactId':_0x53a9cd[_0x6287('0x26')][_0x271958]['ContactId'],'ListId':_0x53a9cd['actions'][_0x271958][_0x6287('0x10c')],'VoiceQueueId':_0x53a9cd[_0x6287('0x26')][_0x271958][_0x6287('0xe4')]||undefined,'CampaignId':_0x53a9cd[_0x6287('0x26')][_0x271958][_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x205')));delete _0x53a9cd[_0x6287('0x26')][_0x271958];}}else{return _0x53a9cd[_0x6287('0x179')](_0x5a6ba0,_0xd5cb49);}}else{if(getDiff(_0xd5cb49[_0x6287('0x206')])<_0x5a6ba0[_0x6287('0x207')]*0x3c){if(_0xd5cb49[_0x6287('0x169')]&&!_0xd5cb49[_0x6287('0x169')]['voicePause']){_0x53a9cd['preview'][_0x6287('0x13c')](_0xd5cb49['id'])[_0x6287('0x1e')](function(){_0x53a9cd[_0x6287('0xc3')](_0x5a6ba0);});}else{_0x53a9cd[_0x6287('0xd3')]({'active':![]},_0xd5cb49['id'],0x1)[_0x6287('0x1e')](function(){_0x53a9cd[_0x6287('0xc3')](_0x5a6ba0);});}}else{_0x5a6ba0[_0x6287('0x6c')]+=0x1;_0x53a9cd['updateOriginated'](_0x5a6ba0);if(_0x5a6ba0[_0x6287('0x208')]){_0x53a9cd[_0x6287('0xd2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xd5cb49[_0x6287('0xe3')],'ListId':_0xd5cb49[_0x6287('0x10c')],'VoiceQueueId':_0xd5cb49['VoiceQueueId']||undefined,'CampaignId':_0xd5cb49[_0x6287('0xe5')]||undefined})[_0x6287('0xc7')](loggerCatch(_0x6287('0x209')));_0x53a9cd[_0x6287('0xdd')](createObjHistory(_0x5a6ba0,_0xd5cb49,_0x6287('0x20a'),0x17,_0x6287('0x20b')))[_0x6287('0xc7')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x53a9cd[_0x6287('0xe1')](createObjHistory(_0x5a6ba0,_0xd5cb49,_0x6287('0x20c'),0x16,_0x6287('0x20d')),_0x6287('0x20e'),_0x6287('0x20f'));}}}}else{_0x5a6ba0[_0x6287('0x65')]+=0x1;_0x53a9cd[_0x6287('0xe1')](createObjHistory(_0x5a6ba0,_0xd5cb49,_0x6287('0x210'),0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x6287('0x211'));throw'inBlackList';}};};Dialer[_0x6287('0xb7')]['handleIvr']=function(_0x45cda2){var _0x3f38b9=this;var _0x5e16f0=_0x45cda2[_0x6287('0x212')]-_0x45cda2['originated']-_0x45cda2[_0x6287('0xd6')];emitCampaignSummary(_0x45cda2);if(_0x5e16f0>0x0){if(_0x5e16f0>this['maxNumberOriginate']){_0x5e16f0=this[_0x6287('0x24')];}_0x45cda2[_0x6287('0xd6')]+=_0x5e16f0;this['getContactDialerIvr'](_0x45cda2['id'],_0x5e16f0,_0x45cda2[_0x6287('0x213')],_0x45cda2)[_0x6287('0x3f')](function(_0x5da7aa){_0x45cda2[_0x6287('0xd6')]-=_0x5e16f0;_0x45cda2[_0x6287('0xd6')]=_0x45cda2['temp']>0x0?_0x45cda2['temp']:0x0;if(!checkContactEmpty(_0x5da7aa)){_0x45cda2[_0x6287('0x44')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x6287('0x88')]('[getContactCampaign2][Empty]'+_0x45cda2[_0x6287('0x42')]);}else{_0x45cda2[_0x6287('0x78')]+=_0x5da7aa[_0x6287('0xa5')];_0x45cda2[_0x6287('0x44')]=_0x6287('0x214');for(var _0x587e79=0x0;_0x587e79<_0x5da7aa[_0x6287('0xa5')];_0x587e79+=0x1){_0x45cda2[_0x6287('0x215')]+=0x1;if(_[_0x6287('0xbe')](_0x5da7aa[_0x587e79])||_['isNil'](_0x5da7aa[_0x587e79][_0x6287('0x19b')])||_[_0x6287('0xbe')](_0x5da7aa[_0x587e79][_0x6287('0x1a4')])){_0x3f38b9['emptyContact'](_0x6287('0x216'),_0x45cda2,_0x5da7aa[_0x587e79]);}else{_0x3f38b9['checkIsBlackListIvr'](_[_0x6287('0xe2')](_0x5da7aa[_0x587e79],[_0x6287('0xe5'),'Contact.phone']))[_0x6287('0x3f')](_0x3f38b9['checkContactBlack'](_0x45cda2,_0x5da7aa[_0x587e79]))[_0x6287('0xc7')](_0x3f38b9[_0x6287('0xe0')](_0x6287('0x217'),_0x45cda2));}}}})[_0x6287('0xc7')](loggerGetContactDialer(_0x6287('0x218'),_0x45cda2,_0x5e16f0));}};Dialer[_0x6287('0xb7')][_0x6287('0x163')]=function(_0x32f868,_0x443ab3){var _0x1e2451=this;var _0x1edf82=[];var _0x335015=_0x443ab3>=0x1?_0x443ab3:0x1;if(_0x32f868['dialMethod']===_0x6287('0x8')){_0x335015=0x1;}var _0x194f0d=Math[_0x6287('0x1e0')](_0x32f868[_0x6287('0x55')]*_0x335015)-_0x32f868[_0x6287('0x78')]-_0x32f868[_0x6287('0xd6')];emitVoiceQueueSummary(_0x32f868);if(_0x32f868[_0x6287('0x219')]>0x0){var _0x51ec10=_0x32f868[_0x6287('0x219')]-_0x32f868[_0x6287('0x78')]-_0x32f868['talking']-_0x32f868[_0x6287('0xd6')]-_0x32f868['pTalking'];if(_0x194f0d>_0x51ec10){_0x194f0d=_0x51ec10;}}if(_0x194f0d>0x0){if(_0x32f868[_0x6287('0x5f')]===_0x6287('0x8')){_0x194f0d=0x1;}if(_0x194f0d>this[_0x6287('0x24')]){_0x194f0d=this[_0x6287('0x24')];}_0x32f868[_0x6287('0xd6')]+=_0x194f0d;for(var _0x567c08 in this[_0x6287('0x22')]){if(typeof this[_0x6287('0x22')][_0x567c08]!==_0x6287('0xbb')){if(this['agents'][_0x567c08][_0x6287('0xb3')]===_0x6287('0x21a')&&this[_0x6287('0x22')][_0x567c08][_0x6287('0xc0')]===_0x6287('0xea')){_0x1edf82[_0x6287('0x138')](this[_0x6287('0x22')][_0x567c08]['id']);}}}this[_0x6287('0xd5')](_0x32f868['id'],_0x1edf82,_0x194f0d,_0x32f868['dialOrderByScheduledAt'],_0x32f868)['then'](function(_0x235f58){_0x32f868[_0x6287('0xd6')]-=_0x194f0d;_0x32f868['temp']=_0x32f868[_0x6287('0xd6')]>0x0?_0x32f868[_0x6287('0xd6')]:0x0;if(!checkContactEmpty(_0x235f58)){_0x1e2451[_0x6287('0x21b')](_0x32f868)['then'](sendMessageReschedule(_0x32f868))[_0x6287('0xc7')](loggerCatch('[countReScheduled]\x20'));}else{_0x32f868['originated']+=_0x235f58[_0x6287('0xa5')];_0x32f868['message']=_0x32f868[_0x6287('0x5f')]===_0x6287('0x8')?_0x6287('0x184'):'RUNNING';for(var _0x35ee4c=0x0;_0x35ee4c<_0x235f58[_0x6287('0xa5')];_0x35ee4c+=0x1){if(_['isNil'](_0x235f58[_0x35ee4c])||_[_0x6287('0xbe')](_0x235f58[_0x35ee4c][_0x6287('0x19b')])||_[_0x6287('0xbe')](_0x235f58[_0x35ee4c][_0x6287('0x1a4')])){_0x1e2451['emptyContact']('[actionOriginate]\x20',_0x32f868,_0x235f58[_0x35ee4c]);}else{_0x1e2451[_0x6287('0xc8')](_[_0x6287('0xe2')](_0x235f58[_0x35ee4c],['VoiceQueueId',_0x6287('0x21c')]))[_0x6287('0x3f')](_0x1e2451[_0x6287('0x200')](_0x32f868,_0x235f58[_0x35ee4c]))['catch'](_0x1e2451['loggerHandler']('[actionOriginate]\x20',_0x32f868));}}}})[_0x6287('0xc7')](loggerGetContactDialer(_0x6287('0x21d'),_0x32f868,_0x194f0d));}};Dialer[_0x6287('0xb7')][_0x6287('0x9d')]=function(_0x157933){if(_0x157933[_0x6287('0x219')]>0x0){var _0x557b3f=_0x157933[_0x6287('0x219')]-_0x157933[_0x6287('0x78')]-_0x157933[_0x6287('0x5a')];if(_0x557b3f>0x0){this[_0x6287('0x21e')](_0x157933);}else{loggerPredictiveCalls['info'](_0x6287('0x21f'));}}else{this['tryOriginatePredictive'](_0x157933);}};Dialer['prototype'][_0x6287('0x21e')]=function(_0x119ee1){var _0x80a3e0=this;var _0x9d68ee=[];_0x119ee1[_0x6287('0x78')]+=0x1;for(var _0x4955ac in this[_0x6287('0x22')]){if(typeof this['agents'][_0x4955ac]!==_0x6287('0xbb')){if(this[_0x6287('0x22')][_0x4955ac][_0x6287('0xb3')]===_0x6287('0x21a')&&this[_0x6287('0x22')][_0x4955ac][_0x6287('0xc0')]===_0x6287('0xea')){_0x9d68ee[_0x6287('0x138')](this[_0x6287('0x22')][_0x4955ac]['id']);}}}this[_0x6287('0xd5')](_0x119ee1['id'],_0x9d68ee,0x1,_0x119ee1['dialOrderByScheduledAt'],_0x119ee1)[_0x6287('0x3f')](function(_0x1eeaa4){if(!checkContactEmpty(_0x1eeaa4)){checkContactLowerLimitOriginate(_0x119ee1,0x1,0x0);_0x80a3e0[_0x6287('0x21b')](_0x119ee1)[_0x6287('0x3f')](sendMessageReschedule(_0x119ee1))[_0x6287('0xc7')](loggerCatch(_0x6287('0x220')));}else{_0x119ee1[_0x6287('0x44')]=_0x6287('0x214');if(_[_0x6287('0xbe')](_0x1eeaa4[0x0])||_['isNil'](_0x1eeaa4[0x0][_0x6287('0x19b')])||_[_0x6287('0xbe')](_0x1eeaa4[0x0]['phone'])){_0x80a3e0['emptyContact'](_0x6287('0x216'),_0x119ee1,_0x1eeaa4[0x0]);}else{_0x80a3e0[_0x6287('0xc8')](_[_0x6287('0xe2')](_0x1eeaa4[0x0],[_0x6287('0xe4'),_0x6287('0x21c')]))[_0x6287('0x3f')](_0x80a3e0[_0x6287('0x200')](_0x119ee1,_0x1eeaa4[0x0]))[_0x6287('0xc7')](_0x80a3e0[_0x6287('0xe0')](_0x6287('0x221'),_0x119ee1));}}})[_0x6287('0xc7')](loggerGetContactDialer(_0x6287('0x222'),_0x119ee1,0x1));emitVoiceQueueSummary(_0x119ee1);};Dialer[_0x6287('0xb7')][_0x6287('0x1f3')]=function(_0x15cace,_0x346705,_0x55131b,_0x2c633a,_0x235813,_0x3ac1ba){loggerPredictive[_0x6287('0x88')](_0x6287('0x223'));loggerPredictive[_0x6287('0x88')]('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',_0x15cace);loggerPredictive['info'](_0x6287('0x224'),_0x346705);loggerPredictive[_0x6287('0x88')](_0x6287('0x225'),_0x55131b);loggerPredictive[_0x6287('0x88')](_0x6287('0x226'),_0x2c633a);loggerPredictive[_0x6287('0x88')](_0x6287('0x227'),_0x235813);loggerPredictive[_0x6287('0x88')](_0x6287('0x91'));return new BPromise(function(_0x432be9,_0x4576b5){if(_0x15cace<=0x0||isNaN(_0x15cace)){return _0x4576b5(msgResponse(_0x6287('0x228'),_0x6287('0x4b'),'m\x20=\x20'+_0x15cace));}if(_0x55131b<=0x0||isNaN(_0x55131b)){return _0x4576b5(msgResponse('[abandonmentRate]',_0x6287('0x4b'),_0x6287('0x229')+_0x55131b));}if(_0x2c633a<=0x0||isNaN(_0x2c633a)){return _0x4576b5(msgResponse(_0x6287('0x228'),_0x6287('0x4b'),_0x6287('0x22a')+_0x2c633a));}if(_0x346705<=0x0||isNaN(_0x346705)){return _0x4576b5(msgResponse('[abandonmentRate]',_0x6287('0x4b'),_0x6287('0x22b')+_0x346705));}if(_0x235813<=0x0||isNaN(_0x235813)){return _0x4576b5(msgResponse(_0x6287('0x228'),_0x6287('0x4b'),'Amax\x20=\x20'+_0x235813));}_0x3ac1ba=_0x3ac1ba||0x0;var _0x1b9f33=0x1/_0x55131b;var _0x2240a3=0x0;var _0x56cb4e=0x0;var _0x4c398d=0x0;var _0x3227b2=0x0;for(var _0x57d684=0x0;_0x4c398d<_0x235813;_0x57d684+=0x1){_0x56cb4e=_0x57d684/_0x346705;_0x2240a3=(_0x2c633a*_0x56cb4e+_0x3ac1ba)/_0x1b9f33;_0x4c398d=erlangb(_0x2240a3,_0x15cace);_0x3227b2=_0x2240a3/_0x15cace*(0x1-erlangb(_0x2240a3,_0x15cace));}return _0x432be9({'erlangCalls':_0x57d684,'erlangCallToSecond':_0x346705/_0x57d684,'erlangAbandonmentRate':_0x4c398d,'erlangBusyFactor':_0x3227b2});});};Dialer[_0x6287('0xb7')][_0x6287('0x1f5')]=function(_0x481c33,_0x9a58ec,_0x112150,_0x4c6eb6,_0x38fce1,_0x35f329){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x6287('0x22c'),_0x481c33);loggerPredictive[_0x6287('0x88')](_0x6287('0x224'),_0x9a58ec);loggerPredictive['info'](_0x6287('0x225'),_0x112150);loggerPredictive[_0x6287('0x88')](_0x6287('0x226'),_0x4c6eb6);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38fce1);loggerPredictive[_0x6287('0x88')](_0x6287('0x91'));return new BPromise(function(_0x30ec1a,_0x1ed456){if(_0x481c33<=0x0||isNaN(_0x481c33)){return _0x1ed456(msgResponse(_0x6287('0x22d'),_0x6287('0x4b'),_0x6287('0x22e')+_0x481c33));}if(_0x112150<=0x0||isNaN(_0x112150)){return _0x1ed456(msgResponse('[busyFactor]','Error',_0x6287('0x229')+_0x112150));}if(_0x4c6eb6<=0x0||isNaN(_0x4c6eb6)){return _0x1ed456(msgResponse('[busyFactor]',_0x6287('0x4b'),_0x6287('0x22a')+_0x4c6eb6));}if(_0x9a58ec<=0x0||isNaN(_0x9a58ec)){return _0x1ed456(msgResponse(_0x6287('0x22d'),_0x6287('0x4b'),_0x6287('0x22b')+_0x9a58ec));}if(_0x38fce1<=0x0||isNaN(_0x38fce1)){return _0x1ed456(msgResponse('[busyFactor]','Error',_0x6287('0x22f')+_0x38fce1));}_0x35f329=_0x35f329||0x0;var _0x3a3ff5=0x1/_0x112150;var _0x10097d=0x0;var _0x10c0dc=0x0;var _0x226bf9=0x0;var _0x34373d=0x0;for(var _0x41c6f6=0x0;_0x34373d<_0x38fce1;_0x41c6f6+=0x1){_0x10c0dc=_0x41c6f6/_0x9a58ec;_0x10097d=(_0x4c6eb6*_0x10c0dc+_0x35f329)/_0x3a3ff5;_0x226bf9=erlangb(_0x10097d,_0x481c33);_0x34373d=_0x10097d/_0x481c33*(0x1-erlangb(_0x10097d,_0x481c33));}return _0x30ec1a({'erlangCalls':_0x41c6f6,'erlangCallToSecond':_0x9a58ec/_0x41c6f6,'erlangAbandonmentRate':_0x226bf9,'erlangBusyFactor':_0x34373d});});};module[_0x6287('0x230')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index f59555d..b01e26e 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x197a=['countmachineretry','countagentrejectretry','uniqueid','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x4767da,_0x20aa50){var _0x5d1743=function(_0x2384ff){while(--_0x2384ff){_0x4767da['push'](_0x4767da['shift']());}};_0x5d1743(++_0x20aa50);}(_0x197a,0x162));var _0xa197=function(_0x2abd03,_0x15bd78){_0x2abd03=_0x2abd03-0x0;var _0x397306=_0x197a[_0x2abd03];return _0x397306;};'use strict';var util=require(_0xa197('0x0'));var _=require('lodash');var moment=require(_0xa197('0x1'));function getSeconds(_0x22bef3,_0x1b9b7d){var _0x3461d2=moment(_0x22bef3)[_0xa197('0x2')](0x0);var _0x5adff8=moment(_0x1b9b7d)[_0xa197('0x2')](0x0);return _0x3461d2[_0xa197('0x3')](_0x5adff8,_0xa197('0x4'));}function QueueCallerAbandon(_0x42a3c1,_0x4acc78){this[_0xa197('0x5')]=_0x42a3c1[_0xa197('0x5')];this[_0xa197('0x6')]=_0x42a3c1[_0xa197('0x6')];this['campaigntype']=_0x42a3c1['type']===_0xa197('0x7')?'queue':_0x42a3c1[_0xa197('0x6')];this[_0xa197('0x8')]=_0x42a3c1[_0xa197('0x8')];this['countcongestionretry']=_0x42a3c1[_0xa197('0x9')];this[_0xa197('0xa')]=_0x42a3c1[_0xa197('0xa')];this[_0xa197('0xb')]=_0x42a3c1['countbusyretry']+_0x42a3c1['countcongestionretry']+_0x42a3c1['countnoanswerretry']+_0x42a3c1[_0xa197('0xc')]+_0x42a3c1[_0xa197('0xd')]+_0x42a3c1[_0xa197('0xe')]+_0x42a3c1[_0xa197('0xf')]+_0x42a3c1[_0xa197('0x10')];this['countnosuchnumberretry']=_0x42a3c1[_0xa197('0xc')];this[_0xa197('0xd')]=_0x42a3c1[_0xa197('0xd')];this[_0xa197('0xe')]=_0x42a3c1['countabandonedretry'];this[_0xa197('0xf')]=_0x42a3c1[_0xa197('0xf')];this[_0xa197('0x10')]=_0x42a3c1[_0xa197('0x10')];this['uniqueid']=_0x4acc78[_0xa197('0x11')];this['calleridname']=_0x42a3c1['name'];this['calleridnum']=_0x42a3c1[_0xa197('0x12')];this[_0xa197('0x13')]=_0x42a3c1['starttime'];this[_0xa197('0x14')]=_0x42a3c1['responsetime'];this['droptime']=_0x42a3c1[_0xa197('0x15')];this[_0xa197('0x16')]=this[_0xa197('0x15')];this[_0xa197('0x17')]=getSeconds(_0x42a3c1[_0xa197('0x14')],_0x42a3c1['starttime']);this[_0xa197('0x18')]=getSeconds(this['droptime'],_0x42a3c1[_0xa197('0x14')]);this[_0xa197('0x19')]=0x0;this[_0xa197('0x1a')]=_0x4acc78[_0xa197('0x1a')];this[_0xa197('0x1b')]=_0x4acc78[_0xa197('0x1c')];this[_0xa197('0x1d')]=_0x4acc78[_0xa197('0x1d')];this['callback']=_0x42a3c1['callback'];this[_0xa197('0x1e')]=_0x42a3c1['callbackuniqueid'];this[_0xa197('0x1f')]=_0x42a3c1[_0xa197('0x1f')];this[_0xa197('0x20')]=_0x42a3c1['recallme'];this[_0xa197('0x21')]=_0x42a3c1[_0xa197('0x21')];this[_0xa197('0x22')]=_0x42a3c1[_0xa197('0x22')];this['UserId']=_0x42a3c1[_0xa197('0x23')];this[_0xa197('0x24')]=_0x42a3c1[_0xa197('0x24')];this[_0xa197('0x25')]=_0x42a3c1['CampaignId'];this[_0xa197('0x26')]=_0x42a3c1[_0xa197('0x26')]||'';this[_0xa197('0x27')]=_0x42a3c1[_0xa197('0x27')]||'';}module[_0xa197('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x9aac=['membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime'];(function(_0xf00faf,_0x10e89c){var _0x7290b2=function(_0x26045c){while(--_0x26045c){_0xf00faf['push'](_0xf00faf['shift']());}};_0x7290b2(++_0x10e89c);}(_0x9aac,0x135));var _0xc9aa=function(_0x466275,_0x1d3463){_0x466275=_0x466275-0x0;var _0x3901fb=_0x9aac[_0x466275];return _0x3901fb;};'use strict';var util=require(_0xc9aa('0x0'));var _=require('lodash');var moment=require(_0xc9aa('0x1'));function getSeconds(_0x3c763d,_0x57da2f){var _0xaee75d=moment(_0x3c763d)['milliseconds'](0x0);var _0x8ca086=moment(_0x57da2f)['milliseconds'](0x0);return _0xaee75d[_0xc9aa('0x2')](_0x8ca086,_0xc9aa('0x3'));}function QueueCallerAbandon(_0x529d1c,_0x280687){this[_0xc9aa('0x4')]=_0x529d1c[_0xc9aa('0x4')];this['type']=_0x529d1c[_0xc9aa('0x5')];this[_0xc9aa('0x6')]=_0x529d1c[_0xc9aa('0x5')]==='outbound'?_0xc9aa('0x7'):_0x529d1c[_0xc9aa('0x5')];this[_0xc9aa('0x8')]=_0x529d1c['countbusyretry'];this['countcongestionretry']=_0x529d1c[_0xc9aa('0x9')];this['countnoanswerretry']=_0x529d1c[_0xc9aa('0xa')];this[_0xc9aa('0xb')]=_0x529d1c[_0xc9aa('0x8')]+_0x529d1c[_0xc9aa('0x9')]+_0x529d1c[_0xc9aa('0xa')]+_0x529d1c[_0xc9aa('0xc')]+_0x529d1c[_0xc9aa('0xd')]+_0x529d1c[_0xc9aa('0xe')]+_0x529d1c[_0xc9aa('0xf')]+_0x529d1c[_0xc9aa('0x10')];this[_0xc9aa('0xc')]=_0x529d1c[_0xc9aa('0xc')];this[_0xc9aa('0xd')]=_0x529d1c[_0xc9aa('0xd')];this[_0xc9aa('0xe')]=_0x529d1c[_0xc9aa('0xe')];this[_0xc9aa('0xf')]=_0x529d1c['countmachineretry'];this[_0xc9aa('0x10')]=_0x529d1c['countagentrejectretry'];this['uniqueid']=_0x280687[_0xc9aa('0x11')];this[_0xc9aa('0x12')]=_0x529d1c[_0xc9aa('0x13')];this[_0xc9aa('0x14')]=_0x529d1c['number'];this[_0xc9aa('0x15')]=_0x529d1c[_0xc9aa('0x15')];this[_0xc9aa('0x16')]=_0x529d1c['responsetime'];this[_0xc9aa('0x17')]=_0x529d1c[_0xc9aa('0x17')];this[_0xc9aa('0x18')]=this[_0xc9aa('0x17')];this[_0xc9aa('0x19')]=getSeconds(_0x529d1c[_0xc9aa('0x16')],_0x529d1c['starttime']);this[_0xc9aa('0x1a')]=getSeconds(this['droptime'],_0x529d1c[_0xc9aa('0x16')]);this['talktime']=0x0;this[_0xc9aa('0x7')]=_0x280687['queue'];this[_0xc9aa('0x1b')]=_0x280687[_0xc9aa('0x1c')];this[_0xc9aa('0x1d')]=_0x280687[_0xc9aa('0x1d')];this['callback']=_0x529d1c[_0xc9aa('0x1e')];this[_0xc9aa('0x1f')]=_0x529d1c[_0xc9aa('0x1f')];this[_0xc9aa('0x20')]=_0x529d1c[_0xc9aa('0x20')];this['recallme']=_0x529d1c[_0xc9aa('0x21')];this[_0xc9aa('0x22')]=_0x529d1c[_0xc9aa('0x22')];this[_0xc9aa('0x23')]=_0x529d1c[_0xc9aa('0x23')];this[_0xc9aa('0x24')]=_0x529d1c[_0xc9aa('0x24')];this['VoiceQueueId']=_0x529d1c[_0xc9aa('0x25')];this[_0xc9aa('0x26')]=_0x529d1c['CampaignId'];this['originatecalleridnum']=_0x529d1c[_0xc9aa('0x27')]||'';this[_0xc9aa('0x28')]=_0x529d1c[_0xc9aa('0x28')]||'';}module[_0xc9aa('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index d917cb4..338ee10 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(_0x43b9d4,_0x89c3e2){var _0x1b7a4a=function(_0x1847c4){while(--_0x1847c4){_0x43b9d4['push'](_0x43b9d4['shift']());}};_0x1b7a4a(++_0x89c3e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function 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(_0x33ef4c,_0xd4290d){var _0x1c036f=function(_0x4b2359){while(--_0x4b2359){_0x33ef4c['push'](_0x33ef4c['shift']());}};_0x1c036f(++_0xd4290d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 6c000ec..4d250ef 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 _0xae60=['../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','actions','variable','value','channelstate','channelstatedesc','operation','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','stringify','merge','response','reason','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','status','reachable','unmonitored','Trunk\x20not\x20working','Empty\x20Fax','Empty\x20path','util','lodash','bluebird','moment','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount'];(function(_0x4a59ed,_0x47bd50){var _0x499f15=function(_0x245462){while(--_0x245462){_0x4a59ed['push'](_0x4a59ed['shift']());}};_0x499f15(++_0x47bd50);}(_0xae60,0x1c7));var _0x0ae6=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xae60[_0x36884e];return _0x1cc367;};'use strict';var util=require(_0x0ae6('0x0'));var _=require(_0x0ae6('0x1'));var BPromise=require(_0x0ae6('0x2'));var uuid=require('uuid');var moment=require(_0x0ae6('0x3'));var path=require(_0x0ae6('0x4'));var tiff2pdf=require(_0x0ae6('0x5'));var gs=require('./util/gs');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var ami=require('../ami');var rpcDb=require(_0x0ae6('0x8'));var Channel=require(_0x0ae6('0x9'));var ut=require(_0x0ae6('0xa'));var Action=require(_0x0ae6('0xb'));var faxAccount=require(_0x0ae6('0xc'));var attachment=require(_0x0ae6('0xd'));var faxMessage=require(_0x0ae6('0xe'));function Fax(_0x1b5e80){this['channels']={};this[_0x0ae6('0xf')]=_0x1b5e80[_0x0ae6('0xf')];this[_0x0ae6('0x10')]=_0x1b5e80[_0x0ae6('0x10')];this['actions']={};ami['on'](_0x0ae6('0x11'),this[_0x0ae6('0x12')][_0x0ae6('0x13')](this));ami['on'](_0x0ae6('0x14'),this[_0x0ae6('0x15')][_0x0ae6('0x13')](this));ami['on'](_0x0ae6('0x16'),this[_0x0ae6('0x17')][_0x0ae6('0x13')](this));ami['on'](_0x0ae6('0x18'),this[_0x0ae6('0x19')][_0x0ae6('0x13')](this));ami['on'](_0x0ae6('0x1a'),this[_0x0ae6('0x1b')]['bind'](this));ami['on'](_0x0ae6('0x1c'),this[_0x0ae6('0x1d')][_0x0ae6('0x13')](this));ami['on'](_0x0ae6('0x1e'),this[_0x0ae6('0x1f')][_0x0ae6('0x13')](this));ami['on'](_0x0ae6('0x20'),this[_0x0ae6('0x21')][_0x0ae6('0x13')](this));}Fax[_0x0ae6('0x22')][_0x0ae6('0x12')]=function(_0x22e8a5){if(_0x22e8a5[_0x0ae6('0x23')]===_0x0ae6('0x24')){for(var _0xda4f01 in this[_0x0ae6('0xf')]){if(this[_0x0ae6('0xf')][_0x0ae6('0x25')](_0xda4f01)){if(_0x22e8a5[_0x0ae6('0x26')]===this[_0x0ae6('0xf')][_0xda4f01][_0x0ae6('0x27')]){this[_0x0ae6('0x28')][_0x22e8a5['uniqueid']]={};this[_0x0ae6('0x28')][_0x22e8a5[_0x0ae6('0x29')]][_0x0ae6('0x2a')]=_0x22e8a5[_0x0ae6('0x2a')];this[_0x0ae6('0x28')][_0x22e8a5[_0x0ae6('0x29')]]['id']=this[_0x0ae6('0xf')][_0xda4f01]['id'];this[_0x0ae6('0x28')][_0x22e8a5['uniqueid']][_0x0ae6('0x2b')]=this[_0x0ae6('0xf')][_0xda4f01][_0x0ae6('0x2b')];logger[_0x0ae6('0x2c')](_0x22e8a5[_0x0ae6('0x29')],'\x20syncNewchannel\x20');}}}}if(this[_0x0ae6('0x2d')][_0x22e8a5[_0x0ae6('0x29')]]){this[_0x0ae6('0x28')][_0x22e8a5[_0x0ae6('0x29')]]={};this[_0x0ae6('0x28')][_0x22e8a5[_0x0ae6('0x29')]]['channel']=_0x22e8a5[_0x0ae6('0x2a')];logger[_0x0ae6('0x2c')](_0x22e8a5['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0x0ae6('0x22')][_0x0ae6('0x15')]=function(_0x17360e){if(this['channels'][_0x17360e[_0x0ae6('0x29')]]){for(var _0xb68cbe in _0x17360e[_0x0ae6('0x2e')]){if(_0x17360e['variable'][_0x0ae6('0x25')](_0xb68cbe)){this[_0x0ae6('0x28')][_0x17360e[_0x0ae6('0x29')]][_0xb68cbe]=_0x17360e[_0x0ae6('0x2f')];}}}};Fax[_0x0ae6('0x22')][_0x0ae6('0x17')]=function(_0x4fc7bd){if(this['channels'][_0x4fc7bd[_0x0ae6('0x29')]]){this[_0x0ae6('0x28')][_0x4fc7bd['uniqueid']]['channelstate']=_0x4fc7bd[_0x0ae6('0x30')];this[_0x0ae6('0x28')][_0x4fc7bd[_0x0ae6('0x29')]][_0x0ae6('0x31')]=_0x4fc7bd['channelstatedesc'];}};Fax[_0x0ae6('0x22')][_0x0ae6('0x19')]=function(_0x2f32df){if(this['channels'][_0x2f32df[_0x0ae6('0x29')]]){for(var _0x42d13f in _0x2f32df[_0x0ae6('0x2e')]){if(_0x2f32df[_0x0ae6('0x2e')][_0x0ae6('0x25')](_0x42d13f)){this[_0x0ae6('0x28')][_0x2f32df[_0x0ae6('0x29')]][_0x42d13f]=_0x2f32df[_0x0ae6('0x2f')];}}}};Fax[_0x0ae6('0x22')][_0x0ae6('0x1b')]=function(_0x4cb7d4){if(this[_0x0ae6('0x28')][_0x4cb7d4[_0x0ae6('0x29')]]){this['channels'][_0x4cb7d4[_0x0ae6('0x29')]][_0x0ae6('0x32')]=_0x4cb7d4[_0x0ae6('0x32')];this['channels'][_0x4cb7d4[_0x0ae6('0x29')]]['status']=_0x4cb7d4['status'];this[_0x0ae6('0x28')][_0x4cb7d4[_0x0ae6('0x29')]][_0x0ae6('0x27')]=_0x4cb7d4[_0x0ae6('0x27')];this[_0x0ae6('0x28')][_0x4cb7d4['uniqueid']]['filename']=_0x4cb7d4[_0x0ae6('0x33')];logger['info'](_0x4cb7d4[_0x0ae6('0x29')],'\x20syncFaxStatus\x20');}};Fax[_0x0ae6('0x22')]['syncReceiveFax']=function(_0x7998e3){var _0x1640e4=this;if(this[_0x0ae6('0x28')][_0x7998e3[_0x0ae6('0x29')]]){var _0x5be17f=this['channels'][_0x7998e3[_0x0ae6('0x29')]]['id'];this[_0x0ae6('0x28')][_0x7998e3[_0x0ae6('0x29')]]['remotestationid']=_0x7998e3[_0x0ae6('0x34')];this['channels'][_0x7998e3[_0x0ae6('0x29')]][_0x0ae6('0x35')]=_0x7998e3[_0x0ae6('0x35')];this[_0x0ae6('0x28')][_0x7998e3[_0x0ae6('0x29')]][_0x0ae6('0x27')]=_0x7998e3['localstationid'];this[_0x0ae6('0x28')][_0x7998e3[_0x0ae6('0x29')]][_0x0ae6('0x36')]=_0x7998e3[_0x0ae6('0x36')];this[_0x0ae6('0x28')][_0x7998e3[_0x0ae6('0x29')]][_0x0ae6('0x37')]=_0x7998e3[_0x0ae6('0x37')];this['channels'][_0x7998e3[_0x0ae6('0x29')]][_0x0ae6('0x33')]=_0x7998e3[_0x0ae6('0x33')];this[_0x0ae6('0x28')][_0x7998e3[_0x0ae6('0x29')]][_0x0ae6('0x38')]=_0x7998e3[_0x0ae6('0x38')];if(this[_0x0ae6('0x28')][_0x7998e3[_0x0ae6('0x29')]][_0x0ae6('0x35')]>0x0){tiff2pdf(_0x7998e3[_0x0ae6('0x33')],_0x0ae6('0x39'),function(_0x22a3f4){logger[_0x0ae6('0x2c')](_0x7998e3[_0x0ae6('0x29')],_0x0ae6('0x3a'),_0x22a3f4[_0x0ae6('0x3b')]);attachment[_0x0ae6('0x3c')]({'name':path['parse'](_0x7998e3[_0x0ae6('0x33')])[_0x0ae6('0x2b')],'basename':path[_0x0ae6('0x3d')](_0x7998e3[_0x0ae6('0x33')])[_0x0ae6('0x2b')]+_0x0ae6('0x3e'),'type':'application/pdf'})[_0x0ae6('0x3f')](function(_0x1af021){faxAccount[_0x0ae6('0x40')](_0x5be17f,{'from':_0x7998e3[_0x0ae6('0x38')],'mapKey':'fax','body':path['parse'](_0x7998e3['filename'])[_0x0ae6('0x2b')]+_0x0ae6('0x3e'),'AttachmentId':_0x1af021['id']})[_0x0ae6('0x41')](function(_0x4ff1de){logger[_0x0ae6('0x42')](_0x7998e3[_0x0ae6('0x29')],'\x20notify\x20',JSON[_0x0ae6('0x43')](_0x4ff1de));});})[_0x0ae6('0x41')](function(_0x4f26e0){logger[_0x0ae6('0x42')](_0x7998e3[_0x0ae6('0x29')],'\x20receiveFax\x20',JSON[_0x0ae6('0x43')](_0x4f26e0));});});}logger[_0x0ae6('0x2c')](_0x7998e3[_0x0ae6('0x29')],'\x20receiveFax\x20');}};Fax[_0x0ae6('0x22')][_0x0ae6('0x21')]=function(_0x46075a){if(this[_0x0ae6('0x2d')][_0x46075a[_0x0ae6('0x29')]]){_[_0x0ae6('0x44')](this[_0x0ae6('0x28')][_0x46075a['uniqueid']],_['pick'](_0x46075a,[_0x0ae6('0x45'),_0x0ae6('0x46')]));}};function updateStatus(_0x1f164f){if(_0x1f164f['AttachmentId']){faxMessage[_0x0ae6('0x47')](_0x1f164f['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x0ae6('0x3f')](function(_0x33a0c4){ut[_0x0ae6('0x48')]('[Fax][Message][Error][Updated]',_0x33a0c4);})[_0x0ae6('0x41')](function(_0x21e5be){ut[_0x0ae6('0x48')](_0x0ae6('0x49'),_0x21e5be);});}else{ut[_0x0ae6('0x48')](_0x0ae6('0x4a'));}}Fax[_0x0ae6('0x22')][_0x0ae6('0x4b')]=function(_0x102573,_0x117d24,_0x1cc515){var _0x64d254=this;var _0x17c71c={};if(_0x117d24){_0x17c71c={'read':_0x117d24};}else{_0x17c71c={'failMessage':_0x1cc515};}if(this[_0x0ae6('0x2d')][_0x102573][_0x0ae6('0x4c')]){faxMessage['update'](this['actions'][_0x102573][_0x0ae6('0x4c')],_0x17c71c)[_0x0ae6('0x3f')](function(_0x29d8bf){ut[_0x0ae6('0x48')](_0x0ae6('0x4d'),_0x29d8bf);})[_0x0ae6('0x41')](function(_0x3fa2ba){ut[_0x0ae6('0x48')](_0x0ae6('0x4e'),_0x3fa2ba);})[_0x0ae6('0x4f')](function(){delete _0x64d254[_0x0ae6('0x28')][_0x102573];delete _0x64d254[_0x0ae6('0x2d')][_0x102573];});}else{ut[_0x0ae6('0x48')](_0x0ae6('0x50'));delete this[_0x0ae6('0x28')][_0x102573];delete this[_0x0ae6('0x2d')][_0x102573];}};Fax[_0x0ae6('0x22')][_0x0ae6('0x1f')]=function(_0x481784){var _0x26d313=this;if(this[_0x0ae6('0x28')][_0x481784[_0x0ae6('0x29')]]){if(this[_0x0ae6('0x2d')][_0x481784[_0x0ae6('0x29')]]){this[_0x0ae6('0x28')][_0x481784[_0x0ae6('0x29')]]['id']=this[_0x0ae6('0x2d')][_0x481784[_0x0ae6('0x29')]]['id'];this[_0x0ae6('0x28')][_0x481784['uniqueid']][_0x0ae6('0x2b')]=this[_0x0ae6('0x2d')][_0x481784[_0x0ae6('0x29')]][_0x0ae6('0x2b')];}logger[_0x0ae6('0x2c')](_0x481784[_0x0ae6('0x29')],this[_0x0ae6('0x2d')][_0x481784[_0x0ae6('0x29')]]?_0x0ae6('0x51'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x0ae6('0x28')][_0x481784[_0x0ae6('0x29')]]));if(this['actions'][_0x481784['uniqueid']]){if(this[_0x0ae6('0x28')][_0x481784[_0x0ae6('0x29')]][_0x0ae6('0x52')]>0x0&&this[_0x0ae6('0x28')][_0x481784[_0x0ae6('0x29')]][_0x0ae6('0x1a')]===_0x0ae6('0x53')){this['updateStatus'](_0x481784[_0x0ae6('0x29')],!![]);}else{this['updateStatus'](_0x481784[_0x0ae6('0x29')],![],this[_0x0ae6('0x28')][_0x481784['uniqueid']][_0x0ae6('0x54')]?_0x0ae6('0x55')+this[_0x0ae6('0x28')][_0x481784['uniqueid']][_0x0ae6('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0x0ae6('0x22')][_0x0ae6('0x56')]=function(_0x19f63f){var _0x12c43d=this;return new BPromise(function(_0x54fff7,_0x4d74f7){_0x12c43d[_0x0ae6('0x57')](_0x19f63f,_0x12c43d[_0x0ae6('0xf')][_0x19f63f[_0x0ae6('0x58')]])[_0x0ae6('0x3f')](function(_0x13a742){ut[_0x0ae6('0x48')]('[Fax][execOriginate][success]',_0x13a742);_0x54fff7(ut['message'](_0x0ae6('0x59')));})[_0x0ae6('0x41')](function(_0x39846c){ut[_0x0ae6('0x48')](_0x0ae6('0x5a'),_0x39846c);updateStatus(_0x19f63f);_0x4d74f7(ut[_0x0ae6('0x3b')](_0x0ae6('0x5b')));});});};Fax[_0x0ae6('0x22')]['checkAfterSend']=function(_0x40eba7){var _0x45adc9=this;return new BPromise(function(_0x1c98bb,_0x7e222c){var _0x361b4a=_0x45adc9[_0x0ae6('0x5c')](_0x45adc9['faxAccounts'][_0x40eba7['FaxAccountId']][_0x0ae6('0x5d')],_0x40eba7);if(_0x361b4a[_0x0ae6('0x5e')]){_0x1c98bb(ut['message'](_0x0ae6('0x5f')));}else{_0x7e222c(ut[_0x0ae6('0x3b')](_0x361b4a[_0x0ae6('0x3b')]));}});};function originate(_0x37ad9b,_0x5cd03b,_0x2d9ec4){return new BPromise(function(_0x243e86,_0x42470){if(_0x2d9ec4){var _0x253c17=util[_0x0ae6('0x60')](_0x0ae6('0x61'),path[_0x0ae6('0x3d')](_0x37ad9b[_0x0ae6('0x4')])['name'],_0x37ad9b[_0x0ae6('0x4')]);gs[_0x0ae6('0x62')](_0x253c17)[_0x0ae6('0x3f')](function(){_0x37ad9b[_0x0ae6('0x4')]=util[_0x0ae6('0x60')](_0x0ae6('0x63'),path[_0x0ae6('0x3d')](_0x37ad9b[_0x0ae6('0x4')])[_0x0ae6('0x64')],path[_0x0ae6('0x3d')](_0x37ad9b[_0x0ae6('0x4')])[_0x0ae6('0x2b')]);_0x5cd03b[_0x0ae6('0x65')]=_0x37ad9b[_0x0ae6('0x4')];ut[_0x0ae6('0x48')](_0x0ae6('0x66'),'');ami[_0x0ae6('0x67')](ut[_0x0ae6('0x68')](_0x37ad9b,_0x5cd03b))[_0x0ae6('0x3f')](function(_0x1a114d){_0x243e86(_0x1a114d);})[_0x0ae6('0x41')](function(_0x5c8d9d){_0x42470(_0x5c8d9d);});})[_0x0ae6('0x41')](function(_0x3518f5){_0x42470(_0x3518f5);});}else{ami[_0x0ae6('0x67')](ut[_0x0ae6('0x68')](_0x37ad9b,_0x5cd03b))['then'](function(_0xe8fabd){_0x243e86(_0xe8fabd);})[_0x0ae6('0x41')](function(_0xf1c98f){_0x42470(_0xf1c98f);});}});}Fax[_0x0ae6('0x22')][_0x0ae6('0x57')]=function(_0xf673a8,_0x4827d0){var _0x93493e=this;return new BPromise(function(_0x5750f0,_0x21b970){var _0x2273fa=uuid['v4']();var _0x368a48=ut[_0x0ae6('0x69')](_0xf673a8,_0x4827d0);_0x93493e[_0x0ae6('0x2d')][_0x2273fa]=new Action(_0x2273fa,_0x4827d0,_0xf673a8);var _0x15003f=_0x93493e[_0x0ae6('0x2d')][_0x2273fa];if(path['parse'](_0xf673a8['path'])[_0x0ae6('0x6a')]===_0x0ae6('0x3e')){originate(_0x15003f,_0x368a48,!![])[_0x0ae6('0x3f')](function(_0x104625){_0x5750f0(_0x104625);})['catch'](function(_0x502af0){_0x21b970(_0x502af0);});}else{originate(_0x15003f,_0x368a48,![])[_0x0ae6('0x3f')](function(_0x4bf489){_0x5750f0(_0x4bf489);})[_0x0ae6('0x41')](function(_0x3c764b){_0x21b970(_0x3c764b);});}});};Fax[_0x0ae6('0x22')][_0x0ae6('0x6b')]=function(_0x154d75){return!_[_0x0ae6('0x6c')](_0x154d75)&&!_['isNil'](_0x154d75['name'])&&!_['isNil'](_0x154d75[_0x0ae6('0x6d')])&&_0x154d75['active']&&!_['isNil'](this['trunks'][util['format'](_0x0ae6('0x6e'),_0x154d75['name'])])&&!_[_0x0ae6('0x6c')](this['trunks'][util[_0x0ae6('0x60')](_0x0ae6('0x6e'),_0x154d75[_0x0ae6('0x2b')])][_0x0ae6('0x6f')])&&(this[_0x0ae6('0x10')][util['format'](_0x0ae6('0x6e'),_0x154d75[_0x0ae6('0x2b')])][_0x0ae6('0x6f')]===_0x0ae6('0x70')||this[_0x0ae6('0x10')][util[_0x0ae6('0x60')](_0x0ae6('0x6e'),_0x154d75['name'])][_0x0ae6('0x6f')]===_0x0ae6('0x71'));};Fax[_0x0ae6('0x22')][_0x0ae6('0x5c')]=function(_0x460d90,_0x16115e){if(!this['isTrunkReachable'](_0x460d90)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x0ae6('0x6c')](_0x460d90)?'':_0x460d90[_0x0ae6('0x2b')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x0ae6('0x72')};}if(_[_0x0ae6('0x6c')](_0x16115e[_0x0ae6('0x7')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x0ae6('0x43')](_0x16115e));return{'isValid':![],'message':_0x0ae6('0x73')};}if(_['isNil'](_0x16115e['path'])){ut[_0x0ae6('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x16115e));return{'isValid':![],'message':_0x0ae6('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x7334=['SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','checkTrunk','FaxAccountId','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','exports','util','lodash','bluebird','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','bind','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','prototype','syncVarSet','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','updateStatus','faxstatusstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7334,0x184));var _0x4733=function(_0x26f06e,_0x5e440f){_0x26f06e=_0x26f06e-0x0;var _0x128477=_0x7334[_0x26f06e];return _0x128477;};'use strict';var util=require(_0x4733('0x0'));var _=require(_0x4733('0x1'));var BPromise=require(_0x4733('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x4733('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var ami=require(_0x4733('0x7'));var rpcDb=require(_0x4733('0x8'));var Channel=require(_0x4733('0x9'));var ut=require(_0x4733('0xa'));var Action=require(_0x4733('0xb'));var faxAccount=require(_0x4733('0xc'));var attachment=require(_0x4733('0xd'));var faxMessage=require(_0x4733('0xe'));function Fax(_0x3562b7){this[_0x4733('0xf')]={};this[_0x4733('0x10')]=_0x3562b7[_0x4733('0x10')];this[_0x4733('0x11')]=_0x3562b7[_0x4733('0x11')];this['actions']={};ami['on'](_0x4733('0x12'),this[_0x4733('0x13')]['bind'](this));ami['on'](_0x4733('0x14'),this['syncVarSet'][_0x4733('0x15')](this));ami['on'](_0x4733('0x16'),this[_0x4733('0x17')][_0x4733('0x15')](this));ami['on'](_0x4733('0x18'),this[_0x4733('0x19')][_0x4733('0x15')](this));ami['on']('faxstatus',this[_0x4733('0x1a')]['bind'](this));ami['on'](_0x4733('0x1b'),this[_0x4733('0x1c')][_0x4733('0x15')](this));ami['on'](_0x4733('0x1d'),this[_0x4733('0x1e')][_0x4733('0x15')](this));ami['on'](_0x4733('0x1f'),this[_0x4733('0x20')][_0x4733('0x15')](this));}Fax['prototype'][_0x4733('0x13')]=function(_0x71e96c){if(_0x71e96c['context']===_0x4733('0x21')){for(var _0x1d2fb6 in this[_0x4733('0x10')]){if(this[_0x4733('0x10')]['hasOwnProperty'](_0x1d2fb6)){if(_0x71e96c['exten']===this[_0x4733('0x10')][_0x1d2fb6][_0x4733('0x22')]){this['channels'][_0x71e96c[_0x4733('0x23')]]={};this[_0x4733('0xf')][_0x71e96c[_0x4733('0x23')]][_0x4733('0x24')]=_0x71e96c['channel'];this[_0x4733('0xf')][_0x71e96c[_0x4733('0x23')]]['id']=this['faxAccounts'][_0x1d2fb6]['id'];this[_0x4733('0xf')][_0x71e96c[_0x4733('0x23')]]['name']=this[_0x4733('0x10')][_0x1d2fb6][_0x4733('0x25')];logger[_0x4733('0x26')](_0x71e96c[_0x4733('0x23')],_0x4733('0x27'));}}}}if(this[_0x4733('0x28')][_0x71e96c[_0x4733('0x23')]]){this[_0x4733('0xf')][_0x71e96c['uniqueid']]={};this[_0x4733('0xf')][_0x71e96c[_0x4733('0x23')]][_0x4733('0x24')]=_0x71e96c[_0x4733('0x24')];logger[_0x4733('0x26')](_0x71e96c[_0x4733('0x23')],_0x4733('0x27'));}};Fax[_0x4733('0x29')][_0x4733('0x2a')]=function(_0x23fe6c){if(this['channels'][_0x23fe6c[_0x4733('0x23')]]){for(var _0x4c91bc in _0x23fe6c['variable']){if(_0x23fe6c[_0x4733('0x2b')]['hasOwnProperty'](_0x4c91bc)){this[_0x4733('0xf')][_0x23fe6c['uniqueid']][_0x4c91bc]=_0x23fe6c['value'];}}}};Fax['prototype'][_0x4733('0x17')]=function(_0x3bfe53){if(this[_0x4733('0xf')][_0x3bfe53[_0x4733('0x23')]]){this['channels'][_0x3bfe53['uniqueid']]['channelstate']=_0x3bfe53[_0x4733('0x2c')];this['channels'][_0x3bfe53['uniqueid']][_0x4733('0x2d')]=_0x3bfe53[_0x4733('0x2d')];}};Fax[_0x4733('0x29')]['syncNewExten']=function(_0x523c61){if(this[_0x4733('0xf')][_0x523c61[_0x4733('0x23')]]){for(var _0x22d38a in _0x523c61[_0x4733('0x2b')]){if(_0x523c61[_0x4733('0x2b')]['hasOwnProperty'](_0x22d38a)){this[_0x4733('0xf')][_0x523c61[_0x4733('0x23')]][_0x22d38a]=_0x523c61[_0x4733('0x2e')];}}}};Fax[_0x4733('0x29')][_0x4733('0x1a')]=function(_0x4b133f){if(this['channels'][_0x4b133f[_0x4733('0x23')]]){this[_0x4733('0xf')][_0x4b133f[_0x4733('0x23')]][_0x4733('0x2f')]=_0x4b133f[_0x4733('0x2f')];this['channels'][_0x4b133f[_0x4733('0x23')]][_0x4733('0x30')]=_0x4b133f[_0x4733('0x30')];this['channels'][_0x4b133f[_0x4733('0x23')]][_0x4733('0x22')]=_0x4b133f[_0x4733('0x22')];this[_0x4733('0xf')][_0x4b133f[_0x4733('0x23')]][_0x4733('0x31')]=_0x4b133f[_0x4733('0x31')];logger[_0x4733('0x26')](_0x4b133f['uniqueid'],_0x4733('0x32'));}};Fax['prototype'][_0x4733('0x1c')]=function(_0x29db03){var _0x381fa8=this;if(this[_0x4733('0xf')][_0x29db03[_0x4733('0x23')]]){var _0x1a8b50=this[_0x4733('0xf')][_0x29db03[_0x4733('0x23')]]['id'];this['channels'][_0x29db03[_0x4733('0x23')]][_0x4733('0x33')]=_0x29db03['remotestationid'];this[_0x4733('0xf')][_0x29db03[_0x4733('0x23')]]['pagestransferred']=_0x29db03[_0x4733('0x34')];this['channels'][_0x29db03[_0x4733('0x23')]]['localstationid']=_0x29db03[_0x4733('0x22')];this[_0x4733('0xf')][_0x29db03['uniqueid']]['resolution']=_0x29db03[_0x4733('0x35')];this[_0x4733('0xf')][_0x29db03['uniqueid']][_0x4733('0x36')]=_0x29db03[_0x4733('0x36')];this[_0x4733('0xf')][_0x29db03[_0x4733('0x23')]][_0x4733('0x31')]=_0x29db03[_0x4733('0x31')];this[_0x4733('0xf')][_0x29db03[_0x4733('0x23')]][_0x4733('0x37')]=_0x29db03[_0x4733('0x37')];if(this[_0x4733('0xf')][_0x29db03[_0x4733('0x23')]][_0x4733('0x34')]>0x0){tiff2pdf(_0x29db03[_0x4733('0x31')],_0x4733('0x38'),function(_0x540cb8){logger[_0x4733('0x26')](_0x29db03[_0x4733('0x23')],'\x20result\x20conversion\x20file\x20',_0x540cb8[_0x4733('0x39')]);attachment[_0x4733('0x3a')]({'name':path[_0x4733('0x3b')](_0x29db03[_0x4733('0x31')])[_0x4733('0x25')],'basename':path[_0x4733('0x3b')](_0x29db03[_0x4733('0x31')])[_0x4733('0x25')]+_0x4733('0x3c'),'type':_0x4733('0x3d')})[_0x4733('0x3e')](function(_0x1a50f5){faxAccount[_0x4733('0x3f')](_0x1a8b50,{'from':_0x29db03[_0x4733('0x37')],'mapKey':'fax','body':path['parse'](_0x29db03[_0x4733('0x31')])[_0x4733('0x25')]+_0x4733('0x3c'),'AttachmentId':_0x1a50f5['id']})[_0x4733('0x40')](function(_0x81a314){logger[_0x4733('0x41')](_0x29db03[_0x4733('0x23')],_0x4733('0x42'),JSON[_0x4733('0x43')](_0x81a314));});})[_0x4733('0x40')](function(_0x4d8301){logger['error'](_0x29db03['uniqueid'],'\x20receiveFax\x20',JSON[_0x4733('0x43')](_0x4d8301));});});}logger[_0x4733('0x26')](_0x29db03[_0x4733('0x23')],_0x4733('0x44'));}};Fax[_0x4733('0x29')][_0x4733('0x20')]=function(_0x1c6abf){if(this[_0x4733('0x28')][_0x1c6abf[_0x4733('0x23')]]){_[_0x4733('0x45')](this['channels'][_0x1c6abf['uniqueid']],_[_0x4733('0x46')](_0x1c6abf,['response',_0x4733('0x47')]));}};function updateStatus(_0x17e686){if(_0x17e686[_0x4733('0x48')]){faxMessage['update'](_0x17e686[_0x4733('0x48')],{'failMessage':_0x4733('0x49')})[_0x4733('0x3e')](function(_0x114464){ut[_0x4733('0x4a')](_0x4733('0x4b'),_0x114464);})[_0x4733('0x40')](function(_0x2da475){ut[_0x4733('0x4a')]('[Fax][Message][Error][NoUpdate1]',_0x2da475);});}else{ut[_0x4733('0x4a')](_0x4733('0x4c'));}}Fax[_0x4733('0x29')]['updateStatus']=function(_0x2effd2,_0x130aee,_0xafb3f8){var _0x4a7fa=this;var _0x59344b={};if(_0x130aee){_0x59344b={'read':_0x130aee};}else{_0x59344b={'failMessage':_0xafb3f8};}if(this[_0x4733('0x28')][_0x2effd2]['AttachmentId']){faxMessage[_0x4733('0x4d')](this[_0x4733('0x28')][_0x2effd2][_0x4733('0x48')],_0x59344b)[_0x4733('0x3e')](function(_0x53321d){ut['logger'](_0x4733('0x4e'),_0x53321d);})[_0x4733('0x40')](function(_0x5e4668){ut['logger'](_0x4733('0x4f'),_0x5e4668);})[_0x4733('0x50')](function(){delete _0x4a7fa[_0x4733('0xf')][_0x2effd2];delete _0x4a7fa[_0x4733('0x28')][_0x2effd2];});}else{ut[_0x4733('0x4a')](_0x4733('0x51'));delete this[_0x4733('0xf')][_0x2effd2];delete this[_0x4733('0x28')][_0x2effd2];}};Fax['prototype']['syncHangup']=function(_0x3b7f06){var _0x5d45c5=this;if(this[_0x4733('0xf')][_0x3b7f06[_0x4733('0x23')]]){if(this[_0x4733('0x28')][_0x3b7f06['uniqueid']]){this['channels'][_0x3b7f06['uniqueid']]['id']=this[_0x4733('0x28')][_0x3b7f06[_0x4733('0x23')]]['id'];this[_0x4733('0xf')][_0x3b7f06['uniqueid']][_0x4733('0x25')]=this[_0x4733('0x28')][_0x3b7f06[_0x4733('0x23')]][_0x4733('0x25')];}logger[_0x4733('0x26')](_0x3b7f06[_0x4733('0x23')],this[_0x4733('0x28')][_0x3b7f06['uniqueid']]?_0x4733('0x52'):_0x4733('0x53'),JSON['stringify'](this['channels'][_0x3b7f06[_0x4733('0x23')]]));if(this[_0x4733('0x28')][_0x3b7f06[_0x4733('0x23')]]){if(this[_0x4733('0xf')][_0x3b7f06[_0x4733('0x23')]][_0x4733('0x54')]>0x0&&this[_0x4733('0xf')][_0x3b7f06[_0x4733('0x23')]][_0x4733('0x55')]==='SUCCESS'){this[_0x4733('0x56')](_0x3b7f06[_0x4733('0x23')],!![]);}else{this[_0x4733('0x56')](_0x3b7f06['uniqueid'],![],this[_0x4733('0xf')][_0x3b7f06['uniqueid']][_0x4733('0x57')]?_0x4733('0x58')+this[_0x4733('0xf')][_0x3b7f06[_0x4733('0x23')]][_0x4733('0x57')]:_0x4733('0x59'));}}}};Fax['prototype'][_0x4733('0x5a')]=function(_0x574787){var _0x15552d=this;return new BPromise(function(_0x12997e,_0x54326d){_0x15552d[_0x4733('0x5b')](_0x574787,_0x15552d['faxAccounts'][_0x574787['FaxAccountId']])[_0x4733('0x3e')](function(_0x28a04f){ut[_0x4733('0x4a')](_0x4733('0x5c'),_0x28a04f);_0x12997e(ut[_0x4733('0x39')](_0x4733('0x5d')));})[_0x4733('0x40')](function(_0x181b34){ut[_0x4733('0x4a')]('[Fax][execOriginate][failure]',_0x181b34);updateStatus(_0x574787);_0x54326d(ut['message']('Fax\x20failed'));});});};Fax[_0x4733('0x29')][_0x4733('0x5e')]=function(_0x24f51d){var _0xa087d9=this;return new BPromise(function(_0x520936,_0x2c224d){var _0x1a743e=_0xa087d9[_0x4733('0x5f')](_0xa087d9['faxAccounts'][_0x24f51d[_0x4733('0x60')]]['Trunk'],_0x24f51d);if(_0x1a743e[_0x4733('0x61')]){_0x520936(ut['message']('Trunk\x20Reachable'));}else{_0x2c224d(ut[_0x4733('0x39')](_0x1a743e['message']));}});};function originate(_0x20f867,_0x523498,_0x4e835b){return new BPromise(function(_0x1a7baf,_0x5c6083){if(_0x4e835b){var _0x54bf73=util[_0x4733('0x62')](_0x4733('0x63'),path[_0x4733('0x3b')](_0x20f867['path'])[_0x4733('0x25')],_0x20f867[_0x4733('0x3')]);gs[_0x4733('0x64')](_0x54bf73)[_0x4733('0x3e')](function(){_0x20f867[_0x4733('0x3')]=util[_0x4733('0x62')]('%s/%s.tif',path[_0x4733('0x3b')](_0x20f867[_0x4733('0x3')])[_0x4733('0x65')],path['parse'](_0x20f867[_0x4733('0x3')])[_0x4733('0x25')]);_0x523498[_0x4733('0x66')]=_0x20f867[_0x4733('0x3')];ut[_0x4733('0x4a')](_0x4733('0x67'),'');ami[_0x4733('0x68')](ut[_0x4733('0x69')](_0x20f867,_0x523498))['then'](function(_0x583e6d){_0x1a7baf(_0x583e6d);})[_0x4733('0x40')](function(_0x4fac10){_0x5c6083(_0x4fac10);});})['catch'](function(_0x1f52ff){_0x5c6083(_0x1f52ff);});}else{ami[_0x4733('0x68')](ut[_0x4733('0x69')](_0x20f867,_0x523498))[_0x4733('0x3e')](function(_0x4830b4){_0x1a7baf(_0x4830b4);})[_0x4733('0x40')](function(_0x55450a){_0x5c6083(_0x55450a);});}});}Fax[_0x4733('0x29')]['execOriginate']=function(_0x542397,_0x129cc2){var _0x567faa=this;return new BPromise(function(_0x487408,_0x58d5ba){var _0x416e3f=uuid['v4']();var _0x4b172b=ut[_0x4733('0x6a')](_0x542397,_0x129cc2);_0x567faa[_0x4733('0x28')][_0x416e3f]=new Action(_0x416e3f,_0x129cc2,_0x542397);var _0x59cc5b=_0x567faa[_0x4733('0x28')][_0x416e3f];if(path['parse'](_0x542397['path'])[_0x4733('0x6b')]===_0x4733('0x3c')){originate(_0x59cc5b,_0x4b172b,!![])[_0x4733('0x3e')](function(_0x5a067b){_0x487408(_0x5a067b);})['catch'](function(_0x6179db){_0x58d5ba(_0x6179db);});}else{originate(_0x59cc5b,_0x4b172b,![])['then'](function(_0x3fd347){_0x487408(_0x3fd347);})[_0x4733('0x40')](function(_0x1e9f9a){_0x58d5ba(_0x1e9f9a);});}});};Fax[_0x4733('0x29')][_0x4733('0x6c')]=function(_0x27494c){return!_['isNil'](_0x27494c)&&!_[_0x4733('0x6d')](_0x27494c[_0x4733('0x25')])&&!_[_0x4733('0x6d')](_0x27494c[_0x4733('0x6e')])&&_0x27494c['active']&&!_['isNil'](this[_0x4733('0x11')][util['format'](_0x4733('0x6f'),_0x27494c[_0x4733('0x25')])])&&!_[_0x4733('0x6d')](this[_0x4733('0x11')][util[_0x4733('0x62')](_0x4733('0x6f'),_0x27494c[_0x4733('0x25')])]['status'])&&(this[_0x4733('0x11')][util[_0x4733('0x62')]('SIP/%s',_0x27494c['name'])][_0x4733('0x30')]==='reachable'||this[_0x4733('0x11')][util['format']('SIP/%s',_0x27494c[_0x4733('0x25')])][_0x4733('0x30')]===_0x4733('0x70'));};Fax[_0x4733('0x29')][_0x4733('0x5f')]=function(_0x56729d,_0x3a68d7){if(!this[_0x4733('0x6c')](_0x56729d)){ut[_0x4733('0x4a')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x56729d)?'':_0x56729d['name']+_0x4733('0x71'));return{'isValid':![],'message':_0x4733('0x72')};}if(_[_0x4733('0x6d')](_0x3a68d7[_0x4733('0x6')])){ut[_0x4733('0x4a')](_0x4733('0x73'),JSON['stringify'](_0x3a68d7));return{'isValid':![],'message':_0x4733('0x74')};}if(_[_0x4733('0x6d')](_0x3a68d7[_0x4733('0x3')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x3a68d7));return{'isValid':![],'message':_0x4733('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x4733('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 96a1c39..2317b69 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 _0xf35b=['util','../../../config/logger','preview','lodash','inspect','notify','resolve','then','catch'];(function(_0x17c98b,_0x520370){var _0x153891=function(_0x370425){while(--_0x370425){_0x17c98b['push'](_0x17c98b['shift']());}};_0x153891(++_0x520370);}(_0xf35b,0x129));var _0xbf35=function(_0x540de4,_0x2aefad){_0x540de4=_0x540de4-0x0;var _0x55ccdf=_0xf35b[_0x540de4];return _0x55ccdf;};'use strict';var util=require(_0xbf35('0x0'));var BPromise=require('bluebird');var logger=require(_0xbf35('0x1'))(_0xbf35('0x2'));var _=require(_0xbf35('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x32c2fb){return function(_0x134e36){logger['error'](_0x32c2fb,util[_0xbf35('0x4')](_0x134e36,{'showHidden':![],'depth':null}));};}exports[_0xbf35('0x5')]=function(_0x28a606,_0x4cd3f9){return BPromise[_0xbf35('0x6')]()[_0xbf35('0x7')](faxAccount[_0xbf35('0x5')](_0x28a606,_0x4cd3f9))[_0xbf35('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xa153=['notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','resolve','then'];(function(_0x79d0c9,_0x31f3ee){var _0x268e4d=function(_0x4bdcb3){while(--_0x4bdcb3){_0x79d0c9['push'](_0x79d0c9['shift']());}};_0x268e4d(++_0x31f3ee);}(_0xa153,0xc9));var _0x3a15=function(_0x58405e,_0x58748c){_0x58405e=_0x58405e-0x0;var _0x555d67=_0xa153[_0x58405e];return _0x555d67;};'use strict';var util=require(_0x3a15('0x0'));var BPromise=require(_0x3a15('0x1'));var logger=require(_0x3a15('0x2'))(_0x3a15('0x3'));var _=require('lodash');var faxAccount=require(_0x3a15('0x4'));function loggerCatch(_0x2f8e33){return function(_0x4b55cb){logger[_0x3a15('0x5')](_0x2f8e33,util['inspect'](_0x4b55cb,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x3d0b61,_0x1da350){return BPromise[_0x3a15('0x6')]()[_0x3a15('0x7')](faxAccount[_0x3a15('0x8')](_0x3d0b61,_0x1da350))[_0x3a15('0x9')](loggerCatch(_0x3a15('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index d670107..e6e9c00 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 _0x9ca5=['util','fax','bluebird','child_process','execute','Exec\x20gs','info','\x20Error\x20:','inspect'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9ca5,0x75));var _0x59ca=function(_0x45a945,_0x2e8b66){_0x45a945=_0x45a945-0x0;var _0x403af5=_0x9ca5[_0x45a945];return _0x403af5;};'use strict';var util=require(_0x59ca('0x0'));var logger=require('../../../../config/logger')(_0x59ca('0x1'));var BPromise=require(_0x59ca('0x2'));var exec=require(_0x59ca('0x3'))['exec'];exports[_0x59ca('0x4')]=function(_0x1416fc){return new BPromise(function(_0x4363ea,_0x476e6c){exec(_0x1416fc,function(_0x1084d0,_0x481500,_0x29cded){logger['info'](_0x59ca('0x5'),_0x481500);if(_0x1084d0){logger[_0x59ca('0x6')](_0x59ca('0x5'),_0x59ca('0x7'),util[_0x59ca('0x8')](_0x1084d0,{'showHidden':![],'depth':null}),_0x481500,_0x29cded);_0x476e6c(_0x1084d0);}_0x4363ea(_0x481500);});});}; \ No newline at end of file +var _0x5867=['inspect','util','../../../../config/logger','fax','child_process','execute','info','Exec\x20gs'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x5867,0x1e1));var _0x7586=function(_0x12546e,_0x49a072){_0x12546e=_0x12546e-0x0;var _0x5173d9=_0x5867[_0x12546e];return _0x5173d9;};'use strict';var util=require(_0x7586('0x0'));var logger=require(_0x7586('0x1'))(_0x7586('0x2'));var BPromise=require('bluebird');var exec=require(_0x7586('0x3'))['exec'];exports[_0x7586('0x4')]=function(_0x3b05d3){return new BPromise(function(_0x444e71,_0x15f69c){exec(_0x3b05d3,function(_0x552b59,_0x4bda27,_0x24a343){logger[_0x7586('0x5')]('Exec\x20gs',_0x4bda27);if(_0x552b59){logger[_0x7586('0x5')](_0x7586('0x6'),'\x20Error\x20:',util[_0x7586('0x7')](_0x552b59,{'showHidden':![],'depth':null}),_0x4bda27,_0x24a343);_0x15f69c(_0x552b59);}_0x444e71(_0x4bda27);});});}; \ 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 e440e0c..ab83bd9 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 _0xdd91=['moment','../../../../config/logger','fax','logger','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','localstationid','path','variablesAction','uniqueid','originate','channel','headerinfo'];(function(_0x1d5e54,_0x5115e6){var _0x420d64=function(_0x14c1dc){while(--_0x14c1dc){_0x1d5e54['push'](_0x1d5e54['shift']());}};_0x420d64(++_0x5115e6);}(_0xdd91,0x168));var _0x1dd9=function(_0x590ecf,_0x341182){_0x590ecf=_0x590ecf-0x0;var _0x34754c=_0xdd91[_0x590ecf];return _0x34754c;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x1dd9('0x0'));var logger=require(_0x1dd9('0x1'))(_0x1dd9('0x2'));exports['message']=function(_0x3254da){return{'message':_0x3254da};};exports[_0x1dd9('0x3')]=function(_0x2e29bd,_0x1787e3){logger['info'](_0x2e29bd,util[_0x1dd9('0x4')](_0x1787e3,{'showHidden':![],'depth':null}));};exports[_0x1dd9('0x5')]=function(_0xf606a8,_0x43e5af){var _0x1be06c={'XMF-ECM':_0x43e5af[_0x1dd9('0x6')],'XMF-HEADERINFO':_0x43e5af['headerinfo'],'XMF-MINRATE':_0x43e5af[_0x1dd9('0x7')],'XMF-MAXRATE':_0x43e5af[_0x1dd9('0x8')],'XMF-MODEM':util[_0x1dd9('0x9')](_0x1dd9('0xa'),_0x43e5af[_0x1dd9('0xb')]),'XMF-GATEWAY':_0x43e5af[_0x1dd9('0xc')],'XMF-FAXDETECT':_0x43e5af['faxdetect'],'XMF-T38TIMEOUT':_0x43e5af['t38timeout'],'XMF-LOCALSTATIONID':_0x43e5af[_0x1dd9('0xd')],'XMF-PATH':_0xf606a8[_0x1dd9('0xe')]};return _0x1be06c;};exports[_0x1dd9('0xf')]=function(_0x28cd7b,_0x57f376){return{'actionid':_0x28cd7b[_0x1dd9('0x10')],'action':_0x1dd9('0x11'),'channel':_0x28cd7b[_0x1dd9('0x12')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x1dd9('0x9')]('\x22%s\x22\x20<%s>',_0x28cd7b[_0x1dd9('0x13')]?_0x28cd7b[_0x1dd9('0x13')]:'',_0x28cd7b[_0x1dd9('0xd')]),'variable':_0x57f376,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x28cd7b[_0x1dd9('0x10')]};}; \ No newline at end of file +var _0xfe2a=['info','addVariables','ecm','minrate','maxrate','format','modem','gateway','faxdetect','localstationid','path','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','uniqueid','util','lodash','moment','../../../../config/logger','fax','message'];(function(_0x374be8,_0x16aef9){var _0x4de51a=function(_0x5fce14){while(--_0x5fce14){_0x374be8['push'](_0x374be8['shift']());}};_0x4de51a(++_0x16aef9);}(_0xfe2a,0x72));var _0xafe2=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0xfe2a[_0x3b7b8a];return _0x441206;};'use strict';var util=require(_0xafe2('0x0'));var _=require(_0xafe2('0x1'));var moment=require(_0xafe2('0x2'));var logger=require(_0xafe2('0x3'))(_0xafe2('0x4'));exports[_0xafe2('0x5')]=function(_0x45727d){return{'message':_0x45727d};};exports['logger']=function(_0x4743cc,_0x3a7c66){logger[_0xafe2('0x6')](_0x4743cc,util['inspect'](_0x3a7c66,{'showHidden':![],'depth':null}));};exports[_0xafe2('0x7')]=function(_0x2ccd90,_0x29391a){var _0x59fb48={'XMF-ECM':_0x29391a[_0xafe2('0x8')],'XMF-HEADERINFO':_0x29391a['headerinfo'],'XMF-MINRATE':_0x29391a[_0xafe2('0x9')],'XMF-MAXRATE':_0x29391a[_0xafe2('0xa')],'XMF-MODEM':util[_0xafe2('0xb')]('\x22%s\x22',_0x29391a[_0xafe2('0xc')]),'XMF-GATEWAY':_0x29391a[_0xafe2('0xd')],'XMF-FAXDETECT':_0x29391a[_0xafe2('0xe')],'XMF-T38TIMEOUT':_0x29391a['t38timeout'],'XMF-LOCALSTATIONID':_0x29391a[_0xafe2('0xf')],'XMF-PATH':_0x2ccd90[_0xafe2('0x10')]};return _0x59fb48;};exports['variablesAction']=function(_0x334929,_0x31cdf1){return{'actionid':_0x334929['uniqueid'],'action':_0xafe2('0x11'),'channel':_0x334929[_0xafe2('0x12')],'Exten':_0xafe2('0x13'),'Context':_0xafe2('0x14'),'Priority':'1','callerid':util[_0xafe2('0xb')](_0xafe2('0x15'),_0x334929[_0xafe2('0x16')]?_0x334929[_0xafe2('0x16')]:'',_0x334929[_0xafe2('0xf')]),'variable':_0x31cdf1,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x334929[_0xafe2('0x17')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 09a42b1..28d57b2 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 _0xa621=['initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','listen','sync','catch','[index.js][main]','inspect','util','./server','./report','./acw','./trigger','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','resolve','then','getTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initVoiceExtensions'];(function(_0x159f9b,_0x5b015c){var _0x5af408=function(_0x3d8a15){while(--_0x3d8a15){_0x159f9b['push'](_0x159f9b['shift']());}};_0x5af408(++_0x5b015c);}(_0xa621,0x175));var _0x1a62=function(_0x1a03e2,_0x481b9a){_0x1a03e2=_0x1a03e2-0x0;var _0x72d9ec=_0xa621[_0x1a03e2];return _0x72d9ec;};'use strict';var BPromise=require('bluebird');var util=require(_0x1a62('0x0'));var moment=require('moment');var server=require(_0x1a62('0x1'));var Realtime=require('./realtime');var Report=require(_0x1a62('0x2'));var Acw=require(_0x1a62('0x3'));var Trigger=require(_0x1a62('0x4'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x1a62('0x5'));var user=require('./rpc/user');var voiceQueue=require(_0x1a62('0x6'));var voiceQueueReport=require(_0x1a62('0x7'));var voiceCallReport=require(_0x1a62('0x8'));var trunk=require(_0x1a62('0x9'));var trigger=require('./rpc/trigger');var template=require(_0x1a62('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x1a62('0xb'));var faxAccount=require(_0x1a62('0xc'));var zendesk=require(_0x1a62('0xd'));var salesforce=require(_0x1a62('0xe'));var sugarcrm=require(_0x1a62('0xf'));var freshdesk=require(_0x1a62('0x10'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x1a62('0x11'));var vtiger=require(_0x1a62('0x12'));var freshsales=require(_0x1a62('0x13'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x1a62('0x14'));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(_0x1a62('0x15'))(_0x1a62('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1a62('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1a62('0x17')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1a62('0x18')]()[_0x1a62('0x19')](user['getAgents']())[_0x1a62('0x19')](realtime['initAgents']())[_0x1a62('0x19')](user[_0x1a62('0x1a')]())[_0x1a62('0x19')](realtime['initTelephones']())['then'](trunk[_0x1a62('0x1b')]())[_0x1a62('0x19')](realtime['initTrunks']())[_0x1a62('0x19')](voiceQueue[_0x1a62('0x1c')]())[_0x1a62('0x19')](realtime[_0x1a62('0x1d')]())[_0x1a62('0x19')](trigger[_0x1a62('0x1e')]())[_0x1a62('0x19')](realtime['initTriggers']())[_0x1a62('0x19')](template['getTemplates']())[_0x1a62('0x19')](realtime[_0x1a62('0x1f')]())[_0x1a62('0x19')](zendesk[_0x1a62('0x20')]())['then'](realtime[_0x1a62('0x21')]())[_0x1a62('0x19')](salesforce['getSalesforceAccounts']())[_0x1a62('0x19')](realtime[_0x1a62('0x22')]())[_0x1a62('0x19')](sugarcrm['getSugarcrmAccounts']())[_0x1a62('0x19')](realtime[_0x1a62('0x23')]())[_0x1a62('0x19')](freshdesk[_0x1a62('0x24')]())['then'](realtime[_0x1a62('0x25')]())['then'](desk[_0x1a62('0x26')]())[_0x1a62('0x19')](realtime[_0x1a62('0x27')]())[_0x1a62('0x19')](zoho['getZohoAccounts']())[_0x1a62('0x19')](realtime[_0x1a62('0x28')]())[_0x1a62('0x19')](vtiger[_0x1a62('0x29')]())[_0x1a62('0x19')](realtime['initVtigerAccounts']())['then'](freshsales['getFreshsalesAccounts']())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x1a62('0x2a')]())['then'](realtime[_0x1a62('0x2b')]())[_0x1a62('0x19')](dynamics365[_0x1a62('0x2c')]())[_0x1a62('0x19')](realtime['initDynamics365Accounts']())[_0x1a62('0x19')](campaign[_0x1a62('0x2d')]())[_0x1a62('0x19')](realtime['initCampaigns']())[_0x1a62('0x19')](voiceExtension['getVoiceExtensions']())[_0x1a62('0x19')](realtime[_0x1a62('0x2e')]())[_0x1a62('0x19')](faxAccount['getFaxAccounts']())['then'](realtime['initFaxAccounts']())[_0x1a62('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0x1a62('0x18')]()[_0x1a62('0x19')](voiceQueueReport['getVoiceQueueReports']())[_0x1a62('0x19')](realtime[_0x1a62('0x2f')]())[_0x1a62('0x19')](cmHopperHistory[_0x1a62('0x30')]())['then'](realtime[_0x1a62('0x31')]())[_0x1a62('0x19')](cmHopperHistory['getCampaignHopperHistory']())[_0x1a62('0x19')](realtime[_0x1a62('0x32')]())[_0x1a62('0x19')](voiceCallReport[_0x1a62('0x33')]())[_0x1a62('0x19')](realtime[_0x1a62('0x34')]())['catch'](function(_0x4e7b9f){logger[_0x1a62('0x35')](_0x1a62('0x36'),util['inspect'](_0x4e7b9f,{'showHidden':![],'depth':null}));});}function main(){return server[_0x1a62('0x37')](realtime,preview,fax)[_0x1a62('0x19')](function(_0x23bb55){return initRealtime();})[_0x1a62('0x19')](function(){return initParams();})['then'](function(){report[_0x1a62('0x38')]();setInterval(initRealtime,0x1388);})[_0x1a62('0x39')](function(_0x2faec9){logger[_0x1a62('0x35')](_0x1a62('0x3a'),util[_0x1a62('0x3b')](_0x2faec9,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x7385=['initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','error','[index.js][initParams]','sync','catch','[index.js][main]','inspect','bluebird','util','./server','./realtime','./report','./acw','./trigger','./dialer','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents'];(function(_0x568ec8,_0x1e0f23){var _0x52b2be=function(_0x2cb177){while(--_0x2cb177){_0x568ec8['push'](_0x568ec8['shift']());}};_0x52b2be(++_0x1e0f23);}(_0x7385,0x188));var _0x5738=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7385[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0x5738('0x0'));var util=require(_0x5738('0x1'));var moment=require('moment');var server=require(_0x5738('0x2'));var Realtime=require(_0x5738('0x3'));var Report=require(_0x5738('0x4'));var Acw=require(_0x5738('0x5'));var Trigger=require(_0x5738('0x6'));var Dialer=require(_0x5738('0x7'));var Preview=require('./preview');var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x5738('0x8'));var voiceQueueReport=require(_0x5738('0x9'));var voiceCallReport=require(_0x5738('0xa'));var trunk=require(_0x5738('0xb'));var trigger=require(_0x5738('0xc'));var template=require(_0x5738('0xd'));var cmHopperHistory=require(_0x5738('0xe'));var campaign=require(_0x5738('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x5738('0x10'));var zendesk=require(_0x5738('0x11'));var salesforce=require(_0x5738('0x12'));var sugarcrm=require(_0x5738('0x13'));var freshdesk=require(_0x5738('0x14'));var desk=require(_0x5738('0x15'));var zoho=require(_0x5738('0x16'));var vtiger=require(_0x5738('0x17'));var freshsales=require(_0x5738('0x18'));var servicenow=require(_0x5738('0x19'));var dynamics365=require(_0x5738('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x5738('0x1b'))(_0x5738('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5738('0x1d')](_0x5738('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5738('0x1d')](_0x5738('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x5738('0x1f')]()[_0x5738('0x20')](user[_0x5738('0x21')]())['then'](realtime[_0x5738('0x22')]())['then'](user[_0x5738('0x23')]())[_0x5738('0x20')](realtime[_0x5738('0x24')]())[_0x5738('0x20')](trunk['getTrunks']())[_0x5738('0x20')](realtime[_0x5738('0x25')]())['then'](voiceQueue[_0x5738('0x26')]())[_0x5738('0x20')](realtime[_0x5738('0x27')]())[_0x5738('0x20')](trigger[_0x5738('0x28')]())[_0x5738('0x20')](realtime[_0x5738('0x29')]())['then'](template[_0x5738('0x2a')]())[_0x5738('0x20')](realtime['initTemplates']())[_0x5738('0x20')](zendesk[_0x5738('0x2b')]())[_0x5738('0x20')](realtime['initZendeskAccounts']())[_0x5738('0x20')](salesforce[_0x5738('0x2c')]())['then'](realtime['initSalesforceAccounts']())[_0x5738('0x20')](sugarcrm[_0x5738('0x2d')]())[_0x5738('0x20')](realtime['initSugarcrmAccounts']())[_0x5738('0x20')](freshdesk[_0x5738('0x2e')]())[_0x5738('0x20')](realtime['initFreshdeskAccounts']())[_0x5738('0x20')](desk['getDeskAccounts']())[_0x5738('0x20')](realtime['initDeskAccounts']())[_0x5738('0x20')](zoho[_0x5738('0x2f')]())[_0x5738('0x20')](realtime[_0x5738('0x30')]())[_0x5738('0x20')](vtiger[_0x5738('0x31')]())['then'](realtime[_0x5738('0x32')]())[_0x5738('0x20')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x5738('0x33')]())['then'](servicenow[_0x5738('0x34')]())[_0x5738('0x20')](realtime[_0x5738('0x35')]())[_0x5738('0x20')](dynamics365[_0x5738('0x36')]())['then'](realtime['initDynamics365Accounts']())['then'](campaign[_0x5738('0x37')]())[_0x5738('0x20')](realtime[_0x5738('0x38')]())['then'](voiceExtension[_0x5738('0x39')]())[_0x5738('0x20')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x5738('0x3a')]())[_0x5738('0x20')](realtime[_0x5738('0x3b')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x5738('0x1f')]()[_0x5738('0x20')](voiceQueueReport[_0x5738('0x3c')]())[_0x5738('0x20')](realtime[_0x5738('0x3d')]())[_0x5738('0x20')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x5738('0x20')](realtime[_0x5738('0x3e')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x5738('0x20')](realtime[_0x5738('0x3f')]())[_0x5738('0x20')](voiceCallReport['getVoiceCallReports']())[_0x5738('0x20')](realtime[_0x5738('0x40')]())['catch'](function(_0x1a6371){logger[_0x5738('0x41')](_0x5738('0x42'),util['inspect'](_0x1a6371,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x5738('0x20')](function(_0xdb0784){return initRealtime();})[_0x5738('0x20')](function(){return initParams();})[_0x5738('0x20')](function(){report[_0x5738('0x43')]();setInterval(initRealtime,0x1388);})[_0x5738('0x44')](function(_0x127200){logger[_0x5738('0x41')](_0x5738('0x45'),util[_0x5738('0x46')](_0x127200,{'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 b25cd27..9418462 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 _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x46e8ec,_0x418424){var _0xe65e17=function(_0xf5dbcb){while(--_0xf5dbcb){_0x46e8ec['push'](_0x46e8ec['shift']());}};_0xe65e17(++_0x418424);}(_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 md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file +var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x5efb4a,_0x39b1ec){var _0x5f31a2=function(_0x2375a7){while(--_0x2375a7){_0x5efb4a['push'](_0x5efb4a['shift']());}};_0x5f31a2(++_0x39b1ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 51e5f00..a8a9650 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 _0x24cb=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x574123,_0x273efe){var _0x4440cf=function(_0x33e880){while(--_0x33e880){_0x574123['push'](_0x574123['shift']());}};_0x4440cf(++_0x273efe);}(_0x24cb,0x189));var _0xb24c=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x24cb[_0x58afd5];return _0x3e503b;};'use strict';function Campaign(_0xe20ff6){this['id']=_0xe20ff6['id']||0x0;this[_0xb24c('0x0')]=_0xe20ff6['name']||'';this['type']=_0xe20ff6[_0xb24c('0x1')]||_0xb24c('0x2');this[_0xb24c('0x3')]=0x0;this[_0xb24c('0x4')]=0x0;this[_0xb24c('0x5')]=0x0;this[_0xb24c('0x6')]=0x0;this[_0xb24c('0x7')]='';this[_0xb24c('0x8')]=!![];this['active']=_0xe20ff6['active'];this['limitCalls']=_0xe20ff6[_0xb24c('0x9')];this[_0xb24c('0xa')]=_0xe20ff6[_0xb24c('0xa')]||null;this[_0xb24c('0xb')]=_0xe20ff6[_0xb24c('0xb')]?_0xe20ff6[_0xb24c('0xb')]:null;this['dialOriginateCallerIdName']=_0xe20ff6[_0xb24c('0xc')];this[_0xb24c('0xd')]=_0xe20ff6['dialOriginateCallerIdNumber'];this[_0xb24c('0xe')]=_0xe20ff6['dialOriginateTimeout']||0x1e;this[_0xb24c('0xf')]=_0xe20ff6[_0xb24c('0xf')];this[_0xb24c('0x10')]=_0xe20ff6[_0xb24c('0x10')];this['dialBusyMaxRetry']=_0xe20ff6[_0xb24c('0x11')];this[_0xb24c('0x12')]=_0xe20ff6['dialBusyRetryFrequency'];this[_0xb24c('0x13')]=_0xe20ff6[_0xb24c('0x13')];this['dialNoAnswerRetryFrequency']=_0xe20ff6[_0xb24c('0x14')];this['dialGlobalMaxRetry']=_0xe20ff6[_0xb24c('0x15')];this[_0xb24c('0x16')]=_0xe20ff6[_0xb24c('0x16')]||0x3;this[_0xb24c('0x17')]=_0xe20ff6[_0xb24c('0x17')]||0x96;this[_0xb24c('0x18')]=_0xe20ff6['dialDropMaxRetry']||0x3;this[_0xb24c('0x19')]=_0xe20ff6[_0xb24c('0x19')]||0x96;this[_0xb24c('0x1a')]=_0xe20ff6[_0xb24c('0x1a')]||0x3;this[_0xb24c('0x1b')]=_0xe20ff6[_0xb24c('0x1b')]||0x96;this[_0xb24c('0x1c')]=_0xe20ff6['dialMachineMaxRetry']||0x3;this[_0xb24c('0x1d')]=_0xe20ff6['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0xe20ff6['dialAgentRejectMaxRetry']||0x3;this[_0xb24c('0x1e')]=_0xe20ff6[_0xb24c('0x1e')]||0x96;this[_0xb24c('0x1f')]=_0xe20ff6[_0xb24c('0x1f')]||'DESC';this[_0xb24c('0x20')]=_0xe20ff6[_0xb24c('0x20')]||undefined;this[_0xb24c('0x21')]=_0xe20ff6[_0xb24c('0x21')]||undefined;this[_0xb24c('0x22')]=_0xe20ff6[_0xb24c('0x22')]||undefined;this[_0xb24c('0x23')]=_0xe20ff6[_0xb24c('0x23')]?_0xe20ff6[_0xb24c('0x23')]:undefined;this[_0xb24c('0x24')]=_0xe20ff6[_0xb24c('0x24')]?_0xe20ff6[_0xb24c('0x24')]:undefined;this['Interval']=_0xe20ff6[_0xb24c('0x25')]?_0xe20ff6['Interval']:undefined;this[_0xb24c('0x26')]=_0xe20ff6[_0xb24c('0x26')]?_0xe20ff6['SquareProject']:undefined;this[_0xb24c('0x27')]=_0xe20ff6[_0xb24c('0x26')]?_0xe20ff6[_0xb24c('0x26')][_0xb24c('0x0')]:undefined;this[_0xb24c('0x28')]=_0xe20ff6[_0xb24c('0x28')]||![];this[_0xb24c('0x29')]=_0xe20ff6[_0xb24c('0x29')];this['dialAMDGreeting']=_0xe20ff6[_0xb24c('0x2a')];this[_0xb24c('0x2b')]=_0xe20ff6[_0xb24c('0x2b')];this[_0xb24c('0x2c')]=_0xe20ff6[_0xb24c('0x2c')];this['dialAMDMinWordLength']=_0xe20ff6[_0xb24c('0x2d')];this['dialAMDBetweenWordsSilence']=_0xe20ff6[_0xb24c('0x2e')];this[_0xb24c('0x2f')]=_0xe20ff6[_0xb24c('0x2f')];this[_0xb24c('0x30')]=_0xe20ff6[_0xb24c('0x30')];this['dialAMDMaximumWordLength']=_0xe20ff6[_0xb24c('0x31')];}module[_0xb24c('0x32')]=Campaign; \ No newline at end of file +var _0xc768=['DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt'];(function(_0x3a31a5,_0x5eea01){var _0x1c10c5=function(_0x5e7bd1){while(--_0x5e7bd1){_0x3a31a5['push'](_0x3a31a5['shift']());}};_0x1c10c5(++_0x5eea01);}(_0xc768,0x172));var _0x8c76=function(_0x5c8938,_0x4502ef){_0x5c8938=_0x5c8938-0x0;var _0x2e6138=_0xc768[_0x5c8938];return _0x2e6138;};'use strict';function Campaign(_0x16b51f){this['id']=_0x16b51f['id']||0x0;this[_0x8c76('0x0')]=_0x16b51f[_0x8c76('0x0')]||'';this[_0x8c76('0x1')]=_0x16b51f[_0x8c76('0x1')]||_0x8c76('0x2');this[_0x8c76('0x3')]=0x0;this['temp']=0x0;this[_0x8c76('0x4')]=0x0;this[_0x8c76('0x5')]=0x0;this['message']='';this[_0x8c76('0x6')]=!![];this['active']=_0x16b51f[_0x8c76('0x7')];this[_0x8c76('0x8')]=_0x16b51f[_0x8c76('0x8')];this['dialTimezone']=_0x16b51f[_0x8c76('0x9')]||null;this[_0x8c76('0xa')]=_0x16b51f[_0x8c76('0xa')]?_0x16b51f[_0x8c76('0xa')]:null;this[_0x8c76('0xb')]=_0x16b51f[_0x8c76('0xb')];this[_0x8c76('0xc')]=_0x16b51f[_0x8c76('0xc')];this[_0x8c76('0xd')]=_0x16b51f[_0x8c76('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x16b51f[_0x8c76('0xe')];this[_0x8c76('0xf')]=_0x16b51f['dialCongestionRetryFrequency'];this[_0x8c76('0x10')]=_0x16b51f[_0x8c76('0x10')];this[_0x8c76('0x11')]=_0x16b51f[_0x8c76('0x11')];this[_0x8c76('0x12')]=_0x16b51f[_0x8c76('0x12')];this[_0x8c76('0x13')]=_0x16b51f[_0x8c76('0x13')];this['dialGlobalMaxRetry']=_0x16b51f[_0x8c76('0x14')];this['dialNoSuchNumberMaxRetry']=_0x16b51f[_0x8c76('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x16b51f[_0x8c76('0x16')]||0x96;this['dialDropMaxRetry']=_0x16b51f[_0x8c76('0x17')]||0x3;this[_0x8c76('0x18')]=_0x16b51f[_0x8c76('0x18')]||0x96;this[_0x8c76('0x19')]=_0x16b51f[_0x8c76('0x19')]||0x3;this[_0x8c76('0x1a')]=_0x16b51f[_0x8c76('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x16b51f['dialMachineMaxRetry']||0x3;this[_0x8c76('0x1b')]=_0x16b51f[_0x8c76('0x1b')]||0x96;this[_0x8c76('0x1c')]=_0x16b51f[_0x8c76('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x16b51f['dialAgentRejectRetryFrequency']||0x96;this[_0x8c76('0x1d')]=_0x16b51f[_0x8c76('0x1d')]||_0x8c76('0x1e');this[_0x8c76('0x1f')]=_0x16b51f['dialPrefix']||undefined;this[_0x8c76('0x20')]=_0x16b51f[_0x8c76('0x20')]||undefined;this[_0x8c76('0x21')]=_0x16b51f[_0x8c76('0x21')]||undefined;this[_0x8c76('0x22')]=_0x16b51f[_0x8c76('0x22')]?_0x16b51f[_0x8c76('0x22')]:undefined;this[_0x8c76('0x23')]=_0x16b51f[_0x8c76('0x23')]?_0x16b51f[_0x8c76('0x23')]:undefined;this[_0x8c76('0x24')]=_0x16b51f['Interval']?_0x16b51f['Interval']:undefined;this[_0x8c76('0x25')]=_0x16b51f[_0x8c76('0x25')]?_0x16b51f[_0x8c76('0x25')]:undefined;this[_0x8c76('0x26')]=_0x16b51f[_0x8c76('0x25')]?_0x16b51f[_0x8c76('0x25')][_0x8c76('0x0')]:undefined;this[_0x8c76('0x27')]=_0x16b51f[_0x8c76('0x27')]||![];this[_0x8c76('0x28')]=_0x16b51f[_0x8c76('0x28')];this[_0x8c76('0x29')]=_0x16b51f[_0x8c76('0x29')];this['dialAMDAfterGreetingSilence']=_0x16b51f[_0x8c76('0x2a')];this[_0x8c76('0x2b')]=_0x16b51f[_0x8c76('0x2b')];this[_0x8c76('0x2c')]=_0x16b51f[_0x8c76('0x2c')];this[_0x8c76('0x2d')]=_0x16b51f[_0x8c76('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x16b51f[_0x8c76('0x2e')];this['dialAMDSilenceThreshold']=_0x16b51f[_0x8c76('0x2f')];this[_0x8c76('0x30')]=_0x16b51f[_0x8c76('0x30')];}module[_0x8c76('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 1480198..a717122 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 _0x3eaf=['uniqueid','exten','answertime','endtime','unmanaged','lastapplication','duration','billableseconds','type','disposition','monitor','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context'];(function(_0x1a252d,_0x567894){var _0x1ee0fc=function(_0x1b9da3){while(--_0x1b9da3){_0x1a252d['push'](_0x1a252d['shift']());}};_0x1ee0fc(++_0x567894);}(_0x3eaf,0x190));var _0xf3ea=function(_0x42432c,_0xadc54f){_0x42432c=_0x42432c-0x0;var _0x403c71=_0x3eaf[_0x42432c];return _0x403c71;};'use strict';function Channel(){this[_0xf3ea('0x0')]=null;this[_0xf3ea('0x1')]='';this[_0xf3ea('0x2')]='';this[_0xf3ea('0x3')]=0x0;this[_0xf3ea('0x4')]='';this[_0xf3ea('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xf3ea('0x6')]=0x0;this[_0xf3ea('0x7')]='';this[_0xf3ea('0x8')]=0x0;this['linkedid']=0x0;this[_0xf3ea('0x9')]=0x0;this['answered']=![];this[_0xf3ea('0xa')]=null;this[_0xf3ea('0xb')]=null;this[_0xf3ea('0xc')]=![];this['abandoned']=![];this[_0xf3ea('0xd')]='';this['lastdata']='';this[_0xf3ea('0xe')]=0x0;this[_0xf3ea('0xf')]=0x0;this['holdtime']=0x0;this[_0xf3ea('0x10')]=null;this['tag']=null;this[_0xf3ea('0x11')]=null;this[_0xf3ea('0x12')]=![];this['monitorFilename']=null;this['queue']=null;this[_0xf3ea('0x13')]=[];this[_0xf3ea('0x14')]=undefined;this[_0xf3ea('0x15')]=undefined;this['transferType']=undefined;this[_0xf3ea('0x16')]=0x0;}module[_0xf3ea('0x17')]=Channel; \ No newline at end of file +var _0xd0bb=['channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','exten','answertime','endtime','abandoned','lastapplication','duration','billableseconds','type','tag','disposition','monitor','monitorFilename','transferconnectedlinenum','transferType','mohtime','exports','starttime'];(function(_0xfaeb2,_0x162fe0){var _0x5ee1ac=function(_0x3a8eeb){while(--_0x3a8eeb){_0xfaeb2['push'](_0xfaeb2['shift']());}};_0x5ee1ac(++_0x162fe0);}(_0xd0bb,0x1a8));var _0xbd0b=function(_0x1d3a5d,_0x17fc32){_0x1d3a5d=_0x1d3a5d-0x0;var _0x257078=_0xd0bb[_0x1d3a5d];return _0x257078;};'use strict';function Channel(){this[_0xbd0b('0x0')]=null;this[_0xbd0b('0x1')]='';this[_0xbd0b('0x2')]='';this[_0xbd0b('0x3')]=0x0;this[_0xbd0b('0x4')]='';this[_0xbd0b('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xbd0b('0x6')]=0x0;this[_0xbd0b('0x7')]='';this[_0xbd0b('0x8')]=0x0;this['linkedid']=0x0;this[_0xbd0b('0x9')]=0x0;this['answered']=![];this[_0xbd0b('0xa')]=null;this[_0xbd0b('0xb')]=null;this['unmanaged']=![];this[_0xbd0b('0xc')]=![];this[_0xbd0b('0xd')]='';this['lastdata']='';this[_0xbd0b('0xe')]=0x0;this[_0xbd0b('0xf')]=0x0;this['holdtime']=0x0;this[_0xbd0b('0x10')]=null;this[_0xbd0b('0x11')]=null;this[_0xbd0b('0x12')]=null;this[_0xbd0b('0x13')]=![];this[_0xbd0b('0x14')]=null;this['queue']=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0xbd0b('0x15')]=undefined;this[_0xbd0b('0x16')]=undefined;this[_0xbd0b('0x17')]=0x0;}module[_0xbd0b('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b15b48e..1824117 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 _0xac99=['serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x3d593d,_0x1dec8d){var _0x501ec5=function(_0x1b7039){while(--_0x1b7039){_0x3d593d['push'](_0x3d593d['shift']());}};_0x501ec5(++_0x1dec8d);}(_0xac99,0x117));var _0x9ac9=function(_0x49b9ef,_0x55547f){_0x49b9ef=_0x49b9ef-0x0;var _0x4de813=_0xac99[_0x49b9ef];return _0x4de813;};'use strict';function DeskAccount(_0xbf4189){this['id']=_0xbf4189['id']||0x0;this['name']=_0xbf4189['name']||'';this[_0x9ac9('0x0')]=_0xbf4189['username']||'';this[_0x9ac9('0x1')]=_0xbf4189['remoteUri']||'';this[_0x9ac9('0x2')]=_0xbf4189[_0x9ac9('0x2')]||'';this[_0x9ac9('0x3')]=_0xbf4189[_0x9ac9('0x3')]||'';this[_0x9ac9('0x4')]=_0xbf4189[_0x9ac9('0x4')]||'';this[_0x9ac9('0x5')]=_0xbf4189['consumerSecret']||'';this[_0x9ac9('0x6')]=_0xbf4189[_0x9ac9('0x6')]||'';this['tokenSecret']=_0xbf4189[_0x9ac9('0x7')]||'';this[_0x9ac9('0x8')]=_0xbf4189[_0x9ac9('0x8')]||'';this[_0x9ac9('0x9')]=_0xbf4189[_0x9ac9('0x9')]||'';this[_0x9ac9('0xa')]=_0xbf4189[_0x9ac9('0xa')]||{};}module[_0x9ac9('0xb')]=DeskAccount; \ No newline at end of file +var _0x6bc9=['password','consumerKey','consumerSecret','token','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x13c4f8,_0x433521){var _0x5a8f4b=function(_0x1df845){while(--_0x1df845){_0x13c4f8['push'](_0x13c4f8['shift']());}};_0x5a8f4b(++_0x433521);}(_0x6bc9,0x134));var _0x96bc=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x6bc9[_0x45d1fd];return _0xd0e542;};'use strict';function DeskAccount(_0x55c9ec){this['id']=_0x55c9ec['id']||0x0;this[_0x96bc('0x0')]=_0x55c9ec[_0x96bc('0x0')]||'';this[_0x96bc('0x1')]=_0x55c9ec[_0x96bc('0x1')]||'';this[_0x96bc('0x2')]=_0x55c9ec[_0x96bc('0x2')]||'';this['authType']=_0x55c9ec[_0x96bc('0x3')]||'';this['password']=_0x55c9ec[_0x96bc('0x4')]||'';this[_0x96bc('0x5')]=_0x55c9ec[_0x96bc('0x5')]||'';this[_0x96bc('0x6')]=_0x55c9ec[_0x96bc('0x6')]||'';this[_0x96bc('0x7')]=_0x55c9ec[_0x96bc('0x7')]||'';this['tokenSecret']=_0x55c9ec['tokenSecret']||'';this[_0x96bc('0x8')]=_0x55c9ec[_0x96bc('0x8')]||'';this[_0x96bc('0x9')]=_0x55c9ec[_0x96bc('0x9')]||'';this[_0x96bc('0xa')]=_0x55c9ec['Configurations']||{};}module[_0x96bc('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 78d82a9..bcf25cd 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 _0x2a78=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','exports','name'];(function(_0x3d53ee,_0x5b2f8b){var _0x1be1f7=function(_0x585a11){while(--_0x585a11){_0x3d53ee['push'](_0x3d53ee['shift']());}};_0x1be1f7(++_0x5b2f8b);}(_0x2a78,0x149));var _0x82a7=function(_0x33e9c3,_0x5df2a8){_0x33e9c3=_0x33e9c3-0x0;var _0x5d752f=_0x2a78[_0x33e9c3];return _0x5d752f;};'use strict';function Dynamics365Account(_0x19dd2a){this['id']=_0x19dd2a['id']||0x0;this['name']=_0x19dd2a[_0x82a7('0x0')]||'';this['username']=_0x19dd2a[_0x82a7('0x1')]||'';this[_0x82a7('0x2')]=_0x19dd2a[_0x82a7('0x2')]||'';this['remoteUri']=_0x19dd2a[_0x82a7('0x3')]||'';this[_0x82a7('0x4')]=_0x19dd2a[_0x82a7('0x4')]||'';this[_0x82a7('0x5')]=_0x19dd2a[_0x82a7('0x5')]||'';this[_0x82a7('0x6')]=_0x19dd2a[_0x82a7('0x6')]||{};this[_0x82a7('0x7')]=_0x19dd2a[_0x82a7('0x7')]||'';this['modernAuthentication']=_0x19dd2a[_0x82a7('0x8')]||![];this['Configurations']=_0x19dd2a[_0x82a7('0x9')]||{};this['CloudProvider']=_0x19dd2a['CloudProvider']||{};}module[_0x82a7('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xc6ce=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0xec141f,_0x44835b){var _0x51ebb0=function(_0x8828d7){while(--_0x8828d7){_0xec141f['push'](_0xec141f['shift']());}};_0x51ebb0(++_0x44835b);}(_0xc6ce,0x13c));var _0xec6c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc6ce[_0x3b380d];return _0x54502b;};'use strict';function Dynamics365Account(_0x4b1666){this['id']=_0x4b1666['id']||0x0;this[_0xec6c('0x0')]=_0x4b1666[_0xec6c('0x0')]||'';this['username']=_0x4b1666[_0xec6c('0x1')]||'';this[_0xec6c('0x2')]=_0x4b1666[_0xec6c('0x2')]||'';this['remoteUri']=_0x4b1666[_0xec6c('0x3')]||'';this[_0xec6c('0x4')]=_0x4b1666[_0xec6c('0x4')]||'';this[_0xec6c('0x5')]=_0x4b1666[_0xec6c('0x5')]||'';this[_0xec6c('0x6')]=_0x4b1666[_0xec6c('0x6')]||{};this[_0xec6c('0x7')]=_0x4b1666[_0xec6c('0x7')]||'';this[_0xec6c('0x8')]=_0x4b1666['modernAuthentication']||![];this[_0xec6c('0x9')]=_0x4b1666[_0xec6c('0x9')]||{};this[_0xec6c('0xa')]=_0x4b1666['CloudProvider']||{};}module[_0xec6c('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 9aae057..104d282 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 _0x5fc5=['SIP','Trunk','ListId','key','name','description','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x35e9e6,_0x10dc1b){var _0xe3ba5e=function(_0x29252d){while(--_0x29252d){_0x35e9e6['push'](_0x35e9e6['shift']());}};_0xe3ba5e(++_0x10dc1b);}(_0x5fc5,0x114));var _0x55fc=function(_0x17d11c,_0x1df580){_0x17d11c=_0x17d11c-0x0;var _0x1bb2c3=_0x5fc5[_0x17d11c];return _0x1bb2c3;};'use strict';function FaxAccount(_0x4b4175){this['id']=_0x4b4175['id']||0x0;this[_0x55fc('0x0')]=_0x4b4175[_0x55fc('0x0')]||'';this[_0x55fc('0x1')]=_0x4b4175[_0x55fc('0x1')];this['ecm']=_0x4b4175['ecm'];this[_0x55fc('0x2')]=_0x4b4175[_0x55fc('0x2')];this[_0x55fc('0x3')]=_0x4b4175['localstationid'];this[_0x55fc('0x4')]=_0x4b4175[_0x55fc('0x4')]||0x960;this[_0x55fc('0x5')]=_0x4b4175['maxrate']||0x3840;this[_0x55fc('0x6')]=_0x4b4175[_0x55fc('0x6')]||_0x55fc('0x7');this['gateway']=_0x4b4175[_0x55fc('0x8')]||'no';this['faxdetect']=_0x4b4175[_0x55fc('0x9')]||'no';this[_0x55fc('0xa')]=_0x4b4175[_0x55fc('0xa')]||0x1388;this[_0x55fc('0xb')]=_0x4b4175[_0x55fc('0xb')]||_0x55fc('0xc');this[_0x55fc('0xd')]=_0x4b4175[_0x55fc('0xd')]?_0x4b4175[_0x55fc('0xd')]:undefined;this[_0x55fc('0xe')]=_0x4b4175[_0x55fc('0xe')];this[_0x55fc('0xf')]=_0x4b4175['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x5972=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x5972,0x7a));var _0x2597=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x5972[_0x43d16c];return _0x208cce;};'use strict';function FaxAccount(_0x4eb998){this['id']=_0x4eb998['id']||0x0;this[_0x2597('0x0')]=_0x4eb998[_0x2597('0x0')]||'';this[_0x2597('0x1')]=_0x4eb998[_0x2597('0x1')];this[_0x2597('0x2')]=_0x4eb998['ecm'];this[_0x2597('0x3')]=_0x4eb998[_0x2597('0x3')];this[_0x2597('0x4')]=_0x4eb998['localstationid'];this[_0x2597('0x5')]=_0x4eb998['minrate']||0x960;this['maxrate']=_0x4eb998['maxrate']||0x3840;this[_0x2597('0x6')]=_0x4eb998[_0x2597('0x6')]||_0x2597('0x7');this[_0x2597('0x8')]=_0x4eb998[_0x2597('0x8')]||'no';this[_0x2597('0x9')]=_0x4eb998[_0x2597('0x9')]||'no';this[_0x2597('0xa')]=_0x4eb998[_0x2597('0xa')]||0x1388;this[_0x2597('0xb')]=_0x4eb998[_0x2597('0xb')]||_0x2597('0xc');this[_0x2597('0xd')]=_0x4eb998[_0x2597('0xd')]?_0x4eb998[_0x2597('0xd')]:undefined;this[_0x2597('0xe')]=_0x4eb998[_0x2597('0xe')];this[_0x2597('0xf')]=_0x4eb998['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 0bad42f..70ce4d1 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 _0x76c8=['remoteUri','Configurations','exports','name','username','apiKey','token'];(function(_0xc694ff,_0x1498ad){var _0x59dba2=function(_0x4c3ccd){while(--_0x4c3ccd){_0xc694ff['push'](_0xc694ff['shift']());}};_0x59dba2(++_0x1498ad);}(_0x76c8,0x145));var _0x876c=function(_0x3b8710,_0x32a948){_0x3b8710=_0x3b8710-0x0;var _0x5947fd=_0x76c8[_0x3b8710];return _0x5947fd;};'use strict';function FreshdeskAccount(_0x9c5153){this['id']=_0x9c5153['id']||0x0;this[_0x876c('0x0')]=_0x9c5153[_0x876c('0x0')]||'';this[_0x876c('0x1')]=_0x9c5153[_0x876c('0x1')]||'';this[_0x876c('0x2')]=_0x9c5153[_0x876c('0x3')]||'';this[_0x876c('0x4')]=_0x9c5153[_0x876c('0x4')]||'';this['serverUrl']=_0x9c5153['serverUrl']||'';this[_0x876c('0x5')]=_0x9c5153[_0x876c('0x5')]||{};}module[_0x876c('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xad95=['username','token','remoteUri','serverUrl','exports','name'];(function(_0x4201d7,_0x2f33ff){var _0x32b56a=function(_0x5b9a2f){while(--_0x5b9a2f){_0x4201d7['push'](_0x4201d7['shift']());}};_0x32b56a(++_0x2f33ff);}(_0xad95,0xcb));var _0x5ad9=function(_0x37d32e,_0x2b5b2d){_0x37d32e=_0x37d32e-0x0;var _0x4aa582=_0xad95[_0x37d32e];return _0x4aa582;};'use strict';function FreshdeskAccount(_0x52994f){this['id']=_0x52994f['id']||0x0;this[_0x5ad9('0x0')]=_0x52994f[_0x5ad9('0x0')]||'';this[_0x5ad9('0x1')]=_0x52994f[_0x5ad9('0x1')]||'';this['apiKey']=_0x52994f[_0x5ad9('0x2')]||'';this[_0x5ad9('0x3')]=_0x52994f['remoteUri']||'';this[_0x5ad9('0x4')]=_0x52994f['serverUrl']||'';this['Configurations']=_0x52994f['Configurations']||{};}module[_0x5ad9('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 73bd4a4..6aa5754 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 _0x4fb4=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x92e68e,_0x132bc2){var _0x4ec11f=function(_0xf2e69d){while(--_0xf2e69d){_0x92e68e['push'](_0x92e68e['shift']());}};_0x4ec11f(++_0x132bc2);}(_0x4fb4,0x190));var _0x44fb=function(_0x5e4799,_0x43055b){_0x5e4799=_0x5e4799-0x0;var _0x333dea=_0x4fb4[_0x5e4799];return _0x333dea;};'use strict';function FreshsalesAccount(_0x2983b0){this['id']=_0x2983b0['id']||0x0;this[_0x44fb('0x0')]=_0x2983b0[_0x44fb('0x0')]||'';this[_0x44fb('0x1')]=_0x2983b0[_0x44fb('0x1')]||'';this[_0x44fb('0x2')]=_0x2983b0[_0x44fb('0x3')]||'';this['remoteUri']=_0x2983b0[_0x44fb('0x4')]||'';this[_0x44fb('0x5')]=_0x2983b0[_0x44fb('0x5')]||'';this[_0x44fb('0x6')]=_0x2983b0[_0x44fb('0x6')]||{};}module[_0x44fb('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x96f1=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x14bb2f,_0x3c8ed0){var _0x5e2041=function(_0x44c46e){while(--_0x44c46e){_0x14bb2f['push'](_0x14bb2f['shift']());}};_0x5e2041(++_0x3c8ed0);}(_0x96f1,0x19c));var _0x196f=function(_0x1a0d00,_0x2ac3e0){_0x1a0d00=_0x1a0d00-0x0;var _0xbe185e=_0x96f1[_0x1a0d00];return _0xbe185e;};'use strict';function FreshsalesAccount(_0xf5b6fa){this['id']=_0xf5b6fa['id']||0x0;this[_0x196f('0x0')]=_0xf5b6fa[_0x196f('0x0')]||'';this[_0x196f('0x1')]=_0xf5b6fa[_0x196f('0x1')]||'';this[_0x196f('0x2')]=_0xf5b6fa[_0x196f('0x3')]||'';this[_0x196f('0x4')]=_0xf5b6fa['remoteUri']||'';this['serverUrl']=_0xf5b6fa[_0x196f('0x5')]||'';this[_0x196f('0x6')]=_0xf5b6fa[_0x196f('0x6')]||{};}module[_0x196f('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 8ce71e7..7c1dc48 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 _0xd37c=['mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice'];(function(_0xefc732,_0x126e41){var _0x440b48=function(_0x4cbb43){while(--_0x4cbb43){_0xefc732['push'](_0xefc732['shift']());}};_0x440b48(++_0x126e41);}(_0xd37c,0x160));var _0xcd37=function(_0x4934a5,_0x3c6d4c){_0x4934a5=_0x4934a5-0x0;var _0x3e7285=_0xd37c[_0x4934a5];return _0x3e7285;};'use strict';function QueueReport(){this[_0xcd37('0x0')]=_0xcd37('0x1');this[_0xcd37('0x2')]='';this[_0xcd37('0x3')]='';this[_0xcd37('0x4')]='';this[_0xcd37('0x5')]='';this[_0xcd37('0x6')]=null;this[_0xcd37('0x7')]=null;this['position']=0x1;this[_0xcd37('0x8')]=0x1;this['queuecallerabandon']=![];this[_0xcd37('0x9')]=null;this[_0xcd37('0xa')]=![];this[_0xcd37('0xb')]=null;this[_0xcd37('0xc')]=![];this['queuecallerexitAt']=null;this[_0xcd37('0xd')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xcd37('0xe')]='';this[_0xcd37('0xf')]='';this[_0xcd37('0x10')]='';this[_0xcd37('0x11')]='';this[_0xcd37('0x12')]='';this[_0xcd37('0x13')]=0x0;this['assigned']=![];this[_0xcd37('0x14')]='';this[_0xcd37('0x15')]=_0xcd37('0x16');this[_0xcd37('0x17')]=0x0;this[_0xcd37('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x3e84=['exten','priority','assigned','lastAssignedTo','motionChannel','mohtime','exports','inbound','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','connectedlinename','accountcode','context'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x3e84,0x147));var _0x43e8=function(_0x4651bd,_0x12a42f){_0x4651bd=_0x4651bd-0x0;var _0xdf510d=_0x3e84[_0x4651bd];return _0xdf510d;};'use strict';function QueueReport(){this['type']=_0x43e8('0x0');this['uniqueid']='';this[_0x43e8('0x1')]='';this['calleridname']='';this[_0x43e8('0x2')]='';this[_0x43e8('0x3')]=null;this[_0x43e8('0x4')]=null;this['position']=0x1;this['count']=0x1;this[_0x43e8('0x5')]=![];this[_0x43e8('0x6')]=null;this[_0x43e8('0x7')]=![];this[_0x43e8('0x8')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x43e8('0x9')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x43e8('0xa')]='';this[_0x43e8('0xb')]='';this[_0x43e8('0xc')]='';this[_0x43e8('0xd')]='';this[_0x43e8('0xe')]='';this['holdtime']=0x0;this[_0x43e8('0xf')]=![];this[_0x43e8('0x10')]='';this[_0x43e8('0x11')]='voice';this[_0x43e8('0x12')]=0x0;this['variables']={};}module[_0x43e8('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8572b8f..0fd3fab 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 _0xafb4=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xafb4,0x1be));var _0x4afb=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0xafb4[_0x549278];return _0x1ea9a1;};'use strict';function SalesforceAccount(_0x1194e5){this['id']=_0x1194e5['id']||0x0;this['name']=_0x1194e5[_0x4afb('0x0')]||'';this[_0x4afb('0x1')]=_0x1194e5[_0x4afb('0x1')]||'';this['remoteUri']=_0x1194e5[_0x4afb('0x2')]||'';this['password']=_0x1194e5[_0x4afb('0x3')]||'';this[_0x4afb('0x4')]=_0x1194e5[_0x4afb('0x4')]||'';this[_0x4afb('0x5')]=_0x1194e5['clientSecret']||'';this[_0x4afb('0x6')]=_0x1194e5[_0x4afb('0x6')]||'';this[_0x4afb('0x7')]=_0x1194e5[_0x4afb('0x7')]||_0x4afb('0x8');this[_0x4afb('0x9')]=_0x1194e5[_0x4afb('0x9')]||'';this['Configurations']=_0x1194e5[_0x4afb('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x9d6f=['securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x9d6f,0x12e));var _0xf9d6=function(_0x4823f6,_0x50111d){_0x4823f6=_0x4823f6-0x0;var _0x37d56b=_0x9d6f[_0x4823f6];return _0x37d56b;};'use strict';function SalesforceAccount(_0x38853d){this['id']=_0x38853d['id']||0x0;this[_0xf9d6('0x0')]=_0x38853d[_0xf9d6('0x0')]||'';this['username']=_0x38853d[_0xf9d6('0x1')]||'';this[_0xf9d6('0x2')]=_0x38853d[_0xf9d6('0x2')]||'';this[_0xf9d6('0x3')]=_0x38853d['password']||'';this[_0xf9d6('0x4')]=_0x38853d[_0xf9d6('0x4')]||'';this['clientSecret']=_0x38853d[_0xf9d6('0x5')]||'';this[_0xf9d6('0x6')]=_0x38853d[_0xf9d6('0x6')]||'';this['type']=_0x38853d[_0xf9d6('0x7')]||'integrationTab';this[_0xf9d6('0x8')]=_0x38853d['serverUrl']||'';this[_0xf9d6('0x9')]=_0x38853d[_0xf9d6('0x9')]||{};}module[_0xf9d6('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 bebd1bd..2a62a29 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 _0xfba0=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1909e6,_0x25aff7){var _0x543b11=function(_0x3ed8b8){while(--_0x3ed8b8){_0x1909e6['push'](_0x1909e6['shift']());}};_0x543b11(++_0x25aff7);}(_0xfba0,0x1c6));var _0x0fba=function(_0x1043eb,_0xa099ad){_0x1043eb=_0x1043eb-0x0;var _0x4de8ed=_0xfba0[_0x1043eb];return _0x4de8ed;};'use strict';function ServicenowAccount(_0x1db8c0){this['id']=_0x1db8c0['id']||0x0;this[_0x0fba('0x0')]=_0x1db8c0['name']||'';this[_0x0fba('0x1')]=_0x1db8c0[_0x0fba('0x1')]||'';this[_0x0fba('0x2')]=_0x1db8c0['password']||'';this['remoteUri']=_0x1db8c0[_0x0fba('0x3')]||'';this[_0x0fba('0x4')]=_0x1db8c0[_0x0fba('0x4')]||'';this[_0x0fba('0x5')]=_0x1db8c0[_0x0fba('0x5')]||{};}module[_0x0fba('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x3b1c=['username','password','remoteUri','Configurations','exports','name'];(function(_0x349a83,_0x4a3854){var _0x2234a8=function(_0x190146){while(--_0x190146){_0x349a83['push'](_0x349a83['shift']());}};_0x2234a8(++_0x4a3854);}(_0x3b1c,0x107));var _0xc3b1=function(_0x1ce5cd,_0x4fd455){_0x1ce5cd=_0x1ce5cd-0x0;var _0x42ea63=_0x3b1c[_0x1ce5cd];return _0x42ea63;};'use strict';function ServicenowAccount(_0x448aff){this['id']=_0x448aff['id']||0x0;this['name']=_0x448aff[_0xc3b1('0x0')]||'';this[_0xc3b1('0x1')]=_0x448aff[_0xc3b1('0x1')]||'';this[_0xc3b1('0x2')]=_0x448aff[_0xc3b1('0x2')]||'';this[_0xc3b1('0x3')]=_0x448aff[_0xc3b1('0x3')]||'';this['serverUrl']=_0x448aff['serverUrl']||'';this['Configurations']=_0x448aff[_0xc3b1('0x4')]||{};}module[_0xc3b1('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 0a938b5..8e9f1b5 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 _0x37ab=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x1aef5f,_0x135d18){var _0x3b13a2=function(_0x4817a3){while(--_0x4817a3){_0x1aef5f['push'](_0x1aef5f['shift']());}};_0x3b13a2(++_0x135d18);}(_0x37ab,0x193));var _0xb37a=function(_0x1df803,_0x25192d){_0x1df803=_0x1df803-0x0;var _0x20ef12=_0x37ab[_0x1df803];return _0x20ef12;};'use strict';function SugarcrmAccount(_0x31ad56){this['id']=_0x31ad56['id']||0x0;this[_0xb37a('0x0')]=_0x31ad56[_0xb37a('0x0')]||'';this[_0xb37a('0x1')]=_0x31ad56['username']||'';this[_0xb37a('0x2')]=_0x31ad56[_0xb37a('0x2')]||'';this[_0xb37a('0x3')]=_0x31ad56[_0xb37a('0x3')]||'';this['serverUrl']=_0x31ad56[_0xb37a('0x4')]||'';this[_0xb37a('0x5')]=_0x31ad56['Configurations']||{};}module[_0xb37a('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xcee8=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x58ed93,_0xdfefd0){var _0x45ea0f=function(_0x56681b){while(--_0x56681b){_0x58ed93['push'](_0x58ed93['shift']());}};_0x45ea0f(++_0xdfefd0);}(_0xcee8,0xb1));var _0x8cee=function(_0x1f3bd4,_0x15ec60){_0x1f3bd4=_0x1f3bd4-0x0;var _0x52eb8e=_0xcee8[_0x1f3bd4];return _0x52eb8e;};'use strict';function SugarcrmAccount(_0x40021e){this['id']=_0x40021e['id']||0x0;this[_0x8cee('0x0')]=_0x40021e[_0x8cee('0x0')]||'';this[_0x8cee('0x1')]=_0x40021e[_0x8cee('0x1')]||'';this[_0x8cee('0x2')]=_0x40021e['password']||'';this[_0x8cee('0x3')]=_0x40021e[_0x8cee('0x3')]||'';this[_0x8cee('0x4')]=_0x40021e[_0x8cee('0x4')]||'';this['Configurations']=_0x40021e[_0x8cee('0x5')]||{};}module[_0x8cee('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 7d97d90..81e2bdd 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 _0x1f8f=['accountcode','state','unknown','stateTime','status','address','name'];(function(_0x594fae,_0x1f5cda){var _0x3dfcac=function(_0xf806c6){while(--_0xf806c6){_0x594fae['push'](_0x594fae['shift']());}};_0x3dfcac(++_0x1f5cda);}(_0x1f8f,0x19c));var _0xf1f8=function(_0x2f241e,_0x3c11ac){_0x2f241e=_0x2f241e-0x0;var _0x254eb4=_0x1f8f[_0x2f241e];return _0x254eb4;};'use strict';function Telephone(_0x32eb9c){this['id']=_0x32eb9c['id']||0x0;this[_0xf1f8('0x0')]=_0x32eb9c['name']||'';this[_0xf1f8('0x1')]=_0x32eb9c[_0xf1f8('0x1')]||'';this[_0xf1f8('0x2')]=_0xf1f8('0x3');this[_0xf1f8('0x4')]=0x0;this[_0xf1f8('0x5')]='unknown';this[_0xf1f8('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xff73=['stateTime','status','address','exports','name','accountcode','state','unknown'];(function(_0x500470,_0x592fe9){var _0x4764df=function(_0x5f98b8){while(--_0x5f98b8){_0x500470['push'](_0x500470['shift']());}};_0x4764df(++_0x592fe9);}(_0xff73,0x1d4));var _0x3ff7=function(_0x223528,_0x420387){_0x223528=_0x223528-0x0;var _0x2527c4=_0xff73[_0x223528];return _0x2527c4;};'use strict';function Telephone(_0x29ffed){this['id']=_0x29ffed['id']||0x0;this[_0x3ff7('0x0')]=_0x29ffed['name']||'';this[_0x3ff7('0x1')]=_0x29ffed[_0x3ff7('0x1')]||'';this[_0x3ff7('0x2')]=_0x3ff7('0x3');this[_0x3ff7('0x4')]=0x0;this[_0x3ff7('0x5')]='unknown';this[_0x3ff7('0x6')]='';}module[_0x3ff7('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 339e730..21ba3dc 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(_0x2bb876,_0x31c991){var _0x58883b=function(_0x346b4c){while(--_0x346b4c){_0x2bb876['push'](_0x2bb876['shift']());}};_0x58883b(++_0x31c991);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x939e08,_0x399927){var _0x4186ee=function(_0xe8ce59){while(--_0xe8ce59){_0x939e08['push'](_0x939e08['shift']());}};_0x4186ee(++_0x399927);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 8586a2e..c8f6591 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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 +var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x5eb8,0xb0));var _0x85eb=function(_0xe36749,_0x2a45c8){_0xe36749=_0xe36749-0x0;var _0x5d86b7=_0x5eb8[_0xe36749];return _0x5d86b7;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 9070bf2..0c9e60a 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 _0x9c8b=['domain','domainport','stateRegistry','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','split','host','port'];(function(_0x2aabcd,_0x4c2a05){var _0x2eb03b=function(_0x117e28){while(--_0x117e28){_0x2aabcd['push'](_0x2aabcd['shift']());}};_0x2eb03b(++_0x4c2a05);}(_0x9c8b,0x113));var _0xb9c8=function(_0x43af6f,_0x3af2f3){_0x43af6f=_0x43af6f-0x0;var _0x263537=_0x9c8b[_0x43af6f];return _0x263537;};'use strict';function Trunk(_0x4447c){this['id']=_0x4447c['id']||0x0;this['active']=_0x4447c[_0xb9c8('0x0')]||![];this[_0xb9c8('0x1')]=_0x4447c['name']||'';this[_0xb9c8('0x2')]=_0xb9c8('0x3');this[_0xb9c8('0x4')]=0x0;this[_0xb9c8('0x5')]=_0xb9c8('0x3');this[_0xb9c8('0x6')]=_0x4447c['registry']&&_0x4447c[_0xb9c8('0x6')]['indexOf'](':')?_0x4447c['registry'][_0xb9c8('0x7')](':')[0x0]:'';this[_0xb9c8('0x8')]='';this[_0xb9c8('0x9')]='';this[_0xb9c8('0xa')]='';this[_0xb9c8('0xb')]='';this['refresh']='';this[_0xb9c8('0xc')]=_0xb9c8('0x3');this['registrationtime']='';this['address']='';this[_0xb9c8('0xd')]=_0x4447c[_0xb9c8('0xd')]||'';}module[_0xb9c8('0xe')]=Trunk; \ No newline at end of file +var _0xcf9a=['exports','active','name','state','unknown','stateTime','status','registry','split','host','port','domain','domainport','refresh','registrationtime','address','defaultuser'];(function(_0x5916f0,_0x5397c6){var _0x49a276=function(_0x35b96b){while(--_0x35b96b){_0x5916f0['push'](_0x5916f0['shift']());}};_0x49a276(++_0x5397c6);}(_0xcf9a,0x199));var _0xacf9=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xcf9a[_0x1d1779];return _0x2377e9;};'use strict';function Trunk(_0x5e267c){this['id']=_0x5e267c['id']||0x0;this[_0xacf9('0x0')]=_0x5e267c['active']||![];this[_0xacf9('0x1')]=_0x5e267c[_0xacf9('0x1')]||'';this[_0xacf9('0x2')]=_0xacf9('0x3');this[_0xacf9('0x4')]=0x0;this[_0xacf9('0x5')]='unknown';this[_0xacf9('0x6')]=_0x5e267c[_0xacf9('0x6')]&&_0x5e267c[_0xacf9('0x6')]['indexOf'](':')?_0x5e267c[_0xacf9('0x6')][_0xacf9('0x7')](':')[0x0]:'';this[_0xacf9('0x8')]='';this[_0xacf9('0x9')]='';this[_0xacf9('0xa')]='';this[_0xacf9('0xb')]='';this[_0xacf9('0xc')]='';this['stateRegistry']=_0xacf9('0x3');this[_0xacf9('0xd')]='';this[_0xacf9('0xe')]='';this[_0xacf9('0xf')]=_0x5e267c[_0xacf9('0xf')]||'';}module[_0xacf9('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0ef34c7..4542fbc 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 _0x7e42=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x47799a,_0x2d0a9d){var _0x5d25f2=function(_0x8fab94){while(--_0x8fab94){_0x47799a['push'](_0x47799a['shift']());}};_0x5d25f2(++_0x2d0a9d);}(_0x7e42,0xee));var _0x27e4=function(_0x264b9d,_0x276056){_0x264b9d=_0x264b9d-0x0;var _0x149b91=_0x7e42[_0x264b9d];return _0x149b91;};'use strict';function voiceExtension(_0x40b3b0){this['id']=_0x40b3b0['id']||0x0;this[_0x27e4('0x0')]=_0x40b3b0[_0x27e4('0x0')]||'';this['recordingFormat']=_0x40b3b0[_0x27e4('0x1')]||'none';this[_0x27e4('0x2')]=_0x40b3b0[_0x27e4('0x2')]||![];}module[_0x27e4('0x3')]=voiceExtension; \ No newline at end of file +var _0xd4c4=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x2b71ac,_0x5aeeb5){var _0xe9c88f=function(_0x12ef1f){while(--_0x12ef1f){_0x2b71ac['push'](_0x2b71ac['shift']());}};_0xe9c88f(++_0x5aeeb5);}(_0xd4c4,0x136));var _0x4d4c=function(_0x4ffa11,_0x120051){_0x4ffa11=_0x4ffa11-0x0;var _0x1f669d=_0xd4c4[_0x4ffa11];return _0x1f669d;};'use strict';function voiceExtension(_0x3045a6){this['id']=_0x3045a6['id']||0x0;this[_0x4d4c('0x0')]=_0x3045a6['exten']||'';this[_0x4d4c('0x1')]=_0x3045a6['recordingFormat']||_0x4d4c('0x2');this[_0x4d4c('0x3')]=_0x3045a6['mandatoryDisposition']||![];}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 90e466d..8caf790 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 _0x60a7=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','acw','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x60a7,0x115));var _0x760a=function(_0x3a370b,_0x52a6a9){_0x3a370b=_0x3a370b-0x0;var _0x2ae6a3=_0x60a7[_0x3a370b];return _0x2ae6a3;};'use strict';var statusDesc=[_0x760a('0x0'),_0x760a('0x1'),_0x760a('0x2'),_0x760a('0x3'),_0x760a('0x4'),_0x760a('0x5'),_0x760a('0x6'),_0x760a('0x7'),_0x760a('0x8')];var monitorFormat={'wav':'wav','wav49':_0x760a('0x9'),'gsm':_0x760a('0xa')};var strategy={'rrmemory':_0x760a('0xb'),'roundrobin':'roundrobin'};function VoiceQueue(_0xdb8c32){this['id']=_0xdb8c32['id']||0x0;this[_0x760a('0xc')]=_0xdb8c32[_0x760a('0xc')]||'';this[_0x760a('0xd')]=_0xdb8c32[_0x760a('0xd')]||'';this['type']=_0xdb8c32[_0x760a('0xe')]||'inbound';this[_0x760a('0xf')]=0x0;this[_0x760a('0x10')]=0x0;this[_0x760a('0x11')]=0x0;this[_0x760a('0x12')]=0x0;this[_0x760a('0x13')]=0x0;this[_0x760a('0x14')]=0x0;this[_0x760a('0x15')]=0x0;this[_0x760a('0x16')]=0x0;this[_0x760a('0x17')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this['acw']=_0xdb8c32[_0x760a('0x18')]||![];this['acwTimeout']=_0xdb8c32[_0x760a('0x19')]||0xa;this['autopause']=_0xdb8c32['autopause']||'no';this[_0x760a('0x1a')]=!![];this[_0x760a('0x1b')]='';this[_0x760a('0x1c')]=0x0;this[_0x760a('0x1d')]=0x0;this[_0x760a('0x1e')]=_0xdb8c32[_0x760a('0x1e')]||null;this[_0x760a('0x1f')]=_0xdb8c32['dialGlobalInterval']?_0xdb8c32['dialGlobalInterval']:null;this[_0x760a('0x20')]=_0xdb8c32['dialActive'];this[_0x760a('0x21')]=_0xdb8c32[_0x760a('0x21')]||_0x760a('0x22');this[_0x760a('0x23')]=_0xdb8c32[_0x760a('0x23')]||0x0;this[_0x760a('0x24')]=_0xdb8c32[_0x760a('0x24')]||0x0;this['dialPowerLevel']=_0xdb8c32['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0xdb8c32['dialPredictiveOptimization']||_0x760a('0x25');this[_0x760a('0x26')]=_0xdb8c32[_0x760a('0x26')]||0.03;this[_0x760a('0x27')]=_0xdb8c32[_0x760a('0x27')]||0x258;this[_0x760a('0x28')]=_0xdb8c32[_0x760a('0x28')]||'anonymous';this[_0x760a('0x29')]=_0xdb8c32['dialOriginateCallerIdNumber']||_0x760a('0x2a');this[_0x760a('0x2b')]=_0xdb8c32[_0x760a('0x2b')]||0x1e;this[_0x760a('0x2c')]=_0xdb8c32[_0x760a('0x2c')]||_0x760a('0x2d');this['dialQueueTimeout']=_0xdb8c32[_0x760a('0x2e')]||0x3;this[_0x760a('0x2f')]=_0xdb8c32['dialQueueProject']||undefined;this[_0x760a('0x30')]=_0xdb8c32[_0x760a('0x30')]||0x3;this[_0x760a('0x31')]=_0xdb8c32[_0x760a('0x31')]||0x96;this[_0x760a('0x32')]=_0xdb8c32[_0x760a('0x32')]||0x3;this[_0x760a('0x33')]=_0xdb8c32[_0x760a('0x33')]||0x96;this['dialNoAnswerMaxRetry']=_0xdb8c32['dialNoAnswerMaxRetry']||0x3;this[_0x760a('0x34')]=_0xdb8c32[_0x760a('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xdb8c32['dialNoSuchNumberMaxRetry']||0x3;this[_0x760a('0x35')]=_0xdb8c32[_0x760a('0x35')]||0x96;this[_0x760a('0x36')]=_0xdb8c32['dialDropMaxRetry']||0x3;this[_0x760a('0x37')]=_0xdb8c32[_0x760a('0x37')]||0x96;this[_0x760a('0x38')]=_0xdb8c32[_0x760a('0x38')]||0x3;this['dialAbandonedRetryFrequency']=_0xdb8c32['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0xdb8c32['dialMachineMaxRetry']||0x3;this[_0x760a('0x39')]=_0xdb8c32[_0x760a('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0xdb8c32[_0x760a('0x3a')]||0x3;this[_0x760a('0x3b')]=_0xdb8c32[_0x760a('0x3b')]||0x96;this[_0x760a('0x3c')]=_0xdb8c32[_0x760a('0x3c')]||0x3;this[_0x760a('0x3d')]=_0xdb8c32[_0x760a('0x3d')]||0x4;this[_0x760a('0x3e')]=_0xdb8c32[_0x760a('0x3e')]?_0xdb8c32['Trunk']:undefined;this[_0x760a('0x3f')]=_0xdb8c32[_0x760a('0x3f')]?_0xdb8c32[_0x760a('0x3f')]:undefined;this['dialPrefix']=_0xdb8c32[_0x760a('0x40')]||undefined;this['Interval']=_0xdb8c32[_0x760a('0x41')]?_0xdb8c32['Interval']:undefined;this[_0x760a('0x42')]=_0xdb8c32[_0x760a('0x42')]||_0x760a('0x43');this[_0x760a('0x44')]=_0xdb8c32[_0x760a('0x44')]||undefined;this['dialCutDigit']=_0xdb8c32[_0x760a('0x45')]||undefined;this['strategy']=strategy[_0xdb8c32[_0x760a('0x46')]]||_0x760a('0xb');this['queueStatusComplete']=!![];this[_0x760a('0x47')]=_0xdb8c32[_0x760a('0x47')]||![];this['dialAMDInitialSilence']=_0xdb8c32['dialAMDInitialSilence'];this['dialAMDGreeting']=_0xdb8c32['dialAMDGreeting'];this[_0x760a('0x48')]=_0xdb8c32[_0x760a('0x48')];this['dialAMDTotalAnalysisTime']=_0xdb8c32[_0x760a('0x49')];this[_0x760a('0x4a')]=_0xdb8c32['dialAMDMinWordLength'];this[_0x760a('0x4b')]=_0xdb8c32['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0xdb8c32[_0x760a('0x4c')];this['dialAMDSilenceThreshold']=_0xdb8c32[_0x760a('0x4d')];this['dialAMDMaximumWordLength']=_0xdb8c32[_0x760a('0x4e')];this[_0x760a('0x4f')]=0x0;this[_0x760a('0x50')]=0x0;this['timeout']=_0xdb8c32[_0x760a('0x51')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x760a('0x52')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x760a('0x53')]=0x0;this[_0x760a('0x54')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x760a('0x55')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x760a('0x56')]=0x0;this[_0x760a('0x57')]=0x0;this[_0x760a('0x58')]=0x0;this[_0x760a('0x59')]=0x0;this[_0x760a('0x5a')]=0x0;this[_0x760a('0x5b')]=undefined;this[_0x760a('0x5c')]=undefined;this['handlePredictive']=undefined;this[_0x760a('0x5d')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x760a('0x5e')]=0x0;this[_0x760a('0x5f')]=0x0;this[_0x760a('0x60')]=0x0;this[_0x760a('0x61')]=0x0;this[_0x760a('0x62')]=0x0;this[_0x760a('0x63')]=0x0;this[_0x760a('0x64')]=0x0;this[_0x760a('0x65')]=_0xdb8c32[_0x760a('0x66')]||0x14;this[_0x760a('0x67')]=_0xdb8c32[_0x760a('0x66')]||0xa;this[_0x760a('0x68')]=0x0;this[_0x760a('0x69')]=0x0;this[_0x760a('0x6a')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x760a('0x6b')]=0x0;this[_0x760a('0x6c')]=_0xdb8c32[_0x760a('0x6c')]||0x1e;this[_0x760a('0x6d')]=_0xdb8c32[_0x760a('0x6d')]||![];this[_0x760a('0x6e')]=!!_0xdb8c32[_0x760a('0x6e')]||![];this[_0x760a('0x6f')]=!!_0xdb8c32[_0x760a('0x6f')]||![];this[_0x760a('0x70')]=_0xdb8c32[_0x760a('0x70')]||undefined;this[_0x760a('0x71')]=_0xdb8c32['dialAgiAfterHangupClient']||![];this[_0x760a('0x72')]=_0xdb8c32[_0x760a('0x72')]||![];this['monitor_format']=monitorFormat[_0xdb8c32['monitor_format']]?monitorFormat[_0xdb8c32[_0x760a('0xd')]]:undefined;this['mandatoryDisposition']=_0xdb8c32[_0x760a('0x73')]||![];this[_0x760a('0x74')]=_0xdb8c32[_0x760a('0x74')]?_0xdb8c32['mandatoryDispositionPause']:undefined;}module[_0x760a('0x75')]=VoiceQueue; \ No newline at end of file +var _0xc346=['predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav49','rrmemory','roundrobin','name','waiting','total','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xc346,0x10e));var _0x6c34=function(_0x543c66,_0x1f6734){_0x543c66=_0x543c66-0x0;var _0x17b470=_0xc346[_0x543c66];return _0x17b470;};'use strict';var statusDesc=[_0x6c34('0x0'),_0x6c34('0x1'),_0x6c34('0x2'),_0x6c34('0x3'),_0x6c34('0x4'),_0x6c34('0x5'),_0x6c34('0x6'),_0x6c34('0x7'),_0x6c34('0x8')];var monitorFormat={'wav':'wav','wav49':_0x6c34('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0x6c34('0xa'),'roundrobin':_0x6c34('0xb')};function VoiceQueue(_0x136c4c){this['id']=_0x136c4c['id']||0x0;this[_0x6c34('0xc')]=_0x136c4c[_0x6c34('0xc')]||'';this['monitor_format']=_0x136c4c['monitor_format']||'';this['type']=_0x136c4c['type']||'inbound';this[_0x6c34('0xd')]=0x0;this['talking']=0x0;this[_0x6c34('0xe')]=0x0;this['answered']=0x0;this[_0x6c34('0xf')]=0x0;this[_0x6c34('0x10')]=0x0;this[_0x6c34('0x11')]=0x0;this['unmanaged']=0x0;this[_0x6c34('0x12')]=0x0;this[_0x6c34('0x13')]=0x0;this[_0x6c34('0x14')]=0x0;this[_0x6c34('0x15')]=_0x136c4c[_0x6c34('0x15')]||![];this['acwTimeout']=_0x136c4c[_0x6c34('0x16')]||0xa;this[_0x6c34('0x17')]=_0x136c4c[_0x6c34('0x17')]||'no';this[_0x6c34('0x18')]=!![];this[_0x6c34('0x19')]='';this[_0x6c34('0x1a')]=0x0;this[_0x6c34('0x1b')]=0x0;this['dialTimezone']=_0x136c4c[_0x6c34('0x1c')]||null;this[_0x6c34('0x1d')]=_0x136c4c[_0x6c34('0x1d')]?_0x136c4c[_0x6c34('0x1d')]:null;this[_0x6c34('0x1e')]=_0x136c4c['dialActive'];this[_0x6c34('0x1f')]=_0x136c4c[_0x6c34('0x1f')]||_0x6c34('0x20');this[_0x6c34('0x21')]=_0x136c4c['dialLimitChannel']||0x0;this[_0x6c34('0x22')]=_0x136c4c['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x136c4c[_0x6c34('0x23')]||0x1;this[_0x6c34('0x24')]=_0x136c4c[_0x6c34('0x24')]||'dropRate';this[_0x6c34('0x25')]=_0x136c4c['dialPredictiveOptimizationPercentage']||0.03;this[_0x6c34('0x26')]=_0x136c4c[_0x6c34('0x26')]||0x258;this[_0x6c34('0x27')]=_0x136c4c[_0x6c34('0x27')]||_0x6c34('0x28');this['dialOriginateCallerIdNumber']=_0x136c4c[_0x6c34('0x29')]||'anonymous';this[_0x6c34('0x2a')]=_0x136c4c['dialOriginateTimeout']||0x1e;this[_0x6c34('0x2b')]=_0x136c4c[_0x6c34('0x2b')]||_0x6c34('0x2c');this['dialQueueTimeout']=_0x136c4c[_0x6c34('0x2d')]||0x3;this[_0x6c34('0x2e')]=_0x136c4c[_0x6c34('0x2e')]||undefined;this[_0x6c34('0x2f')]=_0x136c4c['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x136c4c[_0x6c34('0x30')]||0x96;this[_0x6c34('0x31')]=_0x136c4c[_0x6c34('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x136c4c[_0x6c34('0x32')]||0x96;this[_0x6c34('0x33')]=_0x136c4c[_0x6c34('0x33')]||0x3;this[_0x6c34('0x34')]=_0x136c4c['dialNoAnswerRetryFrequency']||0x96;this[_0x6c34('0x35')]=_0x136c4c[_0x6c34('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x136c4c[_0x6c34('0x36')]||0x96;this[_0x6c34('0x37')]=_0x136c4c[_0x6c34('0x37')]||0x3;this[_0x6c34('0x38')]=_0x136c4c[_0x6c34('0x38')]||0x96;this[_0x6c34('0x39')]=_0x136c4c[_0x6c34('0x39')]||0x3;this['dialAbandonedRetryFrequency']=_0x136c4c[_0x6c34('0x3a')]||0x96;this[_0x6c34('0x3b')]=_0x136c4c[_0x6c34('0x3b')]||0x3;this[_0x6c34('0x3c')]=_0x136c4c[_0x6c34('0x3c')]||0x96;this[_0x6c34('0x3d')]=_0x136c4c['dialAgentRejectMaxRetry']||0x3;this[_0x6c34('0x3e')]=_0x136c4c[_0x6c34('0x3e')]||0x96;this[_0x6c34('0x3f')]=_0x136c4c[_0x6c34('0x3f')]||0x3;this[_0x6c34('0x40')]=_0x136c4c['dialGlobalMaxRetry']||0x4;this[_0x6c34('0x41')]=_0x136c4c[_0x6c34('0x41')]?_0x136c4c['Trunk']:undefined;this[_0x6c34('0x42')]=_0x136c4c[_0x6c34('0x42')]?_0x136c4c['TrunkBackup']:undefined;this[_0x6c34('0x43')]=_0x136c4c['dialPrefix']||undefined;this[_0x6c34('0x44')]=_0x136c4c[_0x6c34('0x44')]?_0x136c4c[_0x6c34('0x44')]:undefined;this[_0x6c34('0x45')]=_0x136c4c['dialOrderByScheduledAt']||_0x6c34('0x46');this[_0x6c34('0x47')]=_0x136c4c[_0x6c34('0x47')]||undefined;this[_0x6c34('0x48')]=_0x136c4c[_0x6c34('0x48')]||undefined;this[_0x6c34('0x49')]=strategy[_0x136c4c[_0x6c34('0x49')]]||'rrmemory';this[_0x6c34('0x4a')]=!![];this[_0x6c34('0x4b')]=_0x136c4c[_0x6c34('0x4b')]||![];this[_0x6c34('0x4c')]=_0x136c4c[_0x6c34('0x4c')];this[_0x6c34('0x4d')]=_0x136c4c['dialAMDGreeting'];this[_0x6c34('0x4e')]=_0x136c4c[_0x6c34('0x4e')];this[_0x6c34('0x4f')]=_0x136c4c[_0x6c34('0x4f')];this[_0x6c34('0x50')]=_0x136c4c['dialAMDMinWordLength'];this[_0x6c34('0x51')]=_0x136c4c[_0x6c34('0x51')];this[_0x6c34('0x52')]=_0x136c4c[_0x6c34('0x52')];this[_0x6c34('0x53')]=_0x136c4c[_0x6c34('0x53')];this[_0x6c34('0x54')]=_0x136c4c[_0x6c34('0x54')];this[_0x6c34('0x55')]=0x0;this[_0x6c34('0x56')]=0x0;this['timeout']=_0x136c4c[_0x6c34('0x57')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x6c34('0x58')]=0x0;this[_0x6c34('0x59')]=0x0;this[_0x6c34('0x5a')]=0x0;this[_0x6c34('0x5b')]=0x0;this[_0x6c34('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x6c34('0x5d')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x6c34('0x5e')]=0x0;this[_0x6c34('0x5f')]=0x0;this[_0x6c34('0x60')]=0x0;this[_0x6c34('0x61')]=undefined;this[_0x6c34('0x62')]=undefined;this['handlePredictive']=undefined;this[_0x6c34('0x63')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x6c34('0x64')]=0x0;this[_0x6c34('0x65')]=0x0;this[_0x6c34('0x66')]=0x0;this[_0x6c34('0x67')]=0x0;this[_0x6c34('0x68')]=0x0;this[_0x6c34('0x69')]=0x0;this[_0x6c34('0x6a')]=0x0;this['predictiveIntervalMaxThreshold']=_0x136c4c['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x6c34('0x6b')]=_0x136c4c[_0x6c34('0x6c')]||0xa;this[_0x6c34('0x6d')]=0x0;this[_0x6c34('0x6e')]=0x0;this[_0x6c34('0x6f')]=0x1;this[_0x6c34('0x70')]=0x0;this[_0x6c34('0x71')]=0x0;this[_0x6c34('0x72')]=0x0;this[_0x6c34('0x73')]=0x0;this[_0x6c34('0x74')]=_0x136c4c['dialRecallMeTimeout']||0x1e;this[_0x6c34('0x75')]=_0x136c4c[_0x6c34('0x75')]||![];this['dialPreviewAutoRecallMe']=!!_0x136c4c[_0x6c34('0x76')]||![];this[_0x6c34('0x77')]=!!_0x136c4c[_0x6c34('0x77')]||![];this['dialQueueProject2']=_0x136c4c[_0x6c34('0x78')]||undefined;this[_0x6c34('0x79')]=_0x136c4c[_0x6c34('0x79')]||![];this['dialAgiAfterHangupAgent']=_0x136c4c[_0x6c34('0x7a')]||![];this[_0x6c34('0x7b')]=monitorFormat[_0x136c4c[_0x6c34('0x7b')]]?monitorFormat[_0x136c4c['monitor_format']]:undefined;this[_0x6c34('0x7c')]=_0x136c4c[_0x6c34('0x7c')]||![];this['mandatoryDispositionPause']=_0x136c4c[_0x6c34('0x7d')]?_0x136c4c[_0x6c34('0x7d')]:undefined;}module[_0x6c34('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 1cf78bc..9351a4d 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 _0xc349=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x234660,_0x4b44fa){var _0x1929de=function(_0x279874){while(--_0x279874){_0x234660['push'](_0x234660['shift']());}};_0x1929de(++_0x4b44fa);}(_0xc349,0x14e));var _0x9c34=function(_0x2b63e1,_0xa6a299){_0x2b63e1=_0x2b63e1-0x0;var _0x130738=_0xc349[_0x2b63e1];return _0x130738;};'use strict';function VtigerAccount(_0x19ebd6){this['id']=_0x19ebd6['id']||0x0;this[_0x9c34('0x0')]=_0x19ebd6[_0x9c34('0x0')]||'';this['username']=_0x19ebd6[_0x9c34('0x1')]||'';this[_0x9c34('0x2')]=_0x19ebd6[_0x9c34('0x2')]||'';this['remoteUri']=_0x19ebd6[_0x9c34('0x3')]||'';this['serverUrl']=_0x19ebd6[_0x9c34('0x4')]||'';this[_0x9c34('0x5')]=_0x19ebd6[_0x9c34('0x5')]||{};}module[_0x9c34('0x6')]=VtigerAccount; \ No newline at end of file +var _0xcc2f=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x24fe48,_0x10e97e){var _0x51e7d5=function(_0x5826c1){while(--_0x5826c1){_0x24fe48['push'](_0x24fe48['shift']());}};_0x51e7d5(++_0x10e97e);}(_0xcc2f,0xa2));var _0xfcc2=function(_0x273863,_0x477ae4){_0x273863=_0x273863-0x0;var _0x5e2c7a=_0xcc2f[_0x273863];return _0x5e2c7a;};'use strict';function VtigerAccount(_0x4de4e0){this['id']=_0x4de4e0['id']||0x0;this[_0xfcc2('0x0')]=_0x4de4e0[_0xfcc2('0x0')]||'';this[_0xfcc2('0x1')]=_0x4de4e0['username']||'';this[_0xfcc2('0x2')]=_0x4de4e0[_0xfcc2('0x2')]||'';this['remoteUri']=_0x4de4e0[_0xfcc2('0x3')]||'';this['serverUrl']=_0x4de4e0[_0xfcc2('0x4')]||'';this[_0xfcc2('0x5')]=_0x4de4e0[_0xfcc2('0x5')]||{};}module[_0xfcc2('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 896572d..3ad50d9 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 _0xdd4f=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x6576cc,_0x261556){var _0x1a5069=function(_0x2870ac){while(--_0x2870ac){_0x6576cc['push'](_0x6576cc['shift']());}};_0x1a5069(++_0x261556);}(_0xdd4f,0x144));var _0xfdd4=function(_0x40aec9,_0x43ab43){_0x40aec9=_0x40aec9-0x0;var _0x37f182=_0xdd4f[_0x40aec9];return _0x37f182;};'use strict';function ZendeskAccount(_0x475278){this['id']=_0x475278['id']||0x0;this[_0xfdd4('0x0')]=_0x475278['name']||'';this[_0xfdd4('0x1')]=_0x475278[_0xfdd4('0x1')]||'';this[_0xfdd4('0x2')]=_0x475278[_0xfdd4('0x2')]||'';this[_0xfdd4('0x3')]=_0x475278['token']||'';this['remoteUri']=_0x475278[_0xfdd4('0x4')]||'';this[_0xfdd4('0x5')]=_0x475278[_0xfdd4('0x5')]||'';this[_0xfdd4('0x6')]=_0x475278[_0xfdd4('0x6')]||_0xfdd4('0x7');this['serverUrl']=_0x475278[_0xfdd4('0x8')]||'';this['Configurations']=_0x475278[_0xfdd4('0x9')]||{};}module[_0xfdd4('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xbba4=['username','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x2ae2bc,_0x177514){var _0x53c290=function(_0x3ac4c0){while(--_0x3ac4c0){_0x2ae2bc['push'](_0x2ae2bc['shift']());}};_0x53c290(++_0x177514);}(_0xbba4,0x1b7));var _0x4bba=function(_0x261683,_0x5b3903){_0x261683=_0x261683-0x0;var _0x54d771=_0xbba4[_0x261683];return _0x54d771;};'use strict';function ZendeskAccount(_0x3b725d){this['id']=_0x3b725d['id']||0x0;this['name']=_0x3b725d[_0x4bba('0x0')]||'';this['username']=_0x3b725d[_0x4bba('0x1')]||'';this['password']=_0x3b725d['password']||'';this['token']=_0x3b725d[_0x4bba('0x2')]||'';this[_0x4bba('0x3')]=_0x3b725d[_0x4bba('0x3')]||'';this[_0x4bba('0x4')]=_0x3b725d[_0x4bba('0x4')]||'';this['type']=_0x3b725d[_0x4bba('0x5')]||_0x4bba('0x6');this['serverUrl']=_0x3b725d[_0x4bba('0x7')]||'';this[_0x4bba('0x8')]=_0x3b725d[_0x4bba('0x8')]||{};}module[_0x4bba('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index de8874c..a96477e 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 _0xba1f=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xba1f,0xe6));var _0xfba1=function(_0xbfacc,_0x205ba2){_0xbfacc=_0xbfacc-0x0;var _0x2f7e3f=_0xba1f[_0xbfacc];return _0x2f7e3f;};'use strict';function ZohoAccount(_0x760895){this['id']=_0x760895['id']||0x0;this[_0xfba1('0x0')]=_0x760895['name']||'';this[_0xfba1('0x1')]=_0x760895[_0xfba1('0x1')]||'';this[_0xfba1('0x2')]=_0x760895[_0xfba1('0x2')]||'';this[_0xfba1('0x3')]=_0x760895[_0xfba1('0x3')]||'';this[_0xfba1('0x4')]=_0x760895[_0xfba1('0x4')]||'';this[_0xfba1('0x5')]=_0x760895[_0xfba1('0x5')]||'';this[_0xfba1('0x6')]=_0x760895[_0xfba1('0x6')]||'';this['code']=_0x760895[_0xfba1('0x7')]||'';this[_0xfba1('0x8')]=_0x760895[_0xfba1('0x8')]||'';this['Configurations']=_0x760895[_0xfba1('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xd446=['Configurations','exports','name','host','zone','clientId','clientSecret','serverUrl'];(function(_0x5413f5,_0x3154c7){var _0x639288=function(_0x4b85e9){while(--_0x4b85e9){_0x5413f5['push'](_0x5413f5['shift']());}};_0x639288(++_0x3154c7);}(_0xd446,0x19a));var _0x6d44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd446[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x9bf7b3){this['id']=_0x9bf7b3['id']||0x0;this[_0x6d44('0x0')]=_0x9bf7b3[_0x6d44('0x0')]||'';this['description']=_0x9bf7b3['description']||'';this['host']=_0x9bf7b3[_0x6d44('0x1')]||'';this['zone']=_0x9bf7b3[_0x6d44('0x2')]||'';this[_0x6d44('0x3')]=_0x9bf7b3[_0x6d44('0x3')]||'';this[_0x6d44('0x4')]=_0x9bf7b3[_0x6d44('0x4')]||'';this[_0x6d44('0x5')]=_0x9bf7b3[_0x6d44('0x5')]||'';this['code']=_0x9bf7b3['code']||'';this['refreshToken']=_0x9bf7b3['refreshToken']||'';this[_0x6d44('0x6')]=_0x9bf7b3[_0x6d44('0x6')]||{};}module[_0x6d44('0x7')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 8c0480a..a6ea9e1 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 _0xb44a=['recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','calleridname','number','exports','moment','isNil','string','uniqueid','idContact','queue','name','type','membername','Agent','channelAgent','format','SIP/%s','Contact','lastName','active','calleridnum','phone','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat'];(function(_0x57b90a,_0x246933){var _0x9b9abd=function(_0x347cc9){while(--_0x347cc9){_0x57b90a['push'](_0x57b90a['shift']());}};_0x9b9abd(++_0x246933);}(_0xb44a,0x1c2));var _0xab44=function(_0x53f37f,_0xfb0b18){_0x53f37f=_0x53f37f-0x0;var _0x2fe5f8=_0xb44a[_0x53f37f];return _0x2fe5f8;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xab44('0x0'));function checkNameSurname(_0x492c1a,_0x186fec,_0x5c825d){var _0x50cb3c='';if(!_[_0xab44('0x1')](_0x186fec)&&'string'===typeof _0x186fec){_0x50cb3c+=_0x186fec;}if(!_[_0xab44('0x1')](_0x5c825d)&&_0xab44('0x2')===typeof _0x5c825d){_0x50cb3c+='\x20'+_0x5c825d;}if(_0x50cb3c!==''){return _0x50cb3c;}return _0x492c1a;}function Action(_0x2e3662,_0x28681a,_0x2f3948,_0x3303b1,_0x3ead8d){this[_0xab44('0x3')]=_0x2f3948||undefined;this[_0xab44('0x4')]=_0x2e3662['id'];this[_0xab44('0x5')]=_0x28681a[_0xab44('0x6')];this[_0xab44('0x7')]=_0x28681a[_0xab44('0x7')];this['campaigntype']=_0xab44('0x5');this['dialAnswer']=![];this[_0xab44('0x8')]=_['isNil'](_0x2e3662['Agent'])?undefined:_0x2e3662[_0xab44('0x9')][_0xab44('0x6')];this[_0xab44('0xa')]=this[_0xab44('0x8')]?util[_0xab44('0xb')](_0xab44('0xc'),this['membername']):_0x3303b1||undefined;this['calleridname']=checkNameSurname(_0x2e3662[_0xab44('0xd')]['phone'],_0x2e3662[_0xab44('0xd')]['firstName'],_0x2e3662[_0xab44('0xd')][_0xab44('0xe')]);this[_0xab44('0xf')]=_0x2e3662[_0xab44('0xf')]||![];this[_0xab44('0x10')]=_0x2e3662[_0xab44('0x11')];this['scheduledat']=_0x2e3662['scheduledat'];this[_0xab44('0x12')]=_0x2e3662[_0xab44('0x12')]||0x0;this[_0xab44('0x13')]=_0x2e3662[_0xab44('0x13')]||0x0;this[_0xab44('0x14')]=_0x2e3662[_0xab44('0x14')]||0x0;this[_0xab44('0x15')]=(_0x2e3662[_0xab44('0x12')]||0x0)+(_0x2e3662[_0xab44('0x13')]||0x0)+(_0x2e3662[_0xab44('0x14')]||0x0)+(_0x2e3662[_0xab44('0x16')]||0x0)+(_0x2e3662['countdropretry']||0x0)+(_0x2e3662[_0xab44('0x17')]||0x0)+(_0x2e3662[_0xab44('0x18')]||0x0)+(_0x2e3662[_0xab44('0x19')]||0x0);this[_0xab44('0x16')]=_0x2e3662[_0xab44('0x16')]||0x0;this['countdropretry']=_0x2e3662[_0xab44('0x1a')]||0x0;this['countabandonedretry']=_0x2e3662[_0xab44('0x17')]||0x0;this[_0xab44('0x18')]=_0x2e3662[_0xab44('0x18')]||0x0;this[_0xab44('0x19')]=_0x2e3662['countagentrejectretry']||0x0;this[_0xab44('0x1b')]=_0x2e3662[_0xab44('0x1b')];this[_0xab44('0x1c')]=_0x2e3662[_0xab44('0x1c')];this[_0xab44('0x1d')]=_0x2e3662[_0xab44('0x1d')];this[_0xab44('0x1e')]=_0x2e3662['recallme'];this['ContactId']=_0x2e3662[_0xab44('0x1f')];this['ListId']=_0x2e3662[_0xab44('0x20')];this['UserId']=_[_0xab44('0x1')](_0x2e3662['Agent'])?_0x2e3662['UserId']:_0x2e3662[_0xab44('0x9')]['id'];this[_0xab44('0x21')]=_0x2e3662[_0xab44('0x21')];this[_0xab44('0x22')]='';this[_0xab44('0x23')]='';}Action['prototype'][_0xab44('0x24')]=function(){return util[_0xab44('0xb')]('\x22%s\x22\x20<%s>',this[_0xab44('0x25')],this[_0xab44('0x26')]);};module[_0xab44('0x27')]=Action; \ No newline at end of file +var _0xaebd=['scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','string','isNil','queue','name','type','campaigntype','dialAnswer','Agent','format','membername','calleridname','Contact','phone','firstName','active','calleridnum'];(function(_0x3e3736,_0x230846){var _0x411f18=function(_0x4bc76f){while(--_0x4bc76f){_0x3e3736['push'](_0x3e3736['shift']());}};_0x411f18(++_0x230846);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x4b951d,_0x1a53f6){_0x4b951d=_0x4b951d-0x0;var _0x2678ce=_0xaebd[_0x4b951d];return _0x2678ce;};'use strict';var util=require(_0xdaeb('0x0'));var _=require('lodash');var moment=require(_0xdaeb('0x1'));function checkNameSurname(_0xac84fd,_0x1312be,_0x18af69){var _0x198c72='';if(!_['isNil'](_0x1312be)&&_0xdaeb('0x2')===typeof _0x1312be){_0x198c72+=_0x1312be;}if(!_[_0xdaeb('0x3')](_0x18af69)&&_0xdaeb('0x2')===typeof _0x18af69){_0x198c72+='\x20'+_0x18af69;}if(_0x198c72!==''){return _0x198c72;}return _0xac84fd;}function Action(_0x1141fe,_0xee94f9,_0x4b7255,_0x3ea090,_0x3f7ba1){this['uniqueid']=_0x4b7255||undefined;this['idContact']=_0x1141fe['id'];this[_0xdaeb('0x4')]=_0xee94f9[_0xdaeb('0x5')];this[_0xdaeb('0x6')]=_0xee94f9['type'];this[_0xdaeb('0x7')]='queue';this[_0xdaeb('0x8')]=![];this['membername']=_[_0xdaeb('0x3')](_0x1141fe['Agent'])?undefined:_0x1141fe[_0xdaeb('0x9')][_0xdaeb('0x5')];this['channelAgent']=this['membername']?util[_0xdaeb('0xa')]('SIP/%s',this[_0xdaeb('0xb')]):_0x3ea090||undefined;this[_0xdaeb('0xc')]=checkNameSurname(_0x1141fe[_0xdaeb('0xd')][_0xdaeb('0xe')],_0x1141fe[_0xdaeb('0xd')][_0xdaeb('0xf')],_0x1141fe[_0xdaeb('0xd')]['lastName']);this['active']=_0x1141fe[_0xdaeb('0x10')]||![];this[_0xdaeb('0x11')]=_0x1141fe[_0xdaeb('0xe')];this[_0xdaeb('0x12')]=_0x1141fe['scheduledat'];this['countbusyretry']=_0x1141fe[_0xdaeb('0x13')]||0x0;this['countcongestionretry']=_0x1141fe['countcongestionretry']||0x0;this[_0xdaeb('0x14')]=_0x1141fe[_0xdaeb('0x14')]||0x0;this[_0xdaeb('0x15')]=(_0x1141fe[_0xdaeb('0x13')]||0x0)+(_0x1141fe[_0xdaeb('0x16')]||0x0)+(_0x1141fe[_0xdaeb('0x14')]||0x0)+(_0x1141fe['countnosuchnumberretry']||0x0)+(_0x1141fe[_0xdaeb('0x17')]||0x0)+(_0x1141fe['countabandonedretry']||0x0)+(_0x1141fe[_0xdaeb('0x18')]||0x0)+(_0x1141fe[_0xdaeb('0x19')]||0x0);this[_0xdaeb('0x1a')]=_0x1141fe['countnosuchnumberretry']||0x0;this['countdropretry']=_0x1141fe[_0xdaeb('0x17')]||0x0;this[_0xdaeb('0x1b')]=_0x1141fe[_0xdaeb('0x1b')]||0x0;this[_0xdaeb('0x18')]=_0x1141fe[_0xdaeb('0x18')]||0x0;this['countagentrejectretry']=_0x1141fe['countagentrejectretry']||0x0;this[_0xdaeb('0x1c')]=_0x1141fe[_0xdaeb('0x1c')];this[_0xdaeb('0x1d')]=_0x1141fe[_0xdaeb('0x1d')];this[_0xdaeb('0x1e')]=_0x1141fe['callbackat'];this[_0xdaeb('0x1f')]=_0x1141fe['recallme'];this[_0xdaeb('0x20')]=_0x1141fe[_0xdaeb('0x20')];this[_0xdaeb('0x21')]=_0x1141fe[_0xdaeb('0x21')];this[_0xdaeb('0x22')]=_['isNil'](_0x1141fe[_0xdaeb('0x9')])?_0x1141fe[_0xdaeb('0x22')]:_0x1141fe[_0xdaeb('0x9')]['id'];this['VoiceQueueId']=_0x1141fe['VoiceQueueId'];this[_0xdaeb('0x23')]='';this['originatecalleridname']='';}Action['prototype'][_0xdaeb('0x24')]=function(){return util[_0xdaeb('0xa')](_0xdaeb('0x25'),this['calleridname'],this['number']);};module[_0xdaeb('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index fad598d..81d7840 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=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','additional','countbusyretry','dialBusyMaxRetry','scheduledAt','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','status','SIP/%s','execRun','recallme','validateContact','isValid','phone','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','defaults','socket.io-emitter','redis','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require(_0x0a9e('0x9'));var Action=require(_0x0a9e('0xa'));var ut=require('./util/util');config['redis']=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0xc'))(new Redis(config[_0x0a9e('0xd')]));var Sequence=function(){};Sequence[_0x0a9e('0xe')][_0x0a9e('0xf')]=function(_0xfeb75b){this[_0x0a9e('0x10')]=this['tail']?this['tail']['finally'](_0xfeb75b):_0xfeb75b();};function Preview(_0x4cfe67){this[_0x0a9e('0x11')]=new Sequence();this[_0x0a9e('0x12')]=_0x4cfe67[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x4cfe67[_0x0a9e('0x14')];this[_0x0a9e('0x15')]={};this['agents']=_0x4cfe67[_0x0a9e('0x16')];this[_0x0a9e('0x17')]=0x0;ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x1b'),this['syncHangup'][_0x0a9e('0x1a')](this));ami['on']('hanguprequest',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')]['bind'](this));ami['on'](_0x0a9e('0x1f'),this['syncNewExten'][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x24'),this[_0x0a9e('0x25')][_0x0a9e('0x1a')](this));this[_0x0a9e('0x26')](this[_0x0a9e('0x12')]);}function emit(_0x4bb1e3,_0x2c3407,_0x155cce){io['to'](_0x4bb1e3)['emit'](_0x2c3407,_0x155cce);}function emitCampaignPreview(_0x20f109){if(_0x20f109['type']==='outbound'){var _0x3a02e1={'id':_0x20f109['id'],'name':_0x20f109[_0x0a9e('0x27')],'strategy':_0x20f109[_0x0a9e('0x28')],'answered':_0x20f109[_0x0a9e('0x29')],'available':_0x20f109['available'],'loggedIn':_0x20f109[_0x0a9e('0x2a')],'pTalking':_0x20f109[_0x0a9e('0x2b')],'sumBillable':_0x20f109[_0x0a9e('0x2c')],'sumDuration':_0x20f109[_0x0a9e('0x2d')],'sumHoldTime':_0x20f109[_0x0a9e('0x2e')]||0x0,'talking':_0x20f109[_0x0a9e('0x2f')],'total':_0x20f109[_0x0a9e('0x30')],'type':_0x20f109['type'],'unmanaged':_0x20f109['unmanaged'],'abandoned':_0x20f109[_0x0a9e('0x31')],'waiting':_0x20f109[_0x0a9e('0x32')],'loggedInDb':_0x20f109[_0x0a9e('0x33')],'dialActive':_0x20f109[_0x0a9e('0x34')],'dialMethod':_0x20f109['dialMethod'],'dialOriginateCallerIdName':_0x20f109[_0x0a9e('0x35')],'dialOriginateCallerIdNumber':_0x20f109['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x20f109[_0x0a9e('0x36')],'dialPrefix':_0x20f109['dialPrefix'],'outboundAnswerAgiCallsDay':_0x20f109[_0x0a9e('0x37')],'outboundAnswerCallsDay':_0x20f109[_0x0a9e('0x38')],'outboundBlacklistCallsDay':_0x20f109[_0x0a9e('0x39')],'outboundBusyCallsDay':_0x20f109[_0x0a9e('0x3a')],'outboundCongestionCallsDay':_0x20f109[_0x0a9e('0x3b')],'outboundDropCallsDayACS':_0x20f109[_0x0a9e('0x3c')],'outboundDropCallsDayCallersExit':_0x20f109[_0x0a9e('0x3d')],'outboundDropCallsDayTimeout':_0x20f109[_0x0a9e('0x3e')],'outboundNoAnswerCallsDay':_0x20f109['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x20f109[_0x0a9e('0x3f')],'outboundOriginateFailureCallsDay':_0x20f109[_0x0a9e('0x40')],'outboundReCallsDay':_0x20f109[_0x0a9e('0x41')],'outboundRejectCallsDay':_0x20f109[_0x0a9e('0x42')],'outboundUnknownCallsDay':_0x20f109['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x20f109[_0x0a9e('0x43')],'predictiveIntervalAnsweredCalls':_0x20f109[_0x0a9e('0x44')],'predictiveIntervalAvgHoldtime':_0x20f109[_0x0a9e('0x45')],'predictiveIntervalAvgTalktime':_0x20f109[_0x0a9e('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x20f109[_0x0a9e('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x20f109[_0x0a9e('0x48')],'predictiveIntervalErlangCalls':_0x20f109[_0x0a9e('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x20f109[_0x0a9e('0x4a')],'predictiveIntervalHitRate':_0x20f109[_0x0a9e('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x20f109['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x20f109[_0x0a9e('0x4c')],'predictiveIntervalAvailable':_0x20f109['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x20f109[_0x0a9e('0x4d')],'message':_0x20f109[_0x0a9e('0x4e')],'originated':_0x20f109[_0x0a9e('0x4f')],'erlangCalls':_0x20f109[_0x0a9e('0x50')],'erlangCallToSecond':_0x20f109[_0x0a9e('0x51')],'erlangAbandonmentRate':_0x20f109['erlangAbandonmentRate'],'erlangBusyFactor':_0x20f109[_0x0a9e('0x52')],'startPredictive':_0x20f109[_0x0a9e('0x53')],'startProgressive':_0x20f109[_0x0a9e('0x54')]};if(_0x20f109[_0x0a9e('0x55')]){_0x3a02e1[_0x0a9e('0x55')]={'id':_0x20f109[_0x0a9e('0x55')]['id'],'name':_0x20f109[_0x0a9e('0x55')][_0x0a9e('0x27')],'active':_0x20f109['Trunk'][_0x0a9e('0x56')],'callerid':_0x20f109['Trunk'][_0x0a9e('0x57')]};}if(_0x20f109[_0x0a9e('0x58')]){_0x3a02e1[_0x0a9e('0x58')]={'id':_0x20f109[_0x0a9e('0x58')]['id'],'name':_0x20f109['Interval'][_0x0a9e('0x27')]};}var _0xd1836d=md5(JSON[_0x0a9e('0x59')](_0x3a02e1));if(_0x20f109[_0x0a9e('0x3')]!==_0xd1836d){_0x20f109['md5']=_0xd1836d;emit(util['format'](_0x0a9e('0x5a'),_0x3a02e1['name']),_0x0a9e('0x5b'),_0x3a02e1);}}}function emitVoiceQueueChannelRemove(_0x3d9717){logger[_0x0a9e('0x5c')](_0x0a9e('0x5d'),JSON['stringify'](_0x3d9717));emit(util[_0x0a9e('0x5e')](_0x0a9e('0x5a'),_0x3d9717[_0x0a9e('0x27')]),'voice_queue_channel:remove',_0x3d9717);io[_0x0a9e('0x5f')](_0x0a9e('0x60'),_0x3d9717);}function notSendMessagesQueue(_0x289467){if(_0x289467['sendMessageOneNotActive']){if(_0x289467['originated']===0x0&&_0x289467[_0x0a9e('0x2b')]===0x0){_0x289467[_0x0a9e('0x61')]=![];_0x289467['available']=0x0;_0x289467[_0x0a9e('0x62')]=0x0;_0x289467[_0x0a9e('0x4e')]=_0x0a9e('0x63');ut[_0x0a9e('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x289467['name']+_0x0a9e('0x65'));}else{_0x289467[_0x0a9e('0x4e')]='IS_DISACTIVED';ut[_0x0a9e('0x64')](_0x0a9e('0x66'),_0x289467[_0x0a9e('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x289467);}}Preview[_0x0a9e('0xe')][_0x0a9e('0x26')]=function(){var _0x274e8e=this;setInterval(function(){_0x274e8e[_0x0a9e('0x67')]();},0x7cf);};Preview[_0x0a9e('0xe')][_0x0a9e('0x67')]=function(){var _0x2881b3=this[_0x0a9e('0x12')];this[_0x0a9e('0x17')]+=0x1;for(var _0x3da2cd in _0x2881b3){if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&(_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')||_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6a'))&&_0x2881b3[_0x3da2cd]['type']==='outbound'){if(this[_0x0a9e('0x17')]>0x7){this[_0x0a9e('0x17')]=0x0;this[_0x0a9e('0x6b')]();}}if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')&&_0x2881b3[_0x3da2cd][_0x0a9e('0x6c')]===_0x0a9e('0x6d')){if(_0x2881b3[_0x3da2cd][_0x0a9e('0x34')]){this[_0x0a9e('0x6e')](_0x2881b3[_0x3da2cd]);if(_0x2881b3[_0x3da2cd][_0x0a9e('0x6f')])this[_0x0a9e('0x70')](_0x2881b3[_0x3da2cd]);}else{notSendMessagesQueue(_0x2881b3[_0x3da2cd]);}}}};Preview['prototype'][_0x0a9e('0x71')]=function(_0x138b8b){var _0xdd268f=this;this[_0x0a9e('0x11')][_0x0a9e('0xf')](function(){if(!_[_0x0a9e('0x72')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b])){loggerAction[_0x0a9e('0x5c')]('[clearZombieChannels][talking]',_0x138b8b,_0x0a9e('0x73'),_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')],_0x0a9e('0x75'),JSON[_0x0a9e('0x59')](_0xdd268f['campaignsPreview'][_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]][_0x0a9e('0x4f')]),_0x0a9e('0x76'),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']][_0x0a9e('0x2b')]),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x77')]),JSON[_0x0a9e('0x59')](_[_0x0a9e('0x78')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b],[_0x0a9e('0x79'),_0x0a9e('0x7a'),'VoiceQueueId',_0x0a9e('0x7b')])));return ami[_0x0a9e('0x7c')]({'action':'status','channel':_0xdd268f['actions'][_0x138b8b]['channel']})[_0x0a9e('0x7d')](function(_0x4317e3){if(_0x4317e3[_0x0a9e('0x4e')]===_0x0a9e('0x7e')){setTimeout(function(){if(_0xdd268f[_0x0a9e('0x15')][_0x138b8b]){ut[_0x0a9e('0x7f')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']],'[clearZombieChannel]');if(_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x77')]===!![]){ut[_0x0a9e('0x80')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')]],_0x0a9e('0x81'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']);}ut[_0x0a9e('0x82')]('[Dialer][checkChannel][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]);delete _0xdd268f[_0x0a9e('0x15')][_0x138b8b];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x6b')]=function(){var _0x1bf38a=this;loggerAction['info']('[action]',_[_0x0a9e('0x83')](this[_0x0a9e('0x15')]));for(var _0x49c095 in this[_0x0a9e('0x15')]){if(_0x1bf38a['actions'][_0x0a9e('0x68')](_0x49c095)){_0x1bf38a['clearZombieChannel'](_0x49c095);}}};Preview[_0x0a9e('0xe')]['recallMe']=function(_0x5da27d){var _0x5df0ad=this;rpcDb[_0x0a9e('0x84')](_0x5da27d['id'],ut['agentReadyId'](this[_0x0a9e('0x16')]))[_0x0a9e('0x85')](function(_0x3cfd00){if(!_[_0x0a9e('0x72')](_0x3cfd00)){for(var _0x232830=0x0;_0x232830<_0x3cfd00[_0x0a9e('0x86')];_0x232830+=0x1){if(ut[_0x0a9e('0x87')](_0x3cfd00[_0x232830][_0x0a9e('0x88')])<_0x5da27d['dialRecallMeTimeout']*0x3c){if(_0x3cfd00[_0x232830][_0x0a9e('0x89')]&&!_0x3cfd00[_0x232830][_0x0a9e('0x89')][_0x0a9e('0x8a')]){_0x5df0ad[_0x0a9e('0x8b')](_0x3cfd00[_0x232830]['id'])[_0x0a9e('0x85')](ut[_0x0a9e('0x8c')]('[RecallMe]'))[_0x0a9e('0x7d')](ut[_0x0a9e('0x8c')]('[RecallMe]'));}else{rpcDb[_0x0a9e('0x8d')](_0x3cfd00[_0x232830]['id']);}}else{var _0x5cc8fb=new Action(_0x3cfd00[_0x232830],_0x5da27d);_0x5cc8fb[_0x0a9e('0x8e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5da27d['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x8f')](_0x5cc8fb,0x17,'RecallInQueue');if(_0x5da27d[_0x0a9e('0x90')]){rpcDb[_0x0a9e('0x91')](ut[_0x0a9e('0x92')](_0x3cfd00[_0x232830]));rpcDb[_0x0a9e('0x93')](_0x5cc8fb,_0x0a9e('0x94'));}else{ut[_0x0a9e('0x8f')](_0x5cc8fb,0x16,'RecallFailedTimeout');rpcDb[_0x0a9e('0x93')](_0x5cc8fb,'[HistoryRecallClose]');rpcDb[_0x0a9e('0x95')](_0x5cc8fb,_0x0a9e('0x96'));}}}}})[_0x0a9e('0x7d')](ut['logger2'](_0x0a9e('0x97')));};Preview[_0x0a9e('0xe')][_0x0a9e('0x6e')]=function(_0x32e134){_0x32e134['sendMessageOneNotActive']=!![];if(ut[_0x0a9e('0x98')](_0x32e134[_0x0a9e('0x2a')])){_0x32e134['message']=_0x0a9e('0x99');}else if(!ut[_0x0a9e('0x9a')](_0x32e134[_0x0a9e('0x34')])){_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x63');}else if(!this['isTrunkReachable'](_0x32e134[_0x0a9e('0x55')])){if(!this[_0x0a9e('0x9b')](_0x32e134[_0x0a9e('0x9c')])){_0x32e134['message']=_0x0a9e('0x9d');}else{_0x32e134['message']='ACTIVE';}}else{_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x9e');}emitCampaignPreview(_0x32e134);};Preview[_0x0a9e('0xe')][_0x0a9e('0x9f')]=function(_0x186f39,_0xc8c264,_0x387489){var _0x54a37d=this;var _0x2d7205=this[_0x0a9e('0x15')][_0xc8c264];var _0x2e89b7=this[_0x0a9e('0x12')][_0x2d7205[_0x0a9e('0x74')]];var _0x2b8192;var _0x320898=![];var _0x412a72=0x2;var _0x2a28c0=0x3;if(_0x2e89b7){switch(_0x387489){case'1':_0x2e89b7[_0x0a9e('0x3f')]+=0x1;_0x2d7205['countnosuchnumberretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x0,'NoSuchNumber');ami[_0x0a9e('0x5f')](_0x0a9e('0xa2'),ut['buildObj'](_0x2d7205,_0x0a9e('0xa3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xa4'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'0',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a43a8){_0x320898=_0x4a43a8['additional']==0x1;_0x412a72=_0x2e89b7['dialNoSuchNumberRetryFrequency'];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xaa'));}else{if(_0x2d7205[_0x0a9e('0xab')]>=_0x2e89b7['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xaa'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xab'),_0x2e89b7['dialNoSuchNumberRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];}else{_0x2d7205[_0x0a9e('0xab')]++;logger[_0x0a9e('0x5c')](_0x0a9e('0xb0'),_0x2d7205['countnosuchnumberretry']);logger[_0x0a9e('0x5c')]('id',_0x2d7205[_0x0a9e('0xb1')]);_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnosuchnumberretry':_0x2d7205['countnosuchnumberretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xb4'):var _0x4abc8f=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));_0x2d7205[_0x0a9e('0xb6')]=_0x4abc8f;_0x2d7205[_0x0a9e('0xb7')]=_0x4abc8f;_0x2d7205[_0x0a9e('0x77')]=!![];_0x2e89b7[_0x0a9e('0x2b')]+=0x1;logger[_0x0a9e('0x5c')](_0x0a9e('0xb8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7[_0x0a9e('0x2b')]);ami[_0x0a9e('0x5f')]('custom:agentconnect',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xbc'),this[_0x0a9e('0x12')][_0x2d7205['queue']]));if(_0x2e89b7[_0x0a9e('0xbd')]){ami[_0x0a9e('0x5f')](_0x0a9e('0xbe'),ut[_0x0a9e('0xbf')](_0x2d7205));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc0'),this['campaignsPreview'][_0x2d7205[_0x0a9e('0x74')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2d7205,_0x0a9e('0xc0')));_0x2e89b7[_0x0a9e('0x38')]+=0x1;_0x2e89b7['total']+=0x1;_0x2e89b7[_0x0a9e('0x29')]+=0x1;ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xc1'));_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x4,_0x0a9e('0xc2'));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xc3'));rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xc4'));rpcDb[_0x0a9e('0xc5')](_0x2d7205);_0x2e89b7['sumDuration']+=_0x2d7205[_0x0a9e('0xc6')];_0x2e89b7[_0x0a9e('0x2c')]+=_0x2d7205['talktime'];logger[_0x0a9e('0x5c')]('[syncHangup][talking][decrement]',_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7['pTalking']);delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;case _0x0a9e('0xc7'):_0x2e89b7[_0x0a9e('0x3a')]+=0x1;_0x2d7205['countbusyretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x5,'Busy');_0x412a72=_0x2e89b7[_0x0a9e('0xc8')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentbusy',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc9')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xca'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'5',_0x2e89b7)[_0x0a9e('0x85')](function(_0x5a8854){_0x320898=_0x5a8854[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut['totalGlobal'](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2d7205[_0x0a9e('0xcc')]>=_0x2e89b7[_0x0a9e('0xcd')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xcc'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xcc')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countbusyretry':_0x2d7205[_0x0a9e('0xcc')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xcf'):_0x2e89b7[_0x0a9e('0xd0')]+=0x1;_0x2d7205['countnoanswerretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x3,_0x0a9e('0xd1'));_0x412a72=_0x2e89b7[_0x0a9e('0xd2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')](_0x0a9e('0xd3'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xd4')));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xd5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'3',_0x2e89b7)[_0x0a9e('0x85')](function(_0x30ef6e){_0x320898=_0x30ef6e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xd6'));}else{if(_0x2d7205[_0x0a9e('0xd7')]>=_0x2e89b7[_0x0a9e('0xd8')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xd5'));}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xd7'),_0x2e89b7[_0x0a9e('0xd2')]),_0x2d7205['unlockAgent'],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205['countnoanswerretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xd9'):_0x2e89b7['outboundCongestionCallsDay']+=0x1;_0x2d7205[_0x0a9e('0xda')]+=0x1;_0x2d7205['countglobal']=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x8,'Congestion');_0x412a72=_0x2e89b7[_0x0a9e('0xdb')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')]('custom:agentcongestion',ut['buildObj'](_0x2d7205,_0x0a9e('0xdc')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xdd'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'8',_0x2e89b7)[_0x0a9e('0x85')](function(_0x2450a8){_0x320898=_0x2450a8[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut['cloneAction'](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb['createCustomerFinal'](_0x2b8192,_0x0a9e('0xde'));}else{if(_0x2d7205[_0x0a9e('0xda')]>=_0x2e89b7[_0x0a9e('0xdf')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xda'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205['countcongestionretry']++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countcongestionretry':_0x2d7205['countcongestionretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xe0'):_0x2e89b7[_0x0a9e('0x42')]+=0x1;_0x2d7205[_0x0a9e('0xe1')]+=0x1;_0x2d7205['countglobal']=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x14,'AgentReject');_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami[_0x0a9e('0x5f')]('custom:agentreject',ut['buildObj'](_0x2d7205,_0x0a9e('0xe3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,'[syncHangupRequest][logAgentReject]');_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x15c6b9){_0x320898=_0x15c6b9[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut['cloneAction'](_0x2d7205,0x14,_0x0a9e('0xe4'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xe5'));}else{if(_0x2d7205[_0x0a9e('0xe1')]>=_0x2e89b7[_0x0a9e('0xe6')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xe5'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe1'),_0x2e89b7[_0x0a9e('0xe2')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});break;case _0x0a9e('0xe7'):_0x2e89b7[_0x0a9e('0x43')]+=0x1;_0x2d7205[_0x0a9e('0xe8')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0xb,'Abandoned');rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xe9'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'11',_0x2e89b7)[_0x0a9e('0x85')](function(_0x34f7b5){_0x320898=_0x34f7b5['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2d7205[_0x0a9e('0xea')]>=_0x2e89b7['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xe9'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe8'),_0x2e89b7['dialAbandonedRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case'18':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xec')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x12,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit']('custom:amd',ut[_0x0a9e('0xbb')](_0x2d7205,'amd'));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xef'));_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0xe2b083){_0x320898=_0xe2b083[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0x12,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xef'));}else{rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xef'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];break;case'19':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x13,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit'](_0x0a9e('0xf0'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xf1')));rpcDb['createCustomerHistory'](_0x2d7205,'[callProgressDetectingCustomer][machine]');_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a70ce){_0x320898=_0x4a70ce['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf2'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf2'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;default:if(_0x2d7205[_0x0a9e('0x77')]){ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xf3'));ut[_0x0a9e('0x82')](_0x0a9e('0xf4')+_0x2e89b7['name'],_0x186f39);}_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0xc,_0x186f39['cause-txt']||_0x186f39[_0x0a9e('0xee')]);_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xf5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x25931e){_0x320898=_0x25931e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf6'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf6'));}delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];}else{_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(_0xd2391){});}});}if(!(_0x2d7205[_0x0a9e('0x77')]&&_0x387489==='16')){ut['updateOriginated'](_0x2e89b7,_0x0a9e('0xf7'));logger[_0x0a9e('0x5c')](_0x0a9e('0xf8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x2e89b7[_0x0a9e('0x4f')]);}if(_0x387489!==_0x0a9e('0xb4')){delete this[_0x0a9e('0x15')][_0x186f39['linkedid']];delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xf9')]];}}};Preview[_0x0a9e('0xe')][_0x0a9e('0xfa')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){if(_[_0x0a9e('0xfb')](_0x3942fd)&&'object'!==typeof _0x3942fd){return;}if(_['isUndefined'](_0x5cb48d)&&'object'!==typeof _0x5cb48d){return;}switch(_0x5cb48d[_0x0a9e('0xfc')]){case'0':ut[_0x0a9e('0xfd')](_0x2b624e,0x0,_0x0a9e('0xfe'));rpcDb[_0x0a9e('0xff')](_0x2b624e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x0a9e('0xfd')](_0x2b624e,0x3,_0x0a9e('0xd1'));rpcDb[_0x0a9e('0xff')](_0x2b624e,_0x0a9e('0x100'));break;case'5':ut[_0x0a9e('0xfd')](_0x2b624e,0x5,'Busy');rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x101'));break;case'8':ut[_0x0a9e('0xfd')](_0x2b624e,0x8,_0x0a9e('0x102'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));break;case'22':ut[_0x0a9e('0xfd')](_0x2b624e,0x16,_0x0a9e('0x104'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x105'));break;default:ut[_0x0a9e('0xfd')](_0x2b624e,0xc,_0x5cb48d[_0x0a9e('0xfc')]);rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));}ut[_0x0a9e('0x7f')](_0x3942fd,_0x0a9e('0x106'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x2b624e['uniqueid'],_0x0a9e('0xba'),_0x3942fd[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x3942fd[_0x0a9e('0x4f')]);delete this['actions'][_0x2b624e[_0x0a9e('0xb9')]];};Preview['prototype'][_0x0a9e('0xa5')]=function(_0x2ff2ab,_0x242f23,_0x57f673){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xa5')](_0x2ff2ab,_0x242f23,_0x57f673))['catch'](logger[_0x0a9e('0x5c')]('[verifyAdditionalPhone]\x20'));};Preview[_0x0a9e('0xe')]['swapAdditionalPhones']=function(_0x41b90a,_0x57b7d4,_0xb14971){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb3')](_0x41b90a,_0x57b7d4,_0xb14971))[_0x0a9e('0x7d')](logger[_0x0a9e('0x5c')](_0x0a9e('0x108')));};Preview['prototype'][_0x0a9e('0xb2')]=function(_0x1c9ea2){return BPromise['resolve']()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb2')](_0x1c9ea2))['catch'](logger[_0x0a9e('0x5c')](_0x0a9e('0x109')));};Preview[_0x0a9e('0xe')]['checkInBlack']=function(_0x3766d7,_0xf49ed4,_0xdeb5e4,_0x3f0d64,_0x2003bc){var _0x29fdfe=this;return new BPromise(function(_0x3ba897,_0x74d9b8){if(_[_0x0a9e('0x72')](_0xf49ed4)||_[_0x0a9e('0x72')](_0xf49ed4['Contact'])||_[_0x0a9e('0x72')](_0xf49ed4['phone'])||_[_0x0a9e('0x72')](_0xf49ed4[_0x0a9e('0x10a')])){_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x10b'),_0x3f0d64,_0x2003bc));return;}var _0x5d577b=uuid['v4']();var _0x2d45db=_0x29fdfe['campaignsPreview'][_0xf49ed4[_0x0a9e('0x73')][_0x0a9e('0x27')]];var _0x2977a7=_0xdeb5e4?_0x29fdfe['agents'][_0xdeb5e4]['id']:undefined;_0x29fdfe[_0x0a9e('0x15')][_0x5d577b]=new Action(_0xf49ed4,_0x2d45db,_0x5d577b,_0xdeb5e4,_0x2977a7);var _0x402544=_0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x402544[_0x0a9e('0xad')]=_0x3f0d64;_0x402544[_0x0a9e('0xae')]=_0x2003bc;_0x402544[_0x0a9e('0x10c')]=_0xdeb5e4;if(_[_0x0a9e('0x10d')](_0x3766d7)){_0x29fdfe['execCall'](_0x402544,_0x2d45db,_0xf49ed4,_0xdeb5e4)[_0x0a9e('0x85')](function(_0x228c10){logger[_0x0a9e('0x5c')](_0x0a9e('0x10e'),_0x0a9e('0x10f')+_0x402544[_0x0a9e('0x74')]+_0x0a9e('0x110')+_0x402544['idContact'],JSON['stringify'](_0x228c10));ami[_0x0a9e('0x5f')](_0x0a9e('0x111'),ut[_0x0a9e('0xbb')](_0x402544,_0x0a9e('0x112'),_0x29fdfe[_0x0a9e('0x12')][_0x402544[_0x0a9e('0x74')]]));_0x3ba897(ut[_0x0a9e('0x4e')]('Calling'));})[_0x0a9e('0x7d')](function(_0x1d7fc4){ut[_0x0a9e('0x64')](_0x0a9e('0x113'),_0x1d7fc4);_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x114'),_0x3f0d64,_0x2003bc));});}else{_0x2d45db[_0x0a9e('0x39')]+=0x1;ut['logBlacklist'](_0x402544);rpcDb[_0x0a9e('0x115')](_0x402544,_0x0a9e('0x116'));delete _0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x74d9b8(ut['message'](_0x0a9e('0x117'),_0x3f0d64,_0x2003bc));}});};Preview[_0x0a9e('0xe')][_0x0a9e('0x9b')]=function(_0x292f02){return!_['isNil'](_0x292f02)&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x27')])&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x56')])&&_0x292f02[_0x0a9e('0x56')]&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])])&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02['name'])][_0x0a9e('0x118')])&&(this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])][_0x0a9e('0x118')]==='reachable'||this[_0x0a9e('0x14')][util['format'](_0x0a9e('0x119'),_0x292f02['name'])]['status']==='unmonitored');};Preview[_0x0a9e('0xe')][_0x0a9e('0x8b')]=function(_0x19f800,_0x20007e){var _0x7d59a9=this;return new BPromise(function(_0xe17af8,_0x48fbef){_0x7d59a9[_0x0a9e('0x11a')](_0x19f800,_0x20007e)[_0x0a9e('0x85')](function(_0x1713a7){_0xe17af8(_[_0x0a9e('0x78')](_0x1713a7,[_0x0a9e('0x4e')]));})[_0x0a9e('0x7d')](function(_0x31c937){if(_0x31c937['unlock']){rpcDb['unlockContact'](_0x19f800);}if(_0x31c937[_0x0a9e('0x56')]){rpcDb['disableContact'](_0x19f800);}_0x48fbef(_[_0x0a9e('0x78')](_0x31c937,[_0x0a9e('0x4e')]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11a')]=function(_0x37a448,_0x383dd8){var _0x594f25=this;return new BPromise(function(_0x4716d1,_0x59b872){var _0x50e32a,_0x504403;rpcDb['getContactPreview'](_0x37a448)[_0x0a9e('0x85')](function(_0x5dc978){if(!_['isNil'](_0x5dc978[0x0])){_0x504403=_0x5dc978[0x0][_0x0a9e('0x11b')]?![]:!![];_0x50e32a=_0x5dc978[0x0]['recallme']?!![]:![];_0x50e32a=_0x383dd8?!![]:_0x50e32a;}var _0x24470a=_0x594f25[_0x0a9e('0x11c')](_0x5dc978);if(_0x24470a[_0x0a9e('0x11d')]){rpcDb['checkIsBlackList'](_[_0x0a9e('0x78')](_0x5dc978[0x0],[_0x0a9e('0x10a'),_0x0a9e('0x11e')]))['then'](function(_0x5236c9){_0x594f25[_0x0a9e('0x11f')](_0x5236c9,_0x5dc978[0x0],_0x383dd8,_0x504403,_0x50e32a)[_0x0a9e('0x85')](function(_0x89d2cb){_0x4716d1(_0x89d2cb);})[_0x0a9e('0x7d')](function(_0x3b0db2){_0x59b872(_0x3b0db2);});})[_0x0a9e('0x7d')](function(_0x247a6c){ut[_0x0a9e('0x64')](_0x0a9e('0x120'),_0x247a6c);_0x59b872(ut[_0x0a9e('0x4e')]('Call\x20unsuccessful',_0x504403,_0x50e32a));});}else{_0x59b872(ut['message'](_0x24470a['message'],_0x504403,_0x50e32a));}})[_0x0a9e('0x7d')](function(_0x19dcc2){ut[_0x0a9e('0x64')](_0x0a9e('0x121'),_0x19dcc2);_0x59b872(ut[_0x0a9e('0x4e')](_0x0a9e('0x122'),![],!![]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11c')]=function(_0x5d74e9){if(_['isNil'](_0x5d74e9)||_[_0x0a9e('0x10d')](_0x5d74e9)||!_[_0x0a9e('0x72')](_0x5d74e9[0x0]['Agent'])&&_[_0x0a9e('0x72')](_0x5d74e9[0x0][_0x0a9e('0x89')][_0x0a9e('0x27')])){ut[_0x0a9e('0x64')](_0x0a9e('0x123'),_0x5d74e9);return{'isValid':![],'message':_0x0a9e('0x124')};}var _0x167196=this[_0x0a9e('0x12')][_0x5d74e9[0x0][_0x0a9e('0x73')][_0x0a9e('0x27')]];_0x167196[_0x0a9e('0x4e')]=_0x0a9e('0x9e');if(_['isNil'](_0x167196)){ut[_0x0a9e('0x64')](_0x0a9e('0x125'),_0x167196);return{'isValid':![],'message':_0x0a9e('0x126')};}if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x55')])){ut[_0x0a9e('0x64')](_0x0a9e('0x127'),_0x0a9e('0x128')+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x129'));if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x9c')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12a'));return{'isValid':![],'message':_0x0a9e('0x12b')};}}if(!ut[_0x0a9e('0x9a')](_0x167196[_0x0a9e('0x34')])){ut[_0x0a9e('0x64')](_0x0a9e('0x12c'),_0x167196['name']+_0x0a9e('0x12d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12d')};}return{'isValid':!![],'message':_0x0a9e('0x12e')};};Preview[_0x0a9e('0xe')][_0x0a9e('0x12f')]=function(_0x358f74,_0x465003,_0x261eca,_0xa7a754){var _0x32a199=this;return new BPromise(function(_0x39d367,_0x8231e5){var _0x43111e=_0x358f74[_0x0a9e('0xb9')];var _0x3c8a9a=_0x32a199[_0x0a9e('0x9b')](_0x465003['Trunk'])?util['format'](_0x0a9e('0x130'),_0x465003[_0x0a9e('0x55')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003['dialCutDigit']>0x0?_0x261eca[_0x0a9e('0x11e')]['substring'](_0x465003[_0x0a9e('0x133')]):_0x261eca['phone']):util[_0x0a9e('0x5e')]('SIP/%s/%s%s',_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['name']:_0x465003[_0x0a9e('0x9c')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003[_0x0a9e('0x133')]>0x0?_0x261eca[_0x0a9e('0x11e')][_0x0a9e('0x134')](_0x465003[_0x0a9e('0x133')]):_0x261eca[_0x0a9e('0x11e')]);var _0x1a3143=_0x32a199[_0x0a9e('0x9b')](_0x465003[_0x0a9e('0x55')])?ut[_0x0a9e('0x135')](_0x465003[_0x0a9e('0x55')][_0x0a9e('0x57')],_0x465003[_0x0a9e('0x35')],_0x465003[_0x0a9e('0x136')]>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003['dialOriginateCallerIdNumber']):ut[_0x0a9e('0x135')](_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['callerid']:_0x465003['TrunkBackup']['callerid'],_0x465003[_0x0a9e('0x35')],_0x465003['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003[_0x0a9e('0x138')]);if(_0x1a3143){_0x358f74[_0x0a9e('0x139')]=ut[_0x0a9e('0x13a')](_0x1a3143);_0x358f74[_0x0a9e('0x13b')]=ut[_0x0a9e('0x13c')](_0x1a3143);}var _0x2154d8=ut[_0x0a9e('0x13d')](_0x465003,_0x261eca,_0x3c8a9a,_0x1a3143,_0x43111e,_0x358f74);_['merge'](_0x358f74,ut[_0x0a9e('0x13e')](_0x2154d8));_0x358f74['starttime']=moment()[_0x0a9e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x7c')](ut[_0x0a9e('0x13f')](_0x358f74,_0x465003,_0x2154d8,_0x358f74[_0x0a9e('0xae')],_0xa7a754))['then'](function(_0x920ad8){_0x465003[_0x0a9e('0x4f')]+=0x1;logger['info']('[originated][increment]',_0x43111e,_0x0a9e('0xba'),_0x465003[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x465003['originated']);_0x39d367(_0x920ad8);})['catch'](function(_0x4869c1){ut[_0x0a9e('0xfd')](_0x358f74,0xe,_0x0a9e('0x140'));rpcDb[_0x0a9e('0xff')](_0x358f74,_0x0a9e('0x141'));_0x8231e5(_0x4869c1);});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x142')]=function(_0x183b9b){if(this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]]){this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]][_0x0a9e('0x143')]=_0x183b9b[_0x0a9e('0x143')];}};Preview[_0x0a9e('0xe')][_0x0a9e('0x19')]=function(_0x1a74c4){var _0x94e69b=this;var _0x320367=this['actions'][_0x1a74c4[_0x0a9e('0x144')]];if(_0x320367){if(_0x320367[_0x0a9e('0x10c')]&&this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]){ut[_0x0a9e('0x145')](_0x320367,this[_0x0a9e('0x16')][_0x320367['lookAgent']][_0x0a9e('0x27')],this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]['id']);}var _0x1109de=_[_0x0a9e('0x146')](_0x320367);_0x1109de[_0x0a9e('0xb6')]=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));var _0x4175a6=_0x94e69b['campaignsPreview'][_0x320367['queue']];if(ut[_0x0a9e('0x147')](_0x1a74c4[_0x0a9e('0x148')])){if(_0x320367['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x320367[_0x0a9e('0xb1')]);}if(_0x320367['activeContact']){rpcDb[_0x0a9e('0x8d')](_0x320367['idContact']);}ami[_0x0a9e('0x5f')](_0x0a9e('0x14a'),ut['buildObj'](_0x320367,_0x0a9e('0x14b'),this[_0x0a9e('0x12')][_0x320367['queue']]));this[_0x0a9e('0xfa')](_0x1109de,_0x4175a6,_0x1a74c4);}else{_0x320367[_0x0a9e('0x8e')]=moment()['format'](_0x0a9e('0xb5'));ut[_0x0a9e('0xfd')](_0x1109de,0x4,_0x0a9e('0xc2'));rpcDb[_0x0a9e('0xff')](_0x1109de,_0x0a9e('0x14c'));}}};Preview[_0x0a9e('0xe')]['syncHangup']=function(_0x1e5b09){var _0x36dc4f=this;var _0x51e697=this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]];var _0x22c390;if(_0x51e697){_0x22c390=this[_0x0a9e('0x12')][_0x51e697[_0x0a9e('0x74')]];logger[_0x0a9e('0x5c')](_0x0a9e('0x14d'),_0x1e5b09['linkedid'],'\x20Queue',_0x22c390['name'],'pTalking:\x20',_0x22c390['pTalking']);}if(this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]]&&_0x1e5b09['linkedid']!==_0x1e5b09['uniqueid']){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this[_0x0a9e('0x15')][_0x1e5b09['linkedid']][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')]('[syncHangup][talking][cause]',_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390[_0x0a9e('0x2b')]);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09['linkedid'],_0x1e5b09[_0x0a9e('0x14e')]);}}else if(_0x51e697&&_['isNil'](_0x51e697[_0x0a9e('0x14f')])&&_0x22c390[_0x0a9e('0x150')]&&_0x1e5b09['linkedid']===_0x1e5b09[_0x0a9e('0xb9')]&&_[_0x0a9e('0x72')](_0x1e5b09['reason'])&&_0x1e5b09[_0x0a9e('0x14e')]==='16'&&_0x1e5b09['channelstate']==='6'&&_[_0x0a9e('0xfb')](_0x51e697[_0x0a9e('0x151')])){if(_0x51e697['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x51e697['idContact']);}if(_0x51e697[_0x0a9e('0xae')]){rpcDb[_0x0a9e('0x8d')](_0x51e697[_0x0a9e('0xb1')]);}_0x1e5b09[_0x0a9e('0xfc')]='22';this[_0x0a9e('0xfa')](_0x51e697,_0x22c390,_0x1e5b09);}else if(_0x51e697&&_0x51e697[_0x0a9e('0x151')]){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x152'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09['cause'],_0x0a9e('0xba'),_0x22c390['name'],'pTalking:\x20',_0x22c390[_0x0a9e('0x2b')]);this['callProgressDetectingCustomer'](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x153'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390['pTalking']);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')]['syncDialEnd']=function(_0x38d95a){if(this[_0x0a9e('0x15')][_0x38d95a[_0x0a9e('0xf9')]]&&_0x38d95a['destlinkedid']!==_0x38d95a[_0x0a9e('0x154')]){this[_0x0a9e('0x9f')](_0x38d95a,_0x38d95a[_0x0a9e('0xf9')],_0x38d95a['dialstatus']);}};Preview[_0x0a9e('0xe')]['syncHangupRequest']=function(_0x2394f2){if(this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]&&_0x2394f2[_0x0a9e('0xaf')]!==_0x2394f2[_0x0a9e('0xb9')]&&!this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]['dialAnswer']){if(_0x2394f2[_0x0a9e('0x14e')]==='1'){this[_0x0a9e('0x9f')](_0x2394f2,_0x2394f2[_0x0a9e('0xaf')],_0x2394f2[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')][_0x0a9e('0x155')]=function(_0x3a4def,_0x2670f5,_0x2310ca){if(this[_0x0a9e('0x15')][_0x3a4def]){if(_[_0x0a9e('0x72')](this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')])){this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')]={};}this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')][_0x2670f5]=_0x2310ca;}};Preview[_0x0a9e('0xe')][_0x0a9e('0x21')]=function(_0x611e46){try{if(!_[_0x0a9e('0x72')](_0x611e46)){if(ut[_0x0a9e('0x157')](_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0])){this[_0x0a9e('0x155')](_0x611e46[_0x0a9e('0xb9')],_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0],_0x611e46[_0x0a9e('0x159')]);}}}catch(_0x4c925e){logger[_0x0a9e('0x15a')](_0x0a9e('0x15b'),util[_0x0a9e('0x15c')](_0x4c925e,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xe')][_0x0a9e('0x23')]=function(_0xb09ef6){if(_0xb09ef6){if(this[_0x0a9e('0x15')][_0xb09ef6[_0x0a9e('0x15d')]]){this['actions'][_0xb09ef6[_0x0a9e('0x15d')]][_0x0a9e('0x151')]=!![];}}};Preview['prototype'][_0x0a9e('0x25')]=function(_0x2db8fe){if(_0x2db8fe){if(this[_0x0a9e('0x15')][_0x2db8fe['transfererlinkedid']]){this[_0x0a9e('0x15')][_0x2db8fe[_0x0a9e('0x15e')]][_0x0a9e('0x151')]=!![];}}};module[_0x0a9e('0x15f')]=Preview; \ No newline at end of file +var _0xa9e0=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','additional','countbusyretry','dialBusyMaxRetry','scheduledAt','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','status','SIP/%s','execRun','recallme','validateContact','isValid','phone','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','defaults','socket.io-emitter','redis','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require(_0x0a9e('0x9'));var Action=require(_0x0a9e('0xa'));var ut=require('./util/util');config['redis']=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0xc'))(new Redis(config[_0x0a9e('0xd')]));var Sequence=function(){};Sequence[_0x0a9e('0xe')][_0x0a9e('0xf')]=function(_0xfeb75b){this[_0x0a9e('0x10')]=this['tail']?this['tail']['finally'](_0xfeb75b):_0xfeb75b();};function Preview(_0x4cfe67){this[_0x0a9e('0x11')]=new Sequence();this[_0x0a9e('0x12')]=_0x4cfe67[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x4cfe67[_0x0a9e('0x14')];this[_0x0a9e('0x15')]={};this['agents']=_0x4cfe67[_0x0a9e('0x16')];this[_0x0a9e('0x17')]=0x0;ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x1b'),this['syncHangup'][_0x0a9e('0x1a')](this));ami['on']('hanguprequest',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')]['bind'](this));ami['on'](_0x0a9e('0x1f'),this['syncNewExten'][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x24'),this[_0x0a9e('0x25')][_0x0a9e('0x1a')](this));this[_0x0a9e('0x26')](this[_0x0a9e('0x12')]);}function emit(_0x4bb1e3,_0x2c3407,_0x155cce){io['to'](_0x4bb1e3)['emit'](_0x2c3407,_0x155cce);}function emitCampaignPreview(_0x20f109){if(_0x20f109['type']==='outbound'){var _0x3a02e1={'id':_0x20f109['id'],'name':_0x20f109[_0x0a9e('0x27')],'strategy':_0x20f109[_0x0a9e('0x28')],'answered':_0x20f109[_0x0a9e('0x29')],'available':_0x20f109['available'],'loggedIn':_0x20f109[_0x0a9e('0x2a')],'pTalking':_0x20f109[_0x0a9e('0x2b')],'sumBillable':_0x20f109[_0x0a9e('0x2c')],'sumDuration':_0x20f109[_0x0a9e('0x2d')],'sumHoldTime':_0x20f109[_0x0a9e('0x2e')]||0x0,'talking':_0x20f109[_0x0a9e('0x2f')],'total':_0x20f109[_0x0a9e('0x30')],'type':_0x20f109['type'],'unmanaged':_0x20f109['unmanaged'],'abandoned':_0x20f109[_0x0a9e('0x31')],'waiting':_0x20f109[_0x0a9e('0x32')],'loggedInDb':_0x20f109[_0x0a9e('0x33')],'dialActive':_0x20f109[_0x0a9e('0x34')],'dialMethod':_0x20f109['dialMethod'],'dialOriginateCallerIdName':_0x20f109[_0x0a9e('0x35')],'dialOriginateCallerIdNumber':_0x20f109['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x20f109[_0x0a9e('0x36')],'dialPrefix':_0x20f109['dialPrefix'],'outboundAnswerAgiCallsDay':_0x20f109[_0x0a9e('0x37')],'outboundAnswerCallsDay':_0x20f109[_0x0a9e('0x38')],'outboundBlacklistCallsDay':_0x20f109[_0x0a9e('0x39')],'outboundBusyCallsDay':_0x20f109[_0x0a9e('0x3a')],'outboundCongestionCallsDay':_0x20f109[_0x0a9e('0x3b')],'outboundDropCallsDayACS':_0x20f109[_0x0a9e('0x3c')],'outboundDropCallsDayCallersExit':_0x20f109[_0x0a9e('0x3d')],'outboundDropCallsDayTimeout':_0x20f109[_0x0a9e('0x3e')],'outboundNoAnswerCallsDay':_0x20f109['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x20f109[_0x0a9e('0x3f')],'outboundOriginateFailureCallsDay':_0x20f109[_0x0a9e('0x40')],'outboundReCallsDay':_0x20f109[_0x0a9e('0x41')],'outboundRejectCallsDay':_0x20f109[_0x0a9e('0x42')],'outboundUnknownCallsDay':_0x20f109['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x20f109[_0x0a9e('0x43')],'predictiveIntervalAnsweredCalls':_0x20f109[_0x0a9e('0x44')],'predictiveIntervalAvgHoldtime':_0x20f109[_0x0a9e('0x45')],'predictiveIntervalAvgTalktime':_0x20f109[_0x0a9e('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x20f109[_0x0a9e('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x20f109[_0x0a9e('0x48')],'predictiveIntervalErlangCalls':_0x20f109[_0x0a9e('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x20f109[_0x0a9e('0x4a')],'predictiveIntervalHitRate':_0x20f109[_0x0a9e('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x20f109['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x20f109[_0x0a9e('0x4c')],'predictiveIntervalAvailable':_0x20f109['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x20f109[_0x0a9e('0x4d')],'message':_0x20f109[_0x0a9e('0x4e')],'originated':_0x20f109[_0x0a9e('0x4f')],'erlangCalls':_0x20f109[_0x0a9e('0x50')],'erlangCallToSecond':_0x20f109[_0x0a9e('0x51')],'erlangAbandonmentRate':_0x20f109['erlangAbandonmentRate'],'erlangBusyFactor':_0x20f109[_0x0a9e('0x52')],'startPredictive':_0x20f109[_0x0a9e('0x53')],'startProgressive':_0x20f109[_0x0a9e('0x54')]};if(_0x20f109[_0x0a9e('0x55')]){_0x3a02e1[_0x0a9e('0x55')]={'id':_0x20f109[_0x0a9e('0x55')]['id'],'name':_0x20f109[_0x0a9e('0x55')][_0x0a9e('0x27')],'active':_0x20f109['Trunk'][_0x0a9e('0x56')],'callerid':_0x20f109['Trunk'][_0x0a9e('0x57')]};}if(_0x20f109[_0x0a9e('0x58')]){_0x3a02e1[_0x0a9e('0x58')]={'id':_0x20f109[_0x0a9e('0x58')]['id'],'name':_0x20f109['Interval'][_0x0a9e('0x27')]};}var _0xd1836d=md5(JSON[_0x0a9e('0x59')](_0x3a02e1));if(_0x20f109[_0x0a9e('0x3')]!==_0xd1836d){_0x20f109['md5']=_0xd1836d;emit(util['format'](_0x0a9e('0x5a'),_0x3a02e1['name']),_0x0a9e('0x5b'),_0x3a02e1);}}}function emitVoiceQueueChannelRemove(_0x3d9717){logger[_0x0a9e('0x5c')](_0x0a9e('0x5d'),JSON['stringify'](_0x3d9717));emit(util[_0x0a9e('0x5e')](_0x0a9e('0x5a'),_0x3d9717[_0x0a9e('0x27')]),'voice_queue_channel:remove',_0x3d9717);io[_0x0a9e('0x5f')](_0x0a9e('0x60'),_0x3d9717);}function notSendMessagesQueue(_0x289467){if(_0x289467['sendMessageOneNotActive']){if(_0x289467['originated']===0x0&&_0x289467[_0x0a9e('0x2b')]===0x0){_0x289467[_0x0a9e('0x61')]=![];_0x289467['available']=0x0;_0x289467[_0x0a9e('0x62')]=0x0;_0x289467[_0x0a9e('0x4e')]=_0x0a9e('0x63');ut[_0x0a9e('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x289467['name']+_0x0a9e('0x65'));}else{_0x289467[_0x0a9e('0x4e')]='IS_DISACTIVED';ut[_0x0a9e('0x64')](_0x0a9e('0x66'),_0x289467[_0x0a9e('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x289467);}}Preview[_0x0a9e('0xe')][_0x0a9e('0x26')]=function(){var _0x274e8e=this;setInterval(function(){_0x274e8e[_0x0a9e('0x67')]();},0x7cf);};Preview[_0x0a9e('0xe')][_0x0a9e('0x67')]=function(){var _0x2881b3=this[_0x0a9e('0x12')];this[_0x0a9e('0x17')]+=0x1;for(var _0x3da2cd in _0x2881b3){if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&(_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')||_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6a'))&&_0x2881b3[_0x3da2cd]['type']==='outbound'){if(this[_0x0a9e('0x17')]>0x7){this[_0x0a9e('0x17')]=0x0;this[_0x0a9e('0x6b')]();}}if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')&&_0x2881b3[_0x3da2cd][_0x0a9e('0x6c')]===_0x0a9e('0x6d')){if(_0x2881b3[_0x3da2cd][_0x0a9e('0x34')]){this[_0x0a9e('0x6e')](_0x2881b3[_0x3da2cd]);if(_0x2881b3[_0x3da2cd][_0x0a9e('0x6f')])this[_0x0a9e('0x70')](_0x2881b3[_0x3da2cd]);}else{notSendMessagesQueue(_0x2881b3[_0x3da2cd]);}}}};Preview['prototype'][_0x0a9e('0x71')]=function(_0x138b8b){var _0xdd268f=this;this[_0x0a9e('0x11')][_0x0a9e('0xf')](function(){if(!_[_0x0a9e('0x72')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b])){loggerAction[_0x0a9e('0x5c')]('[clearZombieChannels][talking]',_0x138b8b,_0x0a9e('0x73'),_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')],_0x0a9e('0x75'),JSON[_0x0a9e('0x59')](_0xdd268f['campaignsPreview'][_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]][_0x0a9e('0x4f')]),_0x0a9e('0x76'),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']][_0x0a9e('0x2b')]),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x77')]),JSON[_0x0a9e('0x59')](_[_0x0a9e('0x78')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b],[_0x0a9e('0x79'),_0x0a9e('0x7a'),'VoiceQueueId',_0x0a9e('0x7b')])));return ami[_0x0a9e('0x7c')]({'action':'status','channel':_0xdd268f['actions'][_0x138b8b]['channel']})[_0x0a9e('0x7d')](function(_0x4317e3){if(_0x4317e3[_0x0a9e('0x4e')]===_0x0a9e('0x7e')){setTimeout(function(){if(_0xdd268f[_0x0a9e('0x15')][_0x138b8b]){ut[_0x0a9e('0x7f')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']],'[clearZombieChannel]');if(_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x77')]===!![]){ut[_0x0a9e('0x80')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')]],_0x0a9e('0x81'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']);}ut[_0x0a9e('0x82')]('[Dialer][checkChannel][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]);delete _0xdd268f[_0x0a9e('0x15')][_0x138b8b];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x6b')]=function(){var _0x1bf38a=this;loggerAction['info']('[action]',_[_0x0a9e('0x83')](this[_0x0a9e('0x15')]));for(var _0x49c095 in this[_0x0a9e('0x15')]){if(_0x1bf38a['actions'][_0x0a9e('0x68')](_0x49c095)){_0x1bf38a['clearZombieChannel'](_0x49c095);}}};Preview[_0x0a9e('0xe')]['recallMe']=function(_0x5da27d){var _0x5df0ad=this;rpcDb[_0x0a9e('0x84')](_0x5da27d['id'],ut['agentReadyId'](this[_0x0a9e('0x16')]))[_0x0a9e('0x85')](function(_0x3cfd00){if(!_[_0x0a9e('0x72')](_0x3cfd00)){for(var _0x232830=0x0;_0x232830<_0x3cfd00[_0x0a9e('0x86')];_0x232830+=0x1){if(ut[_0x0a9e('0x87')](_0x3cfd00[_0x232830][_0x0a9e('0x88')])<_0x5da27d['dialRecallMeTimeout']*0x3c){if(_0x3cfd00[_0x232830][_0x0a9e('0x89')]&&!_0x3cfd00[_0x232830][_0x0a9e('0x89')][_0x0a9e('0x8a')]){_0x5df0ad[_0x0a9e('0x8b')](_0x3cfd00[_0x232830]['id'])[_0x0a9e('0x85')](ut[_0x0a9e('0x8c')]('[RecallMe]'))[_0x0a9e('0x7d')](ut[_0x0a9e('0x8c')]('[RecallMe]'));}else{rpcDb[_0x0a9e('0x8d')](_0x3cfd00[_0x232830]['id']);}}else{var _0x5cc8fb=new Action(_0x3cfd00[_0x232830],_0x5da27d);_0x5cc8fb[_0x0a9e('0x8e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5da27d['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x8f')](_0x5cc8fb,0x17,'RecallInQueue');if(_0x5da27d[_0x0a9e('0x90')]){rpcDb[_0x0a9e('0x91')](ut[_0x0a9e('0x92')](_0x3cfd00[_0x232830]));rpcDb[_0x0a9e('0x93')](_0x5cc8fb,_0x0a9e('0x94'));}else{ut[_0x0a9e('0x8f')](_0x5cc8fb,0x16,'RecallFailedTimeout');rpcDb[_0x0a9e('0x93')](_0x5cc8fb,'[HistoryRecallClose]');rpcDb[_0x0a9e('0x95')](_0x5cc8fb,_0x0a9e('0x96'));}}}}})[_0x0a9e('0x7d')](ut['logger2'](_0x0a9e('0x97')));};Preview[_0x0a9e('0xe')][_0x0a9e('0x6e')]=function(_0x32e134){_0x32e134['sendMessageOneNotActive']=!![];if(ut[_0x0a9e('0x98')](_0x32e134[_0x0a9e('0x2a')])){_0x32e134['message']=_0x0a9e('0x99');}else if(!ut[_0x0a9e('0x9a')](_0x32e134[_0x0a9e('0x34')])){_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x63');}else if(!this['isTrunkReachable'](_0x32e134[_0x0a9e('0x55')])){if(!this[_0x0a9e('0x9b')](_0x32e134[_0x0a9e('0x9c')])){_0x32e134['message']=_0x0a9e('0x9d');}else{_0x32e134['message']='ACTIVE';}}else{_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x9e');}emitCampaignPreview(_0x32e134);};Preview[_0x0a9e('0xe')][_0x0a9e('0x9f')]=function(_0x186f39,_0xc8c264,_0x387489){var _0x54a37d=this;var _0x2d7205=this[_0x0a9e('0x15')][_0xc8c264];var _0x2e89b7=this[_0x0a9e('0x12')][_0x2d7205[_0x0a9e('0x74')]];var _0x2b8192;var _0x320898=![];var _0x412a72=0x2;var _0x2a28c0=0x3;if(_0x2e89b7){switch(_0x387489){case'1':_0x2e89b7[_0x0a9e('0x3f')]+=0x1;_0x2d7205['countnosuchnumberretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x0,'NoSuchNumber');ami[_0x0a9e('0x5f')](_0x0a9e('0xa2'),ut['buildObj'](_0x2d7205,_0x0a9e('0xa3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xa4'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'0',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a43a8){_0x320898=_0x4a43a8['additional']==0x1;_0x412a72=_0x2e89b7['dialNoSuchNumberRetryFrequency'];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xaa'));}else{if(_0x2d7205[_0x0a9e('0xab')]>=_0x2e89b7['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xaa'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xab'),_0x2e89b7['dialNoSuchNumberRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];}else{_0x2d7205[_0x0a9e('0xab')]++;logger[_0x0a9e('0x5c')](_0x0a9e('0xb0'),_0x2d7205['countnosuchnumberretry']);logger[_0x0a9e('0x5c')]('id',_0x2d7205[_0x0a9e('0xb1')]);_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnosuchnumberretry':_0x2d7205['countnosuchnumberretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xb4'):var _0x4abc8f=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));_0x2d7205[_0x0a9e('0xb6')]=_0x4abc8f;_0x2d7205[_0x0a9e('0xb7')]=_0x4abc8f;_0x2d7205[_0x0a9e('0x77')]=!![];_0x2e89b7[_0x0a9e('0x2b')]+=0x1;logger[_0x0a9e('0x5c')](_0x0a9e('0xb8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7[_0x0a9e('0x2b')]);ami[_0x0a9e('0x5f')]('custom:agentconnect',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xbc'),this[_0x0a9e('0x12')][_0x2d7205['queue']]));if(_0x2e89b7[_0x0a9e('0xbd')]){ami[_0x0a9e('0x5f')](_0x0a9e('0xbe'),ut[_0x0a9e('0xbf')](_0x2d7205));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc0'),this['campaignsPreview'][_0x2d7205[_0x0a9e('0x74')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2d7205,_0x0a9e('0xc0')));_0x2e89b7[_0x0a9e('0x38')]+=0x1;_0x2e89b7['total']+=0x1;_0x2e89b7[_0x0a9e('0x29')]+=0x1;ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xc1'));_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x4,_0x0a9e('0xc2'));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xc3'));rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xc4'));rpcDb[_0x0a9e('0xc5')](_0x2d7205);_0x2e89b7['sumDuration']+=_0x2d7205[_0x0a9e('0xc6')];_0x2e89b7[_0x0a9e('0x2c')]+=_0x2d7205['talktime'];logger[_0x0a9e('0x5c')]('[syncHangup][talking][decrement]',_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7['pTalking']);delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;case _0x0a9e('0xc7'):_0x2e89b7[_0x0a9e('0x3a')]+=0x1;_0x2d7205['countbusyretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x5,'Busy');_0x412a72=_0x2e89b7[_0x0a9e('0xc8')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentbusy',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc9')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xca'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'5',_0x2e89b7)[_0x0a9e('0x85')](function(_0x5a8854){_0x320898=_0x5a8854[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut['totalGlobal'](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2d7205[_0x0a9e('0xcc')]>=_0x2e89b7[_0x0a9e('0xcd')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xcc'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xcc')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countbusyretry':_0x2d7205[_0x0a9e('0xcc')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xcf'):_0x2e89b7[_0x0a9e('0xd0')]+=0x1;_0x2d7205['countnoanswerretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x3,_0x0a9e('0xd1'));_0x412a72=_0x2e89b7[_0x0a9e('0xd2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')](_0x0a9e('0xd3'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xd4')));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xd5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'3',_0x2e89b7)[_0x0a9e('0x85')](function(_0x30ef6e){_0x320898=_0x30ef6e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xd6'));}else{if(_0x2d7205[_0x0a9e('0xd7')]>=_0x2e89b7[_0x0a9e('0xd8')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xd5'));}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xd7'),_0x2e89b7[_0x0a9e('0xd2')]),_0x2d7205['unlockAgent'],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205['countnoanswerretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xd9'):_0x2e89b7['outboundCongestionCallsDay']+=0x1;_0x2d7205[_0x0a9e('0xda')]+=0x1;_0x2d7205['countglobal']=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x8,'Congestion');_0x412a72=_0x2e89b7[_0x0a9e('0xdb')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')]('custom:agentcongestion',ut['buildObj'](_0x2d7205,_0x0a9e('0xdc')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xdd'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'8',_0x2e89b7)[_0x0a9e('0x85')](function(_0x2450a8){_0x320898=_0x2450a8[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut['cloneAction'](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb['createCustomerFinal'](_0x2b8192,_0x0a9e('0xde'));}else{if(_0x2d7205[_0x0a9e('0xda')]>=_0x2e89b7[_0x0a9e('0xdf')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xda'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205['countcongestionretry']++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countcongestionretry':_0x2d7205['countcongestionretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xe0'):_0x2e89b7[_0x0a9e('0x42')]+=0x1;_0x2d7205[_0x0a9e('0xe1')]+=0x1;_0x2d7205['countglobal']=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x14,'AgentReject');_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami[_0x0a9e('0x5f')]('custom:agentreject',ut['buildObj'](_0x2d7205,_0x0a9e('0xe3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,'[syncHangupRequest][logAgentReject]');_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x15c6b9){_0x320898=_0x15c6b9[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut['cloneAction'](_0x2d7205,0x14,_0x0a9e('0xe4'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xe5'));}else{if(_0x2d7205[_0x0a9e('0xe1')]>=_0x2e89b7[_0x0a9e('0xe6')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xe5'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe1'),_0x2e89b7[_0x0a9e('0xe2')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});break;case _0x0a9e('0xe7'):_0x2e89b7[_0x0a9e('0x43')]+=0x1;_0x2d7205[_0x0a9e('0xe8')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0xb,'Abandoned');rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xe9'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'11',_0x2e89b7)[_0x0a9e('0x85')](function(_0x34f7b5){_0x320898=_0x34f7b5['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2d7205[_0x0a9e('0xea')]>=_0x2e89b7['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xe9'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe8'),_0x2e89b7['dialAbandonedRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case'18':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xec')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x12,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit']('custom:amd',ut[_0x0a9e('0xbb')](_0x2d7205,'amd'));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xef'));_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0xe2b083){_0x320898=_0xe2b083[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0x12,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xef'));}else{rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xef'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];break;case'19':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x13,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit'](_0x0a9e('0xf0'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xf1')));rpcDb['createCustomerHistory'](_0x2d7205,'[callProgressDetectingCustomer][machine]');_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a70ce){_0x320898=_0x4a70ce['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf2'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf2'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;default:if(_0x2d7205[_0x0a9e('0x77')]){ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xf3'));ut[_0x0a9e('0x82')](_0x0a9e('0xf4')+_0x2e89b7['name'],_0x186f39);}_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0xc,_0x186f39['cause-txt']||_0x186f39[_0x0a9e('0xee')]);_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xf5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x25931e){_0x320898=_0x25931e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf6'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf6'));}delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];}else{_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(_0xd2391){});}});}if(!(_0x2d7205[_0x0a9e('0x77')]&&_0x387489==='16')){ut['updateOriginated'](_0x2e89b7,_0x0a9e('0xf7'));logger[_0x0a9e('0x5c')](_0x0a9e('0xf8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x2e89b7[_0x0a9e('0x4f')]);}if(_0x387489!==_0x0a9e('0xb4')){delete this[_0x0a9e('0x15')][_0x186f39['linkedid']];delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xf9')]];}}};Preview[_0x0a9e('0xe')][_0x0a9e('0xfa')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){if(_[_0x0a9e('0xfb')](_0x3942fd)&&'object'!==typeof _0x3942fd){return;}if(_['isUndefined'](_0x5cb48d)&&'object'!==typeof _0x5cb48d){return;}switch(_0x5cb48d[_0x0a9e('0xfc')]){case'0':ut[_0x0a9e('0xfd')](_0x2b624e,0x0,_0x0a9e('0xfe'));rpcDb[_0x0a9e('0xff')](_0x2b624e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x0a9e('0xfd')](_0x2b624e,0x3,_0x0a9e('0xd1'));rpcDb[_0x0a9e('0xff')](_0x2b624e,_0x0a9e('0x100'));break;case'5':ut[_0x0a9e('0xfd')](_0x2b624e,0x5,'Busy');rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x101'));break;case'8':ut[_0x0a9e('0xfd')](_0x2b624e,0x8,_0x0a9e('0x102'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));break;case'22':ut[_0x0a9e('0xfd')](_0x2b624e,0x16,_0x0a9e('0x104'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x105'));break;default:ut[_0x0a9e('0xfd')](_0x2b624e,0xc,_0x5cb48d[_0x0a9e('0xfc')]);rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));}ut[_0x0a9e('0x7f')](_0x3942fd,_0x0a9e('0x106'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x2b624e['uniqueid'],_0x0a9e('0xba'),_0x3942fd[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x3942fd[_0x0a9e('0x4f')]);delete this['actions'][_0x2b624e[_0x0a9e('0xb9')]];};Preview['prototype'][_0x0a9e('0xa5')]=function(_0x2ff2ab,_0x242f23,_0x57f673){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xa5')](_0x2ff2ab,_0x242f23,_0x57f673))['catch'](logger[_0x0a9e('0x5c')]('[verifyAdditionalPhone]\x20'));};Preview[_0x0a9e('0xe')]['swapAdditionalPhones']=function(_0x41b90a,_0x57b7d4,_0xb14971){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb3')](_0x41b90a,_0x57b7d4,_0xb14971))[_0x0a9e('0x7d')](logger[_0x0a9e('0x5c')](_0x0a9e('0x108')));};Preview['prototype'][_0x0a9e('0xb2')]=function(_0x1c9ea2){return BPromise['resolve']()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb2')](_0x1c9ea2))['catch'](logger[_0x0a9e('0x5c')](_0x0a9e('0x109')));};Preview[_0x0a9e('0xe')]['checkInBlack']=function(_0x3766d7,_0xf49ed4,_0xdeb5e4,_0x3f0d64,_0x2003bc){var _0x29fdfe=this;return new BPromise(function(_0x3ba897,_0x74d9b8){if(_[_0x0a9e('0x72')](_0xf49ed4)||_[_0x0a9e('0x72')](_0xf49ed4['Contact'])||_[_0x0a9e('0x72')](_0xf49ed4['phone'])||_[_0x0a9e('0x72')](_0xf49ed4[_0x0a9e('0x10a')])){_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x10b'),_0x3f0d64,_0x2003bc));return;}var _0x5d577b=uuid['v4']();var _0x2d45db=_0x29fdfe['campaignsPreview'][_0xf49ed4[_0x0a9e('0x73')][_0x0a9e('0x27')]];var _0x2977a7=_0xdeb5e4?_0x29fdfe['agents'][_0xdeb5e4]['id']:undefined;_0x29fdfe[_0x0a9e('0x15')][_0x5d577b]=new Action(_0xf49ed4,_0x2d45db,_0x5d577b,_0xdeb5e4,_0x2977a7);var _0x402544=_0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x402544[_0x0a9e('0xad')]=_0x3f0d64;_0x402544[_0x0a9e('0xae')]=_0x2003bc;_0x402544[_0x0a9e('0x10c')]=_0xdeb5e4;if(_[_0x0a9e('0x10d')](_0x3766d7)){_0x29fdfe['execCall'](_0x402544,_0x2d45db,_0xf49ed4,_0xdeb5e4)[_0x0a9e('0x85')](function(_0x228c10){logger[_0x0a9e('0x5c')](_0x0a9e('0x10e'),_0x0a9e('0x10f')+_0x402544[_0x0a9e('0x74')]+_0x0a9e('0x110')+_0x402544['idContact'],JSON['stringify'](_0x228c10));ami[_0x0a9e('0x5f')](_0x0a9e('0x111'),ut[_0x0a9e('0xbb')](_0x402544,_0x0a9e('0x112'),_0x29fdfe[_0x0a9e('0x12')][_0x402544[_0x0a9e('0x74')]]));_0x3ba897(ut[_0x0a9e('0x4e')]('Calling'));})[_0x0a9e('0x7d')](function(_0x1d7fc4){ut[_0x0a9e('0x64')](_0x0a9e('0x113'),_0x1d7fc4);_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x114'),_0x3f0d64,_0x2003bc));});}else{_0x2d45db[_0x0a9e('0x39')]+=0x1;ut['logBlacklist'](_0x402544);rpcDb[_0x0a9e('0x115')](_0x402544,_0x0a9e('0x116'));delete _0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x74d9b8(ut['message'](_0x0a9e('0x117'),_0x3f0d64,_0x2003bc));}});};Preview[_0x0a9e('0xe')][_0x0a9e('0x9b')]=function(_0x292f02){return!_['isNil'](_0x292f02)&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x27')])&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x56')])&&_0x292f02[_0x0a9e('0x56')]&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])])&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02['name'])][_0x0a9e('0x118')])&&(this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])][_0x0a9e('0x118')]==='reachable'||this[_0x0a9e('0x14')][util['format'](_0x0a9e('0x119'),_0x292f02['name'])]['status']==='unmonitored');};Preview[_0x0a9e('0xe')][_0x0a9e('0x8b')]=function(_0x19f800,_0x20007e){var _0x7d59a9=this;return new BPromise(function(_0xe17af8,_0x48fbef){_0x7d59a9[_0x0a9e('0x11a')](_0x19f800,_0x20007e)[_0x0a9e('0x85')](function(_0x1713a7){_0xe17af8(_[_0x0a9e('0x78')](_0x1713a7,[_0x0a9e('0x4e')]));})[_0x0a9e('0x7d')](function(_0x31c937){if(_0x31c937['unlock']){rpcDb['unlockContact'](_0x19f800);}if(_0x31c937[_0x0a9e('0x56')]){rpcDb['disableContact'](_0x19f800);}_0x48fbef(_[_0x0a9e('0x78')](_0x31c937,[_0x0a9e('0x4e')]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11a')]=function(_0x37a448,_0x383dd8){var _0x594f25=this;return new BPromise(function(_0x4716d1,_0x59b872){var _0x50e32a,_0x504403;rpcDb['getContactPreview'](_0x37a448)[_0x0a9e('0x85')](function(_0x5dc978){if(!_['isNil'](_0x5dc978[0x0])){_0x504403=_0x5dc978[0x0][_0x0a9e('0x11b')]?![]:!![];_0x50e32a=_0x5dc978[0x0]['recallme']?!![]:![];_0x50e32a=_0x383dd8?!![]:_0x50e32a;}var _0x24470a=_0x594f25[_0x0a9e('0x11c')](_0x5dc978);if(_0x24470a[_0x0a9e('0x11d')]){rpcDb['checkIsBlackList'](_[_0x0a9e('0x78')](_0x5dc978[0x0],[_0x0a9e('0x10a'),_0x0a9e('0x11e')]))['then'](function(_0x5236c9){_0x594f25[_0x0a9e('0x11f')](_0x5236c9,_0x5dc978[0x0],_0x383dd8,_0x504403,_0x50e32a)[_0x0a9e('0x85')](function(_0x89d2cb){_0x4716d1(_0x89d2cb);})[_0x0a9e('0x7d')](function(_0x3b0db2){_0x59b872(_0x3b0db2);});})[_0x0a9e('0x7d')](function(_0x247a6c){ut[_0x0a9e('0x64')](_0x0a9e('0x120'),_0x247a6c);_0x59b872(ut[_0x0a9e('0x4e')]('Call\x20unsuccessful',_0x504403,_0x50e32a));});}else{_0x59b872(ut['message'](_0x24470a['message'],_0x504403,_0x50e32a));}})[_0x0a9e('0x7d')](function(_0x19dcc2){ut[_0x0a9e('0x64')](_0x0a9e('0x121'),_0x19dcc2);_0x59b872(ut[_0x0a9e('0x4e')](_0x0a9e('0x122'),![],!![]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11c')]=function(_0x5d74e9){if(_['isNil'](_0x5d74e9)||_[_0x0a9e('0x10d')](_0x5d74e9)||!_[_0x0a9e('0x72')](_0x5d74e9[0x0]['Agent'])&&_[_0x0a9e('0x72')](_0x5d74e9[0x0][_0x0a9e('0x89')][_0x0a9e('0x27')])){ut[_0x0a9e('0x64')](_0x0a9e('0x123'),_0x5d74e9);return{'isValid':![],'message':_0x0a9e('0x124')};}var _0x167196=this[_0x0a9e('0x12')][_0x5d74e9[0x0][_0x0a9e('0x73')][_0x0a9e('0x27')]];_0x167196[_0x0a9e('0x4e')]=_0x0a9e('0x9e');if(_['isNil'](_0x167196)){ut[_0x0a9e('0x64')](_0x0a9e('0x125'),_0x167196);return{'isValid':![],'message':_0x0a9e('0x126')};}if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x55')])){ut[_0x0a9e('0x64')](_0x0a9e('0x127'),_0x0a9e('0x128')+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x129'));if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x9c')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12a'));return{'isValid':![],'message':_0x0a9e('0x12b')};}}if(!ut[_0x0a9e('0x9a')](_0x167196[_0x0a9e('0x34')])){ut[_0x0a9e('0x64')](_0x0a9e('0x12c'),_0x167196['name']+_0x0a9e('0x12d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12d')};}return{'isValid':!![],'message':_0x0a9e('0x12e')};};Preview[_0x0a9e('0xe')][_0x0a9e('0x12f')]=function(_0x358f74,_0x465003,_0x261eca,_0xa7a754){var _0x32a199=this;return new BPromise(function(_0x39d367,_0x8231e5){var _0x43111e=_0x358f74[_0x0a9e('0xb9')];var _0x3c8a9a=_0x32a199[_0x0a9e('0x9b')](_0x465003['Trunk'])?util['format'](_0x0a9e('0x130'),_0x465003[_0x0a9e('0x55')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003['dialCutDigit']>0x0?_0x261eca[_0x0a9e('0x11e')]['substring'](_0x465003[_0x0a9e('0x133')]):_0x261eca['phone']):util[_0x0a9e('0x5e')]('SIP/%s/%s%s',_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['name']:_0x465003[_0x0a9e('0x9c')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003[_0x0a9e('0x133')]>0x0?_0x261eca[_0x0a9e('0x11e')][_0x0a9e('0x134')](_0x465003[_0x0a9e('0x133')]):_0x261eca[_0x0a9e('0x11e')]);var _0x1a3143=_0x32a199[_0x0a9e('0x9b')](_0x465003[_0x0a9e('0x55')])?ut[_0x0a9e('0x135')](_0x465003[_0x0a9e('0x55')][_0x0a9e('0x57')],_0x465003[_0x0a9e('0x35')],_0x465003[_0x0a9e('0x136')]>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003['dialOriginateCallerIdNumber']):ut[_0x0a9e('0x135')](_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['callerid']:_0x465003['TrunkBackup']['callerid'],_0x465003[_0x0a9e('0x35')],_0x465003['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003[_0x0a9e('0x138')]);if(_0x1a3143){_0x358f74[_0x0a9e('0x139')]=ut[_0x0a9e('0x13a')](_0x1a3143);_0x358f74[_0x0a9e('0x13b')]=ut[_0x0a9e('0x13c')](_0x1a3143);}var _0x2154d8=ut[_0x0a9e('0x13d')](_0x465003,_0x261eca,_0x3c8a9a,_0x1a3143,_0x43111e,_0x358f74);_['merge'](_0x358f74,ut[_0x0a9e('0x13e')](_0x2154d8));_0x358f74['starttime']=moment()[_0x0a9e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x7c')](ut[_0x0a9e('0x13f')](_0x358f74,_0x465003,_0x2154d8,_0x358f74[_0x0a9e('0xae')],_0xa7a754))['then'](function(_0x920ad8){_0x465003[_0x0a9e('0x4f')]+=0x1;logger['info']('[originated][increment]',_0x43111e,_0x0a9e('0xba'),_0x465003[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x465003['originated']);_0x39d367(_0x920ad8);})['catch'](function(_0x4869c1){ut[_0x0a9e('0xfd')](_0x358f74,0xe,_0x0a9e('0x140'));rpcDb[_0x0a9e('0xff')](_0x358f74,_0x0a9e('0x141'));_0x8231e5(_0x4869c1);});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x142')]=function(_0x183b9b){if(this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]]){this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]][_0x0a9e('0x143')]=_0x183b9b[_0x0a9e('0x143')];}};Preview[_0x0a9e('0xe')][_0x0a9e('0x19')]=function(_0x1a74c4){var _0x94e69b=this;var _0x320367=this['actions'][_0x1a74c4[_0x0a9e('0x144')]];if(_0x320367){if(_0x320367[_0x0a9e('0x10c')]&&this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]){ut[_0x0a9e('0x145')](_0x320367,this[_0x0a9e('0x16')][_0x320367['lookAgent']][_0x0a9e('0x27')],this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]['id']);}var _0x1109de=_[_0x0a9e('0x146')](_0x320367);_0x1109de[_0x0a9e('0xb6')]=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));var _0x4175a6=_0x94e69b['campaignsPreview'][_0x320367['queue']];if(ut[_0x0a9e('0x147')](_0x1a74c4[_0x0a9e('0x148')])){if(_0x320367['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x320367[_0x0a9e('0xb1')]);}if(_0x320367['activeContact']){rpcDb[_0x0a9e('0x8d')](_0x320367['idContact']);}ami[_0x0a9e('0x5f')](_0x0a9e('0x14a'),ut['buildObj'](_0x320367,_0x0a9e('0x14b'),this[_0x0a9e('0x12')][_0x320367['queue']]));this[_0x0a9e('0xfa')](_0x1109de,_0x4175a6,_0x1a74c4);}else{_0x320367[_0x0a9e('0x8e')]=moment()['format'](_0x0a9e('0xb5'));ut[_0x0a9e('0xfd')](_0x1109de,0x4,_0x0a9e('0xc2'));rpcDb[_0x0a9e('0xff')](_0x1109de,_0x0a9e('0x14c'));}}};Preview[_0x0a9e('0xe')]['syncHangup']=function(_0x1e5b09){var _0x36dc4f=this;var _0x51e697=this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]];var _0x22c390;if(_0x51e697){_0x22c390=this[_0x0a9e('0x12')][_0x51e697[_0x0a9e('0x74')]];logger[_0x0a9e('0x5c')](_0x0a9e('0x14d'),_0x1e5b09['linkedid'],'\x20Queue',_0x22c390['name'],'pTalking:\x20',_0x22c390['pTalking']);}if(this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]]&&_0x1e5b09['linkedid']!==_0x1e5b09['uniqueid']){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this[_0x0a9e('0x15')][_0x1e5b09['linkedid']][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')]('[syncHangup][talking][cause]',_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390[_0x0a9e('0x2b')]);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09['linkedid'],_0x1e5b09[_0x0a9e('0x14e')]);}}else if(_0x51e697&&_['isNil'](_0x51e697[_0x0a9e('0x14f')])&&_0x22c390[_0x0a9e('0x150')]&&_0x1e5b09['linkedid']===_0x1e5b09[_0x0a9e('0xb9')]&&_[_0x0a9e('0x72')](_0x1e5b09['reason'])&&_0x1e5b09[_0x0a9e('0x14e')]==='16'&&_0x1e5b09['channelstate']==='6'&&_[_0x0a9e('0xfb')](_0x51e697[_0x0a9e('0x151')])){if(_0x51e697['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x51e697['idContact']);}if(_0x51e697[_0x0a9e('0xae')]){rpcDb[_0x0a9e('0x8d')](_0x51e697[_0x0a9e('0xb1')]);}_0x1e5b09[_0x0a9e('0xfc')]='22';this[_0x0a9e('0xfa')](_0x51e697,_0x22c390,_0x1e5b09);}else if(_0x51e697&&_0x51e697[_0x0a9e('0x151')]){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x152'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09['cause'],_0x0a9e('0xba'),_0x22c390['name'],'pTalking:\x20',_0x22c390[_0x0a9e('0x2b')]);this['callProgressDetectingCustomer'](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x153'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390['pTalking']);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')]['syncDialEnd']=function(_0x38d95a){if(this[_0x0a9e('0x15')][_0x38d95a[_0x0a9e('0xf9')]]&&_0x38d95a['destlinkedid']!==_0x38d95a[_0x0a9e('0x154')]){this[_0x0a9e('0x9f')](_0x38d95a,_0x38d95a[_0x0a9e('0xf9')],_0x38d95a['dialstatus']);}};Preview[_0x0a9e('0xe')]['syncHangupRequest']=function(_0x2394f2){if(this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]&&_0x2394f2[_0x0a9e('0xaf')]!==_0x2394f2[_0x0a9e('0xb9')]&&!this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]['dialAnswer']){if(_0x2394f2[_0x0a9e('0x14e')]==='1'){this[_0x0a9e('0x9f')](_0x2394f2,_0x2394f2[_0x0a9e('0xaf')],_0x2394f2[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')][_0x0a9e('0x155')]=function(_0x3a4def,_0x2670f5,_0x2310ca){if(this[_0x0a9e('0x15')][_0x3a4def]){if(_[_0x0a9e('0x72')](this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')])){this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')]={};}this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')][_0x2670f5]=_0x2310ca;}};Preview[_0x0a9e('0xe')][_0x0a9e('0x21')]=function(_0x611e46){try{if(!_[_0x0a9e('0x72')](_0x611e46)){if(ut[_0x0a9e('0x157')](_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0])){this[_0x0a9e('0x155')](_0x611e46[_0x0a9e('0xb9')],_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0],_0x611e46[_0x0a9e('0x159')]);}}}catch(_0x4c925e){logger[_0x0a9e('0x15a')](_0x0a9e('0x15b'),util[_0x0a9e('0x15c')](_0x4c925e,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xe')][_0x0a9e('0x23')]=function(_0xb09ef6){if(_0xb09ef6){if(this[_0x0a9e('0x15')][_0xb09ef6[_0x0a9e('0x15d')]]){this['actions'][_0xb09ef6[_0x0a9e('0x15d')]][_0x0a9e('0x151')]=!![];}}};Preview['prototype'][_0x0a9e('0x25')]=function(_0x2db8fe){if(_0x2db8fe){if(this[_0x0a9e('0x15')][_0x2db8fe['transfererlinkedid']]){this[_0x0a9e('0x15')][_0x2db8fe[_0x0a9e('0x15e')]][_0x0a9e('0x151')]=!![];}}};module[_0x0a9e('0x15f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index d54d06c..a9a7ab9 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 _0x9b89=['rescheduleContact','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','catch','[createHistory]\x20','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal'];(function(_0x55ee69,_0x3eec19){var _0x2b9aef=function(_0xd8b357){while(--_0xd8b357){_0x55ee69['push'](_0x55ee69['shift']());}};_0x2b9aef(++_0x3eec19);}(_0x9b89,0x87));var _0x99b8=function(_0xadaa,_0x501ab2){_0xadaa=_0xadaa-0x0;var _0x3d71d6=_0x9b89[_0xadaa];return _0x3d71d6;};'use strict';var util=require(_0x99b8('0x0'));var BPromise=require(_0x99b8('0x1'));var logger=require(_0x99b8('0x2'))(_0x99b8('0x3'));var _=require(_0x99b8('0x4'));var cmHopper=require(_0x99b8('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x99b8('0x6'));var cmHopperBlack=require(_0x99b8('0x7'));var voiceQueueRt=require(_0x99b8('0x8'));var agentReportPreview=require(_0x99b8('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x57686f){return function(_0x2f9c91){logger[_0x99b8('0xa')](_0x57686f,util[_0x99b8('0xb')](_0x2f9c91,{'showHidden':![],'depth':null}));};}function create(_0x1f60c1){return BPromise[_0x99b8('0xc')]()['then'](cmHopperHistory['createHistory'](_0x1f60c1))[_0x99b8('0xd')](loggerCatch(_0x99b8('0xe')));}function createAgent(_0x19c799){return BPromise[_0x99b8('0xc')]()[_0x99b8('0xf')](agentReportPreview[_0x99b8('0x10')](_0x19c799))[_0x99b8('0xd')](loggerCatch(_0x99b8('0xe')));}function moveContact(_0x1ae478){return BPromise[_0x99b8('0xc')]()['then'](cmHopper[_0x99b8('0x11')](_0x1ae478,!![]))[_0x99b8('0xd')](loggerCatch(_0x99b8('0x12')));}exports[_0x99b8('0x13')]=function(_0x1cd535){return BPromise[_0x99b8('0xc')]()[_0x99b8('0xf')](cmHopperBlack['checkIsBlackList'](_0x1cd535))['catch'](loggerCatch(_0x99b8('0x14')));};exports['getContactPreview']=function(_0x4e50ae){return BPromise['resolve']()['then'](cmHopper[_0x99b8('0x15')](_0x4e50ae))['catch'](loggerCatch(_0x99b8('0x16')));};exports[_0x99b8('0x10')]=function(_0xa8d625,_0x55558b){create(_0xa8d625)['catch'](loggerCatch(_0x55558b));moveContact(_0xa8d625)['catch'](loggerCatch(_0x55558b));};exports['createAgentHistory']=function(_0x444388,_0x2e0e0b){createAgent(_0x444388)[_0x99b8('0xd')](loggerCatch(_0x2e0e0b));};exports['createCustomerHistory']=function(_0xad3af6,_0x173d2c){create(_0xad3af6)[_0x99b8('0xd')](loggerCatch(_0x173d2c));};exports[_0x99b8('0x17')]=function(_0x47f359,_0x818794){moveContact(_0x47f359)[_0x99b8('0xd')](loggerCatch(_0x818794));};exports[_0x99b8('0x18')]=function(_0x1a9606,_0x463de1,_0x30f3dd){if(_0x463de1){_0x1a9606['UserId']=null;}if(_0x30f3dd){_0x1a9606['active']=![];}return BPromise[_0x99b8('0xc')]()['then'](cmHopper[_0x99b8('0x18')](_0x1a9606))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x99b8('0x19')]=function(_0x10d287){return BPromise[_0x99b8('0xc')]()[_0x99b8('0xf')](cmHopper[_0x99b8('0x19')](_0x10d287))[_0x99b8('0xd')](loggerCatch('[countReScheduled]\x20'));};exports[_0x99b8('0x1a')]=function(_0x40164e){return BPromise[_0x99b8('0xc')]()[_0x99b8('0xf')](cmHopper[_0x99b8('0x1a')]({'UserId':null},_0x40164e,0x1))[_0x99b8('0xd')](loggerCatch(_0x99b8('0x1b')));};exports['disableContact']=function(_0x268868){return BPromise[_0x99b8('0xc')]()['then'](cmHopper[_0x99b8('0x1a')]({'active':![]},_0x268868,0x1))[_0x99b8('0xd')](loggerCatch(_0x99b8('0x1c')));};exports[_0x99b8('0x1d')]=function(_0x584d80){var _0x3c434d={};_0x3c434d['type']=_0x584d80['type'];_0x3c434d[_0x99b8('0x1e')]=_0x584d80['uniqueid'];_0x3c434d[_0x99b8('0x1f')]=_0x584d80[_0x99b8('0x1f')];_0x3c434d[_0x99b8('0x20')]=_0x584d80[_0x99b8('0x20')];_0x3c434d['queue']=_0x584d80[_0x99b8('0x21')];_0x3c434d['queuecallerjoinAt']=_0x584d80[_0x99b8('0x22')];_0x3c434d[_0x99b8('0x23')]=_0x584d80[_0x99b8('0x22')];_0x3c434d[_0x99b8('0x24')]=0x1;_0x3c434d[_0x99b8('0x25')]=_0x584d80[_0x99b8('0x26')];_0x3c434d[_0x99b8('0x27')]=_0x584d80['membername'];_0x3c434d[_0x99b8('0x28')]=_0x99b8('0x29');_0x3c434d[_0x99b8('0x2a')]=_0x99b8('0x2b');_0x3c434d[_0x99b8('0x2c')]=0x0;_0x3c434d[_0x99b8('0x2d')]=0x1;_0x3c434d[_0x99b8('0x2e')]=_0x584d80[_0x99b8('0x2f')];_0x3c434d[_0x99b8('0x30')]=_0x99b8('0x31');return BPromise['resolve']()['then'](voiceQueueReport[_0x99b8('0x32')](_0x3c434d))[_0x99b8('0xd')](loggerCatch(_0x99b8('0x33')));};exports['getContactRecallMe']=function(_0x3f76e6,_0x2e35aa){return BPromise[_0x99b8('0xc')]()[_0x99b8('0xf')](cmHopper['getContactRecallMe'](_0x3f76e6,_0x2e35aa))[_0x99b8('0xd')](loggerCatch(_0x99b8('0x34')));};exports['rescheduleContactInQueue']=function(_0x4d0113){return BPromise[_0x99b8('0xc')]()[_0x99b8('0xf')](cmHopper[_0x99b8('0x18')](_0x4d0113,!![],!![]))[_0x99b8('0xd')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x8c85=['util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','resolve','createHistory','catch','[createHistory]\x20','then','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','endtime','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0x8c85,0x13e));var _0x58c8=function(_0x109902,_0x502447){_0x109902=_0x109902-0x0;var _0x42db58=_0x8c85[_0x109902];return _0x42db58;};'use strict';var util=require(_0x58c8('0x0'));var BPromise=require(_0x58c8('0x1'));var logger=require('../../../config/logger')(_0x58c8('0x2'));var _=require(_0x58c8('0x3'));var cmHopper=require(_0x58c8('0x4'));var cmHopperFinal=require(_0x58c8('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x58c8('0x6'));var voiceQueueRt=require(_0x58c8('0x7'));var agentReportPreview=require(_0x58c8('0x8'));var voiceQueueReport=require(_0x58c8('0x9'));function loggerCatch(_0x3493a0){return function(_0x44d67d){logger['error'](_0x3493a0,util['inspect'](_0x44d67d,{'showHidden':![],'depth':null}));};}function create(_0x30c233){return BPromise[_0x58c8('0xa')]()['then'](cmHopperHistory[_0x58c8('0xb')](_0x30c233))[_0x58c8('0xc')](loggerCatch(_0x58c8('0xd')));}function createAgent(_0x3d48d9){return BPromise[_0x58c8('0xa')]()[_0x58c8('0xe')](agentReportPreview[_0x58c8('0xb')](_0x3d48d9))[_0x58c8('0xc')](loggerCatch(_0x58c8('0xd')));}function moveContact(_0x54907d){return BPromise[_0x58c8('0xa')]()[_0x58c8('0xe')](cmHopper['moveContactManagedDialer'](_0x54907d,!![]))[_0x58c8('0xc')](loggerCatch(_0x58c8('0xf')));}exports['checkIsBlackList']=function(_0x2d54bf){return BPromise[_0x58c8('0xa')]()[_0x58c8('0xe')](cmHopperBlack[_0x58c8('0x10')](_0x2d54bf))[_0x58c8('0xc')](loggerCatch(_0x58c8('0x11')));};exports[_0x58c8('0x12')]=function(_0x140afb){return BPromise[_0x58c8('0xa')]()[_0x58c8('0xe')](cmHopper[_0x58c8('0x12')](_0x140afb))[_0x58c8('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0x58c8('0xb')]=function(_0x1f5fa4,_0x445da7){create(_0x1f5fa4)[_0x58c8('0xc')](loggerCatch(_0x445da7));moveContact(_0x1f5fa4)[_0x58c8('0xc')](loggerCatch(_0x445da7));};exports[_0x58c8('0x13')]=function(_0x215564,_0x36284d){createAgent(_0x215564)[_0x58c8('0xc')](loggerCatch(_0x36284d));};exports['createCustomerHistory']=function(_0x20a443,_0x1f2235){create(_0x20a443)[_0x58c8('0xc')](loggerCatch(_0x1f2235));};exports[_0x58c8('0x14')]=function(_0x497331,_0x47015d){moveContact(_0x497331)['catch'](loggerCatch(_0x47015d));};exports[_0x58c8('0x15')]=function(_0x35464c,_0x17f168,_0x4f2425){if(_0x17f168){_0x35464c[_0x58c8('0x16')]=null;}if(_0x4f2425){_0x35464c[_0x58c8('0x17')]=![];}return BPromise['resolve']()[_0x58c8('0xe')](cmHopper[_0x58c8('0x15')](_0x35464c))[_0x58c8('0xc')](loggerCatch(_0x58c8('0x18')));};exports[_0x58c8('0x19')]=function(_0x5af305){return BPromise[_0x58c8('0xa')]()[_0x58c8('0xe')](cmHopper['countReScheduled'](_0x5af305))[_0x58c8('0xc')](loggerCatch(_0x58c8('0x1a')));};exports[_0x58c8('0x1b')]=function(_0x450735){return BPromise[_0x58c8('0xa')]()['then'](cmHopper[_0x58c8('0x1b')]({'UserId':null},_0x450735,0x1))[_0x58c8('0xc')](loggerCatch(_0x58c8('0x1c')));};exports[_0x58c8('0x1d')]=function(_0x363886){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'active':![]},_0x363886,0x1))['catch'](loggerCatch(_0x58c8('0x1e')));};exports[_0x58c8('0x1f')]=function(_0x53566c){var _0x510f74={};_0x510f74[_0x58c8('0x20')]=_0x53566c['type'];_0x510f74[_0x58c8('0x21')]=_0x53566c[_0x58c8('0x21')];_0x510f74['calleridnum']=_0x53566c[_0x58c8('0x22')];_0x510f74[_0x58c8('0x23')]=_0x53566c['calleridname'];_0x510f74['queue']=_0x53566c[_0x58c8('0x24')];_0x510f74[_0x58c8('0x25')]=_0x53566c['answertime'];_0x510f74[_0x58c8('0x26')]=_0x53566c['answertime'];_0x510f74[_0x58c8('0x27')]=0x1;_0x510f74['queuecallercompleteAt']=_0x53566c[_0x58c8('0x28')];_0x510f74['connectedlinename']=_0x53566c['membername'];_0x510f74[_0x58c8('0x29')]=_0x58c8('0x2a');_0x510f74['exten']=_0x58c8('0x2b');_0x510f74['holdtime']=0x0;_0x510f74[_0x58c8('0x2c')]=0x1;_0x510f74[_0x58c8('0x2d')]=_0x53566c['membername'];_0x510f74[_0x58c8('0x2e')]=_0x58c8('0x2f');return BPromise[_0x58c8('0xa')]()[_0x58c8('0xe')](voiceQueueReport[_0x58c8('0x30')](_0x510f74))[_0x58c8('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x58c8('0x31')]=function(_0x55eaec,_0x5f33cd){return BPromise[_0x58c8('0xa')]()['then'](cmHopper[_0x58c8('0x31')](_0x55eaec,_0x5f33cd))[_0x58c8('0xc')](loggerCatch(_0x58c8('0x32')));};exports[_0x58c8('0x33')]=function(_0x47e88c){return BPromise['resolve']()[_0x58c8('0xe')](cmHopper['rescheduleContact'](_0x47e88c,!![],!![]))[_0x58c8('0xc')](loggerCatch(_0x58c8('0x34')));}; \ 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 7352216..6d45edd 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 _0x9900=['statedesc','Blacklist','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','RECALL','BOOKED','originate','channelAgent','xcally-motion-preview','from-sip','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','scheduledat','add','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','motionChannel','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push','getDiff','ListId','CampaignId','filterKey','type','campaigntype','dialAnswer','active','countglobal','callback','callbackat','sipcallid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9900,0x174));var _0x0990=function(_0x590c18,_0x11f5fd){_0x590c18=_0x590c18-0x0;var _0x32f91e=_0x9900[_0x590c18];return _0x32f91e;};'use strict';var util=require(_0x0990('0x0'));var _=require('lodash');var moment=require(_0x0990('0x1'));var logger=require(_0x0990('0x2'))('preview');var ipAgi=process[_0x0990('0x3')][_0x0990('0x4')]||_0x0990('0x5');function getSeconds(_0x516b53,_0x1d864f){var _0x15fe64=moment(_0x516b53)[_0x0990('0x6')](0x0);var _0x39a933=moment(_0x1d864f)[_0x0990('0x6')](0x0);return _0x15fe64[_0x0990('0x7')](_0x39a933,_0x0990('0x8'));}exports[_0x0990('0x9')]=function(_0x2c5181){return function(_0x3e7b54){logger[_0x0990('0xa')](_0x2c5181,util['inspect'](_0x3e7b54,{'showHidden':![],'depth':null}));};};exports[_0x0990('0xb')]=function(_0x5b4fda,_0x42f2ca){logger[_0x0990('0xc')](_0x5b4fda,util['inspect'](_0x42f2ca,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x155885,_0x5b80bc){logger[_0x0990('0xa')](_0x155885,util[_0x0990('0xd')](_0x5b80bc,{'showHidden':![],'depth':null}));};exports[_0x0990('0xe')]=function(_0x5e71f4){return function(_0x40391f){logger[_0x0990('0xc')](_0x5e71f4,util[_0x0990('0xd')](_0x40391f,{'showHidden':![],'depth':null}));};};exports[_0x0990('0xf')]=function(_0x5f29e2,_0x5ac97d,_0x44a7ae){return{'message':_0x5f29e2,'unlock':_0x5ac97d,'active':_0x44a7ae};};exports[_0x0990('0x10')]=function(_0x29873b,_0x2e83ce,_0x542809){if(!_[_0x0990('0x11')](_0x542809)&&_0x0990('0x12')===typeof _0x542809&&!_[_0x0990('0x13')](_0x542809)){if(!_['isUndefined'](_0x2e83ce)&&'string'===typeof _0x2e83ce&&!_[_0x0990('0x13')](_0x2e83ce)){return util[_0x0990('0x14')](_0x0990('0x15'),_0x2e83ce,_0x542809);}return util[_0x0990('0x14')]('\x22%s\x22\x20<%s>',_0x542809,_0x542809);}if(!_[_0x0990('0x11')](_0x29873b)&&_0x0990('0x12')===typeof _0x29873b&&!_['isEmpty'](_0x29873b)){return _0x29873b;}return'\x22\x22\x20<>';};exports[_0x0990('0x16')]=function(_0x195bf6){if(_[_0x0990('0x17')](_0x195bf6)){return![];}return _0x195bf6;};exports[_0x0990('0x18')]=function(_0x464ea4,_0x630030,_0xdcc034,_0x74e724,_0x4f5273,_0x29b198){var _0x351c0a={'XMD-QUEUE':_0x630030[_0x0990('0x19')]?_0x630030[_0x0990('0x19')]['name']:'','XMD-CALLERID':_0x74e724,'XMD-CALLERID-PREVIEW':_0x29b198?util[_0x0990('0x14')](_0x0990('0x15'),_0x29b198[_0x0990('0x1a')],_0x29b198[_0x0990('0x1b')]):_0x74e724,'XMD-DIALID':_0x4f5273,'XMD-CONTACTID':_0x630030[_0x0990('0x1c')],'XMD-CDRTYPE':_0x0990('0x1d'),'CALLERID(all)':_0x74e724,'XMD-VOICEQUEUEID':_0x630030[_0x0990('0x1e')],'XMD-DIALCHANNEL':_0xdcc034,'XMD-DIALTIMEOUT':_0x464ea4[_0x0990('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x0990('0x14')](_0x0990('0x20'),_0x464ea4[_0x0990('0x21')]?'g':'',_[_0x0990('0x13')](_0x464ea4[_0x0990('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x464ea4[_0x0990('0x23')]||'','XMD-AGI':_0x464ea4['dialQueueProject']?util[_0x0990('0x14')](_0x0990('0x24'),ipAgi,_0x464ea4[_0x0990('0x25')]):'NONE','XMD-AGIAFTER':_0x464ea4[_0x0990('0x21')]?util[_0x0990('0x14')](_0x0990('0x24'),ipAgi,_0x464ea4[_0x0990('0x21')]):_0x0990('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x29b198?_0x29b198['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x29b198?_0x29b198[_0x0990('0x27')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x0990('0x28')};if(!_[_0x0990('0x13')](_0x464ea4[_0x0990('0x22')])){_0x351c0a[util[_0x0990('0x14')]('%s',_0x0990('0x29'))]=_0x464ea4['monitor_format'];_0x351c0a[util[_0x0990('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4f5273;}if(_0x630030&&_0x630030[_0x0990('0x2a')]){for(var _0xf10b95 in _0x630030[_0x0990('0x2a')]){if(_0x630030[_0x0990('0x2a')][_0x0990('0x2b')](_0xf10b95)){if(!_[_0x0990('0x17')](_0x630030[_0x0990('0x2a')][_0xf10b95])&&_0xf10b95!=='id'&&_0xf10b95!==_0x0990('0x2c')&&_0xf10b95!==_0x0990('0x2d')&&_0xf10b95!==_0x0990('0x2e')){_0x351c0a[util[_0x0990('0x14')]('%s%s',_0x0990('0x2f'),_['toUpper'](_0xf10b95))]=_0x630030[_0x0990('0x2a')][_0xf10b95];}}}}return _0x351c0a;};exports['toLowerVariables']=function(_0x256229){var _0x5ff424={};for(var _0x227790 in _0x256229){if(_0x256229['hasOwnProperty'](_0x227790)){_0x5ff424[util[_0x0990('0x14')]('%s',_[_0x0990('0x30')](_0x227790))]=_0x256229[_0x227790];}}return{'variables':_0x5ff424};};exports[_0x0990('0x31')]=function(_0x33ab25,_0x13ef5f){if(!_['isNil'](_0x33ab25)){if(_0x33ab25['hasOwnProperty'](_0x0990('0x32'))){if(_0x33ab25['originated']>0x0){_0x33ab25[_0x0990('0x32')]-=0x1;}else{logger[_0x0990('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x13ef5f);}}}else{logger[_0x0990('0xa')](_0x0990('0x33'),_0x13ef5f);}};exports[_0x0990('0x34')]=function(_0x54cfc5){var _0x39e62a=moment()[_0x0990('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x54cfc5[_0x0990('0x35')]=0xd;_0x54cfc5[_0x0990('0x36')]=_0x0990('0x37');_0x54cfc5[_0x0990('0x38')]=_0x39e62a;_0x54cfc5[_0x0990('0x39')]=_0x39e62a;_0x54cfc5[_0x0990('0x3a')]=_0x39e62a;};exports['logAgent']=function(_0xd92a2b,_0x2f49b0,_0x5e6ce1){var _0x56cc85=moment()[_0x0990('0x14')](_0x0990('0x3b'));_0xd92a2b[_0x0990('0x35')]=_0x2f49b0;_0xd92a2b[_0x0990('0x36')]=_0x5e6ce1;_0xd92a2b['responsetime']=_0x56cc85;_0xd92a2b[_0x0990('0x3c')]=getSeconds(_0xd92a2b[_0x0990('0x39')],_0xd92a2b['starttime']);};exports[_0x0990('0x3d')]=function(_0x1fa612,_0x394992,_0x436cc9){_0x1fa612[_0x0990('0x3e')]=_0x394992;_0x1fa612[_0x0990('0x3f')]=_0x436cc9;};exports[_0x0990('0x40')]=function(_0xc56cb2,_0x44a2ee,_0x3e8d16){var _0x478fff=moment()[_0x0990('0x14')](_0x0990('0x3b'));_0xc56cb2[_0x0990('0x35')]=_0x44a2ee;_0xc56cb2['statedesc']=_0x3e8d16;_0xc56cb2[_0x0990('0x39')]=_0xc56cb2['responsetime']?_0xc56cb2[_0x0990('0x39')]:_0x478fff;_0xc56cb2[_0x0990('0x3a')]=_0xc56cb2[_0x0990('0x3a')]?_0xc56cb2[_0x0990('0x3a')]:_0x478fff;_0xc56cb2[_0x0990('0x3c')]=getSeconds(_0xc56cb2[_0x0990('0x39')]||0x0,_0xc56cb2[_0x0990('0x38')]||0x0);_0xc56cb2[_0x0990('0x41')]=_0xc56cb2[_0x0990('0x42')]?getSeconds(_0xc56cb2[_0x0990('0x3a')],_0xc56cb2['answertime']):0x0;};exports[_0x0990('0x43')]=function(_0x5554c0){return _0x5554c0==='Failure';};exports['variablesAction']=function(_0x4ef47d,_0x2740c6,_0x3f725a,_0x121532,_0x4cf382){var _0x25e732=_0x121532?_0x0990('0x44'):_0x4ef47d[_0x0990('0x1a')];_0x25e732=_0x4cf382?_0x0990('0x45'):_0x25e732;return{'actionid':_0x4ef47d['uniqueid'],'action':_0x0990('0x46'),'channel':_0x4ef47d[_0x0990('0x47')],'callerid':util['format'](_0x0990('0x15'),_0x25e732,_0x4ef47d[_0x0990('0x1b')]),'Exten':_0x0990('0x48'),'Context':_0x0990('0x49'),'Priority':'1','variable':_0x3f725a,'timeout':(_0x2740c6['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4ef47d[_0x0990('0x4a')]};};exports[_0x0990('0x4b')]=function(_0x38d54f){return _0x38d54f[_0x0990('0x4c')]+_0x38d54f[_0x0990('0x4d')]+_0x38d54f[_0x0990('0x4e')]+_0x38d54f[_0x0990('0x4f')]+_0x38d54f[_0x0990('0x50')];};exports['cloneAction']=function(_0xc59ba6){var _0x2dc1c9=_[_0x0990('0x51')](_0xc59ba6);_0x2dc1c9[_0x0990('0x35')]=0xf;_0x2dc1c9['statedesc']=_0x0990('0x52');return _0x2dc1c9;};exports[_0x0990('0x53')]=function(_0xaf1dfe,_0x44d4c7,_0xda4d5a){var _0x216fee={};_0x216fee[_0x44d4c7]=_0xaf1dfe[_0x44d4c7];_0x216fee['active']=![];_0x216fee[_0x0990('0x54')]=moment()[_0x0990('0x55')](_0xda4d5a,'minutes')[_0x0990('0x14')](_0x0990('0x3b'));_0x216fee[_0x0990('0x1c')]=_0xaf1dfe['ContactId'];_0x216fee['ListId']=_0xaf1dfe['ListId'];_0x216fee[_0x0990('0x1e')]=_0xaf1dfe['VoiceQueueId']||undefined;return _0x216fee;};exports[_0x0990('0x56')]=function(_0x47fe88,_0x2a4726){if(!_[_0x0990('0x17')](_0x47fe88)){if(_0x47fe88[_0x0990('0x57')]>0x0){_0x47fe88[_0x0990('0x57')]-=0x1;}else{logger[_0x0990('0xa')](_0x2a4726,_0x0990('0x58'));}}else{logger[_0x0990('0xa')](_0x2a4726,_0x0990('0x59'));}};exports[_0x0990('0x5a')]=function(_0x1363c7){if(_0x1363c7<=0x0){return!![];}return![];};exports[_0x0990('0x5b')]=function(_0x57f63c,_0x176dc6,_0x328719){_0x57f63c[_0x0990('0x5c')]=_0x176dc6;_0x57f63c[_0x0990('0x5d')]=_0x57f63c[_0x0990('0x5e')];_0x57f63c[_0x0990('0x5f')]=_0x57f63c[_0x0990('0x47')];_0x57f63c[_0x0990('0x60')]='voice';if(_0x328719){_0x57f63c[_0x0990('0x61')]=_0x328719['mandatoryDisposition'];}return _0x57f63c;};exports['buildAcw']=function(_0x439cb7){var _0x5fb01={};_0x5fb01[_0x0990('0x5e')]=_0x439cb7[_0x0990('0x5e')];_0x5fb01[_0x0990('0x5f')]=_0x439cb7[_0x0990('0x47')];_0x5fb01[_0x0990('0x4a')]=_0x439cb7[_0x0990('0x4a')];return _0x5fb01;};exports[_0x0990('0x62')]=function(_0x5a633b){var _0x21635c=[];for(var _0x5ae483 in _0x5a633b){if(_0x5a633b['hasOwnProperty'](_0x5ae483)){if(!_[_0x0990('0x17')](_0x5a633b[_0x5ae483])&&_0x5a633b[_0x5ae483][_0x0990('0x35')]===_0x0990('0x63')&&_0x5a633b[_0x5ae483][_0x0990('0x64')]===_0x0990('0x65')){_0x21635c[_0x0990('0x66')](_0x5a633b[_0x5ae483]['id']);}}}return _0x21635c;};exports[_0x0990('0x67')]=function(_0x4f1b5f){var _0x4e6fb8=moment()[_0x0990('0x6')](0x0);var _0x1d0ef9=moment(_0x4f1b5f)[_0x0990('0x6')](0x0);return _0x4e6fb8['diff'](_0x1d0ef9,'seconds');};exports['createBody']=function(_0xc5e48d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xc5e48d[_0x0990('0x1c')],'ListId':_0xc5e48d[_0x0990('0x68')],'VoiceQueueId':_0xc5e48d[_0x0990('0x1e')]||undefined,'CampaignId':_0xc5e48d[_0x0990('0x69')]||undefined};};exports[_0x0990('0x6a')]=function(_0xbb9d4b){if(_0xbb9d4b===_0x0990('0x4a')||_0xbb9d4b==='idContact'||_0xbb9d4b===_0x0990('0x5e')||_0xbb9d4b===_0x0990('0x6b')||_0xbb9d4b===_0x0990('0x6c')||_0xbb9d4b===_0x0990('0x6d')||_0xbb9d4b==='membername'||_0xbb9d4b===_0x0990('0x47')||_0xbb9d4b==='calleridname'||_0xbb9d4b===_0x0990('0x6e')||_0xbb9d4b==='calleridnum'||_0xbb9d4b===_0x0990('0x54')||_0xbb9d4b===_0x0990('0x4c')||_0xbb9d4b===_0x0990('0x4d')||_0xbb9d4b===_0x0990('0x4e')||_0xbb9d4b===_0x0990('0x6f')||_0xbb9d4b===_0x0990('0x70')||_0xbb9d4b==='callbackuniqueid'||_0xbb9d4b===_0x0990('0x71')||_0xbb9d4b==='recallme'||_0xbb9d4b===_0x0990('0x1c')||_0xbb9d4b===_0x0990('0x68')||_0xbb9d4b==='UserId'||_0xbb9d4b===_0x0990('0x1e')||_0xbb9d4b===_0x0990('0x72')||_0xbb9d4b==='xmd-voicequeueid'||_0xbb9d4b===_0x0990('0x73')||_0xbb9d4b==='xmd-phone'||_0xbb9d4b==='xmd-listid'||_0xbb9d4b===_0x0990('0x74')||_0xbb9d4b===_0x0990('0x75')||_0xbb9d4b===_0x0990('0x76')||_0xbb9d4b===_0x0990('0x77')||_0xbb9d4b===_0x0990('0x78')||_0xbb9d4b===_0x0990('0x79')||_0xbb9d4b===_0x0990('0x7a')||_0xbb9d4b===_0x0990('0x7b')||_0xbb9d4b===_0x0990('0x7c')||_0xbb9d4b===_0x0990('0x7d')||_0xbb9d4b===_0x0990('0x7e')||_0xbb9d4b===_0x0990('0x7f')||_0xbb9d4b===_0x0990('0x80')||_0xbb9d4b==='rtpaudioqosjitterbridged'||_0xbb9d4b===_0x0990('0x81')||_0xbb9d4b===_0x0990('0x82')||_0xbb9d4b==='rtpaudioqosrtt'||_0xbb9d4b===_0x0990('0x83')||_0xbb9d4b==='rtpaudioqos'||_0xbb9d4b==='rtpaudioqosbridged'||_0xbb9d4b===_0x0990('0x80')||_0xbb9d4b===_0x0990('0x84')||_0xbb9d4b===_0x0990('0x81')||_0xbb9d4b==='rtpaudioqoslossbridged'||_0xbb9d4b===_0x0990('0x85')||_0xbb9d4b===_0x0990('0x83')||_0xbb9d4b==='bridgepeer'||_0xbb9d4b===_0x0990('0x86')||_0xbb9d4b===_0x0990('0x35')||_0xbb9d4b===_0x0990('0x36')){return![];}return!![];};exports[_0x0990('0x87')]=function(_0x398491,_0x140bae){var _0x364583,_0x30926b,_0x24c82e;if(_0x140bae<=0x0){_0x140bae=0x1;}_0x364583=new RegExp('\x5cw{0,'+_0x140bae+'}$');_0x30926b=Math[_0x0990('0x88')](0xa,_0x140bae-0x1);_0x24c82e=Math[_0x0990('0x88')](0xa,_0x140bae)-0x1;return util[_0x0990('0x14')]('%s',_[_0x0990('0x89')](_0x398491,_0x364583,_[_0x0990('0x8a')](_0x30926b,_0x24c82e)));};exports[_0x0990('0x8b')]=function(_0x394f90){var _0x6a56ab=_0x394f90[_0x0990('0x8c')](/"(.*?)"/);return _0x6a56ab?_0x6a56ab[0x1]:_0x394f90;};exports[_0x0990('0x8d')]=function(_0x3136d4){var _0x2272e7=_0x3136d4[_0x0990('0x8c')](/<(.*?)>/);return _0x2272e7?_0x2272e7[0x1]:_0x3136d4;}; \ No newline at end of file +var _0xf8e0=['originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','logAgent','state','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','talktime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','minutes','ContactId','ListId','decrementTalkink','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','motionChannel','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','push','getDiff','seconds','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','scheduledat','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','../../../../config/logger','preview','milliseconds','diff','error','logger','inspect','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xf8e0,0xe9));var _0x0f8e=function(_0x5a5f1d,_0x3359d8){_0x5a5f1d=_0x5a5f1d-0x0;var _0x597cf4=_0xf8e0[_0x5a5f1d];return _0x597cf4;};'use strict';var util=require(_0x0f8e('0x0'));var _=require(_0x0f8e('0x1'));var moment=require('moment');var logger=require(_0x0f8e('0x2'))(_0x0f8e('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x64e5d9,_0x17670a){var _0x346e9d=moment(_0x64e5d9)[_0x0f8e('0x4')](0x0);var _0x1d89ff=moment(_0x17670a)[_0x0f8e('0x4')](0x0);return _0x346e9d[_0x0f8e('0x5')](_0x1d89ff,'seconds');}exports['loggerCatch']=function(_0x30c480){return function(_0x17a6e9){logger[_0x0f8e('0x6')](_0x30c480,util['inspect'](_0x17a6e9,{'showHidden':![],'depth':null}));};};exports[_0x0f8e('0x7')]=function(_0x138551,_0x8b8471){logger['info'](_0x138551,util[_0x0f8e('0x8')](_0x8b8471,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1e601e,_0x447033){logger[_0x0f8e('0x6')](_0x1e601e,util[_0x0f8e('0x8')](_0x447033,{'showHidden':![],'depth':null}));};exports[_0x0f8e('0x9')]=function(_0x456f2d){return function(_0x328fb4){logger['info'](_0x456f2d,util[_0x0f8e('0x8')](_0x328fb4,{'showHidden':![],'depth':null}));};};exports[_0x0f8e('0xa')]=function(_0x1a679e,_0xfa1e05,_0x4ff56c){return{'message':_0x1a679e,'unlock':_0xfa1e05,'active':_0x4ff56c};};exports[_0x0f8e('0xb')]=function(_0x479433,_0x15ebf6,_0x319904){if(!_[_0x0f8e('0xc')](_0x319904)&&_0x0f8e('0xd')===typeof _0x319904&&!_[_0x0f8e('0xe')](_0x319904)){if(!_['isUndefined'](_0x15ebf6)&&_0x0f8e('0xd')===typeof _0x15ebf6&&!_[_0x0f8e('0xe')](_0x15ebf6)){return util[_0x0f8e('0xf')]('\x22%s\x22\x20<%s>',_0x15ebf6,_0x319904);}return util[_0x0f8e('0xf')](_0x0f8e('0x10'),_0x319904,_0x319904);}if(!_[_0x0f8e('0xc')](_0x479433)&&_0x0f8e('0xd')===typeof _0x479433&&!_['isEmpty'](_0x479433)){return _0x479433;}return _0x0f8e('0x11');};exports[_0x0f8e('0x12')]=function(_0x555e54){if(_[_0x0f8e('0x13')](_0x555e54)){return![];}return _0x555e54;};exports[_0x0f8e('0x14')]=function(_0x3ac1e1,_0x68039,_0x183e23,_0x1acc49,_0x36d6ba,_0x64355){var _0x4129b7={'XMD-QUEUE':_0x68039[_0x0f8e('0x15')]?_0x68039['Queue'][_0x0f8e('0x16')]:'','XMD-CALLERID':_0x1acc49,'XMD-CALLERID-PREVIEW':_0x64355?util['format'](_0x0f8e('0x10'),_0x64355[_0x0f8e('0x17')],_0x64355[_0x0f8e('0x18')]):_0x1acc49,'XMD-DIALID':_0x36d6ba,'XMD-CONTACTID':_0x68039['ContactId'],'XMD-CDRTYPE':_0x0f8e('0x19'),'CALLERID(all)':_0x1acc49,'XMD-VOICEQUEUEID':_0x68039[_0x0f8e('0x1a')],'XMD-DIALCHANNEL':_0x183e23,'XMD-DIALTIMEOUT':_0x3ac1e1[_0x0f8e('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x0f8e('0xf')]('\x22rtTxX%s%s\x22',_0x3ac1e1[_0x0f8e('0x1c')]?'g':'',_['isEmpty'](_0x3ac1e1['monitor_format'])?'':_0x0f8e('0x1d')),'XMD-DIALURL':_0x3ac1e1[_0x0f8e('0x1e')]||'','XMD-AGI':_0x3ac1e1['dialQueueProject']?util[_0x0f8e('0xf')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3ac1e1[_0x0f8e('0x1f')]):'NONE','XMD-AGIAFTER':_0x3ac1e1[_0x0f8e('0x1c')]?util['format'](_0x0f8e('0x20'),ipAgi,_0x3ac1e1[_0x0f8e('0x1c')]):_0x0f8e('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x64355?_0x64355[_0x0f8e('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x64355?_0x64355[_0x0f8e('0x23')]:'','XMD-DESTINATION':_0x0f8e('0x24'),'SIPADDHEADER':_0x0f8e('0x25')};if(!_[_0x0f8e('0xe')](_0x3ac1e1[_0x0f8e('0x26')])){_0x4129b7[util[_0x0f8e('0xf')]('%s',_0x0f8e('0x27'))]=_0x3ac1e1[_0x0f8e('0x26')];_0x4129b7[util[_0x0f8e('0xf')]('%s',_0x0f8e('0x28'))]=_0x36d6ba;}if(_0x68039&&_0x68039['Contact']){for(var _0x12c930 in _0x68039[_0x0f8e('0x29')]){if(_0x68039['Contact'][_0x0f8e('0x2a')](_0x12c930)){if(!_[_0x0f8e('0x13')](_0x68039[_0x0f8e('0x29')][_0x12c930])&&_0x12c930!=='id'&&_0x12c930!=='tags'&&_0x12c930!==_0x0f8e('0x2b')&&_0x12c930!==_0x0f8e('0x2c')){_0x4129b7[util[_0x0f8e('0xf')](_0x0f8e('0x2d'),_0x0f8e('0x2e'),_[_0x0f8e('0x2f')](_0x12c930))]=_0x68039['Contact'][_0x12c930];}}}}return _0x4129b7;};exports['toLowerVariables']=function(_0x2bae95){var _0x35bac2={};for(var _0x422bf2 in _0x2bae95){if(_0x2bae95['hasOwnProperty'](_0x422bf2)){_0x35bac2[util[_0x0f8e('0xf')]('%s',_[_0x0f8e('0x30')](_0x422bf2))]=_0x2bae95[_0x422bf2];}}return{'variables':_0x35bac2};};exports['updateOriginated']=function(_0x87ca16,_0x54cc0c){if(!_[_0x0f8e('0x13')](_0x87ca16)){if(_0x87ca16[_0x0f8e('0x2a')](_0x0f8e('0x31'))){if(_0x87ca16[_0x0f8e('0x31')]>0x0){_0x87ca16['originated']-=0x1;}else{logger[_0x0f8e('0x6')](_0x0f8e('0x32'),_0x54cc0c);}}}else{logger[_0x0f8e('0x6')](_0x0f8e('0x33'),_0x54cc0c);}};exports[_0x0f8e('0x34')]=function(_0x54cd38){var _0x272850=moment()[_0x0f8e('0xf')](_0x0f8e('0x35'));_0x54cd38['state']=0xd;_0x54cd38[_0x0f8e('0x36')]=_0x0f8e('0x37');_0x54cd38['starttime']=_0x272850;_0x54cd38[_0x0f8e('0x38')]=_0x272850;_0x54cd38[_0x0f8e('0x39')]=_0x272850;};exports[_0x0f8e('0x3a')]=function(_0x2a276f,_0x196bc6,_0x4d6a4e){var _0x128f2a=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2a276f[_0x0f8e('0x3b')]=_0x196bc6;_0x2a276f[_0x0f8e('0x36')]=_0x4d6a4e;_0x2a276f[_0x0f8e('0x38')]=_0x128f2a;_0x2a276f[_0x0f8e('0x3c')]=getSeconds(_0x2a276f['responsetime'],_0x2a276f[_0x0f8e('0x3d')]);};exports[_0x0f8e('0x3e')]=function(_0x392af6,_0x333c76,_0x46129a){_0x392af6[_0x0f8e('0x3f')]=_0x333c76;_0x392af6[_0x0f8e('0x40')]=_0x46129a;};exports[_0x0f8e('0x41')]=function(_0x2b3da9,_0x458f86,_0x206191){var _0x1f7b12=moment()[_0x0f8e('0xf')](_0x0f8e('0x35'));_0x2b3da9[_0x0f8e('0x3b')]=_0x458f86;_0x2b3da9[_0x0f8e('0x36')]=_0x206191;_0x2b3da9['responsetime']=_0x2b3da9[_0x0f8e('0x38')]?_0x2b3da9[_0x0f8e('0x38')]:_0x1f7b12;_0x2b3da9[_0x0f8e('0x39')]=_0x2b3da9[_0x0f8e('0x39')]?_0x2b3da9[_0x0f8e('0x39')]:_0x1f7b12;_0x2b3da9[_0x0f8e('0x3c')]=getSeconds(_0x2b3da9[_0x0f8e('0x38')]||0x0,_0x2b3da9[_0x0f8e('0x3d')]||0x0);_0x2b3da9[_0x0f8e('0x42')]=_0x2b3da9['answertime']?getSeconds(_0x2b3da9[_0x0f8e('0x39')],_0x2b3da9['answertime']):0x0;};exports['isFailure']=function(_0x594fbc){return _0x594fbc===_0x0f8e('0x43');};exports[_0x0f8e('0x44')]=function(_0x2c3438,_0x184bb8,_0x42017d,_0x42faf5,_0x4af94f){var _0x2f25ff=_0x42faf5?_0x0f8e('0x45'):_0x2c3438[_0x0f8e('0x17')];_0x2f25ff=_0x4af94f?_0x0f8e('0x46'):_0x2f25ff;return{'actionid':_0x2c3438[_0x0f8e('0x47')],'action':_0x0f8e('0x48'),'channel':_0x2c3438['channelAgent'],'callerid':util[_0x0f8e('0xf')](_0x0f8e('0x10'),_0x2f25ff,_0x2c3438[_0x0f8e('0x18')]),'Exten':_0x0f8e('0x24'),'Context':_0x0f8e('0x49'),'Priority':'1','variable':_0x42017d,'timeout':(_0x184bb8[_0x0f8e('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c3438[_0x0f8e('0x47')]};};exports['totalGlobal']=function(_0x286659){return _0x286659[_0x0f8e('0x4b')]+_0x286659[_0x0f8e('0x4c')]+_0x286659['countnoanswerretry']+_0x286659[_0x0f8e('0x4d')]+_0x286659[_0x0f8e('0x4e')];};exports['cloneAction']=function(_0x158e9a){var _0x9b1787=_[_0x0f8e('0x4f')](_0x158e9a);_0x9b1787[_0x0f8e('0x3b')]=0xf;_0x9b1787[_0x0f8e('0x36')]=_0x0f8e('0x50');return _0x9b1787;};exports[_0x0f8e('0x51')]=function(_0x296d99,_0x2293fa,_0x35f9f1){var _0x3f9491={};_0x3f9491[_0x2293fa]=_0x296d99[_0x2293fa];_0x3f9491['active']=![];_0x3f9491['scheduledat']=moment()['add'](_0x35f9f1,_0x0f8e('0x52'))[_0x0f8e('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f9491[_0x0f8e('0x53')]=_0x296d99[_0x0f8e('0x53')];_0x3f9491[_0x0f8e('0x54')]=_0x296d99[_0x0f8e('0x54')];_0x3f9491[_0x0f8e('0x1a')]=_0x296d99[_0x0f8e('0x1a')]||undefined;return _0x3f9491;};exports[_0x0f8e('0x55')]=function(_0xbbcc27,_0x4adccd){if(!_[_0x0f8e('0x13')](_0xbbcc27)){if(_0xbbcc27['pTalking']>0x0){_0xbbcc27['pTalking']-=0x1;}else{logger[_0x0f8e('0x6')](_0x4adccd,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x0f8e('0x6')](_0x4adccd,_0x0f8e('0x56'));}};exports[_0x0f8e('0x57')]=function(_0x4a6966){if(_0x4a6966<=0x0){return!![];}return![];};exports[_0x0f8e('0x58')]=function(_0x2dec0a,_0x2b59e6,_0x1c756e){_0x2dec0a[_0x0f8e('0x59')]=_0x2b59e6;_0x2dec0a['name']=_0x2dec0a[_0x0f8e('0x5a')];_0x2dec0a[_0x0f8e('0x5b')]=_0x2dec0a[_0x0f8e('0x5c')];_0x2dec0a[_0x0f8e('0x5d')]='voice';if(_0x1c756e){_0x2dec0a[_0x0f8e('0x5e')]=_0x1c756e[_0x0f8e('0x5e')];}return _0x2dec0a;};exports[_0x0f8e('0x5f')]=function(_0x31ca54){var _0x22a566={};_0x22a566[_0x0f8e('0x5a')]=_0x31ca54[_0x0f8e('0x5a')];_0x22a566[_0x0f8e('0x5b')]=_0x31ca54[_0x0f8e('0x5c')];_0x22a566[_0x0f8e('0x47')]=_0x31ca54[_0x0f8e('0x47')];return _0x22a566;};exports[_0x0f8e('0x60')]=function(_0x47c045){var _0x5df091=[];for(var _0x4df8d0 in _0x47c045){if(_0x47c045[_0x0f8e('0x2a')](_0x4df8d0)){if(!_['isNil'](_0x47c045[_0x4df8d0])&&_0x47c045[_0x4df8d0][_0x0f8e('0x3b')]===_0x0f8e('0x61')&&_0x47c045[_0x4df8d0]['status']==='reachable'){_0x5df091[_0x0f8e('0x62')](_0x47c045[_0x4df8d0]['id']);}}}return _0x5df091;};exports[_0x0f8e('0x63')]=function(_0x1c9140){var _0x45f09e=moment()[_0x0f8e('0x4')](0x0);var _0x4555f0=moment(_0x1c9140)[_0x0f8e('0x4')](0x0);return _0x45f09e[_0x0f8e('0x5')](_0x4555f0,_0x0f8e('0x64'));};exports['createBody']=function(_0x3bddb5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3bddb5[_0x0f8e('0x53')],'ListId':_0x3bddb5[_0x0f8e('0x54')],'VoiceQueueId':_0x3bddb5[_0x0f8e('0x1a')]||undefined,'CampaignId':_0x3bddb5[_0x0f8e('0x65')]||undefined};};exports[_0x0f8e('0x66')]=function(_0x4975b3){if(_0x4975b3===_0x0f8e('0x47')||_0x4975b3===_0x0f8e('0x67')||_0x4975b3===_0x0f8e('0x5a')||_0x4975b3===_0x0f8e('0x68')||_0x4975b3===_0x0f8e('0x69')||_0x4975b3===_0x0f8e('0x6a')||_0x4975b3===_0x0f8e('0x3f')||_0x4975b3===_0x0f8e('0x5c')||_0x4975b3==='calleridname'||_0x4975b3===_0x0f8e('0x6b')||_0x4975b3===_0x0f8e('0x18')||_0x4975b3===_0x0f8e('0x6c')||_0x4975b3==='countbusyretry'||_0x4975b3===_0x0f8e('0x4c')||_0x4975b3==='countnoanswerretry'||_0x4975b3===_0x0f8e('0x6d')||_0x4975b3==='callback'||_0x4975b3===_0x0f8e('0x6e')||_0x4975b3===_0x0f8e('0x6f')||_0x4975b3===_0x0f8e('0x70')||_0x4975b3===_0x0f8e('0x53')||_0x4975b3===_0x0f8e('0x54')||_0x4975b3===_0x0f8e('0x40')||_0x4975b3===_0x0f8e('0x1a')||_0x4975b3===_0x0f8e('0x71')||_0x4975b3===_0x0f8e('0x72')||_0x4975b3==='xmd-queue'||_0x4975b3==='xmd-phone'||_0x4975b3===_0x0f8e('0x73')||_0x4975b3===_0x0f8e('0x74')||_0x4975b3===_0x0f8e('0x75')||_0x4975b3===_0x0f8e('0x76')||_0x4975b3==='xmd-dialid'||_0x4975b3===_0x0f8e('0x77')||_0x4975b3===_0x0f8e('0x78')||_0x4975b3===_0x0f8e('0x79')||_0x4975b3===_0x0f8e('0x7a')||_0x4975b3===_0x0f8e('0x7b')||_0x4975b3===_0x0f8e('0x7c')||_0x4975b3===_0x0f8e('0x7d')||_0x4975b3===_0x0f8e('0x7e')||_0x4975b3==='rtpaudioqosjitter'||_0x4975b3===_0x0f8e('0x7f')||_0x4975b3===_0x0f8e('0x80')||_0x4975b3===_0x0f8e('0x81')||_0x4975b3===_0x0f8e('0x82')||_0x4975b3===_0x0f8e('0x83')||_0x4975b3==='rtpaudioqos'||_0x4975b3===_0x0f8e('0x7e')||_0x4975b3==='rtpaudioqosjitter'||_0x4975b3===_0x0f8e('0x7f')||_0x4975b3==='rtpaudioqosloss'||_0x4975b3==='rtpaudioqoslossbridged'||_0x4975b3===_0x0f8e('0x82')||_0x4975b3===_0x0f8e('0x83')||_0x4975b3===_0x0f8e('0x84')||_0x4975b3===_0x0f8e('0x85')||_0x4975b3===_0x0f8e('0x3b')||_0x4975b3==='statedesc'){return![];}return!![];};exports[_0x0f8e('0x86')]=function(_0x31401d,_0x80f941){var _0x23dcee,_0x355cf5,_0x364db7;if(_0x80f941<=0x0){_0x80f941=0x1;}_0x23dcee=new RegExp('\x5cw{0,'+_0x80f941+'}$');_0x355cf5=Math[_0x0f8e('0x87')](0xa,_0x80f941-0x1);_0x364db7=Math[_0x0f8e('0x87')](0xa,_0x80f941)-0x1;return util[_0x0f8e('0xf')]('%s',_[_0x0f8e('0x88')](_0x31401d,_0x23dcee,_[_0x0f8e('0x89')](_0x355cf5,_0x364db7)));};exports[_0x0f8e('0x8a')]=function(_0x1b5c08){var _0x3880e6=_0x1b5c08['match'](/"(.*?)"/);return _0x3880e6?_0x3880e6[0x1]:_0x1b5c08;};exports[_0x0f8e('0x8b')]=function(_0x2a1206){var _0x99402d=_0x2a1206[_0x0f8e('0x8c')](/<(.*?)>/);return _0x99402d?_0x99402d[0x1]:_0x2a1206;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 0461c48..a3f5e61 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 _0x715c=['voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','queueremove','boolean'];(function(_0x5089bb,_0x1d024e){var _0xd5213e=function(_0x523775){while(--_0x523775){_0x5089bb['push'](_0x5089bb['shift']());}};_0xd5213e(++_0x1d024e);}(_0x715c,0x14c));var _0xc715=function(_0x15a6de,_0x11df7a){_0x15a6de=_0x15a6de-0x0;var _0xc305b4=_0x715c[_0x15a6de];return _0xc305b4;};'use strict';exports[_0xc715('0x0')]={'queue':{'type':_0xc715('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xc715('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xc715('0x2')]={'queue':{'type':_0xc715('0x1'),'required':!![]},'interface':{'type':_0xc715('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xc715('0x1'),'required':!![]},'paused':{'type':_0xc715('0x3')},'reason':{'type':_0xc715('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xc715('0x1'),'required':![]}};exports[_0xc715('0x4')]={'uniqueid':{'type':_0xc715('0x1'),'required':!![]}};exports[_0xc715('0x5')]={'uniqueid':{'type':_0xc715('0x1'),'required':!![]},'filename':{'type':_0xc715('0x1')},'format':{'type':_0xc715('0x1')},'mixmonitorid':{'type':_0xc715('0x1')}};exports[_0xc715('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xc715('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xc715('0x1')}}; \ No newline at end of file +var _0x0f4a=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove'];(function(_0xefee52,_0x40a17b){var _0x5cc2d8=function(_0x8168de){while(--_0x8168de){_0xefee52['push'](_0xefee52['shift']());}};_0x5cc2d8(++_0x40a17b);}(_0x0f4a,0xcd));var _0xa0f4=function(_0x81e409,_0x39f90f){_0x81e409=_0x81e409-0x0;var _0x5f14b2=_0x0f4a[_0x81e409];return _0x5f14b2;};'use strict';exports[_0xa0f4('0x0')]={'queue':{'type':_0xa0f4('0x1'),'required':!![]},'interface':{'type':_0xa0f4('0x1'),'required':!![]},'membername':{'type':_0xa0f4('0x1'),'required':!![]},'penalty':{'type':_0xa0f4('0x2'),'required':![]},'paused':{'type':_0xa0f4('0x3'),'required':![]}};exports[_0xa0f4('0x4')]={'queue':{'type':_0xa0f4('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xa0f4('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xa0f4('0x3')},'reason':{'type':_0xa0f4('0x1'),'required':![]}};exports[_0xa0f4('0x6')]={'module':{'type':_0xa0f4('0x1'),'required':![]}};exports[_0xa0f4('0x7')]={'uniqueid':{'type':_0xa0f4('0x1'),'required':!![]}};exports[_0xa0f4('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xa0f4('0x1')},'format':{'type':_0xa0f4('0x1')},'mixmonitorid':{'type':_0xa0f4('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0xa0f4('0x9')]={'uniqueid':{'type':_0xa0f4('0x1'),'required':!![]},'exten':{'type':_0xa0f4('0x1'),'required':!![]},'context':{'type':_0xa0f4('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b8ca770..ef0a150 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 _0x48df=['name','mapKeys','interface','total','sumBillable','isEmpty','ivrTotalCallsDays','answered','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','agents','length','isUndefined','initTelephones','voiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initDeskAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','sumHoldTime','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','seconds','queuecallercomplete','diff','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','hasOwnProperty','format','SIP/%s'];(function(_0x2faf27,_0x4f2a34){var _0x49ee0a=function(_0xd4a2aa){while(--_0xd4a2aa){_0x2faf27['push'](_0x2faf27['shift']());}};_0x49ee0a(++_0x4f2a34);}(_0x48df,0x189));var _0xf48d=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x48df[_0x267d8d];return _0x11a98f;};'use strict';var BPromise=require(_0xf48d('0x0'));var util=require(_0xf48d('0x1'));var _=require(_0xf48d('0x2'));var moment=require(_0xf48d('0x3'));var Agent=require(_0xf48d('0x4'));var Telephone=require(_0xf48d('0x5'));var Trunk=require(_0xf48d('0x6'));var VoiceQueue=require(_0xf48d('0x7'));var Trigger=require(_0xf48d('0x8'));var Template=require(_0xf48d('0x9'));var Campaign=require(_0xf48d('0xa'));var VoiceExtension=require(_0xf48d('0xb'));var ZendeskAccount=require(_0xf48d('0xc'));var SalesforceAccount=require(_0xf48d('0xd'));var FreshdeskAccount=require(_0xf48d('0xe'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xf48d('0xf'));var DeskAccount=require(_0xf48d('0x10'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xf48d('0x11'));var FreshsalesAccount=require(_0xf48d('0x12'));var FaxAccount=require(_0xf48d('0x13'));var Realtime=function(){this['agents']={};this[_0xf48d('0x14')]={};this[_0xf48d('0x15')]={};this['voiceQueues']={};this[_0xf48d('0x16')]={};this['campaigns']={};this[_0xf48d('0x17')]={};this[_0xf48d('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xf48d('0x19')]={};this['channels']={};this[_0xf48d('0x1a')]={};this[_0xf48d('0x1b')]={};this[_0xf48d('0x1c')]={};this[_0xf48d('0x1d')]={};this[_0xf48d('0x1e')]={};this['salesforceAccounts']={};this[_0xf48d('0x1f')]={};this['freshdeskAccounts']={};this[_0xf48d('0x20')]={};this[_0xf48d('0x21')]={};this['vtigerAccounts']={};this[_0xf48d('0x22')]={};this['dynamics365Accounts']={};this[_0xf48d('0x23')]={};this['faxAccounts']={};};function freeIsNotKey(_0x292b5c,_0x2c140f,_0x4ff338){var _0x390286=_['mapKeys'](_0x292b5c,function(_0x59a3b7,_0x96669b){return _0x59a3b7[_0x4ff338];});for(var _0x4404a0 in _0x2c140f){if(_0x2c140f[_0xf48d('0x24')](_0x4404a0)){if(!_0x390286[_0x4404a0]){delete _0x2c140f[_0x4404a0];}}}}function freeIsNotKeySip(_0x938e7d,_0x4e0ad9){var _0x4088f1=_['mapKeys'](_0x938e7d,function(_0xd820e0,_0x2c87f0){return util[_0xf48d('0x25')](_0xf48d('0x26'),_0xd820e0[_0xf48d('0x27')]);});for(var _0x193030 in _0x4e0ad9){if(_0x4e0ad9[_0xf48d('0x24')](_0x193030)){if(!_0x4088f1[_0x193030]){delete _0x4e0ad9[_0x193030];}}}}function freeIsNotKeyAgent(_0x2b47a4,_0x3e4a86){var _0x1fd6a9=_[_0xf48d('0x28')](_0x2b47a4,function(_0x3f9eb2,_0x29f4da){var _0x3a6575=_['isNil'](_0x3f9eb2[_0xf48d('0x29')])?util[_0xf48d('0x25')](_0xf48d('0x26'),_0x3f9eb2['name']):_0x3f9eb2[_0xf48d('0x29')];return _0x3a6575;});for(var _0x430e66 in _0x3e4a86){if(_0x3e4a86[_0xf48d('0x24')](_0x430e66)){if(!_0x1fd6a9[_0x430e66]){delete _0x3e4a86[_0x430e66];}}}}function clearVoiceCallReports(_0x251f5c){_0x251f5c[_0xf48d('0x2a')]=0x0;_0x251f5c['answered']=0x0;_0x251f5c['sumHoldTime']=0x0;_0x251f5c['sumDuration']=0x0;_0x251f5c[_0xf48d('0x2b')]=0x0;}function clearCampaigns(_0x2062a5){if(!_[_0xf48d('0x2c')](_0x2062a5)){for(var _0x1169f5 in _0x2062a5){if(_0x2062a5[_0xf48d('0x24')](_0x1169f5)){_0x2062a5[_0x1169f5][_0xf48d('0x2d')]=0x0;_0x2062a5[_0x1169f5]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x13e03f){if(!_[_0xf48d('0x2c')](_0x13e03f)){for(var _0x104a1a in _0x13e03f){if(_0x13e03f[_0xf48d('0x24')](_0x104a1a)){_0x13e03f[_0x104a1a][_0xf48d('0x2a')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x2e')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x2f')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x30')]=0x0;_0x13e03f[_0x104a1a]['sumHoldTime']=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x31')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x2b')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x32')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x33')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x34')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x35')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x36')]=0x0;_0x13e03f[_0x104a1a]['outboundUnknownCallsDay']=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x37')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x38')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x39')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x3a')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x3b')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x3c')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x32')]=0x0;_0x13e03f[_0x104a1a][_0xf48d('0x3d')]=0x0;_0x13e03f[_0x104a1a]['queueStatusComplete']=!![];}}}}Realtime[_0xf48d('0x3e')][_0xf48d('0x3f')]=function(_0x5c21ea,_0xed7926){for(var _0x420afa in _0xed7926){if(_0x5c21ea[_0xf48d('0x24')](_0x420afa)){_0x5c21ea[_0x420afa]=_0xed7926[_0x420afa];}}};Realtime[_0xf48d('0x3e')]['initAgents']=function(){var _0x5c3cd0=this;return function(_0x332255){if(_0x332255){freeIsNotKeyAgent(_0x332255,_0x5c3cd0[_0xf48d('0x40')]);for(var _0x315b5f=0x0,_0x52715c={},_0x48f4d6={};_0x315b5f<_0x332255[_0xf48d('0x41')];_0x315b5f+=0x1){_0x52715c=_0x332255[_0x315b5f];var _0x9e958f=_['isNil'](_0x52715c['interface'])?util[_0xf48d('0x25')](_0xf48d('0x26'),_0x52715c[_0xf48d('0x27')]):_0x52715c[_0xf48d('0x29')];if(_[_0xf48d('0x42')](_0x5c3cd0[_0xf48d('0x40')][_0x9e958f])){_0x5c3cd0['agents'][_0x9e958f]=new Agent(_0x52715c);}else{_0x5c3cd0['mergeFromDatabase'](_0x5c3cd0[_0xf48d('0x40')][_0x9e958f],_0x52715c);}}}return _0x5c3cd0['agents'];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x43')]=function(){var _0xff0eaa=this;return function(_0xbb0431){if(_0xbb0431){freeIsNotKeySip(_0xbb0431,_0xff0eaa[_0xf48d('0x14')]);for(var _0x104a9f=0x0,_0x284d9f={},_0x3a64fb={};_0x104a9f<_0xbb0431['length'];_0x104a9f+=0x1){_0x284d9f=_0xbb0431[_0x104a9f];if(_[_0xf48d('0x42')](_0xff0eaa[_0xf48d('0x14')][util[_0xf48d('0x25')](_0xf48d('0x26'),_0x284d9f['name'])])){_0xff0eaa[_0xf48d('0x14')][util[_0xf48d('0x25')]('SIP/%s',_0x284d9f[_0xf48d('0x27')])]=new Telephone(_0x284d9f);}else{_0xff0eaa[_0xf48d('0x3f')](_0xff0eaa['telephones'][util[_0xf48d('0x25')]('SIP/%s',_0x284d9f['name'])],_0x284d9f);}}}return _0xff0eaa[_0xf48d('0x14')];};};Realtime[_0xf48d('0x3e')]['initTrunks']=function(){var _0x1a9935=this;return function(_0x4e2a5f){if(_0x4e2a5f){freeIsNotKeySip(_0x4e2a5f,_0x1a9935[_0xf48d('0x15')]);for(var _0x18daf7=0x0,_0x4e6847={},_0x6ae826={};_0x18daf7<_0x4e2a5f[_0xf48d('0x41')];_0x18daf7+=0x1){_0x4e6847=_0x4e2a5f[_0x18daf7];if(_[_0xf48d('0x42')](_0x1a9935['trunks'][util['format'](_0xf48d('0x26'),_0x4e6847['name'])])){_0x1a9935[_0xf48d('0x15')][util[_0xf48d('0x25')](_0xf48d('0x26'),_0x4e6847[_0xf48d('0x27')])]=new Trunk(_0x4e6847);}else{_0x1a9935[_0xf48d('0x3f')](_0x1a9935[_0xf48d('0x15')][util[_0xf48d('0x25')](_0xf48d('0x26'),_0x4e6847[_0xf48d('0x27')])],_0x4e6847);}}}return _0x1a9935['trunks'];};};Realtime[_0xf48d('0x3e')]['initVoiceQueues']=function(){var _0x3bce6c=this;return function(_0x42b193){if(_0x42b193){freeIsNotKey(_0x42b193,_0x3bce6c[_0xf48d('0x44')],_0xf48d('0x27'));for(var _0x3a1b4c=0x0,_0x59419f={},_0x19776e={};_0x3a1b4c<_0x42b193[_0xf48d('0x41')];_0x3a1b4c+=0x1){_0x59419f=_0x42b193[_0x3a1b4c];if(_[_0xf48d('0x42')](_0x3bce6c[_0xf48d('0x44')][_0x59419f[_0xf48d('0x27')]])){_0x3bce6c[_0xf48d('0x44')][_0x59419f[_0xf48d('0x27')]]=new VoiceQueue(_0x59419f);}else{_0x3bce6c['mergeFromDatabase'](_0x3bce6c[_0xf48d('0x44')][_0x59419f[_0xf48d('0x27')]],_0x59419f);}}}return _0x3bce6c[_0xf48d('0x44')];};};Realtime[_0xf48d('0x3e')]['initTriggers']=function(){var _0x413551=this;return function(_0x54a2c5){if(_0x54a2c5){freeIsNotKey(_0x54a2c5,_0x413551[_0xf48d('0x16')],'id');for(var _0x2d9c89=0x0,_0x207e78={},_0x1a4508={};_0x2d9c89<_0x54a2c5[_0xf48d('0x41')];_0x2d9c89+=0x1){_0x207e78=_0x54a2c5[_0x2d9c89];if(_['isUndefined'](_0x413551[_0xf48d('0x16')][_0x207e78['id']])){_0x413551[_0xf48d('0x16')][_0x207e78['id']]=new Trigger(_0x207e78);}else{_0x413551['mergeFromDatabase'](_0x413551[_0xf48d('0x16')][_0x207e78['id']],_0x207e78);}}}return _0x413551['triggers'];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x45')]=function(){var _0x371602=this;return function(_0x2eda8f){if(_0x2eda8f){freeIsNotKey(_0x2eda8f,_0x371602['templates'],'id');for(var _0x4d70e4=0x0,_0x327d89={},_0x3a6816={};_0x4d70e4<_0x2eda8f['length'];_0x4d70e4+=0x1){_0x327d89=_0x2eda8f[_0x4d70e4];if(_[_0xf48d('0x42')](_0x371602['templates'][_0x327d89['id']])){_0x371602[_0xf48d('0x17')][_0x327d89['id']]=new Template(_0x327d89);}else{_0x371602[_0xf48d('0x3f')](_0x371602['templates'][_0x327d89['id']],_0x327d89);}}}return _0x371602[_0xf48d('0x17')];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x46')]=function(){var _0x511a65=this;return function(_0x291764){if(_0x291764){freeIsNotKey(_0x291764,_0x511a65[_0xf48d('0x1e')],'id');for(var _0x343d76=0x0,_0x1782eb={},_0x21e7a6={};_0x343d76<_0x291764[_0xf48d('0x41')];_0x343d76+=0x1){_0x1782eb=_0x291764[_0x343d76];if(_['isUndefined'](_0x511a65[_0xf48d('0x1e')][_0x1782eb['id']])){_0x511a65['zendeskAccounts'][_0x1782eb['id']]=new ZendeskAccount(_0x1782eb);}else{_0x511a65['mergeFromDatabase'](_0x511a65[_0xf48d('0x1e')][_0x1782eb['id']],_0x1782eb);}}}return _0x511a65[_0xf48d('0x1e')];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x47')]=function(){var _0xf40cda=this;return function(_0x10e1b9){if(_0x10e1b9){freeIsNotKey(_0x10e1b9,_0xf40cda[_0xf48d('0x48')],'id');for(var _0x375ea7=0x0,_0x14cfca={},_0x4cb272={};_0x375ea7<_0x10e1b9[_0xf48d('0x41')];_0x375ea7+=0x1){_0x14cfca=_0x10e1b9[_0x375ea7];if(_[_0xf48d('0x42')](_0xf40cda[_0xf48d('0x48')][_0x14cfca['id']])){_0xf40cda[_0xf48d('0x48')][_0x14cfca['id']]=new SalesforceAccount(_0x14cfca);}else{_0xf40cda[_0xf48d('0x3f')](_0xf40cda[_0xf48d('0x48')][_0x14cfca['id']],_0x14cfca);}}}return _0xf40cda[_0xf48d('0x48')];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x49')]=function(){var _0x9bc2a3=this;return function(_0x66230a){if(_0x66230a){freeIsNotKey(_0x66230a,_0x9bc2a3[_0xf48d('0x4a')],'id');for(var _0x5bba3a=0x0,_0xcdf7ab={},_0x2c56af={};_0x5bba3a<_0x66230a['length'];_0x5bba3a+=0x1){_0xcdf7ab=_0x66230a[_0x5bba3a];if(_['isUndefined'](_0x9bc2a3['freshdeskAccounts'][_0xcdf7ab['id']])){_0x9bc2a3['freshdeskAccounts'][_0xcdf7ab['id']]=new FreshdeskAccount(_0xcdf7ab);}else{_0x9bc2a3[_0xf48d('0x3f')](_0x9bc2a3[_0xf48d('0x4a')][_0xcdf7ab['id']],_0xcdf7ab);}}}return _0x9bc2a3[_0xf48d('0x4a')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x48bb7b=this;return function(_0x2c54fb){if(_0x2c54fb){freeIsNotKey(_0x2c54fb,_0x48bb7b[_0xf48d('0x20')],'id');for(var _0x1d0fb8=0x0,_0x297735={},_0x4c4610={};_0x1d0fb8<_0x2c54fb[_0xf48d('0x41')];_0x1d0fb8+=0x1){_0x297735=_0x2c54fb[_0x1d0fb8];if(_['isUndefined'](_0x48bb7b[_0xf48d('0x20')][_0x297735['id']])){_0x48bb7b[_0xf48d('0x20')][_0x297735['id']]=new ZohoAccount(_0x297735);}else{_0x48bb7b['mergeFromDatabase'](_0x48bb7b[_0xf48d('0x20')][_0x297735['id']],_0x297735);}}}return _0x48bb7b[_0xf48d('0x20')];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x4b')]=function(){var _0x36c3b7=this;return function(_0x3e1ebf){if(_0x3e1ebf){freeIsNotKey(_0x3e1ebf,_0x36c3b7[_0xf48d('0x21')],'id');for(var _0x286ae2=0x0,_0x1e957e={},_0x38f89d={};_0x286ae2<_0x3e1ebf['length'];_0x286ae2+=0x1){_0x1e957e=_0x3e1ebf[_0x286ae2];if(_[_0xf48d('0x42')](_0x36c3b7[_0xf48d('0x21')][_0x1e957e['id']])){_0x36c3b7[_0xf48d('0x21')][_0x1e957e['id']]=new DeskAccount(_0x1e957e);}else{_0x36c3b7['mergeFromDatabase'](_0x36c3b7[_0xf48d('0x21')][_0x1e957e['id']],_0x1e957e);}}}return _0x36c3b7[_0xf48d('0x21')];};};Realtime[_0xf48d('0x3e')]['initSugarcrmAccounts']=function(){var _0x21c13f=this;return function(_0x3b355b){if(_0x3b355b){freeIsNotKey(_0x3b355b,_0x21c13f['sugarcrmAccounts'],'id');for(var _0x555496=0x0,_0x37969f={},_0x5f3c3a={};_0x555496<_0x3b355b[_0xf48d('0x41')];_0x555496+=0x1){_0x37969f=_0x3b355b[_0x555496];if(_[_0xf48d('0x42')](_0x21c13f['sugarcrmAccounts'][_0x37969f['id']])){_0x21c13f[_0xf48d('0x1f')][_0x37969f['id']]=new SugarcrmAccount(_0x37969f);}else{_0x21c13f[_0xf48d('0x3f')](_0x21c13f['sugarcrmAccounts'][_0x37969f['id']],_0x37969f);}}}return _0x21c13f[_0xf48d('0x1f')];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x4c')]=function(){var _0x1ef507=this;return function(_0x5d7c71){if(_0x5d7c71){freeIsNotKey(_0x5d7c71,_0x1ef507[_0xf48d('0x4d')],'id');for(var _0x3c6727=0x0,_0x11709b={},_0x568c46={};_0x3c6727<_0x5d7c71[_0xf48d('0x41')];_0x3c6727+=0x1){_0x11709b=_0x5d7c71[_0x3c6727];if(_['isUndefined'](_0x1ef507[_0xf48d('0x4d')][_0x11709b['id']])){_0x1ef507[_0xf48d('0x4d')][_0x11709b['id']]=new VtigerAccount(_0x11709b);}else{_0x1ef507[_0xf48d('0x3f')](_0x1ef507[_0xf48d('0x4d')][_0x11709b['id']],_0x11709b);}}}return _0x1ef507[_0xf48d('0x4d')];};};Realtime['prototype'][_0xf48d('0x4e')]=function(){var _0x34a147=this;return function(_0x395747){if(_0x395747){freeIsNotKey(_0x395747,_0x34a147['servicenowAccounts'],'id');for(var _0x8c6cc4=0x0,_0x50e4fb={},_0x1759a7={};_0x8c6cc4<_0x395747[_0xf48d('0x41')];_0x8c6cc4+=0x1){_0x50e4fb=_0x395747[_0x8c6cc4];if(_[_0xf48d('0x42')](_0x34a147[_0xf48d('0x22')][_0x50e4fb['id']])){_0x34a147[_0xf48d('0x22')][_0x50e4fb['id']]=new ServicenowAccount(_0x50e4fb);}else{_0x34a147[_0xf48d('0x3f')](_0x34a147[_0xf48d('0x22')][_0x50e4fb['id']],_0x50e4fb);}}}return _0x34a147['servicenowAccounts'];};};Realtime['prototype'][_0xf48d('0x4f')]=function(){var _0x573f80=this;return function(_0x412a42){if(_0x412a42){freeIsNotKey(_0x412a42,_0x573f80[_0xf48d('0x50')],'id');for(var _0x3ad8fa=0x0,_0x413a80={},_0x1c7125={};_0x3ad8fa<_0x412a42[_0xf48d('0x41')];_0x3ad8fa+=0x1){_0x413a80=_0x412a42[_0x3ad8fa];if(_['isUndefined'](_0x573f80['dynamics365Accounts'][_0x413a80['id']])){_0x573f80[_0xf48d('0x50')][_0x413a80['id']]=new Dynamics365Account(_0x413a80);}else{_0x573f80['mergeFromDatabase'](_0x573f80[_0xf48d('0x50')][_0x413a80['id']],_0x413a80);}}}return _0x573f80[_0xf48d('0x50')];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x51')]=function(){var _0x243462=this;return function(_0x362325){if(_0x362325){freeIsNotKey(_0x362325,_0x243462[_0xf48d('0x23')],'id');for(var _0x2d3d6a=0x0,_0x417751={},_0xcb3f2={};_0x2d3d6a<_0x362325[_0xf48d('0x41')];_0x2d3d6a+=0x1){_0x417751=_0x362325[_0x2d3d6a];if(_[_0xf48d('0x42')](_0x243462['freshsalesAccounts'][_0x417751['id']])){_0x243462[_0xf48d('0x23')][_0x417751['id']]=new FreshsalesAccount(_0x417751);}else{_0x243462[_0xf48d('0x3f')](_0x243462[_0xf48d('0x23')][_0x417751['id']],_0x417751);}}}return _0x243462['freshsalesAccounts'];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x52')]=function(){var _0x2e72cb=this;return function(_0x26bdc8){for(var _0x4bfcd8=0x0;_0x4bfcd8<_0x26bdc8[_0xf48d('0x41')];_0x4bfcd8+=0x1){_[_0xf48d('0x53')](_0x2e72cb[_0xf48d('0x44')][_0x26bdc8[_0x4bfcd8][_0xf48d('0x27')]],_0x26bdc8[_0x4bfcd8]);}return _0x2e72cb[_0xf48d('0x44')];};};Realtime[_0xf48d('0x3e')]['initVoiceQueueReports']=function(){var _0x1f529a=this;return function(_0x2dff4b){clearVoiceQueues(_0x1f529a['voiceQueues']);if(_0x2dff4b){_0x2dff4b=_[_0xf48d('0x54')](_0x2dff4b,'uniqueid');for(var _0x417e4b in _0x2dff4b){if(_0x2dff4b[_0xf48d('0x24')](_0x417e4b)){var _0x2d858c={};for(var _0x1594ae=0x0;_0x1594ae<_0x2dff4b[_0x417e4b]['length'];_0x1594ae+=0x1){var _0xcba770=_0x2dff4b[_0x417e4b][_0x1594ae][_0xf48d('0x55')];if(_0x1f529a['voiceQueues'][_0xcba770]){if(_0x2dff4b[_0x417e4b][_0x1594ae][_0xf48d('0x56')]){_0x1f529a[_0xf48d('0x44')][_0xcba770][_0xf48d('0x2f')]+=0x1;}if(_0x2dff4b[_0x417e4b][_0x1594ae]['queuecallerabandon']){_0x1f529a[_0xf48d('0x44')][_0xcba770][_0xf48d('0x30')]+=0x1;}_0x1f529a['voiceQueues'][_0xcba770][_0xf48d('0x57')]+=moment(_0x2dff4b[_0x417e4b][_0x1594ae][_0xf48d('0x58')])['diff'](moment(_0x2dff4b[_0x417e4b][_0x1594ae][_0xf48d('0x59')]),'seconds')||0x0;if(_0x1594ae===_0x2dff4b[_0x417e4b]['length']-0x1){_0x1f529a['voiceQueues'][_0xcba770][_0xf48d('0x31')]+=moment(_0x2dff4b[_0x417e4b][_0x1594ae][_0xf48d('0x5a')]||_0x2dff4b[_0x417e4b][_0x1594ae]['queuecallerabandonAt']||_0x2dff4b[_0x417e4b][_0x1594ae][_0xf48d('0x5b')])['diff'](moment(_0x2dff4b[_0x417e4b][_0x1594ae][_0xf48d('0x59')]),_0xf48d('0x5c'))||0x0;_0x1f529a['voiceQueues'][_0xcba770][_0xf48d('0x2a')]+=0x1;if(_0x2dff4b[_0x417e4b][_0x1594ae][_0xf48d('0x5d')]){_0x1f529a[_0xf48d('0x44')][_0xcba770][_0xf48d('0x2e')]+=0x1;_0x1f529a[_0xf48d('0x44')][_0xcba770][_0xf48d('0x2b')]+=moment(_0x2dff4b[_0x417e4b][_0x1594ae][_0xf48d('0x5a')])[_0xf48d('0x5e')](moment(_0x2dff4b[_0x417e4b][_0x1594ae][_0xf48d('0x58')]),_0xf48d('0x5c'))||0x0;}}else{_0x1f529a[_0xf48d('0x44')][_0xcba770]['sumDuration']+=_0x1f529a['voiceQueues'][_0xcba770][_0xf48d('0x57')]||0x0;}}}}}}return _0x1f529a['voiceQueues'];};};Realtime['prototype'][_0xf48d('0x5f')]=function(){var _0x395a8e=this;return function(_0x41cedb){clearVoiceCallReports(_0x395a8e[_0xf48d('0x18')]);if(_0x41cedb){for(var _0x4df489=0x0;_0x4df489<_0x41cedb[_0xf48d('0x41')];_0x4df489+=0x1){_0x395a8e[_0xf48d('0x18')][_0xf48d('0x2a')]+=0x1;_0x395a8e[_0xf48d('0x18')][_0xf48d('0x31')]+=_0x41cedb[_0x4df489][_0xf48d('0x60')];if(_0x41cedb[_0x4df489][_0xf48d('0x61')]===_0xf48d('0x62')){_0x395a8e[_0xf48d('0x18')][_0xf48d('0x2e')]+=0x1;_0x395a8e[_0xf48d('0x18')][_0xf48d('0x57')]+=_0x41cedb[_0x4df489]['duration']-_0x41cedb[_0x4df489][_0xf48d('0x63')]||0x0;_0x395a8e['outbound']['sumBillable']+=_0x41cedb[_0x4df489]['billableseconds'];}}}return _0x395a8e[_0xf48d('0x18')];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x64')]=function(){var _0x56f445=this;return function(_0x301201){if(_0x301201){freeIsNotKey(_0x301201,_0x56f445[_0xf48d('0x65')],_0xf48d('0x27'));for(var _0x5a3ff6=0x0,_0xd70b92={};_0x5a3ff6<_0x301201[_0xf48d('0x41')];_0x5a3ff6+=0x1){_0xd70b92=_0x301201[_0x5a3ff6];if(_[_0xf48d('0x42')](_0x56f445[_0xf48d('0x65')][_0xd70b92['name']])){_0x56f445[_0xf48d('0x65')][_0xd70b92[_0xf48d('0x27')]]=new Campaign(_0xd70b92);}else{_0x56f445[_0xf48d('0x3f')](_0x56f445[_0xf48d('0x65')][_0xd70b92[_0xf48d('0x27')]],_0xd70b92);_0x56f445['campaigns'][_0xd70b92[_0xf48d('0x27')]]['dialQueueProject']=_0xd70b92[_0xf48d('0x66')]?_0xd70b92[_0xf48d('0x66')]['name']:undefined;}}}return _0x56f445['campaigns'];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x67')]=function(){var _0x4460cf=this;return function(_0x59c5c7){if(_0x59c5c7){freeIsNotKey(_0x59c5c7,_0x4460cf['voiceExtensions'],'id');for(var _0x235209=0x0,_0x384009={};_0x235209<_0x59c5c7['length'];_0x235209+=0x1){_0x384009=_0x59c5c7[_0x235209];if(_[_0xf48d('0x42')](_0x4460cf['voiceExtensions'][_0x384009['id']])){_0x4460cf[_0xf48d('0x19')][_0x384009['id']]=new VoiceExtension(_0x384009);}else{_0x4460cf[_0xf48d('0x3f')](_0x4460cf['voiceExtensions'][_0x384009['id']],_0x384009);}}}return _0x4460cf['voiceExtensions'];};};Realtime['prototype'][_0xf48d('0x68')]=function(){var _0x3e6758=this;return function(_0x1a27ee){clearCampaigns(_0x3e6758[_0xf48d('0x65')]);for(var _0x452882=0x0;_0x452882<_0x1a27ee[_0xf48d('0x41')];_0x452882+=0x1){_['merge'](_0x3e6758[_0xf48d('0x65')][_0x1a27ee[_0x452882][_0xf48d('0x27')]],_0x1a27ee[_0x452882]);}return _0x3e6758['campaigns'];};};Realtime[_0xf48d('0x3e')][_0xf48d('0x69')]=function(){var _0x5b51e7=this;return function(_0x1a4052){if(_0x1a4052){freeIsNotKey(_0x1a4052,_0x5b51e7[_0xf48d('0x6a')],'id');for(var _0x525a76=0x0,_0x1e0077={},_0x5dda43={};_0x525a76<_0x1a4052[_0xf48d('0x41')];_0x525a76+=0x1){_0x1e0077=_0x1a4052[_0x525a76];if(_[_0xf48d('0x42')](_0x5b51e7[_0xf48d('0x6a')][_0x1e0077['id']])){_0x5b51e7['faxAccounts'][_0x1e0077['id']]=new FaxAccount(_0x1e0077);}else{_0x5b51e7[_0xf48d('0x3f')](_0x5b51e7['faxAccounts'][_0x1e0077['id']],_0x1e0077);}}}return _0x5b51e7[_0xf48d('0x6a')];};};module[_0xf48d('0x6b')]=Realtime; \ No newline at end of file +var _0xfed8=['duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','length','initTelephones','isUndefined','initTrunks','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','initVoiceCallReports','disposition','ANSWERED'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xfed8,0xe3));var _0x8fed=function(_0x18921b,_0xa967e4){_0x18921b=_0x18921b-0x0;var _0xe7096c=_0xfed8[_0x18921b];return _0xe7096c;};'use strict';var BPromise=require(_0x8fed('0x0'));var util=require(_0x8fed('0x1'));var _=require(_0x8fed('0x2'));var moment=require('moment');var Agent=require(_0x8fed('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8fed('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x8fed('0x5'));var Template=require(_0x8fed('0x6'));var Campaign=require(_0x8fed('0x7'));var VoiceExtension=require(_0x8fed('0x8'));var ZendeskAccount=require(_0x8fed('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x8fed('0xa'));var SugarcrmAccount=require(_0x8fed('0xb'));var ZohoAccount=require(_0x8fed('0xc'));var DeskAccount=require(_0x8fed('0xd'));var VtigerAccount=require(_0x8fed('0xe'));var ServicenowAccount=require(_0x8fed('0xf'));var Dynamics365Account=require(_0x8fed('0x10'));var FreshsalesAccount=require(_0x8fed('0x11'));var FaxAccount=require(_0x8fed('0x12'));var Realtime=function(){this[_0x8fed('0x13')]={};this[_0x8fed('0x14')]={};this[_0x8fed('0x15')]={};this[_0x8fed('0x16')]={};this[_0x8fed('0x17')]={};this[_0x8fed('0x18')]={};this[_0x8fed('0x19')]={};this[_0x8fed('0x1a')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x8fed('0x1b')]={};this[_0x8fed('0x1c')]={};this[_0x8fed('0x1d')]={};this[_0x8fed('0x1e')]={};this[_0x8fed('0x1f')]={};this[_0x8fed('0x20')]={};this['salesforceAccounts']={};this[_0x8fed('0x21')]={};this[_0x8fed('0x22')]={};this[_0x8fed('0x23')]={};this[_0x8fed('0x24')]={};this[_0x8fed('0x25')]={};this[_0x8fed('0x26')]={};this[_0x8fed('0x27')]={};this[_0x8fed('0x28')]={};this[_0x8fed('0x29')]={};};function freeIsNotKey(_0x52bd55,_0x480ae6,_0x3fddc8){var _0x333040=_[_0x8fed('0x2a')](_0x52bd55,function(_0x3d6ee7,_0x4bd2e4){return _0x3d6ee7[_0x3fddc8];});for(var _0x1c2b37 in _0x480ae6){if(_0x480ae6[_0x8fed('0x2b')](_0x1c2b37)){if(!_0x333040[_0x1c2b37]){delete _0x480ae6[_0x1c2b37];}}}}function freeIsNotKeySip(_0x38b814,_0x258f07){var _0x56f859=_['mapKeys'](_0x38b814,function(_0x1b0edd,_0x50d7ff){return util[_0x8fed('0x2c')](_0x8fed('0x2d'),_0x1b0edd[_0x8fed('0x2e')]);});for(var _0x3cd347 in _0x258f07){if(_0x258f07[_0x8fed('0x2b')](_0x3cd347)){if(!_0x56f859[_0x3cd347]){delete _0x258f07[_0x3cd347];}}}}function freeIsNotKeyAgent(_0x5aa52c,_0x377cc2){var _0x4eebe6=_[_0x8fed('0x2a')](_0x5aa52c,function(_0xc5b638,_0x9ecb7a){var _0x295357=_[_0x8fed('0x2f')](_0xc5b638[_0x8fed('0x30')])?util[_0x8fed('0x2c')](_0x8fed('0x2d'),_0xc5b638[_0x8fed('0x2e')]):_0xc5b638[_0x8fed('0x30')];return _0x295357;});for(var _0x5680e3 in _0x377cc2){if(_0x377cc2['hasOwnProperty'](_0x5680e3)){if(!_0x4eebe6[_0x5680e3]){delete _0x377cc2[_0x5680e3];}}}}function clearVoiceCallReports(_0x2d387a){_0x2d387a[_0x8fed('0x31')]=0x0;_0x2d387a['answered']=0x0;_0x2d387a[_0x8fed('0x32')]=0x0;_0x2d387a[_0x8fed('0x33')]=0x0;_0x2d387a['sumBillable']=0x0;}function clearCampaigns(_0x5c093a){if(!_[_0x8fed('0x34')](_0x5c093a)){for(var _0x2cc604 in _0x5c093a){if(_0x5c093a['hasOwnProperty'](_0x2cc604)){_0x5c093a[_0x2cc604][_0x8fed('0x35')]=0x0;_0x5c093a[_0x2cc604][_0x8fed('0x36')]=0x0;}}}}function clearVoiceQueues(_0x393e97){if(!_[_0x8fed('0x34')](_0x393e97)){for(var _0x27b6ca in _0x393e97){if(_0x393e97['hasOwnProperty'](_0x27b6ca)){_0x393e97[_0x27b6ca]['total']=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x37')]=0x0;_0x393e97[_0x27b6ca]['unmanaged']=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x38')]=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x32')]=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x33')]=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x39')]=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x3a')]=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x3b')]=0x0;_0x393e97[_0x27b6ca]['outboundBusyCallsDay']=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x3c')]=0x0;_0x393e97[_0x27b6ca]['outboundNoSuchCallsDay']=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x3d')]=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x3e')]=0x0;_0x393e97[_0x27b6ca]['outboundDropCallsDayCallersExit']=0x0;_0x393e97[_0x27b6ca]['outboundBlacklistCallsDay']=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x3f')]=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x40')]=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x41')]=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x3a')]=0x0;_0x393e97[_0x27b6ca][_0x8fed('0x42')]=0x0;_0x393e97[_0x27b6ca]['queueStatusComplete']=!![];}}}}Realtime[_0x8fed('0x43')][_0x8fed('0x44')]=function(_0x3b4eaf,_0x379136){for(var _0x3a8d54 in _0x379136){if(_0x3b4eaf['hasOwnProperty'](_0x3a8d54)){_0x3b4eaf[_0x3a8d54]=_0x379136[_0x3a8d54];}}};Realtime['prototype']['initAgents']=function(){var _0x3ded29=this;return function(_0x544cd7){if(_0x544cd7){freeIsNotKeyAgent(_0x544cd7,_0x3ded29['agents']);for(var _0x220eed=0x0,_0x25da12={},_0xd8b767={};_0x220eed<_0x544cd7[_0x8fed('0x45')];_0x220eed+=0x1){_0x25da12=_0x544cd7[_0x220eed];var _0x1e4a60=_[_0x8fed('0x2f')](_0x25da12[_0x8fed('0x30')])?util[_0x8fed('0x2c')]('SIP/%s',_0x25da12[_0x8fed('0x2e')]):_0x25da12[_0x8fed('0x30')];if(_['isUndefined'](_0x3ded29[_0x8fed('0x13')][_0x1e4a60])){_0x3ded29['agents'][_0x1e4a60]=new Agent(_0x25da12);}else{_0x3ded29['mergeFromDatabase'](_0x3ded29[_0x8fed('0x13')][_0x1e4a60],_0x25da12);}}}return _0x3ded29[_0x8fed('0x13')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x46')]=function(){var _0x32ce26=this;return function(_0x3910b2){if(_0x3910b2){freeIsNotKeySip(_0x3910b2,_0x32ce26['telephones']);for(var _0x35208c=0x0,_0x32c78c={},_0x4a9e09={};_0x35208c<_0x3910b2['length'];_0x35208c+=0x1){_0x32c78c=_0x3910b2[_0x35208c];if(_[_0x8fed('0x47')](_0x32ce26['telephones'][util[_0x8fed('0x2c')](_0x8fed('0x2d'),_0x32c78c[_0x8fed('0x2e')])])){_0x32ce26['telephones'][util[_0x8fed('0x2c')]('SIP/%s',_0x32c78c['name'])]=new Telephone(_0x32c78c);}else{_0x32ce26[_0x8fed('0x44')](_0x32ce26[_0x8fed('0x14')][util['format'](_0x8fed('0x2d'),_0x32c78c[_0x8fed('0x2e')])],_0x32c78c);}}}return _0x32ce26[_0x8fed('0x14')];};};Realtime['prototype'][_0x8fed('0x48')]=function(){var _0x309265=this;return function(_0x39232d){if(_0x39232d){freeIsNotKeySip(_0x39232d,_0x309265['trunks']);for(var _0x334db2=0x0,_0x1505ed={},_0x13402d={};_0x334db2<_0x39232d[_0x8fed('0x45')];_0x334db2+=0x1){_0x1505ed=_0x39232d[_0x334db2];if(_['isUndefined'](_0x309265[_0x8fed('0x15')][util[_0x8fed('0x2c')](_0x8fed('0x2d'),_0x1505ed[_0x8fed('0x2e')])])){_0x309265[_0x8fed('0x15')][util['format']('SIP/%s',_0x1505ed[_0x8fed('0x2e')])]=new Trunk(_0x1505ed);}else{_0x309265[_0x8fed('0x44')](_0x309265[_0x8fed('0x15')][util[_0x8fed('0x2c')]('SIP/%s',_0x1505ed[_0x8fed('0x2e')])],_0x1505ed);}}}return _0x309265['trunks'];};};Realtime[_0x8fed('0x43')]['initVoiceQueues']=function(){var _0x3a6a0a=this;return function(_0x402ef3){if(_0x402ef3){freeIsNotKey(_0x402ef3,_0x3a6a0a[_0x8fed('0x16')],_0x8fed('0x2e'));for(var _0x47570f=0x0,_0x327d7f={},_0x14710c={};_0x47570f<_0x402ef3[_0x8fed('0x45')];_0x47570f+=0x1){_0x327d7f=_0x402ef3[_0x47570f];if(_['isUndefined'](_0x3a6a0a[_0x8fed('0x16')][_0x327d7f[_0x8fed('0x2e')]])){_0x3a6a0a[_0x8fed('0x16')][_0x327d7f[_0x8fed('0x2e')]]=new VoiceQueue(_0x327d7f);}else{_0x3a6a0a['mergeFromDatabase'](_0x3a6a0a[_0x8fed('0x16')][_0x327d7f[_0x8fed('0x2e')]],_0x327d7f);}}}return _0x3a6a0a[_0x8fed('0x16')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x49')]=function(){var _0x1088b5=this;return function(_0x3a23ce){if(_0x3a23ce){freeIsNotKey(_0x3a23ce,_0x1088b5[_0x8fed('0x17')],'id');for(var _0x45931c=0x0,_0x202357={},_0x3eb14d={};_0x45931c<_0x3a23ce[_0x8fed('0x45')];_0x45931c+=0x1){_0x202357=_0x3a23ce[_0x45931c];if(_[_0x8fed('0x47')](_0x1088b5[_0x8fed('0x17')][_0x202357['id']])){_0x1088b5[_0x8fed('0x17')][_0x202357['id']]=new Trigger(_0x202357);}else{_0x1088b5[_0x8fed('0x44')](_0x1088b5['triggers'][_0x202357['id']],_0x202357);}}}return _0x1088b5['triggers'];};};Realtime[_0x8fed('0x43')][_0x8fed('0x4a')]=function(){var _0x1b0191=this;return function(_0x1fb9f3){if(_0x1fb9f3){freeIsNotKey(_0x1fb9f3,_0x1b0191[_0x8fed('0x19')],'id');for(var _0x13ed26=0x0,_0x2a1dae={},_0x5ef4c6={};_0x13ed26<_0x1fb9f3[_0x8fed('0x45')];_0x13ed26+=0x1){_0x2a1dae=_0x1fb9f3[_0x13ed26];if(_[_0x8fed('0x47')](_0x1b0191[_0x8fed('0x19')][_0x2a1dae['id']])){_0x1b0191[_0x8fed('0x19')][_0x2a1dae['id']]=new Template(_0x2a1dae);}else{_0x1b0191[_0x8fed('0x44')](_0x1b0191[_0x8fed('0x19')][_0x2a1dae['id']],_0x2a1dae);}}}return _0x1b0191['templates'];};};Realtime['prototype'][_0x8fed('0x4b')]=function(){var _0x5a732e=this;return function(_0x58ec03){if(_0x58ec03){freeIsNotKey(_0x58ec03,_0x5a732e[_0x8fed('0x20')],'id');for(var _0x3bb15d=0x0,_0x57a998={},_0x46f181={};_0x3bb15d<_0x58ec03['length'];_0x3bb15d+=0x1){_0x57a998=_0x58ec03[_0x3bb15d];if(_[_0x8fed('0x47')](_0x5a732e['zendeskAccounts'][_0x57a998['id']])){_0x5a732e[_0x8fed('0x20')][_0x57a998['id']]=new ZendeskAccount(_0x57a998);}else{_0x5a732e['mergeFromDatabase'](_0x5a732e[_0x8fed('0x20')][_0x57a998['id']],_0x57a998);}}}return _0x5a732e[_0x8fed('0x20')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x4c')]=function(){var _0x503f5c=this;return function(_0x10571f){if(_0x10571f){freeIsNotKey(_0x10571f,_0x503f5c[_0x8fed('0x4d')],'id');for(var _0x48cf45=0x0,_0x2d3bc2={},_0x598e52={};_0x48cf45<_0x10571f[_0x8fed('0x45')];_0x48cf45+=0x1){_0x2d3bc2=_0x10571f[_0x48cf45];if(_['isUndefined'](_0x503f5c['salesforceAccounts'][_0x2d3bc2['id']])){_0x503f5c[_0x8fed('0x4d')][_0x2d3bc2['id']]=new SalesforceAccount(_0x2d3bc2);}else{_0x503f5c['mergeFromDatabase'](_0x503f5c[_0x8fed('0x4d')][_0x2d3bc2['id']],_0x2d3bc2);}}}return _0x503f5c[_0x8fed('0x4d')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x4e')]=function(){var _0x56fc9=this;return function(_0x3177d9){if(_0x3177d9){freeIsNotKey(_0x3177d9,_0x56fc9[_0x8fed('0x22')],'id');for(var _0x4bc190=0x0,_0x2a58d9={},_0x60d419={};_0x4bc190<_0x3177d9['length'];_0x4bc190+=0x1){_0x2a58d9=_0x3177d9[_0x4bc190];if(_[_0x8fed('0x47')](_0x56fc9[_0x8fed('0x22')][_0x2a58d9['id']])){_0x56fc9[_0x8fed('0x22')][_0x2a58d9['id']]=new FreshdeskAccount(_0x2a58d9);}else{_0x56fc9['mergeFromDatabase'](_0x56fc9[_0x8fed('0x22')][_0x2a58d9['id']],_0x2a58d9);}}}return _0x56fc9[_0x8fed('0x22')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x4f')]=function(){var _0x317c1b=this;return function(_0x5937c6){if(_0x5937c6){freeIsNotKey(_0x5937c6,_0x317c1b[_0x8fed('0x23')],'id');for(var _0x4474db=0x0,_0x46b576={},_0x5ad446={};_0x4474db<_0x5937c6[_0x8fed('0x45')];_0x4474db+=0x1){_0x46b576=_0x5937c6[_0x4474db];if(_[_0x8fed('0x47')](_0x317c1b['zohoAccounts'][_0x46b576['id']])){_0x317c1b[_0x8fed('0x23')][_0x46b576['id']]=new ZohoAccount(_0x46b576);}else{_0x317c1b[_0x8fed('0x44')](_0x317c1b[_0x8fed('0x23')][_0x46b576['id']],_0x46b576);}}}return _0x317c1b[_0x8fed('0x23')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x50')]=function(){var _0x5704f2=this;return function(_0x56c266){if(_0x56c266){freeIsNotKey(_0x56c266,_0x5704f2[_0x8fed('0x24')],'id');for(var _0x11dbd4=0x0,_0x462131={},_0x30de5f={};_0x11dbd4<_0x56c266['length'];_0x11dbd4+=0x1){_0x462131=_0x56c266[_0x11dbd4];if(_[_0x8fed('0x47')](_0x5704f2['deskAccounts'][_0x462131['id']])){_0x5704f2[_0x8fed('0x24')][_0x462131['id']]=new DeskAccount(_0x462131);}else{_0x5704f2[_0x8fed('0x44')](_0x5704f2['deskAccounts'][_0x462131['id']],_0x462131);}}}return _0x5704f2[_0x8fed('0x24')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x51')]=function(){var _0x842680=this;return function(_0xe61352){if(_0xe61352){freeIsNotKey(_0xe61352,_0x842680[_0x8fed('0x21')],'id');for(var _0x1aa2a8=0x0,_0x27ff97={},_0x2aa6a9={};_0x1aa2a8<_0xe61352['length'];_0x1aa2a8+=0x1){_0x27ff97=_0xe61352[_0x1aa2a8];if(_[_0x8fed('0x47')](_0x842680['sugarcrmAccounts'][_0x27ff97['id']])){_0x842680[_0x8fed('0x21')][_0x27ff97['id']]=new SugarcrmAccount(_0x27ff97);}else{_0x842680[_0x8fed('0x44')](_0x842680[_0x8fed('0x21')][_0x27ff97['id']],_0x27ff97);}}}return _0x842680[_0x8fed('0x21')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x52')]=function(){var _0x52e2cc=this;return function(_0xbe143a){if(_0xbe143a){freeIsNotKey(_0xbe143a,_0x52e2cc[_0x8fed('0x25')],'id');for(var _0x3491b1=0x0,_0x3acb77={},_0x1885d7={};_0x3491b1<_0xbe143a[_0x8fed('0x45')];_0x3491b1+=0x1){_0x3acb77=_0xbe143a[_0x3491b1];if(_[_0x8fed('0x47')](_0x52e2cc[_0x8fed('0x25')][_0x3acb77['id']])){_0x52e2cc[_0x8fed('0x25')][_0x3acb77['id']]=new VtigerAccount(_0x3acb77);}else{_0x52e2cc[_0x8fed('0x44')](_0x52e2cc[_0x8fed('0x25')][_0x3acb77['id']],_0x3acb77);}}}return _0x52e2cc['vtigerAccounts'];};};Realtime[_0x8fed('0x43')]['initServicenowAccounts']=function(){var _0x133007=this;return function(_0x16ec5e){if(_0x16ec5e){freeIsNotKey(_0x16ec5e,_0x133007['servicenowAccounts'],'id');for(var _0x4d1b43=0x0,_0x43e957={},_0x363352={};_0x4d1b43<_0x16ec5e[_0x8fed('0x45')];_0x4d1b43+=0x1){_0x43e957=_0x16ec5e[_0x4d1b43];if(_['isUndefined'](_0x133007[_0x8fed('0x26')][_0x43e957['id']])){_0x133007[_0x8fed('0x26')][_0x43e957['id']]=new ServicenowAccount(_0x43e957);}else{_0x133007[_0x8fed('0x44')](_0x133007[_0x8fed('0x26')][_0x43e957['id']],_0x43e957);}}}return _0x133007[_0x8fed('0x26')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x53')]=function(){var _0x3df796=this;return function(_0x59aae4){if(_0x59aae4){freeIsNotKey(_0x59aae4,_0x3df796[_0x8fed('0x27')],'id');for(var _0x323993=0x0,_0x3a41fd={},_0x452a57={};_0x323993<_0x59aae4['length'];_0x323993+=0x1){_0x3a41fd=_0x59aae4[_0x323993];if(_[_0x8fed('0x47')](_0x3df796[_0x8fed('0x27')][_0x3a41fd['id']])){_0x3df796[_0x8fed('0x27')][_0x3a41fd['id']]=new Dynamics365Account(_0x3a41fd);}else{_0x3df796[_0x8fed('0x44')](_0x3df796['dynamics365Accounts'][_0x3a41fd['id']],_0x3a41fd);}}}return _0x3df796[_0x8fed('0x27')];};};Realtime[_0x8fed('0x43')]['initFreshsalesAccounts']=function(){var _0x13fa6a=this;return function(_0x24c1bb){if(_0x24c1bb){freeIsNotKey(_0x24c1bb,_0x13fa6a['freshsalesAccounts'],'id');for(var _0x3f831a=0x0,_0x427152={},_0x4ccfb8={};_0x3f831a<_0x24c1bb[_0x8fed('0x45')];_0x3f831a+=0x1){_0x427152=_0x24c1bb[_0x3f831a];if(_[_0x8fed('0x47')](_0x13fa6a[_0x8fed('0x28')][_0x427152['id']])){_0x13fa6a[_0x8fed('0x28')][_0x427152['id']]=new FreshsalesAccount(_0x427152);}else{_0x13fa6a[_0x8fed('0x44')](_0x13fa6a[_0x8fed('0x28')][_0x427152['id']],_0x427152);}}}return _0x13fa6a[_0x8fed('0x28')];};};Realtime[_0x8fed('0x43')]['initVoiceQueueHopperHistory']=function(){var _0x42762c=this;return function(_0x538ab6){for(var _0x30d17c=0x0;_0x30d17c<_0x538ab6[_0x8fed('0x45')];_0x30d17c+=0x1){_[_0x8fed('0x54')](_0x42762c[_0x8fed('0x16')][_0x538ab6[_0x30d17c][_0x8fed('0x2e')]],_0x538ab6[_0x30d17c]);}return _0x42762c[_0x8fed('0x16')];};};Realtime['prototype'][_0x8fed('0x55')]=function(){var _0x133df5=this;return function(_0x3dc730){clearVoiceQueues(_0x133df5['voiceQueues']);if(_0x3dc730){_0x3dc730=_[_0x8fed('0x56')](_0x3dc730,_0x8fed('0x57'));for(var _0x29c6c2 in _0x3dc730){if(_0x3dc730[_0x8fed('0x2b')](_0x29c6c2)){var _0xb37b46={};for(var _0x4efee9=0x0;_0x4efee9<_0x3dc730[_0x29c6c2][_0x8fed('0x45')];_0x4efee9+=0x1){var _0x1d3974=_0x3dc730[_0x29c6c2][_0x4efee9]['queue'];if(_0x133df5[_0x8fed('0x16')][_0x1d3974]){if(_0x3dc730[_0x29c6c2][_0x4efee9][_0x8fed('0x58')]){_0x133df5[_0x8fed('0x16')][_0x1d3974]['unmanaged']+=0x1;}if(_0x3dc730[_0x29c6c2][_0x4efee9][_0x8fed('0x59')]){_0x133df5[_0x8fed('0x16')][_0x1d3974][_0x8fed('0x38')]+=0x1;}_0x133df5['voiceQueues'][_0x1d3974][_0x8fed('0x32')]+=moment(_0x3dc730[_0x29c6c2][_0x4efee9][_0x8fed('0x5a')])['diff'](moment(_0x3dc730[_0x29c6c2][_0x4efee9][_0x8fed('0x5b')]),_0x8fed('0x5c'))||0x0;if(_0x4efee9===_0x3dc730[_0x29c6c2][_0x8fed('0x45')]-0x1){_0x133df5[_0x8fed('0x16')][_0x1d3974][_0x8fed('0x33')]+=moment(_0x3dc730[_0x29c6c2][_0x4efee9][_0x8fed('0x5d')]||_0x3dc730[_0x29c6c2][_0x4efee9][_0x8fed('0x5e')]||_0x3dc730[_0x29c6c2][_0x4efee9][_0x8fed('0x5f')])['diff'](moment(_0x3dc730[_0x29c6c2][_0x4efee9][_0x8fed('0x5b')]),_0x8fed('0x5c'))||0x0;_0x133df5[_0x8fed('0x16')][_0x1d3974][_0x8fed('0x31')]+=0x1;if(_0x3dc730[_0x29c6c2][_0x4efee9]['queuecallercomplete']){_0x133df5[_0x8fed('0x16')][_0x1d3974]['answered']+=0x1;_0x133df5['voiceQueues'][_0x1d3974][_0x8fed('0x39')]+=moment(_0x3dc730[_0x29c6c2][_0x4efee9][_0x8fed('0x5d')])[_0x8fed('0x60')](moment(_0x3dc730[_0x29c6c2][_0x4efee9]['queuecallerleaveAt']),_0x8fed('0x5c'))||0x0;}}else{_0x133df5[_0x8fed('0x16')][_0x1d3974][_0x8fed('0x33')]+=_0x133df5[_0x8fed('0x16')][_0x1d3974][_0x8fed('0x32')]||0x0;}}}}}}return _0x133df5['voiceQueues'];};};Realtime[_0x8fed('0x43')][_0x8fed('0x61')]=function(){var _0x1a28e6=this;return function(_0x4beb56){clearVoiceCallReports(_0x1a28e6[_0x8fed('0x1a')]);if(_0x4beb56){for(var _0x5f0f25=0x0;_0x5f0f25<_0x4beb56['length'];_0x5f0f25+=0x1){_0x1a28e6[_0x8fed('0x1a')][_0x8fed('0x31')]+=0x1;_0x1a28e6[_0x8fed('0x1a')][_0x8fed('0x33')]+=_0x4beb56[_0x5f0f25]['duration'];if(_0x4beb56[_0x5f0f25][_0x8fed('0x62')]===_0x8fed('0x63')){_0x1a28e6[_0x8fed('0x1a')][_0x8fed('0x37')]+=0x1;_0x1a28e6[_0x8fed('0x1a')][_0x8fed('0x32')]+=_0x4beb56[_0x5f0f25][_0x8fed('0x64')]-_0x4beb56[_0x5f0f25][_0x8fed('0x65')]||0x0;_0x1a28e6[_0x8fed('0x1a')][_0x8fed('0x39')]+=_0x4beb56[_0x5f0f25][_0x8fed('0x65')];}}}return _0x1a28e6[_0x8fed('0x1a')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x66')]=function(){var _0x2cdc91=this;return function(_0x4a7e1c){if(_0x4a7e1c){freeIsNotKey(_0x4a7e1c,_0x2cdc91[_0x8fed('0x18')],_0x8fed('0x2e'));for(var _0x9cbaa5=0x0,_0x4416fc={};_0x9cbaa5<_0x4a7e1c[_0x8fed('0x45')];_0x9cbaa5+=0x1){_0x4416fc=_0x4a7e1c[_0x9cbaa5];if(_[_0x8fed('0x47')](_0x2cdc91[_0x8fed('0x18')][_0x4416fc[_0x8fed('0x2e')]])){_0x2cdc91['campaigns'][_0x4416fc[_0x8fed('0x2e')]]=new Campaign(_0x4416fc);}else{_0x2cdc91[_0x8fed('0x44')](_0x2cdc91[_0x8fed('0x18')][_0x4416fc[_0x8fed('0x2e')]],_0x4416fc);_0x2cdc91[_0x8fed('0x18')][_0x4416fc[_0x8fed('0x2e')]][_0x8fed('0x67')]=_0x4416fc[_0x8fed('0x68')]?_0x4416fc['SquareProject'][_0x8fed('0x2e')]:undefined;}}}return _0x2cdc91[_0x8fed('0x18')];};};Realtime[_0x8fed('0x43')]['initVoiceExtensions']=function(){var _0x11715a=this;return function(_0x171908){if(_0x171908){freeIsNotKey(_0x171908,_0x11715a[_0x8fed('0x69')],'id');for(var _0x2fc800=0x0,_0x193089={};_0x2fc800<_0x171908[_0x8fed('0x45')];_0x2fc800+=0x1){_0x193089=_0x171908[_0x2fc800];if(_['isUndefined'](_0x11715a[_0x8fed('0x69')][_0x193089['id']])){_0x11715a['voiceExtensions'][_0x193089['id']]=new VoiceExtension(_0x193089);}else{_0x11715a['mergeFromDatabase'](_0x11715a[_0x8fed('0x69')][_0x193089['id']],_0x193089);}}}return _0x11715a[_0x8fed('0x69')];};};Realtime[_0x8fed('0x43')][_0x8fed('0x6a')]=function(){var _0x3f7bbd=this;return function(_0x441cb1){clearCampaigns(_0x3f7bbd[_0x8fed('0x18')]);for(var _0x4d3fb2=0x0;_0x4d3fb2<_0x441cb1[_0x8fed('0x45')];_0x4d3fb2+=0x1){_['merge'](_0x3f7bbd[_0x8fed('0x18')][_0x441cb1[_0x4d3fb2][_0x8fed('0x2e')]],_0x441cb1[_0x4d3fb2]);}return _0x3f7bbd['campaigns'];};};Realtime[_0x8fed('0x43')][_0x8fed('0x6b')]=function(){var _0x5d7737=this;return function(_0x5c1fe0){if(_0x5c1fe0){freeIsNotKey(_0x5c1fe0,_0x5d7737[_0x8fed('0x29')],'id');for(var _0x315746=0x0,_0x2b4102={},_0x283d56={};_0x315746<_0x5c1fe0[_0x8fed('0x45')];_0x315746+=0x1){_0x2b4102=_0x5c1fe0[_0x315746];if(_[_0x8fed('0x47')](_0x5d7737[_0x8fed('0x29')][_0x2b4102['id']])){_0x5d7737[_0x8fed('0x29')][_0x2b4102['id']]=new FaxAccount(_0x2b4102);}else{_0x5d7737[_0x8fed('0x44')](_0x5d7737[_0x8fed('0x29')][_0x2b4102['id']],_0x2b4102);}}}return _0x5d7737[_0x8fed('0x29')];};};module[_0x8fed('0x6c')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 587b115..2494aae 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 _0x4655=['disposition','calleridname','transfers','linkedid','uniqueid','UserId','membername','create','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','Local','substring','indexOf','mobile','phone','lastIndexOf','exports','moment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','length','connectedlinenum','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','keys','getCallType','channel','split','getAgentByInternal','calleridnum','outbound','internal','voiceCallReport','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','callerid'];(function(_0x3545d4,_0x426d0a){var _0x2e4550=function(_0xb6bcd){while(--_0xb6bcd){_0x3545d4['push'](_0x3545d4['shift']());}};_0x2e4550(++_0x426d0a);}(_0x4655,0x1d8));var _0x5465=function(_0x21fc07,_0x16c1c4){_0x21fc07=_0x21fc07-0x0;var _0x16ead9=_0x4655[_0x21fc07];return _0x16ead9;};'use strict';var _=require('lodash');var moment=require(_0x5465('0x0'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0x5465('0x1'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x5465('0x2'));var RpcVoiceDialReport=require(_0x5465('0x3'));var RpcMemberReport=require(_0x5465('0x4'));var RpcVoiceQueueReport=require(_0x5465('0x5'));var RpcVoiceRecording=require(_0x5465('0x6'));var RpcVoiceTransferReport=require(_0x5465('0x7'));var VoiceQueueReport=require(_0x5465('0x8'));var VoiceCallReport=require(_0x5465('0x9'));var VoiceAgentReport=require(_0x5465('0xa'));var VoiceDialReport=require(_0x5465('0xb'));var UserReport=require(_0x5465('0xc'));function Report(_0x5dc2a8){this[_0x5465('0xd')]=_0x5dc2a8;this[_0x5465('0xe')]=_0x5dc2a8[_0x5465('0xe')];this[_0x5465('0xf')]=_0x5dc2a8['telephones'];}Report[_0x5465('0x10')][_0x5465('0x11')]=function(_0x43a84e){var _0x2610e8=new VoiceQueueReport(this[_0x5465('0xd')]);var _0x1e1c56=new VoiceAgentReport(this[_0x5465('0xd')]);var _0x20aed3=new VoiceDialReport(this[_0x5465('0xd')]);var _0x8f4c46=new VoiceCallReport(this['realtime']);var _0x1fdfa5=new UserReport(this[_0x5465('0xd')]);if(config['xdr']&&config[_0x5465('0x12')]['disabled']){ami['on'](_0x5465('0x13'),this[_0x5465('0x14')][_0x5465('0x15')](this));ami['on'](_0x5465('0x16'),this['voiceCallReport'][_0x5465('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0x5465('0x17')][_0x5465('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x5465('0x18')]['bind'](this));ami['on'](_0x5465('0x19'),this[_0x5465('0x1a')]['bind'](this));ami['on'](_0x5465('0x1b'),this[_0x5465('0x1c')][_0x5465('0x15')](this));}};Report[_0x5465('0x10')][_0x5465('0x1d')]=function(_0x3dfd41){var _0x45d624;_0x45d624=_['find'](this[_0x5465('0xe')],function(_0x1b1410){return _0x1b1410[_0x5465('0x1e')]==_0x3dfd41||_0x1b1410[_0x5465('0x1f')]==_0x3dfd41;});if(_[_0x5465('0x20')](_0x45d624)){var _0x5930d7=_['find'](this[_0x5465('0xf')],function(_0x2ad96){return _0x2ad96[_0x5465('0x1e')]==_0x3dfd41||_0x2ad96[_0x5465('0x1f')]==_0x3dfd41;});if(_0x5930d7){_0x45d624=_[_0x5465('0x21')](this[_0x5465('0xe')],function(_0x175368){return _0x175368[_0x5465('0x22')]==util[_0x5465('0x23')]('SIP/%s',_0x5930d7['name']);});}}return _0x45d624;};Report[_0x5465('0x10')][_0x5465('0x14')]=function(_0x506365){for(var _0x32c7ac=0x0;_0x32c7ac<_0x506365[_0x5465('0x24')];_0x32c7ac+=0x1){var _0x2e8e4b=this[_0x5465('0x1d')](_0x506365[_0x32c7ac][_0x5465('0x25')]);if(_0x2e8e4b){_0x506365[_0x32c7ac][_0x5465('0x1e')]=_0x2e8e4b['accountcode'];_0x506365[_0x32c7ac]['assigned']=!![];_0x506365[_0x32c7ac][_0x5465('0x26')]=_0x2e8e4b[_0x5465('0x1f')];_0x506365[_0x32c7ac][_0x5465('0x22')]=_[_0x5465('0x20')](_0x2e8e4b[_0x5465('0x22')])?util[_0x5465('0x23')](_0x5465('0x27'),_0x2e8e4b['name']):_0x2e8e4b[_0x5465('0x22')];if(_0x506365[_0x32c7ac][_0x5465('0x28')]){_0x506365[_0x32c7ac][_0x5465('0x29')]=moment()[_0x5465('0x23')](_0x5465('0x2a'));}if(_0x506365[_0x32c7ac]['queuecallerexit']){_0x506365[_0x32c7ac][_0x5465('0x2b')]=moment()[_0x5465('0x23')](_0x5465('0x2a'));}RpcMemberReport[_0x5465('0x14')](_0x506365[_0x32c7ac]);}RpcVoiceQueueReport['create'](_0x506365[_0x32c7ac]);}};function extractCalleridNumber(_0x439ef8){var _0x3c2795=_0x439ef8[_0x5465('0x2c')](/<(.*?)>/);return _0x3c2795?_0x3c2795[0x1]:_0x439ef8;}Report[_0x5465('0x10')]['getAgentByInternal']=function(_0x4c2c64){for(var _0x2b7a27=0x0;_0x2b7a27',_0x353c9e[_0x5465('0x45')],_0x353c9e['calleridnum']);}if(RpcVoiceTransferReport[_0x5465('0x46')][_0x353c9e[_0x5465('0x47')]]){var _0x39c6f6=RpcVoiceTransferReport[_0x5465('0x46')][_0x353c9e['linkedid']];_0x39c6f6['transfereelinkedid']=_0x353c9e[_0x5465('0x48')];RpcVoiceTransferReport[_0x5465('0x1a')](_0x39c6f6);delete RpcVoiceTransferReport[_0x5465('0x46')][_0x353c9e[_0x5465('0x47')]];}if(_[_0x5465('0x20')](_0x353c9e[_0x5465('0x37')])){_0x353c9e[_0x5465('0x37')]=this[_0x5465('0x2e')](_0x353c9e);}if(_[_0x5465('0x20')](_0x353c9e[_0x5465('0x49')])){var _0x170877=_0x353c9e[_0x5465('0x2f')][_0x5465('0x30')]('-')[0x0];var _0x377ef7=this[_0x5465('0xe')][_0x170877];if(!_0x377ef7)_0x377ef7=this[_0x5465('0x31')](_0x353c9e[_0x5465('0x1e')]);if(_0x377ef7){_0x353c9e[_0x5465('0x49')]=_0x377ef7['id'];_0x353c9e[_0x5465('0x4a')]=_0x377ef7[_0x5465('0x1f')];}}RpcVoiceCallReport[_0x5465('0x4b')](_0x353c9e);if(_0x353c9e['monitor']){for(var _0x44cb67=0x0;_0x44cb67<_0x353c9e[_0x5465('0x4c')][_0x5465('0x24')];_0x44cb67+=0x1){_0x353c9e[_0x5465('0x4d')]=_0x353c9e[_0x5465('0x4c')][_0x44cb67][_0x5465('0x4e')];_0x353c9e[_0x5465('0x4f')]=_0x353c9e['monitors'][_0x44cb67]['createdAt'];if(_0x353c9e[_0x5465('0x50')]=='xcally-motion-preview'){_0x353c9e['calleridnum']=_0x353c9e[_0x5465('0x25')];_0x353c9e[_0x5465('0x45')]=_0x353c9e['connectedlinename'];_0x353c9e['connectedlinenum']=_0x353c9e['accountcode'];_0x353c9e[_0x5465('0x51')]=_0x353c9e[_0x5465('0x4a')];_0x353c9e['exten']=_0x353c9e[_0x5465('0x41')];}else if(_0x353c9e[_0x5465('0x50')]==_0x5465('0x52')){_0x353c9e[_0x5465('0x32')]=_0x353c9e[_0x5465('0x36')];_0x353c9e[_0x5465('0x50')]=_0x353c9e[_0x5465('0x41')];}RpcVoiceRecording[_0x5465('0x4b')](_0x353c9e);}}};Report[_0x5465('0x10')][_0x5465('0x17')]=function(_0x1fce3d){if(_['isArray'](_0x1fce3d)){_0x1fce3d['forEach'](function(_0xcdd790){RpcVoiceAgentReport['create'](_0xcdd790);});}else{RpcVoiceAgentReport[_0x5465('0x4b')](_0x1fce3d);}};Report[_0x5465('0x10')]['voiceDialReport']=function(_0x5f3d84){RpcVoiceDialReport[_0x5465('0x4b')](_0x5f3d84);var _0x3ab74f;var _0x4ed336;var _0x41cf91=_0x5f3d84[_0x5465('0x2f')];if(_['startsWith'](_0x41cf91,_0x5465('0x53'))){_0x4ed336=_0x41cf91[_0x5465('0x54')](_0x41cf91[_0x5465('0x55')]('/')+0x1,_0x41cf91[_0x5465('0x55')]('@'));_0x3ab74f=_[_0x5465('0x21')](this[_0x5465('0xe')],function(_0x44ff6c){return _0x44ff6c[_0x5465('0x56')]==_0x4ed336||_0x44ff6c[_0x5465('0x57')]==_0x4ed336||_0x44ff6c[_0x5465('0x1e')]==_0x4ed336;});}else{_0x4ed336=_0x41cf91['substring'](_0x41cf91[_0x5465('0x55')]('/')+0x1,_0x41cf91[_0x5465('0x58')]('-'));_0x3ab74f=this[_0x5465('0x1d')](_0x4ed336);}if(_0x3ab74f){_0x5f3d84[_0x5465('0x22')]=_[_0x5465('0x20')](_0x3ab74f['interface'])?util[_0x5465('0x23')](_0x5465('0x27'),_0x3ab74f[_0x5465('0x1f')]):_0x3ab74f[_0x5465('0x22')];_0x5f3d84['membername']=_0x3ab74f[_0x5465('0x1f')];_0x5f3d84[_0x5465('0x1e')]=_0x3ab74f['accountcode'];RpcMemberReport[_0x5465('0x18')](_0x5f3d84);}};Report['prototype'][_0x5465('0x1a')]=function(_0x256039){RpcVoiceTransferReport[_0x5465('0x46')][_0x256039['transfererlinkedid']]=_0x256039;};Report['prototype'][_0x5465('0x1c')]=function(_0x2e5b4c){RpcVoiceTransferReport[_0x5465('0x1c')](_0x2e5b4c);};module[_0x5465('0x59')]=Report; \ No newline at end of file +var _0x2678=['type','lastapplication','queue','lastdata','context','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','transfereelinkedid','uniqueid','linkedid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','exten','originatecalleridnum','xcally-motion-dialer','forEach','startsWith','indexOf','phone','substring','lastIndexOf','SIP/%s','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','telephones','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','agents','accountcode','name','isNil','interface','format','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','channel','split','calleridnum','outbound','voiceCallReport','destination'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x2678,0xdd));var _0x8267=function(_0x560ead,_0xba17f0){_0x560ead=_0x560ead-0x0;var _0x501e89=_0x2678[_0x560ead];return _0x501e89;};'use strict';var _=require(_0x8267('0x0'));var moment=require(_0x8267('0x1'));var util=require(_0x8267('0x2'));var config=require(_0x8267('0x3'));var ami=require(_0x8267('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x8267('0x5'));var RpcMemberReport=require(_0x8267('0x6'));var RpcVoiceQueueReport=require(_0x8267('0x7'));var RpcVoiceRecording=require(_0x8267('0x8'));var RpcVoiceTransferReport=require(_0x8267('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x8267('0xa'));var VoiceDialReport=require(_0x8267('0xb'));var UserReport=require(_0x8267('0xc'));function Report(_0x399bd0){this['realtime']=_0x399bd0;this['agents']=_0x399bd0['agents'];this[_0x8267('0xd')]=_0x399bd0[_0x8267('0xd')];}Report['prototype'][_0x8267('0xe')]=function(_0x4c7c9b){var _0x1f30d8=new VoiceQueueReport(this['realtime']);var _0x345a18=new VoiceAgentReport(this[_0x8267('0xf')]);var _0x5d409c=new VoiceDialReport(this[_0x8267('0xf')]);var _0x54909c=new VoiceCallReport(this['realtime']);var _0x5181bb=new UserReport(this[_0x8267('0xf')]);if(config[_0x8267('0x10')]&&config[_0x8267('0x10')][_0x8267('0x11')]){ami['on'](_0x8267('0x12'),this[_0x8267('0x13')][_0x8267('0x14')](this));ami['on'](_0x8267('0x15'),this['voiceCallReport'][_0x8267('0x14')](this));ami['on'](_0x8267('0x16'),this[_0x8267('0x17')][_0x8267('0x14')](this));ami['on'](_0x8267('0x18'),this[_0x8267('0x19')]['bind'](this));ami['on'](_0x8267('0x1a'),this[_0x8267('0x1b')][_0x8267('0x14')](this));ami['on'](_0x8267('0x1c'),this[_0x8267('0x1d')][_0x8267('0x14')](this));}};Report[_0x8267('0x1e')][_0x8267('0x1f')]=function(_0x36f913){var _0x50e447;_0x50e447=_[_0x8267('0x20')](this[_0x8267('0x21')],function(_0x4f0d38){return _0x4f0d38[_0x8267('0x22')]==_0x36f913||_0x4f0d38[_0x8267('0x23')]==_0x36f913;});if(_[_0x8267('0x24')](_0x50e447)){var _0x20296e=_[_0x8267('0x20')](this[_0x8267('0xd')],function(_0x279278){return _0x279278[_0x8267('0x22')]==_0x36f913||_0x279278[_0x8267('0x23')]==_0x36f913;});if(_0x20296e){_0x50e447=_['find'](this[_0x8267('0x21')],function(_0x173703){return _0x173703[_0x8267('0x25')]==util[_0x8267('0x26')]('SIP/%s',_0x20296e['name']);});}}return _0x50e447;};Report[_0x8267('0x1e')]['voiceQueueReport']=function(_0xc2d098){for(var _0x58cd4f=0x0;_0x58cd4f<_0xc2d098[_0x8267('0x27')];_0x58cd4f+=0x1){var _0x32d43a=this['findAgent'](_0xc2d098[_0x58cd4f][_0x8267('0x28')]);if(_0x32d43a){_0xc2d098[_0x58cd4f]['accountcode']=_0x32d43a[_0x8267('0x22')];_0xc2d098[_0x58cd4f][_0x8267('0x29')]=!![];_0xc2d098[_0x58cd4f][_0x8267('0x2a')]=_0x32d43a[_0x8267('0x23')];_0xc2d098[_0x58cd4f][_0x8267('0x25')]=_['isNil'](_0x32d43a['interface'])?util[_0x8267('0x26')]('SIP/%s',_0x32d43a['name']):_0x32d43a[_0x8267('0x25')];if(_0xc2d098[_0x58cd4f][_0x8267('0x2b')]){_0xc2d098[_0x58cd4f][_0x8267('0x2c')]=moment()[_0x8267('0x26')](_0x8267('0x2d'));}if(_0xc2d098[_0x58cd4f][_0x8267('0x2e')]){_0xc2d098[_0x58cd4f][_0x8267('0x2f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x8267('0x13')](_0xc2d098[_0x58cd4f]);}RpcVoiceQueueReport[_0x8267('0x30')](_0xc2d098[_0x58cd4f]);}};function extractCalleridNumber(_0x37e459){var _0xeb34c0=_0x37e459[_0x8267('0x31')](/<(.*?)>/);return _0xeb34c0?_0xeb34c0[0x1]:_0x37e459;}Report[_0x8267('0x1e')][_0x8267('0x32')]=function(_0x59a01b){for(var _0x44bcbf=0x0;_0x44bcbf0x0?_0x5c99e7:0x0;this[_0x46a2('0x14')][_0x16e7ba['queue']]['talking']=this[_0x46a2('0x14')][_0x16e7ba[_0x46a2('0x62')]][_0x46a2('0x31')]>_[_0x46a2('0x69')](_0x16e7ba[_0x46a2('0x68')])?_[_0x46a2('0x69')](_0x16e7ba[_0x46a2('0x68')]):this[_0x46a2('0x14')][_0x16e7ba[_0x46a2('0x62')]][_0x46a2('0x31')];this[_0x46a2('0x4f')](this[_0x46a2('0x14')][_0x16e7ba['queue']],_0x46a2('0x18'));}logger[_0x46a2('0x44')](_0x46a2('0x6a'),util[_0x46a2('0x3d')](this[_0x46a2('0x14')][_0x16e7ba['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0x46a2('0x6b'),this[_0x46a2('0x14')][_0x16e7ba[_0x46a2('0x62')]]);}}}catch(_0x1bfac4){logger[_0x46a2('0x3c')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x1bfac4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x46a2('0x6c')]=function(_0x49bfdf){logger[_0x46a2('0x44')](_0x46a2('0x6d'),util[_0x46a2('0x3d')](_0x49bfdf,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x46a2('0xc')][_0x46a2('0x1d')]=function(_0x34c729){try{if(this[_0x46a2('0x5e')](_0x34c729)){logger['debug'](_0x46a2('0x6e'),_0x34c729[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0x34c729,{'showHidden':![],'depth':null}));if(_[_0x46a2('0x5f')](this['queueReports'][_0x34c729[_0x46a2('0x4b')]]))this[_0x46a2('0x10')][_0x34c729[_0x46a2('0x4b')]]=[];if(_[_0x46a2('0x5f')](this[_0x46a2('0x12')][_0x34c729[_0x46a2('0x4b')]]))this['channels'][_0x34c729[_0x46a2('0x4b')]]={};var _0x5345eb=new QueueReport();_0x5345eb[_0x46a2('0x48')]=_0x34c729[_0x46a2('0x62')];_0x5345eb[_0x46a2('0x50')]=this[_0x46a2('0x14')][_0x5345eb[_0x46a2('0x48')]]&&this[_0x46a2('0x14')][_0x5345eb[_0x46a2('0x48')]][_0x46a2('0x50')]?this[_0x46a2('0x14')][_0x5345eb['name']][_0x46a2('0x50')]||'inbound':_0x46a2('0x51');_0x5345eb[_0x46a2('0x62')]=_0x34c729['queue'];_0x5345eb[_0x46a2('0x6f')]=moment()[_0x46a2('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x5345eb[_0x46a2('0x70')]=_0x34c729['position'];_0x5345eb[_0x46a2('0x71')]=_0x34c729[_0x46a2('0x71')];_0x5345eb['uniqueid']=_0x34c729['uniqueid'];_0x5345eb['routealias']=this[_0x46a2('0x12')][_0x34c729[_0x46a2('0x4b')]][_0x46a2('0x72')];logger['info'](_0x46a2('0x73'),_0x5345eb[_0x46a2('0x48')],_0x5345eb['type']);_[_0x46a2('0x74')](_0x5345eb,_[_0x46a2('0x75')](_0x34c729,_[_0x46a2('0x76')](_0x5345eb)));this[_0x46a2('0x10')][_0x34c729[_0x46a2('0x4b')]][_0x46a2('0x77')](_0x5345eb);this['channels'][_0x34c729[_0x46a2('0x4b')]]=_0x5345eb;this[_0x46a2('0x43')](_0x5345eb,_0x46a2('0x1c'));}}catch(_0x21f316){logger[_0x46a2('0x3c')](_0x46a2('0x6e'),_0x34c729[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0x21f316,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x46a2('0xc')]['syncQueueCallerAbandon']=function(_0xb1fee3){try{if(this[_0x46a2('0x5e')](_0xb1fee3)){logger[_0x46a2('0x44')](_0x46a2('0x78'),_0xb1fee3['uniqueid'],util[_0x46a2('0x3d')](_0xb1fee3,{'showHidden':![],'depth':null}));if(this[_0x46a2('0x10')][_0xb1fee3[_0x46a2('0x4b')]]){var _0x2c75f1=_[_0x46a2('0x79')](this[_0x46a2('0x10')][_0xb1fee3[_0x46a2('0x4b')]]);_0x2c75f1['queuecallercomplete']=![];_0x2c75f1[_0x46a2('0x7a')]=null;_0x2c75f1[_0x46a2('0x7b')]=_0xb1fee3['holdtime'];_0x2c75f1[_0x46a2('0x7c')]=_0xb1fee3[_0x46a2('0x7c')];_0x2c75f1[_0x46a2('0x7d')]=!![];_0x2c75f1[_0x46a2('0x7e')]=moment()[_0x46a2('0x47')](_0x46a2('0x7f'));_0x2c75f1['queuecallerexitreason']=_0x46a2('0x80');_0x2c75f1['lastAssignedTo']=null;logger[_0x46a2('0x64')](_0x46a2('0x81'),_0x2c75f1[_0x46a2('0x48')],_0x2c75f1['type']);this[_0x46a2('0x12')][_0xb1fee3[_0x46a2('0x4b')]]=_0x2c75f1;this[_0x46a2('0x40')](_0x2c75f1,_0x46a2('0x7d'));}}}catch(_0x5eda5d){logger[_0x46a2('0x3c')]('[%s][voiceQueueReport][queuecallerabandon]',_0xb1fee3[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0x5eda5d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x46a2('0x1f')]=function(_0x3d3b46){try{if(this['isNotNull'](_0x3d3b46)){logger[_0x46a2('0x44')]('[%s][voiceQueueReport][queuecallerleave]',_0x3d3b46[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0x3d3b46,{'showHidden':![],'depth':null}));if(this[_0x46a2('0x10')][_0x3d3b46[_0x46a2('0x4b')]]){var _0x162517=_[_0x46a2('0x79')](this['queueReports'][_0x3d3b46[_0x46a2('0x4b')]]);_0x162517['queuecallerleaveAt']=moment()[_0x46a2('0x47')](_0x46a2('0x7f'));_0x162517['connectedlinenum']=_0x3d3b46[_0x46a2('0x82')];_0x162517[_0x46a2('0x83')]=_0x3d3b46[_0x46a2('0x83')];logger[_0x46a2('0x64')](_0x46a2('0x84'),_0x162517['name'],_0x162517[_0x46a2('0x50')],_0x3d3b46['connectedlinenum'],_0x3d3b46['connectedlinename']);this['channels'][_0x3d3b46['uniqueid']]=_0x162517;this[_0x46a2('0x43')](_0x162517,_0x46a2('0x85'));}}}catch(_0x35702c){logger[_0x46a2('0x3c')]('[%s][voiceQueueReport][queuecallerleave]',_0x3d3b46[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0x35702c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x46a2('0xc')]['syncAgentConnect']=function(_0x1adf0f){try{if(this['isNotNull'](_0x1adf0f)){logger[_0x46a2('0x44')](_0x46a2('0x86'),_0x1adf0f[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0x1adf0f,{'showHidden':![],'depth':null}));if(this[_0x46a2('0x10')][_0x1adf0f['uniqueid']]){var _0x498bf4=_['last'](this[_0x46a2('0x10')][_0x1adf0f[_0x46a2('0x4b')]]);_0x498bf4[_0x46a2('0x87')]=!![];_0x498bf4[_0x46a2('0x4c')]='COMPLETEDBYAGENT';logger['info'](_0x46a2('0x88'),_0x498bf4['name'],_0x498bf4[_0x46a2('0x50')]);}}}catch(_0xd56037){logger[_0x46a2('0x3c')](_0x46a2('0x86'),_0x1adf0f[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0xd56037,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x46a2('0x89')]=function(_0x3380f6){try{if(this['isNotNull'](_0x3380f6)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x3380f6[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0x3380f6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3380f6[_0x46a2('0x4b')]]){var _0x234548=_[_0x46a2('0x79')](this[_0x46a2('0x10')][_0x3380f6[_0x46a2('0x4b')]]);_0x234548[_0x46a2('0x7d')]=![];_0x234548[_0x46a2('0x7e')]=null;_0x234548[_0x46a2('0x8a')]=!![];_0x234548[_0x46a2('0x8b')]=_0x3380f6[_0x46a2('0x8c')];_0x234548[_0x46a2('0x7b')]=_0x3380f6[_0x46a2('0x7b')];_0x234548['queuecallercomplete']=!![];_0x234548['queuecallerexit']=![];_0x234548['queuecallerexitAt']=null;if(!_0x234548[_0x46a2('0x8d')]){if(_0x3380f6['reason']==_0x46a2('0x8d')){_0x234548[_0x46a2('0x4c')]=_0x46a2('0x8e');logger['info'](_0x46a2('0x8f'),_0x234548[_0x46a2('0x48')],_0x234548[_0x46a2('0x50')]);}else{if(_[_0x46a2('0x90')](_0x3380f6[_0x46a2('0x91')]['toLowerCase'](),_0x46a2('0x92'))){if(this[_0x46a2('0x10')][_0x3380f6['linkedid']]){var _0x33a96a=_['last'](this[_0x46a2('0x10')][_0x3380f6[_0x46a2('0x93')]]);_0x33a96a['queuecallercomplete']=![];_0x33a96a[_0x46a2('0x94')]=!![];_0x33a96a[_0x46a2('0x95')]=moment(_0x234548[_0x46a2('0x6f')])[_0x46a2('0x96')](_0x3380f6[_0x46a2('0x7b')],_0x46a2('0x97'))[_0x46a2('0x47')](_0x46a2('0x7f'));_0x33a96a[_0x46a2('0x4c')]=_0x46a2('0x98');_0x33a96a[_0x46a2('0x8d')]=!![];_0x33a96a['transfertype']='FORWARD';_0x33a96a[_0x46a2('0x99')]=_0x3380f6[_0x46a2('0x9a')];_0x33a96a['transferuniqueid']=_0x3380f6[_0x46a2('0x4b')];logger[_0x46a2('0x64')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x33a96a[_0x46a2('0x48')],_0x33a96a[_0x46a2('0x50')]);var _0x1f7160=this[_0x46a2('0x10')][_0x3380f6[_0x46a2('0x93')]];this[_0x46a2('0x10')][_0x3380f6[_0x46a2('0x93')]]=this[_0x46a2('0x10')][_0x3380f6[_0x46a2('0x4b')]];this[_0x46a2('0x10')][_0x3380f6[_0x46a2('0x4b')]]=_0x1f7160;}}else{_0x234548['queuecallerexitreason']='COMPLETEDBY'+_0x3380f6[_0x46a2('0x9b')][_0x46a2('0x9c')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x234548[_0x46a2('0x48')],_0x234548['type'],_0x234548[_0x46a2('0x4c')]);}}}this[_0x46a2('0x12')][_0x3380f6[_0x46a2('0x4b')]]=_0x234548;this[_0x46a2('0x40')](_0x234548,_0x46a2('0x20'));}}}catch(_0x4ab6ac){logger['error'](_0x46a2('0x9d'),_0x3380f6[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0x4ab6ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x46a2('0xc')][_0x46a2('0x23')]=function(_0x396831){try{if(this[_0x46a2('0x5e')](_0x396831)){logger[_0x46a2('0x44')]('[%s][voiceQueueReport][varset]',_0x396831[_0x46a2('0x4b')],util['inspect'](_0x396831,{'showHidden':![],'depth':null}));this[_0x46a2('0x9e')](_0x396831['uniqueid'],_['keys'](_0x396831[_0x46a2('0x9f')])[0x0],_0x396831[_0x46a2('0xa0')]);if(this['queueReports'][_0x396831[_0x46a2('0x4b')]]){var _0x1d4c7d=_['last'](this[_0x46a2('0x10')][_0x396831[_0x46a2('0x4b')]]);if(_0x1d4c7d){if(this[_0x46a2('0x5e')](_0x396831['variable'])&&this[_0x46a2('0x5e')](_0x396831[_0x46a2('0x9f')]['queuestatus'])){switch(_0x396831[_0x46a2('0xa0')]){case _0x46a2('0xa1'):_0x1d4c7d[_0x46a2('0x94')]=![];_0x1d4c7d[_0x46a2('0x95')]=null;break;case _0x46a2('0xa2'):_0x1d4c7d['lastevent']=_0x46a2('0xa3');_0x1d4c7d['queuecallerexit']=!![];_0x1d4c7d[_0x46a2('0x95')]=moment()[_0x46a2('0x47')](_0x46a2('0x7f'));_0x1d4c7d[_0x46a2('0xa4')]=moment()[_0x46a2('0x47')](_0x46a2('0x7f'));logger[_0x46a2('0x44')](_0x46a2('0xa5'),_0x396831[_0x46a2('0x4b')],util['inspect'](_0x1d4c7d,{'showHidden':![],'depth':null}));ami[_0x46a2('0x42')]('custom:timeout',_0x1d4c7d);break;default:_0x1d4c7d[_0x46a2('0x94')]=!![];_0x1d4c7d[_0x46a2('0x95')]=moment()[_0x46a2('0x47')](_0x46a2('0x7f'));_0x1d4c7d[_0x46a2('0xa4')]=moment()['format'](_0x46a2('0x7f'));}_0x1d4c7d[_0x46a2('0x7d')]=![];_0x1d4c7d['queuecallerabandonAt']=null;_0x1d4c7d[_0x46a2('0x4c')]=_0x396831[_0x46a2('0xa0')];this['channels'][_0x396831[_0x46a2('0x4b')]]=_0x1d4c7d;this['emitVoiceQueueChannelRemove'](_0x1d4c7d,'varset');}else if(this['isNotNull'](_0x396831[_0x46a2('0x9f')])&&this[_0x46a2('0x5e')](_0x396831[_0x46a2('0x9f')][_0x46a2('0xa6')])){if(!_0x1d4c7d[_0x46a2('0x7d')]){_0x1d4c7d[_0x46a2('0x94')]=!![];_0x1d4c7d['queuecallerexitAt']=moment()['format'](_0x46a2('0x7f'));_0x1d4c7d['queuecallerexitreason']=_0x46a2('0xa7');_0x1d4c7d['queuecallerleaveAt']=moment()[_0x46a2('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x46a2('0x12')][_0x396831[_0x46a2('0x4b')]]=_0x1d4c7d;}}logger[_0x46a2('0x64')](_0x46a2('0xa8'),_0x396831['uniqueid'],_0x1d4c7d[_0x46a2('0x48')],_0x1d4c7d[_0x46a2('0x50')],_[_0x46a2('0x76')](_0x396831[_0x46a2('0x9f')])[0x0],_0x396831[_0x46a2('0xa0')]);_0x1d4c7d[_0x46a2('0x17')]=this['variables'][_0x396831[_0x46a2('0x4b')]];}}}}catch(_0x25e9c0){logger[_0x46a2('0x3c')](_0x46a2('0xa9'),_0x396831[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0x25e9c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x46a2('0x9e')]=function(_0x249265,_0x318448,_0x1dbfb0){var _0x1e7a23=[_0x46a2('0xaa'),_0x46a2('0xab'),'rtpaudioqosjitter',_0x46a2('0xac'),_0x46a2('0xad'),_0x46a2('0xae'),_0x46a2('0xaf'),_0x46a2('0xb0'),_0x46a2('0xb1'),_0x46a2('0xb2'),_0x46a2('0xb3'),_0x46a2('0xb4'),_0x46a2('0xb5'),_0x46a2('0xb6'),_0x46a2('0xb7'),'memberlastcall',_0x46a2('0x8c'),_0x46a2('0xb8'),_0x46a2('0xb9')];if(!_[_0x46a2('0x37')](_0x318448)&&!_[_0x46a2('0xba')](_0x1e7a23,_0x318448)){if(_['isUndefined'](this[_0x46a2('0x17')][_0x249265])){this[_0x46a2('0x17')][_0x249265]={};}this[_0x46a2('0x17')][_0x249265][_0x318448]=_0x1dbfb0;}};VoiceQueueReport[_0x46a2('0xc')][_0x46a2('0xbb')]=function(_0x589d47){try{if(this[_0x46a2('0x5e')](_0x589d47)){logger[_0x46a2('0x44')](_0x46a2('0xbc'),_0x589d47[_0x46a2('0x4b')],util[_0x46a2('0x3d')](_0x589d47,{'showHidden':![],'depth':null}));if(this[_0x46a2('0x10')][_0x589d47[_0x46a2('0x4b')]]){for(var _0x2ad8a0=0x0,_0x4520aa={};_0x2ad8a00x0?_0x272b67:0x0;this[_0x1404('0x13')][_0x5cf156[_0x1404('0x68')]]['talking']=this[_0x1404('0x13')][_0x5cf156[_0x1404('0x68')]][_0x1404('0x30')]>_[_0x1404('0x6d')](_0x5cf156[_0x1404('0x6f')])?_[_0x1404('0x6d')](_0x5cf156[_0x1404('0x6f')]):this['voiceQueues'][_0x5cf156['queue']][_0x1404('0x30')];this[_0x1404('0x55')](this[_0x1404('0x13')][_0x5cf156['queue']],'queuesummary');}logger[_0x1404('0x49')](_0x1404('0x70'),util[_0x1404('0x3e')](this[_0x1404('0x13')][_0x5cf156['queue']],{'showHidden':![],'depth':null}));ami[_0x1404('0x47')](_0x1404('0x71'),this[_0x1404('0x13')][_0x5cf156['queue']]);}}}catch(_0x43ce4b){logger['error']('[voiceQueueReport][queuesummary]',util['inspect'](_0x43ce4b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1404('0xb')][_0x1404('0x19')]=function(_0x1e41fe){logger[_0x1404('0x49')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x1e41fe,{'showHidden':![],'depth':null}));this[_0x1404('0x14')]=!![];};VoiceQueueReport['prototype'][_0x1404('0x1a')]=function(_0x546451){try{if(this[_0x1404('0x67')](_0x546451)){logger[_0x1404('0x49')](_0x1404('0x72'),_0x546451[_0x1404('0x4c')],util['inspect'](_0x546451,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x1404('0x3f')][_0x546451[_0x1404('0x4c')]]))this[_0x1404('0x3f')][_0x546451[_0x1404('0x4c')]]=[];if(_['isUndefined'](this['channels'][_0x546451['uniqueid']]))this['channels'][_0x546451['uniqueid']]={};var _0x355fd4=new QueueReport();_0x355fd4[_0x1404('0x4f')]=_0x546451['queue'];_0x355fd4[_0x1404('0x56')]=this[_0x1404('0x13')][_0x355fd4[_0x1404('0x4f')]]&&this['voiceQueues'][_0x355fd4[_0x1404('0x4f')]]['type']?this[_0x1404('0x13')][_0x355fd4[_0x1404('0x4f')]][_0x1404('0x56')]||_0x1404('0x57'):_0x1404('0x57');_0x355fd4['queue']=_0x546451[_0x1404('0x68')];_0x355fd4[_0x1404('0x73')]=moment()[_0x1404('0x4d')](_0x1404('0x74'));_0x355fd4[_0x1404('0x75')]=_0x546451[_0x1404('0x75')];_0x355fd4[_0x1404('0x76')]=_0x546451['count'];_0x355fd4[_0x1404('0x4c')]=_0x546451[_0x1404('0x4c')];_0x355fd4[_0x1404('0x77')]=this[_0x1404('0x11')][_0x546451[_0x1404('0x4c')]][_0x1404('0x77')];logger[_0x1404('0x78')](_0x1404('0x79'),_0x355fd4['name'],_0x355fd4[_0x1404('0x56')]);_[_0x1404('0x7a')](_0x355fd4,_['pick'](_0x546451,_[_0x1404('0x7b')](_0x355fd4)));this[_0x1404('0x3f')][_0x546451[_0x1404('0x4c')]][_0x1404('0x7c')](_0x355fd4);this['channels'][_0x546451[_0x1404('0x4c')]]=_0x355fd4;this[_0x1404('0x48')](_0x355fd4,_0x1404('0x7d'));}}catch(_0x51ad99){logger[_0x1404('0x3d')](_0x1404('0x72'),_0x546451['uniqueid'],util[_0x1404('0x3e')](_0x51ad99,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1404('0xb')]['syncQueueCallerAbandon']=function(_0x26d84c){try{if(this[_0x1404('0x67')](_0x26d84c)){logger[_0x1404('0x49')](_0x1404('0x7e'),_0x26d84c[_0x1404('0x4c')],util[_0x1404('0x3e')](_0x26d84c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x26d84c['uniqueid']]){var _0x2f122a=_['last'](this[_0x1404('0x3f')][_0x26d84c['uniqueid']]);_0x2f122a[_0x1404('0x7f')]=![];_0x2f122a[_0x1404('0x80')]=null;_0x2f122a[_0x1404('0x81')]=_0x26d84c[_0x1404('0x81')];_0x2f122a[_0x1404('0x82')]=_0x26d84c[_0x1404('0x82')];_0x2f122a['queuecallerabandon']=!![];_0x2f122a[_0x1404('0x83')]=moment()[_0x1404('0x4d')](_0x1404('0x74'));_0x2f122a[_0x1404('0x52')]=_0x1404('0x84');_0x2f122a[_0x1404('0x85')]=null;logger[_0x1404('0x78')](_0x1404('0x86'),_0x2f122a['name'],_0x2f122a[_0x1404('0x56')]);this[_0x1404('0x11')][_0x26d84c[_0x1404('0x4c')]]=_0x2f122a;this[_0x1404('0x45')](_0x2f122a,'queuecallerabandon');}}}catch(_0x49e200){logger['error'](_0x1404('0x7e'),_0x26d84c[_0x1404('0x4c')],util['inspect'](_0x49e200,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1404('0x1e')]=function(_0x4c5f14){try{if(this[_0x1404('0x67')](_0x4c5f14)){logger[_0x1404('0x49')]('[%s][voiceQueueReport][queuecallerleave]',_0x4c5f14[_0x1404('0x4c')],util['inspect'](_0x4c5f14,{'showHidden':![],'depth':null}));if(this[_0x1404('0x3f')][_0x4c5f14[_0x1404('0x4c')]]){var _0x4406ec=_[_0x1404('0x87')](this[_0x1404('0x3f')][_0x4c5f14[_0x1404('0x4c')]]);_0x4406ec[_0x1404('0x88')]=moment()[_0x1404('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x4406ec[_0x1404('0x89')]=_0x4c5f14['connectedlinenum'];_0x4406ec['connectedlinename']=_0x4c5f14[_0x1404('0x8a')];logger[_0x1404('0x78')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4406ec['name'],_0x4406ec['type'],_0x4c5f14['connectedlinenum'],_0x4c5f14[_0x1404('0x8a')]);this[_0x1404('0x11')][_0x4c5f14[_0x1404('0x4c')]]=_0x4406ec;this[_0x1404('0x48')](_0x4406ec,_0x1404('0x1d'));}}}catch(_0x1bded3){logger[_0x1404('0x3d')](_0x1404('0x8b'),_0x4c5f14['uniqueid'],util[_0x1404('0x3e')](_0x1bded3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1404('0xb')][_0x1404('0x8c')]=function(_0x2965bb){try{if(this[_0x1404('0x67')](_0x2965bb)){logger[_0x1404('0x49')](_0x1404('0x8d'),_0x2965bb[_0x1404('0x4c')],util['inspect'](_0x2965bb,{'showHidden':![],'depth':null}));if(this[_0x1404('0x3f')][_0x2965bb['uniqueid']]){var _0x3c407b=_['last'](this[_0x1404('0x3f')][_0x2965bb[_0x1404('0x4c')]]);_0x3c407b['queuecallercomplete']=!![];_0x3c407b[_0x1404('0x52')]=_0x1404('0x8e');logger[_0x1404('0x78')](_0x1404('0x8f'),_0x3c407b[_0x1404('0x4f')],_0x3c407b['type']);}}}catch(_0x2f02c2){logger[_0x1404('0x3d')](_0x1404('0x8d'),_0x2965bb[_0x1404('0x4c')],util[_0x1404('0x3e')](_0x2f02c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1404('0xb')]['syncAgentComplete']=function(_0x4bfbd2){try{if(this[_0x1404('0x67')](_0x4bfbd2)){logger[_0x1404('0x49')](_0x1404('0x90'),_0x4bfbd2['uniqueid'],util[_0x1404('0x3e')](_0x4bfbd2,{'showHidden':![],'depth':null}));if(this[_0x1404('0x3f')][_0x4bfbd2[_0x1404('0x4c')]]){var _0x2d5e9c=_[_0x1404('0x87')](this[_0x1404('0x3f')][_0x4bfbd2[_0x1404('0x4c')]]);_0x2d5e9c[_0x1404('0x1b')]=![];_0x2d5e9c['queuecallerabandonAt']=null;_0x2d5e9c['assigned']=!![];_0x2d5e9c[_0x1404('0x85')]=_0x4bfbd2[_0x1404('0x91')];_0x2d5e9c[_0x1404('0x81')]=_0x4bfbd2[_0x1404('0x81')];_0x2d5e9c[_0x1404('0x7f')]=!![];_0x2d5e9c['queuecallerexit']=![];_0x2d5e9c[_0x1404('0x92')]=null;if(!_0x2d5e9c[_0x1404('0x93')]){if(_0x4bfbd2[_0x1404('0x94')]=='transfer'){_0x2d5e9c['queuecallerexitreason']='COMPLETED';logger[_0x1404('0x78')](_0x1404('0x95'),_0x2d5e9c['name'],_0x2d5e9c[_0x1404('0x56')]);}else{if(_[_0x1404('0x96')](_0x4bfbd2[_0x1404('0x3a')][_0x1404('0x97')](),_0x1404('0x98'))){if(this[_0x1404('0x3f')][_0x4bfbd2['linkedid']]){var _0x393e6f=_[_0x1404('0x87')](this[_0x1404('0x3f')][_0x4bfbd2[_0x1404('0x99')]]);_0x393e6f['queuecallercomplete']=![];_0x393e6f[_0x1404('0x9a')]=!![];_0x393e6f[_0x1404('0x92')]=moment(_0x2d5e9c[_0x1404('0x73')])[_0x1404('0x9b')](_0x4bfbd2[_0x1404('0x81')],'seconds')[_0x1404('0x4d')](_0x1404('0x74'));_0x393e6f[_0x1404('0x52')]='FORWARDTRANSFER';_0x393e6f[_0x1404('0x93')]=!![];_0x393e6f['transfertype']='FORWARD';_0x393e6f[_0x1404('0x9c')]=_0x4bfbd2[_0x1404('0x9d')];_0x393e6f[_0x1404('0x9e')]=_0x4bfbd2['uniqueid'];logger['info'](_0x1404('0x9f'),_0x393e6f[_0x1404('0x4f')],_0x393e6f[_0x1404('0x56')]);var _0x15bf40=this[_0x1404('0x3f')][_0x4bfbd2[_0x1404('0x99')]];this[_0x1404('0x3f')][_0x4bfbd2['linkedid']]=this[_0x1404('0x3f')][_0x4bfbd2['uniqueid']];this[_0x1404('0x3f')][_0x4bfbd2[_0x1404('0x4c')]]=_0x15bf40;}}else{_0x2d5e9c[_0x1404('0x52')]=_0x1404('0xa0')+_0x4bfbd2[_0x1404('0x94')][_0x1404('0xa1')]();logger[_0x1404('0x78')](_0x1404('0xa2'),_0x2d5e9c['name'],_0x2d5e9c[_0x1404('0x56')],_0x2d5e9c[_0x1404('0x52')]);}}}this[_0x1404('0x11')][_0x4bfbd2[_0x1404('0x4c')]]=_0x2d5e9c;this[_0x1404('0x45')](_0x2d5e9c,_0x1404('0x1f'));}}}catch(_0x8630fe){logger[_0x1404('0x3d')](_0x1404('0x90'),_0x4bfbd2[_0x1404('0x4c')],util[_0x1404('0x3e')](_0x8630fe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1404('0xb')][_0x1404('0x22')]=function(_0x519871){try{if(this['isNotNull'](_0x519871)){logger[_0x1404('0x49')](_0x1404('0xa3'),_0x519871['uniqueid'],util[_0x1404('0x3e')](_0x519871,{'showHidden':![],'depth':null}));this[_0x1404('0xa4')](_0x519871[_0x1404('0x4c')],_[_0x1404('0x7b')](_0x519871[_0x1404('0xa5')])[0x0],_0x519871['value']);if(this[_0x1404('0x3f')][_0x519871['uniqueid']]){var _0x308fef=_[_0x1404('0x87')](this['queueReports'][_0x519871[_0x1404('0x4c')]]);if(_0x308fef){if(this[_0x1404('0x67')](_0x519871['variable'])&&this[_0x1404('0x67')](_0x519871['variable'][_0x1404('0xa6')])){switch(_0x519871[_0x1404('0xa7')]){case _0x1404('0xa8'):_0x308fef[_0x1404('0x9a')]=![];_0x308fef['queuecallerexitAt']=null;break;case'TIMEOUT':_0x308fef['lastevent']='timeout';_0x308fef[_0x1404('0x9a')]=!![];_0x308fef['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x308fef['queuecallerleaveAt']=moment()[_0x1404('0x4d')](_0x1404('0x74'));logger[_0x1404('0x49')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x519871[_0x1404('0x4c')],util[_0x1404('0x3e')](_0x308fef,{'showHidden':![],'depth':null}));ami[_0x1404('0x47')](_0x1404('0xa9'),_0x308fef);break;default:_0x308fef[_0x1404('0x9a')]=!![];_0x308fef[_0x1404('0x92')]=moment()[_0x1404('0x4d')](_0x1404('0x74'));_0x308fef[_0x1404('0x88')]=moment()[_0x1404('0x4d')](_0x1404('0x74'));}_0x308fef[_0x1404('0x1b')]=![];_0x308fef['queuecallerabandonAt']=null;_0x308fef[_0x1404('0x52')]=_0x519871[_0x1404('0xa7')];this[_0x1404('0x11')][_0x519871[_0x1404('0x4c')]]=_0x308fef;this['emitVoiceQueueChannelRemove'](_0x308fef,_0x1404('0xaa'));}else if(this[_0x1404('0x67')](_0x519871['variable'])&&this['isNotNull'](_0x519871[_0x1404('0xa5')][_0x1404('0xab')])){if(!_0x308fef[_0x1404('0x1b')]){_0x308fef[_0x1404('0x9a')]=!![];_0x308fef[_0x1404('0x92')]=moment()[_0x1404('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x308fef[_0x1404('0x52')]=_0x1404('0xac');_0x308fef[_0x1404('0x88')]=moment()[_0x1404('0x4d')](_0x1404('0x74'));this['channels'][_0x519871[_0x1404('0x4c')]]=_0x308fef;}}logger[_0x1404('0x78')](_0x1404('0xad'),_0x519871[_0x1404('0x4c')],_0x308fef[_0x1404('0x4f')],_0x308fef[_0x1404('0x56')],_[_0x1404('0x7b')](_0x519871[_0x1404('0xa5')])[0x0],_0x519871['value']);_0x308fef['variables']=this[_0x1404('0x41')][_0x519871[_0x1404('0x4c')]];}}}}catch(_0x56f4cf){logger['error'](_0x1404('0xa3'),_0x519871[_0x1404('0x4c')],util[_0x1404('0x3e')](_0x56f4cf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1404('0xa4')]=function(_0x183e12,_0x5c6a44,_0xe399b4){var _0x1313e7=[_0x1404('0xae'),'rtpaudioqosbridged',_0x1404('0xaf'),_0x1404('0xb0'),_0x1404('0xb1'),'rtpaudioqoslossbridged',_0x1404('0xb2'),_0x1404('0xb3'),'sipcallid',_0x1404('0xb4'),_0x1404('0xb5'),'bridgepvtcallid',_0x1404('0xb6'),_0x1404('0xb7'),_0x1404('0xb8'),_0x1404('0xb9'),_0x1404('0x91'),_0x1404('0xba'),'memberrealtime'];if(!_[_0x1404('0x37')](_0x5c6a44)&&!_[_0x1404('0xbb')](_0x1313e7,_0x5c6a44)){if(_[_0x1404('0xbc')](this['variables'][_0x183e12])){this['variables'][_0x183e12]={};}this[_0x1404('0x41')][_0x183e12][_0x5c6a44]=_0xe399b4;}};VoiceQueueReport[_0x1404('0xb')][_0x1404('0xbd')]=function(_0x3f13c7){try{if(this[_0x1404('0x67')](_0x3f13c7)){logger[_0x1404('0x49')](_0x1404('0xbe'),_0x3f13c7[_0x1404('0x4c')],util['inspect'](_0x3f13c7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3f13c7[_0x1404('0x4c')]]){for(var _0x546e1f=0x0,_0x50b2e5={};_0x546e1f=0x0?moment(_0x2e6f27[_0xe8e1('0x16')])[_0xe8e1('0xc')](_0x2e6f27[_0xe8e1('0x15')],_0xe8e1('0x17')):null,'data1':_0xe8e1('0x18'),'data2':_0x2e6f27[_0xe8e1('0xf')],'data3':_0x2e6f27['exten'],'data4':_0x2e6f27[_0xe8e1('0x19')]||null,'role':_0xe8e1('0x1a'),'internal':_0x2e6f27[_0xe8e1('0xf')]?_[_0xe8e1('0x10')](_0x2e6f27['accountcode']):undefined,'uniqueid':_0x2e6f27[_0xe8e1('0x11')]},'log':_0xe8e1('0x6')});}; \ No newline at end of file +var _0x3c39=['lastAssignedTo','isNil','format','SIP/%s','interface','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','accountcode','toNumber','voiceDialReport','voice','membername','starttime','endtime','seconds','outbound','dialstring','agent','uniqueid','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c39,0x74));var _0x93c3=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x3c39[_0x1ae491];return _0x4958a5;};'use strict';var moment=require(_0x93c3('0x0'));var _=require(_0x93c3('0x1'));var util=require(_0x93c3('0x2'));var client=require(_0x93c3('0x3'));exports[_0x93c3('0x4')]=function(_0x1e70ba){var _0x25b2ce=_0x1e70ba[_0x93c3('0x5')]||_0x1e70ba['queuecallerexitAt'];return client[_0x93c3('0x6')](_0x93c3('0x7'),{'body':{'channel':'voice','membername':_0x1e70ba[_0x93c3('0x8')],'interface':_[_0x93c3('0x9')](_0x1e70ba['interface'])?util[_0x93c3('0xa')](_0x93c3('0xb'),_0x1e70ba[_0x93c3('0x8')]):_0x1e70ba[_0x93c3('0xc')],'type':'TALKING','enterAt':_0x1e70ba[_0x93c3('0xd')],'exitAt':_0x25b2ce,'duration':moment(_0x25b2ce)[_0x93c3('0xe')](_0x1e70ba[_0x93c3('0xd')],'seconds'),'data1':_0x93c3('0xf'),'data2':_0x1e70ba[_0x93c3('0x10')],'data3':_0x1e70ba[_0x93c3('0x11')],'data4':null,'data5':_0x1e70ba[_0x93c3('0x12')],'role':'agent','internal':_0x1e70ba[_0x93c3('0x13')]?_[_0x93c3('0x14')](_0x1e70ba[_0x93c3('0x13')]):undefined,'uniqueid':_0x1e70ba['uniqueid']},'log':_0x93c3('0x7')});};exports[_0x93c3('0x15')]=function(_0x269fad){return client[_0x93c3('0x6')](_0x93c3('0x7'),{'body':{'channel':_0x93c3('0x16'),'membername':_0x269fad[_0x93c3('0x17')],'interface':_0x269fad['interface'],'type':'TALKING','enterAt':_0x269fad[_0x93c3('0x18')],'exitAt':_0x269fad[_0x93c3('0x19')],'duration':moment(_0x269fad[_0x93c3('0x19')])[_0x93c3('0xe')](_0x269fad['starttime'],_0x93c3('0x1a'))>=0x0?moment(_0x269fad[_0x93c3('0x19')])['diff'](_0x269fad[_0x93c3('0x18')],_0x93c3('0x1a')):null,'data1':_0x93c3('0x1b'),'data2':_0x269fad[_0x93c3('0x13')],'data3':_0x269fad[_0x93c3('0x11')],'data4':_0x269fad[_0x93c3('0x1c')]||null,'role':_0x93c3('0x1d'),'internal':_0x269fad[_0x93c3('0x13')]?_[_0x93c3('0x14')](_0x269fad[_0x93c3('0x13')]):undefined,'uniqueid':_0x269fad[_0x93c3('0x1e')]},'log':_0x93c3('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index d135834..8e90230 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 _0x2837=['getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2837,0x12b));var _0x7283=function(_0x44355f,_0x2e1c97){_0x44355f=_0x44355f-0x0;var _0x58f132=_0x2837[_0x44355f];return _0x58f132;};'use strict';var client=require(_0x7283('0x0'));exports[_0x7283('0x1')]=function(){return client[_0x7283('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7283('0x3'),_0x7283('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x4a83=['stopRecordingOnTransfer','getSettings','Request','ShowSetting'];(function(_0x4d0648,_0x303520){var _0x46f3d8=function(_0x5a1b66){while(--_0x5a1b66){_0x4d0648['push'](_0x4d0648['shift']());}};_0x46f3d8(++_0x303520);}(_0x4a83,0x125));var _0x34a8=function(_0x38e834,_0xe29d41){_0x38e834=_0x38e834-0x0;var _0x1202f9=_0x4a83[_0x38e834];return _0x1202f9;};'use strict';var client=require('../client');exports[_0x34a8('0x0')]=function(){return client[_0x34a8('0x1')](_0x34a8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x34a8('0x3'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9f5161a..7f8bd0b 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 _0x01bb=['getTemplates','Request','name','GetTemplate','../client'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x01bb,0x171));var _0xb01b=function(_0xf9e15a,_0x69b956){_0xf9e15a=_0xf9e15a-0x0;var _0x1809e1=_0x01bb[_0xf9e15a];return _0x1809e1;};'use strict';var client=require(_0xb01b('0x0'));exports[_0xb01b('0x1')]=function(_0x3980b1){return function(_0x183d89){return client[_0xb01b('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xb01b('0x3'),'html']},'log':_0xb01b('0x4')});};}; \ No newline at end of file +var _0xbf04=['getTemplates','Request','GetTemplate','html','../client'];(function(_0x24b973,_0x4b732c){var _0xd420ce=function(_0x1fed66){while(--_0x1fed66){_0x24b973['push'](_0x24b973['shift']());}};_0xd420ce(++_0x4b732c);}(_0xbf04,0x108));var _0x4bf0=function(_0x1b28de,_0x466873){_0x1b28de=_0x1b28de-0x0;var _0x3fe976=_0xbf04[_0x1b28de];return _0x3fe976;};'use strict';var client=require(_0x4bf0('0x0'));exports[_0x4bf0('0x1')]=function(_0x530084){return function(_0x2bcb43){return client[_0x4bf0('0x2')](_0x4bf0('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x4bf0('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 21333b5..266f8ed 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 _0x4103=['data6','data7','GetTrigger','../client','Request','name','channel','status','AllConditions','field','value','Condition','Action','Actions','action','data1','data2','data3','data4','data5'];(function(_0x508c88,_0xe1b600){var _0x20a485=function(_0x916edb){while(--_0x916edb){_0x508c88['push'](_0x508c88['shift']());}};_0x20a485(++_0xe1b600);}(_0x4103,0xb7));var _0x3410=function(_0x1fec10,_0x4da311){_0x1fec10=_0x1fec10-0x0;var _0x55c66b=_0x4103[_0x1fec10];return _0x55c66b;};'use strict';var client=require(_0x3410('0x0'));exports['getTriggers']=function(_0x22acae){return function(_0xba9bd1){return client[_0x3410('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x3410('0x2'),_0x3410('0x3'),_0x3410('0x4')],'include':[{'model':'Condition','as':_0x3410('0x5'),'attributes':['id',_0x3410('0x6'),'operator',_0x3410('0x7')]},{'model':_0x3410('0x8'),'as':'AnyConditions','attributes':['id',_0x3410('0x6'),'operator','value']},{'model':_0x3410('0x9'),'as':_0x3410('0xa'),'attributes':['id',_0x3410('0xb'),_0x3410('0xc'),_0x3410('0xd'),_0x3410('0xe'),_0x3410('0xf'),_0x3410('0x10'),_0x3410('0x11'),_0x3410('0x12')]}]},'log':_0x3410('0x13')});};}; \ No newline at end of file +var _0xe29f=['../client','getTriggers','Request','GetTrigger','name','channel','AllConditions','operator','value','Condition','AnyConditions','field','Actions','action','data1','data2','data4','data5','data6','data7'];(function(_0x2d50be,_0x4e2d7c){var _0x2d3545=function(_0x51a02c){while(--_0x51a02c){_0x2d50be['push'](_0x2d50be['shift']());}};_0x2d3545(++_0x4e2d7c);}(_0xe29f,0x1b8));var _0xfe29=function(_0x499f50,_0x521969){_0x499f50=_0x499f50-0x0;var _0x3d35ab=_0xe29f[_0x499f50];return _0x3d35ab;};'use strict';var client=require(_0xfe29('0x0'));exports[_0xfe29('0x1')]=function(_0x4d06ea){return function(_0x2b2943){return client[_0xfe29('0x2')](_0xfe29('0x3'),{'options':{'raw':![],'attributes':['id',_0xfe29('0x4'),_0xfe29('0x5'),'status'],'include':[{'model':'Condition','as':_0xfe29('0x6'),'attributes':['id','field',_0xfe29('0x7'),_0xfe29('0x8')]},{'model':_0xfe29('0x9'),'as':_0xfe29('0xa'),'attributes':['id',_0xfe29('0xb'),_0xfe29('0x7'),_0xfe29('0x8')]},{'model':'Action','as':_0xfe29('0xc'),'attributes':['id',_0xfe29('0xd'),_0xfe29('0xe'),_0xfe29('0xf'),'data3',_0xfe29('0x10'),_0xfe29('0x11'),_0xfe29('0x12'),_0xfe29('0x13')]}]},'log':_0xfe29('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 22e0777..18012ad 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 _0xc452=['GetTrunk','name','registry','defaultuser','getTrunks','Request'];(function(_0x2ca76e,_0x1b68d0){var _0x5b7ce6=function(_0x1736d2){while(--_0x1736d2){_0x2ca76e['push'](_0x2ca76e['shift']());}};_0x5b7ce6(++_0x1b68d0);}(_0xc452,0x154));var _0x2c45=function(_0x429801,_0x1f0475){_0x429801=_0x429801-0x0;var _0x278236=_0xc452[_0x429801];return _0x278236;};'use strict';var client=require('../client');exports[_0x2c45('0x0')]=function(_0x5c28c5){return function(_0x1220e9){return client[_0x2c45('0x1')](_0x2c45('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2c45('0x3'),_0x2c45('0x4'),_0x2c45('0x5')]},'log':_0x2c45('0x2')});};}; \ No newline at end of file +var _0xb268=['defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x34c5af,_0x6f4342){var _0x15cdc3=function(_0x561ebb){while(--_0x561ebb){_0x34c5af['push'](_0x34c5af['shift']());}};_0x15cdc3(++_0x6f4342);}(_0xb268,0x114));var _0x8b26=function(_0x563bb3,_0x271a15){_0x563bb3=_0x563bb3-0x0;var _0x12fe96=_0xb268[_0x563bb3];return _0x12fe96;};'use strict';var client=require(_0x8b26('0x0'));exports[_0x8b26('0x1')]=function(_0x77e2ac){return function(_0x1074ef){return client[_0x8b26('0x2')](_0x8b26('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x8b26('0x4')]},'log':_0x8b26('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 774e5a5..ae91b0c 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x111dc7,_0x311f74){var _0x346fe7=function(_0x4228fa){while(--_0x4228fa){_0x111dc7['push'](_0x111dc7['shift']());}};_0x346fe7(++_0x311f74);}(_0x70e0,0x17b));var _0x070e=function(_0x2b04b4,_0x6a674b){_0x2b04b4=_0x2b04b4-0x0;var _0x24e8be=_0x70e0[_0x2b04b4];return _0x24e8be;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x321ce2,_0x5c32f7){var _0x828304=function(_0x175cff){while(--_0x175cff){_0x321ce2['push'](_0x321ce2['shift']());}};_0x828304(++_0x5c32f7);}(_0x34e8,0x12c));var _0x834e=function(_0x4cb70f,_0x24f098){_0x4cb70f=_0x4cb70f-0x0;var _0x9f6eea=_0x34e8[_0x4cb70f];return _0x9f6eea;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 5ae809e..4827deb 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 _0x3f41=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x3cd780,_0x27f724){var _0x3855aa=function(_0x342a37){while(--_0x342a37){_0x3cd780['push'](_0x3cd780['shift']());}};_0x3855aa(++_0x27f724);}(_0x3f41,0x1c7));var _0x13f4=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x3f41[_0x5e4563];return _0x8d1bf5;};'use strict';var client=require(_0x13f4('0x0'));exports['create']=function(_0x2874d6){return client[_0x13f4('0x1')](_0x13f4('0x2'),{'body':_0x2874d6,'log':_0x13f4('0x2')});};exports[_0x13f4('0x3')]=function(_0x1491c1,_0x1500fd,_0x7ebf28){return client[_0x13f4('0x1')](_0x13f4('0x4'),{'body':_0x1491c1,'options':{'where':{'uniqueid':_0x1500fd,'interface':_0x7ebf28,'agentcomplete':!![]}},'log':_0x13f4('0x4')});}; \ No newline at end of file +var _0x2f64=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x18ca9a,_0x56f911){var _0x54ab21=function(_0xd89c97){while(--_0xd89c97){_0x18ca9a['push'](_0x18ca9a['shift']());}};_0x54ab21(++_0x56f911);}(_0x2f64,0x166));var _0x42f6=function(_0x282320,_0x379ad6){_0x282320=_0x282320-0x0;var _0x271d54=_0x2f64[_0x282320];return _0x271d54;};'use strict';var client=require(_0x42f6('0x0'));exports[_0x42f6('0x1')]=function(_0x4617b1){return client[_0x42f6('0x2')](_0x42f6('0x3'),{'body':_0x4617b1,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x1e9b04,_0x3c9d2,_0x543d93){return client['Request'](_0x42f6('0x4'),{'body':_0x1e9b04,'options':{'where':{'uniqueid':_0x3c9d2,'interface':_0x543d93,'agentcomplete':!![]}},'log':_0x42f6('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index e70f020..9cc4216 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 _0x00d0=['Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00d0,0x179));var _0x000d=function(_0x467acf,_0x4eac3b){_0x467acf=_0x467acf-0x0;var _0x3075b2=_0x00d0[_0x467acf];return _0x3075b2;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require('../client');exports[_0x000d('0x0')]=function(_0x568b13){return client[_0x000d('0x1')](_0x000d('0x2'),{'body':_['merge'](_0x568b13,{'source':_0x568b13[_0x000d('0x3')],'destinationcontext':_0x568b13[_0x000d('0x4')],'callerid':_0x568b13[_0x000d('0x5')],'amaflags':_0x000d('0x6')}),'log':_0x000d('0x2')});};exports[_0x000d('0x7')]=function(){return function(){return client[_0x000d('0x1')](_0x000d('0x8'),{'options':{'where':{'type':[_0x000d('0x9')],'createdAt':{'$between':[moment()['startOf'](_0x000d('0xa'))[_0x000d('0xb')](_0x000d('0xc')),moment()[_0x000d('0xd')]('day')[_0x000d('0xb')](_0x000d('0xc'))]}},'attributes':['type',_0x000d('0xe'),_0x000d('0xf'),_0x000d('0x10')]},'log':_0x000d('0x11')});};}; \ No newline at end of file +var _0xe008=['create','Request','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','outbound','startOf','format','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe008,0x75));var _0x8e00=function(_0x21a1f4,_0x243c31){_0x21a1f4=_0x21a1f4-0x0;var _0x3375ba=_0xe008[_0x21a1f4];return _0x3375ba;};'use strict';var moment=require(_0x8e00('0x0'));var util=require('util');var _=require(_0x8e00('0x1'));var client=require(_0x8e00('0x2'));exports[_0x8e00('0x3')]=function(_0x1f9a2d){return client[_0x8e00('0x4')]('CreateVoiceCallReport',{'body':_['merge'](_0x1f9a2d,{'source':_0x1f9a2d[_0x8e00('0x5')],'destinationcontext':_0x1f9a2d[_0x8e00('0x6')],'callerid':_0x1f9a2d[_0x8e00('0x7')],'amaflags':_0x8e00('0x8')}),'log':_0x8e00('0x9')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x8e00('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x8e00('0xa')],'createdAt':{'$between':[moment()[_0x8e00('0xb')]('day')[_0x8e00('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x8e00('0xd')](_0x8e00('0xe'))[_0x8e00('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x8e00('0xf'),_0x8e00('0x10'),_0x8e00('0x11'),_0x8e00('0x12')]},'log':_0x8e00('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 34642ca..50d5349 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 _0x627b=['CreateVoiceDialReport'];(function(_0xab2a11,_0x1b34fb){var _0x5421cc=function(_0x179064){while(--_0x179064){_0xab2a11['push'](_0xab2a11['shift']());}};_0x5421cc(++_0x1b34fb);}(_0x627b,0xde));var _0xb627=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x627b[_0x40bffc];return _0x3007e9;};'use strict';var client=require('../client');exports['create']=function(_0x3b1e5c){return client['Request'](_0xb627('0x0'),{'body':_0x3b1e5c,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x8ddb=['CreateVoiceDialReport','create','Request'];(function(_0x2f559c,_0x109108){var _0xb6137c=function(_0x2aede5){while(--_0x2aede5){_0x2f559c['push'](_0x2f559c['shift']());}};_0xb6137c(++_0x109108);}(_0x8ddb,0x178));var _0xb8dd=function(_0x2b76c9,_0x46eaee){_0x2b76c9=_0x2b76c9-0x0;var _0x230b98=_0x8ddb[_0x2b76c9];return _0x230b98;};'use strict';var client=require('../client');exports[_0xb8dd('0x0')]=function(_0x4ea31d){return client[_0xb8dd('0x1')](_0xb8dd('0x2'),{'body':_0x4ea31d,'log':_0xb8dd('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index fc2b189..dd994ab 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 _0xe43c=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x23f8d2,_0x301fec){var _0x5d174b=function(_0x2c3c9e){while(--_0x2c3c9e){_0x23f8d2['push'](_0x23f8d2['shift']());}};_0x5d174b(++_0x301fec);}(_0xe43c,0x180));var _0xce43=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xe43c[_0xa148b7];return _0x51efd3;};'use strict';var client=require(_0xce43('0x0'));exports[_0xce43('0x1')]=function(){return function(){return client[_0xce43('0x2')](_0xce43('0x3'),{'options':{'raw':!![],'attributes':['id',_0xce43('0x4'),_0xce43('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xc902=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x2be076,_0xf7ce3){var _0x2a3f0f=function(_0x1492ab){while(--_0x1492ab){_0x2be076['push'](_0x2be076['shift']());}};_0x2a3f0f(++_0xf7ce3);}(_0xc902,0x15c));var _0x2c90=function(_0x2d575d,_0x35dbab){_0x2d575d=_0x2d575d-0x0;var _0x17d4a7=_0xc902[_0x2d575d];return _0x17d4a7;};'use strict';var client=require(_0x2c90('0x0'));exports[_0x2c90('0x1')]=function(){return function(){return client[_0x2c90('0x2')](_0x2c90('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2c90('0x4'),_0x2c90('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d9d94e6..07e5599 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 _0xfdf6=['dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','acwTimeout','autopause','monitor_format','type','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x1d11c9,_0x4c4656){var _0x1860bc=function(_0x2bb993){while(--_0x2bb993){_0x1d11c9['push'](_0x1d11c9['shift']());}};_0x1860bc(++_0x4c4656);}(_0xfdf6,0x1ac));var _0x6fdf=function(_0x9ff7f6,_0x2a90c1){_0x9ff7f6=_0x9ff7f6-0x0;var _0x18a39c=_0xfdf6[_0x9ff7f6];return _0x18a39c;};'use strict';var client=require('../client');exports[_0x6fdf('0x0')]=function(){return function(){return client[_0x6fdf('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name','acw',_0x6fdf('0x2'),_0x6fdf('0x3'),_0x6fdf('0x4'),_0x6fdf('0x5'),'dialActive','dialMethod','dialLimitChannel','dialLimitQueue',_0x6fdf('0x6'),'dialPredictiveOptimization',_0x6fdf('0x7'),_0x6fdf('0x8'),_0x6fdf('0x9'),_0x6fdf('0xa'),_0x6fdf('0xb'),'dialQueueOptions',_0x6fdf('0xc'),_0x6fdf('0xd'),_0x6fdf('0xe'),_0x6fdf('0xf'),_0x6fdf('0x10'),_0x6fdf('0x11'),_0x6fdf('0x12'),_0x6fdf('0x13'),'dialGlobalMaxRetry','dialTimezone',_0x6fdf('0x14'),_0x6fdf('0x15'),_0x6fdf('0x16'),'dialAMDActive',_0x6fdf('0x17'),'dialAMDGreeting',_0x6fdf('0x18'),'dialAMDTotalAnalysisTime',_0x6fdf('0x19'),_0x6fdf('0x1a'),_0x6fdf('0x1b'),_0x6fdf('0x1c'),_0x6fdf('0x1d'),_0x6fdf('0x1e'),_0x6fdf('0x1f'),_0x6fdf('0x20'),_0x6fdf('0x21'),_0x6fdf('0x22'),'dialAgiAfterHangupClient','dialQueueProject2',_0x6fdf('0x4'),'strategy',_0x6fdf('0x23'),'dialCutDigit',_0x6fdf('0x24'),_0x6fdf('0x25'),_0x6fdf('0x26'),_0x6fdf('0x27'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry',_0x6fdf('0x28'),'dialAgentRejectMaxRetry',_0x6fdf('0x29'),_0x6fdf('0x2a'),_0x6fdf('0x2b'),_0x6fdf('0x2c'),_0x6fdf('0x2d'),_0x6fdf('0x2e'),'callAdditionalPhoneAfterMin'],'include':[{'model':_0x6fdf('0x2f'),'as':_0x6fdf('0x2f'),'attributes':['id',_0x6fdf('0x30'),'callerid',_0x6fdf('0x31')]},{'model':_0x6fdf('0x32'),'as':_0x6fdf('0x33'),'attributes':['id',_0x6fdf('0x30')]},{'model':_0x6fdf('0x2f'),'as':_0x6fdf('0x34'),'attributes':['id','name','callerid',_0x6fdf('0x31')]},{'model':_0x6fdf('0x35'),'as':'Interval','attributes':['id',_0x6fdf('0x30')],'include':[{'model':_0x6fdf('0x35'),'as':_0x6fdf('0x36'),'attributes':['id',_0x6fdf('0x30'),_0x6fdf('0x37')]}]}]},'log':_0x6fdf('0x0')});};}; \ No newline at end of file +var _0xf9df=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x9b83c3,_0x307937){var _0xf071e4=function(_0x4a28c8){while(--_0x4a28c8){_0x9b83c3['push'](_0x9b83c3['shift']());}};_0xf071e4(++_0x307937);}(_0xf9df,0x18e));var _0xff9d=function(_0x3ae4d0,_0x484325){_0x3ae4d0=_0x3ae4d0-0x0;var _0x5b79c0=_0xf9df[_0x3ae4d0];return _0x5b79c0;};'use strict';var client=require(_0xff9d('0x0'));exports[_0xff9d('0x1')]=function(){return function(){return client[_0xff9d('0x2')](_0xff9d('0x3'),{'options':{'raw':![],'attributes':['id',_0xff9d('0x4'),_0xff9d('0x5'),'acwTimeout',_0xff9d('0x6'),_0xff9d('0x7'),'type',_0xff9d('0x8'),_0xff9d('0x9'),_0xff9d('0xa'),'dialLimitQueue',_0xff9d('0xb'),_0xff9d('0xc'),_0xff9d('0xd'),_0xff9d('0xe'),_0xff9d('0xf'),'dialOriginateCallerIdNumber',_0xff9d('0x10'),'dialQueueOptions',_0xff9d('0x11'),_0xff9d('0x12'),_0xff9d('0x13'),_0xff9d('0x14'),_0xff9d('0x15'),_0xff9d('0x16'),'dialNoAnswerMaxRetry',_0xff9d('0x17'),_0xff9d('0x18'),_0xff9d('0x19'),_0xff9d('0x1a'),_0xff9d('0x1b'),_0xff9d('0x1c'),_0xff9d('0x1d'),_0xff9d('0x1e'),_0xff9d('0x1f'),_0xff9d('0x20'),_0xff9d('0x21'),_0xff9d('0x22'),_0xff9d('0x23'),_0xff9d('0x24'),_0xff9d('0x25'),_0xff9d('0x26'),_0xff9d('0x27'),_0xff9d('0x28'),'dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2',_0xff9d('0x7'),_0xff9d('0x29'),_0xff9d('0x2a'),_0xff9d('0x2b'),_0xff9d('0x2c'),_0xff9d('0x2d'),_0xff9d('0x2e'),_0xff9d('0x2f'),_0xff9d('0x30'),'dialAbandonedRetryFrequency',_0xff9d('0x31'),_0xff9d('0x32'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0xff9d('0x33'),'dialPredictiveIntervalMaxThreshold',_0xff9d('0x34'),_0xff9d('0x35'),'dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin'],'include':[{'model':'Trunk','as':_0xff9d('0x36'),'attributes':['id',_0xff9d('0x4'),_0xff9d('0x37'),_0xff9d('0x38')]},{'model':_0xff9d('0x39'),'as':_0xff9d('0x3a'),'attributes':['id','name']},{'model':_0xff9d('0x36'),'as':_0xff9d('0x3b'),'attributes':['id','name','callerid',_0xff9d('0x38')]},{'model':_0xff9d('0x3c'),'as':_0xff9d('0x3c'),'attributes':['id',_0xff9d('0x4')],'include':[{'model':_0xff9d('0x3c'),'as':_0xff9d('0x3d'),'attributes':['id',_0xff9d('0x4'),'interval']}]}]},'log':_0xff9d('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f97a1d1..8948fe6 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(_0x47ab73,_0x2df85f){var _0xc14991=function(_0x294803){while(--_0x294803){_0x47ab73['push'](_0x47ab73['shift']());}};_0xc14991(++_0x2df85f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x4c1a77,_0x3236c8){var _0x2a05be=function(_0xc6cebe){while(--_0xc6cebe){_0x4c1a77['push'](_0x4c1a77['shift']());}};_0x2a05be(++_0x3236c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 b140975..e2422f5 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 _0x3970=['Request'];(function(_0x47257e,_0x37e385){var _0x10b3c5=function(_0xe42c14){while(--_0xe42c14){_0x47257e['push'](_0x47257e['shift']());}};_0x10b3c5(++_0x37e385);}(_0x3970,0xac));var _0x0397=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0x3970[_0x1a8bbc];return _0x212fc2;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x836537){return function(){return client[_0x0397('0x0')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x836537,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xd76f=['../client','getVoiceQueueRtPauses'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd76f,0xe6));var _0xfd76=function(_0x5c6ceb,_0x4ed099){_0x5c6ceb=_0x5c6ceb-0x0;var _0x28821b=_0xd76f[_0x5c6ceb];return _0x28821b;};'use strict';var client=require(_0xfd76('0x0'));exports[_0xfd76('0x1')]=function(_0x405ae6){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x405ae6,'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 71d0e98..89e0e06 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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x45f96b,_0x227c54){var _0x1b285c=function(_0x2caee3){while(--_0x2caee3){_0x45f96b['push'](_0x45f96b['shift']());}};_0x1b285c(++_0x227c54);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1859b4,_0x3fb807){var _0x1056ca=function(_0x477744){while(--_0x477744){_0x1859b4['push'](_0x1859b4['shift']());}};_0x1056ca(++_0x3fb807);}(_0x7a54,0x106));var _0x47a5=function(_0x339f8f,_0x32d23d){_0x339f8f=_0x339f8f-0x0;var _0x341ac8=_0x7a54[_0x339f8f];return _0x341ac8;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 782023f..f5027b5 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 _0x1af8=['blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension'];(function(_0x3f06da,_0x2767c3){var _0x338c5a=function(_0x373513){while(--_0x373513){_0x3f06da['push'](_0x3f06da['shift']());}};_0x338c5a(++_0x2767c3);}(_0x1af8,0xbb));var _0x81af=function(_0x231d95,_0xeb8764){_0x231d95=_0x231d95-0x0;var _0x3da43a=_0x1af8[_0x231d95];return _0x3da43a;};'use strict';var client=require(_0x81af('0x0'));exports[_0x81af('0x1')]={};exports[_0x81af('0x2')]=function(_0x583d08){return client[_0x81af('0x3')](_0x81af('0x4'),{'body':{'result':_0x583d08[_0x81af('0x5')],'transfererchannel':_0x583d08[_0x81af('0x6')],'transferercalleridnum':_0x583d08[_0x81af('0x7')],'transferercalleridname':_0x583d08['transferercalleridname'],'transfererconnectedlinenum':_0x583d08[_0x81af('0x8')],'transfererconnectedlinename':_0x583d08[_0x81af('0x9')],'transfereraccountcode':_0x583d08['transfereraccountcode'],'transferercontext':_0x583d08['transferercontext'],'transfererexten':_0x583d08[_0x81af('0xa')],'transfererlinkedid':_0x583d08[_0x81af('0xb')],'transfereechannel':_0x583d08[_0x81af('0xc')],'transfereecalleridnum':_0x583d08[_0x81af('0xd')],'transfereecalleridname':_0x583d08[_0x81af('0xe')],'transfereeconnectedlinenum':_0x583d08[_0x81af('0xf')],'transfereeconnectedlinename':_0x583d08['transfereeconnectedlinename'],'transfereeaccountcode':_0x583d08[_0x81af('0x10')],'transfereecontext':_0x583d08[_0x81af('0x11')],'transfereeexten':_0x583d08[_0x81af('0x12')],'transfereelinkedid':_0x583d08[_0x81af('0x13')],'isexternal':_0x583d08[_0x81af('0x14')],'context':_0x583d08[_0x81af('0x15')],'extension':_0x583d08[_0x81af('0x16')],'type':_0x81af('0x17')},'log':_0x81af('0x4')});};exports[_0x81af('0x18')]=function(_0x28dae1){return client['Request'](_0x81af('0x4'),{'body':{'result':_0x28dae1[_0x81af('0x5')],'transfererchannel':_0x28dae1[_0x81af('0x19')],'transferercalleridnum':_0x28dae1[_0x81af('0x1a')],'transferercalleridname':_0x28dae1['origtransferercalleridname'],'transfererconnectedlinenum':_0x28dae1[_0x81af('0x1b')],'transfererconnectedlinename':_0x28dae1[_0x81af('0x1c')],'transfereraccountcode':_0x28dae1[_0x81af('0x1d')],'transferercontext':_0x28dae1[_0x81af('0x1e')],'transfererexten':_0x28dae1[_0x81af('0x1f')],'transfererlinkedid':_0x28dae1['origtransfererlinkedid'],'transfereechannel':_0x28dae1[_0x81af('0x20')],'transfereecalleridnum':_0x28dae1[_0x81af('0x21')],'transfereecalleridname':_0x28dae1[_0x81af('0x22')],'transfereeconnectedlinenum':_0x28dae1[_0x81af('0x23')],'transfereeconnectedlinename':_0x28dae1[_0x81af('0x24')],'transfereeaccountcode':_0x28dae1[_0x81af('0x25')],'transfereecontext':_0x28dae1[_0x81af('0x26')],'transfereeexten':_0x28dae1['transfertargetexten'],'transfereelinkedid':_0x28dae1[_0x81af('0x27')],'isexternal':_0x28dae1['isexternal'],'context':_0x28dae1['origtransferercontext'],'extension':_0x28dae1[_0x81af('0x28')],'type':_0x81af('0x29')},'log':_0x81af('0x4')});}; \ No newline at end of file +var _0xcbc7=['transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','Request','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','origtransferercontext','origtransfererexten','attended','../client','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname'];(function(_0x2640e4,_0x428a4e){var _0x25018e=function(_0x33f3f8){while(--_0x33f3f8){_0x2640e4['push'](_0x2640e4['shift']());}};_0x25018e(++_0x428a4e);}(_0xcbc7,0x1ae));var _0x7cbc=function(_0x4f9522,_0x399e9f){_0x4f9522=_0x4f9522-0x0;var _0x5a89a7=_0xcbc7[_0x4f9522];return _0x5a89a7;};'use strict';var client=require(_0x7cbc('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x9d58ba){return client['Request'](_0x7cbc('0x1'),{'body':{'result':_0x9d58ba[_0x7cbc('0x2')],'transfererchannel':_0x9d58ba[_0x7cbc('0x3')],'transferercalleridnum':_0x9d58ba[_0x7cbc('0x4')],'transferercalleridname':_0x9d58ba[_0x7cbc('0x5')],'transfererconnectedlinenum':_0x9d58ba['transfererconnectedlinenum'],'transfererconnectedlinename':_0x9d58ba[_0x7cbc('0x6')],'transfereraccountcode':_0x9d58ba[_0x7cbc('0x7')],'transferercontext':_0x9d58ba['transferercontext'],'transfererexten':_0x9d58ba['transfererexten'],'transfererlinkedid':_0x9d58ba[_0x7cbc('0x8')],'transfereechannel':_0x9d58ba[_0x7cbc('0x9')],'transfereecalleridnum':_0x9d58ba[_0x7cbc('0xa')],'transfereecalleridname':_0x9d58ba[_0x7cbc('0xb')],'transfereeconnectedlinenum':_0x9d58ba[_0x7cbc('0xc')],'transfereeconnectedlinename':_0x9d58ba[_0x7cbc('0xd')],'transfereeaccountcode':_0x9d58ba[_0x7cbc('0xe')],'transfereecontext':_0x9d58ba['transfereecontext'],'transfereeexten':_0x9d58ba[_0x7cbc('0xf')],'transfereelinkedid':_0x9d58ba[_0x7cbc('0x10')],'isexternal':_0x9d58ba[_0x7cbc('0x11')],'context':_0x9d58ba[_0x7cbc('0x12')],'extension':_0x9d58ba[_0x7cbc('0x13')],'type':'blind'},'log':_0x7cbc('0x1')});};exports[_0x7cbc('0x14')]=function(_0x1b6e5c){return client[_0x7cbc('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x1b6e5c[_0x7cbc('0x2')],'transfererchannel':_0x1b6e5c[_0x7cbc('0x16')],'transferercalleridnum':_0x1b6e5c['origtransferercalleridnum'],'transferercalleridname':_0x1b6e5c['origtransferercalleridname'],'transfererconnectedlinenum':_0x1b6e5c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1b6e5c[_0x7cbc('0x17')],'transfereraccountcode':_0x1b6e5c[_0x7cbc('0x18')],'transferercontext':_0x1b6e5c['secondtransferercontext'],'transfererexten':_0x1b6e5c[_0x7cbc('0x19')],'transfererlinkedid':_0x1b6e5c[_0x7cbc('0x1a')],'transfereechannel':_0x1b6e5c[_0x7cbc('0x1b')],'transfereecalleridnum':_0x1b6e5c[_0x7cbc('0x1c')],'transfereecalleridname':_0x1b6e5c['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1b6e5c[_0x7cbc('0x1d')],'transfereeconnectedlinename':_0x1b6e5c[_0x7cbc('0x1e')],'transfereeaccountcode':_0x1b6e5c['transfertargetaccountcode'],'transfereecontext':_0x1b6e5c['transfertargetcontext'],'transfereeexten':_0x1b6e5c['transfertargetexten'],'transfereelinkedid':_0x1b6e5c['transfertargetlinkedid'],'isexternal':_0x1b6e5c[_0x7cbc('0x11')],'context':_0x1b6e5c[_0x7cbc('0x1f')],'extension':_0x1b6e5c[_0x7cbc('0x20')],'type':_0x7cbc('0x21')},'log':_0x7cbc('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1ed54e9..d7f0926 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 _0xfc17=['uniqueid','channel','%s.%s','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channels','resolve','StopMixMonitor','destinationchannel','filename','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','exten','context','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','faxAccounts','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','then','message','catch','error','isConnected','Action','content','voiceQueues','hasOwnProperty','name','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','omit','undefined','voicechannel','length','map','find'];(function(_0x13d5bc,_0x3fce3c){var _0x4b8a40=function(_0xe3ef3a){while(--_0xe3ef3a){_0x13d5bc['push'](_0x13d5bc['shift']());}};_0x4b8a40(++_0x3fce3c);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x2604b9,_0xbb6ea5){_0x2604b9=_0x2604b9-0x0;var _0x51433b=_0xfc17[_0x2604b9];return _0x51433b;};'use strict';var _=require(_0x7fc1('0x0'));var util=require(_0x7fc1('0x1'));var jayson=require(_0x7fc1('0x2'));var schema=require(_0x7fc1('0x3'));var BPromise=require('bluebird');var moment=require(_0x7fc1('0x4'));var config=require(_0x7fc1('0x5'));var properties=require(_0x7fc1('0x6'));var ami=require(_0x7fc1('0x7'));exports[_0x7fc1('0x8')]=function(_0x4100a9,_0x5de7fa,_0x30f5f8){return new BPromise(function(_0x1867ea,_0x2267ea){var _0xf0d3fa={'QueuePause':function(_0x24c678){return new Promise(function(_0x1b7106,_0x3b631b){var _0x53a3ba=util[_0x7fc1('0x9')](_0x7fc1('0xa'),_0x7fc1('0xb'),_0x24c678['name']);if(_0x4100a9[_0x7fc1('0xc')]&&_0x4100a9['timers'][_0x53a3ba]&&_0x4100a9['timers'][_0x53a3ba][_0x7fc1('0xd')]){_0x4100a9[_0x7fc1('0xc')][_0x53a3ba][_0x7fc1('0xe')]();}if(_0x4100a9[_0x7fc1('0xf')][_0x53a3ba]){_0x4100a9[_0x7fc1('0xf')][_0x53a3ba][_0x7fc1('0x10')]({'statePause':_0x24c678[_0x7fc1('0x11')]?!![]:![]});}_0x1b7106({'code':0xc8,'message':_0x7fc1('0x12')});});},'Reload':function(_0x902325){var _0x3e4fea=this;return new Promise(function(_0x12ddce,_0x3c328c){if(ami['isConnected']()==![]){return _0x3c328c(_0x3e4fea['error'](0x1f4,[config[_0x7fc1('0x13')]['ip'],config[_0x7fc1('0x13')][_0x7fc1('0x14')],_0x7fc1('0x15')][_0x7fc1('0x16')]('\x20')));}_0x902325=_[_0x7fc1('0x17')](_0x902325,_[_0x7fc1('0x18')](properties[_0x7fc1('0x19')]));_0x902325[_0x7fc1('0x1a')]=_0x7fc1('0x1b');return ami['Action'](_0x902325)[_0x7fc1('0x1c')](function(_0x5e89b1){_0x12ddce({'code':0xc8,'message':_0x5e89b1[_0x7fc1('0x1d')]});})[_0x7fc1('0x1e')](function(_0x535ae1){_0x3c328c(_0x3e4fea[_0x7fc1('0x1f')](0x1f5,_0x535ae1[_0x7fc1('0x1d')]));});});},'Command':function(_0x58c20a){var _0x25d384=this;return new Promise(function(_0x23f3cd,_0x1158f0){if(ami[_0x7fc1('0x20')]()==![]){return _0x1158f0(_0x25d384[_0x7fc1('0x1f')](0x1f4,[config[_0x7fc1('0x13')]['ip'],config[_0x7fc1('0x13')][_0x7fc1('0x14')],_0x7fc1('0x15')][_0x7fc1('0x16')]('\x20')));}_0x58c20a=_['pick'](_0x58c20a,'command');_0x58c20a[_0x7fc1('0x1a')]='Command';return ami[_0x7fc1('0x21')](_0x58c20a)[_0x7fc1('0x1c')](function(_0x253ae9){_0x23f3cd({'code':0xc8,'message':_0x253ae9[_0x7fc1('0x22')]});})['catch'](function(_0x38b5b5){_0x1158f0(_0x25d384[_0x7fc1('0x1f')](0x1f5,_0x38b5b5[_0x7fc1('0x1d')]));});});},'VoiceQueues':function(_0x4d6c46){return new Promise(function(_0x190204,_0x252b18){var _0x5ddc11=[];for(var _0x4b24d6 in _0x4100a9[_0x7fc1('0x23')]){if(_0x4100a9[_0x7fc1('0x23')][_0x7fc1('0x24')](_0x4b24d6)){var _0x2ae7db=_0x4100a9['voiceQueues'][_0x4b24d6];var _0x1d7b77={'id':_0x2ae7db['id'],'name':_0x2ae7db[_0x7fc1('0x25')],'strategy':_0x2ae7db[_0x7fc1('0x26')],'answered':_0x2ae7db[_0x7fc1('0x27')],'available':_0x2ae7db['available'],'loggedIn':_0x2ae7db[_0x7fc1('0x28')],'pTalking':_0x2ae7db['pTalking'],'sumBillable':_0x2ae7db[_0x7fc1('0x29')],'sumDuration':_0x2ae7db[_0x7fc1('0x2a')],'sumHoldTime':_0x2ae7db[_0x7fc1('0x2b')]||0x0,'talking':_0x2ae7db[_0x7fc1('0x2c')],'total':_0x2ae7db[_0x7fc1('0x2d')],'type':_0x2ae7db['type'],'unmanaged':_0x2ae7db[_0x7fc1('0x2e')],'abandoned':_0x2ae7db['abandoned'],'waiting':_0x2ae7db['waiting'],'loggedInDb':_0x2ae7db[_0x7fc1('0x2f')]};if(_0x2ae7db[_0x7fc1('0x30')]===_0x7fc1('0x31')){_0x1d7b77[_0x7fc1('0x32')]=_0x2ae7db[_0x7fc1('0x32')];_0x1d7b77[_0x7fc1('0x33')]=_0x2ae7db[_0x7fc1('0x33')];_0x1d7b77[_0x7fc1('0x34')]=_0x2ae7db[_0x7fc1('0x34')];_0x1d7b77[_0x7fc1('0x35')]=_0x2ae7db[_0x7fc1('0x35')];_0x1d7b77[_0x7fc1('0x36')]=_0x2ae7db[_0x7fc1('0x36')];_0x1d7b77[_0x7fc1('0x37')]=_0x2ae7db[_0x7fc1('0x37')];_0x1d7b77[_0x7fc1('0x38')]=_0x2ae7db['temp'];_0x1d7b77[_0x7fc1('0x39')]=_0x2ae7db[_0x7fc1('0x39')];_0x1d7b77[_0x7fc1('0x3a')]=_0x2ae7db[_0x7fc1('0x3a')];_0x1d7b77[_0x7fc1('0x3b')]=_0x2ae7db[_0x7fc1('0x3b')];_0x1d7b77['outboundBusyCallsDay']=_0x2ae7db[_0x7fc1('0x3c')];_0x1d7b77[_0x7fc1('0x3d')]=_0x2ae7db['outboundCongestionCallsDay'];_0x1d7b77[_0x7fc1('0x3e')]=_0x2ae7db[_0x7fc1('0x3e')];_0x1d7b77[_0x7fc1('0x3f')]=_0x2ae7db[_0x7fc1('0x3f')];_0x1d7b77[_0x7fc1('0x40')]=_0x2ae7db['outboundDropCallsDayTimeout'];_0x1d7b77['outboundNoAnswerCallsDay']=_0x2ae7db[_0x7fc1('0x41')];_0x1d7b77[_0x7fc1('0x42')]=_0x2ae7db[_0x7fc1('0x42')];_0x1d7b77[_0x7fc1('0x43')]=_0x2ae7db[_0x7fc1('0x43')];_0x1d7b77[_0x7fc1('0x44')]=_0x2ae7db[_0x7fc1('0x44')];_0x1d7b77[_0x7fc1('0x45')]=_0x2ae7db['outboundRejectCallsDay'];_0x1d7b77[_0x7fc1('0x46')]=_0x2ae7db[_0x7fc1('0x46')];_0x1d7b77['predictiveIntervalAnsweredCalls']=_0x2ae7db[_0x7fc1('0x47')];_0x1d7b77[_0x7fc1('0x48')]=_0x2ae7db[_0x7fc1('0x48')];_0x1d7b77['predictiveIntervalAvgTalktime']=_0x2ae7db['predictiveIntervalAvgTalktime'];_0x1d7b77[_0x7fc1('0x49')]=_0x2ae7db[_0x7fc1('0x49')];_0x1d7b77[_0x7fc1('0x4a')]=_0x2ae7db['predictiveIntervalDroppedCallsTimeout'];_0x1d7b77['predictiveIntervalErlangCalls']=_0x2ae7db['predictiveIntervalErlangCalls'];_0x1d7b77[_0x7fc1('0x4b')]=_0x2ae7db[_0x7fc1('0x4b')];_0x1d7b77[_0x7fc1('0x4c')]=_0x2ae7db[_0x7fc1('0x4c')];_0x1d7b77['predictiveIntervalMultiplicativeFactor']=_0x2ae7db['predictiveIntervalMultiplicativeFactor'];_0x1d7b77[_0x7fc1('0x4d')]=_0x2ae7db[_0x7fc1('0x4d')];_0x1d7b77[_0x7fc1('0x4e')]=_0x2ae7db['predictiveIntervalAvailable'];_0x1d7b77['predictiveIntervalTotalCalls']=_0x2ae7db['predictiveIntervalTotalCalls'];_0x1d7b77['message']=_0x2ae7db['message'];_0x1d7b77[_0x7fc1('0x4f')]=_0x2ae7db['originated'];_0x1d7b77[_0x7fc1('0x50')]=_0x2ae7db[_0x7fc1('0x50')];_0x1d7b77['erlangCallToSecond']=_0x2ae7db[_0x7fc1('0x51')];_0x1d7b77[_0x7fc1('0x52')]=_0x2ae7db[_0x7fc1('0x52')];_0x1d7b77[_0x7fc1('0x53')]=_0x2ae7db['erlangBusyFactor'];_0x1d7b77[_0x7fc1('0x54')]=_0x2ae7db['startPredictive'];_0x1d7b77[_0x7fc1('0x55')]=_0x2ae7db[_0x7fc1('0x55')];}if(_0x2ae7db[_0x7fc1('0x56')]){_0x1d7b77[_0x7fc1('0x56')]={'id':_0x2ae7db['Trunk']['id'],'name':_0x2ae7db[_0x7fc1('0x56')][_0x7fc1('0x25')],'active':_0x2ae7db['Trunk'][_0x7fc1('0x57')],'callerid':_0x2ae7db[_0x7fc1('0x56')]['callerid']};}if(_0x2ae7db[_0x7fc1('0x58')]){_0x1d7b77[_0x7fc1('0x58')]={'id':_0x2ae7db['Interval']['id'],'name':_0x2ae7db[_0x7fc1('0x58')][_0x7fc1('0x25')]};}_0x5ddc11[_0x7fc1('0x59')](_0x1d7b77);}}_0x190204({'count':_0x5ddc11['length'],'rows':_0x5ddc11});});},'UpdateVoiceQueue':function(_0x3ae3b5){return new Promise(function(_0x750284,_0x419f95){var _0x431d84=_['find'](_0x4100a9['voiceQueues'],{'id':parseInt(_0x3ae3b5['id'])});var _0x15edd4=_[_0x7fc1('0x5a')](_0x3ae3b5,['id']);if(_0x431d84){for(var _0x158181 in _0x15edd4){if(typeof _0x15edd4[_0x158181]!==_0x7fc1('0x5b')&&typeof _0x431d84[_0x158181]!==_0x7fc1('0x5b')){_0x431d84[_0x158181]=_0x15edd4[_0x158181];}}_0x750284(_0x431d84);}else{_0x419f95();}});},'VoiceChannels':function(_0x27b1b7){return new Promise(function(_0x3e936d,_0x40b356){var _0x419ea1=_['values'](_0x4100a9['channels']);_0x3e936d({'count':_0x419ea1['length'],'rows':_0x419ea1});});},'VoiceChannelMixMonitor':function(_0xb0541a){var _0x3bfa32=this;return new Promise(function(_0x45e61a,_0x8d1c10){if(ami['isConnected']()==![]){return _0x8d1c10(_0x3bfa32[_0x7fc1('0x1f')](0x1f4,[config[_0x7fc1('0x13')]['ip'],config[_0x7fc1('0x13')][_0x7fc1('0x14')],'ami\x20disconnected'][_0x7fc1('0x16')]('\x20')));}var _0x5ef33=schema(properties[_0x7fc1('0x5c')])[_0x7fc1('0x3')](_0xb0541a);if(_0x5ef33[_0x7fc1('0x5d')]>0x0){return _0x8d1c10(_0x3bfa32[_0x7fc1('0x1f')](0x1f4,_[_0x7fc1('0x5e')](_0x5ef33,'message')[_0x7fc1('0x16')](',\x20')));}var _0x4daad0=_[_0x7fc1('0x5f')](_0x4100a9['channels'],{'uniqueid':_0xb0541a[_0x7fc1('0x60')]});if(_0x4daad0&&_0x4daad0[_0x7fc1('0x61')]){var _0x4dbd61=util[_0x7fc1('0x9')](_0x7fc1('0x62'),_0xb0541a['filename']||_0xb0541a[_0x7fc1('0x60')],_0xb0541a[_0x7fc1('0x9')]||_0x7fc1('0x63'));return ami[_0x7fc1('0x21')]({'action':'MixMonitor','channel':_0x4daad0['channel'],'file':_0x4dbd61,'options':_0x7fc1('0x64')})['then'](function(_0x802d83){var _0x25258d=_[_0x7fc1('0x5f')](_0x4daad0[_0x7fc1('0x65')],{'filename':_0x7fc1('0x66')+_0x4dbd61[_0x7fc1('0x67')]()});if(_[_0x7fc1('0x68')](_0x25258d)){_0x4daad0[_0x7fc1('0x65')][_0x7fc1('0x59')]({'filename':'/var/spool/asterisk/monitor/'+_0x4dbd61['toLowerCase'](),'createdAt':moment()[_0x7fc1('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x802d83[_0x7fc1('0x69')],'status':'rec'});}else{_0x25258d[_0x7fc1('0x69')]=_0x802d83[_0x7fc1('0x69')];_0x25258d[_0x7fc1('0x6a')]=_0x7fc1('0x6b');}_0x45e61a({'code':0xc8,'message':[_0xb0541a[_0x7fc1('0x60')],_0x7fc1('0x6c'),_0x802d83[_0x7fc1('0x69')]][_0x7fc1('0x16')]('\x20'),'mixmonitorid':_0x802d83['mixmonitorid']});})[_0x7fc1('0x1e')](function(_0x5987af){_0x8d1c10(_0x3bfa32[_0x7fc1('0x1f')](0x1f5,[_0xb0541a['uniqueid'],_0x5987af[_0x7fc1('0x1d')]['toLowerCase']()][_0x7fc1('0x16')]('\x20')));});}else{return _0x8d1c10(_0x3bfa32[_0x7fc1('0x1f')](0x1f5,_0x7fc1('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x1d471f){var _0x559171=this;return new Promise(function(_0x2c6934,_0x58a174){if(ami[_0x7fc1('0x20')]()==![]){return _0x58a174(_0x559171[_0x7fc1('0x1f')](0x1f4,[config[_0x7fc1('0x13')]['ip'],config[_0x7fc1('0x13')][_0x7fc1('0x14')],_0x7fc1('0x15')]['join']('\x20')));}var _0x4e9b22=schema(properties['voicechannel'])[_0x7fc1('0x3')](_0x1d471f);if(_0x4e9b22[_0x7fc1('0x5d')]>0x0){return _0x58a174(_0x559171[_0x7fc1('0x1f')](0x1f4,_[_0x7fc1('0x5e')](_0x4e9b22,_0x7fc1('0x1d'))[_0x7fc1('0x16')](',\x20')));}var _0x1d2659=_[_0x7fc1('0x5f')](_0x4100a9[_0x7fc1('0x6e')],{'uniqueid':_0x1d471f['uniqueid']});if(_0x1d2659){return BPromise[_0x7fc1('0x6f')]()[_0x7fc1('0x1c')](function(){if(_0x1d2659[_0x7fc1('0x61')]){return ami[_0x7fc1('0x21')]({'action':_0x7fc1('0x70'),'channel':_0x1d2659['channel'],'mixmonitorid':_0x1d471f['mixmonitorid']})[_0x7fc1('0x1e')](function(_0x3eccd4){});}})[_0x7fc1('0x1c')](function(){if(_0x1d2659[_0x7fc1('0x71')]){return ami[_0x7fc1('0x21')]({'action':_0x7fc1('0x70'),'channel':_0x1d2659['destinationchannel'],'mixmonitorid':_0x1d471f[_0x7fc1('0x69')]})[_0x7fc1('0x1e')](function(_0x1df318){});}})[_0x7fc1('0x1c')](function(_0x3d070f){var _0x15e8ae=_[_0x7fc1('0x5f')](_0x1d2659[_0x7fc1('0x65')],{'mixmonitorid':_0x1d471f['mixmonitorid']});if(_0x15e8ae){_0x15e8ae[_0x7fc1('0x6a')]='stop';}})[_0x7fc1('0x1c')](function(){var _0x3314f9=util[_0x7fc1('0x9')](_0x7fc1('0x62'),_0x1d471f[_0x7fc1('0x72')]||_0x1d471f['uniqueid'],_0x1d471f[_0x7fc1('0x9')]||_0x7fc1('0x63'));var _0xf7f369=_['find'](_0x1d2659[_0x7fc1('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x3314f9[_0x7fc1('0x67')]()});if(_0xf7f369){_0xf7f369[_0x7fc1('0x6a')]='stop';}})[_0x7fc1('0x1c')](function(){_0x2c6934({'code':0xc8,'message':[_0x1d471f[_0x7fc1('0x60')],_0x7fc1('0x73')][_0x7fc1('0x16')]('\x20')});})['catch'](function(_0x136aa8){_0x58a174(_0x559171[_0x7fc1('0x1f')](0x1f5,[_0x1d471f[_0x7fc1('0x60')],_0x136aa8[_0x7fc1('0x1d')][_0x7fc1('0x67')]()][_0x7fc1('0x16')]('\x20')));});}else{return _0x58a174(_0x559171[_0x7fc1('0x1f')](0x1f5,_0x7fc1('0x6d')));}});},'VoiceQueuesChannels':function(_0x27e174){return new Promise(function(_0x237b75,_0xc7629c){var _0x135662=_[_0x7fc1('0x74')](_0x4100a9[_0x7fc1('0x75')]);_0x237b75({'count':_0x135662[_0x7fc1('0x5d')],'rows':_0x135662});});},'VoiceQueuesChannel':function(_0x4a8c11){var _0x19e649=this;return new Promise(function(_0x85e5fc,_0x43d0a2){var _0x12ac89=schema(properties[_0x7fc1('0x76')])[_0x7fc1('0x3')](_0x4a8c11);if(_0x12ac89['length']>0x0){return _0x43d0a2(_0x19e649['error'](0x1f4,_[_0x7fc1('0x5e')](_0x12ac89,_0x7fc1('0x1d'))[_0x7fc1('0x16')](',\x20')));}var _0x3eacc0=_[_0x7fc1('0x5f')](_0x4100a9[_0x7fc1('0x75')],{'uniqueid':_0x4a8c11['uniqueid']});if(_0x3eacc0){_0x85e5fc(_0x3eacc0);}else{return _0x43d0a2(_0x19e649[_0x7fc1('0x1f')](0x1f5,_0x7fc1('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x4ebff7){var _0x13e001=this;return new Promise(function(_0x4be325,_0x17b925){if(ami[_0x7fc1('0x20')]()==![]){return _0x17b925(_0x13e001['error'](0x1f4,[config['asterisk']['ip'],config[_0x7fc1('0x13')][_0x7fc1('0x14')],_0x7fc1('0x15')][_0x7fc1('0x16')]('\x20')));}var _0x3da92d=schema(properties[_0x7fc1('0x77')])[_0x7fc1('0x3')](_0x4ebff7);if(_0x3da92d['length']>0x0){return _0x17b925(_0x13e001[_0x7fc1('0x1f')](0x1f4,_[_0x7fc1('0x5e')](_0x3da92d,_0x7fc1('0x1d'))[_0x7fc1('0x16')](',\x20')));}var _0x151cba=_[_0x7fc1('0x5f')](_0x4100a9['queueChannels'],{'uniqueid':_0x4ebff7[_0x7fc1('0x60')]});if(_0x151cba&&_0x151cba[_0x7fc1('0x61')]){return ami[_0x7fc1('0x21')]({'action':'Hangup','channel':_0x151cba[_0x7fc1('0x61')]})['then'](function(_0x520045){_0x4be325({'code':0xc8,'message':[_0x4ebff7['uniqueid'],_0x520045[_0x7fc1('0x1d')][_0x7fc1('0x67')]()][_0x7fc1('0x16')]('\x20')});})[_0x7fc1('0x1e')](function(_0x1a33b9){_0x17b925(_0x13e001[_0x7fc1('0x1f')](0x1f5,[_0x4ebff7['uniqueid'],_0x1a33b9[_0x7fc1('0x1d')]['toLowerCase']()]['join']('\x20')));});}else{return _0x17b925(_0x13e001['error'](0x1f5,_0x7fc1('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0xfb6ebd){var _0x3c0c0c=this;return new Promise(function(_0x51cd66,_0x128c77){if(ami[_0x7fc1('0x20')]()==![]){return _0x128c77(_0x3c0c0c[_0x7fc1('0x1f')](0x1f4,[config[_0x7fc1('0x13')]['ip'],config[_0x7fc1('0x13')][_0x7fc1('0x14')],'ami\x20disconnected'][_0x7fc1('0x16')]('\x20')));}var _0x196b1d=schema(properties[_0x7fc1('0x78')])[_0x7fc1('0x3')](_0xfb6ebd);if(_0x196b1d['length']>0x0){return _0x128c77(_0x3c0c0c['error'](0x1f4,_['map'](_0x196b1d,_0x7fc1('0x1d'))[_0x7fc1('0x16')](',\x20')));}var _0x270626=_[_0x7fc1('0x5f')](_0x4100a9['queueChannels'],{'uniqueid':_0xfb6ebd[_0x7fc1('0x60')]});if(_0x270626&&_0x270626[_0x7fc1('0x61')]){return ami['Action']({'action':'Redirect','channel':_0x270626[_0x7fc1('0x61')],'exten':_0xfb6ebd[_0x7fc1('0x79')],'context':_0xfb6ebd['context']||_0x270626[_0x7fc1('0x7a')],'priority':0x1})[_0x7fc1('0x1c')](function(_0x4ab4b5){_0x51cd66({'code':0xc8,'message':[_0xfb6ebd[_0x7fc1('0x60')],_0x4ab4b5[_0x7fc1('0x1d')][_0x7fc1('0x67')]()]['join']('\x20')});})[_0x7fc1('0x1e')](function(_0x357bf1){_0x128c77(_0x3c0c0c[_0x7fc1('0x1f')](0x1f5,[_0xfb6ebd[_0x7fc1('0x60')],_0x357bf1['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x128c77(_0x3c0c0c[_0x7fc1('0x1f')](0x1f5,_0x7fc1('0x6d')));}});},'Agents':function(_0x47e984){return new Promise(function(_0x474256,_0x245578){var _0x2c8a53=_[_0x7fc1('0x74')](_0x4100a9[_0x7fc1('0xf')]);_0x474256({'count':_0x2c8a53[_0x7fc1('0x5d')],'rows':_0x2c8a53});});},'Telephones':function(_0x152fad){return new Promise(function(_0x3df96d,_0x46f399){var _0x38abee=_[_0x7fc1('0x74')](_0x4100a9['telephones']);_0x3df96d({'count':_0x38abee[_0x7fc1('0x5d')],'rows':_0x38abee});});},'Trunks':function(_0x388817){return new Promise(function(_0x512a31,_0x4140ef){var _0x1a8ae4=_['values'](_0x4100a9['trunks']);_0x512a31({'count':_0x1a8ae4[_0x7fc1('0x5d')],'rows':_0x1a8ae4});});},'OutboundChannels':function(_0x6b25e5){return new Promise(function(_0x42f448,_0x53a799){var _0x31caae=_[_0x7fc1('0x74')](_0x4100a9[_0x7fc1('0x7b')]);_0x42f448({'count':_0x31caae[_0x7fc1('0x5d')],'rows':_0x31caae});});},'Outbound':function(_0x3eedfc){return new Promise(function(_0x550c1a,_0x5baff2){_0x550c1a(_0x4100a9[_0x7fc1('0x31')]);});},'Campaigns':function(_0x9f0378){return new Promise(function(_0x208478,_0xf75821){var _0x3e9b82=_['values'](_0x4100a9[_0x7fc1('0x7c')]);_0x208478({'count':_0x3e9b82['length'],'rows':_0x3e9b82});});},'VoiceQueuesPreview':function(_0x1ff21a){var _0x895bfb=this;return new Promise(function(_0x152c4a,_0x5b8d10){_0x5de7fa[_0x7fc1('0x7d')](_0x1ff21a['id'])[_0x7fc1('0x1c')](function(_0x5b0536){_0x152c4a({'code':0xc8,'message':_0x5b0536[_0x7fc1('0x1d')]});})['catch'](function(_0x520467){_0x5b8d10(_0x895bfb[_0x7fc1('0x1f')](0x1f4,_0x520467['message']));});});},'EventManager':function(_0x4fd1e2){var _0x83a77d=this;return new Promise(function(_0x2a15db,_0x4aacb7){if(!_0x4fd1e2[_0x7fc1('0x7e')]){return _0x4aacb7(_0x83a77d[_0x7fc1('0x1f')](0x1f4,_0x7fc1('0x7f')));}ami['emit']('custom:'+_0x4fd1e2[_0x7fc1('0x7e')],_0x4fd1e2[_0x7fc1('0x1d')]);_0x2a15db({'code':0xc8,'message':_0x4fd1e2});});},'FaxAccounts':function(_0x4b430c){return new Promise(function(_0x577caa,_0x2d52ee){var _0x270b45=_[_0x7fc1('0x74')](_0x4100a9[_0x7fc1('0x80')]);_0x577caa({'count':_0x270b45[_0x7fc1('0x5d')],'rows':_0x270b45});});},'SendFax':function(_0x4adfb2){var _0x128a5f=this;return new Promise(function(_0x3808d8,_0x115282){_0x30f5f8['send'](_0x4adfb2)['then'](function(_0x350011){_0x3808d8({'code':0xc8,'message':_0x350011['message']});})[_0x7fc1('0x1e')](function(_0x50f097){_0x115282(_0x128a5f[_0x7fc1('0x1f')](0x1f4,_0x50f097[_0x7fc1('0x1d')]));});});},'CheckAfterSend':function(_0x5dad34){var _0x449bb1=this;return new Promise(function(_0x155022,_0x4b0a13){_0x30f5f8['checkAfterSend'](_0x5dad34)[_0x7fc1('0x1c')](function(_0x521dac){_0x155022({'code':0xc8,'message':_0x521dac[_0x7fc1('0x1d')]});})[_0x7fc1('0x1e')](function(_0x3c3f7a){_0x4b0a13(_0x449bb1[_0x7fc1('0x1f')](0x1f4,_0x3c3f7a[_0x7fc1('0x1d')]));});});}};var _0x192d8a=jayson[_0x7fc1('0x81')](_0xf0d3fa)[_0x7fc1('0x82')]();_0x192d8a['on']('error',function(_0x524d5d){return _0x2267ea(_0x524d5d);});_0x192d8a[_0x7fc1('0x8')](0x232a,_0x7fc1('0x83'),function(){console['log'](_0x7fc1('0x84'),0x232a);return _0x1867ea('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x2a07=['username','ami\x20disconnected','join','pick','module','action','Reload','Action','then','message','catch','isConnected','command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','find','omit','undefined','values','channels','error','voicechannel','length','map','uniqueid','channel','filename','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','mixmonitorid','status','toLowerCase','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','exten','context','telephones','campaigns','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk'];(function(_0x27b5d1,_0x5a942b){var _0x3ed4c0=function(_0x112d4d){while(--_0x112d4d){_0x27b5d1['push'](_0x27b5d1['shift']());}};_0x3ed4c0(++_0x5a942b);}(_0x2a07,0x74));var _0x72a0=function(_0x4f7742,_0x15ce9a){_0x4f7742=_0x4f7742-0x0;var _0x270a53=_0x2a07[_0x4f7742];return _0x270a53;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var jayson=require(_0x72a0('0x2'));var schema=require(_0x72a0('0x3'));var BPromise=require(_0x72a0('0x4'));var moment=require('moment');var config=require(_0x72a0('0x5'));var properties=require(_0x72a0('0x6'));var ami=require(_0x72a0('0x7'));exports[_0x72a0('0x8')]=function(_0x431f65,_0xce74c,_0x3ccf6d){return new BPromise(function(_0x20dab9,_0x193e3b){var _0x287b06={'QueuePause':function(_0x21c819){return new Promise(function(_0x2c04eb,_0x22270e){var _0x1d32e9=util[_0x72a0('0x9')](_0x72a0('0xa'),'SIP',_0x21c819[_0x72a0('0xb')]);if(_0x431f65[_0x72a0('0xc')]&&_0x431f65['timers'][_0x1d32e9]&&_0x431f65[_0x72a0('0xc')][_0x1d32e9][_0x72a0('0xd')]){_0x431f65[_0x72a0('0xc')][_0x1d32e9][_0x72a0('0xe')]();}if(_0x431f65[_0x72a0('0xf')][_0x1d32e9]){_0x431f65['agents'][_0x1d32e9][_0x72a0('0x10')]({'statePause':_0x21c819[_0x72a0('0x11')]?!![]:![]});}_0x2c04eb({'code':0xc8,'message':_0x72a0('0x12')});});},'Reload':function(_0xf91a82){var _0x149f0d=this;return new Promise(function(_0x324cbd,_0xe73b5e){if(ami['isConnected']()==![]){return _0xe73b5e(_0x149f0d['error'](0x1f4,[config[_0x72a0('0x13')]['ip'],config[_0x72a0('0x13')][_0x72a0('0x14')],_0x72a0('0x15')][_0x72a0('0x16')]('\x20')));}_0xf91a82=_[_0x72a0('0x17')](_0xf91a82,_['keys'](properties[_0x72a0('0x18')]));_0xf91a82[_0x72a0('0x19')]=_0x72a0('0x1a');return ami[_0x72a0('0x1b')](_0xf91a82)[_0x72a0('0x1c')](function(_0x54495e){_0x324cbd({'code':0xc8,'message':_0x54495e[_0x72a0('0x1d')]});})[_0x72a0('0x1e')](function(_0x131b73){_0xe73b5e(_0x149f0d['error'](0x1f5,_0x131b73[_0x72a0('0x1d')]));});});},'Command':function(_0x46e9e3){var _0x30899b=this;return new Promise(function(_0x41614d,_0x5437df){if(ami[_0x72a0('0x1f')]()==![]){return _0x5437df(_0x30899b['error'](0x1f4,[config[_0x72a0('0x13')]['ip'],config[_0x72a0('0x13')][_0x72a0('0x14')],'ami\x20disconnected'][_0x72a0('0x16')]('\x20')));}_0x46e9e3=_[_0x72a0('0x17')](_0x46e9e3,_0x72a0('0x20'));_0x46e9e3[_0x72a0('0x19')]='Command';return ami[_0x72a0('0x1b')](_0x46e9e3)[_0x72a0('0x1c')](function(_0x1ddd54){_0x41614d({'code':0xc8,'message':_0x1ddd54[_0x72a0('0x21')]});})[_0x72a0('0x1e')](function(_0x174b1b){_0x5437df(_0x30899b['error'](0x1f5,_0x174b1b['message']));});});},'VoiceQueues':function(_0x468d66){return new Promise(function(_0x2d8b68,_0x123df4){var _0x1504ed=[];for(var _0xf5cb49 in _0x431f65[_0x72a0('0x22')]){if(_0x431f65[_0x72a0('0x22')][_0x72a0('0x23')](_0xf5cb49)){var _0xee99e2=_0x431f65[_0x72a0('0x22')][_0xf5cb49];var _0x4f9718={'id':_0xee99e2['id'],'name':_0xee99e2[_0x72a0('0xb')],'strategy':_0xee99e2[_0x72a0('0x24')],'answered':_0xee99e2[_0x72a0('0x25')],'available':_0xee99e2[_0x72a0('0x26')],'loggedIn':_0xee99e2[_0x72a0('0x27')],'pTalking':_0xee99e2[_0x72a0('0x28')],'sumBillable':_0xee99e2[_0x72a0('0x29')],'sumDuration':_0xee99e2[_0x72a0('0x2a')],'sumHoldTime':_0xee99e2[_0x72a0('0x2b')]||0x0,'talking':_0xee99e2[_0x72a0('0x2c')],'total':_0xee99e2['total'],'type':_0xee99e2[_0x72a0('0x2d')],'unmanaged':_0xee99e2[_0x72a0('0x2e')],'abandoned':_0xee99e2[_0x72a0('0x2f')],'waiting':_0xee99e2[_0x72a0('0x30')],'loggedInDb':_0xee99e2[_0x72a0('0x31')]};if(_0xee99e2[_0x72a0('0x2d')]===_0x72a0('0x32')){_0x4f9718['dialActive']=_0xee99e2[_0x72a0('0x33')];_0x4f9718[_0x72a0('0x34')]=_0xee99e2[_0x72a0('0x34')];_0x4f9718[_0x72a0('0x35')]=_0xee99e2[_0x72a0('0x35')];_0x4f9718[_0x72a0('0x36')]=_0xee99e2[_0x72a0('0x36')];_0x4f9718[_0x72a0('0x37')]=_0xee99e2['dialOriginateTimeout'];_0x4f9718[_0x72a0('0x38')]=_0xee99e2[_0x72a0('0x38')];_0x4f9718[_0x72a0('0x39')]=_0xee99e2['temp'];_0x4f9718[_0x72a0('0x3a')]=_0xee99e2['outboundAnswerAgiCallsDay'];_0x4f9718[_0x72a0('0x3b')]=_0xee99e2[_0x72a0('0x3b')];_0x4f9718[_0x72a0('0x3c')]=_0xee99e2[_0x72a0('0x3c')];_0x4f9718[_0x72a0('0x3d')]=_0xee99e2[_0x72a0('0x3d')];_0x4f9718[_0x72a0('0x3e')]=_0xee99e2[_0x72a0('0x3e')];_0x4f9718[_0x72a0('0x3f')]=_0xee99e2[_0x72a0('0x3f')];_0x4f9718[_0x72a0('0x40')]=_0xee99e2[_0x72a0('0x40')];_0x4f9718['outboundDropCallsDayTimeout']=_0xee99e2[_0x72a0('0x41')];_0x4f9718['outboundNoAnswerCallsDay']=_0xee99e2[_0x72a0('0x42')];_0x4f9718[_0x72a0('0x43')]=_0xee99e2[_0x72a0('0x43')];_0x4f9718[_0x72a0('0x44')]=_0xee99e2[_0x72a0('0x44')];_0x4f9718[_0x72a0('0x45')]=_0xee99e2[_0x72a0('0x45')];_0x4f9718[_0x72a0('0x46')]=_0xee99e2[_0x72a0('0x46')];_0x4f9718['outboundUnknownCallsDay']=_0xee99e2['outboundUnknownCallsDay'];_0x4f9718[_0x72a0('0x47')]=_0xee99e2[_0x72a0('0x47')];_0x4f9718[_0x72a0('0x48')]=_0xee99e2[_0x72a0('0x48')];_0x4f9718[_0x72a0('0x49')]=_0xee99e2['predictiveIntervalAvgTalktime'];_0x4f9718[_0x72a0('0x4a')]=_0xee99e2[_0x72a0('0x4a')];_0x4f9718['predictiveIntervalDroppedCallsTimeout']=_0xee99e2[_0x72a0('0x4b')];_0x4f9718['predictiveIntervalErlangCalls']=_0xee99e2['predictiveIntervalErlangCalls'];_0x4f9718['predictiveIntervalErlangCallsDroppedCalls']=_0xee99e2[_0x72a0('0x4c')];_0x4f9718['predictiveIntervalHitRate']=_0xee99e2[_0x72a0('0x4d')];_0x4f9718[_0x72a0('0x4e')]=_0xee99e2[_0x72a0('0x4e')];_0x4f9718[_0x72a0('0x4f')]=_0xee99e2['predictiveIntervalPauses'];_0x4f9718['predictiveIntervalAvailable']=_0xee99e2['predictiveIntervalAvailable'];_0x4f9718['predictiveIntervalTotalCalls']=_0xee99e2[_0x72a0('0x50')];_0x4f9718[_0x72a0('0x1d')]=_0xee99e2['message'];_0x4f9718[_0x72a0('0x51')]=_0xee99e2[_0x72a0('0x51')];_0x4f9718['erlangCalls']=_0xee99e2[_0x72a0('0x52')];_0x4f9718[_0x72a0('0x53')]=_0xee99e2[_0x72a0('0x53')];_0x4f9718[_0x72a0('0x54')]=_0xee99e2[_0x72a0('0x54')];_0x4f9718[_0x72a0('0x55')]=_0xee99e2['erlangBusyFactor'];_0x4f9718[_0x72a0('0x56')]=_0xee99e2['startPredictive'];_0x4f9718[_0x72a0('0x57')]=_0xee99e2['startProgressive'];}if(_0xee99e2[_0x72a0('0x58')]){_0x4f9718[_0x72a0('0x58')]={'id':_0xee99e2['Trunk']['id'],'name':_0xee99e2[_0x72a0('0x58')]['name'],'active':_0xee99e2[_0x72a0('0x58')][_0x72a0('0x59')],'callerid':_0xee99e2[_0x72a0('0x58')]['callerid']};}if(_0xee99e2[_0x72a0('0x5a')]){_0x4f9718[_0x72a0('0x5a')]={'id':_0xee99e2[_0x72a0('0x5a')]['id'],'name':_0xee99e2['Interval']['name']};}_0x1504ed[_0x72a0('0x5b')](_0x4f9718);}}_0x2d8b68({'count':_0x1504ed['length'],'rows':_0x1504ed});});},'UpdateVoiceQueue':function(_0x28e1a0){return new Promise(function(_0x1436f7,_0x1d2e44){var _0x2b4d36=_[_0x72a0('0x5c')](_0x431f65[_0x72a0('0x22')],{'id':parseInt(_0x28e1a0['id'])});var _0x451558=_[_0x72a0('0x5d')](_0x28e1a0,['id']);if(_0x2b4d36){for(var _0x2efa92 in _0x451558){if(typeof _0x451558[_0x2efa92]!=='undefined'&&typeof _0x2b4d36[_0x2efa92]!==_0x72a0('0x5e')){_0x2b4d36[_0x2efa92]=_0x451558[_0x2efa92];}}_0x1436f7(_0x2b4d36);}else{_0x1d2e44();}});},'VoiceChannels':function(_0x2c2f03){return new Promise(function(_0x134150,_0x476e7a){var _0x3a669d=_[_0x72a0('0x5f')](_0x431f65[_0x72a0('0x60')]);_0x134150({'count':_0x3a669d['length'],'rows':_0x3a669d});});},'VoiceChannelMixMonitor':function(_0x4f9091){var _0x409095=this;return new Promise(function(_0x2161a3,_0xe38fb3){if(ami[_0x72a0('0x1f')]()==![]){return _0xe38fb3(_0x409095[_0x72a0('0x61')](0x1f4,[config[_0x72a0('0x13')]['ip'],config[_0x72a0('0x13')][_0x72a0('0x14')],_0x72a0('0x15')][_0x72a0('0x16')]('\x20')));}var _0x499721=schema(properties[_0x72a0('0x62')])[_0x72a0('0x3')](_0x4f9091);if(_0x499721[_0x72a0('0x63')]>0x0){return _0xe38fb3(_0x409095[_0x72a0('0x61')](0x1f4,_[_0x72a0('0x64')](_0x499721,'message')[_0x72a0('0x16')](',\x20')));}var _0x595243=_['find'](_0x431f65[_0x72a0('0x60')],{'uniqueid':_0x4f9091[_0x72a0('0x65')]});if(_0x595243&&_0x595243[_0x72a0('0x66')]){var _0x35ed6f=util[_0x72a0('0x9')]('%s.%s',_0x4f9091[_0x72a0('0x67')]||_0x4f9091[_0x72a0('0x65')],_0x4f9091['format']||'wav');return ami[_0x72a0('0x1b')]({'action':_0x72a0('0x68'),'channel':_0x595243[_0x72a0('0x66')],'file':_0x35ed6f,'options':_0x72a0('0x69')})[_0x72a0('0x1c')](function(_0x3813ca){var _0x37a6d6=_[_0x72a0('0x5c')](_0x595243['monitors'],{'filename':_0x72a0('0x6a')+_0x35ed6f['toLowerCase']()});if(_['isNil'](_0x37a6d6)){_0x595243['monitors'][_0x72a0('0x5b')]({'filename':_0x72a0('0x6a')+_0x35ed6f['toLowerCase'](),'createdAt':moment()[_0x72a0('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3813ca[_0x72a0('0x6b')],'status':'rec'});}else{_0x37a6d6['mixmonitorid']=_0x3813ca[_0x72a0('0x6b')];_0x37a6d6[_0x72a0('0x6c')]='rec';}_0x2161a3({'code':0xc8,'message':[_0x4f9091[_0x72a0('0x65')],'MixMonitor\x20Success',_0x3813ca[_0x72a0('0x6b')]]['join']('\x20'),'mixmonitorid':_0x3813ca['mixmonitorid']});})[_0x72a0('0x1e')](function(_0x2dbbb4){_0xe38fb3(_0x409095[_0x72a0('0x61')](0x1f5,[_0x4f9091['uniqueid'],_0x2dbbb4['message'][_0x72a0('0x6d')]()]['join']('\x20')));});}else{return _0xe38fb3(_0x409095[_0x72a0('0x61')](0x1f5,_0x72a0('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x1cea02){var _0x4b03ab=this;return new Promise(function(_0x11a750,_0x2628dd){if(ami[_0x72a0('0x1f')]()==![]){return _0x2628dd(_0x4b03ab[_0x72a0('0x61')](0x1f4,[config[_0x72a0('0x13')]['ip'],config[_0x72a0('0x13')][_0x72a0('0x14')],_0x72a0('0x15')]['join']('\x20')));}var _0x39c3a2=schema(properties['voicechannel'])['validate'](_0x1cea02);if(_0x39c3a2['length']>0x0){return _0x2628dd(_0x4b03ab['error'](0x1f4,_[_0x72a0('0x64')](_0x39c3a2,_0x72a0('0x1d'))[_0x72a0('0x16')](',\x20')));}var _0x4a2f94=_[_0x72a0('0x5c')](_0x431f65['channels'],{'uniqueid':_0x1cea02[_0x72a0('0x65')]});if(_0x4a2f94){return BPromise[_0x72a0('0x6f')]()['then'](function(){if(_0x4a2f94[_0x72a0('0x66')]){return ami[_0x72a0('0x1b')]({'action':_0x72a0('0x70'),'channel':_0x4a2f94[_0x72a0('0x66')],'mixmonitorid':_0x1cea02['mixmonitorid']})[_0x72a0('0x1e')](function(_0x4d9b42){});}})[_0x72a0('0x1c')](function(){if(_0x4a2f94[_0x72a0('0x71')]){return ami[_0x72a0('0x1b')]({'action':'StopMixMonitor','channel':_0x4a2f94[_0x72a0('0x71')],'mixmonitorid':_0x1cea02[_0x72a0('0x6b')]})[_0x72a0('0x1e')](function(_0x154c9d){});}})[_0x72a0('0x1c')](function(_0x599e4c){var _0x5707e9=_[_0x72a0('0x5c')](_0x4a2f94['monitors'],{'mixmonitorid':_0x1cea02[_0x72a0('0x6b')]});if(_0x5707e9){_0x5707e9['status']=_0x72a0('0x72');}})[_0x72a0('0x1c')](function(){var _0x5ef439=util[_0x72a0('0x9')](_0x72a0('0x73'),_0x1cea02[_0x72a0('0x67')]||_0x1cea02['uniqueid'],_0x1cea02[_0x72a0('0x9')]||'wav');var _0x2ea1bb=_[_0x72a0('0x5c')](_0x4a2f94['monitors'],{'filename':_0x72a0('0x6a')+_0x5ef439['toLowerCase']()});if(_0x2ea1bb){_0x2ea1bb['status']='stop';}})[_0x72a0('0x1c')](function(){_0x11a750({'code':0xc8,'message':[_0x1cea02['uniqueid'],_0x72a0('0x74')]['join']('\x20')});})[_0x72a0('0x1e')](function(_0x32262){_0x2628dd(_0x4b03ab[_0x72a0('0x61')](0x1f5,[_0x1cea02['uniqueid'],_0x32262[_0x72a0('0x1d')][_0x72a0('0x6d')]()][_0x72a0('0x16')]('\x20')));});}else{return _0x2628dd(_0x4b03ab[_0x72a0('0x61')](0x1f5,_0x72a0('0x6e')));}});},'VoiceQueuesChannels':function(_0x58ef97){return new Promise(function(_0x54e925,_0x2d431d){var _0x19c116=_[_0x72a0('0x5f')](_0x431f65['queueChannels']);_0x54e925({'count':_0x19c116[_0x72a0('0x63')],'rows':_0x19c116});});},'VoiceQueuesChannel':function(_0x647e75){var _0x4ebce5=this;return new Promise(function(_0xd041ec,_0x48345f){var _0xd8b0e1=schema(properties[_0x72a0('0x75')])[_0x72a0('0x3')](_0x647e75);if(_0xd8b0e1[_0x72a0('0x63')]>0x0){return _0x48345f(_0x4ebce5[_0x72a0('0x61')](0x1f4,_[_0x72a0('0x64')](_0xd8b0e1,_0x72a0('0x1d'))['join'](',\x20')));}var _0x5b0dfd=_['find'](_0x431f65[_0x72a0('0x76')],{'uniqueid':_0x647e75[_0x72a0('0x65')]});if(_0x5b0dfd){_0xd041ec(_0x5b0dfd);}else{return _0x48345f(_0x4ebce5[_0x72a0('0x61')](0x1f5,_0x72a0('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x235814){var _0x867b95=this;return new Promise(function(_0x5ab97b,_0x2dd438){if(ami[_0x72a0('0x1f')]()==![]){return _0x2dd438(_0x867b95[_0x72a0('0x61')](0x1f4,[config[_0x72a0('0x13')]['ip'],config[_0x72a0('0x13')][_0x72a0('0x14')],_0x72a0('0x15')]['join']('\x20')));}var _0x1e36b0=schema(properties[_0x72a0('0x77')])[_0x72a0('0x3')](_0x235814);if(_0x1e36b0[_0x72a0('0x63')]>0x0){return _0x2dd438(_0x867b95[_0x72a0('0x61')](0x1f4,_[_0x72a0('0x64')](_0x1e36b0,'message')[_0x72a0('0x16')](',\x20')));}var _0x47e13c=_[_0x72a0('0x5c')](_0x431f65[_0x72a0('0x76')],{'uniqueid':_0x235814[_0x72a0('0x65')]});if(_0x47e13c&&_0x47e13c[_0x72a0('0x66')]){return ami[_0x72a0('0x1b')]({'action':'Hangup','channel':_0x47e13c[_0x72a0('0x66')]})[_0x72a0('0x1c')](function(_0x4e52e4){_0x5ab97b({'code':0xc8,'message':[_0x235814[_0x72a0('0x65')],_0x4e52e4[_0x72a0('0x1d')][_0x72a0('0x6d')]()][_0x72a0('0x16')]('\x20')});})['catch'](function(_0x3b4d55){_0x2dd438(_0x867b95[_0x72a0('0x61')](0x1f5,[_0x235814[_0x72a0('0x65')],_0x3b4d55[_0x72a0('0x1d')][_0x72a0('0x6d')]()][_0x72a0('0x16')]('\x20')));});}else{return _0x2dd438(_0x867b95[_0x72a0('0x61')](0x1f5,_0x72a0('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0xd771f1){var _0x3d02e6=this;return new Promise(function(_0x2fd7e2,_0x109e9e){if(ami['isConnected']()==![]){return _0x109e9e(_0x3d02e6[_0x72a0('0x61')](0x1f4,[config[_0x72a0('0x13')]['ip'],config[_0x72a0('0x13')][_0x72a0('0x14')],_0x72a0('0x15')][_0x72a0('0x16')]('\x20')));}var _0x20281b=schema(properties[_0x72a0('0x78')])['validate'](_0xd771f1);if(_0x20281b[_0x72a0('0x63')]>0x0){return _0x109e9e(_0x3d02e6['error'](0x1f4,_['map'](_0x20281b,_0x72a0('0x1d'))['join'](',\x20')));}var _0x5b9fed=_[_0x72a0('0x5c')](_0x431f65['queueChannels'],{'uniqueid':_0xd771f1[_0x72a0('0x65')]});if(_0x5b9fed&&_0x5b9fed[_0x72a0('0x66')]){return ami[_0x72a0('0x1b')]({'action':'Redirect','channel':_0x5b9fed[_0x72a0('0x66')],'exten':_0xd771f1[_0x72a0('0x79')],'context':_0xd771f1[_0x72a0('0x7a')]||_0x5b9fed[_0x72a0('0x7a')],'priority':0x1})[_0x72a0('0x1c')](function(_0x5cbae1){_0x2fd7e2({'code':0xc8,'message':[_0xd771f1[_0x72a0('0x65')],_0x5cbae1[_0x72a0('0x1d')][_0x72a0('0x6d')]()]['join']('\x20')});})[_0x72a0('0x1e')](function(_0x2e3eb0){_0x109e9e(_0x3d02e6[_0x72a0('0x61')](0x1f5,[_0xd771f1['uniqueid'],_0x2e3eb0[_0x72a0('0x1d')][_0x72a0('0x6d')]()][_0x72a0('0x16')]('\x20')));});}else{return _0x109e9e(_0x3d02e6[_0x72a0('0x61')](0x1f5,_0x72a0('0x6e')));}});},'Agents':function(_0xb7849d){return new Promise(function(_0xff26b1,_0x1b5e55){var _0x30e020=_['values'](_0x431f65[_0x72a0('0xf')]);_0xff26b1({'count':_0x30e020[_0x72a0('0x63')],'rows':_0x30e020});});},'Telephones':function(_0x14657c){return new Promise(function(_0x2458b8,_0x173cc4){var _0x5b72b7=_[_0x72a0('0x5f')](_0x431f65[_0x72a0('0x7b')]);_0x2458b8({'count':_0x5b72b7[_0x72a0('0x63')],'rows':_0x5b72b7});});},'Trunks':function(_0x4124e7){return new Promise(function(_0x5a995e,_0x36d8b9){var _0x41f20f=_[_0x72a0('0x5f')](_0x431f65['trunks']);_0x5a995e({'count':_0x41f20f['length'],'rows':_0x41f20f});});},'OutboundChannels':function(_0x3e23e4){return new Promise(function(_0x76b0bf,_0x17776e){var _0x301479=_[_0x72a0('0x5f')](_0x431f65['outboundChannels']);_0x76b0bf({'count':_0x301479['length'],'rows':_0x301479});});},'Outbound':function(_0x5c4170){return new Promise(function(_0x410f6b,_0x5c1412){_0x410f6b(_0x431f65[_0x72a0('0x32')]);});},'Campaigns':function(_0x4ebb71){return new Promise(function(_0x54724b,_0x58101a){var _0x5035df=_[_0x72a0('0x5f')](_0x431f65[_0x72a0('0x7c')]);_0x54724b({'count':_0x5035df[_0x72a0('0x63')],'rows':_0x5035df});});},'VoiceQueuesPreview':function(_0xde2abe){var _0x5bad18=this;return new Promise(function(_0x10db32,_0x67a029){_0xce74c['run'](_0xde2abe['id'])[_0x72a0('0x1c')](function(_0x5c30f9){_0x10db32({'code':0xc8,'message':_0x5c30f9['message']});})[_0x72a0('0x1e')](function(_0x401d3c){_0x67a029(_0x5bad18[_0x72a0('0x61')](0x1f4,_0x401d3c[_0x72a0('0x1d')]));});});},'EventManager':function(_0x5e1638){var _0x5075ed=this;return new Promise(function(_0x575c69,_0x455818){if(!_0x5e1638[_0x72a0('0x7d')]){return _0x455818(_0x5075ed[_0x72a0('0x61')](0x1f4,_0x72a0('0x7e')));}ami[_0x72a0('0x7f')]('custom:'+_0x5e1638['event'],_0x5e1638[_0x72a0('0x1d')]);_0x575c69({'code':0xc8,'message':_0x5e1638});});},'FaxAccounts':function(_0x3ab4ec){return new Promise(function(_0x57550f,_0x40f2e2){var _0x3a8fee=_[_0x72a0('0x5f')](_0x431f65[_0x72a0('0x80')]);_0x57550f({'count':_0x3a8fee[_0x72a0('0x63')],'rows':_0x3a8fee});});},'SendFax':function(_0x167a80){var _0x7533ea=this;return new Promise(function(_0x56bdf5,_0x42e186){_0x3ccf6d[_0x72a0('0x81')](_0x167a80)[_0x72a0('0x1c')](function(_0x5a0aa3){_0x56bdf5({'code':0xc8,'message':_0x5a0aa3[_0x72a0('0x1d')]});})[_0x72a0('0x1e')](function(_0x346e03){_0x42e186(_0x7533ea[_0x72a0('0x61')](0x1f4,_0x346e03[_0x72a0('0x1d')]));});});},'CheckAfterSend':function(_0x49374f){var _0xc16765=this;return new Promise(function(_0x15d979,_0x1f6d7d){_0x3ccf6d[_0x72a0('0x82')](_0x49374f)[_0x72a0('0x1c')](function(_0x262e3a){_0x15d979({'code':0xc8,'message':_0x262e3a['message']});})[_0x72a0('0x1e')](function(_0x216f40){_0x1f6d7d(_0xc16765[_0x72a0('0x61')](0x1f4,_0x216f40[_0x72a0('0x1d')]));});});}};var _0xa48ecb=jayson[_0x72a0('0x83')](_0x287b06)[_0x72a0('0x84')]();_0xa48ecb['on'](_0x72a0('0x61'),function(_0x2c99f9){return _0x193e3b(_0x2c99f9);});_0xa48ecb['listen'](0x232a,_0x72a0('0x85'),function(){console['log'](_0x72a0('0x86'),0x232a);return _0x20dab9(_0x72a0('0x87')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 31d2c2a..fd07b8f 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 _0x943a=['Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','../../../../config/environment','../../../../config/logger','trigger','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','union','resolve','then','getContacts','isEmpty','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','firstName','calleridname'];(function(_0xc0cbf,_0x22f493){var _0x24a0ac=function(_0x33e3c9){while(--_0x33e3c9){_0xc0cbf['push'](_0xc0cbf['shift']());}};_0x24a0ac(++_0x22f493);}(_0x943a,0x84));var _0xa943=function(_0x49985f,_0x54a141){_0x49985f=_0x49985f-0x0;var _0x270118=_0x943a[_0x49985f];return _0x270118;};'use strict';var _=require(_0xa943('0x0'));var BPromise=require(_0xa943('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xa943('0x2'));var logger=require(_0xa943('0x3'))(_0xa943('0x4'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0xa943('0x5')](config[_0xa943('0x6')],{'host':_0xa943('0x7'),'port':0x18eb});var io=require(_0xa943('0x8'))(new Redis(config[_0xa943('0x6')]));function emit(_0x484bd2,_0x1c6850,_0x4b948d,_0x545842,_0x526407){logger[_0xa943('0x9')](_0xa943('0xa'),_0x484bd2,_0x1c6850['id'],_0x4b948d,_0x545842,JSON[_0xa943('0xb')](_0x526407));io['to'](_0x4b948d)[_0xa943('0xc')](_0x545842,_0x526407);}exports[_0xa943('0xd')]=function(_0x46f569,_0x3a0e55,_0x245e67,_0x3240e3){var _0x2ef292,_0x3b56da;var _0x4ee6a4={};var _0x28cd9c;var _0x105042=Number(_0x245e67['data1']);var _0x6b798b=_0x245e67[_0xa943('0xe')]?Boolean(Number(_0x245e67[_0xa943('0xe')])):![];var _0x2bf476;var _0x1c12a2=![];if(!_[_0xa943('0xf')](_0x245e67[_0xa943('0x10')])){if(_0x245e67[_0xa943('0x10')]=='1')_0x1c12a2=!![];}if(!_0x1c12a2){if(_0x3240e3[_0xa943('0x11')]){_0x4ee6a4['id']=_0x3240e3[_0xa943('0x11')];}}if(!_0x4ee6a4['id']){_0x4ee6a4[_0xa943('0x12')]=_0x105042;_0x2bf476=_0x245e67[_0xa943('0x13')]&&_0x245e67[_0xa943('0x13')]!=='0'?_0x245e67[_0xa943('0x13')][_0xa943('0x14')](','):[_0xa943('0x15')];_0x4ee6a4[_0xa943('0x16')]=_[_0xa943('0x17')](_0x2bf476,function(_0xb3927d){var _0x28d6af={};_0x28d6af[_0xb3927d]=_0x3240e3['routeId']?_0x3240e3[_0xa943('0x18')]:_0x3240e3[_0xa943('0x19')];return _0x28d6af;});_0x28cd9c=_0x3240e3['routeId']?_0x3240e3[_0xa943('0x18')]:_0x3240e3[_0xa943('0x19')];}var _0x5a73c0=['id','firstName',_0xa943('0x1a'),_0xa943('0x15'),_0xa943('0x1b'),_0xa943('0x1c'),'ListId',_0xa943('0x1d'),_0xa943('0x1e'),'updatedAt'];var _0x262ce3=_[_0xa943('0x1f')](_0x5a73c0,_0x2bf476);BPromise[_0xa943('0x20')]()[_0xa943('0x21')](cmContactRpc[_0xa943('0x22')]({'attributes':_0x262ce3,'where':_0x4ee6a4,'phone':_0x28cd9c}))[_0xa943('0x21')](function(_0x2ad2f1){_0x3b56da=_0x2ad2f1;if(!_[_0xa943('0x23')](_0x3b56da)){if(_0x3b56da[_0xa943('0x24')]===0x1){_0x2ef292=_0x3b56da[0x0];logger[_0xa943('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x3240e3[_0xa943('0x25')],_0x3a0e55['id'],_0x2ef292['id']);}else{logger[_0xa943('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3240e3[_0xa943('0x25')],_0x3a0e55['id'],_['map'](_0x3b56da,'id')[_0xa943('0x26')](','));}return;}else{logger[_0xa943('0x9')](_0xa943('0x27'),_0x3240e3['uniqueid'],_0x3a0e55['id']);var _0x398174={'ListId':_0x105042};var _0x3fc538=_0x245e67[_0xa943('0x28')]&&_0x245e67['data4']!=='0'?_0x245e67[_0xa943('0x28')]:_0xa943('0x15');if(_0x6b798b){logger[_0xa943('0x9')](_0xa943('0x29'),_0x3240e3[_0xa943('0x25')],_0x3a0e55['id']);_0x398174[_0x3fc538]=_[_0xa943('0xf')](_0x3240e3[_0xa943('0x2a')])?_0x3240e3['calleridnum']:_0x3240e3[_0xa943('0x18')];if(_[_0xa943('0xf')](_0x3240e3[_0xa943('0x2a')])){_0x398174[_0xa943('0x2b')]=_0x3240e3[_0xa943('0x2c')]&&_0x3240e3[_0xa943('0x2c')]!==''?_0x3240e3[_0xa943('0x2c')]:_0xa943('0x2d');}else{_0x398174['firstName']=_0x3240e3[_0xa943('0x2e')]&&_0x3240e3[_0xa943('0x2e')]!==_0xa943('0x2f')?_0x3240e3[_0xa943('0x2e')]:'Unknown';}return BPromise[_0xa943('0x20')]()[_0xa943('0x21')](cmContactRpc[_0xa943('0x30')](_0x398174))[_0xa943('0x21')](function(_0x4af2bb){_0x2ef292=_0x4af2bb;_0x3b56da[_0xa943('0x31')](_0x4af2bb);if(_0x2ef292){logger[_0xa943('0x9')](_0xa943('0x32'),_0x3240e3[_0xa943('0x25')],_0x3a0e55['id'],_0x2ef292['id']);}return;});}else{logger[_0xa943('0x9')](_0xa943('0x33'),_0x3240e3['uniqueid'],_0x3a0e55['id']);_0x398174[_0x3fc538]=_['isNil'](_0x3240e3[_0xa943('0x2a')])?_0x3240e3[_0xa943('0x19')]:_0x3240e3['destcalleridnum'];if(_[_0xa943('0xf')](_0x3240e3[_0xa943('0x2a')])){_0x398174['firstName']=_0x3240e3[_0xa943('0x2c')]&&_0x3240e3['calleridname']!==_0xa943('0x2f')?_0x3240e3['calleridname']:_0xa943('0x2d');}else{_0x398174[_0xa943('0x2b')]=_0x3240e3['destcalleridname']&&_0x3240e3[_0xa943('0x2e')]!==''?_0x3240e3['destcalleridname']:_0xa943('0x2d');}_0x2ef292=_0x398174;_0x3b56da['push'](_0x398174);return;}}})[_0xa943('0x21')](function(){if(_0x46f569){emit(_0x3240e3['uniqueid'],_0x3a0e55,util[_0xa943('0x34')](_0xa943('0x35'),_0x46f569[_0xa943('0x36')]),util[_0xa943('0x34')](_0xa943('0x37'),_0x245e67[_0xa943('0x38')][_0xa943('0x39')]()),{'evt':_[_0xa943('0x3a')](_0x3240e3,{'autoCreate':_0x6b798b}),'contact':_0x2ef292===undefined?{}:_0x2ef292,'contacts':_0x3b56da[_0xa943('0x24')]===0x0?undefined:_0x3b56da});}});}; \ No newline at end of file +var _0x52f1=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','localhost','info','emit','exec','data2','isNil','data5','xmd-contactid','data3','split','phone','map','routeId','destcalleridnum','calleridnum','firstName','mobile','ListId','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x300363,_0x5a8674){var _0x3f3058=function(_0x5114fd){while(--_0x5114fd){_0x300363['push'](_0x300363['shift']());}};_0x3f3058(++_0x5a8674);}(_0x52f1,0x1ed));var _0x152f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x52f1[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x152f('0x0'));var BPromise=require(_0x152f('0x1'));var Redis=require(_0x152f('0x2'));var util=require(_0x152f('0x3'));var config=require(_0x152f('0x4'));var logger=require(_0x152f('0x5'))('trigger');var cmContactRpc=require(_0x152f('0x6'));config['redis']=_['defaults'](config[_0x152f('0x7')],{'host':_0x152f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5030e8,_0xdda76b,_0x1f4f1f,_0x1aa8fc,_0x37bc94){logger[_0x152f('0x9')]('[CM][%s][%s]',_0x5030e8,_0xdda76b['id'],_0x1f4f1f,_0x1aa8fc,JSON['stringify'](_0x37bc94));io['to'](_0x1f4f1f)[_0x152f('0xa')](_0x1aa8fc,_0x37bc94);}exports[_0x152f('0xb')]=function(_0x2738ee,_0x60eb20,_0x10c471,_0x3eb5d1){var _0x33096a,_0x2ab134;var _0x52390d={};var _0x39bedf;var _0x576102=Number(_0x10c471['data1']);var _0x5a4761=_0x10c471[_0x152f('0xc')]?Boolean(Number(_0x10c471[_0x152f('0xc')])):![];var _0x424b52;var _0xa5876a=![];if(!_[_0x152f('0xd')](_0x10c471[_0x152f('0xe')])){if(_0x10c471[_0x152f('0xe')]=='1')_0xa5876a=!![];}if(!_0xa5876a){if(_0x3eb5d1['xmd-contactid']){_0x52390d['id']=_0x3eb5d1[_0x152f('0xf')];}}if(!_0x52390d['id']){_0x52390d['ListId']=_0x576102;_0x424b52=_0x10c471[_0x152f('0x10')]&&_0x10c471['data3']!=='0'?_0x10c471['data3'][_0x152f('0x11')](','):[_0x152f('0x12')];_0x52390d['$or']=_[_0x152f('0x13')](_0x424b52,function(_0x52c8f8){var _0x1cd9e4={};_0x1cd9e4[_0x52c8f8]=_0x3eb5d1[_0x152f('0x14')]?_0x3eb5d1[_0x152f('0x15')]:_0x3eb5d1[_0x152f('0x16')];return _0x1cd9e4;});_0x39bedf=_0x3eb5d1['routeId']?_0x3eb5d1[_0x152f('0x15')]:_0x3eb5d1[_0x152f('0x16')];}var _0x4b7b4e=['id',_0x152f('0x17'),'lastName',_0x152f('0x12'),_0x152f('0x18'),'fax',_0x152f('0x19'),'createdAt',_0x152f('0x1a'),_0x152f('0x1b')];var _0x281426=_[_0x152f('0x1c')](_0x4b7b4e,_0x424b52);BPromise[_0x152f('0x1d')]()[_0x152f('0x1e')](cmContactRpc[_0x152f('0x1f')]({'attributes':_0x281426,'where':_0x52390d,'phone':_0x39bedf}))[_0x152f('0x1e')](function(_0x2982fb){_0x2ab134=_0x2982fb;if(!_[_0x152f('0x20')](_0x2ab134)){if(_0x2ab134['length']===0x1){_0x33096a=_0x2ab134[0x0];logger[_0x152f('0x9')](_0x152f('0x21'),_0x3eb5d1[_0x152f('0x22')],_0x60eb20['id'],_0x33096a['id']);}else{logger['info'](_0x152f('0x23'),_0x3eb5d1['uniqueid'],_0x60eb20['id'],_[_0x152f('0x13')](_0x2ab134,'id')['join'](','));}return;}else{logger[_0x152f('0x9')](_0x152f('0x24'),_0x3eb5d1['uniqueid'],_0x60eb20['id']);var _0xc1c22a={'ListId':_0x576102};var _0x4450e5=_0x10c471[_0x152f('0x25')]&&_0x10c471[_0x152f('0x25')]!=='0'?_0x10c471['data4']:'phone';if(_0x5a4761){logger[_0x152f('0x9')](_0x152f('0x26'),_0x3eb5d1['uniqueid'],_0x60eb20['id']);_0xc1c22a[_0x4450e5]=_[_0x152f('0xd')](_0x3eb5d1[_0x152f('0x14')])?_0x3eb5d1['calleridnum']:_0x3eb5d1[_0x152f('0x15')];if(_['isNil'](_0x3eb5d1[_0x152f('0x14')])){_0xc1c22a[_0x152f('0x17')]=_0x3eb5d1[_0x152f('0x27')]&&_0x3eb5d1[_0x152f('0x27')]!==_0x152f('0x28')?_0x3eb5d1[_0x152f('0x27')]:'Unknown';}else{_0xc1c22a[_0x152f('0x17')]=_0x3eb5d1[_0x152f('0x29')]&&_0x3eb5d1[_0x152f('0x29')]!==_0x152f('0x28')?_0x3eb5d1[_0x152f('0x29')]:_0x152f('0x2a');}return BPromise[_0x152f('0x1d')]()['then'](cmContactRpc['createContact'](_0xc1c22a))[_0x152f('0x1e')](function(_0x16f1fd){_0x33096a=_0x16f1fd;_0x2ab134[_0x152f('0x2b')](_0x16f1fd);if(_0x33096a){logger[_0x152f('0x9')](_0x152f('0x2c'),_0x3eb5d1[_0x152f('0x22')],_0x60eb20['id'],_0x33096a['id']);}return;});}else{logger[_0x152f('0x9')](_0x152f('0x2d'),_0x3eb5d1[_0x152f('0x22')],_0x60eb20['id']);_0xc1c22a[_0x4450e5]=_['isNil'](_0x3eb5d1[_0x152f('0x14')])?_0x3eb5d1['calleridnum']:_0x3eb5d1[_0x152f('0x15')];if(_[_0x152f('0xd')](_0x3eb5d1[_0x152f('0x14')])){_0xc1c22a['firstName']=_0x3eb5d1[_0x152f('0x27')]&&_0x3eb5d1[_0x152f('0x27')]!==_0x152f('0x28')?_0x3eb5d1[_0x152f('0x27')]:_0x152f('0x2a');}else{_0xc1c22a['firstName']=_0x3eb5d1[_0x152f('0x29')]&&_0x3eb5d1[_0x152f('0x29')]!==''?_0x3eb5d1['destcalleridname']:_0x152f('0x2a');}_0x33096a=_0xc1c22a;_0x2ab134[_0x152f('0x2b')](_0xc1c22a);return;}}})[_0x152f('0x1e')](function(){if(_0x2738ee){emit(_0x3eb5d1['uniqueid'],_0x60eb20,util[_0x152f('0x2e')](_0x152f('0x2f'),_0x2738ee[_0x152f('0x30')]),util[_0x152f('0x2e')](_0x152f('0x31'),_0x10c471[_0x152f('0x32')]['toLowerCase']()),{'evt':_[_0x152f('0x33')](_0x3eb5d1,{'autoCreate':_0x5a4761}),'contact':_0x33096a===undefined?{}:_0x33096a,'contacts':_0x2ab134[_0x152f('0x34')]===0x0?undefined:_0x2ab134});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 69de666..3077285 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 _0xe353=['deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','info','emit','clone','undefined','checkTriggers','prototype','interface','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','contactmanager','exec','integration','script','query','search','every','AllConditions','channel','AnyConditions','checkConditions','account','ChatWebsiteId','operator','value','upperFirst','interaction','event','queue','membername','lastevent','routeId','null','substatus','offlineMessage','created','equals','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts'];(function(_0x18e6f7,_0x29738f){var _0x9e3ab0=function(_0x5ed513){while(--_0x5ed513){_0x18e6f7['push'](_0x18e6f7['shift']());}};_0x9e3ab0(++_0x29738f);}(_0xe353,0xdc));var _0x3e35=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xe353[_0x4d8ed9];return _0x1e2140;};'use strict';var util=require('util');var _=require(_0x3e35('0x0'));var url=require(_0x3e35('0x1'));var Mustache=require(_0x3e35('0x2'));var Redis=require(_0x3e35('0x3'));var urlforward=require(_0x3e35('0x4'));var integration=require(_0x3e35('0x5'));var cmContact=require(_0x3e35('0x6'));var script=require(_0x3e35('0x7'));var config=require(_0x3e35('0x8'));var logger=require(_0x3e35('0x9'))(_0x3e35('0xa'));var ami=require('../ami');config[_0x3e35('0xb')]=_[_0x3e35('0xc')](config[_0x3e35('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x3e35('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0xe156a,_0x183d1f){return _0xe156a==_0x183d1f;},'not_equals':function(_0x37dbac,_0x260262){return _0x37dbac!=_0x260262;}};var barAndWebActions=[_0x3e35('0xe'),_0x3e35('0x1'),_0x3e35('0xf')];function Trigger(_0x1f8ae2){this[_0x3e35('0x10')]=_0x1f8ae2['triggers'];this[_0x3e35('0x11')]=_0x1f8ae2[_0x3e35('0x11')];this[_0x3e35('0x12')]=_0x1f8ae2[_0x3e35('0x12')];this['templates']=_0x1f8ae2[_0x3e35('0x13')];this[_0x3e35('0x14')]=_0x1f8ae2['voiceExtensions'];this['zendeskAccounts']=_0x1f8ae2[_0x3e35('0x15')];this[_0x3e35('0x16')]=_0x1f8ae2[_0x3e35('0x16')];this[_0x3e35('0x17')]=_0x1f8ae2[_0x3e35('0x17')];this[_0x3e35('0x18')]=_0x1f8ae2['sugarcrmAccounts'];this[_0x3e35('0x19')]=_0x1f8ae2[_0x3e35('0x19')];this[_0x3e35('0x1a')]=_0x1f8ae2['deskAccounts'];this[_0x3e35('0x1b')]=_0x1f8ae2[_0x3e35('0x1b')];this[_0x3e35('0x1c')]=_0x1f8ae2[_0x3e35('0x1c')];this[_0x3e35('0x1d')]=_0x1f8ae2['dynamics365Accounts'];this[_0x3e35('0x1e')]=_0x1f8ae2[_0x3e35('0x1e')];this[_0x3e35('0x1f')]={'zendesk':this[_0x3e35('0x15')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x3e35('0x16')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x3e35('0x19')],'desk':this[_0x3e35('0x1a')],'vtiger':this[_0x3e35('0x1b')],'dynamics365':this[_0x3e35('0x1d')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x3e35('0x1c')]};ami['on'](_0x3e35('0x20'),this['syncCustomEvent'][_0x3e35('0x21')](this));ami['on']('custom:agentconnect',this[_0x3e35('0x22')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0x3e35('0x22')][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x23'),this[_0x3e35('0x22')]['bind'](this));ami['on'](_0x3e35('0x24'),this['syncCustomEvent'][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x25'),this[_0x3e35('0x22')][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x26'),this[_0x3e35('0x22')][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x27'),this[_0x3e35('0x22')]['bind'](this));ami['on'](_0x3e35('0x28'),this[_0x3e35('0x22')][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x29'),this[_0x3e35('0x22')]['bind'](this));ami['on'](_0x3e35('0x2a'),this[_0x3e35('0x22')][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x2b'),this[_0x3e35('0x22')][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x2c'),this['syncAgentDial'][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x2d'),this[_0x3e35('0x2e')]['bind'](this));ami['on'](_0x3e35('0x2f'),this[_0x3e35('0x2e')]['bind'](this));ami['on'](_0x3e35('0x30'),this[_0x3e35('0x22')]['bind'](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0x3e35('0x21')](this));ami['on']('custom:substatus',this[_0x3e35('0x22')][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x31'),this[_0x3e35('0x22')][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x32'),this[_0x3e35('0x22')][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x33'),this[_0x3e35('0x22')]['bind'](this));ami['on'](_0x3e35('0x34'),this[_0x3e35('0x22')][_0x3e35('0x21')](this));ami['on'](_0x3e35('0x35'),this[_0x3e35('0x22')][_0x3e35('0x21')](this));}Trigger['prototype']['emit']=function(_0x1c974c,_0x3edf59,_0x3ce113){logger[_0x3e35('0x36')](_0x1c974c,_0x3edf59,JSON['stringify'](_0x3ce113));io['to'](_0x1c974c)[_0x3e35('0x37')](_0x3edf59,_0x3ce113);};Trigger['prototype'][_0x3e35('0x22')]=function(_0x261160){var _0x2babe5=_[_0x3e35('0x38')](_0x261160);if(typeof _0x2babe5['motionChannel']===_0x3e35('0x39')){_0x2babe5['motionChannel']='voice';}this[_0x3e35('0x3a')](_0x2babe5);};Trigger[_0x3e35('0x3b')]['syncAgentDial']=function(_0x23a19e){if(this[_0x3e35('0x11')][_0x23a19e[_0x3e35('0x3c')]]){this[_0x3e35('0x22')](_0x23a19e);}};Trigger[_0x3e35('0x3b')]['checkTriggers']=function(_0x18c02a){var _0xb2d0ca;for(var _0x19191d in this['triggers']){if(this[_0x3e35('0x10')]['hasOwnProperty'](_0x19191d)){if(this[_0x3e35('0x10')][_0x19191d][_0x3e35('0x3d')]){_0xb2d0ca=this[_0x3e35('0x3e')](this['triggers'][_0x19191d],_0x18c02a);if(_0xb2d0ca){_[_0x3e35('0x3f')](_0x18c02a,_0x18c02a[_0x3e35('0x40')]);for(var _0x54a1ef=0x0,_0x5aa054,_0x1dcff7,_0x3ccc66;_0x54a1ef0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x326f,0xd1));var _0xf326=function(_0x305253,_0x33fcb7){_0x305253=_0x305253-0x0;var _0x3a0238=_0x326f[_0x305253];return _0x3a0238;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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 a8c7c62..4339ba6 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 _0x691c=['incident','incidents','assign','Subjects','getString','Descriptions','Fields','phonecall','callDirection','queue','phonecalls','ticketType','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name','lodash','util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data5','POST','clientId','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','userEmail','email','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','internalemailaddress','toLowerCase','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','%2b','Bearer\x20','nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','indexOf','content'];(function(_0x1677e3,_0x5eb8b1){var _0x1bb8e6=function(_0x5dee9e){while(--_0x5dee9e){_0x1677e3['push'](_0x1677e3['shift']());}};_0x1bb8e6(++_0x5eb8b1);}(_0x691c,0x14b));var _0xc691=function(_0x180890,_0x4bc2cd){_0x180890=_0x180890-0x0;var _0x4f4d0f=_0x691c[_0x180890];return _0x4f4d0f;};'use strict';var _=require(_0xc691('0x0'));var rp=require('request-promise');var util=require(_0xc691('0x1'));var intUtil=require('./util');var md5=require(_0xc691('0x2'));var Redis=require(_0xc691('0x3'));var logger=require(_0xc691('0x4'))(_0xc691('0x5'));var config=require('../../../../config/environment');config[_0xc691('0x6')]=_[_0xc691('0x7')](config[_0xc691('0x6')],{'host':_0xc691('0x8'),'port':0x18eb});var io=require(_0xc691('0x9'))(new Redis(config[_0xc691('0x6')]));function getAuthToken(_0x1f79ed,_0x4daa83,_0x514c23){if(_0x1f79ed[_0xc691('0xa')]){_0x1f79ed[_0xc691('0xb')]=_0x1f79ed[_0xc691('0xc')][_0xc691('0xd')];_0x1f79ed[_0xc691('0xe')]=_0x1f79ed[_0xc691('0xc')]['data2'];return Promise['resolve'](_0x1f79ed[_0xc691('0xc')][_0xc691('0xf')]);}var _0x344378={'method':_0xc691('0x10'),'uri':_0x4daa83,'form':{'client_id':_0x1f79ed[_0xc691('0x11')],'resource':_0x1f79ed[_0xc691('0xb')],'username':_0x1f79ed['username'],'password':_0x1f79ed[_0xc691('0x12')],'grant_type':_0xc691('0x12'),'client_secret':_0x1f79ed['clientSecret']},'json':!![]};return rp(_0x344378)[_0xc691('0x13')](function(_0x4810f8){return _0x4810f8[_0xc691('0x14')];})[_0xc691('0x15')](function(_0x116534){logger[_0xc691('0x16')]('['+[_0x514c23[_0xc691('0x17')]()]+_0xc691('0x18'));return _0x116534[_0xc691('0x19')];});}function getUser(_0x518bc0,_0x41bf73,_0x33f2db,_0x496eac,_0x5b1cdd,_0x22f0c9){return new Promise(function(_0x225a6b,_0x29d1a7){return getAuthToken(_0x41bf73,_0x496eac,_0x22f0c9)[_0xc691('0x13')](function(_0x6c749a){var _0x2e99af={'method':_0xc691('0x1a'),'uri':_0x5b1cdd+_0xc691('0x1b'),'headers':{'Authorization':'Bearer\x20'+_0x6c749a,'OData-Version':_0xc691('0x1c')},'json':!![]};return rp(_0x2e99af);})[_0xc691('0x13')](function(_0x29e616){var _0x2da4ab=_0x29e616[_0xc691('0x1d')];var _0x39d394=![];var _0x32eadb=null;if(!_[_0xc691('0x1e')](_0x33f2db)){if(intUtil[_0xc691('0x1f')](_0x33f2db['email'])){_0x518bc0[_0xc691('0x20')]=_0x33f2db[_0xc691('0x21')];for(_0x32eadb=0x0;_0x32eadb<_0x2da4ab['length'];_0x32eadb++){if(_0x2da4ab[_0x32eadb]['internalemailaddress']===_0x33f2db[_0xc691('0x21')]&&!_0x2da4ab[_0x32eadb][_0xc691('0x22')]){_0x39d394=!![];logger[_0xc691('0x23')]('['+[_0x22f0c9['toUpperCase']()]+_0xc691('0x24')+_0x2da4ab[_0x32eadb][_0xc691('0x25')]+'!');_0x518bc0[_0xc691('0x26')]=_0x2da4ab[_0x32eadb][_0xc691('0x25')];}}}}if(!_0x39d394){logger[_0xc691('0x23')]('['+[_0x22f0c9[_0xc691('0x17')]()]+_0xc691('0x27'));_0x518bc0[_0xc691('0x20')]=_0x41bf73[_0xc691('0x28')];for(_0x32eadb=0x0;_0x32eadb<_0x2da4ab[_0xc691('0x29')];_0x32eadb++){if(_0x2da4ab[_0x32eadb][_0xc691('0x2a')]===_0x41bf73[_0xc691('0x28')]){_0x518bc0[_0xc691('0x26')]=_0x2da4ab[_0x32eadb][_0xc691('0x25')];}}}_0x225a6b(_0x518bc0);})['catch'](function(_0x47fa89){_0x29d1a7(_0x47fa89[_0xc691('0x19')]);});});}function createEndUser(_0x3a0901,_0x13c2e5,_0x3b5dc2,_0x5511b9,_0x3d213d,_0x1e7650){return new Promise(function(_0x247672,_0x45812b){return getAuthToken(_0x13c2e5,_0x3b5dc2,_0x1e7650)['then'](function(_0x3ae558){var _0x517bc7=_0x1e7650[_0xc691('0x2b')]()==='outbound'?_0x3d213d[_0xc691('0x2c')]:_0x3d213d['calleridnum'];var _0x5d08e2={'method':_0xc691('0x10'),'uri':_0x5511b9+_0xc691('0x2d'),'body':{'telephone1':_0x517bc7,'fullname':_0x517bc7,'firstname':_0x517bc7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc691('0x2e')+_0x3a0901['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x3ae558,'OData-Version':_0xc691('0x1c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5d08e2);})[_0xc691('0x13')](function(_0x3daa49){var _0x516fc1=_0x3daa49[_0xc691('0x2f')][_0xc691('0x30')];var _0xb2614f=_0x516fc1[_0xc691('0x31')](_0x516fc1[_0xc691('0x32')]('(')+0x1,_0x516fc1['lastIndexOf'](')'));_0x3a0901[_0xc691('0x33')]=_0xb2614f;_0x247672(_0x3a0901);})['catch'](function(_0x3bfa5e){_0x45812b(_0x3bfa5e[_0xc691('0x19')]);});});}function getEndUser(_0x165b83,_0x170094,_0x2d3c09,_0x55613b,_0x403b84,_0x12f2ff,_0x3cc189,_0x1e9901){var _0x4724a8=_0x12f2ff[_0xc691('0x2b')]()==='outbound'?_0x403b84['destcalleridnum']:_0x403b84[_0xc691('0x34')];return getAuthToken(_0x170094,_0x2d3c09,_0x12f2ff)[_0xc691('0x13')](function(_0x1ca680){_0x1e9901=_0x1e9901?_0x1e9901:_0xc691('0x35');var _0x2afb55={'method':_0xc691('0x1a'),'uri':_0x55613b+'contacts?$select='+_0x1e9901+'&$filter='+_0x1e9901+'\x20eq\x20\x27'+_0x4724a8['replace']('+',_0xc691('0x36'))+'\x27','headers':{'Authorization':_0xc691('0x37')+_0x1ca680,'If-None-Match':null,'OData-Version':_0xc691('0x1c')},'json':!![]};return rp(_0x2afb55);})[_0xc691('0x13')](function(_0xdcdee0){var _0x1f239d=![];if(!_0xdcdee0)return _0x1f239d;var _0x5e2dba=_0xdcdee0[_0xc691('0x1d')];for(var _0x25c83d=0x0;_0x25c83d<_0x5e2dba[_0xc691('0x29')];_0x25c83d++){if(_0x5e2dba[_0x25c83d]['additionalSearchContact']===_0x4724a8){_0x1f239d=!![];_0x165b83[_0xc691('0x33')]=_0x5e2dba[_0x25c83d]['contactid'];}}return _0x1f239d;})[_0xc691('0x13')](function(_0x541f43){if(_0x541f43)return _0x165b83;if(_0x3cc189===_0xc691('0x38')){logger['info']('['+[_0x12f2ff['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x165b83;}return createEndUser(_0x165b83,_0x170094,_0x2d3c09,_0x55613b,_0x403b84,_0x12f2ff)[_0xc691('0x13')](function(_0x357d5b){logger[_0xc691('0x23')]('['+[_0x12f2ff[_0xc691('0x17')]()]+_0xc691('0x39'),_0x357d5b[_0xc691('0x33')]);return _0x357d5b;});});}function getCustomFields(_0x45164f,_0x18ac59,_0x272c85){var _0x4bbc6e={};if(_0x45164f[_0xc691('0x29')]>0x0){_[_0xc691('0x3a')](_0x45164f,function(_0x281b6d){if(_[_0xc691('0x3b')]([_0xc691('0x3c'),'picklist'],_0x281b6d[_0xc691('0x3d')])&&_0x281b6d[_0xc691('0x3e')]&&!_0x281b6d['customField']){var _0x8bf003=_0x281b6d['idField'][_0xc691('0x2b')]();var _0x19ec31=_0x8bf003[_0xc691('0x31')](0x0,_0x8bf003['indexOf']('_'));var _0x56c0c3=_0x8bf003[_0xc691('0x31')](_0x8bf003[_0xc691('0x3f')]('_')+0x1);if(_0x19ec31===_0x272c85){_0x4bbc6e[_0x56c0c3]=_0x281b6d[_0xc691('0x40')];}}});}return _0x4bbc6e;}function getTicket(_0xacfcb2,_0x3b9354,_0x20e390,_0xea05ee,_0x29ccb3,_0x1af436,_0x195657){return new Promise(function(_0x41818f,_0xdd3ed3){var _0x5e1268;return getAuthToken(_0x3b9354,_0x20e390,_0x195657)[_0xc691('0x13')](function(_0x21be00){if(_0x1af436['ticketType']===_0xc691('0x41')){_0x5e1268={'method':'POST','uri':_0xea05ee+_0xc691('0x42'),'body':Object[_0xc691('0x43')]({},{'title':intUtil['getString'](_0x1af436[_0xc691('0x44')],_0x29ccb3,'\x20'),'description':intUtil[_0xc691('0x45')](_0x1af436[_0xc691('0x46')],_0x29ccb3,'\x0a'),'customerid_contact@odata.bind':_0xacfcb2['enduserId']?'/contacts('+_0xacfcb2[_0xc691('0x33')]+')':undefined,'ownerid@odata.bind':_0xc691('0x2e')+_0xacfcb2[_0xc691('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x1af436[_0xc691('0x47')],_0x29ccb3,_0x1af436['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x21be00,'OData-Version':_0xc691('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1af436['ticketType']===_0xc691('0x48')){var _0x3a6a8d=_0xacfcb2['enduserId']?[{'partyid_systemuser@odata.bind':_0xc691('0x2e')+_0xacfcb2['userId']+')','participationtypemask':_0xacfcb2[_0xc691('0x49')]===_0xc691('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0xacfcb2[_0xc691('0x33')]+')','participationtypemask':_0xacfcb2['callDirection']===_0xc691('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0xacfcb2['userId']+')','participationtypemask':_0xacfcb2[_0xc691('0x49')]===_0xc691('0x4a')?0x2:0x1}];_0x5e1268={'method':_0xc691('0x10'),'uri':_0xea05ee+_0xc691('0x4b'),'body':Object[_0xc691('0x43')]({},{'subject':intUtil[_0xc691('0x45')](_0x1af436[_0xc691('0x44')],_0x29ccb3,'\x20'),'phonenumber':String(_0x29ccb3[_0xc691('0x34')]),'description':intUtil[_0xc691('0x45')](_0x1af436[_0xc691('0x46')],_0x29ccb3,'\x0a'),'regardingobjectid_contact@odata.bind':_0xacfcb2[_0xc691('0x33')]?'/contacts('+_0xacfcb2[_0xc691('0x33')]+')':undefined,'ownerid@odata.bind':_0xc691('0x2e')+_0xacfcb2[_0xc691('0x26')]+')','directioncode':_0xacfcb2['callDirection']===_0xc691('0x4a')?![]:!![],'phonecall_activity_parties':_0x3a6a8d},getCustomFields(_0x1af436[_0xc691('0x47')],_0x29ccb3,_0x1af436[_0xc691('0x4c')])),'headers':{'Authorization':_0xc691('0x37')+_0x21be00,'OData-Version':_0xc691('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5e1268);})[_0xc691('0x13')](function(_0x78ae){var _0x182426=_0x78ae[_0xc691('0x2f')]['odata-entityid'];var _0x3322a5=_0x182426[_0xc691('0x31')](_0x182426[_0xc691('0x32')]('(')+0x1,_0x182426['lastIndexOf'](')'));_0xacfcb2[_0xc691('0x4d')]=_0x3322a5;_0x41818f(_0xacfcb2);})['catch'](function(_0xeda0a6){_0xdd3ed3(_0xeda0a6['message']);});});}function emit(_0x40d7d4,_0x351913,_0x3942b2,_0x2072af){var _0x16160f={'uri':util[_0xc691('0x4e')](_0xc691('0x4f'),_0x40d7d4,_0x3942b2,_0x2072af)};io['to'](util[_0xc691('0x4e')]('user:%s',_0x351913))[_0xc691('0x50')]('trigger:browser:url',_0x16160f);}exports['cs']=function(_0x5d82dc,_0x3c7bc7,_0x3fa158,_0xd8095,_0x137e0c,_0x1ac493,_0x130be0,_0x3c393f){var _0x26f840={};_0x1ac493[_0xc691('0xb')]=_0x1ac493[_0xc691('0xa')]?intUtil[_0xc691('0x51')](_0x1ac493[_0xc691('0xc')][_0xc691('0xd')]):intUtil[_0xc691('0x51')](_0x1ac493[_0xc691('0xb')]);_0x1ac493[_0xc691('0x52')]=intUtil[_0xc691('0x51')](_0x1ac493[_0xc691('0x52')]);_0x26f840[_0xc691('0x49')]=_0x3c393f==='queue'||_0x3c393f===_0xc691('0x53')?'queue':_0xc691('0x54');var _0x94bc42=_0x1ac493[_0xc691('0xa')]?util['format'](_0xc691('0x55'),_0x1ac493['CloudProvider'][_0xc691('0xd')]):util[_0xc691('0x4e')]('%s/api/data/v9.0/',_0x1ac493['remoteUri']);var _0x3de3c3=util[_0xc691('0x4e')](_0xc691('0x56'),_0x1ac493[_0xc691('0xe')]);var _0x5b7ba3=util[_0xc691('0x4e')](_0xc691('0x57'),_0x1ac493[_0xc691('0x52')],_0x3c7bc7[_0xc691('0x58')],md5(_0x3c7bc7[_0xc691('0x58')]));if(_0x137e0c&&_0x137e0c[_0xc691('0x59')]){logger[_0xc691('0x23')](_0xc691('0x5a'),_0xc691('0x5b'));_0x3c7bc7[_0xc691('0x5c')]=_0x5b7ba3;}else if(_0x130be0&&_0x130be0[_0xc691('0x5d')]&&_0x130be0['recordingFormat']!==_0xc691('0x5e')){logger[_0xc691('0x23')](_0xc691('0x5f'),_0xc691('0x5b'));_0x3c7bc7['recordingURL']=_0x5b7ba3;}else{_0x3c7bc7[_0xc691('0x5c')]='';}return getUser(_0x26f840,_0x1ac493,_0xd8095,_0x3de3c3,_0x94bc42,_0x3c393f)[_0xc691('0x13')](function(_0x528417){logger['info']('['+_0x3c393f[_0xc691('0x17')]()+']\x20The\x20User\x20ID\x20is:',_0x528417[_0xc691('0x26')]);logger[_0xc691('0x23')]('['+_0x3c393f[_0xc691('0x17')]()+']\x20The\x20User\x20email\x20is:',_0x528417[_0xc691('0x20')]);return getEndUser(_0x528417,_0x1ac493,_0x3de3c3,_0x94bc42,_0x3c7bc7,_0x3c393f,_0x3fa158['moduleCreate'],_0x3fa158['additionalSearchContact']);})[_0xc691('0x13')](function(_0x313376){logger[_0xc691('0x23')]('['+_0x3c393f['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x313376[_0xc691('0x33')]);logger[_0xc691('0x23')]('['+_0x3c393f[_0xc691('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x3c7bc7[_0xc691('0x34')]);return getTicket(_0x313376,_0x1ac493,_0x3de3c3,_0x94bc42,_0x3c7bc7,_0x3fa158,_0x3c393f);})[_0xc691('0x13')](function(_0x523ed1){logger[_0xc691('0x23')](util[_0xc691('0x4e')]('['+_0x3c393f[_0xc691('0x17')]()+_0xc691('0x60'),_0x3fa158['ticketType'],_0x523ed1[_0xc691('0x4d')]));logger['info'](util[_0xc691('0x4e')]('['+_0x3c393f[_0xc691('0x17')]()+_0xc691('0x61'),_0x3c393f));if(_0x3c393f!==_0xc691('0x53')){logger[_0xc691('0x23')]('['+_0x3c393f[_0xc691('0x17')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1ac493[_0xc691('0xb')],_0xd8095[_0xc691('0x62')],_0x3fa158['ticketType'],_0x523ed1['ticketId']);}})[_0xc691('0x15')](function(_0x31ad86){logger['error']('['+_0x3c393f[_0xc691('0x17')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x31ad86[_0xc691('0x19')]);});}; \ No newline at end of file +var _0x48d2=['format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','data2','POST','clientId','remoteUri','username','password','then','catch','error','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','email','userEmail','length','internalemailaddress','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','calleridnum','contacts','/systemusers(','4.0','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','&$filter=','additionalSearchContact','nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','headers','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48d2,0x1c4));var _0x248d=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x48d2[_0x311909];return _0x8d3163;};'use strict';var _=require(_0x248d('0x0'));var rp=require(_0x248d('0x1'));var util=require('util');var intUtil=require(_0x248d('0x2'));var md5=require(_0x248d('0x3'));var Redis=require(_0x248d('0x4'));var logger=require(_0x248d('0x5'))(_0x248d('0x6'));var config=require(_0x248d('0x7'));config[_0x248d('0x8')]=_[_0x248d('0x9')](config[_0x248d('0x8')],{'host':_0x248d('0xa'),'port':0x18eb});var io=require(_0x248d('0xb'))(new Redis(config[_0x248d('0x8')]));function getAuthToken(_0x2eb12e,_0x5c3750,_0x10e8fc){if(_0x2eb12e[_0x248d('0xc')]){_0x2eb12e['remoteUri']=_0x2eb12e[_0x248d('0xd')][_0x248d('0xe')];_0x2eb12e[_0x248d('0xf')]=_0x2eb12e[_0x248d('0xd')][_0x248d('0x10')];return Promise['resolve'](_0x2eb12e[_0x248d('0xd')]['data5']);}var _0x9bc7bb={'method':_0x248d('0x11'),'uri':_0x5c3750,'form':{'client_id':_0x2eb12e[_0x248d('0x12')],'resource':_0x2eb12e[_0x248d('0x13')],'username':_0x2eb12e[_0x248d('0x14')],'password':_0x2eb12e[_0x248d('0x15')],'grant_type':_0x248d('0x15'),'client_secret':_0x2eb12e['clientSecret']},'json':!![]};return rp(_0x9bc7bb)[_0x248d('0x16')](function(_0x4c4292){return _0x4c4292['access_token'];})[_0x248d('0x17')](function(_0xadde){logger[_0x248d('0x18')]('['+[_0x10e8fc['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0xadde[_0x248d('0x19')];});}function getUser(_0x2b75ac,_0x128136,_0x33b5ed,_0x14f6fc,_0xb0edaf,_0x5105f0){return new Promise(function(_0x4a7216,_0x2767bc){return getAuthToken(_0x128136,_0x14f6fc,_0x5105f0)[_0x248d('0x16')](function(_0x10d48c){var _0x159ff9={'method':'GET','uri':_0xb0edaf+_0x248d('0x1a'),'headers':{'Authorization':_0x248d('0x1b')+_0x10d48c,'OData-Version':'4.0'},'json':!![]};return rp(_0x159ff9);})[_0x248d('0x16')](function(_0x485cee){var _0x505f25=_0x485cee[_0x248d('0x1c')];var _0x10da4a=![];var _0x594c83=null;if(!_[_0x248d('0x1d')](_0x33b5ed)){if(intUtil['validateEmail'](_0x33b5ed[_0x248d('0x1e')])){_0x2b75ac[_0x248d('0x1f')]=_0x33b5ed[_0x248d('0x1e')];for(_0x594c83=0x0;_0x594c83<_0x505f25[_0x248d('0x20')];_0x594c83++){if(_0x505f25[_0x594c83][_0x248d('0x21')]===_0x33b5ed[_0x248d('0x1e')]&&!_0x505f25[_0x594c83][_0x248d('0x22')]){_0x10da4a=!![];logger['info']('['+[_0x5105f0[_0x248d('0x23')]()]+_0x248d('0x24')+_0x505f25[_0x594c83][_0x248d('0x25')]+'!');_0x2b75ac[_0x248d('0x26')]=_0x505f25[_0x594c83][_0x248d('0x25')];}}}}if(!_0x10da4a){logger[_0x248d('0x27')]('['+[_0x5105f0['toUpperCase']()]+_0x248d('0x28'));_0x2b75ac[_0x248d('0x1f')]=_0x128136[_0x248d('0x14')];for(_0x594c83=0x0;_0x594c83<_0x505f25[_0x248d('0x20')];_0x594c83++){if(_0x505f25[_0x594c83][_0x248d('0x21')]===_0x128136[_0x248d('0x14')]){_0x2b75ac['userId']=_0x505f25[_0x594c83][_0x248d('0x25')];}}}_0x4a7216(_0x2b75ac);})['catch'](function(_0x24e47d){_0x2767bc(_0x24e47d['message']);});});}function createEndUser(_0x38216f,_0x3894bf,_0x421e7d,_0xffdd7,_0x1ac163,_0x153a9a){return new Promise(function(_0x5cd994,_0x29eacf){return getAuthToken(_0x3894bf,_0x421e7d,_0x153a9a)[_0x248d('0x16')](function(_0x5f3633){var _0x238ae2=_0x153a9a[_0x248d('0x29')]()===_0x248d('0x2a')?_0x1ac163['destcalleridnum']:_0x1ac163[_0x248d('0x2b')];var _0x155735={'method':'POST','uri':_0xffdd7+_0x248d('0x2c'),'body':{'telephone1':_0x238ae2,'fullname':_0x238ae2,'firstname':_0x238ae2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x248d('0x2d')+_0x38216f[_0x248d('0x26')]+')'},'headers':{'Authorization':_0x248d('0x1b')+_0x5f3633,'OData-Version':_0x248d('0x2e')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x155735);})[_0x248d('0x16')](function(_0x181a8b){var _0xeac9c4=_0x181a8b['headers'][_0x248d('0x2f')];var _0x3e2029=_0xeac9c4[_0x248d('0x30')](_0xeac9c4['lastIndexOf']('(')+0x1,_0xeac9c4[_0x248d('0x31')](')'));_0x38216f[_0x248d('0x32')]=_0x3e2029;_0x5cd994(_0x38216f);})[_0x248d('0x17')](function(_0x475ce6){_0x29eacf(_0x475ce6[_0x248d('0x19')]);});});}function getEndUser(_0x54cb3d,_0x4d5d27,_0xb9053a,_0x2f449e,_0x5ed3d3,_0x362960,_0x5438b0,_0x59ecea){var _0x589890=_0x362960[_0x248d('0x29')]()===_0x248d('0x2a')?_0x5ed3d3[_0x248d('0x33')]:_0x5ed3d3[_0x248d('0x2b')];return getAuthToken(_0x4d5d27,_0xb9053a,_0x362960)['then'](function(_0x39d13f){_0x59ecea=_0x59ecea?_0x59ecea:_0x248d('0x34');var _0x57d0d3={'method':'GET','uri':_0x2f449e+_0x248d('0x35')+_0x59ecea+_0x248d('0x36')+_0x59ecea+'\x20eq\x20\x27'+_0x589890['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x248d('0x1b')+_0x39d13f,'If-None-Match':null,'OData-Version':_0x248d('0x2e')},'json':!![]};return rp(_0x57d0d3);})['then'](function(_0x11d7d5){var _0x1ad730=![];if(!_0x11d7d5)return _0x1ad730;var _0x2738d5=_0x11d7d5['value'];for(var _0x53d1a9=0x0;_0x53d1a9<_0x2738d5[_0x248d('0x20')];_0x53d1a9++){if(_0x2738d5[_0x53d1a9][_0x248d('0x37')]===_0x589890){_0x1ad730=!![];_0x54cb3d[_0x248d('0x32')]=_0x2738d5[_0x53d1a9]['contactid'];}}return _0x1ad730;})[_0x248d('0x16')](function(_0xee110){if(_0xee110)return _0x54cb3d;if(_0x5438b0===_0x248d('0x38')){logger[_0x248d('0x27')]('['+[_0x362960[_0x248d('0x23')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x54cb3d;}return createEndUser(_0x54cb3d,_0x4d5d27,_0xb9053a,_0x2f449e,_0x5ed3d3,_0x362960)[_0x248d('0x16')](function(_0x21ef9c){logger['info']('['+[_0x362960['toUpperCase']()]+_0x248d('0x39'),_0x21ef9c[_0x248d('0x32')]);return _0x21ef9c;});});}function getCustomFields(_0x167166,_0x16b607,_0x5a8b17){var _0x52ba6c={};if(_0x167166[_0x248d('0x20')]>0x0){_[_0x248d('0x3a')](_0x167166,function(_0x3d87a8){if(_[_0x248d('0x3b')]([_0x248d('0x3c'),_0x248d('0x3d')],_0x3d87a8['type'])&&_0x3d87a8[_0x248d('0x3e')]&&!_0x3d87a8[_0x248d('0x3f')]){var _0x80fce2=_0x3d87a8[_0x248d('0x40')][_0x248d('0x29')]();var _0x247ec4=_0x80fce2[_0x248d('0x30')](0x0,_0x80fce2[_0x248d('0x41')]('_'));var _0x159e1f=_0x80fce2[_0x248d('0x30')](_0x80fce2[_0x248d('0x41')]('_')+0x1);if(_0x247ec4===_0x5a8b17){_0x52ba6c[_0x159e1f]=_0x3d87a8[_0x248d('0x42')];}}});}return _0x52ba6c;}function getTicket(_0x4f0e4b,_0x2190e8,_0xa8b679,_0x1194fd,_0x164da6,_0x451bba,_0x470ce6){return new Promise(function(_0x357120,_0x350ca3){var _0x5c3b61;return getAuthToken(_0x2190e8,_0xa8b679,_0x470ce6)[_0x248d('0x16')](function(_0x53d8a2){if(_0x451bba[_0x248d('0x43')]===_0x248d('0x44')){_0x5c3b61={'method':_0x248d('0x11'),'uri':_0x1194fd+'incidents','body':Object[_0x248d('0x45')]({},{'title':intUtil[_0x248d('0x46')](_0x451bba[_0x248d('0x47')],_0x164da6,'\x20'),'description':intUtil[_0x248d('0x46')](_0x451bba[_0x248d('0x48')],_0x164da6,'\x0a'),'customerid_contact@odata.bind':_0x4f0e4b[_0x248d('0x32')]?'/contacts('+_0x4f0e4b['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4f0e4b[_0x248d('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x451bba[_0x248d('0x49')],_0x164da6,_0x451bba[_0x248d('0x43')])),'headers':{'Authorization':_0x248d('0x1b')+_0x53d8a2,'OData-Version':_0x248d('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x451bba[_0x248d('0x43')]===_0x248d('0x4a')){var _0x418b81=_0x4f0e4b[_0x248d('0x32')]?[{'partyid_systemuser@odata.bind':_0x248d('0x2d')+_0x4f0e4b[_0x248d('0x26')]+')','participationtypemask':_0x4f0e4b[_0x248d('0x4b')]===_0x248d('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x248d('0x4d')+_0x4f0e4b[_0x248d('0x32')]+')','participationtypemask':_0x4f0e4b['callDirection']===_0x248d('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x248d('0x2d')+_0x4f0e4b[_0x248d('0x26')]+')','participationtypemask':_0x4f0e4b['callDirection']===_0x248d('0x4c')?0x2:0x1}];_0x5c3b61={'method':'POST','uri':_0x1194fd+_0x248d('0x4e'),'body':Object[_0x248d('0x45')]({},{'subject':intUtil[_0x248d('0x46')](_0x451bba[_0x248d('0x47')],_0x164da6,'\x20'),'phonenumber':String(_0x164da6['calleridnum']),'description':intUtil[_0x248d('0x46')](_0x451bba['Descriptions'],_0x164da6,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4f0e4b[_0x248d('0x32')]?_0x248d('0x4d')+_0x4f0e4b[_0x248d('0x32')]+')':undefined,'ownerid@odata.bind':_0x248d('0x2d')+_0x4f0e4b[_0x248d('0x26')]+')','directioncode':_0x4f0e4b[_0x248d('0x4b')]===_0x248d('0x4c')?![]:!![],'phonecall_activity_parties':_0x418b81},getCustomFields(_0x451bba[_0x248d('0x49')],_0x164da6,_0x451bba[_0x248d('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x53d8a2,'OData-Version':_0x248d('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5c3b61);})[_0x248d('0x16')](function(_0x219202){var _0x5208f1=_0x219202[_0x248d('0x4f')][_0x248d('0x2f')];var _0x47cd0b=_0x5208f1[_0x248d('0x30')](_0x5208f1[_0x248d('0x31')]('(')+0x1,_0x5208f1[_0x248d('0x31')](')'));_0x4f0e4b[_0x248d('0x50')]=_0x47cd0b;_0x357120(_0x4f0e4b);})[_0x248d('0x17')](function(_0x373ca7){_0x350ca3(_0x373ca7['message']);});});}function emit(_0x5989ef,_0x52c333,_0x365493,_0x5447be){var _0x3259c1={'uri':util['format'](_0x248d('0x51'),_0x5989ef,_0x365493,_0x5447be)};io['to'](util['format'](_0x248d('0x52'),_0x52c333))[_0x248d('0x53')](_0x248d('0x54'),_0x3259c1);}exports['cs']=function(_0x625b91,_0x35f9f3,_0x448e88,_0x36b1f6,_0x478ed1,_0x7a9ad,_0x47c397,_0x3b2833){var _0x2c8685={};_0x7a9ad[_0x248d('0x13')]=_0x7a9ad['modernAuthentication']?intUtil[_0x248d('0x55')](_0x7a9ad[_0x248d('0xd')][_0x248d('0xe')]):intUtil[_0x248d('0x55')](_0x7a9ad[_0x248d('0x13')]);_0x7a9ad[_0x248d('0x56')]=intUtil[_0x248d('0x55')](_0x7a9ad['serverUrl']);_0x2c8685['callDirection']=_0x3b2833===_0x248d('0x4c')||_0x3b2833===_0x248d('0x57')?_0x248d('0x4c'):_0x248d('0x2a');var _0x5d9668=_0x7a9ad['modernAuthentication']?util[_0x248d('0x58')](_0x248d('0x59'),_0x7a9ad[_0x248d('0xd')][_0x248d('0xe')]):util[_0x248d('0x58')]('%s/api/data/v9.0/',_0x7a9ad[_0x248d('0x13')]);var _0x3edd16=util[_0x248d('0x58')](_0x248d('0x5a'),_0x7a9ad[_0x248d('0xf')]);var _0x565f0b=util['format'](_0x248d('0x5b'),_0x7a9ad[_0x248d('0x56')],_0x35f9f3[_0x248d('0x5c')],md5(_0x35f9f3[_0x248d('0x5c')]));if(_0x478ed1&&_0x478ed1[_0x248d('0x5d')]){logger[_0x248d('0x27')](_0x248d('0x5e'),'Recording\x20is\x20enabled!');_0x35f9f3[_0x248d('0x5f')]=_0x565f0b;}else if(_0x47c397&&_0x47c397[_0x248d('0x60')]&&_0x47c397[_0x248d('0x60')]!=='none'){logger[_0x248d('0x27')](_0x248d('0x61'),_0x248d('0x62'));_0x35f9f3[_0x248d('0x5f')]=_0x565f0b;}else{_0x35f9f3[_0x248d('0x5f')]='';}return getUser(_0x2c8685,_0x7a9ad,_0x36b1f6,_0x3edd16,_0x5d9668,_0x3b2833)[_0x248d('0x16')](function(_0x466bc2){logger[_0x248d('0x27')]('['+_0x3b2833[_0x248d('0x23')]()+_0x248d('0x63'),_0x466bc2[_0x248d('0x26')]);logger[_0x248d('0x27')]('['+_0x3b2833[_0x248d('0x23')]()+_0x248d('0x64'),_0x466bc2['userEmail']);return getEndUser(_0x466bc2,_0x7a9ad,_0x3edd16,_0x5d9668,_0x35f9f3,_0x3b2833,_0x448e88[_0x248d('0x65')],_0x448e88[_0x248d('0x37')]);})[_0x248d('0x16')](function(_0x1a9f3e){logger['info']('['+_0x3b2833[_0x248d('0x23')]()+_0x248d('0x66'),_0x1a9f3e['enduserId']);logger[_0x248d('0x27')]('['+_0x3b2833[_0x248d('0x23')]()+_0x248d('0x67'),_0x35f9f3[_0x248d('0x2b')]);return getTicket(_0x1a9f3e,_0x7a9ad,_0x3edd16,_0x5d9668,_0x35f9f3,_0x448e88,_0x3b2833);})[_0x248d('0x16')](function(_0x4ecc5e){logger[_0x248d('0x27')](util[_0x248d('0x58')]('['+_0x3b2833[_0x248d('0x23')]()+_0x248d('0x68'),_0x448e88[_0x248d('0x43')],_0x4ecc5e[_0x248d('0x50')]));logger[_0x248d('0x27')](util[_0x248d('0x58')]('['+_0x3b2833[_0x248d('0x23')]()+_0x248d('0x69'),_0x3b2833));if(_0x3b2833!==_0x248d('0x57')){logger[_0x248d('0x27')]('['+_0x3b2833[_0x248d('0x23')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x7a9ad[_0x248d('0x13')],_0x36b1f6[_0x248d('0x6a')],_0x448e88[_0x248d('0x43')],_0x4ecc5e[_0x248d('0x50')]);}})[_0x248d('0x17')](function(_0x19c1b2){logger[_0x248d('0x18')]('['+_0x3b2833['toUpperCase']()+_0x248d('0x6b'),_0x19c1b2[_0x248d('0x19')]);});}; \ 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 1c4a23b..e102518 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 _0x294f=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','Creating\x20new\x20ticket...','format','calleridnum','getString','Descriptions','
','Tags','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','POST','then','info','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','push','content','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:'];(function(_0x103206,_0x1fae01){var _0x2e2f53=function(_0x34f7ca){while(--_0x34f7ca){_0x103206['push'](_0x103206['shift']());}};_0x2e2f53(++_0x1fae01);}(_0x294f,0x186));var _0xf294=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x294f[_0x22bdd3];return _0x44d9d9;};'use strict';var _=require('lodash');var rp=require(_0xf294('0x0'));var md5=require('md5');var util=require(_0xf294('0x1'));var Redis=require(_0xf294('0x2'));var intUtil=require(_0xf294('0x3'));var config=require(_0xf294('0x4'));var logger=require(_0xf294('0x5'))(_0xf294('0x6'));config[_0xf294('0x7')]=_[_0xf294('0x8')](config[_0xf294('0x7')],{'host':_0xf294('0x9'),'port':0x18eb});var io=require(_0xf294('0xa'))(new Redis(config[_0xf294('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x3fd33e,_0x200e5f,_0x4aa5b1){io['to'](_0x3fd33e)['emit'](_0x200e5f,_0x4aa5b1);}function getTicket(_0x1162fb,_0x120acc,_0x5dd18f,_0x253857,_0x5c2e0d){logger['info'](_0xf294('0xb'));var _0x477743=_['merge']({'responder_id':_0x120acc['id'],'requester_id':_0x5dd18f['id'],'name':util[_0xf294('0xc')]('Caller\x20-\x20%s',_0x5c2e0d['calleridname']),'phone':_0x5c2e0d[_0xf294('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf294('0xe')](_0x253857['Subjects'],_0x5c2e0d,'\x20'),'description':intUtil[_0xf294('0xe')](_0x253857[_0xf294('0xf')],_0x5c2e0d,_0xf294('0x10')),'tags':getTags(_0x253857[_0xf294('0x11')],'name')},getCustomFields(_0x253857['Fields'],_0x5c2e0d));_0x477743['custom_fields']=_[_0xf294('0x12')](_[_0xf294('0x13')](_0x477743[_0xf294('0x14')],'id'),_0xf294('0x15'));return request({'uri':util[_0xf294('0xc')](_0xf294('0x16'),_0x1162fb['remoteUri']),'method':_0xf294('0x17'),'body':_0x477743})[_0xf294('0x18')](function(_0x37982a){logger[_0xf294('0x19')]('Ticket\x20created!');return _0x37982a;});}function getUser(_0x1659d3,_0x23d286){if(intUtil[_0xf294('0x1a')](_0x23d286)){return request({'uri':util[_0xf294('0xc')](_0xf294('0x1b'),_0x1659d3[_0xf294('0x1c')]),'qs':{'email':_0x23d286}})[_0xf294('0x18')](function(_0x667d7e){if(_0x667d7e[_0xf294('0x1d')]){logger[_0xf294('0x19')](_0xf294('0x1e'));return _[_0xf294('0x1f')](_0x667d7e,function(_0x591609){return _0x591609[_0xf294('0x20')][_0xf294('0x21')]===_0x23d286;});}else{logger[_0xf294('0x19')](_0xf294('0x22'));return request({'uri':util[_0xf294('0xc')](_0xf294('0x23'),_0x1659d3[_0xf294('0x1c')])})['then'](function(_0x5104a9){logger[_0xf294('0x19')](_0xf294('0x24'));return _0x5104a9;});}});}else{logger[_0xf294('0x19')](_0xf294('0x25'));return request({'uri':util['format'](_0xf294('0x23'),_0x1659d3[_0xf294('0x1c')])})['then'](function(_0x525b91){logger[_0xf294('0x19')](_0xf294('0x24'));return _0x525b91;});}}function getEndUser(_0xe0544,_0x5a24e2,_0x522961){logger['info'](_0xf294('0x26'),_0x522961);return request({'uri':util[_0xf294('0xc')](_0xf294('0x27'),_0xe0544['remoteUri']),'qs':{'phone':_0x522961}})[_0xf294('0x18')](function(_0x45683f){if(_0x45683f[_0xf294('0x1d')]){logger['info'](_0xf294('0x28'));return _[_0xf294('0x1f')](_0x45683f,{'phone':_0x522961});}else{logger['info'](_0xf294('0x29'));return request({'uri':util[_0xf294('0xc')]('%s/api/v2/contacts',_0xe0544[_0xf294('0x1c')]),'method':'POST','body':{'name':_0x5a24e2,'phone':_0x522961}})[_0xf294('0x18')](function(_0x2f8b79){logger['info'](_0xf294('0x2a'));return _0x2f8b79;});}});}function getAuth(_0x5b4417){return util[_0xf294('0xc')](_0xf294('0x2b'),new Buffer(_0x5b4417[_0xf294('0x2c')]+':X')[_0xf294('0x2d')]('base64'));}function request(_0x3f6738){logger[_0xf294('0x2e')](_0xf294('0x2f'),JSON[_0xf294('0x30')](_0x3f6738));return rp(_[_0xf294('0x8')](_0x3f6738,{'method':_0xf294('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x1fbd18,_0x1f192a){var _0x39ccea=[];if(_0x1fbd18&&_0x1fbd18[_0xf294('0x1d')]>0x0){_0x39ccea=_['map'](_0x1fbd18,_0x1f192a);}return _0x39ccea;}function getCustomFields(_0x27edd0,_0x56f5c0){var _0x56ea81=[];var _0x1275e6={'custom_fields':[]};if(_0x27edd0[_0xf294('0x1d')]>0x0){_[_0xf294('0x32')](_0x27edd0,function(_0x327a5b){if(_[_0xf294('0x33')]([_0xf294('0x34'),_0xf294('0x35')],_0x327a5b[_0xf294('0x36')])&&_0x327a5b[_0xf294('0x37')]&&!_0x327a5b[_0xf294('0x38')]){_0x1275e6[_0x327a5b[_0xf294('0x37')][_0xf294('0x39')]()]=_0x327a5b['content'][_0xf294('0x2d')]();}else if(_[_0xf294('0x33')]([_0xf294('0x34'),'picklist'],_0x327a5b[_0xf294('0x36')])&&_0x327a5b[_0xf294('0x3a')]&&_0x327a5b[_0xf294('0x38')]){_0x1275e6[_0xf294('0x14')][_0xf294('0x3b')]({'id':_0x327a5b[_0xf294('0x3a')],'value':_0x327a5b[_0xf294('0x3c')][_0xf294('0x2d')]()});}else if(_0x327a5b[_0xf294('0x36')]===_0xf294('0x3d')&&_0x327a5b['variableName']&&_0x327a5b[_0xf294('0x3a')]&&_0x327a5b[_0xf294('0x38')]){_0x56f5c0[_0x327a5b[_0xf294('0x3e')]]&&_0x1275e6['custom_fields'][_0xf294('0x3b')]({'id':_0x327a5b[_0xf294('0x3a')],'value':_0x56f5c0[_0x327a5b[_0xf294('0x3e')]]['toString']()});}else if(_0x327a5b[_0xf294('0x36')]===_0xf294('0x3f')&&_0x327a5b['Variable']&&_0x327a5b[_0xf294('0x40')][_0xf294('0x41')]&&_0x327a5b['idField']&&_0x327a5b[_0xf294('0x38')]){_0x56f5c0[_0x327a5b[_0xf294('0x40')]['name'][_0xf294('0x39')]()]&&_0x1275e6[_0xf294('0x14')][_0xf294('0x3b')]({'id':_0x327a5b['idField'],'value':_0x56f5c0[_0x327a5b[_0xf294('0x40')][_0xf294('0x41')][_0xf294('0x39')]()][_0xf294('0x2d')]()});}});}return _0x1275e6;}exports[_0xf294('0x42')]=function(_0x2e0b27,_0x220c0c,_0x1b12a3,_0x4cb2be,_0x15eae1,_0x581bea){var _0x5ba9f3,_0x152595;_0x581bea['remoteUri']=intUtil[_0xf294('0x43')](_0x581bea[_0xf294('0x1c')]);_0x581bea[_0xf294('0x44')]=intUtil[_0xf294('0x43')](_0x581bea[_0xf294('0x44')]);if(_0x15eae1&&_0x15eae1[_0xf294('0x45')]){logger[_0xf294('0x19')]('[QUEUE]',_0xf294('0x46'));_0x220c0c[_0xf294('0x47')]=util[_0xf294('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x581bea['serverUrl'],_0x220c0c[_0xf294('0x48')],md5(_0x220c0c['uniqueid']));}else{_0x220c0c[_0xf294('0x47')]='';}headers[_0xf294('0x49')]=getAuth(_0x581bea);return getUser(_0x581bea,_0x4cb2be[_0xf294('0x21')])['then'](function(_0x137b03){_0x5ba9f3=_0x137b03;logger[_0xf294('0x19')](_0xf294('0x4a'),_0x5ba9f3['id']);return getEndUser(_0x581bea,_0x220c0c['calleridname'],_0x220c0c[_0xf294('0xd')]);})[_0xf294('0x18')](function(_0x1bd632){_0x152595=_0x1bd632;logger[_0xf294('0x19')](_0xf294('0x4b'),_0x152595['id']);return getTicket(_0x581bea,_0x5ba9f3,_0x152595,_0x1b12a3,_0x220c0c);})[_0xf294('0x18')](function(_0x190b73){if(_0x190b73&&_0x190b73['id']){logger[_0xf294('0x19')](_0xf294('0x4c'));logger[_0xf294('0x19')]('The\x20Ticket\x20ID\x20is:',_0x190b73['id']);logger[_0xf294('0x19')](_0xf294('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf294('0xc')](_0xf294('0x4e'),_0x4cb2be[_0xf294('0x41')]),_0xf294('0x4f'),{'uri':util[_0xf294('0xc')](_0xf294('0x50'),_0x581bea[_0xf294('0x1c')],_0x190b73['id'])});}})[_0xf294('0x51')](function(_0x15f54d){logger[_0xf294('0x52')](_0xf294('0x4d'),JSON[_0xf294('0x30')](_0x15f54d));});};exports[_0xf294('0x53')]=function(_0x920449,_0x9595a3,_0x2a9d54,_0x54218e,_0x5650cd,_0x46389c,_0x54b0dc){var _0x4191c4,_0x3d1d22;_0x46389c[_0xf294('0x1c')]=intUtil[_0xf294('0x43')](_0x46389c[_0xf294('0x1c')]);_0x46389c[_0xf294('0x44')]=intUtil[_0xf294('0x43')](_0x46389c[_0xf294('0x44')]);if(_0x54b0dc&&_0x54b0dc[_0xf294('0x54')]&&_0x54b0dc[_0xf294('0x54')]!==_0xf294('0x55')){logger[_0xf294('0x19')](_0xf294('0x56'),'Recording\x20is\x20enabled!');_0x9595a3[_0xf294('0x47')]=util[_0xf294('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46389c['serverUrl'],_0x9595a3['uniqueid'],md5(_0x9595a3[_0xf294('0x48')]));}headers['Authorization']=getAuth(_0x46389c);return getUser(_0x46389c,_0x54218e['email'])[_0xf294('0x18')](function(_0x589cc3){_0x4191c4=_0x589cc3;logger[_0xf294('0x19')](_0xf294('0x4a'),_0x4191c4['id']);return getEndUser(_0x46389c,_0x9595a3[_0xf294('0x57')],_0x9595a3[_0xf294('0x58')]);})[_0xf294('0x18')](function(_0xf6eff8){_0x3d1d22=_0xf6eff8;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3d1d22['id']);return getTicket(_0x46389c,_0x4191c4,_0x3d1d22,_0x2a9d54,_0x9595a3);})['then'](function(_0x1ea57a){if(_0x1ea57a&&_0x1ea57a['id']){logger[_0xf294('0x19')](_0xf294('0x4c'));logger[_0xf294('0x19')](_0xf294('0x59'),_0x1ea57a['id']);logger[_0xf294('0x19')]('[OUTBOUND]',_0xf294('0x5a'));emit(util[_0xf294('0xc')](_0xf294('0x4e'),_0x54218e['name']),'trigger:browser:url',{'uri':util[_0xf294('0xc')]('%s/helpdesk/tickets/%d',_0x46389c['remoteUri'],_0x1ea57a['id'])});}})[_0xf294('0x51')](function(_0x198f21){logger[_0xf294('0x52')](_0xf294('0x56'),JSON[_0xf294('0x30')](_0x198f21));});};exports[_0xf294('0x5b')]=function(_0x21c0ac,_0x2d8362,_0x6440b3,_0x315c86,_0x561741,_0x53ee56){var _0x121460,_0x4c8a01;_0x53ee56[_0xf294('0x1c')]=intUtil[_0xf294('0x43')](_0x53ee56[_0xf294('0x1c')]);_0x53ee56[_0xf294('0x44')]=intUtil[_0xf294('0x43')](_0x53ee56[_0xf294('0x44')]);if(_0x561741&&_0x561741[_0xf294('0x45')]){logger[_0xf294('0x19')]('['+_0x2d8362[_0xf294('0x5c')][_0xf294('0x5d')]()+']',_0xf294('0x46'));_0x2d8362[_0xf294('0x47')]=util[_0xf294('0xc')](_0xf294('0x5e'),_0x53ee56['serverUrl'],_0x2d8362['uniqueid'],md5(_0x2d8362[_0xf294('0x48')]));}else{_0x2d8362[_0xf294('0x47')]='';}headers[_0xf294('0x49')]=getAuth(_0x53ee56);return getUser(_0x53ee56,'')[_0xf294('0x18')](function(_0x4accf1){_0x121460=_0x4accf1;logger[_0xf294('0x19')](_0xf294('0x4a'),_0x121460['id']);return getEndUser(_0x53ee56,_0x2d8362[_0xf294('0x5f')],_0x2d8362['calleridnum']);})[_0xf294('0x18')](function(_0x553def){_0x4c8a01=_0x553def;logger[_0xf294('0x19')](_0xf294('0x4b'),_0x4c8a01['id']);return getTicket(_0x53ee56,_0x121460,_0x4c8a01,_0x6440b3,_0x2d8362);})[_0xf294('0x18')](function(_0x205776){if(_0x205776){logger[_0xf294('0x19')](_0xf294('0x4c'));logger[_0xf294('0x19')](_0xf294('0x59'),_0x205776['id']);}})[_0xf294('0x51')](function(_0x4c761c){logger['error']('['+_0x2d8362['lastevent']['toUpperCase']()+']',JSON[_0xf294('0x30')](_0x4c761c));});}; \ No newline at end of file +var _0x94f5=['email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]','trigger:browser:url','%s/helpdesk/tickets/%d','lastevent','toUpperCase','Authorization','The\x20Enduser\x20ID\x20is:','md5','../../../../config/environment','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','mapValues','custom_fields','value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','toString','[HTTP]','stringify','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','push','content','variable','variableName','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x94f5,0x107));var _0x594f=function(_0x194885,_0x4bf4d4){_0x194885=_0x194885-0x0;var _0x21a494=_0x94f5[_0x194885];return _0x21a494;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x594f('0x0'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x594f('0x1'));var logger=require('../../../../config/logger')(_0x594f('0x2'));config['redis']=_[_0x594f('0x3')](config[_0x594f('0x4')],{'host':_0x594f('0x5'),'port':0x18eb});var io=require(_0x594f('0x6'))(new Redis(config[_0x594f('0x4')]));var headers={'Content-Type':'application/json','Accept':_0x594f('0x7')};function emit(_0x445500,_0x134546,_0xcb0ff2){io['to'](_0x445500)[_0x594f('0x8')](_0x134546,_0xcb0ff2);}function getTicket(_0x132341,_0x1bfa04,_0x4ee18b,_0x202020,_0x5bbed1){logger[_0x594f('0x9')](_0x594f('0xa'));var _0x5a3b02=_[_0x594f('0xb')]({'responder_id':_0x1bfa04['id'],'requester_id':_0x4ee18b['id'],'name':util['format'](_0x594f('0xc'),_0x5bbed1[_0x594f('0xd')]),'phone':_0x5bbed1[_0x594f('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x594f('0xf')](_0x202020[_0x594f('0x10')],_0x5bbed1,'\x20'),'description':intUtil[_0x594f('0xf')](_0x202020[_0x594f('0x11')],_0x5bbed1,_0x594f('0x12')),'tags':getTags(_0x202020[_0x594f('0x13')],_0x594f('0x14'))},getCustomFields(_0x202020[_0x594f('0x15')],_0x5bbed1));_0x5a3b02['custom_fields']=_[_0x594f('0x16')](_['keyBy'](_0x5a3b02[_0x594f('0x17')],'id'),_0x594f('0x18'));return request({'uri':util[_0x594f('0x19')](_0x594f('0x1a'),_0x132341[_0x594f('0x1b')]),'method':'POST','body':_0x5a3b02})[_0x594f('0x1c')](function(_0x54ce28){logger['info'](_0x594f('0x1d'));return _0x54ce28;});}function getUser(_0x85e57c,_0x5b25bb){if(intUtil[_0x594f('0x1e')](_0x5b25bb)){return request({'uri':util[_0x594f('0x19')](_0x594f('0x1f'),_0x85e57c['remoteUri']),'qs':{'email':_0x5b25bb}})[_0x594f('0x1c')](function(_0x4c9257){if(_0x4c9257[_0x594f('0x20')]){logger[_0x594f('0x9')]('Agent\x20found!');return _['find'](_0x4c9257,function(_0x42efb0){return _0x42efb0[_0x594f('0x21')]['email']===_0x5b25bb;});}else{logger['info'](_0x594f('0x22'));return request({'uri':util[_0x594f('0x19')](_0x594f('0x23'),_0x85e57c['remoteUri'])})[_0x594f('0x1c')](function(_0x4529b2){logger['info']('Admin\x20account\x20selected.');return _0x4529b2;});}});}else{logger[_0x594f('0x9')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x594f('0x23'),_0x85e57c['remoteUri'])})[_0x594f('0x1c')](function(_0x487b46){logger[_0x594f('0x9')]('Admin\x20account\x20selected.');return _0x487b46;});}}function getEndUser(_0x4dad7a,_0x241a8d,_0x38c2b0){logger[_0x594f('0x9')]('Searching\x20enduser\x20with\x20phone',_0x38c2b0);return request({'uri':util[_0x594f('0x19')](_0x594f('0x24'),_0x4dad7a['remoteUri']),'qs':{'phone':_0x38c2b0}})[_0x594f('0x1c')](function(_0x22306a){if(_0x22306a[_0x594f('0x20')]){logger[_0x594f('0x9')](_0x594f('0x25'));return _['find'](_0x22306a,{'phone':_0x38c2b0});}else{logger[_0x594f('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x594f('0x19')](_0x594f('0x24'),_0x4dad7a['remoteUri']),'method':'POST','body':{'name':_0x241a8d,'phone':_0x38c2b0}})[_0x594f('0x1c')](function(_0x3988e3){logger[_0x594f('0x9')]('Enduser\x20created.');return _0x3988e3;});}});}function getAuth(_0x43eea0){return util[_0x594f('0x19')](_0x594f('0x26'),new Buffer(_0x43eea0['apiKey']+':X')[_0x594f('0x27')]('base64'));}function request(_0x5a025f){logger['debug'](_0x594f('0x28'),JSON[_0x594f('0x29')](_0x5a025f));return rp(_[_0x594f('0x3')](_0x5a025f,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x39ff1c,_0x12d622){var _0x360bb1=[];if(_0x39ff1c&&_0x39ff1c[_0x594f('0x20')]>0x0){_0x360bb1=_['map'](_0x39ff1c,_0x12d622);}return _0x360bb1;}function getCustomFields(_0x4348c0,_0x18b3e8){var _0x30c850=[];var _0x59c8c1={'custom_fields':[]};if(_0x4348c0[_0x594f('0x20')]>0x0){_[_0x594f('0x2a')](_0x4348c0,function(_0x4367ce){if(_[_0x594f('0x2b')]([_0x594f('0x2c'),_0x594f('0x2d')],_0x4367ce[_0x594f('0x2e')])&&_0x4367ce[_0x594f('0x2f')]&&!_0x4367ce[_0x594f('0x30')]){_0x59c8c1[_0x4367ce[_0x594f('0x2f')][_0x594f('0x31')]()]=_0x4367ce['content']['toString']();}else if(_[_0x594f('0x2b')]([_0x594f('0x2c'),'picklist'],_0x4367ce['type'])&&_0x4367ce[_0x594f('0x32')]&&_0x4367ce['customField']){_0x59c8c1['custom_fields'][_0x594f('0x33')]({'id':_0x4367ce[_0x594f('0x32')],'value':_0x4367ce[_0x594f('0x34')][_0x594f('0x27')]()});}else if(_0x4367ce['type']===_0x594f('0x35')&&_0x4367ce[_0x594f('0x36')]&&_0x4367ce[_0x594f('0x32')]&&_0x4367ce['customField']){_0x18b3e8[_0x4367ce[_0x594f('0x36')]]&&_0x59c8c1[_0x594f('0x17')][_0x594f('0x33')]({'id':_0x4367ce[_0x594f('0x32')],'value':_0x18b3e8[_0x4367ce[_0x594f('0x36')]][_0x594f('0x27')]()});}else if(_0x4367ce['type']===_0x594f('0x37')&&_0x4367ce[_0x594f('0x38')]&&_0x4367ce['Variable'][_0x594f('0x14')]&&_0x4367ce[_0x594f('0x32')]&&_0x4367ce[_0x594f('0x30')]){_0x18b3e8[_0x4367ce[_0x594f('0x38')]['name']['toLowerCase']()]&&_0x59c8c1[_0x594f('0x17')][_0x594f('0x33')]({'id':_0x4367ce[_0x594f('0x32')],'value':_0x18b3e8[_0x4367ce[_0x594f('0x38')][_0x594f('0x14')][_0x594f('0x31')]()][_0x594f('0x27')]()});}});}return _0x59c8c1;}exports['queue']=function(_0x2adf7f,_0x564825,_0x41b7f7,_0x3d9e46,_0x272ab6,_0x66105a){var _0x3776a6,_0x4fb91e;_0x66105a[_0x594f('0x1b')]=intUtil['stripTrailingSlash'](_0x66105a['remoteUri']);_0x66105a[_0x594f('0x39')]=intUtil[_0x594f('0x3a')](_0x66105a[_0x594f('0x39')]);if(_0x272ab6&&_0x272ab6[_0x594f('0x3b')]){logger[_0x594f('0x9')](_0x594f('0x3c'),_0x594f('0x3d'));_0x564825[_0x594f('0x3e')]=util[_0x594f('0x19')](_0x594f('0x3f'),_0x66105a[_0x594f('0x39')],_0x564825[_0x594f('0x40')],md5(_0x564825['uniqueid']));}else{_0x564825[_0x594f('0x3e')]='';}headers['Authorization']=getAuth(_0x66105a);return getUser(_0x66105a,_0x3d9e46[_0x594f('0x41')])[_0x594f('0x1c')](function(_0x2c0bb3){_0x3776a6=_0x2c0bb3;logger[_0x594f('0x9')](_0x594f('0x42'),_0x3776a6['id']);return getEndUser(_0x66105a,_0x564825[_0x594f('0xd')],_0x564825['calleridnum']);})[_0x594f('0x1c')](function(_0x3c6baa){_0x4fb91e=_0x3c6baa;logger[_0x594f('0x9')]('The\x20Enduser\x20ID\x20is:',_0x4fb91e['id']);return getTicket(_0x66105a,_0x3776a6,_0x4fb91e,_0x41b7f7,_0x564825);})['then'](function(_0x3762bc){if(_0x3762bc&&_0x3762bc['id']){logger[_0x594f('0x9')](_0x594f('0x1d'));logger[_0x594f('0x9')](_0x594f('0x43'),_0x3762bc['id']);logger[_0x594f('0x9')](_0x594f('0x3c'),_0x594f('0x44'));emit(util['format'](_0x594f('0x45'),_0x3d9e46[_0x594f('0x14')]),'trigger:browser:url',{'uri':util[_0x594f('0x19')]('%s/helpdesk/tickets/%d',_0x66105a[_0x594f('0x1b')],_0x3762bc['id'])});}})[_0x594f('0x46')](function(_0xc01e0a){logger[_0x594f('0x47')](_0x594f('0x3c'),JSON[_0x594f('0x29')](_0xc01e0a));});};exports['outbound']=function(_0x2a072b,_0x277599,_0x2fad7f,_0x12ca59,_0x2b6fa5,_0x8f47ff,_0x3b7083){var _0x1f76bd,_0x541b7a;_0x8f47ff[_0x594f('0x1b')]=intUtil[_0x594f('0x3a')](_0x8f47ff[_0x594f('0x1b')]);_0x8f47ff[_0x594f('0x39')]=intUtil[_0x594f('0x3a')](_0x8f47ff[_0x594f('0x39')]);if(_0x3b7083&&_0x3b7083[_0x594f('0x48')]&&_0x3b7083[_0x594f('0x48')]!=='none'){logger['info']('[OUTBOUND]',_0x594f('0x3d'));_0x277599['recordingURL']=util['format'](_0x594f('0x3f'),_0x8f47ff[_0x594f('0x39')],_0x277599[_0x594f('0x40')],md5(_0x277599[_0x594f('0x40')]));}headers['Authorization']=getAuth(_0x8f47ff);return getUser(_0x8f47ff,_0x12ca59[_0x594f('0x41')])[_0x594f('0x1c')](function(_0x38c03f){_0x1f76bd=_0x38c03f;logger['info'](_0x594f('0x42'),_0x1f76bd['id']);return getEndUser(_0x8f47ff,_0x277599[_0x594f('0x49')],_0x277599[_0x594f('0x4a')]);})[_0x594f('0x1c')](function(_0x2f634b){_0x541b7a=_0x2f634b;logger[_0x594f('0x9')]('The\x20Enduser\x20ID\x20is:',_0x541b7a['id']);return getTicket(_0x8f47ff,_0x1f76bd,_0x541b7a,_0x2fad7f,_0x277599);})[_0x594f('0x1c')](function(_0x29a564){if(_0x29a564&&_0x29a564['id']){logger[_0x594f('0x9')](_0x594f('0x1d'));logger[_0x594f('0x9')](_0x594f('0x43'),_0x29a564['id']);logger[_0x594f('0x9')](_0x594f('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x594f('0x19')](_0x594f('0x45'),_0x12ca59['name']),_0x594f('0x4c'),{'uri':util[_0x594f('0x19')](_0x594f('0x4d'),_0x8f47ff[_0x594f('0x1b')],_0x29a564['id'])});}})['catch'](function(_0x50ed29){logger['error'](_0x594f('0x4b'),JSON[_0x594f('0x29')](_0x50ed29));});};exports['unmanaged']=function(_0x5efaf1,_0x45cb11,_0x4155a2,_0x466049,_0x3b5b79,_0x1bffea){var _0x5bf224,_0x129f3f;_0x1bffea[_0x594f('0x1b')]=intUtil[_0x594f('0x3a')](_0x1bffea[_0x594f('0x1b')]);_0x1bffea[_0x594f('0x39')]=intUtil[_0x594f('0x3a')](_0x1bffea[_0x594f('0x39')]);if(_0x3b5b79&&_0x3b5b79[_0x594f('0x3b')]){logger[_0x594f('0x9')]('['+_0x45cb11[_0x594f('0x4e')][_0x594f('0x4f')]()+']',_0x594f('0x3d'));_0x45cb11['recordingURL']=util[_0x594f('0x19')](_0x594f('0x3f'),_0x1bffea[_0x594f('0x39')],_0x45cb11[_0x594f('0x40')],md5(_0x45cb11[_0x594f('0x40')]));}else{_0x45cb11[_0x594f('0x3e')]='';}headers[_0x594f('0x50')]=getAuth(_0x1bffea);return getUser(_0x1bffea,'')[_0x594f('0x1c')](function(_0x2378b7){_0x5bf224=_0x2378b7;logger[_0x594f('0x9')]('The\x20User\x20ID\x20is:',_0x5bf224['id']);return getEndUser(_0x1bffea,_0x45cb11[_0x594f('0xd')],_0x45cb11[_0x594f('0xe')]);})['then'](function(_0x544f27){_0x129f3f=_0x544f27;logger[_0x594f('0x9')](_0x594f('0x51'),_0x129f3f['id']);return getTicket(_0x1bffea,_0x5bf224,_0x129f3f,_0x4155a2,_0x45cb11);})[_0x594f('0x1c')](function(_0x3e6ada){if(_0x3e6ada){logger[_0x594f('0x9')]('Ticket\x20created!');logger[_0x594f('0x9')](_0x594f('0x43'),_0x3e6ada['id']);}})[_0x594f('0x46')](function(_0x5bf9f9){logger[_0x594f('0x47')]('['+_0x45cb11[_0x594f('0x4e')]['toUpperCase']()+']',JSON['stringify'](_0x5bf9f9));});}; \ 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 666ce89..4d81c44 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 _0x9cad=['recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','request-promise','md5','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]'];(function(_0x541a15,_0xdbe83e){var _0x5dc464=function(_0x4b0061){while(--_0x4b0061){_0x541a15['push'](_0x541a15['shift']());}};_0x5dc464(++_0xdbe83e);}(_0x9cad,0x1f4));var _0xd9ca=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0x9cad[_0x52a857];return _0x4e2aae;};'use strict';var _=require('lodash');var rp=require(_0xd9ca('0x0'));var md5=require(_0xd9ca('0x1'));var util=require('util');var moment=require('moment');var Promise=require(_0xd9ca('0x2'));var Redis=require(_0xd9ca('0x3'));var intUtil=require(_0xd9ca('0x4'));var config=require('../../../../config/environment');var logger=require(_0xd9ca('0x5'))(_0xd9ca('0x6'));config[_0xd9ca('0x7')]=_[_0xd9ca('0x8')](config[_0xd9ca('0x7')],{'host':_0xd9ca('0x9'),'port':0x18eb});var io=require(_0xd9ca('0xa'))(new Redis(config['redis']));function getAdminId(_0x349258,_0x1f83a7,_0x8627d7,_0x2b5948){return new Promise(function(_0x18918d,_0x22a619){var _0x4f1c06=![];var _0x4ef0a6={'method':_0xd9ca('0xb'),'uri':_0x2b5948+_0xd9ca('0xc'),'json':!![]};_0x4ef0a6['headers']=_0x8627d7;logger[_0xd9ca('0xd')](_0xd9ca('0xe'));return rp(_0x4ef0a6)[_0xd9ca('0xf')](function(_0x46b23e){if(_0x46b23e){var _0x34f898=_0x46b23e[_0xd9ca('0x10')];var _0x4cfb1a=null;for(_0x4cfb1a=0x0;_0x4cfb1a<_0x34f898[_0xd9ca('0x11')];_0x4cfb1a++){if(_0x34f898[_0x4cfb1a][_0xd9ca('0x12')]===_0x349258[_0xd9ca('0x13')]){_0x349258[_0xd9ca('0x14')]=_0x34f898[_0x4cfb1a]['id'];_0x4f1c06=!![];}}if(_0x4f1c06){logger[_0xd9ca('0xd')]('Admin\x20found:',_0x349258[_0xd9ca('0x14')]);_0x18918d(_0x349258);}else{_0x22a619({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x22a619({'statusCode':0x194,'message':_0xd9ca('0x15')});}})[_0xd9ca('0x16')](function(_0x280a61){logger[_0xd9ca('0x17')]('['+[_0x1f83a7[_0xd9ca('0x18')]()]+']',_0x280a61[_0xd9ca('0x19')]);_0x22a619(_0x280a61);});});}function getUser(_0x300029,_0x540c61,_0x15e65e){return function(_0x4d93c1){return new Promise(function(_0x14a57e,_0x49bb9a){var _0x103666={'method':'GET','uri':_0x15e65e+_0xd9ca('0xc'),'json':!![]};_0x103666[_0xd9ca('0x1a')]=_0x540c61;logger[_0xd9ca('0xd')](_0xd9ca('0x1b'));return rp(_0x103666)[_0xd9ca('0xf')](function(_0x16097c){if(_0x16097c){var _0x1d5b0c=_0x16097c['users'];var _0x55d321=![];var _0x39ef03=null;if(_0x4d93c1[_0xd9ca('0x1c')]!==null){logger[_0xd9ca('0xd')](_0xd9ca('0x1d'),_0x4d93c1[_0xd9ca('0x1c')]);_0x4d93c1[_0xd9ca('0x1e')]=_0x4d93c1[_0xd9ca('0x1c')];for(_0x39ef03=0x0;_0x39ef03<_0x1d5b0c[_0xd9ca('0x11')];_0x39ef03++){if(_0x1d5b0c[_0x39ef03][_0xd9ca('0x12')]===_0x4d93c1[_0xd9ca('0x1c')]){_0x55d321=!![];_0x4d93c1['userId']=_0x1d5b0c[_0x39ef03]['id'];logger['info'](_0xd9ca('0x1f'),_0x4d93c1[_0xd9ca('0x20')]);}}}if(!_0x55d321){logger['info'](_0xd9ca('0x21'));_0x4d93c1[_0xd9ca('0x1e')]=_0x4d93c1[_0xd9ca('0x13')];_0x4d93c1[_0xd9ca('0x20')]=_0x4d93c1['adminId'];_0x55d321=!![];}if(_0x55d321){_0x14a57e(_0x4d93c1);}else{_0x49bb9a({'statusCode':0x194,'message':_0xd9ca('0x15')});}}else{_0x49bb9a({'statusCode':0x194,'message':_0xd9ca('0x15')});}})['catch'](function(_0x444902){logger[_0xd9ca('0x17')]('['+[_0x300029[_0xd9ca('0x18')]()]+']',_0x444902[_0xd9ca('0x19')]);_0x49bb9a(_0x444902);});});};}function searchContact(_0x3a2c0f,_0x35ec44,_0x5ca396,_0x3bdad4){return new Promise(function(_0x52ffc7,_0x50ad5c){var _0x35d7b7={'method':_0xd9ca('0xb'),'headers':_0x35ec44,'uri':_0x3a2c0f+_0xd9ca('0x22')+_0x3bdad4+'&f='+_0x5ca396+_0xd9ca('0x23'),'json':!![]};rp(_0x35d7b7)[_0xd9ca('0xf')](function(_0x51b4df){var _0x3943bc=_[_0xd9ca('0x24')](_0x51b4df[_0xd9ca('0x25')][_0xd9ca('0x25')],[_0x5ca396,_0x3bdad4]);_0x52ffc7(_0x3943bc);})[_0xd9ca('0x16')](function(_0x2ec93a){_0x50ad5c(_0x2ec93a);});});}function getEndUser(_0x48e509,_0x107d9a,_0x14dfbd){return function(_0x54eb9c){return new Promise(function(_0x54dc94,_0x22d5d3){logger[_0xd9ca('0xd')](util[_0xd9ca('0x26')](_0xd9ca('0x27'),_0x54eb9c[_0xd9ca('0x28')]));searchContact(_0x14dfbd,_0x107d9a,'mobile_number',_0x54eb9c[_0xd9ca('0x28')])['then'](function(_0x5838a3){if(_0x5838a3){_0x54eb9c[_0xd9ca('0x29')]=_0x5838a3['id'];logger[_0xd9ca('0xd')]('Contact\x20found\x20mobile_number:',_0x54eb9c[_0xd9ca('0x29')]);return _0x54dc94(_0x54eb9c);}searchContact(_0x14dfbd,_0x107d9a,_0xd9ca('0x2a'),_0x54eb9c['contactNumber'])[_0xd9ca('0xf')](function(_0xb429c4){if(_0xb429c4){_0x54eb9c[_0xd9ca('0x29')]=_0xb429c4['id'];logger[_0xd9ca('0xd')](_0xd9ca('0x2b'),_0x54eb9c['endUserId']);return _0x54dc94(_0x54eb9c);}createEndUser(_0x54eb9c,_0x48e509,_0x107d9a,_0x14dfbd)[_0xd9ca('0xf')](function(_0x602440){logger['info']('Contact\x20created:',_0x602440[_0xd9ca('0x29')]);return _0x54dc94(_0x602440);});});})[_0xd9ca('0x16')](function(_0x3e2340){_0x22d5d3(_0x3e2340);});});};}function createEndUser(_0x2208d5,_0x3f94c1,_0x6e339,_0x4954cb){return new Promise(function(_0x479bf9,_0x1c0b81){var _0x295b37=moment();var _0x39aee1={'method':_0xd9ca('0x2c'),'uri':_0x4954cb+'/api/contacts','body':{'contact':{'last_name':_0x2208d5[_0xd9ca('0x28')],'work_number':_0x2208d5['contactNumber'],'mobile_number':_0x2208d5[_0xd9ca('0x28')],'owner_id':_0x2208d5[_0xd9ca('0x20')],'created_at':_0x295b37['format'](_0xd9ca('0x2d'))}},'json':!![]};_0x39aee1[_0xd9ca('0x1a')]=_0x6e339;logger[_0xd9ca('0xd')](_0xd9ca('0x2e'));return rp(_0x39aee1)[_0xd9ca('0xf')](function(_0x187251){_0x2208d5[_0xd9ca('0x29')]=_0x187251[_0xd9ca('0x2f')]['id'];_0x479bf9(_0x2208d5);})[_0xd9ca('0x16')](function(_0x2e3539){logger[_0xd9ca('0x17')]('['+[_0x3f94c1[_0xd9ca('0x18')]()]+']',_0x2e3539['message']);_0x1c0b81(_0x2e3539['message']);});});}function getTicket(_0x272669,_0x24add8,_0x267ffc,_0x44ad44,_0xd4b6f){return function(_0x1524e8){logger[_0xd9ca('0xd')](_0xd9ca('0x30'));return new Promise(function(_0x1b3826,_0x3735df){var _0x1d7ccd=moment();var _0x49e179={'method':_0xd9ca('0x2c'),'uri':_0x267ffc+_0xd9ca('0x31'),'body':{'title':intUtil[_0xd9ca('0x32')](_0x44ad44[_0xd9ca('0x33')],_0xd4b6f,'\x20'),'description':intUtil['getString'](_0x44ad44[_0xd9ca('0x34')],_0xd4b6f,'\x0a'),'owner_id':_0x1524e8[_0xd9ca('0x20')],'creater_id':_0x1524e8[_0xd9ca('0x14')],'targetable_id':_0x1524e8['endUserId'],'targetable_type':_0xd9ca('0x35'),'created_at':_0x1d7ccd[_0xd9ca('0x26')](_0xd9ca('0x2d')),'due_date':_0x1d7ccd[_0xd9ca('0x36')](0x1e,'m')[_0xd9ca('0x26')](_0xd9ca('0x2d'))},'json':!![]};_0x49e179[_0xd9ca('0x1a')]=_0x24add8;return rp(_0x49e179)[_0xd9ca('0xf')](function(_0x1f6e62){_0x1524e8[_0xd9ca('0x37')]=_0x1f6e62[_0xd9ca('0x38')]['id'];logger[_0xd9ca('0xd')](_0xd9ca('0x39'),_0x1524e8[_0xd9ca('0x37')]);_0x1b3826(_0x1524e8);})[_0xd9ca('0x16')](function(_0x916884){logger[_0xd9ca('0x17')]('['+[_0x272669[_0xd9ca('0x18')]()]+']',_0x916884['message']);_0x3735df(_0x916884['message']);});});};}function emit(_0x6e7f3c,_0x345428,_0x205841){var _0xdde6d1={'uri':_0x6e7f3c+_0xd9ca('0x3a')+_0x205841};io['to'](util[_0xd9ca('0x26')]('user:%s',_0x345428))[_0xd9ca('0x3b')]('trigger:browser:url',_0xdde6d1);}exports['cs']=function(_0x339abc,_0x2a9721,_0x3cb8da,_0x1caad9,_0x108a10,_0x459550,_0x1c05bc,_0x3956eb){var _0xa020e9={};var _0x278a39={'Authorization':_0xd9ca('0x3c')+_0x459550['apiKey']};_0x459550[_0xd9ca('0x3d')]=intUtil['stripTrailingSlash'](_0x459550[_0xd9ca('0x3d')]);_0x459550[_0xd9ca('0x3e')]=intUtil[_0xd9ca('0x3f')](_0x459550[_0xd9ca('0x3e')]);var _0x5d24eb=_0x459550[_0xd9ca('0x3d')];_0xa020e9[_0xd9ca('0x13')]=_0x459550['username'];_0xa020e9[_0xd9ca('0x28')]=_0x3956eb['toLowerCase']()==='outbound'?_0x2a9721[_0xd9ca('0x40')]:_0x2a9721[_0xd9ca('0x41')];_0xa020e9[_0xd9ca('0x42')]=_0x3956eb===_0xd9ca('0x43')||_0x3956eb===_0xd9ca('0x44')?_0xd9ca('0x43'):_0xd9ca('0x45');if(_0x1caad9){_0xa020e9[_0xd9ca('0x1c')]=_0x1caad9[_0xd9ca('0x12')];}var _0x242ead=util[_0xd9ca('0x26')](_0xd9ca('0x46'),_0x459550[_0xd9ca('0x3e')],_0x2a9721[_0xd9ca('0x47')],md5(_0x2a9721[_0xd9ca('0x47')]));if(_0x108a10&&_0x108a10[_0xd9ca('0x48')]){logger[_0xd9ca('0xd')](_0xd9ca('0x49'),'Recording\x20is\x20enabled!');_0x2a9721['recordingURL']=_0x242ead;}else if(_0x1c05bc&&_0x1c05bc['recordingFormat']&&_0x1c05bc[_0xd9ca('0x4a')]!==_0xd9ca('0x4b')){logger[_0xd9ca('0xd')](_0xd9ca('0x4c'),_0xd9ca('0x4d'));_0x2a9721['recordingURL']=_0x242ead;}else{_0x2a9721[_0xd9ca('0x4e')]='';}return getAdminId(_0xa020e9,_0x3956eb,_0x278a39,_0x5d24eb)['then'](getUser(_0x3956eb,_0x278a39,_0x5d24eb))[_0xd9ca('0xf')](getEndUser(_0x3956eb,_0x278a39,_0x5d24eb))[_0xd9ca('0xf')](getTicket(_0x3956eb,_0x278a39,_0x5d24eb,_0x3cb8da,_0x2a9721))[_0xd9ca('0xf')](function(_0x434ed3){logger[_0xd9ca('0xd')](util[_0xd9ca('0x26')]('The\x20ticket\x20ID\x20is:\x20%s',_0x434ed3['ticketId']));if(_0x3956eb!==_0xd9ca('0x44')){logger[_0xd9ca('0xd')]('['+[_0x3956eb[_0xd9ca('0x18')]()]+']',_0xd9ca('0x4f'));emit(_0x5d24eb,_0x1caad9[_0xd9ca('0x50')],_0x434ed3[_0xd9ca('0x29')]);}})['catch'](function(_0x25fc96){logger['error']('['+[_0x3956eb[_0xd9ca('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xd9ca('0x51')](_0x25fc96,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe6b3=['Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','add','YYYY-MM-DDTHH:mm:ss','ticketId','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','outbound','calleridnum','callDirection','unmanaged','queue','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','GET','info','Getting\x20admin\x20information','then','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/selector/owners','headers','Getting\x20user\x20with\x20email','userEmail','length','agentEmail','userId','User\x20found:','message','/api/lookup?q=','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId'];(function(_0x5ebd9b,_0x58e3ea){var _0x958cc0=function(_0x106fd2){while(--_0x106fd2){_0x5ebd9b['push'](_0x5ebd9b['shift']());}};_0x958cc0(++_0x58e3ea);}(_0xe6b3,0x10f));var _0x3e6b=function(_0x8f3185,_0xf1acea){_0x8f3185=_0x8f3185-0x0;var _0x3c104b=_0xe6b3[_0x8f3185];return _0x3c104b;};'use strict';var _=require(_0x3e6b('0x0'));var rp=require(_0x3e6b('0x1'));var md5=require(_0x3e6b('0x2'));var util=require(_0x3e6b('0x3'));var moment=require(_0x3e6b('0x4'));var Promise=require('bluebird');var Redis=require(_0x3e6b('0x5'));var intUtil=require(_0x3e6b('0x6'));var config=require('../../../../config/environment');var logger=require(_0x3e6b('0x7'))(_0x3e6b('0x8'));config[_0x3e6b('0x9')]=_[_0x3e6b('0xa')](config[_0x3e6b('0x9')],{'host':_0x3e6b('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3e6b('0x9')]));function getAdminId(_0x53bd79,_0x3ebe7f,_0x40bfab,_0x4cba0a){return new Promise(function(_0x6f9006,_0x169996){var _0x22a5f0=![];var _0x39c850={'method':_0x3e6b('0xc'),'uri':_0x4cba0a+'/api/selector/owners','json':!![]};_0x39c850['headers']=_0x40bfab;logger[_0x3e6b('0xd')](_0x3e6b('0xe'));return rp(_0x39c850)[_0x3e6b('0xf')](function(_0x1bb88f){if(_0x1bb88f){var _0x1d249f=_0x1bb88f['users'];var _0xca3b18=null;for(_0xca3b18=0x0;_0xca3b18<_0x1d249f['length'];_0xca3b18++){if(_0x1d249f[_0xca3b18][_0x3e6b('0x10')]===_0x53bd79[_0x3e6b('0x11')]){_0x53bd79[_0x3e6b('0x12')]=_0x1d249f[_0xca3b18]['id'];_0x22a5f0=!![];}}if(_0x22a5f0){logger[_0x3e6b('0xd')](_0x3e6b('0x13'),_0x53bd79[_0x3e6b('0x12')]);_0x6f9006(_0x53bd79);}else{_0x169996({'statusCode':0x194,'message':_0x3e6b('0x14')});}}else{_0x169996({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x3e6b('0x15')](function(_0x47ea94){logger[_0x3e6b('0x16')]('['+[_0x3ebe7f[_0x3e6b('0x17')]()]+']',_0x47ea94['message']);_0x169996(_0x47ea94);});});}function getUser(_0xcbdd39,_0x18fc2d,_0x272374){return function(_0x2d8c28){return new Promise(function(_0x279c9c,_0x9d514){var _0x2bd267={'method':_0x3e6b('0xc'),'uri':_0x272374+_0x3e6b('0x18'),'json':!![]};_0x2bd267[_0x3e6b('0x19')]=_0x18fc2d;logger[_0x3e6b('0xd')]('Getting\x20user\x20list');return rp(_0x2bd267)['then'](function(_0xe442e0){if(_0xe442e0){var _0x2e7470=_0xe442e0['users'];var _0xaa338a=![];var _0x323b5e=null;if(_0x2d8c28['agentEmail']!==null){logger[_0x3e6b('0xd')](_0x3e6b('0x1a'),_0x2d8c28['agentEmail']);_0x2d8c28[_0x3e6b('0x1b')]=_0x2d8c28['agentEmail'];for(_0x323b5e=0x0;_0x323b5e<_0x2e7470[_0x3e6b('0x1c')];_0x323b5e++){if(_0x2e7470[_0x323b5e][_0x3e6b('0x10')]===_0x2d8c28[_0x3e6b('0x1d')]){_0xaa338a=!![];_0x2d8c28[_0x3e6b('0x1e')]=_0x2e7470[_0x323b5e]['id'];logger[_0x3e6b('0xd')](_0x3e6b('0x1f'),_0x2d8c28['userId']);}}}if(!_0xaa338a){logger[_0x3e6b('0xd')]('Admin\x20selected');_0x2d8c28['userEmail']=_0x2d8c28[_0x3e6b('0x11')];_0x2d8c28[_0x3e6b('0x1e')]=_0x2d8c28[_0x3e6b('0x12')];_0xaa338a=!![];}if(_0xaa338a){_0x279c9c(_0x2d8c28);}else{_0x9d514({'statusCode':0x194,'message':_0x3e6b('0x14')});}}else{_0x9d514({'statusCode':0x194,'message':_0x3e6b('0x14')});}})['catch'](function(_0x4d9565){logger[_0x3e6b('0x16')]('['+[_0xcbdd39['toUpperCase']()]+']',_0x4d9565[_0x3e6b('0x20')]);_0x9d514(_0x4d9565);});});};}function searchContact(_0x2b3ed2,_0x4237cb,_0x418e66,_0x1c4c65){return new Promise(function(_0x476d67,_0x2d2057){var _0x31d662={'method':'GET','headers':_0x4237cb,'uri':_0x2b3ed2+_0x3e6b('0x21')+_0x1c4c65+_0x3e6b('0x22')+_0x418e66+'&entities=contact','json':!![]};rp(_0x31d662)[_0x3e6b('0xf')](function(_0x1324a4){var _0x120b8e=_['find'](_0x1324a4[_0x3e6b('0x23')][_0x3e6b('0x23')],[_0x418e66,_0x1c4c65]);_0x476d67(_0x120b8e);})['catch'](function(_0x36b947){_0x2d2057(_0x36b947);});});}function getEndUser(_0x2223a4,_0x3550fb,_0x3e6428){return function(_0x54bc39){return new Promise(function(_0x108ac3,_0x10dbbe){logger[_0x3e6b('0xd')](util[_0x3e6b('0x24')](_0x3e6b('0x25'),_0x54bc39[_0x3e6b('0x26')]));searchContact(_0x3e6428,_0x3550fb,_0x3e6b('0x27'),_0x54bc39[_0x3e6b('0x26')])[_0x3e6b('0xf')](function(_0x1c5a1d){if(_0x1c5a1d){_0x54bc39[_0x3e6b('0x28')]=_0x1c5a1d['id'];logger[_0x3e6b('0xd')](_0x3e6b('0x29'),_0x54bc39[_0x3e6b('0x28')]);return _0x108ac3(_0x54bc39);}searchContact(_0x3e6428,_0x3550fb,'work_number',_0x54bc39[_0x3e6b('0x26')])[_0x3e6b('0xf')](function(_0x4958a1){if(_0x4958a1){_0x54bc39[_0x3e6b('0x28')]=_0x4958a1['id'];logger['info'](_0x3e6b('0x2a'),_0x54bc39[_0x3e6b('0x28')]);return _0x108ac3(_0x54bc39);}createEndUser(_0x54bc39,_0x2223a4,_0x3550fb,_0x3e6428)[_0x3e6b('0xf')](function(_0x1110c5){logger[_0x3e6b('0xd')](_0x3e6b('0x2b'),_0x1110c5['endUserId']);return _0x108ac3(_0x1110c5);});});})[_0x3e6b('0x15')](function(_0x3318ad){_0x10dbbe(_0x3318ad);});});};}function createEndUser(_0x253ad9,_0x330006,_0x15b0c1,_0x58b159){return new Promise(function(_0x34b411,_0x1188f0){var _0xe19dac=moment();var _0x3d5164={'method':_0x3e6b('0x2c'),'uri':_0x58b159+'/api/contacts','body':{'contact':{'last_name':_0x253ad9[_0x3e6b('0x26')],'work_number':_0x253ad9['contactNumber'],'mobile_number':_0x253ad9[_0x3e6b('0x26')],'owner_id':_0x253ad9[_0x3e6b('0x1e')],'created_at':_0xe19dac['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x3d5164[_0x3e6b('0x19')]=_0x15b0c1;logger[_0x3e6b('0xd')](_0x3e6b('0x2d'));return rp(_0x3d5164)[_0x3e6b('0xf')](function(_0x5718ec){_0x253ad9['endUserId']=_0x5718ec[_0x3e6b('0x2e')]['id'];_0x34b411(_0x253ad9);})[_0x3e6b('0x15')](function(_0x400da5){logger[_0x3e6b('0x16')]('['+[_0x330006[_0x3e6b('0x17')]()]+']',_0x400da5[_0x3e6b('0x20')]);_0x1188f0(_0x400da5[_0x3e6b('0x20')]);});});}function getTicket(_0x240d54,_0x346f5e,_0x3d80a5,_0x2f6b78,_0x4ded6e){return function(_0x1c9051){logger['info'](_0x3e6b('0x2f'));return new Promise(function(_0x476a95,_0x157dcb){var _0x4f6a01=moment();var _0x4287d4={'method':_0x3e6b('0x2c'),'uri':_0x3d80a5+'/api/tasks','body':{'title':intUtil[_0x3e6b('0x30')](_0x2f6b78[_0x3e6b('0x31')],_0x4ded6e,'\x20'),'description':intUtil[_0x3e6b('0x30')](_0x2f6b78[_0x3e6b('0x32')],_0x4ded6e,'\x0a'),'owner_id':_0x1c9051[_0x3e6b('0x1e')],'creater_id':_0x1c9051['adminId'],'targetable_id':_0x1c9051[_0x3e6b('0x28')],'targetable_type':_0x3e6b('0x33'),'created_at':_0x4f6a01[_0x3e6b('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4f6a01[_0x3e6b('0x34')](0x1e,'m')[_0x3e6b('0x24')](_0x3e6b('0x35'))},'json':!![]};_0x4287d4[_0x3e6b('0x19')]=_0x346f5e;return rp(_0x4287d4)[_0x3e6b('0xf')](function(_0x2fcdc1){_0x1c9051[_0x3e6b('0x36')]=_0x2fcdc1['task']['id'];logger['info'](_0x3e6b('0x37'),_0x1c9051[_0x3e6b('0x36')]);_0x476a95(_0x1c9051);})[_0x3e6b('0x15')](function(_0x52439a){logger[_0x3e6b('0x16')]('['+[_0x240d54[_0x3e6b('0x17')]()]+']',_0x52439a['message']);_0x157dcb(_0x52439a[_0x3e6b('0x20')]);});});};}function emit(_0x12f0f9,_0x5e7d8a,_0x21da09){var _0x11098f={'uri':_0x12f0f9+_0x3e6b('0x38')+_0x21da09};io['to'](util[_0x3e6b('0x24')](_0x3e6b('0x39'),_0x5e7d8a))['emit'](_0x3e6b('0x3a'),_0x11098f);}exports['cs']=function(_0x50380a,_0x31dd53,_0x278f64,_0x4eca5c,_0x323bbe,_0x4d6098,_0x2544f6,_0x21fae1){var _0x5d5e66={};var _0xbc3900={'Authorization':_0x3e6b('0x3b')+_0x4d6098['apiKey']};_0x4d6098[_0x3e6b('0x3c')]=intUtil[_0x3e6b('0x3d')](_0x4d6098['remoteUri']);_0x4d6098[_0x3e6b('0x3e')]=intUtil['stripTrailingSlash'](_0x4d6098[_0x3e6b('0x3e')]);var _0x1dfc89=_0x4d6098['remoteUri'];_0x5d5e66[_0x3e6b('0x11')]=_0x4d6098[_0x3e6b('0x3f')];_0x5d5e66[_0x3e6b('0x26')]=_0x21fae1['toLowerCase']()===_0x3e6b('0x40')?_0x31dd53['destcalleridnum']:_0x31dd53[_0x3e6b('0x41')];_0x5d5e66[_0x3e6b('0x42')]=_0x21fae1==='queue'||_0x21fae1===_0x3e6b('0x43')?_0x3e6b('0x44'):_0x3e6b('0x40');if(_0x4eca5c){_0x5d5e66[_0x3e6b('0x1d')]=_0x4eca5c['email'];}var _0xc69dbd=util[_0x3e6b('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d6098[_0x3e6b('0x3e')],_0x31dd53['uniqueid'],md5(_0x31dd53[_0x3e6b('0x45')]));if(_0x323bbe&&_0x323bbe['monitor_format']){logger[_0x3e6b('0xd')]('[QUEUE]',_0x3e6b('0x46'));_0x31dd53[_0x3e6b('0x47')]=_0xc69dbd;}else if(_0x2544f6&&_0x2544f6[_0x3e6b('0x48')]&&_0x2544f6[_0x3e6b('0x48')]!==_0x3e6b('0x49')){logger[_0x3e6b('0xd')]('[OUTBOUND]',_0x3e6b('0x46'));_0x31dd53[_0x3e6b('0x47')]=_0xc69dbd;}else{_0x31dd53['recordingURL']='';}return getAdminId(_0x5d5e66,_0x21fae1,_0xbc3900,_0x1dfc89)[_0x3e6b('0xf')](getUser(_0x21fae1,_0xbc3900,_0x1dfc89))[_0x3e6b('0xf')](getEndUser(_0x21fae1,_0xbc3900,_0x1dfc89))[_0x3e6b('0xf')](getTicket(_0x21fae1,_0xbc3900,_0x1dfc89,_0x278f64,_0x31dd53))[_0x3e6b('0xf')](function(_0x2890a3){logger[_0x3e6b('0xd')](util[_0x3e6b('0x24')](_0x3e6b('0x4a'),_0x2890a3[_0x3e6b('0x36')]));if(_0x21fae1!==_0x3e6b('0x43')){logger[_0x3e6b('0xd')]('['+[_0x21fae1[_0x3e6b('0x17')]()]+']',_0x3e6b('0x4b'));emit(_0x1dfc89,_0x4eca5c[_0x3e6b('0x4c')],_0x2890a3[_0x3e6b('0x28')]);}})['catch'](function(_0x277d67){logger[_0x3e6b('0x16')]('['+[_0x21fae1['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x3e6b('0x4d')](_0x277d67,{'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 9d4cf47..de3bc28 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 _0x4665=['includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec'];(function(_0x1479ee,_0x2a999f){var _0x5b11fe=function(_0x316f16){while(--_0x316f16){_0x1479ee['push'](_0x1479ee['shift']());}};_0x5b11fe(++_0x2a999f);}(_0x4665,0x1e7));var _0x5466=function(_0x133368,_0x1f8d8e){_0x133368=_0x133368-0x0;var _0x4c01a9=_0x4665[_0x133368];return _0x4c01a9;};'use strict';var _=require(_0x5466('0x0'));var util=require(_0x5466('0x1'));var zendesk=require(_0x5466('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x5466('0x3'));var freshdesk=require(_0x5466('0x4'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x5466('0x5'));var servicenow=require(_0x5466('0x6'));var dynamics365=require(_0x5466('0x7'));var freshsales=require(_0x5466('0x8'));var integrations=[_0x5466('0x9'),_0x5466('0xa'),_0x5466('0xb'),_0x5466('0xc'),_0x5466('0xd'),_0x5466('0xe'),_0x5466('0xf'),_0x5466('0x10'),_0x5466('0x11'),_0x5466('0x12')];exports[_0x5466('0x13')]=function(_0x259eae,_0xde5be6,_0x5fb49e,_0x43fbe6,_0x4583d5,_0x429b8b){if(_0x5fb49e){if(_[_0x5466('0x14')](integrations,_0x259eae['data1'][_0x5466('0x15')]())){try{var _0x1b2964=null;var _0x2b12b5='';var _0x5d1e3c=_0x5fb49e[_0x259eae[_0x5466('0x16')]['toLowerCase']()];if(_0x5d1e3c){var _0x1e5200=_0x5d1e3c[_0x259eae[_0x5466('0x17')]];if(_0x1e5200){var _0x371820=_[_0x5466('0x18')](_0x1e5200[_0x5466('0x19')],{'id':parseInt(_0x259eae[_0x5466('0x1a')],0xa)});if(_0x371820){if(_0x43fbe6){if(_0x4583d5&&_0xde5be6[_0x5466('0x1b')]){_0x2b12b5=_0x5466('0x1b');}else if(_0xde5be6[_0x5466('0x1c')]){_0x2b12b5=_0x5466('0x1d');}else{console['log'](_0x5466('0x1e'),_0xde5be6);}}else{_0x2b12b5=_0x5466('0x1f');}switch(_0x259eae[_0x5466('0x16')]['toLowerCase']()){case'zendesk':zendesk[_0x2b12b5](_0x259eae,_0xde5be6,_0x371820,_0x43fbe6,_0x4583d5,_0x1e5200,_0x429b8b);break;case _0x5466('0xa'):salesforce[_0x2b12b5](_0x259eae,_0xde5be6,_0x371820,_0x43fbe6,_0x4583d5,_0x1e5200,_0x429b8b);break;case _0x5466('0xb'):sugarcrm[_0x2b12b5](_0x259eae,_0xde5be6,_0x371820,_0x43fbe6,_0x4583d5,_0x1e5200,_0x429b8b);break;case _0x5466('0xc'):freshdesk[_0x2b12b5](_0x259eae,_0xde5be6,_0x371820,_0x43fbe6,_0x4583d5,_0x1e5200,_0x429b8b);break;case _0x5466('0xd'):zoho[_0x2b12b5](_0x259eae,_0xde5be6,_0x371820,_0x43fbe6,_0x4583d5,_0x1e5200,_0x429b8b);break;case _0x5466('0xe'):desk[_0x2b12b5](_0x259eae,_0xde5be6,_0x371820,_0x43fbe6,_0x4583d5,_0x1e5200,_0x429b8b);break;case'vtiger':vtiger[_0x2b12b5](_0x259eae,_0xde5be6,_0x371820,_0x43fbe6,_0x4583d5,_0x1e5200,_0x429b8b);break;case _0x5466('0x11'):freshsales['cs'](_0x259eae,_0xde5be6,_0x371820,_0x43fbe6,_0x4583d5,_0x1e5200,_0x429b8b,_0x2b12b5);break;case'servicenow':servicenow['cs'](_0x259eae,_0xde5be6,_0x371820,_0x43fbe6,_0x4583d5,_0x1e5200,_0x429b8b,_0x2b12b5);break;case _0x5466('0x10'):dynamics365['cs'](_0x259eae,_0xde5be6,_0x371820,_0x43fbe6,_0x4583d5,_0x1e5200,_0x429b8b,_0x2b12b5);break;default:console[_0x5466('0x20')](_0x5466('0x21'));}}else{_0x1b2964=require(_0x5466('0x22'))(_0x259eae[_0x5466('0x16')][_0x5466('0x15')]());_0x1b2964[_0x5466('0x23')](_0x5466('0x24'),util[_0x5466('0x25')](_0x5466('0x26'),_0x259eae[_0x5466('0x16')]['toLowerCase'](),_0x259eae[_0x5466('0x1a')]));}}else{_0x1b2964=require(_0x5466('0x22'))(_0x259eae[_0x5466('0x16')][_0x5466('0x15')]());_0x1b2964['error']('[EXEC]',util[_0x5466('0x25')]('%s\x20account\x20#%s\x20not\x20found',_0x259eae[_0x5466('0x16')][_0x5466('0x15')](),_0x259eae[_0x5466('0x17')]));}}else{}}catch(_0x283e80){console[_0x5466('0x23')](_0x283e80);}}}}; \ No newline at end of file +var _0xbf2f=['lodash','util','./zendesk','./sugarcrm','./freshdesk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unknown\x20integration','error','format','../../../../config/logger'];(function(_0x126a6f,_0x390a17){var _0x3988db=function(_0x162d81){while(--_0x162d81){_0x126a6f['push'](_0x126a6f['shift']());}};_0x3988db(++_0x390a17);}(_0xbf2f,0x1a0));var _0xfbf2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbf2f[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xfbf2('0x0'));var util=require(_0xfbf2('0x1'));var zendesk=require(_0xfbf2('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xfbf2('0x3'));var freshdesk=require(_0xfbf2('0x4'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xfbf2('0x5'));var dynamics365=require(_0xfbf2('0x6'));var freshsales=require(_0xfbf2('0x7'));var integrations=[_0xfbf2('0x8'),_0xfbf2('0x9'),_0xfbf2('0xa'),'freshdesk','zoho',_0xfbf2('0xb'),_0xfbf2('0xc'),_0xfbf2('0xd'),_0xfbf2('0xe'),_0xfbf2('0xf')];exports[_0xfbf2('0x10')]=function(_0x1ae7d8,_0x2e4980,_0x30ca9a,_0x56299f,_0x3b0a15,_0x589bfd){if(_0x30ca9a){if(_[_0xfbf2('0x11')](integrations,_0x1ae7d8[_0xfbf2('0x12')][_0xfbf2('0x13')]())){try{var _0x4abe87=null;var _0x4d481c='';var _0x3b0a1c=_0x30ca9a[_0x1ae7d8['data1'][_0xfbf2('0x13')]()];if(_0x3b0a1c){var _0x47a13a=_0x3b0a1c[_0x1ae7d8[_0xfbf2('0x14')]];if(_0x47a13a){var _0x31387a=_[_0xfbf2('0x15')](_0x47a13a[_0xfbf2('0x16')],{'id':parseInt(_0x1ae7d8[_0xfbf2('0x17')],0xa)});if(_0x31387a){if(_0x56299f){if(_0x3b0a15&&_0x2e4980[_0xfbf2('0x18')]){_0x4d481c='queue';}else if(_0x2e4980['routeId']){_0x4d481c=_0xfbf2('0x19');}else{console[_0xfbf2('0x1a')](_0xfbf2('0x1b'),_0x2e4980);}}else{_0x4d481c='unmanaged';}switch(_0x1ae7d8[_0xfbf2('0x12')][_0xfbf2('0x13')]()){case _0xfbf2('0x8'):zendesk[_0x4d481c](_0x1ae7d8,_0x2e4980,_0x31387a,_0x56299f,_0x3b0a15,_0x47a13a,_0x589bfd);break;case _0xfbf2('0x9'):salesforce[_0x4d481c](_0x1ae7d8,_0x2e4980,_0x31387a,_0x56299f,_0x3b0a15,_0x47a13a,_0x589bfd);break;case _0xfbf2('0xa'):sugarcrm[_0x4d481c](_0x1ae7d8,_0x2e4980,_0x31387a,_0x56299f,_0x3b0a15,_0x47a13a,_0x589bfd);break;case'freshdesk':freshdesk[_0x4d481c](_0x1ae7d8,_0x2e4980,_0x31387a,_0x56299f,_0x3b0a15,_0x47a13a,_0x589bfd);break;case'zoho':zoho[_0x4d481c](_0x1ae7d8,_0x2e4980,_0x31387a,_0x56299f,_0x3b0a15,_0x47a13a,_0x589bfd);break;case'desk':desk[_0x4d481c](_0x1ae7d8,_0x2e4980,_0x31387a,_0x56299f,_0x3b0a15,_0x47a13a,_0x589bfd);break;case'vtiger':vtiger[_0x4d481c](_0x1ae7d8,_0x2e4980,_0x31387a,_0x56299f,_0x3b0a15,_0x47a13a,_0x589bfd);break;case _0xfbf2('0xe'):freshsales['cs'](_0x1ae7d8,_0x2e4980,_0x31387a,_0x56299f,_0x3b0a15,_0x47a13a,_0x589bfd,_0x4d481c);break;case'servicenow':servicenow['cs'](_0x1ae7d8,_0x2e4980,_0x31387a,_0x56299f,_0x3b0a15,_0x47a13a,_0x589bfd,_0x4d481c);break;case _0xfbf2('0xd'):dynamics365['cs'](_0x1ae7d8,_0x2e4980,_0x31387a,_0x56299f,_0x3b0a15,_0x47a13a,_0x589bfd,_0x4d481c);break;default:console['log'](_0xfbf2('0x1c'));}}else{_0x4abe87=require('../../../../config/logger')(_0x1ae7d8['data1'][_0xfbf2('0x13')]());_0x4abe87[_0xfbf2('0x1d')]('[EXEC]',util[_0xfbf2('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1ae7d8['data1'][_0xfbf2('0x13')](),_0x1ae7d8[_0xfbf2('0x17')]));}}else{_0x4abe87=require(_0xfbf2('0x1f'))(_0x1ae7d8[_0xfbf2('0x12')][_0xfbf2('0x13')]());_0x4abe87[_0xfbf2('0x1d')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x1ae7d8[_0xfbf2('0x12')][_0xfbf2('0x13')](),_0x1ae7d8[_0xfbf2('0x14')]));}}else{}}catch(_0x52a109){console[_0xfbf2('0x1d')](_0x52a109);}}}}; \ 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 8887a1c..4609007 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 _0xd779=['Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','user:%s','trigger:browser:url','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent','lodash','request-promise','bluebird','jsforce','salesforce','redis','socket.io-emitter','emit','assign','getString','Subjects','Task','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','isNil','validateEmail','User','find','execute','then','length','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','contact_lead','cloneDeep','additionalSearchContact','$or','sobject','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','','format','upperFirst','create','includes','string','type','idField','content','toString','variable','variableName'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xd779,0xa3));var _0x9d77=function(_0x2b1288,_0x3b2c86){_0x2b1288=_0x2b1288-0x0;var _0xd8974f=_0xd779[_0x2b1288];return _0xd8974f;};'use strict';var _=require(_0x9d77('0x0'));var rp=require(_0x9d77('0x1'));var moment=require('moment');var BPromise=require(_0x9d77('0x2'));var md5=require('md5');var jsforce=require(_0x9d77('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x9d77('0x4'));config[_0x9d77('0x5')]=_['defaults'](config[_0x9d77('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9d77('0x6'))(new Redis(config[_0x9d77('0x5')]));function emit(_0x517a79,_0x79b513,_0x453597){io['to'](_0x517a79)[_0x9d77('0x7')](_0x79b513,_0x453597);}function getTicket(_0x4b439c,_0x4ef712,_0x44d90c,_0x16b19d,_0x13e8be,_0x8d1c0f,_0x40b8b,_0x28e887){var _0xb7f2d=Object[_0x9d77('0x8')]({},{'OwnerId':_0x4ef712['id'],'Subject':intUtil[_0x9d77('0x9')](_0x16b19d[_0x9d77('0xa')],_0x13e8be,'\x20'),'Description':intUtil['getString'](_0x16b19d['Descriptions'],_0x13e8be,'\x0a')},getCustomFields(_0x8d1c0f,_0x13e8be));if(_0x44d90c){if(_0x16b19d['ticketType']===_0x9d77('0xb')){_0xb7f2d['ActivityDate']=moment[_0x9d77('0xc')]();_0xb7f2d[_0x9d77('0xd')]=![];_0xb7f2d[_0x9d77('0xe')]=![];if(_0x44d90c[_0x9d77('0xf')]==='contact'||_0x44d90c['endUserType']===_0x9d77('0x10')){_0xb7f2d[_0x9d77('0x11')]=_0x44d90c['id'];}else if(_0x44d90c[_0x9d77('0xf')]===_0x9d77('0x12')){_0xb7f2d[_0x9d77('0x13')]=_0x44d90c['id'];}}else if(_0x16b19d[_0x9d77('0x14')]===_0x9d77('0x15')){if(_0x44d90c[_0x9d77('0xf')]==='contact'){_0xb7f2d[_0x9d77('0x16')]=_0x44d90c['id'];}else if(_0x44d90c[_0x9d77('0xf')]==='account'){_0xb7f2d[_0x9d77('0x17')]=_0x44d90c['id'];}else if(_0x44d90c[_0x9d77('0xf')]==='lead'&&_0x16b19d[_0x9d77('0x18')]){_0xb7f2d[_0x16b19d[_0x9d77('0x18')]]=_0x44d90c['id'];}else{logger[_0x9d77('0x19')](_0x9d77('0x1a'));}}}return _0x40b8b['sobject'](_0x16b19d[_0x9d77('0x14')])['create'](_0xb7f2d);}function getUser(_0x1e1e87,_0xb7937f,_0x27b574){if(!_[_0x9d77('0x1b')](_0xb7937f)&&intUtil[_0x9d77('0x1c')](_0xb7937f)){var _0x1d6091={'Email':_0xb7937f};var _0x4365f9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x27b574['sobject'](_0x9d77('0x1d'))[_0x9d77('0x1e')](_0x1d6091,_0x4365f9)[_0x9d77('0x1f')]()[_0x9d77('0x20')](function(_0x2b613d){if(_0x2b613d[_0x9d77('0x21')]){var _0x30c0dd=_[_0x9d77('0x1e')](_0x2b613d,function(_0x26363f){return _0x26363f['Email']===_0xb7937f;});if(_0x30c0dd){logger[_0x9d77('0x19')]('Agent\x20%s\x20found.',_0xb7937f);return BPromise[_0x9d77('0x22')]({'id':_0x30c0dd['Id'],'name':_0x30c0dd[_0x9d77('0x23')]});}}else{logger[_0x9d77('0x19')](_0x9d77('0x24'),_0xb7937f);return _0x27b574['identity']()[_0x9d77('0x20')](function(_0x10827e){return BPromise[_0x9d77('0x22')]({'id':_0x10827e[_0x9d77('0x25')],'name':_0x10827e[_0x9d77('0x26')]});});}});}else{logger['info'](_0x9d77('0x24'),_0xb7937f);return _0x27b574[_0x9d77('0x27')]()[_0x9d77('0x20')](function(_0x11a9f3){return BPromise[_0x9d77('0x22')]({'id':_0x11a9f3[_0x9d77('0x25')],'name':_0x11a9f3[_0x9d77('0x26')]});});}}function getEndUser(_0x304ea5,_0xa801b6,_0x3e109e,_0xe16819,_0x2f9c2c){var _0x536fdc={'$or':{'Phone':_0xe16819}};var _0x2b16e6={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9d77('0x22')]()[_0x9d77('0x20')](function(){logger[_0x9d77('0x19')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0xe16819,_0xa801b6['moduleSearch']);switch(_0xa801b6['moduleSearch']){case _0x9d77('0x28'):var _0x336fa2=_[_0x9d77('0x29')](_0x536fdc);if(_0xa801b6['additionalSearchContact']){var _0x41cde0={};_0x41cde0[_0xa801b6[_0x9d77('0x2a')]]=_0xe16819;_['merge'](_0x336fa2[_0x9d77('0x2b')],_0x41cde0);}return _0x2f9c2c[_0x9d77('0x2c')]('Contact')['find'](_0x336fa2,_0x2b16e6)['execute']()[_0x9d77('0x20')](function(_0x3b4fd2){if(_0x3b4fd2&&_0x3b4fd2[_0x9d77('0x21')]){return _0x3b4fd2;}else{var _0xf741f2=_[_0x9d77('0x29')](_0x536fdc);if(_0xa801b6['additionalSearchLead']){var _0x36dcc7={};_0x36dcc7[_0xa801b6[_0x9d77('0x2d')]]=_0xe16819;_[_0x9d77('0x2e')](_0xf741f2[_0x9d77('0x2b')],_0x36dcc7);}return _0x2f9c2c[_0x9d77('0x2c')](_0x9d77('0x2f'))[_0x9d77('0x1e')](_0xf741f2,_0x2b16e6);}});case _0x9d77('0x30'):var _0x2da102=_[_0x9d77('0x29')](_0x536fdc);if(_0xa801b6[_0x9d77('0x31')]){var _0x41cde0={};_0x41cde0[_0xa801b6[_0x9d77('0x31')]]=_0xe16819;_[_0x9d77('0x2e')](_0x2da102[_0x9d77('0x2b')],_0x41cde0);}return _0x2f9c2c['sobject'](_0x9d77('0x32'))['find'](_0x2da102,_0x2b16e6)['execute']()[_0x9d77('0x20')](function(_0x507411){if(_0x507411&&_0x507411['length']){return _0x507411;}else{var _0x456e88=_[_0x9d77('0x29')](_0x536fdc);if(_0xa801b6['additionalSearchContact']){var _0x1e0086={};_0x1e0086[_0xa801b6[_0x9d77('0x2a')]]=_0xe16819;_['merge'](_0x456e88[_0x9d77('0x2b')],_0x1e0086);}return _0x2f9c2c[_0x9d77('0x2c')](_0x9d77('0x33'))[_0x9d77('0x1e')](_0x456e88,_0x2b16e6)['then'](function(_0x13bff4){if(_0x13bff4&&_0x13bff4[_0x9d77('0x21')]){return _0x13bff4;}else{var _0x14adee=_[_0x9d77('0x29')](_0x536fdc);if(_0xa801b6[_0x9d77('0x2d')]){var _0x540d2e={};_0x540d2e[_0xa801b6['additionalSearchLead']]=_0xe16819;_[_0x9d77('0x2e')](_0x14adee[_0x9d77('0x2b')],_0x540d2e);}return _0x2f9c2c[_0x9d77('0x2c')](_0x9d77('0x2f'))['find'](_0x14adee,_0x2b16e6);}});}});case'contact':var _0x336fa2=_[_0x9d77('0x29')](_0x536fdc);if(_0xa801b6['additionalSearchContact']){var _0x41cde0={};_0x41cde0[_0xa801b6['additionalSearchContact']]=_0xe16819;_[_0x9d77('0x2e')](_0x336fa2[_0x9d77('0x2b')],_0x41cde0);}return _0x2f9c2c[_0x9d77('0x2c')]('Contact')[_0x9d77('0x1e')](_0x336fa2,_0x2b16e6)[_0x9d77('0x1f')]();case _0x9d77('0x10'):var _0x20eca7=_['cloneDeep'](_0x536fdc);if(_0xa801b6['additionalSearchLead']){var _0x41cde0={};_0x41cde0[_0xa801b6[_0x9d77('0x2d')]]=_0xe16819;_['merge'](_0x20eca7[_0x9d77('0x2b')],_0x41cde0);}return _0x2f9c2c[_0x9d77('0x2c')](_0x9d77('0x2f'))[_0x9d77('0x1e')](_0x20eca7,_0x2b16e6);case _0x9d77('0x12'):var _0x2da102=_[_0x9d77('0x29')](_0x536fdc);if(_0xa801b6[_0x9d77('0x31')]){var _0x41cde0={};_0x41cde0[_0xa801b6[_0x9d77('0x31')]]=_0xe16819;_[_0x9d77('0x2e')](_0x2da102['$or'],_0x41cde0);}return _0x2f9c2c[_0x9d77('0x2c')](_0x9d77('0x32'))[_0x9d77('0x1e')](_0x2da102,_0x2b16e6);default:return null;}})[_0x9d77('0x20')](function(_0x508556){if(_0x508556&&_0x508556['length']){var _0x356fdd=_[_0x9d77('0x34')](_0x508556);if(_0x356fdd){return BPromise[_0x9d77('0x22')]({'id':_0x356fdd['Id'],'name':_0x356fdd['Name'],'phone':_0x356fdd[_0x9d77('0x35')],'endUserType':_0x356fdd['attributes']['type'][_0x9d77('0x36')]()});}}})['then'](function(_0x3cba88){if(_0x3cba88){logger[_0x9d77('0x19')](_0x9d77('0x37'),_0x3cba88[_0x9d77('0xf')],_0xe16819);return BPromise[_0x9d77('0x22')](_0x3cba88);}else{logger['info'](_0x9d77('0x38'),_0xe16819);var _0x3cbc14={'Phone':_0xe16819};if(_0xa801b6['moduleCreate']){if(_0xa801b6[_0x9d77('0x39')]==='contact'){logger[_0x9d77('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xe16819,_0xa801b6['moduleCreate']);_0x3cbc14[_0x9d77('0x3a')]=_0x3e109e!==''?_0x3e109e:util['format'](_0x9d77('0x3b'),_0xe16819);}else if(_0xa801b6[_0x9d77('0x39')]==='lead'){logger[_0x9d77('0x19')](_0x9d77('0x3c'),_0xe16819,_0xa801b6['moduleCreate']);_0x3cbc14[_0x9d77('0x3a')]=_0x3e109e!==''?_0x3e109e:util['format'](_0x9d77('0x3b'),_0xe16819);_0x3cbc14[_0x9d77('0x3d')]=_0x9d77('0x3e');}else if(_0xa801b6[_0x9d77('0x39')]===_0x9d77('0x12')){logger[_0x9d77('0x19')](_0x9d77('0x3c'),_0xe16819,_0xa801b6[_0x9d77('0x39')]);_0x3cbc14[_0x9d77('0x23')]=_0x3e109e!==_0x9d77('0x3f')?_0x3e109e:util[_0x9d77('0x40')](_0x9d77('0x3b'),_0xe16819);}else{return null;}}return _0x2f9c2c[_0x9d77('0x2c')](_[_0x9d77('0x41')](_0xa801b6[_0x9d77('0x39')]))[_0x9d77('0x42')](_0x3cbc14)['then'](function(_0x13dad8){return BPromise[_0x9d77('0x22')]({'id':_0x13dad8['id'],'endUserType':_0xa801b6[_0x9d77('0x39')]});});}});}function getCustomFields(_0x91cacb,_0x5c59ce){var _0x2a9cca={};if(_0x91cacb[_0x9d77('0x21')]>0x0){_['forEach'](_0x91cacb,function(_0x579bb1){if(_[_0x9d77('0x43')]([_0x9d77('0x44'),'picklist'],_0x579bb1[_0x9d77('0x45')])&&_0x579bb1[_0x9d77('0x46')]){_0x2a9cca[_0x579bb1[_0x9d77('0x46')]]=_0x579bb1[_0x9d77('0x47')][_0x9d77('0x48')]();}else if(_0x579bb1[_0x9d77('0x45')]===_0x9d77('0x49')&&_0x579bb1[_0x9d77('0x4a')]&&_0x579bb1[_0x9d77('0x46')]){_0x5c59ce[_0x579bb1[_0x9d77('0x4a')]]&&(_0x2a9cca[_0x579bb1[_0x9d77('0x46')]]=_0x5c59ce[_0x579bb1[_0x9d77('0x4a')]][_0x9d77('0x48')]());}else if(_0x579bb1['type']==='customVariable'&&_0x579bb1[_0x9d77('0x4b')]&&_0x579bb1[_0x9d77('0x4b')][_0x9d77('0x4c')]&&_0x579bb1[_0x9d77('0x46')]){_0x5c59ce[_0x579bb1[_0x9d77('0x4b')][_0x9d77('0x4c')][_0x9d77('0x36')]()]&&(_0x2a9cca[_0x579bb1['idField']]=_0x5c59ce[_0x579bb1[_0x9d77('0x4b')][_0x9d77('0x4c')][_0x9d77('0x36')]()][_0x9d77('0x48')]());}});}return _0x2a9cca;}function getConnection(_0x3cb6c0){var _0x16e2f0=_0x3cb6c0[_0x9d77('0x4d')][_0x9d77('0x4e')](_0x3cb6c0['securityToken']);var _0x483b6e=new jsforce[(_0x9d77('0x4f'))]({'oauth2':{'loginUrl':_0x3cb6c0[_0x9d77('0x50')]||_0x9d77('0x51'),'clientId':_0x3cb6c0['clientId'],'clientSecret':_0x3cb6c0[_0x9d77('0x52')]}});return _0x483b6e[_0x9d77('0x53')](_0x3cb6c0[_0x9d77('0x54')],_0x16e2f0)[_0x9d77('0x20')](function(){logger[_0x9d77('0x19')](_0x9d77('0x55'));return _0x483b6e;});}exports[_0x9d77('0x56')]=function(_0x3d439f,_0x24f78b,_0x5023fd,_0x107773,_0x283f3d,_0x3661cd){var _0x2a2095,_0x223e51,_0x11dafc,_0x5c1ac0;_0x3661cd[_0x9d77('0x57')]=intUtil['stripTrailingSlash'](_0x3661cd[_0x9d77('0x57')]);_0x3661cd[_0x9d77('0x50')]=intUtil['stripTrailingSlash'](_0x3661cd[_0x9d77('0x50')]);if(_0x283f3d&&_0x283f3d[_0x9d77('0x58')]){logger[_0x9d77('0x19')](_0x9d77('0x59'),_0x9d77('0x5a'));_0x24f78b['recordingURL']=util[_0x9d77('0x40')](_0x9d77('0x5b'),_0x3661cd[_0x9d77('0x57')],_0x24f78b[_0x9d77('0x5c')],md5(_0x24f78b[_0x9d77('0x5c')]));}else{_0x24f78b[_0x9d77('0x5d')]='';}return getConnection(_0x3661cd)['then'](function(_0x58c22f){_0x5c1ac0=_0x58c22f;return getUser(_0x3661cd,_0x107773['email'],_0x5c1ac0);})[_0x9d77('0x20')](function(_0x5aa65a){_0x2a2095=_0x5aa65a;return getEndUser(_0x3661cd,_0x5023fd,_0x24f78b[_0x9d77('0x5e')],_0x24f78b[_0x9d77('0x5f')],_0x5c1ac0);})['then'](function(_0x127f43){_0x223e51=_0x127f43;return getTicket(_0x3661cd,_0x2a2095,_0x223e51,_0x5023fd,_0x24f78b,_0x5023fd[_0x9d77('0x60')],_0x5c1ac0,_0x9d77('0x56'));})[_0x9d77('0x20')](function(_0xafa1f8){_0x11dafc=_0xafa1f8;logger['info'](_0x9d77('0x61'),_0x11dafc['id']);logger[_0x9d77('0x19')](_0x9d77('0x62'),_0x11dafc['id'],_0x107773[_0x9d77('0x4c')],_0x3661cd['type']);switch(_0x3661cd[_0x9d77('0x45')]){case'integrationTab':emit(util[_0x9d77('0x40')]('user:%s',_0x107773['name']),'trigger:salesforce:display',{'recordId':_0x11dafc['id']});break;case _0x9d77('0x63'):emit(util['format']('user:%s',_0x107773['name']),'trigger:browser:url',{'uri':util[_0x9d77('0x40')](_0x9d77('0x64'),_0x5c1ac0[_0x9d77('0x65')],_0x11dafc['id'])});break;default:logger[_0x9d77('0x66')](_0x9d77('0x67'));}})[_0x9d77('0x68')](function(_0x146742){logger[_0x9d77('0x66')]('[QUEUE]',_0x146742);});};exports[_0x9d77('0x69')]=function(_0x35e6ea,_0x49e273,_0x131bb0,_0x4d8827,_0x2d4dc0,_0x460b37,_0x2b7b7b){var _0x17bd2e,_0x526237,_0x35a77f,_0x3f06ca;_0x460b37['serverUrl']=intUtil[_0x9d77('0x6a')](_0x460b37['serverUrl']);_0x460b37['remoteUri']=intUtil['stripTrailingSlash'](_0x460b37[_0x9d77('0x50')]);if(_0x2b7b7b&&_0x2b7b7b[_0x9d77('0x6b')]&&_0x2b7b7b['recordingFormat']!==_0x9d77('0x6c')){logger['info']('[OUTBOUND]',_0x9d77('0x5a'));_0x49e273[_0x9d77('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x460b37['serverUrl'],_0x49e273[_0x9d77('0x5c')],md5(_0x49e273[_0x9d77('0x5c')]));}return getConnection(_0x460b37)[_0x9d77('0x20')](function(_0x4e2de2){_0x3f06ca=_0x4e2de2;return getUser(_0x460b37,_0x4d8827['email'],_0x3f06ca);})[_0x9d77('0x20')](function(_0x34589f){_0x17bd2e=_0x34589f;return getEndUser(_0x460b37,_0x131bb0,_0x49e273['destcalleridname'],_0x49e273[_0x9d77('0x6d')],_0x3f06ca);})['then'](function(_0x44ee64){_0x526237=_0x44ee64;return getTicket(_0x460b37,_0x17bd2e,_0x526237,_0x131bb0,_0x49e273,_0x131bb0[_0x9d77('0x60')],_0x3f06ca,_0x9d77('0x69'));})[_0x9d77('0x20')](function(_0x49edde){_0x35a77f=_0x49edde;logger['info'](_0x9d77('0x6e'),_0x35a77f['id']);logger[_0x9d77('0x19')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x35a77f['id'],_0x4d8827['name'],_0x460b37[_0x9d77('0x45')]);switch(_0x460b37[_0x9d77('0x45')]){case _0x9d77('0x6f'):emit(util[_0x9d77('0x40')](_0x9d77('0x70'),_0x4d8827['name']),'trigger:salesforce:display',{'recordId':_0x35a77f['id']});break;case _0x9d77('0x63'):emit(util[_0x9d77('0x40')]('user:%s',_0x4d8827['name']),_0x9d77('0x71'),{'uri':util[_0x9d77('0x40')](_0x9d77('0x64'),_0x3f06ca[_0x9d77('0x65')],_0x35a77f['id'])});break;default:logger[_0x9d77('0x66')](_0x9d77('0x72'),_0x9d77('0x73'));}})[_0x9d77('0x68')](function(_0x595df0){logger[_0x9d77('0x66')](_0x9d77('0x72'),_0x595df0);});};exports[_0x9d77('0x74')]=function(_0x17803f,_0x4e0da7,_0x3e3c25,_0xba7284,_0x196d67,_0x23d50){var _0x23db12,_0x467bd9,_0x13ca9d,_0x462a21;_0x23d50[_0x9d77('0x57')]=intUtil[_0x9d77('0x6a')](_0x23d50['serverUrl']);_0x23d50[_0x9d77('0x50')]=intUtil['stripTrailingSlash'](_0x23d50[_0x9d77('0x50')]);if(_0x196d67&&_0x196d67['monitor_format']){logger[_0x9d77('0x19')]('['+_0x4e0da7['lastevent'][_0x9d77('0x75')]()+']','Recording\x20is\x20enabled!');_0x4e0da7['recordingURL']=util['format'](_0x9d77('0x5b'),_0x23d50[_0x9d77('0x57')],_0x4e0da7[_0x9d77('0x5c')],md5(_0x4e0da7['uniqueid']));}else{_0x4e0da7[_0x9d77('0x5d')]='';}return getConnection(_0x23d50)['then'](function(_0x1dc6b3){_0x462a21=_0x1dc6b3;if(!_[_0x9d77('0x1b')](_0xba7284)){return getUser(_0x23d50,_0xba7284['name'],_0x462a21);}else{return getUser(_0x23d50,null,_0x462a21);}})[_0x9d77('0x20')](function(_0x23d730){_0x23db12=_0x23d730;return getEndUser(_0x23d50,_0x3e3c25,_0x4e0da7['calleridname'],_0x4e0da7[_0x9d77('0x5f')],_0x462a21);})[_0x9d77('0x20')](function(_0x1f35ed){_0x467bd9=_0x1f35ed;return getTicket(_0x23d50,_0x23db12,_0x467bd9,_0x3e3c25,_0x4e0da7,_0x3e3c25[_0x9d77('0x60')],_0x462a21);})['then'](function(_0x5868a6){_0x13ca9d=_0x5868a6;logger[_0x9d77('0x19')]('['+_0x4e0da7[_0x9d77('0x76')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x13ca9d['id']);logger[_0x9d77('0x19')]('['+_0x4e0da7[_0x9d77('0x76')][_0x9d77('0x75')]()+']\x20Integration\x20account\x20type\x20%s.',_0x23d50['type']);})[_0x9d77('0x68')](function(_0x3a9a96){logger[_0x9d77('0x66')]('['+_0x4e0da7[_0x9d77('0x76')]['toUpperCase']()+']',_0x3a9a96);});}; \ No newline at end of file +var _0x378d=['toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','salesforce','redis','localhost','assign','getString','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','account','WhatId','contact','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','user_id','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','length','additionalSearchLead','$or','Lead','account_contact_lead','Account','Contact','additionalSearchAccount','first','Name','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','create','forEach','includes','string','idField','content'];(function(_0xc31458,_0x45ee76){var _0x1b4a90=function(_0x1a49b0){while(--_0x1a49b0){_0xc31458['push'](_0xc31458['shift']());}};_0x1b4a90(++_0x45ee76);}(_0x378d,0x138));var _0xd378=function(_0x5d660b,_0x2b6023){_0x5d660b=_0x5d660b-0x0;var _0x29263a=_0x378d[_0x5d660b];return _0x29263a;};'use strict';var _=require(_0xd378('0x0'));var rp=require('request-promise');var moment=require(_0xd378('0x1'));var BPromise=require(_0xd378('0x2'));var md5=require(_0xd378('0x3'));var jsforce=require(_0xd378('0x4'));var util=require(_0xd378('0x5'));var Redis=require(_0xd378('0x6'));var intUtil=require(_0xd378('0x7'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xd378('0x8'));config[_0xd378('0x9')]=_['defaults'](config['redis'],{'host':_0xd378('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd378('0x9')]));function emit(_0x4b4415,_0x353461,_0x314ece){io['to'](_0x4b4415)['emit'](_0x353461,_0x314ece);}function getTicket(_0x4e4093,_0x28fecb,_0x47d9a0,_0x300d83,_0x23d9b3,_0x19c5ef,_0x16f7eb,_0x36ed59){var _0x1e4617=Object[_0xd378('0xb')]({},{'OwnerId':_0x28fecb['id'],'Subject':intUtil[_0xd378('0xc')](_0x300d83['Subjects'],_0x23d9b3,'\x20'),'Description':intUtil['getString'](_0x300d83['Descriptions'],_0x23d9b3,'\x0a')},getCustomFields(_0x19c5ef,_0x23d9b3));if(_0x47d9a0){if(_0x300d83[_0xd378('0xd')]===_0xd378('0xe')){_0x1e4617[_0xd378('0xf')]=moment[_0xd378('0x10')]();_0x1e4617[_0xd378('0x11')]=![];_0x1e4617[_0xd378('0x12')]=![];if(_0x47d9a0[_0xd378('0x13')]==='contact'||_0x47d9a0['endUserType']==='lead'){_0x1e4617['WhoId']=_0x47d9a0['id'];}else if(_0x47d9a0[_0xd378('0x13')]===_0xd378('0x14')){_0x1e4617[_0xd378('0x15')]=_0x47d9a0['id'];}}else if(_0x300d83[_0xd378('0xd')]==='Case'){if(_0x47d9a0[_0xd378('0x13')]===_0xd378('0x16')){_0x1e4617[_0xd378('0x17')]=_0x47d9a0['id'];}else if(_0x47d9a0[_0xd378('0x13')]===_0xd378('0x14')){_0x1e4617[_0xd378('0x18')]=_0x47d9a0['id'];}else if(_0x47d9a0[_0xd378('0x13')]===_0xd378('0x19')&&_0x300d83[_0xd378('0x1a')]){_0x1e4617[_0x300d83[_0xd378('0x1a')]]=_0x47d9a0['id'];}else{logger[_0xd378('0x1b')](_0xd378('0x1c'));}}}return _0x16f7eb[_0xd378('0x1d')](_0x300d83[_0xd378('0xd')])['create'](_0x1e4617);}function getUser(_0x12e13e,_0x1d30e3,_0x243586){if(!_[_0xd378('0x1e')](_0x1d30e3)&&intUtil['validateEmail'](_0x1d30e3)){var _0x3b7021={'Email':_0x1d30e3};var _0x423d38={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x243586[_0xd378('0x1d')](_0xd378('0x1f'))[_0xd378('0x20')](_0x3b7021,_0x423d38)[_0xd378('0x21')]()[_0xd378('0x22')](function(_0x20098c){if(_0x20098c['length']){var _0x448510=_[_0xd378('0x20')](_0x20098c,function(_0x5311f6){return _0x5311f6[_0xd378('0x23')]===_0x1d30e3;});if(_0x448510){logger[_0xd378('0x1b')](_0xd378('0x24'),_0x1d30e3);return BPromise[_0xd378('0x25')]({'id':_0x448510['Id'],'name':_0x448510['Name']});}}else{logger[_0xd378('0x1b')](_0xd378('0x26'),_0x1d30e3);return _0x243586['identity']()[_0xd378('0x22')](function(_0x1cde15){return BPromise['resolve']({'id':_0x1cde15['user_id'],'name':_0x1cde15[_0xd378('0x27')]});});}});}else{logger['info'](_0xd378('0x26'),_0x1d30e3);return _0x243586['identity']()[_0xd378('0x22')](function(_0x580bcc){return BPromise[_0xd378('0x25')]({'id':_0x580bcc[_0xd378('0x28')],'name':_0x580bcc[_0xd378('0x27')]});});}}function getEndUser(_0x4f74f7,_0x2a5745,_0x4c8a5b,_0x582600,_0xa759df){var _0x54ffa2={'$or':{'Phone':_0x582600}};var _0x18fb2d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xd378('0x22')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x582600,_0x2a5745[_0xd378('0x29')]);switch(_0x2a5745[_0xd378('0x29')]){case _0xd378('0x2a'):var _0x153f9=_[_0xd378('0x2b')](_0x54ffa2);if(_0x2a5745[_0xd378('0x2c')]){var _0x2c3c82={};_0x2c3c82[_0x2a5745['additionalSearchContact']]=_0x582600;_[_0xd378('0x2d')](_0x153f9['$or'],_0x2c3c82);}return _0xa759df[_0xd378('0x1d')]('Contact')[_0xd378('0x20')](_0x153f9,_0x18fb2d)[_0xd378('0x21')]()[_0xd378('0x22')](function(_0x719b69){if(_0x719b69&&_0x719b69[_0xd378('0x2e')]){return _0x719b69;}else{var _0x4dec64=_[_0xd378('0x2b')](_0x54ffa2);if(_0x2a5745['additionalSearchLead']){var _0x55806c={};_0x55806c[_0x2a5745[_0xd378('0x2f')]]=_0x582600;_[_0xd378('0x2d')](_0x4dec64[_0xd378('0x30')],_0x55806c);}return _0xa759df[_0xd378('0x1d')](_0xd378('0x31'))[_0xd378('0x20')](_0x4dec64,_0x18fb2d);}});case _0xd378('0x32'):var _0x1cccee=_[_0xd378('0x2b')](_0x54ffa2);if(_0x2a5745['additionalSearchAccount']){var _0x2c3c82={};_0x2c3c82[_0x2a5745['additionalSearchAccount']]=_0x582600;_[_0xd378('0x2d')](_0x1cccee[_0xd378('0x30')],_0x2c3c82);}return _0xa759df['sobject'](_0xd378('0x33'))[_0xd378('0x20')](_0x1cccee,_0x18fb2d)[_0xd378('0x21')]()[_0xd378('0x22')](function(_0x5f3ebb){if(_0x5f3ebb&&_0x5f3ebb['length']){return _0x5f3ebb;}else{var _0x1db280=_['cloneDeep'](_0x54ffa2);if(_0x2a5745['additionalSearchContact']){var _0x16d8db={};_0x16d8db[_0x2a5745['additionalSearchContact']]=_0x582600;_[_0xd378('0x2d')](_0x1db280[_0xd378('0x30')],_0x16d8db);}return _0xa759df[_0xd378('0x1d')](_0xd378('0x34'))[_0xd378('0x20')](_0x1db280,_0x18fb2d)[_0xd378('0x22')](function(_0x56520f){if(_0x56520f&&_0x56520f[_0xd378('0x2e')]){return _0x56520f;}else{var _0x33d102=_[_0xd378('0x2b')](_0x54ffa2);if(_0x2a5745[_0xd378('0x2f')]){var _0x1377c8={};_0x1377c8[_0x2a5745[_0xd378('0x2f')]]=_0x582600;_[_0xd378('0x2d')](_0x33d102['$or'],_0x1377c8);}return _0xa759df['sobject'](_0xd378('0x31'))[_0xd378('0x20')](_0x33d102,_0x18fb2d);}});}});case'contact':var _0x153f9=_[_0xd378('0x2b')](_0x54ffa2);if(_0x2a5745[_0xd378('0x2c')]){var _0x2c3c82={};_0x2c3c82[_0x2a5745['additionalSearchContact']]=_0x582600;_[_0xd378('0x2d')](_0x153f9[_0xd378('0x30')],_0x2c3c82);}return _0xa759df['sobject'](_0xd378('0x34'))['find'](_0x153f9,_0x18fb2d)[_0xd378('0x21')]();case _0xd378('0x19'):var _0x77977b=_[_0xd378('0x2b')](_0x54ffa2);if(_0x2a5745['additionalSearchLead']){var _0x2c3c82={};_0x2c3c82[_0x2a5745[_0xd378('0x2f')]]=_0x582600;_[_0xd378('0x2d')](_0x77977b[_0xd378('0x30')],_0x2c3c82);}return _0xa759df[_0xd378('0x1d')](_0xd378('0x31'))['find'](_0x77977b,_0x18fb2d);case'account':var _0x1cccee=_[_0xd378('0x2b')](_0x54ffa2);if(_0x2a5745['additionalSearchAccount']){var _0x2c3c82={};_0x2c3c82[_0x2a5745[_0xd378('0x35')]]=_0x582600;_[_0xd378('0x2d')](_0x1cccee['$or'],_0x2c3c82);}return _0xa759df['sobject'](_0xd378('0x33'))[_0xd378('0x20')](_0x1cccee,_0x18fb2d);default:return null;}})[_0xd378('0x22')](function(_0x278106){if(_0x278106&&_0x278106[_0xd378('0x2e')]){var _0x1460d4=_[_0xd378('0x36')](_0x278106);if(_0x1460d4){return BPromise['resolve']({'id':_0x1460d4['Id'],'name':_0x1460d4[_0xd378('0x37')],'phone':_0x1460d4['Phone'],'endUserType':_0x1460d4[_0xd378('0x38')][_0xd378('0x39')]['toLowerCase']()});}}})[_0xd378('0x22')](function(_0x283334){if(_0x283334){logger[_0xd378('0x1b')](_0xd378('0x3a'),_0x283334[_0xd378('0x13')],_0x582600);return BPromise[_0xd378('0x25')](_0x283334);}else{logger[_0xd378('0x1b')](_0xd378('0x3b'),_0x582600);var _0x36e835={'Phone':_0x582600};if(_0x2a5745[_0xd378('0x3c')]){if(_0x2a5745['moduleCreate']===_0xd378('0x16')){logger['info'](_0xd378('0x3d'),_0x582600,_0x2a5745['moduleCreate']);_0x36e835[_0xd378('0x3e')]=_0x4c8a5b!==_0xd378('0x3f')?_0x4c8a5b:util[_0xd378('0x40')]('Caller\x20-\x20%s',_0x582600);}else if(_0x2a5745[_0xd378('0x3c')]===_0xd378('0x19')){logger[_0xd378('0x1b')](_0xd378('0x3d'),_0x582600,_0x2a5745[_0xd378('0x3c')]);_0x36e835[_0xd378('0x3e')]=_0x4c8a5b!==_0xd378('0x3f')?_0x4c8a5b:util[_0xd378('0x40')](_0xd378('0x41'),_0x582600);_0x36e835[_0xd378('0x42')]=_0xd378('0x43');}else if(_0x2a5745['moduleCreate']===_0xd378('0x14')){logger[_0xd378('0x1b')](_0xd378('0x3d'),_0x582600,_0x2a5745[_0xd378('0x3c')]);_0x36e835[_0xd378('0x37')]=_0x4c8a5b!==''?_0x4c8a5b:util[_0xd378('0x40')](_0xd378('0x41'),_0x582600);}else{return null;}}return _0xa759df['sobject'](_[_0xd378('0x44')](_0x2a5745[_0xd378('0x3c')]))[_0xd378('0x45')](_0x36e835)[_0xd378('0x22')](function(_0x554a9a){return BPromise['resolve']({'id':_0x554a9a['id'],'endUserType':_0x2a5745[_0xd378('0x3c')]});});}});}function getCustomFields(_0x5be94b,_0x573fe5){var _0x4711f0={};if(_0x5be94b[_0xd378('0x2e')]>0x0){_[_0xd378('0x46')](_0x5be94b,function(_0x147fa7){if(_[_0xd378('0x47')]([_0xd378('0x48'),'picklist'],_0x147fa7[_0xd378('0x39')])&&_0x147fa7['idField']){_0x4711f0[_0x147fa7[_0xd378('0x49')]]=_0x147fa7[_0xd378('0x4a')][_0xd378('0x4b')]();}else if(_0x147fa7[_0xd378('0x39')]===_0xd378('0x4c')&&_0x147fa7[_0xd378('0x4d')]&&_0x147fa7[_0xd378('0x49')]){_0x573fe5[_0x147fa7[_0xd378('0x4d')]]&&(_0x4711f0[_0x147fa7[_0xd378('0x49')]]=_0x573fe5[_0x147fa7[_0xd378('0x4d')]][_0xd378('0x4b')]());}else if(_0x147fa7[_0xd378('0x39')]===_0xd378('0x4e')&&_0x147fa7[_0xd378('0x4f')]&&_0x147fa7[_0xd378('0x4f')][_0xd378('0x50')]&&_0x147fa7[_0xd378('0x49')]){_0x573fe5[_0x147fa7[_0xd378('0x4f')][_0xd378('0x50')][_0xd378('0x51')]()]&&(_0x4711f0[_0x147fa7['idField']]=_0x573fe5[_0x147fa7[_0xd378('0x4f')]['name'][_0xd378('0x51')]()]['toString']());}});}return _0x4711f0;}function getConnection(_0x454597){var _0x40332a=_0x454597[_0xd378('0x52')][_0xd378('0x53')](_0x454597[_0xd378('0x54')]);var _0x3809b5=new jsforce['Connection']({'oauth2':{'loginUrl':_0x454597[_0xd378('0x55')]||_0xd378('0x56'),'clientId':_0x454597[_0xd378('0x57')],'clientSecret':_0x454597[_0xd378('0x58')]}});return _0x3809b5[_0xd378('0x59')](_0x454597[_0xd378('0x5a')],_0x40332a)[_0xd378('0x22')](function(){logger[_0xd378('0x1b')](_0xd378('0x5b'));return _0x3809b5;});}exports[_0xd378('0x5c')]=function(_0x5eea83,_0x4b8396,_0xe9d23f,_0x396537,_0x5b3ee1,_0x457aec){var _0x391211,_0x3e3709,_0x10bba8,_0x50602b;_0x457aec['serverUrl']=intUtil[_0xd378('0x5d')](_0x457aec[_0xd378('0x5e')]);_0x457aec[_0xd378('0x55')]=intUtil['stripTrailingSlash'](_0x457aec[_0xd378('0x55')]);if(_0x5b3ee1&&_0x5b3ee1['monitor_format']){logger[_0xd378('0x1b')](_0xd378('0x5f'),'Recording\x20is\x20enabled!');_0x4b8396[_0xd378('0x60')]=util['format'](_0xd378('0x61'),_0x457aec[_0xd378('0x5e')],_0x4b8396[_0xd378('0x62')],md5(_0x4b8396[_0xd378('0x62')]));}else{_0x4b8396[_0xd378('0x60')]='';}return getConnection(_0x457aec)[_0xd378('0x22')](function(_0x32d7ac){_0x50602b=_0x32d7ac;return getUser(_0x457aec,_0x396537[_0xd378('0x63')],_0x50602b);})[_0xd378('0x22')](function(_0x32c2e4){_0x391211=_0x32c2e4;return getEndUser(_0x457aec,_0xe9d23f,_0x4b8396['calleridname'],_0x4b8396[_0xd378('0x64')],_0x50602b);})[_0xd378('0x22')](function(_0x3784e6){_0x3e3709=_0x3784e6;return getTicket(_0x457aec,_0x391211,_0x3e3709,_0xe9d23f,_0x4b8396,_0xe9d23f['Fields'],_0x50602b,'queue');})[_0xd378('0x22')](function(_0x3d9a3b){_0x10bba8=_0x3d9a3b;logger[_0xd378('0x1b')](_0xd378('0x65'),_0x10bba8['id']);logger[_0xd378('0x1b')](_0xd378('0x66'),_0x10bba8['id'],_0x396537['name'],_0x457aec[_0xd378('0x39')]);switch(_0x457aec[_0xd378('0x39')]){case _0xd378('0x67'):emit(util[_0xd378('0x40')](_0xd378('0x68'),_0x396537[_0xd378('0x50')]),_0xd378('0x69'),{'recordId':_0x10bba8['id']});break;case _0xd378('0x6a'):emit(util[_0xd378('0x40')](_0xd378('0x68'),_0x396537[_0xd378('0x50')]),_0xd378('0x6b'),{'uri':util['format'](_0xd378('0x6c'),_0x50602b['instanceUrl'],_0x10bba8['id'])});break;default:logger[_0xd378('0x6d')](_0xd378('0x6e'));}})[_0xd378('0x6f')](function(_0x530c71){logger[_0xd378('0x6d')](_0xd378('0x5f'),_0x530c71);});};exports[_0xd378('0x70')]=function(_0x486e4d,_0x5aa39f,_0x5d2937,_0x505f88,_0x3aa0ae,_0x54b88f,_0x33c4ec){var _0xbf0e05,_0xcc2194,_0x127626,_0x8dbd9e;_0x54b88f[_0xd378('0x5e')]=intUtil[_0xd378('0x5d')](_0x54b88f[_0xd378('0x5e')]);_0x54b88f['remoteUri']=intUtil[_0xd378('0x5d')](_0x54b88f[_0xd378('0x55')]);if(_0x33c4ec&&_0x33c4ec[_0xd378('0x71')]&&_0x33c4ec[_0xd378('0x71')]!==_0xd378('0x72')){logger[_0xd378('0x1b')]('[OUTBOUND]',_0xd378('0x73'));_0x5aa39f[_0xd378('0x60')]=util[_0xd378('0x40')](_0xd378('0x61'),_0x54b88f[_0xd378('0x5e')],_0x5aa39f[_0xd378('0x62')],md5(_0x5aa39f[_0xd378('0x62')]));}return getConnection(_0x54b88f)['then'](function(_0x7f9d62){_0x8dbd9e=_0x7f9d62;return getUser(_0x54b88f,_0x505f88['email'],_0x8dbd9e);})[_0xd378('0x22')](function(_0x1a32dd){_0xbf0e05=_0x1a32dd;return getEndUser(_0x54b88f,_0x5d2937,_0x5aa39f[_0xd378('0x74')],_0x5aa39f[_0xd378('0x75')],_0x8dbd9e);})['then'](function(_0x2fa02b){_0xcc2194=_0x2fa02b;return getTicket(_0x54b88f,_0xbf0e05,_0xcc2194,_0x5d2937,_0x5aa39f,_0x5d2937[_0xd378('0x76')],_0x8dbd9e,_0xd378('0x70'));})['then'](function(_0x3ad25a){_0x127626=_0x3ad25a;logger[_0xd378('0x1b')](_0xd378('0x77'),_0x127626['id']);logger[_0xd378('0x1b')](_0xd378('0x78'),_0x127626['id'],_0x505f88[_0xd378('0x50')],_0x54b88f[_0xd378('0x39')]);switch(_0x54b88f[_0xd378('0x39')]){case'integrationTab':emit(util[_0xd378('0x40')]('user:%s',_0x505f88['name']),'trigger:salesforce:display',{'recordId':_0x127626['id']});break;case _0xd378('0x6a'):emit(util[_0xd378('0x40')](_0xd378('0x68'),_0x505f88[_0xd378('0x50')]),_0xd378('0x6b'),{'uri':util[_0xd378('0x40')](_0xd378('0x6c'),_0x8dbd9e[_0xd378('0x79')],_0x127626['id'])});break;default:logger[_0xd378('0x6d')](_0xd378('0x7a'),_0xd378('0x7b'));}})[_0xd378('0x6f')](function(_0x3d994c){logger[_0xd378('0x6d')](_0xd378('0x7a'),_0x3d994c);});};exports[_0xd378('0x7c')]=function(_0x15089b,_0xa7fed6,_0x37ea36,_0x27292c,_0x5ccd7b,_0xf13b41){var _0x48b781,_0x432083,_0x33bdd8,_0x21c045;_0xf13b41['serverUrl']=intUtil['stripTrailingSlash'](_0xf13b41[_0xd378('0x5e')]);_0xf13b41[_0xd378('0x55')]=intUtil['stripTrailingSlash'](_0xf13b41['remoteUri']);if(_0x5ccd7b&&_0x5ccd7b['monitor_format']){logger['info']('['+_0xa7fed6[_0xd378('0x7d')][_0xd378('0x7e')]()+']',_0xd378('0x73'));_0xa7fed6['recordingURL']=util[_0xd378('0x40')](_0xd378('0x61'),_0xf13b41[_0xd378('0x5e')],_0xa7fed6[_0xd378('0x62')],md5(_0xa7fed6['uniqueid']));}else{_0xa7fed6[_0xd378('0x60')]='';}return getConnection(_0xf13b41)[_0xd378('0x22')](function(_0x483f4f){_0x21c045=_0x483f4f;if(!_[_0xd378('0x1e')](_0x27292c)){return getUser(_0xf13b41,_0x27292c[_0xd378('0x50')],_0x21c045);}else{return getUser(_0xf13b41,null,_0x21c045);}})['then'](function(_0xc73b88){_0x48b781=_0xc73b88;return getEndUser(_0xf13b41,_0x37ea36,_0xa7fed6[_0xd378('0x7f')],_0xa7fed6[_0xd378('0x64')],_0x21c045);})[_0xd378('0x22')](function(_0x4494e9){_0x432083=_0x4494e9;return getTicket(_0xf13b41,_0x48b781,_0x432083,_0x37ea36,_0xa7fed6,_0x37ea36[_0xd378('0x76')],_0x21c045);})[_0xd378('0x22')](function(_0x298d97){_0x33bdd8=_0x298d97;logger[_0xd378('0x1b')]('['+_0xa7fed6[_0xd378('0x7d')][_0xd378('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x33bdd8['id']);logger[_0xd378('0x1b')]('['+_0xa7fed6[_0xd378('0x7d')]['toUpperCase']()+_0xd378('0x80'),_0xf13b41['type']);})[_0xd378('0x6f')](function(_0x14cf03){logger[_0xd378('0x6d')]('['+_0xa7fed6['lastevent'][_0xd378('0x7e')]()+']',_0x14cf03);});}; \ 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 7ceefb0..d14c2fe 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 _0xb0fd=['uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','ticketId',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','./util','../../../../config/environment','../../../../config/logger','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','toUpperCase','],\x20getAdminUser\x20crm','message','info','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','catch','error','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','then','],\x20EndUser\x20schema','endUserId','sys_id','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','toLowerCase','content','toString','string','idField','customField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','incident','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged'];(function(_0x2c643a,_0x3bfe37){var _0x40cbe1=function(_0x40d0bb){while(--_0x40d0bb){_0x2c643a['push'](_0x2c643a['shift']());}};_0x40cbe1(++_0x3bfe37);}(_0xb0fd,0xdb));var _0xdb0f=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0xb0fd[_0x3bf925];return _0x2128a1;};'use strict';var _=require(_0xdb0f('0x0'));var Promise=require(_0xdb0f('0x1'));var rp=require(_0xdb0f('0x2'));var util=require(_0xdb0f('0x3'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0xdb0f('0x4'));var config=require(_0xdb0f('0x5'));var logger=require(_0xdb0f('0x6'))('servicenow');config[_0xdb0f('0x7')]=_['defaults'](config['redis'],{'host':_0xdb0f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdb0f('0x7')]));function getAdminUser(_0x4a2946,_0x588977,_0x1b0eb8,_0x2effad,_0x454809,_0xdf95e2){return new Promise(function(_0x2f5ba5,_0x194ef2){var _0xcc6ddb={'method':_0xdb0f('0x9'),'uri':_0x2effad+_0xdb0f('0xa')+'&'+_0x454809+'&'+_0xdf95e2,'auth':_0x588977,'json':!![]};return rp(_0xcc6ddb)['then'](function(_0x463daa){if(_0x463daa[_0xdb0f('0xb')][_0xdb0f('0xc')]>0x0){_0x1b0eb8[_0xdb0f('0xd')]=_0x463daa[_0xdb0f('0xb')][0x0]['sys_id'];}logger['info']('['+[_0x4a2946[_0xdb0f('0xe')]()]+_0xdb0f('0xf'),_0x1b0eb8);_0x2f5ba5(_0x1b0eb8);})['catch'](function(_0x3f4ea1){logger['error']('['+[_0x4a2946[_0xdb0f('0xe')]()]+']',_0x3f4ea1[_0xdb0f('0x10')]);_0x194ef2(_0x3f4ea1[_0xdb0f('0x10')]);});});}function getUser(_0x376880,_0x2a0b72,_0x1acd79,_0x34011a,_0x4dee83){return function(_0x220d3e){logger[_0xdb0f('0x11')]('['+[_0x376880['toUpperCase']()]+_0xdb0f('0x12'),_0x220d3e);return new Promise(function(_0x228c6f,_0x527d47){if(intUtil['validateEmail'](_0x220d3e[_0xdb0f('0x13')])){var _0x5dbeb4={'method':'GET','uri':_0x1acd79+_0xdb0f('0x14')+_0x220d3e['userEmail']+'&'+_0x34011a+'&'+_0x4dee83,'auth':_0x2a0b72,'json':!![]};logger[_0xdb0f('0x11')]('['+[_0x376880[_0xdb0f('0xe')]()]+_0xdb0f('0x15'),_0x5dbeb4);return rp(_0x5dbeb4)['then'](function(_0x3d340c){logger['info']('['+[_0x376880[_0xdb0f('0xe')]()]+_0xdb0f('0x16'),_0x3d340c);if(_0x3d340c['result']['length']>0x0&&String(_0x3d340c['result'][0x0][_0xdb0f('0x17')])===_0xdb0f('0x18')){_0x220d3e[_0xdb0f('0x19')]=_0x3d340c['result'][0x0]['sys_id'];}else{_0x220d3e['userId']=_0x220d3e[_0xdb0f('0xd')];_0x220d3e[_0xdb0f('0x13')]=_0x220d3e[_0xdb0f('0x1a')];}logger[_0xdb0f('0x11')]('['+[_0x376880[_0xdb0f('0xe')]()]+'],\x20getUser\x20crm',_0x220d3e);_0x228c6f(_0x220d3e);})[_0xdb0f('0x1b')](function(_0xed8c71){logger[_0xdb0f('0x1c')]('['+[_0x376880['toUpperCase']()]+']',_0xed8c71[_0xdb0f('0x10')]);_0x527d47(_0xed8c71[_0xdb0f('0x10')]);});}else{logger['info']('['+[_0x376880['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x220d3e[_0xdb0f('0x19')]=_0x220d3e['adminId'];_0x220d3e[_0xdb0f('0x13')]=_0x220d3e[_0xdb0f('0x1a')];_0x228c6f(_0x220d3e);}});};}function createEndUser(_0x499c2d,_0x42d82d,_0x411db6,_0x1d7003,_0x8f6124){logger[_0xdb0f('0x11')]('['+[_0x499c2d['toUpperCase']()]+_0xdb0f('0x1d'),_0x411db6);return new Promise(function(_0x3d7710,_0x5eb706){var _0x350fd8={'method':_0xdb0f('0x1e'),'uri':_0x1d7003+'sys_user?'+_0x8f6124,'body':{'user_name':_0x411db6[_0xdb0f('0x1f')],'roles':_0xdb0f('0x20'),'first_name':_0x411db6['endUserNumber'],'active':_0xdb0f('0x18'),'date_format':_0xdb0f('0x21'),'phone':_0x411db6[_0xdb0f('0x1f')]},'auth':_0x42d82d,'json':!![]};return rp(_0x350fd8)[_0xdb0f('0x22')](function(_0x3341e3){logger['info']('['+[_0x499c2d[_0xdb0f('0xe')]()]+_0xdb0f('0x23'),_0x3341e3[_0xdb0f('0xb')]);_0x411db6[_0xdb0f('0x24')]=_0x3341e3['result'][_0xdb0f('0x25')];_0x3d7710(_0x411db6);})[_0xdb0f('0x1b')](function(_0x527d3e){logger[_0xdb0f('0x1c')]('['+[_0x499c2d['toUpperCase']()]+']',_0x527d3e[_0xdb0f('0x10')]);_0x5eb706(_0x527d3e[_0xdb0f('0x10')]);});});}function getEndUser(_0x6fd98c,_0x3ac6fd,_0x5c0a24,_0x528d97,_0x35eb0d){return function(_0x3fb838){logger[_0xdb0f('0x11')]('['+[_0x6fd98c[_0xdb0f('0xe')]()]+_0xdb0f('0x26'),_0x3fb838);return new Promise(function(_0x4ab893,_0x555d5c){var _0x5a975a={'method':_0xdb0f('0x9'),'uri':_0x5c0a24+_0xdb0f('0x27')+_0x3fb838[_0xdb0f('0x1f')]+'&'+_0x528d97+'&'+_0x35eb0d,'auth':_0x3ac6fd,'json':!![]};return rp(_0x5a975a)[_0xdb0f('0x22')](function(_0x545e0b){if(_0x545e0b[_0xdb0f('0xb')]['length']>0x0){_0x3fb838[_0xdb0f('0x24')]=_0x545e0b[_0xdb0f('0xb')][0x0][_0xdb0f('0x25')];logger['info']('['+[_0x6fd98c[_0xdb0f('0xe')]()]+_0xdb0f('0x28'),_0x3fb838);_0x4ab893(_0x3fb838);}else{return createEndUser(_0x6fd98c,_0x3ac6fd,_0x3fb838,_0x5c0a24,_0x528d97)[_0xdb0f('0x22')](function(_0x232af5){logger[_0xdb0f('0x11')]('['+[_0x6fd98c['toUpperCase']()]+_0xdb0f('0x29'),_0x232af5);_0x4ab893(_0x232af5);});}})[_0xdb0f('0x1b')](function(_0x1aae54){logger[_0xdb0f('0x1c')]('['+[_0x6fd98c[_0xdb0f('0xe')]()]+']',_0x1aae54[_0xdb0f('0x10')]);_0x555d5c(_0x1aae54[_0xdb0f('0x10')]);});});};}function getCustomFields(_0x591b07,_0x2049b6){var _0x43f04f={};if(_0x591b07[_0xdb0f('0xc')]>0x0){_[_0xdb0f('0x2a')](_0x591b07,function(_0x383dfc){if(_[_0xdb0f('0x2b')](['string',_0xdb0f('0x2c')],_0x383dfc[_0xdb0f('0x2d')])&&_0x383dfc[_0xdb0f('0x2e')]&&!_0x383dfc['customField']){_0x43f04f[_0x383dfc['nameField'][_0xdb0f('0x2f')]()]=_0x383dfc[_0xdb0f('0x30')][_0xdb0f('0x31')]();}else if(_[_0xdb0f('0x2b')]([_0xdb0f('0x32'),_0xdb0f('0x2c')],_0x383dfc['type'])&&_0x383dfc[_0xdb0f('0x33')]&&_0x383dfc[_0xdb0f('0x34')]){_0x43f04f[_0x383dfc[_0xdb0f('0x33')][_0xdb0f('0x2f')]()]=_0x383dfc[_0xdb0f('0x30')][_0xdb0f('0x31')]();}else if(_0x383dfc[_0xdb0f('0x2d')]==='variable'&&_0x383dfc[_0xdb0f('0x35')]&&_0x383dfc[_0xdb0f('0x33')]&&_0x383dfc[_0xdb0f('0x34')]){_0x43f04f[_0x383dfc[_0xdb0f('0x33')][_0xdb0f('0x2f')]()]=_0x2049b6[_0x383dfc[_0xdb0f('0x35')]]['toString']();}else if(_0x383dfc[_0xdb0f('0x2d')]==='customVariable'&&_0x383dfc[_0xdb0f('0x36')]&&_0x383dfc[_0xdb0f('0x36')][_0xdb0f('0x37')]&&_0x383dfc['idField']&&_0x383dfc['customField']){_0x43f04f[_0x383dfc['idField'][_0xdb0f('0x2f')]()]=_0x2049b6[_0x383dfc['Variable']['name'][_0xdb0f('0x2f')]()][_0xdb0f('0x31')]();}});}return _0x43f04f;}function getTicket(_0x1d236f,_0x1bd474,_0x24fcd2,_0x280f06,_0x1b4991,_0x53727a){return function(_0x2d9e27){logger[_0xdb0f('0x11')]('['+[_0x1d236f[_0xdb0f('0xe')]()]+_0xdb0f('0x38'),_0x2d9e27);return new Promise(function(_0xa9bc4f,_0xf893fc){var _0x4cfc5e=_0x1d236f[_0xdb0f('0x2f')]()==='outbound'?_0x2d9e27['userId']:_0x2d9e27['endUserId'];var _0x55f82f={'method':'POST','uri':_0x24fcd2+'incident'+'?'+_0x53727a,'body':Object[_0xdb0f('0x39')]({},{'active':_0xdb0f('0x18'),'caller_id':_0x4cfc5e,'assigned_to':_0x2d9e27[_0xdb0f('0x19')],'short_description':intUtil[_0xdb0f('0x3a')](_0x280f06['Subjects'],_0x1b4991,'\x20'),'description':intUtil[_0xdb0f('0x3a')](_0x280f06[_0xdb0f('0x3b')],_0x1b4991,'\x0a')},getCustomFields(_0x280f06[_0xdb0f('0x3c')],_0x1b4991)),'auth':_0x1bd474,'json':!![]};return rp(_0x55f82f)[_0xdb0f('0x22')](function(_0x51f9f4){logger[_0xdb0f('0x11')]('['+[_0x1d236f[_0xdb0f('0xe')]()]+_0xdb0f('0x3d'),_0x51f9f4['result']);_0x2d9e27['ticketId']=_0x51f9f4[_0xdb0f('0xb')][_0xdb0f('0x25')];_0x2d9e27['ticketNumber']=_0x51f9f4['result'][_0xdb0f('0x3e')];logger['info']('['+[_0x1d236f[_0xdb0f('0xe')]()]+_0xdb0f('0x3f'),_0x2d9e27);_0xa9bc4f(_0x2d9e27);})[_0xdb0f('0x1b')](function(_0x265f2c){logger['error']('['+[_0x1d236f[_0xdb0f('0xe')]()]+']',_0x265f2c[_0xdb0f('0x10')]);_0xf893fc(_0x265f2c[_0xdb0f('0x10')]);});});};}function createRemoteTag(_0x2c3107,_0x1daeeb,_0xe24ee0,_0x41fd4d){return new Promise(function(_0x1a38b9,_0x21d5dc){var _0x20e357={'method':_0xdb0f('0x1e'),'uri':_0xe24ee0+_0xdb0f('0x40')+'?'+_0x41fd4d,'body':{'short_description':_0x2c3107,'global':!![],'active':!![],'name':_0x2c3107},'auth':_0x1daeeb,'json':!![]};return rp(_0x20e357)['then'](function(_0x4d16a5){var _0x70892d=_0x4d16a5[_0xdb0f('0xb')][_0xdb0f('0x25')];_0x1a38b9(_0x70892d);});});}function getRemoteTag(_0x4b56a8,_0x3cc057,_0x16dab1,_0x1fec7c,_0x2c92dd){return new Promise(function(_0x2ed4a1,_0x12ab4f){var _0x4fd218={'method':_0xdb0f('0x9'),'uri':_0x16dab1+_0xdb0f('0x40')+'?sysparm_query=name%3D'+_0x4b56a8+'&'+_0x1fec7c,'auth':_0x3cc057,'json':!![]};return rp(_0x4fd218)['then'](function(_0x5517ad){if(_0x5517ad[_0xdb0f('0xb')]['length']>0x0){var _0x432dae=_0x5517ad[_0xdb0f('0xb')][0x0][_0xdb0f('0x25')];_0x2ed4a1(_0x432dae);}else{return createRemoteTag(_0x4b56a8,_0x3cc057,_0x16dab1,_0x1fec7c)['then'](function(_0x4bb125){_0x2ed4a1(_0x4bb125);});}});});}function assignTagToIncident(_0x45e8c0,_0x587987,_0x51fc06,_0x38512d,_0x35f9a0){return new Promise(function(_0x4a76c0,_0x5a3196){var _0x50e234={'method':_0xdb0f('0x1e'),'uri':_0x51fc06+'label_entry'+'?'+_0x35f9a0,'body':{'label':_0x45e8c0,'table':_0xdb0f('0x41'),'id_type':_0xdb0f('0x42'),'table_key':_0x38512d['ticketId'],'title':'Incident\x20-\x20'+_0x38512d['ticketNumber'],'id_display':_0x38512d['ticketNumber']},'auth':_0x587987,'json':!![]};return rp(_0x50e234)[_0xdb0f('0x22')](function(_0x16490d){_0x4a76c0();})[_0xdb0f('0x1b')](function(){_0x4a76c0();});});}function manageTags(_0x2f6d9d,_0x58ca58,_0x431645,_0x12d014,_0x5446ce,_0x38bd5c,_0x337d01){return new Promise(function(_0x175ac5,_0x707d0a){var _0x38231e=[];_0x58ca58[_0xdb0f('0x2a')](function(_0x2621e2){_0x38231e[_0xdb0f('0x43')](getRemoteTag(_0x2621e2,_0x431645,_0x12d014,_0x38bd5c,_0x337d01));});return Promise[_0xdb0f('0x44')](_0x38231e)[_0xdb0f('0x22')](function(_0x1dc6d8){if(_0x1dc6d8['length']){logger[_0xdb0f('0x11')]('['+[_0x2f6d9d[_0xdb0f('0xe')]()]+_0xdb0f('0x45'),_0x1dc6d8);var _0x46ceac=[];_0x1dc6d8[_0xdb0f('0x2a')](function(_0x1e50ce){_0x46ceac[_0xdb0f('0x43')](assignTagToIncident(_0x1e50ce,_0x431645,_0x12d014,_0x5446ce,_0x38bd5c));});return Promise['all'](_0x46ceac)[_0xdb0f('0x22')](function(){_0x175ac5();})['catch'](function(){_0x175ac5();});}else{_0x175ac5();}});});}function getTags(_0x952fc1,_0x2f7525,_0x5154b5,_0x6e6706,_0x1542d3,_0x2fe382){return function(_0x3a34b4){return new Promise(function(_0x6feec2,_0x53eaa0){var _0x2ac498=[];var _0x202545=_0x6e6706[_0xdb0f('0x46')];if(_0x202545&&_0x202545[_0xdb0f('0xc')]>0x0){_0x2ac498=_[_0xdb0f('0x47')](_0x202545,'name');}if(_0x2ac498['length']>0x0){return manageTags(_0x952fc1,_0x2ac498,_0x2f7525,_0x5154b5,_0x3a34b4,_0x1542d3,_0x2fe382)[_0xdb0f('0x22')](function(){_0x6feec2(_0x3a34b4);});}else{_0x6feec2(_0x3a34b4);}});};}function emit(_0x3425cb,_0x269fa2,_0x4df9f4){var _0x57de54='%26sysparm_record_target%3Dincident'+_0xdb0f('0x48')+_0xdb0f('0x49')+_0xdb0f('0x4a');var _0x25780f={'uri':_0x3425cb+_0xdb0f('0x4b')+_0x4df9f4+_0x57de54};io['to'](util[_0xdb0f('0x4c')](_0xdb0f('0x4d'),_0x269fa2))[_0xdb0f('0x4e')](_0xdb0f('0x4f'),_0x25780f);}exports['cs']=function(_0x4d227a,_0x2602c8,_0x1678a6,_0x3bcbf6,_0x141752,_0x39f387,_0x3ca0a3,_0x1a878e){var _0xa5fdac={};var _0x320122={'user':_0x39f387[_0xdb0f('0x50')],'pass':_0x39f387[_0xdb0f('0x51')]};var _0x547adf=_0xdb0f('0x52');var _0x3aaf0c=_0xdb0f('0x53');_0x39f387[_0xdb0f('0x54')]=intUtil[_0xdb0f('0x55')](_0x39f387['remoteUri']);_0x39f387[_0xdb0f('0x56')]=intUtil[_0xdb0f('0x55')](_0x39f387['serverUrl']);var _0x1996bc=util['format'](_0xdb0f('0x57'),_0x39f387['remoteUri']);_0xa5fdac[_0xdb0f('0x13')]=!_[_0xdb0f('0x58')](_0x3bcbf6)?_0x3bcbf6[_0xdb0f('0x59')]:null;_0xa5fdac['adminEmail']=_0x39f387[_0xdb0f('0x59')];_0xa5fdac[_0xdb0f('0x1f')]=_0x1a878e[_0xdb0f('0x2f')]()===_0xdb0f('0x5a')?_0x2602c8[_0xdb0f('0x5b')]:_0x2602c8[_0xdb0f('0x5c')];_0xa5fdac[_0xdb0f('0x5d')]=_0x1a878e===_0xdb0f('0x5e')||_0x1a878e===_0xdb0f('0x5f')?_0xdb0f('0x5e'):_0xdb0f('0x5a');var _0x1e4862=util[_0xdb0f('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39f387[_0xdb0f('0x56')],_0x2602c8[_0xdb0f('0x60')],md5(_0x2602c8[_0xdb0f('0x60')]));if(_0x141752&&_0x141752[_0xdb0f('0x61')]){logger[_0xdb0f('0x11')]('[QUEUE]',_0xdb0f('0x62'));_0x2602c8[_0xdb0f('0x63')]=_0x1e4862;}else if(_0x3ca0a3&&_0x3ca0a3[_0xdb0f('0x64')]&&_0x3ca0a3['recordingFormat']!==_0xdb0f('0x65')){logger[_0xdb0f('0x11')]('[OUTBOUND]',_0xdb0f('0x62'));_0x2602c8[_0xdb0f('0x63')]=_0x1e4862;}else{_0x2602c8[_0xdb0f('0x63')]='';}return getAdminUser(_0x1a878e,_0x320122,_0xa5fdac,_0x1996bc,_0x3aaf0c,_0x547adf)[_0xdb0f('0x22')](getUser(_0x1a878e,_0x320122,_0x1996bc,_0x3aaf0c,_0x547adf))[_0xdb0f('0x22')](getEndUser(_0x1a878e,_0x320122,_0x1996bc,_0x3aaf0c,_0x547adf))['then'](getTicket(_0x1a878e,_0x320122,_0x1996bc,_0x1678a6,_0x2602c8,_0x3aaf0c))['then'](function(_0x365061){logger[_0xdb0f('0x11')](util[_0xdb0f('0x4c')]('The\x20ticket\x20ID\x20is:\x20%s',_0x365061[_0xdb0f('0x66')]));logger['info'](util[_0xdb0f('0x4c')]('call\x20direction:\x20%s',_0x1a878e));if(_0x1a878e!==_0xdb0f('0x5f')){logger[_0xdb0f('0x11')]('['+[_0x1a878e[_0xdb0f('0xe')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x39f387[_0xdb0f('0x54')],_0x3bcbf6[_0xdb0f('0x37')],_0x365061[_0xdb0f('0x66')]);}})[_0xdb0f('0x1b')](function(_0x5683dc){logger[_0xdb0f('0x1c')]('['+[_0x1a878e['toUpperCase']()]+_0xdb0f('0x67'),util[_0xdb0f('0x68')](_0x5683dc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcce9=['sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','sys_id','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','content','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase',']\x20getTicket\x20input\x20crm','outbound','userId','incident','assign','getString',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','Incident','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','util','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET'];(function(_0x205cf1,_0x4f82f5){var _0x31f695=function(_0x149fa0){while(--_0x149fa0){_0x205cf1['push'](_0x205cf1['shift']());}};_0x31f695(++_0x4f82f5);}(_0xcce9,0x13b));var _0x9cce=function(_0xa90760,_0x23ed3d){_0xa90760=_0xa90760-0x0;var _0x181e9c=_0xcce9[_0xa90760];return _0x181e9c;};'use strict';var _=require(_0x9cce('0x0'));var Promise=require(_0x9cce('0x1'));var rp=require('request-promise');var util=require(_0x9cce('0x2'));var md5=require('md5');var Redis=require(_0x9cce('0x3'));var intUtil=require(_0x9cce('0x4'));var config=require('../../../../config/environment');var logger=require(_0x9cce('0x5'))(_0x9cce('0x6'));config[_0x9cce('0x7')]=_[_0x9cce('0x8')](config[_0x9cce('0x7')],{'host':_0x9cce('0x9'),'port':0x18eb});var io=require(_0x9cce('0xa'))(new Redis(config[_0x9cce('0x7')]));function getAdminUser(_0x589ccf,_0x37e8ea,_0x362428,_0x55b93c,_0x5749e2,_0x2f6236){return new Promise(function(_0xd5282,_0x20c5f3){var _0x488927={'method':_0x9cce('0xb'),'uri':_0x55b93c+_0x9cce('0xc')+'&'+_0x5749e2+'&'+_0x2f6236,'auth':_0x37e8ea,'json':!![]};return rp(_0x488927)[_0x9cce('0xd')](function(_0x51a3ce){if(_0x51a3ce[_0x9cce('0xe')][_0x9cce('0xf')]>0x0){_0x362428[_0x9cce('0x10')]=_0x51a3ce[_0x9cce('0xe')][0x0]['sys_id'];}logger[_0x9cce('0x11')]('['+[_0x589ccf[_0x9cce('0x12')]()]+_0x9cce('0x13'),_0x362428);_0xd5282(_0x362428);})[_0x9cce('0x14')](function(_0x509e73){logger[_0x9cce('0x15')]('['+[_0x589ccf[_0x9cce('0x12')]()]+']',_0x509e73['message']);_0x20c5f3(_0x509e73[_0x9cce('0x16')]);});});}function getUser(_0x2d07bd,_0x23c8ec,_0x27e69a,_0x30ec4e,_0x19bf88){return function(_0x1b3517){logger['info']('['+[_0x2d07bd[_0x9cce('0x12')]()]+'],\x20getUser\x20input\x20crm',_0x1b3517);return new Promise(function(_0x329d8d,_0x5eda48){if(intUtil[_0x9cce('0x17')](_0x1b3517[_0x9cce('0x18')])){var _0x20c022={'method':'GET','uri':_0x27e69a+'sys_user?sysparm_query=email%3D'+_0x1b3517[_0x9cce('0x18')]+'&'+_0x30ec4e+'&'+_0x19bf88,'auth':_0x23c8ec,'json':!![]};logger['info']('['+[_0x2d07bd['toUpperCase']()]+_0x9cce('0x19'),_0x20c022);return rp(_0x20c022)[_0x9cce('0xd')](function(_0xd96c61){logger[_0x9cce('0x11')]('['+[_0x2d07bd['toUpperCase']()]+_0x9cce('0x1a'),_0xd96c61);if(_0xd96c61[_0x9cce('0xe')][_0x9cce('0xf')]>0x0&&String(_0xd96c61['result'][0x0]['active'])===_0x9cce('0x1b')){_0x1b3517['userId']=_0xd96c61['result'][0x0][_0x9cce('0x1c')];}else{_0x1b3517['userId']=_0x1b3517[_0x9cce('0x10')];_0x1b3517[_0x9cce('0x18')]=_0x1b3517['adminEmail'];}logger[_0x9cce('0x11')]('['+[_0x2d07bd[_0x9cce('0x12')]()]+_0x9cce('0x1d'),_0x1b3517);_0x329d8d(_0x1b3517);})['catch'](function(_0xfafdec){logger[_0x9cce('0x15')]('['+[_0x2d07bd[_0x9cce('0x12')]()]+']',_0xfafdec[_0x9cce('0x16')]);_0x5eda48(_0xfafdec[_0x9cce('0x16')]);});}else{logger['info']('['+[_0x2d07bd[_0x9cce('0x12')]()]+_0x9cce('0x1e'));_0x1b3517['userId']=_0x1b3517['adminId'];_0x1b3517[_0x9cce('0x18')]=_0x1b3517[_0x9cce('0x1f')];_0x329d8d(_0x1b3517);}});};}function createEndUser(_0x2fa33c,_0x409883,_0x11e5f3,_0x4d0f11,_0x41a33b){logger[_0x9cce('0x11')]('['+[_0x2fa33c['toUpperCase']()]+_0x9cce('0x20'),_0x11e5f3);return new Promise(function(_0xd713d0,_0x315c00){var _0x380795={'method':_0x9cce('0x21'),'uri':_0x4d0f11+_0x9cce('0x22')+_0x41a33b,'body':{'user_name':_0x11e5f3['endUserNumber'],'roles':_0x9cce('0x23'),'first_name':_0x11e5f3['endUserNumber'],'active':_0x9cce('0x1b'),'date_format':_0x9cce('0x24'),'phone':_0x11e5f3[_0x9cce('0x25')]},'auth':_0x409883,'json':!![]};return rp(_0x380795)[_0x9cce('0xd')](function(_0x17d451){logger['info']('['+[_0x2fa33c[_0x9cce('0x12')]()]+_0x9cce('0x26'),_0x17d451[_0x9cce('0xe')]);_0x11e5f3[_0x9cce('0x27')]=_0x17d451['result']['sys_id'];_0xd713d0(_0x11e5f3);})['catch'](function(_0x2f8b94){logger['error']('['+[_0x2fa33c[_0x9cce('0x12')]()]+']',_0x2f8b94[_0x9cce('0x16')]);_0x315c00(_0x2f8b94[_0x9cce('0x16')]);});});}function getEndUser(_0x1b4d88,_0x20ec2b,_0x11b008,_0x1fee68,_0x4e0dd3){return function(_0x2d5c78){logger[_0x9cce('0x11')]('['+[_0x1b4d88['toUpperCase']()]+_0x9cce('0x28'),_0x2d5c78);return new Promise(function(_0x2e2e96,_0x894bb1){var _0x10aa95={'method':_0x9cce('0xb'),'uri':_0x11b008+'sys_user?sysparm_query=phone%3D'+_0x2d5c78[_0x9cce('0x25')]+'&'+_0x1fee68+'&'+_0x4e0dd3,'auth':_0x20ec2b,'json':!![]};return rp(_0x10aa95)[_0x9cce('0xd')](function(_0x582bbe){if(_0x582bbe[_0x9cce('0xe')][_0x9cce('0xf')]>0x0){_0x2d5c78[_0x9cce('0x27')]=_0x582bbe['result'][0x0][_0x9cce('0x1c')];logger['info']('['+[_0x1b4d88[_0x9cce('0x12')]()]+_0x9cce('0x29'),_0x2d5c78);_0x2e2e96(_0x2d5c78);}else{return createEndUser(_0x1b4d88,_0x20ec2b,_0x2d5c78,_0x11b008,_0x1fee68)['then'](function(_0x58dca8){logger['info']('['+[_0x1b4d88[_0x9cce('0x12')]()]+_0x9cce('0x2a'),_0x58dca8);_0x2e2e96(_0x58dca8);});}})['catch'](function(_0x3ce91f){logger[_0x9cce('0x15')]('['+[_0x1b4d88['toUpperCase']()]+']',_0x3ce91f[_0x9cce('0x16')]);_0x894bb1(_0x3ce91f['message']);});});};}function getCustomFields(_0x268caf,_0x278627){var _0x3892b3={};if(_0x268caf['length']>0x0){_[_0x9cce('0x2b')](_0x268caf,function(_0x67c8b4){if(_[_0x9cce('0x2c')]([_0x9cce('0x2d'),_0x9cce('0x2e')],_0x67c8b4[_0x9cce('0x2f')])&&_0x67c8b4[_0x9cce('0x30')]&&!_0x67c8b4[_0x9cce('0x31')]){_0x3892b3[_0x67c8b4[_0x9cce('0x30')]['toLowerCase']()]=_0x67c8b4[_0x9cce('0x32')]['toString']();}else if(_['includes'](['string',_0x9cce('0x2e')],_0x67c8b4[_0x9cce('0x2f')])&&_0x67c8b4[_0x9cce('0x33')]&&_0x67c8b4[_0x9cce('0x31')]){_0x3892b3[_0x67c8b4[_0x9cce('0x33')]['toLowerCase']()]=_0x67c8b4[_0x9cce('0x32')][_0x9cce('0x34')]();}else if(_0x67c8b4['type']===_0x9cce('0x35')&&_0x67c8b4['variableName']&&_0x67c8b4[_0x9cce('0x33')]&&_0x67c8b4[_0x9cce('0x31')]){_0x3892b3[_0x67c8b4[_0x9cce('0x33')]['toLowerCase']()]=_0x278627[_0x67c8b4[_0x9cce('0x36')]][_0x9cce('0x34')]();}else if(_0x67c8b4[_0x9cce('0x2f')]===_0x9cce('0x37')&&_0x67c8b4[_0x9cce('0x38')]&&_0x67c8b4[_0x9cce('0x38')][_0x9cce('0x39')]&&_0x67c8b4[_0x9cce('0x33')]&&_0x67c8b4[_0x9cce('0x31')]){_0x3892b3[_0x67c8b4[_0x9cce('0x33')]['toLowerCase']()]=_0x278627[_0x67c8b4[_0x9cce('0x38')][_0x9cce('0x39')][_0x9cce('0x3a')]()][_0x9cce('0x34')]();}});}return _0x3892b3;}function getTicket(_0x2ec17a,_0x410020,_0x434058,_0x2f7e2c,_0x477ddc,_0x4fe459){return function(_0x2c6502){logger[_0x9cce('0x11')]('['+[_0x2ec17a['toUpperCase']()]+_0x9cce('0x3b'),_0x2c6502);return new Promise(function(_0x1a3c35,_0x39d2b0){var _0x53793e=_0x2ec17a[_0x9cce('0x3a')]()===_0x9cce('0x3c')?_0x2c6502[_0x9cce('0x3d')]:_0x2c6502[_0x9cce('0x27')];var _0x1fca9d={'method':_0x9cce('0x21'),'uri':_0x434058+_0x9cce('0x3e')+'?'+_0x4fe459,'body':Object[_0x9cce('0x3f')]({},{'active':'true','caller_id':_0x53793e,'assigned_to':_0x2c6502[_0x9cce('0x3d')],'short_description':intUtil[_0x9cce('0x40')](_0x2f7e2c['Subjects'],_0x477ddc,'\x20'),'description':intUtil[_0x9cce('0x40')](_0x2f7e2c['Descriptions'],_0x477ddc,'\x0a')},getCustomFields(_0x2f7e2c['Fields'],_0x477ddc)),'auth':_0x410020,'json':!![]};return rp(_0x1fca9d)[_0x9cce('0xd')](function(_0x2ff970){logger[_0x9cce('0x11')]('['+[_0x2ec17a[_0x9cce('0x12')]()]+_0x9cce('0x41'),_0x2ff970['result']);_0x2c6502[_0x9cce('0x42')]=_0x2ff970[_0x9cce('0xe')][_0x9cce('0x1c')];_0x2c6502['ticketNumber']=_0x2ff970[_0x9cce('0xe')]['number'];logger[_0x9cce('0x11')]('['+[_0x2ec17a[_0x9cce('0x12')]()]+_0x9cce('0x43'),_0x2c6502);_0x1a3c35(_0x2c6502);})[_0x9cce('0x14')](function(_0x53f189){logger[_0x9cce('0x15')]('['+[_0x2ec17a[_0x9cce('0x12')]()]+']',_0x53f189[_0x9cce('0x16')]);_0x39d2b0(_0x53f189[_0x9cce('0x16')]);});});};}function createRemoteTag(_0x2cf4ec,_0x4aa74d,_0x21f069,_0x400e34){return new Promise(function(_0x499531,_0xa871aa){var _0x2d860f={'method':_0x9cce('0x21'),'uri':_0x21f069+_0x9cce('0x44')+'?'+_0x400e34,'body':{'short_description':_0x2cf4ec,'global':!![],'active':!![],'name':_0x2cf4ec},'auth':_0x4aa74d,'json':!![]};return rp(_0x2d860f)[_0x9cce('0xd')](function(_0x184c1f){var _0x39186c=_0x184c1f[_0x9cce('0xe')][_0x9cce('0x1c')];_0x499531(_0x39186c);});});}function getRemoteTag(_0x27c4b4,_0x1f123c,_0x55ed14,_0x53915a,_0x4bde60){return new Promise(function(_0x18af03,_0x527de6){var _0x4016f1={'method':'GET','uri':_0x55ed14+_0x9cce('0x44')+'?sysparm_query=name%3D'+_0x27c4b4+'&'+_0x53915a,'auth':_0x1f123c,'json':!![]};return rp(_0x4016f1)['then'](function(_0x184791){if(_0x184791[_0x9cce('0xe')][_0x9cce('0xf')]>0x0){var _0x278287=_0x184791[_0x9cce('0xe')][0x0][_0x9cce('0x1c')];_0x18af03(_0x278287);}else{return createRemoteTag(_0x27c4b4,_0x1f123c,_0x55ed14,_0x53915a)[_0x9cce('0xd')](function(_0x386d7f){_0x18af03(_0x386d7f);});}});});}function assignTagToIncident(_0x94bba1,_0x47ffa3,_0x375c39,_0x526e2a,_0x456733){return new Promise(function(_0xec2709,_0x42d6ea){var _0x9d1bed={'method':_0x9cce('0x21'),'uri':_0x375c39+'label_entry'+'?'+_0x456733,'body':{'label':_0x94bba1,'table':'incident','id_type':_0x9cce('0x45'),'table_key':_0x526e2a[_0x9cce('0x42')],'title':'Incident\x20-\x20'+_0x526e2a[_0x9cce('0x46')],'id_display':_0x526e2a[_0x9cce('0x46')]},'auth':_0x47ffa3,'json':!![]};return rp(_0x9d1bed)[_0x9cce('0xd')](function(_0x52ce55){_0xec2709();})['catch'](function(){_0xec2709();});});}function manageTags(_0x185db8,_0x32cb8f,_0x31fc64,_0x556a8c,_0x41112f,_0x20b95d,_0x507d19){return new Promise(function(_0x3a9254,_0x3c1139){var _0x714946=[];_0x32cb8f[_0x9cce('0x2b')](function(_0x2490cb){_0x714946['push'](getRemoteTag(_0x2490cb,_0x31fc64,_0x556a8c,_0x20b95d,_0x507d19));});return Promise['all'](_0x714946)[_0x9cce('0xd')](function(_0x3bcd73){if(_0x3bcd73[_0x9cce('0xf')]){logger[_0x9cce('0x11')]('['+[_0x185db8[_0x9cce('0x12')]()]+_0x9cce('0x47'),_0x3bcd73);var _0x16d41c=[];_0x3bcd73[_0x9cce('0x2b')](function(_0x84a0ea){_0x16d41c[_0x9cce('0x48')](assignTagToIncident(_0x84a0ea,_0x31fc64,_0x556a8c,_0x41112f,_0x20b95d));});return Promise[_0x9cce('0x49')](_0x16d41c)[_0x9cce('0xd')](function(){_0x3a9254();})[_0x9cce('0x14')](function(){_0x3a9254();});}else{_0x3a9254();}});});}function getTags(_0x1a9bb9,_0x226069,_0x38f242,_0x37e90e,_0x2718e7,_0x5e6b3c){return function(_0x41ecd3){return new Promise(function(_0x45edc1,_0x1d2970){var _0x821720=[];var _0x38c640=_0x37e90e[_0x9cce('0x4a')];if(_0x38c640&&_0x38c640['length']>0x0){_0x821720=_[_0x9cce('0x4b')](_0x38c640,_0x9cce('0x39'));}if(_0x821720[_0x9cce('0xf')]>0x0){return manageTags(_0x1a9bb9,_0x821720,_0x226069,_0x38f242,_0x41ecd3,_0x2718e7,_0x5e6b3c)[_0x9cce('0xd')](function(){_0x45edc1(_0x41ecd3);});}else{_0x45edc1(_0x41ecd3);}});};}function emit(_0x1d2f21,_0x483d4,_0x33aaae){var _0x3a2d18=_0x9cce('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x9cce('0x4d')+_0x9cce('0x4e');var _0x20203c={'uri':_0x1d2f21+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x33aaae+_0x3a2d18};io['to'](util[_0x9cce('0x4f')](_0x9cce('0x50'),_0x483d4))[_0x9cce('0x51')](_0x9cce('0x52'),_0x20203c);}exports['cs']=function(_0x27bdcd,_0x32540e,_0x36843e,_0x5b1a44,_0x3aa0bd,_0x454730,_0x4b4a84,_0x35f8dc){var _0x2ac6cd={};var _0x1c5c20={'user':_0x454730[_0x9cce('0x53')],'pass':_0x454730[_0x9cce('0x54')]};var _0x48365b=_0x9cce('0x55');var _0x325aa0=_0x9cce('0x56');_0x454730[_0x9cce('0x57')]=intUtil[_0x9cce('0x58')](_0x454730['remoteUri']);_0x454730[_0x9cce('0x59')]=intUtil['stripTrailingSlash'](_0x454730[_0x9cce('0x59')]);var _0x19cbff=util[_0x9cce('0x4f')](_0x9cce('0x5a'),_0x454730[_0x9cce('0x57')]);_0x2ac6cd['userEmail']=!_['isNil'](_0x5b1a44)?_0x5b1a44['email']:null;_0x2ac6cd[_0x9cce('0x1f')]=_0x454730[_0x9cce('0x5b')];_0x2ac6cd[_0x9cce('0x25')]=_0x35f8dc[_0x9cce('0x3a')]()===_0x9cce('0x3c')?_0x32540e[_0x9cce('0x5c')]:_0x32540e[_0x9cce('0x5d')];_0x2ac6cd[_0x9cce('0x5e')]=_0x35f8dc==='queue'||_0x35f8dc==='unmanaged'?_0x9cce('0x5f'):_0x9cce('0x3c');var _0x5e2a72=util['format'](_0x9cce('0x60'),_0x454730[_0x9cce('0x59')],_0x32540e['uniqueid'],md5(_0x32540e[_0x9cce('0x61')]));if(_0x3aa0bd&&_0x3aa0bd[_0x9cce('0x62')]){logger[_0x9cce('0x11')](_0x9cce('0x63'),_0x9cce('0x64'));_0x32540e['recordingURL']=_0x5e2a72;}else if(_0x4b4a84&&_0x4b4a84[_0x9cce('0x65')]&&_0x4b4a84[_0x9cce('0x65')]!==_0x9cce('0x66')){logger[_0x9cce('0x11')](_0x9cce('0x67'),_0x9cce('0x64'));_0x32540e[_0x9cce('0x68')]=_0x5e2a72;}else{_0x32540e[_0x9cce('0x68')]='';}return getAdminUser(_0x35f8dc,_0x1c5c20,_0x2ac6cd,_0x19cbff,_0x325aa0,_0x48365b)['then'](getUser(_0x35f8dc,_0x1c5c20,_0x19cbff,_0x325aa0,_0x48365b))[_0x9cce('0xd')](getEndUser(_0x35f8dc,_0x1c5c20,_0x19cbff,_0x325aa0,_0x48365b))[_0x9cce('0xd')](getTicket(_0x35f8dc,_0x1c5c20,_0x19cbff,_0x36843e,_0x32540e,_0x325aa0))[_0x9cce('0xd')](function(_0x2e2e0f){logger[_0x9cce('0x11')](util['format'](_0x9cce('0x69'),_0x2e2e0f[_0x9cce('0x42')]));logger['info'](util['format'](_0x9cce('0x6a'),_0x35f8dc));if(_0x35f8dc!==_0x9cce('0x6b')){logger['info']('['+[_0x35f8dc[_0x9cce('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x454730[_0x9cce('0x57')],_0x5b1a44[_0x9cce('0x39')],_0x2e2e0f[_0x9cce('0x42')]);}})['catch'](function(_0xed6285){logger[_0x9cce('0x15')]('['+[_0x35f8dc[_0x9cce('0x12')]()]+_0x9cce('0x6c'),util['inspect'](_0xed6285,{'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 fa3ea8b..5cc48d7 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 _0x2acc=['none','[OUTBOUND]','destcalleridname','Fields','Outbound','Ticket\x20created!','contacts','trigger:browser:url','unmanaged','monitor_format','lastevent','toUpperCase','Inbound','lodash','request-promise','bluebird','md5','util','ioredis','./util','redis','localhost','socket.io-emitter','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','set_entry','JSON','stringify','Basic\x20%s','toString','base64','get_server_info','isNil','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','customField','toLowerCase','content','variableName','custom_fields','Variable','POST','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat'];(function(_0x40a73b,_0x34fbe2){var _0x24082b=function(_0x1141bd){while(--_0x1141bd){_0x40a73b['push'](_0x40a73b['shift']());}};_0x24082b(++_0x34fbe2);}(_0x2acc,0x175));var _0xc2ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2acc[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc2ac('0x0'));var rp=require(_0xc2ac('0x1'));var BPromise=require(_0xc2ac('0x2'));var md5=require(_0xc2ac('0x3'));var util=require(_0xc2ac('0x4'));var Redis=require(_0xc2ac('0x5'));var intUtil=require(_0xc2ac('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('sugarcrm');config[_0xc2ac('0x7')]=_['defaults'](config['redis'],{'host':_0xc2ac('0x8'),'port':0x18eb});var io=require(_0xc2ac('0x9'))(new Redis(config[_0xc2ac('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x53760b,_0x349bf7,_0x409e5a){io['to'](_0x53760b)[_0xc2ac('0xa')](_0x349bf7,_0x409e5a);}function getTicket(_0x4e3419,_0x429ed0,_0x2e0f92,_0x3d891e,_0x499188,_0x4be76e,_0x114883,_0x2e36fa){logger[_0xc2ac('0xb')]('Creating\x20new\x20ticket...');var _0x403492=new Date();var _0x81dc3c=[{'name':_0xc2ac('0xc'),'value':intUtil[_0xc2ac('0xd')](_0x3d891e[_0xc2ac('0xe')],_0x499188,'\x20')},{'name':_0xc2ac('0xf'),'value':_0x429ed0['id']},{'name':_0xc2ac('0x10'),'value':_0x429ed0['id']},{'name':_0xc2ac('0x11'),'value':intUtil[_0xc2ac('0xd')](_0x3d891e['Descriptions'],_0x499188,'\x0a')},{'name':'date_start','value':_0x403492[_0xc2ac('0x12')]()['slice'](0x0,0x13)[_0xc2ac('0x13')]('T','\x20')},{'name':_0xc2ac('0x14'),'value':'0'},{'name':_0xc2ac('0x15'),'value':'15'},{'name':_0xc2ac('0x16'),'value':_0x2e0f92['id']},{'name':_0xc2ac('0x17'),'value':_0xc2ac('0x18')},{'name':_0xc2ac('0x19'),'value':_0x2e0f92[_0xc2ac('0xc')]},{'name':_0xc2ac('0x1a'),'value':_0x2e36fa}];if(_0x4be76e[_0xc2ac('0x1b')]){_[_0xc2ac('0x1c')](_0x4be76e,function(_0x5bb629){if(_0x499188[_0x5bb629['variableName']]){_0x81dc3c[_0xc2ac('0x1d')]({'name':_0x5bb629[_0xc2ac('0x1e')],'value':_0x499188[_0x5bb629['variableName']]});}});}return request({'form':{'method':_0xc2ac('0x1f'),'input_type':_0xc2ac('0x20'),'response_type':_0xc2ac('0x20'),'rest_data':JSON[_0xc2ac('0x21')]({'session':_0x114883['id'],'module_name':'Calls','name_value_list':_0x81dc3c})}});}function getAuth(_0x382026){return util['format'](_0xc2ac('0x22'),new Buffer(_0x382026['apiKey']+':X')[_0xc2ac('0x23')](_0xc2ac('0x24')));}function getServerInfo(_0x1edbdd){return request({'form':{'method':_0xc2ac('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc2ac('0x21')]({'session':_0x1edbdd['id']})}});}function getUser(_0x4484c1,_0x4dd589,_0x4c093c){if(!_[_0xc2ac('0x26')](_0x4dd589)){logger['info']('Getting\x20agent\x20with\x20name',_0x4dd589);return request({'form':{'method':_0xc2ac('0x27'),'input_type':_0xc2ac('0x20'),'response_type':_0xc2ac('0x20'),'rest_data':JSON[_0xc2ac('0x21')]({'session':_0x4c093c['id'],'module_name':'Employees','query':util[_0xc2ac('0x28')](_0xc2ac('0x29'),_0x4dd589),'order_by':'','offset':'0','select_fields':['id',_0xc2ac('0xc'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc2ac('0x2a')](function(_0x170fe5){if(_0x170fe5[_0xc2ac('0x2b')][_0xc2ac('0x1b')]){var _0x4bd23b=_[_0xc2ac('0x2c')](_0x170fe5[_0xc2ac('0x2b')],function(_0x44f4b7){return _0x44f4b7[_0xc2ac('0x2d')][_0xc2ac('0x2e')][_0xc2ac('0x2f')]===_0x4dd589;});if(_0x4bd23b){logger[_0xc2ac('0xb')]('Agent\x20found!');return BPromise['resolve']({'id':_0x4bd23b[_0xc2ac('0x2d')]['id'][_0xc2ac('0x2f')],'name':_0x4bd23b['name_value_list'][_0xc2ac('0xc')]['value']});}}logger[_0xc2ac('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4c093c[_0xc2ac('0x2d')]['user_id'][_0xc2ac('0x2f')],'name':_0x4c093c[_0xc2ac('0x2d')][_0xc2ac('0x2e')][_0xc2ac('0x2f')]});});}else{logger[_0xc2ac('0xb')](_0xc2ac('0x30'));return BPromise[_0xc2ac('0x31')]({'id':_0x4c093c[_0xc2ac('0x2d')][_0xc2ac('0x32')][_0xc2ac('0x2f')],'name':_0x4c093c[_0xc2ac('0x2d')]['user_name'][_0xc2ac('0x2f')]});}}function getEndUser(_0x1572d4,_0x205690,_0x4dd4f5,_0x1b8353){logger['info'](_0xc2ac('0x33'),_0x4dd4f5);return request({'form':{'method':_0xc2ac('0x27'),'input_type':_0xc2ac('0x20'),'response_type':_0xc2ac('0x20'),'rest_data':JSON['stringify']({'session':_0x1b8353['id'],'module_name':_0xc2ac('0x18'),'query':util[_0xc2ac('0x28')](_0xc2ac('0x34'),_0x4dd4f5),'order_by':'','offset':'0','select_fields':['id',_0xc2ac('0xc'),_0xc2ac('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc2ac('0x2a')](function(_0x28d7cf){if(_0x28d7cf[_0xc2ac('0x2b')][_0xc2ac('0x1b')]){var _0x5f5ca8=_['find'](_0x28d7cf['entry_list'],function(_0x3033c3){return _0x3033c3[_0xc2ac('0x2d')][_0xc2ac('0x35')][_0xc2ac('0x2f')]===_0x4dd4f5;});if(_0x5f5ca8){logger[_0xc2ac('0xb')](_0xc2ac('0x36'));return BPromise[_0xc2ac('0x31')]({'id':_0x5f5ca8['name_value_list']['id'][_0xc2ac('0x2f')],'name':_0x5f5ca8[_0xc2ac('0x2d')][_0xc2ac('0xc')][_0xc2ac('0x2f')],'phone':_0x5f5ca8[_0xc2ac('0x2d')]['phone_home'][_0xc2ac('0x2f')]});}}else{logger[_0xc2ac('0xb')](_0xc2ac('0x37'));return request({'form':{'method':_0xc2ac('0x1f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc2ac('0x21')]({'session':_0x1b8353['id'],'module_name':_0xc2ac('0x18'),'name_value_list':[{'name':'first_name','value':_0x205690!==_0xc2ac('0x38')?_0x205690:util['format'](_0xc2ac('0x39'),_0x4dd4f5)},{'name':_0xc2ac('0x35'),'value':_0x4dd4f5}]})}})[_0xc2ac('0x2a')](function(_0x1afb4b){logger[_0xc2ac('0xb')](_0xc2ac('0x3a'));return BPromise['resolve']({'id':_0x1afb4b['id'],'name':_0x1afb4b[_0xc2ac('0x2b')][_0xc2ac('0x3b')][_0xc2ac('0x2f')],'phone':_0x1afb4b['entry_list'][_0xc2ac('0x35')][_0xc2ac('0x2f')]});});}});}function request(_0x39a314){logger[_0xc2ac('0x3c')](_0xc2ac('0x3d'),JSON[_0xc2ac('0x21')](_0x39a314));return rp(_[_0xc2ac('0x3e')](def,_0x39a314));}function getTags(_0x2c1b10,_0x2f4fe2){var _0x24be41=[];if(_0x2c1b10&&_0x2c1b10[_0xc2ac('0x1b')]>0x0){_0x24be41=_[_0xc2ac('0x3f')](_0x2c1b10,_0x2f4fe2);}return _0x24be41;}function getCustomFields(_0x5ef939,_0x461a2b){var _0x251803=[];var _0x255bde={'custom_fields':[]};if(_0x5ef939[_0xc2ac('0x1b')]>0x0){_[_0xc2ac('0x1c')](_0x5ef939,function(_0x52e78f){if(_0x52e78f[_0xc2ac('0x40')]===_0xc2ac('0x41')&&_0x52e78f['nameField']&&!_0x52e78f[_0xc2ac('0x42')]){_0x255bde[_0x52e78f['nameField'][_0xc2ac('0x43')]()]=_0x52e78f[_0xc2ac('0x44')][_0xc2ac('0x23')]();}else if(_0x52e78f[_0xc2ac('0x40')]==='string'&&_0x52e78f[_0xc2ac('0x1e')]&&_0x52e78f['customField']){_0x255bde['custom_fields'][_0xc2ac('0x1d')]({'id':_0x52e78f[_0xc2ac('0x1e')],'value':_0x52e78f[_0xc2ac('0x44')][_0xc2ac('0x23')]()});}else if(_0x52e78f['type']==='variable'&&_0x52e78f[_0xc2ac('0x45')]&&_0x52e78f['idField']&&_0x52e78f[_0xc2ac('0x42')]){_0x461a2b[_0x52e78f[_0xc2ac('0x45')]]&&_0x255bde[_0xc2ac('0x46')][_0xc2ac('0x1d')]({'id':_0x52e78f[_0xc2ac('0x1e')],'value':_0x461a2b[_0x52e78f[_0xc2ac('0x45')]]['toString']()});}else if(_0x52e78f['type']==='customVariable'&&_0x52e78f[_0xc2ac('0x47')]&&_0x52e78f[_0xc2ac('0x47')][_0xc2ac('0xc')]&&_0x52e78f[_0xc2ac('0x1e')]&&_0x52e78f[_0xc2ac('0x42')]){_0x461a2b[_0x52e78f[_0xc2ac('0x47')][_0xc2ac('0xc')]['toLowerCase']()]&&_0x255bde[_0xc2ac('0x46')][_0xc2ac('0x1d')]({'id':_0x52e78f[_0xc2ac('0x1e')],'value':_0x461a2b[_0x52e78f[_0xc2ac('0x47')]['name']['toLowerCase']()][_0xc2ac('0x23')]()});}});}return _0x255bde;}function getConnection(_0x47160b){return request({'method':_0xc2ac('0x48'),'form':{'method':_0xc2ac('0x49'),'input_type':_0xc2ac('0x20'),'response_type':_0xc2ac('0x20'),'rest_data':JSON[_0xc2ac('0x21')]({'user_auth':{'user_name':_0x47160b['username'],'password':_0x47160b[_0xc2ac('0x4a')],'encryption':_0xc2ac('0x4b')},'application':_0xc2ac('0x4c')})}})[_0xc2ac('0x2a')](function(_0x49c687){var _0x5801a0=_0x49c687;if(_0x5801a0['id']){def[_0xc2ac('0x4d')]=_0x5801a0['id'];return BPromise[_0xc2ac('0x31')](_0x5801a0);}else{throw new Error(util[_0xc2ac('0x28')](_0xc2ac('0x4e'),_0x47160b['id']));}});}function setRelationship(_0x9e8db1,_0x1a46e5,_0x3a13bd,_0x4917a6){return request({'form':{'method':_0xc2ac('0x4f'),'input_type':_0xc2ac('0x20'),'response_type':_0xc2ac('0x20'),'rest_data':JSON[_0xc2ac('0x21')]({'session':_0x9e8db1['id'],'module_name':_0xc2ac('0x50'),'module_id':_0x3a13bd['id'],'link_field_name':_0x4917a6,'related_ids':[_0x1a46e5['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc2ac('0x51')]=function(_0x2747c3,_0x1c4110,_0x47d1fe,_0x40b18b,_0x248396,_0x5a54e3){var _0x2910ec,_0x18bb63,_0x34817e,_0x27be39;_0x5a54e3[_0xc2ac('0x52')]=intUtil[_0xc2ac('0x53')](_0x5a54e3[_0xc2ac('0x52')]);_0x5a54e3['serverUrl']=intUtil[_0xc2ac('0x53')](_0x5a54e3[_0xc2ac('0x54')]);def[_0xc2ac('0x55')]=util[_0xc2ac('0x28')]('%s/service/v4_1/rest.php',_0x5a54e3[_0xc2ac('0x52')]);if(_0x248396&&_0x248396['monitor_format']){logger[_0xc2ac('0xb')]('[QUEUE]',_0xc2ac('0x56'));_0x1c4110[_0xc2ac('0x57')]=util['format'](_0xc2ac('0x58'),_0x5a54e3[_0xc2ac('0x54')],_0x1c4110[_0xc2ac('0x59')],md5(_0x1c4110[_0xc2ac('0x59')]));}else{_0x1c4110[_0xc2ac('0x57')]='';}return getConnection(_0x5a54e3)[_0xc2ac('0x2a')](function(_0x257f50){_0x27be39=_0x257f50;return getUser(_0x5a54e3,_0x40b18b['name'],_0x27be39);})['then'](function(_0x1c947a){_0x2910ec=_0x1c947a;logger[_0xc2ac('0xb')](_0xc2ac('0x5a'),_0x2910ec['id']);return getEndUser(_0x5a54e3,_0x1c4110[_0xc2ac('0x5b')],_0x1c4110[_0xc2ac('0x5c')],_0x27be39);})['then'](function(_0x438042){_0x18bb63=_0x438042;logger['info'](_0xc2ac('0x5d'),_0x18bb63['id']);return getTicket(_0x5a54e3,_0x2910ec,_0x18bb63,_0x47d1fe,_0x1c4110,_0x47d1fe['Fields'],_0x27be39,'Inbound');})[_0xc2ac('0x2a')](function(_0x4f2f95){_0x34817e=_0x4f2f95;logger['info']('Ticket\x20created!');logger['info'](_0xc2ac('0x5e'),_0x34817e['id']);return setRelationship(_0x27be39,_0x2910ec,_0x34817e,_0xc2ac('0x5f'));})['then'](function(){return setRelationship(_0x27be39,_0x18bb63,_0x34817e,'contacts');})['then'](function(){return getServerInfo(_0x27be39);})[_0xc2ac('0x2a')](function(_0x5e69de){var _0x29f908=parseInt(_0x5e69de[_0xc2ac('0x60')][_0xc2ac('0x61')](0x0));var _0x21c2cb=util['format'](_0xc2ac('0x62'),_0x5a54e3[_0xc2ac('0x52')],_0x34817e['id']);if(_0x29f908>0x6){_0x21c2cb=util[_0xc2ac('0x28')](_0xc2ac('0x63'),_0x5a54e3[_0xc2ac('0x52')],_0x34817e['id']);}logger['info']('[QUEUE]',_0xc2ac('0x64'));emit(util['format'](_0xc2ac('0x65'),_0x40b18b[_0xc2ac('0xc')]),'trigger:browser:url',{'uri':_0x21c2cb});})[_0xc2ac('0x66')](function(_0x4f4f0d){logger[_0xc2ac('0x67')]('[QUEUE]',JSON[_0xc2ac('0x21')](_0x4f4f0d));});};exports[_0xc2ac('0x68')]=function(_0x3dccb5,_0x60b6b5,_0x4a6297,_0x2983cc,_0x26f216,_0x19dd0f,_0x58ab26){var _0x386b67,_0x555baa,_0x904700,_0x1ddda8;_0x19dd0f[_0xc2ac('0x52')]=intUtil[_0xc2ac('0x53')](_0x19dd0f['remoteUri']);_0x19dd0f['serverUrl']=intUtil[_0xc2ac('0x53')](_0x19dd0f['serverUrl']);def[_0xc2ac('0x55')]=util[_0xc2ac('0x28')](_0xc2ac('0x69'),_0x19dd0f['remoteUri']);if(_0x58ab26&&_0x58ab26[_0xc2ac('0x6a')]&&_0x58ab26[_0xc2ac('0x6a')]!==_0xc2ac('0x6b')){logger[_0xc2ac('0xb')](_0xc2ac('0x6c'),'Recording\x20is\x20enabled!');_0x60b6b5[_0xc2ac('0x57')]=util[_0xc2ac('0x28')](_0xc2ac('0x58'),_0x19dd0f[_0xc2ac('0x54')],_0x60b6b5[_0xc2ac('0x59')],md5(_0x60b6b5[_0xc2ac('0x59')]));}return getConnection(_0x19dd0f)[_0xc2ac('0x2a')](function(_0x255c08){_0x1ddda8=_0x255c08;return getUser(_0x19dd0f,_0x2983cc[_0xc2ac('0xc')],_0x1ddda8);})[_0xc2ac('0x2a')](function(_0x480f36){_0x386b67=_0x480f36;logger[_0xc2ac('0xb')](_0xc2ac('0x5a'),_0x386b67['id']);return getEndUser(_0x19dd0f,_0x60b6b5[_0xc2ac('0x6d')],_0x60b6b5['destcalleridnum'],_0x1ddda8);})[_0xc2ac('0x2a')](function(_0x2fd849){_0x555baa=_0x2fd849;logger[_0xc2ac('0xb')]('The\x20Enduser\x20ID\x20is:',_0x555baa['id']);return getTicket(_0x19dd0f,_0x386b67,_0x555baa,_0x4a6297,_0x60b6b5,_0x4a6297[_0xc2ac('0x6e')],_0x1ddda8,_0xc2ac('0x6f'));})[_0xc2ac('0x2a')](function(_0x3a4f27){_0x904700=_0x3a4f27;logger[_0xc2ac('0xb')](_0xc2ac('0x70'));logger[_0xc2ac('0xb')](_0xc2ac('0x5e'),_0x904700['id']);return setRelationship(_0x1ddda8,_0x386b67,_0x904700,'users');})[_0xc2ac('0x2a')](function(){return setRelationship(_0x1ddda8,_0x555baa,_0x904700,_0xc2ac('0x71'));})[_0xc2ac('0x2a')](function(){return getServerInfo(_0x1ddda8);})[_0xc2ac('0x2a')](function(_0x324054){var _0x1dd998=parseInt(_0x324054[_0xc2ac('0x60')][_0xc2ac('0x61')](0x0));var _0x103e4b=util[_0xc2ac('0x28')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x19dd0f['remoteUri'],_0x904700['id']);if(_0x1dd998>0x6){_0x103e4b=util[_0xc2ac('0x28')](_0xc2ac('0x63'),_0x19dd0f[_0xc2ac('0x52')],_0x904700['id']);}logger[_0xc2ac('0xb')](_0xc2ac('0x6c'),_0xc2ac('0x64'));emit(util[_0xc2ac('0x28')]('user:%s',_0x2983cc[_0xc2ac('0xc')]),_0xc2ac('0x72'),{'uri':_0x103e4b});})[_0xc2ac('0x66')](function(_0x965e13){logger['error'](_0xc2ac('0x6c'),JSON[_0xc2ac('0x21')](_0x965e13));});};exports[_0xc2ac('0x73')]=function(_0x435d7a,_0x291199,_0x416f11,_0x2cee47,_0x290c71,_0x2918d5){var _0x412cbc,_0xcdf4a1,_0x41a10a,_0x417f72;_0x2918d5[_0xc2ac('0x52')]=intUtil[_0xc2ac('0x53')](_0x2918d5[_0xc2ac('0x52')]);_0x2918d5[_0xc2ac('0x54')]=intUtil[_0xc2ac('0x53')](_0x2918d5[_0xc2ac('0x54')]);def['uri']=util[_0xc2ac('0x28')](_0xc2ac('0x69'),_0x2918d5[_0xc2ac('0x52')]);if(_0x290c71&&_0x290c71[_0xc2ac('0x74')]){logger[_0xc2ac('0xb')]('['+_0x291199[_0xc2ac('0x75')][_0xc2ac('0x76')]()+']',_0xc2ac('0x56'));_0x291199['recordingURL']=util[_0xc2ac('0x28')](_0xc2ac('0x58'),_0x2918d5[_0xc2ac('0x54')],_0x291199[_0xc2ac('0x59')],md5(_0x291199['uniqueid']));}else{_0x291199['recordingURL']='';}return getConnection(_0x2918d5)['then'](function(_0x327a2a){_0x417f72=_0x327a2a;if(!_['isNil'](_0x2cee47)){return getUser(_0x2918d5,_0x2cee47['name'],_0x417f72);}else{return getUser(_0x2918d5,null,_0x417f72);}})[_0xc2ac('0x2a')](function(_0x3ede83){_0x412cbc=_0x3ede83;logger[_0xc2ac('0xb')](_0xc2ac('0x5a'),_0x412cbc['id']);return getEndUser(_0x2918d5,_0x291199[_0xc2ac('0x5b')],_0x291199[_0xc2ac('0x5c')],_0x417f72);})['then'](function(_0x5617b0){_0xcdf4a1=_0x5617b0;logger[_0xc2ac('0xb')](_0xc2ac('0x5d'),_0xcdf4a1['id']);return getTicket(_0x2918d5,_0x412cbc,_0xcdf4a1,_0x416f11,_0x291199,_0x416f11[_0xc2ac('0x6e')],_0x417f72,_0xc2ac('0x77'));})[_0xc2ac('0x2a')](function(_0x4e1173){_0x41a10a=_0x4e1173;logger['info'](_0xc2ac('0x70'));logger[_0xc2ac('0xb')]('The\x20Ticket\x20ID\x20is:',_0x41a10a['id']);return setRelationship(_0x417f72,_0x412cbc,_0x41a10a,_0xc2ac('0x5f'));})[_0xc2ac('0x2a')](function(){return setRelationship(_0x417f72,_0xcdf4a1,_0x41a10a,_0xc2ac('0x71'));})['then'](function(){return getServerInfo(_0x417f72);})[_0xc2ac('0x66')](function(_0x863f81){logger[_0xc2ac('0x67')]('['+_0x291199['lastevent'][_0xc2ac('0x76')]()+']',JSON[_0xc2ac('0x21')](_0x863f81));});}; \ No newline at end of file +var _0x1534=['catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','contacts','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','ioredis','./util','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','name','Subjects','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','direction','length','variableName','push','idField','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','stringify','info','Getting\x20agent\x20with\x20name','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','[HTTP]','merge','map','string','nameField','customField','toLowerCase','content','type','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','%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...'];(function(_0x3a22e1,_0xc071b8){var _0x3c02fb=function(_0x4f6c08){while(--_0x4f6c08){_0x3a22e1['push'](_0x3a22e1['shift']());}};_0x3c02fb(++_0xc071b8);}(_0x1534,0xf9));var _0x4153=function(_0x304600,_0x4ecdfe){_0x304600=_0x304600-0x0;var _0x337878=_0x1534[_0x304600];return _0x337878;};'use strict';var _=require(_0x4153('0x0'));var rp=require(_0x4153('0x1'));var BPromise=require(_0x4153('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x4153('0x3'));var intUtil=require(_0x4153('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4153('0x5'))(_0x4153('0x6'));config[_0x4153('0x7')]=_['defaults'](config[_0x4153('0x7')],{'host':_0x4153('0x8'),'port':0x18eb});var io=require(_0x4153('0x9'))(new Redis(config[_0x4153('0x7')]));var def={'method':_0x4153('0xa'),'json':!![]};function emit(_0x1f390b,_0x5dec2e,_0x309ab2){io['to'](_0x1f390b)[_0x4153('0xb')](_0x5dec2e,_0x309ab2);}function getTicket(_0x40ca18,_0x48b29c,_0x3bac15,_0x5d76c1,_0x210dbf,_0x476eee,_0xb1bf5e,_0x7e8206){logger['info']('Creating\x20new\x20ticket...');var _0x631727=new Date();var _0x3ad8c1=[{'name':_0x4153('0xc'),'value':intUtil['getString'](_0x5d76c1[_0x4153('0xd')],_0x210dbf,'\x20')},{'name':'assigned_user_id','value':_0x48b29c['id']},{'name':_0x4153('0xe'),'value':_0x48b29c['id']},{'name':_0x4153('0xf'),'value':intUtil['getString'](_0x5d76c1[_0x4153('0x10')],_0x210dbf,'\x0a')},{'name':_0x4153('0x11'),'value':_0x631727[_0x4153('0x12')]()[_0x4153('0x13')](0x0,0x13)[_0x4153('0x14')]('T','\x20')},{'name':_0x4153('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x4153('0x16'),'value':_0x3bac15['id']},{'name':_0x4153('0x17'),'value':'Contacts'},{'name':_0x4153('0x18'),'value':_0x3bac15['name']},{'name':_0x4153('0x19'),'value':_0x7e8206}];if(_0x476eee[_0x4153('0x1a')]){_['forEach'](_0x476eee,function(_0x1e1b89){if(_0x210dbf[_0x1e1b89[_0x4153('0x1b')]]){_0x3ad8c1[_0x4153('0x1c')]({'name':_0x1e1b89[_0x4153('0x1d')],'value':_0x210dbf[_0x1e1b89['variableName']]});}});}return request({'form':{'method':_0x4153('0x1e'),'input_type':_0x4153('0x1f'),'response_type':_0x4153('0x1f'),'rest_data':JSON['stringify']({'session':_0xb1bf5e['id'],'module_name':_0x4153('0x20'),'name_value_list':_0x3ad8c1})}});}function getAuth(_0x1b0be3){return util['format'](_0x4153('0x21'),new Buffer(_0x1b0be3[_0x4153('0x22')]+':X')[_0x4153('0x23')]('base64'));}function getServerInfo(_0x5dcb9c){return request({'form':{'method':'get_server_info','input_type':_0x4153('0x1f'),'response_type':_0x4153('0x1f'),'rest_data':JSON[_0x4153('0x24')]({'session':_0x5dcb9c['id']})}});}function getUser(_0x3ee302,_0x2209c5,_0x179189){if(!_['isNil'](_0x2209c5)){logger[_0x4153('0x25')](_0x4153('0x26'),_0x2209c5);return request({'form':{'method':_0x4153('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4153('0x24')]({'session':_0x179189['id'],'module_name':'Employees','query':util[_0x4153('0x28')](_0x4153('0x29'),_0x2209c5),'order_by':'','offset':'0','select_fields':['id',_0x4153('0xc'),_0x4153('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4153('0x2b')](function(_0x47dd7c){if(_0x47dd7c[_0x4153('0x2c')][_0x4153('0x1a')]){var _0x125d2a=_[_0x4153('0x2d')](_0x47dd7c['entry_list'],function(_0x4ae44f){return _0x4ae44f[_0x4153('0x2e')][_0x4153('0x2a')]['value']===_0x2209c5;});if(_0x125d2a){logger[_0x4153('0x25')](_0x4153('0x2f'));return BPromise[_0x4153('0x30')]({'id':_0x125d2a[_0x4153('0x2e')]['id'][_0x4153('0x31')],'name':_0x125d2a[_0x4153('0x2e')][_0x4153('0xc')][_0x4153('0x31')]});}}logger[_0x4153('0x25')](_0x4153('0x32'));return BPromise[_0x4153('0x30')]({'id':_0x179189['name_value_list'][_0x4153('0x33')]['value'],'name':_0x179189['name_value_list'][_0x4153('0x2a')][_0x4153('0x31')]});});}else{logger[_0x4153('0x25')](_0x4153('0x34'));return BPromise[_0x4153('0x30')]({'id':_0x179189[_0x4153('0x2e')][_0x4153('0x33')][_0x4153('0x31')],'name':_0x179189[_0x4153('0x2e')][_0x4153('0x2a')][_0x4153('0x31')]});}}function getEndUser(_0x278413,_0x26f686,_0x603a82,_0x3c304c){logger[_0x4153('0x25')](_0x4153('0x35'),_0x603a82);return request({'form':{'method':_0x4153('0x27'),'input_type':'JSON','response_type':_0x4153('0x1f'),'rest_data':JSON[_0x4153('0x24')]({'session':_0x3c304c['id'],'module_name':_0x4153('0x36'),'query':util[_0x4153('0x28')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x603a82),'order_by':'','offset':'0','select_fields':['id',_0x4153('0xc'),_0x4153('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x155cfd){if(_0x155cfd[_0x4153('0x2c')][_0x4153('0x1a')]){var _0x34e5a0=_[_0x4153('0x2d')](_0x155cfd[_0x4153('0x2c')],function(_0x33371a){return _0x33371a[_0x4153('0x2e')][_0x4153('0x37')][_0x4153('0x31')]===_0x603a82;});if(_0x34e5a0){logger[_0x4153('0x25')](_0x4153('0x38'));return BPromise['resolve']({'id':_0x34e5a0[_0x4153('0x2e')]['id'][_0x4153('0x31')],'name':_0x34e5a0[_0x4153('0x2e')][_0x4153('0xc')][_0x4153('0x31')],'phone':_0x34e5a0[_0x4153('0x2e')][_0x4153('0x37')]['value']});}}else{logger[_0x4153('0x25')](_0x4153('0x39'));return request({'form':{'method':_0x4153('0x1e'),'input_type':_0x4153('0x1f'),'response_type':_0x4153('0x1f'),'rest_data':JSON[_0x4153('0x24')]({'session':_0x3c304c['id'],'module_name':_0x4153('0x36'),'name_value_list':[{'name':_0x4153('0x3a'),'value':_0x26f686!==_0x4153('0x3b')?_0x26f686:util[_0x4153('0x28')](_0x4153('0x3c'),_0x603a82)},{'name':_0x4153('0x37'),'value':_0x603a82}]})}})[_0x4153('0x2b')](function(_0x216415){logger[_0x4153('0x25')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x216415['id'],'name':_0x216415['entry_list'][_0x4153('0x3a')][_0x4153('0x31')],'phone':_0x216415['entry_list'][_0x4153('0x37')][_0x4153('0x31')]});});}});}function request(_0x62c785){logger['debug'](_0x4153('0x3d'),JSON[_0x4153('0x24')](_0x62c785));return rp(_[_0x4153('0x3e')](def,_0x62c785));}function getTags(_0x49753e,_0x1d29e4){var _0x51985f=[];if(_0x49753e&&_0x49753e[_0x4153('0x1a')]>0x0){_0x51985f=_[_0x4153('0x3f')](_0x49753e,_0x1d29e4);}return _0x51985f;}function getCustomFields(_0x1d69a2,_0x2b1070){var _0x41ae7b=[];var _0x55e45c={'custom_fields':[]};if(_0x1d69a2[_0x4153('0x1a')]>0x0){_['forEach'](_0x1d69a2,function(_0x47620b){if(_0x47620b['type']===_0x4153('0x40')&&_0x47620b[_0x4153('0x41')]&&!_0x47620b[_0x4153('0x42')]){_0x55e45c[_0x47620b[_0x4153('0x41')][_0x4153('0x43')]()]=_0x47620b[_0x4153('0x44')]['toString']();}else if(_0x47620b[_0x4153('0x45')]===_0x4153('0x40')&&_0x47620b[_0x4153('0x1d')]&&_0x47620b[_0x4153('0x42')]){_0x55e45c[_0x4153('0x46')]['push']({'id':_0x47620b[_0x4153('0x1d')],'value':_0x47620b[_0x4153('0x44')][_0x4153('0x23')]()});}else if(_0x47620b['type']===_0x4153('0x47')&&_0x47620b['variableName']&&_0x47620b[_0x4153('0x1d')]&&_0x47620b[_0x4153('0x42')]){_0x2b1070[_0x47620b[_0x4153('0x1b')]]&&_0x55e45c[_0x4153('0x46')][_0x4153('0x1c')]({'id':_0x47620b[_0x4153('0x1d')],'value':_0x2b1070[_0x47620b['variableName']]['toString']()});}else if(_0x47620b['type']===_0x4153('0x48')&&_0x47620b['Variable']&&_0x47620b[_0x4153('0x49')][_0x4153('0xc')]&&_0x47620b[_0x4153('0x1d')]&&_0x47620b[_0x4153('0x42')]){_0x2b1070[_0x47620b[_0x4153('0x49')]['name']['toLowerCase']()]&&_0x55e45c[_0x4153('0x46')][_0x4153('0x1c')]({'id':_0x47620b[_0x4153('0x1d')],'value':_0x2b1070[_0x47620b['Variable'][_0x4153('0xc')][_0x4153('0x43')]()][_0x4153('0x23')]()});}});}return _0x55e45c;}function getConnection(_0x236577){return request({'method':_0x4153('0xa'),'form':{'method':_0x4153('0x4a'),'input_type':_0x4153('0x1f'),'response_type':_0x4153('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x236577[_0x4153('0x4b')],'password':_0x236577[_0x4153('0x4c')],'encryption':_0x4153('0x4d')},'application':_0x4153('0x4e')})}})[_0x4153('0x2b')](function(_0x2f4653){var _0x3bb143=_0x2f4653;if(_0x3bb143['id']){def[_0x4153('0x4f')]=_0x3bb143['id'];return BPromise['resolve'](_0x3bb143);}else{throw new Error(util[_0x4153('0x28')](_0x4153('0x50'),_0x236577['id']));}});}function setRelationship(_0x42c6ba,_0x2cba71,_0x69849e,_0x484b5c){return request({'form':{'method':_0x4153('0x51'),'input_type':_0x4153('0x1f'),'response_type':_0x4153('0x1f'),'rest_data':JSON[_0x4153('0x24')]({'session':_0x42c6ba['id'],'module_name':_0x4153('0x20'),'module_id':_0x69849e['id'],'link_field_name':_0x484b5c,'related_ids':[_0x2cba71['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4153('0x52')]=function(_0x2deca3,_0xfb0e95,_0x1aa747,_0x347a25,_0x47c6be,_0xf1e7cb){var _0x2d3642,_0x4ef0cd,_0x2786ff,_0x548c39;_0xf1e7cb[_0x4153('0x53')]=intUtil[_0x4153('0x54')](_0xf1e7cb[_0x4153('0x53')]);_0xf1e7cb[_0x4153('0x55')]=intUtil[_0x4153('0x54')](_0xf1e7cb[_0x4153('0x55')]);def[_0x4153('0x56')]=util['format'](_0x4153('0x57'),_0xf1e7cb[_0x4153('0x53')]);if(_0x47c6be&&_0x47c6be[_0x4153('0x58')]){logger[_0x4153('0x25')](_0x4153('0x59'),'Recording\x20is\x20enabled!');_0xfb0e95[_0x4153('0x5a')]=util['format'](_0x4153('0x5b'),_0xf1e7cb[_0x4153('0x55')],_0xfb0e95[_0x4153('0x5c')],md5(_0xfb0e95[_0x4153('0x5c')]));}else{_0xfb0e95[_0x4153('0x5a')]='';}return getConnection(_0xf1e7cb)[_0x4153('0x2b')](function(_0x2d341d){_0x548c39=_0x2d341d;return getUser(_0xf1e7cb,_0x347a25[_0x4153('0xc')],_0x548c39);})[_0x4153('0x2b')](function(_0x27163a){_0x2d3642=_0x27163a;logger[_0x4153('0x25')](_0x4153('0x5d'),_0x2d3642['id']);return getEndUser(_0xf1e7cb,_0xfb0e95[_0x4153('0x5e')],_0xfb0e95[_0x4153('0x5f')],_0x548c39);})[_0x4153('0x2b')](function(_0x11682f){_0x4ef0cd=_0x11682f;logger[_0x4153('0x25')](_0x4153('0x60'),_0x4ef0cd['id']);return getTicket(_0xf1e7cb,_0x2d3642,_0x4ef0cd,_0x1aa747,_0xfb0e95,_0x1aa747[_0x4153('0x61')],_0x548c39,_0x4153('0x62'));})[_0x4153('0x2b')](function(_0x19cf83){_0x2786ff=_0x19cf83;logger[_0x4153('0x25')](_0x4153('0x63'));logger[_0x4153('0x25')](_0x4153('0x64'),_0x2786ff['id']);return setRelationship(_0x548c39,_0x2d3642,_0x2786ff,_0x4153('0x65'));})[_0x4153('0x2b')](function(){return setRelationship(_0x548c39,_0x4ef0cd,_0x2786ff,'contacts');})[_0x4153('0x2b')](function(){return getServerInfo(_0x548c39);})[_0x4153('0x2b')](function(_0x5cd2f5){var _0x18ac11=parseInt(_0x5cd2f5['version']['charAt'](0x0));var _0x5664c1=util[_0x4153('0x28')](_0x4153('0x66'),_0xf1e7cb[_0x4153('0x53')],_0x2786ff['id']);if(_0x18ac11>0x6){_0x5664c1=util[_0x4153('0x28')](_0x4153('0x67'),_0xf1e7cb[_0x4153('0x53')],_0x2786ff['id']);}logger[_0x4153('0x25')](_0x4153('0x59'),_0x4153('0x68'));emit(util[_0x4153('0x28')]('user:%s',_0x347a25[_0x4153('0xc')]),'trigger:browser:url',{'uri':_0x5664c1});})[_0x4153('0x69')](function(_0x37a44c){logger[_0x4153('0x6a')](_0x4153('0x59'),JSON[_0x4153('0x24')](_0x37a44c));});};exports[_0x4153('0x6b')]=function(_0x22a338,_0x3e6b08,_0x588076,_0x3c1512,_0x47b0f0,_0x562617,_0x3b96d1){var _0x101070,_0x2fab3f,_0x54b6f9,_0x3b05dd;_0x562617[_0x4153('0x53')]=intUtil['stripTrailingSlash'](_0x562617[_0x4153('0x53')]);_0x562617[_0x4153('0x55')]=intUtil[_0x4153('0x54')](_0x562617[_0x4153('0x55')]);def['uri']=util[_0x4153('0x28')](_0x4153('0x57'),_0x562617[_0x4153('0x53')]);if(_0x3b96d1&&_0x3b96d1['recordingFormat']&&_0x3b96d1[_0x4153('0x6c')]!==_0x4153('0x6d')){logger[_0x4153('0x25')](_0x4153('0x6e'),_0x4153('0x6f'));_0x3e6b08[_0x4153('0x5a')]=util['format'](_0x4153('0x5b'),_0x562617[_0x4153('0x55')],_0x3e6b08[_0x4153('0x5c')],md5(_0x3e6b08['uniqueid']));}return getConnection(_0x562617)['then'](function(_0x31a244){_0x3b05dd=_0x31a244;return getUser(_0x562617,_0x3c1512['name'],_0x3b05dd);})[_0x4153('0x2b')](function(_0x1f78c0){_0x101070=_0x1f78c0;logger[_0x4153('0x25')](_0x4153('0x5d'),_0x101070['id']);return getEndUser(_0x562617,_0x3e6b08[_0x4153('0x70')],_0x3e6b08['destcalleridnum'],_0x3b05dd);})[_0x4153('0x2b')](function(_0x2a8867){_0x2fab3f=_0x2a8867;logger[_0x4153('0x25')](_0x4153('0x60'),_0x2fab3f['id']);return getTicket(_0x562617,_0x101070,_0x2fab3f,_0x588076,_0x3e6b08,_0x588076['Fields'],_0x3b05dd,'Outbound');})[_0x4153('0x2b')](function(_0x48ebe0){_0x54b6f9=_0x48ebe0;logger[_0x4153('0x25')](_0x4153('0x63'));logger[_0x4153('0x25')]('The\x20Ticket\x20ID\x20is:',_0x54b6f9['id']);return setRelationship(_0x3b05dd,_0x101070,_0x54b6f9,'users');})[_0x4153('0x2b')](function(){return setRelationship(_0x3b05dd,_0x2fab3f,_0x54b6f9,_0x4153('0x71'));})[_0x4153('0x2b')](function(){return getServerInfo(_0x3b05dd);})[_0x4153('0x2b')](function(_0x4729c7){var _0x47ce80=parseInt(_0x4729c7['version']['charAt'](0x0));var _0x367c51=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x562617['remoteUri'],_0x54b6f9['id']);if(_0x47ce80>0x6){_0x367c51=util[_0x4153('0x28')](_0x4153('0x67'),_0x562617[_0x4153('0x53')],_0x54b6f9['id']);}logger[_0x4153('0x25')](_0x4153('0x6e'),_0x4153('0x68'));emit(util[_0x4153('0x28')](_0x4153('0x72'),_0x3c1512[_0x4153('0xc')]),'trigger:browser:url',{'uri':_0x367c51});})[_0x4153('0x69')](function(_0x2e0ef5){logger[_0x4153('0x6a')]('[OUTBOUND]',JSON[_0x4153('0x24')](_0x2e0ef5));});};exports[_0x4153('0x73')]=function(_0x4715fe,_0x425771,_0x53e8e8,_0x5432d6,_0x4598bf,_0x314e83){var _0x465c85,_0x11f040,_0x2f57df,_0x275dc1;_0x314e83['remoteUri']=intUtil[_0x4153('0x54')](_0x314e83[_0x4153('0x53')]);_0x314e83['serverUrl']=intUtil[_0x4153('0x54')](_0x314e83[_0x4153('0x55')]);def[_0x4153('0x56')]=util['format'](_0x4153('0x57'),_0x314e83[_0x4153('0x53')]);if(_0x4598bf&&_0x4598bf['monitor_format']){logger[_0x4153('0x25')]('['+_0x425771[_0x4153('0x74')][_0x4153('0x75')]()+']',_0x4153('0x6f'));_0x425771[_0x4153('0x5a')]=util[_0x4153('0x28')](_0x4153('0x5b'),_0x314e83[_0x4153('0x55')],_0x425771[_0x4153('0x5c')],md5(_0x425771[_0x4153('0x5c')]));}else{_0x425771['recordingURL']='';}return getConnection(_0x314e83)[_0x4153('0x2b')](function(_0x4d5bb1){_0x275dc1=_0x4d5bb1;if(!_['isNil'](_0x5432d6)){return getUser(_0x314e83,_0x5432d6[_0x4153('0xc')],_0x275dc1);}else{return getUser(_0x314e83,null,_0x275dc1);}})['then'](function(_0x148544){_0x465c85=_0x148544;logger['info'](_0x4153('0x5d'),_0x465c85['id']);return getEndUser(_0x314e83,_0x425771[_0x4153('0x5e')],_0x425771['calleridnum'],_0x275dc1);})[_0x4153('0x2b')](function(_0x2c0641){_0x11f040=_0x2c0641;logger[_0x4153('0x25')](_0x4153('0x60'),_0x11f040['id']);return getTicket(_0x314e83,_0x465c85,_0x11f040,_0x53e8e8,_0x425771,_0x53e8e8['Fields'],_0x275dc1,_0x4153('0x62'));})[_0x4153('0x2b')](function(_0x5d6cbe){_0x2f57df=_0x5d6cbe;logger[_0x4153('0x25')](_0x4153('0x63'));logger[_0x4153('0x25')]('The\x20Ticket\x20ID\x20is:',_0x2f57df['id']);return setRelationship(_0x275dc1,_0x465c85,_0x2f57df,'users');})[_0x4153('0x2b')](function(){return setRelationship(_0x275dc1,_0x11f040,_0x2f57df,_0x4153('0x71'));})[_0x4153('0x2b')](function(){return getServerInfo(_0x275dc1);})[_0x4153('0x69')](function(_0x527c68){logger[_0x4153('0x6a')]('['+_0x425771[_0x4153('0x74')]['toUpperCase']()+']',JSON[_0x4153('0x24')](_0x527c68));});}; \ 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 0458a02..7bf346c 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 _0xc129=['%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','push','content','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','key','format','keyContent'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc129,0xf9));var _0x9c12=function(_0x2d3134,_0x477c10){_0x2d3134=_0x2d3134-0x0;var _0x2dd03e=_0xc129[_0x2d3134];return _0x2dd03e;};'use strict';var _=require(_0x9c12('0x0'));var util=require(_0x9c12('0x1'));exports[_0x9c12('0x2')]=function(_0x158ccf,_0x6b82c4,_0x271705){var _0x1233b3=[];if(_0x158ccf[_0x9c12('0x3')]>0x0){var _0x1d2d72=_[_0x9c12('0x4')](_0x158ccf,['id']);for(var _0x541999=0x0;_0x541999<_0x1d2d72[_0x9c12('0x3')];_0x541999++){var _0x1446d0=_0x1d2d72[_0x541999];if(_0x1446d0['type']===_0x9c12('0x5')){_0x1233b3[_0x9c12('0x6')](_0x1446d0[_0x9c12('0x7')]);}else if(_0x1446d0[_0x9c12('0x8')]===_0x9c12('0x9')&&_0x1446d0[_0x9c12('0xa')]){_0x6b82c4[_0x1446d0['variableName']]&&_0x1233b3[_0x9c12('0x6')](_0x6b82c4[_0x1446d0['variableName']]['toString']());}else if(_0x1446d0[_0x9c12('0x8')]===_0x9c12('0xb')&&_0x1446d0['Variable']&&_0x1446d0[_0x9c12('0xc')][_0x9c12('0xd')]){_0x6b82c4[_0x1446d0[_0x9c12('0xc')][_0x9c12('0xd')][_0x9c12('0xe')]()]&&_0x1233b3[_0x9c12('0x6')](_0x6b82c4[_0x1446d0[_0x9c12('0xc')][_0x9c12('0xd')]['toLowerCase']()][_0x9c12('0xf')]());}else if(_0x1446d0[_0x9c12('0x8')]===_0x9c12('0x10')){if(_0x1446d0[_0x9c12('0x11')]===_0x9c12('0x5')&&_0x1446d0[_0x9c12('0x12')]){_0x1233b3['push'](util[_0x9c12('0x13')]('%s:\x20%s',_0x1446d0['key'],_0x1446d0[_0x9c12('0x14')]));}else if(_0x1446d0[_0x9c12('0x11')]===_0x9c12('0x9')&&_0x1446d0[_0x9c12('0xa')]&&_0x1446d0[_0x9c12('0x12')]){_0x6b82c4[_0x1446d0[_0x9c12('0xa')]]&&_0x1233b3[_0x9c12('0x6')](util['format']('%s:\x20%s',_0x1446d0[_0x9c12('0x12')],_0x6b82c4[_0x1446d0['variableName']]));}else if(_0x1446d0['keyType']==='customVariable'&&_0x1446d0[_0x9c12('0xc')]&&_0x1446d0[_0x9c12('0xc')][_0x9c12('0xd')]&&_0x1446d0[_0x9c12('0x12')]){_0x6b82c4[_0x1446d0[_0x9c12('0xc')][_0x9c12('0xd')][_0x9c12('0xe')]()]&&_0x1233b3[_0x9c12('0x6')](util[_0x9c12('0x13')](_0x9c12('0x15'),_0x1446d0[_0x9c12('0x12')],_0x6b82c4[_0x1446d0[_0x9c12('0xc')][_0x9c12('0xd')][_0x9c12('0xe')]()]));}}}}return _0x1233b3[_0x9c12('0x16')](_0x271705);};exports[_0x9c12('0x17')]=function(_0x12e949){var _0x4a570f=_0x12e949[_0x9c12('0x18')](-0x1);if(_0x4a570f==='/'){_0x12e949=_0x12e949[_0x9c12('0x19')](0x0,_0x12e949[_0x9c12('0x1a')](_0x4a570f));}return _0x12e949;};exports[_0x9c12('0x1b')]=function(_0x382fe9){if(!_[_0x9c12('0x1c')](_0x382fe9)&&_0x382fe9!==''){var _0x55f521=/^(([^<>()\[\]\\.,;:\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 _0x55f521[_0x9c12('0x1d')](String(_0x382fe9)[_0x9c12('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x0fb1=['Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','getString','length','sortBy','type','push','content','variable','variableName','toString','customVariable'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x0fb1,0x10d));var _0x10fb=function(_0x119848,_0x4c2ae4){_0x119848=_0x119848-0x0;var _0x3d4115=_0x0fb1[_0x119848];return _0x3d4115;};'use strict';var _=require(_0x10fb('0x0'));var util=require('util');exports[_0x10fb('0x1')]=function(_0x23e0fe,_0x126afc,_0x3907f8){var _0x1ddbca=[];if(_0x23e0fe[_0x10fb('0x2')]>0x0){var _0x3587d3=_[_0x10fb('0x3')](_0x23e0fe,['id']);for(var _0x6e5781=0x0;_0x6e5781<_0x3587d3[_0x10fb('0x2')];_0x6e5781++){var _0xcf595=_0x3587d3[_0x6e5781];if(_0xcf595[_0x10fb('0x4')]==='string'){_0x1ddbca[_0x10fb('0x5')](_0xcf595[_0x10fb('0x6')]);}else if(_0xcf595[_0x10fb('0x4')]===_0x10fb('0x7')&&_0xcf595[_0x10fb('0x8')]){_0x126afc[_0xcf595[_0x10fb('0x8')]]&&_0x1ddbca[_0x10fb('0x5')](_0x126afc[_0xcf595[_0x10fb('0x8')]][_0x10fb('0x9')]());}else if(_0xcf595['type']===_0x10fb('0xa')&&_0xcf595[_0x10fb('0xb')]&&_0xcf595[_0x10fb('0xb')][_0x10fb('0xc')]){_0x126afc[_0xcf595['Variable']['name'][_0x10fb('0xd')]()]&&_0x1ddbca[_0x10fb('0x5')](_0x126afc[_0xcf595[_0x10fb('0xb')][_0x10fb('0xc')][_0x10fb('0xd')]()][_0x10fb('0x9')]());}else if(_0xcf595['type']===_0x10fb('0xe')){if(_0xcf595[_0x10fb('0xf')]===_0x10fb('0x10')&&_0xcf595[_0x10fb('0x11')]){_0x1ddbca[_0x10fb('0x5')](util[_0x10fb('0x12')](_0x10fb('0x13'),_0xcf595[_0x10fb('0x11')],_0xcf595[_0x10fb('0x14')]));}else if(_0xcf595[_0x10fb('0xf')]===_0x10fb('0x7')&&_0xcf595['variableName']&&_0xcf595[_0x10fb('0x11')]){_0x126afc[_0xcf595[_0x10fb('0x8')]]&&_0x1ddbca['push'](util[_0x10fb('0x12')](_0x10fb('0x13'),_0xcf595[_0x10fb('0x11')],_0x126afc[_0xcf595[_0x10fb('0x8')]]));}else if(_0xcf595['keyType']===_0x10fb('0xa')&&_0xcf595[_0x10fb('0xb')]&&_0xcf595['Variable']['name']&&_0xcf595['key']){_0x126afc[_0xcf595[_0x10fb('0xb')]['name']['toLowerCase']()]&&_0x1ddbca[_0x10fb('0x5')](util['format'](_0x10fb('0x13'),_0xcf595[_0x10fb('0x11')],_0x126afc[_0xcf595[_0x10fb('0xb')][_0x10fb('0xc')][_0x10fb('0xd')]()]));}}}}return _0x1ddbca[_0x10fb('0x15')](_0x3907f8);};exports[_0x10fb('0x16')]=function(_0x297ece){var _0x3e760a=_0x297ece[_0x10fb('0x17')](-0x1);if(_0x3e760a==='/'){_0x297ece=_0x297ece[_0x10fb('0x18')](0x0,_0x297ece[_0x10fb('0x19')](_0x3e760a));}return _0x297ece;};exports[_0x10fb('0x1a')]=function(_0x37efde){if(!_['isNil'](_0x37efde)&&_0x37efde!==''){var _0x54feda=/^(([^<>()\[\]\\.,;:\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 _0x54feda[_0x10fb('0x1b')](String(_0x37efde)[_0x10fb('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 ff44c0a..817ed5f 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(_0x55dfbb,_0x1b6d6b){var _0x569ad9=function(_0x17e98f){while(--_0x17e98f){_0x55dfbb['push'](_0x55dfbb['shift']());}};_0x569ad9(++_0x1b6d6b);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 6162168..96e1eea 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 _0x8132=['map','string','nameField','customField','toLowerCase','content','includes','picklist','type','idField','custom_fields','push','variable','variableName','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','calleridname','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','POST','merge','Tags','name','Subjects','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','%s:%s','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','stringify'];(function(_0x3a758e,_0x32e62b){var _0x134079=function(_0x455534){while(--_0x455534){_0x3a758e['push'](_0x3a758e['shift']());}};_0x134079(++_0x32e62b);}(_0x8132,0x187));var _0x2813=function(_0x4869d6,_0x55952b){_0x4869d6=_0x4869d6-0x0;var _0x25da94=_0x8132[_0x4869d6];return _0x25da94;};'use strict';var _=require(_0x2813('0x0'));var rp=require('request-promise');var md5=require(_0x2813('0x1'));var util=require(_0x2813('0x2'));var Redis=require('ioredis');var intUtil=require(_0x2813('0x3'));var config=require(_0x2813('0x4'));var logger=require(_0x2813('0x5'))(_0x2813('0x6'));config[_0x2813('0x7')]=_[_0x2813('0x8')](config['redis'],{'host':_0x2813('0x9'),'port':0x18eb});var io=require(_0x2813('0xa'))(new Redis(config['redis']));function emit(_0x3be3c1,_0x4d3f87,_0x7e122){io['to'](_0x3be3c1)[_0x2813('0xb')](_0x4d3f87,_0x7e122);}var headers={'Content-Type':_0x2813('0xc'),'Accept':_0x2813('0xc')};function getTicket(_0xad6e43,_0x38e737,_0x53bfc5,_0x434559,_0x98cd39){logger[_0x2813('0xd')](_0x2813('0xe'));return request({'uri':util[_0x2813('0xf')]('%s/tickets.json',_0xad6e43['remoteUri']),'method':_0x2813('0x10'),'body':{'ticket':_[_0x2813('0x11')]({'requester_id':_0x53bfc5['id'],'submitter_id':_0x38e737?_0x38e737['id']:undefined,'assignee_id':_0x38e737?_0x38e737['id']:undefined,'tags':getTags(_0x434559[_0x2813('0x12')],_0x2813('0x13')),'subject':intUtil['getString'](_0x434559[_0x2813('0x14')],_0x98cd39,'\x20'),'description':intUtil[_0x2813('0x15')](_0x434559[_0x2813('0x16')],_0x98cd39,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2813('0x15')](_0x434559[_0x2813('0x16')],_0x98cd39,'\x0a')}},getCustomFields(_0x434559['Fields'],_0x98cd39))}})[_0x2813('0x17')](function(_0x39fef9){logger['info'](_0x2813('0x18'));return _0x39fef9[_0x2813('0x19')];});}function getUser(_0x151a83,_0x597c51){if(intUtil[_0x2813('0x1a')](_0x597c51)){logger[_0x2813('0xd')]('Getting\x20agent\x20with\x20email',_0x597c51);return request({'uri':util[_0x2813('0xf')](_0x2813('0x1b'),_0x151a83[_0x2813('0x1c')]),'qs':{'query':util['format'](_0x2813('0x1d'),_0x597c51)}})[_0x2813('0x17')](function(_0x3dd52c){if(_0x3dd52c[_0x2813('0x1e')]){logger[_0x2813('0xd')](_0x2813('0x1f'));return _['find'](_0x3dd52c[_0x2813('0x20')],{'email':_0x597c51,'role':'agent'});}else{logger[_0x2813('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2813('0xf')](_0x2813('0x21'),_0x151a83[_0x2813('0x1c')])})['then'](function(_0x142058){logger[_0x2813('0xd')](_0x2813('0x22'));return _0x142058[_0x2813('0x23')];});}});}else{logger['info'](_0x2813('0x24'));return request({'uri':util[_0x2813('0xf')](_0x2813('0x21'),_0x151a83[_0x2813('0x1c')])})[_0x2813('0x17')](function(_0x302b19){logger[_0x2813('0xd')](_0x2813('0x22'));return _0x302b19['user'];});}}function getEndUser(_0x380fe2,_0x559d7d,_0x3e108d){logger[_0x2813('0xd')](_0x2813('0x25'),_0x3e108d);return request({'uri':util['format']('%s/search.json',_0x380fe2[_0x2813('0x1c')]),'qs':{'query':util['format'](_0x2813('0x26'),_0x3e108d)}})[_0x2813('0x17')](function(_0xb60b17){var _0x646902;if(_0xb60b17[_0x2813('0x20')]['length']){_0xb60b17[_0x2813('0x20')]=_[_0x2813('0x27')](_0xb60b17[_0x2813('0x20')],{'suspended':![],'role':_0x2813('0x28')});if(_0xb60b17[_0x2813('0x20')][_0x2813('0x29')]){_0x646902=_[_0x2813('0x2a')](_0xb60b17['results']);}}if(_0x646902){logger['info']('Enduser\x20found!');return _0x646902;}else{logger[_0x2813('0xd')](_0x2813('0x2b'));return request({'uri':util[_0x2813('0xf')](_0x2813('0x2c'),_0x380fe2[_0x2813('0x1c')]),'method':'POST','body':{'user':{'role':'end-user','name':util['format'](_0x2813('0x2d'),_0x559d7d||_0x3e108d),'phone':_0x3e108d}}})[_0x2813('0x17')](function(_0x50760f){logger['info'](_0x2813('0x2e'));return _0x50760f[_0x2813('0x23')];});}});}function getAuth(_0x5ab3a1){var _0x57ce3d;if(_0x5ab3a1['authType']==='password'){_0x57ce3d=util[_0x2813('0xf')](_0x2813('0x2f'),_0x5ab3a1['username'],_0x5ab3a1[_0x2813('0x30')]);}else if(_0x5ab3a1['authType']===_0x2813('0x31')){_0x57ce3d=util['format'](_0x2813('0x32'),_0x5ab3a1[_0x2813('0x33')],_0x5ab3a1[_0x2813('0x31')]);}return util[_0x2813('0xf')](_0x2813('0x34'),new Buffer(_0x57ce3d)[_0x2813('0x35')](_0x2813('0x36')));}function request(_0x2de0d2){logger[_0x2813('0x37')]('[HTTP]',JSON[_0x2813('0x38')](_0x2de0d2));return rp(_[_0x2813('0x8')](_0x2de0d2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5997a9,_0x3219dc){var _0x411c48=[];if(_0x5997a9&&_0x5997a9[_0x2813('0x29')]>0x0){_0x411c48=_[_0x2813('0x39')](_0x5997a9,_0x3219dc);}return _0x411c48;}function getCustomFields(_0x5055b6,_0x135e93){var _0x3df437=[];var _0x3e576b={'custom_fields':[]};if(_0x5055b6[_0x2813('0x29')]>0x0){_['forEach'](_0x5055b6,function(_0x2e26fe){if(_['includes']([_0x2813('0x3a'),'picklist'],_0x2e26fe['type'])&&_0x2e26fe[_0x2813('0x3b')]&&!_0x2e26fe[_0x2813('0x3c')]){_0x3e576b[_0x2e26fe[_0x2813('0x3b')][_0x2813('0x3d')]()]=_0x2e26fe[_0x2813('0x3e')]['toString']();}else if(_[_0x2813('0x3f')]([_0x2813('0x3a'),_0x2813('0x40')],_0x2e26fe[_0x2813('0x41')])&&_0x2e26fe[_0x2813('0x42')]&&_0x2e26fe[_0x2813('0x3c')]){_0x3e576b[_0x2813('0x43')][_0x2813('0x44')]({'id':_0x2e26fe[_0x2813('0x42')],'value':_0x2e26fe[_0x2813('0x3e')][_0x2813('0x35')]()});}else if(_0x2e26fe['type']===_0x2813('0x45')&&_0x2e26fe[_0x2813('0x46')]&&_0x2e26fe[_0x2813('0x42')]&&_0x2e26fe['customField']){_0x135e93[_0x2e26fe[_0x2813('0x46')]]&&_0x3e576b[_0x2813('0x43')][_0x2813('0x44')]({'id':_0x2e26fe['idField'],'value':_0x135e93[_0x2e26fe[_0x2813('0x46')]]['toString']()});}else if(_0x2e26fe[_0x2813('0x41')]==='customVariable'&&_0x2e26fe[_0x2813('0x47')]&&_0x2e26fe['Variable'][_0x2813('0x13')]&&_0x2e26fe[_0x2813('0x42')]&&_0x2e26fe[_0x2813('0x3c')]){_0x135e93[_0x2e26fe['Variable']['name']['toLowerCase']()]&&_0x3e576b['custom_fields']['push']({'id':_0x2e26fe['idField'],'value':_0x135e93[_0x2e26fe[_0x2813('0x47')][_0x2813('0x13')][_0x2813('0x3d')]()]['toString']()});}});}return _0x3e576b;}exports[_0x2813('0x48')]=function(_0x318a71,_0x3fee1e,_0x761cde,_0x5112c5,_0x587c45,_0x427a99){var _0x1b375d,_0x1bc040;_0x427a99[_0x2813('0x1c')]=intUtil['stripTrailingSlash'](_0x427a99[_0x2813('0x1c')]);_0x427a99[_0x2813('0x49')]=intUtil[_0x2813('0x4a')](_0x427a99[_0x2813('0x49')]);if(_0x587c45&&_0x587c45[_0x2813('0x4b')]){logger['info'](_0x2813('0x4c'),_0x2813('0x4d'));_0x3fee1e['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x427a99['serverUrl'],_0x3fee1e[_0x2813('0x4e')],md5(_0x3fee1e[_0x2813('0x4e')]));}else{_0x3fee1e[_0x2813('0x4f')]='';}headers[_0x2813('0x50')]=getAuth(_0x427a99);return getUser(_0x427a99,_0x5112c5[_0x2813('0x51')])[_0x2813('0x17')](function(_0x40c566){_0x1b375d=_0x40c566;logger[_0x2813('0xd')]('The\x20User\x20ID\x20is:',_0x1b375d['id']);return getEndUser(_0x427a99,_0x3fee1e['calleridname'],_0x3fee1e[_0x2813('0x52')]);})[_0x2813('0x17')](function(_0x4d0196){_0x1bc040=_0x4d0196;logger[_0x2813('0xd')](_0x2813('0x53'),_0x1bc040['id']);return getTicket(_0x427a99,_0x1b375d,_0x1bc040,_0x761cde,_0x3fee1e);})[_0x2813('0x17')](function(_0xeeb711){if(_0xeeb711){logger[_0x2813('0xd')](_0x2813('0x54'),_0xeeb711['id']);switch(_0x427a99[_0x2813('0x41')]){case _0x2813('0x55'):logger[_0x2813('0xd')](_0x2813('0x4c'),_0x2813('0x56'));return request({'uri':util[_0x2813('0xf')](_0x2813('0x57'),_0x427a99[_0x2813('0x1c')],_0x1b375d['id'],_0xeeb711['id']),'method':_0x2813('0x10')});case _0x2813('0x58'):logger[_0x2813('0xd')](_0x2813('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x2813('0x59'),_0x5112c5['name']),_0x2813('0x5a'),{'uri':util[_0x2813('0xf')]('%s/agent/tickets/%s',_0x427a99[_0x2813('0x1c')][_0x2813('0x5b')](_0x2813('0x5c'),''),_0xeeb711['id'])});break;default:logger[_0x2813('0x5d')](_0x2813('0x4c'),_0x2813('0x5e'));}}})[_0x2813('0x5f')](function(_0x370205){logger[_0x2813('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2813('0x60')](_0x370205,{'showHidden':!![],'depth':null}));});};exports[_0x2813('0x61')]=function(_0x2b49f3,_0x52580f,_0x1e7528,_0x3d6c6c,_0xc48ac6,_0x5bd419,_0x3c3d21){var _0x328f79,_0xe773ef;_0x5bd419[_0x2813('0x1c')]=intUtil['stripTrailingSlash'](_0x5bd419['remoteUri']);_0x5bd419[_0x2813('0x49')]=intUtil[_0x2813('0x4a')](_0x5bd419['serverUrl']);if(_0x3c3d21&&_0x3c3d21['recordingFormat']&&_0x3c3d21[_0x2813('0x62')]!==_0x2813('0x63')){logger[_0x2813('0xd')](_0x2813('0x64'),'Recording\x20is\x20enabled!');_0x52580f[_0x2813('0x4f')]=util[_0x2813('0xf')](_0x2813('0x65'),_0x5bd419['serverUrl'],_0x52580f[_0x2813('0x4e')],md5(_0x52580f[_0x2813('0x4e')]));}headers[_0x2813('0x50')]=getAuth(_0x5bd419);return getUser(_0x5bd419,_0x3d6c6c['email'])[_0x2813('0x17')](function(_0x3a0340){_0x328f79=_0x3a0340;logger['info'](_0x2813('0x66'),_0x328f79['id']);return getEndUser(_0x5bd419,_0x52580f[_0x2813('0x67')],_0x52580f[_0x2813('0x68')]);})[_0x2813('0x17')](function(_0x6cf284){_0xe773ef=_0x6cf284;logger['info']('The\x20Enduser\x20ID\x20is:',_0xe773ef['id']);return getTicket(_0x5bd419,_0x328f79,_0xe773ef,_0x1e7528,_0x52580f);})[_0x2813('0x17')](function(_0x1eea68){if(_0x1eea68){logger['info'](_0x2813('0x54'),_0x1eea68['id']);switch(_0x5bd419[_0x2813('0x41')]){case _0x2813('0x55'):logger[_0x2813('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x2813('0xf')](_0x2813('0x57'),_0x5bd419[_0x2813('0x1c')],_0x328f79['id'],_0x1eea68['id']),'method':_0x2813('0x10')});case _0x2813('0x58'):logger[_0x2813('0xd')](_0x2813('0x64'),_0x2813('0x69'));emit(util[_0x2813('0xf')](_0x2813('0x59'),_0x3d6c6c[_0x2813('0x13')]),_0x2813('0x5a'),{'uri':util[_0x2813('0xf')](_0x2813('0x6a'),_0x5bd419[_0x2813('0x1c')][_0x2813('0x5b')]('/api/v2',''),_0x1eea68['id'])});break;default:logger[_0x2813('0x5d')](_0x2813('0x64'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x2813('0x5f')](function(_0x4b4e4d){logger['error'](_0x2813('0x6b'),util[_0x2813('0x60')](_0x4b4e4d,{'showHidden':!![],'depth':null}));});};exports[_0x2813('0x6c')]=function(_0x48d92a,_0x559542,_0x1313c5,_0x1b75ad,_0x16c6fd,_0x403f96){var _0xb433c1,_0x37b90e;_0x403f96[_0x2813('0x1c')]=intUtil[_0x2813('0x4a')](_0x403f96[_0x2813('0x1c')]);_0x403f96[_0x2813('0x49')]=intUtil[_0x2813('0x4a')](_0x403f96[_0x2813('0x49')]);if(_0x16c6fd&&_0x16c6fd['monitor_format']){logger[_0x2813('0xd')]('['+_0x559542['lastevent']['toUpperCase']()+']',_0x2813('0x4d'));_0x559542[_0x2813('0x4f')]=util['format'](_0x2813('0x65'),_0x403f96['serverUrl'],_0x559542[_0x2813('0x4e')],md5(_0x559542['uniqueid']));}else{_0x559542['recordingURL']='';}headers['Authorization']=getAuth(_0x403f96);return getUser(_0x403f96)[_0x2813('0x17')](function(_0x398355){_0xb433c1=_0x398355;logger[_0x2813('0xd')]('The\x20User\x20ID\x20is:',_0xb433c1['id']);return getEndUser(_0x403f96,_0x559542[_0x2813('0x6d')],_0x559542[_0x2813('0x52')]);})[_0x2813('0x17')](function(_0x38651d){_0x37b90e=_0x38651d;logger[_0x2813('0xd')](_0x2813('0x53'),_0x37b90e['id']);return getTicket(_0x403f96,_0xb433c1,_0x37b90e,_0x1313c5,_0x559542);})[_0x2813('0x17')](function(_0x177f5d){if(_0x177f5d){logger[_0x2813('0xd')](_0x2813('0x54'),_0x177f5d['id']);}})['catch'](function(_0x2c9ff1){logger[_0x2813('0x5d')]('['+_0x559542['lastevent'][_0x2813('0x6e')]()+']'+_0x2813('0x6f'),util['inspect'](_0x2c9ff1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x62df=['includes','picklist','type','nameField','customField','content','string','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','The\x20User\x20ID\x20is:','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','filter','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','forEach'];(function(_0xd4d5d5,_0xb1a14a){var _0x332155=function(_0x2e60dd){while(--_0x2e60dd){_0xd4d5d5['push'](_0xd4d5d5['shift']());}};_0x332155(++_0xb1a14a);}(_0x62df,0x120));var _0xf62d=function(_0xfaad21,_0x395749){_0xfaad21=_0xfaad21-0x0;var _0xbcd386=_0x62df[_0xfaad21];return _0xbcd386;};'use strict';var _=require(_0xf62d('0x0'));var rp=require(_0xf62d('0x1'));var md5=require(_0xf62d('0x2'));var util=require(_0xf62d('0x3'));var Redis=require(_0xf62d('0x4'));var intUtil=require(_0xf62d('0x5'));var config=require(_0xf62d('0x6'));var logger=require(_0xf62d('0x7'))(_0xf62d('0x8'));config[_0xf62d('0x9')]=_[_0xf62d('0xa')](config[_0xf62d('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf62d('0xb'))(new Redis(config[_0xf62d('0x9')]));function emit(_0x375a80,_0x26c3ad,_0x4c2d64){io['to'](_0x375a80)[_0xf62d('0xc')](_0x26c3ad,_0x4c2d64);}var headers={'Content-Type':'application/json','Accept':_0xf62d('0xd')};function getTicket(_0x46e0ed,_0x88450f,_0x3d11ef,_0x314689,_0xbba5ed){logger[_0xf62d('0xe')](_0xf62d('0xf'));return request({'uri':util[_0xf62d('0x10')]('%s/tickets.json',_0x46e0ed['remoteUri']),'method':_0xf62d('0x11'),'body':{'ticket':_[_0xf62d('0x12')]({'requester_id':_0x3d11ef['id'],'submitter_id':_0x88450f?_0x88450f['id']:undefined,'assignee_id':_0x88450f?_0x88450f['id']:undefined,'tags':getTags(_0x314689[_0xf62d('0x13')],'name'),'subject':intUtil[_0xf62d('0x14')](_0x314689[_0xf62d('0x15')],_0xbba5ed,'\x20'),'description':intUtil['getString'](_0x314689[_0xf62d('0x16')],_0xbba5ed,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x314689[_0xf62d('0x16')],_0xbba5ed,'\x0a')}},getCustomFields(_0x314689[_0xf62d('0x17')],_0xbba5ed))}})[_0xf62d('0x18')](function(_0x4fbb08){logger['info']('Ticket\x20created!');return _0x4fbb08[_0xf62d('0x19')];});}function getUser(_0x543d0,_0x936d9a){if(intUtil[_0xf62d('0x1a')](_0x936d9a)){logger[_0xf62d('0xe')](_0xf62d('0x1b'),_0x936d9a);return request({'uri':util[_0xf62d('0x10')]('%s/search.json',_0x543d0['remoteUri']),'qs':{'query':util[_0xf62d('0x10')](_0xf62d('0x1c'),_0x936d9a)}})[_0xf62d('0x18')](function(_0x4c394d){if(_0x4c394d['count']){logger[_0xf62d('0xe')](_0xf62d('0x1d'));return _[_0xf62d('0x1e')](_0x4c394d[_0xf62d('0x1f')],{'email':_0x936d9a,'role':_0xf62d('0x20')});}else{logger['info'](_0xf62d('0x21'));return request({'uri':util['format'](_0xf62d('0x22'),_0x543d0[_0xf62d('0x23')])})[_0xf62d('0x18')](function(_0x41e5e0){logger[_0xf62d('0xe')](_0xf62d('0x24'));return _0x41e5e0[_0xf62d('0x25')];});}});}else{logger[_0xf62d('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf62d('0x10')](_0xf62d('0x22'),_0x543d0['remoteUri'])})[_0xf62d('0x18')](function(_0x4e51e0){logger[_0xf62d('0xe')](_0xf62d('0x24'));return _0x4e51e0['user'];});}}function getEndUser(_0x40efeb,_0x5167cd,_0x4f205a){logger[_0xf62d('0xe')]('Searching\x20enduser\x20with\x20phone',_0x4f205a);return request({'uri':util[_0xf62d('0x10')]('%s/search.json',_0x40efeb[_0xf62d('0x23')]),'qs':{'query':util['format'](_0xf62d('0x26'),_0x4f205a)}})[_0xf62d('0x18')](function(_0x2aadd2){var _0x3fdc49;if(_0x2aadd2[_0xf62d('0x1f')]['length']){_0x2aadd2[_0xf62d('0x1f')]=_[_0xf62d('0x27')](_0x2aadd2[_0xf62d('0x1f')],{'suspended':![],'role':'end-user'});if(_0x2aadd2[_0xf62d('0x1f')][_0xf62d('0x28')]){_0x3fdc49=_[_0xf62d('0x29')](_0x2aadd2[_0xf62d('0x1f')]);}}if(_0x3fdc49){logger['info'](_0xf62d('0x2a'));return _0x3fdc49;}else{logger[_0xf62d('0xe')](_0xf62d('0x2b'));return request({'uri':util[_0xf62d('0x10')](_0xf62d('0x2c'),_0x40efeb['remoteUri']),'method':'POST','body':{'user':{'role':_0xf62d('0x2d'),'name':util['format'](_0xf62d('0x2e'),_0x5167cd||_0x4f205a),'phone':_0x4f205a}}})[_0xf62d('0x18')](function(_0x3c904a){logger[_0xf62d('0xe')](_0xf62d('0x2f'));return _0x3c904a[_0xf62d('0x25')];});}});}function getAuth(_0x8ff6a1){var _0x36542b;if(_0x8ff6a1[_0xf62d('0x30')]==='password'){_0x36542b=util[_0xf62d('0x10')](_0xf62d('0x31'),_0x8ff6a1[_0xf62d('0x32')],_0x8ff6a1['password']);}else if(_0x8ff6a1[_0xf62d('0x30')]===_0xf62d('0x33')){_0x36542b=util[_0xf62d('0x10')](_0xf62d('0x34'),_0x8ff6a1[_0xf62d('0x32')],_0x8ff6a1['token']);}return util[_0xf62d('0x10')](_0xf62d('0x35'),new Buffer(_0x36542b)[_0xf62d('0x36')]('base64'));}function request(_0xb3508b){logger[_0xf62d('0x37')](_0xf62d('0x38'),JSON[_0xf62d('0x39')](_0xb3508b));return rp(_[_0xf62d('0xa')](_0xb3508b,{'method':_0xf62d('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x150a7c,_0x5a62a6){var _0x3cd4de=[];if(_0x150a7c&&_0x150a7c[_0xf62d('0x28')]>0x0){_0x3cd4de=_['map'](_0x150a7c,_0x5a62a6);}return _0x3cd4de;}function getCustomFields(_0x1e7c46,_0x49c6de){var _0xfd5b77=[];var _0x2c4f84={'custom_fields':[]};if(_0x1e7c46['length']>0x0){_[_0xf62d('0x3b')](_0x1e7c46,function(_0xb59831){if(_[_0xf62d('0x3c')](['string',_0xf62d('0x3d')],_0xb59831[_0xf62d('0x3e')])&&_0xb59831[_0xf62d('0x3f')]&&!_0xb59831[_0xf62d('0x40')]){_0x2c4f84[_0xb59831[_0xf62d('0x3f')]['toLowerCase']()]=_0xb59831[_0xf62d('0x41')][_0xf62d('0x36')]();}else if(_[_0xf62d('0x3c')]([_0xf62d('0x42'),_0xf62d('0x3d')],_0xb59831[_0xf62d('0x3e')])&&_0xb59831[_0xf62d('0x43')]&&_0xb59831[_0xf62d('0x40')]){_0x2c4f84[_0xf62d('0x44')][_0xf62d('0x45')]({'id':_0xb59831[_0xf62d('0x43')],'value':_0xb59831[_0xf62d('0x41')][_0xf62d('0x36')]()});}else if(_0xb59831['type']===_0xf62d('0x46')&&_0xb59831[_0xf62d('0x47')]&&_0xb59831[_0xf62d('0x43')]&&_0xb59831[_0xf62d('0x40')]){_0x49c6de[_0xb59831[_0xf62d('0x47')]]&&_0x2c4f84[_0xf62d('0x44')]['push']({'id':_0xb59831['idField'],'value':_0x49c6de[_0xb59831[_0xf62d('0x47')]][_0xf62d('0x36')]()});}else if(_0xb59831[_0xf62d('0x3e')]===_0xf62d('0x48')&&_0xb59831['Variable']&&_0xb59831[_0xf62d('0x49')][_0xf62d('0x4a')]&&_0xb59831[_0xf62d('0x43')]&&_0xb59831[_0xf62d('0x40')]){_0x49c6de[_0xb59831[_0xf62d('0x49')]['name'][_0xf62d('0x4b')]()]&&_0x2c4f84[_0xf62d('0x44')][_0xf62d('0x45')]({'id':_0xb59831[_0xf62d('0x43')],'value':_0x49c6de[_0xb59831['Variable'][_0xf62d('0x4a')]['toLowerCase']()][_0xf62d('0x36')]()});}});}return _0x2c4f84;}exports['queue']=function(_0x22bef7,_0x39d34b,_0x17ef43,_0x38e984,_0xe9e4cb,_0x519532){var _0x31e742,_0x126df9;_0x519532[_0xf62d('0x23')]=intUtil[_0xf62d('0x4c')](_0x519532[_0xf62d('0x23')]);_0x519532['serverUrl']=intUtil[_0xf62d('0x4c')](_0x519532[_0xf62d('0x4d')]);if(_0xe9e4cb&&_0xe9e4cb['monitor_format']){logger['info'](_0xf62d('0x4e'),'Recording\x20is\x20enabled!');_0x39d34b[_0xf62d('0x4f')]=util[_0xf62d('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x519532['serverUrl'],_0x39d34b[_0xf62d('0x50')],md5(_0x39d34b[_0xf62d('0x50')]));}else{_0x39d34b[_0xf62d('0x4f')]='';}headers[_0xf62d('0x51')]=getAuth(_0x519532);return getUser(_0x519532,_0x38e984[_0xf62d('0x52')])[_0xf62d('0x18')](function(_0x281648){_0x31e742=_0x281648;logger[_0xf62d('0xe')]('The\x20User\x20ID\x20is:',_0x31e742['id']);return getEndUser(_0x519532,_0x39d34b[_0xf62d('0x53')],_0x39d34b['calleridnum']);})[_0xf62d('0x18')](function(_0x2d4bd6){_0x126df9=_0x2d4bd6;logger['info'](_0xf62d('0x54'),_0x126df9['id']);return getTicket(_0x519532,_0x31e742,_0x126df9,_0x17ef43,_0x39d34b);})[_0xf62d('0x18')](function(_0x3ef55b){if(_0x3ef55b){logger[_0xf62d('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3ef55b['id']);switch(_0x519532[_0xf62d('0x3e')]){case _0xf62d('0x55'):logger['info'](_0xf62d('0x4e'),_0xf62d('0x56'));return request({'uri':util[_0xf62d('0x10')](_0xf62d('0x57'),_0x519532[_0xf62d('0x23')],_0x31e742['id'],_0x3ef55b['id']),'method':_0xf62d('0x11')});case _0xf62d('0x58'):logger[_0xf62d('0xe')](_0xf62d('0x4e'),_0xf62d('0x59'));emit(util[_0xf62d('0x10')]('user:%s',_0x38e984['name']),_0xf62d('0x5a'),{'uri':util['format'](_0xf62d('0x5b'),_0x519532[_0xf62d('0x23')][_0xf62d('0x5c')](_0xf62d('0x5d'),''),_0x3ef55b['id'])});break;default:logger[_0xf62d('0x5e')](_0xf62d('0x4e'),_0xf62d('0x5f'));}}})[_0xf62d('0x60')](function(_0x30c341){logger['error'](_0xf62d('0x61'),util[_0xf62d('0x62')](_0x30c341,{'showHidden':!![],'depth':null}));});};exports[_0xf62d('0x63')]=function(_0xd2f0da,_0x534405,_0x106767,_0x11a32d,_0x295234,_0x39664f,_0x372443){var _0x3ce30e,_0x25d516;_0x39664f['remoteUri']=intUtil[_0xf62d('0x4c')](_0x39664f['remoteUri']);_0x39664f[_0xf62d('0x4d')]=intUtil[_0xf62d('0x4c')](_0x39664f['serverUrl']);if(_0x372443&&_0x372443['recordingFormat']&&_0x372443[_0xf62d('0x64')]!==_0xf62d('0x65')){logger[_0xf62d('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x534405[_0xf62d('0x4f')]=util[_0xf62d('0x10')](_0xf62d('0x66'),_0x39664f[_0xf62d('0x4d')],_0x534405[_0xf62d('0x50')],md5(_0x534405[_0xf62d('0x50')]));}headers['Authorization']=getAuth(_0x39664f);return getUser(_0x39664f,_0x11a32d[_0xf62d('0x52')])[_0xf62d('0x18')](function(_0x2d044e){_0x3ce30e=_0x2d044e;logger[_0xf62d('0xe')]('The\x20User\x20ID\x20is:',_0x3ce30e['id']);return getEndUser(_0x39664f,_0x534405[_0xf62d('0x67')],_0x534405[_0xf62d('0x68')]);})[_0xf62d('0x18')](function(_0x24ef27){_0x25d516=_0x24ef27;logger[_0xf62d('0xe')](_0xf62d('0x54'),_0x25d516['id']);return getTicket(_0x39664f,_0x3ce30e,_0x25d516,_0x106767,_0x534405);})['then'](function(_0x38cdc8){if(_0x38cdc8){logger[_0xf62d('0xe')](_0xf62d('0x69'),_0x38cdc8['id']);switch(_0x39664f['type']){case _0xf62d('0x55'):logger[_0xf62d('0xe')](_0xf62d('0x6a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x39664f[_0xf62d('0x23')],_0x3ce30e['id'],_0x38cdc8['id']),'method':_0xf62d('0x11')});case'newTab':logger['info'](_0xf62d('0x6a'),_0xf62d('0x59'));emit(util['format'](_0xf62d('0x6b'),_0x11a32d['name']),_0xf62d('0x5a'),{'uri':util[_0xf62d('0x10')]('%s/agent/tickets/%s',_0x39664f[_0xf62d('0x23')][_0xf62d('0x5c')](_0xf62d('0x5d'),''),_0x38cdc8['id'])});break;default:logger[_0xf62d('0x5e')](_0xf62d('0x6a'),_0xf62d('0x5f'));}}})[_0xf62d('0x60')](function(_0x3336a2){logger['error'](_0xf62d('0x6c'),util['inspect'](_0x3336a2,{'showHidden':!![],'depth':null}));});};exports[_0xf62d('0x6d')]=function(_0x14aea0,_0x94ef2b,_0x44f189,_0x4786c0,_0x40f020,_0x5238eb){var _0x3d82ed,_0x1258dc;_0x5238eb[_0xf62d('0x23')]=intUtil[_0xf62d('0x4c')](_0x5238eb[_0xf62d('0x23')]);_0x5238eb[_0xf62d('0x4d')]=intUtil[_0xf62d('0x4c')](_0x5238eb[_0xf62d('0x4d')]);if(_0x40f020&&_0x40f020[_0xf62d('0x6e')]){logger[_0xf62d('0xe')]('['+_0x94ef2b['lastevent'][_0xf62d('0x6f')]()+']','Recording\x20is\x20enabled!');_0x94ef2b['recordingURL']=util[_0xf62d('0x10')](_0xf62d('0x66'),_0x5238eb[_0xf62d('0x4d')],_0x94ef2b[_0xf62d('0x50')],md5(_0x94ef2b[_0xf62d('0x50')]));}else{_0x94ef2b[_0xf62d('0x4f')]='';}headers[_0xf62d('0x51')]=getAuth(_0x5238eb);return getUser(_0x5238eb)[_0xf62d('0x18')](function(_0x505067){_0x3d82ed=_0x505067;logger[_0xf62d('0xe')](_0xf62d('0x70'),_0x3d82ed['id']);return getEndUser(_0x5238eb,_0x94ef2b[_0xf62d('0x53')],_0x94ef2b[_0xf62d('0x71')]);})[_0xf62d('0x18')](function(_0x5204e8){_0x1258dc=_0x5204e8;logger[_0xf62d('0xe')](_0xf62d('0x54'),_0x1258dc['id']);return getTicket(_0x5238eb,_0x3d82ed,_0x1258dc,_0x44f189,_0x94ef2b);})[_0xf62d('0x18')](function(_0x539f7f){if(_0x539f7f){logger['info'](_0xf62d('0x69'),_0x539f7f['id']);}})[_0xf62d('0x60')](function(_0x7ec808){logger[_0xf62d('0x5e')]('['+_0x94ef2b[_0xf62d('0x72')][_0xf62d('0x6f')]()+']'+_0xf62d('0x73'),util[_0xf62d('0x62')](_0x7ec808,{'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 fa05c97..c559cde 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 _0x476e=['clientSecret','refresh_token','then','add','expires_in','error','Failing\x20creating\x20the\x20access_token','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','info','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','lead','Leads','nothing','Creating\x20new\x20call...','Owner','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','enduserType','What_Id','$se_module','Call_Duration','utc','format','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','Call\x20created!','queue','stripTrailingSlash','host','monitor_format','recordingURL','serverUrl','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','zoho.eu','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','user:%s','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','stringify','forEach','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId'];(function(_0x3a703a,_0x1e2aff){var _0x206083=function(_0x3562f5){while(--_0x3562f5){_0x3a703a['push'](_0x3a703a['shift']());}};_0x206083(++_0x1e2aff);}(_0x476e,0x73));var _0xe476=function(_0x3924af,_0x2516f0){_0x3924af=_0x3924af-0x0;var _0x77d4e0=_0x476e[_0x3924af];return _0x77d4e0;};'use strict';var _=require(_0xe476('0x0'));var rp=require(_0xe476('0x1'));var md5=require(_0xe476('0x2'));var util=require(_0xe476('0x3'));var intUtil=require(_0xe476('0x4'));var moment=require(_0xe476('0x5'));var Redis=require('ioredis');var BPromise=require(_0xe476('0x6'));var config=require(_0xe476('0x7'));var logger=require(_0xe476('0x8'))(_0xe476('0x9'));config['redis']=_[_0xe476('0xa')](config[_0xe476('0xb')],{'host':_0xe476('0xc'),'port':0x18eb});var io=require(_0xe476('0xd'))(new Redis(config[_0xe476('0xb')]));function emit(_0x2eaa12,_0x573c71,_0x16f519){io['to'](_0x2eaa12)[_0xe476('0xe')](_0x573c71,_0x16f519);}function request(_0x37a603){logger[_0xe476('0xf')]('[HTTP]',JSON[_0xe476('0x10')](_0x37a603));return rp(_0x37a603);}function getCustomFields(_0x9cbe57,_0x47da68){var _0x1172ea={};if(_0x9cbe57['length']>0x0){_[_0xe476('0x11')](_0x9cbe57,function(_0x1fd21e){if(_[_0xe476('0x12')]([_0xe476('0x13'),_0xe476('0x14')],_0x1fd21e[_0xe476('0x15')])&&_0x1fd21e[_0xe476('0x16')]){_0x1172ea[_0x1fd21e[_0xe476('0x16')]]=_0x1fd21e['content'][_0xe476('0x17')]();}else if(_0x1fd21e[_0xe476('0x15')]===_0xe476('0x18')&&_0x1fd21e[_0xe476('0x19')]&&_0x1fd21e[_0xe476('0x16')]&&_0x47da68[_0x1fd21e[_0xe476('0x19')]]){_0x1172ea[_0x1fd21e[_0xe476('0x16')]]=_0x47da68[_0x1fd21e[_0xe476('0x19')]]['toString']();}else if(_0x1fd21e['type']===_0xe476('0x1a')&&_0x1fd21e[_0xe476('0x1b')]&&_0x1fd21e[_0xe476('0x1b')][_0xe476('0x1c')]&&_0x1fd21e[_0xe476('0x16')]&&_0x47da68[_0x1fd21e[_0xe476('0x1b')][_0xe476('0x1c')][_0xe476('0x1d')]()]){_0x1172ea[_0x1fd21e[_0xe476('0x16')]]=_0x47da68[_0x1fd21e[_0xe476('0x1b')][_0xe476('0x1c')][_0xe476('0x1d')]()]['toString']();}});}return _0x1172ea;}function getName(_0x564e19){if(_0x564e19[_0xe476('0x1e')]('\x20')>0x0){var _0x39aa3b=_0x564e19[_0xe476('0x1f')](/ (.+)/);if(_0x39aa3b[0x1]){return _0x39aa3b;}}return[_0x564e19,_0x564e19];}var accountsTokens={};function getAccessToken(_0x5d4d97){return new Promise(function(_0x5ad51b,_0x1e5428){if(!_['isNil'](accountsTokens[_0x5d4d97['id']])&&!_[_0xe476('0x20')](accountsTokens[_0x5d4d97['id']][_0xe476('0x21')])){if(moment()['isBefore'](accountsTokens[_0x5d4d97['id']]['expires_in'])){_0x5ad51b(accountsTokens[_0x5d4d97['id']][_0xe476('0x21')]);}}var _0x1723b1;switch(_0x5d4d97[_0xe476('0x22')]){case'US':_0x1723b1='https://accounts.zoho.com';break;case'AU':_0x1723b1=_0xe476('0x23');break;case'EU':_0x1723b1=_0xe476('0x24');break;case'IN':_0x1723b1=_0xe476('0x25');break;case'CN':_0x1723b1=_0xe476('0x26');break;default:_0x1723b1=_0xe476('0x24');break;}var _0x1df2d8={'method':_0xe476('0x27'),'uri':_0x1723b1+_0xe476('0x28'),'qs':{'refresh_token':_0x5d4d97['refreshToken'],'client_id':_0x5d4d97[_0xe476('0x29')],'client_secret':_0x5d4d97[_0xe476('0x2a')],'grant_type':_0xe476('0x2b')},'json':!![]};return rp(_0x1df2d8)[_0xe476('0x2c')](function(_0x3ce0e0){accountsTokens[_0x5d4d97['id']]={'access_token':_0x3ce0e0[_0xe476('0x21')],'expires_in':moment()[_0xe476('0x2d')](_0x3ce0e0[_0xe476('0x2e')],'seconds')};_0x5ad51b(_0x3ce0e0[_0xe476('0x21')]);})['catch'](function(_0xb229da){logger[_0xe476('0x2f')](_0xe476('0x30'),_0xb229da['stack']);_0x1e5428(_0xb229da);});});}function getUser(_0x4ca365,_0x5a86aa,_0x329de6,_0x2c9c0b){logger['info']('Search\x20user');return request({'method':'GET','uri':util['format'](_0xe476('0x31'),_0x5a86aa),'qs':{'type':_0xe476('0x32')},'headers':{'Authorization':_0xe476('0x33')+_0x4ca365},'json':!![]})[_0xe476('0x2c')](function(_0x538761){if(_0x538761[_0xe476('0x34')]){var _0x4e3224=-0x1;if(_[_0xe476('0x35')](_0x538761[_0xe476('0x34')])){if(!_[_0xe476('0x20')](_0x2c9c0b)){_0x4e3224=_[_0xe476('0x36')](_0x538761['users'],function(_0x1e4c0f){return _0x1e4c0f[_0xe476('0x37')]===_0x2c9c0b;});}if(_0x4e3224>=0x0){logger['info'](_0xe476('0x38'));}else{logger['info'](_0xe476('0x39'));_0x4e3224=_[_0xe476('0x36')](_0x538761[_0xe476('0x34')],function(_0xecde7a){return _0xecde7a[_0xe476('0x3a')][_0xe476('0x1c')]==='Administrator';});}return _0x538761['users'][_0x4e3224];}else{if(_0x538761['user'][_0xe476('0x3a')]['name']===_0xe476('0x3b')){logger[_0xe476('0x3c')]('Using\x20the\x20admin\x20account!');user=_0x538761[_0xe476('0x3d')];return user;}else{logger['error'](_0xe476('0x3e'),JSON[_0xe476('0x10')](_0x538761));throw new Error(_0xe476('0x3f')+JSON['stringify'](_0x538761));}}}else{logger[_0xe476('0x2f')](_0xe476('0x3e'),JSON[_0xe476('0x10')](_0x538761));throw new Error(_0xe476('0x3f')+JSON[_0xe476('0x10')](_0x538761));}})[_0xe476('0x40')](function(_0x93c6c1){console['error'](_0x93c6c1);});}function getZohoUser(_0x247c5d,_0x1a06bb){return new BPromise(function(_0x25bf5a,_0x313cd9){request(_0x247c5d)[_0xe476('0x2c')](function(_0x1df1f4){var _0x4a30c6=null;if(_0x1df1f4){_0x4a30c6=_0x1df1f4['data'][0x0];_0x4a30c6['enduserType']=_0x1a06bb;}_0x25bf5a(_0x4a30c6);})[_0xe476('0x40')](function(_0x49bc9d){_0x313cd9(_0x49bc9d);});});}function createEndUser(_0x4d12c9,_0x570108,_0x37ed8a,_0x552f31,_0x2518e5,_0x37c55e){var _0x37ed8a=getName(_0x37ed8a);return request({'method':_0xe476('0x27'),'uri':'https://www.zohoapis.'+_0x570108+_0xe476('0x41')+_[_0xe476('0x42')](_0x37c55e[_0xe476('0x43')])+'s','body':{'data':[{'Last_Name':_0x37ed8a[0x1],'First_Name':_0x37ed8a[0x0],'Phone':_0x552f31,'Owner':{'name':!_[_0xe476('0x20')](_0x2518e5[_0xe476('0x44')][_0xe476('0x1c')])?_0x2518e5[_0xe476('0x44')][_0xe476('0x1c')]:!_[_0xe476('0x20')](_0x2518e5[_0xe476('0x45')])?_0x2518e5[_0xe476('0x45')]+'\x20'+_0x2518e5[_0xe476('0x46')]:_0x2518e5[_0xe476('0x46')],'id':_0x2518e5['id']}}]},'headers':{'Authorization':_0xe476('0x33')+_0x4d12c9},'json':!![]})['then'](function(_0x3ab1c5){if(_0x3ab1c5&&_0x3ab1c5[_0xe476('0x47')][0x0][_0xe476('0x48')]==='SUCCESS'){var _0x796913=_0x3ab1c5[_0xe476('0x47')][0x0][_0xe476('0x49')];_0x796913['enduserType']=_[_0xe476('0x42')](_0x37c55e['moduleCreate'])+'s';return _0x796913;}logger['error'](_0xe476('0x3e'),JSON[_0xe476('0x10')](data));throw new Error(_0xe476('0x4a')+JSON['stringify'](data));})[_0xe476('0x40')](function(_0x20209f){console[_0xe476('0x4b')](_0xe476('0x4c'),_0x20209f);});}function getEndUser(_0x1edb48,_0x3e8e60,_0x538c0d,_0x5479b6,_0x18d7e7,_0x3221c6,_0x39a7d4){var _0x142404={'method':_0xe476('0x4d'),'uri':'','headers':{'Authorization':_0xe476('0x33')+_0x1edb48},'json':!![]};switch(_0x39a7d4[_0xe476('0x4e')]){case _0xe476('0x4f'):_0x142404[_0xe476('0x50')]='https://www.zohoapis.'+_0x3e8e60+_0xe476('0x51')+_0x18d7e7+'))';return getZohoUser(_0x142404,_0xe476('0x52'))[_0xe476('0x2c')](function(_0x161aed){if(_0x161aed)return _0x161aed;_0x142404['uri']=_0xe476('0x53')+_0x3e8e60+_0xe476('0x54')+_0x18d7e7+'))';return getZohoUser(_0x142404,'Leads')[_0xe476('0x2c')](function(_0x149287){if(_0x149287)return _0x149287;if(_0x39a7d4[_0xe476('0x43')]!='nothing'){return createEndUser(_0x1edb48,_0x3e8e60,_0x5479b6,_0x18d7e7,_0x3221c6,_0x39a7d4);}else{return{};}});});break;case _0xe476('0x55'):_0x142404[_0xe476('0x50')]='https://www.zohoapis.'+_0x3e8e60+_0xe476('0x51')+_0x18d7e7+'))';return getZohoUser(_0x142404,_0xe476('0x52'))['then'](function(_0x3eedc4){if(_0x3eedc4)return _0x3eedc4;if(_0x39a7d4[_0xe476('0x43')]!='nothing'){return createEndUser(_0x1edb48,_0x3e8e60,_0x5479b6,_0x18d7e7,_0x3221c6,_0x39a7d4);}else{return{};}});break;case _0xe476('0x56'):_0x142404[_0xe476('0x50')]=_0xe476('0x53')+_0x3e8e60+_0xe476('0x54')+_0x18d7e7+'))';return getZohoUser(_0x142404,_0xe476('0x57'))[_0xe476('0x2c')](function(_0x330528){if(_0x330528)return _0x330528;if(_0x39a7d4['moduleCreate']!=_0xe476('0x58')){return createEndUser(_0x1edb48,_0x3e8e60,_0x5479b6,_0x18d7e7,_0x3221c6,_0x39a7d4);}else{return{};}});break;}}function getCall(_0x5d8a70,_0xe7b8cb,_0x457737,_0x2d03d8,_0x16d64d,_0x135cab,_0x559e8f,_0x6bd73a){logger[_0xe476('0x3c')](_0xe476('0x59'));var _0x1986b7={};_0x1986b7[_0xe476('0x5a')]={'name':!_[_0xe476('0x20')](_0x2d03d8[_0xe476('0x44')]['name'])&&!_[_0xe476('0x20')](_0x2d03d8[_0xe476('0x3a')][_0xe476('0x1c')])&&_0x2d03d8[_0xe476('0x3a')][_0xe476('0x1c')]==='administrator'?_0x2d03d8[_0xe476('0x44')][_0xe476('0x1c')]:!_[_0xe476('0x20')](_0x2d03d8[_0xe476('0x45')])?_0x2d03d8[_0xe476('0x45')]+'\x20'+_0x2d03d8[_0xe476('0x46')]:_0x2d03d8[_0xe476('0x46')],'id':_0x2d03d8['id']};_0x1986b7['Subject']=intUtil[_0xe476('0x5b')](_0x135cab[_0xe476('0x5c')],_0x559e8f,'\x20');_0x1986b7['Description']=intUtil['getString'](_0x135cab[_0xe476('0x5d')],_0x559e8f,'\x0a');if(_0x16d64d['enduserType']==='Contacts'){_0x1986b7[_0xe476('0x5e')]={'name':!_[_0xe476('0x20')](_0x16d64d['Full_Name'])?_0x16d64d[_0xe476('0x5f')]:!_[_0xe476('0x20')](_0x16d64d[_0xe476('0x60')])?_0x16d64d[_0xe476('0x60')]+'\x20'+_0x16d64d[_0xe476('0x61')]:_0x16d64d['Last_Name'],'id':_0x16d64d['id']};}if(_0x16d64d[_0xe476('0x62')]===_0xe476('0x57')){_0x1986b7[_0xe476('0x63')]={'name':!_['isNil'](_0x16d64d[_0xe476('0x5f')])?_0x16d64d[_0xe476('0x5f')]:!_['isNil'](_0x16d64d[_0xe476('0x60')])?_0x16d64d[_0xe476('0x60')]+'\x20'+_0x16d64d['Last_Name']:_0x16d64d[_0xe476('0x61')],'id':_0x16d64d['id']};_0x1986b7[_0xe476('0x64')]=_[_0xe476('0x42')](_0x16d64d['enduserType']);}if(_0x559e8f['talktime']){_0x1986b7[_0xe476('0x65')]=moment[_0xe476('0x66')](parseInt(_0x559e8f['talktime'])*0x3e8)[_0xe476('0x67')]('mm:ss');}else if(_0x559e8f['answertime']&&_0x559e8f[_0xe476('0x68')]){_0x1986b7['Call_Duration']=moment[_0xe476('0x66')](moment(_0x559e8f[_0xe476('0x68')],_0xe476('0x69'))[_0xe476('0x6a')](moment(_0x559e8f[_0xe476('0x6b')],_0xe476('0x69'))))[_0xe476('0x67')](_0xe476('0x6c'));}switch(_0x559e8f[_0xe476('0x6d')]){case _0xe476('0x6e'):_0x1986b7[_0xe476('0x6f')]=_0xe476('0x70');break;case _0xe476('0x71'):case _0xe476('0x72'):_0x1986b7[_0xe476('0x6f')]=_0xe476('0x73');break;case _0xe476('0x74'):_0x1986b7[_0xe476('0x6f')]=_0xe476('0x75');break;case _0xe476('0x76'):_0x1986b7[_0xe476('0x6f')]='Abandoned';break;case'timeout':_0x1986b7[_0xe476('0x6f')]='Timeout';default:}_0x1986b7['Call_Start_Time']=(_0x6bd73a==='outbound'?moment(_0x559e8f['starttime'])[_0xe476('0x67')](_0xe476('0x69')):moment(_0x559e8f[_0xe476('0x77')])['format'](_0xe476('0x69')))||moment()[_0xe476('0x67')](_0xe476('0x69'));_0x1986b7[_0xe476('0x78')]=_0x6bd73a||_0xe476('0x79');_0x1986b7=_[_0xe476('0x7a')](_0x1986b7,getCustomFields(_0x135cab['Fields'],_0x559e8f));return request({'method':_0xe476('0x27'),'uri':_0xe476('0x53')+_0xe7b8cb+_0xe476('0x7b'),'headers':{'Authorization':_0xe476('0x33')+_0x5d8a70},'body':{'data':[_0x1986b7]},'json':!![]})[_0xe476('0x2c')](function(_0x51c9f1){if(_0x51c9f1&&_0x51c9f1['data'][0x0][_0xe476('0x48')]===_0xe476('0x7c')){logger[_0xe476('0x3c')](_0xe476('0x7d'));return{'id':_0x51c9f1['data'][0x0][_0xe476('0x49')]['id']};}})['catch'](function(_0x2292e0){logger[_0xe476('0x3c')]('err',_0x2292e0['stack']);console[_0xe476('0x4b')]('err',_0x2292e0);});}exports[_0xe476('0x7e')]=function(_0x19b7f2,_0x12c089,_0x1a7cdb,_0x5d4205,_0x2b5918,_0x32ac51){var _0x21f2dd,_0x4dd5e4,_0x391138;_0x32ac51['host']=intUtil[_0xe476('0x7f')](_0x32ac51[_0xe476('0x80')]);_0x32ac51['serverUrl']=intUtil[_0xe476('0x7f')](_0x32ac51['serverUrl']);if(_0x2b5918&&_0x2b5918[_0xe476('0x81')]){logger[_0xe476('0x3c')]('[QUEUE]','Recording\x20is\x20enabled!');_0x12c089[_0xe476('0x82')]=_0x32ac51[_0xe476('0x83')]+_0xe476('0x84')+_0x12c089[_0xe476('0x85')]+_0xe476('0x86')+md5(_0x12c089['uniqueid']);}else{_0x12c089[_0xe476('0x82')]='';}var _0x95dfe9=_0x32ac51[_0xe476('0x80')]==='zoho.eu'?'eu':_0xe476('0x87');return getAccessToken(_0x32ac51)[_0xe476('0x2c')](function(_0x23ad68){_0x391138=_0x23ad68;return getUser(_0x391138,_0x95dfe9,_0x32ac51,_0x5d4205[_0xe476('0x37')]);})[_0xe476('0x2c')](function(_0x3bc492){_0x21f2dd=_0x3bc492;logger[_0xe476('0x3c')]('The\x20User\x20ID\x20is:',_0x21f2dd['id']);return getEndUser(_0x391138,_0x95dfe9,_0x32ac51,_0x12c089[_0xe476('0x88')],_0x12c089[_0xe476('0x89')],_0x21f2dd,_0x1a7cdb);})[_0xe476('0x2c')](function(_0x1c6efb){_0x4dd5e4=_0x1c6efb;return getCall(_0x391138,_0x95dfe9,_0x32ac51,_0x21f2dd,_0x4dd5e4,_0x1a7cdb,_0x12c089,_0xe476('0x79'));})[_0xe476('0x2c')](function(_0x3bac19){if(_0x3bac19){logger[_0xe476('0x3c')](_0xe476('0x8a'),_0x3bac19['id']);logger[_0xe476('0x3c')](_0xe476('0x8b'),_0xe476('0x8c'));emit(util[_0xe476('0x67')]('user:%s',_0x5d4205[_0xe476('0x1c')]),_0xe476('0x8d'),{'uri':_0xe476('0x8e')+_0x32ac51[_0xe476('0x80')]+_0xe476('0x8f')+_0x3bac19['id']});}})[_0xe476('0x40')](function(_0x5a0960){logger[_0xe476('0x2f')](_0xe476('0x8b'),JSON[_0xe476('0x10')](_0x5a0960));});};exports[_0xe476('0x90')]=function(_0x6a31ef,_0x4b5c93,_0x12fa67,_0x331e77,_0x54b78a,_0x12a9b1,_0x53a42a){var _0x5d70cd,_0x1290b8,_0x469b33;_0x12a9b1[_0xe476('0x80')]=intUtil[_0xe476('0x7f')](_0x12a9b1['host']);_0x12a9b1[_0xe476('0x83')]=intUtil[_0xe476('0x7f')](_0x12a9b1['serverUrl']);if(_0x53a42a&&_0x53a42a[_0xe476('0x91')]&&_0x53a42a[_0xe476('0x91')]!==_0xe476('0x92')){logger[_0xe476('0x3c')](_0xe476('0x93'),_0xe476('0x94'));_0x4b5c93[_0xe476('0x82')]=_0x12a9b1[_0xe476('0x83')]+_0xe476('0x84')+_0x4b5c93[_0xe476('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x4b5c93[_0xe476('0x85')]);}var _0x23a662=_0x12a9b1[_0xe476('0x80')]===_0xe476('0x95')?'eu':_0xe476('0x87');return getAccessToken(_0x12a9b1)[_0xe476('0x2c')](function(_0x549140){_0x469b33=_0x549140;return getUser(_0x469b33,_0x23a662,_0x12a9b1,_0x331e77[_0xe476('0x37')]);})[_0xe476('0x2c')](function(_0x49989f){_0x5d70cd=_0x49989f;logger['info'](_0xe476('0x96'),_0x5d70cd['id']);return getEndUser(_0x469b33,_0x23a662,_0x12a9b1,_0x4b5c93[_0xe476('0x97')],_0x4b5c93[_0xe476('0x98')],_0x5d70cd,_0x12fa67);})[_0xe476('0x2c')](function(_0x30f75b){_0x1290b8=_0x30f75b;return getCall(_0x469b33,_0x23a662,_0x12a9b1,_0x5d70cd,_0x1290b8,_0x12fa67,_0x4b5c93,_0xe476('0x99'));})[_0xe476('0x2c')](function(_0x55bc18){if(_0x55bc18){logger[_0xe476('0x3c')]('The\x20Call\x20ID\x20is:',_0x55bc18['id']);logger[_0xe476('0x3c')](_0xe476('0x93'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe476('0x67')](_0xe476('0x9a'),_0x331e77[_0xe476('0x1c')]),_0xe476('0x8d'),{'uri':_0xe476('0x8e')+_0x12a9b1[_0xe476('0x80')]+_0xe476('0x8f')+_0x55bc18['id']});}})[_0xe476('0x40')](function(_0x4c15bd){logger[_0xe476('0x2f')](_0xe476('0x93'),JSON['stringify'](_0x4c15bd));});};exports[_0xe476('0x9b')]=function(_0x4384ef,_0x506264,_0x422283,_0x2903c3,_0x143842,_0x227480){var _0x16e32d,_0x3bbea9,_0x3ed69e;_0x227480[_0xe476('0x80')]=intUtil[_0xe476('0x7f')](_0x227480[_0xe476('0x80')]);_0x227480[_0xe476('0x83')]=intUtil[_0xe476('0x7f')](_0x227480[_0xe476('0x83')]);if(_0x143842&&_0x143842['monitor_format']){logger[_0xe476('0x3c')]('['+_0x506264['lastevent'][_0xe476('0x9c')]()+']',_0xe476('0x94'));_0x506264[_0xe476('0x82')]=_0x227480[_0xe476('0x83')]+_0xe476('0x84')+_0x506264['uniqueid']+_0xe476('0x86')+md5(_0x506264[_0xe476('0x85')]);}else{_0x506264['recordingURL']='';}var _0x768e59=_0x227480[_0xe476('0x80')]===_0xe476('0x95')?'eu':_0xe476('0x87');return getAccessToken(_0x227480)['then'](function(_0xea349f){_0x3ed69e=_0xea349f;return getUser(_0x3ed69e,_0x768e59,_0x227480);})[_0xe476('0x2c')](function(_0x154a91){_0x16e32d=_0x154a91;logger[_0xe476('0x3c')](_0xe476('0x96'),_0x16e32d['id']);return getEndUser(_0x3ed69e,_0x768e59,_0x227480,_0x506264[_0xe476('0x88')],_0x506264[_0xe476('0x89')],_0x16e32d,_0x422283);})[_0xe476('0x2c')](function(_0x3ea84){_0x3bbea9=_0x3ea84;return getCall(_0x3ed69e,_0x768e59,_0x227480,_0x16e32d,_0x3bbea9,_0x422283,_0x506264,_0xe476('0x79'));})[_0xe476('0x2c')](function(_0x3d36c3){if(_0x3d36c3){logger[_0xe476('0x3c')]('The\x20Call\x20ID\x20is:',_0x3d36c3['id']);}})[_0xe476('0x40')](function(_0x55daec){logger[_0xe476('0x2f')]('['+_0x506264[_0xe476('0x6d')][_0xe476('0x9c')]()+']',JSON[_0xe476('0x10')](_0x55daec));});}; \ No newline at end of file +var _0x79f7=['merge','Fields','/crm/v2/Calls','code','Call\x20created!','details','stack','err','queue','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','request-promise','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','includes','content','toString','type','variableName','idField','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refresh_token','then','add','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','/crm/v2/','role','first_name','last_name','data','SUCCESS','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','administrator','Subjects','Description','getString','Descriptions','First_Name','Last_Name','Leads','Full_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound'];(function(_0x546ac7,_0x121704){var _0x368b11=function(_0x406349){while(--_0x406349){_0x546ac7['push'](_0x546ac7['shift']());}};_0x368b11(++_0x121704);}(_0x79f7,0xbb));var _0x779f=function(_0x3e7e17,_0x39822f){_0x3e7e17=_0x3e7e17-0x0;var _0x195697=_0x79f7[_0x3e7e17];return _0x195697;};'use strict';var _=require('lodash');var rp=require(_0x779f('0x0'));var md5=require(_0x779f('0x1'));var util=require(_0x779f('0x2'));var intUtil=require('./util');var moment=require(_0x779f('0x3'));var Redis=require(_0x779f('0x4'));var BPromise=require('bluebird');var config=require(_0x779f('0x5'));var logger=require(_0x779f('0x6'))(_0x779f('0x7'));config[_0x779f('0x8')]=_['defaults'](config[_0x779f('0x8')],{'host':_0x779f('0x9'),'port':0x18eb});var io=require(_0x779f('0xa'))(new Redis(config[_0x779f('0x8')]));function emit(_0x17a077,_0x36b403,_0x554ba0){io['to'](_0x17a077)[_0x779f('0xb')](_0x36b403,_0x554ba0);}function request(_0x2781cf){logger[_0x779f('0xc')](_0x779f('0xd'),JSON['stringify'](_0x2781cf));return rp(_0x2781cf);}function getCustomFields(_0x16c64a,_0xb6f201){var _0x1ee807={};if(_0x16c64a['length']>0x0){_['forEach'](_0x16c64a,function(_0x467e46){if(_[_0x779f('0xe')](['string','picklist'],_0x467e46['type'])&&_0x467e46['idField']){_0x1ee807[_0x467e46['idField']]=_0x467e46[_0x779f('0xf')][_0x779f('0x10')]();}else if(_0x467e46[_0x779f('0x11')]==='variable'&&_0x467e46[_0x779f('0x12')]&&_0x467e46[_0x779f('0x13')]&&_0xb6f201[_0x467e46[_0x779f('0x12')]]){_0x1ee807[_0x467e46[_0x779f('0x13')]]=_0xb6f201[_0x467e46[_0x779f('0x12')]][_0x779f('0x10')]();}else if(_0x467e46[_0x779f('0x11')]==='customVariable'&&_0x467e46[_0x779f('0x14')]&&_0x467e46[_0x779f('0x14')][_0x779f('0x15')]&&_0x467e46['idField']&&_0xb6f201[_0x467e46[_0x779f('0x14')][_0x779f('0x15')][_0x779f('0x16')]()]){_0x1ee807[_0x467e46[_0x779f('0x13')]]=_0xb6f201[_0x467e46[_0x779f('0x14')][_0x779f('0x15')][_0x779f('0x16')]()][_0x779f('0x10')]();}});}return _0x1ee807;}function getName(_0x42cff7){if(_0x42cff7[_0x779f('0x17')]('\x20')>0x0){var _0x4663fe=_0x42cff7['split'](/ (.+)/);if(_0x4663fe[0x1]){return _0x4663fe;}}return[_0x42cff7,_0x42cff7];}var accountsTokens={};function getAccessToken(_0x2e2d85){return new Promise(function(_0x3035c3,_0xb7cc40){if(!_[_0x779f('0x18')](accountsTokens[_0x2e2d85['id']])&&!_['isNil'](accountsTokens[_0x2e2d85['id']][_0x779f('0x19')])){if(moment()[_0x779f('0x1a')](accountsTokens[_0x2e2d85['id']][_0x779f('0x1b')])){_0x3035c3(accountsTokens[_0x2e2d85['id']][_0x779f('0x19')]);}}var _0xecb76a;switch(_0x2e2d85[_0x779f('0x1c')]){case'US':_0xecb76a='https://accounts.zoho.com';break;case'AU':_0xecb76a='https://accounts.zoho.com.au';break;case'EU':_0xecb76a=_0x779f('0x1d');break;case'IN':_0xecb76a=_0x779f('0x1e');break;case'CN':_0xecb76a=_0x779f('0x1f');break;default:_0xecb76a='https://accounts.zoho.eu';break;}var _0x55b149={'method':_0x779f('0x20'),'uri':_0xecb76a+'/oauth/v2/token','qs':{'refresh_token':_0x2e2d85['refreshToken'],'client_id':_0x2e2d85['clientId'],'client_secret':_0x2e2d85['clientSecret'],'grant_type':_0x779f('0x21')},'json':!![]};return rp(_0x55b149)[_0x779f('0x22')](function(_0x4bb45d){accountsTokens[_0x2e2d85['id']]={'access_token':_0x4bb45d['access_token'],'expires_in':moment()[_0x779f('0x23')](_0x4bb45d['expires_in'],'seconds')};_0x3035c3(_0x4bb45d[_0x779f('0x19')]);})['catch'](function(_0x165771){logger[_0x779f('0x24')](_0x779f('0x25'),_0x165771['stack']);_0xb7cc40(_0x165771);});});}function getUser(_0x56ecd7,_0x412778,_0x26516e,_0xc35171){logger[_0x779f('0x26')](_0x779f('0x27'));return request({'method':_0x779f('0x28'),'uri':util[_0x779f('0x29')](_0x779f('0x2a'),_0x412778),'qs':{'type':_0x779f('0x2b')},'headers':{'Authorization':_0x779f('0x2c')+_0x56ecd7},'json':!![]})[_0x779f('0x22')](function(_0xb819cc){if(_0xb819cc[_0x779f('0x2d')]){var _0x114471=-0x1;if(_[_0x779f('0x2e')](_0xb819cc[_0x779f('0x2d')])){if(!_['isNil'](_0xc35171)){_0x114471=_[_0x779f('0x2f')](_0xb819cc[_0x779f('0x2d')],function(_0x5595cf){return _0x5595cf[_0x779f('0x30')]===_0xc35171;});}if(_0x114471>=0x0){logger[_0x779f('0x26')](_0x779f('0x31'));}else{logger[_0x779f('0x26')](_0x779f('0x32'));_0x114471=_[_0x779f('0x2f')](_0xb819cc[_0x779f('0x2d')],function(_0x311ec1){return _0x311ec1[_0x779f('0x33')][_0x779f('0x15')]==='Administrator';});}return _0xb819cc['users'][_0x114471];}else{if(_0xb819cc[_0x779f('0x34')][_0x779f('0x33')][_0x779f('0x15')]===_0x779f('0x35')){logger[_0x779f('0x26')](_0x779f('0x32'));user=_0xb819cc['user'];return user;}else{logger[_0x779f('0x24')](_0x779f('0x36'),JSON[_0x779f('0x37')](_0xb819cc));throw new Error(_0x779f('0x38')+JSON[_0x779f('0x37')](_0xb819cc));}}}else{logger[_0x779f('0x24')](_0x779f('0x36'),JSON[_0x779f('0x37')](_0xb819cc));throw new Error(_0x779f('0x38')+JSON['stringify'](_0xb819cc));}})[_0x779f('0x39')](function(_0x15ad20){console[_0x779f('0x24')](_0x15ad20);});}function getZohoUser(_0xdeb013,_0x25a195){return new BPromise(function(_0x486407,_0x9f10da){request(_0xdeb013)[_0x779f('0x22')](function(_0x58a00e){var _0x9138fb=null;if(_0x58a00e){_0x9138fb=_0x58a00e['data'][0x0];_0x9138fb[_0x779f('0x3a')]=_0x25a195;}_0x486407(_0x9138fb);})[_0x779f('0x39')](function(_0x3db1bf){_0x9f10da(_0x3db1bf);});});}function createEndUser(_0x55228d,_0x148412,_0x58329a,_0x5d29d2,_0x2c1560,_0x18115e){var _0x58329a=getName(_0x58329a);return request({'method':_0x779f('0x20'),'uri':'https://www.zohoapis.'+_0x148412+_0x779f('0x3b')+_['startCase'](_0x18115e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x58329a[0x1],'First_Name':_0x58329a[0x0],'Phone':_0x5d29d2,'Owner':{'name':!_[_0x779f('0x18')](_0x2c1560[_0x779f('0x3c')][_0x779f('0x15')])?_0x2c1560[_0x779f('0x3c')]['name']:!_[_0x779f('0x18')](_0x2c1560[_0x779f('0x3d')])?_0x2c1560['first_name']+'\x20'+_0x2c1560[_0x779f('0x3e')]:_0x2c1560['last_name'],'id':_0x2c1560['id']}}]},'headers':{'Authorization':_0x779f('0x2c')+_0x55228d},'json':!![]})['then'](function(_0x23311a){if(_0x23311a&&_0x23311a[_0x779f('0x3f')][0x0]['code']===_0x779f('0x40')){var _0x2e87d8=_0x23311a[_0x779f('0x3f')][0x0]['details'];_0x2e87d8['enduserType']=_[_0x779f('0x41')](_0x18115e[_0x779f('0x42')])+'s';return _0x2e87d8;}logger[_0x779f('0x24')](_0x779f('0x36'),JSON[_0x779f('0x37')](data));throw new Error(_0x779f('0x43')+JSON[_0x779f('0x37')](data));})[_0x779f('0x39')](function(_0x24baad){console[_0x779f('0x44')](_0x779f('0x45'),_0x24baad);});}function getEndUser(_0x10a16e,_0x54e1a3,_0x59f612,_0x3a7ebc,_0x5b43bb,_0x38d00e,_0x266cb0){var _0x570d20={'method':_0x779f('0x28'),'uri':'','headers':{'Authorization':_0x779f('0x2c')+_0x10a16e},'json':!![]};switch(_0x266cb0[_0x779f('0x46')]){case _0x779f('0x47'):_0x570d20[_0x779f('0x48')]=_0x779f('0x49')+_0x54e1a3+_0x779f('0x4a')+_0x5b43bb+'))';return getZohoUser(_0x570d20,_0x779f('0x4b'))['then'](function(_0x4734c7){if(_0x4734c7)return _0x4734c7;_0x570d20[_0x779f('0x48')]='https://www.zohoapis.'+_0x54e1a3+_0x779f('0x4c')+_0x5b43bb+'))';return getZohoUser(_0x570d20,'Leads')[_0x779f('0x22')](function(_0x12666b){if(_0x12666b)return _0x12666b;if(_0x266cb0[_0x779f('0x42')]!=_0x779f('0x4d')){return createEndUser(_0x10a16e,_0x54e1a3,_0x3a7ebc,_0x5b43bb,_0x38d00e,_0x266cb0);}else{return{};}});});break;case _0x779f('0x4e'):_0x570d20['uri']=_0x779f('0x49')+_0x54e1a3+_0x779f('0x4a')+_0x5b43bb+'))';return getZohoUser(_0x570d20,_0x779f('0x4b'))[_0x779f('0x22')](function(_0x2179a8){if(_0x2179a8)return _0x2179a8;if(_0x266cb0[_0x779f('0x42')]!='nothing'){return createEndUser(_0x10a16e,_0x54e1a3,_0x3a7ebc,_0x5b43bb,_0x38d00e,_0x266cb0);}else{return{};}});break;case _0x779f('0x4f'):_0x570d20[_0x779f('0x48')]=_0x779f('0x49')+_0x54e1a3+_0x779f('0x4c')+_0x5b43bb+'))';return getZohoUser(_0x570d20,'Leads')[_0x779f('0x22')](function(_0x1ab052){if(_0x1ab052)return _0x1ab052;if(_0x266cb0[_0x779f('0x42')]!='nothing'){return createEndUser(_0x10a16e,_0x54e1a3,_0x3a7ebc,_0x5b43bb,_0x38d00e,_0x266cb0);}else{return{};}});break;}}function getCall(_0x1201da,_0x49c590,_0x3540a1,_0x4c3f39,_0x3a4697,_0x50bd25,_0x2fce02,_0x5a8fdc){logger[_0x779f('0x26')]('Creating\x20new\x20call...');var _0x446bb4={};_0x446bb4['Owner']={'name':!_[_0x779f('0x18')](_0x4c3f39[_0x779f('0x3c')][_0x779f('0x15')])&&!_[_0x779f('0x18')](_0x4c3f39['profile'][_0x779f('0x15')])&&_0x4c3f39['profile']['name']===_0x779f('0x50')?_0x4c3f39[_0x779f('0x3c')][_0x779f('0x15')]:!_[_0x779f('0x18')](_0x4c3f39[_0x779f('0x3d')])?_0x4c3f39[_0x779f('0x3d')]+'\x20'+_0x4c3f39[_0x779f('0x3e')]:_0x4c3f39[_0x779f('0x3e')],'id':_0x4c3f39['id']};_0x446bb4['Subject']=intUtil['getString'](_0x50bd25[_0x779f('0x51')],_0x2fce02,'\x20');_0x446bb4[_0x779f('0x52')]=intUtil[_0x779f('0x53')](_0x50bd25[_0x779f('0x54')],_0x2fce02,'\x0a');if(_0x3a4697[_0x779f('0x3a')]===_0x779f('0x4b')){_0x446bb4['Who_Id']={'name':!_[_0x779f('0x18')](_0x3a4697['Full_Name'])?_0x3a4697['Full_Name']:!_['isNil'](_0x3a4697[_0x779f('0x55')])?_0x3a4697['First_Name']+'\x20'+_0x3a4697[_0x779f('0x56')]:_0x3a4697[_0x779f('0x56')],'id':_0x3a4697['id']};}if(_0x3a4697[_0x779f('0x3a')]===_0x779f('0x57')){_0x446bb4['What_Id']={'name':!_['isNil'](_0x3a4697['Full_Name'])?_0x3a4697[_0x779f('0x58')]:!_[_0x779f('0x18')](_0x3a4697[_0x779f('0x55')])?_0x3a4697[_0x779f('0x55')]+'\x20'+_0x3a4697[_0x779f('0x56')]:_0x3a4697[_0x779f('0x56')],'id':_0x3a4697['id']};_0x446bb4[_0x779f('0x59')]=_[_0x779f('0x41')](_0x3a4697[_0x779f('0x3a')]);}if(_0x2fce02[_0x779f('0x5a')]){_0x446bb4[_0x779f('0x5b')]=moment[_0x779f('0x5c')](parseInt(_0x2fce02[_0x779f('0x5a')])*0x3e8)['format'](_0x779f('0x5d'));}else if(_0x2fce02[_0x779f('0x5e')]&&_0x2fce02[_0x779f('0x5f')]){_0x446bb4[_0x779f('0x5b')]=moment[_0x779f('0x5c')](moment(_0x2fce02[_0x779f('0x5f')],_0x779f('0x60'))[_0x779f('0x61')](moment(_0x2fce02['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x779f('0x29')](_0x779f('0x5d'));}switch(_0x2fce02[_0x779f('0x62')]){case _0x779f('0x63'):_0x446bb4['Call_Result']='Called';break;case'complete':case'connect':_0x446bb4[_0x779f('0x64')]='Answered';break;case _0x779f('0x65'):_0x446bb4[_0x779f('0x64')]='Rejected';break;case _0x779f('0x66'):_0x446bb4['Call_Result']='Abandoned';break;case _0x779f('0x67'):_0x446bb4[_0x779f('0x64')]=_0x779f('0x68');default:}_0x446bb4[_0x779f('0x69')]=(_0x5a8fdc===_0x779f('0x6a')?moment(_0x2fce02[_0x779f('0x6b')])[_0x779f('0x29')](_0x779f('0x60')):moment(_0x2fce02[_0x779f('0x6c')])[_0x779f('0x29')](_0x779f('0x60')))||moment()[_0x779f('0x29')]('YYYY-MM-DDTHH:mm:ss');_0x446bb4[_0x779f('0x6d')]=_0x5a8fdc||_0x779f('0x6e');_0x446bb4=_[_0x779f('0x6f')](_0x446bb4,getCustomFields(_0x50bd25[_0x779f('0x70')],_0x2fce02));return request({'method':_0x779f('0x20'),'uri':_0x779f('0x49')+_0x49c590+_0x779f('0x71'),'headers':{'Authorization':_0x779f('0x2c')+_0x1201da},'body':{'data':[_0x446bb4]},'json':!![]})[_0x779f('0x22')](function(_0x451f2f){if(_0x451f2f&&_0x451f2f[_0x779f('0x3f')][0x0][_0x779f('0x72')]===_0x779f('0x40')){logger['info'](_0x779f('0x73'));return{'id':_0x451f2f[_0x779f('0x3f')][0x0][_0x779f('0x74')]['id']};}})[_0x779f('0x39')](function(_0x1dc7c6){logger[_0x779f('0x26')]('err',_0x1dc7c6[_0x779f('0x75')]);console[_0x779f('0x44')](_0x779f('0x76'),_0x1dc7c6);});}exports[_0x779f('0x77')]=function(_0x1db09e,_0x4feb58,_0x32840d,_0x118dc5,_0x581388,_0x2072d3){var _0x349ae5,_0x2e3657,_0x41bb9f;_0x2072d3[_0x779f('0x78')]=intUtil['stripTrailingSlash'](_0x2072d3[_0x779f('0x78')]);_0x2072d3[_0x779f('0x79')]=intUtil['stripTrailingSlash'](_0x2072d3[_0x779f('0x79')]);if(_0x581388&&_0x581388[_0x779f('0x7a')]){logger[_0x779f('0x26')]('[QUEUE]',_0x779f('0x7b'));_0x4feb58[_0x779f('0x7c')]=_0x2072d3[_0x779f('0x79')]+_0x779f('0x7d')+_0x4feb58[_0x779f('0x7e')]+_0x779f('0x7f')+md5(_0x4feb58['uniqueid']);}else{_0x4feb58[_0x779f('0x7c')]='';}var _0x39cd08=_0x2072d3[_0x779f('0x78')]===_0x779f('0x80')?'eu':_0x779f('0x81');return getAccessToken(_0x2072d3)[_0x779f('0x22')](function(_0x2a3d90){_0x41bb9f=_0x2a3d90;return getUser(_0x41bb9f,_0x39cd08,_0x2072d3,_0x118dc5[_0x779f('0x30')]);})[_0x779f('0x22')](function(_0x1b2ef6){_0x349ae5=_0x1b2ef6;logger['info'](_0x779f('0x82'),_0x349ae5['id']);return getEndUser(_0x41bb9f,_0x39cd08,_0x2072d3,_0x4feb58[_0x779f('0x83')],_0x4feb58[_0x779f('0x84')],_0x349ae5,_0x32840d);})['then'](function(_0x3a99d7){_0x2e3657=_0x3a99d7;return getCall(_0x41bb9f,_0x39cd08,_0x2072d3,_0x349ae5,_0x2e3657,_0x32840d,_0x4feb58,_0x779f('0x6e'));})[_0x779f('0x22')](function(_0x5b40e1){if(_0x5b40e1){logger[_0x779f('0x26')](_0x779f('0x85'),_0x5b40e1['id']);logger['info'](_0x779f('0x86'),_0x779f('0x87'));emit(util[_0x779f('0x29')](_0x779f('0x88'),_0x118dc5['name']),_0x779f('0x89'),{'uri':_0x779f('0x8a')+_0x2072d3[_0x779f('0x78')]+_0x779f('0x8b')+_0x5b40e1['id']});}})[_0x779f('0x39')](function(_0x3d069e){logger[_0x779f('0x24')](_0x779f('0x86'),JSON[_0x779f('0x37')](_0x3d069e));});};exports[_0x779f('0x6a')]=function(_0x5198a1,_0x17d191,_0x1c405f,_0x2eb6dd,_0xf60eb8,_0x172357,_0x495e51){var _0x35588f,_0x532495,_0x13291a;_0x172357['host']=intUtil[_0x779f('0x8c')](_0x172357[_0x779f('0x78')]);_0x172357[_0x779f('0x79')]=intUtil[_0x779f('0x8c')](_0x172357[_0x779f('0x79')]);if(_0x495e51&&_0x495e51['recordingFormat']&&_0x495e51[_0x779f('0x8d')]!==_0x779f('0x8e')){logger[_0x779f('0x26')](_0x779f('0x8f'),_0x779f('0x7b'));_0x17d191['recordingURL']=_0x172357['serverUrl']+_0x779f('0x7d')+_0x17d191[_0x779f('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x17d191[_0x779f('0x7e')]);}var _0x350830=_0x172357[_0x779f('0x78')]===_0x779f('0x80')?'eu':'com';return getAccessToken(_0x172357)[_0x779f('0x22')](function(_0x1fe3d2){_0x13291a=_0x1fe3d2;return getUser(_0x13291a,_0x350830,_0x172357,_0x2eb6dd[_0x779f('0x30')]);})[_0x779f('0x22')](function(_0x560bc1){_0x35588f=_0x560bc1;logger[_0x779f('0x26')](_0x779f('0x82'),_0x35588f['id']);return getEndUser(_0x13291a,_0x350830,_0x172357,_0x17d191[_0x779f('0x90')],_0x17d191[_0x779f('0x91')],_0x35588f,_0x1c405f);})[_0x779f('0x22')](function(_0x14e79e){_0x532495=_0x14e79e;return getCall(_0x13291a,_0x350830,_0x172357,_0x35588f,_0x532495,_0x1c405f,_0x17d191,_0x779f('0x92'));})[_0x779f('0x22')](function(_0x45b28d){if(_0x45b28d){logger[_0x779f('0x26')](_0x779f('0x85'),_0x45b28d['id']);logger[_0x779f('0x26')](_0x779f('0x8f'),_0x779f('0x87'));emit(util['format'](_0x779f('0x88'),_0x2eb6dd['name']),'trigger:browser:url',{'uri':_0x779f('0x8a')+_0x172357[_0x779f('0x78')]+_0x779f('0x8b')+_0x45b28d['id']});}})[_0x779f('0x39')](function(_0x5a41aa){logger[_0x779f('0x24')](_0x779f('0x8f'),JSON[_0x779f('0x37')](_0x5a41aa));});};exports[_0x779f('0x93')]=function(_0xa9f265,_0x4b58d0,_0x450b19,_0x3751f4,_0x19f930,_0xa1ae8){var _0x39ed7c,_0x4f485,_0x2fb080;_0xa1ae8[_0x779f('0x78')]=intUtil['stripTrailingSlash'](_0xa1ae8[_0x779f('0x78')]);_0xa1ae8[_0x779f('0x79')]=intUtil[_0x779f('0x8c')](_0xa1ae8[_0x779f('0x79')]);if(_0x19f930&&_0x19f930[_0x779f('0x7a')]){logger[_0x779f('0x26')]('['+_0x4b58d0['lastevent'][_0x779f('0x94')]()+']',_0x779f('0x7b'));_0x4b58d0[_0x779f('0x7c')]=_0xa1ae8[_0x779f('0x79')]+_0x779f('0x7d')+_0x4b58d0[_0x779f('0x7e')]+_0x779f('0x7f')+md5(_0x4b58d0['uniqueid']);}else{_0x4b58d0[_0x779f('0x7c')]='';}var _0x2953cd=_0xa1ae8[_0x779f('0x78')]===_0x779f('0x80')?'eu':_0x779f('0x81');return getAccessToken(_0xa1ae8)[_0x779f('0x22')](function(_0x39a5e2){_0x2fb080=_0x39a5e2;return getUser(_0x2fb080,_0x2953cd,_0xa1ae8);})[_0x779f('0x22')](function(_0x3ac666){_0x39ed7c=_0x3ac666;logger[_0x779f('0x26')]('The\x20User\x20ID\x20is:',_0x39ed7c['id']);return getEndUser(_0x2fb080,_0x2953cd,_0xa1ae8,_0x4b58d0[_0x779f('0x83')],_0x4b58d0['calleridnum'],_0x39ed7c,_0x450b19);})[_0x779f('0x22')](function(_0x52d095){_0x4f485=_0x52d095;return getCall(_0x2fb080,_0x2953cd,_0xa1ae8,_0x39ed7c,_0x4f485,_0x450b19,_0x4b58d0,_0x779f('0x6e'));})[_0x779f('0x22')](function(_0x5e76e6){if(_0x5e76e6){logger[_0x779f('0x26')](_0x779f('0x85'),_0x5e76e6['id']);}})[_0x779f('0x39')](function(_0x3d344e){logger[_0x779f('0x24')]('['+_0x4b58d0['lastevent'][_0x779f('0x94')]()+']',JSON[_0x779f('0x37')](_0x3d344e));});}; \ 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 92bbaa9..e27c90e 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 _0xa0e5=['shelljs','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','util'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0xa0e5,0x86));var _0x5a0e=function(_0x211821,_0x274635){_0x211821=_0x211821-0x0;var _0x23f587=_0xa0e5[_0x211821];return _0x23f587;};'use strict';var util=require(_0x5a0e('0x0'));var sh=require(_0x5a0e('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports[_0x5a0e('0x2')]=function(_0x2d3f3e,_0x39d042){var _0x399c49=_0x2d3f3e[_0x5a0e('0x3')]?_0x2d3f3e['data2']:_0x5a0e('0x4');var _0x3145c2=_0x2d3f3e[_0x5a0e('0x5')]?Mustache['render'](_0x2d3f3e[_0x5a0e('0x5')],_0x39d042):_0x39d042;sh['exec'](_0x3145c2,function(_0x50452d,_0x315d5d,_0x42c0e5){if(_0x50452d!==0x0){logger['error'](util['format'](_0x5a0e('0x6'),_0x399c49,_0x3145c2,_0x50452d,_0x42c0e5));}else{logger[_0x5a0e('0x7')](util[_0x5a0e('0x8')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x399c49,_0x3145c2,_0x315d5d));}});}; \ No newline at end of file +var _0x55e3=['render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','../../../../config/logger','trigger','exec','data2','Script','data3'];(function(_0x25abe0,_0x31bfb9){var _0x5b1277=function(_0x4d3905){while(--_0x4d3905){_0x25abe0['push'](_0x25abe0['shift']());}};_0x5b1277(++_0x31bfb9);}(_0x55e3,0x199));var _0x355e=function(_0xdec64b,_0x284fe3){_0xdec64b=_0xdec64b-0x0;var _0x36f2f5=_0x55e3[_0xdec64b];return _0x36f2f5;};'use strict';var util=require(_0x355e('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x355e('0x1'))(_0x355e('0x2'));exports[_0x355e('0x3')]=function(_0xdfa5a7,_0x45f172){var _0x4c6a61=_0xdfa5a7['data2']?_0xdfa5a7[_0x355e('0x4')]:_0x355e('0x5');var _0x345d04=_0xdfa5a7[_0x355e('0x6')]?Mustache[_0x355e('0x7')](_0xdfa5a7[_0x355e('0x6')],_0x45f172):_0x45f172;sh[_0x355e('0x3')](_0x345d04,function(_0x4ca935,_0x434194,_0x40e67e){if(_0x4ca935!==0x0){logger[_0x355e('0x8')](util['format'](_0x355e('0x9'),_0x4c6a61,_0x345d04,_0x4ca935,_0x40e67e));}else{logger[_0x355e('0xa')](util[_0x355e('0xb')](_0x355e('0xc'),_0x4c6a61,_0x345d04,_0x434194));}});}; \ 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 59fc090..ce73a69 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 _0x8d7e=['isNil',',\x20request\x20body:\x20','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data2','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','number','data5','headers','data6','parse','stack','GET','POST','PUT','data7','body','error','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0x8d7e,0x1a7));var _0xe8d7=function(_0x19360a,_0x31c467){_0x19360a=_0x19360a-0x0;var _0x2681c6=_0x8d7e[_0x19360a];return _0x2681c6;};'use strict';var rp=require(_0xe8d7('0x0'));var util=require(_0xe8d7('0x1'));var _=require(_0xe8d7('0x2'));var Mustache=require(_0xe8d7('0x3'));var logger=require(_0xe8d7('0x4'))(_0xe8d7('0x5'));exports[_0xe8d7('0x6')]=function(_0x3c3263,_0x5158ca){var _0x51274a,_0x30e862;var _0x59722e={'method':_0x3c3263[_0xe8d7('0x7')][_0xe8d7('0x8')](),'uri':Mustache[_0xe8d7('0x9')](_0x3c3263['data2'],_0x5158ca),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3c3263['data5'])===_0xe8d7('0xa')&&parseInt(_0x3c3263[_0xe8d7('0xb')])>=0x1&&parseInt(_0x3c3263['data5'])<=0xa?parseInt(_0x3c3263['data5'])*0x3e8:0x5*0x3e8};try{_0x59722e[_0xe8d7('0xc')]=_0x3c3263[_0xe8d7('0xd')]?JSON[_0xe8d7('0xe')](Mustache[_0xe8d7('0x9')](_0x3c3263[_0xe8d7('0xd')],_0x5158ca)):{};}catch(_0x3f0e91){logger['error'](_0x3f0e91[_0xe8d7('0xf')]);}switch(_0x3c3263[_0xe8d7('0x7')][_0xe8d7('0x8')]()){case _0xe8d7('0x10'):case'DELETE':_0x51274a=null;_0x59722e['qs']=_0x5158ca;break;case _0xe8d7('0x11'):case _0xe8d7('0x12'):if(_0x3c3263[_0xe8d7('0x13')]){try{_0x51274a=JSON['parse'](Mustache[_0xe8d7('0x9')](_0x3c3263[_0xe8d7('0x13')],_0x5158ca));_0x59722e[_0xe8d7('0x14')]=_0x51274a;}catch(_0x1a088c){logger[_0xe8d7('0x15')](_0x1a088c[_0xe8d7('0xf')]);logger[_0xe8d7('0x15')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x51274a=_0x5158ca;_0x59722e['body']=_0x51274a;}break;}logger['info'](util[_0xe8d7('0x16')](_0xe8d7('0x17'),_0x3c3263[_0xe8d7('0x7')],_0x3c3263['data2'],JSON['stringify'](_0x59722e)));rp(_0x59722e)[_0xe8d7('0x18')](function(_0x2ca49e){_0x51274a=!_[_0xe8d7('0x19')](_0x51274a)?_0xe8d7('0x1a')+_0x51274a:'';_0x30e862=typeof _0x2ca49e[_0xe8d7('0x14')]==='object'?JSON[_0xe8d7('0x1b')](_0x2ca49e[_0xe8d7('0x14')]):_0x2ca49e['body'];logger['info'](util[_0xe8d7('0x16')](_0xe8d7('0x1c'),_0x3c3263[_0xe8d7('0x7')],_0x3c3263[_0xe8d7('0x1d')],_0x2ca49e[_0xe8d7('0x1e')],_0x30e862));})['catch'](function(_0x150dd0){logger['error'](util[_0xe8d7('0x16')](_0xe8d7('0x1f'),_0x3c3263['data1'],_0x3c3263['data2'],_0x150dd0[_0xe8d7('0x1e')],_0x150dd0['name'],_0x150dd0['message']));});}; \ No newline at end of file +var _0x1b05=['render','data2','data5','number','headers','data6','error','stack','data1','GET','DELETE','PUT','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','then',',\x20request\x20body:\x20','format','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b05,0x1d9));var _0x51b0=function(_0x1c46ac,_0x5aab38){_0x1c46ac=_0x1c46ac-0x0;var _0x3c2ed1=_0x1b05[_0x1c46ac];return _0x3c2ed1;};'use strict';var rp=require(_0x51b0('0x0'));var util=require(_0x51b0('0x1'));var _=require(_0x51b0('0x2'));var Mustache=require(_0x51b0('0x3'));var logger=require(_0x51b0('0x4'))(_0x51b0('0x5'));exports[_0x51b0('0x6')]=function(_0x28f1d0,_0x37c4d5){var _0x84183f,_0x16c773;var _0x12019c={'method':_0x28f1d0['data1']['toUpperCase'](),'uri':Mustache[_0x51b0('0x7')](_0x28f1d0[_0x51b0('0x8')],_0x37c4d5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x28f1d0[_0x51b0('0x9')])===_0x51b0('0xa')&&parseInt(_0x28f1d0[_0x51b0('0x9')])>=0x1&&parseInt(_0x28f1d0[_0x51b0('0x9')])<=0xa?parseInt(_0x28f1d0['data5'])*0x3e8:0x5*0x3e8};try{_0x12019c[_0x51b0('0xb')]=_0x28f1d0[_0x51b0('0xc')]?JSON['parse'](Mustache[_0x51b0('0x7')](_0x28f1d0[_0x51b0('0xc')],_0x37c4d5)):{};}catch(_0x314a3c){logger[_0x51b0('0xd')](_0x314a3c[_0x51b0('0xe')]);}switch(_0x28f1d0[_0x51b0('0xf')]['toUpperCase']()){case _0x51b0('0x10'):case _0x51b0('0x11'):_0x84183f=null;_0x12019c['qs']=_0x37c4d5;break;case'POST':case _0x51b0('0x12'):if(_0x28f1d0[_0x51b0('0x13')]){try{_0x84183f=JSON[_0x51b0('0x14')](Mustache[_0x51b0('0x7')](_0x28f1d0[_0x51b0('0x13')],_0x37c4d5));_0x12019c[_0x51b0('0x15')]=_0x84183f;}catch(_0x27ccdf){logger['error'](_0x27ccdf['stack']);logger[_0x51b0('0xd')](_0x51b0('0x16'));}}else{_0x84183f=_0x37c4d5;_0x12019c[_0x51b0('0x15')]=_0x84183f;}break;}logger[_0x51b0('0x17')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x28f1d0[_0x51b0('0xf')],_0x28f1d0['data2'],JSON['stringify'](_0x12019c)));rp(_0x12019c)[_0x51b0('0x18')](function(_0x39af73){_0x84183f=!_['isNil'](_0x84183f)?_0x51b0('0x19')+_0x84183f:'';_0x16c773=typeof _0x39af73['body']==='object'?JSON['stringify'](_0x39af73[_0x51b0('0x15')]):_0x39af73[_0x51b0('0x15')];logger[_0x51b0('0x17')](util[_0x51b0('0x1a')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x28f1d0[_0x51b0('0xf')],_0x28f1d0[_0x51b0('0x8')],_0x39af73['statusCode'],_0x16c773));})[_0x51b0('0x1b')](function(_0x28ec7e){logger['error'](util[_0x51b0('0x1a')](_0x51b0('0x1c'),_0x28f1d0[_0x51b0('0xf')],_0x28f1d0[_0x51b0('0x8')],_0x28ec7e['statusCode'],_0x28ec7e['name'],_0x28ec7e[_0x51b0('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 78bd1b7..0327854 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 _0x49b1=['debug','rpc','error','message','result','catch','jayson/promise','../../config/logger','routing','client','request','then'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x49b1,0x1da));var _0x149b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x49b1[_0x5b644e];return _0x49c6bf;};'use strict';var jayson=require(_0x149b('0x0'));var BPromise=require('bluebird');var logger=require(_0x149b('0x1'))(_0x149b('0x2'));var client=jayson[_0x149b('0x3')]['http']({'port':0x2329});client['Request']=function(_0x83e8f0,_0x17b871){return new BPromise(function(_0x1d2020,_0xae10d2){return client[_0x149b('0x4')](_0x83e8f0,_0x17b871)[_0x149b('0x5')](function(_0x4eb534){logger[_0x149b('0x6')](_0x149b('0x7'),_0x149b('0x2'),_0x83e8f0,_0x17b871,_0x4eb534);if(_0x4eb534[_0x149b('0x8')]){logger[_0x149b('0x8')]('rpc','routing',_0x83e8f0,_0x4eb534[_0x149b('0x8')][_0x149b('0x9')],_0x17b871);return _0xae10d2(_0x4eb534['error']['message']);}else{return _0x1d2020(_0x4eb534[_0x149b('0xa')]);}})[_0x149b('0xb')](function(_0x3f0cf7){logger[_0x149b('0x8')](_0x149b('0x7'),_0x149b('0x2'),_0x83e8f0,_0x3f0cf7,_0x17b871);return _0xae10d2(_0x3f0cf7);});});};module['exports']=client; \ No newline at end of file +var _0x3c58=['then','debug','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0x18ba3a,_0xf43859){var _0x1d3f1d=function(_0x14bbfb){while(--_0x14bbfb){_0x18ba3a['push'](_0x18ba3a['shift']());}};_0x1d3f1d(++_0xf43859);}(_0x3c58,0xcb));var _0x83c5=function(_0x4c4d78,_0x2eea21){_0x4c4d78=_0x4c4d78-0x0;var _0x22b768=_0x3c58[_0x4c4d78];return _0x22b768;};'use strict';var jayson=require(_0x83c5('0x0'));var BPromise=require(_0x83c5('0x1'));var logger=require(_0x83c5('0x2'))(_0x83c5('0x3'));var client=jayson[_0x83c5('0x4')][_0x83c5('0x5')]({'port':0x2329});client[_0x83c5('0x6')]=function(_0x37cf6f,_0x1a99b5){return new BPromise(function(_0x358aca,_0x1d5b2c){return client['request'](_0x37cf6f,_0x1a99b5)[_0x83c5('0x7')](function(_0x395390){logger[_0x83c5('0x8')](_0x83c5('0x9'),_0x83c5('0x3'),_0x37cf6f,_0x1a99b5,_0x395390);if(_0x395390[_0x83c5('0xa')]){logger['error'](_0x83c5('0x9'),'routing',_0x37cf6f,_0x395390[_0x83c5('0xa')][_0x83c5('0xb')],_0x1a99b5);return _0x1d5b2c(_0x395390[_0x83c5('0xa')][_0x83c5('0xb')]);}else{return _0x358aca(_0x395390[_0x83c5('0xc')]);}})['catch'](function(_0x26e12e){logger[_0x83c5('0xa')](_0x83c5('0x9'),_0x83c5('0x3'),_0x37cf6f,_0x26e12e,_0x1a99b5);return _0x1d5b2c(_0x26e12e);});});};module[_0x83c5('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 3a5bbfb..9998cfb 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 _0x862b=['../../config/logger','resolve','getMailAccounts','initMailAccounts','then','refresh','mailAccounts','listen','getSettings','catch','error','./server','./lib/email','./rpc/mailAccount','./rpc/setting'];(function(_0x4b3154,_0x3079ec){var _0xf575a1=function(_0x3a1a83){while(--_0x3a1a83){_0x4b3154['push'](_0x4b3154['shift']());}};_0xf575a1(++_0x3079ec);}(_0x862b,0x173));var _0xb862=function(_0x21cd90,_0x263396){_0x21cd90=_0x21cd90-0x0;var _0x360dd9=_0x862b[_0x21cd90];return _0x360dd9;};'use strict';var server=require(_0xb862('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xb862('0x1'));var mailAccount=require(_0xb862('0x2'));var setting=require(_0xb862('0x3'));var logger=require(_0xb862('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb862('0x5')]()['then'](mailAccount[_0xb862('0x6')]())['then'](realtime[_0xb862('0x7')]())[_0xb862('0x8')](function(){email[_0xb862('0x9')](realtime[_0xb862('0xa')]);return realtime;});}function main(){return server[_0xb862('0xb')](realtime,email)[_0xb862('0x8')](function(){return initRealtime();})[_0xb862('0x8')](function(){return setting[_0xb862('0xc')]();})[_0xb862('0x8')](function(_0x567b18){return setInterval(initRealtime,_0x567b18['loginMailFrequency']*0x3e8);})[_0xb862('0xd')](function(_0x2ab7b0){logger[_0xb862('0xe')]('Email\x20service\x20initialization',_0x2ab7b0);});}main(); \ No newline at end of file +var _0xccaa=['initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./rpc/mailAccount','email','getMailAccounts','then'];(function(_0x203ae4,_0x2d83c7){var _0x43af1e=function(_0x15cd6c){while(--_0x15cd6c){_0x203ae4['push'](_0x203ae4['shift']());}};_0x43af1e(++_0x2d83c7);}(_0xccaa,0x95));var _0xacca=function(_0xf7831f,_0x1c6188){_0xf7831f=_0xf7831f-0x0;var _0x3f88e7=_0xccaa[_0xf7831f];return _0x3f88e7;};'use strict';var server=require('./server');var Realtime=require(_0xacca('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xacca('0x1'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0xacca('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0xacca('0x3')]())[_0xacca('0x4')](realtime[_0xacca('0x5')]())['then'](function(){email[_0xacca('0x6')](realtime[_0xacca('0x7')]);return realtime;});}function main(){return server[_0xacca('0x8')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xacca('0x9')]();})['then'](function(_0x4447b6){return setInterval(initRealtime,_0x4447b6[_0xacca('0xa')]*0x3e8);})[_0xacca('0xb')](function(_0x6ebd30){logger[_0xacca('0xc')](_0xacca('0xd'),_0x6ebd30);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 951b046..33e4445 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 _0x7b28=['handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','catch','lastSync','sendMail','send','verifySmtp','Smtp','verify','exports','md5','../../../config/environment','../../../config/logger','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','service','provider','custom','hasOwnProperty','handleImapBox','bind','email','handleImapEmail','end'];(function(_0x4e11e7,_0x42d0b6){var _0x1d7d39=function(_0x416030){while(--_0x416030){_0x4e11e7['push'](_0x4e11e7['shift']());}};_0x1d7d39(++_0x42d0b6);}(_0x7b28,0x126));var _0x87b2=function(_0x172b8e,_0x54140c){_0x172b8e=_0x172b8e-0x0;var _0x41012b=_0x7b28[_0x172b8e];return _0x41012b;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x87b2('0x0'));var Redis=require('ioredis');var config=require(_0x87b2('0x1'));var logger=require(_0x87b2('0x2'))('email');config[_0x87b2('0x3')]=_[_0x87b2('0x4')](config[_0x87b2('0x3')],{'host':_0x87b2('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x87b2('0x3')]));var EmailImap=require(_0x87b2('0x6'));var EmailSmtp=require(_0x87b2('0x7'));var mailAccount=require(_0x87b2('0x8'));var md5Accounts={};function EmailChannel(_0x32dfe3){logger[_0x87b2('0x9')](_0x87b2('0xa'));this[_0x87b2('0xb')]=_0x32dfe3[_0x87b2('0xb')];this[_0x87b2('0xc')]={};this[_0x87b2('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0x87b2('0xe')]=function(_0x355626){var _0x305691=this[_0x87b2('0xb')][_0x355626];var _0x69a47b={'id':_0x305691['id'],'name':_0x305691[_0x87b2('0xf')],'key':_0x305691[_0x87b2('0x10')],'active':_0x305691[_0x87b2('0x11')],'Imap':{'status':_0x305691[_0x87b2('0x12')][_0x87b2('0x13')],'messageStatus':_0x305691[_0x87b2('0x12')][_0x87b2('0x14')],'total':_0x305691[_0x87b2('0x12')][_0x87b2('0x15')]}};if(_[_0x87b2('0x16')](md5Accounts[_0x355626])){md5Accounts[_0x355626]={};}var _0x2334a0=md5(JSON[_0x87b2('0x17')](_0x69a47b));if(md5Accounts[_0x355626][_0x87b2('0x0')]!==_0x2334a0){md5Accounts[_0x355626][_0x87b2('0x0')]=_0x2334a0;io['emit'](_0x87b2('0x18'),_0x69a47b);}};EmailChannel[_0x87b2('0x19')][_0x87b2('0x1a')]=function(_0x16904a){for(var _0x1e138a in _0x16904a){if(_0x16904a['hasOwnProperty'](_0x1e138a)){if(_0x16904a[_0x1e138a]['Imap']&&_0x16904a[_0x1e138a][_0x87b2('0x11')]){var _0x3727eb=_0x16904a[_0x1e138a][_0x87b2('0x12')];if(!_0x3727eb[_0x87b2('0x1b')]&&_0x16904a[_0x1e138a][_0x87b2('0x1c')]!==_0x87b2('0x1d'))_0x3727eb['service']=_0x16904a[_0x1e138a]['provider'];if(!this[_0x87b2('0xc')][_0x87b2('0x1e')](_0x3727eb['id'])){this[_0x87b2('0xc')][_0x3727eb['id']]=new EmailImap(_0x3727eb,_0x16904a[_0x1e138a]['email']);this['imapAccounts'][_0x3727eb['id']]['on']('box',this[_0x87b2('0x1f')][_0x87b2('0x20')](this,_0x1e138a));this[_0x87b2('0xc')][_0x3727eb['id']]['on'](_0x87b2('0x21'),this[_0x87b2('0x22')][_0x87b2('0x20')](this,_0x1e138a));this[_0x87b2('0xc')][_0x3727eb['id']]['on'](_0x87b2('0x23'),this[_0x87b2('0x24')][_0x87b2('0x20')](this,_0x1e138a));this[_0x87b2('0xc')][_0x3727eb['id']]['on'](_0x87b2('0x25'),this[_0x87b2('0x26')][_0x87b2('0x20')](this,_0x1e138a));}}else{if(_[_0x87b2('0x16')](this[_0x87b2('0xb')][_0x1e138a][_0x87b2('0x12')])){this[_0x87b2('0xb')][_0x1e138a][_0x87b2('0x12')]={};}this[_0x87b2('0xb')][_0x1e138a][_0x87b2('0x12')][_0x87b2('0x13')]=_0x87b2('0x27');this['mailAccounts'][_0x1e138a][_0x87b2('0x12')][_0x87b2('0x14')]='';this[_0x87b2('0xe')](_0x1e138a);}}}};EmailChannel[_0x87b2('0x19')][_0x87b2('0x1f')]=function(_0x520cb7,_0x41cdb1){if(this['mailAccounts'][_0x520cb7]){this[_0x87b2('0xb')][_0x520cb7][_0x87b2('0x12')][_0x87b2('0x13')]=_0x87b2('0x28');this[_0x87b2('0xb')][_0x520cb7][_0x87b2('0x12')][_0x87b2('0x14')]=_0x41cdb1[_0x87b2('0xf')];if(_0x41cdb1[_0x87b2('0x29')]){this[_0x87b2('0xb')][_0x520cb7][_0x87b2('0x12')][_0x87b2('0x15')]=_0x41cdb1[_0x87b2('0x29')][_0x87b2('0x15')];}return this[_0x87b2('0xe')](_0x520cb7);}};EmailChannel[_0x87b2('0x19')][_0x87b2('0x22')]=function(_0x16cf80,_0x18d0a7){logger[_0x87b2('0x9')](_0x87b2('0x2a'),_0x18d0a7['firstName'],_0x18d0a7[_0x87b2('0x2b')],_0x18d0a7[_0x87b2('0x2c')],_0x16cf80);if(this[_0x87b2('0xb')][_0x16cf80]){return mailAccount[_0x87b2('0x2d')](_0x16cf80,_0x18d0a7)[_0x87b2('0x2e')](function(_0xf59802){if(_0xf59802){logger[_0x87b2('0x9')]('Mail\x20accepted\x20from\x20routing');}})[_0x87b2('0x2f')](function(_0x2cd5e7){logger[_0x87b2('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x87b2('0x17')](_0x2cd5e7));});}};EmailChannel[_0x87b2('0x19')][_0x87b2('0x24')]=function(_0x271536){if(this['mailAccounts'][_0x271536]&&this['mailAccounts'][_0x271536]['Imap']){if(this[_0x87b2('0xc')][this[_0x87b2('0xb')][_0x271536]['Imap']['id']]){delete this[_0x87b2('0xc')][this['mailAccounts'][_0x271536]['Imap']['id']];}this[_0x87b2('0xb')][_0x271536]['Imap'][_0x87b2('0x30')]=moment();this[_0x87b2('0xe')](_0x271536);}};EmailChannel[_0x87b2('0x19')][_0x87b2('0x26')]=function(_0x4dd3c3,_0x1c8c78){if(this['mailAccounts'][_0x4dd3c3]){this['mailAccounts'][_0x4dd3c3][_0x87b2('0x12')]['status']=_0x87b2('0x25');this[_0x87b2('0xb')][_0x4dd3c3]['Imap']['messageStatus']=_0x1c8c78;return this[_0x87b2('0xe')](_0x4dd3c3);}};EmailChannel[_0x87b2('0x19')][_0x87b2('0x31')]=function(_0x27c467,_0x5afdfb){return this[_0x87b2('0xd')][_0x87b2('0x32')](_0x27c467,_0x5afdfb);};EmailChannel[_0x87b2('0x19')][_0x87b2('0x33')]=function(_0x583197){var _0x4817c7=this;if(this[_0x87b2('0xb')][_0x583197['id']]){if(_['isNil'](this[_0x87b2('0xb')][_0x583197['id']][_0x87b2('0x34')])){this['mailAccounts'][_0x583197['id']][_0x87b2('0x34')]={};}this[_0x87b2('0xb')][_0x583197['id']][_0x87b2('0x34')][_0x87b2('0x30')]=moment();return new BPromise(function(_0x273abf,_0xe0e209){return _0x4817c7[_0x87b2('0xd')][_0x87b2('0x35')](_0x583197)[_0x87b2('0x2e')](function(_0x25369d){_0x4817c7[_0x87b2('0xb')][_0x583197['id']][_0x87b2('0x34')]['status']='verified';_0x4817c7[_0x87b2('0xb')][_0x583197['id']][_0x87b2('0x34')][_0x87b2('0x14')]='';_0x4817c7[_0x87b2('0xe')](_0x583197['id']);_0x273abf(_0x25369d);})['catch'](function(_0x4ceee0){_0x4817c7[_0x87b2('0xb')][_0x583197['id']][_0x87b2('0x34')][_0x87b2('0x13')]=_0x87b2('0x25');_0x4817c7[_0x87b2('0xb')][_0x583197['id']][_0x87b2('0x34')][_0x87b2('0x14')]=_0x4ceee0;_0x4817c7[_0x87b2('0xe')](_0x583197['id']);_0xe0e209(_0x4ceee0);});});}return this['smtp']['verify'](_0x583197);};module[_0x87b2('0x36')]=EmailChannel; \ No newline at end of file +var _0xa772=['handleImapBox','bind','handleImapEmail','end','handleImapEnd','connected','messages','firstName','from','notify','then','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','smtp','send','Smtp','lastSync','verify','verified','bluebird','md5','../../../config/logger','email','redis','defaults','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','name','key','Imap','status','messageStatus','total','isNil','stringify','emit','mailAccount:update','refresh','hasOwnProperty','active','service','provider','box'];(function(_0x287d08,_0x55ab1e){var _0x3e7834=function(_0x3cada6){while(--_0x3cada6){_0x287d08['push'](_0x287d08['shift']());}};_0x3e7834(++_0x55ab1e);}(_0xa772,0x114));var _0x2a77=function(_0x2417f9,_0x803ba4){_0x2417f9=_0x2417f9-0x0;var _0x142d82=_0xa772[_0x2417f9];return _0x142d82;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x2a77('0x0'));var md5=require(_0x2a77('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x2a77('0x2'))(_0x2a77('0x3'));config[_0x2a77('0x4')]=_[_0x2a77('0x5')](config[_0x2a77('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x2a77('0x6'))(new Redis(config[_0x2a77('0x4')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x2a77('0x7'));var mailAccount=require(_0x2a77('0x8'));var md5Accounts={};function EmailChannel(_0x20f56d){logger[_0x2a77('0x9')](_0x2a77('0xa'));this[_0x2a77('0xb')]=_0x20f56d[_0x2a77('0xb')];this[_0x2a77('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x2a77('0xd')]['emit']=function(_0x46eac2){var _0xe01d33=this[_0x2a77('0xb')][_0x46eac2];var _0x147328={'id':_0xe01d33['id'],'name':_0xe01d33[_0x2a77('0xe')],'key':_0xe01d33[_0x2a77('0xf')],'active':_0xe01d33['active'],'Imap':{'status':_0xe01d33[_0x2a77('0x10')][_0x2a77('0x11')],'messageStatus':_0xe01d33['Imap'][_0x2a77('0x12')],'total':_0xe01d33[_0x2a77('0x10')][_0x2a77('0x13')]}};if(_[_0x2a77('0x14')](md5Accounts[_0x46eac2])){md5Accounts[_0x46eac2]={};}var _0xb980b6=md5(JSON[_0x2a77('0x15')](_0x147328));if(md5Accounts[_0x46eac2][_0x2a77('0x1')]!==_0xb980b6){md5Accounts[_0x46eac2][_0x2a77('0x1')]=_0xb980b6;io[_0x2a77('0x16')](_0x2a77('0x17'),_0x147328);}};EmailChannel['prototype'][_0x2a77('0x18')]=function(_0x12c688){for(var _0x252cc0 in _0x12c688){if(_0x12c688[_0x2a77('0x19')](_0x252cc0)){if(_0x12c688[_0x252cc0]['Imap']&&_0x12c688[_0x252cc0][_0x2a77('0x1a')]){var _0x192c57=_0x12c688[_0x252cc0]['Imap'];if(!_0x192c57[_0x2a77('0x1b')]&&_0x12c688[_0x252cc0][_0x2a77('0x1c')]!=='custom')_0x192c57[_0x2a77('0x1b')]=_0x12c688[_0x252cc0]['provider'];if(!this['imapAccounts'][_0x2a77('0x19')](_0x192c57['id'])){this[_0x2a77('0xc')][_0x192c57['id']]=new EmailImap(_0x192c57,_0x12c688[_0x252cc0][_0x2a77('0x3')]);this['imapAccounts'][_0x192c57['id']]['on'](_0x2a77('0x1d'),this[_0x2a77('0x1e')][_0x2a77('0x1f')](this,_0x252cc0));this[_0x2a77('0xc')][_0x192c57['id']]['on'](_0x2a77('0x3'),this[_0x2a77('0x20')][_0x2a77('0x1f')](this,_0x252cc0));this[_0x2a77('0xc')][_0x192c57['id']]['on'](_0x2a77('0x21'),this[_0x2a77('0x22')][_0x2a77('0x1f')](this,_0x252cc0));this['imapAccounts'][_0x192c57['id']]['on']('error',this['handleImapError'][_0x2a77('0x1f')](this,_0x252cc0));}}else{if(_[_0x2a77('0x14')](this['mailAccounts'][_0x252cc0][_0x2a77('0x10')])){this['mailAccounts'][_0x252cc0]['Imap']={};}this['mailAccounts'][_0x252cc0][_0x2a77('0x10')]['status']='disabled';this[_0x2a77('0xb')][_0x252cc0][_0x2a77('0x10')][_0x2a77('0x12')]='';this[_0x2a77('0x16')](_0x252cc0);}}}};EmailChannel[_0x2a77('0xd')][_0x2a77('0x1e')]=function(_0x1e4624,_0x52029d){if(this[_0x2a77('0xb')][_0x1e4624]){this['mailAccounts'][_0x1e4624]['Imap'][_0x2a77('0x11')]=_0x2a77('0x23');this[_0x2a77('0xb')][_0x1e4624]['Imap'][_0x2a77('0x12')]=_0x52029d[_0x2a77('0xe')];if(_0x52029d[_0x2a77('0x24')]){this['mailAccounts'][_0x1e4624][_0x2a77('0x10')][_0x2a77('0x13')]=_0x52029d['messages'][_0x2a77('0x13')];}return this['emit'](_0x1e4624);}};EmailChannel[_0x2a77('0xd')][_0x2a77('0x20')]=function(_0x46d46a,_0x2c1da5){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x2c1da5[_0x2a77('0x25')],_0x2c1da5['lastName'],_0x2c1da5[_0x2a77('0x26')],_0x46d46a);if(this[_0x2a77('0xb')][_0x46d46a]){return mailAccount[_0x2a77('0x27')](_0x46d46a,_0x2c1da5)[_0x2a77('0x28')](function(_0x744a4c){if(_0x744a4c){logger[_0x2a77('0x9')]('Mail\x20accepted\x20from\x20routing');}})[_0x2a77('0x29')](function(_0x3bf261){logger[_0x2a77('0x2a')](_0x2a77('0x2b'),JSON[_0x2a77('0x15')](_0x3bf261));});}};EmailChannel[_0x2a77('0xd')][_0x2a77('0x22')]=function(_0x4dc534){if(this[_0x2a77('0xb')][_0x4dc534]&&this[_0x2a77('0xb')][_0x4dc534][_0x2a77('0x10')]){if(this[_0x2a77('0xc')][this[_0x2a77('0xb')][_0x4dc534][_0x2a77('0x10')]['id']]){delete this[_0x2a77('0xc')][this[_0x2a77('0xb')][_0x4dc534][_0x2a77('0x10')]['id']];}this[_0x2a77('0xb')][_0x4dc534][_0x2a77('0x10')]['lastSync']=moment();this[_0x2a77('0x16')](_0x4dc534);}};EmailChannel[_0x2a77('0xd')]['handleImapError']=function(_0x349ba8,_0x395ad0){if(this[_0x2a77('0xb')][_0x349ba8]){this[_0x2a77('0xb')][_0x349ba8][_0x2a77('0x10')][_0x2a77('0x11')]=_0x2a77('0x2a');this[_0x2a77('0xb')][_0x349ba8][_0x2a77('0x10')]['messageStatus']=_0x395ad0;return this['emit'](_0x349ba8);}};EmailChannel[_0x2a77('0xd')][_0x2a77('0x2c')]=function(_0x340b1a,_0x5b85aa){return this[_0x2a77('0x2d')][_0x2a77('0x2e')](_0x340b1a,_0x5b85aa);};EmailChannel[_0x2a77('0xd')]['verifySmtp']=function(_0x45edb4){var _0x2da762=this;if(this[_0x2a77('0xb')][_0x45edb4['id']]){if(_['isNil'](this[_0x2a77('0xb')][_0x45edb4['id']]['Smtp'])){this[_0x2a77('0xb')][_0x45edb4['id']][_0x2a77('0x2f')]={};}this[_0x2a77('0xb')][_0x45edb4['id']][_0x2a77('0x2f')][_0x2a77('0x30')]=moment();return new BPromise(function(_0x43d98c,_0xd1596f){return _0x2da762[_0x2a77('0x2d')][_0x2a77('0x31')](_0x45edb4)['then'](function(_0x28a91f){_0x2da762['mailAccounts'][_0x45edb4['id']][_0x2a77('0x2f')][_0x2a77('0x11')]=_0x2a77('0x32');_0x2da762[_0x2a77('0xb')][_0x45edb4['id']][_0x2a77('0x2f')][_0x2a77('0x12')]='';_0x2da762['emit'](_0x45edb4['id']);_0x43d98c(_0x28a91f);})['catch'](function(_0x2417b1){_0x2da762[_0x2a77('0xb')][_0x45edb4['id']]['Smtp'][_0x2a77('0x11')]=_0x2a77('0x2a');_0x2da762['mailAccounts'][_0x45edb4['id']][_0x2a77('0x2f')][_0x2a77('0x12')]=_0x2417b1;_0x2da762[_0x2a77('0x16')](_0x45edb4['id']);_0xd1596f(_0x2417b1);});});}return this[_0x2a77('0x2d')][_0x2a77('0x31')](_0x45edb4);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 7d51c41..77b17a6 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 _0x83d0=['mailparser','simpleParser','iconv','events','../../../config/logger','email','mailbox','getAccount','account','once','ready','handleReady','bind','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','required','openBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap'];(function(_0x99e08b,_0x55bb81){var _0x4f7bb9=function(_0x360659){while(--_0x360659){_0x99e08b['push'](_0x99e08b['shift']());}};_0x4f7bb9(++_0x55bb81);}(_0x83d0,0xb7));var _0x083d=function(_0x1874d2,_0x22e634){_0x1874d2=_0x1874d2-0x0;var _0x4986cf=_0x83d0[_0x1874d2];return _0x4986cf;};'use strict';var _=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var Imap=require(_0x083d('0x2'));var simpleParser=require(_0x083d('0x3'))[_0x083d('0x4')];var Iconv=require(_0x083d('0x5'))['Iconv'];var EventEmitter=require(_0x083d('0x6'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x083d('0x7'))(_0x083d('0x8'));function EmailImap(_0x3c4b8c,_0x2e75e8){this[_0x083d('0x9')]='INBOX';this['account']=this[_0x083d('0xa')](_0x3c4b8c,_0x2e75e8);this[_0x083d('0x2')]=new Imap(this[_0x083d('0xb')]);this['imap'][_0x083d('0xc')](_0x083d('0xd'),this[_0x083d('0xe')][_0x083d('0xf')](this));this['imap'][_0x083d('0xc')]('end',this[_0x083d('0x10')][_0x083d('0xf')](this));this['imap']['on'](_0x083d('0x11'),this[_0x083d('0x12')][_0x083d('0xf')](this));this[_0x083d('0x2')][_0x083d('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x083d('0x14')][_0x083d('0xa')]=function(_0x4ee93c,_0x11c03f){var _0x525a36={'connTimeout':_0x4ee93c['connTimeout']?_0x4ee93c[_0x083d('0x15')]*0x3e8:0x2710,'authTimeout':_0x4ee93c[_0x083d('0x16')]?_0x4ee93c[_0x083d('0x16')]*0x3e8:0x1388};if(_0x4ee93c[_0x083d('0x17')]){_0x525a36[_0x083d('0x18')]=_0x4ee93c['user'];_0x525a36[_0x083d('0x8')]=_0x11c03f||_0x4ee93c['user']||_0x083d('0x19');if(_0x4ee93c[_0x083d('0x1a')]){_0x525a36[_0x083d('0x1b')]=utils[_0x083d('0x1c')](_0x4ee93c[_0x083d('0x1d')][_0x083d('0x1e')],_0x4ee93c[_0x083d('0x18')]);}else{_0x525a36[_0x083d('0x1f')]=_0x4ee93c[_0x083d('0x1f')];}}else{if(_0x4ee93c[_0x083d('0x20')]){_0x525a36[_0x083d('0x18')]=_0x4ee93c[_0x083d('0x18')];_0x525a36['password']=_0x4ee93c[_0x083d('0x1f')];}}_0x525a36['host']=_0x4ee93c[_0x083d('0x21')];_0x525a36[_0x083d('0x22')]=_0x4ee93c['port']||0x3e1;if(_0x4ee93c[_0x083d('0x23')]){_0x525a36['tls']=!![];}else{_0x525a36['tls']=![];_0x525a36['autotls']=_0x083d('0x24');}return _0x525a36;};EmailImap[_0x083d('0x14')][_0x083d('0xe')]=function(){this[_0x083d('0x2')][_0x083d('0x25')](this[_0x083d('0x9')],![],this['handleOpenBox'][_0x083d('0xf')](this));};EmailImap[_0x083d('0x14')]['handleOpenBox']=function(_0x3a0ce2,_0x38ca23){if(_0x3a0ce2){this[_0x083d('0x12')](_0x3a0ce2,!![]);}else{this[_0x083d('0x26')](_0x083d('0x27'),_0x38ca23);this[_0x083d('0x28')]();}};EmailImap[_0x083d('0x14')][_0x083d('0x29')]=function(_0x552bc9){if(_0x552bc9){this[_0x083d('0x12')](_0x552bc9,!![]);}else{this['imap'][_0x083d('0x2a')]();}};EmailImap[_0x083d('0x14')][_0x083d('0x28')]=function(){this[_0x083d('0x2')][_0x083d('0x2b')]([_0x083d('0x2c')],this[_0x083d('0x2d')][_0x083d('0xf')](this));};EmailImap[_0x083d('0x14')][_0x083d('0x2d')]=function(_0x2d9202,_0x24c32c){if(_0x2d9202){this[_0x083d('0x12')](_0x2d9202,!![]);}else{if(_0x24c32c[_0x083d('0x2e')]){try{var _0x28b90e=this['imap'][_0x083d('0x2f')](_0x24c32c,{'bodies':'','markSeen':!![]});_0x28b90e['on'](_0x083d('0x30'),this['handleFetchMessage']['bind'](this));_0x28b90e[_0x083d('0xc')]('error',this[_0x083d('0x31')]['bind'](this));_0x28b90e[_0x083d('0xc')]('end',this[_0x083d('0x32')][_0x083d('0xf')](this));}catch(_0x3ab8cd){logger['error'](_0x3ab8cd);}}else{this['imap'][_0x083d('0x33')](!![],this['handleCloseBox'][_0x083d('0xf')](this));}}};EmailImap[_0x083d('0x14')][_0x083d('0x34')]=function(_0x3065c7){_0x3065c7['on']('body',this[_0x083d('0x35')][_0x083d('0xf')](this));_0x3065c7[_0x083d('0xc')](_0x083d('0x36'),this['handleMessageAttributes'][_0x083d('0xf')](this));_0x3065c7[_0x083d('0xc')](_0x083d('0x2a'),this[_0x083d('0x37')]['bind'](this));};EmailImap['prototype'][_0x083d('0x35')]=function(_0x7ae2c4){simpleParser(_0x7ae2c4,{'Iconv':Iconv},this[_0x083d('0x38')][_0x083d('0xf')](this));};EmailImap[_0x083d('0x14')]['handleMessageAttributes']=function(){};EmailImap[_0x083d('0x14')][_0x083d('0x37')]=function(){};EmailImap['prototype'][_0x083d('0x38')]=function(_0x5d00dc,_0x58c1a0){if(_0x5d00dc){logger[_0x083d('0x11')](_0x5d00dc);}else{var _0x3645f3=this;utils['parser'](this[_0x083d('0xb')],_0x58c1a0,function(_0x1b282f){_0x3645f3[_0x083d('0x26')]('email',_0x1b282f);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap'][_0x083d('0x33')](!![],this[_0x083d('0x29')][_0x083d('0xf')](this));};EmailImap[_0x083d('0x14')]['handleFetchError']=function(_0x5ad9f2){this[_0x083d('0x12')](_0x5ad9f2);this['imap'][_0x083d('0x33')](!![],this[_0x083d('0x29')][_0x083d('0xf')](this));};EmailImap[_0x083d('0x14')][_0x083d('0x10')]=function(){this[_0x083d('0x26')](_0x083d('0x2a'));};EmailImap[_0x083d('0x14')]['handleError']=function(_0x38de47,_0x3e6604){logger[_0x083d('0x11')](_0x083d('0x12'),this[_0x083d('0xb')][_0x083d('0x8')],JSON[_0x083d('0x39')](_0x38de47));var _0x56fb85='';if(_0x38de47){if(_0x38de47[_0x083d('0x3a')]){_0x56fb85=_0x38de47[_0x083d('0x3a')];}else{for(var _0x5656ea in _0x38de47){if(_0x38de47[_0x083d('0x3b')](_0x5656ea)){_0x56fb85+=_[_0x083d('0x3c')](_0x5656ea)+':\x20'+_0x38de47[_0x5656ea]+'\x0a';}}}}if(_0x3e6604){this[_0x083d('0x2')][_0x083d('0x2a')]();}else{this[_0x083d('0x26')]('error',_0x56fb85);this[_0x083d('0x26')](_0x083d('0x2a'));}};module[_0x083d('0x3d')]=EmailImap; \ No newline at end of file +var _0xc359=['attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','stringify','textCode','hasOwnProperty','exports','util','mailparser','simpleParser','iconv','events','./utils','email','account','getAccount','imap','once','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','host','port','tls','autotls','required','mailbox','handleOpenBox','readUnseen','handleCloseBox','end','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageBody'];(function(_0x3c5cc8,_0x336027){var _0x44675c=function(_0xf9543e){while(--_0xf9543e){_0x3c5cc8['push'](_0x3c5cc8['shift']());}};_0x44675c(++_0x336027);}(_0xc359,0x1d9));var _0x9c35=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0xc359[_0x5581ba];return _0x1e927f;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var Imap=require('imap');var simpleParser=require(_0x9c35('0x1'))[_0x9c35('0x2')];var Iconv=require(_0x9c35('0x3'))['Iconv'];var EventEmitter=require(_0x9c35('0x4'))['EventEmitter'];var utils=require(_0x9c35('0x5'));var logger=require('../../../config/logger')(_0x9c35('0x6'));function EmailImap(_0x5b3ada,_0x490409){this['mailbox']='INBOX';this[_0x9c35('0x7')]=this[_0x9c35('0x8')](_0x5b3ada,_0x490409);this[_0x9c35('0x9')]=new Imap(this[_0x9c35('0x7')]);this[_0x9c35('0x9')][_0x9c35('0xa')]('ready',this[_0x9c35('0xb')][_0x9c35('0xc')](this));this['imap']['once']('end',this[_0x9c35('0xd')]['bind'](this));this[_0x9c35('0x9')]['on'](_0x9c35('0xe'),this[_0x9c35('0xf')]['bind'](this));this[_0x9c35('0x9')][_0x9c35('0x10')]();}util[_0x9c35('0x11')](EmailImap,EventEmitter);EmailImap[_0x9c35('0x12')][_0x9c35('0x8')]=function(_0x4cc2ca,_0x280758){var _0x4470df={'connTimeout':_0x4cc2ca[_0x9c35('0x13')]?_0x4cc2ca[_0x9c35('0x13')]*0x3e8:0x2710,'authTimeout':_0x4cc2ca[_0x9c35('0x14')]?_0x4cc2ca[_0x9c35('0x14')]*0x3e8:0x1388};if(_0x4cc2ca[_0x9c35('0x15')]){_0x4470df[_0x9c35('0x16')]=_0x4cc2ca[_0x9c35('0x16')];_0x4470df[_0x9c35('0x6')]=_0x280758||_0x4cc2ca[_0x9c35('0x16')]||_0x9c35('0x17');if(_0x4cc2ca[_0x9c35('0x18')]){_0x4470df[_0x9c35('0x19')]=utils[_0x9c35('0x1a')](_0x4cc2ca['CloudProvider'][_0x9c35('0x1b')],_0x4cc2ca[_0x9c35('0x16')]);}else{_0x4470df[_0x9c35('0x1c')]=_0x4cc2ca[_0x9c35('0x1c')];}}else{if(_0x4cc2ca['authentication']){_0x4470df[_0x9c35('0x16')]=_0x4cc2ca[_0x9c35('0x16')];_0x4470df[_0x9c35('0x1c')]=_0x4cc2ca[_0x9c35('0x1c')];}}_0x4470df[_0x9c35('0x1d')]=_0x4cc2ca['host'];_0x4470df[_0x9c35('0x1e')]=_0x4cc2ca['port']||0x3e1;if(_0x4cc2ca[_0x9c35('0x1f')]){_0x4470df[_0x9c35('0x1f')]=!![];}else{_0x4470df[_0x9c35('0x1f')]=![];_0x4470df[_0x9c35('0x20')]=_0x9c35('0x21');}return _0x4470df;};EmailImap[_0x9c35('0x12')][_0x9c35('0xb')]=function(){this['imap']['openBox'](this[_0x9c35('0x22')],![],this[_0x9c35('0x23')][_0x9c35('0xc')](this));};EmailImap[_0x9c35('0x12')]['handleOpenBox']=function(_0x233364,_0x578e00){if(_0x233364){this[_0x9c35('0xf')](_0x233364,!![]);}else{this['emit']('box',_0x578e00);this[_0x9c35('0x24')]();}};EmailImap[_0x9c35('0x12')][_0x9c35('0x25')]=function(_0x4df6bc){if(_0x4df6bc){this[_0x9c35('0xf')](_0x4df6bc,!![]);}else{this['imap'][_0x9c35('0x26')]();}};EmailImap[_0x9c35('0x12')][_0x9c35('0x24')]=function(){this[_0x9c35('0x9')][_0x9c35('0x27')](['UNSEEN'],this[_0x9c35('0x28')][_0x9c35('0xc')](this));};EmailImap['prototype'][_0x9c35('0x28')]=function(_0x1a4270,_0x222dd0){if(_0x1a4270){this[_0x9c35('0xf')](_0x1a4270,!![]);}else{if(_0x222dd0[_0x9c35('0x29')]){try{var _0x4cb625=this[_0x9c35('0x9')][_0x9c35('0x2a')](_0x222dd0,{'bodies':'','markSeen':!![]});_0x4cb625['on'](_0x9c35('0x2b'),this[_0x9c35('0x2c')][_0x9c35('0xc')](this));_0x4cb625[_0x9c35('0xa')]('error',this[_0x9c35('0x2d')]['bind'](this));_0x4cb625[_0x9c35('0xa')](_0x9c35('0x26'),this[_0x9c35('0x2e')][_0x9c35('0xc')](this));}catch(_0x462306){logger['error'](_0x462306);}}else{this[_0x9c35('0x9')][_0x9c35('0x2f')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0x9c35('0x12')]['handleFetchMessage']=function(_0x560b74){_0x560b74['on']('body',this[_0x9c35('0x30')][_0x9c35('0xc')](this));_0x560b74[_0x9c35('0xa')](_0x9c35('0x31'),this[_0x9c35('0x32')][_0x9c35('0xc')](this));_0x560b74['once'](_0x9c35('0x26'),this[_0x9c35('0x33')][_0x9c35('0xc')](this));};EmailImap[_0x9c35('0x12')]['handleMessageBody']=function(_0x29d210){simpleParser(_0x29d210,{'Iconv':Iconv},this[_0x9c35('0x34')][_0x9c35('0xc')](this));};EmailImap[_0x9c35('0x12')][_0x9c35('0x32')]=function(){};EmailImap[_0x9c35('0x12')][_0x9c35('0x33')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x53df3e,_0x12d387){if(_0x53df3e){logger['error'](_0x53df3e);}else{var _0x306c96=this;utils['parser'](this['account'],_0x12d387,function(_0x52a83a){_0x306c96[_0x9c35('0x35')](_0x9c35('0x6'),_0x52a83a);});}};EmailImap[_0x9c35('0x12')][_0x9c35('0x2e')]=function(){this[_0x9c35('0x9')][_0x9c35('0x2f')](!![],this['handleCloseBox'][_0x9c35('0xc')](this));};EmailImap['prototype'][_0x9c35('0x2d')]=function(_0x5827e1){this['handleError'](_0x5827e1);this['imap']['closeBox'](!![],this[_0x9c35('0x25')][_0x9c35('0xc')](this));};EmailImap[_0x9c35('0x12')][_0x9c35('0xd')]=function(){this['emit'](_0x9c35('0x26'));};EmailImap[_0x9c35('0x12')][_0x9c35('0xf')]=function(_0x481eef,_0x4625fa){logger[_0x9c35('0xe')](_0x9c35('0xf'),this[_0x9c35('0x7')][_0x9c35('0x6')],JSON[_0x9c35('0x36')](_0x481eef));var _0xe2ec40='';if(_0x481eef){if(_0x481eef[_0x9c35('0x37')]){_0xe2ec40=_0x481eef[_0x9c35('0x37')];}else{for(var _0x3097f1 in _0x481eef){if(_0x481eef[_0x9c35('0x38')](_0x3097f1)){_0xe2ec40+=_['upperFirst'](_0x3097f1)+':\x20'+_0x481eef[_0x3097f1]+'\x0a';}}}}if(_0x4625fa){this[_0x9c35('0x9')][_0x9c35('0x26')]();}else{this[_0x9c35('0x35')](_0x9c35('0xe'),_0xe2ec40);this[_0x9c35('0x35')](_0x9c35('0x26'));}};module[_0x9c35('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 72a1d82..d8dca12 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 _0x407e=['nodemailer','send','createTransport','use','compile','sendMail','prototype','verify','toString','exports'];(function(_0x4c1680,_0x43f1da){var _0x3291c9=function(_0x1f281d){while(--_0x1f281d){_0x4c1680['push'](_0x4c1680['shift']());}};_0x3291c9(++_0x43f1da);}(_0x407e,0x1f4));var _0xe407=function(_0x114bdf,_0x119ada){_0x114bdf=_0x114bdf-0x0;var _0x5658f6=_0x407e[_0x114bdf];return _0x5658f6;};'use strict';var nodemailer=require(_0xe407('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xe407('0x1')]=function(_0x4225c7,_0x2aa6d2){return new Promise(function(_0xc7fdbd,_0x4b705f){var _0x2236eb=nodemailer[_0xe407('0x2')](_0x4225c7);_0x2236eb[_0xe407('0x3')](_0xe407('0x4'),inlineBase64());_0x2236eb[_0xe407('0x5')](_0x2aa6d2,function(_0x593ccd,_0x4ae659){if(_0x593ccd){_0x4b705f(_0x593ccd['toString']());}else{_0xc7fdbd(_0x4ae659);}});});};EmailSmtp[_0xe407('0x6')][_0xe407('0x7')]=function(_0x4ffbc7){return new Promise(function(_0x2d5ea1,_0x2af540){var _0x36a72a=nodemailer[_0xe407('0x2')](_0x4ffbc7);_0x36a72a[_0xe407('0x7')](function(_0x1cfd53,_0x987820){if(_0x1cfd53){_0x2af540(_0x1cfd53[_0xe407('0x8')]());}else{if(_0x987820){_0x2d5ea1(_0x987820);}else{_0x2af540('Not\x20verifired');}}});});};module[_0xe407('0x9')]=EmailSmtp; \ No newline at end of file +var _0xb055=['prototype','send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb055,0xf9));var _0x5b05=function(_0x3684e6,_0x991a44){_0x3684e6=_0x3684e6-0x0;var _0xcaaf43=_0xb055[_0x3684e6];return _0xcaaf43;};'use strict';var nodemailer=require(_0x5b05('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x5b05('0x1')][_0x5b05('0x2')]=function(_0x5a7061,_0xcceb26){return new Promise(function(_0x4b2317,_0xe9b892){var _0x5800e5=nodemailer[_0x5b05('0x3')](_0x5a7061);_0x5800e5['use'](_0x5b05('0x4'),inlineBase64());_0x5800e5[_0x5b05('0x5')](_0xcceb26,function(_0x1349b9,_0x51b7b9){if(_0x1349b9){_0xe9b892(_0x1349b9[_0x5b05('0x6')]());}else{_0x4b2317(_0x51b7b9);}});});};EmailSmtp[_0x5b05('0x1')]['verify']=function(_0x51cab9){return new Promise(function(_0x3818a5,_0xc76154){var _0xeafbeb=nodemailer['createTransport'](_0x51cab9);_0xeafbeb[_0x5b05('0x7')](function(_0x2fde3e,_0x1e2b8b){if(_0x2fde3e){_0xc76154(_0x2fde3e['toString']());}else{if(_0x1e2b8b){_0x3818a5(_0x1e2b8b);}else{_0xc76154(_0x5b05('0x8'));}}});});};module[_0x5b05('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9e5285c..551ec5c 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 _0x27d3=['content','headerLines','Auto-Submitted:\x20auto-replied','line','isAutoreply','parser','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','name','substring','indexOf','split','join','length','pop','@xcally.com','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x4eac97['slice'](0x0,-0x1)[_0x327d('0x11')]('\x20'):_0x2a68dc[_0x327d('0xd')];}return'Anonymous';}function getLastName(_0x42db2f){var _0x4ca372=_[_0x327d('0x9')](_0x42db2f[_0x327d('0xa')]);if(_0x4ca372&&_0x4ca372[_0x327d('0xd')]){var _0x48913e=_0x4ca372['name'][_0x327d('0x10')](/\s+/);return _0x48913e[_0x327d('0x12')]>0x1?_0x48913e[_0x327d('0x13')]():'';}return'';}function getMails(_0x4d80c7,_0x1b788a){var _0x183f49='';for(var _0x1a0328=0x0;_0x1a0328<_0x1b788a[_0x327d('0xa')]['length'];_0x1a0328+=0x1){if(_0x1b788a[_0x327d('0xa')][_0x1a0328][_0x327d('0xb')]!==_0x4d80c7){if(!_['isEmpty'](_0x183f49)){_0x183f49+=',';}_0x183f49+=_0x1b788a[_0x327d('0xa')][_0x1a0328][_0x327d('0xd')]||_0x1b788a[_0x327d('0xa')][_0x1a0328][_0x327d('0xb')]||'';_0x183f49+='\x20<';_0x183f49+=_0x1b788a['value'][_0x1a0328]['address']?_0x1b788a['value'][_0x1a0328][_0x327d('0xb')]:'anonymous'+random[_0x327d('0xc')](0x6)+_0x327d('0x14');_0x183f49+='>';}}return _0x183f49;}function parseEmail(_0x3a05c7,_0x16dbf8,_0x16761){if(_0x16dbf8[_0x327d('0x15')]){var _0x12ad72=/)<[^<]*)*<\/script>/gi;while(_0x12ad72['test'](_0x16dbf8[_0x327d('0x15')])){_0x16dbf8[_0x327d('0x15')]=_0x16dbf8[_0x327d('0x15')][_0x327d('0x16')](_0x12ad72,'');}if(_0x16dbf8[_0x327d('0x15')][_0x327d('0x17')](_0x327d('0x18'))){var _0x369c85=[];_0x16dbf8[_0x327d('0x19')][_0x327d('0x1a')](_0x2e4688=>{_0x369c85[_0x327d('0x1b')](_0x2e4688[_0x327d('0x1c')]);});var _0x3c1d41=/]+>/g;var _0xcb9a23=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2286f3=_0x16dbf8['html'][_0x327d('0x16')](_0xcb9a23,_0x327d('0x1d'));var _0x426ad=_0x2286f3['replace'](_0x3c1d41,_0x327d('0x1e'));for(let _0x37049b=0x0;_0x37049b<_0x369c85[_0x327d('0x12')];_0x37049b++){var _0x5da08d=_0x426ad[_0x327d('0x16')]('_IMG',_0x327d('0x1f')+_0x369c85[_0x37049b]+_0x327d('0x20'));_0x426ad=_0x5da08d;}_0x16dbf8['html']=_0x426ad;}_0x16761[_0x327d('0x21')]=_0x16dbf8[_0x327d('0x15')];}else{_0x16761[_0x327d('0x21')]=_0x16dbf8[_0x327d('0x22')];}if(_0x16761[_0x327d('0x21')]){_0x16761[_0x327d('0x21')]=_0x16761[_0x327d('0x21')][_0x327d('0x16')](/0x0){var _0x711a8e=[_0x327d('0x31'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x468b3c=0x0;_0x468b3c<_0x16dbf8[_0x327d('0x30')][_0x327d('0x12')];_0x468b3c++){var _0x2294b0=_[_0x327d('0xf')](_0x711a8e,_0x16dbf8[_0x327d('0x30')][_0x468b3c][_0x327d('0x32')]);if(_0x2294b0>=0x0){_0x16761[_0x327d('0x33')]=!![];}}}return _0x16761;}exports[_0x327d('0x34')]=function(_0xc0ec29,_0x29a27e,_0x1f3543){var _0x1d72bd={'from':getAddress(_0x29a27e[_0x327d('0x35')]),'firstName':getFirstName(_0x29a27e['from']),'lastName':getLastName(_0x29a27e['from']),'mapKey':_0x327d('0x7'),'message':{'from':getMails(_0xc0ec29[_0x327d('0x7')],_0x29a27e[_0x327d('0x35')]),'to':_0xc0ec29[_0x327d('0x7')],'cc':'','subject':_0x29a27e[_0x327d('0x36')]||'','messageId':_0x29a27e['messageId'],'inReplyTo':_0x29a27e[_0x327d('0x37')],'sentAt':moment(_0x29a27e[_0x327d('0x38')])[_0x327d('0x2b')](_0x327d('0x39')),'attach':![],'attachments':[]}};if(!_0x29a27e[_0x327d('0x15')]&&!_0x29a27e[_0x327d('0x22')]){var _0x14a3f3=_['filter'](_0x29a27e[_0x327d('0x19')],{'contentType':_0x327d('0x3a')});if(_0x14a3f3[_0x327d('0x12')]){logger['info'](util[_0x327d('0x2b')](_0x327d('0x3b'),_0x29a27e['messageId']));tnef['parseBuffer'](_['first'](_0x14a3f3)['content'],function(_0x3d8296,_0x14668d){if(_0x14668d){_0x29a27e[_0x327d('0x15')]=_0x14668d[_0x327d('0x3c')]||_0x327d('0x3d');if(_0x14668d[_0x327d('0x3e')]){for(var _0x45f5e1=0x0;_0x45f5e1<_0x14668d['Attachments']['length'];_0x45f5e1++){var _0x9125d1=_0x14668d[_0x327d('0x3e')][_0x45f5e1];_0x1d72bd[_0x327d('0x24')][_0x327d('0x19')][_0x327d('0x1b')]({'filename':_0x9125d1[_0x327d('0x3f')],'content':Buffer[_0x327d('0x35')](_0x9125d1[_0x327d('0x40')])});}}}_0x1f3543(parseEmail(_0xc0ec29,_0x29a27e,_0x1d72bd));});}else{_0x29a27e[_0x327d('0x15')]=_0x327d('0x3d');_0x1f3543(parseEmail(_0xc0ec29,_0x29a27e,_0x1d72bd));}}else{_0x1f3543(parseEmail(_0xc0ec29,_0x29a27e,_0x1d72bd));}};exports[_0x327d('0x41')]=function(_0x555170,_0x54d63e){var _0x238c66=[_0x327d('0x42')+(_0x54d63e||''),_0x327d('0x43')+_0x555170,'',''];return Buffer[_0x327d('0x35')](_0x238c66[_0x327d('0x11')](''),_0x327d('0x44'))[_0x327d('0x45')](_0x327d('0x46'));}; \ No newline at end of file +var _0x3e58=['attach','format','%s-%s','server/files/attachments/','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','parser','from','subject','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','messageId','first','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','../../../config/logger','email','../../../config/environment','value','address','@xcally.com','head','name','substring','indexOf','split','length','slice','join','Anonymous','isEmpty','anonymous','html','test','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x241609[_0x83e5('0xf')](0x0,-0x1)[_0x83e5('0x10')]('\x20'):_0x32f289[_0x83e5('0xa')];}return _0x83e5('0x11');}function getLastName(_0x181159){var _0x168563=_['head'](_0x181159['value']);if(_0x168563&&_0x168563['name']){var _0x2a18da=_0x168563[_0x83e5('0xa')]['split'](/\s+/);return _0x2a18da[_0x83e5('0xe')]>0x1?_0x2a18da['pop']():'';}return'';}function getMails(_0x3bb5bc,_0x2077f0){var _0x2dc54d='';for(var _0x3cb612=0x0;_0x3cb612<_0x2077f0[_0x83e5('0x6')]['length'];_0x3cb612+=0x1){if(_0x2077f0[_0x83e5('0x6')][_0x3cb612][_0x83e5('0x7')]!==_0x3bb5bc){if(!_[_0x83e5('0x12')](_0x2dc54d)){_0x2dc54d+=',';}_0x2dc54d+=_0x2077f0[_0x83e5('0x6')][_0x3cb612][_0x83e5('0xa')]||_0x2077f0[_0x83e5('0x6')][_0x3cb612][_0x83e5('0x7')]||'';_0x2dc54d+='\x20<';_0x2dc54d+=_0x2077f0['value'][_0x3cb612][_0x83e5('0x7')]?_0x2077f0[_0x83e5('0x6')][_0x3cb612][_0x83e5('0x7')]:_0x83e5('0x13')+random['generate'](0x6)+'@xcally.com';_0x2dc54d+='>';}}return _0x2dc54d;}function parseEmail(_0x681866,_0x3b7789,_0x4e5599){if(_0x3b7789[_0x83e5('0x14')]){var _0x26fcea=/)<[^<]*)*<\/script>/gi;while(_0x26fcea[_0x83e5('0x15')](_0x3b7789[_0x83e5('0x14')])){_0x3b7789['html']=_0x3b7789['html']['replace'](_0x26fcea,'');}if(_0x3b7789[_0x83e5('0x14')][_0x83e5('0x16')](_0x83e5('0x17'))){var _0x11f094=[];_0x3b7789[_0x83e5('0x18')]['forEach'](_0x41c181=>{_0x11f094[_0x83e5('0x19')](_0x41c181[_0x83e5('0x1a')]);});var _0x53eff5=/]+>/g;var _0x186bb9=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x27de5f=_0x3b7789[_0x83e5('0x14')][_0x83e5('0x1b')](_0x186bb9,'_SRC');var _0x4b0775=_0x27de5f['replace'](_0x53eff5,_0x83e5('0x1c'));for(let _0x1a55a8=0x0;_0x1a55a8<_0x11f094['length'];_0x1a55a8++){var _0x38f086=_0x4b0775['replace'](_0x83e5('0x1c'),_0x83e5('0x1d')+_0x11f094[_0x1a55a8]+'\x20]');_0x4b0775=_0x38f086;}_0x3b7789[_0x83e5('0x14')]=_0x4b0775;}_0x4e5599[_0x83e5('0x1e')]=_0x3b7789[_0x83e5('0x14')];}else{_0x4e5599[_0x83e5('0x1e')]=_0x3b7789[_0x83e5('0x1f')];}if(_0x4e5599[_0x83e5('0x1e')]){_0x4e5599['body']=_0x4e5599['body'][_0x83e5('0x1b')](/0x0){var _0x18755b=['Auto-Submitted:\x20auto-replied',_0x83e5('0x2b'),_0x83e5('0x2c')];for(var _0x350d7f=0x0;_0x350d7f<_0x3b7789['headerLines'][_0x83e5('0xe')];_0x350d7f++){var _0x5f0349=_[_0x83e5('0xc')](_0x18755b,_0x3b7789[_0x83e5('0x2a')][_0x350d7f]['line']);if(_0x5f0349>=0x0){_0x4e5599[_0x83e5('0x2d')]=!![];}}}return _0x4e5599;}exports[_0x83e5('0x2e')]=function(_0x1d845a,_0x55b5ae,_0x66cc8f){var _0x263c6f={'from':getAddress(_0x55b5ae[_0x83e5('0x2f')]),'firstName':getFirstName(_0x55b5ae['from']),'lastName':getLastName(_0x55b5ae[_0x83e5('0x2f')]),'mapKey':_0x83e5('0x4'),'message':{'from':getMails(_0x1d845a[_0x83e5('0x4')],_0x55b5ae[_0x83e5('0x2f')]),'to':_0x1d845a[_0x83e5('0x4')],'cc':'','subject':_0x55b5ae[_0x83e5('0x30')]||'','messageId':_0x55b5ae['messageId'],'inReplyTo':_0x55b5ae['inReplyTo'],'sentAt':moment(_0x55b5ae[_0x83e5('0x31')])[_0x83e5('0x25')](_0x83e5('0x32')),'attach':![],'attachments':[]}};if(!_0x55b5ae[_0x83e5('0x14')]&&!_0x55b5ae[_0x83e5('0x1f')]){var _0x23feb7=_['filter'](_0x55b5ae[_0x83e5('0x18')],{'contentType':_0x83e5('0x33')});if(_0x23feb7[_0x83e5('0xe')]){logger[_0x83e5('0x34')](util[_0x83e5('0x25')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x55b5ae[_0x83e5('0x35')]));tnef['parseBuffer'](_[_0x83e5('0x36')](_0x23feb7)[_0x83e5('0x28')],function(_0x3dcb94,_0x744722){if(_0x744722){_0x55b5ae[_0x83e5('0x14')]=_0x744722['BodyHTML']||_0x83e5('0x37');if(_0x744722[_0x83e5('0x38')]){for(var _0x543556=0x0;_0x543556<_0x744722[_0x83e5('0x38')]['length'];_0x543556++){var _0xa2a7f4=_0x744722['Attachments'][_0x543556];_0x263c6f[_0x83e5('0x21')][_0x83e5('0x18')][_0x83e5('0x19')]({'filename':_0xa2a7f4[_0x83e5('0x39')],'content':Buffer[_0x83e5('0x2f')](_0xa2a7f4[_0x83e5('0x3a')])});}}}_0x66cc8f(parseEmail(_0x1d845a,_0x55b5ae,_0x263c6f));});}else{_0x55b5ae[_0x83e5('0x14')]=_0x83e5('0x37');_0x66cc8f(parseEmail(_0x1d845a,_0x55b5ae,_0x263c6f));}}else{_0x66cc8f(parseEmail(_0x1d845a,_0x55b5ae,_0x263c6f));}};exports[_0x83e5('0x3b')]=function(_0x52f564,_0x25b656){var _0x3d0f21=[_0x83e5('0x3c')+(_0x25b656||''),_0x83e5('0x3d')+_0x52f564,'',''];return Buffer['from'](_0x3d0f21['join'](''),_0x83e5('0x3e'))[_0x83e5('0x3f')](_0x83e5('0x40'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 5b68ed4..5a0186a 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 _0x81bf=['key','SERV','Imap','Smtp','exports','lodash','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81bf,0xc9));var _0xf81b=function(_0x479f15,_0x544345){_0x479f15=_0x479f15-0x0;var _0x3455f1=_0x81bf[_0x479f15];return _0x3455f1;};'use strict';var _=require(_0xf81b('0x0'));function MailAccount(_0x42c210){this['id']=_0x42c210['id']||0x0;this[_0xf81b('0x1')]=_0x42c210[_0xf81b('0x1')]||'Service';this[_0xf81b('0x2')]=_0x42c210[_0xf81b('0x2')]||_0xf81b('0x3');this['active']=_0x42c210['active']||![];this[_0xf81b('0x4')]=_0x42c210[_0xf81b('0x4')]||[];this[_0xf81b('0x5')]=_0x42c210[_0xf81b('0x5')]||[];}module[_0xf81b('0x6')]=MailAccount; \ No newline at end of file +var _0x6dfb=['Service','key','active','Imap','Smtp','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6dfb,0xef));var _0xb6df=function(_0x316246,_0x245621){_0x316246=_0x316246-0x0;var _0x3b90f4=_0x6dfb[_0x316246];return _0x3b90f4;};'use strict';var _=require('lodash');function MailAccount(_0x2e2c56){this['id']=_0x2e2c56['id']||0x0;this[_0xb6df('0x0')]=_0x2e2c56[_0xb6df('0x0')]||_0xb6df('0x1');this[_0xb6df('0x2')]=_0x2e2c56['key']||'SERV';this[_0xb6df('0x3')]=_0x2e2c56['active']||![];this[_0xb6df('0x4')]=_0x2e2c56[_0xb6df('0x4')]||[];this[_0xb6df('0x5')]=_0x2e2c56[_0xb6df('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index dd2e113..6961df2 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 _0xbdbf=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','merge'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0xbdbf,0x177));var _0xfbdb=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xbdbf[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xfbdb('0x0'));var MailAccount=require(_0xfbdb('0x1'));var Realtime=function(){this[_0xfbdb('0x2')]={};};function freeIsNotKey(_0x2a5133,_0x4cd02f,_0x6582c7){var _0x34d686=_[_0xfbdb('0x3')](_0x2a5133,function(_0x1625f8,_0x1ac3d4){return _0x1625f8[_0x6582c7];});for(var _0x1d7034 in _0x4cd02f){if(_0x4cd02f[_0xfbdb('0x4')](_0x1d7034)){if(!_0x34d686[_0x1d7034]){delete _0x4cd02f[_0x1d7034];}}}}Realtime[_0xfbdb('0x5')][_0xfbdb('0x6')]=function(_0x2c1bc2,_0x507890){for(var _0x418739 in _0x507890){if(_0x2c1bc2[_0xfbdb('0x4')](_0x418739)){_0x2c1bc2[_0x418739]=_0x507890[_0x418739];}}};Realtime[_0xfbdb('0x5')][_0xfbdb('0x7')]=function(){var _0x2efa83=this;return function(_0x1438c1){if(_0x1438c1){freeIsNotKey(_0x1438c1,_0x2efa83['mailAccounts'],'id');for(var _0x4fbba0=0x0,_0x2f4d87={},_0x5cce2c={};_0x4fbba0<_0x1438c1[_0xfbdb('0x8')];_0x4fbba0+=0x1){_0x2f4d87=_0x1438c1[_0x4fbba0];if(_['isUndefined'](_0x2efa83[_0xfbdb('0x2')][_0x2f4d87['id']])){_0x2efa83[_0xfbdb('0x2')][_0x2f4d87['id']]=new MailAccount(_0x2f4d87);}else{_[_0xfbdb('0x9')](_0x2efa83[_0xfbdb('0x2')][_0x2f4d87['id']],_0x2f4d87);}}}return _0x2efa83[_0xfbdb('0x2')];};};module[_0xfbdb('0xa')]=Realtime; \ No newline at end of file +var _0xe816=['mapKeys','mergeFromDatabase','prototype','initMailAccounts','length','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x434a0a,_0x1050c5){var _0x2e91ba=function(_0x5c2def){while(--_0x5c2def){_0x434a0a['push'](_0x434a0a['shift']());}};_0x2e91ba(++_0x1050c5);}(_0xe816,0x19b));var _0x6e81=function(_0x101f3b,_0x555407){_0x101f3b=_0x101f3b-0x0;var _0x5147db=_0xe816[_0x101f3b];return _0x5147db;};'use strict';var _=require(_0x6e81('0x0'));var MailAccount=require(_0x6e81('0x1'));var Realtime=function(){this[_0x6e81('0x2')]={};};function freeIsNotKey(_0x1171a5,_0x2cc1bb,_0x37960c){var _0x5a3770=_[_0x6e81('0x3')](_0x1171a5,function(_0x3e87a6,_0x4d0881){return _0x3e87a6[_0x37960c];});for(var _0x21991b in _0x2cc1bb){if(_0x2cc1bb['hasOwnProperty'](_0x21991b)){if(!_0x5a3770[_0x21991b]){delete _0x2cc1bb[_0x21991b];}}}}Realtime['prototype'][_0x6e81('0x4')]=function(_0x6224a0,_0x400ae7){for(var _0x42cd0e in _0x400ae7){if(_0x6224a0['hasOwnProperty'](_0x42cd0e)){_0x6224a0[_0x42cd0e]=_0x400ae7[_0x42cd0e];}}};Realtime[_0x6e81('0x5')][_0x6e81('0x6')]=function(){var _0xd4658c=this;return function(_0x689890){if(_0x689890){freeIsNotKey(_0x689890,_0xd4658c[_0x6e81('0x2')],'id');for(var _0x35a498=0x0,_0x4d1286={},_0x3ce3d7={};_0x35a498<_0x689890[_0x6e81('0x7')];_0x35a498+=0x1){_0x4d1286=_0x689890[_0x35a498];if(_['isUndefined'](_0xd4658c['mailAccounts'][_0x4d1286['id']])){_0xd4658c[_0x6e81('0x2')][_0x4d1286['id']]=new MailAccount(_0x4d1286);}else{_['merge'](_0xd4658c[_0x6e81('0x2')][_0x4d1286['id']],_0x4d1286);}}}return _0xd4658c['mailAccounts'];};};module[_0x6e81('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 371fb16..9c431bc 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 _0x5fab=['name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','type','CloudProvider','MailServerOut','Smtp','data5','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount'];(function(_0x574266,_0x52a8fb){var _0x24d5d7=function(_0x537e62){while(--_0x537e62){_0x574266['push'](_0x574266['shift']());}};_0x24d5d7(++_0x52a8fb);}(_0x5fab,0x177));var _0xb5fa=function(_0xd0255a,_0x5ba91a){_0xd0255a=_0xd0255a-0x0;var _0x265f2d=_0x5fab[_0xd0255a];return _0x265f2d;};'use strict';var client=require(_0xb5fa('0x0'));exports[_0xb5fa('0x1')]=function(){return function(){return client['Request'](_0xb5fa('0x2'),{'options':{'attributes':['id',_0xb5fa('0x3'),_0xb5fa('0x4'),_0xb5fa('0x5'),_0xb5fa('0x6'),_0xb5fa('0x7'),_0xb5fa('0x8'),_0xb5fa('0x9'),_0xb5fa('0xa')],'raw':![],'include':[{'model':_0xb5fa('0xb'),'as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0xb5fa('0x3'),_0xb5fa('0x5'),_0xb5fa('0xc'),'data5'],'as':_0xb5fa('0xd')}]},{'model':_0xb5fa('0xe'),'as':_0xb5fa('0xf'),'include':[{'model':'CloudProvider','attributes':['id','name',_0xb5fa('0x5'),_0xb5fa('0xc'),_0xb5fa('0x10')],'as':_0xb5fa('0xd')}]}]},'log':_0xb5fa('0x11')});};};exports[_0xb5fa('0x12')]=function(_0x65c6b6,_0x46da66){return client[_0xb5fa('0x13')]('NotifyMailAccount',{'account':{'id':_0x65c6b6},'body':_0x46da66,'log':_0xb5fa('0x14')});}; \ No newline at end of file +var _0xeda8=['email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','getMailAccount','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','provider','service'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xeda8,0x104));var _0x8eda=function(_0x1965bb,_0x3a0f57){_0x1965bb=_0x1965bb-0x0;var _0x42c03f=_0xeda8[_0x1965bb];return _0x42c03f;};'use strict';var client=require(_0x8eda('0x0'));exports[_0x8eda('0x1')]=function(){return function(){return client['Request'](_0x8eda('0x2'),{'options':{'attributes':['id',_0x8eda('0x3'),_0x8eda('0x4'),_0x8eda('0x5'),_0x8eda('0x6'),_0x8eda('0x7'),_0x8eda('0x8'),_0x8eda('0x9'),_0x8eda('0xa')],'raw':![],'include':[{'model':_0x8eda('0xb'),'as':_0x8eda('0xc'),'include':[{'model':_0x8eda('0xd'),'attributes':['id','name',_0x8eda('0x5'),_0x8eda('0xe'),_0x8eda('0xf')],'as':_0x8eda('0xd')}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','attributes':['id','name',_0x8eda('0x5'),_0x8eda('0xe'),_0x8eda('0xf')],'as':'CloudProvider'}]}]},'log':_0x8eda('0x10')});};};exports['notify']=function(_0x3f34c,_0x36689a){return client[_0x8eda('0x11')](_0x8eda('0x12'),{'account':{'id':_0x3f34c},'body':_0x36689a,'log':_0x8eda('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 7eadb09..46dd5d1 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 _0x3eb4=['loginMailFrequency','GetSettings','ShowSetting'];(function(_0x51def7,_0x6341b3){var _0x2550b3=function(_0x127e76){while(--_0x127e76){_0x51def7['push'](_0x51def7['shift']());}};_0x2550b3(++_0x6341b3);}(_0x3eb4,0x68));var _0x43eb=function(_0x54f674,_0x362707){_0x54f674=_0x54f674-0x0;var _0x4bd806=_0x3eb4[_0x54f674];return _0x4bd806;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request'](_0x43eb('0x0'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x43eb('0x1')]},'log':_0x43eb('0x2')});}; \ No newline at end of file +var _0x8e7e=['GetSettings','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x31d3f5,_0xe0d9f5){var _0x24a9e7=function(_0x34a68c){while(--_0x34a68c){_0x31d3f5['push'](_0x31d3f5['shift']());}};_0x24a9e7(++_0xe0d9f5);}(_0x8e7e,0x173));var _0xe8e7=function(_0x1403c4,_0x5f435c){_0x1403c4=_0x1403c4-0x0;var _0x179a64=_0x8e7e[_0x1403c4];return _0x179a64;};'use strict';var client=require('../client');exports[_0xe8e7('0x0')]=function(){return client[_0xe8e7('0x1')](_0xe8e7('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe8e7('0x3')]},'log':_0xe8e7('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 24d5375..5923d73 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index b7bf857..c01c342 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 _0xd113=['lodash','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io','websocket','polling','localhost','adapter','socket.io-redis','redis','../../config/triggers','default','../../config/socketio','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports'];(function(_0x33ea48,_0x3ec008){var _0x4100c7=function(_0x7cd8af){while(--_0x7cd8af){_0x33ea48['push'](_0x33ea48['shift']());}};_0x4100c7(++_0x3ec008);}(_0xd113,0xc6));var _0x3d11=function(_0x2e22a5,_0x5dc3b8){_0x2e22a5=_0x2e22a5-0x0;var _0x124c76=_0xd113[_0x2e22a5];return _0x124c76;};'use strict';var _=require(_0x3d11('0x0'));var http=require('http');var express=require(_0x3d11('0x1'));var sticky=require(_0x3d11('0x2'));var Redis=require(_0x3d11('0x3'));var config=require(_0x3d11('0x4'));var app=express();var server=http[_0x3d11('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x3d11('0x6')](server,config[_0x3d11('0x7')])){var socketio=require(_0x3d11('0x8'))(server,{'transports':[_0x3d11('0x9'),_0x3d11('0xa')]});config['redis']=_['defaults'](config['redis'],{'host':_0x3d11('0xb'),'port':0x18eb});socketio[_0x3d11('0xc')](require(_0x3d11('0xd'))({'pubClient':new Redis(config[_0x3d11('0xe')]),'subClient':new Redis(config[_0x3d11('0xe')])}));require(_0x3d11('0xf'))[_0x3d11('0x10')]();require(_0x3d11('0x11'))[_0x3d11('0x10')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x3d11('0x10')](app);}else{server['once'](_0x3d11('0x12'),function(){console[_0x3d11('0x13')](_0x3d11('0x14'),config[_0x3d11('0x7')]);});}exports=module[_0x3d11('0x15')]=app; \ No newline at end of file +var _0x65c0=['redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','port','exports','lodash','express','sticky-session','createServer','timeout','listen','socket.io','websocket'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x65c0,0xef));var _0x065c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x65c0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x065c('0x0'));var http=require('http');var express=require(_0x065c('0x1'));var sticky=require(_0x065c('0x2'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x065c('0x3')](app);server[_0x065c('0x4')]=0xdbba0;if(sticky[_0x065c('0x5')](server,config['port'])){var socketio=require(_0x065c('0x6'))(server,{'transports':[_0x065c('0x7'),'polling']});config[_0x065c('0x8')]=_['defaults'](config[_0x065c('0x8')],{'host':'localhost','port':0x18eb});socketio[_0x065c('0x9')](require(_0x065c('0xa'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x065c('0x8')])}));require(_0x065c('0xb'))[_0x065c('0xc')]();require(_0x065c('0xd'))['default'](socketio);require(_0x065c('0xe'))[_0x065c('0xc')](app);require(_0x065c('0xf'))[_0x065c('0xc')](app);}else{server[_0x065c('0x10')]('listening',function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x065c('0x11')]);});}exports=module[_0x065c('0x12')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 2713a6f..f1414a3 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 _0x494e=['bluebird','../../config/logger','routing','Request','then','rpc','error','message','result','catch','exports','jayson/promise'];(function(_0x380803,_0x338b4b){var _0xfa7dd2=function(_0x3910f7){while(--_0x3910f7){_0x380803['push'](_0x380803['shift']());}};_0xfa7dd2(++_0x338b4b);}(_0x494e,0xcb));var _0xe494=function(_0x22fc02,_0x3f3fea){_0x22fc02=_0x22fc02-0x0;var _0x26806b=_0x494e[_0x22fc02];return _0x26806b;};'use strict';var jayson=require(_0xe494('0x0'));var BPromise=require(_0xe494('0x1'));var logger=require(_0xe494('0x2'))(_0xe494('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0xe494('0x4')]=function(_0x6050b7,_0x357a72){return new BPromise(function(_0xe2c97f,_0x48c4d7){return client['request'](_0x6050b7,_0x357a72)[_0xe494('0x5')](function(_0x344dc4){logger['debug'](_0xe494('0x6'),_0xe494('0x3'),_0x6050b7,_0x357a72,_0x344dc4);if(_0x344dc4[_0xe494('0x7')]){logger[_0xe494('0x7')](_0xe494('0x6'),_0xe494('0x3'),_0x6050b7,_0x344dc4[_0xe494('0x7')][_0xe494('0x8')],_0x357a72);return _0x48c4d7(_0x344dc4[_0xe494('0x7')][_0xe494('0x8')]);}else{return _0xe2c97f(_0x344dc4[_0xe494('0x9')]);}})[_0xe494('0xa')](function(_0x550366){logger[_0xe494('0x7')](_0xe494('0x6'),_0xe494('0x3'),_0x6050b7,_0x550366,_0x357a72);return _0x48c4d7(_0x550366);});});};module[_0xe494('0xb')]=client; \ No newline at end of file +var _0xecb4=['Request','then','rpc','routing','error','result','exports','jayson/promise','client','http'];(function(_0x21cb40,_0x5def87){var _0x3510c8=function(_0x2e6890){while(--_0x2e6890){_0x21cb40['push'](_0x21cb40['shift']());}};_0x3510c8(++_0x5def87);}(_0xecb4,0x1a1));var _0x4ecb=function(_0x2e80b3,_0x1f73e2){_0x2e80b3=_0x2e80b3-0x0;var _0x1269b5=_0xecb4[_0x2e80b3];return _0x1269b5;};'use strict';var jayson=require(_0x4ecb('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0x4ecb('0x1')][_0x4ecb('0x2')]({'port':0x2329});client[_0x4ecb('0x3')]=function(_0x29300f,_0x24b98f){return new BPromise(function(_0x1e88e2,_0x53d358){return client['request'](_0x29300f,_0x24b98f)[_0x4ecb('0x4')](function(_0x2d2ddf){logger['debug'](_0x4ecb('0x5'),_0x4ecb('0x6'),_0x29300f,_0x24b98f,_0x2d2ddf);if(_0x2d2ddf[_0x4ecb('0x7')]){logger[_0x4ecb('0x7')](_0x4ecb('0x5'),_0x4ecb('0x6'),_0x29300f,_0x2d2ddf[_0x4ecb('0x7')]['message'],_0x24b98f);return _0x53d358(_0x2d2ddf[_0x4ecb('0x7')]['message']);}else{return _0x1e88e2(_0x2d2ddf[_0x4ecb('0x8')]);}})['catch'](function(_0x21906b){logger['error'](_0x4ecb('0x5'),_0x4ecb('0x6'),_0x29300f,_0x21906b,_0x24b98f);return _0x53d358(_0x21906b);});});};module[_0x4ecb('0x9')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 93eca79..5ce02e8 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 _0xfb4c=['./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue'];(function(_0x317778,_0x5342a3){var _0x13bff8=function(_0x50b19f){while(--_0x50b19f){_0x317778['push'](_0x317778['shift']());}};_0x13bff8(++_0x5342a3);}(_0xfb4c,0x138));var _0xcfb4=function(_0x5e9691,_0x251156){_0x5e9691=_0x5e9691-0x0;var _0x6348f9=_0xfb4c[_0x5e9691];return _0x6348f9;};'use strict';var BPromise=require(_0xcfb4('0x0'));var server=require(_0xcfb4('0x1'));var Realtime=require(_0xcfb4('0x2'));var user=require('./rpc/user');var interval=require(_0xcfb4('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xcfb4('0x4'));var smsQueue=require(_0xcfb4('0x5'));var mailQueue=require(_0xcfb4('0x6'));var faxQueue=require(_0xcfb4('0x7'));var whatsappQueue=require(_0xcfb4('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xcfb4('0x9')]()[_0xcfb4('0xa')](user[_0xcfb4('0xb')]())[_0xcfb4('0xa')](realtime[_0xcfb4('0xc')]())['then'](interval[_0xcfb4('0xd')]())[_0xcfb4('0xa')](realtime[_0xcfb4('0xe')]())[_0xcfb4('0xa')](openchannelQueue[_0xcfb4('0xf')]())['then'](realtime[_0xcfb4('0x10')]())['then'](chatQueue[_0xcfb4('0x11')]())['then'](realtime[_0xcfb4('0x12')]())[_0xcfb4('0xa')](smsQueue[_0xcfb4('0x13')]())[_0xcfb4('0xa')](realtime[_0xcfb4('0x14')]())[_0xcfb4('0xa')](mailQueue[_0xcfb4('0x15')]())[_0xcfb4('0xa')](realtime['initMailQueues']())[_0xcfb4('0xa')](faxQueue[_0xcfb4('0x16')]())['then'](realtime[_0xcfb4('0x17')]())[_0xcfb4('0xa')](whatsappQueue[_0xcfb4('0x18')]())['then'](realtime[_0xcfb4('0x19')]())[_0xcfb4('0xa')](function(){return realtime;});}function main(){return server[_0xcfb4('0x1a')](realtime)[_0xcfb4('0xa')](function(_0xf672b){return initRealtime();})[_0xcfb4('0xa')](function(_0x3ecc9f){return setInterval(initRealtime,0x1388);})[_0xcfb4('0x1b')](function(_0x4254ff){console[_0xcfb4('0x1c')](_0x4254ff);});}main(); \ No newline at end of file +var _0x0dac=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x0dac,0x159));var _0xc0da=function(_0x22e9ce,_0x496f15){_0x22e9ce=_0x22e9ce-0x0;var _0x1ee946=_0x0dac[_0x22e9ce];return _0x1ee946;};'use strict';var BPromise=require(_0xc0da('0x0'));var server=require('./server');var Realtime=require(_0xc0da('0x1'));var user=require(_0xc0da('0x2'));var interval=require(_0xc0da('0x3'));var openchannelQueue=require(_0xc0da('0x4'));var chatQueue=require(_0xc0da('0x5'));var smsQueue=require(_0xc0da('0x6'));var mailQueue=require(_0xc0da('0x7'));var faxQueue=require(_0xc0da('0x8'));var whatsappQueue=require(_0xc0da('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xc0da('0xa')]()[_0xc0da('0xb')](user[_0xc0da('0xc')]())['then'](realtime[_0xc0da('0xd')]())[_0xc0da('0xb')](interval[_0xc0da('0xe')]())[_0xc0da('0xb')](realtime['initIntervals']())[_0xc0da('0xb')](openchannelQueue[_0xc0da('0xf')]())[_0xc0da('0xb')](realtime[_0xc0da('0x10')]())[_0xc0da('0xb')](chatQueue[_0xc0da('0x11')]())[_0xc0da('0xb')](realtime[_0xc0da('0x12')]())['then'](smsQueue[_0xc0da('0x13')]())[_0xc0da('0xb')](realtime[_0xc0da('0x14')]())[_0xc0da('0xb')](mailQueue[_0xc0da('0x15')]())[_0xc0da('0xb')](realtime['initMailQueues']())[_0xc0da('0xb')](faxQueue[_0xc0da('0x16')]())[_0xc0da('0xb')](realtime[_0xc0da('0x17')]())[_0xc0da('0xb')](whatsappQueue[_0xc0da('0x18')]())[_0xc0da('0xb')](realtime[_0xc0da('0x19')]())[_0xc0da('0xb')](function(){return realtime;});}function main(){return server[_0xc0da('0x1a')](realtime)['then'](function(_0x3e0aa5){return initRealtime();})[_0xc0da('0xb')](function(_0x21a667){return setInterval(initRealtime,0x1388);})[_0xc0da('0x1b')](function(_0x419039){console[_0xc0da('0x1c')](_0x419039);});}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 7ad8046..08e8ca9 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(_0x3feff9,_0x4f636e){var _0x582e61=function(_0x12a182){while(--_0x12a182){_0x3feff9['push'](_0x3feff9['shift']());}};_0x582e61(++_0x4f636e);}(_0x7a54,0x106));var _0x47a5=function(_0x542559,_0x370e78){_0x542559=_0x542559-0x0;var _0x4923a8=_0x7a54[_0x542559];return _0x4923a8;};'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 _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x2ed92f,_0x54091f){var _0x26ff04=function(_0x5ed317){while(--_0x5ed317){_0x2ed92f['push'](_0x2ed92f['shift']());}};_0x26ff04(++_0x54091f);}(_0x814b,0x1a2));var _0xb814=function(_0x3b0999,_0x3c9835){_0x3b0999=_0x3b0999-0x0;var _0x585226=_0x814b[_0x3b0999];return _0x585226;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index c0b0184..3e65603 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 _0x5bd9=['result','catch','sendMailMessage','bluebird','jayson/promise','client','http','then','error','message'];(function(_0x544df4,_0x25edf9){var _0x58e935=function(_0x439212){while(--_0x439212){_0x544df4['push'](_0x544df4['shift']());}};_0x58e935(++_0x25edf9);}(_0x5bd9,0x175));var _0x95bd=function(_0x58215e,_0x377e22){_0x58215e=_0x58215e-0x0;var _0x5637a9=_0x5bd9[_0x58215e];return _0x5637a9;};'use strict';var BPromise=require(_0x95bd('0x0'));var jayson=require(_0x95bd('0x1'));var client=jayson[_0x95bd('0x2')][_0x95bd('0x3')]({'port':0x232b});function request(_0x358ca1,_0x21047c){return new BPromise(function(_0xe6db59,_0x102ca2){return client['request'](_0x358ca1,_0x21047c)[_0x95bd('0x4')](function(_0x5ccaf3){if(_0x5ccaf3[_0x95bd('0x5')]){return _0x102ca2(_0x5ccaf3[_0x95bd('0x5')][_0x95bd('0x6')]);}else{return _0xe6db59(_0x5ccaf3[_0x95bd('0x7')]);}})[_0x95bd('0x8')](function(_0x16d67d){return _0x102ca2(_0x16d67d);});});}exports[_0x95bd('0x9')]=function(_0x3486aa,_0x542b2c){return request('SendMail',{'account':_0x3486aa,'message':_0x542b2c});}; \ No newline at end of file +var _0x8dba=['SendMail','jayson/promise','client','http','request','then','error','message','result'];(function(_0x1b0467,_0x47cffd){var _0x96b657=function(_0x493c46){while(--_0x493c46){_0x1b0467['push'](_0x1b0467['shift']());}};_0x96b657(++_0x47cffd);}(_0x8dba,0xa3));var _0xa8db=function(_0x1da0bf,_0x5d4502){_0x1da0bf=_0x1da0bf-0x0;var _0x391775=_0x8dba[_0x1da0bf];return _0x391775;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa8db('0x0'));var client=jayson[_0xa8db('0x1')][_0xa8db('0x2')]({'port':0x232b});function request(_0x1f9d63,_0x14c995){return new BPromise(function(_0x57299c,_0xd4dcef){return client[_0xa8db('0x3')](_0x1f9d63,_0x14c995)[_0xa8db('0x4')](function(_0x59daa5){if(_0x59daa5[_0xa8db('0x5')]){return _0xd4dcef(_0x59daa5[_0xa8db('0x5')][_0xa8db('0x6')]);}else{return _0x57299c(_0x59daa5[_0xa8db('0x7')]);}})['catch'](function(_0x1966f0){return _0xd4dcef(_0x1966f0);});});}exports['sendMailMessage']=function(_0x466008,_0x3ad406){return request(_0xa8db('0x8'),{'account':_0x466008,'message':_0x3ad406});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index fd8b8c5..1b6a32c 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 _0xcbda=['smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','md5','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','prototype','mail','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatCurrentCapacity','mailCurrentCapacity','openchannelStatus','busy','busyQueue','stringify','emit','user:save','exports','lodash','moment','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0xcbda,0x10e));var _0xacbd=function(_0x5b9284,_0x433376){_0x5b9284=_0x5b9284-0x0;var _0xf8dadb=_0xcbda[_0x5b9284];return _0xf8dadb;};'use strict';var _=require(_0xacbd('0x0'));var moment=require(_0xacbd('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xacbd('0x2'));config[_0xacbd('0x3')]=_['defaults'](config[_0xacbd('0x3')],{'host':_0xacbd('0x4'),'port':0x18eb});var io=require(_0xacbd('0x5'))(new Redis(config['redis']));function Agent(_0x12b5a5){this['id']=_0x12b5a5['id']||0x0;this[_0xacbd('0x6')]=_0x12b5a5[_0xacbd('0x6')]||'';this[_0xacbd('0x7')]=_0x12b5a5[_0xacbd('0x7')]||!![];this[_0xacbd('0x8')]=_0x12b5a5['voicePause']||![];this['chatPause']=_0x12b5a5[_0xacbd('0x9')]||![];this[_0xacbd('0xa')]=_0x12b5a5[_0xacbd('0xa')]||![];this[_0xacbd('0xb')]=_0x12b5a5[_0xacbd('0xb')]||![];this['smsPause']=_0x12b5a5[_0xacbd('0xc')]||![];this['openchannelPause']=_0x12b5a5[_0xacbd('0xd')]||![];this[_0xacbd('0xe')]='unknown';this[_0xacbd('0xf')]=0x0;this[_0xacbd('0x10')]=_0x12b5a5[_0xacbd('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xacbd('0x11')]=_0xacbd('0x12');this[_0xacbd('0x13')]=0x0;this[_0xacbd('0x14')]=_0x12b5a5[_0xacbd('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0xacbd('0x15')]=0x0;this[_0xacbd('0x16')]=_0x12b5a5['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0xacbd('0x17')]=_0xacbd('0x12');this[_0xacbd('0x18')]=0x0;this[_0xacbd('0x19')]=_0x12b5a5[_0xacbd('0x19')]||0x0;this[_0xacbd('0x1a')]=0x0;this[_0xacbd('0x1b')]=_0xacbd('0x12');this[_0xacbd('0x1c')]=0x0;this[_0xacbd('0x1d')]=_0x12b5a5[_0xacbd('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0xacbd('0x12');this[_0xacbd('0x1e')]=0x0;this[_0xacbd('0x1f')]=_0x12b5a5[_0xacbd('0x1f')]||0x0;this[_0xacbd('0x20')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0xacbd('0x21')]='';this[_0xacbd('0x22')]();}Agent['prototype'][_0xacbd('0x23')]=function(_0x303172){if(this[_0x303172+_0xacbd('0x24')]>0x0){if(this[_0x303172+_0xacbd('0x25')]>0x0&&this[_0x303172+_0xacbd('0x24')]>=this[_0x303172+_0xacbd('0x25')]){return _0xacbd('0x26');}else{return _0xacbd('0x27');}}else{return'idle';}};Agent[_0xacbd('0x28')][_0xacbd('0x22')]=function(){var _0x4e65ec=[_0xacbd('0x29'),'chat',_0xacbd('0x2a'),'fax',_0xacbd('0x2b'),_0xacbd('0x2c')];for(var _0x4a9df1=0x0;_0x4a9df1<_0x4e65ec[_0xacbd('0x2d')];_0x4a9df1+=0x1){var _0x2324c0=this[_0xacbd('0x23')](_0x4e65ec[_0x4a9df1]);if(this[_0x4e65ec[_0x4a9df1]+_0xacbd('0x2e')]!==_0x2324c0){this[_0x4e65ec[_0x4a9df1]+_0xacbd('0x2f')]=_[_0xacbd('0x30')](moment()[_0xacbd('0x31')]('x'));}this[_0x4e65ec[_0x4a9df1]+_0xacbd('0x2e')]=_0x2324c0;}var _0x57d1ea={'id':this['id'],'name':this[_0xacbd('0x6')],'online':this['online'],'voicePause':this[_0xacbd('0x8')],'chatPause':this[_0xacbd('0x9')],'mailPause':this[_0xacbd('0xa')],'smsPause':this[_0xacbd('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0xacbd('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xacbd('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xacbd('0x32')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xacbd('0x13')],'mailCapacity':this[_0xacbd('0x14')],'mailCurrentCapacity':this[_0xacbd('0x33')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xacbd('0x15')],'faxCapacity':this[_0xacbd('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xacbd('0x17')],'smsStatusTime':this[_0xacbd('0x18')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xacbd('0x1a')],'whatsappStatus':this[_0xacbd('0x1b')],'whatsappStatusTime':this[_0xacbd('0x1c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xacbd('0x34')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xacbd('0x20')],'busy':this[_0xacbd('0x35')],'busyQueue':this[_0xacbd('0x36')]};var _0x59cfb7=md5(JSON[_0xacbd('0x37')](_0x57d1ea));if(this[_0xacbd('0x21')]!==_0x59cfb7){this['md5']=_0x59cfb7;io[_0xacbd('0x38')](_0xacbd('0x39'),_0x57d1ea);}};module[_0xacbd('0x3a')]=Agent; \ No newline at end of file +var _0x5187=['StatusTime','format','smsCurrentCapacity','busy','stringify','md5','exports','lodash','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','chat','sms','whatsapp','length','Status'];(function(_0x19e3a2,_0x24e21d){var _0x55865e=function(_0x2a2c37){while(--_0x2a2c37){_0x19e3a2['push'](_0x19e3a2['shift']());}};_0x55865e(++_0x24e21d);}(_0x5187,0x124));var _0x7518=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x5187[_0x235482];return _0x5f5bea;};'use strict';var _=require(_0x7518('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x7518('0x1'));config[_0x7518('0x2')]=_[_0x7518('0x3')](config['redis'],{'host':_0x7518('0x4'),'port':0x18eb});var io=require(_0x7518('0x5'))(new Redis(config['redis']));function Agent(_0x167fb8){this['id']=_0x167fb8['id']||0x0;this[_0x7518('0x6')]=_0x167fb8[_0x7518('0x6')]||'';this[_0x7518('0x7')]=_0x167fb8[_0x7518('0x7')]||!![];this[_0x7518('0x8')]=_0x167fb8[_0x7518('0x8')]||![];this[_0x7518('0x9')]=_0x167fb8[_0x7518('0x9')]||![];this['mailPause']=_0x167fb8[_0x7518('0xa')]||![];this[_0x7518('0xb')]=_0x167fb8[_0x7518('0xb')]||![];this[_0x7518('0xc')]=_0x167fb8[_0x7518('0xc')]||![];this[_0x7518('0xd')]=_0x167fb8[_0x7518('0xd')]||![];this[_0x7518('0xe')]=_0x7518('0xf');this[_0x7518('0x10')]=0x0;this[_0x7518('0x11')]=_0x167fb8[_0x7518('0x11')]||0x0;this[_0x7518('0x12')]=0x0;this[_0x7518('0x13')]='unknown';this[_0x7518('0x14')]=0x0;this[_0x7518('0x15')]=_0x167fb8[_0x7518('0x15')]||0x0;this[_0x7518('0x16')]=0x0;this[_0x7518('0x17')]=_0x7518('0xf');this[_0x7518('0x18')]=0x0;this[_0x7518('0x19')]=_0x167fb8[_0x7518('0x19')]||0x0;this[_0x7518('0x1a')]=0x0;this[_0x7518('0x1b')]=_0x7518('0xf');this[_0x7518('0x1c')]=0x0;this[_0x7518('0x1d')]=_0x167fb8['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x7518('0x1e')]=_0x7518('0xf');this[_0x7518('0x1f')]=0x0;this[_0x7518('0x20')]=_0x167fb8[_0x7518('0x20')]||0x0;this[_0x7518('0x21')]=0x0;this[_0x7518('0x22')]=_0x7518('0xf');this['openchannelStatusTime']=0x0;this[_0x7518('0x23')]=_0x167fb8[_0x7518('0x23')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x7518('0x24')]=undefined;this['md5']='';this[_0x7518('0x25')]();}Agent[_0x7518('0x26')][_0x7518('0x27')]=function(_0x2fdccc){if(this[_0x2fdccc+'CurrentCapacity']>0x0){if(this[_0x2fdccc+_0x7518('0x28')]>0x0&&this[_0x2fdccc+_0x7518('0x29')]>=this[_0x2fdccc+_0x7518('0x28')]){return _0x7518('0x2a');}else{return _0x7518('0x2b');}}else{return _0x7518('0x2c');}};Agent[_0x7518('0x26')][_0x7518('0x25')]=function(){var _0xbacbe6=['mail',_0x7518('0x2d'),'openchannel','fax',_0x7518('0x2e'),_0x7518('0x2f')];for(var _0x563833=0x0;_0x563833<_0xbacbe6[_0x7518('0x30')];_0x563833+=0x1){var _0x16ec66=this['getChannelStatus'](_0xbacbe6[_0x563833]);if(this[_0xbacbe6[_0x563833]+_0x7518('0x31')]!==_0x16ec66){this[_0xbacbe6[_0x563833]+_0x7518('0x32')]=_['toNumber'](moment()[_0x7518('0x33')]('x'));}this[_0xbacbe6[_0x563833]+_0x7518('0x31')]=_0x16ec66;}var _0x34734a={'id':this['id'],'name':this[_0x7518('0x6')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x7518('0xc')],'faxPause':this[_0x7518('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x7518('0xe')],'chatStatusTime':this[_0x7518('0x10')],'chatCapacity':this[_0x7518('0x11')],'chatCurrentCapacity':this[_0x7518('0x12')],'mailStatus':this[_0x7518('0x13')],'mailStatusTime':this[_0x7518('0x14')],'mailCapacity':this[_0x7518('0x15')],'mailCurrentCapacity':this[_0x7518('0x16')],'faxStatus':this[_0x7518('0x17')],'faxStatusTime':this[_0x7518('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x7518('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x7518('0x1d')],'smsCurrentCapacity':this[_0x7518('0x34')],'whatsappStatus':this[_0x7518('0x1e')],'whatsappStatusTime':this[_0x7518('0x1f')],'whatsappCapacity':this[_0x7518('0x20')],'whatsappCurrentCapacity':this[_0x7518('0x21')],'openchannelStatus':this[_0x7518('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x7518('0x35')],'busyQueue':this[_0x7518('0x24')]};var _0x5daf0d=md5(JSON[_0x7518('0x36')](_0x34734a));if(this[_0x7518('0x37')]!==_0x5daf0d){this[_0x7518('0x37')]=_0x5daf0d;io['emit']('user:save',_0x34734a);}};module[_0x7518('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 63b154c..b5789da 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 _0x1027=['map','loggedIn','paused','length','online','available','stringify','chat:queue:%s','emit','exports','lodash','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr'];(function(_0x5d675d,_0x7ff323){var _0xa6ad63=function(_0x2d8b88){while(--_0x2d8b88){_0x5d675d['push'](_0x5d675d['shift']());}};_0xa6ad63(++_0x7ff323);}(_0x1027,0xac));var _0x7102=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x1027[_0x1ff2ec];return _0x405683;};'use strict';var _=require(_0x7102('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x7102('0x1'));var config=require(_0x7102('0x2'));config[_0x7102('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7102('0x4'))(new Redis(config[_0x7102('0x3')]));function ChatQueue(_0x5b5787){this['id']=_0x5b5787['id']||0x0;this['name']=_0x5b5787[_0x7102('0x5')]||'';this[_0x7102('0x6')]=_0x5b5787[_0x7102('0x6')]||0xa;this[_0x7102('0x7')]=_0x5b5787['strategy']||_0x7102('0x8');this[_0x7102('0x9')]=_0x5b5787[_0x7102('0x9')];this[_0x7102('0xa')]={};this[_0x7102('0xb')]=0x0;this[_0x7102('0xc')]='';this['updateRouting']();this[_0x7102('0xd')]();}ChatQueue[_0x7102('0xe')][_0x7102('0xf')]=function(){var _0x468249=this[_0x7102('0xa')][_0x7102('0x10')];this['mapAgentsId']=_[_0x7102('0x11')](this[_0x7102('0x9')],'id');this[_0x7102('0xa')]['_rr']=_0x468249;};ChatQueue[_0x7102('0xe')]['updateRealtime']=function(){this[_0x7102('0x12')]=0x0;this[_0x7102('0x13')]=0x0;for(var _0x112bf9=0x0;_0x112bf9=0x0?this['available']:0x0;var _0x950656={'id':this['id'],'available':this[_0x7102('0x16')],'loggedIn':this[_0x7102('0x12')],'name':this[_0x7102('0x5')],'paused':this[_0x7102('0x13')],'waiting':this[_0x7102('0xb')]};var _0x543010=md5(JSON[_0x7102('0x17')](_0x950656));if(this['md5']!==_0x543010){this[_0x7102('0xc')]=_0x543010;io['to'](util['format'](_0x7102('0x18'),_0x950656[_0x7102('0x5')]))[_0x7102('0x19')]('chat_queue:save',_0x950656);}};module[_0x7102('0x1a')]=ChatQueue; \ No newline at end of file +var _0xc431=['updateRealtime','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc431,0xb0));var _0x1c43=function(_0x5de0fe,_0x41b08f){_0x5de0fe=_0x5de0fe-0x0;var _0x206335=_0xc431[_0x5de0fe];return _0x206335;};'use strict';var _=require(_0x1c43('0x0'));var md5=require(_0x1c43('0x1'));var util=require(_0x1c43('0x2'));var Redis=require('ioredis');var config=require(_0x1c43('0x3'));config[_0x1c43('0x4')]=_['defaults'](config[_0x1c43('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x1c43('0x5'))(new Redis(config['redis']));function ChatQueue(_0x260f33){this['id']=_0x260f33['id']||0x0;this[_0x1c43('0x6')]=_0x260f33[_0x1c43('0x6')]||'';this[_0x1c43('0x7')]=_0x260f33[_0x1c43('0x7')]||0xa;this[_0x1c43('0x8')]=_0x260f33[_0x1c43('0x8')]||_0x1c43('0x9');this[_0x1c43('0xa')]=_0x260f33[_0x1c43('0xa')];this[_0x1c43('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x1c43('0xc')]();this[_0x1c43('0xd')]();}ChatQueue['prototype'][_0x1c43('0xc')]=function(){var _0x5bc20c=this[_0x1c43('0xb')]['_rr'];this[_0x1c43('0xb')]=_[_0x1c43('0xe')](this[_0x1c43('0xa')],'id');this[_0x1c43('0xb')][_0x1c43('0xf')]=_0x5bc20c;};ChatQueue['prototype'][_0x1c43('0xd')]=function(){this[_0x1c43('0x10')]=0x0;this[_0x1c43('0x11')]=0x0;for(var _0x208f3e=0x0;_0x208f3e=0x0?this[_0x1c43('0x15')]:0x0;var _0x5eb313={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1c43('0x10')],'name':this[_0x1c43('0x6')],'paused':this[_0x1c43('0x11')],'waiting':this['waiting']};var _0x5c44b6=md5(JSON[_0x1c43('0x16')](_0x5eb313));if(this['md5']!==_0x5c44b6){this[_0x1c43('0x1')]=_0x5c44b6;io['to'](util[_0x1c43('0x17')](_0x1c43('0x18'),_0x5eb313[_0x1c43('0x6')]))[_0x1c43('0x19')]('chat_queue:save',_0x5eb313);}};module[_0x1c43('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index ab32f29..ececde2 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 _0x428d=['defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','paused','length','online','available','stringify','format','fax:queue:%s','emit','exports','md5','util','ioredis','../../../config/environment','redis'];(function(_0x3f813b,_0x5884ab){var _0x566d6f=function(_0x5ebaee){while(--_0x5ebaee){_0x3f813b['push'](_0x3f813b['shift']());}};_0x566d6f(++_0x5884ab);}(_0x428d,0xf7));var _0xd428=function(_0x1c2cff,_0x5dab9a){_0x1c2cff=_0x1c2cff-0x0;var _0x24ae75=_0x428d[_0x1c2cff];return _0x24ae75;};'use strict';var _=require('lodash');var md5=require(_0xd428('0x0'));var util=require(_0xd428('0x1'));var Redis=require(_0xd428('0x2'));var config=require(_0xd428('0x3'));config[_0xd428('0x4')]=_[_0xd428('0x5')](config['redis'],{'host':_0xd428('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd428('0x4')]));function FaxQueue(_0x192c64){this['id']=_0x192c64['id']||0x0;this['name']=_0x192c64[_0xd428('0x7')]||'';this[_0xd428('0x8')]=_0x192c64[_0xd428('0x8')]||0xa;this[_0xd428('0x9')]=_0x192c64[_0xd428('0x9')]||'beepall';this['Agents']=_0x192c64[_0xd428('0xa')];this[_0xd428('0xb')]={};this[_0xd428('0xc')]=0x0;this[_0xd428('0x0')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue['prototype'][_0xd428('0xd')]=function(){var _0x496fac=this[_0xd428('0xb')][_0xd428('0xe')];this[_0xd428('0xb')]=_[_0xd428('0xf')](this[_0xd428('0xa')],'id');this[_0xd428('0xb')][_0xd428('0xe')]=_0x496fac;};FaxQueue[_0xd428('0x10')][_0xd428('0x11')]=function(){this[_0xd428('0x12')]=0x0;this[_0xd428('0x13')]=0x0;for(var _0x19e342=0x0;_0x19e342=0x0?this['available']:0x0;var _0x1c6c9b={'id':this['id'],'available':this[_0xd428('0x16')],'loggedIn':this[_0xd428('0x12')],'name':this['name'],'paused':this[_0xd428('0x13')],'waiting':this['waiting']};var _0x4907a5=md5(JSON[_0xd428('0x17')](_0x1c6c9b));if(this[_0xd428('0x0')]!==_0x4907a5){this[_0xd428('0x0')]=_0x4907a5;io['to'](util[_0xd428('0x18')](_0xd428('0x19'),_0x1c6c9b['name']))[_0xd428('0x1a')]('fax_queue:save',_0x1c6c9b);}};module[_0xd428('0x1b')]=FaxQueue; \ No newline at end of file +var _0x4abb=['_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype'];(function(_0x40f8f0,_0x2958a3){var _0x49e1bd=function(_0x799271){while(--_0x799271){_0x40f8f0['push'](_0x40f8f0['shift']());}};_0x49e1bd(++_0x2958a3);}(_0x4abb,0x86));var _0xb4ab=function(_0x11ccad,_0x1f99a6){_0x11ccad=_0x11ccad-0x0;var _0x5236ce=_0x4abb[_0x11ccad];return _0x5236ce;};'use strict';var _=require(_0xb4ab('0x0'));var md5=require(_0xb4ab('0x1'));var util=require(_0xb4ab('0x2'));var Redis=require(_0xb4ab('0x3'));var config=require('../../../config/environment');config[_0xb4ab('0x4')]=_[_0xb4ab('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb4ab('0x6'))(new Redis(config[_0xb4ab('0x4')]));function FaxQueue(_0x36f384){this['id']=_0x36f384['id']||0x0;this[_0xb4ab('0x7')]=_0x36f384[_0xb4ab('0x7')]||'';this[_0xb4ab('0x8')]=_0x36f384[_0xb4ab('0x8')]||0xa;this[_0xb4ab('0x9')]=_0x36f384[_0xb4ab('0x9')]||_0xb4ab('0xa');this['Agents']=_0x36f384[_0xb4ab('0xb')];this[_0xb4ab('0xc')]={};this[_0xb4ab('0xd')]=0x0;this[_0xb4ab('0x1')]='';this[_0xb4ab('0xe')]();this['updateRealtime']();}FaxQueue[_0xb4ab('0xf')][_0xb4ab('0xe')]=function(){var _0x2114b4=this[_0xb4ab('0xc')][_0xb4ab('0x10')];this[_0xb4ab('0xc')]=_[_0xb4ab('0x11')](this[_0xb4ab('0xb')],'id');this[_0xb4ab('0xc')][_0xb4ab('0x10')]=_0x2114b4;};FaxQueue[_0xb4ab('0xf')]['updateRealtime']=function(){this[_0xb4ab('0x12')]=0x0;this[_0xb4ab('0x13')]=0x0;for(var _0x4ce132=0x0;_0x4ce132=0x0?this['available']:0x0;var _0x2facae={'id':this['id'],'available':this[_0xb4ab('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xb4ab('0x7')],'paused':this[_0xb4ab('0x13')],'waiting':this[_0xb4ab('0xd')]};var _0x3ce01c=md5(JSON[_0xb4ab('0x18')](_0x2facae));if(this['md5']!==_0x3ce01c){this[_0xb4ab('0x1')]=_0x3ce01c;io['to'](util[_0xb4ab('0x19')](_0xb4ab('0x1a'),_0x2facae['name']))[_0xb4ab('0x1b')](_0xb4ab('0x1c'),_0x2facae);}};module[_0xb4ab('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 41e6985..f3a8228 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 _0xf3f5=['name','Intervals','exports'];(function(_0x5246b2,_0xf99187){var _0x395c0e=function(_0x4980e0){while(--_0x4980e0){_0x5246b2['push'](_0x5246b2['shift']());}};_0x395c0e(++_0xf99187);}(_0xf3f5,0x153));var _0x5f3f=function(_0x48588d,_0x5bf1e3){_0x48588d=_0x48588d-0x0;var _0x8981c1=_0xf3f5[_0x48588d];return _0x8981c1;};'use strict';function Interval(_0x442602){this['id']=_0x442602['id']||0x0;this[_0x5f3f('0x0')]=_0x442602['name']||'';this[_0x5f3f('0x1')]=_0x442602['Intervals']||{};}module[_0x5f3f('0x2')]=Interval; \ No newline at end of file +var _0x88a6=['name','Intervals','exports'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x88a6,0x9c));var _0x688a=function(_0x4e566c,_0x16e04c){_0x4e566c=_0x4e566c-0x0;var _0x31947e=_0x88a6[_0x4e566c];return _0x31947e;};'use strict';function Interval(_0x5550cf){this['id']=_0x5550cf['id']||0x0;this[_0x688a('0x0')]=_0x5550cf[_0x688a('0x0')]||'';this[_0x688a('0x1')]=_0x5550cf[_0x688a('0x1')]||{};}module[_0x688a('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 6883356..4667853 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 _0x0ede=['../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','paused','available','waiting','format','mail:queue:%s','mail_queue:save','exports','md5','util','ioredis'];(function(_0xb9c540,_0x434470){var _0x8d4bde=function(_0x590978){while(--_0x590978){_0xb9c540['push'](_0xb9c540['shift']());}};_0x8d4bde(++_0x434470);}(_0x0ede,0x192));var _0xe0ed=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0ede[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var md5=require(_0xe0ed('0x0'));var util=require(_0xe0ed('0x1'));var Redis=require(_0xe0ed('0x2'));var config=require(_0xe0ed('0x3'));config[_0xe0ed('0x4')]=_['defaults'](config[_0xe0ed('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe0ed('0x5'))(new Redis(config[_0xe0ed('0x4')]));function MailQueue(_0x33efce){this['id']=_0x33efce['id']||0x0;this['name']=_0x33efce[_0xe0ed('0x6')]||'';this[_0xe0ed('0x7')]=_0x33efce[_0xe0ed('0x7')]||0xa;this['strategy']=_0x33efce[_0xe0ed('0x8')]||_0xe0ed('0x9');this[_0xe0ed('0xa')]=_0x33efce['Agents'];this[_0xe0ed('0xb')]={};this['waiting']=0x0;this[_0xe0ed('0x0')]='';this[_0xe0ed('0xc')]();this['updateRealtime']();}MailQueue[_0xe0ed('0xd')][_0xe0ed('0xc')]=function(){var _0x322042=this[_0xe0ed('0xb')][_0xe0ed('0xe')];this['mapAgentsId']=_[_0xe0ed('0xf')](this['Agents'],'id');this[_0xe0ed('0xb')][_0xe0ed('0xe')]=_0x322042;};MailQueue[_0xe0ed('0xd')][_0xe0ed('0x10')]=function(){this[_0xe0ed('0x11')]=0x0;this['paused']=0x0;for(var _0x57cae7=0x0;_0x57cae7=0x0?this[_0xe0ed('0x15')]:0x0;var _0xdbd1e7={'id':this['id'],'available':this[_0xe0ed('0x15')],'loggedIn':this[_0xe0ed('0x11')],'name':this[_0xe0ed('0x6')],'paused':this['paused'],'waiting':this[_0xe0ed('0x16')]};var _0x5ac94c=md5(JSON['stringify'](_0xdbd1e7));if(this[_0xe0ed('0x0')]!==_0x5ac94c){this['md5']=_0x5ac94c;io['to'](util[_0xe0ed('0x17')](_0xe0ed('0x18'),_0xdbd1e7[_0xe0ed('0x6')]))['emit'](_0xe0ed('0x19'),_0xdbd1e7);}};module[_0xe0ed('0x1a')]=MailQueue; \ No newline at end of file +var _0x71ba=['localhost','socket.io-emitter','name','timeout','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','map','_rr','prototype','loggedIn','online','mailPause','paused','available','stringify','format','emit','exports','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x4e5bf2,_0x2019d2){var _0xfea14f=function(_0x197cec){while(--_0x197cec){_0x4e5bf2['push'](_0x4e5bf2['shift']());}};_0xfea14f(++_0x2019d2);}(_0x71ba,0xf6));var _0xa71b=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0x71ba[_0xfb65aa];return _0x2aee31;};'use strict';var _=require('lodash');var md5=require(_0xa71b('0x0'));var util=require(_0xa71b('0x1'));var Redis=require(_0xa71b('0x2'));var config=require(_0xa71b('0x3'));config[_0xa71b('0x4')]=_[_0xa71b('0x5')](config['redis'],{'host':_0xa71b('0x6'),'port':0x18eb});var io=require(_0xa71b('0x7'))(new Redis(config[_0xa71b('0x4')]));function MailQueue(_0x911dbc){this['id']=_0x911dbc['id']||0x0;this[_0xa71b('0x8')]=_0x911dbc[_0xa71b('0x8')]||'';this[_0xa71b('0x9')]=_0x911dbc[_0xa71b('0x9')]||0xa;this['strategy']=_0x911dbc['strategy']||_0xa71b('0xa');this[_0xa71b('0xb')]=_0x911dbc['Agents'];this['mapAgentsId']={};this[_0xa71b('0xc')]=0x0;this['md5']='';this[_0xa71b('0xd')]();this[_0xa71b('0xe')]();}MailQueue['prototype']['updateRouting']=function(){var _0x3e7066=this[_0xa71b('0xf')]['_rr'];this[_0xa71b('0xf')]=_[_0xa71b('0x10')](this[_0xa71b('0xb')],'id');this[_0xa71b('0xf')][_0xa71b('0x11')]=_0x3e7066;};MailQueue[_0xa71b('0x12')]['updateRealtime']=function(){this[_0xa71b('0x13')]=0x0;this['paused']=0x0;for(var _0x41e6ad=0x0;_0x41e6ad=0x0?this[_0xa71b('0x17')]:0x0;var _0x42df5a={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa71b('0x8')],'paused':this[_0xa71b('0x16')],'waiting':this[_0xa71b('0xc')]};var _0x4cf604=md5(JSON[_0xa71b('0x18')](_0x42df5a));if(this[_0xa71b('0x0')]!==_0x4cf604){this[_0xa71b('0x0')]=_0x4cf604;io['to'](util[_0xa71b('0x19')]('mail:queue:%s',_0x42df5a[_0xa71b('0x8')]))[_0xa71b('0x1a')]('mail_queue:save',_0x42df5a);}};module[_0xa71b('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index e4973bb..44a0910 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0xfb845c,_0x1945ff){var _0x3ca188=function(_0x28fbc6){while(--_0x28fbc6){_0xfb845c['push'](_0xfb845c['shift']());}};_0x3ca188(++_0x1945ff);}(_0x5fc3,0xa8));var _0x35fc=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0x5fc3[_0x254abd];return _0x31bf1b;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x2ef3,0xba));var _0x32ef=function(_0x3e2a3e,_0x6e8350){_0x3e2a3e=_0x3e2a3e-0x0;var _0x4756bb=_0x2ef3[_0x3e2a3e];return _0x4756bb;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ce36a6f..b1c84eb 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2ff=['smsPause','available','sms:queue:%s','sms_queue:save','exports','lodash','md5','ioredis','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length','online'];(function(_0x435d6c,_0x4871fa){var _0xe93e42=function(_0x20d6ba){while(--_0x20d6ba){_0x435d6c['push'](_0x435d6c['shift']());}};_0xe93e42(++_0x4871fa);}(_0xb2ff,0x123));var _0xfb2f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb2ff[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xfb2f('0x0'));var md5=require(_0xfb2f('0x1'));var util=require('util');var Redis=require(_0xfb2f('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xfb2f('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xfb2f('0x4'))(new Redis(config[_0xfb2f('0x3')]));function SmsQueue(_0x3c5835){this['id']=_0x3c5835['id']||0x0;this[_0xfb2f('0x5')]=_0x3c5835['name']||'';this['timeout']=_0x3c5835[_0xfb2f('0x6')]||0xa;this['strategy']=_0x3c5835[_0xfb2f('0x7')]||_0xfb2f('0x8');this[_0xfb2f('0x9')]=_0x3c5835[_0xfb2f('0x9')];this['mapAgentsId']={};this[_0xfb2f('0xa')]=0x0;this['md5']='';this[_0xfb2f('0xb')]();this['updateRealtime']();}SmsQueue[_0xfb2f('0xc')][_0xfb2f('0xb')]=function(){var _0x31ffea=this[_0xfb2f('0xd')][_0xfb2f('0xe')];this['mapAgentsId']=_[_0xfb2f('0xf')](this[_0xfb2f('0x9')],'id');this[_0xfb2f('0xd')][_0xfb2f('0xe')]=_0x31ffea;};SmsQueue[_0xfb2f('0xc')][_0xfb2f('0x10')]=function(){this[_0xfb2f('0x11')]=0x0;this[_0xfb2f('0x12')]=0x0;for(var _0x5f3893=0x0;_0x5f3893=0x0?this[_0xfb2f('0x16')]:0x0;var _0x239a88={'id':this['id'],'available':this['available'],'loggedIn':this[_0xfb2f('0x11')],'name':this[_0xfb2f('0x5')],'paused':this[_0xfb2f('0x12')],'waiting':this[_0xfb2f('0xa')]};var _0x448216=md5(JSON['stringify'](_0x239a88));if(this['md5']!==_0x448216){this[_0xfb2f('0x1')]=_0x448216;io['to'](util['format'](_0xfb2f('0x17'),_0x239a88['name']))['emit'](_0xfb2f('0x18'),_0x239a88);}};module[_0xfb2f('0x19')]=SmsQueue; \ No newline at end of file +var _0xdace=['sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','available','stringify','md5','format','sms:queue:%s','emit'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0xdace,0xc5));var _0xedac=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0xdace[_0x3bef2c];return _0x331503;};'use strict';var _=require(_0xedac('0x0'));var md5=require('md5');var util=require(_0xedac('0x1'));var Redis=require(_0xedac('0x2'));var config=require(_0xedac('0x3'));config['redis']=_[_0xedac('0x4')](config[_0xedac('0x5')],{'host':_0xedac('0x6'),'port':0x18eb});var io=require(_0xedac('0x7'))(new Redis(config['redis']));function SmsQueue(_0x32b066){this['id']=_0x32b066['id']||0x0;this[_0xedac('0x8')]=_0x32b066[_0xedac('0x8')]||'';this['timeout']=_0x32b066[_0xedac('0x9')]||0xa;this[_0xedac('0xa')]=_0x32b066[_0xedac('0xa')]||'beepall';this[_0xedac('0xb')]=_0x32b066[_0xedac('0xb')];this[_0xedac('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xedac('0xd')]();this[_0xedac('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x4db2ad=this[_0xedac('0xc')]['_rr'];this[_0xedac('0xc')]=_['map'](this[_0xedac('0xb')],'id');this[_0xedac('0xc')][_0xedac('0xf')]=_0x4db2ad;};SmsQueue[_0xedac('0x10')][_0xedac('0xe')]=function(){this[_0xedac('0x11')]=0x0;this[_0xedac('0x12')]=0x0;for(var _0x11f0b0=0x0;_0x11f0b0=0x0?this['available']:0x0;var _0x4b2563={'id':this['id'],'available':this[_0xedac('0x15')],'loggedIn':this[_0xedac('0x11')],'name':this[_0xedac('0x8')],'paused':this[_0xedac('0x12')],'waiting':this['waiting']};var _0x4a699b=md5(JSON[_0xedac('0x16')](_0x4b2563));if(this[_0xedac('0x17')]!==_0x4a699b){this[_0xedac('0x17')]=_0x4a699b;io['to'](util[_0xedac('0x18')](_0xedac('0x19'),_0x4b2563[_0xedac('0x8')]))[_0xedac('0x1a')](_0xedac('0x1b'),_0x4b2563);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 8eeada6..c49a281 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 _0x2579=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults'];(function(_0x1790dc,_0x15fa5a){var _0x20ac30=function(_0x503b24){while(--_0x503b24){_0x1790dc['push'](_0x1790dc['shift']());}};_0x20ac30(++_0x15fa5a);}(_0x2579,0x130));var _0x9257=function(_0x1c3310,_0xfea273){_0x1c3310=_0x1c3310-0x0;var _0x4f77b2=_0x2579[_0x1c3310];return _0x4f77b2;};'use strict';var _=require(_0x9257('0x0'));var md5=require(_0x9257('0x1'));var util=require(_0x9257('0x2'));var Redis=require('ioredis');var config=require(_0x9257('0x3'));config[_0x9257('0x4')]=_[_0x9257('0x5')](config[_0x9257('0x4')],{'host':_0x9257('0x6'),'port':0x18eb});var io=require(_0x9257('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x3b514d){this['id']=_0x3b514d['id']||0x0;this['name']=_0x3b514d[_0x9257('0x8')]||'';this[_0x9257('0x9')]=_0x3b514d['timeout']||0xa;this['strategy']=_0x3b514d[_0x9257('0xa')]||_0x9257('0xb');this[_0x9257('0xc')]=_0x3b514d[_0x9257('0xc')];this[_0x9257('0xd')]={};this[_0x9257('0xe')]=0x0;this['md5']='';this[_0x9257('0xf')]();this[_0x9257('0x10')]();}WhatsappQueue['prototype'][_0x9257('0xf')]=function(){var _0x107864=this[_0x9257('0xd')][_0x9257('0x11')];this['mapAgentsId']=_[_0x9257('0x12')](this[_0x9257('0xc')],'id');this[_0x9257('0xd')][_0x9257('0x11')]=_0x107864;};WhatsappQueue[_0x9257('0x13')]['updateRealtime']=function(){this[_0x9257('0x14')]=0x0;this[_0x9257('0x15')]=0x0;for(var _0x2fb138=0x0;_0x2fb138=0x0?this[_0x9257('0x18')]:0x0;var _0x2b99ef={'id':this['id'],'available':this[_0x9257('0x18')],'loggedIn':this[_0x9257('0x14')],'name':this[_0x9257('0x8')],'paused':this[_0x9257('0x15')],'waiting':this[_0x9257('0xe')]};var _0xd1dc37=md5(JSON[_0x9257('0x19')](_0x2b99ef));if(this[_0x9257('0x1')]!==_0xd1dc37){this[_0x9257('0x1')]=_0xd1dc37;io['to'](util[_0x9257('0x1a')](_0x9257('0x1b'),_0x2b99ef[_0x9257('0x8')]))[_0x9257('0x1c')](_0x9257('0x1d'),_0x2b99ef);}};module[_0x9257('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0xb164=['paused','waiting','whatsapp:queue:%s','emit','whatsapp_queue:save','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','mapAgentsId','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','length','online','whatsappPause','available'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb164,0x14a));var _0x4b16=function(_0x2acea6,_0x5b84e0){_0x2acea6=_0x2acea6-0x0;var _0x118a0a=_0xb164[_0x2acea6];return _0x118a0a;};'use strict';var _=require('lodash');var md5=require(_0x4b16('0x0'));var util=require(_0x4b16('0x1'));var Redis=require('ioredis');var config=require(_0x4b16('0x2'));config[_0x4b16('0x3')]=_[_0x4b16('0x4')](config['redis'],{'host':_0x4b16('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4b16('0x3')]));function WhatsappQueue(_0x37862c){this['id']=_0x37862c['id']||0x0;this[_0x4b16('0x6')]=_0x37862c[_0x4b16('0x6')]||'';this[_0x4b16('0x7')]=_0x37862c['timeout']||0xa;this['strategy']=_0x37862c['strategy']||'beepall';this['Agents']=_0x37862c['Agents'];this[_0x4b16('0x8')]={};this['waiting']=0x0;this[_0x4b16('0x0')]='';this[_0x4b16('0x9')]();this[_0x4b16('0xa')]();}WhatsappQueue[_0x4b16('0xb')][_0x4b16('0x9')]=function(){var _0x3f696c=this[_0x4b16('0x8')]['_rr'];this[_0x4b16('0x8')]=_[_0x4b16('0xc')](this[_0x4b16('0xd')],'id');this[_0x4b16('0x8')][_0x4b16('0xe')]=_0x3f696c;};WhatsappQueue[_0x4b16('0xb')][_0x4b16('0xa')]=function(){this[_0x4b16('0xf')]=0x0;this['paused']=0x0;for(var _0x1999c7=0x0;_0x1999c7=0x0?this[_0x4b16('0x13')]:0x0;var _0x5dc85a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4b16('0xf')],'name':this['name'],'paused':this[_0x4b16('0x14')],'waiting':this[_0x4b16('0x15')]};var _0x5e21ec=md5(JSON['stringify'](_0x5dc85a));if(this[_0x4b16('0x0')]!==_0x5e21ec){this[_0x4b16('0x0')]=_0x5e21ec;io['to'](util['format'](_0x4b16('0x16'),_0x5dc85a[_0x4b16('0x6')]))[_0x4b16('0x17')](_0x4b16('0x18'),_0x5dc85a);}};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 d5b6376..2efd8eb 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _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(_0xd060ad,_0xe4c68e){var _0x4f3489=function(_0x5ebffb){while(--_0x5ebffb){_0xd060ad['push'](_0xd060ad['shift']());}};_0x4f3489(++_0xe4c68e);}(_0xb10b,0x12a));var _0xbb10=function(_0x3411a4,_0x60d585){_0x3411a4=_0x3411a4-0x0;var _0x4eb325=_0xb10b[_0x3411a4];return _0x4eb325;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index bf0b2c9..1cfbd6f 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 _0xf522=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','AddTagsToChatInteraction'];(function(_0x4f0ec4,_0x145416){var _0x3f1e36=function(_0x3b5a53){while(--_0x3b5a53){_0x4f0ec4['push'](_0x4f0ec4['shift']());}};_0x3f1e36(++_0x145416);}(_0xf522,0xf1));var _0x2f52=function(_0xeb7b0f,_0x472f9d){_0xeb7b0f=_0xeb7b0f-0x0;var _0x525c66=_0xf522[_0xeb7b0f];return _0x525c66;};'use strict';var client=require(_0x2f52('0x0'));exports[_0x2f52('0x1')]=function(_0x5bd2cb,_0x7580b7){return client[_0x2f52('0x2')](_0x2f52('0x3'),{'body':_0x7580b7,'options':{'where':{'id':_0x5bd2cb}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x346404,_0x6923d7){return client[_0x2f52('0x2')](_0x2f52('0x4'),{'body':_0x6923d7,'options':{'where':{'id':_0x346404}},'log':_0x2f52('0x5')});}; \ No newline at end of file +var _0xad10=['AddTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xad10,0x109));var _0x0ad1=function(_0x578106,_0x265ed0){_0x578106=_0x578106-0x0;var _0x52e5b8=_0xad10[_0x578106];return _0x52e5b8;};'use strict';var client=require(_0x0ad1('0x0'));exports['update']=function(_0x5249ea,_0x31de16){return client[_0x0ad1('0x1')](_0x0ad1('0x2'),{'body':_0x31de16,'options':{'where':{'id':_0x5249ea}},'log':_0x0ad1('0x3')});};exports[_0x0ad1('0x4')]=function(_0x2d53d9,_0x2e3c5){return client[_0x0ad1('0x1')](_0x0ad1('0x5'),{'body':_0x2e3c5,'options':{'where':{'id':_0x2d53d9}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a28da28..25ac3c9 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 _0x1986=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x1405e3,_0x1ff52d){var _0x5a240e=function(_0x405b9b){while(--_0x405b9b){_0x1405e3['push'](_0x1405e3['shift']());}};_0x5a240e(++_0x1ff52d);}(_0x1986,0x1ea));var _0x6198=function(_0x591d76,_0x3bbdb0){_0x591d76=_0x591d76-0x0;var _0x597835=_0x1986[_0x591d76];return _0x597835;};'use strict';var client=require(_0x6198('0x0'));exports[_0x6198('0x1')]=function(_0x460634){return client[_0x6198('0x2')](_0x6198('0x3'),{'body':_0x460634,'log':_0x6198('0x4')});}; \ No newline at end of file +var _0x711f=['CreateChatMessage','createChatMessage','create','Request'];(function(_0x3d24ea,_0x440f29){var _0x44d9b3=function(_0x35de76){while(--_0x35de76){_0x3d24ea['push'](_0x3d24ea['shift']());}};_0x44d9b3(++_0x440f29);}(_0x711f,0x1b6));var _0xf711=function(_0x362a9c,_0x434fd5){_0x362a9c=_0x362a9c-0x0;var _0x159079=_0x711f[_0x362a9c];return _0x159079;};'use strict';var client=require('../client');exports[_0xf711('0x0')]=function(_0x5cf0f5){return client[_0xf711('0x1')](_0xf711('0x2'),{'body':_0x5cf0f5,'log':_0xf711('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 6fd6cb6..255a57f 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 _0x7c1f=['User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy'];(function(_0x174002,_0x56b6a1){var _0x7c2308=function(_0x52baf8){while(--_0x52baf8){_0x174002['push'](_0x174002['shift']());}};_0x7c2308(++_0x56b6a1);}(_0x7c1f,0x194));var _0xf7c1=function(_0x4a9ad4,_0x3d8e06){_0x4a9ad4=_0x4a9ad4-0x0;var _0x28efbe=_0x7c1f[_0x4a9ad4];return _0x28efbe;};'use strict';var client=require(_0xf7c1('0x0'));exports[_0xf7c1('0x1')]=function(){return function(){return client[_0xf7c1('0x2')](_0xf7c1('0x3'),{'options':{'raw':![],'attributes':['id',_0xf7c1('0x4'),'timeout',_0xf7c1('0x5')],'include':[{'model':_0xf7c1('0x6'),'as':_0xf7c1('0x7'),'attributes':['id','name',_0xf7c1('0x8'),_0xf7c1('0x9')]}]},'log':_0xf7c1('0x1')});};}; \ No newline at end of file +var _0x004c=['Request','GetChatQueue','timeout','strategy','User','Agents','online','../client','getChatQueues'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x004c,0x85));var _0xc004=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x004c[_0x44bcb0];return _0xfaf881;};'use strict';var client=require(_0xc004('0x0'));exports[_0xc004('0x1')]=function(){return function(){return client[_0xc004('0x2')](_0xc004('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xc004('0x4'),_0xc004('0x5')],'include':[{'model':_0xc004('0x6'),'as':_0xc004('0x7'),'attributes':['id','name',_0xc004('0x8'),'chatPause']}]},'log':_0xc004('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 24cdf87..515e744 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 _0x8f37=['CreateChatQueueReport','update','Request','DESC','../client','create'];(function(_0x1d4180,_0x27e84f){var _0x5ba9d2=function(_0xf3c6b4){while(--_0xf3c6b4){_0x1d4180['push'](_0x1d4180['shift']());}};_0x5ba9d2(++_0x27e84f);}(_0x8f37,0x190));var _0x78f3=function(_0x3cd0b7,_0x365f5d){_0x3cd0b7=_0x3cd0b7-0x0;var _0x16f72b=_0x8f37[_0x3cd0b7];return _0x16f72b;};'use strict';var client=require(_0x78f3('0x0'));exports[_0x78f3('0x1')]=function(_0x351c4f){return client['Request']('CreateChatQueueReport',{'body':_0x351c4f,'log':_0x78f3('0x2')});};exports[_0x78f3('0x3')]=function(_0x3b0667,_0x539794){return client[_0x78f3('0x4')]('UpdateChatQueueReport',{'body':_0x539794,'options':{'where':{'uniqueid':_0x3b0667},'order':[['id',_0x78f3('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x0487=['create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC','../client'];(function(_0x52f567,_0x3728a3){var _0x57f36f=function(_0x5b0f76){while(--_0x5b0f76){_0x52f567['push'](_0x52f567['shift']());}};_0x57f36f(++_0x3728a3);}(_0x0487,0x14f));var _0x7048=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x0487[_0x912d27];return _0x31b918;};'use strict';var client=require(_0x7048('0x0'));exports[_0x7048('0x1')]=function(_0x438ba4){return client[_0x7048('0x2')](_0x7048('0x3'),{'body':_0x438ba4,'log':_0x7048('0x3')});};exports['update']=function(_0x2adc11,_0x4e8f94){return client[_0x7048('0x2')](_0x7048('0x4'),{'body':_0x4e8f94,'options':{'where':{'uniqueid':_0x2adc11},'order':[['id',_0x7048('0x5')]],'limit':0x1},'log':_0x7048('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6448226..2eb2c24 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x11527f,_0x26bfda){var _0x40df18=function(_0x2eaba9){while(--_0x2eaba9){_0x11527f['push'](_0x11527f['shift']());}};_0x40df18(++_0x26bfda);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x7a54,0x106));var _0x47a5=function(_0x28ac05,_0x2998ce){_0x28ac05=_0x28ac05-0x0;var _0x238d6c=_0x7a54[_0x28ac05];return _0x238d6c;};'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 903cd54..7dd3a56 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 _0x0147=['create','Request','createFaxMessage','../client'];(function(_0x421759,_0x483b78){var _0x50f1d2=function(_0x5936e0){while(--_0x5936e0){_0x421759['push'](_0x421759['shift']());}};_0x50f1d2(++_0x483b78);}(_0x0147,0x1ef));var _0x7014=function(_0x53524f,_0x16d8ba){_0x53524f=_0x53524f-0x0;var _0x47b996=_0x0147[_0x53524f];return _0x47b996;};'use strict';var client=require(_0x7014('0x0'));exports[_0x7014('0x1')]=function(_0x26c775){return client[_0x7014('0x2')]('CreateFaxMessage',{'body':_0x26c775,'log':_0x7014('0x3')});}; \ No newline at end of file +var _0xb180=['../client','create','Request','CreateFaxMessage'];(function(_0xc0a3da,_0x5afb16){var _0x124159=function(_0x3b4788){while(--_0x3b4788){_0xc0a3da['push'](_0xc0a3da['shift']());}};_0x124159(++_0x5afb16);}(_0xb180,0x154));var _0x0b18=function(_0x4e7531,_0x363fcc){_0x4e7531=_0x4e7531-0x0;var _0x43f51e=_0xb180[_0x4e7531];return _0x43f51e;};'use strict';var client=require(_0x0b18('0x0'));exports[_0x0b18('0x1')]=function(_0x1e45ae){return client[_0x0b18('0x2')](_0x0b18('0x3'),{'body':_0x1e45ae,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 44be2ce..7e95a3e 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 _0x9337=['Request','GetFaxQueue','name','timeout','strategy','Agents','online','faxPause','getFaxQueues'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0x9337,0x104));var _0x7933=function(_0x4ccd94,_0x159861){_0x4ccd94=_0x4ccd94-0x0;var _0xf9ed98=_0x9337[_0x4ccd94];return _0xf9ed98;};'use strict';var client=require('../client');exports[_0x7933('0x0')]=function(){return function(){return client[_0x7933('0x1')](_0x7933('0x2'),{'options':{'raw':![],'attributes':['id',_0x7933('0x3'),_0x7933('0x4'),_0x7933('0x5')],'include':[{'model':'User','as':_0x7933('0x6'),'attributes':['id','name',_0x7933('0x7'),_0x7933('0x8')]}]},'log':_0x7933('0x0')});};}; \ No newline at end of file +var _0x4e97=['getFaxQueues','GetFaxQueue','name','timeout','strategy','Agents','online','../client'];(function(_0x476f57,_0x2d5d1b){var _0x58d36a=function(_0x4a4419){while(--_0x4a4419){_0x476f57['push'](_0x476f57['shift']());}};_0x58d36a(++_0x2d5d1b);}(_0x4e97,0x97));var _0x74e9=function(_0x29dcef,_0x3a4754){_0x29dcef=_0x29dcef-0x0;var _0x169a44=_0x4e97[_0x29dcef];return _0x169a44;};'use strict';var client=require(_0x74e9('0x0'));exports[_0x74e9('0x1')]=function(){return function(){return client['Request'](_0x74e9('0x2'),{'options':{'raw':![],'attributes':['id',_0x74e9('0x3'),_0x74e9('0x4'),_0x74e9('0x5')],'include':[{'model':'User','as':_0x74e9('0x6'),'attributes':['id','name',_0x74e9('0x7'),'faxPause']}]},'log':_0x74e9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0d5de32..c7499c6 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 _0x7337=['../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x8db570,_0x2a2c15){var _0x3b604d=function(_0x13427b){while(--_0x13427b){_0x8db570['push'](_0x8db570['shift']());}};_0x3b604d(++_0x2a2c15);}(_0x7337,0x7d));var _0x7733=function(_0xe1b3c8,_0x3be066){_0xe1b3c8=_0xe1b3c8-0x0;var _0x3d3884=_0x7337[_0xe1b3c8];return _0x3d3884;};'use strict';var client=require(_0x7733('0x0'));exports['create']=function(_0x132a11){return client[_0x7733('0x1')]('CreateFaxQueueReport',{'body':_0x132a11,'log':_0x7733('0x2')});};exports[_0x7733('0x3')]=function(_0x119628,_0x5baa2d){return client[_0x7733('0x1')](_0x7733('0x4'),{'body':_0x5baa2d,'options':{'where':{'uniqueid':_0x119628},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x3bb2=['DESC','../client','create','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0xdaf2cc,_0x21434b){var _0x1c5e61=function(_0x23a186){while(--_0x23a186){_0xdaf2cc['push'](_0xdaf2cc['shift']());}};_0x1c5e61(++_0x21434b);}(_0x3bb2,0x1f3));var _0x23bb=function(_0x11fb49,_0x3909d5){_0x11fb49=_0x11fb49-0x0;var _0x4c959a=_0x3bb2[_0x11fb49];return _0x4c959a;};'use strict';var client=require(_0x23bb('0x0'));exports[_0x23bb('0x1')]=function(_0xa9f3eb){return client['Request'](_0x23bb('0x2'),{'body':_0xa9f3eb,'log':_0x23bb('0x2')});};exports[_0x23bb('0x3')]=function(_0x51ce26,_0x690e50){return client['Request'](_0x23bb('0x4'),{'body':_0x690e50,'options':{'where':{'uniqueid':_0x51ce26},'order':[['id',_0x23bb('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 05d4f20..48476ab 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 _0x2712=['Request','GetInterval','name','Interval','interval','getIntervals','../client'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x2712,0x1cd));var _0x2271=function(_0x4c466d,_0x5cbd58){_0x4c466d=_0x4c466d-0x0;var _0x312024=_0x2712[_0x4c466d];return _0x312024;};'use strict';var client=require(_0x2271('0x0'));exports['getIntervals']=function(){return function(){return client[_0x2271('0x1')](_0x2271('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x2271('0x3')],'include':[{'model':_0x2271('0x4'),'as':'Intervals','attributes':['id',_0x2271('0x3'),_0x2271('0x5')]}]},'log':_0x2271('0x6')});};}; \ No newline at end of file +var _0xed8b=['Interval','getIntervals','Request','name'];(function(_0x3e8d2a,_0x26898f){var _0x51cb91=function(_0x49b4c2){while(--_0x49b4c2){_0x3e8d2a['push'](_0x3e8d2a['shift']());}};_0x51cb91(++_0x26898f);}(_0xed8b,0x10a));var _0xbed8=function(_0x1837d6,_0x67b9c7){_0x1837d6=_0x1837d6-0x0;var _0xf9f011=_0xed8b[_0x1837d6];return _0xf9f011;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0xbed8('0x0')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xbed8('0x1')],'include':[{'model':_0xbed8('0x2'),'as':'Intervals','attributes':['id',_0xbed8('0x1'),'interval']}]},'log':_0xbed8('0x3')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ff578a7..167eeb9 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 _0x3de3=['../client','UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction'];(function(_0x269eba,_0x38828c){var _0x25f3d6=function(_0x1e20ae){while(--_0x1e20ae){_0x269eba['push'](_0x269eba['shift']());}};_0x25f3d6(++_0x38828c);}(_0x3de3,0x1ce));var _0x33de=function(_0x325e24,_0x7a8eff){_0x325e24=_0x325e24-0x0;var _0x20afa2=_0x3de3[_0x325e24];return _0x20afa2;};'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 +var _0x2da6=['UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x5f3a6c,_0x3b01ee){var _0x2c2d08=function(_0x38885d){while(--_0x38885d){_0x5f3a6c['push'](_0x5f3a6c['shift']());}};_0x2c2d08(++_0x3b01ee);}(_0x2da6,0x1dd));var _0x62da=function(_0x1946d3,_0x4f3fe0){_0x1946d3=_0x1946d3-0x0;var _0x49c71a=_0x2da6[_0x1946d3];return _0x49c71a;};'use strict';var client=require(_0x62da('0x0'));exports[_0x62da('0x1')]=function(_0x1d3698,_0xbbb39b){return client[_0x62da('0x2')](_0x62da('0x3'),{'body':_0xbbb39b,'options':{'where':{'id':_0x1d3698}},'log':_0x62da('0x4')});};exports[_0x62da('0x5')]=function(_0x4c079d,_0x4a8428){return client[_0x62da('0x2')](_0x62da('0x6'),{'body':_0x4a8428,'options':{'where':{'id':_0x4c079d}},'log':_0x62da('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index e705bc5..d1373b1 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 _0xfb54=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x1eb822,_0x80c6a6){var _0x495499=function(_0xfb4653){while(--_0xfb4653){_0x1eb822['push'](_0x1eb822['shift']());}};_0x495499(++_0x80c6a6);}(_0xfb54,0x1e8));var _0x4fb5=function(_0x75595f,_0x477cfb){_0x75595f=_0x75595f-0x0;var _0x4d71fd=_0xfb54[_0x75595f];return _0x4d71fd;};'use strict';var client=require(_0x4fb5('0x0'));exports[_0x4fb5('0x1')]=function(_0x43890a){return client['Request'](_0x4fb5('0x2'),{'body':_0x43890a,'log':_0x4fb5('0x3')});}; \ No newline at end of file +var _0x6957=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x3f14e7,_0x4cb627){var _0x4f4a61=function(_0x240e0e){while(--_0x240e0e){_0x3f14e7['push'](_0x3f14e7['shift']());}};_0x4f4a61(++_0x4cb627);}(_0x6957,0x109));var _0x7695=function(_0x34b2ee,_0x14d55c){_0x34b2ee=_0x34b2ee-0x0;var _0x2cf18a=_0x6957[_0x34b2ee];return _0x2cf18a;};'use strict';var client=require(_0x7695('0x0'));exports['create']=function(_0x40996c){return client[_0x7695('0x1')](_0x7695('0x2'),{'body':_0x40996c,'log':_0x7695('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 293308e..d4369e2 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 _0x38d5=['Agents','online','mailPause','../client','Request','GetMailQueue','name','timeout','strategy'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0x38d5,0x66));var _0x538d=function(_0x48a847,_0x2e9451){_0x48a847=_0x48a847-0x0;var _0xa6a5c2=_0x38d5[_0x48a847];return _0xa6a5c2;};'use strict';var client=require(_0x538d('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x538d('0x1')](_0x538d('0x2'),{'options':{'raw':![],'attributes':['id',_0x538d('0x3'),_0x538d('0x4'),_0x538d('0x5')],'include':[{'model':'User','as':_0x538d('0x6'),'attributes':['id',_0x538d('0x3'),_0x538d('0x7'),_0x538d('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xc868=['strategy','User','Agents','name','online','mailPause','../client','Request','timeout'];(function(_0x230980,_0x29a309){var _0x434351=function(_0x314906){while(--_0x314906){_0x230980['push'](_0x230980['shift']());}};_0x434351(++_0x29a309);}(_0xc868,0x1ec));var _0x8c86=function(_0xd78cb5,_0x257a7c){_0xd78cb5=_0xd78cb5-0x0;var _0x586d05=_0xc868[_0xd78cb5];return _0x586d05;};'use strict';var client=require(_0x8c86('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x8c86('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x8c86('0x2'),_0x8c86('0x3')],'include':[{'model':_0x8c86('0x4'),'as':_0x8c86('0x5'),'attributes':['id',_0x8c86('0x6'),_0x8c86('0x7'),_0x8c86('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c13d567..6908159 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 _0x227e=['update','UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport'];(function(_0x56d5d4,_0x229572){var _0x1a7819=function(_0x45ee47){while(--_0x45ee47){_0x56d5d4['push'](_0x56d5d4['shift']());}};_0x1a7819(++_0x229572);}(_0x227e,0x195));var _0xe227=function(_0xf5aaa4,_0x14b73a){_0xf5aaa4=_0xf5aaa4-0x0;var _0x5ed623=_0x227e[_0xf5aaa4];return _0x5ed623;};'use strict';var client=require(_0xe227('0x0'));exports[_0xe227('0x1')]=function(_0x3a363a){return client['Request'](_0xe227('0x2'),{'body':_0x3a363a,'log':'CreateMailQueueReport'});};exports[_0xe227('0x3')]=function(_0x438946,_0x34a638){return client['Request'](_0xe227('0x4'),{'body':_0x34a638,'options':{'where':{'uniqueid':_0x438946},'order':[['id',_0xe227('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x6821=['UpdateMailQueueReport','DESC','create','CreateMailQueueReport','update','Request'];(function(_0x359a79,_0x497ae5){var _0x102219=function(_0x1f2e07){while(--_0x1f2e07){_0x359a79['push'](_0x359a79['shift']());}};_0x102219(++_0x497ae5);}(_0x6821,0x1d0));var _0x1682=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x6821[_0x575057];return _0x49dbc8;};'use strict';var client=require('../client');exports[_0x1682('0x0')]=function(_0x119316){return client['Request'](_0x1682('0x1'),{'body':_0x119316,'log':_0x1682('0x1')});};exports[_0x1682('0x2')]=function(_0x3c33bc,_0x53b287){return client[_0x1682('0x3')](_0x1682('0x4'),{'body':_0x53b287,'options':{'where':{'uniqueid':_0x3c33bc},'order':[['id',_0x1682('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 270420f..ab44604 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 _0x8b6e=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x286a34,_0x1e7d2d){var _0x7059e4=function(_0x32c04f){while(--_0x32c04f){_0x286a34['push'](_0x286a34['shift']());}};_0x7059e4(++_0x1e7d2d);}(_0x8b6e,0x9e));var _0xe8b6=function(_0x173ad3,_0x21c676){_0x173ad3=_0x173ad3-0x0;var _0x4becc3=_0x8b6e[_0x173ad3];return _0x4becc3;};'use strict';var client=require(_0xe8b6('0x0'));exports[_0xe8b6('0x1')]=function(_0x57995a,_0x340515){return client[_0xe8b6('0x2')](_0xe8b6('0x3'),{'body':_0x340515,'options':{'where':{'id':_0x57995a}},'log':_0xe8b6('0x4')});};exports[_0xe8b6('0x5')]=function(_0x148fd3,_0x4a0e38){return client[_0xe8b6('0x2')](_0xe8b6('0x6'),{'body':_0x4a0e38,'options':{'where':{'id':_0x148fd3}},'log':_0xe8b6('0x7')});}; \ No newline at end of file +var _0x4b36=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x583ea0,_0x2b4d63){var _0x1f60e3=function(_0x3da304){while(--_0x3da304){_0x583ea0['push'](_0x583ea0['shift']());}};_0x1f60e3(++_0x2b4d63);}(_0x4b36,0x11f));var _0x64b3=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x4b36[_0x1da527];return _0x40fc7c;};'use strict';var client=require(_0x64b3('0x0'));exports[_0x64b3('0x1')]=function(_0x1e70d5,_0x75da2e){return client[_0x64b3('0x2')](_0x64b3('0x3'),{'body':_0x75da2e,'options':{'where':{'id':_0x1e70d5}},'log':_0x64b3('0x4')});};exports[_0x64b3('0x5')]=function(_0x3baec5,_0x355928){return client['Request'](_0x64b3('0x6'),{'body':_0x355928,'options':{'where':{'id':_0x3baec5}},'log':_0x64b3('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 08ca87b..65473dc 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 _0x50bc=['createOpenchannelMessage','Request','CreateOpenchannelMessage'];(function(_0x2efb90,_0x1a90e1){var _0x236993=function(_0x5af529){while(--_0x5af529){_0x2efb90['push'](_0x2efb90['shift']());}};_0x236993(++_0x1a90e1);}(_0x50bc,0x1a5));var _0xc50b=function(_0x3a313c,_0x488409){_0x3a313c=_0x3a313c-0x0;var _0x44dcb0=_0x50bc[_0x3a313c];return _0x44dcb0;};'use strict';var client=require('../client');exports['create']=function(_0x167697){return client[_0xc50b('0x0')](_0xc50b('0x1'),{'body':_0x167697,'log':_0xc50b('0x2')});}; \ No newline at end of file +var _0xa828=['CreateOpenchannelMessage','createOpenchannelMessage','create','Request'];(function(_0x544f3b,_0x32a679){var _0x26ada1=function(_0x3f60a0){while(--_0x3f60a0){_0x544f3b['push'](_0x544f3b['shift']());}};_0x26ada1(++_0x32a679);}(_0xa828,0xee));var _0x8a82=function(_0x44f9a1,_0x914b7e){_0x44f9a1=_0x44f9a1-0x0;var _0x138599=_0xa828[_0x44f9a1];return _0x138599;};'use strict';var client=require('../client');exports[_0x8a82('0x0')]=function(_0x58fc52){return client[_0x8a82('0x1')](_0x8a82('0x2'),{'body':_0x58fc52,'log':_0x8a82('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 3c9f322..cf646af 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 _0x02d9=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','Agents','online'];(function(_0x1dbf62,_0x3986d4){var _0x64ad0d=function(_0x58d092){while(--_0x58d092){_0x1dbf62['push'](_0x1dbf62['shift']());}};_0x64ad0d(++_0x3986d4);}(_0x02d9,0x97));var _0x902d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x02d9[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x902d('0x0'));exports[_0x902d('0x1')]=function(){return function(){return client[_0x902d('0x2')](_0x902d('0x3'),{'options':{'raw':![],'attributes':['id',_0x902d('0x4'),_0x902d('0x5'),'strategy'],'include':[{'model':_0x902d('0x6'),'as':_0x902d('0x7'),'attributes':['id',_0x902d('0x4'),_0x902d('0x8'),_0x902d('0x9')]}]},'log':_0x902d('0x1')});};}; \ No newline at end of file +var _0xb49e=['online','openchannelPause','../client','getOpenchannelQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0xb49e,0x84));var _0xeb49=function(_0x1e5fa1,_0x35040a){_0x1e5fa1=_0x1e5fa1-0x0;var _0x5ab2fd=_0xb49e[_0x1e5fa1];return _0x5ab2fd;};'use strict';var client=require(_0xeb49('0x0'));exports[_0xeb49('0x1')]=function(){return function(){return client[_0xeb49('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xeb49('0x3'),_0xeb49('0x4'),_0xeb49('0x5')],'include':[{'model':_0xeb49('0x6'),'as':_0xeb49('0x7'),'attributes':['id',_0xeb49('0x3'),_0xeb49('0x8'),_0xeb49('0x9')]}]},'log':_0xeb49('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 084da0e..c8e3066 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 _0xe78b=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x2edfb5,_0x459de1){var _0x4dd84c=function(_0x5c1a0f){while(--_0x5c1a0f){_0x2edfb5['push'](_0x2edfb5['shift']());}};_0x4dd84c(++_0x459de1);}(_0xe78b,0x1c2));var _0xbe78=function(_0xbf7f20,_0x3f856e){_0xbf7f20=_0xbf7f20-0x0;var _0x5dc25d=_0xe78b[_0xbf7f20];return _0x5dc25d;};'use strict';var client=require(_0xbe78('0x0'));exports[_0xbe78('0x1')]=function(_0x52c04e){return client[_0xbe78('0x2')](_0xbe78('0x3'),{'body':_0x52c04e,'log':_0xbe78('0x3')});};exports[_0xbe78('0x4')]=function(_0x1f540e,_0x30500f){return client[_0xbe78('0x2')](_0xbe78('0x5'),{'body':_0x30500f,'options':{'where':{'uniqueid':_0x1f540e},'order':[['id',_0xbe78('0x6')]],'limit':0x1},'log':_0xbe78('0x5')});}; \ No newline at end of file +var _0x8b0c=['Request','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b0c,0xec));var _0xc8b0=function(_0x208d0e,_0x36b013){_0x208d0e=_0x208d0e-0x0;var _0x25526a=_0x8b0c[_0x208d0e];return _0x25526a;};'use strict';var client=require(_0xc8b0('0x0'));exports[_0xc8b0('0x1')]=function(_0x6bf11d){return client['Request'](_0xc8b0('0x2'),{'body':_0x6bf11d,'log':_0xc8b0('0x2')});};exports[_0xc8b0('0x3')]=function(_0x3dfbd7,_0x17e519){return client[_0xc8b0('0x4')](_0xc8b0('0x5'),{'body':_0x17e519,'options':{'where':{'uniqueid':_0x3dfbd7},'order':[['id','DESC']],'limit':0x1},'log':_0xc8b0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1c3d63d..20c8a80 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 _0xc5c7=['addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x5d69a3,_0x14346c){_0x5d69a3=_0x5d69a3-0x0;var _0x428b83=_0xc5c7[_0x5d69a3];return _0x428b83;};'use strict';var client=require('../client');exports[_0x7c5c('0x0')]=function(_0x28e1a9,_0x2e1b3a){return client[_0x7c5c('0x1')](_0x7c5c('0x2'),{'body':_0x2e1b3a,'options':{'where':{'id':_0x28e1a9}},'log':_0x7c5c('0x3')});};exports['addTags']=function(_0xff325e,_0x2b4355){return client[_0x7c5c('0x1')](_0x7c5c('0x4'),{'body':_0x2b4355,'options':{'where':{'id':_0xff325e}},'log':_0x7c5c('0x5')});}; \ No newline at end of file +var _0x5447=['addTagsToSmsInteraction','../client','UpdateSmsInteraction','addTags','Request','AddTagsToSmsInteraction'];(function(_0x1ffaba,_0x13bb09){var _0x4aab50=function(_0x392bd4){while(--_0x392bd4){_0x1ffaba['push'](_0x1ffaba['shift']());}};_0x4aab50(++_0x13bb09);}(_0x5447,0xf1));var _0x7544=function(_0x476792,_0x305daa){_0x476792=_0x476792-0x0;var _0x20cfcd=_0x5447[_0x476792];return _0x20cfcd;};'use strict';var client=require(_0x7544('0x0'));exports['update']=function(_0x2ed026,_0x4274be){return client['Request'](_0x7544('0x1'),{'body':_0x4274be,'options':{'where':{'id':_0x2ed026}},'log':'updateSmsInteraction'});};exports[_0x7544('0x2')]=function(_0x2b18eb,_0xe47f97){return client[_0x7544('0x3')](_0x7544('0x4'),{'body':_0xe47f97,'options':{'where':{'id':_0x2b18eb}},'log':_0x7544('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 97f40b0..f8feb83 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 _0x27a0=['Request','createSmsMessage','../client','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x27a0,0x1c6));var _0x027a=function(_0x45dac7,_0x520d27){_0x45dac7=_0x45dac7-0x0;var _0xa1d7d6=_0x27a0[_0x45dac7];return _0xa1d7d6;};'use strict';var client=require(_0x027a('0x0'));exports[_0x027a('0x1')]=function(_0x549cc8){return client[_0x027a('0x2')]('CreateSmsMessage',{'body':_0x549cc8,'log':_0x027a('0x3')});}; \ No newline at end of file +var _0x3950=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x24555c,_0x118c28){var _0x4514cc=function(_0xf209b1){while(--_0xf209b1){_0x24555c['push'](_0x24555c['shift']());}};_0x4514cc(++_0x118c28);}(_0x3950,0x100));var _0x0395=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3950[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x0395('0x0'));exports[_0x0395('0x1')]=function(_0x39bb7c){return client[_0x0395('0x2')](_0x0395('0x3'),{'body':_0x39bb7c,'log':_0x0395('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index bbd58b5..8ca15bd 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x26059b,_0x23a753){var _0x24122b=function(_0x1d9acf){while(--_0x1d9acf){_0x26059b['push'](_0x26059b['shift']());}};_0x24122b(++_0x23a753);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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 e680dfa..634b40b 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(_0x4cbe6a,_0x593aae){var _0x5273fa=function(_0x2332c3){while(--_0x2332c3){_0x4cbe6a['push'](_0x4cbe6a['shift']());}};_0x5273fa(++_0x593aae);}(_0x70e0,0x17b));var _0x070e=function(_0x4c42c7,_0x79b5f7){_0x4c42c7=_0x4c42c7-0x0;var _0x786b4e=_0x70e0[_0x4c42c7];return _0x786b4e;};'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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x58977a,_0x2bddec){var _0x1162b4=function(_0x5602de){while(--_0x5602de){_0x58977a['push'](_0x58977a['shift']());}};_0x1162b4(++_0x2bddec);}(_0x70e0,0x17b));var _0x070e=function(_0x77a70f,_0x29e85d){_0x77a70f=_0x77a70f-0x0;var _0x1c5383=_0x70e0[_0x77a70f];return _0x1c5383;};'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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 94fc3f7..c385f6e 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(_0x48ac6f,_0x3afacb){var _0x4d01b8=function(_0x4fc24a){while(--_0x4fc24a){_0x48ac6f['push'](_0x48ac6f['shift']());}};_0x4d01b8(++_0x3afacb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x37f8ad,_0x5c3a37){var _0x12bd86=function(_0x4d8617){while(--_0x4d8617){_0x37f8ad['push'](_0x37f8ad['shift']());}};_0x12bd86(++_0x5c3a37);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 5ce088e..6225865 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 _0x7bd0=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x46f50d,_0x10c27a){var _0x4e8839=function(_0x4145ce){while(--_0x4145ce){_0x46f50d['push'](_0x46f50d['shift']());}};_0x4e8839(++_0x10c27a);}(_0x7bd0,0x111));var _0x07bd=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0x7bd0[_0x592e40];return _0x5d4288;};'use strict';var client=require(_0x07bd('0x0'));exports[_0x07bd('0x1')]=function(_0x20836d,_0x3b79f2){return client[_0x07bd('0x2')](_0x07bd('0x3'),{'body':_0x3b79f2,'options':{'where':{'id':_0x20836d}},'log':_0x07bd('0x4')});};exports[_0x07bd('0x5')]=function(_0x5beba7,_0x2d7245){return client[_0x07bd('0x2')](_0x07bd('0x6'),{'body':_0x2d7245,'options':{'where':{'id':_0x5beba7}},'log':_0x07bd('0x7')});}; \ No newline at end of file +var _0x5fc3=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0x5fc3[_0x5dc03e];return _0x466a07;};'use strict';var client=require(_0x35fc('0x0'));exports[_0x35fc('0x1')]=function(_0x5a8343,_0x253d6e){return client[_0x35fc('0x2')](_0x35fc('0x3'),{'body':_0x253d6e,'options':{'where':{'id':_0x5a8343}},'log':_0x35fc('0x4')});};exports[_0x35fc('0x5')]=function(_0x5e75e6,_0x2d1404){return client[_0x35fc('0x2')](_0x35fc('0x6'),{'body':_0x2d1404,'options':{'where':{'id':_0x5e75e6}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3735300..f625063 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 _0x5625=['create','CreateWhatsappMessage'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5625,0x88));var _0x5562=function(_0x530511,_0x445e74){_0x530511=_0x530511-0x0;var _0x5d8902=_0x5625[_0x530511];return _0x5d8902;};'use strict';var client=require('../client');exports[_0x5562('0x0')]=function(_0x2960cb){return client['Request'](_0x5562('0x1'),{'body':_0x2960cb,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x1797=['create','Request','createWhatsappMessage','../client'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x1797,0x19f));var _0x7179=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x1797[_0xae7c2f];return _0x5d7001;};'use strict';var client=require(_0x7179('0x0'));exports[_0x7179('0x1')]=function(_0x1c43c0){return client[_0x7179('0x2')]('CreateWhatsappMessage',{'body':_0x1c43c0,'log':_0x7179('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 301b987..e17b77c 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 _0xa704=['Agents','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','User'];(function(_0xc27749,_0x188efd){var _0x566bde=function(_0x3bbf56){while(--_0x3bbf56){_0xc27749['push'](_0xc27749['shift']());}};_0x566bde(++_0x188efd);}(_0xa704,0xa4));var _0x4a70=function(_0x3be577,_0x33c662){_0x3be577=_0x3be577-0x0;var _0x10bbd8=_0xa704[_0x3be577];return _0x10bbd8;};'use strict';var client=require(_0x4a70('0x0'));exports[_0x4a70('0x1')]=function(){return function(){return client[_0x4a70('0x2')](_0x4a70('0x3'),{'options':{'raw':![],'attributes':['id',_0x4a70('0x4'),_0x4a70('0x5'),'strategy'],'include':[{'model':_0x4a70('0x6'),'as':_0x4a70('0x7'),'attributes':['id','name','online',_0x4a70('0x8')]}]},'log':_0x4a70('0x1')});};}; \ No newline at end of file +var _0x48ea=['getWhatsappQueues','Request','timeout','strategy','Agents','name','whatsappPause','../client'];(function(_0x125d81,_0x1c1751){var _0x441206=function(_0x223d31){while(--_0x223d31){_0x125d81['push'](_0x125d81['shift']());}};_0x441206(++_0x1c1751);}(_0x48ea,0x127));var _0xa48e=function(_0x2eb03c,_0x4272c1){_0x2eb03c=_0x2eb03c-0x0;var _0x2b52dd=_0x48ea[_0x2eb03c];return _0x2b52dd;};'use strict';var client=require(_0xa48e('0x0'));exports[_0xa48e('0x1')]=function(){return function(){return client[_0xa48e('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xa48e('0x3'),_0xa48e('0x4')],'include':[{'model':'User','as':_0xa48e('0x5'),'attributes':['id',_0xa48e('0x6'),'online',_0xa48e('0x7')]}]},'log':_0xa48e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 0a41b1f..fc2c9e7 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 _0x373e=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x39b331,_0xf46c66){var _0x517aae=function(_0x26b1d7){while(--_0x26b1d7){_0x39b331['push'](_0x39b331['shift']());}};_0x517aae(++_0xf46c66);}(_0x373e,0x132));var _0xe373=function(_0x523bbf,_0x328a09){_0x523bbf=_0x523bbf-0x0;var _0x512159=_0x373e[_0x523bbf];return _0x512159;};'use strict';var client=require(_0xe373('0x0'));exports[_0xe373('0x1')]=function(_0xb0293f){return client[_0xe373('0x2')](_0xe373('0x3'),{'body':_0xb0293f,'log':_0xe373('0x3')});};exports[_0xe373('0x4')]=function(_0x237286,_0x1f3988){return client[_0xe373('0x2')](_0xe373('0x5'),{'body':_0x1f3988,'options':{'where':{'uniqueid':_0x237286},'order':[['id',_0xe373('0x6')]],'limit':0x1},'log':_0xe373('0x5')});}; \ No newline at end of file +var _0xb480=['Request','UpdateWhatsappQueueReport','DESC','create','CreateWhatsappQueueReport','update'];(function(_0x2563ae,_0x54a27a){var _0x416429=function(_0x1dc4bd){while(--_0x1dc4bd){_0x2563ae['push'](_0x2563ae['shift']());}};_0x416429(++_0x54a27a);}(_0xb480,0x165));var _0x0b48=function(_0x111e9c,_0x52ee27){_0x111e9c=_0x111e9c-0x0;var _0x512301=_0xb480[_0x111e9c];return _0x512301;};'use strict';var client=require('../client');exports[_0x0b48('0x0')]=function(_0x489746){return client['Request'](_0x0b48('0x1'),{'body':_0x489746,'log':'CreateWhatsappQueueReport'});};exports[_0x0b48('0x2')]=function(_0x2fd514,_0x5ac048){return client[_0x0b48('0x3')](_0x0b48('0x4'),{'body':_0x5ac048,'options':{'where':{'uniqueid':_0x2fd514},'order':[['id',_0x0b48('0x5')]],'limit':0x1},'log':_0x0b48('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 d070638..9db2bdd 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 _0xed2c=['consequence','validate','[%s][AGENT]\x20%s','message','join','stop','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','agent','error','log','[%s][QUEUE]\x20%s','stack','seq-queue','../../../../config/logger','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'];(function(_0x472f34,_0x2b395c){var _0x2db343=function(_0xde3401){while(--_0xde3401){_0x472f34['push'](_0x472f34['shift']());}};_0x2db343(++_0x2b395c);}(_0xed2c,0x16a));var _0xced2=function(_0x49e454,_0x22328f){_0x49e454=_0x49e454-0x0;var _0x21d045=_0xed2c[_0x49e454];return _0x21d045;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require(_0xced2('0x0'));var logger=require(_0xced2('0x1'))(_0xced2('0x2'));var strategy=require(_0xced2('0x3'));var queue=schema({'name':{'type':_0xced2('0x4'),'required':!![],'message':_0xced2('0x5')},'timeout':{'type':_0xced2('0x6'),'message':_0xced2('0x7')}});function writeLog(_0x1c1160,_0x149ac9,_0x21ce08){return logger[_0xced2('0x8')](util['format'](_0xced2('0x9'),_0x1c1160,_0x149ac9[_0xced2('0xa')],_0x21ce08));}function handleFindAgent(_0x264a30){return function(_0x31ee2b){return _0x31ee2b[_0xced2('0xa')][_0xced2('0xb')]()===_0x264a30['toLowerCase']();};}exports[_0xced2('0xc')]=function(_0x27f12e,_0x22ea99,_0x276b21,_0x486fd7){return function(_0x293361){try{var _0x4cfa4d={'name':_0x22ea99[0x0],'timeout':_0x22ea99[0x1]};var _0x16eecb=queue[_0xced2('0xd')](_0x4cfa4d,{'typecast':!![]});if(_0x16eecb['length']){logger['error'](_0xced2('0xe'),_0x27f12e,_['map'](_0x16eecb,_0xced2('0xf'))[_0xced2('0x10')](',\x20'));_0x293361[_0xced2('0x11')]();}else{var _0x74358e=_['find'](_0x276b21[_0xced2('0x12')],handleFindAgent(_0x4cfa4d['name']));if(_0x74358e){var _0x530b7c=(_0x4cfa4d[_0xced2('0x13')]||0xa)*0x3e8;var _0x21685c,_0xa6b38c;var _0x44a704=seqqueue[_0xced2('0x14')](_0x530b7c);_0x44a704['id']=_0x27f12e;_0x44a704[_0xced2('0x15')]=_0x530b7c;_0x44a704[_0xced2('0x16')]=_0x486fd7[_0xced2('0x16')];writeLog(_0x27f12e,_0x74358e,util[_0xced2('0x17')](_0xced2('0x18'),_0x530b7c));_0x276b21[_0xced2('0x19')][_0x27f12e]['on'](_0xced2('0x1a'),function(){logger[_0xced2('0x8')](_0xced2('0x1b'),_0x27f12e);clearTimeout(_0xa6b38c);_0xa6b38c=undefined;_0x44a704['close']();if(_0x276b21[_0xced2('0x19')][_0x27f12e]){delete _0x276b21['rules'][_0x27f12e];}_0x293361[_0xced2('0x11')]();});_0x276b21[_0xced2('0x19')][_0x27f12e]['on']('complete',function(){if(_0x276b21[_0xced2('0x19')][_0x27f12e]){delete _0x276b21[_0xced2('0x19')][_0x27f12e];}});_0xa6b38c=setTimeout(function(){logger['info'](_0xced2('0x1c'),_0x27f12e);clearTimeout(_0xa6b38c);_0x44a704['close']();_0x293361['next']();},_0x530b7c);strategy[_0xced2('0x1d')](_0x44a704,_0x74358e,_0x276b21,_0x486fd7);}else{logger[_0xced2('0x1e')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x27f12e,_0x4cfa4d[_0xced2('0xa')]);_0x293361[_0xced2('0x11')]();}}}catch(_0x49693f){console[_0xced2('0x1f')](_0x49693f);logger['error'](_0xced2('0x20'),_0x27f12e,_0x49693f[_0xced2('0x21')]);_0x293361[_0xced2('0x11')]();}};}; \ No newline at end of file +var _0xd713=['log','stack','lodash','seq-queue','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','format','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x4da4b,_0x15d48e){var _0x370440=function(_0x19c60b){while(--_0x19c60b){_0x4da4b['push'](_0x4da4b['shift']());}};_0x370440(++_0x15d48e);}(_0xd713,0x18e));var _0x3d71=function(_0x4e170c,_0x2838c2){_0x4e170c=_0x4e170c-0x0;var _0x26a21b=_0xd713[_0x4e170c];return _0x26a21b;};'use strict';var schema=require('validate');var _=require(_0x3d71('0x0'));var util=require('util');var seqqueue=require(_0x3d71('0x1'));var logger=require(_0x3d71('0x2'))('routing');var strategy=require(_0x3d71('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x3d71('0x4')},'timeout':{'type':_0x3d71('0x5'),'message':_0x3d71('0x6')}});function writeLog(_0x5bcdbc,_0x5ccd23,_0x47790a){return logger[_0x3d71('0x7')](util['format'](_0x3d71('0x8'),_0x5bcdbc,_0x5ccd23[_0x3d71('0x9')],_0x47790a));}function handleFindAgent(_0x584d7b){return function(_0x57b07d){return _0x57b07d[_0x3d71('0x9')][_0x3d71('0xa')]()===_0x584d7b[_0x3d71('0xa')]();};}exports['consequence']=function(_0x54c546,_0x4cb516,_0x46cffb,_0x3faa68){return function(_0x4ab966){try{var _0x37f5a4={'name':_0x4cb516[0x0],'timeout':_0x4cb516[0x1]};var _0x305ffa=queue[_0x3d71('0xb')](_0x37f5a4,{'typecast':!![]});if(_0x305ffa[_0x3d71('0xc')]){logger[_0x3d71('0xd')](_0x3d71('0xe'),_0x54c546,_[_0x3d71('0xf')](_0x305ffa,_0x3d71('0x10'))[_0x3d71('0x11')](',\x20'));_0x4ab966[_0x3d71('0x12')]();}else{var _0x63922c=_[_0x3d71('0x13')](_0x46cffb[_0x3d71('0x14')],handleFindAgent(_0x37f5a4['name']));if(_0x63922c){var _0x3f9171=(_0x37f5a4[_0x3d71('0x15')]||0xa)*0x3e8;var _0x54546a,_0x1f62d2;var _0x2bb80d=seqqueue[_0x3d71('0x16')](_0x3f9171);_0x2bb80d['id']=_0x54c546;_0x2bb80d[_0x3d71('0x17')]=_0x3f9171;_0x2bb80d[_0x3d71('0x18')]=_0x3faa68['channel'];writeLog(_0x54c546,_0x63922c,util[_0x3d71('0x19')]('START:%s',_0x3f9171));_0x46cffb[_0x3d71('0x1a')][_0x54c546]['on'](_0x3d71('0x1b'),function(){logger['info'](_0x3d71('0x1c'),_0x54c546);clearTimeout(_0x1f62d2);_0x1f62d2=undefined;_0x2bb80d[_0x3d71('0x1d')]();if(_0x46cffb[_0x3d71('0x1a')][_0x54c546]){delete _0x46cffb['rules'][_0x54c546];}_0x4ab966[_0x3d71('0x12')]();});_0x46cffb[_0x3d71('0x1a')][_0x54c546]['on'](_0x3d71('0x1e'),function(){if(_0x46cffb[_0x3d71('0x1a')][_0x54c546]){delete _0x46cffb[_0x3d71('0x1a')][_0x54c546];}});_0x1f62d2=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x54c546);clearTimeout(_0x1f62d2);_0x2bb80d['close']();_0x4ab966[_0x3d71('0x1f')]();},_0x3f9171);strategy[_0x3d71('0x20')](_0x2bb80d,_0x63922c,_0x46cffb,_0x3faa68);}else{logger[_0x3d71('0xd')](_0x3d71('0x21'),_0x54c546,_0x37f5a4[_0x3d71('0x9')]);_0x4ab966[_0x3d71('0x12')]();}}}catch(_0x301359){console[_0x3d71('0x22')](_0x301359);logger[_0x3d71('0xd')]('[%s][QUEUE]\x20%s',_0x54c546,_0x301359[_0x3d71('0x23')]);_0x4ab966['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 13ab8bf..febf756 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 _0x5f11=['catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','next','contact','format','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','getMustacheRender','Message','create','then','body'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x5f11,0x18f));var _0x15f1=function(_0x283cf7,_0x48bdfb){_0x283cf7=_0x283cf7-0x0;var _0x1c37ae=_0x5f11[_0x283cf7];return _0x1c37ae;};'use strict';var _=require(_0x15f1('0x0'));var moment=require(_0x15f1('0x1'));var AWS=require(_0x15f1('0x2'));var utils=require('./utils');var logger=require(_0x15f1('0x3'))(_0x15f1('0x4'));var rpc={'chatMessage':require(_0x15f1('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x15f1('0x6')),'smsMessage':require(_0x15f1('0x7')),'faxMessage':require(_0x15f1('0x8')),'whatsappMessage':require(_0x15f1('0x9'))};exports[_0x15f1('0xa')]=function(_0x1a618f,_0xa78dc7){return function(_0x54a908){try{if(!_[_0x15f1('0xb')](this['interaction']['UserId'])){logger[_0x15f1('0xc')](_0x15f1('0xd'),_0x1a618f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x54a908[_0x15f1('0xe')]();}var _0x3486f6={'ContactId':this[_0x15f1('0xf')]['id'],'sentAt':moment()[_0x15f1('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x15f1('0x11')]==='sms'||this[_0x15f1('0x11')]===_0x15f1('0x12')){_0x3486f6[_0x15f1('0x13')]=this[_0x15f1('0x14')]['phone'];}var _0x590628=this[_0x15f1('0x11')];if(_0x590628===_0x15f1('0x15')){_0x3486f6[_0x15f1('0x16')]=this[_0x15f1('0x17')]['id'];}else{_0x3486f6[_['upperFirst'](_0x590628)+_0x15f1('0x18')]=this['account']['id'];}_0x3486f6[_[_0x15f1('0x19')](_0x590628)+_0x15f1('0x1a')]=this[_0x15f1('0x14')]['id'];if(this[_0x15f1('0x14')][_0x15f1('0x1b')]){var _0x584d6b=_0xa78dc7[0x4];if(!_['isEmpty'](_0x584d6b)){_0x3486f6['body']=utils[_0x15f1('0x1c')](_0x584d6b,this);return rpc[_0x590628+_0x15f1('0x1d')][_0x15f1('0x1e')](_0x3486f6)[_0x15f1('0x1f')](function(_0x4ca650){logger['info'](_0x15f1('0xd'),_0x1a618f,_0x3486f6[_0x15f1('0x20')]);})[_0x15f1('0x21')](function(_0x5848c7){logger[_0x15f1('0x22')](_0x15f1('0xd'),_0x1a618f,JSON[_0x15f1('0x23')](_0x5848c7));})[_0x15f1('0x24')](function(){logger[_0x15f1('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1a618f);_0x54a908['stop']();});}else{logger[_0x15f1('0xc')](_0x15f1('0x25'),_0x1a618f);_0x54a908[_0x15f1('0x26')]();}}else{var _0x2d3737=this;var _0x10c076=new AWS[(_0x15f1('0x27'))]({'accessKeyId':_0xa78dc7[0x0],'secretAccessKey':_0xa78dc7[0x1],'region':_0xa78dc7[0x2]});var _0x551930={'botAlias':'$LATEST','botName':_0xa78dc7[0x3],'inputText':this[_0x15f1('0x28')][_0x15f1('0x20')],'userId':this[_0x15f1('0x11')]+':'+this['interaction']['id'][_0x15f1('0x29')]()};_0x10c076[_0x15f1('0x2a')](_0x551930,function(_0x9932cf,_0x4518f8){if(_0x9932cf){logger[_0x15f1('0x22')](_0x15f1('0xd'),_0x1a618f,_0x9932cf[_0x15f1('0x28')]);_0x54a908[_0x15f1('0xe')]();}else if(_0x4518f8&&_0x4518f8['message']){_0x2d3737['body'][_0x15f1('0x2b')]=_0x4518f8;_0x3486f6[_0x15f1('0x20')]=_0x4518f8['message'];_0x3486f6[_0x15f1('0x2c')]='amazonlex';_0x3486f6[_0x15f1('0x2d')]=JSON[_0x15f1('0x23')](_0x4518f8);return rpc[_0x590628+_0x15f1('0x1d')][_0x15f1('0x1e')](_0x3486f6)[_0x15f1('0x1f')](function(_0x59fabd){logger[_0x15f1('0xc')]('[%s][AMAZONLEX]\x20%s',_0x1a618f,_0x3486f6['body']);if(_0x4518f8[_0x15f1('0x2e')]==_0x15f1('0x2f')){_0x54a908['next']();}else{_0x54a908[_0x15f1('0x26')]();}})[_0x15f1('0x21')](function(_0x4cbb8f){logger[_0x15f1('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1a618f,JSON[_0x15f1('0x23')](_0x4cbb8f));_0x54a908['next']();});}else{_0x54a908[_0x15f1('0xe')]();}});}}catch(_0x4c67f3){logger['error'](_0x15f1('0xd'),_0x1a618f,JSON['stringify'](_0x4c67f3));_0x54a908[_0x15f1('0x26')]();}};}; \ No newline at end of file +var _0x3778=['dialogState','Failed','stringify','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','contact','format','out','channel','sms','whatsapp','chat','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','then','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','postText','message','next','amazonlex','providerName','providerResponse'];(function(_0x12b37b,_0x267320){var _0x38ceb4=function(_0x115924){while(--_0x115924){_0x12b37b['push'](_0x12b37b['shift']());}};_0x38ceb4(++_0x267320);}(_0x3778,0x163));var _0x8377=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3778[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x8377('0x0'));var logger=require('../../../../config/logger')(_0x8377('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x8377('0x2')),'mailMessage':require(_0x8377('0x3')),'smsMessage':require(_0x8377('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8377('0x5'))};exports[_0x8377('0x6')]=function(_0x423ac6,_0x14130b){return function(_0x3619ad){try{if(!_[_0x8377('0x7')](this[_0x8377('0x8')][_0x8377('0x9')])){logger[_0x8377('0xa')](_0x8377('0xb'),_0x423ac6,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3619ad['next']();}var _0x46b91f={'ContactId':this[_0x8377('0xc')]['id'],'sentAt':moment()[_0x8377('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8377('0xe')};if(this[_0x8377('0xf')]===_0x8377('0x10')||this[_0x8377('0xf')]===_0x8377('0x11')){_0x46b91f['phone']=this['interaction']['phone'];}var _0xd7aecd=this[_0x8377('0xf')];if(_0xd7aecd===_0x8377('0x12')){_0x46b91f['ChatWebsiteId']=this[_0x8377('0x13')]['id'];}else{_0x46b91f[_[_0x8377('0x14')](_0xd7aecd)+_0x8377('0x15')]=this['account']['id'];}_0x46b91f[_[_0x8377('0x14')](_0xd7aecd)+_0x8377('0x16')]=this[_0x8377('0x8')]['id'];if(this[_0x8377('0x8')][_0x8377('0x17')]){var _0x19fd55=_0x14130b[0x4];if(!_['isEmpty'](_0x19fd55)){_0x46b91f[_0x8377('0x18')]=utils[_0x8377('0x19')](_0x19fd55,this);return rpc[_0xd7aecd+_0x8377('0x1a')][_0x8377('0x1b')](_0x46b91f)[_0x8377('0x1c')](function(_0x4f1a2b){logger[_0x8377('0xa')](_0x8377('0xb'),_0x423ac6,_0x46b91f[_0x8377('0x18')]);})[_0x8377('0x1d')](function(_0x384404){logger[_0x8377('0x1e')](_0x8377('0xb'),_0x423ac6,JSON['stringify'](_0x384404));})['finally'](function(){logger[_0x8377('0xa')](_0x8377('0x1f'),_0x423ac6);_0x3619ad['stop']();});}else{logger[_0x8377('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x423ac6);_0x3619ad[_0x8377('0x20')]();}}else{var _0x4b2e06=this;var _0x27415a=new AWS[(_0x8377('0x21'))]({'accessKeyId':_0x14130b[0x0],'secretAccessKey':_0x14130b[0x1],'region':_0x14130b[0x2]});var _0x230349={'botAlias':_0x8377('0x22'),'botName':_0x14130b[0x3],'inputText':this['message']['body'],'userId':this[_0x8377('0xf')]+':'+this[_0x8377('0x8')]['id']['toString']()};_0x27415a[_0x8377('0x23')](_0x230349,function(_0x23cc3a,_0x4b58ae){if(_0x23cc3a){logger[_0x8377('0x1e')](_0x8377('0xb'),_0x423ac6,_0x23cc3a[_0x8377('0x24')]);_0x3619ad[_0x8377('0x25')]();}else if(_0x4b58ae&&_0x4b58ae[_0x8377('0x24')]){_0x4b2e06[_0x8377('0x18')][_0x8377('0x26')]=_0x4b58ae;_0x46b91f[_0x8377('0x18')]=_0x4b58ae['message'];_0x46b91f[_0x8377('0x27')]=_0x8377('0x26');_0x46b91f[_0x8377('0x28')]=JSON['stringify'](_0x4b58ae);return rpc[_0xd7aecd+_0x8377('0x1a')][_0x8377('0x1b')](_0x46b91f)['then'](function(_0x172e1f){logger[_0x8377('0xa')]('[%s][AMAZONLEX]\x20%s',_0x423ac6,_0x46b91f[_0x8377('0x18')]);if(_0x4b58ae[_0x8377('0x29')]==_0x8377('0x2a')){_0x3619ad[_0x8377('0x25')]();}else{_0x3619ad['stop']();}})[_0x8377('0x1d')](function(_0x36b50d){logger[_0x8377('0x1e')](_0x8377('0xb'),_0x423ac6,JSON['stringify'](_0x36b50d));_0x3619ad[_0x8377('0x25')]();});}else{_0x3619ad[_0x8377('0x25')]();}});}}catch(_0x29e5ae){logger[_0x8377('0x1e')](_0x8377('0xb'),_0x423ac6,JSON[_0x8377('0x2b')](_0x29e5ae));_0x3619ad['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index af05410..1d2fed4 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 _0x7cef=['headers','auto-replied','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../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','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','messageId','html','replace',''];(function(_0x19a029,_0xe42735){var _0x2997ed=function(_0x38d789){while(--_0x38d789){_0x19a029['push'](_0x19a029['shift']());}};_0x2997ed(++_0xe42735);}(_0x7cef,0xde));var _0xf7ce=function(_0x5a0448,_0x34db12){_0x5a0448=_0x5a0448-0x0;var _0x133b6f=_0x7cef[_0x5a0448];return _0x133b6f;};'use strict';var _=require(_0xf7ce('0x0'));var moment=require('moment');var utils=require(_0xf7ce('0x1'));var logger=require(_0xf7ce('0x2'))(_0xf7ce('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf7ce('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf7ce('0x5')),'faxMessage':require(_0xf7ce('0x6')),'whatsappMessage':require(_0xf7ce('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xf7ce('0x8')),'faxInteraction':require(_0xf7ce('0x9')),'whatsappInteraction':require(_0xf7ce('0xa'))};var mailRpc=require(_0xf7ce('0xb'));exports[_0xf7ce('0xc')]=function(_0x541d62,_0x28aa6d,_0x3731e3,_0x17226d){return function(_0x500fc7){try{var _0x3ad145=this[_0xf7ce('0xd')];if(_0x3ad145===_0xf7ce('0xe')&&_0x17226d[_0xf7ce('0xf')][_0xf7ce('0x10')]){logger[_0xf7ce('0x11')](_0xf7ce('0x12'),_0x541d62,_0xf7ce('0x13'));return _0x500fc7[_0xf7ce('0x14')]();}if(_0x28aa6d[0x0]==='1'&&(_[_0xf7ce('0x15')](this[_0xf7ce('0x16')]['created'])||!this[_0xf7ce('0x16')][_0xf7ce('0x17')])){logger[_0xf7ce('0x11')](_0xf7ce('0x12'),_0x541d62,_0xf7ce('0x18'));return _0x500fc7[_0xf7ce('0x14')]();}if(_0x28aa6d[0x0]==='2'&&this[_0xf7ce('0x16')][_0xf7ce('0x19')]){logger[_0xf7ce('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x541d62,_0xf7ce('0x1a'));return _0x500fc7[_0xf7ce('0x14')]();}var _0x3d234a={'ContactId':this[_0xf7ce('0x1b')]['id'],'sentAt':moment()['format'](_0xf7ce('0x1c')),'direction':_0xf7ce('0x1d')};if(this[_0xf7ce('0xd')]===_0xf7ce('0xe')){_0x3d234a[_0xf7ce('0xf')]=utils['getMustacheRender'](_0x28aa6d[0x2],this);}else{_0x3d234a[_0xf7ce('0xf')]=utils[_0xf7ce('0x1e')](_0x28aa6d[0x1],this);}if(this[_0xf7ce('0x1f')]){_0x3d234a['to']=this[_0xf7ce('0x1f')][_0xf7ce('0x20')]||'';if(this[_0xf7ce('0xd')]===_0xf7ce('0xe')&&_0x28aa6d[0x1]==='1'){_0x3d234a['cc']=this['message']['cc']||'';}_0x3d234a['from']=this[_0xf7ce('0x1f')]['to']||'';_0x3d234a[_0xf7ce('0x21')]=this[_0xf7ce('0x1f')][_0xf7ce('0x21')]||'';_0x3d234a[_0xf7ce('0x22')]=!![];if(this['message'][_0xf7ce('0x23')]){_0x3d234a['subject']='';_0x3d234a[_0xf7ce('0x23')]+=_[_0xf7ce('0x24')](this[_0xf7ce('0x1f')][_0xf7ce('0x23')],_0xf7ce('0x25'))?'':'Re:\x20';_0x3d234a['subject']+=this[_0xf7ce('0x1f')]['subject'];}}if(this[_0xf7ce('0xd')]==='chat'){_0x3d234a[_0xf7ce('0x26')]=this[_0xf7ce('0x27')]['id'];}else{_0x3d234a[_['upperFirst'](this[_0xf7ce('0xd')])+_0xf7ce('0x28')]=this[_0xf7ce('0x27')]['id'];}_0x3d234a[_[_0xf7ce('0x29')](this[_0xf7ce('0xd')])+_0xf7ce('0x2a')]=this[_0xf7ce('0x16')]['id'];var _0x7aacac=this['interaction'];if(rpc[this[_0xf7ce('0xd')]+_0xf7ce('0x2b')]){if(this['channel']===_0xf7ce('0xe')){_0x3d234a['inReplyTo']=this[_0xf7ce('0x1f')][_0xf7ce('0x2c')];_0x3d234a[_0xf7ce('0x2d')]=''+_[_0xf7ce('0x2e')](_0x3d234a['body'],_0xf7ce('0x2f'),_0xf7ce('0x30'))+_0xf7ce('0x31');_0x3d234a[_0xf7ce('0x32')]={'Auto-Submitted':_0xf7ce('0x33'),'X-Auto-Response-Suppress':_0xf7ce('0x34'),'Precedence':'auto_reply'};return mailRpc[_0xf7ce('0x35')](this[_0xf7ce('0x27')][_0xf7ce('0x36')],_0x3d234a)[_0xf7ce('0x37')](function(_0x437f8e){logger['info'](_0xf7ce('0x38'),_0x541d62);_0x3d234a[_0xf7ce('0x2c')]=_0x437f8e[_0xf7ce('0x1f')]['messageId'];return rpc[_0x3ad145+_0xf7ce('0x2b')][_0xf7ce('0x39')](_0x3d234a);})['then'](function(_0x3cec8f){logger[_0xf7ce('0x11')]('[%s][AUTOREPLY]\x20%s',_0x541d62,JSON['stringify'](_0x3cec8f));})[_0xf7ce('0x3a')](function(_0x26b0ca){logger[_0xf7ce('0x3b')](_0xf7ce('0x3c'),_0x541d62,JSON[_0xf7ce('0x3d')](_0x26b0ca));})['finally'](function(){Promise[_0xf7ce('0x3e')]()[_0xf7ce('0x37')](function(){if(_0x28aa6d[0x0]!=='2'||_0x7aacac[_0xf7ce('0x19')])return;return rpc[_0x3ad145+_0xf7ce('0x3f')][_0xf7ce('0x40')](_0x7aacac['id'],{'autoreplyExecuted':!![]})[_0xf7ce('0x37')](function(_0xe3583f){logger[_0xf7ce('0x11')](_0xf7ce('0x41'),_0x541d62,JSON['stringify'](_0xe3583f));})[_0xf7ce('0x3a')](function(_0x352182){logger[_0xf7ce('0x3b')](_0xf7ce('0x42'),_0x541d62,JSON[_0xf7ce('0x3d')](_0x352182));});})[_0xf7ce('0x37')](function(){_0x500fc7[_0xf7ce('0x14')]();});});}else{return rpc[this[_0xf7ce('0xd')]+_0xf7ce('0x2b')][_0xf7ce('0x39')](_0x3d234a)[_0xf7ce('0x37')](function(){logger[_0xf7ce('0x11')](_0xf7ce('0x12'),_0x541d62,_0x3d234a[_0xf7ce('0xf')]);})[_0xf7ce('0x3a')](function(_0x20e3d2){logger[_0xf7ce('0x3b')](_0xf7ce('0x12'),_0x541d62,JSON[_0xf7ce('0x3d')](_0x20e3d2));})[_0xf7ce('0x43')](function(){Promise['resolve']()[_0xf7ce('0x37')](function(){if(_0x28aa6d[0x0]!=='2'||_0x7aacac[_0xf7ce('0x19')])return;return rpc[_0x3ad145+_0xf7ce('0x3f')]['update'](_0x7aacac['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3c589a){logger[_0xf7ce('0x11')](_0xf7ce('0x41'),_0x541d62,JSON[_0xf7ce('0x3d')](_0x3c589a));})[_0xf7ce('0x3a')](function(_0xa940e9){logger[_0xf7ce('0x3b')](_0xf7ce('0x42'),_0x541d62,JSON['stringify'](_0xa940e9));});})[_0xf7ce('0x37')](function(){_0x500fc7[_0xf7ce('0x14')]();});});}}}catch(_0x14ad80){logger[_0xf7ce('0x3b')](_0xf7ce('0x12'),_0x541d62,JSON[_0xf7ce('0x3d')](_0x14ad80));_0x500fc7['stop']();}};}; \ No newline at end of file +var _0xc5f9=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','next','interaction','created','info','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','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','inReplyTo','html','','replace','';_0x27fd7d[_0x9c5f('0x31')]={'Auto-Submitted':_0x9c5f('0x32'),'X-Auto-Response-Suppress':_0x9c5f('0x33'),'Precedence':_0x9c5f('0x34')};return mailRpc[_0x9c5f('0x35')](this['account']['smtpOptions'],_0x27fd7d)['then'](function(_0x4f3d8c){logger[_0x9c5f('0x16')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x407498);_0x27fd7d[_0x9c5f('0x36')]=_0x4f3d8c[_0x9c5f('0x1e')][_0x9c5f('0x36')];return rpc[_0x429b6c+_0x9c5f('0x37')]['create'](_0x27fd7d);})[_0x9c5f('0x38')](function(_0x166141){logger[_0x9c5f('0x16')](_0x9c5f('0x12'),_0x407498,JSON[_0x9c5f('0x39')](_0x166141));})['catch'](function(_0x376d84){logger[_0x9c5f('0x3a')]('[RPC][%s][AUTOREPLY]\x20%s',_0x407498,JSON[_0x9c5f('0x39')](_0x376d84));})[_0x9c5f('0x3b')](function(){Promise['resolve']()[_0x9c5f('0x38')](function(){if(_0x198def[0x0]!=='2'||_0x469bff['autoreplyExecuted'])return;return rpc[_0x429b6c+_0x9c5f('0x3c')][_0x9c5f('0x3d')](_0x469bff['id'],{'autoreplyExecuted':!![]})[_0x9c5f('0x38')](function(_0xe5d4ab){logger[_0x9c5f('0x16')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x407498,JSON['stringify'](_0xe5d4ab));})[_0x9c5f('0x3e')](function(_0x16fd2c){logger[_0x9c5f('0x3a')](_0x9c5f('0x3f'),_0x407498,JSON[_0x9c5f('0x39')](_0x16fd2c));});})[_0x9c5f('0x38')](function(){_0x2cbbfa[_0x9c5f('0x13')]();});});}else{return rpc[this[_0x9c5f('0xe')]+_0x9c5f('0x37')]['create'](_0x27fd7d)[_0x9c5f('0x38')](function(){logger['info'](_0x9c5f('0x12'),_0x407498,_0x27fd7d[_0x9c5f('0x10')]);})['catch'](function(_0x11e55c){logger[_0x9c5f('0x3a')](_0x9c5f('0x12'),_0x407498,JSON['stringify'](_0x11e55c));})[_0x9c5f('0x3b')](function(){Promise['resolve']()['then'](function(){if(_0x198def[0x0]!=='2'||_0x469bff[_0x9c5f('0x18')])return;return rpc[_0x429b6c+_0x9c5f('0x3c')][_0x9c5f('0x3d')](_0x469bff['id'],{'autoreplyExecuted':!![]})[_0x9c5f('0x38')](function(_0x77959f){logger[_0x9c5f('0x16')](_0x9c5f('0x19'),_0x407498,JSON[_0x9c5f('0x39')](_0x77959f));})[_0x9c5f('0x3e')](function(_0x49be1c){logger['error'](_0x9c5f('0x3f'),_0x407498,JSON['stringify'](_0x49be1c));});})['then'](function(){_0x2cbbfa[_0x9c5f('0x13')]();});});}}}catch(_0x4def06){logger['error'](_0x9c5f('0x12'),_0x407498,JSON[_0x9c5f('0x39')](_0x4def06));_0x2cbbfa[_0x9c5f('0x40')]();}};}; \ 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 5afba30..d07faab 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 _0x796c=['[%s][CLOSE]\x20%s','stringify','stop','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','catch','error'];(function(_0x51976d,_0x1da87c){var _0x4268c5=function(_0x2bb422){while(--_0x2bb422){_0x51976d['push'](_0x51976d['shift']());}};_0x4268c5(++_0x1da87c);}(_0x796c,0xed));var _0xc796=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x796c[_0x2aec52];return _0x3b8835;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0xc796('0x0')),'openchannelInteraction':require(_0xc796('0x1')),'smsInteraction':require(_0xc796('0x2')),'mailInteraction':require(_0xc796('0x3')),'faxInteraction':require(_0xc796('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0xa8b4ad,_0x26c5cf,_0xf1990f,_0x32280d){return function(_0x351f89){try{logger['info'](_0xc796('0x5'),_0xa8b4ad,_0x26c5cf[0x0]);var _0x4bde9d={'closed':0x1,'closedAt':moment()[_0xc796('0x6')](_0xc796('0x7')),'closeReason':'system','disposition':_0x26c5cf[0x0]};if(rpc[_0x32280d[_0xc796('0x8')]+'Interaction']){rpc[_0x32280d[_0xc796('0x8')]+_0xc796('0x9')][_0xc796('0xa')](_0x32280d[_0xc796('0xb')]['id'],_0x4bde9d)[_0xc796('0xc')](function(_0x5a3476){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0xa8b4ad,_0x32280d[_0xc796('0xb')]['id']);})[_0xc796('0xd')](function(_0x230582){logger[_0xc796('0xe')](_0xc796('0xf'),_0xa8b4ad,JSON[_0xc796('0x10')](_0x230582));})['finally'](function(){_0x351f89[_0xc796('0x11')]();});}}catch(_0x1cc569){logger[_0xc796('0xe')]('[%s][CLOSE]\x20%s',_0xa8b4ad,JSON[_0xc796('0x10')](_0x1cc569));_0x351f89[_0xc796('0x11')]();}};}; \ No newline at end of file +var _0x743f=['../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x273a3d,_0x51e639){var _0xc38e70=function(_0x32e19d){while(--_0x32e19d){_0x273a3d['push'](_0x273a3d['shift']());}};_0xc38e70(++_0x51e639);}(_0x743f,0x1dc));var _0xf743=function(_0x4e397a,_0x35f3ab){_0x4e397a=_0x4e397a-0x0;var _0x2950fc=_0x743f[_0x4e397a];return _0x2950fc;};'use strict';var moment=require(_0xf743('0x0'));var logger=require(_0xf743('0x1'))('routing');var rpc={'chatInteraction':require(_0xf743('0x2')),'openchannelInteraction':require(_0xf743('0x3')),'smsInteraction':require(_0xf743('0x4')),'mailInteraction':require(_0xf743('0x5')),'faxInteraction':require(_0xf743('0x6')),'whatsappInteraction':require(_0xf743('0x7'))};exports[_0xf743('0x8')]=function(_0x440b81,_0x49cc4f,_0x388b98,_0x58c876){return function(_0x206329){try{logger[_0xf743('0x9')](_0xf743('0xa'),_0x440b81,_0x49cc4f[0x0]);var _0x2ec8d7={'closed':0x1,'closedAt':moment()[_0xf743('0xb')](_0xf743('0xc')),'closeReason':'system','disposition':_0x49cc4f[0x0]};if(rpc[_0x58c876[_0xf743('0xd')]+_0xf743('0xe')]){rpc[_0x58c876[_0xf743('0xd')]+_0xf743('0xe')]['update'](_0x58c876[_0xf743('0xf')]['id'],_0x2ec8d7)['then'](function(_0x409ff5){logger[_0xf743('0x9')](_0xf743('0x10'),_0x440b81,_0x58c876[_0xf743('0xf')]['id']);})[_0xf743('0x11')](function(_0x13b7c5){logger[_0xf743('0x12')](_0xf743('0x13'),_0x440b81,JSON[_0xf743('0x14')](_0x13b7c5));})[_0xf743('0x15')](function(){_0x206329[_0xf743('0x16')]();});}}catch(_0x343294){logger[_0xf743('0x12')](_0xf743('0x13'),_0x440b81,JSON[_0xf743('0x14')](_0x343294));_0x206329['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 b9962f8..51d95d2 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 _0xae30=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','result','speech','providerName','dialogflow','stringify','metadata','endConversation','catch','error','lodash','moment','apiai-promise','./utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae30,0x10a));var _0x0ae3=function(_0x122fe6,_0x4ac758){_0x122fe6=_0x122fe6-0x0;var _0x36b7d2=_0xae30[_0x122fe6];return _0x36b7d2;};'use strict';var _=require(_0x0ae3('0x0'));var moment=require(_0x0ae3('0x1'));var apiai=require(_0x0ae3('0x2'));var md5=require('md5');var utils=require(_0x0ae3('0x3'));var logger=require(_0x0ae3('0x4'))(_0x0ae3('0x5'));var rpc={'chatMessage':require(_0x0ae3('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0ae3('0x7')),'smsMessage':require(_0x0ae3('0x8')),'faxMessage':require(_0x0ae3('0x9')),'whatsappMessage':require(_0x0ae3('0xa'))};exports[_0x0ae3('0xb')]=function(_0xda3853,_0x2b81f4){return function(_0x15b7e2){try{if(!_[_0x0ae3('0xc')](this[_0x0ae3('0xd')][_0x0ae3('0xe')])){logger[_0x0ae3('0xf')](_0x0ae3('0x10'),_0xda3853,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x15b7e2[_0x0ae3('0x11')]();}var _0xee8a4c={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x0ae3('0x12')),'direction':_0x0ae3('0x13')};if(this[_0x0ae3('0x14')]===_0x0ae3('0x15')||this['channel']==='whatsapp'){_0xee8a4c[_0x0ae3('0x16')]=this[_0x0ae3('0xd')]['phone'];}var _0x588a65=this[_0x0ae3('0x14')];if(_0x588a65==='chat'){_0xee8a4c[_0x0ae3('0x17')]=this[_0x0ae3('0x18')]['id'];}else{_0xee8a4c[_[_0x0ae3('0x19')](_0x588a65)+_0x0ae3('0x1a')]=this[_0x0ae3('0x18')]['id'];}_0xee8a4c[_[_0x0ae3('0x19')](_0x588a65)+_0x0ae3('0x1b')]=this['interaction']['id'];if(this[_0x0ae3('0xd')]['created']){var _0x402949=_0x2b81f4[0x2];if(!_[_0x0ae3('0x1c')](_0x402949)){_0xee8a4c[_0x0ae3('0x1d')]=utils[_0x0ae3('0x1e')](_0x402949,this);return rpc[_0x588a65+_0x0ae3('0x1f')][_0x0ae3('0x20')](_0xee8a4c)[_0x0ae3('0x21')](function(_0x1bf406){logger[_0x0ae3('0xf')]('[%s][DIALOGFLOW]\x20%s',_0xda3853,_0xee8a4c[_0x0ae3('0x1d')]);})['catch'](function(_0x49d4b7){logger['error']('[%s][DIALOGFLOW]\x20%s',_0xda3853,JSON['stringify'](_0x49d4b7));})['finally'](function(){logger['info'](_0x0ae3('0x22'),_0xda3853);_0x15b7e2[_0x0ae3('0x23')]();});}else{logger[_0x0ae3('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xda3853);_0x15b7e2[_0x0ae3('0x23')]();}}else{var _0x5ecc45=this;var _0xfcf4a8=apiai(_0x2b81f4[0x0],{'language':_0x2b81f4[0x1]||'en'});return _0xfcf4a8['textRequest'](this['message']['body'],{'sessionId':md5(this[_0x0ae3('0xd')]['id'])})[_0x0ae3('0x21')](function(_0x51e7d1){_0x5ecc45['body']['dialogflow']=_0x51e7d1;_0xee8a4c[_0x0ae3('0x1d')]=_0x51e7d1[_0x0ae3('0x24')]['fulfillment'][_0x0ae3('0x25')];_0xee8a4c[_0x0ae3('0x26')]=_0x0ae3('0x27');_0xee8a4c['providerResponse']=JSON[_0x0ae3('0x28')](_0x51e7d1);return rpc[_0x588a65+_0x0ae3('0x1f')][_0x0ae3('0x20')](_0xee8a4c)['then'](function(_0x293e40){logger[_0x0ae3('0xf')](_0x0ae3('0x10'),_0xda3853,_0xee8a4c['body']);if(_0x51e7d1[_0x0ae3('0x24')][_0x0ae3('0x29')][_0x0ae3('0x2a')]){_0x15b7e2[_0x0ae3('0x11')]();}else{_0x15b7e2[_0x0ae3('0x23')]();}})[_0x0ae3('0x2b')](function(_0x5e8979){logger[_0x0ae3('0x2c')](_0x0ae3('0x10'),_0xda3853,JSON[_0x0ae3('0x28')](_0x5e8979));_0x15b7e2[_0x0ae3('0x11')]();});})[_0x0ae3('0x2b')](function(_0x23f213){logger[_0x0ae3('0x2c')](_0x0ae3('0x10'),_0xda3853,_0x23f213['message']);_0x15b7e2[_0x0ae3('0x11')]();});}}catch(_0x25ec0d){logger[_0x0ae3('0x2c')](_0x0ae3('0x10'),_0xda3853,JSON['stringify'](_0x25ec0d));_0x15b7e2[_0x0ae3('0x23')]();}};}; \ No newline at end of file +var _0x6f44=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','create','endConversation','error','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','then','body','catch','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x4b528b,_0x4926f7){var _0x52418b=function(_0x7fbc20){while(--_0x7fbc20){_0x4b528b['push'](_0x4b528b['shift']());}};_0x52418b(++_0x4926f7);}(_0x6f44,0x1ea));var _0x46f4=function(_0x591597,_0x2f82d1){_0x591597=_0x591597-0x0;var _0x28a215=_0x6f44[_0x591597];return _0x28a215;};'use strict';var _=require(_0x46f4('0x0'));var moment=require(_0x46f4('0x1'));var apiai=require('apiai-promise');var md5=require(_0x46f4('0x2'));var utils=require(_0x46f4('0x3'));var logger=require(_0x46f4('0x4'))(_0x46f4('0x5'));var rpc={'chatMessage':require(_0x46f4('0x6')),'openchannelMessage':require(_0x46f4('0x7')),'mailMessage':require(_0x46f4('0x8')),'smsMessage':require(_0x46f4('0x9')),'faxMessage':require(_0x46f4('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x46f4('0xb')]=function(_0x2a50b1,_0x37d6a2){return function(_0x4b791c){try{if(!_['isNil'](this[_0x46f4('0xc')][_0x46f4('0xd')])){logger['info'](_0x46f4('0xe'),_0x2a50b1,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4b791c[_0x46f4('0xf')]();}var _0x487ef8={'ContactId':this[_0x46f4('0x10')]['id'],'sentAt':moment()[_0x46f4('0x11')](_0x46f4('0x12')),'direction':_0x46f4('0x13')};if(this[_0x46f4('0x14')]===_0x46f4('0x15')||this[_0x46f4('0x14')]===_0x46f4('0x16')){_0x487ef8[_0x46f4('0x17')]=this[_0x46f4('0xc')][_0x46f4('0x17')];}var _0x1262f6=this['channel'];if(_0x1262f6===_0x46f4('0x18')){_0x487ef8[_0x46f4('0x19')]=this['account']['id'];}else{_0x487ef8[_[_0x46f4('0x1a')](_0x1262f6)+_0x46f4('0x1b')]=this[_0x46f4('0x1c')]['id'];}_0x487ef8[_['upperFirst'](_0x1262f6)+_0x46f4('0x1d')]=this['interaction']['id'];if(this['interaction'][_0x46f4('0x1e')]){var _0xf082a9=_0x37d6a2[0x2];if(!_[_0x46f4('0x1f')](_0xf082a9)){_0x487ef8['body']=utils['getMustacheRender'](_0xf082a9,this);return rpc[_0x1262f6+'Message']['create'](_0x487ef8)[_0x46f4('0x20')](function(_0x433297){logger['info'](_0x46f4('0xe'),_0x2a50b1,_0x487ef8[_0x46f4('0x21')]);})[_0x46f4('0x22')](function(_0x33521e){logger['error'](_0x46f4('0xe'),_0x2a50b1,JSON[_0x46f4('0x23')](_0x33521e));})[_0x46f4('0x24')](function(){logger[_0x46f4('0x25')](_0x46f4('0x26'),_0x2a50b1);_0x4b791c[_0x46f4('0x27')]();});}else{logger['info'](_0x46f4('0x28'),_0x2a50b1);_0x4b791c[_0x46f4('0x27')]();}}else{var _0x39760b=this;var _0x4ba21a=apiai(_0x37d6a2[0x0],{'language':_0x37d6a2[0x1]||'en'});return _0x4ba21a[_0x46f4('0x29')](this[_0x46f4('0x2a')][_0x46f4('0x21')],{'sessionId':md5(this[_0x46f4('0xc')]['id'])})[_0x46f4('0x20')](function(_0x41be5e){_0x39760b[_0x46f4('0x21')][_0x46f4('0x2b')]=_0x41be5e;_0x487ef8[_0x46f4('0x21')]=_0x41be5e[_0x46f4('0x2c')][_0x46f4('0x2d')][_0x46f4('0x2e')];_0x487ef8[_0x46f4('0x2f')]='dialogflow';_0x487ef8[_0x46f4('0x30')]=JSON[_0x46f4('0x23')](_0x41be5e);return rpc[_0x1262f6+_0x46f4('0x31')][_0x46f4('0x32')](_0x487ef8)[_0x46f4('0x20')](function(_0x33a7c5){logger['info'](_0x46f4('0xe'),_0x2a50b1,_0x487ef8['body']);if(_0x41be5e['result']['metadata'][_0x46f4('0x33')]){_0x4b791c['next']();}else{_0x4b791c[_0x46f4('0x27')]();}})[_0x46f4('0x22')](function(_0x3c8c91){logger[_0x46f4('0x34')](_0x46f4('0xe'),_0x2a50b1,JSON['stringify'](_0x3c8c91));_0x4b791c[_0x46f4('0xf')]();});})[_0x46f4('0x22')](function(_0x1c1329){logger['error'](_0x46f4('0xe'),_0x2a50b1,_0x1c1329[_0x46f4('0x2a')]);_0x4b791c[_0x46f4('0xf')]();});}}catch(_0x4ab474){logger['error'](_0x46f4('0xe'),_0x2a50b1,JSON[_0x46f4('0x23')](_0x4ab474));_0x4b791c[_0x46f4('0x27')]();}};}; \ 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 ca7b73a..c20cadb 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 _0x6981=['intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','next','stop','message','lodash','dialogflow','md5','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x6981,0x14d));var _0x1698=function(_0x46ae23,_0x52b5c6){_0x46ae23=_0x46ae23-0x0;var _0x1db06b=_0x6981[_0x46ae23];return _0x1db06b;};'use strict';var _=require(_0x1698('0x0'));var dialogflow=require(_0x1698('0x1'));var md5=require(_0x1698('0x2'));var moment=require(_0x1698('0x3'));var Promise=require('bluebird');var logger=require(_0x1698('0x4'))(_0x1698('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0x1698('0x6')),'openchannelMessage':require(_0x1698('0x7')),'mailMessage':require(_0x1698('0x8')),'smsMessage':require(_0x1698('0x9')),'faxMessage':require(_0x1698('0xa')),'whatsappMessage':require(_0x1698('0xb'))};function createMessage(_0x40591a,_0x4827e8,_0x3e9643,_0x2af7c5){return new Promise(function(_0x1689d6,_0x2a2517){var _0x24a102=_[_0x1698('0xc')](_0x3e9643);_0x24a102[_0x1698('0xd')]=_0x2af7c5;return rpc[_0x4827e8+_0x1698('0xe')][_0x1698('0xf')](_0x24a102)[_0x1698('0x10')](function(){logger[_0x1698('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x40591a,_0x24a102[_0x1698('0xd')]);_0x1689d6();})[_0x1698('0x12')](function(_0x4c737d){logger[_0x1698('0x13')](_0x1698('0x14'),_0x40591a,JSON[_0x1698('0x15')](_0x4c737d));_0x2a2517(_0x4c737d);});});}exports[_0x1698('0x16')]=function(_0x5a9488,_0x1893c1){return function(_0x34ae04){try{if(!_[_0x1698('0x17')](this[_0x1698('0x18')][_0x1698('0x19')])){logger[_0x1698('0x11')](_0x1698('0x14'),_0x5a9488,_0x1698('0x1a'));return _0x34ae04['next']();}var _0x676d77={'ContactId':this[_0x1698('0x1b')]['id'],'sentAt':moment()[_0x1698('0x1c')](_0x1698('0x1d')),'direction':_0x1698('0x1e')};if(this['channel']===_0x1698('0x1f')||this[_0x1698('0x20')]==='whatsapp'){_0x676d77[_0x1698('0x21')]=this['interaction']['phone'];}var _0x59f933=this['channel'];if(_0x59f933===_0x1698('0x22')){_0x676d77[_0x1698('0x23')]=this[_0x1698('0x24')]['id'];}else{_0x676d77[_[_0x1698('0x25')](_0x59f933)+_0x1698('0x26')]=this[_0x1698('0x24')]['id'];}_0x676d77[_['upperFirst'](_0x59f933)+_0x1698('0x27')]=this[_0x1698('0x18')]['id'];if(this[_0x1698('0x18')][_0x1698('0x28')]){var _0x67a70a=_0x1893c1[0x4];if(!_[_0x1698('0x29')](_0x67a70a)){_0x676d77[_0x1698('0xd')]=utils[_0x1698('0x2a')](_0x67a70a,this);return rpc[_0x59f933+_0x1698('0xe')][_0x1698('0xf')](_0x676d77)[_0x1698('0x10')](function(_0x1cf8c6){logger[_0x1698('0x11')](_0x1698('0x14'),_0x5a9488,_0x676d77[_0x1698('0xd')]);})[_0x1698('0x12')](function(_0x3973a9){logger['error'](_0x1698('0x14'),_0x5a9488,JSON[_0x1698('0x15')](_0x3973a9));})[_0x1698('0x2b')](function(){logger[_0x1698('0x11')](_0x1698('0x2c'),_0x5a9488);_0x34ae04['stop']();});}else{logger[_0x1698('0x11')](_0x1698('0x2d'),_0x5a9488);_0x34ae04['stop']();}}else{var _0x1176c9=this;var _0x2370ba=_0x1893c1[0x2][_0x1698('0x2e')](/\\n/g,'\x0a');var _0x1bee8b={'credentials':{'private_key':_0x2370ba,'client_email':_0x1893c1[0x1]}};var _0x39cca8=new dialogflow[(_0x1698('0x2f'))](_0x1bee8b);var _0x373d59=_0x39cca8[_0x1698('0x30')](_0x1893c1[0x0],md5(_0x1176c9[_0x1698('0x18')]['id']));var _0x266376={'session':_0x373d59,'queryInput':{'text':{'text':_0x1176c9['message'][_0x1698('0xd')],'languageCode':_0x1893c1[0x3]||'en'}}};return _0x39cca8[_0x1698('0x31')](_0x266376)[_0x1698('0x10')](function(_0x5ee4dd){if(_0x5ee4dd&&_0x5ee4dd[_0x1698('0x32')]){_0x1176c9[_0x1698('0xd')][_0x1698('0x33')]=_0x5ee4dd;var _0xc30892=_0x5ee4dd[0x0];var _0x1688e4=_0xc30892['queryResult'][_0x1698('0x34')]&&_0xc30892[_0x1698('0x35')]['diagnosticInfo'][_0x1698('0x36')]?_0xc30892[_0x1698('0x35')][_0x1698('0x34')][_0x1698('0x36')][_0x1698('0x37')][_0x1698('0x38')]:![];_0x1176c9[_0x1698('0xd')][_0x1698('0x39')]=_0xc30892['queryResult']['action'];_0x1176c9[_0x1698('0xd')][_0x1698('0x3a')]=_0xc30892['queryResult'][_0x1698('0x3b')];_0x1176c9[_0x1698('0xd')][_0x1698('0x3c')]=_0xc30892['queryResult']['diagnosticInfo']&&_0xc30892['queryResult'][_0x1698('0x34')]['fields']?_0xc30892[_0x1698('0x35')][_0x1698('0x34')]['fields'][_0x1698('0x37')][_0x1698('0x38')]:![];_0x1176c9['body'][_0x1698('0x3d')]=_0xc30892[_0x1698('0x35')][_0x1698('0x3e')][_0x1698('0x3f')];_0x1176c9[_0x1698('0xd')][_0x1698('0x40')]=_0xc30892[_0x1698('0x35')][_0x1698('0x3e')]['displayName'];_0x1176c9[_0x1698('0xd')][_0x1698('0x41')]=_0xc30892['queryResult'][_0x1698('0x3e')][_0x1698('0x42')];_0x1176c9[_0x1698('0xd')][_0x1698('0x43')]=_0xc30892[_0x1698('0x35')][_0x1698('0x44')];_0x1176c9[_0x1698('0xd')][_0x1698('0x45')]=_0xc30892[_0x1698('0x35')][_0x1698('0x46')];_0x1176c9['body'][_0x1698('0x47')]=_0xc30892[_0x1698('0x35')]['intentDetectionConfidence'];_0x676d77[_0x1698('0x48')]='dialogflowV2';_0x676d77[_0x1698('0x49')]=JSON[_0x1698('0x15')](_0x5ee4dd);var _0x14ee3f=[];for(var _0x585316=0x0;_0x585316<_0x5ee4dd['length'];_0x585316++){var _0x1e9911=_0x5ee4dd[_0x585316];if(_0x1e9911&&_0x1e9911[_0x1698('0x35')]&&_0x1e9911[_0x1698('0x35')][_0x1698('0x4a')]){_0x14ee3f[_0x1698('0x4b')](createMessage(_0x5a9488,_0x59f933,_0x676d77,_0x1e9911[_0x1698('0x35')][_0x1698('0x4a')]));}}return Promise['all'](_0x14ee3f)[_0x1698('0x10')](function(){if(_0x1688e4){_0x34ae04[_0x1698('0x4c')]();}else{_0x34ae04[_0x1698('0x4d')]();}})['catch'](function(_0x2e3830){logger[_0x1698('0x13')](_0x1698('0x14'),_0x5a9488,JSON['stringify'](_0x2e3830));_0x34ae04[_0x1698('0x4c')]();});}})[_0x1698('0x12')](function(_0x38ae8e){logger[_0x1698('0x13')](_0x1698('0x14'),_0x5a9488,_0x38ae8e[_0x1698('0x4e')]);_0x34ae04[_0x1698('0x4c')]();});}}catch(_0x494019){logger[_0x1698('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x5a9488,JSON[_0x1698('0x15')](_0x494019));_0x34ae04[_0x1698('0x4d')]();}};}; \ No newline at end of file +var _0x554b=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','getMustacheRender','Message','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','length','queryResult','diagnosticInfo','fields','boolValue','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','next','stop','lodash','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x554b,0xda));var _0xb554=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x554b[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0xb554('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xb554('0x1'));var moment=require(_0xb554('0x2'));var Promise=require(_0xb554('0x3'));var logger=require(_0xb554('0x4'))(_0xb554('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0xb554('0x6')),'openchannelMessage':require(_0xb554('0x7')),'mailMessage':require(_0xb554('0x8')),'smsMessage':require(_0xb554('0x9')),'faxMessage':require(_0xb554('0xa')),'whatsappMessage':require(_0xb554('0xb'))};function createMessage(_0x355800,_0x4daf01,_0x2757c8,_0x4da21b){return new Promise(function(_0x569567,_0xae6472){var _0x2a6b1d=_[_0xb554('0xc')](_0x2757c8);_0x2a6b1d[_0xb554('0xd')]=_0x4da21b;return rpc[_0x4daf01+'Message'][_0xb554('0xe')](_0x2a6b1d)[_0xb554('0xf')](function(){logger[_0xb554('0x10')](_0xb554('0x11'),_0x355800,_0x2a6b1d['body']);_0x569567();})[_0xb554('0x12')](function(_0x45cae3){logger[_0xb554('0x13')](_0xb554('0x11'),_0x355800,JSON['stringify'](_0x45cae3));_0xae6472(_0x45cae3);});});}exports[_0xb554('0x14')]=function(_0x176753,_0x2e643d){return function(_0x562410){try{if(!_[_0xb554('0x15')](this['interaction'][_0xb554('0x16')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x176753,_0xb554('0x17'));return _0x562410['next']();}var _0x150bd8={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xb554('0x18')),'direction':_0xb554('0x19')};if(this[_0xb554('0x1a')]===_0xb554('0x1b')||this['channel']===_0xb554('0x1c')){_0x150bd8[_0xb554('0x1d')]=this['interaction'][_0xb554('0x1d')];}var _0x14f389=this['channel'];if(_0x14f389===_0xb554('0x1e')){_0x150bd8[_0xb554('0x1f')]=this[_0xb554('0x20')]['id'];}else{_0x150bd8[_[_0xb554('0x21')](_0x14f389)+_0xb554('0x22')]=this['account']['id'];}_0x150bd8[_[_0xb554('0x21')](_0x14f389)+_0xb554('0x23')]=this[_0xb554('0x24')]['id'];if(this['interaction'][_0xb554('0x25')]){var _0xbd9532=_0x2e643d[0x4];if(!_[_0xb554('0x26')](_0xbd9532)){_0x150bd8[_0xb554('0xd')]=utils[_0xb554('0x27')](_0xbd9532,this);return rpc[_0x14f389+_0xb554('0x28')][_0xb554('0xe')](_0x150bd8)['then'](function(_0x35429c){logger[_0xb554('0x10')](_0xb554('0x11'),_0x176753,_0x150bd8[_0xb554('0xd')]);})[_0xb554('0x12')](function(_0x42eacc){logger[_0xb554('0x13')](_0xb554('0x11'),_0x176753,JSON[_0xb554('0x29')](_0x42eacc));})[_0xb554('0x2a')](function(){logger[_0xb554('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x176753);_0x562410['stop']();});}else{logger[_0xb554('0x10')](_0xb554('0x2b'),_0x176753);_0x562410['stop']();}}else{var _0x284318=this;var _0x895d74=_0x2e643d[0x2][_0xb554('0x2c')](/\\n/g,'\x0a');var _0x41e0b9={'credentials':{'private_key':_0x895d74,'client_email':_0x2e643d[0x1]}};var _0x25c338=new dialogflow[(_0xb554('0x2d'))](_0x41e0b9);var _0x40150b=_0x25c338['sessionPath'](_0x2e643d[0x0],md5(_0x284318[_0xb554('0x24')]['id']));var _0x29fd7d={'session':_0x40150b,'queryInput':{'text':{'text':_0x284318[_0xb554('0x2e')][_0xb554('0xd')],'languageCode':_0x2e643d[0x3]||'en'}}};return _0x25c338[_0xb554('0x2f')](_0x29fd7d)['then'](function(_0x26b365){if(_0x26b365&&_0x26b365[_0xb554('0x30')]){_0x284318[_0xb554('0xd')]['dialogflowV2']=_0x26b365;var _0x476656=_0x26b365[0x0];var _0x30f1d2=_0x476656[_0xb554('0x31')][_0xb554('0x32')]&&_0x476656[_0xb554('0x31')][_0xb554('0x32')][_0xb554('0x33')]?_0x476656[_0xb554('0x31')]['diagnosticInfo']['fields']['end_conversation'][_0xb554('0x34')]:![];_0x284318[_0xb554('0xd')]['DIALOGFLOWV2_ACTION']=_0x476656[_0xb554('0x31')][_0xb554('0x35')];_0x284318[_0xb554('0xd')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x476656['queryResult'][_0xb554('0x36')];_0x284318['body'][_0xb554('0x37')]=_0x476656['queryResult'][_0xb554('0x32')]&&_0x476656[_0xb554('0x31')][_0xb554('0x32')][_0xb554('0x33')]?_0x476656[_0xb554('0x31')]['diagnosticInfo'][_0xb554('0x33')][_0xb554('0x38')][_0xb554('0x34')]:![];_0x284318['body'][_0xb554('0x39')]=_0x476656['queryResult'][_0xb554('0x3a')]['name'];_0x284318[_0xb554('0xd')][_0xb554('0x3b')]=_0x476656[_0xb554('0x31')]['intent'][_0xb554('0x3c')];_0x284318[_0xb554('0xd')][_0xb554('0x3d')]=_0x476656['queryResult'][_0xb554('0x3a')][_0xb554('0x3e')];_0x284318['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x476656[_0xb554('0x31')][_0xb554('0x3f')];_0x284318[_0xb554('0xd')][_0xb554('0x40')]=_0x476656[_0xb554('0x31')][_0xb554('0x41')];_0x284318[_0xb554('0xd')][_0xb554('0x42')]=_0x476656[_0xb554('0x31')][_0xb554('0x43')];_0x150bd8[_0xb554('0x44')]='dialogflowV2';_0x150bd8[_0xb554('0x45')]=JSON[_0xb554('0x29')](_0x26b365);var _0x1652fd=[];for(var _0x4cb94b=0x0;_0x4cb94b<_0x26b365[_0xb554('0x30')];_0x4cb94b++){var _0x1c32af=_0x26b365[_0x4cb94b];if(_0x1c32af&&_0x1c32af[_0xb554('0x31')]&&_0x1c32af[_0xb554('0x31')][_0xb554('0x46')]){_0x1652fd[_0xb554('0x47')](createMessage(_0x176753,_0x14f389,_0x150bd8,_0x1c32af['queryResult'][_0xb554('0x46')]));}}return Promise[_0xb554('0x48')](_0x1652fd)[_0xb554('0xf')](function(){if(_0x30f1d2){_0x562410[_0xb554('0x49')]();}else{_0x562410[_0xb554('0x4a')]();}})[_0xb554('0x12')](function(_0x5e8d49){logger[_0xb554('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x176753,JSON[_0xb554('0x29')](_0x5e8d49));_0x562410[_0xb554('0x49')]();});}})[_0xb554('0x12')](function(_0x527452){logger['error'](_0xb554('0x11'),_0x176753,_0x527452['message']);_0x562410[_0xb554('0x49')]();});}}catch(_0xe2c23f){logger[_0xb554('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x176753,JSON['stringify'](_0xe2c23f));_0x562410['stop']();}};}; \ 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 35c9569..2485092 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 _0x0caa=['info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue'];(function(_0xe6b674,_0x267db9){var _0x2a6236=function(_0x4b6f69){while(--_0x4b6f69){_0xe6b674['push'](_0xe6b674['shift']());}};_0x2a6236(++_0x267db9);}(_0x0caa,0x127));var _0xa0ca=function(_0x55157b,_0x19406b){_0x55157b=_0x55157b-0x0;var _0x2a2f2c=_0x0caa[_0x55157b];return _0x2a2f2c;};'use strict';var schema=require(_0xa0ca('0x0'));var _=require(_0xa0ca('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0xa0ca('0x2'))('routing');var gotoif=schema({'condition':{'type':_0xa0ca('0x3'),'required':!![],'message':_0xa0ca('0x4')},'priorityTrue':{'type':_0xa0ca('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xa0ca('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xa0ca('0x6')]=function(_0x46f42f,_0x3de8c4){return function(_0x3843a9){try{var _0x465d63={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x3de8c4[0x0],this),{'wordwrap':![]})[_0xa0ca('0x7')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3de8c4[0x1],'priorityFalse':_0x3de8c4[0x2]};var _0x104ca5=gotoif[_0xa0ca('0x0')](_0x465d63,{'typecast':!![]});if(_0x104ca5[_0xa0ca('0x8')]){logger[_0xa0ca('0x9')](_0xa0ca('0xa'),_0x46f42f,_[_0xa0ca('0xb')](_0x104ca5,_0xa0ca('0xc'))[_0xa0ca('0xd')](',\x20'));_0x3843a9[_0xa0ca('0xe')]();}else{try{var _0x5a3b0b=eval('('+_0x465d63[_0xa0ca('0xf')]+')');var _0x35a5de=_0x5a3b0b?_0x465d63[_0xa0ca('0x10')]:_0x465d63['priorityFalse'];logger[_0xa0ca('0x11')](_0xa0ca('0x12'),_0x46f42f,_0x465d63[_0xa0ca('0xf')],_0x5a3b0b,_0x35a5de||_0xa0ca('0x13'));if(_0x35a5de){var _0x214d87=_[_0xa0ca('0x14')](_0x3843a9[_0xa0ca('0x15')](),{'p':_0x35a5de});if(_0x214d87>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x46f42f,_0x35a5de||_0xa0ca('0x13'),_0x214d87);_0x3843a9[_0xa0ca('0x13')](_0x214d87);}else{logger[_0xa0ca('0x11')](_0xa0ca('0x16'),_0x46f42f,_0x35a5de||_0xa0ca('0x13'));_0x3843a9['stop']();}}else{_0x3843a9[_0xa0ca('0x13')]();}}catch(_0x2379ca){logger[_0xa0ca('0x9')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x46f42f,_0x2379ca[_0xa0ca('0xc')]);_0x3843a9['stop']();}}}catch(_0xb8ef6a){logger[_0xa0ca('0x9')](_0xa0ca('0xa'),_0x46f42f,JSON[_0xa0ca('0x17')](_0xb8ef6a));_0x3843a9['stop']();}};}; \ No newline at end of file +var _0x4ded=['next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','error','[%s][GOTOIF]\x20%s','map','message','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x4ded,0x17e));var _0xd4de=function(_0x50db6b,_0x1e043e){_0x50db6b=_0x50db6b-0x0;var _0x1395d4=_0x4ded[_0x50db6b];return _0x1395d4;};'use strict';var schema=require(_0xd4de('0x0'));var _=require(_0xd4de('0x1'));var htmlToText=require(_0xd4de('0x2'));var utils=require('./utils');var logger=require(_0xd4de('0x3'))(_0xd4de('0x4'));var gotoif=schema({'condition':{'type':_0xd4de('0x5'),'required':!![],'message':_0xd4de('0x6')},'priorityTrue':{'type':_0xd4de('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':_0xd4de('0x8')}});exports[_0xd4de('0x9')]=function(_0x155ef1,_0x273a2a){return function(_0x5650f7){try{var _0x1209a8={'condition':htmlToText[_0xd4de('0xa')](utils['getMustacheRender'](_0x273a2a[0x0],this),{'wordwrap':![]})[_0xd4de('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x273a2a[0x1],'priorityFalse':_0x273a2a[0x2]};var _0x3db4eb=gotoif['validate'](_0x1209a8,{'typecast':!![]});if(_0x3db4eb['length']){logger[_0xd4de('0xc')](_0xd4de('0xd'),_0x155ef1,_[_0xd4de('0xe')](_0x3db4eb,_0xd4de('0xf'))['join'](',\x20'));_0x5650f7[_0xd4de('0x10')]();}else{try{var _0x426f0b=eval('('+_0x1209a8['condition']+')');var _0x394a9d=_0x426f0b?_0x1209a8[_0xd4de('0x11')]:_0x1209a8[_0xd4de('0x12')];logger[_0xd4de('0x13')](_0xd4de('0x14'),_0x155ef1,_0x1209a8['condition'],_0x426f0b,_0x394a9d||'next');if(_0x394a9d){var _0x22bcfd=_[_0xd4de('0x15')](_0x5650f7['rules'](),{'p':_0x394a9d});if(_0x22bcfd>=0x0){logger['info'](_0xd4de('0x16'),_0x155ef1,_0x394a9d||_0xd4de('0x17'),_0x22bcfd);_0x5650f7[_0xd4de('0x17')](_0x22bcfd);}else{logger[_0xd4de('0x13')](_0xd4de('0x18'),_0x155ef1,_0x394a9d||_0xd4de('0x17'));_0x5650f7['stop']();}}else{_0x5650f7[_0xd4de('0x17')]();}}catch(_0x526ab1){logger[_0xd4de('0xc')](_0xd4de('0x19'),_0x155ef1,_0x526ab1['message']);_0x5650f7[_0xd4de('0x10')]();}}}catch(_0x387c56){logger['error'](_0xd4de('0xd'),_0x155ef1,JSON[_0xd4de('0x1a')](_0x387c56));_0x5650f7[_0xd4de('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 55a15ba..31a7099 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 _0x9eff=['map','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0x2d2e31,_0x305e39){var _0x50a02a=function(_0x308203){while(--_0x308203){_0x2d2e31['push'](_0x2d2e31['shift']());}};_0x50a02a(++_0x305e39);}(_0x9eff,0x1d7));var _0xf9ef=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9eff[_0x199572];return _0x13cfa3;};'use strict';var schema=require('validate');var _=require(_0xf9ef('0x0'));var logger=require(_0xf9ef('0x1'))(_0xf9ef('0x2'));var gotop=schema({'priority':{'type':_0xf9ef('0x3'),'required':!![],'message':_0xf9ef('0x4')}});exports[_0xf9ef('0x5')]=function(_0x32ef21,_0x460e9f){return function(_0x1be431){try{var _0x33cc49={'priority':_0x460e9f[0x0]};var _0x323c1c=gotop['validate'](_0x33cc49,{'typecast':!![]});if(_0x323c1c[_0xf9ef('0x6')]){logger[_0xf9ef('0x7')](_0xf9ef('0x8'),_0x32ef21,_[_0xf9ef('0x9')](_0x323c1c,'message')['join'](',\x20'));_0x1be431[_0xf9ef('0xa')]();}else{logger[_0xf9ef('0xb')](_0xf9ef('0xc'),_0x32ef21,_0x33cc49[_0xf9ef('0xd')]);if(_0x33cc49['priority']){var _0x3f8fd5=_[_0xf9ef('0xe')](_0x1be431[_0xf9ef('0xf')](),{'p':_0x33cc49['priority']});if(_0x3f8fd5>=0x0){logger[_0xf9ef('0xb')](_0xf9ef('0x10'),_0x32ef21,_0x33cc49[_0xf9ef('0xd')]||_0xf9ef('0x11'),_0x3f8fd5);_0x1be431[_0xf9ef('0x11')](_0x3f8fd5);}else{logger[_0xf9ef('0xb')](_0xf9ef('0x12'),_0x32ef21,_0x33cc49[_0xf9ef('0xd')]||_0xf9ef('0x11'));_0x1be431[_0xf9ef('0xa')]();}}else{_0x1be431[_0xf9ef('0x11')]();}}}catch(_0x45eeaf){logger[_0xf9ef('0x7')](_0xf9ef('0x8'),_0x32ef21,JSON[_0xf9ef('0x13')](_0x45eeaf));_0x1be431[_0xf9ef('0xa')]();}};}; \ No newline at end of file +var _0x830a=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','lodash','../../../../config/logger','routing','number','consequence','validate','length','error','[%s][GOTOP]\x20%s','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x22997f,_0x31eee0){var _0x4d17b9=function(_0x524756){while(--_0x524756){_0x22997f['push'](_0x22997f['shift']());}};_0x4d17b9(++_0x31eee0);}(_0x830a,0x169));var _0xa830=function(_0x56553a,_0x458912){_0x56553a=_0x56553a-0x0;var _0x408e7e=_0x830a[_0x56553a];return _0x408e7e;};'use strict';var schema=require('validate');var _=require(_0xa830('0x0'));var logger=require(_0xa830('0x1'))(_0xa830('0x2'));var gotop=schema({'priority':{'type':_0xa830('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xa830('0x4')]=function(_0x3809b2,_0x49de20){return function(_0x7bc052){try{var _0x405660={'priority':_0x49de20[0x0]};var _0x4aefdb=gotop[_0xa830('0x5')](_0x405660,{'typecast':!![]});if(_0x4aefdb[_0xa830('0x6')]){logger[_0xa830('0x7')](_0xa830('0x8'),_0x3809b2,_['map'](_0x4aefdb,_0xa830('0x9'))[_0xa830('0xa')](',\x20'));_0x7bc052[_0xa830('0xb')]();}else{logger['info'](_0xa830('0xc'),_0x3809b2,_0x405660[_0xa830('0xd')]);if(_0x405660[_0xa830('0xd')]){var _0x5ed473=_[_0xa830('0xe')](_0x7bc052[_0xa830('0xf')](),{'p':_0x405660['priority']});if(_0x5ed473>=0x0){logger[_0xa830('0x10')](_0xa830('0x11'),_0x3809b2,_0x405660[_0xa830('0xd')]||_0xa830('0x12'),_0x5ed473);_0x7bc052[_0xa830('0x12')](_0x5ed473);}else{logger[_0xa830('0x10')](_0xa830('0x13'),_0x3809b2,_0x405660[_0xa830('0xd')]||'next');_0x7bc052[_0xa830('0xb')]();}}else{_0x7bc052[_0xa830('0x12')]();}}}catch(_0x4df1f9){logger[_0xa830('0x7')](_0xa830('0x8'),_0x3809b2,JSON['stringify'](_0x4df1f9));_0x7bc052['stop']();}};}; \ 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 081886f..084ffca 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 _0x10a5=['info','body','next','[%s][MESSAGE]\x20%s','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then'];(function(_0x2518e4,_0x486c2e){var _0xcc3d41=function(_0x6b9976){while(--_0x6b9976){_0x2518e4['push'](_0x2518e4['shift']());}};_0xcc3d41(++_0x486c2e);}(_0x10a5,0x163));var _0x510a=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0x10a5[_0x29e2af];return _0x1ea06a;};'use strict';var _=require(_0x510a('0x0'));var utils=require(_0x510a('0x1'));var logger=require(_0x510a('0x2'))(_0x510a('0x3'));var rpc={'chatMessage':require(_0x510a('0x4')),'openchannelMessage':require(_0x510a('0x5')),'mailMessage':require(_0x510a('0x6')),'smsMessage':require(_0x510a('0x7')),'faxMessage':require(_0x510a('0x8')),'whatsappMessage':require(_0x510a('0x9'))};exports[_0x510a('0xa')]=function(_0x4081a9,_0x190ed8){return function(_0x457b21){try{var _0x4bdf71={'body':utils['getMustacheRender'](_0x190ed8[0x0],this),'ContactId':this[_0x510a('0xb')]['id']};if(this[_0x510a('0xc')]===_0x510a('0xd')){_0x4bdf71[_0x510a('0xe')]=this[_0x510a('0xf')]['id'];}else{_0x4bdf71[_[_0x510a('0x10')](this[_0x510a('0xc')])+_0x510a('0x11')]=this[_0x510a('0xf')]['id'];}_0x4bdf71[_['upperFirst'](this[_0x510a('0xc')])+_0x510a('0x12')]=this['interaction']['id'];if(rpc[this[_0x510a('0xc')]+_0x510a('0x13')]){return rpc[this[_0x510a('0xc')]+_0x510a('0x13')][_0x510a('0x14')](_0x4bdf71)[_0x510a('0x15')](function(_0x25facc){logger[_0x510a('0x16')]('[%s][MESSAGE]\x20%s',_0x4081a9,_0x4bdf71[_0x510a('0x17')]);_0x457b21[_0x510a('0x18')]();})['catch'](function(_0x494b03){logger['error'](_0x510a('0x19'),_0x4081a9,JSON[_0x510a('0x1a')](_0x494b03));_0x457b21[_0x510a('0x1b')]();});}}catch(_0x117e1b){logger[_0x510a('0x1c')](_0x510a('0x19'),_0x4081a9,JSON['stringify'](_0x117e1b));_0x457b21[_0x510a('0x1b')]();}};}; \ No newline at end of file +var _0x9626=['getMustacheRender','contact','account','upperFirst','channel','AccountId','Message','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x9626,0x196));var _0x6962=function(_0x322ef0,_0xb69d40){_0x322ef0=_0x322ef0-0x0;var _0x43d7b7=_0x9626[_0x322ef0];return _0x43d7b7;};'use strict';var _=require(_0x6962('0x0'));var utils=require(_0x6962('0x1'));var logger=require(_0x6962('0x2'))('routing');var rpc={'chatMessage':require(_0x6962('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6962('0x4')),'smsMessage':require(_0x6962('0x5')),'faxMessage':require(_0x6962('0x6')),'whatsappMessage':require(_0x6962('0x7'))};exports['consequence']=function(_0x457938,_0x4da270){return function(_0x188f79){try{var _0x38b226={'body':utils[_0x6962('0x8')](_0x4da270[0x0],this),'ContactId':this[_0x6962('0x9')]['id']};if(this['channel']==='chat'){_0x38b226['ChatWebsiteId']=this[_0x6962('0xa')]['id'];}else{_0x38b226[_[_0x6962('0xb')](this[_0x6962('0xc')])+_0x6962('0xd')]=this[_0x6962('0xa')]['id'];}_0x38b226[_[_0x6962('0xb')](this[_0x6962('0xc')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x6962('0xc')]+_0x6962('0xe')]){return rpc[this[_0x6962('0xc')]+_0x6962('0xe')]['create'](_0x38b226)[_0x6962('0xf')](function(_0x32756d){logger[_0x6962('0x10')](_0x6962('0x11'),_0x457938,_0x38b226[_0x6962('0x12')]);_0x188f79[_0x6962('0x13')]();})['catch'](function(_0x28fe09){logger[_0x6962('0x14')](_0x6962('0x11'),_0x457938,JSON[_0x6962('0x15')](_0x28fe09));_0x188f79[_0x6962('0x16')]();});}}catch(_0x4df3be){logger[_0x6962('0x14')](_0x6962('0x11'),_0x457938,JSON[_0x6962('0x15')](_0x4df3be));_0x188f79[_0x6962('0x16')]();}};}; \ 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 986a888..88dc972 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 _0xe9e7=['stringify','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x871c66,_0x5478a3){_0x871c66=_0x871c66-0x0;var _0x2985c5=_0xe9e7[_0x871c66];return _0x2985c5;};'use strict';var utils=require(_0x7e9e('0x0'));var logger=require(_0x7e9e('0x1'))(_0x7e9e('0x2'));exports['consequence']=function(_0x1fd5fc,_0x99030){return function(_0x108c11){try{logger[_0x7e9e('0x3')](_0x7e9e('0x4'),_0x1fd5fc,utils[_0x7e9e('0x5')](_0x99030[0x0],this));_0x108c11[_0x7e9e('0x6')]();}catch(_0x5f29ff){logger[_0x7e9e('0x7')](_0x7e9e('0x4'),_0x1fd5fc,JSON[_0x7e9e('0x8')](_0x5f29ff));_0x108c11['stop']();}};}; \ No newline at end of file +var _0x28ff=['getMustacheRender','next','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger','routing','consequence','info'];(function(_0xd24921,_0x241e05){var _0x187ac4=function(_0x4aea3b){while(--_0x4aea3b){_0xd24921['push'](_0xd24921['shift']());}};_0x187ac4(++_0x241e05);}(_0x28ff,0x7a));var _0xf28f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x28ff[_0x618414];return _0x21c19a;};'use strict';var utils=require('./utils');var logger=require(_0xf28f('0x0'))(_0xf28f('0x1'));exports[_0xf28f('0x2')]=function(_0x5edd2b,_0x1a23d7){return function(_0x2a92dc){try{logger[_0xf28f('0x3')]('[%s][NOOP]\x20%s',_0x5edd2b,utils[_0xf28f('0x4')](_0x1a23d7[0x0],this));_0x2a92dc[_0xf28f('0x5')]();}catch(_0x5b913c){logger['error'](_0xf28f('0x6'),_0x5edd2b,JSON[_0xf28f('0x7')](_0x5b913c));_0x2a92dc[_0xf28f('0x8')]();}};}; \ 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 7ebbc12..487bc20 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 _0x459c=['localhost','queue_id','account','queue','from','joinAt','emit','clone','format','pick','%sQueuesWaitingInteractions','save','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','stop','Queues','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis'];(function(_0x4b9118,_0x1ecf2f){var _0x516c27=function(_0x289d62){while(--_0x289d62){_0x4b9118['push'](_0x4b9118['shift']());}};_0x516c27(++_0x1ecf2f);}(_0x459c,0x12b));var _0xc459=function(_0x3b85db,_0x37836e){_0x3b85db=_0x3b85db-0x0;var _0x19610c=_0x459c[_0x3b85db];return _0x19610c;};'use strict';var schema=require('validate');var _=require(_0xc459('0x0'));var util=require('util');var seqqueue=require(_0xc459('0x1'));var moment=require(_0xc459('0x2'));var Redis=require(_0xc459('0x3'));var config=require(_0xc459('0x4'));var logger=require(_0xc459('0x5'))(_0xc459('0x6'));var strategy=require(_0xc459('0x7'));config[_0xc459('0x8')]=_['defaults'](config[_0xc459('0x8')],{'host':_0xc459('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0xc459('0xa'),_0xc459('0xb'),_0xc459('0xc'),_0xc459('0xd'),_0xc459('0xe')];function emit(_0x40857f,_0x3b54e7,_0x4883a3){io['to'](_0x40857f)[_0xc459('0xf')](_0x3b54e7,_0x4883a3);}function emitChannelQueueInteraction(_0x4312b5,_0x1e7a29,_0x58d53a,_0x46ee95,_0x5e765f,_0x21868d,_0x5c6966,_0xc4cd91){var _0x3cc33b=_[_0xc459('0x10')](_0x58d53a);_0x3cc33b['queue_id']=_0xc4cd91;_0x3cc33b[_0xc459('0xc')]=_0x1e7a29;_0x3cc33b['account']=_0x46ee95;_0x3cc33b['id']=_0x5e765f;if(_0x21868d){_0x5c6966[util[_0xc459('0x11')]('%sQueuesWaitingInteractions',_0x4312b5)][_0x5e765f]=_[_0xc459('0x12')](_0x3cc33b,attributes);}else{delete _0x5c6966[util[_0xc459('0x11')](_0xc459('0x13'),_0x4312b5)][_0x5e765f];}emit(util[_0xc459('0x11')]('%s:queue:%s',_0x4312b5,_0x1e7a29),util[_0xc459('0x11')]('%s_queue_waiting_interaction:%s',_0x4312b5,_0x21868d?_0xc459('0x14'):'remove'),_[_0xc459('0x12')](_0x3cc33b,attributes));}var rpc={'openchannelQueueReport':require(_0xc459('0x15')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xc459('0x16')),'smsQueueReport':require(_0xc459('0x17')),'faxQueueReport':require(_0xc459('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0xc459('0x19')},'timeout':{'type':'number','message':_0xc459('0x1a')}});function startRouting(_0x6bb6f3,_0x47af3f,_0x55e2f0,_0x63848b){if(_0x6bb6f3&&_0x47af3f&&_0x55e2f0){_0x47af3f[_0xc459('0x1b')]+=0x1;var _0xa7752e={'uniqueid':_0x6bb6f3,'from':_0x55e2f0['body']?_0x55e2f0[_0xc459('0x1c')][_0xc459('0xd')]:'','joinAt':moment()[_0xc459('0x11')](_0xc459('0x1d')),'ContactId':_0x55e2f0['contact']?_0x55e2f0[_0xc459('0x1e')]['id']:null,'ListId':_0x55e2f0[_0xc459('0x1f')]?_0x55e2f0[_0xc459('0x1f')]['id']:null};_0xa7752e[_['upperFirst'](_0x55e2f0[_0xc459('0x20')])+_0xc459('0x21')]=_0x47af3f['id']||null;_0xa7752e[_[_0xc459('0x22')](_0x55e2f0[_0xc459('0x20')])+_0xc459('0x23')]=_0x55e2f0['interaction']?_0x55e2f0[_0xc459('0x24')]['id']:null;_0xa7752e[_['upperFirst'](_0x55e2f0['channel'])+_0xc459('0x25')]=_0x55e2f0[_0xc459('0x26')]?_0x55e2f0[_0xc459('0x26')]['id']:null;_0xa7752e[_['upperFirst'](_0x55e2f0['channel'])+(_0x55e2f0[_0xc459('0x20')]!==_0xc459('0x27')?_0xc459('0x28'):_0xc459('0x29'))]=_0x55e2f0['account']?_0x55e2f0[_0xc459('0xb')]['id']:null;logger[_0xc459('0x2a')](util[_0xc459('0x11')](_0xc459('0x2b'),_0x6bb6f3,_0x47af3f[_0xc459('0x2c')]));emitChannelQueueInteraction(_0x55e2f0[_0xc459('0x20')],_0x47af3f['name'],_0xa7752e,_0x55e2f0['account'][_0xc459('0x2c')],_0x55e2f0['message']['id'],!![],_0x63848b,_0x47af3f['id']);if(rpc[_0x55e2f0[_0xc459('0x20')]+'QueueReport']){return rpc[_0x55e2f0[_0xc459('0x20')]+_0xc459('0x2d')][_0xc459('0x2e')](_0xa7752e)[_0xc459('0x2f')](function(_0x273a67){logger[_0xc459('0x30')](_0xc459('0x31'));});}}}function stopRouting(_0x1d4028,_0x307cb8,_0x43e88a,_0x15e127){if(_0x1d4028&&_0x307cb8){_0x307cb8[_0xc459('0x1b')]-=0x1;var _0x573eda={'leaveAt':moment()[_0xc459('0x11')](_0xc459('0x1d')),'acceptAt':moment()[_0xc459('0x11')](_0xc459('0x1d')),'reason':_0xc459('0x32')};logger['info'](util[_0xc459('0x11')](_0xc459('0x33'),_0x1d4028,_0x307cb8['name']));emitChannelQueueInteraction(_0x43e88a[_0xc459('0x20')],_0x307cb8[_0xc459('0x2c')],_0x43e88a[_0xc459('0x1c')],_0x43e88a[_0xc459('0xb')][_0xc459('0x2c')],_0x43e88a[_0xc459('0x26')]['id'],![],_0x15e127,_0x307cb8['id']);if(rpc[_0x43e88a[_0xc459('0x20')]+'QueueReport']){return rpc[_0x43e88a['channel']+_0xc459('0x2d')]['update'](_0x1d4028,_0x573eda)[_0xc459('0x2f')](function(_0x14181b){logger['error'](_0xc459('0x34'));});}}}function endRouting(_0x3083cc,_0x4fd9c1,_0x3dd8ee,_0x48c7da){if(_0x3083cc&&_0x4fd9c1){_0x4fd9c1['waiting']-=0x1;var _0x4a4213={'leaveAt':moment()['format'](_0xc459('0x1d')),'exitAt':moment()[_0xc459('0x11')](_0xc459('0x1d')),'reason':_0xc459('0x35')};logger[_0xc459('0x2a')](util['format'](_0xc459('0x36'),_0x3083cc,_0x4fd9c1['name']));emitChannelQueueInteraction(_0x3dd8ee[_0xc459('0x20')],_0x4fd9c1[_0xc459('0x2c')],_0x3dd8ee[_0xc459('0x1c')],_0x3dd8ee[_0xc459('0xb')][_0xc459('0x2c')],_0x3dd8ee['message']['id'],![],_0x48c7da);if(rpc[_0x3dd8ee[_0xc459('0x20')]+_0xc459('0x2d')]){return rpc[_0x3dd8ee[_0xc459('0x20')]+_0xc459('0x2d')][_0xc459('0x37')](_0x3083cc,_0x4a4213)[_0xc459('0x2f')](function(_0x47f567){logger['error'](_0xc459('0x34'));});}}}function handleFindQueue(_0x3d716d){return function(_0x5ebe6c){return _0x5ebe6c[_0xc459('0x2c')][_0xc459('0x38')]()===_0x3d716d[_0xc459('0x38')]();};}exports[_0xc459('0x39')]=function(_0x470a53,_0x144b8a,_0x289997,_0x15fc68){return function(_0x325b0b){try{var _0x1505b6={'name':_0x144b8a[0x0],'timeout':_0x144b8a[0x1]};var _0x2ff66f=queue[_0xc459('0x3a')](_0x1505b6,{'typecast':!![]});if(_0x2ff66f['length']){logger[_0xc459('0x30')](_0xc459('0x3b'),_0x470a53,_['map'](_0x2ff66f,_0xc459('0x26'))['join'](',\x20'));_0x325b0b[_0xc459('0x3c')]();}else{var _0x2a1dfe=_['find'](_0x289997[_0x15fc68[_0xc459('0x20')]+_0xc459('0x3d')],handleFindQueue(_0x1505b6['name']));if(_0x2a1dfe){startRouting(_0x470a53,_0x2a1dfe,_0x15fc68,_0x289997);var _0x5f37b4=(_0x2a1dfe[_0xc459('0x35')]||0xa)*0x3e8;var _0x3a9d32=(_0x1505b6[_0xc459('0x35')]||0x14)*0x3e8;var _0x43a550,_0x2adf90;if(_0x5f37b4>_0x3a9d32){_0x3a9d32=_0x5f37b4;}var _0x128cf5=seqqueue[_0xc459('0x3e')](_0x5f37b4);_0x128cf5['id']=_0x470a53;_0x128cf5[_0xc459('0x3f')]=_0x5f37b4;_0x128cf5['qtimeout']=_0x3a9d32;_0x128cf5['channel']=_0x15fc68[_0xc459('0x20')];_0x289997[_0xc459('0x40')][_0x470a53]['on'](_0xc459('0x41'),function(){logger['info'](_0xc459('0x42'),_0x470a53);stopRouting(_0x470a53,_0x2a1dfe,_0x15fc68,_0x289997);clearTimeout(_0x43a550);_0x43a550=undefined;_0x128cf5['close'](!![]);if(_0x289997['rules'][_0x470a53]){delete _0x289997[_0xc459('0x40')][_0x470a53];}_0x325b0b[_0xc459('0x3c')]();});_0x289997['rules'][_0x470a53]['on'](_0xc459('0x43'),function(){if(_0x289997[_0xc459('0x40')][_0x470a53]){delete _0x289997[_0xc459('0x40')][_0x470a53];}});_0x43a550=setTimeout(function(){logger['info'](_0xc459('0x44'),_0x470a53);endRouting(_0x470a53,_0x2a1dfe,_0x15fc68,_0x289997);clearTimeout(_0x43a550);_0x128cf5[_0xc459('0x45')](!![]);_0x325b0b[_0xc459('0x46')]();},_0x3a9d32);switch(_0x2a1dfe[_0xc459('0x47')]){case _0xc459('0x48'):strategy[_0xc459('0x48')](_0x128cf5,_0x2a1dfe,_0x289997,_0x15fc68);break;default:strategy[_0xc459('0x49')](_0x128cf5,_0x2a1dfe,_0x289997,_0x15fc68);}}else{logger['error'](_0xc459('0x4a'),_0x470a53,_0x1505b6[_0xc459('0x2c')]);_0x325b0b[_0xc459('0x3c')]();}}}catch(_0x966c6b){console[_0xc459('0x4b')](_0x966c6b);logger['error']('[%s][QUEUE]\x20%s',_0x470a53,_0x966c6b[_0xc459('0x4c')]);_0x325b0b[_0xc459('0x3c')]();}};}; \ No newline at end of file +var _0x61da=['upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','account','info','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','stop','find','Queues','createQueue','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','routing','./strategy','redis','localhost','socket.io-emitter','from','joinAt','clone','queue_id','queue','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list'];(function(_0x3fd1f9,_0x33b040){var _0x567d32=function(_0x573225){while(--_0x573225){_0x3fd1f9['push'](_0x3fd1f9['shift']());}};_0x567d32(++_0x33b040);}(_0x61da,0x10e));var _0xa61d=function(_0x451ce5,_0x4e0268){_0x451ce5=_0x451ce5-0x0;var _0x102a9a=_0x61da[_0x451ce5];return _0x102a9a;};'use strict';var schema=require(_0xa61d('0x0'));var _=require(_0xa61d('0x1'));var util=require(_0xa61d('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xa61d('0x3'));var Redis=require(_0xa61d('0x4'));var config=require(_0xa61d('0x5'));var logger=require('../../../../config/logger')(_0xa61d('0x6'));var strategy=require(_0xa61d('0x7'));config[_0xa61d('0x8')]=_['defaults'](config[_0xa61d('0x8')],{'host':_0xa61d('0x9'),'port':0x18eb});var io=require(_0xa61d('0xa'))(new Redis(config[_0xa61d('0x8')]));var attributes=['id','queue_id','account','queue',_0xa61d('0xb'),_0xa61d('0xc')];function emit(_0x2e8940,_0xe6d87b,_0x3f43dd){io['to'](_0x2e8940)['emit'](_0xe6d87b,_0x3f43dd);}function emitChannelQueueInteraction(_0x3f0c11,_0x118138,_0x48ba5d,_0x2b2cba,_0x35867a,_0x4e46d7,_0xc4a541,_0x4fbe9b){var _0x47ec93=_[_0xa61d('0xd')](_0x48ba5d);_0x47ec93[_0xa61d('0xe')]=_0x4fbe9b;_0x47ec93[_0xa61d('0xf')]=_0x118138;_0x47ec93['account']=_0x2b2cba;_0x47ec93['id']=_0x35867a;if(_0x4e46d7){_0xc4a541[util[_0xa61d('0x10')](_0xa61d('0x11'),_0x3f0c11)][_0x35867a]=_[_0xa61d('0x12')](_0x47ec93,attributes);}else{delete _0xc4a541[util['format'](_0xa61d('0x11'),_0x3f0c11)][_0x35867a];}emit(util['format'](_0xa61d('0x13'),_0x3f0c11,_0x118138),util['format'](_0xa61d('0x14'),_0x3f0c11,_0x4e46d7?_0xa61d('0x15'):_0xa61d('0x16')),_['pick'](_0x47ec93,attributes));}var rpc={'openchannelQueueReport':require(_0xa61d('0x17')),'mailQueueReport':require(_0xa61d('0x18')),'chatQueueReport':require(_0xa61d('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xa61d('0x1a')),'whatsappQueueReport':require(_0xa61d('0x1b'))};var queue=schema({'name':{'type':_0xa61d('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xa61d('0x1d'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x465af4,_0xb8f235,_0xe25818,_0x1be5f8){if(_0x465af4&&_0xb8f235&&_0xe25818){_0xb8f235['waiting']+=0x1;var _0x4c0da0={'uniqueid':_0x465af4,'from':_0xe25818[_0xa61d('0x1e')]?_0xe25818[_0xa61d('0x1e')]['from']:'','joinAt':moment()[_0xa61d('0x10')](_0xa61d('0x1f')),'ContactId':_0xe25818[_0xa61d('0x20')]?_0xe25818['contact']['id']:null,'ListId':_0xe25818[_0xa61d('0x21')]?_0xe25818[_0xa61d('0x21')]['id']:null};_0x4c0da0[_[_0xa61d('0x22')](_0xe25818[_0xa61d('0x23')])+'QueueId']=_0xb8f235['id']||null;_0x4c0da0[_[_0xa61d('0x22')](_0xe25818[_0xa61d('0x23')])+_0xa61d('0x24')]=_0xe25818[_0xa61d('0x25')]?_0xe25818[_0xa61d('0x25')]['id']:null;_0x4c0da0[_[_0xa61d('0x22')](_0xe25818[_0xa61d('0x23')])+_0xa61d('0x26')]=_0xe25818[_0xa61d('0x27')]?_0xe25818[_0xa61d('0x27')]['id']:null;_0x4c0da0[_[_0xa61d('0x22')](_0xe25818[_0xa61d('0x23')])+(_0xe25818[_0xa61d('0x23')]!==_0xa61d('0x28')?_0xa61d('0x29'):'WebsiteId')]=_0xe25818['account']?_0xe25818[_0xa61d('0x2a')]['id']:null;logger[_0xa61d('0x2b')](util[_0xa61d('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x465af4,_0xb8f235[_0xa61d('0x2c')]));emitChannelQueueInteraction(_0xe25818[_0xa61d('0x23')],_0xb8f235[_0xa61d('0x2c')],_0x4c0da0,_0xe25818[_0xa61d('0x2a')][_0xa61d('0x2c')],_0xe25818[_0xa61d('0x27')]['id'],!![],_0x1be5f8,_0xb8f235['id']);if(rpc[_0xe25818[_0xa61d('0x23')]+_0xa61d('0x2d')]){return rpc[_0xe25818[_0xa61d('0x23')]+_0xa61d('0x2d')][_0xa61d('0x2e')](_0x4c0da0)[_0xa61d('0x2f')](function(_0x1da704){logger[_0xa61d('0x30')](_0xa61d('0x31'));});}}}function stopRouting(_0xfa2da1,_0x4f764d,_0x366ae8,_0x2c3cfa){if(_0xfa2da1&&_0x4f764d){_0x4f764d['waiting']-=0x1;var _0x57a125={'leaveAt':moment()['format'](_0xa61d('0x1f')),'acceptAt':moment()[_0xa61d('0x10')](_0xa61d('0x1f')),'reason':_0xa61d('0x32')};logger['info'](util['format'](_0xa61d('0x33'),_0xfa2da1,_0x4f764d['name']));emitChannelQueueInteraction(_0x366ae8[_0xa61d('0x23')],_0x4f764d['name'],_0x366ae8[_0xa61d('0x1e')],_0x366ae8['account'][_0xa61d('0x2c')],_0x366ae8[_0xa61d('0x27')]['id'],![],_0x2c3cfa,_0x4f764d['id']);if(rpc[_0x366ae8[_0xa61d('0x23')]+_0xa61d('0x2d')]){return rpc[_0x366ae8[_0xa61d('0x23')]+_0xa61d('0x2d')][_0xa61d('0x34')](_0xfa2da1,_0x57a125)['catch'](function(_0x35b66f){logger[_0xa61d('0x30')]('update\x20queue\x20report');});}}}function endRouting(_0x4e7d2a,_0x18d95a,_0x3c8de4,_0x1bc4a5){if(_0x4e7d2a&&_0x18d95a){_0x18d95a[_0xa61d('0x35')]-=0x1;var _0x35a215={'leaveAt':moment()[_0xa61d('0x10')](_0xa61d('0x1f')),'exitAt':moment()[_0xa61d('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa61d('0x36')};logger[_0xa61d('0x2b')](util[_0xa61d('0x10')](_0xa61d('0x37'),_0x4e7d2a,_0x18d95a[_0xa61d('0x2c')]));emitChannelQueueInteraction(_0x3c8de4[_0xa61d('0x23')],_0x18d95a['name'],_0x3c8de4[_0xa61d('0x1e')],_0x3c8de4[_0xa61d('0x2a')]['name'],_0x3c8de4[_0xa61d('0x27')]['id'],![],_0x1bc4a5);if(rpc[_0x3c8de4[_0xa61d('0x23')]+'QueueReport']){return rpc[_0x3c8de4[_0xa61d('0x23')]+_0xa61d('0x2d')]['update'](_0x4e7d2a,_0x35a215)['catch'](function(_0x6d6150){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x486ad0){return function(_0xff7fd4){return _0xff7fd4[_0xa61d('0x2c')]['toLowerCase']()===_0x486ad0[_0xa61d('0x38')]();};}exports[_0xa61d('0x39')]=function(_0x150708,_0xb27982,_0x4dda8b,_0x183fec){return function(_0x4ff99e){try{var _0x337acc={'name':_0xb27982[0x0],'timeout':_0xb27982[0x1]};var _0x6790ed=queue[_0xa61d('0x0')](_0x337acc,{'typecast':!![]});if(_0x6790ed['length']){logger[_0xa61d('0x30')]('[%s][QUEUE]\x20%s',_0x150708,_['map'](_0x6790ed,_0xa61d('0x27'))['join'](',\x20'));_0x4ff99e[_0xa61d('0x3a')]();}else{var _0x35086b=_[_0xa61d('0x3b')](_0x4dda8b[_0x183fec[_0xa61d('0x23')]+_0xa61d('0x3c')],handleFindQueue(_0x337acc[_0xa61d('0x2c')]));if(_0x35086b){startRouting(_0x150708,_0x35086b,_0x183fec,_0x4dda8b);var _0x5295dd=(_0x35086b['timeout']||0xa)*0x3e8;var _0x1b7dd8=(_0x337acc[_0xa61d('0x36')]||0x14)*0x3e8;var _0x30c087,_0x760044;if(_0x5295dd>_0x1b7dd8){_0x1b7dd8=_0x5295dd;}var _0x19a589=seqqueue[_0xa61d('0x3d')](_0x5295dd);_0x19a589['id']=_0x150708;_0x19a589[_0xa61d('0x3e')]=_0x5295dd;_0x19a589[_0xa61d('0x3f')]=_0x1b7dd8;_0x19a589[_0xa61d('0x23')]=_0x183fec[_0xa61d('0x23')];_0x4dda8b['rules'][_0x150708]['on']('end',function(){logger[_0xa61d('0x2b')](_0xa61d('0x40'),_0x150708);stopRouting(_0x150708,_0x35086b,_0x183fec,_0x4dda8b);clearTimeout(_0x30c087);_0x30c087=undefined;_0x19a589['close'](!![]);if(_0x4dda8b[_0xa61d('0x41')][_0x150708]){delete _0x4dda8b[_0xa61d('0x41')][_0x150708];}_0x4ff99e[_0xa61d('0x3a')]();});_0x4dda8b[_0xa61d('0x41')][_0x150708]['on'](_0xa61d('0x42'),function(){if(_0x4dda8b['rules'][_0x150708]){delete _0x4dda8b[_0xa61d('0x41')][_0x150708];}});_0x30c087=setTimeout(function(){logger[_0xa61d('0x2b')](_0xa61d('0x43'),_0x150708);endRouting(_0x150708,_0x35086b,_0x183fec,_0x4dda8b);clearTimeout(_0x30c087);_0x19a589['close'](!![]);_0x4ff99e[_0xa61d('0x44')]();},_0x1b7dd8);switch(_0x35086b[_0xa61d('0x45')]){case _0xa61d('0x46'):strategy[_0xa61d('0x46')](_0x19a589,_0x35086b,_0x4dda8b,_0x183fec);break;default:strategy[_0xa61d('0x47')](_0x19a589,_0x35086b,_0x4dda8b,_0x183fec);}}else{logger[_0xa61d('0x30')](_0xa61d('0x48'),_0x150708,_0x337acc[_0xa61d('0x2c')]);_0x4ff99e[_0xa61d('0x3a')]();}}}catch(_0x410042){console[_0xa61d('0x49')](_0x410042);logger['error'](_0xa61d('0x4a'),_0x150708,_0x410042[_0xa61d('0x4b')]);_0x4ff99e[_0xa61d('0x3a')]();}};}; \ 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 dc40530..5eb0ba3 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 _0x94b7=['RINGING','info','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog'];(function(_0xbec948,_0x3ba630){var _0x182646=function(_0x29957a){while(--_0x29957a){_0xbec948['push'](_0xbec948['shift']());}};_0x182646(++_0x3ba630);}(_0x94b7,0x126));var _0x794b=function(_0x180bc0,_0x1cd2e1){_0x180bc0=_0x180bc0-0x0;var _0x2ec58e=_0x94b7[_0x180bc0];return _0x2ec58e;};'use strict';var _=require('lodash');var uuid=require(_0x794b('0x0'));var util=require('./util');var logger=require(_0x794b('0x1'))(_0x794b('0x2'));var Agent=function(_0x4da2ef,_0x274056,_0x34eff5,_0x18449f){this[_0x794b('0x3')]=uuid['v4']();this[_0x794b('0x4')]=_0x4da2ef;this[_0x794b('0x5')]=_0x274056;this[_0x794b('0x6')]=_0x34eff5;this[_0x794b('0x2')]=_0x18449f;this[_0x794b('0x4')][_0x794b('0x7')](this[_0x794b('0x8')][_0x794b('0x9')](this),this['handleTimeout']['bind'](this));this[_0x794b('0x4')]['on'](_0x794b('0xa'),this[_0x794b('0xb')][_0x794b('0x9')](this));this[_0x794b('0x4')]['on'](_0x794b('0xc'),this[_0x794b('0xd')][_0x794b('0x9')](this));};Agent['prototype'][_0x794b('0x7')]=function(){this[_0x794b('0x4')][_0x794b('0x7')](this['handleRun'][_0x794b('0x9')](this),this[_0x794b('0xb')][_0x794b('0x9')](this));};Agent[_0x794b('0xe')][_0x794b('0xd')]=function(){this[_0x794b('0xb')](!![]);};Agent['prototype'][_0x794b('0x8')]=function(_0x3b28d1){logger['info'](_0x794b('0xf'),this[_0x794b('0x4')]['id'],this[_0x794b('0x5')]['id']);if(_[_0x794b('0x10')](this['realtime'][_0x794b('0x11')][this['agent']['id']])){logger['info'](_0x794b('0x12'),this[_0x794b('0x4')]['id'],this[_0x794b('0x5')]['id']);setTimeout(this[_0x794b('0x7')][_0x794b('0x9')](this),0x3e8);}else{if(this[_0x794b('0x2')][_0x794b('0x13')]||util[_0x794b('0x14')](this[_0x794b('0x4')]['id'],this[_0x794b('0x6')][_0x794b('0x11')][this['agent']['id']],this[_0x794b('0x4')][_0x794b('0x15')],![])){this['realtime']['agents'][this['agent']['id']][_0x794b('0x16')]=!![];this['realtime']['agents'][this[_0x794b('0x5')]['id']][_0x794b('0x17')]=undefined;util[_0x794b('0x18')](this[_0x794b('0x3')],this[_0x794b('0x4')]['id'],this[_0x794b('0x6')][_0x794b('0x11')][this['agent']['id']],null,this[_0x794b('0x2')]);util[_0x794b('0x19')](this[_0x794b('0x4')]['id'],this[_0x794b('0x6')]['agents'][this['agent']['id']],_0x794b('0x1a')+(this[_0x794b('0x2')][_0x794b('0x13')]?':FORCED':''));}else{logger[_0x794b('0x1b')](_0x794b('0x1c'),this[_0x794b('0x4')]['id'],this[_0x794b('0x5')]['id']);setTimeout(this[_0x794b('0x7')]['bind'](this),0x3e8);}}};Agent[_0x794b('0xe')][_0x794b('0xb')]=function(_0x47154d){if(_['isNil'](this[_0x794b('0x6')][_0x794b('0x11')][this[_0x794b('0x5')]['id']])){return logger[_0x794b('0x1b')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x794b('0x5')]['id']);}else{logger[_0x794b('0x1b')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x794b('0x4')]['id'],this[_0x794b('0x5')]['id']);util[_0x794b('0x1d')](this['notificationId'],this['squeue']['id'],this['realtime'][_0x794b('0x11')][this[_0x794b('0x5')]['id']],null,this[_0x794b('0x2')]);this[_0x794b('0x6')][_0x794b('0x11')][this[_0x794b('0x5')]['id']][_0x794b('0x16')]=![];this[_0x794b('0x6')][_0x794b('0x11')][this[_0x794b('0x5')]['id']][_0x794b('0x17')]=undefined;util[_0x794b('0x19')](this['squeue']['id'],this[_0x794b('0x6')]['agents'][this['agent']['id']],_0x47154d?_0x794b('0x1e'):'TIMEOUT');}if(!_0x47154d){setTimeout(this['push'][_0x794b('0x9')](this),0x3e8);}};function agent(_0x304b1a,_0x2ee28a,_0x2b54d8,_0x2b957a){return new Agent(_0x304b1a,_0x2ee28a,_0x2b54d8,_0x2b957a);}module[_0x794b('0x1f')]=agent; \ No newline at end of file +var _0xc59c=[':FORCED','info','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','showNotification','writeLog','RINGING'];(function(_0x4a765a,_0x1b42b7){var _0x5b748f=function(_0x4c9479){while(--_0x4c9479){_0x4a765a['push'](_0x4a765a['shift']());}};_0x5b748f(++_0x1b42b7);}(_0xc59c,0x1b4));var _0xcc59=function(_0x594163,_0xf3583c){_0x594163=_0x594163-0x0;var _0x18c749=_0xc59c[_0x594163];return _0x18c749;};'use strict';var _=require(_0xcc59('0x0'));var uuid=require(_0xcc59('0x1'));var util=require(_0xcc59('0x2'));var logger=require(_0xcc59('0x3'))(_0xcc59('0x4'));var Agent=function(_0x56d107,_0x445b15,_0xfcc75d,_0x142b2a){this[_0xcc59('0x5')]=uuid['v4']();this[_0xcc59('0x6')]=_0x56d107;this[_0xcc59('0x7')]=_0x445b15;this[_0xcc59('0x8')]=_0xfcc75d;this[_0xcc59('0x4')]=_0x142b2a;this['squeue'][_0xcc59('0x9')](this[_0xcc59('0xa')][_0xcc59('0xb')](this),this[_0xcc59('0xc')]['bind'](this));this[_0xcc59('0x6')]['on']('timeout',this['handleTimeout'][_0xcc59('0xb')](this));this['squeue']['on'](_0xcc59('0xd'),this[_0xcc59('0xe')][_0xcc59('0xb')](this));};Agent[_0xcc59('0xf')][_0xcc59('0x9')]=function(){this[_0xcc59('0x6')][_0xcc59('0x9')](this[_0xcc59('0xa')][_0xcc59('0xb')](this),this[_0xcc59('0xc')][_0xcc59('0xb')](this));};Agent[_0xcc59('0xf')]['handleDrained']=function(){this[_0xcc59('0xc')](!![]);};Agent[_0xcc59('0xf')][_0xcc59('0xa')]=function(_0x2ff43c){logger['info'](_0xcc59('0x10'),this[_0xcc59('0x6')]['id'],this[_0xcc59('0x7')]['id']);if(_[_0xcc59('0x11')](this['realtime'][_0xcc59('0x12')][this[_0xcc59('0x7')]['id']])){logger['info'](_0xcc59('0x13'),this[_0xcc59('0x6')]['id'],this[_0xcc59('0x7')]['id']);setTimeout(this['push'][_0xcc59('0xb')](this),0x3e8);}else{if(this[_0xcc59('0x4')][_0xcc59('0x14')]||util['isAgentAvailable'](this[_0xcc59('0x6')]['id'],this[_0xcc59('0x8')][_0xcc59('0x12')][this[_0xcc59('0x7')]['id']],this[_0xcc59('0x6')][_0xcc59('0x15')],![])){this[_0xcc59('0x8')]['agents'][this[_0xcc59('0x7')]['id']][_0xcc59('0x16')]=!![];this['realtime'][_0xcc59('0x12')][this[_0xcc59('0x7')]['id']]['busyQueue']=undefined;util[_0xcc59('0x17')](this['notificationId'],this[_0xcc59('0x6')]['id'],this[_0xcc59('0x8')][_0xcc59('0x12')][this['agent']['id']],null,this[_0xcc59('0x4')]);util[_0xcc59('0x18')](this[_0xcc59('0x6')]['id'],this[_0xcc59('0x8')]['agents'][this[_0xcc59('0x7')]['id']],_0xcc59('0x19')+(this['routing']['forcedOwnership']?_0xcc59('0x1a'):''));}else{logger[_0xcc59('0x1b')](_0xcc59('0x1c'),this[_0xcc59('0x6')]['id'],this[_0xcc59('0x7')]['id']);setTimeout(this[_0xcc59('0x9')][_0xcc59('0xb')](this),0x3e8);}}};Agent[_0xcc59('0xf')][_0xcc59('0xc')]=function(_0x363c17){if(_[_0xcc59('0x11')](this['realtime'][_0xcc59('0x12')][this['agent']['id']])){return logger[_0xcc59('0x1b')](_0xcc59('0x13'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xcc59('0x1b')](_0xcc59('0x1d'),this[_0xcc59('0x6')]['id'],this[_0xcc59('0x7')]['id']);util[_0xcc59('0x1e')](this[_0xcc59('0x5')],this[_0xcc59('0x6')]['id'],this[_0xcc59('0x8')]['agents'][this[_0xcc59('0x7')]['id']],null,this[_0xcc59('0x4')]);this[_0xcc59('0x8')][_0xcc59('0x12')][this['agent']['id']]['busy']=![];this[_0xcc59('0x8')][_0xcc59('0x12')][this[_0xcc59('0x7')]['id']][_0xcc59('0x1f')]=undefined;util[_0xcc59('0x18')](this['squeue']['id'],this[_0xcc59('0x8')][_0xcc59('0x12')][this[_0xcc59('0x7')]['id']],_0x363c17?'STOP':'TIMEOUT');}if(!_0x363c17){setTimeout(this[_0xcc59('0x9')][_0xcc59('0xb')](this),0x3e8);}};function agent(_0x2de349,_0x22159f,_0x354ed9,_0x273cc9){return new Agent(_0x2de349,_0x22159f,_0x354ed9,_0x273cc9);}module[_0xcc59('0x20')]=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 c5844bf..667b279 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 _0x8958=['bind','timeout','drained','handleDrained','prototype','isNil','queue','Agents','length','agents','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','info','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','uuid','notificationId','squeue','realtime','routing','push','handleRun','handleTimeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8958,0x93));var _0x8895=function(_0x8031f3,_0x356086){_0x8031f3=_0x8031f3-0x0;var _0x39a15a=_0x8958[_0x8031f3];return _0x39a15a;};'use strict';var _=require('lodash');var uuid=require(_0x8895('0x0'));var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x4cea64,_0x418b66,_0x56e738,_0x38d5d7){this[_0x8895('0x1')]=uuid['v4']();this[_0x8895('0x2')]=_0x4cea64;this['queue']=_0x418b66;this[_0x8895('0x3')]=_0x56e738;this[_0x8895('0x4')]=_0x38d5d7;this[_0x8895('0x2')][_0x8895('0x5')](this[_0x8895('0x6')]['bind'](this),this[_0x8895('0x7')][_0x8895('0x8')](this));this[_0x8895('0x2')]['on'](_0x8895('0x9'),this[_0x8895('0x7')][_0x8895('0x8')](this));this[_0x8895('0x2')]['on'](_0x8895('0xa'),this[_0x8895('0xb')][_0x8895('0x8')](this));};Beepall['prototype'][_0x8895('0x5')]=function(){this[_0x8895('0x2')][_0x8895('0x5')](this[_0x8895('0x6')][_0x8895('0x8')](this),this[_0x8895('0x7')]['bind'](this));};Beepall[_0x8895('0xc')][_0x8895('0xb')]=function(_0x56c18e){this['handleTimeout'](!![]);};Beepall['prototype'][_0x8895('0x6')]=function(_0x4e8f53){var _0x4156f5=!![];if(!_[_0x8895('0xd')](this[_0x8895('0xe')])&&!_[_0x8895('0xd')](this[_0x8895('0xe')]['Agents'])&&this[_0x8895('0xe')][_0x8895('0xf')][_0x8895('0x10')]>0x0){for(var _0xcdd661=0x0,_0x2848b7;_0xcdd6610x0){for(var _0x20a206=0x0,_0x543e7a;_0x20a2060x0&&_0x18807b[_0x886b6+_0x511e('0x20')]>=_0x18807b[_0x886b6+_0x511e('0x21')]){writeLog(_0xaea29d,_0x18807b,_0x886b6[_0x511e('0x22')]()+_0x511e('0x23'));return![];}}return!![];};exports[_0x511e('0x24')]=function(_0x309695,_0x2451c2,_0x5b72fe,_0x2930b2,_0x1d754d){return sendNotification(!![],_0x309695,_0x2451c2,_0x5b72fe,_0x2930b2,_0x1d754d);};exports[_0x511e('0x25')]=function(_0x1aaac1,_0x369be6,_0x50305a,_0x431b75,_0x4e157f){return sendNotification(![],_0x1aaac1,_0x369be6,_0x50305a,_0x431b75,_0x4e157f);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x326f=['CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','lodash','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','split','\x20interaction','name','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','info','isAgentAvailable','busy','BUSY','online','OFFLINE','Capacity','hasOwnProperty'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0x326f,0xd1));var _0xf326=function(_0x5b655f,_0x3f483d){_0x5b655f=_0x5b655f-0x0;var _0x4a96c3=_0x326f[_0x5b655f];return _0x4a96c3;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var utils=require('../utils');var Mustache=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var config=require(_0xf326('0x3'));var logger=require(_0xf326('0x4'))(_0xf326('0x5'));config[_0xf326('0x6')]=_[_0xf326('0x7')](config[_0xf326('0x6')],{'host':_0xf326('0x8'),'port':0x18eb});var io=require(_0xf326('0x9'))(new Redis(config['redis']));function emit(_0x3c254d,_0x3851eb,_0x165f95){io['to'](_0x3c254d)[_0xf326('0xa')](_0x3851eb,_0x165f95);}function sendNotification(_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2,_0x1fc80e,_0x163416){io['to'](util[_0xf326('0xb')](_0xf326('0xc'),_0x3bacf2['name']))[_0xf326('0xa')]('user:save',_0x3bacf2);var _0x1cf441=_0x163416||{};var _0x4aaf3a=_0x592975[_0xf326('0xd')]('.');var _0x518ab5={'uniqueid':_0x4c206c,'channel':_0x4aaf3a[0x0],'id':_0x4aaf3a[0x1],'title':_0x4aaf3a[0x0]+_0xf326('0xe'),'interactionId':_0x4aaf3a[0x2],'queue':_0x1fc80e?_0x1fc80e[_0xf326('0xf')]:null,'sound':_0x1cf441['account'][_0xf326('0x10')],'shake':_0x1cf441[_0xf326('0x11')][_0xf326('0x12')]};try{if(!_0x1cf441[_0xf326('0x13')]){_0x1cf441['body']={};}if(_0x1fc80e){_0x1cf441[_0xf326('0x13')]['queue']=_0x1fc80e;}else if(_0x1cf441['body'][_0xf326('0x14')]){delete _0x1cf441[_0xf326('0x13')][_0xf326('0x14')];}_0x518ab5[_0xf326('0x15')]=utils[_0xf326('0x16')](_0x1cf441[_0xf326('0x11')][_0xf326('0x17')],_0x1cf441);}catch(_0x2cf2ca){_0x518ab5['msg']=_0xf326('0x18');logger[_0xf326('0x19')](util[_0xf326('0xb')](_0xf326('0x1a'),_0x4c206c,_0x2cf2ca[_0xf326('0x1b')]));}io['to'](util[_0xf326('0xb')]('user:%s',_0x3bacf2['name']))['emit'](util[_0xf326('0xb')](_0xf326('0x1c'),_0x515bfa?'save':'remove'),_0x518ab5);}function writeLog(_0x128c68,_0x4dfa76,_0x5b6d3c){return logger[_0xf326('0x1d')](util[_0xf326('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x128c68,_0x4dfa76['name'],_0x5b6d3c));}exports[_0xf326('0x1e')]=function(_0xb1efcf,_0x5f21a2,_0x337ed5,_0x1b9039){if(_0x5f21a2[_0xf326('0x1f')]){writeLog(_0xb1efcf,_0x5f21a2,_0xf326('0x20'));return![];}if(!_0x5f21a2[_0xf326('0x21')]){writeLog(_0xb1efcf,_0x5f21a2,_0xf326('0x22'));return![];}if(_0x5f21a2[_0x337ed5+'Pause']){writeLog(_0xb1efcf,_0x5f21a2,'PAUSE');return![];}if(_0x1b9039&&_0x5f21a2['hasOwnProperty'](_0x337ed5+_0xf326('0x23'))&&_0x5f21a2[_0xf326('0x24')](_0x337ed5+_0xf326('0x25'))){if(_0x5f21a2[_0x337ed5+_0xf326('0x23')]>0x0&&_0x5f21a2[_0x337ed5+_0xf326('0x25')]>=_0x5f21a2[_0x337ed5+_0xf326('0x23')]){writeLog(_0xb1efcf,_0x5f21a2,_0x337ed5['toUpperCase']()+_0xf326('0x26'));return![];}}return!![];};exports[_0xf326('0x27')]=function(_0x212d5d,_0x581531,_0x1617d2,_0x55ad0f,_0x4a9abf){return sendNotification(!![],_0x212d5d,_0x581531,_0x1617d2,_0x55ad0f,_0x4a9abf);};exports[_0xf326('0x28')]=function(_0x1ae23a,_0x2fa28e,_0x5dbe63,_0xc115d9,_0x292500){return sendNotification(![],_0x1ae23a,_0x2fa28e,_0x5dbe63,_0xc115d9,_0x292500);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index e61c76f..bb6b4db 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 _0x4f82=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0x213b0b,_0x5d6410){var _0x5cee71=function(_0x1d477){while(--_0x1d477){_0x213b0b['push'](_0x213b0b['shift']());}};_0x5cee71(++_0x5d6410);}(_0x4f82,0xbc));var _0x24f8=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4f82[_0x2d7f0e];return _0x110b07;};'use strict';var schema=require(_0x24f8('0x0'));var sh=require(_0x24f8('0x1'));var _=require('lodash');var utils=require(_0x24f8('0x2'));var logger=require('../../../../config/logger')(_0x24f8('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x24f8('0x4')}});exports['consequence']=function(_0x39b5e0,_0x4093e2){return function(_0x708002){try{var _0x3fc5d4={'command':_0x4093e2[0x0]};var _0x53e9fb=system[_0x24f8('0x0')](_0x3fc5d4,{'typecast':!![]});if(_0x53e9fb[_0x24f8('0x5')]){logger[_0x24f8('0x6')](_0x24f8('0x7'),_0x39b5e0,_[_0x24f8('0x8')](_0x53e9fb,_0x24f8('0x9'))['join'](',\x20'));logger[_0x24f8('0xa')](_0x24f8('0xb'),_0x39b5e0);_0x708002[_0x24f8('0xc')]();}else{var _0x302c5a=this;var _0x4eba51=utils[_0x24f8('0xd')](_0x4093e2[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x39b5e0,_0x4eba51);sh['exec'](_[_0x24f8('0xe')](_0x4eba51),function(_0x4cf97a,_0x290b2e){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x39b5e0,_0x4cf97a);if(_0x4cf97a==0x0){var _0x1f73ec=_0x290b2e[_0x24f8('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x24f8('0x10')](_0x4093e2[0x1])||_[_0x24f8('0x11')](_0x4093e2[0x1])){logger[_0x24f8('0xa')](_0x24f8('0x12'),_0x39b5e0);_0x302c5a[_0x24f8('0x13')][_0x4093e2[0x1]]=_0x1f73ec;}else{logger[_0x24f8('0xa')](_0x24f8('0x14'),_0x39b5e0,_0x4093e2[0x1],_0x1f73ec);_0x302c5a[_0x24f8('0x13')][_0x4093e2[0x1]]=_0x1f73ec;}}_0x708002[_0x24f8('0xc')]();});}}catch(_0x57d554){logger[_0x24f8('0x6')](_0x24f8('0x7'),_0x39b5e0,_[_0x24f8('0x15')](_0x57d554)?JSON[_0x24f8('0x16')](_0x57d554):_0x57d554);logger[_0x24f8('0xa')](_0x24f8('0xb'),_0x39b5e0);_0x708002[_0x24f8('0xc')]();}};}; \ No newline at end of file +var _0x0ccc=['join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','lodash','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s'];(function(_0x1a5a3e,_0xe7721){var _0x4c5668=function(_0x8b93fc){while(--_0x8b93fc){_0x1a5a3e['push'](_0x1a5a3e['shift']());}};_0x4c5668(++_0xe7721);}(_0x0ccc,0x90));var _0xc0cc=function(_0x5d9f46,_0x40a942){_0x5d9f46=_0x5d9f46-0x0;var _0x32e378=_0x0ccc[_0x5d9f46];return _0x32e378;};'use strict';var schema=require(_0xc0cc('0x0'));var sh=require('shelljs');var _=require(_0xc0cc('0x1'));var utils=require('./utils');var logger=require(_0xc0cc('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xc0cc('0x3')}});exports[_0xc0cc('0x4')]=function(_0x439e64,_0x9ba2f0){return function(_0xbaae23){try{var _0x3e4423={'command':_0x9ba2f0[0x0]};var _0x1247ce=system['validate'](_0x3e4423,{'typecast':!![]});if(_0x1247ce[_0xc0cc('0x5')]){logger[_0xc0cc('0x6')](_0xc0cc('0x7'),_0x439e64,_['map'](_0x1247ce,'message')[_0xc0cc('0x8')](',\x20'));logger['info'](_0xc0cc('0x9'),_0x439e64);_0xbaae23[_0xc0cc('0xa')]();}else{var _0x29782a=this;var _0x1ee24d=utils[_0xc0cc('0xb')](_0x9ba2f0[0x0],this);logger[_0xc0cc('0xc')](_0xc0cc('0xd'),_0x439e64,_0x1ee24d);sh['exec'](_['trim'](_0x1ee24d),function(_0x449d6e,_0x3f72c3){logger[_0xc0cc('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x439e64,_0x449d6e);if(_0x449d6e==0x0){var _0x5578d9=_0x3f72c3['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xc0cc('0xe')](_0x9ba2f0[0x1])||_['isEmpty'](_0x9ba2f0[0x1])){logger[_0xc0cc('0xc')](_0xc0cc('0xf'),_0x439e64);_0x29782a['body'][_0x9ba2f0[0x1]]=_0x5578d9;}else{logger[_0xc0cc('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x439e64,_0x9ba2f0[0x1],_0x5578d9);_0x29782a[_0xc0cc('0x10')][_0x9ba2f0[0x1]]=_0x5578d9;}}_0xbaae23[_0xc0cc('0xa')]();});}}catch(_0x552ab0){logger[_0xc0cc('0x6')](_0xc0cc('0x7'),_0x439e64,_[_0xc0cc('0x11')](_0x552ab0)?JSON[_0xc0cc('0x12')](_0x552ab0):_0x552ab0);logger['info'](_0xc0cc('0x9'),_0x439e64);_0xbaae23[_0xc0cc('0xa')]();}};}; \ 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 9b5e18f..f10daa7 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 _0x19bd=['../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','map','message','join','info','next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','stringify','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x7b25ff,_0x4d69f1){var _0x1bf5a0=function(_0x5023cb){while(--_0x5023cb){_0x7b25ff['push'](_0x7b25ff['shift']());}};_0x1bf5a0(++_0x4d69f1);}(_0x19bd,0x1a9));var _0xd19b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x19bd[_0x2dafbe];return _0x58a45a;};'use strict';var schema=require(_0xd19b('0x0'));var _=require(_0xd19b('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xd19b('0x2')),'smsInteraction':require(_0xd19b('0x3')),'mailInteraction':require(_0xd19b('0x4')),'faxInteraction':require(_0xd19b('0x5')),'whatsappInteraction':require(_0xd19b('0x6'))};var logger=require(_0xd19b('0x7'))('routing');var tag=schema({'tag':{'type':_0xd19b('0x8'),'required':!![],'message':_0xd19b('0x9')}});exports['consequence']=function(_0x15f304,_0x5a4aeb,_0x5e0bdf,_0x314165){return function(_0x5bc1ab){try{var _0x2860ae={'tag':_0x5a4aeb[0x0]};var _0x27c2f8=tag['validate'](_0x2860ae,{'typecast':!![]});if(_0x27c2f8['length']){logger[_0xd19b('0xa')](_0xd19b('0xb'),_0x15f304,_[_0xd19b('0xc')](_0x27c2f8,_0xd19b('0xd'))[_0xd19b('0xe')](',\x20'));logger[_0xd19b('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x15f304);_0x5bc1ab[_0xd19b('0x10')]();}else{var _0x2e689c={'ids':[_0x5a4aeb[0x0]]};if(rpc[_0x314165['channel']+'Interaction']){rpc[_0x314165[_0xd19b('0x11')]+_0xd19b('0x12')][_0xd19b('0x13')](_0x314165['interaction']['id'],_0x2e689c)['then'](function(_0x1342e3){logger[_0xd19b('0xf')](_0xd19b('0x14'),_0x15f304,_0x5a4aeb[0x1],_0x314165[_0xd19b('0x11')],_0x314165[_0xd19b('0x15')]['id']);})[_0xd19b('0x16')](function(_0x2ecae9){logger[_0xd19b('0xa')](_0xd19b('0xb'),_0x15f304,JSON['stringify'](_0x2ecae9));logger['info'](_0xd19b('0x17'),_0x15f304);})[_0xd19b('0x18')](function(){_0x5bc1ab[_0xd19b('0x10')]();});}}}catch(_0x425d01){logger[_0xd19b('0xa')](_0xd19b('0xb'),_0x15f304,_[_0xd19b('0x19')](_0x425d01)?JSON[_0xd19b('0x1a')](_0x425d01):_0x425d01);logger[_0xd19b('0xf')](_0xd19b('0x17'),_0x15f304);_0x5bc1ab[_0xd19b('0x10')]();}};}; \ No newline at end of file +var _0x3a37=['channel','Interaction','addTags','interaction','then','catch','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','map','message','join','info','next'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x3a37,0x175));var _0x73a3=function(_0x24cdd5,_0x4232a0){_0x24cdd5=_0x24cdd5-0x0;var _0x52a09e=_0x3a37[_0x24cdd5];return _0x52a09e;};'use strict';var schema=require(_0x73a3('0x0'));var _=require(_0x73a3('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x73a3('0x2')),'smsInteraction':require(_0x73a3('0x3')),'mailInteraction':require(_0x73a3('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x73a3('0x5'))};var logger=require(_0x73a3('0x6'))(_0x73a3('0x7'));var tag=schema({'tag':{'type':_0x73a3('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x73a3('0x9')]=function(_0x365ed7,_0xa7ba8f,_0x57fa19,_0x489adc){return function(_0x381ebf){try{var _0x355f62={'tag':_0xa7ba8f[0x0]};var _0x30bf4b=tag[_0x73a3('0x0')](_0x355f62,{'typecast':!![]});if(_0x30bf4b[_0x73a3('0xa')]){logger[_0x73a3('0xb')]('[%s][TAG]\x20%s',_0x365ed7,_[_0x73a3('0xc')](_0x30bf4b,_0x73a3('0xd'))[_0x73a3('0xe')](',\x20'));logger[_0x73a3('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x365ed7);_0x381ebf[_0x73a3('0x10')]();}else{var _0x32ce12={'ids':[_0xa7ba8f[0x0]]};if(rpc[_0x489adc[_0x73a3('0x11')]+_0x73a3('0x12')]){rpc[_0x489adc[_0x73a3('0x11')]+_0x73a3('0x12')][_0x73a3('0x13')](_0x489adc[_0x73a3('0x14')]['id'],_0x32ce12)[_0x73a3('0x15')](function(_0x173dbe){logger[_0x73a3('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x365ed7,_0xa7ba8f[0x1],_0x489adc[_0x73a3('0x11')],_0x489adc[_0x73a3('0x14')]['id']);})[_0x73a3('0x16')](function(_0x4fd9b8){logger[_0x73a3('0xb')](_0x73a3('0x17'),_0x365ed7,JSON[_0x73a3('0x18')](_0x4fd9b8));logger[_0x73a3('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x365ed7);})['finally'](function(){_0x381ebf[_0x73a3('0x10')]();});}}}catch(_0x38d1e7){logger[_0x73a3('0xb')]('[%s][TAG]\x20%s',_0x365ed7,_['isObject'](_0x38d1e7)?JSON[_0x73a3('0x18')](_0x38d1e7):_0x38d1e7);logger[_0x73a3('0xf')](_0x73a3('0x19'),_0x365ed7);_0x381ebf['next']();}};}; \ 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 2f74f13..98d76d8 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 _0xc943=['isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','replace','\x20-\x20','push','?params=','urlOnRing','title','jsonrpc','2.0','stringify','utf8','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc943,0xc4));var _0x3c94=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0xc943[_0x4f3c9b];return _0x84e58a;};'use strict';var rp=require(_0x3c94('0x0'));var logger=require('../../../../config/logger')(_0x3c94('0x1'));var _=require(_0x3c94('0x2'));var arr=[];exports[_0x3c94('0x3')]=function(_0x21e985,_0x426639){return function(_0x3e6eb7){var _0x1a263f=_0x426639[0xa];var _0x14996a=_0x426639[0xb];var _0x2936f9=_0x426639[0xc];var _0x16cbf0=_0x426639[0xd];var _0x68b94f=_0x426639[0xe];var _0x582c22=_0x426639[0xf][_0x3c94('0x4')](/\n/g,_0x3c94('0x5'));var _0x31af6d=_0x426639[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x14996a)){arr[_0x3c94('0x6')](_0x14996a);var _0x2d51c2=_0x426639[0x3];var _0x31bad8=_0x426639[0x4];var _0x2cfe06=_0x426639[0x1];var _0x5446ea=_0x426639[0x0];var _0x38c507={};_0x38c507['urlOnAnswer']=_0x426639[0x8]+_0x3c94('0x7')+_0x2936f9+'|'+_0x1a263f+'|'+_0x16cbf0+'|'+_0x14996a+'|'+_0x68b94f;_0x38c507[_0x3c94('0x8')]=_0x426639[0x7]+'?params='+_0x2936f9+'|'+_0x1a263f+'|'+_0x16cbf0+'|'+_0x14996a+'|'+_0x68b94f+'|'+_0x582c22+'|'+_0x31af6d;_0x38c507[_0x3c94('0x9')]=_0x426639[0x9];var _0x27c354={};_0x27c354[_0x3c94('0xa')]=_0x3c94('0xb');_0x27c354['method']='login';var _0xc3d3ab=[];_0xc3d3ab[_0x3c94('0x6')](_0x426639[0x2]);_0xc3d3ab[_0x3c94('0x6')](_0x426639[0x5]);_0xc3d3ab['push'](_0x426639[0x6]);_0x27c354['params']=_0xc3d3ab;_0x27c354['id']=0x1;var _0x50154e=JSON[_0x3c94('0xc')](_0x27c354);var _0x49e5da={'encoding':_0x3c94('0xd'),'method':'POST','timeout':0x2710,'url':_0x2d51c2,'headers':{'Content-Type':_0x3c94('0xe')},'body':_0x50154e};return rp(_0x49e5da)[_0x3c94('0xf')](function(_0x51c025){const _0x4d8ed8=JSON[_0x3c94('0x10')](_0x51c025);if(!_0x4d8ed8[_0x3c94('0x11')]['logged']){throw new Error(_0x3c94('0x12'));}var _0x3457f7=_0x14996a;var _0x509f92=_0x3c94('0x13')+_0x2cfe06+_0x3c94('0x14')+_0x5446ea+_0x3c94('0x15')+_0x3457f7+_0x3c94('0x16')+JSON[_0x3c94('0xc')](_0x38c507);var _0x4a0496=_0x31bad8+'?'+_0x509f92;return rp(_0x4a0496);})[_0x3c94('0xf')](function(_0x2ffca3){logger[_0x3c94('0x17')](_0x3c94('0x18'),_0x21e985,_0x2ffca3);_0x3e6eb7['stop']();})[_0x3c94('0x19')](function(_0x33415e){logger[_0x3c94('0x1a')](_0x3c94('0x1b'),_0x21e985,_[_0x3c94('0x1c')](_0x33415e)?JSON[_0x3c94('0xc')](_0x33415e):_0x33415e);_0x3e6eb7[_0x3c94('0x1d')]();});}else{logger['info'](_0x3c94('0x1e'),_0x21e985);_0x3e6eb7[_0x3c94('0x1f')]();}};}; \ No newline at end of file +var _0x1f3a=['routing','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','[%s][TVOX]\x20%s','isObject','stop','../../../../config/logger'];(function(_0x31b282,_0x362c48){var _0x40367e=function(_0x5ee7d0){while(--_0x5ee7d0){_0x31b282['push'](_0x31b282['shift']());}};_0x40367e(++_0x362c48);}(_0x1f3a,0xdf));var _0xa1f3=function(_0x4eb0cd,_0x3e294a){_0x4eb0cd=_0x4eb0cd-0x0;var _0xf8d4c1=_0x1f3a[_0x4eb0cd];return _0xf8d4c1;};'use strict';var rp=require('request-promise');var logger=require(_0xa1f3('0x0'))(_0xa1f3('0x1'));var _=require(_0xa1f3('0x2'));var arr=[];exports[_0xa1f3('0x3')]=function(_0x3045fd,_0x45ee1f){return function(_0xec502d){var _0x59b5e3=_0x45ee1f[0xa];var _0x442fba=_0x45ee1f[0xb];var _0x1c712a=_0x45ee1f[0xc];var _0x4976aa=_0x45ee1f[0xd];var _0x4dfc84=_0x45ee1f[0xe];var _0xe70d80=_0x45ee1f[0xf][_0xa1f3('0x4')](/\n/g,_0xa1f3('0x5'));var _0x24ef5e=_0x45ee1f[0x10][_0xa1f3('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x442fba)){arr[_0xa1f3('0x6')](_0x442fba);var _0x1621b5=_0x45ee1f[0x3];var _0x4c4e93=_0x45ee1f[0x4];var _0x58082d=_0x45ee1f[0x1];var _0x2f8f01=_0x45ee1f[0x0];var _0x7a39fe={};_0x7a39fe[_0xa1f3('0x7')]=_0x45ee1f[0x8]+_0xa1f3('0x8')+_0x1c712a+'|'+_0x59b5e3+'|'+_0x4976aa+'|'+_0x442fba+'|'+_0x4dfc84;_0x7a39fe['urlOnRing']=_0x45ee1f[0x7]+_0xa1f3('0x8')+_0x1c712a+'|'+_0x59b5e3+'|'+_0x4976aa+'|'+_0x442fba+'|'+_0x4dfc84+'|'+_0xe70d80+'|'+_0x24ef5e;_0x7a39fe[_0xa1f3('0x9')]=_0x45ee1f[0x9];var _0x17f5fc={};_0x17f5fc[_0xa1f3('0xa')]=_0xa1f3('0xb');_0x17f5fc[_0xa1f3('0xc')]=_0xa1f3('0xd');var _0x28118=[];_0x28118['push'](_0x45ee1f[0x2]);_0x28118['push'](_0x45ee1f[0x5]);_0x28118[_0xa1f3('0x6')](_0x45ee1f[0x6]);_0x17f5fc[_0xa1f3('0xe')]=_0x28118;_0x17f5fc['id']=0x1;var _0x4afb47=JSON[_0xa1f3('0xf')](_0x17f5fc);var _0x5906b5={'encoding':'utf8','method':_0xa1f3('0x10'),'timeout':0x2710,'url':_0x1621b5,'headers':{'Content-Type':_0xa1f3('0x11')},'body':_0x4afb47};return rp(_0x5906b5)['then'](function(_0x7d7d27){const _0x5ecbac=JSON[_0xa1f3('0x12')](_0x7d7d27);if(!_0x5ecbac[_0xa1f3('0x13')][_0xa1f3('0x14')]){throw new Error(_0xa1f3('0x15'));}var _0xc037b5=_0x442fba;var _0x318e2d=_0xa1f3('0x16')+_0x58082d+_0xa1f3('0x17')+_0x2f8f01+_0xa1f3('0x18')+_0xc037b5+_0xa1f3('0x19')+JSON[_0xa1f3('0xf')](_0x7a39fe);var _0x336243=_0x4c4e93+'?'+_0x318e2d;return rp(_0x336243);})['then'](function(_0x3d4477){logger[_0xa1f3('0x1a')](_0xa1f3('0x1b'),_0x3045fd,_0x3d4477);_0xec502d['stop']();})[_0xa1f3('0x1c')](function(_0x241694){logger['error'](_0xa1f3('0x1d'),_0x3045fd,_[_0xa1f3('0x1e')](_0x241694)?JSON[_0xa1f3('0xf')](_0x241694):_0x241694);_0xec502d[_0xa1f3('0x1f')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x3045fd);_0xec502d['next']();}};}; \ 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 9a1a2cc..687ee43 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(_0x473bdb,_0x161510){var _0x44c246=function(_0x93148b){while(--_0x93148b){_0x473bdb['push'](_0x473bdb['shift']());}};_0x44c246(++_0x161510);}(_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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4df1a3,_0x3703ee){var _0xc9aef=function(_0x31489d){while(--_0x31489d){_0x4df1a3['push'](_0x4df1a3['shift']());}};_0xc9aef(++_0x3703ee);}(_0xe706,0xa3));var _0x6e70=function(_0x11f4b5,_0x279f0d){_0x11f4b5=_0x11f4b5-0x0;var _0x59d5e0=_0xe706[_0x11f4b5];return _0x59d5e0;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 9ebcd9b..6b14f1b 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 _0xd110=['../rpc/whatsappQueueReport','format','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','existsSync','join','app','.js','autoreply','appdata','mail','push','slice','split','dialogflowv2','amazonlex','tag','TagId','tvox','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport'];(function(_0x570b91,_0x232b46){var _0x47e3ba=function(_0x389327){while(--_0x389327){_0x570b91['push'](_0x570b91['shift']());}};_0x47e3ba(++_0x232b46);}(_0xd110,0x1e8));var _0x0d11=function(_0x39fb5d,_0x59798b){_0x39fb5d=_0x39fb5d-0x0;var _0x22f743=_0xd110[_0x39fb5d];return _0x22f743;};'use strict';var _=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var path=require(_0x0d11('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x0d11('0x3'));var uuid=require(_0x0d11('0x4'));var utils=require(_0x0d11('0x5'));var config=require(_0x0d11('0x6'));var logger=require(_0x0d11('0x7'))(_0x0d11('0x8'));var rpc={'openchannelQueueReport':require(_0x0d11('0x9')),'mailQueueReport':require(_0x0d11('0xa')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x0d11('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x0d11('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x47a493,_0x3f9f5a,_0x1be5b8){return util[_0x0d11('0xd')]('%s.%s.%s',_0x47a493,_0x3f9f5a||0x0,_0x1be5b8||0x0);}function getIntervals(_0x40823e,_0x4deda3){var _0x1fc1d3=[];if(!_['isNil'](_0x4deda3[_0x0d11('0xe')])&&!_[_0x0d11('0xf')](_0x40823e[_0x4deda3[_0x0d11('0xe')]])&&!_[_0x0d11('0xf')](_0x40823e[_0x4deda3['IntervalId']][_0x0d11('0x10')])){_0x1fc1d3=_[_0x0d11('0x11')](_0x40823e[_0x4deda3['IntervalId']][_0x0d11('0x10')],_0x0d11('0x12'));}else if(!_[_0x0d11('0xf')](_0x4deda3['interval'])){_0x1fc1d3=[_0x4deda3[_0x0d11('0x12')]];}return _0x1fc1d3;}exports[_0x0d11('0x13')]=function(_0x5bea18){_0x5bea18[_0x0d11('0x14')]={};return new BPromise(function(_0x3c88e6,_0x266f0f){var _0x3005f2={'Start':function(_0x2bc04b){var _0x5b85a7=this;return new Promise(function(_0x5a0de9,_0x280d81){if(_0x2bc04b){try{var _0x47c872=[];var _0x46aa4f=getId(_0x2bc04b[_0x0d11('0x15')],_0x2bc04b['message']?_0x2bc04b[_0x0d11('0x16')]['id']:0x0,_0x2bc04b['interaction']?_0x2bc04b[_0x0d11('0x17')]['id']:0x0);if(_0x2bc04b[_0x0d11('0x18')]&&_['isArray'](_0x2bc04b['applications'])&&_0x2bc04b[_0x0d11('0x18')][_0x0d11('0x19')]){for(var _0x362c14=0x0;_0x362c14<_0x2bc04b[_0x0d11('0x18')][_0x0d11('0x19')];_0x362c14+=0x1){var _0x3b4be3=_0x2bc04b['applications'][_0x362c14];if(fs[_0x0d11('0x1a')](path[_0x0d11('0x1b')](__dirname,_0x0d11('0x18'),_0x3b4be3[_0x0d11('0x1c')]+_0x0d11('0x1d')))){var _0x551e16=[];switch(_0x3b4be3[_0x0d11('0x1c')]['toLowerCase']()){case _0x0d11('0x1e'):var _0x424255=_0x3b4be3[_0x0d11('0x1f')]['split'](',');if(_0x2bc04b[_0x0d11('0x15')]===_0x0d11('0x20')){_0x551e16['push'](_0x424255[0x0]);_0x551e16[_0x0d11('0x21')](_0x424255[0x1]);_0x551e16['push'](_0x424255[_0x0d11('0x22')](0x2,_0x424255['length'])['join'](','));}else{_0x551e16[_0x0d11('0x21')](_0x424255[0x0]);_0x551e16[_0x0d11('0x21')](_0x424255[_0x0d11('0x22')](0x1,_0x424255[_0x0d11('0x19')])[_0x0d11('0x1b')](','));}break;case'dialogflow':var _0x21fac5=_0x3b4be3['appdata'][_0x0d11('0x23')](',');_0x551e16['push'](_0x21fac5[0x0]);_0x551e16[_0x0d11('0x21')](_0x21fac5[0x1]);_0x551e16[_0x0d11('0x21')](_0x21fac5[_0x0d11('0x22')](0x2,_0x21fac5[_0x0d11('0x19')])[_0x0d11('0x1b')](','));break;case _0x0d11('0x24'):var _0x144e93=_0x3b4be3[_0x0d11('0x1f')][_0x0d11('0x23')](',');_0x551e16[_0x0d11('0x21')](_0x144e93[0x0]);_0x551e16[_0x0d11('0x21')](_0x144e93[0x1]);_0x551e16[_0x0d11('0x21')](_0x144e93[0x2]);_0x551e16['push'](_0x144e93[0x3]);_0x551e16[_0x0d11('0x21')](_0x144e93[_0x0d11('0x22')](0x4,_0x144e93['length'])[_0x0d11('0x1b')](','));break;case _0x0d11('0x25'):var _0x577f01=_0x3b4be3[_0x0d11('0x1f')][_0x0d11('0x23')](',');_0x551e16[_0x0d11('0x21')](_0x577f01[0x0]);_0x551e16[_0x0d11('0x21')](_0x577f01[0x1]);_0x551e16[_0x0d11('0x21')](_0x577f01[0x2]);_0x551e16[_0x0d11('0x21')](_0x577f01[0x3]);_0x551e16[_0x0d11('0x21')](_0x577f01[_0x0d11('0x22')](0x4,_0x577f01['length'])[_0x0d11('0x1b')](','));break;case _0x0d11('0x16'):_0x551e16[_0x0d11('0x21')](_0x3b4be3[_0x0d11('0x1f')]);break;case _0x0d11('0x26'):_0x551e16[_0x0d11('0x21')](_0x3b4be3[_0x0d11('0x27')]);_0x551e16[_0x0d11('0x21')](_0x3b4be3[_0x0d11('0x1f')]);break;case _0x0d11('0x28'):var _0x3c6c4b=utils['getMustacheRender'](_0x2bc04b['account'][_0x0d11('0x29')],_0x2bc04b);var _0x18c268=_0x3b4be3[_0x0d11('0x1f')][_0x0d11('0x23')](',');_0x551e16['push'](_0x18c268[0x0]);_0x551e16[_0x0d11('0x21')](_0x18c268[0x1]);_0x551e16[_0x0d11('0x21')](_0x18c268[0x2]);_0x551e16['push'](_0x18c268[0x3]);_0x551e16[_0x0d11('0x21')](_0x18c268[0x4]);_0x551e16[_0x0d11('0x21')](_0x18c268[0x5]);_0x551e16[_0x0d11('0x21')](_0x18c268[0x6]);_0x551e16[_0x0d11('0x21')](_0x18c268[0x7]);_0x551e16[_0x0d11('0x21')](_0x18c268[0x8]);_0x551e16[_0x0d11('0x21')](_0x18c268[0x9]);_0x551e16[_0x0d11('0x21')](_0x18c268[0xa]);_0x551e16[_0x0d11('0x21')](_0x2bc04b[_0x0d11('0x17')]['id']);_0x551e16[_0x0d11('0x21')](_0x2bc04b[_0x0d11('0x16')]['id']);_0x551e16[_0x0d11('0x21')](_0x3b4be3[_0x0d11('0x2a')]);_0x551e16[_0x0d11('0x21')](_0x2bc04b[_0x0d11('0x17')]['ContactId']);_0x551e16[_0x0d11('0x21')](_0x2bc04b['body'][_0x0d11('0x2b')]);_0x551e16[_0x0d11('0x21')](_0x3c6c4b);break;default:_0x551e16=_[_0x0d11('0xf')](_0x3b4be3[_0x0d11('0x1f')])?[]:_0x3b4be3['appdata'][_0x0d11('0x23')](',');}var _0x1448f5={'id':util[_0x0d11('0xd')](_0x0d11('0x2c'),_0x46aa4f,_0x3b4be3['id'],_0x3b4be3['app']),'condition':require(_0x0d11('0x2d'))['condition'](_0x46aa4f,getIntervals(_0x5bea18[_0x0d11('0x2e')],_0x3b4be3),_0x5bea18),'consequence':require(_0x0d11('0x2f')+_0x3b4be3[_0x0d11('0x1c')])[_0x0d11('0x30')](_0x46aa4f,_0x551e16,_0x5bea18,_0x2bc04b),'p':_0x3b4be3['priority']||0x0};logger[_0x0d11('0x31')](_0x0d11('0x32'),_0x1448f5['id'],_0x0d11('0x33'),getIntervals(_0x5bea18['intervals'],_0x3b4be3)[_0x0d11('0x1b')](_0x0d11('0x34')));_0x47c872[_0x0d11('0x21')](_0x1448f5);}else{logger[_0x0d11('0x35')](_0x0d11('0x36'),path[_0x0d11('0x1b')](__dirname,'applications',_0x3b4be3[_0x0d11('0x1c')]+_0x0d11('0x1d')));}}_0x5bea18[_0x0d11('0x14')][_0x46aa4f]=new RuleEngine(_0x47c872);_0x5bea18[_0x0d11('0x14')][_0x46aa4f][_0x0d11('0x37')](_0x2bc04b,function(_0x163ca8){logger[_0x0d11('0x31')](_0x0d11('0x38'),JSON[_0x0d11('0x39')](_0x163ca8[_0x0d11('0x3a')]));if(_0x5bea18[_0x0d11('0x14')][_0x46aa4f]){_0x5bea18['rules'][_0x46aa4f][_0x0d11('0x3b')]('complete');}});return _0x5a0de9({'code':0xc8,'message':_0x2bc04b});}else{logger['info'](_0x0d11('0x3c'));return _0x5a0de9({'code':0xc8,'message':_0x2bc04b});}}catch(_0x525509){logger['error'](_0x525509[_0x0d11('0x3d')]);return _0x280d81(_0x5b85a7[_0x0d11('0x35')](0x1f4,_0x525509));}}return _0x280d81(_0x0d11('0x3e'));});},'AcceptMessage':function(_0x1ebc1d){var _0x4fcf02=this;return new Promise(function(_0x169a31,_0x4d9e67){if(_0x1ebc1d['agent']&&_0x1ebc1d[_0x0d11('0x3f')]['id']){if(_0x5bea18[_0x0d11('0x40')][_0x1ebc1d[_0x0d11('0x3f')]['id']]){_0x5bea18[_0x0d11('0x40')][_0x1ebc1d[_0x0d11('0x3f')]['id']]['busy']=![];_0x5bea18[_0x0d11('0x40')][_0x1ebc1d[_0x0d11('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x1ebc1d['message']&&_0x1ebc1d['message']['id']){try{var _0x4bcfaa=getId(_0x1ebc1d[_0x0d11('0x15')],_0x1ebc1d[_0x0d11('0x16')]?_0x1ebc1d[_0x0d11('0x16')]['id']:0x0,_0x1ebc1d['interaction']?_0x1ebc1d['interaction']['id']:0x0);if(_0x5bea18[_0x0d11('0x14')][_0x4bcfaa]){_0x5bea18[_0x0d11('0x14')][_0x4bcfaa][_0x0d11('0x3b')](_0x0d11('0x41'));if(rpc[_0x1ebc1d[_0x0d11('0x15')]+'QueueReport']){rpc[_0x1ebc1d[_0x0d11('0x15')]+_0x0d11('0x42')][_0x0d11('0x43')](_0x4bcfaa,{'UserId':_0x1ebc1d[_0x0d11('0x16')][_0x0d11('0x44')]})[_0x0d11('0x45')](function(_0x37916a){logger[_0x0d11('0x35')](_0x0d11('0x46'));});}}return _0x169a31({'code':0xc8,'message':_0x1ebc1d});}catch(_0x406eab){logger[_0x0d11('0x35')](_0x406eab[_0x0d11('0x3d')]);return _0x4d9e67(_0x4fcf02[_0x0d11('0x35')](0x1f4,_0x406eab));}}logger[_0x0d11('0x35')](_0x0d11('0x47'));return _0x4d9e67(_0x4fcf02[_0x0d11('0x35')](0x1f4,_0x0d11('0x47')));});},'RejectMessage':function(_0x1f07f1){var _0x17f3a0=this;return new Promise(function(_0x2927a0,_0x5b28ce){if(_0x1f07f1[_0x0d11('0x3f')]&&_0x1f07f1['agent']['id']){try{if(_0x5bea18[_0x0d11('0x40')][_0x1f07f1['agent']['id']]){_0x5bea18['agents'][_0x1f07f1[_0x0d11('0x3f')]['id']][_0x0d11('0x48')]=![];_0x5bea18[_0x0d11('0x40')][_0x1f07f1[_0x0d11('0x3f')]['id']][_0x0d11('0x49')]=undefined;}return _0x2927a0({'code':0xc8,'message':_0x1f07f1});}catch(_0x1e5510){logger[_0x0d11('0x35')](_0x1e5510[_0x0d11('0x3d')]);return _0x5b28ce(_0x17f3a0['error'](0x1f4,_0x1e5510));}}logger['error']('message\x20is\x20empty');return _0x5b28ce(_0x17f3a0[_0x0d11('0x35')](0x1f4,_0x0d11('0x47')));});},'AbandonInteraction':function(_0x420f8e){var _0x131d40=this;return new Promise(function(_0x258fd3,_0x38ba59){if(_0x420f8e[_0x0d11('0x15')]&&_0x420f8e['interaction']&&_0x420f8e[_0x0d11('0x17')]['id']){try{var _0x34a825=getId(_0x420f8e[_0x0d11('0x15')],_0x420f8e['message']?_0x420f8e['message']['id']:0x0,_0x420f8e[_0x0d11('0x17')]?_0x420f8e['interaction']['id']:0x0);if(_0x5bea18[_0x0d11('0x14')][_0x34a825]){_0x5bea18[_0x0d11('0x14')][_0x34a825][_0x0d11('0x3b')](_0x0d11('0x41'));}return _0x258fd3({'code':0xc8,'message':_0x420f8e});}catch(_0xce2e39){logger[_0x0d11('0x35')](_0xce2e39[_0x0d11('0x3d')]);return _0x38ba59(_0x131d40[_0x0d11('0x35')](0x1f4,_0xce2e39));}}logger[_0x0d11('0x35')](_0x0d11('0x47'));return _0x38ba59(_0x131d40[_0x0d11('0x35')](0x1f4,_0x0d11('0x47')));});},'AgentCapacity':function(_0x546b98){var _0x1d5c84=this;return new Promise(function(_0x142437,_0x26be02){if(_0x5bea18[_0x0d11('0x40')][_0x0d11('0x4a')](_0x546b98['id'])){for(var _0x505562 in _0x546b98[_0x0d11('0x4b')]){if(_0x546b98[_0x0d11('0x4b')][_0x0d11('0x4a')](_0x505562)){if(_0x5bea18[_0x0d11('0x40')][_0x546b98['id']][_0x0d11('0x4a')](_0x505562+_0x0d11('0x4c'))){_0x5bea18[_0x0d11('0x40')][_0x546b98['id']][_0x505562+_0x0d11('0x4c')]=parseInt(_0x546b98['capacity'][_0x505562],0xa);}}}_0x5bea18[_0x0d11('0x40')][_0x546b98['id']]['updateRealtime']();return _0x142437({'code':0xc8,'message':_0x5bea18[_0x0d11('0x40')][_0x546b98['id']]});}else{return _0x26be02(_0x1d5c84[_0x0d11('0x35')](0x1f4,_0x0d11('0x4d')));}});},'Agents':function(_0x4380a9){return new Promise(function(_0x3ba939,_0x5e0e5b){var _0x17f47b=_[_0x0d11('0x4e')](_0x5bea18[_0x0d11('0x40')]);_0x3ba939({'count':_0x17f47b[_0x0d11('0x19')],'rows':_0x17f47b});});},'ChatQueues':function(_0x237224){return new Promise(function(_0x32d692,_0x2a6b03){var _0x323678=[];for(var _0x1df6e0 in _0x5bea18['chatQueues']){if(_0x5bea18[_0x0d11('0x4f')][_0x0d11('0x4a')](_0x1df6e0)){var _0x26aace=_0x5bea18[_0x0d11('0x4f')][_0x1df6e0];var _0x130278={'id':_0x26aace['id'],'available':_0x26aace[_0x0d11('0x50')],'loggedIn':_0x26aace[_0x0d11('0x51')],'name':_0x26aace[_0x0d11('0x52')],'paused':_0x26aace[_0x0d11('0x53')],'waiting':_0x26aace[_0x0d11('0x54')]};_0x323678[_0x0d11('0x21')](_0x130278);}}_0x32d692({'count':_0x323678[_0x0d11('0x19')],'rows':_0x323678});});},'MailQueues':function(_0x1719a8){return new Promise(function(_0x312e5a,_0x1cf80e){var _0x50c040=[];for(var _0x44f6fe in _0x5bea18[_0x0d11('0x55')]){if(_0x5bea18[_0x0d11('0x55')]['hasOwnProperty'](_0x44f6fe)){var _0x59d633=_0x5bea18['mailQueues'][_0x44f6fe];var _0x32179e={'id':_0x59d633['id'],'available':_0x59d633[_0x0d11('0x50')],'loggedIn':_0x59d633['loggedIn'],'name':_0x59d633[_0x0d11('0x52')],'paused':_0x59d633['paused'],'waiting':_0x59d633[_0x0d11('0x54')]};_0x50c040[_0x0d11('0x21')](_0x32179e);}}_0x312e5a({'count':_0x50c040[_0x0d11('0x19')],'rows':_0x50c040});});},'OpenchannelQueues':function(_0x6d3f9d){return new Promise(function(_0x20c1fd,_0x42b607){var _0x2c1405=[];for(var _0xae4f5e in _0x5bea18[_0x0d11('0x56')]){if(_0x5bea18[_0x0d11('0x56')][_0x0d11('0x4a')](_0xae4f5e)){var _0x3397ad=_0x5bea18[_0x0d11('0x56')][_0xae4f5e];var _0x527cd8={'id':_0x3397ad['id'],'available':_0x3397ad[_0x0d11('0x50')],'loggedIn':_0x3397ad[_0x0d11('0x51')],'name':_0x3397ad[_0x0d11('0x52')],'paused':_0x3397ad[_0x0d11('0x53')],'waiting':_0x3397ad[_0x0d11('0x54')]};_0x2c1405[_0x0d11('0x21')](_0x527cd8);}}_0x20c1fd({'count':_0x2c1405[_0x0d11('0x19')],'rows':_0x2c1405});});},'SmsQueues':function(_0x5eff2c){return new Promise(function(_0x2b5802,_0x30e7c8){var _0x363aa4=[];for(var _0xf7f940 in _0x5bea18[_0x0d11('0x57')]){if(_0x5bea18['smsQueues'][_0x0d11('0x4a')](_0xf7f940)){var _0x5889f4=_0x5bea18[_0x0d11('0x57')][_0xf7f940];var _0x3a2480={'id':_0x5889f4['id'],'available':_0x5889f4['available'],'loggedIn':_0x5889f4[_0x0d11('0x51')],'name':_0x5889f4[_0x0d11('0x52')],'paused':_0x5889f4[_0x0d11('0x53')],'waiting':_0x5889f4[_0x0d11('0x54')]};_0x363aa4[_0x0d11('0x21')](_0x3a2480);}}_0x2b5802({'count':_0x363aa4[_0x0d11('0x19')],'rows':_0x363aa4});});},'FaxQueues':function(_0x583bd9){return new Promise(function(_0x24dc5a,_0x2da184){var _0x2b0208=[];for(var _0x919193 in _0x5bea18['faxQueues']){if(_0x5bea18[_0x0d11('0x58')][_0x0d11('0x4a')](_0x919193)){var _0x3c5f72=_0x5bea18[_0x0d11('0x58')][_0x919193];var _0x4462ed={'id':_0x3c5f72['id'],'available':_0x3c5f72[_0x0d11('0x50')],'loggedIn':_0x3c5f72[_0x0d11('0x51')],'name':_0x3c5f72[_0x0d11('0x52')],'paused':_0x3c5f72[_0x0d11('0x53')],'waiting':_0x3c5f72[_0x0d11('0x54')]};_0x2b0208[_0x0d11('0x21')](_0x4462ed);}}_0x24dc5a({'count':_0x2b0208[_0x0d11('0x19')],'rows':_0x2b0208});});},'WhatsappQueues':function(_0x38e17d){return new Promise(function(_0x365604,_0x15903b){var _0x1fd444=[];for(var _0x37f8d3 in _0x5bea18[_0x0d11('0x59')]){if(_0x5bea18[_0x0d11('0x59')]['hasOwnProperty'](_0x37f8d3)){var _0x1c26ff=_0x5bea18[_0x0d11('0x59')][_0x37f8d3];var _0x2c2e6a={'id':_0x1c26ff['id'],'available':_0x1c26ff[_0x0d11('0x50')],'loggedIn':_0x1c26ff[_0x0d11('0x51')],'name':_0x1c26ff['name'],'paused':_0x1c26ff[_0x0d11('0x53')],'waiting':_0x1c26ff[_0x0d11('0x54')]};_0x1fd444[_0x0d11('0x21')](_0x2c2e6a);}}_0x365604({'count':_0x1fd444[_0x0d11('0x19')],'rows':_0x1fd444});});},'ChatQueuesWaitingInteractions':function(_0x432f5b){return new Promise(function(_0x4a1c12,_0x19d4c1){var _0x2f1600=_[_0x0d11('0x4e')](_0x5bea18[_0x0d11('0x5a')]);_0x4a1c12({'count':_0x2f1600[_0x0d11('0x19')],'rows':_0x2f1600});});},'MailQueuesWaitingInteractions':function(_0x5de3f6){return new Promise(function(_0x98df5f,_0x55c46f){var _0x14a7a8=_[_0x0d11('0x4e')](_0x5bea18[_0x0d11('0x5b')]);_0x98df5f({'count':_0x14a7a8['length'],'rows':_0x14a7a8});});},'OpenchannelQueuesWaitingInteractions':function(_0x43ab92){return new Promise(function(_0x167edc,_0x3c1e63){var _0x297d47=_['values'](_0x5bea18[_0x0d11('0x5c')]);_0x167edc({'count':_0x297d47[_0x0d11('0x19')],'rows':_0x297d47});});},'SmsQueuesWaitingInteractions':function(_0x329660){return new Promise(function(_0x1b0f25,_0x412dbe){var _0x2c9a99=_[_0x0d11('0x4e')](_0x5bea18[_0x0d11('0x5d')]);_0x1b0f25({'count':_0x2c9a99[_0x0d11('0x19')],'rows':_0x2c9a99});});},'FaxQueuesWaitingInteractions':function(_0xe86d33){return new Promise(function(_0x2ddaab,_0x43e472){var _0x105f93=_[_0x0d11('0x4e')](_0x5bea18['faxQueuesWaitingInteractions']);_0x2ddaab({'count':_0x105f93[_0x0d11('0x19')],'rows':_0x105f93});});},'WhatsappQueuesWaitingInteractions':function(_0x43b65c){return new Promise(function(_0x8331d5,_0x1f8d62){var _0x3c4928=_['values'](_0x5bea18[_0x0d11('0x5e')]);_0x8331d5({'count':_0x3c4928[_0x0d11('0x19')],'rows':_0x3c4928});});}};var _0xb8e0d2=jayson[_0x0d11('0x5f')](_0x3005f2)[_0x0d11('0x60')]();_0xb8e0d2['on'](_0x0d11('0x35'),function(_0x347c98){logger['error'](JSON[_0x0d11('0x39')](_0x347c98));return _0x266f0f(_0x347c98);});_0xb8e0d2[_0x0d11('0x13')](0x232c,_0x0d11('0x61'),function(){console[_0x0d11('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3c88e6(_0x0d11('0x63')+0x232c);});});}; \ No newline at end of file +var _0xb688=['openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','isArray','applications','length','existsSync','join','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','priority','info','on\x20interval','\x20|\x20','error','app','.js','rules','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','UserId','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','waiting','mailQueues','openchannelQueues','name','paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0xb688,0xcf));var _0x8b68=function(_0x1e4ef2,_0x1fb8b3){_0x1e4ef2=_0x1e4ef2-0x0;var _0x5e9b99=_0xb688[_0x1e4ef2];return _0x5e9b99;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var fs=require('fs');var jayson=require(_0x8b68('0x2'));var BPromise=require(_0x8b68('0x3'));var uuid=require(_0x8b68('0x4'));var utils=require(_0x8b68('0x5'));var config=require('../../../config/environment');var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var rpc={'openchannelQueueReport':require(_0x8b68('0x8')),'mailQueueReport':require(_0x8b68('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x8b68('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x8b68('0xb'))};var RuleEngine=require(_0x8b68('0xc'));function getId(_0x130892,_0xa5571b,_0x132617){return util[_0x8b68('0xd')](_0x8b68('0xe'),_0x130892,_0xa5571b||0x0,_0x132617||0x0);}function getIntervals(_0x21d944,_0x24e0b0){var _0x2f2e3c=[];if(!_[_0x8b68('0xf')](_0x24e0b0[_0x8b68('0x10')])&&!_[_0x8b68('0xf')](_0x21d944[_0x24e0b0['IntervalId']])&&!_[_0x8b68('0xf')](_0x21d944[_0x24e0b0[_0x8b68('0x10')]][_0x8b68('0x11')])){_0x2f2e3c=_[_0x8b68('0x12')](_0x21d944[_0x24e0b0[_0x8b68('0x10')]][_0x8b68('0x11')],_0x8b68('0x13'));}else if(!_[_0x8b68('0xf')](_0x24e0b0[_0x8b68('0x13')])){_0x2f2e3c=[_0x24e0b0['interval']];}return _0x2f2e3c;}exports[_0x8b68('0x14')]=function(_0x509033){_0x509033['rules']={};return new BPromise(function(_0x22f75b,_0x1554d6){var _0x27d717={'Start':function(_0x5d3468){var _0x5c8d0e=this;return new Promise(function(_0x23bd52,_0x5c1e44){if(_0x5d3468){try{var _0x136f1b=[];var _0xb44923=getId(_0x5d3468[_0x8b68('0x15')],_0x5d3468[_0x8b68('0x16')]?_0x5d3468['message']['id']:0x0,_0x5d3468[_0x8b68('0x17')]?_0x5d3468[_0x8b68('0x17')]['id']:0x0);if(_0x5d3468['applications']&&_[_0x8b68('0x18')](_0x5d3468[_0x8b68('0x19')])&&_0x5d3468[_0x8b68('0x19')][_0x8b68('0x1a')]){for(var _0x38b7a7=0x0;_0x38b7a7<_0x5d3468['applications'][_0x8b68('0x1a')];_0x38b7a7+=0x1){var _0x4b4b0f=_0x5d3468[_0x8b68('0x19')][_0x38b7a7];if(fs[_0x8b68('0x1b')](path[_0x8b68('0x1c')](__dirname,_0x8b68('0x19'),_0x4b4b0f['app']+'.js'))){var _0x23edc1=[];switch(_0x4b4b0f['app'][_0x8b68('0x1d')]()){case _0x8b68('0x1e'):var _0x13aee5=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');if(_0x5d3468[_0x8b68('0x15')]==='mail'){_0x23edc1[_0x8b68('0x21')](_0x13aee5[0x0]);_0x23edc1[_0x8b68('0x21')](_0x13aee5[0x1]);_0x23edc1['push'](_0x13aee5[_0x8b68('0x22')](0x2,_0x13aee5[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));}else{_0x23edc1['push'](_0x13aee5[0x0]);_0x23edc1['push'](_0x13aee5['slice'](0x1,_0x13aee5[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));}break;case _0x8b68('0x23'):var _0x583476=_0x4b4b0f[_0x8b68('0x1f')]['split'](',');_0x23edc1['push'](_0x583476[0x0]);_0x23edc1[_0x8b68('0x21')](_0x583476[0x1]);_0x23edc1['push'](_0x583476[_0x8b68('0x22')](0x2,_0x583476[_0x8b68('0x1a')])['join'](','));break;case'dialogflowv2':var _0x357635=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x357635[0x0]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x1]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x2]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x3]);_0x23edc1['push'](_0x357635[_0x8b68('0x22')](0x4,_0x357635['length'])[_0x8b68('0x1c')](','));break;case _0x8b68('0x24'):var _0x4c276f=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x4c276f[0x0]);_0x23edc1['push'](_0x4c276f[0x1]);_0x23edc1['push'](_0x4c276f[0x2]);_0x23edc1[_0x8b68('0x21')](_0x4c276f[0x3]);_0x23edc1[_0x8b68('0x21')](_0x4c276f[_0x8b68('0x22')](0x4,_0x4c276f[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));break;case _0x8b68('0x16'):_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x1f')]);break;case _0x8b68('0x25'):_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x26')]);_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x1f')]);break;case _0x8b68('0x27'):var _0x10aca9=utils[_0x8b68('0x28')](_0x5d3468[_0x8b68('0x29')][_0x8b68('0x2a')],_0x5d3468);var _0x120b34=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x120b34[0x0]);_0x23edc1['push'](_0x120b34[0x1]);_0x23edc1['push'](_0x120b34[0x2]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x3]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x4]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x5]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x6]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x7]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x8]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x9]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0xa]);_0x23edc1['push'](_0x5d3468[_0x8b68('0x17')]['id']);_0x23edc1[_0x8b68('0x21')](_0x5d3468[_0x8b68('0x16')]['id']);_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x2b')]);_0x23edc1[_0x8b68('0x21')](_0x5d3468[_0x8b68('0x17')][_0x8b68('0x2c')]);_0x23edc1['push'](_0x5d3468[_0x8b68('0x2d')][_0x8b68('0x2d')]);_0x23edc1[_0x8b68('0x21')](_0x10aca9);break;default:_0x23edc1=_[_0x8b68('0xf')](_0x4b4b0f[_0x8b68('0x1f')])?[]:_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');}var _0x50a9c6={'id':util[_0x8b68('0xd')](_0x8b68('0x2e'),_0xb44923,_0x4b4b0f['id'],_0x4b4b0f['app']),'condition':require(_0x8b68('0x2f'))[_0x8b68('0x30')](_0xb44923,getIntervals(_0x509033['intervals'],_0x4b4b0f),_0x509033),'consequence':require('./applications/'+_0x4b4b0f['app'])['consequence'](_0xb44923,_0x23edc1,_0x509033,_0x5d3468),'p':_0x4b4b0f[_0x8b68('0x31')]||0x0};logger[_0x8b68('0x32')]('Push\x20new\x20rule',_0x50a9c6['id'],_0x8b68('0x33'),getIntervals(_0x509033['intervals'],_0x4b4b0f)[_0x8b68('0x1c')](_0x8b68('0x34')));_0x136f1b['push'](_0x50a9c6);}else{logger[_0x8b68('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x4b4b0f[_0x8b68('0x36')]+_0x8b68('0x37')));}}_0x509033[_0x8b68('0x38')][_0xb44923]=new RuleEngine(_0x136f1b);_0x509033[_0x8b68('0x38')][_0xb44923]['execute'](_0x5d3468,function(_0x20162a){logger['info'](_0x8b68('0x39'),JSON[_0x8b68('0x3a')](_0x20162a['matchPath']));if(_0x509033[_0x8b68('0x38')][_0xb44923]){_0x509033[_0x8b68('0x38')][_0xb44923][_0x8b68('0x3b')](_0x8b68('0x3c'));}});return _0x23bd52({'code':0xc8,'message':_0x5d3468});}else{logger['info'](_0x8b68('0x3d'));return _0x23bd52({'code':0xc8,'message':_0x5d3468});}}catch(_0x478527){logger[_0x8b68('0x35')](_0x478527[_0x8b68('0x3e')]);return _0x5c1e44(_0x5c8d0e[_0x8b68('0x35')](0x1f4,_0x478527));}}return _0x5c1e44(_0x8b68('0x3f'));});},'AcceptMessage':function(_0x41d9a2){var _0x69fdbe=this;return new Promise(function(_0x29e265,_0x20df07){if(_0x41d9a2[_0x8b68('0x40')]&&_0x41d9a2[_0x8b68('0x40')]['id']){if(_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]){_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]['busy']=![];_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]['busyQueue']=undefined;}}if(_0x41d9a2[_0x8b68('0x16')]&&_0x41d9a2['message']['id']){try{var _0x58cf66=getId(_0x41d9a2['channel'],_0x41d9a2[_0x8b68('0x16')]?_0x41d9a2[_0x8b68('0x16')]['id']:0x0,_0x41d9a2[_0x8b68('0x17')]?_0x41d9a2[_0x8b68('0x17')]['id']:0x0);if(_0x509033['rules'][_0x58cf66]){_0x509033['rules'][_0x58cf66][_0x8b68('0x3b')](_0x8b68('0x42'));if(rpc[_0x41d9a2[_0x8b68('0x15')]+'QueueReport']){rpc[_0x41d9a2[_0x8b68('0x15')]+_0x8b68('0x43')]['update'](_0x58cf66,{'UserId':_0x41d9a2[_0x8b68('0x16')][_0x8b68('0x44')]})['catch'](function(_0x18a9ae){logger[_0x8b68('0x35')]('error\x20update\x20queue\x20report');});}}return _0x29e265({'code':0xc8,'message':_0x41d9a2});}catch(_0x3f7f89){logger[_0x8b68('0x35')](_0x3f7f89['stack']);return _0x20df07(_0x69fdbe['error'](0x1f4,_0x3f7f89));}}logger['error'](_0x8b68('0x45'));return _0x20df07(_0x69fdbe[_0x8b68('0x35')](0x1f4,_0x8b68('0x45')));});},'RejectMessage':function(_0x3d4b4f){var _0x55aad3=this;return new Promise(function(_0x5a1711,_0x4492fd){if(_0x3d4b4f[_0x8b68('0x40')]&&_0x3d4b4f[_0x8b68('0x40')]['id']){try{if(_0x509033['agents'][_0x3d4b4f[_0x8b68('0x40')]['id']]){_0x509033[_0x8b68('0x41')][_0x3d4b4f[_0x8b68('0x40')]['id']]['busy']=![];_0x509033[_0x8b68('0x41')][_0x3d4b4f['agent']['id']][_0x8b68('0x46')]=undefined;}return _0x5a1711({'code':0xc8,'message':_0x3d4b4f});}catch(_0x3efb0e){logger['error'](_0x3efb0e[_0x8b68('0x3e')]);return _0x4492fd(_0x55aad3[_0x8b68('0x35')](0x1f4,_0x3efb0e));}}logger[_0x8b68('0x35')](_0x8b68('0x45'));return _0x4492fd(_0x55aad3[_0x8b68('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x241166){var _0x3f3e43=this;return new Promise(function(_0x32cd05,_0x31a090){if(_0x241166[_0x8b68('0x15')]&&_0x241166[_0x8b68('0x17')]&&_0x241166[_0x8b68('0x17')]['id']){try{var _0x3096b3=getId(_0x241166['channel'],_0x241166[_0x8b68('0x16')]?_0x241166[_0x8b68('0x16')]['id']:0x0,_0x241166[_0x8b68('0x17')]?_0x241166[_0x8b68('0x17')]['id']:0x0);if(_0x509033[_0x8b68('0x38')][_0x3096b3]){_0x509033[_0x8b68('0x38')][_0x3096b3][_0x8b68('0x3b')](_0x8b68('0x42'));}return _0x32cd05({'code':0xc8,'message':_0x241166});}catch(_0x6d63cb){logger[_0x8b68('0x35')](_0x6d63cb[_0x8b68('0x3e')]);return _0x31a090(_0x3f3e43[_0x8b68('0x35')](0x1f4,_0x6d63cb));}}logger[_0x8b68('0x35')](_0x8b68('0x45'));return _0x31a090(_0x3f3e43[_0x8b68('0x35')](0x1f4,_0x8b68('0x45')));});},'AgentCapacity':function(_0xf07a90){var _0x3da7b4=this;return new Promise(function(_0xae90f0,_0x1de9ce){if(_0x509033['agents'][_0x8b68('0x47')](_0xf07a90['id'])){for(var _0x51e17b in _0xf07a90['capacity']){if(_0xf07a90[_0x8b68('0x48')]['hasOwnProperty'](_0x51e17b)){if(_0x509033[_0x8b68('0x41')][_0xf07a90['id']][_0x8b68('0x47')](_0x51e17b+_0x8b68('0x49'))){_0x509033['agents'][_0xf07a90['id']][_0x51e17b+_0x8b68('0x49')]=parseInt(_0xf07a90[_0x8b68('0x48')][_0x51e17b],0xa);}}}_0x509033[_0x8b68('0x41')][_0xf07a90['id']][_0x8b68('0x4a')]();return _0xae90f0({'code':0xc8,'message':_0x509033[_0x8b68('0x41')][_0xf07a90['id']]});}else{return _0x1de9ce(_0x3da7b4[_0x8b68('0x35')](0x1f4,_0x8b68('0x4b')));}});},'Agents':function(_0x4f0aff){return new Promise(function(_0x586a5e,_0x20aac1){var _0x4224f5=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x41')]);_0x586a5e({'count':_0x4224f5[_0x8b68('0x1a')],'rows':_0x4224f5});});},'ChatQueues':function(_0x37da34){return new Promise(function(_0x2d1519,_0x314f1e){var _0x3bf22b=[];for(var _0x36d47a in _0x509033[_0x8b68('0x4d')]){if(_0x509033[_0x8b68('0x4d')][_0x8b68('0x47')](_0x36d47a)){var _0x195f82=_0x509033[_0x8b68('0x4d')][_0x36d47a];var _0x414096={'id':_0x195f82['id'],'available':_0x195f82[_0x8b68('0x4e')],'loggedIn':_0x195f82[_0x8b68('0x4f')],'name':_0x195f82['name'],'paused':_0x195f82['paused'],'waiting':_0x195f82[_0x8b68('0x50')]};_0x3bf22b[_0x8b68('0x21')](_0x414096);}}_0x2d1519({'count':_0x3bf22b['length'],'rows':_0x3bf22b});});},'MailQueues':function(_0x48d57a){return new Promise(function(_0x574aca,_0x39a04e){var _0x3d6c17=[];for(var _0xd5f52e in _0x509033[_0x8b68('0x51')]){if(_0x509033[_0x8b68('0x51')]['hasOwnProperty'](_0xd5f52e)){var _0x1c358b=_0x509033[_0x8b68('0x51')][_0xd5f52e];var _0x5c24f8={'id':_0x1c358b['id'],'available':_0x1c358b[_0x8b68('0x4e')],'loggedIn':_0x1c358b['loggedIn'],'name':_0x1c358b['name'],'paused':_0x1c358b['paused'],'waiting':_0x1c358b[_0x8b68('0x50')]};_0x3d6c17[_0x8b68('0x21')](_0x5c24f8);}}_0x574aca({'count':_0x3d6c17[_0x8b68('0x1a')],'rows':_0x3d6c17});});},'OpenchannelQueues':function(_0x7269fd){return new Promise(function(_0x864b6b,_0x1fc24c){var _0x35b22b=[];for(var _0x34456d in _0x509033[_0x8b68('0x52')]){if(_0x509033[_0x8b68('0x52')]['hasOwnProperty'](_0x34456d)){var _0x3a8d15=_0x509033[_0x8b68('0x52')][_0x34456d];var _0x310ec9={'id':_0x3a8d15['id'],'available':_0x3a8d15['available'],'loggedIn':_0x3a8d15['loggedIn'],'name':_0x3a8d15[_0x8b68('0x53')],'paused':_0x3a8d15[_0x8b68('0x54')],'waiting':_0x3a8d15['waiting']};_0x35b22b[_0x8b68('0x21')](_0x310ec9);}}_0x864b6b({'count':_0x35b22b[_0x8b68('0x1a')],'rows':_0x35b22b});});},'SmsQueues':function(_0x29bff7){return new Promise(function(_0x2c2f6d,_0x50fd2c){var _0x96e526=[];for(var _0x4925a4 in _0x509033['smsQueues']){if(_0x509033[_0x8b68('0x55')]['hasOwnProperty'](_0x4925a4)){var _0xe9550=_0x509033[_0x8b68('0x55')][_0x4925a4];var _0x5e40f4={'id':_0xe9550['id'],'available':_0xe9550[_0x8b68('0x4e')],'loggedIn':_0xe9550[_0x8b68('0x4f')],'name':_0xe9550[_0x8b68('0x53')],'paused':_0xe9550[_0x8b68('0x54')],'waiting':_0xe9550[_0x8b68('0x50')]};_0x96e526['push'](_0x5e40f4);}}_0x2c2f6d({'count':_0x96e526[_0x8b68('0x1a')],'rows':_0x96e526});});},'FaxQueues':function(_0x2e6daf){return new Promise(function(_0xa0ed41,_0x2f87e8){var _0x34c7d8=[];for(var _0x49efb7 in _0x509033['faxQueues']){if(_0x509033[_0x8b68('0x56')]['hasOwnProperty'](_0x49efb7)){var _0x2d442a=_0x509033[_0x8b68('0x56')][_0x49efb7];var _0x16e769={'id':_0x2d442a['id'],'available':_0x2d442a[_0x8b68('0x4e')],'loggedIn':_0x2d442a[_0x8b68('0x4f')],'name':_0x2d442a[_0x8b68('0x53')],'paused':_0x2d442a[_0x8b68('0x54')],'waiting':_0x2d442a['waiting']};_0x34c7d8[_0x8b68('0x21')](_0x16e769);}}_0xa0ed41({'count':_0x34c7d8['length'],'rows':_0x34c7d8});});},'WhatsappQueues':function(_0x3aaaed){return new Promise(function(_0x2caa28,_0xc8c3c){var _0x4e0fb4=[];for(var _0x3141d3 in _0x509033['whatsappQueues']){if(_0x509033[_0x8b68('0x57')]['hasOwnProperty'](_0x3141d3)){var _0x3da555=_0x509033[_0x8b68('0x57')][_0x3141d3];var _0x644d83={'id':_0x3da555['id'],'available':_0x3da555['available'],'loggedIn':_0x3da555[_0x8b68('0x4f')],'name':_0x3da555[_0x8b68('0x53')],'paused':_0x3da555[_0x8b68('0x54')],'waiting':_0x3da555[_0x8b68('0x50')]};_0x4e0fb4[_0x8b68('0x21')](_0x644d83);}}_0x2caa28({'count':_0x4e0fb4[_0x8b68('0x1a')],'rows':_0x4e0fb4});});},'ChatQueuesWaitingInteractions':function(_0x33a02f){return new Promise(function(_0x3ae1f8,_0x395b82){var _0x5a807b=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x58')]);_0x3ae1f8({'count':_0x5a807b[_0x8b68('0x1a')],'rows':_0x5a807b});});},'MailQueuesWaitingInteractions':function(_0x1e4c28){return new Promise(function(_0x71095b,_0x543468){var _0x3dfd43=_['values'](_0x509033[_0x8b68('0x59')]);_0x71095b({'count':_0x3dfd43[_0x8b68('0x1a')],'rows':_0x3dfd43});});},'OpenchannelQueuesWaitingInteractions':function(_0x524763){return new Promise(function(_0x20c8b4,_0x75af51){var _0xa7890f=_['values'](_0x509033[_0x8b68('0x5a')]);_0x20c8b4({'count':_0xa7890f[_0x8b68('0x1a')],'rows':_0xa7890f});});},'SmsQueuesWaitingInteractions':function(_0x43a874){return new Promise(function(_0x3b260a,_0x115cb7){var _0x42464c=_['values'](_0x509033[_0x8b68('0x5b')]);_0x3b260a({'count':_0x42464c[_0x8b68('0x1a')],'rows':_0x42464c});});},'FaxQueuesWaitingInteractions':function(_0x3d38eb){return new Promise(function(_0x4e5d13,_0x45e75f){var _0xde4083=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x5c')]);_0x4e5d13({'count':_0xde4083[_0x8b68('0x1a')],'rows':_0xde4083});});},'WhatsappQueuesWaitingInteractions':function(_0x377045){return new Promise(function(_0x320f42,_0x4e49ec){var _0x23cc54=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x5d')]);_0x320f42({'count':_0x23cc54['length'],'rows':_0x23cc54});});}};var _0x570629=jayson[_0x8b68('0x5e')](_0x27d717)[_0x8b68('0x5f')]();_0x570629['on'](_0x8b68('0x35'),function(_0x131a30){logger[_0x8b68('0x35')](JSON['stringify'](_0x131a30));return _0x1554d6(_0x131a30);});_0x570629[_0x8b68('0x14')](0x232c,_0x8b68('0x60'),function(){console[_0x8b68('0x61')](_0x8b68('0x62'),0x232c);return _0x22f75b('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 663cc85..22761ad 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 _0xecf3=['result','condition','rules','stop','length','push','Command','iftime\x20%s','then','true','catch','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','jayson/promise','lodash','../../../config/logger','routing','request','error','message'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0xecf3,0xa8));var _0x3ecf=function(_0x3ac050,_0x37324b){_0x3ac050=_0x3ac050-0x0;var _0x8b98bd=_0xecf3[_0x3ac050];return _0x8b98bd;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x3ecf('0x0'));var _=require(_0x3ecf('0x1'));var logger=require(_0x3ecf('0x2'))(_0x3ecf('0x3'));var client=jayson['client']['http']({'port':0x232a});function request(_0x47c5b8,_0x1e563d){return new BPromise(function(_0x4f915d,_0x4739ab){return client[_0x3ecf('0x4')](_0x47c5b8,_0x1e563d)['then'](function(_0x25599e){if(_0x25599e[_0x3ecf('0x5')]){return _0x4739ab(_0x25599e[_0x3ecf('0x5')][_0x3ecf('0x6')]);}else{return _0x4f915d(_0x25599e[_0x3ecf('0x7')]);}})['catch'](function(_0x27328d){return _0x4739ab(_0x27328d);});});}exports[_0x3ecf('0x8')]=function(_0x3860cb,_0x28f776,_0x2717c6){return function(_0x455565){if(_0x2717c6[_0x3ecf('0x9')]&&!_0x2717c6[_0x3ecf('0x9')][_0x3860cb]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x3860cb);return _0x455565[_0x3ecf('0xa')]();}var _0x55c1c9=[];for(var _0x834dc1=0x0;_0x834dc1<_0x28f776[_0x3ecf('0xb')];_0x834dc1+=0x1){_0x55c1c9[_0x3ecf('0xc')](request(_0x3ecf('0xd'),{'command':util['format'](_0x3ecf('0xe'),_0x28f776[_0x834dc1])})[_0x3ecf('0xf')](function(_0xd0e252){return _0xd0e252&&_0xd0e252['message']&&_0xd0e252[_0x3ecf('0x6')]['indexOf'](_0x3ecf('0x10'))>=0x0?!![]:![];})[_0x3ecf('0x11')](function(_0x30b66c){logger[_0x3ecf('0x5')](_0x3ecf('0x12'),_0x3860cb,_0x28f776[_0x834dc1]);}));}BPromise['all'](_0x55c1c9)['then'](function(_0x30bc63){var _0x24037c=_[_0x3ecf('0x13')](_0x30bc63);logger['info'](_0x3ecf('0x14'),_0x3860cb,_0x28f776[_0x3ecf('0x15')]('\x20|\x20'),_0x24037c);_0x455565[_0x3ecf('0x16')](_0x24037c);})[_0x3ecf('0x11')](function(_0xda8b87){console['log'](_0xda8b87);logger['error'](_0x3ecf('0x14'),_0x3860cb,_0x28f776['join'](_0x3ecf('0x17')),_0xda8b87[_0x3ecf('0x18')]);_0x455565[_0x3ecf('0xa')]();});};}; \ No newline at end of file +var _0xb59c=['client','http','request','error','message','result','catch','condition','rules','stop','length','push','format','iftime\x20%s','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','stack','util','../../../config/logger','routing'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xb59c,0xbd));var _0xcb59=function(_0x4449e4,_0x4c63ca){_0x4449e4=_0x4449e4-0x0;var _0x5a23d9=_0xb59c[_0x4449e4];return _0x5a23d9;};'use strict';var util=require(_0xcb59('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xcb59('0x1'))(_0xcb59('0x2'));var client=jayson[_0xcb59('0x3')][_0xcb59('0x4')]({'port':0x232a});function request(_0x56920a,_0x3c139c){return new BPromise(function(_0xa253bc,_0x7a3ad4){return client[_0xcb59('0x5')](_0x56920a,_0x3c139c)['then'](function(_0x41446b){if(_0x41446b[_0xcb59('0x6')]){return _0x7a3ad4(_0x41446b[_0xcb59('0x6')][_0xcb59('0x7')]);}else{return _0xa253bc(_0x41446b[_0xcb59('0x8')]);}})[_0xcb59('0x9')](function(_0x2ca799){return _0x7a3ad4(_0x2ca799);});});}exports[_0xcb59('0xa')]=function(_0x5129ec,_0x17a00c,_0x2cc407){return function(_0x58c08a){if(_0x2cc407[_0xcb59('0xb')]&&!_0x2cc407[_0xcb59('0xb')][_0x5129ec]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5129ec);return _0x58c08a[_0xcb59('0xc')]();}var _0x46720b=[];for(var _0x15baaf=0x0;_0x15baaf<_0x17a00c[_0xcb59('0xd')];_0x15baaf+=0x1){_0x46720b[_0xcb59('0xe')](request('Command',{'command':util[_0xcb59('0xf')](_0xcb59('0x10'),_0x17a00c[_0x15baaf])})['then'](function(_0x399532){return _0x399532&&_0x399532[_0xcb59('0x7')]&&_0x399532['message']['indexOf']('true')>=0x0?!![]:![];})[_0xcb59('0x9')](function(_0x12fe45){logger['error'](_0xcb59('0x11'),_0x5129ec,_0x17a00c[_0x15baaf]);}));}BPromise[_0xcb59('0x12')](_0x46720b)['then'](function(_0x214624){var _0x27abab=_['some'](_0x214624);logger['info'](_0xcb59('0x13'),_0x5129ec,_0x17a00c['join'](_0xcb59('0x14')),_0x27abab);_0x58c08a[_0xcb59('0x15')](_0x27abab);})[_0xcb59('0x9')](function(_0x3ee8d5){console[_0xcb59('0x16')](_0x3ee8d5);logger[_0xcb59('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x5129ec,_0x17a00c['join'](_0xcb59('0x14')),_0x3ee8d5[_0xcb59('0x17')]);_0x58c08a[_0xcb59('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7058a08..2ac717b 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 _0x0bb5=['called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','now','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','timeout','cause','rejected','indexOf','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt'];(function(_0x29c6fc,_0x462633){var _0x1406ab=function(_0x2ab3d8){while(--_0x2ab3d8){_0x29c6fc['push'](_0x29c6fc['shift']());}};_0x1406ab(++_0x462633);}(_0x0bb5,0x148));var _0x50bb=function(_0x3f893c,_0x460125){_0x3f893c=_0x3f893c-0x0;var _0x492443=_0x0bb5[_0x3f893c];return _0x492443;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5a12b6,_0x348380){utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x4'),_0x5a12b6[_0x50bb('0x5')],_0x5a12b6[_0x50bb('0x6')],_0x5a12b6[_0x50bb('0x7')],_0x5a12b6[_0x50bb('0x8')],_0x5a12b6['interface'],_0x5a12b6['calleridnum'],_0x5a12b6[_0x50bb('0x9')],_0x5a12b6[_0x50bb('0xa')]));if(_0x5a12b6[_0x50bb('0x7')]){utils[_0x50bb('0xb')](_0x5a12b6['queue'])['then'](function(_0x2bede8){if(_0x2bede8){_0x5a12b6[_0x50bb('0xc')]=_0x2bede8[_0x50bb('0xc')];_0x5a12b6[_0x50bb('0xd')]=_0x5a12b6['agentcomplete']?_0x2bede8[_0x50bb('0xe')]:![];_0x5a12b6[_0x50bb('0xf')]=_0x5a12b6[_0x50bb('0xd')]?_0x2bede8[_0x50bb('0x10')]:0x0;}utils[_0x50bb('0x11')](_0x50bb('0x12'),_0x5a12b6);});}else{utils[_0x50bb('0x11')]('CreateVoiceAgentReport',_0x5a12b6);}if(_0x348380){delete transfers[_0x5a12b6[_0x50bb('0x5')]];}else{delete agents[_0x5a12b6['destuniqueid']];}}exports[_0x50bb('0x13')]=function(_0xd8ab27){try{utils[_0x50bb('0x14')](util['format'](_0x50bb('0x15'),_0xd8ab27[_0x50bb('0x5')]),_0xd8ab27);agents[_0xd8ab27[_0x50bb('0x16')]]=_0xd8ab27;agents[_0xd8ab27['destuniqueid']][_0x50bb('0x17')]=utils['now']();agents[_0xd8ab27[_0x50bb('0x16')]][_0x50bb('0xa')]=_0x50bb('0x18');agents[_0xd8ab27[_0x50bb('0x16')]][_0x50bb('0x9')]=null;agents[_0xd8ab27['destuniqueid']][_0x50bb('0x19')]=null;utils[_0x50bb('0x2')](util['format'](_0x50bb('0x1a'),_0xd8ab27['uniqueid'],agents[_0xd8ab27[_0x50bb('0x16')]][_0x50bb('0x8')],_0xd8ab27['destuniqueid']));}catch(_0x4f1c0a){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x15'),_0xd8ab27[_0x50bb('0x5')]),_0x4f1c0a);}};exports['agentringnoanswer']=function(_0x19dc5d){try{if(!_[_0x50bb('0x1c')](agents[_0x19dc5d[_0x50bb('0x16')]])){utils['debug'](util[_0x50bb('0x3')](_0x50bb('0x1d'),_0x19dc5d[_0x50bb('0x5')]),_0x19dc5d);utils['info'](util[_0x50bb('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x19dc5d[_0x50bb('0x5')],agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0x8')],_0x19dc5d[_0x50bb('0x16')]));agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0x1e')]=!![];agents[_0x19dc5d['destuniqueid']][_0x50bb('0x1f')]=utils[_0x50bb('0x20')]();agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0xa')]='timeout';agents[_0x19dc5d[_0x50bb('0x16')]]['reason']='timeout';agents[_0x19dc5d[_0x50bb('0x16')]]['holdtime']=_0x19dc5d['ringtime']?parseInt(_0x19dc5d[_0x50bb('0x21')])/0x3e8:0x0;agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0x22')]=0x0;unanswered[_0x50bb('0x23')](_0x19dc5d[_0x50bb('0x16')]);}}catch(_0x269479){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')]('[%s][agents][agentringnoanswer]',_0x19dc5d[_0x50bb('0x5')]),_0x269479);}};exports[_0x50bb('0x24')]=function(_0x15ee2e){try{_[_0x50bb('0x25')](agents,function(_0x560b07,_0x13dc3c){if(_0x560b07[_0x50bb('0x5')]==_0x15ee2e[_0x50bb('0x5')]&&!_[_0x50bb('0x26')](unanswered,_0x560b07[_0x50bb('0x16')])){utils[_0x50bb('0x14')](util[_0x50bb('0x3')](_0x50bb('0x27'),_0x15ee2e[_0x50bb('0x5')]),_0x15ee2e);utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x28'),_0x15ee2e['uniqueid'],_0x560b07[_0x50bb('0x8')],_0x560b07[_0x50bb('0x16')]));_0x560b07[_0x50bb('0x1e')]=!![];_0x560b07[_0x50bb('0x1f')]=utils[_0x50bb('0x20')]();_0x560b07[_0x50bb('0xa')]=_0x50bb('0x29');_0x560b07[_0x50bb('0x2a')]=_0x50bb('0x29');_0x560b07[_0x50bb('0x2b')]=_0x15ee2e[_0x50bb('0x2b')];_0x560b07['talktime']=0x0;writeDB(_0x560b07);}});}catch(_0x364ea0){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x27'),_0x15ee2e[_0x50bb('0x5')]),_0x364ea0);}};exports[_0x50bb('0x2c')]=function(_0x53600a){try{if(agents[_0x53600a['destuniqueid']]){utils[_0x50bb('0x14')](util['format'](_0x50bb('0x2d'),_0x53600a[_0x50bb('0x5')]),_0x53600a);utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x2e'),_0x53600a['uniqueid'],agents[_0x53600a[_0x50bb('0x16')]]['membername'],_0x53600a[_0x50bb('0x16')]));agents[_0x53600a[_0x50bb('0x16')]][_0x50bb('0x2f')]=utils['now']();agents[_0x53600a['destuniqueid']][_0x50bb('0x9')]=_0x53600a[_0x50bb('0x9')];agents[_0x53600a[_0x50bb('0x16')]][_0x50bb('0x19')]=_0x53600a['connectedlinename'];agents[_0x53600a[_0x50bb('0x16')]]['holdtime']=_0x53600a['ringtime'];agents[_0x53600a[_0x50bb('0x16')]]['lastevent']=_0x50bb('0x30');_[_0x50bb('0x25')](agents,function(_0x1ef231,_0x1f156e){if(_0x1ef231[_0x50bb('0x16')]!=_0x53600a[_0x50bb('0x16')]&&_0x1ef231[_0x50bb('0x5')]==_0x53600a[_0x50bb('0x5')]){_0x1ef231[_0x50bb('0x22')]=0x0;_0x1ef231[_0x50bb('0x2b')]=_0x53600a['ringtime'];_0x1ef231['agentringnoanswer']=!![];_0x1ef231[_0x50bb('0x1f')]=utils[_0x50bb('0x20')]();_0x1ef231[_0x50bb('0xa')]=_0x50bb('0x31');_0x1ef231['reason']=_0x50bb('0x31');_0x1ef231['answeredelsewheredestinationuniqueid']=_0x53600a[_0x50bb('0x16')];_0x1ef231[_0x50bb('0x32')]=_0x53600a[_0x50bb('0x8')];writeDB(_0x1ef231);}});}}catch(_0x40748d){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x2d'),_0x53600a[_0x50bb('0x5')]),_0x40748d);}};exports[_0x50bb('0x33')]=function(_0x46c1c3){try{if(!_[_0x50bb('0x1c')](agents[_0x46c1c3[_0x50bb('0x16')]])){utils[_0x50bb('0x14')](util[_0x50bb('0x3')](_0x50bb('0x34'),_0x46c1c3[_0x50bb('0x5')]),_0x46c1c3);utils['info'](util[_0x50bb('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x46c1c3[_0x50bb('0x5')],agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x8')],_0x46c1c3[_0x50bb('0x16')]));agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x33')]=!![];agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x35')]=utils[_0x50bb('0x20')]();agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x22')]=utils[_0x50bb('0x36')](agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x35')],agents[_0x46c1c3['destuniqueid']][_0x50bb('0x2f')]);agents[_0x46c1c3['destuniqueid']][_0x50bb('0x2a')]=_0x46c1c3[_0x50bb('0x2a')];agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0xa')]=_0x50bb('0x37');writeDB(agents[_0x46c1c3[_0x50bb('0x16')]]);}}catch(_0x133dd9){utils[_0x50bb('0x1b')](util['format'](_0x50bb('0x34'),_0x46c1c3[_0x50bb('0x5')]),_0x133dd9);}};exports[_0x50bb('0x38')]=function(_0x13afe2){try{if(!_[_0x50bb('0x1c')](agents[_0x13afe2['transfereruniqueid']])){utils[_0x50bb('0x14')](util[_0x50bb('0x3')](_0x50bb('0x39'),_0x13afe2[_0x50bb('0x5')]),_0x13afe2);utils[_0x50bb('0x2')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x13afe2[_0x50bb('0x5')],agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x8')],agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x5')]));agents[_0x13afe2[_0x50bb('0x3a')]][_0x50bb('0x3b')]=!![];agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x3c')]=_0x50bb('0x3d');agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x3e')]=_0x13afe2[_0x50bb('0x3f')];agents[_0x13afe2[_0x50bb('0x3a')]][_0x50bb('0x40')]=agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x5')];}}catch(_0x46b51e){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x39'),_0x13afe2['uniqueid']),_0x46b51e);}};exports[_0x50bb('0x41')]=function(_0x50943a){try{utils[_0x50bb('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x50943a[_0x50bb('0x42')]),_0x50943a);if(_0x50943a['origtransfereruniqueid']==_0x50943a['origtransfererlinkedid']){if(!_[_0x50bb('0x1c')](agents[_0x50943a[_0x50bb('0x43')]])){utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x44'),_0x50943a[_0x50bb('0x42')],agents[_0x50943a[_0x50bb('0x43')]][_0x50bb('0x8')]));agents[_0x50943a['secondtransfereruniqueid']]['transfer']=!![];agents[_0x50943a[_0x50bb('0x43')]][_0x50bb('0x3c')]=_0x50bb('0x45');agents[_0x50943a[_0x50bb('0x43')]][_0x50bb('0x3e')]=_0x50943a[_0x50bb('0x46')];agents[_0x50943a[_0x50bb('0x43')]]['transferuniqueid']=_0x50943a[_0x50bb('0x42')];}if(_0x50943a[_0x50bb('0x47')]&&agents[_0x50943a[_0x50bb('0x47')]]){agents[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x48')]=0x1;transfers[_0x50943a['transfereeuniqueid']]=_[_0x50bb('0x49')](agents[_0x50943a[_0x50bb('0x47')]]);transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x4a')]=agents[_0x50943a[_0x50bb('0x43')]]['calleridnum'];transfers[_0x50943a[_0x50bb('0x47')]]['calleridname']=agents[_0x50943a['secondtransfereruniqueid']][_0x50bb('0x4b')];transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x17')]=utils[_0x50bb('0x20')]();transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x2f')]=utils[_0x50bb('0x20')]();transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x2b')]=0x0;transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x48')]=0x2;}}else if(_0x50943a['secondtransfereruniqueid']==_0x50943a[_0x50bb('0x4c')]){if(!_['isNil'](agents[_0x50943a[_0x50bb('0x42')]])){utils[_0x50bb('0x2')](util['format'](_0x50bb('0x44'),_0x50943a[_0x50bb('0x42')],agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x8')]));agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x3b')]=!![];agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x3c')]='ATTENDED';agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x3e')]=_0x50943a[_0x50bb('0x4d')];agents[_0x50943a['origtransfereruniqueid']][_0x50bb('0x40')]=_0x50943a[_0x50bb('0x43')];}if(_0x50943a[_0x50bb('0x4e')]&&agents[_0x50943a[_0x50bb('0x4e')]]){agents[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x48')]=0x1;transfers[_0x50943a['transfertargetuniqueid']]=_[_0x50bb('0x49')](agents[_0x50943a[_0x50bb('0x4e')]]);transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x4a')]=agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x4a')];transfers[_0x50943a['transfertargetuniqueid']][_0x50bb('0x4b')]=agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x4b')];transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x17')]=utils[_0x50bb('0x20')]();transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x2f')]=utils[_0x50bb('0x20')]();transfers[_0x50943a['transfertargetuniqueid']][_0x50bb('0x2b')]=0x0;transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x48')]=0x2;}}}catch(_0x2d2463){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x4f'),_0x50943a[_0x50bb('0x42')]),_0x2d2463);}};exports[_0x50bb('0x50')]=function(_0x578ff3){try{utils['debug'](util['format'](_0x50bb('0x51'),_0x578ff3['uniqueid']),_0x578ff3);if(agents[_0x578ff3['uniqueid']]&&agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2a')]===_0x50bb('0x52')){if(_0x578ff3[_0x50bb('0x53')]==='21'){agents[_0x578ff3['uniqueid']][_0x50bb('0x2a')]=_0x50bb('0x54');agents[_0x578ff3['uniqueid']][_0x50bb('0xa')]='rejected';}utils[_0x50bb('0x2')](util[_0x50bb('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x578ff3[_0x50bb('0x5')],agents[_0x578ff3['uniqueid']][_0x50bb('0x8')],agents[_0x578ff3[_0x50bb('0x5')]]['reason'],agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0xa')]));writeDB(agents[_0x578ff3[_0x50bb('0x5')]]);var _0x51142c=unanswered[_0x50bb('0x55')](_0x578ff3[_0x50bb('0x5')]);if(_0x51142c>-0x1){unanswered[_0x50bb('0x56')](_0x51142c,0x1);}}if(transfers[_0x578ff3[_0x50bb('0x5')]]){transfers[_0x578ff3['uniqueid']][_0x50bb('0x33')]=!![];transfers[_0x578ff3[_0x50bb('0x5')]]['agentcompleteAt']=utils['now']();transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x22')]=utils['diffTime'](transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x35')],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2f')]);transfers[_0x578ff3[_0x50bb('0x5')]]['reason']='agent';transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0xa')]=_0x50bb('0x37');utils[_0x50bb('0x2')](util['format'](_0x50bb('0x57'),_0x578ff3['uniqueid'],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x8')],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2a')],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0xa')]));writeDB(transfers[_0x578ff3[_0x50bb('0x5')]],!![]);}if(agents[_0x578ff3['uniqueid']]&&agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2f')]){agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x33')]=!![];agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x35')]=utils[_0x50bb('0x20')]();agents[_0x578ff3['uniqueid']][_0x50bb('0x22')]=utils[_0x50bb('0x36')](agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x35')],agents[_0x578ff3[_0x50bb('0x5')]]['agentconnectAt']);agents[_0x578ff3['uniqueid']][_0x50bb('0x2a')]=agents[_0x578ff3['uniqueid']][_0x50bb('0x3b')]?_0x50bb('0x3b'):'agent';agents[_0x578ff3['uniqueid']][_0x50bb('0xa')]=_0x50bb('0x37');utils[_0x50bb('0x2')](util['format'](_0x50bb('0x57'),_0x578ff3[_0x50bb('0x5')],agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x8')],agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2a')],agents[_0x578ff3[_0x50bb('0x5')]]['lastevent']));writeDB(agents[_0x578ff3['uniqueid']]);}}catch(_0x28c99d){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x51'),_0x578ff3[_0x50bb('0x5')]),_0x28c99d);}}; \ No newline at end of file +var _0x97c1=['connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','reason','holdtime','ringtime','talktime','push','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','forIn','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','calleridnum','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','called'];(function(_0x2e3b0b,_0x4bfc88){var _0xac080d=function(_0x15cd27){while(--_0x15cd27){_0x2e3b0b['push'](_0x2e3b0b['shift']());}};_0xac080d(++_0x4bfc88);}(_0x97c1,0xdf));var _0x197c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e2e81,_0x498f9c){utils['info'](util[_0x197c('0x2')](_0x197c('0x3'),_0x5e2e81[_0x197c('0x4')],_0x5e2e81[_0x197c('0x5')],_0x5e2e81[_0x197c('0x6')],_0x5e2e81['membername'],_0x5e2e81['interface'],_0x5e2e81[_0x197c('0x7')],_0x5e2e81[_0x197c('0x8')],_0x5e2e81[_0x197c('0x9')]));if(_0x5e2e81[_0x197c('0x6')]){utils['getVoiceQueueByName'](_0x5e2e81['queue'])[_0x197c('0xa')](function(_0x5cffb8){if(_0x5cffb8){_0x5e2e81[_0x197c('0xb')]=_0x5cffb8[_0x197c('0xb')];_0x5e2e81[_0x197c('0xc')]=_0x5e2e81[_0x197c('0xd')]?_0x5cffb8['acw']:![];_0x5e2e81[_0x197c('0xe')]=_0x5e2e81[_0x197c('0xc')]?_0x5cffb8[_0x197c('0xf')]:0x0;}utils[_0x197c('0x10')](_0x197c('0x11'),_0x5e2e81);});}else{utils['request'](_0x197c('0x11'),_0x5e2e81);}if(_0x498f9c){delete transfers[_0x5e2e81[_0x197c('0x4')]];}else{delete agents[_0x5e2e81[_0x197c('0x12')]];}}exports[_0x197c('0x13')]=function(_0x567658){try{utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x15'),_0x567658[_0x197c('0x4')]),_0x567658);agents[_0x567658[_0x197c('0x12')]]=_0x567658;agents[_0x567658[_0x197c('0x12')]]['agentcalledAt']=utils['now']();agents[_0x567658[_0x197c('0x12')]][_0x197c('0x9')]=_0x197c('0x16');agents[_0x567658[_0x197c('0x12')]][_0x197c('0x8')]=null;agents[_0x567658[_0x197c('0x12')]][_0x197c('0x17')]=null;utils[_0x197c('0x18')](util['format'](_0x197c('0x19'),_0x567658['uniqueid'],agents[_0x567658['destuniqueid']][_0x197c('0x1a')],_0x567658[_0x197c('0x12')]));}catch(_0x2eca5e){utils[_0x197c('0x1b')](util['format'](_0x197c('0x15'),_0x567658[_0x197c('0x4')]),_0x2eca5e);}};exports[_0x197c('0x1c')]=function(_0x5c278a){try{if(!_[_0x197c('0x1d')](agents[_0x5c278a[_0x197c('0x12')]])){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x1e'),_0x5c278a[_0x197c('0x4')]),_0x5c278a);utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x1f'),_0x5c278a[_0x197c('0x4')],agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x1a')],_0x5c278a[_0x197c('0x12')]));agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x1c')]=!![];agents[_0x5c278a[_0x197c('0x12')]]['agentringnoanswerAt']=utils[_0x197c('0x20')]();agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x9')]='timeout';agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x21')]='timeout';agents[_0x5c278a['destuniqueid']][_0x197c('0x22')]=_0x5c278a['ringtime']?parseInt(_0x5c278a[_0x197c('0x23')])/0x3e8:0x0;agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x24')]=0x0;unanswered[_0x197c('0x25')](_0x5c278a[_0x197c('0x12')]);}}catch(_0x3cdcd8){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x1e'),_0x5c278a['uniqueid']),_0x3cdcd8);}};exports['queuecallerabandon']=function(_0x574274){try{_['forIn'](agents,function(_0x5f7425,_0x4c9256){if(_0x5f7425[_0x197c('0x4')]==_0x574274[_0x197c('0x4')]&&!_['includes'](unanswered,_0x5f7425[_0x197c('0x12')])){utils['debug'](util[_0x197c('0x2')](_0x197c('0x26'),_0x574274[_0x197c('0x4')]),_0x574274);utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x27'),_0x574274[_0x197c('0x4')],_0x5f7425[_0x197c('0x1a')],_0x5f7425[_0x197c('0x12')]));_0x5f7425['agentringnoanswer']=!![];_0x5f7425['agentringnoanswerAt']=utils[_0x197c('0x20')]();_0x5f7425[_0x197c('0x9')]=_0x197c('0x28');_0x5f7425[_0x197c('0x21')]=_0x197c('0x28');_0x5f7425[_0x197c('0x22')]=_0x574274[_0x197c('0x22')];_0x5f7425['talktime']=0x0;writeDB(_0x5f7425);}});}catch(_0x54e6be){utils[_0x197c('0x1b')](util[_0x197c('0x2')]('[%s][agents][queuecallerabandon]',_0x574274['uniqueid']),_0x54e6be);}};exports[_0x197c('0x29')]=function(_0x2a884b){try{if(agents[_0x2a884b[_0x197c('0x12')]]){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x2a'),_0x2a884b[_0x197c('0x4')]),_0x2a884b);utils[_0x197c('0x18')](util[_0x197c('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2a884b[_0x197c('0x4')],agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x1a')],_0x2a884b[_0x197c('0x12')]));agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x2b')]=utils['now']();agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x8')]=_0x2a884b[_0x197c('0x8')];agents[_0x2a884b['destuniqueid']][_0x197c('0x17')]=_0x2a884b[_0x197c('0x17')];agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x22')]=_0x2a884b[_0x197c('0x23')];agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x9')]=_0x197c('0x2c');_[_0x197c('0x2d')](agents,function(_0x1dc01b,_0x4a12fc){if(_0x1dc01b[_0x197c('0x12')]!=_0x2a884b[_0x197c('0x12')]&&_0x1dc01b['uniqueid']==_0x2a884b['uniqueid']){_0x1dc01b[_0x197c('0x24')]=0x0;_0x1dc01b[_0x197c('0x22')]=_0x2a884b[_0x197c('0x23')];_0x1dc01b[_0x197c('0x1c')]=!![];_0x1dc01b[_0x197c('0x2e')]=utils['now']();_0x1dc01b[_0x197c('0x9')]=_0x197c('0x2f');_0x1dc01b[_0x197c('0x21')]=_0x197c('0x2f');_0x1dc01b[_0x197c('0x30')]=_0x2a884b['destuniqueid'];_0x1dc01b[_0x197c('0x31')]=_0x2a884b[_0x197c('0x1a')];writeDB(_0x1dc01b);}});}}catch(_0x6d7bda){utils[_0x197c('0x1b')](util[_0x197c('0x2')]('[%s][agents][agentconnect]',_0x2a884b[_0x197c('0x4')]),_0x6d7bda);}};exports[_0x197c('0xd')]=function(_0x3b7fc1){try{if(!_[_0x197c('0x1d')](agents[_0x3b7fc1[_0x197c('0x12')]])){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x32'),_0x3b7fc1[_0x197c('0x4')]),_0x3b7fc1);utils[_0x197c('0x18')](util[_0x197c('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3b7fc1['uniqueid'],agents[_0x3b7fc1['destuniqueid']]['membername'],_0x3b7fc1[_0x197c('0x12')]));agents[_0x3b7fc1[_0x197c('0x12')]]['agentcomplete']=!![];agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x33')]=utils['now']();agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x24')]=utils['diffTime'](agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x33')],agents[_0x3b7fc1['destuniqueid']][_0x197c('0x2b')]);agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x21')]=_0x3b7fc1['reason'];agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x9')]=_0x197c('0x34');writeDB(agents[_0x3b7fc1[_0x197c('0x12')]]);}}catch(_0x53295b){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x32'),_0x3b7fc1['uniqueid']),_0x53295b);}};exports['blindtransfer']=function(_0x3a5089){try{if(!_[_0x197c('0x1d')](agents[_0x3a5089[_0x197c('0x35')]])){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x36'),_0x3a5089['uniqueid']),_0x3a5089);utils[_0x197c('0x18')](util['format'](_0x197c('0x37'),_0x3a5089[_0x197c('0x4')],agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x1a')],agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x4')]));agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x38')]=!![];agents[_0x3a5089['transfereruniqueid']][_0x197c('0x39')]=_0x197c('0x3a');agents[_0x3a5089[_0x197c('0x35')]]['transferexten']=_0x3a5089[_0x197c('0x3b')];agents[_0x3a5089['transfereruniqueid']][_0x197c('0x3c')]=agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x4')];}}catch(_0x22a106){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x36'),_0x3a5089[_0x197c('0x4')]),_0x22a106);}};exports['attendedtransfer']=function(_0x3e3176){try{utils[_0x197c('0x14')](util[_0x197c('0x2')]('[%s][agents][attendedtransfer]',_0x3e3176[_0x197c('0x3d')]),_0x3e3176);if(_0x3e3176[_0x197c('0x3d')]==_0x3e3176[_0x197c('0x3e')]){if(!_[_0x197c('0x1d')](agents[_0x3e3176[_0x197c('0x3f')]])){utils['info'](util['format'](_0x197c('0x40'),_0x3e3176[_0x197c('0x3d')],agents[_0x3e3176[_0x197c('0x3f')]][_0x197c('0x1a')]));agents[_0x3e3176[_0x197c('0x3f')]]['transfer']=!![];agents[_0x3e3176['secondtransfereruniqueid']][_0x197c('0x39')]=_0x197c('0x41');agents[_0x3e3176['secondtransfereruniqueid']][_0x197c('0x42')]=_0x3e3176[_0x197c('0x43')];agents[_0x3e3176[_0x197c('0x3f')]][_0x197c('0x3c')]=_0x3e3176[_0x197c('0x3d')];}if(_0x3e3176[_0x197c('0x44')]&&agents[_0x3e3176['transfereeuniqueid']]){agents[_0x3e3176[_0x197c('0x44')]][_0x197c('0x45')]=0x1;transfers[_0x3e3176['transfereeuniqueid']]=_['clone'](agents[_0x3e3176[_0x197c('0x44')]]);transfers[_0x3e3176['transfereeuniqueid']][_0x197c('0x7')]=agents[_0x3e3176[_0x197c('0x3f')]][_0x197c('0x7')];transfers[_0x3e3176['transfereeuniqueid']][_0x197c('0x46')]=agents[_0x3e3176[_0x197c('0x3f')]]['calleridname'];transfers[_0x3e3176[_0x197c('0x44')]][_0x197c('0x47')]=utils[_0x197c('0x20')]();transfers[_0x3e3176['transfereeuniqueid']][_0x197c('0x2b')]=utils[_0x197c('0x20')]();transfers[_0x3e3176['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x3e3176[_0x197c('0x44')]][_0x197c('0x45')]=0x2;}}else if(_0x3e3176[_0x197c('0x3f')]==_0x3e3176['secondtransfererlinkedid']){if(!_[_0x197c('0x1d')](agents[_0x3e3176[_0x197c('0x3d')]])){utils[_0x197c('0x18')](util['format'](_0x197c('0x40'),_0x3e3176[_0x197c('0x3d')],agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x1a')]));agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x38')]=!![];agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x39')]=_0x197c('0x41');agents[_0x3e3176[_0x197c('0x3d')]]['transferexten']=_0x3e3176[_0x197c('0x48')];agents[_0x3e3176['origtransfereruniqueid']]['transferuniqueid']=_0x3e3176['secondtransfereruniqueid'];}if(_0x3e3176['transfertargetuniqueid']&&agents[_0x3e3176[_0x197c('0x49')]]){agents[_0x3e3176[_0x197c('0x49')]][_0x197c('0x45')]=0x1;transfers[_0x3e3176[_0x197c('0x49')]]=_['clone'](agents[_0x3e3176[_0x197c('0x49')]]);transfers[_0x3e3176['transfertargetuniqueid']][_0x197c('0x7')]=agents[_0x3e3176['origtransfereruniqueid']][_0x197c('0x7')];transfers[_0x3e3176['transfertargetuniqueid']][_0x197c('0x46')]=agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x46')];transfers[_0x3e3176[_0x197c('0x49')]]['agentcalledAt']=utils[_0x197c('0x20')]();transfers[_0x3e3176[_0x197c('0x49')]][_0x197c('0x2b')]=utils['now']();transfers[_0x3e3176[_0x197c('0x49')]][_0x197c('0x22')]=0x0;transfers[_0x3e3176[_0x197c('0x49')]][_0x197c('0x45')]=0x2;}}}catch(_0x5596f3){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x4a'),_0x3e3176[_0x197c('0x3d')]),_0x5596f3);}};exports[_0x197c('0x4b')]=function(_0x342efa){try{utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x4c'),_0x342efa[_0x197c('0x4')]),_0x342efa);if(agents[_0x342efa[_0x197c('0x4')]]&&agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')]==='timeout'){if(_0x342efa['cause']==='21'){agents[_0x342efa['uniqueid']][_0x197c('0x21')]='rejected';agents[_0x342efa[_0x197c('0x4')]]['lastevent']='rejected';}utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x4d'),_0x342efa['uniqueid'],agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x1a')],agents[_0x342efa['uniqueid']][_0x197c('0x21')],agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x9')]));writeDB(agents[_0x342efa[_0x197c('0x4')]]);var _0x54206a=unanswered[_0x197c('0x4e')](_0x342efa['uniqueid']);if(_0x54206a>-0x1){unanswered[_0x197c('0x4f')](_0x54206a,0x1);}}if(transfers[_0x342efa['uniqueid']]){transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0xd')]=!![];transfers[_0x342efa[_0x197c('0x4')]]['agentcompleteAt']=utils[_0x197c('0x20')]();transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x24')]=utils['diffTime'](transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x33')],transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x2b')]);transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')]='agent';transfers[_0x342efa[_0x197c('0x4')]]['lastevent']='complete';utils[_0x197c('0x18')](util[_0x197c('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x342efa[_0x197c('0x4')],transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x1a')],transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')],transfers[_0x342efa['uniqueid']]['lastevent']));writeDB(transfers[_0x342efa['uniqueid']],!![]);}if(agents[_0x342efa['uniqueid']]&&agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x2b')]){agents[_0x342efa['uniqueid']]['agentcomplete']=!![];agents[_0x342efa[_0x197c('0x4')]]['agentcompleteAt']=utils['now']();agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x24')]=utils[_0x197c('0x50')](agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x33')],agents[_0x342efa[_0x197c('0x4')]]['agentconnectAt']);agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')]=agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x38')]?_0x197c('0x38'):_0x197c('0x51');agents[_0x342efa[_0x197c('0x4')]]['lastevent']=_0x197c('0x34');utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x4d'),_0x342efa[_0x197c('0x4')],agents[_0x342efa[_0x197c('0x4')]]['membername'],agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')],agents[_0x342efa['uniqueid']][_0x197c('0x9')]));writeDB(agents[_0x342efa[_0x197c('0x4')]]);}}catch(_0x173303){utils[_0x197c('0x1b')](util[_0x197c('0x2')]('[%s][agents][hangup]',_0x342efa['uniqueid']),_0x173303);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 2c8e54e..00cb27d 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 _0xbd5d=['[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','debug','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','set','cdr','split','substring','lastIndexOf','execif','gotoif','toLowerCase','application','lodash','util','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','recording','newchannel','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','channelstate','hangup','[%s][calls][hangup]','callerid','calleridname'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbd5d,0x118));var _0xdbd5=function(_0x7aed10,_0x4b40d7){_0x7aed10=_0x7aed10-0x0;var _0x3e224e=_0xbd5d[_0x7aed10];return _0x3e224e;};'use strict';var _=require(_0xdbd5('0x0'));var util=require(_0xdbd5('0x1'));var utils=require('./utils');var transfers=require(_0xdbd5('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0xdbd5('0x3'),_0xdbd5('0x4'),_0xdbd5('0x4'),_0xdbd5('0x4'),_0xdbd5('0x5'),_0xdbd5('0x6'),_0xdbd5('0x3'),_0xdbd5('0x3'),_0xdbd5('0x3')];var channels={};function writeDB(_0xc2b019){var _0x26ef60;if(transfers[_0xdbd5('0x7')][_0xc2b019[_0xdbd5('0x8')]]){_0x26ef60=_0xc2b019[_0xdbd5('0x8')];_0xc2b019[_0xdbd5('0x8')]=transfers[_0xdbd5('0x7')][_0xc2b019['uniqueid']][_0xdbd5('0x9')];}utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')](_0xdbd5('0xc'),_0xc2b019[_0xdbd5('0x8')],_0xc2b019['channel'],_0xc2b019['queue'],_0xc2b019[_0xdbd5('0xd')],_0xc2b019['interface'],_0xc2b019[_0xdbd5('0xe')],_0xc2b019[_0xdbd5('0xf')],_0xc2b019[_0xdbd5('0x10')]));if(_0xc2b019[_0xdbd5('0x11')]){utils['getUserByInternal'](_0xc2b019['accountcode'])[_0xdbd5('0x12')](function(_0x5cca87){if(_0x5cca87){_0xc2b019[_0xdbd5('0x13')]=_0x5cca87['id'];}utils[_0xdbd5('0x14')](_0xdbd5('0x15'),_0xc2b019);});}else{utils[_0xdbd5('0x14')](_0xdbd5('0x15'),_0xc2b019);}if(channels[_0xc2b019['uniqueid']]){delete channels[_0xc2b019['uniqueid']];}else if(_0x26ef60&&channels[_0x26ef60]){if(!transfers[_0xdbd5('0x7')][_0x26ef60][_0xdbd5('0x16')])delete transfers['blinds'][_0x26ef60];delete channels[_0x26ef60];}}exports[_0xdbd5('0x17')]=function(_0x13b367){try{utils['debug'](util[_0xdbd5('0xb')](_0xdbd5('0x18'),_0x13b367[_0xdbd5('0x8')]),_0x13b367);if(_0x13b367[_0xdbd5('0x8')]==_0x13b367[_0xdbd5('0x19')]&&_0x13b367[_0xdbd5('0x1a')]!=_0xdbd5('0x1b')){utils['info'](util[_0xdbd5('0xb')](_0xdbd5('0x1c'),_0x13b367[_0xdbd5('0x8')],_0x13b367['context'],_0x13b367[_0xdbd5('0x1d')]));channels[_0x13b367['uniqueid']]={'uniqueid':_0x13b367[_0xdbd5('0x8')],'accountcode':_0x13b367[_0xdbd5('0x11')],'source':_0x13b367[_0xdbd5('0xe')],'destination':_0x13b367[_0xdbd5('0x1d')],'destinationcontext':_0x13b367['context'],'channel':_0x13b367[_0xdbd5('0x1a')],'starttime':utils[_0xdbd5('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xdbd5('0x1f')};}}catch(_0x2d1b37){utils[_0xdbd5('0x20')](util[_0xdbd5('0xb')]('[%s][calls][newchannel]',_0x13b367['uniqueid']),_0x2d1b37);}};exports['newstate']=function(_0x1cc80e){try{utils['debug'](util[_0xdbd5('0xb')]('[%s][calls][newstate]',_0x1cc80e[_0xdbd5('0x8')]),_0x1cc80e);if(!_['isNil'](channels[_0x1cc80e[_0xdbd5('0x8')]])&&_0x1cc80e['channelstate']==0x6){utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')](_0xdbd5('0x21'),_0x1cc80e[_0xdbd5('0x8')],_0x1cc80e[_0xdbd5('0x22')],_0x1cc80e[_0xdbd5('0x1a')]));if(_[_0xdbd5('0x23')](channels[_0x1cc80e[_0xdbd5('0x8')]][_0xdbd5('0x24')])){channels[_0x1cc80e[_0xdbd5('0x8')]][_0xdbd5('0x24')]=utils[_0xdbd5('0x1e')]();}}else if(!_[_0xdbd5('0x23')](channels[_0x1cc80e[_0xdbd5('0x19')]])&&_0x1cc80e['channelstate']==0x6&&_0x1cc80e['context']!=_0xdbd5('0x25')){utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')](_0xdbd5('0x26'),_0x1cc80e[_0xdbd5('0x8')],_0x1cc80e[_0xdbd5('0x19')],_0x1cc80e[_0xdbd5('0x22')],_0x1cc80e[_0xdbd5('0x1a')]));channels[_0x1cc80e[_0xdbd5('0x19')]][_0xdbd5('0x11')]=_0x1cc80e[_0xdbd5('0x11')];channels[_0x1cc80e[_0xdbd5('0x19')]][_0xdbd5('0x27')]=_0x1cc80e['channel'];if(_['isNil'](channels[_0x1cc80e[_0xdbd5('0x19')]][_0xdbd5('0x28')])){channels[_0x1cc80e['linkedid']]['answertime']=utils[_0xdbd5('0x1e')]();}channels[_0x1cc80e[_0xdbd5('0x19')]]['disposition']=dispositions[_[_0xdbd5('0x29')](_0x1cc80e[_0xdbd5('0x2a')])]||'ANSWERED';}}catch(_0x12436c){utils[_0xdbd5('0x20')](util[_0xdbd5('0xb')]('[%s][calls][newstate]',_0x1cc80e[_0xdbd5('0x8')]),_0x12436c);}};exports[_0xdbd5('0x2b')]=function(_0x5bdb13){try{if(!_[_0xdbd5('0x23')](channels[_0x5bdb13[_0xdbd5('0x8')]])){utils['debug'](util['format'](_0xdbd5('0x2c'),_0x5bdb13['uniqueid']),_0x5bdb13);if(_[_0xdbd5('0x23')](channels[_0x5bdb13[_0xdbd5('0x8')]][_0xdbd5('0x2d')])){channels[_0x5bdb13[_0xdbd5('0x8')]]['callerid']=_0x5bdb13[_0xdbd5('0x2e')]+'\x20<'+_0x5bdb13['calleridnum']+'>';}utils['info'](util[_0xdbd5('0xb')](_0xdbd5('0x2f'),_0x5bdb13['uniqueid'],channels[_0x5bdb13[_0xdbd5('0x8')]][_0xdbd5('0x2d')],_0x5bdb13['cause-txt']));channels[_0x5bdb13[_0xdbd5('0x8')]][_0xdbd5('0x30')]=utils[_0xdbd5('0x1e')]();channels[_0x5bdb13[_0xdbd5('0x8')]][_0xdbd5('0x31')]=utils[_0xdbd5('0x32')](channels[_0x5bdb13[_0xdbd5('0x8')]][_0xdbd5('0x30')],channels[_0x5bdb13[_0xdbd5('0x8')]][_0xdbd5('0x33')]);channels[_0x5bdb13[_0xdbd5('0x8')]]['billableseconds']=channels[_0x5bdb13['uniqueid']]['answertime']?utils[_0xdbd5('0x32')](channels[_0x5bdb13[_0xdbd5('0x8')]][_0xdbd5('0x30')],channels[_0x5bdb13[_0xdbd5('0x8')]]['answertime']):0x0;writeDB(channels[_0x5bdb13['uniqueid']]);}}catch(_0x516ce0){utils[_0xdbd5('0x20')](util['format']('[%s][calls][hangup]',_0x5bdb13[_0xdbd5('0x8')]),_0x516ce0);}};exports[_0xdbd5('0x34')]=function(_0x4f8745){try{if(!_['isNil'](channels[_0x4f8745[_0xdbd5('0x35')]])){utils[_0xdbd5('0x36')](util[_0xdbd5('0xb')](_0xdbd5('0x37'),_0x4f8745[_0xdbd5('0x38')]),_0x4f8745);if(channels[_0x4f8745['localtwolinkedid']][_0xdbd5('0x1a')]==_0x4f8745[_0xdbd5('0x39')]){utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')](_0xdbd5('0x3a'),_0x4f8745[_0xdbd5('0x38')],_0x4f8745['localtwolinkedid'],_0x4f8745[_0xdbd5('0x3b')]));channels[_0x4f8745[_0xdbd5('0x35')]]['destinationchannel']=_0x4f8745[_0xdbd5('0x3b')];channels[_0x4f8745[_0xdbd5('0x35')]][_0xdbd5('0x3c')]=_0xdbd5('0x3d');}else if(channels[_0x4f8745[_0xdbd5('0x35')]]['channel']=_0x4f8745[_0xdbd5('0x3e')]){utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')](_0xdbd5('0x3a'),_0x4f8745[_0xdbd5('0x38')],_0x4f8745[_0xdbd5('0x35')],_0x4f8745[_0xdbd5('0x3f')]));channels[_0x4f8745[_0xdbd5('0x35')]][_0xdbd5('0x27')]=_0x4f8745[_0xdbd5('0x3f')];channels[_0x4f8745[_0xdbd5('0x35')]][_0xdbd5('0x3c')]=_0xdbd5('0x3d');}}}catch(_0x4aac7f){utils[_0xdbd5('0x20')](util['format'](_0xdbd5('0x37'),_0x4f8745[_0xdbd5('0x38')]),_0x4aac7f);}};exports[_0xdbd5('0x40')]=function(_0xd296c4){try{if(!_[_0xdbd5('0x23')](channels[_0xd296c4['uniqueid']])){utils[_0xdbd5('0x36')](util['format'](_0xdbd5('0x41'),_0xd296c4[_0xdbd5('0x8')]),_0xd296c4);channels[_0xd296c4['uniqueid']]['musiconholdstartAt']=utils['now']();utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')](_0xdbd5('0x42'),_0xd296c4['uniqueid'],channels[_0xd296c4[_0xdbd5('0x8')]]['musiconholdstartAt']));}}catch(_0x2202b6){utils[_0xdbd5('0x20')](util[_0xdbd5('0xb')]('[%s][calls][musiconholdstart]',_0xd296c4[_0xdbd5('0x8')]),_0x2202b6);}};exports[_0xdbd5('0x43')]=function(_0x4d80bb){try{if(!_[_0xdbd5('0x23')](channels[_0x4d80bb[_0xdbd5('0x8')]])){utils[_0xdbd5('0x36')](util['format'](_0xdbd5('0x44'),_0x4d80bb[_0xdbd5('0x8')]),_0x4d80bb);if(!_[_0xdbd5('0x23')](channels[_0x4d80bb[_0xdbd5('0x8')]]['musiconholdstartAt'])){channels[_0x4d80bb[_0xdbd5('0x8')]]['mohtime']+=utils[_0xdbd5('0x32')](utils['now'](),channels[_0x4d80bb[_0xdbd5('0x8')]][_0xdbd5('0x45')]);utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')](_0xdbd5('0x46'),_0x4d80bb[_0xdbd5('0x8')],channels[_0x4d80bb[_0xdbd5('0x8')]]['mohtime']));delete channels[_0x4d80bb[_0xdbd5('0x8')]][_0xdbd5('0x45')];}}}catch(_0x48bba8){utils[_0xdbd5('0x20')](util[_0xdbd5('0xb')](_0xdbd5('0x44'),_0x4d80bb[_0xdbd5('0x8')]),_0x48bba8);}};exports[_0xdbd5('0x47')]=function(_0x44caf6){try{if(!_['isNil'](channels[_0x44caf6[_0xdbd5('0x8')]])){utils['debug'](util[_0xdbd5('0xb')]('[%s][calls][varset]',_0x44caf6[_0xdbd5('0x8')]),_0x44caf6);if(!_[_0xdbd5('0x23')](_0x44caf6[_0xdbd5('0x48')][_0xdbd5('0x49')])){utils['info'](util[_0xdbd5('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x44caf6[_0xdbd5('0x8')],_0x44caf6[_0xdbd5('0x4a')]));channels[_0x44caf6['uniqueid']][_0xdbd5('0x4b')]=_0x44caf6[_0xdbd5('0x4a')];}if(!_['isNil'](_0x44caf6[_0xdbd5('0x48')][_0xdbd5('0x4c')])){utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')](_0xdbd5('0x4d'),_0x44caf6[_0xdbd5('0x8')],_0x44caf6[_0xdbd5('0x4a')]));channels[_0x44caf6['uniqueid']][_0xdbd5('0x4e')]=_0x44caf6[_0xdbd5('0x4a')];channels[_0x44caf6[_0xdbd5('0x8')]][_0xdbd5('0x2d')]='\x22'+_0x44caf6[_0xdbd5('0x4a')]+_0xdbd5('0x4f')+_0x44caf6[_0xdbd5('0x4a')]+'>';}if(!_[_0xdbd5('0x23')](_0x44caf6[_0xdbd5('0x48')][_0xdbd5('0x50')])||!_[_0xdbd5('0x23')](_0x44caf6[_0xdbd5('0x48')][_0xdbd5('0x51')])){utils['info'](util[_0xdbd5('0xb')](_0xdbd5('0x52'),_0x44caf6[_0xdbd5('0x8')],!_[_0xdbd5('0x23')](_0x44caf6['variable'][_0xdbd5('0x50')])?_0xdbd5('0x50'):_0xdbd5('0x51'),_0x44caf6['value']));channels[_0x44caf6[_0xdbd5('0x8')]][_0xdbd5('0x2d')]=_0x44caf6[_0xdbd5('0x4a')];}if(!_['isNil'](_0x44caf6[_0xdbd5('0x48')][_0xdbd5('0x53')])||!_[_0xdbd5('0x23')](_0x44caf6['variable'][_0xdbd5('0x54')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x44caf6[_0xdbd5('0x8')],!_[_0xdbd5('0x23')](_0x44caf6['variable']['xmd-queue'])?_0xdbd5('0x53'):_0xdbd5('0x54'),_0x44caf6[_0xdbd5('0x4a')]));channels[_0x44caf6[_0xdbd5('0x8')]][_0xdbd5('0x55')]='Queue';channels[_0x44caf6[_0xdbd5('0x8')]][_0xdbd5('0x56')]=_0x44caf6[_0xdbd5('0x4a')];channels[_0x44caf6[_0xdbd5('0x8')]][_0xdbd5('0x57')]=!![];}if(!_[_0xdbd5('0x23')](_0x44caf6[_0xdbd5('0x48')][_0xdbd5('0x58')])){utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')](_0xdbd5('0x59'),_0x44caf6[_0xdbd5('0x8')],_0x44caf6[_0xdbd5('0x4a')]));channels[_0x44caf6['uniqueid']]['ContactId']=_0x44caf6['value'];}if(!_[_0xdbd5('0x23')](_0x44caf6[_0xdbd5('0x48')]['xmd-cdrtype'])){utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x44caf6['uniqueid'],_0x44caf6[_0xdbd5('0x4a')]));channels[_0x44caf6['uniqueid']][_0xdbd5('0x5a')]=_0x44caf6['value'];}if(!_[_0xdbd5('0x23')](_0x44caf6[_0xdbd5('0x48')][_0xdbd5('0x5b')])){utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x44caf6[_0xdbd5('0x8')],_0x44caf6[_0xdbd5('0x4a')]));channels[_0x44caf6['uniqueid']][_0xdbd5('0x5c')]=_0x44caf6[_0xdbd5('0x4a')];}if(!_[_0xdbd5('0x23')](_0x44caf6['variable'][_0xdbd5('0x5d')])){utils['info'](util[_0xdbd5('0xb')](_0xdbd5('0x5e'),_0x44caf6[_0xdbd5('0x8')],_0x44caf6[_0xdbd5('0x4a')]));channels[_0x44caf6[_0xdbd5('0x8')]]['sipcallid']=_0x44caf6[_0xdbd5('0x4a')];}}}catch(_0xbe83ed){utils['error'](util['format'](_0xdbd5('0x5f'),_0x44caf6[_0xdbd5('0x8')]),_0xbe83ed);}};exports[_0xdbd5('0x60')]=function(_0x59c49d){try{if(!_[_0xdbd5('0x23')](channels[_0x59c49d[_0xdbd5('0x8')]])){utils[_0xdbd5('0x36')](util[_0xdbd5('0xb')](_0xdbd5('0x61'),_0x59c49d[_0xdbd5('0x8')]),_0x59c49d);utils[_0xdbd5('0xa')](util[_0xdbd5('0xb')](_0xdbd5('0x62'),_0x59c49d[_0xdbd5('0x8')],_0x59c49d['application'],_0x59c49d[_0xdbd5('0x63')]));if(_0x59c49d['application']['toLowerCase']()==_0xdbd5('0x64')&&_['startsWith'](_0x59c49d[_0xdbd5('0x63')]['toLowerCase'](),_0xdbd5('0x65'))){var _0x34d8da=_0x59c49d[_0xdbd5('0x63')][_0xdbd5('0x66')]('=');var _0x19a820=_0x34d8da[0x0][_0xdbd5('0x67')](_0x34d8da[0x0][_0xdbd5('0x68')]('(')+0x1,_0x34d8da[0x0]['lastIndexOf'](')'));var _0x414a02=_0x34d8da[0x1];channels[_0x59c49d[_0xdbd5('0x8')]][_0x19a820]=_0x414a02;}if(!_['includes']([_0xdbd5('0x2b'),'noop',_0xdbd5('0x69'),'set',_0xdbd5('0x6a')],_0x59c49d['application'][_0xdbd5('0x6b')]())){channels[_0x59c49d[_0xdbd5('0x8')]][_0xdbd5('0x55')]=_0x59c49d[_0xdbd5('0x6c')];channels[_0x59c49d[_0xdbd5('0x8')]][_0xdbd5('0x56')]=_0x59c49d[_0xdbd5('0x63')];}}}catch(_0x5d589e){utils[_0xdbd5('0x20')](util[_0xdbd5('0xb')]('[%s][calls][newexten]',_0x59c49d[_0xdbd5('0x8')]),_0x5d589e);}}; \ No newline at end of file +var _0x90ec=['xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','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','set','startsWith','cdr','split','substring','lastIndexOf','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','connectedlinenum','lastevent','getUserByInternal','accountcode','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable'];(function(_0x3eb002,_0x36bf91){var _0x5a9be5=function(_0x5ec927){while(--_0x5ec927){_0x3eb002['push'](_0x3eb002['shift']());}};_0x5a9be5(++_0x36bf91);}(_0x90ec,0x1d4));var _0xc90e=function(_0x560e1,_0x1185f2){_0x560e1=_0x560e1-0x0;var _0x4a47d3=_0x90ec[_0x560e1];return _0x4a47d3;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var utils=require('./utils');var transfers=require(_0xc90e('0x2'));var dispositions=[_0xc90e('0x3'),_0xc90e('0x4'),_0xc90e('0x4'),_0xc90e('0x3'),'NO\x20ANSWER',_0xc90e('0x3'),_0xc90e('0x5'),_0xc90e('0x6'),'FAILED',_0xc90e('0x4'),'FAILED'];var channels={};function writeDB(_0x42051a){var _0x14311a;if(transfers['blinds'][_0x42051a[_0xc90e('0x7')]]){_0x14311a=_0x42051a[_0xc90e('0x7')];_0x42051a[_0xc90e('0x7')]=transfers[_0xc90e('0x8')][_0x42051a[_0xc90e('0x7')]][_0xc90e('0x9')];}utils[_0xc90e('0xa')](util[_0xc90e('0xb')](_0xc90e('0xc'),_0x42051a['uniqueid'],_0x42051a[_0xc90e('0xd')],_0x42051a['queue'],_0x42051a['membername'],_0x42051a['interface'],_0x42051a['calleridnum'],_0x42051a[_0xc90e('0xe')],_0x42051a[_0xc90e('0xf')]));if(_0x42051a['accountcode']){utils[_0xc90e('0x10')](_0x42051a[_0xc90e('0x11')])['then'](function(_0x1ab6fb){if(_0x1ab6fb){_0x42051a[_0xc90e('0x12')]=_0x1ab6fb['id'];}utils[_0xc90e('0x13')](_0xc90e('0x14'),_0x42051a);});}else{utils[_0xc90e('0x13')](_0xc90e('0x14'),_0x42051a);}if(channels[_0x42051a['uniqueid']]){delete channels[_0x42051a[_0xc90e('0x7')]];}else if(_0x14311a&&channels[_0x14311a]){if(!transfers[_0xc90e('0x8')][_0x14311a]['recording'])delete transfers[_0xc90e('0x8')][_0x14311a];delete channels[_0x14311a];}}exports['newchannel']=function(_0x16a015){try{utils[_0xc90e('0x15')](util['format'](_0xc90e('0x16'),_0x16a015[_0xc90e('0x7')]),_0x16a015);if(_0x16a015[_0xc90e('0x7')]==_0x16a015['linkedid']&&_0x16a015['channel']!='OutgoingSpoolFailed'){utils[_0xc90e('0xa')](util[_0xc90e('0xb')](_0xc90e('0x17'),_0x16a015[_0xc90e('0x7')],_0x16a015[_0xc90e('0x18')],_0x16a015['exten']));channels[_0x16a015[_0xc90e('0x7')]]={'uniqueid':_0x16a015['uniqueid'],'accountcode':_0x16a015[_0xc90e('0x11')],'source':_0x16a015[_0xc90e('0x19')],'destination':_0x16a015['exten'],'destinationcontext':_0x16a015[_0xc90e('0x18')],'channel':_0x16a015[_0xc90e('0xd')],'starttime':utils[_0xc90e('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc90e('0x3'),'amaflags':_0xc90e('0x1b')};}}catch(_0x282c53){utils[_0xc90e('0x1c')](util[_0xc90e('0xb')](_0xc90e('0x16'),_0x16a015['uniqueid']),_0x282c53);}};exports[_0xc90e('0x1d')]=function(_0x41deea){try{utils[_0xc90e('0x15')](util[_0xc90e('0xb')](_0xc90e('0x1e'),_0x41deea['uniqueid']),_0x41deea);if(!_[_0xc90e('0x1f')](channels[_0x41deea[_0xc90e('0x7')]])&&_0x41deea[_0xc90e('0x20')]==0x6){utils['info'](util[_0xc90e('0xb')](_0xc90e('0x21'),_0x41deea[_0xc90e('0x7')],_0x41deea[_0xc90e('0x18')],_0x41deea[_0xc90e('0xd')]));if(_[_0xc90e('0x1f')](channels[_0x41deea['uniqueid']]['systemanswertime'])){channels[_0x41deea[_0xc90e('0x7')]]['systemanswertime']=utils[_0xc90e('0x1a')]();}}else if(!_[_0xc90e('0x1f')](channels[_0x41deea[_0xc90e('0x22')]])&&_0x41deea[_0xc90e('0x20')]==0x6&&_0x41deea[_0xc90e('0x18')]!=_0xc90e('0x23')){utils[_0xc90e('0xa')](util['format'](_0xc90e('0x24'),_0x41deea[_0xc90e('0x7')],_0x41deea['linkedid'],_0x41deea[_0xc90e('0x18')],_0x41deea['channel']));channels[_0x41deea[_0xc90e('0x22')]][_0xc90e('0x11')]=_0x41deea[_0xc90e('0x11')];channels[_0x41deea[_0xc90e('0x22')]][_0xc90e('0x25')]=_0x41deea[_0xc90e('0xd')];if(_[_0xc90e('0x1f')](channels[_0x41deea[_0xc90e('0x22')]][_0xc90e('0x26')])){channels[_0x41deea['linkedid']]['answertime']=utils[_0xc90e('0x1a')]();}channels[_0x41deea[_0xc90e('0x22')]][_0xc90e('0x27')]=dispositions[_[_0xc90e('0x28')](_0x41deea[_0xc90e('0x20')])]||_0xc90e('0x5');}}catch(_0x5924fa){utils[_0xc90e('0x1c')](util[_0xc90e('0xb')](_0xc90e('0x1e'),_0x41deea['uniqueid']),_0x5924fa);}};exports[_0xc90e('0x29')]=function(_0x43630c){try{if(!_[_0xc90e('0x1f')](channels[_0x43630c[_0xc90e('0x7')]])){utils['debug'](util['format']('[%s][calls][hangup]',_0x43630c[_0xc90e('0x7')]),_0x43630c);if(_[_0xc90e('0x1f')](channels[_0x43630c[_0xc90e('0x7')]][_0xc90e('0x2a')])){channels[_0x43630c[_0xc90e('0x7')]]['callerid']=_0x43630c[_0xc90e('0x2b')]+'\x20<'+_0x43630c[_0xc90e('0x19')]+'>';}utils[_0xc90e('0xa')](util[_0xc90e('0xb')](_0xc90e('0x2c'),_0x43630c[_0xc90e('0x7')],channels[_0x43630c[_0xc90e('0x7')]][_0xc90e('0x2a')],_0x43630c[_0xc90e('0x2d')]));channels[_0x43630c[_0xc90e('0x7')]][_0xc90e('0x2e')]=utils[_0xc90e('0x1a')]();channels[_0x43630c[_0xc90e('0x7')]]['duration']=utils[_0xc90e('0x2f')](channels[_0x43630c[_0xc90e('0x7')]]['endtime'],channels[_0x43630c['uniqueid']][_0xc90e('0x30')]);channels[_0x43630c['uniqueid']][_0xc90e('0x31')]=channels[_0x43630c[_0xc90e('0x7')]]['answertime']?utils[_0xc90e('0x2f')](channels[_0x43630c['uniqueid']]['endtime'],channels[_0x43630c[_0xc90e('0x7')]]['answertime']):0x0;writeDB(channels[_0x43630c['uniqueid']]);}}catch(_0x28bb9f){utils[_0xc90e('0x1c')](util['format'](_0xc90e('0x32'),_0x43630c[_0xc90e('0x7')]),_0x28bb9f);}};exports[_0xc90e('0x33')]=function(_0x46fe73){try{if(!_[_0xc90e('0x1f')](channels[_0x46fe73[_0xc90e('0x34')]])){utils[_0xc90e('0x15')](util[_0xc90e('0xb')]('[%s][calls][attendedtransfer]',_0x46fe73[_0xc90e('0x35')]),_0x46fe73);if(channels[_0x46fe73['localtwolinkedid']]['channel']==_0x46fe73[_0xc90e('0x36')]){utils['info'](util[_0xc90e('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x46fe73[_0xc90e('0x35')],_0x46fe73[_0xc90e('0x34')],_0x46fe73[_0xc90e('0x37')]));channels[_0x46fe73[_0xc90e('0x34')]][_0xc90e('0x25')]=_0x46fe73[_0xc90e('0x37')];channels[_0x46fe73[_0xc90e('0x34')]][_0xc90e('0x38')]=_0xc90e('0x39');}else if(channels[_0x46fe73['localtwolinkedid']][_0xc90e('0xd')]=_0x46fe73[_0xc90e('0x3a')]){utils[_0xc90e('0xa')](util[_0xc90e('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x46fe73[_0xc90e('0x35')],_0x46fe73[_0xc90e('0x34')],_0x46fe73[_0xc90e('0x3b')]));channels[_0x46fe73['localtwolinkedid']][_0xc90e('0x25')]=_0x46fe73['origtransfererchannel'];channels[_0x46fe73[_0xc90e('0x34')]]['userfield']=_0xc90e('0x39');}}}catch(_0x55e36b){utils[_0xc90e('0x1c')](util[_0xc90e('0xb')](_0xc90e('0x3c'),_0x46fe73[_0xc90e('0x35')]),_0x55e36b);}};exports[_0xc90e('0x3d')]=function(_0x35f401){try{if(!_[_0xc90e('0x1f')](channels[_0x35f401[_0xc90e('0x7')]])){utils['debug'](util[_0xc90e('0xb')](_0xc90e('0x3e'),_0x35f401['uniqueid']),_0x35f401);channels[_0x35f401['uniqueid']][_0xc90e('0x3f')]=utils['now']();utils[_0xc90e('0xa')](util[_0xc90e('0xb')](_0xc90e('0x40'),_0x35f401[_0xc90e('0x7')],channels[_0x35f401[_0xc90e('0x7')]]['musiconholdstartAt']));}}catch(_0x3a5704){utils[_0xc90e('0x1c')](util['format'](_0xc90e('0x3e'),_0x35f401['uniqueid']),_0x3a5704);}};exports[_0xc90e('0x41')]=function(_0x56627a){try{if(!_[_0xc90e('0x1f')](channels[_0x56627a[_0xc90e('0x7')]])){utils[_0xc90e('0x15')](util[_0xc90e('0xb')](_0xc90e('0x42'),_0x56627a[_0xc90e('0x7')]),_0x56627a);if(!_[_0xc90e('0x1f')](channels[_0x56627a[_0xc90e('0x7')]][_0xc90e('0x3f')])){channels[_0x56627a[_0xc90e('0x7')]][_0xc90e('0x43')]+=utils[_0xc90e('0x2f')](utils[_0xc90e('0x1a')](),channels[_0x56627a[_0xc90e('0x7')]][_0xc90e('0x3f')]);utils[_0xc90e('0xa')](util['format'](_0xc90e('0x44'),_0x56627a[_0xc90e('0x7')],channels[_0x56627a[_0xc90e('0x7')]][_0xc90e('0x43')]));delete channels[_0x56627a[_0xc90e('0x7')]][_0xc90e('0x3f')];}}}catch(_0x2cadae){utils['error'](util[_0xc90e('0xb')]('[%s][calls][musiconholdstop]',_0x56627a[_0xc90e('0x7')]),_0x2cadae);}};exports[_0xc90e('0x45')]=function(_0x31e1da){try{if(!_[_0xc90e('0x1f')](channels[_0x31e1da[_0xc90e('0x7')]])){utils['debug'](util[_0xc90e('0xb')](_0xc90e('0x46'),_0x31e1da['uniqueid']),_0x31e1da);if(!_[_0xc90e('0x1f')](_0x31e1da[_0xc90e('0x47')][_0xc90e('0x48')])){utils[_0xc90e('0xa')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x31e1da[_0xc90e('0x7')],_0x31e1da[_0xc90e('0x49')]));channels[_0x31e1da[_0xc90e('0x7')]][_0xc90e('0x4a')]=_0x31e1da[_0xc90e('0x49')];}if(!_['isNil'](_0x31e1da[_0xc90e('0x47')][_0xc90e('0x4b')])){utils['info'](util['format'](_0xc90e('0x4c'),_0x31e1da[_0xc90e('0x7')],_0x31e1da[_0xc90e('0x49')]));channels[_0x31e1da[_0xc90e('0x7')]]['destination']=_0x31e1da[_0xc90e('0x49')];channels[_0x31e1da[_0xc90e('0x7')]][_0xc90e('0x2a')]='\x22'+_0x31e1da[_0xc90e('0x49')]+_0xc90e('0x4d')+_0x31e1da[_0xc90e('0x49')]+'>';}if(!_[_0xc90e('0x1f')](_0x31e1da[_0xc90e('0x47')]['xmd-callerid-preview'])||!_[_0xc90e('0x1f')](_0x31e1da[_0xc90e('0x47')][_0xc90e('0x4e')])){utils[_0xc90e('0xa')](util[_0xc90e('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x31e1da[_0xc90e('0x7')],!_[_0xc90e('0x1f')](_0x31e1da[_0xc90e('0x47')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0xc90e('0x4e'),_0x31e1da['value']));channels[_0x31e1da[_0xc90e('0x7')]]['callerid']=_0x31e1da[_0xc90e('0x49')];}if(!_[_0xc90e('0x1f')](_0x31e1da[_0xc90e('0x47')][_0xc90e('0x4f')])||!_[_0xc90e('0x1f')](_0x31e1da[_0xc90e('0x47')][_0xc90e('0x50')])){utils[_0xc90e('0xa')](util[_0xc90e('0xb')](_0xc90e('0x51'),_0x31e1da[_0xc90e('0x7')],!_[_0xc90e('0x1f')](_0x31e1da['variable'][_0xc90e('0x4f')])?'xmd-queue':'xmcs-queue',_0x31e1da['value']));channels[_0x31e1da['uniqueid']][_0xc90e('0x52')]=_0xc90e('0x53');channels[_0x31e1da['uniqueid']][_0xc90e('0x54')]=_0x31e1da[_0xc90e('0x49')];channels[_0x31e1da[_0xc90e('0x7')]][_0xc90e('0x55')]=!![];}if(!_[_0xc90e('0x1f')](_0x31e1da[_0xc90e('0x47')]['xmd-contactid'])){utils[_0xc90e('0xa')](util[_0xc90e('0xb')](_0xc90e('0x56'),_0x31e1da[_0xc90e('0x7')],_0x31e1da[_0xc90e('0x49')]));channels[_0x31e1da[_0xc90e('0x7')]]['ContactId']=_0x31e1da[_0xc90e('0x49')];}if(!_['isNil'](_0x31e1da[_0xc90e('0x47')]['xmd-cdrtype'])){utils['info'](util[_0xc90e('0xb')](_0xc90e('0x57'),_0x31e1da['uniqueid'],_0x31e1da[_0xc90e('0x49')]));channels[_0x31e1da['uniqueid']]['type']=_0x31e1da['value'];}if(!_['isNil'](_0x31e1da[_0xc90e('0x47')][_0xc90e('0x58')])){utils['info'](util[_0xc90e('0xb')](_0xc90e('0x59'),_0x31e1da[_0xc90e('0x7')],_0x31e1da[_0xc90e('0x49')]));channels[_0x31e1da[_0xc90e('0x7')]][_0xc90e('0x5a')]=_0x31e1da[_0xc90e('0x49')];}if(!_['isNil'](_0x31e1da[_0xc90e('0x47')][_0xc90e('0x5b')])){utils['info'](util['format'](_0xc90e('0x5c'),_0x31e1da['uniqueid'],_0x31e1da['value']));channels[_0x31e1da[_0xc90e('0x7')]][_0xc90e('0x5b')]=_0x31e1da[_0xc90e('0x49')];}}}catch(_0x16a95f){utils[_0xc90e('0x1c')](util[_0xc90e('0xb')](_0xc90e('0x46'),_0x31e1da['uniqueid']),_0x16a95f);}};exports[_0xc90e('0x5d')]=function(_0x3eafba){try{if(!_['isNil'](channels[_0x3eafba[_0xc90e('0x7')]])){utils[_0xc90e('0x15')](util[_0xc90e('0xb')]('[%s][calls][newexten]',_0x3eafba['uniqueid']),_0x3eafba);utils[_0xc90e('0xa')](util['format'](_0xc90e('0x5e'),_0x3eafba[_0xc90e('0x7')],_0x3eafba[_0xc90e('0x5f')],_0x3eafba[_0xc90e('0x60')]));if(_0x3eafba['application'][_0xc90e('0x61')]()==_0xc90e('0x62')&&_[_0xc90e('0x63')](_0x3eafba[_0xc90e('0x60')]['toLowerCase'](),_0xc90e('0x64'))){var _0x59ffa8=_0x3eafba[_0xc90e('0x60')][_0xc90e('0x65')]('=');var _0x24e1f8=_0x59ffa8[0x0][_0xc90e('0x66')](_0x59ffa8[0x0][_0xc90e('0x67')]('(')+0x1,_0x59ffa8[0x0]['lastIndexOf'](')'));var _0x2c1385=_0x59ffa8[0x1];channels[_0x3eafba[_0xc90e('0x7')]][_0x24e1f8]=_0x2c1385;}if(!_['includes']([_0xc90e('0x29'),_0xc90e('0x68'),_0xc90e('0x69'),_0xc90e('0x62'),_0xc90e('0x6a')],_0x3eafba[_0xc90e('0x5f')]['toLowerCase']())){channels[_0x3eafba['uniqueid']][_0xc90e('0x52')]=_0x3eafba[_0xc90e('0x5f')];channels[_0x3eafba[_0xc90e('0x7')]][_0xc90e('0x54')]=_0x3eafba['appdata'];}}}catch(_0x23be25){utils['error'](util['format'](_0xc90e('0x6b'),_0x3eafba[_0xc90e('0x7')]),_0x23be25);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 1ea1a48..bda059e 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 _0xadd6=['[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xadd6,0xfd));var _0x6add=function(_0x52980f,_0x47b3b0){_0x52980f=_0x52980f-0x0;var _0x1f52a1=_0xadd6[_0x52980f];return _0x1f52a1;};'use strict';var utils=require(_0x6add('0x0'));exports[_0x6add('0x1')]=function(){utils[_0x6add('0x2')](_0x6add('0x3'));};exports[_0x6add('0x4')]=function(){utils[_0x6add('0x2')](_0x6add('0x5'));};exports[_0x6add('0x6')]=function(){utils[_0x6add('0x2')](_0x6add('0x7'));};exports[_0x6add('0x8')]=function(_0x3abb1c){utils[_0x6add('0x8')](_0x6add('0x9'),_0x3abb1c);};exports[_0x6add('0xa')]=function(){utils[_0x6add('0x2')](_0x6add('0xb'));};exports['managerevent']=function(_0x31b6a8){}; \ No newline at end of file +var _0x18ec=['managerevent','./utils','connect','info','[core]\x20connected','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x18ec,0x79));var _0xc18e=function(_0x2f13c8,_0x535808){_0x2f13c8=_0x2f13c8-0x0;var _0x54aa86=_0x18ec[_0x2f13c8];return _0x54aa86;};'use strict';var utils=require(_0xc18e('0x0'));exports[_0xc18e('0x1')]=function(){utils[_0xc18e('0x2')](_0xc18e('0x3'));};exports['shutdown']=function(){utils[_0xc18e('0x2')]('[core]\x20shutdown');};exports[_0xc18e('0x4')]=function(){utils[_0xc18e('0x2')](_0xc18e('0x5'));};exports['error']=function(_0x25edc2){utils[_0xc18e('0x6')](_0xc18e('0x7'),_0x25edc2);};exports['close']=function(){utils[_0xc18e('0x2')](_0xc18e('0x8'));};exports[_0xc18e('0x9')]=function(_0x6a9dc4){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 38445d7..e11636f 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 _0x6dd5=['assign','starttime','now','called','[%s][dials][dialend]','lastevent','answertime','[%s][dials][dialend]\x20dialstatus:%s','error','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr(routeid)','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]'];(function(_0x53c46f,_0x27fb75){var _0x550fc6=function(_0x854aa6){while(--_0x854aa6){_0x53c46f['push'](_0x53c46f['shift']());}};_0x550fc6(++_0x27fb75);}(_0x6dd5,0xa2));var _0x56dd=function(_0x56ea7a,_0x528105){_0x56ea7a=_0x56ea7a-0x0;var _0x459646=_0x6dd5[_0x56ea7a];return _0x459646;};'use strict';var _=require('lodash');var util=require(_0x56dd('0x0'));var utils=require(_0x56dd('0x1'));var dials={};function writeDB(_0x4f4f67){utils[_0x56dd('0x2')](util[_0x56dd('0x3')](_0x56dd('0x4'),_0x4f4f67[_0x56dd('0x5')],_0x4f4f67[_0x56dd('0x6')],_0x4f4f67[_0x56dd('0x7')],_0x4f4f67[_0x56dd('0x8')],_0x4f4f67[_0x56dd('0x9')],_0x4f4f67[_0x56dd('0xa')]));utils[_0x56dd('0xb')](_0x56dd('0xc'),_0x4f4f67);delete dials[_0x4f4f67['uniqueid']];}exports[_0x56dd('0xd')]=function(_0x3d86a3){try{utils[_0x56dd('0xe')](util['format'](_0x56dd('0xf'),_0x3d86a3[_0x56dd('0x5')]),_0x3d86a3);utils['info'](util[_0x56dd('0x3')](_0x56dd('0x10'),_0x3d86a3[_0x56dd('0x5')],_0x3d86a3['application'],_0x3d86a3[_0x56dd('0x11')]));if(_0x3d86a3[_0x56dd('0x12')][_0x56dd('0x13')]()=='set'&&_[_0x56dd('0x14')](_0x3d86a3[_0x56dd('0x11')]['toLowerCase'](),_0x56dd('0x15'))){var _0x17f987=_0x3d86a3[_0x56dd('0x11')]['split']('=');dials[_0x3d86a3[_0x56dd('0x5')]]={'routeId':_0x17f987[0x1]};}}catch(_0x5cbe53){utils['error'](util[_0x56dd('0x3')](_0x56dd('0xf'),_0x3d86a3['uniqueid']),_0x5cbe53);}};exports[_0x56dd('0x16')]=function(_0xb4bf40){try{utils['debug'](util[_0x56dd('0x3')](_0x56dd('0x17'),_0xb4bf40[_0x56dd('0x5')]),_0xb4bf40);if(!_[_0x56dd('0x18')](_0xb4bf40[_0x56dd('0x19')][_0x56dd('0x1a')])){utils['info'](util['format'](_0x56dd('0x1b'),_0xb4bf40[_0x56dd('0x5')],_0xb4bf40[_0x56dd('0x1c')]));dials[_0xb4bf40[_0x56dd('0x5')]]={'routeId':_0xb4bf40['value']};}}catch(_0xd17043){utils['error'](util[_0x56dd('0x3')](_0x56dd('0x17'),_0xb4bf40[_0x56dd('0x5')]),_0xd17043);}};exports['dialbegin']=function(_0x36fa46){try{if(!_[_0x56dd('0x18')](dials[_0x36fa46[_0x56dd('0x5')]])){utils[_0x56dd('0xe')](util[_0x56dd('0x3')](_0x56dd('0x1d'),_0x36fa46[_0x56dd('0x5')]),_0x36fa46);dials[_0x36fa46[_0x56dd('0x5')]]=_[_0x56dd('0x1e')](dials[_0x36fa46['uniqueid']],_0x36fa46);dials[_0x36fa46[_0x56dd('0x5')]][_0x56dd('0x1f')]=utils[_0x56dd('0x20')]();dials[_0x36fa46[_0x56dd('0x5')]]['lastevent']=_0x56dd('0x21');utils['info'](util[_0x56dd('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x36fa46[_0x56dd('0x5')],dials[_0x36fa46[_0x56dd('0x5')]][_0x56dd('0x1f')]));}}catch(_0xa2747c){utils['error'](util[_0x56dd('0x3')]('[%s][dials][dialbegin]',_0x36fa46[_0x56dd('0x5')]),_0xa2747c);}};exports['dialend']=function(_0x3f88ba){try{if(!_[_0x56dd('0x18')](dials[_0x3f88ba['uniqueid']])){utils[_0x56dd('0xe')](util[_0x56dd('0x3')](_0x56dd('0x22'),_0x3f88ba[_0x56dd('0x5')]),_0x3f88ba);dials[_0x3f88ba[_0x56dd('0x5')]]['dialstatus']=_0x3f88ba[_0x56dd('0xa')];if(_0x3f88ba[_0x56dd('0xa')]=='ANSWER'){dials[_0x3f88ba['uniqueid']]=_[_0x56dd('0x1e')](dials[_0x3f88ba[_0x56dd('0x5')]],_0x3f88ba);dials[_0x3f88ba[_0x56dd('0x5')]]['answertime']=utils[_0x56dd('0x20')]();dials[_0x3f88ba[_0x56dd('0x5')]][_0x56dd('0x23')]='connect';utils[_0x56dd('0x2')](util[_0x56dd('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3f88ba['uniqueid'],_0x3f88ba[_0x56dd('0xa')],dials[_0x3f88ba[_0x56dd('0x5')]][_0x56dd('0x24')]));}else{utils['info'](util[_0x56dd('0x3')](_0x56dd('0x25'),_0x3f88ba['uniqueid'],_0x3f88ba[_0x56dd('0xa')]));}}}catch(_0x3a766e){utils[_0x56dd('0x26')](util[_0x56dd('0x3')](_0x56dd('0x22'),_0x3f88ba[_0x56dd('0x5')]),_0x3a766e);}};exports[_0x56dd('0x27')]=function(_0x3cc784){try{if(!_[_0x56dd('0x18')](dials[_0x3cc784[_0x56dd('0x5')]])){utils[_0x56dd('0xe')](util[_0x56dd('0x3')](_0x56dd('0x28'),_0x3cc784[_0x56dd('0x5')]),_0x3cc784);utils[_0x56dd('0x2')](util[_0x56dd('0x3')](_0x56dd('0x29'),_0x3cc784['uniqueid'],_0x3cc784[_0x56dd('0x8')],_0x3cc784[_0x56dd('0x2a')],_0x3cc784[_0x56dd('0x2b')]));dials[_0x3cc784[_0x56dd('0x5')]]=_[_0x56dd('0x1e')](dials[_0x3cc784[_0x56dd('0x5')]],{'endtime':utils[_0x56dd('0x20')](),'lastevent':'complete'});dials[_0x3cc784[_0x56dd('0x5')]][_0x56dd('0x2c')]=utils[_0x56dd('0x2d')](dials[_0x3cc784[_0x56dd('0x5')]][_0x56dd('0x2e')],dials[_0x3cc784[_0x56dd('0x5')]]['starttime']);dials[_0x3cc784[_0x56dd('0x5')]][_0x56dd('0x2f')]=utils['diffTime'](dials[_0x3cc784[_0x56dd('0x5')]]['answertime']||dials[_0x3cc784[_0x56dd('0x5')]][_0x56dd('0x2e')],dials[_0x3cc784[_0x56dd('0x5')]][_0x56dd('0x1f')]);dials[_0x3cc784[_0x56dd('0x5')]]['billableseconds']=dials[_0x3cc784[_0x56dd('0x5')]][_0x56dd('0x24')]?utils['diffTime'](dials[_0x3cc784[_0x56dd('0x5')]][_0x56dd('0x2e')],dials[_0x3cc784['uniqueid']][_0x56dd('0x24')]):0x0;writeDB(dials[_0x3cc784[_0x56dd('0x5')]]);}}catch(_0x941ef){utils[_0x56dd('0x26')](util[_0x56dd('0x3')](_0x56dd('0x28'),_0x3cc784['uniqueid']),_0x941ef);}}; \ No newline at end of file +var _0x749d=['endtime','billableseconds','[%s][dials][hangup]','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','dialstatus','request','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','value','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','assign','complete','diffTime','holdtime'];(function(_0x4d9605,_0x4ed1d8){var _0x431c65=function(_0x4c4d4a){while(--_0x4c4d4a){_0x4d9605['push'](_0x4d9605['shift']());}};_0x431c65(++_0x4ed1d8);}(_0x749d,0x1c5));var _0xd749=function(_0xfe4beb,_0x275f93){_0xfe4beb=_0xfe4beb-0x0;var _0x5448c0=_0x749d[_0xfe4beb];return _0x5448c0;};'use strict';var _=require(_0xd749('0x0'));var util=require('util');var utils=require(_0xd749('0x1'));var dials={};function writeDB(_0x47a9c9){utils[_0xd749('0x2')](util[_0xd749('0x3')](_0xd749('0x4'),_0x47a9c9[_0xd749('0x5')],_0x47a9c9[_0xd749('0x6')],_0x47a9c9[_0xd749('0x7')],_0x47a9c9[_0xd749('0x8')],_0x47a9c9['connectedlinenum'],_0x47a9c9[_0xd749('0x9')]));utils[_0xd749('0xa')]('CreateVoiceDialReport',_0x47a9c9);delete dials[_0x47a9c9[_0xd749('0x5')]];}exports['newexten']=function(_0x425ea1){try{utils[_0xd749('0xb')](util[_0xd749('0x3')](_0xd749('0xc'),_0x425ea1[_0xd749('0x5')]),_0x425ea1);utils[_0xd749('0x2')](util[_0xd749('0x3')](_0xd749('0xd'),_0x425ea1['uniqueid'],_0x425ea1[_0xd749('0xe')],_0x425ea1[_0xd749('0xf')]));if(_0x425ea1[_0xd749('0xe')]['toLowerCase']()==_0xd749('0x10')&&_[_0xd749('0x11')](_0x425ea1[_0xd749('0xf')][_0xd749('0x12')](),_0xd749('0x13'))){var _0x2a0da6=_0x425ea1['appdata'][_0xd749('0x14')]('=');dials[_0x425ea1[_0xd749('0x5')]]={'routeId':_0x2a0da6[0x1]};}}catch(_0x2c993d){utils[_0xd749('0x15')](util[_0xd749('0x3')](_0xd749('0xc'),_0x425ea1[_0xd749('0x5')]),_0x2c993d);}};exports[_0xd749('0x16')]=function(_0xbd3609){try{utils['debug'](util['format'](_0xd749('0x17'),_0xbd3609[_0xd749('0x5')]),_0xbd3609);if(!_[_0xd749('0x18')](_0xbd3609['variable'][_0xd749('0x19')])){utils['info'](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0xbd3609[_0xd749('0x5')],_0xbd3609[_0xd749('0x1a')]));dials[_0xbd3609[_0xd749('0x5')]]={'routeId':_0xbd3609[_0xd749('0x1a')]};}}catch(_0x1467da){utils[_0xd749('0x15')](util[_0xd749('0x3')]('[%s][dials][varset]',_0xbd3609[_0xd749('0x5')]),_0x1467da);}};exports['dialbegin']=function(_0x10ff75){try{if(!_[_0xd749('0x18')](dials[_0x10ff75[_0xd749('0x5')]])){utils[_0xd749('0xb')](util[_0xd749('0x3')](_0xd749('0x1b'),_0x10ff75[_0xd749('0x5')]),_0x10ff75);dials[_0x10ff75[_0xd749('0x5')]]=_['assign'](dials[_0x10ff75[_0xd749('0x5')]],_0x10ff75);dials[_0x10ff75['uniqueid']]['starttime']=utils[_0xd749('0x1c')]();dials[_0x10ff75[_0xd749('0x5')]][_0xd749('0x1d')]=_0xd749('0x1e');utils['info'](util[_0xd749('0x3')](_0xd749('0x1f'),_0x10ff75[_0xd749('0x5')],dials[_0x10ff75[_0xd749('0x5')]][_0xd749('0x20')]));}}catch(_0x566991){utils['error'](util['format']('[%s][dials][dialbegin]',_0x10ff75['uniqueid']),_0x566991);}};exports[_0xd749('0x21')]=function(_0x4dccc2){try{if(!_['isNil'](dials[_0x4dccc2[_0xd749('0x5')]])){utils[_0xd749('0xb')](util[_0xd749('0x3')](_0xd749('0x22'),_0x4dccc2['uniqueid']),_0x4dccc2);dials[_0x4dccc2['uniqueid']][_0xd749('0x9')]=_0x4dccc2[_0xd749('0x9')];if(_0x4dccc2[_0xd749('0x9')]==_0xd749('0x23')){dials[_0x4dccc2[_0xd749('0x5')]]=_['assign'](dials[_0x4dccc2[_0xd749('0x5')]],_0x4dccc2);dials[_0x4dccc2['uniqueid']][_0xd749('0x24')]=utils['now']();dials[_0x4dccc2[_0xd749('0x5')]]['lastevent']=_0xd749('0x25');utils[_0xd749('0x2')](util[_0xd749('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4dccc2[_0xd749('0x5')],_0x4dccc2['dialstatus'],dials[_0x4dccc2[_0xd749('0x5')]][_0xd749('0x24')]));}else{utils[_0xd749('0x2')](util[_0xd749('0x3')](_0xd749('0x26'),_0x4dccc2[_0xd749('0x5')],_0x4dccc2[_0xd749('0x9')]));}}}catch(_0x5e78fb){utils['error'](util[_0xd749('0x3')](_0xd749('0x22'),_0x4dccc2[_0xd749('0x5')]),_0x5e78fb);}};exports[_0xd749('0x27')]=function(_0x21edc2){try{if(!_['isNil'](dials[_0x21edc2[_0xd749('0x5')]])){utils['debug'](util['format']('[%s][dials][hangup]',_0x21edc2[_0xd749('0x5')]),_0x21edc2);utils[_0xd749('0x2')](util[_0xd749('0x3')](_0xd749('0x28'),_0x21edc2['uniqueid'],_0x21edc2['calleridnum'],_0x21edc2[_0xd749('0x29')],_0x21edc2[_0xd749('0x2a')]));dials[_0x21edc2[_0xd749('0x5')]]=_[_0xd749('0x2b')](dials[_0x21edc2['uniqueid']],{'endtime':utils[_0xd749('0x1c')](),'lastevent':_0xd749('0x2c')});dials[_0x21edc2['uniqueid']]['duration']=utils[_0xd749('0x2d')](dials[_0x21edc2['uniqueid']]['endtime'],dials[_0x21edc2[_0xd749('0x5')]]['starttime']);dials[_0x21edc2[_0xd749('0x5')]][_0xd749('0x2e')]=utils[_0xd749('0x2d')](dials[_0x21edc2[_0xd749('0x5')]]['answertime']||dials[_0x21edc2[_0xd749('0x5')]][_0xd749('0x2f')],dials[_0x21edc2['uniqueid']][_0xd749('0x20')]);dials[_0x21edc2[_0xd749('0x5')]][_0xd749('0x30')]=dials[_0x21edc2['uniqueid']]['answertime']?utils[_0xd749('0x2d')](dials[_0x21edc2[_0xd749('0x5')]][_0xd749('0x2f')],dials[_0x21edc2[_0xd749('0x5')]][_0xd749('0x24')]):0x0;writeDB(dials[_0x21edc2[_0xd749('0x5')]]);}}catch(_0x3bc0ae){utils['error'](util[_0xd749('0x3')](_0xd749('0x31'),_0x21edc2[_0xd749('0x5')]),_0x3bc0ae);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index bf8f524..3935501 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 _0x5ad4=['agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','env','production','local','asterisk','username','keepConnected','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]'];(function(_0x5e8d2b,_0x4f89fe){var _0x23ff8a=function(_0x1e2843){while(--_0x1e2843){_0x5e8d2b['push'](_0x5e8d2b['shift']());}};_0x23ff8a(++_0x4f89fe);}(_0x5ad4,0x64));var _0x45ad=function(_0xc47d67,_0x5c720f){_0xc47d67=_0xc47d67-0x0;var _0x207119=_0x5ad4[_0xc47d67];return _0x207119;};var AsteriskManager=require(_0x45ad('0x0'));var config=require(_0x45ad('0x1'));var utils=require(_0x45ad('0x2'));var util=require('util');var isXDREnabled=config[_0x45ad('0x3')]&&config[_0x45ad('0x3')]['disabled']?!config['xdr']['disabled']:!![];var isProduction=config[_0x45ad('0x4')]===_0x45ad('0x5')||![];var isLocalAsterisk=config[_0x45ad('0x3')]&&config['xdr'][_0x45ad('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0x45ad('0x7')]['ip'],config[_0x45ad('0x7')][_0x45ad('0x8')],config[_0x45ad('0x7')]['password'],!![]);ami[_0x45ad('0x9')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x45ad('0xa')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x45ad('0xb'));var calls=require(_0x45ad('0xc'));var queues=require(_0x45ad('0xd'));var recordings=require(_0x45ad('0xe'));var members=require(_0x45ad('0xf'));var dials=require(_0x45ad('0x10'));var transfers=require('./transfers.controller');var core=require(_0x45ad('0x11'));ami['on']('connect',core[_0x45ad('0x12')]);ami['on']('shutdown',core[_0x45ad('0x13')]);ami['on'](_0x45ad('0x14'),core[_0x45ad('0x14')]);ami['on'](_0x45ad('0x15'),core[_0x45ad('0x15')]);ami['on'](_0x45ad('0x16'),core['close']);ami['on'](_0x45ad('0x17'),core[_0x45ad('0x17')]);ami['on'](_0x45ad('0x18'),function(_0x40541f){try{utils[_0x45ad('0x19')](util[_0x45ad('0x1a')](_0x45ad('0x1b'),_0x40541f[_0x45ad('0x1c')]),_0x40541f);members[_0x45ad('0x18')](_0x40541f);}catch(_0x52a2c9){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')](_0x45ad('0x1b'),_0x40541f[_0x45ad('0x1c')]),_0x52a2c9);}});ami['on'](_0x45ad('0x1d'),function(_0x183870){try{utils[_0x45ad('0x19')](util[_0x45ad('0x1a')](_0x45ad('0x1e'),_0x183870[_0x45ad('0x1f')]),_0x183870);agents[_0x45ad('0x1d')](_0x183870);}catch(_0x4a904c){utils[_0x45ad('0x15')](util['format'](_0x45ad('0x1e'),_0x183870[_0x45ad('0x1f')]),_0x4a904c);}});ami['on'](_0x45ad('0x20'),function(_0x271931){try{utils[_0x45ad('0x19')](util[_0x45ad('0x1a')](_0x45ad('0x21'),_0x271931[_0x45ad('0x1f')]),_0x271931);agents[_0x45ad('0x20')](_0x271931);}catch(_0x5d8f60){utils[_0x45ad('0x15')](util['format'](_0x45ad('0x21'),_0x271931[_0x45ad('0x1f')]),_0x5d8f60);}});ami['on'](_0x45ad('0x22'),function(_0x5488c5){try{utils['debug'](util[_0x45ad('0x1a')](_0x45ad('0x23'),_0x5488c5[_0x45ad('0x1f')]),_0x5488c5);agents[_0x45ad('0x22')](_0x5488c5);queues[_0x45ad('0x22')](_0x5488c5);}catch(_0x246662){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')](_0x45ad('0x23'),_0x5488c5['uniqueid']),_0x246662);}});ami['on'](_0x45ad('0x24'),function(_0x4a419e){try{utils[_0x45ad('0x19')](util['format'](_0x45ad('0x25'),_0x4a419e[_0x45ad('0x1f')]),_0x4a419e);agents['agentcomplete'](_0x4a419e);queues[_0x45ad('0x24')](_0x4a419e);members[_0x45ad('0x24')](_0x4a419e);}catch(_0x1ceb20){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')](_0x45ad('0x25'),_0x4a419e[_0x45ad('0x1f')]),_0x1ceb20);}});ami['on']('queuecallerabandon',function(_0x3bca35){try{utils['debug'](util['format'](_0x45ad('0x26'),_0x3bca35[_0x45ad('0x1f')]),_0x3bca35);agents[_0x45ad('0x27')](_0x3bca35);queues[_0x45ad('0x27')](_0x3bca35);}catch(_0x21d40a){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')](_0x45ad('0x26'),_0x3bca35[_0x45ad('0x1f')]),_0x21d40a);}});ami['on'](_0x45ad('0x28'),function(_0x31d929){try{utils[_0x45ad('0x19')](util[_0x45ad('0x1a')](_0x45ad('0x29'),_0x31d929[_0x45ad('0x1f')]),_0x31d929);queues['queuecallerjoin'](_0x31d929);recordings[_0x45ad('0x28')](_0x31d929);}catch(_0x31b18f){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')]('[%s][index][queuecallerjoin]',_0x31d929['uniqueid']),_0x31b18f);}});ami['on']('queuecallerleave',function(_0xc2e8e1){try{utils[_0x45ad('0x19')](util['format'](_0x45ad('0x2a'),_0xc2e8e1[_0x45ad('0x1f')]),_0xc2e8e1);queues[_0x45ad('0x2b')](_0xc2e8e1);}catch(_0x4fac1a){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')](_0x45ad('0x2a'),_0xc2e8e1[_0x45ad('0x1f')]),_0x4fac1a);}});ami['on'](_0x45ad('0x2c'),function(_0x587ce9){try{utils[_0x45ad('0x19')](util['format'](_0x45ad('0x2d'),_0x587ce9[_0x45ad('0x1f')]),_0x587ce9);queues[_0x45ad('0x2c')](_0x587ce9);calls['musiconholdstart'](_0x587ce9);}catch(_0x38f6e3){utils['error'](util[_0x45ad('0x1a')]('[%s][index][musiconholdstart]',_0x587ce9[_0x45ad('0x1f')]),_0x38f6e3);}});ami['on'](_0x45ad('0x2e'),function(_0x25569b){try{utils['debug'](util[_0x45ad('0x1a')](_0x45ad('0x2f'),_0x25569b[_0x45ad('0x1f')]),_0x25569b);queues[_0x45ad('0x2e')](_0x25569b);calls[_0x45ad('0x2e')](_0x25569b);}catch(_0x5a9316){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')](_0x45ad('0x2f'),_0x25569b[_0x45ad('0x1f')]),_0x5a9316);}});ami['on'](_0x45ad('0x30'),function(_0x4cb8c8){try{utils[_0x45ad('0x19')](util[_0x45ad('0x1a')]('[%s][index][newstate]',_0x4cb8c8[_0x45ad('0x1f')]),_0x4cb8c8);calls['newstate'](_0x4cb8c8);recordings[_0x45ad('0x30')](_0x4cb8c8);}catch(_0x333651){utils[_0x45ad('0x15')](util['format'](_0x45ad('0x31'),_0x4cb8c8[_0x45ad('0x1f')]),_0x333651);}});ami['on'](_0x45ad('0x32'),function(_0x1ae5bc){try{utils[_0x45ad('0x19')](util[_0x45ad('0x1a')](_0x45ad('0x33'),_0x1ae5bc['uniqueid']),_0x1ae5bc);calls[_0x45ad('0x32')](_0x1ae5bc);recordings[_0x45ad('0x32')](_0x1ae5bc);dials[_0x45ad('0x32')](_0x1ae5bc);agents[_0x45ad('0x32')](_0x1ae5bc);queues[_0x45ad('0x32')](_0x1ae5bc);}catch(_0x27b673){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')]('[%s][index][hangup]',_0x1ae5bc[_0x45ad('0x1f')]),_0x27b673);}});ami['on'](_0x45ad('0x34'),function(_0x58bcb8){try{utils['debug'](util[_0x45ad('0x1a')]('[%s][index][cdr]',_0x58bcb8[_0x45ad('0x1f')]),_0x58bcb8);members[_0x45ad('0x34')](_0x58bcb8);}catch(_0xc2ddd){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')](_0x45ad('0x35'),_0x58bcb8[_0x45ad('0x1f')]),_0xc2ddd);}});ami['on'](_0x45ad('0x36'),function(_0xfe6dad){try{utils['debug'](util['format']('[%s][index][blindtransfer]',_0xfe6dad['uniqueid']),_0xfe6dad);queues[_0x45ad('0x36')](_0xfe6dad);agents[_0x45ad('0x36')](_0xfe6dad);transfers[_0x45ad('0x36')](_0xfe6dad);recordings[_0x45ad('0x36')](_0xfe6dad);}catch(_0x25e625){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')](_0x45ad('0x37'),_0xfe6dad[_0x45ad('0x1f')]),_0x25e625);}});ami['on'](_0x45ad('0x38'),function(_0x4e661b){try{utils[_0x45ad('0x19')](util[_0x45ad('0x1a')]('[%s][index][attendedtransfer]',_0x4e661b[_0x45ad('0x39')]),_0x4e661b);queues['attendedtransfer'](_0x4e661b);transfers['attendedtransfer'](_0x4e661b);agents[_0x45ad('0x38')](_0x4e661b);calls[_0x45ad('0x38')](_0x4e661b);}catch(_0x10b9db){utils[_0x45ad('0x15')](util['format'](_0x45ad('0x3a'),_0x4e661b[_0x45ad('0x39')]),_0x10b9db);}});ami['on'](_0x45ad('0x3b'),function(_0x46d1a4){try{utils[_0x45ad('0x19')](util['format'](_0x45ad('0x3c'),_0x46d1a4[_0x45ad('0x1f')]),_0x46d1a4);queues[_0x45ad('0x3b')](_0x46d1a4);recordings[_0x45ad('0x3b')](_0x46d1a4);calls[_0x45ad('0x3b')](_0x46d1a4);dials[_0x45ad('0x3b')](_0x46d1a4);}catch(_0x582bdb){utils[_0x45ad('0x15')](util['format'](_0x45ad('0x3c'),_0x46d1a4[_0x45ad('0x1f')]),_0x582bdb);}});ami['on'](_0x45ad('0x3d'),function(_0x1a413c){try{utils[_0x45ad('0x19')](util[_0x45ad('0x1a')]('[%s][index][newexten]',_0x1a413c[_0x45ad('0x1f')]),_0x1a413c);calls[_0x45ad('0x3d')](_0x1a413c);recordings[_0x45ad('0x3d')](_0x1a413c);dials[_0x45ad('0x3d')](_0x1a413c);}catch(_0xd799b6){utils['error'](util[_0x45ad('0x1a')](_0x45ad('0x3e'),_0x1a413c[_0x45ad('0x1f')]),_0xd799b6);}});ami['on'](_0x45ad('0x3f'),function(_0x54ee1a){try{utils[_0x45ad('0x19')](util[_0x45ad('0x1a')]('[%s][index][newchannel]',_0x54ee1a[_0x45ad('0x1f')]),_0x54ee1a);calls['newchannel'](_0x54ee1a);recordings['newchannel'](_0x54ee1a);}catch(_0x44d583){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')](_0x45ad('0x40'),_0x54ee1a[_0x45ad('0x1f')]),_0x44d583);}});ami['on'](_0x45ad('0x41'),function(_0x5b7707){try{utils[_0x45ad('0x19')](util[_0x45ad('0x1a')]('[%s][index][dialbegin]',_0x5b7707['uniqueid']),_0x5b7707);dials[_0x45ad('0x41')](_0x5b7707);}catch(_0x31e563){utils['error'](util[_0x45ad('0x1a')]('[%s]dialbegin',_0x5b7707[_0x45ad('0x1f')]),_0x31e563);}});ami['on'](_0x45ad('0x42'),function(_0x422542){try{utils[_0x45ad('0x19')](util['format'](_0x45ad('0x43'),_0x422542[_0x45ad('0x1f')]),_0x422542);dials['dialend'](_0x422542);}catch(_0x27f51a){utils[_0x45ad('0x15')](util[_0x45ad('0x1a')]('[%s][index][dialend]',_0x422542[_0x45ad('0x1f')]),_0x27f51a);}});} \ No newline at end of file +var _0x278d=['[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','local','port','asterisk','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./recordings.controller','./dials.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x278d,0x111));var _0xd278=function(_0x1920ec,_0x4d5de1){_0x1920ec=_0x1920ec-0x0;var _0x3c6d1d=_0x278d[_0x1920ec];return _0x3c6d1d;};var AsteriskManager=require('asterisk-manager');var config=require(_0xd278('0x0'));var utils=require(_0xd278('0x1'));var util=require(_0xd278('0x2'));var isXDREnabled=config[_0xd278('0x3')]&&config[_0xd278('0x3')][_0xd278('0x4')]?!config[_0xd278('0x3')][_0xd278('0x4')]:!![];var isProduction=config[_0xd278('0x5')]===_0xd278('0x6')||![];var isLocalAsterisk=config[_0xd278('0x3')]&&config[_0xd278('0x3')][_0xd278('0x7')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xd278('0x8')],config['asterisk']['ip'],config[_0xd278('0x9')][_0xd278('0xa')],config[_0xd278('0x9')]['password'],!![]);ami[_0xd278('0xb')]();if(!isXDREnabled){utils[_0xd278('0xc')](_0xd278('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xd278('0xe'));}else{var agents=require(_0xd278('0xf'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0xd278('0x10'));var members=require('./members.controller');var dials=require(_0xd278('0x11'));var transfers=require('./transfers.controller');var core=require(_0xd278('0x12'));ami['on'](_0xd278('0x13'),core[_0xd278('0x13')]);ami['on'](_0xd278('0x14'),core[_0xd278('0x14')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xd278('0x15'),core[_0xd278('0x15')]);ami['on'](_0xd278('0x16'),core[_0xd278('0x16')]);ami['on'](_0xd278('0x17'),core['managerevent']);ami['on'](_0xd278('0x18'),function(_0x3dfe06){try{utils[_0xd278('0x19')](util['format'](_0xd278('0x1a'),_0x3dfe06[_0xd278('0x1b')]),_0x3dfe06);members[_0xd278('0x18')](_0x3dfe06);}catch(_0x5e62b8){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x1a'),_0x3dfe06[_0xd278('0x1b')]),_0x5e62b8);}});ami['on']('agentcalled',function(_0x59a4a8){try{utils[_0xd278('0x19')](util['format'](_0xd278('0x1d'),_0x59a4a8['uniqueid']),_0x59a4a8);agents[_0xd278('0x1e')](_0x59a4a8);}catch(_0x53382f){utils[_0xd278('0x15')](util[_0xd278('0x1c')]('[%s][index][agentcalled]',_0x59a4a8[_0xd278('0x1f')]),_0x53382f);}});ami['on'](_0xd278('0x20'),function(_0x1a71e7){try{utils[_0xd278('0x19')](util['format'](_0xd278('0x21'),_0x1a71e7['uniqueid']),_0x1a71e7);agents[_0xd278('0x20')](_0x1a71e7);}catch(_0xc8abcb){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x21'),_0x1a71e7[_0xd278('0x1f')]),_0xc8abcb);}});ami['on'](_0xd278('0x22'),function(_0x219bb7){try{utils[_0xd278('0x19')](util[_0xd278('0x1c')]('[%s][index][agentconnect]',_0x219bb7['uniqueid']),_0x219bb7);agents[_0xd278('0x22')](_0x219bb7);queues[_0xd278('0x22')](_0x219bb7);}catch(_0x1c87dd){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x23'),_0x219bb7[_0xd278('0x1f')]),_0x1c87dd);}});ami['on'](_0xd278('0x24'),function(_0xa0ff57){try{utils[_0xd278('0x19')](util['format'](_0xd278('0x25'),_0xa0ff57[_0xd278('0x1f')]),_0xa0ff57);agents[_0xd278('0x24')](_0xa0ff57);queues[_0xd278('0x24')](_0xa0ff57);members[_0xd278('0x24')](_0xa0ff57);}catch(_0x1ab214){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x25'),_0xa0ff57['uniqueid']),_0x1ab214);}});ami['on'](_0xd278('0x26'),function(_0x2a0337){try{utils['debug'](util[_0xd278('0x1c')](_0xd278('0x27'),_0x2a0337[_0xd278('0x1f')]),_0x2a0337);agents[_0xd278('0x26')](_0x2a0337);queues[_0xd278('0x26')](_0x2a0337);}catch(_0x5624dc){utils['error'](util[_0xd278('0x1c')](_0xd278('0x27'),_0x2a0337[_0xd278('0x1f')]),_0x5624dc);}});ami['on'](_0xd278('0x28'),function(_0x4e028d){try{utils['debug'](util['format'](_0xd278('0x29'),_0x4e028d[_0xd278('0x1f')]),_0x4e028d);queues[_0xd278('0x28')](_0x4e028d);recordings['queuecallerjoin'](_0x4e028d);}catch(_0x5040d4){utils['error'](util[_0xd278('0x1c')](_0xd278('0x29'),_0x4e028d['uniqueid']),_0x5040d4);}});ami['on']('queuecallerleave',function(_0x14f3d9){try{utils['debug'](util[_0xd278('0x1c')](_0xd278('0x2a'),_0x14f3d9[_0xd278('0x1f')]),_0x14f3d9);queues['queuecallerleave'](_0x14f3d9);}catch(_0x553e15){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x2a'),_0x14f3d9['uniqueid']),_0x553e15);}});ami['on'](_0xd278('0x2b'),function(_0x52ef23){try{utils[_0xd278('0x19')](util['format'](_0xd278('0x2c'),_0x52ef23['uniqueid']),_0x52ef23);queues[_0xd278('0x2b')](_0x52ef23);calls[_0xd278('0x2b')](_0x52ef23);}catch(_0x438eca){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x2c'),_0x52ef23[_0xd278('0x1f')]),_0x438eca);}});ami['on'](_0xd278('0x2d'),function(_0x4f9067){try{utils['debug'](util[_0xd278('0x1c')](_0xd278('0x2e'),_0x4f9067[_0xd278('0x1f')]),_0x4f9067);queues[_0xd278('0x2d')](_0x4f9067);calls[_0xd278('0x2d')](_0x4f9067);}catch(_0x422441){utils[_0xd278('0x15')](util['format'](_0xd278('0x2e'),_0x4f9067[_0xd278('0x1f')]),_0x422441);}});ami['on'](_0xd278('0x2f'),function(_0x10a8fa){try{utils['debug'](util['format'](_0xd278('0x30'),_0x10a8fa[_0xd278('0x1f')]),_0x10a8fa);calls[_0xd278('0x2f')](_0x10a8fa);recordings['newstate'](_0x10a8fa);}catch(_0x3dd179){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x30'),_0x10a8fa[_0xd278('0x1f')]),_0x3dd179);}});ami['on'](_0xd278('0x31'),function(_0x23504e){try{utils['debug'](util[_0xd278('0x1c')](_0xd278('0x32'),_0x23504e[_0xd278('0x1f')]),_0x23504e);calls['hangup'](_0x23504e);recordings[_0xd278('0x31')](_0x23504e);dials[_0xd278('0x31')](_0x23504e);agents[_0xd278('0x31')](_0x23504e);queues[_0xd278('0x31')](_0x23504e);}catch(_0x241737){utils[_0xd278('0x15')](util['format'](_0xd278('0x32'),_0x23504e[_0xd278('0x1f')]),_0x241737);}});ami['on'](_0xd278('0x33'),function(_0x19763a){try{utils[_0xd278('0x19')](util[_0xd278('0x1c')](_0xd278('0x34'),_0x19763a[_0xd278('0x1f')]),_0x19763a);members[_0xd278('0x33')](_0x19763a);}catch(_0x267c9e){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x34'),_0x19763a[_0xd278('0x1f')]),_0x267c9e);}});ami['on']('blindtransfer',function(_0x10df32){try{utils['debug'](util['format'](_0xd278('0x35'),_0x10df32[_0xd278('0x1f')]),_0x10df32);queues[_0xd278('0x36')](_0x10df32);agents[_0xd278('0x36')](_0x10df32);transfers[_0xd278('0x36')](_0x10df32);recordings[_0xd278('0x36')](_0x10df32);}catch(_0x3eaf44){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x35'),_0x10df32[_0xd278('0x1f')]),_0x3eaf44);}});ami['on'](_0xd278('0x37'),function(_0x496dad){try{utils[_0xd278('0x19')](util[_0xd278('0x1c')](_0xd278('0x38'),_0x496dad['origtransfereruniqueid']),_0x496dad);queues[_0xd278('0x37')](_0x496dad);transfers['attendedtransfer'](_0x496dad);agents[_0xd278('0x37')](_0x496dad);calls[_0xd278('0x37')](_0x496dad);}catch(_0x1a3e1b){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x38'),_0x496dad[_0xd278('0x39')]),_0x1a3e1b);}});ami['on'](_0xd278('0x3a'),function(_0x156086){try{utils[_0xd278('0x19')](util[_0xd278('0x1c')]('[%s][index][varset]',_0x156086[_0xd278('0x1f')]),_0x156086);queues['varset'](_0x156086);recordings[_0xd278('0x3a')](_0x156086);calls['varset'](_0x156086);dials[_0xd278('0x3a')](_0x156086);}catch(_0x207c2e){utils[_0xd278('0x15')](util[_0xd278('0x1c')](_0xd278('0x3b'),_0x156086['uniqueid']),_0x207c2e);}});ami['on'](_0xd278('0x3c'),function(_0x1c9eec){try{utils['debug'](util[_0xd278('0x1c')]('[%s][index][newexten]',_0x1c9eec['uniqueid']),_0x1c9eec);calls[_0xd278('0x3c')](_0x1c9eec);recordings[_0xd278('0x3c')](_0x1c9eec);dials[_0xd278('0x3c')](_0x1c9eec);}catch(_0x3804b3){utils['error'](util[_0xd278('0x1c')](_0xd278('0x3d'),_0x1c9eec[_0xd278('0x1f')]),_0x3804b3);}});ami['on'](_0xd278('0x3e'),function(_0x24039b){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x24039b[_0xd278('0x1f')]),_0x24039b);calls['newchannel'](_0x24039b);recordings[_0xd278('0x3e')](_0x24039b);}catch(_0x2b21c2){utils[_0xd278('0x15')](util['format'](_0xd278('0x3f'),_0x24039b['uniqueid']),_0x2b21c2);}});ami['on'](_0xd278('0x40'),function(_0x9b77cb){try{utils[_0xd278('0x19')](util[_0xd278('0x1c')](_0xd278('0x41'),_0x9b77cb[_0xd278('0x1f')]),_0x9b77cb);dials[_0xd278('0x40')](_0x9b77cb);}catch(_0x408087){utils[_0xd278('0x15')](util[_0xd278('0x1c')]('[%s]dialbegin',_0x9b77cb[_0xd278('0x1f')]),_0x408087);}});ami['on'](_0xd278('0x42'),function(_0xabb2be){try{utils[_0xd278('0x19')](util[_0xd278('0x1c')](_0xd278('0x43'),_0xabb2be[_0xd278('0x1f')]),_0xabb2be);dials[_0xd278('0x42')](_0xabb2be);}catch(_0x1f7e47){utils[_0xd278('0x15')](util['format']('[%s][index][dialend]',_0xabb2be[_0xd278('0x1f')]),_0x1f7e47);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index f7905de..da4369f 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 _0x6aff=['enterAt','error','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','interface','getUserByInterface','name','internal','CreateMemberReport','split','then','request','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','uniqueid','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','agent','NOT_INUSE','isNil','exitAt','now','diffTime'];(function(_0x5a51c1,_0x394c67){var _0x38f5fb=function(_0xa5d3d0){while(--_0xa5d3d0){_0x5a51c1['push'](_0x5a51c1['shift']());}};_0x38f5fb(++_0x394c67);}(_0x6aff,0x15e));var _0xf6af=function(_0x12507f,_0xb7322e){_0x12507f=_0x12507f-0x0;var _0x4467ed=_0x6aff[_0x12507f];return _0x4467ed;};'use strict';var _=require('lodash');var util=require(_0xf6af('0x0'));var utils=require(_0xf6af('0x1'));var members={};var exclude=[_0xf6af('0x2'),'Queue:'];function writeDB(_0x26279){utils[_0xf6af('0x3')](util[_0xf6af('0x4')](_0xf6af('0x5'),_0x26279['uniqueid'],_0x26279['interface'],_0x26279[_0xf6af('0x6')],_0x26279[_0xf6af('0x7')],_0x26279[_0xf6af('0x8')],_0x26279[_0xf6af('0x9')]));if(_0x26279[_0xf6af('0xa')]){utils[_0xf6af('0xb')](_0x26279[_0xf6af('0xa')])['then'](function(_0xc8676f){if(_0xc8676f){_0x26279[_0xf6af('0x8')]=_0xc8676f[_0xf6af('0xc')];_0x26279[_0xf6af('0xd')]=_0xc8676f['internal'];utils['request'](_0xf6af('0xe'),_0x26279);}else{utils['getUserByName'](_0x26279['interface'][_0xf6af('0xf')]('/')[0x1])[_0xf6af('0x10')](function(_0x5c47e4){if(_0x5c47e4){_0x26279[_0xf6af('0x8')]=_0x5c47e4['name'];_0x26279[_0xf6af('0xd')]=_0x5c47e4[_0xf6af('0xd')];utils[_0xf6af('0x11')]('CreateMemberReport',_0x26279);}});}})['catch'](function(_0xe0af59){utils['error'](util[_0xf6af('0x4')](_0xf6af('0x12'),_0x26279['uniqueid']),_0xe0af59);});}delete members[_0x26279[_0xf6af('0xa')]];}function startsWith(_0x35b0fc,_0x5b3a49){return _['some'](_0x35b0fc,function(_0x2cd6fb){return _['startsWith'](_0x5b3a49,_0x2cd6fb);});}exports[_0xf6af('0x13')]=function(_0x482972){try{utils[_0xf6af('0x14')](util[_0xf6af('0x4')](_0xf6af('0x15'),members[_0x482972['device']]?members[_0x482972['device']][_0xf6af('0x16')]:_0x482972[_0xf6af('0x17')]),_0x482972);utils[_0xf6af('0x3')](util[_0xf6af('0x4')](_0xf6af('0x18'),members[_0x482972['device']]?members[_0x482972['device']]['uniqueid']:_0x482972[_0xf6af('0x17')],_0x482972[_0xf6af('0x19')],_0x482972[_0xf6af('0x17')]));switch(_0x482972['state']){case _0xf6af('0x1a'):case'BUSY':if(!startsWith(exclude,_0x482972[_0xf6af('0x17')])){members[_0x482972[_0xf6af('0x17')]]={'channel':'voice','interface':_0x482972[_0xf6af('0x17')],'type':_0xf6af('0x1b'),'enterAt':utils['now'](),'role':_0xf6af('0x1c')};}break;case _0xf6af('0x1d'):if(!_[_0xf6af('0x1e')](members[_0x482972['device']])){members[_0x482972[_0xf6af('0x17')]][_0xf6af('0x1f')]=utils[_0xf6af('0x20')]();members[_0x482972[_0xf6af('0x17')]]['duration']=utils[_0xf6af('0x21')](members[_0x482972[_0xf6af('0x17')]][_0xf6af('0x1f')],members[_0x482972['device']][_0xf6af('0x22')]);if(members[_0x482972[_0xf6af('0x17')]][_0xf6af('0x16')]){writeDB(members[_0x482972[_0xf6af('0x17')]]);}}break;default:break;}}catch(_0x5d44dc){utils[_0xf6af('0x23')](util[_0xf6af('0x4')](_0xf6af('0x15'),members[_0x482972[_0xf6af('0x17')]]?members[_0x482972[_0xf6af('0x17')]]['uniqueid']:_0x482972[_0xf6af('0x17')]),_0x5d44dc);}};exports['agentcomplete']=function(_0x2f39de){try{if(!_[_0xf6af('0x1e')](members[_0x2f39de['interface']])){utils[_0xf6af('0x14')](util[_0xf6af('0x4')](_0xf6af('0x24'),_0x2f39de[_0xf6af('0x16')]),_0x2f39de);utils[_0xf6af('0x3')](util['format'](_0xf6af('0x25'),_0x2f39de[_0xf6af('0x16')],_0x2f39de[_0xf6af('0xa')],_0x2f39de[_0xf6af('0x26')]));members[_0x2f39de[_0xf6af('0xa')]]=_[_0xf6af('0x27')](members[_0x2f39de[_0xf6af('0xa')]],{'data4':_0x2f39de[_0xf6af('0x26')],'uniqueid':_0x2f39de[_0xf6af('0x16')]});}}catch(_0x259fe1){utils['error'](util[_0xf6af('0x4')]('[%s][members][agentcomplete]',_0x2f39de[_0xf6af('0x16')]),_0x259fe1);}};exports[_0xf6af('0x28')]=function(_0x16a1ae){try{utils[_0xf6af('0x14')](util[_0xf6af('0x4')](_0xf6af('0x29'),_0x16a1ae[_0xf6af('0x16')]),_0x16a1ae);if(_0x16a1ae[_0xf6af('0x6')]){var _0x8639d5=_0x16a1ae[_0xf6af('0x6')][_0xf6af('0xf')]('-')[0x0];if(!_['isNil'](members[_0x8639d5])){members[_0x8639d5]=_[_0xf6af('0x27')](members[_0x8639d5],{'data1':members[_0x8639d5][_0xf6af('0x2a')]||_0x16a1ae[_0xf6af('0x9')],'data2':members[_0x8639d5][_0xf6af('0x7')]||_0x16a1ae[_0xf6af('0x2b')],'data3':members[_0x8639d5][_0xf6af('0x2c')]||_0x16a1ae[_0xf6af('0x2d')],'uniqueid':members[_0x8639d5]['uniqueid']||_0x16a1ae[_0xf6af('0x16')]});utils['info'](util[_0xf6af('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x16a1ae[_0xf6af('0x16')],members[_0x8639d5][_0xf6af('0x2a')],members[_0x8639d5]['data2'],members[_0x8639d5][_0xf6af('0x2c')]));if(members[_0x8639d5][_0xf6af('0x1f')]){writeDB(members[_0x8639d5]);}}}if(_0x16a1ae['destinationchannel']){var _0x363a6f=_0x16a1ae[_0xf6af('0x2e')][_0xf6af('0xf')]('-')[0x0];if(!_[_0xf6af('0x1e')](members[_0x363a6f])){members[_0x363a6f]=_['assign'](members[_0x363a6f],{'data1':members[_0x363a6f][_0xf6af('0x2a')]||_0x16a1ae[_0xf6af('0x9')],'data2':members[_0x363a6f][_0xf6af('0x7')]||_0x16a1ae[_0xf6af('0x2b')],'data3':members[_0x363a6f][_0xf6af('0x2c')]||_0x16a1ae[_0xf6af('0x2d')],'uniqueid':members[_0x363a6f][_0xf6af('0x16')]||_0x16a1ae[_0xf6af('0x16')]});utils[_0xf6af('0x3')](util[_0xf6af('0x4')](_0xf6af('0x2f'),_0x16a1ae['uniqueid'],members[_0x363a6f]['data1'],members[_0x363a6f][_0xf6af('0x7')],members[_0x363a6f][_0xf6af('0x2c')]));if(members[_0x363a6f][_0xf6af('0x1f')]){writeDB(members[_0x363a6f]);}}}}catch(_0x20fcd6){utils[_0xf6af('0x23')](util[_0xf6af('0x4')](_0xf6af('0x29'),_0x16a1ae[_0xf6af('0x16')]),_0x20fcd6);}}; \ No newline at end of file +var _0x95ef=['[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','util','./utils','Local/_attended@transfer','Queue:','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','format'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x95ef,0xb4));var _0xf95e=function(_0x16f36b,_0x1a3ce2){_0x16f36b=_0x16f36b-0x0;var _0x3b0a4d=_0x95ef[_0x16f36b];return _0x3b0a4d;};'use strict';var _=require('lodash');var util=require(_0xf95e('0x0'));var utils=require(_0xf95e('0x1'));var members={};var exclude=[_0xf95e('0x2'),_0xf95e('0x3')];function writeDB(_0x47e6b6){utils['info'](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x47e6b6[_0xf95e('0x4')],_0x47e6b6[_0xf95e('0x5')],_0x47e6b6[_0xf95e('0x6')],_0x47e6b6['data2'],_0x47e6b6[_0xf95e('0x7')],_0x47e6b6[_0xf95e('0x8')]));if(_0x47e6b6['interface']){utils[_0xf95e('0x9')](_0x47e6b6[_0xf95e('0x5')])[_0xf95e('0xa')](function(_0x2ce8e9){if(_0x2ce8e9){_0x47e6b6[_0xf95e('0x7')]=_0x2ce8e9[_0xf95e('0xb')];_0x47e6b6[_0xf95e('0xc')]=_0x2ce8e9[_0xf95e('0xc')];utils[_0xf95e('0xd')](_0xf95e('0xe'),_0x47e6b6);}else{utils[_0xf95e('0xf')](_0x47e6b6[_0xf95e('0x5')][_0xf95e('0x10')]('/')[0x1])[_0xf95e('0xa')](function(_0x5d57fa){if(_0x5d57fa){_0x47e6b6[_0xf95e('0x7')]=_0x5d57fa[_0xf95e('0xb')];_0x47e6b6[_0xf95e('0xc')]=_0x5d57fa[_0xf95e('0xc')];utils[_0xf95e('0xd')]('CreateMemberReport',_0x47e6b6);}});}})[_0xf95e('0x11')](function(_0x5943de){utils[_0xf95e('0x12')](util['format'](_0xf95e('0x13'),_0x47e6b6[_0xf95e('0x4')]),_0x5943de);});}delete members[_0x47e6b6[_0xf95e('0x5')]];}function startsWith(_0x3ef93a,_0x577cc7){return _[_0xf95e('0x14')](_0x3ef93a,function(_0x3018c3){return _[_0xf95e('0x15')](_0x577cc7,_0x3018c3);});}exports[_0xf95e('0x16')]=function(_0x27d7f5){try{utils[_0xf95e('0x17')](util['format'](_0xf95e('0x18'),members[_0x27d7f5[_0xf95e('0x19')]]?members[_0x27d7f5['device']]['uniqueid']:_0x27d7f5[_0xf95e('0x19')]),_0x27d7f5);utils[_0xf95e('0x1a')](util[_0xf95e('0x1b')](_0xf95e('0x1c'),members[_0x27d7f5[_0xf95e('0x19')]]?members[_0x27d7f5[_0xf95e('0x19')]][_0xf95e('0x4')]:_0x27d7f5['device'],_0x27d7f5[_0xf95e('0x1d')],_0x27d7f5[_0xf95e('0x19')]));switch(_0x27d7f5['state']){case'INUSE':case _0xf95e('0x1e'):if(!startsWith(exclude,_0x27d7f5[_0xf95e('0x19')])){members[_0x27d7f5[_0xf95e('0x19')]]={'channel':_0xf95e('0x1f'),'interface':_0x27d7f5[_0xf95e('0x19')],'type':'TALKING','enterAt':utils[_0xf95e('0x20')](),'role':_0xf95e('0x21')};}break;case _0xf95e('0x22'):if(!_[_0xf95e('0x23')](members[_0x27d7f5[_0xf95e('0x19')]])){members[_0x27d7f5[_0xf95e('0x19')]][_0xf95e('0x24')]=utils['now']();members[_0x27d7f5['device']][_0xf95e('0x25')]=utils['diffTime'](members[_0x27d7f5['device']][_0xf95e('0x24')],members[_0x27d7f5['device']][_0xf95e('0x26')]);if(members[_0x27d7f5['device']][_0xf95e('0x4')]){writeDB(members[_0x27d7f5[_0xf95e('0x19')]]);}}break;default:break;}}catch(_0x17c317){utils[_0xf95e('0x12')](util['format'](_0xf95e('0x18'),members[_0x27d7f5[_0xf95e('0x19')]]?members[_0x27d7f5[_0xf95e('0x19')]][_0xf95e('0x4')]:_0x27d7f5[_0xf95e('0x19')]),_0x17c317);}};exports['agentcomplete']=function(_0x5c3352){try{if(!_['isNil'](members[_0x5c3352[_0xf95e('0x5')]])){utils[_0xf95e('0x17')](util[_0xf95e('0x1b')](_0xf95e('0x27'),_0x5c3352['uniqueid']),_0x5c3352);utils[_0xf95e('0x1a')](util['format'](_0xf95e('0x28'),_0x5c3352['uniqueid'],_0x5c3352['interface'],_0x5c3352[_0xf95e('0x29')]));members[_0x5c3352[_0xf95e('0x5')]]=_[_0xf95e('0x2a')](members[_0x5c3352['interface']],{'data4':_0x5c3352[_0xf95e('0x29')],'uniqueid':_0x5c3352[_0xf95e('0x4')]});}}catch(_0x247580){utils[_0xf95e('0x12')](util[_0xf95e('0x1b')](_0xf95e('0x27'),_0x5c3352[_0xf95e('0x4')]),_0x247580);}};exports[_0xf95e('0x2b')]=function(_0x2efbef){try{utils['debug'](util[_0xf95e('0x1b')](_0xf95e('0x2c'),_0x2efbef[_0xf95e('0x4')]),_0x2efbef);if(_0x2efbef['channel']){var _0x10f001=_0x2efbef['channel'][_0xf95e('0x10')]('-')[0x0];if(!_[_0xf95e('0x23')](members[_0x10f001])){members[_0x10f001]=_[_0xf95e('0x2a')](members[_0x10f001],{'data1':members[_0x10f001][_0xf95e('0x2d')]||_0x2efbef['type'],'data2':members[_0x10f001][_0xf95e('0x2e')]||_0x2efbef[_0xf95e('0x2f')],'data3':members[_0x10f001][_0xf95e('0x30')]||_0x2efbef[_0xf95e('0x31')],'uniqueid':members[_0x10f001][_0xf95e('0x4')]||_0x2efbef[_0xf95e('0x4')]});utils['info'](util[_0xf95e('0x1b')](_0xf95e('0x32'),_0x2efbef[_0xf95e('0x4')],members[_0x10f001][_0xf95e('0x2d')],members[_0x10f001][_0xf95e('0x2e')],members[_0x10f001][_0xf95e('0x30')]));if(members[_0x10f001][_0xf95e('0x24')]){writeDB(members[_0x10f001]);}}}if(_0x2efbef['destinationchannel']){var _0x572091=_0x2efbef[_0xf95e('0x33')][_0xf95e('0x10')]('-')[0x0];if(!_[_0xf95e('0x23')](members[_0x572091])){members[_0x572091]=_[_0xf95e('0x2a')](members[_0x572091],{'data1':members[_0x572091][_0xf95e('0x2d')]||_0x2efbef[_0xf95e('0x8')],'data2':members[_0x572091][_0xf95e('0x2e')]||_0x2efbef['source'],'data3':members[_0x572091][_0xf95e('0x30')]||_0x2efbef[_0xf95e('0x31')],'uniqueid':members[_0x572091][_0xf95e('0x4')]||_0x2efbef[_0xf95e('0x4')]});utils[_0xf95e('0x1a')](util[_0xf95e('0x1b')](_0xf95e('0x32'),_0x2efbef[_0xf95e('0x4')],members[_0x572091]['data1'],members[_0x572091]['data2'],members[_0x572091][_0xf95e('0x30')]));if(members[_0x572091][_0xf95e('0x24')]){writeDB(members[_0x572091]);}}}}catch(_0x5bd852){utils[_0xf95e('0x12')](util['format'](_0xf95e('0x2c'),_0x2efbef[_0xf95e('0x4')]),_0x5bd852);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index cb7a77b..59c5b2f 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 _0xfd8f=['connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','variable','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum'];(function(_0x4fb5b1,_0x5931ed){var _0x3e6b53=function(_0x19c9cc){while(--_0x19c9cc){_0x4fb5b1['push'](_0x4fb5b1['shift']());}};_0x3e6b53(++_0x5931ed);}(_0xfd8f,0x10a));var _0xffd8=function(_0x348739,_0x195d3d){_0x348739=_0x348739-0x0;var _0x5bcfc6=_0xfd8f[_0x348739];return _0x5bcfc6;};'use strict';var _=require(_0xffd8('0x0'));var util=require(_0xffd8('0x1'));var utils=require(_0xffd8('0x2'));var queues={};function writeDB(_0x28de72){utils[_0xffd8('0x3')](util[_0xffd8('0x4')](_0xffd8('0x5'),_0x28de72[_0xffd8('0x6')],_0x28de72[_0xffd8('0x7')],_0x28de72[_0xffd8('0x8')],_0x28de72[_0xffd8('0x9')],_0x28de72[_0xffd8('0xa')],_0x28de72[_0xffd8('0xb')],_0x28de72[_0xffd8('0xc')]));if(_0x28de72[_0xffd8('0x8')]){utils[_0xffd8('0xd')](_0x28de72[_0xffd8('0x8')])[_0xffd8('0xe')](function(_0x16014a){if(_0x16014a){_0x28de72[_0xffd8('0xf')]=_0x16014a[_0xffd8('0xf')];}utils[_0xffd8('0x10')](_0xffd8('0x11'),_0x28de72);});}else{utils[_0xffd8('0x10')]('CreateVoiceQueueReport',_0x28de72);}if(_0x28de72[_0xffd8('0x12')]){delete queues[_0x28de72[_0xffd8('0x12')]];}else{delete queues[_0x28de72[_0xffd8('0x6')]];}}exports[_0xffd8('0x13')]=function(_0x369e37){try{utils['debug'](util['format'](_0xffd8('0x14'),_0x369e37[_0xffd8('0x6')]),_0x369e37);utils[_0xffd8('0x3')](util[_0xffd8('0x4')](_0xffd8('0x15'),_0x369e37['uniqueid'],_0x369e37[_0xffd8('0x8')],_0x369e37[_0xffd8('0x16')]));queues[_0x369e37[_0xffd8('0x6')]]=_[_0xffd8('0x17')](_0x369e37,{'originalposition':_0x369e37[_0xffd8('0x16')],'queuecallerjoinAt':utils[_0xffd8('0x18')](),'mohtime':0x0});}catch(_0xf05c8b){utils[_0xffd8('0x19')](util[_0xffd8('0x4')]('[%s][queues][queuecallerjoin]',_0x369e37['uniqueid']),_0xf05c8b);}};exports[_0xffd8('0x1a')]=function(_0x42ee7b){try{if(!_[_0xffd8('0x1b')](queues[_0x42ee7b[_0xffd8('0x6')]])){utils[_0xffd8('0x1c')](util['format'](_0xffd8('0x1d'),_0x42ee7b[_0xffd8('0x6')]),_0x42ee7b);if(queues[_0x42ee7b[_0xffd8('0x6')]][_0xffd8('0x1e')]){if(!queues[_0x42ee7b[_0xffd8('0x6')]][_0xffd8('0x1f')]&&!queues[_0x42ee7b[_0xffd8('0x6')]][_0xffd8('0x20')]){queues[_0x42ee7b[_0xffd8('0x6')]]['queuecallercomplete']=!![];queues[_0x42ee7b[_0xffd8('0x6')]][_0xffd8('0x21')]=utils[_0xffd8('0x18')]();queues[_0x42ee7b[_0xffd8('0x6')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0xffd8('0x3')](util['format'](_0xffd8('0x22'),_0x42ee7b[_0xffd8('0x6')],queues[_0x42ee7b['uniqueid']][_0xffd8('0x23')],queues[_0x42ee7b['uniqueid']][_0xffd8('0xc')]));writeDB(queues[_0x42ee7b[_0xffd8('0x6')]]);}else if(queues[_0x42ee7b[_0xffd8('0x6')]]['transfereduniqueid']){utils[_0xffd8('0x3')](util[_0xffd8('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x42ee7b[_0xffd8('0x6')],queues[_0x42ee7b['uniqueid']][_0xffd8('0x23')],queues[_0x42ee7b[_0xffd8('0x6')]][_0xffd8('0x12')]));queues[queues[_0x42ee7b[_0xffd8('0x6')]][_0xffd8('0x12')]]=queues[_0x42ee7b[_0xffd8('0x6')]];queues[queues[_0x42ee7b[_0xffd8('0x6')]][_0xffd8('0x12')]][_0xffd8('0x24')]=0x2;delete queues[_0x42ee7b[_0xffd8('0x6')]];}}}catch(_0x17fff7){utils[_0xffd8('0x19')](util['format'](_0xffd8('0x1d'),_0x42ee7b[_0xffd8('0x6')]),_0x17fff7);}};exports['varset']=function(_0xba42b5){try{utils[_0xffd8('0x1c')](util[_0xffd8('0x4')]('[%s][queues][varset]',_0xba42b5[_0xffd8('0x6')]),_0xba42b5);if(!_[_0xffd8('0x1b')](_0xba42b5[_0xffd8('0x25')]['queuestatus'])&&_0xba42b5['value'][_0xffd8('0x26')]()!==_0xffd8('0x27')){if(!_[_0xffd8('0x1b')](queues[_0xba42b5[_0xffd8('0x6')]])){queues[_0xba42b5['uniqueid']][_0xffd8('0x1f')]=![];queues[_0xba42b5[_0xffd8('0x6')]][_0xffd8('0x28')]=null;queues[_0xba42b5[_0xffd8('0x6')]][_0xffd8('0x20')]=!![];queues[_0xba42b5[_0xffd8('0x6')]][_0xffd8('0x29')]=utils[_0xffd8('0x18')]();queues[_0xba42b5[_0xffd8('0x6')]][_0xffd8('0xc')]=_0xba42b5[_0xffd8('0x2a')][_0xffd8('0x26')]();utils['info'](util['format'](_0xffd8('0x2b'),_0xba42b5['uniqueid'],queues[_0xba42b5[_0xffd8('0x6')]][_0xffd8('0x23')],_0xba42b5['value'],queues[_0xba42b5[_0xffd8('0x6')]]['queuecallerexitreason']));writeDB(queues[_0xba42b5['uniqueid']]);}}else if(!_[_0xffd8('0x1b')](_0xba42b5[_0xffd8('0x25')][_0xffd8('0x2c')])){if(!_[_0xffd8('0x1b')](queues[_0xba42b5[_0xffd8('0x6')]])&&!queues[_0xba42b5[_0xffd8('0x6')]]['queuecallerabandon']){queues[_0xba42b5[_0xffd8('0x6')]][_0xffd8('0x1f')]=![];queues[_0xba42b5[_0xffd8('0x6')]][_0xffd8('0x28')]=null;queues[_0xba42b5['uniqueid']][_0xffd8('0x20')]=!![];queues[_0xba42b5[_0xffd8('0x6')]]['queuecallerexitAt']=utils[_0xffd8('0x18')]();queues[_0xba42b5[_0xffd8('0x6')]][_0xffd8('0xc')]=_0xffd8('0x2d');utils[_0xffd8('0x3')](util['format'](_0xffd8('0x2e'),_0xba42b5[_0xffd8('0x6')],queues[_0xba42b5['uniqueid']]['name'],_0xba42b5[_0xffd8('0x2a')],queues[_0xba42b5['uniqueid']][_0xffd8('0xc')]));}}}catch(_0x3061c6){utils[_0xffd8('0x19')](util['format'](_0xffd8('0x2f'),_0xba42b5[_0xffd8('0x6')]),_0x3061c6);}};exports[_0xffd8('0x1f')]=function(_0x401307){try{if(!_[_0xffd8('0x1b')](queues[_0x401307['uniqueid']])){utils[_0xffd8('0x1c')](util[_0xffd8('0x4')]('[%s][queues][queuecallerabandon]',_0x401307[_0xffd8('0x6')]),_0x401307);queues[_0x401307[_0xffd8('0x6')]][_0xffd8('0x20')]=![];queues[_0x401307[_0xffd8('0x6')]][_0xffd8('0x29')]=null;queues[_0x401307[_0xffd8('0x6')]][_0xffd8('0x1f')]=!![];queues[_0x401307[_0xffd8('0x6')]][_0xffd8('0x28')]=utils['now']();queues[_0x401307['uniqueid']]['queuecallerexitreason']=_0xffd8('0x30');utils[_0xffd8('0x3')](util[_0xffd8('0x4')](_0xffd8('0x31'),_0x401307[_0xffd8('0x6')],queues[_0x401307[_0xffd8('0x6')]]['name'],queues[_0x401307['uniqueid']][_0xffd8('0xc')]));}}catch(_0xe90776){utils[_0xffd8('0x19')](util[_0xffd8('0x4')](_0xffd8('0x32'),_0x401307[_0xffd8('0x6')]),_0xe90776);}};exports[_0xffd8('0x33')]=function(_0x2fa44b){try{if(!_[_0xffd8('0x1b')](queues[_0x2fa44b[_0xffd8('0x6')]])){utils[_0xffd8('0x1c')](util[_0xffd8('0x4')](_0xffd8('0x34'),_0x2fa44b['uniqueid']),_0x2fa44b);utils['info'](util[_0xffd8('0x4')](_0xffd8('0x35'),_0x2fa44b['uniqueid'],queues[_0x2fa44b[_0xffd8('0x6')]][_0xffd8('0x23')],_0x2fa44b[_0xffd8('0x36')],_0x2fa44b[_0xffd8('0x37')]));queues[_0x2fa44b[_0xffd8('0x6')]][_0xffd8('0x33')]=!![];queues[_0x2fa44b['uniqueid']][_0xffd8('0x1e')]=utils[_0xffd8('0x18')]();queues[_0x2fa44b[_0xffd8('0x6')]][_0xffd8('0x38')]=utils[_0xffd8('0x39')](queues[_0x2fa44b[_0xffd8('0x6')]][_0xffd8('0x1e')],queues[_0x2fa44b[_0xffd8('0x6')]][_0xffd8('0x3a')]);queues[_0x2fa44b[_0xffd8('0x6')]][_0xffd8('0x16')]=_0x2fa44b[_0xffd8('0x16')];queues[_0x2fa44b[_0xffd8('0x6')]][_0xffd8('0x3b')]=_0x2fa44b[_0xffd8('0x3b')];queues[_0x2fa44b[_0xffd8('0x6')]]['connectedlinenum']=_0x2fa44b[_0xffd8('0x36')];queues[_0x2fa44b['uniqueid']][_0xffd8('0x37')]=_0x2fa44b[_0xffd8('0x37')];}}catch(_0x568062){utils[_0xffd8('0x19')](util[_0xffd8('0x4')](_0xffd8('0x34'),_0x2fa44b[_0xffd8('0x6')]),_0x568062);}};exports[_0xffd8('0x3c')]=function(_0xec4987){try{if(!_[_0xffd8('0x1b')](queues[_0xec4987[_0xffd8('0x6')]])){utils[_0xffd8('0x1c')](util[_0xffd8('0x4')](_0xffd8('0x3d'),_0xec4987[_0xffd8('0x6')]),_0xec4987);utils[_0xffd8('0x3')](util[_0xffd8('0x4')](_0xffd8('0x3e'),_0xec4987[_0xffd8('0x6')],queues[_0xec4987[_0xffd8('0x6')]]['name'],_0xec4987[_0xffd8('0x3f')],_0xec4987[_0xffd8('0x40')]));queues[_0xec4987['uniqueid']][_0xffd8('0x1f')]=![];queues[_0xec4987[_0xffd8('0x6')]][_0xffd8('0x1f')]=![];queues[_0xec4987[_0xffd8('0x6')]]['queuecallerabandonAt']=null;queues[_0xec4987[_0xffd8('0x6')]][_0xffd8('0x20')]=![];queues[_0xec4987[_0xffd8('0x6')]][_0xffd8('0xc')]=null;queues[_0xec4987[_0xffd8('0x6')]][_0xffd8('0x29')]=null;queues[_0xec4987[_0xffd8('0x6')]][_0xffd8('0x41')]=!![];queues[_0xec4987[_0xffd8('0x6')]][_0xffd8('0xb')]=_0xec4987[_0xffd8('0x40')];queues[_0xec4987[_0xffd8('0x6')]][_0xffd8('0x9')]=_0xec4987[_0xffd8('0x3f')];}}catch(_0x13c082){utils['error'](util['format'](_0xffd8('0x3d'),_0xec4987[_0xffd8('0x6')]),_0x13c082);}};exports[_0xffd8('0x42')]=function(_0x252f0d){try{if(!_['isNil'](queues[_0x252f0d[_0xffd8('0x6')]])){if(queues[_0x252f0d[_0xffd8('0x6')]][_0xffd8('0x1e')]){utils[_0xffd8('0x1c')](util['format'](_0xffd8('0x43'),_0x252f0d[_0xffd8('0x6')]),_0x252f0d);queues[_0x252f0d[_0xffd8('0x6')]][_0xffd8('0x1f')]=![];queues[_0x252f0d['uniqueid']][_0xffd8('0x1f')]=![];queues[_0x252f0d['uniqueid']][_0xffd8('0x28')]=null;queues[_0x252f0d['uniqueid']][_0xffd8('0x20')]=![];queues[_0x252f0d[_0xffd8('0x6')]]['queuecallerexitAt']=null;queues[_0x252f0d[_0xffd8('0x6')]]['assigned']=!![];queues[_0x252f0d[_0xffd8('0x6')]]['lastAssignedTo']=_0x252f0d[_0xffd8('0x3f')];queues[_0x252f0d['uniqueid']]['queuecallercomplete']=!![];queues[_0x252f0d[_0xffd8('0x6')]][_0xffd8('0x21')]=utils[_0xffd8('0x18')]();if(_0x252f0d[_0xffd8('0x44')]=='transfer'){if(!queues[_0x252f0d[_0xffd8('0x6')]][_0xffd8('0x45')]){queues[_0x252f0d['uniqueid']]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x252f0d[_0xffd8('0x6')]][_0xffd8('0xc')]=_0xffd8('0x46')+_0x252f0d[_0xffd8('0x44')]['toUpperCase']();}utils[_0xffd8('0x3')](util['format'](_0xffd8('0x47'),_0x252f0d[_0xffd8('0x6')],queues[_0x252f0d[_0xffd8('0x6')]][_0xffd8('0x23')],_0x252f0d[_0xffd8('0x3f')],queues[_0x252f0d[_0xffd8('0x6')]][_0xffd8('0xc')]));writeDB(queues[_0x252f0d[_0xffd8('0x6')]]);}}}catch(_0x283bba){utils[_0xffd8('0x19')](util[_0xffd8('0x4')]('[%s][queues][agentcomplete]',_0x252f0d[_0xffd8('0x6')]),_0x283bba);}};exports['blindtransfer']=function(_0x57b689){try{if(!_[_0xffd8('0x1b')](queues[_0x57b689[_0xffd8('0x48')]])){utils[_0xffd8('0x1c')](util[_0xffd8('0x4')](_0xffd8('0x49'),_0x57b689[_0xffd8('0x6')]),_0x57b689);queues[_0x57b689[_0xffd8('0x48')]][_0xffd8('0x45')]=!![];queues[_0x57b689[_0xffd8('0x48')]][_0xffd8('0x4a')]=_0xffd8('0x4b');queues[_0x57b689[_0xffd8('0x48')]][_0xffd8('0x4c')]=_0x57b689[_0xffd8('0x4d')];queues[_0x57b689['transfereeuniqueid']][_0xffd8('0x4e')]=_0x57b689[_0xffd8('0x48')];queues[_0x57b689[_0xffd8('0x48')]][_0xffd8('0xc')]=_0xffd8('0x4f');utils['info'](util[_0xffd8('0x4')](_0xffd8('0x50'),_0x57b689[_0xffd8('0x6')],queues[_0x57b689['transfereeuniqueid']][_0xffd8('0x23')],_0x57b689[_0xffd8('0x48')],_0x57b689[_0xffd8('0x4d')]));}}catch(_0x5b7e74){utils[_0xffd8('0x19')](util[_0xffd8('0x4')](_0xffd8('0x49'),_0x57b689[_0xffd8('0x6')]),_0x5b7e74);}};exports[_0xffd8('0x51')]=function(_0x120f79){try{utils[_0xffd8('0x1c')](util['format'](_0xffd8('0x52'),_0x120f79[_0xffd8('0x53')]),_0x120f79);if(_0x120f79[_0xffd8('0x53')]==_0x120f79['origtransfererlinkedid']){if(!_[_0xffd8('0x1b')](queues[_0x120f79[_0xffd8('0x54')]])){utils['info'](util[_0xffd8('0x4')](_0xffd8('0x55'),_0x120f79['origtransfereruniqueid'],queues[_0x120f79['secondtransfererlinkedid']][_0xffd8('0x23')],_0x120f79[_0xffd8('0x56')]));queues[_0x120f79[_0xffd8('0x54')]][_0xffd8('0x45')]=!![];queues[_0x120f79[_0xffd8('0x54')]]['transfertype']='ATTENDED';queues[_0x120f79[_0xffd8('0x54')]][_0xffd8('0x4c')]=_0x120f79[_0xffd8('0x56')];queues[_0x120f79[_0xffd8('0x54')]][_0xffd8('0x4e')]=_0x120f79[_0xffd8('0x53')];queues[_0x120f79[_0xffd8('0x54')]]['queuecallerexitreason']=_0xffd8('0x57');}if(!_[_0xffd8('0x1b')](queues[_0x120f79['origtransfererlinkedid']])){if(_0x120f79[_0xffd8('0x58')]&&queues[_0x120f79[_0xffd8('0x58')]]){queues[_0x120f79[_0xffd8('0x58')]][_0xffd8('0x24')]=0x1;queues[_0x120f79['transfereeuniqueid']]=_['clone'](queues[_0x120f79[_0xffd8('0x58')]]);queues[_0x120f79[_0xffd8('0x48')]][_0xffd8('0x12')]=_0x120f79[_0xffd8('0x59')];queues[_0x120f79['transfereeuniqueid']][_0xffd8('0x24')]=0x2;queues[_0x120f79['transfereeuniqueid']][_0xffd8('0xa')]=queues[_0x120f79[_0xffd8('0x54')]][_0xffd8('0xa')];queues[_0x120f79[_0xffd8('0x48')]]['calleridname']=queues[_0x120f79[_0xffd8('0x54')]][_0xffd8('0x5a')];queues[_0x120f79['transfereeuniqueid']][_0xffd8('0x3a')]=utils[_0xffd8('0x18')]();queues[_0x120f79[_0xffd8('0x48')]]['queuecallerleaveAt']=utils[_0xffd8('0x18')]();queues[_0x120f79[_0xffd8('0x48')]][_0xffd8('0x38')]=0x0;queues[_0x120f79[_0xffd8('0x48')]]['mohtime']=0x0;utils[_0xffd8('0x3')](util[_0xffd8('0x4')](_0xffd8('0x5b'),_0x120f79['origtransfereruniqueid'],queues[_0x120f79[_0xffd8('0x48')]]['name'],queues[_0x120f79['transfereeuniqueid']][_0xffd8('0xa')],queues[_0x120f79[_0xffd8('0x48')]][_0xffd8('0x5a')]));}else{utils[_0xffd8('0x3')](util[_0xffd8('0x4')](_0xffd8('0x5c'),_0x120f79[_0xffd8('0x53')],queues[_0x120f79['origtransfererlinkedid']][_0xffd8('0x23')],_0x120f79[_0xffd8('0x54')]));queues[_0x120f79[_0xffd8('0x5d')]][_0xffd8('0x12')]=_0x120f79[_0xffd8('0x54')];}}}else if(_0x120f79[_0xffd8('0x5e')]==_0x120f79[_0xffd8('0x54')]){if(!_[_0xffd8('0x1b')](queues[_0x120f79[_0xffd8('0x5d')]])){utils[_0xffd8('0x3')](util[_0xffd8('0x4')](_0xffd8('0x5f'),_0x120f79[_0xffd8('0x53')],queues[_0x120f79['origtransfererlinkedid']][_0xffd8('0x23')],_0x120f79[_0xffd8('0x5e')],_0x120f79[_0xffd8('0x60')]));queues[_0x120f79[_0xffd8('0x5d')]]['transfer']=!![];queues[_0x120f79['origtransfererlinkedid']][_0xffd8('0x4a')]=_0xffd8('0x61');queues[_0x120f79[_0xffd8('0x5d')]][_0xffd8('0x4c')]=_0x120f79[_0xffd8('0x60')];queues[_0x120f79[_0xffd8('0x5d')]][_0xffd8('0x4e')]=_0x120f79[_0xffd8('0x5e')];queues[_0x120f79[_0xffd8('0x5d')]][_0xffd8('0xc')]=_0xffd8('0x57');}if(!_[_0xffd8('0x1b')](queues[_0x120f79[_0xffd8('0x54')]])){if(_0x120f79[_0xffd8('0x62')]&&queues[_0x120f79['transfertargetlinkedid']]){queues[_0x120f79[_0xffd8('0x62')]][_0xffd8('0x24')]=0x1;queues[_0x120f79[_0xffd8('0x59')]]=_[_0xffd8('0x63')](queues[_0x120f79['transfertargetlinkedid']]);queues[_0x120f79[_0xffd8('0x59')]]['transfereduniqueid']=_0x120f79['transfertargetuniqueid'];queues[_0x120f79[_0xffd8('0x59')]][_0xffd8('0x24')]=0x2;queues[_0x120f79[_0xffd8('0x59')]][_0xffd8('0xa')]=queues[_0x120f79[_0xffd8('0x5d')]][_0xffd8('0xa')];queues[_0x120f79[_0xffd8('0x59')]][_0xffd8('0x5a')]=queues[_0x120f79[_0xffd8('0x5d')]]['calleridname'];queues[_0x120f79[_0xffd8('0x59')]][_0xffd8('0x3a')]=utils[_0xffd8('0x18')]();queues[_0x120f79[_0xffd8('0x59')]][_0xffd8('0x1e')]=utils['now']();queues[_0x120f79['transfertargetuniqueid']][_0xffd8('0x38')]=0x0;queues[_0x120f79[_0xffd8('0x59')]]['mohtime']=0x0;utils[_0xffd8('0x3')](util[_0xffd8('0x4')](_0xffd8('0x64'),_0x120f79[_0xffd8('0x53')],queues[_0x120f79[_0xffd8('0x59')]][_0xffd8('0x23')],queues[_0x120f79[_0xffd8('0x59')]][_0xffd8('0x12')],queues[_0x120f79['transfertargetuniqueid']][_0xffd8('0xa')],queues[_0x120f79[_0xffd8('0x59')]][_0xffd8('0x5a')]));}else{utils[_0xffd8('0x3')](util[_0xffd8('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x120f79[_0xffd8('0x53')],queues[_0x120f79['secondtransfererlinkedid']][_0xffd8('0x23')],_0x120f79[_0xffd8('0x5d')]));queues[_0x120f79[_0xffd8('0x54')]][_0xffd8('0x12')]=_0x120f79[_0xffd8('0x5d')];}}}}catch(_0x503eb2){utils[_0xffd8('0x19')](util[_0xffd8('0x4')](_0xffd8('0x52'),_0x120f79[_0xffd8('0x53')]),_0x503eb2);}};exports[_0xffd8('0x65')]=function(_0x1f2f26){try{if(!_[_0xffd8('0x1b')](queues[_0x1f2f26[_0xffd8('0x6')]])){utils['debug'](util[_0xffd8('0x4')](_0xffd8('0x66'),_0x1f2f26['uniqueid']),_0x1f2f26);queues[_0x1f2f26['uniqueid']][_0xffd8('0x67')]=utils['now']();utils[_0xffd8('0x3')](util[_0xffd8('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1f2f26[_0xffd8('0x6')],queues[_0x1f2f26[_0xffd8('0x6')]][_0xffd8('0x23')],queues[_0x1f2f26['uniqueid']][_0xffd8('0x67')]));}}catch(_0x2ac7b6){utils[_0xffd8('0x19')](util[_0xffd8('0x4')](_0xffd8('0x66'),_0x1f2f26[_0xffd8('0x6')]),_0x2ac7b6);}};exports['musiconholdstop']=function(_0x471bc6){try{if(!_[_0xffd8('0x1b')](queues[_0x471bc6['uniqueid']])){if(!_['isNil'](queues[_0x471bc6[_0xffd8('0x6')]][_0xffd8('0x67')])){utils[_0xffd8('0x1c')](util[_0xffd8('0x4')](_0xffd8('0x68'),_0x471bc6['uniqueid']),_0x471bc6);queues[_0x471bc6[_0xffd8('0x6')]][_0xffd8('0x69')]+=utils[_0xffd8('0x39')](utils['now'](),queues[_0x471bc6[_0xffd8('0x6')]][_0xffd8('0x67')]);utils['info'](util[_0xffd8('0x4')](_0xffd8('0x6a'),_0x471bc6['uniqueid'],queues[_0x471bc6[_0xffd8('0x6')]][_0xffd8('0x23')],queues[_0x471bc6[_0xffd8('0x6')]][_0xffd8('0x69')]));delete queues[_0x471bc6[_0xffd8('0x6')]][_0xffd8('0x67')];}}}catch(_0x2d7df9){utils['error'](util[_0xffd8('0x4')]('[%s][queues][musiconholdstop]',_0x471bc6[_0xffd8('0x6')]),_0x2d7df9);}}; \ No newline at end of file +var _0x1a8a=['ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%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','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','error','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','now','queuecallerexitreason','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','debug','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x1a8a,0xe4));var _0xa1a8=function(_0x29c7ed,_0x389f4b){_0x29c7ed=_0x29c7ed-0x0;var _0x22b24d=_0x1a8a[_0x29c7ed];return _0x22b24d;};'use strict';var _=require(_0xa1a8('0x0'));var util=require('util');var utils=require(_0xa1a8('0x1'));var queues={};function writeDB(_0x36ba93){utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x4'),_0x36ba93['uniqueid'],_0x36ba93['channel'],_0x36ba93[_0xa1a8('0x5')],_0x36ba93[_0xa1a8('0x6')],_0x36ba93[_0xa1a8('0x7')],_0x36ba93[_0xa1a8('0x8')],_0x36ba93['queuecallerexitreason']));if(_0x36ba93[_0xa1a8('0x5')]){utils[_0xa1a8('0x9')](_0x36ba93[_0xa1a8('0x5')])[_0xa1a8('0xa')](function(_0x43cf95){if(_0x43cf95){_0x36ba93[_0xa1a8('0xb')]=_0x43cf95[_0xa1a8('0xb')];}utils['request'](_0xa1a8('0xc'),_0x36ba93);});}else{utils[_0xa1a8('0xd')](_0xa1a8('0xc'),_0x36ba93);}if(_0x36ba93[_0xa1a8('0xe')]){delete queues[_0x36ba93['transfereduniqueid']];}else{delete queues[_0x36ba93[_0xa1a8('0xf')]];}}exports[_0xa1a8('0x10')]=function(_0x3bff1f){try{utils['debug'](util[_0xa1a8('0x3')](_0xa1a8('0x11'),_0x3bff1f[_0xa1a8('0xf')]),_0x3bff1f);utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x12'),_0x3bff1f[_0xa1a8('0xf')],_0x3bff1f[_0xa1a8('0x5')],_0x3bff1f['position']));queues[_0x3bff1f[_0xa1a8('0xf')]]=_[_0xa1a8('0x13')](_0x3bff1f,{'originalposition':_0x3bff1f[_0xa1a8('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x26d937){utils[_0xa1a8('0x15')](util[_0xa1a8('0x3')](_0xa1a8('0x11'),_0x3bff1f[_0xa1a8('0xf')]),_0x26d937);}};exports[_0xa1a8('0x16')]=function(_0x54f4a2){try{if(!_[_0xa1a8('0x17')](queues[_0x54f4a2['uniqueid']])){utils['debug'](util['format']('[%s][queues][hangup]',_0x54f4a2[_0xa1a8('0xf')]),_0x54f4a2);if(queues[_0x54f4a2[_0xa1a8('0xf')]][_0xa1a8('0x18')]){if(!queues[_0x54f4a2[_0xa1a8('0xf')]]['queuecallerabandon']&&!queues[_0x54f4a2['uniqueid']][_0xa1a8('0x19')]){queues[_0x54f4a2[_0xa1a8('0xf')]]['queuecallercomplete']=!![];queues[_0x54f4a2[_0xa1a8('0xf')]][_0xa1a8('0x1a')]=utils[_0xa1a8('0x1b')]();queues[_0x54f4a2[_0xa1a8('0xf')]][_0xa1a8('0x1c')]='COMPLETEDBYAGENT';}utils['info'](util[_0xa1a8('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x54f4a2[_0xa1a8('0xf')],queues[_0x54f4a2[_0xa1a8('0xf')]][_0xa1a8('0x1d')],queues[_0x54f4a2[_0xa1a8('0xf')]][_0xa1a8('0x1c')]));writeDB(queues[_0x54f4a2['uniqueid']]);}else if(queues[_0x54f4a2[_0xa1a8('0xf')]][_0xa1a8('0xe')]){utils[_0xa1a8('0x2')](util['format'](_0xa1a8('0x1e'),_0x54f4a2[_0xa1a8('0xf')],queues[_0x54f4a2[_0xa1a8('0xf')]]['name'],queues[_0x54f4a2[_0xa1a8('0xf')]][_0xa1a8('0xe')]));queues[queues[_0x54f4a2['uniqueid']][_0xa1a8('0xe')]]=queues[_0x54f4a2['uniqueid']];queues[queues[_0x54f4a2[_0xa1a8('0xf')]][_0xa1a8('0xe')]][_0xa1a8('0x1f')]=0x2;delete queues[_0x54f4a2[_0xa1a8('0xf')]];}}}catch(_0x3a00f8){utils[_0xa1a8('0x15')](util[_0xa1a8('0x3')]('[%s][queues][hangup]',_0x54f4a2[_0xa1a8('0xf')]),_0x3a00f8);}};exports[_0xa1a8('0x20')]=function(_0x220068){try{utils[_0xa1a8('0x21')](util['format'](_0xa1a8('0x22'),_0x220068['uniqueid']),_0x220068);if(!_[_0xa1a8('0x17')](_0x220068[_0xa1a8('0x23')][_0xa1a8('0x24')])&&_0x220068[_0xa1a8('0x25')][_0xa1a8('0x26')]()!==_0xa1a8('0x27')){if(!_[_0xa1a8('0x17')](queues[_0x220068[_0xa1a8('0xf')]])){queues[_0x220068[_0xa1a8('0xf')]][_0xa1a8('0x28')]=![];queues[_0x220068['uniqueid']][_0xa1a8('0x29')]=null;queues[_0x220068[_0xa1a8('0xf')]][_0xa1a8('0x19')]=!![];queues[_0x220068['uniqueid']][_0xa1a8('0x2a')]=utils[_0xa1a8('0x1b')]();queues[_0x220068['uniqueid']][_0xa1a8('0x1c')]=_0x220068[_0xa1a8('0x25')][_0xa1a8('0x26')]();utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x2b'),_0x220068[_0xa1a8('0xf')],queues[_0x220068[_0xa1a8('0xf')]][_0xa1a8('0x1d')],_0x220068[_0xa1a8('0x25')],queues[_0x220068[_0xa1a8('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x220068['uniqueid']]);}}else if(!_[_0xa1a8('0x17')](_0x220068['variable'][_0xa1a8('0x2c')])){if(!_['isNil'](queues[_0x220068['uniqueid']])&&!queues[_0x220068['uniqueid']][_0xa1a8('0x28')]){queues[_0x220068[_0xa1a8('0xf')]][_0xa1a8('0x28')]=![];queues[_0x220068['uniqueid']][_0xa1a8('0x29')]=null;queues[_0x220068[_0xa1a8('0xf')]][_0xa1a8('0x19')]=!![];queues[_0x220068[_0xa1a8('0xf')]][_0xa1a8('0x2a')]=utils[_0xa1a8('0x1b')]();queues[_0x220068[_0xa1a8('0xf')]][_0xa1a8('0x1c')]='EXITWITHKEY';utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x2d'),_0x220068[_0xa1a8('0xf')],queues[_0x220068[_0xa1a8('0xf')]][_0xa1a8('0x1d')],_0x220068[_0xa1a8('0x25')],queues[_0x220068[_0xa1a8('0xf')]][_0xa1a8('0x1c')]));}}}catch(_0x248411){utils[_0xa1a8('0x15')](util[_0xa1a8('0x3')](_0xa1a8('0x22'),_0x220068['uniqueid']),_0x248411);}};exports[_0xa1a8('0x28')]=function(_0x2c7756){try{if(!_['isNil'](queues[_0x2c7756[_0xa1a8('0xf')]])){utils[_0xa1a8('0x21')](util[_0xa1a8('0x3')](_0xa1a8('0x2e'),_0x2c7756[_0xa1a8('0xf')]),_0x2c7756);queues[_0x2c7756[_0xa1a8('0xf')]][_0xa1a8('0x19')]=![];queues[_0x2c7756[_0xa1a8('0xf')]][_0xa1a8('0x2a')]=null;queues[_0x2c7756[_0xa1a8('0xf')]]['queuecallerabandon']=!![];queues[_0x2c7756[_0xa1a8('0xf')]][_0xa1a8('0x29')]=utils[_0xa1a8('0x1b')]();queues[_0x2c7756[_0xa1a8('0xf')]]['queuecallerexitreason']=_0xa1a8('0x2f');utils[_0xa1a8('0x2')](util['format'](_0xa1a8('0x30'),_0x2c7756['uniqueid'],queues[_0x2c7756[_0xa1a8('0xf')]][_0xa1a8('0x1d')],queues[_0x2c7756[_0xa1a8('0xf')]][_0xa1a8('0x1c')]));}}catch(_0x221752){utils['error'](util['format'](_0xa1a8('0x2e'),_0x2c7756[_0xa1a8('0xf')]),_0x221752);}};exports['queuecallerleave']=function(_0xcd1778){try{if(!_['isNil'](queues[_0xcd1778[_0xa1a8('0xf')]])){utils['debug'](util[_0xa1a8('0x3')](_0xa1a8('0x31'),_0xcd1778[_0xa1a8('0xf')]),_0xcd1778);utils['info'](util[_0xa1a8('0x3')](_0xa1a8('0x32'),_0xcd1778[_0xa1a8('0xf')],queues[_0xcd1778[_0xa1a8('0xf')]][_0xa1a8('0x1d')],_0xcd1778[_0xa1a8('0x33')],_0xcd1778['connectedlinename']));queues[_0xcd1778[_0xa1a8('0xf')]][_0xa1a8('0x34')]=!![];queues[_0xcd1778['uniqueid']][_0xa1a8('0x18')]=utils['now']();queues[_0xcd1778[_0xa1a8('0xf')]]['holdtime']=utils[_0xa1a8('0x35')](queues[_0xcd1778[_0xa1a8('0xf')]][_0xa1a8('0x18')],queues[_0xcd1778[_0xa1a8('0xf')]][_0xa1a8('0x36')]);queues[_0xcd1778[_0xa1a8('0xf')]]['position']=_0xcd1778[_0xa1a8('0x14')];queues[_0xcd1778[_0xa1a8('0xf')]][_0xa1a8('0x37')]=_0xcd1778[_0xa1a8('0x37')];queues[_0xcd1778[_0xa1a8('0xf')]][_0xa1a8('0x33')]=_0xcd1778['connectedlinenum'];queues[_0xcd1778[_0xa1a8('0xf')]][_0xa1a8('0x38')]=_0xcd1778[_0xa1a8('0x38')];}}catch(_0x3ff452){utils[_0xa1a8('0x15')](util['format'](_0xa1a8('0x31'),_0xcd1778[_0xa1a8('0xf')]),_0x3ff452);}};exports['agentconnect']=function(_0x8fa245){try{if(!_[_0xa1a8('0x17')](queues[_0x8fa245[_0xa1a8('0xf')]])){utils[_0xa1a8('0x21')](util[_0xa1a8('0x3')](_0xa1a8('0x39'),_0x8fa245['uniqueid']),_0x8fa245);utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x3a'),_0x8fa245[_0xa1a8('0xf')],queues[_0x8fa245[_0xa1a8('0xf')]][_0xa1a8('0x1d')],_0x8fa245[_0xa1a8('0x3b')],_0x8fa245[_0xa1a8('0x3c')]));queues[_0x8fa245['uniqueid']][_0xa1a8('0x28')]=![];queues[_0x8fa245[_0xa1a8('0xf')]][_0xa1a8('0x28')]=![];queues[_0x8fa245['uniqueid']][_0xa1a8('0x29')]=null;queues[_0x8fa245[_0xa1a8('0xf')]][_0xa1a8('0x19')]=![];queues[_0x8fa245[_0xa1a8('0xf')]][_0xa1a8('0x1c')]=null;queues[_0x8fa245[_0xa1a8('0xf')]][_0xa1a8('0x2a')]=null;queues[_0x8fa245[_0xa1a8('0xf')]]['assigned']=!![];queues[_0x8fa245['uniqueid']][_0xa1a8('0x8')]=_0x8fa245[_0xa1a8('0x3c')];queues[_0x8fa245[_0xa1a8('0xf')]][_0xa1a8('0x6')]=_0x8fa245[_0xa1a8('0x3b')];}}catch(_0x3ebae1){utils['error'](util[_0xa1a8('0x3')]('[%s][queues][agentconnect]',_0x8fa245['uniqueid']),_0x3ebae1);}};exports[_0xa1a8('0x3d')]=function(_0x4ec6f3){try{if(!_[_0xa1a8('0x17')](queues[_0x4ec6f3[_0xa1a8('0xf')]])){if(queues[_0x4ec6f3[_0xa1a8('0xf')]][_0xa1a8('0x18')]){utils[_0xa1a8('0x21')](util[_0xa1a8('0x3')]('[%s][queues][agentcomplete]',_0x4ec6f3[_0xa1a8('0xf')]),_0x4ec6f3);queues[_0x4ec6f3[_0xa1a8('0xf')]][_0xa1a8('0x28')]=![];queues[_0x4ec6f3['uniqueid']][_0xa1a8('0x28')]=![];queues[_0x4ec6f3[_0xa1a8('0xf')]]['queuecallerabandonAt']=null;queues[_0x4ec6f3[_0xa1a8('0xf')]][_0xa1a8('0x19')]=![];queues[_0x4ec6f3[_0xa1a8('0xf')]][_0xa1a8('0x2a')]=null;queues[_0x4ec6f3[_0xa1a8('0xf')]][_0xa1a8('0x3e')]=!![];queues[_0x4ec6f3[_0xa1a8('0xf')]][_0xa1a8('0x6')]=_0x4ec6f3[_0xa1a8('0x3b')];queues[_0x4ec6f3['uniqueid']]['queuecallercomplete']=!![];queues[_0x4ec6f3[_0xa1a8('0xf')]][_0xa1a8('0x1a')]=utils[_0xa1a8('0x1b')]();if(_0x4ec6f3[_0xa1a8('0x3f')]==_0xa1a8('0x40')){if(!queues[_0x4ec6f3[_0xa1a8('0xf')]][_0xa1a8('0x40')]){queues[_0x4ec6f3[_0xa1a8('0xf')]][_0xa1a8('0x1c')]=_0xa1a8('0x41');}}else{queues[_0x4ec6f3['uniqueid']][_0xa1a8('0x1c')]=_0xa1a8('0x42')+_0x4ec6f3['reason']['toUpperCase']();}utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x43'),_0x4ec6f3[_0xa1a8('0xf')],queues[_0x4ec6f3[_0xa1a8('0xf')]][_0xa1a8('0x1d')],_0x4ec6f3[_0xa1a8('0x3b')],queues[_0x4ec6f3[_0xa1a8('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x4ec6f3[_0xa1a8('0xf')]]);}}}catch(_0x166c7b){utils['error'](util[_0xa1a8('0x3')](_0xa1a8('0x44'),_0x4ec6f3[_0xa1a8('0xf')]),_0x166c7b);}};exports['blindtransfer']=function(_0x4c4ce1){try{if(!_[_0xa1a8('0x17')](queues[_0x4c4ce1[_0xa1a8('0x45')]])){utils[_0xa1a8('0x21')](util[_0xa1a8('0x3')](_0xa1a8('0x46'),_0x4c4ce1[_0xa1a8('0xf')]),_0x4c4ce1);queues[_0x4c4ce1[_0xa1a8('0x45')]][_0xa1a8('0x40')]=!![];queues[_0x4c4ce1[_0xa1a8('0x45')]][_0xa1a8('0x47')]=_0xa1a8('0x48');queues[_0x4c4ce1[_0xa1a8('0x45')]][_0xa1a8('0x49')]=_0x4c4ce1['extension'];queues[_0x4c4ce1['transfereeuniqueid']][_0xa1a8('0x4a')]=_0x4c4ce1[_0xa1a8('0x45')];queues[_0x4c4ce1[_0xa1a8('0x45')]][_0xa1a8('0x1c')]=_0xa1a8('0x4b');utils['info'](util[_0xa1a8('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x4c4ce1[_0xa1a8('0xf')],queues[_0x4c4ce1[_0xa1a8('0x45')]][_0xa1a8('0x1d')],_0x4c4ce1['transfereeuniqueid'],_0x4c4ce1[_0xa1a8('0x4c')]));}}catch(_0x231f08){utils[_0xa1a8('0x15')](util[_0xa1a8('0x3')](_0xa1a8('0x46'),_0x4c4ce1[_0xa1a8('0xf')]),_0x231f08);}};exports[_0xa1a8('0x4d')]=function(_0x47a1b8){try{utils[_0xa1a8('0x21')](util[_0xa1a8('0x3')]('[%s][queues][attendedtransfer]',_0x47a1b8[_0xa1a8('0x4e')]),_0x47a1b8);if(_0x47a1b8[_0xa1a8('0x4e')]==_0x47a1b8['origtransfererlinkedid']){if(!_[_0xa1a8('0x17')](queues[_0x47a1b8[_0xa1a8('0x4f')]])){utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x47a1b8[_0xa1a8('0x4e')],queues[_0x47a1b8[_0xa1a8('0x4f')]][_0xa1a8('0x1d')],_0x47a1b8[_0xa1a8('0x50')]));queues[_0x47a1b8[_0xa1a8('0x4f')]][_0xa1a8('0x40')]=!![];queues[_0x47a1b8[_0xa1a8('0x4f')]][_0xa1a8('0x47')]=_0xa1a8('0x51');queues[_0x47a1b8[_0xa1a8('0x4f')]]['transferexten']=_0x47a1b8[_0xa1a8('0x50')];queues[_0x47a1b8[_0xa1a8('0x4f')]][_0xa1a8('0x4a')]=_0x47a1b8[_0xa1a8('0x4e')];queues[_0x47a1b8[_0xa1a8('0x4f')]][_0xa1a8('0x1c')]=_0xa1a8('0x52');}if(!_['isNil'](queues[_0x47a1b8[_0xa1a8('0x53')]])){if(_0x47a1b8[_0xa1a8('0x54')]&&queues[_0x47a1b8[_0xa1a8('0x54')]]){queues[_0x47a1b8[_0xa1a8('0x54')]][_0xa1a8('0x1f')]=0x1;queues[_0x47a1b8['transfereeuniqueid']]=_['clone'](queues[_0x47a1b8[_0xa1a8('0x54')]]);queues[_0x47a1b8[_0xa1a8('0x45')]][_0xa1a8('0xe')]=_0x47a1b8[_0xa1a8('0x55')];queues[_0x47a1b8['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x47a1b8[_0xa1a8('0x45')]][_0xa1a8('0x7')]=queues[_0x47a1b8[_0xa1a8('0x4f')]]['calleridnum'];queues[_0x47a1b8['transfereeuniqueid']][_0xa1a8('0x56')]=queues[_0x47a1b8[_0xa1a8('0x4f')]][_0xa1a8('0x56')];queues[_0x47a1b8[_0xa1a8('0x45')]][_0xa1a8('0x36')]=utils[_0xa1a8('0x1b')]();queues[_0x47a1b8[_0xa1a8('0x45')]][_0xa1a8('0x18')]=utils[_0xa1a8('0x1b')]();queues[_0x47a1b8['transfereeuniqueid']][_0xa1a8('0x57')]=0x0;queues[_0x47a1b8[_0xa1a8('0x45')]][_0xa1a8('0x58')]=0x0;utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x59'),_0x47a1b8['origtransfereruniqueid'],queues[_0x47a1b8[_0xa1a8('0x45')]][_0xa1a8('0x1d')],queues[_0x47a1b8[_0xa1a8('0x45')]][_0xa1a8('0x7')],queues[_0x47a1b8['transfereeuniqueid']][_0xa1a8('0x56')]));}else{utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x47a1b8[_0xa1a8('0x4e')],queues[_0x47a1b8[_0xa1a8('0x53')]]['name'],_0x47a1b8[_0xa1a8('0x4f')]));queues[_0x47a1b8[_0xa1a8('0x53')]][_0xa1a8('0xe')]=_0x47a1b8['secondtransfererlinkedid'];}}}else if(_0x47a1b8[_0xa1a8('0x5a')]==_0x47a1b8[_0xa1a8('0x4f')]){if(!_[_0xa1a8('0x17')](queues[_0x47a1b8[_0xa1a8('0x53')]])){utils['info'](util[_0xa1a8('0x3')](_0xa1a8('0x5b'),_0x47a1b8[_0xa1a8('0x4e')],queues[_0x47a1b8[_0xa1a8('0x53')]][_0xa1a8('0x1d')],_0x47a1b8['secondtransfereruniqueid'],_0x47a1b8[_0xa1a8('0x5c')]));queues[_0x47a1b8[_0xa1a8('0x53')]][_0xa1a8('0x40')]=!![];queues[_0x47a1b8[_0xa1a8('0x53')]][_0xa1a8('0x47')]='ATTENDED';queues[_0x47a1b8['origtransfererlinkedid']][_0xa1a8('0x49')]=_0x47a1b8['secondtransfererexten'];queues[_0x47a1b8['origtransfererlinkedid']][_0xa1a8('0x4a')]=_0x47a1b8[_0xa1a8('0x5a')];queues[_0x47a1b8[_0xa1a8('0x53')]][_0xa1a8('0x1c')]='ATTENDEDTRANSFER';}if(!_[_0xa1a8('0x17')](queues[_0x47a1b8[_0xa1a8('0x4f')]])){if(_0x47a1b8['transfertargetlinkedid']&&queues[_0x47a1b8[_0xa1a8('0x5d')]]){queues[_0x47a1b8[_0xa1a8('0x5d')]]['queuecallerenterreason']=0x1;queues[_0x47a1b8['transfertargetuniqueid']]=_['clone'](queues[_0x47a1b8[_0xa1a8('0x5d')]]);queues[_0x47a1b8[_0xa1a8('0x55')]][_0xa1a8('0xe')]=_0x47a1b8[_0xa1a8('0x55')];queues[_0x47a1b8[_0xa1a8('0x55')]][_0xa1a8('0x1f')]=0x2;queues[_0x47a1b8[_0xa1a8('0x55')]][_0xa1a8('0x7')]=queues[_0x47a1b8[_0xa1a8('0x53')]][_0xa1a8('0x7')];queues[_0x47a1b8[_0xa1a8('0x55')]][_0xa1a8('0x56')]=queues[_0x47a1b8[_0xa1a8('0x53')]][_0xa1a8('0x56')];queues[_0x47a1b8[_0xa1a8('0x55')]][_0xa1a8('0x36')]=utils[_0xa1a8('0x1b')]();queues[_0x47a1b8[_0xa1a8('0x55')]][_0xa1a8('0x18')]=utils[_0xa1a8('0x1b')]();queues[_0x47a1b8[_0xa1a8('0x55')]]['holdtime']=0x0;queues[_0x47a1b8[_0xa1a8('0x55')]]['mohtime']=0x0;utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x5e'),_0x47a1b8[_0xa1a8('0x4e')],queues[_0x47a1b8[_0xa1a8('0x55')]][_0xa1a8('0x1d')],queues[_0x47a1b8[_0xa1a8('0x55')]][_0xa1a8('0xe')],queues[_0x47a1b8[_0xa1a8('0x55')]][_0xa1a8('0x7')],queues[_0x47a1b8[_0xa1a8('0x55')]][_0xa1a8('0x56')]));}else{utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x5f'),_0x47a1b8[_0xa1a8('0x4e')],queues[_0x47a1b8['secondtransfererlinkedid']][_0xa1a8('0x1d')],_0x47a1b8['origtransfererlinkedid']));queues[_0x47a1b8[_0xa1a8('0x4f')]][_0xa1a8('0xe')]=_0x47a1b8[_0xa1a8('0x53')];}}}}catch(_0x20dabf){utils[_0xa1a8('0x15')](util[_0xa1a8('0x3')]('[%s][queues][attendedtransfer]',_0x47a1b8[_0xa1a8('0x4e')]),_0x20dabf);}};exports[_0xa1a8('0x60')]=function(_0x25a427){try{if(!_['isNil'](queues[_0x25a427['uniqueid']])){utils[_0xa1a8('0x21')](util[_0xa1a8('0x3')](_0xa1a8('0x61'),_0x25a427[_0xa1a8('0xf')]),_0x25a427);queues[_0x25a427['uniqueid']]['musiconholdstartAt']=utils['now']();utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x62'),_0x25a427[_0xa1a8('0xf')],queues[_0x25a427[_0xa1a8('0xf')]]['name'],queues[_0x25a427[_0xa1a8('0xf')]][_0xa1a8('0x63')]));}}catch(_0x2f3544){utils[_0xa1a8('0x15')](util[_0xa1a8('0x3')](_0xa1a8('0x61'),_0x25a427[_0xa1a8('0xf')]),_0x2f3544);}};exports[_0xa1a8('0x64')]=function(_0x97ff84){try{if(!_[_0xa1a8('0x17')](queues[_0x97ff84['uniqueid']])){if(!_[_0xa1a8('0x17')](queues[_0x97ff84[_0xa1a8('0xf')]]['musiconholdstartAt'])){utils[_0xa1a8('0x21')](util[_0xa1a8('0x3')](_0xa1a8('0x65'),_0x97ff84['uniqueid']),_0x97ff84);queues[_0x97ff84[_0xa1a8('0xf')]][_0xa1a8('0x58')]+=utils[_0xa1a8('0x35')](utils[_0xa1a8('0x1b')](),queues[_0x97ff84[_0xa1a8('0xf')]][_0xa1a8('0x63')]);utils[_0xa1a8('0x2')](util[_0xa1a8('0x3')](_0xa1a8('0x66'),_0x97ff84[_0xa1a8('0xf')],queues[_0x97ff84[_0xa1a8('0xf')]][_0xa1a8('0x1d')],queues[_0x97ff84[_0xa1a8('0xf')]][_0xa1a8('0x58')]));delete queues[_0x97ff84[_0xa1a8('0xf')]][_0xa1a8('0x63')];}}}catch(_0x18da85){utils[_0xa1a8('0x15')](util[_0xa1a8('0x3')](_0xa1a8('0x65'),_0x97ff84[_0xa1a8('0xf')]),_0x18da85);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index d243210..e066ec6 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 _0x87da=['[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','variable','value','endsWith','.wav49','replace','monitors','push','error','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','transfereruniqueid','[%s][recordings][blindtransfer]','lodash','util','info','format'];(function(_0x12a145,_0x24483c){var _0x238fe7=function(_0x1277c0){while(--_0x1277c0){_0x12a145['push'](_0x12a145['shift']());}};_0x238fe7(++_0x24483c);}(_0x87da,0x169));var _0xa87d=function(_0x18027d,_0x5bd67e){_0x18027d=_0x18027d-0x0;var _0x2d6f7c=_0x87da[_0x18027d];return _0x2d6f7c;};'use strict';var _=require(_0xa87d('0x0'));var util=require(_0xa87d('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x53be28){var _0xfd7f0;utils[_0xa87d('0x2')](util[_0xa87d('0x3')](_0xa87d('0x4'),_0x53be28[_0xa87d('0x5')]));if(transfers[_0xa87d('0x6')][_0x53be28['uniqueid']]){_0xfd7f0=_0x53be28['uniqueid'];_0x53be28['uniqueid']=transfers[_0xa87d('0x6')][_0x53be28['uniqueid']][_0xa87d('0x7')];}if(_0x53be28[_0xa87d('0x8')]){utils[_0xa87d('0x9')](_0x53be28['accountcode'])[_0xa87d('0xa')](function(_0x296a1f){if(_0x296a1f){_0x53be28[_0xa87d('0xb')]=_0x296a1f[_0xa87d('0xc')];_0x53be28[_0xa87d('0xd')]=_0x296a1f['id'];}utils[_0xa87d('0xe')]('CreateVoiceRecording',_0x53be28);});}else{utils[_0xa87d('0xe')](_0xa87d('0xf'),_0x53be28);}if(_0xfd7f0)delete transfers[_0xa87d('0x6')][_0xfd7f0];}exports[_0xa87d('0x10')]=function(_0x28c080){try{utils[_0xa87d('0x11')](util[_0xa87d('0x3')](_0xa87d('0x12'),_0x28c080[_0xa87d('0x5')]),_0x28c080);if(_0x28c080[_0xa87d('0x5')]==_0x28c080[_0xa87d('0x13')]){utils[_0xa87d('0x2')](util[_0xa87d('0x3')](_0xa87d('0x14'),_0x28c080['uniqueid'],_0x28c080['context'],_0x28c080[_0xa87d('0x15')]));recordings[_0x28c080['uniqueid']]={'uniqueid':_0x28c080['uniqueid'],'accountcode':_0x28c080[_0xa87d('0x8')],'exten':_0x28c080[_0xa87d('0x15')],'context':_0x28c080[_0xa87d('0x16')],'channel':_0x28c080[_0xa87d('0x17')],'monitors':[]};}}catch(_0x5b8498){utils['error'](util[_0xa87d('0x3')](_0xa87d('0x12'),_0x28c080['uniqueid']),_0x5b8498);}};exports['newstate']=function(_0x5df9c0){try{utils[_0xa87d('0x11')](util[_0xa87d('0x3')]('[%s][recordings][newstate]',_0x5df9c0['uniqueid']),_0x5df9c0);if(!_[_0xa87d('0x18')](recordings[_0x5df9c0[_0xa87d('0x5')]])&&_0x5df9c0['channelstate']==0x6){utils[_0xa87d('0x2')](util['format'](_0xa87d('0x19'),_0x5df9c0[_0xa87d('0x5')],_0x5df9c0[_0xa87d('0x16')],_0x5df9c0[_0xa87d('0x17')]));}else if(!_[_0xa87d('0x18')](recordings[_0x5df9c0['linkedid']])&&_0x5df9c0[_0xa87d('0x1a')]==0x6&&_0x5df9c0[_0xa87d('0x16')]!=_0xa87d('0x1b')){utils[_0xa87d('0x2')](util[_0xa87d('0x3')](_0xa87d('0x1c'),_0x5df9c0['uniqueid'],_0x5df9c0[_0xa87d('0x13')],_0x5df9c0[_0xa87d('0x16')],_0x5df9c0['channel']));recordings[_0x5df9c0[_0xa87d('0x13')]][_0xa87d('0x8')]=_0x5df9c0[_0xa87d('0x8')];}}catch(_0xcb5f2d){utils['error'](util['format'](_0xa87d('0x1d'),_0x5df9c0['uniqueid']),_0xcb5f2d);}};exports[_0xa87d('0x1e')]=function(_0x536a25){try{if(!_[_0xa87d('0x18')](_0x536a25['variable'])&&!_[_0xa87d('0x18')](_0x536a25['variable'][_0xa87d('0x1f')])){utils[_0xa87d('0x11')](util[_0xa87d('0x3')](_0xa87d('0x20'),_0x536a25[_0xa87d('0x5')]),_0x536a25);utils['info'](util['format'](_0xa87d('0x21'),_0x536a25[_0xa87d('0x5')],_0x536a25[_0xa87d('0x22')],_0x536a25[_0xa87d('0x23')]));if(_[_0xa87d('0x24')](_0x536a25['value'],_0xa87d('0x25'))){_0x536a25[_0xa87d('0x23')]=_0x536a25[_0xa87d('0x23')][_0xa87d('0x26')](_0xa87d('0x25'),'.WAV');}if(recordings[_0x536a25[_0xa87d('0x13')]]){var _0x6dbfff=_['find'](recordings[_0x536a25['linkedid']][_0xa87d('0x27')],{'value':_0x536a25[_0xa87d('0x23')]});if(_['isNil'](_0x6dbfff)){recordings[_0x536a25[_0xa87d('0x13')]]['monitors'][_0xa87d('0x28')]({'value':_0x536a25['value']});}}}}catch(_0x1fc6e7){utils[_0xa87d('0x29')](util['format'](_0xa87d('0x20'),_0x536a25[_0xa87d('0x5')]),_0x1fc6e7);}};exports[_0xa87d('0x2a')]=function(_0x4c08a3){try{if(!_[_0xa87d('0x18')](recordings[_0x4c08a3[_0xa87d('0x5')]])){utils[_0xa87d('0x11')](util[_0xa87d('0x3')](_0xa87d('0x2b'),_0x4c08a3['uniqueid']),_0x4c08a3);utils['info'](util[_0xa87d('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4c08a3[_0xa87d('0x5')],_0x4c08a3['calleridnum'],_0x4c08a3[_0xa87d('0x2c')],_0x4c08a3[_0xa87d('0x2d')]));recordings[_0x4c08a3[_0xa87d('0x5')]][_0xa87d('0x2e')]=_0x4c08a3[_0xa87d('0x2e')];recordings[_0x4c08a3['uniqueid']][_0xa87d('0x2c')]=_0x4c08a3['calleridname'];recordings[_0x4c08a3[_0xa87d('0x5')]][_0xa87d('0x2f')]=_0x4c08a3[_0xa87d('0x2f')];recordings[_0x4c08a3[_0xa87d('0x5')]][_0xa87d('0x30')]=_0x4c08a3[_0xa87d('0x30')];if(recordings[_0x4c08a3[_0xa87d('0x5')]][_0xa87d('0x31')]==_0xa87d('0x32')&&recordings[_0x4c08a3[_0xa87d('0x5')]][_0xa87d('0x8')]){recordings[_0x4c08a3['uniqueid']][_0xa87d('0x2f')]=recordings[_0x4c08a3['uniqueid']][_0xa87d('0x8')];recordings[_0x4c08a3[_0xa87d('0x5')]]['connectedlinename']='';}recordings[_0x4c08a3['uniqueid']][_0xa87d('0x27')]['forEach'](function(_0x15c68a){var _0x2b7812=_['clone'](recordings[_0x4c08a3[_0xa87d('0x5')]]);_0x2b7812[_0xa87d('0x23')]=_0x15c68a[_0xa87d('0x23')];writeDB(_0x2b7812);});delete recordings[_0x4c08a3['uniqueid']];}}catch(_0x307047){utils[_0xa87d('0x29')](util['format'](_0xa87d('0x2b'),_0x4c08a3[_0xa87d('0x5')]),_0x307047);}};exports[_0xa87d('0x33')]=function(_0x5604f4){try{if(!_['isNil'](recordings[_0x5604f4[_0xa87d('0x5')]])){utils['debug'](util['format'](_0xa87d('0x34'),_0x5604f4['uniqueid']),_0x5604f4);utils['info'](util[_0xa87d('0x3')](_0xa87d('0x35'),_0x5604f4[_0xa87d('0x5')],_0x5604f4['application'],_0x5604f4[_0xa87d('0x36')]));if(_0x5604f4[_0xa87d('0x37')][_0xa87d('0x38')]()==_0xa87d('0x39')&&_[_0xa87d('0x3a')](_0x5604f4['appdata'][_0xa87d('0x38')](),_0xa87d('0x3b'))){var _0x1a0597=_0x5604f4[_0xa87d('0x36')][_0xa87d('0x3c')]('=');var _0x3b975d=_0x1a0597[0x0][_0xa87d('0x3d')](_0x1a0597[0x0][_0xa87d('0x3e')]('(')+0x1,_0x1a0597[0x0]['lastIndexOf'](')'));var _0x22ea8b=_0x1a0597[0x1];recordings[_0x5604f4[_0xa87d('0x5')]][_0x3b975d]=_0x22ea8b;}}}catch(_0x401d6e){utils['error'](util[_0xa87d('0x3')]('[%s][recordings][newexten]',_0x5604f4['uniqueid']),_0x401d6e);}};exports[_0xa87d('0x3f')]=function(_0x441e07){try{if(!_[_0xa87d('0x18')](recordings[_0x441e07[_0xa87d('0x5')]])){utils[_0xa87d('0x11')](util[_0xa87d('0x3')]('[%s][recordings][queuecallerjoin]',_0x441e07['uniqueid']),_0x441e07);utils[_0xa87d('0x2')](util[_0xa87d('0x3')](_0xa87d('0x40'),_0x441e07['uniqueid'],_0x441e07['queue']));recordings[_0x441e07[_0xa87d('0x5')]][_0xa87d('0x41')]=_0x441e07[_0xa87d('0x41')];}}catch(_0x1994ea){utils[_0xa87d('0x29')](util[_0xa87d('0x3')](_0xa87d('0x42'),_0x441e07[_0xa87d('0x5')]),_0x1994ea);}};exports[_0xa87d('0x43')]=function(_0x7156ec){try{utils[_0xa87d('0x11')](util[_0xa87d('0x3')]('[%s][recordings][blindtransfer]',_0x7156ec[_0xa87d('0x5')]),_0x7156ec);utils[_0xa87d('0x2')](util[_0xa87d('0x3')](_0xa87d('0x44'),_0x7156ec[_0xa87d('0x5')],_0x7156ec[_0xa87d('0x45')],_0x7156ec['transferercalleridname'],_0x7156ec['transfereecalleridnum'],_0x7156ec[_0xa87d('0x46')]));if(recordings[_0x7156ec[_0xa87d('0x47')]]&&transfers[_0xa87d('0x6')][_0x7156ec[_0xa87d('0x47')]]){transfers[_0xa87d('0x6')][_0x7156ec['transfereruniqueid']]['recording']=!![];}}catch(_0x4930d5){utils[_0xa87d('0x29')](util[_0xa87d('0x3')](_0xa87d('0x48'),_0x7156ec[_0xa87d('0x5')]),_0x4930d5);}}; \ No newline at end of file +var _0x6f3d=['isNil','info','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','util','./utils','./transfers.controller','format','uniqueid','blinds','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate'];(function(_0xcbe37,_0x4906f3){var _0x3a317c=function(_0x597367){while(--_0x597367){_0xcbe37['push'](_0xcbe37['shift']());}};_0x3a317c(++_0x4906f3);}(_0x6f3d,0x10a));var _0xd6f3=function(_0xb6afe,_0x38671f){_0xb6afe=_0xb6afe-0x0;var _0x335218=_0x6f3d[_0xb6afe];return _0x335218;};'use strict';var _=require('lodash');var util=require(_0xd6f3('0x0'));var utils=require(_0xd6f3('0x1'));var transfers=require(_0xd6f3('0x2'));var recordings={};function writeDB(_0x438ce4){var _0x4a9843;utils['info'](util[_0xd6f3('0x3')]('[%s][recordings][writeDB]',_0x438ce4[_0xd6f3('0x4')]));if(transfers[_0xd6f3('0x5')][_0x438ce4[_0xd6f3('0x4')]]){_0x4a9843=_0x438ce4[_0xd6f3('0x4')];_0x438ce4[_0xd6f3('0x4')]=transfers[_0xd6f3('0x5')][_0x438ce4[_0xd6f3('0x4')]]['transfereeuniqueid'];}if(_0x438ce4[_0xd6f3('0x6')]){utils[_0xd6f3('0x7')](_0x438ce4[_0xd6f3('0x6')])[_0xd6f3('0x8')](function(_0xa944cb){if(_0xa944cb){_0x438ce4['membername']=_0xa944cb[_0xd6f3('0x9')];_0x438ce4[_0xd6f3('0xa')]=_0xa944cb['id'];}utils[_0xd6f3('0xb')](_0xd6f3('0xc'),_0x438ce4);});}else{utils[_0xd6f3('0xb')](_0xd6f3('0xc'),_0x438ce4);}if(_0x4a9843)delete transfers[_0xd6f3('0x5')][_0x4a9843];}exports[_0xd6f3('0xd')]=function(_0x464d91){try{utils[_0xd6f3('0xe')](util[_0xd6f3('0x3')]('[%s][recordings][newchannel]',_0x464d91[_0xd6f3('0x4')]),_0x464d91);if(_0x464d91[_0xd6f3('0x4')]==_0x464d91['linkedid']){utils['info'](util[_0xd6f3('0x3')](_0xd6f3('0xf'),_0x464d91['uniqueid'],_0x464d91[_0xd6f3('0x10')],_0x464d91[_0xd6f3('0x11')]));recordings[_0x464d91['uniqueid']]={'uniqueid':_0x464d91[_0xd6f3('0x4')],'accountcode':_0x464d91['accountcode'],'exten':_0x464d91[_0xd6f3('0x11')],'context':_0x464d91[_0xd6f3('0x10')],'channel':_0x464d91[_0xd6f3('0x12')],'monitors':[]};}}catch(_0x330fc0){utils[_0xd6f3('0x13')](util[_0xd6f3('0x3')](_0xd6f3('0x14'),_0x464d91[_0xd6f3('0x4')]),_0x330fc0);}};exports[_0xd6f3('0x15')]=function(_0x5a1aa4){try{utils['debug'](util['format']('[%s][recordings][newstate]',_0x5a1aa4[_0xd6f3('0x4')]),_0x5a1aa4);if(!_[_0xd6f3('0x16')](recordings[_0x5a1aa4[_0xd6f3('0x4')]])&&_0x5a1aa4['channelstate']==0x6){utils[_0xd6f3('0x17')](util[_0xd6f3('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x5a1aa4[_0xd6f3('0x4')],_0x5a1aa4[_0xd6f3('0x10')],_0x5a1aa4[_0xd6f3('0x12')]));}else if(!_[_0xd6f3('0x16')](recordings[_0x5a1aa4['linkedid']])&&_0x5a1aa4['channelstate']==0x6&&_0x5a1aa4[_0xd6f3('0x10')]!=_0xd6f3('0x18')){utils[_0xd6f3('0x17')](util['format'](_0xd6f3('0x19'),_0x5a1aa4[_0xd6f3('0x4')],_0x5a1aa4['linkedid'],_0x5a1aa4[_0xd6f3('0x10')],_0x5a1aa4['channel']));recordings[_0x5a1aa4[_0xd6f3('0x1a')]]['accountcode']=_0x5a1aa4[_0xd6f3('0x6')];}}catch(_0x32e896){utils[_0xd6f3('0x13')](util[_0xd6f3('0x3')](_0xd6f3('0x1b'),_0x5a1aa4[_0xd6f3('0x4')]),_0x32e896);}};exports[_0xd6f3('0x1c')]=function(_0x5cd4e3){try{if(!_[_0xd6f3('0x16')](_0x5cd4e3['variable'])&&!_[_0xd6f3('0x16')](_0x5cd4e3[_0xd6f3('0x1d')][_0xd6f3('0x1e')])){utils['debug'](util[_0xd6f3('0x3')](_0xd6f3('0x1f'),_0x5cd4e3[_0xd6f3('0x4')]),_0x5cd4e3);utils['info'](util[_0xd6f3('0x3')](_0xd6f3('0x20'),_0x5cd4e3[_0xd6f3('0x4')],_0x5cd4e3[_0xd6f3('0x1d')],_0x5cd4e3[_0xd6f3('0x21')]));if(_['endsWith'](_0x5cd4e3['value'],_0xd6f3('0x22'))){_0x5cd4e3[_0xd6f3('0x21')]=_0x5cd4e3['value'][_0xd6f3('0x23')]('.wav49',_0xd6f3('0x24'));}if(recordings[_0x5cd4e3[_0xd6f3('0x1a')]]){var _0x2d5a78=_[_0xd6f3('0x25')](recordings[_0x5cd4e3[_0xd6f3('0x1a')]][_0xd6f3('0x26')],{'value':_0x5cd4e3[_0xd6f3('0x21')]});if(_[_0xd6f3('0x16')](_0x2d5a78)){recordings[_0x5cd4e3[_0xd6f3('0x1a')]][_0xd6f3('0x26')][_0xd6f3('0x27')]({'value':_0x5cd4e3['value']});}}}}catch(_0x562f56){utils[_0xd6f3('0x13')](util[_0xd6f3('0x3')]('[%s][recordings][varset]',_0x5cd4e3[_0xd6f3('0x4')]),_0x562f56);}};exports['hangup']=function(_0x4da351){try{if(!_[_0xd6f3('0x16')](recordings[_0x4da351[_0xd6f3('0x4')]])){utils[_0xd6f3('0xe')](util[_0xd6f3('0x3')](_0xd6f3('0x28'),_0x4da351[_0xd6f3('0x4')]),_0x4da351);utils[_0xd6f3('0x17')](util['format'](_0xd6f3('0x29'),_0x4da351['uniqueid'],_0x4da351[_0xd6f3('0x2a')],_0x4da351[_0xd6f3('0x2b')],_0x4da351[_0xd6f3('0x2c')]));recordings[_0x4da351[_0xd6f3('0x4')]]['calleridnum']=_0x4da351[_0xd6f3('0x2a')];recordings[_0x4da351[_0xd6f3('0x4')]][_0xd6f3('0x2b')]=_0x4da351[_0xd6f3('0x2b')];recordings[_0x4da351[_0xd6f3('0x4')]][_0xd6f3('0x2d')]=_0x4da351[_0xd6f3('0x2d')];recordings[_0x4da351[_0xd6f3('0x4')]][_0xd6f3('0x2e')]=_0x4da351[_0xd6f3('0x2e')];if(recordings[_0x4da351[_0xd6f3('0x4')]]['type']==_0xd6f3('0x2f')&&recordings[_0x4da351[_0xd6f3('0x4')]]['accountcode']){recordings[_0x4da351['uniqueid']]['connectedlinenum']=recordings[_0x4da351['uniqueid']][_0xd6f3('0x6')];recordings[_0x4da351[_0xd6f3('0x4')]][_0xd6f3('0x2e')]='';}recordings[_0x4da351[_0xd6f3('0x4')]][_0xd6f3('0x26')][_0xd6f3('0x30')](function(_0xf7083f){var _0xa3f2c2=_[_0xd6f3('0x31')](recordings[_0x4da351[_0xd6f3('0x4')]]);_0xa3f2c2[_0xd6f3('0x21')]=_0xf7083f[_0xd6f3('0x21')];writeDB(_0xa3f2c2);});delete recordings[_0x4da351['uniqueid']];}}catch(_0x95d5cc){utils[_0xd6f3('0x13')](util[_0xd6f3('0x3')](_0xd6f3('0x28'),_0x4da351['uniqueid']),_0x95d5cc);}};exports['newexten']=function(_0x342f0d){try{if(!_[_0xd6f3('0x16')](recordings[_0x342f0d[_0xd6f3('0x4')]])){utils['debug'](util[_0xd6f3('0x3')](_0xd6f3('0x32'),_0x342f0d[_0xd6f3('0x4')]),_0x342f0d);utils['info'](util[_0xd6f3('0x3')](_0xd6f3('0x33'),_0x342f0d[_0xd6f3('0x4')],_0x342f0d['application'],_0x342f0d[_0xd6f3('0x34')]));if(_0x342f0d[_0xd6f3('0x35')][_0xd6f3('0x36')]()=='set'&&_[_0xd6f3('0x37')](_0x342f0d[_0xd6f3('0x34')]['toLowerCase'](),_0xd6f3('0x38'))){var _0x324bcc=_0x342f0d[_0xd6f3('0x34')][_0xd6f3('0x39')]('=');var _0x9498d9=_0x324bcc[0x0][_0xd6f3('0x3a')](_0x324bcc[0x0]['lastIndexOf']('(')+0x1,_0x324bcc[0x0][_0xd6f3('0x3b')](')'));var _0xb8b8b8=_0x324bcc[0x1];recordings[_0x342f0d['uniqueid']][_0x9498d9]=_0xb8b8b8;}}}catch(_0x593d5e){utils[_0xd6f3('0x13')](util[_0xd6f3('0x3')](_0xd6f3('0x32'),_0x342f0d[_0xd6f3('0x4')]),_0x593d5e);}};exports[_0xd6f3('0x3c')]=function(_0x215410){try{if(!_['isNil'](recordings[_0x215410['uniqueid']])){utils[_0xd6f3('0xe')](util[_0xd6f3('0x3')](_0xd6f3('0x3d'),_0x215410[_0xd6f3('0x4')]),_0x215410);utils[_0xd6f3('0x17')](util[_0xd6f3('0x3')](_0xd6f3('0x3e'),_0x215410[_0xd6f3('0x4')],_0x215410[_0xd6f3('0x3f')]));recordings[_0x215410[_0xd6f3('0x4')]][_0xd6f3('0x3f')]=_0x215410[_0xd6f3('0x3f')];}}catch(_0x2a88ee){utils[_0xd6f3('0x13')](util[_0xd6f3('0x3')](_0xd6f3('0x3d'),_0x215410[_0xd6f3('0x4')]),_0x2a88ee);}};exports[_0xd6f3('0x40')]=function(_0x16812d){try{utils[_0xd6f3('0xe')](util[_0xd6f3('0x3')](_0xd6f3('0x41'),_0x16812d[_0xd6f3('0x4')]),_0x16812d);utils[_0xd6f3('0x17')](util['format'](_0xd6f3('0x42'),_0x16812d[_0xd6f3('0x4')],_0x16812d[_0xd6f3('0x43')],_0x16812d[_0xd6f3('0x44')],_0x16812d[_0xd6f3('0x45')],_0x16812d[_0xd6f3('0x46')]));if(recordings[_0x16812d[_0xd6f3('0x47')]]&&transfers['blinds'][_0x16812d[_0xd6f3('0x47')]]){transfers[_0xd6f3('0x5')][_0x16812d[_0xd6f3('0x47')]]['recording']=!![];}}catch(_0x1539e6){utils['error'](util[_0xd6f3('0x3')](_0xd6f3('0x41'),_0x16812d['uniqueid']),_0x1539e6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b2d11bf..f6a8f84 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 _0x2238=['uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','format','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetexten','lodash','util','./utils','type','attended','origtransfereruniqueid'];(function(_0x5a5b6f,_0x561c3d){var _0x54c5a6=function(_0x2d7f8f){while(--_0x2d7f8f){_0x5a5b6f['push'](_0x5a5b6f['shift']());}};_0x54c5a6(++_0x561c3d);}(_0x2238,0x132));var _0x8223=function(_0x198014,_0x186508){_0x198014=_0x198014-0x0;var _0x3ef088=_0x2238[_0x198014];return _0x3ef088;};'use strict';var _=require(_0x8223('0x0'));var util=require(_0x8223('0x1'));var utils=require(_0x8223('0x2'));function writeDB(_0x27e8f4){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x27e8f4[_0x8223('0x3')]===_0x8223('0x4')?_0x27e8f4[_0x8223('0x5')]:_0x27e8f4[_0x8223('0x6')],_0x27e8f4[_0x8223('0x3')]));utils['request'](_0x8223('0x7'),_0x27e8f4);}exports[_0x8223('0x8')]={};exports[_0x8223('0x9')]=function(_0x57878b){try{utils['debug'](util[_0x8223('0xa')](_0x8223('0xb'),_0x57878b[_0x8223('0x6')]),_0x57878b);utils[_0x8223('0xc')](util['format'](_0x8223('0xd'),_0x57878b[_0x8223('0x6')],_0x57878b[_0x8223('0xe')],_0x57878b[_0x8223('0xf')],_0x57878b[_0x8223('0x10')],_0x57878b['transfereecalleridname']));_0x57878b[_0x8223('0x3')]=_0x8223('0x11');exports[_0x8223('0x8')][_0x57878b[_0x8223('0x12')]]=_0x57878b;writeDB(_0x57878b);}catch(_0x9760bb){utils[_0x8223('0x13')](util[_0x8223('0xa')](_0x8223('0xb'),_0x57878b['uniqueid']),_0x9760bb);}};exports[_0x8223('0x14')]=function(_0x50ee14){try{utils[_0x8223('0x15')](util[_0x8223('0xa')](_0x8223('0x16'),_0x50ee14[_0x8223('0x5')]),_0x50ee14);utils[_0x8223('0xc')](util[_0x8223('0xa')](_0x8223('0x17'),_0x50ee14['origtransfereruniqueid'],_0x50ee14[_0x8223('0x18')],_0x50ee14[_0x8223('0x19')],_0x50ee14[_0x8223('0x1a')],_0x50ee14[_0x8223('0x1b')]));_0x50ee14=_[_0x8223('0x1c')](_0x50ee14,{'transfererchannel':_0x50ee14[_0x8223('0x1d')],'transferercalleridnum':_0x50ee14['origtransferercalleridnum'],'transferercalleridname':_0x50ee14['origtransferercalleridname'],'transfererconnectedlinenum':_0x50ee14[_0x8223('0x1e')],'transfererconnectedlinename':_0x50ee14[_0x8223('0x1f')],'transfereraccountcode':_0x50ee14['origtransfereraccountcode'],'transferercontext':_0x50ee14[_0x8223('0x20')],'transfererexten':_0x50ee14[_0x8223('0x21')],'transfererlinkedid':_0x50ee14['origtransfererlinkedid'],'context':_0x50ee14[_0x8223('0x22')],'extension':_0x50ee14['origtransfererexten'],'type':_0x8223('0x4')});if(_[_0x8223('0x23')](_0x50ee14[_0x8223('0x24')])){_0x50ee14=_[_0x8223('0x1c')](_0x50ee14,{'transfereechannel':_0x50ee14[_0x8223('0x25')],'transfereecalleridnum':_0x50ee14['transfertargetcalleridnum'],'transfereecalleridname':_0x50ee14[_0x8223('0x1b')],'transfereeconnectedlinenum':_0x50ee14['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x50ee14['transfertargetconnectedlinename'],'transfereeaccountcode':_0x50ee14['transfertargetaccountcode'],'transfereecontext':_0x50ee14['transfertargetcontext'],'transfereeexten':_0x50ee14[_0x8223('0x26')],'transfereelinkedid':_0x50ee14['transfertargetlinkedid']});}writeDB(_0x50ee14);}catch(_0x2d2ece){utils['error'](util['format'](_0x8223('0x16'),_0x50ee14[_0x8223('0x5')]),_0x2d2ece);}}; \ No newline at end of file +var _0xe460=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x444a6e,_0x4b2385){var _0x2b6adb=function(_0x49f242){while(--_0x49f242){_0x444a6e['push'](_0x444a6e['shift']());}};_0x2b6adb(++_0x4b2385);}(_0xe460,0x10f));var _0x0e46=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0xe460[_0xf44d98];return _0x5ebb04;};'use strict';var _=require(_0x0e46('0x0'));var util=require(_0x0e46('0x1'));var utils=require(_0x0e46('0x2'));function writeDB(_0x54d889){utils[_0x0e46('0x3')](util[_0x0e46('0x4')](_0x0e46('0x5'),_0x54d889[_0x0e46('0x6')]===_0x0e46('0x7')?_0x54d889[_0x0e46('0x8')]:_0x54d889[_0x0e46('0x9')],_0x54d889['type']));utils[_0x0e46('0xa')](_0x0e46('0xb'),_0x54d889);}exports[_0x0e46('0xc')]={};exports[_0x0e46('0xd')]=function(_0x2726b7){try{utils[_0x0e46('0xe')](util[_0x0e46('0x4')](_0x0e46('0xf'),_0x2726b7[_0x0e46('0x9')]),_0x2726b7);utils[_0x0e46('0x3')](util[_0x0e46('0x4')](_0x0e46('0x10'),_0x2726b7[_0x0e46('0x9')],_0x2726b7['transferercalleridnum'],_0x2726b7[_0x0e46('0x11')],_0x2726b7['transfereecalleridnum'],_0x2726b7[_0x0e46('0x12')]));_0x2726b7[_0x0e46('0x6')]=_0x0e46('0x13');exports[_0x0e46('0xc')][_0x2726b7[_0x0e46('0x14')]]=_0x2726b7;writeDB(_0x2726b7);}catch(_0x3f8414){utils[_0x0e46('0x15')](util[_0x0e46('0x4')](_0x0e46('0xf'),_0x2726b7[_0x0e46('0x9')]),_0x3f8414);}};exports['attendedtransfer']=function(_0x2a0f18){try{utils[_0x0e46('0xe')](util[_0x0e46('0x4')]('[%s][transfers][attendedtransfer]',_0x2a0f18[_0x0e46('0x8')]),_0x2a0f18);utils['info'](util[_0x0e46('0x4')](_0x0e46('0x16'),_0x2a0f18[_0x0e46('0x8')],_0x2a0f18[_0x0e46('0x17')],_0x2a0f18[_0x0e46('0x18')],_0x2a0f18[_0x0e46('0x19')],_0x2a0f18['transfertargetcalleridname']));_0x2a0f18=_[_0x0e46('0x1a')](_0x2a0f18,{'transfererchannel':_0x2a0f18[_0x0e46('0x1b')],'transferercalleridnum':_0x2a0f18[_0x0e46('0x17')],'transferercalleridname':_0x2a0f18[_0x0e46('0x18')],'transfererconnectedlinenum':_0x2a0f18[_0x0e46('0x1c')],'transfererconnectedlinename':_0x2a0f18[_0x0e46('0x1d')],'transfereraccountcode':_0x2a0f18[_0x0e46('0x1e')],'transferercontext':_0x2a0f18[_0x0e46('0x1f')],'transfererexten':_0x2a0f18[_0x0e46('0x20')],'transfererlinkedid':_0x2a0f18[_0x0e46('0x21')],'context':_0x2a0f18[_0x0e46('0x22')],'extension':_0x2a0f18[_0x0e46('0x23')],'type':_0x0e46('0x7')});if(_['isNil'](_0x2a0f18[_0x0e46('0x24')])){_0x2a0f18=_[_0x0e46('0x1a')](_0x2a0f18,{'transfereechannel':_0x2a0f18['transfertargetchannel'],'transfereecalleridnum':_0x2a0f18[_0x0e46('0x19')],'transfereecalleridname':_0x2a0f18[_0x0e46('0x25')],'transfereeconnectedlinenum':_0x2a0f18[_0x0e46('0x26')],'transfereeconnectedlinename':_0x2a0f18[_0x0e46('0x27')],'transfereeaccountcode':_0x2a0f18['transfertargetaccountcode'],'transfereecontext':_0x2a0f18[_0x0e46('0x28')],'transfereeexten':_0x2a0f18['transfertargetexten'],'transfereelinkedid':_0x2a0f18[_0x0e46('0x29')]});}writeDB(_0x2a0f18);}catch(_0x4d6207){utils[_0x0e46('0x15')](util[_0x0e46('0x4')](_0x0e46('0x2a'),_0x2a0f18['origtransfereruniqueid']),_0x4d6207);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a288f86..8c3ba4d 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 _0x39dc=['[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s'];(function(_0x405474,_0x2e32b9){var _0x2a336f=function(_0x39eff4){while(--_0x39eff4){_0x405474['push'](_0x405474['shift']());}};_0x2a336f(++_0x2e32b9);}(_0x39dc,0x1bc));var _0xc39d=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0x39dc[_0x568cf0];return _0x360f81;};'use strict';var BPromise=require(_0xc39d('0x0'));var jayson=require(_0xc39d('0x1'));var moment=require(_0xc39d('0x2'));var util=require(_0xc39d('0x3'));var client=jayson['client'][_0xc39d('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0xc39d('0x5'));exports[_0xc39d('0x6')]=function(_0x1d16cb,_0x39eb94){logger[_0xc39d('0x6')](_0x1d16cb,_0x39eb94?util[_0xc39d('0x7')](_0x39eb94,{'showHidden':![],'depth':null}):'');};exports[_0xc39d('0x8')]=function(_0x22c1bc,_0x23fc96){logger['debug'](_0x22c1bc,_0x23fc96?util[_0xc39d('0x7')](_0x23fc96,{'showHidden':![],'depth':null}):'');};exports[_0xc39d('0x9')]=function(_0x4169e9,_0x3463f6){logger[_0xc39d('0x9')](_0x4169e9,_0x3463f6?util[_0xc39d('0x7')](_0x3463f6,{'showHidden':![],'depth':null}):'');};exports[_0xc39d('0xa')]=function(_0x1beeb3,_0x20870d){return client[_0xc39d('0xa')](_0x1beeb3,{'body':_0x20870d})[_0xc39d('0xb')](function(_0x558893){logger['debug'](_0xc39d('0xc'),_0x1beeb3,_0x558893?util[_0xc39d('0x7')](_0x558893,{'showHidden':![],'depth':null}):'');})[_0xc39d('0xd')](function(_0xd44acc){logger['error']('[utils][request]\x20name:%s',_0x1beeb3,_0xd44acc?util[_0xc39d('0x7')](_0xd44acc,{'showHidden':![],'depth':null}):'');});};function getUser(_0x578d4d){return client[_0xc39d('0xa')](_0xc39d('0xe'),{'options':{'raw':!![],'attributes':['id',_0xc39d('0xf'),_0xc39d('0x10'),'interface'],'where':_0x578d4d,'limit':0x1}})[_0xc39d('0xb')](function(_0x5386ce){logger[_0xc39d('0x8')]('[utils][getUser]\x20where:%s',JSON[_0xc39d('0x11')](_0x578d4d),_0x5386ce?util['inspect'](_0x5386ce,{'showHidden':![],'depth':null}):'');return _0x5386ce[_0xc39d('0x12')][_0xc39d('0x13')]?_0x5386ce['result'][0x0]:null;});}exports[_0xc39d('0x14')]=function(_0x1948aa){return new BPromise(function(_0x5b51f4,_0x31bc79){if(_0x1948aa){return getUser({'internal':_0x1948aa})[_0xc39d('0xb')](function(_0x20d46e){logger['info'](_0xc39d('0x15'),_0x1948aa,_0x20d46e?_0xc39d('0x16'):_0xc39d('0x17'));return _0x5b51f4(_0x20d46e);})[_0xc39d('0xd')](function(_0x15d728){logger[_0xc39d('0x9')](_0xc39d('0x18'),_0x15d728?util[_0xc39d('0x7')](_0x15d728,{'showHidden':![],'depth':null}):'');return _0x5b51f4(null);});}return _0x5b51f4(null);});};exports['getUserByInterface']=function(_0x3f66a7){return new BPromise(function(_0x3bedea,_0x1f5732){if(_0x3f66a7){return getUser({'interface':_0x3f66a7})['then'](function(_0x23d659){logger['info'](_0xc39d('0x19'),_0x3f66a7,_0x23d659?_0xc39d('0x16'):_0xc39d('0x17'));return _0x3bedea(_0x23d659);})[_0xc39d('0xd')](function(_0x429030){logger[_0xc39d('0x9')](_0xc39d('0x1a'),_0x429030?util[_0xc39d('0x7')](_0x429030,{'showHidden':![],'depth':null}):'');return _0x3bedea(null);});}return _0x3bedea(null);});};exports['getUserByName']=function(_0x19bf0d){return new BPromise(function(_0x45711f,_0x52dac3){if(_0x19bf0d){return getUser({'name':_0x19bf0d})[_0xc39d('0xb')](function(_0x5a85c3){logger[_0xc39d('0x6')](_0xc39d('0x1b'),_0x19bf0d,_0x5a85c3?'found':'notfound');return _0x45711f(_0x5a85c3);})['catch'](function(_0x1ff06f){logger[_0xc39d('0x9')](_0xc39d('0x1c'),_0x1ff06f?util[_0xc39d('0x7')](_0x1ff06f,{'showHidden':![],'depth':null}):'');return _0x45711f(null);});}return _0x45711f(null);});};exports[_0xc39d('0x1d')]=function(_0x22b526){return new BPromise(function(_0x1e385f,_0x142ccd){if(_0x22b526){return client['request'](_0xc39d('0x1e'),{'options':{'raw':!![],'attributes':['id','name',_0xc39d('0x1f'),_0xc39d('0x20'),_0xc39d('0x21')],'where':{'name':_0x22b526},'limit':0x1}})[_0xc39d('0xb')](function(_0x53020d){logger[_0xc39d('0x8')](_0xc39d('0x22'),_0x22b526,_0x53020d?util['inspect'](_0x53020d,{'showHidden':![],'depth':null}):'');logger['info'](_0xc39d('0x23'),_0x22b526,_0x53020d?_0xc39d('0x16'):_0xc39d('0x17'));return _0x1e385f(_0x53020d[_0xc39d('0x12')][_0xc39d('0x13')]?_0x53020d[_0xc39d('0x12')][0x0]:null);})[_0xc39d('0xd')](function(_0x57fc61){logger[_0xc39d('0x9')](_0xc39d('0x24'),_0x57fc61?util['inspect'](_0x57fc61,{'showHidden':![],'depth':null}):'');return _0x1e385f(null);});}return _0x1e385f(null);});};exports[_0xc39d('0x25')]=function(_0x2cfa53,_0x57781a){return moment(_0x2cfa53)[_0xc39d('0x26')](_0x57781a,_0xc39d('0x27'))['format'](_0xc39d('0x28'));};exports[_0xc39d('0x29')]=function(_0x49e7ca,_0x197c59){return moment(_0x49e7ca)['subtract'](_0x197c59,_0xc39d('0x27'))[_0xc39d('0x2a')](_0xc39d('0x28'));};exports[_0xc39d('0x2b')]=function(_0x45d411,_0x1ead3a){return moment(_0x45d411)['diff'](moment(_0x1ead3a),_0xc39d('0x27'));};exports[_0xc39d('0x2c')]=function(_0x5add1f,_0x1d8857){return parseInt(_0x5add1f,0xa)+parseInt(_0x1d8857,0xa);};exports[_0xc39d('0x2d')]=function(){return moment()[_0xc39d('0x2a')](_0xc39d('0x28'));};exports[_0xc39d('0x2e')]=function(_0x32b324,_0xd61cc9){if(_0xd61cc9){return moment(_0x32b324)['isAfter'](_0xd61cc9);}return!![];};exports[_0xc39d('0x2f')]=function(_0x5c1556,_0x558234){if(_0x558234){return moment(_0x5c1556)[_0xc39d('0x2f')](_0x558234);}else if(_0x5c1556){return!![];}return![];}; \ No newline at end of file +var _0x0b79=['inspect','debug','error','then','[utils][request]\x20name:%s','catch','request','GetUser','internal','interface','result','[utils][getUserByInternal]\x20internal:%s\x20%s','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','found','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','acw','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','add','format','subtractTime','subtract','diffTime','diff','seconds','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','info'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0x0b79,0xad));var _0x90b7=function(_0x217f3c,_0x5e4b0a){_0x217f3c=_0x217f3c-0x0;var _0x38d481=_0x0b79[_0x217f3c];return _0x38d481;};'use strict';var BPromise=require(_0x90b7('0x0'));var jayson=require(_0x90b7('0x1'));var moment=require(_0x90b7('0x2'));var util=require(_0x90b7('0x3'));var client=jayson['client'][_0x90b7('0x4')]({'port':0x2329});var logger=require(_0x90b7('0x5'))('xdr');exports[_0x90b7('0x6')]=function(_0x4cd6c5,_0xd50b1b){logger[_0x90b7('0x6')](_0x4cd6c5,_0xd50b1b?util[_0x90b7('0x7')](_0xd50b1b,{'showHidden':![],'depth':null}):'');};exports[_0x90b7('0x8')]=function(_0x5191fa,_0x395d27){logger[_0x90b7('0x8')](_0x5191fa,_0x395d27?util[_0x90b7('0x7')](_0x395d27,{'showHidden':![],'depth':null}):'');};exports[_0x90b7('0x9')]=function(_0x381499,_0x4d8083){logger['error'](_0x381499,_0x4d8083?util['inspect'](_0x4d8083,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x1d9c4e,_0x3d88ab){return client['request'](_0x1d9c4e,{'body':_0x3d88ab})[_0x90b7('0xa')](function(_0x5e817e){logger['debug'](_0x90b7('0xb'),_0x1d9c4e,_0x5e817e?util[_0x90b7('0x7')](_0x5e817e,{'showHidden':![],'depth':null}):'');})[_0x90b7('0xc')](function(_0x55e84f){logger[_0x90b7('0x9')](_0x90b7('0xb'),_0x1d9c4e,_0x55e84f?util['inspect'](_0x55e84f,{'showHidden':![],'depth':null}):'');});};function getUser(_0xa91d51){return client[_0x90b7('0xd')](_0x90b7('0xe'),{'options':{'raw':!![],'attributes':['id',_0x90b7('0xf'),'name',_0x90b7('0x10')],'where':_0xa91d51,'limit':0x1}})[_0x90b7('0xa')](function(_0x238ae5){logger[_0x90b7('0x8')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0xa91d51),_0x238ae5?util['inspect'](_0x238ae5,{'showHidden':![],'depth':null}):'');return _0x238ae5[_0x90b7('0x11')]['length']?_0x238ae5[_0x90b7('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0x249b90){return new BPromise(function(_0x3cefb0,_0x429c74){if(_0x249b90){return getUser({'internal':_0x249b90})[_0x90b7('0xa')](function(_0x1ca7e0){logger['info'](_0x90b7('0x12'),_0x249b90,_0x1ca7e0?'found':'notfound');return _0x3cefb0(_0x1ca7e0);})[_0x90b7('0xc')](function(_0x142aca){logger[_0x90b7('0x9')](_0x90b7('0x13'),_0x142aca?util[_0x90b7('0x7')](_0x142aca,{'showHidden':![],'depth':null}):'');return _0x3cefb0(null);});}return _0x3cefb0(null);});};exports[_0x90b7('0x14')]=function(_0x2efdf8){return new BPromise(function(_0x465715,_0x3e1b34){if(_0x2efdf8){return getUser({'interface':_0x2efdf8})[_0x90b7('0xa')](function(_0x31c512){logger[_0x90b7('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x2efdf8,_0x31c512?'found':'notfound');return _0x465715(_0x31c512);})[_0x90b7('0xc')](function(_0x52f7ef){logger['error'](_0x90b7('0x15'),_0x52f7ef?util[_0x90b7('0x7')](_0x52f7ef,{'showHidden':![],'depth':null}):'');return _0x465715(null);});}return _0x465715(null);});};exports['getUserByName']=function(_0x30207f){return new BPromise(function(_0x5a497c,_0x40aa5c){if(_0x30207f){return getUser({'name':_0x30207f})[_0x90b7('0xa')](function(_0x55e497){logger['info'](_0x90b7('0x16'),_0x30207f,_0x55e497?_0x90b7('0x17'):_0x90b7('0x18'));return _0x5a497c(_0x55e497);})[_0x90b7('0xc')](function(_0x1d3390){logger[_0x90b7('0x9')](_0x90b7('0x19'),_0x1d3390?util[_0x90b7('0x7')](_0x1d3390,{'showHidden':![],'depth':null}):'');return _0x5a497c(null);});}return _0x5a497c(null);});};exports[_0x90b7('0x1a')]=function(_0x187234){return new BPromise(function(_0x107221,_0xcdaa62){if(_0x187234){return client['request'](_0x90b7('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x90b7('0x1c'),'type',_0x90b7('0x1d'),'acwTimeout'],'where':{'name':_0x187234},'limit':0x1}})['then'](function(_0x1784e1){logger[_0x90b7('0x8')](_0x90b7('0x1e'),_0x187234,_0x1784e1?util[_0x90b7('0x7')](_0x1784e1,{'showHidden':![],'depth':null}):'');logger[_0x90b7('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x187234,_0x1784e1?_0x90b7('0x17'):_0x90b7('0x18'));return _0x107221(_0x1784e1['result'][_0x90b7('0x1f')]?_0x1784e1[_0x90b7('0x11')][0x0]:null);})[_0x90b7('0xc')](function(_0x4927ff){logger[_0x90b7('0x9')](_0x90b7('0x20'),_0x4927ff?util[_0x90b7('0x7')](_0x4927ff,{'showHidden':![],'depth':null}):'');return _0x107221(null);});}return _0x107221(null);});};exports[_0x90b7('0x21')]=function(_0x5ae0e9,_0x187790){return moment(_0x5ae0e9)[_0x90b7('0x22')](_0x187790,'seconds')[_0x90b7('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x90b7('0x24')]=function(_0x2cd554,_0x1da22c){return moment(_0x2cd554)[_0x90b7('0x25')](_0x1da22c,'seconds')[_0x90b7('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x90b7('0x26')]=function(_0x3ed5f1,_0x771ea5){return moment(_0x3ed5f1)[_0x90b7('0x27')](moment(_0x771ea5),_0x90b7('0x28'));};exports[_0x90b7('0x29')]=function(_0xc5e235,_0x3a811e){return parseInt(_0xc5e235,0xa)+parseInt(_0x3a811e,0xa);};exports[_0x90b7('0x2a')]=function(){return moment()[_0x90b7('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x90b7('0x2b')]=function(_0x5055ff,_0x383e49){if(_0x383e49){return moment(_0x5055ff)[_0x90b7('0x2b')](_0x383e49);}return!![];};exports[_0x90b7('0x2c')]=function(_0x4c8cc2,_0x98ef42){if(_0x98ef42){return moment(_0x4c8cc2)[_0x90b7('0x2c')](_0x98ef42);}else if(_0x4c8cc2){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 15fa1b9..622c4da 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 _0xd4be=['xcally','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','use','logger','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','remoteAddress','responseTime','other','agent_name','test','setupLoggers','fs-extra','express-winston','util','./loggers','./safe-template','./mask-sensitive-data','join','/var','log'];(function(_0x22789a,_0x4a1c8c){var _0xede88=function(_0x49243f){while(--_0x49243f){_0x22789a['push'](_0x22789a['shift']());}};_0xede88(++_0x4a1c8c);}(_0xd4be,0x1db));var _0xed4b=function(_0x42ecd0,_0x1f29a7){_0x42ecd0=_0x42ecd0-0x0;var _0x1ba69f=_0xd4be[_0x42ecd0];return _0x1ba69f;};var fs=require(_0xed4b('0x0'));var _=require('lodash');var ewinston=require(_0xed4b('0x1'));var path=require('path');var util=require(_0xed4b('0x2'));var fileLogger=require(_0xed4b('0x3'))['fileLogger'];var safeTemplate=require(_0xed4b('0x4'))['safeTemplate'];var maskSensitiveData=require(_0xed4b('0x5'))['maskSensitiveData'];function ClientSideLogger(){function _0x587163(_0x16405b){var _0x18e10d=path[_0xed4b('0x6')](_0xed4b('0x7'),_0xed4b('0x8'),_0xed4b('0x9'));var _0x114990=path['join'](_0xed4b('0xa'),_0x16405b[_0xed4b('0xb')]+'-'+_0x16405b[_0xed4b('0xc')]);return fs[_0xed4b('0xd')](path['join'](_0x18e10d,_0x114990))[_0xed4b('0xe')](function(){var _0x138d43=fileLogger(_0xed4b('0xa'),path[_0xed4b('0x6')](_0x18e10d,_0x114990));return _0x138d43;})[_0xed4b('0xf')](function(_0x203e9e){throw _0x203e9e;});}this['log']=function(_0x497eb0,_0x43b623,_0x47da48,_0x8fde09){return _0x587163(_0x497eb0['user'])[_0xed4b('0xe')](function(_0x1a5628){var _0x3dea27=_0x1a5628[_0x43b623];return _0x3dea27;})[_0xed4b('0xe')](function(_0xa08619){var _0xa0fed3=_0x497eb0[_0xed4b('0x10')]?_0x497eb0[_0xed4b('0x10')]['id']:_0xed4b('0x11');var _0x37c737=_0x8fde09[_0xed4b('0x12')];var _0x462b09=_0x8fde09[_0xed4b('0x13')];var _0x3cd51a=new Date(Number(_0x462b09));return _0xa08619(_0xa0fed3,_0x3cd51a,_0x47da48,_0x37c737);})[_0xed4b('0xf')](function(_0x16c177){fileLogger(_0xed4b('0xa'))[_0xed4b('0x14')](_0x16c177);});};}function setupLoggers(_0x33ff40){return new Promise(function(_0xc019ee){var _0x4f0e43=new ClientSideLogger();var _0x212046=fileLogger(_0xed4b('0x15'));var _0xecc942=fileLogger(_0xed4b('0x16'));_0x33ff40['set']('client-side-logger',_0x4f0e43);_0x33ff40[_0xed4b('0x17')](ewinston[_0xed4b('0x18')]({'winstonInstance':_0x212046,'meta':![],'statusLevels':!![],'msg':function(_0x190432,_0x1210e1){var _0x80a518='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x190432['body'])){_0x80a518+=_0xed4b('0x19');var _0xdaa97b=_0x190432[_0xed4b('0x1a')];maskSensitiveData(_0xdaa97b);}return safeTemplate(util[_0xed4b('0x1b')](_0x80a518,_0x190432[_0xed4b('0x1c')],_0x190432[_0xed4b('0x1d')][_0xed4b('0x1e')]?_0x190432[_0xed4b('0x1d')][_0xed4b('0x1e')]:_0x190432[_0xed4b('0x1f')]['remoteAddress']||_0x190432['ip'],_0x190432[_0xed4b('0x20')],_0x1210e1[_0xed4b('0x21')],_0x1210e1['responseTime'],_0x190432[_0xed4b('0x10')]?_0x190432['user']['id']:null,_0x190432[_0xed4b('0x10')]?_0x190432[_0xed4b('0x10')][_0xed4b('0xc')]:null,_0x190432[_0xed4b('0x10')]?_0x190432[_0xed4b('0x10')][_0xed4b('0xb')]:null,_0xdaa97b?util[_0xed4b('0x22')](_0xdaa97b,![],null):''));}}));_0x33ff40[_0xed4b('0x17')](ewinston[_0xed4b('0x18')]({'winstonInstance':_0xecc942,'meta':![],'statusLevels':!![],'msg':function(_0x455072,_0x49364f){var _0x3ee3f=_0xed4b('0x23');if(_0x455072[_0xed4b('0x1a')]&&_0x455072[_0xed4b('0x1a')][_0xed4b('0x24')]&&_0x455072['body'][_0xed4b('0x25')]){_0x3ee3f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xed4b('0x1b')](_0x3ee3f,_0x455072[_0xed4b('0x1c')],_0x455072[_0xed4b('0x1d')][_0xed4b('0x1e')]?_0x455072[_0xed4b('0x1d')][_0xed4b('0x1e')]:_0x455072['connection'][_0xed4b('0x26')]||_0x455072['ip'],_0x455072[_0xed4b('0x20')],_0x49364f[_0xed4b('0x21')],_0x49364f[_0xed4b('0x27')],_0x455072[_0xed4b('0x10')]?_0x455072[_0xed4b('0x10')]['id']:null,_0x455072['user']?_0x455072[_0xed4b('0x10')][_0xed4b('0xc')]:null,_0x455072['user']?_0x455072[_0xed4b('0x10')][_0xed4b('0xb')]:null,_0x455072[_0xed4b('0x1a')]&&_0x455072[_0xed4b('0x1a')][_0xed4b('0x24')]?_0x455072[_0xed4b('0x1a')][_0xed4b('0x24')]:_0xed4b('0x28'),_0x455072['body']&&_0x455072[_0xed4b('0x1a')][_0xed4b('0x25')]?_0x455072['body'][_0xed4b('0x25')]:'',_0x455072[_0xed4b('0x1a')]&&_0x455072[_0xed4b('0x1a')]['agent_name']?_0x455072[_0xed4b('0x1a')][_0xed4b('0x29')]:'');},'ignoreRoute':function(_0x5c9859){var _0x2c8869=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2c8869[_0xed4b('0x2a')](_0x5c9859[_0xed4b('0x20')]);}}));return _0xc019ee();});}exports[_0xed4b('0x2b')]=setupLoggers; \ No newline at end of file +var _0x6abb=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','other','agent_name','test','setupLoggers','lodash','./loggers','./safe-template','log','xcally','join','client','role','name','ensureDir','then','catch','user','data','timestamp','error','api','auth','set','client-side-logger','use','logger'];(function(_0x12ff5b,_0x172439){var _0x583db3=function(_0x4d0583){while(--_0x4d0583){_0x12ff5b['push'](_0x12ff5b['shift']());}};_0x583db3(++_0x172439);}(_0x6abb,0x92));var _0xb6ab=function(_0x39efee,_0x186dbf){_0x39efee=_0x39efee-0x0;var _0x1dc02c=_0x6abb[_0x39efee];return _0x1dc02c;};var fs=require('fs-extra');var _=require(_0xb6ab('0x0'));var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require(_0xb6ab('0x1'))['fileLogger'];var safeTemplate=require(_0xb6ab('0x2'))['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x403bbb(_0xc776b0){var _0x22f753=path['join']('/var',_0xb6ab('0x3'),_0xb6ab('0x4'));var _0x4e4285=path[_0xb6ab('0x5')](_0xb6ab('0x6'),_0xc776b0[_0xb6ab('0x7')]+'-'+_0xc776b0[_0xb6ab('0x8')]);return fs[_0xb6ab('0x9')](path[_0xb6ab('0x5')](_0x22f753,_0x4e4285))[_0xb6ab('0xa')](function(){var _0x586e7f=fileLogger('client',path[_0xb6ab('0x5')](_0x22f753,_0x4e4285));return _0x586e7f;})[_0xb6ab('0xb')](function(_0x32e793){throw _0x32e793;});}this[_0xb6ab('0x3')]=function(_0x58cc4e,_0x4d97d7,_0x5a7212,_0x38ec6b){return _0x403bbb(_0x58cc4e[_0xb6ab('0xc')])[_0xb6ab('0xa')](function(_0x30b6a7){var _0x25bcc2=_0x30b6a7[_0x4d97d7];return _0x25bcc2;})[_0xb6ab('0xa')](function(_0xd62e19){var _0x3945d3=_0x58cc4e['user']?_0x58cc4e[_0xb6ab('0xc')]['id']:'no-user';var _0xc4eada=_0x38ec6b[_0xb6ab('0xd')];var _0x18915a=_0x38ec6b[_0xb6ab('0xe')];var _0x4f8a03=new Date(Number(_0x18915a));return _0xd62e19(_0x3945d3,_0x4f8a03,_0x5a7212,_0xc4eada);})[_0xb6ab('0xb')](function(_0x47476a){fileLogger(_0xb6ab('0x6'))[_0xb6ab('0xf')](_0x47476a);});};}function setupLoggers(_0x23cfc0){return new Promise(function(_0x39ed4e){var _0x416f0e=new ClientSideLogger();var _0xe98eb3=fileLogger(_0xb6ab('0x10'));var _0x119c6f=fileLogger(_0xb6ab('0x11'));_0x23cfc0[_0xb6ab('0x12')](_0xb6ab('0x13'),_0x416f0e);_0x23cfc0[_0xb6ab('0x14')](ewinston[_0xb6ab('0x15')]({'winstonInstance':_0xe98eb3,'meta':![],'statusLevels':!![],'msg':function(_0x234532,_0x285b51){var _0x4b3c42=_0xb6ab('0x16');if(!_[_0xb6ab('0x17')](_0x234532[_0xb6ab('0x18')])){_0x4b3c42+=_0xb6ab('0x19');var _0x54d02b=_0x234532[_0xb6ab('0x18')];maskSensitiveData(_0x54d02b);}return safeTemplate(util[_0xb6ab('0x1a')](_0x4b3c42,_0x234532['method'],_0x234532['headers']['x-forwarded-for']?_0x234532[_0xb6ab('0x1b')][_0xb6ab('0x1c')]:_0x234532[_0xb6ab('0x1d')]['remoteAddress']||_0x234532['ip'],_0x234532[_0xb6ab('0x1e')],_0x285b51[_0xb6ab('0x1f')],_0x285b51['responseTime'],_0x234532[_0xb6ab('0xc')]?_0x234532[_0xb6ab('0xc')]['id']:null,_0x234532[_0xb6ab('0xc')]?_0x234532[_0xb6ab('0xc')]['name']:null,_0x234532[_0xb6ab('0xc')]?_0x234532[_0xb6ab('0xc')][_0xb6ab('0x7')]:null,_0x54d02b?util[_0xb6ab('0x20')](_0x54d02b,![],null):''));}}));_0x23cfc0[_0xb6ab('0x14')](ewinston[_0xb6ab('0x15')]({'winstonInstance':_0x119c6f,'meta':![],'statusLevels':!![],'msg':function(_0x25a13e,_0x371471){var _0x354a68=_0xb6ab('0x21');if(_0x25a13e[_0xb6ab('0x18')]&&_0x25a13e[_0xb6ab('0x18')][_0xb6ab('0x22')]&&_0x25a13e['body'][_0xb6ab('0x23')]){_0x354a68=_0xb6ab('0x24');}return util[_0xb6ab('0x1a')](_0x354a68,_0x25a13e['method'],_0x25a13e[_0xb6ab('0x1b')][_0xb6ab('0x1c')]?_0x25a13e[_0xb6ab('0x1b')][_0xb6ab('0x1c')]:_0x25a13e[_0xb6ab('0x1d')]['remoteAddress']||_0x25a13e['ip'],_0x25a13e[_0xb6ab('0x1e')],_0x371471[_0xb6ab('0x1f')],_0x371471[_0xb6ab('0x25')],_0x25a13e['user']?_0x25a13e[_0xb6ab('0xc')]['id']:null,_0x25a13e[_0xb6ab('0xc')]?_0x25a13e['user'][_0xb6ab('0x8')]:null,_0x25a13e[_0xb6ab('0xc')]?_0x25a13e[_0xb6ab('0xc')][_0xb6ab('0x7')]:null,_0x25a13e[_0xb6ab('0x18')]&&_0x25a13e[_0xb6ab('0x18')][_0xb6ab('0x22')]?_0x25a13e[_0xb6ab('0x18')][_0xb6ab('0x22')]:_0xb6ab('0x26'),_0x25a13e[_0xb6ab('0x18')]&&_0x25a13e[_0xb6ab('0x18')][_0xb6ab('0x23')]?_0x25a13e['body'][_0xb6ab('0x23')]:'',_0x25a13e['body']&&_0x25a13e[_0xb6ab('0x18')][_0xb6ab('0x27')]?_0x25a13e['body'][_0xb6ab('0x27')]:'');},'ignoreRoute':function(_0x228bcb){var _0x1822fb=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1822fb[_0xb6ab('0x28')](_0x228bcb['url']);}}));return _0x39ed4e();});}exports[_0xb6ab('0x29')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 40ddf23..5a6e68e 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee51=['error','%s-%s','consoleLogger','fileLogger','util','moment','winston','debugLevel','toLowerCase','info','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','format','%s-%s.log','message','{{{','}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File'];(function(_0x25d7c9,_0x883a78){var _0x343fe4=function(_0x14eb1e){while(--_0x14eb1e){_0x25d7c9['push'](_0x25d7c9['shift']());}};_0x343fe4(++_0x883a78);}(_0xee51,0x1a6));var _0x1ee5=function(_0x362ff7,_0xc3af7e){_0x362ff7=_0x362ff7-0x0;var _0xda4a22=_0xee51[_0x362ff7];return _0xda4a22;};'use strict';var path=require('path');var util=require(_0x1ee5('0x0'));var moment=require(_0x1ee5('0x1'));var winston=require(_0x1ee5('0x2'));var config=require('../config/environment');var debugLevel=config[_0x1ee5('0x3')]?config['debugLevel'][_0x1ee5('0x4')]():_0x1ee5('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':'red','warn':_0x1ee5('0x6'),'info':_0x1ee5('0x7'),'print':_0x1ee5('0x8'),'success':_0x1ee5('0x9'),'http':_0x1ee5('0xa'),'verbose':_0x1ee5('0xb'),'debug':_0x1ee5('0xc'),'silly':'bold\x20cyan'};winston[_0x1ee5('0xd')](XC_LOG_COLORS);function getLogFileName(_0x10ef6c,_0x3aacf8,_0x2bc34a){var _0xfab72=_0x10ef6c||_0x1ee5('0xe');return path[_0x1ee5('0xf')](_0xfab72,util[_0x1ee5('0x10')](_0x1ee5('0x11'),_0x3aacf8,_0x2bc34a));}function formatter(_0x32dbef,_0x4d5b0e){_0x4d5b0e[_0x1ee5('0x12')]=_0x4d5b0e[_0x1ee5('0x12')]['replace'](/@@{/g,_0x1ee5('0x13'))['replace'](/}@@/g,_0x1ee5('0x14'))['replace'](/@{/g,'{{')[_0x1ee5('0x15')](/}@/g,'}}');return util[_0x1ee5('0x10')](_0x1ee5('0x16'),moment()['format'](_0x1ee5('0x17')),_0x4d5b0e[_0x1ee5('0x18')][_0x1ee5('0x19')](),_0x32dbef,_0x4d5b0e['message']);}function fileFormat(_0x164484,_0x462036){_0x462036[_0x1ee5('0x12')]=_0x462036[_0x1ee5('0x12')][_0x1ee5('0x15')](/@@{/g,_0x1ee5('0x13'))[_0x1ee5('0x15')](/}@@/g,_0x1ee5('0x14'))[_0x1ee5('0x15')](/@{/g,'{{')[_0x1ee5('0x15')](/}@/g,'}}');var _0x3b4645=_0x462036[_0x1ee5('0x1a')]&&Object['keys'](_0x462036['meta'])[_0x1ee5('0x1b')]?'\x0a\x09'+JSON['stringify'](_0x462036[_0x1ee5('0x1a')]):'';return util[_0x1ee5('0x10')](_0x1ee5('0x1c'),moment()['format'](_0x1ee5('0x17')),_0x462036[_0x1ee5('0x18')][_0x1ee5('0x19')](),_0x164484,_0x462036[_0x1ee5('0x12')],_0x3b4645);}function consoleLogger(){var _0x5b4c0f=new winston[(_0x1ee5('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1ee5('0x1e'))][(_0x1ee5('0x1f'))]({'level':_0x1ee5('0x20'),'json':![],'formatter':function(_0x4956aa){return formatter('',_0x4956aa);}})]});return _0x5b4c0f;}function fileLogger(_0x457233,_0x2dc907){var _0x148b9a=new winston[(_0x1ee5('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1ee5('0x1e'))][(_0x1ee5('0x21'))]({'name':util['format']('%s-%s',_0x457233,_0x1ee5('0x22')),'filename':getLogFileName(_0x2dc907,_0x457233,_0x1ee5('0x22')),'level':_0x1ee5('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xe98786){return fileFormat(_0x457233,_0xe98786);}}),new winston[(_0x1ee5('0x1e'))]['File']({'name':util[_0x1ee5('0x10')](_0x1ee5('0x23'),_0x457233,debugLevel),'filename':getLogFileName(_0x2dc907,_0x457233,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x58d7f1){return fileFormat(_0x457233,_0x58d7f1);}}),new winston['transports'][(_0x1ee5('0x1f'))]({'level':_0x1ee5('0x20'),'json':![],'formatter':function(_0x63578c){return fileFormat(_0x457233,_0x63578c);}})]});return _0x148b9a;}exports[_0x1ee5('0x24')]=consoleLogger;exports[_0x1ee5('0x25')]=fileLogger; \ No newline at end of file +var _0x3a47=['winston','../config/environment','debugLevel','info','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','%s-%s.log','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','warn','File','%s-%s','error','Console','util','moment'];(function(_0x460ede,_0x185eb5){var _0x31944e=function(_0xcfe7e1){while(--_0xcfe7e1){_0x460ede['push'](_0x460ede['shift']());}};_0x31944e(++_0x185eb5);}(_0x3a47,0x166));var _0x73a4=function(_0x4a6602,_0x334010){_0x4a6602=_0x4a6602-0x0;var _0x572732=_0x3a47[_0x4a6602];return _0x572732;};'use strict';var path=require('path');var util=require(_0x73a4('0x0'));var moment=require(_0x73a4('0x1'));var winston=require(_0x73a4('0x2'));var config=require(_0x73a4('0x3'));var debugLevel=config['debugLevel']?config[_0x73a4('0x4')]['toLowerCase']():_0x73a4('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':'red','warn':_0x73a4('0x6'),'info':_0x73a4('0x7'),'print':_0x73a4('0x8'),'success':_0x73a4('0x9'),'http':_0x73a4('0xa'),'verbose':_0x73a4('0xb'),'debug':'bold\x20blue','silly':_0x73a4('0xc')};winston[_0x73a4('0xd')](XC_LOG_COLORS);function getLogFileName(_0x462cda,_0x31c942,_0x494f96){var _0x2fcc3c=_0x462cda||_0x73a4('0xe');return path['join'](_0x2fcc3c,util['format'](_0x73a4('0xf'),_0x31c942,_0x494f96));}function formatter(_0x5d016f,_0x262c52){_0x262c52[_0x73a4('0x10')]=_0x262c52[_0x73a4('0x10')]['replace'](/@@{/g,_0x73a4('0x11'))[_0x73a4('0x12')](/}@@/g,_0x73a4('0x13'))['replace'](/@{/g,'{{')[_0x73a4('0x12')](/}@/g,'}}');return util[_0x73a4('0x14')](_0x73a4('0x15'),moment()[_0x73a4('0x14')](_0x73a4('0x16')),_0x262c52[_0x73a4('0x17')][_0x73a4('0x18')](),_0x5d016f,_0x262c52['message']);}function fileFormat(_0xd48e6e,_0x184074){_0x184074['message']=_0x184074['message']['replace'](/@@{/g,'{{{')[_0x73a4('0x12')](/}@@/g,_0x73a4('0x13'))[_0x73a4('0x12')](/@{/g,'{{')[_0x73a4('0x12')](/}@/g,'}}');var _0x269a5c=_0x184074['meta']&&Object[_0x73a4('0x19')](_0x184074['meta'])[_0x73a4('0x1a')]?'\x0a\x09'+JSON[_0x73a4('0x1b')](_0x184074['meta']):'';return util[_0x73a4('0x14')](_0x73a4('0x1c'),moment()[_0x73a4('0x14')](_0x73a4('0x16')),_0x184074[_0x73a4('0x17')]['toUpperCase'](),_0xd48e6e,_0x184074[_0x73a4('0x10')],_0x269a5c);}function consoleLogger(){var _0x57a876=new winston[(_0x73a4('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x73a4('0x1e'))]['Console']({'level':_0x73a4('0x1f'),'json':![],'formatter':function(_0x4c2591){return formatter('',_0x4c2591);}})]});return _0x57a876;}function fileLogger(_0x33a18d,_0x3ff38b){var _0x3ba55e=new winston[(_0x73a4('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x73a4('0x1e'))][(_0x73a4('0x20'))]({'name':util[_0x73a4('0x14')](_0x73a4('0x21'),_0x33a18d,_0x73a4('0x22')),'filename':getLogFileName(_0x3ff38b,_0x33a18d,'error'),'level':_0x73a4('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x494405){return fileFormat(_0x33a18d,_0x494405);}}),new winston['transports'][(_0x73a4('0x20'))]({'name':util[_0x73a4('0x14')]('%s-%s',_0x33a18d,debugLevel),'filename':getLogFileName(_0x3ff38b,_0x33a18d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x184a95){return fileFormat(_0x33a18d,_0x184a95);}}),new winston['transports'][(_0x73a4('0x23'))]({'level':_0x73a4('0x1f'),'json':![],'formatter':function(_0x303916){return fileFormat(_0x33a18d,_0x303916);}})]});return _0x3ba55e;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 21cb43e..106d400 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 _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x7f6f81,_0x14118d){var _0x339fcb=function(_0x53b10f){while(--_0x53b10f){_0x7f6f81['push'](_0x7f6f81['shift']());}};_0x339fcb(++_0x14118d);}(_0xadb5,0xad));var _0x5adb=function(_0x291b58,_0x551ead){_0x291b58=_0x291b58-0x0;var _0x310762=_0xadb5[_0x291b58];return _0x310762;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}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(_0x450734,_0xcfd140){_0x450734=_0x450734-0x0;var _0x12c29d=_0x7a54[_0x450734];return _0x12c29d;};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/safe-template.js b/server/utils/safe-template.js index 92c5b42..5d74032 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 _0xda2d=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','map','isPlainObject','keys','reduce'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xda2d,0x102));var _0xdda2=function(_0x4298ad,_0x578eac){_0x4298ad=_0x4298ad-0x0;var _0x34b121=_0xda2d[_0x4298ad];return _0x34b121;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x14e970){return _0x14e970==='{{'?_0xdda2('0x0'):_0xdda2('0x1');}function safeTemplate(_0x1f1fcc){var _0x329c5e=_0x1f1fcc;if(typeof _0x1f1fcc==='string'){_0x329c5e=_0x1f1fcc['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x1f1fcc)){_0x329c5e=_0x1f1fcc[_0xdda2('0x2')](function(_0x319129){return safeTemplate(_0x319129);});}else if(_[_0xdda2('0x3')](_0x1f1fcc)){_0x329c5e=Object[_0xdda2('0x4')](_0x1f1fcc)[_0xdda2('0x5')](function(_0xf38e58,_0x2f55dc){_0xf38e58[_0x2f55dc]=safeTemplate(_0x1f1fcc[_0x2f55dc]);return _0xf38e58;},{});}return _0x329c5e;}module[_0xdda2('0x6')][_0xdda2('0x7')]=safeTemplate; \ No newline at end of file +var _0x9348=['isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map'];(function(_0x3c1f2b,_0xf517b7){var _0x34dcc5=function(_0xfbcbc3){while(--_0xfbcbc3){_0x3c1f2b['push'](_0x3c1f2b['shift']());}};_0x34dcc5(++_0xf517b7);}(_0x9348,0x10d));var _0x8934=function(_0x2f04cb,_0x58f1ab){_0x2f04cb=_0x2f04cb-0x0;var _0xd3f9a4=_0x9348[_0x2f04cb];return _0xd3f9a4;};var _=require(_0x8934('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x23f716){return _0x23f716==='{{'?_0x8934('0x1'):_0x8934('0x2');}function safeTemplate(_0x46a231){var _0x4a2577=_0x46a231;if(typeof _0x46a231===_0x8934('0x3')){_0x4a2577=_0x46a231[_0x8934('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x46a231)){_0x4a2577=_0x46a231[_0x8934('0x5')](function(_0x923aa3){return safeTemplate(_0x923aa3);});}else if(_[_0x8934('0x6')](_0x46a231)){_0x4a2577=Object[_0x8934('0x7')](_0x46a231)[_0x8934('0x8')](function(_0x3ee9b9,_0x512f30){_0x3ee9b9[_0x512f30]=safeTemplate(_0x46a231[_0x512f30]);return _0x3ee9b9;},{});}return _0x4a2577;}module[_0x8934('0x9')][_0x8934('0xa')]=safeTemplate; \ No newline at end of file